]> gitweb.factorcode.org Git - factor.git/commitdiff
Initial import first-git-commit
authorSlava Pestov <slava@factorcode.org>
Thu, 20 Sep 2007 22:09:08 +0000 (18:09 -0400)
committerSlava Pestov <slava@factorcode.org>
Thu, 20 Sep 2007 22:09:08 +0000 (18:09 -0400)
3241 files changed:
Factor.app/Contents/Info.plist
Factor.app/Contents/Resources/English.lproj/Factor.nib/info.nib
Factor.app/Contents/Resources/English.lproj/Factor.nib/keyedobjects.nib
Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/classes.nib [new file with mode: 0644]
Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/info.nib [new file with mode: 0644]
Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/keyedobjects.nib [new file with mode: 0644]
Factor.app/Contents/Resources/FRaptorMix.icns [new file with mode: 0644]
Makefile
README.txt
TODO.txt [deleted file]
apps/all.factor [deleted file]
apps/automata.factor [deleted file]
apps/benchmarks/ack.factor [deleted file]
apps/benchmarks/continuations.factor [deleted file]
apps/benchmarks/empty-loop.factor [deleted file]
apps/benchmarks/fac.factor [deleted file]
apps/benchmarks/fib.factor [deleted file]
apps/benchmarks/hashtables.factor [deleted file]
apps/benchmarks/help.factor [deleted file]
apps/benchmarks/iteration.factor [deleted file]
apps/benchmarks/load.factor [deleted file]
apps/benchmarks/prettyprint.factor [deleted file]
apps/benchmarks/reverse-complement-test-in.txt [deleted file]
apps/benchmarks/reverse-complement-test-out.txt [deleted file]
apps/benchmarks/reverse-complement.factor [deleted file]
apps/benchmarks/sort.factor [deleted file]
apps/benchmarks/strings.factor [deleted file]
apps/benchmarks/vectors.factor [deleted file]
apps/boids.factor [deleted file]
apps/factorbot.factor [deleted file]
apps/factory/README.txt [deleted file]
apps/factory/factory.factor [deleted file]
apps/factory/load.factor [deleted file]
apps/furnace-fjsc/furnace-fjsc.factor [deleted file]
apps/furnace-fjsc/load.factor [deleted file]
apps/furnace-fjsc/repl.fhtml [deleted file]
apps/furnace-pastebin/annotate-paste.fhtml [deleted file]
apps/furnace-pastebin/annotation.fhtml [deleted file]
apps/furnace-pastebin/load.factor [deleted file]
apps/furnace-pastebin/new-paste.fhtml [deleted file]
apps/furnace-pastebin/paste-list.fhtml [deleted file]
apps/furnace-pastebin/paste-summary.fhtml [deleted file]
apps/furnace-pastebin/pastebin.factor [deleted file]
apps/furnace-pastebin/show-paste.fhtml [deleted file]
apps/hexdump/hexdump.factor [deleted file]
apps/hexdump/load.factor [deleted file]
apps/hexdump/test/hexdump.factor [deleted file]
apps/lindenmayer/camera-slate.factor [deleted file]
apps/lindenmayer/camera.factor [deleted file]
apps/lindenmayer/lindenmayer.factor [deleted file]
apps/lindenmayer/load.factor [deleted file]
apps/lindenmayer/opengl.factor [deleted file]
apps/lindenmayer/turtle.factor [deleted file]
apps/lisppaste.factor [deleted file]
apps/mandel/load.factor [deleted file]
apps/mandel/mandel.factor [deleted file]
apps/mandel/tests.factor [deleted file]
apps/random-tester/load.factor [deleted file]
apps/random-tester/random-tester.factor [deleted file]
apps/random-tester/random-tester2.factor [deleted file]
apps/random-tester/random.factor [deleted file]
apps/random-tester/type.factor [deleted file]
apps/random-tester/utils.factor [deleted file]
apps/raytracer.factor [deleted file]
apps/rss/load.factor [deleted file]
apps/rss/readme.txt [deleted file]
apps/rss/rss-reader.factor [deleted file]
apps/rss/rss.factor [deleted file]
apps/space-invaders/cpu-8080.factor [deleted file]
apps/space-invaders/load.factor [deleted file]
apps/space-invaders/readme.txt [deleted file]
apps/space-invaders/space-invaders.factor [deleted file]
apps/space-invaders/tests.factor [deleted file]
apps/tetris/README.txt [deleted file]
apps/tetris/load.factor [deleted file]
apps/tetris/test/tetris-board.factor [deleted file]
apps/tetris/test/tetris-piece.factor [deleted file]
apps/tetris/test/tetris.factor [deleted file]
apps/tetris/tetris-board.factor [deleted file]
apps/tetris/tetris-colours.factor [deleted file]
apps/tetris/tetris-gadget.factor [deleted file]
apps/tetris/tetris-gl.factor [deleted file]
apps/tetris/tetris-piece.factor [deleted file]
apps/tetris/tetris.factor [deleted file]
apps/tetris/tetromino.factor [deleted file]
apps/turing.factor [deleted file]
core/alien/alien-docs.factor [new file with mode: 0644]
core/alien/alien-tests.factor [new file with mode: 0644]
core/alien/alien.factor [new file with mode: 0644]
core/alien/arrays/arrays.factor [new file with mode: 0644]
core/alien/arrays/authors.txt [new file with mode: 0644]
core/alien/arrays/summary.txt [new file with mode: 0644]
core/alien/authors.txt [new file with mode: 0644]
core/alien/c-types/authors.txt [new file with mode: 0644]
core/alien/c-types/c-types-docs.factor [new file with mode: 0644]
core/alien/c-types/c-types-tests.factor [new file with mode: 0644]
core/alien/c-types/c-types.factor [new file with mode: 0644]
core/alien/c-types/summary.txt [new file with mode: 0644]
core/alien/compiler/authors.txt [new file with mode: 0644]
core/alien/compiler/compiler.factor [new file with mode: 0644]
core/alien/compiler/summary.txt [new file with mode: 0644]
core/alien/remote-control/authors.txt [new file with mode: 0644]
core/alien/remote-control/remote-control.factor [new file with mode: 0644]
core/alien/remote-control/summary.txt [new file with mode: 0644]
core/alien/structs/authors.txt [new file with mode: 0644]
core/alien/structs/structs-docs.factor [new file with mode: 0644]
core/alien/structs/structs-tests.factor [new file with mode: 0644]
core/alien/structs/structs.factor [new file with mode: 0644]
core/alien/structs/summary.txt [new file with mode: 0644]
core/alien/summary.txt [new file with mode: 0644]
core/alien/syntax/authors.txt [new file with mode: 0644]
core/alien/syntax/summary.txt [new file with mode: 0644]
core/alien/syntax/syntax-docs.factor [new file with mode: 0644]
core/alien/syntax/syntax.factor [new file with mode: 0644]
core/alien/tags.txt [new file with mode: 0644]
core/arrays/arrays-docs.factor [new file with mode: 0644]
core/arrays/arrays-tests.factor [new file with mode: 0644]
core/arrays/arrays.factor [new file with mode: 0644]
core/arrays/authors.txt [new file with mode: 0644]
core/arrays/summary.txt [new file with mode: 0644]
core/arrays/tags.txt [new file with mode: 0644]
core/assocs/assocs-docs.factor [new file with mode: 0644]
core/assocs/assocs-tests.factor [new file with mode: 0644]
core/assocs/assocs.factor [new file with mode: 0644]
core/assocs/authors.txt [new file with mode: 0644]
core/assocs/summary.txt [new file with mode: 0644]
core/assocs/tags.txt [new file with mode: 0644]
core/bit-arrays/authors.txt [new file with mode: 0644]
core/bit-arrays/bit-arrays-docs.factor [new file with mode: 0644]
core/bit-arrays/bit-arrays-tests.factor [new file with mode: 0644]
core/bit-arrays/bit-arrays.factor [new file with mode: 0644]
core/bit-arrays/summary.txt [new file with mode: 0644]
core/bit-arrays/tags.txt [new file with mode: 0644]
core/bootstrap/boot-stage1.factor [deleted file]
core/bootstrap/boot-stage2.factor [deleted file]
core/bootstrap/compiler/authors.txt [new file with mode: 0644]
core/bootstrap/compiler/compiler.factor [new file with mode: 0644]
core/bootstrap/compiler/summary.txt [new file with mode: 0644]
core/bootstrap/help/authors.txt [new file with mode: 0644]
core/bootstrap/help/help.factor [new file with mode: 0644]
core/bootstrap/help/summary.txt [new file with mode: 0644]
core/bootstrap/image/authors.txt [new file with mode: 0644]
core/bootstrap/image/image-docs.factor [new file with mode: 0644]
core/bootstrap/image/image.factor [new file with mode: 0644]
core/bootstrap/image/summary.txt [new file with mode: 0644]
core/bootstrap/image/tags.txt [new file with mode: 0644]
core/bootstrap/init.factor [deleted file]
core/bootstrap/init.facts [deleted file]
core/bootstrap/io/authors.txt [new file with mode: 0644]
core/bootstrap/io/io.factor [new file with mode: 0644]
core/bootstrap/io/summary.txt [new file with mode: 0644]
core/bootstrap/layouts/authors.txt [new file with mode: 0644]
core/bootstrap/layouts/layouts.factor [new file with mode: 0644]
core/bootstrap/layouts/summary.txt [new file with mode: 0644]
core/bootstrap/math/math.factor [new file with mode: 0644]
core/bootstrap/math/summary.txt [new file with mode: 0644]
core/bootstrap/primitives.factor
core/bootstrap/profile-amd64.factor [deleted file]
core/bootstrap/profile-pentium4.factor [deleted file]
core/bootstrap/profile-ppc.factor [deleted file]
core/bootstrap/profile-x86.factor [deleted file]
core/bootstrap/stage1.factor [new file with mode: 0644]
core/bootstrap/stage2.factor [new file with mode: 0644]
core/bootstrap/summary.txt [new file with mode: 0644]
core/bootstrap/syntax.factor [new file with mode: 0644]
core/bootstrap/tools/authors.txt [new file with mode: 0644]
core/bootstrap/tools/summary.txt [new file with mode: 0644]
core/bootstrap/tools/tools.factor [new file with mode: 0644]
core/bootstrap/ui/authors.txt [new file with mode: 0644]
core/bootstrap/ui/summary.txt [new file with mode: 0644]
core/bootstrap/ui/tools/authors.txt [new file with mode: 0644]
core/bootstrap/ui/tools/summary.txt [new file with mode: 0644]
core/bootstrap/ui/tools/tools.factor [new file with mode: 0644]
core/bootstrap/ui/ui.factor [new file with mode: 0644]
core/byte-arrays/authors.txt [new file with mode: 0644]
core/byte-arrays/byte-arrays-docs.factor [new file with mode: 0644]
core/byte-arrays/byte-arrays.factor [new file with mode: 0644]
core/byte-arrays/summary.txt [new file with mode: 0644]
core/byte-arrays/tags.txt [new file with mode: 0644]
core/classes/authors.txt [new file with mode: 0644]
core/classes/classes-docs.factor [new file with mode: 0644]
core/classes/classes-tests.factor [new file with mode: 0644]
core/classes/classes.factor [new file with mode: 0644]
core/classes/mixin/authors.txt [new file with mode: 0644]
core/classes/mixin/mixin-docs.factor [new file with mode: 0644]
core/classes/mixin/mixin.factor [new file with mode: 0644]
core/classes/mixin/summary.txt [new file with mode: 0644]
core/classes/predicate/authors.txt [new file with mode: 0644]
core/classes/predicate/predicate-docs.factor [new file with mode: 0644]
core/classes/predicate/predicate.factor [new file with mode: 0644]
core/classes/predicate/summary.txt [new file with mode: 0644]
core/classes/summary.txt [new file with mode: 0644]
core/classes/tags.txt [new file with mode: 0644]
core/classes/union/authors.txt [new file with mode: 0644]
core/classes/union/summary.txt [new file with mode: 0644]
core/classes/union/union-docs.factor [new file with mode: 0644]
core/classes/union/union.factor [new file with mode: 0644]
core/cli.factor [deleted file]
core/collections/arrays.factor [deleted file]
core/collections/arrays.facts [deleted file]
core/collections/flatten.factor [deleted file]
core/collections/flatten.facts [deleted file]
core/collections/graphs.factor [deleted file]
core/collections/graphs.facts [deleted file]
core/collections/growable.factor [deleted file]
core/collections/growable.facts [deleted file]
core/collections/hashtables.factor [deleted file]
core/collections/hashtables.facts [deleted file]
core/collections/namespaces.factor [deleted file]
core/collections/namespaces.facts [deleted file]
core/collections/queues.factor [deleted file]
core/collections/queues.facts [deleted file]
core/collections/sbuf.factor [deleted file]
core/collections/sbuf.facts [deleted file]
core/collections/sequence-combinators.factor [deleted file]
core/collections/sequence-combinators.facts [deleted file]
core/collections/sequence-sort.factor [deleted file]
core/collections/sequence-sort.facts [deleted file]
core/collections/sequences-epilogue.factor [deleted file]
core/collections/sequences-epilogue.facts [deleted file]
core/collections/sequences.factor [deleted file]
core/collections/sequences.facts [deleted file]
core/collections/slicing.factor [deleted file]
core/collections/slicing.facts [deleted file]
core/collections/strings.factor [deleted file]
core/collections/strings.facts [deleted file]
core/collections/vectors.factor [deleted file]
core/collections/vectors.facts [deleted file]
core/collections/virtual-sequences.factor [deleted file]
core/collections/virtual-sequences.facts [deleted file]
core/combinators/authors.txt [new file with mode: 0644]
core/combinators/combinators-docs.factor [new file with mode: 0644]
core/combinators/combinators-tests.factor [new file with mode: 0644]
core/combinators/combinators.factor [new file with mode: 0644]
core/combinators/summary.txt [new file with mode: 0644]
core/command-line/authors.txt [new file with mode: 0644]
core/command-line/command-line-docs.factor [new file with mode: 0644]
core/command-line/command-line-tests.factor [new file with mode: 0644]
core/command-line/command-line.factor [new file with mode: 0644]
core/command-line/summary.txt [new file with mode: 0644]
core/compiler/alien/alien-callback.factor [deleted file]
core/compiler/alien/alien-callback.facts [deleted file]
core/compiler/alien/alien-indirect.factor [deleted file]
core/compiler/alien/alien-indirect.facts [deleted file]
core/compiler/alien/alien-invoke.factor [deleted file]
core/compiler/alien/alien-invoke.facts [deleted file]
core/compiler/alien/aliens.factor [deleted file]
core/compiler/alien/aliens.facts [deleted file]
core/compiler/alien/c-types.factor [deleted file]
core/compiler/alien/c-types.facts [deleted file]
core/compiler/alien/compiler.factor [deleted file]
core/compiler/alien/malloc.factor [deleted file]
core/compiler/alien/malloc.facts [deleted file]
core/compiler/alien/objc/load.factor [deleted file]
core/compiler/alien/objc/objc-ppc.factor [deleted file]
core/compiler/alien/objc/objc-x86.factor [deleted file]
core/compiler/alien/objc/runtime.factor [deleted file]
core/compiler/alien/objc/subclassing.factor [deleted file]
core/compiler/alien/objc/utilities.factor [deleted file]
core/compiler/alien/prettyprint.factor [deleted file]
core/compiler/alien/primitive-types.factor [deleted file]
core/compiler/alien/structs.factor [deleted file]
core/compiler/alien/structs.facts [deleted file]
core/compiler/alien/syntax.factor [deleted file]
core/compiler/alien/syntax.facts [deleted file]
core/compiler/amd64/alien.factor [deleted file]
core/compiler/amd64/architecture.factor [deleted file]
core/compiler/amd64/intrinsics.factor [deleted file]
core/compiler/amd64/load.factor [deleted file]
core/compiler/authors.txt [new file with mode: 0644]
core/compiler/compiler-docs.factor [new file with mode: 0644]
core/compiler/compiler-tests.factor [new file with mode: 0644]
core/compiler/compiler.factor
core/compiler/compiler.facts [deleted file]
core/compiler/generator/architecture.factor [deleted file]
core/compiler/generator/generator.factor [deleted file]
core/compiler/generator/templates.factor [deleted file]
core/compiler/generator/xt.factor [deleted file]
core/compiler/inference/branches.factor [deleted file]
core/compiler/inference/branches.facts [deleted file]
core/compiler/inference/dataflow.factor [deleted file]
core/compiler/inference/dataflow.facts [deleted file]
core/compiler/inference/errors.factor [deleted file]
core/compiler/inference/inference.factor [deleted file]
core/compiler/inference/inference.facts [deleted file]
core/compiler/inference/known-words.factor [deleted file]
core/compiler/inference/shuffle.factor [deleted file]
core/compiler/inference/shuffle.facts [deleted file]
core/compiler/inference/stack.factor [deleted file]
core/compiler/inference/stack.facts [deleted file]
core/compiler/inference/variables.factor [deleted file]
core/compiler/inference/words.factor [deleted file]
core/compiler/inference/words.facts [deleted file]
core/compiler/load.factor [deleted file]
core/compiler/optimizer/call-optimizers.factor [deleted file]
core/compiler/optimizer/class-infer.factor [deleted file]
core/compiler/optimizer/inline-methods.factor [deleted file]
core/compiler/optimizer/kill-literals.factor [deleted file]
core/compiler/optimizer/optimizer.factor [deleted file]
core/compiler/optimizer/specializers.factor [deleted file]
core/compiler/pentium4/intrinsics.factor [deleted file]
core/compiler/pentium4/load.factor [deleted file]
core/compiler/ppc/allot.factor [deleted file]
core/compiler/ppc/architecture.factor [deleted file]
core/compiler/ppc/assembler.factor [deleted file]
core/compiler/ppc/intrinsics.factor [deleted file]
core/compiler/ppc/load.factor [deleted file]
core/compiler/summary.txt [new file with mode: 0644]
core/compiler/tags.txt [new file with mode: 0644]
core/compiler/test/alien-objects.factor [deleted file]
core/compiler/test/alien.factor
core/compiler/test/bail-out.factor [deleted file]
core/compiler/test/callbacks.factor [deleted file]
core/compiler/test/curry.factor [new file with mode: 0644]
core/compiler/test/float.factor
core/compiler/test/generic.factor
core/compiler/test/identities.factor [deleted file]
core/compiler/test/ifte.factor
core/compiler/test/inference.factor [deleted file]
core/compiler/test/intrinsics.factor
core/compiler/test/optimizer.factor
core/compiler/test/redefine.factor [new file with mode: 0644]
core/compiler/test/simple.factor
core/compiler/test/stack-trace.factor
core/compiler/test/stack.factor [deleted file]
core/compiler/test/templates-early.factor [new file with mode: 0644]
core/compiler/test/templates.factor
core/compiler/test/tuples.factor [new file with mode: 0644]
core/compiler/x86/alien-macosx.factor [deleted file]
core/compiler/x86/alien.factor [deleted file]
core/compiler/x86/allot.factor [deleted file]
core/compiler/x86/architecture.factor [deleted file]
core/compiler/x86/assembler.factor [deleted file]
core/compiler/x86/intrinsics.factor [deleted file]
core/compiler/x86/load.factor [deleted file]
core/continuations.factor [deleted file]
core/continuations.facts [deleted file]
core/continuations/authors.txt [new file with mode: 0644]
core/continuations/continuations-docs.factor [new file with mode: 0644]
core/continuations/continuations-tests.factor [new file with mode: 0644]
core/continuations/continuations.factor [new file with mode: 0644]
core/continuations/summary.txt [new file with mode: 0644]
core/continuations/tags.txt [new file with mode: 0644]
core/cpu/architecture/architecture.factor [new file with mode: 0644]
core/cpu/architecture/authors.txt [new file with mode: 0644]
core/cpu/architecture/summary.txt [new file with mode: 0644]
core/cpu/arm/allot/allot.factor [new file with mode: 0644]
core/cpu/arm/architecture/architecture.factor [new file with mode: 0644]
core/cpu/arm/arm.factor [new file with mode: 0644]
core/cpu/arm/assembler/assembler-tests.factor [new file with mode: 0644]
core/cpu/arm/assembler/assembler.factor [new file with mode: 0644]
core/cpu/arm/authors.txt [new file with mode: 0644]
core/cpu/arm/bootstrap.factor [new file with mode: 0644]
core/cpu/arm/intrinsics/intrinsics.factor [new file with mode: 0644]
core/cpu/arm/summary.txt [new file with mode: 0644]
core/cpu/arm5/arm5.factor [new file with mode: 0644]
core/cpu/arm5/assembler/assembler.factor [new file with mode: 0644]
core/cpu/arm5/authors.txt [new file with mode: 0644]
core/cpu/arm5/intrinsics/intrinsics.factor [new file with mode: 0644]
core/cpu/arm5/summary.txt [new file with mode: 0644]
core/cpu/ppc/allot/allot.factor [new file with mode: 0644]
core/cpu/ppc/allot/authors.txt [new file with mode: 0644]
core/cpu/ppc/allot/summary.txt [new file with mode: 0644]
core/cpu/ppc/architecture/architecture.factor [new file with mode: 0644]
core/cpu/ppc/architecture/authors.txt [new file with mode: 0644]
core/cpu/ppc/architecture/summary.txt [new file with mode: 0644]
core/cpu/ppc/assembler/assembler.factor [new file with mode: 0644]
core/cpu/ppc/assembler/authors.txt [new file with mode: 0644]
core/cpu/ppc/assembler/summary.txt [new file with mode: 0644]
core/cpu/ppc/authors.txt [new file with mode: 0644]
core/cpu/ppc/bootstrap.factor [new file with mode: 0644]
core/cpu/ppc/intrinsics/intrinsics.factor [new file with mode: 0644]
core/cpu/ppc/linux/bootstrap.factor [new file with mode: 0644]
core/cpu/ppc/macosx/bootstrap.factor [new file with mode: 0644]
core/cpu/ppc/ppc.factor [new file with mode: 0644]
core/cpu/ppc/summary.txt [new file with mode: 0644]
core/cpu/summary.txt [new file with mode: 0644]
core/cpu/tags.txt [new file with mode: 0644]
core/cpu/x86/32/32.factor [new file with mode: 0644]
core/cpu/x86/32/bootstrap.factor [new file with mode: 0644]
core/cpu/x86/64/64.factor [new file with mode: 0644]
core/cpu/x86/64/authors.txt [new file with mode: 0644]
core/cpu/x86/64/bootstrap.factor [new file with mode: 0644]
core/cpu/x86/64/summary.txt [new file with mode: 0644]
core/cpu/x86/allot/allot.factor [new file with mode: 0644]
core/cpu/x86/architecture/architecture.factor [new file with mode: 0644]
core/cpu/x86/assembler/assembler-tests.factor [new file with mode: 0644]
core/cpu/x86/assembler/assembler.factor [new file with mode: 0644]
core/cpu/x86/authors.txt [new file with mode: 0644]
core/cpu/x86/intrinsics/intrinsics.factor [new file with mode: 0644]
core/cpu/x86/sse2/authors.txt [new file with mode: 0644]
core/cpu/x86/sse2/sse2.factor [new file with mode: 0644]
core/cpu/x86/sse2/summary.txt [new file with mode: 0644]
core/cpu/x86/summary.txt [new file with mode: 0644]
core/debugger.factor [deleted file]
core/debugger.facts [deleted file]
core/debugger/authors.txt [new file with mode: 0644]
core/debugger/debugger-docs.factor [new file with mode: 0644]
core/debugger/debugger.factor [new file with mode: 0644]
core/debugger/summary.txt [new file with mode: 0644]
core/definitions.factor [deleted file]
core/definitions.facts [deleted file]
core/definitions/authors.txt [new file with mode: 0644]
core/definitions/definitions-docs.factor [new file with mode: 0644]
core/definitions/definitions.factor [new file with mode: 0644]
core/definitions/summary.txt [new file with mode: 0644]
core/definitions/tags.txt [new file with mode: 0644]
core/documentation.factor [deleted file]
core/effects.factor [deleted file]
core/effects.facts [deleted file]
core/effects/authors.txt [new file with mode: 0644]
core/effects/effects-docs.factor [new file with mode: 0644]
core/effects/effects-tests.factor [new file with mode: 0644]
core/effects/effects.factor [new file with mode: 0644]
core/effects/summary.txt [new file with mode: 0644]
core/effects/tags.txt [new file with mode: 0644]
core/errors.factor [deleted file]
core/errors.facts [deleted file]
core/float-arrays/float-arrays-docs.factor [new file with mode: 0644]
core/float-arrays/float-arrays-tests.factor [new file with mode: 0644]
core/float-arrays/float-arrays.factor [new file with mode: 0644]
core/float-arrays/summary.txt [new file with mode: 0644]
core/float-arrays/tags.txt [new file with mode: 0644]
core/generator/authors.txt [new file with mode: 0644]
core/generator/fixup/authors.txt [new file with mode: 0644]
core/generator/fixup/fixup-docs.factor [new file with mode: 0644]
core/generator/fixup/fixup.factor [new file with mode: 0644]
core/generator/fixup/summary.txt [new file with mode: 0644]
core/generator/generator-docs.factor [new file with mode: 0644]
core/generator/generator.factor [new file with mode: 0644]
core/generator/registers/authors.txt [new file with mode: 0644]
core/generator/registers/registers.factor [new file with mode: 0644]
core/generator/registers/summary.txt [new file with mode: 0644]
core/generator/summary.txt [new file with mode: 0644]
core/generator/tags.txt [new file with mode: 0644]
core/generic/authors.txt [new file with mode: 0644]
core/generic/classes.factor [deleted file]
core/generic/classes.facts [deleted file]
core/generic/early-generic.factor [deleted file]
core/generic/early-generic.facts [deleted file]
core/generic/generic-docs.factor [new file with mode: 0644]
core/generic/generic-tests.factor [new file with mode: 0644]
core/generic/generic.factor
core/generic/generic.facts [deleted file]
core/generic/math-combination.factor [deleted file]
core/generic/math-combination.facts [deleted file]
core/generic/math/authors.txt [new file with mode: 0644]
core/generic/math/math-docs.factor [new file with mode: 0644]
core/generic/math/math.factor [new file with mode: 0644]
core/generic/math/summary.txt [new file with mode: 0644]
core/generic/methods.factor [deleted file]
core/generic/methods.facts [deleted file]
core/generic/slots.factor [deleted file]
core/generic/slots.facts [deleted file]
core/generic/standard-combination.factor [deleted file]
core/generic/standard-combination.facts [deleted file]
core/generic/standard/authors.txt [new file with mode: 0644]
core/generic/standard/standard-docs.factor [new file with mode: 0644]
core/generic/standard/standard.factor [new file with mode: 0644]
core/generic/standard/summary.txt [new file with mode: 0644]
core/generic/summary.txt [new file with mode: 0644]
core/generic/tags.txt [new file with mode: 0644]
core/generic/tuple.factor [deleted file]
core/generic/tuple.facts [deleted file]
core/graphs/authors.txt [new file with mode: 0644]
core/graphs/graphs-docs.factor [new file with mode: 0644]
core/graphs/graphs-tests.factor [new file with mode: 0644]
core/graphs/graphs.factor [new file with mode: 0644]
core/graphs/summary.txt [new file with mode: 0644]
core/graphs/tags.txt [new file with mode: 0644]
core/growable/authors.txt [new file with mode: 0644]
core/growable/growable-docs.factor [new file with mode: 0644]
core/growable/growable-tests.factor [new file with mode: 0644]
core/growable/growable.factor [new file with mode: 0644]
core/growable/summary.txt [new file with mode: 0644]
core/growable/tags.txt [new file with mode: 0644]
core/handbook/alien.facts [deleted file]
core/handbook/changes.facts [deleted file]
core/handbook/cli.facts [deleted file]
core/handbook/collections.facts [deleted file]
core/handbook/compiler.facts [deleted file]
core/handbook/conventions.facts [deleted file]
core/handbook/cookbook.facts [deleted file]
core/handbook/dataflow.facts [deleted file]
core/handbook/handbook.facts [deleted file]
core/handbook/hashtables.facts [deleted file]
core/handbook/help.facts [deleted file]
core/handbook/inference.facts [deleted file]
core/handbook/load.factor [deleted file]
core/handbook/math.facts [deleted file]
core/handbook/modules.facts [deleted file]
core/handbook/objects.facts [deleted file]
core/handbook/parser.facts [deleted file]
core/handbook/prettyprinter.facts [deleted file]
core/handbook/sequences.facts [deleted file]
core/handbook/streams.facts [deleted file]
core/handbook/syntax.facts [deleted file]
core/handbook/tools.facts [deleted file]
core/handbook/words.facts [deleted file]
core/hashtables/authors.txt [new file with mode: 0644]
core/hashtables/hashtables-docs.factor [new file with mode: 0644]
core/hashtables/hashtables-tests.factor [new file with mode: 0644]
core/hashtables/hashtables.factor [new file with mode: 0644]
core/hashtables/summary.txt [new file with mode: 0644]
core/hashtables/tags.txt [new file with mode: 0644]
core/help/help.factor [deleted file]
core/help/help.facts [deleted file]
core/help/load.factor [deleted file]
core/help/markup.factor [deleted file]
core/help/markup.facts [deleted file]
core/help/stylesheet.factor [deleted file]
core/help/syntax.factor [deleted file]
core/help/syntax.facts [deleted file]
core/help/test/search.factor [deleted file]
core/help/test/topics.factor [deleted file]
core/help/topics.factor [deleted file]
core/help/topics.facts [deleted file]
core/inference/authors.txt [new file with mode: 0644]
core/inference/backend/authors.txt [new file with mode: 0644]
core/inference/backend/backend-docs.factor [new file with mode: 0644]
core/inference/backend/backend.factor [new file with mode: 0644]
core/inference/backend/summary.txt [new file with mode: 0644]
core/inference/class/authors.txt [new file with mode: 0644]
core/inference/class/class-tests.factor [new file with mode: 0644]
core/inference/class/class.factor [new file with mode: 0644]
core/inference/class/summary.txt [new file with mode: 0644]
core/inference/dataflow/authors.txt [new file with mode: 0644]
core/inference/dataflow/dataflow-docs.factor [new file with mode: 0644]
core/inference/dataflow/dataflow.factor [new file with mode: 0644]
core/inference/dataflow/summary.txt [new file with mode: 0644]
core/inference/errors/authors.txt [new file with mode: 0644]
core/inference/errors/errors.factor [new file with mode: 0644]
core/inference/errors/summary.txt [new file with mode: 0644]
core/inference/inference-docs.factor [new file with mode: 0644]
core/inference/inference-tests.factor [new file with mode: 0644]
core/inference/inference.factor [new file with mode: 0644]
core/inference/known-words/authors.txt [new file with mode: 0644]
core/inference/known-words/known-words.factor [new file with mode: 0644]
core/inference/known-words/summary.txt [new file with mode: 0644]
core/inference/stack/authors.txt [new file with mode: 0644]
core/inference/stack/stack-docs.factor [new file with mode: 0644]
core/inference/stack/stack.factor [new file with mode: 0644]
core/inference/stack/summary.txt [new file with mode: 0644]
core/inference/summary.txt [new file with mode: 0644]
core/inference/tags.txt [new file with mode: 0644]
core/inference/transforms/authors.txt [new file with mode: 0644]
core/inference/transforms/summary.txt [new file with mode: 0644]
core/inference/transforms/transforms-docs.factor [new file with mode: 0644]
core/inference/transforms/transforms-tests.factor [new file with mode: 0644]
core/inference/transforms/transforms.factor [new file with mode: 0644]
core/init/authors.txt [new file with mode: 0644]
core/init/init-docs.factor [new file with mode: 0644]
core/init/init.factor [new file with mode: 0644]
core/init/summary.txt [new file with mode: 0644]
core/inspector/authors.txt [new file with mode: 0644]
core/inspector/inspector-docs.factor [new file with mode: 0644]
core/inspector/inspector-tests.factor [new file with mode: 0644]
core/inspector/inspector.factor [new file with mode: 0644]
core/inspector/summary.txt [new file with mode: 0644]
core/inspector/tags.txt [new file with mode: 0644]
core/io/authors.txt [new file with mode: 0644]
core/io/backend/authors.txt [new file with mode: 0644]
core/io/backend/backend-docs.factor [new file with mode: 0644]
core/io/backend/backend-tests.factor [new file with mode: 0644]
core/io/backend/backend.factor [new file with mode: 0644]
core/io/backend/summary.txt [new file with mode: 0644]
core/io/binary.factor [deleted file]
core/io/binary.facts [deleted file]
core/io/binary/authors.txt [new file with mode: 0644]
core/io/binary/binary-docs.factor [new file with mode: 0644]
core/io/binary/binary-tests.factor [new file with mode: 0644]
core/io/binary/binary.factor [new file with mode: 0644]
core/io/binary/summary.txt [new file with mode: 0644]
core/io/buffer/buffer.factor [deleted file]
core/io/buffer/buffer.facts [deleted file]
core/io/buffer/load.factor [deleted file]
core/io/buffer/test/buffer.factor [deleted file]
core/io/buffers/authors.txt [new file with mode: 0644]
core/io/buffers/buffers-docs.factor [new file with mode: 0644]
core/io/buffers/buffers-tests.factor [new file with mode: 0644]
core/io/buffers/buffers.factor [new file with mode: 0644]
core/io/buffers/summary.txt [new file with mode: 0644]
core/io/c-streams.factor [deleted file]
core/io/c-streams.facts [deleted file]
core/io/crc32/authors.txt [new file with mode: 0644]
core/io/crc32/crc32-docs.factor [new file with mode: 0644]
core/io/crc32/crc32-tests.factor [new file with mode: 0644]
core/io/crc32/crc32.factor [new file with mode: 0644]
core/io/crc32/summary.txt [new file with mode: 0644]
core/io/duplex-stream.factor [deleted file]
core/io/duplex-stream.facts [deleted file]
core/io/encodings/encodings.factor [new file with mode: 0644]
core/io/files.factor [deleted file]
core/io/files.facts [deleted file]
core/io/files/authors.txt [new file with mode: 0644]
core/io/files/files-docs.factor [new file with mode: 0644]
core/io/files/files-tests.factor [new file with mode: 0644]
core/io/files/files.factor [new file with mode: 0644]
core/io/files/summary.txt [new file with mode: 0644]
core/io/io-docs.factor [new file with mode: 0644]
core/io/io-tests.factor [new file with mode: 0644]
core/io/io.factor [new file with mode: 0644]
core/io/lines.factor [deleted file]
core/io/lines.facts [deleted file]
core/io/nested-style.factor [deleted file]
core/io/nested-style.facts [deleted file]
core/io/null-stream.factor [deleted file]
core/io/plain-stream.factor [deleted file]
core/io/plain-stream.facts [deleted file]
core/io/server.factor [deleted file]
core/io/server.facts [deleted file]
core/io/stdio.factor [deleted file]
core/io/stdio.facts [deleted file]
core/io/stream.factor [deleted file]
core/io/stream.facts [deleted file]
core/io/streams/c/authors.txt [new file with mode: 0644]
core/io/streams/c/c-docs.factor [new file with mode: 0644]
core/io/streams/c/c.factor [new file with mode: 0644]
core/io/streams/c/summary.txt [new file with mode: 0644]
core/io/streams/duplex/authors.txt [new file with mode: 0644]
core/io/streams/duplex/duplex-docs.factor [new file with mode: 0644]
core/io/streams/duplex/duplex-tests.factor [new file with mode: 0644]
core/io/streams/duplex/duplex.factor [new file with mode: 0644]
core/io/streams/duplex/summary.txt [new file with mode: 0644]
core/io/streams/lines/authors.txt [new file with mode: 0644]
core/io/streams/lines/lines-docs.factor [new file with mode: 0644]
core/io/streams/lines/lines-tests.factor [new file with mode: 0644]
core/io/streams/lines/lines.factor [new file with mode: 0644]
core/io/streams/lines/summary.txt [new file with mode: 0644]
core/io/streams/nested/authors.txt [new file with mode: 0644]
core/io/streams/nested/nested-docs.factor [new file with mode: 0644]
core/io/streams/nested/nested-tests.factor [new file with mode: 0644]
core/io/streams/nested/nested.factor [new file with mode: 0644]
core/io/streams/nested/summary.txt [new file with mode: 0644]
core/io/streams/plain/authors.txt [new file with mode: 0644]
core/io/streams/plain/plain-docs.factor [new file with mode: 0644]
core/io/streams/plain/plain.factor [new file with mode: 0644]
core/io/streams/plain/summary.txt [new file with mode: 0644]
core/io/streams/string/authors.txt [new file with mode: 0644]
core/io/streams/string/string-docs.factor [new file with mode: 0644]
core/io/streams/string/string-tests.factor [new file with mode: 0644]
core/io/streams/string/string.factor [new file with mode: 0644]
core/io/streams/string/summary.txt [new file with mode: 0644]
core/io/string-streams.factor [deleted file]
core/io/string-streams.facts [deleted file]
core/io/styles.factor [deleted file]
core/io/styles.facts [deleted file]
core/io/styles/authors.txt [new file with mode: 0644]
core/io/styles/styles-docs.factor [new file with mode: 0644]
core/io/styles/styles.factor [new file with mode: 0644]
core/io/styles/summary.txt [new file with mode: 0644]
core/io/summary.txt [new file with mode: 0644]
core/io/test/binary.txt [new file with mode: 0644]
core/io/test/empty-file.txt [new file with mode: 0644]
core/io/test/mac-os-eol.txt [new file with mode: 0644]
core/io/test/no-trailing-eol.factor [new file with mode: 0644]
core/io/test/separator-test.txt [new file with mode: 0644]
core/io/test/unix-eol.txt [new file with mode: 0644]
core/io/test/windows-eol.txt [new file with mode: 0644]
core/io/unix/files.factor [deleted file]
core/io/unix/io.factor [deleted file]
core/io/unix/load.factor [deleted file]
core/io/unix/sockets.factor [deleted file]
core/io/unix/syscalls-freebsd.factor [deleted file]
core/io/unix/syscalls-linux.factor [deleted file]
core/io/unix/syscalls-macosx.factor [deleted file]
core/io/unix/syscalls-solaris.factor [deleted file]
core/io/unix/syscalls.factor [deleted file]
core/io/unix/types.factor [deleted file]
core/io/utf16/authors.txt [new file with mode: 0644]
core/io/utf16/summary.txt [new file with mode: 0644]
core/io/utf16/utf16-docs.factor [new file with mode: 0644]
core/io/utf16/utf16-tests.factor [new file with mode: 0644]
core/io/utf16/utf16.factor [new file with mode: 0644]
core/io/utf8/authors.txt [new file with mode: 0644]
core/io/utf8/summary.txt [new file with mode: 0644]
core/io/utf8/utf8-docs.factor [new file with mode: 0644]
core/io/utf8/utf8-tests.factor [new file with mode: 0644]
core/io/utf8/utf8.factor [new file with mode: 0644]
core/io/windows/errors.factor [deleted file]
core/io/windows/io-internals.factor [deleted file]
core/io/windows/io.factor [deleted file]
core/io/windows/load.factor [deleted file]
core/io/windows/server.factor [deleted file]
core/io/windows/stream.factor [deleted file]
core/kernel.factor [deleted file]
core/kernel.facts [deleted file]
core/kernel/authors.txt [new file with mode: 0644]
core/kernel/kernel-docs.factor [new file with mode: 0644]
core/kernel/kernel-tests.factor [new file with mode: 0644]
core/kernel/kernel.factor [new file with mode: 0644]
core/kernel/summary.txt [new file with mode: 0644]
core/layouts/authors.txt [new file with mode: 0644]
core/layouts/layouts-docs.factor [new file with mode: 0644]
core/layouts/layouts.factor [new file with mode: 0644]
core/layouts/summary.txt [new file with mode: 0644]
core/layouts/tags.txt [new file with mode: 0644]
core/libc/authors.txt [new file with mode: 0644]
core/libc/libc-docs.factor [new file with mode: 0644]
core/libc/libc.factor [new file with mode: 0644]
core/libc/summary.txt [new file with mode: 0644]
core/libc/tags.txt [new file with mode: 0644]
core/listener.factor [deleted file]
core/listener.facts [deleted file]
core/listener/authors.txt [new file with mode: 0644]
core/listener/listener-docs.factor [new file with mode: 0644]
core/listener/listener-tests.factor [new file with mode: 0644]
core/listener/listener.factor [new file with mode: 0644]
core/listener/summary.txt [new file with mode: 0644]
core/listener/tags.txt [new file with mode: 0644]
core/load.factor [deleted file]
core/math/arc-trig-hyp.factor [deleted file]
core/math/arc-trig-hyp.facts [deleted file]
core/math/authors.txt [new file with mode: 0644]
core/math/bitfields/authors.txt [new file with mode: 0644]
core/math/bitfields/bitfields-docs.factor [new file with mode: 0644]
core/math/bitfields/bitfields-tests.factor [new file with mode: 0644]
core/math/bitfields/bitfields.factor [new file with mode: 0644]
core/math/bitfields/summary.txt [new file with mode: 0644]
core/math/complex.factor [deleted file]
core/math/complex.facts [deleted file]
core/math/complex/authors.txt [new file with mode: 0644]
core/math/complex/complex-docs.factor [new file with mode: 0644]
core/math/complex/complex-tests.factor [new file with mode: 0644]
core/math/complex/complex.factor [new file with mode: 0644]
core/math/complex/summary.txt [new file with mode: 0644]
core/math/constants.factor [deleted file]
core/math/constants.facts [deleted file]
core/math/constants/authors.txt [new file with mode: 0644]
core/math/constants/constants-docs.factor [new file with mode: 0644]
core/math/constants/constants.factor [new file with mode: 0644]
core/math/constants/summary.txt [new file with mode: 0644]
core/math/float.factor [deleted file]
core/math/float.facts [deleted file]
core/math/floats/authors.txt [new file with mode: 0644]
core/math/floats/floats-docs.factor [new file with mode: 0644]
core/math/floats/floats-tests.factor [new file with mode: 0644]
core/math/floats/floats.factor [new file with mode: 0644]
core/math/floats/summary.txt [new file with mode: 0644]
core/math/functions/authors.txt [new file with mode: 0644]
core/math/functions/functions-docs.factor [new file with mode: 0644]
core/math/functions/functions-tests.factor [new file with mode: 0644]
core/math/functions/functions.factor [new file with mode: 0644]
core/math/functions/summary.txt [new file with mode: 0644]
core/math/integer.factor [deleted file]
core/math/integer.facts [deleted file]
core/math/integers/authors.txt [new file with mode: 0644]
core/math/integers/integers-docs.factor [new file with mode: 0644]
core/math/integers/integers-tests.factor [new file with mode: 0644]
core/math/integers/integers.factor [new file with mode: 0644]
core/math/integers/summary.txt [new file with mode: 0644]
core/math/intervals/authors.txt [new file with mode: 0644]
core/math/intervals/intervals-docs.factor [new file with mode: 0644]
core/math/intervals/intervals-tests.factor [new file with mode: 0644]
core/math/intervals/intervals.factor [new file with mode: 0644]
core/math/intervals/summary.txt [new file with mode: 0644]
core/math/libm.factor [deleted file]
core/math/libm/authors.txt [new file with mode: 0644]
core/math/libm/libm-docs.factor [new file with mode: 0644]
core/math/libm/libm.factor [new file with mode: 0644]
core/math/libm/summary.txt [new file with mode: 0644]
core/math/libm/tags.txt [new file with mode: 0644]
core/math/math-docs.factor [new file with mode: 0644]
core/math/math-tests.factor [new file with mode: 0644]
core/math/math.factor
core/math/math.facts [deleted file]
core/math/parse-numbers.factor [deleted file]
core/math/parse-numbers.facts [deleted file]
core/math/parser/authors.txt [new file with mode: 0644]
core/math/parser/parser-docs.factor [new file with mode: 0644]
core/math/parser/parser-tests.factor [new file with mode: 0644]
core/math/parser/parser.factor [new file with mode: 0644]
core/math/parser/summary.txt [new file with mode: 0644]
core/math/pow.factor [deleted file]
core/math/pow.facts [deleted file]
core/math/random.factor [deleted file]
core/math/random.facts [deleted file]
core/math/ratio.factor [deleted file]
core/math/ratio.facts [deleted file]
core/math/ratios/authors.txt [new file with mode: 0644]
core/math/ratios/ratios-docs.factor [new file with mode: 0644]
core/math/ratios/ratios-tests.factor [new file with mode: 0644]
core/math/ratios/ratios.factor [new file with mode: 0644]
core/math/ratios/summary.txt [new file with mode: 0644]
core/math/summary.txt [new file with mode: 0644]
core/math/trig-hyp.factor [deleted file]
core/math/trig-hyp.facts [deleted file]
core/math/vectors.factor [deleted file]
core/math/vectors.facts [deleted file]
core/math/vectors/authors.txt [new file with mode: 0644]
core/math/vectors/summary.txt [new file with mode: 0644]
core/math/vectors/vectors-docs.factor [new file with mode: 0644]
core/math/vectors/vectors-tests.factor [new file with mode: 0644]
core/math/vectors/vectors.factor [new file with mode: 0644]
core/memory/authors.txt [new file with mode: 0644]
core/memory/memory-docs.factor [new file with mode: 0644]
core/memory/memory-tests.factor [new file with mode: 0644]
core/memory/memory.factor [new file with mode: 0644]
core/memory/summary.txt [new file with mode: 0644]
core/memory/tags.txt [new file with mode: 0644]
core/mirrors/authors.txt [new file with mode: 0644]
core/mirrors/mirrors-docs.factor [new file with mode: 0644]
core/mirrors/mirrors-tests.factor [new file with mode: 0644]
core/mirrors/mirrors.factor [new file with mode: 0644]
core/mirrors/summary.txt [new file with mode: 0644]
core/mirrors/tags.txt [new file with mode: 0644]
core/modules.factor [deleted file]
core/modules.facts [deleted file]
core/namespaces/authors.txt [new file with mode: 0644]
core/namespaces/namespaces-docs.factor [new file with mode: 0644]
core/namespaces/namespaces-tests.factor [new file with mode: 0644]
core/namespaces/namespaces.factor [new file with mode: 0644]
core/namespaces/summary.txt [new file with mode: 0644]
core/namespaces/tags.txt [new file with mode: 0644]
core/none/authors.txt [new file with mode: 0644]
core/none/none-docs.factor [new file with mode: 0644]
core/none/none.factor [new file with mode: 0644]
core/none/summary.txt [new file with mode: 0644]
core/optimizer/authors.txt [new file with mode: 0644]
core/optimizer/backend/authors.txt [new file with mode: 0644]
core/optimizer/backend/backend.factor [new file with mode: 0644]
core/optimizer/backend/summary.txt [new file with mode: 0644]
core/optimizer/debugger/debugger.factor [new file with mode: 0644]
core/optimizer/def-use/authors.txt [new file with mode: 0644]
core/optimizer/def-use/def-use-tests.factor [new file with mode: 0644]
core/optimizer/def-use/def-use.factor [new file with mode: 0644]
core/optimizer/def-use/summary.txt [new file with mode: 0644]
core/optimizer/known-words/authors.txt [new file with mode: 0644]
core/optimizer/known-words/known-words.factor [new file with mode: 0644]
core/optimizer/known-words/summary.txt [new file with mode: 0644]
core/optimizer/math/authors.txt [new file with mode: 0644]
core/optimizer/math/math.factor [new file with mode: 0644]
core/optimizer/math/summary.txt [new file with mode: 0644]
core/optimizer/optimizer-docs.factor [new file with mode: 0644]
core/optimizer/optimizer.factor [new file with mode: 0644]
core/optimizer/pattern-match/authors.txt [new file with mode: 0644]
core/optimizer/pattern-match/pattern-match.factor [new file with mode: 0644]
core/optimizer/pattern-match/summary.txt [new file with mode: 0644]
core/optimizer/summary.txt [new file with mode: 0644]
core/optimizer/tags.txt [new file with mode: 0644]
core/parser/authors.txt [new file with mode: 0644]
core/parser/parser-docs.factor [new file with mode: 0644]
core/parser/parser-tests.factor [new file with mode: 0644]
core/parser/parser.factor [new file with mode: 0644]
core/parser/summary.txt [new file with mode: 0644]
core/parser/tags.txt [new file with mode: 0644]
core/prettyprint/authors.txt [new file with mode: 0644]
core/prettyprint/backend.factor [deleted file]
core/prettyprint/backend.facts [deleted file]
core/prettyprint/backend/authors.txt [new file with mode: 0644]
core/prettyprint/backend/backend-docs.factor [new file with mode: 0644]
core/prettyprint/backend/backend.factor [new file with mode: 0644]
core/prettyprint/backend/summary.txt [new file with mode: 0644]
core/prettyprint/config/authors.txt [new file with mode: 0644]
core/prettyprint/config/config-docs.factor [new file with mode: 0644]
core/prettyprint/config/config.factor [new file with mode: 0644]
core/prettyprint/config/summary.txt [new file with mode: 0644]
core/prettyprint/core.factor [deleted file]
core/prettyprint/core.facts [deleted file]
core/prettyprint/describe.factor [deleted file]
core/prettyprint/describe.facts [deleted file]
core/prettyprint/frontend.factor [deleted file]
core/prettyprint/frontend.facts [deleted file]
core/prettyprint/prettyprint-docs.factor [new file with mode: 0644]
core/prettyprint/prettyprint-tests.factor [new file with mode: 0644]
core/prettyprint/prettyprint.factor [new file with mode: 0644]
core/prettyprint/sections.factor [deleted file]
core/prettyprint/sections.facts [deleted file]
core/prettyprint/sections/authors.txt [new file with mode: 0644]
core/prettyprint/sections/sections-docs.factor [new file with mode: 0644]
core/prettyprint/sections/sections.factor [new file with mode: 0644]
core/prettyprint/sections/summary.txt [new file with mode: 0644]
core/prettyprint/summary.txt [new file with mode: 0644]
core/prettyprint/tags.txt [new file with mode: 0644]
core/queues/authors.txt [new file with mode: 0644]
core/queues/queues-docs.factor [new file with mode: 0644]
core/queues/queues-tests.factor [new file with mode: 0644]
core/queues/queues.factor [new file with mode: 0644]
core/queues/summary.txt [new file with mode: 0644]
core/queues/tags.txt [new file with mode: 0644]
core/quotations.factor [deleted file]
core/quotations.facts [deleted file]
core/quotations/authors.txt [new file with mode: 0644]
core/quotations/quotations-docs.factor [new file with mode: 0644]
core/quotations/quotations-tests.factor [new file with mode: 0644]
core/quotations/quotations.factor [new file with mode: 0644]
core/quotations/summary.txt [new file with mode: 0644]
core/quotations/tags.txt [new file with mode: 0644]
core/refs/refs-docs.factor [new file with mode: 0644]
core/refs/refs.factor [new file with mode: 0644]
core/sbufs/authors.txt [new file with mode: 0644]
core/sbufs/sbufs-docs.factor [new file with mode: 0644]
core/sbufs/sbufs-tests.factor [new file with mode: 0644]
core/sbufs/sbufs.factor [new file with mode: 0644]
core/sbufs/summary.txt [new file with mode: 0644]
core/sbufs/tags.txt [new file with mode: 0644]
core/sequences/authors.txt [new file with mode: 0644]
core/sequences/sequences-docs.factor [new file with mode: 0644]
core/sequences/sequences-tests.factor [new file with mode: 0644]
core/sequences/sequences.factor [new file with mode: 0644]
core/sequences/summary.txt [new file with mode: 0644]
core/sequences/tags.txt [new file with mode: 0644]
core/slots/authors.txt [new file with mode: 0644]
core/slots/slots-docs.factor [new file with mode: 0644]
core/slots/slots.factor [new file with mode: 0644]
core/slots/summary.txt [new file with mode: 0644]
core/sorting/authors.txt [new file with mode: 0644]
core/sorting/sorting-docs.factor [new file with mode: 0644]
core/sorting/sorting-tests.factor [new file with mode: 0644]
core/sorting/sorting.factor [new file with mode: 0644]
core/sorting/summary.txt [new file with mode: 0644]
core/sorting/tags.txt [new file with mode: 0644]
core/source-files/authors.txt [new file with mode: 0644]
core/source-files/source-files-docs.factor [new file with mode: 0644]
core/source-files/source-files.factor [new file with mode: 0644]
core/source-files/summary.txt [new file with mode: 0644]
core/splitting/authors.txt [new file with mode: 0644]
core/splitting/splitting-docs.factor [new file with mode: 0644]
core/splitting/splitting-tests.factor [new file with mode: 0644]
core/splitting/splitting.factor [new file with mode: 0644]
core/splitting/summary.txt [new file with mode: 0644]
core/splitting/tags.txt [new file with mode: 0644]
core/strings/authors.txt [new file with mode: 0644]
core/strings/strings-docs.factor [new file with mode: 0644]
core/strings/strings-tests.factor [new file with mode: 0644]
core/strings/strings.factor [new file with mode: 0644]
core/strings/summary.txt [new file with mode: 0644]
core/strings/tags.txt [new file with mode: 0644]
core/syntax/authors.txt [new file with mode: 0644]
core/syntax/early-parser.factor [deleted file]
core/syntax/early-parser.facts [deleted file]
core/syntax/parse-stream.factor [deleted file]
core/syntax/parse-stream.facts [deleted file]
core/syntax/parse-syntax.factor [deleted file]
core/syntax/parse-syntax.facts [deleted file]
core/syntax/parser.factor [deleted file]
core/syntax/parser.facts [deleted file]
core/syntax/summary.txt [new file with mode: 0644]
core/syntax/syntax-docs.factor [new file with mode: 0644]
core/syntax/syntax.factor [new file with mode: 0644]
core/system/authors.txt [new file with mode: 0644]
core/system/summary.txt [new file with mode: 0644]
core/system/system-docs.factor [new file with mode: 0644]
core/system/system-tests.factor [new file with mode: 0644]
core/system/system.factor [new file with mode: 0644]
core/test/binary.factor [deleted file]
core/test/collections/arrays.factor [deleted file]
core/test/collections/hashtables.factor [deleted file]
core/test/collections/namespaces.factor [deleted file]
core/test/collections/queues.factor [deleted file]
core/test/collections/sbuf.factor [deleted file]
core/test/collections/sequences.factor [deleted file]
core/test/collections/strings.factor [deleted file]
core/test/collections/vectors.factor [deleted file]
core/test/combinators.factor [deleted file]
core/test/continuations.factor [deleted file]
core/test/errors.factor [deleted file]
core/test/generic.factor [deleted file]
core/test/init.factor [deleted file]
core/test/io/binary.txt [deleted file]
core/test/io/empty-file.txt [deleted file]
core/test/io/io.factor [deleted file]
core/test/io/mac-os-eol.txt [deleted file]
core/test/io/nested-style.factor [deleted file]
core/test/io/no-trailing-eol.factor [deleted file]
core/test/io/unix-eol.txt [deleted file]
core/test/io/windows-eol.txt [deleted file]
core/test/kernel.factor [deleted file]
core/test/math/bitops.factor [deleted file]
core/test/math/complex.factor [deleted file]
core/test/math/float.factor [deleted file]
core/test/math/integer.factor [deleted file]
core/test/math/irrational.factor [deleted file]
core/test/math/math-combinators.factor [deleted file]
core/test/math/random.factor [deleted file]
core/test/math/rational.factor [deleted file]
core/test/parse-number.factor [deleted file]
core/test/parser.factor [deleted file]
core/test/parsing-word.factor [deleted file]
core/test/prettyprint.factor [deleted file]
core/test/random.factor [deleted file]
core/test/redefine.factor [deleted file]
core/test/threads.factor [deleted file]
core/test/tuple.factor [deleted file]
core/test/words.factor [deleted file]
core/threads.factor [deleted file]
core/threads.facts [deleted file]
core/threads/authors.txt [new file with mode: 0644]
core/threads/summary.txt [new file with mode: 0644]
core/threads/threads-docs.factor [new file with mode: 0644]
core/threads/threads-tests.factor [new file with mode: 0644]
core/threads/threads.factor [new file with mode: 0644]
core/tools/completion.factor [deleted file]
core/tools/debugger.factor [deleted file]
core/tools/debugger.facts [deleted file]
core/tools/definitions.factor [deleted file]
core/tools/definitions.facts [deleted file]
core/tools/errors.factor [deleted file]
core/tools/image.factor [deleted file]
core/tools/image.facts [deleted file]
core/tools/inspector.factor [deleted file]
core/tools/inspector.facts [deleted file]
core/tools/interpreter.factor [deleted file]
core/tools/load.factor [deleted file]
core/tools/memory.factor [deleted file]
core/tools/memory.facts [deleted file]
core/tools/modules.factor [deleted file]
core/tools/modules.facts [deleted file]
core/tools/test.factor [deleted file]
core/tools/test.facts [deleted file]
core/tools/test/annotate.factor [deleted file]
core/tools/test/inspector.factor [deleted file]
core/tools/test/interpreter.factor [deleted file]
core/tools/test/memory.factor [deleted file]
core/tools/test/tools.factor [deleted file]
core/tools/word-tools.factor [deleted file]
core/tools/word-tools.facts [deleted file]
core/tuples/authors.txt [new file with mode: 0644]
core/tuples/summary.txt [new file with mode: 0644]
core/tuples/tuples-docs.factor [new file with mode: 0644]
core/tuples/tuples-tests.factor [new file with mode: 0644]
core/tuples/tuples.factor [new file with mode: 0644]
core/ui/backend.factor [deleted file]
core/ui/backend.facts [deleted file]
core/ui/cocoa/application-utils.factor [deleted file]
core/ui/cocoa/core-foundation.factor [deleted file]
core/ui/cocoa/dialogs.factor [deleted file]
core/ui/cocoa/init-cocoa.factor [deleted file]
core/ui/cocoa/load.factor [deleted file]
core/ui/cocoa/pasteboard-utils.factor [deleted file]
core/ui/cocoa/services.factor [deleted file]
core/ui/cocoa/test/cocoa.factor [deleted file]
core/ui/cocoa/types.factor [deleted file]
core/ui/cocoa/ui.factor [deleted file]
core/ui/cocoa/view-utils.factor [deleted file]
core/ui/cocoa/window-utils.factor [deleted file]
core/ui/commands.factor [deleted file]
core/ui/commands.facts [deleted file]
core/ui/debugger.factor [deleted file]
core/ui/debugger.facts [deleted file]
core/ui/freetype/freetype-gl.factor [deleted file]
core/ui/freetype/freetype.factor [deleted file]
core/ui/freetype/load.factor [deleted file]
core/ui/gadgets.factor [deleted file]
core/ui/gadgets.facts [deleted file]
core/ui/gadgets/books.factor [deleted file]
core/ui/gadgets/books.facts [deleted file]
core/ui/gadgets/borders.factor [deleted file]
core/ui/gadgets/borders.facts [deleted file]
core/ui/gadgets/buttons.factor [deleted file]
core/ui/gadgets/buttons.facts [deleted file]
core/ui/gadgets/controls.factor [deleted file]
core/ui/gadgets/controls.facts [deleted file]
core/ui/gadgets/frames.factor [deleted file]
core/ui/gadgets/frames.facts [deleted file]
core/ui/gadgets/grid-lines.factor [deleted file]
core/ui/gadgets/grid-lines.facts [deleted file]
core/ui/gadgets/grids.factor [deleted file]
core/ui/gadgets/grids.facts [deleted file]
core/ui/gadgets/incremental.factor [deleted file]
core/ui/gadgets/incremental.facts [deleted file]
core/ui/gadgets/labelled-gadget.factor [deleted file]
core/ui/gadgets/labelled-gadget.facts [deleted file]
core/ui/gadgets/labels.factor [deleted file]
core/ui/gadgets/labels.facts [deleted file]
core/ui/gadgets/lists.factor [deleted file]
core/ui/gadgets/lists.facts [deleted file]
core/ui/gadgets/menus.factor [deleted file]
core/ui/gadgets/menus.facts [deleted file]
core/ui/gadgets/outliner.factor [deleted file]
core/ui/gadgets/outliner.facts [deleted file]
core/ui/gadgets/panes.factor [deleted file]
core/ui/gadgets/panes.facts [deleted file]
core/ui/gadgets/paragraphs.factor [deleted file]
core/ui/gadgets/presentations.factor [deleted file]
core/ui/gadgets/presentations.facts [deleted file]
core/ui/gadgets/scrolling.factor [deleted file]
core/ui/gadgets/scrolling.facts [deleted file]
core/ui/gadgets/sliders.factor [deleted file]
core/ui/gadgets/sliders.facts [deleted file]
core/ui/gadgets/theme.factor [deleted file]
core/ui/gadgets/tracks.factor [deleted file]
core/ui/gadgets/tracks.facts [deleted file]
core/ui/gadgets/viewports.factor [deleted file]
core/ui/gadgets/viewports.facts [deleted file]
core/ui/gestures.factor [deleted file]
core/ui/gestures.facts [deleted file]
core/ui/handbook/gadgets.facts [deleted file]
core/ui/handbook/load.factor [deleted file]
core/ui/handbook/tools.facts [deleted file]
core/ui/handbook/ui.facts [deleted file]
core/ui/hierarchy.factor [deleted file]
core/ui/hierarchy.facts [deleted file]
core/ui/layouts.factor [deleted file]
core/ui/layouts.facts [deleted file]
core/ui/load.factor [deleted file]
core/ui/models.factor [deleted file]
core/ui/models.facts [deleted file]
core/ui/opengl/gl.factor [deleted file]
core/ui/opengl/glu.factor [deleted file]
core/ui/opengl/load.factor [deleted file]
core/ui/opengl/utilities.factor [deleted file]
core/ui/opengl/utilities.facts [deleted file]
core/ui/paint.factor [deleted file]
core/ui/paint.facts [deleted file]
core/ui/test/commands.factor [deleted file]
core/ui/test/document.factor [deleted file]
core/ui/test/editor.factor [deleted file]
core/ui/test/gadgets.factor [deleted file]
core/ui/test/lists.factor [deleted file]
core/ui/test/models.factor [deleted file]
core/ui/test/panes.factor [deleted file]
core/ui/test/presentations.factor [deleted file]
core/ui/test/rectangles.factor [deleted file]
core/ui/test/scrolling.factor [deleted file]
core/ui/test/search.factor [deleted file]
core/ui/test/sliders.factor [deleted file]
core/ui/test/titled-gadget.factor [deleted file]
core/ui/text.factor [deleted file]
core/ui/text.facts [deleted file]
core/ui/text/commands.factor [deleted file]
core/ui/text/document.factor [deleted file]
core/ui/text/document.facts [deleted file]
core/ui/text/editor.factor [deleted file]
core/ui/text/editor.facts [deleted file]
core/ui/text/elements.factor [deleted file]
core/ui/text/elements.facts [deleted file]
core/ui/text/interactor.factor [deleted file]
core/ui/text/interactor.facts [deleted file]
core/ui/timers.factor [deleted file]
core/ui/timers.facts [deleted file]
core/ui/tools/browser.factor [deleted file]
core/ui/tools/dataflow.factor [deleted file]
core/ui/tools/help.factor [deleted file]
core/ui/tools/listener.factor [deleted file]
core/ui/tools/load.factor [deleted file]
core/ui/tools/messages.factor [deleted file]
core/ui/tools/operations.factor [deleted file]
core/ui/tools/search.factor [deleted file]
core/ui/tools/test/listener.factor [deleted file]
core/ui/tools/test/workspace.factor [deleted file]
core/ui/tools/tools.factor [deleted file]
core/ui/tools/walker.factor [deleted file]
core/ui/tools/workspace.factor [deleted file]
core/ui/ui.factor [deleted file]
core/ui/ui.facts [deleted file]
core/ui/windows.factor [deleted file]
core/ui/windows.facts [deleted file]
core/ui/windows/clipboard.factor [deleted file]
core/ui/windows/load.factor [deleted file]
core/ui/windows/ui.factor [deleted file]
core/ui/world.factor [deleted file]
core/ui/world.facts [deleted file]
core/ui/x11/clipboard.factor [deleted file]
core/ui/x11/constants.factor [deleted file]
core/ui/x11/events.factor [deleted file]
core/ui/x11/glx-utils.factor [deleted file]
core/ui/x11/glx.factor [deleted file]
core/ui/x11/load.factor [deleted file]
core/ui/x11/ui.factor [deleted file]
core/ui/x11/utilities.factor [deleted file]
core/ui/x11/windows.factor [deleted file]
core/ui/x11/xlib.factor [deleted file]
core/vectors/authors.txt [new file with mode: 0644]
core/vectors/summary.txt [new file with mode: 0644]
core/vectors/tags.txt [new file with mode: 0644]
core/vectors/vectors-docs.factor [new file with mode: 0644]
core/vectors/vectors-tests.factor [new file with mode: 0644]
core/vectors/vectors.factor [new file with mode: 0644]
core/version.factor [deleted file]
core/vocabs/authors.txt [new file with mode: 0644]
core/vocabs/loader/authors.txt [new file with mode: 0644]
core/vocabs/loader/loader-docs.factor [new file with mode: 0644]
core/vocabs/loader/loader-tests.factor [new file with mode: 0644]
core/vocabs/loader/loader.factor [new file with mode: 0644]
core/vocabs/loader/summary.txt [new file with mode: 0644]
core/vocabs/loader/test/a/a.factor [new file with mode: 0644]
core/vocabs/loader/test/b/b.factor [new file with mode: 0644]
core/vocabs/loader/test/c/c.factor [new file with mode: 0644]
core/vocabs/loader/test/d/d.factor [new file with mode: 0644]
core/vocabs/loader/test/e/e.factor [new file with mode: 0644]
core/vocabs/loader/test/f/f-docs.factor [new file with mode: 0644]
core/vocabs/loader/test/f/f.factor [new file with mode: 0644]
core/vocabs/summary.txt [new file with mode: 0644]
core/vocabs/vocabs-docs.factor [new file with mode: 0644]
core/vocabs/vocabs-tests.factor [new file with mode: 0644]
core/vocabs/vocabs.factor [new file with mode: 0644]
core/windows/dlls.factor [deleted file]
core/windows/gdi32-constants.factor [deleted file]
core/windows/gdi32.factor [deleted file]
core/windows/io.factor [deleted file]
core/windows/kernel32-constants.factor [deleted file]
core/windows/kernel32-structs.factor [deleted file]
core/windows/kernel32-types.factor [deleted file]
core/windows/kernel32.factor [deleted file]
core/windows/load.factor [deleted file]
core/windows/opengl32.factor [deleted file]
core/windows/types.factor [deleted file]
core/windows/user32-constants.factor [deleted file]
core/windows/user32-structs.factor [deleted file]
core/windows/user32-types.factor [deleted file]
core/windows/user32.factor [deleted file]
core/windows/utils.factor [deleted file]
core/windows/windows-messages.factor [deleted file]
core/windows/winsock.factor [deleted file]
core/words.factor [deleted file]
core/words.facts [deleted file]
core/words/authors.txt [new file with mode: 0644]
core/words/summary.txt [new file with mode: 0644]
core/words/tags.txt [new file with mode: 0644]
core/words/words-docs.factor [new file with mode: 0644]
core/words/words-tests.factor [new file with mode: 0644]
core/words/words.factor [new file with mode: 0644]
cp_dir
demos/all.factor [deleted file]
demos/cocoa/speech.factor [deleted file]
demos/color-picker.factor [deleted file]
demos/haar.factor [deleted file]
demos/hello-world.factor [deleted file]
demos/lcd.factor [deleted file]
demos/mslug-talk.factor [deleted file]
demos/nehe/load.factor [deleted file]
demos/nehe/nehe-utils.factor [deleted file]
demos/nehe/nehe2.factor [deleted file]
demos/nehe/nehe3.factor [deleted file]
demos/nehe/nehe4.factor [deleted file]
demos/numbers-game.factor [deleted file]
demos/rot13.factor [deleted file]
extra/arrays/lib/lib.factor [new file with mode: 0644]
extra/asn1/asn1-tests.factor [new file with mode: 0644]
extra/asn1/asn1.factor [new file with mode: 0644]
extra/asn1/authors.txt [new file with mode: 0644]
extra/asn1/ldap/ldap.factor [new file with mode: 0644]
extra/asn1/summary.txt [new file with mode: 0644]
extra/automata/authors.txt [new file with mode: 0644]
extra/automata/automata.factor [new file with mode: 0644]
extra/automata/summary.txt [new file with mode: 0644]
extra/automata/tags.txt [new file with mode: 0644]
extra/automata/ui/ui.factor [new file with mode: 0644]
extra/bake/bake.factor [new file with mode: 0644]
extra/balloon-bomber/authors.txt [new file with mode: 0644]
extra/balloon-bomber/balloon-bomber-docs.factor [new file with mode: 0644]
extra/balloon-bomber/balloon-bomber.factor [new file with mode: 0644]
extra/balloon-bomber/summary.txt [new file with mode: 0644]
extra/balloon-bomber/tags.txt [new file with mode: 0644]
extra/base64/authors.txt [new file with mode: 0644]
extra/base64/base64-docs.factor [new file with mode: 0644]
extra/base64/base64-tests.factor [new file with mode: 0644]
extra/base64/base64.factor [new file with mode: 0644]
extra/base64/summary.txt [new file with mode: 0644]
extra/benchmark/authors.txt [new file with mode: 0644]
extra/benchmark/benchmark.factor [new file with mode: 0644]
extra/benchmark/bootstrap1/bootstrap1.factor [new file with mode: 0644]
extra/benchmark/bootstrap2/bootstrap2.factor [new file with mode: 0644]
extra/benchmark/continuations/continuations.factor [new file with mode: 0644]
extra/benchmark/dispatch1/dispatch1.factor [new file with mode: 0644]
extra/benchmark/dispatch2/dispatch2.factor [new file with mode: 0644]
extra/benchmark/dispatch3/dispatch3.factor [new file with mode: 0644]
extra/benchmark/dispatch4/dispatch4.factor [new file with mode: 0644]
extra/benchmark/empty-loop/empty-loop.factor [new file with mode: 0644]
extra/benchmark/fib1/fib1.factor [new file with mode: 0644]
extra/benchmark/fib2/fib2.factor [new file with mode: 0644]
extra/benchmark/fib3/fib3.factor [new file with mode: 0644]
extra/benchmark/fib4/fib4.factor [new file with mode: 0644]
extra/benchmark/fib5/fib5.factor [new file with mode: 0644]
extra/benchmark/iteration/iteration.factor [new file with mode: 0644]
extra/benchmark/mandel/mandel.factor [new file with mode: 0644]
extra/benchmark/nsieve-bits/nsieve-bits.factor [new file with mode: 0644]
extra/benchmark/nsieve/nsieve.factor [new file with mode: 0644]
extra/benchmark/partial-sums/partial-sums.factor [new file with mode: 0644]
extra/benchmark/raytracer/raytracer.factor [new file with mode: 0644]
extra/benchmark/recursive/recursive.factor [new file with mode: 0644]
extra/benchmark/reverse-complement-test-in.txt [new file with mode: 0644]
extra/benchmark/reverse-complement-test-out.txt [new file with mode: 0644]
extra/benchmark/reverse-complement/reverse-complement.factor [new file with mode: 0644]
extra/benchmark/ring/ring.factor [new file with mode: 0644]
extra/benchmark/sort/sort.factor [new file with mode: 0644]
extra/benchmark/spectral-norm/spectral-norm.factor [new file with mode: 0644]
extra/benchmark/sum-file/sum-file.factor [new file with mode: 0644]
extra/benchmark/summary.txt [new file with mode: 0644]
extra/benchmark/typecheck1/typecheck1.factor [new file with mode: 0644]
extra/benchmark/typecheck2/typecheck2.factor [new file with mode: 0644]
extra/benchmark/typecheck3/typecheck3.factor [new file with mode: 0644]
extra/benchmark/typecheck4/typecheck4.factor [new file with mode: 0644]
extra/bitfields/authors.txt [new file with mode: 0644]
extra/bitfields/bitfields-docs.factor [new file with mode: 0644]
extra/bitfields/bitfields-tests.factor [new file with mode: 0644]
extra/bitfields/bitfields.factor [new file with mode: 0644]
extra/bitfields/summary.txt [new file with mode: 0644]
extra/bitfields/tags.txt [new file with mode: 0644]
extra/boids/authors.txt [new file with mode: 0644]
extra/boids/boids.factor [new file with mode: 0644]
extra/boids/summary.txt [new file with mode: 0644]
extra/boids/tags.txt [new file with mode: 0644]
extra/boids/ui/ui.factor [new file with mode: 0644]
extra/browser/analyzer/analyzer.factor [new file with mode: 0644]
extra/browser/parser/parser-tests.factor [new file with mode: 0644]
extra/browser/parser/parser.factor [new file with mode: 0644]
extra/browser/printer/printer.factor [new file with mode: 0644]
extra/browser/utils/utils-tests.factor [new file with mode: 0644]
extra/browser/utils/utils.factor [new file with mode: 0644]
extra/bunny/authors.txt [new file with mode: 0644]
extra/bunny/bunny.factor [new file with mode: 0644]
extra/bunny/deploy.factor [new file with mode: 0644]
extra/bunny/summary.txt [new file with mode: 0644]
extra/bunny/tags.txt [new file with mode: 0644]
extra/cabal/cabal.factor [new file with mode: 0644]
extra/cabal/ui/ui.factor [new file with mode: 0644]
extra/cairo/authors.txt [new file with mode: 0644]
extra/cairo/cairo.factor [new file with mode: 0644]
extra/cairo/summary.txt [new file with mode: 0644]
extra/cairo/tags.txt [new file with mode: 0644]
extra/calendar/authors.txt [new file with mode: 0644]
extra/calendar/calendar-tests.factor [new file with mode: 0644]
extra/calendar/calendar.factor [new file with mode: 0644]
extra/calendar/summary.txt [new file with mode: 0644]
extra/calendar/unix/unix-tests.factor [new file with mode: 0644]
extra/calendar/unix/unix.factor [new file with mode: 0644]
extra/calendar/windows/windows-tests.factor [new file with mode: 0644]
extra/calendar/windows/windows.factor [new file with mode: 0644]
extra/catalyst-talk/authors.txt [new file with mode: 0644]
extra/catalyst-talk/catalyst-talk.factor [new file with mode: 0644]
extra/catalyst-talk/summary.txt [new file with mode: 0644]
extra/catalyst-talk/tags.txt [new file with mode: 0644]
extra/cfdg/authors.txt [new file with mode: 0644]
extra/cfdg/cfdg.factor [new file with mode: 0644]
extra/cfdg/gl/gl.factor [new file with mode: 0644]
extra/cfdg/hsv/hsv.factor [new file with mode: 0644]
extra/cfdg/models/aqua-star/aqua-star.factor [new file with mode: 0644]
extra/cfdg/models/chiaroscuro/chiaroscuro.factor [new file with mode: 0644]
extra/cfdg/models/flower6/flower6.factor [new file with mode: 0644]
extra/cfdg/models/game1-turn6/game1-turn6.factor [new file with mode: 0644]
extra/cfdg/models/lesson/lesson.factor [new file with mode: 0644]
extra/cfdg/models/sierpinski/sierpinski.factor [new file with mode: 0644]
extra/cfdg/models/snowflake/snowflake.factor [new file with mode: 0644]
extra/channels/authors.txt [new file with mode: 0644]
extra/channels/channels-docs.factor [new file with mode: 0644]
extra/channels/channels-tests.factor [new file with mode: 0644]
extra/channels/channels.factor [new file with mode: 0644]
extra/channels/examples/authors.txt [new file with mode: 0644]
extra/channels/examples/examples.factor [new file with mode: 0644]
extra/channels/examples/summary.txt [new file with mode: 0644]
extra/channels/examples/tags.txt [new file with mode: 0644]
extra/channels/remote/authors.txt [new file with mode: 0644]
extra/channels/remote/remote-docs.factor [new file with mode: 0644]
extra/channels/remote/remote-tests.factor [new file with mode: 0644]
extra/channels/remote/remote.factor [new file with mode: 0644]
extra/channels/remote/summary.txt [new file with mode: 0644]
extra/channels/remote/tags.txt [new file with mode: 0644]
extra/channels/sniffer/bsd/bsd.factor [new file with mode: 0644]
extra/channels/sniffer/sniffer.factor [new file with mode: 0644]
extra/channels/summary.txt [new file with mode: 0644]
extra/channels/tags.txt [new file with mode: 0644]
extra/circular/authors.txt [new file with mode: 0644]
extra/circular/circular-tests.factor [new file with mode: 0644]
extra/circular/circular.factor [new file with mode: 0644]
extra/circular/summary.txt [new file with mode: 0644]
extra/circular/tags.txt [new file with mode: 0644]
extra/cocoa/application/application-docs.factor [new file with mode: 0644]
extra/cocoa/application/application.factor [new file with mode: 0644]
extra/cocoa/application/authors.txt [new file with mode: 0644]
extra/cocoa/application/summary.txt [new file with mode: 0644]
extra/cocoa/authors.txt [new file with mode: 0644]
extra/cocoa/callbacks/authors.txt [new file with mode: 0644]
extra/cocoa/callbacks/callbacks.factor [new file with mode: 0644]
extra/cocoa/callbacks/summary.txt [new file with mode: 0644]
extra/cocoa/cocoa-docs.factor [new file with mode: 0644]
extra/cocoa/cocoa-tests.factor [new file with mode: 0644]
extra/cocoa/cocoa.factor [new file with mode: 0644]
extra/cocoa/dialogs/authors.txt [new file with mode: 0644]
extra/cocoa/dialogs/dialogs-docs.factor [new file with mode: 0644]
extra/cocoa/dialogs/dialogs.factor [new file with mode: 0644]
extra/cocoa/dialogs/summary.txt [new file with mode: 0644]
extra/cocoa/messages/authors.txt [new file with mode: 0644]
extra/cocoa/messages/messages-docs.factor [new file with mode: 0644]
extra/cocoa/messages/messages.factor [new file with mode: 0644]
extra/cocoa/messages/summary.txt [new file with mode: 0644]
extra/cocoa/nibs/authors.txt [new file with mode: 0644]
extra/cocoa/nibs/nibs-docs.factor [new file with mode: 0644]
extra/cocoa/nibs/nibs.factor [new file with mode: 0644]
extra/cocoa/nibs/summary.txt [new file with mode: 0644]
extra/cocoa/pasteboard/authors.txt [new file with mode: 0644]
extra/cocoa/pasteboard/pasteboard-docs.factor [new file with mode: 0644]
extra/cocoa/pasteboard/pasteboard.factor [new file with mode: 0644]
extra/cocoa/pasteboard/summary.txt [new file with mode: 0644]
extra/cocoa/plists/plists.factor [new file with mode: 0644]
extra/cocoa/runtime/authors.txt [new file with mode: 0644]
extra/cocoa/runtime/runtime.factor [new file with mode: 0644]
extra/cocoa/runtime/summary.txt [new file with mode: 0644]
extra/cocoa/subclassing/authors.txt [new file with mode: 0644]
extra/cocoa/subclassing/subclassing-docs.factor [new file with mode: 0644]
extra/cocoa/subclassing/subclassing.factor [new file with mode: 0644]
extra/cocoa/subclassing/summary.txt [new file with mode: 0644]
extra/cocoa/summary.txt [new file with mode: 0644]
extra/cocoa/tags.txt [new file with mode: 0644]
extra/cocoa/types/authors.txt [new file with mode: 0644]
extra/cocoa/types/summary.txt [new file with mode: 0644]
extra/cocoa/types/types-docs.factor [new file with mode: 0644]
extra/cocoa/types/types.factor [new file with mode: 0644]
extra/cocoa/views/authors.txt [new file with mode: 0644]
extra/cocoa/views/summary.txt [new file with mode: 0644]
extra/cocoa/views/views-docs.factor [new file with mode: 0644]
extra/cocoa/views/views.factor [new file with mode: 0644]
extra/cocoa/windows/authors.txt [new file with mode: 0644]
extra/cocoa/windows/summary.txt [new file with mode: 0644]
extra/cocoa/windows/windows-docs.factor [new file with mode: 0644]
extra/cocoa/windows/windows.factor [new file with mode: 0644]
extra/color-picker/authors.txt [new file with mode: 0644]
extra/color-picker/color-picker.factor [new file with mode: 0644]
extra/color-picker/deploy.factor [new file with mode: 0644]
extra/color-picker/summary.txt [new file with mode: 0644]
extra/color-picker/tags.txt [new file with mode: 0644]
extra/colors/authors.txt [new file with mode: 0644]
extra/colors/colors.factor [new file with mode: 0644]
extra/colors/hsv/hsv.factor [new file with mode: 0644]
extra/combinators/lib/lib-docs.factor [new file with mode: 0644]
extra/combinators/lib/lib-tests.factor [new file with mode: 0644]
extra/combinators/lib/lib.factor [new file with mode: 0644]
extra/concurrency/authors.txt [new file with mode: 0644]
extra/concurrency/concurrency-docs.factor [new file with mode: 0644]
extra/concurrency/concurrency-tests.factor [new file with mode: 0644]
extra/concurrency/concurrency.factor [new file with mode: 0644]
extra/concurrency/distributed/authors.txt [new file with mode: 0644]
extra/concurrency/distributed/distributed-docs.factor [new file with mode: 0644]
extra/concurrency/distributed/distributed.factor [new file with mode: 0644]
extra/concurrency/distributed/summary.txt [new file with mode: 0644]
extra/concurrency/distributed/tags.txt [new file with mode: 0644]
extra/concurrency/summary.txt [new file with mode: 0644]
extra/concurrency/tags.txt [new file with mode: 0644]
extra/const/const.factor [new file with mode: 0644]
extra/contributors/authors.txt [new file with mode: 0644]
extra/contributors/contributors.factor [new file with mode: 0644]
extra/contributors/summary.txt [new file with mode: 0644]
extra/contributors/tags.txt [new file with mode: 0644]
extra/core-foundation/authors.txt [new file with mode: 0644]
extra/core-foundation/core-foundation-docs.factor [new file with mode: 0644]
extra/core-foundation/core-foundation.factor [new file with mode: 0644]
extra/core-foundation/summary.txt [new file with mode: 0644]
extra/core-foundation/tags.txt [new file with mode: 0644]
extra/coroutines/authors.txt [new file with mode: 0644]
extra/coroutines/coroutines-docs.factor [new file with mode: 0644]
extra/coroutines/coroutines-tests.factor [new file with mode: 0644]
extra/coroutines/coroutines.factor [new file with mode: 0644]
extra/coroutines/summary.txt [new file with mode: 0644]
extra/coroutines/tags.txt [new file with mode: 0644]
extra/cpu/8080/8080-docs.factor [new file with mode: 0644]
extra/cpu/8080/8080.factor [new file with mode: 0644]
extra/cryptlib/authors.txt [new file with mode: 0644]
extra/cryptlib/cryptlib-tests.factor [new file with mode: 0644]
extra/cryptlib/cryptlib.factor [new file with mode: 0644]
extra/cryptlib/libcl/libcl.factor [new file with mode: 0644]
extra/cryptlib/notes.txt [new file with mode: 0644]
extra/cryptlib/streams/streams.factor [new file with mode: 0644]
extra/cryptlib/streams/tags.txt [new file with mode: 0644]
extra/cryptlib/summary.txt [new file with mode: 0644]
extra/cryptlib/tags.txt [new file with mode: 0644]
extra/cryptlib/test/keys.p15 [new file with mode: 0644]
extra/cryptlib/test/large_data.txt [new file with mode: 0644]
extra/crypto/authors.txt [new file with mode: 0644]
extra/crypto/barrett/barrett-tests.factor [new file with mode: 0644]
extra/crypto/barrett/barrett.factor [new file with mode: 0644]
extra/crypto/blum-blum-shub.factor [new file with mode: 0644]
extra/crypto/common/common-docs.factor [new file with mode: 0644]
extra/crypto/common/common.factor [new file with mode: 0644]
extra/crypto/hmac/hmac-tests.factor [new file with mode: 0644]
extra/crypto/hmac/hmac.factor [new file with mode: 0644]
extra/crypto/md5/md5-docs.factor [new file with mode: 0644]
extra/crypto/md5/md5-tests.factor [new file with mode: 0644]
extra/crypto/md5/md5.factor [new file with mode: 0644]
extra/crypto/random.factor [new file with mode: 0644]
extra/crypto/rc4.factor [new file with mode: 0644]
extra/crypto/rsa.factor [new file with mode: 0644]
extra/crypto/rsa/rsa-tests.factor [new file with mode: 0644]
extra/crypto/rsa/rsa.factor [new file with mode: 0644]
extra/crypto/sha1/sha1-tests.factor [new file with mode: 0644]
extra/crypto/sha1/sha1.factor [new file with mode: 0644]
extra/crypto/sha2/sha2-tests.factor [new file with mode: 0644]
extra/crypto/sha2/sha2.factor [new file with mode: 0644]
extra/crypto/summary.txt [new file with mode: 0644]
extra/crypto/test/blum-blum-shub.factor [new file with mode: 0644]
extra/crypto/test/common.factor [new file with mode: 0644]
extra/crypto/test/rsa.factor [new file with mode: 0644]
extra/crypto/test/xor.factor [new file with mode: 0644]
extra/crypto/timing/timing-tests.factor [new file with mode: 0644]
extra/crypto/timing/timing.factor [new file with mode: 0644]
extra/crypto/xor.factor [new file with mode: 0644]
extra/destructors/authors.txt [new file with mode: 0644]
extra/destructors/destructors-docs.factor [new file with mode: 0644]
extra/destructors/destructors-tests.factor [new file with mode: 0644]
extra/destructors/destructors.factor [new file with mode: 0644]
extra/destructors/summary.txt [new file with mode: 0644]
extra/dlists/authors.txt [new file with mode: 0644]
extra/dlists/dlists-tests.factor [new file with mode: 0644]
extra/dlists/dlists.factor [new file with mode: 0644]
extra/dlists/summary.txt [new file with mode: 0644]
extra/dlists/tags.txt [new file with mode: 0644]
extra/documents/authors.txt [new file with mode: 0644]
extra/documents/documents-docs.factor [new file with mode: 0644]
extra/documents/documents-tests.factor [new file with mode: 0644]
extra/documents/documents.factor [new file with mode: 0644]
extra/documents/summary.txt [new file with mode: 0644]
extra/editors/authors.txt [new file with mode: 0644]
extra/editors/editors-docs.factor [new file with mode: 0644]
extra/editors/editors.factor [new file with mode: 0644]
extra/editors/editpadpro/authors.txt [new file with mode: 0644]
extra/editors/editpadpro/editpadpro-docs.factor [new file with mode: 0644]
extra/editors/editpadpro/editpadpro.factor [new file with mode: 0644]
extra/editors/emacs/authors.txt [new file with mode: 0644]
extra/editors/emacs/emacs-docs.factor [new file with mode: 0644]
extra/editors/emacs/emacs.factor [new file with mode: 0644]
extra/editors/gvim/authors.txt [new file with mode: 0644]
extra/editors/gvim/gvim.factor [new file with mode: 0644]
extra/editors/jedit/authors.txt [new file with mode: 0644]
extra/editors/jedit/jedit.factor [new file with mode: 0644]
extra/editors/jedit/summary.txt [new file with mode: 0644]
extra/editors/scite/authors.txt [new file with mode: 0644]
extra/editors/scite/scite.factor [new file with mode: 0644]
extra/editors/summary.txt [new file with mode: 0644]
extra/editors/tags.txt [new file with mode: 0644]
extra/editors/textmate/authors.txt [new file with mode: 0644]
extra/editors/textmate/textmate.factor [new file with mode: 0644]
extra/editors/vim/authors.txt [new file with mode: 0644]
extra/editors/vim/generate-vim-syntax.factor [new file with mode: 0644]
extra/editors/vim/vim-docs.factor [new file with mode: 0644]
extra/editors/vim/vim.factor [new file with mode: 0644]
extra/eval-server/authors.txt [new file with mode: 0644]
extra/eval-server/eval-server.factor [new file with mode: 0644]
extra/eval-server/summary.txt [new file with mode: 0644]
extra/eval-server/tags.txt [new file with mode: 0644]
extra/factory/authors.txt [new file with mode: 0644]
extra/factory/commands/commands.factor [new file with mode: 0644]
extra/factory/deploy.factor [new file with mode: 0644]
extra/factory/factory-menus [new file with mode: 0644]
extra/factory/factory-rc [new file with mode: 0644]
extra/factory/factory.factor [new file with mode: 0644]
extra/factory/load/load.factor [new file with mode: 0644]
extra/factory/summary.txt [new file with mode: 0644]
extra/factory/tags.txt [new file with mode: 0644]
extra/fjsc/authors.txt [new file with mode: 0644]
extra/fjsc/fjsc-tests.factor [new file with mode: 0644]
extra/fjsc/fjsc.factor [new file with mode: 0644]
extra/fjsc/resources/bootstrap.factor [new file with mode: 0644]
extra/fjsc/resources/bootstrap.js [new file with mode: 0644]
extra/fjsc/resources/jquery.js [new file with mode: 0644]
extra/fjsc/summary.txt [new file with mode: 0644]
extra/freetype/authors.txt [new file with mode: 0644]
extra/freetype/freetype.factor [new file with mode: 0644]
extra/freetype/summary.txt [new file with mode: 0644]
extra/freetype/tags.txt [new file with mode: 0644]
extra/furnace/furnace-tests.factor [new file with mode: 0644]
extra/furnace/furnace.factor [new file with mode: 0644]
extra/furnace/scaffold/crud-templates/edit.furnace [new file with mode: 0644]
extra/furnace/scaffold/crud-templates/list.furnace [new file with mode: 0644]
extra/furnace/scaffold/crud-templates/show.furnace [new file with mode: 0644]
extra/furnace/scaffold/scaffold.factor [new file with mode: 0644]
extra/furnace/validator/validator-tests.factor [new file with mode: 0644]
extra/furnace/validator/validator.factor [new file with mode: 0644]
extra/gap-buffer/authors.txt [new file with mode: 0644]
extra/gap-buffer/cursortree/authors.txt [new file with mode: 0644]
extra/gap-buffer/cursortree/cursortree-tests.factor [new file with mode: 0644]
extra/gap-buffer/cursortree/cursortree.factor [new file with mode: 0644]
extra/gap-buffer/cursortree/summary.txt [new file with mode: 0644]
extra/gap-buffer/gap-buffer-tests.factor [new file with mode: 0644]
extra/gap-buffer/gap-buffer.factor [new file with mode: 0644]
extra/gap-buffer/summary.txt [new file with mode: 0644]
extra/gap-buffer/tags.txt [new file with mode: 0644]
extra/generic/lib/lib.factor [new file with mode: 0644]
extra/geom/dim/dim.factor [new file with mode: 0644]
extra/geom/pos/pos.factor [new file with mode: 0644]
extra/geom/rect/rect.factor [new file with mode: 0644]
extra/gesture-logger/authors.txt [new file with mode: 0644]
extra/gesture-logger/deploy.factor [new file with mode: 0644]
extra/gesture-logger/gesture-logger.factor [new file with mode: 0644]
extra/gesture-logger/summary.txt [new file with mode: 0644]
extra/golden-section/authors.txt [new file with mode: 0644]
extra/golden-section/deploy.factor [new file with mode: 0644]
extra/golden-section/golden-section.factor [new file with mode: 0644]
extra/golden-section/summary.txt [new file with mode: 0644]
extra/golden-section/tags.txt [new file with mode: 0644]
extra/graphics/authors.txt [new file with mode: 0644]
extra/graphics/bitmap/bitmap.factor [new file with mode: 0644]
extra/graphics/tags.txt [new file with mode: 0644]
extra/graphics/viewer/viewer.factor [new file with mode: 0644]
extra/hardware-info/authors.txt [new file with mode: 0644]
extra/hardware-info/hardware-info.factor [new file with mode: 0644]
extra/hardware-info/linux/linux.factor [new file with mode: 0644]
extra/hardware-info/macosx/macosx.factor [new file with mode: 0644]
extra/hardware-info/summary.txt [new file with mode: 0644]
extra/hardware-info/windows/ce/ce.factor [new file with mode: 0644]
extra/hardware-info/windows/nt/nt.factor [new file with mode: 0644]
extra/hardware-info/windows/windows.factor [new file with mode: 0644]
extra/hash2/authors.txt [new file with mode: 0644]
extra/hash2/hash2-docs.factor [new file with mode: 0644]
extra/hash2/hash2-tests.factor [new file with mode: 0644]
extra/hash2/hash2.factor [new file with mode: 0644]
extra/hash2/summary.txt [new file with mode: 0644]
extra/hash2/tags.txt [new file with mode: 0644]
extra/hashtables/lib/authors.txt [new file with mode: 0644]
extra/hashtables/lib/lib.factor [new file with mode: 0644]
extra/hashtables/lib/summary.txt [new file with mode: 0644]
extra/hashtables/lib/tags.txt [new file with mode: 0644]
extra/hello-ui/authors.txt [new file with mode: 0644]
extra/hello-ui/deploy.factor [new file with mode: 0644]
extra/hello-ui/hello-ui.factor [new file with mode: 0644]
extra/hello-ui/summary.txt [new file with mode: 0644]
extra/hello-ui/tags.txt [new file with mode: 0644]
extra/hello-world/authors.txt [new file with mode: 0644]
extra/hello-world/deploy.factor [new file with mode: 0644]
extra/hello-world/hello-world.factor [new file with mode: 0644]
extra/hello-world/summary.txt [new file with mode: 0644]
extra/hello-world/tags.txt [new file with mode: 0644]
extra/help/authors.txt [new file with mode: 0644]
extra/help/cookbook/cookbook.factor [new file with mode: 0644]
extra/help/crossref/authors.txt [new file with mode: 0644]
extra/help/crossref/crossref-docs.factor [new file with mode: 0644]
extra/help/crossref/crossref-tests.factor [new file with mode: 0644]
extra/help/crossref/crossref.factor [new file with mode: 0644]
extra/help/crossref/summary.txt [new file with mode: 0644]
extra/help/definitions/authors.txt [new file with mode: 0644]
extra/help/definitions/definitions-tests.factor [new file with mode: 0644]
extra/help/definitions/definitions.factor [new file with mode: 0644]
extra/help/definitions/summary.txt [new file with mode: 0644]
extra/help/handbook/authors.txt [new file with mode: 0644]
extra/help/handbook/handbook.factor [new file with mode: 0644]
extra/help/handbook/summary.txt [new file with mode: 0644]
extra/help/help-docs.factor [new file with mode: 0644]
extra/help/help.factor [new file with mode: 0644]
extra/help/lint/authors.txt [new file with mode: 0644]
extra/help/lint/lint-docs.factor [new file with mode: 0644]
extra/help/lint/lint.factor [new file with mode: 0644]
extra/help/lint/summary.txt [new file with mode: 0644]
extra/help/lint/tags.txt [new file with mode: 0644]
extra/help/markup/authors.txt [new file with mode: 0644]
extra/help/markup/markup-docs.factor [new file with mode: 0644]
extra/help/markup/markup-tests.factor [new file with mode: 0644]
extra/help/markup/markup.factor [new file with mode: 0644]
extra/help/markup/summary.txt [new file with mode: 0644]
extra/help/stylesheet/authors.txt [new file with mode: 0644]
extra/help/stylesheet/stylesheet.factor [new file with mode: 0644]
extra/help/stylesheet/summary.txt [new file with mode: 0644]
extra/help/summary.txt [new file with mode: 0644]
extra/help/syntax/authors.txt [new file with mode: 0644]
extra/help/syntax/summary.txt [new file with mode: 0644]
extra/help/syntax/syntax-docs.factor [new file with mode: 0644]
extra/help/syntax/syntax-tests.factor [new file with mode: 0644]
extra/help/syntax/syntax.factor [new file with mode: 0644]
extra/help/topics/authors.txt [new file with mode: 0644]
extra/help/topics/summary.txt [new file with mode: 0644]
extra/help/topics/topics-docs.factor [new file with mode: 0644]
extra/help/topics/topics-tests.factor [new file with mode: 0644]
extra/help/topics/topics.factor [new file with mode: 0644]
extra/hexdump/authors.txt [new file with mode: 0644]
extra/hexdump/hexdump-docs.factor [new file with mode: 0644]
extra/hexdump/hexdump-tests.factor [new file with mode: 0644]
extra/hexdump/hexdump.factor [new file with mode: 0644]
extra/hexdump/summary.txt [new file with mode: 0644]
extra/hints/authors.txt [new file with mode: 0644]
extra/hints/hints.factor [new file with mode: 0644]
extra/hints/summary.txt [new file with mode: 0644]
extra/hints/tags.txt [new file with mode: 0644]
extra/html/authors.txt [new file with mode: 0644]
extra/html/elements/elements.factor [new file with mode: 0644]
extra/html/html-tests.factor [new file with mode: 0644]
extra/html/html.factor [new file with mode: 0644]
extra/html/summary.txt [new file with mode: 0644]
extra/html/tags.txt [new file with mode: 0644]
extra/http/authors.txt [new file with mode: 0644]
extra/http/basic-authentication/authors.txt [new file with mode: 0644]
extra/http/basic-authentication/basic-authentication-docs.factor [new file with mode: 0644]
extra/http/basic-authentication/basic-authentication-tests.factor [new file with mode: 0644]
extra/http/basic-authentication/basic-authentication.factor [new file with mode: 0644]
extra/http/basic-authentication/summary.txt [new file with mode: 0644]
extra/http/basic-authentication/tags.txt [new file with mode: 0644]
extra/http/client/authors.txt [new file with mode: 0644]
extra/http/client/client-tests.factor [new file with mode: 0644]
extra/http/client/client.factor [new file with mode: 0644]
extra/http/client/summary.txt [new file with mode: 0644]
extra/http/client/tags.txt [new file with mode: 0644]
extra/http/http-tests.factor [new file with mode: 0644]
extra/http/http.factor [new file with mode: 0644]
extra/http/mime/mime.factor [new file with mode: 0644]
extra/http/server/resources/prototype.js [new file with mode: 0644]
extra/http/server/resources/stylesheet.css [new file with mode: 0644]
extra/http/server/responders/callback/callback.factor [new file with mode: 0644]
extra/http/server/responders/continuation/continuation.factor [new file with mode: 0644]
extra/http/server/responders/continuation/examples/examples.factor [new file with mode: 0644]
extra/http/server/responders/continuation/examples/numbers/numbers.factor [new file with mode: 0644]
extra/http/server/responders/file/file.factor [new file with mode: 0644]
extra/http/server/responders/responders.factor [new file with mode: 0644]
extra/http/server/server-tests.factor [new file with mode: 0644]
extra/http/server/server.factor [new file with mode: 0644]
extra/http/server/summary.txt [new file with mode: 0644]
extra/http/server/tags.txt [new file with mode: 0644]
extra/http/server/templating/authors.txt [new file with mode: 0644]
extra/http/server/templating/templating-tests.factor [new file with mode: 0644]
extra/http/server/templating/templating.factor [new file with mode: 0644]
extra/http/server/templating/test/bug.fhtml [new file with mode: 0644]
extra/http/server/templating/test/bug.html [new file with mode: 0644]
extra/http/server/templating/test/example.fhtml [new file with mode: 0644]
extra/http/server/templating/test/example.html [new file with mode: 0644]
extra/http/server/templating/test/stack.fhtml [new file with mode: 0644]
extra/http/server/templating/test/stack.html [new file with mode: 0644]
extra/http/summary.txt [new file with mode: 0644]
extra/http/tags.txt [new file with mode: 0644]
extra/icfp/2006/2006.factor [new file with mode: 0644]
extra/icfp/2006/authors.txt [new file with mode: 0644]
extra/icfp/2006/sandmark.umz [new file with mode: 0644]
extra/icfp/2006/summary.txt [new file with mode: 0644]
extra/icfp/2006/tags.txt [new file with mode: 0644]
extra/id3/authors.txt [new file with mode: 0644]
extra/id3/id3-docs.factor [new file with mode: 0644]
extra/id3/id3.factor [new file with mode: 0644]
extra/id3/summary.txt [new file with mode: 0644]
extra/inverse/authors.txt [new file with mode: 0644]
extra/inverse/inverse-docs.factor [new file with mode: 0644]
extra/inverse/inverse-tests.factor [new file with mode: 0644]
extra/inverse/inverse.factor [new file with mode: 0644]
extra/inverse/tags.txt [new file with mode: 0644]
extra/io/launcher/authors.txt [new file with mode: 0644]
extra/io/launcher/launcher.factor [new file with mode: 0644]
extra/io/launcher/summary.txt [new file with mode: 0644]
extra/io/mmap/mmap-tests.factor [new file with mode: 0644]
extra/io/mmap/mmap.factor [new file with mode: 0644]
extra/io/nonblocking/authors.txt [new file with mode: 0644]
extra/io/nonblocking/nonblocking-docs.factor [new file with mode: 0644]
extra/io/nonblocking/nonblocking.factor [new file with mode: 0644]
extra/io/nonblocking/summary.txt [new file with mode: 0644]
extra/io/server/server-docs.factor [new file with mode: 0644]
extra/io/server/server.factor [new file with mode: 0644]
extra/io/sniffer/bsd/bsd.factor [new file with mode: 0644]
extra/io/sniffer/filter/bsd/bsd.factor [new file with mode: 0644]
extra/io/sniffer/filter/filter.factor [new file with mode: 0644]
extra/io/sniffer/sniffer.factor [new file with mode: 0644]
extra/io/sockets/authors.txt [new file with mode: 0644]
extra/io/sockets/headers/bsd/bsd.factor [new file with mode: 0644]
extra/io/sockets/headers/headers.factor [new file with mode: 0644]
extra/io/sockets/impl/impl-tests.factor [new file with mode: 0644]
extra/io/sockets/impl/impl.factor [new file with mode: 0644]
extra/io/sockets/sockets-docs.factor [new file with mode: 0644]
extra/io/sockets/sockets.factor [new file with mode: 0644]
extra/io/sockets/summary.txt [new file with mode: 0644]
extra/io/sockets/tags.txt [new file with mode: 0644]
extra/io/streams/null/null.factor [new file with mode: 0644]
extra/io/unix/authors.txt [new file with mode: 0644]
extra/io/unix/backend/authors.txt [new file with mode: 0644]
extra/io/unix/backend/backend.factor [new file with mode: 0644]
extra/io/unix/backend/summary.txt [new file with mode: 0644]
extra/io/unix/files/authors.txt [new file with mode: 0644]
extra/io/unix/files/files-tests.factor [new file with mode: 0644]
extra/io/unix/files/files.factor [new file with mode: 0644]
extra/io/unix/files/summary.txt [new file with mode: 0644]
extra/io/unix/launcher/launcher.factor [new file with mode: 0644]
extra/io/unix/mmap/mmap.factor [new file with mode: 0644]
extra/io/unix/sockets/authors.txt [new file with mode: 0644]
extra/io/unix/sockets/sockets.factor [new file with mode: 0644]
extra/io/unix/sockets/summary.txt [new file with mode: 0644]
extra/io/unix/summary.txt [new file with mode: 0644]
extra/io/unix/unix-tests.factor [new file with mode: 0644]
extra/io/unix/unix.factor [new file with mode: 0644]
extra/io/windows/authors.txt [new file with mode: 0644]
extra/io/windows/ce/authors.txt [new file with mode: 0644]
extra/io/windows/ce/ce.factor [new file with mode: 0644]
extra/io/windows/ce/summary.txt [new file with mode: 0644]
extra/io/windows/launcher/launcher.factor [new file with mode: 0644]
extra/io/windows/mmap/mmap.factor [new file with mode: 0644]
extra/io/windows/nt/authors.txt [new file with mode: 0644]
extra/io/windows/nt/backend/backend.factor [new file with mode: 0644]
extra/io/windows/nt/files/files.factor [new file with mode: 0644]
extra/io/windows/nt/nt.factor [new file with mode: 0644]
extra/io/windows/nt/sockets/sockets.factor [new file with mode: 0644]
extra/io/windows/nt/summary.txt [new file with mode: 0644]
extra/io/windows/summary.txt [new file with mode: 0644]
extra/io/windows/windows-tests.factor [new file with mode: 0644]
extra/io/windows/windows.factor [new file with mode: 0644]
extra/irc/authors.txt [new file with mode: 0644]
extra/irc/irc.factor [new file with mode: 0644]
extra/irc/summary.txt [new file with mode: 0644]
extra/json/reader/authors.txt [new file with mode: 0644]
extra/json/reader/reader-docs.factor [new file with mode: 0644]
extra/json/reader/reader.factor [new file with mode: 0644]
extra/json/reader/summary.txt [new file with mode: 0644]
extra/json/writer/authors.txt [new file with mode: 0644]
extra/json/writer/summary.txt [new file with mode: 0644]
extra/json/writer/writer-docs.factor [new file with mode: 0644]
extra/json/writer/writer.factor [new file with mode: 0644]
extra/koszul/koszul-tests.factor [new file with mode: 0644]
extra/koszul/koszul.factor [new file with mode: 0644]
extra/lazy-lists/authors.txt [new file with mode: 0644]
extra/lazy-lists/examples/examples-tests.factor [new file with mode: 0644]
extra/lazy-lists/examples/examples.factor [new file with mode: 0644]
extra/lazy-lists/lazy-lists-docs.factor [new file with mode: 0644]
extra/lazy-lists/lazy-lists-tests.factor [new file with mode: 0644]
extra/lazy-lists/lazy-lists.factor [new file with mode: 0644]
extra/lazy-lists/old-doc.html [new file with mode: 0644]
extra/lazy-lists/summary.txt [new file with mode: 0644]
extra/lazy-lists/tags.txt [new file with mode: 0644]
extra/lcd/authors.txt [new file with mode: 0644]
extra/lcd/lcd.factor [new file with mode: 0644]
extra/lcd/summary.txt [new file with mode: 0644]
extra/lcd/tags.txt [new file with mode: 0644]
extra/ldap/authors.txt [new file with mode: 0644]
extra/ldap/conf/addentry.ldif [new file with mode: 0644]
extra/ldap/conf/createdit.ldif [new file with mode: 0644]
extra/ldap/conf/slapd.conf [new file with mode: 0644]
extra/ldap/ldap-tests.factor [new file with mode: 0644]
extra/ldap/ldap.factor [new file with mode: 0644]
extra/ldap/libldap/libldap.factor [new file with mode: 0644]
extra/ldap/libldap/tags.txt [new file with mode: 0644]
extra/ldap/summary.txt [new file with mode: 0644]
extra/ldap/tags.txt [new file with mode: 0644]
extra/levenshtein/authors.txt [new file with mode: 0644]
extra/levenshtein/levenshtein-tests.factor [new file with mode: 0644]
extra/levenshtein/levenshtein.factor [new file with mode: 0644]
extra/levenshtein/summary.txt [new file with mode: 0644]
extra/lint/authors.txt [new file with mode: 0644]
extra/lint/lint-tests.factor [new file with mode: 0644]
extra/lint/lint.factor [new file with mode: 0644]
extra/lint/tags.txt [new file with mode: 0644]
extra/lisp/README [new file with mode: 0644]
extra/lisp/authors.txt [new file with mode: 0644]
extra/lisp/lexer/lexer.factor [new file with mode: 0644]
extra/lisp/lisp.factor [new file with mode: 0644]
extra/lisp/listener/listener.factor [new file with mode: 0644]
extra/lisp/listener/mod/mod.factor [new file with mode: 0644]
extra/lisp/parser/mod/mod.factor [new file with mode: 0644]
extra/lisp/summary.txt [new file with mode: 0644]
extra/lisp/syntax/syntax.factor [new file with mode: 0644]
extra/lisp/tags.txt [new file with mode: 0644]
extra/lisppaste/authors.txt [new file with mode: 0644]
extra/lisppaste/lisppaste.factor [new file with mode: 0644]
extra/lisppaste/summary.txt [new file with mode: 0644]
extra/lisppaste/tags.txt [new file with mode: 0644]
extra/locals/authors.txt [new file with mode: 0644]
extra/locals/locals-docs.factor [new file with mode: 0644]
extra/locals/locals-tests.factor [new file with mode: 0644]
extra/locals/locals.factor [new file with mode: 0644]
extra/locals/summary.txt [new file with mode: 0644]
extra/locals/tags.txt [new file with mode: 0644]
extra/lsys/authors.txt [new file with mode: 0644]
extra/lsys/strings/strings.factor [new file with mode: 0644]
extra/lsys/summary.txt [new file with mode: 0644]
extra/lsys/tags.txt [new file with mode: 0644]
extra/lsys/tortoise/graphics/graphics.factor [new file with mode: 0644]
extra/lsys/tortoise/tortoise.factor [new file with mode: 0644]
extra/lsys/ui/ui.factor [new file with mode: 0644]
extra/lunar-rescue/authors.txt [new file with mode: 0644]
extra/lunar-rescue/lunar-rescue-docs.factor [new file with mode: 0644]
extra/lunar-rescue/lunar-rescue.factor [new file with mode: 0644]
extra/lunar-rescue/summary.txt [new file with mode: 0644]
extra/lunar-rescue/tags.txt [new file with mode: 0644]
extra/macros/authors.txt [new file with mode: 0644]
extra/macros/macros-docs.factor [new file with mode: 0644]
extra/macros/macros-tests.factor [new file with mode: 0644]
extra/macros/macros.factor [new file with mode: 0644]
extra/macros/summary.txt [new file with mode: 0644]
extra/macros/tags.txt [new file with mode: 0644]
extra/macros/zoo/zoo.factor [new file with mode: 0644]
extra/mad/api/api.factor [new file with mode: 0644]
extra/mad/authors.txt [new file with mode: 0644]
extra/mad/mad-tests.factor [new file with mode: 0644]
extra/mad/mad.factor [new file with mode: 0644]
extra/mad/player/player.factor [new file with mode: 0644]
extra/mad/summary.txt [new file with mode: 0644]
extra/match/authors.txt [new file with mode: 0644]
extra/match/match-docs.factor [new file with mode: 0644]
extra/match/match-tests.factor [new file with mode: 0644]
extra/match/match.factor [new file with mode: 0644]
extra/match/summary.txt [new file with mode: 0644]
extra/match/tags.txt [new file with mode: 0644]
extra/math/analysis/analysis-tests.factor [new file with mode: 0644]
extra/math/analysis/analysis.factor [new file with mode: 0644]
extra/math/analysis/authors.txt [new file with mode: 0644]
extra/math/analysis/summary.txt [new file with mode: 0644]
extra/math/combinatorics/authors.txt [new file with mode: 0644]
extra/math/combinatorics/combinatorics.factor [new file with mode: 0644]
extra/math/combinatorics/summary.txt [new file with mode: 0644]
extra/math/fft/authors.txt [new file with mode: 0644]
extra/math/fft/fft.factor [new file with mode: 0644]
extra/math/fft/summary.txt [new file with mode: 0644]
extra/math/haar/haar.factor [new file with mode: 0644]
extra/math/haar/summary.txt [new file with mode: 0644]
extra/math/matrices/authors.txt [new file with mode: 0644]
extra/math/matrices/elimination/authors.txt [new file with mode: 0644]
extra/math/matrices/elimination/elimination-tests.factor [new file with mode: 0644]
extra/math/matrices/elimination/elimination.factor [new file with mode: 0644]
extra/math/matrices/elimination/summary.txt [new file with mode: 0644]
extra/math/matrices/matrices-tests.factor [new file with mode: 0644]
extra/math/matrices/matrices.factor [new file with mode: 0644]
extra/math/matrices/summary.txt [new file with mode: 0644]
extra/math/miller-rabin/miller-rabin-tests.factor [new file with mode: 0644]
extra/math/miller-rabin/miller-rabin.factor [new file with mode: 0644]
extra/math/numerical-integration/authors.txt [new file with mode: 0644]
extra/math/numerical-integration/numerical-integration-tests.factor [new file with mode: 0644]
extra/math/numerical-integration/numerical-integration.factor [new file with mode: 0644]
extra/math/numerical-integration/summary.txt [new file with mode: 0644]
extra/math/polynomials/authors.txt [new file with mode: 0644]
extra/math/polynomials/polynomials-tests.factor [new file with mode: 0644]
extra/math/polynomials/polynomials.factor [new file with mode: 0644]
extra/math/polynomials/summary.txt [new file with mode: 0644]
extra/math/primes/list/list.factor [new file with mode: 0644]
extra/math/quadratic/authors.txt [new file with mode: 0644]
extra/math/quadratic/quadratic.factor [new file with mode: 0644]
extra/math/quadratic/summary.txt [new file with mode: 0644]
extra/math/quaternions/authors.txt [new file with mode: 0644]
extra/math/quaternions/quaternions-tests.factor [new file with mode: 0644]
extra/math/quaternions/quaternions.factor [new file with mode: 0644]
extra/math/quaternions/summary.txt [new file with mode: 0644]
extra/math/ranges/authors.txt [new file with mode: 0644]
extra/math/ranges/ranges-tests.factor [new file with mode: 0644]
extra/math/ranges/ranges.factor [new file with mode: 0644]
extra/math/ranges/summary.txt [new file with mode: 0644]
extra/math/statistics/authors.txt [new file with mode: 0644]
extra/math/statistics/statistics-tests.factor [new file with mode: 0644]
extra/math/statistics/statistics.factor [new file with mode: 0644]
extra/math/statistics/summary.txt [new file with mode: 0644]
extra/math/trig/trig.factor [new file with mode: 0644]
extra/maze/authors.txt [new file with mode: 0644]
extra/maze/deploy.factor [new file with mode: 0644]
extra/maze/maze.factor [new file with mode: 0644]
extra/maze/summary.txt [new file with mode: 0644]
extra/maze/tags.txt [new file with mode: 0644]
extra/memoize/authors.txt [new file with mode: 0644]
extra/memoize/memoize-docs.factor [new file with mode: 0644]
extra/memoize/memoize-tests.factor [new file with mode: 0644]
extra/memoize/memoize.factor [new file with mode: 0644]
extra/memoize/summary.txt [new file with mode: 0644]
extra/memoize/tags.txt [new file with mode: 0644]
extra/models/authors.txt [new file with mode: 0644]
extra/models/models-docs.factor [new file with mode: 0644]
extra/models/models-tests.factor [new file with mode: 0644]
extra/models/models.factor [new file with mode: 0644]
extra/models/summary.txt [new file with mode: 0644]
extra/models/tags.txt [new file with mode: 0644]
extra/mortar/authors.txt [new file with mode: 0644]
extra/mortar/mortar.factor [new file with mode: 0644]
extra/mortar/tags.txt [new file with mode: 0644]
extra/msxml-to-csv/authors.txt [new file with mode: 0644]
extra/msxml-to-csv/msxml-to-csv.factor [new file with mode: 0644]
extra/msxml-to-csv/summary.txt [new file with mode: 0644]
extra/msxml-to-csv/tags.txt [new file with mode: 0644]
extra/namespaces/lib/authors.txt [new file with mode: 0644]
extra/namespaces/lib/lib.factor [new file with mode: 0644]
extra/namespaces/lib/summary.txt [new file with mode: 0644]
extra/namespaces/lib/tags.txt [new file with mode: 0644]
extra/nehe/2/2.factor [new file with mode: 0644]
extra/nehe/3/3.factor [new file with mode: 0644]
extra/nehe/4/4.factor [new file with mode: 0644]
extra/nehe/5/5.factor [new file with mode: 0644]
extra/nehe/authors.txt [new file with mode: 0644]
extra/nehe/deploy.factor [new file with mode: 0644]
extra/nehe/nehe.factor [new file with mode: 0644]
extra/nehe/summary.txt [new file with mode: 0644]
extra/nehe/tags.txt [new file with mode: 0644]
extra/numbers-game/authors.txt [new file with mode: 0644]
extra/numbers-game/numbers-game.factor [new file with mode: 0644]
extra/numbers-game/summary.txt [new file with mode: 0644]
extra/numbers-game/tags.txt [new file with mode: 0644]
extra/odbc/authors.txt [new file with mode: 0644]
extra/odbc/odbc-docs.factor [new file with mode: 0644]
extra/odbc/odbc.factor [new file with mode: 0644]
extra/odbc/summary.txt [new file with mode: 0644]
extra/odbc/tags.txt [new file with mode: 0644]
extra/ogg/authors.txt [new file with mode: 0644]
extra/ogg/ogg.factor [new file with mode: 0644]
extra/ogg/player/authors.txt [new file with mode: 0644]
extra/ogg/player/player.factor [new file with mode: 0644]
extra/ogg/player/summary.txt [new file with mode: 0644]
extra/ogg/player/tags.txt [new file with mode: 0644]
extra/ogg/summary.txt [new file with mode: 0644]
extra/ogg/tags.txt [new file with mode: 0644]
extra/ogg/theora/authors.txt [new file with mode: 0644]
extra/ogg/theora/summary.txt [new file with mode: 0644]
extra/ogg/theora/tags.txt [new file with mode: 0644]
extra/ogg/theora/theora.factor [new file with mode: 0644]
extra/ogg/vorbis/authors.txt [new file with mode: 0644]
extra/ogg/vorbis/summary.txt [new file with mode: 0644]
extra/ogg/vorbis/tags.txt [new file with mode: 0644]
extra/ogg/vorbis/vorbis.factor [new file with mode: 0644]
extra/openal/authors.txt [new file with mode: 0644]
extra/openal/example/example.factor [new file with mode: 0644]
extra/openal/macosx/macosx.factor [new file with mode: 0644]
extra/openal/openal.factor [new file with mode: 0644]
extra/openal/other/other.factor [new file with mode: 0644]
extra/openal/summary.txt [new file with mode: 0644]
extra/openal/tags.txt [new file with mode: 0644]
extra/opengl/authors.txt [new file with mode: 0644]
extra/opengl/camera/camera.factor [new file with mode: 0644]
extra/opengl/gl/authors.txt [new file with mode: 0644]
extra/opengl/gl/gl.factor [new file with mode: 0644]
extra/opengl/gl/summary.txt [new file with mode: 0644]
extra/opengl/gl/tags.txt [new file with mode: 0644]
extra/opengl/glu/authors.txt [new file with mode: 0644]
extra/opengl/glu/glu.factor [new file with mode: 0644]
extra/opengl/glu/summary.txt [new file with mode: 0644]
extra/opengl/glu/tags.txt [new file with mode: 0644]
extra/opengl/lib/lib.factor [new file with mode: 0644]
extra/opengl/opengl-docs.factor [new file with mode: 0644]
extra/opengl/opengl.factor [new file with mode: 0644]
extra/opengl/summary.txt [new file with mode: 0644]
extra/opengl/tags.txt [new file with mode: 0644]
extra/openssl/authors.txt [new file with mode: 0644]
extra/openssl/libcrypto/libcrypto.factor [new file with mode: 0644]
extra/openssl/libssl/libssl.factor [new file with mode: 0644]
extra/openssl/openssl-tests.factor [new file with mode: 0644]
extra/openssl/openssl.factor [new file with mode: 0644]
extra/openssl/tags.txt [new file with mode: 0644]
extra/openssl/test/dh1024.pem [new file with mode: 0644]
extra/openssl/test/errors.txt [new file with mode: 0644]
extra/openssl/test/root.pem [new file with mode: 0644]
extra/openssl/test/server.pem [new file with mode: 0644]
extra/oracle/authors.txt [new file with mode: 0644]
extra/oracle/liboci/liboci.factor [new file with mode: 0644]
extra/oracle/oracle-tests.factor [new file with mode: 0644]
extra/oracle/oracle.factor [new file with mode: 0644]
extra/oracle/summary.txt [new file with mode: 0644]
extra/oracle/tags.txt [new file with mode: 0644]
extra/ori/authors.txt [new file with mode: 0644]
extra/ori/ori.factor [new file with mode: 0644]
extra/pack/authors.txt [new file with mode: 0644]
extra/pack/pack-tests.factor [new file with mode: 0644]
extra/pack/pack.factor [new file with mode: 0644]
extra/parser-combinators/authors.txt [new file with mode: 0644]
extra/parser-combinators/parser-combinators-docs.factor [new file with mode: 0644]
extra/parser-combinators/parser-combinators-tests.factor [new file with mode: 0644]
extra/parser-combinators/parser-combinators.factor [new file with mode: 0644]
extra/parser-combinators/parser-combinators.html [new file with mode: 0644]
extra/parser-combinators/replace/replace-docs.factor [new file with mode: 0644]
extra/parser-combinators/replace/replace.factor [new file with mode: 0644]
extra/parser-combinators/simple/simple-docs.factor [new file with mode: 0644]
extra/parser-combinators/simple/simple.factor [new file with mode: 0644]
extra/parser-combinators/summary.txt [new file with mode: 0644]
extra/partial-continuations/authors.txt [new file with mode: 0644]
extra/partial-continuations/partial-continuations-docs.factor [new file with mode: 0644]
extra/partial-continuations/partial-continuations-tests.factor [new file with mode: 0644]
extra/partial-continuations/partial-continuations.factor [new file with mode: 0644]
extra/partial-continuations/summary.txt [new file with mode: 0644]
extra/partial-continuations/tags.txt [new file with mode: 0644]
extra/pdf/authors.txt [new file with mode: 0644]
extra/pdf/libhpdf/libhpdf.factor [new file with mode: 0644]
extra/pdf/pdf-tests.factor [new file with mode: 0644]
extra/pdf/pdf.factor [new file with mode: 0644]
extra/pdf/readme.txt [new file with mode: 0644]
extra/pdf/test/font_test.pdf [new file with mode: 0644]
extra/porter-stemmer/authors.txt [new file with mode: 0644]
extra/porter-stemmer/porter-stemmer-docs.factor [new file with mode: 0644]
extra/porter-stemmer/porter-stemmer-tests.factor [new file with mode: 0644]
extra/porter-stemmer/porter-stemmer.factor [new file with mode: 0644]
extra/porter-stemmer/summary.txt [new file with mode: 0644]
extra/porter-stemmer/test/output.txt [new file with mode: 0644]
extra/porter-stemmer/test/voc.txt [new file with mode: 0644]
extra/pos/authors.txt [new file with mode: 0644]
extra/pos/pos.factor [new file with mode: 0644]
extra/postgresql/authors.txt [new file with mode: 0644]
extra/postgresql/libpq/libpq.factor [new file with mode: 0644]
extra/postgresql/postgresql-tests.factor [new file with mode: 0644]
extra/postgresql/postgresql.factor [new file with mode: 0644]
extra/promises/authors.txt [new file with mode: 0644]
extra/promises/promises-docs.factor [new file with mode: 0644]
extra/promises/promises.factor [new file with mode: 0644]
extra/promises/summary.txt [new file with mode: 0644]
extra/promises/tags.txt [new file with mode: 0644]
extra/qualified/authors.txt [new file with mode: 0644]
extra/qualified/qualified-docs.factor [new file with mode: 0644]
extra/qualified/qualified-tests.factor [new file with mode: 0644]
extra/qualified/qualified.factor [new file with mode: 0644]
extra/qualified/summary.txt [new file with mode: 0644]
extra/qualified/tags.txt [new file with mode: 0644]
extra/random-weighted/authors.txt [new file with mode: 0644]
extra/random-weighted/random-weighted.factor [new file with mode: 0644]
extra/random/authors.txt [new file with mode: 0644]
extra/random/random-docs.factor [new file with mode: 0644]
extra/random/random-tests.factor [new file with mode: 0644]
extra/random/random.factor [new file with mode: 0644]
extra/random/summary.txt [new file with mode: 0644]
extra/rewrite-closures/authors.txt [new file with mode: 0644]
extra/rewrite-closures/rewrite-closures.factor [new file with mode: 0644]
extra/rewrite-closures/summary.txt [new file with mode: 0644]
extra/rewrite-closures/tags.txt [new file with mode: 0644]
extra/roman/authors.txt [new file with mode: 0644]
extra/roman/roman-docs.factor [new file with mode: 0644]
extra/roman/roman-tests.factor [new file with mode: 0644]
extra/roman/roman.factor [new file with mode: 0644]
extra/roman/summary.txt [new file with mode: 0644]
extra/roman/tags.txt [new file with mode: 0644]
extra/rot13/authors.txt [new file with mode: 0644]
extra/rot13/rot13.factor [new file with mode: 0644]
extra/rot13/summary.txt [new file with mode: 0644]
extra/rot13/tags.txt [new file with mode: 0644]
extra/rss/atom.xml [new file with mode: 0644]
extra/rss/reader/reader.factor [new file with mode: 0644]
extra/rss/readme.txt [new file with mode: 0644]
extra/rss/rss-tests.factor [new file with mode: 0644]
extra/rss/rss.factor [new file with mode: 0644]
extra/rss/rss1.xml [new file with mode: 0644]
extra/self/authors.txt [new file with mode: 0644]
extra/self/self.factor [new file with mode: 0644]
extra/sequences/lib/authors.txt [new file with mode: 0644]
extra/sequences/lib/lib-tests.factor [new file with mode: 0644]
extra/sequences/lib/lib.factor [new file with mode: 0644]
extra/sequences/lib/tags.txt [new file with mode: 0644]
extra/sequences/next/authors.txt [new file with mode: 0644]
extra/sequences/next/next-tests.factor [new file with mode: 0644]
extra/sequences/next/next.factor [new file with mode: 0644]
extra/sequences/next/tags.txt [new file with mode: 0644]
extra/serialize/authors.txt [new file with mode: 0644]
extra/serialize/serialize-docs.factor [new file with mode: 0644]
extra/serialize/serialize-tests.factor [new file with mode: 0644]
extra/serialize/serialize.factor [new file with mode: 0644]
extra/serialize/summary.txt [new file with mode: 0644]
extra/shuffle/authors.txt [new file with mode: 0644]
extra/shuffle/shuffle-docs.factor [new file with mode: 0644]
extra/shuffle/shuffle-tests.factor [new file with mode: 0644]
extra/shuffle/shuffle.factor [new file with mode: 0644]
extra/shuffle/summary.txt [new file with mode: 0644]
extra/shuffle/tags.txt [new file with mode: 0644]
extra/shufflers/authors.txt [new file with mode: 0644]
extra/shufflers/shufflers-docs.factor [new file with mode: 0644]
extra/shufflers/shufflers-tests.factor [new file with mode: 0644]
extra/shufflers/shufflers.factor [new file with mode: 0644]
extra/shufflers/summary.txt [new file with mode: 0644]
extra/shufflers/tags.txt [new file with mode: 0644]
extra/slides/authors.txt [new file with mode: 0644]
extra/slides/slides.factor [new file with mode: 0644]
extra/smtp/authors.txt [new file with mode: 0644]
extra/smtp/smtp-server.factor [new file with mode: 0644]
extra/smtp/smtp-tests.factor [new file with mode: 0644]
extra/smtp/smtp.factor [new file with mode: 0644]
extra/smtp/summary.txt [new file with mode: 0644]
extra/smtp/tags.txt [new file with mode: 0644]
extra/space-invaders/authors.txt [new file with mode: 0644]
extra/space-invaders/resources/BaseHit.wav [new file with mode: 0644]
extra/space-invaders/resources/InvHit.Wav [new file with mode: 0644]
extra/space-invaders/resources/Shot.wav [new file with mode: 0644]
extra/space-invaders/resources/Ufo.wav [new file with mode: 0644]
extra/space-invaders/resources/UfoHit.wav [new file with mode: 0644]
extra/space-invaders/resources/Walk1.wav [new file with mode: 0644]
extra/space-invaders/resources/Walk2.wav [new file with mode: 0644]
extra/space-invaders/resources/Walk3.wav [new file with mode: 0644]
extra/space-invaders/resources/Walk4.wav [new file with mode: 0644]
extra/space-invaders/space-invaders-docs.factor [new file with mode: 0644]
extra/space-invaders/space-invaders.factor [new file with mode: 0644]
extra/space-invaders/summary.txt [new file with mode: 0644]
extra/space-invaders/tags.txt [new file with mode: 0644]
extra/splay-trees/authors.txt [new file with mode: 0644]
extra/splay-trees/splay-trees-tests.factor [new file with mode: 0644]
extra/splay-trees/splay-trees.factor [new file with mode: 0644]
extra/splay-trees/summary.txt [new file with mode: 0644]
extra/splay-trees/tags.txt [new file with mode: 0644]
extra/sqlite/lib/lib.factor [new file with mode: 0644]
extra/sqlite/sqlite-docs.factor [new file with mode: 0644]
extra/sqlite/sqlite-tests.factor [new file with mode: 0644]
extra/sqlite/sqlite.factor [new file with mode: 0644]
extra/sqlite/test.txt [new file with mode: 0644]
extra/sqlite/tuple-db/tuple-db-docs.factor [new file with mode: 0644]
extra/sqlite/tuple-db/tuple-db-tests.factor [new file with mode: 0644]
extra/sqlite/tuple-db/tuple-db.factor [new file with mode: 0644]
extra/state-machine/state-machine.factor [new file with mode: 0644]
extra/state-parser/authors.txt [new file with mode: 0644]
extra/state-parser/state-parser-docs.factor [new file with mode: 0644]
extra/state-parser/state-parser-tests.factor [new file with mode: 0644]
extra/state-parser/state-parser.factor [new file with mode: 0644]
extra/state-parser/summary.txt [new file with mode: 0644]
extra/store/authors.txt [new file with mode: 0644]
extra/store/blob/blob.factor [new file with mode: 0644]
extra/store/store.factor [new file with mode: 0644]
extra/strings/lib/lib.factor [new file with mode: 0644]
extra/strings/lib/tags.txt [new file with mode: 0644]
extra/structs/structs.factor [new file with mode: 0644]
extra/structs/tags.txt [new file with mode: 0644]
extra/sudoku/authors.txt [new file with mode: 0644]
extra/sudoku/sudoku.factor [new file with mode: 0644]
extra/sudoku/summary.txt [new file with mode: 0644]
extra/sudoku/tags.txt [new file with mode: 0644]
extra/tar/tar.factor [new file with mode: 0644]
extra/tetris/README.txt [new file with mode: 0644]
extra/tetris/authors.txt [new file with mode: 0644]
extra/tetris/board/board-tests.factor [new file with mode: 0644]
extra/tetris/board/board.factor [new file with mode: 0644]
extra/tetris/deploy.factor [new file with mode: 0644]
extra/tetris/game/game-tests.factor [new file with mode: 0644]
extra/tetris/game/game.factor [new file with mode: 0644]
extra/tetris/gl/gl.factor [new file with mode: 0644]
extra/tetris/piece/piece-tests.factor [new file with mode: 0644]
extra/tetris/piece/piece.factor [new file with mode: 0644]
extra/tetris/summary.txt [new file with mode: 0644]
extra/tetris/tags.txt [new file with mode: 0644]
extra/tetris/tetris.factor [new file with mode: 0644]
extra/tetris/tetromino/tetromino.factor [new file with mode: 0644]
extra/timers/authors.txt [new file with mode: 0644]
extra/timers/summary.txt [new file with mode: 0644]
extra/timers/timers-docs.factor [new file with mode: 0644]
extra/timers/timers.factor [new file with mode: 0644]
extra/tools/annotations/annotations-docs.factor [new file with mode: 0644]
extra/tools/annotations/annotations-tests.factor [new file with mode: 0644]
extra/tools/annotations/annotations.factor [new file with mode: 0644]
extra/tools/annotations/authors.txt [new file with mode: 0644]
extra/tools/annotations/summary.txt [new file with mode: 0644]
extra/tools/annotations/tags.txt [new file with mode: 0644]
extra/tools/browser/browser-docs.factor [new file with mode: 0644]
extra/tools/browser/browser-tests.factor [new file with mode: 0644]
extra/tools/browser/browser.factor [new file with mode: 0644]
extra/tools/browser/tags.txt [new file with mode: 0644]
extra/tools/completion/authors.txt [new file with mode: 0644]
extra/tools/completion/completion-docs.factor [new file with mode: 0644]
extra/tools/completion/completion.factor [new file with mode: 0644]
extra/tools/completion/summary.txt [new file with mode: 0644]
extra/tools/crossref/authors.txt [new file with mode: 0644]
extra/tools/crossref/crossref-docs.factor [new file with mode: 0644]
extra/tools/crossref/crossref-tests.factor [new file with mode: 0644]
extra/tools/crossref/crossref.factor [new file with mode: 0644]
extra/tools/crossref/summary.txt [new file with mode: 0644]
extra/tools/crossref/tags.txt [new file with mode: 0644]
extra/tools/deploy/app/app.factor [new file with mode: 0644]
extra/tools/deploy/app/summary.txt [new file with mode: 0644]
extra/tools/deploy/app/tags.txt [new file with mode: 0644]
extra/tools/deploy/authors.txt [new file with mode: 0644]
extra/tools/deploy/deploy-docs.factor [new file with mode: 0644]
extra/tools/deploy/deploy.factor [new file with mode: 0644]
extra/tools/deploy/strip-cocoa.factor [new file with mode: 0644]
extra/tools/deploy/strip-debugger.factor [new file with mode: 0644]
extra/tools/deploy/summary.txt [new file with mode: 0644]
extra/tools/deploy/tags.txt [new file with mode: 0644]
extra/tools/interpreter/authors.txt [new file with mode: 0644]
extra/tools/interpreter/interpreter-docs.factor [new file with mode: 0644]
extra/tools/interpreter/interpreter-tests.factor [new file with mode: 0644]
extra/tools/interpreter/interpreter.factor [new file with mode: 0644]
extra/tools/interpreter/summary.txt [new file with mode: 0644]
extra/tools/memory/authors.txt [new file with mode: 0644]
extra/tools/memory/memory-docs.factor [new file with mode: 0644]
extra/tools/memory/memory-tests.factor [new file with mode: 0644]
extra/tools/memory/memory.factor [new file with mode: 0644]
extra/tools/memory/summary.txt [new file with mode: 0644]
extra/tools/memory/tags.txt [new file with mode: 0644]
extra/tools/profiler/authors.txt [new file with mode: 0644]
extra/tools/profiler/profiler-docs.factor [new file with mode: 0644]
extra/tools/profiler/profiler-tests.factor [new file with mode: 0644]
extra/tools/profiler/profiler.factor [new file with mode: 0644]
extra/tools/profiler/summary.txt [new file with mode: 0644]
extra/tools/profiler/tags.txt [new file with mode: 0644]
extra/tools/summary.txt [new file with mode: 0644]
extra/tools/test/authors.txt [new file with mode: 0644]
extra/tools/test/foo.factor [new file with mode: 0644]
extra/tools/test/summary.txt [new file with mode: 0644]
extra/tools/test/tags.txt [new file with mode: 0644]
extra/tools/test/test-docs.factor [new file with mode: 0644]
extra/tools/test/test.factor [new file with mode: 0644]
extra/tools/test/tools.factor [new file with mode: 0644]
extra/tools/time/authors.txt [new file with mode: 0644]
extra/tools/time/summary.txt [new file with mode: 0644]
extra/tools/time/tags.txt [new file with mode: 0644]
extra/tools/time/time-docs.factor [new file with mode: 0644]
extra/tools/time/time.factor [new file with mode: 0644]
extra/tools/walker/authors.txt [new file with mode: 0644]
extra/tools/walker/summary.txt [new file with mode: 0644]
extra/tools/walker/tags.txt [new file with mode: 0644]
extra/tools/walker/walker.factor [new file with mode: 0644]
extra/trees/authors.txt [new file with mode: 0644]
extra/trees/avl-tree/avl-tree-tests.factor [new file with mode: 0644]
extra/trees/avl-tree/avl-tree.factor [new file with mode: 0644]
extra/trees/bst/bst-tests.factor [new file with mode: 0644]
extra/trees/bst/bst.factor [new file with mode: 0644]
extra/trees/summary.txt [new file with mode: 0644]
extra/trees/tags.txt [new file with mode: 0644]
extra/trees/trees.factor [new file with mode: 0644]
extra/tty-server/authors.txt [new file with mode: 0644]
extra/tty-server/summary.txt [new file with mode: 0644]
extra/tty-server/tags.txt [new file with mode: 0644]
extra/tty-server/tty-server.factor [new file with mode: 0644]
extra/tuple-arrays/authors.txt [new file with mode: 0644]
extra/tuple-arrays/summary.txt [new file with mode: 0644]
extra/tuple-arrays/tags.txt [new file with mode: 0644]
extra/tuple-arrays/tuple-arrays-docs.factor [new file with mode: 0644]
extra/tuple-arrays/tuple-arrays-tests.factor [new file with mode: 0644]
extra/tuple-arrays/tuple-arrays.factor [new file with mode: 0644]
extra/tuples/lib/authors.txt [new file with mode: 0644]
extra/tuples/lib/lib-docs.factor [new file with mode: 0644]
extra/tuples/lib/lib-tests.factor [new file with mode: 0644]
extra/tuples/lib/lib.factor [new file with mode: 0644]
extra/turing/authors.txt [new file with mode: 0644]
extra/turing/summary.txt [new file with mode: 0644]
extra/turing/tags.txt [new file with mode: 0644]
extra/turing/turing.factor [new file with mode: 0644]
extra/turtle/authors.txt [new file with mode: 0644]
extra/turtle/turtle.factor [new file with mode: 0644]
extra/ui/authors.txt [new file with mode: 0644]
extra/ui/backend/authors.txt [new file with mode: 0644]
extra/ui/backend/backend.factor [new file with mode: 0644]
extra/ui/backend/summary.txt [new file with mode: 0644]
extra/ui/clipboards/authors.txt [new file with mode: 0644]
extra/ui/clipboards/clipboards-docs.factor [new file with mode: 0644]
extra/ui/clipboards/clipboards.factor [new file with mode: 0644]
extra/ui/clipboards/summary.txt [new file with mode: 0644]
extra/ui/cocoa/authors.txt [new file with mode: 0644]
extra/ui/cocoa/cocoa.factor [new file with mode: 0644]
extra/ui/cocoa/summary.txt [new file with mode: 0644]
extra/ui/cocoa/tools/authors.txt [new file with mode: 0644]
extra/ui/cocoa/tools/summary.txt [new file with mode: 0644]
extra/ui/cocoa/tools/tools.factor [new file with mode: 0644]
extra/ui/cocoa/views/authors.txt [new file with mode: 0644]
extra/ui/cocoa/views/summary.txt [new file with mode: 0644]
extra/ui/cocoa/views/views.factor [new file with mode: 0644]
extra/ui/commands/authors.txt [new file with mode: 0644]
extra/ui/commands/commands-docs.factor [new file with mode: 0644]
extra/ui/commands/commands-tests.factor [new file with mode: 0644]
extra/ui/commands/commands.factor [new file with mode: 0644]
extra/ui/commands/summary.txt [new file with mode: 0644]
extra/ui/freetype/authors.txt [new file with mode: 0644]
extra/ui/freetype/freetype-docs.factor [new file with mode: 0644]
extra/ui/freetype/freetype.factor [new file with mode: 0644]
extra/ui/freetype/summary.txt [new file with mode: 0644]
extra/ui/gadgets/authors.txt [new file with mode: 0644]
extra/ui/gadgets/books/authors.txt [new file with mode: 0644]
extra/ui/gadgets/books/books-docs.factor [new file with mode: 0644]
extra/ui/gadgets/books/books.factor [new file with mode: 0644]
extra/ui/gadgets/books/summary.txt [new file with mode: 0644]
extra/ui/gadgets/borders/authors.txt [new file with mode: 0644]
extra/ui/gadgets/borders/borders-docs.factor [new file with mode: 0644]
extra/ui/gadgets/borders/borders.factor [new file with mode: 0644]
extra/ui/gadgets/borders/summary.txt [new file with mode: 0644]
extra/ui/gadgets/buttons/authors.txt [new file with mode: 0644]
extra/ui/gadgets/buttons/buttons-docs.factor [new file with mode: 0644]
extra/ui/gadgets/buttons/buttons-tests.factor [new file with mode: 0644]
extra/ui/gadgets/buttons/buttons.factor [new file with mode: 0644]
extra/ui/gadgets/buttons/summary.txt [new file with mode: 0644]
extra/ui/gadgets/canvas/canvas.factor [new file with mode: 0644]
extra/ui/gadgets/controls/authors.txt [new file with mode: 0644]
extra/ui/gadgets/controls/controls-docs.factor [new file with mode: 0644]
extra/ui/gadgets/controls/controls.factor [new file with mode: 0644]
extra/ui/gadgets/controls/summary.txt [new file with mode: 0644]
extra/ui/gadgets/editors/authors.txt [new file with mode: 0644]
extra/ui/gadgets/editors/editors-docs.factor [new file with mode: 0644]
extra/ui/gadgets/editors/editors-tests.factor [new file with mode: 0644]
extra/ui/gadgets/editors/editors.factor [new file with mode: 0644]
extra/ui/gadgets/editors/summary.txt [new file with mode: 0644]
extra/ui/gadgets/frames/authors.txt [new file with mode: 0644]
extra/ui/gadgets/frames/frames-docs.factor [new file with mode: 0644]
extra/ui/gadgets/frames/frames-tests.factor [new file with mode: 0644]
extra/ui/gadgets/frames/frames.factor [new file with mode: 0644]
extra/ui/gadgets/frames/summary.txt [new file with mode: 0644]
extra/ui/gadgets/gadgets-docs.factor [new file with mode: 0644]
extra/ui/gadgets/gadgets-tests.factor [new file with mode: 0644]
extra/ui/gadgets/gadgets.factor [new file with mode: 0644]
extra/ui/gadgets/grid-lines/authors.txt [new file with mode: 0644]
extra/ui/gadgets/grid-lines/grid-lines-docs.factor [new file with mode: 0644]
extra/ui/gadgets/grid-lines/grid-lines.factor [new file with mode: 0644]
extra/ui/gadgets/grid-lines/summary.txt [new file with mode: 0644]
extra/ui/gadgets/grids/authors.txt [new file with mode: 0644]
extra/ui/gadgets/grids/grids-docs.factor [new file with mode: 0644]
extra/ui/gadgets/grids/grids-tests.factor [new file with mode: 0644]
extra/ui/gadgets/grids/grids.factor [new file with mode: 0644]
extra/ui/gadgets/grids/summary.txt [new file with mode: 0644]
extra/ui/gadgets/handler/handler.factor [new file with mode: 0644]
extra/ui/gadgets/incremental/authors.txt [new file with mode: 0644]
extra/ui/gadgets/incremental/incremental-docs.factor [new file with mode: 0644]
extra/ui/gadgets/incremental/incremental.factor [new file with mode: 0644]
extra/ui/gadgets/incremental/summary.txt [new file with mode: 0644]
extra/ui/gadgets/labelled/authors.txt [new file with mode: 0644]
extra/ui/gadgets/labelled/labelled-docs.factor [new file with mode: 0644]
extra/ui/gadgets/labelled/labelled-tests.factor [new file with mode: 0644]
extra/ui/gadgets/labelled/labelled.factor [new file with mode: 0644]
extra/ui/gadgets/labelled/summary.txt [new file with mode: 0644]
extra/ui/gadgets/labels/authors.txt [new file with mode: 0644]
extra/ui/gadgets/labels/labels-docs.factor [new file with mode: 0644]
extra/ui/gadgets/labels/labels.factor [new file with mode: 0644]
extra/ui/gadgets/labels/summary.txt [new file with mode: 0644]
extra/ui/gadgets/lib/lib.factor [new file with mode: 0644]
extra/ui/gadgets/lists/authors.txt [new file with mode: 0644]
extra/ui/gadgets/lists/lists-docs.factor [new file with mode: 0644]
extra/ui/gadgets/lists/lists-tests.factor [new file with mode: 0644]
extra/ui/gadgets/lists/lists.factor [new file with mode: 0644]
extra/ui/gadgets/lists/summary.txt [new file with mode: 0644]
extra/ui/gadgets/menus/authors.txt [new file with mode: 0644]
extra/ui/gadgets/menus/menus-docs.factor [new file with mode: 0644]
extra/ui/gadgets/menus/menus.factor [new file with mode: 0644]
extra/ui/gadgets/menus/summary.txt [new file with mode: 0644]
extra/ui/gadgets/packs/authors.txt [new file with mode: 0644]
extra/ui/gadgets/packs/packs-docs.factor [new file with mode: 0644]
extra/ui/gadgets/packs/packs-tests.factor [new file with mode: 0644]
extra/ui/gadgets/packs/packs.factor [new file with mode: 0644]
extra/ui/gadgets/packs/summary.txt [new file with mode: 0644]
extra/ui/gadgets/panes/authors.txt [new file with mode: 0644]
extra/ui/gadgets/panes/panes-docs.factor [new file with mode: 0644]
extra/ui/gadgets/panes/panes-tests.factor [new file with mode: 0644]
extra/ui/gadgets/panes/panes.factor [new file with mode: 0644]
extra/ui/gadgets/panes/summary.txt [new file with mode: 0644]
extra/ui/gadgets/paragraphs/authors.txt [new file with mode: 0644]
extra/ui/gadgets/paragraphs/paragraphs.factor [new file with mode: 0644]
extra/ui/gadgets/paragraphs/summary.txt [new file with mode: 0644]
extra/ui/gadgets/presentations/authors.txt [new file with mode: 0644]
extra/ui/gadgets/presentations/presentations-docs.factor [new file with mode: 0644]
extra/ui/gadgets/presentations/presentations-tests.factor [new file with mode: 0644]
extra/ui/gadgets/presentations/presentations.factor [new file with mode: 0644]
extra/ui/gadgets/presentations/summary.txt [new file with mode: 0644]
extra/ui/gadgets/scrollers/authors.txt [new file with mode: 0644]
extra/ui/gadgets/scrollers/scrollers-docs.factor [new file with mode: 0644]
extra/ui/gadgets/scrollers/scrollers-tests.factor [new file with mode: 0644]
extra/ui/gadgets/scrollers/scrollers.factor [new file with mode: 0644]
extra/ui/gadgets/scrollers/summary.txt [new file with mode: 0644]
extra/ui/gadgets/slate/slate.factor [new file with mode: 0644]
extra/ui/gadgets/sliders/authors.txt [new file with mode: 0644]
extra/ui/gadgets/sliders/sliders-docs.factor [new file with mode: 0644]
extra/ui/gadgets/sliders/sliders.factor [new file with mode: 0644]
extra/ui/gadgets/sliders/summary.txt [new file with mode: 0644]
extra/ui/gadgets/slots/authors.txt [new file with mode: 0644]
extra/ui/gadgets/slots/slots-tests.factor [new file with mode: 0644]
extra/ui/gadgets/slots/slots.factor [new file with mode: 0644]
extra/ui/gadgets/slots/summary.txt [new file with mode: 0644]
extra/ui/gadgets/status-bar/authors.txt [new file with mode: 0644]
extra/ui/gadgets/status-bar/status-bar-docs.factor [new file with mode: 0644]
extra/ui/gadgets/status-bar/status-bar.factor [new file with mode: 0644]
extra/ui/gadgets/status-bar/summary.txt [new file with mode: 0644]
extra/ui/gadgets/summary.txt [new file with mode: 0644]
extra/ui/gadgets/theme/authors.txt [new file with mode: 0644]
extra/ui/gadgets/theme/summary.txt [new file with mode: 0644]
extra/ui/gadgets/theme/theme.factor [new file with mode: 0644]
extra/ui/gadgets/tracks/authors.txt [new file with mode: 0644]
extra/ui/gadgets/tracks/summary.txt [new file with mode: 0644]
extra/ui/gadgets/tracks/tracks-docs.factor [new file with mode: 0644]
extra/ui/gadgets/tracks/tracks-tests.factor [new file with mode: 0644]
extra/ui/gadgets/tracks/tracks.factor [new file with mode: 0644]
extra/ui/gadgets/viewports/authors.txt [new file with mode: 0644]
extra/ui/gadgets/viewports/summary.txt [new file with mode: 0644]
extra/ui/gadgets/viewports/viewports-docs.factor [new file with mode: 0644]
extra/ui/gadgets/viewports/viewports.factor [new file with mode: 0644]
extra/ui/gadgets/worlds/authors.txt [new file with mode: 0644]
extra/ui/gadgets/worlds/summary.txt [new file with mode: 0644]
extra/ui/gadgets/worlds/worlds-docs.factor [new file with mode: 0644]
extra/ui/gadgets/worlds/worlds-tests.factor [new file with mode: 0644]
extra/ui/gadgets/worlds/worlds.factor [new file with mode: 0644]
extra/ui/gestures/authors.txt [new file with mode: 0644]
extra/ui/gestures/gestures-docs.factor [new file with mode: 0644]
extra/ui/gestures/gestures.factor [new file with mode: 0644]
extra/ui/gestures/summary.txt [new file with mode: 0644]
extra/ui/operations/authors.txt [new file with mode: 0644]
extra/ui/operations/operations-docs.factor [new file with mode: 0644]
extra/ui/operations/operations-tests.factor [new file with mode: 0644]
extra/ui/operations/operations.factor [new file with mode: 0644]
extra/ui/operations/summary.txt [new file with mode: 0644]
extra/ui/render/authors.txt [new file with mode: 0644]
extra/ui/render/render-docs.factor [new file with mode: 0644]
extra/ui/render/render.factor [new file with mode: 0644]
extra/ui/render/summary.txt [new file with mode: 0644]
extra/ui/summary.txt [new file with mode: 0644]
extra/ui/tools/authors.txt [new file with mode: 0644]
extra/ui/tools/browser/authors.txt [new file with mode: 0644]
extra/ui/tools/browser/browser.factor [new file with mode: 0644]
extra/ui/tools/browser/summary.txt [new file with mode: 0644]
extra/ui/tools/browser/tags.txt [new file with mode: 0644]
extra/ui/tools/debugger/authors.txt [new file with mode: 0644]
extra/ui/tools/debugger/debugger-docs.factor [new file with mode: 0644]
extra/ui/tools/debugger/debugger.factor [new file with mode: 0644]
extra/ui/tools/debugger/summary.txt [new file with mode: 0644]
extra/ui/tools/debugger/tags.txt [new file with mode: 0644]
extra/ui/tools/inspector/authors.txt [new file with mode: 0644]
extra/ui/tools/inspector/inspector.factor [new file with mode: 0644]
extra/ui/tools/inspector/summary.txt [new file with mode: 0644]
extra/ui/tools/inspector/tags.txt [new file with mode: 0644]
extra/ui/tools/interactor/authors.txt [new file with mode: 0644]
extra/ui/tools/interactor/interactor-docs.factor [new file with mode: 0644]
extra/ui/tools/interactor/interactor.factor [new file with mode: 0644]
extra/ui/tools/interactor/summary.txt [new file with mode: 0644]
extra/ui/tools/listener/authors.txt [new file with mode: 0644]
extra/ui/tools/listener/listener-tests.factor [new file with mode: 0644]
extra/ui/tools/listener/listener.factor [new file with mode: 0644]
extra/ui/tools/listener/summary.txt [new file with mode: 0644]
extra/ui/tools/listener/tags.txt [new file with mode: 0644]
extra/ui/tools/operations/authors.txt [new file with mode: 0644]
extra/ui/tools/operations/operations.factor [new file with mode: 0644]
extra/ui/tools/operations/summary.txt [new file with mode: 0644]
extra/ui/tools/profiler/authors.txt [new file with mode: 0644]
extra/ui/tools/profiler/profiler.factor [new file with mode: 0644]
extra/ui/tools/profiler/summary.txt [new file with mode: 0644]
extra/ui/tools/profiler/tags.txt [new file with mode: 0644]
extra/ui/tools/search/authors.txt [new file with mode: 0644]
extra/ui/tools/search/search-tests.factor [new file with mode: 0644]
extra/ui/tools/search/search.factor [new file with mode: 0644]
extra/ui/tools/search/summary.txt [new file with mode: 0644]
extra/ui/tools/summary.txt [new file with mode: 0644]
extra/ui/tools/tags.txt [new file with mode: 0644]
extra/ui/tools/tools-docs.factor [new file with mode: 0644]
extra/ui/tools/tools-tests.factor [new file with mode: 0644]
extra/ui/tools/tools.factor [new file with mode: 0644]
extra/ui/tools/traceback/authors.txt [new file with mode: 0644]
extra/ui/tools/traceback/summary.txt [new file with mode: 0644]
extra/ui/tools/traceback/traceback.factor [new file with mode: 0644]
extra/ui/tools/walker/authors.txt [new file with mode: 0644]
extra/ui/tools/walker/summary.txt [new file with mode: 0644]
extra/ui/tools/walker/tags.txt [new file with mode: 0644]
extra/ui/tools/walker/walker-tests.factor [new file with mode: 0644]
extra/ui/tools/walker/walker.factor [new file with mode: 0644]
extra/ui/tools/workspace/authors.txt [new file with mode: 0644]
extra/ui/tools/workspace/summary.txt [new file with mode: 0644]
extra/ui/tools/workspace/tags.txt [new file with mode: 0644]
extra/ui/tools/workspace/workspace.factor [new file with mode: 0644]
extra/ui/traverse/authors.txt [new file with mode: 0644]
extra/ui/traverse/summary.txt [new file with mode: 0644]
extra/ui/traverse/traverse-tests.factor [new file with mode: 0644]
extra/ui/traverse/traverse.factor [new file with mode: 0644]
extra/ui/ui-docs.factor [new file with mode: 0644]
extra/ui/ui.factor [new file with mode: 0644]
extra/ui/windows/windows.factor [new file with mode: 0644]
extra/ui/x11/x11.factor [new file with mode: 0644]
extra/unicode/PropList.txt [new file with mode: 0644]
extra/unicode/SpecialCasing.txt [new file with mode: 0644]
extra/unicode/UnicodeData.txt [new file with mode: 0644]
extra/unicode/authors.txt [new file with mode: 0644]
extra/unicode/breaks/breaks-tests.factor [new file with mode: 0644]
extra/unicode/breaks/breaks.factor [new file with mode: 0644]
extra/unicode/summary.txt [new file with mode: 0644]
extra/unicode/unicode-tests.factor [new file with mode: 0644]
extra/unicode/unicode.factor [new file with mode: 0644]
extra/units/constants/constants.factor [new file with mode: 0644]
extra/units/constants/constants.txt [new file with mode: 0644]
extra/units/imperial/imperial-tests.factor [new file with mode: 0644]
extra/units/imperial/imperial.factor [new file with mode: 0644]
extra/units/si/si-tests.factor [new file with mode: 0644]
extra/units/si/si.factor [new file with mode: 0644]
extra/units/units-tests.factor [new file with mode: 0644]
extra/units/units.factor [new file with mode: 0644]
extra/unix/authors.txt [new file with mode: 0644]
extra/unix/bsd/authors.txt [new file with mode: 0644]
extra/unix/bsd/bsd.factor [new file with mode: 0644]
extra/unix/bsd/summary.txt [new file with mode: 0644]
extra/unix/linux/linux.factor [new file with mode: 0644]
extra/unix/solaris/solaris.factor [new file with mode: 0644]
extra/unix/summary.txt [new file with mode: 0644]
extra/unix/tags.txt [new file with mode: 0644]
extra/unix/unix.factor [new file with mode: 0644]
extra/vars/authors.txt [new file with mode: 0644]
extra/vars/summary.txt [new file with mode: 0644]
extra/vars/tags.txt [new file with mode: 0644]
extra/vars/vars.factor [new file with mode: 0644]
extra/visitor/authors.txt [new file with mode: 0644]
extra/visitor/summary.txt [new file with mode: 0644]
extra/visitor/tags.txt [new file with mode: 0644]
extra/visitor/visitor-tests.factor [new file with mode: 0644]
extra/visitor/visitor.factor [new file with mode: 0644]
extra/webapps/article-manager/article-manager-docs.factor [new file with mode: 0644]
extra/webapps/article-manager/article-manager.factor [new file with mode: 0644]
extra/webapps/article-manager/authors.txt [new file with mode: 0644]
extra/webapps/article-manager/database/database.factor [new file with mode: 0644]
extra/webapps/article-manager/furnace/article.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/edit-article.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/edit-head.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/head.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/index.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/navigation.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/setup-site.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/tag.furnace [new file with mode: 0644]
extra/webapps/article-manager/furnace/tags.furnace [new file with mode: 0644]
extra/webapps/article-manager/load.factor [new file with mode: 0644]
extra/webapps/article-manager/resources/jquery.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-blue.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-blue2.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-brown.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-green.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-setup.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-setup_stripped.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-system.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-tas.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-1.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-2.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-cold-1.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-cold-2.css [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/calendar_stripped.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-af.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-al.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-bg.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-big5-utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-big5.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-br.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ca.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-cs-utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-cs-win.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-da.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-de.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-du.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-el.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-en.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-es.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-fi.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-fr.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-he-utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hr-utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hr.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hu.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-it.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-jp.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ko-utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ko.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lt-utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lt.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lv.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-nl.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-no.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pl-utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pl.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pt.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ro.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ru.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ru_win_.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-si.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sk.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sp.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sv.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-tr.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-zh.js [new file with mode: 0644]
extra/webapps/article-manager/resources/jscalendar-1.0/lang/cn_utf8.js [new file with mode: 0644]
extra/webapps/article-manager/resources/style.css [new file with mode: 0644]
extra/webapps/article-manager/resources/wiky.css [new file with mode: 0644]
extra/webapps/article-manager/resources/wiky.js [new file with mode: 0644]
extra/webapps/article-manager/resources/wiky.lang.css [new file with mode: 0644]
extra/webapps/article-manager/resources/wiky.lang.js [new file with mode: 0644]
extra/webapps/article-manager/resources/wiky.math.css [new file with mode: 0644]
extra/webapps/article-manager/resources/wiky.math.js [new file with mode: 0644]
extra/webapps/article-manager/summary.txt [new file with mode: 0644]
extra/webapps/article-manager/tags.txt [new file with mode: 0644]
extra/webapps/fjsc/authors.txt [new file with mode: 0644]
extra/webapps/fjsc/fjsc.factor [new file with mode: 0644]
extra/webapps/fjsc/head.furnace [new file with mode: 0644]
extra/webapps/fjsc/repl.furnace [new file with mode: 0644]
extra/webapps/fjsc/resources/repl.js [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/faq.html [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/index.html [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/multiterm_test.html [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/parser_sample.html [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/readme.txt [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/term_styles.css [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/termlib.js [new file with mode: 0644]
extra/webapps/fjsc/resources/termlib/termlib_parser.js [new file with mode: 0644]
extra/webapps/fjsc/summary.txt [new file with mode: 0644]
extra/webapps/fjsc/tags.txt [new file with mode: 0644]
extra/webapps/help/help.factor [new file with mode: 0644]
extra/windows/advapi32/advapi32.factor [new file with mode: 0644]
extra/windows/authors.txt [new file with mode: 0644]
extra/windows/ce/ce.factor [new file with mode: 0644]
extra/windows/errors/errors.factor [new file with mode: 0644]
extra/windows/gdi32/gdi32.factor [new file with mode: 0644]
extra/windows/kernel32/kernel32.factor [new file with mode: 0644]
extra/windows/messages/messages.factor [new file with mode: 0644]
extra/windows/nt/nt.factor [new file with mode: 0644]
extra/windows/opengl32/opengl32.factor [new file with mode: 0644]
extra/windows/summary.txt [new file with mode: 0644]
extra/windows/tags.txt [new file with mode: 0644]
extra/windows/types/types.factor [new file with mode: 0644]
extra/windows/user32/user32.factor [new file with mode: 0644]
extra/windows/windows.factor [new file with mode: 0644]
extra/windows/winsock/winsock.factor [new file with mode: 0644]
extra/x/authors.txt [new file with mode: 0644]
extra/x/font/font.factor [new file with mode: 0644]
extra/x/gc/gc.factor [new file with mode: 0644]
extra/x/keysym-table/keysym-table.factor [new file with mode: 0644]
extra/x/pen/pen.factor [new file with mode: 0644]
extra/x/widgets/button/button.factor [new file with mode: 0644]
extra/x/widgets/keymenu/keymenu.factor [new file with mode: 0644]
extra/x/widgets/label/label.factor [new file with mode: 0644]
extra/x/widgets/widgets.factor [new file with mode: 0644]
extra/x/widgets/wm/child/child.factor [new file with mode: 0644]
extra/x/widgets/wm/frame/drag/drag.factor [new file with mode: 0644]
extra/x/widgets/wm/frame/drag/move/move.factor [new file with mode: 0644]
extra/x/widgets/wm/frame/drag/size/size.factor [new file with mode: 0644]
extra/x/widgets/wm/frame/frame.factor [new file with mode: 0644]
extra/x/widgets/wm/menu/menu.factor [new file with mode: 0644]
extra/x/widgets/wm/root/root.factor [new file with mode: 0644]
extra/x/widgets/wm/unmapped-frames-menu/unmapped-frames-menu.factor [new file with mode: 0644]
extra/x/widgets/wm/workspace/workspace.factor [new file with mode: 0644]
extra/x/x.factor [new file with mode: 0644]
extra/x11/clipboard/authors.txt [new file with mode: 0644]
extra/x11/clipboard/clipboard.factor [new file with mode: 0644]
extra/x11/clipboard/summary.txt [new file with mode: 0644]
extra/x11/constants/authors.txt [new file with mode: 0644]
extra/x11/constants/constants.factor [new file with mode: 0644]
extra/x11/constants/summary.txt [new file with mode: 0644]
extra/x11/events/authors.txt [new file with mode: 0644]
extra/x11/events/events.factor [new file with mode: 0644]
extra/x11/events/summary.txt [new file with mode: 0644]
extra/x11/glx/authors.txt [new file with mode: 0644]
extra/x11/glx/glx.factor [new file with mode: 0644]
extra/x11/glx/summary.txt [new file with mode: 0644]
extra/x11/glx/tags.txt [new file with mode: 0644]
extra/x11/summary.txt [new file with mode: 0644]
extra/x11/tags.txt [new file with mode: 0644]
extra/x11/windows/authors.txt [new file with mode: 0644]
extra/x11/windows/summary.txt [new file with mode: 0644]
extra/x11/windows/windows.factor [new file with mode: 0644]
extra/x11/xim/authors.txt [new file with mode: 0644]
extra/x11/xim/summary.txt [new file with mode: 0644]
extra/x11/xim/tags.txt [new file with mode: 0644]
extra/x11/xim/xim.factor [new file with mode: 0644]
extra/x11/xlib/authors.txt [new file with mode: 0644]
extra/x11/xlib/summary.txt [new file with mode: 0644]
extra/x11/xlib/tags.txt [new file with mode: 0644]
extra/x11/xlib/xlib.factor [new file with mode: 0644]
extra/xml-rpc/authors.txt [new file with mode: 0644]
extra/xml-rpc/example.factor [new file with mode: 0644]
extra/xml-rpc/summary.txt [new file with mode: 0644]
extra/xml-rpc/tags.txt [new file with mode: 0644]
extra/xml-rpc/xml-rpc-docs.factor [new file with mode: 0644]
extra/xml-rpc/xml-rpc-tests.factor [new file with mode: 0644]
extra/xml-rpc/xml-rpc.factor [new file with mode: 0644]
extra/xml/authors.txt [new file with mode: 0644]
extra/xml/char-classes/char-classes.factor [new file with mode: 0644]
extra/xml/data/data.factor [new file with mode: 0644]
extra/xml/entities/entities.factor [new file with mode: 0644]
extra/xml/errors/errors.factor [new file with mode: 0644]
extra/xml/generator/generator-tests.factor [new file with mode: 0644]
extra/xml/generator/generator.factor [new file with mode: 0644]
extra/xml/summary.txt [new file with mode: 0644]
extra/xml/tags.txt [new file with mode: 0644]
extra/xml/test/arithmetic.factor [new file with mode: 0644]
extra/xml/test/errors.factor [new file with mode: 0644]
extra/xml/test/soap.factor [new file with mode: 0644]
extra/xml/test/soap.xml [new file with mode: 0644]
extra/xml/test/templating.factor [new file with mode: 0644]
extra/xml/test/test.factor [new file with mode: 0644]
extra/xml/test/test.xml [new file with mode: 0644]
extra/xml/tokenize/tokenize.factor [new file with mode: 0644]
extra/xml/utilities/utilities.factor [new file with mode: 0644]
extra/xml/writer/writer.factor [new file with mode: 0644]
extra/xml/xml-docs.factor [new file with mode: 0644]
extra/xml/xml-tests.factor [new file with mode: 0644]
extra/xml/xml.factor [new file with mode: 0644]
extra/yahoo/authors.txt [new file with mode: 0644]
extra/yahoo/summary.txt [new file with mode: 0644]
extra/yahoo/tags.txt [new file with mode: 0644]
extra/yahoo/test-results.xml [new file with mode: 0644]
extra/yahoo/yahoo-docs.factor [new file with mode: 0644]
extra/yahoo/yahoo-tests.factor [new file with mode: 0644]
extra/yahoo/yahoo.factor [new file with mode: 0644]
libs/README.txt [deleted file]
libs/alien.factor [deleted file]
libs/all.factor [deleted file]
libs/base64/base64.factor [deleted file]
libs/base64/load.factor [deleted file]
libs/base64/test.factor [deleted file]
libs/cairo.factor [deleted file]
libs/calendar/calendar.factor [deleted file]
libs/calendar/load.factor [deleted file]
libs/calendar/os-unix.factor [deleted file]
libs/calendar/os-win32.factor [deleted file]
libs/calendar/test/calendar.factor [deleted file]
libs/cocoa-callbacks.factor [deleted file]
libs/concurrency/concurrency-tests.factor [deleted file]
libs/concurrency/concurrency.factor [deleted file]
libs/concurrency/concurrency.facts [deleted file]
libs/concurrency/load.factor [deleted file]
libs/coroutines/coroutines.factor [deleted file]
libs/coroutines/load.factor [deleted file]
libs/coroutines/tests.factor [deleted file]
libs/crypto/barrett.factor [deleted file]
libs/crypto/blum-blum-shub.factor [deleted file]
libs/crypto/common.factor [deleted file]
libs/crypto/crc32.factor [deleted file]
libs/crypto/load.factor [deleted file]
libs/crypto/md5.factor [deleted file]
libs/crypto/miller-rabin.factor [deleted file]
libs/crypto/montgomery.factor [deleted file]
libs/crypto/random.factor [deleted file]
libs/crypto/rc4.factor [deleted file]
libs/crypto/rsa.factor [deleted file]
libs/crypto/sha1.factor [deleted file]
libs/crypto/sha2.factor [deleted file]
libs/crypto/test/barrett.factor [deleted file]
libs/crypto/test/blum-blum-shub.factor [deleted file]
libs/crypto/test/common.factor [deleted file]
libs/crypto/test/crc32.factor [deleted file]
libs/crypto/test/md5.factor [deleted file]
libs/crypto/test/miller-rabin.factor [deleted file]
libs/crypto/test/montgomery.factor [deleted file]
libs/crypto/test/rsa.factor [deleted file]
libs/crypto/test/sha1.factor [deleted file]
libs/crypto/test/sha2.factor [deleted file]
libs/crypto/timing.factor [deleted file]
libs/dlists.factor [deleted file]
libs/emacs.factor [deleted file]
libs/factor.el [deleted file]
libs/fjsc/fjsc.factor [deleted file]
libs/fjsc/load.factor [deleted file]
libs/fjsc/resources/bootstrap.factor [deleted file]
libs/fjsc/resources/bootstrap.js [deleted file]
libs/fjsc/resources/jquery.js [deleted file]
libs/fjsc/tests.factor [deleted file]
libs/furnace/load.factor [deleted file]
libs/furnace/responder.factor [deleted file]
libs/furnace/test/responder.factor [deleted file]
libs/furnace/test/validator.factor [deleted file]
libs/furnace/tools/browser.factor [deleted file]
libs/furnace/tools/browser.fhtml [deleted file]
libs/furnace/tools/help.factor [deleted file]
libs/furnace/tools/list.fhtml [deleted file]
libs/furnace/validator.factor [deleted file]
libs/gap-buffer/circular-tests.factor [deleted file]
libs/gap-buffer/circular.factor [deleted file]
libs/gap-buffer/gap-buffer-tests.factor [deleted file]
libs/gap-buffer/gap-buffer.factor [deleted file]
libs/gap-buffer/load.factor [deleted file]
libs/google-search/google-search.factor [deleted file]
libs/google-search/google-search.facts [deleted file]
libs/google-search/load.factor [deleted file]
libs/hardware-info/cpuinfo.factor [deleted file]
libs/hardware-info/load.factor [deleted file]
libs/hardware-info/os-unix.factor [deleted file]
libs/hardware-info/os-windows.factor [deleted file]
libs/http-client/http-client.factor [deleted file]
libs/http-client/load.factor [deleted file]
libs/http-client/test.factor [deleted file]
libs/http.factor [deleted file]
libs/httpd/callback-responder.factor [deleted file]
libs/httpd/cont-responder.factor [deleted file]
libs/httpd/default-responders.factor [deleted file]
libs/httpd/documentation.tex [deleted file]
libs/httpd/embedded.factor [deleted file]
libs/httpd/examples/cont-examples.factor [deleted file]
libs/httpd/examples/cont-numbers-game.factor [deleted file]
libs/httpd/examples/load.factor [deleted file]
libs/httpd/file-responder.factor [deleted file]
libs/httpd/html-tags.factor [deleted file]
libs/httpd/html.factor [deleted file]
libs/httpd/httpd.factor [deleted file]
libs/httpd/load.factor [deleted file]
libs/httpd/mime.factor [deleted file]
libs/httpd/prototype-js.factor [deleted file]
libs/httpd/resources/prototype.js [deleted file]
libs/httpd/resources/stylesheet.css [deleted file]
libs/httpd/responder.factor [deleted file]
libs/httpd/test/embedded.factor [deleted file]
libs/httpd/test/example.fhtml [deleted file]
libs/httpd/test/example.html [deleted file]
libs/httpd/test/html.factor [deleted file]
libs/httpd/test/httpd.factor [deleted file]
libs/httpd/test/url-encoding.factor [deleted file]
libs/jedit/jedit.factor [deleted file]
libs/jedit/load.factor [deleted file]
libs/jni/jni-internals.factor [deleted file]
libs/jni/jni.factor [deleted file]
libs/jni/load.factor [deleted file]
libs/json/json-reader.factor [deleted file]
libs/json/json-writer.factor [deleted file]
libs/json/json.facts [deleted file]
libs/json/load.factor [deleted file]
libs/lambda/TODO.txt [deleted file]
libs/lambda/core.factor [deleted file]
libs/lambda/lambda.factor [deleted file]
libs/lambda/load.factor [deleted file]
libs/lambda/nodes.factor [deleted file]
libs/lambda/parser.factor [deleted file]
libs/lambda/test/lambda.factor [deleted file]
libs/lazy-lists/examples.factor [deleted file]
libs/lazy-lists/lazy-io.factor [deleted file]
libs/lazy-lists/lazy-io.facts [deleted file]
libs/lazy-lists/lazy.factor [deleted file]
libs/lazy-lists/lazy.facts [deleted file]
libs/lazy-lists/lists.factor [deleted file]
libs/lazy-lists/lists.facts [deleted file]
libs/lazy-lists/load.factor [deleted file]
libs/lazy-lists/old-doc.html [deleted file]
libs/lazy-lists/test/examples.factor [deleted file]
libs/lazy-lists/test/lists.factor [deleted file]
libs/levenshtein/levenshtein.factor [deleted file]
libs/levenshtein/load.factor [deleted file]
libs/levenshtein/tests.factor [deleted file]
libs/match/load.factor [deleted file]
libs/match/match.factor [deleted file]
libs/match/match.facts [deleted file]
libs/match/tests.factor [deleted file]
libs/math/TODO.txt [deleted file]
libs/math/analysis.factor [deleted file]
libs/math/combinatorics.factor [deleted file]
libs/math/load.factor [deleted file]
libs/math/matrices.factor [deleted file]
libs/math/numerical-integration.factor [deleted file]
libs/math/polynomials.factor [deleted file]
libs/math/primes.factor [deleted file]
libs/math/quaternions.factor [deleted file]
libs/math/statistics.factor [deleted file]
libs/math/test.factor [deleted file]
libs/math/utils.factor [deleted file]
libs/parser-combinators/load.factor [deleted file]
libs/parser-combinators/parser-combinators.factor [deleted file]
libs/parser-combinators/parser-combinators.html [deleted file]
libs/parser-combinators/tests.factor [deleted file]
libs/partial-continuations.factor [deleted file]
libs/porter-stemmer/load.factor [deleted file]
libs/porter-stemmer/porter-stemmer.factor [deleted file]
libs/porter-stemmer/porter-stemmer.facts [deleted file]
libs/porter-stemmer/test/output.txt [deleted file]
libs/porter-stemmer/test/porter-stemmer.factor [deleted file]
libs/porter-stemmer/test/voc.txt [deleted file]
libs/postgresql/libpq.factor [deleted file]
libs/postgresql/load.factor [deleted file]
libs/postgresql/postgresql-test.factor [deleted file]
libs/postgresql/postgresql.factor [deleted file]
libs/print-dataflow/load.factor [deleted file]
libs/print-dataflow/print-dataflow.factor [deleted file]
libs/print-dataflow/tests.factor [deleted file]
libs/process/load.factor [deleted file]
libs/process/os-unix.factor [deleted file]
libs/process/os-windows.factor [deleted file]
libs/sequences.factor [deleted file]
libs/serialize/load.factor [deleted file]
libs/serialize/serialize.factor [deleted file]
libs/serialize/serialize.facts [deleted file]
libs/serialize/tests.factor [deleted file]
libs/shuffle/load.factor [deleted file]
libs/shuffle/shuffle.factor [deleted file]
libs/shuffle/test/shuffle.factor [deleted file]
libs/slate/load.factor [deleted file]
libs/slate/slate.factor [deleted file]
libs/splay-trees/load.factor [deleted file]
libs/splay-trees/splay-trees.factor [deleted file]
libs/splay-trees/tests.factor [deleted file]
libs/sql/execute.factor [deleted file]
libs/sql/load.factor [deleted file]
libs/sql/mappings.factor [deleted file]
libs/sql/postgresql/execute.factor [deleted file]
libs/sql/postgresql/libpq.factor [deleted file]
libs/sql/postgresql/postgresql.factor [deleted file]
libs/sql/postgresql/simple.factor [deleted file]
libs/sql/simple-bind.factor [deleted file]
libs/sql/simple.factor [deleted file]
libs/sql/sql.factor [deleted file]
libs/sql/sqlite/execute.factor [deleted file]
libs/sql/sqlite/libsqlite.factor [deleted file]
libs/sql/sqlite/load.factor [deleted file]
libs/sql/sqlite/simple.factor [deleted file]
libs/sql/sqlite/sqlite.factor [deleted file]
libs/sql/tupledb.factor [deleted file]
libs/sql/utils.factor [deleted file]
libs/sqlite/libsqlite.factor [deleted file]
libs/sqlite/load.factor [deleted file]
libs/sqlite/sqlite.factor [deleted file]
libs/sqlite/sqlite.facts [deleted file]
libs/sqlite/test.factor [deleted file]
libs/sqlite/test.txt [deleted file]
libs/sqlite/tuple-db-tests.factor [deleted file]
libs/sqlite/tuple-db.factor [deleted file]
libs/sqlite/tuple-db.facts [deleted file]
libs/textmate/Factor.tmbundle/Syntaxes/Factor.tmLanguage [deleted file]
libs/textmate/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage [deleted file]
libs/textmate/Factor.tmbundle/info.plist [deleted file]
libs/textmate/load.factor [deleted file]
libs/textmate/textmate.factor [deleted file]
libs/topology/hopf.factor [deleted file]
libs/topology/laplacian.factor [deleted file]
libs/topology/linear.factor [deleted file]
libs/topology/load.factor [deleted file]
libs/topology/matrix.factor [deleted file]
libs/topology/simplex.factor [deleted file]
libs/topology/test/hopf.factor [deleted file]
libs/topology/test/laplacian.factor [deleted file]
libs/topology/test/matrix.factor [deleted file]
libs/topology/test/simplex.factor [deleted file]
libs/units/constants.factor [deleted file]
libs/units/dimensioned.factor [deleted file]
libs/units/load.factor [deleted file]
libs/units/si-units.factor [deleted file]
libs/units/test/units.factor [deleted file]
libs/usb/load.factor [deleted file]
libs/usb/usb-common.factor [deleted file]
libs/usb/usb-macosx.factor [deleted file]
libs/usb/usb-unix.factor [deleted file]
libs/usb/usb-win32.factor [deleted file]
libs/usb/usb.factor [deleted file]
libs/usb/usb.facts [deleted file]
libs/vars.factor [deleted file]
libs/vim/factor.vim [deleted file]
libs/vim/factor.vim.fgen [deleted file]
libs/vim/generate-vim-syntax.factor [deleted file]
libs/vim/gvim7.factor [deleted file]
libs/vim/load.factor [deleted file]
libs/vim/vim.factor [deleted file]
libs/vim/vim.facts [deleted file]
libs/x11/concurrent-widgets.factor [deleted file]
libs/x11/draw-string.factor [deleted file]
libs/x11/load.factor [deleted file]
libs/x11/rectangle.factor [deleted file]
libs/x11/x.factor [deleted file]
libs/xml-rpc/example.factor [deleted file]
libs/xml-rpc/load.factor [deleted file]
libs/xml-rpc/test.factor [deleted file]
libs/xml-rpc/xml-rpc.factor [deleted file]
libs/xml-rpc/xml-rpc.facts [deleted file]
libs/xml/char-class.factor [deleted file]
libs/xml/example.factor [deleted file]
libs/xml/example2.factor [deleted file]
libs/xml/load.factor [deleted file]
libs/xml/parser.factor [deleted file]
libs/xml/test.factor [deleted file]
libs/xml/test.xml [deleted file]
libs/xml/tokenizer.factor [deleted file]
libs/xml/utilities.factor [deleted file]
libs/xml/writer.factor [deleted file]
libs/xml/xml.facts [deleted file]
license.txt
misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage [new file with mode: 0644]
misc/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage [new file with mode: 0644]
misc/Factor.tmbundle/info.plist [new file with mode: 0644]
misc/factor.el [new file with mode: 0644]
misc/factor.vim [new file with mode: 0644]
misc/factor.vim.fgen [new file with mode: 0644]
misc/graphics/bmps/1bit.bmp [new file with mode: 0644]
misc/graphics/bmps/rgb4bit.bmp [new file with mode: 0644]
misc/graphics/bmps/rgb8bit.bmp [new file with mode: 0644]
misc/graphics/bmps/thiswayup24.bmp [new file with mode: 0644]
misc/icons/FRaptorMix.ico [new file with mode: 0644]
misc/icons/FRaptorMix_128x128.png [new file with mode: 0644]
misc/icons/FRaptorMix_16x16.png [new file with mode: 0644]
misc/icons/FRaptorMix_32x32.png [new file with mode: 0644]
misc/icons/FRaptorMix_48x48.png [new file with mode: 0644]
misc/icons/license.txt [new file with mode: 0644]
misc/integration/macosx-deploy.factor [new file with mode: 0644]
misc/integration/macosx.sh [new file with mode: 0644]
misc/integration/test.sh [new file with mode: 0644]
misc/integration/unix-arm.sh [new file with mode: 0644]
misc/integration/unix-ppc.sh [new file with mode: 0644]
misc/integration/unix-x86.32.sh [new file with mode: 0644]
misc/integration/unix-x86.64.sh [new file with mode: 0644]
misc/integration/x11-deploy.factor [new file with mode: 0644]
misc/macos-release.sh [new file with mode: 0644]
misc/windows-release.sh [new file with mode: 0644]
unmaintained/README.libs.txt [new file with mode: 0644]
unmaintained/README.txt [new file with mode: 0644]
unmaintained/alarms/alarms.factor [new file with mode: 0644]
unmaintained/alarms/load.factor [new file with mode: 0644]
unmaintained/enchilada/authors.txt [new file with mode: 0644]
unmaintained/enchilada/enchilada-tests.factor [new file with mode: 0644]
unmaintained/enchilada/enchilada.factor [new file with mode: 0644]
unmaintained/enchilada/engine/engine.factor [new file with mode: 0644]
unmaintained/enchilada/parser/parser.factor [new file with mode: 0644]
unmaintained/enchilada/printer/printer.factor [new file with mode: 0644]
unmaintained/enchilada/summary.txt [new file with mode: 0644]
unmaintained/enchilada/tags.txt [new file with mode: 0644]
unmaintained/factorbot.factor [new file with mode: 0644]
unmaintained/farkup/farkup.factor [new file with mode: 0644]
unmaintained/farkup/farkup.facts [new file with mode: 0644]
unmaintained/farkup/farkup.list [new file with mode: 0644]
unmaintained/farkup/load.factor [new file with mode: 0644]
unmaintained/furnace-onigiri/load.factor [new file with mode: 0644]
unmaintained/furnace-onigiri/onigiri.factor [new file with mode: 0644]
unmaintained/furnace-onigiri/onigiri.facts [new file with mode: 0644]
unmaintained/furnace-onigiri/onigiri.todo [new file with mode: 0644]
unmaintained/furnace-onigiri/resources/onigirihouse.css [new file with mode: 0644]
unmaintained/furnace-onigiri/resources/wiky/wiky.css [new file with mode: 0644]
unmaintained/furnace-onigiri/resources/wiky/wiky.js [new file with mode: 0644]
unmaintained/furnace-onigiri/resources/wiky/wiky.lang.css [new file with mode: 0644]
unmaintained/furnace-onigiri/resources/wiky/wiky.lang.js [new file with mode: 0644]
unmaintained/furnace-onigiri/resources/wiky/wiky.math.css [new file with mode: 0644]
unmaintained/furnace-onigiri/resources/wiky/wiky.math.js [new file with mode: 0644]
unmaintained/furnace-onigiri/templates/atom.furnace [new file with mode: 0644]
unmaintained/furnace-onigiri/templates/entry-edit-plain.furnace [new file with mode: 0644]
unmaintained/furnace-onigiri/templates/entry-edit.furnace [new file with mode: 0644]
unmaintained/furnace-onigiri/templates/entry-show.furnace [new file with mode: 0644]
unmaintained/furnace-onigiri/templates/footer.furnace [new file with mode: 0644]
unmaintained/furnace-onigiri/templates/header.furnace [new file with mode: 0644]
unmaintained/furnace-onigiri/templates/sitemap.furnace [new file with mode: 0644]
unmaintained/furnace-pastebin/annotate-paste.furnace [new file with mode: 0644]
unmaintained/furnace-pastebin/annotation.furnace [new file with mode: 0644]
unmaintained/furnace-pastebin/load.factor [new file with mode: 0644]
unmaintained/furnace-pastebin/new-paste.furnace [new file with mode: 0644]
unmaintained/furnace-pastebin/paste-list.furnace [new file with mode: 0644]
unmaintained/furnace-pastebin/paste-summary.furnace [new file with mode: 0644]
unmaintained/furnace-pastebin/pastebin.factor [new file with mode: 0644]
unmaintained/furnace-pastebin/show-paste.furnace [new file with mode: 0644]
unmaintained/heap/heap.factor [new file with mode: 0644]
unmaintained/heap/heap.facts [new file with mode: 0644]
unmaintained/heap/human tests.factor [new file with mode: 0644]
unmaintained/heap/load.factor [new file with mode: 0644]
unmaintained/heap/print.factor [new file with mode: 0644]
unmaintained/heap/tests.factor [new file with mode: 0644]
unmaintained/io/io.factor [new file with mode: 0644]
unmaintained/io/load.factor [new file with mode: 0644]
unmaintained/io/os-unix-shell.factor [new file with mode: 0644]
unmaintained/io/os-unix.factor [new file with mode: 0644]
unmaintained/io/os-winnt-shell.factor [new file with mode: 0644]
unmaintained/io/os-winnt.factor [new file with mode: 0644]
unmaintained/io/shell.factor [new file with mode: 0644]
unmaintained/io/test/io.factor [new file with mode: 0644]
unmaintained/io/test/mmap.factor [new file with mode: 0644]
unmaintained/irc/irc-client.factor [new file with mode: 0644]
unmaintained/irc/load.factor [new file with mode: 0644]
unmaintained/isequences/authors.txt [new file with mode: 0644]
unmaintained/isequences/base/base.factor [new file with mode: 0644]
unmaintained/isequences/interface/interface-docs.factor [new file with mode: 0644]
unmaintained/isequences/interface/interface.factor [new file with mode: 0644]
unmaintained/isequences/isequences-tests.factor [new file with mode: 0644]
unmaintained/isequences/isequences.factor [new file with mode: 0644]
unmaintained/isequences/ops/cache/cache.factor [new file with mode: 0644]
unmaintained/isequences/ops/divide/divide.factor [new file with mode: 0644]
unmaintained/isequences/ops/iota/iota.factor [new file with mode: 0644]
unmaintained/isequences/ops/match/match.factor [new file with mode: 0644]
unmaintained/isequences/ops/maximum/maximum.factor [new file with mode: 0644]
unmaintained/isequences/ops/minimum/minimum.factor [new file with mode: 0644]
unmaintained/isequences/ops/modulus/modulus.factor [new file with mode: 0644]
unmaintained/isequences/ops/multiply/multiply.factor [new file with mode: 0644]
unmaintained/isequences/ops/ops.factor [new file with mode: 0644]
unmaintained/isequences/ops/sort/sort.factor [new file with mode: 0644]
unmaintained/isequences/ops/wipe/wipe.factor [new file with mode: 0644]
unmaintained/isequences/summary.txt [new file with mode: 0644]
unmaintained/isequences/tags.txt [new file with mode: 0644]
unmaintained/jni/jni-internals.factor [new file with mode: 0644]
unmaintained/jni/jni.factor [new file with mode: 0644]
unmaintained/jni/load.factor [new file with mode: 0644]
unmaintained/lambda/TODO.txt [new file with mode: 0644]
unmaintained/lambda/core.factor [new file with mode: 0644]
unmaintained/lambda/lambda.factor [new file with mode: 0644]
unmaintained/lambda/load.factor [new file with mode: 0644]
unmaintained/lambda/nodes.factor [new file with mode: 0644]
unmaintained/lambda/parser.factor [new file with mode: 0644]
unmaintained/lambda/test/lambda.factor [new file with mode: 0644]
unmaintained/mysql/libmysql.factor [new file with mode: 0644]
unmaintained/mysql/load.factor [new file with mode: 0644]
unmaintained/mysql/mysql.factor [new file with mode: 0644]
unmaintained/mysql/test/create_database.sql [new file with mode: 0644]
unmaintained/mysql/test/mysql-example.factor [new file with mode: 0644]
unmaintained/random-tester/load.factor [new file with mode: 0644]
unmaintained/random-tester/random-tester.factor [new file with mode: 0644]
unmaintained/random-tester/random-tester2.factor [new file with mode: 0644]
unmaintained/random-tester/random.factor [new file with mode: 0644]
unmaintained/random-tester/type.factor [new file with mode: 0644]
unmaintained/random-tester/utils.factor [new file with mode: 0644]
unmaintained/regexp/load.factor [new file with mode: 0644]
unmaintained/regexp/regexp.factor [new file with mode: 0644]
unmaintained/regexp/tables.factor [new file with mode: 0644]
unmaintained/regexp/test/regexp.factor [new file with mode: 0644]
unmaintained/regexp/test/tables.factor [new file with mode: 0644]
unmaintained/usb/load.factor [new file with mode: 0644]
unmaintained/usb/usb-common.factor [new file with mode: 0644]
unmaintained/usb/usb-macosx.factor [new file with mode: 0644]
unmaintained/usb/usb-unix.factor [new file with mode: 0644]
unmaintained/usb/usb-win32.factor [new file with mode: 0644]
unmaintained/usb/usb.factor [new file with mode: 0644]
unmaintained/usb/usb.facts [new file with mode: 0644]
unmaintained/wee-url/load.factor [new file with mode: 0644]
unmaintained/wee-url/responder.factor [new file with mode: 0644]
unmaintained/wee-url/wee-url.factor [new file with mode: 0644]
vm/Config.amd64
vm/Config.arm [new file with mode: 0644]
vm/Config.freebsd
vm/Config.freebsd.amd64 [new file with mode: 0644]
vm/Config.freebsd.x86 [new file with mode: 0644]
vm/Config.linux
vm/Config.linux.arm [new file with mode: 0644]
vm/Config.macosx
vm/Config.macosx.x86
vm/Config.openbsd [new file with mode: 0644]
vm/Config.openbsd.amd64 [new file with mode: 0644]
vm/Config.openbsd.x86 [new file with mode: 0644]
vm/Config.ppc
vm/Config.solaris
vm/Config.solaris.amd64 [new file with mode: 0644]
vm/Config.solaris.x86 [new file with mode: 0644]
vm/Config.unix
vm/Config.windows
vm/Config.windows.ce [new file with mode: 0644]
vm/Config.windows.ce.arm [new file with mode: 0644]
vm/Config.windows.ce.x86 [new file with mode: 0644]
vm/Config.windows.nt.x86 [new file with mode: 0644]
vm/Config.x86
vm/alien.c
vm/alien.h
vm/asm.h [new file with mode: 0644]
vm/bignum.c
vm/bignum.h
vm/bignumint.h
vm/code_gc.c
vm/code_gc.h
vm/compiler.c
vm/compiler.h
vm/cpu-amd64.S
vm/cpu-amd64.h
vm/cpu-arm.S [new file with mode: 0644]
vm/cpu-arm.h [new file with mode: 0644]
vm/cpu-ppc.S
vm/cpu-ppc.h
vm/cpu-x86.S
vm/cpu-x86.h
vm/data_gc.c
vm/data_gc.h
vm/debug.c
vm/debug.h
vm/factor.c
vm/factor.h
vm/factor.rs [new file with mode: 0644]
vm/ffi_test.c
vm/ffi_test.h
vm/float_bits.h [new file with mode: 0644]
vm/image.c
vm/image.h
vm/io.c
vm/io.h
vm/jit.c [new file with mode: 0644]
vm/jit.h [new file with mode: 0644]
vm/layouts.h
vm/mach_signal.c
vm/mach_signal.h
vm/main-unix.c [new file with mode: 0644]
vm/main-windows-ce.c [new file with mode: 0644]
vm/main-windows-nt.c [new file with mode: 0644]
vm/master.h [new file with mode: 0644]
vm/math.c
vm/math.h
vm/os-freebsd.c [new file with mode: 0644]
vm/os-freebsd.h
vm/os-genunix.c
vm/os-genunix.h
vm/os-linux-arm.h [new file with mode: 0644]
vm/os-linux-ppc.h
vm/os-linux.c [new file with mode: 0644]
vm/os-linux.h
vm/os-macosx-ppc.h
vm/os-macosx-x86.h
vm/os-macosx.h
vm/os-macosx.m
vm/os-openbsd-amd64.h [new file with mode: 0644]
vm/os-openbsd-x86.h [new file with mode: 0644]
vm/os-openbsd.c [new file with mode: 0644]
vm/os-openbsd.h [new file with mode: 0644]
vm/os-solaris.c [new file with mode: 0644]
vm/os-solaris.h
vm/os-unix-ucontext.h [new file with mode: 0644]
vm/os-unix.c
vm/os-unix.h
vm/os-windows-ce-arm.S [new file with mode: 0644]
vm/os-windows-ce.c [new file with mode: 0644]
vm/os-windows-ce.h [new file with mode: 0644]
vm/os-windows-nt.c [new file with mode: 0644]
vm/os-windows-nt.h [new file with mode: 0644]
vm/os-windows.c
vm/os-windows.h
vm/platform.h
vm/primitives.c
vm/primitives.h
vm/run.c
vm/run.h
vm/stack.c
vm/stack.h
vm/types.c
vm/types.h
vm/utilities.c [new file with mode: 0644]
vm/utilities.h [new file with mode: 0644]

index 686c996b1f0eb9f0e0537ecf1e2e1311f14d375c..c54acd717993258cc0b2a417589ab4de46cfa30c 100644 (file)
@@ -2,16 +2,6 @@
 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-       <key>CFBundleExecutable</key>
-       <string>Factor</string>
-       <key>CFBundleIdentifier</key>
-       <string>org.factorcode.Factor</string>
-       <key>CFBundleInfoDictionaryVersion</key>
-       <string>6.0</string>
-       <key>CFBundleName</key>
-       <string>Factor</string>
-       <key>CFBundlePackageType</key>
-       <string>APPL</string>
        <key>CFBundleDocumentTypes</key>
        <array>
                <dict>
                        </array>
                        <key>CFBundleTypeName</key>
                        <string>Any</string>
-                       <key>CFBundleTypeRole</key>
-                       <string>Viewer</string>
                        <key>CFBundleTypeOSTypes</key>
                        <array>
                                <string>****</string>
                        </array>
+                       <key>CFBundleTypeRole</key>
+                       <string>Viewer</string>
                </dict>
        </array>
+       <key>CFBundleExecutable</key>
+       <string>factor</string>
+       <key>CFBundleIconFile</key>
+       <string>FRaptorMix.icns</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.factorcode.Factor</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>Factor</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>NSHumanReadableCopyright</key>
+       <string>Copyright © 2003-2007, Slava Pestov and friends</string>
        <key>NSServices</key>
        <array>
                <dict>
                        <string>evalToString</string>
                        <key>NSPortName</key>
                        <string>Factor</string>
-                       <key>NSSendTypes</key>
+                       <key>NSReturnTypes</key>
                        <array>
                                <string>NSStringPboardType</string>
                        </array>
-                       <key>NSReturnTypes</key>
+                       <key>NSSendTypes</key>
                        <array>
                                <string>NSStringPboardType</string>
                        </array>
index 36ad9d1080bea5cd92046782f269f2c7f7d89a4b..8e4b9eeba85984431ea1571bae5874dbcbf4e282 100644 (file)
@@ -7,7 +7,7 @@
        <key>IBEditorPositions</key>
        <dict>
                <key>29</key>
-               <string>326 905 420 44 0 0 2560 1578 </string>
+               <string>326 905 270 44 0 0 2560 1578 </string>
        </dict>
        <key>IBFramework Version</key>
        <string>439.0</string>
@@ -16,6 +16,6 @@
                <integer>29</integer>
        </array>
        <key>IBSystem Version</key>
-       <string>8L127</string>
+       <string>8R218</string>
 </dict>
 </plist>
index 0e26521a928f469a30c2f1c461af9689fd47d768..8dfebba5669ffdf8e672731f7d51c4dd3320621d 100644 (file)
Binary files a/Factor.app/Contents/Resources/English.lproj/Factor.nib/keyedobjects.nib and b/Factor.app/Contents/Resources/English.lproj/Factor.nib/keyedobjects.nib differ
diff --git a/Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/classes.nib b/Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/classes.nib
new file mode 100644 (file)
index 0000000..bf3d2a6
--- /dev/null
@@ -0,0 +1,17 @@
+{
+    IBClasses = (
+        {
+            ACTIONS = {
+                newFactorWorkspace = id; 
+                runFactorFile = id; 
+                saveFactorImage = id; 
+                saveFactorImageAs = id; 
+                showFactorHelp = id; 
+            }; 
+            CLASS = FirstResponder; 
+            LANGUAGE = ObjC; 
+            SUPERCLASS = NSObject; 
+        }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file
diff --git a/Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/info.nib b/Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/info.nib
new file mode 100644 (file)
index 0000000..3a18202
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>1266 155 525 491 0 0 2560 1578 </string>
+       <key>IBEditorPositions</key>
+       <dict>
+               <key>29</key>
+               <string>326 905 270 44 0 0 2560 1578 </string>
+       </dict>
+       <key>IBFramework Version</key>
+       <string>439.0</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>29</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>8R218</string>
+</dict>
+</plist>
diff --git a/Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/keyedobjects.nib b/Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..34abd13
Binary files /dev/null and b/Factor.app/Contents/Resources/English.lproj/MiniFactor.nib/keyedobjects.nib differ
diff --git a/Factor.app/Contents/Resources/FRaptorMix.icns b/Factor.app/Contents/Resources/FRaptorMix.icns
new file mode 100644 (file)
index 0000000..5cbe894
Binary files /dev/null and b/Factor.app/Contents/Resources/FRaptorMix.icns differ
index b3db92479c480125f55d609c6525779bf7c96c53..dd232a75dfea6d025e5e76ee1a3ce276177f997a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,26 +1,26 @@
 CC = gcc
 
-BINARY = f
+EXECUTABLE = factor
+VERSION = 0.91
+
 IMAGE = factor.image
 BUNDLE = Factor.app
-VERSION = 0.87
-DISK_IMAGE_DIR = Factor-$(VERSION)
-DISK_IMAGE = Factor-$(VERSION).dmg
 LIBPATH = -L/usr/X11R6/lib
+CFLAGS = -Wall
 
 ifdef DEBUG
-       CFLAGS = -g -std=gnu99
-       STRIP = touch
+       CFLAGS += -g
 else
-       CFLAGS = -Wall -O3 -ffast-math -std=gnu99 $(SITE_CFLAGS)
-       STRIP = strip
+       CFLAGS += -O3 -fomit-frame-pointer $(SITE_CFLAGS)
 endif
 
 ifdef CONFIG
        include $(CONFIG)
 endif
 
-OBJS = $(PLAF_OBJS) \
+ENGINE = $(DLL_PREFIX)factor$(DLL_SUFFIX)$(DLL_EXTENSION)
+
+DLL_OBJS = $(PLAF_DLL_OBJS) \
        vm/alien.o \
        vm/bignum.o \
        vm/compiler.o \
@@ -35,112 +35,112 @@ OBJS = $(PLAF_OBJS) \
        vm/primitives.o \
        vm/run.o \
        vm/stack.o \
-       vm/types.o
+       vm/types.o \
+       vm/jit.o \
+       vm/utilities.o
+
+EXE_OBJS = $(PLAF_EXE_OBJS)
 
 default:
        @echo "Run 'make' with one of the following parameters:"
        @echo ""
-       @echo "freebsd"
+       @echo "freebsd-x86"
+       @echo "freebsd-amd64"
        @echo "linux-x86"
        @echo "linux-amd64"
        @echo "linux-ppc"
+       @echo "linux-arm"
+       @echo "openbsd-x86"
+       @echo "openbsd-amd64"
        @echo "macosx-x86"
        @echo "macosx-ppc"
-       @echo "solaris"
-       @echo "windows"
-       @echo ""
-       @echo "On Unix, pass NO_UI=1 if you don't want to link with the"
-       @echo "X11 and OpenGL libraries."
+       @echo "solaris-x86"
+       @echo "solaris-amd64"
+       @echo "windows-ce-arm"
+       @echo "windows-ce-x86"
+       @echo "windows-nt-x86"
        @echo ""
-       @echo "On Mac OS X, pass X11=1 if you want to link with the"
-       @echo "X11 library instead of Cocoa. You will also need to bootstrap"
-       @echo "Factor with the -no-cocoa -x11 switches."
-       @echo
-       @echo "Also, you might want to set the SITE_CFLAGS environment"
-       @echo "variable to enable some CPU-specific optimizations; this"
-       @echo "can make a huge difference. Eg:"
+       @echo "Additional modifiers:"
        @echo ""
-       @echo "export SITE_CFLAGS=\"-march=pentium4 -ffast-math\""
+       @echo "DEBUG=1  compile VM with debugging information"
+       @echo "SITE_CFLAGS=...  additional optimization flags"
+       @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)"
+
+openbsd-x86:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86
+
+openbsd-amd64:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.amd64
+
+freebsd-x86:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86
 
-freebsd:
-       $(MAKE) $(BINARY) CONFIG=vm/Config.freebsd
+freebsd-amd64:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.amd64
 
 macosx-freetype:
        ln -sf libfreetype.6.dylib \
                Factor.app/Contents/Frameworks/libfreetype.dylib
 
 macosx-ppc: macosx-freetype
-       $(MAKE) $(BINARY) CONFIG=vm/Config.macosx.ppc
+       $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.ppc
 
 macosx-x86: macosx-freetype
-       $(MAKE) $(BINARY) CONFIG=vm/Config.macosx.x86
+       $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86
 
 linux-x86:
-       $(MAKE) $(BINARY) CONFIG=vm/Config.linux.x86
-       $(STRIP) $(BINARY)
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86
 
 linux-amd64:
-       $(MAKE) $(BINARY) CONFIG=vm/Config.linux.amd64
-       $(STRIP) $(BINARY)
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.amd64
 
 linux-ppc:
-       $(MAKE) $(BINARY) CONFIG=vm/Config.linux.ppc
-       $(STRIP) $(BINARY)
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.ppc
 
-solaris solaris-x86 solaris-amd64:
-       $(MAKE) $(BINARY) CONFIG=vm/Config.solaris
-       $(STRIP) $(BINARY)
+linux-arm:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.arm
 
-windows:
-       $(MAKE) $(BINARY) CONFIG=vm/Config.windows
+solaris-x86:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86
 
-macosx.app:
-       cp $(BINARY) $(BUNDLE)/Contents/MacOS/Factor
+solaris-amd64:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.amd64
+
+windows-nt-x86:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86
+
+windows-ce-arm:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
+
+windows-ce-x86:
+       $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.x86
+
+macosx.app: factor
+       cp $(EXECUTABLE) $(BUNDLE)/Contents/MacOS/factor
+       cp $(ENGINE) $(BUNDLE)/Contents/Frameworks
 
        install_name_tool \
                -id @executable_path/../Frameworks/libfreetype.6.dylib \
                Factor.app/Contents/Frameworks/libfreetype.6.dylib
        install_name_tool \
-               -change /usr/X11R6/lib/libfreetype.6.dylib \
-               @executable_path/../Frameworks/libfreetype.6.dylib \
-               Factor.app/Contents/MacOS/Factor
-
-macosx.dmg:
-       rm -f $(DISK_IMAGE)
-       rm -rf $(DISK_IMAGE_DIR)
-       mkdir $(DISK_IMAGE_DIR)
-       mkdir -p $(DISK_IMAGE_DIR)/Factor/
-       cp -R $(BUNDLE) $(DISK_IMAGE_DIR)/Factor/$(BUNDLE)
-       chmod +x cp_dir
-       cp factor.image license.txt README.txt TODO.FACTOR.txt \
-               $(DISK_IMAGE_DIR)/Factor/
-       find doc library contrib examples fonts \( -name '*.factor' \
-               -o -name '*.facts' \
-               -o -name '*.txt' \
-               -o -name '*.html' \
-               -o -name '*.ttf' \
-               -o -name '*.el' \
-               -o -name '*.vim' \
-               -o -name '*.fgen' \
-               -o -name '*.tex' \
-               -o -name '*.fhtml' \
-               -o -name '*.xml' \
-               -o -name '*.js' \) \
-               -exec ./cp_dir {} $(DISK_IMAGE_DIR)/Factor/{} \;
-       hdiutil create -srcfolder "$(DISK_IMAGE_DIR)" -fs HFS+ \
-               -volname "$(DISK_IMAGE_DIR)" "$(DISK_IMAGE)"
-
-tags:
-       ctags-exuberant vm/*.[chm]
-
-f: $(OBJS)
-       $(CC) $(LIBS) $(LIBPATH) $(CFLAGS) -o $@$(PLAF_SUFFIX) $(OBJS)
+               -change libfactor.dylib \
+               @executable_path/../Frameworks/libfactor.dylib \
+               Factor.app/Contents/MacOS/factor
+
+factor: $(DLL_OBJS) $(EXE_OBJS)
+       $(LINKER) $(ENGINE) $(DLL_OBJS)
+       $(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
+               $(CFLAGS) -o $@$(EXE_SUFFIX)$(EXE_EXTENSION) $(EXE_OBJS)
+
+pull:
+       darcs pull http://factorcode.org/repos/
 
 clean:
        rm -f vm/*.o
 
-clean.app:
-       rm -f $(BUNDLE)/Contents/MacOS/Factor
+vm/resources.o:
+       windres vm/factor.rs vm/resources.o
 
 .c.o:
        $(CC) -c $(CFLAGS) -o $@ $<
@@ -150,3 +150,5 @@ clean.app:
 
 .m.o:
        $(CC) -c $(CFLAGS) -o $@ $<
+       
+.PHONY: factor
index 1d7e7bac583531bed63260f5307d2de1db95624e..d5748688928ebf2c1cd6b6a3efad31dc98dd97b8 100644 (file)
@@ -7,82 +7,64 @@ implementation. It is not an introduction to the language itself.
 * Contents
 
 - Platform support
-- Compiling Factor
-- Building Factor
+- Compiling the Factor VM
+- Bootstrapping the Factor image
 - Running Factor on Unix with X11
 - Running Factor on Mac OS X - Cocoa UI
 - Running Factor on Mac OS X - X11 UI
 - Running Factor on Windows
+- Command line usage
 - Source organization
 - Community
-- Credits
 
 * Platform support
 
-Factor is fully supported on the following platforms:
+Factor supports the following platforms:
 
   Linux/x86
   Linux/AMD64
+  Linux/PowerPC
+  Linux/ARM
   Mac OS X/x86
   Mac OS X/PowerPC
-  MS Windows XP
-
-The following platforms should work, but are not tested on a
-regular basis:
-
   FreeBSD/x86
   FreeBSD/AMD64
+  OpenBSD/x86
+  OpenBSD/AMD64
   Solaris/x86
   Solaris/AMD64
-  Linux/PowerPC
+  MS Windows/x86 (XP and above)
+  MS Windows CE/ARM
 
 Please donate time or hardware if you wish to see Factor running on
-other platforms.
+other platforms. In particular, we are interested in:
+
+  Windows/AMD64
+  Mac OS X/AMD64
+  Solaris/UltraSPARC
+  Linux/MIPS
 
-* Compiling Factor
+* Compiling the Factor VM
 
-The Factor runtime is written in C, and is built with GNU make and gcc.
+The Factor runtime is written in GNU C99, and is built with GNU make and
+gcc.
 
 Factor requires gcc 3.4 or later. On x86, it /will not/ build using gcc
 3.3 or earlier.
 
-Run 'make' (or 'gmake' on non-Linux platforms) with one of the following
-parameters to build the Factor runtime:
-
-  freebsd
-  linux-x86
-  linux-amd64
-  linux-ppc
-  macosx-x86
-  macosx-ppc
-  solaris
-
-The following options can be given to make:
-
-  SITE_CFLAGS="..."
-  DEBUG=1
-
-The former allows optimization flags to be specified, for example
-"-march=pentium4 -ffast-math -O3". Nowadays most of the hard work is
-done by Factor compiled code, so optimizing the runtime is not that
-important. Usually the defaults are fine.
-
-The DEBUG flag disables optimization and builds an executable with
-debug symbols. This is probably only of interest to people intending to
-hack on the runtime sources.
-
-Compilation may print a handful of warnings about singled/unsigned
-comparisons, and violated aliasing contracts. They may safely be
-ignored.
+Run 'make' (or 'gmake' on *BSD) with no parameters to see a list of
+targets and build options. Then run 'make' with the appropriate target
+for your platform.
 
-Compilation will yield an executable named 'f'.
+Compilation will yield an executable named 'factor' on Unix,
+'factor-nt.exe' on Windows XP/Vista, and 'factor-ce.exe' on Windows CE.
 
-* Building Factor
+* Bootstrapping the Factor image
 
 The boot images are no longer included with the Factor distribution
 due to size concerns. Instead, download a boot image from:
 
-  http://factorcode.org/images/0.85/
+  http://factorcode.org/images/
 
 Once you have compiled the Factor runtime, you must bootstrap the Factor
 system using the image that corresponds to your CPU architecture.
@@ -90,7 +72,7 @@ system using the image that corresponds to your CPU architecture.
 Once you download the right image, bootstrap the system with the
 following command line:
 
-./f boot.image.<foo>
+./factor -i=boot.<cpu>.image
 
 Bootstrap can take a while, depending on your system. When the process
 completes, a 'factor.image' file will be generated. Note that this image
@@ -105,11 +87,11 @@ a terminal listener.
 If your DISPLAY environment variable is set, the UI will start
 automatically:
 
-  ./f factor.image
+  ./factor
 
 To run an interactive terminal listener:
 
-  ./f factor.image -shell=tty
+  ./factor -run=listener
 
 If you're inside a terminal session, you can start the UI with one of
 the following two commands:
@@ -125,17 +107,13 @@ On Mac OS X 10.4 and later, a Cocoa UI is available in addition to the
 terminal listener. If you are using Mac OS X 10.3, you can only run the
 X11 UI, as documented in the next section.
 
-The 'f' executable runs the terminal listener:
+The 'factor' executable runs the terminal listener:
 
-  ./f factor.image
+  ./factor
 
-The Cocoa UI requires that after bootstrapping you build the Factor.app
-application bundle:
-
-  make macosx.app
-
-This copies the runtime executable, factor.image (which must exist at
-this point), and the library source into a self-contained Factor.app.
+The 'Factor.app' bundle runs the Cocoa UI. Note that this is not a
+self-contained bundle, it must be run from the same directory which
+contains factor.image and the library sources.
 
 * Running Factor on Mac OS X - X11 UI
 
@@ -147,57 +125,56 @@ When compiling Factor, pass the X11=1 parameter:
 
   make macosx-ppc X11=1
 
-Then bootstrap with the following pair of switches:
+Then bootstrap with the following switches:
 
-  ./f boot.image.ppc -no-cocoa -x11
+  ./factor -i=boot.ppc.image -ui-backend=x11
 
-Now if $DISPLAY is set, running ./f will start the UI.
+Now if $DISPLAY is set, running ./factor will start the UI.
 
-* Running Factor on Windows
+* Running Factor on Windows XP/Vista
 
 If you did not download the binary package, you can bootstrap Factor in
 the command prompt:
 
-  f.exe boot.image.pentium4 (or boot.image.x86)
+  factor-nt.exe -i=boot.x86.32.image
 
-Once bootstrapped, double-clicking f.exe starts the Factor UI.
+Once bootstrapped, double-clicking factor.exe starts the Factor UI.
 
 To run the listener in the command prompt:
 
-  f.exe -shell=tty
+  factor-nt.exe -run=listener
+
+* Command line usage
+
+The Factor VM supports a number of command line switches. To read
+command line usage documentation, either enter the following in the UI
+listener:
+
+  "command-line" about
 
 * Source organization
 
-The following four directories are managed by the module system; consult
+The following two directories are managed by the module system; consult
 the documentation for details:
 
-  apps/ - user-contributed applications
-  libs/ - user-contributed libraries
-  demos/ - small examples illustrating various language features
-  core/ - sources for the library, written in Factor
+  core/ - Factor core library and compiler
+  extra/ - more libraries
 
-  fonts/ - TrueType fonts used by UI
+The following directories contain additional files:
+
+  misc/ - editor modes, icons, etc
   vm/ - sources for the Factor runtime, written in C
+  fonts/ - TrueType fonts used by UI
+  unmaintained/ - unmaintained contributions, please help!
 
 * Community
 
-The Factor homepage is located at http://factorcode.org/.
+The Factor homepage is located at <http://factorcode.org/>.
 
 Factor developers meet in the #concatenative channel on the
 irc.freenode.net server. Drop by if you want to discuss anything related
 to Factor or language design in general.
 
-* Credits
-
-The following people have contributed code to the Factor core:
-
-Slava Pestov:       Lead developer
-Alex Chapman:       OpenGL binding
-Doug Coleman:       Mersenne Twister RNG, Windows port
-Eduardo Cavazos:    X11 binding
-Joshua Grams:       PowerPC instruction cache flush code
-Mackenzie Straight: Windows port
-
 Have fun!
 
 :tabSize=2:indentSize=2:noTabs=true:
diff --git a/TODO.txt b/TODO.txt
deleted file mode 100644 (file)
index e8f8412..0000000
--- a/TODO.txt
+++ /dev/null
@@ -1,108 +0,0 @@
-+ 0.87:
-
-- callback scheduling issue
-- error popup obscures input area
-- ui docs
-- test factor on linux/ppc
-
-+ 0.88:
-
-- poorly documented vocabs:
-  - alien
-  - cocoa
-  - command-line
-  - compiler
-  - completion
-  - image
-  - interpreter
-  - objc
-  - optimizer
-- calling 'see' with an nonexistent method should be an error
-- grid-lines are rendered incorrectly
-- interactor: show stack effect for word at caret in status bar
-- lisppaste gui
-- growable data heap
-- variable width word wrap
-- graphical crossref tool
-- inspector where slot values can be changed
-- compiled call traces do not work if the runtime is built with
-  -fomit-frame-pointer on ppc
-- use crc32 instead of modification date in reload-modules
-- models: don't do redundant work
-- top level window positioning on ms windows
-- httpd crash
-- these things are "Too Slow":
-  - make-image
-  - workspace-window
-  - apropos
-  - 10000 [ dup number>string ] map describe in the UI
-  - available-modules
-  - :trace
-  - string-lines
-  - md5, crc32
-  - all-words [ word-name ] map prune [ words-named ] map
-  - 100000 [ "\"hello\" not" eval drop ] times
-- auto-update browser and help when sources reload
-- mac intel: struct returns from objc methods
-- new windows don't always have focus, eg focus follows mouse
-- recompile get/set/>n/n>/ndrop if needed
-- cross-word type inference
-- some kind of declarative wiring framework for ui
-- if we're printing a block on multiple lines, break at some words like
-  set off on % # , ... and assembler opcodes
-- don't end lines with literals, shuffle words or symbols?
-- see should try to not show ; on a line by itself
-- IN: on its own line if the entire 'see' form doesn't fit
-- command buttons: indicate shortcuts
-- test what is done in the case of an invalid declaration on an inline
-  recursive
-- how do we refer to command shortcuts in the docs?
-
-+ ui:
-
-- browser tool: dropdown menu button for definition operations
-- copying pane output
-- editor:
-  - autoscroll
-  - transpose char/word/line
-  - more efficient multi-line inserts
-- see if its possible to only repaint dirty regions
-- structure editor
-
-+ compiler/ffi:
-
-- C types should be words
-  - TYPEDEF: float { ... } { ... } ;   ==> \ float T{ c-type ... } "c-type" swp
-  - TYPEDEF: float FTFloat ;  ==> \ float \ FTFloat "c-type" swp
-  - make typedef aliasing explicit
-- seeing a C struct word should show its def
-- amd64 structs-by-value bug
-- %allot-bignum-signed-2 is broken on both platforms
-- [ [ dup call ] dup call ] infer hangs
-- stdcall callbacks
-- callstack overflow when compiling mutually recursive inline words
-- arm backend
-- float= doesn't consider nans equal
-- C functions returning structs by value
-- compiled continuations
-
-+ misc:
-
-- if a word drops the stack pointer below the bottom, then an error
-  won't be thrown until the next word accesses the stack
-- prettyprinter: don't build entire tree to print first
-- automatic help/effects for slot accessors
-- tuple shape changes
-- should be possible to reload any source file in library
-- minor GC takes too long now, we should card mark code heap
-- buffer-ptr should be an alien
-- swap nappend ==> nappend
-- incremental GC
-- UDP
-- slice: if sequence or seq start is changed, abstraction violation
-- hashed generic method dispatch
-
-+ httpd:
-
-- remaining HTML issues need fixing
-- embedded.factor is O(n^2)
diff --git a/apps/all.factor b/apps/all.factor
deleted file mode 100644 (file)
index 8fb0ca6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-USING: words kernel modules ;
-
-REQUIRES: apps/automata apps/benchmarks apps/boids
-apps/factorbot apps/fjsc-responder apps/furnace-pastebin 
-apps/hexdump apps/lindenmayer apps/mandel apps/random-tester
-apps/raytracer apps/rss apps/space-invaders apps/tetris
-apps/turing ;
-
-"x11" vocab [
-    "apps/factory" require
-] when
-
-PROVIDE: apps/all ;
diff --git a/apps/automata.factor b/apps/automata.factor
deleted file mode 100644 (file)
index 9b8ef1c..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-REQUIRES: libs/vars libs/slate apps/lindenmayer/opengl ;
-
-USING: kernel namespaces hashtables sequences generic math arrays
-       threads opengl gadgets
-       vars slate opengl-contrib ;
-
-IN: automata
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! set-rule
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: char>digit ( c -- i ) 48 - ;
-
-: string>digits ( s -- seq ) >array [ char>digit ] map ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: rule   VAR: rule-number
-
-: init-rule ( -- ) 8 <hashtable> >rule ;
-
-: rule-keys ( -- array )
-{ { 1 1 1 }
-  { 1 1 0 }
-  { 1 0 1 }
-  { 1 0 0 }
-  { 0 1 1 }
-  { 0 1 0 }
-  { 0 0 1 }
-  { 0 0 0 } } ;
-
-: rule-values ( n -- seq ) >bin 8 CHAR: 0 pad-left string>digits ;
-
-: set-rule ( n -- )
-dup >rule-number rule-values rule-keys [ rule> set-hash ] 2each ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! step-capped-line
-! step-wrapped-line
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: 3nth ( n seq -- slice ) >r dup 3 + r> <slice> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: map3-i ( seq -- i ) length 2 - ;
-
-: map3-quot ( quot -- quot ) [ swap 3nth ] swap append ;
-
-: map3 ( seq quot -- seq ) over map3-i swap map3-quot map-with ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: pattern>state ( {_a_b_c_} -- state ) rule> hash ;
-
-: cap-line ( line -- 0-line-0 ) { 0 } swap append { 0 } append ;
-
-: wrap-line ( a-line-z -- za-line-za )
-dup peek 1array swap dup first 1array append append ;
-
-: step-line ( line -- new-line ) [ >array pattern>state ] map3 ;
-
-: step-capped-line ( line -- new-line ) cap-line step-line ;
-
-: step-wrapped-line ( line -- new-line ) wrap-line step-line ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: window-width ( -- width ) slate> rect-dim 0 swap nth ;
-
-: window-height ( -- height ) slate> rect-dim 1 swap nth ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: random-line ( -- line ) window-width [ drop 2 random-int ] map ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: center-i ( -- i ) window-width 2 / >fixnum ;
-
-: center-line ( -- line ) center-i window-width [ = [ 1 ] [ 0 ] if ] map-with ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: random-item ( seq -- item ) dup length random-int swap nth ;
-
-: interesting ( -- seq )
-{ 18 22 26 30 41 45 54 60 73 75 82 86 89 90 97 101 102 105 106 107 109
-  110 120 121 122 124 126 129 137 146 147 149 150 151 153 154 161 165 } ;
-
-: mild ( -- seq )
-{ 6 9 11 57 62 74 118 } ;
-
-: set-interesting ( -- ) interesting random-item set-rule ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: bitmap
-
-VAR: last-line
-
-: run-rule ( -- )
-last-line> window-height [ drop step-capped-line dup ] map >bitmap >last-line
-.slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: start-random ( -- ) random-line >last-line run-rule ;
-
-: start-center ( -- ) center-line >last-line run-rule ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: draw-point ( y x value -- ) 1 = [ swap glVertex2i ] [ 2drop ] if ;
-
-: draw-line ( y line -- ) 0 swap [ >r 2dup r> draw-point 1+ ] each 2drop ;
-
-: (draw-bitmap) ( bitmap -- ) 0 swap [ >r dup r> draw-line 1+ ] each drop ;
-
-: draw-bitmap ( bitmap -- ) GL_POINTS glBegin (draw-bitmap) glEnd ;
-
-: display ( -- )
-GL_COLOR_BUFFER_BIT glClear black gl-color bitmap> draw-bitmap ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-slate ( -- )
-<slate> >slate   namespace slate> set-slate-ns   [ display ] >action ;
-
-: init ( -- ) init-rule init-slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: loop-flag
-
-DEFER: loop
-
-: (loop) ( -- ) run-rule 3000 sleep loop ;
-
-: loop ( -- ) loop-flag> [ (loop) ] [ ] if ;
-
-: start-loop ( -- ) t >loop-flag [ loop ] in-thread ;
-
-: stop-loop ( -- ) f >loop-flag ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: automata-gadget ;
-
-C: automata-gadget ( -- automata-gadget )
-init
-slate> over set-delegate
-interesting random-item set-rule ;
-
-: automata-window ( -- ) <automata-gadget> "Automata" open-titled-window ;
-
-automata-gadget H{
-    { T{ key-down f f "1" } [ slate-ns [ start-center    ] bind ] }
-    { T{ key-down f f "2" } [ slate-ns [ start-random    ] bind ] }
-    { T{ key-down f f "3" } [ slate-ns [ run-rule        ] bind ] }
-    { T{ key-down f f "5" }
-      [ slate-ns [ set-interesting start-center ] bind ] }
-    { T{ key-down f f "9" } [ slate-ns [ start-loop ] bind ] }
-    { T{ key-down f f "0" } [ slate-ns [ stop-loop ] bind ] }
-} set-gestures
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-PROVIDE: apps/automata ;
\ No newline at end of file
diff --git a/apps/benchmarks/ack.factor b/apps/benchmarks/ack.factor
deleted file mode 100644 (file)
index ccd961a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-USE: math
-USE: kernel
-USE: compiler
-USE: test
-
-! http://inferno.bell-labs.com/cm/cs/who/bwk/interps/pap.html
-
-: ack ( m n -- x )
-    over zero? [
-        nip 1+
-    ] [
-        dup zero? [
-            drop 1- 1 ack
-        ] [
-            dupd 1- ack >r 1- r> ack
-        ] if
-    ] if ;
-
-[ 4093 ] [ 3 9 ack ] unit-test
diff --git a/apps/benchmarks/continuations.factor b/apps/benchmarks/continuations.factor
deleted file mode 100644 (file)
index 112c913..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-IN: temporary
-USING: kernel sequences test ;
-
-[ ] [ 100000 [ drop [ continue ] callcc0 ] each ] unit-test
diff --git a/apps/benchmarks/empty-loop.factor b/apps/benchmarks/empty-loop.factor
deleted file mode 100644 (file)
index fdf69b6..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-IN: temporary
-USING: compiler kernel math math-internals sequences test ;
-
-: empty-loop-0 ( n -- )
-    dup 0 fixnum< [ drop ] [ 1 fixnum-fast empty-loop-0 ] if ;
-
-: empty-loop-1 ( n -- )
-    [ ] times ; 
-
-: empty-loop-2 ( n -- )
-    [ ] repeat ; 
-
-: empty-loop-3 ( n -- )
-    [ drop ] each ; 
-
-[ ] [ 5000000 empty-loop-0 ] unit-test
-[ ] [ 5000000 empty-loop-1 ] unit-test
-[ ] [ 5000000 empty-loop-2 ] unit-test
-[ ] [ 5000000 empty-loop-3 ] unit-test
diff --git a/apps/benchmarks/fac.factor b/apps/benchmarks/fac.factor
deleted file mode 100644 (file)
index 442c0e4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-IN: temporary
-USING: compiler kernel math sequences test ;
-
-: (fac) ( n! i -- n! )
-    dup zero? [
-        drop
-    ] [
-        [ * ] keep 1- (fac)
-    ] if ;
-
-: fac ( n -- n! )
-    1 swap (fac) ;
-
-: small-fac-benchmark
-    #! This tests fixnum math.
-    1 swap [ 10 fac 10 [ 1+ / ] each max ] times ;
-
-: big-fac-benchmark
-    10000 fac 10000 [ 1+ / ] each ;
-
-[ 1 ] [ big-fac-benchmark ] unit-test
-
-[ 1 ] [ 1000000 small-fac-benchmark ] unit-test
diff --git a/apps/benchmarks/fib.factor b/apps/benchmarks/fib.factor
deleted file mode 100644 (file)
index d758669..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-IN: temporary
-USE: compiler
-USE: kernel
-USE: math
-USE: test
-USE: math-internals
-USE: namespaces
-USE: words
-
-! Five fibonacci implementations, each one slower than the
-! previous.
-
-: fast-fixnum-fib ( m -- n )
-    dup 1 fixnum<= [
-        drop 1
-    ] [
-        1 fixnum-fast dup fast-fixnum-fib
-        swap 1 fixnum-fast fast-fixnum-fib fixnum+fast
-    ] if ;
-
-[ 9227465 ] [ 34 fast-fixnum-fib ] unit-test
-
-: fixnum-fib ( m -- n )
-    dup 1 fixnum<= [
-        drop 1
-    ] [
-        1 fixnum- dup fixnum-fib swap 1 fixnum- fixnum-fib fixnum+
-    ] if ;
-
-[ 9227465 ] [ 34 fixnum-fib ] unit-test
-
-: fib ( m -- n )
-    dup 1 <= [ drop 1 ] [ dup 1 - fib swap 2 - fib + ] if ;
-
-[ 9227465 ] [ 34 fib ] unit-test
-
-TUPLE: box i ;
-
-: tuple-fib ( m -- n )
-    dup box-i 1 <= [
-        drop 1 <box>
-    ] [
-        box-i 1- <box>
-        dup tuple-fib
-        swap
-        box-i 1- <box>
-        tuple-fib
-        swap box-i swap box-i + <box>
-    ] if ;
-
-[ T{ box f 9227465 } ] [ T{ box f 34 } tuple-fib ] unit-test
-
-SYMBOL: n
-: namespace-fib ( m -- n )
-    [
-        n set
-        n get 1 <= [
-            1
-        ] [
-            n get 1 - namespace-fib
-            n get 2 - namespace-fib
-            +
-        ] if
-    ] with-scope ;
-
-[ 1346269 ] [ 30 namespace-fib ] unit-test
diff --git a/apps/benchmarks/hashtables.factor b/apps/benchmarks/hashtables.factor
deleted file mode 100644 (file)
index 44e0a61..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-IN: temporary
-USING: compiler hashtables kernel math memory namespaces
-sequences strings test ;
-
-: hash-bench-step ( hash elt -- )
-    3 random-int {
-        { [ dup 0 = ] [ drop dup rot set-hash ] }
-        { [ dup 1 = ] [ drop swap remove-hash ] }
-        { [ dup 2 = ] [ drop swap hash drop ] }
-    } cond ;
-
-: hashtable-benchmark ( seq -- )
-    10000 <hashtable> swap 10 [
-        drop
-        [
-            [
-                hash-bench-step
-            ] each-with
-        ] 2keep
-    ] each 2drop ;
-
-[ ] [ [ string? ] instances hashtable-benchmark ] unit-test
diff --git a/apps/benchmarks/help.factor b/apps/benchmarks/help.factor
deleted file mode 100644 (file)
index 1ed70b8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-USING: gadgets-panes hashtables help io kernel namespaces
-prettyprint sequences errors threads words test ;
-
-[
-    all-articles [
-        stdio get duplex-stream-out pane-stream-pane pane-clear
-        dup global [ . flush ] bind
-        [ dup help ] assert-depth drop
-        1 sleep
-    ] each
-] time
diff --git a/apps/benchmarks/iteration.factor b/apps/benchmarks/iteration.factor
deleted file mode 100644 (file)
index 0647426..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-IN: temporary
-USING: arrays compiler kernel kernel-internals math
-sequences strings test vectors sequences-internals ;
-
-: <range> ( from to -- seq ) dup <slice> ; inline
-
-: vector-iter 100 [ 0 100000 <range> >vector [ ] map drop ] times ;
-: array-iter 100 [ 0 100000 <range> >array [ ] map drop ] times ;
-: string-iter 100 [ 0 100000 <range> >string [ ] map drop ] times ;
-: sbuf-iter 100 [ 0 100000 <range> >sbuf [ ] map drop ] times ;
-: reverse-iter 100 [ 0 100000 <range> >vector <reversed> [ ] map drop ] times ;
-: dot-iter 100 [ 0 100000 <range> dup v. drop ] times ;
-
-[ ] [ vector-iter ] unit-test
-[ ] [ array-iter ] unit-test
-[ ] [ string-iter ] unit-test
-[ ] [ sbuf-iter ] unit-test
-[ ] [ reverse-iter ] unit-test
diff --git a/apps/benchmarks/load.factor b/apps/benchmarks/load.factor
deleted file mode 100644 (file)
index 89c62a1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-PROVIDE: apps/benchmarks
-{ +tests+ {
-    "empty-loop.factor"
-    "fac.factor"
-    "fib.factor"
-    "sort.factor"
-    "continuations.factor"
-    "ack.factor"
-    "hashtables.factor"
-    "strings.factor"
-    "vectors.factor"
-    "prettyprint.factor"
-    "iteration.factor"
-} } ;
diff --git a/apps/benchmarks/prettyprint.factor b/apps/benchmarks/prettyprint.factor
deleted file mode 100644 (file)
index 00c57de..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-IN: temporary
-USE: definitions
-USE: prettyprint
-USE: test
-USE: words
-USE: kernel
-USE: sequences
-USE: io
-
-[ ] [
-    [ vocabs [ words [ see ] each ] each ] string-out drop
-] unit-test
diff --git a/apps/benchmarks/reverse-complement-test-in.txt b/apps/benchmarks/reverse-complement-test-in.txt
deleted file mode 100644 (file)
index f1caba0..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
->ONE Homo sapiens alu
-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
-GGCGACAGAGCGAGACTCCG
->TWO IUB ambiguity codes
-cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg
-tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa
-NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt
-cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga
-gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa
-HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca
-tttHatSttMtWgtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactt
-tattRggaMcDaWaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSSt
-acaStYRctVaNMtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaacct
-tacgtVtcVaattVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYt
-gtttaagaagattattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWa
-accRVacacaaactaccScattRatatKVtactatatttHttaagtttSKtRtacaaagt
-RDttcaaaaWgcacatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgt
-tgDcgtMgcatBtgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacag
-cccccacatYScaMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctg
-ttWaaataaaataRattagHacacaagcgKatacBttRttaagtatttccgatctHSaat
-actcNttMaagtattMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKagg
-YtaaBataSaVatactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSa
-KtWaStVcNKHKttactatccctcatgWHatWaRcttactaggatctataDtDHBttata
-aaaHgtacVtagaYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBa
-aNtgctggMBaKctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacg
-gtttNattgVtttctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgc
-tcttagHVggaYtgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccK
-tcHaaStttMcctagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMt
-ttctWgtNtgtgaaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacg
-ggtaKVattKYagactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNa
-BKRgNacaactgatttcctttaNcgatttctctataScaHtataRagtcRVttacDSDtt
-aRtSatacHgtSKacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacc
-tttYtatgttactttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatc
-cgtaBVttccagccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcac
-aattgcaNtSBaaccgggttattaaBcKatDagttactcttcattVtttHaaggctKKga
-tacatcBggScagtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcga
-aacaHtaagttaRatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaD
-gttVHWgtcHaaHgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtg
-ttHWHacgattBtgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcV
-taBtWaaYatcDRaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaa
-ccctcccctagaWBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagat
-gaaaaHctctaacgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgg
-gaWtactKKMaacatKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaa
-tYttWttaWSSttaHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctt
-tYatcatKgctcctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactt
-taSatcgDataaactaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatca
-cBVctgcaVatVttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBag
-aHSBDgtagcacRHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHt
-cgtYaaMNgBaatttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctctt
-ttVctagctDaaagtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBW
-attccgStaMSaMatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatag
-ttactttacgatcaccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaa
-attBgtataRaaaacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStc
-tHNaaatctBBtcttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHccta
->THREE Homo sapiens frequency
-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
-ggaagtgaaaagataaatat
diff --git a/apps/benchmarks/reverse-complement-test-out.txt b/apps/benchmarks/reverse-complement-test-out.txt
deleted file mode 100644 (file)
index 14d792a..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
->ONE Homo sapiens alu
-CGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAAC
-CTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACA
-GGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCAT
-GTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAA
-AGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTC
-TGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGG
-GTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACC
-ACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTG
-GTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTA
-CAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCT
-GGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTC
-TCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCCGGCTAAT
-TTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTCGAACTCCT
-GACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCA
-CCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGC
-GCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCC
-TCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTA
-GTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGAT
-CCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCT
-TTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTC
-ACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTG
-GGATTACAGGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGT
-TTCACCATGTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGG
-CCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAG
-TCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCG
-CCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGC
-GCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGG
-CCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGC
-TGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCG
-CCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCA
-AGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCC
-CGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTC
-GAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGC
-GTGAGCCACCGCGCCCGGCC
->TWO IUB ambiguity codes
-TAGGDHACHATCRGTRGVTGAGWTATGYTGCTGTCABACDWVTRTAAGAVVAGATTTNDA
-GASMTCTGCATBYTTCAAKTTACMTATTACTTCATARGGYACMRTGTTTTYTATACVAAT
-TTCTAKGDACKADACTATATNTANTCGTTCACGBCGYSCBHTANGGTGATCGTAAAGTAA
-CTATBAAAAGATSTGWATBCSGAKHTTABBAACGTSYCATGCAAVATKTSKTASCGGAAT
-WVATTTNTCCTTCTTCTTDDAGTGGTTGGATACVGTTAYMTMTBTACTTTHAGCTAGBAA
-AAGAGKAAGTTRATWATCAGATTMDDTTTAAAVAAATATTKTCYTAAATTVCNKTTRACG
-ADTATATTTATGATSADSCAATAWAGCGRTAGTGTAAGTGACVGRADYGTGCTACHVSDT
-CTVCARCSYTTAATATARAAAATTTAATTTACDAATTGBACAGTAYAABATBTGCAGBVG
-TGATGGDCAAAATBNMSTTABKATTGGSTCCTAGBTTACTTGTTTAGTTTATHCGATSTA
-AAGTCGAKAAASTGTTTTAWAKCAGATATACTTTTMTTTTGBATAGAGGAGCMATGATRA
-AAGGNCAYDCCDDGAAAGTHGBTAATCKYTBTACBGTBCTTTTTGDTAASSWTAAWAARA
-TTGGCTAAGWGRADTYACATAGCTCBTAGATAWAGCAATNGTATMATGTTKMMAGTAWTC
-CCNTSGAAWATWCAAAAMACTGAADNTYGATNAATCCGAYWNCTAACGTTAGAGDTTTTC
-ATCTGGKRTAVGAABVCTGWGBTCTDVGKATTBTCTAAGGVADAAAVWTCTAGGGGAGGG
-TTAGAACAATTAAHTAATNAAATGCATKATCTAAYRTDTCAGSAYTTYHGATRTTWAVTA
-BGNTCDACAGBCCRCAGWCRTCABTGMMAWGMCTCAACCGATRTGBCAVAATCGTDWDAA
-CAYAWAATWCTGGTAHCCCTAAGATAACSCTTAGTGSAACAWTBGTCDTTDGACWDBAAC
-HTTTNGSKTYYAAYGGATNTGATTTAARTTAMBAATCTAAGTBTCATYTAACTTADTGTT
-TCGATACGAAHGGCYATATACCWDTKYATDCSHTDTCAAAATGTGBACTGSCCVGATGTA
-TCMMAGCCTTDAAABAATGAAGAGTAACTHATMGVTTAATAACCCGGTTVSANTGCAATT
-GTGAGATTTAMGTTTAMAAYGCTGACAYAAAAAGGCACAMYTAAGVGGCTGGAABVTACG
-GATTSTYGTBVAKTATWACCGTGTKAGTDTGTATGTTTAAAGGAAAAAGTAACATARAAA
-GGTYCAMNYAAABTATAGNTSATANAGTCATCCTATWADKAACTRGTMSACDGTATSAYT
-AAHSHGTAABYGACTYTATADTGSTATAGAGAAATCGNTAAAGGAAATCAGTTGTNCYMV
-TNACDRTATBNATATASTAGAAMSCGGGANRCKKMCAAACATTNAGTCTRMAATBMTACC
-CGTACTTCTBGDSYAATWGAAAATGACADDCHAKAAAYATATTKTTTTCACANACWAGAA
-AKATCCTTATTAYKHKCTAAACARTATTTTDATBTVWCYGCAATACTAGGKAAASTTDGA
-MGGCHTTHAATVCAHDRYAGGRCTATACGTCMAGAGAGCTBTHGNACARTCCBDCTAAGA
-GCGGCTTTARTAAAGAATCCNAGTAWBTGACTTGAATTACWTVACAGAAABCAATNAAAC
-CGTNTRANTTGAYCMAWBADTANABRGGTKTHTWTAGTTVCTMBKTAGMTVKCCAGCANT
-TVAGSWTTAGCCGCRHTTTCCTTHNTATTAAGAAGAATAGGMTRAARTCTABGTACDTTT
-TATAAVDHAHTATAGATCCTAGTAAGYTWATDWCATGAGGGATAGTAAMDMNGBASTWAM
-TSTATRBAYDABATGTATATYCGCACTGTTTTAACMCWBTATAWAGTATBTSTATVTTAR
-CCTMTTAAKADATCAACTAATYTSVTAKGDATTATGCKTCAYCAKAATACTTKAANGAGT
-ATTSDAGATCGGAAATACTTAAYAAVGTATMCGCTTGTGTDCTAATYTATTTTATTTWAA
-CAGWRCTATGTAGMTGTTTGTTYKTNGTTKTCAGAACNTRACCTACKTGSRATGTGGGGG
-CTGTCATTAAGTAAATNGSTTABCCCCTCGCAGCTCWHTCGCGAAGCAVATGCKACGHCA
-ACAKTTAATAACASAAADATTWNYTGTAATTGTTCGTMHACHTWATGTGCWTTTTGAAHY
-ACTTTGTAYAMSAAACTTAADAAATATAGTABMATATYAATGSGGTAGTTTGTGTBYGGT
-TWSGSVGWMATTDMTCCWWCABTCSVACAGBAATGTTKATBGTCAATAATCTTCTTAAAC
-ARVAATHAGYBWCTRWCABGTWWAATCTAAGTCASTAAAKTAAGVKBAATTBGABACGTA
-AGGTTAAATAAAAACTRMDTWBCTTTTTAATAAAAGATMGCCTACKAKNTBAGYRASTGT
-ASSTCGTHCGAAKTTATTATATTYTTTGTAGAACATGTCAAAACTWTWTHGKTCCYAATA
-AAGTGGAYTMCYTAARCSTAAATWAKTGAATTTRAGTCTSSATACGACWAKAASATDAAA
-TGYYACTSAACAAHAKTSHYARGASTATTATTHAGGYGGASTTTBGAKGATSANAACACD
-TRGSTTRAAAAAAAACAAGARTCVTAGTAAGATAWATGVHAAKATWGAAAAGTYAHVTAC
-TCTGRTGTCAWGATRVAAKTCGCAAVCGASWGGTTRTCSAMCCTAACASGWKKAWDAATG
-ACRCBACTATGTGTCTTCAAAHGSCTATATTTCGTVWAGAAGTAYCKGARAKSGKAGTAN
-TTTCYACATWATGTCTAAAADMDTWCAATSTKDACAMAADADBSAAATAGGCTHAHAGTA
-CGACVGAATTATAAAGAHCCVAYHGHTTTACATSTTTATGNCCMTAGCATATGATAVAAG
->THREE Homo sapiens frequency
-ATATTTATCTTTTCACTTCCTACATTGGTCAGACCATTATTCGACACGTGGCGTCATTTT
-GTCATACCGGGTAATGTTGGAAACAAAACGTACTGATAAAATACTGAGTTGTAAACTCTA
-ATCAGATAACGCGCTTGGATATTAAGATTCACACAGGGGTTTCGGCTGTAAAAAAACTTG
-TGGAGCTGTTCTGGGACAGATAAGTTGTACCTCGTACTTAGCTAATTAATGAACCAACTG
-ATTACGATAGAACAATTCTGAGGCCGCCAGGACAGCCAAATTTTAATCTTATAAAGCTGG
-AAACAGCCGGTATTAGCTTCTCGCATACTTTGCCTGCATTGGTACCTTACAGATATCAGC
-GTAGTCATATACACCTCGGTCTCAGCTAAGCTTGTATCTCTTAGAGTAGTTCAAAGATAG
-TGGACAATACCTGTGGAATCGATTGCAGATATGGATTTATTTAACTACTGAGTCTCATTC
-ACAAGCTAAGCAAGGAGCACGTTTTGGTGCCGGCATACCGATTTGCTATCATGTCAGCAA
-ATTTGCGTTGTATTCCTAGTTGCACCCATTAAGGCCACACTCCGAACCTAATTATTACAT
-CGCAAAGACATGTACGAAGGACCCGATGTCGAATAGAAGGGAGGACTGTTCATTGGAAGC
-TAGACCAGAGGAATCGCAAAGATGCAACTCTTACAATAAAAATCTAATTTCAGTCAACAC
-GCAATTTCTATAAGGTTTCCGATAATAATGAACCGTCTTCCACAGGGGAATTTGCCATGC
-TCGTAAAAGTAGTTAATCCAAGTAGAAGAAATTTTGATAATGTTTTAAGTTGGCACGAAG
-GAATTCAGAGAGATCTTACCTAACAAAGGCATTAGTAGATGTTCCTTGGTTCACACTCGG
-TCAATCAGAGCACATACTACGGGCGATACCGGGAATGACACAACATCAATGAGATTGTTA
-AGTGAGGTAATTGACTTTAGAGGACTCGATCAGTATACTGTCACTATGAACATCGTATTA
-ATTGTTATCCGATATATACACCACCGATTTGCTTGTGCAAGGTTACAGACCCATTCGATA
-AATACAAACACGGAGCGATATTATTTAAGGAGTGCTGTCTTCAAAAGAATTATTCCCACA
-CCGACATAAGAACTTCGCTCCGTCATTCCAGATTTAAATAACATAACGTAACGCTTTGCT
-GATAACATAACATAACCGAGAATTTGCTTAGGAAATTTGGAGCAATATTGCATTGTTTCT
-CAGTCATCACAAGGCCCGCCAAAGAACTCTGAGAATCAGGATTCAACATGATTGGTAAGA
-CTCTATATATATAACTTAATTCTTGTGTCCGGAGATAGAAAGAGGACGAGAGATACTACG
-AAAGAAAGTGTACTTCGATGTATCAATTCAGACGCCTTCTCTATCATCAACATTATAGGT
-CTCGTATATGCTCGGCGCGATCTGCTTCTCTCCGCCAATAGCCCCATAGTGTATTTCAAG
-CGCAGTAACAGTGAAATCGTTACGAAGGTAGGGATGTTGCTTATAATTGTCGTAACTTAT
-CGCTTATGTATCTTTCAAGAATGAACGGCAGCATATACATACGTTCTACCTTTAGCTACA
-AAGCATCCATATACTCCCTCTCATGATTGAAACTCTTCCCTATTTTGTAGCCAATAGTGA
-AAGCGTATTAGTATAAATTCGTCGGTTTTTCACTCGCAACTGTTATACTCTGCAAACAAA
-CGAAAGCCTCATAGTACAAACCTAAAGCTACATACTTCATCATTGGCAGACCAGTGGCGG
-TATTTCTACGGAAGCATCACTATAGATATAAAGTTTCCCTTCATGTACGTCTGTTAACCA
-TATCACAAGAAACTGCTATCTCTGTCACGTAACAATTCACGCGCCTTATCGCCAAATGTT
-CATATATGCGCGGTATACGTATGAACGAATACTAATTAGTATAACGGAGGATTCACGGGA
-GGGATACTTGGGGCATTTATAAATCGTCTAAAAATTTTCTATCAGCACTTGCGGGTTATA
-GTGGATTACTAGGCAACATAATATTCTGTATTGGTCCAAATGACGCTATAGATAAATTAG
-CAAAATACATTGTTTCCATTTATGTAAGTCGAAACTCCAGGACTCCCGGGAACCAGTTAA
-ACCGTCTGGAAAAGACACATTGTGAGCGGGACTTCAATGATAGCTTTCAATGAGCTTCTC
-ATGCTTGGGGTCTGTACATATATGTTGGCGAAATTATCGTCTGTATTCTGTTATGCTTTG
-ATCATGGGTTATTAGTATAGTGTCCGGTTAAGTACCAATACCGCTAGAGACCCGACCTAA
-GTCGATAACTAACGATCATCGACGTAAGGATCGTCTCGATCAGTACTTCAGTCTAGATCT
-GGGAATAGTAACTCGTTAGTGAACTATGTCGTGTCATAACTCTAAAATGCAATCAAATCT
-TATTATTGAGTATTGATTATATAAAGCATCCGCTTAGCTTTACCCTCAAATGTTATATGC
-AATTTAAAGCGCTTGATATCGTCTACTCAAGTTCAGGTTTCACATGGCCGCAACGTGACG
-TTATTAGAGGTGGGTCATCATCTCTGAGGCTAGTGATGTTGAATACTCATTGAATGGGAA
-GTGGAATACCATGCTCGTAGGTAACAGCATGACCTATAAAATATACTATGGGTGTGTGGT
-AGATCAATATTGTTCAAGCATATCGTAACAATAACGGCTGAAATGTTACTGACATGAAAG
-AGGGAGTCCAAACCATTCTAACAGCTGATCAAGTCGTCTAAAAACGCCTGGTTCAGCCTT
-AAGAGTTATAAGCCAGACAAATTGTATCAATAGAGAATCCGTAAATTCCTCGGCCAACCT
-CTTGCAAAGACATCACTATCAATATACTACCGTGATCTTAATTAGTGAACTTATATAAAT
-ATCTACAACCAGATTCAACGGAAAAGCTTTAGTGGATTAGAAATTGCCAAGAATCACATT
-CATGTGGGTTCGAATGCTTTAGTAATACCATTTCGCCGAGTAGTCACTTCGCTGAACTGT
-CGTAAATTGCTATGACATAATCGAAAAGGATTGTCAAGAGTCGATTACTGCGGACTAATA
-ATCCCCACGGGGGTGGTCTCATGTCTCCCCAGGCGAGTGGGGACGGTTGATAAACACGCT
-GCATCGCGGACTGATGTTCCCAGTATTACATAGTCACATTGGATTGCGAGTAGTCTACCT
-ATTTATGAGCGAGAGATGCCTCTAACTACTTCGACTTTTAAAACCTTTCCACGCCAGTAT
-TCGGCGAAAGGGAAGTATTAAGGGTTGTCATAATTAAGCTGATACCACTTCAGACTTTGC
-TCTACTTCTGTCTTTCATTGGTTTAGTAAAGTCTGTCCATTCGTCGAGACCGTCTTTTGC
-AGCCTCATTCTACCAACTGCTCCGACTCTTAGTCTGCTTCTCCCAGCGTTATAACAAGAG
-GCATTTTGTCATCCTTAAAACAATAATAAAGAACTCGGAGCACTGATATAATGACTGAAT
-TAGAACCGCTTAAAAATACAACGAATAGATAAGACTATCGGATAAGATCTAATATGTAGT
-GATTAAGCCCTTTATTAATTAATAATAGTTACCCTTTCTGATGTAACGCGACATATTACG
-ATTTAGTGGCACGTCTGAATTGCAAAGCAGATCTCTACCCGATTTTTATTATAAATCCCG
-TATACATCTTGACTTGAGTAATTGTTCATCTTTTTATATCTCTTCGTACTACAAATAATT
-AATATCTCAACCCGTATTGTGTGATTCTAATTACCAACAGAATACGAGGAGGTTTTTGCT
-TAGGGCCATATATAATGAATCTATCTCGTTTATTCGCGGAACCCGAGATAACATTACGAT
-GTAACTATTTTAGAGAACTTAATACAAGAAACATTGCTGATTACTCATAACTAAATGCTT
-GGTAATATATCCTCAGTGCCCCTACCATCTTTTACGCAGGGATGTAATTACTTAGGATTC
-ATTGTGTAAGAATTACAATGAACGATGGATATGAAGGCATGTTGCGAGGTGTTCCTTGGT
-ATGTGAAGTTCGCAGGGCAACAAAAATTTCGCAGAATAGGCCTCAAAGTATTGGTAAAGA
-AGACAACTAATCATCACGAGCTTCTGATATCAATACGAACGAGTCCTGTGATGGATGAAA
-GAAAGTCGTATCGAAAATGTCAAGAGTCTGCCCAATGTAACTTACTTCAAAAAATAACGC
-TTCCGCCAAGTACGTTCGAATAAACGTAATTTTAAAAATACATAAGGGGTGTTAGAAAGT
-AAGCGACGGGATATAAGTTAGACTCAAGATTCCGCCGTAAAACGAGACTGATTCCGAAGA
-TTGTTCGTGGATCTGGTCATGACTTTCACTGAGTAAGGAGTTTCGACATATGTCAATAAA
-CACAAAAATAGAAGCTATTCGATCTGAAAAATATTAGGACAAGAAACTATCTCACGCTAG
-CCCAGAATATTCACTCACCCACGGGCGATACTAAAGCACTATATAGTCGCGTGATTACTA
-TACATATGGTACACATAAGAATCACGATCAGGTTCTCAATTTTCAACAATATATGTTTAT
-TTGCATAGGTAATATTAGGCCTTTAAGAGAAGGATGGGTGAGATACTCCGGGGATGGCGG
-CAATAAAGAAAAACACGATATGAGTAATAGGATCCTAATATCTTGGCGAGAGACTTAAGG
-TACGAATTTTGCGCAATCTATTTTTTACTTGGCCAGAATTCATGTATGGTATAAGTACGA
-ACTTTTTTGATCACTTTCATGGCTACCTGATTAGGATAGTTTGAGGAATTTCCCAAATAT
-ACCGATTTAATATACACTAGGGCTTGTCACTTTGAGTCAGAAAAAGAATATAATTACTTA
-GGGTAATGCTGCATACATATTCTTATATTGCAAAGGTTCTCTGGGTAATCTTGAGCCTTC
-ACGATACCTGGTGAAGTGTT
diff --git a/apps/benchmarks/reverse-complement.factor b/apps/benchmarks/reverse-complement.factor
deleted file mode 100644 (file)
index c594ae4..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-IN: temporary
-USING: compiler hashtables io kernel math math namespaces
-sequences strings vectors words words ;
-
-DEFER: trans-map
-
-: add-translation \ trans-map get set-nth ;
-
-[
-    256 0 <string> \ trans-map set
-    26 [ CHAR: A + dup add-translation ] each
-    26 [ dup CHAR: A + swap CHAR: a + add-translation ] each
-
-    "TGCAAKYRMBDHV"
-    "ACGTUMRYKVHDB"
-    2dup
-    [ add-translation ] 2each
-    [ ch>lower add-translation ] 2each
-    
-    \ trans-map get
-] with-scope
-
-\ trans-map swap unit define-compound
-\ trans-map t "inline" set-word-prop
-
-: translate-seq ( seq -- sbuf )
-    [
-        30000000 <sbuf> building set
-        <reversed> [ <reversed> % ] each
-        building get dup [ trans-map nth ] inject
-    ] with-scope ;
-
-SYMBOL: out
-
-: seg ( sbuf n -- str )
-    60 * dup 60 + pick length min rot <slice> >string ;
-
-: show-seq ( seq -- )
-    translate-seq dup length 59 + 60 /i
-    [ seg out get stream-print ] each-with ;
-
-: do-line ( seq line -- seq )
-    dup first ">;" memq? [
-        over show-seq out get stream-print dup delete-all
-    ] [
-        over push
-    ] if ;
-
-: (reverse-complement) ( seq -- )
-    readln [ do-line (reverse-complement) ] [ show-seq ] if* ;
-
-: reverse-complement ( infile outfile -- )
-    <file-writer> [
-        stdio get out set
-        <file-reader> [
-            500000 <vector> (reverse-complement)
-        ] with-stream
-    ] with-stream ;
diff --git a/apps/benchmarks/sort.factor b/apps/benchmarks/sort.factor
deleted file mode 100644 (file)
index 979ee3f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-IN: temporary
-USING: compiler kernel math sequences test ;
-
-: sort-benchmark
-    100000 [ drop 100000 random-int ] map natural-sort drop ;
-
-[ ] [ sort-benchmark ] unit-test
diff --git a/apps/benchmarks/strings.factor b/apps/benchmarks/strings.factor
deleted file mode 100644 (file)
index aa075a0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-USING: compiler kernel math namespaces sequences strings test ;
-
-! http://inferno.bell-labs.com/cm/cs/who/bwk/interps/pap.html
-
-: string-step ( n str -- )
-    2dup length > [
-        dup [ "123" % % "456" % % "789" % ] "" make
-        dup dup length 2 /i 0 swap rot subseq
-        swap dup length 2 /i 1+ 1 swap rot subseq append
-        string-step
-    ] [
-        2drop
-    ] if ;
-
-: string-benchmark ( n -- )
-    "abcdef" 10 [ 2dup string-step ] times 2drop ;
-
-[ ] [ 400000 string-benchmark ] unit-test
diff --git a/apps/benchmarks/vectors.factor b/apps/benchmarks/vectors.factor
deleted file mode 100644 (file)
index 3bcbc92..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-USING: compiler kernel math sequences test vectors ;
-
-! http://inferno.bell-labs.com/cm/cs/who/bwk/interps/pap.html
-
-: fill-vector ( n -- vector )
-    dup <vector> swap [ dup pick set-nth ] each ;
-
-: copy-elt ( vec-y vec-x n -- )
-    #! Copy nth element from vec-x to vec-y.
-    rot >r tuck >r nth r> r> set-nth ;
-
-: copy-vector ( vec-y vec-x n -- )
-    #! Copy first n-1 elements from vec-x to vec-y.
-    [ [ >r 2dup r> copy-elt ] keep ] repeat 2drop ;
-
-: vector-benchmark ( n -- )
-    0 <vector> over fill-vector rot copy-vector ;
-
-[ ] [ 400000 vector-benchmark ] unit-test
diff --git a/apps/boids.factor b/apps/boids.factor
deleted file mode 100644 (file)
index 3e49176..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-REQUIRES: libs/math
-          libs/vars
-          apps/lindenmayer/opengl
-          libs/slate ;
-
-USING: kernel namespaces math sequences arrays threads opengl gadgets
-       math-contrib vars opengl-contrib slate ;
-
-IN: boids
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: boid pos vel ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: boids
-VAR: world-size
-VAR: time-slice
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: cohesion-weight
-VAR: alignment-weight
-VAR: separation-weight
-
-VAR: cohesion-view-angle
-VAR: alignment-view-angle
-VAR: separation-view-angle
-
-VAR: cohesion-radius
-VAR: alignment-radius
-VAR: separation-radius
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-variables ( -- )
-1.0 >cohesion-weight
-1.0 >alignment-weight
-1.0 >separation-weight
-
-75 >cohesion-radius
-50 >alignment-radius
-25 >separation-radius
-
-180 >cohesion-view-angle
-180 >alignment-view-angle
-180 >separation-view-angle
-
-10 >time-slice ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! random-boid and random-boids
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: random-range ( a b -- n ) 1 + dupd swap - random-int + ;
-
-: random-pos ( -- pos ) world-size> [ random-int ] map ;
-
-: random-vel ( -- vel ) 2 >array [ drop -10 10 random-range ] map ;
-
-: random-boid ( -- boid ) random-pos random-vel <boid> ;
-
-: random-boids ( n -- boids ) [ drop random-boid ] map ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! draw-boid
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: boid-point-a ( boid -- a ) boid-pos ;
-
-: boid-point-b ( boid -- b ) dup boid-pos swap boid-vel normalize 20 v*n v+ ;
-
-: boid-points ( boid -- point-a point-b ) dup boid-point-a swap boid-point-b ;
-
-: draw-line ( a b -- )
-GL_LINES glBegin first2 glVertex2i first2 glVertex2i glEnd ;
-
-: draw-boid ( boid -- ) boid-points draw-line ;
-
-: draw-boids ( -- ) boids> [ draw-boid ] each ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: distance ( boid boid -- n ) boid-pos swap boid-pos v- norm ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: constrain ( n a b -- n ) rot min max ;
-
-: angle-between ( vec vec -- angle )
-2dup v. -rot norm swap norm * / -1 1 constrain acos rad>deg ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: relative-position ( self other -- v ) boid-pos swap boid-pos v- ;
-
-: relative-angle ( self other -- angle )
-over boid-vel -rot relative-position angle-between ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: vsum ( vector-of-vectors -- vec ) { 0 0 } [ v+ ] reduce ;
-
-: vaverage ( seq-of-vectors -- seq ) dup vsum swap length v/n ;
-
-: average-position ( boids -- pos ) [ boid-pos ] map vaverage ;
-
-: average-velocity ( boids -- vel ) [ boid-vel ] map vaverage ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: within-radius? ( self other radius -- ? ) >r distance r> <= ;
-
-: within-view-angle? ( self other angle -- ? ) >r relative-angle r> 2 / <= ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: within-cohesion-radius? ( self other -- ? )
-  cohesion-radius get within-radius? ;
-
-: within-cohesion-view? ( self other -- ? )
-  cohesion-view-angle get within-view-angle? ;
-
-: within-cohesion-neighborhood? ( self other -- ? )
-  [ eq? not ] 2keep
-  [ within-cohesion-radius? ] 2keep
-  within-cohesion-view?
-  and and ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: within-separation-radius? ( self other -- ? )
-  separation-radius get within-radius? ;
-
-: within-separation-view? ( self other -- ? )
-  separation-view-angle get within-view-angle? ;
-
-: within-separation-neighborhood? ( self other -- ? )
-  [ eq? not ] 2keep
-  [ within-separation-radius? ] 2keep
-  within-separation-view?
-  and and ;  
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: within-alignment-radius? ( self other -- ? )
-  alignment-radius get within-radius? ;
-
-: within-alignment-view? ( self other -- ? )
-  alignment-view-angle get within-view-angle? ;
-
-: within-alignment-neighborhood? ( self other -- ? )
-  [ eq? not ] 2keep
-  [ within-alignment-radius? ] 2keep
-  within-alignment-view?
-  and and ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: cohesion-neighborhood ( self -- boids )
-boids> [ within-cohesion-neighborhood? ] subset-with ;
-
-: cohesion-force ( self -- force )
-dup cohesion-neighborhood
-dup length 0 =
-[ 2drop { 0 0 } ]
-[ average-position swap boid-pos v- normalize cohesion-weight> v*n ]
-if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: separation-neighborhood ( self -- boids )
-boids> [ within-separation-neighborhood? ] subset-with ;
-
-: separation-force ( self -- force )
-dup separation-neighborhood
-dup length 0 =
-[ 2drop { 0 0 } ]
-[ average-position swap boid-pos swap v- normalize separation-weight> v*n ]
-if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: alignment-neighborhood ( self -- boids )
-boids> [ within-alignment-neighborhood? ] subset-with ;
-
-: alignment-force ( self -- force )
-alignment-neighborhood
-dup length 0 =
-[ drop { 0 0 } ]
-[ average-velocity normalize alignment-weight get v*n ]
-if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! F = m a
-!
-! We let m be equal to 1 so then this is simply: F = a
-
-: acceleration ( boid -- acceleration )
-  dup dup
-  separation-force rot
-  alignment-force  rot
-  cohesion-force v+ v+ ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! iterate-boid
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: world-width ( -- w ) world-size> first ;
-
-: world-height ( -- w ) world-size> second ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: below? ( n a b -- ? ) drop < ;
-
-: above? ( n a b -- ? ) nip > ;
-
-: wrap ( n a b -- n )
-{ { [ 3dup below? ]
-    [ 2nip ] }
-  { [ 3dup above? ]
-    [ drop nip ] }
-  { [ t ]
-    [ 2drop ] } }
-cond ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: wrap-x ( x -- x ) 0 world-width 1- wrap ;
-
-: wrap-y ( y -- y ) 0 world-height 1- wrap ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: new-pos ( boid -- pos ) dup boid-vel time-slice> v*n swap boid-pos v+ ;
-
-: new-vel ( boid -- vel )
-dup acceleration time-slice> v*n swap boid-vel v+ normalize ;
-
-: wrap-pos ( pos -- pos ) first2 wrap-y swap wrap-x swap 2array ;
-
-: iterate-boid ( self -- self ) dup >r new-pos wrap-pos r> new-vel <boid> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: iterate-boids ( -- ) boids> [ iterate-boid ] map >boids ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: display ( -- ) GL_COLOR_BUFFER_BIT glClear black gl-color draw-boids ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: stop?
-
-: run ( -- )
-slate> rect-dim >world-size
-iterate-boids .slate 1 sleep
-stop? get [ ] [ run ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-slate ( -- )
-<slate> >slate
-namespace slate> set-slate-ns
-[ display ] >action
-slate> "Boids" open-titled-window ;
-
-: init-boids ( -- ) 50 random-boids >boids ;
-
-: init-world-size ( -- ) { 100 100 } >world-size ;
-
-: init ( -- ) init-slate init-variables init-world-size init-boids stop? off ;
-
-PROVIDE: apps/boids ;
\ No newline at end of file
diff --git a/apps/factorbot.factor b/apps/factorbot.factor
deleted file mode 100644 (file)
index f0611ba..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-! Simple IRC bot written in Factor.
-
-REQUIRES: libs/httpd ;
-
-USING: errors generic hashtables help html http io kernel math
-memory namespaces parser prettyprint sequences strings threads
-words ;
-IN: factorbot
-
-SYMBOL: irc-stream
-SYMBOL: nickname
-SYMBOL: speaker
-SYMBOL: receiver
-
-: irc-write ( s -- ) irc-stream get stream-write ;
-: irc-print ( s -- )
-    irc-stream get stream-print
-    irc-stream get stream-flush ;
-
-: nick ( nick -- )
-    dup nickname set  "NICK " irc-write irc-print ;
-
-: login ( nick -- )
-    dup nick
-    "USER " irc-write irc-write
-    " hostname servername :irc.factor" irc-print ;
-
-: connect ( server -- ) 6667 <client> irc-stream set ;
-
-: disconnect ( -- ) irc-stream get stream-close ;
-
-: join ( chan -- )
-    "JOIN " irc-write irc-print ;
-
-GENERIC: handle-irc ( line -- )
-PREDICATE: string privmsg " " split1 nip "PRIVMSG" head? ;
-PREDICATE: string ping "PING" head? ;
-
-M: object handle-irc ( line -- )
-    drop ;
-
-: parse-privmsg ( line -- text )
-    " " split1 nip
-    "PRIVMSG " ?head drop
-    " " split1 swap receiver set
-    ":" ?head drop ;
-
-M: privmsg handle-irc ( line -- )
-    parse-privmsg
-    " " split1 swap
-    "factorbot-commands" lookup dup
-    [ execute ] [ 2drop ] if ;
-
-M: ping handle-irc ( line -- )
-    "PING " ?head drop "PONG " swap append irc-print ;
-
-: parse-irc ( line -- )
-    ":" ?head [ "!" split1 swap speaker set ] when handle-irc ;
-
-: say ( line nick -- )
-    "PRIVMSG " irc-write irc-write " :" irc-write irc-print ;
-
-: respond ( line -- )
-    receiver get nickname get = speaker receiver ? get say ;
-
-: irc-loop ( -- )
-    irc-stream get stream-readln
-    [ dup print flush parse-irc irc-loop ] when* ;
-
-: factorbot
-    "irc.freenode.net" connect
-    "factorbot" login
-    "#concatenative" join
-    [ irc-loop ] [ irc-stream get stream-close ] cleanup ;
-
-: factorbot-loop [ factorbot ] try 30000 sleep factorbot-loop ;
-
-: multiline-respond ( string -- )
-    string-lines [ respond ] each ;
-
-: object-href
-    "http://factorcode.org" swap browser-link-href append ;
-
-: not-found ( str -- )
-    "Sorry, I couldn't find anything for " swap append respond ;
-
-IN: factorbot-commands
-
-: see ( text -- )
-    dup words-named dup empty? [
-        drop
-        not-found
-    ] [
-        nip [
-            dup summary " -- " 
-            rot object-href 3append respond
-        ] each
-    ] if ;
-
-: memory ( text -- )
-    drop [ room. ] string-out multiline-respond ;
-
-: quit ( text -- )
-    drop speaker get "slava" = [ disconnect ] when ;
-
-PROVIDE: apps/factorbot ;
-
-MAIN: apps/factorbot factorbot ;
diff --git a/apps/factory/README.txt b/apps/factory/README.txt
deleted file mode 100644 (file)
index 2a18a5d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-----------------------------------------------------------------------
-Running factory in Xnest
-----------------------------------------------------------------------
-
-In a terminal, run Xnest using an unused display number. Usually you
-can use 2 or greater.
-
-  $ Xnest -auth /dev/null :2
-
-Start factor and launch factory on the appropriate display:
-
-  "libs/factory" run-module
-
-In a terminal, start an application on the appropriate display:
-
-  $ DISPLAY=:2 xterm
-
-----------------------------------------------------------------------
-The mouse functions
-----------------------------------------------------------------------
-
-Root window
-Mouse-1                Toggle root menu
-Mouse-2                Toggle window list
-
-Window border
-Mouse-1                Drag to move window
-Mouse-2                Drag to resize window (specify bottom right corner)
-Mouse-3                Hide window (use window list to get it back)
diff --git a/apps/factory/factory.factor b/apps/factory/factory.factor
deleted file mode 100644 (file)
index f33f2d0..0000000
+++ /dev/null
@@ -1,657 +0,0 @@
-USING: kernel alien compiler namespaces generic math sequences hashtables io
-arrays words prettyprint concurrency process
-vars rectangle x11 x concurrent-widgets ;
-
-IN: factory
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-DEFER: workspace-menu
-DEFER: wm-frame?
-DEFER: manage-window
-DEFER: window-list
-DEFER: refresh-window-list
-DEFER: layout-frame
-DEFER: mapped-windows
-DEFER: workspace-1 DEFER: workspace-2 DEFER: workspace-3 DEFER: workspace-4
-DEFER: switch-to
-DEFER: update-title
-DEFER: delete-frame
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: popup-window ( -- ) mouse-sensor move-window raise-window map-window ;
-
-: popup-window% [ popup-window ] with-window-object ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: root-menu
-
-: setup-root-menu ( -- )
-  create-menu root-menu set
-  "black" lookup-color root-menu get set-window-background%
-  "Terminal" [ "xterm &" system ] root-menu get add-popup-menu-item
-  "Emacs"    [ "emacs &" system ]          root-menu get add-popup-menu-item
-  "Firefox"  [ "firefox &" system ]        root-menu get add-popup-menu-item
-  "Workspaces"
-    [ workspace-menu get popup-window% ] root-menu get add-popup-menu-item ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: drag-gc
-
-: make-drag-gc ( -- GC )
-create-gc dup
-[ IncludeInferiors set-subwindow-mode
-  GXxor set-function
-  white-pixel get set-foreground ] with-gcontext ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VARS: event frame push position ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: event-type ( -- type ) event> XAnyEvent-type ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: drag-offset ( -- offset ) position> push> v- ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: draw-rubber-band ( <rect> -- )
-root get [ drag-gc get [ draw-rect ] with-gcontext ] with-win ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! drag-move-frame
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: draw-frame-outline ( -- )
-drag-offset frame> window-position% v+ frame> window-size% <rect>
-draw-rubber-band ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: drag-move-frame-loop ( -- )
-next-event >event
-{ { [ event-type MotionNotify = ]
-    [ draw-frame-outline
-      event> XMotionEvent-root-position >position
-      draw-frame-outline
-      drag-move-frame-loop ] }
-  { [ event-type ButtonRelease = ]
-    [ draw-frame-outline
-      drag-offset frame> window-position% v+   frame> move-window% ] }
-  { [ t ]
-    [ "[drag-move-frame-loop] Ignoring event type: " write
-      event-type event-type>name write terpri flush
-      drag-move-frame-loop ] } }
-cond ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: drag-move-frame ( event <wm-frame> -- )
-[ >frame >event
-  event> XButtonEvent-root-position >push
-  event> XButtonEvent-root-position >position
-  draw-frame-outline
-  drag-move-frame-loop
-  frame> raise-window% ]
-with-scope ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! drag-size-frame
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: draw-size-outline ( -- )
-frame> window-position% position> over v- <rect> draw-rubber-band ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: drag-size-frame-loop ( -- )
-next-event >event
-{ { [ event-type MotionNotify = ]
-    [ draw-size-outline
-      event> XMotionEvent-root-position >position
-      draw-size-outline
-      drag-size-frame-loop ] }
-  { [ event-type ButtonRelease = ]
-    [ draw-size-outline
-      position> frame> window-position% v- frame> resize-window%
-      frame> layout-frame ] }
-  { [ t ]
-    [ "[drag-size-frame-loop] ignoring event" print flush
-      drag-size-frame-loop ] } }
-cond ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: drag-size-frame ( event <wm-frame> -- )
-[ >frame >event
-  event> XButtonEvent-root-position >position
-  draw-size-outline
-  drag-size-frame-loop ]
-with-scope ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-GENERIC: move-request-x
-GENERIC: move-request-y
-GENERIC: move-request-position
-GENERIC: execute-move-request
-GENERIC: size-request-width
-GENERIC: size-request-height
-GENERIC: size-request-size
-GENERIC: execute-size-request
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! wm-root
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: wm-root ;
-
-: wm-root-mask ( -- mask )
-[ SubstructureRedirectMask
-  SubstructureNotifyMask
-  ButtonPressMask
-  ButtonReleaseMask
-  KeyPressMask
-  KeyReleaseMask ] bitmask ;
-
-: create-wm-root ( window-id -- <wm-root> )
-dpy get swap <window> <wm-root> tuck set-delegate dup add-to-window-table
-wm-root-mask over select-input% ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! M: wm-root handle-map-request-event
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: id>obj ( id -- obj )
-dup window-table get hash dup [ nip ] [ drop dpy get swap <window> ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-root handle-map-request-event ( event <wm-root> -- )
-"handle-map-request-event called on wm-root" print flush
-  drop XMapRequestEvent-window id>obj                          ! obj
-
-  { { [ dup wm-frame? ]
-      [ map-window% ] }
-
-    { [ dup valid-window?% not ]
-      [ "Not a valid window." print flush drop ] }
-
-    { [ dup window-override-redirect% 1 = ]
-      [ "Not reparenting: " print 
-        "new window has override_redirect attribute set." print flush
-        drop ] }
-
-    { [ dup window-id window-parent+ id>obj wm-frame? ]
-      [ "Window is already managed" print flush drop ] }
-
-    { [ t ] [ window-id manage-window ] } }
-
-  cond ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Words for working with an XConfigureRequestEvent
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: bit-test ( a b -- t-or-f ) bitand 0 = not ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: move-request-x? ( event -- ) XConfigureRequestEvent-value_mask CWX bit-test ;
-: move-request-y? ( event -- ) XConfigureRequestEvent-value_mask CWY bit-test ;
-
-: move-request? ( event -- ? ) dup move-request-x? swap move-request-y? or ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: size-request-width? ( event -- )
-  XConfigureRequestEvent-value_mask CWWidth bit-test ;
-
-: size-request-height? ( event -- )
-  XConfigureRequestEvent-value_mask CWHeight bit-test ;
-
-: size-request? ( event -- )
-  dup size-request-width? swap size-request-height? or ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! M: wm-root handle-configure-request-event
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-root move-request-x ( event wm-root -- x )
-  drop
-  dup move-request-x?
-  [ XConfigureRequestEvent-x ]
-  [ XConfigureRequestEvent-window [ window-x ] with-win ]
-  if ;
-
-M: wm-root move-request-y ( event wm-root -- y )
-  drop
-  dup move-request-y?
-  [ XConfigureRequestEvent-y ]
-  [ XConfigureRequestEvent-window [ window-y ] with-win ]
-  if ;
-
-M: wm-root move-request-position ( event wm-root -- { x y } )
-  2dup move-request-x -rot move-request-y 2array ;
-
-M: wm-root execute-move-request ( event wm-root -- )
-  dupd move-request-position swap XConfigureRequestEvent-window move-window+ ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-root size-request-width ( event wm-root -- width )
-  drop
-  dup size-request-width?
-  [ XConfigureRequestEvent-width ]
-  [ XConfigureRequestEvent-window [ window-width ] with-win ]
-  if ;
-
-M: wm-root size-request-height ( event wm-root -- height )
-  drop 
-  dup size-request-height?
-  [ XConfigureRequestEvent-height ]
-  [ XConfigureRequestEvent-window [ window-height ] with-win ]
-  if ;
-
-M: wm-root size-request-size ( event wm-root -- { width height } )
-  2dup size-request-width -rot size-request-height 2array ;
-
-M: wm-root execute-size-request ( event wm-root -- )
-  dupd size-request-size swap XConfigureRequestEvent-window resize-window+ ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-root handle-configure-request-event ( event wm-root -- )
-  over move-request? [ 2dup execute-move-request ] when
-  over size-request? [ 2dup execute-size-request ] when
-  drop drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! M: wm-root handle-button-press-event
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: XButtonEvent-position ( event -- { x y } )
-  dup XButtonEvent-x swap XButtonEvent-y 2array ;
-
-: XButtonEvent-root-position ( event -- { x y } )
-  dup XButtonEvent-x_root swap XButtonEvent-y_root 2array ;
-
-M: wm-root handle-button-press-event ( event wm-root -- )
-  drop                                         ! event
-
-  { { [ dup XButtonEvent-button Button1 = ]
-      [ root-menu get window-map-state% IsUnmapped =
-        [ XButtonEvent-root-position root-menu get move-window%
-          root-menu get raise-window%
-          root-menu get map-window% ]
-        [ root-menu get unmap-window% ]
-        if ] }
-
-    { [ dup XButtonEvent-button Button2 = ]
-      [ window-list get window-map-state% IsUnmapped =
-        [ XButtonEvent-root-position window-list get move-window%
-          window-list get raise-window%
-          window-list get refresh-window-list
-          window-list get map-window% ]
-        [ window-list get unmap-window% ]
-        if ] }
-
-    { [ t ] [ "Button has no function on root window." print flush drop ] } }
-
-  cond ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! M: wm-root handle-key-press-event
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: True 1 ;
-: False 0 ;
-
-: f1-keycode ( -- code ) 67 ;
-: f2-keycode ( -- code ) 68 ;
-: f3-keycode ( -- code ) 69 ;
-: f4-keycode ( -- code ) 70 ;
-
-: grab-keys ( -- )
-f1-keycode Mod1Mask False GrabModeAsync GrabModeAsync grab-key
-f2-keycode Mod1Mask False GrabModeAsync GrabModeAsync grab-key
-f3-keycode Mod1Mask False GrabModeAsync GrabModeAsync grab-key
-f4-keycode Mod1Mask False GrabModeAsync GrabModeAsync grab-key ;
-
-M: wm-root handle-key-press-event ( event wm-root -- )
-drop
-{ { [ dup XKeyEvent-keycode f1-keycode = ] [ workspace-1 get switch-to ] }
-  { [ dup XKeyEvent-keycode f2-keycode = ] [ workspace-2 get switch-to ] }
-  { [ dup XKeyEvent-keycode f3-keycode = ] [ workspace-3 get switch-to ] }
-  { [ dup XKeyEvent-keycode f4-keycode = ] [ workspace-4 get switch-to ] }
-  { [ t ] [ "wm-root ignoring key press" print drop ] } } cond ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: wm-child ;
-
-: create-wm-child ( window-id -- <wm-child> )
-dpy get swap <window> <wm-child> tuck set-delegate dup add-to-window-table ;
-
-M: wm-child handle-property-event ( event <wm-child> -- )
-  "A <wm-child> received a property event" print flush
-  nip
-  window-parent% window-table get hash dup [ update-title ] [ drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: wm-frame child ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: wm-frame-mask ( -- mask )
-[ SubstructureRedirectMask
-  SubstructureNotifyMask
-  ExposureMask
-  ButtonPressMask
-  ButtonReleaseMask
-  PointerMotionMask
-  EnterWindowMask ] bitmask ;
-
-: create-wm-frame ( <wm-child> -- <wm-frame> )
-<wm-frame> create-window-object over set-delegate dup add-to-window-table
-wm-frame-mask over select-input% ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: update-title ( <wm-frame> -- )
-dup clear-window%
-{ 5 1 } swap dup wm-frame-child fetch-name% swap draw-string-top-left% ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VARS: child frame button ;
-
-: manage-window ( window -- )
-flush-dpy grab-server flush-dpy
-create-wm-child dup create-wm-frame
-[ child frame ]
-[ "cornflowerblue" lookup-color frame> set-window-background%
-  child> add-to-save-set%
-  child> window-position% frame> move-window%
-  0 child> set-window-border-width%
-  frame> child> reparent-window%
-  child> window-size% { 10 20 } v+ frame> resize-window%
-  { 5 15 } child> move-window%
-  "" frame> [ delete-frame ] curry create-button
-  [ button ]
-  [ frame> button> reparent-window%
-    { 9 9 } button> resize-window%
-    frame> window-width% 9 - 5 - 3 2array button> move-window%
-    NorthEastGravity button> set-window-gravity%
-    black-pixel get button> set-window-background% ]
-  let
-  PropertyChangeMask child> select-input%
-  frame> map-subwindows%
-  frame> map-window%
-  frame> update-title
-  flush-dpy 0 sync-dpy ungrab-server flush-dpy ]
-let ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: destroy-window-event-match? ( event <wm-frame> -- ? )
-window-id swap XDestroyWindowEvent-window = ;
-
-M: wm-frame handle-destroy-window-event ( event <wm-frame> -- )
-2dup destroy-window-event-match? [ destroy-window% drop ] [ 2drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: map-request-event-match? ( event <wm-frame> -- ? )
-  window-id swap XMapRequestEvent-window = ;
-
-M: wm-frame handle-map-request-event ( event <wm-frame> -- )
-  2dup map-request-event-match?                                ! event frame ?
-  [ dup wm-frame-child map-window% map-window% drop ] [ drop drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: map-event-match? ( event <wm-frame> -- ? )
-window-id swap XMapEvent-window = ;
-
-M: wm-frame handle-map-event ( event <wm-frame> -- )
-  2dup map-event-match?
-  [ dup map-window% raise-window% drop ] [ drop drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! M: wm-frame handle-configure-request-event ( event frame )
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-frame move-request-x ( event frame -- x )
-  over move-request-x?
-  [ drop XConfigureRequestEvent-x ]
-  [ nip window-x% ]
-  if ;
-
-M: wm-frame move-request-y ( event frame -- y )
-  over move-request-y?
-  [ drop XConfigureRequestEvent-y ]
-  [ nip window-y% ]
-  if ;
-
-M: wm-frame move-request-position ( event frame -- { x y } )
-  2dup move-request-x -rot move-request-y 2array ;
-
-M: wm-frame execute-move-request ( event frame -- )
-  dup -rot move-request-position swap move-window% ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-frame size-request-width ( event frame -- width )
-  over size-request-width?
-  [ drop XConfigureRequestEvent-width ]
-  [ nip wm-frame-child window-width% ]
-  if ;
-
-M: wm-frame size-request-height ( event frame -- height )
-  over size-request-height?
-  [ drop XConfigureRequestEvent-height ]
-  [ nip wm-frame-child window-height% ]
-  if ;
-
-M: wm-frame size-request-size ( event frame -- size )
-  2dup size-request-width -rot size-request-height 2array ;
-
-: execute-size-request/child ( event frame -- )
-  dup wm-frame-child -rot size-request-size swap resize-window% ;
-
-: execute-size-request/frame ( event frame -- )
-  dup -rot size-request-size { 10 20 } v+ swap resize-window% ;
-
-M: wm-frame execute-size-request ( event frame -- )
-  2dup execute-size-request/child execute-size-request/frame ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-frame handle-configure-request-event ( event frame -- )
-  over move-request? [ 2dup execute-move-request ] when
-  over size-request? [ 2dup execute-size-request ] when
-  drop drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: unmap-event-match? ( event frame -- ? )
-  wm-frame-child window-id swap XUnmapEvent-window = ;
-
-M: wm-frame handle-unmap-event ( event frame -- )
-  2dup unmap-event-match? [ unmap-window% drop ] [ drop drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-frame handle-button-press-event ( event frame -- )
-  over XButtonEvent-button                             ! event frame button
-  { { [ dup Button1 = ] [ drop drag-move-frame ] }
-    { [ dup Button2 = ] [ drop drag-size-frame ] }
-    { [ dup Button3 = ] [ drop nip unmap-window% ] }
-    { [ t ] [ drop drop drop ] } }
-  cond ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-frame handle-enter-window-event ( event frame -- )
-  nip dup wm-frame-child valid-window?%
-  [ wm-frame-child >r RevertToPointerRoot CurrentTime r> set-input-focus% ]
-  [ destroy-window% ]
-  if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-frame handle-property-event ( event frame -- )
-"Inside handle-property-event" print flush 2drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: wm-frame handle-expose-event ( event frame -- )
-nip dup clear-window% update-title ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: frame-position-child ( frame -- ) wm-frame-child { 5 15 } swap move-window% ;
-
-: frame-fit-child ( frame -- )
-dup window-size% { 10 20 } v- swap wm-frame-child resize-window% ;
-
-: layout-frame ( frame -- ) dup frame-position-child frame-fit-child ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: WM_PROTOCOLS
-SYMBOL: WM_DELETE_WINDOW
-
-: delete-frame ( frame -- ) wm-frame-child window-id
-[ WM_PROTOCOLS get WM_DELETE_WINDOW get send-client-message ] with-win ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Workspaces
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-GENERIC: switch-to
-
-SYMBOL: current-workspace
-
-TUPLE: workspace windows ;
-
-: create-workspace [ ] <workspace> ;
-
-M: workspace switch-to ( workspace -- )
-  mapped-windows dup current-workspace get set-workspace-windows
-  [ unmap-window+ ] each
-  dup workspace-windows [ map-window+ ] each
-  current-workspace set-global ;
-
-SYMBOL: workspace-1
-SYMBOL: workspace-2
-SYMBOL: workspace-3
-SYMBOL: workspace-4
-
-create-workspace workspace-1 set-global
-create-workspace workspace-2 set-global
-create-workspace workspace-3 set-global
-create-workspace workspace-4 set-global
-
-workspace-1 get current-workspace set-global
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: workspace-menu
-
-: setup-workspace-menu ( -- )
-  create-menu workspace-menu set
-  "black" lookup-color workspace-menu get set-window-background%
-  "Workspace 1"
-    [ workspace-1 get switch-to ] workspace-menu get add-popup-menu-item
-  "Workspace 2"
-    [ workspace-2 get switch-to ] workspace-menu get add-popup-menu-item
-  "Workspace 3"
-    [ workspace-3 get switch-to ] workspace-menu get add-popup-menu-item
-  "Workspace 4"
-    [ workspace-4 get switch-to ] workspace-menu get add-popup-menu-item ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: invalid-frame? ( <wm-frame> -- ? )
-wm-frame-child window-id valid-window?+ not ;
-
-: remove-invalid-frames ( -- )
-window-table get hash-values [ wm-frame? ] subset [ invalid-frame? ] subset
-[ window-id window-table get remove-hash ] each ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! window-list
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: window-list
-
-: setup-window-list ( -- )
-  create-menu window-list set-global
-  "black" lookup-color window-list get set-window-background%
-  300 window-list get set-menu-item-width ;
-
-: not-transient? ( frame -- ? ) wm-frame-child get-transient-for-hint% not ;
-
-: add-window-to-list ( window-list frame -- window-list )
-  dup                          ! window-list frame frame
-  wm-frame-child               ! window-list frame child
-  fetch-name%                  ! window-list frame name-or-f
-  dup                          ! window-list frame name-or-f name-or-f
-  [ ] [ drop "*untitled*" ] if ! window-list frame name
-  swap                         ! window-list name frame
-  [ map-window% ]              ! window-list name frame [ map-window% ]
-  curry                                ! window-list name action
-  pick                         ! window-list name action window-list
-  add-popup-menu-item ;
-
-: refresh-window-list ( window-list -- )
-  dup window-children% [ destroy-window+ ] each
-  clean-window-table
-  remove-invalid-frames
-  window-table get hash-values [ wm-frame? ] subset
-  [ not-transient? ] subset
-  [ add-window-to-list ] each
-  drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: window-is-mapped? ( window -- ? ) window-map-state+ IsUnmapped = not ;
-
-: mapped-windows ( -- [ a b c d ... ] )
-  root get window-children+ [ window-is-mapped? ] subset ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: manage-existing-windows ( -- ) mapped-windows [ manage-window ] each ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: start-factory ( dpy-string -- )
-  initialize-x
-  [ "X11 : error-handler called" print flush ] set-error-handler
-  root get [ make-drag-gc ] with-win drag-gc set
-  root get [ black-pixel get set-window-background clear-window ] with-win
-  root get create-wm-root
-  root get [ grab-keys ] with-win
-  "WM_PROTOCOLS" False intern-atom WM_PROTOCOLS set
-  "WM_DELETE_WINDOW" False intern-atom WM_DELETE_WINDOW set
-  "cornflowerblue" lookup-color menu-enter-color set
-  "white" lookup-color menu-leave-color set
-  setup-root-menu
-  setup-window-list
-  setup-workspace-menu
-  manage-existing-windows
-  [ concurrent-event-loop ] spawn ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-IN: shells USE: listener : factory f start-factory listener ;
\ No newline at end of file
diff --git a/apps/factory/load.factor b/apps/factory/load.factor
deleted file mode 100644 (file)
index 977a1c6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-REQUIRES: libs/process libs/concurrency libs/x11 libs/vars ;
-
-PROVIDE: apps/factory { +files+ {  "factory.factor" } } ;
-
-USE: factory
-
-MAIN: apps/factory f start-factory ;
diff --git a/apps/furnace-fjsc/furnace-fjsc.factor b/apps/furnace-fjsc/furnace-fjsc.factor
deleted file mode 100644 (file)
index 1105682..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-! Copyright (C) 2006 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: furnace:fjsc
-USING: kernel html furnace xml io httpd sequences 
-       namespaces file-responder parser-combinators lazy-lists
-       fjsc  ;
-
-: script ( path -- )
-  #! given a path to a javascript file, output the 
-  #! script tag that references it.
-  <script "text/javascript" =type =src script> </script> ;
-
-: fjsc-page ( scripts title quot -- )
-  #! Display a web page importing the given script
-  #! tags and using the title. The body of the page
-  #! is generated by calling the quotation.
-  -rot xhtml-preamble
-  chars>entities
-  <html " xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"" write-html html>
-    <head>
-      <title> write </title>
-      [ script ] each
-    </head>
-    <body>
-     call
-    </body>
-  </html> ;
-  
-: fjsc-render ( template title -- )
-  #! Render the fjsc page importing the required
-  #! scripts.
-  serving-html {
-    "/responder/fjsc-resources/jquery.js"
-    "/responder/fjsc-resources/bootstrap.js"
-  } swap [
-    [
-      f swap render-template
-    ] fjsc-page
-  ] with-html-stream ;
-
-: compile ( code -- )
-  #! Compile the facor code as a string, outputting the http
-  #! response containing the javascript.
-  serving-text
-  'expression' parse car parse-result-parsed fjsc-compile 
-   write flush ;
-
-! The 'compile' action results in an URL that looks like
-! 'responder/fjsc/compile'. It takes one query or post 
-! parameter called 'code'. It calls the 'compile' word
-! passing the parameter to it on the stack.
-\ compile { 
-  { "code" v-required } 
-} define-action
-
-: repl ( -- )
-  #! The main 'repl' page.
-  f "repl" "Factor to Javascript REPL" fjsc-render ;
-
-! An action called 'repl' 
-\ repl { } define-action
-
-! Create the web app, providing access 
-! under '/responder/fjsc' which calls the
-! 'repl' action.
-"fjsc" "repl" "apps/furnace-fjsc" web-app
-
-! An URL to the javascript resource files used by
-! the 'fjsc' responder.
-"fjsc-resources" [
- [
-   "libs/fjsc/resources/" resource-path "doc-root" set
-   file-responder
- ] with-scope
-] add-simple-responder
diff --git a/apps/furnace-fjsc/load.factor b/apps/furnace-fjsc/load.factor
deleted file mode 100644 (file)
index f7b8a94..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-! Copyright (C) 2006 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-REQUIRES: libs/furnace libs/fjsc ;
-
-PROVIDE: apps/furnace-fjsc 
-{ 
-  +files+ { 
-  "furnace-fjsc.factor"
-  } 
-} {
-  +tests+ { 
-  }
-} { 
-  +help+ 
-  { 
-  } 
-} ;
diff --git a/apps/furnace-fjsc/repl.fhtml b/apps/furnace-fjsc/repl.fhtml
deleted file mode 100644 (file)
index ac4ca9c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<table border="0">
-<tr><td valign="top">
-<p><b>Enter Factor Code Here</b></p>
-<form id="toeval" onsubmit="factor.server_eval($('#code').get(0).value);return false;" method="post">
-  <textarea name="code" id="code" cols="64" rows="5">
-  </textarea>
-  <input type="submit" value="Compile"/>
-</form>
-<h3>Compiled Code</h3>
-<textarea id="compiled" cols="64" rows="3">
-</textarea>
-<p><b>Stack</b></p>
-<div id="stack">
-</div>
-<p><b>Playground</b></p>
-<div id="playground">
-</div>
-</td>
-<td valign="top">
-<p>More information on the Factor to Javascript compiler can be found at these blog posts:
-<ul>
-<li><a href="http://www.bluishcoder.co.nz/2006/12/compiling-factor-to-javascript.html">Factor to Javascript Compiler</a></li>
-<li><a href="http://www.bluishcoder.co.nz/2006/12/factor-to-javascript-compiler-updates.html">Factor to Javascript Compiler Updates</a></li>
-<li><a href="http://www.bluishcoder.co.nz/2006/12/continuations-added-to-fjsc.html">Continuations added to fjsc</a></li>
-<li><a href="http://www.bluishcoder.co.nz/2006/12/cross-domain-json-with-fjsc.html">Cross Domain JSON with fjsc</a></li>
-</ul>
-</p>
-<p>Some useful words:
-<dl>
-<dt>vocabs ( -- seq )</dt>
-<dd>Return a sequence of available vocabularies</dd>
-<dt>words ( string -- seq )</dt>
-<dd>Return a sequence of words in the given vocabulary</dd>
-<dt>all-words ( -- seq )</dt>
-<dd>Return a sequence of all words</dd>
-</dl>
-</p>
-<p>The contents of <a href="/responder/fjsc-resources/bootstrap.factor">bootstrap.factor</a> have been loaded on startup.</p>
-</td>
-</tr>
-</table>
diff --git a/apps/furnace-pastebin/annotate-paste.fhtml b/apps/furnace-pastebin/annotate-paste.fhtml
deleted file mode 100644 (file)
index 24f0d4e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<% USING: namespaces math io ; %>
-
-<h1>Annotate</h1>
-
-<form method="POST" action="/responder/pastebin/annotate-paste">
-
-<table>
-
-<input type="hidden" name="n" value="<% "n" get number>string write %>" />
-
-<tr>
-<th>Summary:</th>
-<td><input type="TEXT" name="summary" value="" /></td>
-</tr>
-
-<tr>
-<th>Your name:</th>
-<td><input type="TEXT" name="author" value="" /></td>
-</tr>
-
-<tr>
-<th valign="top">Contents:</th>
-<td><textarea rows="24" cols="60" name="contents"></textarea></td>
-</tr>
-</table>
-
-<input type="SUBMIT" value="Annotate" />
-</form>
diff --git a/apps/furnace-pastebin/annotation.fhtml b/apps/furnace-pastebin/annotation.fhtml
deleted file mode 100644 (file)
index ed1bdac..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<% USING: namespaces io ; %>
-
-<h2>Annotation: <% "summary" get write %></h2>
-
-<table>
-<tr><th>Annotation by:</th><td><% "author" get write %></td></tr>
-<tr><th>Channel:</th><td><% "channel" get write %></td></tr>
-<tr><th>Created:</th><td><% "date" get write %></td></tr>
-</table>
-
-<pre><% "contents" get write %></pre>
diff --git a/apps/furnace-pastebin/load.factor b/apps/furnace-pastebin/load.factor
deleted file mode 100644 (file)
index e112f63..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-REQUIRES: libs/furnace ;
-
-PROVIDE: apps/furnace-pastebin
-{ +files+ {  "pastebin.factor" } } ;
diff --git a/apps/furnace-pastebin/new-paste.fhtml b/apps/furnace-pastebin/new-paste.fhtml
deleted file mode 100644 (file)
index 36f0397..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<form method="POST" action="/responder/pastebin/submit-paste">
-
-<table>
-
-<tr>
-<th>Summary:</th>
-<td><input type="TEXT" name="summary" value="" /></td>
-</tr>
-
-<tr>
-<th>Your name:</th>
-<td><input type="TEXT" name="author" value="" /></td>
-</tr>
-
-<tr>
-<th>Channel:</th>
-<td><input type="TEXT" name="channel" value="" /></td>
-</tr>
-
-<tr>
-<th valign="top">Contents:</th>
-<td><textarea rows="24" cols="60" name="contents"></textarea></td>
-</tr>
-</table>
-
-<input type="SUBMIT" value="Submit paste" />
-</form>
diff --git a/apps/furnace-pastebin/paste-list.fhtml b/apps/furnace-pastebin/paste-list.fhtml
deleted file mode 100644 (file)
index 60465c6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<% USING: namespaces furnace sequences ; %>
-
-<table>
-<tr><th>Summary:</th><th>Paste by:</th></tr>
-<% "pastes" get [ "paste-summary" render-template ] each %></table>
-
-<% "new-paste-quot" get "New paste" render-link %>
diff --git a/apps/furnace-pastebin/paste-summary.fhtml b/apps/furnace-pastebin/paste-summary.fhtml
deleted file mode 100644 (file)
index 8079bba..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<% USING: namespaces io kernel math furnace ; %>
-
-<tr>
-<td><% "summary" get write %></td>
-<td><% "author" get write %></td>
-<td><% "n" get number>string "show-paste-quot" get curry "Show" render-link %></td>
-</tr>
diff --git a/apps/furnace-pastebin/pastebin.factor b/apps/furnace-pastebin/pastebin.factor
deleted file mode 100644 (file)
index 4cbdeb8..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-IN: furnace:pastebin
-USING: calendar kernel namespaces sequences furnace hashtables
-math ;
-
-TUPLE: paste n summary author channel contents date annotations ;
-
-TUPLE: annotation summary author contents ;
-
-C: paste ( summary author channel contents -- paste )
-    V{ } clone over set-paste-annotations
-    [ set-paste-contents ] keep
-    [ set-paste-author ] keep
-    [ set-paste-channel ] keep
-    [ set-paste-summary ] keep ;
-
-TUPLE: pastebin pastes ;
-
-C: pastebin ( -- pastebin )
-    V{ } clone over set-pastebin-pastes ;
-
-: add-paste ( paste pastebin -- )
-    now timestamp>http-string pick set-paste-date
-    dup pastebin-pastes length pick set-paste-n
-    pastebin-pastes push ;
-
-<pastebin> pastebin set-global
-
-: get-paste ( n -- paste )
-    pastebin get pastebin-pastes nth ;
-
-: show-paste ( n -- )
-    get-paste "show-paste" "Paste" render-page ;
-
-\ show-paste { { "n" v-number } } define-action
-
-: new-paste ( -- )
-    f "new-paste" "New paste" render-page ;
-
-\ new-paste { } define-action
-
-: submit-paste ( summary author channel contents -- )
-    <paste> pastebin get-global add-paste ;
-
-\ submit-paste {
-    { "summary" v-required }
-    { "author" v-required }
-    { "channel" "#concatenative" v-default }
-    { "contents" v-required }
-} define-action
-
-: paste-list ( -- )
-    [
-        [ show-paste ] "show-paste-quot" set
-        [ new-paste ] "new-paste-quot" set
-
-        pastebin get "paste-list" "Pastebin" render-page
-    ] with-scope ;
-
-\ paste-list { } define-action
-
-\ submit-paste [ paste-list ] define-redirect
-
-: annotate-paste ( paste# summary author contents -- )
-    <annotation> swap get-paste paste-annotations push ;
-
-\ annotate-paste {
-    { "n" v-required v-number }
-    { "summary" v-required }
-    { "author" v-required }
-    { "contents" v-required }
-} define-action
-
-\ annotate-paste [ "n" show-paste ] define-redirect
-
-"pastebin" "paste-list" "apps/furnace-pastebin" web-app
diff --git a/apps/furnace-pastebin/show-paste.fhtml b/apps/furnace-pastebin/show-paste.fhtml
deleted file mode 100644 (file)
index b3b4e99..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<% USING: namespaces io furnace sequences ; %>
-
-<h1>Paste: <% "summary" get write %></h1>
-
-<table>
-<tr><th>Paste by:</th><td><% "author" get write %></td></tr>
-<tr><th>Channel:</th><td><% "channel" get write %></td></tr>
-<tr><th>Created:</th><td><% "date" get write %></td></tr>
-</table>
-
-<pre><% "contents" get write %></pre>
-
-<% "annotations" get [ "annotation" render-template ] each %>
-
-<% model get "annotate-paste" render-template %>
diff --git a/apps/hexdump/hexdump.factor b/apps/hexdump/hexdump.factor
deleted file mode 100644 (file)
index 15fe941..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-USING: io kernel math namespaces prettyprint sequences strings ;
-IN: hexdump-internals
-       
-: header. ( len -- )
-    "Length: " write dup unparse write ", " write >hex write "h" write terpri ;
-
-: offset. ( lineno -- ) 16 * >hex 8 CHAR: 0 pad-left write "h: " write ;
-: h-pad. ( digit -- ) >hex 2 CHAR: 0 pad-left write ;
-: line. ( str n -- )
-    offset. [ [ h-pad. " " write ] each ] keep
-    16 over length - [ "   " write ] times
-    [ dup printable? [ drop CHAR: . ] unless ch>string write ] each
-    terpri ;
-
-IN: hexdump
-: hexdump ( str -- str )
-    #! Write hexdump to a string
-    [
-        dup length header.
-        16 group dup length [ line. ] 2each
-    ] string-out ;
-
-: hexdump. ( str -- )
-    #! Print hexdump
-    hexdump write ;
-
diff --git a/apps/hexdump/load.factor b/apps/hexdump/load.factor
deleted file mode 100644 (file)
index 548ac52..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-PROVIDE: apps/hexdump
-{ +files+ {  "hexdump.factor" } }
-{ +tests+ {  "test/hexdump.factor" } } ;
diff --git a/apps/hexdump/test/hexdump.factor b/apps/hexdump/test/hexdump.factor
deleted file mode 100644 (file)
index a375120..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-IN: temporary
-USING: hexdump kernel sequences test ;
-
-[ t ] [ "" hexdump "Length: 0, 0h\n" = ] unit-test
-[ t ] [ "abcdefghijklmnopqrstuvwxyz" hexdump "Length: 26, 1ah\n00000000h: 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop\n00000010h: 71 72 73 74 75 76 77 78 79 7a                   qrstuvwxyz\n" = ] unit-test
-
-[ t ] [ 256 [ ] map hexdump "Length: 256, 100h\n00000000h: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................\n00000010h: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................\n00000020h: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f  !\"#$%&'()*+,-./\n00000030h: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 0123456789:;<=>?\n00000040h: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO\n00000050h: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVWXYZ[\\]^_\n00000060h: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f `abcdefghijklmno\n00000070h: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvwxyz{|}~.\n00000080h: 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f ................\n00000090h: 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f ................\n000000a0h: a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af ................\n000000b0h: b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf ................\n000000c0h: c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf ................\n000000d0h: d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df ................\n000000e0h: e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef ................\n000000f0h: f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff ................\n" = ] unit-test
-
diff --git a/apps/lindenmayer/camera-slate.factor b/apps/lindenmayer/camera-slate.factor
deleted file mode 100644 (file)
index 294a54f..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-
-USING: kernel namespaces generic math gadgets vars slate turtle turtle-camera ;
-
-IN: camera-slate
-
-TUPLE: camera-slate ;
-
-C: camera-slate ( -- slate ) <slate> over set-delegate ;
-
-VAR: camera
-
-camera-slate H{
-  { T{ key-down f f "LEFT" }
-    [ slate-ns [ [ 5 turn-left ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f f "RIGHT" }
-    [ slate-ns [ [ 5 turn-right ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f f "UP" }
-    [ slate-ns [ [ 5 pitch-down ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f f "DOWN" }
-    [ slate-ns [ [ 5 pitch-up ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f f "LEFT" }
-    [ slate-ns [ [ 5 turn-left ] camera> with-turtle .slate ] bind ] }
-
-  { T{ key-down f f "a" }
-    [ slate-ns [ [ 1 step-turtle ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f f "z" }
-    [ slate-ns [ [ -1 step-turtle ] camera> with-turtle .slate ] bind ] }
-
-  { T{ key-down f f "q" }
-    [ slate-ns [ [ 5 roll-left ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f f "w" }
-    [ slate-ns [ [ 5 roll-right ] camera> with-turtle .slate ] bind ] }
-
-  { T{ key-down f { A+ } "LEFT" }
-    [ slate-ns [ [ 1 strafe-left ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f { A+ } "RIGHT" }
-    [ slate-ns [ [ 1 strafe-right ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f { A+ } "UP" }
-    [ slate-ns [ [ 1 strafe-up ] camera> with-turtle .slate ] bind ] }
-  { T{ key-down f { A+ } "DOWN" }
-    [ slate-ns [ [ 1 strafe-down ] camera> with-turtle .slate ] bind ] }
-
-  { T{ key-down f f "1" }
-    [ slate-ns
-      [
-        [ position> norm reset-turtle 90 turn-left step-turtle 180 turn-left ]
-        camera> with-turtle .slate
-      ] bind
-    ] }
-  { T{ key-down f f "2" }
-    [ slate-ns
-      [
-        [ position> norm reset-turtle 90 pitch-up step-turtle 180 pitch-down ]
-        camera> with-turtle .slate
-      ] bind
-    ] }
-  { T{ key-down f f "3" }
-    [ slate-ns
-      [
-        [ position> norm reset-turtle step-turtle 180 turn-left ]
-        camera> with-turtle .slate
-      ] bind
-    ] }
-
-{ T{ key-down f f "4" }
-    [ slate-ns
-      [
-        [ position> norm
-          reset-turtle 45 turn-left 45 pitch-up step-turtle 180 turn-left ]
-        camera> with-turtle .slate
-      ] bind
-    ] }
-
-} set-gestures
\ No newline at end of file
diff --git a/apps/lindenmayer/camera.factor b/apps/lindenmayer/camera.factor
deleted file mode 100644 (file)
index c013b10..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-USING: kernel math sequences opengl turtle ;
-IN: turtle-camera
-
-: camera-eye ( -- array ) position> ;
-
-: camera-focus ( -- array )
-push-turtle
-1 step-turtle position>
-pop-turtle ;
-
-: camera-up ( -- array )
-push-turtle
-90 pitch-up position> 1 step-turtle position> swap v-
-pop-turtle ;
-
-: do-look-at ( -- )
-camera-eye first3 camera-focus first3 camera-up first3 gluLookAt ;
diff --git a/apps/lindenmayer/lindenmayer.factor b/apps/lindenmayer/lindenmayer.factor
deleted file mode 100644 (file)
index 3c59412..0000000
+++ /dev/null
@@ -1,582 +0,0 @@
-! Eduardo Cavazos - wayo.cavazos@gmail.com
-
-REQUIRES: libs/math
-          libs/vars
-          libs/slate
-          apps/lindenmayer/opengl
-          apps/lindenmayer/turtle
-          apps/lindenmayer/camera
-          apps/lindenmayer/camera-slate ;
-
-USING: kernel alien namespaces arrays vectors math opengl sequences threads
-       hashtables strings gadgets
-       math-contrib vars slate turtle turtle-camera camera-slate
-       opengl-contrib ;
-
-IN: lindenmayer 
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: record-vertex ( -- ) position> gl-vertex ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-DEFER: polygon-vertex
-
-: draw-forward ( length -- )
-GL_LINES glBegin record-vertex step-turtle record-vertex glEnd ;
-
-: move-forward ( length -- ) step-turtle polygon-vertex ;
-
-: sneak-forward ( length -- ) step-turtle ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! (v0 - v1) x (v1 - v2)
-
-: polygon-normal ( {_v0_v1_v2_} -- normal ) first3 dupd v- -rot v- swap cross ;
-
-: (polygon) ( vertices -- )
-GL_POLYGON glBegin dup polygon-normal gl-normal [ gl-vertex ] each glEnd ;
-
-: polygon ( vertices -- ) dup length 3 >= [ (polygon) ] [ drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! Maybe use an array instead of a vector
-
-VAR: vertices
-
-: start-polygon ( -- ) 0 <vector> >vertices ;
-
-: finish-polygon ( -- ) vertices> polygon ;
-
-: polygon-vertex ( -- ) position> vertices> push ;
-
-: reset-vertices start-polygon ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Lindenmayer string rewriting
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! Maybe use an array instead of a quot in the work of segment
-
-VAR: rules
-
-: segment ( str -- seq )
-{ { [ dup "" = ] [ drop [ ] ] }
-  { [ dup length 1 = ] [ unit ] }
-  { [ 1 over nth CHAR: ( = ]
-    [ CHAR: ) over index 1 +           ! str i
-      2dup head                                ! str i head
-      -rot tail                                ! head tail
-      segment swap add* ] }
-  { [ t ] [ dup 1 head swap 1 tail segment swap add* ] } }
-cond ;
-
-: lookup ( str -- str ) dup 1 head rules get hash dup [ nip ] [ drop ] if ;
-
-: rewrite ( str -- str ) segment [ lookup ] map concat ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Lindenmayer string interpretation
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: command-table
-
-: segment-command ( seg -- command ) 1 head ;
-
-: segment-parameter ( seg -- parameter )
-dup length 1 - 2 swap rot subseq string>number ;
-
-: segment-parts ( seg -- param command )
-dup segment-parameter swap segment-command ;
-
-: exec-command ( str -- ) command-table get hash dup [ call ] [ drop ] if ;
-
-: exec-command-with-param ( param command -- )
-command-table get hash dup [ peek unit call ] [ 2drop ] if ;
-
-: (interpret) ( seg -- )
-dup length 1 =
-[ exec-command ] [ segment-parts exec-command-with-param ] if ;
-
-: interpret ( str -- ) segment [ (interpret) ] each ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Lparser dialect
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: angle
-VAR: len
-VAR: thickness
-VAR: color-index
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-DEFER: set-thickness
-DEFER: set-color-index
-
-TUPLE: state position orientation angle len thickness color-index ;
-
-VAR: states
-
-: reset-state-stack ( -- ) V{ } clone >states ;
-
-: save-state ( -- )
-position> orientation> angle> len> thickness> color-index> <state>
-states> push ;
-
-: restore-state ( -- )
-states> pop
-dup state-position    >position
-dup state-orientation >orientation
-dup state-len         >len
-dup state-angle       >angle
-dup state-color-index set-color-index
-dup state-thickness   set-thickness
-drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: scale-len ( m -- ) len> * >len ;
-
-: scale-angle ( m -- ) angle> * >angle ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: color-table
-
-: init-color-table ( -- )
-{ { 0    0    0 }    ! black
-  { 0.5  0.5  0.5 }  ! grey
-  { 1    0    0 }    ! red
-  { 1    1    0 }    ! yellow
-  { 0    1    0 }    ! green
-  { 0.25 0.88 0.82 } ! turquoise
-  { 0    0    1 }    ! blue
-  { 0.63 0.13 0.94 } ! purple
-  { 0.00 0.50 0.00 } ! dark green
-  { 0.00 0.82 0.82 } ! dark turquoise
-  { 0.00 0.00 0.50 } ! dark blue
-  { 0.58 0.00 0.82 } ! dark purple
-  { 0.50 0.00 0.00 } ! dark red
-  { 0.25 0.25 0.25 } ! dark grey
-  { 0.75 0.75 0.75 } ! medium grey
-  { 1    1    1 }    ! white
-} [ 1 set-color-alpha ] map color-table set ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: material-color ( color -- )
-GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE rot gl-material-fv ;
-
-: set-color-index ( i -- )
-dup >color-index color-table> nth dup gl-color material-color ;
-
-: inc-color-index ( -- ) color-index> 1 + set-color-index ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: set-thickness ( i -- ) dup >thickness glLineWidth ;
-
-: scale-thickness ( m -- ) thickness> * 0.5 max set-thickness ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: default-values
-VAR: model-values
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: lparser-dialect ( -- )
-
-[ 1 >len   45 >angle   1 >thickness   2 >color-index ] >default-values
-
-H{ { "+" [ angle get     turn-left ] }
-   { "-" [ angle get     turn-right ] }
-   { "&" [ angle get     pitch-down ] }
-   { "^" [ angle get     pitch-up ] }
-   { "<" [ angle get     roll-left ] }
-   { ">" [ angle get     roll-right ] }
-
-   { "|" [ 180.0         rotate-y ] }
-   { "%" [ 180.0         rotate-z ] }
-   { "$" [ roll-until-horizontal ]  }
-
-   { "F" [ len get     draw-forward ] }
-   { "Z" [ len get 2 / draw-forward ] }
-   { "f" [ len get     move-forward ] }
-   { "z" [ len get 2 / move-forward ] }
-   { "g" [ len get     sneak-forward ] }
-   { "." [ polygon-vertex ] }
-
-   { "[" [ save-state ] }
-   { "]" [ restore-state ] }
-   { "{" [ start-polygon ] }
-   { "}" [ finish-polygon ] }
-
-   { "/" [ 1.1 scale-len ] } ! double quote command in lparser
-   { "'" [ 0.9 scale-len ] }
-   { ";" [ 1.1 scale-angle ] }
-   { ":" [ 0.9 scale-angle ] }
-   { "?" [ 1.4 scale-thickness ] }
-   { "!" [ 0.7 scale-thickness ] }
-
-   { "c" [ color-index> 1 + color-table get length mod set-color-index ] }
-
-} command-table set ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: axiom
-VAR: result
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: iterate ( -- ) result> rewrite >result ;
-
-: iterations ( n -- ) [ iterate ] times ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: model
-
-: init-model ( -- ) 1 glGenLists >model ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: display ( -- )
-
-black gl-clear-color
-
-GL_FLAT glShadeModel
-
-GL_PROJECTION glMatrixMode
-glLoadIdentity
--1 1 -1 1 1.5 200 glFrustum
-
-GL_MODELVIEW glMatrixMode
-
-glLoadIdentity
-
-[ do-look-at ] camera> with-turtle
-
-GL_COLOR_BUFFER_BIT glClear
-
-GL_FRONT_AND_BACK GL_LINE glPolygonMode
-
-white gl-color
-GL_LINES glBegin { 0 0 0 } gl-vertex { 0 0 1 } gl-vertex glEnd
-
-color-index> set-color-index
-
-model> glCallList ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-turtle ( -- ) <turtle> >turtle ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-camera ( -- ) <turtle> >camera ;
-
-: reset-camera ( -- ) [
-reset-turtle
-45 turn-left
-45 pitch-up
-5 step-turtle
-180 turn-left
-] camera> with-turtle ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-slate ( -- )
-<camera-slate> >slate
-namespace slate> set-slate-ns
-slate> "L-system" open-titled-window
-[ display ] >action ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init ( -- )
-init-turtle
-init-turtle-stack
-init-camera reset-camera
-init-model
-
-2 >color-index
-init-color-table
-
-init-slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: result>model ( -- )
-[ model> GL_COMPILE glNewList result> interpret glEndList ] >action .slate ;
-
-: build-model ( -- )
-reset-state-stack
-reset-vertices
-reset-turtle
-default-values> call
-model-values> call
-result>model
-3000 sleep
-[ display ] >action .slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Examples
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: koch ( -- ) lparser-dialect   [ 90 >angle ] >model-values
-
-H{ { "K" "[[a|b] '(0.41)f'(2.439) |<(60) [a|b]]" }
-   { "k" "[ c'(0.5) K]" }
-   { "a" "[d <(120) d <(120) d ]" }
-   { "b" "e" }
-   { "e" "[^ '(.2887)f'(3.4758) &(180)      +z{.-(120)f-(120)f}]" }
-   { "d" "[^ '(.2887)f'(3.4758) &(109.5111) +zk{.-(120)f-(120)f}]" }
-} >rules
-
-"K" >result ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: spiral-0 ( -- ) lparser-dialect   [ 10 >angle 5 >thickness ] >model-values
-
-"[P]|[P]" >result
-
-H{ { "P" "[A]>>>>>>>>>[cB]>>>>>>>>>[ccC]>>>>>>>>>[cccD]" }
-   { "A" "F+;'A" }
-   { "B" "F!+F+;'B" }
-   { "C" "F!^+F^+;'C" }
-   { "D" "F!>^+F>^+;'D" }
-} >rules ;
-
-: spiral-0-scene ( -- )
-spiral-0
-22 iterations
-build-model
-[ reset-turtle 90 turn-left 16 step-turtle 180 turn-left ]
-camera> with-turtle .slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: tree-5 ( -- ) lparser-dialect   [ 5 >angle   1 >thickness ] >model-values
-
-"c(4)FFS" >result
-
-H{ { "S" "FFR>(60)R>(60)R>(60)R>(60)R>(60)R>(30)S" }
-   { "R" "[Ba]" }
-   { "a" "$tF[Cx]Fb" }
-   { "b" "$tF[Dy]Fa" }
-   { "B" "&B" }
-   { "C" "+C" }
-   { "D" "-D" }
-
-   { "x" "a" }
-   { "y" "b" }
-
-   { "F" "'(1.25)F'(.8)" }
-} >rules ;
-
-: tree-5-scene ( -- )
-tree-5
-9 iterations
-build-model
-[ reset-turtle 90 pitch-down -70 step-turtle 50 strafe-up ] camera> with-turtle
-.slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: abop-1 ( -- ) lparser-dialect   [ 45 >angle   5 >thickness ] >model-values
-
-H{ { "A" "F[&'(.8)!BL]>(137)'!(.9)A" }
-   { "B" "F[-'(.8)!(.9)$CL]'!(.9)C" }
-   { "C" "F[+'(.8)!(.9)$BL]'!(.9)B" }
-
-   { "L" "~c(8){+(30)f-(120)f-(120)f}" }
-} >rules
-
-"c(12)FFAL" >result ;
-
-: abop-1-scene ( -- )
-abop-1
-8 iterations
-build-model
-[ reset-turtle
-  90 pitch-up 7 step-turtle 90 pitch-down 4 step-turtle 90 pitch-down ]
-camera> with-turtle .slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: abop-2 ( -- ) lparser-dialect   [ 30 >angle   5 >thickness ] >model-values
-
-H{ { "A" "F[&'(.7)!BL]>(137)[&'(.6)!BL]>(137)'(.9)!(.9)A" }
-   { "B" "F[-'(.7)!(.9)$CL]'(.9)!(.9)C" }
-   { "C" "F[+'(.7)!(.9)$BL]'(.9)!(.9)B" }
-
-   { "L" "~c(8){+(45)f(.1)-(45)f(.1)-(45)f(.1)+(45)|+(45)f(.1)-(45)f(.1)-(45)f(.1)}" }
-
-} >rules
-
-"c(12)FAL" >result ;
-
-: abop-2-scene ( -- )
-abop-2
-7 iterations
-build-model
-[ reset-turtle { 0 4 4 } >position 90 pitch-down ]
-camera> with-turtle .slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: abop-3 ( -- ) lparser-dialect   [ 30 >angle   5 >thickness ] >model-values
-
-H{ { "A" "!(.9)t(.4)FB>(94)B>(132)B" }
-   { "B" "[&t(.4)F$A]" }
-   { "F" "'(1.25)F'(.8)" }
-} >rules
-
-"c(12)FA" >result ;
-
-: abop-3-scene ( -- )
-abop-3 11 iterations build-model
-[ reset-turtle { 0 47 29 } >position 90 pitch-down ] camera> with-turtle
-.slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: abop-4 ( -- ) lparser-dialect   [ 18 >angle   5 >thickness ] >model-values
-
-H{ { "N" "FII[&(60)rY]>(90)[&(45)'(0.8)rA]>(90)[&(60)rY]>(90)[&(45)'(0.8)rD]!FIK" }
-   { "Y" "[c(4){++l.--l.--l.++|++l.--l.--l.}]" }
-   { "l" "g(.2)l" }
-   { "K" "[!c(2)FF>w>(72)w>(72)w>(72)w>(72)w]" }
-   { "w" "[c(2)^!F][c(5)&(72){-(54)f(3)+(54)f(3)|-(54)f(3)+(54)f(3)}]" }
-   { "f" "_" }
-
-   { "A" "B" }
-   { "B" "C" }
-   { "C" "D" }
-   { "D" "E" }
-   { "E" "G" }
-   { "G" "H" }
-   { "H" "N" }
-
-   { "I" "FoO" }
-   { "O" "FoP" }
-   { "P" "FoQ" }
-   { "Q" "FoR" }
-   { "R" "FoS" }
-   { "S" "FoT" }
-   { "T" "FoU" }
-   { "U" "FoV" }
-   { "V" "FoW" }
-   { "W" "FoX" }
-   { "X" "_" }
-
-   { "o" "$t(-0.03)" }
-   { "r" "~(30)" }
-} >rules
-
-"c(12)&(20)N" >result ;
-
-: abop-4-scene ( -- )
-abop-4 21 iterations build-model
-[ reset-turtle
-  { 53 25 36 } >position
-  { { 0.57 -0.14 -0.80 } { -0.81 -0.18 -0.54 } { -0.07 0.97 -0.22 } }
-  >orientation
-] camera> with-turtle .slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: abop-5 ( -- ) lparser-dialect   [ 5 >angle   5 >thickness ] >model-values
-
-H{ { "a" "F[+(45)l][-(45)l]^;ca" }
-
-   { "l" "j" }
-   { "j" "h" }
-   { "h" "s" }
-   { "s" "d" }
-   { "d" "x" }
-   { "x" "a" }
-
-   { "F" "'(1.17)F'(.855)" }
-} >rules
-
-"&(90)+(90)a" >result ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: abop-6 ( -- ) lparser-dialect   [ 5 >angle   5 >thickness ] >model-values
-
-"&(90)+(90)FFF[-(120)'(.6)x][-(60)'(.8)x][+(120)'(.6)x][+(60)'(.8)x]x" >result
-
-H{ { "a" "F[cdx][cex]F!(.9)a" }
-   { "x" "a" }
-
-   { "d" "+d" }
-   { "e" "-e" }
-
-   { "F" "'(1.25)F'(.8)" }
-} >rules ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: airhorse ( -- ) lparser-dialect [ 10 >angle 5 >thickness ] >model-values
-
-"C" >result
-
-H{ { "C" "LBW" }
-
-   { "B" "[[''aH]|[g]]" }
-   { "a" "Fs+;'a" }
-   { "g" "Ft+;'g" }
-   { "s" "[::cc!!!!&&[FFcccZ]^^^^FFcccZ]" }
-   { "t" "[c!!!!&[FF]^^FF]" }
-
-   { "L" "O" }
-   { "O" "P" }
-   { "P" "Q" }
-   { "Q" "R" }
-   { "R" "U" }
-   { "U" "X" }
-   { "X" "Y" }
-   { "Y" "V" }
-   { "V" "[cc!!!&(90)[Zp]|[Zp]]" }
-   { "p" "h>(120)h>(120)h" }
-   { "h" "[+(40)!F'''p]" }
-
-   { "H" "[cccci[>(50)dcFFF][<(50)ecFFF]]" }
-   { "d" "Z!&Z!&:'d" }
-   { "e" "Z!^Z!^:'e" }
-   { "i" "-:/i" }
-
-   { "W" "[%[!!cb][<<<!!cb][>>>!!cb]]" }
-   { "b" "Fl!+Fl+;'b" }
-   { "l" "[-cc{--z++z++z--|--z++z++z}]" }
-} >rules ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! These should be moved into a separate file. They are used to pretty
-! print matricies and vectors.
-
-USING: styles prettyprint io ;
-
-: decimal-places ( n d -- n )
-10 swap ^ tuck * >fixnum swap /f ;
-
-! : .mat ( matrix -- ) [ [ 2 decimal-places ] map ] map . ;
-
-: .mat ( matrix -- )
-H{ { table-gap 4 } { table-border 4 } }
-[ 2 decimal-places pprint ]
-tabular-output ;
-
-: .vec ( vector -- ) [ 2 decimal-places ] map . ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\ No newline at end of file
diff --git a/apps/lindenmayer/load.factor b/apps/lindenmayer/load.factor
deleted file mode 100644 (file)
index aa8219e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-PROVIDE: apps/lindenmayer
-{ +files+ { "lindenmayer.factor" } } ;
\ No newline at end of file
diff --git a/apps/lindenmayer/opengl.factor b/apps/lindenmayer/opengl.factor
deleted file mode 100644 (file)
index 38ae09e..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-REQUIRES: libs/alien ;
-USING: kernel sequences opengl alien-contrib ;
-IN: opengl-contrib
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: gl-clear-color ( 4seq -- ) first4 glClearColor ;
-
-: gl-vertex-3f ( 3seq -- ) first3 glVertex3f ;
-
-: gl-vertex ( 3seq -- ) gl-vertex-3f ;
-
-: gl-normal-3f ( vec -- ) first3 glNormal3f ;
-
-: gl-normal ( vec -- ) gl-normal-3f ;
-
-: gl-material-fv ( face pname params -- ) >float-array glMaterialfv ;
-
-: gl-color ( vec -- ) first4 glColor4f ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Misc stuff that should probably go in a separate file
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: black ( -- color ) { 0 0 0 1 } ;
-
-: white ( -- color ) { 1 1 1 1 } ;
-
-: red ( -- color ) { 1 0 0 1 } ;
-
-: green ( -- color ) { 0 1 0 1 } ;
-
-: blue ( -- color ) { 0 0 1 1 } ;
-
-: yellow ( -- color ) { 1 1 0 1 } ;
-
-: set-color-alpha ( color alpha -- color ) swap 3 head swap add ;
-
diff --git a/apps/lindenmayer/turtle.factor b/apps/lindenmayer/turtle.factor
deleted file mode 100644 (file)
index b8432f3..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-REQUIRES: libs/math libs/vars ;
-USING: kernel math namespaces sequences arrays math-contrib vars ;
-IN: turtle
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: turtle position orientation ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: turtle
-
-: position> ( -- position ) turtle> turtle-position ;
-
-: >position ( position -- ) turtle> set-turtle-position ;
-
-: orientation> ( -- orientation ) turtle> turtle-orientation ;
-
-: >orientation ( orientation -- ) turtle> set-turtle-orientation ;
-
-: with-turtle ( quot turtle -- ) [ >turtle call ] with-scope ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: reset-turtle ( -- ) { 0 0 0 } >position 3 identity-matrix >orientation ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-C: turtle ( -- ) [ reset-turtle ] over with-turtle ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: make-matrix >r { } make r> group ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! These rotation matrices are from
-! `Computer Graphics: Principles and Practice'
-
-: Rz ( angle -- Rx ) deg>rad
-[ dup cos ,    dup sin neg ,   0 ,
-  dup sin ,    dup cos ,       0 ,
-  0 ,          0 ,             1 , ] 3 make-matrix nip ;
-
-: Ry ( angle -- Ry ) deg>rad
-[ dup cos ,    0 ,             dup sin ,
-  0 ,          1 ,             0 ,
-  dup sin neg ,        0 ,             dup cos , ] 3 make-matrix nip ;
-
-: Rx ( angle -- Rz ) deg>rad
-[ 1 ,          0 ,             0 ,
-  0 ,          dup cos ,       dup sin neg ,
-  0 ,          dup sin ,       dup cos , ] 3 make-matrix nip ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: apply-rotation ( rotation -- ) orientation> swap m. >orientation ;
-
-: rotate-x ( angle -- ) Rx apply-rotation ;
-: rotate-y ( angle -- ) Ry apply-rotation ;
-: rotate-z ( angle -- ) Rz apply-rotation ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: pitch-up   ( angle -- ) neg rotate-x ;
-: pitch-down ( angle -- )     rotate-x ;
-
-: turn-left ( angle -- )      rotate-y ;
-: turn-right ( angle -- ) neg rotate-y ;
-
-: roll-left  ( angle -- ) neg rotate-z ;
-: roll-right ( angle -- )     rotate-z ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: step-vector ( length -- array ) { 0 0 1 } n*v ;
-
-: step-turtle ( length -- )
-step-vector orientation> swap m.v position> v+ >position ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: strafe-up ( length -- )
-90 pitch-up
-step-turtle
-90 pitch-down ;
-
-: strafe-down ( length -- )
-90 pitch-down
-step-turtle
-90 pitch-up ;
-
-: strafe-left ( length -- )
-90 turn-left
-step-turtle
-90 turn-right ;
-
-: strafe-right ( length -- )
-90 turn-right
-step-turtle
-90 turn-left ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: turtle-stack
-
-: init-turtle-stack ( -- ) V{ } clone >turtle-stack ;
-
-: push-turtle ( -- ) turtle> clone turtle-stack> push ;
-
-! : pop-turtle ( -- ) turtle-stack> pop >turtle ;
-
-: pop-turtle ( -- )
-turtle-stack> pop dup
-turtle-position >position
-turtle-orientation >orientation ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! roll-until-horizontal
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: V ( -- V ) { 0 1 0 } ;
-
-: X ( -- 3array ) orientation> [ first  ] map ;
-: Y ( -- 3array ) orientation> [ second ] map ;
-: Z ( -- 3array ) orientation> [ third  ] map ;
-
-: set-X ( seq -- ) orientation> [ 0 swap set-nth ] 2each ;
-: set-Y ( seq -- ) orientation> [ 1 swap set-nth ] 2each ;
-: set-Z ( seq -- ) orientation> [ 2 swap set-nth ] 2each ;
-
-: roll-until-horizontal ( -- )
-V Z cross normalize set-X
-Z X cross normalize set-Y ;
-
diff --git a/apps/lisppaste.factor b/apps/lisppaste.factor
deleted file mode 100644 (file)
index 545a886..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-IN: lisppaste
-REQUIRES: libs/xml-rpc ;
-USING: arrays kernel xml-rpc ;
-
-: url "http://www.common-lisp.net:8185/RPC2" ;
-
-: channels ( -- seq )
-    { } "listchannels" url invoke-method ;
-
-: lisppaste ( seq -- response )
-    ! seq is { channel user title contents }
-    ! or { channel user title contents annotation-number }
-    "newpaste" url invoke-method ;
-
-PROVIDE: apps/lisppaste ;
diff --git a/apps/mandel/load.factor b/apps/mandel/load.factor
deleted file mode 100644 (file)
index 269a8de..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-PROVIDE: apps/mandel
-{ +files+ { "mandel.factor" } }
-{ +tests+ { "tests.factor" } } ;
-
-USE: mandel
-USE: test
-
-MAIN: apps/mandel [ "mandel.pnm" run>file ] time ;
diff --git a/apps/mandel/mandel.factor b/apps/mandel/mandel.factor
deleted file mode 100644 (file)
index 761ea05..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-! Run this file to write a Mandelbrot fractal to "mandel.ppm".
-
-IN: mandel
-USING: arrays compiler io kernel math namespaces sequences
-strings test ;
-
-: max-color 360 ; inline
-: zoom-fact 0.8 ; inline
-: width 640 ; inline
-: height 480 ; inline
-: nb-iter 40 ; inline
-: center -0.65 ; inline
-
-: f_ >r swap rot >r 2dup r> 6 * r> - ;
-: p ( v s x -- v p x ) >r dupd neg 1 + * r> ;
-: q ( v s f -- q ) * neg 1 + * ;
-: t_ ( v s f -- t_ ) neg 1 + * neg 1 + * ;
-
-: mod-cond ( p vector -- )
-    #! Call p mod q'th entry of the vector of quotations, where
-    #! q is the length of the vector. The value q remains on the
-    #! stack.
-    [ dupd length mod ] keep nth call ;
-
-: hsv>rgb ( h s v -- r g b )
-    pick 6 * >fixnum {
-        [ f_ t_ p swap     ] ! v p t
-        [ f_ q  p -rot     ] ! q v p
-        [ f_ t_ p swapd    ] ! p v t
-        [ f_ q  p rot      ] ! p q v
-        [ f_ t_ p swap rot ] ! t p v
-        [ f_ q  p          ] ! v p q
-    } mod-cond ;
-
-: scale 255 * >fixnum ; inline
-
-: scale-rgb ( r g b -- n )
-    rot scale rot scale rot scale 3array ;
-
-: sat 0.85 ; inline
-: val 0.85 ; inline
-
-: <color-map> ( nb-cols -- map )
-    dup [
-        360 * swap 1+ / 360 / sat val
-        hsv>rgb scale-rgb
-    ] map-with ;
-
-: iter ( c z nb-iter -- x )
-    over absq 4.0 >= over zero? or
-    [ 2nip ] [ 1- >r sq dupd + r> iter ] if ; inline
-
-SYMBOL: cols
-
-: x-inc width 200000 zoom-fact * / ; inline
-: y-inc height 150000 zoom-fact * / ; inline
-
-: c ( i j -- c )
-    >r
-    x-inc * center real x-inc width 2 / * - + >float
-    r>
-    y-inc * center imaginary y-inc height 2 / * - + >float
-    rect> ; inline
-
-: render ( -- )
-    height [
-        width [
-            2dup swap c 0 nb-iter iter dup zero? [
-                drop "\0\0\0"
-            ] [
-                cols get [ length mod ] keep nth
-            ] if %
-        ] repeat
-    ] repeat ;
-
-: ppm-header ( w h -- )
-    "P6\n" % swap # " " % # "\n255\n" % ;
-
-: sbuf-size width height * 3 * 100 + ;
-
-: run ( -- string )
-    [
-        sbuf-size <sbuf> building set
-        width height ppm-header
-        nb-iter max-color min <color-map> cols set
-        render
-        building get >string
-    ] with-scope ;
-
-: run>file ( file -- )
-    "Generating " write dup write "..." print
-    <file-writer> [ run write ] with-stream ;
diff --git a/apps/mandel/tests.factor b/apps/mandel/tests.factor
deleted file mode 100644 (file)
index fddc691..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-IN: mandel
-USE: test
-
-[ 1/2 1/2 1/2 ] [ 0 0 1/2 hsv>rgb ] unit-test
-
-[ 1/2 1/4 1/4 ] [ 0 1/2 1/2 hsv>rgb ] unit-test
-[ 1/3 2/9 2/9 ] [ 0 1/3 1/3 hsv>rgb ] unit-test
-
-[ 24/125 1/5 4/25 ] [ 1/5 1/5 1/5 hsv>rgb ] unit-test
-[ 29/180 1/6 5/36 ] [ 1/5 1/6 1/6 hsv>rgb ] unit-test
-
-[ 6/25 2/5 38/125 ] [ 2/5 2/5 2/5 hsv>rgb ] unit-test
-[ 8/25 4/5 64/125 ] [ 2/5 3/5 4/5 hsv>rgb ] unit-test
-
-[ 6/25 48/125 3/5 ] [ 3/5 3/5 3/5 hsv>rgb ] unit-test
-[ 0 0 0 ] [ 3/5 1/5 0 hsv>rgb ] unit-test
-
-[ 84/125 4/25 4/5 ] [ 4/5 4/5 4/5 hsv>rgb ] unit-test
-[ 7/15 1/3 1/2 ] [ 4/5 1/3 1/2 hsv>rgb ] unit-test
-
-[ 5/6 5/36 5/6 ] [ 5/6 5/6 5/6 hsv>rgb ] unit-test
-[ 1/6 0 1/6 ] [ 5/6 1 1/6 hsv>rgb ] unit-test
-
-[ 1 0 0 ] [ 1 1 1 hsv>rgb ] unit-test
-[ 1/6 1/9 1/9 ] [ 1 1/3 1/6 hsv>rgb ] unit-test
diff --git a/apps/random-tester/load.factor b/apps/random-tester/load.factor
deleted file mode 100644 (file)
index dddeff2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-REQUIRES: libs/lazy-lists libs/shuffle ;
-PROVIDE: apps/random-tester
-{ +files+ {
-    "utils.factor"
-    "random.factor"
-    "random-tester.factor"
-    "random-tester2.factor"
-    "type.factor"
-} } ;
diff --git a/apps/random-tester/random-tester.factor b/apps/random-tester/random-tester.factor
deleted file mode 100644 (file)
index ab24e65..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-USING: kernel math math-internals memory sequences namespaces errors
-hashtables words  arrays parser compiler syntax io
-tools prettyprint optimizer inference ;
-IN: random-tester
-
-! n-foo>bar -- list of words of type 'foo' that take n parameters
-!              and output a 'bar'
-
-
-! Math vocabulary words
-: 1-x>y
-    {
-        1+ 1- >bignum >digit >fixnum abs absq arg 
-        bitnot bits>double bits>float ceiling cis conjugate cos cosec cosech
-        cosh cot coth denominator double>bits exp float>bits floor imaginary
-        log neg numerator real sec ! next-power-of-2
-        sech sgn sin sinh sq sqrt tan tanh truncate 
-    } ;
-
-: 1-x>y-throws
-    {
-        recip log2
-        asec asech acot acoth acosec acosech acos acosh asin asinh atan atanh
-    } ;
-
-: 2-x>y ( -- seq ) { * + - /f max min polar> bitand bitor bitxor align } ;
-: 2-x>y-throws ( -- seq ) { / /i mod rem } ;
-
-: 1-integer>x
-    {
-        1+ 1- >bignum >digit >fixnum abs absq arg 
-        bitnot bits>double bits>float ceiling cis conjugate cos cosec cosech
-        cosh cot coth denominator exp floor imaginary
-        log neg next-power-of-2 numerator real sec
-        sech sgn sin sinh sq sqrt tan tanh truncate 
-    } ;
-
-: 1-ratio>x
-    {
-        1+ 1- >bignum >digit >fixnum abs absq arg ceiling
-        cis conjugate cos cosec cosech
-        cosh cot coth exp floor imaginary
-        log neg next-power-of-2 real sec
-        sech sgn sin sinh sq sqrt tan tanh truncate 
-    } ;
-
-: 1-float>x ( -- seq )
-    {
-        1+ 1- >bignum >digit >fixnum abs absq arg 
-        ceiling cis conjugate cos cosec cosech
-        cosh cot coth double>bits exp float>bits floor imaginary
-        log neg real sec ! next-power-of-2
-        sech sgn sin sinh sq sqrt tan tanh truncate
-    } ;
-
-: 1-complex>x
-    {
-        1+ 1- abs absq arg conjugate cos cosec cosech
-        cosh cot coth exp imaginary log neg real
-        sec sech sin sinh sq sqrt tan tanh 
-    } ;
-
-: 1-integer>x-throws
-    {
-        recip log2
-        asec asech acot acoth acosec acosech acos acosh asin asinh atan atanh
-    } ;
-
-: 1-ratio>x-throws
-    {
-        recip
-        asec asech acot acoth acosec acosech acos acosh asin asinh atan atanh
-    } ;
-
-: 1-integer>integer
-    {
-        1+ 1- >bignum >digit >fixnum abs absq bitnot ceiling conjugate 
-        denominator floor imaginary
-        neg next-power-of-2 numerator real sgn sq truncate 
-    } ;
-
-: 1-ratio>ratio
-    { 1+ 1- >digit abs absq conjugate neg real sq } ;
-
-: 1-float>float
-    {
-        1+ 1- >digit abs absq arg ceiling
-        conjugate exp floor neg real sq truncate
-    } ;
-
-: 1-complex>complex
-    {
-        1+ 1- abs absq arg conjugate cosec cosech cosh cot coth exp log
-        neg sech sin sinh sq sqrt tanh 
-    } ;
-
-: 2-integer>x { * + - /f max min polar> bitand bitor bitxor align } ;
-: 2-ratio>x { * + - /f max min polar> } ;
-: 2-float>x { float+ float- float* float/f + - * /f max min polar> } ;
-: 2-complex>x { * + - /f } ;
-
-: 2-integer>integer { * + - max min bitand bitor bitxor align } ;
-: 2-ratio>ratio { * + - max min } ;
-: 2-float>float { float* float+ float- float/f max min /f + - } ;
-: 2-complex>complex { * + - /f } ;
-
-
-SYMBOL: last-quot
-SYMBOL: first-arg
-SYMBOL: second-arg
-: 0-runtime-check ( quot -- )
-    #! Checks the runtime only, not the compiler
-    #! Evaluates the quotation twice and makes sure the results agree
-    [ last-quot set ] keep
-    [ call ] keep
-    call
-    ! 2dup swap unparse write " " write unparse print flush
-    = [ last-quot get . "problem in runtime" throw ] unless ;
-
-: 1-runtime-check ( quot -- )
-    #! Checks the runtime only, not the compiler
-    #! Evaluates the quotation twice and makes sure the results agree
-    #! For quotations that are given one argument
-    [ last-quot set first-arg set ] 2keep
-    [ call ] 2keep
-    call
-    2dup swap unparse write " " write unparse print flush
-    = [ "problem in runtime" throw ] unless ;
-
-: 1-interpreted-vs-compiled-check ( x quot -- ) 
-    #! Checks the runtime output vs the compiler output
-    #! quot: ( x -- y )
-    2dup swap unparse write " " write . flush
-    [ last-quot set first-arg set ] 2keep
-    [ call ] 2keep compile-1
-    2dup swap unparse write " " write unparse print flush
-    = [ "problem in math1" throw ] unless ;
-
-: 2-interpreted-vs-compiled-check ( x y quot -- )
-    #! Checks the runtime output vs the compiler output
-    #! quot: ( x y -- z )
-    .s flush
-    [ last-quot set first-arg set second-arg set ] 3keep
-    [ call ] 3keep compile-1
-    2dup swap unparse write " " write unparse print flush
-    = [ "problem in math2" throw ] unless ;
-
-: 0-interpreted-vs-compiled-check-catch ( quot -- )
-    #! Check the runtime output vs the compiler output for words that throw
-    #!
-    dup .
-    [ last-quot set ] keep
-    [ catch [ "caught: " write dup print-error ] when* ] keep 
-    [ compile-1 ] catch [ nip "caught: " write dup print-error ] when*
-    = [ "problem in math3" throw ] unless ;
-
-: 1-interpreted-vs-compiled-check-catch ( quot -- )
-    #! Check the runtime output vs the compiler output for words that throw
-    2dup swap unparse write " " write .
-    ! "." write
-    [ last-quot set first-arg set ] 2keep
-    [ catch [ nip "caught: " write dup print-error ] when* ] 2keep 
-    [ compile-1 ] catch [ 2nip "caught: " write dup print-error ] when*
-    = [ "problem in math4" throw ] unless ;
-
-: 2-interpreted-vs-compiled-check-catch ( quot -- )
-    #! Check the runtime output vs the compiler output for words that throw
-    ! 3dup rot unparse write " " write swap unparse write " " write .
-    "." write
-    [ last-quot set first-arg set second-arg set ] 3keep
-    [ catch [ 2nip "caught: " write dup print-error ] when* ] 3keep
-    [ compile-1 ] catch [ 2nip nip "caught: " write dup print-error ] when*
-    = [ "problem in math5" throw ] unless ;
-
-
-! RANDOM QUOTATIONS TO TEST
-: random-1-integer>x-quot ( -- quot ) 1-integer>x pick-one unit ;
-: random-1-ratio>x-quot ( -- quot ) 1-ratio>x pick-one unit ;
-: random-1-float>x-quot ( -- quot ) 1-float>x pick-one unit ;
-: random-1-complex>x-quot ( -- quot ) 1-complex>x pick-one unit ;
-
-: test-1-integer>x ( -- )
-    random-integer random-1-integer>x-quot 1-interpreted-vs-compiled-check ;
-: test-1-ratio>x ( -- )
-    random-ratio random-1-ratio>x-quot 1-interpreted-vs-compiled-check ;
-: test-1-float>x ( -- )
-    random-float random-1-float>x-quot 1-interpreted-vs-compiled-check ;
-: test-1-complex>x ( -- )
-    random-complex random-1-complex>x-quot 1-interpreted-vs-compiled-check ;
-
-
-: random-1-float>float-quot ( -- obj ) 1-float>float pick-one unit ;
-: random-2-float>float-quot ( -- obj ) 2-float>float pick-one unit ;
-: nrandom-2-float>float-quot ( -- obj )
-    [
-        5
-        [
-            {
-                [ 2-float>float pick-one , random-float , ]
-                [ 1-float>float pick-one ,  ]
-            } do-one
-        ] times 
-        2-float>float pick-one ,
-    ] [ ] make ;
-
-: test-1-float>float ( -- )
-    random-float random-1-float>float-quot 1-interpreted-vs-compiled-check ;
-: test-2-float>float ( -- )
-    random-float random-float random-2-float>float-quot
-    2-interpreted-vs-compiled-check ;
-
-: test-n-2-float>float ( -- )
-    random-float random-float nrandom-2-float>float-quot
-    2-interpreted-vs-compiled-check ;
-
-: test-1-integer>x-runtime ( -- )
-    random-integer random-1-integer>x-quot 1-runtime-check ;
-
-: random-1-integer>x-throws-quot ( -- obj ) 1-integer>x-throws pick-one unit ;
-: random-1-ratio>x-throws-quot ( -- obj ) 1-ratio>x-throws pick-one unit ;
-: test-1-integer>x-throws ( -- obj )
-    random-integer random-1-integer>x-throws-quot
-    1-interpreted-vs-compiled-check-catch ;
-: test-1-ratio>x-throws ( -- obj )
-    random-ratio random-1-ratio>x-throws-quot
-    1-interpreted-vs-compiled-check-catch ;
-
-
-
-: test-2-integer>x-throws ( -- )
-    [
-        random-integer , random-integer ,
-        2-x>y-throws pick-one ,
-    ] [ ] make 2-interpreted-vs-compiled-check-catch ;
-
-! : test-^-ratio ( -- )
-    ! [
-        ! random-ratio , random-ratio , \ ^ ,
-    ! ] [ ] make interp-compile-check-catch ;
-
-: test-0-float?-when
-    [
-        random-number , \ dup , \ float? , 1-float>x pick-one unit , \ when ,
-    ] [ ] make 0-runtime-check ;
-
-: test-1-integer?-when
-    random-integer [
-        \ dup , \ integer? , 1-integer>x pick-one unit , \ when ,
-    ] [ ] make 1-interpreted-vs-compiled-check ;
-
-: test-1-ratio?-when
-    random-ratio [
-        \ dup , \ ratio? , 1-ratio>x pick-one unit , \ when ,
-    ] [ ] make 1-interpreted-vs-compiled-check ;
-
-: test-1-float?-when
-    random-float [
-        \ dup , \ float? , 1-float>x pick-one unit , \ when ,
-    ] [ ] make 1-interpreted-vs-compiled-check ;
-
-: test-1-complex?-when
-    random-complex [
-        \ dup , \ complex? , 1-complex>x pick-one unit , \ when ,
-    ] [ ] make 1-interpreted-vs-compiled-check ;
-
-
-: many-word-test ( -- )
-    #! defines words a1000 down to a0, which does a trivial addition
-    "random-tester-scratchpad" vocabularies get remove-hash
-    "random-tester-scratchpad" [ ensure-vocab ] keep use+
-    "a0" "random-tester-scratchpad" create [ 1 1 + ] define-compound
-    100 [
-        [ 1+ "a" swap unparse append "random-tester-scratchpad" create ] keep
-        "a" swap unparse append [ parse ] catch [ 0 :res ] when define-compound
-    ] each ;
-
-: compile-loop ( -- )
-    10 [ many-word-test "a100" parse first compile ] times ;
-
-: random-test
-    "----" print
-    {
-        test-1-integer>x
-        test-1-ratio>x
-        test-1-float>x
-        test-1-complex>x
-        test-1-integer>x-throws
-        test-1-ratio>x-throws
-        test-1-float>float
-        test-2-float>float
-        ! test-n-2-float>float
-        test-1-integer>x-runtime
-        ! test-0-float?-when
-        test-1-integer?-when
-        test-1-ratio?-when
-        test-1-float?-when
-        test-1-complex?-when
-        ! full-gc
-        ! code-gc
-    } pick-one dup . execute terpri ;
-
diff --git a/apps/random-tester/random-tester2.factor b/apps/random-tester/random-tester2.factor
deleted file mode 100644 (file)
index 63f4962..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-USING: compiler errors inference interpreter io
-kernel math memory namespaces prettyprint random-tester
-sequences tools words ;
-USING: arrays definitions generic graphs hashtables ;
-IN: random-tester2
-
-SYMBOL: wordbank
-: w1
-    {
-        die
-        set-walker-hook exit
-
-        xref-words
-
-        times repeat (repeat)
-        supremum infimum assoc rassoc norm-sq
-        product sum curry remove-all member? subseq?
-
-        (next-power-of-2) (^) d>w/w w>h/h millis
-        (random-int) ^n integer, first-bignum
-        most-positive-fixnum ^ init-random next-power-of-2
-        most-negative-fixnum
-
-        clear-hash build-graph
-
-        >r r>
-
-        set-callstack set-word set-word-prop
-        set-catchstack set-namestack set-retainstack
-        set-continuation-retain continuation-catch
-        set-continuation-name catchstack retainstack
-        set-no-math-method-generic
-        set-no-math-method-right
-        set-check-method-class
-        set-check-create-name
-        set-nested-style-stream-style
-        set-pathname-string
-        set-check-create-vocab
-        <check-create> check-create?
-        reset-generic forget-class
-        create forget-word forget-vocab forget forget-tuple
-        remove-word-prop empty-method
-        continue-with <continuation>
-
-        define-compound define make-generic
-        define-method define-predicate-class
-        define-tuple define-temp define-tuple-slots
-        define-writer define-predicate define-generic
-        ?make-generic define-reader define-slot define-slots
-        define-typecheck define-slot-word define-union
-        define-generic* with-methods define-constructor
-        predicate-word condition-continuation define-symbol
-
-        ndrop
-
-        set-word-def set-word-name
-        set-word-props set-word-primitive
-
-        stdio
-        close readln (readln) read1 read with-server
-        stream-read stream-readln stream-read1 lines (lines)
-        contents stream-copy stream-flush
-        stream-format set-line-reader-cr
-
-        double>bits float>bits >bignum
-
-        intern-slots class-predicates delete (delete) prune memq?
-        normalize norm vneg vmax vmin v- v+ [v-]
-
-        bin> oct> le> be> hex> string>number
-
-        gensym random-int counter <byte-array>
-        <word> <client-stream> <server> <client>
-        <duplex-stream> <file-writer> <file-reader> ! <file-r/w>
-        init-namespaces unxref-word set-global set off on
-        nest
-        set-restart-obj
-        +@ inc dec
-
-        changed-words
-        callstack namespace namestack global vocabularies
-
-        path+ parent-dir
-
-        .s . word-xt.
-
-        <continuation> continue-with
-        set-delegate
-
-        closure
-        
-        tabular-output simple-slots
-
-        join concat
-    }
-    { "arrays" "errors" "generic" "graphs" "hashtables" "io"
-    "kernel" "math" "namespaces"
-    "queues" "strings" "sequences" "vectors" "words" }
-    [ words ] map concat diff ;
-
-w1 wordbank set-global
-
-: databank
-    {
-        ! V{ } H{ } V{ 3 } { 3 } { } "" "asdf"
-        pi 1/0. -1/0. 0/0. [ ]
-        f t "" 0 0.0 3.14 2 -3 -7 20 3/4 -3/4 1.2/3 3.5
-        C{ 2 2 } C{ 1/0. 1/0. }
-    } ;
-
-: setup-test ( #data #code -- data... quot )
-    #! variable stack effect
-    >r [ databank pick-one ] times r>
-    [ drop wordbank get pick-one ] map >quotation ;
-
-SYMBOL: before
-SYMBOL: after
-SYMBOL: quot
-SYMBOL: err
-err off
-
-: test-compiler ( data... quot -- ... )
-    err off
-    dup quot set
-    datastack clone dup pop* before set
-    [ call ] catch drop datastack clone after set
-    clear
-    before get [ ] each
-    quot get [ compile-1 ] [ err on ] recover ;
-
-: do-test ( data... quot -- )
-    .s flush test-compiler
-    err get [
-        datastack after get 2dup = [
-            2drop
-        ] [
-            [ . ] each
-            "--" print
-            [ . ] each quot get .
-            "not =" throw
-        ] if
-    ] unless
-    clear ;
-
-: random-test ( #data #code -- )
-    setup-test do-test ;
-
-: run-random-tester2
-    100000000000000 [ 6 3 random-test ] times ;
-
-
-! A worthwhile test that has not been run extensively
-1000 [ drop gensym ] map "syms" set
-
-: pick-one [ length random-int ] keep nth ;
-
-: fooify-test
-    "syms" get pick-one
-    2000 random-int >quotation
-    over set-word-def
-    100 random-int zero? [ code-gc ] when
-    compile fooify-test ;
-
diff --git a/apps/random-tester/random.factor b/apps/random-tester/random.factor
deleted file mode 100644 (file)
index fe614ae..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-USING: kernel math sequences namespaces errors hashtables words
-arrays parser compiler syntax io tools prettyprint optimizer
-inference ;
-IN: random-tester
-
-! Tweak me
-: max-length 15 ; inline
-: max-value 1000000000 ; inline
-
-: 10% ( -- bool ) 10 random-int 8 > ;
-: 20% ( -- bool ) 10 random-int 7 > ;
-: 30% ( -- bool ) 10 random-int 6 > ;
-: 40% ( -- bool ) 10 random-int 5 > ;
-: 50% ( -- bool ) 10 random-int 4 > ;
-: 60% ( -- bool ) 10 random-int 3 > ;
-: 70% ( -- bool ) 10 random-int 2 > ;
-: 80% ( -- bool ) 10 random-int 1 > ;
-: 90% ( -- bool ) 10 random-int 0 > ;
-
-! varying bit-length random number
-: random-bits ( n -- int )
-    random-int 2 swap ^ random-int ;
-
-: random-seq ( -- seq )
-    { [ ] { } V{ } "" } pick-one
-    [ max-length random-int [ max-value random-int , ] times ] swap make ;
-
-: random-string
-    [ max-length random-int [ max-value random-int , ] times ] "" make ;
-
-SYMBOL: special-integers
-[ { -1 0 1 } % most-negative-fixnum , most-positive-fixnum , first-bignum , ] 
-{ } make \ special-integers set-global
-: special-integers ( -- seq ) \ special-integers get ;
-SYMBOL: special-floats
-[ { 0.0 -0.0 } % e , pi , 1./0. , -1./0. , 0./0. , epsilon , epsilon neg , ]
-{ } make \ special-floats set-global
-: special-floats ( -- seq ) \ special-floats get ;
-SYMBOL: special-complexes
-[ 
-    { -1 0 1 i -i } %
-    e , e neg , pi , pi neg ,
-    0 pi rect> , 0 pi neg rect> , pi neg 0 rect> , pi pi rect> ,
-    pi pi neg rect> , pi neg pi rect> , pi neg pi neg rect> ,
-    e neg e neg rect> , e e rect> ,
-] { } make \ special-complexes set-global
-: special-complexes ( -- seq ) \ special-complexes get ;
-
-: random-fixnum ( -- fixnum )
-    most-positive-fixnum random-int 1+ coin-flip [ neg 1- ] when >fixnum ;
-
-: random-bignum ( -- bignum )
-     400 random-bits first-bignum + coin-flip [ neg ] when ;
-    
-: random-integer ( -- n )
-    coin-flip [
-        random-fixnum
-    ] [
-        coin-flip [ random-bignum ] [ special-integers pick-one ] if
-    ] if ;
-
-: random-positive-integer ( -- int )
-    random-integer dup 0 < [
-            neg
-        ] [
-            dup 0 = [ 1 + ] when
-    ] if ;
-
-: random-ratio ( -- ratio )
-    1000000000 dup [ random-int ] 2apply 1+ / coin-flip [ neg ] when dup [ drop random-ratio ] unless 10% [ drop 0 ] when ;
-
-: random-float ( -- float )
-    coin-flip [ random-ratio ] [ special-floats pick-one ] if
-    coin-flip 
-    [ .0000000000000000001 /f ] [ coin-flip [ .00000000000000001 * ] when ] if
-    >float ;
-
-: random-number ( -- number )
-    {
-        [ random-integer ]
-        [ random-ratio ]
-        [ random-float ]
-    } do-one ;
-
-: random-complex ( -- C )
-    random-number random-number rect> ;
-
diff --git a/apps/random-tester/type.factor b/apps/random-tester/type.factor
deleted file mode 100644 (file)
index b1cbae7..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-USING: errors generic io kernel lazy-lists math namespaces
-prettyprint random-tester2 sequences tools words ;
-IN: random-tester
-
-: inert ;
-TUPLE: inert-object ;
-
-: inputs ( -- seq )
-    {
-        0 -1 -1000000000000000000000000
-        ! -268435457
-        inert
-            ! T{ inert-object f }
-        -29/2 1000000000000000000000000000000/1111111111111111111111111111111111111111111
-        3/4
-            -1000000000000000000000000/111111111111111111
-        -3.14 1/0. 0.0 -1/0. 3.14 0/0.
-        C{ 1 -1 }
-        W{ 55 }
-        { }
-        f  t
-        H{ }
-        V{ 65536 0 0 0 65536 }
-        ""
-        SBUF" "
-        [ ]
-        ! DLL" libm.dylib"
-        ALIEN: 1
-        T{ inert-object f }
-    } ;
-
-: word-inputs ( word -- seq )
-    [ stack-effect effect-in length ] [ drop 0 ] recover
-    inputs swap ;
-    
-: type-error? ( exception -- ? )
-    [ swap execute or ] curry
-    >r { no-method? no-math-method? } f r> reduce ;
-
-: maybe-explode
-    dup sequence? [ [ ] each ] when ; inline
-
-SYMBOL: err
-SYMBOL: type-error
-SYMBOL: params
-SYMBOL: last-time
-: throws? ( data... quot -- ? )
-    err off type-error off
-    >r
-        dup clone params set
-        maybe-explode
-    r>
-    ! .s
-    dup last-time get = [ dup . flush dup last-time set ] unless
-    [ call ] [ err on ] recover
-    err get [
-        dup type-error? dup [
-            ! .s
-        ] unless
-        type-error set
-    ] when clear type-error get ;
-
-: test-inputs ( word -- seq )
-    [ word-inputs ] keep
-    unit [
-        throws? not clear
-    ] curry each-permutation ;
-
-: test1
-    wordbank get [
-        [ stack-effect effect-in length ] catch [ 4 < ] unless
-    ] subset [ test-inputs ] each ;
diff --git a/apps/random-tester/utils.factor b/apps/random-tester/utils.factor
deleted file mode 100644 (file)
index 8d24036..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-USING: kernel math sequences namespaces errors hashtables words
-arrays parser compiler syntax io optimizer inference shuffle
-tools prettyprint ;
-IN: random-tester
-
-: pick-one ( seq -- elt )
-    [ length random-int ] keep nth ;
-
-! HASHTABLES
-: random-hash-entry ( hash -- key value )
-    hash>alist pick-one first2 ;
-
-: coin-flip ( -- bool ) 2 random-int zero? ;
-: do-one ( seq -- ) pick-one call ; inline
-
-: nzero-array ( seq -- )
-    dup length >r 0 r> [ pick set-nth ] each-with drop ;
-    
-: zero-array
-    [ drop 0 ] map ;
-
-TUPLE: p-list seq max count count-vec ;
-: make-p-list ( seq n -- tuple )
-    >r dup length [ 1- ] keep r>
-    [ ^ 0 swap 2array ] keep
-    zero-array <p-list> ;
-
-: inc-seq ( seq max -- )
-    2dup [ < ] curry find-last over -1 = [
-        3drop nzero-array
-    ] [
-        nipd 1+ 2over swap set-nth
-        1+ over length rot <slice> nzero-array
-    ] if ;
-
-: inc-count ( tuple -- )
-    [ p-list-count first2 >r 1+ r> 2array ] keep
-    set-p-list-count ;
-
-: get-permutation ( tuple -- seq )
-    [ p-list-seq ] keep p-list-count-vec [ swap nth ] map-with ;
-
-: p-list-next ( tuple -- seq/f )
-    dup p-list-count first2 < [
-        [
-            [ get-permutation ] keep 
-            [ p-list-count-vec ] keep p-list-max
-            inc-seq
-        ] keep inc-count
-    ] [
-        drop f
-    ] if ;
-
-: (permutations) ( tuple -- )
-    dup p-list-next [ , (permutations) ] [ drop ] if* ;
-
-: permutations ( seq n -- seq )
-    make-p-list
-    [
-        (permutations)
-    ] { } make ;
-
-: (each-permutation) ( tuple quot -- )
-    over p-list-next [
-        [ rot drop swap call ] 3keep
-        drop (each-permutation)
-    ] [
-        2drop
-    ] if* ; inline
-
-: each-permutation ( seq n quot -- )
-    >r make-p-list r> (each-permutation) ;
-
diff --git a/apps/raytracer.factor b/apps/raytracer.factor
deleted file mode 100644 (file)
index 7d2063e..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-! Factor port of the raytracer benchmark from
-! http://www.ffconsultancy.com/free/ray_tracer/languages.html
-
-USING: arrays compiler generic io kernel math namespaces
-sequences test words ;
-IN: ray
-
-! parameters
-: light
-    #! Normalized { -1 -3 2 }.
-    { -0.2672612419124244 -0.8017837257372732 0.5345224838248488 } ; inline
-
-: oversampling 4 ; inline
-
-: levels 3 ; inline
-
-: size 200 ; inline
-
-: delta 1.4901161193847656E-8 ; inline
-
-TUPLE: ray orig dir ;
-
-TUPLE: hit normal lambda ;
-
-GENERIC: intersect-scene ( hit ray scene -- hit )
-
-TUPLE: sphere center radius ;
-
-: sphere-v ( sphere ray -- v )
-    swap sphere-center swap ray-orig v- ; inline
-
-: sphere-b ( ray v -- b ) swap ray-dir v. ; inline
-
-: sphere-disc ( sphere v b -- d )
-    sq swap norm-sq - swap sphere-radius sq + ; inline
-
-: -+ ( x y -- x-y x+y ) [ - ] 2keep + ; inline
-
-: sphere-b/d ( b d -- t )
-    -+ dup 0.0 < [ 2drop 1.0/0.0 ] [ >r [ 0.0 > ] keep r> ? ] if ; inline
-
-: ray-sphere ( sphere ray -- t )
-    2dup sphere-v tuck sphere-b [ sphere-disc ] keep
-    over 0.0 < [ 2drop 1.0/0.0 ] [ swap sqrt sphere-b/d ] if ;
-    inline
-
-: sphere-n ( ray sphere l -- n )
-    pick ray-dir n*v swap sphere-center v- swap ray-orig v+ ;
-    inline
-
-: if-ray-sphere ( hit ray sphere quot -- hit )
-    #! quot: hit ray sphere l -- hit
-    >r pick hit-lambda >r 2dup swap ray-sphere dup r> >=
-    [ 3drop ] r> if ; inline
-
-M: sphere intersect-scene ( hit ray sphere -- hit )
-    [ [ sphere-n normalize ] keep <hit> nip ] if-ray-sphere ;
-
-TUPLE: group objs ;
-
-C: group ( objs bound -- group )
-    [ set-delegate ] keep [ set-group-objs ] keep ;
-
-: make-group ( bound quot -- )
-    swap >r { } make r> <group> ; inline
-
-M: group intersect-scene ( hit ray group -- hit )
-    [
-        drop
-        group-objs [ >r tuck r> intersect-scene swap ] each
-        drop
-    ] if-ray-sphere ;
-
-: initial-hit T{ hit f { 0.0 0.0 0.0 } 1.0/0.0 } ; inline
-
-: initial-intersect ( ray scene -- hit )
-    initial-hit -rot intersect-scene ; inline
-
-: ray-o ( ray hit -- o )
-    over ray-dir over hit-lambda v*n
-    swap hit-normal delta v*n v+
-    swap ray-orig v+ ; inline
-
-: sray-intersect ( ray scene hit -- ray )
-    swap >r ray-o light vneg <ray> r> initial-intersect ; inline
-
-: ray-g ( hit -- g ) hit-normal light v. ; inline
-
-: cast-ray ( ray scene -- g )
-    2dup initial-intersect dup hit-lambda 1.0/0.0 = [
-        3drop 0.0
-    ] [
-        dup ray-g >r sray-intersect hit-lambda 1.0/0.0 =
-        [ r> neg ] [ r> drop 0.0 ] if
-    ] if ; inline
-
-: create-center ( c r d -- c2 )
-    >r 3.0 12.0 sqrt / * r> n*v v+ ; inline
-
-DEFER: create ( level c r -- scene )
-
-: create-step ( level c r d -- scene )
-    over >r create-center r> 2.0 / >r >r 1 - r> r> create ;
-
-: create-offsets ( quot -- )
-    {
-        { -1.0 1.0 -1.0 }
-        { 1.0 1.0 -1.0 }
-        { -1.0 1.0 1.0 }
-        { 1.0 1.0 1.0 }
-    } swap each ; inline
-
-: create-bound ( c r -- sphere ) 3.0 * <sphere> ;
-
-: create-group ( level c r -- scene )
-    2dup create-bound [
-        2dup <sphere> ,
-        [ >r 3dup r> create-step , ] create-offsets 3drop
-    ] make-group ;
-
-: create ( level c r -- scene )
-    pick 1 = [ <sphere> nip ] [ create-group ] if ;
-
-: ss-point ( dx dy -- point )
-    [ oversampling /f ] 2apply 0.0 3array ;
-
-: ss-grid ( -- ss-grid )
-    oversampling [ oversampling [ ss-point ] map-with ] map ;
-
-: ray-grid ( point ss-grid -- ray-grid )
-    [
-        [ v+ normalize { 0.0 0.0 -4.0 } swap <ray> ] map-with
-    ] map-with ;
-
-: ray-pixel ( scene point -- n )
-    ss-grid ray-grid 0.0 -rot
-    [ [ swap cast-ray + ] each-with ] each-with ;
-
-: pixel-grid ( -- grid )
-    size reverse [
-        size [
-            [ size 0.5 * - ] 2apply swap size >float 3array
-        ] map-with
-    ] map ;
-
-: pgm-header ( w h -- )
-    "P5\n" % swap # " " % # "\n255\n" % ;
-
-: pgm-pixel ( n -- ) 255 * 0.5 + >fixnum , ;
-
-: ray-trace ( scene -- pixels )
-    pixel-grid [ [ ray-pixel ] map-with ] map-with ;
-
-: run ( -- string )
-    levels { 0.0 -1.0 0.0 } 1.0 create ray-trace [
-        size size pgm-header
-        [ [ oversampling sq / pgm-pixel ] each ] each
-    ] "" make ;
-
-: run>file ( file -- )
-    "Generating " write dup write "..." print
-    <file-writer> [ run write ] with-stream ;
-
-PROVIDE: apps/raytracer ;
-
-MAIN: apps/raytracer [ "raytracer.pnm" run>file ] time ;
diff --git a/apps/rss/load.factor b/apps/rss/load.factor
deleted file mode 100644 (file)
index f2013be..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-REQUIRES: libs/http-client libs/httpd libs/sqlite ;
-PROVIDE: apps/rss
-{ +files+ {
-       "rss.factor"
-       "rss-reader.factor"
-} } ;
diff --git a/apps/rss/readme.txt b/apps/rss/readme.txt
deleted file mode 100644 (file)
index 2e64b0d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-This library is a simple RSS2 parser and RSS reader web
-application. To run the web application you'll need to make sure you
-have the sqlite library working. This can be tested with
-
-  "contrib/sqlite" require
-  "contrib/sqlite" test-module
-
-Remember that to use "sqlite" you need to have done the following
-somewhere:
-
-  USE: alien
-  "sqlite" "/usr/lib/libsqlite3.so" "cdecl" add-library
-
-Replacing "libsqlite3.so" with the path to the sqlite shared library
-or DLL. I put this in my ~/.factor-rc.
-
-The RSS reader web application creates a database file called
-'rss-reader.db' in the same directory as the Factor executable when
-first started. This database contains all the feed information.
-
-To load the web application use:
-
-  "contrib/rss" require
-
-Fire up the web server and navigate to the URL:
-
-  http://localhost:8888/responder/maintain-feeds
-
-Add any RSS2 compatible feed. Use 'Update Feeds' to retrieve them and
-update the sqlite database with the feed contains. Use 'Database' to
-view the entries from the database for that feed.
-
diff --git a/apps/rss/rss-reader.factor b/apps/rss/rss-reader.factor
deleted file mode 100644 (file)
index b6ed9ad..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! Create a test database like follows:
-!
-!   sqlite3 history.db
-!   > create table rss (url text, title text, link text, primary key (url));
-!   > create table entries (url text, link text, title text, description text, pubdate text, primary key(url, link));
-!   > [eof]
-!
-IN: rss
-USING: kernel html cont-responder namespaces sequences io hashtables sqlite errors tuple-db ;
-   
-TUPLE: reader-feed url title link ;
-TUPLE: reader-entry url link title description pubdate ;
-
-reader-feed default-mapping set-mapping
-reader-entry default-mapping set-mapping
-
-SYMBOL: db
-
-: init-db ( -- )
-  db get-global [ sqlite-close ] when*
-  "rss-reader.db" exists? [
-    "rss-reader.db" sqlite-open db set-global
-  ] [
-    "rss-reader.db" sqlite-open dup db set-global
-    dup reader-feed create-tuple-table
-    reader-entry create-tuple-table
-  ] if ;
-
-: add-feed ( url -- )
-  "" "" <reader-feed> db get swap insert-tuple ;
-
-: remove-feed ( url -- )
-  f f <reader-feed> db get swap find-tuples [ db get swap delete-tuple ] each ;
-
-: all-urls ( -- urls )
-  f f f <reader-feed> db get swap find-tuples [ reader-feed-url ] map ;
-
-: ask-for-url ( -- url )
-  [
-    <html>
-      <head> <title> "Enter a Feed URL" write </title> </head>
-      <body>
-        <form =action "post" =method form>
-          "URL: " write
-          <input "text" =type "url" =name "100" =size input/>
-          <input "submit" =type input/>
-        </form>
-      </body>
-    </html>
-  ] show "url" swap hash ;
-
-: get-entries ( url -- entries )
-  f f f f <reader-entry> db get swap find-tuples ;
-  
-: display-entries ( url -- )
-  [
-    <html> 
-      <head> <title> "View entries for " write over write </title> </head>
-      <body>
-        swap get-entries [
-         <h2> dup reader-entry-title write </h2>
-         <p>
-           reader-entry-description write
-         </p>        
-        ] each        
-        <p> <a =href a> "Back" write </a> </p>
-      </body>
-    </html>
-  ] show 2drop ;
-
-: rss>reader-feed ( url rss -- reader-feed )
-  [ rss-title ] keep rss-link <reader-feed> ;   
-
-: rss-entry>reader-entry ( url entry -- reader-entry )
-  [ rss-entry-link ] keep
-  [ rss-entry-title ] keep
-  [ rss-entry-description ] keep
-  rss-entry-pub-date 
-  <reader-entry> ;
-
-: update-feed-database ( url -- )
-  dup remove-feed
-  dup rss-get 
-  2dup rss>reader-feed db get swap save-tuple
-  rss-entries [
-    dupd rss-entry>reader-entry
-    dup >r reader-entry-link f f f <reader-entry> db get swap find-tuples [ db get swap delete-tuple ] each r>
-    db get swap save-tuple
-  ] each-with ;
-
-: update-feeds ( seq -- )
-  [ update-feed-database ] each
-  [
-    <html>
-      <head> <title> "Feeds Updated" write </title> </head>
-      <body>
-        <p> "Feeds Updated." write </p>
-        <p> <a =href a> "Back" write </a> </p>
-      </body>
-    </html>          
-  ] show drop ;
-  
-: maintain-feeds ( -- )
-  [
-    <html>
-      <head> <title> "Maintain Feeds" write </title> </head>
-      <body>
-       <p>
-          <table "1" =border table>
-            all-urls [
-              <tr> 
-                <td> dup write </td>
-                <td> dup [ remove-feed ] curry "Remove" swap quot-href </td>
-                <td> [ display-entries ] curry "Database" swap quot-href </td>
-              </tr>
-            ] each
-          </table>
-        </p>
-        <p> "Add Feed" [ ask-for-url add-feed ] quot-href </p>
-        <p> "Update Feeds" [ all-urls update-feeds ] quot-href </p>
-      </body>
-    </html>
-  ] show-final ;
-
-"maintain-feeds" [ init-db maintain-feeds ] install-cont-responder
diff --git a/apps/rss/rss.factor b/apps/rss/rss.factor
deleted file mode 100644 (file)
index e30cd75..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-IN: rss
-USING: kernel http-client sequences namespaces math errors io ;
-
-: (replace) ( str1 str2 string -- )
-  pick over ! str1 str2 string str1 string
-  start dup -1 = [ ! str1 str2 string n
-    drop % 2drop
-  ] [ 
-    dup    ! str1 str2 string n n-1
-    pick swap head % ! str1 str2 string n )
-    >r pick length r> + tail ! str1 str2 tail
-    over % (replace)     
-  ] if ;
-  
-: replace ( str1 str2 string -- string )
-  #! Replace occurences of str1 with str2 inside string.
-  [ (replace) ] "" make ;
-
-: find-start-tag ( tag seq -- n )
-  #! Find the start XML tag in the sequence. Return f if not found.
-  #! If found return the index of the start of the contents of that tag.
-  dup rot "<" swap append swap start dup 0 >= [ ! seq index
-    ">" -rot start* dup 0 >= [ 1 + ] [ drop f ] if
-  ] [
-    2drop f
-  ] if  ;
-
-: find-end-tag ( tag seq -- n )
-  #! Find the end XML tag in the sequence. Return -1 if not found.
-  #! If found return the index of the data following the end tag.
-  #! If found return the index of one beyond the last items of the contents of that tag.
-  swap "</" swap append swap start dup 0 >= [ drop f ] unless ;
-
-: (between-tags) ( tag seq -- content )
-  #! Return a string containing the contents of the XML tag contained in seq. Returns
-  #! false if the tag is not found.
-  [ find-start-tag [ "no start tag" throw ] unless* ] 2keep [ find-end-tag 2dup and ] keep swap [ subseq ] [ 3drop "" ] if ;
-
-: between-tags ( tag seq -- content )
-  [ (between-tags) ] catch [ 3drop "" ] when* ;
-
-: between-tags-index ( tag seq -- start end bool )
-  #! Return the start and end index of the data contained with an xml tag.
-  #! Returns t if a match is found, else f along with the indexes.
-  [ find-start-tag ] 2keep find-end-tag 2dup and ;
-
-: (child-tags) ( list tag seq -- list )
-  2dup between-tags-index ! list tag seq start end bool
-  [
-    dup 1 + >r ! list tag seq start end r: end
-    pick subseq ! list tag seq item r: end
-    -rot >r >r over push r> r> r> ! list tag seq end
-    over length rot subseq  (child-tags) 
-  ] [
-    drop drop drop drop 
-  ] if ;
-  
-: child-tags ( tag seq -- list )
-  #! Return a list of strings, each string containing the contents of all
-  #! child tags in the XML data sequence.
-  V{ } clone -rot (child-tags) ;
-
-TUPLE: rss title link entries ;
-TUPLE: rss-entry title link description pub-date ;
-
-: entities-mapping ( -- entities )
-  {
-    { "&lt;" "<" }
-    { "&gt;" ">" }
-    { "&amp;" "&" }
-    { "&quot;" "\"" }
-    { "&apos;" "'" }
-  } ;
-
-: replace-entities ( string -- string )
-  entities-mapping [ first2 rot replace ] each ;
-
-: non-empty ( str1 str2 -- str )
-  #! Return the string that is not empty.
-  over empty? [ nip ] [ drop ] if ;
-
-: process-rss-string ( string -- rss )
-  "rss" swap between-tags 
-  "channel" swap between-tags
-  [ "title" swap between-tags replace-entities ] keep
-  [ "link" swap between-tags ] keep
-  "item" swap child-tags [
-    [ "title" swap between-tags replace-entities ] keep
-    [ "link" swap between-tags ] keep
-    [ "guid" swap between-tags non-empty ] keep
-    [ "description" swap between-tags replace-entities ] keep
-    "pubDate" swap between-tags <rss-entry>
-  ] map <rss> ;
-
-: load-rss-file ( filename -- rss )
-  #! Load an RSS file and process it, returning it as an rss tuple.
-  <file-reader> [ contents process-rss-string ] keep stream-close ;
-
-: rss-get ( url -- rss )
-  #! Retrieve an RSS file, return as an rss tuple.
-  http-get rot 200 = [
-    nip process-rss-string 
-  ] [
-    2drop "Error retrieving rss file" throw
-  ] if ;
diff --git a/apps/space-invaders/cpu-8080.factor b/apps/space-invaders/cpu-8080.factor
deleted file mode 100644 (file)
index f1630f8..0000000
+++ /dev/null
@@ -1,1633 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-USING: kernel math sequences errors vectors prettyprint io
-namespaces arrays words parser hashtables lazy-lists
-kernel-internals parser-combinators strings ;
-IN: cpu-8080
-
-TUPLE: cpu b c d e f h l a pc sp halted? last-interrupt cycles ram ;
-
-GENERIC: reset        ( cpu            -- )
-GENERIC: update-video ( value addr cpu -- )
-GENERIC: read-port    ( port cpu       -- byte )
-GENERIC: write-port   ( value port cpu -- )
-
-M: cpu update-video ( value addr cpu -- )
-  3drop ;
-
-M: cpu read-port ( port cpu -- byte )
-  #! Read a byte from the hardware port. 'port' should
-  #! be an 8-bit value.
-  2drop 0 ;
-
-M: cpu write-port ( value port cpu -- )
-  #! Write a byte to the hardware port, where 'port' is
-  #! an 8-bit value.
-  3drop ;
-
-: carry-flag        HEX: 01 ; inline
-: parity-flag       HEX: 04 ; inline
-: half-carry-flag   HEX: 10 ; inline
-: interrupt-flag    HEX: 20 ; inline
-: zero-flag         HEX: 40 ; inline
-: sign-flag         HEX: 80 ; inline
-
-: >word< ( word -- byte byte )
-  #! Explode a word into its two 8 bit values.
-  dup HEX: FF bitand swap -8 shift HEX: FF bitand swap ;
-
-: cpu-af ( cpu -- word )
-  #! Return the 16-bit pseudo register AF.
-  [ cpu-a 8 shift ] keep cpu-f bitor ;
-
-: set-cpu-af ( value cpu -- )
-  #! Set the value of the 16-bit pseudo register AF
-  >r >word< r> tuck set-cpu-f set-cpu-a ;
-
-: cpu-bc ( cpu -- word )
-  #! Return the 16-bit pseudo register BC.
-  [ cpu-b 8 shift ] keep cpu-c bitor ;
-
-: set-cpu-bc ( value cpu -- )
-  #! Set the value of the 16-bit pseudo register BC
-  >r >word< r> tuck set-cpu-c set-cpu-b ;
-
-: cpu-de ( cpu -- word )
-  #! Return the 16-bit pseudo register DE.
-  [ cpu-d 8 shift ] keep cpu-e bitor ;
-
-: set-cpu-de ( value cpu -- )
-  #! Set the value of the 16-bit pseudo register DE
-  >r >word< r> tuck set-cpu-e set-cpu-d ;
-
-: cpu-hl ( cpu -- word )
-  #! Return the 16-bit pseudo register HL.
-  [ cpu-h 8 shift ] keep cpu-l bitor ;
-
-: set-cpu-hl ( value cpu -- )
-  #! Set the value of the 16-bit pseudo register HL
-  >r >word< r> tuck set-cpu-l set-cpu-h ;
-
-: flag-set? ( flag cpu -- bool )
-  cpu-f bitand 0 = not ;
-
-: flag-clear? ( flag cpu -- bool )
-  cpu-f bitand 0 = ;
-
-: flag-nz? ( cpu -- bool )
-  #! Test flag status
-  cpu-f zero-flag bitand 0 = ;
-
-: flag-z? ( cpu -- bool )
-  #! Test flag status
-  cpu-f zero-flag bitand 0 = not ;
-
-: flag-nc? ( cpu -- bool )
-  #! Test flag status
-  cpu-f carry-flag bitand 0 = ;
-
-: flag-c? ( cpu -- bool )
-  #! Test flag status
-  cpu-f carry-flag bitand 0 = not ;
-
-: flag-po? ( cpu -- bool )
-  #! Test flag status
-  cpu-f parity-flag bitand 0 =  ;
-
-: flag-pe? ( cpu -- bool )
-  #! Test flag status
-  cpu-f parity-flag bitand 0 = not ;
-
-: flag-p? ( cpu -- bool )
-  #! Test flag status
-  cpu-f sign-flag bitand 0 = ;
-
-: flag-m? ( cpu -- bool )
-  #! Test flag status
-  cpu-f sign-flag bitand 0 = not ;
-
-: read-byte ( addr cpu -- byte )
-  #! Read one byte from memory at the specified address.
-  #! The address is 16-bit, but if a value greater than
-  #! 0xFFFF is provided then return a default value.
-  over HEX: FFFF <= [
-    cpu-ram nth
-  ] [
-    2drop HEX: FF
-  ] if ;
-
-: read-word ( addr cpu -- word )  
-  #! Read a 16-bit word from memory at the specified address.
-  #! The address is 16-bit, but if a value greater than
-  #! 0xFFFF is provided then return a default value.
-  [ read-byte ] 2keep >r 1 + r> read-byte 8 shift bitor ;
-: next-byte ( cpu -- byte )
-  #! Return the value of the byte at PC, and increment PC.
-  [ cpu-pc ] keep
-  [ read-byte ] keep 
-  [ cpu-pc 1 + ] keep
-  set-cpu-pc ;
-
-: next-word ( cpu -- word )
-  #! Return the value of the word at PC, and increment PC.
-  [ cpu-pc ] keep
-  [ read-word ] keep 
-  [ cpu-pc 2 + ] keep
-  set-cpu-pc ;
-
-
-: write-byte ( value addr cpu -- )
-  #! Write a byte to the specified memory address.
-  over dup HEX: 2000 < swap HEX: FFFF > or [
-    3drop
-  ] [
-    3dup cpu-ram set-nth
-    update-video
-  ] if ;
-
-
-: write-word ( value addr cpu -- )
-  #! Write a 16-bit word to the specified memory address.
-  >r >r >word< r> r> [ write-byte ] 2keep >r 1 + r> write-byte ;
-
-: cpu-a-bitand ( quot cpu -- )
-  #! A &= quot call 
-  [ cpu-a swap call bitand ] keep set-cpu-a ; inline
-
-: cpu-a-bitor ( quot cpu -- )
-  #! A |= quot call 
-  [ cpu-a swap call bitor ] keep set-cpu-a ; inline
-
-: cpu-a-bitxor ( quot cpu -- )
-  #! A ^= quot call 
-  [ cpu-a swap call bitxor ] keep set-cpu-a ; inline
-
-: cpu-a-bitxor= ( value cpu -- )
-  #! cpu-a ^= value
-  [ cpu-a bitxor ] keep set-cpu-a ;
-
-: cpu-f-bitand ( quot cpu -- )
-  #! F &= quot call 
-  [ cpu-f swap call bitand ] keep set-cpu-f ; inline
-
-: cpu-f-bitor ( quot cpu -- )
-  #! F |= quot call 
-  [ cpu-f swap call bitor ] keep set-cpu-f ; inline
-
-: cpu-f-bitxor ( quot cpu -- )
-  #! F |= quot call 
-  [ cpu-f swap call bitxor ] keep set-cpu-f ; inline
-
-: cpu-f-bitor= ( value cpu -- )
-  #! cpu-f |= value
-  [ cpu-f bitor ] keep set-cpu-f ;
-
-: cpu-f-bitand= ( value cpu -- )
-  #! cpu-f &= value
-  [ cpu-f bitand ] keep set-cpu-f ;
-
-: cpu-f-bitxor= ( value cpu -- )
-  #! cpu-f ^= value
-  [ cpu-f bitxor ] keep set-cpu-f ;
-
-: set-flag ( cpu flag -- )
-  swap cpu-f-bitor= ;
-
-: clear-flag ( cpu flag -- )
-   bitnot HEX: FF bitand swap cpu-f-bitand= ;
-
-: update-zero-flag ( result cpu -- )
-  #! If the result of an instruction has the value 0, this
-  #! flag is set, otherwise it is reset.
-  swap HEX: FF bitand 0 = [ zero-flag set-flag ] [ zero-flag clear-flag ] if ;
-
-: update-sign-flag ( result cpu -- )
-  #! If the most significant bit of the result 
-  #! has the value 1 then the flag is set, otherwise
-  #! it is reset.
-  swap HEX: 80 bitand 0 = [ sign-flag clear-flag ] [ sign-flag set-flag ] if ;
-
-: update-parity-flag ( result cpu -- )
-  #! If the modulo 2 sum of the bits of the result
-  #! is 0, (ie. if the result has even parity) this flag
-  #! is set, otherwise it is reset.
-  swap HEX: FF bitand 2 mod 0 = [ parity-flag set-flag ] [ parity-flag clear-flag ] if ;
-
-: update-carry-flag ( result cpu -- )
-  #! If the instruction resulted in a carry (from addition) 
-  #! or a borrow (from subtraction or a comparison) out of the
-  #! higher order bit, this flag is set, otherwise it is reset.
-  swap dup HEX: 100 >= swap 0 < or [ carry-flag set-flag ] [ carry-flag clear-flag ] if ;
-
-: update-half-carry-flag ( original change-by result cpu -- )
-  #! If the instruction caused a carry out of bit 3 and into bit 4 of the
-  #! resulting value, the half carry flag is set, otherwise it is reset.
-  #! The 'original' is the original value of the register being changed.
-  #! 'change-by' is the amount it is being added or decremented by.
-  #! 'result' is the result of that change.
-  >r bitxor bitxor HEX: 10 bitand 0 = not r> 
-  swap [ half-carry-flag set-flag ] [ half-carry-flag clear-flag ] if ;
-
-: update-flags ( result cpu -- )
-  2dup update-carry-flag
-  2dup update-parity-flag
-  2dup update-sign-flag
-  update-zero-flag ;
-
-: update-flags-no-carry ( result cpu -- )
-  2dup update-parity-flag
-  2dup update-sign-flag
-  update-zero-flag ;
-
-: add-byte ( lhs rhs cpu -- result )
-  #! Add rhs to lhs
-  >r 2dup + r> ! lhs rhs result cpu
-  [ update-flags ] 2keep 
-  [ update-half-carry-flag ] 2keep
-  drop HEX: FF bitand ;
-
-: add-carry ( change-by result cpu -- change-by result )
-  #! Add the effect of the carry flag to the result
-  flag-c? [ 1 + >r 1 + r> ] when ;
-
-: add-byte-with-carry ( lhs rhs cpu -- result )
-  #! Add rhs to lhs plus carry.
-  >r 2dup + r> ! lhs rhs result cpu
-  [ add-carry ] keep
-  [ update-flags ] 2keep 
-  [ update-half-carry-flag ] 2keep
-  drop HEX: FF bitand ;
-
-: sub-carry ( change-by result cpu -- change-by result ) 
-  #! Subtract the effect of the carry flag from the result
-  flag-c? [ 1 - >r 1 - r>  ] when ;
-
-: sub-byte ( lhs rhs cpu -- result )
-  #! Subtract rhs from lhs
-  >r 2dup - r> 
-  [ update-flags ] 2keep 
-  [ update-half-carry-flag ] 2keep
-  drop HEX: FF bitand ;
-
-: sub-byte-with-carry ( lhs rhs cpu -- result )
-  #! Subtract rhs from lhs and take carry into account
-  >r 2dup - r> 
-  [ sub-carry ] keep 
-  [ update-flags ] 2keep 
-  [ update-half-carry-flag ] 2keep
-  drop HEX: FF bitand ;
-: inc-byte ( byte cpu -- result )
-  #! Increment byte by one. Note that carry flag is not affected
-  #! by this operation.
-  >r 1 2dup + r> ! lhs rhs result cpu
-  [ update-flags-no-carry ] 2keep 
-  [ update-half-carry-flag ] 2keep
-  drop HEX: FF bitand ;
-
-: dec-byte ( byte cpu -- result )
-  #! Decrement byte by one. Note that carry flag is not affected
-  #! by this operation.
-  >r 1 2dup - r> ! lhs rhs result cpu
-  [ update-flags-no-carry ] 2keep 
-  [ update-half-carry-flag ] 2keep
-  drop HEX: FF bitand ;
-
-: inc-word ( w cpu -- w )
-  #! Increment word by one. Note that no flags are modified.
-  drop 1 + HEX: FFFF bitand ;
-
-: dec-word ( w cpu -- w )
-  #! Decrement word by one. Note that no flags are modified.
-  drop 1 - HEX: FFFF bitand ;
-
-: add-word ( lhs rhs cpu -- result )
-  #! Add rhs to lhs. Note that only the carry flag is modified
-  #! and only if there is a carry out of the double precision add.
-  >r + r> over HEX: FFFF > [ carry-flag set-flag ] [ drop ] if HEX: FFFF bitand ;
-
-: bit3or ( lhs rhs -- 0|1 )
-  #! bitor bit 3 of the two numbers on the stack
-  BIN: 00001000 bitand -3 shift >r
-  BIN: 00001000 bitand -3 shift r> 
-  bitor ;
-
-: and-byte ( lhs rhs cpu -- result )
-  #! Logically and rhs to lhs. The carry flag is cleared and
-  #! the half carry is set to the ORing of bits 3 of the operands.
-  [ drop bit3or ] 3keep ! bit3or lhs rhs cpu
-  >r bitand r> [ update-flags ] 2keep 
-  [ carry-flag clear-flag ] keep
-  rot 0 = [ half-carry-flag set-flag ] [ half-carry-flag clear-flag ] if
-  HEX: FF bitand ;
-
-: xor-byte ( lhs rhs cpu -- result )
-  #! Logically xor rhs to lhs. The carry and half-carry flags are cleared.
-  >r bitxor r> [ update-flags ] 2keep 
-  [ half-carry-flag carry-flag bitor clear-flag ] keep
-  drop HEX: FF bitand ;
-
-: or-byte ( lhs rhs cpu -- result )
-  #! Logically or rhs to lhs. The carry and half-carry flags are cleared.
-  >r bitor r> [ update-flags ] 2keep 
-  [ half-carry-flag carry-flag bitor clear-flag ] keep
-  drop HEX: FF bitand ;
-
-: flags ( seq -- seq )
-  [ 0 [ execute bitor ] reduce ] map ;
-
-: decrement-sp ( n cpu -- )
-  #! Decrement the stackpointer by n.  
-  [ cpu-sp ] keep 
-  >r swap - r> set-cpu-sp ;
-
-: save-pc ( cpu -- )
-  #! Save the value of the PC on the stack.
-  [ cpu-pc ] keep ! pc cpu
-  [ cpu-sp ] keep ! pc sp cpu
-  write-word ;
-
-: push-pc ( cpu -- )
-  #! Push the value of the PC on the stack.
-  2 over decrement-sp
-  save-pc ;
-
-: pop-pc ( cpu -- pc )
-  #! Pop the value of the PC off the stack.
-  [ cpu-sp ] keep
-  [ read-word ] keep 
-  -2 swap decrement-sp ;
-
-: push-sp ( value cpu -- )
-  [ 2 swap decrement-sp ] keep
-  [ cpu-sp ] keep
-  write-word ;
-  
-: pop-sp ( cpu -- value )
-  [ cpu-sp ] keep
-  [ read-word ] keep
-  -2 swap decrement-sp ;
-
-: call-sub ( addr cpu -- )
-  #! Call the address as a subroutine.
-  dup push-pc 
-  >r HEX: FFFF bitand r> set-cpu-pc ;
-
-: ret-from-sub ( cpu -- )
-  [ pop-pc ] keep set-cpu-pc ;
-: interrupt ( number cpu -- )
-  #! Perform a hardware interrupt
-!  "***Interrupt: " write over 16 >base print 
-  dup cpu-f interrupt-flag bitand 0 = not [
-    dup push-pc
-    set-cpu-pc
-  ] [
-    2drop
-  ] if ;
-
-: inc-cycles ( n cpu -- )
-  #! Increment the number of cpu cycles
-  [ cpu-cycles + ] keep set-cpu-cycles ;
-  
-: instruction-cycles ( -- vector )
-  #! Return a 256 element vector containing the cycles for
-  #! each opcode in the 8080 instruction set.
-  { 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f } ;
-
-: instructions ( -- vector )
-  #! Return a 256 element vector containing the emulation words for
-  #! each opcode in the 8080 instruction set.
-  { 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
-    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f } ; inline
-
-: not-implemented ( <cpu> -- )
-  drop ;
-
-instructions length [ 
-  dup instructions nth [
-    drop
-  ] [
-    [ not-implemented ] swap instructions set-nth 
-  ] if
-] each
-
-M: cpu reset ( cpu -- )
-  #! Reset the CPU to its poweron state
-  [ 0 swap set-cpu-b  ] keep
-  [ 0 swap set-cpu-c  ] keep
-  [ 0 swap set-cpu-d  ] keep
-  [ 0 swap set-cpu-e  ] keep
-  [ 0 swap set-cpu-h  ] keep
-  [ 0 swap set-cpu-l  ] keep
-  [ 0 swap set-cpu-a  ] keep
-  [ 0 swap set-cpu-f  ] keep
-  [ 0 swap set-cpu-pc  ] keep
-  [ HEX: F000 swap set-cpu-sp  ] keep 
-  [ HEX: FFFF 0 <array> swap set-cpu-ram ] keep
-  [ f swap set-cpu-halted? ] keep
-  [ HEX: 10 swap set-cpu-last-interrupt ] keep
-  0 swap set-cpu-cycles ;
-
-C: cpu ( -- cpu )
-  [ reset ] keep ;
-
-: (load-rom) ( n ram -- )
-  read1 [ ! n ram ch
-    -rot [ set-nth ] 2keep >r 1 + r> (load-rom)
-  ] [
-    2drop
-  ] if* ;
-
-  #! Reads the ROM from stdin and stores it in ROM from
-  #! offset n.
-: load-rom ( filename <cpu> -- )
-  #! Load the contents of the file into ROM.
-  #! (address 0x0000-0x1FFF).
-  cpu-ram swap <file-reader> [ 
-    0 swap (load-rom)
-  ] with-stream ;
-
-: load-rom* ( addr filename <cpu> -- )
-  #! Load the contents of the file into ROM, starting at
-  #! the specified address.
-  cpu-ram swap <file-reader> [ 
-    (load-rom)
-  ] with-stream ;
-
-: read-instruction ( cpu -- word )
-  #! Read the next instruction from the cpu's program 
-  #! counter, and increment the program counter.
-  [ cpu-pc ] keep ! pc cpu
-  [ over 1 + swap set-cpu-pc ] keep
-  read-byte ;
-
-: get-cycles ( n -- opcode )
-  #! Returns the cycles for the given instruction value.
-  #! If the opcode is not defined throw an error.
-  dup instruction-cycles nth [ 
-    nip  
-  ] [
-    [ "Undefined 8080 opcode: " % number>string % ] "" make throw
-  ] if* ;
-
-: process-interrupts ( cpu -- )
-  #! Process any hardware interrupts
-  [ cpu-cycles ] keep 
-  over 16667 < [
-    2drop
-  ] [ 
-    [ >r 16667 - r> set-cpu-cycles ] keep
-    dup cpu-last-interrupt HEX: 10 = [
-      HEX: 08 over set-cpu-last-interrupt HEX: 08 swap interrupt
-    ] [
-      HEX: 10 over set-cpu-last-interrupt HEX: 10 swap interrupt
-    ] if     
-  ] if ;
-
-: step ( cpu -- )
-  #! Run a single 8080 instruction
-  [ read-instruction ] keep ! n cpu
-  over get-cycles over inc-cycles
-  [ swap instructions dispatch ] keep
-  [ cpu-pc HEX: FFFF bitand ] keep 
-  [ set-cpu-pc ] keep 
-  process-interrupts ;
-
-: peek-instruction ( cpu -- word )
-  #! Return the next instruction from the cpu's program
-  #! counter, but don't increment the counter.
-  [ cpu-pc ] keep read-byte instructions nth first ;
-
-: cpu. ( cpu -- )
-  [ " PC: " write cpu-pc 16 >base 4 CHAR: \s pad-left write ] keep 
-  [ " B: " write cpu-b 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " C: " write cpu-c 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " D: " write cpu-d 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " E: " write cpu-e 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " F: " write cpu-f 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " H: " write cpu-h 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " L: " write cpu-l 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " A: " write cpu-a 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " SP: " write cpu-sp 16 >base 4 CHAR: \s pad-left write ] keep 
-  [ " cycles: " write cpu-cycles number>string 5 CHAR: \s pad-left write ] keep 
-  [ " " write peek-instruction word-name write " " write ] keep
-  terpri drop ;
-
-: cpu*. ( cpu -- )
-  [ " PC: " write cpu-pc 16 >base 4 CHAR: \s pad-left write ] keep 
-  [ " B: " write cpu-b 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " C: " write cpu-c 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " D: " write cpu-d 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " E: " write cpu-e 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " F: " write cpu-f 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " H: " write cpu-h 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " L: " write cpu-l 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " A: " write cpu-a 16 >base 2 CHAR: \s pad-left write ] keep 
-  [ " SP: " write cpu-sp 16 >base 4 CHAR: \s pad-left write ] keep 
-  [ " cycles: " write cpu-cycles number>string 5 CHAR: \s pad-left write ] keep 
-  terpri drop ;
-
-: test-step ( cpu -- cpu )
-  [ step ] keep dup cpu. ;
-
-: test-cpu ( -- cpu )
-  <cpu> "invaders.rom" over load-rom dup cpu. ;
-
-: test-n ( n -- )
-  test-cpu swap [ test-step ] times ;
-
-: run-n ( cpu n -- cpu )
-  [ dup step ] times ;
-
-: register-lookup ( string -- vector )
-  #! Given a string containing a register name, return a vector
-  #! where the 1st item is the getter and the 2nd is the setter
-  #! for that register.
-  H{
-    { "A"  { cpu-a  set-cpu-a  } }
-    { "B"  { cpu-b  set-cpu-b  } }
-    { "C"  { cpu-c  set-cpu-c  } }
-    { "D"  { cpu-d  set-cpu-d  } }
-    { "E"  { cpu-e  set-cpu-e  } }
-    { "H"  { cpu-h  set-cpu-h  } }
-    { "L"  { cpu-l  set-cpu-l  } }
-    { "AF" { cpu-af set-cpu-af } }
-    { "BC" { cpu-bc set-cpu-bc } }
-    { "DE" { cpu-de set-cpu-de } }
-    { "HL" { cpu-hl set-cpu-hl } }
-    { "SP" { cpu-sp set-cpu-sp } }
-  } hash ;
-
-
-: flag-lookup ( string -- vector )
-  #! 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?  } }
-    { "Z"  { flag-z?  } }
-    { "C"  { flag-c? } }
-    { "P"  { flag-p?  } }
-    { "M" { flag-m?  } }
-  } hash ;
-
-SYMBOL: $1
-SYMBOL: $2
-SYMBOL: $3
-SYMBOL: $4
-
-: replace-patterns ( vector tree -- tree )
-  #! Copy the tree, replacing each occurence of 
-  #! $1, $2, etc with the relevant item from the 
-  #! given index.
-  dup quotation? over [ ] = not and [ ! vector tree
-    dup first swap 1 tail ! vector car cdr
-    >r dupd replace-patterns ! vector v R: cdr
-    swap r> replace-patterns >r unit r> append
-  ] [ ! vector value
-    dup $1 = [ drop 0 over nth  ] when 
-    dup $2 = [ drop 1 over nth  ] when 
-    dup $3 = [ drop 2 over nth  ] when 
-    dup $4 = [ drop 3 over nth  ] when 
-    nip
-  ] if ;
-
-: test-rp 
-  { 4 5 3 } [ 1 $2 [ $1 4 ] ] replace-patterns ;
-
-: (emulate-RST) ( n cpu -- )
-  #! RST nn
-  [ cpu-sp 2 - dup ] keep ! sp sp cpu
-  [ set-cpu-sp ] keep ! sp cpu
-  [ cpu-pc ] keep ! sp pc cpu
-  swapd [ write-word ] keep ! cpu
-  >r 8 * r> set-cpu-pc ;
-
-: (emulate-CALL) ( cpu -- )
-  #! 205 - CALL nn
-  [ next-word HEX: FFFF bitand ] keep ! addr cpu
-  [ cpu-sp 2 - dup ] keep ! addr sp sp cpu
-  [ set-cpu-sp ] keep ! addr sp cpu
-  [ cpu-pc ] keep ! addr sp pc cpu
-  swapd [ write-word ] keep ! addr cpu
-  set-cpu-pc ;
-
-: (emulate-RLCA) ( cpu -- )
-  #! The content of the accumulator is rotated left
-  #! one position. The low order bit and the carry flag
-  #! are both set to the value shifd out of the high
-  #! order bit position. Only the carry flag is affected.
-  [ cpu-a -7 shift ] keep 
-  over 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
-  [ cpu-a 1 shift HEX: FF bitand ] keep 
-  >r bitor r> set-cpu-a ;
-
-: (emulate-RRCA) ( cpu -- )
-  #! The content of the accumulator is rotated right
-  #! one position. The high order bit and the carry flag
-  #! are both set to the value shifd out of the low
-  #! order bit position. Only the carry flag is affected.
-  [ cpu-a 1 bitand 7 shift ] keep 
-  over 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
-  [ cpu-a 254 bitand -1 shift ] keep 
-  >r bitor r> set-cpu-a ;
-
-: (emulate-RLA) ( cpu -- )  
-  #! The content of the accumulator is rotated left
-  #! one position through the carry flag. The low
-  #! order bit is set equal to the carry flag and
-  #! the carry flag is set to the value shifd out 
-  #! of the high order bit. Only the carry flag is
-  #! affected.
-  [ carry-flag swap flag-set? [ 1 ] [ 0 ] if ] keep 
-  [ cpu-a 127 bitand 7 shift ] keep 
-  dup cpu-a 128 bitand 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
-  >r bitor r> set-cpu-a ;
-
-: (emulate-RRA) ( cpu -- )  
-  #! The content of the accumulator is rotated right
-  #! one position through the carry flag. The high order
-  #! bit is set to the carry flag and the carry flag is
-  #! set to the value shifd out of the low order bit. 
-  #! Only the carry flag is affected.
-  [ carry-flag swap flag-set? [ BIN: 10000000 ] [ 0 ] if ] keep 
-  [ cpu-a 254 bitand -1 shift ] keep 
-  dup cpu-a 1 bitand 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
-  >r bitor r> set-cpu-a ;
-
-: (emulate-CPL) ( cpu -- )  
-  #! The contents of the accumulator are complemented
-  #! (zero bits become one, one bits becomes zero).
-  #! No flags are affected.
-  HEX: FF swap cpu-a-bitxor= ;
-
-: (emulate-DAA) ( cpu -- )  
-  #! The eight bit number in the accumulator is
-  #! adjusted to form two four-bit binary-coded-decimal
-  #! digits.
-  [
-    dup half-carry-flag swap flag-set? swap 
-    cpu-a BIN: 1111 bitand 9 > or [ 6 ] [ 0 ] if 
-  ] keep 
-  [ cpu-a + ] keep
-  [ update-flags ] 2keep  
-  [ swap HEX: FF bitand swap set-cpu-a ] keep 
-  [
-    dup carry-flag swap flag-set? swap 
-    cpu-a -4 shift BIN: 1111 bitand 9 > or [ 96 ] [ 0 ] if 
-  ] keep 
-  [ cpu-a + ] keep
-  [ update-flags ] 2keep  
-  swap HEX: FF bitand swap set-cpu-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"      [ [ cpu-a ] keep [ next-byte ] keep sub-byte drop ] }
-    { "CP-R"      [ [ cpu-a ] keep [ $1 ] keep sub-byte drop  ] }
-    { "CP-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep sub-byte drop ] }
-    { "OR-N"      [ [ cpu-a ] keep [ next-byte ] keep [ or-byte ] keep set-cpu-a ] }
-    { "OR-R"      [ [ cpu-a ] keep [ $1 ] keep [ or-byte ] keep set-cpu-a ] }
-    { "OR-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ or-byte ] keep set-cpu-a  ] }
-    { "XOR-N"      [ [ cpu-a ] keep [ next-byte ] keep [ xor-byte ] keep set-cpu-a ] }
-    { "XOR-R"      [ [ cpu-a ] keep [ $1 ] keep [ xor-byte ] keep set-cpu-a ] }
-    { "XOR-(RR)"   [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ xor-byte ] keep set-cpu-a  ] }
-    { "AND-N"      [ [ cpu-a ] keep [ next-byte ] keep [ and-byte ] keep set-cpu-a  ] }
-    { "AND-R"      [ [ cpu-a ] keep [ $1 ] keep [ and-byte ] keep set-cpu-a ] }
-    { "AND-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ and-byte ] keep set-cpu-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"      [ [ cpu-a ] keep [ $1 ] keep [ sub-byte ] keep set-cpu-a ] }
-    { "SUB-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ sub-byte ] keep set-cpu-a ] }
-    { "SUB-N"      [ [ cpu-a ] keep [ next-byte ] keep [ sub-byte ] keep set-cpu-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"           [ [ cpu-pc ] keep [ read-word ] keep set-cpu-pc ]               }
-    { "JP-F|FF,NN"      [ [ $1 ] keep swap [ [ next-word ] keep [ set-cpu-pc ] keep [ cpu-cycles ] keep swap 5 + swap set-cpu-cycles ] [ [ cpu-pc 2 + ] keep set-cpu-pc ] if ] }
-    { "JP-(RR)"      [ [ $1 ] keep set-cpu-pc ] }
-    { "CALL-NN"         [ (emulate-CALL) ] }
-    { "CALL-F|FF,NN"    [ [ $1 ] keep swap [ 7 over inc-cycles (emulate-CALL) ] [ [ cpu-pc 2 + ] keep set-cpu-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 set-cpu-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 )
-  #! A parser for 8-bit registers. On a successfull parse the
-  #! parse tree contains a vector. The first item in the vector
-  #! is the getter word for that register with stack effect
-  #! ( cpu -- value ). The second item is the setter word with
-  #! stack effect ( value cpu -- ).
-  "A" token 
-  "B" token  <|>
-  "C" token  <|>
-  "D" token  <|>
-  "E" token  <|>
-  "H" token  <|>
-  "L" token  <|> [ register-lookup ] <@ ;
-
-: all-flags
-  #! A parser for 16-bit flags. 
-  "NZ" token  
-  "NC" token <|>
-  "PO" token <|>
-  "PE" token <|> 
-  "Z" token <|> 
-  "C" token <|> 
-  "P" token <|> 
-  "M" token <|> [ flag-lookup ] <@ ;
-
-: 16-bit-registers
-  #! A parser for 16-bit registers. On a successfull parse the
-  #! parse tree contains a vector. The first item in the vector
-  #! is the getter word for that register with stack effect
-  #! ( cpu -- value ). The second item is the setter word with
-  #! stack effect ( value cpu -- ).
-  "AF" token  
-  "BC" token <|>
-  "DE" token <|>
-  "HL" token <|>
-  "SP" token <|> [ register-lookup ] <@ ;
-
-: all-registers ( -- parser )
-  #! Return a parser that can parse the format
-  #! for 8 bit or 16 bit registers. 
-  8-bit-registers 16-bit-registers <|> ;
-
-: indirect ( parser -- parser )
-  #! Given a parser, return a parser which parses the original
-  #! wrapped in brackets, representing an indirect reference.
-  #! eg. BC -> (BC). The value of the original parser is left in
-  #! the parse tree.
-  "(" token swap &> ")" token <& ;
-
-: generate-instruction ( vector string -- quot )
-  #! Generate the quotation for an instruction, given the instruction in 
-  #! the 'string' and a vector containing the arguments for that instruction.
-  patterns hash replace-patterns ;
-
-: simple-instruction ( token -- parser )
-  #! Return a parser for then instruction identified by the token. 
-  #! The parser return parses the token only and expects no additional
-  #! arguments to the instruction.
-  token [ [ { } clone , , \ generate-instruction , ] [ ] make ] <@ ;
-
-: complex-instruction ( type token -- parser )
-  #! Return a parser for an instruction identified by the token. 
-  #! The instruction is expected to take additional arguments by 
-  #! being combined with other parsers. Then 'type' is used for a lookup
-  #! in a pattern hashtable to return the instruction quotation pattern.
-  token swap [ nip [ , \ generate-instruction , ] [ ] make ] curry <@ ;
-
-: NOP-instruction ( -- parser )
-  "NOP" simple-instruction ;
-
-: RET-NN-instruction ( -- parser )  
-  "RET-NN" "RET" complex-instruction  
-  "nn" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-0-instruction ( -- parser )  
-  "RST-0" "RST" complex-instruction  
-  "0" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-8-instruction ( -- parser )  
-  "RST-8" "RST" complex-instruction  
-  "8" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-10H-instruction ( -- parser )  
-  "RST-10H" "RST" complex-instruction  
-  "10H" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-18H-instruction ( -- parser )  
-  "RST-18H" "RST" complex-instruction  
-  "18H" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-20H-instruction ( -- parser )  
-  "RST-20H" "RST" complex-instruction  
-  "20H" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-28H-instruction ( -- parser )  
-  "RST-28H" "RST" complex-instruction  
-  "28H" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-30H-instruction ( -- parser )  
-  "RST-30H" "RST" complex-instruction  
-  "30H" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: RST-38H-instruction ( -- parser )  
-  "RST-38H" "RST" complex-instruction  
-  "38H" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: JP-NN-instruction ( -- parser )  
-  "JP-NN" "JP" complex-instruction  
-  "nn" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: JP-F|FF,NN-instruction ( -- parser )
-  "JP-F|FF,NN" "JP" complex-instruction  
-  all-flags sp <&> 
-  ",nn" token <&
-  just [ first2 swap curry ] <@ ;
-
-: JP-(RR)-instruction ( -- parser )
-  "JP-(RR)" "JP" complex-instruction  
-  16-bit-registers indirect sp <&>
-  just [ first2 swap curry ] <@ ;
-
-: CALL-NN-instruction ( -- parser )  
-  "CALL-NN" "CALL" complex-instruction  
-  "nn" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: CALL-F|FF,NN-instruction ( -- parser )
-  "CALL-F|FF,NN" "CALL" complex-instruction  
-  all-flags sp <&> 
-  ",nn" token <&
-  just [ first2 swap curry ] <@ ;
-
-: RLCA-instruction ( -- parser )
-  "RLCA" simple-instruction ;
-
-: RRCA-instruction ( -- parser )
-  "RRCA" simple-instruction ;
-
-: HALT-instruction ( -- parser )
-  "HALT" simple-instruction ;
-
-: DI-instruction ( -- parser )
-  "DI" simple-instruction ;
-
-: EI-instruction ( -- parser )
-  "EI" simple-instruction ;
-
-: CPL-instruction ( -- parser )
-  "CPL" simple-instruction ;
-
-: CCF-instruction ( -- parser )
-  "CCF" simple-instruction ;
-
-: SCF-instruction ( -- parser )
-  "SCF" simple-instruction ;
-
-: DAA-instruction ( -- parser )
-  "DAA" simple-instruction ;
-
-: RLA-instruction ( -- parser )
-  "RLA" simple-instruction ;
-
-: RRA-instruction ( -- parser )
-  "RRA" simple-instruction ;
-
-: DEC-R-instruction ( -- parser )
-  "DEC-R" "DEC" complex-instruction  8-bit-registers sp <&> 
-  just [ first2 swap curry ] <@ ;
-
-: DEC-RR-instruction ( -- parser )
-  "DEC-RR" "DEC" complex-instruction  16-bit-registers sp <&> 
-  just [ first2 swap curry ] <@ ;
-
-: DEC-(RR)-instruction ( -- parser )
-  "DEC-(RR)" "DEC" complex-instruction  
-  16-bit-registers indirect sp <&>
-  just [ first2 swap curry ] <@ ;
-
-: POP-RR-instruction ( -- parser )
-  "POP-RR" "POP" complex-instruction  all-registers sp <&> 
-  just [ first2 swap curry ] <@ ;
-
-: PUSH-RR-instruction ( -- parser )
-  "PUSH-RR" "PUSH" complex-instruction  all-registers sp <&> 
-  just [ first2 swap curry ] <@ ;
-
-: INC-R-instruction ( -- parser )
-  "INC-R" "INC" complex-instruction  8-bit-registers sp <&> 
-  just [ first2 swap curry ] <@ ;
-
-: INC-RR-instruction ( -- parser )
-  "INC-RR" "INC" complex-instruction  16-bit-registers sp <&> 
-  just [ first2 swap curry ] <@ ;
-   
-: INC-(RR)-instruction  ( -- parser )
-  "INC-(RR)" "INC" complex-instruction
-  all-registers indirect sp <&> just [ first2 swap curry ] <@ ;
-
-: RET-F|FF-instruction ( -- parser )
-  "RET-F|FF" "RET" complex-instruction  all-flags sp <&> 
-  just [ first2 swap curry ] <@ ;
-
-: AND-N-instruction ( -- parser )
-  "AND-N" "AND" complex-instruction
-  "n" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: AND-R-instruction  ( -- parser )
-  "AND-R" "AND" complex-instruction
-  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
-
-: AND-(RR)-instruction  ( -- parser )
-  "AND-(RR)" "AND" complex-instruction
-  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
-
-: XOR-N-instruction ( -- parser )
-  "XOR-N" "XOR" complex-instruction
-  "n" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: XOR-R-instruction  ( -- parser )
-  "XOR-R" "XOR" complex-instruction
-  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
-
-: XOR-(RR)-instruction  ( -- parser )
-  "XOR-(RR)" "XOR" complex-instruction
-  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
-
-: OR-N-instruction ( -- parser )
-  "OR-N" "OR" complex-instruction
-  "n" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: OR-R-instruction  ( -- parser )
-  "OR-R" "OR" complex-instruction
-  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
-
-: OR-(RR)-instruction  ( -- parser )
-  "OR-(RR)" "OR" complex-instruction
-  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
-
-: CP-N-instruction ( -- parser )
-  "CP-N" "CP" complex-instruction
-  "n" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: CP-R-instruction  ( -- parser )
-  "CP-R" "CP" complex-instruction
-  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
-
-: CP-(RR)-instruction  ( -- parser )
-  "CP-(RR)" "CP" complex-instruction
-  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
-
-: ADC-R,N-instruction ( -- parser )
-  "ADC-R,N" "ADC" complex-instruction
-  8-bit-registers sp <&>
-  ",n" token <& 
-  just [ first2 swap curry ] <@ ;  
-
-: ADC-R,R-instruction ( -- parser )
-  "ADC-R,R" "ADC" complex-instruction
-  8-bit-registers sp <&>
-  "," token <& 
-  8-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: ADC-R,(RR)-instruction ( -- parser )
-  "ADC-R,(RR)" "ADC" complex-instruction
-  8-bit-registers sp <&>
-  "," token <& 
-  16-bit-registers indirect <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: SBC-R,N-instruction ( -- parser )
-  "SBC-R,N" "SBC" complex-instruction
-  8-bit-registers sp <&>
-  ",n" token <& 
-  just [ first2 swap curry ] <@ ;  
-
-: SBC-R,R-instruction ( -- parser )
-  "SBC-R,R" "SBC" complex-instruction
-  8-bit-registers sp <&>
-  "," token <& 
-  8-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry  ] <@ ;  
-
-: SBC-R,(RR)-instruction ( -- parser )
-  "SBC-R,(RR)" "SBC" complex-instruction
-  8-bit-registers sp <&>
-  "," token <& 
-  16-bit-registers indirect  <&>
-  just [ first2 swap first2 swap >r swap append r> curry  ] <@ ;  
-
-: SUB-R-instruction ( -- parser )
-  "SUB-R" "SUB" complex-instruction
-  8-bit-registers sp <&>
-  just [ first2 swap curry ] <@ ;  
-
-: SUB-(RR)-instruction ( -- parser )
-  "SUB-(RR)" "SUB" complex-instruction
-  16-bit-registers indirect sp <&>
-  just [ first2 swap curry ] <@ ;  
-
-: SUB-N-instruction ( -- parser )
-  "SUB-N" "SUB" complex-instruction
-  "n" token sp <&
-  just [ { } clone swap curry  ] <@ ;
-
-: ADD-R,N-instruction ( -- parser )
-  "ADD-R,N" "ADD" complex-instruction
-  8-bit-registers sp <&>
-  ",n" token <& 
-  just [ first2 swap curry ] <@ ;  
-
-: ADD-R,R-instruction ( -- parser )
-  "ADD-R,R" "ADD" complex-instruction
-  8-bit-registers sp <&>
-  "," token <& 
-  8-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: ADD-RR,RR-instruction ( -- parser )
-  "ADD-RR,RR" "ADD" complex-instruction
-  16-bit-registers sp <&>
-  "," token <& 
-  16-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: ADD-R,(RR)-instruction ( -- parser )
-  "ADD-R,(RR)" "ADD" complex-instruction
-  8-bit-registers sp <&>
-  "," token <& 
-  16-bit-registers indirect <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-  
-: LD-RR,NN-instruction
-  #! LD BC,nn
-  "LD-RR,NN" "LD" complex-instruction
-  16-bit-registers sp <&>
-  ",nn" token <& 
-  just [ first2 swap curry ] <@ ;
-
-: LD-R,N-instruction
-  #! LD B,n
-  "LD-R,N" "LD" complex-instruction
-  8-bit-registers sp <&>
-  ",n" token <& 
-  just [ first2 swap curry ] <@ ;
-  
-: LD-(RR),N-instruction
-  "LD-(RR),N" "LD" complex-instruction
-  16-bit-registers indirect sp <&> 
-  ",n" token <&
-  just [ first2 swap curry ] <@ ;
-
-: LD-(RR),R-instruction
-  #! LD (BC),A
-  "LD-(RR),R" "LD" complex-instruction
-  16-bit-registers indirect sp <&> 
-  "," token <&
-  8-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: LD-R,R-instruction
-  "LD-R,R" "LD" complex-instruction
-  8-bit-registers sp <&> 
-  "," token <&
-  8-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: LD-RR,RR-instruction
-  "LD-RR,RR" "LD" complex-instruction
-  16-bit-registers sp <&> 
-  "," token <&
-  16-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: LD-R,(RR)-instruction
-  "LD-R,(RR)" "LD" complex-instruction
-  8-bit-registers sp <&> 
-  "," token <&
-  16-bit-registers indirect <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: LD-(NN),RR-instruction
-  "LD-(NN),RR" "LD" complex-instruction
-  "nn" token indirect sp <&
-  "," token <&
-  16-bit-registers <&>
-  just [ first2 swap curry ] <@ ;
-
-: LD-(NN),R-instruction
-  "LD-(NN),R" "LD" complex-instruction
-  "nn" token indirect sp <&
-  "," token <&
-  8-bit-registers <&>
-  just [ first2 swap curry ] <@ ;
-
-: LD-RR,(NN)-instruction
-  "LD-RR,(NN)" "LD" complex-instruction
-  16-bit-registers sp <&>
-  "," token <&
-  "nn" token indirect <&
-  just [ first2 swap curry ] <@ ;
-
-: LD-R,(NN)-instruction
-  "LD-R,(NN)" "LD" complex-instruction
-  8-bit-registers sp <&>
-  "," token <&
-  "nn" token indirect <&
-  just [ first2 swap curry ] <@ ;
-
-: OUT-(N),R-instruction
-  "OUT-(N),R" "OUT" complex-instruction
-  "n" token indirect sp <&
-  "," token <&
-  8-bit-registers <&>
-  just [ first2 swap curry ] <@ ;
-
-: IN-R,(N)-instruction
-  "IN-R,(N)" "IN" complex-instruction
-  8-bit-registers sp <&>
-  "," token <&
-  "n" token indirect <&
-  just [ first2 swap curry ] <@ ;
-
-: EX-(RR),RR-instruction
-  "EX-(RR),RR" "EX" complex-instruction
-  16-bit-registers indirect sp <&> 
-  "," token <&
-  16-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: EX-RR,RR-instruction
-  "EX-RR,RR" "EX" complex-instruction
-  16-bit-registers sp <&> 
-  "," token <&
-  16-bit-registers <&>
-  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
-
-: 8080-generator-parser
-  NOP-instruction 
-  RST-0-instruction <|> 
-  RST-8-instruction <|> 
-  RST-10H-instruction <|> 
-  RST-18H-instruction <|> 
-  RST-20H-instruction <|> 
-  RST-28H-instruction <|> 
-  RST-30H-instruction <|> 
-  RST-38H-instruction <|> 
-  JP-F|FF,NN-instruction <|> 
-  JP-NN-instruction <|> 
-  JP-(RR)-instruction <|> 
-  CALL-F|FF,NN-instruction <|> 
-  CALL-NN-instruction <|> 
-  CPL-instruction <|> 
-  CCF-instruction <|> 
-  SCF-instruction <|> 
-  DAA-instruction <|> 
-  RLA-instruction <|> 
-  RRA-instruction <|> 
-  RLCA-instruction <|> 
-  RRCA-instruction <|> 
-  HALT-instruction <|> 
-  DI-instruction <|> 
-  EI-instruction <|> 
-  AND-N-instruction <|> 
-  AND-R-instruction <|> 
-  AND-(RR)-instruction <|> 
-  XOR-N-instruction <|> 
-  XOR-R-instruction <|> 
-  XOR-(RR)-instruction <|> 
-  OR-N-instruction <|> 
-  OR-R-instruction <|> 
-  OR-(RR)-instruction <|> 
-  CP-N-instruction <|> 
-  CP-R-instruction <|> 
-  CP-(RR)-instruction <|> 
-  DEC-RR-instruction <|> 
-  DEC-R-instruction <|> 
-  DEC-(RR)-instruction <|> 
-  POP-RR-instruction <|> 
-  PUSH-RR-instruction <|> 
-  INC-RR-instruction <|> 
-  INC-R-instruction <|> 
-  INC-(RR)-instruction <|>
-  LD-RR,NN-instruction <|> 
-  LD-R,N-instruction <|> 
-  LD-R,R-instruction <|> 
-  LD-RR,RR-instruction <|> 
-  LD-(RR),N-instruction <|> 
-  LD-(RR),R-instruction <|> 
-  LD-R,(RR)-instruction <|> 
-  LD-(NN),RR-instruction <|> 
-  LD-(NN),R-instruction <|> 
-  LD-RR,(NN)-instruction <|> 
-  LD-R,(NN)-instruction <|> 
-  ADC-R,N-instruction <|> 
-  ADC-R,R-instruction <|> 
-  ADC-R,(RR)-instruction <|> 
-  ADD-R,N-instruction <|> 
-  ADD-R,R-instruction <|> 
-  ADD-RR,RR-instruction <|> 
-  ADD-R,(RR)-instruction <|> 
-  SBC-R,N-instruction <|> 
-  SBC-R,R-instruction <|> 
-  SBC-R,(RR)-instruction <|> 
-  SUB-R-instruction <|> 
-  SUB-(RR)-instruction <|> 
-  SUB-N-instruction <|> 
-  RET-F|FF-instruction <|> 
-  RET-NN-instruction <|>
-  OUT-(N),R-instruction <|>
-  IN-R,(N)-instruction <|>
-  EX-(RR),RR-instruction <|>
-  EX-RR,RR-instruction <|>
-  just ;
-
-: instruction-quotations ( string -- emulate-quot )
-  #! Given an instruction string, return the emulation quotation for
-  #! it. This will later be expanded to produce the disassembly and
-  #! assembly quotations.
-  8080-generator-parser some parse force call ;
-
-SYMBOL: last-instruction
-SYMBOL: last-opcode
-
-: parse-instructions ( list -- emulate-quot )
-  #! Process the list of strings, which should make
-  #! up an 8080 instruction, and output a quotation
-  #! that would implement that instruction.
-  dup " " join instruction-quotations
-  >r "_" join [ "emulate-" % % ] "" make create-in dup last-instruction global set-hash  
-  r> define-compound ;
-
-: INSTRUCTION: string-mode on [ string-mode off parse-instructions ] f ; parsing
-
-: cycles ( -- )
-  #! Set the number of cycles for the last instruction that was defined. 
-  scan string>number last-opcode global hash instruction-cycles set-nth ; parsing
-
-: opcode ( -- )
-  #! Set the opcode number for the last instruction that was defined.
-  last-instruction global hash unit scan 16 base>
-  dup last-opcode global set-hash instructions set-nth ; parsing
-
-INSTRUCTION: NOP          ; opcode 00 cycles 04 
-INSTRUCTION: LD   BC,nn   ; opcode 01 cycles 10 
-INSTRUCTION: LD   (BC),A  ; opcode 02 cycles 07 
-INSTRUCTION: INC  BC      ; opcode 03 cycles 06 
-INSTRUCTION: INC  B       ; opcode 04 cycles 05 
-INSTRUCTION: DEC  B       ; opcode 05 cycles 05 
-INSTRUCTION: LD   B,n     ; opcode 06 cycles 07 
-INSTRUCTION: RLCA         ; opcode 07 cycles 04 
-INSTRUCTION: NOP          ; opcode 08 cycles 04 
-INSTRUCTION: ADD  HL,BC   ; opcode 09 cycles 11 
-INSTRUCTION: LD   A,(BC)  ; opcode 0A cycles 07 
-INSTRUCTION: DEC  BC      ; opcode 0B cycles 06 
-INSTRUCTION: INC  C       ; opcode 0C cycles 05 
-INSTRUCTION: DEC  C       ; opcode 0D cycles 05 
-INSTRUCTION: LD   C,n     ; opcode 0E cycles 07 
-INSTRUCTION: RRCA         ; opcode 0F cycles 04 
-INSTRUCTION: LD   DE,nn   ; opcode 11 cycles 10 
-INSTRUCTION: LD   (DE),A  ; opcode 12 cycles 07 
-INSTRUCTION: INC  DE      ; opcode 13 cycles 06 
-INSTRUCTION: INC  D       ; opcode 14 cycles 05 
-INSTRUCTION: DEC  D       ; opcode 15 cycles 05 
-INSTRUCTION: LD   D,n     ; opcode 16 cycles 07 
-INSTRUCTION: RLA          ; opcode 17 cycles 04 
-INSTRUCTION: ADD  HL,DE   ; opcode 19 cycles 11 
-INSTRUCTION: LD   A,(DE)  ; opcode 1A cycles 07 
-INSTRUCTION: DEC  DE      ; opcode 1B cycles 06 
-INSTRUCTION: INC  E       ; opcode 1C cycles 05 
-INSTRUCTION: DEC  E       ; opcode 1D cycles 05 
-INSTRUCTION: LD   E,n     ; opcode 1E cycles 07 
-INSTRUCTION: RRA          ; opcode 1F cycles 04 
-INSTRUCTION: LD   HL,nn   ; opcode 21 cycles 10 
-INSTRUCTION: LD   (nn),HL ; opcode 22 cycles 16 
-INSTRUCTION: INC  HL      ; opcode 23 cycles 06 
-INSTRUCTION: INC  H       ; opcode 24 cycles 05 
-INSTRUCTION: DEC  H       ; opcode 25 cycles 05 
-INSTRUCTION: LD   H,n     ; opcode 26 cycles 07 
-INSTRUCTION: DAA          ; opcode 27 cycles 04 
-INSTRUCTION: ADD  HL,HL   ; opcode 29 cycles 11 
-INSTRUCTION: LD   HL,(nn) ; opcode 2A cycles 16 
-INSTRUCTION: DEC  HL      ; opcode 2B cycles 06 
-INSTRUCTION: INC  L       ; opcode 2C cycles 05 
-INSTRUCTION: DEC  L       ; opcode 2D cycles 05 
-INSTRUCTION: LD   L,n     ; opcode 2E cycles 07 
-INSTRUCTION: CPL          ; opcode 2F cycles 04 
-INSTRUCTION: LD   SP,nn   ; opcode 31 cycles 10 
-INSTRUCTION: LD   (nn),A  ; opcode 32 cycles 13 
-INSTRUCTION: INC  SP      ; opcode 33 cycles 06 
-INSTRUCTION: INC  (HL)    ; opcode 34 cycles 10 
-INSTRUCTION: DEC  (HL)    ; opcode 35 cycles 10 
-INSTRUCTION: LD   (HL),n  ; opcode 36 cycles 10 
-INSTRUCTION: SCF          ; opcode 37 cycles 04 
-INSTRUCTION: ADD  HL,SP   ; opcode 39 cycles 11 
-INSTRUCTION: LD   A,(nn)  ; opcode 3A cycles 13 
-INSTRUCTION: DEC  SP      ; opcode 3B cycles 06 
-INSTRUCTION: INC  A       ; opcode 3C cycles 05 
-INSTRUCTION: DEC  A       ; opcode 3D cycles 05 
-INSTRUCTION: LD   A,n     ; opcode 3E cycles 07 
-INSTRUCTION: CCF          ; opcode 3F cycles 04 
-INSTRUCTION: LD   B,B     ; opcode 40 cycles 05 
-INSTRUCTION: LD   B,C     ; opcode 41 cycles 05 
-INSTRUCTION: LD   B,D     ; opcode 42 cycles 05 
-INSTRUCTION: LD   B,E     ; opcode 43 cycles 05 
-INSTRUCTION: LD   B,H     ; opcode 44 cycles 05 
-INSTRUCTION: LD   B,L     ; opcode 45 cycles 05 
-INSTRUCTION: LD   B,(HL)  ; opcode 46 cycles 07 
-INSTRUCTION: LD   B,A     ; opcode 47 cycles 05 
-INSTRUCTION: LD   C,B     ; opcode 48 cycles 05 
-INSTRUCTION: LD   C,C     ; opcode 49 cycles 05 
-INSTRUCTION: LD   C,D     ; opcode 4A cycles 05 
-INSTRUCTION: LD   C,E     ; opcode 4B cycles 05 
-INSTRUCTION: LD   C,H     ; opcode 4C cycles 05 
-INSTRUCTION: LD   C,L     ; opcode 4D cycles 05 
-INSTRUCTION: LD   C,(HL)  ; opcode 4E cycles 07 
-INSTRUCTION: LD   C,A     ; opcode 4F cycles 05 
-INSTRUCTION: LD   D,B     ; opcode 50 cycles 05 
-INSTRUCTION: LD   D,C     ; opcode 51 cycles 05 
-INSTRUCTION: LD   D,D     ; opcode 52 cycles 05 
-INSTRUCTION: LD   D,E     ; opcode 53 cycles 05 
-INSTRUCTION: LD   D,H     ; opcode 54 cycles 05 
-INSTRUCTION: LD   D,L     ; opcode 55 cycles 05 
-INSTRUCTION: LD   D,(HL)  ; opcode 56 cycles 07 
-INSTRUCTION: LD   D,A     ; opcode 57 cycles 05 
-INSTRUCTION: LD   E,B     ; opcode 58 cycles 05 
-INSTRUCTION: LD   E,C     ; opcode 59 cycles 05 
-INSTRUCTION: LD   E,D     ; opcode 5A cycles 05 
-INSTRUCTION: LD   E,E     ; opcode 5B cycles 05 
-INSTRUCTION: LD   E,H     ; opcode 5C cycles 05 
-INSTRUCTION: LD   E,L     ; opcode 5D cycles 05 
-INSTRUCTION: LD   E,(HL)  ; opcode 5E cycles 07 
-INSTRUCTION: LD   E,A     ; opcode 5F cycles 05 
-INSTRUCTION: LD   H,B     ; opcode 60 cycles 05 
-INSTRUCTION: LD   H,C     ; opcode 61 cycles 05 
-INSTRUCTION: LD   H,D     ; opcode 62 cycles 05 
-INSTRUCTION: LD   H,E     ; opcode 63 cycles 05 
-INSTRUCTION: LD   H,H     ; opcode 64 cycles 05 
-INSTRUCTION: LD   H,L     ; opcode 65 cycles 05 
-INSTRUCTION: LD   H,(HL)  ; opcode 66 cycles 07 
-INSTRUCTION: LD   H,A     ; opcode 67 cycles 05 
-INSTRUCTION: LD   L,B     ; opcode 68 cycles 05 
-INSTRUCTION: LD   L,C     ; opcode 69 cycles 05 
-INSTRUCTION: LD   L,D     ; opcode 6A cycles 05 
-INSTRUCTION: LD   L,E     ; opcode 6B cycles 05 
-INSTRUCTION: LD   L,H     ; opcode 6C cycles 05 
-INSTRUCTION: LD   L,L     ; opcode 6D cycles 05 
-INSTRUCTION: LD   L,(HL)  ; opcode 6E cycles 07 
-INSTRUCTION: LD   L,A     ; opcode 6F cycles 05 
-INSTRUCTION: LD   (HL),B  ; opcode 70 cycles 07 
-INSTRUCTION: LD   (HL),C  ; opcode 71 cycles 07 
-INSTRUCTION: LD   (HL),D  ; opcode 72 cycles 07 
-INSTRUCTION: LD   (HL),E  ; opcode 73 cycles 07 
-INSTRUCTION: LD   (HL),H  ; opcode 74 cycles 07 
-INSTRUCTION: LD   (HL),L  ; opcode 75 cycles 07 
-INSTRUCTION: HALT         ; opcode 76 cycles 07 
-INSTRUCTION: LD   (HL),A  ; opcode 77 cycles 07 
-INSTRUCTION: LD   A,B     ; opcode 78 cycles 05 
-INSTRUCTION: LD   A,C     ; opcode 79 cycles 05 
-INSTRUCTION: LD   A,D     ; opcode 7A cycles 05 
-INSTRUCTION: LD   A,E     ; opcode 7B cycles 05 
-INSTRUCTION: LD   A,H     ; opcode 7C cycles 05 
-INSTRUCTION: LD   A,L     ; opcode 7D cycles 05 
-INSTRUCTION: LD   A,(HL)  ; opcode 7E cycles 07 
-INSTRUCTION: LD   A,A     ; opcode 7F cycles 05 
-INSTRUCTION: ADD  A,B     ; opcode 80 cycles 04 
-INSTRUCTION: ADD  A,C     ; opcode 81 cycles 04 
-INSTRUCTION: ADD  A,D     ; opcode 82 cycles 04 
-INSTRUCTION: ADD  A,E     ; opcode 83 cycles 04 
-INSTRUCTION: ADD  A,H     ; opcode 84 cycles 04 
-INSTRUCTION: ADD  A,L     ; opcode 85 cycles 04 
-INSTRUCTION: ADD  A,(HL)  ; opcode 86 cycles 07 
-INSTRUCTION: ADD  A,A     ; opcode 87 cycles 04 
-INSTRUCTION: ADC  A,B     ; opcode 88 cycles 04 
-INSTRUCTION: ADC  A,C     ; opcode 89 cycles 04 
-INSTRUCTION: ADC  A,D     ; opcode 8A cycles 04 
-INSTRUCTION: ADC  A,E     ; opcode 8B cycles 04 
-INSTRUCTION: ADC  A,H     ; opcode 8C cycles 04 
-INSTRUCTION: ADC  A,L     ; opcode 8D cycles 04 
-INSTRUCTION: ADC  A,(HL)  ; opcode 8E cycles 07 
-INSTRUCTION: ADC  A,A     ; opcode 8F cycles 04 
-INSTRUCTION: SUB  B       ; opcode 90 cycles 04 
-INSTRUCTION: SUB  C       ; opcode 91 cycles 04 
-INSTRUCTION: SUB  D       ; opcode 92 cycles 04 
-INSTRUCTION: SUB  E       ; opcode 93 cycles 04 
-INSTRUCTION: SUB  H       ; opcode 94 cycles 04 
-INSTRUCTION: SUB  L       ; opcode 95 cycles 04 
-INSTRUCTION: SUB  (HL)    ; opcode 96 cycles 07 
-INSTRUCTION: SUB  A       ; opcode 97 cycles 04 
-INSTRUCTION: SBC  A,B     ; opcode 98 cycles 04 
-INSTRUCTION: SBC  A,C     ; opcode 99 cycles 04 
-INSTRUCTION: SBC  A,D     ; opcode 9A cycles 04 
-INSTRUCTION: SBC  A,E     ; opcode 9B cycles 04 
-INSTRUCTION: SBC  A,H     ; opcode 9C cycles 04 
-INSTRUCTION: SBC  A,L     ; opcode 9D cycles 04 
-INSTRUCTION: SBC  A,(HL)  ; opcode 9E cycles 07 
-INSTRUCTION: SBC  A,A     ; opcode 9F cycles 04 
-INSTRUCTION: AND  B       ; opcode A0 cycles 04 
-INSTRUCTION: AND  C       ; opcode A1 cycles 04 
-INSTRUCTION: AND  D       ; opcode A2 cycles 04 
-INSTRUCTION: AND  E       ; opcode A3 cycles 04 
-INSTRUCTION: AND  H       ; opcode A4 cycles 04 
-INSTRUCTION: AND  L       ; opcode A5 cycles 04 
-INSTRUCTION: AND  (HL)    ; opcode A6 cycles 07 
-INSTRUCTION: AND  A       ; opcode A7 cycles 04 
-INSTRUCTION: XOR  B       ; opcode A8 cycles 04 
-INSTRUCTION: XOR  C       ; opcode A9 cycles 04 
-INSTRUCTION: XOR  D       ; opcode AA cycles 04 
-INSTRUCTION: XOR  E       ; opcode AB cycles 04 
-INSTRUCTION: XOR  H       ; opcode AC cycles 04 
-INSTRUCTION: XOR  L       ; opcode AD cycles 04 
-INSTRUCTION: XOR  (HL)    ; opcode AE cycles 07 
-INSTRUCTION: XOR  A       ; opcode AF cycles 04 
-INSTRUCTION: OR   B       ; opcode B0 cycles 04 
-INSTRUCTION: OR   C       ; opcode B1 cycles 04 
-INSTRUCTION: OR   D       ; opcode B2 cycles 04 
-INSTRUCTION: OR   E       ; opcode B3 cycles 04 
-INSTRUCTION: OR   H       ; opcode B4 cycles 04 
-INSTRUCTION: OR   L       ; opcode B5 cycles 04 
-INSTRUCTION: OR   (HL)    ; opcode B6 cycles 07 
-INSTRUCTION: OR   A       ; opcode B7 cycles 04 
-INSTRUCTION: CP   B       ; opcode B8 cycles 04 
-INSTRUCTION: CP   C       ; opcode B9 cycles 04 
-INSTRUCTION: CP   D       ; opcode BA cycles 04 
-INSTRUCTION: CP   E       ; opcode BB cycles 04 
-INSTRUCTION: CP   H       ; opcode BC cycles 04 
-INSTRUCTION: CP   L       ; opcode BD cycles 04 
-INSTRUCTION: CP   (HL)    ; opcode BE cycles 07 
-INSTRUCTION: CP   A       ; opcode BF cycles 04 
-INSTRUCTION: RET  NZ      ; opcode C0 cycles 05 
-INSTRUCTION: POP  BC      ; opcode C1 cycles 10 
-INSTRUCTION: JP   NZ,nn   ; opcode C2 cycles 10 
-INSTRUCTION: JP   nn      ; opcode C3 cycles 10 
-INSTRUCTION: CALL NZ,nn   ; opcode C4 cycles 11 
-INSTRUCTION: PUSH BC      ; opcode C5 cycles 11 
-INSTRUCTION: ADD  A,n     ; opcode C6 cycles 07 
-INSTRUCTION: RST  0       ; opcode C7 cycles 11 
-INSTRUCTION: RET  Z       ; opcode C8 cycles 05 
-INSTRUCTION: RET  nn      ; opcode C9 cycles 10 
-INSTRUCTION: JP   Z,nn    ; opcode CA cycles 10 
-INSTRUCTION: CALL Z,nn    ; opcode CC cycles 11 
-INSTRUCTION: CALL nn      ; opcode CD cycles 17 
-INSTRUCTION: ADC  A,n     ; opcode CE cycles 07 
-INSTRUCTION: RST  8       ; opcode CF cycles 11 
-INSTRUCTION: RET  NC      ; opcode D0 cycles 05 
-INSTRUCTION: POP  DE      ; opcode D1 cycles 10 
-INSTRUCTION: JP   NC,nn   ; opcode D2 cycles 10 
-INSTRUCTION: OUT  (n),A   ; opcode D3 cycles 10 
-INSTRUCTION: CALL NC,nn   ; opcode D4 cycles 11 
-INSTRUCTION: PUSH DE      ; opcode D5 cycles 11 
-INSTRUCTION: SUB  n       ; opcode D6 cycles 07 
-INSTRUCTION: RST  10H     ; opcode D7 cycles 11 
-INSTRUCTION: RET  C       ; opcode D8 cycles 05 
-INSTRUCTION: JP   C,nn    ; opcode DA cycles 10 
-INSTRUCTION: IN   A,(n)   ; opcode DB cycles 10 
-INSTRUCTION: CALL C,nn    ; opcode DC cycles 11 
-INSTRUCTION: SBC  A,n     ; opcode DE cycles 07 
-INSTRUCTION: RST  18H     ; opcode DF cycles 11 
-INSTRUCTION: RET  PO      ; opcode E0 cycles 05 
-INSTRUCTION: POP  HL      ; opcode E1 cycles 10 
-INSTRUCTION: JP   PO,nn   ; opcode E2 cycles 10 
-INSTRUCTION: EX   (SP),HL ; opcode E3 cycles 04 
-INSTRUCTION: CALL PO,nn   ; opcode E4 cycles 11 
-INSTRUCTION: PUSH HL      ; opcode E5 cycles 11 
-INSTRUCTION: AND  n       ; opcode E6 cycles 07 
-INSTRUCTION: RST  20H     ; opcode E7 cycles 11 
-INSTRUCTION: RET  PE      ; opcode E8 cycles 05 
-INSTRUCTION: JP   (HL)    ; opcode E9 cycles 04 
-INSTRUCTION: JP   PE,nn   ; opcode EA cycles 10 
-INSTRUCTION: EX   DE,HL   ; opcode EB cycles 04 
-INSTRUCTION: CALL PE,nn   ; opcode EC cycles 11 
-INSTRUCTION: XOR  n       ; opcode EE cycles 07 
-INSTRUCTION: RST  28H     ; opcode EF cycles 11 
-INSTRUCTION: RET  P       ; opcode F0 cycles 05 
-INSTRUCTION: POP  AF      ; opcode F1 cycles 10 
-INSTRUCTION: JP   P,nn    ; opcode F2 cycles 10 
-INSTRUCTION: DI           ; opcode F3 cycles 04 
-INSTRUCTION: CALL P,nn    ; opcode F4 cycles 11 
-INSTRUCTION: PUSH AF      ; opcode F5 cycles 11 
-INSTRUCTION: OR   n       ; opcode F6 cycles 07 
-INSTRUCTION: RST  30H     ; opcode F7 cycles 11 
-INSTRUCTION: RET  M       ; opcode F8 cycles 05 
-INSTRUCTION: LD   SP,HL   ; opcode F9 cycles 06 
-INSTRUCTION: JP   M,nn    ; opcode FA cycles 10 
-INSTRUCTION: EI           ; opcode FB cycles 04 
-INSTRUCTION: CALL M,nn    ; opcode FC cycles 11 
-INSTRUCTION: CP   n       ; opcode FE cycles 07 
-INSTRUCTION: RST  38H     ; opcode FF cycles 11 
-
-: each-8bit ( n quot -- )
-  8 [ ! n quot bit
-   pick over -1 * shift 1 bitand pick call 
-  ] repeat 2drop ;
-
-: >ppm ( cpu filename -- cpu )
-  #! Dump the current screen image to a ppm image file with the given name.
-  <file-writer> [
-    "P3" print
-    "256 224" print
-    "1" print
-    224 [
-      32 [
-        over 32 * over +  HEX: 2400 + ! cpu h w addr
-        >r pick r> swap cpu-ram nth [
-          0 = [
-            " 0 0 0" write
-          ] [
-            " 1 1 1" write
-          ] if
-        ] each-8bit
-      ] repeat terpri
-    ] repeat
-  ] with-stream ;
-
-USE: test
-: time-test ( -- )
-  test-cpu [ 1000000 run-n ] time ;
-
diff --git a/apps/space-invaders/load.factor b/apps/space-invaders/load.factor
deleted file mode 100644 (file)
index 6109d17..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-REQUIRES: libs/parser-combinators libs/concurrency ;
-
-PROVIDE: apps/space-invaders
-{ +files+ {
-       "cpu-8080.factor"
-       "space-invaders.factor"
-} } ;
-
-USE: space-invaders
-
-MAIN: apps/space-invaders run ;
diff --git a/apps/space-invaders/readme.txt b/apps/space-invaders/readme.txt
deleted file mode 100644 (file)
index cda70ae..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-This is a simple space invaders emulator. The goal is to produce an
-emulator, disassembler and assembler for the 8080 processor.
-
-It is integrated into the Factor module system, the following will
-load all necessary files and run it:
-
-  "contrib/space-invaders" run-module
-
-For this to work it needs a ROM file called 'invaders.rom' in the
-factor root directory.
-
-'Backspace' inserts a coin, '1' is the one player button and '2' is
-the two play button. The left and right arrow keys move and the up
-arrow key fires.
-
-If the ROM file you have is split into seperate files, you will need
-to merge them into one 'invaders.rom' file. From Windows this is done
-with:
-
-  copy /b invaders.h+invaders.g+invaders.f+invaders.e invaders.rom
-
-Or Linux:
-
-  cat invaders.h invaders.g invaders.f invaders.e >invaders.rom
-
-The emulator is actually a generic Intel 8080 and the code for this is
-in cpu-8080.factor. The space invaders specific code is in
-space-invaders.factor. It specializes generic functions defined by the
-8080 emulator code to handle the space invaders display and
-input/output ports.
-
-Current Issues:
-
-1) The Escape key does not close the GUI. It does stop the CPU
-   emulation process though.
-
-2) The best way of stopping if to just close the GUI window.
-
-For more information, contact the author, Chris Double, at
-chris.double@double.co.nz or from my weblog
-http://www.bluishcoder.co.nz
diff --git a/apps/space-invaders/space-invaders.factor b/apps/space-invaders/space-invaders.factor
deleted file mode 100644 (file)
index 459b877..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-USING: alien cpu-8080 errors generic io kernel kernel-internals
-math namespaces sequences styles threads gadgets gadgets opengl arrays 
-concurrency ;
-IN: space-invaders
-
-TUPLE: space-invaders port1 port2i port2o port3o port4lo port4hi port5o bitmap ;
-
-: dip ( x y quot -- y )
-  #! Showing my Joy roots...
-  swap >r call r> ; inline
-
-: dipd ( x y z quot -- y z )
-  #! Showing my Joy roots...
-  -rot >r >r call r> r> ; inline  
-
-: game-width 224  ; inline
-: game-height 256 ; inline
-
-: make-opengl-bitmap ( -- array )
-  game-height game-width 3 * * "char" <c-array> ;
-
-: bitmap-index ( point -- index )
-  #! Point is a {x y}.
-  first2 game-width 3 * * swap 3 * + ;
-
-: set-bitmap-pixel ( color point array -- )
-  #! 'color' is a {r g b}. Point is {x y}.
-  [ bitmap-index ] dip ! color index array
-  [ [ first ] dipd set-uchar-nth ] 3keep
-  [ [ second ] dipd [ 1 + ] dip set-uchar-nth ] 3keep
-  [ third ] dipd [ 2 + ] dip set-uchar-nth ;
-
-: get-bitmap-pixel ( point array -- color )
-  #! Point is a {x y}. color is a {r g b} 
-  [ bitmap-index ] dip
-  [ uint-nth ] 2keep
-  [ [ 1 + ] dip uchar-nth ] 2keep
-  [ 2 + ] dip uchar-nth 3array ;
-  
-C: space-invaders ( -- cpu )
-  [ <cpu> swap set-delegate ] keep
-  [ make-opengl-bitmap swap set-space-invaders-bitmap ] keep
-  [ reset ] keep ;
-
-: read-port1 ( cpu -- byte )
-  #! Port 1 maps the keys for space invaders
-  #! Bit 0 = coin slot
-  #! Bit 1 = two players button
-  #! Bit 2 = one player button
-  #! Bit 4 = player one fire
-  #! Bit 5 = player one left
-  #! Bit 6 = player one right
-  [ space-invaders-port1 dup HEX: FE bitand ] keep 
- set-space-invaders-port1 ;
-
-: read-port2 ( cpu -- byte )
-  #! Port 2 maps player 2 controls and dip switches
-  #! Bit 0,1 = number of ships
-  #! Bit 2   = mode (1=easy, 0=hard)
-  #! Bit 4   = player two fire
-  #! Bit 5   = player two left
-  #! Bit 6   = player two right
-  #! Bit 7   = show or hide coin info
-  [ space-invaders-port2i HEX: 8F bitand ] keep 
-  space-invaders-port1 HEX: 70 bitand bitor ;
-
-: read-port3 ( cpu -- byte )
-  #! Used to compute a special formula
-  [ space-invaders-port4hi 8 shift ] keep 
-  [ space-invaders-port4lo bitor ] keep 
-  space-invaders-port2o shift -8 shift HEX: FF bitand ;
-
-M: space-invaders read-port ( port cpu -- byte )
-  #! Read a byte from the hardware port. 'port' should
-  #! be an 8-bit value.
-  {
-    { [ over 1 = ] [ nip read-port1 ] }
-    { [ over 2 = ] [ nip read-port2 ] }
-    { [ over 3 = ] [ nip read-port3 ] }
-    { [ t ]        [ 2drop 0 ] }    
-  } cond ;
-
-: write-port2 ( value cpu -- )
-  #! Setting this value affects the value read from port 3
-  set-space-invaders-port2o ;
-
-: write-port3 ( value cpu -- )
-  #! Connected to the sound hardware
-  #! Bit 0 = spaceship sound (looped)
-  #! Bit 1 = Shot 
-  #! Bit 2 = Your ship hit
-  #! Bit 3 = Invader hit
-  #! Bit 4 = Extended play sound
-  set-space-invaders-port3o ;
-
-: write-port4 ( value cpu -- )
-  #! Affects the value returned by reading port 3
-  [ space-invaders-port4hi ] keep 
-  [ set-space-invaders-port4lo ] keep 
-  set-space-invaders-port4hi ;
-
-: write-port5 ( value cpu -- )
-  #! Plays sounds
-  #! Bit 0 = invaders sound 1
-  #! Bit 1 = invaders sound 2
-  #! Bit 2 = invaders sound 3
-  #! Bit 3 = invaders sound 4
-  #! Bit 4 = spaceship hit 
-  #! Bit 5 = amplifier enabled/disabled
-  set-space-invaders-port5o ;
-
-M: space-invaders write-port ( value port cpu -- )
-  #! Write a byte to the hardware port, where 'port' is
-  #! an 8-bit value.  
-  {
-    { [ over 2 = ] [ nip write-port2 ] }
-    { [ over 3 = ] [ nip write-port3 ] }
-    { [ over 4 = ] [ nip write-port4 ] }
-    { [ over 5 = ] [ nip write-port5 ] }
-    { [ t ]        [ 3drop ] }
-  } cond ;
-
-M: space-invaders reset ( cpu -- )
-  [ delegate reset ] keep
-  [ 0 swap set-space-invaders-port1 ] keep
-  [ 0 swap set-space-invaders-port2i ] keep
-  [ 0 swap set-space-invaders-port2o ] keep
-  [ 0 swap set-space-invaders-port3o ] keep
-  [ 0 swap set-space-invaders-port4lo ] keep
-  [ 0 swap set-space-invaders-port4hi ] keep
-  0 swap set-space-invaders-port5o ;
-
-: gui-step ( cpu -- )
-  [ read-instruction ] keep ! n cpu
-  over get-cycles over inc-cycles
-  [ swap instructions dispatch ] keep  
-  [ cpu-pc HEX: FFFF bitand ] keep 
-  set-cpu-pc ;
-
-: gui-frame/2 ( cpu -- )
-  [ gui-step ] keep
-  [ cpu-cycles ] keep
-  over 16667 < [ ! cycles cpu
-    nip gui-frame/2
-  ] [
-    [ >r 16667 - r> set-cpu-cycles ] keep
-    dup cpu-last-interrupt HEX: 10 = [
-      HEX: 08 over set-cpu-last-interrupt HEX: 08 swap interrupt
-    ] [
-      HEX: 10 over set-cpu-last-interrupt HEX: 10 swap interrupt
-    ] if     
-  ] if ;
-
-: gui-frame ( cpu -- )
-  dup gui-frame/2 gui-frame/2 ;
-
-: coin-down ( cpu -- )
-  [ space-invaders-port1 1 bitor ] keep set-space-invaders-port1 ;
-
-: coin-up ( cpu --  )
-  [ space-invaders-port1 255 1 - bitand ] keep set-space-invaders-port1 ;
-
-: player1-down ( cpu -- )
-  [ space-invaders-port1 4 bitor ] keep set-space-invaders-port1 ;
-
-: player1-up ( cpu -- )
-  [ space-invaders-port1 255 4 - bitand ] keep set-space-invaders-port1 ;
-
-: player2-down ( cpu -- )
-  [ space-invaders-port1 2 bitor ] keep set-space-invaders-port1 ;
-
-: player2-up ( cpu -- )
-  [ space-invaders-port1 255 2 - bitand ] keep set-space-invaders-port1 ;
-
-: fire-down ( cpu -- )
-  [ space-invaders-port1 HEX: 10 bitor ] keep set-space-invaders-port1 ;
-
-: fire-up ( cpu -- )
-  [ space-invaders-port1 255 HEX: 10 - bitand ] keep set-space-invaders-port1 ;
-
-: left-down ( cpu -- )
-  [ space-invaders-port1 HEX: 20 bitor ] keep set-space-invaders-port1 ;
-
-: left-up ( cpu -- )
-  [ space-invaders-port1 255 HEX: 20 - bitand ] keep set-space-invaders-port1 ;
-
-: right-down ( cpu -- )
-  [ space-invaders-port1 HEX: 40 bitor ] keep set-space-invaders-port1 ;
-
-: right-up ( cpu -- )
-  [ space-invaders-port1 255 HEX: 40 - bitand ] keep set-space-invaders-port1 ;
-
-
-TUPLE: invaders-gadget cpu quit? ;
-
-invaders-gadget H{
-    { T{ key-down f f "ESCAPE" }    [ t swap set-invaders-gadget-quit? ] }
-    { T{ key-down f f "BACKSPACE" } [ invaders-gadget-cpu coin-down ] }
-    { T{ key-up   f f "BACKSPACE" } [ invaders-gadget-cpu coin-up ] }
-    { T{ key-down f f "1" }         [ invaders-gadget-cpu player1-down ] }
-    { T{ key-up   f f "1" }         [ invaders-gadget-cpu player1-up ] }
-    { T{ key-down f f "2" }         [ invaders-gadget-cpu player2-down ] }
-    { T{ key-up   f f "2" }         [ invaders-gadget-cpu player2-up ] }
-    { T{ key-down f f "UP" }        [ invaders-gadget-cpu fire-down ] }
-    { T{ key-up   f f "UP" }        [ invaders-gadget-cpu fire-up ] }
-    { T{ key-down f f "LEFT" }      [ invaders-gadget-cpu left-down ] }
-    { T{ key-up   f f "LEFT" }      [ invaders-gadget-cpu left-up ] }
-    { T{ key-down f f "RIGHT" }     [ invaders-gadget-cpu right-down ] }
-    { T{ key-up   f f "RIGHT" }     [ invaders-gadget-cpu right-up ] }
-  } set-gestures 
-
-C: invaders-gadget ( cpu -- gadget ) 
-  [ set-invaders-gadget-cpu ] keep
-  [ f swap set-invaders-gadget-quit? ] keep
-  [ delegate>gadget ] keep ;
-
-M: invaders-gadget pref-dim* drop { 224 256 0 } ;
-
-M: invaders-gadget draw-gadget* ( gadget -- )
-  0 0 glRasterPos2i
-  1.0 -1.0 glPixelZoom
-  >r 224 256 GL_RGB GL_UNSIGNED_BYTE r>
-  invaders-gadget-cpu space-invaders-bitmap glDrawPixels ;
-
-: black { 0 0 0 } ;
-: white { 255 255 255 } ;
-: green { 0 255 0 } ;
-: red   { 255 0 0 } ;
-
-: addr>xy ( addr -- point )
-  #! Convert video RAM address to base X Y value. point is a {x y}.
-  HEX: 2400 - ! n
-  dup HEX: 1f bitand 8 * 255 swap - ! n y
-  swap -5 shift swap 2array ;
-
-: plot-bitmap-pixel ( bitmap point color -- )
-  #! point is a {x y}. color is a {r g b}.
-  swap rot set-bitmap-pixel ;
-
-: within ( n a b -- bool )
-  #! n >= a and n <= b
-  rot tuck swap <= >r swap >= r> and ;
-
-: get-point-color ( point -- color )
-  #! Return the color to use for the given x/y position.
-  first2
-  {
-    { [ dup 184 238 within pick 0 223 within and ] [ 2drop green ] }
-    { [ dup 240 247 within pick 16 133 within and ] [ 2drop green ] }
-    { [ dup 247 215 - 247 184 - within pick 0 223 within and ] [ 2drop red ] }
-    { [ t ] [ 2drop white ] }
-  } cond ;
-
-: plot-bitmap-bits ( bitmap point byte bit -- )
-  #! point is a {x y}.
-  [ first2 ] dipd
-  dup swapd -1 * shift 1 bitand 0 =
-  [ - 2array ] dip
-  [ black ] [ dup get-point-color ] if
-  plot-bitmap-pixel ;
-
-: do-bitmap-update ( bitmap value addr -- )
-  addr>xy swap 
-  [ 0 plot-bitmap-bits ] 3keep
-  [ 1 plot-bitmap-bits ] 3keep
-  [ 2 plot-bitmap-bits ] 3keep
-  [ 3 plot-bitmap-bits ] 3keep
-  [ 4 plot-bitmap-bits ] 3keep
-  [ 5 plot-bitmap-bits ] 3keep
-  [ 6 plot-bitmap-bits ] 3keep
-  7 plot-bitmap-bits ;
-
-M: space-invaders update-video ( value addr cpu -- )  
-  over HEX: 2400 >= [
-    space-invaders-bitmap -rot do-bitmap-update
-  ] [
-    3drop
-  ] if ;
-
-: sync-frame ( millis -- millis )
-  #! Sleep until the time for the next frame arrives.
-  1000 60 / >fixnum + millis - dup 0 >
-  [ sleep ] [ drop yield ] if millis ;
-
-: invaders-process ( millis gadget -- )
-  #! Run a space invaders gadget inside a 
-  #! concurrent process. Messages can be sent to
-  #! signal key presses, etc.
-  dup invaders-gadget-quit? [
-    [ sync-frame ] dip
-    [ invaders-gadget-cpu gui-frame ] keep
-    [ relayout-1 ] keep
-    invaders-process 
-  ] unless ;
-
-M: invaders-gadget graft* ( gadget -- )
- [ f swap set-invaders-gadget-quit? ] keep
- [ millis swap invaders-process ] spawn 2drop ;
-
-M: invaders-gadget ungraft* ( gadget -- )
- t swap set-invaders-gadget-quit? ;
-
-: run ( -- )  
-  <space-invaders> "apps/space-invaders/invaders.rom" resource-path over load-rom <invaders-gadget> 
-  "Space Invaders" open-titled-window ;
diff --git a/apps/space-invaders/tests.factor b/apps/space-invaders/tests.factor
deleted file mode 100644 (file)
index d952a78..0000000
+++ /dev/null
@@ -1,1336 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-USING: kernel cpu-8080 test lazy parser-combinators math hashtables lists sequences words ;
-
-! Test read-byte from ROM
-[ 0 ] [ HEX: 50 <cpu> read-byte ] unit-test
-
-! Test read-byte out of RAM range
-! [ HEX: FF ] [ HEX: 4001 <cpu> read-byte ] unit-test
-
-! Test write-byte to ROM
-[ 0 ] [ <cpu> 1 HEX: 1000 pick write-byte HEX: 1000 swap read-byte ] unit-test
-  
-! Test write-byte to RAM
-[ 1 ] [ <cpu> 1 HEX: 2000 pick write-byte HEX: 2000 swap read-byte ] unit-test
-
-! Test write-byte out of range
-! [ HEX: FF ] [ <cpu> 1 HEX: 4001 pick write-byte HEX: 4001 swap read-byte ] unit-test
-! Test write-word/read-word
-[ HEX: 2021 ] [
-  <cpu>
-  HEX: 2021 HEX: 2000 pick write-word HEX: 2000 swap read-word 
-] unit-test
-
-! Test AF
-[ HEX: 1020 ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-a ] keep
-  [ HEX: 20 swap set-cpu-f ] keep
-  cpu-af 
-] unit-test
-
-[ HEX: 10 HEX: 20 ] [
-  <cpu> HEX: 1020 over set-cpu-af
-        dup cpu-a
-        swap cpu-f
-] unit-test
-
-[ t t ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-a ] keep
-  [ HEX: 20 swap set-cpu-f ] keep
-  [ cpu-af ] keep
-  [ set-cpu-af ] keep
-  [ cpu-a HEX: 10 = ] keep
-  cpu-f HEX: 20 =
-] unit-test
-
-! Test BC
-[ HEX: 1020 ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-b ] keep
-  [ HEX: 20 swap set-cpu-c ] keep
-  cpu-bc
-] unit-test
-
-[ HEX: 10 HEX: 20 ] [
-  <cpu> HEX: 1020 over set-cpu-bc
-        dup cpu-b
-        swap cpu-c
-] unit-test
-
-[ t t ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-b ] keep
-  [ HEX: 20 swap set-cpu-c ] keep
-  [ cpu-bc ] keep
-  [ set-cpu-bc ] keep
-  [ cpu-b HEX: 10 = ] keep
-  cpu-c HEX: 20 =
-] unit-test
-
-! Test DE
-[ HEX: 1020 ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-d ] keep
-  [ HEX: 20 swap set-cpu-e ] keep
-  cpu-de
-] unit-test
-
-[ HEX: 10 HEX: 20 ] [
-  <cpu> HEX: 1020 over set-cpu-de
-        dup cpu-d
-        swap cpu-e
-] unit-test
-
-[ t t ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-d ] keep
-  [ HEX: 20 swap set-cpu-e ] keep
-  [ cpu-de ] keep
-  [ set-cpu-de ] keep
-  [ cpu-d HEX: 10 = ] keep
-  cpu-e HEX: 20 =
-] unit-test
-
-! Test HL
-[ HEX: 1020 ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-h ] keep
-  [ HEX: 20 swap set-cpu-l ] keep
-  cpu-hl
-] unit-test
-
-[ HEX: 10 HEX: 20 ] [
-  <cpu> HEX: 1020 over set-cpu-hl
-        dup cpu-h
-        swap cpu-l
-] unit-test
-
-[ t t ] [
-  <cpu> 
-  [ HEX: 10 swap set-cpu-h ] keep
-  [ HEX: 20 swap set-cpu-l ] keep
-  [ cpu-hl ] keep
-  [ set-cpu-hl ] keep
-  [ cpu-h HEX: 10 = ] keep
-  cpu-l HEX: 20 =
-] unit-test
-
-! Rom loading
-[ HEX: 221 ] [
-  <cpu> "invaders.rom" over load-rom 
-  HEX: 0100 swap read-word
-] unit-test
-  
-: instruction-parse-test ( args type instruction -- )
-  >r patterns hash replace-patterns unit r> 
-  [ instruction-quotations ] cons unit-test ;
-
-{ } "NOP" "NOP" instruction-parse-test
-{ cpu-bc set-cpu-bc } "LD-RR,NN" "LD BC,nn" instruction-parse-test
-{ cpu-bc set-cpu-bc cpu-a set-cpu-a } "LD-(RR),R" "LD (BC),A" instruction-parse-test
-{ cpu-bc set-cpu-bc } "INC-RR" "INC BC" instruction-parse-test
-{ cpu-a set-cpu-a } "INC-R" "INC A" instruction-parse-test
-{ cpu-a set-cpu-a } "DEC-R" "DEC A" instruction-parse-test
-{ cpu-b set-cpu-b } "LD-R,N" "LD B,n" instruction-parse-test
-{ } "RLCA" "RLCA" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-bc set-cpu-bc } "ADD-RR,RR" "ADD HL,BC" instruction-parse-test
-{ cpu-a set-cpu-a cpu-bc set-cpu-bc } "LD-R,(RR)" "LD A,(BC)" instruction-parse-test
-{ cpu-bc set-cpu-bc } "DEC-RR" "DEC BC" instruction-parse-test
-{ cpu-c set-cpu-c } "INC-R" "INC C" instruction-parse-test
-{ cpu-c set-cpu-c } "DEC-R" "DEC C" instruction-parse-test
-{ cpu-c set-cpu-c } "LD-R,N" "LD C,n" instruction-parse-test
-{ } "RRCA" "RRCA" instruction-parse-test
-{ cpu-de set-cpu-de } "LD-RR,NN" "LD DE,nn" instruction-parse-test
-{ cpu-de set-cpu-de cpu-a set-cpu-a } "LD-(RR),R" "LD (DE),A" instruction-parse-test
-{ cpu-de set-cpu-de } "INC-RR" "INC DE" instruction-parse-test
-{ cpu-d set-cpu-d } "INC-R" "INC D" instruction-parse-test
-{ cpu-d set-cpu-d } "DEC-R" "DEC D" instruction-parse-test
-{ cpu-d set-cpu-d } "LD-R,N" "LD D,n" instruction-parse-test
-{ } "RLA" "RLA" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-de set-cpu-de } "ADD-RR,RR" "ADD HL,DE" instruction-parse-test
-{ cpu-a set-cpu-a cpu-de set-cpu-de } "LD-R,(RR)" "LD A,(DE)" instruction-parse-test
-{ cpu-de set-cpu-de } "DEC-RR" "DEC DE" instruction-parse-test
-{ cpu-e set-cpu-e } "INC-R" "INC E" instruction-parse-test
-{ cpu-e set-cpu-e } "DEC-R" "DEC E" instruction-parse-test
-{ cpu-e set-cpu-e } "LD-R,N" "LD E,n" instruction-parse-test
-{ } "RRA" "RRA" instruction-parse-test
-{ cpu-hl set-cpu-hl } "LD-RR,NN" "LD HL,nn" instruction-parse-test
-{ cpu-hl set-cpu-hl } "LD-(NN),RR" "LD (nn),HL" instruction-parse-test
-{ cpu-hl set-cpu-hl } "INC-RR" "INC HL" instruction-parse-test
-{ cpu-h set-cpu-h } "INC-R" "INC H" instruction-parse-test
-{ cpu-h set-cpu-h } "DEC-R" "DEC H" instruction-parse-test
-{ cpu-h set-cpu-h } "LD-R,N" "LD H,n" instruction-parse-test
-{ } "DAA" "DAA" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-hl set-cpu-hl } "ADD-RR,RR" "ADD HL,HL" instruction-parse-test
-{ cpu-hl set-cpu-hl } "LD-RR,(NN)" "LD HL,(nn)" instruction-parse-test
-{ cpu-hl set-cpu-hl } "DEC-RR" "DEC HL" instruction-parse-test
-{ cpu-l set-cpu-l } "INC-R" "INC L" instruction-parse-test
-{ cpu-l set-cpu-l } "DEC-R" "DEC L" instruction-parse-test
-{ cpu-l set-cpu-l } "LD-R,N" "LD L,n" instruction-parse-test
-{ } "CPL" "CPL" instruction-parse-test
-{ cpu-sp set-cpu-sp } "LD-RR,NN" "LD SP,nn" instruction-parse-test
-{ cpu-a set-cpu-a } "LD-(NN),R" "LD (nn),A" instruction-parse-test
-{ cpu-sp set-cpu-sp } "INC-RR" "INC SP" instruction-parse-test
-{ cpu-hl set-cpu-hl } "INC-(RR)" "INC (HL)" instruction-parse-test
-{ cpu-hl set-cpu-hl } "DEC-(RR)" "DEC (HL)" instruction-parse-test
-{ cpu-hl set-cpu-hl } "LD-(RR),N" "LD (HL),n" instruction-parse-test
-{ } "SCF" "SCF" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-sp set-cpu-sp } "ADD-RR,RR" "ADD HL,SP" instruction-parse-test
-{ cpu-a set-cpu-a } "LD-R,(NN)" "LD A,(nn)" instruction-parse-test
-{ cpu-sp set-cpu-sp } "DEC-RR" "DEC SP" instruction-parse-test
-{ cpu-a set-cpu-a } "INC-R" "INC A" instruction-parse-test
-{ cpu-a set-cpu-a } "DEC-R" "DEC A" instruction-parse-test
-{ cpu-a set-cpu-a } "LD-R,N" "LD A,n" instruction-parse-test
-{ } "CCF" "CCF" instruction-parse-test
-{ cpu-b set-cpu-b cpu-b set-cpu-b } "LD-R,R" "LD B,B" instruction-parse-test
-{ cpu-b set-cpu-b cpu-c set-cpu-c } "LD-R,R" "LD B,C" instruction-parse-test
-{ cpu-b set-cpu-b cpu-d set-cpu-d } "LD-R,R" "LD B,D" instruction-parse-test
-{ cpu-b set-cpu-b cpu-e set-cpu-e } "LD-R,R" "LD B,E" instruction-parse-test
-{ cpu-b set-cpu-b cpu-h set-cpu-h } "LD-R,R" "LD B,H" instruction-parse-test
-{ cpu-b set-cpu-b cpu-l set-cpu-l } "LD-R,R" "LD B,L" instruction-parse-test
-{ cpu-b set-cpu-b cpu-hl set-cpu-hl } "LD-R,(RR)" "LD B,(HL)" instruction-parse-test
-{ cpu-b set-cpu-b cpu-a set-cpu-a } "LD-R,R" "LD B,A" instruction-parse-test
-{ cpu-c set-cpu-c cpu-b set-cpu-b } "LD-R,R" "LD C,B" instruction-parse-test
-{ cpu-c set-cpu-c cpu-c set-cpu-c } "LD-R,R" "LD C,C" instruction-parse-test
-{ cpu-c set-cpu-c cpu-d set-cpu-d } "LD-R,R" "LD C,D" instruction-parse-test
-{ cpu-c set-cpu-c cpu-e set-cpu-e } "LD-R,R" "LD C,E" instruction-parse-test
-{ cpu-c set-cpu-c cpu-h set-cpu-h } "LD-R,R" "LD C,H" instruction-parse-test
-{ cpu-c set-cpu-c cpu-l set-cpu-l } "LD-R,R" "LD C,L" instruction-parse-test
-{ cpu-c set-cpu-c cpu-hl set-cpu-hl } "LD-R,(RR)" "LD C,(HL)" instruction-parse-test
-{ cpu-c set-cpu-c cpu-a set-cpu-a } "LD-R,R" "LD C,A" instruction-parse-test
-{ cpu-d set-cpu-d cpu-b set-cpu-b } "LD-R,R" "LD D,B" instruction-parse-test
-{ cpu-d set-cpu-d cpu-c set-cpu-c } "LD-R,R" "LD D,C" instruction-parse-test
-{ cpu-d set-cpu-d cpu-d set-cpu-d } "LD-R,R" "LD D,D" instruction-parse-test
-{ cpu-d set-cpu-d cpu-e set-cpu-e } "LD-R,R" "LD D,E" instruction-parse-test
-{ cpu-d set-cpu-d cpu-h set-cpu-h } "LD-R,R" "LD D,H" instruction-parse-test
-{ cpu-d set-cpu-d cpu-l set-cpu-l } "LD-R,R" "LD D,L" instruction-parse-test
-{ cpu-d set-cpu-d cpu-hl set-cpu-hl } "LD-R,(RR)" "LD D,(HL)" instruction-parse-test
-{ cpu-d set-cpu-d cpu-a set-cpu-a } "LD-R,R" "LD D,A" instruction-parse-test
-{ cpu-e set-cpu-e cpu-b set-cpu-b } "LD-R,R" "LD E,B" instruction-parse-test
-{ cpu-e set-cpu-e cpu-c set-cpu-c } "LD-R,R" "LD E,C" instruction-parse-test
-{ cpu-e set-cpu-e cpu-d set-cpu-d } "LD-R,R" "LD E,D" instruction-parse-test
-{ cpu-e set-cpu-e cpu-e set-cpu-e } "LD-R,R" "LD E,E" instruction-parse-test
-{ cpu-e set-cpu-e cpu-h set-cpu-h } "LD-R,R" "LD E,H" instruction-parse-test
-{ cpu-e set-cpu-e cpu-l set-cpu-l } "LD-R,R" "LD E,L" instruction-parse-test
-{ cpu-e set-cpu-e cpu-hl set-cpu-hl } "LD-R,(RR)" "LD E,(HL)" instruction-parse-test
-{ cpu-e set-cpu-e cpu-a set-cpu-a } "LD-R,R" "LD E,A" instruction-parse-test
-{ cpu-h set-cpu-h cpu-b set-cpu-b } "LD-R,R" "LD H,B" instruction-parse-test
-{ cpu-h set-cpu-h cpu-c set-cpu-c } "LD-R,R" "LD H,C" instruction-parse-test
-{ cpu-h set-cpu-h cpu-d set-cpu-d } "LD-R,R" "LD H,D" instruction-parse-test
-{ cpu-h set-cpu-h cpu-e set-cpu-e } "LD-R,R" "LD H,E" instruction-parse-test
-{ cpu-h set-cpu-h cpu-h set-cpu-h } "LD-R,R" "LD H,H" instruction-parse-test
-{ cpu-h set-cpu-h cpu-l set-cpu-l } "LD-R,R" "LD H,L" instruction-parse-test
-{ cpu-h set-cpu-h cpu-hl set-cpu-hl } "LD-R,(RR)" "LD H,(HL)" instruction-parse-test
-{ cpu-h set-cpu-h cpu-a set-cpu-a } "LD-R,R" "LD H,A" instruction-parse-test
-{ cpu-l set-cpu-l cpu-b set-cpu-b } "LD-R,R" "LD L,B" instruction-parse-test
-{ cpu-l set-cpu-l cpu-c set-cpu-c } "LD-R,R" "LD L,C" instruction-parse-test
-{ cpu-l set-cpu-l cpu-d set-cpu-d } "LD-R,R" "LD L,D" instruction-parse-test
-{ cpu-l set-cpu-l cpu-e set-cpu-e } "LD-R,R" "LD L,E" instruction-parse-test
-{ cpu-l set-cpu-l cpu-h set-cpu-h } "LD-R,R" "LD L,H" instruction-parse-test
-{ cpu-l set-cpu-l cpu-l set-cpu-l } "LD-R,R" "LD L,L" instruction-parse-test
-{ cpu-l set-cpu-l cpu-hl set-cpu-hl } "LD-R,(RR)" "LD L,(HL)" instruction-parse-test
-{ cpu-l set-cpu-l cpu-a set-cpu-a } "LD-R,R" "LD L,A" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-b set-cpu-b } "LD-(RR),R" "LD (HL),B" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-c set-cpu-c } "LD-(RR),R" "LD (HL),C" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-d set-cpu-d } "LD-(RR),R" "LD (HL),D" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-e set-cpu-e } "LD-(RR),R" "LD (HL),E" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-h set-cpu-h } "LD-(RR),R" "LD (HL),H" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-l set-cpu-l } "LD-(RR),R" "LD (HL),L" instruction-parse-test
-{ } "HALT" "HALT" instruction-parse-test
-{ cpu-hl set-cpu-hl cpu-a set-cpu-a } "LD-(RR),R" "LD (HL),A" instruction-parse-test
-{ cpu-a set-cpu-a cpu-b set-cpu-b } "LD-R,R" "LD A,B" instruction-parse-test
-{ cpu-a set-cpu-a cpu-c set-cpu-c } "LD-R,R" "LD A,C" instruction-parse-test
-{ cpu-a set-cpu-a cpu-d set-cpu-d } "LD-R,R" "LD A,D" instruction-parse-test
-{ cpu-a set-cpu-a cpu-e set-cpu-e } "LD-R,R" "LD A,E" instruction-parse-test
-{ cpu-a set-cpu-a cpu-h set-cpu-h } "LD-R,R" "LD A,H" instruction-parse-test
-{ cpu-a set-cpu-a cpu-l set-cpu-l } "LD-R,R" "LD A,L" instruction-parse-test
-{ cpu-a set-cpu-a cpu-hl set-cpu-hl } "LD-R,(RR)" "LD A,(HL)" instruction-parse-test
-{ cpu-a set-cpu-a cpu-a set-cpu-a } "LD-R,R" "LD A,A" instruction-parse-test
-{ cpu-a set-cpu-a cpu-b set-cpu-b } "ADD-R,R" "ADD A,B" instruction-parse-test
-{ cpu-a set-cpu-a cpu-c set-cpu-c } "ADD-R,R" "ADD A,C" instruction-parse-test
-{ cpu-a set-cpu-a cpu-d set-cpu-d } "ADD-R,R" "ADD A,D" instruction-parse-test
-{ cpu-a set-cpu-a cpu-e set-cpu-e } "ADD-R,R" "ADD A,E" instruction-parse-test
-{ cpu-a set-cpu-a cpu-h set-cpu-h } "ADD-R,R" "ADD A,H" instruction-parse-test
-{ cpu-a set-cpu-a cpu-l set-cpu-l } "ADD-R,R" "ADD A,L" instruction-parse-test
-{ cpu-a set-cpu-a cpu-hl set-cpu-hl } "ADD-R,(RR)" "ADD A,(HL)" instruction-parse-test
-{ cpu-a set-cpu-a cpu-a set-cpu-a } "ADD-R,R" "ADD A,A" instruction-parse-test
-{ cpu-a set-cpu-a cpu-b set-cpu-b } "ADC-R,R" "ADC A,B" instruction-parse-test
-{ cpu-a set-cpu-a cpu-c set-cpu-c } "ADC-R,R" "ADC A,C" instruction-parse-test
-{ cpu-a set-cpu-a cpu-d set-cpu-d } "ADC-R,R" "ADC A,D" instruction-parse-test
-{ cpu-a set-cpu-a cpu-e set-cpu-e } "ADC-R,R" "ADC A,E" instruction-parse-test
-{ cpu-a set-cpu-a cpu-h set-cpu-h } "ADC-R,R" "ADC A,H" instruction-parse-test
-{ cpu-a set-cpu-a cpu-l set-cpu-l } "ADC-R,R" "ADC A,L" instruction-parse-test
-{ cpu-a set-cpu-a cpu-hl set-cpu-hl } "ADC-R,(RR)" "ADC A,(HL)" instruction-parse-test
-{ cpu-a set-cpu-a cpu-a set-cpu-a } "ADC-R,R" "ADC A,A" instruction-parse-test
-{ cpu-b set-cpu-b } "SUB-R" "SUB B" instruction-parse-test
-{ cpu-c set-cpu-c } "SUB-R" "SUB C" instruction-parse-test
-{ cpu-d set-cpu-d } "SUB-R" "SUB D" instruction-parse-test
-{ cpu-e set-cpu-e } "SUB-R" "SUB E" instruction-parse-test
-{ cpu-h set-cpu-h } "SUB-R" "SUB H" instruction-parse-test
-{ cpu-l set-cpu-l } "SUB-R" "SUB L" instruction-parse-test
-{ cpu-hl set-cpu-hl } "SUB-(RR)" "SUB (HL)" instruction-parse-test
-{ cpu-a set-cpu-a } "SUB-R" "SUB A" instruction-parse-test
-{ cpu-a set-cpu-a cpu-b set-cpu-b } "SBC-R,R" "SBC A,B" instruction-parse-test
-{ cpu-a set-cpu-a cpu-c set-cpu-c } "SBC-R,R" "SBC A,C" instruction-parse-test
-{ cpu-a set-cpu-a cpu-d set-cpu-d } "SBC-R,R" "SBC A,D" instruction-parse-test
-{ cpu-a set-cpu-a cpu-e set-cpu-e } "SBC-R,R" "SBC A,E" instruction-parse-test
-{ cpu-a set-cpu-a cpu-h set-cpu-h } "SBC-R,R" "SBC A,H" instruction-parse-test
-{ cpu-a set-cpu-a cpu-l set-cpu-l } "SBC-R,R" "SBC A,L" instruction-parse-test
-{ cpu-a set-cpu-a cpu-hl set-cpu-hl } "SBC-R,(RR)" "SBC A,(HL)" instruction-parse-test
-{ cpu-a set-cpu-a cpu-a set-cpu-a } "SBC-R,R" "SBC A,A" instruction-parse-test
-{ cpu-b set-cpu-b } "AND-R" "AND B" instruction-parse-test
-{ cpu-c set-cpu-c } "AND-R" "AND C" instruction-parse-test
-{ cpu-d set-cpu-d } "AND-R" "AND D" instruction-parse-test
-{ cpu-e set-cpu-e } "AND-R" "AND E" instruction-parse-test
-{ cpu-h set-cpu-h } "AND-R" "AND H" instruction-parse-test
-{ cpu-l set-cpu-l } "AND-R" "AND L" instruction-parse-test
-{ cpu-hl set-cpu-hl } "AND-(RR)" "AND (HL)" instruction-parse-test
-{ cpu-a set-cpu-a } "AND-A" "AND A" instruction-parse-test
-{ cpu-b set-cpu-b } "XOR-R" "XOR B" instruction-parse-test
-{ cpu-c set-cpu-c } "XOR-R" "XOR C" instruction-parse-test
-{ cpu-d set-cpu-d } "XOR-R" "XOR D" instruction-parse-test
-{ cpu-e set-cpu-e } "XOR-R" "XOR E" instruction-parse-test
-{ cpu-h set-cpu-h } "XOR-R" "XOR H" instruction-parse-test
-{ cpu-l set-cpu-l } "XOR-R" "XOR L" instruction-parse-test
-{ cpu-hl set-cpu-hl } "XOR-(RR)" "XOR (HL)" instruction-parse-test
-{ cpu-a set-cpu-a } "XOR-R" "XOR A" instruction-parse-test
-{ cpu-b set-cpu-b } "OR-R" "OR B" instruction-parse-test
-{ cpu-c set-cpu-c } "OR-R" "OR C" instruction-parse-test
-{ cpu-d set-cpu-d } "OR-R" "OR D" instruction-parse-test
-{ cpu-e set-cpu-e } "OR-R" "OR E" instruction-parse-test
-{ cpu-h set-cpu-h } "OR-R" "OR H" instruction-parse-test
-{ cpu-l set-cpu-l } "OR-R" "OR L" instruction-parse-test
-{ cpu-hl set-cpu-hl } "OR-(RR)" "OR (HL)" instruction-parse-test
-{ cpu-a set-cpu-a } "OR-R" "OR A" instruction-parse-test
-{ cpu-b set-cpu-b } "CP-R" "CP B" instruction-parse-test
-{ cpu-c set-cpu-c } "CP-R" "CP C" instruction-parse-test
-{ cpu-d set-cpu-d } "CP-R" "CP D" instruction-parse-test
-{ cpu-e set-cpu-e } "CP-R" "CP E" instruction-parse-test
-{ cpu-h set-cpu-h } "CP-R" "CP H" instruction-parse-test
-{ cpu-l set-cpu-l } "CP-R" "CP L" instruction-parse-test
-{ cpu-hl set-cpu-hl } "CP-(RR)" "CP (HL)" instruction-parse-test
-{ cpu-a set-cpu-a } "CP-R" "CP A" instruction-parse-test
-{ flag-nz? } "RET-F|FF" "RET NZ" instruction-parse-test
-{ cpu-bc set-cpu-bc } "POP-RR" "POP BC" instruction-parse-test
-{ flag-nz? } "JP-F|FF,NN" "JP NZ,nn" instruction-parse-test
-{ } "JP-NN" "JP nn" instruction-parse-test
-{ flag-nz? } "CALL-F|FF,NN" "CALL NZ,nn" instruction-parse-test
-{ cpu-bc set-cpu-bc } "PUSH-RR" "PUSH BC" instruction-parse-test
-{ cpu-a set-cpu-a } "ADD-R,N" "ADD A,n" instruction-parse-test
-{ } "RST-0" "RST 0" instruction-parse-test
-{ flag-z? } "RET-F|FF" "RET Z" instruction-parse-test
-{ } "RET-NN" "RET nn" instruction-parse-test
-{ flag-z? } "JP-F|FF,NN" "JP Z,nn" instruction-parse-test
-{ } "CALL-NN" "CALL nn" instruction-parse-test
-{ cpu-a set-cpu-a } "ADC-R,N" "ADC A,n" instruction-parse-test
-{ } "RST-8" "RST 8" instruction-parse-test
-{ flag-nc? } "RET-F|FF" "RET NC" instruction-parse-test
-{ cpu-de set-cpu-de } "POP-RR" "POP DE" instruction-parse-test
-{ flag-nc? } "JP-F|FF,NN" "JP NC,nn" instruction-parse-test
-{ cpu-a set-cpu-a } "OUT-(N),R" "OUT (n),A" instruction-parse-test
-{ flag-nc? } "CALL-F|FF,NN" "CALL NC,nn" instruction-parse-test
-{ cpu-de set-cpu-de } "PUSH-RR" "PUSH DE" instruction-parse-test
-{ } "SUB-N" "SUB n" instruction-parse-test
-{ } "RST-10H" "RST 10H" instruction-parse-test
-{ flag-c? } "RET-F|FF" "RET C" instruction-parse-test
-{ flag-c? } "JP-F|FF,NN" "JP C,nn" instruction-parse-test
-{ cpu-a set-cpu-a } "IN-R,(N)" "IN A,(n)" instruction-parse-test
-{ flag-c? } "CALL-F|FF,NN" "CALL C,nn" instruction-parse-test
-{ cpu-a set-cpu-a } "SBC-R,N" "SBC A,n" instruction-parse-test
-{ } "RST-18H" "RST 18H" instruction-parse-test
-{ flag-po? } "RET-F|FF" "RET PO" instruction-parse-test
-{ cpu-hl set-cpu-hl } "POP-RR" "POP HL" instruction-parse-test
-{ flag-po? } "JP-F|FF,NN" "JP PO,nn" instruction-parse-test
-{ cpu-sp set-cpu-sp cpu-hl set-cpu-hl } "EX-(RR),RR" "EX (SP),HL" instruction-parse-test
-{ flag-po? } "CALL-F|FF,NN" "CALL PO,nn" instruction-parse-test
-{ cpu-hl set-cpu-hl } "PUSH-RR" "PUSH HL" instruction-parse-test
-{ } "AND-N" "AND n" instruction-parse-test
-{ } "RST-20H" "RST 20H" instruction-parse-test
-{ flag-pe? } "RET-F|FF" "RET PE" instruction-parse-test
-{ cpu-hl set-cpu-hl } "JP-(RR)" "JP (HL)" instruction-parse-test
-{ flag-pe? } "JP-F|FF,NN" "JP PE,nn" instruction-parse-test
-{ cpu-de set-cpu-de cpu-hl set-cpu-hl } "EX-RR,RR" "EX DE,HL" instruction-parse-test
-{ flag-pe? } "CALL-F|FF,NN" "CALL PE,nn" instruction-parse-test
-{ } "XOR-N" "XOR n" instruction-parse-test
-{ } "RST-28H" "RST 28H" instruction-parse-test
-{ flag-p? } "RET-F|FF" "RET P" instruction-parse-test
-{ cpu-af set-cpu-af } "POP-RR" "POP AF" instruction-parse-test
-{ flag-p? } "JP-F|FF,NN" "JP P,nn" instruction-parse-test
-{ } "DI" "DI" instruction-parse-test
-{ flag-p? } "CALL-F|FF,NN" "CALL P,nn" instruction-parse-test
-{ cpu-af set-cpu-af } "PUSH-RR" "PUSH AF" instruction-parse-test
-{ } "OR-N" "OR n" instruction-parse-test
-{ } "RST-30H" "RST 30H" instruction-parse-test
-{ flag-m? } "RET-F|FF" "RET M" instruction-parse-test
-{ cpu-sp set-cpu-sp cpu-hl set-cpu-hl } "LD-RR,RR" "LD SP,HL" instruction-parse-test
-{ flag-m? } "JP-F|FF,NN" "JP M,nn" instruction-parse-test
-{ } "EI" "EI" instruction-parse-test
-{ flag-m? } "CALL-F|FF,NN" "CALL M,nn" instruction-parse-test
-{ } "CP-N" "CP n" instruction-parse-test
-{ } "RST-38H" "RST 38H" instruction-parse-test
-
-
-! LD-R,(RR) Testing
-[ HEX: 42 ] [
-  <cpu> HEX: 42 HEX: 2000 pick write-byte 
-        HEX: 2000 over set-cpu-af
-        dup "LD A,(AF)" instruction-quotations call 
-        cpu-a
-] unit-test
-
-[ HEX: 42 ] [
-  <cpu> HEX: 42 HEX: 2000 pick write-byte 
-        HEX: 2000 over set-cpu-bc
-        dup "LD A,(BC)" instruction-quotations call 
-        cpu-a
-] unit-test
-
-[ HEX: 42 ] [
-  <cpu> HEX: 42 HEX: 2000 pick write-byte 
-        HEX: 2000 over set-cpu-de
-        dup "LD A,(DE)" instruction-quotations call 
-        cpu-a
-] unit-test
-
-[ HEX: 42 ] [
-  <cpu> HEX: 42 HEX: 2000 pick write-byte 
-        HEX: 2000 over set-cpu-hl
-        dup "LD A,(HL)" instruction-quotations call 
-        cpu-a
-] unit-test
-
-[ HEX: 42 ] [
-  <cpu> HEX: 42 HEX: 2000 pick write-byte 
-        HEX: 2000 over set-cpu-sp
-        dup "LD A,(SP)" instruction-quotations call 
-        cpu-a
-] unit-test
-
-! LD-RR,NN Testing
-[ HEX: 1FF ] [
-  <cpu> HEX: 1FF HEX: 2000 pick write-word 
-        HEX: 2000 over set-cpu-pc
-        dup "LD SP,nn" instruction-quotations call 
-        cpu-sp
-] unit-test
-
-[ HEX: 1FF ] [
-  <cpu> HEX: 1FF HEX: 2000 pick write-word 
-        HEX: 2000 over set-cpu-pc
-        dup "LD AF,nn" instruction-quotations call 
-        cpu-af
-] unit-test
-
-[ HEX: 1FF ] [
-  <cpu> HEX: 1FF HEX: 2000 pick write-word 
-        HEX: 2000 over set-cpu-pc
-        dup "LD BC,nn" instruction-quotations call 
-        cpu-bc
-] unit-test
-
-[ HEX: 1FF ] [
-  <cpu> HEX: 1FF HEX: 2000 pick write-word 
-        HEX: 2000 over set-cpu-pc
-        dup "LD DE,nn" instruction-quotations call 
-        cpu-de
-] unit-test
-
-[ HEX: 1FF ] [
-  <cpu> HEX: 1FF HEX: 2000 pick write-word 
-        HEX: 2000 over set-cpu-pc
-        dup "LD HL,nn" instruction-quotations call 
-        cpu-hl
-] unit-test
-
-! Test decrement-sp
-[ 2 ] [
-  <cpu> [ cpu-sp ] keep
-        [ 2 swap decrement-sp ] keep
-         cpu-sp -  
-] unit-test
-
-! Test save-pc
-[ HEX: 2000 ] [
-  <cpu> [ HEX: 2000 swap set-cpu-pc ] keep
-        [ save-pc ] keep
-        [ cpu-sp ] keep
-        read-word
-] unit-test
-
-! Test push-pc
-[ HEX: 2000 ] [
-  <cpu> [ HEX: 2000 swap set-cpu-pc ] keep
-        [ push-pc ] keep
-        pop-pc
-] unit-test
-
-! Test some flags
-[ t ] [
-  <cpu> zero-flag over set-cpu-f 
-        flag-z?
-] unit-test
-
-[ f ] [
-  <cpu> zero-flag over set-cpu-f 
-        flag-nz?
-] unit-test
-
-[ t ] [
-  <cpu> carry-flag over set-cpu-f 
-        flag-c?
-] unit-test
-
-[ f ] [
-  <cpu> carry-flag over set-cpu-f 
-        flag-nc?
-] unit-test
-
-! Test each instruction
-[ emulate-NOP ] [
-  <cpu> 0 0 pick cpu-ram set-nth
-        dup read-instruction instructions nth 
-        car dup -rot execute
-] unit-test
-
-[ emulate-LD_BC,nn 1 2 HEX: 0201 ] [
-  <cpu> 1 0 pick cpu-ram set-nth
-        1 1 pick cpu-ram set-nth
-        2 2 pick cpu-ram set-nth
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ cpu-b ] keep
-        [ cpu-bc ] keep
-        drop
-] unit-test
-
-[ emulate-LD_(BC),A 1 ] [
-  <cpu> 2 0 pick cpu-ram set-nth
-        1 over set-cpu-a
-        HEX: 2000 over set-cpu-bc
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ HEX: 2000 swap cpu-ram nth ] keep
-        drop
-] unit-test
-
-[ emulate-INC_BC HEX: 0001 HEX: 0100 HEX: 0000 ] [
-  <cpu> 3 0 pick cpu-ram set-nth
-        HEX: 0000 over set-cpu-bc
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-bc ] keep
-        3 1 pick cpu-ram set-nth
-        HEX: 00FF over set-cpu-bc
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-bc ] keep
-        3 2 pick cpu-ram set-nth
-        HEX: FFFF over set-cpu-bc
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-bc ] keep
-        drop
-] unit-test
-
-[ emulate-INC_B HEX: 01 f t f f  
-                HEX: 00 t f t f 
-                HEX: 80 f t t t 
-                HEX: 90 f t t t 
-] [
-  <cpu> 4 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-b
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        4 1 pick cpu-ram set-nth
-        HEX: FF over set-cpu-b
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        4 2 pick cpu-ram set-nth
-        HEX: 7F over set-cpu-b
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        4 3 pick cpu-ram set-nth
-        HEX: 8F over set-cpu-b
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        drop
-] unit-test
-
-[ emulate-DEC_B HEX: FF f t t t  
-                HEX: 00 t f f f 
-                HEX: 7F f t t f 
-                HEX: 8F f t t t 
-] [
-  <cpu> 5 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-b
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        5 1 pick cpu-ram set-nth
-        HEX: 01 over set-cpu-b
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        5 2 pick cpu-ram set-nth
-        HEX: 80 over set-cpu-b
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        5 3 pick cpu-ram set-nth
-        HEX: 90 over set-cpu-b
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        drop
-] unit-test
-
-[ emulate-LD_B,n 1 HEX: 0100 ] [
-  <cpu> 6 0 pick cpu-ram set-nth
-        1 1 pick cpu-ram set-nth
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ cpu-bc ] keep
-        drop
-] unit-test
-
-[ emulate-RLCA BIN: 00000011 1 BIN: 11111110 0 ] [
-  <cpu> 7 0 pick cpu-ram set-nth
-        19 over set-cpu-f
-        BIN: 10000001 over set-cpu-a
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f ] keep
-        7 1 pick cpu-ram set-nth
-        19 over set-cpu-f
-        BIN: 01111111 over set-cpu-a
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f ] keep
-        drop
-] unit-test
-
-[ emulate-ADD_HL,BC HEX: 04 HEX: 06 HEX: 0406 f f 
-                    HEX: 00 HEX: 00 HEX: 0000 f f
-                    HEX: 00 HEX: 00 HEX: 0000 t t
-                    HEX: 10 HEX: 00 HEX: 1000 f t
-                    HEX: 10 HEX: 00 HEX: 1000 f t
-] [
-  <cpu> 9 0 pick cpu-ram set-nth
-        HEX: 0102 over set-cpu-bc
-        HEX: 0304 over set-cpu-hl
-        236 over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-h ] keep
-        [ cpu-l ] keep
-        [ cpu-hl ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        9 1 pick cpu-ram set-nth
-        HEX: 0000 over set-cpu-bc
-        HEX: 0000 over set-cpu-hl
-        236 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-h ] keep
-        [ cpu-l ] keep
-        [ cpu-hl ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        9 2 pick cpu-ram set-nth
-        HEX: FFFF over set-cpu-bc
-        HEX: 0001 over set-cpu-hl
-        236 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-h ] keep
-        [ cpu-l ] keep
-        [ cpu-hl ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        9 3 pick cpu-ram set-nth
-        HEX: 0FFF over set-cpu-bc
-        HEX: 0001 over set-cpu-hl
-        236 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-h ] keep
-        [ cpu-l ] keep
-        [ cpu-hl ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        9 4 pick cpu-ram set-nth
-        HEX: 0001 over set-cpu-bc
-        HEX: 0FFF over set-cpu-hl
-        236 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-h ] keep
-        [ cpu-l ] keep
-        [ cpu-hl ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        drop
-] unit-test
-
-[ emulate-LD_A,(BC) HEX: 42 ] [
-  <cpu> HEX: 0A 0 pick cpu-ram set-nth
-        HEX: 2000 over set-cpu-bc
-        HEX: 42 HEX: 2000 pick cpu-ram set-nth 
-        HEX: 01 over set-cpu-a
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        drop
-] unit-test
-
-[ emulate-DEC_BC HEX: FF HEX: FF HEX: FFFF 
-                 HEX: 01 HEX: 02 HEX: 0102
-                 HEX: FD HEX: FF HEX: FDFF
-] [
-  <cpu> HEX: 0B 0 pick cpu-ram set-nth
-        HEX: 0000 over set-cpu-bc
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ cpu-c ] keep
-        [ cpu-bc ] keep
-        HEX: 0B 1 pick cpu-ram set-nth
-        HEX: 0103 over set-cpu-bc
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ cpu-c ] keep
-        [ cpu-bc ] keep
-        HEX: 0B 2 pick cpu-ram set-nth
-        HEX: FE00 over set-cpu-bc
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-b ] keep
-        [ cpu-c ] keep
-        [ cpu-bc ] keep
-        drop
-] unit-test
-
-[ emulate-INC_C HEX: 01 f t f f  
-                HEX: 00 t f t f 
-                HEX: 80 f t t t 
-                HEX: 90 f t t t 
-] [
-  <cpu> HEX: 0C 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-c
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 0C 1 pick cpu-ram set-nth
-        HEX: FF over set-cpu-c
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 0C 2 pick cpu-ram set-nth
-        HEX: 7F over set-cpu-c
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 0C 3 pick cpu-ram set-nth
-        HEX: 8F over set-cpu-c
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        drop
-] unit-test
-
-[ emulate-DEC_C HEX: FF f t t t  
-                HEX: 00 t f f f 
-                HEX: 7F f t t f 
-                HEX: 8F f t t t 
-] [
-  <cpu> HEX: 0D 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-c
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 0D 1 pick cpu-ram set-nth
-        HEX: 01 over set-cpu-c
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 0D 2 pick cpu-ram set-nth
-        HEX: 80 over set-cpu-c
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 0D 3 pick cpu-ram set-nth
-        HEX: 90 over set-cpu-c
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        drop
-] unit-test
-
-[ emulate-LD_C,n 1 HEX: 0001 ] [
-  <cpu> HEX: 0E 0 pick cpu-ram set-nth
-        1 1 pick cpu-ram set-nth
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-c ] keep
-        [ cpu-bc ] keep
-        drop
-] unit-test
-
-[ emulate-RRCA BIN: 11000000 1 BIN: 01111111 0 ] [
-  <cpu> HEX: 0F 0 pick cpu-ram set-nth
-        19 over set-cpu-f
-        BIN: 10000001 over set-cpu-a
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f ] keep
-        HEX: 0F 1 pick cpu-ram set-nth
-        19 over set-cpu-f
-        BIN: 11111110 over set-cpu-a
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f ] keep
-        drop
-] unit-test
-
-[ emulate-LD_DE,nn 1 2 HEX: 0201 ] [
-  <cpu> HEX: 11 0 pick cpu-ram set-nth
-        1 1 pick cpu-ram set-nth
-        2 2 pick cpu-ram set-nth
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-e ] keep
-        [ cpu-d ] keep
-        [ cpu-de ] keep
-        drop
-] unit-test
-
-[ emulate-LD_(DE),A 1 ] [
-  <cpu> HEX: 12 0 pick cpu-ram set-nth
-        1 over set-cpu-a
-        HEX: 2000 over set-cpu-de
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ HEX: 2000 swap cpu-ram nth ] keep
-        drop
-] unit-test
-
-[ emulate-INC_DE HEX: 0001 HEX: 0100 HEX: 0000 ] [
-  <cpu> HEX: 13 0 pick cpu-ram set-nth
-        HEX: 0000 over set-cpu-de
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-de ] keep
-        HEX: 13 1 pick cpu-ram set-nth
-        HEX: 00FF over set-cpu-de
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-de ] keep
-        HEX: 13 2 pick cpu-ram set-nth
-        HEX: FFFF over set-cpu-de
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-de ] keep
-        drop
-] unit-test
-
-[ emulate-INC_D HEX: 01 f t f f  
-                HEX: 00 t f t f 
-                HEX: 80 f t t t 
-                HEX: 90 f t t t 
-] [
-  <cpu> HEX: 14 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-d
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 14 1 pick cpu-ram set-nth
-        HEX: FF over set-cpu-d
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 14 2 pick cpu-ram set-nth
-        HEX: 7F over set-cpu-d
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 14 3 pick cpu-ram set-nth
-        HEX: 8F over set-cpu-d
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        drop
-] unit-test
-
-[ emulate-DEC_D HEX: FF f t t t  
-                HEX: 00 t f f f 
-                HEX: 7F f t t f 
-                HEX: 8F f t t t 
-] [
-  <cpu> HEX: 15 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-d
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 15 1 pick cpu-ram set-nth
-        HEX: 01 over set-cpu-d
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 15 2 pick cpu-ram set-nth
-        HEX: 80 over set-cpu-d
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        HEX: 15 3 pick cpu-ram set-nth
-        HEX: 90 over set-cpu-d
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ flag-z? ] keep
-        [ flag-nz? ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        drop
-] unit-test
-
-[ emulate-LD_D,n 1 HEX: 0100 ] [
-  <cpu> HEX: 16 0 pick cpu-ram set-nth
-        1 1 pick cpu-ram set-nth
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-d ] keep
-        [ cpu-de ] keep
-        drop
-] unit-test
-
-[ emulate-RLA BIN: 11111110 0 BIN: 00000011 1 ] [
-  <cpu> HEX: 17 0 pick cpu-ram set-nth
-        0 over set-cpu-f
-        BIN: 01111111 over set-cpu-a
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f ] keep
-        HEX: 17 1 pick cpu-ram set-nth
-        19 over set-cpu-f
-        BIN: 10000001 over set-cpu-a
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f ] keep
-        drop
-] unit-test
-
-[ emulate-ADD_A,B HEX: 01 HEX: 01  f f f
-                  HEX: 00 HEX: 01  t f t
-                  HEX: A0 HEX: 50  f t f
-] [
-  <cpu> HEX: 80 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-a
-        HEX: 01 over set-cpu-b
-        0 over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-b ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        HEX: 80 1 pick cpu-ram set-nth
-        HEX: FF over set-cpu-a
-        HEX: 01 over set-cpu-b
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-b ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        HEX: 80 2 pick cpu-ram set-nth
-        HEX: 50 over set-cpu-a
-        HEX: 50 over set-cpu-b
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep 
-        [ cpu-a ] keep
-        [ cpu-b ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-         drop
-] unit-test
-
-[ emulate-ADD_A,C HEX: 01 HEX: 01  f f f
-                  HEX: 00 HEX: 01  t f t
-                  HEX: A0 HEX: 50  f t f
-] [
-  <cpu> HEX: 81 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-a
-        HEX: 01 over set-cpu-c
-        0 over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-c ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        HEX: 81 1 pick cpu-ram set-nth
-        HEX: FF over set-cpu-a
-        HEX: 01 over set-cpu-c
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-c ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        HEX: 81 2 pick cpu-ram set-nth
-        HEX: 50 over set-cpu-a
-        HEX: 50 over set-cpu-c
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep 
-        [ cpu-a ] keep
-        [ cpu-c ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-         drop
-] unit-test
-
-[ emulate-ADD_A,A HEX: 00 f f t
-                  HEX: FE t t f
-                  HEX: 00 t f t
-] [
-  <cpu> HEX: 87 0 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-a
-        0 over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        HEX: 87 1 pick cpu-ram set-nth
-        HEX: FF over set-cpu-a
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        HEX: 87 2 pick cpu-ram set-nth
-        HEX: 80 over set-cpu-a
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep 
-        [ cpu-a ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-         drop
-] unit-test
-
-
-[ emulate-SUB_n HEX: FF f t t t
-                HEX: 00 t f f f
-                HEX: DA f t f f
-                HEX: 7F f f f t
-] [
-  <cpu> HEX: D6 0 pick cpu-ram set-nth
-        HEX: 01 1 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-a
-        0 over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        HEX: D6 2 pick cpu-ram set-nth
-        HEX: 02 3 pick cpu-ram set-nth
-        HEX: 02 over set-cpu-a
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        HEX: D6 4 pick cpu-ram set-nth
-        HEX: 25 5 pick cpu-ram set-nth
-        HEX: FF over set-cpu-a
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        HEX: D6 6 pick cpu-ram set-nth
-        HEX: 01 7 pick cpu-ram set-nth
-        HEX: 80 over set-cpu-a
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-         drop
-] unit-test
-
-[ emulate-SBC_A,n HEX: FE f t t t
-                HEX: FF f t t t
-                HEX: D9 f t f f
-                HEX: 7E f f f t
-] [
-  <cpu> HEX: DE 0 pick cpu-ram set-nth
-        HEX: 01 1 pick cpu-ram set-nth
-        HEX: 00 over set-cpu-a
-        HEX: FF over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        HEX: DE 2 pick cpu-ram set-nth
-        HEX: 02 3 pick cpu-ram set-nth
-        HEX: 02 over set-cpu-a
-        HEX: FF over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        HEX: DE 4 pick cpu-ram set-nth
-        HEX: 25 5 pick cpu-ram set-nth
-        HEX: FF over set-cpu-a
-        HEX: FF over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-        HEX: DE 6 pick cpu-ram set-nth
-        HEX: 01 7 pick cpu-ram set-nth
-        HEX: 80 over set-cpu-a
-        HEX: FF over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        [ cpu-f zero-flag bitand 0 = not ] keep
-        [ cpu-f sign-flag bitand 0 = not ] keep
-        [ cpu-f carry-flag bitand 0 = not ] keep
-        [ cpu-f half-carry-flag bitand 0 = not ] keep
-         drop
-] unit-test
-
-[ emulate-EX_(SP),HL HEX: 41 HEX: 40 HEX: 5051 ] [
-  <cpu> HEX: E3 0 pick cpu-ram set-nth
-        HEX: 2021 over set-cpu-sp
-        HEX: 4041 over set-cpu-hl
-        HEX: 51 HEX: 2021 pick cpu-ram set-nth
-        HEX: 50 HEX: 2022 pick cpu-ram set-nth
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ HEX: 2021 swap cpu-ram nth ] keep
-        [ HEX: 2022 swap cpu-ram nth ] keep
-       [ cpu-hl ] keep
-        drop
-] unit-test
-
-[ emulate-ADD_A,(HL) HEX: 51
-] [
-  <cpu> HEX: 86 0 pick cpu-ram set-nth
-        HEX: 01 over set-cpu-a
-        HEX: 2001 over set-cpu-hl
-       HEX: 50 HEX: 2001 pick cpu-ram set-nth
-        236 over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-a ] keep
-        drop
-] unit-test
-
-[ emulate-SCF 1 1 t
-] [
-  <cpu> HEX: 37 0 pick cpu-ram set-nth
-        carry-flag over set-cpu-f
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        [ cpu-f ] keep
-       HEX: 37 1 pick cpu-ram set-nth
-        0 over set-cpu-f
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        [ cpu-f ] keep 
-        drop
-       256 [ <cpu> [ set-cpu-f ] keep [ emulate-SCF ] keep cpu-f carry-flag bitand 0 = not ] map [ ] all?
-] unit-test
-
-[ emulate-INC_(HL) HEX: 00 
-                   HEX: 01 
-                   HEX: 80 ] [
-  <cpu> HEX: 34 0 pick cpu-ram set-nth
-        HEX: 3500 over set-cpu-hl
-       HEX: FF HEX: 3500 pick cpu-ram set-nth
-        [ read-instruction instructions nth car dup ] keep 
-        [ swap execute ] keep
-        HEX: 3500 over cpu-ram nth swap
-       HEX: 34 1 pick cpu-ram set-nth
-        HEX: 3500 over set-cpu-hl
-       HEX: 00 HEX: 3500 pick cpu-ram set-nth
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        HEX: 3500 over cpu-ram nth swap
-       HEX: 34 2 pick cpu-ram set-nth
-        HEX: 3500 over set-cpu-hl 
-       HEX: 7F HEX: 3500 pick cpu-ram set-nth
-        [ read-instruction instructions nth car ] keep 
-        [ swap execute ] keep
-        HEX: 3500 over cpu-ram nth swap
-       drop
-] unit-test
diff --git a/apps/tetris/README.txt b/apps/tetris/README.txt
deleted file mode 100644 (file)
index 7e7a470..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-This is a simple tetris game. To play, open factor (in GUI mode), and run:
-
-"contrib/tetris" run-module
-
-This should open a new window with a running tetris game. The commands are:
-
-left, right arrows: move the current piece left or right
-up arrow:           rotate the piece clockwise
-down arrow:         lower the piece one row
-space bar:          drop the piece
-p:                  pause/unpause
-n:                  start a new game
-q:                  quit (currently just stops updating, see TODO)
-
-Running tetris-window will leave a tetris-gadget on your stack. To get your
-current score you can do:
-
-tetris-gadget-tetris tetris-score
-
-TODO:
-- close the window on quit
-- rotation of pieces when they're on the far right of the board
-- show the score and level, maybe floating about the screen somewhere
-- make blocks prettier
diff --git a/apps/tetris/load.factor b/apps/tetris/load.factor
deleted file mode 100644 (file)
index 2b0b5c6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-
-REQUIRES: libs/lazy-lists ;
-
-PROVIDE: apps/tetris
-{ +files+ {
-    "tetris-colours.factor"
-    "tetromino.factor"
-    "tetris-piece.factor"
-    "tetris-board.factor"
-    "tetris.factor"
-    "tetris-gl.factor"
-    "tetris-gadget.factor"
-} }
-{ +tests+ {
-    "test/tetris-piece.factor"
-    "test/tetris-board.factor"
-    "test/tetris.factor"
-} } ;
-
-USE: tetris-gadget
-
-MAIN: apps/tetris tetris-window ;
diff --git a/apps/tetris/test/tetris-board.factor b/apps/tetris/test/tetris-board.factor
deleted file mode 100644 (file)
index 2b2fdec..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-USING: kernel tetris-colours tetris-board tetris-piece test arrays ;
-
-[ { { f f } { f f } { f f } } ] [ 2 3 make-rows ] unit-test
-[ { { f f } { f f } { f f } } ] [ 2 3 <board> board-rows ] unit-test
-[ 1 { f f } ] [ 2 3 <board> { 1 1 } board@block ] unit-test
-[ f ] [ 2 3 <board> { 1 1 } board-block ] unit-test
-[ 2 3 <board> { 2 3 } board-block ] unit-test-fails
-red 1array [ 2 3 <board> dup { 1 1 } red board-set-block { 1 1 } board-block ] unit-test
-[ t ] [ 2 3 <board> { 1 1 } block-free? ] unit-test
-[ f ] [ 2 3 <board> dup { 1 1 } red board-set-block { 1 1 } block-free? ] unit-test
-[ t ] [ 2 3 <board> dup { 1 1 } red board-set-block { 1 2 } block-free? ] unit-test
-[ t ] [ 2 3 <board> dup { 1 1 } red board-set-block { 0 1 } block-free? ] unit-test
-[ t ] [ 2 3 <board> { 0 0 } block-in-bounds? ] unit-test
-[ f ] [ 2 3 <board> { -1 0 } block-in-bounds? ] unit-test
-[ t ] [ 2 3 <board> { 1 2 } block-in-bounds? ] unit-test
-[ f ] [ 2 3 <board> { 2 2 } block-in-bounds? ] unit-test
-[ t ] [ 2 3 <board> { 1 1 } location-valid? ] unit-test
-[ f ] [ 2 3 <board> dup { 1 1 } red board-set-block { 1 1 } location-valid? ] unit-test
-[ t ] [ 10 10 <board> 10 <random-piece> piece-valid? ] unit-test
-[ f ] [ 2 3 <board> 10 <random-piece> { 1 2 } over set-piece-location piece-valid? ] unit-test
-[ { { f } { f } } ] [ 1 1 <board> dup add-row board-rows ] unit-test
-[ { { f } } ] [ 1 2 <board> dup { 0 1 } red board-set-block dup remove-full-rows board-rows ] unit-test
-[ { { f } { f } } ] [ 1 2 <board> dup { 0 1 } red board-set-block dup check-rows drop board-rows ] unit-test
diff --git a/apps/tetris/test/tetris-piece.factor b/apps/tetris/test/tetris-piece.factor
deleted file mode 100644 (file)
index bd3055e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-USING: kernel tetromino tetris-piece test sequences arrays namespaces ;
-
-! Tests for tetromino and tetris-piece, since there's not much to test in tetromino
-
-! these two tests rely on the first rotation of the first tetromino being the
-! 'I' tetromino in its vertical orientation.
-[ 4 ] [ tetrominoes get first tetromino-states first blocks-width ] unit-test
-[ 1 ] [ tetrominoes get first tetromino-states first blocks-height ] unit-test
-
-[ { 0 0 } ] [ random-tetromino <piece> piece-location ] unit-test
-[ 0 ] [ 10 <random-piece> piece-rotation ] unit-test
-
-[ { { 0 0 } { 1 0 } { 2 0 } { 3 0 } } ]
-[ tetrominoes get first <piece> piece-blocks ] unit-test
-
-[ { { 0 0 } { 0 1 } { 0 2 } { 0 3 } } ]
-[ tetrominoes get first <piece> dup 1 rotate-piece piece-blocks ] unit-test
-
-[ { { 1 1 } { 2 1 } { 3 1 } { 4 1 } } ]
-[ tetrominoes get first <piece> dup { 1 1 } move-piece piece-blocks ] unit-test
-
-[ 3 ] [ tetrominoes get second <piece> piece-width ] unit-test
-[ 2 ] [ tetrominoes get second <piece> dup 1 rotate-piece piece-width ] unit-test
diff --git a/apps/tetris/test/tetris.factor b/apps/tetris/test/tetris.factor
deleted file mode 100644 (file)
index 247b3e5..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-USING: kernel tetris tetris-board tetris-piece test sequences ;
-
-[ t ] [ <default-tetris> dup tetris-current-piece swap tetris-next-piece and t f ? ] unit-test
-[ t ] [ <default-tetris> { 1 1 } can-move? ] unit-test
-[ t ] [ <default-tetris> { 1 1 } tetris-move ] unit-test
-[ 1 ] [ <default-tetris> dup { 1 1 } tetris-move drop tetris-current-piece piece-location second ] unit-test
-[ 1 ] [ <default-tetris> tetris-level ] unit-test
-[ 1 ] [ <default-tetris> 9 over set-tetris-rows tetris-level ] unit-test
-[ 2 ] [ <default-tetris> 10 over set-tetris-rows tetris-level ] unit-test
-[ 0 ] [ 3 0 rows-score ] unit-test
-[ 80 ] [ 1 1 rows-score ] unit-test
-[ 4800 ] [ 3 4 rows-score ] unit-test
-[ 1 5 rows-score ] unit-test-fails
-[ 1 ] [ <default-tetris> dup 3 score-rows dup 3 score-rows dup 3 score-rows tetris-level ] unit-test
-[ 2 ] [ <default-tetris> dup 4 score-rows dup 4 score-rows dup 2 score-rows tetris-level ] unit-test
-
diff --git a/apps/tetris/tetris-board.factor b/apps/tetris/tetris-board.factor
deleted file mode 100644 (file)
index 49096ad..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences arrays tetris-piece math ;
-IN: tetris-board
-
-TUPLE: board width height rows ;
-
-: make-rows ( width height -- rows )
-    [ drop f <array> ] map-with ;
-
-C: board ( width height -- board )
-    >r 2dup make-rows r>
-    [ set-board-rows ] keep
-    [ set-board-height ] keep
-    [ set-board-width ] keep ;
-
-#! A block is simply an array of form { x y } where { 0 0 } is the top-left of
-#! the tetris board, and { 9 19 } is the bottom right on a 10x20 board.
-
-: board@block ( board block -- n row )
-    [ second swap board-rows nth ] keep first swap ;
-
-: board-set-block ( board block colour -- ) -rot board@block set-nth ;
-  
-: board-block ( board block -- colour ) board@block nth ;
-
-: block-free? ( board block -- ? ) board-block not ;
-
-: block-in-bounds? ( board block -- ? )
-    [ first swap board-width bounds-check? ] 2keep
-    second swap board-height bounds-check? and ;
-
-: location-valid? ( board block -- ? )
-    2dup block-in-bounds? [ block-free? ] [ 2drop f ] if ;
-
-: piece-valid? ( board piece -- ? )
-    piece-blocks [ location-valid? ] all-with? ;
-
-: row-not-full? ( row -- ? ) f swap member? ;
-
-: add-row ( board -- )
-    dup board-rows over board-width f <array>
-    add* swap set-board-rows ;
-
-: top-up-rows ( board -- )
-    dup board-height over board-rows length = [
-       drop
-    ] [
-       dup add-row top-up-rows
-    ] if ;
-
-: remove-full-rows ( board -- )
-    dup board-rows [ row-not-full? ] subset swap set-board-rows ;
-
-: check-rows ( board -- n )
-    #! remove full rows, then add blank ones at the top, returning the number
-    #! of rows removed (and added)
-    dup remove-full-rows dup board-height over board-rows length - >r top-up-rows r> ;
-
diff --git a/apps/tetris/tetris-colours.factor b/apps/tetris/tetris-colours.factor
deleted file mode 100644 (file)
index 41b70e4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays ;
-IN: tetris-colours
-
-: red     { 0.941 0 0 1 } ; inline
-: grey    { 0.5 0.5 0.5 1 } ; inline
-: black   { 0 0 0 1 } ; inline
-: yellow  { 0.941 0.941 0 1 } ; inline
-: orange  { 0.941 0.627 0 1 } ; inline
-: green   { 0 0.941 0 1 } ; inline
-: blue    { 0 0 0.941 1 } ; inline
-: magenta { 0.941 0 0.941 1 } ; inline
-: cyan    { 0 0.941 0.941 1 } ; inline
-: purple  { 0.627 0 0.941 1 } ; inline
-
diff --git a/apps/tetris/tetris-gadget.factor b/apps/tetris/tetris-gadget.factor
deleted file mode 100644 (file)
index ee6ea67..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel generic gadgets tetris tetris-gl sequences threads arrays ;
-IN: tetris-gadget
-
-TUPLE: tetris-gadget tetris quit? ;
-
-C: tetris-gadget ( tetris -- gadget )
-    [ set-tetris-gadget-tetris ] keep
-    [ f swap set-tetris-gadget-quit? ] keep
-    [ delegate>gadget ] keep ;
-
-M: tetris-gadget pref-dim* drop { 200 400 } ;
-
-M: tetris-gadget draw-gadget* ( gadget -- )
-    ! TODO: show score, level, etc.
-    dup rect-dim dup first swap second rot tetris-gadget-tetris draw-tetris ;
-
-: new-tetris ( gadget -- )
-    dup tetris-gadget-tetris <new-tetris> swap set-tetris-gadget-tetris ;
-
-tetris-gadget H{
-    { T{ key-down f f "ESCAPE" } [ t swap set-tetris-gadget-quit? ] }
-    { T{ key-down f f "q" }      [ t swap set-tetris-gadget-quit? ] }
-    { T{ key-down f f "UP" }     [ tetris-gadget-tetris rotate ] }
-    { T{ key-down f f "LEFT" }   [ tetris-gadget-tetris move-left ] }
-    { T{ key-down f f "RIGHT" }  [ tetris-gadget-tetris move-right ] }
-    { T{ key-down f f "DOWN" }   [ tetris-gadget-tetris move-down ] }
-    { T{ key-down f f " " }      [ tetris-gadget-tetris move-drop ] }
-    { T{ key-down f f "p" }      [ tetris-gadget-tetris toggle-pause ] }
-    { T{ key-down f f "n" }      [ new-tetris ] }
-} set-gestures
-
-: tetris-process ( gadget -- )
-    dup tetris-gadget-quit? [
-       10 sleep
-       dup tetris-gadget-tetris maybe-update
-       [ relayout-1 ] keep
-       tetris-process
-    ] unless ;
-
-M: tetris-gadget graft* ( gadget -- )
-    f over set-tetris-gadget-quit?
-    [ tetris-process ] in-thread drop ;
-
-M: tetris-gadget ungraft* ( gadget -- )
-    t swap set-tetris-gadget-quit? ;
-
-: tetris-window ( -- ) <default-tetris> <tetris-gadget> "Tetris" open-titled-window ;
-
diff --git a/apps/tetris/tetris-gl.factor b/apps/tetris/tetris-gl.factor
deleted file mode 100644 (file)
index c6f73ec..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences arrays math namespaces opengl gadgets tetris tetris-board tetris-piece tetromino ;
-IN: tetris-gl
-
-#! OpenGL rendering for tetris
-
-: draw-block ( block -- )
-    dup { 1 1 } v+ gl-fill-rect ;
-
-: draw-piece-blocks ( piece -- )
-    piece-blocks [ draw-block ] each ;
-
-: draw-piece ( piece -- )
-    dup tetromino-colour gl-color draw-piece-blocks ;
-
-: draw-next-piece ( piece -- )
-    dup tetromino-colour clone 0.1 3 pick set-nth gl-color draw-piece-blocks ;
-
-! TODO: move implementation specific stuff into tetris-board
-: (draw-row) ( y row x -- y )
-    swap dupd nth [ gl-color over 2array draw-block ] [ drop ] if* ;
-
-: draw-row ( y row -- )
-    dup length [ (draw-row) ] each-with drop ;
-
-: draw-board ( board -- )
-    board-rows dup length [ tuck swap nth draw-row ] each-with ;
-
-: scale-tetris ( width height tetris -- )
-    [ board-width swap ] keep board-height / -rot / swap 1 glScalef ;
-
-: (draw-tetris) ( width height tetris -- )
-    #! width and height are in pixels
-    GL_MODELVIEW [
-        [ scale-tetris ] keep
-       GL_COLOR_BUFFER_BIT glClear
-       dup tetris-board draw-board
-        dup tetris-next-piece draw-next-piece
-       tetris-current-piece draw-piece
-    ] do-matrix ;
-
-: draw-tetris ( width height tetris -- )
-    origin get [ (draw-tetris) ] with-translation ;
diff --git a/apps/tetris/tetris-piece.factor b/apps/tetris/tetris-piece.factor
deleted file mode 100644 (file)
index 5182b23..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel generic arrays tetromino math sequences lazy-lists ;
-IN: tetris-piece
-
-#! A piece adds state to the tetromino that is the piece's delegate. The
-#! rotation is an index into the tetromino's states array, and the position is
-#! added to the tetromino's blocks to give them their location on the tetris
-#! board. If the location is f then the piece is not yet on the board.
-TUPLE: piece rotation location ;
-
-C: piece ( tetromino -- piece )
-    [ set-delegate ] keep
-    0 over set-piece-rotation
-    { 0 0 } over set-piece-location ;
-
-: (piece-blocks) ( piece -- blocks )
-    #! rotates the tetromino
-    dup tetromino-states swap piece-rotation swap nth ;
-
-: piece-blocks ( piece -- blocks )
-    #! rotates and positions the tetromino
-    dup piece-location swap (piece-blocks) [ v+ ] map-with ;
-
-: piece-width ( piece -- width )
-    piece-blocks blocks-width ;
-
-: set-start-location ( piece board-width -- )
-    2 / floor over piece-width 2 / floor - 0 2array swap set-piece-location ;
-
-: <random-piece> ( board-width -- piece )
-    random-tetromino <piece> [ swap set-start-location ] keep ;
-
-: <piece-llist> ( board-width -- llist )
-    [ [ <random-piece> ] curry ] keep [ <piece-llist> ] curry lazy-cons ;
-
-: modulo ( n m -- n )
-  #! -2 7 mod => -2, -2 7 modulo =>  5
-  tuck mod over + swap mod ;
-
-: rotate-piece ( piece inc -- )
-    over piece-rotation + over tetromino-states length modulo swap set-piece-rotation ;
-
-: move-piece ( piece move -- )
-    over piece-location v+ swap set-piece-location ;
-
diff --git a/apps/tetris/tetris.factor b/apps/tetris/tetris.factor
deleted file mode 100644 (file)
index e04f456..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel generic sequences math tetris-board tetris-piece tetromino errors lazy-lists ;
-IN: tetris
-
-TUPLE: tetris pieces last-update update-interval rows score game-state paused? running? ;
-
-: default-width 10 ; inline
-: default-height 20 ; inline
-
-C: tetris ( width height -- tetris )
-    >r <board> r> [ set-delegate ] keep
-    dup board-width <piece-llist> over set-tetris-pieces
-    0 over set-tetris-last-update
-    0 over set-tetris-rows
-    0 over set-tetris-score
-    f over set-tetris-paused?
-    t over set-tetris-running? ;
-
-: <default-tetris> ( -- tetris ) default-width default-height <tetris> ;
-
-: <new-tetris> ( old -- new )
-    [ board-width ] keep board-height <tetris> ;
-
-: tetris-board ( tetris -- board ) delegate ;
-
-: tetris-current-piece ( tetris -- piece ) tetris-pieces car ;
-
-: tetris-next-piece ( tetris -- piece ) tetris-pieces cdr car ;
-
-: toggle-pause ( tetris -- )
-    dup tetris-paused? not swap set-tetris-paused? ;
-
-: tetris-level ( tetris -- level )
-    tetris-rows 1+ 10 / ceiling ;
-
-: tetris-update-interval ( tetris -- interval )
-    tetris-level 1- 60 * 1000 swap - ;
-
-: add-block ( tetris block -- )
-    over tetris-current-piece tetromino-colour board-set-block ;
-
-: game-over? ( tetris -- ? )
-    dup dup tetris-next-piece piece-valid? ;
-
-: new-current-piece ( tetris -- )
-    game-over? [
-        dup tetris-pieces cdr swap set-tetris-pieces
-    ] [
-        f swap set-tetris-running?
-    ] if ;
-
-: rows-score ( level n -- score )
-    {
-       { [ dup 0 = ] [ drop 0 ]    }
-       { [ dup 1 = ] [ drop 40 ]   }
-       { [ dup 2 = ] [ drop 100 ]  }
-       { [ dup 3 = ] [ drop 300 ]  }
-       { [ dup 4 = ] [ drop 1200 ] }
-       { [ t ] [ "how did you clear that many rows?" throw ] }
-    } cond swap 1+ * ;
-
-: add-score ( tetris score -- )
-    over tetris-score + swap set-tetris-score ;
-
-: score-rows ( tetris n -- )
-    2dup >r dup tetris-level r> rows-score add-score
-    over tetris-rows + swap set-tetris-rows ;
-
-: lock-piece ( tetris -- )
-    [ dup tetris-current-piece piece-blocks [ add-block ] each-with ] keep
-    dup new-current-piece dup check-rows score-rows ;
-
-: can-rotate? ( tetris -- ? )
-    dup tetris-current-piece clone dup 1 rotate-piece piece-valid? ;
-
-: (rotate) ( inc tetris -- )
-    dup can-rotate? [ tetris-current-piece swap rotate-piece ] [ 2drop ] if ;
-
-: rotate ( tetris -- ) 1 swap (rotate) ;
-
-: can-move? ( tetris move -- ? )
-    >r dup tetris-current-piece clone dup r> move-piece piece-valid? ;
-
-: tetris-move ( tetris move -- ? )
-    #! moves the piece if possible, returns whether the piece was moved
-    2dup can-move? [
-       >r tetris-current-piece r> move-piece t
-    ] [
-       2drop f
-    ] if ;
-
-: move-left ( tetris -- ) { -1 0 } tetris-move drop ;
-
-: move-right ( tetris -- ) { 1 0 } tetris-move drop ;
-
-: move-down ( tetris -- )
-    dup { 0 1 } tetris-move [ drop ] [ lock-piece ] if ;
-
-: move-drop ( tetris -- )
-    dup { 0 1 } tetris-move [ move-drop ] [ lock-piece ] if ;
-
-: can-move? ( tetris move -- ? )
-    >r dup tetris-current-piece clone dup r> move-piece piece-valid? ;
-
-: update ( tetris -- )
-    millis over tetris-last-update -
-    over tetris-update-interval > [
-       dup move-down
-       millis swap set-tetris-last-update
-    ] [ drop ] if ;
-
-: maybe-update ( tetris -- )
-    dup tetris-paused? over tetris-running? not or [ drop ] [ update ] if ;
diff --git a/apps/tetris/tetromino.factor b/apps/tetris/tetromino.factor
deleted file mode 100644 (file)
index bfd9c34..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-! Copyright (C) 2006 Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel arrays namespaces sequences math tetris-colours ;
-IN: tetromino
-
-TUPLE: tetromino states colour ;
-
-SYMBOL: tetrominoes
-
-{
-  [
-    { {
-       { 0 0 } { 1 0 } { 2 0 } { 3 0 }
-      } 
-      { { 0 0 }
-        { 0 1 }
-        { 0 2 }
-        { 0 3 }
-      }
-    } cyan
-  ] [
-    {
-      {         { 1 0 }
-       { 0 1 } { 1 1 } { 2 1 }
-      } {
-       { 0 0 }
-       { 0 1 } { 1 1 }
-       { 0 2 }
-      } {
-       { 0 0 } { 1 0 } { 2 0 }
-               { 1 1 }
-      } {
-               { 1 0 }
-       { 0 1 } { 1 1 }
-               { 1 2 }
-      }
-    } purple
-  ] [
-    { { { 0 0 } { 1 0 }
-        { 0 1 } { 1 1 } }
-    } yellow
-  ] [
-    {
-      { { 0 0 } { 1 0 } { 2 0 }
-       { 0 1 }
-      } {
-       { 0 0 } { 1 0 }
-               { 1 1 }
-               { 1 2 }
-      } {
-                       { 2 0 }
-       { 0 1 } { 1 1 } { 2 1 }
-      } {
-       { 0 0 }
-       { 0 1 }
-       { 0 2 } { 1 2 }
-      }
-    } orange
-  ] [
-    { 
-      { { 0 0 } { 1 0 } { 2 0 }
-                       { 2 1 }
-      } {
-               { 1 0 }
-               { 1 1 }
-       { 0 2 } { 1 2 }
-      } {
-       { 0 0 }
-       { 0 1 } { 1 1 } { 2 1 }
-      } {
-       { 0 0 } { 1 0 }
-       { 0 1 }
-       { 0 2 }
-      }
-    } blue
-  ] [
-    {
-      {          { 1 0 } { 2 0 }
-       { 0 1 } { 1 1 }
-      } {
-       { 0 0 }
-       { 0 1 } { 1 1 }
-               { 1 2 }
-      }
-    } green
-  ] [
-    {
-      {
-       { 0 0 } { 1 0 }
-               { 1 1 } { 2 1 }
-      } {
-               { 1 0 }
-       { 0 1 } { 1 1 }
-       { 0 2 }
-      }
-    } red
-  ]
-} [ call <tetromino> ] map tetrominoes set-global
-
-: random-tetromino ( -- tetromino )
-  tetrominoes get dup length random-int swap nth ;
-
-: blocks-max ( blocks quot -- max )
-    ! add 1 to each block since they are 0 indexed
-    ! [ 1+ ] append map 0 [ max ] reduce ;
-    map [ 1+ ] map 0 [ max ] reduce ;
-
-: blocks-width ( blocks -- width )
-    [ first ] blocks-max ;
-
-: blocks-height ( blocks -- height )
-    [ second ] blocks-max ;
-
diff --git a/apps/turing.factor b/apps/turing.factor
deleted file mode 100644 (file)
index a97f699..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-IN: turing
-USING: arrays hashtables io kernel math namespaces
-prettyprint sequences strings vectors words ;
-
-! A turing machine simulator.
-
-TUPLE: state sym dir next ;
-
-! Mapping from symbol/state pairs into new-state tuples
-SYMBOL: states
-
-! Halting state
-SYMBOL: halt
-
-! This is a simple program that outputs 5 1's
-H{
-    { { 1 0 } T{ state f 1  1 2    } }
-    { { 2 0 } T{ state f 1  1 3    } }
-    { { 3 0 } T{ state f 1 -1 1    } }
-    { { 1 1 } T{ state f 1 -1 2    } }
-    { { 2 1 } T{ state f 1 -1 3    } }
-    { { 3 1 } T{ state f 1 -1 halt } }
-} states set
-
-! Current state
-SYMBOL: state
-
-! Initial state
-1 state set
-
-! Position of head on tape
-SYMBOL: position
-
-! Initial tape position
-5 position set
-
-! The tape, a mutable sequence of some kind
-SYMBOL: tape
-
-! Initial tape
-20 0 <array> >vector tape set
-
-: sym ( -- sym )
-    #! Symbol at head position.
-    position get tape get nth ;
-
-: set-sym ( sym -- )
-    #! Set symbol at head position.
-    position get tape get set-nth ;
-
-: next-state ( -- state )
-    #! Look up the next state/symbol/direction triplet.
-    state get sym 2array states get hash ;
-
-: turing-step ( -- )
-    #! Do one step of the turing machine.
-    next-state
-    dup state-sym set-sym
-    dup state-dir position [ + ] change
-    state-next state set ;
-
-: c
-    #! Print current turing machine state.
-    state get .
-    tape get .
-    2 position get 2 * + CHAR: \s <string> write "^" print ;
-
-: n
-    #! Do one step and print new state.
-    turing-step c ;
-
-PROVIDE: apps/turing ;
diff --git a/core/alien/alien-docs.factor b/core/alien/alien-docs.factor
new file mode 100644 (file)
index 0000000..259d78f
--- /dev/null
@@ -0,0 +1,527 @@
+USING: byte-arrays arrays help.syntax help.markup
+alien.syntax alien.c-types compiler definitions math libc
+debugger parser io io.backend system bit-arrays float-arrays ;
+IN: alien
+
+HELP: alien
+{ $class-description "The class of alien pointers. See " { $link "syntax-aliens" } " for syntax and " { $link "c-data" } " for general information." } ;
+
+HELP: dll
+{ $class-description "The class of native library handles. See " { $link "syntax-aliens" } " for syntax and " { $link "dll.private" } " for general information." } ;
+
+HELP: expired? ( c-ptr -- ? )
+{ $values { "c-ptr" "an alien, byte array, or " { $link f } } { "?" "a boolean" } }
+{ $description "Tests if the alien is a relic from an earlier session. When an image is loaded, any alien objects which persisted in the image are marked as being expired."
+$nl
+"A byte array is never considered to be expired, whereas passing " { $link f } " always yields true." } ;
+
+HELP: <displaced-alien> ( displacement c-ptr -- alien )
+{ $values { "displacement" "an integer" } { "c-ptr" "an alien, byte array, or " { $link f } } { "alien" "a new alien" } }
+{ $description "Creates a new alien address object, wrapping a raw memory address. The alien points to a location in memory which is offset by " { $snippet "displacement" } " from the address of " { $snippet "c-ptr" } "." }
+{ $notes "Passing a value of " { $link f } " for " { $snippet "c-ptr" } " creates an alien with an absolute address; this is how " { $link <alien> } " is implemented."
+$nl
+"Passing a zero absolute address does not construct a new alien object, but instead makes the word output " { $link f } "." } ;
+
+{ <alien> <displaced-alien> alien-address } related-words
+
+HELP: alien-address ( c-ptr -- addr )
+{ $values { "c-ptr" "an alien or " { $link f } } { "addr" "a non-negative integer" } }
+{ $description "Outputs the address of an alien." }
+{ $notes "Taking the address of a " { $link byte-array } " is explicitly prohibited since byte arrays can be moved by the garbage collector between the time the address is taken, and when it is accessed. If you need to pass pointers to C functions which will persist across alien calls, you must allocate unmanaged memory instead. See " { $link "malloc" } "." } ;
+
+HELP: <alien>
+{ $values { "address" "a non-negative integer" } { "alien" "a new alien address" } }
+{ $description "Creates an alien object, wrapping a raw memory address." }
+{ $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*" } "." } ;
+
+HELP: library
+{ $values { "name" "a string" } { "library" "a hashtable" } }
+{ $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 "dll" } " - an instance of the " { $link dll } " class; only set if the library is loaded" }
+    }
+} ;
+
+HELP: dlopen ( path -- dll )
+{ $values { "path" "a pathname string" } { "dll" "a DLL handle" } }
+{ $description "Opens a native library and outputs a handle which may be passed to " { $link dlsym } " or " { $link dlclose } "." }
+{ $errors "Throws an error if the library could not be found, or if loading fails for some other reason." }
+{ $notes "This is the low-level facility used to implement " { $link load-library } ". Use the latter instead." } ;
+
+HELP: dlsym ( name dll -- alien )
+{ $values { "name" "a C symbol name" } { "dll" "a DLL handle" } { "alien" "an alien pointer" } }
+{ $description "Looks up a symbol in a native library. If " { $snippet "dll" } " is " { $link f } " looks for the symbol in the runtime executable." }
+{ $errors "Throws an error if the symbol could not be found." } ;
+
+HELP: dlclose ( dll -- )
+{ $values { "dll" "a DLL handle" } }
+{ $description "Closes a DLL handle created by " { $link dlopen } ". This word might not be implemented on all platforms." } ;
+
+HELP: load-library
+{ $values { "name" "a string" } { "dll" "a DLL handle" } }
+{ $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." }
+{ $errors "Throws an error if the library could not be found, or if loading fails for some other reason." } ;
+
+HELP: add-library
+{ $values { "name" "a string" } { "path" "a string" } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } }
+{ $description "Defines a new logical library named " { $snippet "name" } " located in the file system at " { $snippet "path" } "and the specified ABI." }
+{ $examples { $code "\"gif\" \"libgif.so\" \"cdecl\" add-library" } } ;
+
+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:"
+    { $list
+        { "This can happen when experimenting with " { $link alien-invoke } " in this listener. To fix the problem, place the " { $link alien-invoke } " call in a word and then call " { $link recompile } ". See " { $link "compiler" } "." }
+        { "The return type or parameter list references an unknown C type." }
+        { "The symbol or library could not be found." }
+        { "One of the four inputs to " { $link alien-invoke } " is not a literal value. To call functions which are not known at compile-time, use " { $link alien-indirect } "." }
+    }
+} ;
+
+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" } }
+{ $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 " { $snippet "\"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." } ;
+
+HELP: alien-indirect-error
+{ $error-description "Thrown if the word calling " { $link alien-indirect } " was not compiled with the optimizing compiler. This may be a result of one of several failure conditions:"
+    { $list
+        { "This can happen when experimenting with " { $link alien-indirect } " in this listener. To fix the problem, place the " { $link alien-indirect } " call in a word and then call " { $link recompile } ". See " { $link "compiler" } "." }
+        { "The return type or parameter list references an unknown C type." }
+        { "One of the three inputs to " { $link alien-indirect } " is not a literal value." }
+    }
+} ;
+
+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\"" } } }
+{ $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 " { $snippet "\"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-indirect-error } " if the word calling " { $link alien-indirect } " is not compiled." } ;
+
+HELP: alien-callback-error
+{ $error-description "Thrown if the word calling " { $link alien-callback } " was not compiled with the optimizing compiler. This may be a result of one of several failure conditions:"
+    { $list
+        { "This can happen when experimenting with " { $link alien-callback } " in this listener. To fix the problem, place the " { $link alien-callback } " call in a word and then call " { $link recompile } ". See " { $link "compiler" } "." }
+        { "The return type or parameter list references an unknown C type." }
+        { "One of the four inputs to " { $link alien-callback } " is not a literal value." }
+    }
+} ;
+
+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" "a quotation" } { "alien" c-ptr } }
+{ $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
+    "When a compiled reference to this word is called, it pushes the callback's alien address on the data stack. This address can be passed to any C function expecting a C function pointer with the correct signature. The callback is actually generated when the word calling " { $link alien-callback } " is compiled."
+    $nl
+    "Callback quotations run with freshly-allocated stacks. This means the data stack contains the values passed by the C function, and nothing else. It also means that if the callback throws an error which is not caught, the Factor runtime will halt. See " { $link "errors" } " for error handling options."
+}
+{ $notes "C type names are documented in " { $link "c-types-specs" } "." }
+{ $examples
+    "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 ;"
+    }
+}
+{ $errors "Throws an " { $link alien-callback-error } " if the word calling " { $link alien-callback } " is not compiled." } ;
+
+{ alien-invoke alien-indirect alien-callback } related-words
+
+ARTICLE: "aliens" "Alien addresses"
+"Instances of the " { $link alien } " class represent pointers to C data outside the Factor heap:"
+{ $subsection <alien> }
+{ $subsection <displaced-alien> }
+{ $subsection alien-address }
+{ $subsection expired? }
+"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. See " { $link "c-types-specs" } "." ;
+
+ARTICLE: "c-structs" "C structure types"
+"A " { $snippet "struct" } " in C is essentially a block of memory with the value of each structure field stored at a fixed offset from the start of the block. The C library interface provides some utilities to define words which read and write structure fields given a base address."
+{ $subsection POSTPONE: C-STRUCT: }
+"Great care must be taken when working with C structures since no type or bounds checking is possible."
+$nl
+"An example:"
+{ $code
+    "C-STRUCT: XVisualInfo"
+    "    { \"Visual*\" \"visual\" }"
+    "    { \"VisualID\" \"visualid\" }"
+    "    { \"int\" \"screen\" }"
+    "    { \"uint\" \"depth\" }"
+    "    { \"int\" \"class\" }"
+    "    { \"ulong\" \"red_mask\" }"
+    "    { \"ulong\" \"green_mask\" }"
+    "    { \"ulong\" \"blue_mask\" }"
+    "    { \"int\" \"colormap_size\" }"
+    "    { \"int\" \"bits_per_rgb\" } ;"
+}
+"C structure objects can be allocated by calling " { $link <c-object> } " or " { $link malloc-object } "."
+$nl
+"Arrays of C structures can be created by calling " { $link <c-array> } " or " { $link malloc-array } ". Elements can be read and written using words named " { $snippet { $emphasis "type" } "-nth" } " and " { $snippet "set-" { $emphasis "type" } "-nth" } "; these words are automatically generated by " { $link POSTPONE: C-STRUCT: } "." ;
+
+ARTICLE: "c-unions" "C unions"
+"A " { $snippet "union" } " in C defines a type large enough to hold its largest member. This is usually used to allocate a block of memory which can hold one of several types of values."
+{ $subsection POSTPONE: C-UNION: }
+"C structure objects can be allocated by calling " { $link <c-object> } " or " { $link malloc-object } "."
+$nl
+"Arrays of C unions can be created by calling " { $link <c-array> } " or " { $link malloc-array } ". Elements can be read and written using words named " { $snippet { $emphasis "type" } "-nth" } " and " { $snippet "set-" { $emphasis "type" } "-nth" } "; these words are automatically generated by " { $link POSTPONE: C-UNION: } "." ;
+
+ARTICLE: "reading-writing-memory" "Reading and writing memory directly"
+"Numerical values can be read from memory addresses and converted to Factor objects using the various typed memory accessor words:"
+{ $subsection alien-signed-1 }
+{ $subsection alien-unsigned-1 }
+{ $subsection alien-signed-2 }
+{ $subsection alien-unsigned-2 }
+{ $subsection alien-signed-4 }
+{ $subsection alien-unsigned-4 }
+{ $subsection alien-signed-cell }
+{ $subsection alien-unsigned-cell }
+{ $subsection alien-signed-8 }
+{ $subsection alien-unsigned-8 }
+{ $subsection alien-float }
+{ $subsection alien-double }
+"Factor numbers can also be converted to C values and stored to memory:"
+{ $subsection set-alien-signed-1 }
+{ $subsection set-alien-unsigned-1 }
+{ $subsection set-alien-signed-2 }
+{ $subsection set-alien-unsigned-2 }
+{ $subsection set-alien-signed-4 }
+{ $subsection set-alien-unsigned-4 }
+{ $subsection set-alien-signed-cell }
+{ $subsection set-alien-unsigned-cell }
+{ $subsection set-alien-signed-8 }
+{ $subsection set-alien-unsigned-8 }
+{ $subsection set-alien-float }
+{ $subsection set-alien-double } ;
+
+ARTICLE: "loading-libs" "Loading native libraries"
+"Before calling a C library, you must associate its path name on disk with a logical name which Factor uses to identify the library:"
+{ $subsection add-library }
+"Once a library has been defined, you can try loading it to see if the path name is correct:"
+{ $subsection load-library } ;
+
+ARTICLE: "alien-invoke" "Calling C from Factor"
+"The easiest way to call into a C library is to define bindings using a pair of parsing words:"
+{ $subsection POSTPONE: LIBRARY: }
+{ $subsection POSTPONE: FUNCTION: }
+"The above parsing words create word definitions which call a lower-level word; you can use it directly, too:"
+{ $subsection alien-invoke }
+"Sometimes it is necessary to invoke a C function pointer, rather than a named C function:"
+{ $subsection alien-indirect }
+"There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-data" } "."
+$nl
+"Don't forget to compile your binding word after defining it; C library calls cannot be made from an interpreted definition. Words defined in source files are automatically compiled when the source file is loaded, but words defined in the listener are not; when interactively testing C libraries, use " { $link compile } " or " { $link recompile } " to compile binding words." ;
+
+ARTICLE: "alien-callback-gc" "Callbacks and code GC"
+"A callback consits of two parts; the callback word, which pushes the address of the callback on the stack when executed, and the callback body itself. If the callback word is redefined, removed from the dictionary using " { $link forget } ", or recompiled, the callback body will not be reclaimed by the garbage collector, since potentially C code may be holding a reference to the callback body."
+$nl
+"This is the safest approach, however it can lead to code heap leaks when repeatedly reloading code which defines callbacks. If you are " { $emphasis "completely sure" } " that no running C code is holding a reference to any callbacks, you can blow them all away:"
+{ $code "USE: alien callbacks get clear-hash code-gc" }
+"This will reclaim all callback bodies which are otherwise unreachable from the dictionary (that is, their associated callback words have since been redefined, recompiled or forgotten)." ;
+
+ARTICLE: "alien-callback" "Calling Factor from C"
+"Callbacks can be defined and passed to C code as function pointers; the C code can then invoke the callback and run Factor code:"
+{ $subsection alien-callback }
+"There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-data" } "."
+{ $subsection "alien-callback-gc" } ;
+
+ARTICLE: "dll.private" "DLL handles"
+"DLL handles are a built-in class of objects which represent loaded native libraries. DLL handles are instances of the " { $link dll } " class, and have a literal syntax used for debugging prinouts; see " { $link "syntax-aliens" } "."
+$nl
+"Usually one never has to deal with DLL handles directly; the C library interface creates them as required. However if direct access to these operating system facilities is required, the following primitives can be used:"
+{ $subsection dlopen }
+{ $subsection dlsym }
+{ $subsection dlclose } ;
+
+ARTICLE: "c-types-specs" "C type specifiers"
+"C types are identified by strings, and type names occur as parameters to the " { $link alien-invoke } ", " { $link alien-indirect } " and " { $link alien-callback } " words, as well as " { $link POSTPONE: C-STRUCT: } ", " { $link POSTPONE: C-UNION: } " and " { $link POSTPONE: TYPEDEF: } "."
+$nl
+"The following numerical types are available; a " { $snippet "u" } " prefix denotes an unsigned type:"
+{ $table
+    { "C type" "Notes" }
+    { { $snippet "char" } "always 1 byte" }
+    { { $snippet "uchar" } { } }
+    { { $snippet "short" } "always 2 bytes" }
+    { { $snippet "ushort" } { } }
+    { { $snippet "int" } "always 4 bytes" }
+    { { $snippet "uint" } { } }
+    { { $snippet "long" } { "same size as CPU word size and " { $snippet "void*" } ", except on 64-bit Windows, where it is 4 bytes" } }
+    { { $snippet "ulong" } { } }
+    { { $snippet "longlong" } "always 8 bytes" }
+    { { $snippet "ulonglong" } { } }
+    { { $snippet "float" } { } }
+    { { $snippet "double" } { "same format as " { $link float } " objects" } }
+}
+"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."
+$nl
+"Pointer types are specified by suffixing a C type with " { $snippet "*" } ", for example " { $snippet "float*" } ". One special case is " { $snippet "void*" } ", which denotes a generic pointer; " { $snippet "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."
+$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."
+$nl
+"Structure and union types are specified by the name of the structure or union." ;
+
+ARTICLE: "c-byte-arrays" "Passing data in byte arrays"
+"Instances of the " { $link byte-array } ", " { $link bit-array } " and " { $link float-array } " class can be passed to C functions; the C function receives a pointer to the first element of the array."
+$nl
+"Byte arrays can be allocated directly with a byte count using the " { $link <byte-array> } " word. However in most cases, instead of computing a size in bytes directly, it is easier to use a higher-level word which expects C type and outputs a byte array large enough to hold that type:"
+{ $subsection <c-object> }
+{ $subsection <c-array> }
+{ $warning
+"The Factor garbage collector can move byte arrays around, and it is only safe to pass byte arrays to C functions if the function does not store a pointer to the byte array in some global structure, or retain it in any way after returning."
+$nl
+"Long-lived data for use by C libraries can be allocated manually, just as when programming in C. See " { $link "malloc" } "." }
+{ $see-also "c-arrays" } ;
+
+ARTICLE: "malloc" "Manual memory management"
+"Sometimes data passed to C functions must be allocated at a fixed address, and so garbage collector managed byte arrays cannot be used. See the warning at the bottom of " { $link "c-byte-arrays" } " for a description of when this is the case."
+$nl
+"Allocating a C datum with a fixed address:"
+{ $subsection malloc-object }
+{ $subsection malloc-array }
+{ $subsection malloc-byte-array }
+"There is a set of words in the " { $vocab-link "libc" } " vocabulary which directly call C standard library memory management functions:"
+{ $subsection malloc }
+{ $subsection calloc }
+{ $subsection realloc }
+"The return value of the above three words must always be checked for a memory allocation failure:"
+{ $subsection check-ptr }
+"You must always free pointers returned by any of the above words when the block of memory is no longer in use:"
+{ $subsection free }
+"You can unsafely copy a range of bytes from one memory location to another:"
+{ $subsection memcpy }
+"A wrapper for temporarily allocating a block of memory:"
+{ $subsection with-malloc } ;
+
+ARTICLE: "c-strings" "C strings"
+"The C library interface defines two types of C strings:"
+{ $table
+    { "C type" "Notes" }
+    { { $snippet "char*" } "8-bit per character null-terminated ASCII" }
+    { { $snippet "ushort*" } "16-bit per character null-terminated UCS-2" }
+}
+"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. 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."
+"Sometimes a C function has a parameter type of " { $snippet "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:"
+{ $subsection string>char-alien }
+{ $subsection string>u16-alien }
+{ $subsection malloc-char-string }
+{ $subsection malloc-u16-string }
+"The first two allocate " { $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 } "."
+$nl
+"Finally, a set of words can be used to read and write " { $snippet "char*" } " and " { $snippet "ushort*" } " strings at arbitrary addresses:"
+{ $subsection alien>char-string }
+{ $subsection alien>u16-string }
+{ $subsection memory>string }
+{ $subsection string>memory } ;
+
+ARTICLE: "c-arrays-factor" "Converting C arrays to and from Factor arrays"
+"Each primitive C type has a pair of words, " { $snippet ">" { $emphasis "type" } "-array" } " and " { $snippet { $emphasis "type" } "-array>" } ", for converting an array of Factor objects to and from a " { $link byte-array } " of C values. This set of words consists of:"
+{ $subsection >c-bool-array      }
+{ $subsection >c-char-array      }
+{ $subsection >c-double-array    }
+{ $subsection >c-float-array     }
+{ $subsection >c-int-array       }
+{ $subsection >c-long-array      }
+{ $subsection >c-longlong-array  }
+{ $subsection >c-short-array     }
+{ $subsection >c-uchar-array     }
+{ $subsection >c-uint-array      }
+{ $subsection >c-ulong-array     }
+{ $subsection >c-ulonglong-array }
+{ $subsection >c-ushort-array    }
+{ $subsection >c-void*-array     }
+{ $subsection c-bool-array>      }
+{ $subsection c-char*-array>     }
+{ $subsection c-char-array>      }
+{ $subsection c-double-array>    }
+{ $subsection c-float-array>     }
+{ $subsection c-int-array>       }
+{ $subsection c-long-array>      }
+{ $subsection c-longlong-array>  }
+{ $subsection c-short-array>     }
+{ $subsection c-uchar-array>     }
+{ $subsection c-uint-array>      }
+{ $subsection c-ulong-array>     }
+{ $subsection c-ulonglong-array> }
+{ $subsection c-ushort*-array>   }
+{ $subsection c-ushort-array>    }
+{ $subsection c-void*-array>     } ;
+
+ARTICLE: "c-arrays-get/set" "Reading and writing elements in C arrays"
+"Each C type has a pair of words, " { $snippet { $emphasis "type" } "-nth" } " and " { $snippet "set-" { $emphasis "type" } "-nth" } ", for reading and writing values of this type stored in an array. This set of words includes but is not limited to:"
+{ $subsection char-nth }
+{ $subsection set-char-nth }
+{ $subsection uchar-nth }
+{ $subsection set-uchar-nth }
+{ $subsection short-nth }
+{ $subsection set-short-nth }
+{ $subsection ushort-nth }
+{ $subsection set-ushort-nth }
+{ $subsection int-nth }
+{ $subsection set-int-nth }
+{ $subsection uint-nth }
+{ $subsection set-uint-nth }
+{ $subsection long-nth }
+{ $subsection set-long-nth }
+{ $subsection ulong-nth }
+{ $subsection set-ulong-nth }
+{ $subsection longlong-nth }
+{ $subsection set-longlong-nth }
+{ $subsection ulonglong-nth }
+{ $subsection set-ulonglong-nth }
+{ $subsection float-nth }
+{ $subsection set-float-nth }
+{ $subsection double-nth }
+{ $subsection set-double-nth }
+{ $subsection void*-nth }
+{ $subsection set-void*-nth }
+{ $subsection char*-nth }
+{ $subsection ushort*-nth } ;
+
+ARTICLE: "c-arrays" "C arrays"
+"C arrays are allocated in the same manner as other C data; see " { $link "c-byte-arrays" } " and " { $link "malloc" } "."
+$nl
+"C type specifiers for array types are documented in " { $link "c-types-specs" } "."
+{ $subsection "c-arrays-factor" }
+{ $subsection "c-arrays-get/set" } ;
+
+ARTICLE: "c-out-params" "Output parameters in C"
+"A frequently-occurring idiom in C code is the \"out parameter\". If a C function returns more than one value, the caller passes pointers of the correct type, and the C function writes its return values to those locations."
+$nl
+"Each numerical C type, together with " { $snippet "void*" } ", has an associated " { $emphasis "out parameter constructor" } " word which takes a Factor object as input, constructs a byte array of the correct size, and converts the Factor object to a C value stored into the byte array:"
+{ $subsection <char> }
+{ $subsection <uchar> }
+{ $subsection <short> }
+{ $subsection <ushort> }
+{ $subsection <int> }
+{ $subsection <uint> }
+{ $subsection <long> }
+{ $subsection <ulong> }
+{ $subsection <longlong> }
+{ $subsection <ulonglong> }
+{ $subsection <float> }
+{ $subsection <double> }
+{ $subsection <void*> }
+"You call the out parameter constructor with the required initial value, then pass the byte array to the C function, which receives a pointer to the start of the byte array's data area. The C function then returns, leaving the result in the byte array; you read it back using the next set of words:"
+{ $subsection *char }
+{ $subsection *uchar }
+{ $subsection *short }
+{ $subsection *ushort }
+{ $subsection *int }
+{ $subsection *uint }
+{ $subsection *long }
+{ $subsection *ulong }
+{ $subsection *longlong }
+{ $subsection *ulonglong }
+{ $subsection *float }
+{ $subsection *double }
+{ $subsection *void* }
+{ $subsection *char* }
+{ $subsection *ushort* }
+"Note that while structure and union types do not get these words defined for them, there is no loss of generality since " { $link <void*> } " and " { $link *void* } " may be used." ;
+
+ARTICLE: "c-data" "Passing data between Factor and C"
+"Two defining characteristics of Factor are dynamic typing and automatic memory management, which are somewhat incompatible with the machine-level data model exposed by C. Factor's C library interface defines its own set of C data types, distinct from Factor language types, together with automatic conversion between Factor values and C types. For example, C integer types must be declared and are fixed-width, whereas Factor supports arbitrary-precision integers. Also Factor's garbage collector can move objects in memory, which means that special support has to be provided for passing blocks of memory to C code."
+{ $subsection "c-types-specs" }
+{ $subsection "c-byte-arrays" }
+{ $subsection "malloc" }
+{ $subsection "c-strings" }
+{ $subsection "c-arrays" }
+{ $subsection "c-out-params" }
+"C-style enumerated types are supported:"
+{ $subsection POSTPONE: C-ENUM: }
+"C types can be aliased for convenience and consitency with native library documentation:"
+{ $subsection POSTPONE: TYPEDEF: }
+"New C types can be defined:"
+{ $subsection "c-structs" }
+{ $subsection "c-unions" }
+{ $subsection "reading-writing-memory" } ;
+
+ARTICLE: "embedding-api" "Factor embedding API"
+"The Factor embedding API is defined in " { $snippet "vm/master.h" } "."
+$nl
+"The " { $snippet "F_CHAR" } " type is an alias for the character type used for path names by the operating system; " { $snippet "char" } " on Unix and " { $snippet "wchar_t" } " on Windows."
+$nl
+"Including this header file into a C compilation unit will declare the following functions:"
+{ $table
+    { {
+        { $code "void init_factor_from_args("
+            "    F_CHAR *image, int argc, F_CHAR **argv, bool embedded"
+            ")" }
+        "Initializes Factor."
+        $nl
+        "If " { $snippet "image" } " is " { $snippet "NULL" } ", Factor will load an image file whose name is obtained by suffixing the executable name with " { $snippet ".image" } "."
+        $nl
+        "The " { $snippet "argc" } " and " { $snippet "argv" } " parameters are interpreted just like normal command line arguments when running Factor stand-alone; see " { $link "cli" } "."
+        $nl
+        "The " { $snippet "embedded" } " flag ensures that this function returns as soon as Factor has been initialized. Otherwise, Factor will start up normally."
+    } }
+    { {
+        { $code "char *factor_eval_string(char *string)" }
+        "Evaluates a piece of code in the embedded Factor instance by passing the string to " { $link eval>string } " and returning the result. The result must be explicitly freed by a call to " { $snippet "factor_eval_free" } "."
+    } }
+    { {
+        { $code "void factor_eval_free(char *result)" }
+        "Frees a string returned by " { $snippet "factor_eval_string()" } "."
+    } }
+    { {
+        { $code "void factor_yield(void)" }
+        "Gives all Factor threads a chance to run."
+    } }
+    { {
+        { $code "void factor_sleep(long ms)" }
+        "Gives all Factor threads a chance to run for " { $snippet "ms" } " milliseconds."
+    } }
+} ;
+
+ARTICLE: "embedding-restrictions" "Embedding API restrictions" 
+"The Factor VM is not thread safe, and does not support multiple instances. There must only be one Factor instance per process, and this instance must be consistently accessed from the same thread for its entire lifetime. Once initialized, a Factor instance cannot be destroyed other than by exiting the process." ;
+
+ARTICLE: "embedding-factor" "What embedding looks like from Factor"
+"Factor code will run inside an embedded instance in the same way it would run in a stand-alone instance."
+$nl
+"One exception is the global " { $link stdio } " stream, which is by default not bound to the terminal where the process is running, to avoid conflicting with any I/O the host process might perform. To initialize the terminal stream, " { $link init-stdio } " must be called explicitly."
+$nl
+"There is a word which can detect when Factor is embedded:"
+{ $subsection embedded? }
+"No special support is provided for calling out from Factor into the owner process. The C library inteface works fine for this task - see " { $link "alien" } "." ;
+
+ARTICLE: "embedding" "Embedding Factor into C applications"
+"The Factor " { $snippet "Makefile" } " builds the Factor VM both as an executable and a library. The library can be used by other applications. File names for the library on various operating systems:"
+{ $table
+    { "OS" "Library name" "Shared?" }
+    { "Windows XP/Vista" { $snippet "factor-nt.dll" } "Yes" }
+    { "Windows CE" { $snippet "factor-ce.dll" } "Yes" }
+    { "Mac OS X" { $snippet "libfactor.dylib" } "Yes" }
+    { "Other Unix" { $snippet "libfactor.a" } "No" }
+}
+"An image file must be supplied; a minimal image can be built, however the compiler must be included for the embedding API to work (see " { $link "bootstrap-cli-args" } ")."
+{ $subsection "embedding-api" }
+{ $subsection "embedding-factor" }
+{ $subsection "embedding-restrictions" } ;
+
+ARTICLE: "alien" "C library interface"
+"Factor can directly call C functions in native libraries. It is also possible to compile callbacks which run Factor code, and pass them to native libraries as function pointers."
+$nl
+"The C library interface is entirely self-contained; there is no C code which one must write in order to wrap a library."
+$nl
+"C library interface words are found in the " { $vocab-link "alien" } " vocabulary."
+{ $warning "Since C does not retain runtime type information or do any kind of runtime type checking, any C library interface is not pointer safe. Improper use of C functions can crash the runtime or corrupt memory in unpredictible ways." }
+{ $subsection "loading-libs" }
+{ $subsection "alien-invoke" }
+{ $subsection "alien-callback" }
+{ $subsection "c-data" }
+{ $subsection "dll.private" }
+{ $subsection "embedding" } ;
+
+ABOUT: "alien"
diff --git a/core/alien/alien-tests.factor b/core/alien/alien-tests.factor
new file mode 100644 (file)
index 0000000..0adc5f0
--- /dev/null
@@ -0,0 +1,58 @@
+IN: temporary
+USING: alien byte-arrays
+arrays kernel kernel.private namespaces tools.test sequences
+libc math system prettyprint ;
+
+[ t ] [ -1 <alien> alien-address 0 > ] unit-test
+
+[ t ] [ 0 <alien> 0 <alien> = ] unit-test
+[ f ] [ 0 <alien> 1024 <alien> = ] unit-test
+[ f ] [ "hello" 1024 <alien> = ] unit-test
+[ f ] [ 0 <alien> ] unit-test
+[ f ] [ 0 f <displaced-alien> ] unit-test
+
+! Testing the various bignum accessor
+10 <byte-array> "dump" set
+
+[ "dump" get alien-address ] unit-test-fails
+
+[ 123 ] [
+    123 "dump" get 0 set-alien-signed-1
+    "dump" get 0 alien-signed-1
+] unit-test
+
+[ 12345 ] [
+    12345 "dump" get 0 set-alien-signed-2
+    "dump" get 0 alien-signed-2
+] unit-test
+
+[ 12345678 ] [
+    12345678 "dump" get 0 set-alien-signed-4
+    "dump" get 0 alien-signed-4
+] unit-test
+
+[ 12345678901234567 ] [
+    12345678901234567 "dump" get 0 set-alien-signed-8
+    "dump" get 0 alien-signed-8
+] unit-test
+
+[ -1 ] [
+    -1 "dump" get 0 set-alien-signed-8
+    "dump" get 0 alien-signed-8
+] unit-test
+
+cell 8 = [
+    [ HEX: 123412341234 ] [
+      8 <byte-array>
+      HEX: 123412341234 over 0 set-alien-signed-8
+      0 alien-signed-8
+    ] unit-test
+    
+    [ HEX: 123412341234 ] [
+      8 <byte-array>
+      HEX: 123412341234 over 0 set-alien-signed-cell
+      0 alien-signed-cell
+    ] unit-test
+] when
+
+[ "ALIEN: 1234" ] [ 1234 <alien> unparse ] unit-test
diff --git a/core/alien/alien.factor b/core/alien/alien.factor
new file mode 100644 (file)
index 0000000..5af9e9f
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: alien
+USING: assocs kernel math namespaces sequences system
+byte-arrays bit-arrays float-arrays kernel.private tuples ;
+
+PREDICATE: alien simple-alien
+    underlying-alien not ;
+
+UNION: simple-c-ptr
+    simple-alien byte-array bit-array float-array POSTPONE: f ;
+
+UNION: c-ptr
+    alien bit-array byte-array float-array POSTPONE: f ;
+
+M: f expired? drop t ;
+
+: <alien> ( address -- alien )
+    f <displaced-alien> { simple-c-ptr } declare ; inline
+
+: alien>native-string ( alien -- string )
+    windows? [ alien>u16-string ] [ alien>char-string ] if ;
+
+: dll-path ( dll -- string )
+    (dll-path) alien>native-string ;
+
+M: alien equal?
+    over alien? [
+        2dup [ expired? ] either? [
+            [ expired? ] both?
+        ] [
+            [ alien-address ] 2apply =
+        ] if
+    ] [
+        2drop f
+    ] if ;
+
+SYMBOL: libraries
+
+global [
+    libraries [ H{ } assoc-like ] change
+] bind
+
+TUPLE: library path abi dll ;
+
+: library ( name -- library ) libraries get at ;
+
+: <library> ( path abi -- library ) f \ library construct-boa ;
+
+: load-library ( name -- dll )
+    library dup [
+        dup library-dll [ ] [
+            dup library-path dup [
+                dlopen dup rot set-library-dll
+            ] [
+                2drop f
+            ] if
+        ] ?if
+    ] when ;
+
+: add-library ( name path abi -- )
+    <library> swap libraries get set-at ;
+
+TUPLE: alien-callback return parameters abi quot xt ;
+
+TUPLE: alien-callback-error ;
+
+: alien-callback ( return parameters abi quot -- alien )
+    \ alien-callback-error construct-empty throw ;
+
+TUPLE: alien-indirect return parameters abi ;
+
+TUPLE: alien-indirect-error ;
+
+: alien-indirect ( ... funcptr return parameters abi -- )
+    \ alien-indirect-error construct-empty throw ;
+
+TUPLE: alien-invoke library function return parameters ;
+
+TUPLE: alien-invoke-error library symbol ;
+
+: alien-invoke ( ... return library function parameters -- ... )
+    pick pick \ alien-invoke-error construct-boa throw ;
diff --git a/core/alien/arrays/arrays.factor b/core/alien/arrays/arrays.factor
new file mode 100644 (file)
index 0000000..c9b9d83
--- /dev/null
@@ -0,0 +1,38 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays alien.c-types alien.structs
+sequences math kernel generator.registers
+namespaces libc ;
+IN: alien.arrays
+
+UNION: value-type array struct-type ;
+
+M: array c-type ;
+
+M: array heap-size unclip heap-size [ * ] reduce ;
+
+M: array c-type-align first c-type c-type-align ;
+
+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: value-type c-type-reg-class drop T{ int-regs } ;
+
+M: value-type c-type-prep drop f ;
+
+M: value-type c-type-getter
+    drop [ swap <displaced-alien> ] ;
+
+M: value-type c-type-setter ( type -- quot )
+    [
+        dup c-type-getter % \ swap , heap-size , \ memcpy ,
+    ] [ ] make ;
diff --git a/core/alien/arrays/authors.txt b/core/alien/arrays/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/alien/arrays/summary.txt b/core/alien/arrays/summary.txt
new file mode 100644 (file)
index 0000000..9d8297d
--- /dev/null
@@ -0,0 +1 @@
+C array support
diff --git a/core/alien/authors.txt b/core/alien/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/alien/c-types/authors.txt b/core/alien/c-types/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/alien/c-types/c-types-docs.factor b/core/alien/c-types/c-types-docs.factor
new file mode 100644 (file)
index 0000000..55b788d
--- /dev/null
@@ -0,0 +1,153 @@
+USING: alien alien.c-types help.syntax help.markup libc
+kernel.private byte-arrays math strings ;
+
+HELP: <c-type>
+{ $values { "type" "a hashtable" } }
+{ $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 { "type" string } }
+{ $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-types
+{ $var-description "Global variable holding a hashtable mapping C type names to C types. Use the " { $link c-type } " word to look up C types." } ;
+
+HELP: c-type
+{ $values { "name" string } { "type" "a hashtable" } }
+{ $description "Looks up a C type by name." }
+{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
+
+HELP: heap-size
+{ $values { "type" string } { "size" "an integer" } }
+{ $description "Outputs the number of bytes needed for a heap-allocated value of this C type." }
+{ $examples
+    "On a 32-bit system, you will get the following output:"
+    { $unchecked-example "USE: alien\n\"void*\" heap-size ." "4" }
+}
+{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
+
+HELP: stack-size
+{ $values { "type" string } { "size" "an 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-getter
+{ $values { "name" string } { "quot" "a quotation with stack effect " { $snippet "( c-ptr n -- obj )" } } }
+{ $description "Outputs a quotation which reads values of this C type from a C structure." }
+{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
+
+HELP: c-setter
+{ $values { "name" string } { "quot" "a quotation with stack effect " { $snippet "( 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: <c-array>
+{ $values { "n" "a non-negative integer" } { "type" "a C type" } { "array" byte-array } }
+{ $description "Creates a byte array large enough to hold " { $snippet "n" } " values of a C type." }
+{ $errors "Throws an error if the type does not exist or the requested size is negative." } ;
+
+{ <c-array> malloc-array } related-words
+
+HELP: <c-object>
+{ $values { "type" "a C type" } { "array" byte-array } }
+{ $description "Creates a byte array suitable for holding a value with the given C type." }
+{ $errors "Throws an " { $link no-c-type } " error if the type does not exist." } ;
+
+{ <c-object> malloc-object } related-words
+
+HELP: string>char-alien ( string -- array )
+{ $values { "string" string } { "array" byte-array } }
+{ $description "Copies the string to a new byte array, converting it to 8-bit ASCII and adding a trailing null byte." }
+{ $errors "Throws an error if the string contains null characters, or characters beyond the 8-bit range." } ;
+
+{ string>char-alien alien>char-string malloc-char-string } related-words
+
+HELP: alien>char-string ( c-ptr -- string )
+{ $values { "c-ptr" c-ptr } { "string" string } }
+{ $description "Reads a null-terminated 8-bit C string from the specified address." } ;
+
+HELP: string>u16-alien ( string -- array )
+{ $values { "string" string } { "array" byte-array } }
+{ $description "Copies the string to a new byte array in UCS-2 format with a trailing null byte." }
+{ $errors "Throws an error if the string contains null characters." } ;
+
+{ string>u16-alien alien>u16-string malloc-u16-string } related-words
+
+HELP: alien>u16-string ( c-ptr -- string )
+{ $values { "c-ptr" c-ptr } { "string" string } }
+{ $description "Reads a null-terminated UCS-2 string from the specified address." } ;
+
+HELP: memory>string ( base len -- string )
+{ $values { "base" c-ptr } { "len" "a non-negative integer" } { "string" string } }
+{ $description "Reads " { $snippet "len" } " bytes starting from " { $snippet "base" } " and stores them in a new Factor string." } ;
+
+HELP: string>memory ( string base -- )
+{ $values { "string" string } { "base" c-ptr } }
+{ $description "Writes the string 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" } { "alien" alien } }
+{ $description "Allocates an unmanaged memory block large enough to hold " { $snippet "n" } " values of a C type." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
+{ $errors "Throws an error if the type does not exist, if the requested size is negative, or if memory allocation fails." } ;
+
+HELP: malloc-object
+{ $values { "type" "a C type" } { "alien" alien } }
+{ $description "Allocates an unmanaged memory block large enough to hold a value of a C type." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
+{ $errors "Throws an error if the type does not exist or if memory allocation fails." } ;
+
+HELP: malloc-byte-array
+{ $values { "byte-array" byte-array } { "alien" alien } }
+{ $description "Allocates an unmanaged memory block of the same size as the byte array, and copies the contents of the byte array there." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
+{ $errors "Throws an error if memory allocation fails." } ;
+
+HELP: malloc-char-string
+{ $values { "string" string } { "alien" c-ptr } }
+{ $description "Allocates an unmanaged memory block, and stores a string in 8-bit ASCII encoding with a trailing null byte to the block." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
+{ $errors "Throws an error if memory allocation fails." } ;
+
+HELP: malloc-u16-string
+{ $values { "string" string } { "alien" c-ptr } }
+{ $description "Allocates an unmanaged memory block, and stores a string in UCS2 encoding with a trailing null character to the block." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
+{ $errors "Throws an error if memory allocation fails." } ;
+
+HELP: define-nth
+{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
+{ $description "Defines a word " { $snippet { $emphasis "name" } "-nth" } " with stack effect " { $snippet "( n c-ptr -- value )" } " for reading the value with C type " { $snippet "name" } " stored at an alien pointer, displaced by a multiple of the C type's size." }
+{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
+
+HELP: define-set-nth
+{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
+{ $description "Defines a word " { $snippet "set-" { $emphasis "name" } "-nth" } " with stack effect " { $snippet "( value n c-ptr -- )" } " for writing the value with C type " { $snippet "name" } " to an alien pointer, displaced by a multiple of the C type's size." }
+{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
+
+HELP: box-parameter
+{ $values { "n" integer } { "ctype" string } }
+{ $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 { "ctype" string } }
+{ $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 { "ctype" string } }
+{ $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: define-deref
+{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
+{ $description "Defines a word " { $snippet "*name" } " with stack effect " { $snippet "( c-ptr -- value )" } " for reading a value with C type " { $snippet "name" } " stored at an alien pointer." }
+{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
+
+HELP: define-out
+{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
+{ $description "Defines a word " { $snippet "<" { $emphasis "name" } ">" } " with stack effect " { $snippet "( value -- array )" } ". This word allocates a byte array large enough to hold a value with C type " { $snippet "name" } ", and writes the value at the top of the stack to the array." }
+{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
diff --git a/core/alien/c-types/c-types-tests.factor b/core/alien/c-types/c-types-tests.factor
new file mode 100644 (file)
index 0000000..ee2d8b3
--- /dev/null
@@ -0,0 +1,70 @@
+IN: temporary
+USING: alien alien.syntax alien.c-types kernel tools.test
+sequences system libc ;
+
+[ "\u00ff" ]
+[ "\u00ff" string>char-alien alien>char-string ]
+unit-test
+
+[ "hello world" ]
+[ "hello world" string>char-alien alien>char-string ]
+unit-test
+
+[ "hello\uabcdworld" ]
+[ "hello\uabcdworld" string>u16-alien alien>u16-string ]
+unit-test
+
+[ t ] [ f expired? ] unit-test
+
+[ "hello world" ] [
+    "hello world" malloc-char-string
+    dup alien>char-string swap free
+] unit-test
+
+[ "hello world" ] [
+    "hello world" malloc-u16-string
+    dup alien>u16-string swap free
+] unit-test
+
+: foo ( -- n ) "fdafd" f dlsym [ 123 ] unless* ;
+
+[ 123 ] [ foo ] unit-test
+
+[ -1 ] [ -1 <char> *char ] unit-test
+[ -1 ] [ -1 <short> *short ] unit-test
+[ -1 ] [ -1 <int> *int ] unit-test
+
+C-UNION: foo
+    "int"
+    "int" ;
+
+[ f ] [ "char*" c-type "void*" c-type eq? ] unit-test
+[ t ] [ "char**" c-type "void*" c-type eq? ] 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*" c-type eq? ] unit-test
+
+TYPEDEF: char MyChar
+
+[ t ] [ "char" c-type "MyChar" c-type eq? ] unit-test
+[ f ] [ "void*" c-type "MyChar*" c-type eq? ] unit-test
+[ t ] [ "char*" c-type "MyChar*" c-type eq? ] unit-test
+
+[ 32 ] [ { "int" 8 } heap-size ] unit-test
+
+TYPEDEF: char* MyString
+
+[ t ] [ "char*" c-type "MyString" c-type eq? ] unit-test
+[ t ] [ "void*" c-type "MyString*" c-type eq? ] unit-test
+
+TYPEDEF: int* MyIntArray
+
+[ t ] [ "void*" c-type "MyIntArray" c-type eq? ] unit-test
+
+TYPEDEF: uchar* MyLPBYTE
+
+[ t ] [ "char*" c-type "MyLPBYTE" c-type eq? ] unit-test
diff --git a/core/alien/c-types/c-types.factor b/core/alien/c-types/c-types.factor
new file mode 100644 (file)
index 0000000..234e6ef
--- /dev/null
@@ -0,0 +1,356 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: byte-arrays arrays generator.registers assocs
+kernel kernel.private libc math namespaces parser sequences
+strings words assocs splitting math.parser cpu.architecture
+alien quotations system ;
+IN: alien.c-types
+
+TUPLE: c-type
+boxer prep unboxer
+getter setter
+reg-class size align stack-align? ;
+
+: <c-type> ( -- type )
+    T{ int-regs } { set-c-type-reg-class } \ c-type construct ;
+
+SYMBOL: c-types
+
+global [
+    c-types [ H{ } assoc-like ] change
+] bind
+
+TUPLE: no-c-type name ;
+
+: no-c-type ( type -- * ) \ no-c-type construct-boa throw ;
+
+: (c-type) ( name -- type/f )
+    c-types get-global at dup [
+        dup string? [ (c-type) ] when
+    ] when ;
+
+GENERIC: c-type ( name -- type )
+
+: resolve-pointer-type ( name -- name )
+    c-types get at dup string?
+    [ "*" append ] [ drop "void*" ] if
+    c-type ;
+
+: resolve-typedef ( name -- type )
+    dup string? [ c-type ] when ;
+
+: parse-array-type ( name -- array )
+    "[" split unclip
+    >r [ "]" ?tail drop string>number ] map r> add* ;
+
+M: string c-type ( name -- type )
+    CHAR: ] over member? [
+        parse-array-type
+    ] [
+        dup c-types get at [
+            resolve-typedef
+        ] [
+            "*" ?tail [ resolve-pointer-type ] [ no-c-type ] if
+        ] ?if
+    ] if ;
+
+: c-type-box ( n type -- )
+    dup c-type-reg-class
+    swap c-type-boxer [ "No boxer" throw ] unless*
+    %box ;
+
+: c-type-unbox ( n ctype -- )
+    dup c-type-reg-class
+    swap c-type-unboxer [ "No unboxer" throw ] unless*
+    %unbox ;
+
+M: string c-type-align c-type c-type-align ;
+
+M: string c-type-stack-align? c-type c-type-stack-align? ;
+
+GENERIC: box-parameter ( n ctype -- )
+
+M: c-type box-parameter c-type-box ;
+
+M: string box-parameter c-type box-parameter ;
+
+GENERIC: box-return ( ctype -- )
+
+M: c-type box-return f swap c-type-box ;
+
+M: string box-return c-type box-return ;
+
+GENERIC: unbox-parameter ( n ctype -- )
+
+M: c-type unbox-parameter c-type-unbox ;
+
+M: string unbox-parameter c-type unbox-parameter ;
+
+GENERIC: unbox-return ( ctype -- )
+
+M: c-type unbox-return f swap c-type-unbox ;
+
+M: string unbox-return c-type unbox-return ;
+
+! 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: heap-size ( type -- size ) foldable
+
+M: string heap-size c-type heap-size ;
+
+M: c-type heap-size c-type-size ;
+
+GENERIC: stack-size ( type -- size ) foldable
+
+M: string stack-size c-type stack-size ;
+
+M: c-type stack-size c-type-size ;
+
+: c-getter ( name -- quot )
+    c-type c-type-getter [
+        [ "Cannot read struct fields with type" throw ]
+    ] unless* ;
+
+: c-setter ( name -- quot )
+    c-type c-type-setter [
+        [ "Cannot write struct fields with type" throw ]
+    ] unless* ;
+
+: <c-array> ( n type -- array )
+    heap-size * <byte-array> ; inline
+
+: <c-object> ( type -- array )
+    1 swap <c-array> ; inline
+
+: malloc-array ( n type -- alien )
+    heap-size calloc ; inline
+
+: malloc-object ( type -- alien )
+    1 swap malloc-array ; inline
+
+: malloc-byte-array ( byte-array -- alien )
+    dup length dup malloc [ -rot memcpy ] keep ;
+
+: malloc-char-string ( string -- alien )
+    string>char-alien malloc-byte-array ;
+
+: malloc-u16-string ( string -- alien )
+    string>u16-alien malloc-byte-array ;
+
+: (define-nth) ( word type quot -- )
+    >r heap-size [ rot * ] swap add* r> append define-inline ;
+
+: nth-word ( name vocab -- word )
+    >r "-nth" append r> create ;
+
+: define-nth ( name vocab -- )
+    dupd nth-word swap dup c-getter (define-nth) ;
+
+: set-nth-word ( name vocab -- word )
+    >r "set-" swap "-nth" 3append r> create ;
+
+: define-set-nth ( name vocab -- )
+    dupd set-nth-word swap dup c-setter (define-nth) ;
+
+: typedef ( old new -- ) c-types get set-at ;
+
+: define-c-type ( type name vocab -- )
+    >r tuck typedef r> [ define-nth ] 2keep define-set-nth ;
+
+TUPLE: long-long-type ;
+
+: <long-long-type> ( type -- type )
+    long-long-type construct-delegate ;
+
+M: long-long-type unbox-parameter ( n type -- )
+    c-type-unboxer %unbox-long-long ;
+
+M: long-long-type unbox-return ( type -- )
+    f swap unbox-parameter ;
+
+M: long-long-type box-parameter ( n type -- )
+    c-type-boxer %box-long-long ;
+
+M: long-long-type box-return ( type -- )
+    f swap box-parameter ;
+
+: define-deref ( name vocab -- )
+    >r dup CHAR: * add* r> create
+    swap c-getter 0 add* define-inline ;
+
+: define-out ( name vocab -- )
+    over [ <c-object> tuck 0 ] over c-setter append swap
+    >r >r constructor-word r> r> add* define-inline ;
+
+: >c-array ( seq type word -- )
+    >r >r dup length dup r> <c-array> dup -roll r>
+    [ execute ] 2curry 2each ; inline
+
+: >c-array-quot ( type vocab -- quot )
+    dupd set-nth-word [ >c-array ] 2curry ;
+
+: to-array-word ( name vocab -- word )
+    >r ">c-" swap "-array" 3append r> create ;
+
+: define-to-array ( type vocab -- )
+    [ to-array-word ] 2keep >c-array-quot define-compound ;
+
+: c-array>quot ( type vocab -- quot )
+    [
+        \ swap ,
+        nth-word 1quotation ,
+        [ curry map ] %
+    ] [ ] make ;
+
+: from-array-word ( name vocab -- word )
+    >r "c-" swap "-array>" 3append r> create ;
+
+: define-from-array ( type vocab -- )
+    [ from-array-word ] 2keep c-array>quot define-compound ;
+
+: <primitive-type> ( getter setter width boxer unboxer -- type )
+    <c-type>
+    [ set-c-type-unboxer ] keep
+    [ set-c-type-boxer ] keep
+    [ set-c-type-size ] 2keep
+    [ set-c-type-align ] keep
+    [ set-c-type-setter ] keep
+    [ set-c-type-getter ] keep ;
+
+: define-primitive-type ( type name -- )
+    "alien.c-types"
+    [ define-c-type ] 2keep
+    [ define-deref ] 2keep
+    [ define-to-array ] 2keep
+    [ define-from-array ] 2keep
+    define-out ;
+
+: expand-constants ( c-type -- c-type' )
+    dup array? [
+        unclip >r [ dup word? [ execute ] when ] map r> add*
+    ] when ;
+
+[ alien-cell ]
+[ set-alien-cell ]
+bootstrap-cell
+"box_alien"
+"alien_offset" <primitive-type>
+"void*" define-primitive-type
+
+[ alien-signed-8 ]
+[ set-alien-signed-8 ]
+8
+"box_signed_8"
+"to_signed_8" <primitive-type> <long-long-type>
+"longlong" define-primitive-type
+
+[ alien-unsigned-8 ]
+[ set-alien-unsigned-8 ]
+8
+"box_unsigned_8"
+"to_unsigned_8" <primitive-type> <long-long-type>
+"ulonglong" define-primitive-type
+
+[ alien-signed-cell ]
+[ set-alien-signed-cell ]
+bootstrap-cell
+"box_signed_cell"
+"to_fixnum" <primitive-type>
+"long" define-primitive-type
+
+[ alien-unsigned-cell ]
+[ set-alien-unsigned-cell ]
+bootstrap-cell
+"box_unsigned_cell"
+"to_cell" <primitive-type>
+"ulong" define-primitive-type
+
+[ alien-signed-4 ]
+[ set-alien-signed-4 ]
+4
+"box_signed_4"
+"to_fixnum" <primitive-type>
+"int" define-primitive-type
+
+[ alien-unsigned-4 ]
+[ set-alien-unsigned-4 ]
+4
+"box_unsigned_4"
+"to_cell" <primitive-type>
+"uint" define-primitive-type
+
+[ alien-signed-2 ]
+[ set-alien-signed-2 ]
+2
+"box_signed_2"
+"to_fixnum" <primitive-type>
+"short" define-primitive-type
+
+[ alien-unsigned-2 ]
+[ set-alien-unsigned-2 ]
+2
+"box_unsigned_2"
+"to_cell" <primitive-type>
+"ushort" define-primitive-type
+
+[ alien-signed-1 ]
+[ set-alien-signed-1 ]
+1
+"box_signed_1"
+"to_fixnum" <primitive-type>
+"char" define-primitive-type
+
+[ alien-unsigned-1 ]
+[ set-alien-unsigned-1 ]
+1
+"box_unsigned_1"
+"to_cell" <primitive-type>
+"uchar" define-primitive-type
+
+[ alien-unsigned-4 zero? not ]
+[ 1 0 ? set-alien-unsigned-4 ]
+4
+"box_boolean"
+"to_boolean" <primitive-type>
+"bool" define-primitive-type
+
+[ alien-float ]
+[ >r >r >float r> r> set-alien-float ]
+4
+"box_float"
+"to_float" <primitive-type>
+"float" define-primitive-type
+
+T{ float-regs f 4 } "float" c-type set-c-type-reg-class
+[ >float ] "float" c-type set-c-type-prep
+
+[ alien-double ]
+[ >r >r >float r> r> set-alien-double ]
+8
+"box_double"
+"to_double" <primitive-type>
+"double" define-primitive-type
+
+T{ float-regs f 8 } "double" c-type set-c-type-reg-class
+[ >float ] "double" c-type set-c-type-prep
+
+[ alien-cell alien>char-string ]
+[ set-alien-cell ]
+bootstrap-cell
+"box_char_string"
+"alien_offset" <primitive-type>
+"char*" define-primitive-type
+
+"char*" "uchar*" typedef
+
+[ string>char-alien ] "char*" c-type set-c-type-prep
+
+[ alien-cell alien>u16-string ]
+[ set-alien-cell ]
+4
+"box_u16_string"
+"alien_offset" <primitive-type>
+"ushort*" define-primitive-type
+
+[ string>u16-alien ] "ushort*" c-type set-c-type-prep
diff --git a/core/alien/c-types/summary.txt b/core/alien/c-types/summary.txt
new file mode 100644 (file)
index 0000000..da909c7
--- /dev/null
@@ -0,0 +1 @@
+C data type support
diff --git a/core/alien/compiler/authors.txt b/core/alien/compiler/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/alien/compiler/compiler.factor b/core/alien/compiler/compiler.factor
new file mode 100644 (file)
index 0000000..b63a110
--- /dev/null
@@ -0,0 +1,366 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generator generator.registers generator.fixup
+hashtables kernel math namespaces sequences words
+inference.backend inference.dataflow system math.functions
+math.parser classes alien.arrays alien.c-types alien.structs
+alien.syntax cpu.architecture alien inspector quotations assocs
+kernel.private threads continuations.private libc combinators ;
+IN: alien.compiler
+
+! Common protocol for alien-invoke/alien-callback/alien-indirect
+GENERIC: alien-node-parameters ( node -- seq )
+GENERIC: alien-node-return ( node -- ctype )
+GENERIC: alien-node-abi ( node -- str )
+
+: large-struct? ( ctype -- ? )
+    dup c-struct? [
+        heap-size struct-small-enough? not
+    ] [
+        drop f
+    ] if ;
+
+: alien-node-parameters* ( node -- seq )
+    dup alien-node-parameters
+    swap alien-node-return large-struct? [ "void*" add* ] when ;
+
+: alien-node-return* ( node -- ctype )
+    alien-node-return dup large-struct? [ drop "void" ] when ;
+
+: parameter-align ( n type -- n delta )
+    over >r
+    dup c-type-stack-align? [ c-type-align ] [ drop cell ] if
+    align
+    dup r> - ;
+
+: parameter-sizes ( types -- total offsets )
+    #! Compute stack frame locations.
+    [
+        0 [
+            [ parameter-align drop dup , ] keep stack-size +
+        ] reduce cell align
+    ] { } make ;
+
+: return-size ( ctype -- n )
+    #! Amount of space we reserve for a return value.
+    dup large-struct? [ heap-size ] [ drop 0 ] if ;
+
+: alien-stack-frame ( node -- n )
+    alien-node-parameters* parameter-sizes drop ;
+
+: alien-invoke-frame ( node -- n )
+    #! One cell is temporary storage, temp@
+    dup alien-node-return return-size
+    swap alien-stack-frame +
+    cell + ;
+
+: set-stack-frame ( n -- )
+    dup [ frame-required ] when* \ stack-frame set ;
+
+: with-stack-frame ( n quot -- )
+    swap set-stack-frame
+    call
+    f set-stack-frame ; inline
+
+: reg-class-full? ( class -- ? )
+    dup class get swap param-regs length >= ;
+
+: spill-param ( reg-class -- n reg-class )
+    reg-size stack-params dup get -rot +@ T{ stack-params } ;
+
+: fastcall-param ( reg-class -- n reg-class )
+    [ dup class get swap inc-reg-class ] keep ;
+
+: alloc-parameter ( parameter -- reg reg-class )
+    c-type c-type-reg-class dup reg-class-full?
+    [ spill-param ] [ fastcall-param ] if
+    [ param-reg ] keep ;
+
+: (flatten-int-type) ( size -- )
+    cell /i "void*" <repetition> % ;
+
+: flatten-int-type ( n type -- n )
+    [ parameter-align (flatten-int-type) ] keep
+    stack-size cell align dup (flatten-int-type) + ;
+
+: flatten-value-type ( n type -- n )
+    dup c-type c-type-reg-class T{ int-regs } =
+    [ flatten-int-type ] [ , ] if ;
+
+: flatten-value-types ( params -- params )
+    #! Convert value type structs to consecutive void*s.
+    [ 0 [ flatten-value-type ] reduce drop ] { } make ;
+
+: each-parameter ( parameters quot -- )
+    >r [ parameter-sizes nip ] keep r> 2each ; inline
+
+: reverse-each-parameter ( parameters quot -- )
+    >r [ parameter-sizes nip ] keep r> 2reverse-each ; inline
+
+: reset-freg-counts ( -- )
+    { int-regs float-regs stack-params } [ 0 swap set ] each ;
+
+: with-param-regs ( quot -- )
+    #! In quot you can call alloc-parameter
+    [ reset-freg-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).
+    swap
+    alien-node-parameters*
+    flatten-value-types
+    [ pick >r alloc-parameter r> execute ] each-parameter
+    drop ; inline
+
+: if-void ( type true false -- )
+    pick "void" = [ drop nip call ] [ nip call ] if ; inline
+
+: alien-invoke-stack ( node extra -- )
+    over alien-node-parameters length + dup reify-curries
+    over consume-values
+    dup alien-node-return "void" = 0 1 ?
+    swap produce-values ;
+
+: (make-prep-quot) ( parameters -- )
+    dup empty? [
+        drop
+    ] [
+        unclip c-type c-type-prep %
+        \ >r , (make-prep-quot) \ r> ,
+    ] if ;
+
+: make-prep-quot ( node -- quot )
+    alien-node-parameters
+    [ <reversed> (make-prep-quot) ] [ ] make ;
+
+: unbox-parameters ( offset node -- )
+    alien-node-parameters [
+        %prepare-unbox >r over + r> unbox-parameter
+    ] reverse-each-parameter drop ;
+
+: 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.
+    alien-node-return dup large-struct?
+    [ heap-size %prepare-box-struct cell ] [ drop 0 ] if ;
+
+: objects>registers ( node -- )
+    #! Generate code for unboxing a list of C types, then
+    #! generate code for moving these parameters to register 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 -- )
+    alien-node-return [ ] [ box-return ] if-void ;
+
+M: alien-invoke alien-node-parameters alien-invoke-parameters ;
+M: alien-invoke alien-node-return alien-invoke-return ;
+
+M: alien-invoke alien-node-abi
+    alien-invoke-library library
+    [ library-abi ] [ "cdecl" ] if* ;
+
+: stdcall-mangle ( symbol node -- symbol )
+    "@"
+    swap alien-node-parameters parameter-sizes drop
+    number>string 3append ;
+
+: (alien-invoke-dlsym) ( node -- symbol dll )
+    dup alien-invoke-function
+    swap alien-invoke-library load-library ;
+
+TUPLE: no-such-symbol ;
+
+M: no-such-symbol summary
+    drop "Symbol not found" ;
+
+: no-such-symbol ( -- )
+    \ no-such-symbol inference-error ;
+
+: alien-invoke-dlsym ( node -- symbol dll )
+    dup (alien-invoke-dlsym) 2dup dlsym [
+        >r over stdcall-mangle r> 2dup dlsym
+        [ no-such-symbol ] unless
+    ] unless rot drop ;
+
+M: alien-invoke-error summary
+    drop "Words calling ``alien-invoke'' cannot run in the interpreter. Compile the caller word and try again." ;
+
+: pop-parameters pop-literal nip [ expand-constants ] map ;
+
+\ alien-invoke [
+    ! Four literals
+    4 ensure-values
+    \ alien-invoke empty-node
+    ! Compile-time parameters
+    pop-parameters over set-alien-invoke-parameters
+    pop-literal nip over set-alien-invoke-function
+    pop-literal nip over set-alien-invoke-library
+    pop-literal nip over set-alien-invoke-return
+    ! Quotation which coerces parameters to required types
+    dup make-prep-quot infer-quot
+    ! If symbol doesn't resolve, no stack effect, no compile
+    dup alien-invoke-dlsym 2drop
+    ! Add node to IR
+    dup node,
+    ! Magic #: consume exactly the number of inputs
+    0 alien-invoke-stack
+] "infer" set-word-prop
+
+M: alien-invoke generate-node
+    dup alien-invoke-frame [
+        end-basic-block
+        %prepare-alien-invoke
+        dup objects>registers
+        dup alien-invoke-dlsym %alien-invoke
+        dup %cleanup
+        box-return*
+        iterate-next
+    ] with-stack-frame ;
+
+M: alien-indirect alien-node-parameters alien-indirect-parameters ;
+M: alien-indirect alien-node-return alien-indirect-return ;
+M: alien-indirect alien-node-abi alien-indirect-abi ;
+
+M: alien-indirect-error summary
+    drop "Words calling ``alien-indirect'' cannot run in the interpreter. Compile the caller word and try again." ;
+
+\ alien-indirect [
+    ! Three literals and function pointer
+    4 ensure-values
+    4 reify-curries
+    \ alien-indirect empty-node
+    ! Compile-time parameters
+    pop-literal nip over set-alien-indirect-abi
+    pop-parameters over set-alien-indirect-parameters
+    pop-literal nip over set-alien-indirect-return
+    ! Quotation which coerces parameters to required types
+    dup make-prep-quot 1 make-dip infer-quot
+    ! Add node to IR
+    dup node,
+    ! Magic #: consume the function pointer, too
+    1 alien-invoke-stack
+] "infer" set-word-prop
+
+M: alien-indirect generate-node
+    dup alien-invoke-frame [
+        ! Flush registers
+        end-basic-block
+        ! Save registers for GC
+        %prepare-alien-invoke
+        ! Save alien at top of stack to temporary storage
+        %prepare-alien-indirect
+        dup objects>registers
+        ! Call alien in temporary storage
+        %alien-indirect
+        dup %cleanup
+        box-return*
+        iterate-next
+    ] with-stack-frame ;
+
+! Callbacks are registered in a global hashtable. If you clear
+! this hashtable, they will all be blown away by code GC, beware
+SYMBOL: callbacks
+
+H{ } clone callbacks set-global
+
+: register-callback ( word -- ) dup callbacks get set-at ;
+
+M: alien-callback alien-node-parameters alien-callback-parameters ;
+M: alien-callback alien-node-return alien-callback-return ;
+M: alien-callback alien-node-abi alien-callback-abi ;
+
+M: alien-callback-error summary
+    drop "Words calling ``alien-callback'' cannot run in the interpreter. Compile the caller word and try again." ;
+
+: callback-bottom ( node -- )
+    alien-callback-xt [ word-xt <alien> ] curry infer-quot ;
+
+\ alien-callback [
+    4 ensure-values
+    \ alien-callback empty-node dup node,
+    pop-literal nip over set-alien-callback-quot
+    pop-literal nip over set-alien-callback-abi
+    pop-parameters over set-alien-callback-parameters
+    pop-literal nip over set-alien-callback-return
+    gensym dup register-callback over set-alien-callback-xt
+    callback-bottom
+] "infer" set-word-prop
+
+: box-parameters ( node -- )
+    alien-node-parameters* [ box-parameter ] each-parameter ;
+
+: registers>objects ( node -- )
+    [
+        dup \ %save-param-reg move-parameters
+        "nest_stacks" f %alien-invoke
+        box-parameters
+    ] with-param-regs ;
+
+TUPLE: callback-context ;
+
+: current-callback 2 getenv ;
+
+: wait-to-return ( token -- )
+    dup current-callback eq? [
+        drop
+    ] [
+        yield wait-to-return
+    ] if ;
+
+: do-callback ( quot token -- )
+    init-error-handler
+    dup 2 setenv
+    slip
+    wait-to-return ; inline
+
+: prepare-callback-return ( ctype -- quot )
+    alien-node-return {
+        { [ dup "void" = ] [ drop [ ] ] }
+        { [ dup large-struct? ] [ heap-size [ memcpy ] curry ] }
+        { [ t ] [ c-type c-type-prep ] }
+    } cond ;
+
+: wrap-callback-quot ( node -- quot )
+    [
+        dup alien-callback-quot
+        swap prepare-callback-return append ,
+        [ callback-context construct-empty do-callback ] %
+    ] [ ] make ;
+
+: %unnest-stacks ( -- ) "unnest_stacks" f %alien-invoke ;
+
+: callback-unwind ( node -- n )
+    {
+        { [ dup alien-node-abi "stdcall" = ] [ alien-stack-frame ] }
+        { [ dup alien-node-return large-struct? ] [ drop 4 ] }
+        { [ t ] [ drop 0 ] }
+    } cond ;
+
+: %callback-return ( node -- )
+    #! All the extra book-keeping for %unwind is only for x86.
+    #! On other platforms its an alias for %return.
+    dup alien-node-return*
+    [ %unnest-stacks ] [ %callback-value ] if-void
+    callback-unwind %unwind ;
+
+: generate-callback ( node -- )
+    dup alien-callback-xt dup rot [
+        dup alien-stack-frame [
+            init-templates
+            dup registers>objects
+            dup wrap-callback-quot %alien-callback
+            %callback-return
+        ] with-stack-frame
+    ] generate-1 ;
+
+M: alien-callback generate-node
+    end-basic-block generate-callback iterate-next ;
diff --git a/core/alien/compiler/summary.txt b/core/alien/compiler/summary.txt
new file mode 100644 (file)
index 0000000..f5a0c6d
--- /dev/null
@@ -0,0 +1 @@
+C library interface implementation
diff --git a/core/alien/remote-control/authors.txt b/core/alien/remote-control/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/alien/remote-control/remote-control.factor b/core/alien/remote-control/remote-control.factor
new file mode 100644 (file)
index 0000000..b7700c0
--- /dev/null
@@ -0,0 +1,25 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types parser threads words kernel.private
+kernel ;
+IN: alien.remote-control
+
+: eval-callback
+    "void*" { "char*" } "cdecl"
+    [ eval>string malloc-char-string ] alien-callback ;
+
+: yield-callback
+    "void" { } "cdecl" [ yield ] alien-callback ;
+
+: sleep-callback
+    "void" { "long" } "cdecl" [ sleep ] alien-callback ;
+
+: ?callback ( word -- alien )
+    dup compiled? [ execute ] [ drop f ] if ; inline
+
+: init-remote-control ( -- )
+    \ eval-callback ?callback 16 setenv
+    \ yield-callback ?callback 17 setenv
+    \ sleep-callback ?callback 18 setenv ;
+
+MAIN: init-remote-control
diff --git a/core/alien/remote-control/summary.txt b/core/alien/remote-control/summary.txt
new file mode 100644 (file)
index 0000000..a65a66b
--- /dev/null
@@ -0,0 +1 @@
+Support for embedding Factor in other applications
diff --git a/core/alien/structs/authors.txt b/core/alien/structs/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/alien/structs/structs-docs.factor b/core/alien/structs/structs-docs.factor
new file mode 100644 (file)
index 0000000..704a260
--- /dev/null
@@ -0,0 +1,6 @@
+USING: alien.structs alien.c-types strings help.markup
+sequences io arrays ;
+
+M: string slot-specs c-type struct-type-fields ;
+
+M: array ($instance) first ($instance) " array" write ;
diff --git a/core/alien/structs/structs-tests.factor b/core/alien/structs/structs-tests.factor
new file mode 100644 (file)
index 0000000..b2da0e8
--- /dev/null
@@ -0,0 +1,42 @@
+IN: temporary
+USING: alien alien.syntax alien.c-types kernel tools.test
+sequences system libc words vocabs namespaces ;
+
+C-STRUCT: bar
+    { "int" "x" }
+    { { "int" 8 } "y" } ;
+
+[ 36 ] [ "bar" heap-size ] unit-test
+[ t ] [ \ <displaced-alien> "bar" c-type c-type-getter memq? ] unit-test
+
+C-STRUCT: align-test
+    { "int" "x" }
+    { "double" "y" } ;
+
+[ 16 ] [ "align-test" heap-size ] unit-test
+
+cell 4 = [
+    C-STRUCT: one
+    { "long" "a" } { "double" "b" } { "int" "c" } ;
+
+    [ 24 ] [ "one" heap-size ] unit-test
+] when
+
+: MAX_FOOS 30 ;
+
+C-STRUCT: foox
+    { { "int" MAX_FOOS } "x" } ;
+
+[ 120 ] [ "foox" heap-size ] unit-test
+
+C-UNION: barx
+    { "int" MAX_FOOS }
+    "float" ;
+
+[ 120 ] [ "barx" heap-size ] unit-test
+
+"help" vocab [
+    "help" "help" lookup "help" set
+    [ ] [ \ foox-x "help" get execute ] unit-test
+    [ ] [ \ set-foox-x "help" get execute ] unit-test
+] when
diff --git a/core/alien/structs/structs.factor b/core/alien/structs/structs.factor
new file mode 100644 (file)
index 0000000..0afa9ea
--- /dev/null
@@ -0,0 +1,99 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic hashtables kernel kernel.private math
+namespaces parser sequences strings words libc slots
+alien.c-types math.functions math.vectors cpu.architecture ;
+IN: alien.structs
+
+: align-offset ( offset type -- offset )
+    c-type c-type-align align ;
+
+: struct-offsets ( specs -- size )
+    0 [
+        [ slot-spec-type align-offset ] keep
+        [ set-slot-spec-offset ] 2keep
+        slot-spec-type heap-size +
+    ] reduce ;
+
+: define-struct-slot-word ( spec word quot -- )
+    rot slot-spec-offset add* define-inline ;
+
+: define-getter ( type spec -- )
+    [ set-reader-props ] keep
+    dup slot-spec-reader
+    over slot-spec-type c-getter
+    define-struct-slot-word ;
+
+: define-setter ( type spec -- )
+    [ set-writer-props ] keep
+    dup slot-spec-writer
+    over slot-spec-type c-setter
+    define-struct-slot-word ;
+
+: define-field ( type spec -- )
+    2dup define-getter define-setter ;
+
+: if-value-structs? ( ctype true false -- )
+    value-structs?
+    [ drop call ] [ >r 2drop "void*" r> call ] if ; inline
+
+TUPLE: struct-type size align fields ;
+
+M: struct-type heap-size struct-type-size ;
+
+M: struct-type c-type-align struct-type-align ;
+
+M: struct-type c-type-stack-align? drop f ;
+
+M: struct-type unbox-parameter
+    [ heap-size %unbox-struct ]
+    [ unbox-parameter ]
+    if-value-structs? ;
+
+M: struct-type unbox-return
+    f swap heap-size %unbox-struct ;
+
+M: struct-type box-parameter
+    [ heap-size %box-struct ]
+    [ box-parameter ]
+    if-value-structs? ;
+
+M: struct-type box-return
+    f swap heap-size %box-struct ;
+
+M: struct-type stack-size
+    [ heap-size ] [ stack-size ] if-value-structs? ;
+
+: c-struct? ( type -- ? ) (c-type) struct-type? ;
+
+: (define-struct) ( name vocab size align fields -- )
+    >r [ align ] keep r>
+    struct-type construct-boa
+    -rot define-c-type ;
+
+: make-field ( struct-name vocab type field-name -- spec )
+    [
+        -rot expand-constants ,
+        over ,
+        3dup reader-word ,
+        writer-word ,
+    ] { } make
+    first4 0 -rot <slot-spec> ;
+
+: define-struct-early ( name vocab fields -- fields )
+    -rot [ rot first2 make-field ] 2curry map ;
+
+: compute-struct-align ( types -- n )
+    [ c-type-align ] map supremum ;
+
+: define-struct ( name vocab fields -- )
+    pick >r
+    [ struct-offsets ] keep
+    [ [ slot-spec-type ] map compute-struct-align ] keep
+    [ (define-struct) ] keep
+    r> [ swap define-field ] curry each ;
+
+: define-union ( name vocab members -- )
+    [ expand-constants ] map
+    [ [ heap-size ] map supremum ] keep
+    compute-struct-align f (define-struct) ;
diff --git a/core/alien/structs/summary.txt b/core/alien/structs/summary.txt
new file mode 100644 (file)
index 0000000..4825c5b
--- /dev/null
@@ -0,0 +1 @@
+C structure support
diff --git a/core/alien/summary.txt b/core/alien/summary.txt
new file mode 100644 (file)
index 0000000..5ad1a8e
--- /dev/null
@@ -0,0 +1 @@
+C library interface
diff --git a/core/alien/syntax/authors.txt b/core/alien/syntax/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/alien/syntax/summary.txt b/core/alien/syntax/summary.txt
new file mode 100644 (file)
index 0000000..3586844
--- /dev/null
@@ -0,0 +1 @@
+C library interface parsing words
diff --git a/core/alien/syntax/syntax-docs.factor b/core/alien/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..eda7cc6
--- /dev/null
@@ -0,0 +1,94 @@
+USING: alien alien.c-types alien.structs alien.syntax
+alien.syntax.private help.markup help.syntax ;
+
+HELP: DLL"
+{ $syntax "DLL\" path\"" }
+{ $values { "path" "a pathname string" } }
+{ $description "Constructs a DLL handle at parse time." } ;
+
+HELP: ALIEN:
+{ $syntax "ALIEN: address" }
+{ $values { "address" "a non-negative integer" } }
+{ $description "Creates an alien object at parse time." }
+{ $notes "Alien objects are invalidated between image saves and loads." } ;
+
+ARTICLE: "syntax-aliens" "Alien object literal syntax"
+{ $subsection POSTPONE: ALIEN: }
+{ $subsection POSTPONE: DLL" } ;
+
+HELP: LIBRARY:
+{ $syntax "LIBRARY: name" }
+{ $values { "name" "a logical library name" } }
+{ $description "Sets the logical library for consequent " { $link POSTPONE: FUNCTION: } " definitions that follow." } ;
+
+HELP: FUNCTION:
+{ $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."
+$nl
+"The new word must be compiled before being executed." }
+{ $examples
+"For example, suppose the " { $snippet "foo" } " library exports the following function:"
+{ $code
+    "void the_answer(char* question, int value) {"
+    "    printf(\"The answer to %s is %d.\n\",question,value);"
+    "}"
+}
+"You can define a word for invoking it:"
+{ $unchecked-example
+    "LIBRARY: foo\nFUNCTION: void the_answer ( char* question, int value ) ;"
+    "USE: compiler"
+    "\\ the_answer compile"
+    "\"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:"
+{ $code
+    "FUNCTION: void glHint ( GLenum target, GLenum mode ) ;"
+    "FUNCTION: void glHint GLenum target GLenum mode ;"
+} } ;
+
+HELP: TYPEDEF:
+{ $syntax "TYPEDEF: old new" }
+{ $values { "old" "a C type" } { "new" "a C type" } }
+{ $description "Alises 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-STRUCT:
+{ $syntax "C-STRUCT: name pairs... ;" }
+{ $values { "name" "a new C type name" } { "pairs" "C type / field name string pairs" } }
+{ $description "Defines a C struct layout and accessor words." }
+{ $notes "C type names are documented in " { $link "c-types-specs" } "." } ;
+
+HELP: C-UNION:
+{ $syntax "C-UNION: name members... ;" }
+{ $values { "name" "a new C type name" } { "members" "a sequence of C types" } }
+{ $description "Defines a new C type sized to fit its largest member." }
+{ $notes "C type names are documented in " { $link "c-types-specs" } "." }
+{ $examples { $code "C-UNION: event \"active-event\" \"keyboard-event\" \"mouse-event\" ;" } } ;
+
+HELP: C-ENUM:
+{ $syntax "C-ENUM: words... ;" }
+{ $values { "words" "a sequence of word names" } }
+{ $description "Creates a sequence of compound 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 symbolic constants instead." }
+{ $examples
+    "The following two lines are equivalent:"
+    { $code "C-ENUM: red green blue ;" ": red 0 ;  : green 1 ;  : blue 2 ;" }
+} ;
+
+HELP: typedef
+{ $values { "old" "a string" } { "new" "a string" } }
+{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
+{ $notes "Using this word in the same source file which defines C bindings can cause problems, because words are compiled before top-level forms are run. Use the " { $link POSTPONE: TYPEDEF: } " word instead." } ;
+
+{ typedef POSTPONE: TYPEDEF: } related-words
+
+HELP: c-struct?
+{ $values { "type" "a string" } { "?" "a boolean" } }
+{ $description "Tests if a C type is a structure defined by " { $link POSTPONE: C-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." } ;
diff --git a/core/alien/syntax/syntax.factor b/core/alien/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..d204390
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2005, 2007 Slava Pestov, Alex Chapman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays alien alien.c-types alien.structs kernel math
+namespaces parser sequences words quotations math.parser
+splitting effects prettyprint prettyprint.sections
+prettyprint.backend assocs ;
+IN: alien.syntax
+
+<PRIVATE
+
+: parse-arglist ( return seq -- types effect )
+    2 group dup keys swap values
+    rot dup "void" = [ drop { } ] [ 1array ] if <effect> ;
+
+: function-quot ( type lib func types -- quot )
+    [ alien-invoke ] 2curry 2curry ;
+
+: define-function ( return library function parameters -- )
+    >r pick r> parse-arglist
+    pick create-in dup reset-generic
+    >r >r function-quot r> r> 
+    -rot define-declared ;
+
+PRIVATE>
+
+: DLL" skip-blank parse-string dlopen parsed ; parsing
+
+: ALIEN: scan string>number <alien> parsed ; parsing
+
+: LIBRARY: scan "c-library" set ; parsing
+
+: FUNCTION:
+    scan "c-library" get scan ";" parse-tokens
+    [ "()" subseq? not ] subset
+    define-function ; parsing
+
+: TYPEDEF:
+    scan scan typedef ; parsing
+
+: C-STRUCT:
+    scan in get
+    parse-definition
+    >r 2dup r> define-struct-early
+    define-struct ; parsing
+
+: C-UNION:
+    scan in get parse-definition define-union ; parsing
+
+: C-ENUM:
+    ";" parse-tokens
+    dup length
+    [ >r create-in r> 1quotation define-compound ] 2each ;
+    parsing
+
+M: alien pprint*
+    dup expired? [
+        drop "( alien expired )" text
+    ] [
+        \ ALIEN: [ alien-address pprint* ] pprint-prefix
+    ] if ;
+
+M: dll pprint* dll-path dup "DLL\" " pprint-string ;
diff --git a/core/alien/tags.txt b/core/alien/tags.txt
new file mode 100644 (file)
index 0000000..86a7c8e
--- /dev/null
@@ -0,0 +1 @@
+compiler
diff --git a/core/arrays/arrays-docs.factor b/core/arrays/arrays-docs.factor
new file mode 100644 (file)
index 0000000..83a948a
--- /dev/null
@@ -0,0 +1,70 @@
+USING: byte-arrays bit-arrays help.markup help.syntax
+kernel kernel.private prettyprint strings sbufs vectors
+quotations sequences.private ;
+IN: arrays
+
+ARTICLE: "arrays" "Arrays"
+"Arrays are fixed-size mutable sequences (" { $link "sequence-protocol" } "). The literal syntax is covered in " { $link "syntax-arrays" } ". Resizable arrays also exist and are called vectors; see " { $link "vectors" } "."
+$nl
+"Array words are in the " { $vocab-link "arrays" } " vocabulary. Unsafe implementation words are in the " { $vocab-link "sequences.private" } " vocabulary."
+$nl
+"Arrays form a class of objects:"
+{ $subsection array }
+{ $subsection array? }
+"Creating new arrays:"
+{ $subsection >array }
+{ $subsection <array> }
+"Creating an array from several elements on the stack:"
+{ $subsection 1array }
+{ $subsection 2array }
+{ $subsection 3array }
+{ $subsection 4array }
+"Arrays can be accessed without bounds checks in a pointer unsafe way."
+{ $subsection array-nth }
+{ $subsection set-array-nth }
+"The class of two-element arrays:"
+{ $subsection pair } ;
+
+ABOUT: "arrays"
+
+HELP: array
+{ $description "The class of fixed-length arrays. See " { $link "syntax-arrays" } " for syntax and " { $link "arrays" } " for general information." } ;
+
+HELP: <array> ( n elt -- array )
+{ $values { "n" "a non-negative integer" } { "elt" "an initial element" } { "array" "a new array" } }
+{ $description "Creates a new array with the given length and all elements initially set to " { $snippet "elt" } "." } ;
+
+{ <array> <quotation> <string> <sbuf> <vector> <byte-array> <bit-array> }
+related-words
+
+HELP: >array
+{ $values { "seq" "a sequence" } { "array" array } }
+{ $description "Outputs a freshly-allocated array with the same elements as a given sequence." } ;
+
+{ >array >quotation >string >sbuf >vector >byte-array >bit-array }
+related-words
+
+HELP: 1array
+{ $values { "x" object } { "array" array } }
+{ $description "Create a new array with one element." } ;
+
+{ 1array 2array 3array 4array } related-words
+
+HELP: 2array
+{ $values { "x" object } { "y" object } { "array" array } }
+{ $description "Create a new array with two elements, with " { $snippet "x" } " appearing first." } ;
+
+HELP: 3array
+{ $values { "x" object } { "y" object } { "z" object } { "array" array } }
+{ $description "Create a new array with three elements, with " { $snippet "x" } " appearing first." } ;
+
+HELP: 4array
+{ $values { "w" object } { "x" object } { "y" object } { "z" object } { "array" array } }
+{ $description "Create a new array with four elements, with " { $snippet "w" } " appearing first." } ;
+
+HELP: resize-array ( n array -- newarray )
+{ $values { "n" "a non-negative integer" } { "array" array } { "newarray" "a new array" } }
+{ $description "Creates a new array of " { $snippet "n" } " elements. The contents of the existing array are copied into the new array; if the new array is shorter, only an initial segment is copied, and if the new array is longer the remaining space is filled in with "{ $link f } "." } ;
+
+HELP: pair
+{ $class-description "The class of two-element arrays, known as pairs." } ;
diff --git a/core/arrays/arrays-tests.factor b/core/arrays/arrays-tests.factor
new file mode 100644 (file)
index 0000000..2c550fe
--- /dev/null
@@ -0,0 +1,22 @@
+USING: arrays kernel sequences sequences.private growable
+tools.test vectors layouts system math math.functions
+vectors.private ;
+IN: temporary
+
+[ -2 { "a" "b" "c" } nth ] unit-test-fails
+[ 10 { "a" "b" "c" } nth ] unit-test-fails
+[ "hi" -2 { "a" "b" "c" } set-nth ] unit-test-fails
+[ "hi" 10 { "a" "b" "c" } set-nth ] unit-test-fails
+[ f ] [ { "a" "b" "c" } dup clone eq? ] unit-test
+[ "hi" ] [ "hi" 1 { "a" "b" "c" } clone [ set-nth ] keep second ] unit-test
+[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } >vector ] unit-test
+[ f ] [ { "a" "b" "c" } dup >array eq? ] unit-test
+[ t ] [ { "a" "b" "c" } dup { } like eq? ] unit-test
+[ t ] [ { "a" "b" "c" } dup dup length array>vector underlying eq? ] unit-test
+[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } V{ } like ] unit-test
+[ { "a" "b" "c" } ] [ { "a" } { "b" "c" } append ] unit-test
+[ { "a" "b" "c" "d" "e" } ]
+[ { "a" } { "b" "c" } { "d" "e" } 3append ] unit-test
+
+[ -1 f <array> ] unit-test-fails
+[ cell-bits cell log2 - 2^ f <array> ] unit-test-fails
diff --git a/core/arrays/arrays.factor b/core/arrays/arrays.factor
new file mode 100644 (file)
index 0000000..714973e
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel kernel.private math math.private sequences
+sequences.private ;
+IN: arrays
+
+M: array clone (clone) ;
+M: array length array-capacity ;
+M: array nth-unsafe >r >fixnum r> array-nth ;
+M: array set-nth-unsafe >r >fixnum r> set-array-nth ;
+M: array resize resize-array ;
+
+: >array ( seq -- array ) { } clone-like ;
+
+M: object new drop f <array> ;
+
+M: f new drop dup zero? [ drop f ] [ f <array> ] if ;
+
+M: array like drop dup array? [ >array ] unless ;
+
+M: array equal?
+    over array? [ sequence= ] [ 2drop f ] if ;
+
+INSTANCE: array sequence
+
+: 1array ( x -- array ) 1 swap <array> ; flushable
+
+: 2array ( x y -- array ) { } 2sequence ; flushable
+
+: 3array ( x y z -- array ) { } 3sequence ; flushable
+
+: 4array ( w x y z -- array ) { } 4sequence ; flushable
+
+PREDICATE: array pair length 2 number= ;
diff --git a/core/arrays/authors.txt b/core/arrays/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/arrays/summary.txt b/core/arrays/summary.txt
new file mode 100644 (file)
index 0000000..82a1e04
--- /dev/null
@@ -0,0 +1 @@
+Fixed-size arrays
diff --git a/core/arrays/tags.txt b/core/arrays/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor
new file mode 100644 (file)
index 0000000..1805ee0
--- /dev/null
@@ -0,0 +1,296 @@
+! Copyright (C) 2007 Daniel Ehrenberg and Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel sequences
+sequences.private namespaces classes math ;
+IN: assocs
+
+ARTICLE: "alists" "Association lists"
+"An " { $emphasis "association list" } ", abbreviated " { $emphasis "alist" } ", is an association represented as a sequence where all elements are key/value pairs. The " { $link sequence } " mixin is an instance of the " { $link assoc } " mixin, hence all sequences support the " { $link "assocs-protocol" } " in this way."
+$nl
+"While not an association list, note that " { $link f } " also implements the associative mapping protocol in a trivial way; it is an immutable assoc with no entries."
+$nl
+"An alist is slower to search than a hashtable for a large set of associations. The main advantage of an association list is that the elements are ordered; also sometimes it is more convenient to construct an association list with sequence words than to construct a hashtable with association words. Much of the time, hashtables are more appropriate. See " { $link "hashtables" } "."
+$nl
+"There is no special syntax for literal alists since they are just sequences; in practice, literals look like so:"
+{ $code "{" "    { key1 value1 }" "    { key2 value2 }" "}" }
+"To make an assoc into an alist:"
+{ $subsection >alist } ;
+
+ARTICLE: "assocs-protocol" "Associative mapping protocol"
+"All associative mappings must be instances of a mixin class:"
+{ $subsection assoc }
+{ $subsection assoc? }
+"All associative mappings must implement methods on the following generic words:"
+{ $subsection at* }
+{ $subsection assoc-size }
+"At least one of the following two generic words must have a method; the " { $link assoc } " mixin has default definitions which are mutually recursive:"
+{ $subsection >alist }
+{ $subsection assoc-find }
+"Mutable assocs should implement the following additional words:"
+{ $subsection set-at }
+{ $subsection delete-at }
+{ $subsection clear-assoc }
+"The following two words are optional:"
+{ $subsection new-assoc }
+{ $subsection assoc-like }
+"Assocs should also implement methods on the " { $link clone } ", " { $link equal? } " and " { $link hashcode } " generic words. Two utility words will help with the implementation of the last two:"
+{ $subsection assoc= }
+{ $subsection assoc-hashcode }
+"Finally, assoc classes should define a word for converting other types of assocs; conventionally, such words are named " { $snippet ">" { $emphasis "class" } } " where " { $snippet { $emphasis "class" } } " is the class name. Such a word can be implemented using a utility:"
+{ $subsection assoc-clone-like } ;
+
+ARTICLE: "assocs-lookup" "Lookup and querying of assocs"
+"Utility operations built up from the " { $link "assocs-protocol" } ":"
+{ $subsection key? }
+{ $subsection at }
+{ $subsection value-at }
+{ $subsection assoc-empty? }
+{ $subsection keys }
+{ $subsection values }
+{ $subsection assoc-stack }
+{ $see-also at* assoc-size } ;
+
+ARTICLE: "assocs-sets" "Set-theoretic operations on assocs"
+"It is often useful to use the keys of an associative mapping as a set, exploiting the constant or logarithmic lookup time of most implementations (" { $link "alists" } " being a notable exception)."
+{ $subsection subassoc? }
+{ $subsection intersect }
+{ $subsection update }
+{ $subsection union }
+{ $subsection diff }
+{ $subsection remove-all }
+{ $subsection substitute }
+{ $see-also key? } ;
+
+ARTICLE: "assocs-mutation" "Storing keys and values in assocs"
+"Utility operations built up from the " { $link "assocs-protocol" } ":"
+{ $subsection delete-at* }
+{ $subsection rename-at }
+{ $subsection change-at }
+{ $subsection at+ }
+{ $see-also set-at delete-at clear-assoc } ;
+
+ARTICLE: "assocs-combinators" "Associative mapping combinators"
+"The following combinators can be used on any associative mapping."
+$nl
+"The " { $link assoc-find } " combinator is part of the " { $link "assocs-protocol" } " and must be implemented once for each class of assoc. All other combinators are implemented in terms of this combinator."
+$nl
+"The standard functional programming idioms:"
+{ $subsection assoc-each }
+{ $subsection assoc-map }
+{ $subsection assoc-push-if }
+{ $subsection assoc-subset }
+{ $subsection assoc-all? }
+"Three additional combinators:"
+{ $subsection cache }
+{ $subsection map>assoc }
+{ $subsection assoc>map } ;
+
+ARTICLE: "assocs" "Associative mapping operations"
+"An " { $emphasis "associative mapping" } ", abbreviated " { $emphasis "assoc" } ", is a collection of key/value pairs which provides efficient lookup and storage indexed by key."
+$nl
+"Words used for working with assocs are in the " { $vocab-link "assocs" } " vocabulary."
+$nl
+"Associative mappings implement a protocol:"
+{ $subsection "assocs-protocol" }
+"A large set of utility words work on any object whose class implements the associative mapping protocol."
+{ $subsection "assocs-lookup" }
+{ $subsection "assocs-mutation" }
+{ $subsection "assocs-combinators" }
+{ $subsection "assocs-sets" } ;
+
+ABOUT: "assocs"
+
+HELP: assoc
+{ $class-description "A mixin class whose instances are associative mappings. Custom implementations of the assoc protocol should be declared as instances of this mixin for all assoc functionality to work correctly:"
+    { $code "INSTANCE: avl-tree assoc" }
+} ;
+
+HELP: at*
+{ $values { "key" "an object to look up in the assoc" } { "assoc" assoc } { "value/f" "the value associated to the key, or " { $link f } " if the key is not present in the assoc" } { "?" "a boolean indicating if the key was present" } }
+{ $contract "Looks up the value associated with a key. The boolean flag can decide between the case of a missing value, and a value of " { $link f } "." } ;
+
+HELP: set-at
+{ $values { "value" "a value" } { "key" "a key to add" } { "assoc" assoc } }
+{ $contract "Stores the key/value pair into the assoc." }
+{ $side-effects "assoc" } ;
+
+HELP: new-assoc
+{ $values { "capacity" "a non-negative integer" } { "exemplar" assoc } { "newassoc" 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" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "key" "the successful key, or f" } { "value" "the successful value, or f" } { "?" "a boolean" } }
+{ $contract "Applies a predicate quotation to each entry in the assoc. Returns the key or 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." }
+{ $notes "The " { $link assoc } " mixin has a default implementation for this generic word which first converts the assoc to an association list, then iterates over that with the " { $link find } " combinator for sequences." } ;
+
+HELP: clear-assoc
+{ $values { "assoc" assoc } }
+{ $contract "Removes all entries from the assoc."  }
+{ $side-effects "assoc" } ;
+
+HELP: delete-at
+{ $values { "key" "a key" } { "assoc" assoc } }
+{ $contract "Removes an entry from the assoc." }
+{ $side-effects "assoc" } ;
+
+HELP: assoc-size
+{ $values { "assoc" assoc } { "n" "a non-negative integer" } }
+{ $contract "Outputs the number of entries stored in the assoc." } ;
+
+HELP: assoc-like
+{ $values { "assoc" assoc } { "exemplar" assoc } { "newassoc" "a new assoc" } }
+{ $contract "Creates a new assoc having the same entries as  "{ $snippet "assoc" } " and the same type as " { $snippet "exemplar" } "." } ;
+
+HELP: assoc-empty?
+{ $values { "assoc" assoc } { "?" "a boolean" } }
+{ $description "Tests if the assoc contains no entries." } ;
+
+HELP: key?
+{ $values { "key" object } { "assoc" assoc } { "?" "a boolean" } }
+{ $description "Tests if an assoc contains a key." } ;
+
+{ at at* key? } related-words
+
+HELP: at
+{ $values { "key" "an object" } { "assoc" assoc } { "value/f" "the value associated to the key, or " { $link f } " if the key is not present in the assoc" } }
+{ $description "Looks up the value associated with a key. This word makes no distinction between a missing value and a value set to " { $link f } "; if the difference is important, use " { $link at* } "." } ;
+
+HELP: assoc-each
+{ $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- )" } } }
+{ $description "Applies a quotation to each entry in the assoc." }
+{ $examples
+    { $example
+        "H{ { \"bananas\" 5 } { \"apples\" 42 } { \"pears\" 17 } }"
+        "0 swap [ nip + ] assoc-each ."
+        "64"
+    }
+} ;
+
+HELP: assoc-map
+{ $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( 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
+        ": discount ( prices n -- newprices )"
+        "    [ - ] curry assoc-each ;"
+        "H{ { \"bananas\" 5 } { \"apples\" 42 } { \"pears\" 17 } }"
+        "2 discount ."
+        "H{ { \"bananas\" 3 } { \"apples\" 39 } { \"pears\" 15 } }"
+    }
+} ;
+
+HELP: assoc-push-if
+{ $values { "accum" "a resizable mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "key" object } { "value" object } }
+{ $description "If the quotation yields true when applied to the key/value pair, adds the key/value pair at the end of " { $snippet "accum" } "." } ;
+
+HELP: assoc-subset
+{ $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( 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-all?
+{ $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "?" "a boolean" } }
+{ $description "Applies a predicate quotation to entry in the assoc. Outputs true if the assoc yields true for each entry (which includes the case where the assoc is empty)." } ;
+
+HELP: subassoc?
+{ $values { "assoc1" assoc } { "assoc2" assoc } { "?" "a new assoc" } }
+{ $description "Tests if " { $snippet "assoc2" } " contains all key/value pairs of " { $snippet "assoc1" } "." } ;
+
+HELP: assoc=
+{ $values { "assoc1" assoc } { "assoc2" assoc } { "?" "a boolean" } }
+{ $description "Tests if two assocs contain the same entries. Unlike " { $link = } ", the two assocs may be of different types." }
+{ $notes "Assoc implementations should define a method for the " { $link equal? } " generic word which calls this word after checking that both inputs have the same type." } ;
+
+HELP: assoc-hashcode
+{ $values { "n" "a non-negative integer" } { "assoc" assoc } { "code" integer } }
+{ $description "Computes a hashcode for an assoc, such that equal assocs will have the same hashcode." }
+{ $notes "Custom assoc implementations should use this word to implement a method for the " { $link hashcode* } " generic word." } ;
+
+HELP: assoc-stack
+{ $values { "key" "a key" } { "seq" "a sequence of assocs" } { "value" "a value or " { $link f } } }
+{ $description "Searches for the key in successive elements of the sequence, starting from the end. If an assoc containing the key is found, the associated value is output. If no assoc contains the key, outputs " { $link f } "." }
+{ $notes "This word is used to implement abstractions such as nested scopes; if the sequence is a stack represented by a vector, then the most recently pushed assoc -- the innermost scope -- will be searched first." } ;
+
+HELP: value-at
+{ $values { "value" "an object" } { "assoc" assoc } { "key/f" "the key associated to the value, or " { $link f } } }
+{ $description "Looks up the key associated with a value. No distinction is made between a missing key and a key set to " { $link f } "." }
+{ $notes "This word runs in linear time, proportional to the number of entries in the assoc." } ;
+
+HELP: delete-at*
+{ $values { "key" "a key" } { "assoc" assoc } { "old" "the previous value or " { $link f } } { "?" "a boolean" } }
+{ $description "Removes an entry from the assoc and outputs the previous value together with a boolean indicating whether it was present." }
+{ $side-effects "assoc" } ;
+
+HELP: rename-at
+{ $values { "newkey" object } { "key" object } { "assoc" assoc } }
+{ $description "Removes the values associated to " { $snippet "key" } " and re-adds it as " { $snippet "newkey" } ". Does nothing if the assoc does not contain " { $snippet "key" } "." }
+;
+
+HELP: keys
+{ $values { "assoc" assoc } { "keys" "an array of keys" } }
+{ $description "Outputs an array of all keys in the assoc." } ;
+
+HELP: values
+{ $values { "assoc" assoc } { "values" "an array of values" } }
+{ $description "Outputs an array of all values in the assoc." } ;
+
+{ keys values } related-words
+
+HELP: intersect
+{ $values { "assoc1" assoc } { "assoc2" assoc } { "intersection" "a new assoc" } }
+{ $description "Outputs an assoc consisting of all entries from " { $snippet "assoc2" } " such that the key is also present in " { $snippet "assoc1" } "." }
+{ $notes "The values of the keys in " { $snippet "assoc1" } " are disregarded, so this word is usually used for set-theoretic calculations where the assoc in question either has dummy sentinels as values, or the values equal the keys." } ;
+
+HELP: update
+{ $values { "assoc1" assoc } { "assoc2" assoc } }
+{ $description "Adds all entries from " { $snippet "assoc2" } " to " { $snippet "assoc1" } "." }
+{ $side-effects "assoc1" } ;
+
+HELP: union
+{ $values { "assoc1" assoc } { "assoc2" assoc } { "union" "a new assoc" } }
+{ $description "Outputs a assoc consisting of all entries from " { $snippet "assoc1" } " and " { $snippet "assoc2" } ", with entries from " { $snippet "assoc2" } " taking precedence in case the corresponding values are not equal." } ;
+
+HELP: diff
+{ $values { "assoc1" assoc } { "assoc2" assoc } { "diff" "a new assoc" } }
+{ $description "Outputs an assoc consisting of all entries from " { $snippet "assoc2" } " whose key is not contained in " { $snippet "assoc1" } "." } 
+;
+HELP: remove-all
+{ $values { "assoc" assoc } { "seq" "a sequence" } { "subseq" "a new sequence" } }
+{ $description "Constructs a sequence consisting of all elements in " { $snippet "seq" } " which do not appear as keys in " { $snippet "assoc" } "." }
+{ $notes "The values of the keys in the assoc are disregarded, so this word is usually used for set-theoretic calculations where the assoc in question either has dummy sentinels as values, or the values equal the keys." }
+{ $side-effects "assoc" } ;
+
+HELP: substitute
+{ $values { "assoc" assoc } { "seq" "a mutable sequence" } }
+{ $description "Replaces elements of " { $snippet "seq" } " which appear in as keys in " { $snippet "assoc" } " with the corresponding values, acting as the identity on all other elements." }
+{ $errors "Throws an error if " { $snippet "assoc" } " contains values whose types are not permissible in " { $snippet "seq" } "." }
+{ $side-effects "seq" } ;
+
+HELP: cache
+{ $values { "key" "a key" } { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( 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." }
+{ $side-effects "assoc" } ;
+
+HELP: map>assoc
+{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( 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" "a quotation with stack effect " { $snippet "( 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" "a quotation with stack effect " { $snippet "( value -- newvalue )" } } }
+{ $description "Applies the quotation to the value associated with " { $snippet "key" } ", storing the new value back in the assoc." }
+{ $side-effects "assoc" } ;
+
+{ change-at change-nth change } related-words
+
+HELP: at+
+{ $values { "n" number } { "key" object } { "assoc" assoc } }
+{ $description "Adds " { $snippet "n" } " to the value associated with " { $snippet "key" } "; if there is no value, stores " { $snippet "n" } ", thus behaving as if the value was 0." }
+{ $side-effects "assoc" } ;
+
+HELP: >alist
+{ $values { "assoc" assoc } { "newassoc" "an array of key/value pairs" } }
+{ $contract "Converts an associative structure into an association list." }
+{ $notes "The " { $link assoc } " mixin has a default implementation for this generic word which constructs the association list by iterating over the assoc with " { $link assoc-find } "." } ;
diff --git a/core/assocs/assocs-tests.factor b/core/assocs/assocs-tests.factor
new file mode 100644 (file)
index 0000000..b38ce82
--- /dev/null
@@ -0,0 +1,89 @@
+IN: temporary
+USING: kernel math namespaces tools.test vectors sequences
+sequences.private hashtables io prettyprint assocs
+continuations ;
+
+[ t ] [ H{ } dup subassoc? ] unit-test
+[ f ] [ H{ { 1 3 } } H{ } subassoc? ] unit-test
+[ t ] [ H{ } H{ { 1 3 } } subassoc? ] unit-test
+[ t ] [ H{ { 1 3 } } H{ { 1 3 } } subassoc? ] unit-test
+[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } subassoc? ] unit-test
+[ f ] [ H{ { 1 f } } H{ } subassoc? ] unit-test
+[ t ] [ H{ { 1 f } } H{ { 1 f } } subassoc? ] unit-test
+
+! Test some combinators
+[
+    { 4 14 32 }
+] [
+    [
+        H{
+            { 1 2 }
+            { 3 4 }
+            { 5 6 }
+        } [ * 2 + , ] assoc-each
+    ] { } make
+] unit-test
+
+[ t ] [ H{ } [ 2drop f ] assoc-all? ] unit-test
+[ t ] [ H{ { 1 1 } } [ = ] assoc-all? ] unit-test
+[ f ] [ H{ { 1 2 } } [ = ] assoc-all? ] unit-test
+[ t ] [ H{ { 1 1 } { 2 2 } } [ = ] assoc-all? ] unit-test
+[ f ] [ H{ { 1 2 } { 2 2 } } [ = ] assoc-all? ] unit-test
+
+[ H{ } ] [ H{ { t f } { f t } } [ 2drop f ] assoc-subset ] unit-test
+[ H{ { 3 4 } { 4 5 } { 6 7 } } ] [
+    H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } }
+    [ drop 3 >= ] assoc-subset
+] unit-test
+
+[ 21 ] [
+    0 H{
+        { 1 2 }
+        { 3 4 }
+        { 5 6 }
+    } [
+        + +
+    ] assoc-each
+] unit-test
+
+H{ } clone "cache-test" set
+
+[ 4 ] [ 1 "cache-test" get [ 3 + ] cache ] unit-test
+[ 5 ] [ 2 "cache-test" get [ 3 + ] cache ] unit-test
+[ 4 ] [ 1 "cache-test" get [ 3 + ] cache ] unit-test
+[ 5 ] [ 2 "cache-test" get [ 3 + ] cache ] unit-test
+
+[
+    H{ { "factor" "rocks" } { 3 4 } }
+] [
+    H{ { "factor" "rocks" } { "dup" "sq" } { 3 4 } }
+    H{ { "factor" "rocks" } { 1 2 } { 2 3 } { 3 4 } }
+    intersect
+] unit-test
+
+[
+    H{ { 1 2 } { 2 3 } { 6 5 } }
+] [
+    H{ { 2 4 } { 6 5 } } H{ { 1 2 } { 2 3 } }
+    union
+] unit-test
+
+[ H{ { 1 2 } { 2 3 } } t ] [
+    f H{ { 1 2 } { 2 3 } } [ union ] 2keep swap union dupd =
+] unit-test
+
+[
+    H{ { 1 f } }
+] [
+    H{ { 1 f } } H{ { 1 f } } intersect
+] unit-test
+
+[ { 1 3 } ] [ H{ { 2 2 } } { 1 2 3 } remove-all ] unit-test
+
+[ H{ { "hi" 2 } { 3 4 } } ]
+[ "hi" 1 H{ { 1 2 } { 3 4 } } clone [ rename-at ] keep ]
+unit-test
+
+[ H{ { 1 2 } { 3 4 } } ]
+[ "hi" 5 H{ { 1 2 } { 3 4 } } clone [ rename-at ] keep ]
+unit-test
diff --git a/core/assocs/assocs.factor b/core/assocs/assocs.factor
new file mode 100644 (file)
index 0000000..95b5dd9
--- /dev/null
@@ -0,0 +1,179 @@
+! Copyright (C) 2007 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences arrays math sequences.private vectors ;
+IN: assocs
+
+MIXIN: assoc
+
+GENERIC: at* ( key assoc -- value/f ? )
+GENERIC: set-at ( value key assoc -- )
+GENERIC: new-assoc ( capacity exemplar -- newassoc )
+GENERIC: delete-at ( key assoc -- )
+GENERIC: clear-assoc ( assoc -- )
+GENERIC: assoc-size ( assoc -- n )
+GENERIC: assoc-like ( assoc exemplar -- newassoc )
+
+M: assoc assoc-like drop ;
+
+GENERIC: assoc-clone-like ( assoc exemplar -- newassoc )
+
+GENERIC: >alist ( assoc -- newassoc )
+
+GENERIC# assoc-find 1 ( assoc quot -- key value ? ) inline
+
+M: assoc assoc-find
+    >r >alist [ first2 ] r> compose find swap
+    [ first2 t ] [ drop f f f ] if ;
+
+: key? ( key assoc -- ? ) at* nip ; inline
+
+: assoc-each ( assoc quot -- )
+    [ f ] compose assoc-find 3drop ; inline
+
+: (assoc>map) ( quot accum -- quot' )
+    [ push ] curry compose ; inline
+
+: assoc>map ( assoc quot exemplar -- seq )
+    >r over assoc-size
+    <vector> [ (assoc>map) assoc-each ] keep
+    r> like ; inline
+
+: assoc-map ( assoc quot -- newassoc )
+    over >r [ 2array ] compose V{ } assoc>map r> assoc-like ;
+    inline
+
+: assoc-push-if ( key value quot accum -- )
+    >r pick pick 2slip r> roll
+    [ >r 2array r> push ] [ 3drop ] if ; inline
+
+: assoc-pusher ( quot -- quot' accum )
+    V{ } clone [ [ assoc-push-if ] 2curry ] keep ; inline
+
+: assoc-subset ( assoc quot -- subassoc )
+    over >r assoc-pusher >r assoc-each r> r> assoc-like ; inline
+
+: assoc-all? ( assoc quot -- ? )
+    [ not ] compose assoc-find 2nip not ; inline
+
+: assoc-contains? ( assoc quot -- ? )
+    assoc-find 2nip ; inline
+
+: at ( key assoc -- value/f )
+    at* drop ; inline
+
+M: assoc assoc-clone-like ( assoc exemplar -- newassoc )
+    over assoc-size swap new-assoc
+    swap [ swap pick set-at ] assoc-each ;
+
+: keys ( assoc -- keys )
+    [ drop ] { } assoc>map ;
+
+: values ( assoc -- values )
+    [ nip ] { } assoc>map ;
+
+: delete-at* ( key assoc -- old ? )
+    [ at* ] 2keep delete-at ;
+
+: rename-at ( newkey key assoc -- )
+    tuck delete-at* [ -rot set-at ] [ 3drop ] if ;
+
+: assoc-empty? ( assoc -- ? )
+    assoc-size zero? ;
+
+: (assoc-stack) ( key i seq -- value )
+    over 0 < [
+        3drop f
+    ] [
+        3dup nth-unsafe at*
+        [ >r 3drop r> ] [ drop >r 1- r> (assoc-stack) ] if
+    ] if ; inline
+
+: assoc-stack ( key seq -- value )
+    dup length 1- swap (assoc-stack) ;
+
+: subassoc? ( assoc1 assoc2 -- ? )
+    [ swapd at* [ = ] [ 2drop f ] if ] curry assoc-all? ;
+
+: assoc= ( assoc1 assoc2 -- ? )
+    2dup subassoc? >r swap subassoc? r> and ;
+
+: assoc-hashcode ( n assoc -- code )
+    swap [
+        tuck swap hashcode* >r swap hashcode* 2/ r> bitxor
+    ] curry { } assoc>map hashcode ;
+
+: intersect ( assoc1 assoc2 -- intersection )
+    swap [ nip key? ] curry assoc-subset ;
+
+: update ( assoc1 assoc2 -- )
+    swap [ swapd set-at ] curry assoc-each ;
+
+: union ( assoc1 assoc2 -- union )
+    2dup [ assoc-size ] 2apply + pick new-assoc
+    [ rot update ] keep [ swap update ] keep ;
+
+: diff ( assoc1 assoc2 -- diff )
+    swap [ nip key? not ] curry assoc-subset ;
+
+: remove-all ( assoc seq -- subseq )
+    swap [ key? not ] curry subset ;
+
+: substitute ( assoc seq -- )
+    swap [ dupd at* [ nip ] [ drop ] if ] curry change-each ;
+
+: cache ( key assoc quot -- value )
+    pick pick at [
+        >r 3drop r>
+    ] [
+        pick rot >r >r call dup r> r> set-at
+    ] if* ; inline
+
+: change-at ( key assoc quot -- )
+    [ >r at r> call ] 3keep drop set-at ; inline
+
+: at+ ( n key assoc -- )
+    [ 0 or + ] change-at ;
+
+: map>assoc ( seq quot exemplar -- assoc )
+    >r [ 2array ] compose map r> assoc-like ; inline
+
+M: assoc >alist [ 2array ] { } assoc>map ;
+
+: value-at ( value assoc -- key/f )
+    swap [ = nip ] curry assoc-find 2drop ;
+
+: search-alist ( key alist -- pair i )
+    [ first = ] curry* find swap ; inline
+
+M: sequence at*
+    search-alist [ second t ] [ f ] if ;
+
+M: sequence set-at
+    2dup search-alist
+    [ 2nip set-second ]
+    [ drop >r swap 2array r> push ] if ;
+
+M: sequence new-assoc drop <vector> ;
+
+M: sequence clear-assoc delete-all ;
+
+M: sequence delete-at
+    tuck search-alist nip
+    [ swap delete-nth ] [ drop ] if* ;
+
+M: sequence assoc-size length ;
+
+M: sequence assoc-clone-like
+    >r >alist r> clone-like ;
+
+M: sequence assoc-like
+    over sequence? [ like ] [ assoc-clone-like ] if ;
+
+M: sequence >alist ;
+
+! Override sequence => assoc instance for f
+M: f clear-assoc drop ;
+
+M: f assoc-like drop dup assoc-empty? [ drop f ] when ;
+
+INSTANCE: sequence assoc
diff --git a/core/assocs/authors.txt b/core/assocs/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/core/assocs/summary.txt b/core/assocs/summary.txt
new file mode 100644 (file)
index 0000000..e7b3b51
--- /dev/null
@@ -0,0 +1 @@
+Associative structure protocol
diff --git a/core/assocs/tags.txt b/core/assocs/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/bit-arrays/authors.txt b/core/bit-arrays/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bit-arrays/bit-arrays-docs.factor b/core/bit-arrays/bit-arrays-docs.factor
new file mode 100644 (file)
index 0000000..f804ed2
--- /dev/null
@@ -0,0 +1,49 @@
+USING: arrays help.markup help.syntax kernel
+kernel.private prettyprint strings vectors sbufs ;
+IN: bit-arrays
+
+ARTICLE: "bit-arrays" "Bit arrays"
+"Bit array are a fixed-size mutable sequences (" { $link "sequence-protocol" } ") whose elements are either " { $link t } " or " { $link f } ". Each element only uses one bit of storage, hence the name. The literal syntax is covered in " { $link "syntax-bit-arrays" } "."
+$nl
+"Bit array words are in the " { $vocab-link "bit-arrays" } " vocabulary."
+$nl
+"Bit arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See " { $link "c-byte-arrays" } "."
+$nl
+"Bit arrays form a class of objects:"
+{ $subsection bit-array }
+{ $subsection bit-array? }
+"Creating new bit arrays:"
+{ $subsection >bit-array }
+{ $subsection <bit-array> }
+"Efficiently setting and clearing all bits in a bit array:"
+{ $subsection set-bits }
+{ $subsection clear-bits } ;
+
+ABOUT: "bit-arrays"
+
+HELP: bit-array
+{ $description "The class of fixed-length bit arrays. See " { $link "syntax-bit-arrays" } " for syntax and " { $link "bit-arrays" } " for general information." } ;
+
+HELP: <bit-array> ( n -- bit-array )
+{ $values { "n" "a non-negative integer" } { "bit-array" "a new " { $link bit-array } } }
+{ $description "Creates a new bit array with the given length and all elements initially set to " { $link f } "." } ;
+
+HELP: >bit-array
+{ $values { "seq" "a sequence" } { "bit-array" bit-array } }
+{ $description "Outputs a freshly-allocated bit array whose elements have the same boolean values as a given sequence." } ;
+
+HELP: clear-bits
+{ $values { "bit-array" bit-array } }
+{ $description "Sets all elements of the bit array to " { $link f } "." }
+{ $notes "Calling this word is more efficient than the following:"
+    { $code "[ drop f ] change-each" }
+}
+{ $side-effects "bit-array" } ;
+
+HELP: set-bits
+{ $values { "bit-array" bit-array } }
+{ $description "Sets all elements of the bit array to " { $link t } "." }
+{ $notes "Calling this word is more efficient than the following:"
+    { $code "[ drop t ] change-each" }
+}
+{ $side-effects "bit-array" } ;
diff --git a/core/bit-arrays/bit-arrays-tests.factor b/core/bit-arrays/bit-arrays-tests.factor
new file mode 100644 (file)
index 0000000..48698ad
--- /dev/null
@@ -0,0 +1,48 @@
+USING: sequences arrays bit-arrays kernel tools.test math
+random ;
+IN: temporary
+
+[ 100 ] [ 100 <bit-array> length ] unit-test
+
+[
+    { t f t }
+] [
+    3 <bit-array> t 0 pick set-nth t 2 pick set-nth
+    >array
+] unit-test
+
+[
+    { t f t }
+] [
+    { t f t } >bit-array >array
+] unit-test
+
+[
+    { t f t } { f t f }
+] [
+    { t f t } >bit-array dup clone dup [ not ] change-each
+    [ >array ] 2apply
+] unit-test
+
+[
+    { f f f f f }
+] [
+    { t f t t f } >bit-array dup clear-bits >array
+] unit-test
+
+[
+    { t t t t t }
+] [
+    { t f t t f } >bit-array dup set-bits >array
+] unit-test
+
+[ t ] [
+    100 [
+        drop 100 [ drop 2 random zero? ] map
+        dup >bit-array >array =
+    ] all?
+] unit-test
+
+[ ?{ f } ] [
+    1 2 { t f t f } <slice> >bit-array
+] unit-test
diff --git a/core/bit-arrays/bit-arrays.factor b/core/bit-arrays/bit-arrays.factor
new file mode 100644 (file)
index 0000000..185ca0c
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: math alien kernel kernel.private sequences
+sequences.private ;
+IN: bit-arrays
+
+<PRIVATE
+
+: n>cell -5 shift 4 * ; inline
+
+: cell/bit ( n alien -- byte bit )
+    over n>cell alien-unsigned-4 swap 31 bitand ; inline
+
+: set-bit ( ? byte bit -- byte )
+    2^ rot [ bitor ] [ bitnot bitand ] if ; inline
+
+: bits>bytes 7 + -3 shift ; inline
+
+: bits>cells 31 + -5 shift ; inline
+
+: (set-bits) ( bit-array n -- )
+    over length bits>cells -rot [
+        swap rot 4 * set-alien-unsigned-4
+    ] 2curry each ; inline
+
+PRIVATE>
+
+M: bit-array length array-capacity ;
+
+M: bit-array nth-unsafe cell/bit bit? ;
+
+M: bit-array set-nth-unsafe
+    [ cell/bit set-bit ] 2keep
+    swap n>cell set-alien-unsigned-4 ;
+
+: clear-bits ( bit-array -- ) 0 (set-bits) ;
+
+: set-bits ( bit-array -- ) -1 (set-bits) ;
+
+M: bit-array clone (clone) ;
+
+: >bit-array ( seq -- bit-array ) ?{ } clone-like ; inline
+
+M: bit-array like drop dup bit-array? [ >bit-array ] unless ;
+
+M: bit-array new drop <bit-array> ;
+
+M: bit-array equal?
+    over bit-array? [ sequence= ] [ 2drop f ] if ;
+
+INSTANCE: bit-array sequence
diff --git a/core/bit-arrays/summary.txt b/core/bit-arrays/summary.txt
new file mode 100644 (file)
index 0000000..8844bfc
--- /dev/null
@@ -0,0 +1 @@
+Fixed-size bit arrays
diff --git a/core/bit-arrays/tags.txt b/core/bit-arrays/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/bootstrap/boot-stage1.factor b/core/bootstrap/boot-stage1.factor
deleted file mode 100644 (file)
index 8c645d2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: image
-USING: arrays errors generic hashtables io kernel
-kernel-internals math memory modules namespaces parser
-prettyprint sequences vectors words ;
-
-"Bootstrap stage 1..." print flush
-
-"resource:/core/bootstrap/primitives.factor" run-file
-
-! The [ ] make form creates a boot quotation
-[
-    \ boot ,
-
-    "core" require
-    "core/help" require
-    "core/tools" require
-    "core/compiler" require
-    "core/documentation" require
-    "core/io/buffer" require
-    "core/ui" require
-    "core/ui/tools" require
-    "core/ui/handbook" require
-    "core/compiler/" architecture get append require
-    "core/handbook" require
-
-    [
-        "resource:/core/bootstrap/boot-stage2.factor"
-        run-file
-    ] %
-] [ ] make
-
-vocabularies get [
-    "!syntax" get hash>alist [
-        first2
-        "syntax" over set-word-vocabulary
-        >r "!" ?head drop r> 2dup set-word-name
-        2array
-    ] map alist>hash "syntax" set
-] bind
-
-"!syntax" vocabularies get remove-hash
-
-"Building generic words..." print flush
-all-words [ generic? ] subset [ make-generic ] each
diff --git a/core/bootstrap/boot-stage2.factor b/core/bootstrap/boot-stage2.factor
deleted file mode 100644 (file)
index d4389c3..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: command-line compiler errors generic help io io-internals
-kernel kernel-internals listener math memory modules namespaces
-optimizer parser sequences sequences-internals words prettyprint 
-;
-
-! Wrap everything in a scope where we disable print-warnings,
-! so that people don't get confused thinking bootstrap failed
-! because the compiler prints stuff
-[
-    print-warnings off
-
-    ! Wrap everything in a catch which starts a listener so
-    ! you can see what went wrong, instead of dealing with a
-    ! fep
-    [
-        "Cross-referencing..." print flush
-        H{ } clone changed-words set-global
-        H{ } clone crossref set-global xref-words
-
-        cpu "x86" = [
-            macosx?
-            "resource:/core/compiler/x86/alien-macosx.factor"
-            "resource:/core/compiler/x86/alien.factor"
-            ? run-file
-        ] when
-
-        "compile" get [
-            windows? [
-                "resource:/core/windows/dlls.factor"
-                run-file
-            ] when
-
-            \ number= compile
-            \ + compile
-            \ nth compile
-            \ set-nth compile
-            \ = compile
-
-            ! Load UI backend
-            "cocoa" get [
-                "core/ui/cocoa" require
-            ] when
-
-            "x11" get [
-                "core/ui/x11" require
-            ] when
-
-            windows? [
-                "core/ui/windows" require
-            ] when
-
-            ! Load native I/O code
-            "native-io" get [
-                unix? [
-                    "core/io/unix" require
-                ] when
-                windows? [
-                    "core/io/windows" require
-                ] when
-            ] when
-
-            parse-command-line
-
-            compile-all
-
-            "Initializing native I/O..." print flush
-            "native-io" get [ init-io ] when
-
-        ] when
-
-        [
-            boot
-            [ run-user-init ] try
-            [ "shell" get "shells" lookup execute ] try
-            0 exit
-        ] set-boot
-
-        "compile" get [ 
-            [ recompile ] parse-hook set-global
-        ] when
-
-        "Building online help search index..." print
-        flush
-        H{ } clone parent-graph set-global xref-help
-
-        [ run-bootstrap-init ] try
-
-        f error set-global
-        f error-continuation set-global
-
-        : count-words all-words swap subset length pprint ;
-
-        [ compiled? ] count-words " compiled words" print
-        [ symbol? ] count-words " symbol words" print
-        [ ] count-words " words total" print
-
-        FORGET: count-words
-
-        "Total bootstrap GC time: " write gc-time
-        number>string write " ms" print
-
-        "Bootstrapping is complete." print
-        "Now, you can run ./f factor.image" print flush
-
-        "factor.image" resource-path save-image
-    ] [ print-error :c ] recover
-] with-scope
-
-0 exit
diff --git a/core/bootstrap/compiler/authors.txt b/core/bootstrap/compiler/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/compiler/compiler.factor b/core/bootstrap/compiler/compiler.factor
new file mode 100644 (file)
index 0000000..c550923
--- /dev/null
@@ -0,0 +1,50 @@
+USING: compiler vocabs.loader system sequences namespaces
+parser kernel kernel.private classes classes.private
+arrays hashtables vectors tuples sbufs inference.dataflow
+hashtables.private sequences.private math tuples.private
+growable namespaces.private alien.remote-control assocs
+words generator command-line vocabs io prettyprint ;
+
+"bootstrap.math" vocab [
+    "cpu." cpu append require
+
+    global [ { "compiler" } add-use ] bind
+
+    "-no-stack-traces" cli-args member? [
+        f compiled-stack-traces set-global
+    ] when
+
+    ! Compile a set of words ahead of our general
+    ! compile-all. This set of words was determined
+    ! semi-empirically using the profiler. It improves
+    ! bootstrap time significantly, because frequenly
+    ! called words which are also quick to compile
+    ! are replaced by compiled definitions as soon as
+    ! possible.
+    {
+        roll -roll declare not
+
+        tuple-class-eq? array? hashtable? vector?
+        tuple? sbuf? node? tombstone?
+
+        array-capacity array-nth set-array-nth
+
+        wrap probe
+
+        delegate
+
+        underlying
+
+        find-pair-next namestack*
+
+        bitand bitor bitxor bitnot
+
+        + 1+ 1- 2/ < <= > >= shift min
+
+        new nth push pop peek hashcode* = get set
+
+        . lines
+    } [ compile ] each
+
+    [ recompile ] parse-hook set-global
+] when
diff --git a/core/bootstrap/compiler/summary.txt b/core/bootstrap/compiler/summary.txt
new file mode 100644 (file)
index 0000000..2dda03e
--- /dev/null
@@ -0,0 +1 @@
+Loading the compiler in stage 2 bootstrap
diff --git a/core/bootstrap/help/authors.txt b/core/bootstrap/help/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/help/help.factor b/core/bootstrap/help/help.factor
new file mode 100644 (file)
index 0000000..003c3a9
--- /dev/null
@@ -0,0 +1,24 @@
+USING: help help.topics help.syntax help.crossref
+help.definitions io io.files kernel namespaces vocabs sequences
+parser vocabs.loader ;
+IN: bootstrap.help
+
+: load-help
+    t load-help? set-global
+
+    vocabs
+    [ vocab-root ] subset
+    [ vocab-source-loaded? ] subset
+    [
+        dup vocab-docs-loaded? [
+            drop
+        ] [
+            dup vocab-root swap load-docs
+        ] if
+    ] each
+
+    "help.handbook" require
+
+    global [ "help" use+ ] bind ;
+
+load-help
diff --git a/core/bootstrap/help/summary.txt b/core/bootstrap/help/summary.txt
new file mode 100644 (file)
index 0000000..009a02b
--- /dev/null
@@ -0,0 +1 @@
+Loading the help system in stage 2 bootstrap
diff --git a/core/bootstrap/image/authors.txt b/core/bootstrap/image/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/image/image-docs.factor b/core/bootstrap/image/image-docs.factor
new file mode 100644 (file)
index 0000000..868e49d
--- /dev/null
@@ -0,0 +1,20 @@
+USING: help.markup help.syntax io io.files ;
+IN: bootstrap.image
+
+ARTICLE: "bootstrap.image" "Bootstrapping new images"
+"A new image can be built from source; this is known as " { $emphasis "bootstrap" } ". Bootstrap is a two-step process. The first stage is the creation of a bootstrap image from a running Factor instance:"
+{ $subsection make-image }
+"The second bootstrapping stage is initiated by running the resulting bootstrap image:"
+{ $code "./factor -i=boot.x86.32.image" }
+"This stage loads additional code, compiles all words, and dumps a final " { $snippet "factor.image" } "."
+$nl
+"The bootstrap process can be customized with command-line switches."
+{ $see-also "runtime-cli-args" "bootstrap-cli-args" } ;
+
+ABOUT: "bootstrap.image"
+
+HELP: make-image
+{ $values { "architecture" "a string" } }
+{ $description "Creates a bootstrap image from sources, where " { $snippet "architecture" } " is one of the following:"
+{ $code "x86.32" "x86.64" "ppc" "arm" }
+"The new image file is written to the " { $link resource-path } " and is named " { $snippet "boot." { $emphasis "architecture" } ".image" } "." } ;
diff --git a/core/bootstrap/image/image.factor b/core/bootstrap/image/image.factor
new file mode 100644 (file)
index 0000000..36d2f7f
--- /dev/null
@@ -0,0 +1,461 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays bit-arrays byte-arrays generic assocs
+hashtables assocs hashtables.private io kernel kernel.private
+math namespaces parser prettyprint sequences sequences.private
+strings sbufs vectors words quotations assocs system layouts
+splitting growable math.functions classes tuples words.private
+io.binary io.files vocabs vocabs.loader source-files
+definitions debugger float-arrays quotations.private
+combinators.private combinators ;
+IN: bootstrap.image
+
+<PRIVATE
+
+! Constants
+
+: image-magic HEX: 0f0e0d0c ; inline
+: image-version 4 ; inline
+
+: char bootstrap-cell 2/ ; inline
+
+: data-base 1024 ; inline
+
+: userenv-size 40 ; inline
+
+: header-size 10 ; inline
+
+: data-heap-size-offset 3 ; inline
+: t-offset              6 ; inline
+: 0-offset              7 ; inline
+: 1-offset              8 ; inline
+: -1-offset             9 ; inline
+
+: array-start 2 bootstrap-cells object tag-number - ;
+: scan@ array-start 4 - ;
+: wrapper@ bootstrap-cell object tag-number - ;
+: word-xt@ 8 bootstrap-cells object tag-number - ;
+: quot-array@ bootstrap-cell object tag-number - ;
+: quot-xt@ 2 bootstrap-cells object tag-number - ;
+
+! The image being constructed; a vector of word-size integers
+SYMBOL: image
+
+! Object cache
+SYMBOL: objects
+
+! Image output format
+SYMBOL: big-endian
+
+! Bootstrap architecture name
+SYMBOL: architecture
+
+! Bootstrap global namesapce
+SYMBOL: bootstrap-global
+
+! Boot quotation, set in stage1.factor
+SYMBOL: bootstrap-boot-quot
+
+! JIT parameters
+SYMBOL: jit-code-format
+SYMBOL: jit-setup
+SYMBOL: jit-prolog
+SYMBOL: jit-word-primitive-jump
+SYMBOL: jit-word-primitive-call
+SYMBOL: jit-word-jump
+SYMBOL: jit-word-call
+SYMBOL: jit-push-wrapper
+SYMBOL: jit-push-literal
+SYMBOL: jit-if-word
+SYMBOL: jit-if-jump
+SYMBOL: jit-if-call
+SYMBOL: jit-dispatch-word
+SYMBOL: jit-dispatch
+SYMBOL: jit-epilog
+SYMBOL: jit-return
+
+: userenv-offset ( symbol -- n )
+    {
+        { bootstrap-boot-quot 20 }
+        { bootstrap-global 21 }
+        { jit-code-format 22 }
+        { jit-setup 23 }
+        { jit-prolog 24 }
+        { jit-word-primitive-jump 25 }
+        { jit-word-primitive-call 26 }
+        { jit-word-jump 27 }
+        { jit-word-call 28 }
+        { jit-push-wrapper 29 }
+        { jit-push-literal 30 }
+        { jit-if-word 31 }
+        { jit-if-jump 32 }
+        { jit-if-call 33 }
+        { jit-dispatch-word 34 }
+        { jit-dispatch 35 }
+        { jit-epilog 36 }
+        { jit-return 37 }
+    } at header-size + ;
+
+: emit ( cell -- ) image get push ;
+
+: emit-64 ( cell -- )
+    bootstrap-cell 8 = [
+        emit
+    ] [
+        d>w/w big-endian get [ swap ] unless emit emit
+    ] if ;
+
+: emit-seq ( seq -- ) image get push-all ;
+
+: fixup ( value offset -- ) image get set-nth ;
+
+: heap-size ( -- size )
+    image get length header-size - userenv-size -
+    bootstrap-cells ;
+
+: here ( -- size ) heap-size data-base + ;
+
+: here-as ( tag -- pointer ) here swap bitor ;
+
+: align-here ( -- )
+    here 8 mod 4 = [ 0 emit ] when ;
+
+: emit-fixnum ( n -- ) tag-bits get shift emit ;
+
+: emit-object ( header tag quot -- addr )
+    swap here-as >r swap tag-header emit call align-here r> ;
+    inline
+
+! Write an object to the image.
+GENERIC: ' ( obj -- ptr )
+
+! Image header
+
+: emit-header ( -- )
+    image-magic emit
+    image-version emit
+    data-base emit ! relocation base at end of header
+    0 emit ! size of data heap set later
+    0 emit ! reloc base of code heap is 0
+    0 emit ! size of code heap is 0
+    0 emit ! pointer to t object
+    0 emit ! pointer to bignum 0
+    0 emit ! pointer to bignum 1
+    0 emit ! pointer to bignum -1
+    userenv-size [ f ' emit ] times ;
+
+: emit-userenv ( symbol -- )
+    dup get ' swap userenv-offset fixup ;
+
+! Bignums
+
+: bignum-bits bootstrap-cell-bits 2 - ;
+
+: bignum-radix bignum-bits 2^ 1- ;
+
+: (bignum>seq) ( n -- )
+    dup zero? [
+        drop
+    ] [
+        dup bignum-radix bitand ,
+        bignum-bits neg shift (bignum>seq)
+    ] if ;
+
+: bignum>seq ( n -- seq )
+    #! n is positive or zero.
+    [ (bignum>seq) ] { } make ;
+
+: emit-bignum ( n -- )
+    [ 0 < 1 0 ? ] keep abs bignum>seq
+    dup length 1+ emit-fixnum
+    swap emit emit-seq ;
+
+M: bignum '
+    bignum tag-number dup [ emit-bignum ] emit-object ;
+
+! Fixnums
+
+M: fixnum '
+    #! When generating a 32-bit image on a 64-bit system,
+    #! some fixnums should be bignums.
+    dup most-negative-fixnum most-positive-fixnum between?
+    [ tag-bits get shift ] [ >bignum ' ] if ;
+
+! Floats
+
+M: float '
+    float tag-number dup [
+        align-here double>bits emit-64
+    ] emit-object ;
+
+! Special objects
+
+! Padded with fixnums for 8-byte alignment
+
+: t, t t-offset fixup ;
+
+M: f '
+    #! f is #define F RETAG(0,F_TYPE)
+    drop \ f tag-number ;
+
+:  0,  0 >bignum '  0-offset fixup ;
+:  1,  1 >bignum '  1-offset fixup ;
+: -1, -1 >bignum ' -1-offset fixup ;
+
+! Beginning of the image
+
+: begin-image ( -- ) emit-header t, 0, 1, -1, ;
+
+! Words
+
+: emit-word ( word -- )
+    [
+        dup hashcode ' ,
+        dup word-name ' ,
+        dup word-vocabulary ' ,
+        dup word-def ' ,
+        dup word-props ' ,
+        f ' ,
+        0 ,
+        0 ,
+    ] { } make
+    \ word type-number object tag-number
+    [ emit-seq ] emit-object
+    swap objects get set-at ;
+
+: word-error ( word msg -- * )
+    [ % dup word-vocabulary % " " % word-name % ] "" make throw ;
+
+: transfer-word ( word -- word )
+    dup target-word [ ] [ word-name no-word ] ?if ;
+
+: fixup-word ( word -- offset )
+    transfer-word dup objects get at
+    [ ] [ "Not in image: " word-error ] ?if ;
+
+: fixup-words ( -- )
+    image get [ dup word? [ fixup-word ] when ] change-each ;
+
+M: word ' ;
+
+! Wrappers
+
+M: wrapper '
+    wrapped ' wrapper type-number object tag-number
+    [ emit ] emit-object ;
+
+! Strings
+: 16be> 0 [ swap 16 shift bitor ] reduce ;
+: 16le> <reversed> 16be> ;
+
+: emit-chars ( seq -- )
+    char <groups>
+    big-endian get [ [ 16be> ] map ] [ [ 16le> ] map ] if
+    emit-seq ;
+
+: pack-string ( string -- newstr )
+    dup length 1+ char align 0 pad-right ;
+
+: emit-string ( string -- ptr )
+    string type-number object tag-number [
+        dup length emit-fixnum
+        f ' emit
+        pack-string emit-chars
+    ] emit-object ;
+
+M: string '
+    #! We pool strings so that each string is only written once
+    #! to the image
+    objects get [ emit-string ] cache ;
+
+: assert-empty ( seq -- )
+    length 0 assert= ;
+
+: emit-dummy-array ( obj type -- ptr )
+    swap assert-empty
+    type-number object tag-number
+    [ 0 emit-fixnum ] emit-object ;
+
+M: byte-array ' byte-array emit-dummy-array ;
+
+M: bit-array ' bit-array emit-dummy-array ;
+
+M: float-array ' float-array emit-dummy-array ;
+
+! Arrays
+: emit-array ( list type tag -- pointer )
+    >r >r [ ' ] map r> r> [
+        dup length emit-fixnum
+        emit-seq
+    ] emit-object ;
+
+: emit-tuple ( obj -- pointer )
+    objects get [
+        [ tuple>array unclip transfer-word , % ] { } make
+        tuple type-number dup emit-array
+    ] cache ; inline
+
+M: tuple ' emit-tuple ;
+
+M: tombstone '
+    delegate
+    "((tombstone))" "((empty))" ? "hashtables.private" lookup
+    word-def first emit-tuple ;
+
+M: array '
+    array type-number object tag-number emit-array ;
+
+! Quotations
+
+M: quotation '
+    objects get [
+        quotation-array '
+        quotation type-number object tag-number [
+            emit ! array
+            0 emit ! XT
+        ] emit-object
+    ] cache ;
+
+! Vectors and sbufs
+
+M: vector '
+    dup underlying ' swap length
+    vector type-number object tag-number [
+        emit-fixnum ! length
+        emit ! array ptr
+    ] emit-object ;
+
+M: sbuf '
+    dup underlying ' swap length
+    sbuf type-number object tag-number [
+        emit-fixnum ! length
+        emit ! array ptr
+    ] emit-object ;
+
+! Hashes
+
+M: hashtable '
+    [ hash-array ' ] keep
+    hashtable type-number object tag-number [
+        dup hash-count emit-fixnum
+        hash-deleted emit-fixnum
+        emit ! array ptr
+    ] emit-object ;
+
+! Curries
+
+M: curry '
+    dup curry-quot ' swap curry-obj '
+    \ curry type-number object tag-number
+    [ emit emit ] emit-object ;
+
+! End of the image
+
+: emit-words ( -- )
+    all-words [ emit-word ] each ;
+
+: emit-global ( -- )
+    [
+        {
+            dictionary source-files
+            typemap builtins class<map update-map
+        } [ dup get swap bootstrap-word set ] each
+    ] H{ } make-assoc
+    bootstrap-global set
+    bootstrap-global emit-userenv ;
+
+: emit-boot-quot ( -- )
+    bootstrap-boot-quot emit-userenv ;
+
+: emit-jit-data ( -- )
+    \ if jit-if-word set
+    \ dispatch jit-dispatch-word set
+    {
+        jit-code-format
+        jit-setup
+        jit-prolog
+        jit-word-primitive-jump
+        jit-word-primitive-call
+        jit-word-jump
+        jit-word-call
+        jit-push-wrapper
+        jit-push-literal
+        jit-if-word
+        jit-if-jump
+        jit-if-call
+        jit-dispatch-word
+        jit-dispatch
+        jit-epilog
+        jit-return
+    } [ emit-userenv ] each ;
+
+: fixup-header ( -- )
+    heap-size data-heap-size-offset fixup ;
+
+: end-image ( -- )
+    "Building generic words..." print flush
+    all-words [ generic? ] subset [ make-generic ] each
+    "Serializing words..." print flush
+    emit-words
+    "Serializing JIT data..." print flush
+    emit-jit-data
+    "Serializing global namespace..." print flush
+    emit-global
+    "Serializing boot quotation..." print flush
+    emit-boot-quot
+    "Performing word fixups..." print flush
+    fixup-words
+    "Performing header fixups..." print flush
+    fixup-header
+    "Image length: " write image get length .
+    "Object cache size: " write objects get assoc-size .
+    \ word global delete-at ;
+
+! Image output
+
+: (write-image) ( image -- )
+    bootstrap-cell big-endian get [
+        [ >be write ] curry each
+    ] [
+        [ >le write ] curry each
+    ] if ;
+
+: image-name
+    "boot." architecture get ".image" 3append resource-path ;
+
+: write-image ( image filename -- )
+    "Writing image to " write dup write "..." print flush
+    <file-writer> [ (write-image) ] with-stream ;
+
+: prepare-profile ( arch -- )
+    "resource:core/bootstrap/layouts/layouts.factor" run-file
+    "resource:core/cpu/" swap {
+        { "x86.32" "x86/32" }
+        { "x86.64" "x86/64" }
+        { "linux-ppc" "ppc/linux" }
+        { "macosx-ppc" "ppc/macosx" }
+        { "arm" "arm" }
+    } at "/bootstrap.factor" 3append ?resource-path run-file ;
+
+: prepare-image ( arch -- )
+    dup architecture set prepare-profile
+    bootstrapping? on
+    load-help? off
+    800000 <vector> image set 20000 <hashtable> objects set ;
+
+PRIVATE>
+
+: make-image ( architecture -- )
+    [
+        parse-hook off
+        prepare-image
+        begin-image
+        "resource:/core/bootstrap/stage1.factor" run-file
+        end-image
+        image get image-name write-image
+    ] with-scope ;
+
+: make-images ( -- )
+    {
+        "x86.32" "x86.64" "linux-ppc" "macosx-ppc" "arm"
+    } [ make-image ] each ;
diff --git a/core/bootstrap/image/summary.txt b/core/bootstrap/image/summary.txt
new file mode 100644 (file)
index 0000000..208332e
--- /dev/null
@@ -0,0 +1 @@
+Bootstrap image generation
diff --git a/core/bootstrap/image/tags.txt b/core/bootstrap/image/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/core/bootstrap/init.factor b/core/bootstrap/init.factor
deleted file mode 100644 (file)
index 252eb27..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: kernel-internals
-USING: assembler command-line errors io io-internals kernel math
-namespaces parser words threads ;
-
-: boot ( -- )
-    init-namespaces
-    cell \ cell set
-    millis init-random
-    init-io
-    init-error-handler
-    init-threads
-    default-cli-args
-    [ parse-command-line ] try ;
diff --git a/core/bootstrap/init.facts b/core/bootstrap/init.facts
deleted file mode 100644 (file)
index d3328f0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-IN: kernel-internals
-USING: help kernel ;
-
-HELP: boot
-{ $description "Called on startup as part of the boot quotation (see " { $link set-boot } ") to initialize the runtime and prepare it for running user code." } ;
diff --git a/core/bootstrap/io/authors.txt b/core/bootstrap/io/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/io/io.factor b/core/bootstrap/io/io.factor
new file mode 100644 (file)
index 0000000..8aa7861
--- /dev/null
@@ -0,0 +1,8 @@
+USING: system vocabs vocabs.loader kernel ;
+IN: bootstrap.io
+
+"bootstrap.compiler" vocab [
+    unix? [ "io.unix" require ] when
+    winnt? [ "io.windows.nt" require ] when
+    wince? [ "io.windows.ce" require ] when
+] when
diff --git a/core/bootstrap/io/summary.txt b/core/bootstrap/io/summary.txt
new file mode 100644 (file)
index 0000000..d659643
--- /dev/null
@@ -0,0 +1 @@
+Loading native I/O in stage 2 bootstrap
diff --git a/core/bootstrap/layouts/authors.txt b/core/bootstrap/layouts/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/layouts/layouts.factor b/core/bootstrap/layouts/layouts.factor
new file mode 100644 (file)
index 0000000..189233e
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces math words kernel alien byte-arrays
+hashtables vectors strings sbufs arrays bit-arrays
+float-arrays quotations assocs layouts tuples ;
+
+BIN: 111 tag-mask set
+8 num-tags set
+3 tag-bits set
+
+23 num-types set
+
+H{
+    { fixnum      BIN: 000 }
+    { bignum      BIN: 001 }
+    { tuple       BIN: 010 }
+    { object      BIN: 011 }
+    { ratio       BIN: 100 }
+    { float       BIN: 101 }
+    { complex     BIN: 110 }
+    { POSTPONE: f BIN: 111 }
+} tag-numbers set
+
+tag-numbers get H{
+    { array 8 }
+    { wrapper 9 }
+    { hashtable 10 }
+    { vector 11 }
+    { string 12 }
+    { sbuf 13 }
+    { quotation 14 }
+    { dll 15 }
+    { alien 16 }
+    { word 17 }
+    { byte-array 18 }
+    { bit-array 19 }
+    { float-array 20 }
+    { curry 21 }
+    { callstack 22 }
+} union type-numbers set
diff --git a/core/bootstrap/layouts/summary.txt b/core/bootstrap/layouts/summary.txt
new file mode 100644 (file)
index 0000000..8f4f749
--- /dev/null
@@ -0,0 +1 @@
+Description of low-level object layout for image generation
diff --git a/core/bootstrap/math/math.factor b/core/bootstrap/math/math.factor
new file mode 100644 (file)
index 0000000..a293efd
--- /dev/null
@@ -0,0 +1,5 @@
+USE: vocabs.loader
+
+"math.ratios" require
+"math.floats" require
+"math.complex" require
diff --git a/core/bootstrap/math/summary.txt b/core/bootstrap/math/summary.txt
new file mode 100644 (file)
index 0000000..680c447
--- /dev/null
@@ -0,0 +1 @@
+Loading number tower in stage 2 bootstrap
index f63cbeb7c61238d42dc3c6f7e7673e86241dd20b..5e7bc1f3386e3fe23729e6db42ffbf98d3721964 100644 (file)
-! Copyright (C) 2004, 2006 Slava Pestov.
+! Copyright (C) 2004, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-IN: image
-USING: alien arrays generic hashtables help io kernel
-kernel-internals math modules namespaces parser sequences
-strings vectors words ;
+IN: bootstrap.primitives
+USING: alien arrays byte-arrays generic hashtables
+hashtables.private io kernel math namespaces parser sequences
+strings vectors words quotations assocs layouts classes tuples
+kernel.private vocabs vocabs.loader source-files definitions
+slots classes.union words.private ;
 
 ! Some very tricky code creating a bootstrap embryo in the
 ! host image.
 
 "Creating primitives and basic runtime structures..." print flush
 
-H{ } clone c-types set
-
-"resource:/core/compiler/alien/primitive-types.factor" parse-file
+load-help? off
+crossref off
+changed-words off
 
 ! Bring up a bare cross-compiling vocabulary.
-"syntax" vocab
+"syntax" vocab vocab-words bootstrap-syntax set
 
-H{ } clone source-files set
-H{ } clone vocabularies set
-H{ } clone class<map set
-V{ } clone modules set
-
-vocabularies get [ "syntax" set ] bind
+"resource:core/bootstrap/syntax.factor" parse-file
+H{ } clone dictionary set
+call
 
-H{ } clone articles set
-parent-graph off
-crossref off
-changed-words off
+! Create some empty vocabs where the below primitives and
+! classes will go
+{
+    "alien"
+    "arrays"
+    "bit-arrays"
+    "byte-arrays"
+    "classes.private"
+    "continuations.private"
+    "float-arrays"
+    "generator"
+    "growable"
+    "hashtables"
+    "hashtables.private"
+    "io"
+    "io.files"
+    "io.files.private"
+    "io.streams.c"
+    "kernel"
+    "kernel.private"
+    "math"
+    "math.private"
+    "memory"
+    "quotations"
+    "quotations.private"
+    "sbufs"
+    "sbufs.private"
+    "scratchpad"
+    "sequences"
+    "sequences.private"
+    "slots.private"
+    "strings"
+    "strings.private"
+    "system"
+    "threads.private"
+    "tools.profiler.private"
+    "tuples"
+    "tuples.private"
+    "words"
+    "words.private"
+    "vectors"
+    "vectors.private"
+} [
+    dup find-vocab-root swap create-vocab
+    [ set-vocab-root ] keep
+    f swap set-vocab-source-loaded?
+] each
 
-! Call the quotation parsed from primitive-types.factor
-call
+H{ } clone source-files set
+H{ } clone class<map set
+H{ } clone update-map set
 
-: make-primitive ( { vocab word } n -- )
-    >r first2 create f r> define ;
+: make-primitive ( word vocab n -- ) >r create r> define ;
 
 {
-    { "execute" "words"                     }
-    { "call" "kernel"                       }
-    { "if" "kernel"                         }
-    { "dispatch" "kernel-internals"         }
-    { "rehash-string" "kernel-internals"    }
-    { "string>sbuf" "strings"               }
-    { "bignum>fixnum" "math-internals"      }
-    { "float>fixnum" "math-internals"       }
-    { "fixnum>bignum" "math-internals"      }
-    { "float>bignum" "math-internals"       }
-    { "fixnum>float" "math-internals"       }
-    { "bignum>float" "math-internals"       }
-    { "(fraction>)" "math-internals"        }
-    { "string>float" "math-internals"       }
-    { "float>string" "math-internals"       }
-    { "float>bits" "math"                   }
-    { "double>bits" "math"                  }
-    { "bits>float" "math"                   }
-    { "bits>double" "math"                  }
-    { "<complex>" "math-internals"          }
-    { "fixnum+" "math-internals"            }
-    { "fixnum+fast" "math-internals"        }
-    { "fixnum-" "math-internals"            }
-    { "fixnum-fast" "math-internals"        }
-    { "fixnum*" "math-internals"            }
-    { "fixnum/i" "math-internals"           }
-    { "fixnum-mod" "math-internals"         }
-    { "fixnum/mod" "math-internals"         }
-    { "fixnum-bitand" "math-internals"      }
-    { "fixnum-bitor" "math-internals"       }
-    { "fixnum-bitxor" "math-internals"      }
-    { "fixnum-bitnot" "math-internals"      }
-    { "fixnum-shift" "math-internals"       }
-    { "fixnum<" "math-internals"            }
-    { "fixnum<=" "math-internals"           }
-    { "fixnum>" "math-internals"            }
-    { "fixnum>=" "math-internals"           }
-    { "bignum=" "math-internals"            }
-    { "bignum+" "math-internals"            }
-    { "bignum-" "math-internals"            }
-    { "bignum*" "math-internals"            }
-    { "bignum/i" "math-internals"           }
-    { "bignum-mod" "math-internals"         }
-    { "bignum/mod" "math-internals"         }
-    { "bignum-bitand" "math-internals"      }
-    { "bignum-bitor" "math-internals"       }
-    { "bignum-bitxor" "math-internals"      }
-    { "bignum-bitnot" "math-internals"      }
-    { "bignum-shift" "math-internals"       }
-    { "bignum<" "math-internals"            }
-    { "bignum<=" "math-internals"           }
-    { "bignum>" "math-internals"            }
-    { "bignum>=" "math-internals"           }
-    { "float+" "math-internals"             }
-    { "float-" "math-internals"             }
-    { "float*" "math-internals"             }
-    { "float/f" "math-internals"            }
-    { "float-mod" "math-internals"          }
-    { "float<" "math-internals"             }
-    { "float<=" "math-internals"            }
-    { "float>" "math-internals"             }
-    { "float>=" "math-internals"            }
-    { "(word)" "kernel-internals"           }
-    { "update-xt" "words"                   }
-    { "word-xt" "words"                     }
-    { "drop" "kernel"                       }
-    { "2drop" "kernel"                      }
-    { "3drop" "kernel"                      }
-    { "dup" "kernel"                        }
-    { "2dup" "kernel"                       }
-    { "3dup" "kernel"                       }
-    { "rot" "kernel"                        }
-    { "-rot" "kernel"                       }
-    { "dupd" "kernel"                       }
-    { "swapd" "kernel"                      }
-    { "nip" "kernel"                        }
-    { "2nip" "kernel"                       }
-    { "tuck" "kernel"                       }
-    { "over" "kernel"                       }
-    { "pick" "kernel"                       }
-    { "swap" "kernel"                       }
-    { ">r" "kernel"                         }
-    { "r>" "kernel"                         }
-    { "eq?" "kernel"                        }
-    { "getenv" "kernel-internals"           }
-    { "setenv" "kernel-internals"           }
-    { "stat" "io"                           }
-    { "(directory)" "io"                    }
-    { "data-gc" "memory"                    }
-    { "code-gc" "memory"                    }
-    { "gc-time" "memory"                    }
-    { "save-image" "memory"                 }
-    { "datastack" "kernel"                  }
-    { "retainstack" "kernel"                }
-    { "callstack" "kernel"                  }
-    { "set-datastack" "kernel"              }
-    { "set-retainstack" "kernel"            }
-    { "set-callstack" "kernel"              }
-    { "exit" "kernel"                       }
-    { "data-room" "memory"                  }
-    { "code-room" "memory"                  }
-    { "os-env" "kernel"                     }
-    { "millis" "kernel"                     }
-    { "type" "kernel"                       }
-    { "tag" "kernel-internals"              }
-    { "cwd" "io"                            }
-    { "cd" "io"                             }
-    { "add-compiled-block" "assembler"      }
-    { "dlopen" "alien"                      }
-    { "dlsym" "alien"                       }
-    { "dlclose" "alien"                     }
-    { "<byte-array>" "arrays"               }
-    { "<displaced-alien>" "alien"           }
-    { "alien-signed-cell" "alien"           }
-    { "set-alien-signed-cell" "alien"       }
-    { "alien-unsigned-cell" "alien"         }
-    { "set-alien-unsigned-cell" "alien"     }
-    { "alien-signed-8" "alien"              }
-    { "set-alien-signed-8" "alien"          }
-    { "alien-unsigned-8" "alien"            }
-    { "set-alien-unsigned-8" "alien"        }
-    { "alien-signed-4" "alien"              }
-    { "set-alien-signed-4" "alien"          }
-    { "alien-unsigned-4" "alien"            }
-    { "set-alien-unsigned-4" "alien"        }
-    { "alien-signed-2" "alien"              }
-    { "set-alien-signed-2" "alien"          }
-    { "alien-unsigned-2" "alien"            }
-    { "set-alien-unsigned-2" "alien"        }
-    { "alien-signed-1" "alien"              }
-    { "set-alien-signed-1" "alien"          }
-    { "alien-unsigned-1" "alien"            }
-    { "set-alien-unsigned-1" "alien"        }
-    { "alien-float" "alien"                 }
-    { "set-alien-float" "alien"             }
-    { "alien-double" "alien"                }
-    { "set-alien-double" "alien"            }
-    { "alien>char-string" "alien"           }
-    { "string>char-alien" "alien"           }
-    { "alien>u16-string" "alien"            }
-    { "string>u16-alien" "alien"            }
-    { "throw" "errors"                      }
-    { "string>memory" "kernel-internals"    }
-    { "memory>string" "kernel-internals"    }
-    { "alien-address" "alien"               }
-    { "slot" "kernel-internals"             }
-    { "set-slot" "kernel-internals"         }
-    { "char-slot" "kernel-internals"        }
-    { "set-char-slot" "kernel-internals"    }
-    { "resize-array" "arrays"               }
-    { "resize-string" "strings"             }
-    { "(hashtable)" "hashtables-internals"  }
-    { "<array>" "arrays"                    }
-    { "begin-scan" "memory"                 }
-    { "next-object" "memory"                }
-    { "end-scan" "memory"                   }
-    { "size" "memory"                       }
-    { "die" "kernel"                        }
-    { "finalize-compile" "assembler"        }
-    { "fopen"  "io-internals"               }
-    { "fgetc" "io-internals"                }
-    { "fwrite" "io-internals"               }
-    { "fflush" "io-internals"               }
-    { "fclose" "io-internals"               }
-    { "expired?" "alien"                    }
-    { "<wrapper>" "kernel"                  }
-    { "(clone)" "kernel-internals"          }
-    { "become" "kernel-internals"           }
-    { "array>vector" "vectors"              }
-    { "<string>" "strings"                  }
-    { "xt-map" "kernel-internals"           }
-} dup length 3 swap [ + ] map-with [ make-primitive ] 2each
-
-FORGET: make-primitive
+    { "(execute)" "words.private" }
+    { "(call)" "kernel.private" }
+    { "uncurry" "kernel.private" }
+    { "string>sbuf" "sbufs.private" }
+    { "bignum>fixnum" "math.private" }
+    { "float>fixnum" "math.private" }
+    { "fixnum>bignum" "math.private" }
+    { "float>bignum" "math.private" }
+    { "fixnum>float" "math.private" }
+    { "bignum>float" "math.private" }
+    { "<ratio>" "math.private" }
+    { "string>float" "math.private" }
+    { "float>string" "math.private" }
+    { "float>bits" "math" }
+    { "double>bits" "math" }
+    { "bits>float" "math" }
+    { "bits>double" "math" }
+    { "<complex>" "math.private" }
+    { "fixnum+" "math.private" }
+    { "fixnum+fast" "math.private" }
+    { "fixnum-" "math.private" }
+    { "fixnum-fast" "math.private" }
+    { "fixnum*" "math.private" }
+    { "fixnum*fast" "math.private" }
+    { "fixnum/i" "math.private" }
+    { "fixnum-mod" "math.private" }
+    { "fixnum/mod" "math.private" }
+    { "fixnum-bitand" "math.private" }
+    { "fixnum-bitor" "math.private" }
+    { "fixnum-bitxor" "math.private" }
+    { "fixnum-bitnot" "math.private" }
+    { "fixnum-shift" "math.private" }
+    { "fixnum<" "math.private" }
+    { "fixnum<=" "math.private" }
+    { "fixnum>" "math.private" }
+    { "fixnum>=" "math.private" }
+    { "bignum=" "math.private" }
+    { "bignum+" "math.private" }
+    { "bignum-" "math.private" }
+    { "bignum*" "math.private" }
+    { "bignum/i" "math.private" }
+    { "bignum-mod" "math.private" }
+    { "bignum/mod" "math.private" }
+    { "bignum-bitand" "math.private" }
+    { "bignum-bitor" "math.private" }
+    { "bignum-bitxor" "math.private" }
+    { "bignum-bitnot" "math.private" }
+    { "bignum-shift" "math.private" }
+    { "bignum<" "math.private" }
+    { "bignum<=" "math.private" }
+    { "bignum>" "math.private" }
+    { "bignum>=" "math.private" }
+    { "bignum-bit?" "math.private" }
+    { "bignum-log2" "math.private" }
+    { "byte-array>bignum" "math" }
+    { "float=" "math.private" }
+    { "float+" "math.private" }
+    { "float-" "math.private" }
+    { "float*" "math.private" }
+    { "float/f" "math.private" }
+    { "float-mod" "math.private" }
+    { "float<" "math.private" }
+    { "float<=" "math.private" }
+    { "float>" "math.private" }
+    { "float>=" "math.private" }
+    { "<word>" "words" }
+    { "update-xt" "words" }
+    { "word-xt" "words" }
+    { "drop" "kernel" }
+    { "2drop" "kernel" }
+    { "3drop" "kernel" }
+    { "dup" "kernel" }
+    { "2dup" "kernel" }
+    { "3dup" "kernel" }
+    { "rot" "kernel" }
+    { "-rot" "kernel" }
+    { "dupd" "kernel" }
+    { "swapd" "kernel" }
+    { "nip" "kernel" }
+    { "2nip" "kernel" }
+    { "tuck" "kernel" }
+    { "over" "kernel" }
+    { "pick" "kernel" }
+    { "swap" "kernel" }
+    { ">r" "kernel" }
+    { "r>" "kernel" }
+    { "eq?" "kernel" }
+    { "getenv" "kernel.private" }
+    { "setenv" "kernel.private" }
+    { "(stat)" "io.files.private" }
+    { "(directory)" "io.files.private" }
+    { "data-gc" "memory" }
+    { "code-gc" "memory" }
+    { "gc-time" "memory" }
+    { "save-image" "memory" }
+    { "save-image-and-exit" "memory" }
+    { "datastack" "kernel" }
+    { "retainstack" "kernel" }
+    { "callstack" "kernel" }
+    { "set-datastack" "kernel" }
+    { "set-retainstack" "kernel" }
+    { "set-callstack" "kernel" }
+    { "exit" "system" }
+    { "data-room" "memory" }
+    { "code-room" "memory" }
+    { "os-env" "system" }
+    { "millis" "system" }
+    { "type" "kernel.private" }
+    { "tag" "kernel.private" }
+    { "cwd" "io.files" }
+    { "cd" "io.files" }
+    { "add-compiled-block" "generator" }
+    { "dlopen" "alien" }
+    { "dlsym" "alien" }
+    { "dlclose" "alien" }
+    { "<byte-array>" "byte-arrays" }
+    { "<bit-array>" "bit-arrays" }
+    { "<displaced-alien>" "alien" }
+    { "alien-signed-cell" "alien" }
+    { "set-alien-signed-cell" "alien" }
+    { "alien-unsigned-cell" "alien" }
+    { "set-alien-unsigned-cell" "alien" }
+    { "alien-signed-8" "alien" }
+    { "set-alien-signed-8" "alien" }
+    { "alien-unsigned-8" "alien" }
+    { "set-alien-unsigned-8" "alien" }
+    { "alien-signed-4" "alien" }
+    { "set-alien-signed-4" "alien" }
+    { "alien-unsigned-4" "alien" }
+    { "set-alien-unsigned-4" "alien" }
+    { "alien-signed-2" "alien" }
+    { "set-alien-signed-2" "alien" }
+    { "alien-unsigned-2" "alien" }
+    { "set-alien-unsigned-2" "alien" }
+    { "alien-signed-1" "alien" }
+    { "set-alien-signed-1" "alien" }
+    { "alien-unsigned-1" "alien" }
+    { "set-alien-unsigned-1" "alien" }
+    { "alien-float" "alien" }
+    { "set-alien-float" "alien" }
+    { "alien-double" "alien" }
+    { "set-alien-double" "alien" }
+    { "alien-cell" "alien" }
+    { "set-alien-cell" "alien" }
+    { "alien>char-string" "alien" }
+    { "string>char-alien" "alien" }
+    { "alien>u16-string" "alien" }
+    { "string>u16-alien" "alien" }
+    { "(throw)" "kernel.private" }
+    { "string>memory" "alien" }
+    { "memory>string" "alien" }
+    { "alien-address" "alien" }
+    { "slot" "slots.private" }
+    { "set-slot" "slots.private" }
+    { "char-slot" "strings.private" }
+    { "set-char-slot" "strings.private" }
+    { "resize-array" "arrays" }
+    { "resize-string" "strings" }
+    { "(hashtable)" "hashtables.private" }
+    { "<array>" "arrays" }
+    { "begin-scan" "memory" }
+    { "next-object" "memory" }
+    { "end-scan" "memory" }
+    { "size" "memory" }
+    { "die" "kernel" }
+    { "finalize-compile" "generator" }
+    { "fopen" "io.streams.c" }
+    { "fgetc" "io.streams.c" }
+    { "fread" "io.streams.c" }
+    { "fwrite" "io.streams.c" }
+    { "fflush" "io.streams.c" }
+    { "fclose" "io.streams.c" }
+    { "<wrapper>" "kernel" }
+    { "(clone)" "kernel" }
+    { "array>vector" "vectors.private" }
+    { "<string>" "strings" }
+    { "(>tuple)" "tuples.private" }
+    { "array>quotation" "quotations.private" }
+    { "quotation-xt" "quotations" }
+    { "<tuple>" "tuples.private" }
+    { "tuple>array" "tuples" }
+    { "profiling" "tools.profiler.private" }
+    { "become" "tuples.private" }
+    { "(sleep)" "threads.private" }
+    { "<float-array>" "float-arrays" }
+    { "curry" "kernel" }
+    { "<tuple-boa>" "tuples.private" }
+       { "class-hash" "kernel.private" }
+    { "callstack>array" "kernel" }
+    { "array>callstack" "kernel" }
+}
+dup length [ >r first2 r> make-primitive ] 2each
 
 ! Okay, now we have primitives fleshed out. Bring up the generic
 ! word system.
 : builtin-predicate ( class predicate -- )
     [
         over "type" word-prop dup
-        tag-mask < \ tag \ type ? , , \ eq? ,
+        \ tag-mask get < \ tag \ type ? , , \ eq? ,
     ] [ ] make define-predicate ;
 
 : register-builtin ( class -- )
     dup "type" word-prop builtins get set-nth ;
 
-: define-builtin ( symbol type# predicate slotspec -- )
-    >r >r >r
-    dup intern-symbol
-    dup r> "type" set-word-prop
-    dup define-class
+: intern-slots ( spec -- spec )
+    [
+        [ dup array? [ first2 create ] when ] map
+        { slot-spec f } swap append >tuple
+    ] map ;
+
+: lookup-type-number ( word -- n )
+    global [ target-word ] bind type-number ;
+
+: define-builtin ( symbol predicate slotspec -- )
+    >r dup make-inline >r
+    dup dup lookup-type-number "type" set-word-prop
+    dup f f builtin-class define-class
     dup r> builtin-predicate
     dup r> intern-slots 2dup "slots" set-word-prop
     define-slots
     register-builtin ;
 
 H{ } clone typemap set
-num-types f <array> builtins set
+num-types get f <array> builtins set
 
 ! These symbols are needed by the code that executes below
-"object" "generic" create drop
-"null" "generic" create drop
+{
+    { "object" "kernel" }
+    { "null" "kernel" }
+} [ create drop ] assoc-each
 
-"fixnum?" "math" create t "inline" set-word-prop
-"fixnum" "math" create 0 "fixnum?" "math" create { } define-builtin
-"fixnum" "math" create ">fixnum" "math" create unit "coercer" set-word-prop
+"fixnum" "math" create "fixnum?" "math" create { } define-builtin
+"fixnum" "math" create ">fixnum" "math" create 1quotation "coercer" set-word-prop
 
-"bignum?" "math" create t "inline" set-word-prop
-"bignum" "math" create 1 "bignum?" "math" create { } define-builtin
-"bignum" "math" create ">bignum" "math" create unit "coercer" set-word-prop
+"bignum" "math" create "bignum?" "math" create { } define-builtin
+"bignum" "math" create ">bignum" "math" create 1quotation "coercer" set-word-prop
 
-"word?" "words" create t "inline" set-word-prop
-"word" "words" create 2 "word?" "words" create
+"tuple" "kernel" create "tuple?" "kernel" create
+{ } define-builtin
+
+"ratio" "math" create "ratio?" "math" create
 {
-    { 1 fixnum { "hashcode" "kernel" } f }
-    {
-        2
-        object
-        { "word-name" "words" }
-        { "set-word-name" "words" }
-    }
-    {
-        3
-        object
-        { "word-vocabulary" "words" }
-        { "set-word-vocabulary" "words" }
-    }
     {
-        4
-        object
-        { "word-primitive" "words" }
-        { "set-word-primitive" "words" }
+        { "integer" "math" }
+        "numerator"
+        1
+        { "numerator" "math" }
+        f
     }
     {
-        5
-        object
-        { "word-def" "words" }
-        { "set-word-def" "words" }
+        { "integer" "math" }
+        "denominator"
+        2
+        { "denominator" "math" }
+        f
     }
+} define-builtin
+
+"float" "math" create "float?" "math" create { } define-builtin
+"float" "math" create ">float" "math" create 1quotation "coercer" set-word-prop
+
+"complex" "math" create "complex?" "math" create
+{
     {
-        6
-        object
-        { "word-props" "words" }
-        { "set-word-props" "words" }
+        { "real" "math" }
+        "real"
+        1
+        { "real" "math" }
+        f
     }
     {
-        7
-        object
-        { "compiled?" "words" }
+        { "real" "math" }
+        "imaginary"
+        2
+        { "imaginary" "math" }
         f
     }
 } define-builtin
 
-"ratio?" "math" create t "inline" set-word-prop
-"ratio" "math" create 4 "ratio?" "math" create
-{
-    { 1 integer { "numerator" "math" } f }
-    { 2 integer { "denominator" "math" } f }
-} define-builtin
+"f" "syntax" lookup "not" "kernel" create
+{ } define-builtin
 
-"float?" "math" create t "inline" set-word-prop
-"float" "math" create 5 "float?" "math" create { } define-builtin
-"float" "math" create ">float" "math" create unit "coercer" set-word-prop
+"array" "arrays" create "array?" "arrays" create
+{ } define-builtin
 
-"complex?" "math" create t "inline" set-word-prop
-"complex" "math" create 6 "complex?" "math" create
+"wrapper" "kernel" create "wrapper?" "kernel" create
 {
-    { 1 real { "real" "math" } f }
-    { 2 real { "imaginary" "math" } f }
+    {
+        { "object" "kernel" }
+        "wrapped"
+        1
+        { "wrapped" "kernel" }
+        f
+    }
 } define-builtin
 
-"wrapper?" "kernel" create t "inline" set-word-prop
-"wrapper" "kernel" create 7 "wrapper?" "kernel" create
-{ { 1 object { "wrapped" "kernel" } f } } define-builtin
-
-"array?" "arrays" create t "inline" set-word-prop
-"array" "arrays" create 8 "array?" "arrays" create
-{ } define-builtin
-
-"!f" "!syntax" create 9 "not" "kernel" create
-{ } define-builtin
-
-"hashtable?" "hashtables" create t "inline" set-word-prop
-"hashtable" "hashtables" create 10 "hashtable?" "hashtables" create
+"hashtable" "hashtables" create "hashtable?" "hashtables" create
 {
     {
+        { "array-capacity" "sequences.private" }
+        "count"
         1
-        fixnum
-        { "hash-count" "hashtables" }
-        { "set-hash-count" "hashtables-internals" }
+        { "hash-count" "hashtables.private" }
+        { "set-hash-count" "hashtables.private" }
     } {
+        { "array-capacity" "sequences.private" }
+        "deleted"
         2
-        fixnum
-        { "hash-deleted" "hashtables" }
-        { "set-hash-deleted" "hashtables-internals" }
+        { "hash-deleted" "hashtables.private" }
+        { "set-hash-deleted" "hashtables.private" }
     } {
+        { "array" "arrays" }
+        "array"
         3
-        array
-        { "hash-array" "hashtables-internals" }
-        { "set-hash-array" "hashtables-internals" }
+        { "hash-array" "hashtables.private" }
+        { "set-hash-array" "hashtables.private" }
     }
 } define-builtin
 
-"vector?" "vectors" create t "inline" set-word-prop
-"vector" "vectors" create 11 "vector?" "vectors" create
+"vector" "vectors" create "vector?" "vectors" create
 {
     {
+        { "array-capacity" "sequences.private" }
+        "fill"
         1
-        fixnum
         { "length" "sequences" }
-        { "set-fill" "sequences-internals" }
+        { "set-fill" "growable" }
     } {
+        { "array" "arrays" }
+        "underlying"
         2
-        array
-        { "underlying" "sequences-internals" }
-        { "set-underlying" "sequences-internals" }
+        { "underlying" "growable" }
+        { "set-underlying" "growable" }
     }
 } define-builtin
 
-"string?" "strings" create t "inline" set-word-prop
-"string" "strings" create 12 "string?" "strings" create
+"string" "strings" create "string?" "strings" create
 {
     {
+        { "array-capacity" "sequences.private" }
+        "length"
         1
-        fixnum
         { "length" "sequences" }
         f
-    } {
-        2
-        object
-        { "string-hashcode" "kernel-internals" }
-        { "set-string-hashcode" "kernel-internals" }
     }
 } define-builtin
 
-"sbuf?" "strings" create t "inline" set-word-prop 
-"sbuf" "strings" create 13 "sbuf?" "strings" create
+"sbuf" "sbufs" create "sbuf?" "sbufs" create
 {
     {
+        { "array-capacity" "sequences.private" }
+        "length"
         1
-        fixnum
         { "length" "sequences" }
-        { "set-fill" "sequences-internals" }
+        { "set-fill" "growable" }
     }
     {
+        { "string" "strings" }
+        "underlying"
         2
-        string
-        { "underlying" "sequences-internals" }
-        { "set-underlying" "sequences-internals" }
+        { "underlying" "growable" }
+        { "set-underlying" "growable" }
     }
 } define-builtin
 
-"quotation?" "kernel" create t "inline" set-word-prop
-"quotation" "kernel" create 14 "quotation?" "kernel" create
-{ } define-builtin
+"quotation" "quotations" create "quotation?" "quotations" create
+{
+    {
+        { "object" "kernel" }
+        "array"
+        1
+        { "quotation-array" "quotations.private" }
+        f
+    }
+} define-builtin
+
+"dll" "alien" create "dll?" "alien" create
+{
+    {
+        { "byte-array" "byte-arrays" }
+        "path"
+        1
+        { "(dll-path)" "alien" }
+        f
+    }
+}
+define-builtin
+
+"alien" "alien" create "alien?" "alien" create
+{
+    {
+        { "c-ptr" "alien" }
+        "alien"
+        1
+        { "underlying-alien" "alien" }
+        f
+    } {
+        { "object" "kernel" }
+        "expired?"
+        2
+        { "expired?" "alien" }
+        f
+    }
+}
+define-builtin
+
+"word" "words" create "word?" "words" create
+{
+    {
+        { "object" "kernel" }
+        "name"
+        2
+        { "word-name" "words" }
+        { "set-word-name" "words" }
+    }
+    {
+        { "object" "kernel" }
+        "vocabulary"
+        3
+        { "word-vocabulary" "words" }
+        { "set-word-vocabulary" "words" }
+    }
+    {
+        { "object" "kernel" }
+        "def"
+        4
+        { "word-def" "words" }
+        { "set-word-def" "words.private" }
+    }
+    {
+        { "object" "kernel" }
+        "props"
+        5
+        { "word-props" "words" }
+        { "set-word-props" "words" }
+    }
+    {
+        { "object" "kernel" }
+        "?"
+        6
+        { "compiled?" "words" }
+        f
+    }
+    {
+        { "fixnum" "math" }
+        "counter"
+        7
+        { "profile-counter" "tools.profiler.private" }
+        { "set-profile-counter" "tools.profiler.private" }
+    }
+} define-builtin
 
-"dll?" "alien" create t "inline" set-word-prop
-"dll" "alien" create 15 "dll?" "alien" create
-{ { 1 byte-array { "dll-path" "alien" } f } } define-builtin
+"byte-array" "byte-arrays" create
+"byte-array?" "byte-arrays" create
+{ } define-builtin
 
-"alien" "alien" create 16 "alien?" "alien" create
-{ { 1 c-ptr { "underlying-alien" "alien" } f } } define-builtin
+"bit-array" "bit-arrays" create
+"bit-array?" "bit-arrays" create
+{ } define-builtin
 
-"tuple?" "kernel" create t "inline" set-word-prop
-"tuple" "kernel" create 17 "tuple?" "kernel" create
+"float-array" "float-arrays" create
+"float-array?" "float-arrays" create
 { } define-builtin
 
-"byte-array?" "arrays" create t "inline" set-word-prop
-"byte-array" "arrays" create 18
-"byte-array?" "arrays" create
+"curry" "kernel" create
+"curry?" "kernel" create
+{
+    {
+        { "object" "kernel" }
+        "obj"
+        1
+        { "curry-obj" "kernel" }
+        f
+    }
+    {
+        { "object" "kernel" }
+        "obj"
+        2
+        { "curry-quot" "kernel" }
+        f
+    }
+} define-builtin
+
+"callstack" "kernel" create "callstack?" "kernel" create
 { } define-builtin
 
 ! Define general-t type, which is any object that is not f.
-"general-t" "kernel" create dup define-symbol
-f "!f" "!syntax" lookup builtins get remove [ ] subset
-define-union
+"general-t" "kernel" create
+"f" "syntax" lookup builtins get remove [ ] subset f union-class
+define-class
 
 ! Catch-all class for providing a default method.
-"object" "generic" create [ drop t ] "predicate" set-word-prop
-"object" "generic" create dup define-symbol
-f builtins get [ ] subset define-union
+"object" "kernel" create [ drop t ] "predicate" set-word-prop
+"object" "kernel" create
+builtins get [ ] subset f union-class define-class
+
+! Class of objects with object tag
+"hi-tag" "classes.private" create
+builtins get num-tags get tail f union-class define-class
 
 ! Null class with no instances.
-"null" "generic" create [ drop f ] "predicate" set-word-prop
-"null" "generic" create dup define-symbol f { } define-union
+"null" "kernel" create [ drop f ] "predicate" set-word-prop
+"null" "kernel" create { } f union-class define-class
+
+! Create special tombstone values
+"tombstone" "hashtables.private" create { } define-tuple-class
+
+"((empty))" "hashtables.private" create
+"tombstone" "hashtables.private" lookup f
+2array >tuple 1quotation define-inline
+
+"((tombstone))" "hashtables.private" create
+"tombstone" "hashtables.private" lookup t
+2array >tuple 1quotation define-inline
 
-FORGET: builtin-predicate
-FORGET: register-builtin
-FORGET: define-builtin
+! Bump build number
+"build" "kernel" create build 1+ 1quotation define-compound
diff --git a/core/bootstrap/profile-amd64.factor b/core/bootstrap/profile-amd64.factor
deleted file mode 100644 (file)
index d070071..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: image kernel-internals namespaces ;
-
-! Do not load this file into a running image, ever.
-
-8 \ cell set
-big-endian off
diff --git a/core/bootstrap/profile-pentium4.factor b/core/bootstrap/profile-pentium4.factor
deleted file mode 100644 (file)
index daa47e4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: image kernel-internals namespaces ;
-
-! Do not load this file into a running image, ever.
-
-4 \ cell set
-big-endian off
diff --git a/core/bootstrap/profile-ppc.factor b/core/bootstrap/profile-ppc.factor
deleted file mode 100644 (file)
index fbd25b0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: image kernel-internals namespaces ;
-
-! Do not load this file into a running image, ever.
-
-4 \ cell set
-big-endian on
diff --git a/core/bootstrap/profile-x86.factor b/core/bootstrap/profile-x86.factor
deleted file mode 100644 (file)
index daa47e4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: image kernel-internals namespaces ;
-
-! Do not load this file into a running image, ever.
-
-4 \ cell set
-big-endian off
diff --git a/core/bootstrap/stage1.factor b/core/bootstrap/stage1.factor
new file mode 100644 (file)
index 0000000..bb8c9a5
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: bootstrap.stage1
+USING: arrays debugger generic hashtables io assocs
+kernel.private kernel math memory namespaces parser
+prettyprint sequences vectors words system splitting
+init io.files bootstrap.image bootstrap.image.private vocabs
+vocabs.loader system ;
+
+{ "resource:core" } vocab-roots set
+
+"Bootstrap stage 1..." print flush
+
+"resource:core/bootstrap/primitives.factor" run-file
+
+! Create a boot quotation
+[
+    ! Rehash hashtables, since core/tools/image creates them
+    ! using the host image's hashing algorithms
+
+    [ [ hashtable? ] instances [ rehash ] each ] %
+
+    \ boot ,
+
+    "math.integers" require
+    "memory" require
+    "io.streams.c" require
+    "vocabs.loader" require
+    "syntax" require
+    "bootstrap.layouts" require
+
+    [
+        "resource:core/bootstrap/stage2.factor"
+        dup ?resource-path exists? [
+            run-file
+        ] [
+            "Cannot find " write write "." print
+            "Please move " write image write " to the same directory as the Factor sources," print
+            "and try again." print
+            1 exit
+        ] if
+    ] %
+] [ ] make bootstrap-boot-quot set
diff --git a/core/bootstrap/stage2.factor b/core/bootstrap/stage2.factor
new file mode 100644 (file)
index 0000000..298e905
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: init command-line namespaces words debugger io
+kernel.private math memory continuations kernel io.files
+io.backend system parser vocabs sequences prettyprint
+vocabs.loader combinators splitting source-files strings
+definitions assocs ;
+IN: bootstrap.stage2
+
+! Wrap everything in a catch which starts a listener so
+! you can see what went wrong, instead of dealing with a
+! fep
+[
+    vm file-name windows? [ >lower ".exe" ?tail drop ] when
+    ".image" append "output-image" set-global
+
+    "math compiler tools help ui ui.tools io" "include" set-global
+    "" "exclude" set-global
+
+    parse-command-line
+
+    "Cross-referencing..." print flush
+    H{ } clone changed-words set-global
+    H{ } clone crossref set-global
+    xref-words
+    xref-sources
+
+    ! Set dll paths
+    wince? [ "windows.ce" require ] when
+    winnt? [ "windows.nt" require ] when
+
+    [
+        ! Compile everything if compiler is loaded
+        all-words [ changed-word ] each
+
+        "exclude" "include"
+        [ get-global " " split [ empty? not ] subset ] 2apply
+        seq-diff
+        [ "bootstrap." swap append require ] each
+    ] no-parse-hook
+
+    init-io
+    init-stdio
+
+    changed-words get clear-assoc
+
+    "compile-errors" "generator" lookup [
+        f swap set-global
+    ] when*
+
+    run-bootstrap-init
+
+    f error set-global
+    f error-continuation set-global
+
+    "deploy-vocab" get [
+        "tools.deploy" run
+    ] [
+        "listener" require
+        "none" require
+
+        [
+            boot
+            do-init-hooks
+            [ parse-command-line ] try
+            [ run-user-init ] try
+            [ "run" get run ] try
+            stdio get [ stream-flush ] when*
+        ] set-boot-quot
+
+        : count-words all-words swap subset length pprint ;
+    
+        [ compiled? ] count-words " compiled words" print
+        [ symbol? ] count-words " symbol words" print
+        [ ] count-words " words total" print
+
+        "Bootstrapping is complete." print
+        "Now, you can run ./factor -i=" write
+        "output-image" get print flush
+
+        "output-image" get resource-path save-image-and-exit
+    ] if
+] [ error-hook get call "listener" run ] recover
diff --git a/core/bootstrap/summary.txt b/core/bootstrap/summary.txt
new file mode 100644 (file)
index 0000000..208332e
--- /dev/null
@@ -0,0 +1 @@
+Bootstrap image generation
diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor
new file mode 100644 (file)
index 0000000..136745f
--- /dev/null
@@ -0,0 +1,69 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: words sequences vocabs kernel ;
+IN: bootstrap.syntax
+
+"syntax" create-vocab
+"resource:core" over set-vocab-root
+f swap set-vocab-source-loaded?
+
+{
+    "!"
+    "\""
+    "#!"
+    "("
+    ":"
+    ";"
+    "<PRIVATE"
+    "?{"
+    "BIN:"
+    "B{"
+    "C:"
+    "CHAR:"
+    "C{"
+    "DEFER:"
+    "F{"
+    "FORGET:"
+    "GENERIC#"
+    "GENERIC:"
+    "HEX:"
+    "HOOK:"
+    "H{"
+    "IN:"
+    "INSTANCE:"
+    "M:"
+    "MAIN:"
+    "MATH:"
+    "MIXIN:"
+    "OCT:"
+    "P\""
+    "POSTPONE:"
+    "PREDICATE:"
+    "PRIMITIVE:"
+    "PRIVATE>"
+    "SBUF\""
+    "SYMBOL:"
+    "TUPLE:"
+    "T{"
+    "UNION:"
+    "USE-IF:"
+    "USE:"
+    "USING:"
+    "V{"
+    "W{"
+    "["
+    "\\"
+    "]"
+    "delimiter"
+    "f"
+    "flushable"
+    "foldable"
+    "inline"
+    "parsing"
+    "t"
+    "{"
+    "}"
+    "CS{"
+} [ "syntax" create drop ] each
+
+"t" "syntax" lookup define-symbol
diff --git a/core/bootstrap/tools/authors.txt b/core/bootstrap/tools/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/tools/summary.txt b/core/bootstrap/tools/summary.txt
new file mode 100644 (file)
index 0000000..9c1fad4
--- /dev/null
@@ -0,0 +1 @@
+Loading terminal-based developer tools in stage 2 bootstrap
diff --git a/core/bootstrap/tools/tools.factor b/core/bootstrap/tools/tools.factor
new file mode 100644 (file)
index 0000000..f3ec0a8
--- /dev/null
@@ -0,0 +1,19 @@
+USING: kernel vocabs vocabs.loader sequences namespaces parser ;
+
+{
+    "bootstrap.image"
+    "tools.annotations"
+    "tools.crossref"
+    "tools.deploy"
+    "tools.memory"
+    "tools.test"
+    "tools.time"
+    "tools.walker"
+    "editors"
+} dup [ require ] each
+
+global [ add-use ] bind
+
+"bootstrap.compiler" vocab [
+    "tools.profiler" dup require use+
+] when
diff --git a/core/bootstrap/ui/authors.txt b/core/bootstrap/ui/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/ui/summary.txt b/core/bootstrap/ui/summary.txt
new file mode 100644 (file)
index 0000000..5902a00
--- /dev/null
@@ -0,0 +1 @@
+Loading graphical user interface in stage 2 bootstrap
diff --git a/core/bootstrap/ui/tools/authors.txt b/core/bootstrap/ui/tools/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/bootstrap/ui/tools/summary.txt b/core/bootstrap/ui/tools/summary.txt
new file mode 100644 (file)
index 0000000..fb45fcb
--- /dev/null
@@ -0,0 +1 @@
+Loading graphical developer tools in stage 2 bootstrap
diff --git a/core/bootstrap/ui/tools/tools.factor b/core/bootstrap/ui/tools/tools.factor
new file mode 100644 (file)
index 0000000..c469aed
--- /dev/null
@@ -0,0 +1,10 @@
+USING: kernel vocabs vocabs.loader sequences ;
+
+{ "ui" "help" "tools" }
+[ "bootstrap." swap append vocab ] all? [
+    "ui.tools" require
+
+    "ui.cocoa" vocab [
+        "ui.cocoa.tools" require
+    ] when
+] when
diff --git a/core/bootstrap/ui/ui.factor b/core/bootstrap/ui/ui.factor
new file mode 100644 (file)
index 0000000..86538e0
--- /dev/null
@@ -0,0 +1,14 @@
+USING: alien namespaces system combinators kernel sequences
+vocabs vocabs.loader ;
+
+"bootstrap.compiler" vocab [
+    "ui-backend" get [
+        {
+            { [ macosx? ] [ "cocoa" ] }
+            { [ windows? ] [ "windows" ] }
+            { [ unix? ] [ "x11" ] }
+        } cond
+    ] unless* "ui." swap append require
+
+    "ui.freetype" require
+] when
diff --git a/core/byte-arrays/authors.txt b/core/byte-arrays/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/byte-arrays/byte-arrays-docs.factor b/core/byte-arrays/byte-arrays-docs.factor
new file mode 100644 (file)
index 0000000..d26ab68
--- /dev/null
@@ -0,0 +1,31 @@
+USING: arrays bit-arrays vectors strings sbufs
+kernel help.markup help.syntax ;
+IN: byte-arrays
+
+ARTICLE: "byte-arrays" "Byte arrays"
+"Byte arrays are fixed-size mutable sequences (" { $link "sequence-protocol" } ") whose elements are integers in the range 0-255, inclusive. Each element only uses one byte of storage, hence the name. The literal syntax is covered in " { $link "syntax-byte-arrays" } "."
+$nl
+"Byte array words are in the " { $vocab-link "byte-arrays" } " vocabulary."
+$nl
+"Byte arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See " { $link "c-byte-arrays" } "."
+$nl
+"Byte arrays form a class of objects."
+{ $subsection byte-array }
+{ $subsection byte-array? }
+"There are several ways to construct byte arrays."
+{ $subsection >byte-array }
+{ $subsection <byte-array> } ;
+
+ABOUT: "byte-arrays"
+
+HELP: byte-array
+{ $description "The class of byte arrays. See " { $link "syntax-byte-arrays" } " for syntax and " { $link "byte-arrays" } " for general information." } ;
+
+HELP: <byte-array> ( n -- byte-array )
+{ $values { "n" "a non-negative integer" } { "byte-array" "a new byte array" } }
+{ $description "Creates a new byte array holding " { $snippet "n" } " bytes." } ;
+
+HELP: >byte-array
+{ $values { "seq" "a sequence" } { "byte-array" byte-array } }
+{ $description "Outputs a freshly-allocated byte array whose elements have the same boolean values as a given sequence." }
+{ $errors "Throws an error if the sequence contains elements other than integers." } ;
diff --git a/core/byte-arrays/byte-arrays.factor b/core/byte-arrays/byte-arrays.factor
new file mode 100644 (file)
index 0000000..0d4eda1
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: byte-arrays
+USING: kernel kernel.private alien sequences
+sequences.private math ;
+
+M: byte-array clone (clone) ;
+M: byte-array length array-capacity ;
+M: byte-array nth-unsafe swap >fixnum alien-unsigned-1 ;
+M: byte-array set-nth-unsafe swap >fixnum set-alien-unsigned-1 ;
+: >byte-array ( seq -- byte-array ) B{ } clone-like ; inline
+M: byte-array like drop dup byte-array? [ >byte-array ] unless ;
+M: byte-array new drop <byte-array> ;
+
+M: byte-array equal?
+    over byte-array? [ sequence= ] [ 2drop f ] if ;
+
+INSTANCE: byte-array sequence
diff --git a/core/byte-arrays/summary.txt b/core/byte-arrays/summary.txt
new file mode 100644 (file)
index 0000000..b5b09a0
--- /dev/null
@@ -0,0 +1 @@
+Efficient fixed-length byte arrays
diff --git a/core/byte-arrays/tags.txt b/core/byte-arrays/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/classes/authors.txt b/core/classes/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/classes/classes-docs.factor b/core/classes/classes-docs.factor
new file mode 100644 (file)
index 0000000..e637c47
--- /dev/null
@@ -0,0 +1,219 @@
+USING: generic help.markup help.syntax kernel kernel.private
+namespaces sequences words arrays layouts help effects math
+layouts classes.private classes.union classes.mixin
+classes.predicate ;
+IN: classes
+
+ARTICLE: "builtin-classes" "Built-in classes"
+"Every object is an instance of to exactly one canonical " { $emphasis "built-in class" } " which defines its layout in memory and basic behavior."
+$nl
+"Corresponding to every built-in class is a built-in type number. An object can be asked for its built-in type number:"
+{ $subsection type }
+"Built-in type numbers can be converted to classes, and vice versa:"
+{ $subsection type>class }
+{ $subsection type-number }
+"The set of built-in classes is a class:"
+{ $subsection builtin-class }
+{ $subsection builtin-class? }
+"See " { $link "type-index" } " for a list of built-in classes." ;
+
+ARTICLE: "class-operations" "Class operations"
+"Set-theoretic operations on classes:"
+{ $subsection class< }
+{ $subsection class-and }
+{ $subsection class-or }
+{ $subsection classes-intersect? }
+"Topological sort:"
+{ $subsection sort-classes }
+{ $subsection min-class }
+"Low-level implementation detail:"
+{ $subsection types }
+{ $subsection flatten-class }
+{ $subsection flatten-builtin-class }
+{ $subsection flatten-union-class } ;
+
+ARTICLE: "class-predicates" "Class predicate words"
+"With a handful of exceptions, each class has a membership predicate word, named " { $snippet { $emphasis "class" } "?" } " . A quotation calling this predicate is stored in the " { $snippet "\"predicate\"" } " word property."
+$nl
+"When it comes to predicates, the exceptional classes are:"
+{ $table
+    { "Class" "Predicate" "Explanation" }
+    { { $link f } { $snippet "[ not ]" } { "The conventional name for a word which outputs true when given false is " { $link not } "; " { $snippet "f?" } " would be confusing." } }
+    { { $link object } { $snippet "[ drop t ]" } { "All objects are instances of " { $link object } } }
+    { { $link null } { $snippet "[ drop f ]" } { "No object is an instance of " { $link null } } }
+    { { $link general-t } { $snippet "[ ]" } { "All objects with a true value are instances of " { $link general-t } } }
+}
+"The set of class predicate words is a class:"
+{ $subsection predicate }
+{ $subsection predicate? }
+"A predicate word holds a reference to the class it is predicating over in the " { $snippet "\"predicating\"" } " word property." ;
+
+ARTICLE: "classes" "Classes"
+"Conceptually, a " { $snippet "class" } " is a set of objects whose members can be identified with a predicate, and on which generic words can specialize methods. Classes are organized into a general partial order, and an object may be an instance of more than one class."
+$nl
+"At the implementation level, a class is a word with certain word properties set."
+$nl
+"Words for working with classes are found in the " { $vocab-link "classes" } " vocabulary."
+$nl
+"Classes themselves form a class:"
+{ $subsection class? }
+"You can ask an object for its class:"
+{ $subsection class }
+"There is a universal class which all objects are an instance of, and an empty class with no instances:"
+{ $subsection object }
+{ $subsection null }
+"Obtaining a list of all defined classes:"
+{ $subsection classes }
+"Other sorts of classes:"
+{ $subsection "builtin-classes" }
+{ $subsection "unions" }
+{ $subsection "mixins" }
+{ $subsection "predicates" }
+"Classes can be inspected and operated upon:"
+{ $subsection "class-operations" }
+{ $see-also "class-index" } ;
+
+ABOUT: "classes"
+
+HELP: class
+{ $values { "object" object } { "class" class } }
+{ $description "Outputs an object's canonical class. While an object may be an instance of more than one class, the canonical class is either its built-in class, or if the object is a tuple, its tuple class." }
+{ $class-description "The class of all class words. Subclasses include " { $link builtin-class } ", " { $link union-class } ", " { $link mixin-class } ", " { $link predicate-class } " and " { $link tuple-class } "." }
+{ $examples { $example "USE: classes" "1.0 class ." "float" } { $example "USE: classes" "TUPLE: point x y z ;\nT{ point f 1 2 3 } class ." "point" } } ;
+
+HELP: classes
+{ $values { "seq" "a sequence of class words" } }
+{ $description "Finds all class words in the dictionary." } ;
+
+HELP: builtin-class
+{ $class-description "The class of built-in classes." }
+{ $examples
+    "The class of arrays is a built-in class:"
+    { $example "USE: classes" "array builtin-class? ." "t" }
+    "However, a literal array is not a built-in class; it is not even a class:"
+    { $example "USE: classes" "{ 1 2 3 } builtin-class? ." "f" }
+} ;
+
+HELP: tuple-class
+{ $class-description "The class of tuple class words." }
+{ $examples { $example "USE: classes\nTUPLE: name title first last ;\nname tuple-class? ." "t" } } ;
+
+HELP: typemap
+{ $var-description "Hashtable mapping unions to class words, used to implement " { $link class-and } " and " { $link class-or } "." } ;
+
+HELP: builtins
+{ $var-description "Vector mapping type numbers to builtin class words." } ;
+
+HELP: class<map
+{ $var-description "Hashtable mapping each class to a set of classes which are contained in that class under the " { $link (class<) } " relation. The " { $link class< } " word uses this hashtable to avoid frequent expensive calls to " { $link (class<) } "." } ;
+
+HELP: update-map
+{ $var-description "Hashtable mapping each class to a set of classes defined in terms of this class. The " { $link define-class } " word uses this information to update generic words when classes are redefined." } ;
+
+HELP: type>class
+{ $values { "n" "a non-negative integer" } { "class" class } }
+{ $description "Outputs a builtin class whose instances are precisely those having a given pointer tag." }
+{ $notes "The parameter " { $snippet "n" } " must be between 0 and the return value of " { $link num-types } "." } ;
+
+HELP: predicate-word
+{ $values { "word" "a word" } { "predicate" "a predicate word" } }
+{ $description "Suffixes the word's name with \"?\" and creates a word with that name in the same vocabulary as the word itself." } ;
+
+HELP: define-predicate
+{ $values { "class" class } { "predicate" "a predicate word" } { "quot" "a quotation" } }
+{ $description
+    "Defines a predicate word. This is identical to a compound definition associating " { $snippet "quot" } " with " { $snippet "predicate" } " with the added perk that three word properties are set:"
+    { $list
+        { "the class word's " { $snippet "\"predicate\"" } " property is set to a quotation that calls the predicate" }
+        { "the predicate word's " { $snippet "\"predicating\"" } " property is set to the class word" }
+        { "the predicate word's " { $snippet "\"declared-effect\"" } " word property is set to a descriptive " { $link effect } }
+    }
+    "These properties are used by method dispatch and the help system."
+}
+$low-level-note ;
+
+HELP: superclass
+{ $values { "class" class } { "super" class } }
+{ $description "Outputs the superclass of a class. All instances of this class are also instances of the superclass." }
+{ $notes "If " { $link class< } " yields that one class is a subtype of another, it does not imply that a superclass relation is involved. The superclass relation is a technical implementation detail of predicate and tuple classes." } ;
+
+HELP: members
+{ $values { "class" class } { "seq" "a sequence of union members, or " { $link f } } }
+{ $description "If " { $snippet "class" } " is a union class, outputs a sequence of its member classes, otherwise outputs " { $link f } "." } ;
+
+HELP: flatten-union-class
+{ $values { "class" class } { "assoc" "an assoc whose keys are classes" } }
+{ $description "Outputs the set of classes whose union is equal to " { $snippet "class" } ". Unions are expanded recursively so the output assoc does not contain any union classes. However, it may contain predicate classes whose superclasses are unions." } ;
+
+HELP: flatten-builtin-class
+{ $values { "class" class } { "assoc" "an assoc whose keys are classes" } }
+{ $description "Outputs a set of tuple classes whose union is the smallest cover of " { $snippet "class" } " intersected with " { $link tuple } "." } ;
+
+HELP: flatten-class
+{ $values { "class" class } { "assoc" "an assoc whose keys are classes" } }
+{ $description "Outputs a set of builtin and tuple classes whose union is the smallest cover of " { $snippet "class" } "." } ;
+
+HELP: types
+{ $values { "class" class } { "seq" "an increasing sequence of integers" } }
+{ $description "Outputs a sequence of builtin type numbers whose instances can possibly be instances of the given class." } ;
+
+HELP: class-empty?
+{ $values { "class" "a class" } { "?" "a boolean" } }
+{ $description "Tests if a class is a union class with no members." }
+{ $examples { $example "USE: classes" "null class-empty? ." "t" } } ;
+
+HELP: (class<)
+{ $values { "class1" "a class" } { "class2" "a class" } { "?" "a boolean" } }
+{ $description "Performs the calculation for " { $link class< } ". There is never any reason to call this word from user code since " { $link class< } " outputs identical values and caches results for better performance." } ;
+
+HELP: class<
+{ $values { "class1" "a class" } { "class2" "a class" } { "?" "a boolean" } }
+{ $description "Tests if all instances of " { $snippet "class1" } " are also instances of " { $snippet "class2" } "." }
+{ $notes "Classes are partially ordered. This means that if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class1" } ", then " { $snippet "class1 = class2" } ". Also, if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class3" } ", then " { $snippet "class1 <= class3" } "." } ;
+
+HELP: sort-classes
+{ $values { "seq" "a sequence of class" } { "newseq" "a new seqence of classes" } }
+{ $description "Outputs a topological sort of a sequence of classes. Larger classes come before their subclasses." } ;
+
+{ sort-classes methods order } related-words
+
+HELP: lookup-union
+{ $values { "classes" "a hashtable mapping class words to themselves" } { "class" class } }
+{ $description "Given a set of classes represented as a hashtable with equal keys and values, looks up a previously-defined union class having those members. If no union is defined, outputs " { $link object } "." } ;
+
+{ class-and class-or lookup-union } related-words
+
+HELP: class-or
+{ $values { "class1" class } { "class2" class } { "class" class } }
+{ $description "Outputs the smallest known class containing both " { $snippet "class1" } " and " { $snippet "class2" } "." } ;
+
+HELP: class-and
+{ $values { "class1" class } { "class2" class } { "class" class } }
+{ $description "Outputs the largest known class contained in both " { $snippet "class1" } " and " { $snippet "class2" } ". If the intersection is non-empty but no union class with those exact members is defined, outputs " { $link object } ". If the intersection is empty, outputs " { $link null } "." } ;
+
+HELP: classes-intersect?
+{ $values { "class1" class } { "class2" class } { "?" "a boolean" } }
+{ $description "Tests if two classes have a non-empty intersection. If the intersection is empty, no object can be an instance of both classes at once." } ;
+
+HELP: min-class
+{ $values { "class" class } { "seq" "a sequence of class words" } { "class/f" "a class word or " { $link f } } }
+{ $description "If all classes in " { $snippet "seq" } " that intersect " { $snippet "class" } " are subtypes of " { $snippet "class" } ", outputs the last such element of " { $snippet "seq" } ". If any conditions fail to hold, outputs " { $link f } "." } ;
+
+HELP: define-class
+{ $values { "word" word } { "members" "a sequence of class words" } { "superclass" class } { "metaclass" class } }
+{ $description "Sets a property indicating this word is a class word, thus making it an instance of " { $link class } ", and registers it with " { $link typemap } " and " { $link class<map } "." }
+$low-level-note ;
+
+: $predicate ( element -- )
+    { { "object" object } { "?" "a boolean" } } $values
+    [
+        "Tests if the object is an instance of the " ,
+        first "predicating" word-prop \ $link swap 2array ,
+        " class." ,
+    ] { } make $description ;
+
+M: predicate word-help* drop \ $predicate ;
+
+HELP: $predicate
+{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
+{ $description "Prints the boilerplate description of a class membership predicate word such as " { $link array? } " or " { $link integer? } "." } ;
diff --git a/core/classes/classes-tests.factor b/core/classes/classes-tests.factor
new file mode 100644 (file)
index 0000000..dd18d32
--- /dev/null
@@ -0,0 +1,179 @@
+USING: alien arrays definitions generic assocs hashtables io
+kernel math namespaces parser prettyprint sequences strings
+tools.test vectors words quotations classes io.streams.string
+classes.private classes.union classes.mixin classes.predicate
+vectors ;
+IN: temporary
+
+H{ } "s" set
+
+[ ] [ 1 2 "s" get push-at ] unit-test
+[ 1 ] [ 2 "s" get at first ] unit-test
+[ ] [ 1 2 "s" get pop-at ] unit-test
+[ t ] [ 2 "s" get at empty? ] unit-test
+
+[ object ] [ object object class-and ] unit-test
+[ fixnum ] [ fixnum object class-and ] unit-test
+[ fixnum ] [ object fixnum class-and ] unit-test
+[ fixnum ] [ fixnum fixnum class-and ] unit-test
+[ fixnum ] [ fixnum integer class-and ] unit-test
+[ fixnum ] [ integer fixnum class-and ] unit-test
+[ null ] [ vector fixnum class-and ] unit-test
+[ number ] [ number object class-and ] unit-test
+[ number ] [ object number class-and ] unit-test
+[ null ] [ slice reversed class-and ] unit-test
+
+TUPLE: first-one ;
+TUPLE: second-one ;
+UNION: both first-one union-class ;
+
+[ t ] [ both tuple classes-intersect? ] unit-test
+
+[ t ] [ \ fixnum \ integer class< ] unit-test
+[ t ] [ \ fixnum \ fixnum class< ] unit-test
+[ f ] [ \ integer \ fixnum class< ] unit-test
+[ t ] [ \ integer \ object class< ] unit-test
+[ f ] [ \ integer \ null class< ] unit-test
+[ t ] [ \ null \ object class< ] unit-test
+
+[ t ] [ \ generic \ compound class< ] unit-test
+[ f ] [ \ compound \ generic class< ] unit-test
+
+[ f ] [ \ reversed \ slice class< ] unit-test
+[ f ] [ \ slice \ reversed class< ] unit-test
+
+PREDICATE: word no-docs "documentation" word-prop not ;
+
+UNION: no-docs-union no-docs integer ;
+
+[ t ] [ no-docs no-docs-union class< ] unit-test
+[ f ] [ no-docs-union no-docs class< ] unit-test
+
+TUPLE: a ;
+TUPLE: b ;
+UNION: c a b ;
+
+[ t ] [ \ c \ tuple class< ] unit-test
+[ f ] [ \ tuple \ c class< ] unit-test
+
+DEFER: bah
+FORGET: bah
+UNION: bah fixnum alien ;
+[ bah ] [ \ bah? "predicating" word-prop ] unit-test
+
+! Test generic see and parsing
+[ "IN: temporary\nSYMBOL: bah\n\nUNION: bah fixnum alien ;\n" ]
+[ [ \ bah see ] string-out ] unit-test
+
+! Test redefinition of classes
+UNION: union-1 fixnum float ;
+
+GENERIC: generic-update-test ( x -- y )
+
+M: union-1 generic-update-test drop "union-1" ;
+
+[ f ] [ bignum union-1 class< ] unit-test
+[ t ] [ union-1 number class< ] unit-test
+[ "union-1" ] [ 1.0 generic-update-test ] unit-test
+
+[ union-1 ] [ fixnum float class-or ] unit-test
+
+"IN: temporary UNION: union-1 rational array ;" eval
+
+do-parse-hook
+
+[ t ] [ bignum union-1 class< ] unit-test
+[ f ] [ union-1 number class< ] unit-test
+[ "union-1" ] [ { 1.0 } generic-update-test ] unit-test
+
+[ object ] [ fixnum float class-or ] unit-test
+
+"IN: temporary PREDICATE: integer union-1 even? ;" eval
+
+do-parse-hook
+
+[ f ] [ union-1 union-class? ] unit-test
+[ t ] [ union-1 predicate-class? ] unit-test
+[ "union-1" ] [ 8 generic-update-test ] unit-test
+[ -7 generic-update-test ] unit-test-fails
+
+! Test mixins
+MIXIN: sequence-mixin
+
+INSTANCE: array sequence-mixin
+INSTANCE: vector sequence-mixin
+INSTANCE: slice sequence-mixin
+
+MIXIN: assoc-mixin
+
+INSTANCE: hashtable assoc-mixin
+
+GENERIC: collection-size ( x -- y )
+
+M: sequence-mixin collection-size length ;
+
+M: assoc-mixin collection-size assoc-size ;
+
+[ t ] [ array sequence-mixin class< ] unit-test
+[ t ] [ { 1 2 3 } sequence-mixin? ] unit-test
+[ 3 ] [ { 1 2 3 } collection-size ] unit-test
+[ f ] [ H{ { 1 2 } { 2 3 } } sequence-mixin? ] unit-test
+[ t ] [ H{ { 1 2 } { 2 3 } } assoc-mixin? ] unit-test
+[ 2 ] [ H{ { 1 2 } { 2 3 } } collection-size ] unit-test
+
+! Test mixing in of new classes after the fact
+MIXIN: mx1
+
+INSTANCE: integer mx1
+
+[ t ] [ integer mx1 class< ] unit-test
+[ t ] [ mx1 integer class< ] unit-test
+[ t ] [ mx1 number class< ] unit-test
+
+"INSTANCE: array mx1" eval
+
+[ t ] [ array mx1 class< ] unit-test
+[ f ] [ mx1 number class< ] unit-test
+
+[ mx1 ] [ array integer class-or ] unit-test
+
+\ mx1 forget
+
+[ f ] [ array integer class-or mx1 = ] unit-test
+
+! Empty unions were causing problems
+GENERIC: empty-union-test
+
+UNION: empty-union-1 ;
+
+M: empty-union-1 empty-union-test ;
+
+UNION: empty-union-2 ;
+
+M: empty-union-2 empty-union-test ;
+
+! Redefining a class didn't update containing unions
+UNION: redefine-bug-1 fixnum ;
+
+UNION: redefine-bug-2 redefine-bug-1 quotation ;
+
+[ t ] [ fixnum redefine-bug-2 class< ] unit-test
+[ t ] [ quotation redefine-bug-2 class< ] unit-test
+[ redefine-bug-2 ] [ fixnum quotation class-or ] unit-test
+
+"IN: temporary UNION: redefine-bug-1 bignum ;" eval
+
+[ t ] [ bignum redefine-bug-1 class< ] unit-test
+[ f ] [ fixnum redefine-bug-2 class< ] unit-test
+[ t ] [ bignum redefine-bug-2 class< ] unit-test
+[ f ] [ fixnum quotation class-or redefine-bug-2 eq? ] unit-test
+[ redefine-bug-2 ] [ bignum quotation class-or ] unit-test
+
+! Another issue similar to the above
+UNION: forget-class-bug-1 integer ;
+UNION: forget-class-bug-2 forget-class-bug-1 dll ;
+
+FORGET: forget-class-bug-1
+FORGET: forget-class-bug-2
+
+[ t ] [ integer dll class-or interned? ] unit-test
diff --git a/core/classes/classes.factor b/core/classes/classes.factor
new file mode 100644 (file)
index 0000000..41be3dd
--- /dev/null
@@ -0,0 +1,281 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: classes
+USING: arrays definitions assocs kernel
+kernel.private slots.private namespaces sequences strings words
+vectors math quotations combinators sorting effects graphs ;
+
+PREDICATE: word class ( obj -- ? ) "class" word-prop ;
+
+SYMBOL: typemap
+SYMBOL: class<map
+SYMBOL: update-map
+SYMBOL: builtins
+
+PREDICATE: word builtin-class
+    "metaclass" word-prop builtin-class eq? ;
+
+PREDICATE: class tuple-class
+    "metaclass" word-prop tuple-class eq? ;
+
+: classes ( -- seq ) class<map get keys ;
+
+: type>class ( n -- class ) builtins get nth ;
+
+: predicate-word ( word -- predicate )
+    [ word-name "?" append ] keep word-vocabulary create ;
+
+: predicate-effect 1 { "?" } <effect> ;
+
+PREDICATE: compound predicate
+    "predicating" word-prop >boolean ;
+
+: define-predicate ( class predicate quot -- )
+    over [
+        dupd predicate-effect define-declared
+        2dup 1quotation "predicate" set-word-prop
+        swap "predicating" set-word-prop
+    ] [
+        3drop
+    ] if ;
+
+: superclass ( class -- super )
+    "superclass" word-prop ;
+
+: members ( class -- seq ) "members" word-prop ;
+
+: class-empty? ( class -- ? ) members dup [ empty? ] when ;
+
+: (flatten-union-class) ( class -- )
+    dup members [
+        [ (flatten-union-class) ] each
+    ] [
+        dup set
+    ] ?if ;
+
+: flatten-union-class ( class -- assoc )
+    [ (flatten-union-class) ] H{ } make-assoc ;
+
+: (flatten-class) ( class -- )
+    {
+        { [ dup tuple-class? ] [ dup set ] }
+        { [ dup builtin-class? ] [ dup set ] }
+        { [ dup members ] [ members [ (flatten-class) ] each ] }
+        { [ dup superclass ] [ superclass (flatten-class) ] }
+    } cond ;
+
+: flatten-class ( class -- assoc )
+    [ (flatten-class) ] H{ } make-assoc ;
+
+: class-hashes ( class -- seq )
+    flatten-class keys [
+        dup builtin-class?
+        [ "type" word-prop ] [ hashcode ] if
+    ] map ;
+
+: (flatten-builtin-class) ( class -- )
+    {
+        { [ dup members ] [ members [ (flatten-builtin-class) ] each ] }
+        { [ dup superclass ] [ superclass (flatten-builtin-class) ] }
+        { [ t ] [ dup set ] }
+    } cond ;
+
+: flatten-builtin-class ( class -- assoc )
+    [ (flatten-builtin-class) ] H{ } make-assoc ;
+
+: types ( class -- seq )
+    flatten-builtin-class keys
+    [ "type" word-prop ] map natural-sort ;
+
+: class< ( class1 class2 -- ? ) swap class<map get at key? ;
+
+<PRIVATE
+
+DEFER: (class<)
+
+: superclass< ( cls1 cls2 -- ? )
+    >r superclass r> 2dup and [ (class<) ] [ 2drop f ] if ;
+
+: union-class< ( cls1 cls2 -- ? )
+    [ flatten-union-class ] 2apply keys
+    [ nip [ (class<) ] curry* contains? ] curry assoc-all? ;
+
+: (class<) ( class1 class2 -- ? )
+    {
+        { [ 2dup eq? ] [ 2drop t ] }
+        { [ over class-empty? ] [ 2drop t ] }
+        { [ 2dup superclass< ] [ 2drop t ] }
+        { [ 2dup [ members not ] both? ] [ 2drop f ] }
+        { [ t ] [ union-class< ] }
+    } cond ;
+
+: lookup-union ( classes -- class )
+    typemap get at dup empty? [ drop object ] [ first ] if ;
+
+: (class-or) ( class class -- class )
+    [ flatten-builtin-class ] 2apply union lookup-union ;
+
+: (class-and) ( class class -- class )
+    [ flatten-builtin-class ] 2apply intersect lookup-union ;
+
+: tuple-class-and ( class1 class2 -- class )
+    dupd eq? [ drop null ] unless ;
+
+: largest-class ( seq -- n elt )
+    dup [
+        [ 2dup class< >r swap class< not r> and ]
+        curry* subset empty?
+    ] curry find [ "Topological sort failed" throw ] unless* ;
+
+: (sort-classes) ( vec -- )
+    dup empty?
+    [ drop ]
+    [ dup largest-class , over delete-nth (sort-classes) ] if ;
+
+PRIVATE>
+
+: sort-classes ( seq -- newseq )
+    [ >vector (sort-classes) ] { } make ;
+
+: class-or ( class1 class2 -- class )
+    {
+        { [ 2dup class< ] [ nip ] }
+        { [ 2dup swap class< ] [ drop ] }
+        { [ t ] [ (class-or) ] }
+    } cond ;
+
+: class-and ( class1 class2 -- class )
+    {
+        { [ 2dup class< ] [ drop ] }
+        { [ 2dup swap class< ] [ nip ] }
+        { [ 2dup [ tuple-class? ] both? ] [ tuple-class-and ] }
+        { [ t ] [ (class-and) ] }
+    } cond ;
+
+: classes-intersect? ( class1 class2 -- ? )
+    class-and class-empty? not ;
+
+: min-class ( class seq -- class/f )
+    [ dupd classes-intersect? ] subset dup empty? [
+        2drop f
+    ] [
+        tuck [ class< ] curry* all? [ peek ] [ drop f ] if
+    ] if ;
+
+GENERIC: reset-class ( class -- )
+
+M: word reset-class drop ;
+
+<PRIVATE
+
+! class<map
+: bigger-classes ( class -- seq )
+    classes [ (class<) ] curry* subset ;
+
+: bigger-classes+ ( class -- )
+    [ bigger-classes [ dup ] H{ } map>assoc ] keep
+    class<map get set-at ;
+
+: bigger-classes- ( class -- )
+    class<map get delete-at ;
+
+: smaller-classes ( class -- seq )
+    classes swap [ (class<) ] curry subset ;
+
+: smaller-classes+ ( class -- )
+    dup smaller-classes class<map get add-vertex ;
+
+: smaller-classes- ( class -- )
+    dup smaller-classes class<map get remove-vertex ;
+
+: class<map+ ( class -- )
+    H{ } clone over class<map get set-at
+    dup smaller-classes+ bigger-classes+ ;
+
+: class<map- ( class -- )
+    dup smaller-classes- bigger-classes- ;
+
+! update-map
+: class-uses ( class -- seq )
+    [ dup members % superclass [ , ] when* ] { } make ;
+
+: class-usages ( class -- assoc )
+    [ update-map get at ] closure ;
+
+: update-map+ ( class -- )
+    dup class-uses update-map get add-vertex ;
+
+: update-map- ( class -- )
+    dup class-uses update-map get remove-vertex ;
+
+! typemap
+: push-at ( value key assoc -- )
+    2dup at* [
+        2nip push
+    ] [
+        drop >r >r 1vector r> r> set-at
+    ] if ;
+
+: typemap+ ( class -- )
+    dup flatten-builtin-class typemap get push-at ;
+
+: pop-at ( value key assoc -- )
+    at* [ delete ] [ 2drop ] if ;
+
+: typemap- ( class -- )
+    dup flatten-builtin-class typemap get pop-at ;
+
+! Class definition
+: cache-class ( class -- )
+    dup typemap+ dup class<map+ update-map+ ;
+
+: cache-classes ( assoc -- )
+    [ drop cache-class ] assoc-each ;
+
+GENERIC: uncache-class ( class -- )
+
+M: class uncache-class
+    dup update-map- dup class<map- typemap- ;
+
+M: word uncache-class drop ;
+
+: uncache-classes ( assoc -- )
+    [ drop uncache-class ] assoc-each ;
+
+GENERIC: update-methods ( class -- )
+
+PRIVATE>
+
+: define-class-props ( members superclass metaclass -- assoc )
+    [
+        "metaclass" set
+        dup [ bootstrap-word ] when "superclass" set
+        [ bootstrap-word ] map "members" set
+    ] H{ } make-assoc ;
+
+: (define-class) ( word props -- )
+    over reset-class
+    >r dup word-props r> union over set-word-props
+    dup intern-symbol
+    t "class" set-word-prop ;
+
+: define-class ( word members superclass metaclass -- )
+    #! If it was already a class, update methods after.
+    define-class-props
+    over class? >r
+    over class-usages [
+        uncache-classes
+        dupd (define-class)
+    ] keep cache-classes
+    r> [ update-methods ] [ drop ] if ;
+
+GENERIC: class ( object -- class ) inline
+
+M: object class type type>class ;
+
+<PRIVATE
+
+: class-of-tuple ( obj -- class )
+    2 slot { word } declare ; inline
+
+PRIVATE>
diff --git a/core/classes/mixin/authors.txt b/core/classes/mixin/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/classes/mixin/mixin-docs.factor b/core/classes/mixin/mixin-docs.factor
new file mode 100644 (file)
index 0000000..fedf7c3
--- /dev/null
@@ -0,0 +1,14 @@
+USING: help.markup help.syntax ;
+IN: classes.mixin
+
+ARTICLE: "mixins" "Mixin classes"
+"An object is an instance of a union class if it is an instance of one of its members. In this respect, mixin classes are identical to union classes. However, new classes can be made into instances of a mixin class after the original definition of the mixin."
+{ $subsection POSTPONE: MIXIN: }
+{ $subsection POSTPONE: INSTANCE: }
+{ $subsection define-mixin-class }
+{ $subsection add-mixin-instance }
+"The set of mixin classes is a class:"
+{ $subsection mixin-class }
+{ $subsection mixin-class? } ;
+
+ABOUT: "mixins"
diff --git a/core/classes/mixin/mixin.factor b/core/classes/mixin/mixin.factor
new file mode 100644 (file)
index 0000000..4ea6f43
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: classes classes.union words kernel sequences ;
+IN: classes.mixin
+
+PREDICATE: union-class mixin-class "mixin" word-prop ;
+
+M: mixin-class reset-class
+    { "metaclass" "members" "mixin" } reset-props ;
+
+: redefine-mixin-class ( class members -- )
+    dupd define-union-class
+    t "mixin" set-word-prop ;
+
+: define-mixin-class ( class -- )
+    dup mixin-class? [
+        drop
+    ] [
+        { } redefine-mixin-class
+    ] if ;
+
+: add-mixin-instance ( class mixin -- )
+    dup mixin-class? [ "Not a mixin class" throw ] unless
+    2dup members memq? [
+        2drop
+    ] [
+        [ members swap bootstrap-word add ] keep swap
+        redefine-mixin-class
+    ] if ;
diff --git a/core/classes/mixin/summary.txt b/core/classes/mixin/summary.txt
new file mode 100644 (file)
index 0000000..9e93a91
--- /dev/null
@@ -0,0 +1 @@
+Mixin classes (extensible unions)
diff --git a/core/classes/predicate/authors.txt b/core/classes/predicate/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/classes/predicate/predicate-docs.factor b/core/classes/predicate/predicate-docs.factor
new file mode 100644 (file)
index 0000000..4657671
--- /dev/null
@@ -0,0 +1,23 @@
+USING: generic help.markup help.syntax kernel kernel.private
+namespaces sequences words arrays layouts help effects math
+layouts classes.private classes ;
+IN: classes.predicate
+
+ARTICLE: "predicates" "Predicate classes"
+"Predicate classes allow fine-grained control over method dispatch."
+{ $subsection POSTPONE: PREDICATE: }
+{ $subsection define-predicate-class }
+"The set of predicate classes is a class:"
+{ $subsection predicate-class }
+{ $subsection predicate-class? } ;
+
+ABOUT: "predicates"
+
+HELP: define-predicate-class
+{ $values { "superclass" class } { "class" class } { "definition" "a quotation with stack effect " { $snippet "( superclass -- ? )" } } }
+{ $description "Defines a predicate class." } ;
+
+{ predicate-class define-predicate-class POSTPONE: PREDICATE: } related-words
+
+HELP: predicate-class
+{ $class-description "The class of predicate class words, defined by " { $link POSTPONE: PREDICATE: } " and documented in " { $link "predicates" } "." } ;
diff --git a/core/classes/predicate/predicate.factor b/core/classes/predicate/predicate.factor
new file mode 100644 (file)
index 0000000..a727086
--- /dev/null
@@ -0,0 +1,24 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: classes kernel namespaces words ;
+IN: classes.predicate
+
+PREDICATE: class predicate-class
+    "metaclass" word-prop predicate-class eq? ;
+
+: predicate-quot ( class -- quot )
+    [
+        \ dup ,
+        dup superclass "predicate" word-prop %
+        "predicate-definition" word-prop , [ drop f ] , \ if ,
+    ] [ ] make ;
+
+: define-predicate-class ( superclass class definition -- )
+    >r dup f roll predicate-class define-class r>
+    dupd "predicate-definition" set-word-prop
+    dup predicate-word over predicate-quot define-predicate ;
+
+M: predicate-class reset-class
+    {
+        "metaclass" "predicate-definition" "superclass"
+    } reset-props ;
diff --git a/core/classes/predicate/summary.txt b/core/classes/predicate/summary.txt
new file mode 100644 (file)
index 0000000..2a55d63
--- /dev/null
@@ -0,0 +1 @@
+Predicate classes
diff --git a/core/classes/summary.txt b/core/classes/summary.txt
new file mode 100644 (file)
index 0000000..4dbb643
--- /dev/null
@@ -0,0 +1 @@
+Object system implementation
diff --git a/core/classes/tags.txt b/core/classes/tags.txt
new file mode 100644 (file)
index 0000000..abf53a4
--- /dev/null
@@ -0,0 +1 @@
+reflection
diff --git a/core/classes/union/authors.txt b/core/classes/union/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/classes/union/summary.txt b/core/classes/union/summary.txt
new file mode 100644 (file)
index 0000000..7f4e818
--- /dev/null
@@ -0,0 +1 @@
+Union classes
diff --git a/core/classes/union/union-docs.factor b/core/classes/union/union-docs.factor
new file mode 100644 (file)
index 0000000..41e7619
--- /dev/null
@@ -0,0 +1,25 @@
+USING: generic help.markup help.syntax kernel kernel.private
+namespaces sequences words arrays layouts help effects math
+layouts classes.private classes ;
+IN: classes.union
+
+ARTICLE: "unions" "Union classes"
+"An object is an instance of a union class if it is an instance of one of its members. Union classes are used to associate the same method with several different classes, as well as to conveniently define predicates."
+{ $subsection POSTPONE: UNION: }
+{ $subsection define-union-class }
+"Union classes can be introspected:"
+{ $subsection members }
+"The set of union classes is a class:"
+{ $subsection union-class }
+{ $subsection union-class? } ;
+
+ABOUT: "unions"
+
+HELP: define-union-class
+{ $values { "class" class } { "members" "a sequence of classes" } }
+{ $description "Defines a union class with specified members." } ;
+
+{ union-class define-union-class POSTPONE: UNION: } related-words
+
+HELP: union-class
+{ $class-description "The class of union classes." } ;
diff --git a/core/classes/union/union.factor b/core/classes/union/union.factor
new file mode 100644 (file)
index 0000000..e95c08b
--- /dev/null
@@ -0,0 +1,27 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: words sequences kernel assocs combinators classes
+generic.standard namespaces arrays ;
+IN: classes.union
+
+PREDICATE: class union-class
+    "metaclass" word-prop union-class eq? ;
+
+! Union classes for dispatch on multiple classes.
+: union-predicate-quot ( members -- quot )
+    0 (dispatch#) [
+        [ [ drop t ] ] { } map>assoc
+        object bootstrap-word [ drop f ] 2array add*
+        single-combination
+    ] with-variable ;
+
+: define-union-predicate ( class -- )
+    dup predicate-word
+    over members union-predicate-quot
+    define-predicate ;
+
+: define-union-class ( class members -- )
+    dupd f union-class define-class define-union-predicate ;
+
+M: union-class reset-class
+    { "metaclass" "members" } reset-props ;
diff --git a/core/cli.factor b/core/cli.factor
deleted file mode 100644 (file)
index a1d1c7e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: command-line
-USING: errors hashtables io kernel kernel-internals namespaces
-parser sequences strings ;
-
-: ?run-file ( file -- )
-    dup exists? [ run-file ] [ drop ] if ;
-
-: run-bootstrap-init ( -- )
-    "user-init" get [
-        home ".factor-boot-rc" path+ ?run-file
-    ] when ;
-
-: run-user-init ( -- )
-    "user-init" get [
-        home ".factor-rc" path+ ?run-file
-    ] when ;
-
-: cli-var-param ( name value -- ) swap set-global ;
-
-: cli-bool-param ( name -- ) "no-" ?head not cli-var-param ;
-
-: cli-param ( param -- )
-    #! Handle a command-line argument starting with '-' by
-    #! setting that variable to t, or if the argument is
-    #! prefixed with 'no-', setting the variable to f.
-    #!
-    #! Arguments containing = are handled differently; they
-    #! set the object path.
-    "=" split1 [ cli-var-param ] [ cli-bool-param ] if* ;
-
-: cli-arg ( argument -- argument )
-    #! Handle a command-line argument. If the argument was
-    #! consumed, returns f. Otherwise returns the argument.
-    #! Parameters that start with + are runtime parameters.
-    "-" ?head [ cli-param f ] when ;
-
-: cli-args ( -- args ) 10 getenv ;
-
-: default-shell "tty" ;
-
-: default-cli-args
-    #! Some flags are *on* by default, unless user specifies
-    #! -no-<flag> CLI switch
-    "e" off
-    "user-init" on
-    "compile" on
-    "native-io" on
-    macosx? "cocoa" set
-    unix? macosx? not and "x11" set
-    default-shell "shell" set ;
-
-: ignore-cli-args? ( -- ? )
-    #! On Mac OS X, files to run are given to us via a Cocoa API
-    #! so we ignore any command line switches which name files.
-    macosx? "shell" get "ui" = and ;
-
-: parse-command-line ( -- )
-    cli-args [ cli-arg ] subset
-    ignore-cli-args? [ drop ] [ [ run-file ] each ] if
-    "e" get [ eval flush ] when* ;
-
-IN: shells
-
-: none ;
diff --git a/core/collections/arrays.factor b/core/collections/arrays.factor
deleted file mode 100644 (file)
index 264c158..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: arrays
-USING: kernel kernel-internals math math-internals sequences
-sequences-internals ;
-
-M: array clone (clone) ;
-M: array length array-capacity ;
-M: array nth bounds-check nth-unsafe ;
-M: array set-nth bounds-check set-nth-unsafe ;
-M: array nth-unsafe >r >fixnum r> array-nth ;
-M: array set-nth-unsafe >r >fixnum r> set-array-nth ;
-M: array resize resize-array ;
-
-: >array ( seq -- array )
-    [ array? ] [ f <array> ] >sequence ; inline
-
-M: array like drop dup array? [ >array ] unless ;
-
-M: byte-array clone (clone) ;
-M: byte-array length array-capacity ;
-M: byte-array resize resize-array ;
-
-: 1array ( x -- array ) 1 swap <array> ;
-
-: 2array ( x y -- array )
-    2 swap <array> [ 0 swap set-array-nth ] keep ;
-
-: 3array ( x y z -- array )
-    3 swap <array>
-    [ 1 swap set-array-nth ] keep
-    [ 0 swap set-array-nth ] keep ;
-
-: 4array ( x y z t -- array )
-    4 swap <array>
-    [ 2 swap set-array-nth ] keep
-    [ 1 swap set-array-nth ] keep
-    [ 0 swap set-array-nth ] keep ;
diff --git a/core/collections/arrays.facts b/core/collections/arrays.facts
deleted file mode 100644 (file)
index 542a655..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-IN: arrays
-USING: help kernel kernel-internals prettyprint strings
-vectors ;
-
-HELP: array
-{ $description "The class of fixed-length arrays. See " { $link "syntax-arrays" } " for syntax and " { $link "arrays" } " for general information." } ;
-
-HELP: <array> ( n elt -- array )
-{ $values { "n" "a non-negative integer" } { "elt" "an initial element" } { "array" "a new array" } }
-{ $description "Creates a new array with the given length and all elements initially set to " { $snippet "elt" } "." }
-{ $see-also <quotation> <string> <sbuf> <vector> } ;
-
-HELP: >array
-{ $values { "seq" "a sequence" } { "array" "an array" } }
-{ $description "Outputs a freshly-allocated array with the same elements as a given sequence." }
-{ $see-also >string >sbuf >vector >quotation } ;
-
-HELP: 1array
-{ $values { "x" "an object" } { "array" "an array" } }
-{ $description "Create a new array with one element." }
-{ $see-also 2array 3array ch>string } ;
-
-HELP: 2array
-{ $values { "x" "an object" } { "y" "an object" } { "array" "an array" } }
-{ $description "Create a new array with two elements, with " { $snippet "x" } " appearing first." }
-{ $see-also 1array 3array ch>string } ;
-
-HELP: 3array
-{ $values { "x" "an object" } { "y" "an object" } { "z" "an object" } { "array" "an array" } }
-{ $description "Create a new array with three elements, with " { $snippet "x" } " appearing first." }
-{ $see-also 1array 2array ch>string } ;
-
-HELP: 4array
-{ $values { "w" "an object" } { "x" "an object" } { "y" "an object" } { "z" "an object" } { "array" "an array" } }
-{ $description "Create a new array with four elements, with " { $snippet "w" } " appearing first." }
-{ $see-also 1array 2array ch>string } ;
-
-HELP: resize-array ( n array -- newarray )
-{ $values { "n" "a non-negative integer" } { "array" "an array" } { "newarray" "a new array" } }
-{ $description "Creates a new array of " { $snippet "n" } " elements. The contents of the existing array are copied into the new array; if the new array is shorter, only an initial segment is copied, and if the new array is longer the remaining space is filled in with "{ $link f } "." } ;
-
-HELP: byte-array
-{ $description "The class of byte arrays." } ;
-
-HELP: <byte-array> ( n -- byte-array )
-{ $values { "n" "a non-negative integer" } { "byte-array" "a new byte array" } }
-{ $description "Creates a new byte array holding " { $snippet "n" } " bytes." } ;
diff --git a/core/collections/flatten.factor b/core/collections/flatten.factor
deleted file mode 100644 (file)
index 7f3a874..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: sequences
-USING: generic kernel namespaces strings ;
-
-GENERIC: flatten* ( obj -- )
-
-M: object flatten* , ;
-
-M: sequence flatten* [ flatten* ] each ;
-
-M: string flatten* , ;
-
-M: sbuf flatten* , ;
-
-M: wrapper flatten* wrapped flatten* ;
-
-: flatten ( obj -- seq ) [ flatten* ] { } make ;
diff --git a/core/collections/flatten.facts b/core/collections/flatten.facts
deleted file mode 100644 (file)
index 5cfd616..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: help sequences ;
-
-HELP: flatten
-{ $values { "obj" "an object" } { "seq" "a new sequence" } }
-{ $description "Recursively descends into lists, arrays, vectors and wrappers. Leaf elements are collected into a new sequence which is output at the end of the traversal." }
-{ $notes "This word does not descend into virtual sequences, or user-defined sequences." } ;
diff --git a/core/collections/graphs.factor b/core/collections/graphs.factor
deleted file mode 100644 (file)
index 9f73b0b..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: graphs
-USING: hashtables kernel namespaces sequences ;
-
-: if-graph over [ bind ] [ 2drop 2drop ] if ; inline
-
-: (add-vertex) ( vertex edges -- )
-    dupd call [ dupd nest set-hash ] each-with ; inline
-
-: add-vertex ( vertex edges graph -- )
-    [ (add-vertex) ] if-graph ; inline
-
-: build-graph ( seq edges graph -- )
-    [
-        namespace clear-hash
-        swap [ swap (add-vertex) ] each-with
-    ] if-graph ;
-
-: (remove-vertex) ( vertex graph -- ) nest remove-hash ;
-
-: remove-vertex ( vertex edges graph -- )
-    [
-        dupd call [ namespace hash ?remove-hash ] each-with
-    ] if-graph ; inline
-
-: in-edges ( vertex graph -- seq )
-    ?hash dup [ hash-keys ] when ;
-
-SYMBOL: previous
-
-: (closure) ( obj quot -- )
-    over previous get hash-member? [
-        2drop
-    ] [
-        over dup previous get set-hash
-        [ call ] keep swap [ swap (closure) ] each-with
-    ] if ; inline
-
-: closure ( obj quot -- seq )
-    [
-        H{ } clone previous set
-        (closure)
-        previous get hash-keys
-    ] with-scope ; inline
diff --git a/core/collections/graphs.facts b/core/collections/graphs.facts
deleted file mode 100644 (file)
index 2847355..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-IN: graphs
-USING: help ;
-
-HELP: add-vertex
-{ $values { "vertex" "an object" } { "edges" "a quotation with stack effect " { $snippet "( vertex -- seq )" } } { "graph" "a hashtable mapping vertices to sequences of edges" } }
-{ $description "Adds a vertex to a directed graph, using the " { $snippet "edges" } " quotation to generate a sequence of edges leaving the vertex." }
-{ $side-effects "graph" } ;
-
-HELP: build-graph
-{ $values { "seq" "a sequence" } { "edges" "a quotation with stack effect " { $snippet "( vertex -- seq )" } } { "graph" "a hashtable mapping vertices to sequences of edges" } }
-{ $description "Removes all vertices from the graph, then reconstructs it using the given sequence of vertices and quotation to generate a sequence of edges leaving each vertex." }
-{ $side-effects "graph" } ;
-
-HELP: remove-vertex
-{ $values { "vertex" "an object" } { "edges" "a quotation with stack effect " { $snippet "( vertex -- seq )" } } { "graph" "a hashtable mapping vertices to sequences of edges" } }
-{ $description "Removes a vertex from a graph, using the quotation to generate a sequence of edges leaving the vertex." } 
-{ $notes "The " { $snippet "edges" } " quotation must produce the same return value as it did when " { $link add-vertex } " was called, otherwise some vertices of the graph may continue to refer to the removed vertex." }
-{ $side-effects "graph" } ;
-
-HELP: in-edges
-{ $values { "vertex" "an object" } { "graph" "a hashtable mapping vertices to sequences of edges" } { "seq" "a sequence of vertices" } }
-{ $description "Outputs a sequence of vertices incident to an edge entering the given vertex." } ;
-
-HELP: closure
-{ $values { "obj" "an object" } { "quot" "a a quotation with stack effect " { $snippet "( obj -- seq )" } } { "seq" "a new sequence" } }
-{ $description "Outputs a sequence of all vertices reachable from " { $snippet "vertex" } " via edges given by the quotation. This sequence always includes " { $snippet "vertex" } "." } ; 
diff --git a/core/collections/growable.factor b/core/collections/growable.factor
deleted file mode 100644 (file)
index 28a7297..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-
-! Some low-level code used by vectors and string buffers.
-IN: sequences-internals
-USING: errors kernel kernel-internals math math-internals
-sequences ;
-
-GENERIC: underlying ( seq -- underlying )
-GENERIC: set-underlying ( underlying seq -- )
-GENERIC: set-fill ( n seq -- )
-
-: capacity ( seq -- n ) underlying length ; inline
-
-: expand ( len seq -- )
-    [ underlying resize ] keep set-underlying ; inline
-
-: contract ( len seq -- )
-    dup length pick - [
-        [ swap >r + 0 swap r> set-nth-unsafe ] 3keep
-    ] repeat 2drop ;
-
-: new-size ( old -- new ) 1+ 3 * ; inline
-
-: ensure ( n seq -- )
-    2dup length >= [
-        >r 1+ r>
-        2dup capacity > [ over new-size over expand ] when
-        2dup set-fill
-    ] when 2drop ; inline
-
-TUPLE: bounds-error index seq ;
-
-: bounds-error ( n seq -- * ) <bounds-error> throw ;
-
-: growable-check ( n seq -- n seq )
-    over 0 < [ bounds-error ] when ; inline
-
-: bounds-check ( n seq -- n seq )
-    2dup bounds-check? [ bounds-error ] unless ; inline
-
-: grow-length ( n seq -- )
-    growable-check
-    2dup length < [ 2dup contract ] when
-    2dup capacity > [ 2dup expand ] when
-    set-fill ; inline
-
-: clone-resizable ( seq -- newseq )
-    (clone) dup underlying clone over set-underlying ; inline
diff --git a/core/collections/growable.facts b/core/collections/growable.facts
deleted file mode 100644 (file)
index bc25807..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-IN: sequences-internals
-USING: help kernel sequences ;
-
-HELP: set-fill
-{ $values { "n" "a new fill pointer" } { "seq" "a resizable sequence" } }
-{ $contract "Sets the fill pointer (number of occupied elements in the underlying storage) of a resizable sequence." }
-{ $side-effects "seq" }
-{ $warning "This word is in the " { $vocab-link "sequences-internals" } " vocabulary because it is not safe. Changing the fill pointer to a negative value, or a value higher than the underlying sequence length can lead to memory corruption. User code should use " { $link set-length } " instead." } ;
-
-HELP: underlying
-{ $values { "seq" "a resizable sequence" } { "underlying" "the underlying sequence" } }
-{ $contract "Outputs the underlying storage of a resizable sequence." } ;
-
-HELP: set-underlying
-{ $values { "underlying" "a sequence" } { "seq" "a resizable sequence" } }
-{ $contract "Modifies the underlying storage of a resizable sequence." }
-{ $warning "This word is in the " { $vocab-link "sequences-internals" } " vocabulary because it is not safe. Setting an underlying sequence shorter than the fill pointer can lead to memory corruption." } ;
-
-HELP: capacity
-{ $values { "seq" "a vector or string buffer" } { "n" "the capacity of the sequence" } }
-{ $description "Outputs the number of elements the sequence can hold without growing." } ;
-
-HELP: new-size
-{ $values { "old" "a positive integer" } { "new" "a positive integer" } }
-{ $description "Computes the new size of a resizable sequence." } ;
-
-HELP: ensure
-{ $values { "n" "a positive integer" } { "seq" "a resizable sequence" } }
-{ $description "If " { $snippet "n" } " is less than the length of the sequence, does nothing. Otherwise, if " { $snippet "n" } " also exceeds the capacity of the underlying storage, the underlying storage is grown, and the fill pointer is reset. Finally, if " { $snippet "n" } " is greater than or equal to the length but less than the capacity of the underlying storage, the fill pointer is moved and nothing else is done."
-$terpri
-"This word is used in the implementation of the " { $link set-nth } " generic for sequences supporting the resizable sequence protocol (see " { $link "sequences-resizable" } ")."
-} ;
-
-HELP: bounds-error
-{ $values { "n" "a positive integer" } { "seq" "a sequence" } }
-{ $description "Throws a " { $link bounds-error } "." }
-{ $error-description "Thrown by " { $link nth } ", " { $link set-nth } " and " { $link set-length } " if the given index lies beyond the bounds of the sequence." } ;
-
-HELP: bounds-check
-{ $values { "n" "a positive integer" } { "seq" "a sequence" } }
-{ $description "Throws an error if " { $snippet "n" } " is negative or if it is greater than or equal to the length of " { $snippet "seq" } ". Otherwise the two inputs remain on the stack." } ;
-
-HELP: grow-length
-{ $values { "n" "a positive integer" } { "seq" "a sequence" } }
-{ $description "An implementation of the " { $link set-length } " generic for sequences supporting the resizable sequence protocol (see " { $link "sequences-resizable" } ")." } ;
-
-HELP: clone-resizable
-{ $values { "seq" "a resizable sequence" } { "newseq" "a fresh sequence" } }
-{ $description "An implementation of the " { $link clone } " generic for sequences supporting the resizable sequence protocol (see " { $link "sequences-resizable" } ")." } ;
diff --git a/core/collections/hashtables.factor b/core/collections/hashtables.factor
deleted file mode 100644 (file)
index e1c262f..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: hashtables-internals
-USING: arrays hashtables kernel kernel-internals math
-math-internals sequences sequences-internals vectors ;
-
-TUPLE: tombstone ;
-
-: ((empty)) T{ tombstone f } ; inline
-: ((tombstone)) T{ tombstone t } ; inline
-
-: hash@ ( key array -- i )
-    >r hashcode r> array-capacity 2 /i rem 2 * >fixnum ; inline
-
-: probe ( array i -- array i )
-    2 fixnum+fast over array-capacity fixnum-mod ; inline
-
-: (key@) ( key keys i -- n )
-    #! cond form expanded by hand for better interpreter speed
-    3dup swap array-nth dup ((tombstone)) eq? [
-        2drop probe (key@)
-    ] [
-        dup ((empty)) eq? [
-            2drop 3drop -1
-        ] [
-            = [ 2nip ] [ probe (key@) ] if
-        ] if
-    ] if ; inline
-
-: key@ ( key hash -- i )
-    hash-array 2dup hash@ (key@) ; inline
-
-: if-key ( key hash true false -- )
-    >r >r [ key@ ] 2keep pick -1 > r> r> if ; inline
-
-: <hash-array> ( n -- array )
-    >fixnum 1+ 4 * ((empty)) <array> ; inline
-
-: init-hash ( hash -- )
-    0 over set-hash-count 0 swap set-hash-deleted ;
-
-: reset-hash ( n hash -- )
-    swap <hash-array> over set-hash-array init-hash ;
-
-: (new-key@) ( key keys i -- n )
-    #! cond form expanded by hand for better interpreter speed
-    3dup swap array-nth dup ((empty)) eq? [
-        2drop 2nip
-    ] [
-        = [
-            2nip
-        ] [
-            probe (new-key@)
-        ] if
-    ] if ; inline
-
-: new-key@ ( key hash -- i )
-    hash-array 2dup hash@ (new-key@) ; inline
-
-: nth-pair ( n seq -- key value )
-    [ array-nth ] 2keep >r 1+ r> array-nth ; inline
-
-: set-nth-pair ( value key n seq -- )
-    [ set-array-nth ] 2keep >r 1+ r> set-array-nth ; inline
-
-: hash-count+ ( hash -- )
-    dup hash-count 1+ swap set-hash-count ; inline
-
-: hash-deleted+ ( hash -- )
-    dup hash-deleted 1+ swap set-hash-deleted ; inline
-
-: change-size ( hash old -- )
-    ((empty)) eq? [ hash-count+ ] [ drop ] if ; inline
-
-: (set-hash) ( value key hash -- )
-    2dup new-key@ swap
-    [ hash-array 2dup array-nth ] keep
-    swap change-size set-nth-pair ; inline
-
-: (each-pair) ( quot array i -- )
-    over array-capacity over eq? [
-        3drop
-    ] [
-        [
-            swap nth-pair over tombstone?
-            [ 3drop ] [ rot call ] if
-        ] 3keep 2 fixnum+fast (each-pair)
-    ] if ; inline
-
-: each-pair ( array quot -- )
-    swap 0 (each-pair) ; inline
-
-: (all-pairs?) ( quot array i -- ? )
-    over array-capacity over eq? [
-        3drop t
-    ] [
-        3dup >r >r >r swap nth-pair over tombstone? [
-            3drop r> r> r> 2 fixnum+fast (all-pairs?)
-        ] [
-            rot call [
-                r> r> r> 2 fixnum+fast (all-pairs?)
-            ] [
-                r> r> r> 3drop f
-            ] if
-        ] if
-    ] if ; inline
-
-: all-pairs? ( array quot -- ? )
-    swap 0 (all-pairs?) ; inline
-
-: (hash-keys/values) ( hash quot -- accum array )
-    >r
-    hash-array [ length 2 /i <vector> ] keep
-    r> each-pair { } like ; inline
-
-IN: hashtables
-
-: <hashtable> ( n -- hash )
-    (hashtable) [ reset-hash ] keep ;
-
-: hash* ( key hash -- value ? )
-    [
-        nip >r 1 fixnum+fast r> hash-array array-nth t
-    ] [
-        3drop f f
-    ] if-key ;
-
-: hash-member? ( key hash -- ? )
-    [ 3drop t ] [ 3drop f ] if-key ;
-
-: ?hash* ( key hash/f -- value/f ? )
-    dup [ hash* ] [ 2drop f f ] if ;
-
-: hash ( key hash -- value ) hash* drop ; inline
-
-: ?hash ( key hash/f -- value )
-    dup [ hash ] [ 2drop f ] if ;
-
-: clear-hash ( hash -- )
-    dup init-hash hash-array [ drop ((empty)) ] inject ;
-
-: remove-hash ( key hash -- )
-    [
-        nip
-        dup hash-deleted+
-        hash-array >r >r ((tombstone)) dup r> r> set-nth-pair
-    ] [
-        3drop
-    ] if-key ;
-
-: remove-hash* ( key hash -- old )
-    [ hash ] 2keep remove-hash ;
-
-: ?remove-hash ( key hash -- )
-    [ remove-hash ] [ drop ] if* ;
-
-: hash-size ( hash -- n )
-    dup hash-count swap hash-deleted - ; inline
-
-: hash-empty? ( hash -- ? ) hash-size zero? ;
-
-: grow-hash ( hash -- )
-    [ dup hash-array swap hash-size 1+ ] keep
-    [ reset-hash ] keep swap [ swap pick (set-hash) ] each-pair
-    drop ;
-
-: ?grow-hash ( hash -- )
-    dup hash-count 1 fixnum+fast 3 fixnum*
-    over hash-array array-capacity >
-    [ grow-hash ] [ drop ] if ; inline
-
-: set-hash ( value key hash -- )
-    dup ?grow-hash (set-hash) ;
-
-: hash+ ( n key hash -- )
-    [ hash [ 0 ] unless* + ] 2keep set-hash ;
-
-: associate ( value key -- hash )
-    2 <hashtable> [ set-hash ] keep ;
-
-: hash-keys ( hash -- seq )
-    [ drop over push ] (hash-keys/values) ;
-
-: hash-values ( hash -- seq )
-    [ nip over push ] (hash-keys/values) ;
-
-: hash>alist ( hash -- alist )
-    dup hash-keys swap hash-values 2array flip ;
-
-: alist>hash ( alist -- hash )
-    [ length <hashtable> ] keep
-    [ first2 swap pick (set-hash) ] each ;
-
-: hash-each ( hash quot -- )
-    >r hash-array r> each-pair ; inline
-
-: hash-each-with ( obj hash quot -- )
-    swap [ 2swap [ >r -rot r> call ] 2keep ] hash-each 2drop ;
-    inline
-
-: hash-all? ( hash quot -- ? )
-    >r hash-array r> all-pairs? ; inline
-
-: hash-all-with? ( obj hash quot -- )
-    swap
-    [ 2swap [ >r -rot r> call ] 2keep rot ] hash-all? 2nip ;
-    inline
-
-: subhash? ( hash1 hash2 -- ? )
-    swap [
-        >r swap hash* [ r> = ] [ r> 2drop f ] if
-    ] hash-all-with? ;
-
-: hash-subset ( hash quot -- subhash )
-    over hash-size <hashtable> rot [
-        2swap [
-            >r pick pick >r >r call [
-                r> r> swap r> set-hash
-            ] [
-                r> r> r> 3drop
-            ] if
-        ] 2keep
-    ] hash-each nip ; inline
-
-: hash-subset-with ( obj hash quot -- subhash )
-    swap
-    [ 2swap [ >r -rot r> call ] 2keep rot ] hash-subset 2nip ;
-    inline
-
-M: hashtable clone
-    (clone) dup hash-array clone over set-hash-array ;
-
-: hashtable= ( hash hash -- ? )
-    2dup subhash? >r swap subhash? r> and ;
-
-M: hashtable equal?
-    {
-        { [ over hashtable? not ] [ 2drop f ] }
-        { [ 2dup [ hash-size ] 2apply number= not ] [ 2drop f ] }
-        { [ t ] [ hashtable= ] }
-    } cond ;
-
-: hashtable-hashcode ( hashtable -- n )
-    0 swap [
-        hashcode >r hashcode -1 shift r> bitxor bitxor
-    ] hash-each ;
-
-M: hashtable hashcode
-    dup hash-size 1 number=
-    [ hashtable-hashcode ] [ hash-size ] if ;
-
-: ?hash ( key hash/f -- value/f )
-    dup [ hash ] [ 2drop f ] if ;
-
-: ?hash* ( key hash/f -- value/f ? )
-    dup [ hash* ] [ 2drop f f ] if ;
-
-IN: hashtables-internals
-
-: (hash-stack) ( key i seq -- value )
-    over 0 < [
-        3drop f
-    ] [
-        3dup nth-unsafe dup [
-            hash* [
-                >r 3drop r>
-            ] [
-                drop >r 1- r> (hash-stack)
-            ] if
-        ] [
-            2drop >r 1- r> (hash-stack)
-        ] if
-    ] if ;
-
-IN: hashtables
-
-: hash-stack ( key seq -- value )
-    dup length 1- swap (hash-stack) ;
-
-: hash-intersect ( hash1 hash2 -- intersection )
-    [ drop swap hash ] hash-subset-with ;
-
-: hash-diff ( hash1 hash2 -- difference )
-    [ drop swap hash not ] hash-subset-with ;
-
-: hash-update ( hash1 hash2 -- )
-    [ swap rot set-hash ] hash-each-with ;
-
-: hash-union ( hash1 hash2 -- union )
-    >r clone dup r> hash-update ;
-
-: remove-all ( hash seq -- subseq )
-    [ swap hash-member? not ] subset-with ;
-
-: cache ( key hash quot -- value )
-    pick pick hash [
-        >r 3drop r>
-    ] [
-        pick rot >r >r call dup r> r> set-hash
-    ] if* ; inline
-
-: map>hash ( seq quot -- hash )
-    over length <hashtable> rot
-    [ -rot [ >r call swap r> set-hash ] 2keep ] each nip ;
-    inline
diff --git a/core/collections/hashtables.facts b/core/collections/hashtables.facts
deleted file mode 100644 (file)
index 789aeeb..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-IN: hashtables
-USING: hashtables-internals help tools kernel prettyprint ;
-
-HELP: hashtable
-{ $description "The class of hashtables. See " { $link "syntax-hashtables" } " for syntax and " { $link "hashtables" } " for general information." } ;
-
-HELP: hash@
-{ $values { "key" "a key" } { "array" "the underlying array of a hashtable" } { "i" "the index to begin hashtable search" } }
-{ $description "Computes the index to begin searching from the hashcode of the key. Always outputs an even value since keys are stored at even indices of the underlying array." } ;
-
-HELP: probe
-{ $values { "array" "the underlying array of a hashtable" } { "i" "a search index" } }
-{ $description "Outputs the next hashtable search index." } ;
-
-HELP: key@
-{ $values { "key" "a key" } { "hash" "a hashtable" } { "i" "the index of the key, or -1 if it is not present" } }
-{ $description "Searches the hashtable for the key using a linear probing strategy. Searches stop if either the key or an " { $link ((empty)) } " sentinel is found. Searches skip the " { $link ((tombstone)) } " sentinel." }
-{ $see-also new-key@ } ;
-
-HELP: new-key@
-{ $values { "key" "a key" } { "hash" "a hashtable" } { "i" "the index where the key would be stored" } }
-{ $description "Searches the hashtable for the key using a linear probing strategy. If the key is not present in the hashtable, outputs the index where it should be stored." }
-{ $see-also new-key@ } ;
-
-HELP: if-key
-{ $values { "key" "a key" } { "hash" "a hashtable" } { "true" "a quotation to call if the key is found, with stack effect " { $snippet "( true: index key hash -- )" } } { "false" "a quotation to call if the key is not found" } }
-{ $description "Searches the hashtable for the key, calling one of the two quotations depending on the outcome." } ;
-
-HELP: nth-pair
-{ $values { "n" "an index in the sequence" } { "seq" "a sequence" } { "key" "the first element of the pair" } { "value" "the second element of the pair" } }
-{ $description "Fetches the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
-{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because it does not perform bounds checks." }
-{ $see-also set-nth-pair } ;
-
-HELP: set-nth-pair
-{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "n" "an index in the sequence" } { "seq" "a sequence" } }
-{ $description "Stores a pair of values into the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
-{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because it does not perform bounds checks." }
-{ $side-effects "seq" }
-{ $see-also nth-pair } ;
-
-HELP: each-pair
-{ $values { "array" "an array of pairs" } { "quot" "a quotation with stack effect " { $snippet "( key value -- )" } } }
-{ $description "Applies a quotation to successive pairs in the array." }
-{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because passing an array of odd length can lead to memory corruption." } ;
-
-HELP: all-pairs?
-{ $values { "array" "an array of pairs" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "?" "conjunction of quotation outputs" } }
-{ $description "Applies a predicate quotation to successive pairs in the array, and outputs true if the array is empty or if the quotation yields true for each pair." }
-{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because passing an array of odd length can lead to memory corruption." } ;
-
-HELP: reset-hash
-{ $values { "n" "a positive integer specifying hashtable capacity" } { "hash" "a hashtable" } }
-{ $description "Resets the underlying array of the hashtable to a new array with the given capacity. Removes all entries from the hashtable." }
-{ $side-effects "hash" } ;
-
-HELP: hash-count+
-{ $values { "hash" "a hashtable" } }
-{ $description "Called to increment the hashtable size when a new entry is added with " { $link set-hash } }
-{ $side-effects "hash" } ;
-
-HELP: hash-deleted+
-{ $values { "hash" "a hashtable" } }
-{ $description "Called to increment the deleted entry counter when an entry is removed with " { $link remove-hash } }
-{ $side-effects "hash" } ;
-
-HELP: change-size
-{ $values { "hash" "a hashtable" } { "old" "the key about to be overwritten" } }
-{ $description "Called to update the hashtable counters when a new entry is added with " { $link set-hash } "." }
-{ $side-effects "hash" } ;
-
-HELP: (set-hash)
-{ $values { "value" "a value" } { "key" "a key to add" } { "hash" "a hashtable" } }
-{ $description "Stores the key/value pair into the hashtable. This word does not grow the hashtable if it exceeds capacity, therefore a hang can result. User code should use " { $link set-hash } " instead, which grows the hashtable if necessary." }
-{ $side-effects "hash" } ;
-
-HELP: grow-hash
-{ $values { "hash" "a hashtable" } }
-{ $description "Enlarges the capacity of a hashtable. User code does not need to call this word directly." }
-{ $see-also (set-hash) ?grow-hash set-hash }
-{ $side-effects "hash" } ;
-
-HELP: ?grow-hash
-{ $values { "hash" "a hashtable" } }
-{ $description "Enlarges the capacity of a hashtable if it is almost full. User code does not need to call this word directly." }
-{ $see-also (set-hash) grow-hash set-hash }
-{ $side-effects "hash" } ;
-
-HELP: <hashtable>
-{ $values { "n" "a positive integer specifying hashtable capacity" } { "hash" "a new hashtable" } }
-{ $description "Create a new hashtable capable of storing " { $snippet "n" } " key/value pairs before growing." }
-{ $see-also clear-hash hash-size hash-empty? } ;
-
-HELP: (hashtable) ( -- hash )
-{ $values { "hash" "a new hashtable" } }
-{ $description "Allocates a hashtable stub object without an underlying array. User code should call " { $link <hashtable> } " instead." } ;
-
-HELP: associate
-{ $values { "value" "a value" } { "key" "a key" } }
-{ $description "Create a new hashtable holding one key/value pair." } ;
-
-HELP: clear-hash
-{ $values { "hash" "a hashtable" } }
-{ $description "Removes all entries from the hashtable."  }
-{ $see-also remove-hash }
-{ $side-effects "hash" } ;
-
-HELP: hash-size
-{ $values { "hash" "a hashtable" } { "n" "a non-negative integer" } }
-{ $description "Outputs the number of entries stored in the hashtable." } ;
-
-HELP: hash-empty?
-{ $values { "hash" "a hashtable" } { "?" "a boolean" } }
-{ $description "Tests if the hashtable does not contain any entries." } ;
-
-HELP: hash*
-{ $values { "key" "an object to look up in the hashtable" } { "hash" "a hashtable" } { "value" "the value associated to the key, or " { $link f } " if the key is not present in the hashtable" } { "?" "a boolean indicating if the key was present" } }
-{ $description "Looks up the value associated with a key. The boolean flag can decide between the case of a missing value, and a value of " { $link f } "." }
-{ $see-also hash-member? hash ?hash ?hash* } ;
-
-HELP: hash-member?
-{ $values { "key" "an object to look up in the hashtable" } { "hash" "a hashtable" } }
-{ $description "Tests if the hashtable contains a key/value pair whose key is equal to the given key." }
-{ $see-also hash hash* ?hash ?hash* } ;
-
-HELP: ?hash*
-{ $values { "key" "an object to look up in the hashtable" } { "hash/f" "a hashtable or " { $link f } } }
-{ $description "A variant of " { $link hash* } " overloaded to return " { $link f } " if the given mapping is " { $link f } "."  }
-{ $see-also hash-member? hash hash* ?hash } ;
-
-HELP: hash
-{ $values { "key" "an object to look up in the hashtable" } { "hash" "a hashtable" } { "value" "the value associated to the key, or " { $link f } " if the key is not present in the hashtable" } }
-{ $description "Looks up the value associated with a key. No distinction is made between a missing value and a value set to " { $link f } "." }
-{ $see-also hash-member? hash* ?hash ?hash* } ;
-
-HELP: ?hash
-{ $values { "key" "an object to look up in the hashtable" } { "hash/f" "a hashtable or " { $link f } } { "value" "the value associated to the key, or " { $link f } " if the key is not present in the hashtable" } }
-{ $description "A variant of " { $link hash } " overloaded to return " { $link f } " if the given mapping is " { $link f } "."  }
-{ $see-also hash-member? hash hash* hash ?hash* } ;
-
-HELP: remove-hash
-{ $values { "key" "a key" } { "hash" "a hashtable" } }
-{ $description "Removes an entry from the hashtable." }
-{ $side-effects "hash" }
-{ $see-also clear-hash } ;
-
-HELP: remove-hash*
-{ $values { "key" "a key" } { "hash" "a hashtable" } { "old" "the previous value or " { $link f } } }
-{ $description "Stores an entry into the hashtable." }
-{ $side-effects "hash" }
-{ $see-also hash remove-hash } ;
-
-HELP: set-hash
-{ $values { "value" "a value" } { "key" "a key to add" } { "hash" "a hashtable" } }
-{ $description "Stores the key/value pair into the hashtable." }
-{ $side-effects "hash" } ;
-
-HELP: hash-keys
-{ $values { "hash" "a hashtable" } { "keys" "an array of keys" } }
-{ $description "Outputs an array of all keys in the hashtable." }
-{ $see-also hash-values hash>alist alist>hash } ;
-
-HELP: hash-values
-{ $values { "hash" "a hashtable" } { "values" "an array of values" } }
-{ $description "Outputs an array of all values in the hashtable." }
-{ $see-also hash-keys hash>alist alist>hash } ;
-
-HELP: hash>alist
-{ $values { "hash" "a hashtable" } { "alist" "an array of key/value pairs" } }
-{ $description "Outputs an array of all key/value pairs in the hashtable. Each pair is itself a two-element array." }
-{ $see-also hash-keys hash-values alist>hash } ;
-
-HELP: alist>hash
-{ $values { "alist" "a sequence of key/value pairs" } { "hash" "a hashtable" } }
-{ $description "Constructs a hashtable from a sequence of key/value pairs, where each pair is a two-element sequence. In the case of duplicate keys, later pairs take precedence." }
-{ $see-also hash-keys hash-values hash>alist } ;
-
-HELP: hash-each
-{ $values { "hash" "a hashtable" } { "quot" "a quotation with stack effect " { $snippet "( key value -- )" } } }
-{ $description "Applies a quotation to each key/value pair in the hashtable." } ;
-
-HELP: hash-each-with
-{ $values { "obj" "an object" } { "hash" "a hashtable" } { "quot" "a quotation with stack effect " { $snippet "( obj key value -- )" } } }
-{ $description "Variant of " { $link hash-each } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: hash-all?
-{ $values { "hash" "a hashtable" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "?" "a boolean" } }
-{ $description "Applies a predicate quotation to each key/value pair in the hashtable. Outputs true if the hashtable is empty or the quotation yields true for each entry." } ;
-
-HELP: hash-all-with?
-{ $values { "obj" "an object" } { "hash" "a hashtable" } { "quot" "a quotation with stack effect " { $snippet "( obj key value -- ? )" } } { "?" "a boolean" } }
-{ $description "Variant of " { $link hash-all? } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: hash-subset
-{ $values { "hash" "a hashtable" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "subhash" "a new hashtable" } }
-{ $description "Constructs a hashtable consisting of all key/value pairs for which the predicate quotation yields true." } ;
-
-HELP: hash-subset-with
-{ $values { "obj" "an object" } { "hash" "a hashtable" } { "quot" "a quotation with stack effect " { $snippet "( obj key value -- ? )" } } { "subhash" "a new hashtable" } }
-{ $description "Variant of " { $link hash-all? } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: subhash?
-{ $values { "hash1" "a hashtable" } { "hash2" "a hashtable" } { "?" "a new hashtable" } }
-{ $description "Tests if " { $snippet "hash2" } " contains all key/value pairs of " { $snippet "hash1" } "." } ;
-
-HELP: hash-stack
-{ $values { "key" "a key" } { "seq" "a sequence of hashtables" } { "value" "a value or " { $link f } } }
-{ $description "Looks up the key in every hashtable in the sequence, search from back to front. If the key could not be found, outputs " { $link f } ". This word is used to implement abstractions such as nested scopes; if the sequence is a stack represented by a vector, then the most recently pushed hashtable -- the innermost scope -- will be searched first." } ;
-
-HELP: hash-intersect
-{ $values { "hash1" "a hashtable" } { "hash2" "a hashtable" } { "intersection" "a new hashtable" } }
-{ $description "Constructs a hashstable consisting of all key/value pairs from " { $snippet "hash2" } " such that the key is also present in " { $snippet "hash1" } "." }
-{ $notes "The values of the keys in " { $snippet "hash1" } " are disregarded, so this word is usually used for set-theoretic calculations where the hashtable in question either has dummy sentinels as values, or the values equal the keys." } ;
-
-HELP: hash-diff
-{ $values { "hash1" "a hashtable" } { "hash2" "a hashtable" } { "difference" "a new hashtable" } }
-{ $description "Constructs a hashstable consisting of all key/value pairs from " { $snippet "hash2" } " such that the key is not present in " { $snippet "hash1" } "" }
-{ $notes "The values of the keys in " { $snippet "hash1" } " are disregarded, so this word is usually used for set-theoretic calculations where the hashtable in question either has dummy sentinels as values, or the values equal the keys." } ;
-
-HELP: hash-update
-{ $values { "hash1" "a hashtable" } { "hash2" "a hashtable" } }
-{ $description "Adds all key/value pairs from " { $snippet "hash2" } " to " { $snippet "hash1" } "." }
-{ $side-effects "hash1" } ;
-
-HELP: hash-union
-{ $values { "hash1" "a hashtable" } { "hash2" "a hashtable" } { "union" "a new hashtable" } }
-{ $description "Constructs a hashstable consisting of all key/value pairs from " { $snippet "hash1" } " and " { $snippet "hash2" } ", with entries from " { $snippet "hash2" } " taking precedence." }
-{ $notes "The values of the keys in " { $snippet "hash1" } " are disregarded, so this word is usually used for set-theoretic calculations where the hashtable in question either has dummy sentinels as values, or the values equal the keys." } ;
-
-HELP: remove-all
-{ $values { "hash" "a hashtable" } { "seq" "a sequence" } { "subseq" "a new sequence" } }
-{ $description "Constructs a sequence consisting of all elements from the sequence that appear as keys in the hashtable." }
-{ $notes "The values of the keys in the hashtable are disregarded, so this word is usually used for set-theoretic calculations where the hashtable in question either has dummy sentinels as values, or the values equal the keys." } ;
-
-HELP: cache
-{ $values { "key" "a key" } { "hash" "a hashtable" } { "quot" "a quotation with stack effect " { $snippet "( key -- value )" } } { "value" "a previously-retained or freshly-computed value" } }
-{ $description "If the key is present in the hashtable, outputs the associated value, otherwise calls the quotation to produce a value and stores the key/value pair into the hashtable." }
-{ $side-effects "hash" } ;
-
-HELP: map>hash
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( key -- value )" } } { "hash" "a hashtable" } { "value" "a previously-retained or freshly-computed value" } }
-{ $description "Applies the quotation to each element of the sequence to produce a value corresponding to each key, and constructs a new hashtable from these key/value pairs." } ;
diff --git a/core/collections/namespaces.factor b/core/collections/namespaces.factor
deleted file mode 100644 (file)
index 9f4e592..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: kernel-internals
-USING: vectors sequences ;
-
-: namestack* ( -- namestack )
-    3 getenv { vector } declare ; inline
-: >n ( namespace -- ) namestack* push ;
-: n> ( -- namespace ) namestack* pop ;
-
-IN: namespaces
-USING: arrays hashtables kernel kernel-internals math strings
-words ;
-
-: namestack ( -- namestack ) namestack* clone ; inline
-: set-namestack ( namestack -- ) >vector 3 setenv ; inline
-: namespace ( -- namespace ) namestack* peek ;
-: ndrop ( -- ) namestack* pop* ;
-: global ( -- g ) 4 getenv { hashtable } declare ; inline
-: get ( variable -- value ) namestack* hash-stack ;
-: set ( value variable -- ) namespace set-hash ; inline
-: on ( variable -- ) t swap set ; inline
-: off ( variable -- ) f swap set ; inline
-: get-global ( variable -- value ) global hash ; inline
-: set-global ( value variable -- ) global set-hash ; inline
-
-: nest ( variable -- namespace )
-    dup namespace hash [ ] [ >r H{ } clone dup r> set ] ?if ;
-
-: change ( variable quot -- )
-    >r dup get r> rot slip set ; inline
-
-: +@ ( n variable -- ) [ [ 0 ] unless* + ] change ;
-
-: inc ( variable -- ) 1 swap +@ ; inline
-
-: dec ( variable -- ) -1 swap +@ ; inline
-
-: bind ( ns quot -- ) swap >n call ndrop ; inline
-
-: counter ( variable -- n ) global [ dup inc get ] bind ;
-
-: make-hash ( quot -- hash ) H{ } clone >n call n> ; inline
-
-: with-scope ( quot -- ) H{ } clone >n call ndrop ; inline
-
-! Building sequences
-SYMBOL: building
-
-: make ( quot exemplar -- seq )
-    >r
-    [ V{ } clone building set call building get ] with-scope
-    r> like ; inline
-
-: , ( elt -- ) building get push ;
-
-: % ( seq -- ) building get swap nappend ;
-
-: init-namespaces ( -- ) global 1array set-namestack ;
-
-IN: sequences
-
-: join ( seq glue -- newseq )
-    [ swap [ % ] [ dup % ] interleave drop ] over make ;
diff --git a/core/collections/namespaces.facts b/core/collections/namespaces.facts
deleted file mode 100644 (file)
index b276325..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-IN: namespaces
-USING: help kernel kernel-internals sequences words ;
-
-HELP: get
-{ $values { "variable" "a variable, by convention a symbol" } { "value" "the value, or " { $link f } } }
-{ $description "Searches the namestack for a namespace containing the variable, and outputs the associated value. If no such namespace is found, outputs " { $link f } "." } ;
-
-HELP: set
-{ $values { "value" "the new value" } { "variable" "a variable, by convention a symbol" } }
-{ $description "Assigns a value to the variable in the namespace at the top of the namestack." }
-{ $side-effects "variable" } ;
-
-HELP: off
-{ $values { "variable" "a variable, by convention a symbol" } }
-{ $description "Assigns a value of " { $link f } " to the variable." }
-{ $side-effects "variable" } ;
-
-HELP: on
-{ $values { "variable" "a variable, by convention a symbol" } }
-{ $description "Assigns a value of " { $link t } " to the variable." }
-{ $side-effects "variable" } ;
-
-HELP: change
-{ $values { "variable" "a variable, by convention a symbol" } { "quot" "a quotation with stack effect " { $snippet "( old -- new )" } } }
-{ $description "Applies the quotation to the old value of the variable, and assigns the resulting value to the variable." }
-{ $side-effects "variable" } ;
-
-HELP: +@
-{ $values { "n" "a number" } { "variable" "a variable, by convention a symbol" } }
-{ $description "Adds " { $snippet "n" } " to the value of the variable. A variable value of " { $link f } " is interpreted as being zero." }
-{ $side-effects "variable" }
-{ $examples
-    { $example "SYMBOL: foo\n1 foo +@\n10 foo +@\nfoo get ." "11" }
-} ;
-
-HELP: inc
-{ $values { "variable" "a variable, by convention a symbol" } }
-{ $description "Increments the value of the variable by 1. A variable value of " { $link f } " is interpreted as being zero." }
-{ $side-effects "variable" } ;
-
-HELP: dec
-{ $values { "variable" "a variable, by convention a symbol" } }
-{ $description "Decrements the value of the variable by 1. A variable value of " { $link f } " is interpreted as being zero." }
-{ $side-effects "variable" } ;
-
-HELP: counter
-{ $values { "variable" "a variable, by convention a symbol" } }
-{ $description "Increments the value of the variable by 1, and returns its new value." }
-{ $notes "This word is useful for generating (somewhat) unique identifiers. For example, the " { $link gensym } " word uses it." }
-{ $side-effects "variable" } ;
-
-HELP: with-scope
-{ $values { "quot" "a quotation" } }
-{ $description "Calls the quotation in a new namespace. Any variables set by the quotation are discarded when it returns." } ;
-
-HELP: make-hash
-{ $values { "quot" "a quotation" } { "hash" "a new hashtable" } }
-{ $description "Calls the quotation in a new namespace, and outputs this namespace when the quotation returns. Useful for quickly building hashtables." } ;
-
-HELP: bind
-{ $values { "ns" "a hashtable" } { "quot" "a quotation" } }
-{ $description "Calls the quotation in the dynamic scope of " { $snippet "ns" } ". When variables are looked up by the quotation, " { $snippet "ns" } " is checked first, and setting variables in the quotation stores them in " { $snippet "ns" } "." } ;
-
-HELP: namespace
-{ $values { "ns" "a hashtable" } }
-{ $description "Outputs the current namespace. Calls to " { $link set } " modify this namespace." } ;
-
-HELP: global
-{ $values { "ns" "a hashtable" } }
-{ $description "Outputs the global namespace. The global namespace is always checked last when looking up variable values." } ;
-
-HELP: set-global
-{ $values { "value" "the new value" } { "variable" "a variable, by convention a symbol" } }
-{ $description "Assigns a value to the variable in the global namespace." }
-{ $side-effects "variable" } ;
-
-HELP: nest
-{ $values { "variable" "a variable, by convention a symbol" } { "namespace" "a hashtable" } }
-{ $description "If the variable is not set in the current namespace, sets it to a new hashtable, and outputs this hashtable. Otherwise, outputs the existing value (which should probably be a hashtable)." }
-{ $side-effects "variable" } ;
-
-HELP: namestack*
-{ $values { "namestack" "a vector" } }
-{ $description "Outputs the current namestack." } ;
-
-HELP: namestack
-{ $values { "namestack" "a vector" } }
-{ $description "Outputs a copy of the current namestack." } ;
-
-HELP: set-namestack
-{ $values { "namestack" "a vector" } }
-{ $description "Replaces the namestack with a copy of the given vector." } ;
-
-HELP: >n
-{ $values { "namespace" "a hashtable" } }
-{ $description "Pushes a namespace on the namestack." } ;
-
-HELP: n>
-{ $values { "namespace" "a hashtable" } }
-{ $description "Pops a namespace from the namestack." } ;
-
-HELP: make
-{ $values { "quot" "a quotation" } { "exemplar" "a sequence" } }
-{ $description "Calls the quotation in a new " { $emphasis "dynamic scope" } ". The quotation and any words it calls can execute the " { $link , } " and " { $link % } " words to accumulate elements. When the quotation returns, all accumulated elements are collected into a sequence with the same type as " { $snippet "exemplar" } "." }
-{ $examples { $example "[ 1 , 2 , 3 , ] { } make ." "{ 1 2 3 }" } } ;
-
-HELP: ,
-{ $values { "elt" "an object" } }
-{ $description "Adds an element to the end of the sequence being constructed by " { $link make } "." } ;
-
-HELP: %
-{ $values { "seq" "a sequence" } }
-{ $description "Appends a sequence to the end of the sequence being constructed by " { $link make } "." } ;
-
-HELP: init-namespaces
-{ $description "Resets the name stack to its initial state, holding a single copy of the global namespace. This word is called during startup and is rarely useful, except in certain situations such as the example below." }
-{ $examples
-    "You can use this word to spawn a new thread which does not inherit the parent thread's name stack:"
-    { $code "[ init-namestack do-some-work ] in-thread" }
-} ;
-
-HELP: join
-{ $values { "seq" "a sequence" } { "glue" "a sequence" } { "newseq" "a sequence" } }
-{ $description "Concatenates a sequence of sequences together into one sequence, placing a copy of " { $snippet "glue" } " between each pair of sequences. The resulting sequence is of the same class as " { $snippet "glue" } "." }
-{ $errors "Throws an error if one of the sequences in " { $snippet "seq" } " contains elements not permitted in sequences of the same class as " { $snippet "glue" } "." }
-{ $see-also concat } ;
diff --git a/core/collections/queues.factor b/core/collections/queues.factor
deleted file mode 100644 (file)
index 195ade0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: queues
-USING: errors kernel ;
-
-TUPLE: entry obj next ;
-
-C: entry ( obj -- entry ) [ set-entry-obj ] keep ;
-
-TUPLE: queue head tail ;
-
-C: queue ( -- queue ) ;
-
-: queue-empty? ( queue -- ? ) queue-head not ;
-
-: clear-queue ( queue -- )
-    f over set-queue-head f swap set-queue-tail ;
-
-: (enque) ( entry queue -- )
-    [ set-queue-head ] 2keep set-queue-tail ;
-
-: enque ( elt queue -- )
-    >r <entry> r> dup queue-empty? [
-        (enque)
-    ] [
-        [ queue-tail set-entry-next ] 2keep set-queue-tail
-    ] if ;
-
-: (deque) ( queue -- )
-    dup queue-head over queue-tail eq? [
-        clear-queue
-    ] [
-        dup queue-head entry-next swap set-queue-head
-    ] if ;
-
-TUPLE: empty-queue ;
-: empty-queue ( -- * ) <empty-queue> throw ;
-
-: deque ( queue -- elt )
-    dup queue-empty? [
-        empty-queue
-    ] [
-        dup queue-head entry-obj >r (deque) r>
-    ] if ;
diff --git a/core/collections/queues.facts b/core/collections/queues.facts
deleted file mode 100644 (file)
index 76a5ff0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-IN: queues
-USING: help ;
-
-HELP: queue
-{ $class-description "A simple first-in-first-out queue. See " { $link "queues" } "." } ;
-
-HELP: <queue>
-{ $values { "queue" "a new queue" } }
-{ $description "Makes a new queue with no elements." } ;
-
-HELP: queue-empty?
-{ $values { "queue" "a queue" } { "?" "a boolean" } }
-{ $description "Tests if a queue contains no elements." } ;
-
-HELP: deque
-{ $values { "queue" "a queue" } { "elt" "an object" } }
-{ $description "Removes an element from the front of the queue." }
-{ $errors "Throws an " { $link empty-queue } " error if the queue has no entries." } ;
-
-HELP: enque
-{ $values { "elt" "an object" } { "queue" "a queue" } }
-{ $description "Adds an element to the back of the queue." } ;
-
-HELP: empty-queue
-{ $description "Throws an " { $link empty-queue } " error." }
-{ $error-description "Thrown by " { $link deque } " if the queue has no entries." } ;
diff --git a/core/collections/sbuf.factor b/core/collections/sbuf.factor
deleted file mode 100644 (file)
index 26096a7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: strings
-USING: kernel math strings sequences-internals sequences ;
-
-: <sbuf> ( n -- sbuf )
-    0 <string> string>sbuf 0 over set-fill ;
-
-M: sbuf set-length grow-length ;
-M: sbuf nth-unsafe underlying nth-unsafe ;
-M: sbuf nth bounds-check nth-unsafe ;
-M: sbuf set-nth-unsafe underlying set-nth-unsafe ;
-M: sbuf set-nth growable-check 2dup ensure set-nth-unsafe ;
-M: sbuf clone clone-resizable ;
-M: sbuf new drop <sbuf> ;
-: >sbuf ( seq -- sbuf ) [ sbuf? ] [ <sbuf> ] >sequence ; inline
-
-M: sbuf like
-    drop dup sbuf? [
-        dup string? [ string>sbuf ] [ >sbuf ] if
-    ] unless ;
diff --git a/core/collections/sbuf.facts b/core/collections/sbuf.facts
deleted file mode 100644 (file)
index ccf6834..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-IN: strings
-USING: arrays help kernel vectors ;
-
-HELP: sbuf
-{ $description "The class of resizable character strings. See " { $link "syntax-sbufs" } " for syntax and " { $link "sbufs" } " for general information." } ;
-
-HELP: <sbuf>
-{ $values { "n" "a positive integer specifying initial capacity" } { "sbuf" "a new string buffer" } }
-{ $description "Creates a new string buffer that can hold " { $snippet "n" } " characters before resizing." }
-{ $see-also <array> <quotation> <string> <vector> } ;
-
-HELP: >sbuf
-{ $values { "seq" "a sequence of non-negative integers" } { "sbuf" "a string buffer" } }
-{ $description "Outputs a freshly-allocated string buffer with the same elements as a given sequence." }
-{ $errors "Throws an error if the sequence contains elements other than real numbers." } ;
diff --git a/core/collections/sequence-combinators.factor b/core/collections/sequence-combinators.factor
deleted file mode 100644 (file)
index 26ab7d8..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: sequences-internals
-USING: arrays generic kernel kernel-internals math sequences
-vectors ;
-
-: collect ( n quot -- array )
-    >r [ f <array> ] keep r> swap [
-        [ rot >r [ swap call ] keep r> set-array-nth ] 3keep
-    ] repeat drop ; inline
-
-: (map) ( seq quot i -- quot seq value )
-    -rot [ >r nth-unsafe r> call ] 2keep rot ; inline
-
-: (2each) ( quot seq seq i -- quot seq seq i )
-    [ 2nth-unsafe rot dup slip ] 3keep ; inline
-
-: (2map) ( quot seq seq i -- quot seq seq value )
-    pick pick >r >r 2nth-unsafe rot dup slip
-    swap r> swap r> swap ; inline
-
-: (monotonic) ( quot seq i -- ? )
-    2dup 1+ swap nth-unsafe >r swap nth-unsafe r> rot call ;
-    inline
-
-: (interleave) ( n -- array )
-    dup zero? [
-        drop { }
-    ] [
-        t <array> f 0 pick set-nth-unsafe
-    ] if ;
-
-: map>array ( seq quot -- array )
-    over length [ (map) ] collect 2nip ; inline
-
-IN: sequences
-
-: each ( seq quot -- )
-    swap dup length [
-        [ swap nth-unsafe swap call ] 3keep
-    ] repeat 2drop ; inline
-
-: each-with ( obj seq quot -- )
-    swap [ with ] each 2drop ; inline
-
-: reduce ( seq identity quot -- result )
-    swapd each ; inline
-
-: map ( seq quot -- newseq ) over >r map>array r> like ; inline
-
-: map-with ( obj list quot -- newseq )
-    swap [ with rot ] map 2nip ; inline
-
-: accumulate ( seq identity quot -- final newseq )
-    rot [ pick >r swap call r> ] map-with ; inline
-
-: change-nth ( i seq quot -- )
-    -rot [ nth swap call ] 2keep set-nth ; inline
-
-: inject ( seq quot -- )
-    over length
-    [ [ -rot change-nth ] 3keep ] repeat 2drop ;
-    inline
-
-: inject-with ( obj seq quot -- )
-    swap [ with rot ] inject 2drop ; inline
-
-: min-length ( seq1 seq2 -- n )
-    [ length ] 2apply min ;
-
-: max-length ( seq1 seq2 -- n )
-    [ length ] 2apply max ;
-
-: 2each ( seq1 seq2 quot -- )
-    -rot 2dup min-length [ (2each) ] repeat 3drop ; inline
-
-: 2reduce ( seq seq identity quot -- result )
-    >r -rot r> 2each ; inline
-
-: 2map ( seq1 seq2 quot -- newseq )
-    -rot
-    [ 2dup min-length [ (2map) ] collect ] keep like
-    >r 3drop r> ; inline
-
-: if-bounds ( i seq quot quot -- )
-    >r pick pick bounds-check? r> [ 3drop -1 f ] if ; inline
-
-: find* ( n seq quot -- i elt )
-    [
-        3dup >r >r >r >r nth-unsafe r> call [
-            r> dup r> nth-unsafe r> drop
-        ] [
-            r> 1+ r> r> find*
-        ] if
-    ] if-bounds ; inline
-
-: find-with* ( obj n seq quot -- i elt )
-    -rot [ with rot ] find* 2swap 2drop ; inline
-
-: find ( seq quot -- i elt )
-    0 -rot find* ; inline
-
-: find-with ( obj seq quot -- i elt )
-    swap [ with rot ] find 2swap 2drop ; inline
-
-: find-last* ( n seq quot -- i elt )
-    [
-        3dup >r >r >r >r nth-unsafe r> call [
-            r> dup r> nth-unsafe r> drop
-        ] [
-            r> 1- r> r> find-last*
-        ] if
-    ] if-bounds ; inline
-
-: find-last-with* ( obj n seq quot -- i elt )
-    -rot [ with rot ] find-last* 2swap 2drop ; inline
-
-: find-last ( seq quot -- i elt )
-    >r [ length 1- ] keep r> find-last* ; inline
-
-: find-last-with ( obj seq quot -- i elt )
-    swap [ with rot ] find-last 2swap 2drop ; inline
-
-: contains? ( seq quot -- ? )
-    find drop -1 > ; inline
-
-: contains-with? ( obj seq quot -- ? )
-    find-with drop -1 > ; inline
-
-: all? ( seq quot -- ? )
-    swap [ swap call not ] contains-with? not ; inline
-
-: all-with? ( obj seq quot -- ? )
-    swap [ with rot ] all? 2nip ; inline
-
-: subset* ( flags seq -- subseq )
-    [
-        dup length <vector>
-        [ swap [ over push ] [ drop ] if ] 2reduce
-    ] keep like ; inline
-
-: subset ( seq quot -- subseq )
-    over >r map>array r> subset* ; inline
-
-: subset-with ( obj seq quot -- subseq )
-    swap [ with rot ] subset 2nip ; inline
-
-: monotonic? ( seq quot -- ? )
-    swap dup length 1- [
-        pick pick >r >r (monotonic) r> r> rot
-    ] all? 2nip ; inline
-
-: interleave ( seq quot between -- )
-    rot dup length (interleave) [
-        [ -rot [ -rot 2slip call ] 2keep ]
-        [ -rot [ drop call ] 2keep ]
-        if
-    ] 2each 2drop ; inline
-
-: cache-nth ( i seq quot -- elt )
-    pick pick ?nth dup [
-        >r 3drop r>
-    ] [
-        drop swap >r over >r call dup r> r> set-nth
-    ] if ; inline
-
-: copy-into-check ( n dest src -- n dest src )
-    pick 0 < [ >r bounds-error r> ] when
-    pick over length + pick 2dup length >
-    [ set-length ] [ 2drop ] if ; inline
-
-: copy-into ( n dest src -- )
-    copy-into-check dup length
-    [ >r pick r> + pick set-nth-unsafe ] 2each 2drop ;
-    inline
-
-: >sequence ( seq pred quot -- newseq )
-    pick rot call [
-        drop clone
-    ] [
-        over >r >r length r> call 0 over r> copy-into
-    ] if ; inline
diff --git a/core/collections/sequence-combinators.facts b/core/collections/sequence-combinators.facts
deleted file mode 100644 (file)
index 7a48426..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-IN: sequences
-USING: arrays help math sequences-internals ;
-
-HELP: collect
-{ $values { "n" "a non-negative integer" } { "quot" "a quotation with stack effect " { $snippet "( n -- value )" } } { "array" "an array with " { $snippet "n" } " elements" } }
-{ $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" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- )" } } }
-{ $description "Applies the quotation to each element of the sequence in turn." } ;
-
-HELP: each-with
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- )" } } }
-{ $description "Variant of " { $link each } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: reduce
-{ $values { "seq" "a sequence" } { "identity" "an object" } { "quot" "a quotation with stack effect " { $snippet "( 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 "{ 1 5 3 } 0 [ + ] reduce ." "9" }
-} ;
-
-HELP: accumulate
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( prev elt -- next )" } } { "final" "the final result" } { "newseq" "a new sequence" } }
-{ $description "Combines successive elements of the sequence using a binary operation, and outputs a sequence of intermediate results together with 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. Given the empty sequence, outputs a one-element sequence consisting of " { $snippet "identity" } "." }
-{ $examples
-    { $example "{ 2 2 2 2 2 } 0 [ + ] accumulate . ." "{ 0 2 4 6 8 }\n10" }
-} ;
-
-HELP: map
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( old -- new )" } } { "newseq" "a new sequence" } }
-{ $description "Applies the quotation to each element yielding a new element. The new elements are collected into a sequence of the same class as the input sequence." } ;
-
-HELP: map-with
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- new )" } } { "newseq" "a new sequence" } }
-{ $description "Variant of " { $link map } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: change-nth
-{ $values { "i" "a non-negative integer" } { "seq" "a mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( 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: inject
-{ $values { "seq" "a mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( old -- new )" } } }
-{ $description "Applies the quotation to each element yielding a new element, storing the new elements back in 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" } ;
-
-HELP: inject-with
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- new )" } } }
-{ $description "Variant of " { $link inject } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: min-length
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "n" "a non-negative integer" } }
-{ $description "Outputs the minimum of the lengths of the two sequences." } ;
-
-HELP: max-length
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "n" "a non-negative integer" } }
-{ $description "Outputs the maximum of the lengths of the two sequences." } ;
-
-HELP: 2each
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt1 elt2 -- )" } } }
-{ $description "Applies the quotation to pairs of elements from " { $snippet "seq1" } " and " { $snippet "seq2" } "." }
-{ $notes "If one sequence is shorter than the other, than only the prefix having the length of the minimum of the two is examined." } ;
-
-HELP: 2reduce
-{ $values { "seq1" "a sequence" }
-          { "seq2" "a sequence" }
-          { "identity" "an object" }
-          { "quot" "a quotation with stack effect "
-                   { $snippet "( 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" } "." }
-{ $examples "The " { $link v. } " word provides a particularly elegant implementation of the dot product." }
-{ $notes "If one sequence is shorter than the other, then only the prefix having the length of the minimum of the two is examined." } ;
-
-HELP: 2map
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt1 elt2 -- new )" } } { "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" } "." }
-{ $see-also v+ v- v* v/ }
-{ $notes "If one sequence is shorter than the other, than only the prefix having the length of the minimum of the two is examined." } ;
-
-HELP: find
-{ $values { "seq" "a sequence" }
-          { "quot" "a quotation with stack effect "
-                   { $snippet "( elt -- ? )" } }
-          { "i" "the index of the first match, or -1" }
-          { "elt" "the first matching element, or " { $link f } } }
-{ $description "A simpler variant of " { $link find* } " where the starting index is 0." } ;
-
-HELP: find-with
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- ? )" } } { "i" "the index of the first match, or -1" } { "elt" "the first matching element, or " { $link f } } }
-{ $description "Variant of " { $link find } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: find*
-{ $values { "n" "a starting index" }
-          { "seq" "a sequence" }
-          { "quot" "a quotation with stack effect "
-                   { $snippet "( elt -- ? )" } }
-          { "i" "the index of the first match, or -1" }
-          { "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 -1 and " { $link f } " as the element." } ;
-
-HELP: find-with*
-{ $values { "obj" "an object" } { "n" "a starting index" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- ? )" } } { "i" "the index of the first match, or -1" } { "elt" "the first matching element, or " { $link f } } }
-{ $description "Variant of " { $link find* } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: find-last
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "i" "the index of the first match, or -1" } { "elt" "the first matching element, or " { $link f } } }
-{ $description "A simpler variant of " { $link find-last* } " where the starting index is one less than the length of the sequence." } ;
-
-HELP: find-last-with
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- ? )" } } { "i" "the index of the first match, or -1" } { "elt" "the first matching element, or " { $link f } } }
-{ $description "Variant of " { $link find } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: find-last*
-{ $values { "n" "a starting index" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "i" "the index of the first match, or -1" } { "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 -1 and " { $link f } " as the element." } ;
-
-HELP: find-last-with*
-{ $values { "obj" "an object" } { "n" "a starting index" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- ? )" } } { "i" "the index of the first match, or -1" } { "elt" "the first matching element, or " { $link f } } }
-{ $description "Variant of " { $link find } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: contains?
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( 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: contains-with?
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- ? )" } } { "?" "a boolean" } }
-{ $description "Variant of " { $link contains? } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: all?
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( 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 } "." }
-{ $notes
-    "The implementation makes use of a well-known logical identity:" 
-    $terpri
-    { $snippet "P[x] for all x <==> not ((not P[x]) for some x)" }
-} ;
-
-HELP: all-with?
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- ? )" } } { "?" "a boolean" } }
-{ $description "Variant of " { $link all? } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: subset*
-{ $values { "flags" "a sequence" } { "seq" "a sequence" } { "subseq" "a new sequence" } }
-{ $description "Outputs a new sequence containing all elements of " { $snippet "seq" } " such that the corresponding element of " { $snippet "flags" } " is not equal to " { $link f } "." }
-{ $examples
-    { $example "{ t f t f } { 1 2 3 4 } subset* ." "{ 1 3 }" }
-} ;
-
-HELP: subset
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( 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: subset-with
-{ $values { "obj" "an object" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- ? )" } } { "subseq" "a new sequence" } }
-{ $description "Variant of " { $link subset } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: monotonic?
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt elt -- ? )" } } { "?" "a boolean" } }
-{ $description "Applies the relation to successive pairs of elements in the sequence, testing for a truth value. The relation should be a transitive relation, such as a total order or an equality relation." }
-{ $examples
-    "Testing if a sequence is non-decreasing:"
-    { $example "{ 1 1 2 } [ <= ] monotonic? ." "t" }
-    "Testing if a sequence is decreasing:"
-    { $example "{ 9 8 6 7 } [ < ] monotonic? ." "f" }
-}
-{ $see-also all-eq? all-equal? } ;
-
-HELP: interleave
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- )" } } { "between" "a quotation" } }
-{ $description "Applies " { $snippet "quot" } " to each element in turn, also invoking " { $snippet "between" } " in-between each pair of elements." }
-{ $example "{ \"a\" \"b\" \"c\" } [ write ] [ \"X\" write ] interleave" "aXbXc" } ;
-
-HELP: cache-nth
-{ $values { "i" "a non-negative integer" } { "seq" "a mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( i -- elt )" } } }
-{ $description "If the sequence does not contain at least " { $snippet "i" } " elements or if the " { $snippet "i" } "th element of the sequence is " { $link f } ", calls the quotation to produce a new value, and stores it back into the sequence. Otherwise, this word outputs the " { $snippet "i" } "th element of the sequence." }
-{ $side-effects "seq" } ;
-
-HELP: copy-into
-{ $values { "n" "an index in " { $snippet "dest" } } { "dest" "a mutable sequence" } { "src" "a sequence" } }
-{ $description "Copies all elements of " { $snippet "src" } " to " { $snippet "dest" } ", with destination indices starting from " { $snippet "n" } ". Grows " { $snippet "to" } " first if necessary." }
-{ $errors "An error is thrown if " { $snippet "to" } " is not resizable, and not large enough to hold the copied elements." } ;
-
-HELP: >sequence
-{ $values { "seq" "a sequence" } { "pred" "a quotation with stack effect " { $snippet "( seq -- ? )" } } { "quot" "a quotation with stack effect " { $snippet "( n -- newseq )" } } { "newseq" "a new sequence" } }
-{ $description "If " { $snippet "pred" } " answers a true value given " { $snippet "seq" } ", clones " { $snippet "seq" } ". Otherwise, calls " { $snippet "quot" } " with the length of " { $snippet "seq" } ", creating a new sequence, and copies the contents of " { $snippet "seq" } " into the new sequence." }
-{ $notes "This word is used to implement words which convert one type of sequence into another, for example " { $link >array } "." } ;
diff --git a/core/collections/sequence-sort.factor b/core/collections/sequence-sort.factor
deleted file mode 100644 (file)
index b74c525..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-IN: sequences-internals
-USING: arrays generic kernel math sequences ;
-
-: midpoint@ length 2 /i ; inline
-
-: midpoint [ midpoint@ ] keep nth-unsafe ; inline
-
-TUPLE: sorter seq start end mid ;
-
-C: sorter ( seq start end -- sorter )
-    [ >r 1+ rot <slice> r> set-sorter-seq ] keep
-    dup sorter-seq midpoint over set-sorter-mid
-    dup sorter-seq length 1- over set-sorter-end
-    0 over set-sorter-start ; inline
-
-: s*/e* dup sorter-start swap sorter-end ; inline
-: s*/e dup sorter-start swap sorter-seq length 1- ; inline
-: s/e* 0 swap sorter-end ; inline
-: sorter-exchange dup s*/e* rot sorter-seq exchange-unsafe ; inline
-: compare over sorter-seq nth-unsafe swap sorter-mid rot call ; inline
-: >start> dup sorter-start 1+ swap set-sorter-start ; inline
-: <end< dup sorter-end 1- swap set-sorter-end ; inline
-
-: sort-up ( quot sorter -- )
-    dup s*/e < [
-        [ dup sorter-start compare 0 < ] 2keep rot
-        [ dup >start> sort-up ] [ 2drop ] if
-    ] [
-        2drop
-    ] if ; inline
-
-: sort-down ( quot sorter -- )
-    dup s/e* < [
-        [ dup sorter-end compare 0 > ] 2keep rot
-        [ dup <end< sort-down ] [ 2drop ] if
-    ] [
-        2drop
-    ] if ; inline
-
-: sort-step ( quot sorter -- )
-    dup s*/e* <= [
-        2dup sort-up 2dup sort-down dup s*/e* <= [
-            dup sorter-exchange dup >start> dup <end< sort-step
-        ] [
-            2drop
-        ] if
-    ] [
-        2drop
-    ] if ; inline
-
-: (nsort) ( quot seq start end -- )
-    2dup < [
-        <sorter> 2dup sort-step
-        [ dup sorter-seq swap s/e* (nsort) ] 2keep
-        [ dup sorter-seq swap s*/e (nsort) ] 2keep
-    ] [
-        2drop
-    ] if 2drop ; inline
-
-: partition ( -1/1 seq -- seq )
-    dup midpoint@ rot 1 < [ head-slice ] [ tail-slice ] if ;
-    inline
-
-: (binsearch) ( elt quot seq -- i )
-    dup length 1 <= [
-        2nip slice-from
-    ] [
-        3dup >r >r >r midpoint swap call dup zero? [
-            r> r> 3drop r> dup slice-from swap slice-to + 2 /i
-        ] [
-            r> swap r> swap r> partition (binsearch)
-        ] if
-    ] if ; inline
-
-: flatten-slice ( seq -- slice )
-    #! Binsearch returns an index relative to the sequence
-    #! being sliced, so if we are given a slice as input,
-    #! unexpected behavior will result.
-    dup slice? [ >array ] when 0 over length rot <slice> ;
-    inline
-
-IN: sequences
-
-: nsort ( seq quot -- )
-    swap dup length 1 <=
-    [ 2drop ] [ 0 over length 1- (nsort) ] if ; inline
-
-: sort ( seq quot -- sortedseq )
-    swap [ >array [ swap nsort ] keep ] keep like ; inline
-
-: natural-sort ( seq -- sortedseq ) [ <=> ] sort ;
-
-: sort-keys ( alist -- alist )
-    [ [ first ] 2apply <=> ] sort ;
-
-: sort-values ( alist -- alist )
-    [ [ second ] 2apply <=> ] sort ;
-
-: binsearch ( elt seq quot -- i )
-    swap dup empty?
-    [ 3drop -1 ] [ flatten-slice (binsearch) ] if ; inline
-
-: binsearch* ( elt seq quot -- result )
-    over >r binsearch dup -1 = [ r> 2drop f ] [ r> nth ] if ;
-    inline
diff --git a/core/collections/sequence-sort.facts b/core/collections/sequence-sort.facts
deleted file mode 100644 (file)
index 93405fc..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-IN: sequences
-USING: help kernel words ;
-
-HELP: sort
-{ $values { "seq" "a sequence" } { "quot" "a comparator quotation" } { "sortedseq" "a new sorted sequence" } }
-{ $description "Sorts the elements into a new sequence of the same class as " { $snippet "seq" } "." } ;
-
-HELP: sort-keys
-{ $values { "seq" "a sequence of pairs" } { "sortedseq" "a new sorted sequence" } }
-{ $description "Sorts the elements comparing first elements of pairs using the " { $link <=> } " word." } ;
-
-HELP: sort-values
-{ $values { "seq" "a sequence of pairs" } { "sortedseq" "a new sorted sequence" } }
-{ $description "Sorts the elements comparing second elements of pairs using the " { $link <=> } " word." } ;
-
-HELP: nsort
-{ $values { "seq" "a mutable sequence" } { "quot" "a comparator quotation" } }
-{ $description "Sorts the sequence in-place." }
-{ $side-effects "seq" } ;
-
-HELP: natural-sort
-{ $values { "seq" "a sequence of real numbers" } { "sortedseq" "a new sorted sequence" } }
-{ $description "Sorts a sequence of objects in natural order using the " { $link <=> } " word." } ;
-
-HELP: binsearch
-{ $values { "elt" "an object" } { "seq" "a sorted sequence" } { "quot" "a comparator quotation" } { "i" "the index of the search result" } }
-{ $description "Given a sequence that is sorted with respect to the " { $snippet "quot" } " comparator, searches for an element equal to " { $snippet "elt" } ", or failing that, the greatest element smaller than " { $snippet "elt" } ". Comparison is performed with " { $snippet "quot" } "."
-$terpri
-"Outputs -1 if the sequence is empty. If the sequence has at least one element, this word always outputs a valid index." } ;
-
-HELP: binsearch*
-{ $values { "elt" "an object" } { "seq" "a sorted sequence" } { "quot" "a comparator quotation" } { "result" "the search result" } }
-{ $description "Variant of " { $link binsearch } " which outputs the found element rather than its index in the sequence."
-$terpri
-"Outputs " { $link f } " if the sequence is empty. If the sequence has at least one element, this word always outputs a sequence element." } ;
diff --git a/core/collections/sequences-epilogue.factor b/core/collections/sequences-epilogue.factor
deleted file mode 100644 (file)
index b868a1e..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: sequences
-USING: arrays errors generic kernel kernel-internals math
-sequences-internals strings vectors words ;
-
-: first2 ( seq -- first second )
-    1 swap bounds-check nip first2-unsafe ;
-
-: first3 ( seq -- first second third )
-    2 swap bounds-check nip first3-unsafe ;
-
-: first4 ( seq -- first second third fourth )
-    3 swap bounds-check nip first4-unsafe ;
-
-: index ( obj seq -- n )
-    [ = ] find-with drop ;
-
-: index* ( obj i seq -- n )
-    [ = ] find-with* drop ;
-
-: last-index ( obj seq -- n )
-    [ = ] find-last-with drop ;
-
-: last-index* ( obj i seq -- n )
-    [ = ] find-last-with* drop ;
-
-: member? ( obj seq -- ? )
-    [ = ] contains-with? ;
-
-: memq? ( obj seq -- ? )
-    [ eq? ] contains-with? ;
-
-: remove ( obj seq -- newseq )
-    [ = not ] subset-with ;
-
-: (subst) ( newseq oldseq elt -- new/elt )
-    [ swap index ] keep
-    over -1 > [ drop swap nth ] [ 2nip ] if ;
-
-: subst ( newseq oldseq seq -- )
-    [ >r 2dup r> (subst) ] inject 2drop ;
-
-: move ( m n seq -- )
-    pick pick number=
-    [ 3drop ] [ [ nth swap ] keep set-nth ] if ; inline
-
-: (delete) ( elt store scan seq -- elt store scan seq )
-    2dup length < [
-        3dup move
-        [ nth pick = ] 2keep rot
-        [ >r >r 1+ r> r> ] unless >r 1+ r> (delete)
-    ] when ;
-
-: delete ( elt seq -- ) 0 0 rot (delete) nip set-length drop ;
-
-: push-new ( elt seq -- ) [ delete ] 2keep push ;
-
-: prune ( seq -- newseq )
-    [ V{ } clone swap [ over push-new ] each ] keep like ;
-
-: nappend ( dest src -- )
-    >r [ length ] keep r> copy-into ; inline
-
-: ((append)) ( seq1 seq2 accum -- accum )
-    [ >r over length r> rot copy-into ] keep
-    [ 0 swap rot copy-into ] keep ; inline
-
-: (3append) ( seq1 seq2 seq3 exemplar -- newseq )
-    [
-        >r pick length pick length pick length + + r> new
-        [ >r pick length pick length + r> rot copy-into ] keep
-        ((append))
-    ] keep like ;
-
-: 3append ( seq1 seq2 seq3 -- newseq )
-    pick (3append) ; inline
-
-: (append) ( seq1 seq2 exemplar -- newseq )
-    [
-        >r over length over length + r> new ((append))
-    ] keep like ;
-
-: append ( seq1 seq2 -- newseq )
-    over (append) ; inline
-
-: add ( seq elt -- newseq ) 1array append ; inline
-
-: add* ( seq elt -- newseq ) 1array swap dup (append) ; inline
-
-: concat ( seq -- newseq )
-    dup empty? [
-        [ 0 [ length + ] accumulate ] keep
-        rot over first new -rot
-        [ >r over r> copy-into ] 2each
-    ] unless ;
-
-: diff ( seq1 seq2 -- newseq )
-    [ swap member? not ] subset-with ;
-
-: peek ( seq -- elt ) dup length 1- swap nth ;
-
-: pop* ( seq -- ) dup length 1- swap set-length ;
-
-: pop ( seq -- elt )
-    dup length 1- swap [ nth ] 2keep set-length ;
-
-: all-equal? ( seq -- ? ) [ = ] monotonic? ;
-
-: all-eq? ( seq -- ? ) [ eq? ] monotonic? ;
-
-: (mismatch) ( seq1 seq2 n -- i )
-    [ >r 2dup r> 2nth-unsafe = not ] find drop 2nip ; inline
-
-: mismatch ( seq1 seq2 -- i )
-    2dup min-length (mismatch) ;
-
-: flip ( matrix -- newmatrix )
-    dup empty? [
-        dup first [ length [ <column> dup like ] map-with ] keep
-        like
-    ] unless ;
-
-: unpair ( assoc -- keys values )
-    flip dup empty? [ drop { } { } ] [ first2 ] if ;
-
-: exchange ( m n seq -- )
-    pick over bounds-check 2drop 2dup bounds-check 2drop
-    exchange-unsafe ;
-
-: assoc ( key assoc -- value ) 
-    [ first = ] find-with nip second ;
-
-: rassoc ( value assoc -- key ) 
-    [ second = ] find-with nip first ;
-
-: last/first ( seq -- pair ) dup peek swap first 2array ;
-
-: padding ( seq n elt -- newseq )
-    >r swap length [-] r> <array> ;
-
-: pad-left ( seq n elt -- padded )
-    pick >r pick >r padding r> append r> like ;
-
-: pad-right ( seq n elt -- padded )
-    pick >r padding r> swap append ;
-
-: sequence= ( seq1 seq2 -- ? )
-    2dup [ length ] 2apply tuck number=
-    [ (mismatch) -1 number= ] [ 3drop f ] if ; inline
-
-M: array equal?
-    over array? [ sequence= ] [ 2drop f ] if ;
-
-M: quotation equal?
-    over quotation? [ sequence= ] [ 2drop f ] if ;
-
-M: sbuf equal?
-    over sbuf? [ sequence= ] [ 2drop f ] if ;
-
-M: vector equal?
-    over vector? [ sequence= ] [ 2drop f ] if ;
-
-UNION: sequence array string sbuf vector quotation ;
-
-M: sequence hashcode
-    dup empty? [ drop 0 ] [ first hashcode ] if ;
-
-IN: kernel
-
-M: object <=>
-    2dup mismatch dup -1 =
-    [ drop [ length ] 2apply - ] [ 2nth-unsafe <=> ] if ;
-
-: depth ( -- n ) datastack length ;
-
-TUPLE: no-cond ;
-: no-cond ( -- * ) <no-cond> throw ;
-
-: cond ( assoc -- )
-    [ first call ] find nip dup [ second call ] [ no-cond ] if ;
-
-: unix? ( -- ? )
-    os { "freebsd" "linux" "macosx" "solaris" } member? ;
diff --git a/core/collections/sequences-epilogue.facts b/core/collections/sequences-epilogue.facts
deleted file mode 100644 (file)
index 4c4f402..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-IN: sequences
-USING: help kernel ;
-
-HELP: first2
-{ $values { "seq" "a sequence" } { "first" "the first element" } { "second" "the second element" } }
-{ $description "Pushes the first two elements of a sequence." }
-{ $errors "Throws an error if the sequence has less than two elements." } ;
-
-HELP: first3
-{ $values { "seq" "a sequence" } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } }
-{ $description "Pushes the first three elements of a sequence." }
-{ $errors "Throws an error if the sequence has less than three elements." } ;
-
-HELP: first4
-{ $values { "seq" "a sequence" } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } { "fourth" "the fourth element" } }
-{ $description "Pushes the first four elements of a sequence." }
-{ $errors "Throws an error if the sequence has less than four elements." } ;
-
-HELP: index
-{ $values { "obj" "an object" } { "seq" "a sequence" } }
-{ $description "Outputs the index of the first element in the sequence equal to " { $snippet "obj" } ". If no element is found, outputs -1." }
-{ $see-also index* member? } ;
-
-HELP: index*
-{ $values { "obj" "an object" } { "i" "a start index" } { "seq" "a sequence" } }
-{ $description "Outputs the index of the first element in the sequence equal to " { $snippet "obj" } ", starting the search from the " { $snippet "i" } "th element. If no element is found, outputs -1." }
-{ $see-also index member? } ;
-
-HELP: last-index
-{ $values { "obj" "an object" } { "seq" "a sequence" } }
-{ $description "Outputs the index of the last element in the sequence equal to " { $snippet "obj" } "; the sequence is traversed back to front. If no element is found, outputs -1." }
-{ $see-also index* member? } ;
-
-HELP: last-index*
-{ $values { "obj" "an object" } { "i" "a start index" } { "seq" "a sequence" } }
-{ $description "Outputs the index of the last element in the sequence equal to " { $snippet "obj" } ", traversing the sequence backwards starting from the " { $snippet "i" } "th element and finishing at the first. If no element is found, outputs -1." }
-{ $see-also index member? } ;
-
-HELP: member?
-{ $values { "obj" "an object" } { "seq" "a sequence" } }
-{ $description "Tests if the sequence contains an element equal to the object." }
-{ $see-also index index* memq? } ;
-
-HELP: memq?
-{ $values { "obj" "an object" } { "seq" "a sequence" } }
-{ $description "Tests if the sequence contains the object." }
-{ $examples
-    "This word uses identity comparison, so the following will most likely print " { $link f } ":"
-    { $example "\"hello\" { \"hello\" } memq? ." "f" }
-}
-{ $see-also index index* member? } ;
-
-HELP: remove
-{ $values { "elt" "an object" } { "seq" "a sequence" } { "newseq" "a new sequence" } }
-{ $description "Outputs a new sequence containing all elements of the input sequence except those equal to the given element." } ;
-
-HELP: subst
-{ $values { "newseq" "a sequence" } { "oldseq" "a mutable sequence" } { "seq" "a sequence" } }
-{ $description "Searches for every element of " { $snippet "seq" } " in " { $snippet "oldseq" } "; if a match is found, the element is replaced by the element of " { $snippet "oldseq" } " at the same index." }
-{ $side-effects "seq" } ;
-
-HELP: move
-{ $values { "m" "an index in " { $snippet "seq" } } { "n" "an index in " { $snippet "seq" } } { "seq" "a mutable sequence" } }
-{ $description "Sets the element with index " { $snippet "m" } " to the element with index " { $snippet "n" } "." }
-{ $side-effects "seq" } ;
-
-HELP: delete
-{ $values { "elt" "an object" } { "seq" "a resizable mutable sequence" } }
-{ $description "Removes all elements equal to " { $snippet "elt" } " from " { $snippet "seq" } "." }
-{ $side-effects "seq" } ;
-
-HELP: push-new
-{ $values { "elt" "an object" } { "seq" "a resizable mutable sequence" } }
-{ $description "Removes all elements equal to " { $snippet "elt" } ", and adds " { $snippet "elt" } " at the end of the sequence." }
-{ $examples
-    { $example
-        "V{ \"beans\" \"salsa\" \"cheese\" } \"v\" set"
-        "\"nachos\" \"v\" get push-new"
-        "\"salsa\" \"v\" get push-new"
-        "\"v\" get ."
-        "V{ \"beans\" \"cheese\" \"nachos\" \"salsa\" }"
-    }
-}
-{ $side-effects "seq" }
-{ $see-also push } ;
-
-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" } "." } ;
-
-HELP: nappend
-{ $values { "dest" "a resizable mutable sequence" } { "src" "a sequence" } }
-{ $description "Appends " { $snippet "src" } " to the end of " { $snippet "dest" } "." }
-{ $side-effects "dest" }
-{ $errors "Throws an error if " { $snippet "src" } " contains elements not permitted in " { $snippet "dest" } "." } ;
-
-HELP: add
-{ $values { "seq" "a sequence" } { "elt" "an object" } { "newseq" "a sequence" } }
-{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the end of " { $snippet "seq" } "." }
-{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." }
-{ $examples
-    { $example "{ 1 2 3 } 4 add ." "{ 1 2 3 4 }" }
-} ;
-
-HELP: add*
-{ $values { "seq" "a sequence" } { "elt" "an object" } { "newseq" "a sequence" } }
-{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the beginning of " { $snippet "seq" } "." }
-{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." } 
-{ $examples
-    { $example "{ 1 2 3 } 0 add* ." "{ 0 1 2 3 }" }
-} ;
-
-HELP: diff
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "newseq" "a sequence" } }
-{ $description "Outputs a sequence consisting of elements present in " { $snippet "seq2" } " but not " { $snippet "seq1" } ", comparing elements for equality." } ;
-
-HELP: append
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "newseq" "a sequence" } }
-{ $description "Outputs a new sequence of the same type as " { $snippet "seq1" } " consisting of the elements of " { $snippet "seq1" } " followed by " { $snippet "seq2" } "." }
-{ $errors "Throws an error if " { $snippet "seq2" } " contains elements not permitted in sequences of the same class as " { $snippet "seq1" } "." } ;
-
-HELP: 3append
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "seq3" "a sequence" } { "newseq" "a sequence" } }
-{ $description "Outputs a new sequence consisting of the elements of " { $snippet "seq1" } ", " { $snippet "seq2" } " and " { $snippet "seq3" } " in turn." }
-{ $errors "Throws an error if " { $snippet "seq2" } " or " { $snippet "seq3" } " contain elements not permitted in sequences of the same class as " { $snippet "seq1" } "." } ;
-
-HELP: concat
-{ $values { "seq" "a sequence" } { "newseq" "a sequence" } }
-{ $description "Concatenates a sequence of sequences together into one sequence. The resulting sequence is of the same class as the first element of " { $snippet "seq" } "." }
-{ $errors "Throws an error if one of the sequences in " { $snippet "seq" } " contains elements not permitted in sequences of the same class as the first element of " { $snippet "seq" } "." }
-{ $see-also join } ;
-
-HELP: peek
-{ $values { "seq" "a sequence" } { "elt" "an object" } }
-{ $description "Outputs the last element of a sequence." }
-{ $errors "Throws an error if the sequence is empty." }
-{ $see-also pop* pop } ;
-
-HELP: pop*
-{ $values { "seq" "a resizable mutable sequence" } }
-{ $description "Removes the last element and shortens the sequence." }
-{ $side-effects "seq" }
-{ $errors "Throws an error if the sequence is empty." }
-{ $see-also peek pop } ;
-
-HELP: pop
-{ $values { "seq" "a resizable mutable sequence" } { "elt" "an object" } }
-{ $description "Outputs the last element after removing it and shortening the sequence." }
-{ $side-effects "seq" }
-{ $errors "Throws an error if the sequence is empty." }
-{ $see-also peek pop* } ;
-
-HELP: all-equal?
-{ $values { "seq" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if all elements in the sequence are equal. Yields true with an empty sequence." } ;
-
-HELP: all-eq?
-{ $values { "seq" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if all elements in the sequence are the same identical object. Yields true with an empty sequence." } ;
-
-HELP: mismatch
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "i" "an index" } }
-{ $description "Compares pairs of elements up to the minimum of the sequences' lengths, outputting the first index where the two sequences have non-equal elements, or -1 if all tested elements were equal." } ;
-
-HELP: flip
-{ $values { "matrix" "a sequence of equal-length sequences" } { "newmatrix" "a sequence of equal-length sequences" } }
-{ $description "Transposes the matrix; that is, rows become columns and columns become rows." }
-{ $examples { $example "{ { 1 2 3 } { 4 5 6 } } flip ." "{ { 1 4 } { 2 5 } { 3 6 } }" } } ;
-
-HELP: unpair
-{ $values { "assoc" "a sequence of pairs" } { "keys" "a new sequence" } { "values" "a new sequence" } }
-{ $description "Given a sequence of two-element sequences, outputs a new sequence with the first element of each pair, and a new sequence with the second element of each pair." } ;
-
-HELP: exchange
-{ $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "seq" "a mutable sequence" } }
-{ $description "Exchanges the " { $snippet "m" } "th and " { $snippet "n" } "th elements of " { $snippet "seq" } "." } ;
-
-HELP: assoc
-{ $values { "key" "an object" } { "assoc" "a sequence of pairs" } { "value" "the associated value, or " { $link f } } }
-{ $description "Searches for a pair whose first element is equal to the key and outputs the second element of the pair. Keys are compared for equality using " { $link = } ". Outputs " { $link f } " if no matching key is found." }
-{ $see-also rassoc } ;
-
-HELP: rassoc
-{ $values { "value" "an object" } { "assoc" "a sequence of pairs" } { "key" "the associated key, or " { $link f } } }
-{ $description "Searches for a pair whose second element is equal to the value and outputs the first element of the pair. Values are compared for equality using " { $link = } ". Outputs " { $link f } " if no matching value is found." } 
-{ $see-also rassoc } ;
-
-HELP: last/first
-{ $values { "seq" "a sequence" } { "pair" "a two-element array" } }
-{ $description "Creates an array holding the first and last element of the sequence." } ;
-
-HELP: padding
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "elt" "an object"} { "padded" "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-left
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "elt" "an object"} { "padded" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of " { $snippet "seq" } " padded on the left with enough repetitions of " { $snippet "elt" } " to have the result be of length " { $snippet "n" } "." }
-{ $examples { $example "{ \"ab\" \"quux\" } [ 5 CHAR: - pad-left print ] each" "---ab\n-quux" } } ;
-
-HELP: pad-right
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "elt" "an object"} { "padded" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of " { $snippet "seq" } " padded on the right with enough repetitions of " { $snippet "elt" } " to have the result be of length " { $snippet "n" } "." }
-{ $examples { $example "{ \"ab\" \"quux\" } [ 5 CHAR: - pad-right print ] each" "ab---\nquux-" } } ;
-
-HELP: sequence=
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if the two sequences have the same length and elements. This is weaker than " { $link = } ", since it does not ensure that the sequences are instances of the same class." } ;
-
-HELP: depth
-{ $values { "n" "a non-negative integer" } }
-{ $description "Outputs the number of elements on the data stack." } ;
-
-HELP: cond
-{ $values { "assoc" "a sequence of quotation pairs" } }
-{ $description
-    "Calls the second quotation in the first pair whose first quotation yields a true value."
-    $terpri
-    "The following two phrases are equivalent:"
-    { $code "{ { [ X ] [ Y ] } { [ Z ] [ T ] } } cond" }
-    { $code "X [ Y ] [ Z [ T ] [ no-cond ] if ] if" }
-}
-{ $errors "Throws a " { $link no-cond } " error if none of the test quotations yield a true value." }
-{ $examples
-    { $code
-        "{"
-        "    { [ dup 0 > ] [ \"positive\" ] }"
-        "    { [ dup 0 < ] [ \"negative\" ] }"
-        "    { [ dup zero? ] [ \"zero\" ] }"
-        "} cond"
-    }
-} ;
-
-HELP: no-cond
-{ $description "Throws a " { $link no-cond } " error." }
-{ $error-description "Thrown by " { $link cond } " if none of the test quotations yield a true value. Most uses of " { $link cond } " include a default case where the test quotation is " { $snippet "[ t ]" } "; such a " { $link cond } " form will never throw this error. If you wish to assert that certain conditions are true, and fail otherwise, you can use " { $link cond } " without a default case." } ;
-
-HELP: unix?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on a Unix-like system. While this is a rather vague notion, one can use it to make certain assumptions about system calls and file structure which are not valid on Windows." } ;
diff --git a/core/collections/sequences.factor b/core/collections/sequences.factor
deleted file mode 100644 (file)
index b52e75c..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: vectors
-USING: arrays kernel sequences-internals ;
-
-: <vector> ( n -- vector )
-    f <array> array>vector 0 over set-fill ;
-
-IN: sequences
-USING: errors generic math math-internals strings ;
-
-GENERIC: length ( seq -- n )
-GENERIC: set-length ( n seq -- )
-GENERIC: nth ( n seq -- elt )
-GENERIC: set-nth ( elt n seq -- )
-GENERIC: new ( len seq -- newseq )
-GENERIC: like ( seq prototype -- newseq )
-
-M: object new drop f <array> ;
-
-M: object like drop ;
-
-: empty? ( seq -- ? ) length zero? ; inline
-
-: delete-all ( seq -- ) 0 swap set-length ;
-
-: first ( seq -- first ) 0 swap nth ; inline
-: second ( seq -- second ) 1 swap nth ; inline
-: third ( seq -- third ) 2 swap nth ; inline
-: fourth  ( seq -- fourth ) 3 swap nth ; inline
-
-: push ( elt seq -- ) dup length swap set-nth ;
-
-: ?push ( elt seq/f -- seq )
-    [ 1 <vector> ] unless* [ push ] keep ;
-
-: bounds-check? ( n seq -- ? )
-    over 0 >= [ length < ] [ 2drop f ] if ; inline
-
-IN: sequences-internals
-
-GENERIC: resize ( n seq -- newseq )
-
-! Unsafe sequence protocol for inner loops
-GENERIC: nth-unsafe ( n seq -- elt )
-GENERIC: set-nth-unsafe ( elt n seq -- )
-
-M: object nth-unsafe nth ;
-M: object set-nth-unsafe set-nth ;
-
-: 2nth-unsafe ( s s n -- x x )
-    tuck swap nth-unsafe >r swap nth-unsafe r> ; inline
-
-! The f object supports the sequence protocol trivially
-M: f length drop 0 ;
-M: f nth nip ;
-M: f nth-unsafe nip ;
-M: f like drop dup empty? [ drop f ] when ;
-
-! Integers support the sequence protocol
-M: integer length ;
-M: integer nth drop ;
-M: integer nth-unsafe drop ;
-
-: first2-unsafe
-    [ 0 swap nth-unsafe ] keep 1 swap nth-unsafe ; inline
-
-: first3-unsafe
-    [ first2-unsafe ] keep 2 swap nth-unsafe ; inline
-
-: first4-unsafe
-    [ first3-unsafe ] keep 3 swap nth-unsafe ; inline
-
-: exchange-unsafe ( m n seq -- )
-    [ tuck nth-unsafe >r nth-unsafe r> ] 3keep tuck
-    >r >r set-nth-unsafe r> r> set-nth-unsafe ; inline
-
-IN: sequences
-
-: ?nth ( n seq/f -- elt/f )
-    2dup bounds-check? [ nth-unsafe ] [ 2drop f ] if ;
diff --git a/core/collections/sequences.facts b/core/collections/sequences.facts
deleted file mode 100644 (file)
index 1586a1c..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-USING: arrays help sequences sequences-internals vectors
-strings kernel ;
-
-HELP: <vector>
-{ $values { "n" "a positive integer specifying initial capacity" } { "vector" "a new vector" } }
-{ $description "Creates a new vector that can hold " { $snippet "n" } " elements before resizing." }
-{ $see-also <array> <string> <sbuf> } ;
-
-HELP: length
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } }
-{ $contract "Outputs the length of the sequence. All sequences support this operation." } ;
-
-HELP: set-length
-{ $values { "n" "a non-negative integer" } { "seq" "a resizable sequence" } }
-{ $contract "Resizes the sequence. Not all sequences are resizable." }
-{ $errors "Throws a " { $link bounds-error } " if the new length is negative, or if the sequence is not resizable." }
-{ $side-effects "seq" } ;
-
-HELP: nth
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } { "elt" "the element at the " { $snippet "n" } "th index" } }
-{ $contract "Outputs the " { $snippet "n" } "th element of the sequence. Elements are numbered from zero, so the last element has an index one less than the length of the sequence. All sequences support this operation." }
-{ $errors "Throws a " { $link bounds-error } " if the index is negative, or greater than or equal to the length of the sequence." } ;
-
-HELP: set-nth
-{ $values { "elt" "an object" } { "n" "a non-negative integer" } { "seq" "a mutable sequence" } }
-{ $contract "Sets the " { $snippet "n" } "th element of the sequence. Storing beyond the end of a resizable sequence such as a vector or string buffer grows the sequence." }
-{ $errors "Throws an error if the index is negative, or if the sequence is not resizable and the index is greater than or equal to the length of the sequence."
-$terpri
-"Throws an error if the sequence cannot hold elements of the given type." }
-{ $side-effects "seq" } ;
-
-HELP: new
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } { "newseq" "a mutable sequence" } }
-{ $contract "Outputs a mutable sequence of length " { $snippet "n" } " which can hold the elements of " { $snippet "seq" } "." } ;
-
-HELP: like
-{ $values { "seq" "a sequence" } { "prototype" "a sequence" } { "newseq" "a sequence" } }
-{ $contract "Outputs a sequence with the same elements as the input sequence, but " { $emphasis "like" } " the template sequence, in the sense that it either has the same class as the template sequence, or if the template sequence is a virtual sequence, the same class as the template sequence's underlying sequence."
-$terpri
-"The default implementation does nothing." }
-{ $notes "The output sequence might share storage with the input sequence, for example:"
-{ $example
-    "{ 1 2 3 } \"array\" set"
-    "\"array\" get V{ } like \"vector\" set"
-    "t 0 \"array\" get set-nth"
-    "\"vector\" get ."
-    "V{ t 2 3 }"
-}
-"If this behavior is undesirable, you can use one of the following words instead, which always output a fresh sequence:"
-{ $list
-    { $link >array }
-    { $link >quotation }
-    { $link >string }
-    { $link >sbuf }
-    { $link >vector }
-} } ;
-
-HELP: empty?
-{ $values { "seq" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if the sequence has zero length." } ;
-
-HELP: delete-all
-{ $values { "seq" "a resizable sequence" } }
-{ $description "Resizes the sequence to zero length, removing all elements. Not all sequences are resizable." }
-{ $errors "Throws a " { $link bounds-error } " if the new length is negative, or if the sequence is not resizable." }
-{ $side-effects "seq" } ;
-
-HELP: resize
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } { "newseq" "a new sequence" } }
-{ $description "Creates a new sequence of the same type as " { $snippet "seq" } " with " { $snippet "n" } " elements, and copies the contents of " { $snippet "seq" } " into the new sequence. If " { $snippet "n" } " exceeds the length of " { $snippet "seq" } ", the remaining elements are filled with a default value; " { $link f } " for arrays and 0 for strings." }
-{ $notes "This generic word is only implemented for strings and arrays." } ;
-
-HELP: first
-{ $values { "seq" "a sequence" } { "first" "the first element of the sequence" } }
-{ $description "Outputs the first element of the sequence." }
-{ $errors "Throws an error if the sequence is empty." } ;
-
-HELP: second
-{ $values { "seq" "a sequence" } { "second" "the second element of the sequence" } }
-{ $description "Outputs the second element of the sequence." }
-{ $errors "Throws an error if the sequence contains less than two elements." } ;
-
-HELP: third
-{ $values { "seq" "a sequence" } { "third" "the third element of the sequence" } }
-{ $description "Outputs the third element of the sequence." }
-{ $errors "Throws an error if the sequence contains less than three elements." } ;
-
-HELP: fourth
-{ $values { "seq" "a sequence" } { "fourth" "the fourth element of the sequence" } }
-{ $description "Outputs the fourth element of the sequence." }
-{ $errors "Throws an error if the sequence contains less than four elements." } ;
-
-HELP: push
-{ $values { "elt" "an object" } { "seq" "a resizable mutable sequence" } }
-{ $description "Adds an element at the end of the sequence. The sequence length is adjusted accordingly." }
-{ $errors "Throws an error if " { $snippet "seq" } " is not resizable, or if the type of " { $snippet "elt" } " is not permitted in " { $snippet "seq" } "." }
-{ $side-effects "seq" }
-{ $see-also pop push-new } ;
-
-HELP: ?push
-{ $values { "elt" "an object" } { "seq/f" "a resizable mutable sequence, or " { $link f } } { "seq" "a resizable mutable sequence" } }
-{ $description "If the given sequence is " { $link f } ", creates and outputs a new one-element vector holding " { $snippet "elt" } ". Otherwise, pushes " { $snippet "elt" } " onto the given sequence." }
-{ $errors "Throws an error if " { $snippet "seq" } " is not resizable, or if the type of " { $snippet "elt" } " is not permitted in " { $snippet "seq" } "." }
-{ $side-effects "seq" } ;
-
-HELP: bounds-check?
-{ $values { "n" "an integer" } { "seq" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if the index is within the bounds of the sequence." } ;
-
-HELP: ?nth
-{ $values { "n" "an integer" } { "seq" "a sequence" } { "elt/f" "an object or " { $link f } } }
-{ $description "A forgiving version of " { $link nth } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } "." } ;
-
-HELP: nth-unsafe
-{ $values { "n" "an integer" } { "seq" "a sequence" } { "elt" "an object" } }
-{ $contract "Unsafe variant of " { $link nth } " that does not perform bounds checks." } ;
-
-HELP: set-nth-unsafe
-{ $values { "elt" "an object" } { "n" "an integer" } { "seq" "a sequence" } }
-{ $contract "Unsafe variant of " { $link set-nth } " that does not perform bounds checks." } ;
-
-HELP: exchange-unsafe
-{ $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "seq" "a mutable sequence" } }
-{ $description "Unsafe variant of " { $link exchange } " that does not perform bounds checks." } ;
-
-HELP: first2-unsafe
-{ $values { "seq" "a sequence" } { "first" "the first element" } { "second" "the second element" } }
-{ $contract "Unsafe variant of " { $link first2 } " that does not perform bounds checks." } ;
-
-HELP: first3-unsafe
-{ $values { "seq" "a sequence" } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } }
-{ $contract "Unsafe variant of " { $link first3 } " that does not perform bounds checks." } ;
-
-HELP: first4-unsafe
-{ $values { "seq" "a sequence" } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } { "fourth" "the fourth element" } }
-{ $contract "Unsafe variant of " { $link first4 } " that does not perform bounds checks." } ;
diff --git a/core/collections/slicing.factor b/core/collections/slicing.factor
deleted file mode 100644 (file)
index a9e3560..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: sequences
-USING: generic kernel kernel-internals math namespaces
-strings vectors errors ;
-
-: head-slice ( seq n -- slice ) 0 swap rot <slice> ;
-
-: tail-slice ( seq n -- slice ) over length rot <slice> ;
-
-: (slice*) >r dup length r> - ;
-
-: head-slice* ( seq n -- slice ) (slice*) head-slice ;
-
-: tail-slice* ( seq n -- slice ) (slice*) tail-slice ;
-
-: subseq ( from to seq -- subseq ) [ <slice> ] keep like ;
-
-: head ( seq n -- headseq ) dupd head-slice swap like ;
-
-: head* ( seq n -- headseq ) dupd head-slice* swap like ;
-
-: tail ( seq n -- tailseq ) dupd tail-slice swap like ;
-
-: tail* ( seq n -- tailseq ) dupd tail-slice* swap like ;
-
-: head? ( seq begin -- ? )
-    2dup [ length ] 2apply < [
-        2drop f
-    ] [
-        [ length head-slice ] keep sequence=
-    ] if ;
-
-: ?head ( seq begin -- newseq ? )
-    2dup head? [ length tail t ] [ drop f ] if ;
-
-: tail? ( seq end -- ? )
-    2dup [ length ] 2apply < [
-        2drop f
-    ] [
-        [ length tail-slice* ] keep sequence=
-    ] if ;
-
-: ?tail ( seq end -- newseq ? )
-    2dup tail? [ length head* t ] [ drop f ] if ;
-
-: replace-slice ( new m n seq -- replaced )
-    tuck swap tail-slice >r swap head-slice swap r> 3append ;
-
-: remove-nth ( n seq -- newseq )
-    >r f swap dup 1+ r> replace-slice ;
-
-: (cut) ( n seq -- before after )
-    swap [ head ] 2keep tail-slice ;
-
-: cut ( n seq -- before after )
-    swap [ head ] 2keep tail ;
-
-: cut* ( n seq -- before after )
-    swap [ head* ] 2keep tail* ;
-
-: (group) ( n seq -- )
-    2dup length >= [
-        dup empty? [ 2drop ] [ dup like , drop ] if
-    ] [
-        dupd (cut) >r , r> (group)
-    ] if ;
-
-: group ( seq n -- groups )
-    dup 0 <= [ "Invalid group count" throw ] when
-    [ swap (group) ] { } make ;
-
-: start-step ( subseq seq n -- subseq slice )
-    pick length dupd + rot <slice> ;
-
-: start* ( subseq seq i -- n )
-    pick length pick length pick - > [
-        3drop -1
-    ] [
-        2dup >r >r start-step dupd sequence= [
-            r> 2drop r>
-        ] [
-            r> r> 1+ start*
-        ] if
-    ] if ;
-
-: start ( subseq seq -- n ) 0 start* ;
-
-: subseq? ( subseq seq -- ? ) start -1 > ;
-
-: split1 ( seq subseq -- before after )
-    dup pick start dup -1 = [
-        2drop dup like f
-    ] [
-        [ >r over r> head -rot length ] keep + tail
-    ] if ;
-
-: split, building get peek push ;
-
-: split-next, V{ } clone , ;
-
-: (split) ( quot elt -- )
-    [ swap call ] keep swap
-    [ drop split-next, ] [ split, ] if ; inline
-
-: split* ( seq quot -- pieces )
-    over >r
-    [ split-next, swap [ (split) ] each-with ]
-    { } make r> swap [ swap like ] map-with ; inline
-
-: split ( seq separators -- pieces )
-    swap [ over member? ] split* nip ;
-
-: drop-prefix ( seq1 seq2 -- slice1 slice2 )
-    2dup mismatch dup -1 = [ drop 2dup min-length ] when
-    tuck tail-slice >r tail-slice r> ;
-
-: unclip ( seq -- rest first ) dup 1 tail swap first ;
diff --git a/core/collections/slicing.facts b/core/collections/slicing.facts
deleted file mode 100644 (file)
index 1c0c88b..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-USING: help sequences ;
-
-HELP: head-slice
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "slice" "a slice" } }
-{ $description "Outputs a virtual sequence sharing storage with the first " { $snippet "n" } " elements of the input sequence." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: tail-slice
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "slice" "a slice" } }
-{ $description "Outputs a virtual sequence sharing storage with all elements up to the " { $snippet "n" } "th index of the input sequence." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: head-slice*
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "slice" "a slice" } }
-{ $description "Outputs a virtual sequence sharing storage with all elements of " { $snippet "seq" } " until the " { $snippet "n" } "th element from the end. In other words, it outputs a sequence of the first " { $snippet "l-n" } " elements of the input sequence, where " { $snippet "l" } " is its length." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: tail-slice*
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "slice" "a slice" } }
-{ $description "Outputs a virtual sequence sharing storage with the last " { $snippet "n" } " elements of the input sequence." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: subseq
-{ $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "seq" "a sequence" } { "subseq" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of all elements 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." } ;
-
-HELP: head
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "headseq" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of the first " { $snippet "n" } " elements of the input sequence." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: tail
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "tailseq" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of the input sequence with the first n items removed." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: head*
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "headseq" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of all elements of " { $snippet "seq" } " until the " { $snippet "n" } "th element from the end. In other words, it outputs a sequence of the first " { $snippet "l-n" } " elements of the input sequence, where " { $snippet "l" } " is its length." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: tail*
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "tailseq" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of the last " { $snippet "n" } " elements of the input sequence." }
-{ $errors "Throws an error if the index is out of bounds." } ;
-
-HELP: head?
-{ $values { "seq" "a sequence" } { "begin" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If " { $snippet "begin" } " is longer than " { $snippet "seq" } ", this word outputs " { $link f } "." } ;
-
-HELP: tail?
-{ $values { "seq" "a sequence" } { "begin" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "seq" } " ends with " { $snippet "end" } ". If " { $snippet "end" } " is longer than " { $snippet "seq" } ", this word outputs " { $link f } "." } ;
-
-HELP: ?head
-{ $values { "seq" "a sequence" } { "begin" "a sequence" } { "newseq" "a new sequence" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "begin" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ;
-
-HELP: ?tail
-{ $values { "seq" "a sequence" } { "end" "a sequence" } { "newseq" "a new sequence" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "seq" } " ends with " { $snippet "end" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "begin" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ;
-
-HELP: replace-slice
-{ $values { "new" "a sequence" } { "seq" "a sequence" } { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "replaced" "a new sequence" } }
-{ $description "Outputs a new sequence consisting of the elements of " { $snippet "seq" } ", with the range from " { $snippet "m" } " to " { $snippet "n" } " replaced by " { $snippet "new" } "." }
-{ $errors "Throws an error if " { $snippet "new" } " contains elements whose types are not permissible in sequences of the same class as " { $snippet "seq" } "." } ;
-
-HELP: remove-nth
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } { "newseq" "a new sequence" } }
-{ $description "Outputs a new sequence with the same elements as " { $snippet "seq" } " except omitting the " { $snippet "n" } "th element." }
-{ $examples
-    { $example "2 { + - = * / } remove-nth ." "{ + - * / }" }
-} ;
-
-HELP: (cut)
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } { "before" "a sequence" } { "after" "a slice" } }
-{ $description "Outputs a pair of sequences, where " { $snippet "before" } " consists of the first " { $snippet "n" } " elements of " { $snippet "seq" } " and has the same type, while " { $snippet "after" } " is a slice of the remaining elements." }
-{ $notes "Unlike " { $link cut } ", the run time of this word is proportional to the length of " { $snippet "before" } ", not " { $snippet "after" } ", so it is suitable for use in an iterative algorithm which cuts successive pieces off a sequence." } ;
-
-HELP: cut
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } { "before" "a sequence" } { "after" "a sequence" } }
-{ $description "Outputs a pair of sequences, where " { $snippet "before" } " consists of the first " { $snippet "n" } " elements of " { $snippet "seq" } ", while " { $snippet "after" } " holds the remaining elements. Both output sequences have the same type as " { $snippet "seq" } "." }
-{ $notes "Since this word copies the entire tail of the sequence, it should not be used in a loop. If this is important, consider using " { $link (cut) } " instead, since it returns a slice for the tail instead of copying." } ;
-
-HELP: cut*
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } { "before" "a sequence" } { "after" "a sequence" } }
-{ $description "Outputs a pair of sequences, where " { $snippet "after" } " consists of the last " { $snippet "n" } " elements of " { $snippet "seq" } ", while " { $snippet "before" } " holds the remaining elements. Both output sequences have the same type as " { $snippet "seq" } "." } ;
-
-HELP: group
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" "a sequence of sequences" } }
-{ $description "Splits the sequence into groups of " { $snippet "n" } " elements and collects the groups into a new array." }
-{ $notes "If the sequence length is not a multiple of " { $snippet "n" } ", the final subsequence in the list will be shorter than " { $snippet "n" } " elements." } ;
-
-HELP: start*
-{ $values { "subseq" "a sequence" } { "seq" "a sequence" } { "i" "a start index" } { "n" "a start index" } }
-{ $description "Outputs the start index of the first contiguous subsequence equal to " { $snippet "subseq" } ", starting the search from the " { $snippet "i" } "th element. If no matching subsequence is found, outputs -1." } ;
-
-HELP: start
-{ $values { "subseq" "a sequence" } { "seq" "a sequence" } { "n" "a start index" } }
-{ $description "Outputs the start index of the first contiguous subsequence equal to " { $snippet "subseq" } ", or -1 if no matching subsequence is found." } ;
-
-HELP: subseq?
-{ $values { "subseq" "a sequence" } { "seq" "a sequence" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "seq" } " contains the elements of " { $snippet "subseq" } " as a contiguous subsequence." } ;
-
-HELP: split1
-{ $values { "seq" "a sequence" } { "subseq" "a sequence" } { "before" "a new sequence" } { "after" "a new sequence" } }
-{ $description "Splits " { $snippet "seq" } " at the first occurrence of " { $snippet "subseq" } ", and outputs the pieces before and after the split. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ;
-
-HELP: split*
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "pieces" "a new array" } }
-{ $description "Splits " { $snippet "seq" } " at each element for which " { $snippet "quot" } " yields a true value, and outputs an array of pieces. The pieces do not include the elements along which the sequence was split." }
-{ $examples { $example "{ 1 2 3 4 5 6 7 8 } [ 3 mod zero? ] split* ." "{ { 1 2 } { 4 5 } { 7 8 } }" } } ;
-
-HELP: split
-{ $values { "seq" "a sequence" } { "separators" "a sequence" } { "pieces" "a new array" } }
-{ $description "Splits " { $snippet "seq" } " at each occurrence of an element of " { $snippet "separators" } ", and outputs an array of pieces. The pieces do not include the elements along which the sequence was split." }
-{ $examples { $example "\"hello world-how are you?\" \" -\" split ." "{ \"hello\" \"world\" \"how\" \"are\" \"you?\" }" } } ;
-
-HELP: drop-prefix
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "slice1" "a slice" } { "slice2" "a slice" } }
-{ $description "Outputs a pair of virtual sequences with the common prefix of " { $snippet "seq1" } " and " { $snippet "seq2" } " removed." } ;
-
-HELP: unclip
-{ $values { "seq" "a sequence" } { "rest" "a sequence" } { "first" "an object" } }
-{ $description "Outputs a tail sequence and the first element of " { $snippet "seq" } "; the tail sequence consists of all elements of " { $snippet "seq" } " but the first." }
-{ $examples
-    { $example "{ 1 2 3 } unclip add ." "{ 2 3 1 }" }
-} ;
diff --git a/core/collections/strings.factor b/core/collections/strings.factor
deleted file mode 100644 (file)
index 60f8c7b..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: strings
-USING: generic kernel kernel-internals math sequences
-sequences-internals ;
-
-M: string equal?
-    over string? [
-        over hashcode over hashcode number=
-        [ sequence= ] [ 2drop f ] if
-    ] [
-        2drop f
-    ] if ;
-
-M: string hashcode
-    dup string-hashcode [ ] [
-        dup rehash-string string-hashcode
-    ] ?if ;
-
-M: string nth bounds-check nth-unsafe ;
-
-M: string nth-unsafe >r >fixnum r> char-slot ;
-
-M: string set-nth bounds-check set-nth-unsafe ;
-
-M: string set-nth-unsafe 
-    f over set-string-hashcode
-    >r >fixnum >r >fixnum r> r> set-char-slot ;
-
-M: string clone (clone) ;
-
-M: string resize resize-string ;
-
-! Characters
-PREDICATE: integer blank " \t\n\r" member? ;
-PREDICATE: integer letter CHAR: a CHAR: z between? ;
-PREDICATE: integer LETTER CHAR: A CHAR: Z between? ;
-PREDICATE: integer digit CHAR: 0 CHAR: 9 between? ;
-PREDICATE: integer printable CHAR: \s CHAR: ~ between? ;
-PREDICATE: integer control "\0\e\r\n\t\u0008\u007f" member? ;
-PREDICATE: printable quotable "\"\\" member? not ;
-
-UNION: Letter letter LETTER ;
-UNION: alpha Letter digit ;
-
-: ch>lower ( ch -- lower ) dup LETTER? [ HEX: 20 + ] when ;
-: ch>upper ( ch -- lower ) dup letter? [ HEX: 20 - ] when ;
-: >lower ( str -- lower ) [ ch>lower ] map ;
-: >upper ( str -- upper ) [ ch>upper ] map ;
-
-: ch>string ( ch -- str ) 1 swap <string> ;
-
-: >string ( seq -- str )
-    [ string? ] [ 0 <string> ] >sequence ; inline
-
-M: string like
-    drop dup string? [
-        dup sbuf? [
-            dup length over underlying length number=
-            [ underlying ] [ >string ] if
-        ] [
-            >string
-        ] if
-    ] unless ;
-
-M: string new drop 0 <string> ;
diff --git a/core/collections/strings.facts b/core/collections/strings.facts
deleted file mode 100644 (file)
index ce1e31c..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-USING: arrays help kernel kernel-internals sequences strings
-vectors ;
-
-HELP: string
-{ $description "The class of fixed-length character strings. See " { $link "syntax-strings" } " for syntax and " { $link "strings" } " for general information." } ;
-
-HELP: char-slot ( n string -- ch )
-{ $values { "n" "a fixnum" } { "string" "a string" } { "ch" "the character at the " { $snippet "n" } "th index" } }
-{ $description "Unsafe string accessor, used to define " { $link nth } " on strings." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link nth } " instead." } ;
-
-HELP: set-char-slot ( ch n string -- )
-{ $values { "ch" "a character" } { "n" "a fixnum" } { "string" "a string" }  }
-{ $description "Unsafe string mutator, used to define " { $link set-nth } " on strings." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link set-nth } " instead." } ;
-
-HELP: <string> ( n ch -- string )
-{ $values { "n" "a positive integer specifying string length" } { "elt" "an initial character" } }
-{ $description "Creates a new string with the given length and all characters initially set to " { $snippet "ch" } "." }
-{ $see-also <array> <quotation> <sbuf> <vector> } ;
-
-HELP: blank
-{ $class-description "Class of integers denoting ASCII whitespace characters." } ;
-
-HELP: letter
-{ $class-description "Class of integers denoting lowercase alphabet ASCII characters." } ;
-
-HELP: LETTER
-{ $class-description "Class of integers denoting uppercase alphabet ASCII characters." } ;
-
-HELP: digit
-{ $class-description "Class of integers denoting ASCII decimal digit characters." } ;
-
-HELP: Letter
-{ $class-description "Class of integers denoting ASCII alphabet characters, both upper and lower case." } ;
-
-HELP: alpha
-{ $class-description "Class of integers denoting alphanumeric ASCII characters." } ;
-
-HELP: alpha
-{ $class-description "Class of integers denoting printable ASCII characters." } ;
-
-HELP: alpha
-{ $class-description "Class of integers denoting ASCII control characters." } ;
-
-HELP: alpha
-{ $class-description "Class of integers denoting characters which may appear in a Factor string literal without escaping." } ;
-
-HELP: ch>lower
-{ $values { "ch" "a character" } { "lower" "a character" } }
-{ $description "Converts a character to lowercase." } ;
-
-HELP: ch>upper
-{ $values { "ch" "a character" } { "lower" "a character" } }
-{ $description "Converts a character to uppercase." } ;
-
-HELP: >lower
-{ $values { "str" "a string" } { "lower" "a string" } }
-{ $description "Converts a string to lowercase." } ;
-
-HELP: >upper
-{ $values { "str" "a string" } { "upper" "a string" } }
-{ $description "Converts a string to uppercase." } ;
-
-HELP: ch>string
-{ $values { "ch" "a character"} { "str" "a new string" } }
-{ $description "Outputs a string of one character." } ;
-
-HELP: >string
-{ $values { "seq" "a sequence of characters" } { "str" "a new string" } }
-{ $description "Outputs a freshly-allocated string with the same elements as a given sequence." }
-{ $errors "Throws an error if the sequence contains elements other than real numbers." }
-{ $see-also >array >sbuf >vector >quotation } ;
-
-HELP: resize-string ( n str -- newstr )
-{ $values { "n" "a non-negative integer" } { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Creates a new string " { $snippet "n" } " characters long The contents of the existing string are copied into the new string; if the new string is shorter, only an initial segment is copied, and if the new string is longer the remaining space is filled with " { $snippet "\u0000" } "." } ;
diff --git a/core/collections/vectors.factor b/core/collections/vectors.factor
deleted file mode 100644 (file)
index 198e123..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: vectors
-USING: arrays errors generic kernel kernel-internals math
-math-internals sequences sequences-internals words ;
-
-M: vector set-length grow-length ;
-
-M: vector nth-unsafe underlying nth-unsafe ;
-
-M: vector nth bounds-check nth-unsafe ;
-
-M: vector set-nth-unsafe
-    underlying set-nth-unsafe ;
-
-M: vector set-nth
-    growable-check 2dup ensure set-nth-unsafe ;
-
-: >vector ( seq -- vector )
-    [ vector? ] [ <vector> ] >sequence ; inline
-
-M: vector clone clone-resizable ;
-
-M: vector like
-    drop dup vector? [
-        dup array? [ array>vector ] [ >vector ] if
-    ] unless ;
-
-M: vector new drop <vector> ;
-
-IN: kernel
-
-: with-datastack ( stack word -- newstack )
-    datastack >r >r >vector set-datastack r> execute
-    datastack r> [ push ] keep set-datastack 2nip ;
diff --git a/core/collections/vectors.facts b/core/collections/vectors.facts
deleted file mode 100644 (file)
index b021e0b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-IN: vectors
-USING: arrays help kernel strings ;
-
-HELP: vector
-{ $description "The class of resizable vectors. See " { $link "syntax-vectors" } " for syntax and " { $link "vectors" } " for general information." } ;
-
-HELP: >vector
-{ $values { "seq" "a sequence" } { "vector" "a new vector" } }
-{ $description "Outputs a freshly-allocated vector with the same elements as a given sequence." } ;
-
-HELP: array>vector ( array -- vector )
-{ $values { "array" "an array" } { "vector" "a new vector" } }
-{ $description "Creates a new vector using the array for underlying storage. The vector's initial length is the same as that of the array."
-$terpri
-"This word can be marginally more efficient than " { $link >vector } ", but the sharing of storage can lead to unexpected results." } ;
-
-HELP: with-datastack
-{ $values { "stack" "a sequence" } { "word" "a word" } { "newstack" "a sequence" } }
-{ $description "Executes " { $snippet "word" } " with the given data stack contents, and outputs the new data stack after the word returns. Does not affect the data stack in surrounding code, other than consuming the two inputs and pushing the output." }
-{ $examples
-    { $example "{ 3 7 } \\ + with-datastack ." "V{ 10 }" }
-} ;
diff --git a/core/collections/virtual-sequences.factor b/core/collections/virtual-sequences.factor
deleted file mode 100644 (file)
index c6b1431..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: sequences
-USING: errors generic kernel math sequences-internals vectors ;
-
-! A reversal of an underlying sequence.
-TUPLE: reversed seq ;
-
-: reversed@ ( m reversed -- n seq )
-    reversed-seq [ length swap - 1- ] keep ; inline
-
-M: reversed length reversed-seq length ;
-
-M: reversed nth reversed@ nth ;
-
-M: reversed nth-unsafe reversed@ nth-unsafe ;
-
-M: reversed set-nth reversed@ set-nth ;
-
-M: reversed set-nth-unsafe
-    reversed@ set-nth-unsafe ;
-
-M: reversed like reversed-seq like ;
-
-M: reversed new reversed-seq new ;
-
-: reverse ( seq -- newseq ) [ <reversed> ] keep like ;
-
-! A slice of another sequence.
-TUPLE: slice seq from to ;
-
-: collapse-slice ( from to slice -- from to seq )
-    dup slice-from swap slice-seq >r tuck + >r + r> r> ;
-
-TUPLE: slice-error reason ;
-: slice-error ( str -- * ) <slice-error> throw ;
-
-: check-slice ( from to seq -- )
-    pick 0 < [ "start < 0" slice-error ] when
-    length over < [ "end > sequence" slice-error ] when
-    > [ "start > end" slice-error ] when ;
-
-C: slice ( m n seq -- slice )
-    #! A slice of a slice collapses.
-    >r dup slice? [ collapse-slice ] when r>
-    >r 3dup check-slice r>
-    [ set-slice-seq ] keep
-    [ set-slice-to ] keep
-    [ set-slice-from ] keep ;
-
-M: slice length
-    dup slice-to swap slice-from - ;
-
-: slice@ ( m slice -- n seq )
-    [ slice-from + ] keep slice-seq ; inline
-
-M: slice nth slice@ nth ;
-
-M: slice nth-unsafe slice@ nth-unsafe ;
-
-M: slice set-nth slice@ set-nth ;
-
-M: slice set-nth-unsafe slice@ set-nth-unsafe ;
-
-M: slice like slice-seq like ;
-
-M: slice new slice-seq new ;
-
-TUPLE: column seq col ;
-
-: column@ ( m column -- n seq )
-    dup column-col -rot column-seq nth ;
-
-M: column length column-seq length ;
-
-M: column nth column@ nth ;
-
-M: column set-nth column@ set-nth ;
-
-M: column like column-seq like ;
-
-M: column new column-seq new ;
diff --git a/core/collections/virtual-sequences.facts b/core/collections/virtual-sequences.facts
deleted file mode 100644 (file)
index 768fe82..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-USING: help sequences ;
-
-HELP: reversed
-{ $class-description "A virtual sequence which presents a reversed view of an underlying sequence." }
-{ $see-also <reversed> reverse } ;
-
-HELP: reversed@
-{ $values { "m" "a non-negative integer" } { "reversed" "an instance of " { $link reversed } } { "n" "a non-negative integer" } { "seq" "a sequence" } }
-{ $description "Indexes into a reversed sequence. Helper word used to implement " { $link "sequence-protocol" } " methods for the " { $link reversed } " class." } ;
-
-HELP: reverse
-{ $values { "seq" "a sequence" } { "newseq" "a new sequence" } }
-{ $description "Outputs a new sequence having the same elements as " { $snippet "seq" } " but in reverse order." } ;
-
-HELP: <reversed> ( seq -- reversed )
-{ $values { "seq" "a sequence" } { "reversed" "a new sequence" } }
-{ $description "Creates an instance of the " { $link reversed } " virtual sequence." } ;
-
-HELP: slice-error
-{ $values { "str" "a reason" } }
-{ $description "Throws a " { $link slice-error } "." }
-{ $error-description "Thrown by " { $link <slice> } " if one of the following invalid conditions holds:"
-    { $list
-        "The start index is negative"
-        "The end index is greater than the length of the sequence"
-        "The start index is greater than the end index"
-    }
-} ;
-
-HELP: slice
-{ $class-description "A virtual sequence which presents a subrange of the elements of an underlying sequence." }
-{ $see-also <slice> subseq } ;
-
-HELP: <slice>
-{ $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "seq" "a sequence" } { "slice" "a 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." } ;
-
-HELP: slice@
-{ $values { "m" "a non-negative integer" } { "slice" "an instance of " { $link slice } } { "n" "a non-negative integer" } { "seq" "a sequence" } }
-{ $description "Indexes into a slice. Helper word used to implement " { $link "sequence-protocol" } " methods for the " { $link reversed } " class." } ;
-
-HELP: column
-{ $class-description "A virtual sequence which presents a fixed column of a matrix represented as a sequence of rows." }
-{ $see-also <column> } ;
-
-HELP: <column>
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } }
-{ $description "Outputs a new virtual sequence which presents a fixed column of a matrix represented as a sequence of rows." "The " { $snippet "i" } "th element of a column is the " { $snippet "n" } "th element of the " { $snippet "i" } "th element of" { $snippet "seq" } ". Every element of " { $snippet "seq" } " must be a sequence, and all sequences must have equal length." }
-{ $examples
-    { $example
-        "{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } 0 <column> >array ."
-        "{ 1 4 7 }"
-    }
-}
-{ $notes
-    "In the same sense that " { $link <reversed> } " is a virtual variant of " { $link reverse } ", " { $link <column> } " is a virtual variant of " { $snippet "[ swap nth ] map-with" } "."
-} ;
-
-HELP: column@
-{ $values { "m" "a non-negative integer" } { "column" "an instance of " { $link column } } { "n" "a non-negative integer" } { "seq" "a sequence" } }
-{ $description "Indexes into a column view of a matrix. Helper word used to implement " { $link "sequence-protocol" } " methods for the " { $link column } " class." } ;
diff --git a/core/combinators/authors.txt b/core/combinators/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/combinators/combinators-docs.factor b/core/combinators/combinators-docs.factor
new file mode 100644 (file)
index 0000000..731b12b
--- /dev/null
@@ -0,0 +1,132 @@
+USING: arrays help.markup help.syntax strings sbufs vectors
+kernel quotations generic generic.standard classes
+math assocs sequences combinators.private ;
+IN: combinators
+
+ARTICLE: "combinators-quot" "Quotation construction utilities"
+"Some words for creating quotations which can be useful for implementing method combinations and compiler transforms:"
+{ $subsection make-dip }
+{ $subsection cond>quot }
+{ $subsection case>quot }
+{ $subsection alist>quot }
+"A powerful tool used to optimize code in several places is open-coded hashtable dispatch:"
+{ $subsection hash-case>quot }
+{ $subsection distribute-buckets }
+{ $subsection hash-dispatch-quot } ;
+
+ARTICLE: "combinators" "Additional combinators"
+"The " { $vocab-link "combinators" } " vocabulary is usually used because it provides two combinators which abstract out nested chains of " { $link if } ":"
+{ $subsection cond }
+{ $subsection case }
+"A combinator which can help with implementing methods on " { $link hashcode* } ":"
+{ $subsection recursive-hashcode }
+"An oddball combinator:"
+{ $subsection with-datastack }
+{ $subsection "combinators-quot" }
+{ $see-also "quotations" "basic-combinators" } ;
+
+ABOUT: "combinators"
+
+HELP: make-dip
+{ $values { "quot" "a quotation" } { "n" "a non-negative integer" } { "newquot" "a new quotation" } }
+{ $description "Constructs a quotation which retains the top " { $snippet "n" } " stack items, and applies " { $snippet "quot" } " to what is underneath." }
+{ $examples
+    { $example "USE: quotations" "[ 3 + ] 2 make-dip ." "[ >r >r 3 + r> r> ]" }
+} ;
+
+HELP: alist>quot
+{ $values { "default" "a quotation" } { "assoc" "a sequence of quotation pairs" } { "quot" "a new quotation" } }
+{ $description "Constructs a quotation which calls the first quotation in each pair of " { $snippet "assoc" } " until one of them outputs a true value, and then calls the second quotation in the corresponding pair. Quotations are called in reverse order, and if no quotation outputs a true value then " { $snippet "default" } " is called." }
+{ $notes "This word is used to implement compile-time behavior for " { $link cond } ", and it is also used by the generic word system. Note that unlike " { $link cond } ", the constructed quotation performs the tests starting from the end and not the beginning." } ;
+
+HELP: cond
+{ $values { "assoc" "a sequence of quotation pairs" } }
+{ $description
+    "Calls the second quotation in the first pair whose first quotation yields a true value."
+    $nl
+    "The following two phrases are equivalent:"
+    { $code "{ { [ X ] [ Y ] } { [ Z ] [ T ] } } cond" }
+    { $code "X [ Y ] [ Z [ T ] [ no-cond ] if ] if" }
+}
+{ $errors "Throws a " { $link no-cond } " error if none of the test quotations yield a true value." }
+{ $examples
+    { $code
+        "{"
+        "    { [ dup 0 > ] [ \"positive\" ] }"
+        "    { [ dup 0 < ] [ \"negative\" ] }"
+        "    { [ dup zero? ] [ \"zero\" ] }"
+        "} cond"
+    }
+} ;
+
+HELP: no-cond
+{ $description "Throws a " { $link no-cond } " error." }
+{ $error-description "Thrown by " { $link cond } " if none of the test quotations yield a true value. Some uses of " { $link cond } " include a default case where the test quotation is " { $snippet "[ t ]" } "; such a " { $link cond } " form will never throw this error." } ;
+
+HELP: case
+{ $values { "obj" object } { "assoc" "a sequence of object/quotation pairs, with an optional quotation at the end" } }
+{ $description
+    "Compares " { $snippet "obj" } " against the first element of every pair. If some pair matches, removes " { $snippet "obj" } " from the stack and calls the second element of that pair, which must be a quotation."
+    $nl
+    "If there is no case matching " { $snippet "obj" } ", the default case is taken. If the last element of " { $snippet "cases" } " is a quotation, the quotation is called with " { $snippet "obj" } " on the stack. Otherwise, a " { $link no-cond } " error is rasied."
+    $nl
+    "The following two phrases are equivalent:"
+    { $code "{ { X [ Y ] } { Y [ T ] } } case" }
+    { $code "dup X = [ drop Y ] [ dup Z = [ drop T ] [ no-case ] if ] if" }
+}
+{ $examples
+    { $code
+        "SYMBOL: yes  SYMBOL: no  SYMBOL: maybe"
+        "maybe {"
+        "    { yes [ ] } ! Do nothing"
+        "    { no [ \"No way!\" throw ] }"
+        "    { maybe [ \"Make up your mind!\" print ] }"
+        "    [ \"Invalid input; try again.\" print ]"
+        "} case"
+    }
+} ;
+
+HELP: no-case
+{ $description "Throws a " { $link no-case } " error." }
+{ $error-description "Thrown by " { $link case } " if the object at the top of the stack does not match any case, and no default case is given." } ;
+
+HELP: with-datastack
+{ $values { "stack" sequence } { "quot" quotation } { "newstack" 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. Does not affect the data stack in surrounding code, other than consuming the two inputs and pushing the output." }
+{ $examples
+    { $example "{ 3 7 } [ + ] with-datastack ." "{ 10 }" }
+} ;
+
+HELP: recursive-hashcode
+{ $values { "n" integer } { "obj" object } { "quot" "a quotation with stack effect " { $snippet "( n obj -- code )" } } { "code" integer } }
+{ $description "A combinator used to implement methods for the " { $link hashcode* } " generic word. If " { $snippet "n" } " is less than or equal to zero, outputs 0, otherwise calls the quotation." } ;
+
+HELP: cond>quot
+{ $values { "assoc" "a sequence of pairs of quotations" } { "quot" quotation } }
+{ $description  "Creates a quotation that when called, has the same effect as applying " { $link cond } " to " { $snippet "assoc" } "."
+$nl
+"the generated quotation is more efficient than the naive implementation of " { $link cond } ", though, since it expands into a series of conditionals, and no iteration through " { $snippet "assoc" } " has to be performed." }
+{ $notes "This word is used behind the scenes to compile " { $link cond } " forms efficiently; it can also be called directly,  which is useful for meta-programming." } ;
+
+HELP: case>quot
+{ $values { "assoc" "a sequence of pairs of quotations" } { "default" quotation } { "quot" quotation } }
+{ $description "Creates a quotation that when called, has the same effect as applying " { $link case } " to " { $snippet "assoc" } "."
+$nl
+"The quotation actually tests each possible case in order;" { $link hash-case>quot } " produces more efficient code." } ;
+
+HELP: distribute-buckets
+{ $values { "assoc" "an alist" } { "initial" object } { "quot" "a quotation with stack effect " { $snippet "( obj -- assoc )" } } { "buckets" "a new array" } }
+{ $description "Sorts the entries of " { $snippet "assoc" } " into buckets, using the quotation to yield a set of keys for each entry. The hashcode of each key is computed, and the entry is placed in all corresponding buckets. Each bucket is initially cloned from " { $snippet "initial" } "; this should either be an empty vector or a one-element vector containing a pair." }
+{ $notes "This word is used in the implemention of " { $link hash-case>quot } " and " { $link standard-combination } "." } ;
+
+HELP: hash-case>quot
+{ $values { "default" quotation } { "assoc" "an association list mapping quotations to quotations" } { "quot" quotation } }
+{ $description "Creates a quotation that when called, has the same effect as applying " { $link case } " to " { $snippet "assoc" } "."
+$nl
+"The quotation uses an efficient hash-based search to avoid testing the object against all possible keys." }
+{ $notes "This word is used behind the scenes to compile " { $link case } " forms efficiently; it can also be called directly,  which is useful for meta-programming." } ;
+
+HELP: dispatch ( n array -- )
+{ $values { "n" "a fixnum" } { "array" "an array of quotations" } }
+{ $description "Calls the " { $snippet "n" } "th quotation in the array." }
+{ $warning "This word is in the " { $vocab-link "kernel.private" } " vocabulary because it is an implementation detail used by the generic word system to accelerate method dispatch. It does not perform type or bounds checks, and user code should not need to call it directly." } ;
diff --git a/core/combinators/combinators-tests.factor b/core/combinators/combinators-tests.factor
new file mode 100644 (file)
index 0000000..208f8c0
--- /dev/null
@@ -0,0 +1,71 @@
+IN: temporary
+USING: alien strings kernel math tools.test io prettyprint
+namespaces combinators words ;
+
+[ "even" ] [
+    2 {
+        { [ dup 2 mod 0 = ] [ drop "even" ] }
+        { [ dup 2 mod 1 = ] [ drop "odd" ] }
+    } cond
+] unit-test
+
+[ "odd" ] [
+    3 {
+        { [ dup 2 mod 0 = ] [ drop "even" ] }
+        { [ dup 2 mod 1 = ] [ drop "odd" ] }
+    } cond
+] unit-test
+
+[ "neither" ] [
+    3 {
+        { [ dup string? ] [ drop "string" ] }
+        { [ dup float? ] [ drop "float" ] }
+        { [ dup alien? ] [ drop "alien" ] }
+        { [ t ] [ drop "neither" ] }
+    } cond
+] unit-test
+
+: case-test-1
+    {
+        { 1 [ "one" ] }
+        { 2 [ "two" ] }
+        { 3 [ "three" ] }
+        { 4 [ "four" ] }
+    } case ;
+
+[ "two" ] [ 2 case-test-1 ] unit-test
+
+! Interpreted
+[ "two" ] [ 2 \ case-test-1 word-def call ] unit-test
+
+[ "x" case-test-1 ] unit-test-fails
+
+: case-test-2
+    {
+        { 1 [ "one" ] }
+        { 2 [ "two" ] }
+        { 3 [ "three" ] }
+        { 4 [ "four" ] }
+        [ sq ]
+    } case ;
+
+[ 25 ] [ 5 case-test-2 ] unit-test
+
+! Interpreted
+[ 25 ] [ 5 \ case-test-2 word-def call ] unit-test
+
+: case-test-3
+    {
+        { 1 [ "one" ] }
+        { 2 [ "two" ] }
+        { 3 [ "three" ] }
+        { 4 [ "four" ] }
+        { H{ } [ "a hashtable" ] }
+        { { 1 2 3 } [ "an array" ] }
+        [ sq ]
+    } case ;
+
+[ "an array" ] [ { 1 2 3 } case-test-3 ] unit-test
+
+! Interpreted
+[ "a hashtable" ] [ H{ } \ case-test-3 word-def call ] unit-test
diff --git a/core/combinators/combinators.factor b/core/combinators/combinators.factor
new file mode 100644 (file)
index 0000000..cda1d41
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: combinators
+USING: arrays sequences sequences.private math.private
+kernel kernel.private math assocs quotations vectors ;
+
+<PRIVATE
+
+: dispatch ( n array -- ) array-nth (call) ;
+
+PRIVATE>
+
+TUPLE: no-cond ;
+
+: no-cond ( -- * ) \ no-cond construct-empty throw ;
+
+: cond ( assoc -- )
+    [ first call ] find nip dup [ second call ] [ no-cond ] if ;
+
+TUPLE: no-case ;
+
+: no-case ( -- * ) \ no-case construct-empty throw ;
+
+: case ( obj assoc -- )
+    [ dup array? [ dupd first = ] [ quotation? ] if ] find nip
+    {
+        { [ dup array? ] [ nip second call ] }
+        { [ dup quotation? ] [ call ] }
+        { [ dup not ] [ no-case ] }
+    } cond ;
+
+: with-datastack ( stack quot -- newstack )
+    datastack >r
+    >r >array set-datastack r> call
+    datastack r> swap add set-datastack 2nip ; inline
+
+: recursive-hashcode ( n obj quot -- code )
+    pick 0 <= [ 3drop 0 ] [ rot 1- -rot call ] if ; inline
+
+M: sequence hashcode*
+    [
+        0 -rot [ hashcode* bitxor ] curry* each
+    ] recursive-hashcode ;
+
+: alist>quot ( default assoc -- quot )
+    [ rot \ if 3array append [ ] like ] assoc-each ;
+
+: cond>quot ( assoc -- quot )
+    reverse [ no-cond ] swap alist>quot ;
+
+: case>quot ( default assoc -- quot )
+    [ >r [ dupd = ] curry r> \ drop add* ] assoc-map
+    alist>quot ;
+
+: (distribute-buckets) ( buckets pair keys -- )
+    dup t eq? [
+        drop [ swap push-new ] curry each
+    ] [
+        [
+            >r 2dup r> hashcode pick length rem rot nth push-new
+        ] each 2drop
+    ] if ;
+
+: <buckets> ( initial length -- array )
+    next-power-of-2 swap [ nip clone ] curry map ;
+
+: distribute-buckets ( assoc initial quot -- buckets )
+    swap rot [ length <buckets> ] keep
+    [ >r 2dup r> dup first roll call (distribute-buckets) ] each
+    nip ; inline
+
+: hash-case-table ( default assoc -- array )
+    V{ } [ 1array ] distribute-buckets
+    [ case>quot ] curry* map ;
+
+: hash-dispatch-quot ( table -- quot )
+    [ length 1- [ fixnum-bitand ] curry ] keep
+    [ dispatch ] curry append ;
+
+: hash-case>quot ( default assoc -- quot )
+    dup empty? [
+        drop
+    ] [
+        hash-case-table hash-dispatch-quot
+        [ dup hashcode >fixnum ] swap append
+    ] if ;
diff --git a/core/combinators/summary.txt b/core/combinators/summary.txt
new file mode 100644 (file)
index 0000000..9346bba
--- /dev/null
@@ -0,0 +1 @@
+Complex conditionals (cond, case) and support words for quotation construction
diff --git a/core/command-line/authors.txt b/core/command-line/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/command-line/command-line-docs.factor b/core/command-line/command-line-docs.factor
new file mode 100644 (file)
index 0000000..0c9bbd1
--- /dev/null
@@ -0,0 +1,113 @@
+USING: help.markup help.syntax parser vocabs.loader strings ;
+IN: command-line
+
+ARTICLE: "runtime-cli-args" "Command line switches for the VM"
+"A handful of command line switches are processed by the VM and not the library. They control low-level features."
+{ $table
+    { { $snippet "-i=" { $emphasis "image" } } "Specifies the image file to use" }
+    { { $snippet "-datastack=" { $emphasis "n" } } "Data stack size, kilobytes" }
+    { { $snippet "-retainstack=" { $emphasis "n" } } "Retain stack size, kilobytes" }
+    { { $snippet "-generations=" { $emphasis "n" } } "Number of generations, must be >= 2" }
+    { { $snippet "-young=" { $emphasis "n" } } { "Size of " { $snippet { $emphasis "n" } "-1" } " youngest generations, megabytes" } }
+    { { $snippet "-aging=" { $emphasis "n" } } "Size of tenured and semi-spaces, megabytes" }
+    { { $snippet "-codeheap=" { $emphasis "n" } } "Code heap size, megabytes" }
+    { { $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)." ;
+
+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:"
+{ $table
+    { { $snippet "-output-image=" { $emphasis "image" } } { "Save the result to " { $snippet "image" } ". The default is " { $snippet "factor.image" } "." } }
+    { { $snippet "-no-user-init" } { "Inhibits the running of the " { $snippet ".factor-boot-rc" } " file in the user's home directory." } }
+    { { $snippet "-include=" { $emphasis "components..." } } "A list of components to include (see below)." }
+    { { $snippet "-exclude=" { $emphasis "components..." } } "A list of components to exclude." }
+    { { $snippet "-ui-backend=" { $emphasis "backend" } } { "One of " { $snippet "x11" } ", " { $snippet "windows" } ", or " { $snippet "cocoa" } ". The default is platform-specific." } }
+}
+"Bootstrap can load various optional components:"
+{ $table
+    { { $snippet "compiler" } "The compiler." }
+    { { $snippet "tools" } "Terminal-based developer tools." }
+    { { $snippet "help" } "The help system." }
+    { { $snippet "ui" } "The graphical user interface." }
+    { { $snippet "ui.tools" } "Graphical developer tools." }
+    { { $snippet "io" } "Non-blocking I/O and networking." }
+}
+"By default, all optional components are loaded. To load all optional components except for a given list, use the " { $snippet "-exclude=" } " switch; to only load specified optional components, use the " { $snippet "-include=" } "."
+$nl
+"For example, to build an image with the compiler but no other components, you could do:"
+{ $code "./factor -i=boot.ppc.image -include=compiler" }
+"To build an image with everything except for the user interface and graphical tools,"
+{ $code "./factor -i=boot.ppc.image -exclude=\"ui ui.tools\"" }
+"To generate a bootstrap image in the first place, see " { $link "bootstrap.image" } "." ;
+
+ARTICLE: "standard-cli-args" "Command line switches for general usage"
+"The following command line switches can be passed to a bootstrapped Factor image:"
+{ $table
+    { { $snippet "-e=" { $emphasis "code" } } { "This specifies a code snippet to evaluate. If you want Factor to exit immediately after, also specify " { $snippet "-run=none" } "." } }
+    { { $snippet "-run=" { $emphasis "vocab" } } { { $snippet { $emphasis "vocab" } } " is the name of a vocabulary with a " { $link POSTPONE: MAIN: } " hook to run on startup, for example " { $vocab-link "listener" } ", " { $vocab-link "ui" } " or " { $vocab-link "none" } "." } }
+    { { $snippet "-no-user-init" } { "Inhibits the running of the " { $snippet ".factor-rc" } " file in the user's home directory on startup." } }
+    { { $snippet "-quiet" } { "If set, " { $link run-file } " and " { $link require } " will not print load messages." } }
+    { { $snippet "-script" } { "Equivalent to " { $snippet "-quiet -run=none" } "." $nl "On Unix systems, Factor can be used for scripting - just create an executable text file whose first line is:" { $code "#! /usr/local/bin/factor -script" } "The space after " { $snippet "#!" } " is necessary because of Factor syntax." } }
+} ;
+
+ARTICLE: "cli" "Command line usage"
+"Unless the " { $snippet "-no-user-init" } " command line switch is specified, The startup routine runs the " { $snippet ".factor-rc" } " file in the user's home directory, if it exists. This file can contain initialization and customization for your development environment."
+$nl
+"Zero or more command line arguments may be passed to the Factor runtime. Command line arguments starting with a dash (" { $snippet "-" } ") is interpreted as switches. All other arguments are taken to be file names to be run by " { $link run-file } "."
+$nl
+"Switches can take one of the following three forms:"
+{ $list
+    { { $snippet "-" { $emphasis "foo" } } " - sets the global variable " { $snippet "\"" { $emphasis "foo" } "\"" } " to " { $link t } }
+    { { $snippet "-no-" { $emphasis "foo" } } " - sets the global variable " { $snippet "\"" { $emphasis "foo" } "\"" } " to " { $link f } }
+    { { $snippet "-" { $emphasis "foo" } "=" { $emphasis "bar" } } " - sets the global variable " { $snippet "\"" { $emphasis "foo" } "\"" } " to " { $snippet "\"" { $emphasis "bar" } "\"" } }
+}
+{ $subsection "runtime-cli-args" }
+{ $subsection "bootstrap-cli-args" }
+{ $subsection "standard-cli-args" }
+"The list of command line arguments can be obtained and inspected directly:"
+{ $subsection cli-args }
+"The " { $snippet ".factor-rc" } " and " { $snippet ".factor-boot-rc" } " files can be run explicitly:"
+{ $subsection run-user-init }
+{ $subsection run-bootstrap-init }
+"There is a way to override the default vocabulary to run on startup:"
+{ $subsection main-vocab-hook } ;
+
+ABOUT: "cli"
+
+HELP: run-bootstrap-init
+{ $description "Runs the " { $snippet ".factor-boot-rc" } " file in the user's home directory unless the " { $snippet "-no-user-init" } " command line switch was given." } ;
+
+HELP: run-user-init
+{ $description "Runs the " { $snippet ".factor-rc" } " file in the user's home directory unless the " { $snippet "-no-user-init" } " command line switch was given." } ;
+
+HELP: cli-param
+{ $values { "param" string } }
+{ $description "Process a command-line switch."
+$nl
+"If the parameter contains " { $snippet "=" } ", the global variable named by the string before the equals sign is set to the string after the equals sign."
+$nl
+"If the parameter begins with " { $snippet "no-" } ", sets the global variable named by the parameter with the prefix removed to " { $link f } "."
+$nl
+"Otherwise, sets the global variable named by the parameter to " { $link t } "." } ;
+
+HELP: cli-args
+{ $values { "args" "a sequence of strings" } }
+{ $description "Outputs the command line parameters which were passed to the Factor VM on startup." } ;
+
+HELP: main-vocab-hook
+{ $var-description "Global variable holding a quotation which outputs a vocabulary name. UI backends set this so that the UI can automatically start if the prerequisites are met (for example, " { $snippet "$DISPLAY" } " being set on X11)." } ;
+
+HELP: main-vocab
+{ $values { "vocab" string } }
+{ $description "Outputs the name of the vocabulary which is to be run on startup using the " { $link run } " word. The " { $snippet "-run" } " command line switch overrides this setting." } ;
+
+HELP: default-cli-args
+{ $description "Sets global variables corresponding to default command line arguments." } ;
+
+HELP: ignore-cli-args?
+{ $values { "?" "a boolean" } }
+{ $description "On Mac OS X, source files to run are supplied by the Cocoa API, so to avoid running them twice the startup code has to call this word." } ;
+
+HELP: parse-command-line
+{ $description "Called on startup to process command line arguments. This sets global variables with " { $link cli-param } ", runs source files, and evaluates the string given by the " { $snippet "-e" } " switch, if there is one." } ;
diff --git a/core/command-line/command-line-tests.factor b/core/command-line/command-line-tests.factor
new file mode 100644 (file)
index 0000000..c4221b0
--- /dev/null
@@ -0,0 +1,12 @@
+USING: namespaces tools.test kernel command-line ;
+IN: temporary
+
+[
+    [ f ] [ "-no-user-init" cli-arg ] unit-test
+    [ f ] [ "user-init" get ] unit-test
+
+    [ f ] [ "-user-init" cli-arg ] unit-test
+    [ t ] [ "user-init" get ] unit-test
+    
+    [ "sdl.factor" ] [ "sdl.factor" cli-arg ] unit-test
+] with-scope
diff --git a/core/command-line/command-line.factor b/core/command-line/command-line.factor
new file mode 100644 (file)
index 0000000..ed4fb9f
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: command-line
+USING: init continuations debugger hashtables io kernel
+kernel.private namespaces parser sequences strings system
+splitting io.files ;
+
+: run-bootstrap-init ( -- )
+    "user-init" get [
+        home ".factor-boot-rc" path+ ?run-file
+    ] when ;
+
+: run-user-init ( -- )
+    "user-init" get [
+        home ".factor-rc" path+ ?run-file
+    ] when ;
+
+: cli-var-param ( name value -- ) swap set-global ;
+
+: cli-bool-param ( name -- ) "no-" ?head not cli-var-param ;
+
+: cli-param ( param -- )
+    "=" split1 [ cli-var-param ] [ cli-bool-param ] if* ;
+
+: cli-arg ( argument -- argument )
+    "-" ?head [ cli-param f ] when ;
+
+: cli-args ( -- args ) 10 getenv ;
+
+SYMBOL: main-vocab-hook
+
+: main-vocab ( -- vocab )
+    embedded? [
+        "alien.remote-control"
+    ] [
+        main-vocab-hook get [ call ] [ "listener" ] if*
+    ] if ;
+
+: default-cli-args
+    global [
+        "quiet" off
+        "script" off
+        "e" off
+        "user-init" on
+        embedded? "quiet" set
+        main-vocab "run" set
+    ] bind ;
+
+: ignore-cli-args? ( -- ? )
+    macosx? "run" get "ui" = and ;
+
+: script-mode ( -- )
+    t "quiet" set-global
+    "none" "run" set-global ;
+
+: parse-command-line ( -- )
+    cli-args [ cli-arg ] subset
+    "script" get [ script-mode ] when
+    ignore-cli-args? [ drop ] [ [ run-file ] each ] if
+    "e" get [ eval ] when* ;
+
+[ default-cli-args ] "command-line" add-init-hook
diff --git a/core/command-line/summary.txt b/core/command-line/summary.txt
new file mode 100644 (file)
index 0000000..3f1ff87
--- /dev/null
@@ -0,0 +1 @@
+Command line argument parsing
diff --git a/core/compiler/alien/alien-callback.factor b/core/compiler/alien/alien-callback.factor
deleted file mode 100644 (file)
index 5135049..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-USING: compiler errors generic hashtables inference
-kernel namespaces sequences strings words parser prettyprint
-kernel-internals ;
-
-! Callbacks are registered in a global hashtable. If you clear
-! this hashtable, they will all be blown away by code GC, beware
-SYMBOL: callbacks
-
-H{ } clone callbacks set-global
-
-: register-callback ( word -- ) dup callbacks get set-hash ;
-
-TUPLE: alien-callback return parameters quot xt ;
-C: alien-callback make-node ;
-
-TUPLE: alien-callback-error ;
-
-: alien-callback ( return parameters quot -- alien )
-    <alien-callback-error> throw ;
-
-M: alien-callback-error summary
-    drop "Words calling ``alien-callback'' cannot run in the interpreter. Compile the caller word and try again." ;
-
-: callback-bottom ( node -- )
-    alien-callback-xt [ word-xt <alien> ] curry infer-quot ;
-
-\ alien-callback [ string object quotation ] [ alien ] <effect>
-"inferred-effect" set-word-prop
-
-\ alien-callback [
-    empty-node <alien-callback> dup node,
-    pop-literal nip over set-alien-callback-quot
-    pop-literal nip over set-alien-callback-parameters
-    pop-literal nip over set-alien-callback-return
-    gensym dup register-callback over set-alien-callback-xt
-    callback-bottom
-] "infer" set-word-prop
-
-: box-parameters ( parameters -- )
-    [ c-type c-type-box ] each-parameter ;
-
-: registers>objects ( parameters -- )
-    dup \ %freg>stack move-parameters
-    "nest_stacks" f %alien-invoke box-parameters ;
-
-: unbox-return ( node -- )
-    alien-callback-return [
-        "unnest_stacks" f %alien-invoke
-    ] [
-        c-type dup c-type-reg-class
-        swap c-type-unboxer
-        %callback-value
-    ] if-void ;
-
-: alien-callback-quot* ( node -- quot )
-    [
-        \ init-error-handler ,
-        dup alien-callback-quot %
-        alien-callback-return
-        [ ] [ c-type c-type-prep % ] if-void
-    ] [ ] make ;
-
-: generate-callback ( node -- )
-    [ alien-callback-xt ] keep [
-        dup alien-callback-parameters registers>objects
-        dup alien-callback-quot* %alien-callback
-        unbox-return
-        %return
-    ] generate-1 ;
-
-M: alien-callback generate-node
-    end-basic-block generate-callback iterate-next ;
-
-M: alien-callback stack-reserve*
-    alien-callback-parameters stack-space ;
diff --git a/core/compiler/alien/alien-callback.facts b/core/compiler/alien/alien-callback.facts
deleted file mode 100644 (file)
index 316f5fb..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-IN: alien
-USING: errors help ;
-
-HELP: alien-callback-error
-{ $error-description "Thrown when " { $link alien-callback } " is called in the interpreter.  Words using " { $link alien-callback } " must be compiled first, and all three inputs to " { $link alien-callback } " must be literals." } ;
-
-HELP: alien-callback
-{ $values { "return" "a C return type" } { "parameters" "a sequence of C parameter types" } { "quot" "a quotation" } { "alien" "an alien address" } }
-{ $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."
-    $terpri
-    "When a compiled reference to this word is called, it pushes the callback's alien address on the data stack. This address can be passed to any C function expecting a C function pointer with the correct signature. The callback is actually generated when the word calling " { $link alien-callback } " is compiled."
-    $terpri
-    "Callback quotations run with freshly-allocated stacks. This means the data stack contains the values passed by the C function, and nothing else. It also means that if the callback throws an error which is not caught, the Factor runtime will halt. See " { $link "errors" } " for error handling options."
-}
-{ $examples
-    "A simple example, showing a C function which returns the difference of two given integers:"
-    { $code
-        ": difference-callback ( -- alien )"
-        "    \"int\" { \"int\" \"int\" } [ - ] alien-callback ;"
-    }
-}
-{ $errors "Throws an " { $link alien-callback-error } " if the word calling " { $link alien-callback } " is not compiled." }
-{ $see-also alien-invoke alien-indirect } ;
diff --git a/core/compiler/alien/alien-indirect.factor b/core/compiler/alien/alien-indirect.factor
deleted file mode 100644 (file)
index 83b6ece..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-USING: compiler errors generic hashtables inference
-kernel namespaces sequences strings words parser prettyprint ;
-
-TUPLE: alien-indirect return parameters abi ;
-C: alien-indirect make-node ;
-
-M: alien-indirect alien-invoke-parameters alien-indirect-parameters ;
-M: alien-indirect alien-invoke-return alien-indirect-return ;
-M: alien-indirect alien-invoke-abi alien-indirect-abi ;
-
-TUPLE: alien-indirect-error ;
-
-: alien-indirect ( funcptr args... return parameters abi -- )
-    <alien-indirect-error> throw ;
-
-M: alien-indirect-error summary
-    drop "Words calling ``alien-indirect'' cannot run in the interpreter. Compile the caller word and try again." ;
-
-\ alien-indirect [ string object string ] [ ] <effect>
-"inferred-effect" set-word-prop
-
-: alien-indirect-stack ( node -- )
-    1 over consume-values
-    alien-invoke-stack ;
-
-\ alien-indirect [
-    empty-node <alien-indirect>
-    pop-literal nip over set-alien-indirect-abi
-    pop-literal nip over set-alien-indirect-parameters
-    pop-literal nip over set-alien-indirect-return
-    dup alien-indirect-parameters
-    make-prep-quot 1 make-dip infer-quot
-    dup node,
-    alien-indirect-stack
-] "infer" set-word-prop
-
-M: alien-indirect generate-node
-    end-basic-block
-    %prepare-alien-indirect
-    dup alien-indirect-parameters objects>registers
-    %alien-indirect
-    dup generate-invoke-cleanup
-    alien-indirect-return box-return
-    iterate-next ;
-
-M: alien-indirect stack-reserve*
-    alien-indirect-parameters stack-space ;
diff --git a/core/compiler/alien/alien-indirect.facts b/core/compiler/alien/alien-indirect.facts
deleted file mode 100644 (file)
index 084138f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-IN: alien
-USING: errors help ;
-
-HELP: alien-indirect-error
-{ $error-description "Thrown when " { $link alien-indirect } " is called in the interpreter.  Words using " { $link alien-indirect } " must be compiled first, and all three inputs to " { $link alien-indirect } " must be literals." } ;
-
-HELP: alien-indirect
-{ $values { "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\"" } } }
-{ $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 " { $snippet "\"void\"" } " indicates that no value is to be expected."
-}
-{ $errors "Throws an " { $link alien-indirect-error } " if the word calling " { $link alien-indirect } " is not compiled." }
-{ $see-also alien-invoke alien-callback } ;
diff --git a/core/compiler/alien/alien-invoke.factor b/core/compiler/alien/alien-invoke.factor
deleted file mode 100644 (file)
index 7459e0d..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-USING: arrays assembler compiler errors generic hashtables
-inference io kernel kernel-internals math namespaces parser
-prettyprint sequences strings words ;
-
-TUPLE: alien-invoke library function return parameters ;
-
-GENERIC: alien-invoke-abi ( node -- string )
-
-M: alien-invoke alien-invoke-abi
-    alien-invoke-library library-abi ;
-
-C: alien-invoke make-node ;
-
-: alien-invoke-stack ( node -- )
-    dup alien-invoke-parameters over consume-values
-    dup alien-invoke-return "void" = 0 1 ? swap produce-values ;
-
-: alien-invoke-dlsym ( node -- symbol dll )
-    dup alien-invoke-function swap alien-invoke-library
-    load-library ;
-
-TUPLE: alien-invoke-error library symbol ;
-
-M: alien-invoke-error summary
-    drop "Words calling ``alien-invoke'' cannot run in the interpreter. Compile the caller word and try again." ;
-
-: alien-invoke ( ... return library function parameters -- ... )
-    pick pick <alien-invoke-error> throw ;
-
-: ensure-dlsym ( node -- )
-    [ alien-invoke-dlsym dlsym drop ]
-    [ inference-warning ] recover ;
-
-\ alien-invoke [ string object string object ] [ ] <effect>
-"inferred-effect" set-word-prop
-
-\ alien-invoke [
-    empty-node <alien-invoke>
-    pop-literal nip over set-alien-invoke-parameters
-    pop-literal nip over set-alien-invoke-function
-    pop-literal nip over set-alien-invoke-library
-    pop-literal nip over set-alien-invoke-return
-    dup alien-invoke-parameters make-prep-quot infer-quot
-    dup ensure-dlsym
-    dup node,
-    alien-invoke-stack
-] "infer" set-word-prop
-
-: unbox-parameters ( parameters -- )
-    [ c-type c-type-unbox ] reverse-each-parameter ;
-
-: objects>registers ( parameters -- )
-    #! Generate code for boxing a list of C types, then generate
-    #! code for moving these parameters to register on
-    #! architectures where parameters are passed in registers
-    #! (PowerPC, AMD64).
-    dup unbox-parameters
-    "save_stacks" f %alien-invoke
-    \ %stack>freg move-parameters ;
-
-: box-return ( ctype -- )
-    [ ] [ f swap c-type c-type-box ] if-void ;
-
-: generate-invoke-cleanup ( node -- )
-    dup alien-invoke-abi "stdcall" = [
-        drop
-    ] [
-        alien-invoke-parameters stack-space %cleanup
-    ] if ;
-
-M: alien-invoke generate-node
-    end-basic-block
-    dup alien-invoke-parameters objects>registers
-    dup alien-invoke-dlsym %alien-invoke
-    dup generate-invoke-cleanup
-    alien-invoke-return box-return
-    iterate-next ;
-
-M: alien-invoke stack-reserve*
-    alien-invoke-parameters stack-space ;
-
-: parse-arglist ( return seq -- types effect )
-    2 group unpair
-    rot dup "void" = [ drop { } ] [ 1array ] if <effect> ;
-
-: (define-c-word) ( type lib func types stack-effect -- )
-    >r over create-in dup reset-generic >r 
-    [ alien-invoke ] curry curry curry curry
-    r> swap define-compound word r>
-    "declared-effect" set-word-prop ;
-
-: define-c-word ( return library function parameters -- )
-    [ "()" subseq? not ] subset >r pick r> parse-arglist
-    (define-c-word) ;
diff --git a/core/compiler/alien/alien-invoke.facts b/core/compiler/alien/alien-invoke.facts
deleted file mode 100644 (file)
index 8dfcc21..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-IN: alien
-USING: help ;
-
-HELP: alien-invoke-error
-{ $error-description "Thrown when " { $link alien-invoke } " is called in the interpreter.  Words using " { $link alien-invoke } " must be compiled first, and all four inputs to " { $link alien-invoke } " must be literals." } ;
-
-HELP: alien-invoke
-{ $values { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } }
-{ $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 " { $snippet "\"void\"" } " indicates that no value is to be expected." }
-{ $errors "Throws an " { $link alien-invoke-error } " if the word calling " { $link alien-invoke } " is not compiled." }
-{ $see-also alien-indirect alien-callback } ;
-
-HELP: define-c-word
-{ $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." } ;
diff --git a/core/compiler/alien/aliens.factor b/core/compiler/alien/aliens.factor
deleted file mode 100644 (file)
index d39402e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-USING: arrays hashtables io kernel math namespaces parser
-sequences ;
-
-: <alien> ( address -- alien ) f <displaced-alien> ; inline
-
-UNION: c-ptr byte-array alien POSTPONE: f ;
-
-M: alien equal?
-    over alien? [
-        2dup [ expired? ] 2apply 2dup or [
-            2swap 2drop
-        ] [
-            2drop [ alien-address ] 2apply
-        ] if =
-    ] [
-        2drop f
-    ] if ;
-
-global [ "libraries" nest drop ] bind
-
-: library ( name -- library ) "libraries" get hash ;
-
-: load-library ( name -- dll )
-    library dup [
-        [
-            "dll" get dup [
-                drop "name" get dlopen dup "dll" set
-            ] unless
-        ] bind
-    ] when ;
-
-: add-library ( name path abi -- )
-    "libraries" get [
-        [ "abi" set "name" set ] make-hash swap set
-    ] bind ;
-
-: library-abi ( library -- abi )
-    library "abi" swap ?hash [ "cdecl" ] unless* ;
diff --git a/core/compiler/alien/aliens.facts b/core/compiler/alien/aliens.facts
deleted file mode 100644 (file)
index 595ae01..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-IN: alien
-USING: arrays help ;
-
-HELP: alien
-{ $class-description "The class of alien pointers. See " { $link "syntax-aliens" } " for syntax and " { $link "c-data" } " for general information." } ;
-
-HELP: dll
-{ $class-description "The class of native library handles. See " { $link "syntax-aliens" } " for syntax and " { $link "dll-internals" } " for general information." } ;
-
-HELP: expired? ( c-ptr -- ? )
-{ $values { "c-ptr" "an alien, byte array, or " { $link f } } { "?" "a boolean" } }
-{ $description "Tests if the alien is a relic from an earlier session. When an image is loaded, any alien objects which persisted in the image are marked as being expired."
-$terpri
-"A byte array is never considered to be expired, whereas passing " { $link f } " always yields true." } ;
-
-HELP: <displaced-alien> ( displacement c-ptr -- alien )
-{ $values { "displacement" "an integer" } { "c-ptr" "an alien, byte array, or " { $link f } } { "alien" "a new alien" } }
-{ $description "Creates a new alien address object, wrapping a raw memory address. The alien points to a location in memory which is offset by " { $snippet "displacement" } " from the address of " { $snippet "c-ptr" } "." }
-{ $notes "Passing a value of " { $link f } " for " { $snippet "c-ptr" } " creates an alien with an absolute address; this is how " { $link <alien> } " is implemented."
-$terpri
-"Passing a zero absolute address does not construct a new alien object, but instead makes the word output " { $link f } "." }
-{ $see-also <alien> alien-address } ;
-
-HELP: alien-address ( c-ptr -- addr )
-{ $values { "c-ptr" "an alien or " { $link f } } { "addr" "a non-negative integer" } }
-{ $description "Outputs the address of an alien." }
-{ $notes "Taking the address of a " { $link byte-array } " is explicitly prohibited since byte arrays can be moved by the garbage collector between the time the address is taken, and when it is accessed. If you need to pass pointers to C functions which will persist across alien calls, you must allocate unmanaged memory instead. See " { $link "malloc" } "." } ;
-
-HELP: <alien>
-{ $values { "address" "a non-negative integer" } { "alien" "a new alien address" } }
-{ $description "Creates an alien object, wrapping a raw memory address." }
-{ $notes "Alien objects are invalidated between image saves and loads." }
-{ $see-also <displaced-alien> alien-address } ;
-
-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*" } "." } ;
-
-HELP: library
-{ $values { "name" "a string" } { "library" "a hashtable" } }
-{ $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 "dll" } " - an instance of the " { $link dll } " class; only set if the library is loaded" }
-    }
-} ;
-
-HELP: dlopen ( path -- dll )
-{ $values { "path" "a path name string" } { "dll" "a DLL handle" } }
-{ $description "Opens a native library and outputs a handle which may be passed to " { $link dlsym } " or " { $link dlclose } "." }
-{ $errors "Throws an error if the library could not be found, or if loading fails for some other reason." }
-{ $notes "This is the low-level facility used to implement " { $link load-library } ". Use the latter instead." } ;
-
-HELP: dlsym ( name dll -- alien )
-{ $values { "name" "a C symbol name" } { "dll" "a DLL handle" } { "alien" "an alien pointer" } }
-{ $description "Looks up a symbol in a native library. If " { $snippet "dll" } " is " { $link f } " looks for the symbol in the runtime executable." }
-{ $errors "Throws an error if the symbol could not be found." } ;
-
-HELP: dlclose ( dll -- )
-{ $values { "dll" "a DLL handle" } }
-{ $description "Closes a DLL handle created by " { $link dlopen } ". This word might not be implemented on all platforms." } ;
-
-HELP: load-library
-{ $values { "name" "a string" } { "dll" "a DLL handle" } }
-{ $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." }
-{ $errors "Throws an error if the library could not be found, or if loading fails for some other reason." } ;
-
-HELP: add-library
-{ $values { "name" "a string" } { "path" "a string" } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } }
-{ $description "Defines a new logical library named " { $snippet "name" } " located in the file system at " { $snippet "path" } "and the specified ABI." }
-{ $examples { $code "\"gif\" \"libgif.so\" \"cdecl\" add-library" } } ;
diff --git a/core/compiler/alien/c-types.factor b/core/compiler/alien/c-types.factor
deleted file mode 100644 (file)
index 9bf8546..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-USING: arrays compiler errors generic
-hashtables kernel kernel-internals libc math namespaces
-parser sequences strings words ;
-
-TUPLE: c-type
-boxer prep unboxer
-getter setter
-reg-class size align ;
-
-C: c-type ( -- type )
-    T{ int-regs f } over set-c-type-reg-class ;
-
-SYMBOL: c-types
-
-TUPLE: no-c-type name ;
-: no-c-type ( type -- * ) <no-c-type> throw ;
-
-: c-type ( name -- type )
-    dup c-types get hash [ ] [ no-c-type ] ?if ;
-
-GENERIC: c-type-unbox ( n type -- )
-
-M: c-type c-type-unbox
-    dup c-type-reg-class swap c-type-unboxer %unbox ;
-
-GENERIC: c-type-box ( n type -- )
-
-M: c-type c-type-box
-    dup c-type-reg-class swap c-type-boxer %box ;
-
-: c-size ( name -- size ) c-type c-type-size ;
-
-: c-getter ( name -- quot ) c-type c-type-getter ;
-
-: c-setter ( name -- quot ) c-type c-type-setter ;
-
-: <c-array> ( n type -- array )
-    global [ c-size * <byte-array> ] bind ;
-
-: <c-object> ( type -- array ) 1 swap <c-array> ;
-
-: <malloc-array> ( n type -- alien )
-    global [ c-size calloc ] bind check-ptr ;
-
-: <malloc-object> ( type -- alien ) 1 swap <malloc-array> ;
-
-: <malloc-string> ( string -- alien )
-    0 add dup length malloc check-ptr
-    [ alien-address string>memory ] keep ;
-
-: (typedef) ( old new -- ) c-types get [ >r get r> set ] bind ;
-
-: define-pointer ( type -- ) "*" append "void*" swap (typedef) ;
-
-: define-deref ( name vocab -- )
-    >r dup "*" swap append r> create
-    swap c-getter 0 add* define-compound ;
-
-: (define-nth) ( word type quot -- )
-    >r c-size [ rot * ] swap add* r> append define-compound ;
-
-: define-nth ( name vocab -- )
-    >r dup "-nth" append r> create
-    swap dup c-getter (define-nth) ;
-
-: define-set-nth ( name vocab -- )
-    >r "set-" over "-nth" 3append r> create
-    swap dup c-setter (define-nth) ;
-
-: define-out ( name vocab -- )
-    over [ <c-object> tuck 0 ] over c-setter append swap
-    >r >r constructor-word r> r> add* define-compound ;
-
-: init-c-type ( name vocab -- )
-    over define-pointer define-nth ;
-
-: <primitive-type> ( getter setter width boxer unboxer -- type )
-    <c-type>
-    [ set-c-type-unboxer ] keep
-    [ set-c-type-boxer ] keep
-    [ set-c-type-size ] 2keep
-    [ set-c-type-align ] keep
-    [ set-c-type-setter ] keep
-    [ set-c-type-getter ] keep ;
-
-: define-c-type ( type name vocab -- )
-    >r [ c-types get set-hash ] keep r>
-    over define-pointer
-    define-nth ;
-
-: define-primitive-type ( getter setter width boxer unboxer name -- )
-    >r <primitive-type> r> "alien"
-    [ define-c-type ] 2keep
-    [ define-deref ] 2keep
-    [ define-set-nth ] 2keep
-    define-out ;
-
-: typedef ( old new -- )
-    over "*" append over "*" append (typedef) (typedef) ;
diff --git a/core/compiler/alien/c-types.facts b/core/compiler/alien/c-types.facts
deleted file mode 100644 (file)
index e9d2ac8..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-IN: alien
-USING: help libc kernel-internals ;
-
-HELP: <c-type>
-{ $values { "type" "a hashtable" } }
-{ $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 { "type" "a string" } }
-{ $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 string" } { "type" "a hashtable" } }
-{ $description "Looks up a C type by name." }
-{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
-
-HELP: c-size
-{ $values { "name" "a string" } { "size" "an integer" } }
-{ $description "Outputs the number of bytes taken up by this C type." }
-{ $examples
-    "On a 32-bit system, you will get the following output:"
-    { $example "USE: alien\n\"void*\" c-size ." "4" }
-}
-{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
-
-HELP: c-getter
-{ $values { "name" "a string" } { "quot" "a quotation with stack effect " { $snippet "( c-ptr n -- obj )" } } }
-{ $description "Outputs a quotation which reads values of this C type from a C structure." }
-{ $errors "Throws a " { $link no-c-type } " error if the type does not exist." } ;
-
-HELP: c-setter
-{ $values { "name" "a string" } { "quot" "a quotation with stack effect " { $snippet "( 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: <c-array>
-{ $values { "n" "a non-negative integer" } { "type" "a string" } { "array" "a byte array" } }
-{ $description "Creates a byte array large enough to hold " { $snippet "n" } " values of a C type." }
-{ $errors "Throws an error if the type does not exist or the requested size is negative." } 
-{ $see-also <malloc-array> } ;
-
-HELP: <c-object>
-{ $values { "type" "a string" } { "array" "a byte array" } }
-{ $description "Creates a byte array suitable for holding a value with the given C type." }
-{ $errors "Throws an error if the type does not exist." }
-{ $see-also <malloc-object> } ;
-
-HELP: string>char-alien ( string -- array )
-{ $values { "string" "a string" } { "array" "a byte array" } }
-{ $description "Copies the string to a new byte array, converting it to 8-bit ASCII and adding a trailing null byte." }
-{ $errors "Throws an error if the string contains null characters, or characters beyond the 8-bit range." } 
-{ $see-also alien>char-string <malloc-string> } ;
-
-HELP: alien>char-string ( c-ptr -- string )
-{ $values { "c-ptr" "an alien, byte array or " { $link f } } { "string" "a string" } }
-{ $description "Reads a null-terminated 8-bit C string from the specified address." }
-{ $see-also string>char-alien } ;
-
-HELP: string>u16-alien ( string -- array )
-{ $values { "string" "a string" } { "array" "a byte array" } }
-{ $description "Copies the string to a new byte array in UTF16 format with a trailing null byte." }
-{ $errors "Throws an error if the string contains null characters." }
-{ $see-also alien>u16-string } ;
-
-HELP: alien>u16-string ( c-ptr -- string )
-{ $values { "c-ptr" "an alien, byte array or " { $link f } } { "string" "a string" } }
-{ $description "Reads a null-terminated UTF16 string from the specified address." }
-{ $see-also string>u16-alien } ;
-
-HELP: memory>string ( base len -- string )
-{ $values { "base" "an integer address" } { "len" "a non-negative integer" } { "string" "a string" } }
-{ $description "Reads " { $snippet "len" } " bytes starting from " { $snippet "base" } " and stores them in a new Factor string." } ;
-
-HELP: string>memory ( string base -- )
-{ $values { "string" "a string" } { "base" "an integer address" } }
-{ $description "Writes the string to memory starting from the " { $snippet "base" } " address." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is unsafe. Improper use can corrupt memory." } ;
-
-HELP: <malloc-array>
-{ $values { "n" "a non-negative integer" } { "type" "a string" } { "alien" "an alien address" } }
-{ $description "Allocates an unmanaged memory block large enough to hold " { $snippet "n" } " values of a C type." }
-{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
-{ $errors "Throws an error if the type does not exist, if the requested size is negative, or if memory allocation fails." }
-{ $see-also <c-array> } ;
-
-HELP: <malloc-object>
-{ $values { "type" "a string" } { "alien" "an alien address" } }
-{ $description "Allocates an unmanaged memory block large enough to hold a value of a C type." }
-{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
-{ $errors "Throws an error if the type does not exist or if memory allocation fails." } 
-{ $see-also <c-object> } ;
-
-HELP: <malloc-string>
-{ $values { "string" "a string" } { "alien" "an alien address" } }
-{ $description "Copies a string to an unmanaged memory block large enough to hold a copy of the string in 8-bit ASCII encoding, with a trailing null byte." }
-{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." }
-{ $errors "Throws an error if memory allocation fails." }
-{ $see-also string>char-alien } ;
-
-HELP: (typedef)
-{ $values { "old" "a string" } { "new" "a string" } }
-{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
-{ $notes "You should use the higher-level " { $link POSTPONE: TYPEDEF: } " word instead." }
-{ $see-also typedef POSTPONE: TYPEDEF: }  ;
-
-HELP: define-pointer
-{ $values { "type" "a string" } }
-{ $description "Aliases the C type " { $snippet "type*" } " to " { $snippet "void*" } "." }
-{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
-
-HELP: define-deref
-{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
-{ $description "Defines a word " { $snippet "*name" } " with stack effect " { $snippet "( c-ptr -- value )" } " for reading a value with C type " { $snippet "name" } " stored at an alien pointer." }
-{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
-
-HELP: define-nth
-{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
-{ $description "Defines a word " { $snippet { $emphasis "name" } "-nth" } " with stack effect " { $snippet "( n c-ptr -- value )" } " for reading the value with C type " { $snippet "name" } " stored at an alien pointer, displaced by a multiple of the C type's size." }
-{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
-
-HELP: define-set-nth
-{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
-{ $description "Defines a word " { $snippet "set-" { $emphasis "name" } "-nth" } " with stack effect " { $snippet "( value n c-ptr -- )" } " for writing the value with C type " { $snippet "name" } " to an alien pointer, displaced by a multiple of the C type's size." }
-{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
-
-HELP: define-out
-{ $values { "name" "a word name" } { "vocab" "a vocabulary name" } }
-{ $description "Defines a word " { $snippet "<" { $emphasis "name" } ">" } " with stack effect " { $snippet "( value -- array )" } ". This word allocates a byte array large enough to hold a value with C type " { $snippet "name" } ", and writes the value at the top of the stack to the array." }
-{ $notes "This is an internal word called when defining C types, there is no need to call it on your own." } ;
-
-HELP: typedef
-{ $values { "old" "a string" } { "new" "a string" } }
-{ $description "Alises the C types " { $snippet "old" } " and " { $snippet "old*" } " under the names " { $snippet "new" } " and " { $snippet "new*" } ", respectively." }
-{ $notes "You should use the higher-level " { $link POSTPONE: TYPEDEF: } " word instead." }
-{ $see-also (typedef) POSTPONE: TYPEDEF: } ;
diff --git a/core/compiler/alien/compiler.factor b/core/compiler/alien/compiler.factor
deleted file mode 100644 (file)
index db9dc79..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-USING: arrays compiler generic hashtables kernel
-kernel-internals math namespaces sequences words
-inference ;
-
-: parameter-size c-size cell align ;
-
-: parameter-sizes ( types -- offsets )
-    #! Compute stack frame locations.
-    0 [ parameter-size + ] accumulate nip ;
-
-: stack-space ( parameters -- n )
-    0 [ parameter-size + ] reduce ;
-
-: reg-class-full? ( class -- ? )
-    dup class get swap fastcall-regs length >= ;
-
-: spill-param ( reg-class -- n reg-class )
-    reg-size stack-params dup get -rot +@ T{ stack-params } ;
-
-: fastcall-param ( reg-class -- n reg-class )
-    [ dup class get swap inc-reg-class ] keep ;
-
-: alloc-parameter ( parameter -- reg reg-class )
-    c-type c-type-reg-class dup reg-class-full?
-    [ spill-param ] [ fastcall-param ] if
-    [ fastcall-regs nth ] keep ;
-
-: flatten-value-types ( params -- params )
-    #! Convert value type structs to consecutive void*s.
-    [
-        dup c-struct?
-        [ c-size cell / "void*" <array> ] [ 1array ] if
-    ] map concat ;
-
-: each-parameter ( parameters quot -- )
-    >r [ parameter-sizes ] keep r> 2each ; inline
-
-: reverse-each-parameter ( parameters quot -- )
-    >r [ parameter-sizes ] keep
-    [ <reversed> ] 2apply r> 2each ; inline
-
-: reset-freg-counts ( -- )
-    0 { int-regs float-regs stack-params } [ set ] each-with ;
-
-: move-parameters ( params word -- )
-    #! Moves values from C stack to registers (if word is
-    #! %stack>freg) and registers to C stack (if word is
-    #! %freg>stack).
-    swap [
-        flatten-value-types
-        reset-freg-counts
-        [ pick >r alloc-parameter r> execute ] each-parameter
-        drop
-    ] with-scope ; inline
-
-: if-void ( type true false -- )
-    pick "void" = [ drop nip call ] [ nip call ] if ; inline
-
-: (make-prep-quot) ( parameters -- )
-    dup empty? [
-        drop
-    ] [
-        unclip c-type c-type-prep %
-        \ >r , (make-prep-quot) \ r> ,
-    ] if ;
-
-: make-prep-quot ( parameters -- quot )
-    [ <reversed> (make-prep-quot) ] [ ] make ;
diff --git a/core/compiler/alien/malloc.factor b/core/compiler/alien/malloc.factor
deleted file mode 100644 (file)
index 74a4096..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-! Copyright (C) 2004, 2005 Mackenzie Straight.
-! See http://factorcode.org/license.txt for BSD license.
-IN: libc
-USING: alien errors kernel math prettyprint ;
-
-LIBRARY: libc
-FUNCTION: void* malloc ( ulong size ) ;
-FUNCTION: void* calloc ( ulong count, ulong size ) ;
-FUNCTION: void free ( void* ptr ) ;
-FUNCTION: void* realloc ( void* ptr, ulong size ) ;
-FUNCTION: void memcpy ( void* dst, void* src, ulong size ) ;
-
-TUPLE: check-ptr ;
-
-: check-ptr ( c-ptr -- c-ptr ) [ <check-ptr> throw ] unless* ;
-
-M: check-ptr summary
-    drop "Memory allocation failed" ;
-
-: with-malloc ( size quot -- )
-    swap 1 calloc check-ptr [ swap call ] keep free ; inline
diff --git a/core/compiler/alien/malloc.facts b/core/compiler/alien/malloc.facts
deleted file mode 100644 (file)
index d7346fd..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-IN: libc
-USING: help ;
-
-HELP: malloc ( size -- alien )
-{ $values { "size" "a non-negative integer" } { "alien" "an alien address" } }
-{ $description "Allocates a block of " { $snippet "size" } " bytes from the operating system. The contents of the block are undefined."
-$terpri
-"Outputs " { $link f } " if memory allocation failed, so calls to this word should be followed by a call to " { $link check-ptr } "." }
-{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ;
-
-HELP: calloc ( count size -- alien )
-{ $values { "count" "a non-negative integer" } { "size" "a non-negative integer" } { "alien" "an alien address" } }
-{ $description "Allocates a block of " { $snippet "count * size" } " bytes from the operating system. The contents of the block are initially zero."
-$terpri
-"Outputs " { $link f } " if memory allocation failed, so calls to this word should be followed by a call to " { $link check-ptr } "." }
-{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ;
-
-HELP: realloc ( alien size -- newalien )
-{ $values { "alien" "an alien address" } { "size" "a non-negative integer" } { "newalien" "an alien address" } }
-{ $description "Allocates a new block of " { $snippet "size" } " bytes from the operating system. The contents of " { $snippet "alien" } ", which itself must be a block previously returned by " { $link malloc } " or " { $link realloc } ", are copied into the new block, and the old block is freed."
-$terpri
-"Outputs " { $link f } " if memory allocation failed, so calls to this word should be followed by a call to " { $link check-ptr } "." }
-{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ;
-
-HELP: memcpy ( dst src size -- )
-{ $values { "dst" "an alien address" } { "src" "an alien address" } { "size" "a non-negative integer" } }
-{ $description "Copies " { $snippet "size" } " bytes from " { $snippet "src" } " to " { $snippet "dst" } "." }
-{ $warning "As per the BSD C library documentation, the behavior is undefined if the source and destination overlap." } ;
-
-HELP: check-ptr
-{ $values { "c-ptr" "an alien address, byte array, or " { $link f } } { "checked" "an alien address or byte array with non-zero address" } }
-{ $description "Throws an error if the input is " { $link f } ". Otherwise the object remains on the data stack. This word should be used to check the return values of " { $link malloc } " and " { $link realloc } " before use." }
-{ $error-description "Callers of " { $link malloc } " and " { $link realloc } " should use " { $link check-ptr } " to throw an error in the case of a memory allocation failure." } ;
-
-HELP: free ( ptr -- )
-{ $values { "ptr" "an alien address" } }
-{ $description "Deallocates a block of memory allocated by " { $link malloc } ", " { $link calloc } " or " { $link realloc } "." } ;
-
-HELP: with-malloc
-{ $values { "n" "a positive integer" } { "quot" "a quotation with stack effect " { $snippet "( c-ptr -- )" } } }
-{ $description "Allocates a zeroed block of " { $snippet "n" } " bytes and passes it to the quotation. When the quotation returns, the block is freed." } ;
diff --git a/core/compiler/alien/objc/load.factor b/core/compiler/alien/objc/load.factor
deleted file mode 100644 (file)
index 2ffb753..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-USE: kernel
-PROVIDE: core/compiler/alien/objc
-{ +files+ {
-    { "objc-x86.factor" [ cpu "x86" = ] }
-    { "objc-ppc.factor" [ cpu "ppc" = ] }
-    "runtime.factor"
-    "utilities.factor"
-    "subclassing.factor"
-} } ;
diff --git a/core/compiler/alien/objc/objc-ppc.factor b/core/compiler/alien/objc/objc-ppc.factor
deleted file mode 100644 (file)
index 9279127..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc
-
-: (post-stret) ; inline
diff --git a/core/compiler/alien/objc/objc-x86.factor b/core/compiler/alien/objc/objc-x86.factor
deleted file mode 100644 (file)
index f94ce7a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc
-USING: assembler compiler ;
-
-! In their infinite wisdom, Apple's struct-returning Objective C
-! messages do not use their own documented ABI; instead they
-! pop one of the input parameters off the stack. We compensate
-! for that here.
-
-! when calling an stret via objc_msgSend_stret, it pops the 
-! struct off the stack for us!
-: (post-stret) ;
-
-\ (post-stret) [ EAX PUSH ] H{ } define-intrinsic
diff --git a/core/compiler/alien/objc/runtime.factor b/core/compiler/alien/objc/runtime.factor
deleted file mode 100644 (file)
index 9663249..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc
-
-TYPEDEF: void* SEL
-
-TYPEDEF: void* id
-
-FUNCTION: char* sel_getName ( SEL aSelector ) ;
-
-FUNCTION: bool sel_isMapped ( SEL aSelector ) ;
-
-FUNCTION: SEL sel_registerName ( char* str ) ;
-
-BEGIN-STRUCT: objc-super
-    FIELD: id receiver
-    FIELD: void* class
-END-STRUCT
-
-: CLS_CLASS        HEX: 1   ;
-: CLS_META         HEX: 2   ;
-: CLS_INITIALIZED  HEX: 4   ;
-: CLS_POSING       HEX: 8   ;
-: CLS_MAPPED       HEX: 10  ;
-: CLS_FLUSH_CACHE  HEX: 20  ;
-: CLS_GROW_CACHE   HEX: 40  ;
-: CLS_NEED_BIND    HEX: 80  ;
-: CLS_METHOD_ARRAY HEX: 100 ;
-
-BEGIN-STRUCT: objc-class
-    FIELD: void* isa
-    FIELD: void* super-class
-    FIELD: char* name
-    FIELD: long version
-    FIELD: long info
-    FIELD: long instance-size
-    FIELD: void* ivars
-    FIELD: void* methodLists
-    FIELD: void* cache
-    FIELD: void* protocols
-END-STRUCT
-
-BEGIN-STRUCT: objc-object
-    FIELD: objc-class* isa
-END-STRUCT
-
-FUNCTION: int objc_getClassList ( void* buffer, int bufferLen ) ;
-
-FUNCTION: objc-class* objc_getClass ( char* class ) ;
-
-FUNCTION: objc-class* objc_getMetaClass ( char* class ) ;
-
-FUNCTION: void objc_addClass ( objc-class* class ) ;
-
-FUNCTION: id class_createInstance ( objc-class* class, uint additionalByteCount ) ;
-
-FUNCTION: id class_createInstanceFromZone ( objc-class* class, uint additionalByteCount, void* zone ) ;
-
-BEGIN-STRUCT: objc-method
-    FIELD: SEL name
-    FIELD: char* types
-    FIELD: void* imp
-END-STRUCT
-
-FUNCTION: objc-method* class_getInstanceMethod ( objc-class* class, SEL selector ) ;
-
-FUNCTION: objc-method* class_getClassMethod ( objc-class* class, SEL selector ) ;
-
-BEGIN-STRUCT: objc-method-list
-    FIELD: void* obsolete
-    FIELD: int count
-END-STRUCT
-
-FUNCTION: objc-method-list* class_nextMethodList ( objc-class* class, void** iterator ) ;
-
-FUNCTION: void class_addMethods ( objc-class* class, objc-method-list* methodList ) ;
-
-FUNCTION: void class_removeMethods ( objc-class* class, objc-method-list* methodList ) ;
-
-FUNCTION: uint method_getNumberOfArguments ( objc-method* method ) ;
-
-FUNCTION: uint method_getSizeOfArguments ( objc-method* method ) ;
-
-FUNCTION: uint method_getArgumentInfo ( objc-method* method, int argIndex, char** type, int* offset ) ;
diff --git a/core/compiler/alien/objc/subclassing.factor b/core/compiler/alien/objc/subclassing.factor
deleted file mode 100644 (file)
index 06319a8..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc
-USING: alien arrays compiler hashtables kernel kernel-internals
-libc math namespaces sequences strings words ;
-
-: init-method ( method alien -- )
-    >r first3 r>
-    [ >r execute r> set-objc-method-imp ] keep
-    [ >r <malloc-string> r> set-objc-method-types ] keep
-    >r sel_registerName r> set-objc-method-name ;
-
-: <empty-method-list> ( n -- alien )
-    "objc-method-list" c-size
-    "objc-method" c-size pick * + 1 calloc
-    [ set-objc-method-list-count ] keep ;
-
-: <method-list> ( methods -- alien )
-    dup length dup <empty-method-list> -rot
-    [ pick method-list@ objc-method-nth init-method ] 2each ;
-
-: define-objc-methods ( class methods -- )
-    <method-list> class_addMethods ;
-
-: <objc-class> ( name info -- class )
-    "objc-class" <malloc-object>
-    [ set-objc-class-info ] keep
-    [ >r <malloc-string> r> set-objc-class-name ] keep ;
-
-! The Objective C object model is a bit funny.
-! Every class has a metaclass.
-
-! The superclass of the metaclass of X is the metaclass of the
-! superclass of X.
-
-! The metaclass of the metaclass of X is the metaclass of the
-! root class of X.
-: meta-meta-class ( class -- class ) root-class objc-class-isa ;
-
-: copy-instance-size ( class -- )
-    dup objc-class-super-class objc-class-instance-size
-    swap set-objc-class-instance-size ;
-
-: <meta-class> ( superclass name -- class )
-    CLS_META <objc-class>
-    [ >r dup objc-class-isa r> set-objc-class-super-class ] keep
-    [ >r meta-meta-class r> set-objc-class-isa ] keep
-    dup copy-instance-size ;
-
-: <new-class> ( metaclass superclass name -- class )
-    CLS_CLASS <objc-class>
-    [ set-objc-class-super-class ] keep
-    [ set-objc-class-isa ] keep
-    dup copy-instance-size ;
-
-: (define-objc-class) ( superclass name imeth -- )
-    >r
-    >r objc-class r>
-    [ <meta-class> ] 2keep <new-class> dup objc_addClass
-    r> <method-list> class_addMethods ;
-
-: encode-types ( return types -- encoding )
-    >r 1array r> append
-    [ [ alien>objc-types get hash % CHAR: 0 , ] each ] "" make ;
-
-: struct-return ( ret types quot -- ret types quot )
-    pick c-struct? [
-        pick c-size [ memcpy ] curry append
-        >r { "void*" } swap append >r drop "void" r> r>
-    ] when ;
-
-: prepare-method ( ret types quot -- type imp )
-    >r [ encode-types ] 2keep r>
-    [ struct-return 3array % \ alien-callback , ] [ ] make
-    compile-quot ;
-
-: prepare-methods ( methods -- methods )
-    [ first4 prepare-method 3array ] map ;
-
-: redefine-objc-methods ( name imeth -- )
-    >r objc_getClass r> define-objc-methods ;
-
-: define-objc-class ( superclass name imeth -- )
-    prepare-methods
-    over class-exists? [ 2dup redefine-objc-methods ] when
-    over >r [ 3array % \ (define-objc-class) , ] [ ] make r>
-    swap import-objc-class ;
diff --git a/core/compiler/alien/objc/utilities.factor b/core/compiler/alien/objc/utilities.factor
deleted file mode 100644 (file)
index 3d53ec0..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc
-USING: alien arrays compiler errors generic hashtables inference
-kernel libc math namespaces parser sequences strings words ;
-
-: make-alien-invoke [ ] make \ alien-invoke add ; inline
-
-: make-sender ( method function -- quot )
-    [ over first , f , , second , ] make-alien-invoke ;
-
-: make-sender-stret ( method function -- quot )
-    [
-        [ "void" f ] %
-        "_stret" append ,
-        { "void*" } swap second append ,
-    ] make-alien-invoke \ (post-stret) add ;
-
-: use-stret? ( type -- ? )
-    #! We use the objc_msgSend_stret form in either of the
-    #! following two cases:
-    #! - type is a struct, and we're on PowerPC
-    #! - type is a struct <= 8 bytes, and we're on x86
-    {
-        { [ dup c-struct? not ] [ drop f ] }
-        { [ cpu "ppc" = ] [ drop t ] }
-        { [ cpu "x86" = ] [ c-size 8 > ] }
-    } cond ;
-    
-: sender-stub ( method function -- word )
-    over first use-stret?
-    [ make-sender-stret ] [ make-sender ] if
-    define-temp ;
-
-SYMBOL: msg-senders
-H{ } clone msg-senders set-global
-
-SYMBOL: super-msg-senders
-H{ } clone super-msg-senders set-global
-
-: (cache-stub) ( method function hash -- word )
-    [
-        over get dup [
-            2nip
-        ] [
-            drop over >r sender-stub dup r> set
-        ] if
-    ] bind ;
-
-: cache-stub ( method super? -- word )
-    [ "objc_msgSendSuper" "objc_msgSend" ? ] keep
-    super-msg-senders msg-senders ? get
-    (cache-stub) ;
-
-: <super> ( receiver -- super )
-    "objc-super" <c-object> [
-        >r dup objc-object-isa objc-class-super-class r>
-        set-objc-super-class
-    ] keep
-    [ set-objc-super-receiver ] keep ;
-
-TUPLE: selector name object ;
-
-C: selector ( name -- sel ) [ set-selector-name ] keep ;
-
-: selector ( selector -- alien )
-    dup selector-object expired? [
-        dup selector-name sel_registerName
-        dup rot set-selector-object
-    ] [
-        selector-object
-    ] if ;
-
-SYMBOL: selectors
-
-H{ } clone selectors set-global
-
-: cache-selector selectors get-global [ <selector> ] cache ;
-
-SYMBOL: objc-methods
-H{ } clone objc-methods set-global
-
-: lookup-method ( selector -- method )
-    dup objc-methods get hash
-    [ ] [ "No such method: " swap append throw ] ?if ;
-
-: make-stret-quot ( method -- quot )
-    first [ <c-object> dup ] curry 1 make-dip ;
-
-: stret-prolog ( type -- )
-    dup use-stret?
-    [ [ >r ] % , [ <malloc-object> dup r> ] % ] [ drop ] if ;
-
-: make-prepare-send ( selector method super? -- quot )
-    over second length 2 - >r [
-        [ \ <super> , ] when
-        first stret-prolog
-        cache-selector , \ selector ,
-    ] [ ] make r> make-dip ;
-
-: block>byte-array ( block size -- byte-array )
-    dup <byte-array> -rot >r 2dup r> memcpy free ;
-
-: stret-epilog ( type -- )
-    dup use-stret?
-    [ c-size , \ block>byte-array , ] [ drop ] if ;
-
-: make-objc-send ( selector super? -- quot )
-    [
-        over lookup-method [
-            swap [ make-prepare-send % ] 2keep cache-stub ,
-        ] keep first stret-epilog
-    ] [ ] make ;
-
-: infer-send ( super? -- )
-    pop-literal rot make-objc-send infer-quot-value ;
-
-: (send) ( ... selector super? -- ... )
-    make-objc-send dup peek compile call ;
-
-\ (send) [ pop-literal nip infer-send ] "infer" set-word-prop
-
-\ (send) [ object object ] [ ] <effect>
-"inferred-effect" set-word-prop
-
-: send ( ... selector -- ... ) f (send) ; inline
-
-: -> scan parsed \ send parsed ; parsing
-
-: super-send ( ... selector -- ... ) t (send) ; inline
-
-: SUPER-> scan parsed \ super-send parsed ; parsing
-
-! Runtime introspection
-: (objc-class) ( string word -- class )
-    dupd execute
-    [ ] [ "No such class: " swap append throw ] ?if ; inline
-
-: objc-class ( string -- class )
-    \ objc_getClass (objc-class) ;
-
-: objc-meta-class ( string -- class )
-    \ objc_getMetaClass (objc-class) ;
-
-: method-arg-type ( method i -- type )
-    f <void*> 0 <int> over
-    >r method_getArgumentInfo drop
-    r> *char* ;
-
-SYMBOL: objc>alien-types
-
-H{
-    { "c" "char" }
-    { "i" "int" }
-    { "s" "short" }
-    { "l" "long" }
-    { "q" "longlong" }
-    { "C" "uchar" }
-    { "I" "uint" }
-    { "S" "ushort" }
-    { "L" "ulong" }
-    { "Q" "ulonglong" }
-    { "f" "float" }
-    { "d" "double" }
-    { "B" "bool" }
-    { "v" "void" }
-    { "*" "char*" }
-    { "@" "id" }
-    { "#" "id" }
-    { ":" "SEL" }
-} objc>alien-types set-global
-
-! The transpose of the above map
-SYMBOL: alien>objc-types
-
-objc>alien-types get hash>alist [ reverse ] map alist>hash
-! A hack...
-H{
-    { "NSPoint" "{_NSPoint=ff}" }
-    { "NSRect" "{_NSRect=ffff}" }
-    { "NSSize" "{_NSSize=ff}" }
-} hash-union alien>objc-types set-global
-
-: objc-struct-type ( i string -- ctype )
-    2dup CHAR: = -rot index* swap subseq ;
-
-: (parse-objc-type) ( i string -- ctype )
-    2dup nth >r >r 1+ r> r> {
-        { [ dup "rnNoORV" member? ] [ drop (parse-objc-type) ] }
-        { [ dup CHAR: ^ = ] [ 3drop "void*" ] }
-        { [ dup CHAR: { = ] [ drop objc-struct-type ] }
-        { [ dup CHAR: [ = ] [ 3drop "void*" ] }
-        { [ t ] [ 2nip ch>string objc>alien-types get hash ] }
-    } cond ;
-
-: parse-objc-type ( string -- ctype ) 0 swap (parse-objc-type) ;
-
-: method-arg-types ( method -- args )
-    dup method_getNumberOfArguments
-    [ method-arg-type parse-objc-type ] map-with ;
-
-: method-return-type ( method -- ctype )
-    #! Undocumented hack! Apple does not support this feature!
-    objc-method-types parse-objc-type ;
-
-: register-objc-method ( method -- )
-    dup method-return-type over method-arg-types 2array
-    swap objc-method-name sel_getName
-    objc-methods get set-hash ;
-
-: method-list@ ( ptr -- ptr )
-    "objc-method-list" c-size swap <displaced-alien> ;
-
-: (register-objc-methods) ( objc-class iterator -- )
-    2dup class_nextMethodList [
-        dup method-list@ swap objc-method-list-count [
-            swap objc-method-nth register-objc-method
-        ] each-with (register-objc-methods)
-    ] [
-        2drop
-    ] if* ;
-
-: register-objc-methods ( class -- )
-    f <void*> (register-objc-methods) ;
-
-: class-exists? ( string -- class ) objc_getClass >boolean ;
-
-: unless-defined ( class quot -- )
-    >r class-exists? r> unless ; inline
-
-: define-objc-class-word ( name quot -- )
-    [
-        over , , \ unless-defined , dup , \ objc-class ,
-    ] [ ] make >r "objc-classes" create r> define-compound ;
-
-: import-objc-class ( name quot -- )
-    #! The quotation is prepended to the class word. It should
-    #! "regenerate" the class as appropriate (by loading a
-    #! framework or defining the class in some manner).
-    2dup unless-defined
-    dupd define-objc-class-word
-    dup objc-class register-objc-methods
-    objc-meta-class register-objc-methods ;
-
-: root-class ( class -- class )
-    dup objc-class-super-class [ root-class ] [ ] ?if ;
diff --git a/core/compiler/alien/prettyprint.factor b/core/compiler/alien/prettyprint.factor
deleted file mode 100644 (file)
index 76abf44..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: prettyprint-internals
-USING: alien kernel prettyprint math ;
-
-M: alien pprint*
-    dup expired? [
-        drop "( alien expired )"
-    ] [
-        \ ALIEN: pprint-word alien-address number>string
-    ] if text ;
-
-M: dll pprint*
-    dll-path alien>char-string "DLL\" " pprint-string ;
diff --git a/core/compiler/alien/primitive-types.factor b/core/compiler/alien/primitive-types.factor
deleted file mode 100644 (file)
index b7a07d7..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-USING: alien compiler kernel kernel-internals math namespaces ;
-
-[ alien-unsigned-cell <alien> ]
-[ >r >r alien-address r> r> set-alien-unsigned-cell ]
-bootstrap-cell
-"box_alien"
-"unbox_alien"
-"void*" define-primitive-type
-
-[ alien-signed-8 ]
-[ set-alien-signed-8 ]
-8
-"box_signed_8"
-"unbox_signed_8"
-"longlong" define-primitive-type
-
-[ alien-unsigned-8 ]
-[ set-alien-unsigned-8 ]
-8
-"box_unsigned_8"
-"unbox_unsigned_8"
-"ulonglong" define-primitive-type
-
-[ alien-signed-cell ]
-[ set-alien-signed-cell ]
-bootstrap-cell
-"box_signed_cell"
-"unbox_signed_cell"
-"long" define-primitive-type
-
-[ alien-unsigned-cell ]
-[ set-alien-unsigned-cell ]
-bootstrap-cell
-"box_unsigned_cell"
-"unbox_unsigned_cell"
-"ulong" define-primitive-type
-
-[ alien-signed-4 ]
-[ set-alien-signed-4 ]
-4
-"box_signed_4"
-"unbox_signed_4"
-"int" define-primitive-type
-
-[ alien-unsigned-4 ]
-[ set-alien-unsigned-4 ]
-4
-"box_unsigned_4"
-"unbox_unsigned_4"
-"uint" define-primitive-type
-
-[ alien-signed-2 ]
-[ set-alien-signed-2 ]
-2
-"box_signed_2"
-"unbox_signed_2"
-"short" define-primitive-type
-
-[ alien-unsigned-2 ]
-[ set-alien-unsigned-2 ]
-2
-"box_unsigned_2"
-"unbox_unsigned_2"
-"ushort" define-primitive-type
-
-[ alien-signed-1 ]
-[ set-alien-signed-1 ]
-1
-"box_signed_1"
-"unbox_signed_1"
-"char" define-primitive-type
-
-[ alien-unsigned-1 ]
-[ set-alien-unsigned-1 ]
-1
-"box_unsigned_1"
-"unbox_unsigned_1"
-"uchar" define-primitive-type
-
-! This is a hack; we need better ways of handling arrays
-! inline structs
-[ swap <displaced-alien> alien>char-string ]
-[ swap <displaced-alien> swap set-alien-unsigned-1 ]
-1
-f
-f
-"char[]" define-primitive-type
-
-[ alien-unsigned-4 zero? not ]
-[ 1 0 ? set-alien-unsigned-4 ]
-4
-"box_boolean"
-"unbox_boolean"
-"bool" define-primitive-type
-
-[ alien-float ]
-[ >r >r >float r> r> set-alien-float ]
-4
-"box_float"
-"unbox_float"
-"float" define-primitive-type
-
-T{ float-regs f 4 } "float" c-type set-c-type-reg-class
-[ >float ] "float" c-type set-c-type-prep
-
-[ alien-double ]
-[ >r >r >float r> r> set-alien-double ]
-8
-"box_double"
-"unbox_double"
-"double" define-primitive-type
-
-T{ float-regs f 8 } "double" c-type set-c-type-reg-class
-[ >float ] "double" c-type set-c-type-prep
-
-[ alien-unsigned-cell <alien> alien>char-string ]
-[ >r >r alien-address r> r> set-alien-unsigned-cell ]
-bootstrap-cell
-"box_char_string"
-"unbox_alien"
-"char*" define-primitive-type
-
-[ string>char-alien ] "char*" c-type set-c-type-prep
-
-[ alien-unsigned-cell <alien> alien>u16-string ]
-[ >r >r alien-address r> r> set-alien-unsigned-cell ]
-4
-"box_u16_string"
-"unbox_alien"
-"ushort*" define-primitive-type
-
-[ string>u16-alien ] "ushort*" c-type set-c-type-prep
diff --git a/core/compiler/alien/structs.factor b/core/compiler/alien/structs.factor
deleted file mode 100644 (file)
index 3b45512..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-USING: assembler compiler errors generic
-hashtables kernel kernel-internals math namespaces parser
-sequences strings words ;
-
-! Some code for interfacing with C structures.
-
-: c-getter* ( name -- quot )
-    c-getter [
-        [ "Cannot read struct fields with type" throw ]
-    ] unless* ;
-
-: define-getter ( offset type name -- )
-    #! Define a word with stack effect ( alien -- obj ) in the
-    #! current 'in' vocabulary.
-    create-in >r c-getter* swap add* r> swap define-compound ;
-
-: c-setter* ( name -- quot )
-    c-setter [
-        [ "Cannot write struct fields with type" throw ]
-    ] unless* ;
-
-: define-setter ( offset type name -- )
-    #! Define a word with stack effect ( obj alien -- ) in the
-    #! current 'in' vocabulary.
-    "set-" swap append create-in >r c-setter* swap add* r>
-    swap define-compound ;
-
-: parse-c-decl ( string -- count name )
-    "[]" split "" swap remove unclip
-    >r
-    dup empty? [ drop 1 ] [ [ string>number ] map product ] if
-    r> over 1 > [ "[]" append ] when ;
-
-: define-field ( offset type name -- offset )
-    >r parse-c-decl [ c-type c-type-align ] keep
-    >r swapd align r> r> 
-    "struct-name" get swap "-" swap 3append
-    3dup define-getter 3dup define-setter
-    drop c-size rot * + ;
-
-: define-member ( max type -- max )
-    c-size max ;
-
-TUPLE: struct-type ;
-
-M: struct-type c-type-unbox c-type-size %unbox-struct ;
-
-M: struct-type c-type-box c-type-size %box-struct ;
-
-C: struct-type ( width -- type )
-    <c-type> over set-delegate
-    bootstrap-cell over set-c-type-align
-    [ swap <displaced-alien> ] over set-c-type-getter
-    [ set-c-type-size ] keep ;
-
-: define-struct-type ( width -- )
-    #! Define inline and pointer type for the struct. Pointer
-    #! type is exactly like void*.
-    <struct-type> "struct-name" get in get define-c-type ;
-
-: c-struct? ( type -- ? ) c-types get hash struct-type? ;
diff --git a/core/compiler/alien/structs.facts b/core/compiler/alien/structs.facts
deleted file mode 100644 (file)
index ae9e0d0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-IN: alien
-USING: help ;
-
-HELP: c-struct?
-{ $values { "type" "a string" } { "?" "a boolean" } }
-{ $description "Tests if a C type is a structure defined by " { $link POSTPONE: BEGIN-STRUCT: } "." } ;
diff --git a/core/compiler/alien/syntax.factor b/core/compiler/alien/syntax.factor
deleted file mode 100644 (file)
index e59c935..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov, Alex Chapman.
-! See http://factorcode.org/license.txt for BSD license.
-IN: !syntax
-USING: alien compiler kernel math namespaces parser
-sequences syntax words ;
-
-: !DLL" skip-blank parse-string dlopen parsed ; parsing
-
-: !ALIEN: scan-word <alien> parsed ; parsing
-
-: !LIBRARY: scan "c-library" set ; parsing
-
-: !FUNCTION:
-    scan "c-library" get scan string-mode on
-    [ string-mode off define-c-word ] f ; parsing
-
-: !TYPEDEF: scan scan typedef ; parsing
-
-: !BEGIN-STRUCT: ( -- offset )
-    scan "struct-name" set  0 ; parsing
-
-: !FIELD: ( offset -- offset )
-    scan scan define-field ; parsing
-
-: !END-STRUCT ( length -- )
-    define-struct-type ; parsing
-
-: !C-UNION:
-    scan "struct-name" set
-    string-mode on [
-        string-mode off
-        0 [ define-member ] reduce define-struct-type
-    ] f ; parsing
-
-: !C-ENUM:
-    string-mode on [
-        string-mode off 0 [
-            create-in swap [ unit define-compound ] keep 1+
-        ] reduce drop
-    ] f ; parsing
diff --git a/core/compiler/alien/syntax.facts b/core/compiler/alien/syntax.facts
deleted file mode 100644 (file)
index 98c2db6..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-IN: syntax
-USING: alien help ;
-
-HELP: DLL"
-{ $syntax "DLL\" path\"" }
-{ $values { "path" "a path name string" } }
-{ $description "Constructs a DLL handle at parse time." }
-{ $see-also dlopen } ;
-
-HELP: ALIEN:
-{ $syntax "ALIEN: address" }
-{ $values { "address" "a non-negative integer" } }
-{ $description "Creates an alien object at parse time." }
-{ $notes "Alien objects are invalidated between image saves and loads." }
-{ $see-also <alien> } ;
-
-HELP: LIBRARY:
-{ $syntax "LIBRARY: name" }
-{ $values { "name" "a logical library name" } }
-{ $description "Sets the logical library for consequent " { $link POSTPONE: FUNCTION: } " definitions that follow." } ;
-
-HELP: FUNCTION:
-{ $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."
-$terpri
-"The new word must be compiled before being executed." }
-{ $examples
-"For example, suppose the " { $snippet "foo" } " library exports the following function:"
-{ $code
-    "void the_answer(char* question, int value) {"
-    "    printf(\"The answer to %s is %d.\n\",question,value);"
-    "}"
-}
-"You can define a word for invoking it:"
-{ $example
-    "LIBRARY: foo\nFUNCTION: void the_answer ( char* question, int value ) ;"
-    "USE: compiler"
-    "\\ the_answer compile"
-    "\"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:"
-{ $code
-    "FUNCTION: void glHint ( GLenum target, GLenum mode ) ;"
-    "FUNCTION: void glHint GLenum target GLenum mode ;"
-} } ;
-
-HELP: TYPEDEF:
-{ $syntax "TYPEDEF: old new" }
-{ $values { "old" "a C type" } { "new" "a C type" } }
-{ $description "Alises the C types " { $snippet "old" } " and " { $snippet "old*" } " under the names " { $snippet "new" } " and " { $snippet "new*" } ", respectively." }
-{ $see-also (typedef) typedef } ;
-
-HELP: BEGIN-STRUCT:
-{ $syntax "BEGIN-STRUCT: name" }
-{ $values { "name" "a new C type name" } }
-{ $description "Begins reading a C struct definition. This word must be followed by one or more " { $link POSTPONE: FIELD: } " declarations, terminating in " { $link POSTPONE: END-STRUCT } "." } ;
-
-HELP: FIELD:
-{ $syntax "FIELD: type name" }
-{ $values { "type" "a C type" } { "name" "a field name" } }
-{ $description "Adds a field to the C structure currently being read. This word can only be used inside a " { $link POSTPONE: BEGIN-STRUCT: } "/" { $link POSTPONE: END-STRUCT } " pair." } ;
-
-HELP: END-STRUCT
-{ $syntax "END-STRUCT" }
-{ $description "Ends a structure definition. Only valid after a " { $link POSTPONE: BEGIN-STRUCT: } "." } ;
-
-HELP: C-UNION:
-{ $syntax "C-UNION: name members... ;" }
-{ $values { "name" "a new C type name" } { "members" "a sequence of C types" } }
-{ $description "Defines a new C type sized to fit its largest member." }
-{ $examples { $code "C-UNION: event  active-event keyboard-event mouse-event ;" } } ;
-
-HELP: C-ENUM:
-{ $syntax "C-ENUM: words... ;" }
-{ $values { "words" "a sequence of word names" } }
-{ $description "Creates a sequence of compound 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 symbolic constants instead." }
-{ $examples
-    "The following two lines are equivalent:"
-    { $code "C-ENUM: red green blue ;" ": red 0 ;  : green 1 ;  : blue 2 ;" }
-} ;
diff --git a/core/compiler/amd64/alien.factor b/core/compiler/amd64/alien.factor
deleted file mode 100644 (file)
index 1295b68..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: alien arrays assembler kernel kernel-internals math
-sequences ;
-
-M: stack-params %stack>freg
-    drop >r R11 swap stack@ MOV r> stack@ R11 MOV ;
-
-M: stack-params %freg>stack
-    >r stack-increment + cell + swap r> %stack>freg ;
-
-: struct-ptr/size ( n size func -- )
-    ! Load destination address
-    >r RDI RSP MOV
-    RDI rot ADD
-    ! Load struct size
-    RSI swap MOV
-    ! Copy the struct to the stack
-    r> f compile-c-call ;
-
-: %unbox-struct ( n size -- )
-    "unbox_value_struct" struct-ptr/size ;
-
-: %unbox ( n reg-class func -- )
-    ! Call the unboxer
-    f compile-c-call
-    ! Store the return value on the C stack
-    [ return-reg ] keep %freg>stack ;
-
-: %box-struct ( n size -- )
-    "box_value_struct" struct-ptr/size ;
-
-: load-return-value ( reg-class -- )
-    dup fastcall-regs first swap return-reg
-    2dup eq? [ 2drop ] [ MOV ] if ;
-
-: %box ( n reg-class func -- )
-    rot [
-        rot [ fastcall-regs first ] keep %stack>freg
-    ] [
-        swap load-return-value
-    ] if*
-    f compile-c-call ;
-
-: reset-sse RAX RAX XOR ;
-
-: %alien-invoke ( symbol dll -- )
-    reset-sse compile-c-call ;
-
-: alien-temp ( quot -- )
-    R11 0 MOV "alien_temp" f rel-absolute-cell rel-dlsym
-    R11 [] swap call ; inline
-
-: %alien-indirect ( -- )
-    reset-sse [ CALL ] alien-temp ;
-
-: %alien-callback ( quot -- )
-    RDI load-indirect "run_callback" f compile-c-call ;
-
-: save-return 0 swap [ return-reg ] keep %freg>stack ;
-: load-return 0 swap [ return-reg ] keep %stack>freg ;
-
-: %callback-value ( reg-class func -- )
-    ! Call the unboxer
-    f compile-c-call
-    ! Save return register
-    dup save-return
-    ! Restore data/callstacks
-    "unnest_stacks" f compile-c-call
-    ! Restore return register
-    load-return ;
-
-: %cleanup ( n -- ) drop ;
diff --git a/core/compiler/amd64/architecture.factor b/core/compiler/amd64/architecture.factor
deleted file mode 100644 (file)
index 43d8335..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: alien arrays assembler generic kernel kernel-internals
-math namespaces sequences ;
-
-! AMD64 register assignments
-! RAX RCX RDX RSI RDI R8 R9 R10 integer vregs
-! XMM0 - XMM7 float vregs
-! R13 cards_offset
-! R14 datastack
-! R15 callstack
-
-: ds-reg R14 ; inline
-: cs-reg R15 ; inline
-: allot-tmp-reg RBX ; inline
-: stack-reg RSP ; inline
-
-M: int-regs return-reg drop RAX ;
-M: int-regs vregs drop { RAX RCX RDX RSI RDI R8 R9 R10 R11 } ;
-M: int-regs fastcall-regs drop { RDI RSI RDX RCX R8 R9 } ;
-
-M: float-regs return-reg drop XMM0 ;
-M: float-regs vregs drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ;
-M: float-regs fastcall-regs vregs ;
-
-: address-operand ( address -- operand )
-    #! On AMD64, we have to load 64-bit addresses into a
-    #! scratch register first. The usage of R11 here is a hack.
-    #! This word can only be called right before a subroutine
-    #! call, where all vregs have been flushed anyway.
-    R11 [ swap MOV ] keep ; inline
-
-: compile-c-call ( symbol dll -- )
-    0 address-operand >r rel-absolute-cell rel-dlsym r> CALL ;
-
-: fixnum>slot@ drop ; inline
-
-: prepare-division CQO ; inline
-
-: load-indirect ( literal vreg -- )
-    dup 0 MOV >r rel-absolute-cell rel-literal r> dup [] MOV ;
-
-: stack-increment \ stack-reserve get 16 align 8 + ;
-
-: %prologue ( n -- )
-    \ stack-reserve set stack-reg stack-increment SUB ;
-
-: %epilogue ( -- ) stack-reg stack-increment ADD ;
diff --git a/core/compiler/amd64/intrinsics.factor b/core/compiler/amd64/intrinsics.factor
deleted file mode 100644 (file)
index b95d82f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: assembler ;
-IN: compiler
-
-: generate-write-barrier ( -- )
-    #! Mark the card pointed to by vreg.
-    "obj" operand card-bits SHR
-    "obj" operand R13 [+] card-mark OR ;
diff --git a/core/compiler/amd64/load.factor b/core/compiler/amd64/load.factor
deleted file mode 100644 (file)
index 3391e40..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-REQUIRES: core/compiler/x86 core/compiler/pentium4 ;
-PROVIDE: core/compiler/amd64
-{ +files+ {
-    "architecture.factor"
-    "alien.factor"
-    "intrinsics.factor"
-} } ;
diff --git a/core/compiler/authors.txt b/core/compiler/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/compiler/compiler-docs.factor b/core/compiler/compiler-docs.factor
new file mode 100644 (file)
index 0000000..29744d3
--- /dev/null
@@ -0,0 +1,139 @@
+USING: generator help.markup help.syntax words io parser
+assocs words.private sequences ;
+IN: compiler
+
+ARTICLE: "compiler-usage" "Calling the optimizing compiler"
+"The main entry point to the optimizing compiler is a single word taking a word as input:"
+{ $subsection compile }
+"The above word throws an error if the word did not compile. Another variant simply prints the error and returns:"
+{ $subsection try-compile }
+"The optimizing compiler can also compile a single quotation:"
+{ $subsection compile-quot }
+{ $subsection compile-1 }
+"Three utility words for bulk compilation:"
+{ $subsection compile-batch }
+{ $subsection compile-vocabs }
+{ $subsection compile-all }
+"Bulk compilation saves compile warnings and errors in a global variable, instead of printing them as they arise:"
+{ $subsection compile-errors }
+"The warnings and errors can be viewed later:"
+{ $subsection :warnings }
+{ $subsection :errors }
+{ $subsection forget-errors } ;
+
+ARTICLE: "recompile" "Automatic recompilation"
+"When a word is redefined, you can recompile all affected words automatically:"
+{ $subsection recompile }
+"Normally loading a source file or a module also calls " { $link recompile } ". This can be disabled by wrapping file loading in a combinator:"
+{ $subsection no-parse-hook } ;
+
+ARTICLE: "compiler" "Optimizing compiler"
+"Factor is a fully compiled language implementation with two distinct compilers:"
+{ $list
+    { "The " { $emphasis "non-optimizing quotation compiler" } " compiles quotations to naive machine code very quickly. The non-optimizing quotation compiler is part of the VM." }
+    { "The " { $emphasis "optimizing word compiler" } " compiles whole words at a time while performing extensive data and control flow analysis. This provides greater performance for generated code, but incurs a much longer compile time. The optimizing compiler is written in Factor." }
+}
+"While the quotation compiler is transparent to the developer, the optimizing compiler is invoked explicitly. It differs in two important ways from the non-optimizing compiler:"
+{ $list
+    { "The optimizing compiler only compiles words which have a static stack effect. This means that methods defined on fundamental generic words such as " { $link nth } " should have a static stack effect; for otherwise, most of the system would be compiled with the non-optimizing compiler. See " { $link "inference" } " and " { $link "cookbook-pitfalls" } "." }
+    { "The optimizing compiler performs " { $emphasis "early binding" } "; if a compiled word " { $snippet "A" } " calls another compiled word " { $snippet "B" } " and " { $snippet "B" } " is subsequently redefined, the compiled definition of " { $snippet "A" } " will still refer to the earlier compiled definition of " { $snippet "B" } ", until " { $snippet "A" } " explicitly recompiled." }
+}
+{ $subsection "compiler-usage" }
+{ $subsection "recompile" } ;
+
+ABOUT: "compiler"
+
+HELP: compile-error
+{ $values { "word" word } { "error" "an error" } }
+{ $description "If inside a " { $link compile-batch } ", saves the error for future persual via " { $link :errors } " and " { $link :warnings } ", otherwise reports the error to the " { $link stdio } " stream." } ;
+
+HELP: begin-batch
+{ $values { "seq" "a sequence of words" } }
+{ $description "Begins batch compilation. Any compile errors reported until a call to " { $link end-batch } " are stored in the " { $link compile-errors } " global variable." }
+$low-level-note ;
+
+HELP: compile-error.
+{ $values { "pair" "a " { $snippet "{ word error }" } " pair" } }
+{ $description "Prints a compiler error to the " { $link stdio } " stream." } ;
+
+HELP: (:errors)
+{ $values { "seq" "an alist" } }
+{ $description "Outputs all serious compiler errors from the most recent compile batch as a sequence of " { $snippet "{ word error }" } " pairs."  } ;
+
+HELP: :errors
+{ $description "Prints all serious compiler errors from the most recent compile batch to the " { $link stdio } " stream." } ;
+
+HELP: (:warnings)
+{ $values { "seq" "an alist" } }
+{ $description "Outputs all ignorable compiler warnings from the most recent compile batch as a sequence of " { $snippet "{ word error }" } " pairs."  } ;
+
+HELP: :warnings
+{ $description "Prints all ignorable compiler warnings from the most recent compile batch to the " { $link stdio } " stream." } ;
+
+HELP: end-batch
+{ $description "Ends batch compilation, printing a summary of the errors and warnings produced to the " { $link stdio } " stream." }
+$low-level-note ;
+
+HELP: compile
+{ $values { "word" word } }
+{ $description "Compiles a word together with any uncompiled dependencies. Does nothing if the word is already compiled." }
+{ $errors "If compilation fails, this word can throw an error. In particular, if the word's stack effect cannot be inferred, this word will throw an error. The related " { $link try-compile } " word logs errors and returns rather than throwing." } ;
+
+HELP: compile-failed
+{ $values { "word" word } { "error" "an error" } }
+{ $description "Called when the optimizing compiler fails to compile a word. The word is removed from the set of words pending compilation, and it's un-optimized compiled definition will be used. The error is reported by calling " { $link compile-error } "." } ;
+
+HELP: try-compile
+{ $values { "word" word } }
+{ $description "Compiles a word together with any uncompiled dependencies. Does nothing if the word is already compiled." }
+{ $errors "If compilation fails, this calls " { $link compile-failed } "." } ;
+
+HELP: forget-errors
+{ $values { "seq" "a sequence of words" } }
+{ $description "If any of the words in the sequence previously failed to compile, removes the marker indicating such."
+$nl
+"The compiler remembers which words failed to compile as an optimization, so that it does not try to infer the stack effect of words which do not have one over and over again." }
+{ $notes "Usually this word does not need to be called directly; if a word failed to compile because of a stack effect error, fixing the word definition clears the flag automatically. However, if words failed to compile due to external factors which were subsequently rectified, such as an unavailable C library or a missing or broken compiler transform, this flag can be cleared for all words:"
+{ $code "all-words forget-errors" }
+"Subsequent invocations of the compiler will consider all words for compilation." } ;
+
+HELP: compile-batch
+{ $values { "seq" "a sequence of words" } }
+{ $description "Compiles a batch of words. Any compile errors are summarized at the end and can be viewed with " { $link :warnings } " and " { $link :errors } "." } ;
+
+{ :errors (:errors) :warnings (:warnings) } related-words
+
+HELP: compile-vocabs
+{ $values { "seq" "a sequence of strings" } }
+{ $description "Compiles all words which have not been compiled yet from the given vocabularies." } ;
+
+HELP: compile-quot
+{ $values { "quot" "a quotation" } { "word" "a new, uninterned word" } }
+{ $description "Creates a new uninterned word having the given quotation as its definition, and compiles it. The returned word can be passed to " { $link execute } "." }
+{ $errors "Throws an error if the stack effect of the quotation cannot be inferred." } ;
+
+HELP: compile-1
+{ $values { "quot" "a quotation" } }
+{ $description "Compiles and runs a quotation." }
+{ $errors "Throws an error if the stack effect of the quotation cannot be inferred." } ;
+
+HELP: recompile
+{ $description "Recompiles words whose compiled definitions have become out of date as a result of dependent words being redefined." } ;
+
+HELP: compile-all
+{ $description "Compiles all words which have not been compiled yet." } ;
+
+HELP: recompile-all
+{ $description "Recompiles all words." } ;
+
+HELP: changed-words
+{ $var-description "Global variable holding words which need to be recompiled. Implemented as a hashtable where a key equals its value. This hashtable is updated by " { $link define } " when words are redefined, and inspected and cleared by " { $link recompile } "." } ;
+
+HELP: compile-begins
+{ $values { "word" word } }
+{ $description "Prints a message stating the word is being compiled, unless we are inside a " { $link compile-batch } "." } ;
+
+HELP: (compile)
+{ $values { "word" word } }
+{ $description "Compile a word. This word recursively calls itself to compile all dependencies." }
+{ $notes "This is an internal word, and user code should call " { $link compile } " instead." } ;
diff --git a/core/compiler/compiler-tests.factor b/core/compiler/compiler-tests.factor
new file mode 100644 (file)
index 0000000..59e2aaa
--- /dev/null
@@ -0,0 +1,20 @@
+USING: io.files tools.test sequences namespaces kernel ;
+
+{
+    "templates-early"
+    "simple"
+    "intrinsics"
+    "float"
+    "generic"
+    "ifte"
+    "templates"
+    "optimizer"
+    "redefine"
+    "stack-trace"
+    "alien"
+    "curry"
+    "tuples"
+}
+[ "resource:core/compiler/test/" swap ".factor" 3append ] map
+[ run-test ] map
+[ failures get push-all ] each
index 68565b83c50bdfe19a3b156075eb6d317d47be98..76b4d49636248159088da860f2bb4581c5d61cbe 100644 (file)
@@ -1,77 +1,92 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
+! Copyright (C) 2004, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
+USING: kernel namespaces arrays sequences io inference.backend
+generator debugger math.parser prettyprint words continuations
+vocabs assocs alien.compiler ;
 IN: compiler
-USING: errors generic hashtables inference io kernel math
-namespaces optimizer parser prettyprint sequences test threads
-words ;
 
-SYMBOL: print-warnings
+M: object inference-error-major? drop t ;
 
-t print-warnings set-global
-
-SYMBOL: batch-errors
-
-GENERIC: batch-begins ( batch-errors -- )
-
-M: f batch-begins drop ;
-
-GENERIC: compile-begins ( word batch-errors -- )
-
-M: f compile-begins drop "Compiling " write . flush ;
-
-GENERIC: compile-error ( error batch-errors -- )
-
-M: f compile-error
-    drop
-    dup inference-error-major? print-warnings get or
-    [ dup error. flush ] when drop ;
-
-GENERIC: batch-ends ( batch-errors -- )
-
-M: f batch-ends drop ;
-
-: word-dataflow ( word -- dataflow )
-    [
-        dup "no-effect" word-prop [ no-effect ] when
-        dup dup add-recursive-state
-        [ specialized-def (dataflow) ] keep
-        finish-word 2drop
-    ] with-infer ;
-
-: (compile) ( word -- )
-    dup compiling? not over compound? and [
-        dup batch-errors get compile-begins
-        dup word-dataflow optimize generate
+: compile-error ( word error -- )
+    batch-mode get [
+        2array compile-errors get push
     ] [
-        drop
+        "quiet" get [ drop ] [ print-error flush ] if drop
     ] if ;
 
+: begin-batch ( seq -- )
+    batch-mode on
+    [
+        "Compiling " % length # " words..." %
+    ] "" make print flush
+    V{ } clone compile-errors set-global ;
+
+: compile-error. ( pair -- )
+    nl
+    "While compiling " write dup first pprint ": " print
+    nl
+    second print-error ;
+
+: (:errors) ( -- seq )
+    compile-errors get-global
+    [ second inference-error-major? ] subset ;
+
+: :errors (:errors) [ compile-error. ] each ;
+
+: (:warnings) ( -- seq )
+    compile-errors get-global
+    [ second inference-error-major? not ] subset ;
+
+: :warnings (:warnings) [ compile-error. ] each ;
+
+: end-batch ( -- )
+    batch-mode off
+    "quiet" get [
+        "Compile finished." print
+        nl
+        ":errors - print " write (:errors) length pprint
+        " compiler errors." print
+        ":warnings - print " write (:warnings) length pprint
+        " compiler warnings." print
+        nl
+    ] unless ;
+
 : compile ( word -- )
-    [ (compile) ] with-compiler ;
+    H{ } clone [
+        compiled-xts [ (compile) ] with-variable
+    ] keep >alist finalize-compile ;
+
+: compile-failed ( word error -- )
+    dupd compile-error dup update-xt unchanged-word ;
 
 : try-compile ( word -- )
-    [ compile ]
-    [ batch-errors get compile-error update-xt ] recover ;
+    [ compile ] [ compile-failed ] recover ;
+
+: forget-errors ( seq -- )
+    [ f "no-effect" set-word-prop ] each ;
 
 : compile-batch ( seq -- )
-    batch-errors get batch-begins
-    dup
-    [ f "no-effect" set-word-prop ] each
-    [ try-compile ] each
-    batch-errors get batch-ends ;
+    dup empty? [
+        drop
+    ] [
+        dup begin-batch
+        dup forget-errors
+        [ try-compile ] each
+        end-batch
+    ] if ;
 
-: compile-vocabs ( seq -- )
-    [ words ] map concat compile-batch ;
+: compile-vocabs ( seq -- ) [ words ] map concat compile-batch ;
 
-: compile-all ( -- )
-    vocabs compile-vocabs changed-words get clear-hash ;
+: compile-all ( -- ) vocabs compile-vocabs ;
 
-: compile-quot ( quot -- word )
-    define-temp dup compile ;
+: compile-quot ( quot -- word ) define-temp dup compile ;
 
 : compile-1 ( quot -- ) compile-quot execute ;
 
 : recompile ( -- )
     changed-words get [
-        dup hash-keys compile-batch clear-hash
+        dup keys compile-batch clear-assoc
     ] when* ;
+
+: recompile-all ( -- )
+    all-words [ changed-word ] each recompile ;
diff --git a/core/compiler/compiler.facts b/core/compiler/compiler.facts
deleted file mode 100644 (file)
index e2ea92b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-IN: compiler
-USING: assembler help words ;
-
-HELP: compiled? ( word -- ? )
-{ $values { "word" "a word" } { "?" "a boolean" } }
-{ $description "Tests if a word is compiled." } ;
-
-HELP: compile
-{ $values { "word" "a word" } }
-{ $description "Compiles a word together with any uncompiled dependencies. Does nothing if the word is already compiled." }
-{ $errors "If compilation fails, this word can throw an error. In particular, if the word's stack effect cannot be inferred, this word will throw an error. The related " { $link try-compile } " word logs errors and returns rather than throwing." } ;
-
-HELP: try-compile
-{ $values { "word" "a word" } }
-{ $description "Compiles a word together with any uncompiled dependencies. Does nothing if the word is already compiled." }
-{ $errors "If compilation fails, this word logs the error to the default stream and returns normally." } ;
-
-HELP: compile-vocabs
-{ $values { "seq" "a sequence of strings" } }
-{ $description "Compiles all words in the vocabularies named by elements of a sequence, skipping compiled words. Compile errors are logged to the default stream." } ;
-
-HELP: compile-all
-{ $description "Compile all words in the dictionary which have not already been compiled. Compile errors are logged to the default stream." } ;
-
-HELP: compile-quot
-{ $values { "quot" "a quotation" } { "word" "a new, uninterned word" } }
-{ $description "Creates a new uninterned word having the given quotation as its definition, and compiles it. The returned word can be passed to " { $link execute } "." }
-{ $errors "Throws an error if the stack effect of the quotation cannot be inferred." } ;
-
-HELP: compile-1
-{ $values { "quot" "a quotation" } }
-{ $description "Compiles and runs a quotation." }
-{ $errors "Throws an error if the stack effect of the quotation cannot be inferred." } ;
-
-IN: assembler
-
-HELP: finalize-compile ( xts -- )
-{ $values { "xts" "an array of pairs mapping words to XTs" } }
-{ $description "Performs relocation, atomically changes the XT of all given words, and on PowerPC, flushes the CPU instruction cache." } ;
diff --git a/core/compiler/generator/architecture.factor b/core/compiler/generator/architecture.factor
deleted file mode 100644 (file)
index f1d30c9..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-IN: compiler
-USING: arrays generic kernel kernel-internals math memory
-namespaces sequences ;
-
-! Does the assembler emit bytes or cells?
-DEFER: code-format ( -- byte# )
-
-! A scratch register for computations
-TUPLE: vreg n ;
-
-C: vreg ( n reg-class -- vreg )
-    [ set-delegate ] keep [ set-vreg-n ] keep ;
-
-! Register classes
-TUPLE: int-regs ;
-TUPLE: float-regs size ;
-
-: <int-vreg> ( n -- vreg ) T{ int-regs } <vreg> ;
-: <float-vreg> ( n -- vreg ) T{ float-regs f 8 } <vreg> ;
-
-! A pseudo-register class for parameters spilled on the stack
-TUPLE: stack-params ;
-
-! Return values of this class go here
-GENERIC: return-reg ( register-class -- reg )
-
-! Sequence of registers used for parameter passing in class
-GENERIC: fastcall-regs ( register-class -- regs )
-
-! Sequence mapping vreg-n to native assembler registers
-GENERIC: vregs ( register-class -- regs )
-
-! Map a sequence of literals to f or float
-DEFER: literal-template ( literals -- template )
-
-! Load a literal (immediate or indirect)
-G: load-literal ( obj vreg -- ) 1 standard-combination ;
-
-! Set up caller stack frame
-DEFER: %prologue ( n -- )
-
-! Tear down stack frame
-DEFER: %epilogue ( -- )
-
-! Tail call another word
-DEFER: %jump ( label -- )
-
-! Call another word
-DEFER: %call ( label -- )
-
-! Local jump for branches or tail calls in nested #label
-DEFER: %jump-label ( label -- )
-
-! Test if vreg is 'f' or not
-DEFER: %jump-t ( label vreg -- )
-
-! Jump table of addresses (one cell each) is right after this
-DEFER: %dispatch ( -- )
-
-! Jump table entry
-DEFER: %target ( label -- )
-
-! Return to caller
-DEFER: %return ( -- )
-
-! Change datastack height
-DEFER: %inc-d ( n -- )
-
-! Change callstack height
-DEFER: %inc-r ( n -- )
-
-! Load stack into vreg
-GENERIC: (%peek) ( vreg loc reg-class -- )
-: %peek ( vreg loc -- ) over (%peek) ;
-
-! Store vreg to stack
-GENERIC: (%replace) ( vreg loc reg-class -- )
-: %replace ( vreg loc -- ) over (%replace) ;
-
-! Move one vreg to another
-DEFER: %move-int>int ( dst src -- )
-DEFER: %move-int>float ( dst src -- )
-
-: %move ( dst src -- )
-    2dup = [
-        2drop
-    ] [
-        2dup [ delegate class ] 2apply 2array {
-            { [ dup { int-regs int-regs } = ] [ drop %move-int>int ] }
-            { [ dup { float-regs int-regs } = ] [ drop %move-int>float ] }
-        } cond
-    ] if ;
-
-! FFI stuff
-DEFER: %unbox ( n reg-class func -- )
-
-DEFER: %unbox-struct ( n size -- )
-
-DEFER: %box ( n reg-class func -- )
-
-DEFER: %box-struct ( n size -- )
-
-GENERIC: %freg>stack ( stack reg reg-class -- )
-
-GENERIC: %stack>freg ( stack reg reg-class -- )
-
-DEFER: %alien-invoke ( library function -- )
-
-DEFER: %cleanup ( n -- )
-
-DEFER: %alien-callback ( quot -- )
-
-DEFER: %callback-value ( reg-class func -- )
-
-DEFER: %prepare-alien-indirect ( -- )
-
-DEFER: %alien-indirect ( -- )
-
-M: stack-params fastcall-regs drop 0 ;
-
-GENERIC: reg-size ( register-class -- n )
-
-GENERIC: inc-reg-class ( register-class -- )
-
-M: int-regs reg-size drop cell ;
-
-: (inc-reg-class)
-    dup class inc
-    macosx? [ reg-size stack-params +@ ] [ drop ] if ;
-
-M: int-regs inc-reg-class
-    (inc-reg-class) ;
-
-M: float-regs reg-size float-regs-size ;
-
-M: float-regs inc-reg-class
-    dup (inc-reg-class)
-    macosx? [ reg-size 4 / int-regs +@ ] [ drop ] if ;
-
-GENERIC: v>operand ( obj -- operand )
-M: integer v>operand tag-bits shift ;
-M: vreg v>operand dup vreg-n swap vregs nth ;
-M: f v>operand drop object-tag ;
diff --git a/core/compiler/generator/generator.factor b/core/compiler/generator/generator.factor
deleted file mode 100644 (file)
index 70063b1..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: arrays assembler errors generic hashtables inference
-kernel kernel-internals math namespaces sequences words ;
-
-GENERIC: stack-reserve* ( node -- n )
-
-M: object stack-reserve* drop 0 ;
-
-: stack-reserve ( node -- n )
-    0 swap [ stack-reserve* max ] each-node ;
-
-: intrinsic ( #call -- quot )
-    node-param "intrinsic" word-prop ;
-
-: if-intrinsic ( #call -- quot )
-    node-param "if-intrinsic" word-prop ;
-
-DEFER: #terminal?
-
-PREDICATE: #merge #terminal-merge node-successor #terminal? ;
-
-PREDICATE: #values #terminal-values node-successor #terminal? ;
-
-PREDICATE: #call #terminal-call
-    dup node-successor #if?
-    over node-successor node-successor #terminal? and
-    swap if-intrinsic and ;
-
-UNION: #terminal
-    POSTPONE: f #return #terminal-values #terminal-merge ;
-
-: tail-call? ( -- ? )
-    node-stack get [
-        dup #terminal-call? swap node-successor #terminal? or
-    ] all? ;
-
-: generate-code ( node quot -- )
-    over stack-reserve %prologue call ; inline
-
-: init-generator ( word -- )
-    #! The first entry in the literal table is the word itself,
-    #! this is for compiled call traces
-    V{ } clone relocation-table set
-    V{ } clone literal-table set
-    V{ } clone label-table set 
-    V{ } clone word-table set
-    literal-table get push ;
-
-: generate-1 ( word node quot -- )
-    #! Generate the code, then dump three vectors to pass to
-    #! add-compiled-block.
-    pick f save-xt [
-        pick init-generator
-        init-templates
-        generate-code
-        generate-labels
-        relocation-table get
-        literal-table get
-        word-table get
-    ] V{ } make code-format add-compiled-block save-xt ;
-
-GENERIC: generate-node ( node -- next )
-
-: generate-nodes ( node -- )
-    [ node@ generate-node ] iterate-nodes end-basic-block ;
-
-: generate-branch ( node -- )
-    [ generate-nodes ] keep-templates ;
-
-: generate ( word node -- )
-    [ [ generate-nodes ] with-node-iterator ] generate-1 ;
-
-! node
-M: node generate-node drop iterate-next ;
-
-! #label
-: generate-call ( label -- next )
-    end-basic-block
-    tail-call? [ %jump f ] [ %call iterate-next ] if ;
-
-M: #label generate-node
-    dup node-param dup generate-call >r
-    swap node-child generate r> ;
-
-! #if
-: end-false-branch ( label -- )
-    tail-call? [ %return drop ] [ %jump-label ] if ;
-
-: generate-if ( node label -- next )
-    <label> [
-        >r >r node-children first2 generate-branch
-        r> r> end-false-branch resolve-label
-        generate-branch
-        init-templates
-    ] keep resolve-label iterate-next ;
-
-M: #if generate-node
-    [ <label> dup %jump-t ]
-    H{ { +input+ { { f "flag" } } } }
-    with-template
-    generate-if ;
-
-! #call
-: [with-template] ( quot template -- quot )
-    \ with-template 3array >quotation ;
-
-: define-intrinsic ( word quot template -- )
-    [with-template] "intrinsic" set-word-prop ;
-
-: define-if>branch-intrinsic ( word quot inputs -- )
-    +input+ associate
-    [with-template] "if-intrinsic" set-word-prop ;
-
-: if>boolean-intrinsic ( quot -- )
-    "true" define-label
-    "end" define-label
-    "true" get swap call
-    f "if-scratch" get load-literal
-    "end" get %jump-label
-    "true" resolve-label
-    t "if-scratch" get load-literal
-    "end" resolve-label
-    "if-scratch" get phantom-d get phantom-push
-    compute-free-vregs ; inline
-
-: define-if>boolean-intrinsic ( word quot inputs -- )
-    +input+ associate
-    { { f "if-scratch" } } +scratch+ associate
-    hash-union
-    >r [ if>boolean-intrinsic ] curry r>
-    [with-template] "intrinsic" set-word-prop ;
-
-: define-if-intrinsic ( word quot inputs -- )
-    3dup define-if>branch-intrinsic define-if>boolean-intrinsic ;
-
-: do-if-intrinsic ( node -- next )
-    dup node-successor dup #if? [
-        <label> [ rot if-intrinsic call ] keep
-        generate-if node-successor
-    ] [
-        drop intrinsic call iterate-next
-    ] if ;
-
-M: #call generate-node
-    {
-        { [ dup if-intrinsic ] [ do-if-intrinsic ] }
-        { [ dup intrinsic ] [ intrinsic call iterate-next ] }
-        { [ t ] [ node-param generate-call ] }
-    } cond ;
-
-! #call-label
-M: #call-label generate-node
-    node-param generate-call ;
-
-! #dispatch
-: dispatch-head ( node -- label/node )
-    #! Return a list of label/branch pairs.
-    node-children [ <label> dup %target 2array ] map ;
-
-: dispatch-body ( label/node -- )
-    <label> swap [
-        first2 resolve-label generate-branch
-        dup %jump-label
-    ] each resolve-label init-templates ;
-
-M: #dispatch generate-node
-    #! The parameter is a list of nodes, each one is a branch to
-    #! take in case the top of stack has that type.
-    %dispatch dispatch-head dispatch-body iterate-next ;
-
-! #push
-UNION: immediate fixnum POSTPONE: f ;
-
-: generate-push ( node -- )
-    >#push<
-    dup length ?fp-scratch + 0 ensure-vregs
-    [ f spec>vreg [ load-literal ] keep ] map
-    phantom-d get phantom-append ;
-
-M: #push generate-node
-    generate-push iterate-next ;
-
-! #shuffle
-: phantom-shuffle-input ( n phantom -- seq )
-    2dup length <= [
-        cut-phantom
-    ] [
-        [ phantom-locs ] keep [ length head-slice* ] keep
-        [ append ] keep delete-all
-    ] if ;
-
-: adjust-shuffle ( shuffle -- )
-    effect-in length neg phantom-d get adjust-phantom ;
-
-: phantom-shuffle ( shuffle -- )
-    dup effect-in 0 additional-vregs 0 ensure-vregs
-    [
-        effect-in length phantom-d get phantom-shuffle-input
-    ] keep
-    [ shuffle* ] keep adjust-shuffle
-    phantom-d get phantom-append ;
-
-M: #shuffle generate-node
-    node-shuffle phantom-shuffle iterate-next ;
-
-M: #>r generate-node
-    drop
-    1 0 additional-vregs 0 ensure-vregs
-    1 phantom-d get phantom-shuffle-input
-    -1 phantom-d get adjust-phantom
-    phantom-r get phantom-append
-    iterate-next ;
-
-M: #r> generate-node
-    drop
-    0 1 additional-vregs 0 ensure-vregs
-    1 phantom-r get phantom-shuffle-input
-    -1 phantom-r get adjust-phantom
-    phantom-d get phantom-append
-    iterate-next ;
-
-! #return
-M: #return generate-node drop end-basic-block %return f ;
-
-! These constants must match vm/memory.h
-: card-bits 7 ;
-: card-mark HEX: 80 ;
-
-! These constants must match vm/layouts.h
-: float-offset 8 float-tag - ;
-: string-offset 3 cells object-tag - ;
diff --git a/core/compiler/generator/templates.factor b/core/compiler/generator/templates.factor
deleted file mode 100644 (file)
index 2132893..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: arrays generic hashtables inference io kernel math
-namespaces prettyprint sequences vectors words ;
-
-! Set this to t so that end-basic-block compiles a GC check
-: maybe-gc ( n -- ) \ maybe-gc get push ;
-
-! Register allocation
-
-! Hash mapping reg-classes to mutable vectors
-: free-vregs ( reg-class -- seq ) \ free-vregs get hash ;
-
-: alloc-reg ( reg-class -- vreg ) free-vregs pop ;
-
-: take-reg ( vreg -- ) dup delegate free-vregs delete ;
-
-: reg-spec>class ( spec -- class )
-    float eq? T{ float-regs f 8 } T{ int-regs } ? ;
-
-: spec>vreg ( spec -- vreg )
-    dup integer? [
-        <int-vreg> dup take-reg
-    ] [
-        reg-spec>class alloc-reg
-    ] if ;
-
-! A data stack location.
-TUPLE: ds-loc n ;
-
-! A call stack location.
-TUPLE: cs-loc n ;
-
-UNION: loc ds-loc cs-loc ;
-
-TUPLE: phantom-stack height ;
-
-C: phantom-stack ( -- stack )
-    0 over set-phantom-stack-height
-    V{ } clone over set-delegate ;
-
-GENERIC: finalize-height ( stack -- )
-
-GENERIC: <loc> ( n stack -- loc )
-
-: (loc)
-    #! Utility for methods on <loc>
-    phantom-stack-height - ;
-
-: (finalize-height) ( stack word -- )
-    #! We consolidate multiple stack height changes until the
-    #! last moment, and we emit the final height changing
-    #! instruction here.
-    swap [
-        phantom-stack-height
-        dup zero? [ 2drop ] [ swap execute ] if
-        0
-    ] keep set-phantom-stack-height ; inline
-
-TUPLE: phantom-datastack ;
-
-C: phantom-datastack
-    [ >r <phantom-stack> r> set-delegate ] keep ;
-
-M: phantom-datastack <loc> (loc) <ds-loc> ;
-
-M: phantom-datastack finalize-height
-    \ %inc-d (finalize-height) ;
-
-TUPLE: phantom-callstack ;
-
-C: phantom-callstack
-    [ >r <phantom-stack> r> set-delegate ] keep ;
-
-M: phantom-callstack <loc> (loc) <cs-loc> ;
-
-M: phantom-callstack finalize-height
-    \ %inc-r (finalize-height) ;
-
-: phantom-locs ( n phantom -- locs )
-    #! A sequence of n ds-locs or cs-locs indexing the stack.
-    swap <reversed> [ swap <loc> ] map-with ;
-
-: phantom-locs* ( phantom -- locs )
-    dup length swap phantom-locs ;
-
-: adjust-phantom ( n phantom -- )
-    [ phantom-stack-height + ] keep set-phantom-stack-height ;
-
-GENERIC: cut-phantom ( n phantom -- seq )
-
-M: phantom-stack cut-phantom
-    [ delegate cut* swap ] keep set-delegate ;
-
-SYMBOL: phantom-d
-SYMBOL: phantom-r
-
-: phantoms ( -- phantom phantom ) phantom-d get phantom-r get ;
-
-: finalize-heights ( -- )
-    phantoms [ finalize-height ] 2apply ;
-
-: vreg>stack ( value loc -- )
-    over loc? over not or [ 2drop ] [ %replace ] if ;
-
-: vregs>stack ( phantom -- )
-    [ dup phantom-locs* [ vreg>stack ] 2each ] keep delete-all ;
-
-: (live-locs) ( seq -- seq )
-    dup phantom-locs* [ 2array ] 2map
-    [ first2 over loc? >r = not r> and ] subset
-    0 <column> ;
-
-: stack>new-vreg ( loc spec -- vreg )
-    spec>vreg [ swap %peek ] keep ;
-
-: live-locs ( phantom phantom -- hash )
-    [ (live-locs) ] 2apply append prune
-    [ dup f stack>new-vreg ] map>hash ;
-
-: lazy-store ( value loc -- )
-    over loc? [
-        2dup =
-        [ 2drop ] [ >r \ live-locs get hash r> vreg>stack ] if
-    ] [
-        2drop
-    ] if ;
-
-: flush-locs ( phantom phantom -- )
-    2dup live-locs \ live-locs set
-    [ dup phantom-locs* [ lazy-store ] 2each ] 2apply ;
-
-: finalize-contents ( -- )
-    phantoms 2dup flush-locs [ vregs>stack ] 2apply ;
-
-: end-basic-block ( -- )
-    finalize-contents finalize-heights
-    \ maybe-gc get dup empty? [
-        drop
-    ] [
-        delete-all
-        "simple_gc" f %alien-invoke
-    ] if ;
-
-: used-vregs ( -- seq ) phantoms append [ vreg? ] subset ;
-
-: (compute-free-vregs) ( used class -- vector )
-    dup vregs length reverse [ swap <vreg> ] map-with diff
-    >vector ;
-
-: compute-free-vregs ( -- )
-    used-vregs
-    { T{ int-regs } T{ float-regs f 8 } }
-    [ 2dup (compute-free-vregs) ] map>hash \ free-vregs set
-    drop ;
-
-: init-templates ( -- )
-    V{ } clone \ maybe-gc set
-    <phantom-datastack> phantom-d set
-    <phantom-callstack> phantom-r set
-    compute-free-vregs ;
-
-: keep-templates ( quot -- )
-    [
-        V{ } clone \ maybe-gc set
-        phantom-d [ clone ] change
-        phantom-r [ clone ] change
-        compute-free-vregs
-        call
-    ] with-scope ; inline
-
-: additional-vregs ( seq seq -- n )
-    2array phantoms 2array [ [ length ] map ] 2apply v-
-    [ 0 max ] map sum ;
-
-: free-vregs# ( -- int# float# )
-    T{ int-regs } free-vregs length
-    phantoms [ [ loc? ] subset length ] 2apply + -
-    T{ float-regs f 8 } free-vregs length ;
-
-: ensure-vregs ( int# float# -- )
-    compute-free-vregs free-vregs# swapd <= >r <= r> and
-    [ finalize-contents compute-free-vregs ] unless ;
-
-: (lazy-load) ( spec value -- value )
-    {
-        { [ dup loc? ] [ >r spec>vreg dup r> %peek ] }
-        { [ dup [ float-regs? ] is? ] [ nip ] }
-        { [ over float eq? ] [ >r spec>vreg dup r> %move ] }
-        { [ t ] [ nip ] }
-    } cond ;
-
-: lazy-load ( values template -- )
-    dup length neg phantom-d get adjust-phantom
-    [ first2 >r swap (lazy-load) r> set ] 2each ;
-
-: compatible-vreg? ( n vreg -- ? )
-    dup [ int-regs? ] is? [ vreg-n = ] [ 2drop f ] if ;
-
-: compatible-values? ( value template -- ? )
-    {
-        { [ over loc? ] [ 2drop t ] }
-        { [ dup not ] [ drop [ float-regs? ] is? not ] }
-        { [ dup float eq? ] [ 2drop t ] }
-        { [ dup integer? ] [ swap compatible-vreg? ] }
-    } cond ;
-
-: template-match? ( template phantom -- ? )
-    [ <reversed> ] 2apply
-    t [ swap first compatible-values? and ] 2reduce ;
-
-: split-template ( template phantom -- slow fast )
-    over length over length <=
-    [ drop { } swap ] [ length swap cut* ] if ;
-
-: match-template ( template -- slow fast )
-    phantom-d get 2dup template-match?
-    [ split-template ] [ drop { } ] if ;
-
-: fast-input ( template -- )
-    phantom-d get over length swap cut-phantom swap lazy-load ;
-
-: phantom-push ( obj stack -- )
-    1 over adjust-phantom push ;
-
-: phantom-append ( seq stack -- )
-    over length over adjust-phantom swap nappend ;
-
-SYMBOL: +input+
-SYMBOL: +output+
-SYMBOL: +scratch+
-SYMBOL: +clobber+
-
-: fix-spec ( spec -- spec )
-    H{
-        { +input+ { } }
-        { +output+ { } }
-        { +scratch+ { } }
-        { +clobber+ { } }
-    } swap hash-union ;
-
-: output-vregs ( -- seq seq )
-    +output+ +clobber+ [ get [ get ] map ] 2apply ;
-
-: outputs-clash? ( -- ? )
-    output-vregs append phantoms append
-    [ swap member? ] contains-with? ;
-
-: slow-input ( template -- )
-    #! Are we loading stuff from the stack? Then flush out
-    #! remaining vregs, not slurped in by fast-input.
-    #! Do the outputs clash with vregs on the phantom stacks?
-    #! Then we must flush them first.
-    dup empty? not outputs-clash? or [ finalize-contents ] when
-    [ length phantom-d get phantom-locs ] keep lazy-load ;
-
-: requested-vregs ( template -- int# float# )
-    dup length swap [ float eq? ] subset length [ - ] keep ;
-
-: (requests-class?) ( class template -- ? )
-    [ second reg-spec>class eq? ] contains-with? ;
-
-: requests-class? ( class -- ? )
-    dup +input+ get (requests-class?) swap
-    +scratch+ get (requests-class?) or ;
-
-: ?fp-scratch ( -- n )
-    T{ float-regs f 8 } requests-class? 1 0 ? ;
-
-: fp-scratch ( -- vreg )
-    "fp-scratch" get [
-        T{ int-regs } alloc-reg dup "fp-scratch" set
-    ] unless* ;
-
-: guess-vregs ( -- int# float# )
-    +input+ get { } additional-vregs ?fp-scratch +
-    +scratch+ get 0 <column> requested-vregs >r + r> ;
-
-: alloc-scratch ( -- )
-    +scratch+ get [ first2 >r spec>vreg r> set ] each ;
-
-: template-inputs ( -- )
-    ! Ensure we have enough to hold any new stack elements we
-    ! will read (if any), and scratch.
-    guess-vregs ensure-vregs
-    ! Split the template into available (fast) parts and those
-    ! that require allocating registers and reading the stack
-    +input+ get match-template fast-input slow-input
-    ! Finally allocate scratch registers
-    alloc-scratch ;
-
-: template-outputs ( -- )
-    +output+ get [ get ] map phantom-d get phantom-append ;
-
-: with-template ( quot spec -- )
-    fix-spec [ template-inputs call template-outputs ] bind
-    compute-free-vregs ; inline
-
-: operand ( var -- op ) get v>operand ; inline
-
-: unique-operands ( operands quot -- )
-    >r [ operand ] map prune r> each ; inline
diff --git a/core/compiler/generator/xt.factor b/core/compiler/generator/xt.factor
deleted file mode 100644 (file)
index 629b553..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: alien arrays assembler errors generic hashtables kernel
-kernel-internals math namespaces prettyprint queues
-sequences strings vectors words ;
-
-DEFER: (compile)
-
-: compiled-offset ( -- n ) building get length code-format * ;
-
-TUPLE: label offset ;
-
-C: label ( -- label ) ;
-
-: define-label ( name -- ) <label> swap set ;
-
-: resolve-label ( label/name -- )
-    dup string? [ get ] when
-    compiled-offset swap set-label-offset ;
-
-SYMBOL: compiled-xts
-
-: save-xt ( word xt -- )
-    swap dup unchanged-word compiled-xts get set-hash ;
-
-: push-new* ( obj table -- n )
-    2dup [ eq? ] find-with drop dup -1 > [
-        2nip
-    ] [
-        drop dup length >r push r>
-    ] if ;
-
-SYMBOL: literal-table
-
-: add-literal ( obj -- n ) literal-table get push-new* ;
-
-SYMBOL: word-table
-
-: add-word ( word -- n ) word-table get push-new* ;
-
-SYMBOL: relocation-table
-SYMBOL: label-table
-
-: rel-absolute-cell 0 ;
-: rel-absolute 1 ;
-: rel-relative 2 ;
-: rel-absolute-2/2 3 ;
-: rel-relative-2/2 4 ;
-: rel-relative-2 5 ;
-: rel-relative-3 6 ;
-
-: (rel) ( arg class type offset -- pair )
-    #! Write a relocation instruction for the runtime image
-    #! loader.
-    pick rel-absolute-cell = cell 4 ? -
-    >r >r >r 16 shift r> 8 shift bitor r> bitor r>
-    2array ;
-
-: rel, ( arg class type -- )
-    compiled-offset (rel) relocation-table get swap nappend ;
-
-: rel-dlsym ( name dll class -- )
-   >r >r string>char-alien r> 2array add-literal r> 1 rel, ;
-
-: rel-here ( class -- )
-    dup rel-relative = [ drop ] [ 0 swap 2 rel, ] if ;
-
-: rel-word ( word class -- )
-    over primitive?
-    [ >r word-primitive r> 0 ] [ >r add-word r> 5 ] if
-    rel, ;
-
-: rel-cards ( class -- ) 0 swap 3 rel, ;
-
-: rel-literal ( literal class -- )
-    >r add-literal r> 4 rel, ;
-
-: rel-label ( label class -- )
-    compiled-offset 3array label-table get push ;
-
-: generate-labels ( -- )
-    label-table get [
-        first3 >r >r label-offset r> 6 r> (rel)
-        relocation-table get swap nappend
-    ] each ;
-
-: compiling? ( word -- ? )
-    {
-        { [ dup compiled-xts get hash-member? ] [ drop t ] }
-        { [ dup word-changed? ] [ drop f ] }
-        { [ t ] [ compiled? ] }
-    } cond ;
-
-: with-compiler ( quot -- )
-    [
-        H{ } clone compiled-xts set
-        call
-        compiled-xts get hash>alist finalize-compile
-    ] with-scope ;
diff --git a/core/compiler/inference/branches.factor b/core/compiler/inference/branches.factor
deleted file mode 100644 (file)
index a99cc99..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: inference
-USING: arrays errors generic hashtables kernel math
-namespaces parser prettyprint sequences strings vectors words ;
-
-: unify-lengths ( seq -- newseq )
-    dup [ length ] map supremum
-    swap [ add-inputs nip ] map-with ;
-
-: unify-values ( seq -- value )
-    dup all-eq? [ first ] [ drop <computed> ] if ;
-
-: unify-stacks ( seq -- stack ) flip [ unify-values ] map ;
-
-: balanced? ( in out -- ? )
-    [ dup [ length - ] [ 2drop f ] if ] 2map
-    [ ] subset all-equal? ;
-
-TUPLE: unbalanced-branches-error in out ;
-
-: unbalanced-branches-error ( in out -- * )
-    <unbalanced-branches-error> inference-error ;
-
-: unify-inputs ( max-d-in d-in meta-d -- meta-d )
-    dup [
-        [ >r - r> length + ] keep add-inputs nip
-    ] [
-        2nip
-    ] if ;
-
-: unify-effect ( in out -- newin newout )
-    #! in is a sequence of integers, out is a sequence of
-    #! stacks.
-    2dup balanced? [
-        over supremum -rot
-        [ >r dupd r> unify-inputs ] 2map
-        [ ] subset unify-stacks
-    ] [
-        unbalanced-branches-error
-    ] if ;
-
-: active-variable ( seq symbol -- seq )
-    swap [
-        terminated? over hash [ 2drop f ] [ hash ] if
-    ] map-with ;
-
-: datastack-effect ( seq -- )
-    d-in over [ hash ] map-with
-    swap meta-d active-variable
-    unify-effect meta-d set d-in set ;
-
-: callstack-effect ( seq -- )
-    dup length 0 <array>
-    swap meta-r active-variable
-    unify-effect meta-r set drop ;
-
-TUPLE: unbalanced-namestacks ;
-
-: unify-namestacks ( seq -- )
-    flip
-    [ H{ } clone [ dupd hash-update ] reduce ] map
-    meta-n set ;
-
-: namestack-effect ( seq -- )
-    #! If the namestack is unbalanced, we don't throw an error
-    [ meta-n swap hash ] map
-    dup [ length ] map all-equal? [
-        <unbalanced-namestacks> inference-error
-    ] unless
-    unify-namestacks ;
-
-: unify-vars ( seq -- )
-    #! Don't use active-variable here, because we want to
-    #! consider variables set right before a throw too
-    [ inferred-vars swap hash ] map apply-var-seq ;
-
-: unify-effects ( seq -- )
-    dup datastack-effect
-    dup callstack-effect
-    dup namestack-effect
-    dup unify-vars
-    [ terminated? swap hash ] all? terminated? set ;
-
-: unify-dataflow ( effects -- nodes )
-    [ dataflow-graph swap hash ] map ;
-
-: copy-inference ( -- )
-    meta-d [ clone ] change
-    meta-r [ clone ] change
-    meta-n [ [ clone ] map ] change
-    inferred-vars [ clone ] change
-    d-in [ ] change
-    dataflow-graph off
-    current-node off ;
-
-: infer-branch ( value -- namespace )
-    [
-        copy-inference
-        dup value-recursion recursive-state set
-        value-literal infer-quot
-        terminated? get [ #values node, ] unless
-    ] make-hash ;
-
-: (infer-branches) ( branchlist -- list )
-    [ infer-branch ] map dup unify-effects unify-dataflow ;
-
-: infer-branches ( branches node -- )
-    dup node,
-    >r (infer-branches) r> set-node-children
-    #merge node, ;
diff --git a/core/compiler/inference/branches.facts b/core/compiler/inference/branches.facts
deleted file mode 100644 (file)
index 212798a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-IN: inference
-USING: help interpreter kernel kernel-internals ;
-
-HELP: unify-lengths
-{ $values { "seq" "a sequence" } { "newseq" "a new sequence" } }
-{ $description "Pads sequences in " { $snippet "seq" } " with computed value placeholders to ensure they are all the same length." } ;
-
-HELP: unify-values
-{ $values { "seq" "a sequence" } { "value" "an object" } }
-{ $description "If all values in the sequence are equal, outputs the value, otherwise outputs a computed value placeholder." } ;
-
-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 } ", " { $link dispatch } " or " { $link cond } " where the branches do not all exit with the same stack height." }
-{ $notes "Conditionals with variable stack effects are considered to be bad style and should be avoided since they do not compile."
-$terpri
-"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." } ;
-
-HELP: unify-effect
-{ $values { "in" "a sequence of integers" } { "out" "a sequence of stacks" } { "newin" "a sequence of integers" } { "newout" "a sequence of stacks" } }
-{ $description "Unifies the stack effects of a number of branches, and outputs new values for " { $link d-in } " and " { $link meta-d } "." } ;
diff --git a/core/compiler/inference/dataflow.factor b/core/compiler/inference/dataflow.factor
deleted file mode 100644 (file)
index 17c022d..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: inference
-USING: arrays generic hashtables kernel math
-namespaces parser sequences words vectors ;
-
-SYMBOL: d-in
-SYMBOL: meta-d
-SYMBOL: meta-r
-
-: push-d meta-d get push ;
-: pop-d meta-d get pop ;
-: peek-d meta-d get peek ;
-
-: push-r meta-r get push ;
-: pop-r meta-r get pop ;
-: peek-r meta-r get peek ;
-
-TUPLE: node param
-in-d out-d in-r out-r
-classes literals history
-successor children ;
-
-M: node equal? eq? ;
-
-: node-shuffle ( node -- shuffle )
-    dup node-in-d swap node-out-d <effect> ;
-
-: make-node ( param in-d out-d in-r out-r node -- node )
-    [ >r f f f f f <node> r> set-delegate ] keep ;
-
-: empty-node f { } { } { } { } ;
-: param-node { } { } { } { } ;
-: in-node >r f r> { } { } { } ;
-: out-node >r f { } r> { } { } ;
-: meta-d-node f meta-d get clone dup { } { } ;
-
-: d-tail ( n -- seq )
-    dup zero? [ drop f ] [ meta-d get swap tail* ] if ;
-
-: r-tail ( n -- seq )
-    dup zero? [ drop f ] [ meta-r get swap tail* ] if ;
-
-: node-child node-children first ;
-
-TUPLE: #label ;
-C: #label make-node ;
-: #label ( label -- node ) param-node <#label> ;
-
-TUPLE: #entry ;
-C: #entry make-node ;
-
-: #entry ( -- node ) meta-d-node <#entry> ;
-
-TUPLE: #call ;
-C: #call make-node ;
-: #call ( word -- node ) param-node <#call> ;
-
-TUPLE: #call-label ;
-C: #call-label make-node ;
-: #call-label ( label -- node ) param-node <#call-label> ;
-
-TUPLE: #push ;
-C: #push make-node ;
-: #push ( -- node ) empty-node <#push> ;
-: >#push< ( node -- seq ) node-out-d [ value-literal ] map ;
-
-TUPLE: #shuffle ;
-C: #shuffle make-node ;
-: #shuffle ( -- node ) empty-node <#shuffle> ;
-
-TUPLE: #>r ;
-C: #>r make-node ;
-: #>r ( -- node ) empty-node <#>r> ;
-
-TUPLE: #r> ;
-C: #r> make-node ;
-: #r> ( -- node ) empty-node <#r>> ;
-
-TUPLE: #values ;
-C: #values make-node ;
-: #values ( -- node ) meta-d-node <#values> ;
-
-TUPLE: #return ;
-C: #return make-node ;
-: #return ( label -- node )
-    meta-d-node <#return> [ set-node-param ] keep ;
-
-TUPLE: #if ;
-C: #if make-node ;
-: #if ( -- node ) peek-d 1array in-node <#if> ;
-
-TUPLE: #dispatch ;
-C: #dispatch make-node ;
-: #dispatch ( -- node ) peek-d 1array in-node <#dispatch> ;
-
-TUPLE: #merge ;
-C: #merge make-node ;
-: #merge ( -- node ) meta-d-node <#merge> ;
-
-TUPLE: #terminate ;
-C: #terminate make-node ;
-: #terminate ( -- node ) empty-node <#terminate> ;
-
-TUPLE: #declare ;
-C: #declare make-node ;
-: #declare ( classes -- node ) param-node <#declare> ;
-
-: node-inputs ( d-count r-count node -- )
-    tuck
-    >r r-tail r> set-node-in-r
-    >r d-tail r> set-node-in-d ;
-
-: node-outputs ( d-count r-count node -- )
-    tuck
-    >r r-tail r> set-node-out-r
-    >r d-tail r> set-node-out-d ;
-
-SYMBOL: dataflow-graph
-SYMBOL: current-node
-
-: node, ( node -- )
-    dataflow-graph get [
-        dup current-node [ set-node-successor ] change
-    ] [
-        dup dataflow-graph set  current-node set
-    ] if ;
-
-: node-values ( node -- values )
-    [
-        dup node-in-d % dup node-out-d %
-        dup node-in-r % node-out-r %
-    ] { } make ;
-
-: last-node ( node -- last )
-    dup node-successor [ last-node ] [ ] ?if ;
-
-: penultimate-node ( node -- penultimate )
-    dup node-successor dup [
-        dup node-successor
-        [ nip penultimate-node ] [ drop ] if
-    ] [
-        2drop f
-    ] if ;
-
-: drop-inputs ( node -- #shuffle )
-    node-in-d clone in-node <#shuffle> ;
-
-: #drop ( n -- #shuffle )
-    d-tail in-node <#shuffle> ;
-
-: each-node ( node quot -- )
-    over [
-        [ call ] 2keep swap
-        [ node-children [ swap each-node ] each-with ] 2keep
-        node-successor swap each-node
-    ] [
-        2drop
-    ] if ; inline
-
-: each-node-with ( obj node quot -- )
-    swap [ with ] each-node 2drop ; inline
-
-: all-nodes? ( node quot -- ? )
-    over [
-        [ call ] 2keep rot [
-            [
-                swap node-children [ swap all-nodes? ] all-with?
-            ] 2keep rot [
-                >r node-successor r> all-nodes?
-            ] [
-                2drop f
-            ] if
-        ] [
-            2drop f
-        ] if
-    ] [
-        2drop t
-    ] if ; inline
-
-: all-nodes-with? ( obj node quot -- ? )
-    swap [ with rot ] all-nodes? 2nip ; inline
-
-: remember-node ( word node -- )
-    [
-        dup #call?
-        [ [ node-history ?push ] keep set-node-history ]
-        [ 2drop ] if
-    ] each-node-with ;
-
-GENERIC: calls-label* ( label node -- ? )
-
-M: node calls-label* 2drop f ;
-
-M: #call-label calls-label* node-param eq? ;
-
-: calls-label? ( label node -- ? )
-    [ calls-label* not ] all-nodes-with? not ;
-
-: recursive-label? ( node -- ? )
-    dup node-param swap calls-label? ;
-
-SYMBOL: node-stack
-
-: >node node-stack get push ;
-: node> node-stack get pop ;
-: node@ node-stack get peek ;
-
-DEFER: iterate-nodes
-
-: iterate-children ( quot -- )
-    node@ node-children [ swap iterate-nodes ] each-with ;
-    inline
-
-: iterate-next ( -- node ) node@ node-successor ;
-
-: iterate-nodes ( node quot -- )
-    over [
-        [ swap >node call node> drop ] keep
-        over [ iterate-nodes ] [ 2drop ] if
-    ] [
-        2drop
-    ] if ; inline
-
-: ?set-node-successor ( next prev -- )
-    [ set-node-successor ] [ drop ] if* ;
-
-: map-node ( prev quot -- )
-    swap >r node@ swap call dup r> ?set-node-successor
-    node> drop >node ; inline
-
-DEFER: map-children
-DEFER: (map-nodes)
-
-: map-next ( quot -- )
-    node@ [
-        swap [ map-children ] keep
-        node> node-successor >node (map-nodes)
-    ] [
-        drop
-    ] if* ; inline
-
-: (map-nodes) ( prev quot -- )
-    node@
-    [ [ map-node ] keep map-next ]
-    [ drop f swap ?set-node-successor ] if ; inline
-
-: map-first ( node quot -- node )
-    call node> drop dup >node ; inline
-
-: map-nodes ( node quot -- node )
-    over [
-        over >node [ map-first ] keep map-next node>
-    ] when drop ; inline
-
-: map-children ( quot -- )
-    node@ [ node-children [ swap map-nodes ] map-with ] keep
-    set-node-children ; inline
-
-: with-node-iterator ( quot -- )
-    [ V{ } clone node-stack set call ] with-scope ; inline
-
-: (subst-values) ( new old node -- )
-    [
-        [ node-in-d subst ] 3keep [ node-in-r subst ] 3keep
-        [ node-out-d subst ] 3keep [ node-out-r subst ] 3keep
-        drop
-    ] each-node 2drop ;
-
-: subst-values ( new old node -- )
-    node-stack get 1 head-slice* swap add
-    [ >r 2dup r> node-successor (subst-values) ] each 2drop ;
-
-: node-literal? ( node value -- ? )
-    {
-        { [ dup value? ] [ 2drop t ] }
-        { [ over node-literals not ] [ 2drop f ] }
-        { [ swap node-literals hash-member? ] [ t ] }
-    } cond ;
-
-: node-literal ( node value -- obj )
-    dup value?
-    [ nip value-literal ] [ swap node-literals ?hash ] if ;
-
-: node-class ( node value -- class )
-    dup value? [
-        nip value-literal class
-    ] [
-        swap node-classes ?hash [ object ] unless*
-    ] if ;
diff --git a/core/compiler/inference/dataflow.facts b/core/compiler/inference/dataflow.facts
deleted file mode 100644 (file)
index 114743a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-IN: inference
-USING: help ;
-
-HELP: #return
-{ $values { "label" "a word or " { $link f } } }
-{ $description "Creates a node which returns from a nested label, or if " { $snippet "label" } " is " { $link f } ", the top-level word being compiled." } ;
-
-HELP: dataflow-graph
-{ $var-description "In the dynamic extent of " { $link infer } " and " { $link dataflow } ", holds the first node of the dataflow graph being constructed." } ;
-
-HELP: current-node
-{ $var-description "In the dynamic extent of " { $link infer } " and " { $link dataflow } ", holds the most recently added node of the dataflow graph being constructed." } ;
-
-HELP: remember-node
-{ $values { "word" "a word" } { "node" "a dataflow node" } }
-{ $description "Annotates all nodes starting from " { $snippet "node" } " with the fact that they were inlined from " { $snippet "word" } ". This prevents infinite loops when the optimizer inlines words." } ;
-
-HELP: d-in
-{ $var-description "During inference, holds the number of inputs which the quotation has been inferred to require so far." } ;
diff --git a/core/compiler/inference/errors.factor b/core/compiler/inference/errors.factor
deleted file mode 100644 (file)
index e5891aa..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: inference
-USING: kernel generic errors sequences prettyprint io words
-arrays ;
-
-M: inference-error error.
-    dup inference-error-rstate 0 <column> >array
-    dup empty? [ "Word: " write dup peek . ] unless
-    swap delegate error. "Nesting: " write . ;
-
-M: inference-error error-help drop f ;
-
-M: unbalanced-branches-error error.
-    "Unbalanced branches:" print
-    dup unbalanced-branches-error-out
-    swap unbalanced-branches-error-in
-    [ pprint bl length . ] 2each ;
-
-M: literal-expected summary
-    drop "Literal value expected" ;
-
-M: too-many->r summary
-    drop
-    "Quotation pushes elements on retain stack without popping them" ;
-
-M: too-many-r> summary
-    drop
-    "Quotation pops retain stack elements which it did not push" ;
-
-M: too-many-n> summary
-    drop
-    "Quotation pops name stack elements which it did not push" ;
-
-M: unbalanced-namestacks error.
-    "Unbalanced name stack usage." print
-    "Make sure occurrences of >n/n> are consistent across branches." print ;
-
-M: no-effect error.
-    "The word " write
-    no-effect-word pprint
-    " does not have a stack effect" print ;
-
-M: recursive-declare-error error.
-    "The recursive word " write
-    recursive-declare-error-word pprint
-    " must declare a stack effect" print ;
-
-M: effect-error error.
-    "Stack effects of the word " write
-    dup effect-error-word pprint
-    " do not match." print
-    "Declared: " write
-    dup effect-error-word stack-effect effect>string .
-    "Inferred: " write effect-error-effect effect>string . ;
diff --git a/core/compiler/inference/inference.factor b/core/compiler/inference/inference.factor
deleted file mode 100644 (file)
index 6f7c475..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: inference
-USING: arrays errors generic io kernel
-math namespaces parser prettyprint sequences strings
-vectors words tools ;
-
-TUPLE: inference-error rstate major? ;
-
-C: inference-error ( msg rstate important? -- error )
-    [ set-inference-error-major? ] keep
-    [ set-inference-error-rstate ] keep
-    [ set-delegate ] keep ;
-
-: inference-error ( msg -- * )
-    recursive-state get t <inference-error> throw ;
-
-: inference-warning ( msg -- * )
-    recursive-state get f <inference-error> throw ;
-
-TUPLE: literal-expected ;
-
-M: object value-literal
-    <literal-expected> inference-warning ;
-
-: pop-literal ( -- rstate obj )
-    1 #drop node,
-    pop-d dup value-recursion swap value-literal ;
-
-: value-vector ( n -- vector ) [ drop <computed> ] map >vector ;
-
-: add-inputs ( seq stack -- n stack )
-    tuck [ length ] 2apply - dup 0 >
-    [ dup value-vector [ rot nappend ] keep ]
-    [ drop 0 swap ] if ;
-
-: ensure-values ( seq -- )
-    meta-d [ add-inputs ] change d-in [ + ] change ;
-
-SYMBOL: terminated?
-
-: current-effect ( -- effect )
-    d-in get meta-d get length <effect>
-    terminated? get over set-effect-terminated? ;
-
-SYMBOL: recorded
-
-: init-inference ( recursive-state -- )
-    terminated? off
-    V{ } clone meta-d set
-    V{ } clone meta-r set
-    V{ } clone meta-n set
-    empty-vars inferred-vars set
-    0 d-in set
-    recursive-state set
-    dataflow-graph off
-    current-node off ;
-
-GENERIC: apply-object ( obj -- )
-
-: apply-literal ( obj -- )
-    #push dup node,
-    swap <value> push-d
-    1 d-tail swap set-node-out-d ;
-
-M: object apply-object apply-literal ;
-
-M: wrapper apply-object wrapped apply-literal ;
-
-GENERIC: apply-word ( word -- )
-
-M: word apply-object apply-word ;
-
-: terminate ( -- )
-    terminated? on #terminate node, ;
-
-GENERIC: infer-quot ( quot -- )
-
-M: f infer-quot drop ;
-
-M: quotation infer-quot
-    [ apply-object terminated? get not ] all? drop ;
-
-: infer-quot-value ( rstate quot -- )
-    recursive-state get >r swap recursive-state set
-    infer-quot r> recursive-state set ;
-
-TUPLE: too-many->r ;
-
-: check->r ( -- )
-    meta-r get empty? [
-        <too-many->r> inference-error
-    ] unless ;
-
-TUPLE: too-many-r> ;
-
-: check-r> ( -- )
-    meta-r get empty? [
-        <too-many-r>> inference-error
-    ] when ;
-
-: undo-infer ( -- )
-    recorded get [ custom-infer? not ] subset [
-        dup
-        f "inferred-vars" set-word-prop
-        f "inferred-effect" set-word-prop
-    ] each ;
-
-: with-infer ( quot -- )
-    [
-        [
-            { } recursive-state set
-            V{ } clone recorded set
-            f init-inference
-            call
-            check->r
-        ] [
-            undo-infer
-            rethrow
-        ] recover
-    ] with-scope ;
-
-: infer ( quot -- effect infer-vars )
-    [ infer-quot inferred-vars get current-effect ] with-infer ;
-
-: vars. ( seq str -- )
-    over empty? [ 2drop ] [ print [ . ] each ] if ;
-
-: infer. ( quot -- )
-    infer
-    "* Stack effect:" print effect>string print
-    dup inferred-vars-reads "* Reads free variables:" vars.
-    dup inferred-vars-writes "* Writes free variables:" vars.
-    dup inferred-vars-reads-globals "* Reads global variables:" vars.
-    inferred-vars-writes-globals "* Writes global variables:" vars. ;
-
-: (dataflow) ( quot -- dataflow )
-    infer-quot f #return node, dataflow-graph get ;
-
-: dataflow ( quot -- dataflow )
-    [ (dataflow) ] with-infer ;
-
-: dataflow-with ( quot stack -- effect )
-    [ meta-d set (dataflow) ] with-infer ;
diff --git a/core/compiler/inference/inference.facts b/core/compiler/inference/inference.facts
deleted file mode 100644 (file)
index 9961292..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-IN: inference
-USING: compiler help kernel sequences words ;
-
-HELP: inference-error
-{ $values { "msg" "an object" } }
-{ $description "Throws an " { $link inference-error } "." }
-{ $error-description
-    "Thrown by " { $link infer } ", " { $link dataflow } " and " { $link compile } " when the stack effect of a quotation cannot be inferred."
-    $terpri
-    "This error always delegates to one of the following classes of errors, which indicate the specific issue preventing a stack effect from being inferred:"
-    { $list
-        { $link no-effect }
-        { $link literal-expected }
-        { $link too-many->r }
-        { $link too-many-r> }
-        { $link unbalanced-branches-error }
-        { $link effect-error }
-        { $link recursive-declare-error }
-    }
-} ;
-
-HELP: literal-expected
-{ $error-description "Thrown when inference encounters a " { $link call } " or " { $link if } " being applied to a value which is not known to be a literal. Such a form can have an arbitrary stack effect, and does not compile." }
-{ $notes "This error will be thrown when compiling any combinator, such as " { $link each } ". However, words calling combinators can compile of the combinator is declared " { $link POSTPONE: inline } " and the quotation being passed in is a literal." } ;
-
-HELP: terminated?
-{ $var-description "During inference, a flag set to " { $link t } " if the current control flow path unconditionally throws an error." } ;
-
-HELP: too-many->r
-{ $error-description "Thrown if inference notices a quotation pushing elements on the retain stack without popping them at the end." }
-{ $notes "See " { $link "shuffle-words" } " for retain stack usage conventions." } ;
-
-HELP: too-many-r>
-{ $error-description "Thrown if inference notices a quotation popping elements from the return stack it did not place there." }
-{ $notes "See " { $link "shuffle-words" } " for retain stack usage conventions." } ;
-
-HELP: infer
-{ $values { "quot" "a quotation" } { "effect" "an instance of " { $link effect } } { "infer-vars" "an instance of " { $link inferred-vars } } }
-{ $description "Attempts to infer the quotation's stack effect and variable usage. For interactive testing, the " { $link infer. } " word should be called instead since it presents the output in a nicely formatted manner." }
-{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
-
-HELP: infer.
-{ $values { "quot" "a quotation" } }
-{ $description "Attempts to infer the quotation's stack effect and variable usage, and prints this data to the default stream." }
-{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." }
-{ $see-also infer } ;
-
-HELP: dataflow
-{ $values { "quot" "a quotation" } { "dataflow" "a dataflow node" } }
-{ $description "Attempts to construct a dataflow graph showing stack flow in the quotation." }
-{ $notes "This is the first stage of the compiler." }
-{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
-
-HELP: dataflow-with
-{ $values { "quot" "a quotation" } { "stack" "a vector" } { "dataflow" "a dataflow node" } }
-{ $description "Attempts to construct a dataflow graph showing stack flow in the quotation, starting with an initial data stack of values." }
-{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
diff --git a/core/compiler/inference/known-words.factor b/core/compiler/inference/known-words.factor
deleted file mode 100644 (file)
index b815913..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: inference
-USING: arrays alien assembler errors generic hashtables
-hashtables-internals io io-internals kernel
-kernel-internals math math-internals memory parser
-sequences strings vectors words prettyprint namespaces ;
-
-\ declare [
-    pop-literal nip
-    dup ensure-values
-    dup length d-tail
-    swap #declare
-    [ 2dup set-node-in-d set-node-out-d ] keep
-    node,
-] "infer" set-word-prop
-\ declare { object } { } <effect> "inferred-effect" set-word-prop
-
-\ fixnum< { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
-\ fixnum< t "foldable" set-word-prop
-
-\ fixnum<= { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
-\ fixnum<= t "foldable" set-word-prop
-
-\ fixnum> { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
-\ fixnum> t "foldable" set-word-prop
-
-\ fixnum>= { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
-\ fixnum>= t "foldable" set-word-prop
-
-\ eq? { object object } { object } <effect> "inferred-effect" set-word-prop
-\ eq? t "foldable" set-word-prop
-
-! Primitive combinators
-\ call { object } { } <effect> "inferred-effect" set-word-prop
-
-\ call [ pop-literal infer-quot-value ] "infer" set-word-prop
-
-\ execute { word } { } <effect> "inferred-effect" set-word-prop
-
-\ execute [ pop-literal nip apply-word ] "infer" set-word-prop
-
-\ if { object object object } { } <effect> "inferred-effect" set-word-prop
-
-\ if [
-    2 #drop node, pop-d pop-d swap 2array
-    #if pop-d drop infer-branches
-] "infer" set-word-prop
-
-\ cond { object } { } <effect> "inferred-effect" set-word-prop
-
-\ cond [
-    pop-literal <reversed>
-    [ no-cond ] swap alist>quot infer-quot-value
-] "infer" set-word-prop
-
-\ dispatch { fixnum array } { } <effect> "inferred-effect" set-word-prop
-
-\ dispatch [
-    pop-literal nip [ <value> ] map
-    #dispatch pop-d drop infer-branches
-] "infer" set-word-prop
-
-! Non-standard control flow
-\ throw { object } { } <effect>
-t over set-effect-terminated?
-"inferred-effect" set-word-prop
-
-! Stack effects for all primitives
-\ rehash-string { string } { } <effect> "inferred-effect" set-word-prop
-
-\ string>sbuf { string } { sbuf } <effect> "inferred-effect" set-word-prop
-
-\ bignum>fixnum { bignum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ bignum>fixnum t "foldable" set-word-prop
-
-\ float>fixnum { float } { fixnum } <effect> "inferred-effect" set-word-prop
-\ bignum>fixnum t "foldable" set-word-prop
-
-\ fixnum>bignum { fixnum } { bignum } <effect> "inferred-effect" set-word-prop
-\ fixnum>bignum t "foldable" set-word-prop
-
-\ float>bignum { float } { bignum } <effect> "inferred-effect" set-word-prop
-\ float>bignum t "foldable" set-word-prop
-
-\ fixnum>float { fixnum } { float } <effect> "inferred-effect" set-word-prop
-\ fixnum>float t "foldable" set-word-prop
-
-\ bignum>float { bignum } { float } <effect> "inferred-effect" set-word-prop
-\ bignum>float t "foldable" set-word-prop
-
-\ (fraction>) { integer integer } { rational } <effect> "inferred-effect" set-word-prop
-\ (fraction>) t "foldable" set-word-prop
-
-\ string>float { string } { float } <effect> "inferred-effect" set-word-prop
-\ string>float t "foldable" set-word-prop
-
-\ float>string { float } { string } <effect> "inferred-effect" set-word-prop
-\ float>string t "foldable" set-word-prop
-
-\ float>bits { real } { integer } <effect> "inferred-effect" set-word-prop
-\ float>bits t "foldable" set-word-prop
-
-\ double>bits { real } { integer } <effect> "inferred-effect" set-word-prop
-\ double>bits t "foldable" set-word-prop
-
-\ bits>float { integer } { float } <effect> "inferred-effect" set-word-prop
-\ bits>float t "foldable" set-word-prop
-
-\ bits>double { integer } { float } <effect> "inferred-effect" set-word-prop
-\ bits>double t "foldable" set-word-prop
-
-\ <complex> { real real } { number } <effect> "inferred-effect" set-word-prop
-\ <complex> t "foldable" set-word-prop
-
-\ fixnum+ { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
-\ fixnum+ t "foldable" set-word-prop
-
-\ fixnum+fast { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum+fast t "foldable" set-word-prop
-
-\ fixnum- { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
-\ fixnum- t "foldable" set-word-prop
-
-\ fixnum-fast { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum-fast t "foldable" set-word-prop
-
-\ fixnum* { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
-\ fixnum* t "foldable" set-word-prop
-
-\ fixnum/i { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
-\ fixnum/i t "foldable" set-word-prop
-
-\ fixnum-mod { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum-mod t "foldable" set-word-prop
-
-\ fixnum/mod { fixnum fixnum } { integer fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum/mod t "foldable" set-word-prop
-
-\ fixnum-bitand { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum-bitand t "foldable" set-word-prop
-
-\ fixnum-bitor { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum-bitor t "foldable" set-word-prop
-
-\ fixnum-bitxor { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum-bitxor t "foldable" set-word-prop
-
-\ fixnum-bitnot { fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
-\ fixnum-bitnot t "foldable" set-word-prop
-
-\ fixnum-shift { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
-\ fixnum-shift t "foldable" set-word-prop
-
-\ bignum= { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
-\ bignum= t "foldable" set-word-prop
-
-\ bignum+ { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum+ t "foldable" set-word-prop
-
-\ bignum- { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum- t "foldable" set-word-prop
-
-\ bignum* { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum* t "foldable" set-word-prop
-
-\ bignum/i { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum/i t "foldable" set-word-prop
-
-\ bignum-mod { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum-mod t "foldable" set-word-prop
-
-\ bignum/mod { bignum bignum } { bignum bignum } <effect> "inferred-effect" set-word-prop
-\ bignum/mod t "foldable" set-word-prop
-
-\ bignum-bitand { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum-bitand t "foldable" set-word-prop
-
-\ bignum-bitor { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum-bitor t "foldable" set-word-prop
-
-\ bignum-bitxor { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum-bitxor t "foldable" set-word-prop
-
-\ bignum-bitnot { bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum-bitnot t "foldable" set-word-prop
-
-\ bignum-shift { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
-\ bignum-shift t "foldable" set-word-prop
-
-\ bignum< { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
-\ bignum< t "foldable" set-word-prop
-
-\ bignum<= { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
-\ bignum<= t "foldable" set-word-prop
-
-\ bignum> { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
-\ bignum> t "foldable" set-word-prop
-
-\ bignum>= { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
-\ bignum>= t "foldable" set-word-prop
-
-\ float+ { float float } { float } <effect> "inferred-effect" set-word-prop
-\ float+ t "foldable" set-word-prop
-
-\ float- { float float } { float } <effect> "inferred-effect" set-word-prop
-\ float- t "foldable" set-word-prop
-
-\ float* { float float } { float } <effect> "inferred-effect" set-word-prop
-\ float* t "foldable" set-word-prop
-
-\ float/f { float float } { float } <effect> "inferred-effect" set-word-prop
-\ float/f t "foldable" set-word-prop
-
-\ float< { float float } { object } <effect> "inferred-effect" set-word-prop
-\ float< t "foldable" set-word-prop
-
-\ float-mod { float float } { float } <effect> "inferred-effect" set-word-prop
-\ float-mod t "foldable" set-word-prop
-
-\ float<= { float float } { object } <effect> "inferred-effect" set-word-prop
-\ float<= t "foldable" set-word-prop
-
-\ float> { float float } { object } <effect> "inferred-effect" set-word-prop
-\ float> t "foldable" set-word-prop
-
-\ float>= { float float } { object } <effect> "inferred-effect" set-word-prop
-\ float>= t "foldable" set-word-prop
-
-\ (word) { object object } { word } <effect> "inferred-effect" set-word-prop
-
-\ update-xt { word } { } <effect> "inferred-effect" set-word-prop
-
-\ word-xt { word } { integer } <effect> "inferred-effect" set-word-prop
-
-\ getenv { fixnum } { object } <effect> "inferred-effect" set-word-prop
-\ setenv { object fixnum } { } <effect> "inferred-effect" set-word-prop
-\ stat { string } { object object object object } <effect> "inferred-effect" set-word-prop
-\ (directory) { string } { array } <effect> "inferred-effect" set-word-prop
-\ data-gc { integer } { } <effect> "inferred-effect" set-word-prop
-
-! code-gc does not declare a stack effect since it might be
-! called from a compiled word which becomes unreachable during
-! the course of its execution, resulting in a crash
-
-\ gc-time { } { integer } <effect> "inferred-effect" set-word-prop
-\ save-image { string } { } <effect> "inferred-effect" set-word-prop
-\ exit { integer } { } <effect> "inferred-effect" set-word-prop
-\ data-room { } { integer integer array } <effect> "inferred-effect" set-word-prop
-\ code-room { } { integer integer } <effect> "inferred-effect" set-word-prop
-\ os-env { string } { object } <effect> "inferred-effect" set-word-prop
-\ millis { } { integer } <effect> "inferred-effect" set-word-prop
-
-\ type { object } { fixnum } <effect> "inferred-effect" set-word-prop
-\ type t "foldable" set-word-prop
-
-\ tag { object } { fixnum } <effect> "inferred-effect" set-word-prop
-\ tag t "foldable" set-word-prop
-
-\ cwd { } { string } <effect> "inferred-effect" set-word-prop
-\ cd { string } { } <effect> "inferred-effect" set-word-prop
-
-\ dlopen { string } { dll } <effect> "inferred-effect" set-word-prop
-\ dlsym { string object } { integer } <effect> "inferred-effect" set-word-prop
-\ dlclose { dll } { } <effect> "inferred-effect" set-word-prop
-
-\ <byte-array> { integer } { byte-array } <effect> "inferred-effect" set-word-prop
-
-\ <displaced-alien> { integer c-ptr } { c-ptr } <effect> "inferred-effect" set-word-prop
-
-\ alien-signed-cell { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-signed-cell { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-unsigned-cell { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-unsigned-cell { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-signed-8 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-signed-8 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-unsigned-8 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-unsigned-8 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-signed-4 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-signed-4 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-unsigned-4 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-unsigned-4 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-signed-2 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-signed-2 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-unsigned-2 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-unsigned-2 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-signed-1 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-signed-1 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-unsigned-1 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-unsigned-1 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-float { c-ptr integer } { float } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-float { float c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-float { c-ptr integer } { float } <effect> "inferred-effect" set-word-prop
-
-\ set-alien-double { float c-ptr integer } { } <effect> "inferred-effect" set-word-prop
-\ alien-double { c-ptr integer } { float } <effect> "inferred-effect" set-word-prop
-
-\ alien>char-string { c-ptr } { string } <effect> "inferred-effect" set-word-prop
-
-\ string>char-alien { string } { byte-array } <effect> "inferred-effect" set-word-prop
-
-\ alien>u16-string { c-ptr } { string } <effect> "inferred-effect" set-word-prop
-
-\ string>u16-alien { string } { byte-array } <effect> "inferred-effect" set-word-prop
-
-\ string>memory { string integer } { } <effect> "inferred-effect" set-word-prop
-\ memory>string { integer integer } { string } <effect> "inferred-effect" set-word-prop
-
-\ alien-address { alien } { integer } <effect> "inferred-effect" set-word-prop
-
-\ slot { object fixnum } { object } <effect> "inferred-effect" set-word-prop
-
-\ set-slot { object object fixnum } { } <effect> "inferred-effect" set-word-prop
-
-\ char-slot { fixnum object } { fixnum } <effect> "inferred-effect" set-word-prop
-
-\ set-char-slot { fixnum fixnum object } { } <effect> "inferred-effect" set-word-prop
-\ resize-array { integer array } { array } <effect> "inferred-effect" set-word-prop
-\ resize-string { integer string } { string } <effect> "inferred-effect" set-word-prop
-
-\ (hashtable) { } { hashtable } <effect> "inferred-effect" set-word-prop
-
-\ <array> { integer object } { array } <effect> "inferred-effect" set-word-prop
-
-\ begin-scan { } { } <effect> "inferred-effect" set-word-prop
-\ next-object { } { object } <effect> "inferred-effect" set-word-prop
-\ end-scan { } { } <effect> "inferred-effect" set-word-prop
-
-\ size { object } { fixnum } <effect> "inferred-effect" set-word-prop
-
-\ die { } { } <effect> "inferred-effect" set-word-prop
-\ fopen { string string } { alien } <effect> "inferred-effect" set-word-prop
-\ fgetc { alien } { object } <effect> "inferred-effect" set-word-prop
-\ fwrite { string alien } { } <effect> "inferred-effect" set-word-prop
-\ fflush { alien } { } <effect> "inferred-effect" set-word-prop
-\ fclose { alien } { } <effect> "inferred-effect" set-word-prop
-\ expired? { object } { object } <effect> "inferred-effect" set-word-prop
-
-\ <wrapper> { object } { wrapper } <effect> "inferred-effect" set-word-prop
-\ <wrapper> t "foldable" set-word-prop
-
-\ (clone) { object } { object } <effect> "inferred-effect" set-word-prop
-
-\ become { object fixnum } { object } <effect> "inferred-effect" set-word-prop
-
-\ array>vector { array } { vector } <effect> "inferred-effect" set-word-prop
-
-\ finalize-compile { array } { } <effect> "inferred-effect" set-word-prop
-
-\ <string> { integer integer } { string } <effect> "inferred-effect" set-word-prop
-
-\ <quotation> { integer } { quotation } <effect> "inferred-effect" set-word-prop
-
-\ xt-map { } { array } <effect> "inferred-effect" set-word-prop
-
-! Dynamic scope inference
-: if-tos-literal ( quot -- )
-    peek-d dup value? [ value-literal swap call ] [ 2drop ] if ;
-    inline
-
-\ >n [ H{ } clone push-n ] "infer-vars" set-word-prop
-
-\ >n { object } { } <effect> "inferred-effect" set-word-prop
-
-TUPLE: too-many-n> ;
-
-: apply-n> ( -- )
-    meta-n get empty? [
-        <too-many-n>> inference-error
-    ] [
-        pop-n drop
-    ] if ;
-
-\ n> [ apply-n> ] "infer-vars" set-word-prop
-
-\ n> { } { object } <effect> "inferred-effect" set-word-prop
-
-\ ndrop [ apply-n> ] "infer-vars" set-word-prop
-
-\ ndrop { } { } <effect> "inferred-effect" set-word-prop
-
-\ get [
-    [ apply-var-read ] if-tos-literal
-] "infer-vars" set-word-prop
-
-\ get { object } { object } <effect> "inferred-effect" set-word-prop
-
-\ set [
-    [ apply-var-write ] if-tos-literal
-] "infer-vars" set-word-prop
-
-\ set { object object } { } <effect> "inferred-effect" set-word-prop
-
-\ get-global [
-    [ apply-global-read ]
-    if-tos-literal
-] "infer-vars" set-word-prop
-
-\ get-global { object } { object } <effect> "inferred-effect" set-word-prop
-
-\ set-global [
-    [ apply-global-write ]
-    if-tos-literal
-] "infer-vars" set-word-prop
-
-\ set-global { object object } { } <effect> "inferred-effect" set-word-prop
diff --git a/core/compiler/inference/shuffle.factor b/core/compiler/inference/shuffle.factor
deleted file mode 100644 (file)
index ead62d5..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: inference
-USING: hashtables kernel math namespaces sequences words ;
-
-SYMBOL: recursive-state
-
-: <computed> \ <computed> counter ;
-
-TUPLE: value uid literal recursion ;
-
-C: value ( obj -- value )
-    <computed> over set-value-uid
-    recursive-state get over set-value-recursion
-    [ set-value-literal ] keep ;
-
-M: value hashcode value-uid ;
-
-M: value equal? eq? ;
-
-M: integer value-uid ;
-
-M: integer value-recursion drop f ;
-
-: split-shuffle ( stack shuffle -- stack1 stack2 )
-    effect-in length swap cut* ;
-
-: load-shuffle ( stack shuffle -- )
-    effect-in [ set ] 2each ;
-
-: shuffled-values ( shuffle -- values )
-    effect-out [ get ] map ;
-
-: shuffle* ( stack shuffle -- stack )
-    [ [ load-shuffle ] keep shuffled-values ] with-scope ;
-
-: shuffle ( stack shuffle -- stack )
-    [ split-shuffle ] keep shuffle* append ;
diff --git a/core/compiler/inference/shuffle.facts b/core/compiler/inference/shuffle.facts
deleted file mode 100644 (file)
index ab56ab5..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-IN: inference
-USING: help ;
-
-HELP: recursive-state
-{ $var-description "During inference, holds an association list mapping words to labels." } ;
-
-HELP: shuffle
-{ $values { "d" "a sequence" } { "r" "a sequence" } { "shuffle" "an instance of " { $link shuffle } } { "newd" "a new sequence" } { "newr" "a new sequence" } }
-{ $description "Applies a stack shuffle pattern to a pair of stacks." }
-{ $errors "Throws an error if the input stacks contain insufficient elements." } ;
diff --git a/core/compiler/inference/stack.factor b/core/compiler/inference/stack.factor
deleted file mode 100644 (file)
index 574ee10..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-IN: inference
-USING: arrays generic kernel math namespaces
-sequences words parser words ;
-
-: infer-shuffle-inputs ( shuffle node -- )
-    >r effect-in length 0 r> node-inputs ;
-
-: shuffle-stacks ( shuffle -- )
-    meta-d [ swap shuffle ] change ;
-
-: infer-shuffle-outputs ( shuffle node -- )
-    >r effect-out length 0 r> node-outputs ;
-
-: infer-shuffle ( shuffle -- )
-    #shuffle dup node,
-    2dup infer-shuffle-inputs
-    over shuffle-stacks
-    infer-shuffle-outputs ;
-
-: define-shuffle ( word shuffle -- )
-    [ "inferred-effect" set-word-prop ] 2keep
-    [ infer-shuffle ] curry "infer" set-word-prop ;
-
-{
-    { drop  T{ effect f 1 {             } } }
-    { 2drop T{ effect f 2 {             } } }
-    { 3drop T{ effect f 3 {             } } }
-    { dup   T{ effect f 1 { 0 0         } } }
-    { 2dup  T{ effect f 2 { 0 1 0 1     } } }
-    { 3dup  T{ effect f 3 { 0 1 2 0 1 2 } } }
-    { rot   T{ effect f 3 { 1 2 0       } } }
-    { -rot  T{ effect f 3 { 2 0 1       } } }
-    { dupd  T{ effect f 2 { 0 0 1       } } }
-    { swapd T{ effect f 3 { 1 0 2       } } }
-    { nip   T{ effect f 2 { 1           } } }
-    { 2nip  T{ effect f 3 { 2           } } }
-    { tuck  T{ effect f 2 { 1 0 1       } } }
-    { over  T{ effect f 2 { 0 1 0       } } }
-    { pick  T{ effect f 3 { 0 1 2 0     } } }
-    { swap  T{ effect f 2 { 1 0         } } }
-} [ first2 define-shuffle ] each
-
-\ >r [
-    #>r dup node,
-    1 0 pick node-inputs
-    pop-d push-r
-    0 1 rot node-outputs
-] "infer" set-word-prop
-
-\ >r { object } { } <effect> "inferred-effect" set-word-prop
-
-\ r> [
-    check-r>
-    #r> dup node,
-    0 1 pick node-inputs
-    pop-r push-d
-    1 0 rot node-outputs
-] "infer" set-word-prop
-
-\ r> { } { object } <effect> "inferred-effect" set-word-prop
diff --git a/core/compiler/inference/stack.facts b/core/compiler/inference/stack.facts
deleted file mode 100644 (file)
index 400c8a0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-IN: inference
-USING: help ;
-
-HELP: shuffle-stacks
-{ $values { "shuffle" "an instance of " { $link shuffle } } }
-{ $description "Applies a stack shuffle pattern to the inference stacks." }
-{ $errors "Throws an error if the stacks contain insufficient elements." } ;
diff --git a/core/compiler/inference/variables.factor b/core/compiler/inference/variables.factor
deleted file mode 100644 (file)
index 54325a3..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: inference
-USING: kernel sequences hashtables kernel-internals words
-namespaces generic vectors namespaces ;
-
-! Name stack and variable binding simulation
-SYMBOL: meta-n
-
-: push-n meta-n get push ;
-: pop-n meta-n get pop ;
-: peek-n meta-n get peek ;
-
-TUPLE: inferred-vars reads writes reads-globals writes-globals ;
-
-: vars-trivial? ( vars -- ? ) tuple-slots [ empty? ] all? ;
-
-: empty-vars ( -- vars )
-    V{ } clone V{ } clone V{ } clone V{ } clone
-    <inferred-vars> ;
-
-: apply-var-seq ( seq -- )
-    inferred-vars [
-        >r [ tuple-slots ] map r> tuple-slots add flip
-        [ concat prune >vector ] map first4 <inferred-vars>
-    ] change ;
-    
-: apply-var-read ( symbol -- )
-    dup meta-n get [ hash-member? ] contains-with? [
-        drop
-    ] [
-        inferred-vars get 2dup inferred-vars-writes member? [
-            2drop
-        ] [
-            inferred-vars-reads push-new
-        ] if
-    ] if ;
-    
-: apply-var-write ( symbol -- )
-    meta-n get empty? [
-        inferred-vars get inferred-vars-writes push-new
-    ] [
-        dup peek-n set-hash
-    ] if ;
-
-: apply-global-read ( symbol -- )
-    inferred-vars get
-    2dup inferred-vars-writes-globals member? [
-        2drop
-    ] [
-        inferred-vars-reads-globals push-new
-    ] if ;
-
-: apply-global-write ( symbol -- )
-    inferred-vars get inferred-vars-writes-globals push-new ;
-
-: apply-vars ( vars -- )
-    [
-        dup inferred-vars-reads [ apply-var-read ] each
-        dup inferred-vars-writes [ apply-var-write ] each
-        dup inferred-vars-reads-globals [ apply-global-read ] each
-        inferred-vars-writes-globals [ apply-global-write ] each
-    ] when* ;
diff --git a/core/compiler/inference/words.factor b/core/compiler/inference/words.factor
deleted file mode 100644 (file)
index ff5a050..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays errors generic hashtables kernel
-math math-internals namespaces parser prettyprint sequences
-strings vectors words ;
-IN: inference
-
-: consume-values ( seq node -- )
-    >r length r>
-    over ensure-values
-    over 0 rot node-inputs
-    meta-d get [ length swap - ] keep set-length ;
-
-: produce-values ( seq node -- )
-    >r [ drop <computed> ] map dup r> set-node-out-d
-    meta-d get swap nappend ;
-
-: recursing? ( word -- label/f )
-    recursive-state get <reversed> assoc ;
-
-: if-inline ( word true false -- )
-    >r >r dup "inline" word-prop r> r> if ; inline
-
-: make-call-node ( word -- node )
-    [ dup recursing? [ #call-label ] [ #call ] ?if ]
-    [ #call ]
-    if-inline ;
-
-: consume/produce ( effect word -- )
-    meta-d get clone >r
-    swap make-call-node dup node,
-    over effect-in over consume-values
-    over effect-out over produce-values
-    r> over #call-label? [ swap set-node-in-d ] [ 2drop ] if
-    effect-terminated? [ terminate ] when ;
-
-TUPLE: no-effect word ;
-
-: no-effect ( word -- * )
-    <no-effect> inference-warning ;
-
-: nest-node ( -- ) #entry node, ;
-
-: unnest-node ( new-node -- new-node )
-    dup node-param #return node,
-    dataflow-graph get 1array over set-node-children ;
-
-: add-recursive-state ( word label -- )
-    2array recursive-state [ swap add ] change ;
-
-: block-label ( word -- newword )
-    word-name " - inlined" append f <word> ;
-
-: inline-block ( word -- node-block data )
-    [
-        copy-inference nest-node
-        dup block-label 2dup add-recursive-state
-        #label >r word-def infer-quot r>
-        unnest-node
-    ] make-hash ;
-
-: apply-infer ( hash -- )
-    { meta-d meta-r d-in }
-    [ [ swap hash ] keep set ] each-with ;
-
-GENERIC: collect-recursion* ( label node -- )
-
-M: node collect-recursion* 2drop ;
-
-M: #call-label collect-recursion*
-    tuck node-param eq? [ node-in-d , ] [ drop ] if ;
-
-: collect-recursion ( #label -- seq )
-    dup node-param swap
-    [ [ collect-recursion* ] each-node-with ] { } make ;
-
-: join-values ( node -- )
-    collect-recursion meta-d get add unify-lengths unify-stacks
-    meta-d [ length tail* >vector ] change ;
-
-: splice-node ( node -- )
-    dup node-successor [
-        dup node, penultimate-node f over set-node-successor
-        dup current-node set
-    ] when drop ;
-
-: inline-closure ( word -- )
-    dup inline-block over recursive-label? [
-        meta-d get >r
-        drop join-values inline-block apply-infer
-        r> over 2dup set-node-out-d set-node-in-d node,
-    ] [
-        apply-infer node-child node-successor splice-node drop
-    ] if ;
-
-: infer-compound ( word -- hash )
-    [
-        recursive-state get init-inference inline-block nip
-    ] with-scope ;
-
-GENERIC: infer-word ( word -- effect data )
-
-M: word infer-word no-effect ;
-
-TUPLE: effect-error word effect ;
-
-: effect-error ( word effect -- * )
-    <effect-error> inference-error ;
-
-: check-effect ( word effect -- )
-    over "infer" word-prop [
-        over recorded get push
-        over "declared-effect" word-prop 2dup
-        [ swap effect<= [ effect-error ] unless ] [ 2drop ] if
-    ] unless 2drop ;
-
-: save-inferred-data ( word effect vars -- )
-    >r over r>
-    dup vars-trivial? [ drop f ] when
-    "inferred-vars" set-word-prop
-    "inferred-effect" set-word-prop ;
-
-: finish-word ( word -- effect vars )
-    current-effect inferred-vars get
-    pick custom-infer? [
-        rot drop
-    ] [
-        >r 2dup check-effect r>
-        [ save-inferred-data ] 2keep
-    ] if ;
-
-M: compound infer-word
-    [ dup infer-compound [ finish-word ] bind ]
-    [ swap t "no-effect" set-word-prop rethrow ] recover ;
-
-: custom-infer ( word -- )
-    #! Customized inference behavior
-    dup "inferred-vars" word-prop apply-vars
-    dup "inferred-effect" word-prop effect-in ensure-values
-    "infer" word-prop call ;
-
-: apply-effect/vars ( word effect vars -- )
-    apply-vars consume/produce ;
-
-: cached-infer ( word -- )
-    dup "inferred-effect" word-prop
-    over "inferred-vars" word-prop
-    apply-effect/vars ;
-
-: default-apply-word ( word -- )
-    {
-        { [ dup "no-effect" word-prop ] [ no-effect ] }
-        { [ dup "infer" word-prop ] [ custom-infer ] }
-        { [ dup "inferred-effect" word-prop ] [ cached-infer ] }
-        { [ t ] [ dup infer-word apply-effect/vars ] }
-    } cond ;
-
-M: word apply-word default-apply-word ;
-
-M: symbol apply-word apply-literal ;
-
-TUPLE: recursive-declare-error word ;
-
-: declared-infer ( word -- )
-    dup stack-effect [
-        consume/produce
-    ] [
-        <recursive-declare-error> inference-error
-    ] if* ;
-
-: apply-inline ( word -- )
-    dup recursive-state get peek first eq?
-    [ declared-infer ] [ inline-closure ] if ;
-
-: apply-compound ( word -- )
-    dup recursing?
-    [ declared-infer ] [ default-apply-word ] if ;
-
-: custom-infer-vars ( word -- )
-    dup "infer-vars" word-prop dup [
-        swap "inferred-effect" word-prop effect-in ensure-values
-        call
-    ] [
-        2drop
-    ] if ;
-
-M: compound apply-word
-    dup custom-infer-vars
-    [ apply-inline ] [ apply-compound ] if-inline ;
diff --git a/core/compiler/inference/words.facts b/core/compiler/inference/words.facts
deleted file mode 100644 (file)
index ce6eae9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-IN: inference
-USING: help words ;
-
-HELP: consume/produce
-{ $values { "word" "a word" } { "effect" "an instance of " { $link effect } } }
-{ $description "Adds a node to the dataflow graph that calls " { $snippet "word" } " with a stack effect of " { $snippet "effect" } "." } ;
-
-HELP: no-effect
-{ $values { "word" "a word" } }
-{ $description "Throws a " { $link no-effect } " error." }
-{ $error-description "Thrown when inference encounters a call to a word which is already known not to have a static stack effect, due to a prior inference attempt failing." } ;
-
-HELP: collect-recursion
-{ $values { "#label" "a " { $link #label } " node" } { "seq" "a new sequence" } }
-{ $description "Collect the input stacks of all child " { $link #call-label } " nodes that call the given label." } ;
-
-HELP: inline-closure
-{ $values { "word" "a word" } }
-{ $description "Called during inference to infer stack effects of inline words."
-$terpri
-"If the inline word is recursive, a new " { $link #label } " node is added to the dataflow graph, and the word has to be inferred twice, to determine which literals survive the recursion (eg, quotations) and which don't (loop indices, etc)."
-$terpri
-"If the inline word is not recursive, the resulting nodes are spliced into the dataflow graph, and no " { $link #label } " node is created." } ;
-
-HELP: effect-error
-{ $values { "word" "a word" } { "effect" "an instance of " { $link effect } } }
-{ $description "Throws an " { $link effect-error } "." }
-{ $error-description "Thrown when a word's inferred stack effect does not match its declared stack effect." } ;
-
-HELP: recursive-declare-error
-{ $error-description "Thrown when inference encounters a recursive call to a word lacking a stack effect declaration. Recursive words must declare a stack effect in order to compile. Due to implementation detail, generic words are recursive, and thus the same restriction applies." } ;
diff --git a/core/compiler/load.factor b/core/compiler/load.factor
deleted file mode 100644 (file)
index 784044d..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-PROVIDE: core/compiler
-{ +files+ {
-    "inference/shuffle.factor"
-    "inference/dataflow.factor"
-    "inference/variables.factor"
-    "inference/inference.factor"
-    "inference/branches.factor"
-    "inference/words.factor"
-    "inference/stack.factor"
-    "inference/known-words.factor"
-    "inference/errors.factor"
-
-    "optimizer/specializers.factor"
-    "optimizer/class-infer.factor"
-    "optimizer/kill-literals.factor"
-    "optimizer/optimizer.factor"
-    "optimizer/inline-methods.factor"
-    "optimizer/call-optimizers.factor"
-
-    "generator/architecture.factor"
-    "generator/templates.factor"
-    "generator/xt.factor"
-    "generator/generator.factor"
-
-    "compiler.factor"
-
-    "alien/malloc.factor"
-    "alien/c-types.factor"
-    "alien/structs.factor"
-    "alien/compiler.factor"
-    "alien/alien-invoke.factor"
-    "alien/alien-callback.factor"
-    "alien/alien-indirect.factor"
-    "alien/prettyprint.factor"
-    "alien/syntax.factor"
-
-    "alien/alien-callback.facts"
-    "alien/alien-indirect.facts"
-    "alien/alien-invoke.facts"
-    "alien/aliens.facts"
-    "alien/c-types.facts"
-    "alien/malloc.facts"
-    "alien/structs.facts"
-    "alien/syntax.facts"
-    "inference/branches.facts"
-    "inference/dataflow.facts"
-    "inference/inference.facts"
-    "inference/shuffle.facts"
-    "inference/stack.facts"
-    "inference/words.facts"
-    "compiler.facts"
-} }
-{ +tests+ {
-    "test/inference.factor"
-    "test/alien-objects.factor"
-    "test/simple.factor"
-    "test/templates.factor"
-    "test/stack.factor"
-    "test/ifte.factor"
-    "test/generic.factor"
-    "test/bail-out.factor"
-    "test/intrinsics.factor"
-    "test/float.factor"
-    "test/identities.factor"
-    "test/optimizer.factor"
-    "test/alien.factor"
-    "test/callbacks.factor"
-    "test/stack-trace.factor"
-} } ;
diff --git a/core/compiler/optimizer/call-optimizers.factor b/core/compiler/optimizer/call-optimizers.factor
deleted file mode 100644 (file)
index 90b4ef8..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: optimizer
-USING: arrays errors generic hashtables inference kernel
-math math-internals sequences words parser ;
-
-! A system for associating dataflow optimizers with words.
-
-: optimizer-hooks ( node -- conditions )
-    node-param "optimizer-hooks" word-prop ;
-
-: optimize-hooks ( node -- node/t )
-    dup optimizer-hooks cond ;
-
-: define-optimizers ( word optimizers -- )
-    { [ t ] [ drop t ] } add "optimizer-hooks" set-word-prop ;
-
-: partial-eval? ( #call -- ? )
-    dup node-param "foldable" word-prop [
-        dup node-in-d [ node-literal? ] all-with?
-    ] [
-        drop f
-    ] if ;
-
-: literal-in-d ( #call -- inputs )
-    dup node-in-d [ node-literal ] map-with ;
-
-: partial-eval ( #call -- node )
-    dup literal-in-d over node-param
-    [ with-datastack ] catch
-    [ 3drop t ] [ inline-literals ] if ;
-
-: call>no-op ( not -- node/f )
-    #! Note: cloning the vectors, since subst-values will modify
-    #! them.
-    [ node-in-d clone ] keep
-    [ node-out-d clone ] keep
-    [ subst-values ] keep node-successor ;
-
-: flip-branches ( not -- #if )
-    #! If a not is followed by an #if, flip branches and
-    #! remove the not.
-    call>no-op dup
-    dup node-children reverse swap set-node-children ;
-
-! An if following a not flips the two branches
-\ not {
-    { [ dup node-successor #if? ] [ flip-branches ] }
-} define-optimizers
-
-! eq? on objects of disjoint types is always f
-: disjoint-eq? ( node -- ? )
-    dup node-classes swap node-in-d
-    [ swap ?hash ] map-with
-    first2 2dup and [ classes-intersect? not ] [ 2drop f ] if ;
-
-\ eq? {
-    { [ dup disjoint-eq? ] [ [ f ] inline-literals ] }
-} define-optimizers
-
-! type applied to an object of a known type can be folded
-: known-type? ( node -- ? )
-    0 node-class# types length 1 number= ;
-
-: fold-known-type ( node -- node )
-    dup 0 node-class# types first 1array inline-literals ;
-
-\ type [
-    { [ dup known-type? ] [ fold-known-type ] }
-] define-optimizers
-
-! Arithmetic identities
-SYMBOL: @
-
-: define-identities ( words identities -- )
-    swap [ swap "identities" set-word-prop ] each-with ;
-
-: literals-match? ( values template -- ? )
-    [
-        over value? [ >r value-literal r> ] [ nip @ ] if =
-    ] 2map [ ] all? ;
-
-: values-match? ( values template -- ? )
-    [ @ = [ drop f ] unless ] 2map [ ] subset all-eq? ;
-
-: apply-identity? ( values identity -- ? )
-    first 2dup literals-match? >r values-match? r> and ;
-
-: find-identity ( node -- values identity )
-    dup node-in-d swap node-param "identities" word-prop
-    [ dupd apply-identity? ] find nip ;
-
-: apply-identities ( node -- node/f )
-    dup find-identity dup [
-        second swap dataflow-with [ subst-node ] keep
-    ] [
-        3drop f
-    ] if ;
-
-[ + fixnum+ bignum+ float+ ] {
-    { { @ 0 } [ drop ] }
-    { { 0 @ } [ nip ]  }
-} define-identities
-
-[ - fixnum- bignum- float- ] {
-    { { @ 0 } [ drop ]    }
-    { { @ @ } [ 2drop 0 ] }
-} define-identities
-
-[ * fixnum* bignum* float* ] {
-    { { @ 1 }  [ drop ]          }
-    { { 1 @ }  [ nip ]           }
-    { { @ 0 }  [ nip ]           }
-    { { 0 @ }  [ drop ]          }
-    { { @ -1 } [ drop 0 swap - ] }
-    { { -1 @ } [ nip 0 swap - ]  }
-} define-identities
-
-[ / fixnum/i bignum/i float/f ] {
-    { { @ 1 }  [ drop ]          }
-    { { @ -1 } [ drop 0 swap - ] }
-} define-identities
-
-[ fixnum-mod bignum-mod ] {
-    { { @ 1 }  [ 2drop 0 ] }
-} define-identities
-
-[ bitand fixnum-bitand bignum-bitand ] {
-    { { @ -1 } [ drop ] }
-    { { -1 @ } [ nip  ] }
-    { { @ @ }  [ drop ] }
-    { { @ 0 }  [ nip  ] }
-    { { 0 @ }  [ drop ] }
-} define-identities
-
-[ bitor fixnum-bitor bignum-bitor ] {
-    { { @ 0 }  [ drop ] }
-    { { 0 @ }  [ nip  ] }
-    { { @ @ }  [ drop ] }
-    { { @ -1 } [ nip  ] }
-    { { -1 @ } [ drop ] }
-} define-identities
-
-[ bitxor fixnum-bitxor bignum-bitxor ] {
-    { { @ 0 }  [ drop ]        }
-    { { 0 @ }  [ nip  ]        }
-    { { @ -1 } [ drop bitnot ] }
-    { { -1 @ } [ nip  bitnot ] }
-    { { @ @ }  [ 2drop 0 ]     }
-} define-identities
-
-[ shift fixnum-shift bignum-shift ] {
-    { { 0 @ } [ drop ] }
-    { { @ 0 } [ drop ] }
-} define-identities
-
-[ < fixnum< bignum< float< ] {
-    { { @ @ } [ 2drop f ] }
-} define-identities
-
-[ <= fixnum<= bignum<= float<= ] {
-    { { @ @ } [ 2drop t ] }
-} define-identities
-    
-[ > fixnum> bignum> float>= ] {
-    { { @ @ } [ 2drop f ] }
-} define-identities
-
-[ >= fixnum>= bignum>= float>= ] {
-    { { @ @ } [ 2drop t ] }
-} define-identities
-
-[ eq? bignum= float= number= = ] {
-    { { @ @ } [ 2drop t ] }
-} define-identities
-
-M: #call optimize-node*
-    {
-        { [ dup partial-eval? ] [ partial-eval ] }
-        { [ dup find-identity nip ] [ apply-identities ] }
-        { [ dup optimizer-hooks ] [ optimize-hooks ] }
-        { [ dup optimize-predicate? ] [ optimize-predicate ] }
-        { [ t ] [ inline-method ] }
-    } cond ;
diff --git a/core/compiler/optimizer/class-infer.factor b/core/compiler/optimizer/class-infer.factor
deleted file mode 100644 (file)
index 37f8128..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: optimizer
-USING: arrays generic hashtables inference kernel
-kernel-internals math namespaces sequences words parser ;
-
-! Infer possible classes of values in a dataflow IR.
-: node-class# ( node n -- class )
-    over node-in-d <reversed> ?nth node-class ;
-
-! Variables used by the class inferencer
-
-! Current value --> class mapping
-SYMBOL: value-classes
-
-! Current value --> literal mapping
-SYMBOL: value-literals
-
-! Maps ties to ties
-SYMBOL: ties
-
-GENERIC: apply-tie ( tie -- )
-
-M: f apply-tie drop ;
-
-TUPLE: class-tie value class ;
-
-: set-value-class* ( class value -- )
-    2dup swap <class-tie> ties get hash [ apply-tie ] when*
-    value-classes get set-hash ;
-
-M: class-tie apply-tie
-    dup class-tie-class swap class-tie-value
-    set-value-class* ;
-
-TUPLE: literal-tie value literal ;
-
-: set-value-literal* ( literal value -- )
-    over class over set-value-class*
-    2dup swap <literal-tie> ties get hash [ apply-tie ] when*
-    value-literals get set-hash ;
-
-M: literal-tie apply-tie
-    dup literal-tie-literal swap literal-tie-value
-    set-value-literal* ;
-
-GENERIC: infer-classes* ( node -- )
-
-M: node infer-classes* drop ;
-
-! For conditionals, a map of child node # --> possibility
-GENERIC: child-ties ( node -- seq )
-
-M: node child-ties
-    node-children length f <array> ;
-
-: value-class* ( value -- class )
-    value-classes get hash [ object ] unless* ;
-
-: value-literal* ( value -- class )
-    value-literals get hash ;
-
-: annotate-node ( node -- )
-    #! Annotate the node with the currently-inferred set of
-    #! value classes.
-    dup node-values
-    [ dup value-class* ] map>hash swap set-node-classes ;
-
-: intersect-classes ( classes values -- )
-    [
-        [ value-class* class-and ] keep set-value-class*
-    ] 2each ;
-
-: set-tie ( tie tie -- ) ties get set-hash ;
-
-: type/tag-ties ( node n -- )
-    over node-out-d first over [ <literal-tie> ] map-with
-    >r swap node-in-d first swap [ type>class <class-tie> ] map-with r>
-    [ set-tie ] 2each ;
-
-\ type [ num-types type/tag-ties ] "create-ties" set-word-prop
-
-\ tag [ num-tags type/tag-ties ] "create-ties" set-word-prop
-
-\ eq? [
-    dup node-in-d second value? [
-        dup node-in-d first2 value-literal* <literal-tie>
-        over node-out-d first general-t <class-tie>
-        set-tie
-    ] when drop
-] "create-ties" set-word-prop
-
-: create-ties ( #call -- )
-    #! If the node is calling a class test predicate, create a
-    #! tie.
-    dup node-param "create-ties" word-prop dup [
-        call
-    ] [
-        drop dup node-param "predicating" word-prop dup [
-            >r dup node-in-d first r> <class-tie>
-            swap node-out-d first general-t <class-tie>
-            set-tie
-        ] [
-            2drop
-        ] if
-    ] if ;
-
-\ <tuple> [
-    node-in-d first value-literal 1array
-] "output-classes" set-word-prop
-
-{ clone (clone) } [
-    [
-        node-in-d [ value-class* ] map
-    ] "output-classes" set-word-prop
-] each
-
-: output-classes ( node -- seq )
-    dup node-param "output-classes" word-prop [
-        call
-    ] [
-        node-param "inferred-effect" word-prop effect-out
-        dup [ word? ] all? [ drop f ] unless
-    ] if* ;
-
-M: #call infer-classes*
-    dup create-ties dup output-classes
-    [ swap node-out-d intersect-classes ] [ drop ] if* ;
-
-M: #push infer-classes*
-    node-out-d
-    [ [ value-literal ] keep set-value-literal* ] each ;
-
-M: #if child-ties
-    node-in-d first dup general-t <class-tie>
-    swap f <literal-tie> 2array ;
-
-M: #dispatch child-ties
-    dup node-in-d first
-    swap node-children length [ <literal-tie> ] map-with ;
-
-M: #declare infer-classes*
-    dup node-param swap node-in-d [ set-value-class* ] 2each ;
-
-DEFER: (infer-classes)
-
-: infer-children ( node -- )
-    dup node-children swap child-ties [
-        [
-            value-classes [ clone ] change
-            ties [ clone ] change
-            apply-tie
-            (infer-classes)
-        ] with-scope
-    ] 2each ;
-
-: merge-value-class ( # nodes -- class )
-    [ swap node-class# ] map-with
-    null [ class-or ] reduce ;
-
-: annotate-merge ( nodes values -- )
-    dup length
-    [ pick merge-value-class swap set-value-class* ] 2each
-    drop ;
-
-: active-children ( node -- seq )
-    node-children
-    [ last-node ] map
-    [ #terminate? not ] subset ;
-
-: merge-children ( node -- )
-    dup node-successor dup #merge? [
-        swap active-children dup empty? [
-            2drop
-        ] [
-            swap node-out-d <reversed> annotate-merge
-        ] if
-    ] [
-        2drop
-    ] if ;
-
-: (infer-classes) ( node -- )
-    [
-        dup infer-classes*
-        dup annotate-node
-        dup infer-children
-        dup merge-children
-        node-successor (infer-classes)
-    ] when* ;
-
-: ?<hashtable> [ H{ } clone ] unless* ;
-
-: infer-classes-with ( node classes literals -- )
-    [
-        ?<hashtable> value-literals set
-        ?<hashtable> value-classes set
-        H{ } clone ties set
-        (infer-classes)
-    ] with-scope ;
-
-: infer-classes ( node -- )
-    f f infer-classes-with ;
-
-: infer-classes/node ( existing node -- )
-    #! Infer classes, using the existing node's class info as a
-    #! starting point.
-    over node-classes rot node-literals infer-classes-with ;
diff --git a/core/compiler/optimizer/inline-methods.factor b/core/compiler/optimizer/inline-methods.factor
deleted file mode 100644 (file)
index da3271c..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: optimizer
-USING: arrays generic hashtables inference kernel
-kernel-internals math namespaces prettyprint sequences
-words ;
-
-: (inline-method) ( #call quot -- node )
-    dup t eq? [
-        2drop t
-    ] [
-        over node-in-d dataflow-with
-        2dup infer-classes/node
-        over node-param over remember-node
-        [ subst-node ] keep
-    ] if ;
-
-! Single dispatch method inlining optimization
-: dispatch# ( #call -- n )
-    node-param "combination" word-prop first ;
-
-: dispatching-class ( node -- class )
-    dup dispatch# node-class# ;
-
-: already-inlined? ( node -- ? )
-    #! Was this node inlined from definition of 'word'?
-    dup node-param swap node-history memq? ;
-
-: specific-method ( word class -- ? ) swap order min-class ;
-
-: inlining-class ( #call -- class )
-    #! If the generic dispatch can be eliminated, return the
-    #! class of the method that will always be invoked here.
-    dup node-param swap dispatching-class specific-method ;
-
-: will-inline-method ( node -- quot/t )
-    #! t indicates failure
-    dup inlining-class dup
-    [ swap node-param method method-def ] [ 2drop t ] if ;
-
-: inline-standard-method ( node -- node )
-    dup will-inline-method (inline-method) ;
-
-: inline-standard-method? ( #call -- ? )
-    dup already-inlined? not swap node-param standard-generic?
-    and ;
-
-! Partial dispatch of 2generic words
-: math-both-known? ( word left right -- ? )
-    math-class-max specific-method ;
-
-: will-inline-math-method ( word left right -- quot/t )
-    #! t indicates failure
-    3dup math-both-known? [ math-method ] [ 3drop t ] if ;
-
-: inline-math-method ( #call -- node )
-    dup node-param over 1 node-class# pick 0 node-class#
-    will-inline-math-method (inline-method) ;
-
-: inline-math-method? ( #call -- ? )
-    dup node-history [ 2generic? ] contains? not
-    swap node-param 2generic? and ;
-
-: inline-method ( #call -- node )
-    {
-        { [ dup inline-standard-method? ] [ inline-standard-method ] }
-        { [ dup inline-math-method? ] [ inline-math-method ] }
-        { [ t ] [ drop t ] }
-    } cond ;
-
-! Resolve type checks at compile time where possible
-: comparable? ( actual testing -- ? )
-    #! If actual is a subset of testing or if the two classes
-    #! are disjoint, return t.
-    2dup class< >r classes-intersect? not r> or ;
-
-: optimize-predicate? ( #call -- ? )
-    dup node-param "predicating" word-prop dup [
-        >r 0 node-class# r> comparable?
-    ] [
-        2drop f
-    ] if ;
-
-: inline-literals ( node literals -- node )
-    #! Make #shuffle -> #push -> #return -> successor
-    over drop-inputs [
-        >r >quotation [ literalize ] map dataflow
-        [ subst-node ] keep r> set-node-successor
-    ] keep ;
-
-: optimize-predicate ( #call -- node )
-    dup node-param "predicating" word-prop >r
-    dup 0 node-class# r> class< 1array inline-literals ;
diff --git a/core/compiler/optimizer/kill-literals.factor b/core/compiler/optimizer/kill-literals.factor
deleted file mode 100644 (file)
index 1658f81..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: optimizer
-USING: arrays generic hashtables inference kernel math
-namespaces sequences words ;
-
-: node-union ( node quot -- hash )
-    [
-        swap [ swap call [ dup set ] each ] each-node-with
-    ] make-hash ; inline
-
-GENERIC: literals* ( node -- seq )
-
-: literals ( node -- hash )
-    [ literals* ] node-union ;
-
-GENERIC: live-values* ( node -- seq )
-
-: live-values ( node -- hash )
-    #! All values that are returned or passed to calls.
-    [ live-values* ] node-union ;
-
-: kill-node* ( values node -- )
-    2dup [ node-in-d remove-all ] keep set-node-in-d
-    2dup [ node-out-d remove-all ] keep set-node-out-d
-    2dup [ node-in-r remove-all ] keep set-node-in-r
-    [ node-out-r remove-all ] keep set-node-out-r ;
-
-: kill-node ( values node -- )
-    over hash-empty?
-    [ 2drop ] [ [ kill-node* ] each-node-with ] if ;
-
-: kill-values ( node -- )
-    dup live-values over literals hash-diff swap kill-node ;
-
-! Generic nodes
-M: node literals* drop { } ;
-
-M: node live-values*
-    node-in-d [ value? ] subset ;
-
-! #push
-M: #push literals* node-out-d ;
-
-! #return
-M: #return live-values*
-    #! Values returned by local labels can be killed.
-    dup node-param [ drop { } ] [ delegate live-values* ] if ;
-
-! nodes that don't use their values directly
-UNION: #killable
-    #push #shuffle #>r #r> #call-label #merge #values #entry ;
-
-M: #killable live-values* drop { } ;
-
-: purge-invariants ( stacks -- seq )
-    #! Output a sequence of values which are not present in the
-    #! same position in each sequence of the stacks sequence.
-    unify-lengths flip [ all-eq? not ] subset concat ;
-
-! #label
-M: #label live-values*
-    dup node-child node-in-d over node-in-d 2array
-    swap collect-recursion append purge-invariants ;
-
-! branching
-UNION: #branch #if #dispatch ;
-
-M: #branch live-values*
-    #! This assumes that the last element of each branch is a
-    #! #return node.
-    dup delegate live-values* >r
-    node-children [ last-node node-in-d ] map purge-invariants
-    r> append ;
diff --git a/core/compiler/optimizer/optimizer.factor b/core/compiler/optimizer/optimizer.factor
deleted file mode 100644 (file)
index c53c03a..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: optimizer
-USING: arrays generic hashtables inference io kernel math
-namespaces sequences test vectors ;
-
-SYMBOL: optimizer-changed
-
-GENERIC: optimize-node* ( node -- node/t )
-
-: keep-optimizing ( node -- node ? )
-    dup optimize-node* dup t eq?
-    [ drop f ] [ nip keep-optimizing t or ] if ;
-
-: optimize-node ( node -- node )
-    [
-        keep-optimizing [ optimizer-changed on ] when
-    ] map-nodes ;
-
-: optimize-1 ( node -- node ? )
-    dup kill-values dup infer-classes [
-        optimizer-changed off
-        optimize-node
-        optimizer-changed get
-    ] with-node-iterator ;
-
-: optimize ( node -- node )
-    optimize-1 [ optimize ] when ;
-
-: prune-if ( node quot -- successor/t )
-    over >r call [ r> node-successor ] [ r> drop t ] if ;
-    inline
-
-! Generic nodes
-M: f optimize-node* drop t ;
-
-M: node optimize-node* drop t ;
-
-! #shuffle
-M: #shuffle optimize-node* 
-    [ node-values empty? ] prune-if ;
-
-! #>r
-M: #>r optimize-node*
-    dup node-successor #r>? [
-        node-successor node-successor
-    ] [
-        [ node-in-d empty? ] prune-if
-    ] if ;
-
-! #r>
-M: #r> optimize-node*
-    dup node-successor #>r? [
-        node-successor node-successor
-    ] [
-        [ node-in-r empty? ] prune-if
-    ] if ;
-
-! #push
-M: #push optimize-node* 
-    [ node-out-d empty? ] prune-if ;
-
-! #return
-M: #return optimize-node*
-    node-successor [ node-successor ] [ t ] if* ;
-
-! Some utilities for splicing in dataflow IR subtrees
-: post-inline ( #return/#values #call/#merge -- )
-    [
-        >r node-in-d r> node-out-d 2array unify-lengths first2
-    ] keep subst-values ;
-
-: ?hash-union ( hash/f hash -- hash )
-    over [ hash-union ] [ nip ] if ;
-
-: add-node-literals ( hash node -- )
-    [ node-literals ?hash-union ] keep set-node-literals ;
-
-: add-node-classes ( hash node -- )
-    [ node-classes ?hash-union ] keep set-node-classes ;
-
-: (subst-classes) ( literals classes node -- )
-    dup [
-        3dup [ add-node-classes ] keep add-node-literals
-        node-successor (subst-classes)
-    ] [
-        3drop
-    ] if ;
-
-: subst-classes ( #return/#values #call/#merge -- )
-    >r dup node-literals swap node-classes r> (subst-classes) ;
-
-: subst-node ( old new -- )
-    #! The last node of 'new' becomes 'old', then values are
-    #! substituted. A subsequent optimizer phase kills the
-    #! last node of 'new' and the first node of 'old'.
-    last-node 2dup swap 2dup post-inline subst-classes
-    set-node-successor ;
-
-! Constant branch folding
-: fold-branch ( node branch# -- node )
-    over drop-inputs >r
-    >r dup node-successor r> rot node-children nth
-    [ subst-node ] keep r> [ set-node-successor ] keep ;
-
-! #if
-: known-boolean-value? ( node value -- value ? )
-    2dup node-literal? [
-        node-literal t
-    ] [
-        node-class {
-            { [ dup null class< ] [ drop f f ] }
-            { [ dup general-t class< ] [ drop t t ] }
-            { [ dup \ f class< ] [ drop f t ] }
-            { [ t ] [ drop f f ] }
-        } cond
-    ] if ;
-
-M: #if optimize-node*
-    dup dup node-in-d first known-boolean-value?
-    [ 0 1 ? fold-branch ] [ 2drop t ] if ;
-
-! #dispatch
-M: #dispatch optimize-node*
-    dup dup node-in-d first 2dup node-literal? [
-        node-literal fold-branch
-    ] [
-        3drop t
-    ] if ;
diff --git a/core/compiler/optimizer/specializers.factor b/core/compiler/optimizer/specializers.factor
deleted file mode 100644 (file)
index cb528f3..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: arrays generic hashtables kernel kernel-internals math
-namespaces sequences vectors words ;
-
-: make-standard-specializer ( quot class picker -- quot )
-    over \ object eq? [
-        2drop
-    ] [
-        [
-            , "predicate" word-prop % dup , , \ if ,
-        ] [ ] make
-    ] if ;
-
-: make-math-specializer ( quot picker -- quot )
-    [
-        , \ tag , num-tags swap <array> , \ dispatch ,
-    ] [ ] make ;
-
-: make-specializer ( quot class picker -- quot )
-    over number eq? [
-        nip make-math-specializer
-    ] [
-        make-standard-specializer
-    ] if ;
-
-: specialized-def ( word -- quot )
-    dup word-def swap "specializer" word-prop [
-        <reversed> { dup over pick } [
-            make-specializer
-        ] 2each
-    ] when* ;
-
-{ 1+ 1- sq neg recip sgn truncate } [
-    { number } "specializer" set-word-prop
-] each
-
-{ vneg norm-sq norm normalize } [
-    { array } "specializer" set-word-prop
-] each
-
-\ n*v { object array } "specializer" set-word-prop
-\ v*n { array object } "specializer" set-word-prop
-\ n/v { object array } "specializer" set-word-prop
-\ v/n { array object } "specializer" set-word-prop
-
-{ v+ v- v* v/ vmax vmin v. } [
-    { array array } "specializer" set-word-prop
-] each
-
-{ hash* remove-hash set-hash } [
-    { hashtable } "specializer" set-word-prop
-] each
-
-{ first first2 first3 first4 }
-[ { array } "specializer" set-word-prop ] each
-
-{ peek pop* pop push } [
-    { vector } "specializer" set-word-prop
-] each
diff --git a/core/compiler/pentium4/intrinsics.factor b/core/compiler/pentium4/intrinsics.factor
deleted file mode 100644 (file)
index de120a3..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays assembler generic kernel kernel-internals
-math math-internals memory namespaces sequences words ;
-IN: compiler
-
-M: float-regs (%peek)
-    drop
-    fp-scratch swap %move-int>int
-    fp-scratch %move-int>float ;
-
-M: float-regs (%replace) drop swap %allot-float ;
-
-: define-float-op ( word op -- )
-    [ "x" operand "y" operand ] swap add H{
-        { +input+ { { float "x" } { float "y" } } }
-        { +output+ { "x" } }
-    } define-intrinsic ;
-
-{
-    { float+ ADDSD }
-    { float- SUBSD }
-    { float* MULSD }
-    { float/f DIVSD }
-} [
-    first2 define-float-op
-] each
-
-: define-float-jump ( word op -- )
-    [ "x" operand "y" operand UCOMISD ] swap add
-    { { float "x" } { float "y" } } define-if-intrinsic ;
-
-{
-    { float< JB }
-    { float<= JBE }
-    { float> JA }
-    { float>= JAE }
-    { float= JE }
-} [
-    first2 define-float-jump
-] each
-
-\ float>fixnum [
-    "out" operand "in" operand CVTTSD2SI
-    "out" operand tag-bits SHL
-] H{
-    { +input+ { { float "in" } } }
-    { +scratch+ { { f "out" } } }
-    { +output+ { "out" } }
-} define-intrinsic
-
-\ fixnum>float [
-    "in" operand tag-bits SAR
-    "out" operand "in" operand CVTSI2SD
-] H{
-    { +input+ { { f "in" } } }
-    { +scratch+ { { float "out" } } }
-    { +output+ { "out" } }
-} define-intrinsic
diff --git a/core/compiler/pentium4/load.factor b/core/compiler/pentium4/load.factor
deleted file mode 100644 (file)
index 17ef829..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-REQUIRES: core/compiler/x86 ;
-
-PROVIDE: core/compiler/pentium4
-{ +files+ { "intrinsics.factor" } } ;
diff --git a/core/compiler/ppc/allot.factor b/core/compiler/ppc/allot.factor
deleted file mode 100644 (file)
index ada9045..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: kernel assembler kernel-internals namespaces math ;
-
-: load-zone-ptr ( reg -- )
-    "generations" f pick compile-dlsym dup 0 LWZ ;
-
-: %allot ( header size -- )
-    #! Store a pointer to 'size' bytes allocated from the
-    #! nursery in r11.
-    dup maybe-gc
-    8 align ! align the size
-    12 load-zone-ptr ! nusery -> r12
-    11 12 cell LWZ ! nursery.here -> r11
-    11 11 pick ADDI ! increment r11
-    11 12 cell STW ! r11 -> nursery.here
-    11 11 rot SUBI ! old value
-    tag-header 12 LI ! compute header
-    12 11 0 STW ! store header
-    ;
-
-: %allot-float ( reg -- )
-    #! exits with tagged ptr to object in r12, untagged in r11
-    float-tag 16 %allot
-    11 8 STFD
-    11 12 float-tag ORI ;
-
-M: float-regs (%replace)
-    drop
-    swap v>operand %allot-float
-    12 swap loc>operand STW ;
-
-: %allot-bignum ( #digits -- )
-    #! 1 cell header, 1 cell length, 1 cell sign, + digits
-    #! length is the # of digits + sign
-    bignum-tag over 3 + cells %allot
-    1+ tag-bits shift 12 LI ! compute the length
-    12 11 cell STW ! store the length
-    ;
-
-: %allot-bignum-signed-1 ( reg -- )
-    #! on entry, reg is a 30-bit quantity sign-extended to
-    #! 32-bits.
-    #! exits with tagged ptr to bignum in reg
-    [
-        "end" define-label
-        "pos" define-label
-        1 %allot-bignum
-        0 over 0 CMPI ! is the fixnum negative?
-        "pos" get BGE
-        1 12 LI
-        12 11 2 cells STW ! store negative sign
-        dup dup -1 MULI ! negate fixnum
-        "end" get B
-        "pos" resolve-label
-        0 12 LI
-        12 11 2 cells STW ! store positive sign
-        "end" resolve-label
-        dup 11 3 cells STW ! store the number
-        11 swap bignum-tag ORI ! tag the bignum, store it in reg
-    ] with-scope ;
-
-: %allot-bignum-signed-2 ( reg1 reg2 -- )
-    #! this word has some hairy restrictions; its really only
-    #! intended to be used by fixnum*.
-    #! - reg1 and reg2 together form a 60-bit signed quantity
-    #!   (product of two 29-bit fixnums cannot exceed this)
-    #! - the quantity must be non-zero
-    #!   (if the product of two fixnums is zero, there's no
-    #!   overflow so this word won't be called in that case)
-    #! exits with tagged ptr to bignum in reg1
-    [
-        "end" define-label
-        "pos" define-label
-        2 %allot-bignum
-        0 pick 0 CMPI ! is the 60-bit quantity negative?
-        "pos" get BGE
-        1 12 LI
-        12 11 2 cells STW ! store negative sign
-        over dup NOT ! negate 60-bit quanity
-        dup dup -1 MULI
-        "end" get B
-        "pos" resolve-label
-        0 12 LI
-        12 11 2 cells STW ! store positive sign
-        "end" resolve-label
-        HEX: 3fffffff 12 LOAD ! first 30 bits set
-        dup dup 12 AND ! store the number
-        11 3 cells STW
-        dup dup 12 AND
-        dup 11 4 cells STW
-        11 swap bignum-tag ORI ! tag the bignum, store it in reg
-    ] with-scope ;
diff --git a/core/compiler/ppc/architecture.factor b/core/compiler/ppc/architecture.factor
deleted file mode 100644 (file)
index 4a41ce0..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: alien assembler generic kernel kernel-internals math
-memory namespaces sequences words ;
-
-: code-format cell ; inline
-
-! PowerPC register assignments
-! r3-r10 integer vregs
-! f0-f13 float vregs
-! r11, r12 scratch
-! r14 data stack
-! r15 call stack
-
-! Stack layout:
-
-! Mach-O -vs- Linux/PPC
-: stack@ macosx? 24 8 ? + ;
-: lr@ macosx? 8 4 ? + ;
-
-M: int-regs return-reg drop 3 ;
-M: int-regs fastcall-regs drop { 3 4 5 6 7 8 9 10 } ;
-M: int-regs vregs drop { 3 4 5 6 7 8 9 10 } ;
-
-M: float-regs return-reg drop 1 ;
-M: float-regs fastcall-regs drop { 1 2 3 4 5 6 7 8 } ;
-M: float-regs vregs drop { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
-
-GENERIC: loc>operand ( loc -- reg n )
-
-M: ds-loc loc>operand ds-loc-n cells neg 14 swap ;
-M: cs-loc loc>operand cs-loc-n cells neg 15 swap ;
-
-M: immediate load-literal
-    [ v>operand ] 2apply LOAD ;
-
-M: object load-literal
-    v>operand
-    [ 0 swap LOAD32 rel-absolute-2/2 rel-literal ] keep
-    dup 0 LWZ ;
-
-: stack-increment \ stack-reserve get 32 max stack@ 16 align ;
-
-: %prologue ( n -- )
-    \ stack-reserve set
-    1 1 stack-increment neg STWU
-    0 MFLR
-    0 1 stack-increment lr@ STW ;
-
-: %epilogue ( -- )
-    #! At the end of each word that calls a subroutine, we store
-    #! the previous link register value in r0 by popping it off
-    #! the stack, set the link register to the contents of r0,
-    #! and jump to the link register.
-    0 1 stack-increment lr@ LWZ
-    1 1 stack-increment ADDI
-    0 MTLR ;
-
-: word-addr ( word -- )
-    #! Load a word address into r3.
-    0 3 LOAD32 rel-absolute-2/2 rel-word ;
-
-: %call ( label -- )
-    #! Far C call for primitives, near C call for compiled defs.
-    dup (compile)
-    dup primitive? [ word-addr  3 MTLR  BLRL ] [ BL ] if ;
-
-: %jump-label ( label -- )
-    #! For tail calls. IP not saved on C stack.
-    dup primitive? [ word-addr  3 MTCTR  BCTR ] [ B ] if ;
-
-: %jump ( label -- )
-    %epilogue dup (compile) %jump-label ;
-
-: %jump-t ( label -- )
-    0 "flag" operand object-tag CMPI BNE ;
-
-: %dispatch ( -- )
-    #! The value 20 is a magic number. It is the length of the
-    #! instruction sequence that follows
-    [
-        "n" operand dup 1 SRAWI
-        0 "scratch" operand LOAD32 rel-absolute-2/2 rel-here
-        "n" operand dup "scratch" operand ADD
-        "n" operand dup 20 LWZ
-        "n" operand MTLR
-        BLR
-    ] H{
-        { +input+ { { f "n" } } }
-        { +scratch+ { { f "scratch" } } }
-    } with-template ;
-
-: %target ( label -- ) 0 , rel-absolute-cell rel-label ;
-
-: %return ( -- ) %epilogue BLR ;
-
-: compile-dlsym ( symbol dll register -- )
-    0 swap LOAD32 rel-absolute-2/2 rel-dlsym ;
-
-M: int-regs (%peek)
-    drop >r v>operand r> loc>operand LWZ ;
-
-M: float-regs (%peek)
-    drop fp-scratch v>operand swap loc>operand LWZ
-    fp-scratch [ v>operand ] 2apply float-offset LFD ;
-
-M: int-regs (%replace)
-    drop >r v>operand r> loc>operand STW ;
-
-: %move-int>int ( dst src -- )
-    [ v>operand ] 2apply MR ;
-
-: %move-int>float ( dst src -- )
-    [ v>operand ] 2apply float-offset LFD ;
-
-: %inc-d ( n -- ) 14 14 rot cells ADDI ;
-
-: %inc-r ( n -- ) 15 15 rot cells ADDI ;
-
-M: int-regs %freg>stack drop 1 rot stack@ STW ;
-
-M: int-regs %stack>freg drop 1 rot stack@ LWZ ;
-
-: STF float-regs-size 4 = [ STFS ] [ STFD ] if ;
-
-M: float-regs %freg>stack >r 1 rot stack@ r> STF ;
-
-: LF float-regs-size 4 = [ LFS ] [ LFD ] if ;
-
-M: float-regs %stack>freg >r 1 rot stack@ r> LF ;
-
-M: stack-params %stack>freg
-    drop 2dup = [
-        2drop
-    ] [
-        >r 0 1 rot stack@ LWZ 0 1 r> stack@ STW
-    ] if ;
-
-M: stack-params %freg>stack
-   >r stack-increment + swap r> %stack>freg ;
-
-: %unbox ( n reg-class func -- )
-    ! Call the unboxer
-    f %alien-invoke
-    ! Store the return value on the C stack
-    [ return-reg ] keep %freg>stack ;
-
-: %box ( n reg-class 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.
-    pick [
-        >r [ fastcall-regs first ] keep %stack>freg r>
-    ] [
-        2nip
-    ] if
-    f %alien-invoke ;
-
-: struct-ptr/size ( n size func -- )
-    ! Load destination address
-    >r >r 3 1 rot stack@ ADDI r>
-    ! Load struct size
-    4 LI
-    r> f %alien-invoke ;
-
-: %unbox-struct ( n size -- )
-    "unbox_value_struct" struct-ptr/size ;
-
-: %box-struct ( n size -- )
-    "box_value_struct" struct-ptr/size ;
-
-: %alien-invoke ( symbol dll -- )
-    12 [ compile-dlsym ] keep MTLR BLRL ;
-
-: %alien-callback ( quot -- )
-    0 <int-vreg> load-literal "run_callback" f %alien-invoke ;
-
-: %prepare-alien-indirect ( -- )
-    "unbox_alien" f %alien-invoke
-    3 1 12 STW ;
-
-: %alien-indirect ( -- )
-    12 1 12 LWZ
-    12 MTLR BLRL ;
-
-: save-return 0 swap [ return-reg ] keep %freg>stack ;
-: load-return 0 swap [ return-reg ] keep %stack>freg ;
-
-: %callback-value ( reg-class func -- )
-    ! Call the unboxer
-    f %alien-invoke
-    ! Save return register
-    dup save-return
-    ! Restore data/callstacks
-    "unnest_stacks" f %alien-invoke
-    ! Restore return register
-    load-return ;
-
-: %cleanup ( n -- ) drop ;
-
-: %untag ( dest src -- ) 0 0 31 tag-bits - RLWINM ;
-
-: %tag-fixnum ( src dest -- ) tag-bits SLWI ;
-
-: %untag-fixnum ( src dest -- ) tag-bits SRAWI ;
diff --git a/core/compiler/ppc/assembler.factor b/core/compiler/ppc/assembler.factor
deleted file mode 100644 (file)
index 6dc9ca4..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: assembler
-USING: compiler errors generic kernel math memory namespaces
-words ;
-
-! See the Motorola or IBM documentation for details. The opcode
-! names are standard, and the operand order is the same as in
-! the docs, except a few differences, namely, in IBM/Motorola
-! assembler syntax, loads and stores are written like:
-!
-! stw r14,10(r15)
-!
-! In Factor, we write:
-!
-! 14 15 10 STW
-
-: insn ( operand opcode -- ) 26 shift bitor , ;
-
-: a-form ( d a b c xo rc -- n )
-    >r 1 shift >r 6 shift >r 11 shift >r 16 shift >r 21 shift
-    r> bitor r> bitor r> bitor r> bitor r> bitor ;
-
-: b-form ( bo bi bd aa lk -- n )
-    >r 1 shift >r 2 shift >r 16 shift >r 21 shift
-    r> bitor r> bitor r> bitor r> bitor ;
-
-: d-form ( d a simm -- n )
-    HEX: ffff bitand >r 16 shift >r 21 shift r> bitor r> bitor ;
-
-: i-form ( li aa lk -- n )
-    >r 1 shift bitor r> bitor ;
-
-: x-form ( a s b xo rc -- n )
-    swap
-    >r 1 shift >r 11 shift >r swap 16 shift >r 21 shift
-    r> bitor r> bitor r> bitor r> bitor ;
-
-: xfx-form ( d spr xo -- n )
-    1 shift >r 11 shift >r 21 shift r> bitor r> bitor ;
-
-: xo-form ( d a b oe rc xo -- n )
-    swap
-    >r 1 shift >r 10 shift >r 11 shift >r 16 shift >r 21 shift
-    r> bitor r> bitor r> bitor r> bitor r> bitor ;
-
-: ADDI d-form 14 insn ;   : LI 0 rot ADDI ;   : SUBI neg ADDI ;
-: ADDIS d-form 15 insn ;  : LIS 0 rot ADDIS ;
-
-: ADDIC d-form 12 insn ;  : SUBIC neg ADDIC ;
-
-: ADDIC. d-form 13 insn ; : SUBIC. neg ADDIC. ;
-
-: MULI d-form 7 insn ;
-
-: (ADD) 266 xo-form 31 insn ;
-: ADD 0 0 (ADD) ;  : ADD. 0 1 (ADD) ;
-: ADDO 1 0 (ADD) ; : ADDO. 1 1 (ADD) ;
-
-: (ADDC) 10 xo-form 31 insn ;
-: ADDC 0 0 (ADDC) ;  : ADDC. 0 1 (ADDC) ;
-: ADDCO 1 0 (ADDC) ; : ADDCO. 1 1 (ADDC) ;
-
-: (ADDE) 138 xo-form 31 insn ;
-: ADDE 0 0 (ADDE) ;  : ADDE. 0 1 (ADDE) ;
-: ADDEO 1 0 (ADDE) ; : ADDEO. 1 1 (ADDE) ;
-
-: ANDI d-form 28 insn ;
-: ANDIS d-form 29 insn ;
-
-: (AND) 28 x-form 31 insn ;
-: AND 0 (AND) ;  : AND. 0 (AND) ;
-
-: (DIVW) 491 xo-form 31 insn ;
-: DIVW 0 0 (DIVW) ;  : DIVW. 0 1 (DIVW) ;
-: DIVWO 1 0 (DIVW) ; : DIVWO. 1 1 (DIVW) ;
-
-: (DIVWU) 459 xo-form 31 insn ;
-: DIVWU 0 0 (DIVWU) ;  : DIVWU. 0 1 (DIVWU) ;
-: DIVWUO 1 0 (DIVWU) ; : DIVWUO. 1 1 (DIVWU) ;
-
-: (EQV) 284 x-form 31 insn ;
-: EQV 0 (EQV) ;  : EQV. 1 (EQV) ;
-
-: (NAND) 476 x-form 31 insn ;
-: NAND 0 (NAND) ;  : NAND. 1 (NAND) ;
-
-: (NOR) 124 x-form 31 insn ;
-: NOR 0 (NOR) ;  : NOR. 1 (NOR) ;
-
-: NOT dup NOR ;   : NOT. dup NOR. ;
-
-: ORI d-form 24 insn ;  : ORIS d-form 25 insn ;
-
-: (OR) 444 x-form 31 insn ;
-: OR 0 (OR) ;  : OR. 1 (OR) ;
-
-: (ORC) 412 x-form 31 insn ;
-: ORC 0 (ORC) ;  : ORC. 1 (ORC) ;
-
-: MR dup OR ;  : MR. dup OR. ;
-
-: (MULHW) 75 xo-form 31 insn ;
-: MULHW 0 0 (MULHW) ;  : MULHW. 0 1 (MULHW) ;
-
-: MULLI d-form 7 insn ;
-
-: (MULHWU) 11 xo-form 31 insn ;
-: MULHWU 0 0 (MULHWU) ;  : MULHWU. 0 1 (MULHWU) ;
-
-: (MULLW) 235 xo-form 31 insn ;
-: MULLW 0 0 (MULLW) ;  : MULLW. 0 1 (MULLW) ;
-: MULLWO 1 0 (MULLW) ; : MULLWO. 1 1 (MULLW) ;
-
-: (SLW) 24 x-form 31 insn ;
-: SLW 0 (SLW) ;  : SLW. 1 (SLW) ;
-
-: (SRAW) 792 x-form 31 insn ;
-: SRAW 0 (SRAW) ;  : SRAW. 1 (SRAW) ;
-
-: (SRW) 536 x-form 31 insn ;
-: SRW 0 (SRW) ;  : SRW. 1 (SRW) ;
-
-: SRAWI 0 824 x-form 31 insn ;
-
-: (SUBF) 40 xo-form 31 insn ;
-: SUBF 0 0 (SUBF) ;  : SUBF. 0 1 (SUBF) ;
-: SUBFO 1 0 (SUBF) ; : SUBFO. 1 1 (SUBF) ;
-
-: (SUBFC) 8 xo-form 31 insn ;
-: SUBFC 0 0 (SUBFC) ;  : SUBFC. 0 1 (SUBFC) ;
-: SUBFCO 1 0 (SUBFC) ; : SUBFCO. 1 1 (SUBFC) ;
-
-: (SUBFE) 136 xo-form 31 insn ;
-: SUBFE 0 0 (SUBFE) ;  : SUBFE. 0 1 (SUBFE) ;
-: SUBFEO 1 0 (SUBFE) ; : SUBFEO. 1 1 (SUBFE) ;
-
-: XORI d-form 26 insn ;
-: XORIS d-form 27 insn ;
-
-: (XOR) 316 x-form 31 insn ;
-: XOR 0 (XOR) ;  : XOR. 1 (XOR) ;
-
-: CMPI d-form 11 insn ;
-: CMPLI d-form 10 insn ;
-
-: CMP 0 0 x-form 31 insn ;
-: CMPL 0 32 x-form 31 insn ;
-
-: (RLWINM) a-form 21 insn ;
-: RLWINM 0 (RLWINM) ;  : RLWINM. 1 (RLWINM) ;
-
-: SLWI 0 31 pick - RLWINM ;  : SLWI. 0 31 pick - RLWINM. ;
-
-: LBZ d-form 34 insn ;  : LBZU d-form 35 insn ;
-: LHA d-form 42 insn ;  : LHAU d-form 43 insn ;
-: LHZ d-form 40 insn ;  : LHZU d-form 41 insn ;
-: LWZ d-form 32 insn ;  : LWZU d-form 33 insn ;
-
-: STB d-form 38 insn ;  : STBU d-form 39 insn ;
-: STH d-form 44 insn ;  : STHU d-form 45 insn ;
-: STW d-form 36 insn ;  : STWU d-form 37 insn ;
-
-G: (B) ( dest aa lk -- ) 2 standard-combination ;
-M: integer (B) i-form 18 insn ;
-M: word (B) 0 -rot (B) rel-relative-3 rel-word ;
-M: label (B) 0 -rot (B) rel-relative-3 rel-label ;
-
-: B 0 0 (B) ; : BL 0 1 (B) ;
-
-GENERIC: BC ( a b c -- )
-M: integer BC 0 0 b-form 16 insn ;
-M: word BC >r 0 BC r> rel-relative-2 rel-word ;
-M: label BC >r 0 BC r> rel-relative-2 rel-label ;
-
-: BLT 12 0 rot BC ;  : BGE 4 0 rot BC ;
-: BGT 12 1 rot BC ;  : BLE 4 1 rot BC ;
-: BEQ 12 2 rot BC ;  : BNE 4 2 rot BC ;
-: BO  12 3 rot BC ;  : BNO 4 3 rot BC ;
-
-: BCLR 0 8 0 0 b-form 19 insn ;
-: BLR 20 BCLR ;
-: BCLRL 0 8 0 1 b-form 19 insn ;
-: BLRL 20 BCLRL ;
-: BCCTR 0 264 0 0 b-form 19 insn ;
-: BCTR 20 BCCTR ;
-
-: MFSPR 5 shift 339 xfx-form 31 insn ;
-: MFXER 1 MFSPR ;  : MFLR 8 MFSPR ;  : MFCTR 9 MFSPR ;
-
-: MTSPR 5 shift 467 xfx-form 31 insn ;
-: MTXER 1 MTSPR ;  : MTLR 8 MTSPR ;  : MTCTR 9 MTSPR ;
-
-: LOAD32 >r w>h/h r> tuck LIS dup rot ORI ;
-
-: LOAD ( n r -- )
-    #! PowerPC cannot load a 32 bit literal in one instruction.
-   >r dup -32768 32767 between? [ r> LI ] [ r> LOAD32 ] if ;
-
-! Floating point
-: LFS d-form 48 insn ;  : LFSU d-form 49 insn ;
-: LFD d-form 50 insn ;  : LFDU d-form 51 insn ;
-: STFS d-form 52 insn ; : STFSU d-form 53 insn ;
-: STFD d-form 54 insn ; : STFDU d-form 55 insn ;
-
-: (FMR) >r 0 -rot 72 r> x-form 63 insn ;
-: FMR 0 (FMR) ;  : FMR. 1 (FMR) ;
-
-: (FCTIWZ) >r 0 -rot r> 15 x-form 63 insn ;
-: FCTIWZ 0 (FCTIWZ) ;  : FCTIWZ. 1 (FCTIWZ) ;
-
-: (FADD) >r 0 21 r> a-form 63 insn ;
-: FADD 0 (FADD) ;  : FADD. 1 (FADD) ;
-
-: (FSUB) >r 0 20 r> a-form 63 insn ;
-: FSUB 0 (FSUB) ;  : FSUB. 1 (FSUB) ;
-
-: (FMUL) >r 0 swap 25 r> a-form 63 insn ;
-: FMUL 0 (FMUL) ;  : FMUL. 1 (FMUL) ;
-
-: (FDIV) >r 0 18 r> a-form 63 insn ;
-: FDIV 0 (FDIV) ;  : FDIV. 1 (FDIV) ;
-
-: (FSQRT) >r 0 swap 0 22 r> a-form 63 insn ;
-: FSQRT 0 (FSQRT) ;  : FSQRT. 1 (FSQRT) ;
-
-: FCMPU 0 0 x-form 63 insn ;
-: FCMPO 0 32 x-form 63 insn ;
diff --git a/core/compiler/ppc/intrinsics.factor b/core/compiler/ppc/intrinsics.factor
deleted file mode 100644 (file)
index cbea020..0000000
+++ /dev/null
@@ -1,369 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: alien assembler kernel kernel-internals math
-math-internals namespaces sequences words ;
-
-: generate-slot ( size quot -- )
-    >r >r
-    ! turn tagged fixnum slot # into an offset, multiple of 4
-    "n" operand dup tag-bits r> - SRAWI
-    ! compute slot address
-    "obj" operand dup "n" operand ADD
-    ! load slot value
-    "obj" operand dup r> call ; inline
-
-\ slot [
-    "obj" operand dup %untag
-    cell log2 [ 0 LWZ ] generate-slot
-] H{
-    { +input+ { { f "obj" } { f "n" } } }
-    { +output+ { "obj" } }
-} define-intrinsic
-
-\ char-slot [
-    1 [ string-offset LHZ ] generate-slot
-    "obj" operand dup %tag-fixnum
-] H{
-    { +input+ { { f "n" } { f "obj" } } }
-    { +output+ { "obj" } }
-} define-intrinsic
-
-: generate-set-slot ( size quot -- )
-    >r >r
-    ! turn tagged fixnum slot # into an offset, multiple of 4
-    "slot" operand dup tag-bits r> - SRAWI
-    ! compute slot address in 1st input
-    "slot" operand dup "obj" operand ADD
-    ! store new slot value
-    "val" operand "slot" operand r> call ; inline
-
-: generate-write-barrier ( -- )
-    #! Mark the card pointed to by vreg.
-    "obj" operand dup card-bits SRAWI
-    "obj" operand dup 16 ADD
-    "x" operand "obj" operand 0 LBZ
-    "x" operand dup card-mark ORI
-    "x" operand "obj" operand 0 STB ;
-
-\ set-slot [
-    "obj" operand dup %untag
-    cell log2 [ 0 STW ] generate-set-slot generate-write-barrier
-] H{
-    { +input+ { { f "val" } { f "obj" } { f "slot" } } }
-    { +scratch+ { { f "x" } } }
-    { +clobber+ { "obj" "slot" } }
-} define-intrinsic
-
-\ set-char-slot [
-    ! untag the new value in 0th input
-    "val" operand dup %untag-fixnum
-    1 [ string-offset STH ] generate-set-slot
-] H{
-    { +input+ { { f "val" } { f "slot" } { f "obj" } } }
-    { +scratch+ { { f "x" } } }
-    { +clobber+ { "val" "slot" "obj" } }
-} define-intrinsic
-
-: define-fixnum-op ( word op -- )
-    [ [ "x" operand "y" operand "x" operand ] % , ] [ ] make H{
-        { +input+ { { f "x" } { f "y" } } }
-        { +output+ { "x" } }
-    } define-intrinsic ;
-
-{
-    { fixnum+fast ADD }
-    { fixnum-fast SUBF }
-    { fixnum-bitand AND }
-    { fixnum-bitor OR }
-    { fixnum-bitxor XOR }
-} [
-    first2 define-fixnum-op
-] each
-
-: generate-fixnum-mod
-    #! PowerPC doesn't have a MOD instruction; so we compute
-    #! x-(x/y)*y. Puts the result in "s" operand.
-    "s" operand "r" operand "y" operand MULLW
-    "s" operand "s" operand "x" operand SUBF ;
-
-\ fixnum-mod [
-    ! divide x by y, store result in x
-    "r" operand "x" operand "y" operand DIVW
-    generate-fixnum-mod
-] H{
-    { +input+ { { f "x" } { f "y" } } }
-    { +scratch+ { { f "r" } { f "s" } } }
-    { +output+ { "s" } }
-} define-intrinsic
-
-\ fixnum-bitnot [
-    "x" operand dup NOT
-    "x" operand dup %untag
-] H{
-    { +input+ { { f "x" } } }
-    { +output+ { "x" } }
-} define-intrinsic
-
-: define-fixnum-jump ( word op -- )
-    [ "x" operand 0 "y" operand CMP ] swap add
-    { { f "x" } { f "y" } } define-if-intrinsic ;
-
-{
-    { fixnum< BLT }
-    { fixnum<= BLE }
-    { fixnum> BGT }
-    { fixnum>= BGE }
-    { eq? BEQ }
-} [
-    first2 define-fixnum-jump
-] each
-
-: simple-overflow ( word -- )
-    [
-        >r
-        "end" define-label
-        "end" get BNO
-        { "x" "y" } [ dup %untag-fixnum ] unique-operands
-        "r" operand "y" operand "x" operand r> execute
-        "r" operand %allot-bignum-signed-1
-        "end" resolve-label
-    ] with-scope ; inline
-
-\ fixnum+ [
-    0 MTXER
-    "r" operand "y" operand "x" operand ADDO.
-    \ ADD simple-overflow
-] H{
-    { +input+ { { f "x" } { f "y" } } }
-    { +scratch+ { { f "r" } } }
-    { +output+ { "r" } }
-    { +clobber+ { "x" "y" } }
-} define-intrinsic
-
-\ fixnum- [
-    0 MTXER
-    "r" operand "y" operand "x" operand SUBFO.
-    \ SUBF simple-overflow
-] H{
-    { +input+ { { f "x" } { f "y" } } }
-    { +scratch+ { { f "r" } } }
-    { +output+ { "r" } }
-    { +clobber+ { "x" "y" } }
-} define-intrinsic
-
-! \ fixnum* [
-!     "end" define-label
-!     "r" operand "x" operand %untag-fixnum
-!     0 MTXER
-!     "s" operand "y" operand "r" operand MULLWO.
-!     "end" get BNO
-!     "s" operand "y" operand 1 SRAWI
-!     "x" operand "s" operand "r" operand MULLWO.
-!     "x" operand dup 2 SRAWI
-!     "s" operand "s" operand "r" operand MULHW
-!     "s" operand "x" operand %allot-bignum-signed-2
-!     "end" resolve-label
-! ] H{
-!     { +input+ { { f "x" } { f "y" } } }
-!     { +scratch+ { { f "r" } { f "s" } } }
-!     { +output+ { "s" } }
-!     { +clobber+ { "x" "y" } }
-! } define-intrinsic
-
-: generate-fixnum/i
-    #! This VOP is funny. If there is an overflow, it falls
-    #! through to the end, and the result is in "x" operand.
-    #! Otherwise it jumps to the "no-overflow" label and the
-    #! result is in "r" operand.
-    "end" define-label
-    "no-overflow" define-label
-    "r" operand "x" operand "y" operand DIVW
-    ! if the result is greater than the most positive fixnum,
-    ! which can only ever happen if we do
-    ! most-negative-fixnum -1 /i, then the result is a bignum.
-    most-positive-fixnum "s" operand LOAD
-    "r" operand 0 "s" operand CMP
-    "no-overflow" get BLE
-    most-negative-fixnum neg "x" operand LOAD
-    "x" operand %allot-bignum-signed-1 ;
-
-\ fixnum/i [
-    generate-fixnum/i
-    "end" get B
-    "no-overflow" resolve-label
-    "r" operand "x" operand %tag-fixnum
-    "end" resolve-label
-] H{
-    { +input+ { { f "x" } { f "y" } } }
-    { +scratch+ { { f "r" } { f "s" } } }
-    { +output+ { "x" } }
-    { +clobber+ { "y" } }
-} define-intrinsic
-
-\ fixnum/mod [
-    generate-fixnum/i
-    0 "s" operand LI
-    "end" get B
-    "no-overflow" resolve-label
-    generate-fixnum-mod
-    "r" operand "x" operand %tag-fixnum
-    "end" resolve-label
-] H{
-    { +input+ { { f "x" } { f "y" } } }
-    { +scratch+ { { f "r" } { f "s" } } }
-    { +output+ { "x" "s" } }
-    { +clobber+ { "y" } }
-} define-intrinsic
-
-\ fixnum>bignum [
-    "nonzero" define-label
-    "end" define-label
-    0 "x" operand 0 CMPI ! is it zero?
-    "nonzero" get BNE
-    0 >bignum "x" get load-literal
-    "end" get B
-    "nonzero" resolve-label
-    "x" operand dup %untag-fixnum
-    "x" operand %allot-bignum-signed-1
-    "end" resolve-label
-] H{
-    { +input+ { { f "x" } } }
-    { +output+ { "x" } }
-} define-intrinsic
-
-\ bignum>fixnum [
-    "nonzero" define-label
-    "positive" define-label
-    "end" define-label
-    "x" operand dup %untag
-    "y" operand "x" operand cell LWZ
-     ! if the length is 1, its just the sign and nothing else,
-     ! so output 0
-    0 "y" operand 1 tag-bits shift CMPI
-    "nonzero" get BNE
-    0 "y" operand LI
-    "end" get B
-    "nonzero" resolve-label
-    ! load the value
-    "y" operand "x" operand 3 cells LWZ
-    ! load the sign
-    "x" operand "x" operand 2 cells LWZ
-    ! is the sign negative?
-    0 "x" operand 0 CMPI
-    "positive" get BEQ
-    "y" operand dup -1 MULI
-    "positive" resolve-label
-    "y" operand dup %tag-fixnum
-    "end" resolve-label
-] H{
-    { +input+ { { f "x" } } }
-    { +scratch+ { { f "y" } } }
-    { +clobber+ { "x" } }
-    { +output+ { "y" } }
-} define-intrinsic
-
-: define-float-op ( word op -- )
-    [ [ "x" operand "x" operand "y" operand ] % , ] [ ] make H{
-        { +input+ { { float "x" } { float "y" } } }
-        { +output+ { "x" } }
-    } define-intrinsic ;
-
-{
-    { float+ FADD }
-    { float- FSUB }
-    { float* FMUL }
-    { float/f FDIV }
-} [
-    first2 define-float-op
-] each
-
-: define-float-jump ( word op -- )
-    [ "x" operand 0 "y" operand FCMPU ] swap add
-    { { float "x" } { float "y" } } define-if-intrinsic ;
-
-{
-    { float< BLT }
-    { float<= BLE }
-    { float> BGT }
-    { float>= BGE }
-    { float= BEQ }
-} [
-    first2 define-float-jump
-] each
-
-\ float>fixnum [
-    "scratch" operand "in" operand FCTIWZ
-    "scratch" operand 1 0 stack@ STFD
-    "out" operand 1 cell stack@ LWZ
-    "out" operand dup %tag-fixnum
-] H{
-    { +input+ { { float "in" } } }
-    { +scratch+ { { float "scratch" } { f "out" } } }
-    { +output+ { "out" } }
-} define-intrinsic
-
-\ tag [
-    "in" operand "out" operand tag-mask ANDI
-    "out" operand dup %tag-fixnum
-] H{
-    { +input+ { { f "in" } } }
-    { +scratch+ { { f "out" } } }
-    { +output+ { "out" } }
-} define-intrinsic
-
-\ type [
-    "f" define-label
-    "end" define-label
-    ! Get the tag
-    "obj" operand "y" operand tag-mask ANDI
-    ! Tag the tag
-    "y" operand "x" operand %tag-fixnum
-    ! Compare with object tag number (3).
-    0 "y" operand object-tag CMPI
-    ! Jump if the object doesn't store type info in its header
-    "end" get BNE
-    ! It does store type info in its header
-    ! Is the pointer itself equal to 3? Then its F_TYPE (9).
-    0 "obj" operand object-tag CMPI
-    "f" get BEQ
-    ! The pointer is not equal to 3. Load the object header.
-    "x" operand "obj" operand object-tag neg LWZ
-    "x" operand dup %untag
-    "end" get B
-    "f" resolve-label
-    ! The pointer is equal to 3. Load F_TYPE (9).
-    f type tag-bits shift "x" operand LI
-    "end" resolve-label
-] H{
-    { +input+ { { f "obj" } } }
-    { +scratch+ { { f "x" } { f "y" } } }
-    { +output+ { "x" } }
-} define-intrinsic
-
-: userenv ( reg -- )
-    #! Load the userenv pointer in a register.
-    "userenv" f rot compile-dlsym ;
-
-\ getenv [
-    "n" operand dup 1 SRAWI
-    "x" operand userenv
-    "x" operand "n" operand "x" operand ADD
-    "x" operand dup 0 LWZ
-] H{
-    { +input+ { { f "n" } } }
-    { +scratch+ { { f "x" } } }
-    { +output+ { "x" } }
-    { +clobber+ { "n" } }
-} define-intrinsic
-
-\ setenv [
-    "n" operand dup 1 SRAWI
-    "x" operand userenv
-    "x" operand "n" operand "x" operand ADD
-    "val" operand "x" operand 0 STW
-] H{
-    { +input+ { { f "val" } { f "n" } } }
-    { +scratch+ { { f "x" } } }
-    { +clobber+ { "n" } }
-} define-intrinsic
diff --git a/core/compiler/ppc/load.factor b/core/compiler/ppc/load.factor
deleted file mode 100644 (file)
index 401c0f3..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-PROVIDE: core/compiler/ppc
-{ +files+ {
-    "assembler.factor"
-    "architecture.factor"
-    "allot.factor"
-    "intrinsics.factor"
-} } ;
diff --git a/core/compiler/summary.txt b/core/compiler/summary.txt
new file mode 100644 (file)
index 0000000..09cfea3
--- /dev/null
@@ -0,0 +1 @@
+Factor's optimizing machine code compiler
diff --git a/core/compiler/tags.txt b/core/compiler/tags.txt
new file mode 100644 (file)
index 0000000..86a7c8e
--- /dev/null
@@ -0,0 +1 @@
+compiler
diff --git a/core/compiler/test/alien-objects.factor b/core/compiler/test/alien-objects.factor
deleted file mode 100644 (file)
index a41eb8a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-IN: temporary
-USING: alien arrays kernel kernel-internals namespaces test
-errors sequences ;
-
-[ t ] [ 0 <alien> 0 <alien> = ] unit-test
-[ f ] [ 0 <alien> 1024 <alien> = ] unit-test
-[ f ] [ "hello" 1024 <alien> = ] unit-test
-[ f ] [ 0 <alien> ] unit-test
-[ f ] [ 0 f <displaced-alien> ] unit-test
-
-! Testing the various bignum accessor
-10 <byte-array> "dump" set
-
-[ "dump" get alien-address ] unit-test-fails
-
-[ 123 ] [
-    123 "dump" get 0 set-alien-signed-1
-    "dump" get 0 alien-signed-1
-] unit-test
-
-[ 12345 ] [
-    12345 "dump" get 0 set-alien-signed-2
-    "dump" get 0 alien-signed-2
-] unit-test
-
-[ 12345678 ] [
-    12345678 "dump" get 0 set-alien-signed-4
-    "dump" get 0 alien-signed-4
-] unit-test
-
-[ 12345678901234567 ] [
-    12345678901234567 "dump" get 0 set-alien-signed-8
-    "dump" get 0 alien-signed-8
-] unit-test
-
-[ -1 ] [
-    -1 "dump" get 0 set-alien-signed-8
-    "dump" get 0 alien-signed-8
-] unit-test
-
-cell 8 = [
-    [ HEX: 123412341234 ] [
-      8 <byte-array>
-      HEX: 123412341234 over 0 set-alien-signed-8
-      0 alien-signed-8
-    ] unit-test
-    
-    [ HEX: 123412341234 ] [
-      8 <byte-array>
-      HEX: 123412341234 over 0 set-alien-signed-cell
-      0 alien-signed-cell
-    ] unit-test
-] when
-
-[ "\u00ff" ]
-[ "\u00ff" string>char-alien alien>char-string ]
-unit-test
-
-[ "hello world" ]
-[ "hello world" string>char-alien alien>char-string ]
-unit-test
-
-[ "hello\uabcdworld" ]
-[ "hello\uabcdworld" string>u16-alien alien>u16-string ]
-unit-test
-
-[ t ] [ f expired? ] unit-test
-
-[ "fdasfds" ] [ [ "fdasfds" f dlsym ] catch third ] unit-test
index 955e6b242cd77fe06b03e3f7073b872e6e61565e..edb5de09405c21a0cc6f1839ead202558f9aa66a 100644 (file)
@@ -1,8 +1,8 @@
 IN: temporary
-USING: alien compiler kernel namespaces namespaces test
-sequences inference errors ;
-
-[ t ] [ [ [ alien-indirect ] infer ] catch inference-error? ] unit-test
+USING: alien alien.c-types alien.syntax compiler kernel
+namespaces namespaces tools.test sequences inference words
+arrays parser quotations continuations inference.backend effects
+namespaces.private io io.streams.string memory system threads ;
 
 FUNCTION: void ffi_test_0 ;
 [ ] [ ffi_test_0 ] unit-test
@@ -12,6 +12,7 @@ FUNCTION: int ffi_test_1 ;
 
 FUNCTION: int ffi_test_2 int x int y ;
 [ 5 ] [ 2 3 ffi_test_2 ] unit-test
+[ "hi" 3 ffi_test_2 ] unit-test-fails
 
 FUNCTION: int ffi_test_3 int x int y int z int t ;
 [ 25 ] [ 2 3 4 5 ffi_test_3 ] unit-test
@@ -22,8 +23,112 @@ FUNCTION: float ffi_test_4 ;
 FUNCTION: double ffi_test_5 ;
 [ 1.5 ] [ ffi_test_5 ] unit-test
 
+FUNCTION: int ffi_test_9 int a int b int c int d int e int f int g ;
+[ 28 ] [ 1 2 3 4 5 6 7 ffi_test_9 ] unit-test
+[ "a" 2 3 4 5 6 7 ffi_test_9 ] unit-test-fails
+[ 1 2 3 4 5 6 "a" ffi_test_9 ] unit-test-fails
+
+C-STRUCT: foo
+    { "int" "x" }
+    { "int" "y" }
+;
+
+: make-foo ( x y -- foo )
+    "foo" <c-object> [ set-foo-y ] keep [ set-foo-x ] keep ;
+
+FUNCTION: int ffi_test_11 int a foo b int c ;
+
+[ 14 ] [ 1 2 3 make-foo 4 ffi_test_11 ] unit-test
+
+FUNCTION: 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 ;
+
+[ 66 ] [ 1 2 3 4 5 6 7 8 9 10 11 ffi_test_13 ] unit-test
+
+FUNCTION: foo ffi_test_14 int x int y ;
+
+[ 11 6 ] [ 11 6 ffi_test_14 dup foo-x swap foo-y ] unit-test
+
+FUNCTION: char* ffi_test_15 char* x char* y ;
+
+[ "foo" ] [ "xy" "zt" ffi_test_15 ] unit-test
+[ "bar" ] [ "xy" "xy" ffi_test_15 ] unit-test
+[ 1 2 ffi_test_15 ] unit-test-fails
+
+C-STRUCT: bar
+    { "long" "x" }
+    { "long" "y" }
+    { "long" "z" }
+;
+
+FUNCTION: bar ffi_test_16 long x long y long z ;
+
+[ 11 6 -7 ] [
+    11 6 -7 ffi_test_16 dup bar-x over bar-y rot bar-z
+] unit-test
+
+C-STRUCT: tiny
+    { "int" "x" }
+;
+
+FUNCTION: tiny ffi_test_17 int x ;
+
+[ 11 ] [ 11 ffi_test_17 tiny-x ] unit-test
+
+[ t ] [ [ [ alien-indirect ] infer ] catch inference-error? ] unit-test
+
+: indirect-test-1
+    "int" { } "cdecl" alien-indirect ;
+
+: short-effect
+    dup effect-in length swap effect-out length 2array ;
+
+[ { 1 1 } ] [ [ indirect-test-1 ] infer short-effect ] unit-test
+
+[ 3 ] [ "ffi_test_1" f dlsym indirect-test-1 ] unit-test
+
+[ -1 indirect-test-1 ] unit-test-fails
+
+: indirect-test-2
+    "int" { "int" "int" } "cdecl" alien-indirect data-gc ;
+
+[ { 3 1 } ] [ [ indirect-test-2 ] infer short-effect ] unit-test
+
+[ 5 ]
+[ 2 3 "ffi_test_2" f dlsym indirect-test-2 ]
+unit-test
+
+: indirect-test-3
+    "int" { "int" "int" "int" "int" } "stdcall" alien-indirect
+    data-gc ;
+
+! This is a hack -- words are compiled before top-level forms
+! run.
+
+DEFER: >> delimiter
+: << \ >> parse-until >quotation call ; parsing
+
+<< "f-stdcall" f "stdcall" add-library >>
+
+[ f ] [ "f-stdcall" load-library ] unit-test
+[ "stdcall" ] [ "f-stdcall" library library-abi ] unit-test
+
+: ffi_test_18 ( w x y z -- int )
+    "int" "f-stdcall" "ffi_test_18" { "int" "int" "int" "int" }
+    alien-invoke data-gc ;
+
+[ 25 ] [ 2 3 4 5 ffi_test_18 ] unit-test
+
+: ffi_test_19 ( x y z -- bar )
+    "bar" "f-stdcall" "ffi_test_19" { "long" "long" "long" }
+    alien-invoke data-gc ;
+
+[ 11 6 -7 ] [
+    11 6 -7 ffi_test_19 dup bar-x over bar-y rot bar-z
+] 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 ] unit-test-fails
 
 FUNCTION: double ffi_test_7 double x double y ;
 [ 6.0 ] [ 3.0 2.0 ffi_test_7 ] unit-test
@@ -31,30 +136,33 @@ FUNCTION: double ffi_test_7 double x double y ;
 FUNCTION: double ffi_test_8 double x float y double z float t int w ;
 [ 19.0 ] [ 3.0 2.0 1.0 6.0 7 ffi_test_8 ] unit-test
 
-FUNCTION: int ffi_test_9 int a int b int c int d int e int f int g ;
-[ 28 ] [ 1 2 3 4 5 6 7 ffi_test_9 ] unit-test
-
 FUNCTION: int ffi_test_10 int a int b double c int d float e int f int g int h ;
 [ -34 ] [ 1 2 3.0 4 5.0 6 7 8 ffi_test_10 ] unit-test
 
-BEGIN-STRUCT: foo
-    FIELD: int x
-    FIELD: int y
-END-STRUCT
+FUNCTION: void ffi_test_20 double x1, double x2, double x3,
+       double y1, double y2, double y3,
+       double z1, double z2, double z3 ;
 
-: make-foo ( x y -- foo )
-    "foo" <c-object> [ set-foo-y ] keep [ set-foo-x ] keep ;
+[ ] [ 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 ffi_test_20 ] unit-test
 
-FUNCTION: int ffi_test_11 int a foo b int c ;
+FUNCTION: longlong ffi_test_21 long x long y ;
 
-[ 14 ] [ 1 2 3 make-foo 4 ffi_test_11 ] unit-test
+[ 121932631112635269 ]
+[ 123456789 987654321 ffi_test_21 ] unit-test
+
+FUNCTION: long ffi_test_22 long x longlong y longlong z ;
+
+[ 987655432 ]
+[ 1111 121932631112635269 123456789 ffi_test_22 ] unit-test
+
+[ 1111 f 123456789 ffi_test_22 ] unit-test-fails
 
-BEGIN-STRUCT: rect
-    FIELD: float x
-    FIELD: float y
-    FIELD: float w
-    FIELD: float h
-END-STRUCT
+C-STRUCT: rect
+    { "float" "x" }
+    { "float" "y" }
+    { "float" "w" }
+    { "float" "h" }
+;
 
 : <rect>
     "rect" <c-object>
@@ -67,29 +175,126 @@ FUNCTION: int ffi_test_12 int a int b rect c int d int e int f ;
 
 [ 45 ] [ 1 2 3.0 4.0 5.0 6.0 <rect> 7 8 9 ffi_test_12 ] unit-test
 
-FUNCTION: 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 ;
+[ 1 2 { 1 2 3 } 7 8 9 ffi_test_12 ] unit-test-fails
 
-[ 66 ] [ 1 2 3 4 5 6 7 8 9 10 11 ffi_test_13 ] unit-test
+FUNCTION: float ffi_test_23 ( float[3] x, float[3] y ) ;
 
-FUNCTION: foo ffi_test_14 int x int y ;
+[ 32.0 ] [ { 1.0 2.0 3.0 } >c-float-array { 4.0 5.0 6.0 } >c-float-array ffi_test_23 ] unit-test
 
-cpu "x86" = macosx? and [
-    [ 11 6 ] [ 11 6 ffi_test_14 dup foo-x swap foo-y ] unit-test
-] when
+! Test odd-size structs
+C-STRUCT: test-struct-1 { { "char" 1 } "x" } ;
 
-: indirect-test-1
-    "int" { } "cdecl" alien-indirect ;
+FUNCTION: test-struct-1 ffi_test_24 ;
 
-[ 3 ] [ "ffi_test_1" f dlsym indirect-test-1 ] unit-test
+[ B{ 1 } ] [ ffi_test_24 ] unit-test
 
-: indirect-test-2
-    "int" { "int" "int" } "cdecl" alien-indirect ;
+C-STRUCT: test-struct-2 { { "char" 2 } "x" } ;
 
-[ 5 ]
-[ 2 3 "ffi_test_2" f dlsym indirect-test-2 ]
-unit-test
+FUNCTION: test-struct-2 ffi_test_25 ;
 
-FUNCTION: char* ffi_test_15 char* x char* y ;
+[ B{ 1 2 } ] [ ffi_test_25 ] unit-test
 
-[ "foo" ] [ "xy" "zt" ffi_test_15 ] unit-test
-[ "bar" ] [ "xy" "xy" ffi_test_15 ] unit-test
+C-STRUCT: test-struct-3 { { "char" 3 } "x" } ;
+
+FUNCTION: test-struct-3 ffi_test_26 ;
+
+[ B{ 1 2 3 } ] [ ffi_test_26 ] unit-test
+
+C-STRUCT: test-struct-4 { { "char" 4 } "x" } ;
+
+FUNCTION: test-struct-4 ffi_test_27 ;
+
+[ B{ 1 2 3 4 } ] [ ffi_test_27 ] unit-test
+
+C-STRUCT: test-struct-5 { { "char" 5 } "x" } ;
+
+FUNCTION: test-struct-5 ffi_test_28 ;
+
+[ B{ 1 2 3 4 5 } ] [ ffi_test_28 ] unit-test
+
+C-STRUCT: test-struct-6 { { "char" 6 } "x" } ;
+
+FUNCTION: test-struct-6 ffi_test_29 ;
+
+[ B{ 1 2 3 4 5 6 } ] [ ffi_test_29 ] unit-test
+
+C-STRUCT: test-struct-7 { { "char" 7 } "x" } ;
+
+FUNCTION: test-struct-7 ffi_test_30 ;
+
+[ B{ 1 2 3 4 5 6 7 } ] [ ffi_test_30 ] unit-test
+
+! Test callbacks
+
+: callback-1 "void" { } "cdecl" [ ] alien-callback ;
+
+[ 0 1 ] [ [ callback-1 ] infer dup effect-in swap effect-out ] unit-test
+
+[ t ] [ callback-1 alien? ] unit-test
+
+: callback_test_1 "void" { } "cdecl" alien-indirect ;
+
+[ ] [ callback-1 callback_test_1 ] unit-test
+
+: callback-2 "void" { } "cdecl" [ [ 5 throw ] catch drop ] alien-callback ;
+
+[ ] [ callback-2 callback_test_1 ] unit-test
+
+: callback-3 "void" { } "cdecl" [ 5 "x" set ] alien-callback ;
+
+[ t ] [ 
+    namestack*
+    3 "x" set callback-3 callback_test_1
+    namestack* eq?
+] unit-test
+
+[ 5 ] [ 
+    [
+        3 "x" set callback-3 callback_test_1 "x" get
+    ] with-scope
+] unit-test
+
+: callback-4
+    "void" { } "cdecl" [ "Hello world" write ] alien-callback
+    data-gc ;
+
+[ "Hello world" ] [ 
+    [ callback-4 callback_test_1 ] string-out
+] unit-test
+
+: callback-5
+    "void" { } "cdecl" [ data-gc ] alien-callback ;
+
+[ "testing" ] [
+    "testing" callback-5 callback_test_1
+] unit-test
+
+: callback-5a
+    "void" { } "cdecl" [ 8000000 f <array> drop ] alien-callback ;
+
+! Hack; if we're on ARM, we probably don't have much RAM, so
+! skip this test.
+cpu "arm" = [
+    [ "testing" ] [
+        "testing" callback-5a callback_test_1
+    ] unit-test
+] unless
+
+: callback-6
+    "void" { } "cdecl" [ [ continue ] callcc0 ] alien-callback ;
+
+[ 1 2 3 ] [ callback-6 callback_test_1 1 2 3 ] unit-test
+
+: callback-7
+    "void" { } "cdecl" [ 1000 sleep ] alien-callback ;
+
+[ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test
+
+[ f ] [ namespace global eq? ] unit-test
+
+: callback-8
+    "void" { } "cdecl" [
+        [ continue ] callcc0
+    ] alien-callback ;
+
+[ ] [ callback-8 callback_test_1 ] unit-test
diff --git a/core/compiler/test/bail-out.factor b/core/compiler/test/bail-out.factor
deleted file mode 100644 (file)
index 7549215..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-IN: temporary
-USE: compiler
-USE: errors
-USE: math
-USE: test
-USE: kernel
-
-: bail-out call + ;
-
-[ 4 ] [ [ 2 2 ] bail-out ] unit-test
diff --git a/core/compiler/test/callbacks.factor b/core/compiler/test/callbacks.factor
deleted file mode 100644 (file)
index 8eed90e..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-IN: temporary
-USING: alien compiler errors inference io kernel
-kernel-internals math memory namespaces test threads words ;
-
-: callback-1 "void" { } [ ] alien-callback ;
-
-[ 0 1 ] [ [ callback-1 ] infer nip dup effect-in swap effect-out ] unit-test
-
-[ t ] [ callback-1 alien? ] unit-test
-
-: callback_test_1 "void" { } "cdecl" alien-indirect ;
-
-[ ] [ callback-1 callback_test_1 ] unit-test
-
-: callback-2 "void" { } [ [ 5 throw ] catch drop ] alien-callback ;
-
-[ ] [ callback-2 callback_test_1 ] unit-test
-
-: callback-3 "void" { } [ 5 "x" set ] alien-callback ;
-
-[ t ] [ 
-    namestack*
-    3 "x" set callback-3 callback_test_1
-    namestack* eq?
-] unit-test
-
-[ 5 ] [ 
-    [
-        3 "x" set callback-3 callback_test_1 "x" get
-    ] with-scope
-] unit-test
-
-: callback-4 "void" { } [ "Hello world" write ] alien-callback ;
-
-[ "Hello world" ] [ 
-    [ callback-4 callback_test_1 ] string-out
-] unit-test
-
-: callback-5
-    "void" { } [ full-gc ] alien-callback ;
-
-[ "testing" ] [
-    "testing" callback-5 callback_test_1
-] unit-test
-
-: callback-6
-    "void" { } [ [ continue ] callcc0 ] alien-callback ;
-
-[ 1 2 3 ] [ callback-6 callback_test_1 1 2 3 ] unit-test
-
-: callback-7
-    "void" { } [ 1000 sleep ] alien-callback ;
-
-[ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test
-
-[ f ] [ namespace global eq? ] unit-test
-
-: callback-8
-    "void" { "int" "int" } [ / "x" set ] alien-callback ;
-
-: callback_test_2
-    "void" { "int" "int" } "cdecl" alien-indirect ;
-
-[ 3/4 ] [
-    [
-        "x" off 3 4 callback-8 callback_test_2 "x" get
-    ] with-scope
-] unit-test
-
-: callback-9
-    "void" { "int" "double" "int" }
-    [ + * "x" set ] alien-callback ;
-
-: callback_test_3
-    "void" { "int" "double" "int" } "cdecl" alien-indirect ;
-
-[ 27.0 ] [
-    [
-        "x" off 3 4.0 5 callback-9 callback_test_3 "x" get
-    ] with-scope
-] unit-test
-
-: callback-11 "int" { } [ 1234 ] alien-callback ;
-
-: callback_test_5 "int" { } "cdecl" alien-indirect ;
-
-[ 1234 ] [ callback-11 callback_test_5 ] unit-test
-
-: callback-12 "float" { } [ pi ] alien-callback ;
-
-: callback_test_6 "float" { } "cdecl" alien-indirect ;
-
-[ t ] [ callback-12 callback_test_6 pi - 0.00001 <= ] unit-test
-
-: callback-13 "double" { } [ pi ] alien-callback ;
-
-: callback_test_7 "double" { } "cdecl" alien-indirect ;
-
-[ t ] [ callback-13 callback_test_7 pi = ] unit-test
-
-: callback-10
-    "void"
-    { "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" }
-    [ datastack "stack" set ] alien-callback ;
-
-: callback_test_4
-    "void"
-    { "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" }
-    "cdecl"
-    alien-indirect ;
-
-[ V{ 1 2 3 4 5 6 7 8 9 10 } ] [
-    [
-        1 2 3 4 5 6 7 8 9 10 callback-10 callback_test_4
-        "stack" get
-    ] with-scope
-] unit-test
-
-BEGIN-STRUCT: foo
-    FIELD: int x
-    FIELD: int y
-END-STRUCT
-
-: make-foo ( x y -- foo )
-    "foo" <c-object> [ set-foo-y ] keep [ set-foo-x ] keep ;
-
-: callback-14
-    "int"
-    { "foo" }
-    [ dup foo-x swap foo-y / ] alien-callback ;
-
-: callback_test_8 "int" { "foo" } "cdecl" alien-indirect ;
-
-[ 5 ] [ 10 2 make-foo callback-14 callback_test_8 ] unit-test
-
-! Callback scheduling issue
-: callback_test_9 "int" { } "cdecl" alien-indirect ;
-
-: callback-16
-    "int" { } [
-        yield 2
-    ] alien-callback ;
-
-: callback-15
-    "int" { } [
-        [ callback-16 callback_test_9 ] in-thread 3
-    ] alien-callback ;
-
-[ 3 ] [ callback-15 callback_test_9 ] unit-test
diff --git a/core/compiler/test/curry.factor b/core/compiler/test/curry.factor
new file mode 100644 (file)
index 0000000..e7401fb
--- /dev/null
@@ -0,0 +1,61 @@
+USING: tools.test compiler quotations math kernel sequences
+assocs namespaces ;
+IN: temporary
+
+[ 3 ] [ 5 [ [ 2 - ] curry call ] compile-1 ] unit-test
+[ 3 ] [ [ 5 [ 2 - ] curry call ] compile-1 ] unit-test
+[ 3 ] [ [ 5 2 [ - ] 2curry call ] compile-1 ] unit-test
+[ 3 ] [ 5 [ 2 [ - ] 2curry call ] compile-1 ] unit-test
+[ 3 ] [ 5 2 [ [ - ] 2curry call ] compile-1 ] unit-test
+[ 1/3 ] [ 5 2 [ [ - ] 2curry 1 swap call / ] compile-1 ] unit-test
+[ 1/3 ] [ 5 2 [ [ - ] 2curry >r 1 r> call / ] compile-1 ] unit-test
+
+[ -10 -20 ] [ 10 20 -1 [ [ * ] curry 2apply ] compile-1 ] unit-test
+
+[ [ 5 2 - ] ] [ 5 [ [ 2 - ] curry ] compile-1 >quotation ] unit-test
+[ [ 5 2 - ] ] [ [ 5 [ 2 - ] curry ] compile-1 >quotation ] unit-test
+[ [ 5 2 - ] ] [ [ 5 2 [ - ] 2curry ] compile-1 >quotation ] unit-test
+[ [ 5 2 - ] ] [ 5 [ 2 [ - ] 2curry ] compile-1 >quotation ] unit-test
+[ [ 5 2 - ] ] [ 5 2 [ [ - ] 2curry ] compile-1 >quotation ] unit-test
+
+[ [ 6 2 + ] ]
+[
+    2 5
+    [ >r [ + ] curry r> 0 < [ -2 ] [ 6 ] if swap curry ]
+    compile-1 >quotation
+] unit-test
+
+[ 8 ]
+[
+    2 5
+    [ >r [ + ] curry r> 0 < [ -2 ] [ 6 ] if swap curry call ]
+    compile-1
+] unit-test
+
+: foobar ( quot -- )
+    dup slip swap [ foobar ] [ drop ] if ; inline
+
+[ ] [ [ [ f ] foobar ] compile-1 ] unit-test
+
+[ { 6 7 8 } ] [ { 1 2 3 } 5 [ [ + ] curry map ] compile-1 ] unit-test
+[ { 6 7 8 } ] [ { 1 2 3 } [ 5 [ + ] curry map ] compile-1 ] unit-test
+
+: funky-assoc>map
+    [
+        [ call f ] curry assoc-find 3drop
+    ] { } make ; inline
+
+[ t ] [
+    global [ [ drop , ] funky-assoc>map ] compile-1
+    global keys =
+] unit-test
+
+[ 3 ] [ 1 2 [ curry [ 3 ] [ 4 ] if ] compile-1 ] unit-test
+
+[ 3 ] [ t [ 3 [ ] curry 4 [ ] curry if ] compile-1 ] unit-test
+
+[ 3 ] [ t [ 3 [ ] curry [ 4 ] if ] compile-1 ] unit-test
+
+[ 4 ] [ f [ 3 [ ] curry 4 [ ] curry if ] compile-1 ] unit-test
+
+[ 4 ] [ f [ [ 3 ] 4 [ ] curry if ] compile-1 ] unit-test
index 7589a1a2be9a42ac0d4b14ca18210ce6bb2bb8d2..404626dd36a423b5ce2fa32e92d2f24115b488cb 100644 (file)
@@ -1,8 +1,8 @@
 IN: temporary
-USING: compiler kernel kernel-internals memory math
-math-internals test ;
+USING: compiler kernel kernel.private memory math
+math.private tools.test math.floats.private ;
 
-[ 5.0 ] [ [ 5.0 ] compile-1 full-gc full-gc full-gc ] unit-test
+[ 5.0 ] [ [ 5.0 ] compile-1 data-gc data-gc data-gc ] unit-test
 [ 2.0 3.0 ] [ 3.0 [ 2.0 swap ] compile-1 ] unit-test
 
 [ 1 2 3 4.0 ] [ [ 1 2 3 4.0 ] compile-1 ] unit-test
@@ -81,3 +81,5 @@ math-internals test ;
 [ t ] [ 0.0 [ dup 0.0 float= swap -0.0 float= or ] compile-1 ] unit-test
 [ t ] [ -0.0 [ dup 0.0 float= swap -0.0 float= or ] compile-1 ] unit-test
 [ f ] [ 3.0 [ dup 0.0 float= swap -0.0 float= or ] compile-1 ] unit-test
+
+[ 315 315.0 ] [ 313 [ 2 fixnum+fast dup fixnum>float ] compile-1 ] unit-test
index 0d16fb21734d9d19c41f9cba1c6f54a25f5d6067..c54dbd753d0abe9066df66b2bcc5176153b477d2 100644 (file)
@@ -1,12 +1,6 @@
 IN: temporary
-USE: compiler
-USE: generic
-USE: test
-USE: math
-USE: kernel
-USE: words
-USE: arrays
-USE: sequences
+USING: compiler generic tools.test math kernel words arrays
+sequences quotations ;
 
 GENERIC: single-combination-test
 
diff --git a/core/compiler/test/identities.factor b/core/compiler/test/identities.factor
deleted file mode 100644 (file)
index b296f7b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-IN: temporary
-USING: compiler kernel kernel-internals math test vectors ;
-
-[ 5 ] [ 5 [ 0 + ] compile-1 ] unit-test
-[ 5 ] [ 5 [ 0 swap + ] compile-1 ] unit-test
-
-[ 5 ] [ 5 [ 0 - ] compile-1 ] unit-test
-[ -5 ] [ 5 [ 0 swap - ] compile-1 ] unit-test
-[ 0 ] [ 5 [ dup - ] compile-1 ] unit-test
-
-[ 5 ] [ 5 [ 1 * ] compile-1 ] unit-test
-[ 5 ] [ 5 [ 1 swap * ] compile-1 ] unit-test
-[ 0 ] [ 5 [ 0 * ] compile-1 ] unit-test
-[ 0 ] [ 5 [ 0 swap * ] compile-1 ] unit-test
-[ -5 ] [ 5 [ -1 * ] compile-1 ] unit-test
-[ -5 ] [ 5 [ -1 swap * ] compile-1 ] unit-test
-
-[ 5 ] [ 5 [ 1 / ] compile-1 ] unit-test
-[ 1/5 ] [ 5 [ 1 swap / ] compile-1 ] unit-test
-[ -5 ] [ 5 [ -1 / ] compile-1 ] unit-test
-
-[ 0 ] [ 5 [ 1 mod ] compile-1 ] unit-test
-[ 0 ] [ 5 [ 1 rem ] compile-1 ] unit-test
-
-[ 5 ] [ 5 [ -1 bitand ] compile-1 ] unit-test
-[ 0 ] [ 5 [ 0 bitand ] compile-1 ] unit-test
-[ 5 ] [ 5 [ -1 swap bitand ] compile-1 ] unit-test
-[ 0 ] [ 5 [ 0 swap bitand ] compile-1 ] unit-test
-[ 5 ] [ 5 [ dup bitand ] compile-1 ] unit-test
-
-[ 5 ] [ 5 [ 0 bitor ] compile-1 ] unit-test
-[ -1 ] [ 5 [ -1 bitor ] compile-1 ] unit-test
-[ 5 ] [ 5 [ 0 swap bitor ] compile-1 ] unit-test
-[ -1 ] [ 5 [ -1 swap bitor ] compile-1 ] unit-test
-[ 5 ] [ 5 [ dup bitor ] compile-1 ] unit-test
-
-[ 5 ] [ 5 [ 0 bitxor ] compile-1 ] unit-test
-[ 5 ] [ 5 [ 0 swap bitxor ] compile-1 ] unit-test
-[ -6 ] [ 5 [ -1 bitxor ] compile-1 ] unit-test
-[ -6 ] [ 5 [ -1 swap bitxor ] compile-1 ] unit-test
-[ 0 ] [ 5 [ dup bitxor ] compile-1 ] unit-test
-
-[ 0 ] [ 5 [ 0 swap shift ] compile-1 ] unit-test
-[ 5 ] [ 5 [ 0 shift ] compile-1 ] unit-test
-
-[ f ] [ 5 [ dup < ] compile-1 ] unit-test
-[ t ] [ 5 [ dup <= ] compile-1 ] unit-test
-[ f ] [ 5 [ dup > ] compile-1 ] unit-test
-[ t ] [ 5 [ dup >= ] compile-1 ] unit-test
-
-[ t ] [ 5 [ dup eq? ] compile-1 ] unit-test
-[ t ] [ 5 [ dup = ] compile-1 ] unit-test
-[ t ] [ 5 [ dup number= ] compile-1 ] unit-test
-[ t ] [ \ vector [ \ vector = ] compile-1 ] unit-test
-
-[ 3 ] [ 10/3 [ { ratio } declare 1 /i ] compile-1 ] unit-test
index 91b31a3bab397f9c3fc9e3f4c335688099dcbeb3..c2ccc43cc58f2ec569293623c37b2a14a4232307 100644 (file)
@@ -1,11 +1,6 @@
 IN: temporary
-USING: alien strings ;
-USE: compiler
-USE: test
-USE: math
-USE: kernel
-USE: words
-USE: math-internals
+USING: alien strings compiler tools.test math kernel words
+math.private combinators ;
 
 : dummy-if-1 t [ ] [ ] if ;
 
@@ -31,7 +26,7 @@ USE: math-internals
     dup 1 fixnum<= [
         drop 1
     ] [
-        1 fixnum- dup swap 1 fixnum- fixnum+
+        1 fixnum- dup 1 fixnum- fixnum+
     ] if ;
 
 [ 17 ] [ 10 dummy-if-6 ] unit-test
diff --git a/core/compiler/test/inference.factor b/core/compiler/test/inference.factor
deleted file mode 100644 (file)
index 56ebbfd..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-USING: arrays errors generic inference kernel kernel-internals
-math math-internals namespaces parser sequences strings test
-vectors words ;
-IN: temporary
-
-: short-effect
-    dup effect-in length swap effect-out length 2array nip ;
-
-[ f ] [ f [ [ ] map-nodes ] with-node-iterator ] unit-test
-
-[ t ] [ [ ] dataflow dup [ [ ] map-nodes ] with-node-iterator = ] unit-test
-
-[ t ] [ [ 1 2 ] dataflow dup [ [ ] map-nodes ] with-node-iterator = ] unit-test
-
-[ t ] [ [ [ ] [ ] if ] dataflow dup [ [ ] map-nodes ] with-node-iterator = ] unit-test
-
-[ { 0 0 } ] [ f infer short-effect ] unit-test
-[ { 0 2 } ] [ [ 2 "Hello" ] infer short-effect ] unit-test
-[ { 1 2 } ] [ [ dup ] infer short-effect ] unit-test
-
-[ { 1 2 } ] [ [ [ dup ] call ] infer short-effect ] unit-test
-[ [ call ] infer short-effect ] unit-test-fails
-
-[ { 2 4 } ] [ [ 2dup ] infer short-effect ] unit-test
-
-[ { 1 0 } ] [ [ [ ] [ ] if ] infer short-effect ] unit-test
-[ [ if ] infer short-effect ] unit-test-fails
-[ [ [ ] if ] infer short-effect ] unit-test-fails
-[ [ [ 2 ] [ ] if ] infer short-effect ] unit-test-fails
-[ { 4 3 } ] [ [ [ rot ] [ -rot ] if ] infer short-effect ] unit-test
-
-[ { 4 3 } ] [
-    [
-        [
-            [ swap 3 ] [ nip 5 5 ] if
-        ] [
-            -rot
-        ] if
-    ] infer short-effect
-] unit-test
-
-[ { 1 1 } ] [ [ dup [ ] when ] infer short-effect ] unit-test
-[ { 1 1 } ] [ [ dup [ dup fixnum* ] when ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ [ dup fixnum* ] when ] infer short-effect ] unit-test
-
-[ { 1 0 } ] [ [ [ drop ] when* ] infer short-effect ] unit-test
-[ { 1 1 } ] [ [ [ { { [ ] } } ] unless* ] infer short-effect ] unit-test
-
-[ { 0 1 } ] [
-    [ [ 2 2 fixnum+ ] dup [ ] when call ] infer short-effect
-] unit-test
-
-[
-    [ [ 2 2 fixnum+ ] ] [ [ 2 2 fixnum* ] ] if call
-] unit-test-fails
-
-! Test inference of termination of control flow
-: termination-test-1
-    "foo" throw ;
-
-: termination-test-2 [ termination-test-1 ] [ 3 ] if ;
-
-[ { 1 1 } ] [ [ termination-test-2 ] infer short-effect ] unit-test
-
-: infinite-loop infinite-loop ;
-
-[ [ infinite-loop ] infer short-effect ] unit-test-fails
-
-: no-base-case-1 dup [ no-base-case-1 ] [ no-base-case-1 ] if ;
-[ [ no-base-case-1 ] infer short-effect ] unit-test-fails
-
-: simple-recursion-1 ( obj -- obj )
-    dup [ simple-recursion-1 ] [ ] if ;
-
-[ { 1 1 } ] [ [ simple-recursion-1 ] infer short-effect ] unit-test
-
-: simple-recursion-2 ( obj -- obj )
-    dup [ ] [ simple-recursion-2 ] if ;
-
-[ { 1 1 } ] [ [ simple-recursion-2 ] infer short-effect ] unit-test
-
-: bad-recursion-2 ( obj -- obj )
-    dup [ dup first swap second bad-recursion-2 ] [ ] if ;
-
-[ [ bad-recursion-2 ] infer short-effect ] unit-test-fails
-
-: funny-recursion ( obj -- obj )
-    dup [ funny-recursion 1 ] [ 2 ] if drop ;
-
-[ { 1 1 } ] [ [ funny-recursion ] infer short-effect ] unit-test
-
-! Simple combinators
-[ { 1 2 } ] [ [ [ first ] keep second ] infer short-effect ] unit-test
-
-! Mutual recursion
-DEFER: foe
-
-: fie ( element obj -- ? )
-    dup array? [ foe ] [ eq? ] if ;
-
-: foe ( element tree -- ? )
-    dup [
-        2dup first fie [
-            nip
-        ] [
-            second dup array? [
-                foe
-            ] [
-                fie
-            ] if
-        ] if
-    ] [
-        2drop f
-    ] if ;
-
-[ { 2 1 } ] [ [ fie ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ foe ] infer short-effect ] unit-test
-
-: nested-when ( -- )
-    t [
-        t [
-            5 drop
-        ] when
-    ] when ;
-
-[ { 0 0 } ] [ [ nested-when ] infer short-effect ] unit-test
-
-: nested-when* ( obj -- )
-    [
-        [
-            drop
-        ] when*
-    ] when* ;
-
-[ { 1 0 } ] [ [ nested-when* ] infer short-effect ] unit-test
-
-SYMBOL: sym-test
-
-[ { 0 1 } ] [ [ sym-test ] infer short-effect ] unit-test
-
-: terminator-branch
-    dup [
-        length
-    ] [
-        "foo" throw
-    ] if ;
-
-[ { 1 1 } ] [ [ terminator-branch ] infer short-effect ] unit-test
-
-: recursive-terminator ( obj -- )
-    dup [
-        recursive-terminator
-    ] [
-        "Hi" throw
-    ] if ;
-
-[ { 1 0 } ] [ [ recursive-terminator ] infer short-effect ] unit-test
-
-GENERIC: potential-hang ( obj -- obj )
-M: fixnum potential-hang dup [ potential-hang ] when ;
-
-[ ] [ [ 5 potential-hang ] infer short-effect drop ] unit-test
-
-TUPLE: funny-cons car cdr ;
-GENERIC: iterate ( obj -- )
-M: funny-cons iterate funny-cons-cdr iterate ;
-M: f iterate drop ;
-M: real iterate drop ;
-
-[ { 1 0 } ] [ [ iterate ] infer short-effect ] unit-test
-
-! Regression
-: cat ( obj -- * ) dup [ throw ] [ throw ] if ;
-: dog ( a b c -- ) dup [ cat ] [ 3drop ] if ;
-[ { 3 0 } ] [ [ dog ] infer short-effect ] unit-test
-
-! Regression
-DEFER: monkey
-: friend ( a b c -- ) dup [ friend ] [ monkey ] if ;
-: monkey ( a b c -- ) dup [ 3drop ] [ friend ] if ;
-[ { 3 0 } ] [ [ friend ] infer short-effect ] unit-test
-
-! Regression -- same as above but we infer short-effect the second word first
-DEFER: blah2
-: blah ( a b c -- ) dup [ blah ] [ blah2 ] if ;
-: blah2 ( a b c -- ) dup [ blah ] [ 3drop ] if ;
-[ { 3 0 } ] [ [ blah2 ] infer short-effect ] unit-test
-
-! Regression
-DEFER: blah4
-: blah3 ( a b c -- )
-    dup [ blah3 ] [ dup [ blah4 ] [ blah3 ] if ] if ;
-: blah4 ( a b c -- )
-    dup [ blah4 ] [ dup [ 3drop ] [ blah3 ] if ] if ;
-[ { 3 0 } ] [ [ blah4 ] infer short-effect ] unit-test
-
-! Regression
-: bad-combinator ( obj quot -- )
-    over [
-        2drop
-    ] [
-        [ swap slip ] keep swap bad-combinator
-    ] if ; inline
-
-[ [ [ 1 ] [ ] bad-combinator ] infer short-effect ] unit-test-fails
-
-! Regression
-: bad-input#
-    dup string? [ 2array throw ] unless
-    over string? [ 2array throw ] unless ;
-
-[ { 2 2 } ] [ [ bad-input# ] infer short-effect ] unit-test
-
-! Regression
-
-! This order of branches works
-DEFER: do-crap
-: more-crap ( obj -- ) dup [ drop ] [ dup do-crap call ] if ;
-: do-crap ( obj -- ) dup [ more-crap ] [ do-crap ] if ;
-[ [ do-crap ] infer short-effect ] unit-test-fails
-
-! This one does not
-DEFER: do-crap*
-: more-crap* ( obj -- ) dup [ drop ] [ dup do-crap* call ] if ;
-: do-crap* ( obj -- ) dup [ do-crap* ] [ more-crap* ] if ;
-[ [ do-crap* ] infer short-effect ] unit-test-fails
-
-! Regression
-: too-deep ( a b -- c )
-    dup [ drop ] [ 2dup too-deep too-deep * ] if ; inline
-[ { 2 1 } ] [ [ too-deep ] infer short-effect ] unit-test
-
-! Error reporting is wrong
-G: xyz math-combination ;
-M: fixnum xyz 2array ;
-M: ratio xyz 
-    [ >fraction ] 2apply swapd >r 2array swap r> 2array swap ;
-
-[ t ] [ [ [ xyz ] infer short-effect ] catch inference-error? ] unit-test
-
-! Doug Coleman discovered this one while working on the
-! calendar library
-DEFER: A
-DEFER: B
-DEFER: C
-
-: A ( a -- )
-    dup {
-        [ drop ]
-        [ A ]
-        [ \ A no-method ]
-        [ dup C A ]
-    } dispatch ;
-
-: B ( b -- )
-    dup {
-        [ C ]
-        [ B ]
-        [ \ B no-method ]
-        [ dup B B ]
-    } dispatch ;
-
-: C ( c -- )
-    dup {
-        [ A ]
-        [ C ]
-        [ \ C no-method ]
-        [ dup B C ]
-    } dispatch ;
-
-[ { 1 0 } ] [ [ A ] infer short-effect ] unit-test
-[ { 1 0 } ] [ [ B ] infer short-effect ] unit-test
-[ { 1 0 } ] [ [ C ] infer short-effect ] unit-test
-
-! I found this bug by thinking hard about the previous one
-DEFER: Y
-: X ( a b -- c d ) dup [ swap Y ] [ ] if ;
-: Y ( a b -- c d ) X ;
-
-[ { 2 2 } ] [ [ X ] infer short-effect ] unit-test
-[ { 2 2 } ] [ [ Y ] infer short-effect ] unit-test
-
-! This one comes from UI code
-DEFER: #1
-: #2 ( a b -- ) dup [ call ] [ 2drop ] if ; inline
-: #3 ( a -- ) [ #1 ] #2 ;
-: #4 ( a -- ) dup [ drop ] [ dup #4 dup #3 call ] if ;
-: #1 ( a -- ) dup [ dup #4 dup #3 ] [ ] if drop ;
-
-[ \ #4 word-def infer short-effect ] unit-test-fails
-[ [ #1 ] infer short-effect ] unit-test-fails
-
-! Similar
-DEFER: bar
-: foo ( a b -- c d ) dup [ 2drop f f bar ] [ ] if ;
-: bar ( a b -- ) [ 2 2 + ] t foo drop call drop ;
-
-[ [ foo ] infer short-effect ] unit-test-fails
-
-[ 1234 infer short-effect ] unit-test-fails
-
-! This used to hang
-[ [ [ dup call ] dup call ] infer short-effect ] unit-test-fails
-
-! This form should not have a stack effect
-
-: bad-recursion-1 ( a -- b )
-    dup [ drop bad-recursion-1 5 ] [ ] if ;
-
-[ [ bad-recursion-1 ] infer short-effect ] unit-test-fails
-
-: bad-bin ( a b -- ) 5 [ 5 bad-bin bad-bin 5 ] [ 2drop ] if ;
-[ [ bad-bin ] infer short-effect ] unit-test-fails
-
-[ t ] [ [ [ r> ] infer short-effect ] catch inference-error? ] unit-test
-
-! Test some random library words
-
-[ { 1 1 } ] [ [ unit ] infer short-effect ] unit-test
-
-! Unbalanced >n/n> is an error now!
-! [ { 1 0 } ] [ [ >n ] infer short-effect ] unit-test
-! [ { 0 1 } ] [ [ n> ] infer short-effect ] unit-test
-
-[ { 2 1 } ] [ [ bitor ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ bitand ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ bitxor ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ mod ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ /i ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ /f ] infer short-effect ] unit-test
-[ { 2 2 } ] [ [ /mod ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ + ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ - ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ * ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ / ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ < ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ <= ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ > ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ >= ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ number= ] infer short-effect ] unit-test
-
-[ { 1 1 } ] [ [ string>number ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ = ] infer short-effect ] unit-test
-[ { 1 1 } ] [ [ get ] infer short-effect ] unit-test
-
-[ { 2 0 } ] [ [ push ] infer short-effect ] unit-test
-[ { 2 0 } ] [ [ set-length ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ append ] infer short-effect ] unit-test
-[ { 1 1 } ] [ [ peek ] infer short-effect ] unit-test
-
-[ { 1 1 } ] [ [ length ] infer short-effect ] unit-test
-[ { 1 1 } ] [ [ reverse ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ member? ] infer short-effect ] unit-test
-[ { 2 1 } ] [ [ remove ] infer short-effect ] unit-test
-[ { 1 1 } ] [ [ natural-sort ] infer short-effect ] unit-test
-
-! Test scope inference
-SYMBOL: x
-
-[ [ n> ] infer ] unit-test-fails
-[ [ ndrop ] infer ] unit-test-fails
-[ V{ x } ] [ [ x get ] infer drop inferred-vars-reads ] unit-test
-[ V{ x } ] [ [ x set ] infer drop inferred-vars-writes ] unit-test
-[ V{ x } ] [ [ [ x get ] with-scope ] infer drop inferred-vars-reads ] unit-test
-[ V{ } ] [ [ [ x set ] with-scope ] infer drop inferred-vars-writes ] unit-test
-[ V{ x } ] [ [ [ x get ] bind ] infer drop inferred-vars-reads ] unit-test
-[ V{ } ] [ [ [ x set ] bind ] infer drop inferred-vars-writes ] unit-test
-[ V{ x } ] [ [ [ x get ] make-hash ] infer drop inferred-vars-reads ] unit-test
-[ V{ } ] [ [ [ x set ] make-hash ] infer drop inferred-vars-writes ] unit-test
-[ V{ building } ] [ [ , ] infer drop inferred-vars-reads ] unit-test
-[ V{ } ] [ [ [ 3 , ] { } make ] infer drop inferred-vars-reads ] unit-test
-[ V{ x } ] [ [ [ x get ] [ 5 ] if ] infer drop inferred-vars-reads ] unit-test
-[ V{ x } ] [ [ >n [ x get ] [ 5 ] if n> ] infer drop inferred-vars-reads ] unit-test
-[ V{ } ] [ [ >n [ x set ] [ drop ] if x get n> ] infer drop inferred-vars-reads ] unit-test
-[ V{ x } ] [ [ >n x get ndrop ] infer drop inferred-vars-reads ] unit-test
-[ V{ } ] [ [ >n x set ndrop ] infer drop inferred-vars-writes ] unit-test
-
-[ [ >n ] [ ] if ] unit-test-fails
-
-[ V{ 2 3 } ] [ [ [ [ 2 get 3 throw ] [ 3 get ] if ] with-scope ] infer drop inferred-vars-reads ] unit-test
-
-[ V{ } ] [ [ 5 set 5 get ] infer drop inferred-vars-reads ] unit-test
-
-[ [ 3.1 execute ] infer ] unit-test-fails
index f6ee053e09a89cc32dd905a2fa5b6087e36f4c00..23e94a79740b9b369505ba47e4278562880c8330 100644 (file)
@@ -1,8 +1,30 @@
 IN: temporary
-USING: arrays compiler kernel kernel-internals math
-math-internals sequences strings test words errors ;
+USING: arrays compiler kernel kernel.private math
+math.private sequences strings tools.test words continuations
+sequences.private hashtables.private byte-arrays
+strings.private system random math.vectors layouts
+vectors.private sbufs.private strings.private slots.private
+alien alien.c-types alien.syntax namespaces libc math.constants
+math.functions ;
 
 ! Make sure that intrinsic ops compile to correct code.
+[ ] [ 1 [ drop ] compile-1 ] unit-test
+[ ] [ 1 2 [ 2drop ] compile-1 ] unit-test
+[ ] [ 1 2 3 [ 3drop ] compile-1 ] unit-test
+[ 1 1 ] [ 1 [ dup ] compile-1 ] unit-test
+[ 1 2 1 2 ] [ 1 2 [ 2dup ] compile-1 ] unit-test
+[ 1 2 3 1 2 3 ] [ 1 2 3 [ 3dup ] compile-1 ] unit-test
+[ 2 3 1 ] [ 1 2 3 [ rot ] compile-1 ] unit-test
+[ 3 1 2 ] [ 1 2 3 [ -rot ] compile-1 ] unit-test
+[ 1 1 2 ] [ 1 2 [ dupd ] compile-1 ] unit-test
+[ 2 1 3 ] [ 1 2 3 [ swapd ] compile-1 ] unit-test
+[ 2 ] [ 1 2 [ nip ] compile-1 ] unit-test
+[ 3 ] [ 1 2 3 [ 2nip ] compile-1 ] unit-test
+[ 2 1 2 ] [ 1 2 [ tuck ] compile-1 ] unit-test
+[ 1 2 1 ] [ 1 2 [ over ] compile-1 ] unit-test
+[ 1 2 3 1 ] [ 1 2 3 [ pick ] compile-1 ] unit-test
+[ 2 1 ] [ 1 2 [ swap ] compile-1 ] unit-test
+
 [ 1 ] [ { 1 2 } [ 2 slot ] compile-1 ] unit-test
 [ 1 ] [ [ { 1 2 } 2 slot ] compile-1 ] unit-test
 [ 3 ] [ 3 1 2 2array [ [ 2 set-slot ] keep ] compile-1 first ] unit-test
@@ -19,9 +41,9 @@ math-internals sequences strings test words errors ;
 [ CHAR: b ] [ 1 [ "abc" char-slot ] compile-1 ] unit-test
 [ CHAR: b ] [ [ 1 "abc" char-slot ] compile-1 ] unit-test
 
-[ "axc" ] [ CHAR: x 1 "abc" [ [ set-char-slot ] keep dup rehash-string ] compile-1 ] unit-test
-[ "axc" ] [ CHAR: x 1 [ "abc" [ set-char-slot ] keep dup rehash-string ] compile-1 ] unit-test
-[ "axc" ] [ CHAR: x [ 1 "abc" [ set-char-slot ] keep dup rehash-string ] compile-1 ] unit-test
+[ "axc" ] [ CHAR: x 1 "abc" [ [ set-char-slot ] keep { string } declare dup rehash-string ] compile-1 ] unit-test
+[ "axc" ] [ CHAR: x 1 [ "abc" [ set-char-slot ] keep { string } declare dup rehash-string ] compile-1 ] unit-test
+[ "axc" ] [ CHAR: x [ 1 "abc" [ set-char-slot ] keep { string } declare dup rehash-string ] compile-1 ] unit-test
 
 [ ] [ [ 0 getenv ] compile-1 drop ] unit-test
 [ ] [ 1 getenv [ 1 setenv ] compile-1 ] unit-test
@@ -132,6 +154,19 @@ math-internals sequences strings test words errors ;
 [ 4 ] [ 1 [ 3 fixnum+ ] compile-1 ] unit-test
 [ 4 ] [ [ 1 3 fixnum+ ] compile-1 ] unit-test
 
+[ 4 ] [ 1 3 [ fixnum+fast ] compile-1 ] unit-test
+[ 4 ] [ 1 [ 3 fixnum+fast ] compile-1 ] unit-test
+[ 4 ] [ [ 1 3 fixnum+fast ] compile-1 ] unit-test
+
+[ 30001 ] [ 1 [ 30000 fixnum+fast ] compile-1 ] unit-test
+
+[ 6 ] [ 2 3 [ fixnum*fast ] compile-1 ] unit-test
+[ 6 ] [ 2 [ 3 fixnum*fast ] compile-1 ] unit-test
+[ 6 ] [ [ 2 3 fixnum*fast ] compile-1 ] unit-test
+[ -6 ] [ 2 -3 [ fixnum*fast ] compile-1 ] unit-test
+[ -6 ] [ 2 [ -3 fixnum*fast ] compile-1 ] unit-test
+[ -6 ] [ [ 2 -3 fixnum*fast ] compile-1 ] unit-test
+
 [ 6 ] [ 2 3 [ fixnum* ] compile-1 ] unit-test
 [ 6 ] [ 2 [ 3 fixnum* ] compile-1 ] unit-test
 [ 6 ] [ [ 2 3 fixnum* ] compile-1 ] unit-test
@@ -218,6 +253,8 @@ cell 8 = [
     [ 1152921504606846976 ] [ -1152921504606846976 >fixnum -1 [ fixnum/i ] compile-1 ] unit-test
 
     [ 1152921504606846976 0 ] [ -1152921504606846976 >fixnum -1 [ fixnum/mod ] compile-1 ] unit-test
+
+    [ -268435457 ] [ 28 2^ [ fixnum-bitnot ] compile-1 ] unit-test
 ] when
 
 ! Some randomized tests
@@ -225,7 +262,7 @@ cell 8 = [
 \ compiled-fixnum* compile
 
 : test-fixnum*
-    (random-int) >fixnum (random-int) >fixnum
+    (random) >fixnum (random) >fixnum
     2dup
     [ fixnum* ] 2keep compiled-fixnum* =
     [ 2drop ] [ "Oops" throw ] if ;
@@ -236,7 +273,7 @@ cell 8 = [
 \ compiled-fixnum>bignum compile
 
 : test-fixnum>bignum
-    (random-int) >fixnum
+    (random) >fixnum
     dup [ fixnum>bignum ] keep compiled-fixnum>bignum =
     [ drop ] [ "Oops" throw ] if ;
 
@@ -246,8 +283,131 @@ cell 8 = [
 \ compiled-bignum>fixnum compile
 
 : test-bignum>fixnum
-    5 random-int [ drop (random-int) ] map product >bignum
+    5 random [ drop (random) ] map product >bignum
     dup [ bignum>fixnum ] keep compiled-bignum>fixnum =
     [ drop ] [ "Oops" throw ] if ;
 
 [ ] [ 10000 [ test-bignum>fixnum ] times ] unit-test
+
+! Test overflow check removal
+[ t ] [
+    most-positive-fixnum 100 - >fixnum
+    200
+    [ [ fixnum+ ] compile-1 [ bignum>fixnum ] compile-1 ] 2keep
+    [ fixnum+ >fixnum ] compile-1
+    =
+] unit-test
+
+[ t ] [
+    most-negative-fixnum 100 + >fixnum
+    -200
+    [ [ fixnum+ ] compile-1 [ bignum>fixnum ] compile-1 ] 2keep
+    [ fixnum+ >fixnum ] compile-1
+    =
+] unit-test
+
+[ t ] [
+    most-negative-fixnum 100 + >fixnum
+    200
+    [ [ fixnum- ] compile-1 [ bignum>fixnum ] compile-1 ] 2keep
+    [ fixnum- >fixnum ] compile-1
+    =
+] unit-test
+
+! Test inline allocators
+[ { 1 1 1 } ] [
+    [ 3 1 <array> ] compile-1
+] unit-test
+
+[ B{ 0 0 0 } ] [
+    [ 3 <byte-array> ] compile-1
+] unit-test
+
+[ 500 ] [
+    [ 500 <byte-array> length ] compile-1
+] unit-test
+
+[ C{ 1 2 } ] [ 1 2 [ <complex> ] compile-1 ] unit-test
+
+[ 1/2 ] [ 1 2 [ <ratio> ] compile-1 ] unit-test
+
+[ \ + ] [ \ + [ <wrapper> ] compile-1 ] unit-test
+
+[ H{ } ] [
+    100 [ (hashtable) ] compile-1 [ reset-hash ] keep
+] unit-test
+
+[ B{ 0 0 0 0 0 } ] [
+    [ 5 <byte-array> ] compile-1
+] unit-test
+
+[ V{ 1 2 } ] [
+    { 1 2 3 } 2 [ array>vector ] compile-1
+] unit-test
+
+[ SBUF" hello" ] [
+    "hello world" 5 [ string>sbuf ] compile-1
+] unit-test
+
+[ [ 3 + ] ] [
+    3 [ + ] [ curry ] compile-1
+] unit-test
+
+! Alien intrinsics
+[ 3 ] [ B{ 1 2 3 4 5 } 2 [ alien-unsigned-1 ] compile-1 ] unit-test
+[ 3 ] [ [ B{ 1 2 3 4 5 } 2 alien-unsigned-1 ] compile-1 ] unit-test
+[ 3 ] [ B{ 1 2 3 4 5 } 2 [ { byte-array fixnum } declare alien-unsigned-1 ] compile-1 ] unit-test
+[ 3 ] [ B{ 1 2 3 4 5 } 2 [ { simple-c-ptr fixnum } declare alien-unsigned-1 ] compile-1 ] unit-test
+
+[ ] [ B{ 1 2 3 4 5 } malloc-byte-array "b" set ] unit-test
+
+[ 3 ] [ "b" get 2 [ alien-unsigned-1 ] compile-1 ] unit-test
+[ 3 ] [ "b" get [ { simple-alien } declare 2 alien-unsigned-1 ] compile-1 ] unit-test
+[ 3 ] [ "b" get 2 [ { simple-alien fixnum } declare alien-unsigned-1 ] compile-1 ] unit-test
+[ 3 ] [ "b" get 2 [ { simple-c-ptr fixnum } declare alien-unsigned-1 ] compile-1 ] unit-test
+
+[ ] [ "b" get free ] unit-test
+
+[ ] [ "hello world" malloc-char-string "s" set ] unit-test
+
+[ "hello world" ] [ "s" get <void*> [ { byte-array } declare *void* ] compile-1 alien>char-string ] unit-test
+[ "hello world" ] [ "s" get <void*> [ { simple-c-ptr } declare *void* ] compile-1 alien>char-string ] unit-test
+
+[ ] [ "s" get free ] unit-test
+
+[ ALIEN: 1234 ] [ ALIEN: 1234 [ { simple-alien } declare <void*> ] compile-1 *void* ] unit-test
+[ ALIEN: 1234 ] [ ALIEN: 1234 [ { simple-c-ptr } declare <void*> ] compile-1 *void* ] unit-test
+[ f ] [ f [ { POSTPONE: f } declare <void*> ] compile-1 *void* ] unit-test
+
+[ 252 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-unsigned-1 ] compile-1 ] unit-test
+[ -4 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-signed-1 ] compile-1 ] unit-test
+
+: xword-def word-def [ { fixnum } declare ] swap append ;
+
+[ -100 ] [ -100 <char> [ { byte-array } declare *char ] compile-1 ] unit-test
+[ 156 ] [ -100 <uchar> [ { byte-array } declare *uchar ] compile-1 ] unit-test
+
+[ -100 ] [ -100 \ <char> xword-def compile-1 *char ] unit-test
+[ 156 ] [ -100 \ <uchar> xword-def compile-1 *uchar ] unit-test
+
+[ -1000 ] [ -1000 <short> [ { byte-array } declare *short ] compile-1 ] unit-test
+[ 64536 ] [ -1000 <ushort> [ { byte-array } declare *ushort ] compile-1 ] unit-test
+
+[ -1000 ] [ -1000 \ <short> xword-def compile-1 *short ] unit-test
+[ 64536 ] [ -1000 \ <ushort> xword-def compile-1 *ushort ] unit-test
+
+[ -100000 ] [ -100000 <int> [ { byte-array } declare *int ] compile-1 ] unit-test
+[ 4294867296 ] [ -100000 <uint> [ { byte-array } declare *uint ] compile-1 ] unit-test
+
+[ -100000 ] [ -100000 \ <int> xword-def compile-1 *int ] unit-test
+[ 4294867296 ] [ -100000 \ <uint> xword-def compile-1 *uint ] unit-test
+
+[ t ] [ pi pi <double> *double = ] unit-test
+
+[ t ] [ pi <double> [ { byte-array } declare *double ] compile-1 pi = ] unit-test
+
+! Silly
+[ t ] [ pi 4 <byte-array> [ [ { float byte-array } declare 0 set-alien-float ] compile-1 ] keep *float pi - abs 0.001 < ] unit-test
+[ t ] [ pi <float> [ { byte-array } declare *float ] compile-1 pi - abs 0.001 < ] unit-test
+
+[ t ] [ pi 8 <byte-array> [ [ { float byte-array } declare 0 set-alien-double ] compile-1 ] keep *double pi = ] unit-test
index 7633e8510cf098cc4dbb15c5b0b982dd7e3e65db..496c6f24ec6c75d5d5c4fa3c23903281503aa530 100644 (file)
-USING: arrays assembler compiler generic
-hashtables inference kernel kernel-internals math
-optimizer prettyprint sequences strings test vectors words
-sequences-internals ;
+USING: arrays compiler generic hashtables inference kernel
+kernel.private math optimizer prettyprint sequences sbufs
+strings tools.test vectors words sequences.private quotations
+optimizer.backend classes inference.dataflow tuples.private ;
 IN: temporary
 
-: kill-1
-    [ 1 2 3 ] [ + ] over drop drop ;
-
-[ [ 1 2 3 ] ] [ kill-1 ] unit-test
-
-: kill-2
-    [ + ] [ 1 2 3 ] over drop nip ;
-
-[ [ 1 2 3 ] ] [ kill-2 ] unit-test
-
-: kill-3
-    [ + ] dup over 3drop ;
-
-[ ] [ kill-3 ] unit-test
-
-: kill-4
-    [ 1 2 3 ] [ + ] [ - ] pick >r 2drop r> ;
-
-[ [ 1 2 3 ] [ 1 2 3 ] ] [ kill-4 ] unit-test
-
-: kill-5
-    [ + ] [ - ] [ 1 2 3 ] pick pick 2drop >r 2drop r> ;
-
-[ [ 1 2 3 ] ] [ kill-5 ] unit-test
-
-: kill-6
-    [ 1 2 3 ] [ 4 5 6 ] [ + ] pick >r drop r> ;
-
-[ [ 1 2 3 ] [ 4 5 6 ] [ 1 2 3 ] ] [ kill-6 ] unit-test
-
-: subset? swap [ swap member? ] all-with? ;
-
-: set= 2dup subset? >r swap subset? r> and ;
-
-USE: optimizer
-
-: kill-set dup live-values swap literals hash-diff ;
-
-: kill-set=
-    dataflow kill-set hash-keys [ value-literal ] map set= ;
-
-: foo 1 2 3 ;
-
-[ H{ } ] [ \ foo word-def dataflow kill-set ] unit-test
-
-[ t ] [ [ [ 1 ] [ 2 ] ] [ [ 1 ] [ 2 ] if ] kill-set= ] unit-test
-
-[ t ] [ [ [ 1 ] [ 2 ] ] [ [ 1 ] [ 2 ] if ] kill-set= ] unit-test
-
-
-: literal-kill-test-1 4 cell 2 cells - ;
-
-[ 4 ] [ literal-kill-test-1 drop ] unit-test
-
-: literal-kill-test-2 3 cell 2 cells - ;
-
-[ 3 ] [ literal-kill-test-2 drop ] unit-test
-
-: literal-kill-test-3 10 3 /mod drop ;
-
-[ 3 ] [ literal-kill-test-3 ] unit-test
-
-: literal-kill-test-4
-    5 swap [ 3 ] [ dup ] if 2drop ;
-
-[ ] [ t literal-kill-test-4 ] unit-test
-[ ] [ f literal-kill-test-4 ] unit-test
-
-: literal-kill-test-5
-    5 swap [ 5 ] [ dup ] if 2drop ;
-
-[ ] [ t literal-kill-test-5 ] unit-test
-[ ] [ f literal-kill-test-5 ] unit-test
-
-: literal-kill-test-6
-    5 swap [ dup ] [ dup ] if 2drop ;
-
-[ ] [ t literal-kill-test-6 ] unit-test
-[ ] [ f literal-kill-test-6 ] unit-test
-
-[ t ] [ [
-    5 [ dup ] [ dup ] ] \ literal-kill-test-6 word-def kill-set=
+[ H{ { 1 5 } { 3 4 } { 2 5 } } ] [
+    H{ { 1 2 } { 3 4 } } H{ { 2 5 } } union*
 ] unit-test
 
-: literal-kill-test-7
-    [ 1 2 3 ] >r + r> drop ;
-
-[ 4 ] [ 2 2 literal-kill-test-7 ] unit-test
-
-: literal-kill-test-8 ( a b -- )
-    dup [ >r dup slip r> literal-kill-test-8 ] [ 2drop ] if ; inline
-
-[ t ] [
-    [ [ ] swap literal-kill-test-8 ] dataflow
-    live-values hash-values [ value? ] subset empty?
+[ H{ { 1 4 } { 2 4 } { 3 4 } } ] [
+    H{ { 1 2 } { 3 4 } } H{ { 2 3 } } union*
 ] unit-test
 
 ! Test method inlining
@@ -108,31 +19,31 @@ USE: optimizer
     \ string
     [ integer string array reversed sbuf
     slice vector quotation ]
-    [ class-compare ] sort min-class
-] unit-test
-
-[ f ] [
-    \ fixnum
-    [ fixnum integer letter ]
-    [ class-compare ] sort min-class
+    sort-classes min-class
 ] unit-test
 
 [ fixnum ] [
     \ fixnum
     [ fixnum integer object ]
-    [ class-compare ] sort min-class
+    sort-classes min-class
 ] unit-test
 
 [ integer ] [
     \ fixnum
     [ integer float object ]
-    [ class-compare ] sort min-class
+    sort-classes min-class
 ] unit-test
 
 [ object ] [
     \ word
     [ integer float object ]
-    [ class-compare ] sort min-class
+    sort-classes min-class
+] unit-test
+
+[ reversed ] [
+    \ reversed
+    [ integer reversed slice ]
+    sort-classes min-class
 ] unit-test
 
 FORGET: xyz
@@ -171,12 +82,12 @@ TUPLE: pred-test ;
 
 [ T{ pred-test } "pred-test" ] [ T{ pred-test } pred-test-3 ] unit-test
 
-: inline-test
-    "nom" = ;
-! 
-[ t ] [ "nom" inline-test ] unit-test
-[ f ] [ "shayin" inline-test ] unit-test
-[ f ] [ 3 inline-test ] unit-test
+: inline-test
+    "nom" = ;
+
+[ t ] [ "nom" inline-test ] unit-test
+[ f ] [ "shayin" inline-test ] unit-test
+[ f ] [ 3 inline-test ] unit-test
 
 : fixnum-declarations >fixnum 24 shift 1234 bitxor ;
 
@@ -196,8 +107,8 @@ TUPLE: pred-test ;
 [ 3 ] [ t bad-kill-2 ] unit-test
 
 ! regression
-: (the-test) dup 0 > [ 1- (the-test) ] when ; inline
-: the-test 2 dup (the-test) ;
+: (the-test) ( n -- ) dup 0 > [ 1- (the-test) ] when ; inline
+: the-test ( -- n ) 2 dup (the-test) ;
 
 [ 2 0 ] [ the-test ] unit-test
 
@@ -213,9 +124,10 @@ TUPLE: pred-test ;
 [ ] [ double-recursion ] unit-test
 
 ! regression
-: double-label-1
+: double-label-1 ( a b c -- d )
     [ f double-label-1 ] [ swap nth-unsafe ] if ; inline
-: double-label-2
+
+: double-label-2 ( a -- b )
     dup array? [ ] [ ] if 0 t double-label-1 ;
 
 [ 0 ] [ 10 double-label-2 ] unit-test
@@ -227,16 +139,16 @@ GENERIC: void-generic ( obj -- * )
 [ breakage ] unit-test-fails
 
 ! regression
-: test-0 dup 0 = [ drop ] [ 1- test-0 ] if ; inline
-: test-1 t [ test-0 ] [ delegate dup [ test-1 ] [ drop ] if ] if ; inline
-: test-2 5 test-1 ;
+: test-0 ( n -- ) dup 0 = [ drop ] [ 1- test-0 ] if ; inline
+: test-1 ( n -- ) t [ test-0 ] [ delegate dup [ test-1 ] [ drop ] if ] if ; inline
+: test-2 ( -- ) 5 test-1 ;
 
 [ f ] [ f test-2 ] unit-test
 
-: branch-fold-regression-0
+: branch-fold-regression-0 ( n -- )
     t [ ] [ 1+ branch-fold-regression-0 ] if ; inline
 
-: branch-fold-regression-1
+: branch-fold-regression-1 ( -- )
     10 branch-fold-regression-0 ;
 
 [ 10 ] [ branch-fold-regression-1 ] unit-test
@@ -250,3 +162,114 @@ GENERIC: void-generic ( obj -- * )
 : foo f ;
 : bar foo 4 4 = and ;
 [ f ] [ bar ] unit-test
+
+! ensure identities are working in some form
+[ t ] [
+    [ { number } declare 0 + ] dataflow optimize
+    [ #push? ] node-exists? not
+] unit-test
+
+! compiling <tuple> with a non-literal class failed
+[ t ] [ [ <tuple> ] compile-quot word? ] unit-test
+
+GENERIC: foozul
+M: reversed foozul ;
+M: integer foozul ;
+M: slice foozul ;
+
+[ reversed ] [ reversed \ foozul specific-method ] unit-test
+
+! regression
+: constant-fold-2 f ; foldable
+: constant-fold-3 4 ; foldable
+
+[ f t ] [
+    [ constant-fold-2 constant-fold-3 4 = ] compile-1
+] unit-test
+
+: constant-fold-4 f ; foldable
+: constant-fold-5 f ; foldable
+
+[ f ] [
+    [ constant-fold-4 constant-fold-5 or ] compile-1
+] unit-test
+
+[ 5 ] [ 5 [ 0 + ] compile-1 ] unit-test
+[ 5 ] [ 5 [ 0 swap + ] compile-1 ] unit-test
+
+[ 5 ] [ 5 [ 0 - ] compile-1 ] unit-test
+[ -5 ] [ 5 [ 0 swap - ] compile-1 ] unit-test
+[ 0 ] [ 5 [ dup - ] compile-1 ] unit-test
+
+[ 5 ] [ 5 [ 1 * ] compile-1 ] unit-test
+[ 5 ] [ 5 [ 1 swap * ] compile-1 ] unit-test
+[ 0 ] [ 5 [ 0 * ] compile-1 ] unit-test
+[ 0 ] [ 5 [ 0 swap * ] compile-1 ] unit-test
+[ -5 ] [ 5 [ -1 * ] compile-1 ] unit-test
+[ -5 ] [ 5 [ -1 swap * ] compile-1 ] unit-test
+
+[ 5 ] [ 5 [ 1 / ] compile-1 ] unit-test
+[ 1/5 ] [ 5 [ 1 swap / ] compile-1 ] unit-test
+[ -5 ] [ 5 [ -1 / ] compile-1 ] unit-test
+
+[ 0 ] [ 5 [ 1 mod ] compile-1 ] unit-test
+[ 0 ] [ 5 [ 1 rem ] compile-1 ] unit-test
+
+[ 5 ] [ 5 [ -1 bitand ] compile-1 ] unit-test
+[ 0 ] [ 5 [ 0 bitand ] compile-1 ] unit-test
+[ 5 ] [ 5 [ -1 swap bitand ] compile-1 ] unit-test
+[ 0 ] [ 5 [ 0 swap bitand ] compile-1 ] unit-test
+[ 5 ] [ 5 [ dup bitand ] compile-1 ] unit-test
+
+[ 5 ] [ 5 [ 0 bitor ] compile-1 ] unit-test
+[ -1 ] [ 5 [ -1 bitor ] compile-1 ] unit-test
+[ 5 ] [ 5 [ 0 swap bitor ] compile-1 ] unit-test
+[ -1 ] [ 5 [ -1 swap bitor ] compile-1 ] unit-test
+[ 5 ] [ 5 [ dup bitor ] compile-1 ] unit-test
+
+[ 5 ] [ 5 [ 0 bitxor ] compile-1 ] unit-test
+[ 5 ] [ 5 [ 0 swap bitxor ] compile-1 ] unit-test
+[ -6 ] [ 5 [ -1 bitxor ] compile-1 ] unit-test
+[ -6 ] [ 5 [ -1 swap bitxor ] compile-1 ] unit-test
+[ 0 ] [ 5 [ dup bitxor ] compile-1 ] unit-test
+
+[ 0 ] [ 5 [ 0 swap shift ] compile-1 ] unit-test
+[ 5 ] [ 5 [ 0 shift ] compile-1 ] unit-test
+
+[ f ] [ 5 [ dup < ] compile-1 ] unit-test
+[ t ] [ 5 [ dup <= ] compile-1 ] unit-test
+[ f ] [ 5 [ dup > ] compile-1 ] unit-test
+[ t ] [ 5 [ dup >= ] compile-1 ] unit-test
+
+[ t ] [ 5 [ dup eq? ] compile-1 ] unit-test
+[ t ] [ 5 [ dup = ] compile-1 ] unit-test
+[ t ] [ 5 [ dup number= ] compile-1 ] unit-test
+[ t ] [ \ vector [ \ vector = ] compile-1 ] unit-test
+
+[ 3 ] [ 10/3 [ { ratio } declare 1 /i ] compile-1 ] unit-test
+
+GENERIC: detect-number ( obj -- obj )
+M: number detect-number ;
+
+[ 10 f [ <array> 0 + detect-number ] compile-1 ] unit-test-fails
+
+! Regression
+[ 4 [ + ] ] [ 2 2 [ [ + ] [ call ] keep ] compile-1 ] unit-test
+
+! Regression
+USE: sorting
+USE: sorting.private
+
+: old-binsearch ( elt quot seq -- elt quot i )
+    dup length 1 <= [
+        slice-from
+    ] [
+        [ midpoint swap call ] 3keep roll dup zero?
+        [ drop dup slice-from swap midpoint@ + ]
+        [ partition old-binsearch ] if
+    ] if ; inline
+
+[ 10 ] [
+    10 20 >vector <flat-slice>
+    [ [ - ] swap old-binsearch ] compile-1 2nip
+] unit-test
diff --git a/core/compiler/test/redefine.factor b/core/compiler/test/redefine.factor
new file mode 100644 (file)
index 0000000..df2f3c3
--- /dev/null
@@ -0,0 +1,45 @@
+USING: compiler definitions generic assocs inference math
+namespaces parser tools.test words kernel sequences arrays io
+effects ;
+IN: temporary
+
+parse-hook get [
+    DEFER: foo \ foo reset-generic
+    DEFER: bar \ bar reset-generic
+
+    : short-effect
+        dup effect-in length swap effect-out length 2array ;
+
+    [   ] [ \ foo [ 1 2 ] define-compound     ] unit-test
+    [ { 0 2 } ] [ [ foo ] infer short-effect ] unit-test
+    [   ] [ \ foo compile                     ] unit-test
+    [   ] [ \ bar [ foo foo ] define-compound ] unit-test
+    [   ] [ \ bar compile                     ] unit-test
+    [   ] [ \ foo [ 1 2 3 ] define-compound   ] unit-test
+    [ t ] [ \ bar changed-words get key?  ] unit-test
+    [   ] [ recompile ] unit-test
+    [ { 0 3 } ] [ [ foo ] infer short-effect ] unit-test
+    [ f ] [ \ bar changed-words get key?  ] unit-test
+    [   ] [ \ bar [ 1 2 ] define-compound     ] unit-test
+    [ t ] [ \ bar changed-words get key?  ] unit-test
+    [   ] [ recompile ] unit-test
+    [ { 0 2 } ] [ [ bar ] infer short-effect ] unit-test
+    [ f ] [ \ bar changed-words get key?  ] unit-test
+    [   ] [ \ foo [ 1 2 3 ] define-compound   ] unit-test
+    [ f ] [ \ bar changed-words get key?  ] unit-test
+    [   ] [ \ bar [ 1 2 3 ] define-compound   ] unit-test
+    [ t ] [ \ bar changed-words get key?  ] unit-test
+    [   ] [ \ bar forget ] unit-test
+    [ f ] [ \ bar changed-words get key?  ] unit-test
+
+    : xy ;
+    : yx xy ;
+
+    \ yx compile
+    
+    \ xy [ 1 ] define-compound
+
+    [ ] [ recompile ] unit-test
+
+    [ 1 ] [ yx ] unit-test
+] when
index 47a60cd5c4ab9580ed080f4ae7013dc0bfa66a69..594bb844a12a7d013af538298d6c7587595fcbd0 100644 (file)
@@ -1,57 +1,58 @@
-USE: compiler
-USE: test
-USE: math
-USE: kernel
-USE: words
-USE: kernel
-USE: math-internals
-USE: memory
+USING: compiler tools.test kernel kernel.private
+combinators.private ;
 IN: temporary
 
-: no-op ;
-
-[ ] [ no-op ] unit-test
-
-: literals 3 5 ;
-
-: tail-call fixnum+ ;
+! Test empty word
+[ ] [ [ ] compile-1 ] unit-test
 
-[ 4 ] [ 1 3 tail-call ] unit-test
+! Test literals
+[ 1 ] [ [ 1 ] compile-1 ] unit-test
+[ 31 ] [ [ 31 ] compile-1 ] unit-test
+[ 255 ] [ [ 255 ] compile-1 ] unit-test
+[ -1 ] [ [ -1 ] compile-1 ] unit-test
+[ 65536 ] [ [ 65536 ] compile-1 ] unit-test
+[ -65536 ] [ [ -65536 ] compile-1 ] unit-test
+[ "hey" ] [ [ "hey" ] compile-1 ] unit-test
 
-[ 3 5 ] [ literals ] unit-test
-
-: literals&tail-call 3 5 fixnum+ ;
-
-[ 8 ] [ literals&tail-call ] unit-test
+! Calls
+: no-op ;
 
-: two-calls dup fixnum* ;
+[ ] [ [ no-op ] compile-1 ] unit-test
+[ 3 ] [ [ no-op 3 ] compile-1 ] unit-test
+[ 3 ] [ [ 3 no-op ] compile-1 ] unit-test
 
-[ 25 ] [ 5 two-calls ] unit-test
+: bar 4 ;
 
-: mix-test 3 5 fixnum+ 6 fixnum* ;
+[ 4 ] [ [ bar no-op ] compile-1 ] unit-test
+[ 4 3 ] [ [ no-op bar 3 ] compile-1 ] unit-test
+[ 3 4 ] [ [ 3 no-op bar ] compile-1 ] unit-test
 
-[ 48 ] [ mix-test ] unit-test
+[ ] [ no-op ] unit-test
 
-: indexed-literal-test "hello world" ;
+! Conditionals
 
-full-gc
-full-gc
+[ 1 ] [ t [ [ 1 ] [ 2 ] if ] compile-1 ] unit-test
+[ 2 ] [ f [ [ 1 ] [ 2 ] if ] compile-1 ] unit-test
+[ 1 3 ] [ t [ [ 1 ] [ 2 ] if 3 ] compile-1 ] unit-test
+[ 2 3 ] [ f [ [ 1 ] [ 2 ] if 3 ] compile-1 ] unit-test
 
-[ "hello world" ] [ indexed-literal-test ] unit-test
+[ "hi" ] [ 0 [ { [ "hi" ] [ "bye" ] } dispatch ] compile-1 ] unit-test
+[ "bye" ] [ 1 [ { [ "hi" ] [ "bye" ] } dispatch ] compile-1 ] unit-test
 
-: foo dup [ dup [ ] [ ] if drop ] [ drop ] if ;
+[ "hi" 3 ] [ 0 [ { [ "hi" ] [ "bye" ] } dispatch 3 ] compile-1 ] unit-test
+[ "bye" 3 ] [ 1 [ { [ "hi" ] [ "bye" ] } dispatch 3 ] compile-1 ] unit-test
 
-[ 10 ] [ 10 2 foo ] unit-test
+[ 4 1 ] [ 0 [ { [ bar 1 ] [ 3 1 ] } dispatch ] compile-1 ] unit-test
+[ 3 1 ] [ 1 [ { [ bar 1 ] [ 3 1 ] } dispatch ] compile-1 ] unit-test
+[ 4 1 3 ] [ 0 [ { [ bar 1 ] [ 3 1 ] } dispatch 3 ] compile-1 ] unit-test
+[ 3 1 3 ] [ 1 [ { [ bar 1 ] [ 3 1 ] } dispatch 3 ] compile-1 ] unit-test
 
-: foox dup [ foox ] when ; inline
-: bar foox ;
+! Labels
 
-: xyz 3 ;
+: recursive ( ? -- ) [ f recursive ] when ; inline
 
-: execute-test execute ; inline
-: execute-test-2 \ xyz execute-test ;
+[ ] [ t [ recursive ] compile-1 ] unit-test
 
-\ execute-test-2 compile
+\ recursive compile
 
-[ f ] [ \ execute-test compiled? ] unit-test
-[ 3 ] [ execute-test-2 ] unit-test
+[ ] [ t recursive ] unit-test
index daf8afacc98d2a53bae631b61ba135e6991be3ec..ee94f0c9a2b751a6579dc6118722c74f2c1f441c 100644 (file)
@@ -1,21 +1,24 @@
 IN: temporary
-USING: errors compiler test namespaces sequences
-kernel-internals kernel math ;
+USING: compiler tools.test namespaces sequences
+kernel.private kernel math continuations continuations.private
+words ;
 
-: nice-stack-trace
-    error-stack-trace get symbolic-stack-trace [ second ] map ;
+: symbolic-stack-trace ( -- newseq )
+    error-continuation get continuation-call callstack>array ;
 
 : foo 3 throw 7 ;
 : bar foo 4 ;
 : baz bar 5 ;
 \ baz compile
 [ 3 ] [ [ baz ] catch ] unit-test
-[ { foo bar baz } ] [ nice-stack-trace ] unit-test
+[ { baz bar foo throw } ] [
+    symbolic-stack-trace [ word? ] subset
+] unit-test
 
 : bleh [ 3 + ] map [ 0 > ] subset ;
 \ bleh compile
 
-: stack-trace-contains? nice-stack-trace memq? ;
+: stack-trace-contains? symbolic-stack-trace memq? ;
     
 [ t ] [
     [ { 1 "hi" } bleh ] catch drop \ + stack-trace-contains?
@@ -26,3 +29,11 @@ kernel-internals kernel math ;
     \ + stack-trace-contains?
     \ > stack-trace-contains?
 ] unit-test
+
+: quux [ t [ "hi" throw ] when ] times ;
+\ quux compile
+
+[ t ] [
+    [ 10 quux ] catch drop
+    \ (each-integer) stack-trace-contains?
+] unit-test
diff --git a/core/compiler/test/stack.factor b/core/compiler/test/stack.factor
deleted file mode 100644 (file)
index ed3d27b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-IN: temporary
-USING: compiler kernel math-internals test ;
-
-! Test shuffle intrinsics
-[ ] [ 1 [ drop ] compile-1 ] unit-test
-[ ] [ 1 2 [ 2drop ] compile-1 ] unit-test
-[ ] [ 1 2 3 [ 3drop ] compile-1 ] unit-test
-[ 1 1 ] [ 1 [ dup ] compile-1 ] unit-test
-[ 1 2 1 2 ] [ 1 2 [ 2dup ] compile-1 ] unit-test
-[ 1 2 3 1 2 3 ] [ 1 2 3 [ 3dup ] compile-1 ] unit-test
-[ 2 3 1 ] [ 1 2 3 [ rot ] compile-1 ] unit-test
-[ 3 1 2 ] [ 1 2 3 [ -rot ] compile-1 ] unit-test
-[ 1 1 2 ] [ 1 2 [ dupd ] compile-1 ] unit-test
-[ 2 1 3 ] [ 1 2 3 [ swapd ] compile-1 ] unit-test
-[ 2 ] [ 1 2 [ nip ] compile-1 ] unit-test
-[ 3 ] [ 1 2 3 [ 2nip ] compile-1 ] unit-test
-[ 2 1 2 ] [ 1 2 [ tuck ] compile-1 ] unit-test
-[ 1 2 1 ] [ 1 2 [ over ] compile-1 ] unit-test
-[ 1 2 3 1 ] [ 1 2 3 [ pick ] compile-1 ] unit-test
-[ 2 1 ] [ 1 2 [ swap ] compile-1 ] unit-test
diff --git a/core/compiler/test/templates-early.factor b/core/compiler/test/templates-early.factor
new file mode 100644 (file)
index 0000000..5f6ece5
--- /dev/null
@@ -0,0 +1,131 @@
+! Testing templates machinery without compiling anything
+IN: temporary
+USING: compiler generator generator.registers tools.test
+namespaces sequences words kernel math effects ;
+
+[
+    [ ] [ init-templates ] unit-test
+    
+    [ V{ 3 } ] [ 3 fresh-object fresh-objects get ] unit-test
+    
+    [ ] [ 0 <int-vreg> phantom-d get phantom-push ] unit-test
+    
+    [ ] [ compute-free-vregs ] unit-test
+    
+    [ f ] [ 0 <int-vreg> T{ int-regs } free-vregs member? ] unit-test
+    
+    [ f ] [
+        [
+            copy-templates
+            1 <int-vreg> phantom-d get phantom-push
+            compute-free-vregs
+            1 <int-vreg> T{ int-regs } free-vregs member?
+        ] with-scope
+    ] unit-test
+    
+    [ t ] [ 1 <int-vreg> T{ int-regs } free-vregs member? ] unit-test
+] with-scope
+
+[
+    [ ] [ init-templates ] unit-test
+    
+    [ ] [ T{ effect f 3 { 1 2 0 } f } phantom-shuffle ] unit-test
+    
+    [ 3 ] [ live-locs length ] unit-test
+    
+    [ ] [ T{ effect f 2 { 1 0 } f } phantom-shuffle ] unit-test
+    
+    [ 2 ] [ live-locs length ] unit-test
+] with-scope
+
+[
+    [ ] [ init-templates ] unit-test
+
+    [ ] [ init-generator ] unit-test
+
+    [ t ] [ [ end-basic-block ] { } make empty? ] unit-test
+
+    3 fresh-object
+
+    [ f ] [ [ end-basic-block ] { } make empty? ] unit-test
+] with-scope
+
+[
+    [ ] [ init-templates ] unit-test
+    
+    H{
+        { +input+ { { f "x" } } }
+    } clone [
+        [ 1 0 ] [ +input+ get { } { } guess-vregs ] unit-test
+        [ ] [ 1 0 ensure-vregs ] unit-test
+        ! [ t ] [ +input+ get phantom-d get compatible? ] unit-test
+        [ ] [ finalize-contents ] unit-test
+        [ ] [ [ template-inputs ] { } make drop ] unit-test
+    ] bind
+] with-scope
+
+! Test template picking strategy
+SYMBOL: template-chosen
+
+: template-test ( a b -- c ) + ;
+
+\ template-test {
+    {
+        [
+            1 template-chosen get push
+        ] H{
+            { +input+ { { f "obj" } { [ ] "n" } } }
+            { +output+ { "obj" } }
+        }
+    }
+    {
+        [
+            2 template-chosen get push
+        ] H{
+            { +input+ { { f "obj" } { f "n" } } }
+            { +output+ { "obj" } }
+        }
+    }
+} define-intrinsics
+
+[ V{ 2 } ] [
+    V{ } clone template-chosen set
+    [ template-test ] compile-quot drop
+    template-chosen get
+] unit-test
+
+[ V{ 1 } ] [
+    V{ } clone template-chosen set
+    [ dup 0 template-test ] compile-quot drop
+    template-chosen get
+] unit-test
+
+[ V{ 1 } ] [
+    V{ } clone template-chosen set
+    [ 0 template-test ] compile-quot drop
+    template-chosen get
+] unit-test
+
+! Regression
+[
+    [ ] [ init-templates ] unit-test
+
+    ! dup dup
+    [ ] [
+        T{ effect f { "x" } { "x" "x" } } phantom-shuffle
+        T{ effect f { "x" } { "x" "x" } } phantom-shuffle
+    ] unit-test
+
+    ! This is not empty since a load instruction is emitted
+    [ f ] [
+        [ { { f "x"  } } fast-input ] { } make empty?
+    ] unit-test
+
+    ! This is empty since we already loaded the value
+    [ t ] [
+        [ { { f "x"  } } fast-input ] { } make empty?
+    ] unit-test
+
+    ! This is empty since we didn't change the stack
+    [ t ] [ [ end-basic-block ] { } make empty? ] unit-test
+] with-scope
index bbce59f9a66303b3263f2a960a2789501748e243..8877126902e4be84effcf76c1e4f3a99c64c7bdc 100644 (file)
@@ -1,7 +1,9 @@
 ! Black box testing of templater optimization
 
-USING: arrays compiler kernel kernel-internals math
-math-internals namespaces sequences sequences-internals test ;
+USING: arrays compiler kernel kernel.private math
+hashtables.private math.private math.ratios.private namespaces
+sequences sequences.private tools.test namespaces.private
+slots.private combinators.private ;
 IN: temporary
 
 ! Oops!
@@ -73,7 +75,7 @@ unit-test
 [ 3 ]
 [
     global [ 3 \ foo set ] bind
-    \ foo [ global >n get ndrop ] compile-1
+    \ foo [ global >n get ndrop ] compile-1
 ] unit-test
 
 : blech drop ;
@@ -87,7 +89,7 @@ unit-test
 [ 3 ]
 [
     global [ 3 \ foo set ] bind
-    \ foo [ global [ get ] swap >n call ndrop ] compile-1
+    \ foo [ global [ get ] swap >n call ndrop ] compile-1
 ] unit-test
 
 [ 3 ]
@@ -106,20 +108,80 @@ unit-test
     -12 -13 [ [ 0 swap fixnum- ] 2apply ] compile-1
 ] unit-test
 
-[ { t t } ] [
-    { t } { t } [
-        dup array-capacity [
-            2dup swap swap 2 fixnum+fast slot
-            >r pick swap 2 fixnum+fast slot r> 2array
-        ] collect 2nip
-    ] compile-1 first
+[ 2 ] [
+    SBUF" " [ 2 slot 2 [ slot ] keep ] compile-1 nip
 ] unit-test
 
-[ { t t } ] [
-    { t } { t } [
-        dup array-capacity [
-            2dup swap swap 2 fixnum+ slot
-            >r pick swap 2 fixnum+ slot r> 2array
-        ] collect 2nip
-    ] compile-1 first
+! Test slow shuffles
+[ 3 1 2 3 4 5 6 7 8 9 ] [
+    1 2 3 4 5 6 7 8 9
+    [ >r >r >r >r >r >r >r >r >r 3 r> r> r> r> r> r> r> r> r> ]
+    compile-1
 ] unit-test
+
+[ 2 2 2 2 2 2 2 2 2 2 1 ] [
+    1 2
+    [ swap >r dup dup dup dup dup dup dup dup dup r> ] compile-1
+] unit-test
+
+[ ] [ [ 9 [ ] times ] compile-1 ] unit-test
+
+[ ] [
+    [
+        [ 200 dup [ 200 3array ] curry map drop ] times
+    ] compile-quot drop
+] unit-test
+
+
+! Test how dispatch handles the end of a basic block
+: try-breaking-dispatch
+    float+ swap { [ "hey" ] [ "bye" ] } dispatch ;
+
+: try-breaking-dispatch-2
+    1 1.0 2.5 try-breaking-dispatch "bye" = >r 3.5 = r> and ;
+
+[ t ] [
+    10000000 [ drop try-breaking-dispatch-2 ] all?
+] unit-test
+
+! Regression
+: (broken) ( x -- y ) ;
+
+[ 2.0 { 2.0 0.0 } ] [
+    2.0 1.0
+    [ float/f 0.0 [ drop (broken) ] 2keep 2array ] compile-1
+] unit-test
+
+! Regression
+: hellish-bug-1 2drop ;
+
+: hellish-bug-2 ( i array x -- x ) 
+    2dup 1 slot eq? [ 2drop ] [ 
+        2dup array-nth tombstone? [ 
+            [
+                [ array-nth ] 2keep >r 1 fixnum+fast r> array-nth
+                pick 2dup hellish-bug-1 3drop
+            ] 2keep
+        ] unless >r 2 fixnum+fast r> hellish-bug-2
+    ] if ; inline
+
+: hellish-bug-3 ( hash array -- ) 
+    0 swap hellish-bug-2 drop ;
+
+[ ] [
+    H{ { 1 2 } { 3 4 } } dup hash-array
+    [ 0 swap hellish-bug-2 drop ] compile-1
+] unit-test
+
+! Regression
+: foox
+    dup not
+    [ drop 3 ] [ dup tuple? [ drop 4 ] [ drop 5 ] if ] if ;
+
+[ 3 ] [ f foox ] unit-test
+
+TUPLE: my-tuple ;
+
+[ 4 ] [ T{ my-tuple } foox ] unit-test
+
+[ 5 ] [ "hi" foox ] unit-test
diff --git a/core/compiler/test/tuples.factor b/core/compiler/test/tuples.factor
new file mode 100644 (file)
index 0000000..1a469ea
--- /dev/null
@@ -0,0 +1,32 @@
+IN: temporary
+USING: kernel tools.test compiler ;
+
+TUPLE: color red green blue ;
+
+[ T{ color f 1 2 3 } ]
+[ 1 2 3 [ color construct-boa ] compile-1 ] unit-test
+
+[ 1 3 ] [
+    1 2 3 color construct-boa
+    [ { color-red color-blue } get-slots ] compile-1
+] unit-test
+
+[ T{ color f 10 2 20 } ] [
+    10 20
+    1 2 3 color construct-boa [
+        [
+            { set-color-red set-color-blue } set-slots
+        ] compile-1
+    ] keep
+] unit-test
+
+[ T{ color f f f f } ]
+[ [ color construct-empty ] compile-1 ] unit-test
+
+[ T{ color "a" f "b" f } ] [
+    "a" "b"
+    [ { set-delegate set-color-green } color construct ]
+    compile-1
+] unit-test
+
+[ T{ color f f f f } ] [ [ { } color construct ] compile-1 ] unit-test
diff --git a/core/compiler/x86/alien-macosx.factor b/core/compiler/x86/alien-macosx.factor
deleted file mode 100644 (file)
index 9424715..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: assembler errors kernel kernel-internals math namespaces ;
-
-! OS X uses a different ABI. The stack must be 16-byte aligned.
-
-: stack-increment \ stack-reserve get 16 align 16 + 2 cells - ;
-
-: %prologue ( n -- )
-    EBP PUSH
-    EBP ESP MOV
-    \ stack-reserve set stack-reg stack-increment SUB ;
-
-: align-sub ( n -- )
-    dup 16 align swap - ESP swap SUB ;
-
-: align-add ( n -- )
-    16 align ESP swap ADD ;
-
-: with-aligned-stack ( n quot -- )
-    swap dup align-sub slip align-add ; inline
-
-: struct-ptr/size ( n size func -- )
-    EAX ESP MOV ! Save stack pointer
-    >r >r EAX swap ADD r> r> ! Add n
-    8 [
-        ! Push struct size
-        >r PUSH r>
-        ! Push destination address
-        EAX PUSH
-        ! Copy the struct to the stack
-        f %alien-invoke
-    ] with-aligned-stack ;
-
-: %unbox-struct ( n size -- )
-    "unbox_value_struct" struct-ptr/size ;
-
-: %unbox ( n reg-class func -- )
-    ! Call the unboxer
-    f %alien-invoke
-    ! Store the return value on the C stack
-    store-return-reg ;
-
-: %box-pair ( -- )
-    #! Box an 8-byte struct returned in EAX:EDX.
-    #! Why did Apple have to make things so complex?
-    #! Just use objc_msgSend_stret for all structs... jesus.
-    8 [
-        EDX PUSH
-        EAX PUSH
-        "box_value_pair" f %alien-invoke
-    ] with-aligned-stack ;
-
-: %box-struct ( n size -- )
-    over [
-        >r stack-increment + 2 cells + r>
-        "box_value_struct" struct-ptr/size 
-    ] [
-        nip 8 = [
-            "Cannot %box-struct which is not 8 bytes." throw
-        ] unless
-        %box-pair
-    ] if ;
-
-: box@ ( n reg-class -- stack@ )
-    #! Used for callbacks; we want to box the values given to
-    #! us by the C function caller. Computes stack location of
-    #! nth parameter; note that we must go back one more stack
-    #! frame, since %box sets one up to call the one-arg boxer
-    #! function. The size of this stack frame so far depends on
-    #! the reg-class of the boxer's arg.
-    16 swap reg-size - + stack-increment + 2 cells + ;
-
-: (%box) ( n reg-class -- )
-    #! 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 [ [ box@ ] keep [ load-return-reg ] keep ] [ nip ] if
-    push-return-reg ;
-
-: %box ( n reg-class func -- )
-    over reg-size [
-        >r (%box) r> f %alien-invoke
-    ] with-aligned-stack ;
-
-: %alien-callback ( quot -- )
-    4 [
-        EAX load-indirect
-        EAX PUSH
-        "run_callback" f %alien-invoke
-    ] with-aligned-stack ;
-
-: align-callback-value ( reg-class -- reg n )
-    ESP 16 rot reg-size - ;
-    
-: %callback-value ( reg-class func -- )
-    ! Call the unboxer
-    f %alien-invoke
-    dup align-callback-value SUB
-    ! Save return register
-    dup push-return-reg
-    ! Restore data/call/retain stacks
-    "unnest_stacks" f %alien-invoke
-    ! Restore return register
-    dup pop-return-reg
-    align-callback-value ADD ;
-
-: %cleanup ( n -- ) drop ;
diff --git a/core/compiler/x86/alien.factor b/core/compiler/x86/alien.factor
deleted file mode 100644 (file)
index 7ceb876..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: alien arrays assembler inference kernel
-kernel-internals math memory namespaces words ;
-
-: %unbox ( n reg-class func -- )
-    f %alien-invoke push-return-reg drop ;
-
-: struct-ptr/size ( size func -- )
-    ! Load struct size
-    swap PUSH
-    ! Load destination address
-    EAX PUSH
-    ! Copy the struct to the stack
-    f %alien-invoke
-    ! Clean up
-    EAX POP
-    ECX POP ;
-
-: %unbox-struct ( n size -- )
-    nip
-    ! Increase stack size
-    ESP over SUB
-    ! Save destination address in EAX
-    EAX ESP MOV
-    "unbox_value_struct" struct-ptr/size ;
-
-: %box-struct ( n size -- )
-    nip
-    ! Compute source address in EAX
-    EAX ESP MOV
-    EAX 8 ADD
-    "box_value_struct" struct-ptr/size ;
-
-: %box ( n reg-class func -- )
-    rot [ 8 + pick load-return-reg ] when*
-    over push-return-reg
-    f %alien-invoke
-    drop-return-reg ;
-
-: %alien-callback ( quot -- )
-    0 <int-vreg> load-literal
-    EAX PUSH
-    "run_callback" f %alien-invoke
-    EAX POP ;
-
-: %callback-value ( reg-class func -- )
-    ! Call the unboxer
-    f %alien-invoke
-    ! Save return register
-    dup push-return-reg
-    ! Restore data/callstacks
-    "unnest_stacks" f %alien-invoke
-    ! Restore return register
-    pop-return-reg ;
-
-: %cleanup ( n -- ) dup zero? [ drop ] [ ESP swap ADD ] if ;
diff --git a/core/compiler/x86/allot.factor b/core/compiler/x86/allot.factor
deleted file mode 100644 (file)
index b655884..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: compiler
-USING: kernel assembler kernel-internals namespaces math ;
-
-: load-zone-ptr ( -- )
-    #! Load pointer to start of zone array
-    allot-tmp-reg 0 MOV
-    "generations" f rel-absolute-cell rel-dlsym
-    allot-tmp-reg allot-tmp-reg [] MOV ;
-
-: load-allot-ptr ( -- )
-    load-zone-ptr
-    allot-tmp-reg allot-tmp-reg cell [+] MOV ;
-
-: inc-allot-ptr ( n -- )
-    load-zone-ptr
-    allot-tmp-reg cell [+] swap 8 align ADD ;
-
-: store-header ( header -- )
-    allot-tmp-reg [] swap tag-header MOV ;
-
-: %allot ( header size quot -- )
-    dup maybe-gc
-    swap >r >r
-    allot-tmp-reg PUSH
-    load-allot-ptr
-    store-header
-    r> call
-    r> inc-allot-ptr
-    allot-tmp-reg POP ; inline
-
-: %allot-float ( loc vreg -- )
-    #! Only called by pentium4 backend, uses SSE2 instruction
-    float-tag 16 [
-        allot-tmp-reg 8 [+] swap v>operand MOVSD
-        allot-tmp-reg float-tag OR
-        v>operand allot-tmp-reg MOV
-    ] %allot ;
-
-: %allot-bignum ( #digits quot -- )
-    #! 1 cell header, 1 cell length, 1 cell sign, + digits
-    #! length is the # of digits + sign
-    bignum-tag pick 3 + cells [
-        ! Write length
-        >r allot-tmp-reg cell [+] swap 1+ tag-bits shift MOV r>
-        ! Call quot
-        call
-    ] %allot ; inline
-
-: %allot-bignum-signed-1 ( outreg inreg -- )
-    #! on entry, inreg is a signed 32-bit quantity
-    #! exits with tagged ptr to bignum in outreg
-    [
-        "positive" define-label
-        "end" define-label
-        1 [
-            dup 0 CMP
-            "positive" get JGE
-            allot-tmp-reg 2 cells [+] 1 MOV ! negative sign
-            dup NEG
-            "end" get JMP
-            "positive" resolve-label
-            allot-tmp-reg 2 cells [+] 0 MOV ! positive sign
-            "end" resolve-label
-            allot-tmp-reg 3 cells [+] swap MOV
-            allot-tmp-reg bignum-tag OR
-            allot-tmp-reg MOV
-        ] %allot-bignum
-    ] with-scope ;
-
-: bignum-radix-mask 1 cell 2 - shift 1- ;
-
-: %allot-bignum-signed-2 ( reg1 reg2 -- )
-    #! this word has some hairy restrictions; its really only
-    #! intended to be used by fixnum*.
-    #! - reg1 and reg2 together form a 60-bit signed quantity
-    #!   (product of two 29-bit fixnums cannot exceed this)
-    #! - the quantity must be non-zero
-    #!   (if the product of two fixnums is zero, there's no
-    #!   overflow so this word won't be called in that case)
-    #! exits with tagged ptr to bignum in reg1
-    [
-        "positive" define-label
-        "end" define-label
-        2 [
-            0 pick CMP
-            "positive" get JGE
-            allot-tmp-reg 2 cells [+] 1 MOV
-            over NOT
-            dup -1 IMUL2
-            "end" get JMP
-            "positive" resolve-label
-            allot-tmp-reg 2 cells [+] 0 MOV
-            "end" resolve-label
-            dup bignum-radix-mask AND
-            allot-tmp-reg 3 cells [+] swap MOV
-            dup bignum-radix-mask AND
-            allot-tmp-reg 4 cells [+] over MOV
-            allot-tmp-reg bignum-tag OR
-            allot-tmp-reg MOV
-        ] %allot-bignum
-    ] with-scope ;
diff --git a/core/compiler/x86/architecture.factor b/core/compiler/x86/architecture.factor
deleted file mode 100644 (file)
index 6d486c9..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays assembler generic kernel kernel-internals
-math memory namespaces sequences words ;
-IN: compiler
-
-: code-format 1 ; inline
-
-! x86 register assignments
-! EAX, ECX, EDX integer vregs
-! XMM0 - XMM7 float vregs
-! ESI datastack
-! EDI callstack
-
-! AMD64 redefines a lot of words in this file
-
-: ds-reg ESI ; inline
-: cs-reg EDI ; inline
-: allot-tmp-reg EBX ; inline
-: stack-reg ESP ; inline
-: stack@ stack-reg swap [+] ;
-
-: reg-stack ( n reg -- op ) swap cells neg [+] ;
-
-M: ds-loc v>operand ds-loc-n ds-reg reg-stack ;
-M: cs-loc v>operand cs-loc-n cs-reg reg-stack ;
-
-: %alien-invoke ( symbol dll -- ) (CALL) rel-dlsym ;
-
-: alien-temp ( quot -- )
-    0 [] swap call "alien_temp" f rel-absolute rel-dlsym ;
-    inline
-
-: %prepare-alien-indirect ( -- )
-    "unbox_alien" f %alien-invoke
-    [ T{ int-regs } return-reg MOV ] alien-temp ;
-
-: %alien-indirect ( -- )
-    [ CALL ] alien-temp ;
-
-GENERIC: push-return-reg ( reg-class -- )
-GENERIC: pop-return-reg ( reg-class -- )
-GENERIC: load-return-reg ( stack@ reg-class -- )
-GENERIC: store-return-reg ( stack@ reg-class -- )
-
-! On x86, parameters are never passed in registers.
-M: int-regs return-reg drop EAX ;
-M: int-regs fastcall-regs drop { } ;
-M: int-regs vregs drop { EAX ECX EDX } ;
-M: int-regs %freg>stack drop >r stack@ r> MOV ;
-M: int-regs %stack>freg drop swap stack@ MOV ;
-M: int-regs push-return-reg return-reg PUSH ;
-M: int-regs pop-return-reg return-reg POP ;
-: load/store-int-return return-reg stack-reg rot [+] ;
-M: int-regs load-return-reg load/store-int-return MOV ;
-M: int-regs store-return-reg load/store-int-return swap MOV ;
-
-: MOVSS/D float-regs-size 4 = [ MOVSS ] [ MOVSD ] if ;
-
-M: float-regs fastcall-regs drop { } ;
-M: float-regs vregs drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ;
-M: float-regs %freg>stack >r >r stack@ r> r> MOVSS/D ;
-M: float-regs %stack>freg >r swap stack@ r> MOVSS/D ;
-
-: FSTP 4 = [ FSTPS ] [ FSTPL ] if ;
-
-M: float-regs push-return-reg
-    stack-reg swap reg-size [ SUB  stack-reg [] ] keep FSTP ;
-
-: FLD 4 = [ FLDS ] [ FLDL ] if ;
-
-: drop-return-reg stack-reg swap reg-size ADD ;
-
-M: float-regs pop-return-reg
-    stack-reg [] over reg-size FLD drop-return-reg ;
-
-: load/store-float-return reg-size >r stack-reg swap [+] r> ;
-M: float-regs load-return-reg load/store-float-return FLD ;
-M: float-regs store-return-reg load/store-float-return FSTP ;
-
-: address-operand ( address -- operand )
-    #! On x86, we can always use an address as an operand
-    #! directly.
-    ; inline
-
-: fixnum>slot@ 1 SHR ; inline
-
-: prepare-division CDQ ; inline
-
-M: immediate load-literal
-    v>operand swap v>operand MOV ;
-
-: load-indirect ( literal reg -- )
-    0 [] MOV rel-absolute-cell rel-literal ;
-
-M: object load-literal
-    v>operand load-indirect ;
-
-: %prologue ( n -- )
-    drop
-    EBP PUSH
-    EBP ESP MOV ;
-
-: %epilogue ( -- )
-    LEAVE ;
-
-: (%call) ( label -- label )
-    dup (compile) dup primitive? [ address-operand ] when ;
-
-: %call ( label -- ) (%call) CALL ;
-
-: %jump ( label -- ) %epilogue (%call) JMP ;
-
-: %jump-label ( label -- ) JMP ;
-
-: %jump-t ( label -- ) "flag" operand f v>operand CMP JNE ;
-
-: compile-aligned ( -- )
-    compiled-offset [ 8 align ] keep - 0 <array> % ;
-
-: %dispatch ( -- )
-    #! Compile a piece of code that jumps to an offset in a
-    #! jump table indexed by the fixnum at the top of the stack.
-    #! The jump table must immediately follow this macro.
-    [
-        ! Untag and multiply to get a jump table offset
-        "end" define-label
-        "n" operand fixnum>slot@
-        ! Add to jump table base. We use a temporary register
-        ! since on AMD64 we have to load a 64-bit immediate. On
-        ! x86, this is redundant.
-        "scratch" operand HEX: ffffffff MOV
-        "end" get rel-absolute-cell rel-label
-        "n" operand "scratch" operand ADD
-        ! Jump to jump table entry
-        "n" operand [] JMP
-        ! Align for better performance
-        compile-aligned
-        ! Fix up jump table pointer
-        "end" resolve-label
-    ] H{
-        { +input+ { { f "n" } } }
-        { +scratch+ { { f "scratch" } } }
-    } with-template ;
-
-: %target ( label -- ) 0 cell, rel-absolute-cell rel-label ;
-
-: %return ( -- ) %epilogue RET ;
-
-: %move-int>int ( dst src -- )
-    [ v>operand ] 2apply MOV ;
-
-: %move-int>float ( dst src -- )
-    [ v>operand ] 2apply float-offset [+] MOVSD ;
-
-M: int-regs (%peek) drop %move-int>int ;
-
-M: int-regs (%replace) drop swap %move-int>int ;
-
-: (%inc) swap cells dup 0 > [ ADD ] [ neg SUB ] if ;
-
-: %inc-d ( n -- ) ds-reg (%inc) ;
-
-: %inc-r ( n -- ) cs-reg (%inc) ;
-
-M: object %stack>freg 3drop ;
-
-M: object %freg>stack 3drop ;
diff --git a/core/compiler/x86/assembler.factor b/core/compiler/x86/assembler.factor
deleted file mode 100644 (file)
index 953c306..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays compiler errors generic io kernel kernel-internals
-math namespaces parser sequences words ;
-IN: assembler
-
-! A postfix assembler for x86 and AMD64.
-
-! In 32-bit mode, { 1234 } is absolute indirect addressing.
-! In 64-bit mode, { 1234 } is RIP-relative.
-! Beware!
-
-: 4, 4 >le % ; inline
-: cell, cell >le % ; inline
-
-#! Extended AMD64 registers (R8-R15) return true.
-GENERIC: extended? ( op -- ? )
-
-M: object extended? drop f ;
-
-! Register operands -- eg, ECX
-: define-register ( symbol num size -- )
-    >r dupd "register" set-word-prop r>
-    "register-size" set-word-prop ;
-
-! x86 registers
-SYMBOL: AX \ AX 0 16 define-register
-SYMBOL: CX \ CX 1 16 define-register
-SYMBOL: DX \ DX 2 16 define-register
-SYMBOL: BX \ BX 3 16 define-register
-SYMBOL: SP \ SP 4 16 define-register
-SYMBOL: BP \ BP 5 16 define-register
-SYMBOL: SI \ SI 6 16 define-register
-SYMBOL: DI \ DI 7 16 define-register
-
-SYMBOL: EAX \ EAX 0 32 define-register
-SYMBOL: ECX \ ECX 1 32 define-register
-SYMBOL: EDX \ EDX 2 32 define-register
-SYMBOL: EBX \ EBX 3 32 define-register
-SYMBOL: ESP \ ESP 4 32 define-register
-SYMBOL: EBP \ EBP 5 32 define-register
-SYMBOL: ESI \ ESI 6 32 define-register
-SYMBOL: EDI \ EDI 7 32 define-register
-
-SYMBOL: XMM0 \ XMM0 0 128 define-register
-SYMBOL: XMM1 \ XMM1 1 128 define-register
-SYMBOL: XMM2 \ XMM2 2 128 define-register
-SYMBOL: XMM3 \ XMM3 3 128 define-register
-SYMBOL: XMM4 \ XMM4 4 128 define-register
-SYMBOL: XMM5 \ XMM5 5 128 define-register
-SYMBOL: XMM6 \ XMM6 6 128 define-register
-SYMBOL: XMM7 \ XMM7 7 128 define-register
-
-! AMD64 registers
-SYMBOL: RAX \ RAX 0  64 define-register
-SYMBOL: RCX \ RCX 1  64 define-register
-SYMBOL: RDX \ RDX 2  64 define-register
-SYMBOL: RBX \ RBX 3  64 define-register
-SYMBOL: RSP \ RSP 4  64 define-register
-SYMBOL: RBP \ RBP 5  64 define-register
-SYMBOL: RSI \ RSI 6  64 define-register
-SYMBOL: RDI \ RDI 7  64 define-register
-SYMBOL: R8  \ R8  8  64 define-register
-SYMBOL: R9  \ R9  9  64 define-register
-SYMBOL: R10 \ R10 10 64 define-register
-SYMBOL: R11 \ R11 11 64 define-register
-SYMBOL: R12 \ R12 12 64 define-register
-SYMBOL: R13 \ R13 13 64 define-register
-SYMBOL: R14 \ R14 14 64 define-register
-SYMBOL: R15 \ R15 15 64 define-register
-
-SYMBOL: XMM8 \ XMM8 8 128 define-register
-SYMBOL: XMM9 \ XMM9 9 128 define-register
-SYMBOL: XMM10 \ XMM10 10 128 define-register
-SYMBOL: XMM11 \ XMM11 11 128 define-register
-SYMBOL: XMM12 \ XMM12 12 128 define-register
-SYMBOL: XMM13 \ XMM13 13 128 define-register
-SYMBOL: XMM14 \ XMM14 14 128 define-register
-SYMBOL: XMM15 \ XMM15 15 128 define-register
-
-PREDICATE: word register "register" word-prop ;
-
-PREDICATE: register register-16 "register-size" word-prop 16 = ;
-PREDICATE: register register-32 "register-size" word-prop 32 = ;
-PREDICATE: register register-64 "register-size" word-prop 64 = ;
-PREDICATE: register register-128 "register-size" word-prop 128 = ;
-
-M: register extended? "register" word-prop 7 > ;
-
-! Addressing modes
-TUPLE: indirect base index scale displacement ;
-
-M: indirect extended? indirect-base extended? ;
-
-: canonicalize-EBP
-    #! { EBP } ==> { EBP 0 }
-    dup indirect-base { EBP RBP R13 } memq? [
-        dup indirect-displacement [
-            drop
-        ] [
-            0 swap set-indirect-displacement
-        ] if
-    ] [
-        drop
-    ] if ;
-
-: canonicalize-ESP
-    #! { ESP } ==> { ESP ESP }
-    dup indirect-base { ESP RSP R12 } memq? [
-        dup indirect-base swap set-indirect-index
-    ] [
-        drop
-    ] if ;
-
-: canonicalize ( indirect -- )
-    #! Modify the indirect to work around certain addressing mode
-    #! quirks.
-    dup canonicalize-EBP
-    canonicalize-ESP ;
-
-C: indirect ( base index scale displacement -- indirect )
-    [ set-indirect-displacement ] keep
-    [ set-indirect-scale ] keep
-    [ set-indirect-index ] keep
-    [ set-indirect-base ] keep
-    dup canonicalize ;
-
-: [] ( reg/displacement -- indirect )
-    dup integer? [ >r f f f r> ] [ f f f ] if <indirect> ;
-
-: [+] ( reg displacement -- indirect )
-    dup integer?
-    [ dup zero? [ drop f ] when >r f f r> ]
-    [ f f ] if
-    <indirect> ;
-
-: reg-code "register" word-prop 7 bitand ;
-
-: indirect-base* indirect-base [ EBP ] unless* reg-code ;
-
-: indirect-index* indirect-index [ ESP ] unless* reg-code ;
-
-: indirect-scale* indirect-scale [ 0 ] unless* ;
-
-GENERIC: sib-present? ( op -- ? )
-
-M: indirect sib-present?
-    dup indirect-base { ESP RSP } memq?
-    over indirect-index rot indirect-scale or or ;
-
-M: register sib-present? drop f ;
-
-GENERIC: r/m ( operand -- n )
-
-M: indirect r/m
-    dup sib-present?
-    [ drop ESP reg-code ] [ indirect-base* ] if ;
-
-M: register r/m reg-code ;
-
-: byte? -128 127 between? ;
-
-GENERIC: modifier ( op -- n )
-
-M: indirect modifier
-    dup indirect-base [
-        indirect-displacement BIN: 10 BIN: 00 ?
-    ] [
-        drop BIN: 00
-    ] if ;
-
-M: register modifier drop BIN: 11 ;
-
-: mod-r/m ( reg# indirect -- byte )
-    dup modifier 6 shift rot 3 shift rot r/m bitor bitor ;
-
-: sib ( indirect -- byte )
-    dup sib-present? [
-        dup indirect-base*
-        over indirect-index* 3 shift bitor
-        swap indirect-scale* 6 shift bitor
-    ] [
-        drop f
-    ] if ;
-
-GENERIC: displacement ( op -- n )
-
-M: indirect displacement indirect-displacement ;
-
-M: register displacement drop f ;
-
-: addressing ( reg# indirect -- )
-    [ mod-r/m , ] keep
-    [ sib [ , ] when* ] keep
-    displacement [ 4, ] when* ;
-
-! Utilities
-UNION: operand register indirect ;
-
-: operand-64? ( operand -- ? )
-    dup indirect? [
-        dup indirect-base register-64?
-        swap indirect-index register-64? or
-    ] [
-        register-64?
-    ] if ;
-
-: rex.w? ( rex.w reg mod-r/m -- ? )
-    [ operand-64? ] [ operand-64? ] ?if and ;
-
-: lhs-prefix
-    extended? [ BIN: 00000100 bitor ] when ;
-
-: rhs-prefix
-    [ extended? [ BIN: 00000001 bitor ] when ] keep
-    dup indirect? [
-        indirect-index extended?
-        [ BIN: 00000010 bitor ] when
-    ] [
-        drop
-    ] if ;
-
-: rex-prefix ( reg r/m rex.w -- )
-    #! Compile an AMD64 REX prefix.
-    pick pick rex.w? BIN: 01001000 BIN: 01000000 ?
-    swap lhs-prefix swap rhs-prefix
-    dup BIN: 01000000 = [ drop ] [ , ] if ;
-
-: 16-prefix ( reg r/m -- )
-    [ register-16? ] 2apply or [ HEX: 66 , ] when ;
-
-: prefix ( reg r/m rex.w -- ) pick pick 16-prefix rex-prefix ;
-
-: prefix-1 ( reg rex.w -- ) f swap prefix ;
-
-: short-operand ( reg rex.w n -- )
-    #! Some instructions encode their single operand as part of
-    #! the opcode.
-    >r dupd prefix-1 reg-code r> + , ;
-
-: 1-operand ( op reg rex.w opcode -- )
-    #! The 'reg' is not really a register, but a value for the
-    #! 'reg' field of the mod-r/m byte.
-    >r >r over r> prefix-1 r> , swap addressing ;
-
-: immediate-1 ( imm dst reg rex.w opcode -- )
-    1-operand , ;
-
-: immediate-1/4 ( imm dst reg rex.w opcode -- )
-    #! If imm is a byte, compile the opcode and the byte.
-    #! Otherwise, set the 32-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.
-    >r >r pick byte? [
-        r> r> BIN: 10 bitor immediate-1
-    ] [
-        r> r> 1-operand 4,
-    ] if ;
-
-: 2-operand ( dst src op -- )
-    #! Sets the opcode's direction bit. It is set if the
-    #! destination is a direct register operand.
-    pick register? [ BIN: 10 bitor swapd ] when
-    >r 2dup t prefix r> , reg-code swap addressing ;
-
-PREDICATE: word callable register? not ;
-
-! Moving stuff
-GENERIC: PUSH ( op -- )
-M: register PUSH f HEX: 50 short-operand ;
-M: integer PUSH HEX: 68 , 4, ;
-M: callable PUSH 0 PUSH rel-absolute rel-word ;
-M: label PUSH 0 PUSH rel-absolute rel-label ;
-M: operand PUSH BIN: 110 f HEX: ff 1-operand ;
-
-GENERIC: POP ( op -- )
-M: register POP f HEX: 58 short-operand ;
-M: operand POP BIN: 000 f HEX: 8f 1-operand ;
-
-! MOV where the src is immediate.
-GENERIC: (MOV-I) ( src dst -- )
-M: register (MOV-I) t HEX: b8 short-operand cell, ;
-M: operand (MOV-I) BIN: 000 t HEX: c7 1-operand 4, ;
-
-GENERIC: MOV ( dst src -- )
-M: integer MOV swap (MOV-I) ;
-M: callable MOV 0 rot (MOV-I) rel-absolute-cell rel-word ;
-M: label MOV 0 rot (MOV-I) rel-absolute-cell rel-label ;
-M: operand MOV HEX: 89 2-operand ;
-
-! Control flow
-GENERIC: JMP ( op -- )
-: (JMP) HEX: e9 , 0 4, rel-relative ;
-M: callable JMP (JMP) rel-word ;
-M: label JMP (JMP) rel-label ;
-M: operand JMP BIN: 100 t HEX: ff 1-operand ;
-
-GENERIC: CALL ( op -- )
-: (CALL) HEX: e8 , 0 4, rel-relative ;
-M: callable CALL (CALL) rel-word ;
-M: label CALL (CALL) rel-label ;
-M: operand CALL BIN: 010 t HEX: ff 1-operand ;
-
-G: JUMPcc ( addr opcode -- ) 1 standard-combination ;
-: (JUMPcc) HEX: 0f , , 0 4, rel-relative ;
-M: callable JUMPcc (JUMPcc) rel-word ;
-M: label JUMPcc (JUMPcc) rel-label ;
-
-: JO  HEX: 80 JUMPcc ;
-: JNO HEX: 81 JUMPcc ;
-: JB  HEX: 82 JUMPcc ;
-: JAE HEX: 83 JUMPcc ;
-: JE  HEX: 84 JUMPcc ; ! aka JZ
-: JNE HEX: 85 JUMPcc ;
-: JBE HEX: 86 JUMPcc ;
-: JA  HEX: 87 JUMPcc ;
-: JS  HEX: 88 JUMPcc ;
-: JNS HEX: 89 JUMPcc ;
-: JP  HEX: 8a JUMPcc ;
-: JNP HEX: 8b JUMPcc ;
-: JL  HEX: 8c JUMPcc ;
-: JGE HEX: 8d JUMPcc ;
-: JLE HEX: 8e JUMPcc ;
-: JG  HEX: 8f JUMPcc ;
-
-: LEAVE ( -- ) HEX: c9 , ;
-: RET ( -- ) HEX: c3 , ;
-
-! Arithmetic
-
-GENERIC: ADD ( dst src -- )
-M: integer ADD swap BIN: 000 t HEX: 81 immediate-1/4 ;
-M: operand ADD OCT: 001 2-operand ;
-
-GENERIC: OR ( dst src -- )
-M: integer OR swap BIN: 001 t HEX: 81 immediate-1/4 ;
-M: operand OR OCT: 011 2-operand ;
-
-GENERIC: ADC ( dst src -- )
-M: integer ADC swap BIN: 010 t HEX: 81 immediate-1/4 ;
-M: operand ADC OCT: 021 2-operand ;
-
-GENERIC: SBB ( dst src -- )
-M: integer SBB swap BIN: 011 t HEX: 81 immediate-1/4 ;
-M: operand SBB OCT: 031 2-operand ;
-
-GENERIC: AND ( dst src -- )
-M: integer AND swap BIN: 100 t HEX: 81 immediate-1/4 ;
-M: operand AND OCT: 041 2-operand ;
-
-GENERIC: SUB ( dst src -- )
-M: integer SUB swap BIN: 101 t HEX: 81 immediate-1/4 ;
-M: operand SUB OCT: 051 2-operand ;
-
-GENERIC: XOR ( dst src -- )
-M: integer XOR swap BIN: 110 t HEX: 81 immediate-1/4 ;
-M: operand XOR OCT: 061 2-operand ;
-
-GENERIC: CMP ( dst src -- )
-M: integer CMP swap BIN: 111 t HEX: 81 immediate-1/4 ;
-M: operand CMP OCT: 071 2-operand ;
-
-: NOT  ( dst -- ) BIN: 010 t HEX: f7 1-operand ;
-: NEG  ( dst -- ) BIN: 011 t HEX: f7 1-operand ;
-: MUL  ( dst -- ) BIN: 100 t HEX: f7 1-operand ;
-: IMUL ( src -- ) BIN: 101 t HEX: f7 1-operand ;
-: DIV  ( dst -- ) BIN: 110 t HEX: f7 1-operand ;
-: IDIV ( src -- ) BIN: 111 t HEX: f7 1-operand ;
-
-GENERIC: IMUL2 ( dst src -- )
-M: integer IMUL2 swap dup reg-code t HEX: 69 immediate-1/4 ;
-
-: CDQ HEX: 99 , ;
-: CQO HEX: 48 , CDQ ;
-
-: ROL ( dst n -- ) swap BIN: 000 t HEX: c1 immediate-1 ;
-: ROR ( dst n -- ) swap BIN: 001 t HEX: c1 immediate-1 ;
-: RCL ( dst n -- ) swap BIN: 010 t HEX: c1 immediate-1 ;
-: RCR ( dst n -- ) swap BIN: 011 t HEX: c1 immediate-1 ;
-: SHL ( dst n -- ) swap BIN: 100 t HEX: c1 immediate-1 ;
-: SHR ( dst n -- ) swap BIN: 101 t HEX: c1 immediate-1 ;
-: SAR ( dst n -- ) swap BIN: 111 t HEX: c1 immediate-1 ;
-
-! x87 Floating Point Unit
-
-: FSTPS ( operand -- ) BIN: 011 f HEX: d9 1-operand ;
-: FSTPL ( operand -- ) BIN: 011 f HEX: dd 1-operand ;
-
-: FLDS ( operand -- ) BIN: 000 f HEX: d9 1-operand ;
-: FLDL ( operand -- ) BIN: 000 f HEX: dd 1-operand ;
-
-! SSE multimedia instructions
-
-: (2-operand-sse)
-    >r 2dup t prefix HEX: 0f , r>
-    , reg-code swap addressing ;
-
-: 2-operand-sse ( dst src op1 op2 -- )
-    swap , pick register-128? [ swapd ] [ 1 bitor ] if
-    (2-operand-sse) ;
-
-: 2-operand-int/sse ( dst src op1 op2 -- )
-    swap , over register-128? [ swapd ] [ 1 bitor ] if
-    (2-operand-sse) ;
-
-: MOVSS ( dest src -- ) HEX: f3 HEX: 10 2-operand-sse ;
-: MOVSD ( dest src -- ) HEX: f2 HEX: 10 2-operand-sse ;
-: ADDSD ( dest src -- ) HEX: f2 HEX: 58 2-operand-sse ;
-: MULSD ( dest src -- ) HEX: f2 HEX: 59 2-operand-sse ;
-: SUBSD ( dest src -- ) HEX: f2 HEX: 5c 2-operand-sse ;
-: DIVSD ( dest src -- ) HEX: f2 HEX: 5e 2-operand-sse ;
-: SQRTSD ( dest src -- ) HEX: f2 HEX: 51 2-operand-sse ;
-: UCOMISD ( dest src -- ) HEX: 66 HEX: 2e 2-operand-sse ;
-: COMISD ( dest src -- ) HEX: 66 HEX: 2f 2-operand-sse ;
-: CVTSI2SD ( dest src -- ) HEX: f2 HEX: 2a 2-operand-sse ;
-: CVTSD2SI ( dest src -- ) HEX: f2 HEX: 2d 2-operand-int/sse ;
-: CVTTSD2SI ( dest src -- ) HEX: f2 HEX: 2c 2-operand-int/sse ;
diff --git a/core/compiler/x86/intrinsics.factor b/core/compiler/x86/intrinsics.factor
deleted file mode 100644 (file)
index c6735c9..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays assembler kernel kernel-internals math
-math-internals namespaces sequences words ;
-IN: compiler
-
-! Type checks
-\ tag [
-    "in" operand tag-mask AND
-    "in" operand tag-bits SHL
-] H{
-    { +input+ { { f "in" } } }
-    { +output+ { "in" } }
-} define-intrinsic
-
-\ type [
-    #! Intrinstic version of type primitive.
-    "header" define-label
-    "f" define-label
-    "end" define-label
-    ! Make a copy
-    "x" operand "obj" operand MOV
-    ! Get the tag
-    "obj" operand tag-mask AND
-    ! Compare with object tag number (3).
-    "obj" operand object-tag CMP
-    ! Jump if the object doesn't store type info in its header
-    "header" get JE
-    ! It doesn't store type info in its header
-    "obj" operand tag-bits SHL
-    "end" get JMP
-    "header" resolve-label
-    ! It does store type info in its header
-    ! Is the pointer itself equal to 3? Then its F_TYPE (9).
-    "x" operand object-tag CMP
-    "f" get JE
-    ! The pointer is not equal to 3. Load the object header.
-    "obj" operand "x" operand object-tag neg [+] MOV
-    ! Mask off header tag, making a fixnum.
-    "obj" operand object-tag XOR
-    "end" get JMP
-    "f" resolve-label
-    ! The pointer is equal to 3. Load F_TYPE (9).
-    "obj" operand f type tag-bits shift MOV
-    "end" resolve-label
-] H{
-    { +input+ { { f "obj" } } }
-    { +scratch+ { { f "x" } { f "y" } } }
-    { +output+ { "obj" } }
-} define-intrinsic
-
-! Slots
-: %untag ( reg -- ) tag-mask bitnot AND ;
-
-\ slot [
-    "obj" operand %untag
-    ! turn tagged fixnum slot # into an offset, multiple of 4
-    "n" operand fixnum>slot@
-    ! compute slot address
-    "obj" operand "n" operand ADD
-    ! load slot value
-    "obj" operand dup [] MOV
-] H{
-    { +input+ { { f "obj" } { f "n" } } }
-    { +output+ { "obj" } }
-    { +clobber+ { "n" } }
-} define-intrinsic
-
-: generate-write-barrier ( -- )
-    #! Mark the card pointed to by vreg.
-    "obj" operand card-bits SHR
-    "obj" operand HEX: ffff ADD rel-absolute-cell rel-cards
-    "obj" operand [] card-mark OR ;
-
-\ set-slot [
-    "obj" operand %untag
-    ! turn tagged fixnum slot # into an offset
-    "slot" operand fixnum>slot@
-    ! compute slot address
-    "slot" operand "obj" operand ADD
-    ! store new slot value
-    "slot" operand [] "val" operand MOV
-    generate-write-barrier
-] H{
-    { +input+ { { f "val" } { f "obj" } { f "slot" } } }
-    { +clobber+ { "obj" "slot" } }
-} define-intrinsic
-
-: char-reg cell 8 = RBX EBX ? ; inline
-: char-reg-16 BX ; inline
-
-\ char-slot [
-    char-reg PUSH
-    "n" operand 2 SHR
-    char-reg dup XOR
-    "obj" operand "n" operand ADD
-    char-reg-16 "obj" operand string-offset [+] MOV
-    char-reg tag-bits SHL
-    "obj" operand char-reg MOV
-    char-reg POP
-] H{
-    { +input+ { { f "n" } { f "obj" } } }
-    { +output+ { "obj" } }
-    { +clobber+ { "n" } }
-} define-intrinsic
-
-\ set-char-slot [
-    char-reg PUSH
-    "val" operand tag-bits SHR
-    "slot" operand 2 SHR
-    "obj" operand "slot" operand ADD
-    char-reg "val" operand MOV
-    "obj" operand string-offset [+] char-reg-16 MOV
-    char-reg POP
-] H{
-    { +input+ { { f "val" } { f "slot" } { f "obj" } } }
-    { +clobber+ { "val" "slot" "obj" } }
-} define-intrinsic
-
-! Fixnums
-: define-fixnum-op ( word op -- )
-    [ [ "x" operand "y" operand ] % , ] [ ] make H{
-        { +input+ { { f "x" } { f "y" } } }
-        { +output+ { "x" } }
-    } define-intrinsic ;
-
-{
-    { fixnum+fast ADD }
-    { fixnum-fast SUB }
-    { fixnum-bitand AND }
-    { fixnum-bitor OR }
-    { fixnum-bitxor XOR }
-} [
-    first2 define-fixnum-op
-] each
-
-\ fixnum-bitnot [
-    "x" operand NOT
-    "x" operand tag-mask XOR
-] H{
-    { +input+ { { f "x" } } }
-    { +output+ { "x" } }
-} define-intrinsic
-
-! This has specific register requirements. Inputs are in
-! ECX and EAX, and the result is in EDX.
-\ fixnum-mod [
-    prepare-division
-    "y" operand IDIV
-] H{
-    { +input+ { { 0 "x" } { 1 "y" } } }
-    { +scratch+ { { 2 "out" } } }
-    { +output+ { "out" } }
-} define-intrinsic
-
-: %untag-fixnums ( seq -- )
-    [ tag-bits SAR ] unique-operands ;
-
-: simple-overflow ( word -- )
-    "end" define-label
-    "z" operand "x" operand MOV
-    "z" operand "y" operand pick execute
-    ! If the previous arithmetic operation overflowed, then we
-    ! turn the result into a bignum and leave it in EAX.
-    "end" get JNO
-    ! There was an overflow. Recompute the original operand.
-    { "y" "x" } %untag-fixnums
-    "x" operand "y" operand rot execute
-    "z" operand "x" operand %allot-bignum-signed-1
-    "end" resolve-label ; inline
-
-: simple-overflow-template ( word insn -- )
-    [ simple-overflow ] curry H{
-        { +input+ { { f "x" } { f "y" } } }
-        { +scratch+ { { f "z" } } }
-        { +output+ { "z" } }
-        { +clobber+ { "x" "y" } }
-    } define-intrinsic ;
-
-\ fixnum+ \ ADD simple-overflow-template
-\ fixnum- \ SUB simple-overflow-template
-
-: %tag-overflow ( -- )
-    #! Tag a cell-size value, where the tagging might posibly
-    #! overflow BUT IT MUST NOT EXCEED cell-2 BITS
-    "y" operand "x" operand MOV ! Make a copy
-    "x" operand 1 tag-bits shift IMUL2 ! Tag it
-    "end" get JNO ! Overflow?
-    "x" operand "y" operand %allot-bignum-signed-1 ! Yes, box bignum
-    ;
-
-! \ fixnum* [
-!     "overflow-1" define-label
-!     "overflow-2" define-label
-!     "end" define-label
-!     { "y" "x" } %untag-fixnums
-!     "y" operand IMUL
-!     "overflow-1" get JNO
-!     "x" operand "r" operand %allot-bignum-signed-2
-!     "end" get JMP
-!     "overflow-1" resolve-label
-!     %tag-overflow
-!     "end" resolve-label
-! ] H{
-!     { +input+ { { 0 "x" } { 1 "y" } } }
-!     { +output+ { "x" } }
-!     { +scratch+ { { 2 "r" } } }
-!     { +clobber+ { "y" } }
-! } define-intrinsic
-
-: generate-fixnum/mod
-    #! The same code is used for fixnum/i and fixnum/mod.
-    #! This has specific register
-    #! ECX and EAX, and the result is in EDX.
-    "end" define-label
-    prepare-division
-    "y" operand IDIV
-    %tag-overflow
-    "end" resolve-label ;
-
-\ fixnum/i [ generate-fixnum/mod ] H{
-    { +input+ { { 0 "x" } { 1 "y" } } }
-    { +scratch+ { { 2 "r" } } }
-    { +output+ { "x" } }
-    { +clobber+ { "x" "y" } }
-} define-intrinsic
-
-\ fixnum/mod [ generate-fixnum/mod ] H{
-    { +input+ { { 0 "x" } { 1 "y" } } }
-    { +scratch+ { { 2 "r" } } }
-    { +output+ { "x" "r" } }
-    { +clobber+ { "x" "y" } }
-} define-intrinsic
-
-: define-fixnum-jump ( word op -- )
-    [ "x" operand "y" operand CMP ] swap add
-    { { f "x" } { f "y" } } define-if-intrinsic ;
-
-{
-    { fixnum< JL }
-    { fixnum<= JLE }
-    { fixnum> JG }
-    { fixnum>= JGE }
-    { eq? JE }
-} [
-    first2 define-fixnum-jump
-] each
-
-\ fixnum>bignum [
-    "nonzero" define-label
-    "end" define-label
-    "x" operand 0 CMP ! is it zero?
-    "nonzero" get JNE
-    0 >bignum "x" get load-literal
-    "end" get JMP
-    "nonzero" resolve-label
-    "x" operand tag-bits SAR
-    "x" operand dup %allot-bignum-signed-1
-    "end" resolve-label
-] H{
-    { +input+ { { f "x" } } }
-    { +output+ { "x" } }
-} define-intrinsic
-
-\ bignum>fixnum [
-    "nonzero" define-label
-    "positive" define-label
-    "end" define-label
-    "x" operand %untag
-    "y" operand "x" operand cell [+] MOV
-     ! if the length is 1, its just the sign and nothing else,
-     ! so output 0
-    "y" operand 1 tag-bits shift CMP
-    "nonzero" get JNE
-    "y" operand 0 MOV
-    "end" get JMP
-    "nonzero" resolve-label
-    ! load the value
-    "y" operand "x" operand 3 cells [+] MOV
-    ! load the sign
-    "x" operand "x" operand 2 cells [+] MOV
-    ! is the sign negative?
-    "x" operand 0 CMP
-    "positive" get JE
-    "y" operand -1 IMUL2
-    "positive" resolve-label
-    "y" operand 3 SHL
-    "end" resolve-label
-] H{
-    { +input+ { { f "x" } } }
-    { +scratch+ { { f "y" } } }
-    { +clobber+ { "x" } }
-    { +output+ { "y" } }
-} define-intrinsic
-
-! User environment
-: %userenv ( -- )
-    "x" operand 0 MOV
-    "userenv" f rel-absolute-cell rel-dlsym
-    "n" operand fixnum>slot@
-    "n" operand "x" operand ADD ;
-
-\ getenv [
-    %userenv  "n" operand dup [] MOV
-] H{
-    { +input+ { { f "n" } } }
-    { +scratch+ { { f "x" } } }
-    { +output+ { "n" } }
-} define-intrinsic
-
-\ setenv [
-    %userenv  "n" operand [] "val" operand MOV
-] H{
-    { +input+ { { f "val" } { f "n" } } }
-    { +scratch+ { { f "x" } } }
-    { +clobber+ { "n" } }
-} define-intrinsic
diff --git a/core/compiler/x86/load.factor b/core/compiler/x86/load.factor
deleted file mode 100644 (file)
index 1742ade..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-PROVIDE: core/compiler/x86
-{ +files+ {
-    "assembler.factor"
-    "architecture.factor"
-    "allot.factor"
-    "intrinsics.factor"
-} } ;
diff --git a/core/continuations.factor b/core/continuations.factor
deleted file mode 100644 (file)
index df4ecdb..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: kernel-internals
-USING: vectors ;
-
-: catchstack* ( -- catchstack )
-    6 getenv { vector } declare ; inline
-
-IN: errors
-USING: kernel kernel-internals ;
-
-: catchstack ( -- catchstack ) catchstack* clone ; inline
-: set-catchstack ( catchstack -- ) >vector 6 setenv ; inline
-
-IN: kernel
-USING: arrays namespaces sequences ;
-
-TUPLE: continuation data retain call name catch ;
-
-: continuation ( -- continuation )
-    datastack retainstack callstack namestack catchstack
-    <continuation> ; inline
-
-: >continuation< ( continuation -- data retain call name catch )
-    [ continuation-data ] keep
-    [ continuation-retain ] keep
-    [ continuation-call ] keep
-    [ continuation-name ] keep
-    continuation-catch ; inline
-
-: ifcc ( terminator balance -- )
-    >r >r f [ continuation nip t ] call r> r> if ; inline
-
-: callcc0 ( quot -- ) [ ] ifcc ; inline
-
-: callcc1 ( quot -- obj ) callcc0 ; inline
-
-DEFER: continue-with
-
-: set-walker-hook 2 setenv ; inline
-
-: get-walker-hook 2 getenv f set-walker-hook ; inline
-
-: (continue) ( continuation -- )
-    >continuation<
-    set-catchstack
-    set-namestack
-    set-callstack
-    set-retainstack
-    set-datastack ; inline
-
-: (continue-with) ( obj continuation -- )
-    #! There's no good way to avoid this code duplication!
-    swap 9 setenv
-    >continuation<
-    set-catchstack
-    set-namestack
-    set-callstack
-    set-retainstack
-    set-datastack
-    9 getenv swap ; inline
-
-: continue ( continuation -- )
-    get-walker-hook [ (continue-with) ] [ (continue) ] if* ;
-    inline
-
-: continue-with ( obj continuation -- )
-    get-walker-hook [ >r 2array r> ] when* (continue-with) ;
-    inline
-
-M: continuation clone
-    [ continuation-data clone ] keep
-    [ continuation-retain clone ] keep
-    [ continuation-call clone ] keep
-    [ continuation-name clone ] keep
-    continuation-catch clone <continuation> ;
diff --git a/core/continuations.facts b/core/continuations.facts
deleted file mode 100644 (file)
index 938e1fa..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-USING: errors help kernel kernel-internals ;
-
-HELP: catchstack*
-{ $values { "catchstack" "a vector" } }
-{ $description "Outputs the current catchstack." } ;
-
-HELP: catchstack
-{ $values { "catchstack" "a vector" } }
-{ $description "Outputs a copy of the current catchstack." } ;
-
-HELP: set-catchstack
-{ $values { "catchstack" "a vector" } }
-{ $description "Replaces the catchstack with a copy of the given vector." } ;
-
-HELP: continuation
-{ $values { "continuation" "a continuation" } }
-{ $description "Reifies the current continuation from the point immediately after which the caller returns." } ;
-
-HELP: >continuation<
-{ $values { "continuation" "a continuation" } { "data" "a vector" } { "retain" "a vector" } { "call" "a vector" } { "name" "a vector" } { "catch" "a vector" } }
-{ $description "Takes a continuation apart into its four constituents." } ;
-
-HELP: ifcc
-{ $values { "terminator" "a quotation with stack effect " { $snippet "( continuation -- )" } } { "balance" "a quotation" } }
-{ $description "Reifies a continuation from the point immediately after which the caller returns, and passes it to " { $snippet "terminator" } ". When the continuation is restored, execution resumes; " { $snippet "terminator" } " is still on the stack and "{ $snippet "balance" } " is called." }
-{ $see-also callcc0 callcc1 } ;
-
-HELP: callcc0
-{ $values { "quot" "a quotation with stack effect " { $snippet "( continuation -- )" } } }
-{ $description "Applies the quotation to the current continuation, which is reified from the point immediately after which the caller returns. The " { $link continue } " word resumes the continuation." }
-{ $see-also ifcc callcc1 continue } ;
-
-HELP: callcc1
-{ $values { "quot" "a quotation with stack effect " { $snippet "( continuation -- )" } } { "obj" "an object provided when resuming the continuation" } }
-{ $description "Applies the quotation to the current continuation, which is reified from the point immediately after which the caller returns. The " { $link continue-with } " word resumes the continuation, passing a value back to the original execution context." }
-{ $see-also ifcc callcc0 continue-with } ;
-
-HELP: continue
-{ $values { "continuation" "a continuation" } }
-{ $description "Resumes a continuation reified by " { $link callcc0 } "." } ;
-
-HELP: continue-with
-{ $values { "obj" "an object to pass to the continuation's execution context" } { "continuation" "a continuation" } }
-{ $description "Resumes a continuation reified by " { $link callcc1 } ". The object remains on the stack when the continuation resumes executing." } ;
diff --git a/core/continuations/authors.txt b/core/continuations/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/continuations/continuations-docs.factor b/core/continuations/continuations-docs.factor
new file mode 100644 (file)
index 0000000..16752d3
--- /dev/null
@@ -0,0 +1,225 @@
+USING: help.markup help.syntax kernel kernel.private
+continuations.private parser vectors arrays namespaces
+threads assocs words quotations ;
+IN: continuations
+
+ARTICLE: "errors-restartable" "Restartable error handling"
+"Support for restartable errors is built on top of the basic error handling facility. The following words signals recoverable errors:"
+{ $subsection throw-restarts }
+{ $subsection rethrow-restarts }
+"The list of restarts from the most recently-thrown error is stored in a global variable:"
+{ $subsection restarts }
+"To invoke restarts, see " { $link "debugger" } "." ;
+
+ARTICLE: "errors-post-mortem" "Post-mortem error inspection"
+"The most recently thrown error, together with the continuation at that point, are stored in a pair of global variables:"
+{ $subsection error }
+{ $subsection error-continuation }
+"Developer tools for inspecting these values are found in " { $link "debugger" } "." ;
+
+ARTICLE: "errors" "Error handling"
+"Support for handling exceptional situations such as bad user input, implementation bugs, and input/output errors is provided by a set of words built using continuations."
+$nl
+"Two words raise an error in the innermost error handler for the current dynamic extent:"
+{ $subsection throw }
+{ $subsection rethrow }
+"A set of words establish an error handler:"
+{ $subsection cleanup }
+{ $subsection recover }
+{ $subsection catch }
+"Unhandled errors are reported in the listener and can be debugged using various tools. See " { $link "debugger" } "."
+{ $subsection "errors-restartable" }
+{ $subsection "errors-post-mortem" } ;
+
+ARTICLE: "continuations.private" "Continuation implementation details"
+"A continuation is simply a tuple holding the contents of the five stacks:"
+{ $subsection continuation }
+{ $subsection >continuation< }
+"The five stacks can be read and written:"
+{ $subsection datastack }
+{ $subsection set-datastack }
+{ $subsection retainstack }
+{ $subsection set-retainstack }
+{ $subsection callstack }
+{ $subsection set-callstack }
+{ $subsection namestack }
+{ $subsection set-namestack }
+{ $subsection catchstack }
+{ $subsection set-catchstack }
+"The continuations implementation has hooks for single-steppers:"
+{ $subsection walker-hook }
+{ $subsection set-walker-hook }
+{ $subsection (continue) }
+{ $subsection (continue-with) } ;
+
+ARTICLE: "continuations" "Continuations"
+"At any point in the execution of a program, the " { $emphasis "current continuation" } " represents the future of the computation."
+$nl
+"Words for working with continuations are found in the " { $vocab-link "continuations" } " vocabulary; implementation details are in " { $vocab-link "continuations.private" } "."
+$nl
+"Continuations can be reified with the following two words:"
+{ $subsection callcc0 }
+{ $subsection callcc1 }
+"Another two words resume continuations:"
+{ $subsection continue }
+{ $subsection continue-with }
+"Continuations serve as the building block for a number of higher-level abstractions."
+{ $subsection "errors" }
+{ $subsection "continuations.private" } ;
+
+ABOUT: "continuations"
+
+HELP: catchstack*
+{ $values { "catchstack" "a vector of continuations" } }
+{ $description "Outputs the current catchstack." } ;
+
+HELP: catchstack
+{ $values { "catchstack" "a vector of continuations" } }
+{ $description "Outputs a copy of the current catchstack." } ;
+
+HELP: set-catchstack
+{ $values { "catchstack" "a vector of continuations" } }
+{ $description "Replaces the catchstack with a copy of the given vector." } ;
+
+HELP: continuation
+{ $values { "continuation" continuation } }
+{ $description "Reifies the current continuation from the point immediately after which the caller returns." } ;
+
+HELP: >continuation<
+{ $values { "continuation" continuation } { "data" vector } { "retain" vector } { "call" vector } { "name" vector } { "catch" vector } { "c" array } }
+{ $description "Takes a continuation apart into its constituents." } ;
+
+HELP: ifcc0
+{ $values { "capture" "a quotation with stack effect " { $snippet "( continuation -- )" } } { "restore" quotation } }
+{ $description "Reifies a continuation from the point immediately after which this word returns, and passes it to " { $snippet "capture" } ". When the continuation is restored, execution resumes and "{ $snippet "restore" } " is called." } ;
+
+HELP: ifcc1
+{ $values { "capture" "a quotation with stack effect " { $snippet "( continuation -- )" } } { "restore" quotation } }
+{ $description "Reifies a continuation from the point immediately after which this word returns, and passes it to " { $snippet "capture" } ". When the continuation is restored, execution resumes and "{ $snippet "restore" } " is called." } ;
+
+{ callcc0 continue callcc1 continue-with ifcc0 ifcc1 } related-words
+
+HELP: callcc0
+{ $values { "quot" "a quotation with stack effect " { $snippet "( continuation -- )" } } }
+{ $description "Applies the quotation to the current continuation, which is reified from the point immediately after which the caller returns. The " { $link continue } " word resumes the continuation." } ;
+
+HELP: callcc1
+{ $values { "quot" "a quotation with stack effect " { $snippet "( continuation -- )" } } { "obj" "an object provided when resuming the continuation" } }
+{ $description "Applies the quotation to the current continuation, which is reified from the point immediately after which the caller returns. The " { $link continue-with } " word resumes the continuation, passing a value back to the original execution context." } ;
+
+HELP: set-walker-hook
+{ $values { "quot" "a quotation with stack effect " { $snippet "( continuation -- )" } ", or " { $link f } } }
+{ $description "Sets a quotation to be called when a continuation is resumed." }
+{ $notes "The single-stepper uses this hook to support single-stepping through code which makes use of continuations." } ;
+
+HELP: walker-hook
+{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } ", or " { $link f } } }
+{ $description "Outputs a quotation to be called when a continuation is resumed, or " { $link f } " if no hook is set. If a hook was set prior to this word being called, it will be reset to " { $link f } "."
+$nl
+"The following words do not perform their usual action and instead just call the walker hook if one is set:"
+    { $list
+        { { $link callcc0 } " will call the hook, passing it the continuation to resume." }
+        { { $link callcc1 } " will call the hook, passing it a " { $snippet "{ obj continuation }" } " pair." }
+        { { $link stop } " will call the hook, passing it " { $link f } "." }
+    }
+"The walker hook must take appropriate action so that the callers of these words see the behavior that they expect." }
+{ $notes "The single-stepper uses this hook to support single-stepping through code which makes use of continuations." } ;
+
+HELP: (continue)
+{ $values { "continuation" continuation } }
+{ $description "Resumes a continuation reified by " { $link callcc0 } " without invoking " { $link walker-hook } "." } ;
+
+HELP: (continue-with)
+{ $values { "obj" "an object to pass to the continuation's execution context" } { "continuation" continuation } }
+{ $description "Resumes a continuation reified by " { $link callcc1 } " without invoking " { $link walker-hook } ". The object will be placed on the data stack when the continuation resumes." } ;
+
+HELP: continue
+{ $values { "continuation" continuation } }
+{ $description "Resumes a continuation reified by " { $link callcc0 } "." } ;
+
+HELP: continue-with
+{ $values { "obj" "an object to pass to the continuation's execution context" } { "continuation" continuation } }
+{ $description "Resumes a continuation reified by " { $link callcc1 } ". The object will be placed on the data stack when the continuation resumes." } ;
+
+HELP: error
+{ $description "Global variable holding most recently thrown error." }
+{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
+
+HELP: error-continuation
+{ $description "Global variable holding current continuation of most recently thrown error." }
+{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
+
+HELP: restarts
+{ $var-description "Global variable holding the set of possible restarts for the most recently thrown error." }
+{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
+
+HELP: >c
+{ $values { "continuation" continuation } }
+{ $description "Pushes an exception handler continuation on the catch stack. The continuation must have been reified by " { $link callcc1 } "." } ;
+
+HELP: c>
+{ $values { "continuation" continuation } }
+{ $description "Pops an exception handler continuation from the catch stack." } ;
+
+HELP: throw
+{ $values { "error" object } }
+{ $description "Saves the current continuation in the " { $link error-continuation } " global variable and throws an error. Execution does not continue at the point after the " { $link throw } " call. Rather, the innermost catch block is invoked, and execution continues at that point." } ;
+
+HELP: catch
+{ $values { "try" quotation } { "error/f" object } }
+{ $description "Calls the " { $snippet "try" } " quotation. If an error is thrown in the dynamic extent of the quotation, restores the data stack and pushes the error. If the quotation returns successfully, outputs " { $link f } " without restoring the data stack." }
+{ $notes "This word cannot differentiate between the case of " { $link f } " being thrown, and no error being thrown. You should never throw " { $link f } ", and you should also use other error handling combinators where possible." } ;
+
+{ catch cleanup recover } related-words
+
+HELP: cleanup
+{ $values { "try" quotation } { "cleanup-always" quotation } { "cleanup-error" quotation } }
+{ $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" "a quotation with stack effect " { $snippet "( error -- )" } } }
+{ $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: rethrow
+{ $values { "error" object } }
+{ $description "Throws an error without saving the current continuation in the " { $link error-continuation } " global variable. This is done so that inspecting the error stacks sheds light on the original cause of the exception, rather than the point where it was rethrown." }
+{ $notes
+    "This word is intended to be used in conjunction with " { $link recover } " or " { $link catch } " to implement error handlers which perform an action and pass the error to the next outermost error handler."
+}
+{ $examples
+    "The " { $link with-parser } " catches errors, annotates them with file name and line number information, and rethrows them:"
+    { $see with-parser }
+} ;
+
+HELP: throw-restarts
+{ $values { "error" object } { "restarts" "a sequence of " { $snippet "{ string object }" } " pairs" } { "restart" object } }
+{ $description "Throws a restartable error using " { $link throw } ". The " { $snippet "restarts" } " parameter is a sequence of pairs where the first element in each pair is a human-readable description and the second is an arbitrary object. If the error reaches the top-level error handler, the user will be presented with the list of possible restarts, and upon invoking one, execution will continue after the call to " { $link condition } " with the object associated to the chosen restart on the stack." }
+{ $examples
+    "Try invoking one of the two restarts which are offered after the below code throws an error:"
+    { $code
+        ": restart-test"
+        "    \"Oops!\" { { \"One\" 1 } { \"Two\" 2 } } condition"
+        "    \"You restarted: \" write . ;"
+        "restart-test"
+    }
+} ;
+
+HELP: rethrow-restarts
+{ $values { "error" object } { "restarts" "a sequence of " { $snippet "{ string object }" } " pairs" } { "restart" object } }
+{ $description "Throws a restartable error using " { $link rethrow } ". Otherwise, this word is identical to " { $link throw-restarts } "." } ;
+
+{ throw rethrow throw-restarts rethrow-restarts } related-words
+
+HELP: compute-restarts
+{ $values { "error" object } { "seq" "a sequence" } }
+{ $description "Outputs a sequence of triples, where each triple consists of a human-readable string, an object, and a continuation. Resuming a continuation with the corresponding object restarts execution immediately after the corresponding call to " { $link condition } "."
+$nl
+"This word recursively travels up the delegation chain to collate restarts from nested and wrapped conditions." } ;
+
+HELP: save-error
+{ $values { "error" "an error" } }
+{ $description "Called by the error handler to set the " { $link error } " and " { $link restarts } " global variables after an error was thrown." }
+$low-level-note ;
+
+HELP: init-error-handler
+{ $description "Called on startup to initialize the catch stack and set a pair of hooks which allow the Factor VM to signal errors to library code." } ;
diff --git a/core/continuations/continuations-tests.factor b/core/continuations/continuations-tests.factor
new file mode 100644 (file)
index 0000000..602efe9
--- /dev/null
@@ -0,0 +1,70 @@
+USING: kernel math namespaces io tools.test sequences vectors
+continuations debugger parser memory arrays ;
+IN: temporary
+
+! [ "hello" ] [
+!     [
+!         callstack [ set-callstack ] curry [ ] like -1 2array
+!         array>callstack set-callstack
+!     ] call "hello"
+! ] unit-test
+
+: (callcc1-test)
+    swap 1- tuck swap ?push
+    over 0 = [ "test-cc" get continue-with ] when
+    (callcc1-test) ;
+
+: callcc1-test ( x -- list )
+    [
+        "test-cc" set V{ } clone (callcc1-test)
+    ] callcc1 nip ;
+
+: callcc-namespace-test ( -- ? )
+    [
+        "test-cc" set
+        5 "x" set
+        [
+            6 "x" set "test-cc" get continue
+        ] with-scope
+    ] callcc0 "x" get 5 = ;
+
+[ t ] [ 10 callcc1-test 10 reverse >vector = ] unit-test
+[ t ] [ callcc-namespace-test ] unit-test
+
+[ f ] [ [ ] catch ] unit-test
+
+[ 5 ] [ [ 5 throw ] catch ] unit-test
+
+[ t ] [
+    [ "Hello" throw ] catch drop
+    global [ error get ] bind
+    "Hello" =
+] unit-test
+
+"!!! The following error is part of the test" print
+
+[ ] [ [ 6 [ 12 [ "2 car" ] ] ] print-error ] unit-test
+
+"!!! The following error is part of the test" print
+
+[ [ "2 car" ] parse ] catch print-error
+
+[ f throw ] unit-test-fails
+
+! Weird PowerPC bug.
+[ ] [
+    [ "4" throw ] catch drop
+    data-gc
+    data-gc
+] unit-test
+
+[ f ] [ { } kernel-error? ] unit-test
+[ f ] [ { "A" "B" } kernel-error? ] unit-test
+
+! ! See how well callstack overflow is handled
+! [ clear drop ] unit-test-fails
+! 
+! : callstack-overflow callstack-overflow f ;
+! [ callstack-overflow ] unit-test-fails
+! 
+! 
diff --git a/core/continuations/continuations.factor b/core/continuations/continuations.factor
new file mode 100644 (file)
index 0000000..063b9e7
--- /dev/null
@@ -0,0 +1,176 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays vectors kernel kernel.private sequences
+namespaces tuples math splitting sorting quotations assocs ;
+IN: continuations
+
+SYMBOL: error
+SYMBOL: error-continuation
+SYMBOL: restarts
+
+<PRIVATE
+
+: catchstack* ( -- catchstack )
+    1 getenv { vector } declare ; inline
+
+: >c ( continuation -- ) catchstack* push ;
+
+: c> ( -- continuation ) catchstack* pop ;
+
+: (catch) ( quot -- newquot )
+    [ swap >c call c> drop ] curry ; inline
+
+: (callcc1) 4 getenv f 4 setenv ; inline
+
+PRIVATE>
+
+: catchstack ( -- catchstack ) catchstack* clone ; inline
+
+: set-catchstack ( catchstack -- ) >vector 1 setenv ; inline
+
+TUPLE: continuation data call retain name catch ;
+
+C: <continuation> continuation
+
+: continuation ( -- continuation )
+    datastack callstack retainstack namestack catchstack
+    <continuation> ;
+
+: >continuation< ( continuation -- data call retain name catch )
+    {
+        continuation-data
+        continuation-call
+        continuation-retain
+        continuation-name
+        continuation-catch
+    } get-slots ;
+
+: ifcc0 ( capture restore -- )
+    #! After continuation is being captured, the stacks looks
+    #! like:
+    #! ( continuation r:capture r:restore )
+    #! so the 'capture' branch is taken.
+    #!
+    #! Note that the continuation itself is not captured as part
+    #! of the datastack.
+    #!
+    #! BUT...
+    #!
+    #! After the continuation is resumed, (continue) pushes f,
+    #! so now, the stacks looks like:
+    #! ( f r:capture r:restore )
+    #! Execution begins right after the call to 'continuation'.
+    #! The 'restore' branch is taken.
+    >r >r continuation r> r> if* ; inline
+
+: ifcc1 ( capture restore -- )
+    [ (callcc1) ] swap compose ifcc0 ; inline
+
+: callcc0 ( quot -- ) [ ] ifcc0 ; inline
+
+: callcc1 ( quot -- obj ) [ ] ifcc1 ; inline
+
+: set-walker-hook ( quot -- ) 3 setenv ; inline
+
+: walker-hook ( -- quot ) 3 getenv f set-walker-hook ; inline
+
+<PRIVATE
+
+: (continue) ( continuation -- )
+    >continuation<
+    set-catchstack
+    set-namestack
+    set-retainstack
+    >r set-datastack f r>
+    set-callstack ;
+
+: (continue-with) ( obj continuation -- )
+    swap 4 setenv (continue) ;
+
+PRIVATE>
+
+: continue ( continuation -- )
+    [
+        walker-hook [ (continue-with) ] [ (continue) ] if*
+    ] curry (throw) ;
+
+: continue-with ( obj continuation -- )
+    [
+        walker-hook [ >r 2array r> ] when* (continue-with)
+    ] 2curry (throw) ;
+
+GENERIC: compute-restarts ( error -- seq )
+
+<PRIVATE
+
+: save-error ( error -- )
+    dup error set-global
+    compute-restarts restarts set-global ;
+
+PRIVATE>
+
+: rethrow ( error -- * )
+    catchstack* empty? [ die ] when
+    dup save-error c> continue-with ;
+
+: catch ( try -- error/f )
+    (catch) [ f ] compose callcc1 ; inline
+
+: recover ( try recovery -- )
+    >r (catch) r> ifcc1 ; inline
+
+: cleanup ( try cleanup-always cleanup-error -- )
+    >r [ compose (catch) ] keep r> compose
+    [ dip rethrow ] curry ifcc1 ; inline
+
+: attempt-all ( seq quot -- obj )
+    [
+        [ [ , f ] compose [ , drop t ] recover ] curry all?
+    ] { } make peek swap [ rethrow ] when ; inline
+
+TUPLE: condition restarts continuation ;
+
+: <condition> ( error restarts cc -- condition )
+    {
+        set-delegate
+        set-condition-restarts
+        set-condition-continuation
+    } condition construct ;
+
+: throw-restarts ( error restarts -- restart )
+    [ <condition> throw ] callcc1 2nip ;
+
+: rethrow-restarts ( error restarts -- restart )
+    [ <condition> rethrow ] callcc1 2nip ;
+
+TUPLE: restart name obj continuation ;
+
+C: <restart> restart
+
+: restart ( restart -- )
+    dup restart-obj swap restart-continuation continue-with ;
+
+M: object compute-restarts drop { } ;
+
+M: tuple compute-restarts delegate compute-restarts ;
+
+M: condition compute-restarts
+    [ delegate compute-restarts ] keep
+    [ condition-restarts ] keep
+    condition-continuation
+    [ <restart> ] curry { } assoc>map
+    append ;
+
+<PRIVATE
+
+: init-error-handler ( -- )
+    V{ } clone set-catchstack
+    ! VM calls on error
+    [
+        continuation error-continuation set-global rethrow
+    ] 5 setenv
+    ! VM adds this to kernel errors, so that user-space
+    ! can identify them
+    "kernel-error" 6 setenv ;
+
+PRIVATE>
diff --git a/core/continuations/summary.txt b/core/continuations/summary.txt
new file mode 100644 (file)
index 0000000..f8980d7
--- /dev/null
@@ -0,0 +1 @@
+Capturing and restorating continuations, catching errors
diff --git a/core/continuations/tags.txt b/core/continuations/tags.txt
new file mode 100644 (file)
index 0000000..abf53a4
--- /dev/null
@@ -0,0 +1 @@
+reflection
diff --git a/core/cpu/architecture/architecture.factor b/core/cpu/architecture/architecture.factor
new file mode 100644 (file)
index 0000000..e501d54
--- /dev/null
@@ -0,0 +1,208 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic kernel kernel.private math memory
+namespaces sequences layouts system hashtables classes alien
+byte-arrays bit-arrays float-arrays combinators words ;
+IN: cpu.architecture
+
+SYMBOL: compiler-backend
+
+! A pseudo-register class for parameters spilled on the stack
+TUPLE: stack-params ;
+
+! Return values of this class go here
+GENERIC: return-reg ( register-class -- reg )
+
+! Sequence of registers used for parameter passing in class
+GENERIC: param-regs ( register-class -- regs )
+
+GENERIC: param-reg ( n register-class -- reg )
+
+M: object param-reg param-regs nth ;
+
+! Sequence mapping vreg-n to native assembler registers
+GENERIC: vregs ( register-class -- regs )
+
+! Load a literal (immediate or indirect)
+GENERIC# load-literal 1 ( obj vreg -- )
+
+HOOK: load-indirect compiler-backend ( obj reg -- )
+
+HOOK: stack-frame compiler-backend ( frame-size -- n )
+
+: stack-frame* ( -- n )
+    \ stack-frame get stack-frame ;
+
+! Set up caller stack frame
+HOOK: %prologue compiler-backend ( n -- )
+
+: %prologue-later \ %prologue-later , ;
+
+! Tear down stack frame
+HOOK: %epilogue compiler-backend ( n -- )
+
+: %epilogue-later \ %epilogue-later , ;
+
+! Bump profiling counter
+HOOK: %profiler-prologue compiler-backend ( word -- )
+
+! Store word XT in stack frame
+HOOK: %save-xt compiler-backend ( -- )
+
+! Call another label
+HOOK: %call-label compiler-backend ( label -- )
+
+! Call C primitive
+HOOK: %call-primitive compiler-backend ( label -- )
+
+! Local jump for branches
+HOOK: %jump-label compiler-backend ( label -- )
+
+! Far jump to C primitive
+HOOK: %jump-primitive compiler-backend ( label -- )
+
+! Test if vreg is 'f' or not
+HOOK: %jump-t compiler-backend ( label -- )
+
+! We pass the offset of the jump table start in the world table
+HOOK: %call-dispatch compiler-backend ( word-table# -- )
+
+HOOK: %jump-dispatch compiler-backend ( word-table# -- )
+
+! Return to caller
+HOOK: %return compiler-backend ( -- )
+
+! Change datastack height
+HOOK: %inc-d compiler-backend ( n -- )
+
+! Change callstack height
+HOOK: %inc-r compiler-backend ( n -- )
+
+! Load stack into vreg
+GENERIC: (%peek) ( vreg loc reg-class -- )
+: %peek ( vreg loc -- ) over (%peek) ;
+
+! Store vreg to stack
+GENERIC: (%replace) ( vreg loc reg-class -- )
+: %replace ( vreg loc -- ) over (%replace) ;
+
+! Move one vreg to another
+HOOK: %move-int>int compiler-backend ( dst src -- )
+HOOK: %move-int>float compiler-backend ( dst src -- )
+HOOK: %move-float>int compiler-backend ( dst src -- )
+
+! FFI stuff
+
+! Is this integer small enough to appear in value template
+! slots?
+HOOK: small-enough? compiler-backend ( n -- ? )
+
+! Is this structure small enough to be returned in registers?
+HOOK: struct-small-enough? compiler-backend ( size -- ? )
+
+! Do we pass explode value structs?
+HOOK: value-structs? compiler-backend ( -- ? )
+
+! If t, fp parameters are shadowed by dummy int parameters
+HOOK: fp-shadows-int? compiler-backend ( -- ? )
+
+HOOK: %prepare-unbox compiler-backend ( -- )
+
+HOOK: %unbox compiler-backend ( n reg-class func -- )
+
+HOOK: %unbox-long-long compiler-backend ( n func -- )
+
+HOOK: %unbox-small-struct compiler-backend ( size -- )
+
+HOOK: %unbox-large-struct compiler-backend ( n size -- )
+
+HOOK: %box compiler-backend ( n reg-class func -- )
+
+HOOK: %box-long-long compiler-backend ( n func -- )
+
+HOOK: %prepare-box-struct compiler-backend ( size -- )
+
+HOOK: %box-small-struct compiler-backend ( size -- )
+
+HOOK: %box-large-struct compiler-backend ( n size -- )
+
+GENERIC: %save-param-reg ( stack reg reg-class -- )
+
+GENERIC: %load-param-reg ( stack reg reg-class -- )
+
+HOOK: %prepare-alien-invoke compiler-backend ( -- )
+
+HOOK: %alien-invoke compiler-backend ( library function -- )
+
+HOOK: %cleanup compiler-backend ( alien-node -- )
+
+HOOK: %alien-callback compiler-backend ( quot -- )
+
+HOOK: %callback-value compiler-backend ( ctype -- )
+
+! Return to caller with stdcall unwinding (only for x86)
+HOOK: %unwind compiler-backend ( n -- )
+
+HOOK: %prepare-alien-indirect compiler-backend ( -- )
+
+HOOK: %alien-indirect compiler-backend ( -- )
+
+M: stack-params param-reg drop ;
+
+GENERIC: v>operand ( obj -- operand )
+
+M: integer v>operand tag-bits get shift ;
+
+M: f v>operand drop \ f tag-number ;
+
+M: object load-literal v>operand load-indirect ;
+
+PREDICATE: integer small-slot cells small-enough? ;
+
+PREDICATE: integer small-tagged v>operand small-enough? ;
+
+PREDICATE: integer inline-array 32 < ;
+
+: if-small-struct ( n size true false -- ? )
+    >r >r over not over struct-small-enough? and
+    [ nip r> call r> drop ] [ r> drop r> call ] if ;
+    inline
+
+: %unbox-struct ( n size -- )
+    [
+        %unbox-small-struct
+    ] [
+        %unbox-large-struct
+    ] if-small-struct ;
+
+: %box-struct ( n size -- )
+    [
+        %box-small-struct
+    ] [
+        %box-large-struct
+    ] if-small-struct ;
+
+! Alien accessors
+HOOK: %unbox-byte-array compiler-backend ( quot src -- ) inline
+
+HOOK: %unbox-alien compiler-backend ( quot src -- ) inline
+
+HOOK: %unbox-f compiler-backend ( quot src -- ) inline
+
+HOOK: %complex-alien-accessor compiler-backend ( quot src -- )
+inline
+
+: %alien-accessor ( quot src class -- )
+    {
+        { [ dup \ f class< ] [ drop %unbox-f ] }
+        { [ dup simple-alien class< ] [ drop %unbox-alien ] }
+        { [ dup byte-array class< ] [ drop %unbox-byte-array ] }
+        { [ dup bit-array class< ] [ drop %unbox-byte-array ] }
+        { [ dup float-array class< ] [ drop %unbox-byte-array ] }
+        { [ t ] [ drop %complex-alien-accessor ] }
+    } cond ; inline
+
+: operand ( var -- op ) get v>operand ; inline
+
+: unique-operands ( operands quot -- )
+    >r [ operand ] map prune r> each ; inline
diff --git a/core/cpu/architecture/authors.txt b/core/cpu/architecture/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/architecture/summary.txt b/core/cpu/architecture/summary.txt
new file mode 100644 (file)
index 0000000..80524d8
--- /dev/null
@@ -0,0 +1 @@
+Compiler's abstract CPU architecture description model
diff --git a/core/cpu/arm/allot/allot.factor b/core/cpu/arm/allot/allot.factor
new file mode 100644 (file)
index 0000000..ce07e1e
--- /dev/null
@@ -0,0 +1,84 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel cpu.architecture cpu.arm.assembler
+cpu.arm.architecture namespaces math math.functions sequences
+generator generator.registers generator.fixup system layouts
+alien ;
+IN: cpu.arm.allot
+
+: load-zone-ptr ( reg -- ) "nursery" f rot %alien-global ;
+
+: object@ "allot-tmp" operand swap cells <+> ;
+
+: %allot ( header size -- )
+    #! Store a pointer to 'size' bytes allocated from the
+    #! nursery in allot-tmp.
+    8 align ! align the size
+    R12 load-zone-ptr ! nusery -> r12
+    "allot-tmp" operand R12 cell <+> LDR ! nursery.here -> allot-tmp
+    "allot-tmp" operand dup pick ADD ! increment allot-tmp
+    "allot-tmp" operand R12 cell <+> STR ! allot-tmp -> nursery.here
+    "allot-tmp" operand dup rot SUB ! old value
+    R12 swap type-number tag-header MOV ! compute header
+    R12 0 object@ STR ! store header
+    ;
+    
+: %tag-allot ( tag -- )
+    "allot-tmp" operand dup rot tag-number ORR
+    "allot-tmp" get fresh-object ;
+
+: %allot-bignum ( #digits -- )
+    #! 1 cell header, 1 cell length, 1 cell sign, + digits
+    #! length is the # of digits + sign
+    bignum over 3 + cells %allot
+    R12 swap 1+ v>operand MOV ! compute the length
+    R12 1 object@ STR ! store the length
+    ;
+
+: %allot-bignum-signed-1 ( reg -- )
+    #! on entry, reg is a 30-bit quantity sign-extended to
+    #! 32-bits.
+    #! exits with tagged ptr to bignum in allot-tmp.
+    [
+        "end" define-label
+        ! is it zero?
+        dup v>operand 0 CMP
+        0 >bignum "allot-tmp" operand EQ load-indirect
+        "end" get EQ B
+        ! ! it is non-zero
+        1 %allot-bignum
+        ! is the fixnum negative?
+        dup v>operand 0 CMP
+        ! negative sign
+        R12 1 LT MOV
+        ! negate fixnum
+        dup v>operand dup 0 LT RSB
+        ! positive sign
+        R12 0 GE MOV
+        ! store sign
+        R12 2 object@ STR
+        ! store the number
+        v>operand 3 object@ STR
+        ! tag the bignum, store it in reg
+        bignum %tag-allot
+        "end" resolve-label
+    ] with-scope ;
+
+: %allot-alien ( ptr -- )
+    #! Tagged pointer to alien is in allot-tmp on exit.
+    [
+        "temp" set
+        "end" define-label
+        "temp" operand 0 CMP
+        "allot-tmp" operand f v>operand EQ MOV
+        "end" get EQ B
+        alien 4 cells %allot
+        "temp" operand 2 object@ STR
+        "temp" operand f v>operand MOV
+        "temp" operand 1 object@ STR
+        "temp" operand 0 MOV
+        "temp" operand 3 object@ STR
+        ! Store tagged ptr in reg
+        object %tag-allot
+        "end" resolve-label
+    ] with-scope ;
diff --git a/core/cpu/arm/architecture/architecture.factor b/core/cpu/arm/architecture/architecture.factor
new file mode 100644 (file)
index 0000000..5a4a2bd
--- /dev/null
@@ -0,0 +1,327 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types arrays cpu.arm.assembler compiler
+kernel kernel.private math math.functions namespaces words
+words.private generator.registers generator.fixup generator
+cpu.architecture system layouts ;
+IN: cpu.arm.architecture
+
+TUPLE: arm-backend ;
+
+! ARM register assignments:
+! R0, R1, R2, R3 integer vregs
+! R12 temporary
+! R5 data stack
+! R6 retain stack
+! R7 primitives
+
+: ds-reg R5 ; inline
+: rs-reg R6 ; inline
+
+M: temp-reg v>operand drop R12 ;
+
+M: int-regs return-reg drop R0 ;
+M: int-regs param-regs drop { R0 R1 R2 R3 } ;
+M: int-regs vregs drop { R0 R1 R2 R3 } ;
+
+! No FPU support yet
+M: float-regs param-regs drop { } ;
+M: float-regs vregs drop { } ;
+
+: <+/-> dup 0 < [ neg <-> ] [ <+> ] if ;
+
+GENERIC: loc>operand ( loc -- reg addressing )
+M: ds-loc loc>operand ds-loc-n cells neg ds-reg swap <+/-> ;
+M: rs-loc loc>operand rs-loc-n cells neg rs-reg swap <+/-> ;
+
+M: arm-backend load-indirect ( obj reg -- )
+    PC 0 <+> LDR rc-indirect-arm-pc rel-literal ;
+
+M: immediate load-literal
+    over v>operand small-enough? [
+        [ v>operand ] 2apply swap MOV
+    ] [
+        v>operand load-indirect
+    ] if ;
+
+M: arm-backend stack-frame ( n -- i ) 4 + 8 align ;
+
+M: arm-backend %prologue ( n -- )
+    LR SP 4 <-> STR
+    SP SP rot stack-frame SUB ;
+
+M: arm-backend %epilogue ( n -- )
+    SP SP rot stack-frame ADD
+    LR SP 4 <-> LDR ;
+
+: compile-dlsym ( symbol dll reg -- )
+    [
+        "end" define-label
+        ! Load target address
+        PC 0 <+> LDR
+        ! Skip an instruction
+        "end" get B
+        ! The target address
+        0 , rc-absolute rel-dlsym
+        ! Continue here
+        "end" resolve-label
+    ] with-scope ;
+
+: %alien-global ( symbol dll reg -- )
+    [ compile-dlsym ] keep dup 0 <+> LDR ;
+
+M: arm-backend %profiler-prologue ( word -- )
+    #! We can clobber R0 here since it is undefined at the start
+    #! of a word.
+    "end" define-label
+    "profiling" f R12 %alien-global
+    R12 0 CMP
+    "end" get EQ B
+    R12 load-indirect
+    R0 R12 profile-count-offset <+> LDR
+    R0 R0 1 v>operand ADD
+    R0 R12 profile-count-offset <+> STR
+    "end" resolve-label ;
+
+: primitive-addr ( word dst -- )
+    #! Load a word address into dst.
+    R7 rot word-primitive cells <+> LDR ;
+
+M: arm-backend %call ( label -- )
+    #! Far C call for primitives, near C call for compiled defs.
+    dup primitive? [ R0 primitive-addr R0 BLX ] [ BL ] if ;
+
+M: arm-backend %jump-label ( label -- )
+    #! For tail calls. IP not saved on C stack.
+    #! WARNING: don't clobber LR here!
+    dup primitive? [ PC primitive-addr ] [ B ] if ;
+
+M: arm-backend %jump-t ( label -- )
+    "flag" operand object tag-number CMP NE B ;
+
+: (%dispatch) ( word-table# reg -- )
+    #! Load jump table target address into reg.
+    "n" operand PC "n" operand 1 <LSR> ADD
+    "n" operand 0 <+> LDR
+    rc-indirect-arm rel-dispatch ;
+
+M: arm-backend %call-dispatch ( word-table# -- )
+    [
+        "scratch" operand (%dispatch)
+        "scratch" operand BLX
+    ] H{
+        { +input+ { { f "n" } } }
+        { +scratch+ { { f "scratch" } } }
+        { +clobber+ { "n" } }
+    } with-template ;
+
+M: arm-backend %jump-dispatch ( word-table# -- )
+    [
+        %epilogue-later
+        PC (%dispatch)
+    ] H{
+        { +input+ { { f "n" } } }
+        { +clobber+ { "n" } }
+    } with-template ;
+
+M: arm-backend %return ( -- ) %epilogue-later PC LR MOV ;
+
+M: arm-backend %unwind drop %return ;
+
+: (%peek/replace)
+    >r drop >r v>operand r> loc>operand r> execute ;
+
+M: int-regs (%peek) \ LDR (%peek/replace) ;
+M: int-regs (%replace) \ STR (%peek/replace) ;
+
+M: arm-backend %move-int>int ( dst src -- )
+    [ v>operand ] 2apply MOV ;
+
+: (%inc) ( n reg -- )
+    dup rot cells dup 0 < [ neg SUB ] [ ADD ] if ;
+
+M: arm-backend %inc-d ( n -- ) ds-reg (%inc) ;
+
+M: arm-backend %inc-r ( n -- ) rs-reg (%inc) ;
+
+: stack@ SP swap <+> ;
+
+M: int-regs %save-param-reg drop swap stack@ STR ;
+
+M: int-regs %load-param-reg drop swap stack@ LDR ;
+
+M: stack-params %save-param-reg
+    drop
+    R12 swap stack-frame* + stack@ LDR
+    R12 swap stack@ STR ;
+
+M: stack-params %load-param-reg
+    drop
+    R12 rot stack@ LDR
+    R12 swap stack@ STR ;
+
+M: arm-backend %prepare-unbox ( -- )
+    ! First parameter is top of stack
+    R0 R5 4 <-!> LDR ;
+
+M: arm-backend %unbox ( n reg-class func -- )
+    ! Value must be in R0.
+    ! Call the unboxer
+    f %alien-invoke
+    ! Store the return value on the C stack
+    over [ [ return-reg ] keep %save-param-reg ] [ 2drop ] if ;
+
+M: arm-backend %unbox-long-long ( n func -- )
+    ! Value must be in R0:R1.
+    ! Call the unboxer
+    f %alien-invoke
+    ! Store the return value on the C stack
+    [
+        R0 over stack@ STR
+        R1 swap cell + stack@ STR
+    ] when* ;
+
+M: arm-backend %unbox-small-struct ( size -- )
+    #! Alien must be in R0.
+    drop
+    "alien_offset" f %alien-invoke
+    ! Load first cell
+    R0 R0 0 <+> LDR ;
+
+M: arm-backend %unbox-large-struct ( n size -- )
+    #! Alien must be in R0.
+    ! Compute destination address
+    R1 SP roll ADD
+    R2 swap MOV
+    ! Copy the struct to the stack
+    "to_value_struct" f %alien-invoke ;
+
+M: arm-backend %box ( n reg-class 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.
+    >r
+    over [ 0 over param-reg swap %load-param-reg ] [ 2drop ] if
+    r> f %alien-invoke ;
+
+M: arm-backend %box-long-long ( n func -- )
+    >r [
+        R0 over stack@ LDR
+        R1 swap cell + stack@ LDR
+    ] when* r> f %alien-invoke ;
+
+M: arm-backend %box-small-struct ( size -- )
+    #! Box a 4-byte struct returned in R0.
+    R2 swap MOV
+    "box_small_struct" f %alien-invoke ;
+
+: struct-return@ ( size n -- n )
+    [
+        stack-frame* +
+    ] [
+        stack-frame* swap - cell -
+    ] ?if ;
+
+M: arm-backend %prepare-box-struct ( size -- )
+    ! Compute target address for value struct return
+    R0 SP rot f struct-return@ ADD
+    ! Store it as the first parameter
+    R0 0 stack@ STR ;
+
+M: arm-backend %box-large-struct ( n size -- )
+    ! Compute destination address
+    [ swap struct-return@ ] keep
+    R0 SP roll ADD
+    R1 swap MOV
+    ! Copy the struct from the C stack
+    "box_value_struct" f %alien-invoke ;
+
+M: arm-backend struct-small-enough? ( size -- ? )
+    wince? [ drop f ] [ 4 <= ] if ;
+
+M: arm-backend %alien-invoke ( symbol dll -- )
+    ! Load target address
+    R12 PC 4 <+> LDR
+    ! Store address of next instruction in LR
+    LR PC 4 ADD
+    ! Jump to target address
+    R12 BX
+    ! The target address
+    0 , rc-absolute rel-dlsym ;
+
+: temp@ SP stack-frame* 2 cells - <+> ;
+
+M: arm-backend %prepare-alien-indirect ( -- )
+    "unbox_alien" f %alien-invoke
+    R0 temp@ STR ;
+
+M: arm-backend %alien-indirect ( -- )
+    IP temp@ LDR
+    IP BLX ;
+
+M: arm-backend %alien-callback ( quot -- )
+    R0 load-indirect
+    "run_callback" f %alien-invoke ;
+
+M: arm-backend %callback-value ( ctype -- )
+    ! Save top of data stack
+    %prepare-unbox
+    R0 temp@ STR
+    ! Restore data/call/retain stacks
+    "unnest_stacks" f %alien-invoke
+    ! Place former top of data stack in R0
+    R0 temp@ LDR
+    ! Unbox R0
+    unbox-return ;
+
+M: arm-backend %cleanup ( alien-node -- ) drop ;
+
+: %untag ( dest src -- ) BIN: 111 BIC ;
+
+: %untag-fixnum ( dest src -- ) tag-bits get <ASR> MOV ;
+
+: %tag-fixnum ( dest src -- ) tag-bits get <LSL> MOV ;
+
+M: arm-backend value-structs? t ;
+
+M: arm-backend small-enough? ( n -- ? ) 0 255 between? ;
+
+M: long-long-type c-type-stack-align? drop wince? not ;
+
+M: arm-backend fp-shadows-int? ( -- ? ) f ;
+
+! Alien intrinsics
+: add-alien-offset "offset" operand tag-bits get <ASR> ADD ;
+
+: (%unbox-alien) <+> roll call ; inline
+
+M: arm-backend %unbox-byte-array ( quot src -- )
+    "address" operand "alien" operand add-alien-offset
+    "address" operand alien-offset (%unbox-alien) ;
+
+M: arm-backend %unbox-alien ( quot src -- )
+    "address" operand "alien" operand alien-offset <+> LDR
+    "address" operand dup add-alien-offset
+    "address" operand 0 (%unbox-alien) ;
+
+M: arm-backend %unbox-f ( quot src -- )
+    "offset" operand dup %untag-fixnum
+    "offset" operand 0 (%unbox-alien) ;
+
+M: arm-backend %complex-alien-accessor ( quot src -- )
+    "is-f" define-label
+    "is-alien" define-label
+    "end" define-label
+    "alien" operand f v>operand CMP
+    "is-f" get EQ B
+    "address" operand "alien" operand header-offset neg <-> LDR
+    "address" operand alien type-number tag-header CMP
+    "is-alien" get EQ B
+    [ %unbox-byte-array ] 2keep
+    "end" get B
+    "is-alien" resolve-label
+    [ %unbox-alien ] 2keep
+    "end" get B
+    "is-f" resolve-label
+    %unbox-f
+    "end" resolve-label ;
diff --git a/core/cpu/arm/arm.factor b/core/cpu/arm/arm.factor
new file mode 100644 (file)
index 0000000..111044a
--- /dev/null
@@ -0,0 +1,50 @@
+USING: alien alien.c-types kernel math namespaces
+cpu.architecture cpu.arm.architecture cpu.arm.intrinsics
+generator generator.registers continuations compiler io
+vocabs.loader ;
+
+! EABI passes floats in integer registers.
+[ alien-float ]
+[ >r >r >float r> r> set-alien-float ]
+4
+"box_float"
+"to_float" <primitive-type>
+"float" define-primitive-type
+
+[ >float ] "float" c-type set-c-type-prep
+
+[ alien-double ]
+[ >r >r >float r> r> set-alien-double ]
+8
+"box_double"
+"to_double" <primitive-type> <long-long-type>
+"double" define-primitive-type
+
+[ >float ] "double" c-type set-c-type-prep
+
+T{ arm-backend } compiler-backend set-global
+
+: (detect-arm5) ;
+
+\ (detect-arm5) [
+    ! The LDRH word is defined in the module we conditionally
+    ! load below...
+    ! R0 PC 0 <+> LDRH
+    HEX: e1df00b0 ,
+] H{
+    { +scratch+ { { 0 "scratch" } } }
+} define-intrinsic
+
+: detect-arm5 (detect-arm5) ;
+
+: arm5? ( -- ? ) [ detect-arm5 ] catch not ;
+
+"arm-variant" get [
+    \ detect-arm5 compile
+    "Detecting ARM architecture variant..." print
+    arm5? "arm5" "arm3" ? "arm-variant" set
+] unless
+
+"ARM architecture variant: " write "arm-variant" get print
+
+"arm-variant" "arm5" = [ "cpu.arm5" require ] when
diff --git a/core/cpu/arm/assembler/assembler-tests.factor b/core/cpu/arm/assembler/assembler-tests.factor
new file mode 100644 (file)
index 0000000..219015f
--- /dev/null
@@ -0,0 +1,45 @@
+IN: temporary
+USING: assembler-arm math test namespaces sequences kernel
+quotations ;
+
+: test-opcode [ { } make first ] curry unit-test ;
+
+[ HEX: ea000000 ] [ 0 B ] test-opcode
+[ HEX: eb000000 ] [ 0 BL ] test-opcode
+! [ HEX: e12fff30 ] [ R0 BLX ] test-opcode
+
+[ HEX: e24cc004 ] [ IP IP 4 SUB ] test-opcode
+[ HEX: e24cb004 ] [ FP IP 4 SUB ] test-opcode
+[ HEX: e087e3ac ] [ LR R7 IP 7 <LSR> ADD ] test-opcode
+[ HEX: e08c0109 ] [ R0 IP R9 2 <LSL> ADD ] test-opcode
+[ HEX: 02850004 ] [ R0 R5 4 EQ ADD ] test-opcode
+[ HEX: 00000000 ] [ R0 R0 R0 EQ AND ] test-opcode
+
+[ HEX: e1a0c00c ] [ IP IP MOV ] test-opcode
+[ HEX: e1a0c00d ] [ IP SP MOV ] test-opcode
+[ HEX: e3a03003 ] [ R3 3 MOV ] test-opcode
+[ HEX: e1a00003 ] [ R0 R3 MOV ] test-opcode
+[ HEX: e1e01c80 ] [ R1 R0 25 <LSL> MVN ] test-opcode
+[ HEX: e1e00ca1 ] [ R0 R1 25 <LSR> MVN ] test-opcode
+[ HEX: 11a021ac ] [ R2 IP 3 <LSR> NE MOV ] test-opcode
+
+[ HEX: e3530007 ] [ R3 7 CMP ] test-opcode
+
+[ HEX: e008049a ] [ R8 SL R4 MUL ] test-opcode
+
+[ HEX: e5151004 ] [ R1 R5 4 <-> LDR ] test-opcode
+[ HEX: e41c2004 ] [ R2 IP 4 <-!> LDR ] test-opcode
+[ HEX: e50e2004 ] [ R2 LR 4 <-> STR ] test-opcode
+
+[ HEX: e7910002 ] [ R0 R1 R2 <+> LDR ] test-opcode
+[ HEX: e7910102 ] [ R0 R1 R2 2 <LSL> <+> LDR ] test-opcode
+
+[ HEX: e1d310bc ] [ R1 R3 12 <+> LDRH ] test-opcode
+[ HEX: e1d310fc ] [ R1 R3 12 <+> LDRSH ] test-opcode
+[ HEX: e1d310dc ] [ R1 R3 12 <+> LDRSB ] test-opcode
+[ HEX: e1c310bc ] [ R1 R3 12 <+> STRH ] test-opcode
+[ HEX: e19310b4 ] [ R1 R3 R4 <+> LDRH ] test-opcode
+[ HEX: e1f310fc ] [ R1 R3 12 <!+> LDRSH ] test-opcode
+[ HEX: e1b310d4 ] [ R1 R3 R4 <!+> LDRSB ] test-opcode
+[ HEX: e0c317bb ] [ R1 R3 123 <+!> STRH ] test-opcode
+[ HEX: e08310b4 ] [ R1 R3 R4 <+!> STRH ] test-opcode
diff --git a/core/cpu/arm/assembler/assembler.factor b/core/cpu/arm/assembler/assembler.factor
new file mode 100644 (file)
index 0000000..0152380
--- /dev/null
@@ -0,0 +1,270 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generator generator.fixup kernel sequences words
+namespaces math math.bitfields ;
+IN: cpu.arm.assembler
+
+SYMBOL: arm-variant
+
+: define-registers ( seq -- )
+    dup length [ "register" set-word-prop ] 2each ;
+
+SYMBOL: R0
+SYMBOL: R1
+SYMBOL: R2
+SYMBOL: R3
+SYMBOL: R4
+SYMBOL: R5
+SYMBOL: R6
+SYMBOL: R7
+SYMBOL: R8
+SYMBOL: R9
+SYMBOL: R10
+SYMBOL: R11
+SYMBOL: R12
+SYMBOL: R13
+SYMBOL: R14
+SYMBOL: R15
+
+{ R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 }
+define-registers
+
+PREDICATE: word register register >boolean ;
+
+GENERIC: register ( register -- n )
+M: word register "register" word-prop ;
+M: f register drop 0 ;
+
+: SL R10 ; inline : FP R11 ; inline : IP R12 ; inline
+: SP R13 ; inline : LR R14 ; inline : PC R15 ; inline
+
+! Condition codes
+SYMBOL: cond-code
+
+: >CC ( n -- )
+    cond-code set ;
+
+: CC> ( -- n )
+    #! Default value is BIN: 1110 AL (= always)
+    cond-code [ f ] change BIN: 1110 or ;
+
+: EQ BIN: 0000 >CC ;
+: NE BIN: 0001 >CC ;
+: CS BIN: 0010 >CC ;
+: CC BIN: 0011 >CC ;
+: LO BIN: 0100 >CC ;
+: PL BIN: 0101 >CC ;
+: VS BIN: 0110 >CC ;
+: VC BIN: 0111 >CC ;
+: HI BIN: 1000 >CC ;
+: LS BIN: 1001 >CC ;
+: GE BIN: 1010 >CC ;
+: LT BIN: 1011 >CC ;
+: GT BIN: 1100 >CC ;
+: LE BIN: 1101 >CC ;
+: AL BIN: 1110 >CC ;
+: NV BIN: 1111 >CC ;
+
+: (insn) ( n -- ) CC> 28 shift bitor , ;
+
+: insn ( bitspec -- ) bitfield (insn) ; inline
+
+! Branching instructions
+GENERIC# (B) 1 ( signed-imm-24 l -- )
+
+M: integer (B) { 24 { 1 25 } { 0 26 } { 1 27 } 0 } insn ;
+M: word (B) 0 swap (B) rc-relative-arm-3 rel-word ;
+M: label (B) 0 swap (B) rc-relative-arm-3 label-fixup ;
+
+: B 0 (B) ; : BL 1 (B) ;
+
+! Data processing instructions
+SYMBOL: updates-cond-code
+
+: S ( -- ) updates-cond-code on ;
+
+: S> ( -- ? ) updates-cond-code [ f ] change ;
+
+: sinsn ( bitspec -- )
+    bitfield S> [ 20 2^ bitor ] when (insn) ; inline
+
+GENERIC# shift-imm/reg 2 ( shift-imm/Rs Rm shift -- n )
+
+M: integer shift-imm/reg ( shift-imm Rm shift -- n )
+    { { 0 4 } 5 { register 0 } 7 } bitfield ;
+
+M: register shift-imm/reg ( Rs Rm shift -- n )
+    {
+        { 1 4 }
+        { 0 7 }
+        5
+        { register 8 }
+        { register 0 }
+    } bitfield ;
+
+GENERIC: shifter-op ( shifter-op -- n )
+
+TUPLE: IMM immed rotate ;
+C: <IMM> IMM
+
+M: IMM shifter-op
+    dup IMM-immed swap IMM-rotate
+    { { 1 25 } 8 0 } bitfield ;
+
+TUPLE: shifter Rm by shift ;
+C: <shifter> shifter
+
+M: shifter shifter-op
+    dup shifter-by over shifter-Rm rot shifter-shift
+    shift-imm/reg ;
+
+: <LSL> ( Rm shift-imm/Rs -- shifter-op ) BIN: 00 <shifter> ;
+: <LSR> ( Rm shift-imm/Rs -- shifter-op ) BIN: 01 <shifter> ;
+: <ASR> ( Rm shift-imm/Rs -- shifter-op ) BIN: 10 <shifter> ;
+: <ROR> ( Rm shift-imm/Rs -- shifter-op ) BIN: 11 <shifter> ;
+: <RRX> ( Rm -- shifter-op ) 0 <ROR> ;
+
+M: register shifter-op 0 <LSL> shifter-op ;
+
+M: integer shifter-op 0 <IMM> shifter-op ;
+
+: addr1 ( Rd Rn shifter-op opcode -- )
+    {
+        21 ! opcode
+        { shifter-op 0 }
+        { register 16 } ! Rn
+        { register 12 } ! Rd
+    } sinsn ;
+
+: AND BIN: 0000 addr1 ;
+: EOR BIN: 0001 addr1 ;
+: SUB BIN: 0010 addr1 ;
+: RSB BIN: 0011 addr1 ;
+: ADD BIN: 0100 addr1 ;
+: ADC BIN: 0101 addr1 ;
+: SBC BIN: 0110 addr1 ;
+: RSC BIN: 0111 addr1 ;
+: ORR BIN: 1100 addr1 ;
+: BIC BIN: 1110 addr1 ;
+
+: MOV f swap BIN: 1101 addr1 ;
+: MVN f swap BIN: 1111 addr1 ;
+
+! These always update the condition code flags
+: (CMP) >r f -rot r> S addr1 ;
+
+: TST BIN: 1000 (CMP) ;
+: TEQ BIN: 1001 (CMP) ;
+: CMP BIN: 1010 (CMP) ;
+: CMN BIN: 1011 (CMP) ;
+
+! Multiply instructions
+: (MLA)  ( Rd Rm Rs Rn a -- )
+    {
+        21
+        { register 12 }
+        { register 8 }
+        { register 0 }
+        { register 16 }
+        { 1 7 }
+        { 1 4 }
+    } sinsn ;
+
+: MUL ( Rd Rm Rs -- ) f 0 (MLA) ;
+: MLA ( Rd Rm Rs Rn -- ) 1 (MLA) ;
+
+: (S/UMLAL)  ( RdLo RdHi Rm Rs s a -- )
+    {
+        { 1 23 }
+        22
+        21
+        { register 8 }
+        { register 0 }
+        { register 16 }
+        { register 12 }
+        { 1 7 }
+        { 1 4 }
+    } sinsn ;
+
+: SMLAL 1 1 (S/UMLAL) ; : SMULL 1 0 (S/UMLAL) ;
+: UMLAL 0 1 (S/UMLAL) ; : UMULL 0 0 (S/UMLAL) ;
+
+! Miscellaneous arithmetic instructions
+: CLZ ( Rd Rm -- )
+    {
+        { 1 24 }
+        { 1 22 }
+        { 1 21 }
+        { BIN: 111 16 }
+        { BIN: 1111 8 }
+        { 1 4 }
+        { register 0 }
+        { register 12 }
+    } sinsn ;
+
+! Status register acess instructions
+
+! Load and store instructions
+GENERIC: addressing-mode-2 ( addressing-mode -- n )
+
+TUPLE: addressing p u w ;
+: <addressing> ( delegate p u w -- addressing )
+    {
+        set-delegate
+        set-addressing-p
+        set-addressing-u
+        set-addressing-w
+    } addressing construct ;
+
+M: addressing addressing-mode-2
+    {
+        addressing-p addressing-u addressing-w delegate
+    } get-slots addressing-mode-2
+    { 0 21 23 24 } bitfield ;
+
+M: integer addressing-mode-2 ;
+
+M: object addressing-mode-2 shifter-op { { 1 25 } 0 } bitfield ;
+
+! Offset
+: <+> 1 1 0 <addressing> ;
+: <-> 1 0 0 <addressing> ;
+
+! Pre-indexed
+: <!+> 1 1 1 <addressing> ;
+: <!-> 1 0 1 <addressing> ;
+
+! Post-indexed
+: <+!> 0 1 0 <addressing> ;
+: <-!> 0 0 0 <addressing> ;
+
+: addr2 ( Rd Rn addressing-mode b l -- )
+    {
+        { 1 26 }
+        20
+        22
+        { addressing-mode-2 0 }
+        { register 16 }
+        { register 12 }
+    } insn ;
+
+: LDR 0 1 addr2 ;
+: LDRB 1 1 addr2 ;
+: STR 0 0 addr2 ;
+: STRB 1 0 addr2 ;
+
+HOOK: BX arm-variant ( operand -- )
+
+HOOK: BLX arm-variant ( operand -- )
+
+! We might have to simulate these instructions since older ARM
+! chips don't have them.
+M: f BX PC swap MOV ;
+
+M: f BLX LR PC MOV BX ;
+
+! Load and store multiple instructions
+
+! Semaphore instructions
+
+! Exception-generating instructions
diff --git a/core/cpu/arm/authors.txt b/core/cpu/arm/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/arm/bootstrap.factor b/core/cpu/arm/bootstrap.factor
new file mode 100644 (file)
index 0000000..3ef3ffc
--- /dev/null
@@ -0,0 +1,4 @@
+USING: bootstrap.image.private kernel namespaces system ;
+
+4 \ cell set
+big-endian off
diff --git a/core/cpu/arm/intrinsics/intrinsics.factor b/core/cpu/arm/intrinsics/intrinsics.factor
new file mode 100644 (file)
index 0000000..5af55cf
--- /dev/null
@@ -0,0 +1,462 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays cpu.architecture cpu.arm.assembler
+cpu.arm.architecture cpu.arm.allot kernel kernel.private math
+math.functions math.private namespaces sequences words
+quotations byte-arrays hashtables.private hashtables generator
+generator.registers generator.fixup sequences.private sbufs
+sbufs.private vectors vectors.private system tuples.private
+layouts strings.private slots.private ;
+IN: cpu.arm.intrinsics
+
+\ slot {
+    ! Slot number is literal
+    {
+        [
+            "out" operand "obj" operand %untag
+            "out" operand dup "n" get cells <+> LDR
+        ] H{
+            { +input+ { { f "obj" } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "out" } } }
+            { +output+ { "out" } }
+        }
+    }
+    ! Slot number in a register
+    {
+        [
+            "out" operand "obj" operand %untag
+            "out" operand dup "n" operand 1 <LSR> <+> LDR
+        ] H{
+            { +input+ { { f "obj" } { f "n" } } }
+            { +scratch+ { { f "out" } } }
+            { +output+ { "out" } }
+        }
+    }
+} define-intrinsics
+
+: generate-write-barrier ( -- )
+    "val" operand-immediate? "obj" get fresh-object? or [
+        "cards_offset" f R12 %alien-global
+        "scratch" operand R12 "scratch" operand card-bits <LSR> ADD
+        "val" operand "scratch" operand 0 LDRB
+        "val" operand dup card-mark ORR
+        "val" operand "scratch" operand 0 STRB
+    ] unless ;
+
+\ set-slot {
+    ! Slot number is literal
+    {
+        [
+            "scratch" operand "obj" operand %untag
+            "val" operand "scratch" operand "n" get cells <+> STR
+            generate-write-barrier
+        ] H{
+            { +input+ { { f "val" } { f "obj" } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "scratch" } } }
+            { +clobber+ { "val" } }
+        }
+    }
+    ! Slot number is in a register
+    {
+        [
+            "scratch" operand "obj" operand %untag
+            "n" operand "scratch" operand "n" operand 1 <LSR> ADD
+            "val" operand "n" operand 0 STR
+            generate-write-barrier
+        ] H{
+            { +input+ { { f "val" } { f "obj" } { f "n" } } }
+            { +scratch+ { { f "scratch" } } }
+            { +clobber+ { "val" "n" } }
+        }
+    }
+} define-intrinsics
+
+: fixnum-op ( op -- quot )
+    [ "out" operand "x" operand "y" operand ] swap add ;
+
+: fixnum-register-op ( op -- pair )
+    fixnum-op H{
+        { +input+ { { f "x" } { f "y" } } }
+        { +scratch+ { { f "out" } } }
+        { +output+ { "out" } }
+    } 2array ;
+
+: fixnum-value-op ( op -- pair )
+    fixnum-op H{
+        { +input+ { { f "x" } { [ small-tagged? ] "y" } } }
+        { +scratch+ { { f "out" } } }
+        { +output+ { "out" } }
+    } 2array ;
+
+: define-fixnum-op ( word op -- )
+    [ fixnum-value-op ] keep fixnum-register-op 2array
+    define-intrinsics ;
+
+{
+    { fixnum+fast ADD }
+    { fixnum-fast SUB }
+    { fixnum-bitand AND }
+    { fixnum-bitor ORR }
+    { fixnum-bitxor EOR }
+} [
+    first2 define-fixnum-op
+] each
+
+\ fixnum-bitnot [
+    "x" operand dup MVN
+    "x" operand dup %untag
+] H{
+    { +input+ { { f "x" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+\ fixnum*fast [
+    "out" operand "y" operand %untag-fixnum
+    "out" operand "x" operand "out" operand MUL
+] H{
+    { +input+ { { f "x" } { f "y" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ fixnum-shift [
+    "out" operand "x" operand "y" get neg <ASR> MOV
+    ! Mask off low bits
+    "out" operand dup %untag
+] H{
+    { +input+ { { f "x" } { [ -31 0 between? ] "y" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+: %untag-fixnums ( seq -- )
+    [ dup %untag-fixnum ] unique-operands ;
+
+: overflow-check ( insn -- )
+    [
+        "end" define-label
+        [ "allot-tmp" operand "x" operand "y" operand roll S execute ] keep
+        "end" get VC B
+        { "x" "y" } %untag-fixnums
+        "x" operand "x" operand "y" operand roll execute
+        "x" get %allot-bignum-signed-1
+        "end" resolve-label
+    ] with-scope ; inline
+
+: overflow-template ( word insn -- )
+    [ overflow-check ] curry H{
+        { +input+ { { f "x" } { f "y" } } }
+        { +scratch+ { { f "allot-tmp" } } }
+        { +output+ { "allot-tmp" } }
+        { +clobber+ { "x" "y" } }
+    } define-intrinsic ;
+
+\ fixnum+ \ ADD overflow-template
+\ fixnum- \ SUB overflow-template
+
+\ fixnum>bignum [
+    "x" operand dup %untag-fixnum
+    "x" get %allot-bignum-signed-1
+] H{
+    { +input+ { { f "x" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +clobber+ { "x" } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ bignum>fixnum [
+    "end" define-label
+    "x" operand dup %untag
+    "y" operand "x" operand cell <+> LDR
+     ! if the length is 1, its just the sign and nothing else,
+     ! so output 0
+    "y" operand 1 v>operand CMP
+    "y" operand 0 EQ MOV
+    "end" get EQ B
+    ! load the value
+    "y" operand "x" operand 3 cells <+> LDR
+    ! load the sign
+    "x" operand "x" operand 2 cells <+> LDR
+    ! is the sign negative?
+    "x" operand 0 CMP
+    ! Negate the value
+    "y" operand "y" operand 0 NE RSB
+    "y" operand dup %tag-fixnum
+    "end" resolve-label
+] H{
+    { +input+ { { f "x" } } }
+    { +scratch+ { { f "y" } } }
+    { +clobber+ { "x" } }
+    { +output+ { "y" } }
+} define-intrinsic
+
+: fixnum-jump ( op -- quo )
+    [ "x" operand "y" operand CMP ] swap
+    1quotation [ B ] 3append ;
+
+: fixnum-register-jump ( op -- pair )
+   fixnum-jump { { f "x" } { f "y" } } 2array ;
+
+: fixnum-value-jump ( op -- pair )
+    fixnum-jump { { f "x" } { [ small-tagged? ] "y" } } 2array ;
+
+: define-fixnum-jump ( word op -- )
+    [ fixnum-value-jump ] keep fixnum-register-jump
+    2array define-if-intrinsics ;
+
+{
+    { fixnum< LT }
+    { fixnum<= LE }
+    { fixnum> GT }
+    { fixnum>= GE }
+    { eq? EQ }
+} [
+    first2 define-fixnum-jump
+] each
+
+\ tag [
+    "out" operand "in" operand tag-mask get AND
+    "out" operand dup %tag-fixnum
+] H{
+    { +input+ { { f "in" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ type [
+    "end" define-label
+    ! Get the tag
+    "y" operand "obj" operand tag-mask get AND
+    ! Compare with object tag number (3).
+    "y" operand object tag-number CMP
+    ! Tag the tag if it is not equal to 3
+    "x" operand "y" operand NE %tag-fixnum
+    ! Jump to end if it is not equal to 3
+    "end" get NE B
+    ! Is the pointer itself equal to 3? Then its F_TYPE (9).
+    "obj" operand object tag-number CMP
+    ! Load F_TYPE (9) if it is equal
+    "x" operand f type v>operand EQ MOV
+    ! Load the object header if it is not equal
+    "x" operand "obj" operand object tag-number <-> NE LDR
+    ! Turn the header into a fixnum
+    "x" operand dup NE %untag
+    "end" resolve-label
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "x" } { f "y" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+: userenv ( reg -- )
+    #! Load the userenv pointer in a register.
+    "userenv" f rot compile-dlsym ;
+
+\ getenv [
+    "n" operand dup 1 <ASR> MOV
+    "x" operand userenv
+    "x" operand "x" operand "n" operand <+> LDR
+] H{
+    { +input+ { { f "n" } } }
+    { +scratch+ { { f "x" } } }
+    { +output+ { "x" } }
+    { +clobber+ { "n" } }
+} define-intrinsic
+
+\ setenv [
+    "n" operand dup 1 <ASR> MOV
+    "x" operand userenv
+    "val" operand "x" operand "n" operand <+> STR
+] H{
+    { +input+ { { f "val" } { f "n" } } }
+    { +scratch+ { { f "x" } } }
+    { +clobber+ { "n" } }
+} define-intrinsic
+
+: %set-slot "allot-tmp" operand swap cells <+> STR ;
+
+: %store-length
+    R12 "n" operand MOV
+    R12 1 %set-slot ;
+
+: %fill-array swap 2 + %set-slot ;
+
+\ <tuple> [
+    tuple "n" get 2 + cells %allot
+    %store-length
+    ! Store class
+    "class" operand 2 %set-slot
+    ! Zero out the rest of the tuple
+    R12 f v>operand MOV
+    "n" get 1- [ 1+ R12 %fill-array ] each
+    object %tag-allot
+] H{
+    { +input+ { { f "class" } { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ <array> [
+    array "n" get 2 + cells %allot
+    %store-length
+    ! Store initial element
+    "n" get [ "initial" operand %fill-array ] each
+    object %tag-allot
+] H{
+    { +input+ { { [ inline-array? ] "n" } { f "initial" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ <byte-array> [
+    byte-array "n" get 2 cells + %allot
+    %store-length
+    ! Store initial element
+    R12 0 MOV
+    "n" get cell align cell /i [ R12 %fill-array ] each
+    object %tag-allot
+] H{
+    { +input+ { { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ <ratio> [
+    ratio 3 cells %allot
+    "numerator" operand 1 %set-slot
+    "denominator" operand 2 %set-slot
+    ratio %tag-allot
+] H{
+    { +input+ { { f "numerator" } { f "denominator" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ <complex> [
+    complex 3 cells %allot
+    "real" operand 1 %set-slot
+    "imaginary" operand 2 %set-slot
+    ! Store tagged ptr in reg
+    complex %tag-allot
+] H{
+    { +input+ { { f "real" } { f "imaginary" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ <wrapper> [
+    wrapper 2 cells %allot
+    "obj" operand 1 %set-slot
+    ! Store tagged ptr in reg
+    wrapper %tag-allot
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ (hashtable) [
+    hashtable 4 cells %allot
+    R12 f v>operand MOV
+    R12 1 %set-slot
+    R12 2 %set-slot
+    R12 3 %set-slot
+    ! Store tagged ptr in reg
+    object %tag-allot
+] H{
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ string>sbuf [
+    sbuf 3 cells %allot
+    "length" operand 1 %set-slot
+    "string" operand 2 %set-slot
+    object %tag-allot
+] H{
+    { +input+ { { f "string" } { f "length" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ array>vector [
+    vector 3 cells %allot
+    "length" operand 1 %set-slot
+    "array" operand 2 %set-slot
+    object %tag-allot
+] H{
+    { +input+ { { f "array" } { f "length" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+\ curry [
+    \ curry 3 cells %allot
+    "obj" operand 1 %set-slot
+    "quot" operand 2 %set-slot
+    object %tag-allot
+] H{
+    { +input+ { { f "obj" } { f "quot" } } }
+    { +scratch+ { { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+} define-intrinsic
+
+! Alien intrinsics
+: alien-integer-get-template
+    H{
+        { +input+ {
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { f "output" } } }
+        { +output+ { "output" } }
+        { +clobber+ { "offset" } }
+    } ;
+
+: %alien-get ( quot -- )
+    "output" get "address" set
+    "output" operand "alien" operand-class %alien-accessor ;
+
+: %alien-integer-get ( quot -- )
+    %alien-get
+    "output" operand dup %tag-fixnum ; inline
+
+: %alien-integer-set ( quot -- )
+    "value" operand dup %untag-fixnum
+    "value" operand "alien" operand-class %alien-accessor ; inline
+
+: alien-integer-set-template
+    H{
+        { +input+ {
+            { f "value" fixnum }
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { f "address" } } }
+        { +clobber+ { "value" "offset" } }
+    } ;
+
+: define-alien-integer-intrinsics ( word get-quot word set-quot -- )
+    [ %alien-integer-set ] curry
+    alien-integer-set-template
+    define-intrinsic
+    [ %alien-integer-get ] curry
+    alien-integer-get-template
+    define-intrinsic ;
+
+\ alien-unsigned-1 [ LDRB ]
+\ set-alien-unsigned-1 [ STRB ]
+define-alien-integer-intrinsics
+
+\ alien-cell [
+    [ LDR ] %alien-get
+    "output" get %allot-alien
+] H{
+    { +input+ {
+        { f "alien" simple-c-ptr }
+        { f "offset" fixnum }
+    } }
+    { +scratch+ { { f "output" } { f "allot-tmp" } } }
+    { +output+ { "allot-tmp" } }
+    { +clobber+ { "offset" } }
+} define-intrinsic
diff --git a/core/cpu/arm/summary.txt b/core/cpu/arm/summary.txt
new file mode 100644 (file)
index 0000000..f3e46d9
--- /dev/null
@@ -0,0 +1 @@
+ARM3 compiler backend
diff --git a/core/cpu/arm5/arm5.factor b/core/cpu/arm5/arm5.factor
new file mode 100644 (file)
index 0000000..11675f1
--- /dev/null
@@ -0,0 +1,4 @@
+USING: cpu.arm.assembler cpu.arm5.assembler cpu.arm5.intrinsics
+namespaces ;
+
+T{ arm5-variant } arm-variant set-global
diff --git a/core/cpu/arm5/assembler/assembler.factor b/core/cpu/arm5/assembler/assembler.factor
new file mode 100644 (file)
index 0000000..237394a
--- /dev/null
@@ -0,0 +1,74 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generator generator.fixup kernel sequences words
+namespaces math math.bitfields cpu.arm.assembler ;
+IN: cpu.arm5.assembler
+
+TUPLE: arm5-variant ;
+
+GENERIC# (BX) 1 ( Rm l -- )
+
+M: register (BX) ( Rm l -- )
+    {
+        { 1 24 }
+        { 1 21 }
+        { BIN: 1111 16 }
+        { BIN: 1111 12 }
+        { BIN: 1111 8 }
+        5
+        { 1 4 }
+        { register 0 }
+    } insn ;
+
+M: word (BX) 0 swap (BX) rc-relative-arm-3 rel-word ;
+
+M: label (BX) 0 swap (BX) rc-relative-arm-3 label-fixup ;
+
+M: arm5-variant BX 0 (BX) ;
+
+M: arm5-variant BLX 1 (BX) ;
+
+! More load and store instructions
+GENERIC: addressing-mode-3 ( addressing-mode -- n )
+
+: b>n/n ( b -- n n ) dup -4 shift swap HEX: f bitand ;
+
+M: addressing addressing-mode-3
+    [ addressing-p ] keep
+    [ addressing-u ] keep
+    [ addressing-w ] keep
+    delegate addressing-mode-3
+    { 0 21 23 24 } bitfield ;
+
+M: integer addressing-mode-3
+    b>n/n {
+        ! { 1 24 }
+        { 1 22 }
+        { 1 7 }
+        { 1 4 }
+        0
+        8
+    } bitfield ;
+
+M: object addressing-mode-3
+    shifter-op {
+        ! { 1 24 }
+        { 1 7 }
+        { 1 4 }
+        0
+    } bitfield ;
+
+: addr3 ( Rn Rd addressing-mode h l s -- )
+    {
+        6
+        20
+        5
+        { addressing-mode-3 0 }
+        { register 16 }
+        { register 12 }
+    } insn ;
+
+: LDRH 1 1 0 addr3 ;
+: LDRSB 0 1 1 addr3 ;
+: LDRSH 1 1 1 addr3 ;
+: STRH 1 0 0 addr3 ;
diff --git a/core/cpu/arm5/authors.txt b/core/cpu/arm5/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/arm5/intrinsics/intrinsics.factor b/core/cpu/arm5/intrinsics/intrinsics.factor
new file mode 100644 (file)
index 0000000..d6f651b
--- /dev/null
@@ -0,0 +1,45 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays cpu.architecture cpu.arm.assembler
+cpu.arm.architecture cpu.arm5.assembler kernel kernel.private
+math math.private namespaces sequences words quotations
+byte-arrays hashtables.private hashtables generator
+generator.registers generator.fixup sequences.private
+strings.private ;
+IN: cpu.arm5.intrinsics
+
+: (%char-slot)
+    "out" operand string-offset MOV
+    "out" operand dup "n" operand 2 <LSR> ADD ;
+
+\ char-slot [
+    (%char-slot)
+    "out" operand "obj" operand "out" operand <+> LDRH
+    "out" operand dup %tag-fixnum
+] H{
+    { +input+ { { f "n" } { f "obj" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ set-char-slot [
+    "val" operand dup %untag-fixnum
+    (%char-slot)
+    "val" operand "obj" operand "out" operand <+> STRH
+] H{
+    { +input+ { { f "val" } { f "n" } { f "obj" } } }
+    { +scratch+ { { f "out" } } }
+    { +clobber+ { "val" } }
+} define-intrinsic
+
+\ alien-signed-1 [ LDRSB ]
+\ set-alien-signed-1 [ STRB ]
+define-alien-integer-intrinsics
+
+\ alien-unsigned-2 [ LDRH ]
+\ set-alien-unsigned-2 [ STRH ]
+define-alien-integer-intrinsics
+
+\ alien-signed-2 [ LDRSH ]
+\ set-alien-signed-2 [ STRH ]
+define-alien-integer-intrinsics
diff --git a/core/cpu/arm5/summary.txt b/core/cpu/arm5/summary.txt
new file mode 100644 (file)
index 0000000..5c697fe
--- /dev/null
@@ -0,0 +1 @@
+Additional compiler intrinsics for ARM5
diff --git a/core/cpu/ppc/allot/allot.factor b/core/cpu/ppc/allot/allot.factor
new file mode 100644 (file)
index 0000000..a31e4b7
--- /dev/null
@@ -0,0 +1,104 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel cpu.ppc.architecture cpu.ppc.assembler
+kernel.private namespaces math sequences generic arrays
+generator generator.registers generator.fixup system layouts
+math.functions cpu.architecture alien ;
+IN: cpu.ppc.allot
+
+: load-zone-ptr ( reg -- )
+    "nursery" f pick %load-dlsym dup 0 LWZ ;
+
+: %allot ( header size -- )
+    #! Store a pointer to 'size' bytes allocated from the
+    #! nursery in r11.
+    8 align ! align the size
+    12 load-zone-ptr ! nusery -> r12
+    11 12 cell LWZ ! nursery.here -> r11
+    11 11 pick ADDI ! increment r11
+    11 12 cell STW ! r11 -> nursery.here
+    11 11 rot SUBI ! old value
+    type-number tag-header 12 LI ! compute header
+    12 11 0 STW ! store header
+    ;
+
+: %store-tagged ( reg tag -- )
+    >r dup fresh-object v>operand 11 r> tag-number ORI ;
+
+: %allot-float ( reg -- )
+    #! exits with tagged ptr to object in r12, untagged in r11
+    float 16 %allot
+    11 8 STFD
+    12 11 float tag-number ORI
+    f fresh-object ;
+
+M: float-regs (%replace)
+    drop
+    swap v>operand %allot-float
+    12 swap loc>operand STW ;
+
+M: ppc-backend %move-float>int ( dst src -- )
+    [ v>operand ] 2apply %allot-float 12 MR ;
+
+: %allot-bignum ( #digits -- )
+    #! 1 cell header, 1 cell length, 1 cell sign, + digits
+    #! length is the # of digits + sign
+    bignum over 3 + cells %allot
+    1+ v>operand 12 LI ! compute the length
+    12 11 cell STW ! store the length
+    ;
+
+: %allot-bignum-signed-1 ( reg -- )
+    #! on entry, reg is a 30-bit quantity sign-extended to
+    #! 32-bits.
+    #! exits with tagged ptr to bignum in reg
+    [
+        { "end" "non-zero" "pos" "store" } [ define-label ] each
+        ! is it zero?
+        0 over v>operand 0 CMPI
+        "non-zero" get BNE
+        0 >bignum over load-literal
+        "end" get B
+        ! it is non-zero
+        "non-zero" resolve-label
+        1 %allot-bignum
+        ! is the fixnum negative?
+        0 over v>operand 0 CMPI
+        "pos" get BGE
+        1 12 LI
+        ! store negative sign
+        12 11 2 cells STW
+        ! negate fixnum
+        dup v>operand dup -1 MULI
+        "store" get B
+        "pos" resolve-label
+        0 12 LI
+        ! store positive sign
+        12 11 2 cells STW
+        "store" resolve-label
+        ! store the number
+        dup v>operand 11 3 cells STW
+        ! tag the bignum, store it in reg
+        bignum %store-tagged
+        "end" resolve-label
+    ] with-scope ;
+
+: %allot-alien ( ptr -- )
+    "temp" set
+    "f" define-label
+    "end" define-label
+    0 "temp" operand 0 CMPI
+    "f" get BEQ
+    alien 4 cells %allot
+    "temp" operand 11 3 cells STW
+    f v>operand "temp" operand LI
+    ! Store expired slot
+    "temp" operand 11 1 cells STW
+    ! Store underlying-alien slot
+    "temp" operand 11 2 cells STW
+    ! Store tagged ptr in reg
+    "temp" get object %store-tagged
+    "end" get B
+    "f" resolve-label
+    f v>operand "temp" operand LI
+    "end" resolve-label ;
diff --git a/core/cpu/ppc/allot/authors.txt b/core/cpu/ppc/allot/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/ppc/allot/summary.txt b/core/cpu/ppc/allot/summary.txt
new file mode 100644 (file)
index 0000000..3c4941e
--- /dev/null
@@ -0,0 +1 @@
+PowerPC inline memory allocation
diff --git a/core/cpu/ppc/architecture/architecture.factor b/core/cpu/ppc/architecture/architecture.factor
new file mode 100644 (file)
index 0000000..d12139c
--- /dev/null
@@ -0,0 +1,357 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types cpu.ppc.assembler cpu.architecture generic
+kernel kernel.private math memory namespaces sequences words
+assocs generator generator.registers generator.fixup system
+layouts math.functions classes words.private alien combinators ;
+IN: cpu.ppc.architecture
+
+TUPLE: ppc-backend ;
+
+! PowerPC register assignments
+! r3-r10, r17-r31: integer vregs
+! f0-f13: float vregs
+! r11, r12: scratch
+! r14: data stack
+! r15: retain stack
+
+! For stack frame layout, see vm/os-{macosx,linux}-ppc.h.
+
+: ds-reg 14 ;
+: rs-reg 15 ;
+: stack-chain-reg 16 ;
+
+: reserved-area-size
+    os {
+        { "linux" [ 2 ] }
+        { "macosx" [ 6 ] }
+    } case cells ; foldable
+
+: lr-save
+    os {
+        { "linux" [ 1 ] }
+        { "macosx" [ 2 ] }
+    } case cells ; foldable
+
+: param@ ( n -- x ) reserved-area-size + ; inline
+
+: param-save-size 8 cells ; foldable
+
+: xt-save reserved-area-size param-save-size + 2 cells + ; foldable
+
+: local-area-start xt-save cell + ; foldable
+
+: local@ ( n -- x ) local-area-start + ; inline
+
+M: ppc-backend stack-frame ( n -- i ) local@ 4 cells align ;
+
+M: temp-reg v>operand drop 11 ;
+
+M: int-regs return-reg drop 3 ;
+M: int-regs param-regs drop { 3 4 5 6 7 8 9 10 } ;
+M: int-regs vregs
+    drop {
+        3 4 5 6 7 8 9 10
+        16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
+    } ;
+
+M: float-regs return-reg drop 1 ;
+
+M: float-regs param-regs 
+    drop os H{
+        { "macosx" { 1 2 3 4 5 6 7 8 9 10 11 12 13 } }
+        { "linux" { 1 2 3 4 5 6 7 8 } }
+    } at ;
+
+M: float-regs vregs drop { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
+
+GENERIC: loc>operand ( loc -- reg n )
+
+M: ds-loc loc>operand ds-loc-n cells neg ds-reg swap ;
+M: rs-loc loc>operand rs-loc-n cells neg rs-reg swap ;
+
+M: immediate load-literal
+    [ v>operand ] 2apply LOAD ;
+
+M: ppc-backend load-indirect ( obj reg -- )
+    [ 0 swap LOAD32 rc-absolute-ppc-2/2 rel-literal ] keep
+    dup 0 LWZ ;
+
+: %load-xt ( word reg -- )
+    0 swap LOAD32  rc-absolute-ppc-2/2 rel-word ;
+
+M: ppc-backend %save-xt ( -- )
+    compiling-label get 11 %load-xt ;
+
+M: ppc-backend %prologue ( n -- )
+    0 MFLR
+    1 1 pick stack-frame neg STWU
+    11 1 xt-save STW
+    0 1 rot stack-frame lr-save + STW ;
+
+M: ppc-backend %epilogue ( n -- )
+    #! At the end of each word that calls a subroutine, we store
+    #! the previous link register value in r0 by popping it off
+    #! the stack, set the link register to the contents of r0,
+    #! and jump to the link register.
+    0 1 pick stack-frame lr-save + LWZ
+    1 1 rot stack-frame ADDI
+    0 MTLR ;
+
+: %load-dlsym ( symbol dll register -- )
+    0 swap LOAD32 rc-absolute-ppc-2/2 rel-dlsym ;
+
+M: ppc-backend %profiler-prologue ( word -- )
+    "end" define-label
+    "profiling" f 3 %load-dlsym
+    3 3 0 LWZ
+    0 3 0 CMPI
+    "end" get BEQ
+    3 load-indirect
+    4 3 profile-count-offset LWZ
+    4 4 1 v>operand ADDI
+    4 3 profile-count-offset STW
+    "end" resolve-label ;
+
+M: ppc-backend %call-label ( label -- ) BL ;
+
+M: ppc-backend %jump-label ( label -- ) B ;
+
+: %prepare-primitive ( word -- )
+    ! Save stack pointer to stack_chain->callstack_top, load XT
+    4 1 MR 11 %load-xt ;
+
+: (%call) 11 MTLR BLRL ;
+
+M: ppc-backend %call-primitive ( word -- )
+    %prepare-primitive (%call) ;
+
+: (%jump) 11 MTCTR BCTR ;
+
+M: ppc-backend %jump-primitive ( word -- )
+    %prepare-primitive (%jump) ;
+
+M: ppc-backend %jump-t ( label -- )
+    0 "flag" operand \ f tag-number CMPI BNE ;
+
+: dispatch-template ( word-table# quot -- )
+    [
+        >r
+        "offset" operand "n" operand 1 SRAWI
+        0 11 LOAD32 rc-absolute-ppc-2/2 rel-dispatch
+        11 dup "offset" operand LWZX
+        r> call
+    ] H{
+        { +input+ { { f "n" } } }
+        { +scratch+ { { f "offset" } } }
+    } with-template ; inline
+
+M: ppc-backend %call-dispatch ( word-table# -- )
+    [ (%call) ] dispatch-template ;
+
+M: ppc-backend %jump-dispatch ( word-table# -- )
+    [ %epilogue-later (%jump) ] dispatch-template ;
+
+M: ppc-backend %return ( -- ) %epilogue-later BLR ;
+
+M: ppc-backend %unwind drop %return ;
+
+M: int-regs (%peek)
+    drop >r v>operand r> loc>operand LWZ ;
+
+M: float-regs (%peek)
+    drop
+    11 swap loc>operand LWZ
+    v>operand 11 float-offset LFD ;
+
+M: int-regs (%replace)
+    drop >r v>operand r> loc>operand STW ;
+
+M: ppc-backend %move-int>int ( dst src -- )
+    [ v>operand ] 2apply MR ;
+
+M: ppc-backend %move-int>float ( dst src -- )
+    [ v>operand ] 2apply float-offset LFD ;
+
+M: ppc-backend %inc-d ( n -- ) ds-reg dup rot cells ADDI ;
+
+M: ppc-backend %inc-r ( n -- ) rs-reg dup rot cells ADDI ;
+
+M: int-regs %save-param-reg drop 1 rot local@ STW ;
+
+M: int-regs %load-param-reg drop 1 rot local@ LWZ ;
+
+: STF float-regs-size 4 = [ STFS ] [ STFD ] if ;
+
+M: float-regs %save-param-reg >r 1 rot local@ r> STF ;
+
+: LF float-regs-size 4 = [ LFS ] [ LFD ] if ;
+
+M: float-regs %load-param-reg >r 1 rot local@ r> LF ;
+
+M: stack-params %load-param-reg ( stack reg reg-class -- )
+    drop >r 0 1 rot local@ LWZ 0 1 r> param@ STW ;
+
+M: stack-params %save-param-reg ( stack reg reg-class -- )
+    #! Funky. Read the parameter from the caller's stack frame.
+    #! This word is used in callbacks
+    drop
+    0 1 rot param@ stack-frame* + LWZ
+    0 1 rot local@ STW ;
+
+M: ppc-backend %prepare-unbox ( -- )
+    ! First parameter is top of stack
+    3 ds-reg 0 LWZ
+    ds-reg dup cell SUBI ;
+
+M: ppc-backend %unbox ( n reg-class func -- )
+    ! Value must be in r3
+    ! Call the unboxer
+    f %alien-invoke
+    ! Store the return value on the C stack
+    over [ [ return-reg ] keep %save-param-reg ] [ 2drop ] if ;
+
+M: ppc-backend %unbox-long-long ( n func -- )
+    ! Value must be in r3:r4
+    ! Call the unboxer
+    f %alien-invoke
+    ! Store the return value on the C stack
+    [
+        3 1 pick local@ STW
+        4 1 rot cell + local@ STW
+    ] when* ;
+
+M: ppc-backend %unbox-large-struct ( n size -- )
+    ! Value must be in r3
+    ! Compute destination address
+    4 1 roll local@ ADDI
+    ! Load struct size
+    5 LI
+    ! Call the function
+    "to_value_struct" f %alien-invoke ;
+
+M: ppc-backend %box ( n reg-class 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.
+    >r
+    over [ 0 over param-reg swap %load-param-reg ] [ 2drop ] if
+    r> f %alien-invoke ;
+
+M: ppc-backend %box-long-long ( n func -- )
+    >r [
+        3 1 pick local@ LWZ
+        4 1 rot cell + local@ LWZ
+    ] when* r> f %alien-invoke ;
+
+: temp@ stack-frame* swap - ;
+
+: struct-return@ ( size n -- n ) [ local@ ] [ temp@ ] ?if ;
+
+M: ppc-backend %prepare-box-struct ( size -- )
+    #! Compute target address for value struct return
+    3 1 rot f struct-return@ ADDI
+    3 1 0 local@ STW ;
+
+M: ppc-backend %box-large-struct ( n size -- )
+    #! If n = f, then we're boxing a returned struct
+    [ swap struct-return@ ] keep
+    ! Compute destination address
+    3 1 roll ADDI
+    ! Load struct size
+    4 LI
+    ! Call the function
+    "box_value_struct" f %alien-invoke ;
+
+M: ppc-backend %prepare-alien-invoke
+    #! Save Factor stack pointers in case the C code calls a
+    #! callback which does a GC, which must reliably trace
+    #! all roots.
+    "stack_chain" f 11 %load-dlsym
+    11 11 0 LWZ
+    1 11 0 STW
+    ds-reg 11 8 STW
+    rs-reg 11 12 STW ;
+
+M: ppc-backend %alien-invoke ( symbol dll -- )
+    11 %load-dlsym (%call) ;
+
+M: ppc-backend %alien-callback ( quot -- )
+    0 <int-vreg> load-literal "c_to_factor" f %alien-invoke ;
+
+M: ppc-backend %prepare-alien-indirect ( -- )
+    "unbox_alien" f %alien-invoke
+    3 1 cell temp@ STW ;
+
+M: ppc-backend %alien-indirect ( -- )
+    11 1 cell temp@ LWZ (%call) ;
+
+M: ppc-backend %callback-value ( ctype -- )
+     ! Save top of data stack
+     3 ds-reg 0 LWZ
+     3 1 0 local@ STW
+     ! 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-backend %cleanup ( alien-node -- ) drop ;
+
+: %untag ( src dest -- ) 0 0 31 tag-bits get - RLWINM ;
+
+: %tag-fixnum ( src dest -- ) tag-bits get SLWI ;
+
+: %untag-fixnum ( src dest -- ) tag-bits get SRAWI ;
+
+M: ppc-backend value-structs?
+    #! On Linux/PPC, value structs are passed in the same way
+    #! as reference structs, we just have to make a copy first.
+    os "linux" = not ;
+
+M: ppc-backend fp-shadows-int? ( -- ? ) macosx? ;
+
+M: ppc-backend small-enough? ( n -- ? ) -32768 32767 between? ;
+
+M: ppc-backend struct-small-enough? ( size -- ? ) drop f ;
+
+M: ppc-backend %box-small-struct
+    drop "No small structs" throw ;
+
+M: ppc-backend %unbox-small-struct
+    drop "No small structs" throw ;
+
+! Alien intrinsics
+M: ppc-backend %unbox-byte-array ( quot src -- )
+    "address" operand "alien" operand "offset" operand ADD
+    "address" operand byte-array-offset
+    roll call ;
+
+M: ppc-backend %unbox-alien ( quot src -- )
+    "address" operand "alien" operand alien-offset LWZ
+    "address" operand dup "offset" operand ADD
+    "address" operand 0
+    roll call ;
+
+M: ppc-backend %unbox-f ( quot src -- )
+    "offset" operand 0
+    roll call ;
+
+M: ppc-backend %complex-alien-accessor ( quot src -- )
+    "is-f" define-label
+    "is-alien" define-label
+    "end" define-label
+    0 "alien" operand f v>operand CMPI
+    "is-f" get BEQ
+    "address" operand "alien" operand header-offset LWZ
+    0 "address" operand alien type-number tag-header CMPI
+    "is-alien" get BEQ
+    [ %unbox-byte-array ] 2keep
+    "end" get B
+    "is-alien" resolve-label
+    [ %unbox-alien ] 2keep
+    "end" get B
+    "is-f" resolve-label
+    %unbox-f
+    "end" resolve-label ;
diff --git a/core/cpu/ppc/architecture/authors.txt b/core/cpu/ppc/architecture/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/ppc/architecture/summary.txt b/core/cpu/ppc/architecture/summary.txt
new file mode 100644 (file)
index 0000000..76fe694
--- /dev/null
@@ -0,0 +1 @@
+PowerPC architecture description
diff --git a/core/cpu/ppc/assembler/assembler.factor b/core/cpu/ppc/assembler/assembler.factor
new file mode 100644 (file)
index 0000000..2ea5595
--- /dev/null
@@ -0,0 +1,225 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: cpu.ppc.assembler
+USING: generator.fixup generic kernel math memory namespaces
+words math.bitfields math.functions io.binary ;
+
+! See the Motorola or IBM documentation for details. The opcode
+! names are standard, and the operand order is the same as in
+! the docs, except a few differences, namely, in IBM/Motorola
+! assembler syntax, loads and stores are written like:
+!
+! stw r14,10(r15)
+!
+! In Factor, we write:
+!
+! 14 15 10 STW
+
+: insn ( operand opcode -- ) { 26 0 } bitfield , ;
+: a-form ( d a b c xo rc -- n ) { 0 1 6 11 16 21 } bitfield ;
+: b-form ( bo bi bd aa lk -- n ) { 0 1 2 16 21 } bitfield ;
+: s>u16 ( s -- u ) HEX: ffff bitand ;
+: d-form ( d a simm -- n ) s>u16 { 0 16 21 } bitfield ;
+: sd-form ( d a simm -- n ) s>u16 { 0 21 16 } bitfield ;
+: i-form ( li aa lk -- n ) { 0 1 0 } bitfield ;
+: x-form ( a s b rc xo -- n ) { 1 0 11 21 16 } bitfield ;
+: xfx-form ( d spr xo -- n ) { 1 11 21 } bitfield ;
+: xo-form ( d a b oe rc xo -- n ) { 1 0 10 11 16 21 } bitfield ;
+
+: ADDI d-form 14 insn ;   : LI 0 rot ADDI ;   : SUBI neg ADDI ;
+: ADDIS d-form 15 insn ;  : LIS 0 rot ADDIS ;
+
+: ADDIC d-form 12 insn ;  : SUBIC neg ADDIC ;
+
+: ADDIC. d-form 13 insn ; : SUBIC. neg ADDIC. ;
+
+: MULI d-form 7 insn ;
+
+: (ADD) 266 xo-form 31 insn ;
+: ADD 0 0 (ADD) ;  : ADD. 0 1 (ADD) ;
+: ADDO 1 0 (ADD) ; : ADDO. 1 1 (ADD) ;
+
+: (ADDC) 10 xo-form 31 insn ;
+: ADDC 0 0 (ADDC) ;  : ADDC. 0 1 (ADDC) ;
+: ADDCO 1 0 (ADDC) ; : ADDCO. 1 1 (ADDC) ;
+
+: (ADDE) 138 xo-form 31 insn ;
+: ADDE 0 0 (ADDE) ;  : ADDE. 0 1 (ADDE) ;
+: ADDEO 1 0 (ADDE) ; : ADDEO. 1 1 (ADDE) ;
+
+: ANDI sd-form 28 insn ;
+: ANDIS sd-form 29 insn ;
+
+: (AND) 28 x-form 31 insn ;
+: AND 0 (AND) ;  : AND. 0 (AND) ;
+
+: (DIVW) 491 xo-form 31 insn ;
+: DIVW 0 0 (DIVW) ;  : DIVW. 0 1 (DIVW) ;
+: DIVWO 1 0 (DIVW) ; : DIVWO. 1 1 (DIVW) ;
+
+: (DIVWU) 459 xo-form 31 insn ;
+: DIVWU 0 0 (DIVWU) ;  : DIVWU. 0 1 (DIVWU) ;
+: DIVWUO 1 0 (DIVWU) ; : DIVWUO. 1 1 (DIVWU) ;
+
+: (EQV) 284 x-form 31 insn ;
+: EQV 0 (EQV) ;  : EQV. 1 (EQV) ;
+
+: (NAND) 476 x-form 31 insn ;
+: NAND 0 (NAND) ;  : NAND. 1 (NAND) ;
+
+: (NOR) 124 x-form 31 insn ;
+: NOR 0 (NOR) ;  : NOR. 1 (NOR) ;
+
+: NOT dup NOR ;   : NOT. dup NOR. ;
+
+: ORI sd-form 24 insn ;  : ORIS sd-form 25 insn ;
+
+: (OR) 444 x-form 31 insn ;
+: OR 0 (OR) ;  : OR. 1 (OR) ;
+
+: (ORC) 412 x-form 31 insn ;
+: ORC 0 (ORC) ;  : ORC. 1 (ORC) ;
+
+: MR dup OR ;  : MR. dup OR. ;
+
+: (MULHW) 75 xo-form 31 insn ;
+: MULHW 0 0 (MULHW) ;  : MULHW. 0 1 (MULHW) ;
+
+: MULLI d-form 7 insn ;
+
+: (MULHWU) 11 xo-form 31 insn ;
+: MULHWU 0 0 (MULHWU) ;  : MULHWU. 0 1 (MULHWU) ;
+
+: (MULLW) 235 xo-form 31 insn ;
+: MULLW 0 0 (MULLW) ;  : MULLW. 0 1 (MULLW) ;
+: MULLWO 1 0 (MULLW) ; : MULLWO. 1 1 (MULLW) ;
+
+: (SLW) 24 x-form 31 insn ;
+: SLW 0 (SLW) ;  : SLW. 1 (SLW) ;
+
+: (SRAW) 792 x-form 31 insn ;
+: SRAW 0 (SRAW) ;  : SRAW. 1 (SRAW) ;
+
+: (SRW) 536 x-form 31 insn ;
+: SRW 0 (SRW) ;  : SRW. 1 (SRW) ;
+
+: SRAWI 0 824 x-form 31 insn ;
+
+: (SUBF) 40 xo-form 31 insn ;
+: SUBF 0 0 (SUBF) ;  : SUBF. 0 1 (SUBF) ;
+: SUBFO 1 0 (SUBF) ; : SUBFO. 1 1 (SUBF) ;
+
+: (SUBFC) 8 xo-form 31 insn ;
+: SUBFC 0 0 (SUBFC) ;  : SUBFC. 0 1 (SUBFC) ;
+: SUBFCO 1 0 (SUBFC) ; : SUBFCO. 1 1 (SUBFC) ;
+
+: (SUBFE) 136 xo-form 31 insn ;
+: SUBFE 0 0 (SUBFE) ;  : SUBFE. 0 1 (SUBFE) ;
+: SUBFEO 1 0 (SUBFE) ; : SUBFEO. 1 1 (SUBFE) ;
+
+: (EXTSB) 0 swap 954 x-form 31 insn ;
+: EXTSB 0 (EXTSB) ;
+: EXTSB. 1 (EXTSB) ;
+
+: XORI sd-form 26 insn ;  : XORIS sd-form 27 insn ;
+
+: (XOR) 316 x-form 31 insn ;
+: XOR 0 (XOR) ;  : XOR. 1 (XOR) ;
+
+: CMPI d-form 11 insn ;
+: CMPLI d-form 10 insn ;
+
+: CMP 0 0 x-form 31 insn ;
+: CMPL 0 32 x-form 31 insn ;
+
+: (RLWINM) a-form 21 insn ;
+: RLWINM 0 (RLWINM) ;  : RLWINM. 1 (RLWINM) ;
+
+: (SLWI) 0 31 pick - ;
+: SLWI (SLWI) RLWINM ;  : SLWI. (SLWI) RLWINM. ;
+: (SRWI) 32 over - swap 31 ;
+: SRWI (SRWI) RLWINM ;  : SRWI. (SRWI) RLWINM. ;
+
+: LBZ d-form 34 insn ;  : LBZU d-form 35 insn ;
+: LHA d-form 42 insn ;  : LHAU d-form 43 insn ;
+: LHZ d-form 40 insn ;  : LHZU d-form 41 insn ;
+: LWZ d-form 32 insn ;  : LWZU d-form 33 insn ;
+
+: LBZX 0  87 x-form 31 insn ; : LBZUX 0 119 x-form 31 insn ;
+: LHAX 0 343 x-form 31 insn ; : LHAUX 0 375 x-form 31 insn ;
+: LHZX 0 279 x-form 31 insn ; : LHZUX 0 311 x-form 31 insn ;
+: LWZX 0  23 x-form 31 insn ; : LWZUX 0  55 x-form 31 insn ;
+
+: STB d-form 38 insn ;  : STBU d-form 39 insn ;
+: STH d-form 44 insn ;  : STHU d-form 45 insn ;
+: STW d-form 36 insn ;  : STWU d-form 37 insn ;
+
+: STBX 0 215 x-form 31 insn ; : STBUX 247 x-form 31 insn ;
+: STHX 0 407 x-form 31 insn ; : STHUX 439 x-form 31 insn ;
+: STWX 0 151 x-form 31 insn ; : STWUX 183 x-form 31 insn ;
+
+GENERIC# (B) 2 ( dest aa lk -- )
+M: integer (B) i-form 18 insn ;
+M: word (B) 0 -rot (B) rc-relative-ppc-3 rel-word ;
+M: label (B) 0 -rot (B) rc-relative-ppc-3 label-fixup ;
+
+: B 0 0 (B) ; : BL 0 1 (B) ;
+
+GENERIC: BC ( a b c -- )
+M: integer BC 0 0 b-form 16 insn ;
+M: word BC >r 0 BC r> rc-relative-ppc-2 rel-word ;
+M: label BC >r 0 BC r> rc-relative-ppc-2 label-fixup ;
+
+: BLT 12 0 rot BC ;  : BGE 4 0 rot BC ;
+: BGT 12 1 rot BC ;  : BLE 4 1 rot BC ;
+: BEQ 12 2 rot BC ;  : BNE 4 2 rot BC ;
+: BO  12 3 rot BC ;  : BNO 4 3 rot BC ;
+
+: BCLR 0 8 0 0 b-form 19 insn ;
+: BLR 20 BCLR ;
+: BCLRL 0 8 0 1 b-form 19 insn ;
+: BLRL 20 BCLRL ;
+: BCCTR 0 264 0 0 b-form 19 insn ;
+: BCTR 20 BCCTR ;
+
+: MFSPR 5 shift 339 xfx-form 31 insn ;
+: MFXER 1 MFSPR ;  : MFLR 8 MFSPR ;  : MFCTR 9 MFSPR ;
+
+: MTSPR 5 shift 467 xfx-form 31 insn ;
+: MTXER 1 MTSPR ;  : MTLR 8 MTSPR ;  : MTCTR 9 MTSPR ;
+
+: LOAD32 >r w>h/h r> tuck LIS dup rot ORI ;
+
+: LOAD ( n r -- )
+    #! PowerPC cannot load a 32 bit literal in one instruction.
+   >r dup -32768 32767 between? [ r> LI ] [ r> LOAD32 ] if ;
+
+! Floating point
+: LFS d-form 48 insn ;  : LFSU d-form 49 insn ;
+: LFD d-form 50 insn ;  : LFDU d-form 51 insn ;
+: STFS d-form 52 insn ; : STFSU d-form 53 insn ;
+: STFD d-form 54 insn ; : STFDU d-form 55 insn ;
+
+: (FMR) >r 0 -rot 72 r> x-form 63 insn ;
+: FMR 0 (FMR) ;  : FMR. 1 (FMR) ;
+
+: (FCTIWZ) >r 0 -rot r> 15 x-form 63 insn ;
+: FCTIWZ 0 (FCTIWZ) ;  : FCTIWZ. 1 (FCTIWZ) ;
+
+: (FADD) >r 0 21 r> a-form 63 insn ;
+: FADD 0 (FADD) ;  : FADD. 1 (FADD) ;
+
+: (FSUB) >r 0 20 r> a-form 63 insn ;
+: FSUB 0 (FSUB) ;  : FSUB. 1 (FSUB) ;
+
+: (FMUL) >r 0 swap 25 r> a-form 63 insn ;
+: FMUL 0 (FMUL) ;  : FMUL. 1 (FMUL) ;
+
+: (FDIV) >r 0 18 r> a-form 63 insn ;
+: FDIV 0 (FDIV) ;  : FDIV. 1 (FDIV) ;
+
+: (FSQRT) >r 0 swap 0 22 r> a-form 63 insn ;
+: FSQRT 0 (FSQRT) ;  : FSQRT. 1 (FSQRT) ;
+
+: FCMPU 0 0 x-form 63 insn ;
+: FCMPO 0 32 x-form 63 insn ;
diff --git a/core/cpu/ppc/assembler/authors.txt b/core/cpu/ppc/assembler/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/ppc/assembler/summary.txt b/core/cpu/ppc/assembler/summary.txt
new file mode 100644 (file)
index 0000000..336eaf9
--- /dev/null
@@ -0,0 +1 @@
+PowerPC assembler
diff --git a/core/cpu/ppc/authors.txt b/core/cpu/ppc/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/ppc/bootstrap.factor b/core/cpu/ppc/bootstrap.factor
new file mode 100644 (file)
index 0000000..7caaabc
--- /dev/null
@@ -0,0 +1,128 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: bootstrap.image.private kernel namespaces system
+cpu.ppc.assembler math math.functions layouts words vocabs ;
+IN: bootstrap.ppc
+
+4 \ cell set
+big-endian on
+
+4 jit-code-format set
+
+: ds-reg 14 ;
+
+: word-reg 3 ;
+: quot-reg 3 ;
+: scan-reg 5 ;
+: temp-reg 6 ;
+: xt-reg 11 ;
+
+: param-save-size 8 bootstrap-cells ;
+
+: local@
+    bootstrap-cells reserved-area-size param-save-size + + ;
+
+: array-save 0 local@ ;
+: scan-save 1 local@ ;
+: xt-save 2 local@ ;
+
+: stack-frame
+    3 local@ 4 bootstrap-cells align ;
+
+[
+    temp-reg quot-reg quot-array@ LWZ ! load array
+    scan-reg temp-reg scan@ ADDI      ! initialize scan pointer
+] { } make jit-setup set
+
+[
+    1 1 stack-frame neg STWU          ! store back link
+    0 MFLR                            ! load return address into r0
+    temp-reg 1 array-save STW         ! save array
+    xt-reg 1 xt-save STW              ! save XT
+    0 1 lr-save stack-frame + STW     ! save return address
+] { } make jit-prolog set
+
+[
+    temp-reg scan-reg 4 LWZU          ! load literal and advance
+    temp-reg ds-reg 4 STWU            ! push literal
+] { } make jit-push-literal set
+
+[
+    temp-reg scan-reg 4 LWZU          ! load wrapper and advance
+    temp-reg dup wrapper@ LWZ         ! load wrapped object
+    temp-reg ds-reg 4 STWU            ! push wrapped object
+] { } make jit-push-wrapper set
+
+[
+    4 1 MR                            ! pass stack pointer to primitive
+] { } make jit-word-primitive-jump set
+
+[
+    4 1 MR                            ! pass stack pointer to primitive
+] { } make jit-word-primitive-call set
+
+: load-xt ( -- )
+    xt-reg word-reg word-xt@ LWZ ;
+
+: jit-call
+    scan-reg 1 scan-save STW          ! save scan pointer
+    xt-reg MTLR                       ! pass XT to callee
+    BLRL                              ! call
+    scan-reg 1 scan-save LWZ          ! restore scan pointer
+    ;
+
+: jit-jump
+    xt-reg MTCTR BCTR ;
+
+[
+    word-reg scan-reg 4 LWZU          ! load word and advance
+    load-xt
+    jit-call
+] { } make jit-word-call set
+
+[
+    word-reg scan-reg 4 LWZ           ! load word
+    load-xt                           ! jump to word XT
+    jit-jump
+] { } make jit-word-jump set
+
+: load-branch
+    temp-reg ds-reg 0 LWZ             ! load boolean
+    0 temp-reg \ f tag-number CMPI    ! compare it with f
+    quot-reg scan-reg MR              ! point quot-reg at false branch
+    2 BNE                             ! skip next insn if its not f
+    quot-reg dup 4 ADDI               ! point quot-reg at true branch
+    quot-reg dup 4 LWZ                ! load the branch
+    ds-reg dup 4 SUBI                 ! pop boolean
+    scan-reg dup 12 ADDI              ! advance scan pointer
+    xt-reg quot-reg quot-xt@ LWZ      ! load quotation-xt
+    ;
+
+[
+    load-branch jit-jump
+] { } make jit-if-jump set
+
+[
+    load-branch jit-call
+] { } make jit-if-call set
+
+[
+    temp-reg ds-reg 0 LWZ             ! load index
+    temp-reg dup 1 SRAWI              ! turn it into an array offset
+    ds-reg dup 4 SUBI                 ! pop index
+    scan-reg dup 4 LWZ                ! load array
+    temp-reg dup scan-reg ADD         ! compute quotation location
+    quot-reg temp-reg array-start LWZ ! load quotation
+    xt-reg quot-reg quot-xt@ LWZ      ! load quotation-xt
+    jit-jump                          ! execute quotation
+] { } make jit-dispatch set
+
+[
+    0 1 lr-save stack-frame + LWZ     ! load return address
+    1 1 stack-frame ADDI              ! pop stack frame
+    0 MTLR                            ! get ready to return
+] { } make jit-epilog set
+
+[ BLR ] { } make jit-return set
+
+"bootstrap.ppc" forget-vocab
diff --git a/core/cpu/ppc/intrinsics/intrinsics.factor b/core/cpu/ppc/intrinsics/intrinsics.factor
new file mode 100644 (file)
index 0000000..97d866d
--- /dev/null
@@ -0,0 +1,712 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types arrays cpu.ppc.assembler
+cpu.ppc.architecture cpu.ppc.allot cpu.architecture kernel
+kernel.private math math.private namespaces sequences words
+generic quotations byte-arrays hashtables hashtables.private
+generator generator.registers generator.fixup sequences.private
+sbufs vectors system layouts math.functions math.floats.private
+classes tuples tuples.private sbufs.private vectors.private
+strings.private slots.private combinators bit-arrays
+float-arrays ;
+IN: cpu.ppc.intrinsics
+
+: %slot-literal-known-tag
+    "val" operand
+    "obj" operand
+    "n" get cells
+    "obj" operand-tag - ;
+
+: %slot-literal-any-tag
+    "obj" operand "scratch" operand %untag
+    "val" operand "scratch" operand "n" get cells ;
+
+: %slot-any
+    "obj" operand "scratch" operand %untag
+    "n" operand dup 1 SRAWI
+    "scratch" operand "val" operand "n" operand ;
+
+\ slot {
+    ! Slot number is literal and the tag is known
+    {
+        [ %slot-literal-known-tag LWZ ] H{
+            { +input+ { { f "obj" known-tag } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "val" } } }
+            { +output+ { "val" } }
+        }
+    }
+    ! Slot number is literal
+    {
+        [ %slot-literal-any-tag LWZ ] H{
+            { +input+ { { f "obj" } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "scratch" } { f "val" } } }
+            { +output+ { "val" } }
+        }
+    }
+    ! Slot number in a register
+    {
+        [ %slot-any LWZX ] H{
+            { +input+ { { f "obj" } { f "n" } } }
+            { +scratch+ { { f "val" } { f "scratch" } } }
+            { +output+ { "val" } }
+            { +clobber+ { "n" } }
+        }
+    }
+} define-intrinsics
+
+: load-cards-offset ( dest -- )
+    "cards_offset" f pick %load-dlsym  dup 0 LWZ ;
+
+: %write-barrier ( -- )
+    "val" operand-immediate? "obj" get fresh-object? or [
+        "obj" operand "scratch" operand card-bits SRWI
+        "val" operand load-cards-offset
+        "scratch" operand dup "val" operand ADD
+        "val" operand "scratch" operand 0 LBZ
+        "val" operand dup card-mark ORI
+        "val" operand "scratch" operand 0 STB
+    ] unless ;
+
+\ set-slot {
+    ! Slot number is literal and tag is known
+    {
+        [ %slot-literal-known-tag STW %write-barrier ] H{
+            { +input+ { { f "val" } { f "obj" known-tag } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "scratch" } } }
+            { +clobber+ { "val" } }
+        }
+    }
+    ! Slot number is literal
+    {
+        [ %slot-literal-any-tag STW %write-barrier ] H{
+            { +input+ { { f "val" } { f "obj" } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "scratch" } } }
+            { +clobber+ { "val" } }
+        }
+    }
+    ! Slot number is in a register
+    {
+        [ %slot-any STWX %write-barrier ] H{
+            { +input+ { { f "val" } { f "obj" } { f "n" } } }
+            { +scratch+ { { f "scratch" } } }
+            { +clobber+ { "val" "n" } }
+        }
+    }
+} define-intrinsics
+
+\ char-slot [
+    "out" operand "obj" operand MR
+    "n" operand dup 2 SRAWI
+    "n" operand "obj" operand "n" operand ADD
+    "out" operand "n" operand string-offset LHZ
+    "out" operand dup %tag-fixnum
+] H{
+    { +input+ { { f "n" } { f "obj" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+    { +clobber+ { "n" } }
+} define-intrinsic
+
+\ set-char-slot [
+    "val" operand dup %untag-fixnum
+    "slot" operand dup 2 SRAWI
+    "slot" operand dup "obj" operand ADD
+    "val" operand "slot" operand string-offset STH
+] H{
+    { +input+ { { f "val" } { f "slot" } { f "obj" } } }
+    { +clobber+ { "val" "slot" } }
+} define-intrinsic
+
+: fixnum-register-op ( op -- pair )
+    [ "out" operand "y" operand "x" operand ] swap add H{
+        { +input+ { { f "x" } { f "y" } } }
+        { +scratch+ { { f "out" } } }
+        { +output+ { "out" } }
+    } 2array ;
+
+: fixnum-value-op ( op -- pair )
+    [ "out" operand "x" operand "y" operand ] swap add H{
+        { +input+ { { f "x" } { [ small-tagged? ] "y" } } }
+        { +scratch+ { { f "out" } } }
+        { +output+ { "out" } }
+    } 2array ;
+
+: define-fixnum-op ( word imm-op reg-op -- )
+    >r fixnum-value-op r> fixnum-register-op 2array
+    define-intrinsics ;
+
+{
+    { fixnum+fast ADDI ADD }
+    { fixnum-fast SUBI SUBF }
+    { fixnum-bitand ANDI AND }
+    { fixnum-bitor ORI OR }
+    { fixnum-bitxor XORI XOR }
+} [
+    first3 define-fixnum-op
+] each
+
+\ fixnum*fast {
+    {
+        [
+            "out" operand "x" operand "y" get MULLI
+        ] H{
+            { +input+ { { f "x" } { [ small-tagged? ] "y" } } }
+            { +scratch+ { { f "out" } } }
+            { +output+ { "out" } }
+        }
+    } {
+        [
+            "out" operand "x" operand %untag-fixnum
+            "out" operand "y" operand "out" operand MULLW
+        ] H{
+            { +input+ { { f "x" } { f "y" } } }
+            { +scratch+ { { f "out" } } }
+            { +output+ { "out" } }
+        }
+    }
+} define-intrinsics
+
+\ fixnum-shift [
+    "out" operand "x" operand "y" get neg SRAWI
+    ! Mask off low bits
+    "out" operand dup %untag
+] H{
+    { +input+ { { f "x" } { [ -31 0 between? ] "y" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+: generate-fixnum-mod
+    #! PowerPC doesn't have a MOD instruction; so we compute
+    #! x-(x/y)*y. Puts the result in "s" operand.
+    "s" operand "r" operand "y" operand MULLW
+    "s" operand "s" operand "x" operand SUBF ;
+
+\ fixnum-mod [
+    ! divide x by y, store result in x
+    "r" operand "x" operand "y" operand DIVW
+    generate-fixnum-mod
+] H{
+    { +input+ { { f "x" } { f "y" } } }
+    { +scratch+ { { f "r" } { f "s" } } }
+    { +output+ { "s" } }
+} define-intrinsic
+
+\ fixnum-bitnot [
+    "x" operand dup NOT
+    "x" operand dup %untag
+] H{
+    { +input+ { { f "x" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+: fixnum-register-jump ( op -- pair )
+    [ "x" operand 0 "y" operand CMP ] swap add
+    { { f "x" } { f "y" } } 2array ;
+
+: fixnum-value-jump ( op -- pair )
+    [ 0 "x" operand "y" operand CMPI ] swap add
+    { { f "x" } { [ small-tagged? ] "y" } } 2array ;
+
+: define-fixnum-jump ( word op -- )
+    [ fixnum-value-jump ] keep fixnum-register-jump
+    2array define-if-intrinsics ;
+
+{
+    { fixnum< BLT }
+    { fixnum<= BLE }
+    { fixnum> BGT }
+    { fixnum>= BGE }
+    { eq? BEQ }
+} [
+    first2 define-fixnum-jump
+] each
+
+: %untag-fixnums ( seq -- )
+    [ dup %untag-fixnum ] unique-operands ;
+
+: overflow-check ( insn1 insn2 -- )
+    [
+        >r 0 0 LI
+        0 MTXER
+        "r" operand "y" operand "x" operand r> execute
+        >r
+        "end" define-label
+        "end" get BNO
+        { "x" "y" } %untag-fixnums
+        "r" operand "y" operand "x" operand r> execute
+        "r" get %allot-bignum-signed-1
+        "end" resolve-label
+    ] with-scope ; inline
+
+: overflow-template ( word insn1 insn2 -- )
+    [ overflow-check ] 2curry H{
+        { +input+ { { f "x" } { f "y" } } }
+        { +scratch+ { { f "r" } } }
+        { +output+ { "r" } }
+        { +clobber+ { "x" "y" } }
+    } define-intrinsic ;
+
+\ fixnum+ \ ADD \ ADDO. overflow-template
+\ fixnum- \ SUBF \ SUBFO. overflow-template
+
+: generate-fixnum/i
+    #! This VOP is funny. If there is an overflow, it falls
+    #! through to the end, and the result is in "x" operand.
+    #! Otherwise it jumps to the "no-overflow" label and the
+    #! result is in "r" operand.
+    "end" define-label
+    "no-overflow" define-label
+    "r" operand "x" operand "y" operand DIVW
+    ! if the result is greater than the most positive fixnum,
+    ! which can only ever happen if we do
+    ! most-negative-fixnum -1 /i, then the result is a bignum.
+    most-positive-fixnum "s" operand LOAD
+    "r" operand 0 "s" operand CMP
+    "no-overflow" get BLE
+    most-negative-fixnum neg "x" operand LOAD
+    "x" get %allot-bignum-signed-1 ;
+
+\ fixnum/i [
+    generate-fixnum/i
+    "end" get B
+    "no-overflow" resolve-label
+    "r" operand "x" operand %tag-fixnum
+    "end" resolve-label
+] H{
+    { +input+ { { f "x" } { f "y" } } }
+    { +scratch+ { { f "r" } { f "s" } } }
+    { +output+ { "x" } }
+    { +clobber+ { "y" } }
+} define-intrinsic
+
+\ fixnum/mod [
+    generate-fixnum/i
+    0 "s" operand LI
+    "end" get B
+    "no-overflow" resolve-label
+    generate-fixnum-mod
+    "r" operand "x" operand %tag-fixnum
+    "end" resolve-label
+] H{
+    { +input+ { { f "x" } { f "y" } } }
+    { +scratch+ { { f "r" } { f "s" } } }
+    { +output+ { "x" "s" } }
+    { +clobber+ { "y" } }
+} define-intrinsic
+
+\ fixnum>bignum [
+    "x" operand dup %untag-fixnum
+    "x" get %allot-bignum-signed-1
+] H{
+    { +input+ { { f "x" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+\ bignum>fixnum [
+    "nonzero" define-label
+    "positive" define-label
+    "end" define-label
+    "x" operand dup %untag
+    "y" operand "x" operand cell LWZ
+     ! if the length is 1, its just the sign and nothing else,
+     ! so output 0
+    0 "y" operand 1 v>operand CMPI
+    "nonzero" get BNE
+    0 "y" operand LI
+    "end" get B
+    "nonzero" resolve-label
+    ! load the value
+    "y" operand "x" operand 3 cells LWZ
+    ! load the sign
+    "x" operand "x" operand 2 cells LWZ
+    ! is the sign negative?
+    0 "x" operand 0 CMPI
+    "positive" get BEQ
+    "y" operand dup -1 MULI
+    "positive" resolve-label
+    "y" operand dup %tag-fixnum
+    "end" resolve-label
+] H{
+    { +input+ { { f "x" } } }
+    { +scratch+ { { f "y" } } }
+    { +clobber+ { "x" } }
+    { +output+ { "y" } }
+} define-intrinsic
+
+: define-float-op ( word op -- )
+    [ "x" operand "x" operand "y" operand ] swap add H{
+        { +input+ { { float "x" } { float "y" } } }
+        { +output+ { "x" } }
+    } define-intrinsic ;
+
+{
+    { float+ FADD }
+    { float- FSUB }
+    { float* FMUL }
+    { float/f FDIV }
+} [
+    first2 define-float-op
+] each
+
+: define-float-jump ( word op -- )
+    [ "x" operand 0 "y" operand FCMPU ] swap add
+    { { float "x" } { float "y" } } define-if-intrinsic ;
+
+{
+    { float< BLT }
+    { float<= BLE }
+    { float> BGT }
+    { float>= BGE }
+    { float= BEQ }
+} [
+    first2 define-float-jump
+] each
+
+\ float>fixnum [
+    "scratch" operand "in" operand FCTIWZ
+    "scratch" operand 1 0 param@ STFD
+    "out" operand 1 cell param@ LWZ
+    "out" operand dup %tag-fixnum
+] H{
+    { +input+ { { float "in" } } }
+    { +scratch+ { { float "scratch" } { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+! \ fsqrt [
+!     "y" operand "x" operand FSQRT
+! ] H{
+!     { +input+ { { float "x" } } }
+!     { +scratch+ { { float "y" } } }
+!     { +output+ { "y" } }
+! } define-intrinsic
+
+\ tag [
+    "out" operand "in" operand tag-mask get ANDI
+    "out" operand dup %tag-fixnum
+] H{
+    { +input+ { { f "in" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ type [
+    "end" define-label
+    ! Get the tag
+    "y" operand "obj" operand tag-mask get ANDI
+    ! Tag the tag
+    "y" operand "x" operand %tag-fixnum
+    ! Compare with object tag number (3).
+    0 "y" operand object tag-number CMPI
+    ! Jump if the object doesn't store type info in its header
+    "end" get BNE
+    ! It does store type info in its header
+    "x" operand "obj" operand header-offset LWZ
+    "end" resolve-label
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "x" } { f "y" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+\ class-hash [
+    "end" define-label
+    "tuple" define-label
+    "object" define-label
+    ! Get the tag
+    "y" operand "obj" operand tag-mask get ANDI
+    ! Compare with tuple tag number (2).
+    0 "y" operand tuple tag-number CMPI
+    "tuple" get BEQ
+    ! Compare with object tag number (3).
+    0 "y" operand object tag-number CMPI
+    "object" get BEQ
+    ! Tag the tag
+    "y" operand "x" operand %tag-fixnum
+    "end" get B
+    "object" get resolve-label
+    ! Load header type
+    "x" operand "obj" operand header-offset LWZ
+    "end" get B
+    "tuple" get resolve-label
+    ! Load class hash
+    "x" operand "obj" operand tuple-class-offset LWZ
+    "x" operand dup class-hash-offset LWZ
+    "end" resolve-label
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "x" } { f "y" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+: userenv ( reg -- )
+    #! Load the userenv pointer in a register.
+    "userenv" f rot %load-dlsym ;
+
+\ getenv [
+    "n" operand dup 1 SRAWI
+    "x" operand userenv
+    "x" operand "n" operand "x" operand ADD
+    "x" operand dup 0 LWZ
+] H{
+    { +input+ { { f "n" } } }
+    { +scratch+ { { f "x" } } }
+    { +output+ { "x" } }
+    { +clobber+ { "n" } }
+} define-intrinsic
+
+\ setenv [
+    "n" operand dup 1 SRAWI
+    "x" operand userenv
+    "x" operand "n" operand "x" operand ADD
+    "val" operand "x" operand 0 STW
+] H{
+    { +input+ { { f "val" } { f "n" } } }
+    { +scratch+ { { f "x" } } }
+    { +clobber+ { "n" } }
+} define-intrinsic
+
+\ <tuple> [
+    tuple "n" get 2 + cells %allot
+    ! Store length
+    "n" operand 12 LI
+    12 11 cell STW
+    ! Store class
+    "class" operand 11 2 cells STW
+    ! Zero out the rest of the tuple
+    f v>operand 12 LI
+    "n" get 1- [ 12 11 rot 3 + cells STW ] each
+    ! Store tagged ptr in reg
+    "tuple" get tuple %store-tagged
+] H{
+    { +input+ { { f "class" } { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "tuple" } } }
+    { +output+ { "tuple" } }
+} define-intrinsic
+
+\ <array> [
+    array "n" get 2 + cells %allot
+    ! Store length
+    "n" operand 12 LI
+    12 11 cell STW
+    ! Store initial element
+    "n" get [ "initial" operand 11 rot 2 + cells STW ] each
+    ! Store tagged ptr in reg
+    "array" get object %store-tagged
+] H{
+    { +input+ { { [ inline-array? ] "n" } { f "initial" } } }
+    { +scratch+ { { f "array" } } }
+    { +output+ { "array" } }
+} define-intrinsic
+
+\ <byte-array> [
+    byte-array "n" get 2 cells + %allot
+    ! Store length
+    "n" operand 12 LI
+    12 11 cell STW
+    ! Store initial element
+    0 12 LI
+    "n" get cell align cell /i [ 12 11 rot 2 + cells STW ] each
+    ! Store tagged ptr in reg
+    "array" get object %store-tagged
+] H{
+    { +input+ { { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "array" } } }
+    { +output+ { "array" } }
+} define-intrinsic
+
+\ <ratio> [
+    ratio 3 cells %allot
+    "numerator" operand 11 1 cells STW
+    "denominator" operand 11 2 cells STW
+    ! Store tagged ptr in reg
+    "ratio" get ratio %store-tagged
+] H{
+    { +input+ { { f "numerator" } { f "denominator" } } }
+    { +scratch+ { { f "ratio" } } }
+    { +output+ { "ratio" } }
+} define-intrinsic
+
+\ <complex> [
+    complex 3 cells %allot
+    "real" operand 11 1 cells STW
+    "imaginary" operand 11 2 cells STW
+    ! Store tagged ptr in reg
+    "complex" get complex %store-tagged
+] H{
+    { +input+ { { f "real" } { f "imaginary" } } }
+    { +scratch+ { { f "complex" } } }
+    { +output+ { "complex" } }
+} define-intrinsic
+
+\ <wrapper> [
+    wrapper 2 cells %allot
+    "obj" operand 11 1 cells STW
+    ! Store tagged ptr in reg
+    "wrapper" get object %store-tagged
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "wrapper" } } }
+    { +output+ { "wrapper" } }
+} define-intrinsic
+
+\ (hashtable) [
+    hashtable 4 cells %allot
+    f v>operand 12 LI
+    12 11 1 cells STW
+    12 11 2 cells STW
+    12 11 3 cells STW
+    ! Store tagged ptr in reg
+    "hashtable" get object %store-tagged
+] H{
+    { +scratch+ { { f "hashtable" } } }
+    { +output+ { "hashtable" } }
+} define-intrinsic
+
+\ string>sbuf [
+    sbuf 3 cells %allot
+    "length" operand 11 1 cells STW
+    "string" operand 11 2 cells STW
+    ! Store tagged ptr in reg
+    "sbuf" get object %store-tagged
+] H{
+    { +input+ { { f "string" } { f "length" } } }
+    { +scratch+ { { f "sbuf" } } }
+    { +output+ { "sbuf" } }
+} define-intrinsic
+
+\ array>vector [
+    vector 3 cells %allot
+    "length" operand 11 1 cells STW
+    "array" operand 11 2 cells STW
+    ! Store tagged ptr in reg
+    "vector" get object %store-tagged
+] H{
+    { +input+ { { f "array" } { f "length" } } }
+    { +scratch+ { { f "vector" } } }
+    { +output+ { "vector" } }
+} define-intrinsic
+
+\ curry [
+    \ curry 3 cells %allot
+    "obj" operand 11 1 cells STW
+    "quot" operand 11 2 cells STW
+    ! Store tagged ptr in reg
+    "curry" get object %store-tagged
+] H{
+    { +input+ { { f "obj" } { f "quot" } } }
+    { +scratch+ { { f "curry" } } }
+    { +output+ { "curry" } }
+} define-intrinsic
+
+! Alien intrinsics
+: alien-integer-get-template
+    H{
+        { +input+ {
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { f "output" } } }
+        { +output+ { "output" } }
+        { +clobber+ { "offset" } }
+    } ;
+
+: %alien-get ( quot -- )
+    "output" get "address" set
+    "offset" operand dup %untag-fixnum
+    "output" operand "alien" operand-class %alien-accessor ;
+
+: %alien-integer-get ( quot -- )
+    %alien-get
+    "output" operand dup %tag-fixnum ; inline
+
+: %alien-integer-set ( quot -- )
+    { "offset" "value" } %untag-fixnums
+    "value" operand "alien" operand-class %alien-accessor ; inline
+
+: alien-integer-set-template
+    H{
+        { +input+ {
+            { f "value" fixnum }
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { f "address" } } }
+        { +clobber+ { "value" "offset" } }
+    } ;
+
+: define-alien-integer-intrinsics ( word get-quot word set-quot -- )
+    [ %alien-integer-set ] curry
+    alien-integer-set-template
+    define-intrinsic
+    [ %alien-integer-get ] curry
+    alien-integer-get-template
+    define-intrinsic ;
+
+\ alien-unsigned-1 [ LBZ ]
+\ set-alien-unsigned-1 [ STB ]
+define-alien-integer-intrinsics
+
+\ alien-signed-1 [ pick >r LBZ r> dup EXTSB ]
+\ set-alien-signed-1 [ STB ]
+define-alien-integer-intrinsics
+
+\ alien-unsigned-2 [ LHZ ]
+\ set-alien-unsigned-2 [ STH ]
+define-alien-integer-intrinsics
+
+\ alien-signed-2 [ LHA ]
+\ set-alien-signed-2 [ STH ]
+define-alien-integer-intrinsics
+
+: %alien-float-get ( quot -- )
+    "offset" operand dup %untag-fixnum
+    "output" operand "alien" operand-class %alien-accessor ; inline
+
+: alien-float-get-template
+    H{
+        { +input+ {
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { float "output" } { f "address" } } }
+        { +output+ { "output" } }
+        { +clobber+ { "offset" } }
+    } ;
+
+: %alien-float-set ( quot -- )
+    "offset" operand dup %untag-fixnum
+    "value" operand "alien" operand-class %alien-accessor ; inline
+
+: alien-float-set-template
+    H{
+        { +input+ {
+            { float "value" float }
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { f "address" } } }
+        { +clobber+ { "offset" } }
+    } ;
+
+: define-alien-float-intrinsics ( word get-quot word set-quot -- )
+    [ %alien-float-set ] curry
+    alien-float-set-template
+    define-intrinsic
+    [ %alien-float-get ] curry
+    alien-float-get-template
+    define-intrinsic ;
+
+\ alien-double [ LFD ]
+\ set-alien-double [ STFD ]
+define-alien-float-intrinsics
+
+\ alien-float [ LFS ]
+\ set-alien-float [ STFS ]
+define-alien-float-intrinsics
+
+\ alien-cell [
+    [ LWZ ] %alien-get
+    "output" get %allot-alien
+] alien-integer-get-template define-intrinsic
diff --git a/core/cpu/ppc/linux/bootstrap.factor b/core/cpu/ppc/linux/bootstrap.factor
new file mode 100644 (file)
index 0000000..32491f9
--- /dev/null
@@ -0,0 +1,9 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: parser layouts system ;
+IN: bootstrap.ppc
+
+: reserved-area-size 2 bootstrap-cells ;
+: lr-save bootstrap-cell ;
+
+"resource:core/cpu/ppc/bootstrap.factor" run-file
diff --git a/core/cpu/ppc/macosx/bootstrap.factor b/core/cpu/ppc/macosx/bootstrap.factor
new file mode 100644 (file)
index 0000000..4909c86
--- /dev/null
@@ -0,0 +1,9 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: parser layouts system ;
+IN: bootstrap.ppc
+
+: reserved-area-size 6 bootstrap-cells ;
+: lr-save 2 bootstrap-cells ;
+
+"resource:core/cpu/ppc/bootstrap.factor" run-file
diff --git a/core/cpu/ppc/ppc.factor b/core/cpu/ppc/ppc.factor
new file mode 100644 (file)
index 0000000..460ce26
--- /dev/null
@@ -0,0 +1,15 @@
+USING: cpu.ppc.architecture cpu.ppc.intrinsics cpu.architecture
+namespaces alien.c-types kernel system combinators ;
+
+{
+    { [ macosx? ] [
+        4 "longlong" c-type set-c-type-align
+        4 "ulonglong" c-type set-c-type-align
+    ] }
+    { [ os "linux" = ] [
+        t "longlong" c-type set-c-type-stack-align?
+        t "ulonglong" c-type set-c-type-stack-align?
+    ] }
+} cond
+
+T{ ppc-backend } compiler-backend set-global
diff --git a/core/cpu/ppc/summary.txt b/core/cpu/ppc/summary.txt
new file mode 100644 (file)
index 0000000..9850905
--- /dev/null
@@ -0,0 +1 @@
+32-bit PowerPC compiler backend
diff --git a/core/cpu/summary.txt b/core/cpu/summary.txt
new file mode 100644 (file)
index 0000000..e2dcc98
--- /dev/null
@@ -0,0 +1 @@
+Compiler backends, emulators, and other process-specific code
diff --git a/core/cpu/tags.txt b/core/cpu/tags.txt
new file mode 100644 (file)
index 0000000..86a7c8e
--- /dev/null
@@ -0,0 +1 @@
+compiler
diff --git a/core/cpu/x86/32/32.factor b/core/cpu/x86/32/32.factor
new file mode 100644 (file)
index 0000000..9b7597d
--- /dev/null
@@ -0,0 +1,284 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types arrays cpu.x86.assembler
+cpu.x86.architecture cpu.x86.intrinsics cpu.x86.allot
+cpu.architecture kernel kernel.private math namespaces sequences
+generator.registers generator.fixup generator system
+math.functions alien.compiler combinators command-line
+compiler io vocabs.loader ;
+IN: cpu.x86.32
+
+! We implement the FFI for Linux, OS X and Windows all at once.
+! OS X requires that the stack be 16-byte aligned, and we do
+! this on all platforms, sacrificing some stack space for
+! code simplicity.
+
+M: x86-backend ds-reg ESI ;
+M: x86-backend rs-reg EDI ;
+M: x86-backend stack-reg ESP ;
+M: x86-backend frame-reg EBP ;
+M: x86-backend xt-reg EDX ;
+M: x86-backend stack-save-reg EDX ;
+
+M: temp-reg v>operand drop EBX ;
+
+M: x86-backend %alien-invoke ( symbol dll -- )
+    (CALL) rel-dlsym ;
+
+! On x86, parameters are never passed in registers.
+M: int-regs return-reg drop EAX ;
+M: int-regs param-regs drop { } ;
+M: int-regs vregs drop { EAX ECX EDX EBP } ;
+M: int-regs push-return-reg return-reg PUSH ;
+: load/store-int-return return-reg stack-reg rot [+] ;
+M: int-regs load-return-reg load/store-int-return MOV ;
+M: int-regs store-return-reg load/store-int-return swap MOV ;
+
+M: float-regs param-regs drop { } ;
+M: float-regs vregs drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ;
+
+: FSTP 4 = [ FSTPS ] [ FSTPL ] if ;
+
+M: float-regs push-return-reg
+    stack-reg swap reg-size [ SUB  stack-reg [] ] keep FSTP ;
+
+: FLD 4 = [ FLDS ] [ FLDL ] if ;
+
+: load/store-float-return reg-size >r stack-reg swap [+] r> ;
+M: float-regs load-return-reg load/store-float-return FLD ;
+M: float-regs store-return-reg load/store-float-return FSTP ;
+
+: align-sub ( n -- )
+    dup 16 align swap - ESP swap SUB ;
+
+: align-add ( n -- )
+    16 align ESP swap ADD ;
+
+: with-aligned-stack ( n quot -- )
+    swap dup align-sub slip align-add ; inline
+
+! On x86, we can always use an address as an operand
+! directly.
+M: x86-backend address-operand ;
+
+M: x86-backend fixnum>slot@ 1 SHR ;
+
+M: x86-backend prepare-division CDQ ;
+
+M: x86-backend load-indirect
+    0 [] MOV rc-absolute-cell rel-literal ;
+
+M: object %load-param-reg 3drop ;
+
+M: object %save-param-reg 3drop ;
+
+M: x86-backend %prepare-unbox ( -- )
+    #! Move top of data stack to EAX.
+    EAX ESI [] MOV
+    ESI 4 SUB ;
+
+: (%unbox) ( func -- )
+    4 [
+        ! Push parameter
+        EAX PUSH
+        ! Call the unboxer
+        f %alien-invoke
+    ] with-aligned-stack ;
+
+M: x86-backend %unbox ( n reg-class 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.
+    (%unbox)
+    ! Store the return value on the C stack
+    over [ store-return-reg ] [ 2drop ] if ;
+
+M: x86-backend %unbox-long-long ( n func -- )
+    (%unbox)
+    ! Store the return value on the C stack
+    [
+        dup stack@ EAX MOV
+        cell + stack@ EDX MOV
+    ] when* ;
+
+M: x86-backend %unbox-struct-2
+    #! Alien must be in EAX.
+    4 [
+        EAX PUSH
+        "alien_offset" f %alien-invoke
+        ! Load second cell
+        EDX EAX 4 [+] MOV
+        ! Load first cell
+        EAX EAX [] MOV
+    ] with-aligned-stack ;
+
+M: x86-backend %unbox-large-struct ( n size -- )
+    #! Alien must be in EAX.
+    ! Compute destination address
+    ECX ESP roll [+] LEA
+    12 [
+        ! Push struct size
+        PUSH
+        ! Push destination address
+        ECX PUSH
+        ! Push source address
+        EAX PUSH
+        ! Copy the struct to the stack
+        "to_value_struct" f %alien-invoke
+    ] with-aligned-stack ;
+
+: box@ ( n reg-class -- stack@ )
+    #! Used for callbacks; we want to box the values given to
+    #! us by the C function caller. Computes stack location of
+    #! nth parameter; note that we must go back one more stack
+    #! frame, since %box sets one up to call the one-arg boxer
+    #! function. The size of this stack frame so far depends on
+    #! the reg-class of the boxer's arg.
+    reg-size neg + stack-frame* + 20 + ;
+
+: (%box) ( n reg-class -- )
+    #! 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 [ [ box@ ] keep [ load-return-reg ] keep ] [ nip ] if
+    push-return-reg ;
+
+M: x86-backend %box ( n reg-class func -- )
+    over reg-size [
+        >r (%box) r> f %alien-invoke
+    ] with-aligned-stack ;
+    
+: (%box-long-long)
+    #! If n is f, push the return registers onto the stack; we
+    #! are boxing a return value of a C function. If n is an
+    #! integer, push [ESP+n]:[ESP+n+4] on the stack; we are
+    #! boxing a parameter being passed to a callback from C.
+    [
+        T{ int-regs } box@
+        EDX over stack@ MOV
+        EAX swap cell - stack@ MOV 
+    ] when*
+    EDX PUSH
+    EAX PUSH ;
+
+M: x86-backend %box-long-long ( n func -- )
+    8 [
+        >r (%box-long-long) r> f %alien-invoke
+    ] with-aligned-stack ;
+
+M: x86-backend %box-large-struct ( n size -- )
+    ! Compute destination address
+    [ swap struct-return@ ] keep
+    ECX ESP roll [+] LEA
+    8 [
+        ! Push struct size
+        PUSH
+        ! Push destination address
+        ECX PUSH
+        ! Copy the struct from the C stack
+        "box_value_struct" f %alien-invoke
+    ] with-aligned-stack ;
+
+M: x86-backend %prepare-box-struct ( size -- )
+    ! Compute target address for value struct return
+    EAX ESP rot f struct-return@ [+] LEA
+    ! Store it as the first parameter
+    ESP [] EAX MOV ;
+
+M: x86-backend %unbox-struct-1
+    #! Alien must be in EAX.
+    4 [
+        EAX PUSH
+        "alien_offset" f %alien-invoke
+        ! Load first cell
+        EAX EAX [] MOV
+    ] with-aligned-stack ;
+
+M: x86-backend %box-small-struct ( size -- )
+    #! Box a <= 8-byte struct returned in EAX:DX. OS X only.
+    12 [
+        PUSH
+        EDX PUSH
+        EAX PUSH
+        "box_small_struct" f %alien-invoke
+    ] with-aligned-stack ;
+
+M: x86-backend %prepare-alien-indirect ( -- )
+    "unbox_alien" f %alien-invoke
+    ESP cell temp@ [+] EAX MOV ;
+
+M: x86-backend %alien-indirect ( -- )
+    ESP cell temp@ [+] CALL ;
+
+M: x86-backend %alien-callback ( quot -- )
+    4 [
+        EAX load-indirect
+        EAX PUSH
+        "c_to_factor" f %alien-invoke
+    ] with-aligned-stack ;
+
+M: x86-backend %callback-value ( ctype -- )
+    ! Align C stack
+    ESP 12 SUB
+    ! Save top of data stack
+    %prepare-unbox
+    EAX PUSH
+    ! Restore data/call/retain stacks
+    "unnest_stacks" f %alien-invoke
+    ! Place top of data stack in EAX
+    EAX POP
+    ! Restore C stack
+    ESP 12 ADD
+    ! Unbox EAX
+    unbox-return ;
+
+M: x86-backend %cleanup ( alien-node -- )
+    #! 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.
+    {
+        {
+            [ dup alien-node-abi "stdcall" = ]
+            [ alien-stack-frame ESP swap SUB ]
+        } {
+            [ dup alien-node-return large-struct? ]
+            [ drop EAX PUSH ]
+        } {
+            [ t ] [ drop ]
+        }
+    } cond ;
+
+M: x86-backend %unwind ( n -- ) %epilogue-later RET ;
+
+windows? [
+    cell "longlong" c-type set-c-type-align
+    cell "ulonglong" c-type set-c-type-align
+] unless
+
+T{ x86-backend f 4 } compiler-backend set-global
+
+: sse2? "Intrinsic" throw ;
+
+\ sse2? [
+    { EAX EBX ECX EDX } [ PUSH ] each
+    EAX 1 MOV
+    CPUID
+    EDX 26 SHR
+    EDX 1 AND
+    { EAX EBX ECX EDX } [ POP ] each
+    JNE
+] { } define-if-intrinsic
+
+"-no-sse2" cli-args member? [
+    "Checking if your CPU supports SSE2..." print flush
+    [ sse2? ] compile-1 [
+        " - yes" print
+        "cpu.x86.sse2" require
+    ] [
+        " - no" print
+    ] if
+] unless
diff --git a/core/cpu/x86/32/bootstrap.factor b/core/cpu/x86/32/bootstrap.factor
new file mode 100644 (file)
index 0000000..71478f4
--- /dev/null
@@ -0,0 +1,106 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: bootstrap.image.private kernel namespaces system
+cpu.x86.assembler layouts vocabs ;
+IN: bootstrap.x86.32
+
+4 \ cell set
+big-endian off
+
+1 jit-code-format set
+
+: ds-reg ESI ;
+: scan-reg EBX ;
+: xt-reg ECX ;
+: scan-save ESP 12 [+] ;
+
+[
+    EAX EAX quot-array@ [+] MOV             ! load array
+    scan-reg EAX 1 [+] LEA                  ! initialize scan pointer
+] { } make jit-setup set
+
+[
+    EBP ESP -48 [+] LEA                     ! compute forward chain pointer
+    EBP PUSH                                ! save forward chain pointer
+    xt-reg PUSH                             ! save XT
+    EAX PUSH                                ! save array
+    ESP 16 SUB                              ! reserve space for scan-save
+] { } make jit-prolog set
+
+: advance-scan scan-reg 4 ADD ;
+
+[
+    advance-scan
+    ds-reg 4 ADD                            ! increment datastack pointer
+    EAX scan-reg [] MOV                     ! load literal
+    ds-reg [] EAX MOV                       ! store literal on datastack
+] { } make jit-push-literal set
+
+[
+    advance-scan
+    ds-reg 4 ADD                            ! increment datastack pointer
+    EAX scan-reg [] MOV                     ! load wrapper
+    EAX dup wrapper@ [+] MOV                ! load wrapper-obj slot
+    ds-reg [] EAX MOV                       ! store literal on datastack
+] { } make jit-push-wrapper set
+
+[
+    EDX ESP MOV                             ! pass callstack pointer as arg 2
+] { } make jit-word-primitive-jump set
+
+[
+    EDX ESP -4 [+] LEA                      ! pass callstack pointer as arg 2
+] { } make jit-word-primitive-call set
+
+[
+    EAX scan-reg 4 [+] MOV                  ! load word
+    EAX word-xt@ [+] JMP                    ! jump to word XT
+] { } make jit-word-jump set
+
+[
+    advance-scan
+    scan-save scan-reg MOV                  ! save scan pointer
+    EAX scan-reg [] MOV                     ! load word
+    EAX word-xt@ [+] CALL                   ! call word XT
+    scan-reg scan-save MOV                  ! restore scan pointer
+] { } make jit-word-call set
+
+: load-branch
+    EAX ds-reg [] MOV                       ! load boolean
+    ds-reg 4 SUB                            ! pop boolean
+    EAX \ f tag-number CMP                  ! compare it with f
+    EAX scan-reg 8 [+] CMOVE                ! load false branch if equal
+    EAX scan-reg 4 [+] CMOVNE               ! load true branch if not equal
+    scan-reg 12 ADD                         ! advance scan pointer
+    xt-reg EAX quot-xt@ [+] MOV             ! load quotation-xt
+    ;
+
+[
+    load-branch
+    xt-reg JMP
+] { } make jit-if-jump set
+
+[
+    load-branch
+    ESP [] scan-reg MOV                     ! save scan pointer
+    xt-reg CALL                             ! call quotation
+    scan-reg ESP [] MOV                     ! restore scan pointer
+] { } make jit-if-call set
+
+[
+    EAX ds-reg [] MOV                       ! load index
+    EAX 1 SAR                               ! turn it into an array offset
+    ds-reg 4 SUB                            ! pop index
+    EAX scan-reg 4 [+] ADD                  ! compute quotation location
+    EAX EAX array-start [+] MOV             ! load quotation
+    xt-reg EAX quot-xt@ [+] MOV             ! load quotation-xt
+    xt-reg JMP                              ! execute quotation
+] { } make jit-dispatch set
+
+[
+    ESP 28 ADD                              ! unwind stack frame
+] { } make jit-epilog set
+
+[ 0 RET ] { } make jit-return set
+
+"bootstrap.x86.32" forget-vocab
diff --git a/core/cpu/x86/64/64.factor b/core/cpu/x86/64/64.factor
new file mode 100644 (file)
index 0000000..1625a56
--- /dev/null
@@ -0,0 +1,175 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types arrays cpu.x86.assembler
+cpu.x86.architecture cpu.x86.intrinsics cpu.x86.sse2
+cpu.x86.allot cpu.architecture kernel kernel.private math
+namespaces sequences generator.registers generator.fixup system
+alien ;
+IN: cpu.x86.64
+
+PREDICATE: x86-backend amd64-backend
+    x86-backend-cell 8 = ;
+
+M: amd64-backend ds-reg R14 ;
+M: amd64-backend rs-reg R15 ;
+M: amd64-backend stack-reg RSP ;
+
+M: temp-reg v>operand drop R11 ;
+
+M: int-regs return-reg drop RAX ;
+M: int-regs vregs drop { RAX RCX RDX RSI RDI RBP R8 R9 R10 } ;
+M: int-regs param-regs drop { RDI RSI RDX RCX R8 R9 } ;
+
+M: float-regs return-reg drop XMM0 ;
+
+M: float-regs vregs
+    drop {
+        XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7
+        XMM8 XMM9 XMM10 XMM11 XMM12 XMM13 XMM14 XMM15
+    } ;
+
+M: float-regs param-regs
+    drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ;
+
+M: amd64-backend address-operand ( address -- operand )
+    #! On AMD64, we have to load 64-bit addresses into a
+    #! scratch register first. The usage of R11 here is a hack.
+    #! This word can only be called right before a subroutine
+    #! call, where all vregs have been flushed anyway.
+    temp-reg v>operand [ swap MOV ] keep ;
+
+: compile-c-call ( symbol dll -- )
+    0 address-operand >r rc-absolute-cell rel-dlsym r> CALL ;
+
+M: amd64-backend fixnum>slot@ drop ;
+
+M: amd64-backend prepare-division CQO ;
+
+M: amd64-backend load-indirect ( literal reg -- )
+    0 [] MOV rc-relative rel-literal ;
+
+M: stack-params %load-param-reg
+    drop
+    >r temp-reg v>operand swap stack@ MOV
+    r> stack@ temp-reg v>operand MOV ;
+
+M: stack-params %save-param-reg
+    >r stack-frame* + cell + swap r> %load-param-reg ;
+
+M: amd64-backend %prepare-unbox ( -- )
+    ! First parameter is top of stack
+    RDI R14 [] MOV
+    R14 cell SUB ;
+
+M: amd64-backend %unbox ( n reg-class func -- )
+    ! Call the unboxer
+    f compile-c-call
+    ! Store the return value on the C stack
+    over [ [ return-reg ] keep %save-param-reg ] [ 2drop ] if ;
+
+M: amd64-backend %unbox-long-long ( n func -- )
+    T{ int-regs } swap %unbox ;
+
+M: amd64-backend %unbox-struct-1 ( -- )
+    #! Alien must be in RDI.
+    "alien_offset" f compile-c-call
+    ! Load first cell
+    RAX RAX [] MOV ;
+
+M: amd64-backend %unbox-struct-2 ( -- )
+    #! Alien must be in RDI.
+    "alien_offset" f compile-c-call
+    ! Load second cell
+    RDX RAX cell [+] MOV
+    ! Load first cell
+    RAX RAX [] MOV ;
+
+M: amd64-backend %unbox-large-struct ( n size -- )
+    ! Source is in RDI
+    ! Load destination address
+    RSI RSP roll [+] LEA
+    ! Load structure size
+    RDX swap MOV
+    ! Copy the struct to the C stack
+    "to_value_struct" f compile-c-call ;
+
+: load-return-value ( reg-class -- )
+    0 over param-reg swap return-reg
+    2dup eq? [ 2drop ] [ MOV ] if ;
+
+M: amd64-backend %box ( n reg-class func -- )
+    rot [
+        rot [ 0 swap param-reg ] keep %load-param-reg
+    ] [
+        swap load-return-value
+    ] if*
+    f compile-c-call ;
+
+M: amd64-backend %box-long-long ( n func -- )
+    T{ int-regs } swap %box ;
+
+M: amd64-backend struct-small-enough? ( size -- ? ) 2 cells <= ;
+
+M: amd64-backend %box-small-struct ( size -- )
+    #! Box a <= 16-byte struct returned in RAX:RDX.
+    RDI RAX MOV
+    RSI RDX MOV
+    RDX swap MOV
+    "box_small_struct" f compile-c-call ;
+
+M: amd64-backend %box-large-struct ( n size -- )
+    ! Struct size is parameter 2
+    RSI over MOV
+    ! Compute destination address
+    swap struct-return@ RDI RSP rot [+] LEA
+    ! Copy the struct from the C stack
+    "box_value_struct" f compile-c-call ;
+
+M: amd64-backend %prepare-box-struct ( size -- )
+    ! Compute target address for value struct return
+    RAX RSP rot f struct-return@ [+] LEA
+    RSP 0 [+] RAX MOV ;
+
+: reset-sse RAX RAX XOR ;
+
+M: amd64-backend %alien-invoke ( symbol dll -- )
+    reset-sse compile-c-call ;
+
+M: amd64-backend %prepare-alien-indirect ( -- )
+    "unbox_alien" f compile-c-call
+    cell temp@ RAX MOV ;
+
+M: amd64-backend %alien-indirect ( -- )
+    reset-sse
+    cell temp@ CALL ;
+
+M: amd64-backend %alien-callback ( quot -- )
+    RDI load-indirect "run_callback" f compile-c-call ;
+
+M: amd64-backend %callback-value ( ctype -- )
+    ! Save top of data stack
+    %prepare-unbox
+    ! Put former top of data stack in RDI
+    temp@ RDI MOV
+    ! Restore data/call/retain stacks
+    "unnest_stacks" f %alien-invoke
+    ! Put former top of data stack in RDI
+    RDI temp@ MOV
+    ! Unbox former top of data stack to return registers
+    unbox-return ;
+
+M: amd64-backend %cleanup ( alien-node -- ) drop ;
+
+M: amd64-backend %unwind ( n -- ) drop %epilogue-later 0 RET ;
+
+USE: cpu.x86.intrinsics
+
+! On 64-bit systems, the result of reading 4 bytes from memory
+! is a fixnum.
+\ alien-unsigned-4 small-reg-32 define-unsigned-getter
+\ set-alien-unsigned-4 small-reg-32 define-setter
+
+\ alien-signed-4 small-reg-32 define-signed-getter
+\ set-alien-signed-4 small-reg-32 define-setter
+
+T{ x86-backend f 8 } compiler-backend set-global
diff --git a/core/cpu/x86/64/authors.txt b/core/cpu/x86/64/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/x86/64/bootstrap.factor b/core/cpu/x86/64/bootstrap.factor
new file mode 100644 (file)
index 0000000..bccdcbd
--- /dev/null
@@ -0,0 +1,4 @@
+USING: bootstrap.image.private kernel namespaces system ;
+
+8 \ cell set
+big-endian off
diff --git a/core/cpu/x86/64/summary.txt b/core/cpu/x86/64/summary.txt
new file mode 100644 (file)
index 0000000..81fce29
--- /dev/null
@@ -0,0 +1 @@
+64-bit x86 compiler backend
diff --git a/core/cpu/x86/allot/allot.factor b/core/cpu/x86/allot/allot.factor
new file mode 100644 (file)
index 0000000..c698961
--- /dev/null
@@ -0,0 +1,97 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel cpu.architecture cpu.x86.assembler
+cpu.x86.architecture kernel.private namespaces math
+math.functions sequences generic arrays generator
+generator.fixup generator.registers system layouts alien ;
+IN: cpu.x86.allot
+
+: (object@) ( n -- operand ) temp-reg v>operand swap [+] ;
+
+: object@ ( n -- operand ) cells (object@) ;
+
+: load-zone-ptr ( -- )
+    #! Load pointer to start of zone array
+    "nursery" f %alien-global ;
+
+: load-allot-ptr ( -- )
+    load-zone-ptr
+    temp-reg v>operand dup cell [+] MOV ;
+
+: inc-allot-ptr ( n -- )
+    load-zone-ptr
+    temp-reg v>operand cell [+] swap 8 align ADD ;
+
+: store-header ( header -- )
+    0 object@ swap type-number tag-header MOV ;
+
+: %allot ( header size quot -- )
+    swap >r >r
+    load-allot-ptr
+    store-header
+    r> call
+    r> inc-allot-ptr ; inline
+
+: %store-tagged ( reg tag -- )
+    >r dup fresh-object v>operand r>
+    temp-reg v>operand swap tag-number OR
+    temp-reg v>operand MOV ;
+
+M: x86-backend %move-float>int ( dst src -- )
+    #! Only called by pentium4 backend, uses SSE2 instruction
+    #! dest is a loc or a vreg
+    float 16 [
+        8 (object@) swap v>operand MOVSD
+        float %store-tagged
+    ] %allot ;
+
+: %allot-bignum-signed-1 ( outreg inreg -- )
+    #! on entry, inreg is a signed 32-bit quantity
+    #! exits with tagged ptr to bignum in outreg
+    #! 1 cell header, 1 cell length, 1 cell sign, + digits
+    #! length is the # of digits + sign
+    [
+        { "end" "nonzero" "positive" "store" }
+        [ define-label ] each
+        dup v>operand 0 CMP ! is it zero?
+        "nonzero" get JNE
+        0 >bignum pick load-literal ! this is our result
+        "end" get JMP
+        "nonzero" resolve-label
+        bignum 4 cells [
+            ! Write length
+            1 object@ 2 v>operand MOV
+            ! Test sign
+            dup v>operand 0 CMP
+            "positive" get JGE
+            2 object@ 1 MOV ! negative sign
+            dup v>operand NEG
+            "store" get JMP
+            "positive" resolve-label
+            2 object@ 0 MOV ! positive sign
+            "store" resolve-label
+            3 object@ swap v>operand MOV
+            ! Store tagged ptr in reg
+            bignum %store-tagged
+        ] %allot
+        "end" resolve-label
+    ] with-scope ;
+
+: %allot-alien ( ptr -- )
+    [
+        "temp" set
+        { "end" "f" } [ define-label ] each
+        "temp" operand 0 CMP
+        "f" get JE
+        alien 4 cells [
+            1 object@ f v>operand MOV
+            2 object@ f v>operand MOV
+            3 object@ "temp" operand MOV
+            ! Store tagged ptr in reg
+            "temp" get object %store-tagged
+        ] %allot
+        "end" get JMP
+        "f" resolve-label
+        "temp" operand f v>operand MOV
+        "end" resolve-label
+    ] with-scope ;
diff --git a/core/cpu/x86/architecture/architecture.factor b/core/cpu/x86/architecture/architecture.factor
new file mode 100644 (file)
index 0000000..df570c6
--- /dev/null
@@ -0,0 +1,207 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.compiler arrays
+cpu.x86.assembler cpu.architecture kernel kernel.private math
+math.functions memory namespaces sequences words generator
+generator.registers generator.fixup system layouts combinators ;
+IN: cpu.x86.architecture
+
+TUPLE: x86-backend cell ;
+
+HOOK: ds-reg compiler-backend
+HOOK: rs-reg compiler-backend
+HOOK: stack-reg compiler-backend
+HOOK: frame-reg compiler-backend
+HOOK: xt-reg compiler-backend
+HOOK: stack-save-reg compiler-backend
+
+: stack@ stack-reg swap [+] ;
+
+: reg-stack ( n reg -- op ) swap cells neg [+] ;
+
+M: ds-loc v>operand ds-loc-n ds-reg reg-stack ;
+M: rs-loc v>operand rs-loc-n rs-reg reg-stack ;
+
+M: int-regs %save-param-reg drop >r stack@ r> MOV ;
+M: int-regs %load-param-reg drop swap stack@ MOV ;
+
+: MOVSS/D float-regs-size 4 = [ MOVSS ] [ MOVSD ] if ;
+
+M: float-regs %save-param-reg >r >r stack@ r> r> MOVSS/D ;
+M: float-regs %load-param-reg >r swap stack@ r> MOVSS/D ;
+
+GENERIC: push-return-reg ( reg-class -- )
+GENERIC: load-return-reg ( stack@ reg-class -- )
+GENERIC: store-return-reg ( stack@ reg-class -- )
+
+HOOK: address-operand compiler-backend ( address -- operand )
+
+HOOK: fixnum>slot@ compiler-backend
+
+HOOK: prepare-division compiler-backend
+
+M: immediate load-literal v>operand swap v>operand MOV ;
+
+M: x86-backend stack-frame ( n -- i )
+    3 cells + 16 align cell - ;
+
+M: x86-backend %save-xt ( -- )
+    xt-reg compiling-label get MOV ;
+
+M: x86-backend %prologue ( n -- )
+    frame-reg stack-reg pick stack-frame 5 cells + neg [+] LEA
+    frame-reg PUSH
+    xt-reg PUSH
+    stack-reg swap stack-frame 2 cells - SUB ;
+
+M: x86-backend %epilogue ( n -- )
+    stack-reg swap stack-frame ADD ;
+
+: %alien-global ( symbol dll -- )
+    temp-reg v>operand 0 MOV rc-absolute-cell rel-dlsym
+    temp-reg v>operand dup [] MOV ;
+
+M: x86-backend %prepare-alien-invoke
+    #! Save Factor stack pointers in case the C code calls a
+    #! callback which does a GC, which must reliably trace
+    #! all roots.
+    "stack_chain" f %alien-global
+    temp-reg v>operand [] stack-reg MOV
+    temp-reg v>operand 2 cells [+] ds-reg MOV
+    temp-reg v>operand 3 cells [+] rs-reg MOV ;
+
+M: x86-backend %profiler-prologue ( word -- )
+    "end" define-label
+    "profiling" f %alien-global
+    temp-reg v>operand 0 CMP
+    "end" get JE
+    temp-reg load-literal
+    temp-reg v>operand profile-count-offset [+] 1 v>operand ADD
+    "end" resolve-label ;
+
+M: x86-backend %call-label ( label -- ) CALL ;
+
+M: x86-backend %jump-label ( label -- ) JMP ;
+
+: %prepare-primitive ( word -- operand )
+    ! Save stack pointer to stack_chain->callstack_top, load XT
+    ! in register
+    stack-save-reg stack-reg MOV address-operand ;
+
+M: x86-backend %call-primitive ( word -- )
+    stack-save-reg stack-reg cell neg [+] LEA
+    address-operand CALL ;
+
+M: x86-backend %jump-primitive ( word -- )
+    stack-save-reg stack-reg MOV
+    address-operand JMP ;
+
+M: x86-backend %jump-t ( label -- )
+    "flag" operand f v>operand CMP JNE ;
+
+: (%dispatch) ( word-table# -- )
+    ! Untag and multiply to get a jump table offset
+    "n" operand fixnum>slot@
+    ! Add to jump table base. We use a temporary register
+    ! since on AMD64 we have to load a 64-bit immediate. On
+    ! x86, this is redundant.
+    "scratch" operand HEX: ffffffff MOV rc-absolute-cell rel-dispatch
+    "n" operand "scratch" operand ADD ;
+
+: dispatch-template ( word-table# quot -- )
+    [
+        >r (%dispatch) "n" operand [] r> call
+    ] H{
+        { +input+ { { f "n" } } }
+        { +scratch+ { { f "scratch" } } }
+    } with-template ; inline
+
+M: x86-backend %call-dispatch ( word-table# -- )
+    [ CALL ] dispatch-template ;
+
+M: x86-backend %jump-dispatch ( word-table# -- )
+    [ %epilogue-later JMP ] dispatch-template ;
+
+M: x86-backend %move-int>int ( dst src -- )
+    [ v>operand ] 2apply MOV ;
+
+M: x86-backend %move-int>float ( dst src -- )
+    [ v>operand ] 2apply float-offset [+] MOVSD ;
+
+M: int-regs (%peek) drop %move-int>int ;
+
+M: int-regs (%replace) drop swap %move-int>int ;
+
+: (%inc) swap cells dup 0 > [ ADD ] [ neg SUB ] if ;
+
+M: x86-backend %inc-d ( n -- ) ds-reg (%inc) ;
+
+M: x86-backend %inc-r ( n -- ) rs-reg (%inc) ;
+
+M: x86-backend fp-shadows-int? ( -- ? ) f ;
+
+M: x86-backend value-structs? t ;
+
+M: x86-backend small-enough? ( n -- ? )
+    HEX: -80000000 HEX: 7fffffff between? ;
+
+: %untag ( reg -- ) tag-mask get bitnot AND ;
+
+: %untag-fixnum ( reg -- ) tag-bits get SAR ;
+
+: %tag-fixnum ( reg -- ) tag-bits get SHL ;
+
+: temp@ \ stack-frame get swap - ;
+
+: struct-return@ ( size n -- n )
+    [
+        stack-frame* cell + +
+    ] [
+        temp@
+    ] ?if ;
+
+HOOK: %unbox-struct-1 compiler-backend ( -- )
+
+HOOK: %unbox-struct-2 compiler-backend ( -- )
+
+M: x86-backend %unbox-small-struct ( size -- )
+    #! Alien must be in EAX.
+    cell align cell / {
+        { 1 [ %unbox-struct-1 ] }
+        { 2 [ %unbox-struct-2 ] }
+    } case ;
+
+M: x86-backend struct-small-enough? ( size -- ? )
+    { 1 2 4 8 } member?
+    os { "linux" "solaris" } member? not and ;
+
+M: x86-backend %return ( -- ) 0 %unwind ;
+
+! Alien intrinsics
+M: x86-backend %unbox-byte-array ( quot src -- )
+    "alien" operand "offset" operand ADD
+    "alien" operand byte-array-offset [+]
+    rot call ;
+
+M: x86-backend %unbox-alien ( quot src -- )
+    "alien" operand dup alien-offset [+] MOV
+    "alien" operand "offset" operand [+]
+    rot call ;
+
+M: x86-backend %unbox-f ( quot src -- )
+    "offset" operand rot call ;
+
+M: x86-backend %complex-alien-accessor ( quot src -- )
+    { "is-f" "is-alien" "end" } [ define-label ] each
+    "alien" operand f v>operand CMP
+    "is-f" get JE
+    "alien" operand header-offset [+] alien type-number tag-header CMP
+    "is-alien" get JE
+    [ %unbox-byte-array ] 2keep
+    "end" get JMP
+    "is-alien" resolve-label
+    [ %unbox-alien ] 2keep
+    "end" get JMP
+    "is-f" resolve-label
+    %unbox-f
+    "end" resolve-label ;
diff --git a/core/cpu/x86/assembler/assembler-tests.factor b/core/cpu/x86/assembler/assembler-tests.factor
new file mode 100644 (file)
index 0000000..256bc57
--- /dev/null
@@ -0,0 +1,38 @@
+USING: cpu.x86.assembler kernel tools.test namespaces ;
+IN: temporary
+
+[ { HEX: 49 HEX: 89 HEX: 04 HEX: 24 } ] [ [ R12 [] RAX MOV ] { } make ] unit-test
+[ { HEX: 49 HEX: 8b HEX: 06 } ] [ [ RAX R14 [] MOV ] { } make ] unit-test
+
+! [ { HEX: 89 HEX: ca } ] [ [ EDX ECX MOV ] { } make ] unit-test
+! [ { HEX: 4c HEX: 89 HEX: e2 } ] [ [ RDX R12 MOV ] { } make ] unit-test
+! [ { HEX: 49 HEX: 89 HEX: d4 } ] [ [ R12 RDX MOV ] { } make ] unit-test
+
+[ { HEX: f2 HEX: 0f HEX: 2c HEX: c0 } ] [ [ EAX XMM0 CVTTSD2SI ] { } make ] unit-test
+[ { HEX: f2 HEX: 48 HEX: 0f HEX: 2c HEX: c0 } ] [ [ RAX XMM0 CVTTSD2SI ] { } make ] unit-test
+[ { HEX: f2 HEX: 4c HEX: 0f HEX: 2c HEX: e0 } ] [ [ R12 XMM0 CVTTSD2SI ] { } make ] unit-test
+[ { HEX: f2 HEX: 0f HEX: 2a HEX: c0 } ] [ [ XMM0 EAX CVTSI2SD ] { } make ] unit-test
+[ { HEX: f2 HEX: 48 HEX: 0f HEX: 2a HEX: c0 } ] [ [ XMM0 RAX CVTSI2SD ] { } make ] unit-test
+[ { HEX: f2 HEX: 48 HEX: 0f HEX: 2a HEX: c1 } ] [ [ XMM0 RCX CVTSI2SD ] { } make ] unit-test
+[ { HEX: f2 HEX: 48 HEX: 0f HEX: 2a HEX: d9 } ] [ [ XMM3 RCX CVTSI2SD ] { } make ] unit-test
+[ { 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
+
+[ { 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
diff --git a/core/cpu/x86/assembler/assembler.factor b/core/cpu/x86/assembler/assembler.factor
new file mode 100644 (file)
index 0000000..5e40fe4
--- /dev/null
@@ -0,0 +1,498 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generator generator.fixup io.binary kernel
+combinators kernel.private math namespaces parser sequences
+words system ;
+IN: cpu.x86.assembler
+
+! A postfix assembler for x86 and AMD64.
+
+! In 32-bit mode, { 1234 } is absolute indirect addressing.
+! In 64-bit mode, { 1234 } is RIP-relative.
+! Beware!
+
+! Register operands -- eg, ECX
+: define-register ( symbol num size -- )
+    >r dupd "register" set-word-prop r>
+    "register-size" set-word-prop ;
+
+! x86 registers
+SYMBOL: AL \ AL 0 8 define-register
+SYMBOL: CL \ CL 1 8 define-register
+SYMBOL: DL \ DL 2 8 define-register
+SYMBOL: BL \ BL 3 8 define-register
+
+SYMBOL: AX \ AX 0 16 define-register
+SYMBOL: CX \ CX 1 16 define-register
+SYMBOL: DX \ DX 2 16 define-register
+SYMBOL: BX \ BX 3 16 define-register
+SYMBOL: SP \ SP 4 16 define-register
+SYMBOL: BP \ BP 5 16 define-register
+SYMBOL: SI \ SI 6 16 define-register
+SYMBOL: DI \ DI 7 16 define-register
+
+SYMBOL: EAX \ EAX 0 32 define-register
+SYMBOL: ECX \ ECX 1 32 define-register
+SYMBOL: EDX \ EDX 2 32 define-register
+SYMBOL: EBX \ EBX 3 32 define-register
+SYMBOL: ESP \ ESP 4 32 define-register
+SYMBOL: EBP \ EBP 5 32 define-register
+SYMBOL: ESI \ ESI 6 32 define-register
+SYMBOL: EDI \ EDI 7 32 define-register
+
+SYMBOL: XMM0 \ XMM0 0 128 define-register
+SYMBOL: XMM1 \ XMM1 1 128 define-register
+SYMBOL: XMM2 \ XMM2 2 128 define-register
+SYMBOL: XMM3 \ XMM3 3 128 define-register
+SYMBOL: XMM4 \ XMM4 4 128 define-register
+SYMBOL: XMM5 \ XMM5 5 128 define-register
+SYMBOL: XMM6 \ XMM6 6 128 define-register
+SYMBOL: XMM7 \ XMM7 7 128 define-register
+
+! AMD64 registers
+SYMBOL: RAX \ RAX 0  64 define-register
+SYMBOL: RCX \ RCX 1  64 define-register
+SYMBOL: RDX \ RDX 2  64 define-register
+SYMBOL: RBX \ RBX 3  64 define-register
+SYMBOL: RSP \ RSP 4  64 define-register
+SYMBOL: RBP \ RBP 5  64 define-register
+SYMBOL: RSI \ RSI 6  64 define-register
+SYMBOL: RDI \ RDI 7  64 define-register
+SYMBOL: R8  \ R8  8  64 define-register
+SYMBOL: R9  \ R9  9  64 define-register
+SYMBOL: R10 \ R10 10 64 define-register
+SYMBOL: R11 \ R11 11 64 define-register
+SYMBOL: R12 \ R12 12 64 define-register
+SYMBOL: R13 \ R13 13 64 define-register
+SYMBOL: R14 \ R14 14 64 define-register
+SYMBOL: R15 \ R15 15 64 define-register
+
+SYMBOL: XMM8 \ XMM8 8 128 define-register
+SYMBOL: XMM9 \ XMM9 9 128 define-register
+SYMBOL: XMM10 \ XMM10 10 128 define-register
+SYMBOL: XMM11 \ XMM11 11 128 define-register
+SYMBOL: XMM12 \ XMM12 12 128 define-register
+SYMBOL: XMM13 \ XMM13 13 128 define-register
+SYMBOL: XMM14 \ XMM14 14 128 define-register
+SYMBOL: XMM15 \ XMM15 15 128 define-register
+
+<PRIVATE
+
+: n, >le % ; inline
+: 4, 4 n, ; inline
+: 2, 2 n, ; inline
+: cell, cell n, ; inline
+
+#! Extended AMD64 registers (R8-R15) return true.
+GENERIC: extended? ( op -- ? )
+
+M: object extended? drop f ;
+
+PREDICATE: word register "register" word-prop ;
+
+PREDICATE: register register-8 "register-size" word-prop 8 = ;
+PREDICATE: register register-16 "register-size" word-prop 16 = ;
+PREDICATE: register register-32 "register-size" word-prop 32 = ;
+PREDICATE: register register-64 "register-size" word-prop 64 = ;
+PREDICATE: register register-128 "register-size" word-prop 128 = ;
+
+M: register extended? "register" word-prop 7 > ;
+
+! Addressing modes
+TUPLE: indirect base index scale displacement ;
+
+M: indirect extended? indirect-base extended? ;
+
+: canonicalize-EBP
+    #! { EBP } ==> { EBP 0 }
+    dup indirect-base { EBP RBP R13 } memq? [
+        dup indirect-displacement [
+            drop
+        ] [
+            0 swap set-indirect-displacement
+        ] if
+    ] [
+        drop
+    ] if ;
+
+: canonicalize-ESP
+    #! { ESP } ==> { ESP ESP }
+    dup indirect-base { ESP RSP R12 } memq? [
+        ESP swap set-indirect-index
+    ] [
+        drop
+    ] if ;
+
+: canonicalize ( indirect -- )
+    #! Modify the indirect to work around certain addressing mode
+    #! quirks.
+    dup canonicalize-EBP
+    canonicalize-ESP ;
+
+: <indirect> ( base index scale displacement -- indirect )
+    indirect construct-boa dup canonicalize ;
+
+: reg-code "register" word-prop 7 bitand ;
+
+: indirect-base* indirect-base EBP or reg-code ;
+
+: indirect-index* indirect-index ESP or reg-code ;
+
+: indirect-scale* indirect-scale 0 or ;
+
+GENERIC: sib-present? ( op -- ? )
+
+M: indirect sib-present?
+    dup indirect-base { ESP RSP } memq?
+    over indirect-index rot indirect-scale or or ;
+
+M: register sib-present? drop f ;
+
+GENERIC: r/m ( operand -- n )
+
+M: indirect r/m
+    dup sib-present?
+    [ drop ESP reg-code ] [ indirect-base* ] if ;
+
+M: register r/m reg-code ;
+
+: byte? -128 127 between? ;
+
+GENERIC: modifier ( op -- n )
+
+M: indirect modifier
+    dup indirect-base [
+        indirect-displacement {
+            { [ dup not ]      [ BIN: 00 ] }
+            { [ dup byte? ]    [ BIN: 01 ] }
+            { [ dup integer? ] [ BIN: 10 ] }
+        } cond nip
+    ] [
+        drop BIN: 00
+    ] if ;
+
+M: register modifier drop BIN: 11 ;
+
+: mod-r/m, ( reg# indirect -- )
+    dup modifier 6 shift rot 3 shift rot r/m bitor bitor , ;
+
+: sib, ( indirect -- )
+    dup sib-present? [
+        dup indirect-base*
+        over indirect-index* 3 shift bitor
+        swap indirect-scale* 6 shift bitor ,
+    ] [
+        drop
+    ] if ;
+
+GENERIC: displacement, ( op -- )
+
+M: indirect displacement,
+    dup indirect-displacement dup [
+        swap indirect-base
+        [ dup byte? [ , ] [ 4, ] if ] [ 4, ] if
+    ] [
+        2drop
+    ] if ;
+
+M: register displacement, drop ;
+
+: addressing ( reg# indirect -- )
+    [ mod-r/m, ] keep [ sib, ] keep displacement, ;
+
+! Utilities
+UNION: operand register indirect ;
+
+: operand-64? ( operand -- ? )
+    dup indirect? [
+        dup indirect-base register-64?
+        swap indirect-index register-64? or
+    ] [
+        register-64?
+    ] if ;
+
+: rex.w? ( rex.w reg r/m -- ? )
+    {
+        { [ dup register-128? ] [ drop operand-64? ] }
+        { [ dup not ] [ drop operand-64? ] }
+        { [ t ] [ nip operand-64? ] }
+    } cond and ;
+
+: rex.r
+    extended? [ BIN: 00000100 bitor ] when ;
+
+: rex.b
+    [ extended? [ BIN: 00000001 bitor ] when ] keep
+    dup indirect? [
+        indirect-index extended?
+        [ BIN: 00000010 bitor ] when
+    ] [
+        drop
+    ] if ;
+
+: rex-prefix ( reg r/m rex.w -- )
+    #! Compile an AMD64 REX prefix.
+    pick pick rex.w? BIN: 01001000 BIN: 01000000 ?
+    swap rex.r swap rex.b
+    dup BIN: 01000000 = [ drop ] [ , ] if ;
+
+: 16-prefix ( reg r/m -- )
+    [ register-16? ] either? [ HEX: 66 , ] when ;
+
+: prefix ( reg r/m rex.w -- ) pick pick 16-prefix rex-prefix ;
+
+: prefix-1 ( reg rex.w -- ) f swap prefix ;
+
+: short-operand ( reg rex.w n -- )
+    #! Some instructions encode their single operand as part of
+    #! the opcode.
+    >r dupd prefix-1 reg-code r> + , ;
+
+: opcode, dup array? [ % ] [ , ] if ;
+
+: extended-opcode ( opcode -- opcode' ) OCT: 17 swap 2array ;
+
+: extended-opcode, ( opcode -- ) extended-opcode opcode, ;
+
+: opcode-or ( opcode mask -- opcode' )
+    over array?
+    [ 1 rot cut* first rot bitor add ]
+    [ bitor ] if ;
+
+: 1-operand ( op reg rex.w opcode -- )
+    #! The 'reg' is not really a register, but a value for the
+    #! 'reg' field of the mod-r/m byte.
+    >r >r over r> prefix-1 r> opcode, swap addressing ;
+
+: immediate-1 ( imm dst reg rex.w opcode -- )
+    1-operand , ;
+
+: immediate-1/4 ( imm dst reg rex.w opcode -- )
+    #! If imm is a byte, compile the opcode and the byte.
+    #! Otherwise, set the 32-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.
+    >r >r pick byte? [
+        r> r> BIN: 10 opcode-or immediate-1
+    ] [
+        r> r> 1-operand 4,
+    ] if ;
+
+: (2-operand) ( dst src op -- )
+    >r 2dup t rex-prefix r> opcode,
+    reg-code swap addressing ;
+
+: direction-bit ( dst src op -- dst' src' op' )
+    pick register? [ BIN: 10 opcode-or swapd ] when ;
+
+: operand-size-bit ( dst src op -- dst' src' op' )
+    over 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.
+    pick pick 16-prefix
+    direction-bit
+    operand-size-bit
+    (2-operand) ;
+
+PRIVATE>
+
+: [] ( reg/displacement -- indirect )
+    dup integer? [ >r f f f r> ] [ f f f ] if <indirect> ;
+
+: [+] ( reg displacement -- indirect )
+    dup integer?
+    [ dup zero? [ drop f ] when >r f f r> ]
+    [ f f ] if
+    <indirect> ;
+
+! Moving stuff
+GENERIC: PUSH ( op -- )
+M: register PUSH f HEX: 50 short-operand ;
+M: integer PUSH HEX: 68 , 4, ;
+M: operand PUSH BIN: 110 f HEX: ff 1-operand ;
+
+GENERIC: POP ( op -- )
+M: register POP f HEX: 58 short-operand ;
+M: operand POP BIN: 000 f HEX: 8f 1-operand ;
+
+! MOV where the src is immediate.
+GENERIC: (MOV-I) ( src dst -- )
+M: register (MOV-I) t HEX: b8 short-operand cell, ;
+M: operand (MOV-I) BIN: 000 t HEX: c7 1-operand 4, ;
+
+PREDICATE: word callable register? not ;
+
+GENERIC: MOV ( dst src -- )
+M: integer MOV swap (MOV-I) ;
+M: callable MOV 0 rot (MOV-I) rc-absolute-cell rel-word ;
+M: operand MOV HEX: 88 2-operand ;
+
+: LEA ( dst src -- ) swap HEX: 8d 2-operand ;
+
+! Control flow
+GENERIC: JMP ( op -- )
+: (JMP) HEX: e9 , 0 4, rc-relative ;
+M: callable JMP (JMP) rel-word ;
+M: label JMP (JMP) label-fixup ;
+M: operand JMP BIN: 100 t HEX: ff 1-operand ;
+
+GENERIC: CALL ( op -- )
+: (CALL) HEX: e8 , 0 4, rc-relative ;
+M: callable CALL (CALL) rel-word ;
+M: label CALL (CALL) label-fixup ;
+M: operand CALL BIN: 010 t HEX: ff 1-operand ;
+
+GENERIC# JUMPcc 1 ( addr opcode -- )
+: (JUMPcc) extended-opcode, 0 4, rc-relative ;
+M: callable JUMPcc (JUMPcc) rel-word ;
+M: label JUMPcc (JUMPcc) label-fixup ;
+
+: JO  HEX: 80 JUMPcc ;
+: JNO HEX: 81 JUMPcc ;
+: JB  HEX: 82 JUMPcc ;
+: JAE HEX: 83 JUMPcc ;
+: JE  HEX: 84 JUMPcc ; ! aka JZ
+: JNE HEX: 85 JUMPcc ;
+: JBE HEX: 86 JUMPcc ;
+: JA  HEX: 87 JUMPcc ;
+: JS  HEX: 88 JUMPcc ;
+: JNS HEX: 89 JUMPcc ;
+: JP  HEX: 8a JUMPcc ;
+: JNP HEX: 8b JUMPcc ;
+: JL  HEX: 8c JUMPcc ;
+: JGE HEX: 8d JUMPcc ;
+: JLE HEX: 8e JUMPcc ;
+: JG  HEX: 8f JUMPcc ;
+
+: LEAVE ( -- ) HEX: c9 , ;
+
+: RET ( n -- )
+    dup zero? [ drop HEX: c3 , ] [ HEX: C2 , 2, ] if ;
+
+! Arithmetic
+
+GENERIC: ADD ( dst src -- )
+M: integer ADD swap BIN: 000 t HEX: 81 immediate-1/4 ;
+M: operand ADD OCT: 000 2-operand ;
+
+GENERIC: OR ( dst src -- )
+M: integer OR swap BIN: 001 t HEX: 81 immediate-1/4 ;
+M: operand OR OCT: 010 2-operand ;
+
+GENERIC: ADC ( dst src -- )
+M: integer ADC swap BIN: 010 t HEX: 81 immediate-1/4 ;
+M: operand ADC OCT: 020 2-operand ;
+
+GENERIC: SBB ( dst src -- )
+M: integer SBB swap BIN: 011 t HEX: 81 immediate-1/4 ;
+M: operand SBB OCT: 030 2-operand ;
+
+GENERIC: AND ( dst src -- )
+M: integer AND swap BIN: 100 t HEX: 81 immediate-1/4 ;
+M: operand AND OCT: 040 2-operand ;
+
+GENERIC: SUB ( dst src -- )
+M: integer SUB swap BIN: 101 t HEX: 81 immediate-1/4 ;
+M: operand SUB OCT: 050 2-operand ;
+
+GENERIC: XOR ( dst src -- )
+M: integer XOR swap BIN: 110 t HEX: 81 immediate-1/4 ;
+M: operand XOR OCT: 060 2-operand ;
+
+GENERIC: CMP ( dst src -- )
+M: integer CMP swap BIN: 111 t HEX: 81 immediate-1/4 ;
+M: operand CMP OCT: 070 2-operand ;
+
+: NOT  ( dst -- ) BIN: 010 t HEX: f7 1-operand ;
+: NEG  ( dst -- ) BIN: 011 t HEX: f7 1-operand ;
+: MUL  ( dst -- ) BIN: 100 t HEX: f7 1-operand ;
+: IMUL ( src -- ) BIN: 101 t HEX: f7 1-operand ;
+: DIV  ( dst -- ) BIN: 110 t HEX: f7 1-operand ;
+: IDIV ( src -- ) BIN: 111 t HEX: f7 1-operand ;
+
+: CDQ HEX: 99 , ;
+: CQO HEX: 48 , CDQ ;
+
+: ROL ( dst n -- ) swap BIN: 000 t HEX: c1 immediate-1 ;
+: ROR ( dst n -- ) swap BIN: 001 t HEX: c1 immediate-1 ;
+: RCL ( dst n -- ) swap BIN: 010 t HEX: c1 immediate-1 ;
+: RCR ( dst n -- ) swap BIN: 011 t HEX: c1 immediate-1 ;
+: SHL ( dst n -- ) swap BIN: 100 t HEX: c1 immediate-1 ;
+: SHR ( dst n -- ) swap BIN: 101 t HEX: c1 immediate-1 ;
+: SAR ( dst n -- ) swap BIN: 111 t HEX: c1 immediate-1 ;
+
+GENERIC: IMUL2 ( dst src -- )
+M: integer IMUL2 swap dup reg-code t HEX: 69 immediate-1/4 ;
+M: operand IMUL2 OCT: 257 extended-opcode (2-operand) ;
+
+: MOVSX ( dst src -- )
+    dup register-32? OCT: 143 OCT: 276 extended-opcode ?
+    over register-16? [ BIN: 1 opcode-or ] when
+    swapd
+    (2-operand) ;
+
+! Conditional move
+: MOVcc ( dst src cc -- ) extended-opcode swapd (2-operand) ;
+
+: CMOVO  HEX: 40 MOVcc ;
+: CMOVNO HEX: 41 MOVcc ;
+: CMOVB  HEX: 42 MOVcc ;
+: CMOVAE HEX: 43 MOVcc ;
+: CMOVE  HEX: 44 MOVcc ; ! aka CMOVZ
+: CMOVNE HEX: 45 MOVcc ;
+: CMOVBE HEX: 46 MOVcc ;
+: CMOVA  HEX: 47 MOVcc ;
+: CMOVS  HEX: 48 MOVcc ;
+: CMOVNS HEX: 49 MOVcc ;
+: CMOVP  HEX: 4a MOVcc ;
+: CMOVNP HEX: 4b MOVcc ;
+: CMOVL  HEX: 4c MOVcc ;
+: CMOVGE HEX: 4d MOVcc ;
+: CMOVLE HEX: 4e MOVcc ;
+: CMOVG  HEX: 4f MOVcc ;
+
+! CPU Identification
+
+: CPUID HEX: a2 extended-opcode, ;
+
+! x87 Floating Point Unit
+
+: FSTPS ( operand -- ) BIN: 011 f HEX: d9 1-operand ;
+: FSTPL ( operand -- ) BIN: 011 f HEX: dd 1-operand ;
+
+: FLDS ( operand -- ) BIN: 000 f HEX: d9 1-operand ;
+: FLDL ( operand -- ) BIN: 000 f HEX: dd 1-operand ;
+
+! SSE multimedia instructions
+
+<PRIVATE
+
+: direction-bit-sse ( dst src op1 -- dst' src' op1' )
+    pick register-128? [ swapd ] [ BIN: 1 bitor ] if ;
+
+: 2-operand-sse ( dst src op1 op2 -- )
+    , direction-bit-sse extended-opcode (2-operand) ;
+
+: 2-operand-int/sse ( dst src op1 op2 -- )
+    , swapd extended-opcode (2-operand) ;
+
+PRIVATE>
+
+: MOVSS   ( dest src -- ) HEX: 10 HEX: f3 2-operand-sse ;
+: MOVSD   ( dest src -- ) HEX: 10 HEX: f2 2-operand-sse ;
+: ADDSD   ( dest src -- ) HEX: 58 HEX: f2 2-operand-sse ;
+: MULSD   ( dest src -- ) HEX: 59 HEX: f2 2-operand-sse ;
+: SUBSD   ( dest src -- ) HEX: 5c HEX: f2 2-operand-sse ;
+: DIVSD   ( dest src -- ) HEX: 5e HEX: f2 2-operand-sse ;
+: SQRTSD  ( dest src -- ) HEX: 51 HEX: f2 2-operand-sse ;
+: UCOMISD ( dest src -- ) HEX: 2e HEX: 66 2-operand-sse ;
+: COMISD  ( dest src -- ) HEX: 2f HEX: 66 2-operand-sse ;
+
+: CVTSS2SD ( dest src -- ) HEX: 5a HEX: f3 2-operand-sse ;
+: CVTSD2SS ( dest src -- ) HEX: 5a HEX: f2 2-operand-sse ;
+
+: CVTSI2SD  ( dest src -- ) HEX: 2a HEX: f2 2-operand-int/sse ;
+: CVTSD2SI  ( dest src -- ) HEX: 2d HEX: f2 2-operand-int/sse ;
+: CVTTSD2SI ( dest src -- ) HEX: 2c HEX: f2 2-operand-int/sse ;
diff --git a/core/cpu/x86/authors.txt b/core/cpu/x86/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/x86/intrinsics/intrinsics.factor b/core/cpu/x86/intrinsics/intrinsics.factor
new file mode 100644 (file)
index 0000000..fc4d738
--- /dev/null
@@ -0,0 +1,575 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays cpu.x86.assembler cpu.x86.allot
+cpu.x86.architecture cpu.architecture kernel kernel.private math
+math.functions math.private namespaces quotations sequences
+words generic byte-arrays hashtables hashtables.private
+generator generator.registers generator.fixup sequences.private
+sbufs sbufs.private vectors vectors.private layouts system
+tuples.private strings.private slots.private ;
+IN: cpu.x86.intrinsics
+
+! Type checks
+\ tag [
+    "in" operand tag-mask get AND
+    "in" operand %tag-fixnum
+] H{
+    { +input+ { { f "in" } } }
+    { +output+ { "in" } }
+} define-intrinsic
+
+\ type [
+    "end" define-label
+    ! Make a copy
+    "x" operand "obj" operand MOV
+    ! Get the tag
+    "x" operand tag-mask get AND
+    ! Tag the tag
+    "x" operand %tag-fixnum
+    ! Compare with object tag number (3).
+    "x" operand object tag-number tag-bits get shift CMP
+    "end" get JNE
+    ! If we have equality, load type from header
+    "x" operand "obj" operand -3 [+] MOV
+    "end" resolve-label
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "x" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+\ class-hash [
+    "end" define-label
+    "tuple" define-label
+    "object" define-label
+    ! Make a copy
+    "x" operand "obj" operand MOV
+    ! Get the tag
+    "x" operand tag-mask get AND
+    ! Tag the tag
+    "x" operand %tag-fixnum
+    ! Compare with tuple tag number (2).
+    "x" operand tuple tag-number tag-bits get shift CMP
+    "tuple" get JE
+    ! Compare with object tag number (3).
+    "x" operand object tag-number tag-bits get shift CMP
+    "object" get JE
+    "end" get JMP
+    "object" get resolve-label
+    ! Load header type
+    "x" operand "obj" operand header-offset [+] MOV
+    "end" get JMP
+    "tuple" get resolve-label
+    ! Load class hash
+    "x" operand "obj" operand tuple-class-offset [+] MOV
+    "x" operand dup class-hash-offset [+] MOV
+    "end" resolve-label
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "x" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+! Slots
+
+\ slot {
+    ! Slot number is literal
+    {
+        [
+            "obj" operand %untag
+            ! load slot value
+            "obj" operand dup "n" get cells [+] MOV
+        ] H{
+            { +input+ { { f "obj" } { [ small-slot? ] "n" } } }
+            { +output+ { "obj" } }
+        }
+    }
+    ! Slot number in a register
+    {
+        [
+            "obj" operand %untag
+            ! turn tagged fixnum slot # into an offset,
+            ! multiple of 4
+            "n" operand fixnum>slot@
+            ! load slot value
+            "obj" operand dup "n" operand [+] MOV
+        ] H{
+            { +input+ { { f "obj" } { f "n" } } }
+            { +output+ { "obj" } }
+            { +clobber+ { "n" } }
+        }
+    }
+} define-intrinsics
+
+: generate-write-barrier ( -- )
+    #! Mark the card pointed to by vreg.
+    "val" operand-immediate? "obj" get fresh-object? or [
+        "obj" operand card-bits SHR
+        "scratch" operand HEX: ffffffff MOV
+        "cards_offset" f rc-absolute-cell rel-dlsym
+        "scratch" operand dup [] MOV
+        "scratch" operand "obj" operand [+] card-mark OR
+    ] unless ;
+
+\ set-slot {
+    ! Slot number is literal
+    {
+        [
+            "obj" operand %untag
+            ! store new slot value
+            "obj" operand "n" get cells [+] "val" operand MOV
+            generate-write-barrier
+        ] H{
+            { +input+ { { f "val" } { f "obj" } { [ small-slot? ] "n" } } }
+            { +scratch+ { { f "scratch" } } }
+            { +clobber+ { "obj" } }
+        }
+    }
+    ! Slot number in a register
+    {
+        [
+            ! turn tagged fixnum slot # into an offset
+            "n" operand fixnum>slot@
+            "obj" operand %untag
+            ! store new slot value
+            "obj" operand "n" operand [+] "val" operand MOV
+            ! reuse register
+            "n" get "scratch" set
+            generate-write-barrier
+        ] H{
+            { +input+ { { f "val" } { f "obj" } { f "n" } } }
+            { +clobber+ { "obj" "n" } }
+        }
+    }
+} define-intrinsics
+
+! Sometimes, we need to do stuff with operands which are
+! less than the word size. Instead of teaching the register
+! allocator about the different sized registers, with all
+! the complexity this entails, we just push/pop a register
+! which is guaranteed to be unused (the tempreg)
+: small-reg cell 8 = RBX EBX ? ; inline
+: small-reg-8 BL ; inline
+: small-reg-16 BX ; inline
+: small-reg-32 EBX ; inline
+
+\ char-slot [
+    small-reg PUSH
+    "n" operand 2 SHR
+    small-reg dup XOR
+    "obj" operand "n" operand ADD
+    small-reg-16 "obj" operand string-offset [+] MOV
+    small-reg %tag-fixnum
+    "obj" operand small-reg MOV
+    small-reg POP
+] H{
+    { +input+ { { f "n" } { f "obj" } } }
+    { +output+ { "obj" } }
+    { +clobber+ { "obj" "n" } }
+} define-intrinsic
+
+\ set-char-slot [
+    small-reg PUSH
+    "val" operand %untag-fixnum
+    "slot" operand 2 SHR
+    "obj" operand "slot" operand ADD
+    small-reg "val" operand MOV
+    "obj" operand string-offset [+] small-reg-16 MOV
+    small-reg POP
+] H{
+    { +input+ { { f "val" } { f "slot" } { f "obj" } } }
+    { +clobber+ { "val" "slot" "obj" } }
+} define-intrinsic
+
+! Fixnums
+: fixnum-op ( op hash -- pair )
+    >r [ "x" operand "y" operand ] swap add r> 2array ;
+
+: fixnum-value-op ( op -- pair )
+    H{
+        { +input+ { { f "x" } { [ small-tagged? ] "y" } } }
+        { +output+ { "x" } }
+    } fixnum-op ;
+
+: fixnum-register-op ( op -- pair )
+    H{
+        { +input+ { { f "x" } { f "y" } } }
+        { +output+ { "x" } }
+    } fixnum-op ;
+
+: define-fixnum-op ( word op -- )
+    [ fixnum-value-op ] keep fixnum-register-op
+    2array define-intrinsics ;
+
+{
+    { fixnum+fast ADD }
+    { fixnum-fast SUB }
+    { fixnum-bitand AND }
+    { fixnum-bitor OR }
+    { fixnum-bitxor XOR }
+} [
+    first2 define-fixnum-op
+] each
+
+\ fixnum-bitnot [
+    "x" operand NOT
+    "x" operand tag-mask get XOR
+] H{
+    { +input+ { { f "x" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+\ fixnum*fast {
+    {
+        [
+            "x" operand "y" get IMUL2
+        ] H{
+            { +input+ { { f "x" } { [ small-tagged? ] "y" } } }
+            { +output+ { "x" } }
+        }
+    } {
+        [
+            "out" operand "x" operand MOV
+            "out" operand %untag-fixnum
+            "y" operand "out" operand IMUL2
+        ] H{
+            { +input+ { { f "x" } { f "y" } } }
+            { +scratch+ { { f "out" } } }
+            { +output+ { "out" } }
+        }
+    }
+} define-intrinsics
+
+\ fixnum-shift [
+    "x" operand "y" get neg SAR
+    ! Mask off low bits
+    "x" operand %untag
+] H{
+    { +input+ { { f "x" } { [ -31 0 between? ] "y" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+: %untag-fixnums ( seq -- )
+    [ %untag-fixnum ] unique-operands ;
+
+: overflow-check ( word -- )
+    "end" define-label
+    "z" operand "x" operand MOV
+    "z" operand "y" operand pick execute
+    ! If the previous arithmetic operation overflowed, then we
+    ! turn the result into a bignum and leave it in EAX.
+    "end" get JNO
+    ! There was an overflow. Recompute the original operand.
+    { "y" "x" } %untag-fixnums
+    "x" operand "y" operand rot execute
+    "z" get "x" get %allot-bignum-signed-1
+    "end" resolve-label ; inline
+
+: overflow-template ( word insn -- )
+    [ overflow-check ] curry H{
+        { +input+ { { f "x" } { f "y" } } }
+        { +scratch+ { { f "z" } } }
+        { +output+ { "z" } }
+        { +clobber+ { "x" "y" } }
+    } define-intrinsic ;
+
+\ fixnum+ \ ADD overflow-template
+\ fixnum- \ SUB overflow-template
+
+: fixnum-jump ( op inputs -- pair )
+    >r [ "x" operand "y" operand CMP ] swap add r> 2array ;
+
+: fixnum-value-jump ( op -- pair )
+    { { f "x" } { [ small-tagged? ] "y" } } fixnum-jump ;
+
+: fixnum-register-jump ( op -- pair )
+    { { f "x" } { f "y" } } fixnum-jump ;
+
+: define-fixnum-jump ( word op -- )
+    [ fixnum-value-jump ] keep fixnum-register-jump
+    2array define-if-intrinsics ;
+
+{
+    { fixnum< JL }
+    { fixnum<= JLE }
+    { fixnum> JG }
+    { fixnum>= JGE }
+    { eq? JE }
+} [
+    first2 define-fixnum-jump
+] each
+
+\ fixnum>bignum [
+    "x" operand %untag-fixnum
+    "x" get dup %allot-bignum-signed-1
+] H{
+    { +input+ { { f "x" } } }
+    { +output+ { "x" } }
+} define-intrinsic
+
+\ bignum>fixnum [
+    "nonzero" define-label
+    "positive" define-label
+    "end" define-label
+    "x" operand %untag
+    "y" operand "x" operand cell [+] MOV
+     ! if the length is 1, its just the sign and nothing else,
+     ! so output 0
+    "y" operand 1 v>operand CMP
+    "nonzero" get JNE
+    "y" operand 0 MOV
+    "end" get JMP
+    "nonzero" resolve-label
+    ! load the value
+    "y" operand "x" operand 3 cells [+] MOV
+    ! load the sign
+    "x" operand "x" operand 2 cells [+] MOV
+    ! is the sign negative?
+    "x" operand 0 CMP
+    "positive" get JE
+    "y" operand -1 IMUL2
+    "positive" resolve-label
+    "y" operand 3 SHL
+    "end" resolve-label
+] H{
+    { +input+ { { f "x" } } }
+    { +scratch+ { { f "y" } } }
+    { +clobber+ { "x" } }
+    { +output+ { "y" } }
+} define-intrinsic
+
+! User environment
+: %userenv ( -- )
+    "x" operand 0 MOV
+    "userenv" f rc-absolute-cell rel-dlsym
+    "n" operand fixnum>slot@
+    "n" operand "x" operand ADD ;
+
+\ getenv [
+    %userenv  "n" operand dup [] MOV
+] H{
+    { +input+ { { f "n" } } }
+    { +scratch+ { { f "x" } } }
+    { +output+ { "n" } }
+} define-intrinsic
+
+\ setenv [
+    %userenv  "n" operand [] "val" operand MOV
+] H{
+    { +input+ { { f "val" } { f "n" } } }
+    { +scratch+ { { f "x" } } }
+    { +clobber+ { "n" } }
+} define-intrinsic
+
+\ <tuple> [
+    tuple "n" get 2 + cells [
+        ! Store length
+        1 object@ "n" operand MOV
+        ! Store class
+        2 object@ "class" operand MOV
+        ! Zero out the rest of the tuple
+        "n" operand 1- [ 3 + object@ f v>operand MOV ] each
+        ! Store tagged ptr in reg
+        "tuple" get tuple %store-tagged
+    ] %allot
+] H{
+    { +input+ { { f "class" } { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "tuple" } } }
+    { +output+ { "tuple" } }
+} define-intrinsic
+
+\ <array> [
+    array "n" get 2 + cells [
+        ! Store length
+        1 object@ "n" operand MOV
+        ! Zero out the rest of the tuple
+        "n" get [ 2 + object@ "initial" operand MOV ] each
+        ! Store tagged ptr in reg
+        "array" get object %store-tagged
+    ] %allot
+] H{
+    { +input+ { { [ inline-array? ] "n" } { f "initial" } } }
+    { +scratch+ { { f "array" } } }
+    { +output+ { "array" } }
+} define-intrinsic
+
+\ <byte-array> [
+    byte-array "n" get 2 cells + [
+        ! Store length
+        1 object@ "n" operand MOV
+        ! Store initial element
+        "n" get cell align cell /i [ 2 + object@ 0 MOV ] each
+        ! Store tagged ptr in reg
+        "array" get object %store-tagged
+    ] %allot
+] H{
+    { +input+ { { [ inline-array? ] "n" } } }
+    { +scratch+ { { f "array" } } }
+    { +output+ { "array" } }
+} define-intrinsic
+
+\ <ratio> [
+    ratio 3 cells [
+        1 object@ "numerator" operand MOV
+        2 object@ "denominator" operand MOV
+        ! Store tagged ptr in reg
+        "ratio" get ratio %store-tagged
+    ] %allot
+] H{
+    { +input+ { { f "numerator" } { f "denominator" } } }
+    { +scratch+ { { f "ratio" } } }
+    { +output+ { "ratio" } }
+} define-intrinsic
+
+\ <complex> [
+    complex 3 cells [
+        1 object@ "real" operand MOV
+        2 object@ "imaginary" operand MOV
+        ! Store tagged ptr in reg
+        "complex" get complex %store-tagged
+    ] %allot
+] H{
+    { +input+ { { f "real" } { f "imaginary" } } }
+    { +scratch+ { { f "complex" } } }
+    { +output+ { "complex" } }
+} define-intrinsic
+
+\ <wrapper> [
+    wrapper 2 cells [
+        1 object@ "obj" operand MOV
+        ! Store tagged ptr in reg
+        "wrapper" get object %store-tagged
+    ] %allot
+] H{
+    { +input+ { { f "obj" } } }
+    { +scratch+ { { f "wrapper" } } }
+    { +output+ { "wrapper" } }
+} define-intrinsic
+
+\ (hashtable) [
+    hashtable 4 cells [
+        1 object@ f v>operand MOV
+        2 object@ f v>operand MOV
+        3 object@ f v>operand MOV
+        ! Store tagged ptr in reg
+        "hashtable" get object %store-tagged
+    ] %allot
+] H{
+    { +scratch+ { { f "hashtable" } } }
+    { +output+ { "hashtable" } }
+} define-intrinsic
+
+\ string>sbuf [
+    sbuf 3 cells [
+        1 object@ "length" operand MOV
+        2 object@ "string" operand MOV
+        ! Store tagged ptr in reg
+        "sbuf" get object %store-tagged
+    ] %allot
+] H{
+    { +input+ { { f "string" } { f "length" } } }
+    { +scratch+ { { f "sbuf" } } }
+    { +output+ { "sbuf" } }
+} define-intrinsic
+
+\ array>vector [
+    vector 3 cells [
+        1 object@ "length" operand MOV
+        2 object@ "array" operand MOV
+        ! Store tagged ptr in reg
+        "vector" get object %store-tagged
+    ] %allot
+] H{
+    { +input+ { { f "array" } { f "length" } } }
+    { +scratch+ { { f "vector" } } }
+    { +output+ { "vector" } }
+} define-intrinsic
+
+\ curry [
+    \ curry 3 cells [
+        1 object@ "obj" operand MOV
+        2 object@ "quot" operand MOV
+        ! Store tagged ptr in reg
+        "curry" get object %store-tagged
+    ] %allot
+] H{
+    { +input+ { { f "obj" } { f "quot" } } }
+    { +scratch+ { { f "curry" } } }
+    { +output+ { "curry" } }
+} define-intrinsic
+
+! Alien intrinsics
+: %alien-integer-get ( quot reg -- )
+    small-reg PUSH
+    "offset" operand %untag-fixnum
+    "alien" operand-class %alien-accessor
+    "offset" operand small-reg MOV
+    "offset" operand %tag-fixnum
+    small-reg POP ; inline
+
+: alien-integer-get-template
+    H{
+        { +input+ {
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +output+ { "offset" } }
+        { +clobber+ { "alien" "offset" } }
+    } ;
+
+: define-getter
+    [ %alien-integer-get ] 2curry
+    alien-integer-get-template
+    define-intrinsic ;
+
+: define-unsigned-getter
+    [ small-reg dup XOR MOV ] swap define-getter ;
+
+: define-signed-getter
+    [ [ >r MOV small-reg r> MOVSX ] curry ] keep define-getter ;
+
+: %alien-integer-set ( quot reg -- )
+    small-reg PUSH
+    { "offset" "value" } %untag-fixnums
+    small-reg "value" operand MOV
+    "alien" operand-class %alien-accessor
+    small-reg POP ; inline
+
+: alien-integer-set-template
+    H{
+        { +input+ {
+            { f "value" fixnum }
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +clobber+ { "value" "alien" "offset" } }
+    } ;
+
+: define-setter
+    [ swap MOV ] swap
+    [ %alien-integer-set ] 2curry
+    alien-integer-set-template
+    define-intrinsic ;
+
+\ alien-unsigned-1 small-reg-8 define-unsigned-getter
+\ set-alien-unsigned-1 small-reg-8 define-setter
+
+\ alien-signed-1 small-reg-8 define-signed-getter
+\ set-alien-signed-1 small-reg-8 define-setter
+
+\ alien-unsigned-2 small-reg-16 define-unsigned-getter
+\ set-alien-unsigned-2 small-reg-16 define-setter
+
+\ alien-signed-2 small-reg-16 define-signed-getter
+\ set-alien-signed-2 small-reg-16 define-setter
+
+\ alien-cell [
+    "offset" operand %untag-fixnum
+
+    [ MOV ]
+    "offset" operand
+    "alien" operand-class
+    %alien-accessor
+
+    "offset" get %allot-alien
+] alien-integer-get-template define-intrinsic
diff --git a/core/cpu/x86/sse2/authors.txt b/core/cpu/x86/sse2/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/cpu/x86/sse2/sse2.factor b/core/cpu/x86/sse2/sse2.factor
new file mode 100644 (file)
index 0000000..3fa83a4
--- /dev/null
@@ -0,0 +1,113 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays cpu.x86.assembler cpu.x86.architecture
+generic kernel kernel.private math math.private memory
+namespaces sequences words generator generator.registers
+cpu.architecture math.floats.private layouts quotations ;
+IN: cpu.x86.sse2
+
+M: float-regs (%peek)
+    drop
+    temp-reg swap %move-int>int
+    temp-reg %move-int>float ;
+
+M: float-regs (%replace) drop swap %move-float>int ;
+
+: define-float-op ( word op -- )
+    [ "x" operand "y" operand ] swap add H{
+        { +input+ { { float "x" } { float "y" } } }
+        { +output+ { "x" } }
+    } define-intrinsic ;
+
+{
+    { float+ ADDSD }
+    { float- SUBSD }
+    { float* MULSD }
+    { float/f DIVSD }
+} [
+    first2 define-float-op
+] each
+
+: define-float-jump ( word op -- )
+    [ "x" operand "y" operand UCOMISD ] swap add
+    { { float "x" } { float "y" } } define-if-intrinsic ;
+
+{
+    { float< JB }
+    { float<= JBE }
+    { float> JA }
+    { float>= JAE }
+    { float= JE }
+} [
+    first2 define-float-jump
+] each
+
+\ float>fixnum [
+    "out" operand "in" operand CVTTSD2SI
+    "out" operand tag-bits get SHL
+] H{
+    { +input+ { { float "in" } } }
+    { +scratch+ { { f "out" } } }
+    { +output+ { "out" } }
+} define-intrinsic
+
+\ fixnum>float [
+    "in" operand %untag-fixnum
+    "out" operand "in" operand CVTSI2SD
+] H{
+    { +input+ { { f "in" } } }
+    { +scratch+ { { float "out" } } }
+    { +output+ { "out" } }
+    { +clobber+ { "in" } }
+} define-intrinsic
+
+: %alien-float-get ( quot -- )
+    "offset" operand %untag-fixnum
+    "output" operand "alien" operand-class %alien-accessor ;
+    inline
+
+: alien-float-get-template
+    H{
+        { +input+ {
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +scratch+ { { float "output" } } }
+        { +output+ { "output" } }
+        { +clobber+ { "alien" "offset" } }
+    } ;
+
+: %alien-float-set ( quot -- )
+    "offset" operand %untag-fixnum
+    "value" operand "alien" operand-class %alien-accessor ;
+    inline
+
+: alien-float-set-template
+    H{
+        { +input+ {
+            { float "value" float }
+            { f "alien" simple-c-ptr }
+            { f "offset" fixnum }
+        } }
+        { +clobber+ { "value" "alien" "offset" } }
+    } ;
+
+: define-alien-float-intrinsics ( word get-quot word set-quot -- )
+    [ %alien-float-set ] curry
+    alien-float-set-template
+    define-intrinsic
+    [ %alien-float-get ] curry
+    alien-float-get-template
+    define-intrinsic ;
+
+\ alien-double
+[ MOVSD ]
+\ set-alien-double
+[ swap MOVSD ]
+define-alien-float-intrinsics
+
+\ alien-float
+[ dupd MOVSS dup CVTSS2SD ]
+\ set-alien-float
+[ swap dup dup CVTSD2SS MOVSS ]
+define-alien-float-intrinsics
diff --git a/core/cpu/x86/sse2/summary.txt b/core/cpu/x86/sse2/summary.txt
new file mode 100644 (file)
index 0000000..dd2d309
--- /dev/null
@@ -0,0 +1 @@
+SSE2 floating point intrinsics for Pentium 4 and above
diff --git a/core/cpu/x86/summary.txt b/core/cpu/x86/summary.txt
new file mode 100644 (file)
index 0000000..ecaa508
--- /dev/null
@@ -0,0 +1 @@
+32-bit x86 compiler backend
diff --git a/core/debugger.factor b/core/debugger.factor
deleted file mode 100644 (file)
index c8ce092..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays definitions generic hashtables tools io
-kernel math namespaces parser prettyprint sequences
-sequences-internals strings styles vectors words errors ;
-IN: kernel-internals
-
-: save-error ( error trace continuation -- )
-    error-continuation set-global
-    error-stack-trace set-global
-    dup error set-global
-    compute-restarts restarts set-global ;
-
-: error-handler ( error trace -- )
-    dupd continuation save-error rethrow ;
-
-: init-error-handler ( -- )
-    V{ } clone set-catchstack
-    ! kernel calls on error
-    [ error-handler ] 5 setenv
-    \ kernel-error 12 setenv ;
-
-: find-xt ( xt xtmap -- word )
-    [ second - ] binsearch* first ;
-
-: symbolic-stack-trace ( seq -- seq )
-    xt-map 2 group swap [ dup rot find-xt 2array ] map-with ;
-
-IN: errors
-
-GENERIC: error. ( error -- )
-GENERIC: error-help ( error -- topic )
-
-M: object error. . ;
-M: object error-help drop f ;
-
-M: tuple error. describe ;
-M: tuple error-help class ;
-
-M: string error. print ;
-
-: :s ( -- )
-    error-continuation get continuation-data stack. ;
-
-: :r ( -- )
-    error-continuation get continuation-retain stack. ;
-
-: xt. ( xt -- )
-    >hex cell 2 * CHAR: 0 pad-left write ;
-
-: word-xt. ( xt word -- )
-    "Compiled: " write dup pprint bl
-    "(offset " write word-xt - >hex write ")" print ;
-
-: :trace
-    error-stack-trace get symbolic-stack-trace <reversed>
-    [ first2 word-xt. ] each ;
-
-: :c ( -- )
-    error-continuation get continuation-call callstack. :trace ;
-
-: :get ( variable -- value )
-    error-continuation get continuation-name hash-stack ;
-
-: :res ( n -- )
-    restarts get-global nth f restarts set-global restart ;
-
-: restart. ( restart n -- )
-    [ # " :res  " % restart-name % ] "" make print ;
-
-: restarts. ( -- )
-    restarts get dup empty? [
-        drop
-    ] [
-        terpri
-        "The following restarts are available:" print
-        terpri
-        dup length [ restart. ] 2each
-    ] if ;
-
-: debug-help ( -- )
-    terpri
-    "Debugger commands:" print
-    terpri
-    ":help - documentation for this error" print
-    ":s    - data stack at exception time" print
-    ":r    - retain stack at exception time" print
-    ":c    - call stack at exception time" print
-
-    error get [ parse-error? ] is? [
-        ":edit - jump to source location" print
-    ] when
-
-    ":get  ( var -- value ) accesses variables at time of the error" print
-    flush ;
-
-: print-error ( error -- )
-    [
-        dup error.
-    ] [
-        "Error in print-error!" print drop
-    ] recover drop ;
-
-SYMBOL: error-hook
-
-[ print-error restarts. debug-help ] error-hook set-global
-
-: try ( quot -- )
-    [ error-hook get call ] recover ;
diff --git a/core/debugger.facts b/core/debugger.facts
deleted file mode 100644 (file)
index 555b8d9..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-IN: errors
-USING: alien arrays generic help kernel math memory
-strings vectors ;
-
-HELP: :s
-{ $description "Prints the data stack at the time of the most recent error. Used for interactive debugging." } ;
-
-HELP: :r
-{ $description "Prints the retain stack at the time of the most recent error. Used for interactive debugging." } ;
-
-HELP: :c
-{ $description "Prints the call stack at the time of the most recent error. Used for interactive debugging." } ;
-
-HELP: :get
-{ $values { "variable" "an object" } { "value" "the value, or f" } }
-{ $description "Looks up the value of a variable at the time of the most recent error." } ;
-
-HELP: :res
-{ $values { "n" "a non-negative integer" } }
-{ $description "Continues executing the " { $snippet "n" } "th restart." } ;
-
-HELP: error.
-{ $values { "error" "an error" } }
-{ $contract "Print an error to the default stream." } ;
-
-HELP: error-help
-{ $values { "error" "an error" } { "topic" "an article name or word" } }
-{ $contract "Outputs a help article which explains the error." }
-{ $see-also :help } ;
-
-HELP: print-error
-{ $values { "error" "an error" } }
-{ $description "Print an error to the default stream. This word gets called by the listener and other tools which report caught errors to the user. You can define methods on this generic word for custom error reporting." } ;
-
-HELP: try
-{ $values { "quot" "a quotation" } }
-{ $description "Calls the quotation. If it throws an error, logs the error to the default stream and restores the data stack." } ;
-
-HELP: expired-error.
-{ $error-description "Thrown by " { $link alien-address } " and " { $link alien-invoke } " if an " { $link alien } " object passed in as a parameter has expired. Alien objects expire if they are saved an image which is subsequently loaded; this prevents a certain class of programming errors, usually attempts to use uninitialized objects, since holding a C address is meaningless between sessions." }
-{ $notes "You can check if an alien object has expired by calling " { $link expired? } "." } ;
-
-HELP: io-error.
-{ $error-description "Thrown by the C streams I/O primitives if an I/O error occurs." } ;
-
-HELP: undefined-word-error.
-{ $error-description "Thrown if an attempt is made to call a word which was defined by " { $link POSTPONE: DEFER: } "." } ;
-
-HELP: type-check-error.
-{ $error-description "Thrown by various primitives if one of the inputs does not have the expected type. Generic words throw " { $link no-method } " and " { $link no-math-method } " errors in such cases instead." } ;
-
-HELP: divide-by-zero-error.
-{ $error-description "This error is thrown when " { $link / } " or " { $link /i } " is called with with a zero denominator." }
-{ $see-also "division-by-zero" } ;
-
-HELP: signal-error.
-{ $error-description
-    "Thrown by the runtime when a Unix signal is received. While signal numbers are system-specific, the following are relatively standard:"
-    { $list
-        { "4 - Illegal instruction. If you see this error, it is a bug in Factor's compiler and should be reported." }
-        { "8 - Arithmetic exception. Most likely a divide by zero in " { $link /i } "." }
-        { "10, 11 - Memory protection fault. This error suggests invalid values are being passed to C functions by an " { $link alien-invoke } ". Factor also uses memory protection to trap stack underflows and overflows, but usually these are reported as their own errors. Sometimes they'll show up as a generic signal 11, though." }
-    }
-    "The Windows equivalent of a signal 11 is a SEH fault. When one occurs, the runtime throws a singal error, even though it does not correspond to a Unix signal."
-} ;
-
-HELP: negative-array-size-error.
-{ $error-description "Thrown by " { $link <array> } ", " { $link <string> } ", " { $link <vector> } " and " { $link <sbuf> } " if a negative capacity is specified." } ;
-
-HELP: c-string-error.
-{ $error-description "Thrown by " { $link alien-invoke } " and various primitives if a string containing null bytes, or characters with values higher than 255 is passed in where a C string is expected. See " { $link "c-strings" } "." } ;
-
-HELP: ffi-error.
-{ $error-description "Thrown by " { $link dlopen } " and " { $link dlsym } " if a problem occurs while loading a native library or looking up a symbol. See " { $link "alien" } "." } ;
-
-HELP: heap-scan-error.
-{ $error-description "Thrown if " { $link next-object } " is called outside of a " { $link begin-scan } "/" { $link end-scan } " pair." } ;
-
-HELP: undefined-symbol-error.
-{ $error-description "Thrown if a previously-compiled " { $link alien-invoke } " call refers to a native library symbol which no longer exists." } ;
-
-HELP: user-interrupt.
-{ $error-description "Thrown by the " { $snippet "t" } " command in the FEP." } ;
-
-HELP: datastack-underflow.
-{ $error-description "Thrown by the runtime if an attempt is made to pop elements from an empty data stack." }
-{ $notes "You can use the stack effect tool to statically check stack effects of quotations. See " { $link "inference" } "." } ;
-
-HELP: datastack-overflow.
-{ $error-description "Thrown by the runtime if an attempt is made to push elements on a full data stack." }
-{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a data stack larger than the default, see " { $link "runtime-cli-args" } "." } ;
-
-HELP: retainstack-underflow.
-{ $error-description "Thrown by the runtime if " { $link r> } " is called while the retain stack is empty." }
-{ $notes "You can use the stack effect tool to statically check stack effects of quotations. See " { $link "inference" } "." } ;
-
-HELP: retainstack-overflow.
-{ $error-description "Thrown by the runtime if " { $link >r } " is called when the retain stack is full." }
-{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a retain stack larger than the default, see " { $link "runtime-cli-args" } "." } ;
-
-HELP: callstack-overflow.
-{ $error-description "Thrown by the runtime if the call stack is full." }
-{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a call stack larger than the default, see " { $link "runtime-cli-args" } "." } ;
diff --git a/core/debugger/authors.txt b/core/debugger/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/debugger/debugger-docs.factor b/core/debugger/debugger-docs.factor
new file mode 100644 (file)
index 0000000..d5c7ecf
--- /dev/null
@@ -0,0 +1,174 @@
+USING: alien arrays generic generic.math help.markup help.syntax
+kernel math memory strings sbufs vectors io io.files classes
+help generic.standard continuations system ;
+IN: debugger
+
+ARTICLE: "errors-assert" "Assertions"
+"Some words to make assertions easier to enforce:"
+{ $subsection assert }
+{ $subsection assert= }
+"Runtime stack depth checking:"
+{ $subsection depth }
+{ $subsection assert-depth } ;
+
+ARTICLE: "debugger" "The debugger"
+"Caught errors can be logged in human-readable form:"
+{ $subsection print-error }
+{ $subsection try }
+"User-defined errors can have customized printed representation by implementing a generic word:"
+{ $subsection error. }
+"A number of words facilitate interactive debugging of errors:"
+{ $subsection :s }
+{ $subsection :r }
+{ $subsection :c }
+{ $subsection :get }
+"Most types of errors are documented, and the documentation is instantly accessible:"
+{ $subsection :help }
+"If the error was restartable, a list of restarts is also printed, and a numbered restart can be invoked:"
+{ $subsection :1 }
+{ $subsection :2 }
+{ $subsection :3 }
+{ $subsection :res }
+"Assertions:"
+{ $subsection "errors-assert" }
+"You can read more about error handling in " { $link "errors" } "." ;
+
+ABOUT: "debugger"
+
+HELP: :s
+{ $description "Prints the data stack at the time of the most recent error. Used for interactive debugging." } ;
+
+HELP: :r
+{ $description "Prints the retain stack at the time of the most recent error. Used for interactive debugging." } ;
+
+HELP: :c
+{ $description "Prints the call stack at the time of the most recent error. Used for interactive debugging." } ;
+
+HELP: :get
+{ $values { "variable" "an object" } { "value" "the value, or f" } }
+{ $description "Looks up the value of a variable at the time of the most recent error." } ;
+
+HELP: :res
+{ $values { "n" "a positive integer" } }
+{ $description "Continues executing the " { $snippet "n" } "th restart. Since restarts may only be invoked once, this resets the " { $link restarts } " global variable." } ;
+
+HELP: :1
+{ $description "A shortcut for invoking the first restart." } ;
+
+HELP: :2
+{ $description "A shortcut for invoking the second restart." } ;
+
+HELP: :3
+{ $description "A shortcut for invoking the third restart." } ;
+
+HELP: error.
+{ $values { "error" "an error" } }
+{ $contract "Print an error to the " { $link stdio } " stream.  You can define methods on this generic word to print human-readable messages for custom errors." }
+{ $notes "Code should call " { $link print-error } " instead, which handles the case where the printing of the error itself throws an error." } ;
+
+HELP: error-help
+{ $values { "error" "an error" } { "topic" "an article name or word" } }
+{ $contract "Outputs a help article which explains the error." } ;
+
+{ error-help :help } related-words
+
+HELP: print-error
+{ $values { "error" "an error" } }
+{ $description "Print an error to the " { $link stdio } " stream." }
+{ $notes "This word is called by the listener and other tools which report caught errors to the user." } ;
+
+HELP: restarts.
+{ $description "Print a list of restarts for the most recently thrown error to the " { $link stdio } " stream." } ;
+
+HELP: debug-help
+{ $description "Print a synopsis of useful debugger words." } ;
+
+HELP: error-hook
+{ $var-description "A quotation with stack effect " { $snippet "( error -- )" } " which is used by " { $link try } " to report the error to the user." }
+{ $examples "The default value prints the error with " { $link print-error } ", followed by a list of restarts and a help message. The graphical listener sets this variable to display a popup instead." } ;
+
+HELP: try
+{ $values { "quot" "a quotation" } }
+{ $description "Calls the quotation. If it throws an error, calls " { $link error-hook } " with the error and restores the data stack." } ;
+
+HELP: expired-error.
+{ $error-description "Thrown by " { $link alien-address } " and " { $link alien-invoke } " if an " { $link alien } " object passed in as a parameter has expired. Alien objects expire if they are saved an image which is subsequently loaded; this prevents a certain class of programming errors, usually attempts to use uninitialized objects, since holding a C address is meaningless between sessions." }
+{ $notes "You can check if an alien object has expired by calling " { $link expired? } "." } ;
+
+HELP: io-error.
+{ $error-description "Thrown by the C streams I/O primitives if an I/O error occurs." } ;
+
+HELP: undefined-word-error.
+{ $error-description "Thrown if an attempt is made to call a word which was defined by " { $link POSTPONE: DEFER: } "." } ;
+
+HELP: type-check-error.
+{ $error-description "Thrown by various primitives if one of the inputs does not have the expected type. Generic words throw " { $link no-method } " and " { $link no-math-method } " errors in such cases instead." } ;
+
+HELP: divide-by-zero-error.
+{ $error-description "This error is thrown when " { $link / } " or " { $link /i } " is called with with a zero denominator." }
+{ $see-also "division-by-zero" } ;
+
+HELP: signal-error.
+{ $error-description
+    "Thrown by the Factor VM when a Unix signal is received. While signal numbers are system-specific, the following are relatively standard:"
+    { $list
+        { "4 - Illegal instruction. If you see this error, it is a bug in Factor's compiler and should be reported." }
+        { "8 - Arithmetic exception. Most likely a divide by zero in " { $link /i } "." }
+        { "10, 11 - Memory protection fault. This error suggests invalid values are being passed to C functions by an " { $link alien-invoke } ". Factor also uses memory protection to trap stack underflows and overflows, but usually these are reported as their own errors. Sometimes they'll show up as a generic signal 11, though." }
+    }
+    "The Windows equivalent of a signal 11 is a SEH fault. When one occurs, the runtime throws a singal error, even though it does not correspond to a Unix signal."
+} ;
+
+HELP: array-size-error.
+{ $error-description "Thrown by " { $link <array> } ", " { $link <string> } ", " { $link <vector> } " and " { $link <sbuf> } " if the specified capacity is negative or too large." } ;
+
+HELP: c-string-error.
+{ $error-description "Thrown by " { $link alien-invoke } " and various primitives if a string containing null bytes, or characters with values higher than 255 is passed in where a C string is expected. See " { $link "c-strings" } "." } ;
+
+HELP: ffi-error.
+{ $error-description "Thrown by " { $link dlopen } " and " { $link dlsym } " if a problem occurs while loading a native library or looking up a symbol. See " { $link "alien" } "." } ;
+
+HELP: heap-scan-error.
+{ $error-description "Thrown if " { $link next-object } " is called outside of a " { $link begin-scan } "/" { $link end-scan } " pair." } ;
+
+HELP: undefined-symbol-error.
+{ $error-description "Thrown if a previously-compiled " { $link alien-invoke } " call refers to a native library symbol which no longer exists." } ;
+
+HELP: datastack-underflow.
+{ $error-description "Thrown by the Factor VM if an attempt is made to pop elements from an empty data stack." }
+{ $notes "You can use the stack effect tool to statically check stack effects of quotations. See " { $link "inference" } "." } ;
+
+HELP: datastack-overflow.
+{ $error-description "Thrown by the Factor VM if an attempt is made to push elements on a full data stack." }
+{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a data stack larger than the default, see " { $link "runtime-cli-args" } "." } ;
+
+HELP: retainstack-underflow.
+{ $error-description "Thrown by the Factor VM if " { $link r> } " is called while the retain stack is empty." }
+{ $notes "You can use the stack effect tool to statically check stack effects of quotations. See " { $link "inference" } "." } ;
+
+HELP: retainstack-overflow.
+{ $error-description "Thrown by the Factor VM if " { $link >r } " is called when the retain stack is full." }
+{ $notes "This error usually indicates a run-away recursion, however if you legitimately need a retain stack larger than the default, see " { $link "runtime-cli-args" } "." } ;
+
+HELP: memory-error.
+{ $error-description "Thrown by the Factor VM if an invalid memory access occurs." }
+{ $notes "This can be a result of incorrect usage of C library interface words, a bug in the compiler, or a bug in the VM." } ;
+
+HELP: primitive-error.
+{ $error-description "Thrown by the Factor VM if an unsupported primitive word is called." }
+{ $notes "This word is only ever thrown on Windows CE, where the " { $link cwd } ", " { $link cd } ", and " { $link os-env } " primitives are unsupported." } ;
+
+HELP: assert
+{ $values { "got" "the obtained value" } { "expect" "the expected value" } }
+{ $description "Throws an " { $link assert } " error." }
+{ $error-description "Thrown when a unit test or other assertion fails." } ;
+
+{ assert assert-depth } related-words
+
+HELP: depth
+{ $values { "n" "a non-negative integer" } }
+{ $description "Outputs the number of elements on the data stack." } ;
+
+HELP: assert-depth
+{ $values { "quot" "a quotation" } }
+{ $description "Runs a quotation. Throws an error if the total number of elements on the stack is not the same before and after the quotation runs." } ;
diff --git a/core/debugger/debugger.factor b/core/debugger/debugger.factor
new file mode 100644 (file)
index 0000000..bdeeb04
--- /dev/null
@@ -0,0 +1,223 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions generic hashtables inspector io kernel
+math namespaces prettyprint sequences assocs sequences.private
+strings io.styles vectors words system splitting math.parser
+tuples continuations continuations.private combinators
+generic.math io.streams.duplex classes
+generic.standard ;
+IN: debugger
+
+GENERIC: error. ( error -- )
+GENERIC: error-help ( error -- topic )
+
+M: object error. . ;
+M: object error-help drop f ;
+
+M: tuple error. describe ;
+M: tuple error-help class ;
+
+M: string error. print ;
+
+: :s ( -- )
+    error-continuation get continuation-data stack. ;
+
+: :r ( -- )
+    error-continuation get continuation-retain stack. ;
+
+: :c ( -- )
+    error-continuation get continuation-call callstack. ;
+
+: :get ( variable -- value )
+    error-continuation get continuation-name assoc-stack ;
+
+: :res ( n -- )
+    1- restarts get-global nth f restarts set-global restart ;
+
+: :1 1 :res ;
+: :2 2 :res ;
+: :3 3 :res ;
+
+: restart. ( restart n -- )
+    [
+        1+ dup 3 <= [ ":" % # "    " % ] [ # " :res  " % ] if
+        restart-name %
+    ] "" make print ;
+
+: restarts. ( -- )
+    restarts get dup empty? [
+        drop
+    ] [
+        nl
+        "The following restarts are available:" print
+        nl
+        dup length [ restart. ] 2each
+    ] if ;
+
+: debug-help ( -- )
+    nl
+    "Debugger commands:" print
+    nl
+    ":help - documentation for this error" print
+    ":s    - data stack at exception time" print
+    ":r    - retain stack at exception time" print
+    ":c    - call stack at exception time" print
+    ":edit - jump to source location (parse errors only)" print
+
+    ":get  ( var -- value ) accesses variables at time of the error" print
+    flush ;
+
+: print-error ( error -- )
+    [ error. flush ] curry
+    [ global [ "Error in print-error!" print drop ] bind ]
+    recover ;
+
+SYMBOL: error-hook
+
+[ print-error restarts. debug-help ] error-hook set-global
+
+: try ( quot -- )
+    [ error-hook get call ] recover ;
+
+TUPLE: assert got expect ;
+
+: assert ( got expect -- * ) \ assert construct-boa throw ;
+
+: assert= ( a b -- ) 2dup = [ 2drop ] [ assert ] if ;
+
+: depth ( -- n ) datastack length ;
+
+: assert-depth ( quot -- ) depth slip depth swap assert= ;
+
+: expired-error. ( obj -- )
+    "Object did not survive image save/load: " write third . ;
+
+: undefined-word-error. ( obj -- )
+    "Undefined word: " write third . ;
+
+: io-error. ( error -- )
+    "I/O error: " write third print ;
+
+: type-check-error. ( obj -- )
+    "Type check error" print
+    "Object: " write dup fourth short.
+    "Object type: " write dup fourth class .
+    "Expected type: " write third type>class . ;
+
+: divide-by-zero-error. ( obj -- )
+    "Division by zero" print drop ;
+
+: signal-error. ( obj -- )
+    "Operating system signal " write third . ;
+
+: array-size-error. ( obj -- )
+    "Invalid array size: " write dup third .
+    "Maximum: " write fourth 1- . ;
+
+: c-string-error. ( obj -- )
+    "Cannot convert to C string: " write third . ;
+
+: ffi-error. ( obj -- )
+    "FFI: " write
+    dup third [ write ": " write ] when*
+    fourth print ;
+
+: heap-scan-error. ( obj -- )
+    "Cannot do next-object outside begin/end-scan" print drop ;
+
+: undefined-symbol-error. ( obj -- )
+    "The image refers to a library or symbol that was not found"
+    " at load time" append print drop ;
+
+: stack-underflow. ( obj name -- )
+    write " stack underflow" print drop ;
+
+: stack-overflow. ( obj name -- )
+    write " stack overflow" print drop ;
+
+: datastack-underflow. "Data" stack-underflow. ;
+: datastack-overflow. "Data" stack-overflow. ;
+: retainstack-underflow. "Retain" stack-underflow. ;
+: retainstack-overflow. "Retain" stack-overflow. ;
+
+: memory-error.
+    "Memory protection fault at address " write third .h ;
+
+: primitive-error.
+    "Unimplemented primitive" print drop ;
+
+PREDICATE: array kernel-error ( obj -- ? )
+    {
+        { [ dup empty? ] [ drop f ] }
+        { [ dup first "kernel-error" = not ] [ drop f ] }
+        { [ t ] [ second 0 16 between? ] }
+    } cond ;
+
+: kernel-errors
+    second {
+        { 0  [ expired-error.          ] }
+        { 1  [ io-error.               ] }
+        { 2  [ undefined-word-error.   ] }
+        { 3  [ type-check-error.       ] }
+        { 4  [ divide-by-zero-error.   ] }
+        { 5  [ signal-error.           ] }
+        { 6  [ array-size-error.       ] }
+        { 7  [ c-string-error.         ] }
+        { 8  [ ffi-error.              ] }
+        { 9  [ heap-scan-error.        ] }
+        { 10 [ undefined-symbol-error. ] }
+        { 11 [ datastack-underflow.    ] }
+        { 12 [ datastack-overflow.     ] }
+        { 13 [ retainstack-underflow.  ] }
+        { 14 [ retainstack-overflow.   ] }
+        { 15 [ memory-error.           ] }
+        { 16 [ primitive-error.        ] }
+    } ; inline
+
+M: kernel-error error. dup kernel-errors case ;
+
+M: kernel-error error-help kernel-errors at first ;
+
+M: no-method summary
+    drop "No suitable method" ;
+
+M: no-method error.
+    "Generic word " write
+    dup no-method-generic pprint
+    " does not define a method for the " write
+    dup no-method-object class pprint
+    " class." print
+    "Allowed classes: " write dup no-method-generic order .
+    "Dispatching on object: " write no-method-object short. ;
+
+M: no-math-method summary
+    drop "No suitable arithmetic method" ;
+
+M: check-closed summary
+    drop "Attempt to perform I/O on closed stream" ;
+
+M: check-method summary
+    drop "Invalid parameters for define-method" ;
+
+M: check-tuple summary
+    drop "Invalid class for define-constructor" ;
+
+M: no-cond summary
+    drop "Fall-through in cond" ;
+
+M: no-case summary
+    drop "Fall-through in case" ;
+
+M: slice-error error.
+    "Cannot create slice because " write
+    slice-error-reason print ;
+
+M: bounds-error summary drop "Sequence index out of bounds" ;
+
+M: condition error. delegate error. ;
+
+M: condition error-help drop f ;
+
+M: assert summary drop "Assertion failed" ;
+
+M: immutable summary drop "Sequence is immutable" ;
diff --git a/core/debugger/summary.txt b/core/debugger/summary.txt
new file mode 100644 (file)
index 0000000..75c13e3
--- /dev/null
@@ -0,0 +1 @@
+Printing errors, inspecting tracebacks, restarts
diff --git a/core/definitions.factor b/core/definitions.factor
deleted file mode 100644 (file)
index 0d516b6..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: definitions
-USING: kernel sequences namespaces errors ;
-
-GENERIC: see ( defspec -- )
-
-GENERIC: where ( defspec -- loc )
-
-GENERIC: subdefs ( defspec -- seq )
-
-GENERIC: forget ( defspec -- )
-
-GENERIC: synopsis* ( defspec -- )
diff --git a/core/definitions.facts b/core/definitions.facts
deleted file mode 100644 (file)
index 3e1c4f9..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-IN: definitions
-USING: help words ;
-
-HELP: see
-{ $values { "defspec" "a definition specifier" } }
-{ $description "Prettyprints a definition." } ;
-
-HELP: where
-{ $values { "defspec" "a definition specifier" } { "loc" "an array holding a file name string and line number indexed from 1" } }
-{ $description "Outputs the location of a definition. If the location is not known, will output " { $snippet "{ f f }" } " or " { $link f } "." } ;
-
-HELP: forget
-{ $values { "defspec" "a definition specifier" } }
-{ $description "Forgets about a definition. For example, if it is a word, it will be removed from its vocabulary." } ;
diff --git a/core/definitions/authors.txt b/core/definitions/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/definitions/definitions-docs.factor b/core/definitions/definitions-docs.factor
new file mode 100644 (file)
index 0000000..eeb547b
--- /dev/null
@@ -0,0 +1,84 @@
+USING: help.markup help.syntax words math ;
+IN: definitions
+
+ARTICLE: "definition-protocol" "Definition protocol"
+"A common protocol is used to build generic tools for working with all definitions."
+$nl
+"Definitions must know what source file they were loaded from, and provide a way to set this:"
+{ $subsection where }
+{ $subsection set-where }
+"Definitions can be removed:"
+{ $subsection forget }
+"Definitions can answer a sequence of definitions they directly depend on:"
+{ $subsection uses }
+"When a definition is changed, all definitions which depend on it are notified via a hook:"
+{ $subsection redefined* }
+"Definitions must implement a few operations used for printing them in human and computer-readable form:"
+{ $subsection synopsis* }
+{ $subsection definer }
+{ $subsection definition } ;
+
+ARTICLE: "definitions" "Definitions"
+"A " { $emphasis "definition" } " is an artifact read from a source file. This includes words, methods, and help articles. Words for working with definitions are found in the " { $vocab-link "definitions" } " vocabulary."
+{ $subsection "definition-protocol" }
+"A common cross-referencing system is used to track definition usages:"
+{ $subsection crossref }
+{ $subsection xref }
+{ $subsection unxref }
+{ $subsection delete-xref }
+{ $subsection usage }
+"Implementations of the definition protocol include pathnames, words, methods, and help articles."
+{ $see-also "source-files" "words" "generic" "help-impl" } ;
+
+ABOUT: "definitions"
+
+HELP: where
+{ $values { "defspec" "a definition specifier" } { "loc" "a " { $snippet "{ path line# }" } " pair" } }
+{ $description "Outputs the location of a definition. If the location is not known, will output " { $link f } "." } ;
+
+HELP: set-where
+{ $values { "loc" "a " { $snippet "{ path line# }" } " pair" } { "defspec" "a definition specifier" } }
+{ $description "Sets the definition's location." }
+{ $notes "This word is used by the parser." } ;
+
+HELP: forget
+{ $values { "defspec" "a definition specifier" } }
+{ $description "Forgets about a definition. For example, if it is a word, it will be removed from its vocabulary." } ;
+
+HELP: uses
+{ $values { "defspec" "a definition specifier" } { "seq" "a sequence of definition specifiers" } }
+{ $description "Outputs a sequence of definitions directory called by the given definition." }
+{ $notes "The sequence might include the definition itself, if it is a recursive word." }
+{ $examples
+    "We can ask the " { $link sq } " word to produce a list of words it calls:"
+    { $unchecked-example "\ sq uses ." "{ dup * }" }
+} ;
+
+HELP: crossref
+{ $var-description "A graph whose vertices are definition specifiers and edges are usages. See " { $link "graphs" } "." } ;
+
+HELP: xref
+{ $values { "defspec" "a definition specifier" } }
+{ $description "Adds a vertex representing this definition, along with edges representing dependencies to the " { $link crossref } " graph." }
+$low-level-note ;
+
+HELP: usage
+{ $values { "defspec" "a definition specifier" } { "seq" "a sequence of definition specifiers" } }
+{ $description "Outputs a sequence of definitions that directly call the given definition." }
+{ $notes "The sequence might include the definition itself, if it is a recursive word." } ;
+
+HELP: redefined*
+{ $values { "defspec" "a definition specifier" } }
+{ $contract "Updates the definition to cope with a callee being redefined." }
+$low-level-note ;
+
+HELP: unxref
+{ $values { "defspec" "a definition specifier" } }
+{ $description "Remove edges leaving the vertex which represents the definition from the " { $link crossref } " graph." }
+{ $notes "This word is called before a word is redefined." } ;
+
+HELP: delete-xref
+{ $values { "defspec" "a definition specifier" } }
+{ $description "Remove the vertex which represents the definition from the " { $link crossref } " graph." }
+{ $notes "This word is called before a word is forgotten." }
+{ $see-also forget } ;
diff --git a/core/definitions/definitions.factor b/core/definitions/definitions.factor
new file mode 100644 (file)
index 0000000..9d31c8d
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: definitions
+USING: kernel sequences namespaces assocs graphs ;
+
+GENERIC: where ( defspec -- loc )
+
+M: object where drop f ;
+
+GENERIC: set-where ( loc defspec -- )
+
+GENERIC: forget ( defspec -- )
+
+M: object forget drop ;
+
+GENERIC: synopsis* ( defspec -- )
+
+GENERIC: definer ( defspec -- start end )
+
+GENERIC: definition ( defspec -- seq )
+
+SYMBOL: crossref
+
+GENERIC: uses ( defspec -- seq )
+
+M: object uses drop f ;
+
+: xref ( defspec -- ) dup uses crossref get add-vertex ;
+
+: usage ( defspec -- seq ) crossref get at keys ;
+
+GENERIC: redefined* ( defspec -- )
+
+M: object redefined* drop ;
+
+: redefined ( defspec -- )
+    [ crossref get at ] closure [ drop redefined* ] assoc-each ;
+
+: unxref ( defspec -- )
+    dup uses crossref get remove-vertex ;
+
+: delete-xref ( defspec -- )
+    dup unxref crossref get delete-at ;
diff --git a/core/definitions/summary.txt b/core/definitions/summary.txt
new file mode 100644 (file)
index 0000000..79a7ba4
--- /dev/null
@@ -0,0 +1 @@
+Definition protocol and cross-referencing
diff --git a/core/definitions/tags.txt b/core/definitions/tags.txt
new file mode 100644 (file)
index 0000000..8ba7ae8
--- /dev/null
@@ -0,0 +1,2 @@
+tools
+reflection
diff --git a/core/documentation.factor b/core/documentation.factor
deleted file mode 100644 (file)
index 249a6eb..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-PROVIDE: core/documentation
-{ +directory+ "core" }
-{ +files+ {
-    "continuations.facts"
-    "definitions.facts"
-    "effects.facts"
-    "errors.facts"
-    "kernel.facts"
-    "modules.facts"
-    "quotations.facts"
-    "threads.facts"
-    "words.facts"
-    "listener.facts"
-    "debugger.facts"
-    "bootstrap/init.facts"
-    "collections/growable.facts"
-    "collections/arrays.facts"
-    "collections/graphs.facts"
-    "collections/hashtables.facts"
-    "collections/namespaces.facts"
-    "collections/queues.facts"
-    "collections/sbuf.facts"
-    "collections/sequence-combinators.facts"
-    "collections/sequence-sort.facts"
-    "collections/sequences-epilogue.facts"
-    "collections/sequences.facts"
-    "collections/slicing.facts"
-    "collections/strings.facts"
-    "collections/flatten.facts"
-    "collections/vectors.facts"
-    "collections/virtual-sequences.facts"
-    "generic/early-generic.facts"
-    "generic/classes.facts"
-    "generic/generic.facts"
-    "generic/methods.facts"
-    "generic/math-combination.facts"
-    "generic/slots.facts"
-    "generic/standard-combination.facts"
-    "generic/tuple.facts"
-    "help/help.facts"
-    "help/markup.facts"
-    "help/syntax.facts"
-    "help/topics.facts"
-    "io/binary.facts"
-    "io/c-streams.facts"
-    "io/duplex-stream.facts"
-    "io/files.facts"
-    "io/lines.facts"
-    "io/nested-style.facts"
-    "io/plain-stream.facts"
-    "io/server.facts"
-    "io/stdio.facts"
-    "io/stream.facts"
-    "io/string-streams.facts"
-    "io/styles.facts"
-    "math/arc-trig-hyp.facts"
-    "math/complex.facts"
-    "math/constants.facts"
-    "math/float.facts"
-    "math/integer.facts"
-    "math/math.facts"
-    "math/parse-numbers.facts"
-    "math/pow.facts"
-    "math/random.facts"
-    "math/ratio.facts"
-    "math/trig-hyp.facts"
-    "math/vectors.facts"
-    "prettyprint/core.facts"
-    "prettyprint/sections.facts"
-    "prettyprint/backend.facts"
-    "prettyprint/frontend.facts"
-    "prettyprint/describe.facts"
-    "syntax/early-parser.facts"
-    "syntax/parse-stream.facts"
-    "syntax/parser.facts"
-    "syntax/parse-syntax.facts"
-} } ;
diff --git a/core/effects.factor b/core/effects.factor
deleted file mode 100644 (file)
index da7cbd0..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: words
-USING: kernel math namespaces sequences strings generic ;
-
-TUPLE: effect in out terminated? ;
-
-C: effect
-    [
-        over { "*" } sequence=
-        [ nip t swap set-effect-terminated? ]
-        [ set-effect-out ] if
-    ] keep
-    [ set-effect-in ] keep ;
-
-: effect-height ( effect -- n )
-    dup effect-out length swap effect-in length - ;
-
-: effect<= ( eff1 eff2 -- ? )
-    2dup [ effect-terminated? ] 2apply = >r
-    2dup [ effect-in length ] 2apply <= >r
-    [ effect-height ] 2apply number= r> and r> and ;
-
-: stack-picture ( seq -- string )
-    [
-        [
-            {
-                { [ dup string? ] [ ] }
-                { [ dup word? ] [ word-name ] }
-                { [ dup integer? ] [ drop "object" ] }
-            } cond % CHAR: \s ,
-        ] each
-    ] "" make ;
-
-: effect>string ( effect -- string )
-    [
-        "( " %
-        dup effect-in stack-picture %
-        "-- " %
-        dup effect-out stack-picture %
-        effect-terminated? [ "* " % ] when
-        ")" %
-    ] "" make ;
-
-: stack-effect ( word -- effect/f )
-    dup "declared-effect" word-prop [ ] [
-        dup "inferred-effect" word-prop [ ] [ drop f ] ?if
-    ] ?if ;
-
-M: effect clone
-    [ effect-in clone ] keep effect-out clone <effect> ;
diff --git a/core/effects.facts b/core/effects.facts
deleted file mode 100644 (file)
index 8616fd3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-IN: words
-USING: help ;
-
-HELP: effect
-{ $class-description "An object representing a stack effect. Holds a sequence of inputs, a sequence of outputs and a flag indicating if an error is thrown unconditionally." } ;
-
-HELP: effect-height
-{ $values { "effect" "a stack effect" } { "n" "an integer" } }
-{ $description "Outputs the number of items added to the data stack by the stack effect. This will be negative if the stack effect only removes objects from the stack." } ;
-
-HELP: effect<=
-{ $values { "eff1" "a stack effect" } { "eff2" "a stack effect" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "eff1" } " can be used anywhere " { $snippet "eff2" } " can. What this means is that both stack effects change the stack height by the same amount, the first takes a smaller or equal number of inputs as the second, and either both or neither one terminate execution by throwing an error." } ;
-
-HELP: effect>string
-{ $values { "effect" "a stack effect" } { "string" "a string" } }
-{ $description "Turns a stack effect object into a string mnemonic." }
-{ $examples
-    { $example "1 2 <effect> effect>string print" "( object -- object object )" }
-} ;
-
-HELP: stack-effect
-{ $values { "word" "a word" } { "effect/f" "a stack effect" } }
-{ $description "Outputs the stack effect of a word; either a stack effect declared with " { $link POSTPONE: ( } ", or an inferred stack effect (see " { $link "inference" } "." } ;
diff --git a/core/effects/authors.txt b/core/effects/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/effects/effects-docs.factor b/core/effects/effects-docs.factor
new file mode 100644 (file)
index 0000000..f473eb5
--- /dev/null
@@ -0,0 +1,66 @@
+USING: help.markup help.syntax math strings words ;
+IN: effects
+
+ARTICLE: "effect-declaration" "Stack effect declaration"
+"It is good practice to declare the stack effects of words using the following syntax:"
+{ $code ": sq ( x -- y ) dup * ;" }
+"A stack effect declaration is written in parentheses and lists word inputs and outputs, separated by " { $snippet "--" } ". Stack effect declarations are read in using a parsing word:"
+{ $subsection POSTPONE: ( }
+"Stack elements in a stack effect are ordered so that the top of the stack is on the right side. Each value can be named by a data type or description. The following are some examples of value names:"
+{ $table
+    { { { $snippet "?" } } "a boolean" }
+    { { { $snippet "elt" } } "an object which is an element of a sequence" }
+    { { { $snippet "m" } ", " { $snippet "n" } } "an integer" }
+    { { { $snippet "obj" } } "an object" }
+    { { { $snippet "quot" } } "a quotation" }
+    { { { $snippet "seq" } } "a sequence" }
+    { { { $snippet "assoc" } } "an associative mapping" }
+    { { { $snippet "str" } } "a string" }
+    { { { $snippet "x" } ", " { $snippet "y" } ", " { $snippet "z" } } "a number" }
+    { { $snippet "loc" } "a screen location specified as a two-element array holding x and y co-ordinates" }
+    { { $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" }
+}
+"The stack effect inferencer verifies stack effect comments to ensure the correct number of inputs and outputs is listed. Value names are ignored; only their number matters. An error is thrown if a word's declared stack effect does not match its inferred stack effect."
+$nl
+"Recursive words must declare a stack effect in order to compile. This includes all generic words, due to how delegation is implemented." ;
+
+ARTICLE: "effects" "Stack effects"
+"A " { $emphasis "stack effect declaration" } ", for example " { $snippet "( x y -- z )" } " denotes that an operation takes two inputs, with " { $snippet "y" } " at the top of the stack, and returns one output."
+$nl
+"Stack effects are first-class, and words for working with them are found in the " { $vocab-link "effects" } " vocabulary."
+{ $subsection effect }
+{ $subsection effect? }
+"Stack effects of words can be declared."
+{ $subsection "effect-declaration" }
+"Getting a word's declared stack effect:"
+{ $subsection stack-effect }
+"Converting a stack effect to a string form:"
+{ $subsection effect>string }
+"Comparing effects:"
+{ $subsection effect-height }
+{ $subsection effect<= } ;
+
+ABOUT: "effects"
+
+HELP: effect
+{ $class-description "An object representing a stack effect. Holds a sequence of inputs, a sequence of outputs and a flag indicating if an error is thrown unconditionally." } ;
+
+HELP: effect-height
+{ $values { "effect" effect } { "n" integer } }
+{ $description "Outputs the number of objects added to the data stack by the stack effect. This will be negative if the stack effect only removes objects from the stack." } ;
+
+HELP: effect<=
+{ $values { "eff1" effect } { "eff2" effect } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "eff1" } " is substitutable for " { $snippet "eff2" } ". What this means is that both stack effects change the stack height by the same amount, the first takes a smaller or equal number of inputs as the second, and either both or neither one terminate execution by throwing an error." } ;
+
+HELP: effect>string
+{ $values { "effect" effect } { "string" string } }
+{ $description "Turns a stack effect object into a string mnemonic." }
+{ $examples
+    { $example "USE: effects" "1 2 <effect> effect>string print" "( object -- object object )" }
+} ;
+
+HELP: stack-effect
+{ $values { "word" word } { "effect/f" "an " { $link effect } " or " { $link f } } }
+{ $description "Outputs the stack effect of a word; either a stack effect declared with " { $link POSTPONE: ( } ", or an inferred stack effect (see " { $link "inference" } "." } ;
diff --git a/core/effects/effects-tests.factor b/core/effects/effects-tests.factor
new file mode 100644 (file)
index 0000000..46037ba
--- /dev/null
@@ -0,0 +1,9 @@
+IN: temporary
+USING: effects tools.test ;
+
+[ t ] [ 1 1 <effect> 2 2 <effect> effect<= ] unit-test
+[ f ] [ 1 0 <effect> 2 2 <effect> effect<= ] unit-test
+[ t ] [ 2 2 <effect> 2 2 <effect> effect<= ] unit-test
+[ f ] [ 3 3 <effect> 2 2 <effect> effect<= ] unit-test
+[ f ] [ 2 3 <effect> 2 2 <effect> effect<= ] unit-test
+[ t ] [ 2 3 <effect> f effect<= ] unit-test
diff --git a/core/effects/effects.factor b/core/effects/effects.factor
new file mode 100644 (file)
index 0000000..62d6afc
--- /dev/null
@@ -0,0 +1,53 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math namespaces sequences strings words assocs
+combinators ;
+IN: effects
+
+TUPLE: effect in out terminated? ;
+
+: <effect> ( in out -- effect )
+    dup { "*" } sequence= [ drop { } t ] [ f ] if
+    effect construct-boa ;
+
+: effect-height ( effect -- n )
+    dup effect-out length swap effect-in length - ;
+
+: effect<= ( eff1 eff2 -- ? )
+    {
+        { [ dup not ] [ t ] }
+        { [ over effect-terminated? ] [ t ] }
+        { [ dup effect-terminated? ] [ f ] }
+        { [ 2dup [ effect-in length ] 2apply > ] [ f ] }
+        { [ 2dup [ effect-height ] 2apply = not ] [ f ] }
+        { [ t ] [ t ] }
+    } cond 2nip ;
+
+GENERIC: (stack-picture) ( obj -- str )
+M: string (stack-picture) ;
+M: word (stack-picture) word-name ;
+M: integer (stack-picture) drop "object" ;
+
+: stack-picture ( seq -- string )
+    [ [ (stack-picture) % CHAR: \s , ] each ] "" make ;
+
+: effect>string ( effect -- string )
+    [
+        "( " %
+        dup effect-in stack-picture %
+        "-- " %
+        dup effect-out stack-picture %
+        effect-terminated? [ "* " % ] when
+        ")" %
+    ] "" make ;
+
+: stack-effect ( word -- effect/f )
+    dup symbol? [
+        drop 0 1 <effect>
+    ] [
+        { "declared-effect" "inferred-effect" }
+        swap word-props [ at ] curry map [ ] find nip
+    ] if ;
+
+M: effect clone
+    [ effect-in clone ] keep effect-out clone <effect> ;
diff --git a/core/effects/summary.txt b/core/effects/summary.txt
new file mode 100644 (file)
index 0000000..54cd9d6
--- /dev/null
@@ -0,0 +1 @@
+Stack effects as first-class data types
diff --git a/core/effects/tags.txt b/core/effects/tags.txt
new file mode 100644 (file)
index 0000000..abf53a4
--- /dev/null
@@ -0,0 +1 @@
+reflection
diff --git a/core/errors.factor b/core/errors.factor
deleted file mode 100644 (file)
index b6af228..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: kernel-internals
-USING: arrays generic namespaces sequences math ;
-
-: >c ( continuation -- ) catchstack* push ;
-: c> ( -- continuation ) catchstack* pop ;
-
-IN: errors
-USING: kernel ;
-
-SYMBOL: error
-SYMBOL: error-continuation
-SYMBOL: error-stack-trace
-SYMBOL: restarts
-
-: catch ( try -- error/f )
-    [ >c call f c> drop f ] callcc1 nip ; inline
-
-: rethrow ( error -- )
-    catchstack* empty?
-    [ die ] [ dup error set-global c> continue-with ] if ;
-
-: cleanup ( try cleanup -- )
-    [ >c >r call c> drop r> call ]
-    [ >r nip call r> rethrow ] ifcc ;
-    inline
-
-: recover ( try recovery -- )
-    [ >c drop call c> drop ]
-    [ rot drop swap call ] ifcc ; inline
-
-TUPLE: condition restarts continuation ;
-
-C: condition ( error restarts cc -- condition )
-    [ set-condition-continuation ] keep
-    [ set-condition-restarts ] keep
-    [ set-delegate ] keep ;
-
-: condition ( error restarts -- restart )
-    [ <condition> throw ] callcc1 2nip ;
-
-TUPLE: restart name obj continuation ;
-
-: restart ( restart -- )
-    dup restart-obj swap restart-continuation continue-with ;
-
-GENERIC: compute-restarts ( error -- seq )
-
-M: object compute-restarts drop { } ;
-
-M: tuple compute-restarts delegate compute-restarts ;
-
-M: condition compute-restarts
-    [ delegate compute-restarts ] keep
-    [ condition-continuation ] keep
-    condition-restarts [ first2 rot <restart> ] map-with
-    append ;
-
-PREDICATE: array kernel-error ( obj -- ? )
-    dup first \ kernel-error eq? [
-        second 0 19 between?
-    ] [
-        drop f
-    ] if ;
-
-TUPLE: assert got expect ;
-
-: assert ( got expect -- * ) <assert> throw ;
-
-: assert= ( a b -- ) 2dup = [ 2drop ] [ assert ] if ;
-
-: assert-depth ( quot -- ) depth slip depth swap assert= ;
-
-DEFER: try
diff --git a/core/errors.facts b/core/errors.facts
deleted file mode 100644 (file)
index d3f9a02..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-IN: errors
-USING: errors help kernel kernel-internals ;
-
-HELP: error
-{ $description "Global variable holding most recently thrown error." }
-{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
-
-HELP: error-continuation
-{ $description "Global variable holding current continuation of most recently thrown error." }
-{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
-
-HELP: restarts
-{ $var-description "Global variable holding the set of possible restarts for the most recently thrown error." }
-{ $notes "Only updated by " { $link throw } ", not " { $link rethrow } "." } ;
-
-HELP: >c
-{ $values { "continuation" "a continuation" } }
-{ $description "Pushes an exception handler continuation on the catch stack. The continuation must have been reified by " { $link callcc1 } "." } ;
-
-HELP: c>
-{ $values { "continuation" "a continuation" } }
-{ $description "Pops an exception handler continuation from the catch stack." } ;
-
-HELP: throw ( error -- * )
-{ $values { "error" "an object" } }
-{ $description "Saves the current continuation in the " { $link error-continuation } " global variable and throws an error. Execution does not continue at the point after the " { $link throw } " call. Rather, the innermost catch block is invoked, and execution continues at that point." }
-{ $see-also rethrow } ;
-
-HELP: catch
-{ $values { "try" "a quotation" } { "error/f" "an object" } }
-{ $description "Calls the " { $snippet "try" } " quotation. If an error is thrown in the dynamic extent of the quotation, restores the data stack and pushes the error. If the quotation returns successfully, outputs " { $link f } " without restoring the data stack." }
-{ $notes "This word cannot differentiate between the case of " { $link f } " being thrown, and no error being thrown. You should never throw " { $link f } ", and you should also use other error handling combinators where possible." }
-{ $see-also cleanup recover } ;
-
-HELP: cleanup
-{ $values { "try" "a quotation" } { "cleanup" "a quotation" } }
-{ $description "Calls the " { $snippet "try" } " quotation. If an exception is thrown in the dynamic extent of the " { $snippet "try" } " quotation, restores the data stack, calls the " { $snippet "cleanup" } " quotation, and rethrows the error. If the " { $snippet "try" } " quotation returns successfully, calls the " { $snippet "cleanup" } " quotation without restoring the data stack." }
-{ $see-also catch recover } ;
-
-HELP: recover
-{ $values { "try" "a quotation" } { "recovery" "a quotation with stack effect " { $snippet "( error -- )" } } }
-{ $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." } 
-{ $see-also catch cleanup } ;
-
-HELP: rethrow
-{ $values { "error" "an object" } }
-{ $description "Throws an error without saving the current continuation in the " { $link error-continuation } " global variable. This is done so that inspecting the error stacks sheds light on the original cause of the exception, rather than the point where it was rethrown." }
-{ $examples
-    "This word definition attempts to convert a hexadecimal literal string to an integer, and outputs " { $link f } " if there is an error:"
-    { $code
-        ": catch-hex> ( str -- n/f )"
-        "    [ hex> ] [ [ drop f ] when ] catch ;"
-    }
-} ;
-
-HELP: condition
-{ $values { "error" "an object" } { "restarts" "a sequence of pairs" } { "restart" "an object" } }
-{ $description "Throws a restartable error. The " { $snippet "restarts" } " parameter is a sequence of pairs where the first element in each pair is a human-readable description and the second is an arbitrary object. If the error reaches the top-level error handler, the user will be presented with the list of possible restarts, and upon invoking one with the " { $link :res } " word, execution will continue after the call to " { $link condition } " with the object associated to the chosen restart on the stack." }
-{ $examples
-    "Try invoking one of the two restarts which are offered after the below code throws an error:"
-    { $code
-        ": restart-test"
-        "    \"Oops!\" { { \"One\" 1 } { \"Two\" 2 } } condition"
-        "    \"You restarted: \" write . ;"
-        "restart-test"
-    }
-} ;
-
-HELP: compute-restarts
-{ $values { "error" "an object" } { "seq" "a sequence" } }
-{ $description "Outputs a sequence of triples, where each triple consists of a human-readable string, an object, and a continuation. Resuming a continuation with the corresponding object restarts execution immediately after the corresponding call to " { $link condition } "."
-$terpri
-"This word recursively travels up the delegation chain to collate restarts from nested and wrapped conditions." } ;
-
-HELP: assert
-{ $values { "got" "the obtained value" } { "expect" "the expected value" } }
-{ $description "Throws an " { $link assert } " error." }
-{ $error-description "Thrown when a unit test or other assertion fails." }
-{ $see-also assert-depth } ;
-
-HELP: assert-depth
-{ $values { "quot" "a quotation" } }
-{ $description "Runs a quotation. Throws an error if the total number of elements on the stack is not the same before and after the quotation runs." } ;
diff --git a/core/float-arrays/float-arrays-docs.factor b/core/float-arrays/float-arrays-docs.factor
new file mode 100644 (file)
index 0000000..70bbfe2
--- /dev/null
@@ -0,0 +1,54 @@
+USING: arrays bit-arrays vectors strings sbufs
+kernel help.markup help.syntax math ;
+IN: float-arrays
+
+ARTICLE: "float-arrays" "Float arrays"
+"Float arrays are fixed-size mutable sequences (" { $link "sequence-protocol" } ") whose elements are instances of " { $link float } ". Elements are unboxed, hence the memory usage is lower than an equivalent " { $link array } " of floats. The literal syntax is covered in " { $link "syntax-float-arrays" } "."
+$nl
+"Float array words are in the " { $vocab-link "float-arrays" } " vocabulary."
+$nl
+"Float arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See " { $link "c-byte-arrays" } "."
+$nl
+"Float arrays form a class of objects."
+{ $subsection float-array }
+{ $subsection float-array? }
+"There are several ways to construct float arrays."
+{ $subsection >float-array }
+{ $subsection <float-array> }
+"Creating a float array from several elements on the stack:"
+{ $subsection 1float-array }
+{ $subsection 2float-array }
+{ $subsection 3float-array }
+{ $subsection 4float-array } ;
+
+ABOUT: "float-arrays"
+
+HELP: float-array
+{ $description "The class of float arrays. See " { $link "syntax-float-arrays" } " for syntax and " { $link "float-arrays" } " for general information." } ;
+
+HELP: <float-array> ( n initial -- float-array )
+{ $values { "n" "a non-negative integer" } { "initial" float } { "float-array" "a new float array" } }
+{ $description "Creates a new float array holding " { $snippet "n" } " floats with the specified initial element." } ;
+
+HELP: >float-array
+{ $values { "seq" "a sequence" } { "float-array" float-array } }
+{ $description "Outputs a freshly-allocated float array whose elements have the same boolean values as a given sequence." }
+{ $errors "Throws an error if the sequence contains elements other than real numbers." } ;
+
+HELP: 1float-array
+{ $values { "x" object } { "array" float-array } }
+{ $description "Create a new float array with one element." } ;
+
+{ 1array 2array 3array 4array } related-words
+
+HELP: 2float-array
+{ $values { "x" object } { "y" object } { "array" float-array } }
+{ $description "Create a new float array with two elements, with " { $snippet "x" } " appearing first." } ;
+
+HELP: 3float-array
+{ $values { "x" object } { "y" object } { "z" object } { "array" float-array } }
+{ $description "Create a new float array with three elements, with " { $snippet "x" } " appearing first." } ;
+
+HELP: 4float-array
+{ $values { "w" object } { "x" object } { "y" object } { "z" object } { "array" float-array } }
+{ $description "Create a new float array with four elements, with " { $snippet "w" } " appearing first." } ;
diff --git a/core/float-arrays/float-arrays-tests.factor b/core/float-arrays/float-arrays-tests.factor
new file mode 100644 (file)
index 0000000..811c380
--- /dev/null
@@ -0,0 +1,4 @@
+IN: temporary
+USING: float-arrays tools.test ;
+
+[ F{ 1.0 1.0 1.0 } ] [ 3 1.0 <float-array> ] unit-test
diff --git a/core/float-arrays/float-arrays.factor b/core/float-arrays/float-arrays.factor
new file mode 100644 (file)
index 0000000..36ffabb
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: float-arrays
+USING: kernel kernel.private alien sequences
+sequences.private math math.private ;
+
+<PRIVATE
+
+: float-array@ swap >fixnum 8 fixnum*fast ; inline
+
+PRIVATE>
+
+M: float-array clone (clone) ;
+M: float-array length array-capacity ;
+
+M: float-array nth-unsafe
+    float-array@ alien-double ;
+
+M: float-array set-nth-unsafe
+    >r >r >float r> r> float-array@ set-alien-double ;
+
+: >float-array ( seq -- float-array ) F{ } clone-like ; inline
+
+M: float-array like
+    drop dup float-array? [ >float-array ] unless ;
+
+M: float-array new drop 0.0 <float-array> ;
+
+M: float-array equal?
+    over float-array? [ sequence= ] [ 2drop f ] if ;
+
+INSTANCE: float-array sequence
+
+: 1float-array ( x -- array ) 1 swap <float-array> ; flushable
+
+: 2float-array ( x y -- array ) F{ } 2sequence ; flushable
+
+: 3float-array ( x y z -- array ) F{ } 3sequence ; flushable
+
+: 4float-array ( w x y z -- array ) F{ } 4sequence ; flushable
diff --git a/core/float-arrays/summary.txt b/core/float-arrays/summary.txt
new file mode 100644 (file)
index 0000000..0eac3b0
--- /dev/null
@@ -0,0 +1 @@
+Efficient fixed-length floating point number arrays
diff --git a/core/float-arrays/tags.txt b/core/float-arrays/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/generator/authors.txt b/core/generator/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/generator/fixup/authors.txt b/core/generator/fixup/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/generator/fixup/fixup-docs.factor b/core/generator/fixup/fixup-docs.factor
new file mode 100644 (file)
index 0000000..284af26
--- /dev/null
@@ -0,0 +1,32 @@
+USING: help.syntax help.markup generator.fixup math kernel
+words strings alien ;
+
+HELP: frame-required
+{ $values { "n" "a non-negative integer" } }
+{ $description "Notify the code generator that the currently compiling code block needs a stack frame with room for at least " { $snippet "n" } " parameters." } ;
+
+HELP: (rel-fixup)
+{ $values { "arg" integer } { "class" "a relocation class" } { "type" "a relocation type" } { "offset" integer } { "pair" "a pair of integers" } }
+{ $description "Creates a relocation instruction for the VM's runtime compiled code linker." } ;
+
+HELP: add-literal
+{ $values { "obj" object } { "n" integer } }
+{ $description "Adds a literal to the " { $link literal-table } ", if it is not already there, and outputs the index of the literal in the table. This literal can then be used as an argument for a " { $link rt-literal } " relocation with " { $link rel-fixup } "." } ;
+
+HELP: word-table
+{ $var-description "Holds a vector of words called from the currently compiling word." } ;
+
+HELP: add-word
+{ $values { "word" word } { "n" integer } }
+{ $description "Adds a word to the " { $link word-table } ", if it is not already there, and outputs the index of the word in the table. This literal can then be used as an argument for a " { $link rt-xt } " relocation with " { $link rel-fixup } "." } ;
+
+HELP: string>symbol
+{ $values { "str" string } { "alien" alien } }
+{ $description "Converts the string to a format which is a valid symbol name for the Factor VM's compiled code linker. By performing this conversion ahead of time, the image loader can run without allocating memory."
+$nl
+"On Windows CE, symbols are represented as UCS2 strings, and on all other platforms they are ASCII strings." } ;
+
+HELP: rel-dlsym
+{ $values { "name" string } { "dll" "a " { $link dll } " or " { $link f } } { "class" "a relocation class" } }
+{ $description "Records that the most recently assembled instruction contains a reference to the " { $snippet "name" } " symbol from " { $snippet "dll" } ". The correct " { $snippet "class" } " to use depends on instruction formats."
+} ;
diff --git a/core/generator/fixup/fixup.factor b/core/generator/fixup/fixup.factor
new file mode 100644 (file)
index 0000000..a339f95
--- /dev/null
@@ -0,0 +1,156 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic assocs hashtables
+kernel kernel.private math namespaces sequences words
+quotations strings alien system combinators math.bitfields
+words.private cpu.architecture ;
+IN: generator.fixup
+
+: no-stack-frame -1 ; inline
+
+TUPLE: frame-required n ;
+
+: frame-required ( n -- ) \ frame-required construct-boa , ;
+
+: stack-frame-size ( code -- n )
+    no-stack-frame [
+        dup frame-required? [ frame-required-n max ] [ drop ] if
+    ] reduce ;
+
+GENERIC: fixup* ( frame-size obj -- frame-size )
+
+: code-format 22 getenv ;
+
+: compiled-offset ( -- n ) building get length code-format * ;
+
+TUPLE: label offset ;
+
+: <label> ( -- label ) label construct-empty ;
+
+M: label fixup*
+    compiled-offset swap set-label-offset ;
+
+: define-label ( name -- ) <label> swap set ;
+
+: resolve-label ( label/name -- ) dup label? [ get ] unless , ;
+
+: if-stack-frame ( frame-size quot -- )
+    over no-stack-frame = [ 2drop ] [ call ] if ; inline
+
+M: word fixup*
+    {
+        { %prologue-later [ dup [ %prologue ] if-stack-frame ] }
+        { %epilogue-later [ dup [ %epilogue ] if-stack-frame ] }
+    } case ;
+
+SYMBOL: relocation-table
+SYMBOL: label-table
+
+! Relocation classes
+: rc-absolute-cell     0 ;
+: rc-absolute          1 ;
+: rc-relative          2 ;
+: rc-absolute-ppc-2/2  3 ;
+: rc-relative-ppc-2    4 ;
+: rc-relative-ppc-3    5 ;
+: rc-relative-arm-3    6 ;
+: rc-indirect-arm      7 ;
+: rc-indirect-arm-pc   8 ;
+
+: rc-absolute? ( n -- ? )
+    dup rc-absolute-cell =
+    over rc-absolute =
+    rot rc-absolute-ppc-2/2 = or or ;
+
+! Relocation types
+: rt-primitive 0 ;
+: rt-dlsym     1 ;
+: rt-literal   2 ;
+: rt-dispatch  3 ;
+: rt-xt        4 ;
+: rt-label     5 ;
+
+TUPLE: label-fixup label class ;
+
+: label-fixup ( label class -- ) \ label-fixup construct-boa , ;
+
+M: label-fixup fixup*
+    dup label-fixup-class rc-absolute?
+    [ "Absolute labels not supported" throw ] when
+    dup label-fixup-label swap label-fixup-class
+    compiled-offset 4 - rot 3array label-table get push ;
+
+TUPLE: rel-fixup arg class type ;
+
+: rel-fixup ( arg class type -- ) \ rel-fixup construct-boa , ;
+
+: (rel-fixup) ( arg class type offset -- pair )
+    pick rc-absolute-cell = cell 4 ? -
+    >r { 0 8 16 } bitfield r>
+    2array ;
+
+M: rel-fixup fixup*
+    dup rel-fixup-arg
+    over rel-fixup-class
+    rot rel-fixup-type
+    compiled-offset (rel-fixup)
+    relocation-table get push-all ;
+
+M: frame-required fixup* drop ;
+
+M: integer fixup* , ;
+
+: push-new* ( obj table -- n )
+    2dup swap [ eq? ] curry find drop
+    [ 2nip ] [ dup length >r push r> ] if* ;
+
+SYMBOL: literal-table
+
+: add-literal ( obj -- n ) literal-table get push-new* ;
+
+SYMBOL: word-table
+
+: add-word ( word -- n ) word-table get push-new* ;
+
+: string>symbol ( str -- alien )
+    wince? [ string>u16-alien ] [ string>char-alien ] if ;
+
+: add-dlsym-literals ( symbol dll -- )
+    >r string>symbol r> 2array literal-table get push-all ;
+
+: rel-dlsym ( name dll class -- )
+    >r literal-table get length >r
+    add-dlsym-literals
+    r> r> rt-dlsym rel-fixup ;
+
+: rel-dispatch ( word-table# class -- ) rt-dispatch rel-fixup ;
+
+GENERIC# rel-word 1 ( word class -- )
+
+M: primitive rel-word ( word class -- )
+    >r word-def r> rt-primitive rel-fixup ;
+
+M: word rel-word ( word class -- )
+    >r add-word r> rt-xt rel-fixup ;
+
+: rel-literal ( literal class -- )
+    >r add-literal r> rt-literal rel-fixup ;
+
+: init-fixup ( -- )
+    V{ } clone relocation-table set
+    V{ } clone label-table set ;
+
+: generate-labels ( -- labels )
+    label-table get [
+        first3 label-offset
+        [ "Unresolved label" throw ] unless*
+        3array
+    ] map concat ;
+
+: fixup ( code -- relocation-table label-table code )
+    [
+        init-fixup
+        dup stack-frame-size swap [ fixup* ] each drop
+        relocation-table get >array
+        generate-labels
+    ] { } make ;
diff --git a/core/generator/fixup/summary.txt b/core/generator/fixup/summary.txt
new file mode 100644 (file)
index 0000000..ce83e6d
--- /dev/null
@@ -0,0 +1 @@
+Support for generation of relocatable code
diff --git a/core/generator/generator-docs.factor b/core/generator/generator-docs.factor
new file mode 100644 (file)
index 0000000..9b19b57
--- /dev/null
@@ -0,0 +1,109 @@
+USING: help.markup help.syntax words debugger generator.fixup
+generator.registers quotations kernel vectors arrays ;
+IN: generator
+
+ARTICLE: "generator" "Compiled code generator"
+"Most of the words in the " { $vocab-link "generator" } " vocabulary are internal to the compiler and user code has no reason to call them."
+$nl
+"Debugging information can be enabled or disabled; these hooks are used by " { $link "profiling" } " and " { $link "tools.deploy" } ":"
+{ $subsection profiler-prologues }
+{ $subsection compiled-stack-traces }
+"Assembler intrinsics can be defined for low-level optimization:"
+{ $subsection define-intrinsic }
+{ $subsection define-intrinsics }
+{ $subsection define-if-intrinsic }
+{ $subsection define-if-intrinsics }
+"The main entry point into the code generator:"
+{ $subsection generate }
+"Primitive compiler interface exported by the Factor VM:"
+{ $subsection add-compiled-block }
+{ $subsection finalize-compile } ;
+
+ABOUT: "generator"
+
+HELP: compiled-xts
+{ $var-description "During compilation, holds a hashtable mapping words to temporary uninterned words. The XT of each value points to the compiled code block of each key; at the end of compilation, the XT of each key is set to the XT of the value." } ;
+
+HELP: compiling?
+{ $values { "word" word } { "?" "a boolean" } }
+{ $description "Tests if a word is going to be or already is compiled." } ;
+
+HELP: finalize-compile ( xts -- )
+{ $values { "xts" "an association list mapping words to uninterned words" } }
+{ $description "Performs relocation, atomically changes the XT of each key to the XT of each value, and flushes the CPU instruction cache on architectures where this has to be done manually." } ;
+
+HELP: add-compiled-block ( literals words rel labels code -- xt )
+{ $values { "literals" vector } { "words" "a vector of words" } { "rel" "a vector of integers" } { "labels" "an array of integers" } { "code" "a vector of integers" } { "xt" "an uninterned word" } }
+{ $description "Adds a new compiled block and outputs an uninterned word whose XT points at this block. This uninterned word can then be passed to " { $link finalize-compile } "." } ;
+
+HELP: compiling-word
+{ $var-description "The word currently being compiled, set by " { $link generate-1 } "." } ;
+
+HELP: compiling-label
+{ $var-description "The label currently being compiled, set by " { $link generate-1 } "." } ;
+
+HELP: compiled-stack-traces
+{ $var-description "If set to true, compiled code blocks will retain what word they were compiled from. This information is used by " { $link :c } " to display call stack traces after an error is thrown from compiled code. This variable is on by default; the deployment tool switches it off to save some space in the deployed image." } ;
+
+HELP: literal-table
+{ $var-description "Holds a vector of literal objects referenced from the currently compiling word. If " { $link compiled-stack-traces } " is on, " { $link init-generator } " ensures that the first entry is the word being compiled." } ;
+
+HELP: init-generator
+{ $values { "word" word } }
+{ $description "Prepares to generate machine code for a word." } ;
+
+HELP: generate-1
+{ $values { "label" word } { "node" "a dataflow node" } { "quot" "a quotation with stack effect " { $snippet "( node -- )" } } }
+{ $description "Generates machine code for " { $snippet "label" } " by applying the quotation to the dataflow node." } ;
+
+HELP: generate-node
+{ $values { "node" "a dataflow node" } { "next" "a dataflow node" } }
+{ $contract "Generates machine code for a dataflow node, and outputs the next node to generate machine code for." }
+{ $notes "This word can only be called from inside the quotation passed to " { $link generate-1 } "." } ;
+
+HELP: generate-nodes
+{ $values { "node" "a dataflow node" } } 
+{ $description "Recursively generate machine code for a dataflow graph." }
+{ $notes "This word can only be called from inside the quotation passed to " { $link generate-1 } "." } ;
+
+HELP: profiler-prologue
+{ $description "Compiles a prologue which increment's the currently compiling word's call count, if such prologues were enabled by setting " { $link profiler-prologues } " to a true value." } ;
+
+HELP: generate
+{ $values { "word" word } { "label" word } { "node" "a dataflow node" } }
+{ $description "Generates machine code for " { $snippet "label" } " from " { $snippet "node" } ". The value of " { $snippet "word" } " is retained for debugging purposes; it is the word which will appear in a call stack trace if this compiled code block throws an error when run." } ;
+
+HELP: word-dataflow
+{ $values { "word" word } { "dataflow" "a dataflow graph" } }
+{ $description "Outputs the dataflow graph of a word, taking specializers into account (see " { $link "specializers" } ")." } ;
+
+HELP: define-intrinsics
+{ $values { "word" word } { "intrinsics" "a sequence of " { $snippet "{ quot assoc }" } " pairs" } }
+{ $description "Defines a set of assembly intrinsics for the word. When a call to the word is being compiled, each intrinsic is tested in turn; the first applicable one will be called to generate machine code. If no suitable intrinsic is found, a simple call to the word is compiled instead."
+$nl
+"See " { $link with-template } " for an explanation of the keys which may appear in " { $snippet "assoc" } "." } ;
+
+HELP: define-intrinsic
+{ $values { "word" word } { "quot" quotation } { "assoc" "an assoc" } }
+{ $description "Defines an assembly intrinsic for the word. When a call to the word is being compiled, this intrinsic will be used if it is found to be applicable. If it is not applicable, a simple call to the word is compiled instead."
+$nl
+"See " { $link with-template } " for an explanation of the keys which may appear in " { $snippet "assoc" } "." } ;
+
+HELP: if>boolean-intrinsic
+{ $values { "quot" "a quotation with stack effect " { $snippet "( label -- )" } } }
+{ $description "Generates code which pushes " { $link t } " or " { $link f } " on the data stack, depending on whether the quotation jumps to the label or not." } ;
+
+HELP: define-if-intrinsics
+{ $values { "word" word } { "intrinsics" "a sequence of " { $snippet "{ quot inputs }" } " pairs" } }
+{ $description "Defines a set of conditional assembly intrinsics for the word, which must have a boolean value as its single output."
+$nl
+"The quotations must have stack effect " { $snippet "( label -- )" } "; they are required to branch to the label if the word evaluates to true."
+$nl
+"The " { $snippet "inputs" } " are in the same format as the " { $link +input+ } " key to " { $link with-template } "; a description can be found in the documentation for thatt word." }
+{ $notes "Conditional intrinsics are used when the word is followed by a call to " { $link if } ". They allow for tighter code to be generated in certain situations; for example, if two integers are being compared and the result is immediately used to branch, the intermediate boolean does not need to be pushed at all." } ;
+
+HELP: define-if-intrinsic
+{ $values { "word" word } { "quot" "a quotation with stack effect " { $snippet "( label -- )" } } { "inputs" "a sequence of input register specifiers" } }
+{ $description "Defines a conditional assembly intrinsic for the word, which must have a boolean value as its single output."
+$nl
+"See " { $link define-if-intrinsics } " for a description of the parameters." } ;
diff --git a/core/generator/generator.factor b/core/generator/generator.factor
new file mode 100644 (file)
index 0000000..3b1ea07
--- /dev/null
@@ -0,0 +1,325 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs classes combinators cpu.architecture
+effects generator.fixup generator.registers generic hashtables
+inference inference.backend inference.dataflow inference.stack
+io kernel kernel.private layouts math namespaces optimizer
+prettyprint quotations sequences system threads words ;
+IN: generator
+
+SYMBOL: compiled-xts
+
+: save-xt ( word xt -- )
+    swap dup unchanged-word compiled-xts get set-at ;
+
+: compiling? ( word -- ? )
+    {
+        { [ dup compiled-xts get key? ] [ drop t ] }
+        { [ dup word-changed? ] [ drop f ] }
+        { [ t ] [ compiled? ] }
+    } cond ;
+
+SYMBOL: compiling-word
+
+SYMBOL: compiling-label
+
+! Label of current word, after prologue, makes recursion faster
+SYMBOL: current-label-start
+
+SYMBOL: compiled-stack-traces
+
+t compiled-stack-traces set-global
+
+: init-generator ( -- )
+    V{ } clone literal-table set
+    V{ } clone word-table set
+    compiled-stack-traces get
+    [ compiling-word get ] [ f ] if
+    literal-table get push ;
+
+: generate-1 ( word label node quot -- )
+    pick f save-xt [
+        roll compiling-word set
+        pick compiling-label set
+        init-generator
+        %save-xt
+        %prologue-later
+        call
+        literal-table get >array
+        word-table get >array
+    ] { } make fixup add-compiled-block save-xt ;
+
+GENERIC: generate-node ( node -- next )
+
+: generate-nodes ( node -- )
+    [ node@ generate-node ] iterate-nodes end-basic-block ;
+
+SYMBOL: profiler-prologues
+
+: profiler-prologue ( -- )
+    profiler-prologues get-global [
+        compiling-word get %profiler-prologue
+    ] when ;
+
+: generate ( word label node -- )
+    [
+        init-templates
+        profiler-prologue
+        current-label-start define-label
+        current-label-start resolve-label
+        [ generate-nodes ] with-node-iterator
+    ] generate-1 ;
+
+: word-dataflow ( word -- dataflow )
+    [
+        dup "no-effect" word-prop [ no-effect ] when
+        dup dup add-recursive-state
+        [ specialized-def (dataflow) ] keep
+        finish-word drop
+    ] with-infer ;
+
+SYMBOL: compiler-hook
+
+[ ] compiler-hook set-global
+
+SYMBOL: compile-errors
+
+SYMBOL: batch-mode
+
+: compile-begins ( word -- )
+    compiler-hook get call
+    "quiet" get batch-mode get or [
+        drop
+    ] [
+        "Compiling " write . flush
+    ] if ;
+
+: (compile) ( word -- )
+    dup compiling? not over compound? and [
+        dup compile-begins
+        dup dup word-dataflow optimize generate
+    ] [
+        drop
+    ] if ;
+
+: intrinsics ( #call -- quot )
+    node-param "intrinsics" word-prop ;
+
+: if-intrinsics ( #call -- quot )
+    node-param "if-intrinsics" word-prop ;
+
+DEFER: #terminal?
+
+PREDICATE: #merge #terminal-merge node-successor #terminal? ;
+
+PREDICATE: #values #terminal-values node-successor #terminal? ;
+
+PREDICATE: #call #terminal-call
+    dup node-successor #if?
+    over node-successor node-successor #terminal? and
+    swap if-intrinsics and ;
+
+UNION: #terminal
+    POSTPONE: f #return #terminal-values #terminal-merge ;
+
+: tail-call? ( -- ? )
+    node-stack get [
+        dup #terminal-call? swap node-successor #terminal? or
+    ] all? ;
+
+! node
+M: node generate-node drop iterate-next ;
+
+: %call ( word -- )
+    dup primitive? [ %call-primitive ] [ %call-label ] if ;
+
+: %jump ( word -- )
+    {
+        { [ dup compiling-label get eq? ] [
+            drop current-label-start get %jump-label
+        ] }
+        { [ dup primitive? ] [
+            %epilogue-later %jump-primitive
+        ] }
+        { [ t ] [
+            %epilogue-later %jump-label
+        ] }
+    } cond ;
+
+: generate-call ( label -- next )
+    dup (compile)
+    end-basic-block
+    tail-call? [
+        %jump f
+    ] [
+        0 frame-required
+        %call
+        iterate-next
+    ] if ;
+
+! #label
+M: #label generate-node
+    dup node-param generate-call >r
+    dup #label-word over node-param rot node-child generate
+    r> ;
+
+! #if
+: end-false-branch ( label -- )
+    tail-call? [ %return drop ] [ %jump-label ] if ;
+
+: generate-branch ( node -- )
+    [ copy-templates generate-nodes ] with-scope ;
+
+: generate-if ( node label -- next )
+    <label> [
+        >r >r node-children first2 generate-branch
+        r> r> end-false-branch resolve-label
+        generate-branch
+        init-templates
+    ] keep resolve-label iterate-next ;
+
+M: #if generate-node
+    [ <label> dup %jump-t ]
+    H{ { +input+ { { f "flag" } } } }
+    with-template
+    generate-if ;
+
+! #dispatch
+: dispatch-branch ( node word -- label )
+    gensym [
+        rot [
+            copy-templates
+            [ generate-nodes ] with-node-iterator
+        ] generate-1
+    ] keep ;
+
+: dispatch-branches ( node -- syms )
+    node-children
+    [ compiling-word get dispatch-branch ] map
+    word-table get push-all ;
+
+: %dispatch ( word-table# -- )
+    tail-call? [
+        %jump-dispatch
+    ] [
+        0 frame-required
+        %call-dispatch
+    ] if ;
+
+M: #dispatch generate-node
+    word-table get length %dispatch
+    dispatch-branches init-templates iterate-next ;
+
+! #call
+: define-intrinsics ( word intrinsics -- )
+    "intrinsics" set-word-prop ;
+
+: define-intrinsic ( word quot assoc -- )
+    2array 1array define-intrinsics ;
+
+: define-if>branch-intrinsics ( word intrinsics -- )
+    "if-intrinsics" set-word-prop ;
+
+: if>boolean-intrinsic ( quot -- )
+    "true" define-label
+    "end" define-label
+    "true" get swap call
+    f "if-scratch" get load-literal
+    "end" get %jump-label
+    "true" resolve-label
+    t "if-scratch" get load-literal
+    "end" resolve-label
+    "if-scratch" get phantom-d get phantom-push ; inline
+
+: define-if>boolean-intrinsics ( word intrinsics -- )
+    [
+        first2
+        >r [ if>boolean-intrinsic ] curry r>
+        { { f "if-scratch" } } +scratch+ associate union
+        2array
+    ] map "intrinsics" set-word-prop ;
+
+: define-if-intrinsics ( word intrinsics -- )
+    [ +input+ associate ] assoc-map
+    2dup define-if>branch-intrinsics
+    define-if>boolean-intrinsics ;
+
+: define-if-intrinsic ( word quot inputs -- )
+    2array 1array define-if-intrinsics ;
+
+: do-intrinsic ( pair -- ) first2 with-template ;
+
+: do-if-intrinsic ( #call pair -- next )
+    <label> [ swap do-intrinsic ] keep
+    >r node-successor r> generate-if
+    node-successor ;
+
+: find-intrinsic ( #call -- pair/f )
+    intrinsics find-template ;
+
+: find-if-intrinsic ( #call -- pair/f )
+    dup node-successor #if? [
+        if-intrinsics find-template
+    ] [
+        drop f
+    ] if ;
+
+M: #call generate-node
+    dup find-if-intrinsic [
+        do-if-intrinsic
+    ] [
+        dup find-intrinsic [
+            do-intrinsic iterate-next
+        ] [
+            node-param generate-call
+        ] ?if
+    ] if* ;
+
+! #call-label
+M: #call-label generate-node node-param generate-call ;
+
+! #push
+UNION: immediate fixnum POSTPONE: f ;
+
+M: #push generate-node
+    node-out-d phantom-d get phantom-append iterate-next ;
+
+! #shuffle
+: phantom-shuffle ( shuffle -- )
+    [ effect-in length phantom-d get phantom-input ] keep
+    shuffle* phantom-d get phantom-append ;
+
+M: #shuffle generate-node
+    node-shuffle phantom-shuffle iterate-next ;
+
+M: #>r generate-node
+    node-in-d length
+    phantom-d get phantom-input
+    phantom-r get phantom-append
+    iterate-next ;
+
+M: #r> generate-node
+    node-out-d length
+    phantom-r get phantom-input
+    phantom-d get phantom-append
+    iterate-next ;
+
+! #return
+M: #return generate-node drop end-basic-block %return f ;
+
+! These constants must match vm/memory.h
+: card-bits 6 ;
+: card-mark HEX: 40 HEX: 80 bitor ;
+
+! These constants must match vm/layouts.h
+: header-offset object tag-number neg ;
+: float-offset 8 float tag-number - ;
+: string-offset 3 cells object tag-number - ;
+: profile-count-offset 7 cells object tag-number - ;
+: byte-array-offset 2 cells object tag-number - ;
+: alien-offset 3 cells object tag-number - ;
+: tuple-class-offset 2 cells tuple tag-number - ;
+: class-hash-offset cell object tag-number - ;
+
+: operand-immediate? ( operand -- ? )
+    operand-class immediate class< ;
diff --git a/core/generator/registers/authors.txt b/core/generator/registers/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/generator/registers/registers.factor b/core/generator/registers/registers.factor
new file mode 100644 (file)
index 0000000..c77ec05
--- /dev/null
@@ -0,0 +1,563 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs classes classes.private combinators
+cpu.architecture generator.fixup generic hashtables
+inference.dataflow kernel kernel.private layouts math memory
+namespaces quotations sequences system vectors words ;
+IN: generator.registers
+
+! A scratch register for computations
+TUPLE: vreg n ;
+
+: <vreg> ( n reg-class -- vreg )
+    { set-vreg-n set-delegate } vreg construct ;
+
+! Register classes
+TUPLE: int-regs ;
+TUPLE: float-regs size ;
+
+: <int-vreg> ( n -- vreg ) T{ int-regs } <vreg> ;
+: <float-vreg> ( n -- vreg ) T{ float-regs f 8 } <vreg> ;
+
+! Temporary register for stack shuffling
+TUPLE: temp-reg ;
+
+: temp-reg T{ temp-reg T{ int-regs } } ;
+
+: %move ( dst src -- )
+    2dup = [
+        2drop
+    ] [
+        2dup [ delegate class ] 2apply 2array {
+            { { int-regs int-regs } [ %move-int>int ] }
+            { { float-regs int-regs } [ %move-int>float ] }
+            { { int-regs float-regs } [ %move-float>int ] }
+        } case
+    ] if ;
+
+GENERIC: reg-size ( register-class -- n )
+
+GENERIC: inc-reg-class ( register-class -- )
+
+M: int-regs reg-size drop cell ;
+
+: (inc-reg-class)
+    dup class inc
+    fp-shadows-int? [ reg-size stack-params +@ ] [ drop ] if ;
+
+M: int-regs inc-reg-class
+    (inc-reg-class) ;
+
+M: float-regs reg-size float-regs-size ;
+
+M: float-regs inc-reg-class
+    dup (inc-reg-class)
+    fp-shadows-int? [ reg-size 4 / int-regs +@ ] [ drop ] if ;
+
+M: vreg v>operand dup vreg-n swap vregs nth ;
+
+: reg-spec>class ( spec -- class )
+    float eq?
+    T{ float-regs f 8 } T{ int-regs } ? ;
+
+SYMBOL: phantom-d
+SYMBOL: phantom-r
+
+! A data stack location.
+TUPLE: ds-loc n ;
+
+C: <ds-loc> ds-loc
+
+! A retain stack location.
+TUPLE: rs-loc n ;
+
+C: <rs-loc> rs-loc
+
+UNION: loc ds-loc rs-loc ;
+
+TUPLE: phantom-stack height ;
+
+: <phantom-stack> ( class -- stack )
+    >r
+    V{ } clone 0
+    { set-delegate set-phantom-stack-height }
+    phantom-stack construct
+    r> construct-delegate ;
+
+GENERIC: finalize-height ( stack -- )
+
+GENERIC: <loc> ( n stack -- loc )
+
+: (loc)
+    #! Utility for methods on <loc>
+    phantom-stack-height - ;
+
+: (finalize-height) ( stack word -- )
+    #! We consolidate multiple stack height changes until the
+    #! last moment, and we emit the final height changing
+    #! instruction here.
+    swap [
+        phantom-stack-height
+        dup zero? [ 2drop ] [ swap execute ] if
+        0
+    ] keep set-phantom-stack-height ; inline
+
+TUPLE: phantom-datastack ;
+
+: <phantom-datastack> phantom-datastack <phantom-stack> ;
+
+M: phantom-datastack <loc> (loc) <ds-loc> ;
+
+M: phantom-datastack finalize-height
+    \ %inc-d (finalize-height) ;
+
+TUPLE: phantom-retainstack ;
+
+: <phantom-retainstack> phantom-retainstack <phantom-stack> ;
+
+M: phantom-retainstack <loc> (loc) <rs-loc> ;
+
+M: phantom-retainstack finalize-height
+    \ %inc-r (finalize-height) ;
+
+: phantom-locs ( n phantom -- locs )
+    #! A sequence of n ds-locs or rs-locs indexing the stack.
+    >r <reversed> r> [ <loc> ] curry map ;
+
+: phantom-locs* ( phantom -- locs )
+    dup length swap phantom-locs ;
+
+: (each-loc) ( phantom quot -- )
+    >r dup phantom-locs* r> 2each ; inline
+
+: each-loc ( quot -- )
+    >r phantom-d get r> phantom-r get over
+    >r >r (each-loc) r> r> (each-loc) ; inline
+
+: adjust-phantom ( n phantom -- )
+    [ phantom-stack-height + ] keep set-phantom-stack-height ;
+
+: phantom-push ( obj stack -- )
+    1 over adjust-phantom push ;
+
+: phantom-append ( seq stack -- )
+    over length over adjust-phantom push-all ;
+
+GENERIC: cut-phantom ( n phantom -- seq )
+
+M: phantom-stack cut-phantom
+    [ delegate cut* swap ] keep set-delegate ;
+
+: phantom-input ( n phantom -- seq )
+    [
+        2dup length <= [
+            cut-phantom
+        ] [
+            [ phantom-locs ] keep
+            [ length head-slice* ] keep
+            [ append ] keep
+            delete-all
+        ] if
+    ] 2keep >r neg r> adjust-phantom ;
+
+: phantoms ( -- phantom phantom ) phantom-d get phantom-r get ;
+
+: each-phantom ( quot -- ) phantoms rot 2apply ; inline
+
+: finalize-heights ( -- )
+    phantoms [ finalize-height ] 2apply ;
+
+! Phantom stacks hold values, locs, and vregs
+UNION: pseudo loc value ;
+
+: live-vregs ( -- seq ) phantoms append [ vreg? ] subset ;
+
+: live-loc? ( current actual -- ? )
+    over loc? [ = not ] [ 2drop f ] if ;
+
+: (live-locs) ( phantom -- seq )
+    #! Discard locs which haven't moved
+    dup phantom-locs* 2array flip
+    [ live-loc? ] assoc-subset
+    keys ;
+
+: live-locs ( -- seq )
+    [ (live-locs) ] each-phantom append prune ;
+
+: minimal-ds-loc ( phantom -- n )
+    #! When shuffling more values than can fit in registers, we
+    #! need to find an area on the data stack which isn't in
+    #! use.
+    dup phantom-stack-height neg
+    [ dup ds-loc? [ ds-loc-n min ] [ drop ] if ] reduce ;
+
+! Operands holding pointers to freshly-allocated objects which
+! are guaranteed to be in the nursery
+SYMBOL: fresh-objects
+
+: fresh-object ( obj -- ) fresh-objects get push ;
+
+: fresh-object? ( obj -- ? ) fresh-objects get memq? ;
+
+! Computing free registers and initializing allocator
+: free-vregs ( reg-class -- seq )
+    #! Free vregs in a given register class
+    \ free-vregs get at ;
+
+: (compute-free-vregs) ( used class -- vector )
+    #! Find all vregs in 'class' which are not in 'used'.
+    [ vregs length reverse ] keep
+    [ <vreg> ] curry map seq-diff
+    >vector ;
+
+: compute-free-vregs ( -- )
+    #! Create a new hashtable for thee free-vregs variable.
+    live-vregs
+    { T{ int-regs } T{ float-regs f 8 } }
+    [ 2dup (compute-free-vregs) ] H{ } map>assoc \ free-vregs set
+    drop ;
+
+: init-templates ( -- )
+    #! Initialize register allocator.
+    V{ } clone fresh-objects set
+    <phantom-datastack> phantom-d set
+    <phantom-retainstack> phantom-r set
+    compute-free-vregs ;
+
+: copy-templates ( -- )
+    #! Copies register allocator state, used when compiling
+    #! branches.
+    fresh-objects [ clone ] change
+    phantom-d [ clone ] change
+    phantom-r [ clone ] change
+    compute-free-vregs ;
+
+! Copying vregs to stacks
+: alloc-vreg ( spec -- vreg )
+    reg-spec>class free-vregs pop ;
+
+: vreg>vreg ( vreg spec -- vreg )
+    alloc-vreg dup rot %move ;
+
+: value>int-vreg ( value spec -- vreg )
+    alloc-vreg [ >r value-literal  r> load-literal ] keep ;
+
+: value>float-vreg ( value spec -- vreg )
+    alloc-vreg [
+        >r value-literal temp-reg load-literal r> temp-reg %move
+    ] keep ;
+
+: loc>vreg ( loc spec -- vreg )
+    alloc-vreg [ swap %peek ] keep ;
+
+: allocation
+    H{
+        { { int-regs f } f }
+        { { int-regs float } T{ float-regs 8 f } }
+        { { float-regs f } T{ int-regs f } }
+        { { float-regs float } f }
+        { { value value } f }
+        { { value f } T{ int-regs f } }
+        { { value float } T{ float-regs 8 f } }
+        { { loc f } T{ int-regs f } }
+        { { loc float } T{ float-regs 8 f } }
+    } at ;
+
+: transfer
+    {
+        { { int-regs f } [ drop ] }
+        { { int-regs float } [ vreg>vreg ] }
+        { { float-regs f } [ vreg>vreg ] }
+        { { float-regs float } [ drop ] }
+        { { value f } [ value>int-vreg ] }
+        { { value float } [ value>float-vreg ] }
+        { { value value } [ drop ] }
+        { { loc f } [ loc>vreg ] }
+        { { loc float } [ loc>vreg ] }
+    } case ;
+
+GENERIC: template-lhs ( obj -- lhs )
+
+M: int-regs template-lhs class ;
+M: float-regs template-lhs class ;
+M: ds-loc template-lhs drop loc ;
+M: rs-loc template-lhs drop loc ;
+M: f template-lhs drop loc ;
+M: value template-lhs class ;
+
+GENERIC: template-rhs ( obj -- rhs )
+
+M: quotation template-rhs drop value ;
+M: object template-rhs ;
+
+: transfer-op ( value spec -- pair )
+    swap template-lhs swap template-rhs 2array ;
+
+: (lazy-load) ( value spec -- value )
+    2dup transfer-op transfer ;
+
+: loc>loc ( fromloc toloc -- )
+    #! Move a value from a stack location to another stack
+    #! location.
+    temp-reg rot %peek
+    temp-reg swap %replace ;
+
+: lazy-store ( src dest -- )
+    #! Don't store a location to itself.
+    2dup = [
+        2drop
+    ] [
+        >r \ live-locs get at dup vreg?
+        [ r> %replace ] [ r> loc>loc ] if
+    ] if ;
+
+: do-shuffle ( hash -- )
+    dup assoc-empty? [
+        drop
+    ] [
+        \ live-locs set
+        [ over loc? [ lazy-store ] [ 2drop ] if ] each-loc
+    ] if ;
+
+: fast-shuffle ( locs -- )
+    #! We have enough free registers to load all shuffle inputs
+    #! at once
+    [ dup f (lazy-load) ] H{ } map>assoc do-shuffle ;
+
+: find-tmp-loc ( -- n )
+    #! Find an area of the data stack which is not referenced
+    #! from the phantom stacks. We can clobber there all we want
+    [ minimal-ds-loc ] each-phantom min 1- ;
+
+: slow-shuffle-mapping ( locs tmp -- pairs )
+    >r dup length r>
+    [ swap - <ds-loc> ] curry map
+    2array flip ;
+
+: slow-shuffle ( locs -- )
+    #! We don't have enough free registers to load all shuffle
+    #! inputs, so we use a single temporary register, together
+    #! with the area of the data stack above the stack pointer
+    find-tmp-loc slow-shuffle-mapping
+    [ [ loc>loc ] assoc-each ] keep
+    >hashtable do-shuffle ;
+
+: fast-shuffle? ( live-locs -- ? )
+    #! Test if we have enough free registers to load all
+    #! shuffle inputs at once.
+    T{ int-regs } free-vregs [ length ] 2apply <= ;
+
+: finalize-locs ( -- )
+    #! Perform any deferred stack shuffling.
+    live-locs dup fast-shuffle?
+    [ fast-shuffle ] [ slow-shuffle ] if ;
+
+: value>loc ( literal toloc -- )
+    #! Move a literal to a stack location.
+    >r value-literal temp-reg load-literal
+    temp-reg r> %replace ;
+
+: finalize-values ( -- )
+    #! Store any deferred literals to their final stack
+    #! locations.
+    [ over value? [ value>loc ] [ 2drop ] if ] each-loc ;
+
+: finalize-vregs ( -- )
+    #! Store any vregs to their final stack locations.
+    [ over pseudo? [ 2drop ] [ %replace ] if ] each-loc ;
+
+: reusing-vregs ( quot -- )
+    #! Any vregs allocated by quot are released again.
+    >r \ free-vregs get [ clone ] assoc-map \ free-vregs r>
+    with-variable ; inline
+
+: finalize-contents ( -- )
+    [ finalize-locs ] reusing-vregs
+    [ finalize-values ] reusing-vregs
+    finalize-vregs
+    [ delete-all ] each-phantom ;
+
+: %gc ( -- )
+    0 frame-required
+    %prepare-alien-invoke
+    "simple_gc" f %alien-invoke ;
+
+: end-basic-block ( -- )
+    #! Commit all deferred stacking shuffling, and ensure the
+    #! in-memory data and retain stacks are up to date with
+    #! respect to the compiler's current picture.
+    finalize-contents finalize-heights
+    fresh-objects get dup empty? swap delete-all [ %gc ] unless ;
+
+! Loading stacks to vregs
+: free-vregs# ( -- int# float# )
+    T{ int-regs } T{ float-regs f 8 } 
+    [ free-vregs length ] 2apply ;
+
+: free-vregs? ( int# float# -- ? )
+    free-vregs# swapd <= >r <= r> and ;
+
+: ensure-vregs ( int# float# -- )
+    compute-free-vregs free-vregs?
+    [ finalize-contents compute-free-vregs ] unless ;
+
+: phantom&spec ( phantom spec -- phantom' spec' )
+    0 <column>
+    [ length f pad-left ] keep
+    [ <reversed> ] 2apply ; inline
+
+: phantom&spec-agree? ( phantom spec quot -- ? )
+    >r phantom&spec r> 2all? ; inline
+
+: split-template ( input -- slow fast )
+    phantom-d get
+    2dup [ length ] 2apply <=
+    [ drop { } swap ] [ length swap cut* ] if ;
+
+: substitute-vregs ( alist -- )
+    >hashtable
+    { phantom-d phantom-r }
+    [ get substitute ] curry* each ;
+
+: lazy-load ( values template -- )
+    #! Set operand vars here.
+    flip first2
+    >r dupd [ (lazy-load) ] 2map dup r>
+    [ >r dup value? [ value-literal ] when r> set ] 2each
+    2array flip substitute-vregs ;
+
+: fast-input ( template -- )
+    dup empty? [
+        drop
+    ] [
+        dup length phantom-d get phantom-input swap lazy-load
+    ] if ;
+
+SYMBOL: +input+
+SYMBOL: +output+
+SYMBOL: +scratch+
+SYMBOL: +clobber+
+
+: output-vregs ( -- seq seq )
+    +output+ +clobber+ [ get [ get ] map ] 2apply ;
+
+: clash? ( seq -- ? )
+    phantoms append swap [ member? ] curry contains? ;
+
+: outputs-clash? ( -- ? )
+    output-vregs append clash? ;
+
+: slow-input ( template -- )
+    outputs-clash? [ finalize-contents ] when fast-input ;
+
+: count-vregs ( reg-classes -- ) [ [ inc ] when* ] each ;
+
+: count-input-vregs ( phantom spec -- )
+    phantom&spec [ transfer-op allocation ] 2map
+    count-vregs ;
+
+: count-scratch-regs ( spec -- )
+    [ first reg-spec>class ] map count-vregs ;
+
+: guess-vregs ( dinput rinput scratch -- int# float# )
+    H{
+        { T{ int-regs } 0 }
+        { T{ float-regs 8 } 0 }
+    } clone [
+        count-scratch-regs
+        phantom-r get swap count-input-vregs
+        phantom-d get swap count-input-vregs
+        T{ int-regs } get T{ float-regs 8 } get
+    ] bind ;
+
+: alloc-scratch ( -- )
+    +scratch+ get [ >r alloc-vreg r> set ] assoc-each ;
+
+: guess-template-vregs ( -- int# float# )
+    +input+ get { } +scratch+ get guess-vregs ;
+
+: template-inputs ( -- )
+    ! Ensure we have enough to hold any new stack elements we
+    ! will read (if any), and scratch.
+    guess-template-vregs ensure-vregs
+    ! Split the template into available (fast) parts and those
+    ! that require allocating registers and reading the stack
+    +input+ get split-template fast-input slow-input
+    ! Finally allocate scratch registers
+    alloc-scratch ;
+
+: template-outputs ( -- )
+    +output+ get [ get ] map phantom-d get phantom-append ;
+
+: with-template ( quot hash -- )
+    clone [ template-inputs call template-outputs ] bind
+    compute-free-vregs ;
+    inline
+
+: value-matches? ( value spec -- ? )
+    #! If the spec is a quotation and the value is a literal
+    #! fixnum, see if the quotation yields true when applied
+    #! to the fixnum. Otherwise, the values don't match. If the
+    #! spec is not a quotation, its a reg-class, in which case
+    #! the value is always good.
+    dup quotation? [
+        over value?
+        [ >r value-literal r> call ] [ 2drop f ] if
+    ] [
+        2drop t
+    ] if ;
+
+: template-specs-match? ( -- ? )
+    phantom-d get +input+ get
+    [ value-matches? ] phantom&spec-agree? ;
+
+: class-tag ( class -- tag/f )
+    dup hi-tag class< [
+        drop object tag-number
+    ] [
+        flatten-builtin-class keys
+        dup length 1 = [ first tag-number ] [ drop f ] if
+    ] if ;
+
+SYMBOL: known-tag
+
+: class-match? ( actual expected -- ? )
+    {
+        { f [ drop t ] }
+        { known-tag [ class-tag >boolean ] }
+        [ class< ]
+    } case ;
+
+: template-classes-match? ( -- ? )
+    #! Depends on node@
+    node@ node-input-classes +input+ get
+    [ 2 swap ?nth class-match? ] 2all? ;
+
+: template-matches? ( spec -- ? )
+    #! Depends on node@
+    clone [
+        template-specs-match?
+        template-classes-match? and
+        [ guess-template-vregs free-vregs? ] [ f ] if
+    ] bind ;
+
+: (find-template) ( templates -- pair/f )
+    #! Depends on node@
+    [ second template-matches? ] find nip ;
+
+: find-template ( templates -- pair/f )
+    #! Pair has shape { quot hash }
+    #! Depends on node@
+    compute-free-vregs
+    dup (find-template) [ ] [
+        finalize-contents (find-template)
+    ] ?if ;
+
+: operand-class ( operand -- class )
+    #! Depends on node@
+    +input+ get [ second = ] curry* find drop
+    node@ tuck node-in-d nth node-class ;
+
+: operand-tag ( operand -- tag/f )
+    #! Depends on node@
+    operand-class class-tag ;
diff --git a/core/generator/registers/summary.txt b/core/generator/registers/summary.txt
new file mode 100644 (file)
index 0000000..89a46af
--- /dev/null
@@ -0,0 +1 @@
+Register allocation and intrinsic selection
diff --git a/core/generator/summary.txt b/core/generator/summary.txt
new file mode 100644 (file)
index 0000000..cf857ad
--- /dev/null
@@ -0,0 +1 @@
+Final stage of compilation generates machine code from dataflow IR
diff --git a/core/generator/tags.txt b/core/generator/tags.txt
new file mode 100644 (file)
index 0000000..86a7c8e
--- /dev/null
@@ -0,0 +1 @@
+compiler
diff --git a/core/generic/authors.txt b/core/generic/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/generic/classes.factor b/core/generic/classes.factor
deleted file mode 100644 (file)
index a961ead..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: generic
-USING: arrays definitions errors hashtables kernel
-kernel-internals namespaces sequences strings words
-vectors math parser ;
-
-PREDICATE: word class ( obj -- ? ) "class" word-prop ;
-
-SYMBOL: typemap
-SYMBOL: class<map
-SYMBOL: builtins
-
-PREDICATE: word builtin ( obj -- ? ) builtins get memq? ;
-
-: classes ( -- seq ) class<map get hash-keys ;
-
-: type>class ( n -- class ) builtins get nth ;
-
-: predicate-word ( word -- predicate )
-    word-name "?" append create-in ;
-
-: predicate-effect 1 1 <effect> ;
-
-: define-predicate ( class predicate quot -- )
-    over [
-        over predicate-effect "declared-effect" set-word-prop
-        dupd define-compound
-        2dup unit "predicate" set-word-prop
-        swap "predicating" set-word-prop
-    ] [
-        3drop
-    ] if ;
-
-: superclass ( class -- super ) "superclass" word-prop ;
-
-: members ( class -- seq ) "members" word-prop ;
-
-: (flatten-class) ( class -- )
-    dup members [ [ (flatten-class) ] each ] [ dup set ] ?if ;
-
-: flatten-class ( class -- seq )
-    [ (flatten-class) ] make-hash ;
-
-: (types) ( class -- )
-    flatten-class [
-        drop dup superclass
-        [ (types) ] [ "type" word-prop dup set ] ?if
-    ] hash-each ;
-
-: types ( class -- seq )
-    [ (types) ] make-hash hash-keys natural-sort ;
-
-DEFER: (class<)
-
-: superclass< ( cls1 cls2 -- ? )
-    >r superclass r> 2dup and [ (class<) ] [ 2drop f ] if ;
-
-: union-class< ( cls1 cls2 -- ? )
-    [ flatten-class ] 2apply hash-keys swap
-    [ drop swap [ (class<) ] contains-with? ] hash-all-with? ;
-
-: class-empty? ( class -- ? )
-    members dup [ empty? ] when ;
-
-: (class<) ( class1 class2 -- ? )
-    {
-        { [ 2dup eq? ] [ 2drop t ] }
-        { [ over class-empty? ] [ 2drop t ] }
-        { [ 2dup superclass< ] [ 2drop t ] }
-        { [ 2dup [ members ] 2apply or not ] [ 2drop f ] }
-        { [ t ] [ union-class< ] }
-    } cond ;
-
-: class< ( class1 class2 -- ? )
-    class<map get hash hash-member? ;
-
-: class-compare ( class1 class2 -- n )
-    2dup eq? [ 2drop 0 ] [ class< 1 -1 ? ] if ;
-
-: lookup-union ( classes -- class )
-    typemap get hash [ object ] unless* ;
-
-: types* ( class -- classes )
-    types [ type>class dup ] map>hash ;
-
-: (class-or) ( class class -- class )
-    [ types* ] 2apply hash-union lookup-union ;
-
-: class-or ( class1 class2 -- class )
-    {
-        { [ 2dup class< ] [ nip ] }
-        { [ 2dup swap class< ] [ drop ] }
-        { [ t ] [ (class-or) ] }
-    } cond ;
-
-: (class-and) ( class class -- class )
-    [ types* ] 2apply hash-intersect lookup-union ;
-
-: class-and ( class1 class2 -- class )
-    {
-        { [ 2dup class< ] [ drop ] }
-        { [ 2dup swap class< ] [ nip ] }
-        { [ t ] [ (class-and) ] }
-    } cond ;
-
-: classes-intersect? ( class1 class2 -- ? )
-    class-and class-empty? not ;
-
-: min-class ( class seq -- class/f )
-    [ dupd classes-intersect? ] subset dup empty? [
-        2drop f
-    ] [
-        tuck [ class< ] all-with? [ peek ] [ drop f ] if
-    ] if ;
-
-: smaller-classes ( class -- seq )
-    classes [ swap (class<) ] subset-with ;
-
-: smaller-classes+ ( class -- )
-    [ smaller-classes [ dup ] map>hash ] keep
-    class<map get set-hash ;
-
-: bigger-classes ( class -- seq )
-    classes [ (class<) ] subset-with ;
-
-: bigger-classes+ ( class -- )
-    dup bigger-classes
-    [ dupd class<map get hash set-hash ] each-with ;
-
-: define-class ( class -- )
-    dup t "class" set-word-prop
-    dup dup flatten-class typemap get set-hash
-    dup smaller-classes+ bigger-classes+ ;
-
-! Predicate classes for generalized predicate dispatch.
-: define-predicate-class ( class predicate definition -- )
-    pick define-class
-    3dup nip "definition" set-word-prop
-    pick superclass "predicate" word-prop
-    [ \ dup , % , [ drop f ] , \ if , ] [ ] make
-    define-predicate ;
-
-PREDICATE: class predicate "definition" word-prop ;
-
-! Union classes for dispatch on multiple classes.
-: union-predicate ( seq -- quot )
-    [ dup ] swap [ "predicate" word-prop append ] map-with
-    [ [ drop t ] 2array ] map [ drop f ] swap alist>quot ;
-
-: set-members ( class members -- )
-    [ bootstrap-word ] map "members" set-word-prop ;
-
-: define-union ( class predicate members -- )
-    3dup nip set-members pick define-class
-    union-predicate define-predicate ;
-
-PREDICATE: class union members ;
-
-! Definition protocol
-: smaller-classes- ( class -- )
-    class<map get remove-hash ;
-
-: bigger-classes- ( class -- )
-    classes [ class<map get hash remove-hash ] each-with ;
-
-: forget-class ( class -- )
-    dup subdefs [ forget ] each
-    dup "predicate" word-prop [ forget ] each
-    dup dup flatten-class typemap get remove-hash forget-word
-    dup smaller-classes- bigger-classes- ;
-
-M: class forget forget-class ;
diff --git a/core/generic/classes.facts b/core/generic/classes.facts
deleted file mode 100644 (file)
index 71aa887..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-USING: generic help kernel kernel-internals ;
-
-HELP: classes
-{ $values { "seq" "a sequence of class words" } }
-{ $description "Finds all class words in the dictionary." } ;
-
-HELP: builtin
-{ $class-description "The class of built-in classes." } ;
-
-HELP: typemap
-{ $description "Global variable. Hashtable mapping unions to class words." }
-{ $see-also class-and } ;
-
-HELP: builtins
-{ $description "Global variable. Vector mapping type numbers to builtin class words." } ;
-
-HELP: object
-{ $description
-    "The class of all objects. If a generic word defines a method specializing on this class, the method is used as a fallback, if no other applicable method is found. For instance:"
-    { $code "GENERIC: enclose" "M: number enclose 1array ;" "M: object enclose ;" }
-} ;
-
-HELP: null
-{ $description
-    "The canonical empty class with no instances."
-} ;
-
-HELP: type>class
-{ $values { "n" "a non-negative integer" } { "class" "a class word" } }
-{ $description "Outputs a builtin class whose instances are precisely those of a builtin type." }
-{ $notes "The parameter " { $snippet "n" } " must be between 0 and the return value of " { $link num-types } "." } ;
-
-HELP: predicate-word
-{ $values { "word" "a word" } { "predicate" "a predicate word" } }
-{ $description "Suffixes \"?\" to the name of " { $snippet "word" } " and creates a word with that name in the current vocabulary." } ;
-
-HELP: define-predicate
-{ $values { "class" "a class word" } { "predicate" "a predicate word" } { "quot" "a quotation" } }
-{ $description
-    "Defines a predicate word. This is identical to a compound definition associating " { $snippet "quot" } " with " { $snippet "predicate" } " with the added perk that two word properties are set:"
-    { $list
-        { "the class word's " { $snippet "\"predicate\"" } " property is set to a quotation that calls the predicate" }
-        { "the predicate word's " { $snippet "\"predicating\"" } " property is set to the class word" }
-    }
-    "These properties allow the method combination code to generate method dispatch logic."
-}
-$low-level-note ;
-
-HELP: superclass
-{ $values { "class" "a class word" } { "super" "a class word" } }
-{ $description "Outputs the superclass of a class. All instances of this class are also instances of the superclass." }
-{ $notes "If " { $link class< } " yields that one class is a subtype of another, it does not imply that a superclass relation is involved. The superclass relation is a technical implementation detail of predicate classes (see " { $link POSTPONE: PREDICATE: } ").." } ;
-
-HELP: members
-{ $values { "class" "a class word" } { "seq" "a sequence of union members, or " { $link f } } }
-{ $description "If " { $snippet "class" } " is a union class, outputs a sequence of members, otherwise outputs " { $link f } "." } ;
-
-HELP: flatten-class
-{ $values { "class" "a class word" } { "seq" "a sequence of classes" } }
-{ $description "Outputs a sequence of classes whose union is the given class. Unless the given class is a union class, the output is just a singleton sequence consisting of the given class." } ;
-
-HELP: types
-{ $values { "class" "a class word" } { "seq" "a sequence of integers" } }
-{ $description "Outputs a sequence of builtin type numbers whose instances can possibly be instances of the given class." } ;
-
-HELP: class-empty?
-{ $values { "class" "a class" } }
-{ $description "Tests if a class is a union class with no members." }
-{ $examples { $example "null class-empty? ." "t" } } ;
-
-HELP: class<
-{ $values { "class1" "a class" } { "class2" "a class" } { "?" "a boolean" } }
-{ $description "Tests if all instances of " { $snippet "class1" } " are also instances of " { $snippet "class2" } "." }
-{ $notes "Classes are partially ordered. This means that if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class1" } ", then " { $snippet "class1 = class2" } ". Also, if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class3" } ", then " { $snippet "class1 <= class3" } "." } ;
-
-HELP: class-compare
-{ $values { "class1" "a class" } { "class2" "a class" } { "n" "an integer" } }
-{ $description "Compares two classes, with the sign of the result indicating their sort order." }
-{ $notes "This word is used to sort sequences of classes." }
-{ $see-also methods order } ;
-
-HELP: lookup-union
-{ $values { "classes" "a hashtable mapping class words to themselves" } { "class" "a class word" } }
-{ $description "Given a set of classes represented as a hashtable with equal keys and values, looks up a previously-defined union class having those members. If no union is defined, outputs " { $link object } "." }
-{ $see-also "unions" class-and class-or } ;
-
-HELP: types*
-{ $values { "class" "a class word" } { "classes" "a hashtable mapping class words to themselves" } }
-{ $description "Outputs a sequence of builtin classes whose instances can possibly be instances of the given class." } ;
-
-HELP: class-or
-{ $values { "class1" "a class word" } { "class2" "a class word" } { "class" "a class word" } }
-{ $description "Outputs a class whose instances are instances of either one of the two input classes. If the union is non-empty but no class with those members is defined, outputs " { $link object } "." } ;
-
-HELP: class-and
-{ $values { "class1" "a class word" } { "class2" "a class word" } { "class" "a class word" } }
-{ $description "Outputs a class whose instances are instances of both input classes. If the intersection is non-empty but no class with those members is defined, outputs " { $link object } ". If the intersection is empty, outputs " { $link null } "." } ;
-
-HELP: classes-intersect?
-{ $values { "class1" "a class word" } { "class2" "a class word" } { "?" "a boolean" } }
-{ $description "Tests if two classes have a non-empty intersection." } ;
-
-HELP: min-class
-{ $values { "class" "a class word" } { "seq" "a sequence of class words" } { "class/f" "a class word or " { $link f } } }
-{ $description "If all classes in " { $snippet "seq" } " that intersect " { $snippet "class" } " are subtypes of " { $snippet "class" } ", outputs the last such element of " { $snippet "seq" } ". If any conditions fail to hold, outputs " { $link f } "." } ;
-
-HELP: define-class
-{ $values { "class" "a class word" } }
-{ $description "Sets a property indicating this is a class word, and registers the class in the global union lookup map." }
-$low-level-note ;
-
-HELP: define-predicate-class
-{ $values { "class" "a class word" } { "predicate" "a predicate word" } { "definition" "a quotation with stack effect " { $snippet "( superclass -- ? )" } } }
-{ $description "Defines a predicate class. The superclass of " { $snippet "class" } " must already be set." }
-{ $see-also POSTPONE: PREDICATE: } ;
-
-HELP: predicate
-{ $class-description "The class of predicate class words." }
-{ $see-also "predicates" POSTPONE: PREDICATE: } ;
-
-HELP: union-predicate
-{ $values { "seq" "a sequence of class words" } { "quot" "a quotation with stack effect " { $snippet "( object -- ? )" } } }
-{ $description "Outputs a quotation for testing of an object is an instance of one of the given classes." } ;
-
-HELP: define-union
-{ $values { "class" "a class word" } { "predicate" "a predicate word" } { "members" "a sequence of class words" } }
-{ $description "Defines a union class with specified members." }
-{ $see-also POSTPONE: UNION: } ;
-
-HELP: union
-{ $class-description "The class of union class words." } 
-{ $see-also "unions" POSTPONE: UNION: } ;
diff --git a/core/generic/early-generic.factor b/core/generic/early-generic.factor
deleted file mode 100644 (file)
index cc143ac..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: generic
-USING: errors kernel kernel-internals ;
-
-DEFER: standard-combination
-
-DEFER: math-combination
-
-: delegate ( obj -- delegate )
-    dup tuple? [ 3 slot ] [ drop f ] if ;
-
-GENERIC: set-delegate ( delegate tuple -- )
-M: tuple set-delegate 3 set-slot ;
diff --git a/core/generic/early-generic.facts b/core/generic/early-generic.facts
deleted file mode 100644 (file)
index 744115c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-USING: generic help ;
-
-HELP: delegate
-{ $values { "obj" "an object" } { "delegate" "an object" } }
-{ $description "Returns an object's delegate, or " { $link f } " if no delegate is set." }
-{ $notes "A direct consequence of this behavior is that an object may not have a delegate of " { $link f } "." } ;
-
-HELP: set-delegate
-{ $values { "delegate" "an object" } { "tuple" "a tuple" } }
-{ $description "Sets a tuple's delegate. Method calls not handled by the tuple's class will now be passed on to the delegate." } ;
diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor
new file mode 100644 (file)
index 0000000..bc9d1b3
--- /dev/null
@@ -0,0 +1,169 @@
+USING: help.markup help.syntax generic.math generic.standard
+words classes definitions kernel alien combinators sequences ;
+IN: generic
+
+ARTICLE: "method-order" "Method ordering"
+"It is possible that two classes have a non-empty intersection and neither is a subclass of the other. This means there is no canonical linear ordering of classes."
+$nl
+"Consider the following set of definitions:"
+{ $code
+    "GENERIC: explain"
+    "M: general-t explain drop \"a true value\" print ;"
+    "M: c-ptr explain drop \"a tagged immediate\" print ;"
+    "M: object explain drop \"an object\" print ;"
+}
+"Neither " { $link general-t } " nor " { $link sequence } " are subclasses of each other, yet their intersection is non-empty. So the generic word system will place " { $link object } " first in the method order, however either " { $link general-t } " or " { $link sequence } " may come next, and it is pretty much a random choice that depends on hashing:"
+{ $example "\\ bar order ."  "{ object general-t sequence }" }
+"Therefore, the outcome of calling " { $snippet "bar" } " with " { $link f } " on the stack is undefined."
+$nl
+"As you can see above, the " { $link order } " word can be useful to clarify method dispatch."
+{ $subsection order } ;
+
+ARTICLE: "generic-introspection" "Generic word introspection"
+"In most cases, generic words and methods are defined at parse time with " { $link POSTPONE: GENERIC: } " (or some other parsing word) and " { $link POSTPONE: M: } "."
+$nl
+"Sometimes, generic words need to be inspected defined at run time; words for performing these tasks are found in the " { $vocab-link "generic" } " vocabulary."
+$nl
+"The set of generic words is a class which implements the " { $link "definition-protocol" } ":"
+{ $subsection generic }
+{ $subsection generic? }
+"New generic words can be defined:"
+{ $subsection define-generic }
+{ $subsection define-simple-generic }
+"Methods are tuples:"
+{ $subsection <method> }
+"Methods can be added to existing generic words:"
+{ $subsection define-method }
+"Method definitions can be looked up:"
+{ $subsection method }
+{ $subsection methods }
+"A generic word contains methods; the list of methods specializing on a class can also be obtained:"
+{ $subsection implementors }
+"Low-level words which rebuilds the generic word after methods are added or removed, or the method combination is changed:"
+{ $subsection make-generic }
+{ $subsection ?make-generic }
+"A " { $emphasis "method specifier" } " refers to a method and implements the " { $link "definition-protocol" } ":"
+{ $subsection method-spec } ;
+
+ARTICLE: "method-combination" "Custom method combination"
+"Abstractly, a generic word can be thought of as a big chain of type conditional tests applied to the top of the stack, with methods as the bodies of each test. The " { $emphasis "method combination" } " is this control flow glue between the set of methods, and several aspects of it can be customized:"
+{ $list
+    "which stack item(s) the generic word dispatches upon,"
+    "which methods out of the set of applicable methods are called"
+}
+"A table of built-in method combination defining words, and the method combinations themselves:"
+{ $table
+    { { $link POSTPONE: GENERIC: } { $link standard-combination } }
+    { { $link POSTPONE: GENERIC# } { $link standard-combination } }
+    { { $link POSTPONE: HOOK: } { $link hook-combination } }
+    { { $link POSTPONE: MATH: } { $link math-combination } }
+}
+"Developing a custom method combination requires that a parsing word calling " { $link define-generic } " be defined; additionally, it is a good idea to implement the definition protocol words " { $link definer } " and " { $link synopsis* } " on the class of words having this method combination, to properly support developer tools."
+$nl
+"The combination quotation passed to " { $link define-generic } " has stack effect " { $snippet "( word -- quot )" } ". It's job is to call various introspection words, including at least obtaining the set of methods defined on the generic word, then combining these methods in some way to produce a quotation."
+$nl
+"Method combination utilities:"
+{ $subsection single-combination }
+{ $subsection class-predicates }
+{ $subsection simplify-alist }
+{ $subsection math-upgrade }
+{ $subsection object-method }
+{ $subsection error-method }
+"More quotation construction utilities can be found in " { $link "quotations" } " and " { $link "combinators-quot" } "."
+{ $see-also "generic-introspection" } ;
+
+ARTICLE: "generic" "Generic words and methods"
+"A " { $emphasis "generic word" } " is composed of zero or more " { $emphasis "methods" } " together with a " { $emphasis "method combination" } ". A method " { $emphasis "specializes" } " on a class; when a generic word executed, the method combination chooses the most appropriate method and calls its definition."
+$nl
+"A generic word behaves roughly like a long series of class predicate conditionals in a " { $link cond } " form, however methods can be defined in independent source files, reducing coupling and increasing extensibility. The method combination determines which object the generic word will " { $emphasis "dispatch" } " on; this could be the top of the stack, or some other value."
+$nl
+"Generic words which dispatch on the object at the top of the stack:"
+{ $subsection POSTPONE: GENERIC: }
+"A method combination which dispatches on a specified stack position:"
+{ $subsection POSTPONE: GENERIC# }
+"A method combination which dispatches on the value of a variable at the time the generic word is called:"
+{ $subsection POSTPONE: HOOK: }
+"A method combination which dispatches on a pair of stack values, which must be numbers, and upgrades both to the same type of number:"
+{ $subsection POSTPONE: MATH: }
+"Method definition:"
+{ $subsection POSTPONE: M: }
+"Generic words must declare their stack effect in order to compile. See " { $link "effect-declaration" } "."
+{ $subsection "method-order" }
+{ $subsection "generic-introspection" }
+{ $subsection "method-combination" }
+"Generic words specialize behavior based on the class of an object; sometimes behavior needs to be specialized on the object's " { $emphasis "structure" } "; this is known as " { $emphasis "pattern matching" } " and is implemented in the " { $vocab-link "match" } " vocabulary." ;
+
+ABOUT: "generic"
+
+HELP: generic
+{ $class-description "The class of generic words, documented in " { $link "generic" } "." } ;
+
+{ generic define-generic define-simple-generic POSTPONE: GENERIC: POSTPONE: GENERIC# POSTPONE: MATH: POSTPONE: HOOK: } related-words
+
+HELP: make-generic
+{ $values { "word" generic } }
+{ $description "Regenerates the definition of a generic word by applying the method combination to the set of defined methods." }
+$low-level-note ;
+
+HELP: ?make-generic
+{ $values { "word" generic } }
+{ $description "Regenerates the definition of a generic word, unless bootstrap is in progress, in which case nothing is done. This avoids regenerating generic words multiple times during bootstrap as methods are defined. Instead, all generic words are built once at the end of the process, resulting in a performance improvement." }
+$low-level-note ;
+
+HELP: init-methods
+{ $values { "word" word } }
+{ $description "Prepare to define a generic word." } ;
+
+HELP: define-generic
+{ $values { "word" word } { "combination" "a method combination" } }
+{ $description "Defines a generic word. A method combination is an object which responds to the " { $link perform-combination } " generic word." }
+{ $contract "The method combination quotation is called each time the generic word has to be updated (for example, when a method is added), and thus must be side-effect free." } ;
+
+HELP: method-spec
+{ $class-description "The class of method specifiers, which are two-element arrays consisting of a class word followed by a generic word." }
+{ $examples { $code "{ fixnum + }" "{ editor draw-gadget* }" } } ;
+
+HELP: method
+{ $values { "class" class } { "generic" generic } { "method/f" "a " { $link method } " or " { $link f } } }
+{ $description "Looks up a method definition." }
+{ $class-description "Instances of this class are methods. A method consists of a quotation together with a source location where it was defined." } ;
+
+{ method method-def method-loc define-method POSTPONE: M: } related-words
+
+HELP: <method>
+{ $values { "def" "a quotation" } { "method" "a new method definition" } }
+{ $description "Creates a new  "{ $link method } " instance." } ;
+
+HELP: sort-methods
+{ $values { "assoc" "an assoc mapping classes to methods" } { "newassoc" "an association list mapping classes to quotations" } }
+{ $description "Outputs a sequence of pairs, where the first element of each pair is a class and the second element is the corresponding method quotation. The methods are sorted by class order; see " { $link sort-classes } "." } ;
+
+HELP: methods
+{ $values { "word" generic } { "assoc" "an association list mapping classes to quotations" } }
+{ $description "Outputs a sequence of pairs, where the first element of each pair is a class and the second element is the corresponding method quotation. The methods are sorted by class order; see " { $link sort-classes } "." } ;
+
+HELP: order
+{ $values { "generic" generic } { "seq" "a sequence of classes" } }
+{ $description "Outputs a sequence of classes for which methods have been defined on this generic word. The sequence is sorted in method dispatch order." } ;
+
+HELP: check-method
+{ $values { "class" class } { "generic" generic } }
+{ $description "Asserts that " { $snippet "class" } " is a class word and " { $snippet "generic" } " is a generic word, throwing a " { $link check-method } " error if the assertion fails." }
+{ $error-description "Thrown if " { $link POSTPONE: M: } " or " { $link define-method } " is given an invalid class or generic word." } ;
+
+HELP: with-methods
+{ $values { "word" generic } { "quot" "a quotation with stack effect " { $snippet "( methods -- )" } } }
+{ $description "Applies a quotation to the generic word's methods hashtable, and regenerates the generic word's definition when the quotation returns." }
+$low-level-note ;
+
+HELP: define-method
+{ $values { "method" "an instance of " { $link method } } { "class" class } { "generic" generic } }
+{ $description "Defines a method. This is the runtime equivalent of " { $link POSTPONE: M: } "." } ;
+
+HELP: implementors
+{ $values { "class" class } { "seq" "a sequence of generic words" } }
+{ $description "Finds all generic words in the dictionary implementing methods for this class." } ;
+
+HELP: forget-methods
+{ $values { "class" class } }
+{ $description "Remove all method definitions which specialize on the class." } ;
diff --git a/core/generic/generic-tests.factor b/core/generic/generic-tests.factor
new file mode 100644 (file)
index 0000000..112fe48
--- /dev/null
@@ -0,0 +1,199 @@
+USING: alien arrays definitions generic generic.standard
+generic.math assocs hashtables io kernel math namespaces parser
+prettyprint sequences strings tools.test vectors words
+quotations classes continuations layouts classes.union sorting ;
+IN: temporary
+
+GENERIC: foobar ( x -- y )
+M: object foobar drop "Hello world" ;
+M: fixnum foobar drop "Goodbye cruel world" ;
+
+GENERIC: class-of ( x -- y )
+
+M: fixnum class-of drop "fixnum" ;
+M: word   class-of drop "word"   ;
+
+[ "fixnum" ] [ 5 class-of ] unit-test
+[ "word" ] [ \ class-of class-of ] unit-test
+[ 3.4 class-of ] unit-test-fails
+
+[ "Hello world" ] [ 4 foobar foobar ] unit-test
+[ "Goodbye cruel world" ] [ 4 foobar ] unit-test
+
+GENERIC: bool>str ( x -- y )
+M: general-t bool>str drop "true" ;
+M: f bool>str drop "false" ;
+
+: str>bool
+    H{
+        { "true" t }
+        { "false" f }
+    } at ;
+
+[ t ] [ t bool>str str>bool ] unit-test
+[ f ] [ f bool>str str>bool ] unit-test
+
+! Testing unions
+UNION: funnies quotation ratio complex ;
+
+GENERIC: funny ( x -- y )
+M: funnies funny drop 2 ;
+M: object funny drop 0 ;
+
+[ 2 ] [ [ { } ] funny ] unit-test
+[ 0 ] [ { } funny ] unit-test
+
+PREDICATE: funnies very-funny number? ;
+
+GENERIC: gooey ( x -- y )
+M: very-funny gooey sq ;
+
+[ 1/4 ] [ 1/2 gooey ] unit-test
+
+DEFER: complement-test
+FORGET: complement-test
+GENERIC: complement-test ( x -- y )
+
+M: f         complement-test drop "f" ;
+M: general-t complement-test drop "general-t" ;
+
+[ "general-t" ] [ 5 complement-test ] unit-test
+[ "f" ] [ f complement-test ] unit-test
+
+GENERIC: empty-method-test ( x -- y )
+M: object empty-method-test ;
+TUPLE: for-arguments-sake ;
+C: <for-arguments-sake> for-arguments-sake
+
+M: for-arguments-sake empty-method-test drop "Hi" ;
+
+TUPLE: another-one ;
+C: <another-one> another-one
+
+[ "Hi" ] [ <for-arguments-sake> empty-method-test empty-method-test ] unit-test
+[ T{ another-one f } ] [ <another-one> empty-method-test ] unit-test
+
+! Weird bug
+GENERIC: stack-underflow ( x y -- )
+M: object stack-underflow 2drop ;
+M: word stack-underflow 2drop ;
+
+GENERIC: union-containment ( x -- y )
+M: integer union-containment drop 1 ;
+M: number union-containment drop 2 ;
+
+[ 1 ] [ 1 union-containment ] unit-test
+[ 2 ] [ 1.0 union-containment ] unit-test
+
+! Testing recovery from bad method definitions
+"IN: temporary GENERIC: unhappy ( x -- x )" eval
+[
+    "IN: temporary M: dictionary unhappy ;" eval
+] unit-test-fails
+[ ] [ "IN: temporary GENERIC: unhappy ( x -- x )" eval ] unit-test
+
+GENERIC# complex-combination 1 ( a b -- c )
+M: string complex-combination drop ;
+M: object complex-combination nip ;
+
+[ "hi" ] [ "hi" 3 complex-combination ] unit-test
+[ "hi" ] [ 3 "hi" complex-combination ] unit-test
+
+TUPLE: shit ;
+
+M: shit complex-combination 2array ;
+[ { T{ shit f } 5 } ] [ T{ shit f } 5 complex-combination ] unit-test
+
+[ t ] [ \ complex-combination generic? >boolean ] unit-test
+
+GENERIC: big-generic-test ( x -- x y )
+M: fixnum big-generic-test "fixnum" ;
+M: bignum big-generic-test "bignum" ;
+M: ratio big-generic-test "ratio" ;
+M: string big-generic-test "string" ;
+M: shit big-generic-test "shit" ;
+
+TUPLE: delegating ;
+
+[ T{ shit f } "shit" ] [ T{ shit f } big-generic-test ] unit-test
+[ T{ shit f } "shit" ] [ T{ delegating T{ shit f } } big-generic-test ] unit-test
+
+[ t ] [ \ + math-generic? ] unit-test
+
+[ "SYMBOL: not-a-class C: not-a-class ;" parse ] unit-test-fails
+
+! Test math-combination
+[ [ >r >float r> ] ] [ \ real \ float math-upgrade ] unit-test
+[ [ >float ] ] [ \ float \ real math-upgrade ] unit-test
+[ [ >r >bignum r> ] ] [ \ fixnum \ bignum math-upgrade ] unit-test
+[ [ >float ] ] [ \ float \ integer math-upgrade ] unit-test
+[ number ] [ \ number \ float math-class-max ] unit-test
+[ float ] [ \ real \ float math-class-max ] unit-test
+[ fixnum ] [ \ fixnum \ null math-class-max ] unit-test
+
+[ t ] [ { hashtable equal? } method-spec? ] unit-test
+[ f ] [ { word = } method-spec? ] unit-test
+
+! Regression
+TUPLE: first-one ;
+TUPLE: second-one ;
+UNION: both first-one union-class ;
+
+GENERIC: wii ( x -- y )
+M: both wii drop 3 ;
+M: second-one wii drop 4 ;
+M: tuple-class wii drop 5 ;
+M: integer wii drop 6 ;
+
+[ 3 ] [ T{ first-one } wii ] unit-test
+
+! Hooks
+SYMBOL: my-var
+HOOK: my-hook my-var ( -- x )
+
+M: integer my-hook "an integer" ;
+M: string my-hook "a string" ;
+
+[ "an integer" ] [ 3 my-var set my-hook ] unit-test
+[ "a string" ] [ my-hook my-var set my-hook ] unit-test
+[ T{ no-method f 1.0 my-hook } ] [
+    1.0 my-var set [ my-hook ] catch
+] unit-test
+
+GENERIC: tag-and-f ( x -- x x )
+
+M: fixnum tag-and-f 1 ;
+
+M: bignum tag-and-f 2 ;
+
+M: float tag-and-f 3 ;
+
+M: f tag-and-f 4 ;
+
+[ f 4 ] [ f tag-and-f ] unit-test
+
+[ 3.4 3 ] [ 3.4 tag-and-f ] unit-test
+
+! define-class hashing issue
+TUPLE: debug-combination ;
+
+M: debug-combination perform-combination
+    drop
+    order [ dup class-hashes ] { } map>assoc sort-keys
+    1quotation ;
+
+SYMBOL: redefinition-test-generic
+
+redefinition-test-generic T{ debug-combination } define-generic
+
+TUPLE: redefinition-test-tuple ;
+
+"IN: temporary M: redefinition-test-tuple redefinition-test-generic ;" eval
+
+[ t ] [
+    [
+        redefinition-test-generic ,
+        "IN: temporary TUPLE: redefinition-test-tuple ;" eval
+        redefinition-test-generic ,
+    ] { } make all-equal?
+] unit-test
index 53d5edee689489d9671617ed1e267edb61f157a9..0de8bd42d2f4592684f1b76a122ea4450a2c06ed 100644 (file)
-! Copyright (C) 2006 Slava Pestov.
+! Copyright (C) 2006, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
+USING: words kernel sequences namespaces assocs hashtables
+definitions kernel.private classes classes.private
+quotations arrays vocabs ;
 IN: generic
-USING: words kernel sequences namespaces hashtables ;
 
 PREDICATE: compound generic ( word -- ? )
     "combination" word-prop ;
 
-M: generic definer drop \ G: ;
+M: generic definer drop f f ;
+
+M: generic definition drop f ;
+
+GENERIC: perform-combination ( word combination -- quot )
 
 : make-generic ( word -- )
-    dup dup "combination" word-prop call define-compound ;
+    dup
+    dup "combination" word-prop perform-combination
+    define-compound ;
 
 : ?make-generic ( word -- )
-    bootstrapping? get
-    [ [ ] define-compound ] [ make-generic ] if ;
+    [ [ ] define-compound ] [ make-generic ] if-bootstrapping ;
 
 : init-methods ( word -- )
      dup "methods" word-prop
-     [ drop ] [ H{ } clone "methods" set-word-prop ] if ;
-
-! Defining generic words
-
-: bootstrap-combination ( quot -- quot )
-    global [ [ dup word? [ target-word ] when ] map ] bind ;
+     H{ } assoc-like
+     "methods" set-word-prop ;
 
-: define-generic* ( word combination -- )
-    bootstrap-combination
+: define-generic ( word combination -- )
     dupd "combination" set-word-prop
     dup init-methods ?make-generic ;
 
-: generic-tags ( word -- seq )
-    "methods" word-prop hash-keys [ types ] map concat prune ;
+TUPLE: method loc def ;
+
+: <method> ( def -- method )
+    { set-method-def } \ method construct ;
+
+M: f method-def ;
+M: f method-loc ;
+M: quotation method-def ;
+M: quotation method-loc drop f ;
+
+: method ( class generic -- method/f )
+    "methods" word-prop at ;
+
+PREDICATE: pair method-spec
+    first2 generic? swap class? and ;
+
+: order ( generic -- seq )
+    "methods" word-prop keys sort-classes ;
+
+: sort-methods ( assoc -- newassoc )
+    [ keys sort-classes ] keep
+    [ dupd at method-def 2array ] curry map ;
+
+: methods ( word -- assoc )
+    "methods" word-prop sort-methods ;
+
+TUPLE: check-method class generic ;
+
+: check-method ( class generic -- class generic )
+    over class? over generic? and [
+        \ check-method construct-boa throw
+    ] unless ;
+
+: with-methods ( word quot -- )
+    swap [ "methods" word-prop swap call ] keep ?make-generic ;
+    inline
+
+: define-method ( method class generic -- )
+    >r bootstrap-word r> check-method
+    [ set-at ] with-methods ;
+
+! Definition protocol
+M: method-spec where
+    dup first2 method method-loc [ ] [ second where ] ?if ;
+
+M: method-spec set-where first2 method set-method-loc ;
+
+M: method-spec definer drop \ M: \ ; ;
+
+M: method-spec definition first2 method method-def ;
+
+M: method-spec forget first2 [ delete-at ] with-methods ;
+
+: implementors* ( classes -- words )
+    all-words [
+        "methods" word-prop keys
+        swap [ key? ] curry contains?
+    ] curry* subset ;
+
+: implementors ( class -- seq )
+    dup associate implementors* ;
+
+: forget-methods ( class -- )
+    [ implementors ] keep [ swap 2array forget ] curry each ;
+
+M: class forget ( class -- )
+    dup forget-methods
+    dup uncache-class
+    forget-word ;
+
+M: class update-methods ( class -- )
+    [ drop ]
+    [ class-usages implementors* [ make-generic ] each ]
+    if-bootstrapping ;
diff --git a/core/generic/generic.facts b/core/generic/generic.facts
deleted file mode 100644 (file)
index e762f24..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-IN: generic
-USING: help ;
-
-HELP: generic
-{ $class-description "The class of generic words." }
-{ $see-also "generic" POSTPONE: GENERIC: POSTPONE: G: } ;
-
-HELP: make-generic
-{ $values { "word" "a generic word" } }
-{ $description "Regenerates the definition of a generic word by applying the method combination to the set of defined methods." }
-$low-level-note ;
-
-HELP: ?make-generic
-{ $values { "word" "a generic word" } }
-{ $description "Regenerates the definition of a generic word, unless bootstrap is in progress, in which case nothing is done. This avoids regenerating generic words multiple times during bootstrap as methods are defined. Instead, all generic words are built once at the end of the process, resulting in a performance improvement." }
-$low-level-note ;
-
-HELP: init-methods
-{ $values { "word" "a word" } }
-{ $description "Prepare to define a generic word." } ;
-
-HELP: define-generic*
-{ $values { "word" "a word" } { "combination" "a quotation with stack effect " { $snippet "( word -- quot )" } } }
-{ $description "Defines a generic word with the specified method combination. If the word is already a generic word, existing methods are retained." }
-{ $see-also POSTPONE: G: define-generic } ;
diff --git a/core/generic/math-combination.factor b/core/generic/math-combination.factor
deleted file mode 100644 (file)
index e0b704f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: generic
-USING: arrays errors generic hashtables kernel kernel-internals
-math namespaces sequences words ;
-
-PREDICATE: class math-class ( object -- ? )
-    dup null bootstrap-word eq? [
-        drop f
-    ] [
-        number bootstrap-word class<
-    ] if ;
-
-: math-class-compare ( class class -- n )
-    [
-        dup math-class?
-        [ types last/first ] [ drop { 100 100 } ] if
-    ] 2apply <=> ;
-
-: math-class-max ( class class -- class )
-    [ math-class-compare 0 > ] 2keep ? ;
-
-: (math-upgrade) ( max class -- quot )
-    dupd = [
-        drop [ ]
-    ] [
-        "coercer" word-prop [ [ ] ] unless*
-    ] if ;
-
-: math-upgrade ( class1 class2 -- quot )
-    [ math-class-max ] 2keep
-    >r over r> (math-upgrade)
-    >r (math-upgrade) dup empty? [ 1 make-dip ] unless
-    r> append ;
-
-TUPLE: no-math-method left right generic ;
-
-: no-math-method ( left right generic -- * )
-    <no-math-method> throw ;
-
-: applicable-method ( generic class -- quot )
-    over method method-def
-    [ ] [ [ no-math-method ] curry ] ?if ;
-
-: object-method ( generic -- quot )
-    object bootstrap-word applicable-method ;
-
-: math-method ( word class1 class2 -- quot )
-    2dup and [
-        2dup math-upgrade >r
-        math-class-max over order min-class applicable-method
-        r> swap append
-    ] [
-        2drop object-method
-    ] if ;
-
-: math-vtable* ( picker max quot -- quot )
-    [
-        rot , \ tag ,
-        [ >r [ type>class ] map r> map % ] { } make ,
-        \ dispatch ,
-    ] [ ] make ; inline
-
-: math-vtable ( picker quot -- quot )
-    num-tags swap math-vtable* ; inline
-
-: math-combination ( word -- quot )
-    \ over [
-        dup math-class? [
-            \ dup [ >r 2dup r> math-method ] math-vtable
-        ] [
-            over object-method
-        ] if nip
-    ] math-vtable nip ;
-
-PREDICATE: generic 2generic ( word -- ? )
-    "combination" word-prop [ math-combination ] = ;
diff --git a/core/generic/math-combination.facts b/core/generic/math-combination.facts
deleted file mode 100644 (file)
index 6414849..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-USING: generic help math ;
-
-HELP: math-upgrade
-{ $values { "class1" "a class word" } { "class2" "a class word" } { "quot" "a quotation with stack effect " { $snippet "( n n -- n n )" } } }
-{ $description "Outputs a quotation for upgrading numberical types. It takes two numbers on the stack, an instance of " { $snippet "class1" } ", and an instance of " { $snippet "class2" } ", and converts the one with the lower priority to the higher priority type." }
-{ $examples { $example "fixnum bignum math-upgrade ." "[ >r >bignum r> ]" } } ;
-
-HELP: no-math-method
-{ $values { "left" "an object" } { "right" "an object" } { "generic" "a generic word" } }
-{ $description "Throws a " { $link no-math-method } " error." }
-{ $error-description "Thrown by generic words using the " { $link math-combination } " method combination if there is no suitable method defined for the two inputs." } ;
-
-HELP: math-method
-{ $values { "word" "a generic word" } { "class1" "a class word" } { "class2" "a class word" } { "quot" "a quotation" } }
-{ $description "Generates a definition for " { $snippet "word" } " when the two inputs are instances of " { $snippet "class1" } " and " { $snippet "class2" } ", respectively." }
-{ $examples { $example "\\ + fixnum float math-method ." "[ >r >float r> float+ ]" } } ;
-
-HELP: math-class
-{ $values { "object" "an object" } { "?" "a boolean" } }
-{ $class-description "The class of subtypes of " { $link number } " which are not " { $link null } "." } ;
-
-HELP: math-combination
-{ $values { "word" "a generic word" } { "quot" "a quotation" } }
-{ $description "Generates a double-dispatching word definition. Only methods defined on numerical classes and " { $link object } " take effect in the math combination. Methods defined on numerical classes are guaranteed to have their two inputs upgraded to the highest priority type of the two."
-$terpri
-"The math method combination is used for binary operators such as " { $link + } " and " { $link * } "."
-$terpri
-"A method can only be added to a generic word using the math combination if the method specializes on one of the below classes, or a union defined over one or more of the below classes:"
-{ $code
-    "fixnum"
-    "bignum"
-    "ratio"
-    "float"
-    "complex"
-    "object"
-}
-"The math combination performs numerical upgrading as described in " { $link "number-protocol" } "." } ;
-
-HELP: 2generic
-{ $class-description "The class of generic words using " { $link math-combination } "." }
-{ $see-also POSTPONE: G: } ;
diff --git a/core/generic/math/authors.txt b/core/generic/math/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/generic/math/math-docs.factor b/core/generic/math/math-docs.factor
new file mode 100644 (file)
index 0000000..b19b358
--- /dev/null
@@ -0,0 +1,44 @@
+USING: kernel generic help.markup help.syntax math classes
+generic.math ;
+
+HELP: math-upgrade
+{ $values { "class1" "a class word" } { "class2" "a class word" } { "quot" "a quotation with stack effect " { $snippet "( n n -- n n )" } } }
+{ $description "Outputs a quotation for upgrading numberical types. It takes two numbers on the stack, an instance of " { $snippet "class1" } ", and an instance of " { $snippet "class2" } ", and converts the one with the lower priority to the higher priority type." }
+{ $examples { $example "USE: generic.math" "fixnum bignum math-upgrade ." "[ >r >bignum r> ]" } } ;
+
+HELP: no-math-method
+{ $values { "left" "an object" } { "right" "an object" } { "generic" "a generic word" } }
+{ $description "Throws a " { $link no-math-method } " error." }
+{ $error-description "Thrown by generic words using the " { $link math-combination } " method combination if there is no suitable method defined for the two inputs." } ;
+
+HELP: math-method
+{ $values { "word" "a generic word" } { "class1" "a class word" } { "class2" "a class word" } { "quot" "a quotation" } }
+{ $description "Generates a definition for " { $snippet "word" } " when the two inputs are instances of " { $snippet "class1" } " and " { $snippet "class2" } ", respectively." }
+{ $examples { $example "USE: generic.math" "\\ + fixnum float math-method ." "[ >r >float r> float+ ]" } } ;
+
+HELP: math-class
+{ $class-description "The class of subtypes of " { $link number } " which are not " { $link null } "." } ;
+
+HELP: math-combination
+{ $values { "word" "a generic word" } { "quot" "a quotation" } }
+{ $description "Generates a double-dispatching word definition. Only methods defined on numerical classes and " { $link object } " take effect in the math combination. Methods defined on numerical classes are guaranteed to have their two inputs upgraded to the highest priority type of the two."
+$nl
+"The math method combination is used for binary operators such as " { $link + } " and " { $link * } "."
+$nl
+"A method can only be added to a generic word using the math combination if the method specializes on one of the below classes, or a union defined over one or more of the below classes:"
+{ $code
+    "fixnum"
+    "bignum"
+    "ratio"
+    "float"
+    "complex"
+    "object"
+}
+"The math combination performs numerical upgrading as described in " { $link "number-protocol" } "." } ;
+
+HELP: math-generic
+{ $class-description "The class of generic words using " { $link math-combination } "." } ;
+
+HELP: last/first
+{ $values { "seq" "a sequence" } { "pair" "a two-element array" } }
+{ $description "Creates an array holding the first and last element of the sequence." } ;
diff --git a/core/generic/math/math.factor b/core/generic/math/math.factor
new file mode 100644 (file)
index 0000000..c61ce05
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic hashtables kernel kernel.private
+math namespaces sequences words quotations layouts combinators
+combinators.private classes definitions ;
+IN: generic.math
+
+PREDICATE: class math-class ( object -- ? )
+    dup null bootstrap-word eq? [
+        drop f
+    ] [
+        number bootstrap-word class<
+    ] if ;
+
+: last/first ( seq -- pair ) dup peek swap first 2array ;
+
+: math-precedence ( class -- n )
+    {
+        { [ dup class-empty? ] [ drop { -1 -1 } ] }
+        { [ dup math-class? ] [ types last/first ] }
+        { [ t ] [ drop { 100 100 } ] }
+    } cond ;
+    
+: math-class-max ( class class -- class )
+    [ [ math-precedence ] compare 0 > ] most ;
+
+: (math-upgrade) ( max class -- quot )
+    dupd = [
+        drop [ ]
+    ] [
+        "coercer" word-prop [ ] or
+    ] if ;
+
+: math-upgrade ( class1 class2 -- quot )
+    [ math-class-max ] 2keep
+    >r over r> (math-upgrade)
+    >r (math-upgrade) dup empty? [ 1 make-dip ] unless
+    r> append ;
+
+TUPLE: no-math-method left right generic ;
+
+: no-math-method ( left right generic -- * )
+    \ no-math-method construct-boa throw ;
+
+: applicable-method ( generic class -- quot )
+    over method method-def
+    [ ] [ [ no-math-method ] curry [ ] like ] ?if ;
+
+: object-method ( generic -- quot )
+    object bootstrap-word applicable-method ;
+
+: math-method ( word class1 class2 -- quot )
+    2dup and [
+        2dup math-upgrade >r
+        math-class-max over order min-class applicable-method
+        r> swap append
+    ] [
+        2drop object-method
+    ] if ;
+
+: math-vtable* ( picker max quot -- quot )
+    [
+        rot , \ tag ,
+        [ >r [ type>class ] map r> map % ] { } make ,
+        \ dispatch ,
+    ] [ ] make ; inline
+
+: math-vtable ( picker quot -- quot )
+    num-tags get swap math-vtable* ; inline
+
+TUPLE: math-combination ;
+
+M: math-combination perform-combination
+    drop
+    \ over [
+        dup math-class? [
+            \ dup [ >r 2dup r> math-method ] math-vtable
+        ] [
+            over object-method
+        ] if nip
+    ] math-vtable nip ;
+
+PREDICATE: generic math-generic ( word -- ? )
+    "combination" word-prop math-combination? ;
+
+M: math-generic definer drop \ MATH: f ;
diff --git a/core/generic/math/summary.txt b/core/generic/math/summary.txt
new file mode 100644 (file)
index 0000000..d92ddd2
--- /dev/null
@@ -0,0 +1 @@
+Math method combination used for arithmetic words
diff --git a/core/generic/methods.factor b/core/generic/methods.factor
deleted file mode 100644 (file)
index 68b5507..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: generic
-USING: arrays definitions errors hashtables help kernel
-sequences words namespaces ;
-
-PREDICATE: array method-spec
-    dup length 2 = [
-        first2 generic? >r class? r> and
-    ] [
-        drop f
-    ] if ;
-
-TUPLE: method loc def ;
-
-M: f method-def ;
-M: f method-loc ;
-M: quotation method-def ;
-M: quotation method-loc drop f ;
-
-: method ( class generic -- method/f )
-    "methods" word-prop hash ;
-
-: methods ( generic -- assoc )
-    "methods" word-prop hash>alist
-    [ [ first ] 2apply class-compare ] sort
-    [ first2 method-def 2array ] map ;
-
-: order ( generic -- seq )
-    "methods" word-prop hash-keys [ class-compare ] sort ;
-
-TUPLE: check-method class generic ;
-
-: check-method ( class generic -- class generic )
-    dup generic? [ <check-method> throw ] unless
-    over class? [ <check-method> throw ] unless ;
-
-: with-methods ( word quot -- )
-    swap [ "methods" word-prop swap call ] keep ?make-generic ;
-    inline
-
-: define-method ( method class generic -- )
-    >r bootstrap-word r> check-method
-    [ set-hash ] with-methods ;
-
-: implementors ( class -- seq )
-    all-words
-    [ generic? ] subset
-    [ "methods" word-prop hash-member? ] subset-with ;
-
-M: method-spec where
-    dup first2 method method-loc [ ] [ second where ] ?if ;
-
-M: method-spec subdefs drop f ;
-
-M: generic subdefs
-    dup "methods" word-prop hash-keys natural-sort
-    [ swap 2array ] map-with ;
-
-M: class subdefs
-    [
-        dup "constructor" word-prop [ , ] when*
-        dup implementors natural-sort [ 2array , ] each-with
-    ] { } make ;
-
-M: method-spec forget
-    first2 [ remove-hash ] with-methods ;
diff --git a/core/generic/methods.facts b/core/generic/methods.facts
deleted file mode 100644 (file)
index 2a59cf9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-IN: generic
-USING: help ;
-
-HELP: method-spec
-{ $class-description "The class of method specifiers, which are two-element arrays consisting of a class word followed by a generic word." }
-{ $examples { $code "{ fixnum + }" "{ editor draw-gadget* }" } } ;
-
-HELP: method
-{ $values { "class" "a class word" } { "generic" "a generic word" } { "method" "an instance of " { $link method } } }
-{ $description "Looks up a method definition." }
-{ $class-description "Instances of this class are methods. A method consists of a quotation together with a source location where it was defined." }
-{ $see-also method-def method-loc define-method POSTPONE: M: } ;
-
-HELP: <method> ( def loc -- method )
-{ $values { "def" "a quotation" } { "loc" "a file/line pair or " { $link f } } { "method" "a new method definition" } }
-{ $description "Creates a new  "{ $link method } " instance." } ;
-
-HELP: methods
-{ $values { "word" "a generic word" } { "assoc" "a sequence of pairs" } }
-{ $description "Outputs a sequence of pairs, where the first element of each pair is a class and the second element is the corresponding method quotation." } ;
-
-HELP: order
-{ $values { "word" "a generic word" } { "seq" "a sequence of classes" } }
-{ $description "Outputs a sequence of classes for which methods have been defined on this generic word. The sequence is sorted in method dispatch order." } ;
-
-HELP: check-method
-{ $values { "class" "a class word" } { "generic" "a generic word" } }
-{ $description "Asserts that " { $snippet "class" } " is a class word and " { $snippet "generic" } " is a generic word, throwing a " { $link check-method } " error if the assertion fails." }
-{ $error-description "Thrown if " { $link POSTPONE: M: } " or " { $link define-method } " is given an invalid class or generic word." } ;
-
-HELP: with-methods
-{ $values { "word" "a generic word" } { "quot" "a quotation with stack effect " { $snippet "( methods -- )" } } }
-{ $description "Applies a quotation to the generic word's methods hashtable, and regenerates the generic word's definition when the quotation returns." }
-$low-level-note ;
-
-HELP: define-method
-{ $values { "method" "an instance of " { $link method } } { "class" "a class word" } { "generic" "a generic word" } }
-{ $description "Defines a method. This is the runtime equivalent of " { $link POSTPONE: M: } "." }
-{ $see-also <method> } ;
-
-HELP: implementors
-{ $values { "class" "a class word" } { "seq" "a sequence of generic words" } }
-{ $description "Finds all generic words in the dictionary implementing methods for this class." } ;
diff --git a/core/generic/slots.factor b/core/generic/slots.factor
deleted file mode 100644 (file)
index 5734e95..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-
-IN: generic
-USING: arrays kernel kernel-internals math namespaces
-parser sequences strings words ;
-
-: define-typecheck ( class generic quot -- )
-    over define-generic -rot define-method ;
-
-: define-slot-word ( class slot word quot -- )
-    rot >fixnum add* define-typecheck ;
-
-: reader-effect ( -- effect ) 1 1 <effect> ; inline
-
-: define-reader ( class slot decl reader -- )
-    dup [
-        dup reader-effect "declared-effect" set-word-prop
-        [ slot ] rot dup object eq?
-        [ drop ] [ 1array [ declare ] swap add* append ] if
-        define-slot-word
-    ] [
-        2drop 2drop
-    ] if ;
-
-: writer-effect ( -- effect ) 2 0 <effect> ; inline
-
-: define-writer ( class slot writer -- )
-    dup [
-        dup writer-effect "declared-effect" set-word-prop
-        [ set-slot ] define-slot-word
-    ] [
-        3drop
-    ] if ;
-
-: define-slot ( class slot decl reader writer -- )
-    >r >r >r 2dup r> r> define-reader r> define-writer ;
-
-: intern-slots ( spec -- spec )
-    [ [ dup array? [ first2 create ] when ] map ] map ;
-
-: define-slots ( class spec -- )
-    [ first4 define-slot ] each-with ;
-
-: reader-word ( class name -- word )
-    >r word-name "-" r> 3append in get 2array ;
-
-: writer-word ( class name -- word )
-    [ swap "set-" % word-name % "-" % % ] "" make in get 2array ;
-
-: simple-slot ( class name -- )
-    2dup reader-word , writer-word , ;
-
-: simple-slots ( class slots base -- spec )
-    over length [ + ] map-with
-    [ [ , object , dupd simple-slot ] { } make ] 2map nip intern-slots ;
diff --git a/core/generic/slots.facts b/core/generic/slots.facts
deleted file mode 100644 (file)
index ca9c125..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-USING: generic help kernel-internals parser words ;
-
-HELP: define-typecheck
-{ $values { "class" "a class word" } { "generic" "a generic word" } { "quot" "a quotation" } }
-{ $description
-    "Defines a generic word with the " { $link standard-combination } " using dispatch position 0, and having one method on " { $snippet "class" } "."
-    $terpri
-    "This creates a definition analogous to the following code:"
-    { $code
-        "GENERIC: generic"
-        "M: class generic quot ;"
-    }
-    "It checks if the top of the stack is an instance of " { $snippet "class" } ", and if so, executes the quotation. Delegation is respected."
-}
-{ $notes "This word is used internally to wrap low-level code that does not do type-checking in safe user-visible words." } ;
-
-HELP: define-slot-word
-{ $values { "class" "a class word" } { "slot" "a positive integer" } { "word" "a new word" } { "quot" "a quotation" } }
-{ $description "Defines " { $snippet "word" } " to be a simple type-checking generic word that receives the slot number on the stack as a fixnum." }
-$low-level-note ;
-
-HELP: reader-effect
-{ $values { "effect" "an instance of " { $link effect } } }
-{ $description "The stack effect of slot reader words is " { $snippet "( obj -- value )" } "." } ;
-
-HELP: define-reader
-{ $values { "class" "a class word" } { "slot" "a positive integer" } { "decl" "a class word or " { $link f } } { "reader" "a word" } }
-{ $description "Defines a generic word " { $snippet "reader" } " to read a slot from instances of " { $snippet "class" } ". If " { $snippet "decl" } " is not " { $link f } ", then " { $link declare } " is applied to the slot value to declare that the value is an instance of a specific class." }
-$low-level-note ;
-
-HELP: define-writer
-{ $values { "class" "a class word" } { "slot" "a positive integer" } { "writer" "a word" } }
-{ $description "Defines a generic word " { $snippet "writer" } " to write a new value to a slot in instances of " { $snippet "class" } "." }
-$low-level-note ;
-
-HELP: define-slot
-{ $values { "class" "a class word" } { "slot" "a positive integer" } { "decl" "a class word or " { $link f } } { "reader" "a word" } { "writer" "a word" } }
-{ $description "Defines a pair of generic words, " { $snippet "reader" } " and " { $snippet "writer" } " for reading and writing a slot value in instances of " { $snippet "class" } "." }
-$low-level-note ;
-
-HELP: define-slots
-{ $values { "class" "a class word" } { "spec" "a sequence of triples" } }
-{ $description
-    "Defines a set of slot accessor/mutator words."
-    $terpri
-    "Each entry in the " { $snippet "spec" } " sequence is a three-element sequence with the following elements:"
-    { $list
-        "a slot number"
-        { "a reader word, or " { $link f } }
-        { "a writer word, or " { $link f } }
-    }
-    "If the reader or writer is " { $link f } ", the corresponding word is not defined."
-}
-$low-level-note ;
-
-HELP: simple-slots
-{ $values { "class" "a class word" } { "slots" "a sequence of strings" } { "base" "a slot number" } }
-{ $description "Constructs a slot specification for " { $link define-slots } " where each slot is named by an element of " { $snippet "slots" } " prefixed by the name of the class. Slots are numbered consecutively starting from " { $snippet "base" } ". Reader and writer words are defined in the current vocabulary, with the reader word having the same name as the slot, and the writer word name prefixed by " { $snippet "\"set-\"" } "." }
-{ $notes "This word is used by " { $link define-tuple } " and " { $link POSTPONE: TUPLE: } "." } ;
diff --git a/core/generic/standard-combination.factor b/core/generic/standard-combination.factor
deleted file mode 100644 (file)
index 78a1ad4..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays errors hashtables kernel kernel-internals
-math namespaces sequences vectors words ;
-IN: generic
-
-: picker ( dispatch# -- quot )
-    { [ dup ] [ over ] [ pick ] } nth ;
-
-: unpicker ( dispatch# -- quot )
-    { [ nip ] [ >r nip r> swap ] [ >r >r nip r> r> -rot ] } nth ;
-
-TUPLE: no-method object generic ;
-
-: no-method ( object generic -- * ) <no-method> throw ;
-
-: error-method ( dispatch# word -- method )
-    >r picker r> [ no-method ] curry append ;
-
-: empty-method ( dispatch# word -- method )
-    [
-        over picker % [ delegate dup ] %
-        over unpicker over add ,
-        [ drop ] -rot error-method append , \ if ,
-    ] [ ] make ;
-
-: class-predicates ( picker assoc -- assoc )
-    [
-        first2 >r >r picker r> "predicate" word-prop append
-        r> 2array
-    ] map-with ;
-
-: sort-methods ( assoc n -- vtable )
-    #! Input is a predicate -> method association.
-    #! n is vtable size (either num-types or num-tags).
-    [
-        type>class [ object bootstrap-word ] unless*
-        swap [ first classes-intersect? ] subset-with
-    ] map-with ;
-
-: (simplify-alist) ( class i assoc -- default assoc )
-    2dup length 1- = [
-        nth second [ ] rot drop
-    ] [
-        3dup >r 1+ r> nth first class< [
-            >r 1+ r> (simplify-alist)
-        ] [
-            [ nth second ] 2keep swap 1+ tail rot drop
-        ] if
-    ] if ;
-
-: simplify-alist ( class assoc -- default assoc )
-    0 swap (simplify-alist) ;
-
-: default-method ( dispatch# word -- pair )
-    empty-method object bootstrap-word swap 2array ;
-
-: methods* ( dispatch# word -- assoc )
-    #! Make a class->method association, together with a
-    #! default delegating method at the end.
-    dup methods -rot default-method add* ;
-
-: method-alist>quot ( dispatch# alist base-class -- quot )
-    bootstrap-word swap simplify-alist
-    swapd class-predicates alist>quot ;
-
-: small-generic ( dispatch# word -- def )
-    dupd methods* object method-alist>quot ;
-
-: build-type-vtable ( dispatch# alist-seq -- alist-seq )
-    dup length [
-        type>class
-        [ swap simplify-alist ] [ first second [ ] ] if*
-        >r over r> class-predicates alist>quot
-    ] 2map nip ;
-
-: <type-vtable> ( dispatch# word n -- vtable )
-    #! n is vtable size; either num-types or num-tags.
-    >r dupd methods* r> sort-methods build-type-vtable ;
-
-: type-generic ( dispatch# word n dispatcher -- quot )
-    [
-        >r pick picker % r> , <type-vtable> , \ dispatch ,
-    ] [ ] make ;
-
-: tag-generic? ( word -- ? )
-    #! If all the types we dispatch upon can be identified
-    #! based on tag alone, we change the dispatcher primitive
-    #! from 'type' to 'tag'.
-    generic-tags [ tag-mask < ] all? ;
-
-: small-generic? ( word -- ? ) generic-tags length 3 <= ;
-
-: standard-combination ( word dispatch# -- quot )
-    swap {
-        { [ dup tag-generic? ] [ num-tags \ tag type-generic ] }
-        { [ dup small-generic? ] [ small-generic ] }
-        { [ t ] [ num-types \ type type-generic ] }
-    } cond ;
-
-: define-generic ( word -- )
-    [ 0 standard-combination ] define-generic* ;
-
-PREDICATE: generic standard-generic
-    "combination" word-prop [ standard-combination ] tail? ;
diff --git a/core/generic/standard-combination.facts b/core/generic/standard-combination.facts
deleted file mode 100644 (file)
index 469d51f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-USING: generic help sequences ;
-
-HELP: no-method
-{ $values { "object" "an object" } { "generic" "a generic word" } }
-{ $description "Throws a " { $link no-method } " error." }
-{ $error-description "Thrown by the " { $snippet "generic" } " word to indicate it does not have a method for the class of " { $snippet "object" } "." } ;
-
-HELP: standard-combination
-{ $values { "word" "a generic word" } { "dispatch#" "a dispatch position" } { "quot" "a new quotation" } }
-{ $description
-    "Performs standard method combination."
-    $terpri
-    "Generic words using the standard method combination dispatch on the class of the object at the given stack position, where 0 is the top of the stack, 1 is the object underneath, and 2 is the next one under that. If no suitable method is defined on the class of the dispatch object, the generic word is called on the dispatch object's delegate. If the delegate is " { $link f } ", an exception is thrown."
-}
-{ $examples
-    "A generic word for append strings and characters to a sequence, dispatching on the object underneath the top of the stack:"
-    { $code
-        "G: build-string 1 standard-combination ;"
-        "M: string build-string swap nappend ;"
-        "M: integer build-string push ;"
-    }
-}
-{ $notes "The " { $link POSTPONE: GENERIC: } " parsing word defines generic words using the standard method combination with dispatch position 0." }
-{ $examples "Most generic words in the standard library use this method combination with a dispatch position of 0. A handful of combinators such as " { $link each } " dispatch on position 1, since position 0 (the top of the stack) is a quotation." }
-{ $see-also POSTPONE: GENERIC: define-generic POSTPONE: G: define-generic* } ;
-
-HELP: define-generic
-{ $values { "word" "a word" } }
-{ $description "Defines a generic word with the " { $link standard-combination } " method combination, and a dispatch position of 0." }
-{ $see-also POSTPONE: GENERIC: define-generic* } ;
diff --git a/core/generic/standard/authors.txt b/core/generic/standard/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/generic/standard/standard-docs.factor b/core/generic/standard/standard-docs.factor
new file mode 100644 (file)
index 0000000..820a027
--- /dev/null
@@ -0,0 +1,33 @@
+USING: generic help.markup help.syntax sequences
+generic.standard ;
+
+HELP: no-method
+{ $values { "object" "an object" } { "generic" "a generic word" } }
+{ $description "Throws a " { $link no-method } " error." }
+{ $error-description "Thrown by the " { $snippet "generic" } " word to indicate it does not have a method for the class of " { $snippet "object" } "." } ;
+
+HELP: standard-combination
+{ $class-description
+    "Performs standard method combination."
+    $nl
+    "Generic words using the standard method combination dispatch on the class of the object at the given stack position, where 0 is the top of the stack, 1 is the object underneath, and 2 is the next one under that. If no suitable method is defined on the class of the dispatch object, the generic word is called on the dispatch object's delegate. If the delegate is " { $link f } ", an exception is thrown."
+}
+{ $examples
+    "A generic word for append strings and characters to a sequence, dispatching on the object underneath the top of the stack:"
+    { $code
+        "G: build-string 1 standard-combination ;"
+        "M: string build-string swap push-all ;"
+        "M: integer build-string push ;"
+    }
+} ;
+
+HELP: hook-combination
+{ $class-description
+    "Performs hook method combination . See " { $link POSTPONE: HOOK: } "."
+} ;
+
+HELP: define-simple-generic
+{ $values { "word" "a word" } }
+{ $description "Defines a generic word with the " { $link standard-combination } " method combination and a dispatch position of 0." } ;
+
+{ standard-combination hook-combination } related-words
diff --git a/core/generic/standard/standard.factor b/core/generic/standard/standard.factor
new file mode 100644 (file)
index 0000000..75385b1
--- /dev/null
@@ -0,0 +1,184 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs kernel kernel.private slots.private math
+namespaces sequences vectors words quotations definitions
+hashtables layouts combinators combinators.private generic
+classes classes.private ;
+IN: generic.standard
+
+TUPLE: standard-combination # ;
+
+C: <standard-combination> standard-combination
+
+SYMBOL: (dispatch#)
+
+: (picker) ( n -- quot )
+    {
+        { 0 [ [ dup ] ] }
+        { 1 [ [ over ] ] }
+        { 2 [ [ pick ] ] }
+        [ 1- (picker) [ >r ] swap [ r> swap ] 3append ]
+    } case ;
+
+: picker ( -- quot ) \ (dispatch#) get (picker) ;
+
+: unpickers { [ nip ] [ >r nip r> swap ] [ >r >r nip r> r> -rot ] } ; inline
+
+: unpicker ( -- quot ) \ (dispatch#) get unpickers nth ;
+
+TUPLE: no-method object generic ;
+
+: no-method ( object generic -- * )
+    \ no-method construct-boa throw ;
+
+: error-method ( word -- method )
+    picker swap [ no-method ] curry append ;
+
+: empty-method ( word -- method )
+    [
+        picker % [ delegate dup ] %
+        unpicker over add ,
+        error-method \ drop add* , \ if ,
+    ] [ ] make ;
+
+: class-predicates ( assoc -- assoc )
+    [
+        >r >r picker r> "predicate" word-prop append r>
+    ] assoc-map ;
+
+: (simplify-alist) ( class i assoc -- default assoc )
+    2dup length 1- = [
+        nth second { } rot drop
+    ] [
+        3dup >r 1+ r> nth first class< [
+            >r 1+ r> (simplify-alist)
+        ] [
+            [ nth second ] 2keep swap 1+ tail rot drop
+        ] if
+    ] if ;
+
+: simplify-alist ( class assoc -- default assoc )
+    dup empty? [
+        2drop [ "Unreachable" throw ] { }
+    ] [
+        0 swap (simplify-alist)
+    ] if ;
+
+: default-method ( word -- pair )
+    empty-method object bootstrap-word swap 2array ;
+
+: method-alist>quot ( alist base-class -- quot )
+    bootstrap-word swap simplify-alist
+    class-predicates alist>quot ;
+
+: small-generic ( methods -- def )
+    object method-alist>quot ;
+
+: hash-methods ( methods -- buckets )
+    V{ } clone [
+        tuple bootstrap-word over class< [
+            drop t
+        ] [
+            class-hashes
+        ] if
+    ] distribute-buckets ;
+
+: big-generic ( methods -- quot )
+    hash-methods [ small-generic ] map
+    hash-dispatch-quot picker [ class-hash ] rot 3append ;
+
+: vtable-class ( n -- class )
+    type>class [ hi-tag bootstrap-word ] unless* ;
+
+: group-methods ( assoc -- vtable )
+    #! Input is a predicate -> method association.
+    #! n is vtable size (either num-types or num-tags).
+    num-tags get [
+        vtable-class
+        [ swap first classes-intersect? ] curry subset
+    ] curry* map ;
+
+: build-type-vtable ( alist-seq -- alist-seq )
+    dup length [
+        vtable-class swap simplify-alist
+        class-predicates alist>quot
+    ] 2map ;
+
+: tag-generic ( methods -- quot )
+    [
+        picker %
+        \ tag ,
+        group-methods build-type-vtable ,
+        \ dispatch ,
+    ] [ ] make ;
+
+: flatten-method ( class body -- )
+    over members pick object bootstrap-word eq? not and [
+        >r members r> [ flatten-method ] curry each
+    ] [
+        swap set
+    ] if ;
+
+: flatten-methods ( methods -- newmethods )
+    [ [ flatten-method ] assoc-each ] V{ } make-assoc ;
+
+: dispatched-types ( methods -- seq )
+    keys object bootstrap-word swap remove prune ;
+
+: single-combination ( methods -- quot )
+    dup length 4 <= [
+        small-generic
+    ] [
+        flatten-methods
+        dup dispatched-types [ number class< ] all?
+        [ tag-generic ] [ big-generic ] if
+    ] if ;
+
+: standard-methods ( word -- alist )
+    dup methods swap default-method add* ;
+
+M: standard-combination perform-combination
+    standard-combination-# (dispatch#) [
+        standard-methods single-combination
+    ] with-variable ;
+
+: default-hook-method ( word -- pair )
+    error-method object bootstrap-word swap 2array ;
+
+: hook-methods ( word -- methods )
+    dup methods [ [ drop ] swap append ] assoc-map
+    swap default-hook-method add* ;
+
+TUPLE: hook-combination var ;
+
+C: <hook-combination> hook-combination
+
+M: hook-combination perform-combination
+    0 (dispatch#) [
+        [
+            hook-combination-var [ get ] curry %
+            hook-methods single-combination %
+        ] [ ] make
+    ] with-variable ;
+
+: define-simple-generic ( word -- )
+    T{ standard-combination f 0 } define-generic ;
+
+PREDICATE: generic standard-generic
+    "combination" word-prop standard-combination? ;
+
+PREDICATE: standard-generic simple-generic
+    "combination" word-prop standard-combination-# zero? ;
+
+PREDICATE: generic hook-generic
+    "combination" word-prop hook-combination? ;
+
+GENERIC: dispatch# ( word -- n )
+
+M: word dispatch# "combination" word-prop dispatch# ;
+
+M: standard-combination dispatch# standard-combination-# ;
+
+M: hook-combination dispatch# drop 0 ;
+
+M: simple-generic definer drop \ GENERIC: f ;
diff --git a/core/generic/standard/summary.txt b/core/generic/standard/summary.txt
new file mode 100644 (file)
index 0000000..5e731c6
--- /dev/null
@@ -0,0 +1 @@
+Standard method combination used for most generic words
diff --git a/core/generic/summary.txt b/core/generic/summary.txt
new file mode 100644 (file)
index 0000000..2e2fae0
--- /dev/null
@@ -0,0 +1 @@
+Generic word implementation
diff --git a/core/generic/tags.txt b/core/generic/tags.txt
new file mode 100644 (file)
index 0000000..abf53a4
--- /dev/null
@@ -0,0 +1 @@
+reflection
diff --git a/core/generic/tuple.factor b/core/generic/tuple.factor
deleted file mode 100644 (file)
index 63027e4..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: generic
-USING: arrays definitions errors hashtables kernel
-kernel-internals math namespaces parser sequences
-sequences-internals strings vectors words ;
-
-IN: kernel-internals
-
-: tuple= ( tuple1 tuple2 -- ? )
-    2dup [ array-capacity ] 2apply number= [
-        dup array-capacity
-        [ 2dup swap array-nth >r pick array-nth r> = ] all? 2nip
-    ] [
-        2drop f
-    ] if ;
-
-: <tuple> ( class n -- tuple )
-    f <array> [ 2 set-slot ] keep tuple-type become ;
-
-IN: generic
-
-: class ( object -- class )
-    dup tuple? [ 2 slot ] [ type type>class ] if ; inline
-
-: tuple-predicate ( class -- )
-    dup predicate-word [
-        [ dup tuple? ] %
-        [ [ 2 slot ] % over literalize , \ eq? , ] [ ] make ,
-        [ [ drop f ] if ] %
-    ] [ ] make define-predicate ;
-
-: forget-tuple ( class -- )
-    dup forget "predicate" word-prop first [ forget ] when* ;
-
-: tuple-size ( class -- size ) "tuple-size" word-prop ;
-
-: check-shape ( class slots -- )
-    >r in get lookup dup [
-        dup tuple-size r> length 2 + =
-        [ drop ] [ forget-tuple ] if
-    ] [
-        r> 2drop
-    ] if ;
-
-: delegate-slots { { 3 object delegate set-delegate } } ;
-
-: define-tuple-slots ( class slots -- )
-    2dup "slot-names" set-word-prop
-    2dup length 2 + "tuple-size" set-word-prop
-    dupd 4 simple-slots
-    2dup delegate-slots swap append "slots" set-word-prop
-    define-slots ;
-
-PREDICATE: class tuple-class tuple-size >boolean ;
-
-TUPLE: check-tuple class ;
-: check-tuple ( class -- class )
-    dup tuple-class? [ <check-tuple> throw ] unless ;
-
-: define-constructor ( word class def -- )
-    swap check-tuple [
-        dup literalize ,
-        tuple-size ,
-        \ <tuple> , %
-    ] [ ] make define-compound ;
-
-: default-constructor ( class -- )
-    dup create-constructor
-    2dup "constructor" set-word-prop
-    dup reset-generic
-    swap dup "slots" word-prop unclip drop <reversed>
-    [ [ tuck ] swap peek add ] map concat >quotation
-    define-constructor ;
-
-: define-tuple ( class slots -- )
-    2dup check-shape
-    >r create-in
-    dup intern-symbol
-    dup tuple-predicate
-    dup \ tuple bootstrap-word "superclass" set-word-prop
-    dup define-class
-    dup r> define-tuple-slots
-    default-constructor ;
-
-M: tuple clone
-    (clone) dup delegate clone over set-delegate ;
-
-M: tuple hashcode 2 slot hashcode ;
-
-M: tuple equal?
-    over tuple? [ tuple= ] [ 2drop f ] if ;
-
-: (delegates) ( obj -- )
-    [ dup , delegate (delegates) ] when* ;
-
-: delegates ( obj -- seq ) [ (delegates) ] { } make ;
-
-: is? ( obj quot -- ? ) >r delegates r> contains? ; inline
-
-: >tuple ( seq -- tuple )
-    >vector dup first tuple-size over set-length
-    >array tuple-type become ;
-
-GENERIC: tuple>array ( tuple -- array )
-
-M: tuple tuple>array (clone) array-type become ;
-
-: tuple-slots ( tuple -- seq ) tuple>array 2 tail ;
-
-! Definition protocol
-M: tuple-class forget
-    dup "constructor" word-prop forget forget-class ;
diff --git a/core/generic/tuple.facts b/core/generic/tuple.facts
deleted file mode 100644 (file)
index 680582e..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-USING: generic help kernel kernel-internals ;
-
-HELP: tuple=
-{ $values { "tuple1" "a tuple" } { "tuple2" "a tuple" } }
-{ $description "Low-level tuple equality test. User code should use " { $link = } " instead." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not do any type checking. Passing values which are not tuples can result in memory corruption." } ;
-
-HELP: tuple
-{ $class-description "The class of tuples. This class is further partitioned into disjoint subclasses; each tuple shape defined by " { $link POSTPONE: TUPLE: } " is a new class."
-$terpri
-"Tuple classes have additional word properties:"
-{ $list
-    { { $snippet "\"slot-names\"" } " - a sequence of strings naming the tuple's slots" }
-    { { $snippet "\"tuple-size\"" } " - the number of slots" }
-} } ;
-
-HELP: class
-{ $values { "object" "an object" } { "class" "a class word" } }
-{ $description "Outputs an object's canonical class. While an object may be an instance of more than one class, the canonical class is either its built-in class, or if the object is a tuple, its tuple class." }
-{ $examples { $example "1.0 class ." "float" } { $example "TUPLE: point x y z ;\nT{ point f 1 2 3 } class ." "point" } } ;
-
-HELP: tuple-predicate
-{ $values { "class" "a tuple class word" } }
-{ $description "Defines a predicate word that tests if the top of the stack is an instance of " { $snippet "class" } ". This will only work if " { $snippet "class" } " is a tuple class." }
-$low-level-note ;
-
-HELP: check-shape
-{ $values { "class" "a tuple class word" } { "slots" "a sequence of strings" } }
-{ $description "If the new slot list does not have the same length as the current slot list for " { $snippet "class" } ", removes the class word from the dictionary. This allows a new class to be defined, and instances of the old class and the new class can co-exist, with new instances having a different number of slots. This prevents memory corruption if old accessors are called on new instances, or vice versa."
-$terpri
-"If " { $snippet "class" } " is not a tuple class word, or if no slots are being added or removed, this word does nothing. In this case, it is safe to redefine the class, and have the same set of accessor words operate on old and new instances." }
-$low-level-note ;
-
-HELP: tuple-slots
-{ $values { "class" "a tuple class word" } { "slots" "a sequence of strings" } }
-{ $description "Defines slot accessor and mutator words for the tuple." }
-$low-level-note ;
-
-HELP: tuple-class
-{ $class-description "The class of tuple class words." }
-{ $examples { $example "TUPLE: name title first last ;\nname tuple-class? ." "t" } } ;
-
-HELP: define-constructor
-{ $values { "word" "a constructor word" } { "class" "a tuple class word" } { "def" "a quotation" } }
-{ $description "Define a constructor word for a tuple class. The constructor definition receives a new instance of the class on the stack, with all slots initially set to " { $link f } "." }
-{ $see-also POSTPONE: C: } ;
-
-HELP: check-tuple
-{ $values { "class" "a class" } }
-{ $description "Throws a " { $link check-tuple } " error if " { $snippet "word" } " is not a tuple class word." }
-{ $error-description "Thrown if " { $link define-constructor } " or " { $link POSTPONE: C: } " is called with a word which does not name a tuple class. Only tuple classes can have user-defined constructors." } ;
-
-HELP: default-constructor
-{ $values { "class" "a tuple class word" } }
-{ $description "Defines the default constructor for a tuple class. The default constructor fills slot values in from the stack." }
-{ $examples { $example "TUPLE: account type balance ;\n\"savings\" 100 <account> ." "T{ account f \"savings\" 100 }" } } ;
-
-HELP: define-tuple
-{ $values { "class" "a new word" } { "slots" "a sequence of strings" } }
-{ $description "Defines a tuple class with slots named by " { $snippet "slots" } "." }
-{ $see-also POSTPONE: TUPLE: } ;
-
-HELP: delegates
-{ $values { "obj" "an object" } { "seq" "a sequence" } }
-{ $description "Outputs the delegation chain of an object. The first element of " { $snippet "seq" } " is " { $snippet "obj" } " itself. If " { $snippet "obj" } " is " { $link f } ", an empty sequence is output." } ;
-
-HELP: is?
-{ $values { "obj" "an object" } { "quot" "a quotation with stack effect " { $snippet "( obj -- ? )" } } { "?" "a boolean" } }
-{ $description "Tests if the object or one of its delegates satisfies the predicate quotation."
-$terpri
-"Class membership test predicates only test if an object is a direct instance of that class. Sometimes, you need to check delegates, since this gives a clearer picture of what operations the object supports." } ;
-
-HELP: >tuple
-{ $values { "seq" "a sequence" } { "tuple" "a new tuple" } }
-{ $description "Creates a tuple with slot values taken from a sequence. The first element of the sequence must be a tuple class word, the second a delegate, and the remainder the declared slots."
-$terpri
-"If the sequence has too many elements, they are ignored, and if it has too few, the remaining slots in the tuple are set to " { $link f } "." }
-{ $errors "Throws an error if the first element of the sequence is not a tuple class word." } ;
-
-HELP: tuple>array ( tuple -- array )
-{ $values { "tuple" "a tuple" } { "array" "a new array" } }
-{ $description "Outputs an array having the tuple's slots as elements. The first element is the tuple class word and the second is the delegate; the remainder are declared slots." } ;
-
-HELP: <tuple>
-{ $values { "class" "a class word" } { "n" "a non-negative integer" } { "tuple" "a new tuple" } }
-{ $description "Low-level tuple constructor. User code should never call this directly, and instead use the constructor word which is defined for each tuple. See " { $link "tuples" } "." } ;
diff --git a/core/graphs/authors.txt b/core/graphs/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/graphs/graphs-docs.factor b/core/graphs/graphs-docs.factor
new file mode 100644 (file)
index 0000000..1e4350d
--- /dev/null
@@ -0,0 +1,35 @@
+IN: graphs
+USING: help.markup help.syntax kernel assocs hashtables ;
+
+ARTICLE: "graphs" "Directed graph utilities"
+"Words for treating associative mappings as directed graphs can be found in the " { $vocab-link "graphs" } " vocabulary. A directed graph is represented as an assoc mapping each vertex to a set of edges entering that vertex, where the set is itself an assoc, with equal keys and values."
+$nl
+"To create a new graph, just create an assoc, for example by calling " { $link <hashtable> } ". To add vertices and edges to a graph:"
+{ $subsection add-vertex }
+"To remove vertices from the graph:"
+{ $subsection remove-vertex }
+"Since graphs are represented as assocs, they can be cleared out by calling " { $link clear-assoc } "."
+$nl
+"You can perform queries on the graph:"
+{ $subsection closure }
+"Directed graphs are used to maintain cross-referencing information for " { $link "definitions" } "." ;
+
+ABOUT: "graphs"
+
+HELP: graph
+{ $var-description "Temporary variable used by various graph words." } ;
+
+HELP: add-vertex
+{ $values { "vertex" object } { "edges" "a sequence" } { "graph" "an assoc mapping vertices to sequences of edges" } }
+{ $description "Adds a vertex to a directed graph, using the " { $snippet "edges" } " quotation to generate a sequence of edges leaving the vertex." }
+{ $side-effects "graph" } ;
+
+HELP: remove-vertex
+{ $values { "vertex" object } { "edges" "a sequence" } { "graph" "an assoc mapping vertices to sequences of edges" } }
+{ $description "Removes a vertex from a graph, using the quotation to generate a sequence of edges leaving the vertex." } 
+{ $notes "The " { $snippet "edges" } " sequence must equal the value passed to " { $link add-vertex } ", otherwise some vertices of the graph may continue to refer to the removed vertex." }
+{ $side-effects "graph" } ;
+
+HELP: closure
+{ $values { "obj" object } { "quot" "a a quotation with stack effect " { $snippet "( obj -- assoc )" } } { "assoc" "a new assoc" } }
+{ $description "Outputs a set of all vertices reachable from " { $snippet "vertex" } " via edges given by the quotation. The set always includes " { $snippet "vertex" } "." } ;
diff --git a/core/graphs/graphs-tests.factor b/core/graphs/graphs-tests.factor
new file mode 100644 (file)
index 0000000..c68ecca
--- /dev/null
@@ -0,0 +1,18 @@
+USING: graphs tools.test namespaces kernel sorting assocs ;
+
+H{ } "g" set
+{ 1 2 3 } "v" set
+
+[ ] [ "v" dup get "g" get add-vertex ] unit-test
+
+[ { "v" } ] [ 1 "g" get at keys ] unit-test
+
+H{
+    { 1 H{ { 1 1 } { 2 2 } } }
+    { 2 H{ { 3 3 } { 4 4 } } }
+    { 4 H{ { 4 4 } { 5 5 } } }
+} "g" set
+
+[ { 2 3 4 5 } ] [
+    2 [ "g" get at ] closure keys natural-sort 
+] unit-test
diff --git a/core/graphs/graphs.factor b/core/graphs/graphs.factor
new file mode 100644 (file)
index 0000000..1088c75
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs kernel namespaces sequences ;
+IN: graphs
+
+SYMBOL: graph
+
+: if-graph ( vertex edges graph quot -- )
+    over
+    [ graph swap with-variable ]
+    [ 2drop 2drop ] if ; inline
+
+: nest ( key -- hash )
+    graph get [ drop H{ } clone ] cache ;
+
+: add-vertex ( vertex edges graph -- )
+    [ [ dupd nest set-at ] curry* each ] if-graph ; inline
+
+: remove-vertex ( vertex edges graph -- )
+    [ [ graph get at delete-at ] curry* each ] if-graph ; inline
+
+SYMBOL: previous
+
+: (closure) ( obj quot -- )
+    over previous get key? [
+        2drop
+    ] [
+        over dup previous get set-at
+        dup slip
+        [ nip (closure) ] curry assoc-each
+    ] if ; inline
+
+: closure ( obj quot -- assoc )
+    H{ } clone [
+        previous [ (closure) ] with-variable
+    ] keep ; inline
diff --git a/core/graphs/summary.txt b/core/graphs/summary.txt
new file mode 100644 (file)
index 0000000..aced099
--- /dev/null
@@ -0,0 +1 @@
+Directed graphs
diff --git a/core/graphs/tags.txt b/core/graphs/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/growable/authors.txt b/core/growable/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/growable/growable-docs.factor b/core/growable/growable-docs.factor
new file mode 100644 (file)
index 0000000..0311397
--- /dev/null
@@ -0,0 +1,48 @@
+USING: help.markup help.syntax kernel sequences
+sequences.private ;
+IN: growable
+
+ARTICLE: "growable" "Resizable sequence implementation"
+"Resizable sequences are implementing by having a wrapper object hold a reference to an underlying sequence, together with a fill pointer indicating how many elements of the underlying sequence are occupied. When the fill pointer exceeds the underlying sequence capacity, the underlying sequence grows."
+$nl
+"There is a resizable sequence mixin:"
+{ $subsection growable }
+"This mixin implements the sequence protocol in terms of a growable protocol:"
+{ $subsection underlying }
+{ $subsection set-underlying }
+{ $subsection set-fill }
+"The underlying sequence must implement a generic word:"
+{ $subsection resize }
+{ $link "vectors" } " and " { $link "sbufs" } " are implemented using the resizable sequence facility." ;
+
+ABOUT: "growable"
+
+HELP: set-fill
+{ $values { "n" "a new fill pointer" } { "seq" "a resizable sequence" } }
+{ $contract "Sets the fill pointer (number of occupied elements in the underlying storage) of a resizable sequence." }
+{ $side-effects "seq" }
+{ $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it is not safe. Changing the fill pointer to a negative value, or a value higher than the underlying sequence length can lead to memory corruption. User code should use " { $link set-length } " instead." } ;
+
+HELP: underlying
+{ $values { "seq" "a resizable sequence" } { "underlying" "the underlying sequence" } }
+{ $contract "Outputs the underlying storage of a resizable sequence." } ;
+
+HELP: set-underlying
+{ $values { "underlying" "a sequence" } { "seq" "a resizable sequence" } }
+{ $contract "Modifies the underlying storage of a resizable sequence." }
+{ $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it is not safe. Setting an underlying sequence shorter than the fill pointer can lead to memory corruption." } ;
+
+HELP: capacity
+{ $values { "seq" "a vector or string buffer" } { "n" "the capacity of the sequence" } }
+{ $description "Outputs the number of elements the sequence can hold without growing." } ;
+
+HELP: new-size
+{ $values { "old" "a positive integer" } { "new" "a positive integer" } }
+{ $description "Computes the new size of a resizable sequence." } ;
+
+HELP: ensure
+{ $values { "n" "a positive integer" } { "seq" "a resizable sequence" } }
+{ $description "If " { $snippet "n" } " is less than the length of the sequence, does nothing. Otherwise, if " { $snippet "n" } " also exceeds the capacity of the underlying storage, the underlying storage is grown, and the fill pointer is reset. Finally, if " { $snippet "n" } " is greater than or equal to the length but less than the capacity of the underlying storage, the fill pointer is moved and nothing else is done."
+$nl
+"This word is used in the implementation of the " { $link set-nth } " generic for sequences supporting the resizable sequence protocol (see " { $link "growable" } ")."
+} ;
diff --git a/core/growable/growable-tests.factor b/core/growable/growable-tests.factor
new file mode 100644 (file)
index 0000000..3ef1f4e
--- /dev/null
@@ -0,0 +1,26 @@
+USING: math sequences classes growable tools.test kernel
+layouts ;
+IN: temporary
+
+! erg found this one
+[ fixnum ] [
+    2 >bignum V{ } [ set-length ] keep length class
+] unit-test
+
+! overflow bugs
+[ "hi" most-positive-fixnum 2 * 2 + V{ } clone set-nth ]
+unit-test-fails
+
+[ most-positive-fixnum 2 * 2 + { 1 } clone nth ]
+unit-test-fails
+
+[ most-positive-fixnum 2 * 2 + V{ } clone lengthen ]
+unit-test-fails
+
+[ most-positive-fixnum 2 * 2 + V{ } clone set-length ]
+unit-test-fails
+
+[ ] [
+    10 V{ } [ set-length ] keep
+    1/2 swap set-length
+] unit-test
diff --git a/core/growable/growable.factor b/core/growable/growable.factor
new file mode 100644 (file)
index 0000000..d660610
--- /dev/null
@@ -0,0 +1,63 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+
+! Some low-level code used by vectors and string buffers.
+USING: kernel kernel.private math math.private
+sequences sequences.private ;
+IN: growable
+
+MIXIN: growable
+GENERIC: underlying ( seq -- underlying )
+GENERIC: set-underlying ( underlying seq -- )
+GENERIC: set-fill ( n seq -- )
+
+M: growable nth-unsafe underlying nth-unsafe ;
+
+M: growable set-nth-unsafe underlying set-nth-unsafe ;
+
+: capacity ( seq -- n ) underlying length ; inline
+
+: expand ( len seq -- )
+    [ underlying resize ] keep set-underlying ; inline
+
+: contract ( len seq -- )
+    [ length ] keep
+    [ 0 -rot set-nth-unsafe ] curry
+    (each-integer) ; inline
+
+: growable-check ( n seq -- n seq )
+    over 0 < [ bounds-error ] when ; inline
+
+M: growable set-length ( n seq -- )
+    growable-check
+    2dup length < [
+        2dup contract
+    ] [
+        2dup capacity > [ 2dup expand ] when
+    ] if
+    >r >fixnum r> set-fill ;
+
+: new-size ( old -- new ) 1+ 3 * ; inline
+
+: ensure ( n seq -- n seq )
+    growable-check
+    2dup length >= [
+        2dup capacity >= [ over new-size over expand ] when
+        >r >fixnum r>
+        2dup >r 1 fixnum+fast r> set-fill
+    ] [
+        >r >fixnum r>
+    ] if ; inline
+
+M: growable set-nth ensure set-nth-unsafe ;
+
+M: growable clone ( seq -- newseq )
+    (clone) dup underlying clone over set-underlying ;
+
+M: growable lengthen ( n seq -- )
+    2dup length > [
+        2dup capacity > [ over new-size over expand ] when
+        2dup >r >fixnum r> set-fill
+    ] when 2drop ;
+
+INSTANCE: growable sequence
diff --git a/core/growable/summary.txt b/core/growable/summary.txt
new file mode 100644 (file)
index 0000000..150efdb
--- /dev/null
@@ -0,0 +1 @@
+Low-level implementation of vectors and string buffers
diff --git a/core/growable/tags.txt b/core/growable/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/handbook/alien.facts b/core/handbook/alien.facts
deleted file mode 100644 (file)
index de00358..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-IN: alien
-USING: arrays errors help libc math words definitions
-kernel-internals ;
-
-ARTICLE: "c-types-numeric" "Integer and floating point C types"
-"The following numerical types are available; a " { $snippet "u" } " prefix denotes an unsigned type:"
-{ $table
-    { "C type" "Notes" }
-    { { $snippet "char" } "always 1 byte" }
-    { { $snippet "uchar" } { } }
-    { { $snippet "short" } "always 2 bytes" }
-    { { $snippet "ushort" } { } }
-    { { $snippet "int" } "always 4 bytes" }
-    { { $snippet "uint" } { } }
-    { { $snippet "long" } { "same size as CPU word size and " { $snippet "void*" } ", except on 64-bit Windows, where it is 4 bytes" } }
-    { { $snippet "ulong" } { } }
-    { { $snippet "longlong" } "always 8 bytes" }
-    { { $snippet "ulonglong" } { } }
-    { { $snippet "float" } { } }
-    { { $snippet "double" } { "same format as " { $link float } " objects" } }
-}
-"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: "aliens" "Alien addresses"
-"Instances of the " { $link alien } " class represent pointers to C data outside the Factor heap:"
-{ $subsection <alien> }
-{ $subsection <displaced-alien> }
-{ $subsection alien-address }
-{ $subsection expired? }
-"Anywhere that a " { $link alien } " instance is accepted, the " { $link f } " singleton may be passed in to denote a null pointer."
-$terpri
-"C " { $snippet "void*" } " values returned by functions are wrapped inside fresh " { $link alien } " objects." ;
-
-ARTICLE: "byte-arrays" "Byte arrays"
-"Instances of the " { $link byte-array } " class store arbitrary binary data which can be passed to C functions."
-$terpri
-"Byte arrays can be allocated directly with a byte count:"
-{ $subsection <byte-array> }
-"However in most cases, instead of computing a size in bytes directly, it is easier to use a higher-level word which expects C type and outputs a byte array large enough to hold that type:"
-{ $subsection <c-object> }
-{ $warning
-"The Factor garbage collector can move byte arrays around, and it is only safe to pass byte arrays to C functions if the function does not store a pointer to the byte array in some global structure, or retain it in any way after returning."
-$terpri
-"Long-lived data for use by C libraries can be allocated manually, just as when programming in C. See " { $link "malloc" } "." } ;
-
-ARTICLE: "malloc" "Manual memory management"
-"Sometimes data passed to C functions must be allocated at a fixed address, and so garbage collector managed byte arrays cannot be used. See the warning at the bottom of " { $link "byte-arrays" } " for a description of when this is the case."
-$terpri
-"Allocating a C datum with a fixed address:"
-{ $subsection <malloc-object> }
-"There is a set of words in the " { $vocab-link "libc" } " vocabulary which directly call C standard library memory management functions:"
-{ $subsection malloc }
-{ $subsection calloc }
-{ $subsection realloc }
-"The return value of the above three words must always be checked for a memory allocation failure:"
-{ $subsection check-ptr }
-"You must always free pointers returned by any of the above words when the block of memory is no longer in use:"
-{ $subsection free }
-"You can unsafely copy a range of bytes from one memory location to another:"
-{ $subsection memcpy }
-"A wrapper for temporarily allocating a block of memory:"
-{ $subsection with-malloc } ;
-
-ARTICLE: "c-strings" "C strings"
-"The C library interface defines two types of C strings:"
-{ $table
-    { "C type" "Notes" }
-    { { $snippet "char*" } "8-bit per character null-terminated ASCII" }
-    { { $snippet "ushort*" } "16-bit per character null-terminated UTF16" }
-}
-"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. 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."
-"Sometimes a C function has a parameter type of " { $snippet "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:"
-{ $subsection string>char-alien }
-{ $subsection string>u16-alien }
-{ $subsection <malloc-string> }
-"The first two allocate " { $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:"
-{ $subsection free }
-"Finally, a set of words can be used to read and write " { $snippet "char*" } " and " { $snippet "ushort*" } " strings at arbitrary addresses:"
-{ $subsection alien>char-string }
-{ $subsection alien>u16-string }
-{ $subsection memory>string }
-{ $subsection string>memory } ;
-
-ARTICLE: "c-structs" "C structure types"
-"A " { $snippet "struct" } " in C is essentially a block of memory with the value of each structure field stored at a fixed offset from the start of the block. The C library interface provides some utilities to define words which read and write structure fields given a base address."
-{ $subsection POSTPONE: BEGIN-STRUCT: }
-{ $subsection POSTPONE: FIELD: }
-{ $subsection POSTPONE: END-STRUCT }
-"Great care must be taken when working with C structures since no type or bounds checking is possible."
-$terpri
-"An example:"
-{ $code
-    "BEGIN-STRUCT: surface"
-    "    FIELD: uint    flags"
-    "    FIELD: format* format"
-    "    FIELD: int     w"
-    "    FIELD: int     h"
-    "    FIELD: ushort  pitch"
-    "    FIELD: void*   pixels"
-    "    FIELD: int     offset"
-    "    FIELD: void*   hwdata"
-    "    FIELD: short   clip-x"
-    "    FIELD: short   clip-y"
-    "    FIELD: ushort  clip-w"
-    "    FIELD: ushort  clip-h"
-    "    FIELD: uint    unused1"
-    "    FIELD: uint    locked"
-    "    FIELD: int     map"
-    "    FIELD: uint    format_version"
-    "    FIELD: int     refcount"
-    "END-STRUCT"
-} ;
-
-ARTICLE: "c-unions" "C unions"
-"A " { $snippet "union" } " in C defines a type large enough to hold its largest member. This is usually used to allocate a block of memory which can hold one of several types of values."
-{ $subsection POSTPONE: C-UNION: } ;
-
-ARTICLE: "c-out-params" "Output parameters in C"
-"A frequently-occurring idiom in C code is the \"out parameter\". If a C function returns more than one value, the caller passes pointers of the correct type, and the C function writes its return values to those locations."
-$terpri
-"Each numerical C type, together with " { $snippet "void*" } ", has an associated " { $emphasis "out parameter constructor" } " word which takes a Factor object as input, constructs a byte array of the correct size, and converts the Factor object to a C value stored into the byte array:"
-{ $subsection <char> }
-{ $subsection <uchar> }
-{ $subsection <short> }
-{ $subsection <ushort> }
-{ $subsection <int> }
-{ $subsection <uint> }
-{ $subsection <long> }
-{ $subsection <ulong> }
-{ $subsection <longlong> }
-{ $subsection <ulonglong> }
-{ $subsection <float> }
-{ $subsection <double> }
-{ $subsection <void*> }
-"You call the out parameter constructor with the required initial value, then pass the byte array to the C function, which receives a pointer to the start of the byte array's data area. The C function then returns, leaving the result in the byte array; you read it back using the next set of words:"
-{ $subsection *char }
-{ $subsection *uchar }
-{ $subsection *short }
-{ $subsection *ushort }
-{ $subsection *int }
-{ $subsection *uint }
-{ $subsection *long }
-{ $subsection *ulong }
-{ $subsection *longlong }
-{ $subsection *ulonglong }
-{ $subsection *float }
-{ $subsection *double }
-{ $subsection *void* }
-{ $subsection *char* }
-{ $subsection *ushort* }
-"Note that while structure and union types do not get these words defined for them, there is no loss of generality since " { $link <void*> } " and " { $link *void* } " may be used." ;
-
-ARTICLE: "c-arrays" "C arrays"
-"When calling a C function expecting an array as input, use a utility word to allocate a block of memory of the required size:"
-{ $subsection <c-array> }
-{ $subsection <malloc-array> }
-"The first one 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:"
-{ $subsection free }
-"Each C type has a pair of words, " { $snippet { $emphasis "type" } "-nth" } " and " { $snippet "set-" { $emphasis "type" } "-nth" } ", for reading and writing values of this type stored in an array. This set of words includes but is not limited to:"
-{ $subsection char-nth }
-{ $subsection set-char-nth }
-{ $subsection uchar-nth }
-{ $subsection set-uchar-nth }
-{ $subsection short-nth }
-{ $subsection set-short-nth }
-{ $subsection ushort-nth }
-{ $subsection set-ushort-nth }
-{ $subsection int-nth }
-{ $subsection set-int-nth }
-{ $subsection uint-nth }
-{ $subsection set-uint-nth }
-{ $subsection long-nth }
-{ $subsection set-long-nth }
-{ $subsection ulong-nth }
-{ $subsection set-ulong-nth }
-{ $subsection longlong-nth }
-{ $subsection set-longlong-nth }
-{ $subsection ulonglong-nth }
-{ $subsection set-ulonglong-nth }
-{ $subsection float-nth }
-{ $subsection set-float-nth }
-{ $subsection double-nth }
-{ $subsection set-double-nth }
-{ $subsection void*-nth }
-{ $subsection set-void*-nth }
-{ $subsection char*-nth }
-{ $subsection ushort*-nth } ;
-
-ARTICLE: "reading-writing-memory" "Reading and writing memory directly"
-"Numerical values can be read from memory addresses and converted to Factor objects using the various typed memory accessor words:"
-{ $subsection alien-signed-1 }
-{ $subsection alien-unsigned-1 }
-{ $subsection alien-signed-2 }
-{ $subsection alien-unsigned-2 }
-{ $subsection alien-signed-4 }
-{ $subsection alien-unsigned-4 }
-{ $subsection alien-signed-cell }
-{ $subsection alien-unsigned-cell }
-{ $subsection alien-signed-8 }
-{ $subsection alien-unsigned-8 }
-{ $subsection alien-float }
-{ $subsection alien-double }
-"Factor numbers can also be converted to C values and stored to memory:"
-{ $subsection set-alien-signed-1 }
-{ $subsection set-alien-unsigned-1 }
-{ $subsection set-alien-signed-2 }
-{ $subsection set-alien-unsigned-2 }
-{ $subsection set-alien-signed-4 }
-{ $subsection set-alien-unsigned-4 }
-{ $subsection set-alien-signed-cell }
-{ $subsection set-alien-unsigned-cell }
-{ $subsection set-alien-signed-8 }
-{ $subsection set-alien-unsigned-8 }
-{ $subsection set-alien-float }
-{ $subsection set-alien-double } ;
-
-ARTICLE: "c-data" "Passing data between Factor and C"
-"Two defining characteristics of Factor are dynamic typing and automatic memory management, which are somewhat incompatible with the machine-level data model exposed by C. The C library interface defines its own set of data types, distinct from Factor language types, together with automatic conversion between Factor values and C types. For example, C integer types must be declared and are fixed-width, whereas Factor supports arbitrary-precision integers. Also Factor's garbage collector can move objects in memory, which means that special support has to be provided for passing blocks of memory, such as structures and unions, to C code."
-$terpri
-"C types are identified by strings, and type names occur as parameters to the " { $link alien-invoke } ", " { $link alien-indirect } " and " { $link alien-callback } " words."
-{ $subsection "aliens" }
-{ $subsection "byte-arrays" }
-{ $subsection "malloc" }
-{ $subsection "c-types-numeric" }
-{ $subsection "c-out-params" }
-{ $subsection "c-strings" }
-{ $subsection "c-arrays" }
-"C-style enumerated types are supported:"
-{ $subsection POSTPONE: C-ENUM: }
-"C types can be aliased for convenience and consitency with native library documentation:"
-{ $subsection POSTPONE: TYPEDEF: }
-"New C types can be defined:"
-{ $subsection "c-structs" }
-{ $subsection "c-unions" }
-{ $subsection "reading-writing-memory" } ;
-
-ARTICLE: "alien" "C library interface"
-"Factor can directly call C functions in native libraries. It is also possible to compile callbacks which run Factor code, and pass them to native libraries as function pointers."
-$terpri
-"The C library interface is entirely self-contained; there is no C code which one must write in order to wrap a library."
-$terpri
-"C library interface words are found in the " { $vocab-link "alien" } " vocabulary."
-{ $warning "Since C does not retain runtime type information or do any kind of runtime type checking, any C library interface is not pointer safe. Improper use of C functions can crash the runtime or corrupt memory in unpredictible ways." }
-{ $subsection "loading-libs" }
-{ $subsection "alien-invoke" }
-{ $subsection "alien-callback" }
-{ $subsection "c-data" }
-{ $subsection "dll-internals" } ;
-
-ARTICLE: "loading-libs" "Loading native libraries"
-"Before calling a C library, you must associate its path name on disk with a logical name which Factor uses to identify the library:"
-{ $subsection add-library }
-"Once a library has been defined, you can try loading it to see if the path name is correct:"
-{ $subsection load-library } ;
-
-ARTICLE: "alien-invoke" "Calling C from Factor"
-"The easiest way to call into a C library is to define bindings using a pair of parsing words:"
-{ $subsection POSTPONE: LIBRARY: }
-{ $subsection POSTPONE: FUNCTION: }
-"Don't forget to compile your binding word after defining it; C library calls cannot be made from an interpreted definition."
-$terpri
-"The above parsing words create word definitions which call a lower-level word; you can use it directly, too:"
-{ $subsection alien-invoke }
-"Sometimes it is necessary to invoke a C function pointer, rather than a named C function:"
-{ $subsection alien-indirect }
-"There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-data" } "." ;
-
-ARTICLE: "alien-callback" "Calling Factor from C"
-"Callbacks can be defined and passed to C code as function pointers; the C code can then invoke the callback and run Factor code:"
-{ $subsection alien-callback }
-"There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-data" } "."
-{ $subsection "alien-callback-gc" } ;
-
-ARTICLE: "alien-callback-gc" "Callbacks and code GC"
-"A callback consits of two parts; the callback word, which pushes the address of the callback on the stack when executed, and the callback body itself. If the callback word is redefined, removed from the dictionary using " { $link forget } ", or recompiled, the callback body will not be reclaimed by the garbage collector, since potentially C code may be holding a reference to the callback body."
-$terpri
-"This is the safest approach, however it can lead to code heap leaks when repeatedly reloading code which defines callbacks. If you are " { $emphasis "completely sure" } " that no running C code is holding a reference to any callbacks, you can blow them all away:"
-{ $code "USE: alien callbacks get clear-hash code-gc" }
-"This will reclaim all callback bodies which are otherwise unreachable from the dictionary (that is, their associated callback words have since been redefined, recompiled or forgotten)." ;
-
-ARTICLE: "dll-internals" "DLL handles"
-"DLL handles are a built-in class of objects which represent loaded native libraries. DLL handles are instances of the " { $link dll } " class, and have a literal syntax used for debugging prinouts; see " { $link "syntax-aliens" } "."
-$terpri
-"Usually one never has to deal with DLL handles directly; the C library interface creates them as required. However if direct access to these operating system facilities is required, the following primitives can be used:"
-{ $subsection dlopen }
-{ $subsection dlsym }
-{ $subsection dlclose } ;
diff --git a/core/handbook/changes.facts b/core/handbook/changes.facts
deleted file mode 100644 (file)
index 137fe37..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-USING: errors gadgets-tracks generic hashtables help io kernel
-math memory sequences words compiler parser modules definitions
-tools alien inference ;
-
-ARTICLE: "changes" "Changes in the latest release"
-{ $heading "Factor 0.86" }
-{ $subtopic "Core"
-    { $list
-        "Improved memory management code leads to reduced memory consumption, less frequent garbage collections and fixes a few corner cases where Factor could run out of heap even if a GC would have freed enough memory to proceed"
-        "Improved prettyprinter low lays out code in a more pleasing manner"
-        "Windows native I/O has been sped up (Doug Coleman)"
-    }
-}
-{ $subtopic "UI"
-    { $list
-        { "Double and triple clicks are now recognized, and can be used to select text in the editor gadget" }
-        { "Windows now update while being resized on Windows" }
-    }
-}
-{ $subtopic "Stack effect inference"
-    { $list
-        { "The new " { $link infer. } " word should be called instead of " { $link infer } ", since it presents information in a more pleasing way" }
-        "Stack effect inference now infers variables read and written by a quotation to facilitate code comprehension and debugging"
-    }
-}
-{ $subtopic "Module system"
-    { $list
-        { "The syntax for " { $link POSTPONE: PROVIDE: } " has changed, consult the documentation" }
-        { "Modules can now provide a main entry point, see " { $link run-module } " and " { $link POSTPONE: MAIN: } }
-        { "Modules can now provide documentation, see " { $link "documenting-modules" } }
-    }
-}
-{ $subtopic "Contributed libraries"
-    { $list
-        { "New " { $snippet "contrib/cpuinfo" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/match" } " (Chris Double)" }
-        { "Updated " { $snippet "contrib/parser-combinators" } " (Chris Double)" }
-        { "Updated " { $snippet "contrib/postgresql" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/process" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/sqlite" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/textmate" } " (Benjamin Pollack)" }
-        { "Updated " { $snippet "contrib/tuple-db" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/vim" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/xml" } " (Daniel Ehrenberg)" }
-    }
-}
-{ $heading "Factor 0.85" }
-{ $subtopic "Core"
-    { $list
-        { "Implemented garbage collection for the compiled code heap using a mark and sweep algorithm. The code GC kicks in automatically when the code heap is full, and can also be invoked manually with " { $link code-gc } "." }
-        { "The " { $link usage. } " word now lists individual method usages" }
-        { "New " { $link alien-indirect } " word allows invoking function pointers" }
-        { "Pressing " { $snippet "F8" } " or invoking " { $link reload-modules } " reloads changed source files from loaded modules. Use " { $link reset-modified } " to reset modification times" }
-        { "The module system is used to organize the core library now, and modules from " { $snippet "contrib/" } " must now have their names prefixed with " { $snippet "contrib/" } " when being passed to " { $link require } ", " { $link POSTPONE: REQUIRES: } " and " { $link POSTPONE: PROVIDE: } }
-    }
-}
-{ $subtopic "UI"
-    { $list
-        "Right-clicking on a presentation now shows a popup menu of operations"
-        { "Pressing " { $snippet "C+e" } " in the UI listener displays a file name completion popup; selecting a file and pressing " { $snippet "RETURN" } " opens it in the default editor using " { $link edit-file } }
-        { "Pressing " { $snippet "TAB" } " or " { $snippet "C+u" } " in the UI listener displays a word or vocabulary name completion popup, respectively. Selecting a word inserts its name in the input area, selecting a vocabulary adds it to the search path." }
-        { "New dataflow visualizer tool. Enter a piece of code in the listener, and press " { $snippet "C+A+d" } }
-        "The single stepper tool now properly handles code which uses continuations and exceptions"
-        { "Various fixes for the Windows UI backend (Doug Coleman)" }
-    }
-}
-{ $subtopic "Contributed libraries"
-    { $list
-        { "Updated " { $snippet "contrib/sqlite" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/lazy-lists" } " (Chris Double)" }
-        { "Updated " { $snippet "contrib/parser-combinators" } " (Chris Double)" }
-        { "Updated " { $snippet "contrib/process" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/calendar" } " (Doug Coleman)" }
-        { "Updated " { $snippet "contrib/slate" } " (Eduardo Cavazos)" }
-        { "New module " { $snippet "contrib/lindenmayer" } " - Lindenmayer L-system visualization (Eduardo Cavazos)" }
-        { "New module " { $snippet "contrib/jni" } " - Java interface (Chris Double)" }
-        { "New module " { $snippet "contrib/usb" } " - USB interface (Chris Double)" }
-        { "New module " { $snippet "contrib/match" } " - Pattern matching (Chris Double)" }
-        { "New module " { $snippet "contrib/textmate" } " - TextMate editor integration (Benjamin Pollack)" }
-        { "New module " { $snippet "contrib/tetris" } " - TextMate editor integration (Alex Chapman)" }
-    }
-}
-{ $heading "Factor 0.84" }
-{ $subtopic "Core"
-    { $list
-        { "Incompatible change: the argument order for the following words has changed:"
-            { $list
-                { $link head }
-                { $link head* }
-                { $link head-slice }
-                { $link head-slice* }
-                { $link tail }
-                { $link tail* }
-                { $link tail-slice }
-                { $link tail-slice* }
-                { $link group }
-            }
-        }
-        "Native I/O on Windows is now supported again. This means non-blocking I/O, network sockets, HTTPD and so on work again (Doug Coleman)."
-        { "Stack effect declarations are now read by the parser. This means that " { $snippet "( foo bar )" } " is not a comment anymore, but syntax. See " { $link "effect-declaration" } "." }
-        { "Redefining words no longer decompiles words that call them; now you must call " { $link recompile } " manually. This word is automatically called after loading a file with " { $link run-file } " or a module with " { $link require } ". See " { $link "recompile" } " for details." }
-        { "Words such as " { $link see } ", " { $link reload } ", and " { $link edit } " can now take method and help article specifiers in addition to words. See " { $link "definitions" } " for details." }
-    }
-}
-{ $subtopic "UI"
-    { $list
-        "New code walker runs in UI, supports backward time travel and replaces terminal-based walker."
-        "New single-window interface -- the listener, browser, documentation and walker have been merged into a single window. Use F2, F3, F4, F5 to switch between tools. Multiple windows can still be opened with S+F2, S+F3, S+F4."
-        "The input gadget in the listener now supports a variety of shortcuts for getting information about the word at the caret. Explore the keyboard help for details."
-        "Pressing F1 now lists keyboard shortcuts for the currently focused gadget."
-        "The UI now sends modifier keys along with mouse button up/down gestures."
-        "For users with a one-button mouse, control-clicking is now sent as a right click, and alt-clicking is sent as a middle-click."
-        "On Mac OS X, the UI can now act as a system services client. That is, you can select some text in the listener's input gadget, invoke a service, and see the result appear."
-    }
-}
-{ $subtopic "Tools"
-    { $list
-        { "The " { $snippet "jedit" } " word has been replaced with a general " { $link edit } " word. You must now load one of the following modules for external editor support:"
-            { $list
-                { $snippet "emacs" }
-                { $snippet "jedit" }
-                { $snippet "vim" }
-            }
-        }
-        { "New " { $link :edit } " word opens your editor at the location of the most recent syntax error." }
-        { "New " { $link :help } " word displays documentation explaining the most recent error." }
-        { "The " { $link apropos } " word now performs fuzzy matching and ranks results according to edit distance." }
-    }
-}
-{ $subtopic "Contributed libraries"
-    { $list
-        { { $snippet "automata" } ": updated (Eduardo Cavazos)." }
-        { { $snippet "boids" } ": updated (Eduardo Cavazos)." }
-        { { $snippet "calendar" } ": updated (Doug Coleman)." }
-        { { $snippet "concurrency" } ": supports distributed message passing over sockets between nodes (Chris Double)." }
-        { { $snippet "emacs" } ": new module, adds a hook for the " { $link edit } " word that invokes Emacs (Eduardo Cavazos)." }
-        { { $snippet "httpd" } ": supports client cache control headers (Chris Double)." }
-        { { $snippet "json" } ": new module reads and writes JSON objects (Chris Double)." }
-        { { $snippet "lambda" } ": new module, lambda calculus interpreter (Matthew Willis)." }
-        { { $snippet "lazy-lists" } ": updated (Matthew Willis)." }
-        { { $snippet "parser-combinators" } ": updated (Chris Double)." }
-        { { $snippet "rss" } ": new module reads RSS2 feeds (Chris Double)." }
-        { { $snippet "serialize" } ": revived and updated (Chris Double)." }
-        { { $snippet "sqlite" } ": updated (Chris Double)." }
-        { { $snippet "tuple-db" } ": updated (Chris Double)." }
-        { { $snippet "vim" } ": new module, adds a hook for the " { $link edit } " word that invokes VIM (Doug Coleman)." }
-    }
-}
-{ $heading "Factor 0.83" }
-{ $subtopic "First class quotations"
-    { $list
-        "Support for cons cells and linked lists has been removed from the core language."
-        "Quotations are now a first-class array-like type with the same literal syntax that linked lists used to have."
-        { "A few quotation construction words such as " { $link curry } ", " { $link unit } " and " { $link alist>quot } " have been moved to the " { $snippet "kernel" } " vocabulary." }
-    }
-}
-{ $subtopic "UI"
-    { $list
-        "Multi-line text editor gadget replaces single-line editor gadget and adds support for selection, copy and paste, and more advanced text editing."
-        "New apropos tool."
-        "New word browser tool."
-        { "New " { $link track } " gadget replaces the old " { $snippet "splitter" } "; it behaves similarly but supports more than two children." }
-        "Key down and key up gestures have been made separate."
-        "Window positions and contents are now saved in the image."
-        "You can now paste from the clipboard using Control-V (Mac OS) or by middle-clicking (X11)."
-        "The UI now uses 2-dimensional rather than 3-dimensional co-ordinates, since the third dimension was never used."
-        "Beginnings of an MVC framework taking some cues from functional reactive programming."
-    }
-}
-{ $subtopic "Documentation"
-    { $list
-        "Better looking markup output."
-        "Expanded and improved documentation."
-        "Full-text search."
-    }
-}
-{ $subtopic "Mac OS X-specific"
-    { $list
-        "Factor now runs on Intel-based Macs."
-        { "Redesigned Cocoa binding. Messages are now sent via the " { $snippet "->" } " parsing word, for example:"
-            { $code "NSObject -> alloc -> init" }
-        }
-        "Files can be run by dropping them on the Factor icon in the dock"
-        { "Services support; if you drop " { $snippet "Factor.app" } " in your " { $snippet "Applications" } " directory, you will be able to evaluate Factor code from other applications." }
-        "File->Run command."
-    }
-}
-{ $subtopic "Core language changes"
-    { $list
-        { "The " { $snippet "reverse-slice" } " word has been removed; call " { $link <reversed> } " instead." }
-        { "The " { $link sum } " and " { $link product } " words have been moved into the core." }
-        { "New " { $link remove-hash* } " word removes the former value." }
-        { "C library interface now features full support for " { $snippet "ushort*" } " UTF-16 strings." }
-        { "Restartable errors are now supported; throw them using " { $link condition } ", and invoke restarts in the listener using " { $link :res } "." }
-        { { $link with-stream-table } " word for tabular formatting." }
-        { "Style stack and associated words such as " { $snippet "format*" } " have been removed in favor of a better abstraction, " { $link with-style } " and " { $link with-stream-style } "." }
-    }
-}
-{ $subtopic "Contributed libraries"
-    { $list
-        { "There is a new mechanism for loading contributed libraries that correctly handles dependencies; see " { $link "modules" } "." }
-        { "Time and date library added in " { $snippet "contrib/calendar/" } ". (Doug Coleman)" }
-        "Factory window manager updates (Eduardo Cavazos)"
-        { "New " { $snippet "slate" } " gadget for easier graphical output for simulations and demos. (Eduardo Cavazos)" }
-        "Automata and boids demos. (Eduardo Cavazos)"
-        { "More concise syntax for variables in " { $snippet "contrib/vars.factor" } ". (Eduardo Cavazos)" }
-    }
-}
-{ $subtopic "HTTP server"
-    { $list
-        "Improved AJAX outliners in the help responder can now be collapsed."
-        { "Files with the " { $snippet ".fhtml" } " extension are run through the " { $snippet "embedded.factor" } " module; snippets of Factor code between " { $snippet "<%" } " and " { $snippet "%>" } " are evaluated and their output intermingled with the HTML text." }
-    }
-}
-{ $heading "Factor 0.82" }
-{ $list
-    "New code generator framework in compiler"
-    "Floating point operations are now open-coded, resulting in a performance gain"
-    { "Remove " { $snippet "unswons" } " word" }
-    "Implement value type struct inputs to callbacks on AMD64"
-    "Fix some Unix I/O bugs"
-    "Standard OS X-style menu bar in the Cocoa UI (Kevin Reid)"
-    "Objective C methods defined in Factor can now return C structures by value"
-}
-{ $heading "Factor 0.81" }
-{ $subtopic "UI"
-    { $list
-        "Replaced SDL backend code with Mac OS X (Cocoa), X11 and Windows implementations"
-        { "The UI now starts by default under X11 if " { $snippet "$DISPLAY" } " is set" }
-        "Multiple windows are now supported"
-        "New browser gadget supports history and multiple views of an object"
-        "Preferred size cache to speed up gadget layout"
-        "Better-looking outliners"
-    }
-}
-{ $subtopic "Help system"
-    { $list
-        { "Help cross-referencing implemented - the " { $snippet "links-in." } " and " { $snippet "links-out." } " words are analogous to " { $link usage. } " and " { $snippet "uses." } }
-        { "New documentation covers development tools and C library interface" }
-    }
-}
-{ $subtopic "Core language"
-    { $list
-        "Stack underflow and overflow errors are not reported as such, and not generic \"signal 11\" errors (Adam Langley)"
-        { "The " { $link standard-combination } " word now takes a stack position, not a picker quotation, and delegation is now supported for words which dispatch on a stack location other than the top" }
-        { "New " { $link exchange } " word" }
-        { "More useful " { $link heap-stats. } " output now shows count/allocation statistics per-class, instead of per-type" }
-        { "Factor now looks for a " { $snippet "factor.image" } " in the same directory as the runtime executable on Mac OS X and Windows, if you don't specify an image name parameter on the command line" }
-    }
-}
-{ $subtopic "Portability"
-    { $list
-        "Solaris x86 port (Patrick Mauritz)"
-    }
-}
-{ $subtopic "Compiler"
-    { $list
-        "Compiler no longer splits all branches, reducing compile time and generated code size"
-    }
-}
-{ $subtopic "C library interface"
-    { $list
-        "Structs can now be passed by value to C functions"
-        { "Callbacks from C code to Factor are now supported - see " { $link "alien-callback" } }
-        { "Improved support for passing UTF16 strings to and from C functions (" { $snippet "ushort*" } " type)" }
-        { "The " { $snippet "BEGIN-ENUM:" } " and " { $snippet "BEGIN-UNION:" } " parsing words have been annexed in favor of new, more consise syntax - see " { $link POSTPONE: C-ENUM: } " and " { $link POSTPONE: C-UNION: } }
-    }
-}
-{ $subtopic "Objective C library interface"
-    { $list
-        "Objective C classes can now be subclassed"
-        "Objective C exceptions are now caught and reported as Factor exceptions"
-        "Objective C messages returning structs by value are now supported"
-        
-    }
-}
-{ $subtopic "Contributed libraries"
-    { $subtopic "contrib/processes.factor"
-        { $list "This is a new library" }
-    }
-    { $subtopic "contrib/partial-continuations.factor"
-        { $list "This is a new library (Chris Double)" }
-    }
-    { $subtopic "contrib/httpd/"
-        { $list
-            "File responder fixes"
-            "Inspector responder fixes"
-            "Continuation responder fixes (Chris Double)"
-            { "Add templating engine in " { $snippet "embedded.factor" } " (Alex Chapman)" }
-        }
-    }
-    { $subtopic "contrib/xml.factor"
-        { $list
-            "Various updates for recent Factor changes"
-            "Improved XML output capabilities"
-        }
-    }
-    { $subtopic "contrib/factory/"
-        { $list "Many updates" }
-    }
-    { $subtopic "contrib/crypto/"
-        { $list
-            "Added Base64 encoding (Doug Coleman)"
-            "Added Blum Blum Shub random number generator (Doug Coleman)"
-            "Added CRC32 checksum (Doug Coleman)"
-        }
-    }
-    { $subtopic "contrib/space-invaders/"
-        { $list
-            "Updated to use Factor UI instead of SDL (Chris Double)"
-        }
-    }
-} ;
diff --git a/core/handbook/cli.facts b/core/handbook/cli.facts
deleted file mode 100644 (file)
index 51deaa9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-USING: help parser shells modules ;
-
-ARTICLE: "cli" "Command line usage"
-"Unless the " { $snippet "-no-user-init" } " command line switch is specified, The startup routine runs the " { $snippet ".factor-rc" } " file in the user's home directory, if it exists. This file can contain initialization and customization for your development environment."
-$terpri
-"Zero or more command line arguments may be passed to the Factor runtime. Command line arguments starting with a dash (" { $snippet "-" } ") is interpreted as a switch. All other arguments are taken to be file names."
-$terpri
-"If any file names are specified at all, the first one must be the image name; otherwise, 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)."
-$terpri
-"All file names other than the first one are source file names which will be run with " { $link run-file } " when Factor starts up."
-$terpri
-"Finally, switches can take one of the following three forms:"
-{ $list
-    { { $snippet "-" { $emphasis "foo" } } " - sets the global variable " { $snippet "\"" { $emphasis "foo" } "\"" } " to " { $link t } }
-    { { $snippet "-no-" { $emphasis "foo" } } " - sets the global variable " { $snippet "\"" { $emphasis "foo" } "\"" } " to " { $link f } }
-    { { $snippet "-" { $emphasis "foo" } "=" { $emphasis "bar" } } " - sets the global variable " { $snippet "\"" { $emphasis "foo" } "\"" } " to " { $snippet "\"" { $emphasis "bar" } "\"" } }
-}
-{ $subsection "runtime-cli-args" }
-{ $subsection "bootstrap-cli-args" }
-{ $subsection "standard-cli-args" } ;
-
-ARTICLE: "runtime-cli-args" "Runtime command line switches"
-"A handful of command line switches are processed by the runtime and not the library. They control low-level features."
-{ $table
-    { { $snippet "-D=" { $emphasis "n" } } "Data stack size, kilobytes" }
-    { { $snippet "-R=" { $emphasis "n" } } "Retain stack size, kilobytes" }
-    { { $snippet "-C=" { $emphasis "n" } } "Call stack size, kilobytes" }
-    { { $snippet "-G=" { $emphasis "n" } } "Number of generations, must be >= 2" }
-    { { $snippet "-Y=" { $emphasis "n" } } { "Size of " { $snippet { $emphasis "n" } "-1" } " youngest generations, megabytes" } }
-    { { $snippet "-A=" { $emphasis "n" } } "Size of tenured and semi-spaces, megabytes" }
-    { { $snippet "-X=" { $emphasis "n" } } "Code heap size, megabytes" }
-} ;
-
-ARTICLE: "bootstrap-cli-args" "Switches available when bootstrapping"
-"A number of command line switches can be passed to a bootstrap image to modify the behavior of the resulting " { $snippet "factor.image" } ":"
-{ $table
-    { { $snippet "-no-compile" } "Do not compile any words in the image or load any modules which depend on the compiler" }
-    { { $snippet "-no-native-io" } "Do not load the native I/O module for your operating system; non-blocking I/O and sockets will not be available" }
-    { { $snippet "-no-cocoa" } "(Mac OS X only) do not load the Cocoa UI backend" }
-    { { $snippet "-x11" } { "(Unix only) load the X11 UI backend. You can specify " { $snippet "-no-cocoa -x11" } " to load the X11 UI on Mac OS X" } }
-    { { $snippet "-no-x11" } "(Unix only) do not load the X11 UI backend" }
-}
-"To find out how to generate a bootstrap image, see " { $link "images" } "." ;
-
-ARTICLE: "standard-cli-args" "General command line switches"
-"The following command line switches can be passed to a bootstrapped Factor image:"
-{ $table
-    { { $snippet "-e=" { $emphasis "code" } } { "This specifies a code snippet to evaluate. If you want Factor to exit immediately after, also specify " { $snippet "-shell=none" } "." } }
-    { { $snippet "-shell=" { $emphasis "shell" } } { { $snippet { $emphasis "shell" } } " is either " { $link tty } ", " { $link ui } ", " { $link none } ", or the name of any other word in the " { $vocab-link "shells" } " vocabulary. This specifies the user interface to run on startup." } }
-    { { $snippet "-no-user-init" } { "If specified, Factor will not run the " { $snippet "~/.factor-rc" } " file on startup" } }
-    { { $snippet "-quiet" } { "If set, " { $link run-file } " and " { $link require } " will not print load messages" } }
-} ;
diff --git a/core/handbook/collections.facts b/core/handbook/collections.facts
deleted file mode 100644 (file)
index 98b2053..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-USING: graphs hashtables hashtables-internals help io-internals
-kernel kernel-internals namespaces queues ;
-
-ARTICLE: "collections" "Collections"
-"Classical data structures:"
-{ $subsection "sequences" }
-{ $subsection "hashtables" }
-"An abstraction on hashtables:"
-{ $subsection "namespaces" }
-"Special-purpose data structures:"
-{ $subsection "queues" }
-{ $subsection "graphs" }
-"A low-level facility:"
-{ $subsection "buffers" } ;
-
-ARTICLE: "queues" "Queues"
-"Last-in-first-out queues can be found in the " { $vocab-link "queues" } " vocabulary."
-{ $subsection queue? }
-{ $subsection <queue> }
-{ $subsection queue-empty? }
-{ $subsection deque }
-{ $subsection enque }
-"An example:"
-{ $code
-    "<queue> \"q\" set"
-    "5 \"q\" get enque"
-    "3 \"q\" get enque"
-    "7 \"q\" get enque"
-    "\"q\" get deque ."
-    "  5"
-    "\"q\" get deque ."
-    "  3"
-    "\"q\" get deque ."
-    "  7"
-} ;
-
-ARTICLE: "graphs" "Directed graphs"
-"A minimalist directed graph data type can be found in the " { $vocab-link "graphs" } " vocabulary. A directed graph is represented as a hashtable mapping each vertex to a set of edges entering that vertex, where the set is represented as a hashtable with equal keys and values."
-$terpri
-"To create a new graph, just call " { $link <hashtable> } " or construct a hashtable by some other means. To add vertices and edges to a graph:"
-{ $subsection add-vertex }
-{ $subsection build-graph }
-"To remove vertices from the graph:"
-{ $subsection remove-vertex }
-{ $subsection clear-hash }
-"You can perform queries on the graph:"
-{ $subsection in-edges }
-{ $subsection closure }
-"Directed graphs are used to maintain cross-referencing information for words (" { $link "word-crossref" } ")." ;
-
-ARTICLE: "buffers" "Locked I/O buffers"
-"I/O buffers are a circular ring structure, a fixed-size queue of characters. Their key feature is that they are backed by manually allocated storage that does not get moved by the garbage collector. They are typically used for asynchronous I/O in conjunction with the C library interface in Factor's implementation."
-$terpri
-"Buffer words are in the " { $vocab-link "io-internals" } " vocabulary."
-{ $subsection buffer }
-{ $subsection <buffer> }
-"Buffers must be manually deallocated:"
-{ $subsection buffer-free }
-"Buffer operations:"
-{ $subsection buffer-reset }
-{ $subsection buffer-length }
-{ $subsection buffer-empty? }
-{ $subsection buffer-capacity }
-"Reading from the buffer:"
-{ $subsection buffer-peek }
-{ $subsection buffer-pop }
-{ $subsection buffer> }
-{ $subsection buffer>> }
-{ $subsection buffer-contents }
-"Writing to the buffer:"
-{ $subsection extend-buffer }
-{ $subsection ch>buffer }
-{ $subsection >buffer } ;
diff --git a/core/handbook/compiler.facts b/core/handbook/compiler.facts
deleted file mode 100644 (file)
index b9062e5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-USING: help compiler parser ;
-
-ARTICLE: "compiler" "The compiler"
-"The Factor compiler transforms word definitions to native machine code and performs a variety of optimizations."
-$terpri
-"Only words for which a stack effect can be inferred will compile. All other words run in the interpreter. See " { $link "inference" } "."
-{ $subsection "compiler-usage" }
-{ $subsection "recompile" } ;
-
-ARTICLE: "compiler-usage" "Compiler usage"
-"The main entry point to the compiler is a single word taking a word as input:"
-{ $subsection compile }
-"The above word throws an error if the word did not compile. Another variant simply prints the error and returns:"
-{ $subsection try-compile }
-"The compiler can also compile a single quotation:"
-{ $subsection compile-quot }
-{ $subsection compile-1 }
-"Two utility words for bulk compilation:"
-{ $subsection compile-vocabs }
-{ $subsection compile-all } ;
-
-ARTICLE: "recompile" "Automatic recompilation"
-"Factor's compiler performs " { $emphasis "early binding" } "; if a compiled word " { $snippet "A" } " calls another compiled word " { $snippet "B" } " and " { $snippet "B" } " is subsequently redefined, the compiled definition of " { $snippet "A" } " will still refer to the earlier compiled definition of " { $snippet "B" } "."
-$terpri
-"When a word is redefined, you can recompile all affected words automatically:"
-{ $subsection recompile }
-"Normally loading a source file or a module also calls " { $link recompile } ". This can be disabled by wrapping file loading in a combinator:"
-{ $subsection no-parse-hook } ;
diff --git a/core/handbook/conventions.facts b/core/handbook/conventions.facts
deleted file mode 100644 (file)
index 120024e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-USING: arrays gadgets hashtables help io kernel-internals
-namespaces sequences ;
-
-ARTICLE: "conventions" "Conventions"
-"Various conventions are used throughout the Factor documentation and source code."
-{ $heading "Word naming conventions" }
-"These conventions are not hard and fast, but are usually a good first step in understanding a word's behavior:"
-{ $table
-    { "General form" "Description" "Examples" }
-    { { $snippet { $emphasis "foo" } "?" } "outputs a boolean" { { $link empty? } } }
-    { { $snippet "?" { $emphasis "foo" } } { "conditionally performs " { $snippet { $emphasis "foo" } } } { { $links ?nth ?hash } } }
-    { { $snippet "<" { $emphasis "foo" } ">" } { "creates a new " { $snippet "foo" } } { { $link <array> } } }
-    { { $snippet { $emphasis "foo" } "*" } { "alternative form of " { $snippet "foo" } ", or a generic word called by " { $snippet "foo" } } { { $links hash* draw-gadget* } } }
-    { { $snippet "(" { $emphasis "foo" } ")" } { "implementation detail word used by " { $snippet "foo" } } { { $link (clone) } } }
-    { { $snippet "n" { $emphasis "foo" } } { "(sequence words only) performs " { $snippet "foo" } " but modifies an input sequence instead of creating a new sequence" } { { $links nappend nsort } } }
-    { { $snippet "set-" { $emphasis "foo" } } { "sets " { $snippet "foo" } " to a new value" } { $links set-length } }
-    { { $snippet { $emphasis "foo" } "-" { $emphasis "bar" } } { "(tuple accessors) outputs the value of the " { $snippet "bar" } " slot of the " { $snippet "foo" } " at the top of the stack" } { } }
-    { { $snippet "set-" { $emphasis "foo" } "-" { $emphasis "bar" } } { "(tuple mutators) sets the value of the " { $snippet "bar" } " slot of the " { $snippet "foo" } " at the top of the stack" } { } }
-    { { $snippet "with-" { $emphasis "foo" } } { "performs some kind of initialization and cleanup related to " { $snippet "foo" } ", usually in a new dynamic scope" } { $links with-scope with-stream } }
-    { { $snippet "$" { $emphasis "foo" } } { "help markup" } { $links $heading $emphasis } }
-}
-{ $heading "Vocabulary naming conventions" }
-"A vocabulary name ending in " { $snippet "-internals" } " contains words which are either implementation detail, unsafe, or both. For example, the " { $snippet "sequence-internals" } " vocabulary contains words which access sequence elements without bounds checking (" { $link "sequences-unsafe" } ")."
-$terpri
-"You should should avoid using internal words from the Factor library unless absolutely necessary. Similarly, your own code can place words in internal vocabularies if you do not want other people to use them unless they have a good reason." ;
diff --git a/core/handbook/cookbook.facts b/core/handbook/cookbook.facts
deleted file mode 100644 (file)
index 7b53cff..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-USING: help io kernel math namespaces parser prettyprint
-sequences modules tools ;
-
-ARTICLE: "cookbook" "Factor cookbook"
-{ $list
-    { "The basic unit of code, corresponding to a \"function\" in other languages, is called a " { $emphasis "word" } " in Factor." }
-    { "Word take inputs from the stack, and leave output values on the stack. This is documented in a " { $emphasis "stack effect declaration" } ", for example " { $snippet "( x y -- z )" } " denotes that a word takes two inputs, with " { $snippet "y" } " at the top of the stack, and returns one output. See " { $link "effect-declaration" } " for details." }
-    { "You can load source files with " { $link run-file } ":"
-    { $code "\"my-program.factor\" run-file" } }
-    { { "You can load modules from " { $snippet "apps/" } ", " { $snippet "libs/" } " or " { $snippet "demos/" } " with " { $link require } ":" }
-    { $code "\"libs/httpd\" require" } }
-    { { "Some modules have a defined main entry point, and can be run just like applications in an operating system:" }
-        { $code "\"apps/tetris\" run-module" }
-    }
-    { { $link .s } " prints the contents of the stack." }
-    { { $link . } " prints the object at the top of the stack." }
-    { "If you are reading this from the Factor UI, take a look at " { $link "ui-tools" } "." }
-}
-{ $subsection "cookbook-syntax" }
-{ $subsection "cookbook-colon-defs" }
-{ $subsection "cookbook-combinators" }
-{ $subsection "cookbook-variables" }
-{ $subsection "cookbook-vocabs" }
-{ $subsection "cookbook-sources" }
-{ $subsection "cookbook-io" }
-{ $subsection "cookbook-philosophy" } ;
-
-ARTICLE: "cookbook-syntax" "Basic syntax cookbook"
-"The following is a simple snippet of Factor code:"
-{ $example "10 sq 5 - ." "95" }
-"You can click on it to evaluate it in the listener, and it will print the same output value as indicated above."
-$terpri
-"Factor has a very simple syntax. Your program consists of " { $emphasis "words" } " and " { $emphasis "literals" } ". In the above snippet, the words are " { $link sq } ", " { $link - } " and " { $link . } ". The two integers 10 and 5 are literals."
-$terpri
-"Factor evaluates code left to right, and stores intermediate values on a " { $emphasis "stack" } ". If you think of the stack as a pile of papers, then " { $emphasis "pushing" } " a value on the stack corresponds to placing a piece of paper at the top of the pile, while " { $emphasis "popping" } " a value corresponds to removing the topmost piece."
-$terpri
-"In the above example, the following series of steps occurs as the code is evaluated:"
-{ $table
-    { "Action" "Stack contents" }
-    { "10 is pushed on the stack." { $snippet "10" } }
-    { { "The " { $link sq } " word is executed. It pops one input from the stack - the integer 10 - and squares it, pushing the result." } { $snippet "100" } }
-    { { "5 is pushed on the stack." } { $snippet "100 5" } }
-    { { "The " { $link - } " word is executed. It pops two inputs from the stack - the integers 100 and 5 - and subtracts 5 from 100, pushing the result." } { $snippet "95" } }
-    { { "The " { $link . } " word is executed. It pops one input from the stack - the integer 95 - and prints it in the listener's output area." } { } }
-}
-"Factor supports many other data types:"
-{ $code
-    "10.5"
-    "\"character strings\""
-    "{ 1 2 3 }"
-    "! by the way, this is a comment"
-    "#! and so is this"
-}
-{ $references
-    { "Factor's syntax can be extended, the parser can be called reflectively, and the " { $link . } " word is in fact a general facility for turning almost any object into a form which can be parsed back in again. If this interests you, consult the following sections:" }
-    "syntax"
-    "parser"
-    "prettyprint"
-} ;
-
-ARTICLE: "cookbook-colon-defs" "Shuffle word and definition cookbook"
-"The " { $link dup } " word makes a copy of the value at the top of the stack:"
-{ $example "5 dup * ." "25" }
-"The " { $link sq } " word is actually defined as follows:"
-{ $code ": sq dup * ;" }
-"(You could have looked this up yourself by clicking on the " { $link sq } " word itself.)"
-$terpri
-"Note the key elements in a word definition: The colon (" { $link POSTPONE: : } " denotes the start of a word definition. The name of the new word must immediately follow. The word definition then continues on until the " { $link POSTPONE: ; } " token signifies the end of the definition. This type of word definition is called a " { $emphasis "colon definition." }
-$terpri
-"Factor is all about code reuse through short and logical colon definitions. Breaking up a problem into small pieces which are easy to test is called " { $emphasis "factoring." }
-$terpri
-"Another example of a colon definition:"
-{ $code ": neg ( x -- -x ) 0 swap - ;" }
-"Here the " { $link swap } " shuffle word is used to interchange the top two stack elements. Note the difference that " { $link swap } " makes in the following two snippets:"
-{ $code
-    "5 0 -       ! Computes 5-0"
-    "5 0 swap -  ! Computes 0-5"
-}
-"Also, in the above example a stack effect declaration is written between " { $snippet "(" } " and " { $snippet ")" } " with a mnemonic description of what the word does to the stack. See " { $link "effect-declaration" } " for details."
-{ $curious
-    "This syntax will be familiar to anybody who has used FORTH before. However the behavior is slightly different. In most FORTH systems, the below code prints 2, because the definition of " { $snippet "b" } " still refers to the previous definition of " { $snippet "b" } ":"
-    { $code
-        ": a 1 ;"
-        ": b a 1 + ;"
-        ": a 2 ;"
-        "b ."
-    }
-    "In Factor, this example will print 3 since word redefinition is explicitly supported."
-}
-{ $references
-    { "A whole slew of shuffle words can be used to rearrange the stack. There are forms of word definition other than colon definition, words can be defined entirely at runtime, and word definitions can be " { $emphasis "annotated" } " with tracing calls and breakpoints without modifying the source code." }
-    "shuffle-words"
-    "words"
-    "word-introspection"
-    "annotations"
-} ;
-
-ARTICLE: "cookbook-combinators" "Control flow cookbook"
-"A " { $emphasis "quotation" } " is an object containing code which can be evaluated."
-{ $code
-    "2 2 + .     ! Prints 4"
-    "[ 2 2 + . ] ! Pushes a quotation"
-}
-"The quotation pushed by the second example will push 4 when called by " { $link call } "."
-$terpri
-"Quotations are used to implement control flow. For example, conditional execution is done with " { $link if } ":"
-{ $code
-    ": sign-test ( n -- )"
-    "    dup 0 < ["
-    "        drop \"negative\""
-    "    ] ["
-    "        zero? [ \"zero\" ] [ \"positive\" ] if"
-    "    ] if print ;"
-}
-"The " { $link if } " word takes a boolean, a true quotation, and a false quotation, and executes one of the two quotations depending on the value of the boolean. In Factor, any object not equal to the special value " { $link f } " is considered true, while " { $link f } " is false."
-$terpri
-"Another useful form of control flow is iteration. You can do something several times:"
-{ $code "10 [ \"Factor rocks!\" print ] times" }
-"Now we can look at a new data type, the array:"
-{ $code "{ 1 2 3 }" }
-"An array looks like a quotation except it cannot be evaluated; it simply stores data."
-$terpri
-"You can perform an operation on each element of an array:"
-{ $code "{ 1 2 3 } [ \"The number is \" write . ] each" }
-"You can transform each element, collecting the results in a new array:"
-{ $example "{ 5 12 0 -12 -5 } [ sq ] map ." "{ 25 144 0 144 25 }" }
-"You can create a new array, only containing elements which satisfy some condition:"
-{ $example
-    ": negative? ( n -- ? ) 0 < ;"
-    "{ -12 10 16 0 -1 -3 -9 } [ negative? ] subset ."
-    "{ -12 -1 -3 -9 }"
-}
-{ $references
-    { "Since quotations are real objects, they can be constructed and taken apart at will. You can write code that writes code. Arrays are just one of the various types of sequences, and the sequence operations such as " { $link each } " and " { $link map } " operate on all types of sequences. There are many more sequence iteration operations than the ones above, too." }
-    "dataflow"
-    "sequences"
-} ;
-
-ARTICLE: "cookbook-variables" "Variables cookbook"
-"Before using a variable, you must define a symbol for it:"
-{ $code "SYMBOL: name" }
-"A symbol is a word which pushes itself on the stack when executed. Try it:"
-{ $example "SYMBOL: foo" "foo ." "foo" }
-"Symbols can be passed to the " { $link get } " and " { $link set } " words to read and write variable values:"
-{ $example "\"Slava\" name set" "name get print" "Slava" }
-"If you set variables inside a " { $link with-scope } ", their values will be lost after leaving the scope:"
-{ $example
-    ": print-name name get print ;"
-    "\"Slava\" name set"
-    "["
-    "    \"Diana\" name set"
-    "    \"There, the name is \" write  print-name"
-    "] with-scope"
-    "\"Here, the name is \" write  print-name"
-    "There, the name is Diana\nHere, the name is Slava"
-}
-{ $curious
-    "Variables are dynamically-scoped in Factor."
-}
-{ $references
-    "There is a lot more to be said about variables and namespaces."
-    "namespaces"
-} ;
-
-ARTICLE: "cookbook-vocabs" "Vocabularies cookbook"
-"Rather than being in one flat list, words belong to vocabularies; every word is contained in exactly one. When parsing a word name, the parser searches the " { $emphasis "vocabulary search path" } ". When working at the listener, a useful set of vocabularies is already available. In a source file, all used vocabularies must be imported."
-$terpri
-"For example, a source file containing the following code will print a parse error if you try loading it:"
-{ $code "\"Hello world\" print" }
-"The " { $link print } " word is contained inside the " { $vocab-link "io" } " vocabulary, which is available in the listener but must be explicitly added to the search path in source files:"
-{ $code
-    "USE: io"
-    "\"Hello world\" print"
-}
-"Typically a source file will refer to words in multiple vocabularies, and they can all be added to the search path in one go:"
-{ $code "USING: arrays kernel math ;" }
-"New words go into the " { $vocab-link "scratchpad" } " vocabulary by default. You can change this with " { $link POSTPONE: IN: } ":"
-{ $code
-    "IN: time-machine"
-    ": time-travel ( when what -- ) frob fizz flap ;"
-}
-"Note that words must be defined before being referenced. The following is generally invalid:"
-{ $code
-    ": frob accelerate particles ;"
-    ": accelerate accelerator on ;"
-    ": particles [ (particles) ] each ;"
-}
-"You would have to place the first definition after the two others for the parser to accept the file."
-{ $references
-    { }
-    "vocabulary-search"
-    "words"
-    "parser"
-} ;
-
-ARTICLE: "cookbook-sources" "Source file cookbook"
-"By convention, code  is stored in files with the " { $snippet ".factor" } " filename extension. You can load source files using " { $link run-file } ":"
-{ $code "\"hello.factor\" run-file" }
-{ $references
-    "Programs larger than one source file or programs which depend on other libraries should be loaded via the module system instead. Even more advanced functionality can be implemented by calling the parser and source reader at runtime."
-    "sources"
-    "modules"
-    "parser"
-} ;
-
-ARTICLE: "cookbook-io" "I/O cookbook"
-"Ask the user for their age, and print it back:"
-{ $code
-    ": ask-age ( -- ) \"How old are you?\" print ;"
-    ": read-age ( -- n ) readln string>number ;"
-    ": print-age ( n -- )"
-    "    \"You are \" write"
-    "    number>string write"
-    "    \" years old.\" print ;"
-    ": example ( -- ) ask-age read-age print-age ;"
-    "example"
-}
-"Print the lines of a file in sorted order:"
-{ $code
-    "\"lines.txt\" <file-reader> lines natural-sort [ print ] each"
-}
-"Read 1024 bytes from a file:"
-{ $code
-    "\"data.bin\" <file-reader> [ 1024 read ] with-stream"
-}
-"Send some bytes to a remote host:"
-{ $code
-    "\"myhost\" 1033 <client> [ { 12 17 102 } write ] with-stream"
-}
-{ $references
-    { }
-    "number-strings"
-    "streams"
-} ;
-
-ARTICLE: "cookbook-philosophy" "Factor philosophy"
-"Factor is a high-level language with automatic memory management, runtime type checking, and strong typing. Factor code should be as simple as possible, but not simpler. If you are coming to Factor from another programming language, one of your first observations might me related to the amount of code you " { $emphasis "don't" } " have to write."
-$terpri
-"If you try to write Factor word definitions which are longer than a couple of lines, you will find it hard to keep track of the stack contents. Well-written Factor code is " { $emphasis "factored" } " into short definitions, where each definition is easy to test interactively, and has a clear purpose. Well-chosen word names are critical, and having a thesaurus on hand really helps."
-$terpri
-"If you run into problems with stack shuffling, take a deep breath and a step back, and reconsider the problem. A much simpler solution is waiting right around the corner, a natural solution which requires far less stack shuffling and far less code. As a last resort, if no simple solution exists, consider defining a domain-specific language."
-$terpri
-"Every time you define a word which simply manipulates sequences, hashtables or objects in an abstract way which is not related to your program domain, check the library to see if you can reuse an existing definition and save yourself some debugging time."
-$terpri
-"In addition to writing short definitions and testing them interactively, a great habit to get into is writing unit tests. Factor provides good support for unit testing; see " { $link "testing-modules" } "."
-$terpri
-"The Factor core consists of the development environment together with a minimal library to host it. Additional functionality which other languages integrate is often a separate module in Factor; see " { $link "modules" } "."
-$terpri
-"Factor tries to implement as much of itself as possible, because this improves simplicity and performance. One consequence is that Factor gives you the option of using low-level features not usually associated with high-level languages, such manual memory management, pointer arithmetic, and inline assembly code."
-$terpri
-"Unsafe features are tucked away so that you will not invoke them by accident, or have to use them to solve conventional programming problems. However when the need arises, unsafe features are invaluable, for example you might have to do some pointer arithmetic when interfacing directly with C libraries." ;
diff --git a/core/handbook/dataflow.facts b/core/handbook/dataflow.facts
deleted file mode 100644 (file)
index 70015ec..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-USING: errors help kernel namespaces threads words ;
-
-ARTICLE: "dataflow" "Data and control flow"
-{ $subsection "shuffle-words" }
-{ $subsection "quotations" }
-{ $subsection "combinators" }
-{ $subsection "conditionals" }
-{ $subsection "interpreter" }
-{ $subsection "continuations" } ;
-
-ARTICLE: "shuffle-words" "Shuffle words"
-"Shuffle words rearrange items at the top of the data stack. They control the flow of data between words that perform actions."
-$terpri
-"Removing stack elements:"
-{ $subsection drop }
-{ $subsection 2drop }
-{ $subsection 3drop }
-{ $subsection nip }
-{ $subsection 2nip }
-"Duplicating stack elements:"
-{ $subsection dup }
-{ $subsection 2dup }
-{ $subsection 3dup }
-{ $subsection dupd }
-{ $subsection over }
-{ $subsection pick }
-{ $subsection tuck }
-"Permuting stack elements:"
-{ $subsection swap }
-{ $subsection rot }
-{ $subsection -rot }
-{ $subsection 2swap }
-{ $subsection swapd }
-"Sometimes an additional storage area is needed to hold objects. The " { $emphasis "retain stack" } " is an auxilliary stack for this purpose. Objects can be moved between the data and retain stacks using the following two words:"
-{ $subsection >r }
-{ $subsection r> }
-"The top of the data stack is ``hidden'' between " { $link >r } " and " { $link r> } ":"
-{ $example "1 2 3 >r .s r>" "2\n1" }
-"Words must not leave objects on the retain stack, nor expect values to be there on entry. The retain stack is for local storage within a word only, and occurrences of " { $link >r } " and " { $link r> } " must be balanced inside a single quotation. One exception is the following trick involving " { $link if } "; values may be pushed on the retain stack before the condition value is computed, as long as both branches of the " { $link if } " pop the values off the retain stack before returning:"
-{ $code
-    ": foo ( m ? n -- m+n/n )"
-    "    >r [ r> + ] [ drop r> ] if ; ! This is OK"
-} ;
-
-ARTICLE: "quotations" "Quotations"
-"Conceptually, a quotation is a snippet of code which can be passed around and called. Concretely, a quotation is a sequence of objects, some of which may be words. When evaluating a quotation, the interpreter looks at each element in turn, and executes words while pushing other types of objects on the stack. Details can be found in " { $link "interpreter" } "."
-$terpri
-"Quotation literal syntax is documented in " { $link "syntax-quots" } "."
-$terpri
-"Quotations implement the sequence protocol (" { $link "sequences" } "). Much of the power of Factor comes from the fact that not only can you have literal quotations in your program, but you can also construct new quotations at run time using general sequence words, or the following quotation-specific words:"
-{ $subsection unit }
-{ $subsection literalize }
-{ $subsection curry }
-{ $subsection alist>quot } ;
-
-ARTICLE: "combinators" "Combinators"
-"The following pair of words invoke the interpreter reflectively:"
-{ $subsection call }
-{ $subsection execute }
-"These words are used to implement " { $emphasis "combinators" } ", which are words that take code from the stack. Combinator definitions must be followed by the " { $link POSTPONE: inline } " declaration in order to compile; for example:"
-{ $code
-    ": keep ( x quot -- x | quot: x -- )"
-    "    over >r call r> ; inline"
-}
-"Word inlining is documented in " { $link "declarations" } "."
-$terpri
-"There are some words that combine shuffle words with " { $link call } ". They are useful for implementing higher-level combinators."
-{ $subsection slip }
-{ $subsection 2slip }
-{ $subsection keep }
-{ $subsection 2keep }
-{ $subsection 3keep }
-{ $subsection 2apply } ;
-
-ARTICLE: "conditionals" "Conditionals and boolean logic"
-"In Factor, any object that is not " { $link f } " has a true boolean value, and " { $link f } " has a false boolean value."
-$terpri
-"The basic conditionals:"
-{ $subsection if }
-{ $subsection when }
-{ $subsection unless }
-"A form encapsulating a common stack shuffle pattern:"
-{ $subsection if* }
-{ $subsection when* }
-{ $subsection unless* }
-"Another form encapsulating a common stack shuffle pattern:"
-{ $subsection ?if }
-"A form used when multiple conditional tests are to be performed:"
-{ $subsection cond }
-"Sometimes instead of executing one of two quotations, you just need to pick one of two values:"
-{ $subsection ? }
-"There are some logical operations on booleans:"
-{ $subsection >boolean }
-{ $subsection and }
-{ $subsection or } ;
-
-ARTICLE: "interpreter" "The interpreter"
-"The interpreter runs in a loop which repeatedly performs the following steps:"
-{ $list
-    { "If the end of the current quotation has been reached, the parent quotation is popped from the call stack and execution resumes from the saved location" }
-    { "Otherwise, the interpreter performs an action depending on the type of the object at the instruction pointer:"
-        { $list
-            { { $emphasis "Symbol word" } " - pushed on the data stack. See " { $link "symbols" } }
-            { { $emphasis "Compound word" } " - the associated quotation is called. See " { $link "colon-definition" } }
-            { { $emphasis "Compiled or primitive word" } " - the interpreter jumps to machine code. See " { $link "primitives" } }
-            { { $emphasis "Undefined word" } " -  an error is raised. See " { $link "deferred" } }
-            { { $emphasis "Wrapper" } " - the wrapped object is pushed on the data stack. Wrappers are used to push word objects directly on the stack when they would otherwise execute. See the " { $link POSTPONE: \ } " parsing word." }
-            { "All other types of objects are pushed on the data stack." }
-        }
-    }
-}
-"At each stage, the instruction pointer is advanced by one position."
-$terpri
-"If the instruction pointer is at the end of a quotation when a nested quotation is called, the quotation which just finished executing is not pushed on the call stack. Therefore the last call in a quotation does not grow the call stack, and tail recursion executes in bounded space."
-$terpri
-"The compiler generates machine code which perform the steps in a more efficient manner than the interpreter, however the observable semantics remain the same." ;
-
-ARTICLE: "continuations" "Continuations"
-"At any point in the execution of a program, the " { $emphasis "current continuation" } " represents the future of the computation. This object can be reified with the following two words:"
-{ $subsection callcc0 }
-{ $subsection callcc1 }
-"Another two words resume continuations:"
-{ $subsection continue }
-{ $subsection continue-with }
-"Continuations serve as the building block for a number of higher-level abstractions."
-{ $subsection "errors" }
-{ $subsection "threads" }
-{ $subsection "continuations-internals" } ;
-
-ARTICLE: "errors" "Error handling"
-"Support for handling exceptional situations such as bad user input, implementation bugs, and input/output errors is provided by a set of words built using continuations."
-$terpri
-"Two words raise an error in the innermost error handler for the current dynamic extent:"
-{ $subsection throw }
-{ $subsection rethrow }
-"A set of words establish an error handler:"
-{ $subsection cleanup }
-{ $subsection recover }
-{ $subsection catch }
-"Caught errors can be logged in human-readable form:"
-{ $subsection error. }
-{ $subsection try }
-"Information relating to the most recently thrown error is stored in a pair of global variables:"
-{ $subsection error }
-{ $subsection error-continuation }
-"Support for recoverable errors is built on top of the basic error handling facility. The following word signals a recoverable error:"
-{ $subsection condition }
-"Unhandled errors are reported in the listener and can be debugged using various tools. See " { $link "debugger" } "." ;
-
-ARTICLE: "threads" "Multitasking"
-"Continuations are used to implements co-operative multitasking, where the runtime switches between threads during I/O calls, and explicit yields."
-{ $subsection in-thread }
-{ $subsection yield }
-{ $subsection sleep }
-{ $subsection stop }
-"Multitasking relies on a very simple round-robin scheduler:"
-{ $subsection run-queue }
-{ $subsection sleep-queue }
-{ $subsection schedule-thread }
-{ $subsection schedule-thread-with } ;
-
-ARTICLE: "continuations-internals" "Continuation implementation details"
-"A continuation is simply a tuple holding the contents of the five stacks:"
-{ $subsection continuation }
-"The five stacks can be read and written:"
-{ $subsection datastack }
-{ $subsection set-datastack }
-{ $subsection retainstack }
-{ $subsection set-retainstack }
-{ $subsection callstack }
-{ $subsection set-callstack }
-{ $subsection namestack }
-{ $subsection set-namestack }
-{ $subsection catchstack }
-{ $subsection set-catchstack } ;
diff --git a/core/handbook/handbook.facts b/core/handbook/handbook.facts
deleted file mode 100644 (file)
index 9ea0237..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-USING: alien errors generic hashtables help inference tools
-io-internals io libc math-internals modules namespaces parser
-prettyprint queues sequences sequences-internals test words 
-kernel generic ;
-
-ARTICLE: "handbook" "Factor documentation"
-{ $subsection "changes" }
-"If you are new to Factor, please read the cookbook first."
-{ $subsection "cookbook" }
-{ $heading "Language reference" }
-{ $subsection "conventions" }
-{ $subsection "syntax" }
-{ $subsection "dataflow" }
-{ $subsection "words" }
-{ $subsection "objects" }
-{ $subsection "math" }
-{ $subsection "collections" }
-{ $subsection "streams" }
-{ $subsection "parser" }
-{ $subsection "prettyprint" }
-{ $subsection "alien" }
-{ $heading "Environment reference" }
-{ $subsection "cli" }
-{ $subsection "tools" }
-{ $subsection "modules" }
-{ $subsection "help" }
-{ $subsection "inference" }
-{ $subsection "compiler" }
-{ $heading "Graphical user interface" }
-{ $subsection "ui-tools" }
-{ $subsection "gadgets" }
-{ $heading "Currently-loaded contributed modules" }
-{ $outliner [ modules-help ] }
-{ $heading "Index" }
-{ $subsection "article-index" }
-{ $subsection "error-index" }
-{ $subsection "type-index" }
-{ $subsection "class-index" }
-{ $subsection "primitive-index" } ;
-
-ARTICLE: "article-index" "Article index"
-{ $outliner [ articles get hash-keys ] } ;
-
-ARTICLE: "primitive-index" "Primitive index"
-{ $outliner [ all-words [ primitive? ] subset ] } ;
-
-ARTICLE: "error-index" "Error index"
-{ $outliner [ all-errors ] } ;
-
-ARTICLE: "type-index" "Type index"
-{ $outliner [ builtins get [ ] subset ] } ;
-
-ARTICLE: "class-index" "Class index"
-{ $outliner [ classes ] } ;
diff --git a/core/handbook/hashtables.facts b/core/handbook/hashtables.facts
deleted file mode 100644 (file)
index 774110b..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-USING: hashtables hashtables-internals help io-internals kernel
-kernel-internals namespaces queues ;
-
-ARTICLE: "hashtables" "Hashtables"
-"A hashtable provides efficient (expected constant time) lookup and storage of key/value pairs. Keys are compared for equality, and a hashing function is used to reduce the number of comparisons made."
-$terpri
-"Hashtable words are in the " { $vocab-link "hashtables" } " vocabulary. Unsafe implementation words are in the " { $vocab-link "hashtables-internals" } " vocabulary."
-$terpri
-"Hashtables form a class of objects."
-{ $subsection hashcode }
-{ $subsection hashtable? }
-"You can create a new hashtable with an initial capacity."
-{ $subsection <hashtable> }
-"If you don't care about initial capacity, a more elegant way to create a new hashtable is to write:"
-{ $code "H{ } clone" }
-"There are some primitive operations on hashes, and many utilities."
-{ $subsection "hashtables-lookup" }
-{ $subsection "hashtables-mutation" }
-{ $subsection "hashtables-combinators" }
-{ $subsection "hashtables-utilities" }
-{ $subsection "hashtables-internals" } ;
-
-ARTICLE: "hashtables-lookup" "Looking up keys in hashtables"
-{ $subsection hash }
-{ $subsection hash* }
-{ $subsection ?hash }
-{ $subsection ?hash* }
-{ $subsection hash-member? } ;
-
-ARTICLE: "hashtables-mutation" "Storing keys in hashtables"
-{ $subsection set-hash }
-{ $subsection remove-hash }
-{ $subsection clear-hash } ;
-
-ARTICLE: "hashtables-combinators" "Hashtable combinators"
-"We have the standard functional programming idioms."
-{ $subsection hash-each }
-{ $subsection hash-all? }
-{ $subsection hash-subset }
-"There are curried forms of the above."
-{ $subsection hash-each-with }
-{ $subsection hash-all-with? }
-{ $subsection hash-subset-with }
-"Two oddball combinators."
-{ $subsection cache }
-{ $subsection map>hash } ;
-
-ARTICLE: "hashtables-utilities" "Hashtable utilities"
-"Set-theoretic operations exploit the expected constant lookup time of a hashtable."
-{ $subsection hash-intersect }
-{ $subsection hash-diff }
-{ $subsection hash-union }
-{ $subsection hash-update }
-{ $subsection remove-all }
-"A combinator used to implement notions of nested scope. This includes various fundamental abstractions like variables, vocabulary search and cascading styles."
-{ $subsection hash-stack } ;
-
-ARTICLE: "hashtables-internals" "Hashtable implementation details"
-"This hashtable implementation uses only one auxilliary array in addition to the hashtable tuple itself. The array stores keys in even slots and values in odd slots. Values are looked up with a hashing strategy that uses linear probing to resolve collisions."
-{ $terpri }
-"There are two special objects: the " { $link ((tombstone)) } " marker and the " { $link ((empty)) } " marker. Neither of these markers can be used as hashtable keys."
-{ $terpri }
-"The " { $link hash-count } " slot is the number of entries including deleted entries, and " { $link hash-deleted } " is the number of deleted entries."
-{ $subsection <hash-array> }
-{ $subsection nth-pair }
-{ $subsection set-nth-pair }
-{ $subsection each-pair }
-{ $subsection all-pairs? } ;
-
-ARTICLE: "namespaces" "Variables and namespaces"
-"A variable is an entry in a hashtable of bindings, with the hashtable being implicit rather than passed on the stack. These hashtables are termed " { $emphasis "namespaces" } ". Nesting of scopes is implemented with a search order on namespaces, defined by a " { $emphasis "namestack" } ". Since namespaces are just hashtables, any object can be used as a variable, however by convention, variables are keyed by symbols (see " { $link "symbols" } ")."
-$terpri
-"The " { $snippet "get" } " and " { $snippet "set" } " words read and write variable values. The " { $snippet "get" } " word searches up the chain of nested namespaces, while " { $snippet "set" } " always sets variable values in the current namespace only. Namespaces are dynamically scoped; when a quotation is called from a nested scope, any words called by the quotation also execute in that scope."
-{ $subsection get }
-{ $subsection set }
-"Various utility words abstract away common variable access patterns:"
-{ $subsection "namespaces-change" }
-{ $subsection "namespaces-combinators" }
-{ $subsection "namespaces-utilities" }
-"A useful facility for constructing sequences by holding an accumulator sequence in a variable:"
-{ $subsection "namespaces-make" }
-"Implementation details your code probably does not care about:"
-{ $subsection "namespaces-internals" } ;
-
-ARTICLE: "namespaces-combinators" "Namespace combinators"
-{ $subsection make-hash }
-{ $subsection with-scope }
-{ $subsection bind } ;
-
-ARTICLE: "namespaces-change" "Ways to change variable values"
-{ $subsection on }
-{ $subsection off }
-{ $subsection inc }
-{ $subsection dec }
-{ $subsection change } ;
-
-ARTICLE: "namespaces-utilities" "Namespace utilities"
-{ $subsection namespace }
-{ $subsection nest }
-{ $subsection global }
-{ $subsection set-global } ;
-
-ARTICLE: "namespaces-make" "Constructing sequences"
-"There is a lexicon of words for constructing sequences without passing the partial sequence being built on the stack. This reduces stack noise."
-{ $subsection make }
-{ $subsection , }
-{ $subsection % }
-{ $subsection # } ;
-
-ARTICLE: "namespaces-internals" "Namespace implementation details"
-"The namestack holds namespaces."
-{ $subsection namestack }
-{ $subsection set-namestack }
-"A pair of words push and pop namespaces on the namestack."
-{ $subsection >n }
-{ $subsection n> } ;
diff --git a/core/handbook/help.facts b/core/handbook/help.facts
deleted file mode 100644 (file)
index 7215ff4..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-USING: help ;
-
-ARTICLE: "help" "The help system"
-"The help system maintains documentation written in a simple markup language, along with cross-referencing and search. Documentation can either exist as free-standing " { $emphasis "articles" } " or be associated with words."
-{ $subsection "browsing-help" }
-{ $subsection "writing-help" } ;
-
-ARTICLE: "browsing-help" "Browsing documentation"
-"The easiest way to browse the help is from the help browser tool in the UI, however you can also display help topics in the listener."
-{ $subsection handbook }
-"Help topics are identified by article name strings, or words. You can request a specific help topic:"
-{ $subsection help } ;
-
-ARTICLE: "writing-help" "Writing documentation"
-"By convention, documentation is written in files with the " { $snippet ".facts" } " filename extension. Module documentation should follow a few conventions documented in " { $link "documenting-modules" } "."
-$terpri
-"A pair of parsing words are used to define free-standing articles and to associate documentation with words:"
-{ $subsection POSTPONE: ARTICLE: }
-{ $subsection POSTPONE: HELP: }
-"The " { $emphasis "content" } " in both cases is a " { $emphasis "markup element" } ", a recursive structure taking one of the following forms:"
-{ $list
-    { "a string," }
-    { "an array of markup elements," }
-    { "or an array of the form " { $snippet "{ $directive content... }" } ", where " { $snippet "$directive" } " is a markup word whose name starts with " { $snippet "$" } ", and " { $snippet "content..." } " is a series of markup elements" }
-}
-"Markup elements are therefore effectively just Factor objects, written using Factor syntax."
-{ $subsection "printing-elements" }
-{ $subsection "element-types" } ;
-
-ARTICLE: "printing-elements" "Printing markup elements"
-"When writing documentation, it is useful to be able to print markup elements for testing purposes. Markup elements which are strings or arrays of elements are printed in the obvious way. Markup elements of the form " { $snippet "{ $directive content... }" } " are printed by executing the " { $snippet "$directive" } " word with the element content on the stack."
-{ $subsection print-element }
-{ $subsection print-content } ;
-
-ARTICLE: "element-types" "Element types"
-"Markup elements can be classified into two broad categories, block elements and span elements. Block elements are inset with newlines before and after, whereas span elements flow with the paragraph text."
-{ $subsection "span-elements" }
-{ $subsection "block-elements" }
-{ $subsection "markup-utils" } ;
-
-ARTICLE: "span-elements" "Span elements"
-{ $subsection $emphasis }
-{ $subsection $link }
-{ $subsection $snippet }
-{ $subsection $url } ;
-
-ARTICLE: "block-elements" "Block elements"
-"The following are the standard headings found in word documentation:"
-{ $subsection $values }
-{ $subsection $description }
-{ $subsection $contract }
-{ $subsection $examples }
-{ $subsection $warning }
-{ $subsection $notes }
-{ $subsection $side-effects }
-{ $subsection $errors }
-{ $subsection $see-also }
-"Some additional elements:"
-{ $subsection $code }
-{ $subsection $curious }
-{ $subsection $example }
-{ $subsection $heading }
-{ $subsection $links }
-{ $subsection $list }
-{ $subsection $markup-example }
-{ $subsection $references }
-{ $subsection $see }
-{ $subsection $subsection }
-{ $subsection $table } ;
-
-ARTICLE: "markup-utils" "Markup element utilities"
-"Utility words to assist in defining new elements:"
-{ $subsection simple-element }
-{ $subsection ($span) }
-{ $subsection ($block) } ;
diff --git a/core/handbook/inference.facts b/core/handbook/inference.facts
deleted file mode 100644 (file)
index 87d012f..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-USING: help inference interpreter kernel math sequences gadgets ;
-
-ARTICLE: "effect-declaration" "Stack effect declaration"
-"It is good practice to declare the stack effects of words using the following syntax:"
-{ $code ": sq ( x -- y ) dup * ;" }
-"A stack effect declaration is written in parentheses and lists word inputs and outputs, separated by " { $snippet "--" } ". Stack effect declarations are read in using a parsing word:"
-{ $subsection POSTPONE: ( }
-"Stack elements in a stack effect are ordered so that the top of the stack is on the right side. Each value can be named by a data type or description. The following are some examples of value names:"
-{ $table
-    { { { $snippet "?" } } "a boolean" }
-    { { { $snippet "elt" } } "an object which is an element of a sequence" }
-    { { { $snippet "m" } ", " { $snippet "n" } } "an integer" }
-    { { { $snippet "obj" } } "an object" }
-    { { { $snippet "quot" } } "a quotation" }
-    { { { $snippet "seq" } } "a sequence" }
-    { { { $snippet "str" } } "a string" }
-    { { { $snippet "x" } ", " { $snippet "y" } ", " { $snippet "z" } } "a number" }
-    { { $snippet "loc" } "a screen location specified as a two-element array holding x and y co-ordinates" }
-    { { $snippet "dim" } "a screen dimension specified as a two-element array holding width and height values" }
-    { { $snippet "rect" } { "a " { $link rect } } }
-    { { $snippet "*" } "when this symbol appears by itself in the list of outputs, it means the word unconditionally throws an error" }
-}
-"The stack effect inferencer verifies stack effect comments to ensure the correct number of inputs and outputs is listed. Value names are ignored; only their number matters. If a word's declared stack effect does not match its inferred stack effect, a " { $link effect-error } " is thrown."
-$terpri
-"Recursive words must declare a stack effect in order to compile. This includes all generic words, due to how delegation is implemented." ;
-
-ARTICLE: "inference-simple" "Straight-line stack effects"
-"The simplest case to look at is that of a quotation which does not have any branches or recursion, and just pushes literals and calls words, each of which has a known stack effect."
-$terpri
-"Stack effect inference works by stepping through the quotation, while maintaining a \"shadow stack\" which tracks stack height at the current position in the quotation. Initially, the shadow stack is empty. If a word is encountered which expects more values than there are on the shadow stack, a global counter is incremented. This counter keeps track of the number of inputs the quotation expects on the stack. When inference is done, this counter, together with the final height of the shadow stack, gives the inferred stack effect."
-{ $subsection d-in }
-{ $subsection meta-d }
-"When a literal is encountered, it is simply pushed on the shadow stack. For example, the stack effect of the following quotation is inferred by pushing all three literals on the shadow stack, then taking the value of " { $link d-in } " and the length of " { $link meta-d } ":"
-{ $example "[ 1 2 3 ] infer." "* Stack effect:\n( -- object object object )" }
-"In the following example, the call to " { $link + } " expects two values on the shadow stack, but only one value is present, the literal which was pushed previously. This increments the " { $link d-in } " counter by one:"
-{ $example "[ 2 + ] infer." "* Stack effect:\n( object -- object )" }
-"After the call to " { $link + } ", the shadow stack contains a \"computed value placeholder\", since the inferencer has no way to know what the resulting value actually is (in fact it is arbitrary)." ;
-
-ARTICLE: "inference-combinators" "Combinator stack effects"
-"Without further information, one cannot say what the stack effect of " { $link call } " is; it depends on the given quotation. If the inferencer encounters a " { $link call } " when the top of the stack is a computed value placeholder, a " { $link literal-expected } " error is raised."
-{ $example "[ [ + ] append call ] infer." "... an error ..." }
-"On the other hand, applying " { $link call } " to a literal value behaves as if the quotation was substituted at that point:"
-{ $example "[ [ 2 + ] call ] infer." "* Stack effect:\n( object -- object )" }
-"Consider a combinator such as " { $link keep } ". The combinator itself does not have a stack effect. However, since the combinator is declared " { $link POSTPONE: inline } ", a given usage of it can have a stack effect:"
-{ $example "[ [ 2 + ] keep ] infer." "* Stack effect:\n( object -- object object )" }
-"In general, combinators must be declared " { $link POSTPONE: inline } " so that we can infer the stack effects of words that call them with literal quotations."
-$terpri
-"Here is an example where the stack effect cannot be inferred:"
-{ $code ": foo 0 [ + ] ;" "[ foo reduce ] infer." }
-"However if " { $snippet "foo" } " was declared " { $link POSTPONE: inline } ", everything would work, since the " { $link reduce } " combinator is also " { $link POSTPONE: inline } ", and the inferencer can see the literal quotation value at the point it is passed to " { $link call } ":"
-{ $example ": foo 0 [ + ] ; inline" "[ foo reduce ] infer." "* Stack effect:\n( object -- object )" } ;
-
-ARTICLE: "inference-branches" "Branch stack effects"
-"Conditionals such as " { $link if } " and combinators built on " { $link if } " present a problem, in that if the two branches leave the stack at a different height, it is not clear what the stack effect should be. In this case, inference throws a " { $link unbalanced-branches-error } "."
-$terpri
-"If all branches leave the stack at the same height, then the stack effect of the conditional is just the maximum of the stack effect of each branch. For example,"
-{ $example "[ [ + ] [ drop ] if ] infer." "* Stack effect:\n( object object object -- object )" }
-"The call to " { $link if } " takes one value from the stack, a generalized boolean. The first branch " { $snippet "[ + ]" } " has stack effect " { $snippet "( x x -- x )" } " and the second has stack effect " { $snippet "( x -- )" } ". Since both branches decrease the height of the stack by one, we say that the stack effect of the two branches is " { $snippet "( x x -- x )" } ", and together with the boolean popped off the stack by " { $link if } ", this gives a total stack effect of " { $snippet "( x x x -- x )" } "." ;
-
-ARTICLE: "inference-recursive" "Stack effects of recursive words"
-"Recursive words must declare a stack effect. When a recursive call is encountered, the declared stack effect is substituted in. When inference is complete, the inferred stack effect is compared with the declared stack effect."
-$terpri
-"Attempting to infer the stack effect of a recursive word which outputs a variable number of objects on the stack will fail. For example, the following will throw an " { $link unbalanced-branches-error } ":"
-{ $code ": foo ( seq -- ) dup empty? [ drop ] [ dup pop foo ] if" "[ foo ] infer." }
-"If you declare an incorrect stack effect, inference will fail also. Badly defined recursive words cannot confuse the inferencer." ;
-
-ARTICLE: "inference-limitations" "Inference limitations"
-"Mutually recursive words are supported, but mutually recursive " { $emphasis "inline" } " words are not."
-$terpri
-"An inline recursive word cannot pass a quotation through the recursive call. For example, the following will not infer:"
-{ $code ": foo ( a b c -- d e f ) [ f foo drop ] when 2dup call ; inline" "[ 1 [ 1+ ] foo ] infer ." }
-"However a small change can be made:"
-{ $example ": foo ( a b c -- d ) [ 2dup f foo drop ] when call ; inline" "[ 1 [ 1+ ] t foo ] infer ." "{ 0 1 }" }
-"An inline recursive word must have a fixed stack effect in its base case. The following will not infer:"
-{ $code
-    ": foo ( quot ? -- ) [ f foo ] [ call ] if ; inline"
-    "[ [ 5 ] t foo ] infer."
-} ;
-
-ARTICLE: "inference-custom" "Customizing inference behavior"
-"The default inference behavior of a word can be changed by storing a quotation in the " { $snippet "\"infer\"" } " word property."
-$terpri
-"As an example, consider the " { $link cond } " word. It does not have a stack effect, even if it is inlined at a call side where the input quotations are all literal, since it applies " { $link call } " to the result of a sequence operation."
-$terpri
-"However, calls to " { $link cond } " still compile, because " { $link cond } " defines an " { $snippet "\"infer\"" } " word property which converts the " { $link cond } " form into a series of nested " { $link if } " calls at compile time."
-{ $subsection pop-literal }
-{ $subsection infer-quot }
-{ $subsection infer-quot-value } ;
-
-ARTICLE: "inference" "Stack effect inference"
-"The stack effect inference tool is used to check correctness of code before it is run. It is also used by the compiler to build a dataflow graph on which optimizations can be performed. Only words for which a stack effect can be inferred will compile."
-$terpri
-"The main entry point is a single word which takes a quotation and prints its stack effect and variable usage:"
-{ $subsection infer. }
-"Instead of printing the inferred information, it can be returned as objects on the stack:"
-{ $subsection infer }
-"The dataflow graph used by " { $link "compiler" } " and the " { $link "ui-dataflow" } " can be obtained:"
-{ $subsection dataflow }
-"The stack effect inference tool can also check stack effect declarations for corectness:"
-{ $subsection "effect-declaration" }
-"The following articles describe the implementation of the stack effect inference algorithm:"
-{ $subsection "inference-simple" }
-{ $subsection "inference-combinators" }
-{ $subsection "inference-branches" }
-{ $subsection "inference-recursive" } 
-{ $subsection "inference-limitations" } 
-{ $subsection "inference-custom" } ;
diff --git a/core/handbook/load.factor b/core/handbook/load.factor
deleted file mode 100644 (file)
index 361b93c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-PROVIDE: core/handbook
-{ +files+ {
-    "alien.facts"
-    "changes.facts"
-    "cli.facts"
-    "collections.facts"
-    "compiler.facts"
-    "conventions.facts"
-    "cookbook.facts"
-    "dataflow.facts"
-    "handbook.facts"
-    "hashtables.facts"
-    "inference.facts"
-    "math.facts"
-    "objects.facts"
-    "parser.facts"
-    "prettyprinter.facts"
-    "sequences.facts"
-    "streams.facts"
-    "syntax.facts"
-    "modules.facts"
-    "help.facts"
-    "tools.facts"
-    "words.facts"
-} } ;
diff --git a/core/handbook/math.facts b/core/handbook/math.facts
deleted file mode 100644 (file)
index 1dec257..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-USING: help math prettyprint sequences ;
-
-ARTICLE: "math" "Numbers"
-"Factor attempts to preserve natural mathematical semantics for numbers. Multiplying two large integers never results in overflow, and dividing two integers yields an exact ratio. Floating point numbers are also supported, along with complex numbers."
-$terpri
-"Math words are in the " { $vocab-link "math" } " vocabulary. Implementation details are in the " { $vocab-link "math-internals" } " vocabulary."
-{ $subsection "number-protocol" }
-{ $subsection "number-types" }
-{ $subsection "math-functions" }
-{ $subsection "math-constants" }
-{ $subsection "math-vectors" }
-{ $subsection "number-strings" } ;
-
-ARTICLE: "number-types" "Types of numbers"
-{ $subsection "integers" }
-{ $subsection "rationals" }
-{ $subsection "floats" }
-{ $subsection "complex-numbers" } ;
-
-ARTICLE: "division-by-zero" "Division by zero"
-"Floating point division never raises an error if the denominator is zero. This means that if at least one of the two inputs to " { $link / } ", " { $link /f } " or " { $link mod } " is a float, the result will be a floating point infinity or not a number value."
-$terpri
-"The behavior of integer division is hardware specific. On x86 processors, " { $link /i } " and " { $link mod } " raise an error if both inputs are integers and the denominator is zero. On PowerPC, integer division by zero yields a result of zero."
-$terpri
-"On the other hand, the " { $link / } " word, when given integer arguments, implements a much more expensive division algorithm which always yields an exact rational answer, and this word always tests for division by zero explicitly." ;
-
-ARTICLE: "number-protocol" "Number protocol"
-"Math operations obey certain numerical upgrade rules. If one of the inputs is a bignum and the other is a fixnum, the latter is first coerced to a bignum; if one of the inputs is a float, the other is coerced to a float."
-$terpri
-"Two examples where you should note the types of the inputs and outputs:"
-{ $example "3 >fixnum 6 >bignum * class ." "bignum" }
-{ $example "1/2 2.0 + ." "4.5" }
-"The following usual operations are supported by all numbers."
-{ $subsection + }
-{ $subsection - }
-{ $subsection * }
-{ $subsection / }
-"Non-commutative operations take operands from the stack in the natural order; " { $snippet "6 2 /" } " divides 6 by 2."
-{ $subsection "division-by-zero" }
-"Real numbers (but not complex numbers) can be ordered:"
-{ $subsection < }
-{ $subsection <= }
-{ $subsection > }
-{ $subsection >= } ;
-
-ARTICLE: "integers" "Integers"
-{ $subsection integer }
-"Integers come in two varieties -- fixnums and bignums. Fixnums fit in a machine word and are faster to manipulate; if the result of a fixnum operation is too large to fit in a fixnum, the result is upgraded to a bignum. Here is an example where two fixnums are multiplied yielding a bignum:"
-{ $example "134217728 class ." "fixnum" }
-{ $example "128 class ." "fixnum" }
-{ $example "134217728 128 * ." "17179869184" }
-{ $example "134217728 128 * class ." "bignum" }
-"Integers can be entered using a different base; see " { $link "syntax-numbers" } "."
-$terpri
-"Integers can be tested for, and real numbers can be converted to integers:"
-{ $subsection fixnum? }
-{ $subsection bignum? }
-{ $subsection >fixnum }
-{ $subsection >bignum }
-"The " { $link . } " word prints numbers in decimal. A set of words in the " { $vocab-link "prettyprint" } " vocabulary is provided to print integers using another base."
-{ $subsection .b }
-{ $subsection .o }
-{ $subsection .h }
-"Some mathematical operations are only supported on integers."
-{ $subsection "modular-arithmetic" }
-{ $subsection "bitwise-arithmetic" }
-{ $subsection "random-numbers" } ;
-
-ARTICLE: "modular-arithmetic" "Modular arithmetic"
-{ $subsection mod }
-{ $subsection rem }
-{ $subsection /mod }
-{ $subsection /i }
-{ $subsection gcd } ;
-
-ARTICLE: "bitwise-arithmetic" "Bitwise arithmetic"
-"There are two ways of looking at an integer -- as an abstract mathematical entity, or as a string of bits. The latter representation motivates " { $emphasis "bitwise operations" } "."
-{ $subsection bitand }
-{ $subsection bitor }
-{ $subsection bitxor }
-{ $subsection bitnot }
-{ $subsection shift }
-{ $subsection log2 }
-{ $subsection power-of-2? }
-{ $subsection next-power-of-2 } ;
-
-ARTICLE: "random-numbers" "Generating random integers"
-{ $subsection (random-int) }
-{ $subsection random-int } ;
-
-ARTICLE: "rationals" "Rational numbers"
-{ $subsection ratio }
-"When we add, subtract or multiply any two integers, the result is always an integer. However, dividing a numerator by a denominator that is not an integral divisor of the denominator yields a ratio:"
-{ $example "1210 11 / ." "110" }
-{ $example "100 330 / ." "10/33" }
-"Ratios are printed and can be input literally in the form above. Ratios are always reduced to lowest terms by factoring out the greatest common divisor of the numerator and denominator. A ratio with a denominator of 1 becomes an integer. Division with a denominator of 0 throws an error."
-$terpri
-"Ratios behave just like any other number -- all numerical operations work as you would expect."
-{ $example "1/2 1/3 + ." "5/6" }
-{ $example "100 6 / 3 * ." "50" }
-"Ratios can be taken apart:"
-{ $subsection numerator }
-{ $subsection denominator }
-{ $subsection >fraction } ;
-
-ARTICLE: "floats" "Floats"
-"Rational numbers represent " { $emphasis "exact" } " quantities. On the other hand, a floating point number is an " { $emphasis "approximation" } ". While rationals can grow to any required precision, floating point numbers are fixed-width, and manipulating them is usually faster than manipulating ratios or bignums (but slower than manipulating fixnums). Floating point numbers are often used to represent irrational numbers, which have no exact representation as a ratio of two integers."
-$terpri
-"Floating point literals are input with a decimal point."
-{ $example "1.23 1.5 + ." "1.73" }
-"Introducing a floating point number in a computation forces the result to be expressed in floating point."
-{ $example "5/4 1/2 + ." "7/4" }
-{ $example "5/4 0.5 + ." "1.75" }
-"Integers and rationals can be converted to floats:"
-{ $subsection >float }
-"Two real numbers can be divided yielding a float result:"
-{ $subsection /f }
-"Floating point numbers are represented internally in IEEE 754 double-precision format. This internal representation can be accessed for advanced operations and input/output purposes."
-{ $subsection float>bits }
-{ $subsection double>bits }
-{ $subsection bits>float }
-{ $subsection bits>double } ;
-
-ARTICLE: "complex-numbers" "Complex numbers"
-{ $subsection complex }
-"Complex numbers arise as solutions to quadratic equations whose graph does not intersect the " { $emphasis "x" } " axis. Their literal syntax is covered in " { $link "syntax-complex-numbers" } "."
-$terpri
-"Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero."
-$terpri
-"Complex numbers can be taken apart:"
-{ $subsection real }
-{ $subsection imaginary }
-{ $subsection >rect }
-"Complex numbers can be constructed from real numbers:"
-{ $subsection rect> }
-"The polar form can be computed:"
-{ $subsection abs }
-{ $subsection absq }
-{ $subsection arg }
-{ $subsection >polar }
-{ $subsection polar> }
-"Reflection in the " { $snippet "x" } " axis:"
-{ $subsection conjugate } ;
-
-ARTICLE: "math-functions" "Mathematical functions"
-{ $subsection "arithmetic-functions" }
-{ $subsection "power-functions" }
-{ $subsection "trig-hyp-functions" } ;
-
-ARTICLE: "arithmetic-functions" "Arithmetic functions"
-"Computing additive and multiplicative inverses:"
-{ $subsection neg }
-{ $subsection recip }
-"Rounding:"
-{ $subsection ceiling }
-{ $subsection floor }
-{ $subsection truncate } ;
-
-ARTICLE: "power-functions" "Powers and logarithms"
-"Squares:"
-{ $subsection sq }
-{ $subsection sqrt }
-"Exponential and natural logarithm:"
-{ $subsection exp }
-{ $subsection cis }
-{ $subsection log }
-"Raising a number to a power:"
-{ $subsection ^ } ;
-
-ARTICLE: "trig-hyp-functions" "Trigonometric and hyperbolic functions"
-"Trigonometric functions:"
-{ $subsection cos }
-{ $subsection sin }
-{ $subsection tan }
-"Reciprocals:"
-{ $subsection sec }
-{ $subsection cosec }
-{ $subsection cot }
-"Inverses:"
-{ $subsection acos }
-{ $subsection asin }
-{ $subsection atan }
-"Inverse reciprocals:"
-{ $subsection asec }
-{ $subsection acosec }
-{ $subsection acot }
-"Hyperbolic functions:"
-{ $subsection cosh }
-{ $subsection sinh }
-{ $subsection tanh }
-"Reciprocals:"
-{ $subsection sech }
-{ $subsection cosech }
-{ $subsection coth }
-"Inverses:"
-{ $subsection acosh }
-{ $subsection asinh }
-{ $subsection atanh }
-"Inverse reciprocals:"
-{ $subsection asech }
-{ $subsection acosech }
-{ $subsection acoth } ;
-
-ARTICLE: "math-constants" "Constants"
-{ $subsection i }
-{ $subsection -i }
-{ $subsection e }
-{ $subsection pi }
-{ $subsection most-positive-fixnum }
-{ $subsection most-negative-fixnum } ;
-
-ARTICLE: "math-vectors" "Vector arithmetic"
-"Any Factor sequence can be used to represent a mathematical vector."
-$terpri
-"Acting on vectors by a scalar:"
-{ $subsection vneg }
-{ $subsection v*n }
-{ $subsection n*v }
-{ $subsection v/n }
-{ $subsection n/v }
-"Combining two vectors to form another vector using " { $link 2map } ":"
-{ $subsection v+ }
-{ $subsection v- }
-{ $subsection v* }
-{ $subsection v/ }
-{ $subsection vmax }
-{ $subsection vmin }
-"Inner product and norm:"
-{ $subsection v. }
-{ $subsection norm }
-{ $subsection norm-sq }
-{ $subsection normalize } ;
-
-ARTICLE: "number-strings" "Converting between numbers and strings"
-"These words only convert between real numbers and strings. Complex numbers are constructed by the parser (" { $link "parser" } ") and printed by the prettyprinter (" { $link "prettyprint" } ")."
-$terpri
-"Note that only integers can be converted to and from strings using a representation other than base 10. Calling a word such as " { $link >oct } " on a float will give a result in base 10."
-$terpri
-"Converting numbers to strings:"
-{ $subsection number>string }
-{ $subsection >bin }
-{ $subsection >oct }
-{ $subsection >hex }
-{ $subsection >base }
-"Converting strings to numbers:"
-{ $subsection string>number }
-{ $subsection bin> }
-{ $subsection oct> }
-{ $subsection hex> }
-{ $subsection base> }
-"You can also input literal numbers in a different base (" { $link "syntax-integers" } ")." ;
diff --git a/core/handbook/modules.facts b/core/handbook/modules.facts
deleted file mode 100644 (file)
index 251ac18..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-USING: definitions errors help image tools io kernel
-listener memory modules parser prettyprint sequences test
-words shells ;
-
-ARTICLE: "module-organization" "Module organization"
-"Modules are loaded from the Factor directory, and are conventionally placed in one of four subdirectories therein:"
-{ $list
-    { { $snippet "core/" } " - core library and language" }
-    { { $snippet "apps/" } " - complete applications written in Factor" }
-    { { $snippet "libs/" } " - additional libraries written in Factor" }
-    { { $snippet "demos/" } " - small examples demonstrating language features" }
-}
-"A module named " { $snippet "libs/frob" } " must be defined in a file whose name takes one of the following two forms:"
-{ $code "libs/frob.factor" "libs/frob/load.factor" }
-"The former should only be used for very small modules; if your module needs unit tests, documentation or more than one source file (as most do), you need to create a new directory with a " { $snippet "load.factor" } " file in it."
-$terpri
-"When a module takes the latter form, the directory containing the load file is termed the " { $emphasis "module directory" } "." ;
-
-ARTICLE: "using-modules" "Using modules"
-"To load " { $snippet "libs/concurrency" } " for instance, you simply issue the following command in the listener:"
-{ $code "\"libs/concurrency\" require" }
-"The " { $link require } " word will load all dependencies and source files of the " { $snippet "libs/concurrency" } " module."
-{ $subsection require }
-"Some modules are have a main entry point, and can be run much like an application in an operating system:"
-{ $subsection run-module } ;
-
-ARTICLE: "developing-modules" "Developing modules"
-"To create a new module, you must first decide if the module is a single-file module or a directory with a load file; see " { $link "module-organization" } "."
-$terpri
-"If the module depends on other modules, the load file must first load them:"
-{ $subsection POSTPONE: REQUIRES: }
-"Then, it must define the module itself:"
-{ $subsection POSTPONE: PROVIDE: }
-"Finally, it can define a main entry point for use with " { $link run-module } ":"
-{ $subsection POSTPONE: MAIN: }
-"When working on a module, you can automatically reload any changed source files, in the correct order, without having to call " { $link run-file } " manually:"
-{ $subsection reload-modules }
-{ $subsection reset-modified }
-{ $heading "Example " { $snippet "load.factor" } }
-"Here is a simple module definition taken from " { $snippet "apps/tetris/load.factor" } "; it demonstrates all of the above features:"
-{ $code "REQUIRES: libs/lazy-lists ;"
-""
-"PROVIDE: apps/tetris"
-"{ +files+ {"
-"    \"tetris-colours.factor\""
-"    \"tetromino.factor\""
-"    \"tetris-piece.factor\""
-"    \"tetris-board.factor\""
-"    \"tetris.factor\""
-"    \"tetris-gl.factor\""
-"    \"tetris-gadget.factor\""
-"} }"
-"{ +tests+ {"
-"    \"test/tetris-piece.factor\""
-"    \"test/tetris-board.factor\""
-"    \"test/tetris.factor\""
-"} } ;"
-""
-"USE: tetris-gadget"
-""
-"MAIN: apps/tetris tetris-window ;" } ;
-
-ARTICLE: "testing-modules" "Unit testing modules"
-"A unit test is a piece of code which starts with known input values, then compares the output of a word with an expected output, where the expected output is defined by the word's contract."
-$terpri
-"For example, if you were developing a word for computing symbolic derivatives, your unit tests would apply the word to certain input functions, comparing the results against the correct values. While the passing of these tests would not guarantee the algorithm is correct, it would at least ensure that what used to work keeps working, in that as soon as something breaks due to a change in another part of your program, failing tests will let you know."
-$terpri
-"Unit tests are placed in test harness files, separate from the rest of your source code. If the test harness needs to define words, they should be placed in the " { $snippet "temporary" } " vocabulary so that they can be forgotten after the tests have been run. Test harness files mainly consist of calls to the following two words:"
-{ $subsection unit-test }
-{ $subsection unit-test-fails }
-{ $subsection assert-depth }
-"Any non-trivial module should ship with unit tests in the " { $snippet "tests" } " subdirectory of the module directory. Unit test files should be listed in the " { $link +tests+ } " key of the " { $link POSTPONE: PROVIDE: } " form."
-$terpri
-"The following words run test harness files:"
-{ $subsection test-module }
-{ $subsection test-modules } ;
-
-ARTICLE: "documenting-modules" "Documenting modules"
-"Any non-trivial module should ship with documentation. Documentation " { $snippet ".facts" } " files should be listed along with your module's source files in the " { $link +files+ } " key passed to " { $link POSTPONE: PROVIDE: } ", and the main article should be referenced from the " { $link +help+ } " key."
-$terpri
-"Help markup is described in " { $link "writing-help" } ". Since help articles describing the core library have string names, a convention to avoid clashes is to name module help articles by arrays, where the first element is a string identifying the module, and the second identifies the article itself. For example, " { $snippet "{ \"concurrency\" \"processes\" }" } "." ;
-
-ARTICLE: "submitting-modules" "Submitting modules"
-"If you would like to contribute a module you wrote to Factor, please make sure of the following:"
-{ $list
-    { "The module actually is a module, and the load file has a " { $link POSTPONE: PROVIDE: } " form with the correct module name" }
-    { "The module is placed in either the " { $snippet "apps/" } ", " { $snippet "libs/" } " or " { $snippet "demos/" } " directories" }
-    { "The module is listed in the " { $snippet "README.txt" } " and " { $snippet "all.factor" } " files of its parent directory" }
-    "If the module is non-trivial, it should come with unit tests and documentation"
-} ;
-
-ARTICLE: "modules" "Modules and contributed libraries"
-"The module system provides a set of conventions and tools for organizing large bodies of Factor code."
-{ $subsection "module-organization" }
-{ $subsection "using-modules" }
-{ $subsection "developing-modules" }
-{ $subsection "testing-modules" }
-{ $subsection "documenting-modules" }
-{ $subsection "submitting-modules" } ;
diff --git a/core/handbook/objects.facts b/core/handbook/objects.facts
deleted file mode 100644 (file)
index 7cbe26a..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-USING: alien arrays compiler generic help kernel math sequences
-strings vectors words ;
-
-ARTICLE: "objects" "Objects"
-"Objects model data in Factor. Objects have unique identity, and either hold intrinsic value -- for example, an integer object -- or are composed from named slots, each slot holding an object."
-{ $subsection "equality" }
-{ $subsection "generic" }
-{ $subsection "classes" }
-{ $subsection "tuples" } ;
-
-ARTICLE: "equality" "Equality and comparison testing"
-"There are two distinct notions of ``sameness'' when it comes to objects. You can test if two references point to the same object, or you can test if two objects are equal in some sense, usually by being instances of the same class, and having equal slot values. Both notions of equality are equality relations in the mathematical sense."
-{ $subsection eq? }
-{ $subsection = }
-"Some types of objects also have an intrinsic order allowing sorting using " { $link natural-sort } ":"
-{ $subsection <=> }
-"An object can be cloned; the clone has distinct identity but equal value:"
-{ $subsection clone } ;
-
-ARTICLE: "generic" "Generic words and methods"
-"A generic word's behavior depends on the class of the object at the top of the stack, although this can be generalized using custom method combination. A specific behavior of a generic word on a class is called a " { $emphasis "method" } "."
-$terpri
-"The key advantage of a generic word over a set of conditional tests is that methods are defined in a decentralized manner, thus adding new methods does not force unnecessary coupling between code."
-$terpri
-"In the overwhelming majority of cases, your interaction with the generic word system centers on two parsing words:"
-{ $subsection POSTPONE: GENERIC: }
-{ $subsection POSTPONE: M: }
-"Generic words must declare their stack effect in order to compile. See " { $link "effect-declaration" } "."
-$terpri
-"Since classes are not linearly ordered, method ordering is an issue to keep in mind."
-{ $subsection "method-order" }
-"Generic word dispatch can be customized:"
-{ $subsection "method-combination" } ;
-
-ARTICLE: "method-order" "Method ordering"
-"It is possible that two classes have a non-empty intersectionand neither is a subclass of the other. This means there is no canonical linear ordering of classes."
-$terpri
-"Consider the following set of definitions:"
-{ $code
-    "GENERIC: explain"
-    "M: general-t explain drop \"a true value\" print ;"
-    "M: immediate explain drop \"a tagged immediate\" print ;"
-    "M: object explain drop \"an object\" print ;"
-}
-"Neither " { $link general-t } " nor " { $link immediate } " are subclasses of each other, yet their intersection is the non-empty " { $link POSTPONE: f } " class. So the generic word system will place " { $link object } " first in the method order, however either " { $link general-t } " or " { $link immediate } " may come next, and it is pretty much a random choice that depends on hashing:"
-{ $example "\\ bar order ."  "{ object general-list general-t }" }
-"Therefore, the outcome of calling " { $snippet "bar" } " with " { $link f } " on the stack is undefined."
-$terpri
-"As you can see above, the " { $link order } " word can be useful to clarify method dispatch."
-{ $subsection order } ;
-
-ARTICLE: "method-combination" "Method combination"
-"Abstractly, a generic word can be thought of as a big chain of type conditional tests applied to the top of the stack, with methods as the bodies of each test. The " { $emphasis "method combination" } " is this control flow glue between the set of methods, and several aspects of it can be customized:"
-{ $list
-    "which stack item(s) the generic word dispatches upon,"
-    "which methods out of the set of applicable methods are called"
-}
-"The " { $link POSTPONE: GENERIC: } " parsing word creates a generic word using the " { $emphasis "simple method combination" } ". Most generic words that come up in practice use this method combination:"
-{ $subsection standard-combination }
-"The " { $link POSTPONE: G: } " parsing word allows a different method combination to be specified:"
-{ $subsection POSTPONE: G: }
-"The simple method combination is a special case of the standard method combination:"
-{ $subsection standard-combination }
-"Another combination for arithmetic operators:"
-{ $subsection math-combination }
-"If nothing else will do:"
-{ $subsection "custom-combination" } ;
-
-ARTICLE: "custom-combination" "Custom method combination"
-"Developing a custom method combination requires a good understanding of higher-order programming (code that writes code) and Factor internals. Custom method combination has not been fully explored at this stage of Factor development, and this section can only give a brief sketch of what is involved."
-$terpri
-"A method combination quotation has stack effect " { $snippet "( word -- quot )" } "."
-$terpri
-"Generic words can be introspected:"
-{ $subsection methods }
-"Code generation utilities:"
-{ $subsection alist>quot }
-{ $subsection curry }
-"Generic word generation utilities:"
-{ $subsection class-predicates }
-{ $subsection simplify-alist }
-{ $subsection math-upgrade }
-{ $subsection object-method } ;
-
-ARTICLE: "classes" "Classes"
-"A class is a set of objects on which generic words can specialize methods. Classes are organized into a general partial order, and an object may be an instance of more than one class."
-$terpri
-"You can ask an object for its class:"
-{ $subsection class }
-"Each class has a membership predicate named after the class with a \"?\" suffix, with the following two exceptions:"
-{ $list
-    { { $link object } " - there is no need for a predicate word, since every object is an instance of this class" }
-    { { $link null } " - there is no need for a predicate word, since no object is an instance of this class" }
-    { { $link general-t } " - there is no need for a predicate word, since the " { $link if } " combinator makes an implicit test for instances of this class" }
-}
-"There is a universal class which all objects are an instance of, and an empty class with no instances:"
-{ $subsection object }
-{ $subsection null }
-"Other sorts of clases are described next."
-{ $subsection "builtin-classes" }
-{ $subsection "unions" }
-{ $subsection "predicates" }
-{ $subsection "class-operations" } ;
-
-ARTICLE: "builtin-classes" "Built-in classes"
-"Every object is an instance of to exactly one canonical " { $emphasis "built-in class" } " which defines its layout in memory and basic behavior:"
-{ $subsection alien }
-{ $subsection array }
-{ $subsection bignum }
-{ $subsection byte-array }
-{ $subsection complex }
-{ $subsection dll }
-{ $subsection f }
-{ $subsection fixnum }
-{ $subsection float }
-{ $subsection ratio }
-{ $subsection quotation }
-{ $subsection sbuf }
-{ $subsection string }
-{ $subsection t }
-{ $subsection tuple }
-{ $subsection vector }
-{ $subsection word }
-{ $subsection wrapper }
-"There is a class of built-in classes:"
-{ $subsection builtin } ;
-
-ARTICLE: "unions" "Union classes"
-"An object is an instance of a union class if it is an instance of one of its members. Union classes are used to associate the same method with several different classes, as well as to conveniently define predicates."
-{ $subsection POSTPONE: UNION: }
-{ $subsection define-union }
-{ $subsection union } ;
-
-ARTICLE: "predicates" "Predicate classes"
-"Predicate classes allow fine-grained control over method dispatch."
-{ $subsection POSTPONE: PREDICATE: }
-{ $subsection define-predicate-class }
-{ $subsection predicate } ;
-
-ARTICLE: "class-operations" "Class operations"
-{ $subsection class< }
-{ $subsection class-compare }
-{ $subsection class-and }
-{ $subsection types } ;
-
-ARTICLE: "tuples" "Tuples"
-"Tuples are user-defined classes composed of named slots. A new tuple class can be defined as follows:"
-{ $code "TUPLE: person name address phone ;" }
-"This defines a class word named " { $snippet "person" } ", along with a predicate " { $snippet "person?" } ", a default constructor " { $snippet "<person>" } ", and the following reader/writer words:"
-{ $table
-    { "Reader" "Writer" }
-    { { $snippet "person-name" }    { $snippet "set-person-name" }    }
-    { { $snippet "person-address" } { $snippet "set-person-address" } }
-    { { $snippet "person-phone" }   { $snippet "set-person-phone" }   }
-}
-"A parsing word defines tuple classes."
-{ $subsection POSTPONE: TUPLE: }
-{ $subsection "tuple-constructors" }
-{ $subsection "tuple-delegation" } ;
-
-ARTICLE: "tuple-constructors" "Constructors and slots"
-"New instances of tuple classes are created by calling a constructor word, whose name is the tuple's name surrounded by angle brackets:"
-{ $code "TUPLE: point x y z ;\n1 2 3 <point>" }
-"The default constructor stores stack elements into consecutive slots, with the top of the stack going into the rightmost slot."
-$terpri
-"After construction, slots are read and written using various automatically-defined words with names of the form " { $snippet { $emphasis "class-slot" } } " and " { $snippet "set-" { $emphasis "class-slot" } } "."
-$terpri
-"Custom constructors can be defined:"
-{ $subsection POSTPONE: C: } ;
-
-ARTICLE: "tuple-delegation" "Delegation"
-"If a generic word having the " { $link standard-combination } " method combination is called on a tuple for which it does not have an applicable method, the method call is forwarded to the tuple's " { $emphasis "delegate" } ". If no delegate is set, a " { $link no-method } " error is thrown."
-{ $subsection delegate }
-{ $subsection set-delegate }
-"A tuple's delegate should either be another tuple, or " { $link f } ", indicating no delegate is set. Delegation from a tuple to an object of some other type is not fully supported and should be used with caution."
-$terpri
-"Factor uses delegation in place of implementation inheritance, but it is not a direct substitute; in particular, the semantics differ in that a delegated method call receives the delegate on the stack, not the original object."
-$terpri
-"A pair of words examine delegation chains:"
-{ $subsection delegates }
-{ $subsection is? }
-"An example:"
-{ $example
-    "TUPLE: ellipse center radius ;"
-    "TUPLE: colored color ;"
-    "{ 0 0 } 10 <ellipse> \"my-ellipse\" set"
-    "{ 1 0 0 } <colored> \"my-shape\" set"
-    "\"my-ellipse\" get \"my-shape\" get set-delegate"
-    "\"my-shape\" get dup colored-color swap ellipse-center .s"
-    "{ 0 0 }\n{ 1 0 0 }"
-} ;
diff --git a/core/handbook/parser.facts b/core/handbook/parser.facts
deleted file mode 100644 (file)
index 5877236..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-USING: help io parser sequences words ;
-
-ARTICLE: "parser" "The parser"
-"This section concerns itself with reflective access and extension of the Factor parser. The parser algorithm and standard syntax is described in " { $link "syntax" } "."
-$terpri
-"The set of words making up the parser are found in the " { $vocab-link "parser" } " and " { $vocab-link "syntax" } " vocabularies."
-$terpri
-"As documented in " { $link "vocabulary-search" } ", the parser looks up words in the vocabulary search path. New word definitions are added to the current vocabulary. These two parameters are stored in a pair of variables:"
-{ $subsection use }
-{ $subsection in }
-"There are two simple ways to call the parser which use the vocabulary search path currently in scope, which is usually the default listener search path:"
-{ $subsection parse }
-{ $subsection eval }
-"The parser can also take input from a stream (" { $link "streams" } "):"
-{ $subsection parse-stream }
-"By convention, words for parsing input from streams use a certain default vocabulary search path:"
-{ $subsection file-vocabs }
-"More details on working with source files can be found in " { $link "sources" } "."
-$terpri
-"The parser can be extended with new parsing word definitions."
-{ $subsection "parsing-words" } ;
-
-ARTICLE: "parsing-words" "Parsing words"
-"Parsing words execute at parse time, and therefore can access and modify the state of the parser, as well as add objects to the parse tree. Parsing words are a difficult concept to grasp, so this section has several examples and explains the workings of some of the parsing words provided in the library."
-$terpri
-"Parsing words are marked by suffixing the definition with a declaration:"
-{ $subsection POSTPONE: parsing }
-{ $subsection "parsing-word-nest" }
-{ $subsection "reading-ahead" }
-{ $subsection "defining-words" }
-{ $subsection "string-mode" }
-{ $subsection "parser-internals" } ;
-
-ARTICLE: "parsing-word-nest" "Nested structure"
-"The first thing to look at is how the parse tree is built. When parsing begins, " { $link f } " is pushed on the data stack; when a new object is parsed, " { $link ?push } " is called to add it to the parse tree. The first call to " { $link ?push } " creates a new one-element vector, and subsequent calls add elements to the end of this vector. When parsing is complete, the vector is converted into a quotation."
-$terpri
-"Lets look at a simple example; the parsing of " { $snippet "1 2 3" } ":"
-{ $table
-    { "Action" "Stack" }
-    { "Initial stack after parsing begins" { $snippet "f" } }
-    { { "Token: " { $snippet "1" } } { $snippet "V{ 1 }" } }
-    { { "Token: " { $snippet "2" } } { $snippet "V{ 1 2 }" } }
-    { { "Token: " { $snippet "3" } } { $snippet "V{ 1 2 3 }" } }
-    { "Final stack upon completion:" { $snippet "[ 1 2 3 ]" } }
-}
-"Nested structure is a bit more involved. The basic idea is that parsing words can push " { $link f } " on the stack to begin a new level of nesting, then all subsequent objects are pushed onto this sequence, until another parsing word adds this sequence to the vector underneath."
-$terpri
-"The parsing words that delimit the beginning and the end of a quotation illustrate the idiom:"
-{ $see POSTPONE: [ }
-{ $see POSTPONE: ] }
-"Let us ponder, then, how one particular string will parse:"
-{ $snippet "\"1 [ 2 3 ] 4\"" }
-{ $table
-    { "Action" "Stack" }
-    { "Initial stack after parsing begins" { $snippet "f" } }
-    { { "Token: " { $snippet "1" } } { $snippet "V{ 1 }" } }
-    { { "Token: " { $snippet "[" } } { $snippet "V{ 1 } f" } }
-    { { "Token: " { $snippet "2" } } { $snippet "V{ 1 } V{ 2 }" } }
-    { { "Token: " { $snippet "3" } } { $snippet "V{ 1 } V{ 2 3 }" } }
-    { { "Token: " { $snippet "]" } } { $snippet "V{ 1 [ 2 3 ] }" } }
-    { { "Token: " { $snippet "4" } } { $snippet "V{ 1 [ 2 3 ] 4 }" } }
-    { "Final stack upon completion" { $snippet "[ 1 [ 2 3 ] 4 ]" } }
-}
-"Notice how in the definition of the quotation parsing words, the final word " { $link POSTPONE: ] } " does all the work. A closely related set of parsing words for reading various other literal types implements another useful idiom."
-$terpri
-"The word set in question consists of various start delimiters, such a " { $link POSTPONE: { } " for arrays and " { $link POSTPONE: H{ } " for hashtables, together with one end delimiter " { $link POSTPONE: } } ". The start words push a quotation in addition to pushing " { $link f } "; the end word applies the quotation to the newly-parsed vector; the quotation converts it to the appropriate type of literal."
-{ $see-also POSTPONE: { POSTPONE: H{ POSTPONE: V{ POSTPONE: W{ POSTPONE: T{ POSTPONE: } } ;
-
-ARTICLE: "reading-ahead" "Reading ahead"
-"Parsing words can consume input from the current line to implement various forms of custom syntax."
-{ $subsection scan }
-{ $subsection scan-word }
-"For example, the " { $link POSTPONE: HEX: } " word, for reading hexadecimal literals, uses this facility. It is defined in terms of a lower-level " { $link parse-base } " word that takes the numerical base on the data stack, but reads the number from the parser and then adds it to the parse tree:"
-{ $see parse-base }
-{ $see POSTPONE: HEX: }
-"Another simple example is the " { $link POSTPONE: \ } " word:"
-{ $see POSTPONE: \ } ;
-
-ARTICLE: "defining-words" "Defining words"
-"Defining words add definitions to the dictionary without modifying the parse tree. The simplest example is the " { $link POSTPONE: SYMBOL: } " word:"
-{ $subsection POSTPONE: SYMBOL: }
-"The key factor the above definition is " { $link CREATE } ", which reads a token from the input and creates a word with that name. This word is then passed to " { $link define-symbol } "."
-{ $subsection CREATE }
-"Colon definitions are defined in a more elaborate way. The  definition of " { $link POSTPONE: : } " introduces the next idiom, and that is building a quotation and then adding a definition using " { $link POSTPONE: ; } "."
-$terpri
-"Recall the colon definition syntax. When the " { $link POSTPONE: : } " word executes, it reads ahead from the input and defines a word. Then, it places a quotation and " { $link f } " on the data stack. The parser builds up a parse tree, and the quotation pushed by " { $link POSTPONE: : } " is called by " { $link POSTPONE: ; } "."
-{ $see POSTPONE: : }
-{ $see POSTPONE: ; }
-"There are additional parsing words whose syntax is delimited by  " { $link POSTPONE: ; } ", and they are all implemented in the same way -- first they read some input, then they leave a quotation followed by an empty list on the stack."
-{ $see-also POSTPONE: C: POSTPONE: G: POSTPONE: M: POSTPONE: PREDICATE: POSTPONE: TUPLE: POSTPONE: UNION: POSTPONE: USING: } ;
-
-ARTICLE: "string-mode" "String mode"
-"String mode allows custom parsing of tokenized input. For even more esoteric situations, the input text can be accessed directly."
-$terpri
-"String mode is controlled by a boolean variable in the parser scope:"
-{ $subsection string-mode }
-"An illustration of this idiom is found in the " { $link POSTPONE: USING: } " parsing word. It reads a list of vocabularies, terminated by " { $link POSTPONE: ; } ". However, the vocabulary names do not name words, except by coincidence; so string mode is used to read them."
-{ $see POSTPONE: USING: }
-"Make note of the quotation that is left in position for " { $link POSTPONE: ; } " to call. It switches off string mode, so that normal parsing can resume, then adds the given vocabularies to the search path." ;
-
-ARTICLE: "parser-internals" "Parser internals"
-"Some variables that encapsulate internal parser state:"
-{ $subsection file }
-{ $subsection line-number }
-{ $subsection line-text }
-{ $subsection column }
-"A utility used when parsing string literals:"
-{ $subsection parse-string } ;
diff --git a/core/handbook/prettyprinter.facts b/core/handbook/prettyprinter.facts
deleted file mode 100644 (file)
index 080992e..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-USING: help io prettyprint prettyprint-internals ;
-
-ARTICLE: "prettyprint" "The prettyprinter"
-"One of Factor's key features is the ability to print almost any object as a valid source literal expression. This greatly aids debugging and provides the building blocks for light-weight object serialization facilities."
-$terpri
-"Prettyprinter words are found in the " { $vocab-link "prettyprint" } " vocabulary."
-$terpri
-"The key words to print an object to the " { $link stdio } " stream; the first two emit a trailing newline, the second two do not:"
-{ $subsection . }
-{ $subsection short. }
-{ $subsection pprint }
-{ $subsection pprint-short }
-"The string representation of an object can be requested:"
-{ $subsection unparse }
-{ $subsection unparse-short }
-"Advanced topics:"
-{ $subsection "prettyprint-limitations" }
-{ $subsection "prettyprint-variables" }
-{ $subsection "prettyprint-extension" }
-;
-
-ARTICLE: "prettyprint-limitations" "Prettyprinter limitations"
-"The prettyprinter has some limitations; namely, the following objects may not print in a readable form:"
-{ $list
-    { "When printing words, no " { $link POSTPONE: USE: } " declarations are output, hence the result may not be immediately readable without prefixing appropriate declarations." }
-    "Shared structure is not reflected in the printed output; if the output is parsed back in, fresh objects are created for all literal denotations."
-    { "Circular structure is not printed in a readable way. Circular references print as " { $snippet "#" } "." }
-    "Floating point numbers might not equal themselves after being printed and read, since a decimal representation of a float is inexact."
-}
-"On a final note, the " { $link short. } ", " { $link pprint-short } " and " { $link unparse-short } " words restrict the length and nesting of printed sequences, their output will very likely not be valid syntax. They are only intended for interactive use." ;
-
-ARTICLE: "prettyprint-variables" "Prettyprint control variables"
-"The following variables affect the " { $link . } " and " { $link pprint } " words if set in the current dynamic scope:"
-{ $subsection tab-size }
-{ $subsection margin }
-{ $subsection nesting-limit }
-{ $subsection length-limit }
-{ $subsection line-limit }
-{ $subsection string-limit }
-"Note that the " { $link short. } " and " { $link pprint-short } " variables override some of these variables."
-{
-    $warning "Treat the global variables as essentially being constants. Only ever rebind them in a nested scope."
-    $terpri
-    "Some of the globals are safe to change, like the tab size and wrap margin. However setting limits globally could break code which uses the prettyprinter as a serialization mechanism."
-} ;
-
-ARTICLE: "prettyprint-extension" "Extending the prettyprinter"
-"It is possible to define literal syntax for a new class using the " { $link "parser" } ", and then define a corresponding prettyprint method for the class which reproduces the literal syntax."
-$terpri
-"The prettyprinter maintains some internal state while prettyprinting. First, the object graph is traversed and a tree of " { $emphasis "sections" } " is produced. A section is either a text node or a " { $emphasis "block" } " which itself consists of sections."
-$terpri
-"Once the output is divided into sections, the tree is traversed and intelligent decisions are made about indentation and line breaks. If a block does not fit on the remainder of the current line, a newline is output before and after the block, and additional indentation is used when printing the block."
-$terpri
-"The following generic word is called to output a prettyprinting section for an object:"
-{ $subsection pprint* }
-"Two types of leaf sections:"
-{ $subsection text }
-{ $subsection newline }
-"Nesting and denesting is done using a set words:"
-{ $subsection <inset }
-{ $subsection <flow }
-{ $subsection <narrow }
-{ $subsection <defblock }
-{ $subsection block> }
-"Recall that since " { $link text } " sections take style hashtables as input, any type of formatted text can be output, including presentations. See " { $link "styles" } " to explore the possibility." ;
diff --git a/core/handbook/sequences.facts b/core/handbook/sequences.facts
deleted file mode 100644 (file)
index d6846e9..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-IN: sequences
-USING: arrays help kernel kernel-internals sequences-internals
-strings vectors words ;
-
-ARTICLE: "sequence-implementations" "Sequence implementations"
-"There are two basic types of sequences. Instances of the following two types have fixed length:"
-{ $subsection "arrays" }
-{ $subsection "strings" }
-"Instances of the following are resizable:"
-{ $subsection "vectors" }
-{ $subsection "sbufs" }
-"Quotations are special sequences which hold code:"
-{ $subsection "quotations" }
-"Integers support the sequence protocol:"
-{ $subsection "sequences-integers" }
-"Virtual sequences wrap an underlying sequence, and changes to the underlying sequence are reflected in the virtual sequence:"
-{ $subsection <reversed> }
-{ $subsection <slice> }
-{ $subsection <column> }
-"The " { $link f } " object also supports the sequence protocol. It responds with a length of zero, and instead of throwing an out of bounds error, outputs " { $link f } " when an element is accessed. This can simplify code that would like a dummy sequence behaving as if it has arbitrary length." ;
-
-ARTICLE: "sequences-integers" "Integer sequences and counted loops"
-"Integers support the sequence protocol in a trivial fashion; a non-negative integer presents its non-negative predecessors as elements. For example, the integer 3, when viewed as a sequence, contains the elements 0, 1, and 2. This is very useful for performing counted loops."
-$terpri
-"For example, the " { $link each } " combinator, given an integer, simply calls a quotation that number of times, pushing a counter on each iteration that ranges from 0 up to that integer:"
-{ $example "3 [ . ] each" "0\n1\n2" }
-"A common idiom is to iterate over a sequence, while also maintaining a loop counter. This can be done using " { $link 2each } ":"
-{ $example "{ \"a\" \"b\" \"c\" } dup length [\n    \"Index: \" write . \"Element: \" write .\n] 2each" "Index: 0\nElement: \"a\"\nIndex: 1\nElement: \"b\"\nIndex: 2\nElement: \"c\"" }
-"Combinators that produce new sequences, such as " { $link map } ", will output an array if the input is an integer." ;
-
-ARTICLE: "sequences-access" "Accessing sequence elements"
-{ $subsection nth }
-{ $subsection ?nth }
-{ $subsection first }
-{ $subsection second }
-{ $subsection third }
-{ $subsection fourth }
-{ $subsection first2 }
-{ $subsection first3 }
-{ $subsection first4 }
-{ $subsection peek }
-{ $subsection last/first } ;
-
-ARTICLE: "sequences-combinators" "Sequence combinators"
-"Iteration:"
-{ $subsection each }
-{ $subsection each-with }
-{ $subsection reduce }
-{ $subsection interleave }
-{ $subsection 2each }
-{ $subsection 2reduce }
-"Mapping:"
-{ $subsection map }
-{ $subsection map-with }
-{ $subsection accumulate }
-{ $subsection 2map }
-"Filtering:"
-{ $subsection subset }
-{ $subsection subset-with } ;
-
-ARTICLE: "sequences-tests" "Testing sequences"
-"Testing for an empty sequence:"
-{ $subsection empty? }
-"Testing indices:"
-{ $subsection bounds-check? }
-"Testing if a sequence contains an object:"
-{ $subsection member? }
-{ $subsection memq? }
-"Testing if a sequence contains a subsequence:"
-{ $subsection head? }
-{ $subsection tail? }
-{ $subsection subseq? }
-"Testing if a sequence contains elements satisfying a predicate:"
-{ $subsection contains? }
-{ $subsection contains-with? }
-{ $subsection all? }
-{ $subsection all-with? }
-"Testing how elements are related:"
-{ $subsection monotonic? }
-{ $subsection all-eq? }
-{ $subsection all-equal? } ;
-
-ARTICLE: "sequences-search" "Searching sequences"
-"Finding the index of an element:"
-{ $subsection index }
-{ $subsection index* }
-{ $subsection last-index }
-{ $subsection last-index* }
-"Finding the start of a subsequence:"
-{ $subsection start }
-{ $subsection start* }
-"Finding the index of an element satisfying a predicate:"
-{ $subsection find }
-{ $subsection find* }
-{ $subsection find-with }
-{ $subsection find-with* }
-{ $subsection find-last }
-{ $subsection find-last-with }
-{ $subsection find-last* }
-{ $subsection find-last-with* } ;
-
-ARTICLE: "sequences-join-split" "Joining and splitting sequences"
-"Forming new sequences from existing sequences:"
-{ $subsection append }
-{ $subsection 3append }
-{ $subsection concat }
-{ $subsection join }
-{ $subsection replace-slice }
-"Slicing sequences:"
-{ $subsection subseq }
-{ $subsection head }
-{ $subsection tail }
-{ $subsection head* }
-{ $subsection tail* }
-"Variants of the above which output a virtual sequence sharing storage with the input sequence:"
-{ $subsection <slice> }
-{ $subsection head-slice }
-{ $subsection tail-slice }
-{ $subsection head-slice* }
-{ $subsection tail-slice* }
-"Splitting sequences at specific indices:"
-{ $subsection cut }
-{ $subsection cut* }
-{ $subsection unclip }
-"Splitting sequences at occurrences of subsequences:"
-{ $subsection ?head }
-{ $subsection ?tail }
-{ $subsection split1 }
-{ $subsection split }
-{ $subsection drop-prefix } ;
-
-ARTICLE: "sequences-add-remove" "Adding and removing sequence elements"
-"Adding elements:"
-{ $subsection add }
-{ $subsection add* }
-"Removing elements:"
-{ $subsection remove }
-{ $subsection remove-nth }
-{ $subsection diff }
-{ $subsection prune } ;
-
-ARTICLE: "sequences-reshape" "Reshaping sequences"
-{ $subsection reverse }
-{ $subsection <reversed> }
-{ $subsection group }
-{ $subsection flatten }
-{ $subsection flip }
-{ $subsection <column> }
-{ $subsection subst } ;
-
-ARTICLE: "sequences-destructive" "Destructive operations"
-"These words modify their input, instead of creating a new sequence."
-$terpri
-"In-place variant of " { $link add } ":"
-{ $subsection push }
-"In-place variant of " { $link append } ":"
-{ $subsection nappend }
-"In-place variant of " { $link remove } ":"
-{ $subsection delete }
-"In-place variant of " { $link map } ":"
-{ $subsection inject }
-{ $subsection inject-with }
-"Changing elements:"
-{ $subsection set-nth }
-{ $subsection change-nth }
-{ $subsection cache-nth }
-"Other destructive words:"
-{ $subsection exchange }
-{ $subsection push-new }
-{ $subsection pop }
-{ $subsection pop* }
-{ $subsection delete-all }
-{ $subsection copy-into } ;
-
-ARTICLE: "sequences-stacks" "Stack operations"
-"The classical stack operations, modifying a sequence in place:"
-{ $subsection empty? }
-{ $subsection peek }
-{ $subsection push }
-{ $subsection pop }
-{ $subsection pop* }
-"Lazy instantiation of stacks:"
-{ $subsection ?push } ;
-
-ARTICLE: "sequences-comparing" "Comparing sequences"
-"Element equality:"
-{ $subsection sequence= }
-{ $subsection mismatch }
-"Lexicographic order:"
-{ $subsection <=> } ;
-
-ARTICLE: "sequences-assoc" "Association lists"
-"An " { $emphasis "association list" } " is a sequence of pairs. Association lists come up from time to time; for example, the " { $link cond } " combinator takes an association list of quotations as input. You can perform lookups and take association lists apart:"
-{ $subsection assoc }
-{ $subsection rassoc }
-{ $subsection unpair }
-"An association list is slower to search than a hashtable. The main advantage of an association list is that the elements are ordered; also sometimes it is more convenient to construct an association list with sequence words than to construct a hashtable with hastable words. Most of the time, hashtables are more appropriate. See " { $link "hashtables" } "." ;
-
-ARTICLE: "sequence-protocol" "Sequence protocol"
-"All sequences must know their length, and provide a way to access elements:"
-{ $subsection length }
-{ $subsection nth }
-"Mutable sequences:"
-{ $subsection set-nth }
-"Resizable sequences:"
-{ $subsection set-length }
-"An optional generic word for creating sequences of the same class as a given sequence:"
-{ $subsection like }
-"Another optional generic word for optimization purposes:"
-{ $subsection new } ;
-
-ARTICLE: "arrays" "Arrays"
-"An array is a fixed-size mutable sequence whose elements are stored in a contiguous range of memory. The literal syntax is covered in " { $link "syntax-arrays" } ". Sometimes you need a resizable array -- this is called a vector, and vectors are documented in " { $link "vectors" } "."
-$terpri
-"Array words are in the " { $vocab-link "arrays" } " vocabulary. Unsafe implementation words are in the " { $vocab-link "kernel-internals" } " vocabulary."
-$terpri
-"Arrays form a class of objects."
-{ $subsection array }
-{ $subsection array? }
-"There are several ways to construct arrays."
-{ $subsection >array }
-{ $subsection <array> }
-{ $subsection 1array }
-{ $subsection 2array }
-{ $subsection 3array }
-{ $subsection 4array }
-"Arrays can be accessed without bounds checks in a pointer unsafe way."
-{ $subsection array-nth }
-{ $subsection set-array-nth } ;
-
-ARTICLE: "strings" "Strings"
-"A string is a fixed-size mutable sequence of characters."
-$terpri
-"String words are found in the " { $vocab-link "strings" } " vocabulary."
-{ $subsection string? }
-{ $subsection >string }
-{ $subsection <string> }
-"A pair of words are used to nicely format columns of text."
-{ $subsection pad-left }
-{ $subsection pad-right }
-"Characters are not a first-class type; they are simply represented as integers between 0 and 65535. A few words operate on characters:"
-{ $subsection blank? }
-{ $subsection letter? }
-{ $subsection LETTER? }
-{ $subsection digit? }
-{ $subsection printable? }
-{ $subsection control? }
-{ $subsection quotable? }
-{ $subsection ch>lower }
-{ $subsection ch>upper } ;
-
-ARTICLE: "sbufs" "String buffers"
-"A string buffer is a resizable mutable sequence of characters. String buffers can be used to construct new strings by accumilating substrings and characters, however usually they are only used indirectly, since the sequence construction words are more convenient to use in most cases (see " { $link "namespaces-make" } ")."
-$terpri
-"String buffer words are found in the " { $vocab-link "strings" } " vocabulary."
-{ $subsection sbuf? }
-"Words for creating string buffers:"
-{ $subsection >sbuf }
-{ $subsection <sbuf> }
-"If you don't care about initial capacity, a more elegant way to create a new string buffer is to write:"
-{ $code "SBUF\" \" clone" } ;
-
-ARTICLE: "vectors" "Vectors"
-"A vector is a resizable mutable sequence of objects. Vector words are found in the " { $vocab-link "vectors" } " vocabulary."
-{ $subsection vector? }
-"Words for creating vectors:"
-{ $subsection >vector }
-{ $subsection <vector> }
-"If you don't care about initial capacity, a more elegant way to create a new vector is to write:"
-{ $code "V{ } clone" } ;
-
-ARTICLE: "sequences-sorting" "Sorting and binary search"
-"Sorting and binary search combinators all take comparator quotations with stack effect " { $snippet "( elt1 elt2 -- n )" } " that order the two given elements and output a value whose sign denotes the result:"
-{ $list
-    { "positive - indicates that " { $snippet "elt1" } " follows " { $snippet "elt2" } }
-    { "zero - indicates that " { $snippet "elt1" } " is ordered equivalently to " { $snippet "elt2" } }
-    { "negative - indicates that " { $snippet "elt1" } " precedes " { $snippet "elt2" } }
-}
-"In-place sorting:"
-{ $subsection nsort }
-"Sorting elements in a new sequence:"
-{ $subsection sort }
-"Common comparators:"
-{ $subsection natural-sort }
-{ $subsection sort-keys }
-{ $subsection sort-values }
-"Binary search:"
-{ $subsection binsearch }
-{ $subsection binsearch* } ;
-
-ARTICLE: "sequences-unsafe" "Unsafe sequence operations"
-"The unsafe sequence protocol bypasses bounds checks for increased performance:"
-{ $subsection nth-unsafe }
-{ $subsection set-nth-unsafe }
-"These words assume the sequence index given is within bounds; if it is not, memory corruption can occur. Please think twice before using them; first, make sure the code in question is actually a bottleneck; next, try improving the algorithm first. If all else fails, then use these words and test your code very carefully."
-$terpri
-"There is a very important invariant these word must preserve: if at some point in time, the length of a sequence was " { $snippet "n" } ", then any future lookups of elements with indices below " { $snippet "n" } " must not crash the runtime, even if the sequence length is now less than " { $snippet "n" } ". For example, vectors preserve this invariant by never shrinking the underlying storage, only growing it as necessary."
-$terpri
-"The justification for this is that the runtime should not crash if a resizable sequence is resized during the execution of an iteration combinator."
-$terpri
-"Indeed, iteration combinators are the primary use-case for these words; if the iteration index is already guarded by a loop test which ensures it is within bounds, then additional bounds checks are redundant. For example, see the implementation of " { $link each } "." ;
-
-ARTICLE: "sequences-resizable" "Resizable sequence implementation"
-"Resizable sequences are implementing by having a wrapper object hold a reference to an underlying sequence, together with a fill pointer indicating how many elements of the underlying sequence are occupied. When the fill pointer exceeds the underlying sequence capacity, the underlying sequence grows."
-$terpri
-"There is a resizable sequence protocol:"
-{ $subsection underlying }
-{ $subsection set-underlying }
-{ $subsection set-fill }
-"Any instance of a class implementing the above generics can make use of several utility words:"
-{ $subsection capacity }
-{ $subsection ensure }
-{ $subsection grow-length }
-{ $subsection clone-resizable }
-"This protocol and the above words are unsafe; they do not perform bounds checks for performance reasons, and thus a mistake can lead to memory corruption due to an underlying sequence being shorter than the fill pointer."
-$terpri
-"Vectors and string buffers are implemented using the resizable sequence facility (and they perform full bounds-checks and thus are safe)." ;
-
-ARTICLE: "sequences" "Sequences"
-"A sequence is a linearly-ordered finite collection of elements."
-$terpri
-"Sequence utility words can operate on any object whose class implements the sequence protocol."
-{ $subsection "sequence-protocol" }
-"There are a number of implementations of sequences in the core library, and you can write new implementations yourself."
-{ $subsection "sequence-implementations" }
-"Much of the power of sequences lies in the polymorphic utility words that allow computations to be expressed as bulk operations without loops, recursion or micro-management of elements."
-{ $subsection "sequences-access" }
-{ $subsection "sequences-combinators" }
-{ $subsection "sequences-tests" }
-{ $subsection "sequences-search" }
-{ $subsection "sequences-add-remove" }
-{ $subsection "sequences-join-split" }
-{ $subsection "sequences-reshape" }
-{ $subsection "sequences-comparing" }
-{ $subsection "sequences-sorting" }
-{ $subsection "sequences-destructive" }
-"Sequences are also used to implement other data structures:"
-{ $subsection "sequences-stacks" }
-{ $subsection "sequences-assoc" }
-"Some implementation details which your code should probably not care about:"
-{ $subsection "sequences-unsafe" }
-{ $subsection "sequences-resizable" }
-{ $see-also "namespaces-make" } ;
diff --git a/core/handbook/streams.facts b/core/handbook/streams.facts
deleted file mode 100644 (file)
index d33ac5a..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-USING:
-help
-io
-styles ;
-
-ARTICLE: "streams" "Streams"
-"Input and output centers on the concept of a " { $emphasis "stream" } ", which is a source or sink of characters. Streams also support formatted output, which may be used to present styled text in a manner independent of output medium."
-$terpri
-"Stream words are in the " { $vocab-link "io" } " vocabulary."
-{ $subsection "stream-protocol" }
-{ $subsection "stream-utils" }
-{ $subsection "stdio" }
-{ $subsection "styles" }
-{ $subsection "stream-binary" }
-{ $subsection "stream-impls" }
-;
-
-ARTICLE: "stream-protocol" "Stream protocol"
-"The stream protocol consists of a large number of generic words, many of which are optional."
-$terpri
-"A word required to be implemented for all streams:"
-{ $subsection stream-close }
-"Three words are required for input streams:"
-{ $subsection stream-read1 }
-{ $subsection stream-read }
-{ $subsection stream-readln }
-"If your stream supports the first two but not the last one, wrap it in a " { $link <line-reader> } " to get a default implementation."
-$terpri
-"Seven words are required for output streams:"
-{ $subsection stream-flush }
-{ $subsection stream-write1 }
-{ $subsection stream-write }
-{ $subsection stream-terpri }
-{ $subsection stream-format }
-{ $subsection with-nested-stream }
-"If your stream supports the first three but not the rest, wrap it in a " { $link <plain-writer> } ", which provides plain text implementations of the stream formatting words (the so called " { $emphasis "extended stream output protocol" } ")." ;
-
-ARTICLE: "stream-utils" "Stream utilities"
-"There are a few useful stream-related words which are not generic, but merely built up from the stream protocol."
-$terpri
-"First, a simple composition of " { $link stream-write } " and " { $link stream-terpri } ":"
-{ $subsection stream-print }
-"Next up, a pair of words for reading the entire contents of a stream as an array of lines, or a single string:"
-{ $subsection lines }
-{ $subsection contents }
-"Finally, a word to copy the contents of one stream to another:"
-{ $subsection stream-copy } ;
-
-ARTICLE: "stdio" "The default stream"
-"Various words take an implicit stream parameter from a variable to reduce stack shuffling."
-{ $subsection stdio }
-"Unless rebound in a child namespace, this variable will be set to a console stream for interacting with the user."
-{ $subsection close }
-{ $subsection read1 }
-{ $subsection read }
-{ $subsection readln }
-{ $subsection flush }
-{ $subsection write1 }
-{ $subsection write }
-{ $subsection print }
-{ $subsection terpri }
-{ $subsection format }
-{ $subsection with-nesting }
-"A pair of combinators support rebinding the " { $link stdio } " variable:"
-{ $subsection with-stream }
-{ $subsection with-stream* } ;
-
-ARTICLE: "styles" "Formatted output"
-"The " { $link stream-format } ", " { $link with-nested-stream } " and " { $link with-stream-table } " words take a hashtable of style attributes. Output stream implementations are free to ignore style information."
-$terpri
-"Style hashtables are keyed by symbols from the " { $vocab-link "styles" } " vocabulary."
-{ $subsection "character-styles" }
-{ $subsection "paragraph-styles" }
-{ $subsection "table-styles" }
-{ $subsection "presentations" } ;
-
-ARTICLE: "character-styles" "Character styles"
-"Character styles for " { $link stream-format } ":"
-{ $subsection foreground }
-{ $subsection background }
-{ $subsection font }
-{ $subsection font-size }
-{ $subsection font-style }
-{ $subsection presented } ;
-
-ARTICLE: "paragraph-styles" "Paragraph styles"
-"Paragraph styles for " { $link with-nested-stream } ":"
-{ $subsection page-color }
-{ $subsection border-color }
-{ $subsection border-width }
-{ $subsection wrap-margin }
-{ $subsection outline }
-{ $subsection presented } ;
-
-ARTICLE: "table-styles" "Table styles"
-"Table styles for " { $link with-stream-table } ":"
-{ $subsection table-gap }
-{ $subsection table-border } ;
-
-ARTICLE: "presentations" "Presentations and outliners"
-"The " { $link presented } " and " { $link outline } " styles can be used to build sophisticated user interfaces in the Factor UI. Instead of setting them directly, two utility words should be used:"
-{ $subsection write-object }
-{ $subsection write-outliner } ;
-
-ARTICLE: "stream-binary" "Working with binary data"
-"The core stream words read and write strings. Packed binary integers can be read and written by converting to and from sequences of bytes. Floating point numbers can be read and written by converting them into a their bitwise integer representation (" { $link "floats" } ")."
-$terpri
-"There are two ways to order the bytes making up an integer; " { $emphasis "little endian" } " byte order outputs the least significant byte first, and the most significant byte last, whereas " { $emphasis "big endian" } " is the other way around."
-$terpri
-"Consider the hexadecimal integer "{ $snippet "HEX: cafebabe" } ". Big endian byte order yields the following sequence of bytes:"
-{ $code
-    "Byte:   1  2  3  4"
-    "Value: be ba fe ca"
-}
-"Compare this with little endian byte order:"
-{ $code
-    "Byte:   1  2  3  4"
-    "Value: ca fe ba be"                    
-}                                                             
-"Two words convert a sequence of bytes into an integer:"
-{ $subsection be> }
-{ $subsection le> }
-"Two words convert an integer into a sequence of bytes:"
-{ $subsection >be }
-{ $subsection >le } ;
-
-ARTICLE: "stream-impls" "Stream implementations"
-"External resource streams communicate with the outside world:"
-{ $subsection "file-streams" }
-{ $subsection "network-streams" }
-"Virtual streams serve as glue:"
-{ $subsection "string-streams" }
-"Wrapper streams convert partial implementations of the stream protocol into full-fledged streams:"
-{ $subsection <line-reader> }
-{ $subsection <plain-writer> }
-"A utility to combine a complementary input and output stream pair into a single stream:"
-{ $subsection <duplex-stream> }
-"As a final note, the " { $link f } " object implements the stream protocol, by yielding end-of-file on input and discarding all output." ;
-
-ARTICLE: "file-streams" "Reading and writing files"
-{ $subsection <file-reader> }
-{ $subsection <file-writer> }
-"File system meta-data:"
-{ $subsection exists? }
-{ $subsection directory? }
-{ $subsection file-length }
-{ $subsection stat } ;
-
-ARTICLE: "network-streams" "TCP/IP networking"
-"Client connections are bidirectional streams opened with this word:"
-{ $subsection <client> }
-"Network servers are implemented by first opening a server socket, then waiting for connections:"
-{ $subsection <server> }
-{ $subsection accept }
-"Some information can be obtained about incoming client connections:"
-{ $subsection client-stream-host }
-{ $subsection client-stream-port } ;
-
-ARTICLE: "string-streams" "String streams"
-"Streams:"
-{ $subsection <string-reader> }
-{ $subsection <string-writer> }
-"Utility combinators:"
-{ $subsection string-in }
-{ $subsection string-out } ;
diff --git a/core/handbook/syntax.facts b/core/handbook/syntax.facts
deleted file mode 100644 (file)
index ec3cdbf..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-USING: help kernel math parser words ;
-
-ARTICLE: "syntax" "Syntax"
-"In Factor, an " { $emphasis "object" } " is a piece of data that can be identified. Code is data, so Factor syntax is actually a syntax for describing objects, of which code is a special case. Factor syntax is read by the parser. The parser performs two kinds of tasks -- it creates objects from their " { $emphasis "printed representations" } ", and it adds " { $emphasis "word definitions" } " to the dictionary (see " { $link "words" } "). The parser can be extended (see " { $link "parser" } ")."
-{ $subsection "parser-algorithm" }
-{ $subsection "vocabulary-search" }
-{ $subsection "syntax-comments" }
-{ $subsection "syntax-literals" } ;
-
-ARTICLE: "parser-algorithm" "Parser algorithm"
-"At the most abstract level, Factor syntax consists of whitespace-separated tokens. The parser tokenizes the input on whitespace boundaries.  The parser is case-sensitive and whitesapce between tokens is significant, so the following three expressions tokenize differently:"
-{ $code "2X+\n2 X +\n2 x +" }
-"As the parser reads tokens it makes a distinction between numbers, ordinary words, and parsing words. Tokens are appended to the parse tree, the top level of which is a list returned by the original parser invocation. Nested levels of the parse tree are created by parsing words."
-$terpri
-"The parser iterates through the input text, checking each character in turn. Here is the parser algorithm in more detail -- some of the concepts therein will be defined shortly:"
-{ $list
-    { "If the current character is a double-quote (\"), the " { $link POSTPONE: " } " parsing word is executed, causing a string to be read." }
-    {
-        "Otherwise, the next token is taken from the input. The parser searches for a word named by the token in the currently used set of vocabularies. If the word is found, one of the following two actions is taken:"
-        { $list
-            "If the word is an ordinary word, it is appended to the parse tree."
-            "If the word is a parsing word, it is executed."
-        }
-    }
-    "Otherwise if the token does not represent a known word, the parser attempts to parse it as a number. If the token is a number, the number object is added to the parse tree. Otherwise, an error is raised and parsing halts."
-}
-"There is one exception to the above process; the parser might be placed in " { $emphasis "string mode" } ", in which case it simply reads tokens and appends them to the parse tree as strings. String mode is activated and deactivated by certain parsing words wishing to read input in an unstructured but tokenized manner -- see " { $link "string-mode" } "."
-$terpri
-"Parsing words play a key role in parsing; while ordinary words and numbers are simply added to the parse tree, parsing words execute in the context of the parser, and can do their own parsing and create nested data structures in the parse tree. Parsing words are also able to define new words."
-$terpri
-"While parsing words supporting arbitrary syntax can be defined, the default set is found in the " { $vocab-link "syntax" } " vocabulary and provides the basis for all further syntactic interaction with Factor." ;
-
-ARTICLE: "vocabulary-search" "Vocabulary search"
-"A " { $emphasis "word" } " is a code definition identified by a name. Words are sorted into " { $emphasis "vocabularies" } ". Words are discussed in depth in " { $link "words" } "."
-$terpri
-"When the parser reads a token, it attempts to look up a word named by that token. The lookup is performed by searching each vocabulary in the search path, in order."
-$terpri
-"Due to the way the parser works, words cannot be referenced before they are defined; that is, source files must order definitions in a strictly bottom-up fashion. Use the " { $link POSTPONE: DEFER: } " parsing word to get around this limitation, for example when defining mutually-recursive words."
-$terpri
-"For a source file the vocabulary search path starts off with two vocabularies:"
-{ $code "syntax\nscratchpad" }
-"The " { $vocab-link "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words. The " { $vocab-link "scratchpad" } " vocabulary is the default vocabulary for new word definitions."
-$terpri
-"At the interactive listener, the default search path contains many more vocabularies. Details on the default search path and parser invocation are found in " { $link "parser" } "."
-$terpri
-"Three parsing words deal with the vocabulary search path:"
-{ $subsection POSTPONE: USE: }
-{ $subsection POSTPONE: USING: }
-{ $subsection POSTPONE: IN: }
-"Here is an example demonstrating the vocabulary search path. If you can understand this example, then you have grasped vocabularies."
-{ $code
-    "IN: foe"
-    "USING: sequences io ;"
-    ""
-    ": append"
-    "    #! Prints a message, then calls sequences::append."
-    "    \"foe::append calls sequences::append\" print append ;"
-    ""
-    "IN: fee"
-    ""
-    ": append"
-    "    #! Loops, calling fee::append."
-    "    \"fee::append calls fee::append\" print append ;"
-    ""
-    "USE: foe"
-    ""
-    ": append"
-    "    #! Redefining fee::append to call foe::append."
-    "    \"fee::append calls foe::append\" print append ;"
-    ""
-    "\"1234\" \"5678\" append print"
-}
-"When placed in a source file and run, the above code produces the following output:"
-{ $code
-    "fee::append calls foe::append"
-    "foe::append calls sequences::append"
-    "12345678"
-} ;
-
-ARTICLE: "syntax-comments" "Comments"
-{ $subsection POSTPONE: ! }
-{ $subsection POSTPONE: #! } ;
-
-ARTICLE: "syntax-literals" "Literals"
-"Many different types of objects can be constructed at parse time via literal syntax. Numbers are a special case since support for reading them is built-in to the parser. All other literals are constructed via parsing words."
-$terpri
-"If a quotation contains a literal object, the same literal object instance is used each time the quotation executes; that is, literals are ``live''."
-$terpri
-"Using mutable object literals in word definitions requires care, since if those objects are mutated, the actual word definition will be changed, which is in most cases not what you would expect."
-{ $subsection "syntax-numbers" }
-{ $subsection "syntax-words" }
-{ $subsection "syntax-booleans" }
-{ $subsection "syntax-quots" }
-{ $subsection "syntax-arrays" }
-{ $subsection "syntax-vectors" }
-{ $subsection "syntax-strings" }
-{ $subsection "syntax-sbufs" }
-{ $subsection "syntax-hashtables" }
-{ $subsection "syntax-tuples" }
-{ $subsection "syntax-aliens" } ;
-
-ARTICLE: "syntax-numbers" "Number syntax"
-"If a vocabulary lookup of a token fails, the parser attempts to parse it as a number."
-{ $subsection "syntax-integers" }
-{ $subsection "syntax-ratios" }
-{ $subsection "syntax-floats" }
-{ $subsection "syntax-complex-numbers" } ;
-
-ARTICLE: "syntax-integers" "Integer syntax"
-"The printed representation of an integer consists of a sequence of digits, optionally prefixed by a sign."
-{ $code
-    "123456"
-    "-10"
-    "2432902008176640000"
-}
-"Integers are entered in base 10 unless prefixed with a base change parsing word."
-{ $subsection POSTPONE: BIN: }
-{ $subsection POSTPONE: OCT: }
-{ $subsection POSTPONE: HEX: }
-"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 (/). No intermediate whitespace is permitted. Either integer may be signed, however the ratio will be normalized into a form where the denominator is positive and the greatest common divisor of the two terms is 1."
-{ $code
-    "75/33"
-    "1/10"
-    "-5/-6"
-}
-"More information on ratios can be found in " { $link "rationals" } ;
-
-ARTICLE: "syntax-floats" "Float syntax"
-"Floating point numbers contain an optional decimal part, an optional exponent, with an optional sign prefix on either the mantissa or exponent."
-{ $code
-    "10.5"
-    "-3.1456"
-    "7e13"
-    "1e-5"
-}
-"More information on floats can be found in " { $link "floats" } "." ;
-
-ARTICLE: "syntax-complex-numbers" "Complex number syntax"
-"A complex number is given by two components, a ``real'' part and ''imaginary'' part. The components must either be integers, ratios or floats."
-{ $code
-    "C{ 1/2 1/3 }   ! the complex number 1/2+1/3i"
-    "C{ 0 1 }       ! the imaginary unit"
-}
-"More information on complex numbers can be found in " { $link "complex-numbers" } "." ;
-
-ARTICLE: "syntax-words" "Word syntax"
-"A word occurring inside a quotation is executed when the quotation is called. Sometimes a word needs to be pushed on the data stack instead. The canonical use-case for this is passing the word to the " { $link execute } " combinator, or alternatively, reflectively accessing word properties (" { $link "word-props" } ")."
-{ $subsection POSTPONE: \ }
-{ $subsection POSTPONE: POSTPONE: }
-"The implementation of the " { $link POSTPONE: \ } " word is discussed in detail in " { $link "reading-ahead" } ". Words are documented in " { $link "words" } "." ;
-
-ARTICLE: "syntax-booleans" "Boolean syntax"
-"Any Factor object may be used as a truth value in a conditional expression. The " { $link f } " object is false and anything else is true. The " { $link f } " object is also used to represent the empty list, as well as the concept of a missing value. The canonical truth value is the " { $link t } " object."
-{ $subsection POSTPONE: f }
-{ $subsection t } ;
-
-ARTICLE: "syntax-strings" "Character and string syntax"
-"Factor has no distinct character type, however Unicode character value integers can be read by specifying a literal character, or an escaped representation thereof."
-{ $subsection POSTPONE: CHAR: }
-{ $subsection POSTPONE: " }
-{ $subsection "escape" }
-"Strings are documented in " { $link "strings" } "." ;
-
-ARTICLE: "escape" "Character escape codes"
-{ $table
-    { "Escape code" "Meaning" }
-    { { $snippet "\\\\" } { $snippet "\\" } }
-    { { $snippet "\\s" } "a space" }
-    { { $snippet "\\t" } "a tab" }
-    { { $snippet "\\n" } "a newline" }
-    { { $snippet "\\r" } "a carriage return" }
-    { { $snippet "\\0" } "a null byte (ASCII 0)" }
-    { { $snippet "\\e" } "escape (ASCII 27)" }
-    { { $snippet "\\\"" } { $snippet "\"" } }
-}
-"A Unicode character can be specified by its code number by writing " { $snippet "\\u" } " followed by a four-digit hexadecimal number. That is, the following two expressions are equivalent:"
-{ $code
-    "CHAR: \\u0078"
-    "78"
-}
-"While not useful for single characters, this syntax is also permitted inside strings." ;
-
-ARTICLE: "syntax-sbufs" "String buffer syntax"
-{ $subsection POSTPONE: SBUF" }
-"String buffers are documented in " { $link "sbufs" } "." ;
-
-ARTICLE: "syntax-arrays" "Array syntax"
-{ $subsection POSTPONE: { }
-{ $subsection POSTPONE: } }
-"Arrays are documented in " { $link "arrays" } "." ;
-
-ARTICLE: "syntax-vectors" "Vector syntax"
-{ $subsection POSTPONE: V{ }
-{ $subsection POSTPONE: } }
-"Vectors are documented in " { $link "vectors" } "." ;
-
-ARTICLE: "syntax-hashtables" "Hashtable syntax"
-{ $subsection POSTPONE: H{ }
-{ $subsection POSTPONE: } }
-"Hashtables are documented in " { $link "hashtables" } "." ;
-
-ARTICLE: "syntax-tuples" "Tuple syntax"
-{ $subsection POSTPONE: T{ }
-{ $subsection POSTPONE: } }
-"Tuples are documented in " { $link "tuples" } "."  ;
-
-ARTICLE: "syntax-quots" "Quotation syntax"
-{ $subsection POSTPONE: [ }
-{ $subsection POSTPONE: ] }
-"Quotations are documented in " { $link "quotations" } "." ;
-
-ARTICLE: "syntax-aliens" "Alien object syntax"
-"These literal forms mainly exist for print-outs, and should not be input unless you know what you are doing."
-{ $subsection POSTPONE: DLL" }
-{ $subsection POSTPONE: ALIEN: }
-"The alien interface is documented in " { $link "alien" } "." ;
diff --git a/core/handbook/tools.facts b/core/handbook/tools.facts
deleted file mode 100644 (file)
index 2731eea..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-USING: definitions errors help image tools io kernel
-listener memory modules parser prettyprint sequences test
-words shells ;
-
-ARTICLE: "tools" "Development tools"
-"This section covers words which are used during development, and not usually invoked directly by user code."
-$terpri
-"There are two useful development tools which are complex enough that separate sections are devoted to them; see " { $link "inference" } " and " { $link "compiler" } "."
-{ $subsection "listener" }
-{ $subsection "debugger" }
-{ $subsection "editor" }
-{ $subsection "definitions" }
-{ $subsection "word-introspection" }
-{ $subsection "inspector" }
-{ $subsection "annotations" }
-{ $subsection "sources" }
-{ $subsection "images" }
-{ $subsection "memory" }
-{ $subsection "timing" } ;
-
-ARTICLE: "listener" "The listener"
-"The listener evaluates Factor expressions read from a stream. The listener is the primary interface to the Factor runtime. Typically, you write Factor code in a text editor, then load it using the listener and test it."
-$terpri
-"The classical first program can be run in the listener:"
-{ $example "\"Hello, world\" print" "Hello, world" }
-"Multi-line phrases are supported:"
-{ $example "{ 1 2 3 } [\n    .\n] each" "1\n2\n3" }
-"The listener knows when to expect more input by looking at the height of the stack. Parsing words such as " { $link POSTPONE: { } " leave elements on the parser stack, and corresponding words such as " { $link POSTPONE: } } " pop them."
-$terpri
-"A very common operation is to inspect the contents of the data stack in the listener:"
-{ $subsection .s }
-"Note that calls to " { $link .s } " can also be included inside words as a debugging aid, however a more convenient way to achieve this is to use the annotation facility. See " { $link "annotations" } "."
-$terpri
-"You can start a nested listener or exit a listener using the following words:"
-{ $subsection tty }
-{ $subsection bye }
-"The following variables can be rebound inside a nested scope to customize the behavior of a listener; this can be done to create a development tool with a custom interaction loop:"
-{ $subsection listener-hook }
-"Finally, the multi-line expression reading word can be used independently of the rest of the listener:"
-{ $subsection parse-interactive } ;
-
-ARTICLE: "editor" "Editor integration"
-"Factor development is best done with one of the supported editors; this allows you to quickly jump to definitions from the Factor environment."
-$terpri
-"Depending on the editor you are using, you must load one of the following modules using " { $link require } ":"
-{ $list
-    { $snippet "libs/emacs" }
-    { $snippet "libs/jedit" }
-    { $snippet "libs/textmate" }
-    { $snippet "libs/vim" }
-}
-"These modules store a quotation in a global variable when loaded:"
-{ $subsection edit-hook }
-"To jump to a definition:"
-{ $subsection edit }
-"To jump to a source file:"
-{ $subsection edit-file }
-"To jump to a source file and line number:"
-{ $subsection edit-location }
-"To jump to the most recent syntax error:"
-{ $subsection :edit } ;
-
-ARTICLE: "sources" "Source files"
-"The simplest way to distribute a piece of Factor code is in the form of a source file. Source files can be loaded in the listener:"
-{ $subsection run-file }
-"Factor tracks which source files definitions were loaded from; see " { $link "definitions" } "."
-$terpri
-"Details on the Factor source parser itself can be found in " { $link "parser" } "."
-$terpri
-"Modules in the " { $snippet "apps/" } " and " { $snippet "libs/" } " directories of the Factor distribution should be loaded via the high-level module system instead of the above words (" { $link "modules" } ")." ;
-
-ARTICLE: "debugger" "The debugger"
-"If an expression entered in the listener throws an error, the error is printed to the output stream. A number of words facilitate interactive debugging of the error:"
-{ $subsection :s }
-{ $subsection :r }
-{ $subsection :c }
-{ $subsection :get }
-"You can get a more detailed explanation as most types of errors are documented:"
-{ $subsection :help }
-"If the error was recoverable, a list of restarts is also printed, and a numbered restart can be invoked:"
-{ $subsection :res }
-"If the error was a syntax error thrown by " { $link run-file } " or " { $link require } " while loading a source file, you can jump to the location of the error in your editor:"
-{ $subsection :edit }
-"You can read more about error handling in " { $link "errors" } "." ;
-
-ARTICLE: "inspector" "The inspector"
-"The prettyprinter (see " { $link "prettyprint" } ") can turn any object into a source representation. Sometimes this source representation is hard to read for a human, so the inspector provides an alternative tabular view of an object:"
-{ $subsection inspect }
-"The inspector supports a number of commands which operate on the most recently inspected object:"
-{ $subsection me }
-{ $subsection go }
-{ $subsection up }
-"Word for getting very brief descriptions of words and general objects:"
-{ $subsection summary } ;
-
-ARTICLE: "memory" "Object memory"
-"You can print object heap status information:"
-{ $subsection room. }
-{ $subsection heap-stats. }
-"Alternative forms of the above words return data on the stack instead of printing:"
-{ $subsection data-room }
-{ $subsection code-room }
-{ $subsection heap-stats }
-"There are a pair of combinators, analogous to " { $link each } " and " { $link subset } ", which operate on the entire collection of objects in the object heap:"
-{ $subsection each-object }
-{ $subsection instances }
-"You can request the amount of heap memory used by an object:"
-{ $subsection size }
-"The garbage collector can be invoked manually:"
-{ $subsection data-gc }
-{ $subsection full-gc }
-{ $subsection code-gc } ;
-
-ARTICLE: "word-introspection" "Word introspection"
-"Words support the definition protocol; see " { $link "definitions" } " for general tools that work with definitions. A few word-specific tools also exist:"
-{ $subsection apropos }
-{ $subsection vocabs }
-{ $subsection words }
-{ $subsection usage. } ;
-
-ARTICLE: "definitions" "Definitions"
-"A " { $emphasis "definition" } " is something read from a source file -- this includes words, methods, and help articles."
-$terpri
-"Words that work with definition take " { $emphasis "definition specifiers" } " as input. A definition specifier is one of the following:"
-{ $list
-    "a word"
-    "a two-element array, holding a class name and a generic word name, naming a method"
-    { "a " { $link link } " instance holding a word or a help topic, naming a piece of documentation" }
-}
-"The following words all accept definition specifiers."
-$terpri
-"Obtaining information about definitions:"
-{ $subsection see }
-{ $subsection where }
-{ $subsection subdefs }
-"Editing definitions:"
-{ $subsection edit }
-{ $subsection reload }
-"Removing definitions:"
-{ $subsection forget } ;
-
-ARTICLE: "timing" "Timing code"
-"You can time the execution of a quotation in the listener:"
-{ $subsection time }
-"A lower-level word puts timings on the stack, intead of printing:"
-{ $subsection benchmark }
-"You can also read the system clock and total garbage collection time directly:"
-{ $subsection millis } 
-{ $subsection gc-time } ;
-
-ARTICLE: "annotations" "Word annotations"
-"The word annotation feature modifies word definitions to add debugging code. You can restore the old definition by calling " { $link reload } " on the word in question."
-{ $subsection watch }
-{ $subsection profile }
-"All of the above words are implemented using a single combinator which applies a quotation to a word definition to yield a new definition:"
-{ $subsection annotate } ;
-
-ARTICLE: "images" "Working with images"
-"Factor is an " { $emphasis "image-based" } " system, meaning it integrates a persistence mechanism where the object heap can be checkpointed to disk and loaded back in. Every time Factor runs, it starts by loading an image. The image contains all code and data needed to run Factor in a \"ready-to-go\" form."
-$terpri
-"Image files are loaded by launching the Factor runtime with the image file as the first command line argument. Images are saved using one of the following two words; the latter takes an image path as a parameter:"
-{ $subsection save }
-{ $subsection save-image }
-"A new image can also be built from sources; this is known as " { $emphasis "bootstrap" } ". Bootstrap is a two-step process. The first stage is the creation of a bootstrap image inside a running Factor instance:"
-{ $subsection make-image }
-"The second stage is initiated by running the resulting bootstrap image. This stage loads any additional platform-specific code, compiles all words, and dumps a new, final image."
-$terpri
-"The bootstrap image supports a number of command line arguments; see " { $link "bootstrap-cli-args" } "." ;
diff --git a/core/handbook/words.facts b/core/handbook/words.facts
deleted file mode 100644 (file)
index 4a96a5f..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-USING: definitions help kernel parser words ;
-
-ARTICLE: "words" "Words"
-"Words are the fundamental unit of code in Factor, analogous to functions or procedures in other languages. Words are also objects, and this concept forms the basis for Factor's meta-programming facilities. A word consists of several parts:"
-{ $list
-    "a word name,"
-    "a vocabulary name,"
-    "a definition, specifying the behavior of the word when executed,"
-    "a set of word properties, including documentation and other meta-data."
-}
-"Words for working with words are in the " { $vocab-link "words" } " vocabulary."
-{ $subsection "vocabularies" }
-{ $subsection "word-definition" }
-{ $subsection "word-crossref" }
-{ $subsection "word-internals" } ;
-
-ARTICLE: "vocabularies" "Vocabularies"
-"Words are organized into named vocabularies, stored in a global variable."
-{ $subsection vocabularies }
-"A word is said to be " { $emphasis "interned" } " if it is a member of the vocabulary named by its vocabulary slot. Otherwise, the word is " { $emphasis "uninterned" } "."
-$terpri
-"Words whose names are known at parse time -- that is, most words making up your program -- can be referenced in source code by stating their name. However, the parser itself, and sometimes code you write, will need to create look up words dynamically."
-$terpri
-"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $vocab-link "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "vocabulary-search" } ")."
-{ $subsection create }
-{ $subsection create-in }
-{ $subsection gensym }
-{ $subsection lookup }
-"Words can output their name and vocabulary:"
-{ $subsection word-name }
-{ $subsection word-vocabulary } ;
-
-ARTICLE: "word-definition" "Defining words"
-"There are two approaches to creating word definitions:"
-{ $list
-    "using parsing words at parse time,"
-    "using defining words at run-time."
-}
-"The latter is a more dynamic feature that can be used to implement code generation and such, and in fact parse-time defining words are implemented in terms of run-time defining words."
-{ $subsection "colon-definition" }
-{ $subsection "symbols" }
-{ $subsection "primitives" }
-{ $subsection "deferred" }
-{ $subsection "undefining" }
-{ $subsection "declarations" } ;
-
-ARTICLE: "colon-definition" "Compound definitions"
-"A compound definition associates a word name with a quotation that is called when the word is executed."
-{ $subsection POSTPONE: : }
-{ $subsection define-compound }
-{ $subsection compound? }
-{ $subsection compound }
-"Colon definitions should declare their stack effect, unless the definition is completely trivial. See " { $link "effect-declaration" } "." ;
-
-ARTICLE: "symbols" "Symbols"
-{ $subsection POSTPONE: SYMBOL: }
-{ $subsection define-symbol }
-{ $subsection symbol? }
-{ $subsection symbol } ;
-
-ARTICLE: "primitives" "Primitives"
-"Executing a primitive invokes native code in the Factor runtime. Primitives cannot be defined through Factor code. Compiled definitions behave similarly to primitives in that the interpreter jumps to native code upon encountering them."
-{ $subsection primitive? }
-{ $subsection primitive } ;
-
-ARTICLE: "deferred" "Deferred words and mutual recursion"
-{ $subsection POSTPONE: DEFER: }
-{ $subsection undefined? }
-{ $subsection undefined } ;
-
-ARTICLE: "undefining" "Undefining words"
-{ $subsection POSTPONE: FORGET: }
-{ $subsection forget }
-{ $subsection interned? } ;
-
-ARTICLE: "declarations" "Declarations"
-"Declarations give special behavior to a word. Declarations are parsing words that set a word property in the most recently defined word."
-$terpri
-"The first declaration specifies the time when a word runs. It affects both interpreted and compiled definitions."
-{ $subsection POSTPONE: parsing }
-"The remaining declarations only affect compiled definitions. They do not change evaluation semantics of a word, but instead declare that the word follows a certain contract, and thus may be compiled differently."
-{ $warning "If a generic word is declared " { $link POSTPONE: foldable } ", all methods must satisfy the contract, otherwise unpredicable behavior will occur." }
-{ $subsection POSTPONE: inline }
-{ $subsection POSTPONE: foldable }
-"Stack effect declarations are documented in " { $link "effect-declaration" } "." ;
-
-ARTICLE: "word-props" "Word properties"
-"Each word has a hashtable of properties."
-{ $subsection word-prop }
-{ $subsection set-word-prop }
-{ $subsection word-props }
-{ $subsection set-word-props }
-"The stack effect of the above two words is designed so that it is most convenient when " { $snippet "name" } " is a literal pushed on the stack right before executing this word."
-$terpri
-"The following properties are set by the library:"
-{ $list
-    { { $snippet "\"parsing\"" } ", " { $snippet "\"inline\"" } ", " { $snippet "\"foldable\"" } " - declarations (see " { $link "declarations" } ")" }
-    { { $snippet "\"file\"" } " - the source file storing the word definition" }
-    { { $snippet "\"line\"" } " - the line number in the source file storing the word definition" }
-    { { $snippet "\"methods\"" } ", " { $snippet "\"combination\"" } " - only defined on generic words (see " { $link "generic" } ")" }
-    { { $snippet "\"predicate\"" } " - only defined on class words, stores a quotation that tests if the top of the stack is an instance of that class" }
-    { { $snippet "\"predicating\"" } " - only defined on class predicate words, stores the corresponding class word" }
-} ;
-
-ARTICLE: "word-crossref" "Cross-referencing"
-"The cross-reference database is updated every time a word is redefined."
-{ $subsection crossref }
-"You can find all words called by a given word:"
-{ $subsection uses }
-"As well as all words calling a given word:"
-{ $subsection usage }
-"In most cases the cross-reference database is maintained automatically, but if you do something unusual you might need to update it manually."
-{ $subsection xref-words } ;
-
-ARTICLE: "word-internals" "Word implementation details"
-"The behavior of a word when executed depends on the values of two slots:"
-{ $list
-    "the primitive number"
-    "the primitive parameter"
-}
-"The primitive number is an index into an array of native functions in the Factor runtime."
-$terpri
-"Primitive number accessors:"
-{ $subsection word-primitive }
-{ $subsection set-word-primitive }
-"Primitive parameter accessors:"
-{ $subsection word-def }
-{ $subsection set-word-def }
-"A lower-level facility for inspecting the machine code address of a word:"
-{ $subsection word-xt }
-{ $subsection update-xt } ;
diff --git a/core/hashtables/authors.txt b/core/hashtables/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/hashtables/hashtables-docs.factor b/core/hashtables/hashtables-docs.factor
new file mode 100644 (file)
index 0000000..d4aee1a
--- /dev/null
@@ -0,0 +1,138 @@
+USING: hashtables.private help.markup help.syntax
+kernel prettyprint generic sequences sequences.private
+namespaces assocs ;
+IN: hashtables
+
+ARTICLE: "hashtables.private" "Hashtable implementation details"
+"This hashtable implementation uses only one auxilliary array in addition to the hashtable tuple itself. The array stores keys in even slots and values in odd slots. Values are looked up with a hashing strategy that uses linear probing to resolve collisions."
+$nl
+"There are two special objects: the " { $link ((tombstone)) } " marker and the " { $link ((empty)) } " marker. Neither of these markers can be used as hashtable keys."
+$nl
+"The " { $link hash-count } " slot is the number of entries including deleted entries, and " { $link hash-deleted } " is the number of deleted entries."
+{ $subsection <hash-array> }
+{ $subsection nth-pair }
+{ $subsection set-nth-pair }
+{ $subsection find-pair }
+"If a hashtable's keys are mutated, or if hashing algorithms change, hashtables can be rehashed:"
+{ $subsection rehash } ;
+
+ARTICLE: "hashtables" "Hashtables"
+"A hashtable provides efficient (expected constant time) lookup and storage of key/value pairs. Keys are compared for equality, and a hashing function is used to reduce the number of comparisons made. The literal syntax is covered in " { $link "syntax-hashtables" } "."
+$nl
+"Hashtable words are in the " { $vocab-link "hashtables" } " vocabulary. Unsafe implementation words are in the " { $vocab-link "hashtables.private" } " vocabulary."
+$nl
+"Hashtables implement the " { $link "assocs-protocol" } "."
+$nl
+"Hashtables are a class of objects."
+{ $subsection hashtable }
+{ $subsection hashtable? }
+"You can create a new hashtable with an initial capacity."
+{ $subsection <hashtable> }
+"If you don't care about initial capacity, a more elegant way to create a new hashtable is to write:"
+{ $code "H{ } clone" }
+"To convert an assoc to a hashtable:"
+{ $subsection >hashtable }
+"Utility words to create a new hashtable from a single key/value pair:"
+{ $subsection associate }
+{ $subsection ?set-at }
+"Removing duplicate elements from a sequence in linear time, using a hashtable:"
+{ $subsection prune }
+{ $subsection "hashtables.private" } ;
+
+ABOUT: "hashtables"
+
+HELP: hashtable
+{ $description "The class of hashtables. See " { $link "syntax-hashtables" } " for syntax and " { $link "hashtables" } " for general information." } ;
+
+HELP: hash@
+{ $values { "key" "a key" } { "array" "the underlying array of a hashtable" } { "i" "the index to begin hashtable search" } }
+{ $description "Computes the index to begin searching from the hashcode of the key. Always outputs an even value since keys are stored at even indices of the underlying array." } ;
+
+HELP: probe
+{ $values { "array" "the underlying array of a hashtable" } { "i" "a search index" } }
+{ $description "Outputs the next hashtable search index." } ;
+
+HELP: key@
+{ $values { "key" "a key" } { "hash" hashtable } { "array" "the underlying array of the hashtable" } { "n" "the index of the key" } { "?" "a boolean indicating whether the key was present" } }
+{ $description "Searches the hashtable for the key using a linear probing strategy. Searches stop if either the key or an " { $link ((empty)) } " sentinel is found. Searches skip the " { $link ((tombstone)) } " sentinel." } ;
+
+{ key@ new-key@ } related-words
+
+HELP: new-key@
+{ $values { "key" "a key" } { "hash" hashtable } { "array" "the underlying array of the hashtable" } { "n" "the index where the key would be stored" } { "empty?" "a boolean indicating whether the location is currently empty" } }
+{ $description "Searches the hashtable for the key using a linear probing strategy. If the key is not present in the hashtable, outputs the index where it should be stored." } ;
+
+HELP: nth-pair
+{ $values { "n" "an index in the sequence" } { "seq" "a sequence" } { "key" "the first element of the pair" } { "value" "the second element of the pair" } }
+{ $description "Fetches the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
+{ $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because it does not perform bounds checks." } ;
+
+{ nth-pair set-nth-pair } related-words
+
+HELP: set-nth-pair
+{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "n" "an index in the sequence" } { "seq" "a sequence" } }
+{ $description "Stores a pair of values into the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
+{ $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because it does not perform bounds checks." }
+{ $side-effects "seq" } ;
+
+HELP: find-pair
+{ $values { "array" "an array of pairs" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "key" "the successful key" } { "value" "the successful value" } { "?" "a boolean of whether there was success" } }
+{ $description "Applies a quotation to successive pairs in the array, yielding the first successful pair." }
+{ $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because passing an array of odd length can lead to memory corruption." } ;
+
+HELP: reset-hash
+{ $values { "n" "a positive integer specifying hashtable capacity" } { "hash" hashtable } }
+{ $description "Resets the underlying array of the hashtable to a new array with the given capacity. Removes all entries from the hashtable." }
+{ $side-effects "hash" } ;
+
+HELP: hash-count+
+{ $values { "hash" hashtable } }
+{ $description "Called to increment the hashtable size when a new entry is added with " { $link set-at } }
+{ $side-effects "hash" } ;
+
+HELP: hash-deleted+
+{ $values { "hash" hashtable } }
+{ $description "Called to increment the deleted entry counter when an entry is removed with " { $link delete-at } }
+{ $side-effects "hash" } ;
+
+HELP: (set-hash)
+{ $values { "value" "a value" } { "key" "a key to add" } { "hash" hashtable } }
+{ $description "Stores the key/value pair into the hashtable. This word does not grow the hashtable if it exceeds capacity, therefore a hang can result. User code should use " { $link set-at } " instead, which grows the hashtable if necessary." }
+{ $side-effects "hash" } ;
+
+HELP: grow-hash
+{ $values { "hash" hashtable } }
+{ $description "Enlarges the capacity of a hashtable. User code does not need to call this word directly." }
+{ $side-effects "hash" } ;
+
+HELP: ?grow-hash
+{ $values { "hash" hashtable } }
+{ $description "Enlarges the capacity of a hashtable if it is almost full. User code does not need to call this word directly." }
+{ $side-effects "hash" } ;
+
+HELP: <hashtable>
+{ $values { "n" "a positive integer specifying hashtable capacity" } { "hash" "a new hashtable" } }
+{ $description "Create a new hashtable capable of storing " { $snippet "n" } " key/value pairs before growing." } ;
+
+HELP: (hashtable) ( -- hash )
+{ $values { "hash" "a new hashtable" } }
+{ $description "Allocates a hashtable stub object without an underlying array. User code should call " { $link <hashtable> } " instead." } ;
+
+HELP: associate
+{ $values { "value" "a value" } { "key" "a key" } { "hash" "a new " { $link hashtable } } }
+{ $description "Create a new hashtable holding one key/value pair." } ;
+
+HELP: >hashtable
+{ $values { "assoc" "an assoc" } { "hashtable" "a hashtable" } }
+{ $description "Constructs a hashtable from any assoc." } ;
+
+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 "USE: hashtables" "{ 1 1 t 3 t } prune ." "V{ 1 t 3 }" }
+} ;
+
+HELP: rehash
+{ $values { "hash" hashtable } }
+{ $description "Rebuild the hashtable. This word should be called if the hashcodes of the hashtable's keys have changed, or if the hashing algorithms themselves have changed, neither of which should occur during normal operation." } ;
diff --git a/core/hashtables/hashtables-tests.factor b/core/hashtables/hashtables-tests.factor
new file mode 100644 (file)
index 0000000..0c79eff
--- /dev/null
@@ -0,0 +1,162 @@
+IN: temporary
+USING: kernel math namespaces tools.test vectors sequences
+sequences.private hashtables io prettyprint assocs
+continuations ;
+
+[ f ] [ "hi" V{ 1 2 3 } at ] unit-test
+
+[ H{ } ] [ { } [ dup ] H{ } map>assoc ] unit-test
+
+[ ] [ 1000 [ dup sq ] H{ } map>assoc "testhash" set ] unit-test
+
+[ V{ } ]
+[ 1000 [ dup sq swap "testhash" get at = not ] subset ]
+unit-test
+
+[ t ]
+[ "testhash" get hashtable? ]
+unit-test
+
+[ f ]
+[ { 1 { 2 3 } } hashtable? ]
+unit-test
+
+! Test some hashcodes.
+
+[ t ] [ [ 1 2 3 ] hashcode [ 1 2 3 ] hashcode = ] unit-test
+[ t ] [ [ 1 [ 2 3 ] 4 ] hashcode [ 1 [ 2 3 ] 4 ] hashcode = ] unit-test
+
+[ t ] [ 12 hashcode 12 hashcode = ] unit-test
+[ t ] [ 12 >bignum hashcode 12 hashcode = ] unit-test
+[ t ] [ 12.0 hashcode 12 >bignum hashcode = ] unit-test
+
+! Test various odd keys to see if they work.
+
+16 <hashtable> "testhash" set
+
+t C{ 2 3 } "testhash" get set-at
+f 100000000000000000000000000 "testhash" get set-at
+{ } { [ { } ] } "testhash" get set-at
+
+[ t ] [ C{ 2 3 } "testhash" get at ] unit-test
+[ f ] [ 100000000000000000000000000 "testhash" get at* drop ] unit-test
+[ { } ] [ { [ { } ] } clone "testhash" get at* drop ] unit-test
+
+! Regression
+3 <hashtable> "broken-remove" set
+1 W{ \ + } dup "x" set "broken-remove" get set-at
+2 W{ \ = } dup "y" set "broken-remove" get set-at
+"x" get "broken-remove" get delete-at
+2 "y" get "broken-remove" get set-at
+[ 1 ] [ "broken-remove" get keys length ] unit-test
+
+{
+    { "salmon" "fish" }
+    { "crocodile" "reptile" }
+    { "cow" "mammal" }
+    { "visual basic" "language" }
+} >hashtable "testhash" set
+
+[ f f ] [
+    "visual basic" "testhash" get delete-at
+    "visual basic" "testhash" get at*
+] unit-test
+
+[ t ] [ H{ } dup = ] unit-test
+[ f ] [ "xyz" H{ } = ] unit-test
+[ t ] [ H{ } H{ } = ] unit-test
+[ f ] [ H{ { 1 3 } } H{ } = ] unit-test
+[ f ] [ H{ } H{ { 1 3 } } = ] unit-test
+[ t ] [ H{ { 1 3 } } H{ { 1 3 } } = ] unit-test
+[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } = ] unit-test
+
+! Testing the hash element counting
+
+H{ } clone "counting" set
+"value" "key" "counting" get set-at
+[ 1 ] [ "counting" get assoc-size ] unit-test
+"value" "key" "counting" get set-at
+[ 1 ] [ "counting" get assoc-size ] unit-test
+"key" "counting" get delete-at
+[ 0 ] [ "counting" get assoc-size ] unit-test
+"key" "counting" get delete-at
+[ 0 ] [ "counting" get assoc-size ] unit-test
+
+! Test rehashing
+
+2 <hashtable> "rehash" set
+
+1 1 "rehash" get set-at
+2 2 "rehash" get set-at
+3 3 "rehash" get set-at
+4 4 "rehash" get set-at
+5 5 "rehash" get set-at
+6 6 "rehash" get set-at
+
+[ 6 ] [ "rehash" get assoc-size ] unit-test
+
+[ 6 ] [ "rehash" get clone assoc-size ] unit-test
+
+"rehash" get clear-assoc
+
+[ 0 ] [ "rehash" get assoc-size ] unit-test
+
+[
+    3
+] [
+    2 H{
+        { 1 2 }
+        { 2 3 }
+    } clone at
+] unit-test
+
+! There was an assoc in place of assoc* somewhere
+3 <hashtable> "f-hash-test" set
+
+10 [ f f "f-hash-test" get set-at ] times
+
+[ 1 ] [ "f-hash-test" get assoc-size ] unit-test
+
+! Resource leak...
+H{ } "x" set
+100 [ drop "x" get clear-assoc ] each
+
+! Crash discovered by erg
+[ t ] [ 3/4 <hashtable> dup clone = ] unit-test
+
+! Another crash discovered by erg
+[ ] [
+    H{ } clone
+    [ 1 swap set-at ] catch drop
+    [ 2 swap set-at ] catch drop
+    [ 3 swap set-at ] catch drop
+    drop
+] unit-test
+
+[ H{ { -1 4 } { -3 16 } { -5 36 } } ] [
+    H{ { 1 2 } { 3 4 } { 5 6 } }
+    [ >r neg r> sq ] assoc-map
+] unit-test
+
+! Bug discovered by littledan
+[ { 5 5 5 5 } ] [
+    [
+        H{
+            { 1 2 }
+            { 2 3 }
+            { 3 4 }
+            { 4 5 }
+            { 5 6 }
+        } clone
+        dup keys length ,
+        dup assoc-size ,
+        dup rehash
+        dup keys length ,
+        assoc-size ,
+    ] { } make
+] unit-test
+
+[ { "one" "two" 3 } ] [
+    H{ { 1 "one" } { 2 "two" } }
+    { 1 2 3 } clone [ substitute ] keep
+] unit-test
diff --git a/core/hashtables/hashtables.factor b/core/hashtables/hashtables.factor
new file mode 100644 (file)
index 0000000..3050ed2
--- /dev/null
@@ -0,0 +1,197 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel kernel.private slots.private math assocs
+math.private sequences sequences.private vectors
+combinators ;
+IN: hashtables
+
+<PRIVATE
+
+: wrap ( i array -- n )
+    array-capacity 1 fixnum-fast fixnum-bitand ; inline
+
+: hash@ ( key array -- i )
+    >r hashcode >fixnum dup fixnum+fast r> wrap ; inline
+
+: probe ( array i -- array i )
+    2 fixnum+fast over wrap ; inline
+
+: (key@) ( key keys i -- array n ? )
+    #! cond form expanded by hand for better interpreter speed
+    3dup swap array-nth dup ((tombstone)) eq? [
+        2drop probe (key@)
+    ] [
+        dup ((empty)) eq? [
+            3drop nip f f
+        ] [
+            = [ rot drop t ] [ probe (key@) ] if
+        ] if
+    ] if ; inline
+
+: key@ ( key hash -- array n ? )
+    hash-array 2dup hash@ (key@) ; inline
+
+: <hash-array> ( n -- array )
+    1+ next-power-of-2 4 * ((empty)) <array> ; inline
+
+: init-hash ( hash -- )
+    0 over set-hash-count 0 swap set-hash-deleted ;
+
+: reset-hash ( n hash -- )
+    swap <hash-array> over set-hash-array init-hash ;
+
+: (new-key@) ( key keys i -- keys n empty? )
+    #! cond form expanded by hand for better interpreter speed
+    3dup swap array-nth dup ((empty)) eq? [
+        2drop rot drop t
+    ] [
+        = [
+            rot drop f
+        ] [
+            probe (new-key@)
+        ] if
+    ] if ; inline
+
+: new-key@ ( key hash -- array n empty? )
+    hash-array 2dup hash@ (new-key@) ; inline
+
+: nth-pair ( n seq -- key value )
+    swap 2 fixnum+fast 2dup slot -rot 1 fixnum+fast slot ;
+    inline
+
+: set-nth-pair ( value key n seq -- )
+    swap
+    2 fixnum+fast [ set-slot ] 2keep
+    1 fixnum+fast set-slot ; inline
+
+: hash-count+ ( hash -- )
+    dup hash-count 1+ swap set-hash-count ; inline
+
+: hash-deleted+ ( hash -- )
+    dup hash-deleted 1+ swap set-hash-deleted ; inline
+
+: (set-hash) ( value key hash -- )
+    2dup new-key@
+    [ rot hash-count+ ] [ rot drop ] if
+    swap set-nth-pair ; inline
+
+: find-pair-next >r 2 fixnum+fast r> ; inline
+
+: (find-pair) ( quot i array -- key value ? )
+    2dup array-capacity eq? [
+        3drop f f f
+    ] [
+        2dup array-nth tombstone? [
+            find-pair-next (find-pair)
+        ] [
+            [ nth-pair rot call ] 3keep roll [
+                nth-pair >r nip r> t
+            ] [
+                find-pair-next (find-pair)
+            ] if
+        ] if
+    ] if ; inline
+
+: find-pair ( array quot -- key value ? ) 0 rot (find-pair) ; inline
+
+: (rehash) ( hash array -- )
+    [ swap pick (set-hash) f ] find-pair 2drop 2drop ;
+
+: hash-large? ( hash -- ? )
+    dup hash-count 1 fixnum+fast 3 fixnum*fast
+    swap hash-array array-capacity > ;
+
+: hash-stale? ( hash -- ? )
+    dup hash-deleted 10 fixnum*fast swap hash-count fixnum> ;
+
+: grow-hash ( hash -- )
+    [ dup hash-array swap assoc-size 1+ ] keep
+    [ reset-hash ] keep
+    swap (rehash) ;
+
+: ?grow-hash ( hash -- )
+    dup hash-large? [
+        grow-hash
+    ] [
+        dup hash-stale? [
+            grow-hash
+        ] [
+            drop
+        ] if
+    ] if ; inline
+
+PRIVATE>
+
+: <hashtable> ( n -- hash )
+    (hashtable) [ reset-hash ] keep ;
+
+M: hashtable at* ( key hash -- value ? )
+    key@ [ 3 fixnum+fast slot t ] [ 2drop f f ] if ;
+
+M: hashtable clear-assoc ( hash -- )
+    dup init-hash hash-array [ drop ((empty)) ] change-each ;
+
+M: hashtable delete-at ( key hash -- )
+    tuck key@ [
+        >r >r ((tombstone)) dup r> r> swap set-nth-pair
+        hash-deleted+
+    ] [
+        3drop
+    ] if ;
+
+M: hashtable assoc-size ( hash -- n )
+    dup hash-count swap hash-deleted - ;
+
+: rehash ( hash -- )
+    dup hash-array
+    dup length ((empty)) <array> pick set-hash-array
+    0 pick set-hash-count
+    0 pick set-hash-deleted
+    (rehash) ;
+
+M: hashtable set-at ( value key hash -- )
+    dup ?grow-hash (set-hash) ;
+
+: associate ( value key -- hash )
+    2 <hashtable> [ set-at ] keep ;
+
+M: hashtable assoc-find ( hash quot -- key value ? )
+    >r hash-array r> find-pair ;
+
+M: hashtable clone
+    (clone) dup hash-array clone over set-hash-array ;
+
+M: hashtable equal?
+    {
+        { [ over hashtable? not ] [ 2drop f ] }
+        { [ 2dup [ assoc-size ] 2apply number= not ] [ 2drop f ] }
+        { [ t ] [ assoc= ] }
+    } cond ;
+
+M: hashtable hashcode*
+    dup assoc-size 1 number=
+    [ assoc-hashcode ] [ nip assoc-size ] if ;
+
+! Default method
+M: assoc new-assoc drop <hashtable> ;
+
+M: f new-assoc drop <hashtable> ;
+
+: >hashtable ( assoc -- hashtable )
+    H{ } assoc-clone-like ;
+
+M: hashtable assoc-like
+    drop dup hashtable? [ >hashtable ] unless ;
+
+: ?set-at ( value key assoc/f -- assoc )
+    [ [ set-at ] keep ] [ associate ] if* ;
+
+: (prune) ( hash vec elt -- )
+    rot 2dup key?
+    [ 3drop ] [ dupd dupd set-at swap push ] if ; inline
+
+: prune ( seq -- newseq )
+    dup length <hashtable> over length <vector>
+    rot [ >r 2dup r> (prune) ] each nip ;
+
+INSTANCE: hashtable assoc
diff --git a/core/hashtables/summary.txt b/core/hashtables/summary.txt
new file mode 100644 (file)
index 0000000..46b82eb
--- /dev/null
@@ -0,0 +1 @@
+Associative structure with expected constant time lookup
diff --git a/core/hashtables/tags.txt b/core/hashtables/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/help/help.factor b/core/help/help.factor
deleted file mode 100644 (file)
index 6566baa..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: help
-USING: arrays io kernel namespaces parser prettyprint sequences
-words hashtables definitions errors generic ;
-
-M: word article-title
-    dup parsing? [
-        word-name
-    ] [
-        dup word-name
-        swap stack-effect
-        [ effect>string " " swap 3append ] when*
-    ] if ;
-
-M: word article-content
-    [
-        \ $vocabulary over 2array ,
-        dup word-help [
-            %
-        ] [
-            dup "predicating" word-prop [
-                \ $predicate swap 2array ,
-            ] when*
-        ] if*
-        \ $definition swap 2array ,
-    ] { } make ;
-
-: $title ( topic -- )
-    title-style get [
-        title-style get [
-            dup [ 1array $link ] ($block) $doc-path
-        ] with-nesting
-    ] with-style terpri ;
-
-: (help) ( topic -- ) article-content print-content ;
-
-: help ( topic -- ) dup $title (help) terpri ;
-
-: handbook ( -- ) "handbook" help ;
-
-: $subtopic ( element -- )
-    [
-        subtopic-style get [
-            unclip f rot [ print-content ] curry write-outliner
-        ] with-style
-    ] ($block) ;
-
-: ($subsection) ( object -- )
-    [ article-title ] keep >link
-    dup [ (help) ] curry
-    write-outliner ;
-
-: $subsection ( element -- )
-    [
-        subsection-style get [ first ($subsection) ] with-style
-    ] ($block) ;
-
-: help-outliner ( seq quot -- )
-    subsection-style get [
-        sort-articles [ ($subsection) ] [ terpri ] interleave
-    ] with-style ;
-
-: $outliner ( element -- )
-    first call dup empty?
-    [ drop ] [ [ help-outliner ] ($block) ] if ;
-
-: remove-article ( name -- )
-    dup articles get hash-member? [
-        dup unxref-article
-        dup articles get remove-hash
-    ] when drop ;
-
-: add-article ( article name -- )
-    [ remove-article ] keep
-    [ articles get set-hash ] keep
-    xref-article ;
-
-: remove-word-help ( word -- )
-    dup word-help [ dup unxref-article ] when drop ;
-
-: set-word-help ( content word -- )
-    [ remove-word-help ] keep
-    [ swap "help" set-word-prop ] keep
-    xref-article ;
diff --git a/core/help/help.facts b/core/help/help.facts
deleted file mode 100644 (file)
index 6e39395..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-IN: help
-USING: definitions io prettyprint ;
-
-HELP: $title
-{ $values { "topic" "a help article name or a word" } }
-{ $description "Prints a help article's title, or a word's " { $link summary } ", depending on the type of " { $snippet "topic" } "." } ;
-
-HELP: (help)
-{ $values { "topic" "an article name or a word" } }
-{ $description
-    "Displays a help article or documentation associated to a word on the " { $link stdio } " stream. This word does not print the article title, so it is intended for use by outliners and in other contexts where the title is already visible to the user."
-}
-{ $see-also help } ;
-
-HELP: help
-{ $values { "topic" "an article name or a word" } }
-{ $description
-    "Displays a help article or documentation associated to a word on the " { $link stdio } " stream."
-}
-{ $see-also (help) } ;
-
-HELP: handbook
-{ $description "Displays the Factor developer's handbook." }
-{ $see-also help } ;
-
-HELP: $subsection
-{ $values { "element" "a markup element of the form " { $snippet "{ topic }" } } }
-{ $description "Prints an expandable outliner containing the body of the help topic named by the first string element of " { $snippet "element" } "." }
-{ $examples
-    { $markup-example { $subsection "sequences" } }
-} ;
-
-HELP: $subtopic
-{ $values { "element" "a markup element of the form " { $snippet "{ title content }" } } }
-{ $description "Prints an expandable outliner with the given title containing an arbitrary markup element." }
-{ $examples
-    { $markup-example { $subtopic "Subtopic example"
-    "Subtopics are useful for short notes, sidebars "
-    "and other bits of info which don't really deserve "
-    "their own help article." } }
-} ;
-
-HELP: $outliner
-{ $values { "element" "a markup element containing one quotation with stack effect " { $snippet "( quot -- )" } } }
-{ $description "Calls the quotation to generate a sequence of help topics, and outputs an outliner for each one. Expanding a help topic shows the article body." } ;
-
-HELP: help-outliner
-{ $values { "seq" "a sequence of help article names and words" } { "quot" "a quotation with stack effect " { $snippet "( topic -- )" } } }
-{ $description "Writes an outliner of help topics to the " { $link stdio } " stream. Expanding a help topic calls " { $snippet "quot" } " with the topic on the data stack." } ;
diff --git a/core/help/load.factor b/core/help/load.factor
deleted file mode 100644 (file)
index 561e1bc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-PROVIDE: core/help
-{ +files+ {
-    "stylesheet.factor"
-    "topics.factor"
-    "markup.factor"
-    "help.factor"
-    "syntax.factor"
-} }
-{ +tests+ {
-    "test/topics.factor"
-} } ;
diff --git a/core/help/markup.factor b/core/help/markup.factor
deleted file mode 100644 (file)
index bf74290..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays definitions generic hashtables io kernel
-namespaces parser prettyprint sequences strings styles vectors
-words ;
-IN: help
-
-! Simple markup language.
-
-! <element> ::== <string> | <simple-element> | <fancy-element>
-! <simple-element> ::== { <element>* }
-! <fancy-element> ::== { <type> <element> }
-
-! Element types are words whose name begins with $.
-
-PREDICATE: array simple-element
-    dup empty? [ drop t ] [ first word? not ] if ;
-
-M: simple-element elements* [ elements* ] each-with ;
-
-M: object elements* 2drop ;
-
-M: array elements*
-    [ [ elements* ] each-with ] 2keep
-    [ first eq? ] keep swap [ , ] [ drop ] if ;
-
-SYMBOL: last-element
-SYMBOL: span
-SYMBOL: block
-SYMBOL: table
-
-: last-span? last-element get span eq? ;
-: last-block? last-element get block eq? ;
-
-: ($span) ( quot -- )
-    last-block? [ terpri ] when
-    span last-element set
-    call ; inline
-
-GENERIC: print-element ( element -- )
-
-M: simple-element print-element [ print-element ] each ;
-M: string print-element [ write ] ($span) ;
-M: array print-element unclip execute ;
-M: word print-element { } swap execute ;
-M: f print-element drop ;
-
-: print-element* ( element style -- )
-    [ print-element ] with-style ;
-
-: with-default-style ( quot -- )
-    default-style get [
-        last-element off
-        H{ } swap with-nesting
-    ] with-style ; inline
-
-: print-content ( element -- )
-    last-element off
-    [ print-element ] with-default-style ;
-
-: ($block) ( quot -- )
-    last-element get { f table } member? [ terpri ] unless
-    span last-element set
-    call
-    block last-element set ; inline
-
-! Some spans
-
-: $snippet [ snippet-style get print-element* ] ($span) ;
-
-: $emphasis [ emphasis-style get print-element* ] ($span) ;
-
-: $strong [ strong-style get print-element* ] ($span) ;
-
-: $url [ url-style get print-element* ] ($span) ;
-
-: $terpri terpri terpri drop ;
-
-! Some blocks
-: ($heading)
-    last-element get [ terpri ] when ($block) ; inline
-
-: $heading ( element -- )
-    [ heading-style get print-element* ] ($heading) ;
-
-: ($code) ( presentation quot -- )
-    [
-        code-style get [
-            last-element off
-            >r presented associate code-style get hash-union r>
-            with-nesting
-        ] with-style
-    ] ($block) ; inline
-
-: $code ( element -- )
-    "\n" join dup <input> [ write ] ($code) ;
-
-: $syntax ( element -- ) "Syntax" $heading $code ;
-
-: $description ( element -- )
-    "Word description" $heading print-element ;
-
-: $class-description ( element -- )
-    "Class description" $heading print-element ;
-
-: $error-description ( element -- )
-    "Error description" $heading print-element ;
-
-: $var-description ( element -- )
-    "Variable description" $heading print-element ;
-
-: $contract ( element -- )
-    "Generic word contract" $heading print-element ;
-
-: $examples ( element -- )
-    "Examples" $heading print-element ;
-
-: $example ( element -- )
-    1 swap cut* swap "\n" join dup <input> [
-        input-style get format terpri print-element
-    ] ($code) ;
-
-: $markup-example ( element -- )
-    first dup unparse " print-element" append 1array $code
-    print-element ;
-
-: $warning ( element -- )
-    [
-        warning-style get [
-            last-element off
-            "Warning" $heading print-element
-        ] with-nesting
-    ] ($heading) ;
-
-! Some links
-: >link ( obj -- obj ) dup link? [ <link> ] unless ;
-
-: ($link) ( article -- )
-    link-style get [
-        dup article-title swap >link write-object
-    ] with-style ;
-
-: $link ( element -- )
-    first ($link) ;
-
-: $vocab-link ( element -- )
-    first link-style get [
-        dup <vocab-link> write-object
-    ] with-style ;
-
-: $vocabulary ( element -- )
-    [ word-vocabulary ] map
-    [ "Vocabulary" $heading terpri $vocab-link ] when* ;
-
-: textual-list ( seq quot -- )
-    [ ", " print-element ] interleave ; inline
-
-: $links ( topics -- )
-    [ [ 1array $link ] textual-list ] ($span) ;
-
-: $see-also ( topics -- )
-    "See also" $heading $links ;
-
-: $doc-path ( article -- )
-    doc-path dup empty? [
-        drop
-    ] [
-        [
-            doc-path-style get [
-                "Parent topics: " write $links
-            ] with-style
-        ] ($block)
-    ] if ;
-
-: $grid ( content style -- )
-    [
-        table-content-style get [
-            [ last-element off print-element ] tabular-output
-        ] with-style
-    ] ($block) table last-element set ;
-
-: $list ( element -- )
-    [ bullet get swap 2array ] map list-style get $grid ;
-
-: $table ( element -- )
-    table-style get $grid ;
-
-: a/an ( str -- str )
-    first "aeiou" member? "an" "a" ? ;
-
-: $instance ( element -- )
-    first dup word-name a/an write bl ($link) ;
-
-: values-row ( seq -- seq )
-    unclip \ $snippet swap 2array
-    swap dup first word? [ \ $instance add* ] when 2array ;
-
-: $values ( element -- )
-    "Inputs and outputs" $heading
-    [ values-row ] map $table ;
-
-: $predicate ( element -- )
-    { { "object" "an object" } } $values
-    [
-        "Tests if the object is an instance of the " ,
-        { $link } swap append ,
-        " class." ,
-    ] { } make $description ;
-
-: $errors ( element -- )
-    "Errors" $heading print-element ;
-
-: $side-effects ( element -- )
-    "Side effects" $heading "Modifies " print-element
-    [ $snippet ] textual-list ;
-
-: $notes ( element -- )
-    "Notes" $heading print-element ;
-
-: ($see) ( word -- )
-    [
-        code-style get [
-            code-style get [ see ] with-nesting
-        ] with-style
-    ] ($block) ;
-
-: $see ( element -- ) first ($see) ;
-
-: $definition ( word -- )
-    "Definition" $heading $see ;
-
-: $curious ( element -- )
-    "For the curious..." $heading print-element ;
-
-: $references ( element -- )
-    "References" $heading
-    unclip print-element [ \ $link swap 2array ] map $list ;
-
-: $shuffle ( element -- )
-    drop
-    "Shuffle word. Re-arranges the stack according to the stack effect pattern." $description ;
-
-: $low-level-note
-    drop
-    "Calling this word directly is not necessary in most cases. Higher-level words call it automatically." $notes ;
-
-: $values-x/y
-    drop
-    { { "x" "a complex number" } { "y" "a complex number" } } $values ;
-
-: $io-error
-    drop
-    "Throws an error if the I/O operation fails." $errors ;
-
-: $prettyprinting-note
-    drop {
-        "This word should only be called from inside the "
-        { $link with-pprint } " combinator."
-    } $notes ;
-
-: sort-articles ( seq -- newseq )
-    [ dup article-title 2array ] map
-    [ [ second ] 2apply <=> ] sort
-    0 <column> ;
-
-: error? ( word -- ? )
-    \ $error-description swap word-help elements empty? not ;
-
-: all-errors ( -- seq )
-    all-words [ error? ] subset sort-articles ;
diff --git a/core/help/markup.facts b/core/help/markup.facts
deleted file mode 100644 (file)
index 53fd43d..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-IN: help
-USING: arrays definitions tools io math prettyprint
-sequences ;
-
-HELP: print-element
-{ $values { "element" "a markup element" } }
-{ $description "Prints a markup element to the " { $link stdio } " stream." } ;
-
-HELP: print-content
-{ $values { "element" "a markup element" } }
-{ $description "Prints a top-level markup element to the " { $link stdio } " stream." } ;
-
-HELP: simple-element
-{ $class-description "Class of simple elements, which are just arrays of elements." } ;
-
-HELP: ($span)
-{ $values { "quot" "a quotation" } }
-{ $description "Prints an inline markup element." } ;
-
-HELP: ($block)
-{ $values { "quot" "a quotation" } }
-{ $description "Prints a block markup element with newlines before and after." } ;
-
-HELP: $heading
-{ $values { "element" "a markup element" } }
-{ $description "Prints a markup element, usually a string, as a block with the " { $link heading-style } "." }
-{ $examples
-    { $markup-example { $heading "What remains to be discovered" } }
-} ;
-
-HELP: $code
-{ $values { "element" "a markup element of the form " { $snippet "{ string... }" } } }
-{ $description "Prints code examples, as seen in many help articles. The markup element must be an array of strings." }
-{ $notes
-    "The code becomes clickable if the output stream supports it, and clicking it opens a listener window with the text inserted at the input prompt."
-    $terpri
-    "If you want to show code along with sample output, use the " { $link $example } " element."
-}
-{ $examples
-    { $markup-example { $code "2 2 + ." } }
-} ;
-
-HELP: $vocabulary
-{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
-{ $description "Prints a word's vocabulary. This markup element is automatically output by the help system, so help descriptions of parsing words should not call it." } ;
-
-HELP: $description
-{ $values { "element" "a markup element" } }
-{ $description "Prints the description subheading found on the help page of most words." } ;
-
-HELP: $contract
-{ $values { "element" "a markup element" } }
-{ $description "Prints a heading followed by a contract, found on the help page of generic words. Every generic word should document a contract which specifies method behavior that callers can rely upon, and implementations must obey." }
-{ $examples
-    { $markup-example { $contract "Methods of this generic word must always crash." } }
-} ;
-
-HELP: $examples
-{ $values { "element" "a markup element" } }
-{ $description "Prints a heading followed by some examples. Word documentation should include examples, at least if the usage of the word is not entirely obvious." }
-{ $examples
-    { $markup-example { $examples { $example "2 2 + ." "4" } } }
-} ;
-
-HELP: $example
-{ $values { "element" "a markup element of the form " { $snippet "{ inputs... output }" } } }
-{ $description "Prints a clickable example with sample output. The markup element must be an array of strings. All but the last string are joined by newlines and taken as the input text, and the last string is the output. The example becomes clickable if the output stream supports it, and clicking it opens a listener window with the input text inserted at the input prompt." }
-{ $examples
-    "The output text should be a string of what the input prints when executed, not the final stack contents or anything like that. So the following is an incorrect example:"
-    { $markup-example { $example "2 2 +" "4" } }
-    "However the following is right:"
-    { $markup-example { $example "2 2 + ." "4" } }
-    "Examples can incorporate a call to " { $link .s } " to show multiple output values; the convention is that you may assume the stack is empty before the example evaluates."
-} ;
-
-HELP: $markup-example
-{ $values { "element" "a markup element" } }
-{ $description "Prints a clickable example showing the prettyprinted source text of " { $snippet "element" } " followed by rendered output. The example becomes clickable if the output stream supports it." }
-{ $examples
-    { $markup-example { $markup-example { $emphasis "Hi" } } }
-} ;
-
-HELP: $warning
-{ $values { "element" "a markup element" } }
-{ $description "Prints an element inset in a block styled as so to draw the reader's attention towards it." }
-{ $examples
-    { $markup-example { $warning "Incorrect use of this product may cause serious injury or death." } }
-} ;
-
-HELP: $link
-{ $values { "element" "a markup element of the form " { $snippet "{ topic }" } } }
-{ $description "Prints a link to a help article or word." }
-{ $examples
-    { $markup-example { $link "queues" } }
-    { $markup-example { $link + } }
-} ;
-
-HELP: textual-list
-{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- )" } } }
-{ $description "Applies the quotation to each element of the sequence, printing a comma between each pair of elements." }
-{ $examples
-    { $example "{ \"fish\" \"chips\" \"salt\" } [ write ] textual-list" "fish, chips, salt" }
-} ;
-
-HELP: $links
-{ $values { "topics" "a sequence of article names or words" } }
-{ $description "Prints a series of links to help articles or word documentation." }
-{ $notes "This markup element is used to implement " { $link $links } "." }
-{ $examples
-    { $markup-example { $links + - * / } }
-} ;
-
-HELP: $see-also
-{ $values { "topics" "a sequence of article names or words" } }
-{ $description "Prints a heading followed by a series of links." }
-{ $examples
-    { $markup-example { $see-also "graphs" "queues" } }
-} ;
-
-HELP: $table
-{ $values { "element" "an array of arrays of markup elements" } }
-{ $description "Prints a table given as an array of rows, where each row must have the same number of columns." }
-{ $examples
-    { $markup-example
-        { $table
-            { "a" "b" "c" }
-            { "d" "e" "f" } 
-        }
-    }
-} ;
-
-HELP: $values
-{ $values { "element" "an array of pairs of markup elements" } }
-{ $description "Prints the description of arguments and values found on every word help page. The first element of a pair is the argument name and is output with " { $link $snippet } ". The remainder can be an element of any form." } ;
-
-HELP: $predicate
-{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
-{ $description "Prints the boilerplate description of a class membership predicate word such as " { $link array? } " or " { $link integer? } "." } ;
-
-HELP: $list
-{ $values { "element" "an array of markup elements" } }
-{ $description "Prints a bulleted list of markup elements." }
-{ $notes
-    "A common mistake is that if an item consists of more than just a string, it will be broken up as several items:"
-    { $markup-example
-        { $list
-            "First item"
-            "Second item " { $emphasis "with emphasis" }
-        }
-    }
-    "The fix is easy; just group the two markup elements making up the second item into one markup element:"
-    { $markup-example
-        { $list
-            "First item"
-            { "Second item " { $emphasis "with emphasis" } }
-        }
-    }
-} ;
-
-HELP: $errors
-{ $values { "element" "a markup element" } }
-{ $description "Prints the errors subheading found on the help page of some words. This section should document any errors thrown by the word." }
-{ $examples
-    { $markup-example { $errors "I/O errors, network errors, hardware errors... oh my!" } }
-} ;
-
-HELP: $side-effects
-{ $values { "element" "a markup element of the form " { $snippet "{ string... }" } } }
-{ $description "Prints a heading followed by a list of input values or variables which are modified by the word being documented." }
-{ $examples
-    { $markup-example
-        { { $values { "seq" "a mutable sequence" } } { $side-effects "seq" } }
-    }
-} ;
-
-HELP: $notes
-{ $values { "element" "a markup element" } }
-{ $description "Prints the errors subheading found on the help page of some words. This section should usage tips and pitfalls." } ;
-
-HELP: $see
-{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
-{ $description "Prints the definition of " { $snippet "word" } " by calling " { $link see } "." }
-{ $examples
-    { $markup-example { "Here is a word definition:" { $see reverse } } }
-} ;
-
-HELP: $definition
-{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
-{ $description "Prints a heading followed by the definition of " { $snippet "word" } " by calling " { $link see } "." } ;
-
-HELP: $curious
-{ $values { "element" "a markup element" } }
-{ $description "Prints a heading followed by a markup element." }
-{ $notes "This element type is used by the cookbook-style introductory articles in the " { $link "handbook" } "." } ;
-
-HELP: $references
-{ $values { "element" "a markup element of the form " { $snippet "{ topic... }" } } }
-{ $description "Prints a heading followed by a series of links." }
-{ $notes "This element type is used by the cookbook-style introductory articles in the " { $link "handbook" } "." } ;
-
-HELP: sort-articles
-{ $values { "seq" "a sequence of help article names and words" } { "assoc" "a new sequence of pairs" } }
-{ $description "Constructs a key-sorted association list mapping article titles to help topics." } ;
diff --git a/core/help/stylesheet.factor b/core/help/stylesheet.factor
deleted file mode 100644 (file)
index 7495156..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: help
-USING: styles namespaces ;
-
-SYMBOL: default-style
-H{
-    { font "sans-serif" }
-    { font-size 12 }
-    { font-style plain }
-    { wrap-margin 500 }
-} default-style set-global
-
-SYMBOL: link-style
-H{
-    { foreground { 0 0 0.3 1 } }
-    { font-style bold }
-} link-style set-global
-
-SYMBOL: emphasis-style
-H{ { font-style italic } } emphasis-style set-global
-
-SYMBOL: strong-style
-H{ { font-style bold } } strong-style set-global
-
-SYMBOL: title-style
-H{
-    { font "sans-serif" }
-    { font-size 16 }
-    { font-style bold }
-    { wrap-margin 500 }
-    { page-color { 0.8 0.8 1 1 } }
-    { border-width 5 }
-} title-style set-global
-
-SYMBOL: doc-path-style
-H{ { font-size 10 } } doc-path-style set-global
-
-SYMBOL: heading-style
-H{
-    { font "sans-serif" }
-    { font-size 14 }
-    { font-style bold }
-} heading-style set-global
-
-SYMBOL: subsection-style
-H{
-    { font "sans-serif" }
-    { font-size 14 }
-    { font-style bold }
-} subsection-style set-global
-
-SYMBOL: subtopic-style
-H{ { font-style bold } } subtopic-style set-global
-
-SYMBOL: snippet-style
-H{
-    { font "monospace" }
-    { foreground { 0.3 0.3 0.3 1 } }
-} snippet-style set-global
-
-SYMBOL: code-style
-H{
-    { font "monospace" }
-    { font-size 12 }
-    { page-color { 0.8 0.8 0.8 0.5 } }
-    { border-width 5 }
-    { wrap-margin f }
-} code-style set-global
-
-SYMBOL: input-style
-H{ { font-style bold } } input-style set-global
-
-SYMBOL: url-style
-H{
-    { font "monospace" }
-    { foreground { 0.0 0.0 1.0 1.0 } }
-} url-style set-global
-
-SYMBOL: warning-style
-H{
-    { page-color { 0.95 0.95 0.95 1 } }
-    { border-color { 1 0 0 1 } }
-    { border-width 5 }
-} warning-style set-global
-
-SYMBOL: table-content-style
-H{
-    { wrap-margin 350 }
-} table-content-style set-global
-
-SYMBOL: table-style
-H{
-    { table-gap { 5 5 } }
-    { table-border { 0.8 0.8 0.8 1.0 } }
-} table-style set-global
-
-SYMBOL: list-style
-H{ { table-gap { 10 2 } } } list-style set-global
-
-SYMBOL: bullet
-"- " bullet set-global
diff --git a/core/help/syntax.factor b/core/help/syntax.factor
deleted file mode 100644 (file)
index 68904cb..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2005 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: !syntax
-USING: arrays help kernel parser sequences syntax words ;
-
-: !HELP:
-    scan-word bootstrap-word dup set-word
-    dup location "help-loc" set-word-prop
-    [ >array swap set-word-help ] f ; parsing
-
-: !ARTICLE:
-    location
-    [
-        swap >r >array [ first2 ] keep 2 tail r> <article>
-        swap add-article
-    ]
-    f ; parsing
diff --git a/core/help/syntax.facts b/core/help/syntax.facts
deleted file mode 100644 (file)
index df2fbdc..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-USING: help ;
-
-HELP: HELP:
-{ $syntax "HELP: word content... ;" }
-{ $values { "word" "a word" } { "content" "markup elements" } }
-{ $description "Defines documentation for a word." }
-{ $examples
-    { $code
-        ": foo 2 + ;"
-        "HELP: foo"
-        "{ $values { \"m\" \"an integer\" } { \"n\" \"an integer\" } }"
-        "{ $description \"Increments a value by 2.\" } ;"
-        "\\ foo help"
-    }
-} ;
-
-HELP: ARTICLE:
-{ $syntax "ARTICLE: topic title content... ;" }
-{ $values { "topic" "an object" } { "title" "a string" } { "content" "markup elements" } }
-{ $description "Defines a help article. String topic names are reserved for core documentation. Contributed modules should name articles by arrays, where the first element of an array identifies the module; for example, " { $snippet "{ \"httpd\" \"intro\" }" } "." }
-{ $examples
-    { $code
-        "ARTICLE: \"example\" \"An example article\""
-        "\"Hello world.\" ;"
-    }
-} ;
diff --git a/core/help/test/search.factor b/core/help/test/search.factor
deleted file mode 100644 (file)
index 6cb42aa..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-IN: temporary
-USING: help sequences math test ;
-
-[ t ]
-[ "variables" search-help [ second number? ] all? ]
-unit-test
diff --git a/core/help/test/topics.factor b/core/help/test/topics.factor
deleted file mode 100644 (file)
index 834662b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-IN: temporary
-USING: definitions help kernel sequences test words parser
-namespaces hashtables ;
-
-! Test help cross-referencing
-
-"Test B" { "Hello world." } f <article> { "test" "b" } add-article
-
-"Test A" { { $subsection { "test" "b" } } } f <article> { "test" "a" } add-article
-
-{ "test" "a" } remove-article
-
-[ t ] [ { "test" "b" } parents empty? ] unit-test
-
-SYMBOL: foo
-
-{ "test" "a" } "Test A" { { $subsection foo } } f <article> add-article
-
-! Test article location recording
-
-[ ] [
-    {
-        "ARTICLE: { \"test\" 1 } \"Hello\""
-        "\"abc\""
-        "\"def\" ;"
-    } "\n" join
-    [
-        "testfile" file set
-        eval
-    ] with-scope
-] unit-test
-
-[ { "testfile" 1 } ]
-[ { "test" 1 } articles get hash article-loc ] unit-test
-
-[ ] [ { "test" 1 } remove-article ] unit-test
diff --git a/core/help/topics.factor b/core/help/topics.factor
deleted file mode 100644 (file)
index fda7892..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: help
-USING: arrays definitions errors generic graphs hashtables
-io kernel namespaces prettyprint prettyprint-internals
-sequences words ;
-
-! Help articles
-SYMBOL: articles
-
-TUPLE: article title content loc ;
-
-TUPLE: no-article name ;
-: no-article ( name -- * ) <no-article> throw ;
-
-: article ( name -- article )
-    dup articles get hash [ ] [ no-article ] ?if ;
-
-M: object article-title article article-title ;
-M: object article-content article article-content ;
-
-TUPLE: link name ;
-
-M: link article-title link-name article-title ;
-M: link article-content link-name article-content ;
-M: link summary "Link: " swap link-name unparse append ;
-
-! Special case: f help
-M: f article-title drop \ f article-title ;
-M: f article-content drop \ f article-content ;
-
-: word-help ( word -- content ) "help" word-prop ;
-
-: all-articles ( -- seq )
-    articles get hash-keys
-    all-words [ word-help ] subset append ;
-
-GENERIC: elements* ( elt-type element -- )
-
-: elements ( elt-type element -- seq ) [ elements* ] { } make ;
-
-: collect-elements ( element seq -- elements )
-    [
-        [
-            swap elements [
-                1 tail [ dup set ] each
-            ] each
-        ] each-with
-    ] make-hash hash-keys ;
-
-SYMBOL: parent-graph
-
-DEFER: $subsection
-
-: children ( topic -- seq )
-    article-content { $subsection } collect-elements ;
-
-: parents ( topic -- seq )
-    dup link? [ link-name ] when parent-graph get in-edges ;
-
-: (doc-path) ( topic -- )
-    dup , parents [ word? not ] subset dup empty?
-    [ drop ] [ [ (doc-path) ] each ] if ;
-
-: doc-path ( topic -- seq )
-    [ (doc-path) ] { } make 1 tail prune ;
-
-: xref-article ( topic -- )
-    [ children ] parent-graph get add-vertex ;
-
-: unxref-article ( topic -- )
-    [ children ] parent-graph get remove-vertex ;
-
-: xref-help ( -- )
-    all-articles [ children ] parent-graph get build-graph ;
diff --git a/core/help/topics.facts b/core/help/topics.facts
deleted file mode 100644 (file)
index 72ae862..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-IN: help
-USING: io ;
-
-HELP: articles
-{ $var-description "Hashtable mapping article names to " { $link article } " instances." } ;
-
-HELP: no-article
-{ $values { "name" "an article name" } }
-{ $description "Throws a " { $link no-article } " error." }
-{ $error-description "Thrown by " { $link help } " if the given help topic does not exist, or if the help topic being dispayed links to a help topic which does not exist." } ;
-
-HELP: article
-{ $values { "name" "an article name" } { "article" "an " { $link article } " object" } }
-{ $description "Outputs a named " { $link article } " object." } ;
-
-HELP: article-title ( topic -- string )
-{ $values { "topic" "an article name or a word" } { "string" "a string" } }
-{ $description "Outputs the title of a specific help article." } ;
-
-HELP: article-content ( topic -- element )
-{ $values { "topic" "an article name or a word" } { "element" "a markup element" } }
-{ $description "Outputs the content of a specific help article." } ;
-
-HELP: all-articles
-{ $values { "seq" "a sequence" } }
-{ $description "Outputs a sequence of all help article names, and all words with documentation." } ;
-
-HELP: elements
-{ $values { "elt-type" "a word" } { "element" "a markup element" } { "seq" "a new sequence" } }
-{ $description "Outputs a sequence of all elements of type " { $snippet "elt-type" } " found by traversing " { $snippet "element" } "." } ;
-
-HELP: collect-elements
-{ $values { "element" "a markup element" } { "seq" "a sequence of words" } { "elements" "a new sequence" } }
-{ $description "Collects the arguments of all sub-elements of " { $snippet "element" } " whose markup element type occurs in " { $snippet "seq" } "." }
-{ $notes "Used to implement " { $link children } "." } ;
-
-HELP: parent-graph
-{ $var-description "A graph whose vertices are help articles and edges are subsections. See " { $link "graphs" } "." }
-{ $see-also children parents xref-help } ;
-
-HELP: children
-{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
-{ $description "Outputs a sequence of all subsections of " { $snippet "topic" } "." } ;
-
-HELP: parents
-{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
-{ $description "Outputs a sequence of all help articles which contain " { $snippet "topic" } " as a subsection." } ;
-
-HELP: doc-path
-{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
-{ $description "Outputs a sequence of all help articles which contain " { $snippet "topic" } " as a subsection, traversing all the way up to the root." }
-{ $examples
-    { $example "\"sequences\" doc-path ." "{ \"collections\" \"handbook\" }" }
-} ;
-
-HELP: xref-article
-{ $values { "topic" "an article name or a word" } }
-{ $description "Adds an article to the " { $link parent-graph } " graph." }
-$low-level-note ;
-
-HELP: unxref-article
-{ $values { "topic" "an article name or a word" } }
-{ $description "Removes an article to the " { $link parent-graph } " graph." }
-$low-level-note ;
-
-HELP: xref-help
-{ $description "Update the " { $link parent-graph } ". Usually this is done automatically." } ;
-
-HELP: link
-{ $class-description "Class of help article presentations. Instances can be passed to " { $link write-object } " to output a clickable hyperlink. Also, instances of this class are valid definition specifiers; see " { $link "definitions" } "." } ;
diff --git a/core/inference/authors.txt b/core/inference/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/backend/authors.txt b/core/inference/backend/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/backend/backend-docs.factor b/core/inference/backend/backend-docs.factor
new file mode 100644 (file)
index 0000000..05d80f6
--- /dev/null
@@ -0,0 +1,81 @@
+USING: help.syntax help.markup words effects inference.dataflow
+inference.backend kernel sequences kernel.private
+combinators combinators.private ;
+
+HELP: recursive-state
+{ $var-description "During inference, holds an association list mapping words to labels." } ;
+
+HELP: literal-expected
+{ $error-description "Thrown when inference encounters a " { $link call } " or " { $link if } " being applied to a value which is not known to be a literal. Such a form can have an arbitrary stack effect, and does not compile." }
+{ $notes "This error will be thrown when compiling any combinator, such as " { $link each } ". However, words calling combinators can compile of the combinator is declared " { $link POSTPONE: inline } " and the quotation being passed in is a literal." } ;
+
+HELP: terminated?
+{ $var-description "During inference, a flag set to " { $link t } " if the current control flow path unconditionally throws an error." } ;
+
+HELP: too-many->r
+{ $error-description "Thrown if inference notices a quotation pushing elements on the retain stack without popping them at the end." }
+{ $notes "See " { $link "shuffle-words" } " for retain stack usage conventions." } ;
+
+HELP: too-many-r>
+{ $error-description "Thrown if inference notices a quotation popping elements from the return stack it did not place there." }
+{ $notes "See " { $link "shuffle-words" } " for retain stack usage conventions." } ;
+
+HELP: unify-lengths
+{ $values { "seq" sequence } { "newseq" "a new sequence" } }
+{ $description "Pads sequences in " { $snippet "seq" } " with computed value placeholders to ensure they are all the same length." } ;
+
+HELP: cannot-unify-specials
+{ $description "Throws an " { $link cannot-unify-specials } "." }
+{ $error-description "Thrown when some but not all branches in a conditional output " { $link curry } " or " { $link compose } " values. This case is not supported by stack effect inference yet. It does not indicate there is a programming error." } ;
+
+HELP: unify-values
+{ $values { "seq" sequence } { "value" "an object" } }
+{ $description "If all values in the sequence are equal, outputs the value, otherwise outputs a computed value placeholder." } ;
+
+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 } ", " { $link dispatch } " or " { $link cond } " where the branches do not all exit with the same stack height." }
+{ $notes "Conditionals with variable stack effects are considered to be bad style and should be avoided since they do not compile."
+$nl
+"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." } ;
+
+HELP: unify-effect
+{ $values { "quots" "a sequence of quotations" } { "in" "a sequence of integers" } { "out" "a sequence of stacks" } { "newin" "a sequence of integers" } { "newout" "a sequence of stacks" } }
+{ $description "Unifies the stack effects of a number of branches, and outputs new values for " { $link d-in } " and " { $link meta-d } "." } ;
+
+HELP: consume/produce
+{ $values { "node" "a dataflow node" } { "effect" "an instance of " { $link effect } } }
+{ $description "Adds a node to the dataflow graph that calls " { $snippet "word" } " with a stack effect of " { $snippet "effect" } "." } ;
+
+HELP: no-effect
+{ $values { "word" word } }
+{ $description "Throws a " { $link no-effect } " error." }
+{ $error-description "Thrown when inference encounters a call to a word which is already known not to have a static stack effect, due to a prior inference attempt failing." } ;
+
+HELP: collect-recursion
+{ $values { "#label" "a " { $link #label } " node" } { "seq" "a new sequence" } }
+{ $description "Collect the input stacks of all child " { $link #call-label } " nodes that call the given label." } ;
+
+HELP: inline-closure
+{ $values { "word" word } }
+{ $description "Called during inference to infer stack effects of inline words."
+$nl
+"If the inline word is recursive, a new " { $link #label } " node is added to the dataflow graph, and the word has to be inferred twice, to determine which literals survive the recursion (eg, quotations) and which don't (loop indices, etc)."
+$nl
+"If the inline word is not recursive, the resulting nodes are spliced into the dataflow graph, and no " { $link #label } " node is created." } ;
+
+HELP: effect-error
+{ $values { "word" word } { "effect" "an instance of " { $link effect } } }
+{ $description "Throws an " { $link effect-error } "." }
+{ $error-description "Thrown when a word's inferred stack effect does not match its declared stack effect." } ;
+
+HELP: recursive-declare-error
+{ $error-description "Thrown when inference encounters a recursive call to a word lacking a stack effect declaration. Recursive words must declare a stack effect in order to compile. Due to implementation detail, generic words are recursive, and thus the same restriction applies." } ;
+
+HELP: recursive-quotation-error
+{ $error-description "Thrown when a quotation calls itself, directly or indirectly, within the same word. Stack effect inference becomes equivalent to the halting problem if quotation recursion has to be taken into account, hence it is not permitted." }
+{ $examples
+    "Here is an example of quotation recursion:"
+    { $code "[ [ dup call ] dup call ] infer." }
+} ;
diff --git a/core/inference/backend/backend.factor b/core/inference/backend/backend.factor
new file mode 100644 (file)
index 0000000..d046c31
--- /dev/null
@@ -0,0 +1,472 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: inference.backend
+USING: inference.dataflow arrays generic io io.streams.string
+kernel math math.vectors namespaces parser prettyprint sequences
+strings vectors words quotations effects classes continuations
+debugger assocs combinators ;
+
+: recursive-label ( word -- label/f )
+    recursive-state get at ;
+
+: local-recursive-state ( -- assoc )
+    recursive-state get dup keys
+    [ dup word? [ "inline" word-prop ] when not ] find drop
+    [ head-slice ] when* ;
+
+: inline-recursive-label ( word -- label/f )
+    local-recursive-state at ;
+
+: recursive-quotation? ( quot -- ? )
+    local-recursive-state [ first eq? ] curry* contains? ;
+
+: add-recursive-state ( word label -- )
+    2array recursive-state [ swap add* ] change ;
+
+TUPLE: inference-error rstate major? ;
+
+: (inference-error) ( ... class important? -- * )
+    >r construct-boa r>
+    recursive-state get {
+        set-delegate
+        set-inference-error-major?
+        set-inference-error-rstate
+    } \ inference-error construct throw ; inline
+
+: inference-error ( ... class -- * )
+    t (inference-error) ; inline
+
+: inference-warning ( ... class -- * )
+    f (inference-error) ; inline
+
+TUPLE: literal-expected ;
+
+M: object value-literal \ literal-expected inference-warning ;
+
+: pop-literal ( -- rstate obj )
+    1 #drop node,
+    pop-d dup value-literal >r value-recursion r> ;
+
+: value-vector ( n -- vector ) [ drop <computed> ] V{ } map-as ;
+
+: add-inputs ( seq stack -- n stack )
+    tuck [ length ] compare dup 0 >
+    [ dup value-vector [ swapd push-all ] keep ]
+    [ drop 0 swap ] if ;
+
+: ensure-values ( seq -- )
+    meta-d [ add-inputs ] change d-in [ + ] change ;
+
+SYMBOL: terminated?
+
+: current-effect ( -- effect )
+    d-in get meta-d get length <effect>
+    terminated? get over set-effect-terminated? ;
+
+SYMBOL: recorded
+
+: init-inference ( recursive-state -- )
+    terminated? off
+    V{ } clone meta-d set
+    V{ } clone meta-r set
+    0 d-in set
+    recursive-state set
+    dataflow-graph off
+    current-node off ;
+
+GENERIC: apply-object ( obj -- )
+
+: apply-literal ( obj -- )
+    <value> push-d #push 1 0 pick node-outputs node, ;
+
+M: object apply-object apply-literal ;
+
+M: wrapper apply-object wrapped apply-literal ;
+
+: terminate ( -- )
+    terminated? on #terminate node, ;
+
+: infer-quot ( quot -- )
+    [ apply-object terminated? get not ] all? drop ;
+
+TUPLE: recursive-quotation-error quot ;
+
+: bad-call ( -- )
+    [ "call must be given a callable" throw ] infer-quot ;
+
+: infer-quot-value ( value -- )
+    dup recursive-quotation? [
+        value-literal recursive-quotation-error inference-error
+    ] [
+        dup value-literal callable? [
+            recursive-state get >r
+            [
+                [ value-recursion ] keep f 2array add*
+                recursive-state set
+            ] keep value-literal infer-quot
+            r> recursive-state set
+        ] [
+            drop bad-call
+        ] if
+    ] if ;
+
+TUPLE: too-many->r ;
+
+: check->r ( -- )
+    meta-r get empty? terminated? get or
+    [ \ too-many->r inference-error ] unless ;
+
+TUPLE: too-many-r> ;
+
+: check-r> ( -- )
+    meta-r get empty?
+    [ \ too-many-r> inference-error ] when ;
+
+: infer->r ( -- )
+    1 ensure-values
+    #>r
+    1 0 pick node-inputs
+    pop-d push-r
+    0 1 pick node-outputs
+    node, ;
+
+: infer-r> ( -- )
+    check-r>
+    #r>
+    0 1 pick node-inputs
+    pop-r push-d
+    1 0 pick node-outputs
+    node, ;
+
+: undo-infer ( -- )
+    recorded get [ f "inferred-effect" set-word-prop ] each ;
+
+: with-infer ( quot -- )
+    [
+        [
+            { } recursive-state set
+            V{ } clone recorded set
+            f init-inference
+            call
+            check->r
+        ] [ ] [ undo-infer ] cleanup
+    ] with-scope ;
+
+: (consume-values) ( n -- )
+    meta-d get [ length swap - ] keep set-length ;
+
+: consume-values ( seq node -- )
+    >r length r>
+    over ensure-values
+    over 0 rot node-inputs
+    (consume-values) ;
+
+: produce-values ( seq node -- )
+    >r value-vector dup r> set-node-out-d
+    meta-d get push-all ;
+
+: if-inline ( word true false -- )
+    >r >r dup "inline" word-prop r> r> if ; inline
+
+: consume/produce ( effect node -- )
+    over effect-in over consume-values
+    over effect-out over produce-values
+    node,
+    effect-terminated? [ terminate ] when ;
+
+GENERIC: constructor ( value -- word/f )
+
+GENERIC: infer-uncurry ( value -- )
+
+M: curried infer-uncurry
+    drop pop-d dup curried-obj push-d curried-quot push-d ;
+
+M: curried constructor
+    drop \ curry ;
+
+M: composed infer-uncurry
+    drop pop-d dup composed-quot1 push-d composed-quot2 push-d ;
+
+M: composed constructor
+    drop \ compose ;
+
+M: object infer-uncurry drop ;
+
+M: object constructor drop f ;
+
+: reify-curry ( value -- )
+    dup infer-uncurry
+    constructor [
+        peek-d reify-curry
+        infer->r
+        peek-d reify-curry
+        infer-r>
+        2 1 <effect> swap #call consume/produce
+    ] when* ;
+
+: reify-curries ( n -- )
+    meta-d get reverse [
+        dup special? [
+            over [ infer->r ] times
+            dup reify-curry
+            over [ infer-r> ] times
+        ] when 2drop
+    ] 2each ;
+
+: reify-all ( -- )
+    meta-d get length reify-curries ;
+
+: unify-lengths ( seq -- newseq )
+    dup empty? [
+        dup [ length ] map supremum
+        [ swap add-inputs nip ] curry map
+    ] unless ;
+
+DEFER: unify-values
+
+: unify-curries ( seq -- value )
+    dup [ curried-obj ] map unify-values
+    swap [ curried-quot ] map unify-values
+    <curried> ;
+
+: unify-composed ( seq -- value )
+    dup [ composed-quot1 ] map unify-values
+    swap [ composed-quot2 ] map unify-values
+    <composed> ;
+
+TUPLE: cannot-unify-specials ;
+
+: cannot-unify-specials ( -- * )
+    \ cannot-unify-specials inference-warning ;
+
+: unify-values ( seq -- value )
+    {
+        { [ dup all-eq? ] [ first ] }
+        { [ dup [ curried? ] all? ] [ unify-curries ] }
+        { [ dup [ composed? ] all? ] [ unify-composed ] }
+        { [ dup [ special? ] contains? ] [ cannot-unify-specials ] }
+        { [ t ] [ drop <computed> ] }
+    } cond ;
+
+: unify-stacks ( seq -- stack )
+    flip [ unify-values ] V{ } map-as ;
+
+: balanced? ( in out -- ? )
+    [ dup [ length - ] [ 2drop f ] if ] 2map
+    [ ] subset all-equal? ;
+
+TUPLE: unbalanced-branches-error quots in out ;
+
+: unbalanced-branches-error ( quots in out -- * )
+    \ unbalanced-branches-error inference-error ;
+
+: unify-inputs ( max-d-in d-in meta-d -- meta-d )
+    dup [
+        [ >r - r> length + ] keep add-inputs nip
+    ] [
+        2nip
+    ] if ;
+
+: unify-effect ( quots in out -- newin newout )
+    #! in is a sequence of integers, out is a sequence of
+    #! stacks.
+    2dup balanced? [
+        over supremum -rot
+        [ >r dupd r> unify-inputs ] 2map
+        [ ] subset unify-stacks
+        rot drop
+    ] [
+        unbalanced-branches-error
+    ] if ;
+
+: active-variable ( seq symbol -- seq )
+    [
+        swap terminated? over at [ 2drop f ] [ at ] if
+    ] curry map ;
+
+: branch-variable ( seq symbol -- seq )
+    [ swap at ] curry map ;
+
+: datastack-effect ( seq -- )
+    dup quotation branch-variable
+    over d-in branch-variable
+    rot meta-d active-variable
+    unify-effect meta-d set d-in set ;
+
+: retainstack-effect ( seq -- )
+    dup quotation branch-variable
+    over length 0 <repetition>
+    rot meta-r active-variable
+    unify-effect meta-r set drop ;
+
+: unify-effects ( seq -- )
+    dup datastack-effect
+    dup retainstack-effect
+    [ terminated? swap at ] all? terminated? set ;
+
+: unify-dataflow ( effects -- nodes )
+    dataflow-graph branch-variable ;
+
+: copy-inference ( -- )
+    meta-d [ clone ] change
+    meta-r [ clone ] change
+    d-in [ ] change
+    dataflow-graph off
+    current-node off ;
+
+: infer-branch ( last value -- namespace )
+    [
+        copy-inference
+        dup value-literal quotation set
+        infer-quot-value
+        terminated? get [ drop ] [ call node, ] if
+    ] H{ } make-assoc ; inline
+
+: (infer-branches) ( last branches -- list )
+    [ infer-branch ] curry* map
+    dup unify-effects unify-dataflow ; inline
+
+: infer-branches ( last branches node -- )
+    #! last is a quotation which provides a #return or a #values
+    1 reify-curries
+    call dup node,
+    pop-d drop
+    >r (infer-branches) r> set-node-children
+    #merge node, ; inline
+
+: make-call-node ( word effect -- )
+    swap dup "inline" word-prop
+    over dup recursive-label eq? not and [
+        meta-d get clone -rot
+        recursive-label #call-label [ consume/produce ] keep
+        set-node-in-d
+    ] [
+        over effect-in length reify-curries
+        #call consume/produce
+    ] if ;
+
+TUPLE: no-effect word ;
+
+: no-effect ( word -- * ) \ no-effect inference-warning ;
+
+: nest-node ( -- ) #entry node, ;
+
+: unnest-node ( new-node -- new-node )
+    dup node-param #return node,
+    dataflow-graph get 1array over set-node-children ;
+
+: inline-block ( word -- node-block data )
+    [
+        copy-inference nest-node
+        gensym 2dup add-recursive-state
+        over >r #label r> word-def infer-quot
+        unnest-node
+    ] H{ } make-assoc ;
+
+: apply-infer ( hash -- )
+    { meta-d meta-r d-in terminated? }
+    [ swap [ at ] curry map ] keep
+    [ set ] 2each ;
+
+GENERIC: collect-recursion* ( label node -- )
+
+M: node collect-recursion* 2drop ;
+
+M: #call-label collect-recursion*
+    tuck node-param eq? [ , ] [ drop ] if ;
+
+: collect-recursion ( #label -- seq )
+    dup node-param
+    [ [ swap collect-recursion* ] curry each-node ] { } make ;
+
+: join-values ( node -- )
+    collect-recursion [ node-in-d ] map meta-d get add
+    unify-lengths unify-stacks
+    meta-d [ length tail* ] change ;
+
+: splice-node ( node -- )
+    dup node-successor [
+        dup node, penultimate-node f over set-node-successor
+        dup current-node set
+    ] when drop ;
+
+: inline-closure ( word -- )
+    dup inline-block over recursive-label? [
+        flatten-meta-d >r
+        drop join-values inline-block apply-infer
+        r> over set-node-in-d
+        dup node,
+        collect-recursion [
+            [ flatten-curries ] modify-values
+        ] each
+    ] [
+        apply-infer node-child node-successor splice-node drop
+    ] if ;
+
+: infer-compound ( word -- hash )
+    [
+        recursive-state get init-inference inline-block nip
+    ] with-scope ;
+
+GENERIC: infer-word ( word -- effect )
+
+M: word infer-word no-effect ;
+
+TUPLE: effect-error word effect ;
+
+: effect-error ( word effect -- * )
+    \ effect-error inference-error ;
+
+: check-effect ( word effect -- )
+    dup pick "declared-effect" word-prop effect<=
+    [ 2drop ] [ effect-error ] if ;
+
+: finish-word ( word -- effect )
+    current-effect
+    2dup check-effect
+    over recorded get push
+    tuck "inferred-effect" set-word-prop ;
+
+M: compound infer-word
+    [ dup infer-compound [ finish-word ] bind ]
+    [ ] [ t "no-effect" set-word-prop ] cleanup ;
+
+: custom-infer ( word -- )
+    #! Customized inference behavior
+    "infer" word-prop call ;
+
+: cached-infer ( word -- )
+    dup "inferred-effect" word-prop make-call-node ;
+
+: apply-word ( word -- )
+    {
+        { [ dup "infer" word-prop ] [ custom-infer ] }
+        { [ dup "no-effect" word-prop ] [ no-effect ] }
+        { [ dup "inferred-effect" word-prop ] [ cached-infer ] }
+        { [ t ] [ dup infer-word make-call-node ] }
+    } cond ;
+
+M: word apply-object apply-word ;
+
+M: symbol apply-object apply-literal ;
+
+TUPLE: recursive-declare-error word ;
+
+: declared-infer ( word -- )
+    dup stack-effect [
+        make-call-node
+    ] [
+        \ recursive-declare-error inference-error
+    ] if* ;
+
+M: compound apply-object
+    [
+        dup inline-recursive-label
+        [ declared-infer ] [ inline-closure ] if
+    ] [
+        dup recursive-label
+        [ declared-infer ] [ apply-word ] if
+    ] if-inline ;
+
+M: undefined apply-object
+    drop [ "Undefined" throw ] infer-quot ;
diff --git a/core/inference/backend/summary.txt b/core/inference/backend/summary.txt
new file mode 100644 (file)
index 0000000..bce6ce4
--- /dev/null
@@ -0,0 +1 @@
+Stack effect inference implementation
diff --git a/core/inference/class/authors.txt b/core/inference/class/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/class/class-tests.factor b/core/inference/class/class-tests.factor
new file mode 100644 (file)
index 0000000..d464ffe
--- /dev/null
@@ -0,0 +1,233 @@
+IN: temporary
+USING: arrays math.private kernel math compiler inference
+inference.dataflow optimizer tools.test kernel.private generic
+sequences words inference.class quotations alien
+alien.c-types strings sbufs sequences.private
+slots.private combinators ;
+
+! Make sure these compile even though this is invalid code
+[ ] [ [ 10 mod 3.0 /i ] dataflow optimize drop ] unit-test
+[ ] [ [ 10 mod 3.0 shift ] dataflow optimize drop ] unit-test
+
+! Ensure type inference works as it is supposed to by checking
+! if various methods get inlined
+
+: inlined? ( quot word -- ? )
+    swap dataflow optimize
+    [ node-param eq? ] curry* node-exists? not ;
+
+GENERIC: mynot ( x -- y )
+
+M: f mynot drop t ;
+
+M: general-t mynot drop f ;
+
+GENERIC: detect-f ( x -- y )
+
+M: f detect-f ;
+
+[ t ] [
+    [ dup [ mynot ] [ ] if detect-f ] \ detect-f inlined?
+] unit-test
+
+[ ] [ [ fixnum< ] dataflow optimize drop ] unit-test
+
+[ ] [ [ fixnum< [ ] [ ] if ] dataflow optimize drop ] unit-test
+
+FORGET: xyz
+
+GENERIC: xyz ( n -- n )
+
+M: integer xyz ;
+
+M: object xyz ;
+
+[ t ] [
+    [ { integer } declare xyz ] \ xyz inlined?
+] unit-test
+
+[ t ] [
+    [ dup fixnum? [ xyz ] [ drop "hi" ] if ]
+    \ xyz inlined?
+] unit-test
+
+: (fx-repeat) ( i n quot -- )
+    pick pick fixnum>= [
+        3drop
+    ] [
+        [ swap >r call 1 fixnum+fast r> ] keep (fx-repeat)
+    ] if ; inline
+
+: fx-repeat ( n quot -- )
+    0 -rot (fx-repeat) ; inline
+
+! The + should be optimized into fixnum+, if it was not, then
+! the type of the loop index was not inferred correctly
+[ t ] [
+    [ [ dup 2 + drop ] fx-repeat ] \ + inlined?
+] unit-test
+
+: (i-repeat) ( i n quot -- )
+    pick pick dup xyz drop >= [
+        3drop
+    ] [
+        [ swap >r call 1+ r> ] keep (i-repeat)
+    ] if ; inline
+
+: i-repeat >r { integer } declare r> 0 -rot (i-repeat) ; inline
+
+[ t ] [
+    [ [ dup xyz drop ] i-repeat ] \ xyz inlined?
+] unit-test
+
+[ t ] [
+    [ { fixnum } declare dup 100 >= [ 1 + ] unless ] \ fixnum+ inlined?
+] unit-test
+
+[ t ] [
+    [ { fixnum fixnum } declare dupd < [ 1 + 1 + ] when ]
+    \ + inlined?
+] unit-test
+
+[ t ] [
+    [ { fixnum fixnum } declare dupd < [ 1 + 1 + ] when ]
+    \ + inlined?
+] unit-test
+
+[ t ] [
+    [ { fixnum } declare [ ] times ] \ >= inlined?
+] unit-test
+
+[ t ] [
+    [ { fixnum } declare [ ] times ] \ 1+ inlined?
+] unit-test
+
+[ t ] [
+    [ { fixnum } declare [ ] times ] \ + inlined?
+] unit-test
+
+[ t ] [
+    [ { fixnum } declare [ ] times ] \ fixnum+ inlined?
+] unit-test
+
+[ f ] [
+    [ { integer fixnum } declare dupd < [ 1 + ] when ]
+    \ + inlined?
+] unit-test
+
+[ f ] [ [ dup 0 < [ neg ] when ] \ neg inlined? ] unit-test
+
+[ f ] [
+    [
+        [ no-cond ] 1
+        [ 1array dup quotation? [ >quotation ] unless ] times
+    ] \ type inlined?
+] unit-test
+
+[ f ] [ [ <reversed> length ] \ slot inlined? ] unit-test
+
+! We don't want to use = to compare literals
+: foo reverse ;
+
+\ foo [
+    [
+        fixnum 0 `output class,
+        V{ } dup dup push 0 `input literal,
+    ] set-constraints
+] "constraints" set-word-prop
+
+[ t ] [
+    [ dup V{ } eq? [ foo ] when ] dup second dup push
+    compile-quot word?
+] unit-test
+
+GENERIC: detect-fx ( n -- n )
+
+M: fixnum detect-fx ;
+
+[ t ] [
+    [
+        [ uchar-nth ] 2keep [ uchar-nth ] 2keep uchar-nth
+        >r >r 298 * r> 100 * - r> 208 * - 128 + -8 shift
+        255 min 0 max detect-fx
+    ] \ detect-fx inlined?
+] unit-test
+
+[ f ] [
+    [
+        1000000000000000000000000000000000 [ ] times
+    ] \ 1+ inlined?
+] unit-test
+
+[ f ] [
+    [ { bignum } declare [ ] times ] \ 1+ inlined?
+] unit-test
+
+
+[ t ] [
+    [ { string sbuf } declare push-all ] \ push-all inlined?
+] unit-test
+
+[ t ] [
+    [ { string sbuf } declare push-all ] \ + inlined?
+] unit-test
+
+[ t ] [
+    [ { string sbuf } declare push-all ] \ fixnum+ inlined?
+] unit-test
+
+[ t ] [
+    [ { string sbuf } declare push-all ] \ >fixnum inlined?
+] unit-test
+
+[ t ] [
+    [ { array-capacity } declare 0 < ] \ < inlined?
+] unit-test
+
+[ t ] [
+    [ { array-capacity } declare 0 < ] \ fixnum< inlined?
+] unit-test
+
+[ t ] [
+    [ { array-capacity } declare 1 fixnum- ] \ fixnum- inlined?
+] unit-test
+
+[ t ] [
+    [ 5000 [ 5000 [ ] times ] times ] \ 1+ inlined?
+] unit-test
+
+[ t ] [
+    [ 5000 [ [ ] times ] each ] \ 1+ inlined?
+] unit-test
+
+[ t ] [
+    [ 5000 0 [ dup 2 - swap [ 2drop ] curry each ] reduce ]
+    \ 1+ inlined?
+] unit-test
+
+GENERIC: annotate-entry-test-1 ( x -- )
+
+M: fixnum annotate-entry-test-1 drop ;
+
+: (annotate-entry-test-2) ( from to quot -- )
+    pick pick >= [
+        3drop
+    ] [
+        [ swap >r call dup annotate-entry-test-1 1+ r> ] keep (annotate-entry-test-2)
+    ] if ; inline
+
+: annotate-entry-test-2 0 -rot (annotate-entry-test-2) ; inline
+
+[ f ] [
+    [ { bignum } declare [ ] annotate-entry-test-2 ]
+    \ annotate-entry-test-1 inlined?
+] unit-test
+
+[ t ] [
+    [ { float } declare 10 [ 2.3 * ] times >float ]
+    \ >float inlined?
+] unit-test
+
+[ t ] [
+    [ 3 + = ] \ equal? inlined?
+] unit-test
diff --git a/core/inference/class/class.factor b/core/inference/class/class.factor
new file mode 100644 (file)
index 0000000..016f718
--- /dev/null
@@ -0,0 +1,321 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic assocs hashtables inference kernel
+math namespaces sequences words parser math.intervals
+math.vectors effects classes inference.dataflow
+inference.backend ;
+IN: inference.class
+
+! Class inference
+
+! A constraint is a statement about a value.
+
+! We need a notion of equality which doesn't recurse so cannot
+! infinite loop on circular data
+GENERIC: eql? ( obj1 obj2 -- ? )
+M: object eql? eq? ;
+M: number eql? number= ;
+
+! Maps constraints to constraints
+SYMBOL: constraints
+
+TUPLE: literal-constraint literal value ;
+
+C: <literal-constraint> literal-constraint
+
+M: literal-constraint equal?
+    over literal-constraint? [
+        2dup
+        [ literal-constraint-literal ] 2apply eql? >r
+        [ literal-constraint-value ] 2apply = r> and
+    ] [
+        2drop f
+    ] if ;
+
+TUPLE: class-constraint class value ;
+
+C: <class-constraint> class-constraint
+
+TUPLE: interval-constraint interval value ;
+
+C: <interval-constraint> interval-constraint
+
+GENERIC: apply-constraint ( constraint -- )
+GENERIC: constraint-satisfied? ( constraint -- ? )
+
+: `input node get node-in-d nth ;
+: `output node get node-out-d nth ;
+: class, <class-constraint> , ;
+: literal, <literal-constraint> , ;
+: interval, <interval-constraint> , ;
+
+M: f apply-constraint drop ;
+
+: make-constraints ( node quot -- constraint )
+    [ swap node set call ] { } make ; inline
+
+: set-constraints ( node quot -- )
+    make-constraints
+    unclip [ 2array ] reduce
+    apply-constraint ; inline
+
+: assume ( constraint -- )
+    constraints get at [ apply-constraint ] when* ;
+
+! Variables used by the class inferencer
+
+! Current value --> literal mapping
+SYMBOL: value-literals
+
+! Current value --> interval mapping
+SYMBOL: value-intervals
+
+! Current value --> class mapping
+SYMBOL: value-classes
+
+: set-value-interval* ( interval value -- )
+    value-intervals get set-at ;
+
+M: interval-constraint apply-constraint
+    dup interval-constraint-interval
+    swap interval-constraint-value set-value-interval* ;
+
+: set-class-interval ( class value -- )
+    >r "interval" word-prop dup
+    [ r> set-value-interval* ] [ r> 2drop ] if ;
+
+: set-value-class* ( class value -- )
+    over [
+        dup value-intervals get at [
+            2dup set-class-interval
+        ] unless
+        2dup <class-constraint> assume
+    ] when
+    value-classes get set-at ;
+
+M: class-constraint apply-constraint
+    dup class-constraint-class
+    swap class-constraint-value set-value-class* ;
+
+: set-value-literal* ( literal value -- )
+    over class over set-value-class*
+    over real? [ over [a,a] over set-value-interval* ] when
+    2dup <literal-constraint> assume
+    value-literals get set-at ;
+
+M: literal-constraint apply-constraint
+    dup literal-constraint-literal
+    swap literal-constraint-value set-value-literal* ;
+
+! For conditionals, an assoc of child node # --> constraint
+GENERIC: child-constraints ( node -- seq )
+
+GENERIC: infer-classes-before ( node -- )
+
+GENERIC: infer-classes-around ( node -- )
+
+M: node infer-classes-before drop ;
+
+M: node child-constraints
+    node-children length
+    dup zero? [ drop f ] [ f <repetition> ] if ;
+
+: value-literal* ( value -- obj ? )
+    value-literals get at* ;
+
+M: literal-constraint constraint-satisfied?
+    dup literal-constraint-value value-literal*
+    [ swap literal-constraint-literal eql? ] [ 2drop f ] if ;
+
+: value-class* ( value -- class )
+    value-classes get at object or ;
+
+M: class-constraint constraint-satisfied?
+    dup class-constraint-value value-class*
+    swap class-constraint-class class< ;
+
+: value-interval* ( value -- interval/f )
+    value-intervals get at ;
+
+M: pair apply-constraint
+    first2 2dup constraints get set-at
+    constraint-satisfied? [ apply-constraint ] [ drop ] if ;
+
+M: pair constraint-satisfied?
+    first constraint-satisfied? ;
+
+: extract-keys ( assoc seq -- newassoc )
+    dup length <hashtable> swap [
+        dup >r pick at* [ r> pick set-at ] [ r> 2drop ] if
+    ] each nip f assoc-like ;
+
+: annotate-node ( node -- )
+    #! Annotate the node with the currently-inferred set of
+    #! value classes.
+    dup node-values
+    value-intervals get over extract-keys pick set-node-intervals
+    value-classes get over extract-keys pick set-node-classes
+    value-literals get over extract-keys pick set-node-literals
+    2drop ;
+
+: intersect-classes ( classes values -- )
+    [ [ value-class* class-and ] keep set-value-class* ] 2each ;
+
+: intersect-intervals ( intervals values -- )
+    [
+        [ value-interval* interval-intersect ] keep
+        set-value-interval*
+    ] 2each ;
+
+: predicate-constraints ( class #call -- )
+    [
+        0 `input class,
+        general-t 0 `output class,
+    ] set-constraints ;
+
+: compute-constraints ( #call -- )
+    dup node-param "constraints" word-prop [
+        call
+    ] [
+        dup node-param "predicating" word-prop dup
+        [ swap predicate-constraints ] [ 2drop ] if
+    ] if* ;
+
+: default-output-classes ( word -- classes )
+    "inferred-effect" word-prop effect-out
+    dup [ class? ] all? [ drop f ] unless ;
+
+: compute-output-classes ( node word -- classes intervals )
+    dup node-param "output-classes" word-prop dup
+    [ call ] [ 2drop f f ] if ;
+
+: output-classes ( node -- classes intervals )
+    dup compute-output-classes
+    >r [ ] [ node-param default-output-classes ] ?if r> ;
+
+M: #call infer-classes-before
+    dup compute-constraints
+    dup node-out-d swap output-classes
+    >r over intersect-classes
+    r> swap intersect-intervals ;
+
+M: #push infer-classes-before
+    node-out-d
+    [ [ value-literal ] keep set-value-literal* ] each ;
+
+M: #if child-constraints
+    [
+        general-t 0 `input class,
+        f 0 `input literal,
+    ] make-constraints ;
+
+M: #dispatch child-constraints
+    dup [
+        node-children length [
+            0 `input literal,
+        ] each
+    ] make-constraints ;
+
+M: #declare infer-classes-before
+    dup node-param swap node-in-d [ set-value-class* ] 2each ;
+
+DEFER: (infer-classes)
+
+: infer-children ( node -- )
+    dup node-children swap child-constraints [
+        [
+            value-classes [ clone ] change
+            value-literals [ clone ] change
+            value-intervals [ clone ] change
+            constraints [ clone ] change
+            apply-constraint
+            (infer-classes)
+        ] with-scope
+    ] 2each ;
+
+: pad-all ( seqs elt -- seq )
+    >r dup [ length ] map supremum r> [ pad-left ] 2curry map ;
+
+: (merge-classes) ( nodes -- seq )
+    [ node-input-classes ] map
+    null pad-all flip [ null [ class-or ] reduce ] map ;
+
+: set-classes ( seq node -- )
+    node-out-d [ set-value-class* ] 2reverse-each ;
+
+: merge-classes ( nodes node -- )
+    >r (merge-classes) r> set-classes ;
+
+: (merge-intervals) ( nodes quot -- seq )
+    >r
+    [ node-input-intervals ] map
+    f pad-all flip
+    r> map ; inline
+
+: set-intervals ( seq node -- )
+    node-out-d [ set-value-interval* ] 2reverse-each ;
+
+: merge-intervals ( nodes node -- )
+    >r [ dup first [ interval-union ] reduce ]
+    (merge-intervals) r> set-intervals ;
+
+: annotate-merge ( nodes #merge/#entry -- )
+    2dup merge-classes merge-intervals ;
+
+: merge-children ( node -- )
+    dup node-successor dup #merge? [
+        swap active-children dup empty?
+        [ 2drop ] [ swap annotate-merge ] if
+    ] [
+        2drop
+    ] if ;
+
+: annotate-entry ( nodes #label -- )
+    node-child merge-classes ;
+
+M: #label infer-classes-before ( #label -- )
+    #! First, infer types under the hypothesis which hold on
+    #! entry to the recursive label.
+    dup 1array swap annotate-entry ;
+
+M: #label infer-classes-around ( #label -- )
+    #! Now merge the types at every recursion point with the
+    #! entry types.
+    dup annotate-node
+    dup infer-classes-before
+    dup infer-children
+    dup collect-recursion over add
+    pick annotate-entry
+    node-child (infer-classes) ;
+
+M: object infer-classes-around
+    dup infer-classes-before
+    dup annotate-node
+    dup infer-children
+    merge-children ;
+
+: (infer-classes) ( node -- )
+    [
+        dup infer-classes-around
+        node-successor (infer-classes)
+    ] when* ;
+
+: infer-classes-with ( node classes literals intervals -- )
+    [
+        H{ } assoc-like value-intervals set
+        H{ } assoc-like value-literals set
+        H{ } assoc-like value-classes set
+        H{ } clone constraints set
+        (infer-classes)
+    ] with-scope ;
+
+: infer-classes ( node -- )
+    f f f infer-classes-with ;
+
+: infer-classes/node ( node existing -- )
+    #! Infer classes, using the existing node's class info as a
+    #! starting point.
+    dup node-classes
+    over node-literals
+    rot node-intervals
+    infer-classes-with ;
diff --git a/core/inference/class/summary.txt b/core/inference/class/summary.txt
new file mode 100644 (file)
index 0000000..d929e69
--- /dev/null
@@ -0,0 +1 @@
+Static type and class inference
diff --git a/core/inference/dataflow/authors.txt b/core/inference/dataflow/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/dataflow/dataflow-docs.factor b/core/inference/dataflow/dataflow-docs.factor
new file mode 100644 (file)
index 0000000..2777d47
--- /dev/null
@@ -0,0 +1,8 @@
+USING: inference.dataflow help.syntax help.markup ;
+
+HELP: #return
+{ $values { "label" "a word or " { $link f } } { "node" "a new " { $link node } } }
+{ $description "Creates a node which returns from a nested label, or if " { $snippet "label" } " is " { $link f } ", the top-level word being compiled." } ;
+
+HELP: d-in
+{ $var-description "During inference, holds the number of inputs which the quotation has been inferred to require so far." } ;
diff --git a/core/inference/dataflow/dataflow.factor b/core/inference/dataflow/dataflow.factor
new file mode 100644 (file)
index 0000000..c9531f8
--- /dev/null
@@ -0,0 +1,301 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: inference.dataflow
+USING: arrays generic assocs kernel math
+namespaces parser sequences words vectors math.intervals
+effects classes ;
+
+SYMBOL: recursive-state
+
+! Computed value
+: <computed> \ <computed> counter ;
+
+! Literal value
+TUPLE: value literal uid recursion ;
+
+: <value> ( obj -- value )
+    <computed> recursive-state get value construct-boa ;
+
+M: value hashcode* nip value-uid ;
+
+M: value equal? 2drop f ;
+
+! Result of curry
+TUPLE: curried obj quot ;
+
+C: <curried> curried
+
+! Result of compose
+TUPLE: composed quot1 quot2 ;
+
+C: <composed> composed
+
+SYMBOL: d-in
+SYMBOL: meta-d
+SYMBOL: meta-r
+
+UNION: special curried composed ;
+
+: push-d meta-d get push ;
+: pop-d meta-d get pop ;
+: peek-d meta-d get peek ;
+
+: push-r meta-r get push ;
+: pop-r meta-r get pop ;
+: peek-r meta-r get peek ;
+
+TUPLE: node param
+in-d out-d in-r out-r
+classes literals intervals
+history successor children ;
+
+M: node equal? 2drop f ;
+
+M: node hashcode* drop node hashcode* ;
+
+GENERIC: flatten-curry ( value -- )
+
+M: curried flatten-curry
+    dup curried-obj flatten-curry
+    curried-quot flatten-curry ;
+
+M: composed flatten-curry
+    dup composed-quot1 flatten-curry
+    composed-quot2 flatten-curry ;
+
+M: object flatten-curry , ;
+
+: flatten-curries ( seq -- newseq )
+    dup [ special? ] contains? [
+        [ [ flatten-curry ] each ] { } make
+    ] when ;
+
+: flatten-meta-d ( -- seq )
+    meta-d get clone flatten-curries ;
+
+: modify-values ( node quot -- )
+    [ swap [ node-in-d swap call ] keep set-node-in-d ] 2keep
+    [ swap [ node-in-r swap call ] keep set-node-in-r ] 2keep
+    [ swap [ node-out-d swap call ] keep set-node-out-d ] 2keep
+    swap [ node-out-r swap call ] keep set-node-out-r ; inline
+
+: node-shuffle ( node -- shuffle )
+    dup node-in-d swap node-out-d <effect> ;
+
+: make-node ( slots class -- node )
+    >r node construct r> construct-delegate ; inline
+
+: empty-node ( class -- node )
+    { } swap make-node ; inline
+
+: param-node ( param class -- node )
+    { set-node-param } swap make-node ; inline
+
+: in-node ( seq class -- node )
+    { set-node-in-d } swap make-node ; inline
+
+: all-in-node ( class -- node )
+    flatten-meta-d swap in-node ; inline
+
+: out-node ( seq class -- node )
+    { set-node-out-d } swap make-node ; inline
+
+: all-out-node ( class -- node )
+    flatten-meta-d swap out-node ; inline
+
+: d-tail ( n -- seq )
+    dup zero? [ drop f ] [ meta-d get swap tail* ] if ;
+
+: r-tail ( n -- seq )
+    dup zero? [ drop f ] [ meta-r get swap tail* ] if ;
+
+: node-child node-children first ;
+
+TUPLE: #label word ;
+
+: #label ( word label -- node )
+    \ #label param-node [ set-#label-word ] keep ;
+
+TUPLE: #entry ;
+
+: #entry ( -- node ) \ #entry all-out-node ;
+
+TUPLE: #call ;
+
+: #call ( word -- node ) \ #call param-node ;
+
+TUPLE: #call-label ;
+
+: #call-label ( label -- node ) \ #call-label param-node ;
+
+TUPLE: #push ;
+
+: #push ( -- node ) \ #push empty-node ;
+
+TUPLE: #shuffle ;
+
+: #shuffle ( -- node ) \ #shuffle empty-node ;
+
+TUPLE: #>r ;
+
+: #>r ( -- node ) \ #>r empty-node ;
+
+TUPLE: #r> ;
+
+: #r> ( -- node ) \ #r> empty-node ;
+
+TUPLE: #values ;
+
+: #values ( -- node ) \ #values all-in-node ;
+
+TUPLE: #return ;
+
+: #return ( label -- node )
+    \ #return all-in-node [ set-node-param ] keep ;
+
+TUPLE: #if ;
+
+: #if ( -- node ) peek-d 1array \ #if in-node ;
+
+TUPLE: #dispatch ;
+
+: #dispatch ( -- node ) peek-d 1array \ #dispatch in-node ;
+
+TUPLE: #merge ;
+
+: #merge ( -- node ) \ #merge all-out-node ;
+
+TUPLE: #terminate ;
+
+: #terminate ( -- node ) \ #terminate empty-node ;
+
+TUPLE: #declare ;
+
+: #declare ( classes -- node ) \ #declare param-node ;
+
+UNION: #branch #if #dispatch ;
+
+: node-inputs ( d-count r-count node -- )
+    tuck
+    >r r-tail flatten-curries r> set-node-in-r
+    >r d-tail flatten-curries r> set-node-in-d ;
+
+: node-outputs ( d-count r-count node -- )
+    tuck
+    >r r-tail flatten-curries r> set-node-out-r
+    >r d-tail flatten-curries r> set-node-out-d ;
+
+SYMBOL: dataflow-graph
+SYMBOL: current-node
+
+: node, ( node -- )
+    dataflow-graph get [
+        dup current-node [ set-node-successor ] change
+    ] [
+        dup dataflow-graph set  current-node set
+    ] if ;
+
+: node-values ( node -- values )
+    dup node-in-d
+    over node-out-d
+    pick node-in-r
+    roll node-out-r 4array concat ;
+
+: last-node ( node -- last )
+    dup node-successor [ last-node ] [ ] ?if ;
+
+: penultimate-node ( node -- penultimate )
+    dup node-successor dup [
+        dup node-successor
+        [ nip penultimate-node ] [ drop ] if
+    ] [
+        2drop f
+    ] if ;
+
+: #drop ( n -- #shuffle )
+    d-tail flatten-curries \ #shuffle in-node ;
+
+: node-exists? ( node quot -- ? )
+    over [
+        2dup 2slip rot [
+            2drop t
+        ] [
+            >r dup node-children swap node-successor add r>
+            [ node-exists? ] curry contains?
+        ] if
+    ] [
+        2drop f
+    ] if ; inline
+
+GENERIC: calls-label* ( label node -- ? )
+
+M: node calls-label* 2drop f ;
+
+M: #call-label calls-label* node-param eq? ;
+
+: calls-label? ( label node -- ? )
+    [ calls-label* ] curry* node-exists? ;
+
+: recursive-label? ( node -- ? )
+    dup node-param swap calls-label? ;
+
+SYMBOL: node-stack
+
+: >node node-stack get push ;
+: node> node-stack get pop ;
+: node@ node-stack get peek ;
+
+: iterate-next ( -- node ) node@ node-successor ;
+
+: iterate-nodes ( node quot -- )
+    over [
+        [ swap >node call node> drop ] keep iterate-nodes
+    ] [
+        2drop
+    ] if ; inline
+
+: (each-node) ( quot -- next )
+    node@ [ swap call ] 2keep
+    node-children [
+        [
+            [ (each-node) ] keep swap
+        ] iterate-nodes
+    ] each drop
+    iterate-next ; inline
+
+: with-node-iterator ( quot -- )
+    >r V{ } clone node-stack r> with-variable ; inline
+
+: each-node ( node quot -- )
+    [
+        swap [
+            [ (each-node) ] keep swap
+        ] iterate-nodes drop
+    ] with-node-iterator ; inline
+
+: node-literal? ( node value -- ? )
+    dup value? >r swap node-literals key? r> or ;
+
+: node-literal ( node value -- obj )
+    dup value?
+    [ nip value-literal ] [ swap node-literals at ] if ;
+
+: node-interval ( node value -- interval )
+    swap node-intervals at ;
+
+: node-class ( node value -- class )
+    swap node-classes at object or ;
+
+: node-input-classes ( node -- seq )
+    dup node-in-d [ node-class ] curry* map ;
+
+: node-input-intervals ( node -- seq )
+    dup node-in-d [ node-interval ] curry* map ;
+
+: node-class-first ( node -- class )
+    dup node-in-d first node-class ;
+
+: active-children ( node -- seq )
+    node-children
+    [ last-node ] map
+    [ #terminate? not ] subset ;
diff --git a/core/inference/dataflow/summary.txt b/core/inference/dataflow/summary.txt
new file mode 100644 (file)
index 0000000..6457d1c
--- /dev/null
@@ -0,0 +1 @@
+Dataflow IR used by stack effect inference and compiler
diff --git a/core/inference/errors/authors.txt b/core/inference/errors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/errors/errors.factor b/core/inference/errors/errors.factor
new file mode 100644 (file)
index 0000000..4d57ac5
--- /dev/null
@@ -0,0 +1,58 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: inference.errors
+USING: inference.backend inference.dataflow kernel generic
+sequences prettyprint io words arrays inspector effects debugger
+assocs ;
+
+M: inference-error error.
+    dup inference-error-rstate
+    keys [ dup value? [ value-literal ] when ] map
+    dup empty? [ "Word: " write dup peek . ] unless
+    swap delegate error. "Nesting: " write . ;
+
+M: inference-error error-help drop f ;
+
+M: unbalanced-branches-error error.
+    "Unbalanced branches:" print
+    dup unbalanced-branches-error-quots
+    over unbalanced-branches-error-in
+    rot unbalanced-branches-error-out [ length ] map
+    3array flip [ [ bl ] [ pprint ] interleave nl ] each ;
+
+M: literal-expected summary
+    drop "Literal value expected" ;
+
+M: too-many->r summary
+    drop
+    "Quotation pushes elements on retain stack without popping them" ;
+
+M: too-many-r> summary
+    drop
+    "Quotation pops retain stack elements which it did not push" ;
+
+M: no-effect error.
+    "Unable to infer stack effect of " write no-effect-word . ;
+
+M: recursive-declare-error error.
+    "The recursive word " write
+    recursive-declare-error-word pprint
+    " must declare a stack effect" print ;
+
+M: effect-error error.
+    "Stack effects of the word " write
+    dup effect-error-word pprint
+    " do not match." print
+    "Declared: " write
+    dup effect-error-word stack-effect effect>string .
+    "Inferred: " write effect-error-effect effect>string . ;
+
+M: recursive-quotation-error error.
+    "The quotation " write
+    recursive-quotation-error-quot pprint
+    " calls itself." print
+    "Stack effect inference is undecidable when quotation-level recursion is permitted." print ;
+
+M: cannot-unify-specials summary
+    drop
+    "Cannot unify branches with inconsistent special values" ;
diff --git a/core/inference/errors/summary.txt b/core/inference/errors/summary.txt
new file mode 100644 (file)
index 0000000..b813421
--- /dev/null
@@ -0,0 +1 @@
+Errors which may be reaised by stack effect inference
diff --git a/core/inference/inference-docs.factor b/core/inference/inference-docs.factor
new file mode 100644 (file)
index 0000000..b9ac8ce
--- /dev/null
@@ -0,0 +1,141 @@
+USING: help.syntax help.markup kernel sequences words io
+effects inference.dataflow inference.backend
+math combinators inference.transforms ;
+IN: inference
+
+ARTICLE: "inference-simple" "Straight-line stack effects"
+"The simplest case to look at is that of a quotation which does not have any branches or recursion, and just pushes literals and calls words, each of which has a known stack effect."
+$nl
+"Stack effect inference works by stepping through the quotation, while maintaining a \"shadow stack\" which tracks stack height at the current position in the quotation. Initially, the shadow stack is empty. If a word is encountered which expects more values than there are on the shadow stack, a global counter is incremented. This counter keeps track of the number of inputs the quotation expects on the stack. When inference is done, this counter, together with the final height of the shadow stack, gives the inferred stack effect."
+{ $subsection d-in }
+{ $subsection meta-d }
+"When a literal is encountered, it is simply pushed on the shadow stack. For example, the stack effect of the following quotation is inferred by pushing all three literals on the shadow stack, then taking the value of " { $link d-in } " and the length of " { $link meta-d } ":"
+{ $example "[ 1 2 3 ] infer." "( -- object object object )" }
+"In the following example, the call to " { $link + } " expects two values on the shadow stack, but only one value is present, the literal which was pushed previously. This increments the " { $link d-in } " counter by one:"
+{ $example "[ 2 + ] infer." "( object -- object )" }
+"After the call to " { $link + } ", the shadow stack contains a \"computed value placeholder\", since the inferencer has no way to know what the resulting value actually is (in fact it is arbitrary)." ;
+
+ARTICLE: "inference-combinators" "Combinator stack effects"
+"Without further information, one cannot say what the stack effect of " { $link call } " is; it depends on the given quotation. If the inferencer encounters a " { $link call } " without further information, a " { $link literal-expected } " error is raised."
+{ $example "[ dup call ] infer." "... an error ..." }
+"On the other hand, the stack effect of applying " { $link call } " to a literal quotation or a " { $link curry } " of a literal quotation is easy to compute; it behaves as if the quotation was substituted at that point:"
+{ $example "[ [ 2 + ] call ] infer." "( object -- object )" }
+"Consider a combinator such as " { $link keep } ". The combinator itself does not have a stack effect, because it applies " { $link call } " to a potentially arbitrary quotation. However, since the combinator is declared " { $link POSTPONE: inline } ", a given usage of it can have a stack effect:"
+{ $example "[ [ 2 + ] keep ] infer." "( object -- object object )" }
+"Another example is the " { $link compose } " combinator. Because it is decared " { $link POSTPONE: inline } ", we can infer the stack effect of applying " { $link call } " to the result of " { $link compose } ":"
+{ $example "[ 2 [ + ] curry [ sq ] compose ] infer." "( -- object object )" }
+"Incidentally, this example demonstrates that the stack effect of nested currying and composition can also be inferred."
+$nl
+"A general rule of thumb is that any word which applies " { $link call } " or " { $link curry } " to one of its inputs must be declared " { $link POSTPONE: inline } "."
+$nl
+"Here is an example where the stack effect cannot be inferred:"
+{ $code ": foo 0 [ + ] ;" "[ foo reduce ] infer." }
+"However if " { $snippet "foo" } " was declared " { $link POSTPONE: inline } ", everything would work, since the " { $link reduce } " combinator is also " { $link POSTPONE: inline } ", and the inferencer can see the literal quotation value at the point it is passed to " { $link call } ":"
+{ $example ": foo 0 [ + ] ; inline" "[ foo reduce ] infer." "( object -- object )" } ;
+
+ARTICLE: "inference-branches" "Branch stack effects"
+"Conditionals such as " { $link if } " and combinators built on " { $link if } " present a problem, in that if the two branches leave the stack at a different height, it is not clear what the stack effect should be. In this case, inference throws a " { $link unbalanced-branches-error } "."
+$nl
+"If all branches leave the stack at the same height, then the stack effect of the conditional is just the maximum of the stack effect of each branch. For example,"
+{ $example "[ [ + ] [ drop ] if ] infer." "( object object object -- object )" }
+"The call to " { $link if } " takes one value from the stack, a generalized boolean. The first branch " { $snippet "[ + ]" } " has stack effect " { $snippet "( x x -- x )" } " and the second has stack effect " { $snippet "( x -- )" } ". Since both branches decrease the height of the stack by one, we say that the stack effect of the two branches is " { $snippet "( x x -- x )" } ", and together with the boolean popped off the stack by " { $link if } ", this gives a total stack effect of " { $snippet "( x x x -- x )" } "." ;
+
+ARTICLE: "inference-recursive" "Stack effects of recursive words"
+"Recursive words must declare a stack effect. When a recursive call is encountered, the declared stack effect is substituted in. When inference is complete, the inferred stack effect is compared with the declared stack effect."
+$nl
+"Attempting to infer the stack effect of a recursive word which outputs a variable number of objects on the stack will fail. For example, the following will throw an " { $link unbalanced-branches-error } ":"
+{ $code ": foo ( seq -- ) dup empty? [ drop ] [ dup pop foo ] if" "[ foo ] infer." }
+"If you declare an incorrect stack effect, inference will fail also. Badly defined recursive words cannot confuse the inferencer." ;
+
+ARTICLE: "inference-limitations" "Inference limitations"
+"Mutually recursive words are supported, but mutually recursive " { $emphasis "inline" } " words are not."
+$nl
+"An inline recursive word cannot pass a quotation through the recursive call. For example, the following will not infer:"
+{ $code ": foo ( a b c -- d e f ) [ f foo drop ] when 2dup call ; inline" "[ 1 [ 1+ ] foo ] infer." }
+"However a small change can be made:"
+{ $example ": foo ( a b c -- d ) [ 2dup f foo drop ] when call ; inline" "[ 1 [ 1+ ] t foo ] infer." "( -- object )" }
+"An inline recursive word must have a fixed stack effect in its base case. The following will not infer:"
+{ $code
+    ": foo ( quot ? -- ) [ f foo ] [ call ] if ; inline"
+    "[ [ 5 ] t foo ] infer."
+} ;
+
+ARTICLE: "compiler-transforms" "Compiler transforms"
+"Compiler transforms can be used to allow words to compile which would otherwise not have a stack effect, and to expand combinators into more efficient code at compile time."
+{ $subsection define-transform }
+"An example is the " { $link cond } " word. If the association list of quotations it is given is literal, the entire form is expanded into a series of nested calls to " { $link if } "."
+$nl
+"Further customization can be achieved by hooking into the lower-level machinery used by " { $link define-transform } ", the " { $snippet "\"infer\"" } " word property."
+$nl
+"This property can hold a quotation to be called when the stack effect of a call to this word is being inferred. This quotation can access all internal state of the stack effect inferencer, such as the known literals on the data stack."
+{ $subsection pop-literal }
+{ $subsection infer-quot }
+{ $subsection infer-quot-value }
+"The " { $vocab-link "macros" } " vocabulary defines some nice syntax sugar which makes compiler transforms easier to work with." ;
+
+ARTICLE: "inference" "Stack effect inference"
+"The stack effect inference tool is used to check correctness of code before it is run. It is also used by the compiler to build a dataflow graph on which optimizations can be performed. Only words for which a stack effect can be inferred will compile."
+$nl
+"The main entry point is a single word which takes a quotation and prints its stack effect and variable usage:"
+{ $subsection infer. }
+"Instead of printing the inferred information, it can be returned as objects on the stack:"
+{ $subsection infer }
+"The dataflow graph used by " { $link "compiler" } " can be obtained:"
+{ $subsection dataflow }
+"The following articles describe the implementation of the stack effect inference algorithm:"
+{ $subsection "inference-simple" }
+{ $subsection "inference-combinators" }
+{ $subsection "inference-branches" }
+{ $subsection "inference-recursive" } 
+{ $subsection "inference-limitations" } 
+{ $subsection "compiler-transforms" } ;
+
+ABOUT: "inference"
+
+HELP: inference-error
+{ $values { "msg" "an object" } }
+{ $description "Throws an " { $link inference-error } "." }
+{ $error-description
+    "Thrown by " { $link infer } " and " { $link dataflow } " when the stack effect of a quotation cannot be inferred."
+    $nl
+    "This error always delegates to one of the following classes of errors, which indicate the specific issue preventing a stack effect from being inferred:"
+    { $list
+        { $link no-effect }
+        { $link literal-expected }
+        { $link too-many->r }
+        { $link too-many-r> }
+        { $link unbalanced-branches-error }
+        { $link effect-error }
+        { $link recursive-declare-error }
+    }
+} ;
+
+
+HELP: dataflow-graph
+{ $var-description "In the dynamic extent of " { $link infer } " and " { $link dataflow } ", holds the first node of the dataflow graph being constructed." } ;
+
+HELP: current-node
+{ $var-description "In the dynamic extent of " { $link infer } " and " { $link dataflow } ", holds the most recently added node of the dataflow graph being constructed." } ;
+
+HELP: infer
+{ $values { "quot" "a quotation" } { "effect" "an instance of " { $link effect } } }
+{ $description "Attempts to infer the quotation's stack effect. For interactive testing, the " { $link infer. } " word should be called instead since it presents the output in a nicely formatted manner." }
+{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
+
+HELP: infer.
+{ $values { "quot" "a quotation" } }
+{ $description "Attempts to infer the quotation's stack effect, and prints this data to the " { $link stdio } " stream." }
+{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
+
+{ infer infer. } related-words
+
+HELP: dataflow
+{ $values { "quot" "a quotation" } { "dataflow" "a dataflow node" } }
+{ $description "Attempts to construct a dataflow graph showing stack flow in the quotation." }
+{ $notes "This is the first stage of the compiler." }
+{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
+
+HELP: dataflow-with
+{ $values { "quot" "a quotation" } { "stack" "a vector" } { "dataflow" "a dataflow node" } }
+{ $description "Attempts to construct a dataflow graph showing stack flow in the quotation, starting with an initial data stack of values." }
+{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
diff --git a/core/inference/inference-tests.factor b/core/inference/inference-tests.factor
new file mode 100644 (file)
index 0000000..f83dc3a
--- /dev/null
@@ -0,0 +1,559 @@
+USING: arrays generic inference inference.backend
+inference.dataflow kernel classes kernel.private math
+math.parser math.private namespaces namespaces.private parser
+sequences strings vectors words quotations effects tools.test
+continuations generic.standard sorting assocs definitions
+prettyprint io inspector bootstrap.image tuples
+classes.union classes.predicate debugger bootstrap.image
+bootstrap.image.private io.launcher threads.private
+io.streams.string combinators.private ;
+IN: temporary
+
+: short-effect
+    dup effect-in length swap effect-out length 2array ;
+
+[ { 0 2 } ] [ [ 2 "Hello" ] infer short-effect ] unit-test
+[ { 1 2 } ] [ [ dup ] infer short-effect ] unit-test
+
+[ { 1 2 } ] [ [ [ dup ] call ] infer short-effect ] unit-test
+[ [ call ] infer short-effect ] unit-test-fails
+
+[ { 2 4 } ] [ [ 2dup ] infer short-effect ] unit-test
+
+[ { 1 0 } ] [ [ [ ] [ ] if ] infer short-effect ] unit-test
+[ [ if ] infer short-effect ] unit-test-fails
+[ [ [ ] if ] infer short-effect ] unit-test-fails
+[ [ [ 2 ] [ ] if ] infer short-effect ] unit-test-fails
+[ { 4 3 } ] [ [ [ rot ] [ -rot ] if ] infer short-effect ] unit-test
+
+[ { 4 3 } ] [
+    [
+        [
+            [ swap 3 ] [ nip 5 5 ] if
+        ] [
+            -rot
+        ] if
+    ] infer short-effect
+] unit-test
+
+[ { 1 1 } ] [ [ dup [ ] when ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ dup [ dup fixnum* ] when ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ [ dup fixnum* ] when ] infer short-effect ] unit-test
+
+[ { 1 0 } ] [ [ [ drop ] when* ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ [ { { [ ] } } ] unless* ] infer short-effect ] unit-test
+
+[ { 0 1 } ] [
+    [ [ 2 2 fixnum+ ] dup [ ] when call ] infer short-effect
+] unit-test
+
+[
+    [ [ [ 2 2 fixnum+ ] ] [ [ 2 2 fixnum* ] ] if call ] infer
+] unit-test-fails
+
+! Test inference of termination of control flow
+: termination-test-1
+    "foo" throw ;
+
+: termination-test-2 [ termination-test-1 ] [ 3 ] if ;
+
+[ { 1 1 } ] [ [ termination-test-2 ] infer short-effect ] unit-test
+
+: infinite-loop infinite-loop ;
+
+[ [ infinite-loop ] infer short-effect ] unit-test-fails
+
+: no-base-case-1 dup [ no-base-case-1 ] [ no-base-case-1 ] if ;
+[ [ no-base-case-1 ] infer short-effect ] unit-test-fails
+
+: simple-recursion-1 ( obj -- obj )
+    dup [ simple-recursion-1 ] [ ] if ;
+
+[ { 1 1 } ] [ [ simple-recursion-1 ] infer short-effect ] unit-test
+
+: simple-recursion-2 ( obj -- obj )
+    dup [ ] [ simple-recursion-2 ] if ;
+
+[ { 1 1 } ] [ [ simple-recursion-2 ] infer short-effect ] unit-test
+
+: bad-recursion-2 ( obj -- obj )
+    dup [ dup first swap second bad-recursion-2 ] [ ] if ;
+
+[ [ bad-recursion-2 ] infer short-effect ] unit-test-fails
+
+: funny-recursion ( obj -- obj )
+    dup [ funny-recursion 1 ] [ 2 ] if drop ;
+
+[ { 1 1 } ] [ [ funny-recursion ] infer short-effect ] unit-test
+
+! Simple combinators
+[ { 1 2 } ] [ [ [ first ] keep second ] infer short-effect ] unit-test
+
+! Mutual recursion
+DEFER: foe
+
+: fie ( element obj -- ? )
+    dup array? [ foe ] [ eq? ] if ;
+
+: foe ( element tree -- ? )
+    dup [
+        2dup first fie [
+            nip
+        ] [
+            second dup array? [
+                foe
+            ] [
+                fie
+            ] if
+        ] if
+    ] [
+        2drop f
+    ] if ;
+
+[ { 2 1 } ] [ [ fie ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ foe ] infer short-effect ] unit-test
+
+: nested-when ( -- )
+    t [
+        t [
+            5 drop
+        ] when
+    ] when ;
+
+[ { 0 0 } ] [ [ nested-when ] infer short-effect ] unit-test
+
+: nested-when* ( obj -- )
+    [
+        [
+            drop
+        ] when*
+    ] when* ;
+
+[ { 1 0 } ] [ [ nested-when* ] infer short-effect ] unit-test
+
+SYMBOL: sym-test
+
+[ { 0 1 } ] [ [ sym-test ] infer short-effect ] unit-test
+
+: terminator-branch
+    dup [
+        length
+    ] [
+        "foo" throw
+    ] if ;
+
+[ { 1 1 } ] [ [ terminator-branch ] infer short-effect ] unit-test
+
+: recursive-terminator ( obj -- )
+    dup [
+        recursive-terminator
+    ] [
+        "Hi" throw
+    ] if ;
+
+[ { 1 0 } ] [ [ recursive-terminator ] infer short-effect ] unit-test
+
+GENERIC: potential-hang ( obj -- obj )
+M: fixnum potential-hang dup [ potential-hang ] when ;
+
+[ ] [ [ 5 potential-hang ] infer short-effect drop ] unit-test
+
+TUPLE: funny-cons car cdr ;
+GENERIC: iterate ( obj -- )
+M: funny-cons iterate funny-cons-cdr iterate ;
+M: f iterate drop ;
+M: real iterate drop ;
+
+[ { 1 0 } ] [ [ iterate ] infer short-effect ] unit-test
+
+! Regression
+: cat ( obj -- * ) dup [ throw ] [ throw ] if ;
+: dog ( a b c -- ) dup [ cat ] [ 3drop ] if ;
+[ { 3 0 } ] [ [ dog ] infer short-effect ] unit-test
+
+! Regression
+DEFER: monkey
+: friend ( a b c -- ) dup [ friend ] [ monkey ] if ;
+: monkey ( a b c -- ) dup [ 3drop ] [ friend ] if ;
+[ { 3 0 } ] [ [ friend ] infer short-effect ] unit-test
+
+! Regression -- same as above but we infer short-effect the second word first
+DEFER: blah2
+: blah ( a b c -- ) dup [ blah ] [ blah2 ] if ;
+: blah2 ( a b c -- ) dup [ blah ] [ 3drop ] if ;
+[ { 3 0 } ] [ [ blah2 ] infer short-effect ] unit-test
+
+! Regression
+DEFER: blah4
+: blah3 ( a b c -- )
+    dup [ blah3 ] [ dup [ blah4 ] [ blah3 ] if ] if ;
+: blah4 ( a b c -- )
+    dup [ blah4 ] [ dup [ 3drop ] [ blah3 ] if ] if ;
+[ { 3 0 } ] [ [ blah4 ] infer short-effect ] unit-test
+
+! Regression
+: bad-combinator ( obj quot -- )
+    over [
+        2drop
+    ] [
+        [ swap slip ] keep swap bad-combinator
+    ] if ; inline
+
+[ [ [ 1 ] [ ] bad-combinator ] infer short-effect ] unit-test-fails
+
+! Regression
+: bad-input#
+    dup string? [ 2array throw ] unless
+    over string? [ 2array throw ] unless ;
+
+[ { 2 2 } ] [ [ bad-input# ] infer short-effect ] unit-test
+
+! Regression
+
+! This order of branches works
+DEFER: do-crap
+: more-crap ( obj -- ) dup [ drop ] [ dup do-crap call ] if ;
+: do-crap ( obj -- ) dup [ more-crap ] [ do-crap ] if ;
+[ [ do-crap ] infer short-effect ] unit-test-fails
+
+! This one does not
+DEFER: do-crap*
+: more-crap* ( obj -- ) dup [ drop ] [ dup do-crap* call ] if ;
+: do-crap* ( obj -- ) dup [ do-crap* ] [ more-crap* ] if ;
+[ [ do-crap* ] infer short-effect ] unit-test-fails
+
+! Regression
+: too-deep ( a b -- c )
+    dup [ drop ] [ 2dup too-deep too-deep * ] if ; inline
+[ { 2 1 } ] [ [ too-deep ] infer short-effect ] unit-test
+
+! Error reporting is wrong
+MATH: xyz
+M: fixnum xyz 2array ;
+M: ratio xyz 
+    [ >fraction ] 2apply swapd >r 2array swap r> 2array swap ;
+
+[ t ] [ [ [ xyz ] infer short-effect ] catch inference-error? ] unit-test
+
+! Doug Coleman discovered this one while working on the
+! calendar library
+DEFER: A
+DEFER: B
+DEFER: C
+
+: A ( a -- )
+    dup {
+        [ drop ]
+        [ A ]
+        [ \ A no-method ]
+        [ dup C A ]
+    } dispatch ;
+
+: B ( b -- )
+    dup {
+        [ C ]
+        [ B ]
+        [ \ B no-method ]
+        [ dup B B ]
+    } dispatch ;
+
+: C ( c -- )
+    dup {
+        [ A ]
+        [ C ]
+        [ \ C no-method ]
+        [ dup B C ]
+    } dispatch ;
+
+[ { 1 0 } ] [ [ A ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ B ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ C ] infer short-effect ] unit-test
+
+! I found this bug by thinking hard about the previous one
+DEFER: Y
+: X ( a b -- c d ) dup [ swap Y ] [ ] if ;
+: Y ( a b -- c d ) X ;
+
+[ { 2 2 } ] [ [ X ] infer short-effect ] unit-test
+[ { 2 2 } ] [ [ Y ] infer short-effect ] unit-test
+
+! This one comes from UI code
+DEFER: #1
+: #2 ( a b -- ) dup [ call ] [ 2drop ] if ; inline
+: #3 ( a -- ) [ #1 ] #2 ;
+: #4 ( a -- ) dup [ drop ] [ dup #4 dup #3 call ] if ;
+: #1 ( a -- ) dup [ dup #4 dup #3 ] [ ] if drop ;
+
+[ \ #4 word-def infer short-effect ] unit-test-fails
+[ [ #1 ] infer short-effect ] unit-test-fails
+
+! Similar
+DEFER: bar
+: foo ( a b -- c d ) dup [ 2drop f f bar ] [ ] if ;
+: bar ( a b -- ) [ 2 2 + ] t foo drop call drop ;
+
+[ [ foo ] infer short-effect ] unit-test-fails
+
+[ 1234 infer short-effect ] unit-test-fails
+
+! This used to hang
+[ t ] [
+    [ [ [ dup call ] dup call ] infer ] catch
+    inference-error?
+] unit-test
+
+: m dup call ; inline
+
+[ t ] [
+    [ [ [ m ] m ] infer ] catch inference-error?
+] unit-test
+
+: m' dup curry call ; inline
+
+[ t ] [
+    [ [ [ m' ] m' ] infer ] catch inference-error?
+] unit-test
+
+: m'' [ dup curry ] ; inline
+
+: m''' m'' call call ; inline
+
+[ t ] [
+    [ [ [ m''' ] m''' ] infer ] catch inference-error?
+] unit-test
+
+: m-if t over if ; inline
+
+[ t ] [
+    [ [ [ m-if ] m-if ] infer ] catch inference-error?
+] unit-test
+
+! This doesn't hang but it's also an example of the
+! undedicable case
+[ t ] [
+    [ [ [ [ drop 3 ] swap call ] dup call ] infer ] catch
+    inference-error?
+] unit-test
+
+! This form should not have a stack effect
+
+: bad-recursion-1 ( a -- b )
+    dup [ drop bad-recursion-1 5 ] [ ] if ;
+
+[ [ bad-recursion-1 ] infer short-effect ] unit-test-fails
+
+: bad-bin ( a b -- ) 5 [ 5 bad-bin bad-bin 5 ] [ 2drop ] if ;
+[ [ bad-bin ] infer short-effect ] unit-test-fails
+
+[ t ] [ [ [ r> ] infer short-effect ] catch inference-error? ] unit-test
+
+! Test some curry stuff
+[ { 1 1 } ] [ [ 3 [ ] curry 4 [ ] curry if ] infer short-effect ] unit-test
+
+[ { 2 1 } ] [ [ [ ] curry 4 [ ] curry if ] infer short-effect ] unit-test
+
+[ [ 3 [ ] curry 1 2 [ ] 2curry if ] infer ] unit-test-fails
+
+! Test number protocol
+[ { 2 1 } ] [ [ bitor ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ bitand ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ bitxor ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ mod ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ /i ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ /f ] infer short-effect ] unit-test
+[ { 2 2 } ] [ [ /mod ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ + ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ - ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ * ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ / ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ < ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ <= ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ > ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ >= ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ number= ] infer short-effect ] unit-test
+
+! Test object protocol
+[ { 2 1 } ] [ [ = ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ clone ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ hashcode* ] infer short-effect ] unit-test
+
+! Test sequence protocol
+[ { 1 1 } ] [ [ length ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ nth ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ set-length ] infer short-effect ] unit-test
+[ { 3 0 } ] [ [ set-nth ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ new ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ new-resizable ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ like ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ lengthen ] infer short-effect ] unit-test
+
+! Test assoc protocol
+[ { 2 2 } ] [ [ at* ] infer short-effect ] unit-test
+[ { 3 0 } ] [ [ set-at ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ new-assoc ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ delete-at ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ clear-assoc ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ assoc-size ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ assoc-like ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ assoc-clone-like ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ >alist ] infer short-effect ] unit-test
+[ { 1 3 } ] [ [ [ 2drop f ] assoc-find ] infer short-effect ] unit-test
+
+! Test some random library words
+[ { 1 1 } ] [ [ 1quotation ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ string>number ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ get ] infer short-effect ] unit-test
+
+[ { 2 0 } ] [ [ push ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ append ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ peek ] infer short-effect ] unit-test
+
+[ { 1 1 } ] [ [ reverse ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ member? ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ remove ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ natural-sort ] infer short-effect ] unit-test
+
+[ { 1 0 } ] [ [ forget ] infer short-effect ] unit-test
+[ { 4 0 } ] [ [ define-class ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ define-tuple-class ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ define-union-class ] infer short-effect ] unit-test
+[ { 3 0 } ] [ [ define-predicate-class ] infer short-effect ] unit-test
+
+! Test words with continuations
+[ { 0 0 } ] [ [ [ drop ] callcc0 ] infer short-effect ] unit-test
+[ { 0 1 } ] [ [ [ 4 swap continue-with ] callcc1 ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ [ + ] [ ] [ ] cleanup ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ [ + ] [ 3drop 0 ] recover ] infer short-effect ] unit-test
+
+! Test stream protocol
+[ { 2 0 } ] [ [ set-timeout ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ stream-read ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ stream-read1 ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ stream-readln ] infer short-effect ] unit-test
+[ { 2 2 } ] [ [ stream-read-until ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ stream-write ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ stream-write1 ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ stream-nl ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ stream-close ] infer short-effect ] unit-test
+[ { 3 0 } ] [ [ stream-format ] infer short-effect ] unit-test
+[ { 3 0 } ] [ [ stream-write-table ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ stream-flush ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ make-span-stream ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ make-block-stream ] infer short-effect ] unit-test
+[ { 2 1 } ] [ [ make-cell-stream ] infer short-effect ] unit-test
+
+! Test stream utilities
+[ { 1 1 } ] [ [ lines ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ contents ] infer short-effect ] unit-test
+
+! Test prettyprinting
+[ { 1 0 } ] [ [ . ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ short. ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ unparse ] infer short-effect ] unit-test
+
+[ { 1 0 } ] [ [ describe ] infer short-effect ] unit-test
+[ { 1 0 } ] [ [ error. ] infer short-effect ] unit-test
+
+! Test odds and ends
+[ { 1 1 } ] [ [ ' ] infer short-effect ] unit-test
+[ { 2 0 } ] [ [ write-image ] infer short-effect ] unit-test
+[ { 1 1 } ] [ [ <process-stream> ] infer short-effect ] unit-test
+[ { 0 0 } ] [ [ idle-thread ] infer short-effect ] unit-test
+
+! Incorrect stack declarations on inline recursive words should
+! be caught
+: fooxxx ( a b -- c ) over [ foo ] when ; inline
+: barxxx fooxxx ;
+
+[ [ barxxx ] infer ] unit-test-fails
+
+! A typo
+[ { 1 0 } ] [ [ { [ ] } dispatch ] infer short-effect ] unit-test
+
+DEFER: inline-recursive-2
+: inline-recursive-1 ( -- ) inline-recursive-2 ;
+: inline-recursive-2 ( -- ) inline-recursive-1 ;
+
+[ { 0 0 } ] [ [ inline-recursive-1 ] infer short-effect ] unit-test
+
+! Hooks
+SYMBOL: my-var
+HOOK: my-hook my-var ( -- x )
+
+M: integer my-hook "an integer" ;
+M: string my-hook "a string" ;
+
+[ { 0 1 } ] [ [ my-hook ] infer short-effect ] unit-test
+
+DEFER: deferred-word
+
+: calls-deferred-word [ deferred-word ] [ 3 ] if ;
+
+[ { 1 1 } ] [ [ calls-deferred-word ] infer short-effect ] unit-test
+
+USE: inference.dataflow
+
+[ { 1 0 } ] [ [ [ iterate-next ] iterate-nodes ] infer short-effect ] unit-test
+
+[ { 1 0 } ] [
+    [
+        [ [ iterate-next ] iterate-nodes ] with-node-iterator
+    ] infer short-effect
+] unit-test
+
+: nilpotent ( quot -- )
+    t [ [ call ] keep nilpotent ] [ drop ] if ; inline
+
+: semisimple ( quot -- )
+    [ call ] keep [ [ semisimple ] keep ] nilpotent drop ; inline
+
+[ { 0 1 } ] [
+    [ [ ] [ call ] keep [ [ call ] keep ] nilpotent ]
+    infer short-effect
+] unit-test
+
+[ { 0 0 } ] [ [ [ ] semisimple ] infer short-effect ] unit-test
+
+[ { 1 0 } ] [ [ [ drop ] each-node ] infer short-effect ] unit-test
+
+DEFER: an-inline-word
+
+: normal-word-3 ( -- )
+    3 [ [ 2 + ] curry ] an-inline-word call drop ;
+
+: normal-word-2 ( -- )
+    normal-word-3 ;
+
+: normal-word ( x -- x )
+    dup [ normal-word-2 ] when ;
+
+: an-inline-word ( obj quot -- )
+    >r normal-word r> call ; inline
+
+[ { 1 1 } ] [ [ [ 3 * ] an-inline-word ] infer short-effect ] unit-test
+
+[ { 0 1 } ] [ [ [ 2 ] [ 2 ] [ + ] compose compose call ] infer short-effect ] unit-test
+
+TUPLE: custom-error ;
+
+[ T{ effect f 0 0 t } ] [
+    [ custom-error construct-boa throw ] infer
+] unit-test
+
+: funny-throw throw ; inline
+
+[ T{ effect f 0 0 t } ] [
+    [ 3 funny-throw ] infer
+] unit-test
+
+[ T{ effect f 0 0 t } ] [
+    [ custom-error inference-error ] infer
+] unit-test
+
+[ T{ effect f 1 1 t } ] [
+    [ dup >r 3 throw r> ] infer
+] unit-test
+
+! This was a false trigger of the undecidable quotation
+! recursion bug
+[ { 2 1 } ] [ [ find-last-sep ] infer short-effect ] unit-test
diff --git a/core/inference/inference.factor b/core/inference/inference.factor
new file mode 100644 (file)
index 0000000..e43afe9
--- /dev/null
@@ -0,0 +1,27 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: inference
+USING: inference.backend inference.dataflow
+inference.known-words inference.stack inference.transforms
+inference.errors sequences prettyprint io effects kernel
+namespaces quotations ;
+
+GENERIC: infer ( quot -- effect )
+
+M: callable infer ( quot -- effect )
+    [ infer-quot current-effect ] with-infer ;
+
+: infer. ( quot -- )
+    infer effect>string print ;
+
+: (dataflow) ( quot -- dataflow )
+    infer-quot
+    reify-all
+    f #return node,
+    dataflow-graph get ;
+
+: dataflow ( quot -- dataflow )
+    [ (dataflow) ] with-infer ;
+
+: dataflow-with ( quot stack -- dataflow )
+    [ V{ } like meta-d set (dataflow) ] with-infer ;
diff --git a/core/inference/known-words/authors.txt b/core/inference/known-words/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/known-words/known-words.factor b/core/inference/known-words/known-words.factor
new file mode 100644 (file)
index 0000000..81fc7f6
--- /dev/null
@@ -0,0 +1,532 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: inference.known-words
+USING: alien arrays bit-arrays byte-arrays classes
+combinators.private continuations.private effects float-arrays
+generic hashtables hashtables.private
+inference.backend inference.dataflow io io.backend io.files
+io.files.private io.streams.c kernel kernel.private math
+math.private memory namespaces namespaces.private parser
+prettyprint quotations quotations.private sbufs sbufs.private
+sequences sequences.private slots.private strings
+strings.private system threads.private tuples tuples.private
+vectors vectors.private words ;
+
+\ declare [
+    1 ensure-values
+    pop-literal nip
+    dup ensure-values
+    dup length d-tail
+    swap #declare
+    [ 2dup set-node-in-d set-node-out-d ] keep
+    node,
+] "infer" set-word-prop
+
+\ fixnum< { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
+\ fixnum< make-foldable
+
+\ fixnum<= { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
+\ fixnum<= make-foldable
+
+\ fixnum> { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
+\ fixnum> make-foldable
+
+\ fixnum>= { fixnum fixnum } { object } <effect> "inferred-effect" set-word-prop
+\ fixnum>= make-foldable
+
+\ eq? { object object } { object } <effect> "inferred-effect" set-word-prop
+\ eq? make-foldable
+
+! Primitive combinators
+GENERIC: infer-call ( value -- )
+
+M: value infer-call
+    drop
+    1 #drop node,
+    pop-d infer-quot-value ;
+
+M: curried infer-call
+    infer-uncurry peek-d infer-call ;
+
+M: composed infer-call
+    infer-uncurry
+    infer->r peek-d infer-call infer-r>
+    peek-d infer-call ;
+
+M: object infer-call
+    \ literal-expected inference-warning ;
+
+\ call [
+    1 ensure-values
+    peek-d infer-call
+] "infer" set-word-prop
+
+\ execute [
+    1 ensure-values
+    pop-literal nip
+    dup word? [
+        apply-object
+    ] [
+        drop
+        [ "execute must be given a word" throw ]
+        infer-quot
+    ] if
+] "infer" set-word-prop
+
+\ if [
+    3 ensure-values
+    2 d-tail [ special? ] contains? [
+        [ rot [ drop call ] [ nip call ] if ] infer-quot
+    ] [
+        [ #values ]
+        2 #drop node, pop-d pop-d swap 2array
+        [ #if ] infer-branches
+    ] if
+] "infer" set-word-prop
+
+\ dispatch [
+    2 ensure-values
+    [ gensym #return ]
+    pop-literal nip [ <value> ] map
+    [ #dispatch ] infer-branches
+] "infer" set-word-prop
+
+\ curry [
+    2 ensure-values
+    pop-d pop-d swap <curried> push-d
+] "infer" set-word-prop
+
+\ curry { object object } { curry } <effect> "inferred-effect" set-word-prop
+
+\ compose [
+    2 ensure-values
+    pop-d pop-d swap <composed> push-d
+] "infer" set-word-prop
+
+\ compose { object object } { curry } <effect> "inferred-effect" set-word-prop
+
+! Variadic tuple constructor
+\ <tuple-boa> [
+    \ <tuple-boa>
+    peek-d value-literal { tuple } <effect>
+    make-call-node
+] "infer" set-word-prop
+
+! We need this for default-output-classes
+\ <tuple-boa> 2 { tuple } <effect> "inferred-effect" set-word-prop
+
+! Non-standard control flow
+\ (throw) { callable } { } <effect>
+t over set-effect-terminated?
+"inferred-effect" set-word-prop
+
+! Stack effects for all primitives
+\ rehash-string { string } { } <effect> "inferred-effect" set-word-prop
+
+\ string>sbuf { string integer } { sbuf } <effect> "inferred-effect" set-word-prop
+\ string>sbuf make-flushable
+
+\ bignum>fixnum { bignum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ bignum>fixnum make-foldable
+
+\ float>fixnum { float } { fixnum } <effect> "inferred-effect" set-word-prop
+\ bignum>fixnum make-foldable
+
+\ fixnum>bignum { fixnum } { bignum } <effect> "inferred-effect" set-word-prop
+\ fixnum>bignum make-foldable
+
+\ float>bignum { float } { bignum } <effect> "inferred-effect" set-word-prop
+\ float>bignum make-foldable
+
+\ fixnum>float { fixnum } { float } <effect> "inferred-effect" set-word-prop
+\ fixnum>float make-foldable
+
+\ bignum>float { bignum } { float } <effect> "inferred-effect" set-word-prop
+\ bignum>float make-foldable
+
+\ <ratio> { integer integer } { ratio } <effect> "inferred-effect" set-word-prop
+\ <ratio> make-foldable
+
+\ string>float { string } { float } <effect> "inferred-effect" set-word-prop
+\ string>float make-foldable
+
+\ float>string { float } { string } <effect> "inferred-effect" set-word-prop
+\ float>string make-foldable
+
+\ float>bits { real } { integer } <effect> "inferred-effect" set-word-prop
+\ float>bits make-foldable
+
+\ double>bits { real } { integer } <effect> "inferred-effect" set-word-prop
+\ double>bits make-foldable
+
+\ bits>float { integer } { float } <effect> "inferred-effect" set-word-prop
+\ bits>float make-foldable
+
+\ bits>double { integer } { float } <effect> "inferred-effect" set-word-prop
+\ bits>double make-foldable
+
+\ <complex> { real real } { complex } <effect> "inferred-effect" set-word-prop
+\ <complex> make-foldable
+
+\ fixnum+ { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
+\ fixnum+ make-foldable
+
+\ fixnum+fast { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum+fast make-foldable
+
+\ fixnum- { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
+\ fixnum- make-foldable
+
+\ fixnum-fast { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum-fast make-foldable
+
+\ fixnum* { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
+\ fixnum* make-foldable
+
+\ fixnum*fast { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum*fast make-foldable
+
+\ fixnum/i { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
+\ fixnum/i make-foldable
+
+\ fixnum-mod { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum-mod make-foldable
+
+\ fixnum/mod { fixnum fixnum } { integer fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum/mod make-foldable
+
+\ fixnum-bitand { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum-bitand make-foldable
+
+\ fixnum-bitor { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum-bitor make-foldable
+
+\ fixnum-bitxor { fixnum fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum-bitxor make-foldable
+
+\ fixnum-bitnot { fixnum } { fixnum } <effect> "inferred-effect" set-word-prop
+\ fixnum-bitnot make-foldable
+
+\ fixnum-shift { fixnum fixnum } { integer } <effect> "inferred-effect" set-word-prop
+\ fixnum-shift make-foldable
+
+\ bignum= { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
+\ bignum= make-foldable
+
+\ bignum+ { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum+ make-foldable
+
+\ bignum- { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum- make-foldable
+
+\ bignum* { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum* make-foldable
+
+\ bignum/i { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum/i make-foldable
+
+\ bignum-mod { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum-mod make-foldable
+
+\ bignum/mod { bignum bignum } { bignum bignum } <effect> "inferred-effect" set-word-prop
+\ bignum/mod make-foldable
+
+\ bignum-bitand { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum-bitand make-foldable
+
+\ bignum-bitor { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum-bitor make-foldable
+
+\ bignum-bitxor { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum-bitxor make-foldable
+
+\ bignum-bitnot { bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum-bitnot make-foldable
+
+\ bignum-shift { bignum bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum-shift make-foldable
+
+\ bignum< { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
+\ bignum< make-foldable
+
+\ bignum<= { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
+\ bignum<= make-foldable
+
+\ bignum> { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
+\ bignum> make-foldable
+
+\ bignum>= { bignum bignum } { object } <effect> "inferred-effect" set-word-prop
+\ bignum>= make-foldable
+
+\ bignum-bit? { bignum integer } { object } <effect> "inferred-effect" set-word-prop
+\ bignum-bit? make-foldable
+
+\ bignum-log2 { bignum } { bignum } <effect> "inferred-effect" set-word-prop
+\ bignum-log2 make-foldable
+
+\ byte-array>bignum { byte-array } { bignum } <effect> "inferred-effect" set-word-prop
+\ byte-array>bignum make-foldable
+
+\ float= { float float } { object } <effect> "inferred-effect" set-word-prop
+\ float= make-foldable
+
+\ float+ { float float } { float } <effect> "inferred-effect" set-word-prop
+\ float+ make-foldable
+
+\ float- { float float } { float } <effect> "inferred-effect" set-word-prop
+\ float- make-foldable
+
+\ float* { float float } { float } <effect> "inferred-effect" set-word-prop
+\ float* make-foldable
+
+\ float/f { float float } { float } <effect> "inferred-effect" set-word-prop
+\ float/f make-foldable
+
+\ float< { float float } { object } <effect> "inferred-effect" set-word-prop
+\ float< make-foldable
+
+\ float-mod { float float } { float } <effect> "inferred-effect" set-word-prop
+\ float-mod make-foldable
+
+\ float<= { float float } { object } <effect> "inferred-effect" set-word-prop
+\ float<= make-foldable
+
+\ float> { float float } { object } <effect> "inferred-effect" set-word-prop
+\ float> make-foldable
+
+\ float>= { float float } { object } <effect> "inferred-effect" set-word-prop
+\ float>= make-foldable
+
+\ <word> { object object } { word } <effect> "inferred-effect" set-word-prop
+\ <word> make-flushable
+
+\ update-xt { word } { } <effect> "inferred-effect" set-word-prop
+
+\ word-xt { word } { integer } <effect> "inferred-effect" set-word-prop
+\ word-xt make-flushable
+
+\ getenv { fixnum } { object } <effect> "inferred-effect" set-word-prop
+\ getenv make-flushable
+
+\ setenv { object fixnum } { } <effect> "inferred-effect" set-word-prop
+
+\ (stat) { string } { object object object object } <effect> "inferred-effect" set-word-prop
+
+\ (directory) { string } { array } <effect> "inferred-effect" set-word-prop
+
+\ data-gc { } { } <effect> "inferred-effect" set-word-prop
+
+\ code-gc { } { } <effect> "inferred-effect" set-word-prop
+
+\ gc-time { } { integer } <effect> "inferred-effect" set-word-prop
+
+\ save-image { string } { } <effect> "inferred-effect" set-word-prop
+
+\ save-image-and-exit { string } { } <effect> "inferred-effect" set-word-prop
+
+\ exit { integer } { } <effect>
+t over set-effect-terminated?
+"inferred-effect" set-word-prop
+
+\ data-room { } { integer array } <effect> "inferred-effect" set-word-prop
+\ data-room make-flushable
+
+\ code-room { } { integer integer } <effect> "inferred-effect" set-word-prop
+\ code-room  make-flushable
+
+\ os-env { string } { object } <effect> "inferred-effect" set-word-prop
+
+\ millis { } { integer } <effect> "inferred-effect" set-word-prop
+\ millis make-flushable
+
+\ type { object } { fixnum } <effect> "inferred-effect" set-word-prop
+\ type make-foldable
+
+\ tag { object } { fixnum } <effect> "inferred-effect" set-word-prop
+\ tag make-foldable
+
+\ class-hash { object } { fixnum } <effect> "inferred-effect" set-word-prop
+\ class-hash make-foldable
+
+\ cwd { } { string } <effect> "inferred-effect" set-word-prop
+
+\ cd { string } { } <effect> "inferred-effect" set-word-prop
+
+\ dlopen { string } { dll } <effect> "inferred-effect" set-word-prop
+
+\ dlsym { string object } { c-ptr } <effect> "inferred-effect" set-word-prop
+
+\ dlclose { dll } { } <effect> "inferred-effect" set-word-prop
+
+\ <byte-array> { integer } { byte-array } <effect> "inferred-effect" set-word-prop
+\ <byte-array> make-flushable
+
+\ <bit-array> { integer } { bit-array } <effect> "inferred-effect" set-word-prop
+\ <bit-array> make-flushable
+
+\ <float-array> { integer float } { float-array } <effect> "inferred-effect" set-word-prop
+\ <float-array> make-flushable
+
+\ <displaced-alien> { integer c-ptr } { c-ptr } <effect> "inferred-effect" set-word-prop
+\ <displaced-alien> make-flushable
+
+\ alien-signed-cell { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-signed-cell { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-unsigned-cell { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-unsigned-cell { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-signed-8 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-signed-8 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-unsigned-8 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-unsigned-8 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-signed-4 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-signed-4 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-unsigned-4 { c-ptr integer } { integer } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-unsigned-4 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-signed-2 { c-ptr integer } { fixnum } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-signed-2 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-unsigned-2 { c-ptr integer } { fixnum } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-unsigned-2 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-signed-1 { c-ptr integer } { fixnum } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-signed-1 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-unsigned-1 { c-ptr integer } { fixnum } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-unsigned-1 { integer c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-float { c-ptr integer } { float } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-float { float c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-double { c-ptr integer } { float } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-double { float c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien-cell { c-ptr integer } { simple-c-ptr } <effect> "inferred-effect" set-word-prop
+
+\ set-alien-cell { c-ptr c-ptr integer } { } <effect> "inferred-effect" set-word-prop
+
+\ alien>char-string { c-ptr } { string } <effect> "inferred-effect" set-word-prop
+
+\ string>char-alien { string } { byte-array } <effect> "inferred-effect" set-word-prop
+
+\ alien>u16-string { c-ptr } { string } <effect> "inferred-effect" set-word-prop
+
+\ string>u16-alien { string } { byte-array } <effect> "inferred-effect" set-word-prop
+
+\ string>memory { string c-ptr } { } <effect> "inferred-effect" set-word-prop
+
+\ memory>string { c-ptr integer } { string } <effect> "inferred-effect" set-word-prop
+
+\ alien-address { alien } { integer } <effect> "inferred-effect" set-word-prop
+\ alien-address make-flushable
+
+\ slot { object fixnum } { object } <effect> "inferred-effect" set-word-prop
+\ slot make-flushable
+
+\ set-slot { object object fixnum } { } <effect> "inferred-effect" set-word-prop
+
+\ char-slot { fixnum object } { fixnum } <effect> "inferred-effect" set-word-prop
+\ char-slot make-flushable
+
+\ set-char-slot { fixnum fixnum object } { } <effect> "inferred-effect" set-word-prop
+
+\ resize-array { integer array } { array } <effect> "inferred-effect" set-word-prop
+\ resize-array make-flushable
+
+\ resize-string { integer string } { string } <effect> "inferred-effect" set-word-prop
+\ resize-string make-flushable
+
+\ (hashtable) { } { hashtable } <effect> "inferred-effect" set-word-prop
+\ (hashtable) make-flushable
+
+\ <array> { integer object } { array } <effect> "inferred-effect" set-word-prop
+\ <array> make-flushable
+
+\ begin-scan { } { } <effect> "inferred-effect" set-word-prop
+
+\ next-object { } { object } <effect> "inferred-effect" set-word-prop
+
+\ end-scan { } { } <effect> "inferred-effect" set-word-prop
+
+\ size { object } { fixnum } <effect> "inferred-effect" set-word-prop
+\ size make-flushable
+
+\ die { } { } <effect> "inferred-effect" set-word-prop
+
+\ fopen { string string } { alien } <effect> "inferred-effect" set-word-prop
+
+\ fgetc { alien } { object } <effect> "inferred-effect" set-word-prop
+
+\ fwrite { string alien } { } <effect> "inferred-effect" set-word-prop
+
+\ fread { integer string } { object } <effect> "inferred-effect" set-word-prop
+
+\ fflush { alien } { } <effect> "inferred-effect" set-word-prop
+
+\ fclose { alien } { } <effect> "inferred-effect" set-word-prop
+
+\ expired? { object } { object } <effect> "inferred-effect" set-word-prop
+\ expired? make-flushable
+
+\ <wrapper> { object } { wrapper } <effect> "inferred-effect" set-word-prop
+\ <wrapper> make-foldable
+
+\ (clone) { object } { object } <effect> "inferred-effect" set-word-prop
+\ (clone) make-flushable
+
+\ array>vector { array integer } { vector } <effect> "inferred-effect" set-word-prop
+\ array>vector make-flushable
+
+\ <string> { integer integer } { string } <effect> "inferred-effect" set-word-prop
+\ <string> make-flushable
+
+\ array>quotation { array } { quotation } <effect> "inferred-effect" set-word-prop
+\ array>quotation make-flushable
+
+\ quotation-xt { quotation } { integer } <effect> "inferred-effect" set-word-prop
+\ quotation-xt make-flushable
+
+\ <tuple> { word integer } { quotation } <effect> "inferred-effect" set-word-prop
+\ <tuple> make-flushable
+
+\ (>tuple) { array } { tuple } <effect> "inferred-effect" set-word-prop
+\ (>tuple) make-flushable
+
+\ tuple>array { tuple } { array } <effect> "inferred-effect" set-word-prop
+\ tuple>array make-flushable
+
+\ datastack { } { array } <effect> "inferred-effect" set-word-prop
+\ datastack make-flushable
+
+\ retainstack { } { array } <effect> "inferred-effect" set-word-prop
+\ retainstack make-flushable
+
+\ callstack { } { callstack } <effect> "inferred-effect" set-word-prop
+\ callstack make-flushable
+
+\ callstack>array { callstack } { array } <effect> "inferred-effect" set-word-prop
+\ callstack>array make-flushable
+
+\ array>callstack { array } { callstack } <effect> "inferred-effect" set-word-prop
+\ array>callstack make-flushable
+
+\ (sleep) { integer } { } <effect> "inferred-effect" set-word-prop
+
+\ become { array array } { } <effect> "inferred-effect" set-word-prop
diff --git a/core/inference/known-words/summary.txt b/core/inference/known-words/summary.txt
new file mode 100644 (file)
index 0000000..fcd33bb
--- /dev/null
@@ -0,0 +1 @@
+Hard-coded stack effects for primitive words
diff --git a/core/inference/stack/authors.txt b/core/inference/stack/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/stack/stack-docs.factor b/core/inference/stack/stack-docs.factor
new file mode 100644 (file)
index 0000000..18e26a8
--- /dev/null
@@ -0,0 +1,11 @@
+USING: inference.stack help.syntax help.markup ;
+
+HELP: shuffle
+{ $values { "stack" "a sequence" } { "shuffle" shuffle } { "newstack" "a new sequence" } }
+{ $description "Applies a stack shuffle pattern to a stack." }
+{ $errors "Throws an error if the input stack contains insufficient elements." } ;
+
+HELP: shuffle-stacks
+{ $values { "shuffle" "an instance of " { $link shuffle } } }
+{ $description "Applies a stack shuffle pattern to the inference stacks." }
+{ $errors "Throws an error if the stacks contain insufficient elements." } ;
diff --git a/core/inference/stack/stack.factor b/core/inference/stack/stack.factor
new file mode 100644 (file)
index 0000000..ac6ea73
--- /dev/null
@@ -0,0 +1,64 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: inference.stack
+USING: inference.dataflow inference.backend arrays generic
+kernel math namespaces sequences words parser words quotations
+assocs effects ;
+
+: split-shuffle ( stack shuffle -- stack1 stack2 )
+    effect-in length swap cut* ;
+
+: load-shuffle ( stack shuffle -- )
+    effect-in [ set ] 2each ;
+
+: shuffled-values ( shuffle -- values )
+    effect-out [ get ] map ;
+
+: shuffle* ( stack shuffle -- newstack )
+    [ [ load-shuffle ] keep shuffled-values ] with-scope ;
+
+: shuffle ( stack shuffle -- newstack )
+    [ split-shuffle ] keep shuffle* append ;
+
+: infer-shuffle-inputs ( shuffle node -- )
+    >r effect-in length 0 r> node-inputs ;
+
+: shuffle-stacks ( shuffle -- )
+    meta-d [ swap shuffle ] change ;
+
+: infer-shuffle-outputs ( shuffle node -- )
+    >r effect-out length 0 r> node-outputs ;
+
+: infer-shuffle ( shuffle -- )
+    dup effect-in ensure-values
+    #shuffle
+    2dup infer-shuffle-inputs
+    over shuffle-stacks
+    2dup infer-shuffle-outputs
+    node, drop ;
+
+: define-shuffle ( word shuffle -- )
+    [ infer-shuffle ] curry "infer" set-word-prop ;
+
+{
+    { drop  T{ effect f 1 {             } } }
+    { 2drop T{ effect f 2 {             } } }
+    { 3drop T{ effect f 3 {             } } }
+    { dup   T{ effect f 1 { 0 0         } } }
+    { 2dup  T{ effect f 2 { 0 1 0 1     } } }
+    { 3dup  T{ effect f 3 { 0 1 2 0 1 2 } } }
+    { rot   T{ effect f 3 { 1 2 0       } } }
+    { -rot  T{ effect f 3 { 2 0 1       } } }
+    { dupd  T{ effect f 2 { 0 0 1       } } }
+    { swapd T{ effect f 3 { 1 0 2       } } }
+    { nip   T{ effect f 2 { 1           } } }
+    { 2nip  T{ effect f 3 { 2           } } }
+    { tuck  T{ effect f 2 { 1 0 1       } } }
+    { over  T{ effect f 2 { 0 1 0       } } }
+    { pick  T{ effect f 3 { 0 1 2 0     } } }
+    { swap  T{ effect f 2 { 1 0         } } }
+} [ define-shuffle ] assoc-each
+
+\ >r [ infer->r ] "infer" set-word-prop
+
+\ r> [ infer-r> ] "infer" set-word-prop
diff --git a/core/inference/stack/summary.txt b/core/inference/stack/summary.txt
new file mode 100644 (file)
index 0000000..daf873e
--- /dev/null
@@ -0,0 +1 @@
+Stack shuffles as first-class data types
diff --git a/core/inference/summary.txt b/core/inference/summary.txt
new file mode 100644 (file)
index 0000000..e676861
--- /dev/null
@@ -0,0 +1 @@
+Stack effect inference
diff --git a/core/inference/tags.txt b/core/inference/tags.txt
new file mode 100644 (file)
index 0000000..417ced6
--- /dev/null
@@ -0,0 +1,2 @@
+tools
+compiler
diff --git a/core/inference/transforms/authors.txt b/core/inference/transforms/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inference/transforms/summary.txt b/core/inference/transforms/summary.txt
new file mode 100644 (file)
index 0000000..71dfdc7
--- /dev/null
@@ -0,0 +1 @@
+Support for compile-time code transformation
diff --git a/core/inference/transforms/transforms-docs.factor b/core/inference/transforms/transforms-docs.factor
new file mode 100644 (file)
index 0000000..b695406
--- /dev/null
@@ -0,0 +1,14 @@
+USING: help.markup help.syntax inference.transforms
+combinators words ;
+
+HELP: define-transform
+{ $values { "word" word } { "quot" "a quotation taking " { $snippet "n" } " inputs from the stack and producing another quotation as output" } { "n" "a non-negative integer" } }
+{ $description "Defines a compiler transform for the optimizing compiler. When a call to " { $snippet "word" } " is being compiled, the compiler ensures that the top " { $snippet "n" } " stack values are literal; if they are not, compilation fails. The literal values are passed to the quotation, which is expected to produce a new quotation. The call to the word is then replaced by this quotation." }
+{ $examples "Here is a word which pops " { $snippet "n" } " values from the stack:"
+{ $code ": ndrop ( n -- ) [ drop ] times ;" }
+"This word is inefficient; it does not have a static stack effect. This means that words calling " { $snippet "ndrop" } " cannot be compiled by the optimizing compiler, and additionally, a call to this word will always involve a loop with arithmetic, even if the value of " { $snippet "n" } " is known at compile time. A compiler transform can fix this:"
+{ $code "\\ ndrop [ \\ drop <repetition> >quotation ] 1 define-transform" }
+"Now, a call like " { $snippet "4 ndrop" } " is replaced with " { $snippet "drop drop drop drop" } " at compile time; the optimizer then ensures that this compiles as a single machine instruction, which is a lot cheaper than an actual call to " { $snippet "ndrop" } "."
+$nl
+"The " { $link cond } " word compiles to efficient code because it is transformed using " { $link cond>quot } ":"
+{ $code "\\ cond [ cond>quot ] 1 define-transform" } } ;
diff --git a/core/inference/transforms/transforms-tests.factor b/core/inference/transforms/transforms-tests.factor
new file mode 100644 (file)
index 0000000..6dc5bca
--- /dev/null
@@ -0,0 +1,20 @@
+IN: temporary
+USING: sequences inference.transforms tools.test math kernel
+quotations ;
+
+: compose-n-quot <repetition> >quotation ;
+: compose-n compose-n-quot call ;
+\ compose-n [ compose-n-quot ] 2 define-transform
+: compose-n-test 2 \ + compose-n ;
+
+[ 6 ] [ 1 2 3 compose-n-test ] unit-test
+
+[ 0 ] [ { } bitfield-quot call ] unit-test
+
+[ 256 ] [ 1 { 8 } bitfield-quot call ] unit-test
+
+[ 268 ] [ 3 1 { 8 2 } bitfield-quot call ] unit-test
+
+[ 268 ] [ 1 { 8 { 3 2 } } bitfield-quot call ] unit-test
+
+[ 512 ] [ 1 { { 1+ 8 } } bitfield-quot call ] unit-test
diff --git a/core/inference/transforms/transforms.factor b/core/inference/transforms/transforms.factor
new file mode 100644 (file)
index 0000000..8a0dbb9
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel words sequences generic math namespaces
+quotations assocs combinators math.bitfields inference.backend
+inference.dataflow tuples.private ;
+IN: inference.transforms
+
+: pop-literals ( n -- seq )
+    [ ensure-values ] keep
+    [ d-tail ] keep
+    (consume-values)
+    [ value-literal ] map ;
+
+: transform-quot ( quot n -- newquot )
+    [
+        , \ pop-literals , [ [ ] each ] % % \ infer-quot ,
+    ] [ ] make ;
+
+: define-transform ( word quot n -- )
+    transform-quot "infer" set-word-prop ;
+
+\ cond [
+    cond>quot
+] 1 define-transform
+
+\ case [
+    dup empty? [
+        drop [ no-case ]
+    ] [
+        dup peek quotation? [
+            dup peek swap 1 head*
+        ] [
+            [ no-case ] swap
+        ] if hash-case>quot
+    ] if
+] 1 define-transform
+
+GENERIC: (bitfield-quot) ( spec -- quot )
+
+M: integer (bitfield-quot) ( spec -- quot )
+    [ swapd shift bitor ] curry ;
+
+M: pair (bitfield-quot) ( spec -- quot )
+    first2 over word? [ >r swapd execute r> ] [ ] ?
+    [ shift bitor ] append 2curry ;
+
+: bitfield-quot ( spec -- quot )
+    [ (bitfield-quot) ] map [ 0 ] add* concat ;
+
+\ bitfield [ bitfield-quot ] 1 define-transform
+
+! Tuple operations
+: [get-slots] ( slots -- quot )
+    [ [ 1quotation , \ keep , ] each \ drop , ] [ ] make ;
+
+\ get-slots [ [get-slots] ] 1 define-transform
+
+\ set-slots [ <reversed> [get-slots] ] 1 define-transform
+
+\ construct-boa [
+    [ dup literalize , tuple-size , \ <tuple-boa> , ] [ ] make
+] 1 define-transform
diff --git a/core/init/authors.txt b/core/init/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/init/init-docs.factor b/core/init/init-docs.factor
new file mode 100644 (file)
index 0000000..168a0d7
--- /dev/null
@@ -0,0 +1,41 @@
+USING: help.markup help.syntax quotations strings ;
+IN: init
+
+HELP: boot
+{ $description "Called on startup as part of the boot quotation  to initialize the runtime and prepare it for running user code." } ;
+
+{ boot boot-quot set-boot-quot } related-words
+
+HELP: boot-quot
+{ $values { "quot" quotation } }
+{ $description "Outputs the initial quotation called by the VM on startup." } ;
+
+HELP: set-boot-quot
+{ $values { "quot" quotation } }
+{ $description "Sets the initial quotation called by the VM on startup. This quotation must begin with a call to " { $link boot } ". The image must be saved for changes to the boot quotation to take effect." }
+{ $notes "The " { $link "tools.deploy" } " tool uses this word." } ;
+
+HELP: init-hooks
+{ $var-description "An association list mapping string identifiers to quotations to be run on startup." } ;
+
+HELP: do-init-hooks
+{ $description "Calls all initialization hook quotations." } ;
+
+HELP: add-init-hook
+{ $values { "quot" quotation } { "name" string } }
+{ $description "Registers a startup hook. The hook will always run when Factor is started. If the hook was not already defined, this word also calls it immediately." } ;
+
+{ init-hooks do-init-hooks add-init-hook } related-words
+
+ARTICLE: "init" "Initialization and startup"
+"When Factor starts, the first thing it does is call a word:"
+{ $subsection boot }
+"Next, initialization hooks are called:"
+{ $subsection do-init-hooks }
+"Initialization hooks can be defined:"
+{ $subsection add-init-hook }
+"The boot quotation can be changed:"
+{ $subsection boot-quot }
+{ $subsection set-boot-quot } ;
+
+ABOUT: "init"
diff --git a/core/init/init.factor b/core/init/init.factor
new file mode 100644 (file)
index 0000000..770655d
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: continuations continuations.private kernel
+kernel.private sequences assocs namespaces namespaces.private ;
+IN: init
+
+SYMBOL: init-hooks
+
+init-hooks global [ drop V{ } clone ] cache drop
+
+: do-init-hooks ( -- )
+    init-hooks get [ nip call ] assoc-each ;
+
+: add-init-hook ( quot name -- )
+    dup init-hooks get at [ over call ] unless
+    init-hooks get set-at ;
+
+: boot ( -- ) init-namespaces init-error-handler ;
+
+: boot-quot ( -- quot ) 20 getenv ;
+
+: set-boot-quot ( quot -- ) 20 setenv ;
diff --git a/core/init/summary.txt b/core/init/summary.txt
new file mode 100644 (file)
index 0000000..1b28156
--- /dev/null
@@ -0,0 +1 @@
+Startup and initialization hooks
diff --git a/core/inspector/authors.txt b/core/inspector/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/inspector/inspector-docs.factor b/core/inspector/inspector-docs.factor
new file mode 100644 (file)
index 0000000..84ae344
--- /dev/null
@@ -0,0 +1,111 @@
+USING: help.markup help.syntax kernel classes io io.styles ;
+IN: inspector
+
+ARTICLE: "inspector" "The inspector"
+"The inspector displays a tabular view of an object and adds navigation and editing features. Inspector words are found in the " { $vocab-link "inspector" } " vocabulary."
+$nl
+"Starting the inspector:"
+{ $subsection inspect }
+"The inspector supports a number of commands which operate on the most recently inspected object:"
+{ $subsection &push }
+{ $subsection &back }
+{ $subsection &at }
+{ $subsection &put }
+{ $subsection &add }
+{ $subsection &rename }
+{ $subsection &delete }
+"A variable holding the current object:"
+{ $subsection me }
+"A variable holding inspector history:"
+{ $subsection inspector-stack }
+"A customization hook:"
+{ $subsection inspector-hook }
+"A description of an object can be printed without starting the inspector:"
+{ $subsection describe }
+{ $subsection describe* }
+"A word for getting very brief descriptions of words and general objects:"
+{ $subsection summary } ;
+
+ABOUT: "inspector"
+
+HELP: value-editor
+{ $values { "path" "a sequence of keys" } }
+{ $description "Prettyprints the value at a path, and if the output stream supports it, a graphical gadget for editing the object." }
+{ $notes "To learn about paths, see " { $link "mirrors" } "." } ;
+
+{ presented-path presented-printer value-editor } related-words
+
+HELP: describe
+{ $values { "obj" object } }
+{ $description "Print a tabular overview of the object."
+$nl
+"For sequences and hashtables, this outputs the entries of the collection. For all other object types, slot names and values are shown." }
+{ $examples { $code "global describe" } } ;
+
+HELP: describe*
+{ $values { "obj" object } { "flags" "an assoc" } }
+{ $description "Print a tabular overview of the object."
+$nl
+"The assoc can contain any of the following keys:"
+{ $list
+    { { $link +number-rows+ } " - if set to a true value, every row of output will begin with a row number." }
+    { { $link +editable+ } " - if set to a true value, keys and values will be editable in place, if the output stream supports it." }
+    { { $link +sequence+ } " - if set to a true value, keys will not be printed, only values." }
+} }
+{ $notes "This word is a factor of " { $link describe } " and " { $link inspect } "." } ;
+
+HELP: summary
+{ $values { "object" object } { "string" "a string" } }
+{ $contract "Outputs a brief description of the object." } ;
+
+HELP: inspector-stack
+{ $var-description "If the inspector is running, this variable holds previously-inspected objects." } ;
+
+HELP: &push
+{ $values { "obj" object } } 
+{ $description "If the inspector is running, outputs the object currently being inspected." } ;
+
+HELP: inspector
+{ $values { "obj" object } }
+{ $description "Starts a new inspector and prints a brief help message. If an inspector is already running, this starts a nested inspector. An alternative word that reuses the current inspector instance is " { $link inspect } "." } ;
+
+HELP: inspect
+{ $values { "obj" object } }
+{ $description "If an inspector is already running, displays the slots of the object in the current inspector. If an inspector is not running, starts a new inspector." } ;
+
+HELP: &at
+{ $values { "n" "a non-negative integer" } }
+{ $description "Inspects the " { $snippet "n" } "th slot of the current object. Use " { $link &back } " to return." } ;
+
+HELP: &put
+{ $values { "value" object } { "n" "a non-negative integer" } }
+{ $description "Sets the " { $snippet "n" } "th slot of the current object to the given value." }
+{ $errors "Throws an error if the object does not support this operation." } ;
+
+HELP: &add
+{ $values { "value" object } { "key" object } }
+{ $description "Adds a key/value pair to the current object." }
+{ $errors "Throws an error if the object does not support this operation." } ;
+
+HELP: &delete
+{ $values { "n" "a non-negative integer" } }
+{ $description "Deletes the " { $snippet "n" } "th slot from the current object." }
+{ $errors "Throws an error if the object does not support this operation." } ;
+
+HELP: &rename
+{ $values { "key" object } { "n" "a non-negative integer" } }
+{ $description "Changes the key of the " { $snippet "n" } "th slot of the current object." }
+{ $errors "Throws an error if the object does not support this operation." } ;
+
+HELP: &back
+{ $description "Returns to the previously-inspected object." } ;
+
+{ &back &at &put &add &delete } related-words
+
+HELP: me
+{ $var-description "The currently inspected object." } ;
+
+HELP: inspector-hook
+{ $var-description "A quotation with stack effect " { $snippet "( obj -- )" } ", called by the inspector to display an overview of an object."
+$nl
+"The default implementation calls " { $link describe } " which outputs on the " { $link stdio } " stream, but the graphical listener sets this variable so that calling " { $link inspect } " in the UI opens the graphical inspector." } ;
diff --git a/core/inspector/inspector-tests.factor b/core/inspector/inspector-tests.factor
new file mode 100644 (file)
index 0000000..4cb638c
--- /dev/null
@@ -0,0 +1,11 @@
+USING: kernel tools.test math namespaces prettyprint
+sequences inspector io.streams.string ;
+IN: temporary
+
+[ 1 2 3 ] describe
+f describe
+\ + describe
+H{ } describe
+H{ } describe
+
+[ "fixnum instance\n" ] [ [ 3 describe ] string-out ] unit-test
diff --git a/core/inspector/inspector.factor b/core/inspector/inspector.factor
new file mode 100644 (file)
index 0000000..868cffb
--- /dev/null
@@ -0,0 +1,152 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic hashtables io kernel assocs math
+namespaces prettyprint sequences strings io.styles vectors words
+quotations mirrors splitting math.parser classes vocabs refs ;
+IN: inspector
+
+GENERIC: summary ( object -- string )
+
+: object-summary ( object -- string )
+    class word-name " instance" append ;
+
+M: object summary object-summary ;
+
+M: input summary
+    [
+        "Input: " %
+        input-string "\n" split1 swap %
+        "..." "" ? %
+    ] "" make ;
+
+M: word summary synopsis ;
+
+M: sequence summary
+    [
+        dup class word-name %
+        " with " %
+        length #
+        " elements" %
+    ] "" make ;
+
+M: assoc summary
+    [
+        dup class word-name %
+        " with " %
+        assoc-size #
+        " entries" %
+    ] "" make ;
+
+! Override sequence => integer instance
+M: f summary object-summary ;
+
+M: integer summary object-summary ;
+
+: value-editor ( path -- )
+    [
+        [ pprint-short ] presented-printer set
+        dup presented-path set
+    ] H{ } make-assoc
+    [ get-ref pprint-short ] with-nesting ;
+
+SYMBOL: +sequence+
+SYMBOL: +number-rows+
+SYMBOL: +editable+
+
+: write-slot-editor ( path -- )
+    [
+        +editable+ get [
+            value-editor
+        ] [
+            get-ref pprint-short
+        ] if
+    ] with-cell ;
+
+: write-key ( mirror key -- )
+    +sequence+ get
+    [ 2drop ] [ <key-ref> write-slot-editor ] if ;
+
+: write-value ( mirror key -- )
+    <value-ref> write-slot-editor ;
+
+: describe-row ( obj key n -- )
+    [
+        +number-rows+ get [ pprint-cell ] [ drop ] if
+        2dup write-key write-value
+    ] with-row ;
+
+: summary. ( obj -- ) [ summary ] keep write-object nl ;
+
+: describe* ( obj flags -- )
+    clone [
+        dup summary.
+        make-mirror dup keys dup empty? [
+            2drop
+        ] [
+            dup enum? [ +sequence+ on ] when
+            standard-table-style [
+                dup length
+                rot [ -rot describe-row ] curry 2each
+            ] tabular-output
+        ] if
+    ] bind ;
+
+: describe ( obj -- ) H{ } describe* ;
+
+SYMBOL: inspector-hook
+
+[ H{ { +number-rows+ t } } describe* ] inspector-hook set-global
+
+SYMBOL: inspector-stack
+
+SYMBOL: me
+
+: reinspect ( obj -- )
+    dup me set
+    dup make-mirror dup mirror set keys \ keys set
+    inspector-hook get call ;
+
+: (inspect) ( obj -- )
+    dup inspector-stack get push reinspect ;
+
+: key@ ( n -- key ) \ keys get nth ;
+
+: &push ( -- obj ) me get ;
+
+: &at ( n -- ) key@ mirror get at (inspect) ;
+
+: &back ( -- )
+    inspector-stack get
+    dup length 1 <= [ drop ] [ dup pop* peek reinspect ] if ;
+
+: &add ( value key -- ) mirror get set-at &push reinspect ;
+
+: &put ( value n -- ) key@ &add ;
+
+: &delete ( n -- ) key@ mirror get delete-at &push reinspect ;
+
+: &rename ( key n -- ) key@ mirror get rename-at &push reinspect ;
+
+: &help ( -- )
+    #! A tribute to Slate:
+    "You are in a twisty little maze of objects, all alike." print
+    nl
+    "'n' is a slot number in the following:" print
+    nl
+    "&back -- return to previous object" print
+    "&push ( -- obj ) push this object" print
+    "&at ( n -- ) inspect nth slot" print
+    "&put ( value n -- ) change nth slot" print
+    "&add ( value key -- ) add new slot" print
+    "&delete ( n -- ) remove a slot" print
+    "&rename ( key n -- ) change a slot's key" print
+    "&help -- display this message" print
+    nl ;
+
+: inspector ( obj -- )
+    &help
+    V{ } clone inspector-stack set
+    (inspect) ;
+
+: inspect ( obj -- )
+    inspector-stack get [ (inspect) ] [ inspector ] if ;
diff --git a/core/inspector/summary.txt b/core/inspector/summary.txt
new file mode 100644 (file)
index 0000000..814642a
--- /dev/null
@@ -0,0 +1 @@
+Terminal-based object viewer and editor
diff --git a/core/inspector/tags.txt b/core/inspector/tags.txt
new file mode 100644 (file)
index 0000000..8ba7ae8
--- /dev/null
@@ -0,0 +1,2 @@
+tools
+reflection
diff --git a/core/io/authors.txt b/core/io/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/backend/authors.txt b/core/io/backend/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/backend/backend-docs.factor b/core/io/backend/backend-docs.factor
new file mode 100644 (file)
index 0000000..8bf761e
--- /dev/null
@@ -0,0 +1,12 @@
+USING: help.markup help.syntax io io.backend strings
+byte-arrays ;
+
+HELP: io-multiplex
+{ $values { "ms" "a non-negative integer" } }
+{ $contract "Waits up to " { $snippet "ms" } " milliseconds for pending I/O requests to complete." } ;
+
+HELP: init-io
+{ $contract "Initializes the I/O system. Called on startup." } ;
+
+HELP: init-stdio
+{ $contract "Initializes the global " { $link stdio } " stream.  Called on startup." } ;
diff --git a/core/io/backend/backend-tests.factor b/core/io/backend/backend-tests.factor
new file mode 100644 (file)
index 0000000..e295cc3
--- /dev/null
@@ -0,0 +1,4 @@
+IN: temporary\r
+USING: tools.test io.backend kernel ;\r
+\r
+[ ] [ "a" normalize-pathname drop ] unit-test\r
diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor
new file mode 100644 (file)
index 0000000..a7736ae
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: init kernel system ;
+IN: io.backend
+
+SYMBOL: io-backend
+
+HOOK: init-io io-backend ( -- )
+
+HOOK: init-stdio io-backend ( -- )
+
+HOOK: io-multiplex io-backend ( ms -- )
+
+HOOK: normalize-directory io-backend ( str -- newstr )
+
+M: object normalize-directory ;
+
+HOOK: normalize-pathname io-backend ( str -- newstr )
+
+M: object normalize-pathname ;
+
+[ init-io embedded? [ init-stdio ] unless ]
+"io.backend" add-init-hook
diff --git a/core/io/backend/summary.txt b/core/io/backend/summary.txt
new file mode 100644 (file)
index 0000000..8362dfa
--- /dev/null
@@ -0,0 +1 @@
+Hooks for native I/O implementation
diff --git a/core/io/binary.factor b/core/io/binary.factor
deleted file mode 100644 (file)
index e279214..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-! Copyright (C) 2003, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: kernel math sequences strings ;
-
-: be> ( seq -- x ) 0 [ >r 8 shift r> bitor ] reduce ;
-: le> ( seq -- x ) <reversed> be> ;
-
-: nth-byte ( x n -- b ) -8 * shift HEX: ff bitand ;
-
-: >le ( x n -- str ) [ nth-byte ] map-with >string ;
-: >be ( x n -- str ) >le reverse ;
diff --git a/core/io/binary.facts b/core/io/binary.facts
deleted file mode 100644 (file)
index 571df49..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-USING: help io ;
-
-HELP: be>
-{ $values { "seq" "a sequence of bytes" } { "x" "a non-negative integer" } }
-{ $description "Converts a sequence of bytes in big endian order into an unsigned integer." } ;
-
-HELP: le>
-{ $values { "seq" "a sequence of bytes" } { "x" "a non-negative integer" } }
-{ $description "Converts a sequence of bytes in little endian order into an unsigned integer." } ;
-
-HELP: nth-byte
-{ $values { "x" "an integer" } { "n" "a non-negative integer" } { "b" "a byte" } }
-{ $description "Outputs the " { $snippet "n" } "th least significant byte of the sign-extended 2's complement representation of " { $snippet "x" } "." } ;
-
-HELP: >le
-{ $values { "x" "an integer" } { "n" "a non-negative integer" } { "str" "a string" } }
-{ $description "Converts an integer " { $snippet "x" } " into a string of " { $snippet "n" } " bytes in little endian order. Truncation will occur if the integer is not in the range " { $snippet "[-2^(8n),2^(8n))" } "." } ;
-
-HELP: >be
-{ $values { "x" "an integer" } { "n" "a non-negative integer" } { "str" "a string" } }
-{ $description "Converts an integer " { $snippet "x" } " into a string of " { $snippet "n" } " bytes in big endian order. Truncation will occur if the integer is not in the range " { $snippet "[-2^(8n),2^(8n))" } "." } ;
diff --git a/core/io/binary/authors.txt b/core/io/binary/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/binary/binary-docs.factor b/core/io/binary/binary-docs.factor
new file mode 100644 (file)
index 0000000..edf6549
--- /dev/null
@@ -0,0 +1,66 @@
+USING: help.markup help.syntax io math ;
+IN: io.binary
+
+ARTICLE: "stream-binary" "Working with binary data"
+"The core stream words read and write strings. Packed binary integers can be read and written by converting to and from sequences of bytes. Floating point numbers can be read and written by converting them into a their bitwise integer representation (" { $link "floats" } ")."
+$nl
+"There are two ways to order the bytes making up an integer; " { $emphasis "little endian" } " byte order outputs the least significant byte first, and the most significant byte last, whereas " { $emphasis "big endian" } " is the other way around."
+$nl
+"Consider the hexadecimal integer "{ $snippet "HEX: cafebabe" } ". Big endian byte order yields the following sequence of bytes:"
+{ $table
+    { "Byte:" "1" "2" "3" "4" }
+    { "Value:" { $snippet "be" } { $snippet "ba" } { $snippet "fe" } { $snippet "ca" } }
+}
+"Compare this with little endian byte order:"
+{ $table
+    { "Byte:" "1" "2" "3" "4" }
+    { "Value:" { $snippet "ca" } { $snippet "fe" } { $snippet "ba" } { $snippet "be" } }
+}
+"Two words convert a sequence of bytes into an integer:"
+{ $subsection be> }
+{ $subsection le> }
+"Two words convert an integer into a sequence of bytes:"
+{ $subsection >be }
+{ $subsection >le }
+"Words for taking larger integers apart into smaller integers:"
+{ $subsection d>w/w }
+{ $subsection w>h/h }
+{ $subsection h>b/b } ;
+
+ABOUT: "stream-binary"
+
+HELP: be>
+{ $values { "seq" "a sequence of bytes" } { "x" "a non-negative integer" } }
+{ $description "Converts a sequence of bytes in big endian order into an unsigned integer." } ;
+
+HELP: le>
+{ $values { "seq" "a sequence of bytes" } { "x" "a non-negative integer" } }
+{ $description "Converts a sequence of bytes in little endian order into an unsigned integer." } ;
+
+HELP: nth-byte
+{ $values { "x" integer } { "n" "a non-negative integer" } { "b" "a byte" } }
+{ $description "Outputs the " { $snippet "n" } "th least significant byte of the sign-extended 2's complement representation of " { $snippet "x" } "." } ;
+
+HELP: >le
+{ $values { "x" integer } { "n" "a non-negative integer" } { "str" "a string" } }
+{ $description "Converts an integer " { $snippet "x" } " into a string of " { $snippet "n" } " bytes in little endian order. Truncation will occur if the integer is not in the range " { $snippet "[-2^(8n),2^(8n))" } "." } ;
+
+HELP: >be
+{ $values { "x" integer } { "n" "a non-negative integer" } { "str" "a string" } }
+{ $description "Converts an integer " { $snippet "x" } " into a string of " { $snippet "n" } " bytes in big endian order. Truncation will occur if the integer is not in the range " { $snippet "[-2^(8n),2^(8n))" } "." } ;
+
+HELP: mask-byte
+{ $values { "x" integer } { "y" "a non-negative integer" } }
+{ $description "Masks off the least significant 8 bits of an integer." } ;
+
+HELP: d>w/w
+{ $values { "d" "a 64-bit integer" } { "w1" "a 32-bit integer" } { "w2" "a 32-bit integer" } }
+{ $description "Outputs two integers, the least followed by the most significant 32 bits of the input." } ;
+
+HELP: w>h/h
+{ $values { "w" "a 32-bit integer" } { "h1" "a 16-bit integer" } { "h2" "a 16-bit integer" } }
+{ $description "Outputs two integers, the least followed by the most significant 16 bits of the input." } ;
+
+HELP: h>b/b
+{ $values { "h" "a 16-bit integer" } { "b1" "an 8-bit integer" } { "b2" "an 8-bit integer" } }
+{ $description "Outputs two integers, the least followed by the most significant 8 bits of the input." } ;
diff --git a/core/io/binary/binary-tests.factor b/core/io/binary/binary-tests.factor
new file mode 100644 (file)
index 0000000..5d80443
--- /dev/null
@@ -0,0 +1,8 @@
+USING: io.binary tools.test ;
+IN: temporary
+
+[ "\0\0\u0004\u00d2" ] [ 1234 4 >be ] unit-test
+[ "\u00d2\u0004\0\0" ] [ 1234 4 >le ] unit-test
+
+[ 1234 ] [ 1234 4 >be be> ] unit-test
+[ 1234 ] [ 1234 4 >le le> ] unit-test
diff --git a/core/io/binary/binary.factor b/core/io/binary/binary.factor
new file mode 100644 (file)
index 0000000..538f517
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math sequences ;
+IN: io.binary
+
+: le> ( seq -- x ) B{ } like byte-array>bignum ;
+: be> ( seq -- x ) <reversed> le> ;
+
+: mask-byte ( x -- y ) HEX: ff bitand ; inline
+
+: nth-byte ( x n -- b ) -8 * shift mask-byte ; inline
+
+: >le ( x n -- str ) [ nth-byte ] curry* "" map-as ;
+: >be ( x n -- str ) >le dup reverse-here ;
+
+: d>w/w ( d -- w1 w2 )
+    dup HEX: ffffffff bitand
+    swap -32 shift HEX: ffffffff bitand ;
+
+: w>h/h ( w -- h1 h2 )
+    dup HEX: ffff bitand
+    swap -16 shift HEX: ffff bitand ;
+
+: h>b/b ( h -- b1 b2 )
+    dup mask-byte
+    swap -8 shift mask-byte ;
diff --git a/core/io/binary/summary.txt b/core/io/binary/summary.txt
new file mode 100644 (file)
index 0000000..14d76d4
--- /dev/null
@@ -0,0 +1 @@
+Utilities for reading and writing little and big endian data
diff --git a/core/io/buffer/buffer.factor b/core/io/buffer/buffer.factor
deleted file mode 100644 (file)
index 5516d58..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-! Copyright (C) 2004, 2005 Mackenzie Straight.
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io-internals
-USING: alien errors kernel kernel-internals libc math sequences
-strings ;
-
-TUPLE: buffer size ptr fill pos ;
-
-C: buffer ( n -- buffer )
-    2dup set-buffer-size
-    [ >r malloc check-ptr alien-address r> set-buffer-ptr ] keep
-    0 over set-buffer-fill
-    0 over set-buffer-pos ;
-
-: buffer-free ( buffer -- )
-    dup buffer-ptr <alien> free  0 swap set-buffer-ptr ;
-
-: buffer-contents ( buffer -- string )
-    dup buffer-ptr over buffer-pos +
-    over buffer-fill rot buffer-pos - memory>string ;
-
-: buffer-reset ( n buffer -- )
-    [ set-buffer-fill ] keep 0 swap set-buffer-pos ;
-
-: buffer-consume ( n buffer -- )
-    [ buffer-pos + ] keep
-    [ buffer-fill min ] keep
-    [ set-buffer-pos ] keep
-    dup buffer-pos over buffer-fill >= [
-        0 over set-buffer-pos
-        0 over set-buffer-fill
-    ] when drop ;
-
-: buffer@ ( buffer -- n ) dup buffer-ptr swap buffer-pos + ;
-
-: buffer-end ( buffer -- n ) dup buffer-ptr swap buffer-fill + ;
-
-: buffer-first-n ( n buffer -- string )
-    [ dup buffer-fill swap buffer-pos - min ] keep
-    buffer@ swap memory>string ;
-
-: buffer> ( n buffer -- string )
-    [ buffer-first-n ] 2keep buffer-consume ;
-
-: buffer>> ( buffer -- string )
-    [ buffer-contents ] keep 0 swap buffer-reset ;
-
-: buffer-length ( buffer -- n )
-    dup buffer-fill swap buffer-pos - ;
-
-: buffer-capacity ( buffer -- n )
-    dup buffer-size swap buffer-fill - ;
-
-: buffer-empty? ( buffer -- ? ) buffer-fill zero? ;
-
-: extend-buffer ( n buffer -- )
-    2dup buffer-ptr <alien> swap realloc check-ptr alien-address
-    over set-buffer-ptr set-buffer-size ;
-
-: check-overflow ( n buffer -- )
-    2dup buffer-capacity > [ extend-buffer ] [ 2drop ] if ;
-
-: >buffer ( string buffer -- )
-    over length over check-overflow
-    [ buffer-end string>memory ] 2keep
-    [ buffer-fill swap length + ] keep set-buffer-fill ;
-
-: ch>buffer ( ch buffer -- )
-    1 over check-overflow
-    [ buffer-end f swap set-alien-unsigned-1 ] keep
-    [ buffer-fill 1+ ] keep set-buffer-fill ;
-
-: buffer-bound ( buffer -- n )
-    dup buffer-ptr swap buffer-size + ;
-
-: n>buffer ( n buffer -- )
-    [ buffer-fill + ] keep 
-    [ buffer-bound > [ "Buffer overflow" throw ] when ] 2keep
-    set-buffer-fill ;
-
-: buffer-peek ( buffer -- ch )
-    buffer@ f swap alien-unsigned-1 ;
-
-: buffer-pop ( buffer -- ch )
-    [ buffer-peek  1 ] keep buffer-consume ;
diff --git a/core/io/buffer/buffer.facts b/core/io/buffer/buffer.facts
deleted file mode 100644 (file)
index b0131c3..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-USING: help io-internals ;
-
-HELP: buffer
-{ $class-description "The class of I/O buffers, which are allocated in the system malloc arena, and thus have a fixed address, unlike garbage-collected heap objects which are moved around. Buffers must be de-allocated manually."
-$terpri
-"Buffers have two internal pointers:"
-{ $list
-    { "the fill pointer -- a write index where new data is added; accessor: " { $link buffer-fill } }
-    { "the position -- a read index where data is consumed; accessor: " { $link buffer-pos } }
-} } ;
-
-HELP: <buffer>
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } }
-{ $description "Creates a buffer with an initial capacity of " { $snippet "n" } " bytes." } ;
-
-HELP: buffer-free
-{ $values { "buffer" "a buffer" } }
-{ $description "De-allocates a buffer's underlying storage. The buffer may not be used after being freed." }
-{ $warning "You " { $emphasis "must" } " free a buffer using this word, before letting the GC collect the buffer tuple instance." } ;
-
-HELP: buffer-contents
-{ $values { "buffer" "a buffer" } { "string" "a string" } }
-{ $description "Collects the entire contents of the buffer into a string." } ;
-
-HELP: buffer-reset
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } }
-{ $description "Resets the fill pointer to 0 and the position to " { $snippet "count" } "." } ;
-
-HELP: buffer-consume
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } }
-{ $description "Moves the position forward by " { $snippet "n" } " bytes. If it exceeds the fill pointer, both are reset to 0." } ;
-
-HELP: buffer@
-{ $values { "buffer" "a buffer" } { "n" "a non-negative integer" } }
-{ $description "Outputs the memory address of the current buffer position." } ;
-
-HELP: buffer-end
-{ $values { "buffer" "a buffer" } { "n" "a non-negative integer" } }
-{ $description "Outputs the memory address of the current fill-pointer." } ;
-
-HELP: buffer-first-n
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } }
-{ $description "Outputs a string of the first " { $snippet "n" } " characters at the buffer's current position. If there are less than " { $snippet "n" } " characters available, the output is truncated." }
-{ $see-also buffer> } ;
-
-HELP: buffer>
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } { "string" "a string" } }
-{ $description "Collects a string of " { $snippet "n" } " characters starting from the buffer's current position, and advances the position accordingly. If there are less than " { $snippet "n" } " characters available, the output is truncated." } ;
-
-HELP: buffer>>
-{ $values { "buffer" "a buffer" } { "string" "a string" } }
-{ $description "Collects the contents of the buffer into a string, and resets the position and fill pointer to 0." } ;
-
-HELP: buffer-length
-{ $values { "buffer" "a buffer" } { "n" "a non-negative integer" } }
-{ $description "Outputs the number of unconsumed bytes in the buffer." } ;
-
-HELP: buffer-capacity
-{ $values { "buffer" "a buffer" } { "n" "a non-negative integer" } }
-{ $description "Outputs the buffer's maximum capacity before growing." } ;
-
-HELP: buffer-empty?
-{ $values { "buffer" "a buffer" } { "?" "a boolean" } }
-{ $description "Tests if the buffer contains no more data to be read." } ;
-
-HELP: extend-buffer
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } }
-{ $description "Grows a buffer to fit " { $snippet "n" } " bytes of data." } ;
-
-HELP: check-overflow
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } }
-{ $description "Grows the buffer, if possible, so it can accomodate " { $snippet "n" } " bytes." }
-{ $warning "I/O system implementations should call this word or one of the other words that calls this word, at the beginning of an I/O transaction, when the buffer is empty. Buffers cannot be resized if they contain data; one of the requirements of a buffer is to remain fixed in memory while I/O operations are in progress." }
-{ $errors "Throws an error if the buffer contains unread data, and the new data does not fit." } ;
-
-HELP: >buffer
-{ $values { "string" "a string" } { "buffer" "a buffer" } }
-{ $description "Copies a string to the buffer's fill pointer, and advances it accordingly." } ;
-
-HELP: ch>buffer
-{ $values { "ch" "a character" } { "buffer" "a buffer" } }
-{ $description "Appends a single byte to a buffer." } ;
-
-HELP: buffer-bound
-{ $values { "buffer" "a buffer" } { "n" "a non-negative integer" } }
-{ $description "Outputs the address pointing to the end of the buffer." } ;
-
-HELP: n>buffer
-{ $values { "n" "a non-negative integer" } { "buffer" "a buffer" } }
-{ $description "Advances the fill pointer by " { $snippet "n" } " bytes." }
-{ $errors "Throws an error if the buffer does not contain " { $snippet "n" } " bytes of data." } ;
-
-HELP: buffer-peek
-{ $values { "buffer" "a buffer" } { "ch" "a character" } }
-{ $description "Outputs the byte at the buffer position." }
-{ $see-also buffer-pop } ;
-
-HELP: buffer-pop
-{ $values { "buffer" "a buffer" } { "ch" "a character" } }
-{ $description "Outputs the byte at the buffer position and advances the position." } ;
diff --git a/core/io/buffer/load.factor b/core/io/buffer/load.factor
deleted file mode 100644 (file)
index e98f384..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-PROVIDE: core/io/buffer
-{ +files+ {
-    "buffer.factor"
-    "buffer.facts"
-} }
-{ +tests+ {
-    "test/buffer.factor"
-} } ;
diff --git a/core/io/buffer/test/buffer.factor b/core/io/buffer/test/buffer.factor
deleted file mode 100644 (file)
index ec38c2d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-IN: temporary
-USING: alien io-internals kernel kernel-internals libc
-sequences test ;
-
-: buffer-set ( string buffer -- )
-    2dup buffer-ptr string>memory
-    >r length r> buffer-reset ;
-
-: string>buffer ( string -- buffer )
-    dup length <buffer> tuck buffer-set ;
-
-[ "" 65536 ] [
-    65536 <buffer>
-    dup buffer-contents
-    over buffer-capacity
-    rot buffer-free
-] unit-test
-
-[ "hello world" "" ] [
-    "hello world" string>buffer
-    dup buffer-contents
-    0 pick buffer-reset
-    over buffer-contents
-    rot buffer-free
-] unit-test
-
-[ "hello" ] [
-    "hello world" string>buffer
-    5 over buffer-first-n swap buffer-free
-] unit-test
-
-[ 11 ] [
-    "hello world" string>buffer
-    [ buffer-length ] keep buffer-free
-] unit-test
-
-[ "hello world" ] [
-    "hello" 1024 <buffer> [ buffer-set ] keep
-    " world" over >buffer
-    dup buffer-contents swap buffer-free
-] unit-test
-
-[ CHAR: e ] [
-    "hello" string>buffer
-    1 over buffer-consume [ buffer-pop ] keep buffer-free
-] unit-test
diff --git a/core/io/buffers/authors.txt b/core/io/buffers/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/buffers/buffers-docs.factor b/core/io/buffers/buffers-docs.factor
new file mode 100644 (file)
index 0000000..def3e47
--- /dev/null
@@ -0,0 +1,127 @@
+USING: help.markup help.syntax strings alien ;
+IN: io.buffers
+
+ARTICLE: "buffers" "Locked I/O buffers"
+"I/O buffers are first-in-first-out queues of characters. Their key feature is that they are backed by manually allocated storage that does not get moved by the garbage collector. They are used to implement native I/O backends."
+$nl
+"Buffer words are found in the " { $vocab-link "buffers" } " vocabulary."
+{ $subsection buffer }
+{ $subsection <buffer> }
+"Buffers must be manually deallocated:"
+{ $subsection buffer-free }
+"Buffer operations:"
+{ $subsection buffer-reset }
+{ $subsection buffer-length }
+{ $subsection buffer-empty? }
+{ $subsection buffer-capacity }
+{ $subsection buffer@ }
+"Reading from the buffer:"
+{ $subsection buffer-peek }
+{ $subsection buffer-pop }
+{ $subsection buffer> }
+{ $subsection buffer>> }
+{ $subsection buffer-until }
+"Writing to the buffer:"
+{ $subsection extend-buffer }
+{ $subsection ch>buffer }
+{ $subsection >buffer }
+{ $subsection n>buffer } ;
+
+ABOUT: "buffers"
+
+HELP: buffer
+{ $class-description "The class of I/O buffers, which resemble FIFO queues, but are optimize for holding bytes, are have underlying storage allocated at a fixed address. Buffers must be de-allocated manually."
+$nl
+"Buffers have two internal pointers:"
+{ $list
+    { { $link buffer-fill } " - the fill pointer, a write index where new data is added" }
+    { { $link buffer-pos } " - the position, a read index where data is consumed" }
+} } ;
+
+HELP: <buffer>
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } }
+{ $description "Creates a buffer with an initial capacity of " { $snippet "n" } " bytes." } ;
+
+HELP: buffer-free
+{ $values { "buffer" buffer } }
+{ $description "De-allocates a buffer's underlying storage. The buffer may not be used after being freed." }
+{ $warning "You " { $emphasis "must" } " free a buffer using this word, before letting the GC collect the buffer tuple instance." } ;
+
+HELP: (buffer>>)
+{ $values { "buffer" buffer } { "string" "a string" } }
+{ $description "Collects the entire contents of the buffer into a string." } ;
+
+HELP: buffer-reset
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } }
+{ $description "Resets the fill pointer to 0 and the position to " { $snippet "count" } "." } ;
+
+HELP: buffer-consume
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } }
+{ $description "Moves the position forward by " { $snippet "n" } " bytes. If it exceeds the fill pointer, both are reset to 0." } ;
+
+HELP: buffer@
+{ $values { "buffer" buffer } { "alien" alien } }
+{ $description "Outputs the memory address of the current buffer position." } ;
+
+HELP: buffer-end
+{ $values { "buffer" buffer } { "alien" alien } }
+{ $description "Outputs the memory address of the current fill-pointer." } ;
+
+HELP: (buffer>)
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } { "string" string } }
+{ $description "Outputs a string of the first " { $snippet "n" } " characters at the buffer's current position. If there are less than " { $snippet "n" } " characters available, the output is truncated." } ;
+
+HELP: buffer>
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } { "string" "a string" } }
+{ $description "Collects a string of " { $snippet "n" } " characters starting from the buffer's current position, and advances the position accordingly. If there are less than " { $snippet "n" } " characters available, the output is truncated." } ;
+
+HELP: buffer>>
+{ $values { "buffer" buffer } { "string" "a string" } }
+{ $description "Collects the contents of the buffer into a string, and resets the position and fill pointer to 0." } ;
+
+HELP: buffer-length
+{ $values { "buffer" buffer } { "n" "a non-negative integer" } }
+{ $description "Outputs the number of unconsumed bytes in the buffer." } ;
+
+HELP: buffer-capacity
+{ $values { "buffer" buffer } { "n" "a non-negative integer" } }
+{ $description "Outputs the buffer's maximum capacity before growing." } ;
+
+HELP: buffer-empty?
+{ $values { "buffer" buffer } { "?" "a boolean" } }
+{ $description "Tests if the buffer contains no more data to be read." } ;
+
+HELP: extend-buffer
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } }
+{ $description "Grows a buffer to fit " { $snippet "n" } " bytes of data." } ;
+
+HELP: check-overflow
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } }
+{ $description "Grows the buffer, if possible, so it can accomodate " { $snippet "n" } " bytes." }
+{ $warning "I/O system implementations should call this word or one of the other words that calls this word, at the beginning of an I/O transaction, when the buffer is empty. Buffers cannot be resized if they contain data; one of the requirements of a buffer is to remain fixed in memory while I/O operations are in progress." }
+{ $errors "Throws an error if the buffer contains unread data, and the new data does not fit." } ;
+
+HELP: >buffer
+{ $values { "string" "a string" } { "buffer" buffer } }
+{ $description "Copies a string to the buffer's fill pointer, and advances it accordingly." } ;
+
+HELP: ch>buffer
+{ $values { "ch" "a character" } { "buffer" buffer } }
+{ $description "Appends a single byte to a buffer." } ;
+
+HELP: n>buffer
+{ $values { "n" "a non-negative integer" } { "buffer" buffer } }
+{ $description "Advances the fill pointer by " { $snippet "n" } " bytes." }
+{ $errors "Throws an error if the buffer does not contain " { $snippet "n" } " bytes of data." } ;
+
+HELP: buffer-peek
+{ $values { "buffer" buffer } { "ch" "a character" } }
+{ $description "Outputs the byte at the buffer position." } ;
+
+HELP: buffer-pop
+{ $values { "buffer" buffer } { "ch" "a character" } }
+{ $description "Outputs the byte at the buffer position and advances the position." } ;
+
+HELP: buffer-until
+{ $values { "separators" string } { "buffer" buffer } { "string" string } { "separator" "a character or " { $link f } } }
+{ $description "Searches the buffer for a character appearing in " { $snippet "separators" } ", starting from " { $link buffer-pos } ". If a separator is found, all data up to but not including the separator is output, together with the separator itself; otherwise the remainder of the buffer's contents are output together with " { $link f } "." } ;
diff --git a/core/io/buffers/buffers-tests.factor b/core/io/buffers/buffers-tests.factor
new file mode 100644 (file)
index 0000000..b199182
--- /dev/null
@@ -0,0 +1,79 @@
+IN: temporary
+USING: alien io.buffers kernel kernel.private libc
+sequences tools.test namespaces ;
+
+: buffer-set ( string buffer -- )
+    2dup buffer-ptr string>memory
+    >r length r> buffer-reset ;
+
+: string>buffer ( string -- buffer )
+    dup length <buffer> tuck buffer-set ;
+
+[ "" 65536 ] [
+    65536 <buffer>
+    dup (buffer>>)
+    over buffer-capacity
+    rot buffer-free
+] unit-test
+
+[ "hello world" "" ] [
+    "hello world" string>buffer
+    dup (buffer>>)
+    0 pick buffer-reset
+    over (buffer>>)
+    rot buffer-free
+] unit-test
+
+[ "hello" ] [
+    "hello world" string>buffer
+    5 over buffer> swap buffer-free
+] unit-test
+
+[ 11 ] [
+    "hello world" string>buffer
+    [ buffer-length ] keep buffer-free
+] unit-test
+
+[ "hello world" ] [
+    "hello" 1024 <buffer> [ buffer-set ] keep
+    " world" over >buffer
+    dup (buffer>>) swap buffer-free
+] unit-test
+
+[ CHAR: e ] [
+    "hello" string>buffer
+    1 over buffer-consume [ buffer-pop ] keep buffer-free
+] unit-test
+
+[ "hello" CHAR: \r ] [
+    "hello\rworld" string>buffer
+    "\r" over buffer-until
+    rot buffer-free
+] unit-test
+
+[ "hello" CHAR: \r ] [
+    "hello\rworld" string>buffer
+    "\n\r" over buffer-until
+    rot buffer-free
+] unit-test
+
+[ "hello\rworld" f ] [
+    "hello\rworld" string>buffer
+    "X" over buffer-until
+    rot buffer-free
+] unit-test
+
+[ "hello" CHAR: \r "world" CHAR: \n ] [
+    "hello\rworld\n" string>buffer
+    [ "\r\n" swap buffer-until ] keep
+    [ "\r\n" swap buffer-until ] keep
+    buffer-free
+] unit-test
+
+"hello world" string>buffer "b" set
+[ "hello world" ] [ 1000 "b" get buffer> ] unit-test
+"b" get buffer-free
+
+100 <buffer> "b" set
+[ 1000 "b" get n>buffer ] unit-test-fails
+"b" get buffer-free
diff --git a/core/io/buffers/buffers.factor b/core/io/buffers/buffers.factor
new file mode 100644 (file)
index 0000000..7bca067
--- /dev/null
@@ -0,0 +1,96 @@
+! Copyright (C) 2004, 2005 Mackenzie Straight.
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.buffers
+USING: alien alien.syntax kernel kernel.private libc math
+sequences strings ;
+
+TUPLE: buffer size ptr fill pos ;
+
+: <buffer> ( n -- buffer )
+    dup malloc 0 0 buffer construct-boa ;
+
+: buffer-free ( buffer -- )
+    dup buffer-ptr free  f swap set-buffer-ptr ;
+
+: buffer-reset ( n buffer -- )
+    [ set-buffer-fill ] keep 0 swap set-buffer-pos ;
+
+: buffer-consume ( n buffer -- )
+    [ buffer-pos + ] keep
+    [ buffer-fill min ] keep
+    [ set-buffer-pos ] keep
+    dup buffer-pos over buffer-fill >= [
+        0 over set-buffer-pos
+        0 over set-buffer-fill
+    ] when drop ;
+
+: buffer@ ( buffer -- alien )
+    dup buffer-pos swap buffer-ptr <displaced-alien> ;
+
+: buffer-end ( buffer -- alien )
+    dup buffer-fill swap buffer-ptr <displaced-alien> ;
+
+: buffer-peek ( buffer -- ch )
+    buffer@ 0 alien-unsigned-1 ;
+
+: buffer-pop ( buffer -- ch )
+    dup buffer-peek 1 rot buffer-consume ;
+
+: (buffer>) ( n buffer -- string )
+    [ dup buffer-fill swap buffer-pos - min ] keep
+    buffer@ swap memory>string ;
+
+: buffer> ( n buffer -- string )
+    [ (buffer>) ] 2keep buffer-consume ;
+
+: (buffer>>) ( buffer -- string )
+    dup buffer-pos over buffer-ptr <displaced-alien>
+    over buffer-fill rot buffer-pos - memory>string ;
+
+: buffer>> ( buffer -- string )
+    dup (buffer>>) 0 rot buffer-reset ;
+
+: (buffer-until) ( start end alien separators -- n )
+    [ >r swap alien-unsigned-1 r> memq? ] 2curry find* drop ;
+
+: buffer-until ( separators buffer -- string separator )
+    tuck { buffer-pos buffer-fill buffer-ptr } get-slots roll
+    (buffer-until) [
+        over buffer-pos -
+        over buffer>
+        swap buffer-pop
+    ] [
+        buffer>> f
+    ] if* ;
+
+: buffer-length ( buffer -- n )
+    dup buffer-fill swap buffer-pos - ;
+
+: buffer-capacity ( buffer -- n )
+    dup buffer-size swap buffer-fill - ;
+
+: buffer-empty? ( buffer -- ? )
+    buffer-fill zero? ;
+
+: extend-buffer ( n buffer -- )
+    2dup buffer-ptr swap realloc check-ptr
+    over set-buffer-ptr set-buffer-size ;
+
+: check-overflow ( n buffer -- )
+    2dup buffer-capacity > [ extend-buffer ] [ 2drop ] if ;
+
+: >buffer ( string buffer -- )
+    over length over check-overflow
+    [ buffer-end string>memory ] 2keep
+    [ buffer-fill swap length + ] keep set-buffer-fill ;
+
+: ch>buffer ( ch buffer -- )
+    1 over check-overflow
+    [ buffer-end 0 set-alien-unsigned-1 ] keep
+    [ buffer-fill 1+ ] keep set-buffer-fill ;
+
+: n>buffer ( n buffer -- )
+    [ buffer-fill + ] keep 
+    [ buffer-size > [ "Buffer overflow" throw ] when ] 2keep
+    set-buffer-fill ;
diff --git a/core/io/buffers/summary.txt b/core/io/buffers/summary.txt
new file mode 100644 (file)
index 0000000..4f3a8e1
--- /dev/null
@@ -0,0 +1 @@
+High-performance pinned FIFO buffers
diff --git a/core/io/c-streams.factor b/core/io/c-streams.factor
deleted file mode 100644 (file)
index ccdf92e..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io-internals
-USING: errors kernel kernel-internals namespaces io strings ;
-
-! Simple wrappers for ANSI C I/O functions, used for
-! bootstrapping only.
-
-! More elaborate platform-specific I/O code is used on Unix and
-! Windows; see core/unix and core/win32.
-
-TUPLE: c-stream in out ;
-
-M: c-stream stream-write1
-    >r ch>string r> stream-write ;
-
-M: c-stream stream-write
-    c-stream-out fwrite ;
-
-M: c-stream stream-read1
-    c-stream-in dup [ fgetc ] when ;
-
-M: c-stream stream-flush
-    c-stream-out [ fflush ] when* ;
-
-M: c-stream stream-close
-    dup c-stream-in [ fclose ] when*
-    c-stream-out [ fclose ] when* ;
-
-: <duplex-c-stream> ( in out -- stream )
-    >r f <c-stream> <line-reader> f r> <c-stream> <plain-writer>
-    <duplex-stream> ;
-
-: init-c-io ( -- )
-    13 getenv 14 getenv <duplex-c-stream> stdio set ;
-
-: init-io init-c-io ;
-
-: io-multiplex ( ms -- ) drop ;
-
-IN: io
-
-: <file-reader> ( path -- stream )
-    "rb" fopen f <c-stream> <line-reader> ;
-
-: <file-writer> ( path -- stream )
-    "wb" fopen f swap <c-stream> <plain-writer> ;
-
-TUPLE: client-stream host port ;
-
-TUPLE: c-stream-error ;
-: c-stream-error ( -- * ) <c-stream-error> throw ;
-
-: <client> ( host port -- stream ) c-stream-error ;
-: <server> ( port -- server ) c-stream-error ;
-: accept ( server -- stream ) c-stream-error ;
diff --git a/core/io/c-streams.facts b/core/io/c-streams.facts
deleted file mode 100644 (file)
index 468037b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-USING: help io io-internals threads ;
-
-HELP: io-multiplex
-{ $values { "ms" "a non-negative integer" } }
-{ $description "Waits up to " { $snippet "ms" } " milliseconds for pending I/O requests to complete." }
-{ $warning "If an I/O request completes during the time period, its continuation is resumed and the current one is not saved. If you need to delay execution for a period of time, use the higher-level " { $link sleep } " word instead." } ;
-
-HELP: <file-reader>
-{ $values { "path" "a string" } { "stream" "an input stream" } }
-{ $description "Outputs an input stream for reading from the specified path name." }
-{ $errors "Throws an error if the file is unreadable." } ;
-
-HELP: <file-writer>
-{ $values { "path" "a string" } { "stream" "an output stream" } }
-{ $description "Outputs an input stream for writing to the specified path name." }
-{ $errors "Throws an error if the file is unreadable." } ;
-
-HELP: <client>
-{ $values { "host" "a string" } { "port" "an integer between 0 and 65535" } { "stream" "a bidirectional stream" } }
-{ $description "Connects to TCP/IP port number " { $snippet "port" } " on the host named by " { $snippet "host" } ", and outputs a bidirectional stream." }
-{ $errors "Throws an error if domain name lookup fails, or if the connection cannot be established." } ;
-
-HELP: <server>
-{ $values  { "port" "an integer between 0 and 65535" } { "server" "a handle" } }
-{ $description
-    "Begins listening for connections to " { $snippet "port" } " on all network interfaces. The returned object responds to two generic words:"
-    { $list
-        { { $link stream-close } " - stops listening on the port and frees all associated resources" }
-        { { $link accept } " - blocks until there is a connection" }
-    }
-}
-{ $errors "Throws an error if the port is already in use, or if the OS forbits access." } ;
-
-HELP: accept
-{ $values { "server" "a handle" } { "client" "a bidirectional stream" } }
-{ $description "Waits for a connection to a server socket created by " { $link <server> } ", and outputs a bidirectional stream when the connection has been established."
-$terpri
-"The new stream supports two accessor words to get the host name and port number of the incoming connection:"
-{ $list { $link client-stream-host } { $link client-stream-port } } }
-{ $errors "Throws an error if the server socket is closed or otherwise is unavailable." } ;
-
-HELP: <c-stream> ( in out -- stream )
-{ $values { "in" "a C FILE* handle" } { "out" "a C FILE* handle" } }
-{ $description "Creates a stream which reads and writes data by calling C standard library functions." }
-{ $notes "Usually C streams are only used during bootstrap, and non-blocking OS-specific I/O routines are used during normal operation." } ;
-
-HELP: fopen ( path mode -- alien )
-{ $values { "path" "a path name string" } { "mode" "an access mode specifier" } { "alien" "a C FILE* handle" } }
-{ $description "Opens a file named by " { $snippet "path" } ". The " { $snippet "mode" } " parameter should be something like " { $snippet "\"r\"" } " or " { $snippet "\"rw\"" } "; consult the " { $snippet "fopen(3)" } " manual page for details." }
-{ $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." }
-{ $errors "Throws an error if the output operation failed." } ;
-
-HELP: fflush ( alien -- )
-{ $values { "alien" "a C FILE* handle" } }
-{ $description "Forces pending output on a C FILE* handle to complete." }
-{ $errors "Throws an error if the output operation failed." } ;
-
-HELP: fclose ( alien -- )
-{ $values { "alien" "a C FILE* handle" } }
-{ $description "Closes a C FILE* handle." } ;
-
-HELP: fgetc ( alien -- ch )
-{ $values { "alien" "a C FILE* handle" } { "ch" "a character" } }
-{ $description "Reads a single character from a C FILE* handle." } 
-{ $errors "Throws an error if the input operation failed." } ;
-
-HELP: c-stream-error
-{ $error-description "This error is thrown when C stream I/O is in use and one of the TCP/IP networking words is called. C stream I/O will be in use if either the " { $snippet "-no-native-io" } " switch is passed to bootstrap (see " { $link "bootstrap-cli-args" } ") or if Factor does not have a native I/O implementation for your operating system." } ;
diff --git a/core/io/crc32/authors.txt b/core/io/crc32/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/crc32/crc32-docs.factor b/core/io/crc32/crc32-docs.factor
new file mode 100644 (file)
index 0000000..020f266
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax math ;
+IN: io.crc32
+
+HELP: crc32
+{ $values { "seq" "a sequence" } { "n" integer } }
+{ $description "Computes the CRC32 checksum of a sequence of bytes." } ;
+
+HELP: file-crc32
+{ $values { "path" "a pathname string" } { "n" integer } }
+{ $description "Computes the CRC32 checksum of a file's contents." } ;
+
+ARTICLE: "io.crc32" "CRC32 checksum calculation"
+"The CRC32 checksum algorithm provides a quick but unreliable way to detect changes in data."
+{ $subsection crc32 }
+{ $subsection file-crc32 } ;
+
+ABOUT: "io.crc32"
diff --git a/core/io/crc32/crc32-tests.factor b/core/io/crc32/crc32-tests.factor
new file mode 100644 (file)
index 0000000..5eafae2
--- /dev/null
@@ -0,0 +1,5 @@
+USING: io.crc32 kernel math tools.test namespaces ;
+
+[ 0 ] [ "" crc32 ] unit-test
+[ HEX: cbf43926 ] [ "123456789" crc32 ] unit-test
+
diff --git a/core/io/crc32/crc32.factor b/core/io/crc32/crc32.factor
new file mode 100644 (file)
index 0000000..2b10194
--- /dev/null
@@ -0,0 +1,30 @@
+! Copyright (C) 2006 Doug Coleman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math sequences sequences.private namespaces
+words io io.binary io.files io.streams.string quotations ;
+IN: io.crc32
+
+: crc32-polynomial HEX: edb88320 ; inline
+
+! Generate the table at load time and define a new word with it,
+! instead of using a variable, so that the compiler can inline
+! the call to nth-unsafe
+DEFER: crc32-table inline
+
+\ crc32-table
+256 [
+    8 [
+        dup even? >r 2/ r> [ crc32-polynomial bitxor ] unless
+    ] times >bignum
+] map
+1quotation define-inline
+
+: (crc32) ( crc ch -- crc )
+    >bignum dupd bitxor
+    mask-byte crc32-table nth-unsafe >bignum
+    swap -8 shift bitxor ; inline
+
+: crc32 ( seq -- n )
+    >r HEX: ffffffff dup r> [ (crc32) ] each bitxor ;
+
+: file-crc32 ( path -- n ) <file-reader> contents crc32 ;
diff --git a/core/io/crc32/summary.txt b/core/io/crc32/summary.txt
new file mode 100644 (file)
index 0000000..041d7ff
--- /dev/null
@@ -0,0 +1 @@
+CRC32 checksum algorithm
diff --git a/core/io/duplex-stream.factor b/core/io/duplex-stream.factor
deleted file mode 100644 (file)
index 1e288fc..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: errors kernel ;
-
-! We ensure that the stream can only be closed once, to preserve
-! integrity of duplex I/O ports.
-
-TUPLE: duplex-stream in out closed? ;
-
-C: duplex-stream ( in out -- stream )
-    [ set-duplex-stream-out ] keep
-    [ set-duplex-stream-in ] keep ;
-
-TUPLE: check-closed ;
-
-: check-closed ( stream -- )
-    duplex-stream-closed? [ <check-closed> throw ] when ;
-
-: duplex-stream-in+ ( duplex -- stream )
-    dup check-closed duplex-stream-in ;
-
-: duplex-stream-out+ ( duplex -- stream )
-    dup check-closed duplex-stream-out ;
-
-M: duplex-stream stream-flush
-    duplex-stream-out+ stream-flush ;
-
-M: duplex-stream stream-readln
-    duplex-stream-in+ stream-readln ;
-
-M: duplex-stream stream-read1
-    duplex-stream-in+ stream-read1 ;
-
-M: duplex-stream stream-read
-    duplex-stream-in+ stream-read ;
-
-M: duplex-stream stream-write1
-    duplex-stream-out+ stream-write1 ;
-
-M: duplex-stream stream-write
-    duplex-stream-out+ stream-write ;
-
-M: duplex-stream stream-terpri
-    duplex-stream-out+ stream-terpri ;
-
-M: duplex-stream stream-format
-    duplex-stream-out+ stream-format ;
-
-M: duplex-stream with-stream-style
-    duplex-stream-out+ with-stream-style ;
-
-M: duplex-stream with-nested-stream
-    duplex-stream-out+ with-nested-stream ;
-
-M: duplex-stream with-stream-table
-    duplex-stream-out+ with-stream-table ;
-
-M: duplex-stream stream-close
-    #! The output stream is closed first, in case both streams
-    #! are attached to the same file descriptor, the output
-    #! buffer needs to be flushed before we close the fd.
-    dup duplex-stream-closed? [
-        t over set-duplex-stream-closed?
-        dup duplex-stream-out stream-close
-        dup duplex-stream-in stream-close
-    ] unless drop ;
-
-M: duplex-stream set-timeout
-    2dup
-    duplex-stream-in set-timeout
-    duplex-stream-out set-timeout ;
diff --git a/core/io/duplex-stream.facts b/core/io/duplex-stream.facts
deleted file mode 100644 (file)
index 32a6b2d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-USING: help io ;
-
-HELP: duplex-stream
-{ $class-description "A bidirectional stream delegating to a pair of streams, sending input to one delegate and output to another." } ;
-
-HELP: <duplex-stream>
-{ $values { "in" "an input stream" } { "out" "an output stream" } { "stream" " a duplex stream" } }
-{ $description "Creates a duplex stream. Writing to a duplex stream will write to " { $snippet "out" } ", and reading from a duplex stream will read from " { $snippet "in" } ". Closing a duplex stream closes both the input and output streams." } ;
-
-HELP: check-closed
-{ $values { "stream" "a duplex stream" } }
-{ $description "Throws a " { $link check-closed } " error if the stream has already been closed." }
-{ $error-description "This error is thrown when performing an I/O operation on a " { $link duplex-stream } " which has been closed with " { $link stream-close } "." } ;
diff --git a/core/io/encodings/encodings.factor b/core/io/encodings/encodings.factor
new file mode 100644 (file)
index 0000000..f363389
--- /dev/null
@@ -0,0 +1,25 @@
+! Copyright (C) 2006, 2007 Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: math kernel sequences sbufs vectors
+namespaces ;
+IN: io.encodings
+
+TUPLE: encode-error ;
+
+: encode-error ( -- * ) \ encode-error construct-empty throw ;
+
+TUPLE: decode-error ;
+
+: decode-error ( -- * ) \ decode-error construct-empty throw ;
+
+SYMBOL: begin
+
+: decoded ( buf ch -- buf ch state )
+    over push 0 begin ;
+
+: finish-decoding ( buf ch state -- str )
+    begin eq? [ decode-error ] unless drop { } like ;
+
+: decode ( seq quot -- str )
+    >r [ length <vector> 0 begin ] keep r> each
+    finish-decoding ; inline
diff --git a/core/io/files.factor b/core/io/files.factor
deleted file mode 100644 (file)
index 4370445..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: hashtables kernel math memory namespaces sequences
-strings styles arrays ;
-
-! Words for accessing filesystem meta-data.
-
-: path+ ( str1 str2 -- str )
-    over "/" tail? [ append ] [ "/" swap 3append ] if ;
-
-: exists? ( path -- ? ) stat >r 3drop r> >boolean ;
-
-: directory? ( path -- ? ) stat 3drop ;
-
-: directory ( path -- seq )
-    (directory)
-    [ { "." ".." } member? not ] subset ;
-
-: file-length ( path -- n ) stat 4array third ;
-
-: file-modified ( path -- n ) stat >r 3drop r> ;
-
-: parent-dir ( path -- parent )
-    CHAR: / over last-index CHAR: \\ pick last-index max
-    dup -1 = [ 2drop "." ] [ head ] if ;
-
-: resource-path ( resource -- path )
-    \ resource-path get [ image parent-dir ] unless*
-    swap path+ ;
-
-: ?resource-path ( path -- path )
-    "resource:" ?head [ resource-path ] when ;
-
-TUPLE: pathname string ;
-
-: write-pathname ( path -- ) dup <pathname> write-object ;
-
-: home ( -- dir )
-    windows? "USERPROFILE" "HOME" ? os-env [ "." ] unless* ;
diff --git a/core/io/files.facts b/core/io/files.facts
deleted file mode 100644 (file)
index 6c7dd36..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-USING: help io styles ;
-
-HELP: cwd ( -- path )
-{ $values { "path" "a path name string" } }
-{ $description "Outputs the current working directory of the Factor process." }
-{ $see-also cd } ;
-
-HELP: cd ( path -- )
-{ $values { "path" "a path name string" } }
-{ $description "Changes the current working directory of the Factor process." }
-{ $see-also cwd } ;
-
-HELP: stat ( path -- directory? length permissions modified )
-{ $values { "path" "a path name string" } { "directory?" "boolean indicating if the file is a directory" } { "length" "the length in bytes as an integer" } { "permissions" "a Unix permission bitmap (0 on Windows" } { "modified" "the last modification time, as milliseconds since midnight, January 1st 1970 GMT" } }
-{ $description
-    "Queries the file system for file meta data. If the file does not exist, outputs " { $link f } " for all four values."
-}
-{ $see-also exists? directory? file-length file-modified } ;
-
-HELP: path+
-{ $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
-{ $description "Concatenates two path names." } ;
-
-HELP: exists?
-{ $values { "path" "a string" } { "?" "a boolean" } }
-{ $description "Tests if the file named by " { $snippet "path" } " exists." } ;
-
-HELP: directory?
-{ $values { "path" "a string" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "path" } " names a directory." } ;
-
-HELP: directory
-{ $values { "path" "a string" } { "seq" "a sequence of file name strings" } }
-{ $description "Outputs a sorted sequence of file names stored in the directory named by " { $snippet "path" } "." } ;
-
-HELP: file-length
-{ $values { "path" "a string" } { "n" "a non-negative integer or " { $link f } } }
-{ $description "Outputs the length of the file in bytes, or " { $link f } " if it does not exist." } ;
-
-HELP: parent-dir
-{ $values { "path" "a string" } { "parent" "a string" } }
-{ $description "Strips the last component off a path name." }
-{ $examples { $example "\"/etc/passwd\" parent-dir print" "/etc" } } ;
-
-HELP: resource-path
-{ $values { "resource" "a string" } { "path" "a string" } }
-{ $description "Resolve a path relative to the Factor source code location. This first checks if the " { $link resource-path } " variable is set to a path, and if not, uses the parent directory of the current image." } ;
-
-HELP: pathname
-{ $class-description "Class of path name presentations. Instances can be used passed to " { $link write-object } " to output a clickable path name." } ;
diff --git a/core/io/files/authors.txt b/core/io/files/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/files/files-docs.factor b/core/io/files/files-docs.factor
new file mode 100644 (file)
index 0000000..6652495
--- /dev/null
@@ -0,0 +1,159 @@
+USING: help.markup help.syntax io io.styles strings
+io.backend io.files.private ;
+IN: io.files
+
+ARTICLE: "file-streams" "Reading and writing files"
+{ $subsection <file-reader> }
+{ $subsection <file-writer> }
+{ $subsection <file-appender> }
+"Pathname manipulation:"
+{ $subsection parent-dir }
+{ $subsection file-name }
+{ $subsection last-path-separator }
+{ $subsection path+ }
+"File system meta-data:"
+{ $subsection exists? }
+{ $subsection directory? }
+{ $subsection file-length }
+{ $subsection file-modified }
+{ $subsection stat }
+"Directory listing:"
+{ $subsection directory }
+"File management:"
+{ $subsection delete-file }
+{ $subsection make-directory }
+{ $subsection delete-directory }
+"Current and home directories:"
+{ $subsection home }
+{ $subsection cwd }
+{ $subsection cd }
+"Pathnames relative to the Factor install directory:"
+{ $subsection resource-path }
+{ $subsection ?resource-path }
+"Pathname presentations:"
+{ $subsection pathname }
+{ $subsection <pathname> }
+{ $see-also "os" } ;
+
+ABOUT: "file-streams"
+
+HELP: <file-reader>
+{ $values { "path" "a pathname string" } { "stream" "an input stream" } }
+{ $description "Outputs an input stream for reading from the specified pathname." }
+{ $errors "Throws an error if the file is unreadable." } ;
+
+HELP: <file-writer>
+{ $values { "path" "a pathname string" } { "stream" "an output stream" } }
+{ $description "Outputs an output stream for writing to the specified pathname. The file's length is truncated to zero." }
+{ $errors "Throws an error if the file cannot be opened for writing." } ;
+
+HELP: <file-appender>
+{ $values { "path" "a pathname string" } { "stream" "an output stream" } }
+{ $description "Outputs an output stream for writing to the specified pathname. The stream begins writing at the end of the file." }
+{ $errors "Throws an error if the file cannot be opened for writing." } ;
+
+HELP: cwd ( -- path )
+{ $values { "path" "a pathname string" } }
+{ $description "Outputs the current working directory of the Factor process." }
+{ $errors "Windows CE has no concept of ``current directory'', so this word throws an error there." } ;
+
+HELP: cd ( path -- )
+{ $values { "path" "a pathname string" } }
+{ $description "Changes the current working directory of the Factor process." }
+{ $errors "Windows CE has no concept of ``current directory'', so this word throws an error there." } ;
+
+{ cd cwd } related-words
+
+HELP: stat ( path -- directory? permissions length modified )
+{ $values { "path" "a pathname string" } { "directory?" "boolean indicating if the file is a directory" } { "permissions" "a Unix permission bitmap (0 on Windows)" } { "length" "the length in bytes as an integer" } { "modified" "the last modification time, as milliseconds since midnight, January 1st 1970 GMT" } }
+{ $description
+    "Queries the file system for file meta data. If the file does not exist, outputs " { $link f } " for all four values."
+} ;
+
+{ stat exists? directory? file-length file-modified } related-words
+
+HELP: path+
+{ $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
+{ $description "Concatenates two pathnames." } ;
+
+HELP: exists?
+{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $description "Tests if the file named by " { $snippet "path" } " exists." } ;
+
+HELP: directory?
+{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "path" } " names a directory." } ;
+
+HELP: (directory)
+{ $values { "path" "a pathname string" } { "seq" "a sequence of " { $snippet "{ name dir? }" } " pairs" } }
+{ $description "Outputs the contents of a directory named by " { $snippet "path" } "." }
+{ $notes "This is a low-level word, and user code should call " { $link directory } " instead." } ;
+
+HELP: directory
+{ $values { "path" "a pathname string" } { "seq" "a sequence of " { $snippet "{ name dir? }" } " pairs" } }
+{ $description "Outputs the contents of a directory named by " { $snippet "path" } "." } ;
+
+HELP: file-length
+{ $values { "path" "a pathname string" } { "n" "a non-negative integer or " { $link f } } }
+{ $description "Outputs the length of the file in bytes, or " { $link f } " if it does not exist." } ;
+
+HELP: file-modified
+{ $values { "path" "a pathname string" } { "n" "a non-negative integer or " { $link f } } }
+{ $description "Outputs a file's last modification time, since midnight January 1, 1970. If the file does not exist, outputs " { $link f } "." } ;
+
+HELP: parent-dir
+{ $values { "path" "a pathname string" } { "parent" "a pathname string" } }
+{ $description "Strips the last component off a pathname." }
+{ $examples { $example "USE: io.files" "\"/etc/passwd\" parent-dir print" "/etc" } } ;
+
+HELP: file-name
+{ $values { "path" "a pathname string" } { "string" string } }
+{ $description "Outputs the last component of a pathname string." }
+{ $examples
+    { "\"/usr/bin/gcc\" file-name ." "\"gcc\"" }
+    { "\"/usr/libexec/awk/\" file-name ." "\"awk\"" }
+} ;
+
+HELP: resource-path
+{ $values { "path" "a pathname string" } { "newpath" "a pathname string" } }
+{ $description "Resolve a path relative to the Factor source code location. This first checks if the " { $link resource-path } " variable is set to a path, and if not, uses the parent directory of the current image." } ;
+
+HELP: ?resource-path
+{ $values { "path" "a pathname string" } { "newpath" "a string" } }
+{ $description "If the path is prefixed with " { $snippet "\"resource:\"" } ", prepends the resource path." } ;
+
+{ resource-path ?resource-path } related-words
+
+HELP: pathname
+{ $class-description "Class of pathname presentations. Path name presentations can be created by calling " { $link <pathname> } ". Instances can be passed to " { $link write-object } " to output a clickable pathname." } ;
+
+HELP: normalize-directory
+{ $values { "str" "a pathname string" } { "newstr" "a new pathname string" } }
+{ $description "Called by the " { $link directory } " word to prepare a pathname before passing it to the " { $link (directory) } " primitive." } ;
+
+HELP: normalize-pathname
+{ $values { "str" "a pathname string" } { "newstr" "a new pathname string" } }
+{ $description "Called by the " { $link stat } " word, and possibly " { $link <file-reader> } " and " { $link <file-writer> } ", to prepare a pathname before passing it to underlying code." } ;
+
+HELP: <pathname> ( str -- pathname )
+{ $values { "str" "a pathname string" } { "pathname" pathname } }
+{ $description "Creates a new " { $link pathname } "." } ;
+
+HELP: home
+{ $values { "dir" string } }
+{ $description "Outputs the user's home directory." } ;
+
+HELP: delete-file
+{ $values { "path" "a pathname string" } }
+{ $description "Deletes a file." }
+{ $errors "Throws an error if the file could not be deleted." } ;
+
+HELP: make-directory
+{ $values { "path" "a pathname string" } }
+{ $description "Creates a directory." }
+{ $errors "Throws an error if the directory could not be created." } ;
+
+HELP: delete-directory
+{ $values { "path" "a pathname string" } }
+{ $description "Deletes a directory. The directory must be empty." }
+{ $errors "Throws an error if the directory could not be deleted." } ;
diff --git a/core/io/files/files-tests.factor b/core/io/files/files-tests.factor
new file mode 100644 (file)
index 0000000..4f071e0
--- /dev/null
@@ -0,0 +1,67 @@
+IN: temporary
+USING: tools.test io.files io threads kernel ;
+
+[ "passwd" ] [ "/etc/passwd" file-name ] unit-test
+[ "awk/" ] [ "/usr/libexec/awk/" file-name ] unit-test
+
+[ ] [
+    "test-foo.txt" resource-path <file-writer> [
+        "Hello world." print
+    ] with-stream
+] unit-test
+
+[ ] [
+    "test-foo.txt" resource-path <file-appender> [
+        "Hello appender." print
+    ] with-stream
+] unit-test
+
+[ ] [
+    "test-bar.txt" resource-path <file-appender> [
+        "Hello appender." print
+    ] with-stream
+] unit-test
+
+[ "Hello world.\nHello appender.\n" ] [
+    "test-foo.txt" resource-path <file-reader> contents
+] unit-test
+
+[ "Hello appender.\n" ] [
+    "test-bar.txt" resource-path <file-reader> contents
+] unit-test
+
+[ ] [ "test-foo.txt" resource-path delete-file ] unit-test
+
+[ ] [ "test-bar.txt" resource-path delete-file ] unit-test
+
+[ f ] [ "test-foo.txt" resource-path exists? ] unit-test
+
+[ f ] [ "test-bar.txt" resource-path exists? ] unit-test
+
+[ ] [ "test-blah" resource-path make-directory ] unit-test
+
+[ ] [
+    "test-blah/fooz" resource-path <file-writer> stream-close
+] unit-test
+
+[ t ] [
+    "test-blah/fooz" resource-path exists?
+] unit-test
+
+[ ] [ "test-blah/fooz" resource-path delete-file ] unit-test
+
+[ ] [ "test-blah" resource-path delete-directory ] unit-test
+
+[ f ] [ "test-blah" resource-path exists? ] unit-test
+
+[ ] [ "test-quux.txt" resource-path <file-writer> [ [ yield "Hi" write ] in-thread ] with-stream ] unit-test
+
+[ ] [ "test-quux.txt" resource-path delete-file ] unit-test
+
+[ ] [ "test-quux.txt" resource-path <file-writer> [ [ yield "Hi" write ] in-thread ] with-stream ] unit-test
+
+[ ] [ "test-quux.txt" "quux-test.txt" [ resource-path ] 2apply rename-file ] unit-test
+[ t ] [ "quux-test.txt" resource-path exists? ] unit-test
+
+[ ] [ "quux-test.txt" resource-path delete-file ] unit-test
+
diff --git a/core/io/files/files.factor b/core/io/files/files.factor
new file mode 100644 (file)
index 0000000..84d83bd
--- /dev/null
@@ -0,0 +1,106 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.files
+USING: io.backend io.files.private hashtables kernel math memory
+namespaces sequences strings arrays definitions system
+combinators splitting ;
+
+HOOK: <file-reader> io-backend ( path -- stream )
+
+HOOK: <file-writer> io-backend ( path -- stream )
+
+HOOK: <file-appender> io-backend ( path -- stream )
+
+HOOK: delete-file io-backend ( path -- )
+
+HOOK: rename-file io-backend ( from to -- )
+
+HOOK: make-directory io-backend ( path -- )
+
+HOOK: delete-directory io-backend ( path -- )
+
+HOOK: root-directory? io-backend ( path -- ? )
+
+M: object root-directory? ( path -- ? ) "/" = ;
+
+! Words for accessing filesystem meta-data.
+
+: path-separator? ( ch -- ? )
+    "/\\" member? ;
+
+: path+ ( str1 str2 -- str )
+    >r [ path-separator? ] rtrim r>
+    [ path-separator? ] ltrim
+    >r "/" r> 3append ;
+
+: stat ( path -- directory? permissions length modified )
+    normalize-pathname (stat) ;
+
+: exists? ( path -- ? ) stat >r 3drop r> >boolean ;
+
+: directory? ( path -- ? ) stat 3drop ;
+
+: fixup-directory ( path seq -- newseq )
+    [
+        dup string?
+        [ tuck path+ directory? 2array ] [ nip ] if
+    ] curry* map
+    [ first { "." ".." } member? not ] subset ;
+
+: directory ( path -- seq )
+    normalize-directory dup (directory) fixup-directory ;
+
+: file-length ( path -- n ) stat 4array third ;
+
+: file-modified ( path -- n ) stat >r 3drop r> ;
+
+: last-path-separator ( path -- n ? )
+    [ length 2 [-] ] keep [ path-separator? ] find-last* ;
+
+TUPLE: no-parent-directory path ;
+
+: parent-dir ( path -- parent )
+    {
+        { [ dup root-directory? ] [ ] }
+        { [ dup "/\\" split ".." over member? "." rot member? or ]
+            [ \ no-parent-directory construct-boa throw ] }
+        { [ t ] [ dup last-path-separator
+                [ 1+ head ] [ 2drop "." ] if ] }
+    } cond ;
+
+: file-name ( path -- string )
+    dup last-path-separator
+    [ 1+ tail ] [ drop ] if ;
+
+: resource-path ( path -- newpath )
+    \ resource-path get [ image parent-dir ] unless*
+    swap path+ ;
+
+: ?resource-path ( path -- newpath )
+    "resource:" ?head [ resource-path ] when ;
+
+: make-directories ( path -- )
+    normalize-pathname
+    {
+        { [ dup "." = ] [ ] }
+        { [ dup root-directory? ] [ ] }
+        { [ dup empty? ] [ ] }
+        { [ dup exists? ] [ ] }
+        { [ t ] [
+            dup parent-dir make-directories
+            dup make-directory
+        ] }
+    } cond drop ;
+
+TUPLE: pathname string ;
+
+C: <pathname> pathname
+
+M: pathname <=> [ pathname-string ] compare ;
+
+: home ( -- dir )
+    {
+        { [ winnt? ] [ "USERPROFILE" os-env ] }
+        { [ wince? ] [ "" resource-path ] }
+        { [ unix? ] [ "HOME" os-env ] }
+    } cond ;
diff --git a/core/io/files/summary.txt b/core/io/files/summary.txt
new file mode 100644 (file)
index 0000000..2121295
--- /dev/null
@@ -0,0 +1 @@
+Reading and writing files
diff --git a/core/io/io-docs.factor b/core/io/io-docs.factor
new file mode 100644 (file)
index 0000000..d653bc8
--- /dev/null
@@ -0,0 +1,301 @@
+USING: help.markup help.syntax quotations hashtables kernel
+classes strings ;
+IN: io
+
+ARTICLE: "stream-protocol" "Stream protocol"
+"The stream protocol consists of a large number of generic words, many of which are optional."
+$nl
+"A word required to be implemented for all streams:"
+{ $subsection stream-close }
+"Three words are required for input streams:"
+{ $subsection stream-read1 }
+{ $subsection stream-read }
+{ $subsection stream-read-until }
+{ $subsection stream-readln }
+"Seven words are required for output streams:"
+{ $subsection stream-flush }
+{ $subsection stream-write1 }
+{ $subsection stream-write }
+{ $subsection stream-format }
+{ $subsection stream-nl }
+{ $subsection make-span-stream }
+{ $subsection make-block-stream }
+{ $subsection make-cell-stream }
+{ $subsection stream-write-table }
+"Optional word for network streams:"
+{ $subsection set-timeout } ;
+
+ARTICLE: "stdio" "The default stream"
+"Various words take an implicit stream parameter from a variable to reduce stack shuffling."
+{ $subsection stdio }
+"Unless rebound in a child namespace, this variable will be set to a console stream for interacting with the user."
+{ $subsection close }
+{ $subsection read1 }
+{ $subsection read }
+{ $subsection read-until }
+{ $subsection readln }
+{ $subsection flush }
+{ $subsection write1 }
+{ $subsection write }
+{ $subsection print }
+{ $subsection nl }
+{ $subsection bl }
+"Formatted output:"
+{ $subsection format }
+{ $subsection write-object }
+{ $subsection with-style }
+{ $subsection with-nesting }
+"Tabular output:"
+{ $subsection tabular-output }
+{ $subsection with-row }
+{ $subsection with-cell }
+{ $subsection write-cell }
+"A pair of combinators support rebinding the " { $link stdio } " variable:"
+{ $subsection with-stream }
+{ $subsection with-stream* } ;
+
+ARTICLE: "stream-utils" "Stream utilities"
+"There are a few useful stream-related words which are not generic, but merely built up from the stream protocol."
+$nl
+"First, a simple composition of " { $link stream-write } " and " { $link stream-nl } ":"
+{ $subsection stream-print }
+"Sluring an entire stream into memory all at once:"
+{ $subsection lines }
+{ $subsection contents }
+"Copying the contents of one stream to another:"
+{ $subsection stream-copy } ;
+
+ARTICLE: "streams" "Streams"
+"Input and output centers on the concept of a " { $emphasis "stream" } ", which is a source or sink of characters. Streams also support formatted output, which may be used to present styled text in a manner independent of output medium."
+{ $subsection "stream-protocol" }
+{ $subsection "stdio" }
+{ $subsection "stream-utils" }
+{ $see-also "io.streams.string" "io.streams.lines" "io.streams.plain" "io.streams.duplex" } ;
+
+ABOUT: "streams"
+
+HELP: stream-close
+{ $values { "stream" "a stream" } }
+{ $contract "Closes the stream. This releases any external resources associated with the stream, such as file handles and network connections. No further operations can be performed on the stream after this call." }
+{ $notes "You must close streams after you are finished working with them. A convenient way to automate this is by using the " { $link with-stream } " word." }
+$io-error ;
+
+HELP: set-timeout
+{ $values { "n" "an integer" } { "stream" "a stream" } }
+{ $contract "Sets a timeout, in milliseconds, for closing the stream if there is no activity. Not all streams support timeouts." } 
+$io-error ;
+
+HELP: stream-readln
+{ $values { "stream" "an input stream" } { "str" string } }
+{ $contract "Reads a line of input from the stream. Outputs " { $link f } " on stream exhaustion." }
+$io-error ;
+
+HELP: stream-read1
+{ $values { "stream" "an input stream" } { "ch/f" "a character or " { $link f } } }
+{ $contract "Reads a character of input from the stream. Outputs " { $link f } " on stream exhaustion." }
+$io-error ;
+
+HELP: stream-read
+{ $values { "n" "a non-negative integer" } { "stream" "an input stream" } { "str/f" "a string or " { $link f } } }
+{ $contract "Reads " { $snippet "n" } " characters of input from the stream. Outputs a truncated string or " { $link f } " on stream exhaustion." }
+$io-error ;
+
+HELP: stream-read-until
+{ $values { "seps" string } { "stream" "an input stream" } { "str/f" "a string or " { $link f } } { "sep/f" "a character or " { $link f } } }
+{ $contract "Reads characters from the stream, until the first occurrence of a separator character, or stream exhaustion. In the former case, the separator character is pushed on the stack, and is not part of the output string. In the latter case, the entire stream contents are output, along with " { $link f } "." }
+$io-error ;
+
+HELP: stream-write1
+{ $values { "ch" "a character" } { "stream" "an output stream" } }
+{ $contract "Writes a character of output to the stream. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
+$io-error ;
+
+HELP: stream-write
+{ $values { "str" string } { "stream" "an output stream" } }
+{ $contract "Writes a string of output to the stream. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
+$io-error ;
+
+HELP: stream-flush
+{ $values { "stream" "an output stream" } }
+{ $contract "Waits for any pending output to complete." }
+{ $notes "With many output streams, written output is buffered and not sent to the underlying resource until either the buffer is full, or this word is called." }
+$io-error ;
+
+HELP: stream-nl
+{ $values { "stream" "an output stream" } }
+{ $contract "Writes a line terminator. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
+$io-error ;
+
+HELP: stream-format
+{ $values { "str" string } { "style" "a hashtable" } { "stream" "an output stream" } }
+{ $contract "Writes formatted text to the stream. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output."
+$nl
+"The " { $snippet "style" } " hashtable holds character style information. See " { $link "character-styles" } "." }
+$io-error ;
+
+HELP: make-block-stream
+{ $values { "quot" "a quotation" } { "style" "a hashtable" } { "stream" "an output stream" } }
+{ $contract "Calls the quotation in a new dynamic scope with the " { $link stdio } " stream rebound to a nested paragraph stream, with formatting information applied."
+$nl
+"Unlike " { $link make-span-stream } ", this creates a new paragraph block in the output."
+$nl
+"The " { $snippet "style" } " hashtable holds paragraph style information. See " { $link "paragraph-styles" } "." }
+$io-error ;
+
+HELP: stream-write-table
+{ $values { "table-cells" "a sequence of sequences of table cells" } { "style" "a hashtable" } { "stream" "an output stream" } }
+{ $contract "Prints a table of cells produced by " { $link with-cell } "."
+$nl
+"The " { $snippet "style" } " hashtable holds table style information. See " { $link "table-styles" } "." }
+{ $notes "Instead of calling this word directly, use " { $link tabular-output } "." }
+$io-error ;
+
+HELP: make-cell-stream
+{ $values { "quot" quotation } { "style" hashtable } { "stream" "an output stream" } { "table-cell" object } }
+{ $contract "Creates a table cell by calling the quotation in a new scope with a rebound " { $link stdio } " stream. Callers should not make any assumptions about the type of this word's output value; it should be treated like an opaque handle passed to " { $link stream-write-table } "." }
+{ $notes "Instead of calling this word directly, use " { $link tabular-output } "." }
+$io-error ;
+
+HELP: make-span-stream
+{ $values { "style" "a hashtable" } { "quot" "a quotation" } { "stream" "an output stream" } }
+{ $contract "Calls the quotation in a new dynamic scope where calls to " { $link write } ", " { $link format } " and other stream output words automatically inherit style settings from " { $snippet "style" } "."
+$nl
+"Unlike " { $link make-block-stream } ", the quotation's output is inline, and not nested in a paragraph block." }
+$io-error ;
+
+HELP: stream-print
+{ $values { "str" string } { "stream" "an output stream" } }
+{ $description "Writes a newline-terminated string." }
+$io-error ;
+
+HELP: stream-copy
+{ $values { "in" "an input stream" } { "out" "an output stream" } }
+{ $description "Copies the contents of one stream into another, closing both streams when done." } 
+$io-error ;
+
+HELP: stdio
+{ $var-description "Holds a stream, used for various implicit stream operations. Rebound using " { $link with-stream } " and " { $link with-stream* } "." } ;
+
+HELP: close
+{ $contract "Closes the " { $link stdio } " stream." } 
+$io-error ;
+
+HELP: readln
+{ $values { "str/f" "a string or " { $link f } } }
+{ $contract "Reads a line of input from the " { $link stdio } " stream. Outputs " { $link f } " on stream exhaustion." }
+$io-error ;
+
+HELP: read1
+{ $values { "ch/f" "a character or " { $link f } } }
+{ $contract "Reads a character of input from the " { $link stdio } " stream. Outputs " { $link f } " on stream exhaustion." }
+$io-error ;
+
+HELP: read
+{ $values { "n" "a non-negative integer" } { "str/f" "a string or " { $link f } } }
+{ $contract "Reads " { $snippet "n" } " characters of input from the " { $link stdio } " stream. Outputs a truncated string or " { $link f } " on stream exhaustion." }
+$io-error ;
+
+HELP: read-until
+{ $values { "seps" string } { "str/f" "a string or " { $link f } } { "sep/f" "a character or " { $link f } } }
+{ $contract "Reads characters from the " { $link stdio } " stream. until the first occurrence of a separator character, or stream exhaustion. In the former case, the separator character is pushed on the stack, and is not part of the output string. In the latter case, the entire stream contents are output, along with " { $link f } "." }
+$io-error ;
+
+HELP: write1
+{ $values { "ch" "a character" } }
+{ $contract "Writes a character of output to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
+$io-error ;
+
+HELP: write
+{ $values { "str" string } }
+{ $contract "Writes a string of output to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
+$io-error ;
+
+HELP: flush
+{ $contract "Waits for any pending output to the " { $link stdio } " stream to complete." }
+$io-error ;
+
+HELP: nl
+{ $contract "Writes a line terminator to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
+$io-error ;
+
+HELP: format
+{ $values { "str" string } { "style" "a hashtable" } }
+{ $contract "Writes formatted text to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
+{ $notes "Details are in the documentation for " { $link stream-format } "." }
+$io-error ;
+
+HELP: with-nesting
+{ $values { "style" "a hashtable" } { "quot" "a quotation" } }
+{ $contract "Calls the quotation in a new dynamic scope with the " { $link stdio } " stream rebound to a nested paragraph stream, with formatting information applied." }
+{ $notes "Details are in the documentation for " { $link make-block-stream } "." }
+$io-error ;
+
+HELP: tabular-output
+{ $values { "style" "a hashtable" } { "quot" quotation } }
+{ $description "Calls a quotation which emits a series of equal-length table rows using " { $link with-row } ". The results are laid out in a tabular fashion on the " { $link stdio } " stream."
+$nl
+"The " { $snippet "style" } " hashtable holds table style information. See " { $link "table-styles" } "." }
+{ $examples
+    { $code
+        "{ { 1 2 } { 3 4 } }"
+        "H{ { table-gap { 10 10 } } } ["
+        "    [ [ [ [ . ] with-cell ] each ] with-row ] each"
+        "] tabular-output"
+    }
+}
+$io-error ;
+
+HELP: with-row
+{ $values { "quot" quotation } }
+{ $description "Calls a quotation which emits a series of table cells using " { $link with-cell } ". This word can only be called inside the quotation given to " { $link tabular-output } "." }
+$io-error ;
+
+HELP: with-cell
+{ $values { "quot" quotation } }
+{ $description "Calls a quotation in a new scope with the " { $link stdio } " stream rebound. Output performed by the quotation is displayed in a table cell. This word can only be called inside the quotation given to " { $link with-row } "." }
+$io-error ;
+
+HELP: write-cell
+{ $values { "str" string } }
+{ $description "Outputs a table cell containing a single string. This word can only be called inside the quotation given to " { $link with-row } "." }
+$io-error ;
+
+HELP: with-style
+{ $values { "style" "a hashtable" } { "quot" "a quotation" } }
+{ $description "Calls the quotation in a new dynamic scope where calls to " { $link write } ", " { $link format } " and other stream output words automatically inherit style settings from " { $snippet "style" } "." }
+{ $notes "Details are in the documentation for " { $link make-span-stream } "." }
+$io-error ;
+
+HELP: print
+{ $values { "string" string } }
+{ $description "Writes a newline-terminated string to the " { $link stdio } " stream." }
+$io-error ;
+
+HELP: with-stream
+{ $values { "stream" "an input or output stream" } { "quot" "a quotation" } }
+{ $description "Calls the quotation in a new dynamic scope, with the " { $link stdio } " variable rebound to  " { $snippet "stream" } ". The stream is closed if the quotation returns or throws an error." } ;
+
+{ with-stream with-stream* } related-words
+
+HELP: with-stream*
+{ $values { "stream" "an input or output stream" } { "quot" "a quotation" } }
+{ $description "Calls the quotation in a new dynamic scope, with the " { $link stdio } " variable rebound to  " { $snippet "stream" } "." }
+{ $notes "This word does not close the stream. Compare with " { $link with-stream } "." } ;
+
+HELP: bl
+{ $description "Outputs a space character (" { $snippet "\" \"" } ")." }
+$io-error ;
+
+HELP: write-object
+{ $values { "str" string } { "obj" "an object" } }
+{ $description "Writes a string to the " { $link stdio } " stream, associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." }
+$io-error ;
+
+HELP: lines
+{ $values { "stream" "an input stream" } { "seq" "a sequence of strings" } }
+{ $description "Reads lines of text until the stream is exhausted, collecting them in a sequence of strings." } ;
+
+HELP: contents
+{ $values { "stream" "an input stream" } { "str" string } }
+{ $description "Reads the entire contents of a stream into a string." }
+$io-error ;
diff --git a/core/io/io-tests.factor b/core/io/io-tests.factor
new file mode 100644 (file)
index 0000000..ab1d00e
--- /dev/null
@@ -0,0 +1,59 @@
+USING: arrays io io.files kernel math parser strings system
+tools.test words namespaces ;
+IN: temporary
+
+[ f ] [
+    "resource:/core/io/test/no-trailing-eol.factor" run-file
+    "foo" "temporary" lookup
+] unit-test
+
+: <resource-reader> ( resource -- stream )
+    resource-path <file-reader> ;
+
+[
+    "This is a line.\rThis is another line.\r"
+] [
+    "/core/io/test/mac-os-eol.txt" <resource-reader>
+    [ 500 read ] with-stream
+] unit-test
+
+[
+    255
+] [
+    "/core/io/test/binary.txt" <resource-reader>
+    [ read1 ] with-stream >fixnum
+] unit-test
+
+! Make sure we use correct to_c_string form when writing
+[ ] [ "\0" write ] unit-test
+
+[ "" ] [ 0 read ] unit-test
+
+! [ ] [ "123" write 9000 CHAR: x <string> write flush ] unit-test
+
+[ "" ] [
+    "/core/io/test/binary.txt" <resource-reader>
+    [ 0.2 read ] with-stream
+] unit-test
+
+[
+    {
+        { "It seems " CHAR: J }
+        { "obs has lost h" CHAR: i }
+        { "s grasp on reality again.\n" f }
+    }
+] [
+    [
+        "/core/io/test/separator-test.txt" <resource-reader> [
+            "J" read-until 2array ,
+            "i" read-until 2array ,
+            "X" read-until 2array ,
+        ] with-stream
+    ] { } make
+] unit-test
+
+[ ] [
+    image <file-reader> [
+        10 [ 65536 read drop ] times
+    ] with-stream
+] unit-test
diff --git a/core/io/io.factor b/core/io/io.factor
new file mode 100644 (file)
index 0000000..4580d83
--- /dev/null
@@ -0,0 +1,94 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io
+USING: hashtables generic kernel math namespaces
+sequences strings continuations assocs io.styles sbufs ;
+
+GENERIC: stream-close ( stream -- )
+GENERIC: set-timeout ( n stream -- )
+GENERIC: stream-readln ( stream -- str )
+GENERIC: stream-read1 ( stream -- ch/f )
+GENERIC: stream-read ( n stream -- str/f )
+GENERIC: stream-read-until ( seps stream -- str/f sep/f )
+GENERIC: stream-read-partial ( max stream -- str/f )
+GENERIC: stream-write1 ( ch stream -- )
+GENERIC: stream-write ( str stream -- )
+GENERIC: stream-flush ( stream -- )
+GENERIC: stream-nl ( stream -- )
+GENERIC: stream-format ( str style stream -- )
+GENERIC: make-span-stream ( style stream -- stream' )
+GENERIC: make-block-stream ( style stream -- stream' )
+GENERIC: make-cell-stream ( style stream -- stream' )
+GENERIC: stream-write-table ( table-cells style stream -- )
+
+: stream-print ( str stream -- )
+    [ stream-write ] keep stream-nl ;
+
+: (stream-copy) ( in out -- )
+    64 1024 * pick stream-read
+    [ over stream-write (stream-copy) ] [ 2drop ] if* ;
+
+: stream-copy ( in out -- )
+    [ 2dup (stream-copy) ] [ stream-close stream-close ] [ ]
+    cleanup ;
+
+! Default stream
+SYMBOL: stdio
+
+: close ( -- ) stdio get stream-close ;
+
+: readln ( -- str/f ) stdio get stream-readln ;
+: read1 ( -- ch/f ) stdio get stream-read1 ;
+: read ( n -- str/f ) stdio get stream-read ;
+: read-until ( seps -- str/f sep/f ) stdio get stream-read-until ;
+
+: write1 ( ch -- ) stdio get stream-write1 ;
+: write ( str -- ) stdio get stream-write ;
+: flush ( -- ) stdio get stream-flush ;
+
+: nl ( -- ) stdio get stream-nl ;
+: format ( str style -- ) stdio get stream-format ;
+
+: with-stream* ( stream quot -- )
+    stdio swap with-variable ; inline
+
+: with-stream ( stream quot -- )
+    swap [ [ close ] [ ] cleanup ] with-stream* ; inline
+
+: tabular-output ( style quot -- )
+    swap >r { } make r> stdio get stream-write-table ; inline
+
+: with-row ( quot -- )
+    { } make , ; inline
+
+: with-cell ( quot -- )
+    H{ } stdio get make-cell-stream
+    [ swap with-stream ] keep , ; inline
+
+: write-cell ( str -- )
+    [ write ] with-cell ; inline
+
+: with-style ( style quot -- )
+    swap dup assoc-empty? [
+        drop call
+    ] [
+        stdio get make-span-stream swap with-stream
+    ] if ; inline
+
+: with-nesting ( style quot -- )
+    >r stdio get make-block-stream r> with-stream ; inline
+
+: print ( string -- ) stdio get stream-print ;
+
+: bl ( -- ) " " write ;
+
+: write-object ( str obj -- )
+    presented associate format ;
+
+: lines-loop ( -- ) readln [ , lines-loop ] when* ;
+
+: lines ( stream -- seq )
+    [ [ lines-loop ] { } make ] with-stream ;
+
+: contents ( stream -- str )
+    2048 <sbuf> [ stream-copy ] keep >string ;
diff --git a/core/io/lines.factor b/core/io/lines.factor
deleted file mode 100644 (file)
index daa27ac..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: errors generic io kernel math namespaces sequences
-vectors ;
-
-TUPLE: line-reader cr ;
-
-C: line-reader ( stream -- new-stream ) [ set-delegate ] keep ;
-
-: cr> dup line-reader-cr f rot set-line-reader-cr ;
-
-: (readln) ( ? line -- ? )
-    #! The flag is set after the first character is read.
-    dup delegate stream-read1 dup [
-        >r >r drop t r> r> dup CHAR: \r number= [
-            drop t swap set-line-reader-cr
-        ] [
-            dup CHAR: \n number= [
-                drop dup cr> [ (readln) ] [ drop ] if
-            ] [
-                , (readln)
-            ] if
-        ] if
-    ] [
-        2drop
-    ] if ;
-
-M: line-reader stream-readln
-    [ f swap (readln) ] "" make
-    dup empty? [ f ? ] [ nip ] if ;
-
-M: line-reader stream-read
-    [ delegate stream-read ] keep dup cr> [
-        over empty? [
-            drop
-        ] [
-            >r 1 tail r> stream-read1 [ add ] when*
-        ] if
-    ] [
-        drop
-    ] if ;
-
-: (lines) ( -- ) readln [ , (lines) ] when* ;
-
-: lines ( stream -- seq ) [ [ (lines) ] { } make ] with-stream ;
diff --git a/core/io/lines.facts b/core/io/lines.facts
deleted file mode 100644 (file)
index 2623b1b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-USING: help io ;
-
-HELP: <line-reader>
-{ $values { "stream" "an input stream" } { "new-stream" "an input stream" } }
-{ $description "Wraps an input stream in a stream supporting the " { $link stream-readln } " generic word." }
-{ $notes "Stream constructors should call this word to wrap streams that do not natively support reading lines. Unix (" { $snippet "\\n" } "), Windows (" { $snippet "\\r\\n" } ") and MacOS (" { $snippet "\\r" } ") line endings are supported." } ;
-
-HELP: lines
-{ $values { "stream" "an input stream" } { "seq" "a sequence of strings" } }
-{ $description "Reads lines of text until the stream is exhausted, collecting them in a sequence of strings." } ;
diff --git a/core/io/nested-style.factor b/core/io/nested-style.factor
deleted file mode 100644 (file)
index df214b1..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: arrays generic hashtables kernel namespaces strings ;
-
-TUPLE: nested-style-stream style ;
-
-: (with-stream-style) ( quot style stream -- )
-    <nested-style-stream> swap with-stream* ; inline
-
-: do-nested-style ( style stream -- style delegate )
-    [ nested-style-stream-style swap hash-union ] keep
-    delegate ;
-
-C: nested-style-stream ( style delegate -- stream )
-    [ set-delegate ] keep
-    [ set-nested-style-stream-style ] keep ;
-
-M: nested-style-stream stream-format
-    do-nested-style stream-format ;
-
-M: nested-style-stream stream-write
-    H{ } swap do-nested-style stream-format ;
-
-M: nested-style-stream stream-write1
-    >r ch>string r> H{ } swap do-nested-style stream-format ;
-
-: do-nested-quot ( quot style stream -- quot style stream )
-    tuck >r >r
-    nested-style-stream-style swap \ with-style
-    3array >quotation
-    r> r> do-nested-style ;
-
-M: nested-style-stream with-stream-style
-    do-nested-style with-stream-style ;
-
-M: nested-style-stream with-nested-stream
-    do-nested-quot with-nested-stream ;
-
-M: nested-style-stream with-stream-table
-    do-nested-quot with-stream-table ;
diff --git a/core/io/nested-style.facts b/core/io/nested-style.facts
deleted file mode 100644 (file)
index 10e09ea..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-IN: io
-USING: help ;
-
-HELP: (with-stream-style)
-{ $values { "quot" "a quotation" } { "style" "a hashtable" } { "stream" "an output stream" } }
-{ $description "Wraps the stream in a " { $link nested-style-stream } " and calls the quotation in a dynamic scope where " { $link stdio } " is rebound to the new stream." }
-{ $notes "This word provides a default implementation for the " { $link with-stream-style } " generic word that methods can call. It should not be used outside this context, since some streams require a custom definition of " { $link with-stream-style } "." } ;
diff --git a/core/io/null-stream.factor b/core/io/null-stream.factor
deleted file mode 100644 (file)
index 8410485..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-IN: io
-USING: kernel ;
-
-! Think '/dev/null'.
-M: f stream-close drop ;
-M: f set-timeout 2drop ;
-
-M: f stream-readln drop f ;
-M: f stream-read1 drop f ;
-M: f stream-read 2drop f ;
-
-M: f stream-write1 2drop ;
-M: f stream-write 2drop ;
-M: f stream-terpri drop ;
-M: f stream-flush drop ;
-
-M: f stream-format 3drop ;
-M: f with-nested-stream rot drop with-stream* ;
diff --git a/core/io/plain-stream.factor b/core/io/plain-stream.factor
deleted file mode 100644 (file)
index e564201..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: generic hashtables kernel math namespaces sequences
-strings styles ;
-
-TUPLE: plain-writer ;
-
-C: plain-writer ( stream -- stream ) [ set-delegate ] keep ;
-
-M: plain-writer stream-terpri CHAR: \n swap stream-write1 ;
-
-M: plain-writer stream-format
-    highlight rot hash [ >r >upper r> ] when stream-write ;
-
-M: plain-writer with-nested-stream
-    nip swap with-stream* ;
-
-M: plain-writer with-stream-style
-    (with-stream-style) ;
diff --git a/core/io/plain-stream.facts b/core/io/plain-stream.facts
deleted file mode 100644 (file)
index 4e2509f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: help io ;
-
-HELP: <plain-writer>
-{ $values { "stream" "an input stream" } { "new-stream" "an input stream" } }
-{ $description "Wraps an input stream in a stream supporting the extended stream output protocol in a trivial way." }
-{ $notes "Stream constructors should call this word to wrap streams that do not natively support the extended stream output protocol." }
-{ $see-also "stream-protocol" } ;
diff --git a/core/io/server.factor b/core/io/server.factor
deleted file mode 100644 (file)
index bb6d1c1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-! Copyright (C) 2003, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: errors io kernel math namespaces parser sequences strings
-threads ;
-
-SYMBOL: log-stream
-
-: log-message ( str -- )
-    log-stream get [ stream-print ] keep stream-flush ;
-
-: log-error ( str -- ) "Error: " swap append log-message ;
-
-: log-client ( client -- )
-    [
-        "Accepted connection from " %
-        dup client-stream-host %
-        CHAR: : ,
-        client-stream-port # 
-    ] "" make log-message ;
-
-: with-log-file ( path quot -- )
-    [ swap <file-writer> log-stream set call ] with-scope ;
-
-: with-logging ( quot -- )
-    [ stdio get log-stream set call ] with-scope ;
-
-: with-client ( quot client -- )
-    dup log-client [ swap with-stream ] in-thread 2drop ;
-    inline
-
-SYMBOL: server-stream
-
-: server-loop ( quot -- )
-    server-stream get accept over
-    >r with-client r> server-loop ; inline
-
-: with-server ( port ident quot -- )
-    >r >r <server> dup r> set r> swap [
-        server-stream set
-        [ server-loop ]
-        [ server-stream get stream-close ] cleanup
-    ] with-logging ; inline
diff --git a/core/io/server.facts b/core/io/server.facts
deleted file mode 100644 (file)
index 8b352e4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-USING: help io ;
-
-HELP: log-stream
-{ $var-description "Holds an output stream for logging messages." }
-{ $see-also log-error log-client with-log-file with-logging } ;
-
-HELP: log-message
-{ $values { "str" "a string" } }
-{ $description "Logs a message to the log stream. If " { $link log-stream } " is not set, logs to the " { $link stdio } " stream." }
-{ $see-also log-error log-client } ;
-
-HELP: log-error
-{ $values { "str" "a string" } }
-{ $description "Logs an error message." }
-{ $see-also log-message log-client } ;
-
-HELP: log-client
-{ $values { "client" "a client socket stream" } }
-{ $description "Logs an incoming client connection." }
-{ $see-also log-message log-error } ;
-
-HELP: with-log-file
-{ $values { "path" "a string" } { "quot" "a quotation" } }
-{ $description "Calls the quotation in a new dynamic scope where the " { $link log-stream } " is set to a file output stream writing to " { $snippet "path" } "." } ;
-
-HELP: with-logging
-{ $values { "quot" "a quotation" } }
-{ $description "Calls the quotation in a new dynamic scope where the " { $link log-stream } " is set to the " { $link stdio } " stream " { $emphasis "at this point in time" } "." } ;
-
-HELP: with-client
-{ $values { "quot" "a quotation" } { "client" "a client socket stream" } }
-{ $description "Logs a client connection and spawns a new thread that calls the quotation, with the " { $link stdio } " stream set to the client stream. If the quotation throws an error, the client connection is closed, and the error is printed to the " { $link stdio } " stream at the time the thread was spawned." } ;
-
-HELP: server-stream
-{ $var-description "Current server socket, set by " { $link with-server } "." } ;
-
-HELP: with-server
-{ $values { "port" "an integer from 0 to 65535" } { "ident" "a symbol" } { "quot" "a quotation" } }
-{ $description "Starts a TCP/IP server. The quotation is called in a new thread for each client connection, with the client connection being the " { $link stdio } " stream. Client connections are logged to the " { $link stdio } " stream at the time the server was started."
-$terpri
-"The socket server is stored in the " { $snippet "ident" } " variable. If " { $link with-server } " was called inside a new thread, this allows other threads to stop the server by passing the variable value to " { $link stream-close } "." } ;
diff --git a/core/io/stdio.factor b/core/io/stdio.factor
deleted file mode 100644 (file)
index 1fc6a7d..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: errors generic hashtables kernel namespaces sequences
-strings styles ;
-
-! Default stream
-SYMBOL: stdio
-
-: close ( -- ) stdio get stream-close ;
-
-: readln ( -- str/f ) stdio get stream-readln ;
-: read1 ( -- ch/f ) stdio get stream-read1 ;
-: read ( n -- str/f ) stdio get stream-read ;
-
-: write1 ( ch -- ) stdio get stream-write1 ;
-: write ( str -- ) stdio get stream-write ;
-: flush ( -- ) stdio get stream-flush ;
-
-: terpri ( -- ) stdio get stream-terpri ;
-: format ( str style -- ) stdio get stream-format ;
-
-: with-nesting ( style quot -- )
-    swap stdio get with-nested-stream ;
-
-: tabular-output ( grid style quot -- )
-    swap stdio get with-stream-table ;
-
-: with-style ( style quot -- )
-    swap dup hash-empty?
-    [ drop call ] [ stdio get with-stream-style ] if ;
-
-: print ( string -- ) stdio get stream-print ;
-
-: with-stream* ( stream quot -- )
-    [ swap stdio set call ] with-scope ; inline
-
-: with-stream ( stream quot -- )
-    swap [ [ close ] cleanup ] with-stream* ; inline
-
-: bl ( -- ) " " write ;
-
-: write-object ( str obj -- )
-    presented associate format ;
-
-: write-outliner ( str obj content -- )
-    outline associate [ write-object ] with-nesting ;
diff --git a/core/io/stdio.facts b/core/io/stdio.facts
deleted file mode 100644 (file)
index 039d700..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-USING: help io ;
-
-HELP: stdio
-{ $var-description "Holds a stream, used for various implicit stream operations. Rebound using " { $link with-stream } " and " { $link with-stream* } "." } ;
-
-HELP: close
-{ $contract "Closes the " { $link stdio } " stream." } 
-$io-error ;
-
-HELP: readln
-{ $values { "str/f" "a string or " { $link f } } }
-{ $contract "Reads a line of input from the " { $link stdio } " stream. Outputs " { $link f } " on stream exhaustion." }
-$io-error ;
-
-HELP: read1
-{ $values { "ch/f" "a character or " { $link f } } }
-{ $contract "Reads a character of input from the " { $link stdio } " stream. Outputs " { $link f } " on stream exhaustion." }
-$io-error ;
-
-HELP: read
-{ $values { "str/f" "a string or " { $link f } } }
-{ $contract "Reads " { $snippet "n" } " characters of input from the " { $link stdio } " stream. Outputs a truncated string or " { $link f } " on stream exhaustion." }
-$io-error ;
-
-HELP: write1
-{ $values { "ch" "a character" } }
-{ $contract "Writes a character of output to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
-$io-error ;
-
-HELP: write
-{ $values { "str" "a string" } }
-{ $contract "Writes a string of output to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
-$io-error ;
-
-HELP: flush
-{ $contract "Waits for any pending output to the " { $link stdio } " stream to complete." }
-$io-error ;
-
-HELP: terpri
-{ $contract "Writes a line terminator to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
-$io-error ;
-
-HELP: format
-{ $values { "str" "a string" } { "style" "a hashtable" } }
-{ $contract "Writes formatted text to the " { $link stdio } " stream. If the stream does buffering, output may not be performed immediately; use " { $link flush } " to force output." }
-{ $notes "Details are in the documentation for " { $link stream-format } "." }
-$io-error ;
-
-HELP: with-nesting
-{ $values { "style" "a hashtable" } { "quot" "a quotation" } }
-{ $contract "Calls the quotation in a new dynamic scope with the " { $link stdio } " stream rebound to a nested paragraph stream, with formatting information applied." }
-{ $notes "Details are in the documentation for " { $link stream-format } "." }
-$io-error ;
-
-HELP: tabular-output
-{ $values { "grid" "a sequence of equal-length sequences" } { "style" "a hashtable" } { "quot" "a quotation" } }
-{ $description "Calls the quotation with each element of the grid in turn, each time in a new dynamic scope with " { $link stdio } " rebound to a new stream. The results are laid out in a tabular fashion on the " { $link stdio } " stream." }
-{ $notes "Details are in the documentation for " { $link with-stream-table } "." }
-$io-error ;
-
-HELP: with-style
-{ $values { "style" "a hashtable" } { "quot" "a quotation" } }
-{ $description "Calls the quotation in a new dynamic scope where calls to " { $link write } ", " { $link format } " and other stream output words automatically inherit style settings from " { $snippet "style" } "." }
-{ $notes "Details are in the documentation for " { $link with-stream-style } "." }
-$io-error ;
-
-HELP: print
-{ $values { "string" "a string" } }
-{ $description "Writes a newline-terminated string to the " { $link stdio } " stream." }
-$io-error ;
-
-HELP: with-stream
-{ $values { "stream" "an input or output stream" } { "quot" "a quotation" } }
-{ $description "Calls the quotation in a new dynamic scope, with the " { $link stdio } " variable rebound to  " { $snippet "stream" } ". The stream is closed if the quotation returns or throws an error." } 
-{ $see-also with-stream* } ;
-
-HELP: with-stream*
-{ $values { "stream" "an input or output stream" } { "quot" "a quotation" } }
-{ $description "Calls the quotation in a new dynamic scope, with the " { $link stdio } " variable rebound to  " { $snippet "stream" } "." }
-{ $notes "This word differs from " { $link with-stream } " in that if an error is thrown while the quotation is executing, the stream is " { $emphasis "not" } " closed." }
-{ $see-also with-stream } ;
-
-HELP: bl
-{ $description "Outputs a space character (" { $snippet "\" \"" } ")." }
-$io-error ;
-
-HELP: write-object
-{ $values { "str" "a string" } { "obj" "an object" } }
-{ $description "Writes a string to the " { $link stdio } " stream, associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." }
-$io-error ;
-
-HELP: write-outliner
-{ $values { "str" "a string" } { "obj" "an object" } { "content" "a quotation" } }
-{ $description "Writes an outliner to the " { $link stdio } " stream. The outliner's caption is a the string " { $snippet "str" } " with an associated presentation of " { $snippet "obj" } ". Expanding the outliner calls " { $snippet "content" } " in a new dynamic scope with " { $link stdio } " rebound to the body of the outliner. If the stream does not support formatted output, this simply writes " { $snippet "str" } " and ignores everything else." }
-$io-error ;
diff --git a/core/io/stream.factor b/core/io/stream.factor
deleted file mode 100644 (file)
index 1bd848c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-! Copyright (C) 2003, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: errors hashtables generic kernel math namespaces
-sequences strings ;
-
-GENERIC: stream-close ( stream -- )
-GENERIC: set-timeout ( n stream -- )
-GENERIC: stream-readln ( stream -- str )
-GENERIC: stream-read1 ( stream -- ch/f )
-GENERIC: stream-read ( n stream -- str/f )
-GENERIC: stream-write1 ( ch stream -- )
-GENERIC: stream-write ( str stream -- )
-GENERIC: stream-flush ( stream -- )
-GENERIC: stream-terpri ( stream -- )
-GENERIC: stream-format ( str style stream -- )
-GENERIC: with-nested-stream ( quot style stream -- )
-GENERIC: with-stream-table ( grid quot style stream -- )
-GENERIC: with-stream-style ( quot style stream -- )
-
-: stream-print ( str stream -- )
-    [ stream-write ] keep stream-terpri ;
-
-: (stream-copy) ( in out -- )
-    4096 pick stream-read
-    [ over stream-write (stream-copy) ] [ 2drop ] if* ;
-
-: stream-copy ( in out -- )
-    [ 2dup (stream-copy) ] [ stream-close stream-close ] cleanup ;
diff --git a/core/io/stream.facts b/core/io/stream.facts
deleted file mode 100644 (file)
index d96b519..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-USING: help io ;
-
-HELP: stream-close
-{ $values { "stream" "a stream" } }
-{ $contract "Closes the stream. This releases any external resources associated with the stream, such as file handles and network connections. No further operations can be performed on the stream after this call." }
-{ $notes "You must close streams after you are finished working with them. A convenient way to automate this is by using the " { $link with-stream } " word." }
-$io-error ;
-
-HELP: set-timeout
-{ $values { "n" "an integer" } { "stream" "a stream" } }
-{ $contract "Sets a timeout, in milliseconds, for closing the stream if there is no activity. Not all streams support timeouts." } 
-$io-error ;
-
-HELP: stream-readln
-{ $values { "stream" "an input stream" } { "str" "a string" } }
-{ $contract "Reads a line of input from the stream. Outputs " { $link f } " on stream exhaustion." }
-$io-error ;
-
-HELP: stream-read1
-{ $values { "stream" "an input stream" } }
-{ $contract "Reads a character of input from the stream. Outputs " { $link f } " on stream exhaustion." }
-$io-error ;
-
-HELP: stream-read
-{ $values { "n" "a non-negative integer" } { "stream" "an input stream" } { "str/f" "a string or " { $link f } } }
-{ $contract "Reads " { $snippet "n" } " characters of input from the stream. Outputs a truncated string or " { $link f } " on stream exhaustion." }
-$io-error ;
-
-HELP: stream-write1
-{ $values { "ch" "a character" } { "stream" "an output stream" } }
-{ $contract "Writes a character of output to the stream. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
-$io-error ;
-
-HELP: stream-write
-{ $values { "str" "a string" } { "stream" "an output stream" } }
-{ $contract "Writes a string of output to the stream. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
-$io-error ;
-
-HELP: stream-flush
-{ $values { "stream" "an output stream" } }
-{ $contract "Waits for any pending output to complete." }
-{ $notes "With many output streams, written output is buffered and not sent to the underlying resource until either the buffer is full, or this word is called." }
-$io-error ;
-
-HELP: stream-terpri
-{ $values { "stream" "an output stream" } }
-{ $contract "Writes a line terminator. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output." }
-$io-error ;
-
-HELP: stream-format
-{ $values { "str" "a string" } { "style" "a hashtable" } { "stream" "an output stream" } }
-{ $contract "Writes formatted text to the stream. If the stream does buffering, output may not be performed immediately; use " { $link stream-flush } " to force output."
-$terpri
-"The " { $snippet "style" } " hashtable holds character style information. See " { $link "character-styles" } "." }
-$io-error ;
-
-HELP: with-nested-stream
-{ $values { "quot" "a quotation" } { "style" "a hashtable" } { "stream" "an output stream" } }
-{ $contract "Calls the quotation in a new dynamic scope with the " { $link stdio } " stream rebound to a nested paragraph stream, with formatting information applied."
-$terpri
-"Unlike " { $link with-stream-style } ", this creates a new paragraph block in the output."
-$terpri
-"The " { $snippet "style" } " hashtable holds paragraph style information. See " { $link "paragraph-styles" } "." }
-$io-error ;
-
-HELP: with-stream-table
-{ $values { "grid" "a sequence of equal-length sequences" } { "quot" "a quotation" } { "style" "a hashtable" } { "stream" "an output stream" } }
-{ $description "Calls the quotation with each element of the grid in turn, each time in a new dynamic scope with " { $link stdio } " rebound to a new stream. The results are laid out in a tabular fashion on " { $snippet "stream" } "."
-$terpri
-"The " { $snippet "style" } " hashtable holds table style information. See " { $link "table-styles" } "." }
-$io-error ;
-
-HELP: with-stream-style
-{ $values { "style" "a hashtable" } { "quot" "a quotation" } { "stream" "an output stream" } }
-{ $description "Calls the quotation in a new dynamic scope where calls to " { $link write } ", " { $link format } " and other stream output words automatically inherit style settings from " { $snippet "style" } "."
-$terpri
-"Unlike " { $link with-nested-stream } ", the quotation's output is inline, and not nested in a paragraph block." }
-$io-error ;
-
-HELP: stream-print
-{ $values { "str" "a string" } { "stream" "an output stream" } }
-{ $description "Writes a newline-terminated string." }
-$io-error ;
-
-HELP: stream-copy
-{ $values { "in" "an input stream" } { "out" "an output stream" } }
-{ $description "Copies the contents of one stream into another, closing both streams when done." } 
-$io-error ;
diff --git a/core/io/streams/c/authors.txt b/core/io/streams/c/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/streams/c/c-docs.factor b/core/io/streams/c/c-docs.factor
new file mode 100644 (file)
index 0000000..af81362
--- /dev/null
@@ -0,0 +1,73 @@
+USING: help.markup help.syntax io io.files threads
+strings byte-arrays io.streams.lines io.streams.plain ;
+IN: io.streams.c
+
+ARTICLE: "io.streams.c" "ANSI C streams"
+"C streams are found in the " { $vocab-link "io.streams.c" } " vocabulary; they are " { $link "stream-protocol" } " implementations which read and write C " { $snippet "FILE*" } " handles."
+{ $subsection <c-reader> }
+{ $subsection <c-writer> }
+{ $subsection <duplex-c-stream> }
+"Underlying primitives used to implement the above:"
+{ $subsection fopen }
+{ $subsection fwrite }
+{ $subsection fflush }
+{ $subsection fclose }
+{ $subsection fgetc }
+{ $subsection fread }
+"Two standard file handles:"
+{ $subsection stdin }
+{ $subsection stdout } ;
+
+ABOUT: "io.streams.c"
+
+HELP: <c-reader> ( in -- stream )
+{ $values { "in" "a C FILE* handle" } { "stream" "a new stream" } }
+{ $description "Creates a stream which reads data by calling C standard library functions." }
+{ $notes "Usually C streams are only used during bootstrap, and non-blocking OS-specific I/O routines are used during normal operation." } ;
+
+HELP: <c-writer> ( out -- stream )
+{ $values { "out" "a C FILE* handle" } { "stream" "a new stream" } }
+{ $description "Creates a stream which writes data by calling C standard library functions." }
+{ $notes "Usually C streams are only used during bootstrap, and non-blocking OS-specific I/O routines are used during normal operation." } ;
+
+HELP: <duplex-c-stream>
+{ $values { "in" "a C FILE* handle" } { "out" "a C FILE* handle" } { "stream" "a new stream" } }
+{ $description "Creates a stream which reads and writes data by calling C standard library functions, wrapping the input portion in a " { $link line-reader } " and the output portion in a " { $link plain-writer } "." } ;
+
+HELP: fopen ( path mode -- alien )
+{ $values { "path" "a pathname string" } { "mode" "an access mode specifier" } { "alien" "a C FILE* handle" } }
+{ $description "Opens a file named by " { $snippet "path" } ". The " { $snippet "mode" } " parameter should be something like " { $snippet "\"r\"" } " or " { $snippet "\"rw\"" } "; consult the " { $snippet "fopen(3)" } " manual page for details." }
+{ $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." }
+{ $errors "Throws an error if the output operation failed." } ;
+
+HELP: fflush ( alien -- )
+{ $values { "alien" "a C FILE* handle" } }
+{ $description "Forces pending output on a C FILE* handle to complete." }
+{ $errors "Throws an error if the output operation failed." } ;
+
+HELP: fclose ( alien -- )
+{ $values { "alien" "a C FILE* handle" } }
+{ $description "Closes a C FILE* handle." } ;
+
+HELP: fgetc ( alien -- ch/f )
+{ $values { "alien" "a C FILE* handle" } { "ch/f" "a character or " { $link f } } }
+{ $description "Reads a single character from a C FILE* handle, and outputs " { $link f } " on end of file." } 
+{ $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 } } }
+{ $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." } ;
+
+HELP: stdin
+{ $values { "in" "a C FILE* handle" } }
+{ $description "Outputs the console standard input file handle." } ;
+
+HELP: stdout
+{ $values { "out" "a C FILE* handle" } }
+{ $description "Outputs the console standard output file handle." } ;
diff --git a/core/io/streams/c/c.factor b/core/io/streams/c/c.factor
new file mode 100644 (file)
index 0000000..48c08eb
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel kernel.private namespaces io
+strings sequences math generic threads.private classes
+io.backend io.streams.lines io.streams.plain io.streams.duplex
+io.files ;
+IN: io.streams.c
+
+TUPLE: c-writer handle ;
+
+C: <c-writer> c-writer
+
+M: c-writer stream-write1
+    >r 1string r> stream-write ;
+
+M: c-writer stream-write
+    c-writer-handle fwrite ;
+
+M: c-writer stream-flush
+    c-writer-handle fflush ;
+
+M: c-writer stream-close
+    c-writer-handle fclose ;
+
+TUPLE: c-reader handle ;
+
+C: <c-reader> c-reader
+
+M: c-reader stream-read
+    >r >fixnum r> c-reader-handle fread ;
+
+M: c-reader stream-read1
+    c-reader-handle fgetc ;
+
+: read-until-loop ( stream delim -- ch )
+    over stream-read1 dup [
+        dup pick memq? [ 2nip ] [ , read-until-loop ] if
+    ] [
+        2nip
+    ] if ;
+
+M: c-reader stream-read-until
+    [ swap read-until-loop ] "" make swap
+    over empty? over not and [ 2drop f f ] when ;
+
+M: c-reader stream-close
+    c-reader-handle fclose ;
+
+: <duplex-c-stream> ( in out -- stream )
+    >r <c-reader> <line-reader> r>
+    <c-writer> <plain-writer>
+    <duplex-stream> ;
+
+M: object init-io ;
+
+: stdin 11 getenv ;
+
+: stdout 12 getenv ;
+
+M: object init-stdio
+    stdin stdout <duplex-c-stream> stdio set ;
+
+M: object io-multiplex (sleep) ;
+
+M: object <file-reader>
+    "rb" fopen <c-reader> <line-reader> ;
+
+M: object <file-writer>
+    "wb" fopen <c-writer> <plain-writer> ;
+
+M: object <file-appender>
+    "ab" fopen <c-writer> <plain-writer> ;
diff --git a/core/io/streams/c/summary.txt b/core/io/streams/c/summary.txt
new file mode 100644 (file)
index 0000000..2c33b2a
--- /dev/null
@@ -0,0 +1 @@
+Bare-bones ANSI C I/O implementation
diff --git a/core/io/streams/duplex/authors.txt b/core/io/streams/duplex/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/streams/duplex/duplex-docs.factor b/core/io/streams/duplex/duplex-docs.factor
new file mode 100644 (file)
index 0000000..6293836
--- /dev/null
@@ -0,0 +1,22 @@
+USING: help.markup help.syntax io ;
+IN: io.streams.duplex
+
+ARTICLE: "io.streams.duplex" "Duplex streams"
+"Duplex streams combine an input stream and an output stream into a bidirectional stream."
+{ $subsection duplex-stream }
+{ $subsection <duplex-stream> }
+{ $subsection check-closed } ;
+
+ABOUT: "io.streams.duplex"
+
+HELP: duplex-stream
+{ $class-description "A bidirectional stream delegating to a pair of streams, sending input to one delegate and output to another." } ;
+
+HELP: <duplex-stream>
+{ $values { "in" "an input stream" } { "out" "an output stream" } { "stream" " a duplex stream" } }
+{ $description "Creates a duplex stream. Writing to a duplex stream will write to " { $snippet "out" } ", and reading from a duplex stream will read from " { $snippet "in" } ". Closing a duplex stream closes both the input and output streams." } ;
+
+HELP: check-closed
+{ $values { "stream" "a duplex stream" } }
+{ $description "Throws a " { $link check-closed } " error if the stream has already been closed." }
+{ $error-description "This error is thrown when performing an I/O operation on a " { $link duplex-stream } " which has been closed with " { $link stream-close } "." } ;
diff --git a/core/io/streams/duplex/duplex-tests.factor b/core/io/streams/duplex/duplex-tests.factor
new file mode 100644 (file)
index 0000000..a4a6433
--- /dev/null
@@ -0,0 +1,40 @@
+USING: io.streams.duplex io kernel continuations tools.test ;
+IN: temporary
+
+! Test duplex stream close behavior
+TUPLE: closing-stream closed? ;
+
+: <closing-stream> closing-stream construct-empty ;
+
+M: closing-stream stream-close
+    dup closing-stream-closed? [
+        "Closing twice!" throw
+    ] [
+        t swap set-closing-stream-closed?
+    ] if ;
+
+TUPLE: unclosable-stream ;
+
+: <unclosable-stream> unclosable-stream construct-empty ;
+
+M: unclosable-stream stream-close
+    "Can't close me!" throw ;
+
+[ ] [
+    <closing-stream> <closing-stream> <duplex-stream>
+    dup stream-close stream-close
+] unit-test
+
+[ t ] [
+    <unclosable-stream> <closing-stream> [
+        <duplex-stream>
+        [ dup stream-close ] catch 2drop
+    ] keep closing-stream-closed?
+] unit-test
+
+[ t ] [
+    <closing-stream> [ <unclosable-stream>
+        <duplex-stream>
+        [ dup stream-close ] catch 2drop
+    ] keep closing-stream-closed?
+] unit-test
diff --git a/core/io/streams/duplex/duplex.factor b/core/io/streams/duplex/duplex.factor
new file mode 100644 (file)
index 0000000..a46dad7
--- /dev/null
@@ -0,0 +1,81 @@
+! Copyright (C) 2005 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.streams.duplex
+USING: kernel continuations io ;
+
+! We ensure that the stream can only be closed once, to preserve
+! integrity of duplex I/O ports.
+
+TUPLE: duplex-stream in out closed? ;
+
+: <duplex-stream> ( in out -- stream )
+    f duplex-stream construct-boa ;
+
+TUPLE: check-closed ;
+
+: check-closed ( stream -- )
+    duplex-stream-closed?
+    [ \ check-closed construct-boa throw ] when ;
+
+: duplex-stream-in+ ( duplex -- stream )
+    dup check-closed duplex-stream-in ;
+
+: duplex-stream-out+ ( duplex -- stream )
+    dup check-closed duplex-stream-out ;
+
+M: duplex-stream stream-flush
+    duplex-stream-out+ stream-flush ;
+
+M: duplex-stream stream-readln
+    duplex-stream-in+ stream-readln ;
+
+M: duplex-stream stream-read1
+    duplex-stream-in+ stream-read1 ;
+
+M: duplex-stream stream-read-until
+    duplex-stream-in+ stream-read-until ;
+
+M: duplex-stream stream-read-partial
+    duplex-stream-in+ stream-read-partial ;
+
+M: duplex-stream stream-read
+    duplex-stream-in+ stream-read ;
+
+M: duplex-stream stream-write1
+    duplex-stream-out+ stream-write1 ;
+
+M: duplex-stream stream-write
+    duplex-stream-out+ stream-write ;
+
+M: duplex-stream stream-nl
+    duplex-stream-out+ stream-nl ;
+
+M: duplex-stream stream-format
+    duplex-stream-out+ stream-format ;
+
+M: duplex-stream make-span-stream
+    duplex-stream-out+ make-span-stream ;
+
+M: duplex-stream make-block-stream
+    duplex-stream-out+ make-block-stream ;
+
+M: duplex-stream make-cell-stream
+    duplex-stream-out+ make-cell-stream ;
+
+M: duplex-stream stream-write-table
+    duplex-stream-out+ stream-write-table ;
+
+M: duplex-stream stream-close
+    #! The output stream is closed first, in case both streams
+    #! are attached to the same file descriptor, the output
+    #! buffer needs to be flushed before we close the fd.
+    dup duplex-stream-closed? [
+        t over set-duplex-stream-closed?
+        [ dup duplex-stream-out stream-close ]
+        [ dup duplex-stream-in stream-close ] [ ] cleanup
+    ] unless drop ;
+
+M: duplex-stream set-timeout
+    2dup
+    duplex-stream-in set-timeout
+    duplex-stream-out set-timeout ;
diff --git a/core/io/streams/duplex/summary.txt b/core/io/streams/duplex/summary.txt
new file mode 100644 (file)
index 0000000..b15d3aa
--- /dev/null
@@ -0,0 +1 @@
+Combine an input and an output stream into a single duplex stream
diff --git a/core/io/streams/lines/authors.txt b/core/io/streams/lines/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/streams/lines/lines-docs.factor b/core/io/streams/lines/lines-docs.factor
new file mode 100644 (file)
index 0000000..789a060
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax io strings ;
+IN: io.streams.lines
+
+ARTICLE: "io.streams.lines" "Line reader streams"
+"Line reader streams wrap an underlying stream and provide a default implementation of " { $link stream-readln } "."
+{ $subsection line-reader }
+{ $subsection <line-reader> } ;
+
+ABOUT: "io.streams.lines"
+
+HELP: line-reader
+{ $class-description "An input stream which delegates to an underlying stream while providing an implementation of the " { $link stream-readln } " word in terms of the underlying stream's " { $link stream-read-until } ". Line readers are created by calling " { $link <line-reader> } "." } ;
+
+HELP: <line-reader>
+{ $values { "stream" "an input stream" } { "new-stream" "an input stream" } }
+{ $description "Creates a new " { $link line-reader } "." }
+{ $notes "Stream constructors should call this word to wrap streams that do not natively support reading lines. Unix (" { $snippet "\\n" } "), Windows (" { $snippet "\\r\\n" } ") and MacOS (" { $snippet "\\r" } ") line endings are supported." } ;
diff --git a/core/io/streams/lines/lines-tests.factor b/core/io/streams/lines/lines-tests.factor
new file mode 100644 (file)
index 0000000..b09711b
--- /dev/null
@@ -0,0 +1,50 @@
+USING: io.streams.lines io.files io.streams.string io
+tools.test kernel ;
+IN: temporary
+
+: <resource-reader> ( resource -- stream )
+    resource-path <file-reader> ;
+    
+[ { } ]
+[ "/core/io/test/empty-file.txt" <resource-reader> lines ]
+unit-test
+
+: lines-test ( stream -- line1 line2 )
+    [ readln readln ] with-stream ;
+
+[
+    "This is a line."
+    "This is another line."
+] [
+    "/core/io/test/windows-eol.txt" <resource-reader> lines-test
+] unit-test
+
+[
+    "This is a line."
+    "This is another line."
+] [
+    "/core/io/test/mac-os-eol.txt" <resource-reader> lines-test
+] unit-test
+
+[
+    "This is a line."
+    "This is another line."
+] [
+    "/core/io/test/unix-eol.txt" <resource-reader> lines-test
+] unit-test
+
+[
+    "1234"
+] [
+     "Hello world\r\n1234" <string-reader>
+     dup stream-readln drop
+     4 swap stream-read
+] unit-test
+
+[
+    CHAR: 1
+] [
+     "Hello world\r\n1234" <string-reader>
+     dup stream-readln drop
+     stream-read1
+] unit-test
diff --git a/core/io/streams/lines/lines.factor b/core/io/streams/lines/lines.factor
new file mode 100644 (file)
index 0000000..3de8bdc
--- /dev/null
@@ -0,0 +1,46 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.streams.lines
+USING: arrays generic io kernel math namespaces sequences
+vectors combinators splitting ;
+
+TUPLE: line-reader cr ;
+
+: <line-reader> ( stream -- new-stream )
+    line-reader construct-delegate ;
+
+: cr+ t swap set-line-reader-cr ; inline
+
+: cr- f swap set-line-reader-cr ; inline
+
+: line-ends/eof ( stream str -- str ) f like swap cr- ; inline
+
+: line-ends\r ( stream str -- str ) swap cr+ ; inline
+
+: line-ends\n ( stream str -- str )
+    over line-reader-cr over empty? and
+    [ drop dup cr- stream-readln ] [ swap cr- ] if ; inline
+
+: handle-readln ( stream str ch -- str )
+    {
+        { f [ line-ends/eof ] }
+        { CHAR: \r [ line-ends\r ] }
+        { CHAR: \n [ line-ends\n ] }
+    } case ;
+
+M: line-reader stream-readln ( stream -- str )
+    "\r\n" over delegate stream-read-until handle-readln ;
+
+: fix-read ( stream string -- string )
+    "\n" ?head [ swap stream-read1 [ add ] when* ] [ nip ] if ;
+
+M: line-reader stream-read
+    tuck delegate stream-read
+    over line-reader-cr [ over cr- fix-read ] [ nip ] if ;
+
+: fix-read1 ( stream char -- char )
+    dup CHAR: \n = [ drop stream-read1 ] [ nip ] if ;
+
+M: line-reader stream-read1 ( stream -- char )
+    dup delegate stream-read1
+    over line-reader-cr [ over cr- fix-read1 ] [ nip ] if ;
diff --git a/core/io/streams/lines/summary.txt b/core/io/streams/lines/summary.txt
new file mode 100644 (file)
index 0000000..8c0c096
--- /dev/null
@@ -0,0 +1 @@
+Read lines of text from a character-oriented stream
diff --git a/core/io/streams/nested/authors.txt b/core/io/streams/nested/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/streams/nested/nested-docs.factor b/core/io/streams/nested/nested-docs.factor
new file mode 100644 (file)
index 0000000..e7e18e3
--- /dev/null
@@ -0,0 +1,2 @@
+USING: io io.streams.nested help.markup help.syntax ;
+
diff --git a/core/io/streams/nested/nested-tests.factor b/core/io/streams/nested/nested-tests.factor
new file mode 100644 (file)
index 0000000..fea88cf
--- /dev/null
@@ -0,0 +1,23 @@
+USING: io io.streams.string io.streams.nested kernel math
+namespaces io.styles tools.test ;
+IN: temporary
+
+[ "=>a<=" ] [
+    [
+        [
+            H{ { highlight t } } [
+                H{ } [ "a" write ] with-nesting
+            ] with-style
+        ] string-out
+    ] with-scope
+] unit-test
+
+[ "a" ] [
+    [
+        [
+            H{ } [
+                H{ { highlight t } } [ "a" write ] with-nesting
+            ] with-style
+        ] string-out
+    ] with-scope
+] unit-test
diff --git a/core/io/streams/nested/nested.factor b/core/io/streams/nested/nested.factor
new file mode 100644 (file)
index 0000000..83a86a9
--- /dev/null
@@ -0,0 +1,47 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.streams.nested
+USING: arrays generic assocs kernel namespaces strings
+quotations io ;
+
+TUPLE: ignore-close-stream ;
+
+: <ignore-close-stream> ignore-close-stream construct-delegate ;
+
+M: ignore-close-stream stream-close drop ;
+
+TUPLE: style-stream style ;
+
+: do-nested-style ( style stream -- style delegate )
+    [ style-stream-style swap union ] keep
+    delegate ; inline
+
+: <style-stream> ( style delegate -- stream )
+    { set-style-stream-style set-delegate }
+    style-stream construct ;
+
+M: style-stream stream-format
+    do-nested-style stream-format ;
+
+M: style-stream stream-write
+    dup style-stream-style swap delegate stream-format ;
+
+M: style-stream stream-write1
+    >r 1string r> stream-write ;
+
+M: style-stream make-span-stream
+    do-nested-style make-span-stream ;
+
+M: style-stream make-block-stream
+    [ do-nested-style make-block-stream ] keep
+    style-stream-style swap <style-stream> ;
+
+M: style-stream make-cell-stream
+    [ do-nested-style make-cell-stream ] keep
+    style-stream-style swap <style-stream> ;
+
+TUPLE: block-stream ;
+
+: <block-stream> block-stream construct-delegate ;
+
+M: block-stream stream-close drop ;
diff --git a/core/io/streams/nested/summary.txt b/core/io/streams/nested/summary.txt
new file mode 100644 (file)
index 0000000..cf1c662
--- /dev/null
@@ -0,0 +1 @@
+Support for with-stream-style implementation
diff --git a/core/io/streams/plain/authors.txt b/core/io/streams/plain/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/streams/plain/plain-docs.factor b/core/io/streams/plain/plain-docs.factor
new file mode 100644 (file)
index 0000000..4d7c5cc
--- /dev/null
@@ -0,0 +1,24 @@
+USING: help.markup help.syntax io ;
+IN: io.streams.plain
+
+ARTICLE: "io.streams.plain" "Plain writer streams"
+"Plain writer streams wrap an underlying stream and provide a default implementation of "
+{ $link stream-nl } ", "
+{ $link stream-format } ", "
+{ $link make-span-stream } ", "
+{ $link make-block-stream } " and "
+{ $link make-cell-stream } "."
+{ $subsection plain-writer }
+{ $subsection <plain-writer> } ;
+
+ABOUT: "io.streams.plain"
+
+HELP: plain-writer
+{ $class-description "An output stream which delegates to an underlying stream while providing an implementation of the extended stream output protocol in a trivial way. Plain writers are created by calling " { $link <plain-writer> } "." }
+{ $see-also "stream-protocol" } ;
+
+HELP: <plain-writer>
+{ $values { "stream" "an input stream" } { "new-stream" "an input stream" } }
+{ $description "Creates a new " { $link plain-writer } "." }
+{ $notes "Stream constructors should call this word to wrap streams that do not natively support the extended stream output protocol." }
+{ $see-also "stream-protocol" } ;
diff --git a/core/io/streams/plain/plain.factor b/core/io/streams/plain/plain.factor
new file mode 100644 (file)
index 0000000..0647ee5
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.streams.plain
+USING: generic assocs kernel math namespaces sequences
+io.styles io io.streams.nested ;
+
+TUPLE: plain-writer ;
+
+: <plain-writer> ( stream -- new-stream )
+    plain-writer construct-delegate ;
+
+M: plain-writer stream-nl CHAR: \n swap stream-write1 ;
+
+M: plain-writer stream-format
+    highlight rot at
+    [ >r "=>" swap "<=" 3append r> ] when
+    stream-write ;
+
+M: plain-writer make-span-stream
+    <style-stream> <ignore-close-stream> ;
+
+M: plain-writer make-block-stream
+    nip <ignore-close-stream> ;
diff --git a/core/io/streams/plain/summary.txt b/core/io/streams/plain/summary.txt
new file mode 100644 (file)
index 0000000..efb4367
--- /dev/null
@@ -0,0 +1 @@
+Extended stream output protocol implementation for character-oriented output streams
diff --git a/core/io/streams/string/authors.txt b/core/io/streams/string/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/streams/string/string-docs.factor b/core/io/streams/string/string-docs.factor
new file mode 100644 (file)
index 0000000..45238c8
--- /dev/null
@@ -0,0 +1,29 @@
+USING: help.markup help.syntax io strings quotations sequences ;
+IN: io.streams.string
+
+ARTICLE: "io.streams.string" "String streams"
+"String streams:"
+{ $subsection <string-reader> }
+{ $subsection <string-writer> }
+"Utility combinators:"
+{ $subsection string-in }
+{ $subsection string-out } ;
+
+ABOUT: "io.streams.string"
+
+HELP: <string-writer>
+{ $values { "stream" "an output stream" } }
+{ $description "Creates an output stream that collects text into a delegate string buffer. The contents of the buffer can be recovered by executing " { $link >string } ", and indeed all other sequence operations are permitted by virtue of the delegation." } ;
+
+HELP: string-out
+{ $values { "quot" quotation } { "str" string } }
+{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to a new string writer. The accumulated string is output when the quotation returns." } ;
+
+HELP: <string-reader>
+{ $values { "str" string } { "stream" "an input stream" } }
+{ $description "Creates a new stream for reading " { $snippet "str" } " from beginning to end." }
+{ $notes "The implementation exploits the ability of string buffers to respond to the input stream protocol by reading characters from the end of the buffer." } ;
+
+HELP: string-in
+{ $values { "str" string } { "quot" quotation } }
+{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to an input stream reading " { $snippet "str" } " from beginning to end. The accumulated string is output when the quotation returns." } ;
diff --git a/core/io/streams/string/string-tests.factor b/core/io/streams/string/string-tests.factor
new file mode 100644 (file)
index 0000000..9c8202a
--- /dev/null
@@ -0,0 +1,58 @@
+USING: io.streams.string io kernel arrays namespaces tools.test ;
+IN: temporary
+
+[ "line 1" CHAR: l ]
+[
+    "line 1\nline 2\nline 3" <string-reader>
+    dup stream-readln swap stream-read1
+]
+unit-test
+
+[ f ]
+[ "" <string-reader> stream-readln ]
+unit-test
+
+[ "xyzzy" ] [ [ "xyzzy" write ] string-out ] unit-test
+
+[ "a" ] [ 1 SBUF" cba" stream-read ] unit-test
+[ "ab" ] [ 2 SBUF" cba" stream-read ] unit-test
+[ "abc" ] [ 3 SBUF" cba" stream-read ] unit-test
+[ "abc" ] [ 4 SBUF" cba" stream-read ] unit-test
+[ "abc" f ] [
+    3 SBUF" cba" [ stream-read ] keep stream-read1
+] unit-test
+
+[
+    {
+        { "It seems " CHAR: J }
+        { "obs has lost h" CHAR: i }
+        { "s grasp on reality again.\n" f }
+    }
+] [
+    [
+        "It seems Jobs has lost his grasp on reality again.\n"
+        <string-reader> [
+            "J" read-until 2array ,
+            "i" read-until 2array ,
+            "X" read-until 2array ,
+        ] with-stream
+    ] { } make
+] unit-test
+
+[ "hello" "hi" ] [
+    "hello\nhi" <string-reader>
+    dup stream-readln
+    2 rot stream-read
+] unit-test
+
+[ "hello" "hi" ] [
+    "hello\r\nhi" <string-reader>
+    dup stream-readln
+    2 rot stream-read
+] unit-test
+
+[ "hello" "hi" ] [
+    "hello\rhi" <string-reader>
+    dup stream-readln
+    2 rot stream-read
+] unit-test
diff --git a/core/io/streams/string/string.factor b/core/io/streams/string/string.factor
new file mode 100644 (file)
index 0000000..9aaece6
--- /dev/null
@@ -0,0 +1,70 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.streams.string
+USING: io kernel math namespaces sequences sbufs strings
+generic splitting io.streams.plain io.streams.lines ;
+
+M: sbuf stream-write1 push ;
+M: sbuf stream-write push-all ;
+M: sbuf stream-close drop ;
+M: sbuf stream-flush drop ;
+
+: <string-writer> ( -- stream )
+    512 <sbuf> <plain-writer> ;
+
+: string-out ( quot -- str )
+    <string-writer> [ call stdio get >string ] with-stream* ;
+    inline
+
+: format-column ( seq ? -- seq )
+    [
+        [ 0 [ length max ] reduce ] keep
+        swap [ CHAR: \s pad-right ] curry map
+    ] unless ;
+
+: map-last ( seq quot -- seq )
+    swap dup length <reversed>
+    [ zero? rot [ call ] keep swap ] 2map nip ; inline
+
+: format-table ( table -- seq )
+    flip [ format-column ] map-last
+    flip [ " " join ] map ;
+
+M: plain-writer stream-write-table
+    [ drop format-table [ print ] each ] with-stream* ;
+
+M: plain-writer make-cell-stream 2drop <string-writer> ;
+
+M: sbuf stream-read1 dup empty? [ drop f ] [ pop ] if ;
+
+: sbuf-read-until ( sbuf n -- str )
+    tail-slice >string dup reverse-here ;
+
+: find-last-sep swap [ memq? ] curry find-last drop ;
+
+M: sbuf stream-read-until
+    [ find-last-sep ] keep over [
+        [ swap 1+ sbuf-read-until ] 2keep [ nth ] 2keep
+        set-length
+    ] [
+        [ swap drop 0 sbuf-read-until f like f ] keep
+        delete-all
+    ] if ;
+
+M: sbuf stream-read
+    dup empty? [
+        2drop f
+    ] [
+        [ length swap - 0 max ] keep
+        [ swap sbuf-read-until ] 2keep
+        set-length
+    ] if ;
+
+M: sbuf stream-read-partial
+    stream-read ;
+
+: <string-reader> ( str -- stream )
+    >sbuf dup reverse-here <line-reader> ;
+
+: string-in ( str quot -- )
+    >r <string-reader> r> with-stream ; inline
diff --git a/core/io/streams/string/summary.txt b/core/io/streams/string/summary.txt
new file mode 100644 (file)
index 0000000..2567c6a
--- /dev/null
@@ -0,0 +1 @@
+Reading and writing strings as streams
diff --git a/core/io/string-streams.factor b/core/io/string-streams.factor
deleted file mode 100644 (file)
index cf0c56d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-! Copyright (C) 2003, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: io kernel math namespaces sequences strings ;
-
-M: sbuf stream-write1 push ;
-M: sbuf stream-write swap nappend ;
-M: sbuf stream-close drop ;
-M: sbuf stream-flush drop ;
-
-: <string-writer> ( -- stream )
-    512 <sbuf> <plain-writer> ;
-
-: string-out ( quot -- str )
-    <string-writer> [ call stdio get >string ] with-stream* ;
-    inline
-
-: format-column ( seq ? -- seq )
-    [
-        [ 0 [ length max ] reduce ] keep
-        [ swap CHAR: \s pad-right ] map-with
-    ] unless ;
-
-: map-last ( seq quot -- seq )
-    swap dup length <reversed>
-    [ zero? rot [ call ] keep swap ] 2map nip ; inline
-
-M: plain-writer with-stream-table
-    [
-        drop swap
-        [ [ swap string-out ] map-with ] map-with
-        flip [ format-column ] map-last
-        flip [ " " join ] map
-        [ print ] each
-    ] with-stream* ;
-
-M: sbuf stream-read1
-    dup empty? [ drop f ] [ pop ] if ;
-
-M: sbuf stream-read
-    dup empty? [
-        2drop f
-    ] [
-        swap over length min 0 <string>
-        [ [ drop pop ] inject-with ] keep
-    ] if ;
-
-: <string-reader> ( str -- stream )
-    <reversed> >sbuf <line-reader> ;
-
-: string-in ( str quot -- )
-    >r <string-reader> r> with-stream ; inline
-
-: contents ( stream -- str )
-    <string-writer> [ stream-copy ] keep >string ;
-
-: string-lines ( string -- seq )
-    CHAR: \n add <string-reader> lines ;
diff --git a/core/io/string-streams.facts b/core/io/string-streams.facts
deleted file mode 100644 (file)
index e1664aa..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-USING: help io strings ;
-
-HELP: <string-writer>
-{ $values { "stream" "an output stream" } }
-{ $description "Creates an output stream that collects text into a delegate string buffer. The contents of the buffer can be recovered by executing " { $link >string } ", and indeed all other sequence operations are permitted by virtue of the delegation." } ;
-
-HELP: string-out
-{ $values { "quot" "a quotation" } { "str" "a string" } }
-{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to a new string writer. The accumulated string is output when the quotation returns." } ;
-
-HELP: <string-reader>
-{ $values { "str" "a string" } { "stream" "an input stream" } }
-{ $description "Creates a new stream for reading " { $snippet "str" } " from beginning to end." }
-{ $notes "The implementation exploits the ability of string buffers to respond to the input stream protocol by reading characters from the end of the buffer." } ;
-
-HELP: string-in
-{ $values { "str" "a string" } { "quot" "a quotation" } }
-{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to an input stream reading " { $snippet "str" } " from beginning to end. The accumulated string is output when the quotation returns." } ;
-
-HELP: contents
-{ $values { "stream" "an input stream" } { "str" "a string" } }
-{ $description "Reads the contents of a stream into a string." }
-$io-error ;
diff --git a/core/io/styles.factor b/core/io/styles.factor
deleted file mode 100644 (file)
index 9162341..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: styles
-
-SYMBOL: plain
-SYMBOL: bold
-SYMBOL: italic
-SYMBOL: bold-italic
-
-! Character styles
-SYMBOL: foreground
-SYMBOL: background
-SYMBOL: font
-SYMBOL: font-size
-SYMBOL: font-style
-SYMBOL: presented
-
-! Only for plain-stream
-SYMBOL: highlight
-
-! Paragraph styles
-SYMBOL: page-color
-SYMBOL: border-color
-SYMBOL: border-width
-SYMBOL: wrap-margin
-SYMBOL: outline
-
-! Table styles
-SYMBOL: table-gap
-SYMBOL: table-border
-
-! Input history
-TUPLE: input string ;
-
-! Vocabulary links
-TUPLE: vocab-link name ;
diff --git a/core/io/styles.facts b/core/io/styles.facts
deleted file mode 100644 (file)
index 8a0714d..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-USING: help styles io ;
-
-HELP: plain
-{ $description "A value for the " { $link font-style } " character style denoting plain text." } ;
-
-HELP: bold
-{ $description "A value for the " { $link font-style } " character style denoting boldface text." } ;
-
-HELP: italic
-{ $description "A value for the " { $link font-style } " character style denoting italicized text." } ;
-
-HELP: bold-italic
-{ $description "A value for the " { $link font-style } " character style denoting boldface italicized text." } ;
-
-HELP: foreground
-{ $description "Character style. Text color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } 
-{ $examples
-    { $code
-        "\"Hello world\" 10 ["
-            "    { 0.1 0.1 0.2 1 } n*v { 1 1 1 1 } vmin"
-            "    foreground associate format terpri"
-        "] each-with"
-    }
-} ;
-
-HELP: background
-{ $description "Character style. Background color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
-{ $examples
-    { $code
-        "\"Hello world\" 10 ["
-            "    { 0.1 0.4 0.1 } n*v { 1 1 1 } vmin { 1 } append"
-            "    background associate format terpri"
-        "] each-with"
-    }
-} ;
-
-HELP: font
-{ $description "Character style. Font family named by a string." }
-{ $examples
-    "This example outputs some different font sizes:"
-    { $code "{ \"monospace\" \"serif\" \"sans-serif\" }\n[ dup font associate format terpri ] each" }
-} ;
-
-HELP: font-size
-{ $description "Character style. Font size, an integer." }
-{ $examples
-    "This example outputs some different font sizes:"
-    { $code "\"Bigger\" { 12 18 24 72 }\n[ font-size associate format terpri ] each-with" }
-}  ;
-
-HELP: font-style
-{ $description "Character style. Font style, one of " { $link plain } ", " { $link bold } ", " { $link italic } ", or " { $link bold-italic } "." }
-{ $examples
-    "This example outputs text in all three styles:"
-    { $code "{ plain bold italic bold-italic }\n[ [ word-name ] keep font-style associate format terpri ] each" }
-}  ;
-
-HELP: presented
-{ $description "Character and paragraph style. An object associated with the text. In the Factor UI, this is shown as a clickable presentation of the object; left-clicking invokes a default command, and right-clicking shows a menu of commands." }
-{ $see-also write-object } ;
-
-HELP: highlight
-{ $description "Character style. Used to mark up text on streams that otherwise do not support different colors or font styles." }
-{ $examples "Instances of " { $link plain-writer } " uppercases highlighted text." } ;
-
-HELP: page-color
-{ $description "Paragraph style. Background color of the paragraph block, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } 
-{ $examples
-    { $code "H{ { page-color { 1 0.8 0.5 1 } } }\n[ \"A background\" write ] with-nesting terpri" }
-} ;
-
-HELP: border-color
-{ $description "Paragraph style. Border color of the paragraph block, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } 
-{ $examples
-    { $code "H{ { border-color { 1 0 0 1 } } }\n[ \"A border\" write ] with-nesting terpri" }
-} ;
-
-HELP: border-width
-{ $description "Paragraph style. Pixels between edge of text and border color, an integer." } 
-{ $examples
-    { $code "H{ { border-width 10 } }\n[ \"Some inset text\" write ] with-nesting terpri" }
-} ;
-
-HELP: wrap-margin
-{ $description "Paragraph style. Pixels between left margin and right margin where text is wrapped, an integer." }
-{ $see-also bl } ;
-
-HELP: outline
-{ $description "Paragraph style. In the Factor UI, a quotation executed to produce outliner content when the outliner widget next to the paragraph block is expanded." }
-{ $see-also write-outliner } ;
-
-HELP: table-gap
-{ $description "Table style. Horizontal and vertical gap between table cells, denoted by a pair of integers." }
-{ $see-also with-stream-table tabular-output } ;
-
-HELP: table-border
-{ $description "Table style. Color of the border drawn between cells, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
-{ $see-also with-stream-table tabular-output } ;
-
-HELP: input
-{ $class-description "Class of input text presentations.A wrapper class. Instances can be used passed to " { $link write-object } " to output a clickable piece of input." }
-{ $examples
-    "This presentation class is used for the code examples you see in the online help:"
-    { $code "\"2 3 + .\" dup <input> write-object terpri" }
-} ;
diff --git a/core/io/styles/authors.txt b/core/io/styles/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/io/styles/styles-docs.factor b/core/io/styles/styles-docs.factor
new file mode 100644 (file)
index 0000000..a4c3040
--- /dev/null
@@ -0,0 +1,157 @@
+USING: help.markup help.syntax io.streams.plain io strings
+hashtables ;
+IN: io.styles
+
+ARTICLE: "character-styles" "Character styles"
+"Character styles for " { $link stream-format } " and " { $link with-style } ":"
+{ $subsection foreground }
+{ $subsection background }
+{ $subsection font }
+{ $subsection font-size }
+{ $subsection font-style }
+{ $subsection presented } ;
+
+ARTICLE: "paragraph-styles" "Paragraph styles"
+"Paragraph styles for " { $link with-nesting } ":"
+{ $subsection page-color }
+{ $subsection border-color }
+{ $subsection border-width }
+{ $subsection wrap-margin }
+{ $subsection presented } ;
+
+ARTICLE: "table-styles" "Table styles"
+"Table styles for " { $link tabular-output } ":"
+{ $subsection table-gap }
+{ $subsection table-border } ;
+
+ARTICLE: "presentations" "Presentations"
+"The " { $link presented } " style can be used to emit clickable objects. The " { $link write-object } " word should be used instead of setting this directly." ;
+
+ARTICLE: "styles" "Formatted output"
+"The " { $link stream-format } ", " { $link with-style } ", " { $link with-nesting } " and " { $link tabular-output } " words take a hashtable of style attributes. Output stream implementations are free to ignore style information."
+$nl
+"Style hashtables are keyed by symbols from the " { $vocab-link "styles" } " vocabulary."
+{ $subsection "character-styles" }
+{ $subsection "paragraph-styles" }
+{ $subsection "table-styles" }
+{ $subsection "presentations" } ;
+
+ABOUT: "styles"
+
+HELP: plain
+{ $description "A value for the " { $link font-style } " character style denoting plain text." } ;
+
+HELP: bold
+{ $description "A value for the " { $link font-style } " character style denoting boldface text." } ;
+
+HELP: italic
+{ $description "A value for the " { $link font-style } " character style denoting italicized text." } ;
+
+HELP: bold-italic
+{ $description "A value for the " { $link font-style } " character style denoting boldface italicized text." } ;
+
+HELP: foreground
+{ $description "Character style. Text color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } 
+{ $examples
+    { $code
+        "10 ["
+            "    \"Hello world\" swap"
+            "    { 0.1 0.1 0.2 1 } n*v { 1 1 1 1 } vmin"
+            "    foreground associate format nl"
+        "] each"
+    }
+} ;
+
+HELP: background
+{ $description "Character style. Background color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
+{ $examples
+    { $code
+        "10 ["
+            "    \"Hello world\" swap"
+            "    { 0.1 0.4 0.1 } n*v { 1 1 1 } vmin { 1 } append"
+            "    background associate format nl"
+        "] each"
+    }
+} ;
+
+HELP: font
+{ $description "Character style. Font family named by a string." }
+{ $examples
+    "This example outputs some different font sizes:"
+    { $code "{ \"monospace\" \"serif\" \"sans-serif\" }\n[ dup font associate format nl ] each" }
+} ;
+
+HELP: font-size
+{ $description "Character style. Font size, an integer." }
+{ $examples
+    "This example outputs some different font sizes:"
+    { $code "{ 12 18 24 72 }"
+        "[ \"Bigger\" swap font-size associate format nl ] each"
+    }
+}  ;
+
+HELP: font-style
+{ $description "Character style. Font style, one of " { $link plain } ", " { $link bold } ", " { $link italic } ", or " { $link bold-italic } "." }
+{ $examples
+    "This example outputs text in all three styles:"
+    { $code "{ plain bold italic bold-italic }\n[ [ word-name ] keep font-style associate format nl ] each" }
+}  ;
+
+HELP: presented
+{ $description "Character and paragraph style. An object associated with the text. In the Factor UI, this is shown as a clickable presentation of the object; left-clicking invokes a default command, and right-clicking shows a menu of commands." } ;
+
+HELP: presented-path
+{ $description "Character and paragraph style. An editable object associated with the text. In the Factor UI, this is shown as a clickable presentation of the object path together with an expander button which displays an object editor; left-clicking invokes a default command, and right-clicking shows a menu of commands." } ;
+
+HELP: presented-printer
+{ $description "Character and paragraph style. A quotation with stack effect " { $snippet "( obj -- )" } " which is applied to the value at the " { $link presented-path } " if the presentation needs to be re-displayed after the object has been edited." } ;
+
+HELP: highlight
+{ $description "Character style. Used to mark up text on streams that otherwise do not support different colors or font styles." }
+{ $examples "Instances of " { $link plain-writer } " uppercases highlighted text." } ;
+
+HELP: page-color
+{ $description "Paragraph style. Background color of the paragraph block, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } 
+{ $examples
+    { $code "H{ { page-color { 1 0.8 0.5 1 } } }\n[ \"A background\" write ] with-nesting nl" }
+} ;
+
+HELP: border-color
+{ $description "Paragraph style. Border color of the paragraph block, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } 
+{ $examples
+    { $code "H{ { border-color { 1 0 0 1 } } }\n[ \"A border\" write ] with-nesting nl" }
+} ;
+
+HELP: border-width
+{ $description "Paragraph style. Pixels between edge of text and border color, an integer." } 
+{ $examples
+    { $code "H{ { border-width 10 } }\n[ \"Some inset text\" write ] with-nesting nl" }
+} ;
+
+HELP: wrap-margin
+{ $description "Paragraph style. Pixels between left margin and right margin where text is wrapped, an integer." } ;
+
+{ wrap-margin bl } related-words
+
+HELP: table-gap
+{ $description "Table style. Horizontal and vertical gap between table cells, denoted by a pair of integers." } ;
+
+{ table-gap table-border stream-write-table tabular-output } related-words
+
+HELP: table-border
+{ $description "Table style. Color of the border drawn between cells, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } ;
+
+HELP: input
+{ $class-description "Class of input text presentations. Instances can be used passed to " { $link write-object } " to output a clickable piece of input. Input text presentations are created by calling " { $link <input> } "." }
+{ $examples
+    "This presentation class is used for the code examples you see in the online help:"
+    { $code "\"2 3 + .\" dup <input> write-object nl" }
+} ;
+
+HELP: <input> ( string -- input )
+{ $values { "string" string } { "input" input } }
+{ $description "Creates a new " { $link input } "." } ;
+
+HELP: standard-table-style
+{ $values { "style" hashtable } }
+{ $description "Outputs a table style where cells are separated by 5-pixel gaps and framed by a light gray border. This style can be passed to " { $link tabular-output } "." } ;
diff --git a/core/io/styles/styles.factor b/core/io/styles/styles.factor
new file mode 100644 (file)
index 0000000..25e87ab
--- /dev/null
@@ -0,0 +1,44 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.styles
+
+SYMBOL: plain
+SYMBOL: bold
+SYMBOL: italic
+SYMBOL: bold-italic
+
+! Character styles
+SYMBOL: foreground
+SYMBOL: background
+SYMBOL: font
+SYMBOL: font-size
+SYMBOL: font-style
+
+! Presentation
+SYMBOL: presented
+SYMBOL: presented-path
+SYMBOL: presented-printer
+
+! Only for plain-stream
+SYMBOL: highlight
+
+! Paragraph styles
+SYMBOL: page-color
+SYMBOL: border-color
+SYMBOL: border-width
+SYMBOL: wrap-margin
+
+! Table styles
+SYMBOL: table-gap
+SYMBOL: table-border
+
+: standard-table-style ( -- style )
+    H{
+        { table-gap { 5 5 } }
+        { table-border { 0.8 0.8 0.8 1.0 } }
+    } ;
+
+! Input history
+TUPLE: input string ;
+
+C: <input> input
diff --git a/core/io/styles/summary.txt b/core/io/styles/summary.txt
new file mode 100644 (file)
index 0000000..3ec307f
--- /dev/null
@@ -0,0 +1 @@
+Styles which can be used to mark up text sent to an output stream
diff --git a/core/io/summary.txt b/core/io/summary.txt
new file mode 100644 (file)
index 0000000..86adb54
--- /dev/null
@@ -0,0 +1 @@
+Stream protocol
diff --git a/core/io/test/binary.txt b/core/io/test/binary.txt
new file mode 100644 (file)
index 0000000..ce542ef
--- /dev/null
@@ -0,0 +1 @@
+ÿ
\ No newline at end of file
diff --git a/core/io/test/empty-file.txt b/core/io/test/empty-file.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/core/io/test/mac-os-eol.txt b/core/io/test/mac-os-eol.txt
new file mode 100644 (file)
index 0000000..53c8eaf
--- /dev/null
@@ -0,0 +1 @@
+This is a line.\rThis is another line.\r
\ No newline at end of file
diff --git a/core/io/test/no-trailing-eol.factor b/core/io/test/no-trailing-eol.factor
new file mode 100644 (file)
index 0000000..aa4d8b8
--- /dev/null
@@ -0,0 +1,4 @@
+IN: temporary
+USE: math
+: foo 2 2 + ;
+FORGET: foo
\ No newline at end of file
diff --git a/core/io/test/separator-test.txt b/core/io/test/separator-test.txt
new file mode 100644 (file)
index 0000000..c3568f6
--- /dev/null
@@ -0,0 +1 @@
+It seems Jobs has lost his grasp on reality again.
diff --git a/core/io/test/unix-eol.txt b/core/io/test/unix-eol.txt
new file mode 100644 (file)
index 0000000..a0853ee
--- /dev/null
@@ -0,0 +1,2 @@
+This is a line.
+This is another line.
diff --git a/core/io/test/windows-eol.txt b/core/io/test/windows-eol.txt
new file mode 100644 (file)
index 0000000..c78d007
--- /dev/null
@@ -0,0 +1,2 @@
+This is a line.\r
+This is another line.\r
diff --git a/core/io/unix/files.factor b/core/io/unix/files.factor
deleted file mode 100644 (file)
index 865cbb2..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io
-USING: io-internals kernel ;
-
-: <file-reader> ( path -- stream ) open-read <reader> ;
-: <file-writer> ( path -- stream ) open-write <writer> ;
-: <file-r/w> ( path -- stream ) open-r/w dup <fd-stream> ;
diff --git a/core/io/unix/io.factor b/core/io/unix/io.factor
deleted file mode 100644 (file)
index 7c4a728..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: io-internals
-USING: alien arrays errors generic hashtables io kernel
-kernel-internals math parser sequences strings threads
-unix-internals vectors words sequences-internals ;
-
-! We want namespaces::bind to shadow the bind system call from
-! unix-internals
-USING: namespaces ;
-
-! This will go elsewhere soon
-: byte-bit ( n alien -- byte bit )
-    over -5 shift alien-unsigned-4 swap 31 bitand ;
-
-: bit-nth ( n alien -- ? )
-    byte-bit 1 swap shift bitand 0 > ;
-
-: set-bit ( ? byte bit -- byte )
-    1 swap shift rot [ bitor ] [ bitnot bitand ] if ;
-
-: set-bit-nth ( ? n alien -- )
-    [ byte-bit set-bit ] 2keep
-    swap -5 shift set-alien-unsigned-4 ;
-
-: clear-bits ( alien len -- )
-    [ 0 -rot set-alien-unsigned-1 ] each-with ;
-
-! Global variables
-SYMBOL: read-fdset
-SYMBOL: read-tasks
-SYMBOL: write-fdset
-SYMBOL: write-tasks
-
-! Some general stuff
-: file-mode OCT: 0600 ;
-
-: (io-error) ( -- * ) err_no strerror throw ;
-
-: check-null ( n -- ) zero? [ (io-error) ] when ;
-
-: io-error ( n -- ) 0 < [ (io-error) ] when ;
-
-: init-handle ( fd -- )
-    #! We drop the error code rather than calling io-error,
-    #! since on OS X 10.3, this operation fails from init-io
-    #! when running the Factor.app (presumably because fd 0 and
-    #! 1 are closed).
-    F_SETFL O_NONBLOCK fcntl drop ;
-
-! Common delegate of native stream readers and writers
-SYMBOL: input
-SYMBOL: output
-SYMBOL: closed
-
-TUPLE: port handle error timeout cutoff type eof? ;
-
-PREDICATE: port input-port port-type input eq? ;
-PREDICATE: port output-port port-type output eq? ;
-
-C: port ( handle buffer -- port )
-    [ set-delegate ] keep
-    [ >r dup init-handle r> set-port-handle ] keep
-    [ 0 swap set-port-timeout ] keep
-    [ 0 swap set-port-cutoff ] keep ;
-
-: touch-port ( port -- )
-    dup port-timeout dup zero?
-    [ 2drop ] [ millis + swap set-port-cutoff ] if ;
-
-M: port set-timeout
-    [ set-port-timeout ] keep touch-port ;
-
-: buffered-port 32768 <buffer> <port> ;
-
-: >port< dup port-handle swap delegate ;
-
-: pending-error ( port -- )
-    dup port-error f rot set-port-error [ throw ] when* ;
-
-: report-error ( error port -- )
-    [ "Error on fd " % dup port-handle # ": " % swap % ] "" make
-    swap set-port-error ;
-
-: ignorable-error? ( n -- ? )
-    dup EAGAIN number= swap EINTR number= or ;
-
-: defer-error ( port -- ? )
-    #! Return t if it is an unrecoverable error.
-    err_no dup ignorable-error?
-    [ 2drop f ] [ strerror swap report-error t ] if ;
-
-! Associates a port with a list of continuations waiting on the
-! port to finish I/O
-TUPLE: io-task port callbacks ;
-C: io-task ( port -- task )
-    [ set-io-task-port ] keep
-    V{ } clone over set-io-task-callbacks ;
-
-! Multiplexer
-GENERIC: do-io-task ( task -- ? )
-GENERIC: task-container ( task -- vector )
-
-: io-task-fd io-task-port port-handle ;
-
-: add-io-task ( callback task -- )
-    [ io-task-callbacks push ] keep
-    dup io-task-fd over task-container 2dup hash [
-        "Cannot perform multiple reads from the same port" throw
-    ] when set-hash ;
-
-: remove-io-task ( task -- )
-    dup io-task-fd swap task-container remove-hash ;
-
-: pop-callbacks ( task -- )
-    dup io-task-callbacks swap remove-io-task
-    [ schedule-thread ] each ;
-
-: handle-fd ( task -- )
-    dup io-task-port touch-port
-    dup do-io-task [ pop-callbacks ] [ drop ] if ;
-
-: timeout? ( port -- ? )
-    port-cutoff dup zero? not swap millis < and ;
-
-: handle-fdset ( fdset tasks -- )
-    [
-        nip dup io-task-port timeout? [
-            dup io-task-port "Timeout" swap report-error
-            nip pop-callbacks
-        ] [
-            tuck io-task-fd swap bit-nth
-            [ handle-fd ] [ drop ] if
-        ] if
-    ] hash-each-with ;
-
-: init-fdset ( fdset tasks -- fdset )
-    >r dup dup FD_SETSIZE clear-bits r>
-    [ drop t swap rot set-bit-nth ] hash-each-with ;
-
-: read-fdset/tasks
-    read-fdset get-global read-tasks get-global ;
-
-: write-fdset/tasks
-    write-fdset get-global write-tasks get-global ;
-
-: init-fdsets ( -- read write except )
-    read-fdset/tasks init-fdset
-    write-fdset/tasks init-fdset f ;
-
-: (io-multiplex) ( ms -- )
-    [ FD_SETSIZE init-fdsets ] keep make-timeval select 0 < [
-        err_no ignorable-error? [ (io-multiplex) ] [ drop ] if
-    ] [
-        drop
-    ] if ;
-
-: io-multiplex ( ms -- )
-    (io-multiplex)
-    read-fdset/tasks handle-fdset
-    write-fdset/tasks handle-fdset ;
-
-! Readers
-
-: <reader> ( fd -- stream )
-    buffered-port input over set-port-type <line-reader> ;
-
-: open-read ( path -- fd )
-    O_RDONLY file-mode open dup io-error ;
-
-: reader-eof ( reader -- )
-    dup buffer-empty? [ t over set-port-eof? ] when drop ;
-
-: (refill) ( port -- n )
-    >port< dup buffer-end swap buffer-capacity read ;
-
-: refill ( port -- ? )
-    #! Return f if there is a recoverable error
-    dup buffer-empty? [
-        dup (refill)  dup 0 >= [
-            swap n>buffer t
-        ] [
-            drop defer-error
-        ] if
-    ] [
-        drop t
-    ] if ;
-
-! Reading a single character
-TUPLE: read1-task ;
-
-C: read1-task ( port -- task )
-    [ >r <io-task> r> set-delegate ] keep ;
-
-M: read1-task do-io-task
-    io-task-port dup refill
-    [ [ reader-eof ] [ drop ] if ] keep ;
-
-M: read1-task task-container drop read-tasks get-global ;
-
-: wait-to-read1 ( port -- )
-    dup buffer-empty? [
-        [ swap <read1-task> add-io-task stop ] callcc0
-    ] when pending-error ;
-
-: unless-eof ( port quot -- value )
-    over port-eof? [
-        f rot set-port-eof? drop f
-    ] [
-        call
-    ] if ; inline
-
-M: input-port stream-read1
-    dup wait-to-read1 [ buffer-pop ] unless-eof ;
-
-! Reading character counts
-TUPLE: read-task count ;
-
-C: read-task ( count port -- task )
-    [ >r <io-task> r> set-delegate ] keep
-    [ set-read-task-count ] keep ;
-
-: >read-task< dup read-task-count swap io-task-port ;
-
-M: read-task do-io-task
-    io-task-port dup refill [ reader-eof t ] [ drop f ] if ;
-
-M: read-task task-container drop read-tasks get-global ;
-
-: wait-to-read ( count port -- )
-    2dup buffer-length > [
-        [ -rot <read-task> add-io-task stop ] callcc0
-    ] when pending-error drop ;
-
-: stream-read-part ( count port -- string )
-    [ wait-to-read ] 2keep
-    [ dupd buffer> ] unless-eof nip ;
-
-: stream-read-loop ( count port sbuf -- )
-    pick over length - dup 0 > [
-        pick stream-read-part dup [
-            dupd nappend stream-read-loop
-        ] [
-            2drop 2drop
-        ] if
-    ] [
-        2drop 2drop
-    ] if ;
-
-M: input-port stream-read
-    >r 0 max >fixnum r>
-    2dup stream-read-part dup [
-        pick over length > [
-            pick <sbuf>
-            [ swap nappend ] keep
-            [ stream-read-loop ] keep
-            "" like
-        ] [
-            2nip
-        ] if
-    ] [
-        2nip
-    ] if ;
-
-! Writers
-
-: open-write ( path -- fd )
-    O_WRONLY O_CREAT bitor O_TRUNC bitor file-mode open
-    dup io-error ;
-
-: <writer> ( fd -- writer )
-    buffered-port output over set-port-type <plain-writer> ;
-
-: write-step ( port -- )
-    dup >port< dup buffer@ swap buffer-length write dup 0 >= [
-        swap buffer-consume
-    ] [
-        drop defer-error drop
-    ] if ;
-
-: can-write? ( len writer -- ? )
-    #! If the buffer is empty and the string is too long,
-    #! extend the buffer.
-    dup buffer-empty? [
-        2drop t
-    ] [
-        [ buffer-fill + ] keep buffer-capacity <=
-    ] if ;
-
-TUPLE: write-task ;
-
-C: write-task ( port -- task )
-    [ >r <io-task> r> set-delegate ] keep ;
-
-M: write-task do-io-task
-    io-task-port dup buffer-length zero? over port-error or
-    [ 0 swap buffer-reset t ] [ write-step f ] if ;
-
-M: write-task task-container drop write-tasks get-global ;
-
-: add-write-io-task ( callback task -- )
-    dup io-task-fd write-tasks get-global hash
-    [ io-task-callbacks push ] [ add-io-task ] ?if ;
-
-: port-flush ( port -- )
-    [ swap <write-task> add-write-io-task stop ] callcc0 drop ;
-
-M: output-port stream-flush
-    dup port-flush pending-error ;
-
-: wait-to-write ( len port -- )
-    tuck can-write? [ drop ] [ stream-flush ] if ;
-
-M: output-port stream-write1
-    1 over wait-to-write ch>buffer ;
-
-M: output-port stream-write
-    over length over wait-to-write >buffer ;
-
-M: port stream-close
-    dup port-type closed eq? [
-        dup port-type >r closed over set-port-type r>
-        output eq? [ dup port-flush ] when dup port-handle close
-        dup delegate [ buffer-free ] when* f over set-delegate
-    ] unless drop ;
-
-! Make a duplex stream for reading/writing a pair of fds
-: open-r/w ( path -- fd ) O_RDWR file-mode open dup io-error ;
-
-: <fd-stream> ( infd outfd -- stream )
-    >r <reader> r> <writer> <duplex-stream> ;
-
-USE: io
-
-: init-io ( -- )
-    #! Should only be called on startup. Calling this at any
-    #! other time can have unintended consequences.
-    global [
-        H{ } clone read-tasks set
-        FD_SETSIZE <byte-array> read-fdset set
-        H{ } clone write-tasks set
-        FD_SETSIZE <byte-array> write-fdset set
-        0 1 <fd-stream> stdio set
-    ] bind ;
diff --git a/core/io/unix/load.factor b/core/io/unix/load.factor
deleted file mode 100644 (file)
index 51bffbf..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-USE: kernel
-
-REQUIRES: core/io/buffer ;
-
-PROVIDE: core/io/unix
-{ +files+ {
-    "types.factor"
-    { "syscalls-freebsd.factor" [ os "freebsd" = ] }
-    { "syscalls-linux.factor" [ os "linux" = ] }
-    { "syscalls-macosx.factor" [ os "macosx" = ] }
-    { "syscalls-solaris.factor" [ os "solaris" = ] }
-    "syscalls.factor"
-    "io.factor"
-    "sockets.factor"
-    "files.factor"
-} } ;
diff --git a/core/io/unix/sockets.factor b/core/io/unix/sockets.factor
deleted file mode 100644 (file)
index 5e3ac62..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-
-! We need to fiddle with the exact search order here, since
-! unix-internals::accept shadows streams::accept.
-IN: io-internals
-USING: alien errors generic io kernel math namespaces parser
-threads unix-internals ;
-
-: init-sockaddr ( port -- sockaddr )
-    "sockaddr-in" <c-object>
-    [ AF_INET swap set-sockaddr-in-family ] keep
-    [ >r htons r> set-sockaddr-in-port ] keep ;
-
-: client-sockaddr ( host port -- sockaddr )
-    #! Error handling here
-    init-sockaddr [
-        >r gethostbyname dup [
-            "Host lookup failed" throw
-        ] unless hostent-addr dup check-null
-        r> set-sockaddr-in-addr
-    ] keep ;
-
-: socket-fd ( -- socket )
-    PF_INET SOCK_STREAM 0 socket dup io-error dup init-handle ;
-
-: with-socket-fd ( quot -- fd )
-    socket-fd [ swap call ] keep  swap 0 < [
-        err_no EINPROGRESS = [ dup close (io-error) ] unless
-    ] when ; inline
-
-: server-sockaddr ( port -- sockaddr )
-    init-sockaddr  INADDR_ANY htonl over set-sockaddr-in-addr ;
-
-: sockopt ( fd level opt -- )
-    1 <int> "int" c-size setsockopt io-error ;
-
-: server-socket ( port -- fd )
-    server-sockaddr [
-        dup SOL_SOCKET SO_REUSEADDR sockopt
-        swap dupd "sockaddr-in" c-size bind
-        dup 0 >= [ drop 1 listen ] [ nip ] if
-    ] with-socket-fd ;
-
-TUPLE: connect-task ;
-
-C: connect-task ( port -- task )
-    [ >r <io-task> r> set-delegate ] keep ;
-
-M: connect-task do-io-task
-    io-task-port dup port-handle 0 0 write
-    0 < [ defer-error ] [ drop t ] if ;
-
-M: connect-task task-container drop write-tasks get-global ;
-
-: client-socket ( host port -- fd )
-    client-sockaddr [
-        swap "sockaddr-in" c-size connect
-    ] with-socket-fd ;
-
-: wait-to-connect ( port -- )
-    [ swap <connect-task> add-io-task stop ] callcc0 drop ;
-
-IN: io
-
-: <client> ( host port -- stream )
-    client-socket dup <fd-stream>
-    dup duplex-stream-out dup wait-to-connect pending-error ;
-
-C: client-stream ( host port fd -- stream )
-    [ >r dup <fd-stream> r> set-delegate ] keep
-    [ set-client-stream-port ] keep
-    [ set-client-stream-host ] keep ;
-
-TUPLE: server client ;
-
-C: server ( port -- server )
-    #! Starts listening for TCP connections on localhost:port.
-    [ >r server-socket f <port> r> set-delegate ] keep
-    server over set-port-type ;
-
-IN: io-internals
-USE: unix-internals
-
-TUPLE: accept-task ;
-
-C: accept-task ( port -- task )
-    [ >r <io-task> r> set-delegate ] keep ;
-
-: init-socket ( fd -- ) SOL_SOCKET SO_OOBINLINE sockopt ;
-
-: inet-ntoa ( n -- str )
-    ntohl [
-        dup -24 shift HEX: ff bitand # CHAR: . ,
-        dup -16 shift HEX: ff bitand # CHAR: . ,
-        dup -8  shift HEX: ff bitand # CHAR: . ,
-                      HEX: ff bitand #
-    ] "" make ;
-
-: do-accept ( port sockaddr fd -- )
-    [
-        init-socket
-        dup sockaddr-in-addr inet-ntoa
-        swap sockaddr-in-port ntohs
-    ] keep <client-stream> swap set-server-client ;
-
-M: accept-task do-io-task
-    io-task-port "sockaddr-in" <c-object>
-    over port-handle over "sockaddr-in" c-size <int> accept
-    dup 0 >= [
-        do-accept t
-    ] [
-        2drop defer-error
-    ] if ;
-
-M: accept-task task-container drop read-tasks get ;
-
-: wait-to-accept ( server -- )
-    [ swap <accept-task> add-io-task stop ] callcc0 drop ;
-
-: timeout-opt ( fd level opt value -- )
-    "timeval" c-size setsockopt io-error ;
-
-IN: io
-
-: accept ( server -- client )
-    #! Wait for a client connection.
-    dup wait-to-accept  dup pending-error  server-client ;
diff --git a/core/io/unix/syscalls-freebsd.factor b/core/io/unix/syscalls-freebsd.factor
deleted file mode 100644 (file)
index b0fdec8..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: unix-internals
-USING: alien ;
-
-! FreeBSD
-
-: O_RDONLY  HEX: 0000 ;
-: O_WRONLY  HEX: 0001 ;
-: O_RDWR    HEX: 0002 ;
-: O_CREAT   HEX: 0200 ;
-: O_TRUNC   HEX: 0400 ;
-                        
-: FD_SETSIZE 1024 ;
-
-: SOL_SOCKET HEX: ffff ;
-: SO_REUSEADDR HEX: 4 ;
-: SO_OOBINLINE HEX: 100 ;
-: SO_SNDTIMEO HEX: 1005 ;
-: SO_RCVTIMEO HEX: 1006 ;
-
-: INADDR_ANY 0 ;
-
-: F_SETFL 4 ;
-: O_NONBLOCK 4 ;
-
-BEGIN-STRUCT: sockaddr-in
-    FIELD: uchar len
-    FIELD: uchar family
-    FIELD: ushort port
-    FIELD: in_addr_t addr
-    FIELD: longlong unused
-END-STRUCT
-
-: EINTR HEX: 4 ;
-: EAGAIN HEX: 23 ;
-: EINPROGRESS HEX: 24 ;
-
-: AF_INET 2 ;
-: PF_INET AF_INET ;
-: SOCK_STREAM 1 ;
diff --git a/core/io/unix/syscalls-linux.factor b/core/io/unix/syscalls-linux.factor
deleted file mode 100644 (file)
index fb5963d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: unix-internals
-USING: alien ;
-
-! Linux.
-
-: O_RDONLY  HEX: 0000 ;
-: O_WRONLY  HEX: 0001 ;
-: O_RDWR    HEX: 0002 ;
-: O_CREAT   HEX: 0040 ;
-: O_TRUNC   HEX: 0200 ;
-
-: SOL_SOCKET 1 ;
-
-: FD_SETSIZE 1024 ;
-
-: SO_REUSEADDR 2 ;
-: SO_OOBINLINE 10 ;
-: SO_SNDTIMEO HEX: 15 ;
-: SO_RCVTIMEO HEX: 14 ;
-
-: INADDR_ANY 0 ;
-
-: F_SETFL 4 ;    ! set file status flags
-: O_NONBLOCK HEX: 800 ; ! no delay
-
-BEGIN-STRUCT: sockaddr-in
-    FIELD: ushort family
-    FIELD: ushort port
-    FIELD: in_addr_t addr
-    FIELD: longlong unused
-END-STRUCT
-
-: EINTR HEX: 4 ;
-: EAGAIN HEX: b ;
-: EINPROGRESS HEX: 73 ;
-
-: AF_INET 2 ;
-: PF_INET AF_INET ;
-: SOCK_STREAM 1 ;
diff --git a/core/io/unix/syscalls-macosx.factor b/core/io/unix/syscalls-macosx.factor
deleted file mode 100644 (file)
index 24bb79c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: unix-internals
-USING: alien ;
-
-! Mac OS X
-
-: O_RDONLY  HEX: 0000 ;
-: O_WRONLY  HEX: 0001 ;
-: O_RDWR    HEX: 0002 ;
-: O_CREAT   HEX: 0200 ;
-: O_TRUNC   HEX: 0400 ;
-
-: FD_SETSIZE 1024 ;
-
-: SOL_SOCKET HEX: ffff ;
-: SO_REUSEADDR HEX: 4 ;
-: SO_OOBINLINE HEX: 100 ;
-: SO_SNDTIMEO HEX: 1005 ;
-: SO_RCVTIMEO HEX: 1006 ;
-
-: INADDR_ANY 0 ;
-
-: F_SETFL 4 ;
-: O_NONBLOCK 4 ;
-
-BEGIN-STRUCT: sockaddr-in
-    FIELD: uchar len
-    FIELD: uchar family
-    FIELD: ushort port
-    FIELD: in_addr_t addr
-    FIELD: longlong unused
-END-STRUCT
-
-: EINTR HEX: 4 ;
-: EAGAIN HEX: 23 ;
-: EINPROGRESS HEX: 24 ;
-
-: AF_INET 2 ;
-: PF_INET AF_INET ;
-: SOCK_STREAM 1 ;
diff --git a/core/io/unix/syscalls-solaris.factor b/core/io/unix/syscalls-solaris.factor
deleted file mode 100644 (file)
index 7fb40ce..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Copyright (C) 2006 Patrick Mauritz.
-! See http://factorcode.org/license.txt for BSD license.
-IN: unix-internals
-USING: alien kernel kernel-internals ;
-
-! Solaris.
-
-: SOCK_STREAM 2 ;
-
-: O_RDONLY  HEX: 0000 ;
-: O_WRONLY  HEX: 0001 ;
-: O_RDWR    HEX: 0002 ;
-: O_CREAT   HEX: 0100 ;
-: O_TRUNC   HEX: 0200 ;
-
-: SOL_SOCKET HEX: ffff ;
-
-: FD_SETSIZE cell 4 = 1024 65536 ? ;
-
-: SO_REUSEADDR 4 ;
-: SO_OOBINLINE HEX: 0100 ;
-: SO_SNDTIMEO HEX: 1005 ;
-: SO_RCVTIMEO HEX: 1006 ;
-
-: INADDR_ANY 0 ;
-
-: F_SETFL 4 ;    ! set file status flags
-: O_NONBLOCK HEX: 80 ; ! no delay
-
-BEGIN-STRUCT: sockaddr-in
-    FIELD: ushort family
-    FIELD: ushort port
-    FIELD: in_addr_t addr
-    FIELD: longlong unused
-END-STRUCT
-
-: EINTR HEX: 4 ;
-: EAGAIN 11 ;
-: EINPROGRESS 150 ;
diff --git a/core/io/unix/syscalls.factor b/core/io/unix/syscalls.factor
deleted file mode 100644 (file)
index eafa6df..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: unix-internals
-USING: alien errors kernel math namespaces ;
-
-! Alien wrappers for various Unix libc functions.
-
-LIBRARY: factor
-FUNCTION: int err_no ( ) ;
-
-LIBRARY: libc
-FUNCTION: char* strerror ( int errno ) ;
-FUNCTION: int open ( char* path, int flags, int prot ) ;
-FUNCTION: void close ( int fd ) ;
-FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
-FUNCTION: ssize_t read ( int fd, ulong buf, size_t nbytes ) ;
-FUNCTION: ssize_t write ( int fd, ulong buf, size_t nbytes ) ;
-
-BEGIN-STRUCT: timeval
-    FIELD: long sec
-    FIELD: long usec
-END-STRUCT
-
-: make-timeval ( ms -- timeval )
-    1000 /mod 1000 *
-    "timeval" <c-object>
-    [ set-timeval-usec ] keep
-    [ set-timeval-sec ] keep ;
-
-FUNCTION: int select ( int nfds, void* readfds, void* writefds, void* exceptfds, timeval* timeout ) ;
-
-BEGIN-STRUCT: hostent
-    FIELD: char* name
-    FIELD: void* aliases
-    FIELD: int addrtype
-    FIELD: int length
-    FIELD: void* addr-list
-END-STRUCT
-
-: hostent-addr hostent-addr-list *void* *uint ;
-
-: gethostbyname ( name -- hostent )
-    "hostent*" "libc" "gethostbyname" [ "char*" ] alien-invoke ;
-
-FUNCTION: int socket ( int domain, int type, int protocol ) ;
-FUNCTION: int setsockopt ( int s, int level, int optname, void* optval, socklen_t optlen ) ;
-FUNCTION: int connect ( int s, sockaddr-in* name, socklen_t namelen ) ;
-FUNCTION: int bind ( int s, sockaddr-in* name, socklen_t namelen ) ;
-FUNCTION: int listen ( int s, int backlog ) ;
-FUNCTION: int accept ( int s, sockaddr-in* sockaddr, socklen_t* socklen ) ;
-FUNCTION: uint htonl ( uint n ) ;
-FUNCTION: ushort htons ( ushort n ) ;
-FUNCTION: uint ntohl ( uint n ) ;
-FUNCTION: ushort ntohs ( ushort n ) ;
diff --git a/core/io/unix/types.factor b/core/io/unix/types.factor
deleted file mode 100644 (file)
index cb2fb82..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: unix-internals
-USING: alien errors kernel math namespaces ;
-
-TYPEDEF: ulonglong off_t
-TYPEDEF: long ssize_t
-TYPEDEF: ulong size_t
-TYPEDEF: uint socklen_t
-TYPEDEF: uint in_addr_t
diff --git a/core/io/utf16/authors.txt b/core/io/utf16/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/core/io/utf16/summary.txt b/core/io/utf16/summary.txt
new file mode 100644 (file)
index 0000000..b249067
--- /dev/null
@@ -0,0 +1 @@
+UTF16 encoding/decoding
diff --git a/core/io/utf16/utf16-docs.factor b/core/io/utf16/utf16-docs.factor
new file mode 100644 (file)
index 0000000..6d24f54
--- /dev/null
@@ -0,0 +1,45 @@
+USING: help.markup help.syntax io.encodings strings ;
+IN: io.utf16
+
+ARTICLE: "io.utf16" "Working with UTF16-encoded data"
+"The UTF16 encoding is a variable-width encoding. Unicode code points are encoded as 2 or 4 byte sequences."
+{ $subsection encode-utf16le }
+{ $subsection encode-utf16be }
+{ $subsection decode-utf16le }
+{ $subsection decode-utf16be }
+"Support for UTF16 data with a byte order mark:"
+{ $subsection encode-utf16 }
+{ $subsection decode-utf16 } ;
+
+ABOUT: "io.utf16"
+
+HELP: decode-utf16
+{ $values { "seq" "a sequence of bytes" } { "str" string } }
+{ $description "Decodes a sequence of bytes representing a Unicode string in UTF16 format. The bytes must begin with a UTF16 byte order mark, which determines if the input is in little or big endian. To decode data without a byte order mark, use " { $link decode-utf16le } " or " { $link decode-utf16be } "." }
+{ $errors "Throws a " { $link decode-error } " if the input is malformed." } ;
+
+HELP: decode-utf16be
+{ $values { "seq" "a sequence of bytes" } { "str" string } }
+{ $description "Decodes a sequence of bytes representing a Unicode string in big endian UTF16 format. The bytes must not begin with a UTF16 byte order mark. To decode data with a byte order mark, use " { $link decode-utf16 } "." }
+{ $errors "Throws a " { $link decode-error } " if the input is malformed." } ;
+
+HELP: decode-utf16le
+{ $values { "seq" "a sequence of bytes" } { "str" string } }
+{ $description "Decodes a sequence of bytes representing a Unicode string in little endian UTF16 format. The bytes must not begin with a UTF16 byte order mark. To decode data with a byte order mark, use " { $link decode-utf16 } "." }
+{ $errors "Throws a " { $link decode-error } " if the input is malformed." } ;
+
+{ decode-utf16 decode-utf16le decode-utf16be } related-words
+
+HELP: encode-utf16be
+{ $values { "str" string } { "seq" "a sequence of bytes" } }
+{ $description "Encodes a Unicode string as a sequence of bytes in big endian UTF16 format." } ;
+
+HELP: encode-utf16le
+{ $values { "str" string } { "seq" "a sequence of bytes" } }
+{ $description "Encodes a Unicode string as a sequence of bytes in little endian UTF16 format." } ;
+
+HELP: encode-utf16
+{ $values { "str" string } { "seq" "a sequence of bytes" } }
+{ $description "Encodes a Unicode string as a sequence of bytes in UTF16 format with a byte order mark." } ;
+
+{ encode-utf16 encode-utf16be encode-utf16le } related-words
diff --git a/core/io/utf16/utf16-tests.factor b/core/io/utf16/utf16-tests.factor
new file mode 100644 (file)
index 0000000..014d834
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.test io.utf16 ;
+
+[ { CHAR: x } ] [ { 0 CHAR: x } decode-utf16be ] unit-test
+[ { HEX: 1D11E } ] [ { HEX: D8 HEX: 34 HEX: DD HEX: 1E } decode-utf16be ] unit-test
+[ { BIN: 11011111 CHAR: q } decode-utf16be ] unit-test-fails
+[ { BIN: 11011011 CHAR: x BIN: 11011011 CHAR: x } decode-utf16be ] unit-test-fails
+
+[ B{ 0 120 216 52 221 30 } ] [ { CHAR: x HEX: 1d11e } encode-utf16be ] unit-test
+
+[ { CHAR: x } ] [ { CHAR: x 0 } decode-utf16le ] unit-test
+[ { 119070 } ] [ { HEX: 34 HEX: D8 HEX: 1E HEX: DD } decode-utf16le ] unit-test
+[ { 0 BIN: 11011111 } decode-utf16le ] unit-test-fails
+[ { 0 BIN: 11011011 0 0 } decode-utf16le ] unit-test-fails
+
+[ B{ 120 0 52 216 30 221 } ] [ { CHAR: x HEX: 1d11e } encode-utf16le ] unit-test
diff --git a/core/io/utf16/utf16.factor b/core/io/utf16/utf16.factor
new file mode 100644 (file)
index 0000000..ea63201
--- /dev/null
@@ -0,0 +1,113 @@
+! Copyright (C) 2006, 2007 Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: math kernel sequences sbufs vectors namespaces io.binary
+io.encodings combinators splitting math.functions ;
+IN: io.utf16
+
+SYMBOL: double
+SYMBOL: quad1
+SYMBOL: quad2
+SYMBOL: quad3
+
+: append-nums ( byte ch -- ch )
+    8 shift bitor ;
+
+: end-multibyte ( buf byte ch -- buf ch state )
+    append-nums decoded ;
+
+: begin-utf16be ( buf byte -- buf ch state )
+    dup -3 shift BIN: 11011 number= [
+        dup BIN: 00000100 bitand zero?
+        [ BIN: 11 bitand quad1 ]
+        [ decode-error ] if
+    ] [ double ] if ;
+
+: handle-quad2be ( byte ch -- ch )
+    swap dup -2 shift BIN: 110111 number= [
+        >r 2 shift r> BIN: 11 bitand bitor
+    ] [ decode-error ] if ;
+
+: (decode-utf16be) ( buf byte ch state -- buf ch state )
+    {
+        { begin [ drop begin-utf16be ] }
+        { double [ end-multibyte ] }
+        { quad1 [ append-nums quad2 ] }
+        { quad2 [ handle-quad2be quad3 ] }
+        { quad3 [ append-nums HEX: 10000 + decoded ] }
+    } case ;
+
+: decode-utf16be ( seq -- str )
+    [ -rot (decode-utf16be) ] decode ;
+
+: handle-double ( buf byte ch -- buf ch state )
+    swap dup -3 shift BIN: 11011 = [
+        dup BIN: 100 bitand 0 number=
+        [ BIN: 11 bitand 8 shift bitor quad2 ]
+        [ decode-error ] if
+    ] [ end-multibyte ] if ;
+
+: handle-quad3le ( buf byte ch -- buf ch state )
+    swap dup -2 shift BIN: 110111 = [
+        BIN: 11 bitand append-nums HEX: 10000 + decoded
+    ] [ decode-error ] if ;
+
+: (decode-utf16le) ( buf byte ch state -- buf ch state )
+    {
+        { begin [ drop double ] }
+        { double [ handle-double ] }
+        { quad1 [ append-nums quad2 ] }
+        { quad2 [ 10 shift bitor quad3 ] }
+        { quad3 [ handle-quad3le ] }
+    } case ;
+
+: decode-utf16le ( seq -- str )
+    [ -rot (decode-utf16le) ] decode ;
+
+: encode-first
+    -10 shift
+    dup -8 shift BIN: 11011000 bitor
+    swap HEX: FF bitand ;
+
+: encode-second
+    BIN: 1111111111 bitand
+    dup -8 shift BIN: 11011100 bitor
+    swap BIN: 11111111 bitand ;
+
+: char>utf16be ( char -- )
+    dup HEX: FFFF > [
+        HEX: 10000 -
+        dup encode-first swap , ,
+        encode-second swap , ,
+    ] [ h>b/b , , ] if ;
+
+: encode-utf16be ( str -- seq )
+    [ [ char>utf16be ] each ] B{ } make ;
+
+: char>utf16le ( char -- )
+    dup HEX: FFFF > [
+        HEX: 10000 -
+        dup encode-first , ,
+        encode-second , ,
+    ] [ h>b/b swap , , ] if ; 
+
+: encode-utf16le ( str -- seq )
+    [ [ char>utf16le ] each ] B{ } make ;
+
+: bom-le B{ HEX: ff HEX: fe } ; inline
+
+: bom-be B{ HEX: fe HEX: ff } ; inline
+
+: encode-utf16 ( str -- seq )
+    encode-utf16le bom-le swap append ;
+
+: utf16le? ( seq1 -- seq2 ? ) bom-le ?head ;
+
+: utf16be? ( seq1 -- seq2 ? ) bom-be ?head ;
+
+: decode-utf16 ( seq -- str )
+    {
+        { [ utf16le? ] [ decode-utf16le ] }
+        { [ utf16be? ] [ decode-utf16be ] }
+        { [ t ] [ decode-error ] }
+    } cond ;
+
diff --git a/core/io/utf8/authors.txt b/core/io/utf8/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/core/io/utf8/summary.txt b/core/io/utf8/summary.txt
new file mode 100644 (file)
index 0000000..afd259a
--- /dev/null
@@ -0,0 +1 @@
+UTF8 encoding/decoding
diff --git a/core/io/utf8/utf8-docs.factor b/core/io/utf8/utf8-docs.factor
new file mode 100644 (file)
index 0000000..28310b5
--- /dev/null
@@ -0,0 +1,18 @@
+USING: help.markup help.syntax io.encodings strings ;
+IN: io.utf8
+
+ARTICLE: "io.utf8" "Working with UTF8-encoded data"
+"The UTF8 encoding is a variable-width encoding. 7-bit ASCII characters are encoded as single bytes, and other Unicode code points are encoded as 2 to 4 byte sequences."
+{ $subsection encode-utf8 }
+{ $subsection decode-utf8 } ;
+
+ABOUT: "io.utf8"
+
+HELP: decode-utf8
+{ $values { "seq" "a sequence of bytes" } { "str" string } }
+{ $description "Decodes a sequence of bytes representing a Unicode string in UTF8 format." }
+{ $errors "Throws a " { $link decode-error } " if the input is malformed." } ;
+
+HELP: encode-utf8
+{ $values { "str" string } { "seq" "a sequence of bytes" } }
+{ $description "Encodes a Unicode string as a sequence of bytes in UTF8 format." } ;
diff --git a/core/io/utf8/utf8-tests.factor b/core/io/utf8/utf8-tests.factor
new file mode 100644 (file)
index 0000000..d120b62
--- /dev/null
@@ -0,0 +1,16 @@
+USING: io.utf8 tools.test strings ;
+
+[ { BIN: 11110101 BIN: 10111111 BIN: 10000000 BIN: 11111111 } decode-utf8 ] unit-test-fails
+
+[ { BIN: 101111111000000111111 } ] [ { BIN: 11110101 BIN: 10111111 BIN: 10000000 BIN: 10111111 } decode-utf8 ] unit-test
+
+[ "x" ] [ "x" decode-utf8 >string ] unit-test
+
+[ { BIN: 11111000000 } ] [ { BIN: 11011111 BIN: 10000000 } decode-utf8 ] unit-test
+
+[ { BIN: 10000000 } decode-utf8 ] unit-test-fails
+
+[ { BIN: 1111000000111111 } ] [ { BIN: 11101111 BIN: 10000000 BIN: 10111111 } decode-utf8 ] unit-test
+
+[ B{ BIN: 11110101 BIN: 10111111 BIN: 10000000 BIN: 10111111 BIN: 11101111 BIN: 10000000 BIN: 10111111 BIN: 11011111 BIN: 10000000 CHAR: x } ]
+[ { BIN: 101111111000000111111 BIN: 1111000000111111 BIN: 11111000000 CHAR: x } encode-utf8 ] unit-test
diff --git a/core/io/utf8/utf8.factor b/core/io/utf8/utf8.factor
new file mode 100644 (file)
index 0000000..0269e20
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2006, 2007 Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: math kernel sequences sbufs vectors
+namespaces io.encodings combinators ;
+IN: io.utf8
+
+SYMBOL: double
+SYMBOL: triple
+SYMBOL: triple2
+SYMBOL: quad
+SYMBOL: quad2
+SYMBOL: quad3
+
+: starts-2? ( char -- ? )
+    -6 shift BIN: 10 number= ;
+
+: append-nums ( bottom top -- num )
+    over starts-2?
+    [ 6 shift swap BIN: 111111 bitand bitor ]
+    [ decode-error ] if ;
+
+: begin-utf8 ( buf byte -- buf ch state )
+    {
+        { [ dup -7 shift zero? ] [ decoded ] }
+        { [ dup -5 shift BIN: 110 number= ] [ BIN: 11111 bitand double ] }
+        { [ dup -4 shift BIN: 1110 number= ] [ BIN: 1111 bitand triple ] }
+        { [ dup -3 shift BIN: 11110 number= ] [ BIN: 111 bitand quad ] }
+        { [ t ] [ decode-error ] }
+    } cond ;
+
+: end-multibyte ( buf byte ch -- buf ch state )
+    append-nums decoded ;
+
+: (decode-utf8) ( buf byte ch state -- buf ch state )
+    {
+        { begin [ drop begin-utf8 ] }
+        { double [ end-multibyte ] }
+        { triple [ append-nums triple2 ] }
+        { triple2 [ end-multibyte ] }
+        { quad [ append-nums quad2 ] }
+        { quad2 [ append-nums quad3 ] }
+        { quad3 [ end-multibyte ] }
+    } case ;
+
+: decode-utf8 ( seq -- str )
+    [ -rot (decode-utf8) ] decode ;
+
+: encoded ( char -- )
+    BIN: 111111 bitand BIN: 10000000 bitor , ;
+
+: char>utf8 ( char -- )
+    {
+        { [ dup -7 shift zero? ] [ , ] }
+        { [ dup -11 shift zero? ] [
+            dup -6 shift BIN: 11000000 bitor ,
+            encoded
+        ] }
+        { [ dup -16 shift zero? ] [
+            dup -12 shift BIN: 11100000 bitor ,
+            dup -6 shift encoded
+            encoded
+        ] }
+        { [ t ] [
+            dup -18 shift BIN: 11110000 bitor ,
+            dup -12 shift encoded
+            dup -6 shift encoded
+            encoded
+        ] }
+    } cond ;
+
+: encode-utf8 ( str -- seq )
+    [ [ char>utf8 ] each ] B{ } make ;
diff --git a/core/io/windows/errors.factor b/core/io/windows/errors.factor
deleted file mode 100644 (file)
index d5edd71..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
-
-IN: win32-api
-USING: alien errors io-internals kernel math parser sequences words ;
-
-: ERROR_SUCCESS 0 ; inline
-: ERROR_HANDLE_EOF 38 ; inline
-: ERROR_IO_PENDING 997 ; inline
-: WAIT_TIMEOUT 258 ; inline
-
-: FORMAT_MESSAGE_ALLOCATE_BUFFER HEX: 00000100 ; inline
-: FORMAT_MESSAGE_IGNORE_INSERTS  HEX: 00000200 ; inline
-: FORMAT_MESSAGE_FROM_STRING     HEX: 00000400 ; inline
-: FORMAT_MESSAGE_FROM_HMODULE    HEX: 00000800 ; inline
-: FORMAT_MESSAGE_FROM_SYSTEM     HEX: 00001000 ; inline
-: FORMAT_MESSAGE_ARGUMENT_ARRAY  HEX: 00002000 ; inline
-: FORMAT_MESSAGE_MAX_WIDTH_MASK  HEX: 000000FF ; inline
-
-: MAKELANGID ( primary sub -- lang ) 10 shift bitor ;
-
-: LANG_NEUTRAL 0 ; inline
-: SUBLANG_DEFAULT 1 ; inline
diff --git a/core/io/windows/io-internals.factor b/core/io/windows/io-internals.factor
deleted file mode 100644 (file)
index 1766bc1..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
-
-IN: win32-io-internals
-USING: alien arrays errors kernel kernel-internals math namespaces threads 
-       vectors win32-api io generic io-internals sequences ;
-
-SYMBOL: completion-port
-SYMBOL: io-queue
-
-TUPLE: io-queue free-list callbacks ;
-TUPLE: io-callback overlapped quotation stream ;
-
-: expected-error? ( obj -- bool )
-    [ 
-        ERROR_IO_PENDING ERROR_HANDLE_EOF ERROR_SUCCESS WAIT_TIMEOUT 
-        997
-    ] member? ;
-
-: handle-io-error ( -- )
-    GetLastError expected-error? [ win32-error ] unless ;
-
-: queue-error ( len/status -- len/status )
-    GetLastError expected-error? [ drop f ] unless ;
-
-: add-completion ( handle -- )
-    completion-port get f 1 CreateIoCompletionPort drop ;
-
-: get-access ( -- file-mode )
-    "file-mode" get first2 
-    GENERIC_WRITE 0 ? >r
-    GENERIC_READ 0 ? r> bitor ;
-
-: get-sharemode ( -- share-mode )
-     FILE_SHARE_READ FILE_SHARE_WRITE bitor ;
-
-: get-create ( -- creation-disposition )
-    "file-mode" get first2 [
-      [ OPEN_ALWAYS ] [ CREATE_ALWAYS ] if  
-    ] [
-      [ OPEN_EXISTING ] [ 0 ] if
-    ] if ;
-
-: win32-open-file ( file r w -- handle )
-    [ 
-        2array "file-mode" set
-        get-access get-sharemode f get-create FILE_FLAG_OVERLAPPED f 
-        CreateFile dup INVALID_HANDLE_VALUE =
-        [ win32-error ] when
-        dup add-completion
-    ] with-scope ;
-
-: <overlapped> ( -- overlapped )
-    "overlapped-ext" <malloc-object> ;
-
-C: io-queue ( -- queue )
-    V{ } clone over set-io-queue-callbacks ;
-
-C: io-callback ( -- callback )
-    io-queue get io-queue-callbacks [ push ] 2keep
-    length 1 - <overlapped> [ set-overlapped-ext-user-data ] keep
-    swap [ set-io-callback-overlapped ] keep ;
-
-: alloc-io-callback ( quot stream -- overlapped )
-    io-queue get io-queue-free-list [ 
-        first2 io-queue get [ set-io-queue-free-list ] keep
-        io-queue-callbacks nth
-    ] [ <io-callback> ] if*
-    [ set-io-callback-stream ] keep
-    [ set-io-callback-quotation ] keep
-    io-callback-overlapped ;
-
-: get-io-callback ( index -- callback )
-    dup io-queue get io-queue-callbacks nth swap
-    io-queue get [ io-queue-free-list 2array ] keep set-io-queue-free-list 
-    [ f swap set-io-callback-stream ] keep
-    io-callback-quotation ;
-
-: (wait-for-io) ( timeout -- error overlapped len )
-    >r completion-port get  0 <int>  0 <int> 0 <int>
-    pick over r> -rot >r >r GetQueuedCompletionStatus r> r> ;
-
-: overlapped>callback ( overlapped -- callback )
-    *int dup zero? [
-        drop f
-    ] [
-        <alien> overlapped-ext-user-data get-io-callback
-    ] if ;
-
-IN: win32-stream
-DEFER: expire
-IN: win32-io-internals
-: cancel-timedout ( -- )
-    io-queue get 
-    io-queue-callbacks [ io-callback-stream [ expire ] when* ] each ;
-
-: wait-for-io ( timeout -- callback len )
-    (wait-for-io) overlapped>callback swap *int 
-    rot [ queue-error ] unless ;
-
-: win32-init-stdio ( -- )
-    INVALID_HANDLE_VALUE f f 1 CreateIoCompletionPort
-    completion-port set-global
-    <io-queue> io-queue set-global ;
-
diff --git a/core/io/windows/io.factor b/core/io/windows/io.factor
deleted file mode 100644 (file)
index ba38f87..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
-
-IN: io
-USING: win32-api win32-io-internals win32-server win32-stream ;
-USING: alien kernel io-internals namespaces threads ;
-
-: <file-reader> ( path -- stream ) <win32-file-reader> ;
-: <file-writer> ( path -- stream ) <win32-file-writer> ;
-
-SYMBOL: serv
-: accept ( server -- client )
-    [
-        duplex-stream-in
-        serv set
-        serv get update-timeout new-socket 64 <buffer>
-        [
-            serv get alloc-io-callback f swap init-overlapped
-            >r >r >r serv get win32-stream-handle r> r>
-            buffer-ptr <alien> 0 32 32 f r> AcceptEx
-            handle-socket-error!=0/f stop
-        ] callcc1 drop
-        swap dup add-completion <win32-stream> <win32-duplex-stream>
-        dupd <win32-client-stream> swap buffer-free
-    ] with-scope ;
-
-: <client> ( host port -- stream )
-    client-sockaddr new-socket
-    [ swap "sockaddr-in" c-size connect handle-socket-error!=0/f ] keep
-    dup add-completion <win32-stream> <win32-duplex-stream> ;
-: <server> ( port -- stream ) make-win32-server ;
-
-IN: io-internals
-
-: io-multiplex ( ms -- )
-    dup -1 = [ drop INFINITE ] when cancel-timedout wait-for-io
-    swap [ schedule-thread-with ] [ drop ] if* ;
-
-: init-io ( -- )
-    win32-init-stdio
-    init-winsock
-    init-c-io ;
-
diff --git a/core/io/windows/load.factor b/core/io/windows/load.factor
deleted file mode 100644 (file)
index a31ac32..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-REQUIRES: core/windows core/io/buffer ;
-
-PROVIDE: core/io/windows
-{ +files+ {
-    "errors.factor"
-    "io-internals.factor"
-    "stream.factor"
-    "server.factor"
-    "io.factor"
-} } ;
diff --git a/core/io/windows/server.factor b/core/io/windows/server.factor
deleted file mode 100644 (file)
index a153130..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
-
-IN: win32-server
-USING: alien errors generic kernel kernel-internals math namespaces
-       prettyprint sequences io strings threads win32-api
-       win32-io-internals io-internals win32-stream ;
-
-TUPLE: win32-client-stream host port ;
-
-: (handle-socket-error) ( -- )
-    WSAGetLastError dup ERROR_IO_PENDING = over ERROR_SUCCESS = or
-    [ drop ] [ error_message alien>char-string throw ] if ;
-
-: handle-socket-error!=0/f ( int -- )
-    [ 0 f ] member? [ (handle-socket-error) ] unless ;
-
-: handle-socket-error=0/f ( int -- )
-    [ 0 f ] member? [ (handle-socket-error) ] when ;
-
-: init-winsock ( -- )
-    HEX: 0202 <wsadata> WSAStartup handle-socket-error!=0/f ;
-
-: new-socket ( -- socket )
-    AF_INET SOCK_STREAM 0 f f WSA_FLAG_OVERLAPPED
-    WSASocket dup INVALID_SOCKET = [ (handle-socket-error) ] when ;
-
-: setup-sockaddr ( port -- sockaddr )
-    "sockaddr-in" <c-object> swap
-    htons over set-sockaddr-in-port
-    INADDR_ANY over set-sockaddr-in-addr 
-    AF_INET over set-sockaddr-in-family ;
-
-: bind-socket ( port socket -- )
-    swap setup-sockaddr "sockaddr-in" c-size wsa-bind handle-socket-error!=0/f ;
-
-: listen-backlog ( -- n ) 20 ; inline
-
-: listen-socket ( socket -- )
-    listen-backlog wsa-listen handle-socket-error!=0/f ;
-
-: sockaddr> ( sockaddr -- port host )
-    dup sockaddr-in-port ntohs swap sockaddr-in-addr inet-ntoa ;
-
-: extract-remote-host ( buffer -- port host )
-    buffer-ptr <alien> 0 32 32 0 <int> 
-                               0 <int>
-                               0 <int> 
-                        dup >r 0 <int>
-    GetAcceptExSockaddrs r> *int <alien> sockaddr> ;
-
-C: win32-client-stream ( buf stream -- stream )
-    [ set-delegate extract-remote-host ] keep
-    [ set-win32-client-stream-host ] keep 
-    [ set-win32-client-stream-port ] keep ;
-
-M: win32-client-stream client-stream-host ( win32-client-stream -- host )
-    win32-client-stream-host ;
-M: win32-client-stream client-stream-port ( win32-client-stream -- port )
-    win32-client-stream-port ;
-
-: make-win32-server ( port -- win32-stream )
-    new-socket tuck bind-socket dup listen-socket dup add-completion
-    <win32-stream> <win32-duplex-stream> ;
-
-: client-sockaddr ( host port -- sockaddr )
-    setup-sockaddr [
-        >r gethostbyname dup handle-socket-error=0/f hostent-addr
-        r> set-sockaddr-in-addr
-    ] keep ;
-
diff --git a/core/io/windows/stream.factor b/core/io/windows/stream.factor
deleted file mode 100644 (file)
index 9b60717..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
-
-IN: win32-stream
-USING: alien errors generic hashtables io-internals kernel
-kernel-internals math namespaces prettyprint sequences sequences-internals
-io strings threads tools win32-api win32-io-internals ;
-
-TUPLE: win32-stream handle timeout cutoff fileptr file-size eof? ;
-TUPLE: win32-stream-reader in ;
-TUPLE: win32-stream-writer out ;
-TUPLE: win32-duplex-stream ;
-
-: win32-buffer-size 16384 ; inline
-
-: init-overlapped ( fileptr overlapped -- overlapped )
-    0 over set-overlapped-ext-internal
-    0 over set-overlapped-ext-internal-high
-    >r dup 0 ? r> [ set-overlapped-ext-offset ] keep
-    0 over set-overlapped-ext-offset-high
-    f over set-overlapped-ext-event ;
-
-: update-file-pointer ( whence stream -- )
-    dup win32-stream-file-size [
-        [ win32-stream-fileptr + ] keep set-win32-stream-fileptr
-    ] [
-        2drop
-    ] if ;
-
-: update-timeout ( stream -- )
-    dup win32-stream-timeout
-    [ millis + swap set-win32-stream-cutoff ] [ drop ] if* ;
-
-! Write
-: flush-output ( stream -- ) 
-    dup update-timeout 
-    [
-        over alloc-io-callback
-        over win32-stream-fileptr swap init-overlapped >r
-        dup win32-stream-handle
-        over win32-stream-writer-out
-        [ buffer@ ] keep buffer-length
-        f r> WriteFile zero? [ handle-io-error ] when stop
-    ] callcc1 [ over update-file-pointer ] keep
-    over win32-stream-writer-out [ buffer-consume ] keep 
-    buffer-length 0 > [ flush-output ] [ drop ] if ;
-
-: maybe-flush-output ( stream -- )
-    dup win32-stream-writer-out buffer-length 0 > [ flush-output ] [ drop ] if ;
-
-G: do-write 1 standard-combination ;
-M: integer do-write ( integer stream -- )
-    dup win32-stream-writer-out buffer-capacity zero?
-    [ dup flush-output ] when
-    >r ch>string r> win32-stream-writer-out >buffer ;
-
-M: string do-write ( string stream -- )
-    over length over win32-stream-writer-out 2dup buffer-capacity <= [
-        2drop win32-stream-writer-out >buffer
-    ] [
-        2dup buffer-size > [
-            extend-buffer 
-        ] [
-            2drop dup flush-output
-        ] if do-write
-    ] if ;
-
-! Read
-: (fill-input) ( stream -- )
-    dup update-timeout
-    [
-        over alloc-io-callback
-        over win32-stream-fileptr swap init-overlapped >r
-        dup win32-stream-handle
-        over win32-stream-reader-in
-        [ buffer@ ] keep buffer-capacity
-        >r pick r> swap dup win32-stream-file-size
-        [ swap win32-stream-fileptr - min ] [ drop ] if*
-        f r> ReadFile zero? [ handle-io-error ] when stop
-    ] callcc1 [ over win32-stream-reader-in n>buffer ] keep
-    swap update-file-pointer ;
-
-: fill-input ( count stream -- )
-    tuck win32-stream-reader-in buffer-length > [
-        (fill-input)
-    ] [
-        drop
-    ] if ;
-
-: stream-eof? ( stream -- ? )
-    dup win32-stream-eof? [
-        drop t
-    ] [
-        dup win32-stream-file-size [
-            [
-                dup win32-stream-file-size
-                swap win32-stream-fileptr
-                - zero?
-            ] keep set-win32-stream-eof?
-        ] [
-            drop
-        ] if
-        f
-    ] if ;
-
-: unless-done ( stream quot -- value )
-    over stream-eof? pick win32-stream-reader-in buffer-empty? and
-    [ 2drop f ] [ call ] if ;
-
-: stream-read-part ( count stream -- string )
-    [ fill-input ] 2keep
-    [ dupd win32-stream-reader-in buffer> ] unless-done nip ;
-
-: stream-read-loop ( count stream sbuf -- )
-    pick over length - dup 0 > [
-        pick stream-read-part dup [
-            dup nappend stream-read-loop
-        ] [
-            2drop 2drop
-        ] if
-    ] [
-        2drop 2drop
-    ] if ;
-
-M: win32-stream-reader stream-read ( n stream -- str/f )
-    >r 0 max >fixnum r>
-    2dup stream-read-part dup [
-        pick over length > [
-            pick <sbuf>
-            [ swap nappend ] keep
-            [ stream-read-loop ] keep
-            "" like
-        ] [
-            2nip
-        ] if
-    ] [
-        2nip
-    ] if ;
-
-M: win32-stream-reader stream-read1 ( stream -- ch/f )
-    1 over fill-input [ win32-stream-reader-in buffer-pop ] unless-done ;
-
-M: win32-stream-reader stream-close ( stream -- )
-    dup win32-stream-reader-in buffer-free
-    win32-stream-handle CloseHandle win32-error=0 ;
-
-M: win32-stream-writer stream-flush ( stream -- ) maybe-flush-output ;
-M: win32-stream-writer stream-write1 ( ch stream -- ) >r >fixnum r> do-write ;
-M: win32-stream-writer stream-write ( str stream -- ) do-write ;
-M: win32-stream-writer stream-close ( stream -- )
-    dup maybe-flush-output
-    dup win32-stream-writer-out buffer-free
-    win32-stream-handle CloseHandle win32-error=0 ;
-
-M: win32-stream set-timeout ( n stream -- ) set-win32-stream-timeout ;
-
-: expire ( stream -- )
-    dup win32-stream-timeout millis pick win32-stream-cutoff > and [
-        win32-stream-handle CancelIo [ win32-error ] unless
-    ] [
-        drop
-    ] if ;
-
-C: win32-stream ( handle -- stream )
-    [ set-win32-stream-handle ] keep
-    f swap [ set-win32-stream-timeout ] keep
-    0 swap [ set-win32-stream-cutoff ] keep
-    dup win32-stream-handle f GetFileSize dup -1 = [ drop f ] when
-    over set-win32-stream-file-size
-    dup win32-stream-file-size zero? [ t over set-win32-stream-eof? ] when
-    0 swap [ set-win32-stream-fileptr ] keep ;
-
-C: win32-stream-reader ( stream -- stream )
-    [ set-delegate ] keep
-    win32-buffer-size <buffer> swap [ set-win32-stream-reader-in ] keep ;
-
-C: win32-stream-writer ( stream -- stream )
-    [ set-delegate ] keep
-    win32-buffer-size <buffer> swap [ set-win32-stream-writer-out ] keep ;
-
-: make-win32-file-reader ( stream -- stream )
-    <win32-stream-reader> <line-reader> ;
-
-: <win32-file-reader> ( path -- stream )
-    t f win32-open-file <win32-stream> make-win32-file-reader ;
-
-: make-win32-file-writer ( stream -- stream )
-    <win32-stream-writer> <plain-writer> ;
-
-: <win32-file-writer> ( path -- stream )
-    f t win32-open-file <win32-stream> make-win32-file-writer ;
-
-C: win32-duplex-stream ( stream -- stream )
-    >r [ make-win32-file-reader ] keep make-win32-file-writer <duplex-stream> r>
-    [ set-delegate ] keep ;
-
-M: win32-duplex-stream stream-close ( stream -- )
-    dup duplex-stream-out maybe-flush-output
-    dup duplex-stream-out win32-stream-writer-out buffer-free
-    dup duplex-stream-in win32-stream-reader-in buffer-free
-    duplex-stream-in
-    win32-stream-handle CloseHandle drop ;
diff --git a/core/kernel.factor b/core/kernel.factor
deleted file mode 100644 (file)
index a5906f3..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: kernel
-USING: generic kernel-internals math math-internals ;
-
-: 2swap ( x y z t -- z t x y ) rot >r rot r> ; inline
-
-: clear ( -- ) V{ } set-datastack ;
-
-GENERIC: hashcode ( obj -- n )
-M: object hashcode drop 0 ;
-
-GENERIC: equal? ( obj obj -- ? )
-M: object equal? eq? ;
-
-: = ( obj1 obj2 -- ? )
-    2dup eq? [ 2drop t ] [ equal? ] if ; inline
-
-GENERIC: <=> ( obj1 obj2 -- n )
-
-GENERIC: clone ( obj -- cloned )
-M: object clone ;
-
-: set-boot ( quot -- ) 8 setenv ;
-
-: ? ( cond true false -- true/false )
-    rot [ drop ] [ nip ] if ; inline
-
-: cpu ( -- cpu ) 7 getenv ; foldable
-: os ( -- os ) 11 getenv ; foldable
-: windows? ( -- ? ) os "windows" = ; foldable
-: macosx? ( -- ? ) os "macosx" = ; foldable
-
-: slip ( quot x -- x ) >r call r> ; inline
-
-: 2slip ( quot x y -- x y ) >r >r call r> r> ; inline
-
-: keep ( x quot -- x ) over >r call r> ; inline
-
-: 2keep ( x y quot -- x y ) over >r pick >r call r> r> ; inline
-
-: 3keep ( x y z quot -- x y z )
-    >r 3dup r> swap >r swap >r swap >r call r> r> r> ;
-    inline
-
-: 2apply ( x y quot -- ) tuck 2slip call ; inline
-
-: if* ( cond true false -- )
-    pick [ drop call ] [ 2nip call ] if ; inline
-
-: ?if ( default cond true false -- )
-    >r >r [ nip r> r> drop call ] [ r> drop r> call ] if* ;
-    inline
-
-: unless ( cond false -- ) [ ] swap if ; inline
-
-: unless* ( cond false -- )
-    over [ drop ] [ nip call ] if ; inline
-
-: when ( cond true -- ) [ ] if ; inline
-
-: when* ( cond true -- ) dupd [ drop ] if ; inline
-
-: >boolean ( obj -- ? ) t f ? ; inline
-: and ( obj1 obj2 -- ? ) f ? ; inline
-: or ( obj1 obj2 -- ? ) t swap ? ; inline
-: xor ( obj1 obj2 -- ? ) [ not ] when ; inline
-
-: with ( obj quot elt -- obj quot )
-    pick pick >r >r swap call r> r> ; inline
-
-: keep-datastack ( quot -- )
-    datastack slip set-datastack drop ; inline
-
-IN: kernel-internals
-
-! These words are unsafe. Don't use them.
-: declare ( spec -- ) drop ;
-
-: array-capacity ( array -- n )
-    1 slot { fixnum } declare ; inline
-
-: array-nth ( n array -- elt )
-    swap 2 fixnum+fast slot ; inline
-
-: set-array-nth ( elt n array -- )
-    swap 2 fixnum+fast set-slot ; inline
-
-! Some runtime implementation details
-: num-types ( -- n ) 19 ; inline
-: tag-mask BIN: 111 ; inline
-: num-tags 8 ; inline
-: tag-bits 3 ; inline
-
-: cell ( -- n ) 1 getenv ; foldable
-
-: fixnum-tag  BIN: 000 ; inline
-: bignum-tag  BIN: 001 ; inline
-: word-tag    BIN: 010 ; inline
-: object-tag  BIN: 011 ; inline
-: ratio-tag   BIN: 100 ; inline
-: float-tag   BIN: 101 ; inline
-: complex-tag BIN: 110 ; inline
-: wrapper-tag BIN: 111 ; inline
-
-: array-type      8  ; inline
-: hashtable-type  10 ; inline
-: vector-type     11 ; inline
-: string-type     12 ; inline
-: sbuf-type       13 ; inline
-: quotation-type  14 ; inline
-: dll-type        15 ; inline
-: alien-type      16 ; inline
-: tuple-type      17 ; inline
-: byte-array-type 18 ; inline
-
-IN: kernel
-
-: win32? ( -- ? ) windows? cell 4 = and ; foldable
-: win64? ( -- ? ) windows? cell 8 = and ; foldable
-
-IN: memory
-
-: generations ( -- n ) 15 getenv ;
-: image ( -- path ) 16 getenv ;
-: save ( -- ) image save-image ;
diff --git a/core/kernel.facts b/core/kernel.facts
deleted file mode 100644 (file)
index 8a82cc7..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-IN: kernel
-USING: generic help kernel math memory namespaces sequences kernel-internals ;
-
-HELP: eq? ( obj1 obj2 -- ? )
-{ $values { "obj1" "an object" } { "obj2" "an object" } }
-{ $description "Tests if two references point at the same object." } ;
-
-HELP: drop  ( x -- )                 $shuffle ;
-HELP: 2drop ( x y -- )               $shuffle ;
-HELP: 3drop ( x y z -- )             $shuffle ;
-HELP: dup   ( x -- x x )             $shuffle ;
-HELP: 2dup  ( x y -- x y x y )       $shuffle ;
-HELP: 3dup  ( x y z -- x y z x y z ) $shuffle ;
-HELP: rot   ( x y z -- y z x )       $shuffle ;
-HELP: -rot  ( x y z -- z x y )       $shuffle ;
-HELP: dupd  ( x y -- x x y )         $shuffle ;
-HELP: swapd ( x y z -- y x z )       $shuffle ;
-HELP: nip   ( x y -- y )             $shuffle ;
-HELP: 2nip  ( x y z -- z )           $shuffle ;
-HELP: tuck  ( x y -- y x y )         $shuffle ;
-HELP: over  ( x y -- x y x )         $shuffle ;
-HELP: pick  ( x y z -- x y z x )     $shuffle ;
-HELP: swap  ( x y -- y x )           $shuffle ;
-HELP: 2swap ( x y z t -- z t x y )   $shuffle ;
-
-HELP: >r ( x -- )
-{ $values { "x" "an object" } } { $description "Moves the top of the data stack to the retain stack." } ;
-
-HELP: r> ( -- x )
-{ $values { "x" "an object" } } { $description "Moves the top of the retain stack to the data stack." } ;
-
-HELP: datastack ( -- ds )
-{ $values { "ds" "a vector" } }
-{ $description "Outputs the a vector 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 vector." } ;
-
-HELP: set-datastack ( ds -- )
-{ $values { "ds" "a vector" } }
-{ $description "Replaces the data stack contents with a copy of a vector. The end of the vector becomes the top of the stack." } ;
-
-HELP: retainstack ( -- rs )
-{ $values { "rs" "a vector" } }
-{ $description "Outputs the a vector 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 vector." } ;
-
-HELP: set-retainstack ( rs -- )
-{ $values { "rs" "a vector" } }
-{ $description "Replaces the retain stack contents with a copy of a vector. The end of the vector becomes the top of the stack." } ;
-
-HELP: callstack ( -- cs )
-{ $values { "cs" "a vector" } }
-{ $description "Outputs the a vector containing a copy of the call stack contents right before the call to this word, with the top of the stack at the end of the vector. The call frame of the caller word is " { $emphasis "not" } " included." } ;
-
-HELP: set-callstack ( cs -- )
-{ $values { "cs" "a vector" } }
-{ $description "Replaces the call stack contents with a copy of a vector. The end of the vector becomes the top of the stack. The current quotation continues executing. The new callstack takes effect when the current quotation returns, resulting in a callframe being popped." } ;
-
-HELP: clear
-{ $description "Clears the data stack." } ;
-
-HELP: hashcode
-{ $values { "obj" "an object" } { "n" "a fixnum" } }
-{ $contract "Outputs the hashcode of the object. The hashcode operation must satisfy the following properties:"
-{ $list
-    "the hashcode should be a fixnum, however returning a bignum will not cause any problems other than potential performance degradation."
-    { "if two objects are equal under " { $link = } ", they must have equal hashcodes" }
-    "the hashcode is only permitted to change if the object is mutated in some way"
-}
-"If mutable objects are used as hashtable keys, they must not be mutated in such a way that their hashcode changes. Doing so will violate bucket sorting invariants and result in undefined behavior." } ;
-
-HELP: =
-{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } }
-{ $description
-    "Tests if two objects are equal. If " { $snippet "obj1" } " and " { $snippet "obj2" } " point to the same object, outputs " { $link t } ". Otherwise, calls the " { $link equal? } " generic word."
-} ;
-
-HELP: equal?
-{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } }
-{ $contract
-    "Tests if two objects are equal."
-    $terpri
-    "Method definitions should ensure that this is an equality relation:"
-    { $list
-        { $snippet "a = a" }
-        { { $snippet "a = b" } " implies " { $snippet "b = a" } }
-        { { $snippet "a = b" } " and " { $snippet "b = c" } " implies " { $snippet "a = c" } }
-    }
-    "While user code can define methods for this generic word, it should not call it directly, since it is slightly less efficient than " { $link = } " in the case the two references point to the same object."
-}
-{ $examples
-    "The most common reason for defining a method for this generic word to ensure that instances of a specific tuple class are only ever equal to themselves, overriding the default implementation which checks slot values for equality."
-    { $code "TUPLE: foo ;" "M: foo equal? eq? ;" }
-} ;
-
-HELP: <=>
-{ $values { "obj1" "an object" } { "obj2" "an object" } { "n" "an integer" } }
-{ $contract
-    "Compares two objects using an intrinsic partial order, for example, the natural order for real numbers and lexicographic order for strings."
-    $terpri
-    "The output value is one of the following:"
-    { $list
-        { "positive - indicating that " { $snippet "str1" } " follows " { $snippet "str2" } }
-        { "zero - indicating that " { $snippet "str1" } " is equal to " { $snippet "str2" } }
-        { "negative - indicating that " { $snippet "str1" } " precedes " { $snippet "str2" } }
-    }
-    "The default implementation treats the two objects as sequences, and recursively compares their elements. So no extra work is required to compare sequences lexicographically."
-}
-{ $see-also natural-sort } ;
-
-HELP: clone
-{ $values { "obj" "an object" } { "cloned" "a new object" } }
-{ $contract "Outputs a new object equal to the given object. This is not guaranteed to actually copy the object; it does nothing with immutable objects, and does not copy words either. However, sequences and tuples can be cloned to obtain a shallow copy of the original." } ;
-
-HELP: set-boot
-{ $values { "quot" "a quotation" } }
-{ $description "Sets the initial quotation called by the runtime as the last stage of startup. The image must be saved for changes to the boot quotation to take effect. Usually the boot quotation should not be changed." } ;
-
-HELP: num-types
-{ $values { "n" "a postiive integer" } }
-{ $description "Outputs one more than the maximum value from the " { $link type } " primitive." } ;
-
-DEFER: type ( object -- n )
-
-HELP: type
-{ $values { "object" "an object" } { "n" "a type number" } }
-{ $description "Outputs an object's type number, between zero and one less than " { $link num-types } ". This is implementation detail and user code should call " { $link class } " instead." }
-{ $see-also type>class tag } ;
-
-HELP: ?
-{ $values { "cond" "a generalized boolean" } { "true" "an object" } { "false" "an object" } { "true/false" "one two input objects" } }
-{ $description "Chooses between two values depending on the boolean value of " { $snippet "cond" } "." } ;
-
-HELP: >boolean
-{ $values { "obj" "a generalized boolean" } { "?" "a boolean" } }
-{ $description "Convert a generalized boolean into a boolean. That is, " { $link f } " retains its value, whereas anything else becomes " { $link t } "." } ;
-
-HELP: not ( obj -- ? )
-{ $values { "obj" "a generalized boolean" } { "?" "a boolean" } }
-{ $description "For " { $link f } " outputs " { $link t } " and for anything else outputs " { $link f } "." } ;
-
-HELP: and
-{ $values { "obj1" "a generalized boolean" } { "obj2" "a generalized boolean" } { "obj" "a generalized boolean" } }
-{ $description "Tests if neither object is " { $link f } "." } ;
-
-HELP: or
-{ $values { "obj1" "a generalized boolean" } { "obj2" "a generalized boolean" } { "obj" "a generalized boolean" } }
-{ $description "Tests if at least one object is not " { $link f } "." } ;
-
-HELP: xor
-{ $values { "obj1" "a generalized boolean" } { "obj2" "a generalized boolean" } { "obj" "a generalized boolean" } }
-{ $description "Tests if at exactly one object is not " { $link f } "." } ;
-
-HELP: cpu
-{ $values { "cpu" "a string" } }
-{ $description
-    "Outputs a string descriptor of the current CPU architecture. Currently, this set of descriptors is:"
-    { $code "amd64" "ppc" "x86" }
-} ;
-
-HELP: os
-{ $values { "os" "a string" } }
-{ $description
-    "Outputs a string descriptor of the current operating system family. Currently, this set of descriptors is:"
-    { $code "freebsd" "linux" "macosx" "solaris" "win32" "unix" }
-} ;
-
-HELP: windows?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Windows." } ;
-
-HELP: macosx?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on Mac OS X." } ;
-
-HELP: call ( quot -- )
-{ $values { "quot" "a quotation" } }
-{ $description "Push the current callframe on the callstack, and set the callframe to the given quotation. Conceptually, calls the quotation, as if its definition was substituted at the location of the call." }
-{ $examples
-    "The following two lines are equivalent:"
-    { $code "2 [ 2 + 3 * ] call" "2 2 + 3 *" }
-} ;
-
-HELP: slip
-{ $values { "quot" "a quotation" } { "x" "an object" } }
-{ $description "Calls a quotation while hiding the top of the stack." } ;
-
-HELP: 2slip
-{ $values { "quot" "a quotation" } { "x" "an object" } { "y" "an object" } }
-{ $description "Calls a quotation while hiding the top two stack elements." } ;
-
-HELP: keep
-{ $values { "quot" "a quotation with stack effect " { $snippet "( x -- )" } } { "x" "an object" } }
-{ $description "Call a quotation with a value on the stack, restoring the value when the quotation returns." } ;
-
-HELP: 2keep
-{ $values { "quot" "a quotation with stack effect " { $snippet "( x y -- )" } } { "x" "an object" } { "y" "an object" } }
-{ $description "Call a quotation with two values on the stack, restoring the values when the quotation returns." } ;
-
-HELP: 3keep
-{ $values { "quot" "a quotation with stack effect " { $snippet "( x y -- )" } } { "x" "an object" } { "y" "an object" } { "z" "an object" } }
-{ $description "Call a quotation with three values on the stack, restoring the values when the quotation returns." } ;
-
-HELP: 2apply
-{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } { "x" "an object" } { "y" "an object" } }
-{ $description "Applies the quotation to " { $snippet "x" } ", then to " { $snippet "y" } "." } ;
-
-HELP: if ( cond true false -- )
-{ $values { "cond" "a generalized boolean" } { "true" "a quotation" } { "false" "a quotation" } }
-{ $description "If " { $snippet "cond" } " is " { $link f } ", calls the " { $snippet "false" } " quotation. Otherwise calls the " { $snippet "true" } " quotation."
-$terpri
-"The " { $snippet "cond" } " value is removed from the stack before either quotation is called." } ;
-
-HELP: when
-{ $values { "cond" "a generalized boolean" } { "true" "a quotation" } }
-{ $description "If " { $snippet "cond" } " is not " { $link f } ", calls the " { $snippet "true" } " quotation."
-$terpri
-"The " { $snippet "cond" } " value is removed from the stack before the quotation is called." } ;
-
-HELP: unless
-{ $values { "cond" "a generalized boolean" } { "false" "a quotation" } }
-{ $description "If " { $snippet "cond" } " is " { $link f } ", calls the " { $snippet "false" } " quotation."
-$terpri
-"The " { $snippet "cond" } " value is removed from the stack before the quotation is called." } ;
-
-HELP: if*
-{ $values { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } { "false" "a quotation" } }
-{ $description "Alternative conditional form that preserves the " { $snippet "cond" } " value if it is true."
-$terpri
-"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."
-$terpri
-"The following two lines are equivalent:"
-{ $code "X [ Y ] [ Z ] if*" "X dup [ Y ] [ drop Z ] if" } } ;
-
-HELP: when*
-{ $values { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } }
-{ $description "Variant of " { $link if* } " with no false quotation."
-$terpri
-"The following two lines are equivalent:"
-{ $code "X [ Y ] when*" "X dup [ Y ] [ drop ] if" } } ;
-
-HELP: unless*
-{ $values { "cond" "a generalized boolean" } { "false" "a quotation " } }
-{ $description "Variant of " { $link if* } " with no true quotation."
-$terpri
-"The following two lines are equivalent:"
-{ $code "X [ Y ] unless*" "X dup [ ] [ drop Y ] if" } } ;
-
-HELP: ?if
-{ $values { "default" "an object" } { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } { "false" "a quotation with stack effect " { $snippet "( default -- )" } } }
-{ $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."
-$terpri
-"The following two lines are equivalent:"
-{ $code "[ X ] [ Y ] ?if" "dup [ nip X ] [ drop Y ] if" } } ;
-
-HELP: with
-{ $values { "obj" "an object" } { "quot" "a quotation with stack effect " { $snippet "( obj elt -- )" } } { "elt" "an object" } }
-{ $description "Utility word used to implement curried combinators such as " { $link each-with } " and " { $link map-with } "." } ;
-
-HELP: keep-datastack
-{ $values { "quot" "a quotation" } }
-{ $description "Calls a quotation, saving the data stack before calling it and restoring it after it returns." } ;
-
-HELP: die
-{ $description "Starts the front-end processor (FEP), which is a low-level debugger which can inspect memory addresses and the like. The FEP is also entered when a critical error occurs." } ;
-
-HELP: exit ( n -- )
-{ $values { "n" "an integer exit code" } }
-{ $description "Exits the Factor process." } ;
-
-HELP: millis ( -- n )
-{ $values { "n" "an integer" } }
-{ $description "Outputs the number of milliseconds ellapsed since midnight January 1, 1970." } ;
-
-HELP: os-env ( key -- value )
-{ $values { "key" "a string" } { "value" "a string" } }
-{ $description "Looks up the value of a shell environment variable." }
-{ $examples 
-    "This is an operating system-specific feature. On Unix, you can do:"
-    { $example "\"USER\" os-env print" "slava" }
-} ;
-
-HELP: cell
-{ $values { "n" "a positive integer" } }
-{ $description "Outputs the pointer size in bytes of the current CPU architecture." } ;
-
-HELP: win32?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on 32-bit Windows." } ;
-
-HELP: win64?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if Factor is running on 64-bit Windows." } ;
-
-IN: memory
-
-HELP: generations
-{ $values { "n" "a positive integer" } }
-{ $description "Outputs the number of generations partitioning the heap." } ;
-
-HELP: image
-{ $values { "path" "a path name string" } }
-{ $description "Outputs the path name of the currently running Factor image." } ;
-
-HELP: save-image ( path -- )
-{ $values { "path" "a path name string" } }
-{ $description "Saves a snapshot of the heap to the given file, overwriting the file if it already exists." } ;
-
-HELP: save
-{ $description "Saves a snapshot of the heap to the current image file." } ;
-
-IN: kernel-internals
-
-HELP: (clone) ( obj -- newobj )
-{ $values { "obj" "an object" } { "newobj" "a shallow copy" } }
-{ $description "Outputs a byte-by-byte copy of the given object. User code should call " { $link clone } " instead." } ;
-
-HELP: declare
-{ $values { "spec" "an array of class words" } }
-{ $description "Declares that the elements at the top of the stack are instances of the classes in " { $snippet "spec" } "." }
-{ $warning "The compiler blindly trusts declarations, and false declarations can lead to crashes, memory corruption and other undesirable behavior." }
-{ $examples
-    "The optimizer cannot do anything with the below code as you can verify with " { $link "ui-dataflow" } ":"
-    { $code "2 + 10 *" }
-    "However, if we declare that the top of the stack is a " { $link float } ", then type checks and generic dispatch are eliminated, and the compiler can use unsafe intrinsics:"
-    { $code "{ float } declare 2 + 10 *" }
-} ;
-
-HELP: array-capacity
-{ $values { "array" "an array" } { "n" "a non-negative fixnum" } }
-{ $description "Low-level array length accessor." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is unsafe. It does not check types, so improper use can corrupt memory." } ;
-
-HELP: array-nth
-{ $values { "n" "a non-negative fixnum" } { "array" "an array" }  { "elt" "an object" } }
-{ $description "Low-level array element accessor." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory." } ;
-
-HELP: set-array-nth
-{ $values { "elt" "an object" } { "n" "a non-negative fixnum" } { "array" "an array" }  }
-{ $description "Low-level array element mutator." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory." } ;
-
-HELP: tag ( object -- n )
-{ $values { "object" "an object" } { "n" "a tag number" } }
-{ $description "Outputs an object's tag number, between zero and one less than " { $link num-tags } ". This is implementation detail and user code should call " { $link class } " instead." }
-{ $see-also type } ;
-
-HELP: dispatch ( n array -- )
-{ $values { "n" "a fixnum" } { "array" "an array of quotations" } }
-{ $description "Calls the " { $snippet "n" } "th quotation in the array." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is an implementation detail used by the generic word system to accelerate method dispatch. It does not perform type or bounds checks, and user code should not need to call it directly." } ;
-
-HELP: getenv ( n -- obj )
-{ $values { "n" "a non-negative integer" } { "obj" "an object" } }
-{ $description "Reads an object from the Factor runtime's environment table. User code never has to read the environment table directly; instead, use one of the callers of this word." } ;
-
-HELP: setenv ( obj n -- )
-{ $values { "n" "a non-negative integer" } { "obj" "an object" } }
-{ $description "Writes an object to the Factor runtime's environment table. User code never has to write to the environment table directly; instead, use one of the callers of this word." } ;
-
-HELP: slot ( obj m -- value )
-{ $values { "obj" "an object" } { "m" "a non-negative fixnum" } { "value" "an object" } }
-{ $description "Reads the object stored at the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
-
-HELP: set-slot ( value obj n -- )
-{ $values { "value" "an object" } { "obj" "an object" } { "m" "a non-negative fixnum" } }
-{ $description "Writes " { $snippet "value" } " to the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
-{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
diff --git a/core/kernel/authors.txt b/core/kernel/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/kernel/kernel-docs.factor b/core/kernel/kernel-docs.factor
new file mode 100644 (file)
index 0000000..bbfd15c
--- /dev/null
@@ -0,0 +1,535 @@
+USING: generic help.markup help.syntax math memory
+namespaces sequences kernel.private layouts sorting classes
+kernel.private vectors combinators quotations strings words
+assocs arrays ;
+IN: kernel
+
+ARTICLE: "shuffle-words" "Shuffle words"
+"Shuffle words rearrange items at the top of the data stack. They control the flow of data between words that perform actions."
+$nl
+"Removing stack elements:"
+{ $subsection drop }
+{ $subsection 2drop }
+{ $subsection 3drop }
+{ $subsection nip }
+{ $subsection 2nip }
+"Duplicating stack elements:"
+{ $subsection dup }
+{ $subsection 2dup }
+{ $subsection 3dup }
+{ $subsection dupd }
+{ $subsection over }
+{ $subsection pick }
+{ $subsection tuck }
+"Permuting stack elements:"
+{ $subsection swap }
+{ $subsection swapd }
+{ $subsection rot }
+{ $subsection -rot }
+{ $subsection roll }
+{ $subsection -roll }
+"Sometimes an additional storage area is needed to hold objects. The " { $emphasis "retain stack" } " is an auxilliary stack for this purpose. Objects can be moved between the data and retain stacks using the following two words:"
+{ $subsection >r }
+{ $subsection r> }
+"The top of the data stack is ``hidden'' between " { $link >r } " and " { $link r> } ":"
+{ $example "1 2 3 >r .s r>" "2\n1" }
+"Words must not leave objects on the retain stack, nor expect values to be there on entry. The retain stack is for local storage within a word only, and occurrences of " { $link >r } " and " { $link r> } " must be balanced inside a single quotation. One exception is the following trick involving " { $link if } "; values may be pushed on the retain stack before the condition value is computed, as long as both branches of the " { $link if } " pop the values off the retain stack before returning:"
+{ $code
+    ": foo ( m ? n -- m+n/n )"
+    "    >r [ r> + ] [ drop r> ] if ; ! This is OK"
+} ;
+
+ARTICLE: "basic-combinators" "Basic combinators"
+"The following pair of words invoke words and quotations reflectively:"
+{ $subsection call }
+{ $subsection execute }
+"These words are used to implement " { $emphasis "combinators" } ", which are words that take code from the stack. Note that combinator definitions must be followed by the " { $link POSTPONE: inline } " declaration in order to compile in the optimizing compiler; for example:"
+{ $code
+    ": keep ( x quot -- x | quot: x -- )"
+    "    over >r call r> ; inline"
+}
+"Word inlining is documented in " { $link "declarations" } "."
+$nl
+"There are some words that combine shuffle words with " { $link call } ". They are useful for implementing higher-level combinators."
+{ $subsection slip }
+{ $subsection 2slip }
+{ $subsection keep }
+{ $subsection 2keep }
+{ $subsection 3keep }
+{ $subsection 2apply }
+"A pair of utility words built from " { $link 2apply } ":"
+{ $subsection both? }
+{ $subsection either? }
+"Quotations can be composed using efficient quotation-specific operations:"
+{ $subsection curry }
+{ $subsection 2curry }
+{ $subsection 3curry }
+{ $subsection curry* }
+{ $subsection compose }
+{ $subsection 3compose }
+"Quotations also implement the sequence protocol, and can be manipulated with sequence words; see " { $link "quotations" } "."
+{ $see-also "combinators" } ;
+
+ARTICLE: "booleans" "Booleans"
+"In Factor, any object that is not " { $link f } " has a true value, and " { $link f } " has a false value. The " { $link t } " object is the canonical true value."
+{ $subsection f }
+{ $subsection t }
+"The " { $link f } " object is the unique instance of the " { $link f } " class; the two are distinct objects. The latter is also a parsing word which adds the " { $link f } " object to the parse tree at parse time. To refer to the class itself you must use " { $link POSTPONE: POSTPONE: } " or " { $link POSTPONE: \ } " to prevent the parsing word from executing."
+$nl
+"Here is the " { $link f } " object:"
+{ $example "f ." "f" }
+"Here is the " { $link f } " class:"
+{ $example "\\ f ." "POSTPONE: f" }
+"They are not equal:"
+{ $example "f \\ f = ." "f" }
+"Here is an array containing the " { $link f } " object:"
+{ $example "{ f } ." "{ f }" }
+"Here is an array containing the " { $link f } " class:"
+{ $example "{ POSTPONE: f } ." "{ POSTPONE: f }" }
+"The " { $link f } " object is an instance of the " { $link f } " class:"
+{ $example "f class ." "POSTPONE: f" }
+"The " { $link f } " class is an instance of " { $link word } ":"
+{ $example "\\ f class ." "word" }
+"On the other hand, " { $link t } " is just a word, and there is no class which it is a unique instance of."
+{ $example "t \\ t eq? ." "t" }
+"Many words which search collections confuse the case of no element being present with an element being found equal to " { $link f } ". If this distinction is imporant, there is usually an alternative word which can be used; for example, compare " { $link at } " with " { $link at* } "."
+$nl
+"A tuple cannot delegate to " { $link f } " at all, since a delegate of " { $link f } " actually denotes that no delegate is set. See " { $link set-delegate } "." ;
+
+ARTICLE: "conditionals" "Conditionals and logic"
+"The basic conditionals:"
+{ $subsection if }
+{ $subsection when }
+{ $subsection unless }
+"Forms abstracting a common stack shuffle pattern:"
+{ $subsection if* }
+{ $subsection when* }
+{ $subsection unless* }
+"Another form abstracting a common stack shuffle pattern:"
+{ $subsection ?if }
+"Sometimes instead of branching, you just need to pick one of two values:"
+{ $subsection ? }
+"Forms which abstract away common patterns involving multiple nested branches:"
+{ $subsection cond }
+{ $subsection case }
+"There are some logical operations on booleans:"
+{ $subsection >boolean }
+{ $subsection not }
+{ $subsection and }
+{ $subsection or }
+{ $subsection xor }
+{ $see-also "booleans" "bitwise-arithmetic" both? either? } ;
+
+ARTICLE: "equality" "Equality and comparison testing"
+"There are two distinct notions of ``sameness'' when it comes to objects. You can test if two references point to the same object, or you can test if two objects are equal in some sense, usually by being instances of the same class, and having equal slot values. Both notions of equality are equality relations in the mathematical sense."
+{ $subsection eq? }
+{ $subsection = }
+"Some types of objects also have an intrinsic order allowing sorting using " { $link natural-sort } ":"
+{ $subsection <=> }
+{ $subsection compare }
+"An object can be cloned; the clone has distinct identity but equal value:"
+{ $subsection clone } ;
+
+! Defined in handbook.factor
+ABOUT: "dataflow"
+
+HELP: version
+{ $values { "str" string } }
+{ $description "Outputs the version number of the current Factor instance." } ;
+
+HELP: eq? ( obj1 obj2 -- ? )
+{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $description "Tests if two references point at the same object." } ;
+
+HELP: drop  ( x -- )                 $shuffle ;
+HELP: 2drop ( x y -- )               $shuffle ;
+HELP: 3drop ( x y z -- )             $shuffle ;
+HELP: dup   ( x -- x x )             $shuffle ;
+HELP: 2dup  ( x y -- x y x y )       $shuffle ;
+HELP: 3dup  ( x y z -- x y z x y z ) $shuffle ;
+HELP: rot   ( x y z -- y z x )       $shuffle ;
+HELP: -rot  ( x y z -- z x y )       $shuffle ;
+HELP: dupd  ( x y -- x x y )         $shuffle ;
+HELP: swapd ( x y z -- y x z )       $shuffle ;
+HELP: nip   ( x y -- y )             $shuffle ;
+HELP: 2nip  ( x y z -- z )           $shuffle ;
+HELP: tuck  ( x y -- y x y )         $shuffle ;
+HELP: over  ( x y -- x y x )         $shuffle ;
+HELP: pick  ( x y z -- x y z x )     $shuffle ;
+HELP: swap  ( x y -- y x )           $shuffle ;
+HELP: roll                           $shuffle ;
+HELP: -roll                          $shuffle ;
+
+HELP: >r ( x -- )
+{ $values { "x" object } } { $description "Moves the top of the data stack to the retain stack." } ;
+
+HELP: r> ( -- x )
+{ $values { "x" object } } { $description "Moves the top of the retain stack to the data stack." } ;
+
+HELP: datastack ( -- ds )
+{ $values { "ds" 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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $description "Replaces the call stack contents. The end of the vector becomes the top of the stack. Control flow is transferred immediately to the new call stack." } ;
+
+HELP: clear
+{ $description "Clears the data stack." } ;
+
+HELP: hashcode*
+{ $values { "depth" integer } { "obj" object } { "code" fixnum } }
+{ $contract "Outputs the hashcode of an object. The hashcode operation must satisfy the following properties:"
+{ $list
+    { "if two objects are equal under " { $link = } ", they must have equal hashcodes" }
+    { "if the hashcode of an object depends on the values of its slots, the hashcode of the slots must be computed recursively by calling " { $link hashcode* } " with a " { $snippet "level" } " parameter decremented by one. This avoids excessive work while still computing well-distributed hashcodes. The " { $link recursive-hashcode } " combinator can help with implementing this logic" }
+    { "the hashcode should be a " { $link fixnum } ", however returning a " { $link bignum } " will not cause any problems other than potential performance degradation."
+    "the hashcode is only permitted to change between two invocations if the object was mutated in some way" }
+}
+"If mutable objects are used as hashtable keys, they must not be mutated in such a way that their hashcode changes. Doing so will violate bucket sorting invariants and result in undefined behavior." } ;
+
+HELP: hashcode
+{ $values { "obj" object } { "code" fixnum } }
+{ $description "Computes the hashcode of an object with a default hashing depth. See " { $link hashcode* } " for the hashcode contract." } ;
+
+{ hashcode hashcode* } related-words
+
+HELP: =
+{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $description
+    "Tests if two objects are equal. If " { $snippet "obj1" } " and " { $snippet "obj2" } " point to the same object, outputs " { $link t } ". Otherwise, calls the " { $link equal? } " generic word."
+} ;
+
+HELP: equal?
+{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $contract
+    "Tests if two objects are equal."
+    $nl
+    "Method definitions should ensure that this is an equality relation:"
+    { $list
+        { $snippet "a = a" }
+        { { $snippet "a = b" } " implies " { $snippet "b = a" } }
+        { { $snippet "a = b" } " and " { $snippet "b = c" } " implies " { $snippet "a = c" } }
+    }
+    "While user code can define methods for this generic word, it should not call it directly, since it does not handle the case where the two references point to the same object."
+}
+{ $examples
+    "The most common reason for defining a method for this generic word to ensure that instances of a specific tuple class are only ever equal to themselves, overriding the default implementation which checks slot values for equality."
+    { $code "TUPLE: foo ;" "M: foo equal? 2drop f ;" }
+    "Note that with the above definition, calling " { $link equal? } " directly will give unexpected results:"
+    { $unchecked-example "T{ foo } dup equal? ." "f" }
+    { $unchecked-example "T{ foo } dup clone equal? ." "f" }
+    "As documented above, " { $link = } " should be called instead:"
+    { $unchecked-example "T{ foo } dup = ." "t" }
+    { $unchecked-example "T{ foo } dup clone = ." "f" }
+} ;
+
+HELP: <=>
+{ $values { "obj1" object } { "obj2" object } { "n" real } }
+{ $contract
+    "Compares two objects using an intrinsic partial order, for example, the natural order for real numbers and lexicographic order for strings."
+    $nl
+    "The output value is one of the following:"
+    { $list
+        { "positive - indicating that " { $snippet "obj1" } " follows " { $snippet "obj2" } }
+        { "zero - indicating that " { $snippet "obj1" } " is equal to " { $snippet "obj2" } }
+        { "negative - indicating that " { $snippet "obj1" } " precedes " { $snippet "obj2" } }
+    }
+    "The default implementation treats the two objects as sequences, and recursively compares their elements. So no extra work is required to compare sequences lexicographically."
+} ;
+
+{ <=> compare natural-sort sort-keys sort-values } related-words
+
+HELP: compare
+{ $values { "obj1" object } { "obj2" object } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } { "n" integer } }
+{ $description "Compares the results of applying the quotation to both objects via " { $link <=> } "." }
+{ $examples
+    { $example "\"hello\" \"hi\" [ length ] compare ." "3" }
+} ;
+
+HELP: clone
+{ $values { "obj" object } { "cloned" "a new object" } }
+{ $contract "Outputs a new object equal to the given object. This is not guaranteed to actually copy the object; it does nothing with immutable objects, and does not copy words either. However, sequences and tuples can be cloned to obtain a shallow copy of the original." } ;
+
+HELP: type ( object -- n )
+{ $values { "object" object } { "n" "a type number" } }
+{ $description "Outputs an object's type number, between zero and one less than " { $link num-types } ". This is implementation detail and user code should call " { $link class } " instead." } ;
+
+{ type tag type>class } related-words
+
+HELP: ? ( ? true false -- true/false )
+{ $values { "?" "a generalized boolean" } { "true" object } { "false" object } { "true/false" "one two input objects" } }
+{ $description "Chooses between two values depending on the boolean value of " { $snippet "cond" } "." } ;
+
+HELP: >boolean
+{ $values { "obj" "a generalized boolean" } { "?" "a boolean" } }
+{ $description "Convert a generalized boolean into a boolean. That is, " { $link f } " retains its value, whereas anything else becomes " { $link t } "." } ;
+
+HELP: not ( obj -- ? )
+{ $values { "obj" "a generalized boolean" } { "?" "a boolean" } }
+{ $description "For " { $link f } " outputs " { $link t } " and for anything else outputs " { $link f } "." }
+{ $notes "This word implements boolean not, so applying it to integers will not yield useful results (all integers have a true value). Bitwise not is the " { $link bitnot } " word." } ;
+
+HELP: and
+{ $values { "obj1" "a generalized boolean" } { "obj2" "a generalized boolean" } { "?" "a generalized boolean" } }
+{ $description "If both inputs are true, outputs " { $snippet "obj2" } ". otherwise outputs " { $link f } "." }
+{ $notes "This word implements boolean and, so applying it to integers will not yield useful results (all integers have a true value). Bitwise and is the " { $link bitand } " word." }
+{ $examples
+    "Usually only the boolean value of the result is used, however you can also explicitly rely on the behavior that if both inputs are true, the second is output:"
+    { $example "t f and ." "f" }
+    { $example "t 7 and ." "7" }
+    { $example "\"hi\" 12.0 and ." "12.0" }
+} ;
+
+HELP: or
+{ $values { "obj1" "a generalized boolean" } { "obj2" "a generalized boolean" } { "?" "a generalized boolean" } }
+{ $description "If both inputs are false, outputs " { $link f } ". otherwise outputs the first of " { $snippet "obj1" } " and " { $snippet "obj2" } " which is true." }
+{ $notes "This word implements boolean inclusive or, so applying it to integers will not yield useful results (all integers have a true value). Bitwise inclusive or is the " { $link bitor } " word." }
+{ $examples
+    "Usually only the boolean value of the result is used, however you can also explicitly rely on the behavior that the result will be the first true input:"
+    { $example "t f or ." "t" }
+    { $example "\"hi\" 12.0 or ." "\"hi\"" }
+} ;
+
+HELP: xor
+{ $values { "obj1" "a generalized boolean" } { "obj2" "a generalized boolean" } { "?" "a generalized boolean" } }
+{ $description "Tests if at exactly one object is not " { $link f } "." }
+{ $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 { "quot" "a quotation with stack effect " { $snippet "( obj -- ? )" } } { "x" object } { "y" object } { "?" "a boolean" } }
+{ $description "Tests if the quotation yields a true value when applied to both " { $snippet "x" } " and " { $snippet "y" } "." }
+{ $examples
+    { $example "3 5 [ odd? ] both? ." "t" }
+    { $example "12 7 [ even? ] both? ." "f" }
+} ;
+
+HELP: either?
+{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- ? )" } } { "x" object } { "y" object } { "?" "a boolean" } }
+{ $description "Tests if the quotation yields a true value when applied to either " { $snippet "x" } " or " { $snippet "y" } "." }
+{ $examples
+    { $example "3 6 [ odd? ] either? ." "t" }
+    { $example "5 7 [ even? ] either? ." "f" }
+} ;
+
+HELP: call ( quot -- )
+{ $values { "quot" callable } }
+{ $description "Calls a quotation."
+$nl
+"Under the covers, pushes the current call frame on the call stack, and set the call frame to the given quotation." }
+{ $examples
+    "The following two lines are equivalent:"
+    { $code "2 [ 2 + 3 * ] call" "2 2 + 3 *" }
+} ;
+
+HELP: slip
+{ $values { "quot" quotation } { "x" object } }
+{ $description "Calls a quotation while hiding the top of the stack." } ;
+
+HELP: 2slip
+{ $values { "quot" quotation } { "x" object } { "y" object } }
+{ $description "Calls a quotation while hiding the top two stack elements." } ;
+
+HELP: 3slip
+{ $values { "quot" quotation } { "x" object } { "y" object } { "z" object } }
+{ $description "Calls a quotation while hiding the top three stack elements." } ;
+
+HELP: keep
+{ $values { "quot" "a quotation with stack effect " { $snippet "( x -- )" } } { "x" object } }
+{ $description "Call a quotation with a value on the stack, restoring the value when the quotation returns." } ;
+
+HELP: 2keep
+{ $values { "quot" "a quotation with stack effect " { $snippet "( x y -- )" } } { "x" object } { "y" object } }
+{ $description "Call a quotation with two values on the stack, restoring the values when the quotation returns." } ;
+
+HELP: 3keep
+{ $values { "quot" "a quotation with stack effect " { $snippet "( x y -- )" } } { "x" object } { "y" object } { "z" object } }
+{ $description "Call a quotation with three values on the stack, restoring the values when the quotation returns." } ;
+
+HELP: 2apply
+{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } { "x" object } { "y" object } }
+{ $description "Applies the quotation to " { $snippet "x" } ", then to " { $snippet "y" } "." } ;
+
+HELP: if ( cond true false -- )
+{ $values { "cond" "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." } ;
+
+HELP: when
+{ $values { "cond" "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." } ;
+
+HELP: unless
+{ $values { "cond" "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." } ;
+
+HELP: if*
+{ $values { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } { "false" quotation } }
+{ $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" } } ;
+
+HELP: when*
+{ $values { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } }
+{ $description "Variant of " { $link if* } " with no false quotation."
+$nl
+"The following two lines are equivalent:"
+{ $code "X [ Y ] when*" "X dup [ Y ] [ drop ] if" } } ;
+
+HELP: unless*
+{ $values { "cond" "a generalized boolean" } { "false" "a quotation " } }
+{ $description "Variant of " { $link if* } " with no true quotation."
+$nl
+"The following two lines are equivalent:"
+{ $code "X [ Y ] unless*" "X dup [ ] [ drop Y ] if" } } ;
+
+HELP: ?if
+{ $values { "default" object } { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } { "false" "a quotation with stack effect " { $snippet "( default -- )" } } }
+{ $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."
+$nl
+"The following two lines are equivalent:"
+{ $code "[ X ] [ Y ] ?if" "dup [ nip X ] [ drop Y ] if" } } ;
+
+HELP: die
+{ $description "Starts the front-end processor (FEP), which is a low-level debugger which can inspect memory addresses and the like. The FEP is also entered when a critical error occurs." } ;
+
+HELP: (clone) ( obj -- newobj )
+{ $values { "obj" object } { "newobj" "a shallow copy" } }
+{ $description "Outputs a byte-by-byte copy of the given object. User code should call " { $link clone } " instead." } ;
+
+HELP: declare
+{ $values { "spec" "an array of class words" } }
+{ $description "Declares that the elements at the top of the stack are instances of the classes in " { $snippet "spec" } "." }
+{ $warning "The compiler blindly trusts declarations, and false declarations can lead to crashes, memory corruption and other undesirable behavior." }
+{ $examples
+    "The optimizer cannot do anything with the below code:"
+    { $code "2 + 10 *" }
+    "However, if we declare that the top of the stack is a " { $link float } ", then type checks and generic dispatch are eliminated, and the compiler can use unsafe intrinsics:"
+    { $code "{ float } declare 2 + 10 *" }
+} ;
+
+HELP: tag ( object -- n )
+{ $values { "object" object } { "n" "a tag number" } }
+{ $description "Outputs an object's tag number, between zero and one less than " { $link num-tags } ". This is implementation detail and user code should call " { $link class } " instead." } ;
+
+HELP: getenv ( n -- obj )
+{ $values { "n" "a non-negative integer" } { "obj" object } }
+{ $description "Reads an object from the Factor VM's environment table. User code never has to read the environment table directly; instead, use one of the callers of this word." } ;
+
+HELP: setenv ( obj n -- )
+{ $values { "n" "a non-negative integer" } { "obj" object } }
+{ $description "Writes an object to the Factor VM's environment table. User code never has to write to the environment table directly; instead, use one of the callers of this word." } ;
+
+HELP: object
+{ $class-description
+    "The class of all objects. If a generic word defines a method specializing on this class, the method is used as a fallback, if no other applicable method is found. For instance:"
+    { $code "GENERIC: enclose" "M: number enclose 1array ;" "M: object enclose ;" }
+} ;
+
+HELP: null
+{ $class-description
+    "The canonical empty class with no instances."
+} ;
+
+HELP: general-t
+{ $class-description
+    "The class of all objects not equal to " { $link f } "."
+}
+{ $examples
+    "Here is an implementation of " { $link if } " using generic words:"
+    { $code
+        "GENERIC# my-if 2 ( ? true false -- )"
+        "M: f my-if 2nip call ;"
+        "M: general-t my-if drop nip call ;"
+    }
+} ;
+
+HELP: most
+{ $values { "x" object } { "y" object } { "quot" "a quotation with stack effect " { $snippet "( x y -- ? )" } } { "z" "either " { $snippet "x" } " or " { $snippet "y" } } }
+{ $description "If the quotation yields a true value when applied to " { $snippet "x" } " and " { $snippet "y" } ", outputs " { $snippet "x" } ", otherwise outputs " { $snippet "y" } "." } ;
+
+HELP: curry ( obj quot -- curry )
+{ $values { "obj" object } { "quot" callable } { "curry" curry } }
+{ $description "Partial application. Outputs a " { $link callable } " which first pushes " { $snippet "obj" } " and then calls " { $snippet "quot" } "." }
+{ $class-description "The class of objects created by " { $link curry } ". These objects print identically to quotations and implement the sequence protocol, however they only use two cells of storage; a reference to the object and a reference to the underlying quotation." }
+{ $notes "Even if " { $snippet "obj" } " is a word, it will be pushed as a literal."
+$nl
+"This operation is efficient and does not copy the quotation." }
+{ $examples
+    { $example "5 [ . ] curry ." "[ 5 . ]" }
+    { $example "\\ = [ see ] curry ." "[ \\ = see ]" }
+    { $example "{ 1 2 3 } 2 [ - ] curry map ." "{ -1 0 1 }" }
+} ;
+
+HELP: 2curry
+{ $values { "obj1" object } { "obj2" object } { "quot" callable } { "curry" curry } }
+{ $description "Outputs a " { $link callable } " which pushes " { $snippet "obj1" } " and " { $snippet "obj2" } " and then calls " { $snippet "quot" } "." }
+{ $notes "This operation is efficient and does not copy the quotation." }
+{ $examples
+    { $example "5 4 [ + ] 2curry ." "[ 5 4 + ]" }
+} ;
+
+HELP: 3curry
+{ $values { "obj1" object } { "obj2" object } { "obj3" object } { "quot" callable } { "curry" curry } }
+{ $description "Outputs a " { $link callable } " which pushes " { $snippet "obj1" } ", " { $snippet "obj2" } " and " { $snippet "obj3" } ", and then calls " { $snippet "quot" } "." }
+{ $notes "This operation is efficient and does not copy the quotation." } ;
+
+HELP: curry*
+{ $values { "param" object } { "obj" object } { "quot" "a quotation with stack effect " { $snippet "( param elt -- ... )" } } { "obj" object } { "curry" curry } }
+{ $description "Partial application on the left. The following two lines are equivalent:"
+    { $code "swap [ swap A ] curry B" }
+    { $code "[ A ] curry* B" }
+    
+}
+{ $notes "This operation is efficient and does not copy the quotation." }
+{ $examples
+    { $example "2 { 1 2 3 } [ - ] curry* map ." "{ 1 0 -1 }" }
+} ;
+
+HELP: compose
+{ $values { "quot1" callable } { "quot2" callable } { "curry" curry } }
+{ $description "Quotation composition. Outputs a " { $link callable } " which calls " { $snippet "quot1" } " followed by " { $snippet "quot2" } "." }
+{ $notes
+    "The following two lines are equivalent:"
+    { $code
+        "compose call"
+        "append call"
+    }
+    "However, " { $link compose } " runs in constant time, and the compiler is able to compile code which calls composed quotations."
+} ;
+
+HELP: 3compose
+{ $values { "quot1" callable } { "quot2" callable } { "quot3" callable } { "curry" curry } }
+{ $description "Quotation composition. Outputs a " { $link callable } " which calls " { $snippet "quot1" } ", " { $snippet "quot2" } " and then " { $snippet "quot3" } "." }
+{ $notes
+    "The following two lines are equivalent:"
+    { $code
+        "3compose call"
+        "3append call"
+    }
+    "However, " { $link 3compose } " runs in constant time, and the compiler is able to compile code which calls composed quotations."
+} ;
diff --git a/core/kernel/kernel-tests.factor b/core/kernel/kernel-tests.factor
new file mode 100644 (file)
index 0000000..ce04af7
--- /dev/null
@@ -0,0 +1,77 @@
+USING: arrays byte-arrays kernel kernel.private math memory
+namespaces sequences tools.test math.private quotations
+continuations prettyprint io.streams.string ;
+IN: temporary
+
+[ 0 ] [ f size ] unit-test
+[ t ] [ [ \ = \ = ] all-equal? ] unit-test
+
+! Don't leak extra roots if error is thrown
+[ ] [ 10000 [ [ 3 throw ] catch drop ] times ] unit-test
+
+[ ] [ 10000 [ [ -1 f <array> ] catch drop ] times ] unit-test
+
+! Make sure we report the correct error on stack underflow
+[ { "kernel-error" 11 f f } ]
+[ [ clear drop ] catch ] unit-test
+
+[ { "kernel-error" 13 f f } ]
+[ [ { } set-retainstack r> ] catch ] unit-test
+
+: overflow-d 3 overflow-d ;
+
+[ { "kernel-error" 12 f f } ]
+[ [ overflow-d ] catch ] unit-test
+
+: overflow-r 3 >r overflow-r ;
+
+[ { "kernel-error" 14 f f } ]
+[ [ overflow-r ] catch ] unit-test
+
+! : overflow-c overflow-c 3 ;
+! 
+! [ { "kernel-error" 16 f f } ]
+! [ [ overflow-c ] catch ] unit-test
+
+[ -7 <byte-array> ] unit-test-fails
+
+[ 2 3 4 1 ] [ 1 2 3 4 roll ] unit-test
+[ 1 2 3 4 ] [ 2 3 4 1 -roll ] unit-test
+
+[ 3 ] [ t 3 and ] unit-test
+[ f ] [ f 3 and ] unit-test
+[ f ] [ 3 f and ] unit-test
+[ 4 ] [ 4 6 or ] unit-test
+[ 6 ] [ f 6 or ] unit-test
+
+[ slip ] unit-test-fails
+[ 1 slip ] unit-test-fails
+[ 1 2 slip ] unit-test-fails
+[ 1 2 3 slip ] unit-test-fails
+
+[ 5 ] [ [ 2 2 + ] 1 slip + ] unit-test
+
+[ [ ] keep ] unit-test-fails
+
+[ 6 ] [ 2 [ sq ] keep + ] unit-test
+
+[ [ ] 2keep ] unit-test-fails
+[ 1 [ ] 2keep ] unit-test-fails
+[ 3 1 2 ] [ 1 2 [ 2drop 3 ] 2keep ] unit-test
+
+[ 0 ] [ f [ sq ] [ 0 ] if* ] unit-test
+[ 4 ] [ 2 [ sq ] [ 0 ] if* ] unit-test
+
+[ 0 ] [ f [ 0 ] unless* ] unit-test
+[ t ] [ t [ "Hello" ] unless* ] unit-test
+
+[ "2\n" ] [ [ 1 2 [ . ] [ sq . ] ?if ] string-out ] unit-test
+[ "9\n" ] [ [ 3 f [ . ] [ sq . ] ?if ] string-out ] unit-test
+
+[ f ] [ f (clone) ] unit-test
+[ -123 ] [ -123 (clone) ] unit-test
+
+[ 6 2 ] [ 1 2 [ 5 + ] dip ] unit-test
+
+[ ] [ callstack set-callstack ] unit-test
+! [ ] [ callstack callstack>array array>callstack set-callstack ] unit-test
diff --git a/core/kernel/kernel.factor b/core/kernel/kernel.factor
new file mode 100644 (file)
index 0000000..a2444ec
--- /dev/null
@@ -0,0 +1,153 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel.private ;
+IN: kernel
+
+: version ( -- str ) "0.91" ; foldable
+
+! Stack stuff
+: roll ( x y z t -- y z t x ) >r rot r> swap ; inline
+
+: -roll ( x y z t -- t x y z ) swap >r -rot r> ; inline
+
+: clear ( -- ) { } set-datastack ;
+
+! Combinators
+: call ( callable -- ) uncurry (call) ;
+
+DEFER: if
+
+: ? ( ? true false -- true/false )
+    #! 'if' and '?' can be defined in terms of each other
+    #! because the JIT special-cases an 'if' preceeded by
+    #! two literal quotations.
+    rot [ drop ] [ nip ] if ; inline
+
+: if ( ? true false -- ) ? call ;
+
+: if* ( cond true false -- )
+    pick [ drop call ] [ 2nip call ] if ; inline
+
+: ?if ( default cond true false -- )
+    pick [ roll 2drop call ] [ 2nip call ] if ; inline
+
+: unless ( cond false -- )
+    swap [ drop ] [ call ] if ; inline
+
+: unless* ( cond false -- )
+    over [ drop ] [ nip call ] if ; inline
+
+: when ( cond true -- )
+    swap [ call ] [ drop ] if ; inline
+
+: when* ( cond true -- )
+    over [ call ] [ 2drop ] if ; inline
+
+: slip ( quot x -- x ) >r call r> ; inline
+
+: 2slip ( quot x y -- x y ) >r >r call r> r> ; inline
+
+: 3slip ( quot x y z -- x y z ) >r >r >r call r> r> r> ; inline
+
+: dip ( obj callable -- obj ) swap slip ; inline
+
+: keep ( x quot -- x ) over slip ; inline
+
+: 2keep ( x y quot -- x y ) pick pick 2slip ; inline
+
+: 3keep ( x y z quot -- x y z )
+    >r 3dup r> -roll 3slip ; inline
+
+: 2apply ( x y quot -- ) tuck 2slip call ; inline
+
+! Quotation building
+
+: 2curry ( obj1 obj2 quot -- curry )
+    curry curry ; inline
+
+: 3curry ( obj1 obj2 obj3 quot -- curry )
+    curry curry curry ; inline
+
+: curry* ( param obj quot -- obj curry )
+    swapd [ swapd call ] 2curry ; inline
+
+: compose ( quot1 quot2 -- curry )
+    ! Not inline because this is treated as a primitive by
+    ! the compiler
+    [ slip call ] 2curry ;
+
+: 3compose ( quot1 quot2 quot3 -- curry )
+    [ 2slip slip call ] 3curry ; inline
+
+! Object protocol
+
+GENERIC: delegate ( obj -- delegate )
+
+M: object delegate drop f ;
+
+GENERIC: set-delegate ( delegate tuple -- )
+
+GENERIC: hashcode* ( depth obj -- code )
+
+M: object hashcode* 2drop 0 ;
+
+: hashcode ( obj -- code ) 3 swap hashcode* ; inline
+
+GENERIC: equal? ( obj1 obj2 -- ? )
+
+M: object equal? 2drop f ;
+
+: = ( obj1 obj2 -- ? )
+    2dup eq? [ 2drop t ] [ equal? ] if ; inline
+
+GENERIC: <=> ( obj1 obj2 -- n )
+
+GENERIC: clone ( obj -- cloned )
+
+M: object clone ;
+
+! Tuple construction
+
+GENERIC# get-slots 1 ( tuple slots -- ... )
+
+GENERIC# set-slots 1 ( ... tuple slots -- )
+
+GENERIC: construct-empty ( class -- tuple )
+
+GENERIC: construct ( ... slots class -- tuple ) inline
+
+GENERIC: construct-boa ( ... class -- tuple )
+
+: construct-delegate ( delegate class -- tuple )
+    >r { set-delegate } r> construct ; inline
+
+! Booleans
+
+: not ( obj -- ? ) f eq? ; inline
+
+: >boolean ( obj -- ? ) t f ? ; inline
+
+: and ( obj1 obj2 -- ? ) over ? ; inline
+
+: or ( obj1 obj2 -- ? ) dupd ? ; inline
+
+: xor ( obj1 obj2 -- ? ) dup not swap ? ; inline
+
+: both? ( x y quot -- ? ) 2apply and ; inline
+
+: either? ( x y quot -- ? ) 2apply or ; inline
+
+: compare ( obj1 obj2 quot -- n ) 2apply <=> ; inline
+
+: most ( x y quot -- z )
+    >r 2dup r> call [ drop ] [ nip ] if ; inline
+
+! Error handling -- defined early so that other files can
+! throw errors before continuations are loaded
+: throw ( error -- * ) 5 getenv [ die ] or curry (throw) ;
+
+<PRIVATE
+
+: declare ( spec -- ) drop ;
+
+PRIVATE>
diff --git a/core/kernel/summary.txt b/core/kernel/summary.txt
new file mode 100644 (file)
index 0000000..49ccc71
--- /dev/null
@@ -0,0 +1 @@
+Data and control flow, basic object protocol
diff --git a/core/layouts/authors.txt b/core/layouts/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/layouts/layouts-docs.factor b/core/layouts/layouts-docs.factor
new file mode 100644 (file)
index 0000000..dccd137
--- /dev/null
@@ -0,0 +1,37 @@
+USING: layouts generic help.markup help.syntax kernel math
+memory namespaces sequences kernel.private classes ;
+
+HELP: tag-bits
+{ $var-description "Number of least significant bits reserved for a type tag in a tagged pointer." }
+{ $see-also tag } ;
+
+HELP: num-tags
+{ $var-description "Number of distinct pointer tags. This is one more than the maximum value from the " { $link tag } " primitive." } ;
+
+HELP: tag-mask
+{ $var-description "Taking the bitwise and of a tagged pointer with this mask leaves the tag." } ;
+
+HELP: num-types
+{ $var-description "Number of distinct built-in types. This is one more than the maximum value from the " { $link type } " primitive." } ;
+
+HELP: tag-number
+{ $values { "class" class } { "n" "an integer or " { $link f } } }
+{ $description "Outputs the pointer tag for pointers to instances of " { $link class } ". Will output " { $link f } " if instances of this class are not identified by a distinct pointer tag." } ;
+
+HELP: type-number
+{ $values { "class" class } { "n" "an integer or " { $link f } } }
+{ $description "Outputs the built-in type number instances of " { $link class } ". Will output " { $link f } " if this is not a built-in class." }
+{ $see-also builtin-class } ;
+
+HELP: tag-header
+{ $values { "n" "a built-in type number" } { "tagged" integer } }
+{ $description "Outputs the header for objects of type " { $snippet "n" } "." } ;
+
+HELP: first-bignum
+{ $values { "n" "smallest positive integer not representable by a fixnum" } } ;
+
+HELP: most-positive-fixnum
+{ $values { "n" "largest positive integer representable by a fixnum" } } ;
+
+HELP: most-negative-fixnum
+{ $values { "n" "smallest negative integer representable by a fixnum" } } ;
diff --git a/core/layouts/layouts.factor b/core/layouts/layouts.factor
new file mode 100644 (file)
index 0000000..31e182e
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces math words kernel assocs system classes ;
+IN: layouts
+
+SYMBOL: tag-mask
+
+SYMBOL: num-tags
+
+SYMBOL: tag-bits
+
+SYMBOL: num-types
+
+SYMBOL: tag-numbers
+
+SYMBOL: type-numbers
+
+: tag-number ( class -- n )
+    tag-numbers get at [ object tag-number ] unless* ;
+
+: type-number ( class -- n )
+    type-numbers get at ;
+
+: tag-header ( n -- tagged )
+    tag-bits get shift ;
+
+: first-bignum ( -- n )
+    bootstrap-cell-bits tag-bits get - 1 - 2^ ;
+
+: most-positive-fixnum ( -- n )
+    first-bignum 1- ;
+
+: most-negative-fixnum ( -- n )
+    first-bignum neg ;
diff --git a/core/layouts/summary.txt b/core/layouts/summary.txt
new file mode 100644 (file)
index 0000000..87d883f
--- /dev/null
@@ -0,0 +1 @@
+Low-level in-memory object layout introspection
diff --git a/core/layouts/tags.txt b/core/layouts/tags.txt
new file mode 100644 (file)
index 0000000..abf53a4
--- /dev/null
@@ -0,0 +1 @@
+reflection
diff --git a/core/libc/authors.txt b/core/libc/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/libc/libc-docs.factor b/core/libc/libc-docs.factor
new file mode 100644 (file)
index 0000000..9596b98
--- /dev/null
@@ -0,0 +1,41 @@
+USING: help.markup help.syntax alien ;
+IN: libc
+
+HELP: malloc
+{ $values { "size" "a non-negative integer" } { "alien" c-ptr } }
+{ $description "Allocates a block of " { $snippet "size" } " bytes from the operating system. The contents of the block are undefined." }
+{ $errors "Throws an error if memory allocation failed." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ;
+
+HELP: calloc
+{ $values { "count" "a non-negative integer" } { "size" "a non-negative integer" } { "alien" c-ptr } }
+{ $description "Allocates a block of " { $snippet "count * size" } " bytes from the operating system. The contents of the block are initially zero." }
+{ $errors "Throws an error if memory allocation failed." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ;
+
+HELP: realloc
+{ $values { "alien" c-ptr } { "size" "a non-negative integer" } { "newalien" c-ptr } }
+{ $description "Allocates a new block of " { $snippet "size" } " bytes from the operating system. The contents of " { $snippet "alien" } ", which itself must be a block previously returned by " { $link malloc } " or " { $link realloc } ", are copied into the new block, and the old block is freed." }
+{ $errors "Throws an error if memory allocation failed." }
+{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ;
+
+HELP: memcpy
+{ $values { "dst" c-ptr } { "src" c-ptr } { "size" "a non-negative integer" } }
+{ $description "Copies " { $snippet "size" } " bytes from " { $snippet "src" } " to " { $snippet "dst" } "." }
+{ $warning "As per the BSD C library documentation, the behavior is undefined if the source and destination overlap." } ;
+
+HELP: check-ptr
+{ $values { "c-ptr" "an alien address, byte array, or " { $link f } } { "checked" "an alien address or byte array with non-zero address" } }
+{ $description "Throws an error if the input is " { $link f } ". Otherwise the object remains on the data stack. This word should be used to check the return values of " { $link malloc } " and " { $link realloc } " before use." }
+{ $error-description "Callers of " { $link malloc } " and " { $link realloc } " should use " { $link check-ptr } " to throw an error in the case of a memory allocation failure." } ;
+
+HELP: free
+{ $values { "alien" c-ptr } }
+{ $description "Deallocates a block of memory allocated by " { $link malloc } ", " { $link calloc } " or " { $link realloc } "." } ;
+
+HELP: with-malloc
+{ $values { "size" "a positive integer" } { "quot" "a quotation with stack effect " { $snippet "( c-ptr -- )" } } }
+{ $description "Allocates a zeroed block of " { $snippet "n" } " bytes and passes it to the quotation. When the quotation returns, the block is freed." } ;
+
+! Defined in alien-docs.factor
+ABOUT: "malloc"
diff --git a/core/libc/libc.factor b/core/libc/libc.factor
new file mode 100644 (file)
index 0000000..71b49e9
--- /dev/null
@@ -0,0 +1,87 @@
+! Copyright (C) 2004, 2005 Mackenzie Straight
+! Copyright (C) 2007 Slava Pestov
+! Copyright (C) 2007 Doug Coleman
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien assocs init inspector kernel namespaces ;
+IN: libc
+
+<PRIVATE
+
+: (malloc) ( size -- alien )
+    "void*" "libc" "malloc" { "ulong" } alien-invoke ;
+
+: (calloc) ( count size -- alien )
+    "void*" "libc" "calloc" { "ulong" "ulong" } alien-invoke ;
+
+: (free) ( alien -- )
+    "void" "libc" "free" { "void*" } alien-invoke ;
+
+: (realloc) ( alien size -- newalien )
+    "void*" "libc" "realloc" { "void*" "ulong" } alien-invoke ;
+
+SYMBOL: mallocs
+
+PRIVATE>
+
+TUPLE: check-ptr ;
+
+M: check-ptr summary drop "Memory allocation failed" ;
+
+: check-ptr ( c-ptr -- c-ptr )
+    [ \ check-ptr construct-boa throw ] unless* ;
+
+TUPLE: double-free ;
+
+M: double-free summary drop "Free failed since memory is not allocated" ;
+
+: double-free ( -- * )
+    \ double-free construct-empty throw ;
+
+TUPLE: realloc-error ptr size ;
+
+M: realloc-error summary drop "Memory reallocation failed" ;
+
+: realloc-error ( alien size -- * )
+    \ realloc-error construct-boa throw ;
+
+<PRIVATE
+
+[ H{ } clone mallocs set-global ] "mallocs" add-init-hook
+
+: add-malloc ( alien -- )
+    dup mallocs get-global set-at ;
+
+: delete-malloc ( alien -- )
+    [
+        mallocs get-global delete-at*
+        [ double-free ] unless drop
+    ] when* ;
+
+: malloc-exists? ( alien -- ? )
+    mallocs get-global key? ;
+
+PRIVATE>
+
+: malloc ( size -- alien )
+    (malloc) check-ptr
+    dup add-malloc ;
+
+: calloc ( count size -- alien )
+    (calloc) check-ptr
+    dup add-malloc ;
+
+: realloc ( alien size -- newalien )
+    over malloc-exists? [ realloc-error ] unless
+    dupd (realloc) check-ptr
+    swap delete-malloc
+    dup add-malloc ;
+
+: free ( alien -- )
+    dup delete-malloc
+    (free) ;
+
+: memcpy ( dst src size -- )
+    "void" "libc" "memcpy" { "void*" "void*" "ulong" } alien-invoke ;
+
+: with-malloc ( size quot -- )
+    swap 1 calloc check-ptr swap keep free ; inline
diff --git a/core/libc/summary.txt b/core/libc/summary.txt
new file mode 100644 (file)
index 0000000..57b0ddc
--- /dev/null
@@ -0,0 +1 @@
+Manual memory management for interfacing with C
diff --git a/core/libc/tags.txt b/core/libc/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/core/listener.factor b/core/listener.factor
deleted file mode 100644 (file)
index 632474e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: listener
-USING: errors hashtables io kernel math memory namespaces
-parser sequences strings styles vectors words generic ;
-
-SYMBOL: quit-flag
-
-SYMBOL: listener-hook
-
-GENERIC: parse-interactive ( stream -- quot/f )
-
-: (parse-interactive) ( stream stack -- quot/f )
-    over stream-readln dup [
-        over push \ (parse) with-datastack
-        dup length 1 = [
-            nip first >quotation
-        ] [
-            (parse-interactive)
-        ] if
-    ] [
-        3drop f
-    ] if ;
-
-M: line-reader parse-interactive
-    [
-        [ V{ f } clone (parse-interactive) ] with-parser in get
-    ] with-scope in set ;
-
-M: duplex-stream parse-interactive
-    duplex-stream-in parse-interactive ;
-
-: bye ( -- ) quit-flag on ;
-
-: prompt. ( -- )
-    in get H{ { background { 1 0.7 0.7 1 } } } format bl flush ;
-
-: listen ( -- )
-    [ stdio get parse-interactive [ call ] [ bye ] if* ] try ;
-
-: listener ( -- )
-    quit-flag get
-    [ quit-flag off ]
-    [ prompt. listener-hook get call listen listener ] if ;
-
-: print-banner ( -- )
-    "Factor " write version write
-    " on " write os write "/" write cpu print ;
-
-IN: shells
-
-: tty ( -- )
-    [
-        print-banner use [ clone ] change listener
-    ] with-scope ;
diff --git a/core/listener.facts b/core/listener.facts
deleted file mode 100644 (file)
index 7e70e74..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-IN: listener
-USING: help kernel shells ;
-
-HELP: quit-flag
-{ $var-description "Variable set to true by " { $link bye } " word; it forces the next iteration of the " { $link listener } " loop to end." } ;
-
-HELP: listener-hook
-{ $var-description "Variable holding a quotation called by the listener before reading each line of input. The UI sets this variable to a quotation which updates the stack display in a listener gadget." } ;
-
-HELP: parse-interactive
-{ $values { "stream" "an input stream" } { "quot" "a parsed quotation, or " { $link f } " indicating end of file" } }
-{ $description "Reads a Factor expression from the stream, possibly spanning more than line. Additional lines of input are read while the parser stack height is greater than one. Since structural parsing words push partial quotations on the stack, this will keep on reading input until all delimited parsing words are terminated." } ;
-
-HELP: listen
-{ $description "Prompts for an expression on the default stream and evaluates it. On end of file, " { $link quit-flag } " is set to terminate the listener loop." }
-{ $errors "If the expression input by the user throws an error, the error is printed to the default stream and the word returns normally." } ;
-
-HELP: print-banner
-{ $description "Print Factor version, operating system, and CPU architecture." } ;
-
-HELP: listener
-{ $description "Prompts for expressions on the default stream and evaluates them until end of file is reached. This is an internal word; call " { $link tty } " instead." } ;
-
-HELP: tty
-{ $description "Starts a listener prompting for expressions on the default stream." } ;
diff --git a/core/listener/authors.txt b/core/listener/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/listener/listener-docs.factor b/core/listener/listener-docs.factor
new file mode 100644 (file)
index 0000000..d4d6053
--- /dev/null
@@ -0,0 +1,49 @@
+USING: help.markup help.syntax kernel io system prettyprint ;
+IN: listener
+
+ARTICLE: "listener" "The listener"
+"The listener evaluates Factor expressions read from a stream. The listener is the primary interface to the Factor runtime. Typically, you write Factor code in a text editor, then load it using the listener and test it."
+$nl
+"The classical first program can be run in the listener:"
+{ $example "\"Hello, world\" print" "Hello, world" }
+"Multi-line phrases are supported:"
+{ $example "{ 1 2 3 } [\n    .\n] each" "1\n2\n3" }
+"The listener knows when to expect more input by looking at the height of the stack. Parsing words such as " { $link POSTPONE: { } " leave elements on the parser stack, and corresponding words such as " { $link POSTPONE: } } " pop them."
+$nl
+"A very common operation is to inspect the contents of the data stack in the listener:"
+{ $subsection .s }
+"Note that calls to " { $link .s } " can also be included inside words as a debugging aid, however a more convenient way to achieve this is to use the annotation facility. See " { $link "tools.annotations" } "."
+$nl
+"You can start a nested listener or exit a listener using the following words:"
+{ $subsection listener }
+{ $subsection bye }
+"The following variables can be rebound inside a nested scope to customize the behavior of a listener; this can be done to create a development tool with a custom interaction loop:"
+{ $subsection listener-hook }
+"Finally, the multi-line expression reading word can be used independently of the rest of the listener:"
+{ $subsection parse-interactive } ;
+
+ABOUT: "listener"
+
+HELP: quit-flag
+{ $var-description "Variable set to true by " { $link bye } " word; it forces the next iteration of the " { $link listener } " loop to end." } ;
+
+HELP: listener-hook
+{ $var-description "Variable holding a quotation called by the listener before reading an input expression. The UI sets this variable to a quotation which updates the stack display in a listener gadget." } ;
+
+HELP: parse-interactive
+{ $values { "stream" "an input stream" } { "quot/f" "a parsed quotation, or " { $link f } " indicating end of file" } }
+{ $description "Reads a Factor expression from the stream, possibly spanning more than line. Additional lines of input are read while the parser stack height is greater than one. Since structural parsing words push partial quotations on the stack, this will keep on reading input until all delimited parsing words are terminated." } ;
+
+HELP: listen
+{ $description "Prompts for an expression on the " { $link stdio } " stream and evaluates it. On end of file, " { $link quit-flag } " is set to terminate the listener loop." }
+{ $errors "If the expression input by the user throws an error, the error is printed to the " { $link stdio } " stream and the word returns normally." } ;
+
+HELP: print-banner
+{ $description "Print Factor version, operating system, and CPU architecture." } ;
+
+HELP: listener
+{ $description "Prompts for expressions on the " { $link stdio } " stream and evaluates them until end of file is reached." } ;
+
+HELP: bye
+{ $description "Exits the current listener." }
+{ $notes "This word is for interactive use only. To exit the Factor runtime, use " { $link exit } "." } ;
diff --git a/core/listener/listener-tests.factor b/core/listener/listener-tests.factor
new file mode 100644 (file)
index 0000000..47bb00b
--- /dev/null
@@ -0,0 +1,36 @@
+USING: io io.streams.string listener tools.test parser
+math namespaces continuations vocabs ;
+IN: temporary
+
+: hello "Hi" print ; parsing
+
+[ [ ] ] [
+    "USE: temporary hello" <string-reader> parse-interactive
+] unit-test
+
+[
+    file-vocabs
+    "debugger" use+
+
+    [ [ \ + 1 2 3 4 ] ]
+    [
+        [
+            "cont" set
+            [
+                "\\ + 1 2 3 4" 
+                <string-reader>
+                parse-interactive "cont" get continue-with
+            ] catch
+            ":1" eval
+        ] callcc1
+    ] unit-test
+] with-scope
+
+[ ] [ "vocabs.loader.test.c" forget-vocab ] unit-test
+
+[
+    "USE: vocabs.loader.test.c" <string-reader>
+    parse-interactive
+] unit-test-fails
+
+[ ] [ "vocabs.loader.test.c" forget-vocab ] unit-test
diff --git a/core/listener/listener.factor b/core/listener/listener.factor
new file mode 100644 (file)
index 0000000..188a5e3
--- /dev/null
@@ -0,0 +1,66 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays hashtables io kernel math memory namespaces
+parser sequences strings io.styles io.streams.lines
+io.streams.duplex vectors words generic system combinators
+tuples continuations debugger ;
+IN: listener
+
+SYMBOL: quit-flag
+
+SYMBOL: listener-hook
+
+[ ] listener-hook set-global
+
+GENERIC: parse-interactive ( stream -- quot/f )
+
+: parse-interactive-step ( lines -- quot/f )
+    [ parse-lines ] catch {
+        { [ dup delegate unexpected-eof? ] [ 2drop f ] }
+        { [ dup not ] [ drop ] }
+        { [ t ] [ rethrow ] }
+    } cond ;
+
+: parse-interactive-loop  ( stream accum -- quot/f )
+    over stream-readln dup [
+        over push
+        dup parse-interactive-step dup
+        [ 2nip ] [ drop parse-interactive-loop ] if
+    ] [
+        3drop f
+    ] if ;
+
+M: line-reader parse-interactive
+    [
+        V{ } clone parse-interactive-loop in get
+    ] with-scope in set ;
+
+M: duplex-stream parse-interactive
+    duplex-stream-in parse-interactive ;
+
+: bye ( -- ) quit-flag on ;
+
+: prompt. ( -- )
+    "( " in get " )" 3append
+    H{ { background { 1 0.7 0.7 1 } } } format bl flush ;
+
+: listen ( -- )
+    listener-hook get call prompt.
+    [
+        stdio get parse-interactive [ call ] [ bye ] if*
+    ] try ;
+
+: until-quit ( -- )
+    quit-flag get
+    [ quit-flag off ]
+    [ listen until-quit ] if ; inline
+
+: print-banner ( -- )
+    "Factor " write version write
+    " on " write os write "/" write cpu print ;
+
+: listener ( -- )
+    print-banner
+    [ use [ clone ] change until-quit ] with-scope ;
+
+MAIN: listener
diff --git a/core/listener/summary.txt b/core/listener/summary.txt
new file mode 100644 (file)
index 0000000..5d94e72
--- /dev/null
@@ -0,0 +1 @@
+Terminal-based interactive code evaluator
diff --git a/core/listener/tags.txt b/core/listener/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/core/load.factor b/core/load.factor
deleted file mode 100644 (file)
index 051d8b7..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-PROVIDE: core
-{ +files+ {
-    "version.factor"
-
-    "generic/early-generic.factor"
-
-    "kernel.factor"
-
-    "math/math.factor"
-    "math/integer.factor"
-    "math/ratio.factor"
-    "math/libm.factor"
-    "math/float.factor"
-    "math/complex.factor"
-
-    "collections/sequences.factor"
-    "collections/growable.factor"
-    "collections/virtual-sequences.factor"
-    "collections/sequence-combinators.factor"
-    "collections/arrays.factor"
-    "collections/sequences-epilogue.factor"
-    "collections/strings.factor"
-    "collections/sbuf.factor"
-    "collections/vectors.factor"
-    "collections/hashtables.factor"
-    "collections/namespaces.factor"
-    "collections/slicing.factor"
-    "collections/sequence-sort.factor"
-    "collections/flatten.factor"
-    "collections/queues.factor"
-    "collections/graphs.factor"
-
-    "quotations.factor"
-
-    "math/random.factor"
-    "math/constants.factor"
-    "math/pow.factor"
-    "math/trig-hyp.factor"
-    "math/arc-trig-hyp.factor"
-    "math/vectors.factor"
-    "math/parse-numbers.factor"
-
-    "definitions.factor"
-    "words.factor"
-    "effects.factor"
-    "continuations.factor"
-    "errors.factor"
-    
-    "io/styles.factor"
-    "io/stream.factor"
-    "io/duplex-stream.factor"
-    "io/stdio.factor"
-    "io/null-stream.factor"
-    "io/nested-style.factor"
-    "io/lines.factor"
-    "io/plain-stream.factor"
-    "io/string-streams.factor"
-    "io/c-streams.factor"
-    "io/files.factor"
-    "io/binary.factor"
-
-    "syntax/early-parser.factor"
-
-    "generic/classes.factor"
-    "generic/generic.factor"
-    "generic/methods.factor"
-    "generic/standard-combination.factor"
-    "generic/slots.factor"
-    "generic/math-combination.factor"
-    "generic/tuple.factor"
-    
-    "compiler/alien/aliens.factor"
-    
-    "prettyprint/core.factor"
-    "prettyprint/sections.factor"
-    "prettyprint/backend.factor"
-    "prettyprint/frontend.factor"
-    "prettyprint/describe.factor"
-
-    "syntax/parser.factor"
-    "syntax/parse-stream.factor"
-
-    "debugger.factor"
-    "listener.factor"
-    
-    "threads.factor"
-    "io/server.factor"
-
-    "cli.factor"
-    "modules.factor"
-    "syntax/parse-syntax.factor"
-
-    "bootstrap/init.factor"
-
-} }
-{ +tests+ {
-    "test/binary.factor"
-    "test/collections/hashtables.factor"
-    "test/collections/namespaces.factor"
-    "test/collections/queues.factor"
-    "test/collections/sbuf.factor"
-    "test/collections/sequences.factor"
-    "test/collections/strings.factor"
-    "test/collections/vectors.factor"
-    "test/combinators.factor"
-    "test/continuations.factor"
-    "test/errors.factor"
-    "test/generic.factor"
-    "test/init.factor"
-    "test/io/io.factor"
-    "test/io/nested-style.factor"
-    "test/kernel.factor"
-    "test/math/bitops.factor"
-    "test/math/complex.factor"
-    "test/math/float.factor"
-    "test/math/integer.factor"
-    "test/math/irrational.factor"
-    "test/math/math-combinators.factor"
-    "test/math/random.factor"
-    "test/math/rational.factor"
-    "test/parse-number.factor"
-    "test/parser.factor"
-    "test/parsing-word.factor"
-    "test/prettyprint.factor"
-    "test/random.factor"
-    "test/redefine.factor"
-    "test/threads.factor"
-    "test/tuple.factor"
-    "test/words.factor"
-} } ;
diff --git a/core/math/arc-trig-hyp.factor b/core/math/arc-trig-hyp.factor
deleted file mode 100644 (file)
index ce13204..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math
-USING: kernel math math-internals ;
-
-: acosh ( x -- y ) dup sq 1- sqrt + log ; inline
-
-: asech ( x -- y ) recip acosh ; inline
-
-: asinh ( x -- y ) dup sq 1+ sqrt + log ; inline
-
-: acosech ( x -- y ) recip asinh ; inline
-
-: atanh ( x -- y ) dup 1+ swap 1- neg / log 2 / ; inline
-
-: acoth ( x -- y ) recip atanh ; inline
-
-: [-1,1]? ( x -- ? )
-    dup complex? [ drop f ] [ abs 1 <= ] if ; inline
-
-: asin ( x -- y )
-    dup [-1,1]? [ >float fasin ] [ i * asinh -i * ] if ; inline
-
-: acos ( x -- y )
-    dup [-1,1]? [ >float facos ] [ asin pi 2 / swap - ] if ;
-    inline
-
-: atan ( x -- y )
-    dup [-1,1]? [ >float fatan ] [ i * atanh i * ] if ; inline
-
-: asec ( x -- y ) recip acos ; inline
-
-: acosec ( x -- y ) recip asin ; inline
-
-: acot ( x -- y ) recip atan ; inline
diff --git a/core/math/arc-trig-hyp.facts b/core/math/arc-trig-hyp.facts
deleted file mode 100644 (file)
index 481e39c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-USING: help math ;
-
-HELP: acosh
-$values-x/y
-{ $description "Inverse hyperbolic cosine." } ;
-
-HELP: asech
-$values-x/y
-{ $description "Inverse hyperbolic secant." } ;
-
-HELP: asinh
-$values-x/y
-{ $description "Inverse hyperbolic sine." } ;
-
-HELP: asinh
-$values-x/y
-{ $description "Inverse hyperbolic sine." } ;
-
-HELP: acosech
-$values-x/y
-{ $description "Inverse hyperbolic cosecant." } ;
-
-HELP: atanh
-$values-x/y
-{ $description "Inverse hyperbolic tangent." } ;
-
-HELP: acoth
-$values-x/y
-{ $description "Inverse hyperbolic cotangent." } ;
-
-HELP: acos
-$values-x/y
-{ $description "Inverse trigonometric cosine." } ;
-
-HELP: asec
-$values-x/y
-{ $description "Inverse trigonometric secant." } ;
-
-HELP: asin
-$values-x/y
-{ $description "Inverse trigonometric sine." } ;
-
-HELP: asin
-$values-x/y
-{ $description "Inverse trigonometric sine." } ;
-
-HELP: acosec
-$values-x/y
-{ $description "Inverse trigonometric cosecant." } ;
-
-HELP: atan
-$values-x/y
-{ $description "Inverse trigonometric tangent." } ;
-
-HELP: acot
-$values-x/y
-{ $description "Inverse trigonometric cotangent." } ;
diff --git a/core/math/authors.txt b/core/math/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/bitfields/authors.txt b/core/math/bitfields/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/bitfields/bitfields-docs.factor b/core/math/bitfields/bitfields-docs.factor
new file mode 100644 (file)
index 0000000..f9d16d2
--- /dev/null
@@ -0,0 +1,37 @@
+USING: help.markup help.syntax math ;
+IN: math.bitfields
+
+ARTICLE: "math-bitfields" "Constructing bit fields"
+"Some applications, such as binary communication protocols and assemblers, need to construct integers from elaborate bit field specifications. Hand-coding this using " { $link shift } " and " { $link bitor } " results in repetitive code. A higher-level facility exists to factor out this repetition:"
+{ $subsection bitfield } ;
+
+ABOUT: "math-bitfields"
+
+HELP: bitfield
+{ $values { "values..." "a series of objects" } { "bitspec" "an array" } { "n" integer } }
+{ $description "Constructs an integer from a series of values on the stack together with a bit field specifier, which is an array whose elements have one of the following shapes:"
+    { $list
+        { { $snippet "{ constant shift }" } " - the resulting bit field is bitwise or'd with " { $snippet "constant" } " shifted to the right by " { $snippet "shift" } " bits" }
+        { { $snippet "{ word shift }" } " - the resulting bit field is bitwise or'd with " { $snippet "word" } " applied to the top of the stack; the result is shifted to the right by " { $snippet "shift" } " bits" }
+        { { $snippet "shift" } " - the resulting bit field is bitwise or'd with the top of the stack; the result is shifted to the right by " { $snippet "shift" } " bits" }
+    }
+"The bit field specifier is processed left to right, so stack values should be supplied in reverse order." }
+{ $examples
+    "Consider the following specification:"
+    { $list
+        { "bits 0-10 are set to the value of " { $snippet "x" } }
+        { "bits 11-14 are set to the value of " { $snippet "y" } }
+        { "bit 15 is always on" }
+        { "bits 16-20 are set to the value of " { $snippet "fooify" } " applied to " { $snippet "z" } }
+    }
+    "Such a bit field construction can be specified with a word like the following:"
+    { $code
+        ": baz-bitfield ( x y z -- n )"
+        "    {"
+        "        { fooify 16 }"
+        "        { 1 15 }"
+        "        11"
+        "        0"
+        "    } ;"
+    }
+} ;
diff --git a/core/math/bitfields/bitfields-tests.factor b/core/math/bitfields/bitfields-tests.factor
new file mode 100644 (file)
index 0000000..c382d33
--- /dev/null
@@ -0,0 +1,8 @@
+USING: math math.bitfields tools.test kernel ;
+IN: temporary
+
+[ 0 ] [ { } bitfield ] unit-test
+[ 256 ] [ 1 { 8 } bitfield ] unit-test
+[ 268 ] [ 3 1 { 8 2 } bitfield ] unit-test
+[ 268 ] [ 1 { 8 { 3 2 } } bitfield ] unit-test
+[ 512 ] [ 1 { { 1+ 8 } } bitfield ] unit-test
diff --git a/core/math/bitfields/bitfields.factor b/core/math/bitfields/bitfields.factor
new file mode 100644 (file)
index 0000000..f6a3419
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel math sequences words ;
+IN: math.bitfields
+
+GENERIC: (bitfield) inline
+
+M: integer (bitfield) ( value accum shift -- newaccum )
+    swapd shift bitor ;
+
+M: pair (bitfield) ( value accum pair -- newaccum )
+    first2 >r dup word? [ swapd execute ] when r> shift bitor ;
+
+: bitfield ( values... bitspec -- n )
+    0 [ (bitfield) ] reduce ;
diff --git a/core/math/bitfields/summary.txt b/core/math/bitfields/summary.txt
new file mode 100644 (file)
index 0000000..d622f81
--- /dev/null
@@ -0,0 +1 @@
+Domain-specific language for constructing integers
diff --git a/core/math/complex.factor b/core/math/complex.factor
deleted file mode 100644 (file)
index 43e83ac..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math-internals
-USING: errors generic kernel kernel-internals math ;
-
-: (rect>) ( x y -- z )
-    dup zero? [ drop ] [ <complex> ] if ; inline
-
-IN: math
-
-UNION: number real complex ;
-
-M: real real ;
-M: real imaginary drop 0 ;
-
-M: number equal? number= ;
-
-: rect> ( x y -- z )
-    over real? over real? and [
-        (rect>)
-    ] [
-        "Complex number must have real components" throw
-    ] if ; inline
-
-: >rect ( z -- x y ) dup real swap imaginary ; inline
-
-: >float-rect ( z -- x y )
-    >rect swap >float swap >float ; inline
-
-: conjugate ( z -- z* ) >rect neg rect> ; inline
-
-: arg ( z -- arg ) >float-rect swap fatan2 ; inline
-
-: >polar ( z -- abs arg )
-    >float-rect [ [ sq ] 2apply + fsqrt ] 2keep swap fatan2 ;
-    inline
-
-: cis ( arg -- z ) dup fcos swap fsin rect> ; inline
-
-: polar> ( abs arg -- z ) cis * ; inline
-
-M: complex absq >rect [ sq ] 2apply + ;
-
-IN: math-internals
-
-: 2>rect ( x y -- xr yr xi yi )
-    [ [ real ] 2apply ] 2keep [ imaginary ] 2apply ; inline
-
-M: complex number=
-    2>rect number= [ number= ] [ 2drop f ] if ;
-
-: *re ( x y -- xr*yr xi*ri ) 2>rect * >r * r> ; inline
-: *im ( x y -- xi*yr xr*yi ) 2>rect >r * swap r> * ; inline
-
-M: complex + 2>rect + >r + r> (rect>) ;
-M: complex - 2>rect - >r - r> (rect>) ;
-M: complex * 2dup *re - -rot *im + (rect>) ;
-
-: complex/ ( x y -- r i m )
-    #! r = xr*yr+xi*yi, i = xi*yr-xr*yi, m = yr*yr+yi*yi
-    dup absq >r 2dup *re + -rot *im - r> ; inline
-
-M: complex / complex/ tuck / >r / r> (rect>) ;
-
-M: complex abs absq >float fsqrt ;
-
-M: complex hashcode
-    >rect >fixnum swap >fixnum bitxor ;
diff --git a/core/math/complex.facts b/core/math/complex.facts
deleted file mode 100644 (file)
index 965853d..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-USING: help math math-internals ;
-
-HELP: complex
-{ $class-description "The class of complex numbers with non-zero imaginary part." } ;
-
-HELP: real ( z -- x )
-{ $values { "z" "a complex number" } { "x" "a real number" } }
-{ $description "Outputs the real part of a complex number. This acts as the identity on real numbers." }
-{ $notes "This word also acts as the class word for the class of real numbers, which is a disjoint union of rationals and floats." } ;
-
-HELP: imaginary ( z -- y )
-{ $values { "z" "a complex number" } { "y" "a real number" } }
-{ $description "Outputs the imaginary part of a complex number. This outputs zero for real numbers." } ;
-
-HELP: (rect>)
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a complex number" } }
-{ $description "Creates a complex number from real and imaginary components." }
-{ $warning "This word does not check that the arguments are real numbers, which can have undefined consequences. Use the " { $link rect> } " word instead." } ;
-
-HELP: number
-{ $class-description "The class of numbers." } ;
-
-HELP: rect>
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a complex number" } }
-{ $description "Creates a complex number from real and imaginary components." } ;
-
-HELP: >rect
-{ $values { "z" "a complex number" } { "x" "a real number" } { "y" "a real number" } }
-{ $description "Extracts the real and imaginary components of a complex number." } ;
-
-HELP: conjugate
-{ $values { "z" "a complex number" } { "z*" "a complex number" } }
-{ $description "Computes the complex conjugate by flipping the sign of the imaginary part of " { $snippet "z" } "." } ;
-
-HELP: arg
-{ $values { "z" "a complex number" } { "arg" "a number in the interval " { $snippet "(-pi,pi]" } } }
-{ $description "Computes the complex argument." } ;
-
-HELP: >polar
-{ $values { "z" "a complex number" } { "abs" "a non-negative real number" } { "arg" "a number in the interval " { $snippet "(-pi,pi]" } } }
-{ $description "Creates a complex number from an absolute value and argument (polar form)." } ;
-
-HELP: cis
-{ $values { "arg" "a real number" } { "z" "a complex number on the unit circle" } }
-{ $description "Computes a point on the unit circle using Euler's formula for " { $snippet "exp(arg*i)" } "." }
-{ $see-also exp } ;
-
-HELP: polar>
-{ $values { "z" "a complex number" } { "abs" "a non-negative real number" } { "arg" "a real number" } }
-{ $description "Converts an absolute value and argument (polar form) to a complex number." } ;
-
-HELP: 2>rect
-{ $values { "x" "a complex number" } { "y" "a complex number" } { "xr" "real part of " { $snippet "x" } } { "xi" "imaginary part of " { $snippet "x" } } { "yr" "real part of " { $snippet "y" } } { "yi" "imaginary part of " { $snippet "y" } } }
-{ $description "Extracts real and imaginary components of two numbers at once." } ;
-
-HELP: complex/
-{ $values { "x" "a complex number" } { "y" "a complex number" } { "r" "a real number" } { "i" "a real number" } { "m" "a real number" } }
-{ $description
-    "Complex division kernel. If we use the notation from " { $link 2>rect } ", this word computes:"
-    { $code
-        "r = xr*yr+xi*yi"
-        "i = xi*yr-xr*yi"
-        "m = yr*yr+yi*yi"
-    }
-} ;
-
-HELP: <complex> ( x y -- z )
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a complex number" } }
-{ $description "Low-level complex number constructor. User code should call " { $link rect> } " instead." } ;
diff --git a/core/math/complex/authors.txt b/core/math/complex/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/complex/complex-docs.factor b/core/math/complex/complex-docs.factor
new file mode 100644 (file)
index 0000000..01a52da
--- /dev/null
@@ -0,0 +1,40 @@
+USING: help.markup help.syntax math math.private math.functions
+math.complex.private ;
+IN: math.complex
+
+ARTICLE: "complex-numbers" "Complex numbers"
+{ $subsection complex }
+"Complex numbers arise as solutions to quadratic equations whose graph does not intersect the " { $emphasis "x" } " axis. Their literal syntax is covered in " { $link "syntax-complex-numbers" } "."
+$nl
+"Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero."
+$nl
+"Complex numbers can be taken apart:"
+{ $subsection real }
+{ $subsection imaginary }
+{ $subsection >rect }
+"Complex numbers can be constructed from real numbers:"
+{ $subsection rect> }
+{ $see-also "syntax-complex-numbers" } ;
+HELP: complex
+{ $class-description "The class of complex numbers with non-zero imaginary part." } ;
+
+ABOUT: "math.complex"
+
+HELP: 2>rect
+{ $values { "x" "a complex number" } { "y" "a complex number" } { "xr" "real part of " { $snippet "x" } } { "xi" "imaginary part of " { $snippet "x" } } { "yr" "real part of " { $snippet "y" } } { "yi" "imaginary part of " { $snippet "y" } } }
+{ $description "Extracts real and imaginary components of two numbers at once." } ;
+
+HELP: complex/
+{ $values { "x" "a complex number" } { "y" "a complex number" } { "r" "a real number" } { "i" "a real number" } { "m" "a real number" } }
+{ $description
+    "Complex division kernel. If we use the notation from " { $link 2>rect } ", this word computes:"
+    { $code
+        "r = xr*yr+xi*yi"
+        "i = xi*yr-xr*yi"
+        "m = yr*yr+yi*yi"
+    }
+} ;
+
+HELP: <complex> ( x y -- z )
+{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a complex number" } }
+{ $description "Low-level complex number constructor. User code should call " { $link rect> } " instead." } ;
diff --git a/core/math/complex/complex-tests.factor b/core/math/complex/complex-tests.factor
new file mode 100644 (file)
index 0000000..655dbd4
--- /dev/null
@@ -0,0 +1,65 @@
+USING: kernel math math.constants math.functions tools.test ;
+IN: temporary
+
+[ 1 C{ 0 1 } rect> ] unit-test-fails
+[ C{ 0 1 } 1 rect> ] unit-test-fails
+
+[ f ] [ C{ 5 12.5 } 5  = ] unit-test
+[ t ] [ C{ 1.0 2.0 } C{ 1 2 }  = ] unit-test
+[ f ] [ C{ 1.0 2.3 } C{ 1 2 }  = ] unit-test
+
+[ C{ 2 5 } ] [ 2 5  rect> ] unit-test
+[ 2 5 ] [ C{ 2 5 }  >rect ] unit-test
+[ C{ 1/2 1 } ] [ 1/2 i  + ] unit-test
+[ C{ 1/2 1 } ] [ i 1/2  + ] unit-test
+[ t ] [ C{ 11 64 } C{ 11 64 }  = ] unit-test
+[ C{ 2 1 } ] [ 2 i  + ] unit-test
+[ C{ 2 1 } ] [ i 2  + ] unit-test
+[ C{ 5 4 } ] [ C{ 2 2 } C{ 3 2 }  + ] unit-test
+[ 5 ] [ C{ 2 2 } C{ 3 -2 }  + ] unit-test
+[ C{ 1.0 1 } ] [ 1.0 i  + ] unit-test
+
+[ C{ 1/2 -1 } ] [ 1/2 i  - ] unit-test
+[ C{ -1/2 1 } ] [ i 1/2  - ] unit-test
+[ C{ 1/3 1/4 } ] [ 1 3 / 1 2 / i * + 1 4 / i *  - ] unit-test
+[ C{ -1/3 -1/4 } ] [ 1 4 / i * 1 3 / 1 2 / i * +  - ] unit-test
+[ C{ 1/5 1/4 } ] [ C{ 3/5 1/2 } C{ 2/5 1/4 }  - ] unit-test
+[ 4 ] [ C{ 5 10/3 } C{ 1 10/3 }  - ] unit-test
+[ C{ 1.0 -1 } ] [ 1.0 i  - ] unit-test
+
+[ C{ 0 1 } ] [ i 1  * ] unit-test
+[ C{ 0 1 } ] [ 1 i  * ] unit-test
+[ C{ 0 1.0 } ] [ 1.0 i  * ] unit-test
+[ -1 ] [ i i  * ] unit-test
+[ C{ 0 1 } ] [ 1 i  * ] unit-test
+[ C{ 0 1 } ] [ i 1  * ] unit-test
+[ C{ 0 1/2 } ] [ 1/2 i  * ] unit-test
+[ C{ 0 1/2 } ] [ i 1/2  * ] unit-test
+[ 2 ] [ C{ 1 1 } C{ 1 -1 }  * ] unit-test
+[ 1 ] [ i -i  * ] unit-test
+
+[ -1 ] [ i -i  / ] unit-test
+[ C{ 0 1 } ] [ 1 -i  / ] unit-test
+[ t ] [ C{ 12 13 } C{ 13 14 } / C{ 13 14 } * C{ 12 13 }  = ] unit-test
+
+[ C{ -3 4 } ] [ C{ 3 -4 }  neg ] unit-test
+
+[ 5 ] [ C{ 3 4 } abs ] unit-test
+[ 5 ] [ -5.0 abs ] unit-test
+
+! Make sure arguments are sane
+[ 0 ] [ 0 arg ] unit-test
+[ 0 ] [ 1 arg ] unit-test
+[ t ] [ -1 arg 3.14 3.15 between? ] unit-test
+[ t ] [ i arg 1.57 1.58 between? ] unit-test
+[ t ] [ -i arg -1.58 -1.57 between? ] unit-test
+
+[ 1 0 ] [ 1 >polar ] unit-test
+[ 1 ] [ -1 >polar drop ] unit-test
+[ t ] [ -1 >polar nip 3.14 3.15 between? ] unit-test
+
+! I broke something
+[ ] [ C{ 1 4 } tanh drop ] unit-test
+[ ] [ C{ 1 4 } tan drop ] unit-test
+[ ] [ C{ 1 4 } coth drop ] unit-test
+[ ] [ C{ 1 4 } cot drop ] unit-test
diff --git a/core/math/complex/complex.factor b/core/math/complex/complex.factor
new file mode 100644 (file)
index 0000000..8b21866
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: math.complex.private
+USING: kernel kernel.private math math.private
+math.libm math.functions ;
+
+M: real real ;
+M: real imaginary drop 0 ;
+
+M: number equal? number= ;
+
+M: complex absq >rect [ sq ] 2apply + ;
+
+: 2>rect ( x y -- xr yr xi yi )
+    [ [ real ] 2apply ] 2keep [ imaginary ] 2apply ; inline
+
+M: complex number=
+    2>rect number= [ number= ] [ 2drop f ] if ;
+
+: *re ( x y -- xr*yr xi*ri ) 2>rect * >r * r> ; inline
+: *im ( x y -- xi*yr xr*yi ) 2>rect >r * swap r> * ; inline
+
+M: complex + 2>rect + >r + r> (rect>) ;
+M: complex - 2>rect - >r - r> (rect>) ;
+M: complex * 2dup *re - -rot *im + (rect>) ;
+
+: complex/ ( x y -- r i m )
+    dup absq >r 2dup *re + -rot *im - r> ; inline
+
+M: complex / complex/ tuck / >r / r> (rect>) ;
+
+M: complex abs absq >float fsqrt ;
+
+M: complex sqrt >polar swap fsqrt swap 2.0 / polar> ;
+
+M: complex hashcode* nip >rect >fixnum swap >fixnum bitxor ;
diff --git a/core/math/complex/summary.txt b/core/math/complex/summary.txt
new file mode 100644 (file)
index 0000000..dbca00f
--- /dev/null
@@ -0,0 +1 @@
+Complex number implementation
diff --git a/core/math/constants.factor b/core/math/constants.factor
deleted file mode 100644 (file)
index 03d6e4e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: kernel-internals
-USING: kernel namespaces math ;
-
-: bootstrap-cell \ cell get ; inline
-: cells ( m -- n ) cell * ; inline
-: bootstrap-cells bootstrap-cell * ; inline
-
-: cell-bits ( -- n ) 8 cells ; inline
-: bootstrap-cell-bits 8 bootstrap-cells ; inline
-
-: tag-address ( x tag -- tagged ) swap tag-bits shift bitor ;
-: tag-header ( id -- tagged ) object-tag tag-address ;
-
-IN: math
-
-: i ( -- i ) C{ 0 1 } ; inline
-: -i ( -- -i ) C{ 0 -1 } ; inline
-: e ( -- e ) 2.7182818284590452354 ; inline
-: pi ( -- pi ) 3.14159265358979323846 ; inline
-: epsilon ( -- epsilon ) 2.2204460492503131e-16 ; inline
-
-: first-bignum ( -- n )
-    1 bootstrap-cell-bits tag-bits - 1- shift ;
-
-: most-positive-fixnum ( -- n ) first-bignum 1- ;
-: most-negative-fixnum ( -- n ) first-bignum neg ;
diff --git a/core/math/constants.facts b/core/math/constants.facts
deleted file mode 100644 (file)
index 95e3b78..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-USING: help kernel-internals math ;
-
-HELP: cells
-{ $values { "m" "an integer" } { "n" "an integer" } }
-{ $description "Computes the number of bytes corresponding to " { $snippet "m" } " CPU operand-sized cells." } ;
-
-HELP: cell-bits
-{ $values { "n" "an integer" } }
-{ $description "Outputs the number of bits in one CPU operand-sized cell." } ;
-
-HELP: i
-{ $values { "i" "the imaginary unit" } } ;
-
-HELP: -i
-{ $values { "-i" "the negated imaginary unit" } } ;
-
-HELP: e
-{ $values { "e" "base of natural logarithm" } } ;
-
-HELP: pi
-{ $values { "pi" "circumference of circle with diameter 1" } } ;
-
-HELP: epsilon
-{ $values { "epsilon" "smallest floating point value you can add to 1 without underflow" } } ;
-
-HELP: first-bignum
-{ $values { "n" "smallest positive integer not representable by a fixnum" } } ;
-
-HELP: most-positive-fixnum
-{ $values { "n" "largest positive integer representable by a fixnum" } } ;
-
-HELP: most-negative-fixnum
-{ $values { "n" "smallest negative integer representable by a fixnum" } } ;
diff --git a/core/math/constants/authors.txt b/core/math/constants/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/constants/constants-docs.factor b/core/math/constants/constants-docs.factor
new file mode 100644 (file)
index 0000000..5945bb2
--- /dev/null
@@ -0,0 +1,30 @@
+USING: help.markup help.syntax kernel layouts ;
+IN: math.constants
+
+ARTICLE: "math-constants" "Constants"
+"Standard mathematical constants:"
+{ $subsection i }
+{ $subsection -i }
+{ $subsection e }
+{ $subsection pi }
+"Various limits:"
+{ $subsection most-positive-fixnum }
+{ $subsection most-negative-fixnum }
+{ $subsection epsilon } ;
+
+ABOUT: "math-constants"
+
+HELP: i
+{ $values { "i" "the imaginary unit" } } ;
+
+HELP: -i
+{ $values { "-i" "the negated imaginary unit" } } ;
+
+HELP: e
+{ $values { "e" "base of natural logarithm" } } ;
+
+HELP: pi
+{ $values { "pi" "circumference of circle with diameter 1" } } ;
+
+HELP: epsilon
+{ $values { "epsilon" "smallest floating point value you can add to 1 without underflow" } } ;
diff --git a/core/math/constants/constants.factor b/core/math/constants/constants.factor
new file mode 100644 (file)
index 0000000..75c745e
--- /dev/null
@@ -0,0 +1,9 @@
+! Copyright (C) 2004, 2005 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: math.constants
+
+: i ( -- i ) C{ 0 1 } ; inline
+: -i ( -- -i ) C{ 0 -1 } ; inline
+: e ( -- e ) 2.7182818284590452354 ; inline
+: pi ( -- pi ) 3.14159265358979323846 ; inline
+: epsilon ( -- epsilon ) 2.2204460492503131e-16 ; inline
diff --git a/core/math/constants/summary.txt b/core/math/constants/summary.txt
new file mode 100644 (file)
index 0000000..38684ec
--- /dev/null
@@ -0,0 +1 @@
+Mathematical constants
diff --git a/core/math/float.factor b/core/math/float.factor
deleted file mode 100644 (file)
index 2b1d048..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math-internals
-USING: math kernel ;
-
-: float= ( n n -- ? )
-    #! The compiler replaces this with a better intrinsic.
-    [ double>bits ] 2apply number= ; foldable
-
-IN: math
-
-UNION: real rational float ;
-
-M: real abs dup 0 < [ neg ] when ;
-M: real absq sq ;
-
-M: real hashcode >fixnum ;
-M: real <=> - ;
-
-: fp-nan? ( float -- ? )
-    double>bits -51 shift BIN: 111111111111 [ bitand ] keep
-    number= ;
-
-M: float zero?
-    dup 0.0 float= swap -0.0 float= or ;
-
-M: float >fixnum float>fixnum ;
-M: float >bignum float>bignum ;
-M: float >float ;
-
-M: float < float< ;
-M: float <= float<= ;
-M: float > float> ;
-M: float >= float>= ;
-M: float number= float= ;
-
-M: float + float+ ;
-M: float - float- ;
-M: float * float* ;
-M: float / float/f ;
-M: float mod float-mod ;
-
-: /f  ( x y -- z ) >r >float r> >float float/f ; inline
-
-M: ratio >float >fraction /f ;
diff --git a/core/math/float.facts b/core/math/float.facts
deleted file mode 100644 (file)
index ef17809..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-USING: help math math-internals ;
-
-HELP: float
-{ $class-description "The class of double-precision floating point numbers." } ;
-
-HELP: >float ( x -- y )
-{ $values { "x" "a real number" } { "y" "a float" } }
-{ $description "Converts a real to a float. This is the identity on floats, and performs a floating point division on rationals." } ;
-
-HELP: bits>double ( n -- x )
-{ $values { "n" "a 64-bit integer representing an 754 double-precision float" } { "x" "a float" } }
-{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." }
-{ $see-also bits>float double>bits float>bits } ;
-
-HELP: bits>float ( n -- x )
-{ $values { "n" "a 32-bit integer representing an 754 single-precision float" } { "x" "a float" } }
-{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." }
-{ $see-also bits>double double>bits float>bits } ;
-
-HELP: double>bits ( x -- n )
-{ $values { "x" "a float" } { "n" "a 64-bit integer representing an 754 double-precision float" } }
-{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." }
-{ $see-also bits>double bits>float float>bits } ;
-
-HELP: float>bits ( x -- n )
-{ $values { "x" "a float" } { "n" "a 32-bit integer representing an 754 single-precision float" } }
-{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." }
-{ $see-also bits>double bits>float double>bits } ;
-
-! Unsafe primitives
-HELP: float+ ( x y -- z )
-{ $values { "x" "a float" } { "y" "a float" } { "z" "a float" } }
-{ $description "Primitive version of " { $link + } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
-
-HELP: float- ( x y -- z )
-{ $values { "x" "a float" } { "y" "a float" } { "z" "a float" } }
-{ $description "Primitive version of " { $link - } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
-
-HELP: float* ( x y -- z )
-{ $values { "x" "a float" } { "y" "a float" } { "z" "a float" } }
-{ $description "Primitive version of " { $link * } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link * } " instead." } ;
-
-HELP: float-mod ( x y -- z )
-{ $values { "x" "a float" } { "y" "a float" } { "z" "a float" } }
-{ $description "Primitive version of " { $link mod } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link mod } " instead." } ;
-
-HELP: float/f ( x y -- z )
-{ $values { "x" "a float" } { "y" "a float" } { "z" "a float" } }
-{ $description "Primitive version of " { $link /f } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /f } " instead." } ;
-
-HELP: float< ( x y -- ? )
-{ $values { "x" "a float" } { "y" "a float" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link < } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
-
-HELP: float<= ( x y -- ? )
-{ $values { "x" "a float" } { "y" "a float" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link <= } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
-
-HELP: float> ( x y -- ? )
-{ $values { "x" "a float" } { "y" "a float" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link > } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
-
-HELP: float>= ( x y -- ? )
-{ $values { "x" "a float" } { "y" "a float" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link >= } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
diff --git a/core/math/floats/authors.txt b/core/math/floats/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/floats/floats-docs.factor b/core/math/floats/floats-docs.factor
new file mode 100644 (file)
index 0000000..cd2a3c2
--- /dev/null
@@ -0,0 +1,93 @@
+USING: help.markup help.syntax math math.private ;
+IN: math.floats
+
+ARTICLE: "floats" "Floats"
+{ $subsection float }
+"Rational numbers represent " { $emphasis "exact" } " quantities. On the other hand, a floating point number is an " { $emphasis "approximation" } ". While rationals can grow to any required precision, floating point numbers are fixed-width, and manipulating them is usually faster than manipulating ratios or bignums (but slower than manipulating fixnums). Floating point numbers are often used to represent irrational numbers, which have no exact representation as a ratio of two integers."
+$nl
+"Introducing a floating point number in a computation forces the result to be expressed in floating point."
+{ $example "5/4 1/2 + ." "7/4" }
+{ $example "5/4 0.5 + ." "1.75" }
+"Integers and rationals can be converted to floats:"
+{ $subsection >float }
+"Two real numbers can be divided yielding a float result:"
+{ $subsection /f }
+"Floating point numbers are represented internally in IEEE 754 double-precision format. This internal representation can be accessed for advanced operations and input/output purposes."
+{ $subsection float>bits }
+{ $subsection double>bits }
+{ $subsection bits>float }
+{ $subsection bits>double }
+{ $see-also "syntax-floats" } ;
+
+ABOUT: "floats"
+
+HELP: float
+{ $class-description "The class of double-precision floating point numbers." } ;
+
+HELP: >float ( x -- y )
+{ $values { "x" real } { "y" float } }
+{ $description "Converts a real to a float. This is the identity on floats, and performs a floating point division on rationals." } ;
+
+HELP: bits>double ( n -- x )
+{ $values { "n" "a 64-bit integer representing an 754 double-precision float" } { "x" float } }
+{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
+
+{ bits>double bits>float double>bits float>bits } related-words
+
+HELP: bits>float ( n -- x )
+{ $values { "n" "a 32-bit integer representing an 754 single-precision float" } { "x" float } }
+{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
+
+HELP: double>bits ( x -- n )
+{ $values { "x" float } { "n" "a 64-bit integer representing an 754 double-precision float" } }
+{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
+
+HELP: float>bits ( x -- n )
+{ $values { "x" float } { "n" "a 32-bit integer representing an 754 single-precision float" } }
+{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
+
+! Unsafe primitives
+HELP: float+ ( x y -- z )
+{ $values { "x" float } { "y" float } { "z" float } }
+{ $description "Primitive version of " { $link + } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
+
+HELP: float- ( x y -- z )
+{ $values { "x" float } { "y" float } { "z" float } }
+{ $description "Primitive version of " { $link - } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
+
+HELP: float* ( x y -- z )
+{ $values { "x" float } { "y" float } { "z" float } }
+{ $description "Primitive version of " { $link * } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link * } " instead." } ;
+
+HELP: float-mod ( x y -- z )
+{ $values { "x" float } { "y" float } { "z" float } }
+{ $description "Primitive version of " { $link mod } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link mod } " instead." } ;
+
+HELP: float/f ( x y -- z )
+{ $values { "x" float } { "y" float } { "z" float } }
+{ $description "Primitive version of " { $link /f } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /f } " instead." } ;
+
+HELP: float< ( x y -- ? )
+{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link < } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
+
+HELP: float<= ( x y -- ? )
+{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link <= } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
+
+HELP: float> ( x y -- ? )
+{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link > } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
+
+HELP: float>= ( x y -- ? )
+{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link >= } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
diff --git a/core/math/floats/floats-tests.factor b/core/math/floats/floats-tests.factor
new file mode 100644 (file)
index 0000000..eed1046
--- /dev/null
@@ -0,0 +1,78 @@
+USING: kernel math math.constants tools.test sequences ;
+IN: temporary
+
+[ t ] [ 0.0 float? ] unit-test
+[ t ] [ 3.1415 number? ] unit-test
+[ f ] [ 12 float? ] unit-test
+
+[ t ] [ 1 1.0 = ] unit-test
+[ t ] [ 1 >bignum 1.0 = ] unit-test
+[ t ] [ 1.0 1 = ] unit-test
+[ t ] [ 1.0 1 >bignum = ] unit-test
+
+[ f ] [ 1 1.3 = ] unit-test
+[ f ] [ 1 >bignum 1.3 = ] unit-test
+[ f ] [ 1.3 1 = ] unit-test
+[ f ] [ 1.3 1 >bignum = ] unit-test
+
+[ t ] [ 134.3 >fixnum 134 = ] unit-test
+
+[ 3 ] [ 3.5 >bignum ] unit-test
+[ -3 ] [ -3.5 >bignum ] unit-test
+
+[ 3 ] [ 3.5 >fixnum ] unit-test
+[ -3 ] [ -3.5 >fixnum ] unit-test
+
+[ 2.1 ] [ -2.1 neg ] unit-test
+
+[ 1 ] [ 0.5 1/2 + ] unit-test
+[ 1 ] [ 1/2 0.5 + ] unit-test
+
+[ 3 ] [ 3.1415 >fixnum ] unit-test
+[ 3 ] [ 3.1415 >bignum ] unit-test
+
+[ t ] [ pi 3 > ] unit-test
+[ f ] [ e 2 <= ] unit-test
+
+[ t ] [ 1.0 dup float>bits bits>float = ] unit-test
+[ t ] [ pi double>bits bits>double pi = ] unit-test
+[ t ] [ e double>bits bits>double e = ] unit-test
+
+[ BIN: 11111111111000000000000000000000000000000000000000000000000000 ]
+[ 1.5 double>bits ] unit-test
+
+[ 1.5 ]
+[ BIN: 11111111111000000000000000000000000000000000000000000000000000 bits>double ]
+unit-test
+
+[ 2.0 ] [ 1.0 1+ ] unit-test
+[ 0.0 ] [ 1.0 1- ] unit-test
+
+[ 4.0 ] [ 4.5 truncate ] unit-test
+[ 4.0 ] [ 4.5 floor ] unit-test
+[ 5.0 ] [ 4.5 ceiling ] unit-test
+
+[ -4.0 ] [ -4.5 truncate ] unit-test
+[ -5.0 ] [ -4.5 floor ] unit-test
+[ -4.0 ] [ -4.5 ceiling ] unit-test
+
+[ -4.0 ] [ -4.0 truncate ] unit-test
+[ -4.0 ] [ -4.0 floor ] unit-test
+[ -4.0 ] [ -4.0 ceiling ] unit-test
+
+[ -5.0 ] [ -4.5 round ] unit-test
+[ -4.0 ] [ -4.4 round ] unit-test
+[ 5.0 ] [ 4.5 round ] unit-test
+[ 4.0 ] [ 4.4 round ] unit-test
+
+! [ t ] [ -0.0 -0.0 = ] unit-test
+! [ f ] [ 0.0 -0.0 = ] unit-test
+
+[ t ] [ 0.0 zero? ] unit-test
+[ t ] [ -0.0 zero? ] unit-test
+
+! [ t ] [ 0.0/0.0 0.0/0.0 = ] unit-test
+
+[ 0 ] [ 1/0. >bignum ] unit-test
+
+[ t ] [ 64 [ 2^ 0.5 * ] map [ < ] monotonic? ] unit-test
diff --git a/core/math/floats/floats.factor b/core/math/floats/floats.factor
new file mode 100644 (file)
index 0000000..62679af
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2004, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math math.functions math.private math.libm ;
+IN: math.floats.private
+
+M: fixnum >float fixnum>float ;
+M: bignum >float bignum>float ;
+
+M: real abs dup 0 < [ neg ] when ;
+M: real absq sq ;
+
+M: real hashcode* nip >fixnum ;
+M: real <=> - ;
+
+M: float zero? dup 0.0 float= swap -0.0 float= or ;
+
+M: float >fixnum float>fixnum ;
+M: float >bignum float>bignum ;
+M: float >float ;
+
+M: float < float< ;
+M: float <= float<= ;
+M: float > float> ;
+M: float >= float>= ;
+M: float number= float= ;
+
+M: float + float+ ;
+M: float - float- ;
+M: float * float* ;
+M: float / float/f ;
+M: float mod float-mod ;
+
+M: real sqrt
+    >float dup 0.0 < [ neg fsqrt 0.0 swap rect> ] [ fsqrt ] if ;
diff --git a/core/math/floats/summary.txt b/core/math/floats/summary.txt
new file mode 100644 (file)
index 0000000..07fd690
--- /dev/null
@@ -0,0 +1 @@
+Floating point number implementation
diff --git a/core/math/functions/authors.txt b/core/math/functions/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/functions/functions-docs.factor b/core/math/functions/functions-docs.factor
new file mode 100644 (file)
index 0000000..6889b60
--- /dev/null
@@ -0,0 +1,283 @@
+USING: help.markup help.syntax kernel math
+sequences quotations ;
+IN: math.functions
+
+ARTICLE: "integer-functions" "Integer functions"
+{ $subsection align }
+{ $subsection gcd }
+{ $subsection log2 }
+{ $subsection next-power-of-2 }
+"Tests:"
+{ $subsection power-of-2? }
+{ $subsection even? }
+{ $subsection odd? } ;
+
+ARTICLE: "arithmetic-functions" "Arithmetic functions"
+"Computing additive and multiplicative inverses:"
+{ $subsection neg }
+{ $subsection recip }
+"Incrementing, decrementing:"
+{ $subsection 1+ }
+{ $subsection 1- }
+"Minimum, maximum:"
+{ $subsection min }
+{ $subsection max }
+"Complex conjugation:"
+{ $subsection conjugate }
+"Tests:"
+{ $subsection zero? }
+{ $subsection between? }
+"Sign:"
+{ $subsection sgn }
+"Rounding:"
+{ $subsection ceiling }
+{ $subsection floor }
+{ $subsection truncate }
+{ $subsection round } ;
+
+ARTICLE: "power-functions" "Powers and logarithms"
+"Squares:"
+{ $subsection sq }
+{ $subsection sqrt }
+"Exponential and natural logarithm:"
+{ $subsection exp }
+{ $subsection cis }
+{ $subsection log }
+"Raising a number to a power:"
+{ $subsection ^ }
+"Converting between rectangular and polar form:"
+{ $subsection abs }
+{ $subsection absq }
+{ $subsection arg }
+{ $subsection >polar }
+{ $subsection polar> } ;
+
+ARTICLE: "trig-hyp-functions" "Trigonometric and hyperbolic functions"
+"Trigonometric functions:"
+{ $subsection cos }
+{ $subsection sin }
+{ $subsection tan }
+"Reciprocals:"
+{ $subsection sec }
+{ $subsection cosec }
+{ $subsection cot }
+"Inverses:"
+{ $subsection acos }
+{ $subsection asin }
+{ $subsection atan }
+"Inverse reciprocals:"
+{ $subsection asec }
+{ $subsection acosec }
+{ $subsection acot }
+"Hyperbolic functions:"
+{ $subsection cosh }
+{ $subsection sinh }
+{ $subsection tanh }
+"Reciprocals:"
+{ $subsection sech }
+{ $subsection cosech }
+{ $subsection coth }
+"Inverses:"
+{ $subsection acosh }
+{ $subsection asinh }
+{ $subsection atanh }
+"Inverse reciprocals:"
+{ $subsection asech }
+{ $subsection acosech }
+{ $subsection acoth } ;
+
+ARTICLE: "math-functions" "Mathematical functions"
+{ $subsection "integer-functions" }
+{ $subsection "arithmetic-functions" }
+{ $subsection "power-functions" }
+{ $subsection "trig-hyp-functions" } ;
+
+ABOUT: "math-functions"
+
+HELP: power-of-2?
+{ $values { "n" integer } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "n" } " is a power of 2." } ;
+
+HELP: align
+{ $values { "m" integer } { "w" "a power of 2" } { "n" "an integer multiple of " { $snippet "w" } } }
+{ $description "Outputs the least multiple of " { $snippet "w" } " greater than " { $snippet "m" } "." }
+{ $notes "This word will give an incorrect result if " { $snippet "w" } " is not a power of 2." } ;
+
+HELP: exp
+{ $values { "x" number } { "y" number } }
+{ $description "Exponential function, " { $snippet "y=e^x" } "." } ;
+
+HELP: log
+{ $values { "x" number } { "y" number } }
+{ $description "Natural logarithm function. Outputs negative infinity if " { $snippet "x" } " is 0." } ;
+
+HELP: sqrt
+{ $values { "x" number } { "y" number } }
+{ $description "Square root function." } ;
+
+HELP: cosh
+$values-x/y
+{ $description "Hyperbolic cosine." } ;
+
+HELP: sech
+$values-x/y
+{ $description "Hyperbolic secant." } ;
+
+HELP: sinh
+$values-x/y
+{ $description "Hyperbolic sine." } ;
+
+HELP: cosech
+$values-x/y
+{ $description "Hyperbolic cosecant." } ;
+
+HELP: tanh
+$values-x/y
+{ $description "Hyperbolic tangent." } ;
+
+HELP: coth
+$values-x/y
+{ $description "Hyperbolic cotangent." } ;
+
+HELP: cos
+$values-x/y
+{ $description "Trigonometric cosine." } ;
+
+HELP: sec
+$values-x/y
+{ $description "Trigonometric secant." } ;
+
+HELP: sin
+$values-x/y
+{ $description "Trigonometric sine." } ;
+
+HELP: cosec
+$values-x/y
+{ $description "Trigonometric cosecant." } ;
+
+HELP: tan
+$values-x/y
+{ $description "Trigonometric tangent." } ;
+
+HELP: cot
+$values-x/y
+{ $description "Trigonometric cotangent." } ;
+
+HELP: acosh
+$values-x/y
+{ $description "Inverse hyperbolic cosine." } ;
+
+HELP: asech
+$values-x/y
+{ $description "Inverse hyperbolic secant." } ;
+
+HELP: asinh
+$values-x/y
+{ $description "Inverse hyperbolic sine." } ;
+
+HELP: acosech
+$values-x/y
+{ $description "Inverse hyperbolic cosecant." } ;
+
+HELP: atanh
+$values-x/y
+{ $description "Inverse hyperbolic tangent." } ;
+
+HELP: acoth
+$values-x/y
+{ $description "Inverse hyperbolic cotangent." } ;
+
+HELP: acos
+$values-x/y
+{ $description "Inverse trigonometric cosine." } ;
+
+HELP: asec
+$values-x/y
+{ $description "Inverse trigonometric secant." } ;
+
+HELP: asin
+$values-x/y
+{ $description "Inverse trigonometric sine." } ;
+
+HELP: acosec
+$values-x/y
+{ $description "Inverse trigonometric cosecant." } ;
+
+HELP: atan
+$values-x/y
+{ $description "Inverse trigonometric tangent." } ;
+
+HELP: acot
+$values-x/y
+{ $description "Inverse trigonometric cotangent." } ;
+
+HELP: conjugate
+{ $values { "z" number } { "z*" number } }
+{ $description "Computes the complex conjugate by flipping the sign of the imaginary part of " { $snippet "z" } "." } ;
+
+HELP: arg
+{ $values { "z" number } { "arg" "a number in the interval " { $snippet "(-pi,pi]" } } }
+{ $description "Computes the complex argument." } ;
+
+HELP: >polar
+{ $values { "z" number } { "abs" "a non-negative real number" } { "arg" "a number in the interval " { $snippet "(-pi,pi]" } } }
+{ $description "Creates a complex number from an absolute value and argument (polar form)." } ;
+
+HELP: cis
+{ $values { "arg" "a real number" } { "z" "a complex number on the unit circle" } }
+{ $description "Computes a point on the unit circle using Euler's formula for " { $snippet "exp(arg*i)" } "." } ;
+
+{ cis exp } related-words
+
+HELP: polar>
+{ $values { "z" number } { "abs" "a non-negative real number" } { "arg" real } }
+{ $description "Converts an absolute value and argument (polar form) to a complex number." } ;
+
+HELP: [-1,1]?
+{ $values { "x" number } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "x" } " is a real number between -1 and 1, inclusive." } ;
+
+HELP: abs
+{ $values { "x" number } { "y" "a non-negative real number" } }
+{ $description "Computes the absolute value of a complex number." } ;
+
+HELP: absq
+{ $values { "x" number } { "y" "a non-negative real number" } }
+{ $description "Computes the squared absolute value of a complex number. This is marginally more efficient than " { $link abs } "." } ;
+
+HELP: ^
+{ $values { "x" number } { "y" number } { "z" number } }
+{ $description "Raises " { $snippet "x" } " to the power of " { $snippet "y" } ". If " { $snippet "y" } " is an integer the answer is computed exactly, otherwise a floating point approximation is used." }
+{ $errors "Throws an error if " { $snippet "x" } " and " { $snippet "y" } " are both integer 0." } ;
+
+HELP: gcd
+{ $values { "x" integer } { "y" integer } { "a" integer } { "d" integer } }
+{ $description "Computes the positive greatest common divisor " { $snippet "d" } " of " { $snippet "x" } " and " { $snippet "y" } ", and another value " { $snippet "a" } " satisfying:" { $code "a*y = d mod x" } }
+{ $notes "If " { $snippet "d" } " is 1, then " { $snippet "a" } " is the inverse of " { $snippet "y" } " modulo " { $snippet "x" } "." } ;
+
+HELP: mod-inv
+{ $values { "x" integer } { "n" integer } { "y" integer } }
+{ $description "Outputs an integer " { $snippet "y" } " such that " { $snippet "xy = 1 (mod n)" } "." }
+{ $errors "Throws an error if " { $snippet "n" } " is not invertible modulo " { $snippet "n" } "." }
+{ $examples
+    { $example "173 1119 mod-inv ." "815" }
+    { $example "173 815 * 1119 mod ." "1" }
+} ;
+
+HELP: each-bit
+{ $values { "n" integer } { "quot" "a quotation with stack effect " { $snippet "( ? -- )" } } }
+{ $description "Applies the quotation to each bit of the integer, starting from the least significant bit, and stopping at the last bit from which point on all bits are either clear (if the integer is positive) or all bits are set (if the integer is negataive)." }
+{ $examples
+    { $example "[ BIN: 1101 [ , ] each-bit ] { } make ." "{ t f t t }" }
+    { $example "[ -3 [ , ] each-bit ] { } make ." "{ f t }" }
+} ;
+
+HELP: ~
+{ $values { "x" real } { "y" real } { "epsilon" real } }
+{ $description "Tests if " { $snippet "x" } " and " { $snippet "y" } " are approximately equal to each other. There are three possible comparison tests, chosen based on the sign of " { $snippet "epsilon" } ":"
+    { $list
+        { { $snippet "epsilon" } " is zero: exact comparison." }
+        { { $snippet "epsilon" } " is positive: absolute distance test." }
+        { { $snippet "epsilon" } " is negative: relative distance test." }
+    }
+} ;
diff --git a/core/math/functions/functions-tests.factor b/core/math/functions/functions-tests.factor
new file mode 100644 (file)
index 0000000..17104e7
--- /dev/null
@@ -0,0 +1,74 @@
+USING: kernel math math.constants math.functions math.private
+math.libm tools.test ;
+IN: temporary
+
+[ t ] [ 4 4 .00000001 ~ ] unit-test
+[ t ] [ 4.0000001 4.0000001 .000001 ~ ] unit-test
+[ f ] [ -4.0000001 4.0000001 .00001 ~ ] unit-test
+[ t ] [ -.0000000000001 0 .0000000001 ~ ] unit-test
+
+! Lets get the argument order correct, eh?
+[ 0.0 ] [ 0.0 1.0 fatan2 ] unit-test
+[ 0.25 ] [ 2.0 -2.0 fpow ] unit-test
+
+[ 4.0 ] [ 16 sqrt ] unit-test
+[ C{ 0 4.0 } ] [ -16 sqrt ] unit-test
+
+[ 4.0 ] [ 2 2 ^ ] unit-test
+[ 0.25 ] [ 2 -2 ^ ] unit-test
+[ t ] [ 2 0.5 ^ 2 ^ 2 2.00001 between? ] unit-test
+[ t ] [ e pi i * ^ real -1.0 = ] unit-test
+[ t ] [ e pi i * ^ imaginary -0.00001 0.00001 between? ] unit-test
+
+[ t ] [ 0 0 ^ fp-nan? ] unit-test
+[ 1.0/0.0 ] [ 0 -2 ^ ] unit-test
+[ t ] [ 0 0.0 ^ fp-nan? ] unit-test
+[ 1.0/0.0 ] [ 0 -2.0 ^ ] unit-test
+[ 0 ] [ 0 3.0 ^ ] unit-test
+[ 0 ] [ 0 3 ^ ] unit-test
+
+[ 1.0 ] [ 0 cosh ] unit-test
+[ 0.0 ] [ 1 acosh ] unit-test
+            
+[ 1.0 ] [ 0 cos ] unit-test
+[ 0.0 ] [ 1 acos ] unit-test
+            
+[ 0.0 ] [ 0 sinh ] unit-test
+[ 0.0 ] [ 0 asinh ] unit-test
+            
+[ 0.0 ] [ 0 sin ] unit-test
+[ 0.0 ] [ 0 asin ] unit-test
+
+[ 100 ] [ 100 100 gcd nip ] unit-test
+[ 100 ] [ 1000 100 gcd nip ] unit-test
+[ 100 ] [ 100 1000 gcd nip ] unit-test
+[ 4 ] [ 132 64 gcd nip ] unit-test
+[ 4 ] [ -132 64 gcd nip ] unit-test
+[ 4 ] [ -132 -64 gcd nip ] unit-test
+[ 4 ] [ 132 -64 gcd nip ] unit-test
+[ 4 ] [ -132 -64 gcd nip ] unit-test
+
+[ 100 ] [ 100 >bignum 100 >bignum gcd nip ] unit-test
+[ 100 ] [ 1000 >bignum 100 >bignum gcd nip ] unit-test
+[ 100 ] [ 100 >bignum 1000 >bignum gcd nip ] unit-test
+[ 4 ] [ 132 >bignum 64 >bignum gcd nip ] unit-test
+[ 4 ] [ -132 >bignum 64 >bignum gcd nip ] unit-test
+[ 4 ] [ -132 >bignum -64 >bignum gcd nip ] unit-test
+[ 4 ] [ 132 >bignum -64 >bignum gcd nip ] unit-test
+[ 4 ] [ -132 >bignum -64 >bignum gcd nip ] unit-test
+
+[ 6 ] [
+    1326264299060955293181542400000006
+    1591517158873146351817850880000000
+    gcd nip
+] unit-test
+
+: verify-gcd
+    2dup gcd
+    >r rot * swap rem r> = ; 
+
+[ t ] [ 123 124 verify-gcd ] unit-test
+[ t ] [ 50 120 verify-gcd ] unit-test
+
+[ 3 ] [ 5 7 mod-inv ] unit-test
+[ 78572682077 ] [ 234829342 342389423843 mod-inv ] unit-test
diff --git a/core/math/functions/functions.factor b/core/math/functions/functions.factor
new file mode 100644 (file)
index 0000000..b0f81d4
--- /dev/null
@@ -0,0 +1,177 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: math kernel math.constants math.libm combinators ;
+IN: math.functions
+
+: each-bit ( n quot -- )
+    over 0 number= pick -1 number= or [
+        2drop
+    ] [
+        2dup >r >r >r odd? r> call r> 2/ r> each-bit
+    ] if ; inline
+
+GENERIC: (^) ( x y -- z ) foldable
+
+: ^n ( z w -- z^w )
+    1 swap [
+        [ dupd * ] when >r sq r>
+    ] each-bit nip ; inline
+
+M: integer (^)
+    dup 0 < [ neg ^n recip ] [ ^n ] if ;
+
+: ^ ( x y -- z )
+    over zero? [
+        dup zero?
+        [ 2drop 0.0 0.0 / ] [ 0 < [ drop 1.0 0.0 / ] when ] if
+    ] [
+        (^)
+    ] if ; inline
+
+: (^mod) ( n x y -- z )
+    1 swap [
+        [ dupd * pick mod ] when >r sq over mod r>
+    ] each-bit 2nip ; inline
+
+: (gcd) ( b a x y -- a d )
+    over zero? [
+        2nip
+    ] [
+        swap [ /mod >r over * swapd - r> ] keep (gcd)
+    ] if ;
+
+: gcd ( x y -- a d )
+    0 -rot 1 -rot (gcd) dup 0 < [ neg ] when ; foldable
+
+: lcm ( a b -- c )
+    [ * ] 2keep gcd nip /i ; foldable
+
+: mod-inv ( x n -- y )
+    tuck gcd 1 = [
+        dup 0 < [ + ] [ nip ] if
+    ] [
+        [ "Non-trivial divisor found" throw ] unless
+    ] if ; foldable
+
+: ^mod ( x y n -- z )
+    over 0 < [
+        [ >r neg r> ^mod ] keep mod-inv
+    ] [
+        -rot (^mod)
+    ] if ; foldable
+
+GENERIC: abs ( x -- y ) foldable
+
+GENERIC: absq ( x -- y ) foldable
+
+: ~abs ( x y epsilon -- ? )
+    >r - abs r> < ;
+
+: ~rel ( x y epsilon -- ? )
+    >r [ - abs ] 2keep [ abs ] 2apply + r> * < ;
+
+: ~ ( x y epsilon -- ? )
+    {
+        { [ pick fp-nan? pick fp-nan? or ] [ 3drop f ] }
+        { [ dup zero? ] [ drop number= ] }
+        { [ dup 0 < ] [ ~rel ] }
+        { [ t ] [ ~abs ] }
+    } cond ;
+
+: power-of-2? ( n -- ? )
+    dup 0 < [ drop f ] [ dup 1- bitand zero? ] if ; foldable
+
+: align ( m w -- n ) 1- [ + ] keep bitnot bitand ; inline
+
+: conjugate ( z -- z* ) >rect neg rect> ; inline
+
+: arg ( z -- arg ) >float-rect swap fatan2 ; inline
+
+: >polar ( z -- abs arg )
+    >float-rect [ [ sq ] 2apply + fsqrt ] 2keep swap fatan2 ;
+    inline
+
+: cis ( arg -- z ) dup fcos swap fsin rect> ; inline
+
+: polar> ( abs arg -- z ) cis * ; inline
+
+: ^mag ( w abs arg -- magnitude )
+    >r >r >float-rect swap r> swap fpow r> rot * fexp /f ;
+    inline
+
+: ^theta ( w abs arg -- theta )
+    >r >r >float-rect r> flog * swap r> * + ; inline
+
+M: number (^)
+    swap >polar 3dup ^theta >r ^mag r> polar> ;
+
+: exp ( x -- y ) >rect swap fexp swap polar> ; inline
+
+: log ( x -- y ) >polar swap flog swap rect> ; inline
+
+: cos ( x -- y )
+    >float-rect 2dup
+    fcosh swap fcos * -rot
+    fsinh swap fsin neg * rect> ; foldable
+
+: sec ( x -- y ) cos recip ; inline
+
+: cosh ( x -- y )
+    >float-rect 2dup
+    fcos swap fcosh * -rot
+    fsin swap fsinh * rect> ; foldable
+
+: sech ( x -- y ) cosh recip ; inline
+
+: sin ( x -- y )
+    >float-rect 2dup
+    fcosh swap fsin * -rot
+    fsinh swap fcos * rect> ; foldable
+
+: cosec ( x -- y ) sin recip ; inline
+
+: sinh ( x -- y )
+    >float-rect 2dup
+    fcos swap fsinh * -rot
+    fsin swap fcosh * rect> ; foldable
+
+: cosech ( x -- y ) sinh recip ; inline
+
+: tan ( x -- y ) dup sin swap cos / ; inline
+
+: tanh ( x -- y ) dup sinh swap cosh / ; inline
+
+: cot ( x -- y ) dup cos swap sin / ; inline
+
+: coth ( x -- y ) dup cosh swap sinh / ; inline
+
+: acosh ( x -- y ) dup sq 1- sqrt + log ; inline
+
+: asech ( x -- y ) recip acosh ; inline
+
+: asinh ( x -- y ) dup sq 1+ sqrt + log ; inline
+
+: acosech ( x -- y ) recip asinh ; inline
+
+: atanh ( x -- y ) dup 1+ swap 1- neg / log 2 / ; inline
+
+: acoth ( x -- y ) recip atanh ; inline
+
+: [-1,1]? ( x -- ? )
+    dup complex? [ drop f ] [ abs 1 <= ] if ; inline
+
+: asin ( x -- y )
+    dup [-1,1]? [ >float fasin ] [ i * asinh -i * ] if ; inline
+
+: acos ( x -- y )
+    dup [-1,1]? [ >float facos ] [ asin pi 2 / swap - ] if ;
+    inline
+
+: atan ( x -- y )
+    dup [-1,1]? [ >float fatan ] [ i * atanh i * ] if ; inline
+
+: asec ( x -- y ) recip acos ; inline
+
+: acosec ( x -- y ) recip asin ; inline
+
+: acot ( x -- y ) recip atan ; inline
diff --git a/core/math/functions/summary.txt b/core/math/functions/summary.txt
new file mode 100644 (file)
index 0000000..e2a07e6
--- /dev/null
@@ -0,0 +1 @@
+Elementary complex-valued functions
diff --git a/core/math/integer.factor b/core/math/integer.factor
deleted file mode 100644 (file)
index fb2a7a1..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math
-USING: errors generic kernel kernel-internals sequences
-sequences-internals ;
-
-UNION: integer fixnum bignum ;
-
-: even? ( n -- ? ) 1 bitand zero? ;
-
-: odd? ( n -- ? ) 1 bitand 1 number= ;
-
-: (gcd) ( b a y x -- a d )
-    dup zero? [
-        drop nip
-    ] [
-        tuck /mod >r pick * swap >r swapd - r> r> (gcd)
-    ] if ; inline
-
-: gcd ( x y -- a d )
-    0 1 2swap (gcd) dup 0 < [ neg ] when ; foldable
-
-: (next-power-of-2) ( i n -- n )
-    2dup >= [
-        drop
-    ] [
-        >r 1 shift r> (next-power-of-2)
-    ] if ;
-
-: next-power-of-2 ( m -- n ) 2 swap (next-power-of-2) ;
-
-: d>w/w ( d -- w1 w2 )
-    dup HEX: ffffffff bitand
-    swap -32 shift HEX: ffffffff bitand ;
-
-: w>h/h ( w -- h1 h2 )
-    dup HEX: ffff bitand
-    swap -16 shift HEX: ffff bitand ;
-
-IN: math-internals
-
-: fraction> ( a b -- a/b )
-    dup 1 number= [ drop ] [ (fraction>) ] if ; inline
-
-M: integer /
-    dup zero? [
-        /i
-    ] [
-        dup 0 < [ [ neg ] 2apply ] when
-        2dup gcd nip tuck /i >r /i r> fraction>
-    ] if ;
-
-M: fixnum >fixnum ;
-M: fixnum >bignum fixnum>bignum ;
-M: fixnum >float fixnum>float ;
-
-M: fixnum number= eq? ;
-
-M: fixnum < fixnum< ;
-M: fixnum <= fixnum<= ;
-M: fixnum > fixnum> ;
-M: fixnum >= fixnum>= ;
-
-M: fixnum + fixnum+ ;
-M: fixnum - fixnum- ;
-M: fixnum * fixnum* ;
-M: fixnum /i fixnum/i ;
-M: fixnum mod fixnum-mod ;
-
-M: fixnum /mod fixnum/mod ;
-
-M: fixnum bitand fixnum-bitand ;
-M: fixnum bitor fixnum-bitor ;
-M: fixnum bitxor fixnum-bitxor ;
-M: fixnum shift >fixnum fixnum-shift ;
-
-M: fixnum bitnot fixnum-bitnot ;
-
-M: bignum >fixnum bignum>fixnum ;
-M: bignum >bignum ;
-M: bignum >float bignum>float ;
-
-M: bignum number= bignum= ;
-M: bignum < bignum< ;
-M: bignum <= bignum<= ;
-M: bignum > bignum> ;
-M: bignum >= bignum>= ;
-
-M: bignum + bignum+ ;
-M: bignum - bignum- ;
-M: bignum * bignum* ;
-M: bignum /i bignum/i ;
-M: bignum mod bignum-mod ;
-
-M: bignum /mod bignum/mod ;
-
-M: bignum bitand bignum-bitand ;
-M: bignum bitor bignum-bitor ;
-M: bignum bitxor bignum-bitxor ;
-M: bignum shift >fixnum bignum-shift ;
-
-M: bignum bitnot bignum-bitnot ;
-
-M: integer zero? 0 number= ;
diff --git a/core/math/integer.facts b/core/math/integer.facts
deleted file mode 100644 (file)
index 9ebebc5..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-USING: errors help math math-internals ;
-
-HELP: fixnum
-{ $class-description "The class of fixnums, which are fixed-width integers small enough to fit in a machine cell. Because they are not heap-allocated, fixnums do not have object identity. Equality of tagged pointer bit patterns is actually " { $emphasis "value" } " equality for fixnums." } ;
-
-HELP: >fixnum ( x -- n )
-{ $values { "x" "a real number" } { "n" "a fixnum" } }
-{ $description "Converts a real number to a fixnum, with a possible loss of precision and overflow." } ;
-
-HELP: bignum
-{ $class-description "The class of bignums, which are heap-allocated arbitrary-precision integers." } ;
-
-HELP: >bignum ( x -- n )
-{ $values { "x" "a real number" } { "n" "a bignum" } }
-{ $description "Converts a real number to a bignum, with a possible loss of precision." } ;
-
-HELP: integer
-{ $class-description "The class of integers, which is a disjoint union of fixnums and bignums." } ;
-
-HELP: even?
-{ $values { "n" "an integer" } { "?" "a boolean" } }
-{ $description "Tests if an integer is even." } ;
-
-HELP: odd?
-{ $values { "n" "an integer" } { "?" "a boolean" } }
-{ $description "Tests if an integer is odd." } ;
-
-HELP: gcd
-{ $values { "x" "an integer" } { "y" "an integer" } { "a" "an integer" } { "d" "an integer" } }
-{ $description "Computes the positive greatest common divisor " { $snippet "d" } " of " { $snippet "x" } " and " { $snippet "y" } ", and another value " { $snippet "a" } " satisfying:" { $code "a*y = d mod x" } }
-{ $notes "If " { $snippet "d" } " is 1, then " { $snippet "a" } " is the inverse of " { $snippet "y" } " modulo " { $snippet "x" } "." } ;
-
-HELP: d>w/w
-{ $values { "d" "a 64-bit integer" } { "w1" "a 32-bit integer" } { "w2" "a 32-bit integer" } }
-{ $description "Outputs two integers, the least followed by the most significant 32 bits of the input." } ;
-
-HELP: w>h/h
-{ $values { "w" "a 32-bit integer" } { "h1" "a 16-bit integer" } { "h2" "a 16-bit integer" } }
-{ $description "Outputs two integers, the least followed by the most significant 16 bits of the input." } ;
-
-HELP: next-power-of-2
-{ $values { "m" "a non-negative integer" } { "n" "an integer" } }
-{ $description "Outputs the smallest power of 2 greater than " { $snippet "m" } ". The output value is always at least 1." } ;
-
-
-HELP: fraction>
-{ $values { "a" "an integer" } { "b" "a positive integer" } { "a/b" "a rational number" } }
-{ $description "Creates a new ratio, or outputs the numerator if the denominator is 1. This word does not reduce the fraction to lowest terms, and should not be called directly; use " { $link / } " instead." } ;
-
-! Unsafe primitives
-HELP: fixnum+ ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "an integer" } }
-{ $description "Primitive version of " { $link + } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
-
-HELP: fixnum- ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "an integer" } }
-{ $description "Primitive version of " { $link - } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
-
-HELP: fixnum* ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "an integer" } }
-{ $description "Primitive version of " { $link * } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link * } " instead." } ;
-
-HELP: fixnum/i ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "an integer" } }
-{ $description "Primitive version of " { $link /i } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /i } " instead." } ;
-
-HELP: fixnum-mod ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "a fixnum" } }
-{ $description "Primitive version of " { $link mod } ". The result always fits in a fixnum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link mod } " instead." } ;
-
-HELP: fixnum/mod ( x y -- z w )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "an integer" } { "w" "a fixnum" } }
-{ $description "Primitive version of " { $link /mod } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /mod } " instead." } ;
-
-HELP: fixnum< ( x y -- ? )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link < } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
-
-HELP: fixnum<= ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "an integer" } }
-{ $description "Primitive version of " { $link <= } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
-
-HELP: fixnum> ( x y -- ? )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link > } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
-
-HELP: fixnum>= ( x y -- ? )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link >= } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
-
-HELP: fixnum-bitand ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "a fixnum" } }
-{ $description "Primitive version of " { $link bitand } ". The result always fits in a fixnum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitand } " instead." } ;
-
-HELP: fixnum-bitor ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "a fixnum" } }
-{ $description "Primitive version of " { $link bitor } ". The result always fits in a fixnum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitor } " instead." } ;
-
-HELP: fixnum-bitxor ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "a fixnum" } }
-{ $description "Primitive version of " { $link bitxor } ". The result always fits in a fixnum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitxor } " instead." } ;
-
-HELP: fixnum-bitnot ( x -- y )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } }
-{ $description "Primitive version of " { $link bitnot } ". The result always fits in a fixnum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitnot } " instead." } ;
-
-HELP: fixnum-shift ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "a fixnum" } }
-{ $description "Primitive version of " { $link shift } ". The result may overflow to a bignum." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link shift } " instead." } ;
-
-HELP: fixnum+fast ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "a fixnum" } }
-{ $description "Primitive version of " { $link + } ". Unlike " { $link fixnum+ } ", does not perform an overflow check, so the result may be incorrect." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
-
-HELP: fixnum-fast ( x y -- z )
-{ $values { "x" "a fixnum" } { "y" "a fixnum" } { "z" "a fixnum" } }
-{ $description "Primitive version of " { $link - } ". Unlike " { $link fixnum- } ", does not perform an overflow check, so the result may be incorrect." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
-
-HELP: bignum+ ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link + } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
-
-HELP: bignum- ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link - } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
-
-HELP: bignum* ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link * } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link * } " instead." } ;
-
-HELP: bignum/i ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link /i } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /i } " instead." } ;
-
-HELP: bignum-mod ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link mod } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link mod } " instead." } ;
-
-HELP: bignum/mod ( x y -- z w )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } { "w" "a bignum" } }
-{ $description "Primitive version of " { $link /mod } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /mod } " instead." } ;
-
-HELP: bignum< ( x y -- ? )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link < } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
-
-HELP: bignum<= ( x y -- ? )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link <= } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
-
-HELP: bignum> ( x y -- ? )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link > } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
-
-HELP: bignum>= ( x y -- ? )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link >= } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
-
-HELP: bignum= ( x y -- ? )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "?" "a boolean" } }
-{ $description "Primitive version of " { $link number= } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link number= } " instead." } ;
-
-HELP: bignum-bitand ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link bitand } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitand } " instead." } ;
-
-HELP: bignum-bitor ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link bitor } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitor } " instead." } ;
-
-HELP: bignum-bitxor ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link bitxor } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitxor } " instead." } ;
-
-HELP: bignum-bitnot ( x -- y )
-{ $values { "x" "a bignum" } { "y" "a bignum" } }
-{ $description "Primitive version of " { $link bitnot } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitnot } " instead." } ;
-
-HELP: bignum-shift ( x y -- z )
-{ $values { "x" "a bignum" } { "y" "a bignum" } { "z" "a bignum" } }
-{ $description "Primitive version of " { $link shift } "." }
-{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link shift } " instead." } ;
diff --git a/core/math/integers/authors.txt b/core/math/integers/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/integers/integers-docs.factor b/core/math/integers/integers-docs.factor
new file mode 100644 (file)
index 0000000..3a5fd38
--- /dev/null
@@ -0,0 +1,221 @@
+USING: help.markup help.syntax math math.private math.functions
+math.ratios.private ;
+IN: math.integers
+
+ARTICLE: "integers" "Integers"
+{ $subsection integer }
+"Integers come in two varieties -- fixnums and bignums. Fixnums fit in a machine word and are faster to manipulate; if the result of a fixnum operation is too large to fit in a fixnum, the result is upgraded to a bignum. Here is an example where two fixnums are multiplied yielding a bignum:"
+{ $example "134217728 class ." "fixnum" }
+{ $example "128 class ." "fixnum" }
+{ $example "134217728 128 * ." "17179869184" }
+{ $example "134217728 128 * class ." "bignum" }
+"Integers can be entered using a different base; see " { $link "syntax-numbers" } "."
+$nl
+"Integers can be tested for, and real numbers can be converted to integers:"
+{ $subsection fixnum? }
+{ $subsection bignum? }
+{ $subsection >fixnum }
+{ $subsection >bignum }
+{ $see-also "prettyprint-numbers" "modular-arithmetic" "bitwise-arithmetic" "integer-functions" "syntax-integers" } ;
+
+ABOUT: "integers"
+
+HELP: fixnum
+{ $class-description "The class of fixnums, which are fixed-width integers small enough to fit in a machine cell. Because they are not heap-allocated, fixnums do not have object identity. Equality of tagged pointer bit patterns is actually " { $emphasis "value" } " equality for fixnums." } ;
+
+HELP: >fixnum ( x -- n )
+{ $values { "x" real } { "n" fixnum } }
+{ $description "Converts a real number to a fixnum, with a possible loss of precision and overflow." } ;
+
+HELP: bignum
+{ $class-description "The class of bignums, which are heap-allocated arbitrary-precision integers." } ;
+
+HELP: >bignum ( x -- n )
+{ $values { "x" real } { "n" bignum } }
+{ $description "Converts a real number to a bignum, with a possible loss of precision." } ;
+
+HELP: integer
+{ $class-description "The class of integers, which is a disjoint union of fixnums and bignums." } ;
+
+HELP: even?
+{ $values { "n" integer } { "?" "a boolean" } }
+{ $description "Tests if an integer is even." } ;
+
+HELP: odd?
+{ $values { "n" integer } { "?" "a boolean" } }
+{ $description "Tests if an integer is odd." } ;
+
+HELP: fraction>
+{ $values { "a" integer } { "b" "a positive integer" } { "a/b" rational } }
+{ $description "Creates a new ratio, or outputs the numerator if the denominator is 1. This word does not reduce the fraction to lowest terms, and should not be called directly; use " { $link / } " instead." } ;
+
+! Unsafe primitives
+HELP: fixnum+ ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" integer } }
+{ $description "Primitive version of " { $link + } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
+
+HELP: fixnum- ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" integer } }
+{ $description "Primitive version of " { $link - } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
+
+HELP: fixnum* ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" integer } }
+{ $description "Primitive version of " { $link * } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link * } " instead." } ;
+
+HELP: fixnum/i ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" integer } }
+{ $description "Primitive version of " { $link /i } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /i } " instead." } ;
+
+HELP: fixnum-mod ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link mod } ". The result always fits in a fixnum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link mod } " instead." } ;
+
+HELP: fixnum/mod ( x y -- z w )
+{ $values { "x" fixnum } { "y" fixnum } { "z" integer } { "w" fixnum } }
+{ $description "Primitive version of " { $link /mod } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /mod } " instead." } ;
+
+HELP: fixnum< ( x y -- ? )
+{ $values { "x" fixnum } { "y" fixnum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link < } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
+
+HELP: fixnum<= ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" integer } }
+{ $description "Primitive version of " { $link <= } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
+
+HELP: fixnum> ( x y -- ? )
+{ $values { "x" fixnum } { "y" fixnum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link > } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
+
+HELP: fixnum>= ( x y -- ? )
+{ $values { "x" fixnum } { "y" fixnum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link >= } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
+
+HELP: fixnum-bitand ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link bitand } ". The result always fits in a fixnum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitand } " instead." } ;
+
+HELP: fixnum-bitor ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link bitor } ". The result always fits in a fixnum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitor } " instead." } ;
+
+HELP: fixnum-bitxor ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link bitxor } ". The result always fits in a fixnum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitxor } " instead." } ;
+
+HELP: fixnum-bitnot ( x -- y )
+{ $values { "x" fixnum } { "y" fixnum } }
+{ $description "Primitive version of " { $link bitnot } ". The result always fits in a fixnum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitnot } " instead." } ;
+
+HELP: fixnum-shift ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link shift } ". The result may overflow to a bignum." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link shift } " instead." } ;
+
+HELP: fixnum+fast ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link + } ". Unlike " { $link fixnum+ } ", does not perform an overflow check, so the result may be incorrect." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
+
+HELP: fixnum-fast ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link - } ". Unlike " { $link fixnum- } ", does not perform an overflow check, so the result may be incorrect." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
+
+HELP: fixnum*fast ( x y -- z )
+{ $values { "x" fixnum } { "y" fixnum } { "z" fixnum } }
+{ $description "Primitive version of " { $link * } ". Unlike " { $link fixnum* } ", does not perform an overflow check, so the result may be incorrect." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link * } " instead." } ;
+
+HELP: bignum+ ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link + } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link + } " instead." } ;
+
+HELP: bignum- ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link - } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link - } " instead." } ;
+
+HELP: bignum* ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link * } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link * } " instead." } ;
+
+HELP: bignum/i ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link /i } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /i } " instead." } ;
+
+HELP: bignum-mod ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link mod } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link mod } " instead." } ;
+
+HELP: bignum/mod ( x y -- z w )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } { "w" bignum } }
+{ $description "Primitive version of " { $link /mod } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /mod } " instead." } ;
+
+HELP: bignum< ( x y -- ? )
+{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link < } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
+
+HELP: bignum<= ( x y -- ? )
+{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link <= } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
+
+HELP: bignum> ( x y -- ? )
+{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link > } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
+
+HELP: bignum>= ( x y -- ? )
+{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link >= } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
+
+HELP: bignum= ( x y -- ? )
+{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $description "Primitive version of " { $link number= } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link number= } " instead." } ;
+
+HELP: bignum-bitand ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link bitand } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitand } " instead." } ;
+
+HELP: bignum-bitor ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link bitor } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitor } " instead." } ;
+
+HELP: bignum-bitxor ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link bitxor } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitxor } " instead." } ;
+
+HELP: bignum-bitnot ( x -- y )
+{ $values { "x" bignum } { "y" bignum } }
+{ $description "Primitive version of " { $link bitnot } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link bitnot } " instead." } ;
+
+HELP: bignum-shift ( x y -- z )
+{ $values { "x" bignum } { "y" bignum } { "z" bignum } }
+{ $description "Primitive version of " { $link shift } "." }
+{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link shift } " instead." } ;
diff --git a/core/math/integers/integers-tests.factor b/core/math/integers/integers-tests.factor
new file mode 100644 (file)
index 0000000..55b2c0a
--- /dev/null
@@ -0,0 +1,202 @@
+USING: kernel math namespaces prettyprint math.functions
+math.private continuations tools.test sequences ;
+IN: temporary
+
+[ "-8" ] [ -8 unparse ] unit-test
+
+[ t ] [ 0 fixnum? ] unit-test
+[ t ] [ 31415 number? ] unit-test
+[ t ] [ 31415 >bignum number? ] unit-test
+[ t ] [ 2345621 fixnum? ] unit-test
+
+[ t ] [ 2345621 dup >bignum >fixnum = ] unit-test
+
+[ t ] [ 0 >fixnum 0 >bignum = ] unit-test
+[ f ] [ 0 >fixnum 1 >bignum = ] unit-test
+[ f ] [ 1 >bignum 0 >bignum = ] unit-test
+[ t ] [ 0 >bignum 0 >fixnum = ] unit-test
+
+[ t ] [ 0 >bignum bignum? ] unit-test
+[ f ] [ 0 >fixnum bignum? ] unit-test
+[ f ] [ 0 >fixnum bignum? ] unit-test
+[ t ] [ 0 >fixnum fixnum? ] unit-test
+
+[ -1 ] [ 1 neg ] unit-test
+[ -1 ] [ 1 >bignum neg ] unit-test
+[ 268435456 ] [ -268435456 >fixnum -1 * ] unit-test
+[ 268435456 ] [ -268435456 >fixnum neg ] unit-test
+
+[ 9 3 ] [ 93 10 /mod ] unit-test
+[ 9 3 ] [ 93 >bignum 10 /mod ] unit-test
+
+[ 5 ] [ 2 >bignum 3 >bignum + ] unit-test
+
+[ -10000000001981284352 ] [
+    -10000000000000000000
+    HEX: -100000000 bitand
+] unit-test
+
+[ 9999999997686317056 ] [
+    10000000000000000000
+    HEX: -100000000 bitand
+] unit-test
+
+[ 4294967296 ] [
+    -10000000000000000000
+    HEX: 100000000 bitand
+] unit-test
+
+[ 0 ] [
+    10000000000000000000
+    HEX: 100000000 bitand
+] unit-test
+
+[ -1 ] [ -1 >bignum >fixnum ] unit-test
+
+[ "8589934592" ]
+[ 134217728 dup + dup + dup + dup + dup + dup + unparse ]
+unit-test
+
+[ t ] [ 0 0 ^ fp-nan? ] unit-test
+[ 1 ] [ 10 0 ^ ] unit-test
+[ 1/8 ] [ 1/2 3 ^ ] unit-test
+[ 1/8 ] [ 2 -3 ^ ] unit-test
+[ t ] [ 1 100 shift 2 100 ^ = ] unit-test
+
+[ t ] [ 256 power-of-2? ] unit-test
+[ f ] [ 123 power-of-2? ] unit-test
+
+[ 7 ] [ 255 log2 ] unit-test
+[ 8 ] [ 256 log2 ] unit-test
+[ 8 ] [ 257 log2 ] unit-test
+[ 0 ] [ 1   log2 ] unit-test
+
+[ 7 ] [ 255 >bignum log2 ] unit-test
+[ 8 ] [ 256 >bignum log2 ] unit-test
+[ 8 ] [ 257 >bignum log2 ] unit-test
+[ 0 ] [ 1   >bignum log2 ] unit-test
+
+[ t ] [ BIN: 1101 0 bit? ] unit-test
+[ f ] [ BIN: 1101 1 bit? ] unit-test
+[ t ] [ BIN: 1101 2 bit? ] unit-test
+[ t ] [ BIN: 1101 3 bit? ] unit-test
+[ f ] [ BIN: 1101 4 bit? ] unit-test
+
+[ t ] [ BIN: 1101 >bignum 0 bit? ] unit-test
+[ f ] [ BIN: 1101 >bignum 1 bit? ] unit-test
+[ t ] [ BIN: 1101 >bignum 2 bit? ] unit-test
+[ t ] [ BIN: 1101 >bignum 3 bit? ] unit-test
+[ f ] [ BIN: 1101 >bignum 4 bit? ] unit-test
+
+[ t ] [ BIN: -1101 0 bit? ] unit-test
+[ t ] [ BIN: -1101 1 bit? ] unit-test
+[ f ] [ BIN: -1101 2 bit? ] unit-test
+[ f ] [ BIN: -1101 3 bit? ] unit-test
+[ t ] [ BIN: -1101 4 bit? ] unit-test
+
+[ t ] [ BIN: -1101 >bignum 0 bit? ] unit-test
+[ t ] [ BIN: -1101 >bignum 1 bit? ] unit-test
+[ f ] [ BIN: -1101 >bignum 2 bit? ] unit-test
+[ f ] [ BIN: -1101 >bignum 3 bit? ] unit-test
+[ t ] [ BIN: -1101 >bignum 4 bit? ] unit-test
+
+[ 1 ] [ 7/8 ceiling ] unit-test
+[ 2 ] [ 3/2 ceiling ] unit-test
+[ 0 ] [ -7/8 ceiling ] unit-test
+[ -1 ] [ -3/2 ceiling ] unit-test
+
+[ 2 ] [ 0 next-power-of-2 ] unit-test
+[ 2 ] [ 1 next-power-of-2 ] unit-test
+[ 2 ] [ 2 next-power-of-2 ] unit-test
+[ 4 ] [ 3 next-power-of-2 ] unit-test
+[ 16 ] [ 13 next-power-of-2 ] unit-test
+[ 16 ] [ 16 next-power-of-2 ] unit-test
+
+[ 268435456 ] [ -268435456 >fixnum -1 / ] unit-test
+[ 268435456 ] [ -268435456 >fixnum -1 /i ] unit-test
+[ 268435456 0 ] [ -268435456 >fixnum -1 /mod ] unit-test
+[ 1/268435456 ] [ -1 -268435456 >fixnum / ] unit-test
+[ 0 ] [ -1 -268435456 >fixnum /i ] unit-test
+[ 0 -1 ] [ -1 -268435456 >fixnum /mod ] unit-test
+[ 14355 ] [ 1591517158873146351817850880000000 32769 mod ] unit-test
+
+[ -351382792 ] [ -43922849 3 shift ] unit-test
+
+[ t ] [ 0 zero? ] unit-test
+[ f ] [ 30 zero? ] unit-test
+[ t ] [ 0 >bignum zero? ] unit-test
+
+[ 4294967280 ] [ 268435455 >fixnum 16 fixnum* ] unit-test
+
+[ 23603949310011464311086123800853779733506160743636399259558684142844552151041 ]
+[
+    1957739506503920732625800353008742584087090810400921800808997218266517557963281171906190947801528098188887586755474449585677502695226712388326288208691204
+    79562815144503850065234921197651376510595262628033069372760833939060637564931
+    bignum-mod
+] unit-test
+
+! We don't care if this fails or returns 0 (its CPU-specific)
+! as long as it doesn't crash
+[ ] [ [ 0 0 /i ] catch clear ] unit-test
+[ ] [ [ 100000000000000000 0 /i ] catch clear ] unit-test
+
+[ -2 ] [ 1 bitnot ] unit-test
+[ -2 ] [ 1 >bignum bitnot ] unit-test
+[ -2 ] [ 1 >bignum bitnot ] unit-test
+[ 0 ] [ 123 dup bitnot bitand ] unit-test
+[ 0 ] [ 123 >bignum dup bitnot bitand ] unit-test
+[ 0 ] [ 123 dup bitnot >bignum bitand ] unit-test
+[ 0 ] [ 123 dup bitnot bitand >bignum ] unit-test
+[ -1 ] [ 123 dup bitnot bitor ] unit-test
+[ -1 ] [ 123 >bignum dup bitnot bitor ] unit-test
+[ -1 ] [ 123 dup bitnot >bignum bitor ] unit-test
+[ -1 ] [ 123 dup bitnot bitor >bignum ] unit-test
+[ -1 ] [ 123 dup bitnot bitxor ] unit-test
+[ -1 ] [ 123 >bignum dup bitnot bitxor ] unit-test
+[ -1 ] [ 123 dup bitnot >bignum bitxor ] unit-test
+[ -1 ] [ 123 dup bitnot bitxor >bignum ] unit-test
+[ 4 ] [ 4 7 bitand ] unit-test
+
+[ 256 ] [ 65536 -8 shift ] unit-test
+[ 256 ] [ 65536 >bignum -8 shift ] unit-test
+[ 256 ] [ 65536 -8 >bignum shift ] unit-test
+[ 256 ] [ 65536 >bignum -8 >bignum shift ] unit-test
+[ 4294967296 ] [ 1 16 shift 16 shift ] unit-test
+[ 4294967296 ] [ 1 32 shift ] unit-test
+[ 1267650600228229401496703205376 ] [ 1 100 shift ] unit-test
+
+[ t ] [ 1 27 shift fixnum? ] unit-test
+
+[ t ] [
+    t
+    [ 27 28 29 30 31 32 59 60 61 62 63 64 ]
+    [
+        1 over shift swap 1 >bignum swap shift = and
+    ] each
+] unit-test
+
+[ t ] [
+    t
+    [ 27 28 29 30 31 32 59 60 61 62 63 64 ]
+    [
+        -1 over shift swap -1 >bignum swap shift = and
+    ] each
+] unit-test
+
+[ 12 ] [ 11 4 align ] unit-test
+[ 12 ] [ 12 4 align ] unit-test
+[ 10 ] [ 10 2 align ] unit-test
+[ 14 ] [ 13 2 align ] unit-test
+[ 11 ] [ 11 1 align ] unit-test
+
+[ HEX: 332211 ] [
+    B{ HEX: 11 HEX: 22 HEX: 33 } byte-array>bignum
+] unit-test
+
+[ HEX: 7a2c793b2ff08554 ] [
+    B{ HEX: 54 HEX: 85 HEX: f0 HEX: 2f HEX: 3b HEX: 79 HEX: 2c HEX: 7a } byte-array>bignum
+] unit-test
+
+[ HEX: 988a259c3433f237 ] [
+    B{ HEX: 37 HEX: f2 HEX: 33 HEX: 34 HEX: 9c HEX: 25 HEX: 8a HEX: 98 } byte-array>bignum
+] unit-test
diff --git a/core/math/integers/integers.factor b/core/math/integers/integers.factor
new file mode 100644 (file)
index 0000000..32bbcad
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel kernel.private sequences
+sequences.private math math.private combinators ;
+IN: math.integers.private
+
+M: integer hashcode* nip >fixnum ;
+M: integer <=> - ;
+
+M: integer numerator ;
+M: integer denominator drop 1 ;
+
+M: fixnum >fixnum ;
+M: fixnum >bignum fixnum>bignum ;
+
+M: fixnum number= eq? ;
+
+M: fixnum < fixnum< ;
+M: fixnum <= fixnum<= ;
+M: fixnum > fixnum> ;
+M: fixnum >= fixnum>= ;
+
+M: fixnum + fixnum+ ;
+M: fixnum - fixnum- ;
+M: fixnum * fixnum* ;
+M: fixnum /i fixnum/i ;
+M: fixnum mod fixnum-mod ;
+
+M: fixnum /mod fixnum/mod ;
+
+M: fixnum bitand fixnum-bitand ;
+M: fixnum bitor fixnum-bitor ;
+M: fixnum bitxor fixnum-bitxor ;
+M: fixnum shift >fixnum fixnum-shift ;
+
+M: fixnum bitnot fixnum-bitnot ;
+
+M: fixnum bit? 2^ bitand 0 > ;
+
+: (fixnum-log2) ( accum n -- accum )
+    dup 1 number= [ drop ] [ >r 1+ r> 2/ (fixnum-log2) ] if ;
+    inline
+
+M: fixnum (log2) 0 swap (fixnum-log2) ;
+
+M: bignum >fixnum bignum>fixnum ;
+M: bignum >bignum ;
+
+M: bignum number= bignum= ;
+M: bignum < bignum< ;
+M: bignum <= bignum<= ;
+M: bignum > bignum> ;
+M: bignum >= bignum>= ;
+
+M: bignum + bignum+ ;
+M: bignum - bignum- ;
+M: bignum * bignum* ;
+M: bignum /i bignum/i ;
+M: bignum mod bignum-mod ;
+
+M: bignum /mod bignum/mod ;
+
+M: bignum bitand bignum-bitand ;
+M: bignum bitor bignum-bitor ;
+M: bignum bitxor bignum-bitxor ;
+M: bignum shift bignum-shift ;
+
+M: bignum bitnot bignum-bitnot ;
+M: bignum bit? bignum-bit? ;
+M: bignum (log2) bignum-log2 ;
+
+M: integer zero? 0 number= ;
diff --git a/core/math/integers/summary.txt b/core/math/integers/summary.txt
new file mode 100644 (file)
index 0000000..88bd2b4
--- /dev/null
@@ -0,0 +1 @@
+Integer implementation
diff --git a/core/math/intervals/authors.txt b/core/math/intervals/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/intervals/intervals-docs.factor b/core/math/intervals/intervals-docs.factor
new file mode 100644 (file)
index 0000000..09afded
--- /dev/null
@@ -0,0 +1,277 @@
+USING: help.markup help.syntax math ;
+IN: math.intervals
+
+ARTICLE: "math-intervals-new" "Creating intervals"
+"Standard constructors:"
+{ $subsection [a,b] }
+{ $subsection (a,b) }
+{ $subsection [a,b) }
+{ $subsection (a,b] }
+"One-point interval constructor:"
+{ $subsection [a,a] }
+"Open-ended interval constructors:"
+{ $subsection [-inf,a] }
+{ $subsection [-inf,a) }
+{ $subsection [a,inf] }
+{ $subsection (a,inf] }
+"Another constructor:"
+{ $subsection points>interval } ;
+
+ARTICLE: "math-intervals-arithmetic" "Interval arithmetic"
+"Binary operations on intervals:"
+{ $subsection interval+ }
+{ $subsection interval- }
+{ $subsection interval* }
+{ $subsection interval/ }
+{ $subsection interval/i }
+{ $subsection interval-shift }
+{ $subsection interval-min }
+{ $subsection interval-max }
+"Unary operations on intervals:"
+{ $subsection interval-1+ }
+{ $subsection interval-1- }
+{ $subsection interval-neg }
+{ $subsection interval-bitnot }
+{ $subsection interval-recip }
+{ $subsection interval-2/ } ;
+
+ARTICLE: "math-intervals-sets" "Set-theoretic operations on intervals"
+{ $subsection interval-contains? }
+{ $subsection interval-subset? }
+{ $subsection interval-intersect }
+{ $subsection interval-union }
+{ $subsection interval-closure }
+{ $subsection integral-closure } ;
+
+ARTICLE: "math-intervals-compare" "Comparing intervals"
+{ $subsection interval< }
+{ $subsection interval<= }
+{ $subsection interval> }
+{ $subsection interval>= }
+{ $subsection assume< }
+{ $subsection assume<= }
+{ $subsection assume> }
+{ $subsection assume>= } ;
+
+ARTICLE: "math-intervals" "Intervals"
+"Interval arithmetic is performed on ranges of real numbers, rather than exact values. It is used by the Factor compiler to convert arbitrary-precision arithmetic to machine arithmetic, by inferring bounds for integer calculations."
+$nl
+"The class of intervals:"
+{ $subsection interval }
+{ $subsection interval? }
+{ $subsection "math-intervals-new" }
+{ $subsection "math-intervals-arithmetic" }
+{ $subsection "math-intervals-sets" }
+{ $subsection "math-intervals-compare" } ;
+
+ABOUT: "math-intervals"
+
+HELP: interval
+{ $class-description "An interval represents a set of real numbers between two endpoints; the endpoints can either be included or excluded from the interval."
+$nl
+"The " { $link interval-from } " and " { $link interval-to } " slots store endpoints, represented as arrays of the shape " { $snippet "{ number included? }" } "."
+$nl
+"Intervals are created by calling " { $link [a,b] } ", " { $link (a,b) } ", " { $link [a,b) } ", " { $link (a,b] } " or " { $link [a,a] } "." } ;
+
+HELP: <interval> ( from to -- interval )
+{ $values { "from" "a " { $snippet "{ point included? }" } " pair" } { "to" "a " { $snippet "{ point included? }" } " pair" } { "interval" interval } }
+{ $description "Creates a new interval. Usually it is more convenient to create intervals using one of the following words instead:"
+    { $list
+        { $link [a,b] }
+        { $link (a,b) }
+        { $link [a,b) }
+        { $link (a,b] }
+        { $link [a,inf] }
+        { $link (a,inf] }
+        { $link [-inf,a) }
+        { $link [-inf,a] }
+    }
+} ;
+
+HELP: [a,b]
+{ $values { "a" real } { "b" real } { "interval" interval } }
+{ $description "Creates a new interval that includes both endpoints." } ;
+
+HELP: (a,b)
+{ $values { "a" real } { "b" real } { "interval" interval } }
+{ $description "Creates a new interval that excludes both endpoints." } ;
+
+HELP: [a,b)
+{ $values { "a" real } { "b" real } { "interval" interval } }
+{ $description "Creates a new interval that includes the lower endpoint and excludes the upper endpoint." } ;
+
+HELP: (a,b]
+{ $values { "a" real } { "b" real } { "interval" interval } }
+{ $description "Creates a new interval that excludes the lower endpoint and includes the upper endpoint." } ;
+
+HELP: [a,a]
+{ $values { "a" real } { "interval" interval } }
+{ $description "Creates a new interval consisting of a single point." } ;
+
+HELP: [-inf,a]
+{ $values { "a" real } { "interval" interval } }
+{ $description "Creates a new interval containing all real numbers less than or equal to " { $snippet "a" } ", together with negative infinity." } ;
+
+HELP: [-inf,a)
+{ $values { "a" real } { "interval" interval } }
+{ $description "Creates a new interval containing all real numbers less than " { $snippet "a" } ", together with negative infinity." } ;
+
+HELP: [a,inf]
+{ $values { "a" real } { "interval" interval } }
+{ $description "Creates a new interval containing all real numbers greater than or equal to " { $snippet "a" } ", together with positive infinity." } ;
+
+HELP: (a,inf]
+{ $values { "a" real } { "interval" interval } }
+{ $description "Creates a new interval containing all real numbers greater than " { $snippet "a" } ", together with positive infinity." } ;
+
+HELP: interval+
+{ $values { "i1" interval } { "i2" interval } { "i3" interval } }
+{ $description "Adds two intervals." } ;
+
+HELP: interval-
+{ $values { "i1" interval } { "i2" interval } { "i3" interval } }
+{ $description "Subtracts " { $snippet "i2" } " from " { $snippet "i1" } "." } ;
+
+HELP: interval*
+{ $values { "i1" interval } { "i2" interval } { "i3" interval } }
+{ $description "Multiplies two intervals." } ;
+
+HELP: interval-shift
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Shifts " { $snippet "i1" } " to the left by " { $snippet "i2" } " bits. Outputs " { $link f } " if the endpoints of either " { $snippet "i1" } " or " { $snippet "i2" } " are not integers." } ;
+
+HELP: interval-max
+{ $values { "i1" interval } { "i2" interval } { "i3" interval } }
+{ $description "Outputs the interval values obtained by lifting the " { $link max } " word to " { $snippet "i1" } " and " { $snippet "i2" } "." } ;
+
+HELP: interval-min
+{ $values { "i1" interval } { "i2" interval } { "i3" interval } }
+{ $description "Outputs the interval values obtained by lifting the " { $link min } " word to " { $snippet "i1" } " and " { $snippet "i2" } "." } ;
+
+HELP: interval-1+
+{ $values { "i1" interval } { "i2" interval } }
+{ $description "Adds 1 to an interval." } ;
+
+HELP: interval-1-
+{ $values { "i1" interval } { "i2" interval } }
+{ $description "Subtracts 1 from an interval." } ;
+
+HELP: interval-neg
+{ $values { "i1" interval } { "i2" interval } }
+{ $description "Negates an interval." } ;
+
+HELP: interval-intersect
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval  } " or " { $link f } } }
+{ $description "Outputs the set-theoretic intersection of " { $snippet "i1" } " and " { $snippet "i2" } ". If " { $snippet "i1" } " and " { $snippet "i2" } " do not intersect, outputs " { $link f } "." } ;
+
+HELP: interval-union
+{ $values { "i1" interval } { "i2" interval } { "i3" interval } }
+{ $description "Outputs the smallest interval containing the set-theoretic union of " { $snippet "i1" } " and " { $snippet "i2" } " (the union itself may not be an interval)." } ;
+
+HELP: interval-subset?
+{ $values { "i1" interval } { "i2" interval } { "?" "a boolean" } }
+{ $description "Tests if every point of " { $snippet "i1" } " is contained in " { $snippet "i2" } "." } ;
+
+HELP: interval-contains?
+{ $values { "x" real } { "int" interval } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "x" } " is contained in " { $snippet "int" } "." } ;
+
+HELP: interval-closure
+{ $values { "i1" interval } { "i2" interval } }
+{ $description "Outputs the smallest closed interval containing the endpoints of " { $snippet "i1" } "." } ;
+
+HELP: interval/
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Divides " { $snippet "i1" } " by " { $snippet "i2" } ", using " { $link / } " to perform the division. Outputs " { $link f } " if " { $snippet "i2" } " contains points arbitrarily close to zero." } ;
+
+HELP: interval/i
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Divides " { $snippet "i1" } " by " { $snippet "i2" } ", using " { $link /i } " to perform the division. Outputs " { $link f } " if " { $snippet "i2" } " contains points arbitrarily close to zero." } ;
+
+HELP: interval-recip
+{ $values { "i1" interval } { "i2" interval } }
+{ $description "Outputs the reciprocal of an interval. Outputs " { $link f } " if " { $snippet "i1" } " contains points arbitrarily close to zero." } ;
+
+HELP: interval-2/
+{ $values { "i1" interval } { "i2" interval } }
+{ $description "Shifts an interval to the right by one bit." } ;
+
+HELP: interval-bitnot
+{ $values { "i1" interval } { "i2" interval } }
+{ $description "Computes the bitwise complement of the interval." } ;
+
+HELP: points>interval
+{ $values { "seq" "a sequence of " { $snippet "{ point included? }" } " pairs" } { "interval" interval } }
+{ $description "Outputs the smallest interval containing all of the endpoints." }
+;
+
+HELP: interval-shift-safe
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Shifts " { $snippet "i1" } " to the left by " { $snippet "i2" } " bits. Outputs " { $link f } " if the endpoints of either " { $snippet "i1" } " or " { $snippet "i2" } " are not integers, or if the endpoints of " { $snippet "i2" } " are so large that the resulting interval will consume too much memory." } ;
+
+HELP: incomparable
+{ $description "Output value from " { $link interval<= } ", " { $link interval< } ", " { $link interval>= } " and " { $link interval> } " in the case where the result of the comparison is ambiguous." } ;
+
+HELP: interval<=
+{ $values { "int" interval } { "n" real } { "?" "a boolean or " { $link incomparable } } }
+{ $description "Compares " { $snippet "int" } " with " { $snippet "n" } ", and outputs one of the following:"
+    { $list
+        { { $link t } " if every point in " { $snippet "int" } " is less than or equal to " { $snippet "n" } }
+        { { $link f } " if every point in " { $snippet "int" } " is greater than " { $snippet "n" } }
+        { { $link incomparable } " if neither of the above conditions hold" }
+    }
+} ;
+
+HELP: interval<
+{ $values { "int" interval } { "n" real } { "?" "a boolean or " { $link incomparable } } }
+{ $description "Compares " { $snippet "int" } " with " { $snippet "n" } ", and outputs one of the following:"
+    { $list
+        { { $link t } " if every point in " { $snippet "int" } " is less than " { $snippet "n" } }
+        { { $link f } " if every point in " { $snippet "int" } " is greater than or equal to " { $snippet "n" } }
+        { { $link incomparable } " if neither of the above conditions hold" }
+    }
+} ;
+
+HELP: interval>=
+{ $values { "int" interval } { "n" real } { "?" "a boolean or " { $link incomparable } } }
+{ $description "Compares " { $snippet "int" } " with " { $snippet "n" } ", and outputs one of the following:"
+    { $list
+        { { $link t } " if every point in " { $snippet "int" } " is greater than or equal to " { $snippet "n" } }
+        { { $link f } " if every point in " { $snippet "int" } " is less than " { $snippet "n" } }
+        { { $link incomparable } " if neither of the above conditions hold" }
+    }
+} ;
+
+HELP: interval>
+{ $values { "int" interval } { "n" real } { "?" "a boolean or " { $link incomparable } } }
+{ $description "Compares " { $snippet "int" } " with " { $snippet "n" } ", and outputs one of the following:"
+    { $list
+        { { $link t } " if every point in " { $snippet "int" } " is greater than " { $snippet "n" } }
+        { { $link f } " if every point in " { $snippet "int" } " is less than or equal to " { $snippet "n" } }
+        { { $link incomparable } " if neither of the above conditions hold" }
+    }
+} ;
+
+HELP: interval>points
+{ $values { "int" interval } { "from" "a " { $snippet "{ point included? }" } " pair" } { "to" "a " { $snippet "{ point included? }" } " pair" } }
+{ $description "Outputs both endpoints of the interval." } ;
+
+HELP: assume<
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Outputs the interval consisting of points from " { $snippet "i1" } " which are less than all points in " { $snippet "i2" } ". If the resulting interval is empty, outputs " { $link f } "." } ;
+
+HELP: assume<=
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Outputs the interval consisting of points from " { $snippet "i1" } " which are less or equal to all points in " { $snippet "i2" } ". If the resulting interval is empty, outputs " { $link f } "." } ;
+
+HELP: assume>
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Outputs the interval consisting of points from " { $snippet "i1" } " which are greater than all points in " { $snippet "i2" } ". If the resulting interval is empty, outputs " { $link f } "." } ;
+
+HELP: assume>=
+{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $description "Outputs the interval consisting of points from " { $snippet "i1" } " which are greater than or equal to all points in " { $snippet "i2" } ". If the resulting interval is empty, outputs " { $link f } "." } ;
+
+HELP: integral-closure
+{ $values { "i1" "an " { $link interval } " with integer end-points" } { "i2" "a closed " { $link interval } " with integer end-points" } }
+{ $description "Outputs a closed interval which is equal as a set to " { $snippet "i1" } ", when " { $snippet "i1" } " is viewed as an interval over in integers (that is, a discrete set)." } ;
diff --git a/core/math/intervals/intervals-tests.factor b/core/math/intervals/intervals-tests.factor
new file mode 100644 (file)
index 0000000..fe31225
--- /dev/null
@@ -0,0 +1,144 @@
+USING: math.intervals kernel sequences words math arrays
+prettyprint tools.test random ;
+IN: temporary
+
+[ T{ interval f { 1 t } { 2 t } } ] [ 1 2 [a,b] ] unit-test
+
+[ T{ interval f { 1 t } { 2 f } } ] [ 1 2 [a,b) ] unit-test
+
+[ T{ interval f { 1 f } { 2 f } } ] [ 1 2 (a,b) ] unit-test
+
+[ T{ interval f { 1 f } { 2 t } } ] [ 1 2 (a,b] ] unit-test
+
+[ T{ interval f { 1 t } { 1 t } } ] [ 1 [a,a] ] unit-test
+
+[ t ] [ { 3 t } { 3 f } endpoint< ] unit-test
+[ t ] [ { 2 f } { 3 f } endpoint< ] unit-test
+[ f ] [ { 3 f } { 3 t } endpoint< ] unit-test
+[ t ] [ { 4 f } { 3 t } endpoint> ] unit-test
+[ f ] [ { 3 f } { 3 t } endpoint> ] unit-test
+
+[ t ] [
+    1 2 [a,b] -3 3 [a,b] interval+ -2 5 [a,b] =
+] unit-test
+
+[ t ] [
+    1 2 [a,b] -3 3 (a,b) interval+ -2 5 (a,b) =
+] unit-test
+
+[ t ] [
+    1 2 [a,b] 0 1 [a,b] interval- 0 2 [a,b] =
+] unit-test
+
+[ t ] [
+    1 2 [a,b] 0 4 [a,b] interval* 0 8 [a,b] =
+] unit-test
+
+[ t ] [
+    1 2 [a,b] -4 4 [a,b] interval* -8 8 [a,b] =
+] unit-test
+
+[ t ] [
+    1 2 [a,b] -1/2 1/2 [a,b] interval* -1 1 [a,b] =
+] unit-test
+
+[ t ] [
+    1 2 [a,b] -1/2 1/2 (a,b] interval* -1 1 (a,b] =
+] unit-test
+
+[ t ] [
+    -1 1 [a,b] -1 1 (a,b] interval* -1 1 [a,b] =
+] unit-test
+
+[ t ] [
+    0 1 (a,b) 0 1 [a,b] interval-union 0 1 [a,b] =
+] unit-test
+
+[ t ] [
+    0 1 (a,b) 1 2 [a,b] interval-union 0 2 (a,b] =
+] unit-test
+
+[ f ] [ 0 1 (a,b) f interval-union ] unit-test
+
+[ t ] [
+    0 1 (a,b) 0 1 [a,b] interval-intersect 0 1 (a,b) =
+] unit-test
+
+[ f ] [ 0 5 [a,b] -1 [a,a] interval-intersect ] unit-test
+
+[ f ] [ 0 5 (a,b] 0 [a,a] interval-intersect ] unit-test
+
+[ t ] [
+    0 1 (a,b) 0 1 [a,b] interval-subset?
+] unit-test
+
+[ f ] [
+    0 0 1 (a,b) interval-contains?
+] unit-test
+
+[ t ] [
+    1/2 0 1 (a,b) interval-contains?
+] unit-test
+
+[ f ] [
+    1 0 1 (a,b) interval-contains?
+] unit-test
+
+[ f ] [ -1 1 (a,b) -1 1 (a,b) interval/ ] unit-test
+
+[ f ] [ -1 1 (a,b) 0 1 (a,b) interval/ ] unit-test
+
+[ t ] [
+    -1 1 (a,b) 1/2 1 (a,b) interval/ -2 2 (a,b) =
+] unit-test
+
+[ t ] [ 0 5 [a,b] 5 interval<= ] unit-test
+
+[ incomparable ] [ 0 5 [a,b] 5 interval< ] unit-test
+
+[ t ] [ 0 5 [a,b) 5 interval< ] unit-test
+
+[ f ] [ 0 5 [a,b] -1 interval< ] unit-test
+
+[ incomparable ] [ 0 5 [a,b] 1 interval< ] unit-test
+
+[ t ] [ -1 1 (a,b) -1 interval> ] unit-test
+
+[ t ] [ -1 1 (a,b) -1 interval>= ] unit-test
+
+[ f ] [ -1 1 (a,b) -1 interval< ] unit-test
+
+[ f ] [ -1 1 (a,b) -1 interval<= ] unit-test
+
+[ t ] [ -1 1 (a,b] 1 interval<= ] unit-test
+
+! Interval random tester
+: random-element ( interval -- n )
+    dup interval-to first swap interval-from first tuck -
+    random + ;
+
+: random-interval ( -- interval )
+    1000 random dup 1 1000 random + + [a,b] ;
+
+: random-op
+    {
+        { + interval+ }
+        { - interval- }
+        { * interval* }
+        { / interval/ }
+        { /i interval/i }
+        { shift interval-shift }
+        { min interval-min }
+        { max interval-max }
+    } random ;
+
+: interval-test
+    random-interval random-interval random-op
+    0 pick interval-contains? over first { / /i } member? and [
+        3drop t
+    ] [
+        [ >r [ random-element ] 2apply r> first execute ] 3keep
+        second execute interval-contains?
+    ] if ;
+
+[ t ] [ 1000 [ drop interval-test ] all? ] unit-test
diff --git a/core/math/intervals/intervals.factor b/core/math/intervals/intervals.factor
new file mode 100644 (file)
index 0000000..26efbef
--- /dev/null
@@ -0,0 +1,201 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+! Based on Slate's src/unfinished/interval.slate by Brian Rice.
+USING: kernel sequences arrays math combinators ;
+IN: math.intervals
+
+TUPLE: interval from to ;
+
+C: <interval> interval
+
+: open-point f 2array ;
+
+: closed-point t 2array ;
+
+: [a,b] ( a b -- interval )
+    >r closed-point r> closed-point <interval> ;
+
+: (a,b) ( a b -- interval )
+    >r open-point r> open-point <interval> ;
+
+: [a,b) ( a b -- interval )
+    >r closed-point r> open-point <interval> ;
+
+: (a,b] ( a b -- interval )
+    >r open-point r> closed-point <interval> ;
+
+: [a,a] ( a -- interval ) closed-point dup <interval> ;
+
+: [-inf,a] ( a -- interval ) -1./0. swap [a,b] ;
+
+: [-inf,a) ( a -- interval ) -1./0. swap [a,b) ;
+
+: [a,inf] ( a -- interval ) 1./0. [a,b] ;
+
+: (a,inf] ( a -- interval ) 1./0. (a,b] ;
+
+: compare-endpoints ( p1 p2 quot -- ? )
+    >r over first over first r> call [
+        2drop t
+    ] [
+        over first over first = [
+            swap second swap second not or
+        ] [
+            2drop f
+        ] if
+    ] if ; inline
+
+: endpoint< ( p1 p2 -- ? ) [ < ] compare-endpoints ;
+
+: endpoint<= ( p1 p2 -- ? ) [ endpoint< ] 2keep = or ;
+
+: endpoint> ( p1 p2 -- ? ) [ > ] compare-endpoints ;
+
+: endpoint>= ( p1 p2 -- ? ) [ endpoint> ] 2keep = or ;
+
+: endpoint-min ( p1 p2 -- p3 ) [ endpoint< ] most ;
+
+: endpoint-max ( p1 p2 -- p3 ) [ endpoint> ] most ;
+
+: interval>points ( int -- from to )
+    dup interval-from swap interval-to ;
+
+: points>interval ( seq -- interval )
+    dup first
+    [ [ endpoint-min ] reduce ] 2keep
+    [ endpoint-max ] reduce <interval> ;
+
+: (interval-op) ( p1 p2 quot -- p3 )
+    pick pick >r >r
+    >r >r first r> first r> call
+    r> second r> second and 2array ; inline
+
+: interval-op ( i1 i2 quot -- i3 )
+    pick interval-from pick interval-from pick (interval-op) >r
+    pick interval-to pick interval-from pick (interval-op) >r
+    pick interval-to pick interval-to pick (interval-op) >r
+    pick interval-from pick interval-to pick (interval-op) >r
+    3drop r> r> r> r> 4array points>interval ; inline
+
+: interval+ ( i1 i2 -- i3 ) [ + ] interval-op ;
+
+: interval- ( i1 i2 -- i3 ) [ - ] interval-op ;
+
+: interval* ( i1 i2 -- i3 ) [ * ] interval-op ;
+
+: interval-integer-op ( i1 i2 quot -- i3 )
+    >r 2dup
+    [ interval>points [ first integer? ] 2apply and ] 2apply and
+    r> [ 2drop f ] if ; inline
+
+: interval-shift ( i1 i2 -- i3 )
+    [ [ shift ] interval-op ] interval-integer-op ;
+
+: interval-shift-safe ( i1 i2 -- i3 )
+    dup interval-to first 100 > [
+        2drop f
+    ] [
+        interval-shift
+    ] if ;
+
+: interval-max ( i1 i2 -- i3 ) [ max ] interval-op ;
+
+: interval-min ( i1 i2 -- i3 ) [ min ] interval-op ;
+
+: interval-1+ ( i1 -- i2 ) 1 [a,a] interval+ ;
+
+: interval-1- ( i1 -- i2 ) -1 [a,a] interval+ ;
+
+: interval-neg ( i1 -- i2 ) -1 [a,a] interval* ;
+
+: interval-bitnot ( i1 -- i2 ) interval-neg interval-1- ;
+
+: make-interval ( from to -- int )
+    over first over first {
+        { [ 2dup > ] [ 2drop 2drop f ] }
+        { [ 2dup = ] [
+            2drop over second over second and
+            [ <interval> ] [ 2drop f ] if
+        ] }
+        { [ t ] [ 2drop <interval> ] }
+    } cond ;
+
+: interval-intersect ( i1 i2 -- i3 )
+    2dup and [
+        [ interval>points ] 2apply swapd
+        [ swap endpoint> ] most
+        >r [ swap endpoint< ] most r>
+        make-interval
+    ] [
+        or
+    ] if ;
+
+: interval-union ( i1 i2 -- i3 )
+    2dup and [
+        [ interval>points 2array ] 2apply append points>interval
+    ] [
+        2drop f
+    ] if ;
+
+: interval-subset? ( i1 i2 -- ? )
+    dupd interval-intersect = ;
+
+: interval-contains? ( x int -- ? )
+    >r [a,a] r> interval-subset? ;
+
+: interval-closure ( i1 -- i2 )
+    interval>points [ first ] 2apply [a,b] ;
+
+: interval-division-op ( i1 i2 quot -- i3 )
+    >r 0 over interval-closure interval-contains?
+    [ 2drop f ] r> if ; inline
+
+: interval/ ( i1 i2 -- i3 )
+    [ [ / ] interval-op ] interval-division-op ;
+
+: interval/i ( i1 i2 -- i3 )
+    [
+        [ [ /i ] interval-op ] interval-integer-op
+    ] interval-division-op ;
+
+: interval-recip ( i1 -- i2 ) 1 [a,a] swap interval/ ;
+
+: interval-2/ ( i1 -- i2 ) -1 [a,a] interval-shift ;
+
+SYMBOL: incomparable
+
+: interval-compare ( int n quot -- ? )
+    >r dupd r> call interval-intersect dup [
+        = t incomparable ?
+    ] [
+        2drop f
+    ] if ; inline
+
+: interval< ( int n -- ? )
+    [ [-inf,a) ] interval-compare ; inline
+
+: interval<= ( int n -- ? )
+    [ [-inf,a] ] interval-compare ; inline
+
+: interval> ( int n -- ? )
+    [ (a,inf] ] interval-compare ; inline
+
+: interval>= ( int n -- ? )
+    [ [a,inf] ] interval-compare ; inline
+
+: assume< ( i1 i2 -- i3 )
+    interval-to first [-inf,a) interval-intersect ;
+
+: assume<= ( i1 i2 -- i3 )
+    interval-to first [-inf,a] interval-intersect ;
+
+: assume> ( i1 i2 -- i3 )
+    interval-from first (a,inf] interval-intersect ;
+
+: assume>= ( i1 i2 -- i3 )
+    interval-to first [a,inf] interval-intersect ;
+
+: integral-closure ( i1 -- i2 )
+    dup interval-from first2 [ 1+ ] unless
+    swap interval-to first2 [ 1- ] unless
+    [a,b] ;
diff --git a/core/math/intervals/summary.txt b/core/math/intervals/summary.txt
new file mode 100644 (file)
index 0000000..5a8f737
--- /dev/null
@@ -0,0 +1 @@
+Interval arithmetic
diff --git a/core/math/libm.factor b/core/math/libm.factor
deleted file mode 100644 (file)
index be5ce35..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-DEFER: alien-invoke
-
-IN: math-internals
-
-: facos ( x -- y )
-    "double" "libm" "acos" { "double" } alien-invoke ;
-    foldable
-
-: fasin ( x -- y )
-    "double" "libm" "asin" { "double" } alien-invoke ;
-    foldable
-
-: fatan ( x -- y )
-    "double" "libm" "atan" { "double" } alien-invoke ;
-    foldable
-
-: fatan2 ( x y -- z )
-    "double" "libm" "atan2" { "double" "double" } alien-invoke ;
-    foldable
-
-: fcos ( x -- y )
-    "double" "libm" "cos" { "double" } alien-invoke ;
-    foldable
-
-: fexp ( x -- y )
-    "double" "libm" "exp" { "double" } alien-invoke ;
-    foldable
-
-: fcosh ( x -- y )
-    "double" "libm" "cosh" { "double" } alien-invoke ;
-    foldable
-
-: flog ( x -- y )
-    "double" "libm" "log" { "double" } alien-invoke ;
-    foldable
-
-: fpow ( x y -- z )
-    "double" "libm" "pow" { "double" "double" } alien-invoke ;
-    foldable
-
-: fsin ( x -- y )
-    "double" "libm" "sin" { "double" } alien-invoke ;
-    foldable
-
-: fsinh ( x -- y )
-    "double" "libm" "sinh" { "double" } alien-invoke ;
-    foldable
-
-: fsqrt ( x -- y )
-    "double" "libm" "sqrt" { "double" } alien-invoke ;
-    foldable
diff --git a/core/math/libm/authors.txt b/core/math/libm/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/libm/libm-docs.factor b/core/math/libm/libm-docs.factor
new file mode 100644 (file)
index 0000000..1fe565e
--- /dev/null
@@ -0,0 +1,75 @@
+USING: help.markup help.syntax math.functions math ;
+IN: math.libm
+
+ARTICLE: "math.libm" "C standard library math functions"
+"The words in the " { $vocab-link "math.libm" } " vocabulary call C standard library math functions. They are used to implement words in the " { $vocab-link "math.functions" } " vocabulary."
+$nl
+"They can be called directly, however there is little reason to do so, since they only implement real-valued functions, and in some cases place restrictions on the domain:"
+{ $example "2 acos ." "C{ 0.0 1.316957896924817 }" }
+{ $example "2 facos ." "0.0/0.0" }
+"Trigonometric functions:"
+{ $subsection fcos }
+{ $subsection fsin }
+{ $subsection facos }
+{ $subsection fasin }
+{ $subsection fatan }
+{ $subsection fatan2 }
+"Hyperbolic functions:"
+{ $subsection fcosh }
+{ $subsection fsinh }
+"Exponentials and logarithms:"
+{ $subsection fexp }
+{ $subsection flog }
+"Powers:"
+{ $subsection fpow }
+{ $subsection fsqrt } ;
+
+ABOUT: "math.libm"
+
+HELP: facos
+{ $values { "x" real } { "y" 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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $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 } }
+{ $description "Calls the natural logarithm function from the C standard library. User code should call " { $link log } " instead." } ;
+
+HELP: fpow
+{ $values { "x" real } { "y" real } { "z" 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 } }
+{ $description "Calls the square root function from the C standard library. User code should call " { $link sqrt } " instead." } ;
diff --git a/core/math/libm/libm.factor b/core/math/libm/libm.factor
new file mode 100644 (file)
index 0000000..0cc402e
--- /dev/null
@@ -0,0 +1,52 @@
+! Copyright (C) 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien ;
+IN: math.libm
+
+: facos ( x -- y )
+    "double" "libm" "acos" { "double" } alien-invoke ;
+    foldable
+
+: fasin ( x -- y )
+    "double" "libm" "asin" { "double" } alien-invoke ;
+    foldable
+
+: fatan ( x -- y )
+    "double" "libm" "atan" { "double" } alien-invoke ;
+    foldable
+
+: fatan2 ( x y -- z )
+    "double" "libm" "atan2" { "double" "double" } alien-invoke ;
+    foldable
+
+: fcos ( x -- y )
+    "double" "libm" "cos" { "double" } alien-invoke ;
+    foldable
+
+: fsin ( x -- y )
+    "double" "libm" "sin" { "double" } alien-invoke ;
+    foldable
+
+: fcosh ( x -- y )
+    "double" "libm" "cosh" { "double" } alien-invoke ;
+    foldable
+
+: fsinh ( x -- y )
+    "double" "libm" "sinh" { "double" } alien-invoke ;
+    foldable
+
+: fexp ( x -- y )
+    "double" "libm" "exp" { "double" } alien-invoke ;
+    foldable
+
+: flog ( x -- y )
+    "double" "libm" "log" { "double" } alien-invoke ;
+    foldable
+
+: fpow ( x y -- z )
+    "double" "libm" "pow" { "double" "double" } alien-invoke ;
+    foldable
+
+: fsqrt ( x -- y )
+    "double" "libm" "sqrt" { "double" } alien-invoke ;
+    foldable
diff --git a/core/math/libm/summary.txt b/core/math/libm/summary.txt
new file mode 100644 (file)
index 0000000..73ac3c2
--- /dev/null
@@ -0,0 +1 @@
+Low-level binding to math functions in the C standard library
diff --git a/core/math/libm/tags.txt b/core/math/libm/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/core/math/math-docs.factor b/core/math/math-docs.factor
new file mode 100644 (file)
index 0000000..7b7a1ad
--- /dev/null
@@ -0,0 +1,392 @@
+USING: help.markup help.syntax kernel sequences quotations
+math.private math.functions ;
+IN: math
+
+ARTICLE: "division-by-zero" "Division by zero"
+"Floating point division never raises an error if the denominator is zero. This means that if at least one of the two inputs to " { $link / } ", " { $link /f } " or " { $link mod } " is a float, the result will be a floating point infinity or not a number value."
+$nl
+"The behavior of integer division is hardware specific. On x86 processors, " { $link /i } " and " { $link mod } " raise an error if both inputs are integers and the denominator is zero. On PowerPC, integer division by zero yields a result of zero."
+$nl
+"On the other hand, the " { $link / } " word, when given integer arguments, implements a much more expensive division algorithm which always yields an exact rational answer, and this word always tests for division by zero explicitly." ;
+
+ARTICLE: "number-protocol" "Number protocol"
+"Math operations obey certain numerical upgrade rules. If one of the inputs is a bignum and the other is a fixnum, the latter is first coerced to a bignum; if one of the inputs is a float, the other is coerced to a float."
+$nl
+"Two examples where you should note the types of the inputs and outputs:"
+{ $example "3 >fixnum 6 >bignum * class ." "bignum" }
+{ $example "1/2 2.0 + ." "4.5" }
+"The following usual operations are supported by all numbers."
+{ $subsection + }
+{ $subsection - }
+{ $subsection * }
+{ $subsection / }
+"Non-commutative operations take operands from the stack in the natural order; " { $snippet "6 2 /" } " divides 6 by 2."
+{ $subsection "division-by-zero" }
+"Real numbers (but not complex numbers) can be ordered:"
+{ $subsection < }
+{ $subsection <= }
+{ $subsection > }
+{ $subsection >= }
+"Inexact comparison:"
+{ $subsection ~ } ;
+
+ARTICLE: "modular-arithmetic" "Modular arithmetic"
+{ $subsection mod }
+{ $subsection rem }
+{ $subsection /mod }
+{ $subsection /i }
+{ $subsection mod-inv }
+{ $subsection ^mod }
+{ $see-also "integer-functions" } ;
+
+ARTICLE: "bitwise-arithmetic" "Bitwise arithmetic"
+"There are two ways of looking at an integer -- as an abstract mathematical entity, or as a string of bits. The latter representation motivates " { $emphasis "bitwise operations" } "."
+{ $subsection bitand }
+{ $subsection bitor }
+{ $subsection bitxor }
+{ $subsection bitnot }
+{ $subsection shift }
+{ $subsection 2/ }
+{ $subsection 2^ }
+{ $subsection bit? }
+{ $see-also "conditionals" } ;
+
+ARTICLE: "arithmetic" "Arithmetic"
+"Factor attempts to preserve natural mathematical semantics for numbers. Multiplying two large integers never results in overflow, and dividing two integers yields an exact ratio. Floating point numbers are also supported, along with complex numbers."
+$nl
+"Math words are in the " { $vocab-link "math" } " vocabulary. Implementation details are in the " { $vocab-link "math.private" } " vocabulary."
+{ $subsection "number-protocol" }
+{ $subsection "modular-arithmetic" }
+{ $subsection "bitwise-arithmetic" }
+{ $see-also "integers" "rationals" "floats" "complex-numbers" } ;
+
+ABOUT: "arithmetic"
+
+HELP: number=
+{ $values { "x" number } { "y" number } { "?" "a boolean" } }
+{ $description "Tests if two numbers have the same numerical value. If either input is not a number, outputs " { $link f } "." }
+{ $notes "Do not call this word directly. Calling " { $link = } " has the same effect and is more concise." } ;
+
+HELP: <
+{ $values { "x" real } { "y" real } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "x" } " is less than " { $snippet "y" } "." } ;
+
+HELP: <=
+{ $values { "x" real } { "y" real } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "x" } " is less than or equal to " { $snippet "y" } "." } ;
+
+HELP: >
+{ $values { "x" real } { "y" real } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "x" } " is greater than " { $snippet "y" } "." } ;
+
+HELP: >=
+{ $values { "x" real } { "y" real } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "x" } " is greater than or equal to " { $snippet "y" } "." } ;
+
+HELP: +
+{ $values { "x" number } { "y" number } { "z" number } }
+{ $description
+    "Adds two numbers."
+    { $list
+        "Addition of fixnums may overflow and convert the result to a bignum."
+        "Addition of bignums always yields a bignum."
+        "Addition of floats always yields a float."
+        "Addition of ratios and complex numbers proceeds using the relevant mathematical rules."
+    }
+} ;
+
+HELP: -
+{ $values { "x" number } { "y" number } { "z" number } }
+{ $description
+    "Subtracts " { $snippet "y" } " from " { $snippet "x" } "."
+    { $list
+        "Subtraction of fixnums may overflow and convert the result to a bignum."
+        "Subtraction of bignums always yields a bignum."
+        "Subtraction of floats always yields a float."
+        "Subtraction of ratios and complex numbers proceeds using the relevant mathematical rules."
+    }
+} ;
+
+HELP: *
+{ $values { "x" number } { "y" number } { "z" number } }
+{ $description
+    "Multiplies two numbers."
+    { $list
+        "Multiplication of fixnums may overflow and convert the result to a bignum."
+        "Multiplication of bignums always yields a bignum."
+        "Multiplication of floats always yields a float."
+        "Multiplication of ratios and complex numbers proceeds using the relevant mathematical rules."
+    }
+} ;
+
+HELP: /
+{ $values { "x" number } { "y" number } { "z" number } }
+{ $description
+    "Divides " { $snippet "x" } " by " { $snippet "y" } ", retaining as much precision as possible."
+    { $list
+        "Division of fixnums may yield a ratio, or overflow and yield a bignum."
+        "Division of bignums may yield a ratio."
+        "Division of floats always yields a float."
+        "Division of ratios and complex numbers proceeds using the relevant mathematical rules."
+    }
+}
+{ $see-also "division-by-zero" } ;
+
+HELP: /i
+{ $values { "x" real } { "y" real } { "z" real } }
+{ $description
+    "Divides " { $snippet "x" } " by " { $snippet "y" } ", truncating the result to an integer."
+    { $list
+        "Integer division of fixnums may overflow and yield a bignum."
+        "Integer division of bignums always yields a bignum."
+        "Integer division of floats always yields a float."
+        "Integer division of ratios and complex numbers proceeds using the relevant mathematical rules."
+    }
+}
+{ $see-also "division-by-zero" } ;
+
+HELP: /f
+{ $values { "x" real } { "y" real } { "z" real } }
+{ $description
+    "Divides " { $snippet "x" } " by " { $snippet "y" } ", representing the result as a floating point number."
+    { $list 
+        "Integer division of fixnums may overflow and yield a bignum."
+        "Integer division of bignums always yields a bignum."            
+        "Integer division of floats always yields a float."
+        "Integer division of ratios and complex numbers proceeds using the relevant mathematical rules."
+    }
+}
+{ $see-also "division-by-zero" } ;
+
+HELP: mod
+{ $values { "x" integer } { "y" integer } { "z" integer } }
+{ $description
+    "Computes the remainder of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder being negative if " { $snippet "x" } " is negative."
+    { $list 
+        "Modulus of fixnums always yields a fixnum."
+        "Modulus of bignums always yields a bignum."            
+    }
+}
+{ $see-also "division-by-zero" rem } ;
+
+HELP: /mod
+{ $values { "x" integer } { "y" integer } { "z" integer } { "w" integer } }
+{ $description
+    "Computes the quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder being negative if " { $snippet "x" } " is negative."
+    { $list 
+        "The quotient of two fixnums may overflow and yield a bignum; the remainder is always a fixnum"
+        "The quotient and remainder of two bignums is always a bignum."            
+    }
+}
+{ $see-also "division-by-zero" } ;
+
+HELP: bitand
+{ $values { "x" integer } { "y" integer } { "z" integer } }
+{ $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in both inputs." }
+{ $examples
+    { $example "BIN: 101 BIN: 10 bitand .b" "0" }
+    { $example "BIN: 110 BIN: 10 bitand .b" "10" }
+}
+{ $notes "This word implements bitwise and, so applying it to booleans will throw an error. Boolean and is the " { $link and } " word." } ;
+
+HELP: bitor
+{ $values { "x" integer } { "y" integer } { "z" integer } }
+{ $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in at least one of the inputs." }
+{ $examples
+    { $example "BIN: 101 BIN: 10 bitor .b" "111" }
+    { $example "BIN: 110 BIN: 10 bitor .b" "110" }
+}
+{ $notes "This word implements bitwise inclusive or, so applying it to booleans will throw an error. Boolean inclusive or is the " { $link and } " word." } ;
+
+HELP: bitxor
+{ $values { "x" integer } { "y" integer } { "z" integer } }
+{ $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in exactly one of the inputs." }
+{ $examples
+    { $example "BIN: 101 BIN: 10 bitxor .b" "111" }
+    { $example "BIN: 110 BIN: 10 bitxor .b" "100" }
+}
+{ $notes "This word implements bitwise exclusive or, so applying it to booleans will throw an error. Boolean exclusive or is the " { $link xor } " word." } ;
+
+HELP: shift
+{ $values { "x" integer } { "n" integer } { "y" integer } }
+{ $description "Shifts " { $snippet "x" } " to the left by " { $snippet "y" } " bits if " { $snippet "y" } " is positive, or " { $snippet "-y" } " bits to the right if " { $snippet "y" } " is negative. A left shift of a fixnum may overflow, yielding a bignum. A right shift may result in bits ``falling off'' the right hand side and being discarded." }
+{ $examples { $example "BIN: 101 5 shift .b" "10100000" } { $example "BIN: 11111 -2 shift .b" "111" } } ;
+
+HELP: bitnot
+{ $values { "x" integer } { "y" integer } }
+{ $description "Computes the bitwise complement of the input; that is, each bit in the input number is flipped." }
+{ $notes "This word implements bitwise not, so applying it to booleans will throw an error. Boolean not is the " { $link not } " word."
+$nl
+"Due to the two's complement representation of signed integers, the following two lines are equivalent:" { $code "bitnot" "neg 1-" } } ;
+
+HELP: bit?
+{ $values { "x" integer } { "n" integer } { "?" "a boolean" } }
+{ $description "Tests if the " { $snippet "n" } "th bit of " { $snippet "x" } " is set." }
+{ $examples { $example "BIN: 101 3 bit? ." "t" } } ;
+
+HELP: log2
+{ $values { "n" "a positive integer" } { "b" integer } }
+{ $description "Outputs the largest integer " { $snippet "b" } " such that " { $snippet "2^b" } " is less than " { $snippet "n" } "." }
+{ $errors "Throws an error if " { $snippet "n" } " is zero or negative." } ;
+
+HELP: 1+
+{ $values { "x" number } { "y" number } }
+{ $description
+    "Increments a number by 1. The following two lines are equivalent, but the first is more efficient:"
+    { $code "1+" "1 +" }
+} ;
+
+HELP: 1-
+{ $values { "x" number } { "y" number } }
+{ $description
+    "Decrements a number by 1. The following two lines are equivalent, but the first is more efficient:"
+    { $code "1-" "1 -" }
+} ;
+
+HELP: truncate
+{ $values { "x" real } { "y" "a whole real number" } }
+{ $description "Outputs the number that results from subtracting the fractional component of " { $snippet "x" } "." }
+{ $notes "The result is not necessarily an integer." } ;
+
+HELP: floor
+{ $values { "x" real } { "y" "a whole real number" } }
+{ $description "Outputs the greatest whole number smaller than or equal to " { $snippet "x" } "." }
+{ $notes "The result is not necessarily an integer." } ;
+
+HELP: ceiling
+{ $values { "x" real } { "y" "a whole real number" } }
+{ $description "Outputs the least whole number greater than or equal to " { $snippet "x" } "." }
+{ $notes "The result is not necessarily an integer." } ;
+
+HELP: round
+{ $values { "x" real } { "y" "a whole real number" } }
+{ $description "Outputs the whole number closest to " { $snippet "x" } "." }
+{ $notes "The result is not necessarily an integer." } ;
+
+HELP: sq
+{ $values { "x" number } { "y" number } }
+{ $description "Multiplies a number by itself." } ;
+
+HELP: neg
+{ $values { "x" number } { "-x" number } }
+{ $description "Computes a number's additive inverse." } ;
+
+HELP: recip
+{ $values { "x" number } { "y" number } }
+{ $description "Computes a number's multiplicative inverse." }
+{ $errors "Throws an error if " { $snippet "x" } " is the integer 0." } ;
+
+HELP: max
+{ $values { "x" real } { "y" real } { "z" real } }
+{ $description "Outputs the greatest of two real numbers." } ;
+
+HELP: min
+{ $values { "x" real } { "y" real } { "z" real } }
+{ $description "Outputs the smallest of two real numbers." } ;
+
+HELP: between?
+{ $values { "x" real } { "y" real } { "z" real } { "?" "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." } ;
+
+HELP: rem
+{ $values { "x" integer } { "y" integer } { "z" integer } }
+{ $description
+    "Computes the remainder of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder always positive."
+    { $list 
+        "Modulus of fixnums always yields a fixnum."
+        "Modulus of bignums always yields a bignum."            
+    }
+}
+{ $see-also "division-by-zero" mod } ;
+
+HELP: sgn
+{ $values { "x" real } { "n" "-1, 0 or 1" } }
+{ $description
+    "Outputs one of the following:"
+    { $list
+        "-1 if " { $snippet "x" } " is negative"
+        "0 if " { $snippet "x" } " is equal to 0"
+        "1 if " { $snippet "x" } " is positive"
+    }
+} ;
+
+HELP: 2/
+{ $values { "x" integer } { "y" integer } }
+{ $description "Shifts " { $snippet "x" } " to the right by one bit." }
+{ $examples
+    { $example "14 2/ ." "7" }
+    { $example "17 2/ ." "8" }
+    { $example "-17 2/ ." "-9" }
+}
+{ $notes "This word is not equivalent to " { $snippet "2 /" } " or " { $snippet "2 /i" } "; the name is historic and originates from the Forth programming language." } ;
+
+HELP: 2^
+{ $values { "n" "a positive integer" } { "2^n" "a positive integer" } }
+{ $description "Computes two to the power of " { $snippet "n" } ". This word will only give correct results if " { $snippet "n" } " is greater than zero; for the general case, use " { $snippet  "2 swap ^" } "." } ;
+
+HELP: zero?
+{ $values { "x" number } { "?" "a boolean" } }
+{ $description "Tests if the number is equal to zero." } ;
+
+HELP: times
+{ $values { "n" integer } { "quot" quotation } }
+{ $description "Calls the quotation " { $snippet "n" } " times." }
+{ $notes "If you need to pass the current index to the quotation, use " { $link each } "." } ;
+
+HELP: [-]
+{ $values { "x" real } { "y" real } { "z" real } }
+{ $description "Subtracts " { $snippet "y" } " from " { $snippet "x" } ". If the result is less than zero, outputs zero." } ;
+
+HELP: fp-nan?
+{ $values { "x" real } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "x" } " is an IEEE Not-a-Number value. While " { $snippet "x" } " can be any real number, this word will only ever yield true if " { $snippet "x" } " is a " { $link float } "." } ;
+
+HELP: real ( z -- x )
+{ $values { "z" number } { "x" real } }
+{ $description "Outputs the real part of a complex number. This acts as the identity on real numbers." }
+{ $class-description "The class of real numbers, which is a disjoint union of rationals and floats." } ;
+
+HELP: imaginary ( z -- y )
+{ $values { "z" number } { "y" real } }
+{ $description "Outputs the imaginary part of a complex number. This outputs zero for real numbers." } ;
+
+HELP: (rect>)
+{ $values { "x" real } { "y" real } { "z" number } }
+{ $description "Creates a complex number from real and imaginary components." }
+{ $warning "This word does not check that the arguments are real numbers, which can have undefined consequences. Use the " { $link rect> } " word instead." } ;
+
+HELP: number
+{ $class-description "The class of numbers." } ;
+
+HELP: rect>
+{ $values { "x" real } { "y" real } { "z" number } }
+{ $description "Creates a complex number from real and imaginary components." } ;
+
+HELP: >rect
+{ $values { "z" number } { "x" real } { "y" real } }
+{ $description "Extracts the real and imaginary components of a complex number." } ;
+
+HELP: next-power-of-2
+{ $values { "m" "a non-negative integer" } { "n" "an integer" } }
+{ $description "Outputs the smallest power of 2 greater than " { $snippet "m" } ". The output value is always at least 1." } ;
+
+HELP: each-integer
+{ $values { "n" integer } { "quot" "a quotation with stack effect " { $snippet "( 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" "a quotation with stack effect " { $snippet "( 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 " { $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" "a quotation with stack effect " { $snippet "( 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" "a quotation with stack effect " { $snippet "( 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 } "." } ;
diff --git a/core/math/math-tests.factor b/core/math/math-tests.factor
new file mode 100644 (file)
index 0000000..c650f73
--- /dev/null
@@ -0,0 +1,11 @@
+USING: kernel math namespaces tools.test ;
+IN: temporary
+
+[ ] [ 5 [ ] times ] unit-test
+[ ] [ 0 [ ] times ] unit-test
+[ ] [ -1 [ ] times ] unit-test
+
+[ ] [ 5 [ drop ] each-integer ] unit-test
+[ [ 0 1 2 3 4 ] ] [ [ 5 [ , ] each-integer ] [ ] make ] unit-test
+[ [ ] ] [ [ -1 [ , ] each-integer ] [ ] make ] unit-test
+
index 2faf673557d2bf7a4ec4b1e619c86a432cb7d91d..5331a954bfcb3ab09cfd800af1845e87e71f54d7 100644 (file)
@@ -1,54 +1,74 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
+! Copyright (C) 2003, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math.private ;
 IN: math
-USING: errors generic kernel math-internals ;
 
 GENERIC: >fixnum ( x -- y ) foldable
 GENERIC: >bignum ( x -- y ) foldable
 GENERIC: >float ( x -- y ) foldable
 
-G: number= ( x y -- ? ) math-combination ; foldable
+MATH: number= ( x y -- ? ) foldable
 M: object number= 2drop f ;
 
-G: <  ( x y -- ? ) math-combination ; foldable
-G: <= ( x y -- ? ) math-combination ; foldable
-G: >  ( x y -- ? ) math-combination ; foldable
-G: >= ( x y -- ? ) math-combination ; foldable
+MATH: <  ( x y -- ? ) foldable
+MATH: <= ( x y -- ? ) foldable
+MATH: >  ( x y -- ? ) foldable
+MATH: >= ( x y -- ? ) foldable
 
-G: +   ( x y -- z ) math-combination ; foldable
-G: -   ( x y -- z ) math-combination ; foldable
-G: *   ( x y -- z ) math-combination ; foldable
-G: /   ( x y -- z ) math-combination ; foldable
-G: /i  ( x y -- z ) math-combination ; foldable
-G: mod ( x y -- z ) math-combination ; foldable
+MATH: +   ( x y -- z ) foldable
+MATH: -   ( x y -- z ) foldable
+MATH: *   ( x y -- z ) foldable
+MATH: /   ( x y -- z ) foldable
+MATH: /i  ( x y -- z ) foldable
+MATH: mod ( x y -- z ) foldable
 
-G: /mod ( x y -- z w ) math-combination ; foldable
-
-G: bitand ( x y -- z ) math-combination ; foldable
-G: bitor  ( x y -- z ) math-combination ; foldable
-G: bitxor ( x y -- z ) math-combination ; foldable
-G: shift  ( x n -- y ) 1 standard-combination ; foldable
+MATH: /mod ( x y -- z w ) foldable
 
+MATH: bitand ( x y -- z ) foldable
+MATH: bitor  ( x y -- z ) foldable
+MATH: bitxor ( x y -- z ) foldable
+GENERIC# shift 1 ( x n -- y ) foldable
 GENERIC: bitnot ( x -- y ) foldable
+GENERIC# bit? 1 ( x n -- ? ) foldable
+
+<PRIVATE
+
+GENERIC: (log2) ( x -- n ) foldable
 
-GENERIC: abs ( x -- y ) foldable
-GENERIC: absq ( x -- y ) foldable
+PRIVATE>
+
+: log2 ( x -- n )
+    dup 0 <= [
+        "log2 expects positive inputs" throw
+    ] [
+        (log2)
+    ] if ; foldable
 
 GENERIC: zero? ( x -- ? ) foldable
+
 M: object zero? drop f ;
 
+GENERIC: sqrt ( x -- y ) foldable
+
 : 1+ ( x -- y ) 1 + ; foldable
 : 1- ( x -- y ) 1 - ; foldable
+: 2/ ( x -- y ) -1 shift ; foldable
 : sq ( x -- y ) dup * ; foldable
 : neg ( x -- -x ) 0 swap - ; foldable
 : recip ( x -- y ) 1 swap / ; foldable
-: max ( x y -- z ) [ > ] 2keep ? ; foldable
-: min ( x y -- z ) [ < ] 2keep ? ; foldable
-: between? ( x y z -- ? ) pick >= >r >= r> and ; foldable
+
+: /f  ( x y -- z ) >r >float r> >float float/f ; inline
+
+: max ( x y -- z ) [ > ] most ; foldable
+: min ( x y -- z ) [ < ] most ; foldable
+
+: between? ( x y z -- ? )
+    pick >= [ >= ] [ 2drop f ] if ; inline
+
 : rem ( x y -- z ) tuck mod over + swap mod ; foldable
 : sgn ( x -- n ) dup 0 < -1 0 ? swap 0 > 1 0 ? bitor ; foldable
-: align ( m w -- n ) 1- [ + ] keep bitnot bitand ; inline
-: truncate ( x -- y ) dup 1 mod - ; foldable
+: truncate ( x -- y ) dup 1 mod - ; inline
+: round ( x -- y ) dup sgn 2 / + truncate ; inline
 
 : floor ( x -- y )
     dup 1 mod dup zero?
@@ -56,16 +76,111 @@ M: object zero? drop f ;
 
 : ceiling ( x -- y ) neg floor neg ; foldable
 
-: [-] - 0 max ; inline
+: [-] ( x y -- z ) - 0 max ; inline
+
+: 2^ ( n -- 2^n ) 1 swap shift ; inline
+
+: even? ( n -- ? ) 1 bitand zero? ;
+
+: odd? ( n -- ? ) 1 bitand 1 number= ;
+
+: >fraction ( a/b -- a b )
+    dup numerator swap denominator ; inline
+
+UNION: integer fixnum bignum ;
+
+UNION: rational integer ratio ;
+
+UNION: real rational float ;
+
+UNION: number real complex ;
+
+GENERIC: fp-nan? ( x -- ? )
+
+M: object fp-nan?
+    drop f ;
+
+M: float fp-nan?
+    double>bits -51 shift BIN: 111111111111 [ bitand ] keep
+    number= ;
 
-: (repeat) ( i n quot -- )
-    pick pick >= [
-        3drop
+<PRIVATE
+
+: (rect>) ( x y -- z )
+    dup zero? [ drop ] [ <complex> ] if ; inline
+
+PRIVATE>
+
+: rect> ( x y -- z )
+    over real? over real? and [
+        (rect>)
     ] [
-        [ swap >r call 1+ r> ] keep (repeat)
+        "Complex number must have real components" throw
     ] if ; inline
 
-: repeat 0 -rot (repeat) ; inline
+: >rect ( z -- x y ) dup real swap imaginary ; inline
+
+: >float-rect ( z -- x y )
+    >rect swap >float swap >float ; inline
+
+: (next-power-of-2) ( i n -- n )
+    2dup >= [
+        drop
+    ] [
+        >r 1 shift r> (next-power-of-2)
+    ] if ;
+
+: next-power-of-2 ( m -- n ) 2 swap (next-power-of-2) ; foldable
+
+<PRIVATE
+
+: iterate-prep 0 -rot ; inline
+
+: if-iterate? >r >r pick pick < r> r> if ; inline
+
+: iterate-step ( i n quot -- i n quot )
+    #! Apply quot to i, keep i and quot, hide n.
+    swap >r 2dup 2slip r> swap ; inline
+
+: iterate-next >r >r 1+ r> r> ; inline
+
+PRIVATE>
+
+: (each-integer) ( i n quot -- )
+    [ iterate-step iterate-next (each-integer) ]
+    [ 3drop ] if-iterate? ; inline
+
+: (find-integer) ( i n quot -- i )
+    [
+        iterate-step roll
+        [ 2drop ] [ iterate-next (find-integer) ] if
+    ] [ 3drop f ] if-iterate? ; inline
+
+: (all-integers?) ( i n quot -- ? )
+    [
+        iterate-step roll
+        [ iterate-next (all-integers?) ] [ 3drop f ] if
+    ] [ 3drop t ] if-iterate? ; inline
+
+: each-integer ( n quot -- )
+    iterate-prep (each-integer) ; inline
 
 : times ( n quot -- )
-    swap [ >r dup slip r> ] repeat drop ; inline
+    [ drop ] swap compose each-integer ; inline
+
+: find-integer ( n quot -- i )
+    iterate-prep (find-integer) ; inline
+
+: all-integers? ( n quot -- ? )
+    iterate-prep (all-integers?) ; inline
+
+: find-last-integer ( n quot -- i )
+    over 0 < [
+        2drop f
+    ] [
+        2dup 2slip rot [
+            drop
+        ] [
+            >r 1- r> find-last-integer
+        ] if
+    ] if ; inline
diff --git a/core/math/math.facts b/core/math/math.facts
deleted file mode 100644 (file)
index 4ad26b6..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-USING: help kernel math ;
-
-HELP: number=
-{ $values { "x" "a number" } { "y" "a number" } { "?" "a boolean" } }
-{ $description "Tests if two numbers have the same numerical value." }
-{ $notes "Do not call this word directly. Calling " { $link = } " has the same effect and is more concise." } ;
-
-HELP: <
-{ $values { "x" "a real number" } { "y" "a real number" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "x" } " is less than " { $snippet "y" } "." } ;
-
-HELP: <=
-{ $values { "x" "a real number" } { "y" "a real number" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "x" } " is less than or equal to " { $snippet "y" } "." } ;
-
-HELP: >
-{ $values { "x" "a real number" } { "y" "a real number" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "x" } " is greater than " { $snippet "y" } "." } ;
-
-HELP: >=
-{ $values { "x" "a real number" } { "y" "a real number" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "x" } " is greater than or equal to " { $snippet "y" } "." } ;
-
-HELP: +
-{ $values { "x" "a number" } { "y" "a number" } { "z" "a number" } }
-{ $description
-    "Adds two numbers."
-    { $list
-        "Addition of fixnums may overflow and convert the result to a bignum."
-        "Addition of bignums always yields a bignum."
-        "Addition of floats always yields a float."
-        "Addition of ratios and complex numbers proceeds using the relevant mathematical rules."
-    }
-} ;
-
-HELP: -
-{ $values { "x" "a number" } { "y" "a number" } { "z" "a number" } }
-{ $description
-    "Subtracts " { $snippet "y" } " from " { $snippet "x" } "."
-    { $list
-        "Subtraction of fixnums may overflow and convert the result to a bignum."
-        "Subtraction of bignums always yields a bignum."
-        "Subtraction of floats always yields a float."
-        "Subtraction of ratios and complex numbers proceeds using the relevant mathematical rules."
-    }
-} ;
-
-HELP: *
-{ $values { "x" "a number" } { "y" "a number" } { "z" "a number" } }
-{ $description
-    "Multiplies two numbers."
-    { $list
-        "Multiplication of fixnums may overflow and convert the result to a bignum."
-        "Multiplication of bignums always yields a bignum."
-        "Multiplication of floats always yields a float."
-        "Multiplication of ratios and complex numbers proceeds using the relevant mathematical rules."
-    }
-} ;
-
-HELP: /
-{ $values { "x" "a number" } { "y" "a number" } { "z" "a number" } }
-{ $description
-    "Divides " { $snippet "x" } " by " { $snippet "y" } ", retaining as much precision as possible."
-    { $list
-        "Division of fixnums may yield a ratio, or overflow and yield a bignum."
-        "Division of bignums may yield a ratio."
-        "Division of floats always yields a float."
-        "Division of ratios and complex numbers proceeds using the relevant mathematical rules."
-    }
-}
-{ $see-also "division-by-zero" } ;
-
-HELP: /i
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a real number" } }
-{ $description
-    "Divides " { $snippet "x" } " by " { $snippet "y" } ", truncating the result to an integer."
-    { $list
-        "Integer division of fixnums may overflow and yield a bignum."
-        "Integer division of bignums always yields a bignum."
-        "Integer division of floats always yields a float."
-        "Integer division of ratios and complex numbers proceeds using the relevant mathematical rules."
-    }
-}
-{ $see-also "division-by-zero" } ;
-
-HELP: /f
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a real number" } }
-{ $description
-    "Divides " { $snippet "x" } " by " { $snippet "y" } ", representing the result as a floating point number."
-    { $list 
-        "Integer division of fixnums may overflow and yield a bignum."
-        "Integer division of bignums always yields a bignum."            
-        "Integer division of floats always yields a float."
-        "Integer division of ratios and complex numbers proceeds using the relevant mathematical rules."
-    }
-}
-{ $see-also "division-by-zero" } ;
-
-HELP: mod
-{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } }
-{ $description
-    "Computes the remainder of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder being negative if " { $snippet "x" } " is negative."
-    { $list 
-        "Modulus of fixnums always yields a fixnum."
-        "Modulus of bignums always yields a bignum."            
-    }
-}
-{ $see-also "division-by-zero" rem } ;
-
-HELP: /mod
-{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } { "w" "an integer" } }
-{ $description
-    "Computes the quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder being negative if " { $snippet "x" } " is negative."
-    { $list 
-        "The quotient of two fixnums may overflow and yield a bignum; the remainder is always a fixnum"
-        "The quotient and remainder of two bignums is always a bignum."            
-    }
-}
-{ $see-also "division-by-zero" } ;
-
-HELP: bitand
-{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } }
-{ $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in both inputs." }
-{ $examples
-    { $example "BIN: 101 BIN: 10 bitand .b" "0" }
-    { $example "BIN: 110 BIN: 10 bitand .b" "10" }
-} ;
-
-HELP: bitor
-{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } }
-{ $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in at least one of the inputs." }
-{ $examples
-    { $example "BIN: 101 BIN: 10 bitor .b" "111" }
-    { $example "BIN: 110 BIN: 10 bitor .b" "110" }
-} ;
-
-HELP: bitxor
-{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } }
-{ $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in exactly one of the inputs." }
-{ $examples
-    { $example "BIN: 101 BIN: 10 bitxor .b" "111" }
-    { $example "BIN: 110 BIN: 10 bitxor .b" "100" }
-} ;
-
-HELP: shift
-{ $values { "x" "an integer" } { "n" "an integer" } { "y" "an integer" } }
-{ $description "Shifts " { $snippet "x" } " to the left by " { $snippet "y" } " bits if " { $snippet "y" } " is positive, or " { $snippet "-y" } " bits to the right if " { $snippet "y" } " is negative. A left shift of a fixnum may overflow, yielding a bignum. A right shift may result in bits ``falling off'' the right hand side and being discarded." }
-{ $examples { $example "BIN: 101 5 shift .b" "10100000" } { $example "BIN: 11111 -2 shift .b" "111" } } ;
-
-HELP: bitnot
-{ $values { "x" "an integer" } { "y" "an integer" } }
-{ $description "Computes the bitwise complement of the input; that is, each bit in the input number is flipped." }
-{ $notes "Due to the two's complement representation of signed integers, the following two lines are equivalent:" { $code "bitnot" "neg 1-" } } ;
-
-HELP: 1+
-{ $values { "x" "a number" } { "y" "a number" } }
-{ $description
-    "Increments a number by 1. The following two lines are equivalent, but the first is more efficient:"
-    { $code "1+" "1 +" }
-} ;
-
-HELP: 1-
-{ $values { "x" "a number" } { "y" "a number" } }
-{ $description
-    "Decrements a number by 1. The following two lines are equivalent, but the first is more efficient:"
-    { $code "1-" "1 -" }
-} ;
-
-HELP: truncate
-{ $values { "x" "a real number" } { "y" "a whole real number" } }
-{ $description "Outputs the number that results from subtracting the fractional component of " { $snippet "x" } "." }
-{ $notes "The result is not necessarily an integer." } ;
-
-HELP: floor
-{ $values { "x" "a real number" } { "y" "a whole real number" } }
-{ $description "Outputs the greatest whole number smaller than or equal to " { $snippet "x" } "." }
-{ $notes "The result is not necessarily an integer." } ;
-
-HELP: ceiling
-{ $values { "x" "a real number" } { "y" "a whole real number" } }
-{ $description "Outputs the least whole number greater than or equal to " { $snippet "x" } "." }
-{ $notes "The result is not necessarily an integer." } ;
-
-HELP: abs
-{ $values { "x" "a complex number" } { "y" "a non-negative real number" } }
-{ $description "Computes the absolute value of a complex number." } ;
-
-HELP: absq
-{ $values { "x" "a complex number" } { "y" "a non-negative real number" } }
-{ $description "Computes the squared absolute value of a complex number. This is marginally more efficient than " { $link abs } "." } ;
-
-HELP: sq
-{ $values { "x" "a number" } { "y" "a number" } }
-{ $description "Multiplies a number by itself." } ;
-
-HELP: neg
-{ $values { "x" "a number" } { "-x" "a number" } }
-{ $description "Computes a number's additive inverse." } ;
-
-HELP: recip
-{ $values { "x" "a number" } { "y" "a number" } }
-{ $description "Computes a number's multiplicative inverse." }
-{ $errors "Throws an error if " { $snippet "x" } " is the integer 0." } ;
-
-HELP: max
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a real number" } }
-{ $description "Outputs the greatest of two real numbers." } ;
-
-HELP: min
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a real number" } }
-{ $description "Outputs the smallest of two real numbers." } ;
-
-HELP: between?
-{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a real number" } { "?" "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." } ;
-
-HELP: rem
-{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } }
-{ $description
-    "Computes the remainder of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder always positive."
-    { $list 
-        "Modulus of fixnums always yields a fixnum."
-        "Modulus of bignums always yields a bignum."            
-    }
-}
-{ $see-also "division-by-zero" mod } ;
-
-HELP: sgn
-{ $values { "x" "a real number" } { "n" "-1, 0 or 1" } }
-{ $description
-    "Outputs one of the following:"
-    { $list
-        "-1 if " { $snippet "x" } " is negative"
-        "0 if " { $snippet "x" } " is equal to 0"
-        "1 if " { $snippet "x" } " is positive"
-    }
-} ;
-
-HELP: align
-{ $values { "m" "an integer" } { "w" "a power of 2" } { "n" "an integer multiple of " { $snippet "w" } } }
-{ $description "Outputs the least multiple of " { $snippet "w" } " greater than " { $snippet "m" } "." }
-{ $notes "This word will give an incorrect result if " { $snippet "w" } " is not a power of 2." } ;
-
-HELP: number>string
-{ $values { "n" "a real number" } { "str" "a string" } }
-{ $description "Converts a real number to a string." }
-{ $notes "Printing complex numbers requires the more general prettyprinter facility (see " { $link "prettyprint" } ")." } ;
diff --git a/core/math/parse-numbers.factor b/core/math/parse-numbers.factor
deleted file mode 100644 (file)
index c466b35..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math
-USING: errors generic kernel math-internals namespaces sequences
-strings ;
-
-DEFER: base>
-
-: string>ratio ( str radix -- a/b )
-    >r "/" split1 r> tuck base> >r base> r>
-    2dup and [ / ] [ 2drop f ] if ;
-
-GENERIC: digit> ( ch -- n )
-M: digit  digit> CHAR: 0 - ;
-M: letter digit> CHAR: a - 10 + ;
-M: LETTER digit> CHAR: A - 10 + ;
-M: object digit> drop f ;
-
-: digit+ ( num digit base -- num )
-    pick pick and
-    [ 2dup < [ rot * + ] [ 3drop f ] if ] [ 3drop f ] if ;
-
-: (string>integer) ( radix str -- num )
-    dup empty? [
-        2drop f
-    ] [
-        0 [ digit> pick digit+ ] reduce nip
-    ] if ;
-
-: string>integer ( string radix -- n )
-    swap "-" ?head >r (string>integer) dup r> and [ neg ] when ;
-
-: base> ( str radix -- n/f )
-    {
-        { [ CHAR: / pick member? ] [ string>ratio ] }
-        { [ CHAR: . pick member? ] [ drop string>float ] }
-        { [ t ] [ string>integer ] }
-    } cond ;
-
-: string>number ( str -- n ) 10 base> ;
-: bin> ( str -- n ) 2 base> ;
-: oct> ( str -- n ) 8 base> ;
-: hex> ( str -- n ) 16 base> ;
-
-: >digit ( n -- ch )
-    dup 10 < [ CHAR: 0 + ] [ 10 - CHAR: a + ] if ;
-
-: integer, ( num radix -- )
-    dup 1 <= [ "Invalid radix" throw ] when
-    dup >r /mod >digit , dup 0 >
-    [ r> integer, ] [ r> 2drop ] if ;
-
-G: >base ( n radix -- str ) 1 standard-combination ;
-
-M: integer >base
-    [
-        over 0 < [
-            swap neg swap integer, CHAR: - ,
-        ] [
-            integer,
-        ] if
-    ] "" make reverse ;
-
-M: ratio >base
-    [
-        over numerator over >base %
-        CHAR: / ,
-        swap denominator swap >base %
-    ] "" make ;
-
-: fix-float
-    CHAR: . over member? [ ".0" append ] unless ;
-
-M: float >base
-    drop {
-        { [ dup 1.0/0.0 = ] [ drop "1.0/0.0" ] }
-        { [ dup -1.0/0.0 = ] [ drop "-1.0/0.0" ] }
-        { [ dup fp-nan? ] [ drop "0.0/0.0" ] }
-        { [ t ] [ float>string fix-float ] }
-    } cond ;
-
-: number>string ( n -- str ) 10 >base ;
-: >bin ( num -- string ) 2 >base ;
-: >oct ( num -- string ) 8 >base ;
-: >hex ( num -- string ) 16 >base ;
-
-IN: namespaces
-
-: # ( n -- ) number>string % ;
diff --git a/core/math/parse-numbers.facts b/core/math/parse-numbers.facts
deleted file mode 100644 (file)
index b9e93d1..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-USING: help math math-internals prettyprint namespaces ;
-
-HELP: base>
-{ $values { "str" "a string" } { "radix" "an integer between 2 and 36" } { "n/f" "a real number or " { $link f } } }
-{ $description "Creates a real number from a string representation with the given radix. The radix is ignored for floating point literals; they are always taken to be in base 10."
-$terpri
-"Outputs " { $link f } " if the string does not represent a number." }
-{ $see-also >base } ;
-
-HELP: string>number
-{ $values { "str" "a string" } { "n/f" "a real number or " { $link f } } }
-{ $description "Creates a real number from a string representation of a number in base 10."
-$terpri
-"Outputs " { $link f } " if the string does not represent a number." }
-{ $see-also number>string } ;
-
-HELP: bin>
-{ $values { "str" "a string" } { "n/f" "a real number or " { $link f } } }
-{ $description "Creates a real number from a string representation of a number in base 2."
-$terpri
-"Outputs " { $link f } " if the string does not represent a number." }
-{ $see-also POSTPONE: BIN: } ;
-
-HELP: oct>
-{ $values { "str" "a string" } { "n/f" "a real number or " { $link f } } }
-{ $description "Creates a real number from a string representation of a number in base 8."
-$terpri
-"Outputs " { $link f } " if the string does not represent a number." }
-{ $see-also POSTPONE: OCT: } ;
-
-HELP: hex>
-{ $values { "str" "a string" } { "n" "a real number" } }
-{ $description "Creates a real number from a string representation of a number in base 16."
-$terpri
-"Outputs " { $link f } " if the string does not represent a number." }
-{ $see-also POSTPONE: HEX: } ;
-
-HELP: >base
-{ $values { "n" "a real number" } { "radix" "an integer between 2 and 36" } { "str" "a string" } }
-{ $description "Converts a real number into a string representation using the given radix. If the number is a float, the radix is ignored and the output is always in base 10." }
-{ $see-also base> } ;
-
-HELP: number>string
-{ $values { "n" "a real number" } { "str" "a string" } }
-{ $description "Outputs a string representation of a number using base 10." } ;
-
-HELP: >bin
-{ $values { "n" "a real number" } { "str" "a string" } }
-{ $description "Outputs a string representation of a number using base 2." }
-{ $see-also .b } ;
-
-HELP: >oct
-{ $values { "n" "a real number" } { "str" "a string" } }
-{ $description "Outputs a string representation of a number using base 8." } 
-{ $see-also .o } ;
-
-HELP: >hex
-{ $values { "n" "a real number" } { "str" "a string" } }
-{ $description "Outputs a string representation of a number using base 16." } 
-{ $see-also .h } ;
-
-HELP: string>float ( n -- str )
-{ $values { "str" "a string" } { "n/f" "a real number or " { $link f } } }
-{ $description "Primitive for creating a float from a string representation. User code should call " { $link string>number } " instead, since it is polymorphic and can handle other types of numbers."
-$terpri
-"Outputs " { $link f } " if the string does not represent a float." } ;
-
-HELP: float>string ( n -- str )
-{ $values { "n" "a real number" } { "str" "a string" } }
-{ $description "Primitive for getting a string representation of a float. User code should call " { $link number>string } " instead, since it is polymorphic and can handle other types of numbers." } ;
-
-HELP: #
-{ $values { "n" "a real number" } }
-{ $description "Appends the string representation of a real number to the end of the sequence being constructed by " { $link make } "." } ;
diff --git a/core/math/parser/authors.txt b/core/math/parser/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/parser/parser-docs.factor b/core/math/parser/parser-docs.factor
new file mode 100644 (file)
index 0000000..b0d52ef
--- /dev/null
@@ -0,0 +1,126 @@
+USING: help.markup help.syntax math math.private prettyprint
+namespaces strings ;
+IN: math.parser
+
+ARTICLE: "number-strings" "Converting between numbers and strings"
+"These words only convert between real numbers and strings. Complex numbers are constructed by the parser (" { $link "parser" } ") and printed by the prettyprinter (" { $link "prettyprint" } ")."
+$nl
+"Note that only integers can be converted to and from strings using a representation other than base 10. Calling a word such as " { $link >oct } " on a float will give a result in base 10."
+$nl
+"Converting numbers to strings:"
+{ $subsection number>string }
+{ $subsection >bin }
+{ $subsection >oct }
+{ $subsection >hex }
+{ $subsection >base }
+"Converting strings to numbers:"
+{ $subsection string>number }
+{ $subsection bin> }
+{ $subsection oct> }
+{ $subsection hex> }
+{ $subsection base> }
+"You can also input literal numbers in a different base (" { $link "syntax-integers" } ")."
+{ $see-also "prettyprint-numbers" } ;
+
+ABOUT: "number-strings"
+
+HELP: digits>integer
+{ $values { "radix" "an integer between 2 and 36" } { "seq" "a sequence of integers" } { "n" integer } }
+{ $description "Converts a sequence of digits (with most significant digit first) into an integer." }
+{ $notes "This is one of the factors of " { $link string>number } "." } ;
+
+HELP: valid-digits?
+{ $values { "radix" "an integer between 2 and 36" } { "seq" "a sequence of integers" } { "?" "a boolean" } }
+{ $description "Tests if this sequence of integers represents a valid integer in the given radix." } ;
+
+HELP: >digit
+{ $values { "n" "an integer between 0 and 35" } { "ch" "a character" } }
+{ $description "Outputs a character representation of a digit." }
+{ $notes "This is one of the factors of " { $link number>string } "." } ;
+
+HELP: digit>
+{ $values { "ch" "a character" } { "n" integer } }
+{ $description "Converts a character representation of a digit to an integer." }
+{ $notes "This is one of the factors of " { $link string>number } "." } ;
+
+HELP: string>integer
+{ $values { "str" string } { "radix" "an integer between 2 and 36" } { "n/f" "an integer or " { $link f } } }
+{ $description "Creates an integer from a string representation." }
+{ $notes "The " { $link base> } " word is more general." } ;
+
+HELP: base>
+{ $values { "str" string } { "radix" "an integer between 2 and 36" } { "n/f" "a real number or " { $link f } } }
+{ $description "Creates a real number from a string representation with the given radix. The radix is ignored for floating point literals; they are always taken to be in base 10."
+$nl
+"Outputs " { $link f } " if the string does not represent a number." } ;
+
+{ >base base> } related-words
+
+HELP: string>number
+{ $values { "str" string } { "n/f" "a real number or " { $link f } } }
+{ $description "Creates a real number from a string representation of a number in base 10."
+$nl
+"Outputs " { $link f } " if the string does not represent a number." } ;
+
+{ string>number number>string } related-words
+
+HELP: bin>
+{ $values { "str" string } { "n/f" "a real number or " { $link f } } }
+{ $description "Creates a real number from a string representation of a number in base 2."
+$nl
+"Outputs " { $link f } " if the string does not represent a number." } ;
+
+{ bin> POSTPONE: BIN: bin> .b } related-words
+
+HELP: oct>
+{ $values { "str" string } { "n/f" "a real number or " { $link f } } }
+{ $description "Creates a real number from a string representation of a number in base 8."
+$nl
+"Outputs " { $link f } " if the string does not represent a number." } ;
+
+{ oct> POSTPONE: OCT: oct> .o } related-words
+
+HELP: hex>
+{ $values { "str" string } { "n/f" "a real number or " { $link f } } }
+{ $description "Creates a real number from a string representation of a number in base 16."
+$nl
+"Outputs " { $link f } " if the string does not represent a number." } ;
+
+{ hex> POSTPONE: HEX: hex> .h } related-words
+
+HELP: >base
+{ $values { "n" real } { "radix" "an integer between 2 and 36" } { "str" string } }
+{ $description "Converts a real number into a string representation using the given radix. If the number is a float, the radix is ignored and the output is always in base 10." } ;
+
+HELP: >bin
+{ $values { "n" real } { "str" string } }
+{ $description "Outputs a string representation of a number using base 2." } ;
+
+HELP: >oct
+{ $values { "n" real } { "str" string } }
+{ $description "Outputs a string representation of a number using base 8." } ;
+
+HELP: >hex
+{ $values { "n" real } { "str" string } }
+{ $description "Outputs a string representation of a number using base 16." } ;
+
+HELP: string>float ( str -- n/f )
+{ $values { "str" string } { "n/f" "a real number or " { $link f } } }
+{ $description "Primitive for creating a float from a string representation." }
+{ $notes "The " { $link string>number } " word is more general."
+$nl
+"Outputs " { $link f } " if the string does not represent a float." } ;
+
+HELP: float>string ( n -- str )
+{ $values { "n" real } { "str" string } }
+{ $description "Primitive for getting a string representation of a float." }
+{ $notes "The " { $link number>string } " word is more general." } ;
+
+HELP: number>string
+{ $values { "n" real } { "str" string } }
+{ $description "Converts a real number to a string." }
+{ $notes "Printing complex numbers requires the more general prettyprinter facility (see " { $link "prettyprint" } ")." } ;
+
+HELP: #
+{ $values { "n" real } }
+{ $description "Appends the string representation of a real number to the end of the sequence being constructed by " { $link make } "." } ;
diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor
new file mode 100644 (file)
index 0000000..bea96b1
--- /dev/null
@@ -0,0 +1,130 @@
+USING: kernel math math.parser sequences tools.test ;
+IN: temporary
+
+[ f ]
+[ f string>number ]
+unit-test
+
+[ f ]
+[ "12345abcdef" string>number ]
+unit-test
+
+[ t ]
+[ "-12" string>number 0 < ]
+unit-test
+
+[ f ]
+[ "--12" string>number ]
+unit-test
+
+[ f ]
+[ "-" string>number ]
+unit-test
+
+[ f ]
+[ "e" string>number ]
+unit-test
+
+[ "100.0" ]
+[ "1.0e2" string>number number>string ]
+unit-test
+
+[ "-100.0" ]
+[ "-1.0e2" string>number number>string ]
+unit-test
+
+[ "0.01" ]
+[ "1.0e-2" string>number number>string ]
+unit-test
+
+[ "-0.01" ]
+[ "-1.0e-2" string>number number>string ]
+unit-test
+
+[ "-1.0e-12" ]
+[ "-1.0e-12" string>number number>string ]
+unit-test
+
+[ f ]
+[ "-1e-2e4" string>number ]
+unit-test
+
+[ "3.14" ]
+[ "3.14" string>number number>string ]
+unit-test
+
+[ f ]
+[ "." string>number ]
+unit-test
+
+[ f ]
+[ ".e" string>number ]
+unit-test
+
+[ "101.0" ]
+[ "1.01e2" string>number number>string ]
+unit-test
+
+[ "-101.0" ]
+[ "-1.01e2" string>number number>string ]
+unit-test
+
+[ "1.01" ]
+[ "101.0e-2" string>number number>string ]
+unit-test
+
+[ "-1.01" ]
+[ "-101.0e-2" string>number number>string ]
+unit-test
+
+[ 5 ]
+[ "10/2" string>number ]
+unit-test
+
+[ -5 ]
+[ "-10/2" string>number ]
+unit-test
+
+[ -5 ]
+[ "10/-2" string>number ]
+unit-test
+
+[ 5 ]
+[ "-10/-2" string>number ]
+unit-test
+
+[ 5.0 ]
+[ "10.0/2" string>number ]
+unit-test
+
+[ f ]
+[ "1e1/2" string>number ]
+unit-test
+
+[ f ]
+[ "e/2" string>number ]
+unit-test
+
+[ "33/100" ]
+[ "66/200" string>number number>string ]
+unit-test
+
+[ f ] [ "12" bin> ] unit-test
+[ f ] [ "fdsf" bin> ] unit-test
+[ 3 ] [ "11" bin> ] unit-test
+
+[ f ] [ "\0." string>number ] unit-test
+
+! [ t ] [
+!     { "1.0/0.0" "-1.0/0.0" "0.0/0.0" }
+!     [ dup string>number number>string = ] all?
+! ] unit-test
+! 
+! [ t ] [
+!     { 1.0/0.0 -1.0/0.0 0.0/0.0 }
+!     [ dup number>string string>number = ] all?
+! ] unit-test
+
+[ 1 1 >base ] unit-test-fails
+[ 1 0 >base ] unit-test-fails
+[ 1 -1 >base ] unit-test-fails
diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor
new file mode 100644 (file)
index 0000000..28cecc0
--- /dev/null
@@ -0,0 +1,104 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math.private namespaces sequences strings arrays
+combinators splitting math ;
+IN: math.parser
+
+DEFER: base>
+
+: string>ratio ( str radix -- a/b )
+    >r "/" split1 r> tuck base> >r base> r>
+    2dup and [ / ] [ 2drop f ] if ;
+
+: digit> ( ch -- n )
+    {
+        { [ dup digit?  ] [ CHAR: 0 - ] }
+        { [ dup letter? ] [ CHAR: a - 10 + ] }
+        { [ dup LETTER? ] [ CHAR: A - 10 + ] }
+        { [ t ] [ drop f ] }
+    } cond ;
+
+: digits>integer ( radix seq -- n )
+    0 rot [ swapd * + ] curry reduce ;
+
+: valid-digits? ( radix seq -- ? )
+    {
+        { [ dup empty? ] [ 2drop f ] }
+        { [ f over memq? ] [ 2drop f ] }
+        { [ t ] [ swap [ < ] curry all? ] }
+    } cond ;
+
+: string>digits ( str -- digits )
+    [ digit> ] { } map-as ;
+
+: string>integer ( str radix -- n/f )
+    swap "-" ?head >r
+    string>digits 2dup valid-digits?
+    [ digits>integer r> [ neg ] when ] [ r> 3drop f ] if ;
+
+: base> ( str radix -- n/f )
+    {
+        { [ CHAR: / pick member? ] [ string>ratio ] }
+        { [ CHAR: . pick member? ] [ drop string>float ] }
+        { [ t ] [ string>integer ] }
+    } cond ;
+
+: string>number ( str -- n/f ) 10 base> ;
+: bin> ( str -- n/f ) 2 base> ;
+: oct> ( str -- n/f ) 8 base> ;
+: hex> ( str -- n/f ) 16 base> ;
+
+: >digit ( n -- ch )
+    dup 10 < [ CHAR: 0 + ] [ 10 - CHAR: a + ] if ;
+
+: integer, ( num radix -- )
+    dup 1 <= [ "Invalid radix" throw ] when
+    dup >r /mod >digit , dup 0 >
+    [ r> integer, ] [ r> 2drop ] if ;
+
+GENERIC# >base 1 ( n radix -- str )
+
+M: integer >base
+    [
+        over 0 < [
+            swap neg swap integer, CHAR: - ,
+        ] [
+            integer,
+        ] if
+    ] "" make reverse ;
+
+M: ratio >base
+    [
+        over numerator over >base %
+        CHAR: / ,
+        swap denominator swap >base %
+    ] "" make ;
+
+: fix-float ( str -- newstr )
+    {
+        {
+            [ CHAR: e over member? ]
+            [ "e" split1 >r fix-float "e" r> 3append ]
+        } {
+            [ CHAR: . over member? ]
+            [ ]
+        } {
+            [ t ]
+            [ ".0" append ]
+        }
+    } cond ;
+
+M: float >base
+    drop {
+        { [ dup 1.0/0.0 = ] [ drop "1.0/0.0" ] }
+        { [ dup -1.0/0.0 = ] [ drop "-1.0/0.0" ] }
+        { [ dup fp-nan? ] [ drop "0.0/0.0" ] }
+        { [ t ] [ float>string fix-float ] }
+    } cond ;
+
+: number>string ( n -- str ) 10 >base ;
+: >bin ( n -- str ) 2 >base ;
+: >oct ( n -- str ) 8 >base ;
+: >hex ( n -- str ) 16 >base ;
+
+: # ( n -- ) number>string % ;
diff --git a/core/math/parser/summary.txt b/core/math/parser/summary.txt
new file mode 100644 (file)
index 0000000..21ecd3e
--- /dev/null
@@ -0,0 +1 @@
+Converting numbers to and from strings
diff --git a/core/math/pow.factor b/core/math/pow.factor
deleted file mode 100644 (file)
index c98ac91..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math
-USING: errors kernel math math-internals ;
-
-: exp ( x -- y ) >rect swap fexp swap polar> ; inline
-: log ( x -- y ) >polar swap flog swap rect> ; inline
-
-GENERIC: sqrt ( x -- y ) foldable
-
-M: complex sqrt >polar swap fsqrt swap 2.0 / polar> ;
-
-M: real sqrt
-    >float dup 0.0 < [ neg fsqrt 0.0 swap rect> ] [ fsqrt ] if ;
-
-GENERIC: (^) ( x y -- z ) foldable
-
-: ^ ( x y -- z )
-    over zero? [
-        dup zero?
-        [ 2drop 0.0/0.0 ] [ 0 < [ drop 1.0/0.0 ] when ] if
-     ] [
-         (^)
-     ] if ; inline
-
-: ^mag ( w abs arg -- magnitude )
-    >r >r >float-rect swap r> swap fpow r> rot * fexp /f ;
-    inline
-
-: ^theta ( w abs arg -- theta )
-    >r >r >float-rect r> flog * swap r> * + ; inline
-
-M: number (^)
-    swap >polar 3dup ^theta >r ^mag r> polar> ;
-
-: ^n ( z w -- z^w )
-    {
-        { [ dup zero? ] [ 2drop 1 ] }
-        { [ dup 1 number= ] [ drop ] }
-        { [ t ] [ over sq over 2 /i ^n -rot 2 mod ^n * ] }
-    } cond ; inline
-
-M: integer (^)
-    dup 0 < [ neg ^n recip ] [ ^n ] if ;
-
-: power-of-2? ( n -- ? )
-    dup 0 > [
-        dup dup neg bitand number=
-    ] [
-        drop f
-    ] if ; foldable
-
-: log2 ( n -- b )
-    {
-        { [ dup 0 <= ] [ "log2 expects positive inputs" throw ] }
-        { [ dup 1 number= ] [ drop 0 ] }
-        { [ t ] [ -1 shift log2 1+ ] }
-    } cond ; foldable
diff --git a/core/math/pow.facts b/core/math/pow.facts
deleted file mode 100644 (file)
index 1aadc4d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-USING: help math ;
-
-HELP: exp
-{ $values { "x" "a complex number" } { "y" "a complex number" } }
-{ $description "Computes the exponential function." } ;
-
-HELP: log
-{ $values { "x" "a complex number" } { "y" "a complex number" } }
-{ $description "Computes the natural logarithm function. Outputs negative infinity if " { $snippet "x" } " is 0." } ;
-
-HELP: sqrt
-{ $values { "x" "a complex number" } { "y" "a complex number" } }
-{ $description "Computes the square root function." } ;
-
-HELP: ^
-{ $values { "x" "a complex number" } { "y" "a complex number" } { "z" "a complex number" } }
-{ $description "Raises " { $snippet "x" } " to the power of " { $snippet "y" } ". If " { $snippet "y" } " is an integer the answer is computed exactly, otherwise a floating point approximation is used." }
-{ $errors "Throws an error if " { $snippet "x" } " and " { $snippet "y" } " are both integer 0." } ;
-
-HELP: power-of-2?
-{ $values { "n" "an integer" } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "n" } " is a power of 2." } ;
-
-HELP: log2
-{ $values { "n" "a positive integer" } { "b" "an integer" } }
-{ $description "Computes the largest integer " { $snippet "b" } " such that " { $snippet "2^b" } " is less than " { $snippet "n" } "." }
-{ $errors "Throws an error if " { $snippet "n" } " is zero or negative." } ;
diff --git a/core/math/random.factor b/core/math/random.factor
deleted file mode 100644 (file)
index d1bee1e..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-! Copyright (C) 2005 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-
-! mersenne twister based on 
-! http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
-
-IN: math-internals
-USING: arrays kernel math namespaces sequences ;
-
-: mt-n 624 ; inline
-: mt-m 397 ; inline
-: mt-a HEX: 9908b0df ; inline
-: mt-hi HEX: 80000000 ; inline
-: mt-lo HEX: 7fffffff ; inline
-
-SYMBOL: mt
-SYMBOL: mti
-
-: mt-nth ( n -- nth )
-    mt get nth ; inline
-
-: mt-formula ( mt mti -- mt[mti] )
-    dup rot nth dup -30 shift bitxor
-    1812433253 * + HEX: ffffffff bitand ; inline
-
-: mt-y ( i0 i1 -- y )
-    mt-nth mt-lo bitand >r mt-nth mt-hi bitand r> bitor ; inline
-    
-: set-mt-ith ( yi0 yi1 mt-set mt-get -- )
-    >r >r mt-y r> r> mt-nth rot dup odd? mt-a 0 ?
-    swap -1 shift bitxor bitxor swap mt get set-nth ; inline
-
-: mt-temper ( y -- yt )
-    dup -11 shift bitxor
-    dup 7 shift HEX: 9d2c5680 bitand bitxor
-    dup 15 shift HEX: efc60000 bitand bitxor
-    dup -18 shift bitxor ; inline
-
-: (generate-mt)
-    dup 2dup >r 1+ r> dup mt-m ;
-
-: generate-mt
-    mt-n mt-m - [ (generate-mt) + set-mt-ith ] repeat
-    mt-m 1- [ dup 227 + (generate-mt) mt-n - + set-mt-ith drop ] repeat
-    mt-n 1- 0 mt-n 1- mt-m 1- set-mt-ith
-    0 mti set ;
-
-IN: math
-
-: init-random ( seed -- )
-    global [
-        mt-n 0 <array> swap
-        HEX: ffffffff bitand 0 pick set-nth
-        mt-n 1- [ 2dup mt-formula 1+ pick pick 1+ swap set-nth ] repeat
-        mt set 0 mti set
-        generate-mt
-    ] bind ;
-
-: (random-int) ( -- rand )
-    global [
-        mti get dup mt-n < [ drop generate-mt 0 ] unless
-        mt-nth mt-temper mti inc
-    ] bind ;
-
-: random-int ( n -- rand ) (random-int) * -32 shift ;
diff --git a/core/math/random.facts b/core/math/random.facts
deleted file mode 100644 (file)
index 82fd750..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-USING: help math ;
-
-HELP: (random-int)
-{ $values { "rand" "an integer between 0 and 2^32-1" } }
-{ $description "Generates a random 32-bit unsigned integer." } ;
-
-HELP: random-int
-{ $values { "rand" "an integer between 0 and n" } }
-{ $description "Outputs a pseudo-random integer in the interval " { $snippet "[0,n)" } "." }
-{ $notes "As per the closed interval notation, the end-points are included in the interval." } ;
diff --git a/core/math/ratio.factor b/core/math/ratio.factor
deleted file mode 100644 (file)
index 74603cd..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math
-USING: generic kernel kernel-internals math math-internals ;
-
-UNION: rational integer ratio ;
-
-M: integer numerator ;
-M: integer denominator drop 1 ;
-
-: >fraction ( a/b -- a b )
-    dup numerator swap denominator ; inline
-
-IN: math-internals
-
-: 2>fraction ( a/b c/d -- a c b d )
-    [ >fraction ] 2apply swapd ; inline
-
-M: ratio number=
-    2>fraction number= [ number= ] [ 2drop f ] if ;
-
-: scale ( a/b c/d -- a*d b*c )
-    2>fraction >r * swap r> * swap ; inline
-
-: ratio+d ( a/b c/d -- b*d )
-    denominator swap denominator * ; inline
-
-M: ratio >fixnum >fraction /i >fixnum ;
-M: ratio >bignum >fraction /i >bignum ;
-
-M: ratio < scale < ;
-M: ratio <= scale <= ;
-M: ratio > scale > ;
-M: ratio >= scale >= ;
-
-M: ratio + 2dup scale + -rot ratio+d / ;
-M: ratio - 2dup scale - -rot ratio+d / ;
-M: ratio * 2>fraction * >r * r> / ;
-M: ratio / scale / ;
-M: ratio /i scale /i ;
-M: ratio mod 2dup >r >r /i r> r> rot * - ;
diff --git a/core/math/ratio.facts b/core/math/ratio.facts
deleted file mode 100644 (file)
index b9ce9f2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-USING: help math math-internals ;
-
-HELP: ratio
-{ $class-description "The class of rational numbers with denominator not equal to 1." } ;
-
-HELP: rational
-{ $class-description "The class of rational numbers, a disjoint union of integers and ratios." } ;
-
-HELP: numerator ( a/b -- a )
-{ $values { "a/b" "a rational number" } { "a" "an integer" } }
-{ $description "Outputs the numerator of a rational number. Acts as the identity on integers." } ;
-
-HELP: denominator ( a/b -- b )
-{ $values { "a/b" "a rational number" } { "b" "a positive integer" } }
-{ $description "Outputs the denominator of a rational number. Always outputs 1 with integers." } ;
-
-HELP: >fraction
-{ $values { "a/b" "a rational number" } { "a" "an integer" } { "b" "a positive integer" } }
-{ $description "Extracts the numerator and denominator of a rational number." } ;
-
-HELP: 2>fraction
-{ $values { "a/b" "a rational number" } { "a" "an integer" } { "c" "an integer" } { "b" "a positive integer" } { "d" "a positive integer" } }
-{ $description "Extracts the numerator and denominator of two rational numbers at once." } ;
-
-HELP: (fraction>) ( a b -- a/b )
-{ $values { "a" "an integer" } { "b" "an integer" } { "a/b" "a ratio" } }
-{ $description "Primitive ratio constructor. User code should call " { $link / } " to create ratios instead." } ;
diff --git a/core/math/ratios/authors.txt b/core/math/ratios/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/ratios/ratios-docs.factor b/core/math/ratios/ratios-docs.factor
new file mode 100644 (file)
index 0000000..d661a68
--- /dev/null
@@ -0,0 +1,47 @@
+USING: help.markup help.syntax math math.private
+math.ratios.private ;
+IN: math.ratios
+
+ARTICLE: "rationals" "Rational numbers"
+{ $subsection ratio }
+"When we add, subtract or multiply any two integers, the result is always an integer. However, dividing a numerator by a denominator that is not an integral divisor of the denominator yields a ratio:"
+{ $example "1210 11 / ." "110" }
+{ $example "100 330 / ." "10/33" }
+"Ratios are printed and can be input literally in the form above. Ratios are always reduced to lowest terms by factoring out the greatest common divisor of the numerator and denominator. A ratio with a denominator of 1 becomes an integer. Division with a denominator of 0 throws an error."
+$nl
+"Ratios behave just like any other number -- all numerical operations work as you would expect."
+{ $example "1/2 1/3 + ." "5/6" }
+{ $example "100 6 / 3 * ." "50" }
+"Ratios can be taken apart:"
+{ $subsection numerator }
+{ $subsection denominator }
+{ $subsection >fraction }
+{ $see-also "syntax-ratios" } ;
+
+ABOUT: "rationals"
+
+HELP: ratio
+{ $class-description "The class of rational numbers with denominator not equal to 1." } ;
+
+HELP: rational
+{ $class-description "The class of rational numbers, a disjoint union of integers and ratios." } ;
+
+HELP: numerator ( a/b -- a )
+{ $values { "a/b" rational } { "a" integer } }
+{ $description "Outputs the numerator of a rational number. Acts as the identity on integers." } ;
+
+HELP: denominator ( a/b -- b )
+{ $values { "a/b" rational } { "b" "a positive integer" } }
+{ $description "Outputs the denominator of a rational number. Always outputs 1 with integers." } ;
+
+HELP: >fraction
+{ $values { "a/b" rational } { "a" integer } { "b" "a positive integer" } }
+{ $description "Extracts the numerator and denominator of a rational number." } ;
+
+HELP: 2>fraction
+{ $values { "a/b" rational } { "c/d" rational } { "a" integer } { "c" integer } { "b" "a positive integer" } { "d" "a positive integer" } }
+{ $description "Extracts the numerator and denominator of two rational numbers at once." } ;
+
+HELP: <ratio> ( a b -- a/b )
+{ $values { "a" integer } { "b" integer } { "a/b" "a ratio" } }
+{ $description "Primitive ratio constructor. User code should call " { $link / } " to create ratios instead." } ;
diff --git a/core/math/ratios/ratios-tests.factor b/core/math/ratios/ratios-tests.factor
new file mode 100644 (file)
index 0000000..46e60f9
--- /dev/null
@@ -0,0 +1,81 @@
+USING: kernel math tools.test ;
+IN: temporary
+
+[ 1 2 ] [ 1/2 >fraction ] unit-test
+
+[ 1/2 ] [ 1 >bignum 2 >bignum / ] unit-test
+[ t ] [ 10 3 / ratio? ] unit-test
+[ f ] [ 10 2 / ratio? ] unit-test
+[ 10 ] [ 10 numerator ] unit-test
+[ 1 ] [ 10 denominator ] unit-test
+[ 12 ] [ -12 -13 / numerator ] unit-test
+[ 13 ] [ -12 -13 / denominator ] unit-test
+[ 1 ] [ -1 -1 / numerator ] unit-test
+[ 1 ] [ -1 -1 / denominator ] unit-test
+
+[ -1 ] [ 2 -2 / ] unit-test
+[ -1 ] [ -2 2 / ] unit-test
+
+[ t ] [ 1 3 / 1 3 / = ] unit-test
+
+[ -10 ] [ -100 10 /i ] unit-test
+[ 10 ] [ -100 -10 /i ] unit-test
+[ -10 ] [ 100 -10 /i ] unit-test
+[ -10 ] [ -100 >bignum 10 >bignum /i ] unit-test
+[ 10  ] [ -100 >bignum -10 >bignum /i ] unit-test
+[ -10 ] [ 100 >bignum -10 >bignum /i ] unit-test
+
+[ 3/2 ] [ 1 1/2 + ] unit-test
+[ 3/2 ] [ 1 >bignum 1/2 + ] unit-test
+[ -1/2 ] [ 1/2 1 - ] unit-test
+[ -1/2 ] [ 1/2 1 >bignum - ] unit-test
+[ 41/20 ] [ 5/4 4/5 + ] unit-test
+
+[ 1 ] [ 1/2 2 * ] unit-test
+[ 1/3 ] [ 1/2 2/3 * ] unit-test
+
+[ 1 ] [ 1/2 1/2 / ] unit-test
+[ 27/4 ] [ 3/2 2/9 / ] unit-test
+
+[ t ] [ 5768 476343 < ] unit-test
+[ t ] [ 5768 476343 <= ] unit-test
+[ f ] [ 5768 476343 > ] unit-test
+[ f ] [ 5768 476343 >= ] unit-test
+[ t ] [ 3434 >bignum 3434 >= ] unit-test
+[ t ] [ 3434 3434 >bignum <= ] unit-test
+
+[ t ] [ 1 1/3 > ] unit-test
+[ t ] [ 2/3 3/4 <= ] unit-test
+[ f ] [ -2/3 1/3 > ] unit-test
+
+[ t ] [ 1000000000/999999 1000 > ] unit-test
+[ f ] [ 100000 100000000000/999999 > ] unit-test
+[ t ]
+[ 1000000000000/999999999999 1000000000001/999999999998 < ]
+unit-test
+
+[ -3 ] [ -3 10 mod ] unit-test
+[ 7 ] [ -3 10 rem ] unit-test
+[ 7 ] [ -13 10 rem ] unit-test
+[ 0 ] [ 37 37 rem ] unit-test
+
+[ -1 ] [ -12.55 sgn ] unit-test
+[ 1 ] [ 100000000000000000000000000000000 sgn ] unit-test
+[ 0 ] [ 0.0 sgn ] unit-test
+
+[ 1/2 ] [ 1/2 1 mod ] unit-test
+[ 1/3 ] [ 10/3 3 mod ] unit-test
+[ -1/3 ] [ -10/3 3 mod ] unit-test
+
+[ 5 ] [ 5 floor ] unit-test
+[ -5 ] [ -5 floor ] unit-test
+[ 6 ] [ 6 truncate ] unit-test
+[ 3 ] [ 10/3 floor ] unit-test
+[ -4 ] [ -10/3 floor ] unit-test
+[ 4 ] [ 10/3 ceiling ] unit-test
+[ -3 ] [ -10/3 ceiling ] unit-test
+[ 3 ] [ 10/3 truncate ] unit-test
+[ -3 ] [ -10/3 truncate ] unit-test
+
+[ -1/2 ] [ 1/2 1- ] unit-test
+[ 3/2 ] [ 1/2 1+ ] unit-test
diff --git a/core/math/ratios/ratios.factor b/core/math/ratios/ratios.factor
new file mode 100644 (file)
index 0000000..4dfc084
--- /dev/null
@@ -0,0 +1,44 @@
+! Copyright (C) 2004, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: math.ratios.private
+USING: kernel kernel.private math math.functions
+math.private ;
+
+: fraction> ( a b -- a/b )
+    dup 1 number= [ drop ] [ <ratio> ] if ; inline
+
+M: integer /
+    dup zero? [
+        /i
+    ] [
+        dup 0 < [ [ neg ] 2apply ] when
+        2dup gcd nip tuck /i >r /i r> fraction>
+    ] if ;
+
+: 2>fraction ( a/b c/d -- a c b d )
+    [ >fraction ] 2apply swapd ; inline
+
+: scale ( a/b c/d -- a*d b*c )
+    2>fraction >r * swap r> * swap ; inline
+
+: ratio+d ( a/b c/d -- b*d )
+    denominator swap denominator * ; inline
+
+M: ratio number=
+    2>fraction number= [ number= ] [ 2drop f ] if ;
+
+M: ratio >fixnum >fraction /i >fixnum ;
+M: ratio >bignum >fraction /i >bignum ;
+M: ratio >float >fraction /f ;
+
+M: ratio < scale < ;
+M: ratio <= scale <= ;
+M: ratio > scale > ;
+M: ratio >= scale >= ;
+
+M: ratio + 2dup scale + -rot ratio+d / ;
+M: ratio - 2dup scale - -rot ratio+d / ;
+M: ratio * 2>fraction * >r * r> / ;
+M: ratio / scale / ;
+M: ratio /i scale /i ;
+M: ratio mod 2dup >r >r /i r> r> rot * - ;
diff --git a/core/math/ratios/summary.txt b/core/math/ratios/summary.txt
new file mode 100644 (file)
index 0000000..6077e3d
--- /dev/null
@@ -0,0 +1 @@
+Rational number implementation
diff --git a/core/math/summary.txt b/core/math/summary.txt
new file mode 100644 (file)
index 0000000..4830568
--- /dev/null
@@ -0,0 +1 @@
+Arithmetic
diff --git a/core/math/trig-hyp.factor b/core/math/trig-hyp.factor
deleted file mode 100644 (file)
index 3a0654e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math
-USING: kernel math math-internals ;
-
-: cos ( x -- y )
-    >float-rect 2dup
-    fcosh swap fcos * -rot
-    fsinh swap fsin neg * rect> ; foldable
-
-: sec ( x -- y ) cos recip ; inline
-
-: cosh ( x -- y )
-    >float-rect 2dup
-    fcos swap fcosh * -rot
-    fsin swap fsinh * rect> ; foldable
-
-: sech ( x -- y ) cosh recip ; inline
-
-: sin ( x -- y )
-    >float-rect 2dup
-    fcosh swap fsin * -rot
-    fsinh swap fcos * rect> ; foldable
-
-: cosec ( x -- y ) sin recip ; inline
-
-: sinh ( x -- y )
-    >float-rect 2dup
-    fcos swap fsinh * -rot
-    fsin swap fcosh * rect> ; foldable
-
-: cosech ( x -- y ) sinh recip ; inline
-
-: tan ( x -- y ) dup sin swap cos / ; inline
-: tanh ( x -- y ) dup sinh swap cosh / ; inline
-: cot ( x -- y ) dup cos swap sin / ; inline
-: coth ( x -- y ) dup cosh swap sinh / ; inline
diff --git a/core/math/trig-hyp.facts b/core/math/trig-hyp.facts
deleted file mode 100644 (file)
index 45162aa..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-USING: help math ;
-
-HELP: cosh
-$values-x/y
-{ $description "Hyperbolic cosine." } ;
-
-HELP: sech
-$values-x/y
-{ $description "Hyperbolic secant." } ;
-
-HELP: sinh
-$values-x/y
-{ $description "Hyperbolic sine." } ;
-
-HELP: sinh
-$values-x/y
-{ $description "Hyperbolic sine." } ;
-
-HELP: cosech
-$values-x/y
-{ $description "Hyperbolic cosecant." } ;
-
-HELP: tanh
-$values-x/y
-{ $description "Hyperbolic tangent." } ;
-
-HELP: coth
-$values-x/y
-{ $description "Hyperbolic cotangent." } ;
-
-HELP: cos
-$values-x/y
-{ $description "Trigonometric cosine." } ;
-
-HELP: sec
-$values-x/y
-{ $description "Trigonometric secant." } ;
-
-HELP: sin
-$values-x/y
-{ $description "Trigonometric sine." } ;
-
-HELP: sin
-$values-x/y
-{ $description "Trigonometric sine." } ;
-
-HELP: cosec
-$values-x/y
-{ $description "Trigonometric cosecant." } ;
-
-HELP: tan
-$values-x/y
-{ $description "Trigonometric tangent." } ;
-
-HELP: cot
-$values-x/y
-{ $description "Trigonometric cotangent." } ;
diff --git a/core/math/vectors.factor b/core/math/vectors.factor
deleted file mode 100644 (file)
index 7c7924f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: math
-USING: arrays generic kernel sequences ;
-
-: vneg ( u -- v ) [ neg ] map ;
-
-: n*v ( n u -- v ) [ * ] map-with ;
-: v*n ( n u -- v ) swap n*v ;
-: n/v ( n u -- v ) [ / ] map-with ;
-: v/n ( u n -- v ) swap [ swap / ] map-with ;
-
-: v+   ( u v -- w ) [ + ] 2map ;
-: v-   ( u v -- w ) [ - ] 2map ;
-: [v-] ( u v -- w ) [ [-] ] 2map ;
-: v*   ( u v -- w ) [ * ] 2map ;
-: v/   ( u v -- w ) [ / ] 2map ;
-: vmax ( u v -- w ) [ max ] 2map ;
-: vmin ( u v -- w ) [ min ] 2map ;
-
-: v. ( v v -- x ) 0 [ * + ] 2reduce ;
-: norm-sq ( v -- x ) 0 [ absq + ] reduce ;
-: norm ( vec -- x ) norm-sq sqrt ;
-: normalize ( u -- v ) dup norm v/n ;
-
-: set-axis ( u v axis -- w )
-    dup length [ >r zero? pick pick ? r> swap nth ] 2map 2nip ;
-
-: sum ( seq -- n ) 0 [ + ] reduce ;
-: product ( seq -- n ) 1 [ * ] reduce ;
-
-: infimum ( seq -- n ) 1./0. [ min ] reduce ;
-: supremum ( seq -- n ) -1./0. [ max ] reduce ;
diff --git a/core/math/vectors.facts b/core/math/vectors.facts
deleted file mode 100644 (file)
index 2726172..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-USING: help math ;
-
-HELP: vneg
-{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
-{ $description "Negates each element of " { $snippet "u" } "." } ;
-
-HELP: n*v
-{ $values { "n" "a number" } { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
-{ $description "Multiplies each element of " { $snippet "u" } " by " { $snippet "n" } "." } ;
-
-HELP: v*n
-{ $values { "n" "a number" } { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
-{ $description "Multiplies each element of " { $snippet "u" } " by " { $snippet "n" } "." } ;
-
-HELP: n/v
-{ $values { "n" "a number" } { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
-{ $description "Divides " { $snippet "n" } " by each element of " { $snippet "u" } "." } ;
-
-HELP: v/n
-{ $values { "u" "a sequence of numbers" } { "n" "a number" } { "v" "a sequence of numbers" } }
-{ $description "Divides each element of " { $snippet "u" } " by " { $snippet "n" } "." } ;
-
-HELP: v+
-{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
-{ $description "Adds " { $snippet "u" } " and " { $snippet "v" } " component-wise." } ;
-
-HELP: v-
-{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
-{ $description "Subtracts " { $snippet "v" } " from " { $snippet "u" } " component-wise." } ;
-
-HELP: v*
-{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
-{ $description "Multiplies " { $snippet "u" } " and " { $snippet "v" } " component-wise." } ;
-
-HELP: v/
-{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
-{ $description "Divides " { $snippet "u" } " by " { $snippet "v" } " component-wise." }
-{ $errors "Throws an error if an integer division by zero occurs." } ;
-
-HELP: vmax
-{ $values { "u" "a sequence of real numbers" } { "v" "a sequence of real numbers" } { "w" "a sequence of real numbers" } }
-{ $description "Creates a sequence where each element is the maximum of the corresponding elements from " { $snippet "u" } " andd " { $snippet "v" } "." }
-{ $examples { $example "{ 1 2 5 } { -7 6 3 } vmax ." "{ 1 6 5 }" } } ;
-
-HELP: vmin
-{ $values { "u" "a sequence of real numbers" } { "v" "a sequence of real numbers" } { "w" "a sequence of real numbers" } }
-{ $description "Creates a sequence where each element is the minimum of the corresponding elements from " { $snippet "u" } " andd " { $snippet "v" } "." }
-{ $examples { $example "{ 1 2 5 } { -7 6 3 } vmin ." "{ -7 2 3 }" } } ;
-
-HELP: v.
-{ $values { "u" "a sequence of real numbers" } { "v" "a sequence of real numbers" } { "x" "a real number" } }
-{ $description "Computes the real-valued dot product." }
-{ $notes
-    "This word can also take complex number sequences as input, however mathematically it will compute the wrong result. The complex-valued dot product is defined differently:"
-    { $snippet "0 [ conjugate * + ] 2reduce" }
-} ;
-
-HELP: norm-sq
-{ $values { "v" "a sequence of numbers" } { "x" "a non-negative real number" } }
-{ $description "Computes the squared length of a mathematical vector." } ;
-
-HELP: norm
-{ $values { "v" "a sequence of numbers" } { "x" "a non-negative real number" } }
-{ $description "Computes the length of a mathematical vector." } ;
-
-HELP: normalize
-{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
-{ $description "Computes a mathematical vector with the same direction but length 1." }
-{ $errors "Throws an error if " { $snippet "v" } " has zero length." } ;
-
-HELP: set-axis
-{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
-{ $description "Using " { $snippet "w" } " as a template, creates a new sequence containing corresponding elements from " { $snippet "x" } " in place of 0, and corresponding elements from " { $snippet "y" } " in place of 1." }
-{ $examples { $example "{ 1 2 3 } { 4 5 6 } { 0 1 0 } set-axis ." "{ 1 5 3 }" } } ;
-
-HELP: sum
-{ $values { "seq" "a sequence of numbers" } { "n" "a number" } }
-{ $description "Outputs the sum of all elements of " { $snippet "seq" } ". Outputs zero given an empty sequence." } ;
-
-HELP: product
-{ $values { "seq" "a sequence of numbers" } { "n" "a number" } }
-{ $description "Outputs the product of all elements of " { $snippet "seq" } ". Outputs one given an empty sequence." } ;
-
-HELP: infimum
-{ $values { "seq" "a sequence of real numbers" } { "n" "a number" } }
-{ $description "Outputs the least element of " { $snippet "seq" } ". Outputs positive infinity given an empty sequence." } ;
-
-HELP: supremum
-{ $values { "seq" "a sequence of real numbers" } { "n" "a number" } }
-{ $description "Outputs the greatest element of " { $snippet "seq" } ". Outputs negative infinity given an empty sequence." } ;
diff --git a/core/math/vectors/authors.txt b/core/math/vectors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/math/vectors/summary.txt b/core/math/vectors/summary.txt
new file mode 100644 (file)
index 0000000..319b42b
--- /dev/null
@@ -0,0 +1 @@
+Vector arithmetic
diff --git a/core/math/vectors/vectors-docs.factor b/core/math/vectors/vectors-docs.factor
new file mode 100644 (file)
index 0000000..a97ab7c
--- /dev/null
@@ -0,0 +1,125 @@
+USING: help.markup help.syntax math sequences ;
+IN: math.vectors
+
+ARTICLE: "math-vectors" "Vector arithmetic"
+"Any Factor sequence can be used to represent a mathematical vector."
+$nl
+"Acting on vectors by a scalar:"
+{ $subsection vneg }
+{ $subsection v*n }
+{ $subsection n*v }
+{ $subsection v/n }
+{ $subsection n/v }
+"Combining two vectors to form another vector with " { $link 2map } ":"
+{ $subsection v+ }
+{ $subsection v- }
+{ $subsection v* }
+{ $subsection v/ }
+{ $subsection vmax }
+{ $subsection vmin }
+"Inner product and norm:"
+{ $subsection v. }
+{ $subsection norm }
+{ $subsection norm-sq }
+{ $subsection normalize }
+"Combining all the values in a vector into a scalar with " { $link reduce } ":"
+{ $subsection sum }
+{ $subsection product }
+{ $subsection supremum }
+{ $subsection infimum } ;
+
+ABOUT: "math-vectors"
+
+HELP: vneg
+{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
+{ $description "Negates each element of " { $snippet "u" } "." } ;
+
+HELP: n*v
+{ $values { "n" "a number" } { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
+{ $description "Multiplies each element of " { $snippet "u" } " by " { $snippet "n" } "." } ;
+
+HELP: v*n
+{ $values { "n" "a number" } { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
+{ $description "Multiplies each element of " { $snippet "u" } " by " { $snippet "n" } "." } ;
+
+HELP: n/v
+{ $values { "n" "a number" } { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } }
+{ $description "Divides " { $snippet "n" } " by each element of " { $snippet "u" } "." } ;
+
+HELP: v/n
+{ $values { "u" "a sequence of numbers" } { "n" "a number" } { "v" "a sequence of numbers" } }
+{ $description "Divides each element of " { $snippet "u" } " by " { $snippet "n" } "." } ;
+
+HELP: v+
+{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
+{ $description "Adds " { $snippet "u" } " and " { $snippet "v" } " component-wise." } ;
+
+HELP: v-
+{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
+{ $description "Subtracts " { $snippet "v" } " from " { $snippet "u" } " component-wise." } ;
+
+HELP: [v-]
+{ $values { "u" "a sequence of real numbers" } { "v" "a sequence of real numbers" } { "w" "a sequence of real numbers" } }
+{ $description "Subtracts " { $snippet "v" } " from " { $snippet "u" } " component-wise; any components which become negative are set to zero." } ;
+
+HELP: v*
+{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
+{ $description "Multiplies " { $snippet "u" } " and " { $snippet "v" } " component-wise." } ;
+
+HELP: v/
+{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "w" "a sequence of numbers" } }
+{ $description "Divides " { $snippet "u" } " by " { $snippet "v" } " component-wise." }
+{ $errors "Throws an error if an integer division by zero occurs." } ;
+
+HELP: vmax
+{ $values { "u" "a sequence of real numbers" } { "v" "a sequence of real numbers" } { "w" "a sequence of real numbers" } }
+{ $description "Creates a sequence where each element is the maximum of the corresponding elements from " { $snippet "u" } " andd " { $snippet "v" } "." }
+{ $examples { $example "USE: math.vectors" "{ 1 2 5 } { -7 6 3 } vmax ." "{ 1 6 5 }" } } ;
+
+HELP: vmin
+{ $values { "u" "a sequence of real numbers" } { "v" "a sequence of real numbers" } { "w" "a sequence of real numbers" } }
+{ $description "Creates a sequence where each element is the minimum of the corresponding elements from " { $snippet "u" } " andd " { $snippet "v" } "." }
+{ $examples { $example "USE: math.vectors" "{ 1 2 5 } { -7 6 3 } vmin ." "{ -7 2 3 }" } } ;
+
+HELP: v.
+{ $values { "u" "a sequence of real numbers" } { "v" "a sequence of real numbers" } { "x" "a real number" } }
+{ $description "Computes the real-valued dot product." }
+{ $notes
+    "This word can also take complex number sequences as input, however mathematically it will compute the wrong result. The complex-valued dot product is defined differently:"
+    { $snippet "0 [ conjugate * + ] 2reduce" }
+} ;
+
+HELP: norm-sq
+{ $values { "v" "a sequence of numbers" } { "x" "a non-negative real number" } }
+{ $description "Computes the squared length of a mathematical vector." } ;
+
+HELP: norm
+{ $values { "v" "a sequence of numbers" } { "x" "a non-negative real number" } }
+{ $description "Computes the length of a mathematical vector." } ;
+
+HELP: normalize
+{ $values { "u" "a sequence of numbers, not all zero" } { "v" "a sequence of numbers" } }
+{ $description "Outputs a vector with the same direction as " { $snippet "u" } " but length 1." } ;
+
+HELP: set-axis
+{ $values { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } { "axis" "a sequence of 0/1" } { "w" "a sequence of numbers" } }
+{ $description "Using " { $snippet "w" } " as a template, creates a new sequence containing corresponding elements from " { $snippet "u" } " in place of 0, and corresponding elements from " { $snippet "v" } " in place of 1." }
+{ $examples { $example "USE: math.vectors" "{ 1 2 3 } { 4 5 6 } { 0 1 0 } set-axis ." "{ 1 5 3 }" } } ;
+
+HELP: sum
+{ $values { "seq" "a sequence of numbers" } { "n" "a number" } }
+{ $description "Outputs the sum of all elements of " { $snippet "seq" } ". Outputs zero given an empty sequence." } ;
+
+HELP: product
+{ $values { "seq" "a sequence of numbers" } { "n" "a number" } }
+{ $description "Outputs the product of all elements of " { $snippet "seq" } ". Outputs one given an empty sequence." } ;
+
+HELP: infimum
+{ $values { "seq" "a sequence of real numbers" } { "n" "a number" } }
+{ $description "Outputs the least element of " { $snippet "seq" } "." }
+{ $errors "Throws an error if the sequence is empty." } ;
+
+HELP: supremum
+{ $values { "seq" "a sequence of real numbers" } { "n" "a number" } }
+{ $description "Outputs the greatest element of " { $snippet "seq" } "." }
+{ $errors "Throws an error if the sequence is empty." } ;
diff --git a/core/math/vectors/vectors-tests.factor b/core/math/vectors/vectors-tests.factor
new file mode 100644 (file)
index 0000000..924dc16
--- /dev/null
@@ -0,0 +1,7 @@
+IN: temporary
+USING: math.vectors tools.test ;
+
+[ { 1 2 3 } ] [ 1/2 { 2 4 6 } n*v ] unit-test
+[ { 1 2 3 } ] [ { 2 4 6 } 1/2 v*n ] unit-test
+[ { 1 2 3 } ] [ { 2 4 6 } 2 v/n ] unit-test
+[ { 1/1 1/2 1/3 } ] [ 1 { 1 2 3 } n/v ] unit-test
diff --git a/core/math/vectors/vectors.factor b/core/math/vectors/vectors.factor
new file mode 100644 (file)
index 0000000..ab7a1e8
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel sequences math math.functions ;
+IN: math.vectors
+
+: vneg ( u -- v ) [ neg ] map ;
+
+: v*n ( u n -- v ) [ * ] curry map ;
+: n*v ( n u -- v ) [ * ] curry* map ;
+: v/n ( u n -- v ) [ / ] curry map ;
+: n/v ( n u -- v ) [ / ] curry* map ;
+
+: v+   ( u v -- w ) [ + ] 2map ;
+: v-   ( u v -- w ) [ - ] 2map ;
+: [v-] ( u v -- w ) [ [-] ] 2map ;
+: v*   ( u v -- w ) [ * ] 2map ;
+: v/   ( u v -- w ) [ / ] 2map ;
+: vmax ( u v -- w ) [ max ] 2map ;
+: vmin ( u v -- w ) [ min ] 2map ;
+
+: v. ( u v -- x ) 0 [ * + ] 2reduce ;
+: norm-sq ( v -- x ) 0 [ absq + ] reduce ;
+: norm ( v -- x ) norm-sq sqrt ;
+: normalize ( u -- v ) dup norm v/n ;
+
+: set-axis ( u v axis -- w )
+    dup length [ >r zero? pick pick ? r> swap nth ] 2map 2nip ;
+
+: sum ( seq -- n ) 0 [ + ] reduce ;
+: product ( seq -- n ) 1 [ * ] reduce ;
+
+: infimum ( seq -- n ) dup first [ min ] reduce ;
+: supremum ( seq -- n ) dup first [ max ] reduce ;
diff --git a/core/memory/authors.txt b/core/memory/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/memory/memory-docs.factor b/core/memory/memory-docs.factor
new file mode 100644 (file)
index 0000000..80670a6
--- /dev/null
@@ -0,0 +1,83 @@
+USING: help.markup help.syntax debugger sequences kernel ;
+IN: memory
+
+ARTICLE: "memory" "Object memory"
+"You can query memory status:"
+{ $subsection data-room }
+{ $subsection code-room }
+"There are a pair of combinators, analogous to " { $link each } " and " { $link subset } ", which operate on the entire collection of objects in the object heap:"
+{ $subsection each-object }
+{ $subsection instances }
+"You can check an object's the heap memory usage:"
+{ $subsection size }
+"The garbage collector can be invoked manually:"
+{ $subsection data-gc }
+{ $subsection code-gc }
+"The current image can be saved:"
+{ $subsection save }
+{ $subsection save-image }
+{ $subsection save-image-and-exit }
+{ $see-also "tools.memory" } ;
+
+ABOUT: "memory"
+
+HELP: begin-scan ( -- )
+{ $description "Moves all objects to tenured space, disables the garbage collector, and resets the heap scan pointer to point at the first object in the heap. The " { $link next-object } " word can then be called to advance the heap scan pointer and return successive objects."
+$nl
+"This word must always be paired with a call to " { $link end-scan } "." }
+{ $notes "This is a low-level facility and can be dangerous. Use the " { $link each-object } " combinator instead." } ;
+
+HELP: next-object ( -- obj )
+{ $values { "obj" object } }
+{ $description "Outputs the object at the heap scan pointer, and then advances the heap scan pointer. If the end of the heap has been reached, outputs " { $link f } ". This is unambiguous since the " { $link f } " object is tagged immediate and not actually stored in the heap." }
+{ $errors "Throws a " { $link heap-scan-error. } " if called outside a " { $link begin-scan } "/" { $link end-scan } " pair." }
+{ $notes "This is a low-level facility and can be dangerous. Use the " { $link each-object } " combinator instead." } ;
+
+HELP: end-scan ( -- )
+{ $description "Finishes a heap iteration by re-enabling the garbage collector. This word must always be paired with a call to " { $link begin-scan } "." }
+{ $notes "This is a low-level facility and can be dangerous. Use the " { $link each-object } " combinator instead." } ;
+
+HELP: each-object
+{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
+{ $description "Applies a quotation to each object in the heap. The garbage collector is switched off while this combinator runs, so the given quotation must not allocate too much memory." }
+{ $notes "This word is the low-level facility used to implement the " { $link instances } " word." } ;
+
+HELP: instances
+{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- ? )" } } { "seq" "a fresh sequence" } }
+{ $description "Outputs a sequence of all objects in the heap which satisfy the quotation." }
+{ $notes "This word relies on " { $link each-object } ", so in particular the garbage collector is switched off while it runs and the given quotation must not allocate too much memory." } ;
+
+HELP: data-gc ( -- )
+{ $description "Performs a full garbage collection." } ;
+
+HELP: code-gc ( -- )
+{ $description "Collects all generations up to and including tenured space, and also collects the code heap." } ;
+
+HELP: gc-time ( -- n )
+{ $values { "n" "a timestamp in milliseconds" } }
+{ $description "Outputs the total time spent in garbage collection during this Factor session." } ;
+
+HELP: data-room ( -- cards semi generations )
+{ $values { "cards" "number of bytes reserved for card marking" } { "semi" "number of bytes reserved for tenured semi-space" } { "generations" "array of free/total bytes pairs" } }
+{ $description "Queries the runtime for memory usage information." } ;
+
+HELP: code-room ( -- code-free code-total )
+{ $values { "code-free" "bytes free in the code heap" } { "code-total" "total bytes in the code heap" } }
+{ $description "Queries the runtime for memory usage information." } ;
+
+HELP: size ( obj -- n )
+{ $values { "obj" "an object" } { "n" "a size in bytes" } }
+{ $description "Outputs the size of the object in memory, in bytes. Tagged immediate objects such as fixnums and " { $link f } " will yield a size of 0." } ;
+
+HELP: save-image ( path -- )
+{ $values { "path" "a pathname string" } }
+{ $description "Saves a snapshot of the heap to the given file, overwriting the file if it already exists." } ;
+
+HELP: save-image-and-exit ( path -- )
+{ $values { "path" "a pathname string" } }
+{ $description "Saves a snapshot of the heap to the given file, overwriting the file if it already exists. This word compacts the code heap and immediately exits Factor, since the Factor VM cannot continue executing after compiled code blocks have been moved around." } ;
+
+{ save save-image save-image-and-exit } related-words
+
+HELP: save
+{ $description "Saves a snapshot of the heap to the current image file." } ;
diff --git a/core/memory/memory-tests.factor b/core/memory/memory-tests.factor
new file mode 100644 (file)
index 0000000..98d2779
--- /dev/null
@@ -0,0 +1,15 @@
+USING: generic kernel kernel.private math memory prettyprint
+sequences tools.test words namespaces layouts classes ;
+IN: temporary
+
+TUPLE: testing x y z ;
+
+[ ] [
+    num-types get [
+        type>class [
+            "predicate" word-prop instances [
+                class drop
+            ] each
+        ] when*
+    ] each
+] unit-test
diff --git a/core/memory/memory.factor b/core/memory/memory.factor
new file mode 100644 (file)
index 0000000..62be94d
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: memory
+USING: arrays kernel sequences vectors system ;
+
+: (each-object) ( quot -- )
+    next-object dup
+    [ swap [ call ] keep (each-object) ] [ 2drop ] if ; inline
+
+: each-object ( quot -- )
+    begin-scan (each-object) end-scan ; inline
+
+: instances ( quot -- seq )
+    pusher >r each-object r> >array ; inline
+
+: save ( -- ) image save-image ;
diff --git a/core/memory/summary.txt b/core/memory/summary.txt
new file mode 100644 (file)
index 0000000..2be70cd
--- /dev/null
@@ -0,0 +1 @@
+Heap introspection support
diff --git a/core/memory/tags.txt b/core/memory/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/core/mirrors/authors.txt b/core/mirrors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/mirrors/mirrors-docs.factor b/core/mirrors/mirrors-docs.factor
new file mode 100644 (file)
index 0000000..ae40c85
--- /dev/null
@@ -0,0 +1,51 @@
+USING: help.markup help.syntax slots kernel assocs sequences ;
+IN: mirrors
+
+ARTICLE: "mirrors" "Mirrors"
+"A reflective view of an object's slots and their values:"
+{ $subsection mirror }
+{ $subsection <mirror> }
+"A view of a sequence as an associative structure:"
+{ $subsection enum }
+{ $subsection <enum> }
+"Utility word used by developer tools which inspect objects:"
+{ $subsection make-mirror } ;
+
+ABOUT: "mirrors"
+
+HELP: object-slots
+{ $values { "obj" object } { "seq" "a sequence of " { $link slot-spec } " instances" } }
+{ $description "Outputs a sequence of slot specifiers for the object." } ;
+
+HELP: mirror
+{ $class-description "An associative structure which wraps an object and presents itself as a mapping from slot names to the object's slot values. Mirrors are used to build reflective developer tools."
+$nl
+"Mirrors are mutable, however new keys cannot be inserted and keys cannot be deleted, only values of existing keys can be changed."
+$nl
+"Mirrors are created by calling " { $link <mirror> } " or " { $link make-mirror } "." } ;
+
+HELP: <mirror>
+{ $values { "object" object } { "mirror" mirror } } 
+{ $description "Creates a " { $link mirror } " reflecting an object." }
+{ $examples
+    { $example
+        "USING: assocs mirrors ;"
+        "TUPLE: circle center radius ;"
+        "C: <circle> circle"
+        "{ 100 50 } 15 <circle> <mirror> >alist ."
+        "{ { circle-center { 100 50 } } { circle-radius 15 } }"
+    }
+} ;
+
+HELP: >mirror<
+{ $values { "mirror" mirror } { "obj" object } { "slots" "a sequence of " { $link slot-spec } " instances" } }
+{ $description "Pushes the object being viewed in the mirror together with its slots." } ;
+
+HELP: enum
+{ $class-description "An associative structure which wraps a sequence and maps integers to the corresponding elements of the sequence."
+$nl
+"Enumerations are mutable; note that deleting a key calls " { $link delete-nth } ", which results in all subsequent elements being shifted down." } ;
+
+HELP: make-mirror
+{ $values { "obj" object } { "assoc" "an assoc" } }
+{ $description "Creates an assoc which reflects the internal structure of the object." } ;
diff --git a/core/mirrors/mirrors-tests.factor b/core/mirrors/mirrors-tests.factor
new file mode 100644 (file)
index 0000000..994bb8e
--- /dev/null
@@ -0,0 +1,16 @@
+USING: mirrors tools.test assocs kernel arrays ;
+IN: temporary
+
+TUPLE: foo bar baz ;
+
+C: <foo> foo
+
+[ { foo-bar foo-baz } ] [ 1 2 <foo> <mirror> keys ] unit-test
+
+[ 1 t ] [ \ foo-bar 1 2 <foo> <mirror> at* ] unit-test
+
+[ f f ] [ "hi" 1 2 <foo> <mirror> at* ] unit-test
+
+[ 3 ] [
+    3 \ foo-baz 1 2 <foo> [ <mirror> set-at ] keep foo-baz
+] unit-test
diff --git a/core/mirrors/mirrors.factor b/core/mirrors/mirrors.factor
new file mode 100644 (file)
index 0000000..d7ceaea
--- /dev/null
@@ -0,0 +1,78 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs hashtables kernel sequences generic words
+arrays classes slots slots.private tuples math vectors
+quotations ;
+IN: mirrors
+
+GENERIC: object-slots ( obj -- seq )
+
+M: object object-slots class "slots" word-prop ;
+
+M: tuple object-slots
+    dup class "slots" word-prop
+    swap delegate [ 1 tail-slice ] unless ;
+
+TUPLE: mirror object slots ;
+
+: <mirror> ( object -- mirror )
+    dup object-slots mirror construct-boa ;
+
+: >mirror< ( mirror -- obj slots )
+    dup mirror-object swap mirror-slots ;
+
+M: mirror at*
+    >mirror< swapd slot-of-reader
+    dup [ slot-spec-offset slot t ] [ 2drop f f ] if ;
+
+M: mirror set-at ( val key mirror -- )
+    >mirror< swapd slot-of-reader dup [
+        dup slot-spec-writer [
+            slot-spec-offset set-slot
+        ] [
+            "Immutable slot" throw
+        ] if
+    ] [
+        "No such slot" throw
+    ] if ;
+
+M: mirror delete-at ( key mirror -- )
+    f -rot set-at ;
+
+M: mirror >alist ( mirror -- alist )
+    >mirror<
+    [ [ slot-spec-offset slot ] curry* map ] keep
+    [ slot-spec-reader ] map swap 2array flip ;
+
+M: mirror assoc-size mirror-slots length ;
+
+INSTANCE: mirror assoc
+
+TUPLE: enum seq ;
+
+C: <enum> enum
+
+M: enum at*
+    enum-seq 2dup bounds-check?
+    [ nth t ] [ 2drop f f ] if ;
+
+M: enum set-at enum-seq set-nth ;
+
+M: enum delete-at enum-seq delete-nth ;
+
+M: enum >alist ( enum -- alist )
+    enum-seq dup length swap 2array flip ;
+
+M: enum assoc-size enum-seq length ;
+
+M: enum clear-assoc enum-seq delete-all ;
+
+INSTANCE: enum assoc
+
+GENERIC: make-mirror ( obj -- assoc )
+M: hashtable make-mirror ;
+M: integer make-mirror drop f ;
+M: array make-mirror <enum> ;
+M: vector make-mirror <enum> ;
+M: quotation make-mirror <enum> ;
+M: object make-mirror <mirror> ;
diff --git a/core/mirrors/summary.txt b/core/mirrors/summary.txt
new file mode 100644 (file)
index 0000000..249c5ee
--- /dev/null
@@ -0,0 +1 @@
+View any object as an association mapping slots to values
diff --git a/core/mirrors/tags.txt b/core/mirrors/tags.txt
new file mode 100644 (file)
index 0000000..c43322c
--- /dev/null
@@ -0,0 +1,2 @@
+reflection
+collections
diff --git a/core/modules.factor b/core/modules.factor
deleted file mode 100644 (file)
index 8d5e049..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: modules
-USING: hashtables io kernel namespaces parser sequences
-words strings arrays math help errors ;
-
-SYMBOL: modules
-
-TUPLE: module name loc directory files tests help main ;
-
-: module-def ( name -- path )
-    "resource:" over "/load.factor" 3append
-    dup ?resource-path exists? [
-        nip
-    ] [
-        drop "resource:" swap ".factor" 3append
-    ] if ;
-
-: module modules get [ module-name = ] find-with nip ;
-
-: process-files ( name seq -- newseq )
-    [ dup string? [ [ t ] 2array ] when ] map
-    [ second call ] subset
-    0 <column> >array
-    [ path+ "resource:" swap append ] map-with ;
-
-: module-files* ( module -- seq )
-    dup module-directory swap module-files process-files ;
-
-: loading-module ( name -- )
-    "quiet" get [
-        drop
-    ] [
-        "Loading module " write print flush
-    ] if ;
-
-: load-module ( name -- )
-    [
-        dup loading-module
-        [ dup module-def run-file ] assert-depth drop
-    ] no-parse-hook ;
-
-: reload-module ( module -- )
-    dup module-name module-def source-modified? [
-        module-name load-module
-    ] [
-        module-files* [ source-modified? ] subset run-files
-    ] if ;
-
-: reload-modules ( -- )
-    modules get [ reload-module ] each do-parse-hook ;
-
-: require ( name -- )
-    dup module [ drop ] [ load-module ] if do-parse-hook ;
-
-: remove-module ( name -- )
-    module [ modules get delete ] when* ;
-
-: alist>module ( name loc hash -- module )
-    alist>hash [
-        +directory+ get [ over ] unless*
-        +files+ get
-        +tests+ get
-        +help+ get
-    ] bind f <module> ;
-
-: module>alist ( module -- hash )
-    [
-        +directory+ over module-directory 2array ,
-        +files+ over module-files 2array ,
-        +tests+ over module-tests 2array ,
-        +help+ swap module-help 2array ,
-    ] { } make ;
-
-: provide ( name loc hash -- )
-    pick remove-module
-    alist>module
-    [ module-files* run-files ] keep
-    modules get push ;
diff --git a/core/modules.facts b/core/modules.facts
deleted file mode 100644 (file)
index 7a6e144..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-IN: modules
-USING: help io parser ;
-
-HELP: module-def
-{ $values { "name" "a module name string" } { "path" "a path name string" } }
-{ $description "Outputs the location of the module definition file. This word looks for the module definition in two locations relative to the " { $link resource-path } ":"
-    { $list
-        { $snippet { $emphasis "name" } ".factor" }
-        { $snippet { $emphasis "name" } "/load.factor" }
-    }
-}
-{ $notes "This file is loaded by " { $link require } ", and should contain the necessary " { $link POSTPONE: REQUIRES: } " and " { $link POSTPONE: PROVIDE: } " declarations for the module." } ;
-
-HELP: modules
-{ $var-description "Sequence of " { $link module } " instances." }
-{ $see-also require load-module } ;
-
-HELP: load-module
-{ $values { "name" "a module name string" } }
-{ $description "Runs the module definition file given by " { $link module-def } ", which loads the module's dependencies and source files." }
-{ $notes "Calling this word directly is rarely necessary. Usually, " { $link require } " is used to load modules and " { $link reload-modules } " is used to reload changed files." } ;
-
-HELP: require
-{ $values { "name" "a module name string" } }
-{ $description "Ensures that a module has been loaded, along with all its dependencies, and compiles all new words."
-$terpri
-"If this module is already listed in the " { $link modules } " hashtable, this word does nothing. Otherwise, it calls " { $link load-module } "." }
-{ $notes "Module definitions should use the " { $link POSTPONE: REQUIRES: } " parsing word instead. In the listener, the " { $link require } " word might be more useful since it recompiles new words after loading the module." } ;
-
-HELP: provide
-{ $values { "name" "a string" } { "hash" "a hashtable" } { "loc" "a pair holding a path name and line number" } }
-{ $description "Registers a module definition and loads its source files. The possible hashtable keys are documented in the " { $link POSTPONE: PROVIDE: } " word. Usually instead of calling this word, module definitions use the parsing word " { $link POSTPONE: PROVIDE: } " instead." } ;
-
-HELP: reload-module
-{ $values { "module" "a " { $link module } " instance" } }
-{ $description "Reloads any source files making up a module if they have been modified on disk since last being loaded. Most of the time " { $link reload-modules } " should be called instead." } ;
-
-HELP: reload-modules
-{ $description "Reloads all source files in all loaded modules which have been modified on disk since last being loaded." }
-{ $notes "If modification times become invalid after moving sources or images between machines, and this word ends up trying to reload all library sources, call " { $link reset-modified } " from the listener." } ;
diff --git a/core/namespaces/authors.txt b/core/namespaces/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/namespaces/namespaces-docs.factor b/core/namespaces/namespaces-docs.factor
new file mode 100644 (file)
index 0000000..f087090
--- /dev/null
@@ -0,0 +1,186 @@
+USING: help.markup help.syntax kernel kernel.private
+sequences words namespaces.private quotations vectors
+math.parser math ;
+IN: namespaces
+
+ARTICLE: "namespaces-combinators" "Namespace combinators"
+{ $subsection make-assoc }
+{ $subsection with-scope }
+{ $subsection with-variable }
+{ $subsection bind } ;
+
+ARTICLE: "namespaces-change" "Changing variable values"
+{ $subsection on }
+{ $subsection off }
+{ $subsection inc }
+{ $subsection dec }
+{ $subsection change } ;
+
+ARTICLE: "namespaces-global" "Global variables"
+{ $subsection namespace }
+{ $subsection global }
+{ $subsection get-global }
+{ $subsection set-global } ;
+
+ARTICLE: "namespaces-make" "Constructing sequences"
+"There is a lexicon of words for constructing sequences without passing the partial sequence being built on the stack. This reduces stack noise."
+{ $subsection make }
+{ $subsection , }
+{ $subsection % }
+{ $subsection # } ;
+
+ARTICLE: "namespaces.private" "Namespace implementation details"
+"The namestack holds namespaces."
+{ $subsection namestack }
+{ $subsection set-namestack }
+{ $subsection namespace }
+"A pair of words push and pop namespaces on the namestack."
+{ $subsection >n }
+{ $subsection ndrop } ;
+
+ARTICLE: "namespaces" "Variables and namespaces"
+"The " { $vocab-link "namespaces" } " vocabulary implements simple dynamically-scoped variables."
+$nl
+"A variable is an entry in an assoc of bindings, where the assoc is implicit rather than passed on the stack. These assocs are termed " { $emphasis "namespaces" } ". Nesting of scopes is implemented with a search order on namespaces, defined by a " { $emphasis "namestack" } ". Since namespaces are just assoc, any object can be used as a variable, however by convention, variables are keyed by symbols (see " { $link "symbols" } ")."
+$nl
+"The " { $link get } " and " { $link set } " words read and write variable values. The " { $link get } " word searches up the chain of nested namespaces, while " { $link set } " always sets variable values in the current namespace only. Namespaces are dynamically scoped; when a quotation is called from a nested scope, any words called by the quotation also execute in that scope."
+{ $subsection get }
+{ $subsection set }
+"Various utility words abstract away common variable access patterns:"
+{ $subsection "namespaces-change" }
+{ $subsection "namespaces-combinators" }
+{ $subsection "namespaces-global" }
+"A useful facility for constructing sequences by holding an accumulator sequence in a variable:"
+{ $subsection "namespaces-make" }
+"Implementation details your code probably does not care about:"
+{ $subsection "namespaces.private" }
+"An alternative to dynamic scope is lexical scope. Lexically-scoped values and closures are implemented in the " { $vocab-link "locals" } " vocabulary." ;
+
+ABOUT: "namespaces"
+
+HELP: get
+{ $values { "variable" "a variable, by convention a symbol" } { "value" "the value, or " { $link f } } }
+{ $description "Searches the name stack for a namespace containing the variable, and outputs the associated value. If no such namespace is found, outputs " { $link f } "." } ;
+
+HELP: set
+{ $values { "value" "the new value" } { "variable" "a variable, by convention a symbol" } }
+{ $description "Assigns a value to the variable in the namespace at the top of the name stack." }
+{ $side-effects "variable" } ;
+
+HELP: off
+{ $values { "variable" "a variable, by convention a symbol" } }
+{ $description "Assigns a value of " { $link f } " to the variable." }
+{ $side-effects "variable" } ;
+
+HELP: on
+{ $values { "variable" "a variable, by convention a symbol" } }
+{ $description "Assigns a value of " { $link t } " to the variable." }
+{ $side-effects "variable" } ;
+
+HELP: change
+{ $values { "variable" "a variable, by convention a symbol" } { "quot" "a quotation with stack effect " { $snippet "( old -- new )" } } }
+{ $description "Applies the quotation to the old value of the variable, and assigns the resulting value to the variable." }
+{ $side-effects "variable" } ;
+
+HELP: +@
+{ $values { "n" "a number" } { "variable" "a variable, by convention a symbol" } }
+{ $description "Adds " { $snippet "n" } " to the value of the variable. A variable value of " { $link f } " is interpreted as being zero." }
+{ $side-effects "variable" }
+{ $examples
+    { $example "SYMBOL: foo\n1 foo +@\n10 foo +@\nfoo get ." "11" }
+} ;
+
+HELP: inc
+{ $values { "variable" "a variable, by convention a symbol" } }
+{ $description "Increments the value of the variable by 1. A variable value of " { $link f } " is interpreted as being zero." }
+{ $side-effects "variable" } ;
+
+HELP: dec
+{ $values { "variable" "a variable, by convention a symbol" } }
+{ $description "Decrements the value of the variable by 1. A variable value of " { $link f } " is interpreted as being zero." }
+{ $side-effects "variable" } ;
+
+HELP: counter
+{ $values { "variable" "a variable, by convention a symbol" } { "n" integer } }
+{ $description "Increments the value of the variable by 1, and returns its new value." }
+{ $notes "This word is useful for generating (somewhat) unique identifiers. For example, the " { $link gensym } " word uses it." }
+{ $side-effects "variable" } ;
+
+HELP: with-scope
+{ $values { "quot" quotation } }
+{ $description "Calls the quotation in a new namespace. Any variables set by the quotation are discarded when it returns." } ;
+
+HELP: with-variable
+{ $values { "value" object } { "key" "a variable, by convention a symbol" } { "quot" quotation } }
+{ $description "Calls the quotation in a new namespace where " { $snippet "key" } " is set to " { $snippet "value" } "." }
+{ $examples "The following two phrases are equivalent:"
+    { $code "[ 3 x set foo ] with-scope" }
+    { $code "3 x [ foo ] with-variable" }
+} ;
+
+HELP: make-assoc
+{ $values { "quot" quotation } { "exemplar" "an assoc" } { "hash" "a new hashtable" } }
+{ $description "Calls the quotation in a new namespace of the same type as " { $snippet "exemplar" } ", and outputs this namespace when the quotation returns. Useful for quickly building assocs." } ;
+
+HELP: bind
+{ $values { "ns" "a hashtable" } { "quot" quotation } }
+{ $description "Calls the quotation in the dynamic scope of " { $snippet "ns" } ". When variables are looked up by the quotation, " { $snippet "ns" } " is checked first, and setting variables in the quotation stores them in " { $snippet "ns" } "." } ;
+
+HELP: namespace
+{ $values { "namespace" "an assoc" } }
+{ $description "Outputs the current namespace. Calls to " { $link set } " modify this namespace." } ;
+
+HELP: global
+{ $values { "g" "an assoc" } }
+{ $description "Outputs the global namespace. The global namespace is always checked last when looking up variable values." } ;
+
+HELP: get-global
+{ $values { "variable" "a variable, by convention a symbol" } { "value" "the value" } }
+{ $description "Outputs the value of a variable in the global namespace." } ;
+
+HELP: set-global
+{ $values { "value" "the new value" } { "variable" "a variable, by convention a symbol" } }
+{ $description "Assigns a value to the variable in the global namespace." }
+{ $side-effects "variable" } ;
+
+HELP: namestack*
+{ $values { "namestack" "a vector of assocs" } }
+{ $description "Outputs the current name stack." } ;
+
+HELP: namestack
+{ $values { "namestack" "a vector of assocs" } }
+{ $description "Outputs a copy of the current name stack." } ;
+
+HELP: set-namestack
+{ $values { "namestack" "a vector of assocs" } }
+{ $description "Replaces the name stack with a copy of the given vector." } ;
+
+HELP: >n
+{ $values { "namespace" "an assoc" } }
+{ $description "Pushes a namespace on the name stack." } ;
+
+HELP: ndrop
+{ $description "Pops a namespace from the name stack." } ;
+
+HELP: building
+{ $var-description "Temporary mutable growable sequence holding elements accumulated so far by " { $link make } "." } ;
+
+HELP: make
+{ $values { "quot" quotation } { "exemplar" "a sequence" } { "seq" "a new sequence" } }
+{ $description "Calls the quotation in a new " { $emphasis "dynamic scope" } ". The quotation and any words it calls can execute the " { $link , } " and " { $link % } " words to accumulate elements. When the quotation returns, all accumulated elements are collected into a sequence with the same type as " { $snippet "exemplar" } "." }
+{ $examples { $example "[ 1 , 2 , 3 , ] { } make ." "{ 1 2 3 }" } } ;
+
+HELP: ,
+{ $values { "elt" object } }
+{ $description "Adds an element to the end of the sequence being constructed by " { $link make } "." } ;
+
+HELP: %
+{ $values { "seq" "a sequence" } }
+{ $description "Appends a sequence to the end of the sequence being constructed by " { $link make } "." } ;
+
+HELP: init-namespaces
+{ $description "Resets the name stack to its initial state, holding a single copy of the global namespace. This word is called during startup and is rarely useful, except in certain situations such as the example below." }
+{ $examples
+    "You can use this word to spawn a new thread which does not inherit the parent thread's dynamic variable bindings:"
+    { $code "[ init-namestack do-some-work ] in-thread" }
+} ;
diff --git a/core/namespaces/namespaces-tests.factor b/core/namespaces/namespaces-tests.factor
new file mode 100644 (file)
index 0000000..07e9d80
--- /dev/null
@@ -0,0 +1,14 @@
+IN: temporary
+USING: kernel namespaces tools.test words ;
+
+H{ } clone "test-namespace" set
+
+: test-namespace ( -- )
+    H{ } clone dup [ namespace = ] bind ;
+
+[ t ] [ test-namespace ] unit-test
+
+10 "some-global" set
+[ f ]
+[ H{ } clone [ f "some-global" set "some-global" get ] bind ]
+unit-test
diff --git a/core/namespaces/namespaces.factor b/core/namespaces/namespaces.factor
new file mode 100644 (file)
index 0000000..bac6895
--- /dev/null
@@ -0,0 +1,65 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel vectors sequences hashtables
+arrays kernel.private math strings assocs ;
+IN: namespaces
+
+<PRIVATE
+
+: namestack* ( -- namestack )
+    0 getenv { vector } declare ; inline
+
+: >n ( namespace -- ) namestack* push ;
+: ndrop ( -- ) namestack* pop* ;
+
+PRIVATE>
+
+: namespace ( -- namespace ) namestack* peek ;
+: namestack ( -- namestack ) namestack* clone ; inline
+: set-namestack ( namestack -- ) >vector 0 setenv ; inline
+: global ( -- g ) 21 getenv { hashtable } declare ; inline
+: init-namespaces ( -- ) global 1array set-namestack ;
+: get ( variable -- value ) namestack* assoc-stack ; flushable
+: set ( value variable -- ) namespace set-at ;
+: on ( variable -- ) t swap set ; inline
+: off ( variable -- ) f swap set ; inline
+: get-global ( variable -- value ) global at ; inline
+: set-global ( value variable -- ) global set-at ; inline
+
+: change ( variable quot -- )
+    >r dup get r> rot slip set ; inline
+
+: +@ ( n variable -- ) [ 0 or + ] change ;
+
+: inc ( variable -- ) 1 swap +@ ; inline
+
+: dec ( variable -- ) -1 swap +@ ; inline
+
+: bind ( ns quot -- ) swap >n call ndrop ; inline
+
+: counter ( variable -- n ) global [ dup inc get ] bind ;
+
+: make-assoc ( quot exemplar -- hash )
+    20 swap new-assoc [ >n call ndrop ] keep ; inline
+
+: with-scope ( quot -- )
+    H{ } clone >n call ndrop ; inline
+
+: with-variable ( value key quot -- )
+    >r associate >n r> call ndrop ; inline
+
+! Building sequences
+SYMBOL: building
+
+: make ( quot exemplar -- seq )
+    [
+        [
+            1024 swap new-resizable [
+                building set call
+            ] keep
+        ] keep like
+    ] with-scope ; inline
+
+: , ( elt -- ) building get push ;
+
+: % ( seq -- ) building get push-all ;
diff --git a/core/namespaces/summary.txt b/core/namespaces/summary.txt
new file mode 100644 (file)
index 0000000..645872d
--- /dev/null
@@ -0,0 +1 @@
+Dynamically-scoped variables
diff --git a/core/namespaces/tags.txt b/core/namespaces/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/none/authors.txt b/core/none/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/none/none-docs.factor b/core/none/none-docs.factor
new file mode 100644 (file)
index 0000000..e083006
--- /dev/null
@@ -0,0 +1,4 @@
+USING: help.markup help.syntax none ;
+
+HELP: none
+{ $description "Passing the " { $snippet "-run=none" } " command line switch will make Factor exit as soon as it finishes running any source files specified on the command line." } ;
diff --git a/core/none/none.factor b/core/none/none.factor
new file mode 100644 (file)
index 0000000..66a0de8
--- /dev/null
@@ -0,0 +1,6 @@
+! Just a dummy shell for the -run switch...
+IN: none
+
+: none ;
+
+MAIN: none
diff --git a/core/none/summary.txt b/core/none/summary.txt
new file mode 100644 (file)
index 0000000..1a46dd9
--- /dev/null
@@ -0,0 +1 @@
+Dummy module for command-line usage
diff --git a/core/optimizer/authors.txt b/core/optimizer/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/optimizer/backend/authors.txt b/core/optimizer/backend/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/optimizer/backend/backend.factor b/core/optimizer/backend/backend.factor
new file mode 100644 (file)
index 0000000..479b910
--- /dev/null
@@ -0,0 +1,366 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic assocs inference inference.class
+inference.dataflow inference.backend io kernel math namespaces
+sequences vectors words quotations hashtables combinators
+classes generic.math continuations optimizer.def-use
+optimizer.pattern-match generic.standard ;
+IN: optimizer.backend
+
+SYMBOL: class-substitutions
+
+SYMBOL: literal-substitutions
+
+SYMBOL: value-substitutions
+
+SYMBOL: optimizer-changed
+
+GENERIC: optimize-node* ( node -- node/t changed? )
+
+: ?union ( hash/f hash -- hash )
+    over [ union ] [ nip ] if ;
+
+: add-node-literals ( hash node -- )
+    over assoc-empty? [
+        2drop
+    ] [
+        [ node-literals ?union ] keep set-node-literals
+    ] if ;
+
+: add-node-classes ( hash node -- )
+    over assoc-empty? [
+        2drop
+    ] [
+        [ node-classes ?union ] keep set-node-classes
+    ] if ;
+
+: substitute-values ( assoc node -- )
+    over assoc-empty? [
+        2drop
+    ] [
+        2dup node-in-d substitute
+        2dup node-in-r substitute
+        2dup node-out-d substitute
+        node-out-r substitute
+    ] if ;
+
+: perform-substitutions ( node -- )
+    class-substitutions get over add-node-classes
+    literal-substitutions get over add-node-literals
+    value-substitutions get swap substitute-values ;
+
+DEFER: optimize-nodes
+
+: optimize-children ( node -- )
+    [
+        dup node-children dup [
+            [ optimize-nodes ] map swap set-node-children
+        ] [
+            2drop
+        ] if
+    ] when* ;
+
+: optimize-node ( node -- node )
+    dup [
+        dup perform-substitutions
+        dup optimize-node* [
+            nip optimizer-changed on optimize-node
+        ] [
+            dup t eq? [
+                drop dup optimize-children
+            ] [
+                nip optimize-node
+            ] if
+        ] if
+    ] when ;
+
+M: f set-node-successor 2drop ;
+
+: (optimize-nodes) ( prev node -- )
+    optimize-node [
+        dup rot set-node-successor
+        dup node-successor (optimize-nodes)
+    ] [
+        f swap set-node-successor
+    ] if* ;
+
+: optimize-nodes ( node -- newnode )
+    [
+        class-substitutions [ clone ] change
+        literal-substitutions [ clone ] change
+        dup [
+            optimize-node
+            dup dup node-successor (optimize-nodes)
+        ] when optimizer-changed get
+    ] with-scope optimizer-changed set ;
+
+: prune-if ( node quot -- successor/t )
+    over >r call [ r> node-successor t ] [ r> drop t f ] if ;
+    inline
+
+! Generic nodes
+M: node optimize-node* drop t f ;
+
+M: #shuffle optimize-node* 
+    [
+        dup node-in-d empty? swap node-out-d empty? and
+    ] prune-if ;
+
+M: #push optimize-node* 
+    [ node-out-d empty? ] prune-if ;
+
+: cleanup-inlining ( node -- newnode changed? )
+    node-successor [ node-successor t ] [ t f ] if* ;
+
+! #return
+M: #return optimize-node* cleanup-inlining ;
+
+! #values
+M: #values optimize-node* cleanup-inlining ;
+
+! Some utilities for splicing in dataflow IR subtrees
+: follow ( key assoc -- value )
+    2dup at* [ swap follow nip ] [ 2drop ] if ;
+
+: union* ( assoc1 assoc2 -- assoc )
+    union [ keys ] keep
+    [ dupd follow ] curry
+    H{ } map>assoc ;
+
+: update* ( assoc1 assoc2 -- )
+    #! Not very efficient.
+    dupd union* update ;
+
+: post-inline ( #call/#merge #return/#values -- assoc )
+    >r node-out-d r> node-in-d 2array unify-lengths flip
+    [ = not ] assoc-subset >hashtable ;
+
+: substitute-def-use ( node -- )
+    #! As a first approximation, we take all the values used
+    #! by the set of new nodes, and push a 't' on their
+    #! def-use list here. We could perform a full graph
+    #! substitution, but we don't need to, because the next
+    #! optimizer iteration will do that. We just need a minimal
+    #! degree of accuracy; the new values should be marked as
+    #! having _some_ usage, so that flushing doesn't erronously
+    #! flush them away.
+    [ compute-def-use def-use get keys ] with-scope
+    def-use get [ [ t swap ?push ] change-at ] curry each ;
+
+: substitute-node ( old new -- )
+    #! The last node of 'new' becomes 'old', then values are
+    #! substituted. A subsequent optimizer phase kills the
+    #! last node of 'new' and the first node of 'old'.
+    dup substitute-def-use
+    last-node
+    class-substitutions get over node-classes update
+    literal-substitutions get over node-literals update
+    2dup post-inline value-substitutions get swap update*
+    set-node-successor ;
+
+GENERIC: remember-method* ( method-spec node -- )
+
+M: #call remember-method*
+    [ node-history ?push ] keep set-node-history ;
+
+M: node remember-method*
+    2drop ;
+
+: remember-method ( method-spec node -- )
+    swap dup
+    [ [ swap remember-method* ] curry each-node ] [ 2drop ] if ;
+
+: (splice-method) ( #call method-spec quot -- node )
+    #! Must remember the method before splicing in, otherwise
+    #! the rest of the IR will also remember the method
+    pick node-in-d dataflow-with
+    [ remember-method ] keep
+    [ swap infer-classes/node ] 2keep
+    [ substitute-node ] keep ;
+
+: splice-quot ( #call quot -- node ) f swap (splice-method) ;
+
+: drop-inputs ( node -- #shuffle )
+    node-in-d clone \ #shuffle in-node ;
+
+! Constant branch folding
+: fold-branch ( node branch# -- node )
+    over drop-inputs >r
+    over node-children nth
+    swap node-successor over substitute-node
+    r> [ set-node-successor ] keep ;
+
+! #if
+: known-boolean-value? ( node value -- value ? )
+    2dup node-literal? [
+        node-literal t
+    ] [
+        node-class {
+            { [ dup null class< ] [ drop f f ] }
+            { [ dup general-t class< ] [ drop t t ] }
+            { [ dup \ f class< ] [ drop f t ] }
+            { [ t ] [ drop f f ] }
+        } cond
+    ] if ;
+
+M: #if optimize-node*
+    dup dup node-in-d first known-boolean-value?
+    [ 0 1 ? fold-branch t ] [ 2drop t f ] if ;
+
+M: #dispatch optimize-node*
+    dup dup node-in-d first 2dup node-literal? [
+        node-literal fold-branch t
+    ] [
+        3drop t f
+    ] if ;
+
+! #call
+: splice-method ( #call method-spec/t quot/t -- node/t )
+    #! t indicates failure
+    {
+        { [ dup t eq? ] [ 3drop t ] }
+        { [ pick pick swap node-history member? ] [ 3drop t ] }
+        { [ t ] [ (splice-method) ] }
+    } cond ;
+
+! Single dispatch method inlining optimization
+: already-inlined? ( node -- ? )
+    #! Was this node inlined from definition of 'word'?
+    dup node-param swap node-history memq? ;
+
+: specific-method ( class word -- class ) order min-class ;
+
+: node-class# ( node n -- class )
+    over node-in-d <reversed> ?nth node-class ;
+
+: dispatching-class ( node word -- class )
+    [ dispatch# node-class# ] keep specific-method ;
+
+: will-inline-method ( node word -- method-spec/t quot/t )
+    #! t indicates failure
+    tuck dispatching-class dup [
+        swap [ 2array ] 2keep
+        method method-def
+    ] [
+        2drop t t
+    ] if ;
+
+: inline-standard-method ( node word -- node )
+    dupd will-inline-method splice-method ;
+
+! Partial dispatch of math-generic words
+: math-both-known? ( word left right -- ? )
+    math-class-max swap specific-method ;
+
+: will-inline-math-method ( word left right -- method-spec/t quot/t )
+    #! t indicates failure
+    3dup math-both-known?
+    [ [ 3array ] 3keep math-method ] [ 3drop t t ] if ;
+
+: inline-math-method ( #call word -- node )
+    over node-input-classes first2
+    will-inline-math-method splice-method ;
+
+: inline-method ( #call -- node )
+    dup node-param {
+        { [ dup standard-generic? ] [ inline-standard-method ] }
+        { [ dup math-generic? ] [ inline-math-method ] }
+        { [ t ] [ 2drop t ] }
+    } cond ;
+
+! Resolve type checks at compile time where possible
+: comparable? ( actual testing -- ? )
+    #! If actual is a subset of testing or if the two classes
+    #! are disjoint, return t.
+    2dup class< >r classes-intersect? not r> or ;
+
+: optimize-predicate? ( #call -- ? )
+    dup node-param "predicating" word-prop dup [
+        >r node-class-first r> comparable?
+    ] [
+        2drop f
+    ] if ;
+
+: literal-quot ( node literals -- quot )
+    #! Outputs a quotation which drops the node's inputs, and
+    #! pushes some literals.
+    >r node-in-d length \ drop <repetition>
+    r> [ literalize ] map append >quotation ;
+
+: inline-literals ( node literals -- node )
+    #! Make #shuffle -> #push -> #return -> successor
+    dupd literal-quot splice-quot ;
+
+: optimize-predicate ( #call -- node )
+    dup node-param "predicating" word-prop >r
+    dup node-class-first r> class< 1array inline-literals ;
+
+: optimizer-hooks ( node -- conditions )
+    node-param "optimizer-hooks" word-prop ;
+
+: optimizer-hook ( node -- pair/f )
+    dup optimizer-hooks [ first call ] find 2nip ;
+
+: optimize-hook ( node -- )
+    dup optimizer-hook second call ;
+
+: define-optimizers ( word optimizers -- )
+    "optimizer-hooks" set-word-prop ;
+
+: flush-eval? ( #call -- ? )
+    dup node-param "flushable" word-prop [
+        node-out-d [ unused? ] all?
+    ] [
+        drop f
+    ] if ;
+
+: flush-eval ( #call -- node )
+    dup node-out-d length f <repetition> inline-literals ;
+
+: partial-eval? ( #call -- ? )
+    dup node-param "foldable" word-prop [
+        dup node-in-d [ node-literal? ] curry* all?
+    ] [
+        drop f
+    ] if ;
+
+: literal-in-d ( #call -- inputs )
+    dup node-in-d [ node-literal ] curry* map ;
+
+: partial-eval ( #call -- node )
+    dup literal-in-d over node-param 1quotation
+    [ with-datastack ] catch
+    [ 3drop t ] [ inline-literals ] if ;
+
+: define-identities ( words identities -- )
+    [ "identities" set-word-prop ] curry each ;
+
+: find-identity ( node -- quot )
+    [ node-param "identities" word-prop ] keep
+    [ swap first in-d-match? ] curry find
+    nip dup [ second ] when ;
+
+: apply-identities ( node -- node/f )
+    dup find-identity dup [ splice-quot ] [ 2drop f ] if ;
+
+: optimistic-inline? ( #call -- ? )
+    dup node-param "specializer" word-prop dup [
+        >r node-input-classes r> length tail*
+        [ types length 1 = ] all?
+    ] [
+        2drop f
+    ] if ;
+
+: optimistic-inline ( #call -- node )
+    dup node-param word-def splice-quot ;
+
+M: #call optimize-node*
+    {
+        { [ dup flush-eval? ] [ flush-eval ] }
+        { [ dup partial-eval? ] [ partial-eval ] }
+        { [ dup find-identity ] [ apply-identities ] }
+        { [ dup optimizer-hook ] [ optimize-hook ] }
+        { [ dup optimize-predicate? ] [ optimize-predicate ] }
+        { [ dup optimistic-inline? ] [ optimistic-inline ] }
+        { [ t ] [ inline-method ] }
+    } cond dup not ;
diff --git a/core/optimizer/backend/summary.txt b/core/optimizer/backend/summary.txt
new file mode 100644 (file)
index 0000000..78a4ac6
--- /dev/null
@@ -0,0 +1 @@
+Dataflow IR optimizer implementation
diff --git a/core/optimizer/debugger/debugger.factor b/core/optimizer/debugger/debugger.factor
new file mode 100644 (file)
index 0000000..6c323fc
--- /dev/null
@@ -0,0 +1,119 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: classes inference inference.dataflow io kernel
+kernel.private math.parser namespaces optimizer prettyprint
+prettyprint.backend sequences words arrays match macros
+assocs ;
+IN: optimizer.debugger
+
+! A simple tool for turning dataflow IR into quotations, for
+! debugging purposes.
+
+GENERIC: node>quot ( ? node -- )
+
+TUPLE: comment node text ;
+
+M: comment pprint*
+    "( " over comment-text " )" 3append
+    swap comment-node present-text ;
+
+: comment, ( ? node text -- )
+    rot [ \ comment construct-boa , ] [ 2drop ] if ;
+
+: values% ( prefix values -- )
+    swap [
+        %
+        dup value? [
+            value-literal unparse %
+        ] [
+            "@" % unparse %
+        ] if
+    ] curry each ;
+
+: effect-str ( node -- str )
+    [
+        " " over node-in-d values%
+        " r: " over node-in-r values%
+        " --" %
+        " " over node-out-d values%
+        " r: " swap node-out-r values%
+    ] "" make 1 tail ;
+
+MACRO: match-choose ( alist -- )
+    [ [ ] curry ] assoc-map [ match-cond ] curry ;
+
+MATCH-VARS: ?a ?b ?c ;
+
+: pretty-shuffle ( in out -- word/f )
+    2array {
+        { { { ?a } { } } drop }
+        { { { ?a ?b } { } } 2drop }
+        { { { ?a ?b ?c } { } } 3drop }
+        { { { ?a } { ?a ?a } } dup }
+        { { { ?a ?b } { ?a ?b ?a ?b } } 2dup }
+        { { { ?a ?b ?c } { ?a ?b ?c ?a ?b ?c } } 3dup }
+        { { { ?a ?b } { ?a ?b ?a } } over }
+        { { { ?b ?a } { ?a ?b } } swap }
+        { { { ?a ?b ?c } { ?a ?b ?c ?a } } pick }
+        { { { ?a ?b ?c } { ?c ?a ?b } } -rot }
+        { { { ?a ?b ?c } { ?b ?c ?a } } rot }
+        { { { ?a ?b } { ?b } } nip }
+        { _ f }
+    } match-choose ;
+
+M: #shuffle node>quot
+    dup node-in-d over node-out-d pretty-shuffle
+    [ , ] [ >r drop t r> ] if*
+    dup effect-str "#shuffle: " swap append comment, ;
+
+: pushed-literals node-out-d [ value-literal ] map ;
+
+M: #push node>quot nip pushed-literals % ;
+
+DEFER: dataflow>quot
+
+: #call>quot ( ? node -- )
+    dup node-param dup
+    [ , dup effect-str comment, ] [ 3drop ] if ;
+
+M: #call node>quot #call>quot ;
+
+M: #call-label node>quot #call>quot ;
+
+M: #label node>quot
+    [ "#label: " over node-param word-name append comment, ] 2keep
+    node-child swap dataflow>quot , \ call ,  ;
+
+M: #if node>quot
+    [ "#if" comment, ] 2keep
+    node-children swap [ dataflow>quot ] curry map %
+    \ if , ;
+
+M: #dispatch node>quot
+    [ "#dispatch" comment, ] 2keep
+    node-children swap [ dataflow>quot ] curry map ,
+    \ dispatch , ;
+
+M: #return node>quot
+    dup node-param unparse "#return " swap append comment, ;
+
+M: #>r node>quot nip node-in-d length \ >r <array> % ;
+
+M: #r> node>quot nip node-out-d length \ r> <array> % ;
+
+M: object node>quot dup class word-name comment, ;
+
+: (dataflow>quot) ( ? node -- )
+    dup [
+        2dup node>quot node-successor (dataflow>quot)
+    ] [
+        2drop
+    ] if ;
+
+: dataflow>quot ( node ? -- quot )
+    [ swap (dataflow>quot) ] [ ] make ;
+
+: print-dataflow ( quot ? -- )
+    #! Print dataflow IR for a quotation. Flag indicates if
+    #! annotations should be printed or not.
+    >r dataflow optimize r> dataflow>quot pprint nl ;
diff --git a/core/optimizer/def-use/authors.txt b/core/optimizer/def-use/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/optimizer/def-use/def-use-tests.factor b/core/optimizer/def-use/def-use-tests.factor
new file mode 100644 (file)
index 0000000..556b9d7
--- /dev/null
@@ -0,0 +1,130 @@
+IN: temporary
+USING: inference inference.dataflow optimizer optimizer.def-use
+namespaces assocs kernel sequences math tools.test words ;
+
+[ 3 { 1 1 1 } ] [
+    [ 1 2 3 ] dataflow compute-def-use
+    def-use get values dup length swap [ length ] map
+] unit-test
+
+: kill-set ( quot -- seq )
+    dataflow compute-def-use dead-literals keys
+    [ value-literal ] map ;
+
+: subset? [ member? ] curry all? ;
+
+: set= 2dup subset? >r swap subset? r> and ;
+
+[ { [ + ] } ] [
+    [ [ 1 2 3 ] [ + ] over drop drop ] kill-set
+] unit-test
+
+[ { [ + ] } ] [
+    [ [ + ] [ 1 2 3 ] over drop nip ] kill-set
+] unit-test
+
+[ { [ + ] } ] [
+    [ [ + ] dup over 3drop ] kill-set
+] unit-test
+
+[ t ] [
+    { [ + ] [ - ] }
+    [ [ + ] [ - ] [ 1 2 3 ] pick pick 2drop >r 2drop r> ]
+    kill-set set=
+] unit-test
+
+[ t ] [
+    { [ + ] }
+    [ [ 1 2 3 ] [ 4 5 6 ] [ + ] pick >r drop r> ]
+    kill-set set=
+] unit-test
+
+[ t ] [
+    [ [ 1 ] [ 2 ] ] [ [ 1 ] [ 2 ] if ] kill-set set=
+] unit-test
+
+[ t ] [
+    { [ 5 ] [ dup ] }
+    [ [ 5 ] [ dup ] if ] kill-set set=
+] unit-test
+
+[ t ] [
+    [ [ dup ] [ dup ] ]
+    [ 5 swap [ dup ] [ dup ] if ]
+    kill-set set=
+] unit-test
+
+[ t ] [
+    [ 5 [ dup ] [ dup ] ]
+    [ 5 swap [ dup ] [ dup ] if 2drop ]
+    kill-set set=
+] unit-test
+
+: literal-kill-test ( a b -- )
+    dup [ >r dup slip r> literal-kill-test ] [ 2drop ] if ; inline
+
+[ t ] [
+    { [ ] [ >r dup slip r> literal-kill-test ] [ 2drop ] }
+    [ [ ] swap literal-kill-test ] kill-set set=
+] unit-test
+
+: p1 drop 4 ;
+: p2 3drop 1 2 ;
+: p3 drop 3 ;
+
+: regression-0
+    [ 2drop ] curry* assoc-find ;
+
+[ t ] [
+    [ [ 2drop ] curry* assoc-find ] kill-set
+    [ 2drop ] swap member?
+] unit-test
+
+[ t ] [
+    [ [ "x" 2drop ] assoc-find ] kill-set
+    [ "x" 2drop ] swap member?
+] unit-test
+
+: 2swap ( x y z t -- z t x y )
+    rot >r rot r> ; inline
+
+: regression-1
+    [ 2swap [ swapd * -rot p2 +@ ] 2keep ] assoc-each ;
+
+[ { t t } ] [
+    {
+        [ swapd * -rot p2 +@ ]
+        [ 2swap [ swapd * -rot p2 +@ ] 2keep ]
+    } \ regression-1 word-def kill-set [ member? ] curry map
+] unit-test
+
+: regression-2 ( x y -- x.y )
+    [ p1 ] 2apply [
+        [
+            rot
+            [ 2swap [ swapd * -rot p2 +@ ] 2keep ]
+            assoc-each 2drop
+        ] curry* assoc-each
+    ] H{ } make-assoc p3 ;
+
+[ { t t t t t } ] [
+    {
+        [ p1 ]
+        [ swapd * -rot p2 +@ ]
+        [ 2swap [ swapd * -rot p2 +@ ] 2keep ]
+        [
+            rot
+            [ 2swap [ swapd * -rot p2 +@ ] 2keep ]
+            assoc-each 2drop
+        ]
+        [
+            [
+                rot
+                [ 2swap [ swapd * -rot p2 +@ ] 2keep ]
+                assoc-each 2drop
+            ] curry* assoc-each
+        ]
+    }
+    \ regression-2 word-def kill-set
+    [ member? ] curry map
+] unit-test
diff --git a/core/optimizer/def-use/def-use.factor b/core/optimizer/def-use/def-use.factor
new file mode 100644 (file)
index 0000000..82b39fc
--- /dev/null
@@ -0,0 +1,89 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: optimizer.def-use
+USING: namespaces assocs sequences inference.dataflow
+inference.backend kernel generic assocs classes vectors ;
+
+SYMBOL: def-use
+
+: used-by ( value -- seq ) def-use get at ;
+
+: unused? ( value -- ? )
+    used-by empty? ;
+
+: uses-values ( node seq -- )
+    [ def-use get [ ?push ] change-at ] curry* each ;
+
+: defs-values ( seq -- )
+    #! If there is no value, set it to a new empty vector,
+    #! otherwise do nothing.
+    [ def-use get [ V{ } like ] change-at ] each ;
+
+GENERIC: node-def-use ( node -- )
+
+: compute-def-use ( node -- )
+    H{ } clone def-use set [ node-def-use ] each-node ;
+
+: nest-def-use ( node -- def-use )
+    [ compute-def-use def-use get ] with-scope ;
+
+: (node-def-use) ( node -- )
+    dup dup node-in-d uses-values
+    dup dup node-in-r uses-values
+    dup node-out-d defs-values
+    node-out-r defs-values ;
+
+M: object node-def-use (node-def-use) ;
+
+! nodes that don't use their values directly
+UNION: #passthru
+    #shuffle #>r #r> #call-label #merge #values #entry #declare ;
+
+M: #passthru node-def-use drop ;
+
+M: #return node-def-use
+    #! Values returned by local labels can be killed.
+    dup node-param [ drop ] [ (node-def-use) ] if ;
+
+! nodes that don't use their values directly
+UNION: #killable
+    #push #passthru ;
+
+: purge-invariants ( stacks -- seq )
+    #! Output a sequence of values which are not present in the
+    #! same position in each sequence of the stacks sequence.
+    unify-lengths flip [ all-eq? not ] subset concat ;
+
+M: #label node-def-use
+    [
+        dup node-in-d ,
+        dup node-child node-out-d ,
+        dup collect-recursion [ node-in-d , ] each
+    ] { } make purge-invariants uses-values ;
+
+: branch-def-use ( #branch -- )
+    active-children [ node-in-d ] map
+    purge-invariants t swap uses-values ;
+
+M: #branch node-def-use
+    #! This assumes that the last element of each branch is a
+    #! #values node.
+    dup branch-def-use (node-def-use) ;
+
+: dead-literals ( -- values )
+    def-use get [ >r value? r> empty? and ] assoc-subset ;
+
+: kill-node* ( node values -- )
+    [ swap remove-all ] curry modify-values ;
+
+: kill-node ( node values -- )
+    dup assoc-empty?
+    [ 2drop ] [ [ kill-node* ] curry each-node ] if ;
+
+: kill-values ( node -- )
+    #! Remove literals which are not actually used anywhere.
+    dead-literals kill-node ;
+
+: sole-consumer ( #call -- node/f )
+    node-out-d first used-by
+    dup length 1 = [ first ] [ drop f ] if ;
diff --git a/core/optimizer/def-use/summary.txt b/core/optimizer/def-use/summary.txt
new file mode 100644 (file)
index 0000000..4bd6284
--- /dev/null
@@ -0,0 +1 @@
+Value definition/use inference
diff --git a/core/optimizer/known-words/authors.txt b/core/optimizer/known-words/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/optimizer/known-words/known-words.factor b/core/optimizer/known-words/known-words.factor
new file mode 100644 (file)
index 0000000..c072661
--- /dev/null
@@ -0,0 +1,166 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: optimizer.known-words
+USING: alien arrays generic hashtables inference.dataflow
+inference.class kernel assocs math math.private kernel.private
+sequences words parser vectors strings sbufs io namespaces
+assocs quotations sequences.private io.binary io.crc32
+io.buffers io.streams.string layouts splitting math.intervals
+math.floats.private math.vectors tuples tuples.private classes
+optimizer.def-use optimizer.backend optimizer.pattern-match
+float-arrays combinators.private ;
+
+! the output of <tuple> and <tuple-boa> has the class which is
+! its second-to-last input
+{ <tuple> <tuple-boa> } [
+    [
+        node-in-d dup length 2 - swap nth dup value?
+        [ value-literal ] [ drop tuple ] if 1array f
+    ] "output-classes" set-word-prop
+] each
+
+! the output of clone has the same type as the input
+{ clone (clone) } [
+    [
+        node-in-d [ value-class* ] map f
+    ] "output-classes" set-word-prop
+] each
+
+! not [ A ] [ B ] if ==> [ B ] [ A ] if
+: flip-branches? ( #call -- ? ) sole-consumer #if? ;
+
+: (flip-branches) ( #if -- )
+    dup node-children reverse swap set-node-children ;
+
+: flip-branches ( #call -- #if )
+    #! If a not is followed by an #if, flip branches and
+    #! remove the not.
+    dup sole-consumer (flip-branches) [ ] splice-quot ;
+
+\ not {
+    { [ dup flip-branches? ] [ flip-branches ] }
+} define-optimizers
+
+! eq? on objects of disjoint types is always f
+: disjoint-eq? ( node -- ? )
+    node-input-classes first2 2dup and
+    [ classes-intersect? not ] [ 2drop f ] if ;
+
+\ eq? {
+    { [ dup disjoint-eq? ] [ [ f ] inline-literals ] }
+} define-optimizers
+
+! if the result of eq? is t and the second input is a literal,
+! the first input is equal to the second
+\ eq? [
+    dup node-in-d second dup value? [
+        swap [
+            value-literal 0 `input literal,
+            general-t 0 `output class,
+        ] set-constraints
+    ] [
+        2drop
+    ] if
+] "constraints" set-word-prop
+
+! eq? on the same object is always t
+{ eq? bignum= float= number= = } {
+    { { @ @ } [ 2drop t ] }
+} define-identities
+
+! type applied to an object of a known type can be folded
+: known-type? ( node -- ? )
+    node-class-first types length 1 number= ;
+
+: fold-known-type ( node -- node )
+    dup node-class-first types inline-literals ;
+
+\ type [
+    { [ dup known-type? ] [ fold-known-type ] }
+] define-optimizers
+
+! if the result of type is n, then the object has type n
+{ tag type } [
+    [
+        num-types get swap [
+            [
+                [ type>class 0 `input class, ] keep
+                0 `output literal,
+            ] set-constraints
+        ] curry each
+    ] "constraints" set-word-prop
+] each
+
+! Specializers
+{ 1+ 1- sq neg recip sgn truncate } [
+    { number } "specializer" set-word-prop
+] each
+
+\ 2/ { fixnum } "specializer" set-word-prop
+
+{ min max } [
+    { number number } "specializer" set-word-prop
+] each
+
+{ vneg norm-sq norm normalize } [
+    { { float-array array } } "specializer" set-word-prop
+] each
+
+\ n*v { * { float-array array } } "specializer" set-word-prop
+\ v*n { { float-array array } * } "specializer" set-word-prop
+\ n/v { * { float-array array } } "specializer" set-word-prop
+\ v/n { { float-array array } * } "specializer" set-word-prop
+
+{ v+ v- v* v/ vmax vmin v. } [
+    { { float-array array } { float-array array } }
+    "specializer" set-word-prop
+] each
+
+{ first first2 first3 first4 }
+[ { array } "specializer" set-word-prop ] each
+
+{ peek pop* pop push } [
+    { vector } "specializer" set-word-prop
+] each
+
+\ push-all
+{ { string array } { sbuf vector } }
+"specializer" set-word-prop
+
+\ append
+{ { string array } { string array } }
+"specializer" set-word-prop
+
+\ subseq
+{ fixnum fixnum { string array } }
+"specializer" set-word-prop
+
+\ reverse-here
+{ { string array } }
+"specializer" set-word-prop
+
+\ mismatch
+{ string string }
+"specializer" set-word-prop
+
+\ find-last-sep { string sbuf } "specializer" set-word-prop
+
+\ >string { sbuf } "specializer" set-word-prop
+
+\ >array { { string vector } } "specializer" set-word-prop
+
+\ crc32 { string } "specializer" set-word-prop
+
+\ split, { string string } "specializer" set-word-prop
+
+\ memq? { array } "specializer" set-word-prop
+
+\ member? { fixnum string } "specializer" set-word-prop
+
+\ assoc-stack { vector } "specializer" set-word-prop
+
+\ >le { { fixnum bignum } fixnum } "specializer" set-word-prop
+
+\ >be { { fixnum bignum } fixnum } "specializer" set-word-prop
+
+\ (buffer-until) { fixnum fixnum simple-alien string } "specializer" set-word-prop
diff --git a/core/optimizer/known-words/summary.txt b/core/optimizer/known-words/summary.txt
new file mode 100644 (file)
index 0000000..0e944a1
--- /dev/null
@@ -0,0 +1 @@
+Hand-coded optimization rules for primitives and low-level words
diff --git a/core/optimizer/math/authors.txt b/core/optimizer/math/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/optimizer/math/math.factor b/core/optimizer/math/math.factor
new file mode 100644 (file)
index 0000000..c3ab01b
--- /dev/null
@@ -0,0 +1,455 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: optimizer.math
+USING: alien arrays generic hashtables kernel assocs math
+math.private kernel.private sequences words parser
+inference.class inference.dataflow vectors strings sbufs io
+namespaces assocs quotations math.intervals sequences.private
+math.libm combinators splitting layouts math.parser classes
+generic.math optimizer.pattern-match optimizer.backend
+optimizer.def-use generic.standard ;
+
+{ + bignum+ float+ fixnum+fast } {
+    { { number 0 } [ drop ] }
+    { { 0 number } [ nip ] }
+} define-identities
+
+{ fixnum+ } {
+    { { number 0 } [ drop ] }
+    { { 0 number } [ nip ] }
+} define-identities
+
+{ - fixnum- bignum- float- fixnum-fast } {
+    { { number 0 } [ drop ] }
+    { { @ @ } [ 2drop 0 ] }
+} define-identities
+
+{ < fixnum< bignum< float< } {
+    { { @ @ } [ 2drop f ] }
+} define-identities
+
+{ <= fixnum<= bignum<= float<= } {
+    { { @ @ } [ 2drop t ] }
+} define-identities
+
+{ > fixnum> bignum> float>= } {
+    { { @ @ } [ 2drop f ] }
+} define-identities
+
+{ >= fixnum>= bignum>= float>= } {
+    { { @ @ } [ 2drop t ] }
+} define-identities
+
+{ * fixnum* bignum* float* } {
+    { { number 1 } [ drop ] }
+    { { 1 number } [ nip ] }
+    { { number 0 } [ nip ] }
+    { { 0 number } [ drop ] }
+    { { number -1 } [ drop 0 swap - ] }
+    { { -1 number } [ nip 0 swap - ] }
+} define-identities
+
+{ / fixnum/i bignum/i float/f } {
+    { { number 1 } [ drop ] }
+    { { number -1 } [ drop 0 swap - ] }
+} define-identities
+
+{ fixnum-mod bignum-mod } {
+    { { number 1 } [ 2drop 0 ] }
+} define-identities
+
+{ bitand fixnum-bitand bignum-bitand } {
+    { { number -1 } [ drop ] }
+    { { -1 number } [ nip ] }
+    { { @ @ } [ drop ] }
+    { { number 0 } [ nip ] }
+    { { 0 number } [ drop ] }
+} define-identities
+
+{ bitor fixnum-bitor bignum-bitor } {
+    { { number 0 } [ drop ] }
+    { { 0 number } [ nip ] }
+    { { @ @ } [ drop ] }
+    { { number -1 } [ nip ] }
+    { { -1 number } [ drop ] }
+} define-identities
+
+{ bitxor fixnum-bitxor bignum-bitxor } {
+    { { number 0 } [ drop ] }
+    { { 0 number } [ nip ] }
+    { { number -1 } [ drop bitnot ] }
+    { { -1 number } [ nip bitnot ] }
+    { { @ @ } [ 2drop 0 ] }
+} define-identities
+
+{ shift fixnum-shift bignum-shift } {
+    { { 0 number } [ drop ] }
+    { { number 0 } [ drop ] }
+} define-identities
+
+: math-closure ( class -- newclass )
+    { fixnum integer rational real }
+    [ class< ] curry* find nip number or ;
+
+: fits? ( interval class -- ? )
+    "interval" word-prop dup
+    [ interval-subset? ] [ 2drop t ] if ;
+
+: math-output-class ( node min -- newclass )
+    #! if min is f, it means we just want to use the declared
+    #! output class from the "infer-effect".
+    dup [
+        swap node-in-d
+        [ value-class* math-closure math-class-max ] each
+    ] [
+        2drop f
+    ] if ;
+
+: won't-overflow? ( interval node -- ? )
+    node-in-d [ value-class* fixnum class< ] all?
+    swap fixnum fits? and ;
+
+: post-process ( class interval node -- classes intervals )
+    dupd won't-overflow?
+    [ >r dup { f integer } memq? [ drop fixnum ] when r> ] when
+    [ dup [ 1array ] when ] 2apply ;
+
+: math-output-interval-1 ( node word -- interval )
+    dup [
+        >r node-in-d first value-interval* dup
+        [ r> execute ] [ r> 2drop f ] if
+    ] [
+        2drop f
+    ] if ; inline
+
+: math-output-class/interval-1 ( node min word -- classes intervals )
+    pick >r
+    >r over r>
+    math-output-interval-1
+    >r math-output-class r>
+    r> post-process ; inline
+
+{
+    { 1+ integer interval-1+ }
+    { 1- integer interval-1- }
+    { neg integer interval-neg }
+    { shift integer interval-recip }
+    { bitnot fixnum interval-bitnot }
+    { fixnum-bitnot f interval-bitnot }
+    { bignum-bitnot f interval-bitnot }
+    { 2/ fixnum interval-2/ }
+    { sq integer f }
+} [
+    first3 [
+        math-output-class/interval-1
+    ] 2curry "output-classes" set-word-prop
+] each
+
+: intervals ( node -- i1 i2 )
+    node-in-d first2 [ value-interval* ] 2apply ;
+
+: math-output-interval-2 ( node word -- interval )
+    dup [
+        >r intervals 2dup and [ r> execute ] [ r> 3drop f ] if
+    ] [
+        2drop f
+    ] if ; inline
+
+: math-output-class/interval-2 ( node min word -- classes intervals )
+    pick >r
+    >r over r>
+    math-output-interval-2
+    >r math-output-class r>
+    r> post-process ; inline
+
+{
+    { + integer interval+ }
+    { - integer interval- }
+    { * integer interval* }
+    { / rational interval/ }
+    { /i integer interval/i }
+
+    { fixnum+ f interval+ }
+    { fixnum+fast f interval+ }
+    { fixnum- f interval- }
+    { fixnum-fast f interval- }
+    { fixnum* f interval* }
+    { fixnum*fast f interval* }
+    { fixnum/i f interval/i }
+
+    { bignum+ f interval+ }
+    { bignum- f interval- }
+    { bignum* f interval* }
+    { bignum/i f interval/i }
+    { bignum-shift f interval-shift-safe }
+
+    { float+ f interval+ }
+    { float- f interval- }
+    { float* f interval* }
+    { float/f f interval/ }
+
+    { min fixnum interval-min }
+    { max fixnum interval-max }
+} [
+    first3 [
+        math-output-class/interval-2
+    ] 2curry "output-classes" set-word-prop
+] each
+
+{ fixnum-shift shift } [
+    [
+        dup
+        node-in-d second value-interval*
+        -1./0. 0 [a,b] interval-subset? fixnum integer ?
+        \ interval-shift-safe
+        math-output-class/interval-2
+    ] "output-classes" set-word-prop
+] each
+
+: real-value? ( value -- n ? )
+    dup value? [ value-literal dup real? ] [ drop f f ] if ;
+
+: mod-range ( n -- interval )
+    dup neg swap (a,b) ;
+
+: rem-range ( n -- interval )
+    0 swap [a,b) ;
+
+: bitand-range ( n -- interval )
+    dup 0 < [ drop f ] [ 0 swap [a,b] ] if ;
+
+: math-output-interval-special ( node word -- interval )
+    dup [
+        >r node-in-d second real-value?
+        [ r> execute ] [ r> 2drop f ] if
+    ] [
+        2drop f
+    ] if ; inline
+
+: math-output-class/interval-special ( node min word -- classes intervals )
+    pick >r
+    >r over r>
+    math-output-interval-special
+    >r math-output-class r>
+    r> post-process ; inline
+
+{
+    { mod fixnum mod-range }
+    { fixnum-mod f mod-range }
+    { bignum-mod f mod-range }
+    { float-mod f mod-range }
+
+    { rem integer rem-range }
+
+    { bitand fixnum bitand-range }
+    { fixnum-bitand f bitand-range }
+
+    { bitor fixnum f }
+    { bitxor fixnum f }
+} [
+    first3 [
+        math-output-class/interval-special
+    ] 2curry "output-classes" set-word-prop
+] each
+
+: twiddle-interval ( i1 -- i2 )
+    dup [
+        node get node-in-d
+        [ value-class* integer class< ] all?
+        [ integral-closure ] when
+    ] when ;
+
+: (comparison-constraints) ( i1 i2 word class -- )
+    node get [
+        >r execute twiddle-interval 0 `input interval,
+        r> 0 `output class,
+    ] set-constraints ; inline
+
+: comparison-constraints ( node true false -- )
+    >r >r dup node set intervals dup [
+        2dup
+        r> general-t (comparison-constraints)
+        r> \ f (comparison-constraints)
+    ] [
+        r> r> 2drop 2drop
+    ] if ; inline
+
+{
+    { < assume< assume>= }
+    { <= assume<= assume> }
+    { > assume> assume<= }
+    { >= assume>= assume< }
+
+    { fixnum< assume< assume>= }
+    { fixnum<= assume<= assume> }
+    { fixnum> assume> assume<= }
+    { fixnum>= assume>= assume< }
+
+    { bignum< assume< assume>= }
+    { bignum<= assume<= assume> }
+    { bignum> assume> assume<= }
+    { bignum>= assume>= assume< }
+
+    { float< assume< assume>= }
+    { float<= assume<= assume> }
+    { float> assume> assume<= }
+    { float>= assume>= assume< }
+} [
+    first3
+    [
+        [ comparison-constraints ] with-scope
+    ] 2curry "constraints" set-word-prop
+] each
+
+{
+    alien-signed-1
+    alien-unsigned-1
+    alien-signed-2
+    alien-unsigned-2
+    alien-signed-4
+    alien-unsigned-4
+    alien-signed-8
+    alien-unsigned-8
+} [
+    dup word-name {
+        {
+            [ "alien-signed-" ?head ]
+            [ string>number 8 * 1- 2^ dup neg swap 1- [a,b] ]
+        }
+        {
+            [ "alien-unsigned-" ?head ]
+            [ string>number 8 * 2^ 1- 0 swap [a,b] ]
+        }
+    } cond 1array
+    [ nip f swap ] curry "output-classes" set-word-prop
+] each
+
+! Associate intervals to classes
+\ fixnum
+most-negative-fixnum most-positive-fixnum [a,b]
+"interval" set-word-prop
+
+\ array-capacity
+0 max-array-capacity [a,b]
+"interval" set-word-prop
+
+{
+    { >fixnum fixnum }
+    { >bignum bignum }
+    { >float float }
+} [
+    [
+        over node-in-d first value-interval*
+        dup pick fits? [ drop f ] unless
+        rot post-process
+    ] curry "output-classes" set-word-prop
+] assoc-each
+
+! Removing overflow checks
+: remove-overflow-check? ( #call -- ? )
+    dup node-out-d first node-class fixnum class< ;
+
+{
+    { + [ fixnum+fast ] }
+    { - [ fixnum-fast ] }
+    { * [ fixnum*fast ] }
+    { fixnum+ [ fixnum+fast ] }
+    { fixnum- [ fixnum-fast ] }
+    { fixnum* [ fixnum*fast ] }
+    ! these are here as an optimization. if they weren't given
+    ! explicitly, the same would be inferred after an extra
+    ! optimization step (see optimistic-inline?)
+    { 1+ [ 1 fixnum+fast ] }
+    { 1- [ 1 fixnum-fast ] }
+    { 2/ [ -1 fixnum-shift ] }
+    { neg [ 0 swap fixnum-fast ] }
+} [
+    [
+        [ dup remove-overflow-check? ] ,
+        [ splice-quot ] curry ,
+    ] { } make 1array define-optimizers
+] assoc-each
+
+! Remove redundant comparisons
+: known-comparison? ( #call -- ? )
+    dup dup node-in-d first node-interval
+    swap dup node-in-d second node-literal real? and ;
+
+: perform-comparison ( #call word -- result )
+    >r dup dup node-in-d first node-interval
+    swap dup node-in-d second node-literal r> execute ; inline
+
+: foldable-comparison? ( #call word -- )
+    >r dup known-comparison? [
+        r> perform-comparison incomparable eq? not
+    ] [
+        r> 2drop f
+    ] if ; inline
+
+: fold-comparison ( #call word -- node )
+    dupd perform-comparison 1array inline-literals ;
+
+{
+    { < interval< }
+    { <= interval<= }
+    { > interval> }
+    { >= interval>= }
+
+    { fixnum< interval< }
+    { fixnum<= interval<= }
+    { fixnum> interval> }
+    { fixnum>= interval>= }
+
+    { bignum< interval< }
+    { bignum<= interval<= }
+    { bignum> interval> }
+    { bignum>= interval>= }
+
+    { float< interval< }
+    { float<= interval<= }
+    { float> interval> }
+    { float>= interval>= }
+} [
+    [
+        dup [ dupd foldable-comparison? ] curry ,
+        [ fold-comparison ] curry ,
+    ] { } make 1array define-optimizers
+] assoc-each
+
+! The following words are handled in a similar way except if
+! the only consumer is a >fixnum we remove the overflow check
+! too
+: consumed-by? ( node word -- ? )
+    swap sole-consumer
+    dup #call? [ node-param eq? ] [ 2drop f ] if ;
+
+: coereced-to-fixnum? ( #call -- ? )
+    \ >fixnum consumed-by? ;
+
+{
+    { fixnum+ [ fixnum+fast ] }
+    { fixnum- [ fixnum-fast ] }
+    { fixnum* [ fixnum*fast ] }
+} [
+    [
+        [
+            dup remove-overflow-check?
+            over coereced-to-fixnum? or
+        ] ,
+        [ splice-quot ] curry ,
+    ] { } make 1array define-optimizers
+] assoc-each
+
+! This will go away when we have cross-word type inference
+{
+    facos fasin fatan
+    fcos fexp fcosh flog fpow
+    fsin fsinh fsqrt
+} [
+    [ drop { float } f ]
+    "output-classes" set-word-prop
+] each
+
+\ fatan2
+[ drop { float float } f ]
+"output-classes" set-word-prop
diff --git a/core/optimizer/math/summary.txt b/core/optimizer/math/summary.txt
new file mode 100644 (file)
index 0000000..b89c9a8
--- /dev/null
@@ -0,0 +1 @@
+Overflow check removal and mathematical identities
diff --git a/core/optimizer/optimizer-docs.factor b/core/optimizer/optimizer-docs.factor
new file mode 100644 (file)
index 0000000..ff69465
--- /dev/null
@@ -0,0 +1,49 @@
+USING: help.markup help.syntax quotations words math
+sequences ;
+IN: optimizer
+
+ARTICLE: "specializers" "Word specializers"
+"The optimizer can be passed hints as to the classes of parameters a word is expected to be called with. The optimizer will then generate multiple versions of word when compiling, specialized to each class."
+$nl
+"Specialization hints are stored in the " { $snippet "\"specializer\"" } " word property. The value of this property is a sequence having the same number of elements as the word has inputs; each element takes one of the following forms and gives the compiler a hint about the corresponding parameter:"
+{ $table
+    { { $snippet { $emphasis "class" } } { "a class word indicates that this parameter is expected to be an instance of the class most of the time." } }
+    { { $snippet "{ " { $emphasis "classes..." } " }" } { "a sequence of class words indicates that this parameter is expected to be an instance of one of these classes most of the time." } }
+    { { $snippet "number" } { "the " { $link number } " class word has a special behavior. It will result in a version of the word being generated for every primitive numeric type, where this parameter is assumed to have that type. A fast jump table will then determine which version is chosen at run time." } }
+    { { $snippet "*" } { "indicates no specialization should be performed on this parameter." } }
+}
+"Specialization can help in the case where a word calls a lot of generic words on the same object - perhaps in a loop - and in most cases, it is anticipated that this object is of a certain class. Using specialization hints, the compiler can be instructed to compile a branch at the beginning of the word; if the branch is taken, the input object has the assumed class, and inlining of generic methods can take place."
+$nl
+"Specialization hints are not declarations; if the inputs do not match what is specified, the word will still run, possibly slower if the compiled code cannot inline methods because of insufficient static type information."
+$nl
+"In some cases, specialization will not help at all, and can make generated code slower from the increase in code size. The compiler is capable of inferring enough static type information to generate efficient code in many cases without explicit help from the programmer. Specializers should be used as a last resort, after profiling shows that a critical loop makes a lot of repeated calls to generic words which dispatch on the same class."
+$nl
+"For example, the " { $link append } " word has a specializer for the very common case where two strings or two arrays are appended:"
+{ $code
+"\\ append"
+"{ { string array } { string array } }"
+"\"specializer\" set-word-prop"
+}
+"The specialized version of a word which will be compiled by the compiler can be inspected:"
+{ $subsection specialized-def } ;
+
+ARTICLE: "optimizer" "Optimizer"
+"The words in the " { $vocab-link "optimizer" } " vocabulary are internal to the compiler and user code has no reason to call them."
+$nl
+"The main entry point into the optimizer:"
+{ $subsection optimize }
+{ $subsection "specializers" } ;
+
+ABOUT: "optimizer"
+
+HELP: optimize-1
+{ $values { "node" "a dataflow graph" } { "newnode" "a dataflow graph" } { "?" "a boolean" } }
+{ $description "Performs a single round of optimization on the dataflow graph, and outputs the new graph together with a new flag indicating if any changes were made." } ;
+
+HELP: optimize
+{ $values { "node" "a dataflow graph" } { "newnode" "a dataflow graph" } }
+{ $description "Continues to optimize a dataflow graph until a fixed point is reached." } ;
+
+HELP: specialized-def
+{ $values { "word" word } { "quot" quotation } }
+{ $description "Outputs the definition of a word after it has been split into specialized branches. This is the definition which will actually be compiled by the compiler." } ;
diff --git a/core/optimizer/optimizer.factor b/core/optimizer/optimizer.factor
new file mode 100644 (file)
index 0000000..66e4ac9
--- /dev/null
@@ -0,0 +1,60 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic hashtables kernel kernel.private math
+namespaces sequences vectors words strings layouts combinators
+combinators.private classes optimizer.backend optimizer.def-use
+optimizer.known-words optimizer.math inference.class
+generic.standard ;
+IN: optimizer
+
+: optimize-1 ( node -- newnode ? )
+    [
+        H{ } clone class-substitutions set
+        H{ } clone literal-substitutions set
+        H{ } clone value-substitutions set
+        dup compute-def-use
+        dup kill-values
+        dup infer-classes
+        optimizer-changed off
+        optimize-nodes
+        optimizer-changed get
+    ] with-scope ;
+
+: optimize ( node -- newnode )
+    optimize-1 [ optimize ] when ;
+
+: simple-specializer ( quot dispatch# classes -- quot )
+    swap (dispatch#) [
+        object add* swap [ 2array ] curry map
+        object method-alist>quot
+    ] with-variable ;
+
+: dispatch-specializer ( quot dispatch# symbol dispatcher -- quot )
+    rot (dispatch#) [
+        [
+            picker %
+            ,
+            get swap <array> ,
+            \ dispatch ,
+        ] [ ] make
+    ] with-variable ;
+
+: tag-specializer ( quot dispatch# -- quot )
+    num-tags \ tag dispatch-specializer ;
+
+: type-specializer ( quot dispatch# -- quot )
+    num-types \ type dispatch-specializer ;
+
+: make-specializer ( quot dispatch# spec -- quot )
+    {
+        { [ dup number eq? ] [ drop tag-specializer ] }
+        { [ dup object eq? ] [ drop type-specializer ] }
+        { [ dup \ * eq? ] [ 2drop ] }
+        { [ dup array? ] [ simple-specializer ] }
+        { [ t ] [ 1array simple-specializer ] }
+    } cond ;
+
+: specialized-def ( word -- quot )
+    dup word-def swap "specializer" word-prop [
+        [ length ] keep <reversed> [ make-specializer ] 2each
+    ] when* ;
diff --git a/core/optimizer/pattern-match/authors.txt b/core/optimizer/pattern-match/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/optimizer/pattern-match/pattern-match.factor b/core/optimizer/pattern-match/pattern-match.factor
new file mode 100644 (file)
index 0000000..ed78330
--- /dev/null
@@ -0,0 +1,32 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: optimizer.pattern-match
+USING: kernel sequences inference namespaces generic
+combinators classes inference.dataflow ;
+
+! Funny pattern matching
+SYMBOL: @
+
+: match-@ ( value -- ? )
+    #! All @ must be eq
+    @ get [ eq? ] [ @ set t ] if* ;
+
+: match-class ( value spec -- ? )
+    >r node get swap node-class r> class< ;
+
+: value-match? ( value spec -- ? )
+    {
+        { [ dup @ eq? ] [ drop match-@ ] }
+        { [ dup class? ] [ match-class ] }
+        { [ over value? not ] [ 2drop f ] }
+        { [ t ] [ swap value-literal = ] }
+    } cond ;
+
+: node-match? ( node values pattern -- ? )
+    [
+        rot node set @ off
+        [ value-match? ] 2all?
+    ] with-scope ;
+
+: in-d-match? ( node pattern -- ? )
+    >r dup node-in-d r> node-match? ;
diff --git a/core/optimizer/pattern-match/summary.txt b/core/optimizer/pattern-match/summary.txt
new file mode 100644 (file)
index 0000000..7f7c1c4
--- /dev/null
@@ -0,0 +1 @@
+Simple pattern matching used by optimizer
diff --git a/core/optimizer/summary.txt b/core/optimizer/summary.txt
new file mode 100644 (file)
index 0000000..65cf363
--- /dev/null
@@ -0,0 +1 @@
+Dataflow IR optimizer
diff --git a/core/optimizer/tags.txt b/core/optimizer/tags.txt
new file mode 100644 (file)
index 0000000..86a7c8e
--- /dev/null
@@ -0,0 +1 @@
+compiler
diff --git a/core/parser/authors.txt b/core/parser/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/parser/parser-docs.factor b/core/parser/parser-docs.factor
new file mode 100644 (file)
index 0000000..29c3da6
--- /dev/null
@@ -0,0 +1,610 @@
+USING: help.markup help.syntax kernel sequences words
+math strings vectors quotations generic effects classes
+vocabs.loader definitions io vocabs source-files
+quotations namespaces ;
+IN: parser
+
+ARTICLE: "vocabulary-search-shadow" "Shadowing word names"
+"If adding a vocabulary to the search path results in a word in another vocabulary becoming inaccessible due to the new vocabulary defining a word with the same name, a message is printed to the " { $link stdio } " stream. Except when debugging suspected name clashes, these messages can be ignored."
+$nl
+"Here is an example where shadowing occurs:"
+{ $code
+    "IN: foe"
+    "USING: sequences io ;"
+    ""
+    ": append"
+    "    #! Prints a message, then calls sequences::append."
+    "    \"foe::append calls sequences::append\" print append ;"
+    ""
+    "IN: fee"
+    ""
+    ": append"
+    "    #! Infinite recursion! Calls fee::append."
+    "    \"fee::append calls fee::append\" print append ;"
+    ""
+    "USE: foe"
+    ""
+    ": append"
+    "    #! Redefining fee::append to call foe::append."
+    "    \"fee::append calls foe::append\" print append ;"
+    ""
+    "\"1234\" \"5678\" append print"
+}
+"When placed in a source file and run, the above code produces the following output:"
+{ $code
+    "fee::append calls foe::append"
+    "foe::append calls sequences::append"
+    "12345678"
+} ;
+
+ARTICLE: "vocabulary-search-errors" "Word lookup errors"
+"If the parser cannot not find a word in the current vocabulary search path, it attempts to look for the word in all loaded vocabularies. Then, one of three things happen:"
+{ $list
+    { "If there are no words having this name at all, an error is thrown and parsing stops." }
+    { "If there is exactly one vocabulary having a word with this name, the vocabulary is automatically added to the search path. This behavior is intended for interactive use and exploratory programming only, and production code should contain full " { $link POSTPONE: USING: } " declarations." }
+    { "If there is more than one vocabulary which contains a word with this name, a restartable error is thrown, with a restart for each vocabulary in question. The restarts add the vocabulary to the search path and continue parsing." }
+}
+"When writing a new vocabulary, one approach is to ignore " { $link POSTPONE: USING: } " declarations altogether, then to load the vocabulary and observe any parser notes and restarts and use this information to write the correct " { $link POSTPONE: USING: } " declaration." ;
+
+ARTICLE: "vocabulary-search" "Vocabulary search"
+"When the parser reads a token, it attempts to look up a word named by that token. The lookup is performed by searching each vocabulary in the search path, in order."
+$nl
+"For a source file the vocabulary search path starts off with two vocabularies:"
+{ $code "syntax\nscratchpad" }
+"The " { $vocab-link "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words. The " { $vocab-link "scratchpad" } " vocabulary is the default vocabulary for new word definitions."
+$nl
+"At the interactive listener, the default search path contains many more vocabularies. Details on the default search path and parser invocation are found in " { $link "parser" } "."
+$nl
+"Three parsing words deal with the vocabulary search path:"
+{ $subsection POSTPONE: USE: }
+{ $subsection POSTPONE: USING: }
+{ $subsection POSTPONE: IN: }
+"Private words can be defined; note that this is just a convention and they can be called from other vocabularies anyway:"
+{ $subsection POSTPONE: <PRIVATE }
+{ $subsection POSTPONE: PRIVATE> }
+{ $subsection "vocabulary-search-errors" }
+{ $subsection "vocabulary-search-shadow" }
+{ $see-also "words" } ;
+
+ARTICLE: "reading-ahead" "Reading ahead"
+"Parsing words can consume input:"
+{ $subsection scan }
+{ $subsection scan-word }
+"For example, the " { $link POSTPONE: HEX: } " word uses this feature to read hexadecimal literals:"
+{ $see POSTPONE: HEX: }
+"It is defined in terms of a lower-level word that takes the numerical base on the data stack, but reads the number from the parser and then adds it to the parse tree:"
+{ $see parse-base }
+"Another simple example is the " { $link POSTPONE: \ } " word:"
+{ $see POSTPONE: \ } ;
+
+ARTICLE: "parsing-word-nest" "Nested structure"
+"Recall that the parser loop calls parsing words with an accumulator vector on the stack. The parser loop can be invoked recursively with a new, empty accumulator; the result can then be added to the original accumulator. This is how parsing words for object literals are implemented; object literals can nest arbitrarily deep."
+$nl
+"A simple example is the parsing word that reads a quotation:"
+{ $see POSTPONE: [ }
+"This word uses a utility word which recursively invokes the parser, reading objects into a new accumulator until an occurrence of " { $link POSTPONE: ] } ":"
+{ $subsection parse-literal }
+"There is another, lower-level word for reading nested structure, which is also useful when called directly:"
+{ $subsection parse-until }
+"Words such as " { $link POSTPONE: ] } " use a declaration which causes them to throw an error when an unpaired occurrence is encountered:"
+{ $subsection POSTPONE: delimiter }
+{ $see-also POSTPONE: { POSTPONE: H{ POSTPONE: V{ POSTPONE: W{ POSTPONE: T{ POSTPONE: } } ;
+
+ARTICLE: "defining-words" "Defining words"
+"Defining words add definitions to the dictionary without modifying the parse tree. The simplest example is the " { $link POSTPONE: SYMBOL: } " word."
+{ $see POSTPONE: SYMBOL: }
+"The key factor in the definition of " { $link POSTPONE: SYMBOL: } " is " { $link CREATE } ", which reads a token from the input and creates a word with that name. This word is then passed to " { $link define-symbol } "."
+{ $subsection CREATE }
+"Colon definitions are defined in a more elaborate way:"
+{ $subsection POSTPONE: : }
+"The " { $link POSTPONE: : } " word first calls " { $link CREATE } ", and then reads input until reaching " { $link POSTPONE: ; } " using a utility word:"
+{ $subsection parse-definition }
+"The " { $link POSTPONE: ; } " word is just a delimiter; an unpaired occurrence throws a parse error:"
+{ $see POSTPONE: ; }
+"There are additional parsing words whose syntax is delimited by  " { $link POSTPONE: ; } ", and they are all implemented by calling " { $link parse-definition } "." ;
+
+ARTICLE: "parsing-tokens" "Parsing raw tokens"
+"So far we have seen how to read individual tokens, or read a sequence of parsed objects until a delimiter. It is also possible to read raw tokens from the input and perform custom processing."
+$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:"
+{ $subsection parse-tokens } ;
+
+ARTICLE: "parsing-words" "Parsing words"
+"The Factor parser is 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."
+$nl
+"Parsing words are marked by suffixing the definition with a " { $link POSTPONE: parsing } " declaration. Here is the simplest possible parsing word; it prints a greeting at parse time:"
+{ $code ": hello \"Hello world\" print ; parsing" }
+"Parsing words must have stack effect " { $snippet "( accum -- accum )" } ", where " { $snippet "accum" } " is the accumulator vector supplied by the parser. Parsing words can read input, add word definitions to the dictionary, and do anything an ordinary word can."
+$nl
+"Tools for implementing parsing words:"
+{ $subsection "reading-ahead" }
+{ $subsection "parsing-word-nest" }
+{ $subsection "defining-words" }
+{ $subsection "parsing-tokens" } ;
+
+ARTICLE: "parser-lexer" "The lexer"
+"Two variables that encapsulate internal parser state:"
+{ $subsection file }
+{ $subsection lexer }
+"Creating a default lexer:"
+{ $subsection <lexer> }
+"A word to test of the end of input has been reached:"
+{ $subsection still-parsing? }
+"A word to get the text of the current line:"
+{ $subsection line-text }
+"A word to advance the lexer to the next line:"
+{ $subsection next-line }
+"Two generic words to override the lexer's token boundary detection:"
+{ $subsection skip-blank }
+{ $subsection skip-word }
+"A utility used when parsing string literals:"
+{ $subsection parse-string }
+"The parser can be invoked with a custom lexer:"
+{ $subsection (parse-lines) }
+{ $subsection with-parser } ;
+
+ARTICLE: "parser-files" "Parsing source files"
+"The parser can run source files:"
+{ $subsection run-file }
+{ $subsection parse-file }
+{ $subsection bootstrap-file }
+"The parser cross-references source files and definitions. This allows it to keep track of removed definitions, and prevent forward references and accidental redefinitions."
+$nl
+"When a source file is reloaded, the parser compares the previous list of definitions with the current list; any definitions which are no longer present in the file are removed by a call to " { $link forget } ". A warning message is printed if any other definitions still depend on the removed definitions."
+$nl
+"The parser also catches forward references when reloading source files. This is best illustrated with an example. Suppose we load a source file " { $snippet "a.factor" } ":"
+{ $code
+    "USING: io sequences ;"
+    "IN: a"
+    ": hello \"Hello\" ;"
+    ": world \"world\" ;"
+    ": hello-world hello " " world 3append print ;"
+}
+"The definitions for " { $snippet "hello" } ", " { $snippet "world" } ", and " { $snippet "hello-world" } " are in the dictionary."
+$nl
+"Now, after some heavily editing and refactoring, the file looks like this:"
+{ $code
+    "USING: namespaces ;"
+    "IN: a"
+    ": hello \"Hello\" % ;"
+    ": hello-world [ hello " " % world ] \"\" make ;"
+    ": world \"world\" % ;"
+}
+"Note that the developer has made a mistake, placing the definition of " { $snippet "world" } " " { $emphasis "after" } " its usage in " { $snippet "hello-world" } "."
+$nl
+"If the parser did not have special checks for this case, then the modified source file would still load, because when the definition of " { $snippet "hello-world" } " on line 4 is being parsed, the " { $snippet "world" } " word is already present in the dictionary from an earlier run. The developer would then not discover this mistake until attempting to load the source file into a fresh image."
+$nl
+"Since this is undesirable, the parser explicitly raises an error if a source file refers to a word which is in the dictionary, but defined after it is used."
+{ $subsection forward-error }
+"If a source file raises a " { $link forward-error } " when loaded into a development image, then it would have raised a " { $link no-word } " error when loaded into a fresh image."
+$nl
+"The parser also catches duplicate definitions. If an artifact is defined twice in the same source file, the earlier definition will never be accessible, and this is almost always a mistake, perhaps due to a bad choice of word names, or a copy and paste error. The parser raises an error in this case."
+{ $subsection redefine-error }
+{ $see-also "source-files" } ;
+
+ARTICLE: "parser-usage" "Reflective parser usage"
+"The parser can be called on a string:"
+{ $subsection eval }
+{ $subsection parse }
+{ $subsection parse-fresh }
+"The parser can also parse from a stream:"
+{ $subsection parse-stream } ;
+
+ARTICLE: "parser" "The parser"
+"This parser is a general facility for reading textual representations of objects and definitions. The parser is implemented in the " { $vocab-link "parser" } " and " { $vocab-link "syntax" } " vocabularies."
+$nl
+"This section concerns itself with usage and extension of the parser. Standard syntax is described in " { $link "syntax" } "."
+{ $subsection "vocabulary-search" }
+{ $subsection "parser-files" }
+{ $subsection "parser-usage" }
+"The parser can be extended."
+{ $subsection "parsing-words" }
+{ $subsection "parser-lexer" } ;
+
+ABOUT: "parser"
+
+: $parsing-note
+    drop
+    "This word should only be called from parsing words."
+    $notes ;
+
+HELP: lexer
+{ $var-description "Stores the current " { $link lexer } " instance." }
+{ $class-description "An object for tokenizing parser input. It has the following slots:"
+    { $list
+        { { $link lexer-text } " - the lines being parsed; an array of strings" }
+        { { $link lexer-line } " - the line number being parsed; unlike most indices this is 1-based for friendlier error reporting and integration with text editors" }
+        { { $link lexer-column } " - the current column position, zero-based" }
+    }
+"Custom lexing can be implemented by delegating a tuple to an instance of this class and implementing the " { $link skip-word } " and " { $link skip-blank } " generic words." } ;
+
+HELP: <lexer>
+{ $values { "text" "a sequence of strings" } { "lexer" lexer } }
+{ $description "Creates a new lexer for tokenizing the given sequence of lines." } ;
+
+HELP: location
+{ $values { "loc" "a " { $snippet "{ path line# }" } " pair" } }
+{ $description "Outputs the current parser location. This value can be passed to " { $link set-where } " or " { $link (save-location) } "." } ;
+
+HELP: redefine-error
+{ $values { "definition" "a definition specifier" } }
+{ $description "Throws a " { $link redefine-error } "." }
+{ $error-description "Indicates that a single source file contains two definitions for the same artifact, one of which shadows the other. This is an error since it indicates a likely mistake, such as two words accidentally named the same by the developer; the error is restartable." } ;
+
+HELP: redefinition?
+{ $values { "definition" "a definition specifier" } { "?" "a boolean" } }
+{ $description "Tests if this definition is already present in the current source file." }
+$parsing-note ;
+
+HELP: (save-location)
+{ $values { "definition" "a definition specifier" } { "loc" "a " { $snippet "{ path line# }" } " pair" } }
+{ $description "Saves the location of a definition and associates this definition with the current source file."
+$nl
+"This is the book-keeping required to detect " { $link redefine-error } " and " { $link forward-error } "." } ;
+
+HELP: save-location
+{ $values { "definition" "a definition specifier" } }
+{ $description "Saves the location of a definition and associates this definition with the current source file."
+$nl
+"This is the book-keeping required to detect " { $link redefine-error } " and " { $link forward-error } "." } ;
+
+HELP: parser-notes
+{ $var-description "A boolean controlling whether the parser will print various notes and warnings. Switched on by default. If a source file is being run for its effect on the " { $link stdio } " stream, this variable should be switched off, to prevent parser notes from polluting the output." } ;
+
+HELP: parser-notes?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if the parser will print various notes and warnings. To disable parser notes, either set " { $link parser-notes } " to " { $link f } ", or pass the " { $snippet "-quiet" } " command line switch." } ;
+
+HELP: next-line
+{ $values { "lexer" lexer } }
+{ $description "Advances the lexer to the next input line, discarding the remainder of the current line." } ;
+
+HELP: file
+{ $var-description "Stores the " { $link source-file } " being parsed. The " { $link source-file-path } " of this object comes from the input parameter to " { $link parse-stream } "." } ;
+
+HELP: old-definitions
+{ $var-description "Stores an assoc where the keys form the set of definitions which were defined by " { $link file } " the most recent time it was loaded." } ;
+
+HELP: new-definitions
+{ $var-description "Stores an assoc where the keys form the set of definitions which were defined so far by the current parsing of " { $link file } "." } ;
+
+HELP: parse-error
+{ $error-description "Thrown when the parser encounters invalid input. A parse error wraps an underlying error and holds the file being parsed, line number, and column number." } ;
+
+HELP: <parse-error>
+{ $values { "msg" "an error" } { "error" parse-error } }
+{ $description "Creates a new " { $link parse-error } ", filling in the location information from the current " { $link lexer } "." } ;
+
+HELP: line-text
+{ $values { "lexer" lexer } { "str" string } }
+{ $description "Outputs the text of the line being parsed." } ;
+
+HELP: skip
+{ $values { "i" "a starting index" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "n" integer } }
+{ $description "Variant of " { $link find* } " that outputs the length of the sequence instead of " { $link f } " if no elements satisfy the predicate." } ;
+
+HELP: change-column
+{ $values { "lexer" lexer } { "quot" "a quotation with stack effect " { $snippet "( col line -- newcol )" } } }
+{ $description "Applies a quotation to the current column and line text to produce a new column, and moves the lexer position." } ;
+
+HELP: skip-blank
+{ $values { "lexer" lexer } }
+{ $contract "Skips whitespace characters." }
+{ $notes "Custom lexers can implement this generic word." } ;
+
+HELP: skip-word
+{ $values { "lexer" lexer } }
+{ $contract
+    "Skips until the end of the current token."
+    $nl
+    "The default implementation treats a single " { $snippet "\"" } " as a word by itself; otherwise it searches forward until a whitespace character or the end of the line."
+}
+{ $notes "Custom lexers can implement this generic word." } ;
+
+HELP: still-parsing-line?
+{ $values { "lexer" lexer } { "?" "a boolean" } }
+{ $description "Outputs " { $link f } " if the end of the current line has been reached, " { $link t } " otherwise." } ;
+
+HELP: parse-token
+{ $values { "lexer" lexer } { "str/f" "a " { $link string } " or " { $link f } } }
+{ $description "Reads the next token from the lexer. Tokens are delimited by whitespace, with the exception that " { $snippet "\"" } " is treated like a single token even when not followed by whitespace." } ;
+
+HELP: scan
+{ $values { "str/f" "a " { $link string } " or " { $link f } } }
+{ $description "Reads the next token from the lexer. See " { $link parse-token } " for details." }
+$parsing-note ;
+
+HELP: bad-escape
+{ $error-description "Indicates the parser encountered an invalid escape code following a backslash (" { $snippet "\\" } ") in a string literal. See " { $link "escape" } " for a list of valid escape codes." } ;
+
+HELP: bad-number
+{ $error-description "Indicates the parser encountered an invalid numeric literal." } ;
+
+HELP: escape
+{ $values { "escape" "a single-character escape" } { "ch" "a character" } }
+{ $description "Converts from a single-character escape code and the corresponding character." }
+{ $examples { $example "CHAR: n escape CHAR: \\n = ." "t" } } ;
+
+HELP: next-escape
+{ $values { "m" "an index into " { $snippet "str" } } { "str" string } { "n" "an index into " { $snippet "str" } } { "ch" "a character" } }
+{ $description "Helper word for " { $link parse-string } " which parses an escape sequence starting at the " { $snippet "m" } "th index of " { $snippet "str" } "." }
+{ $errors "Throws a " { $link bad-escape } " if the string contains an invalid escape sequence." } ;
+
+HELP: next-char
+{ $values { "m" "an index into " { $snippet "str" } } { "str" string } { "n" "an index into " { $snippet "str" } } { "ch" "a character" } }
+{ $description "Helper word for " { $link parse-string } " which parses a character starting at the " { $snippet "m" } "th index of " { $snippet "str" } "." } ;
+
+HELP: parse-string
+{ $values { "str" "a new " { $link string } } }
+{ $description "Parses the line until a quote (\"), interpreting escape codes along the way." }
+{ $errors "Throws an " { $link bad-escape } " if the string contains an invalid escape sequence." }
+$parsing-note ;
+
+HELP: still-parsing?
+{ $values { "lexer" lexer } { "?" "a boolean" } }
+{ $description "Outputs " { $link f } " if end of input has been reached, " { $link t } " otherwise." } ;
+
+HELP: use
+{ $var-description "A variable holding the current vocabulary search path as a sequence of assocs." } ;
+
+{ use in use+ (use+) set-use set-in POSTPONE: USING: POSTPONE: USE: file-vocabs } related-words
+
+HELP: in
+{ $var-description "A variable holding the name of the current vocabulary for new definitions." } ;
+
+HELP: shadow-warnings
+{ $values { "vocab" "an assoc mapping strings to words" } { "vocabs" "a sequence of assocs" } }
+{ $description "Tests if any keys in " { $snippet "vocab" } " shadow keys in the elements of " { $snippet "vocabs" } ", and if so, prints a warning message. These warning messages can be disabled by setting " { $link parser-notes } " to " { $link f } "." } ;
+
+HELP: (use+)
+{ $values { "vocab" "an assoc mapping strings to words" } }
+{ $description "Adds an assoc at the front of the search path." }
+$parsing-note ;
+
+HELP: use+
+{ $values { "vocab" string } }
+{ $description "Adds a new vocabulary at the front of the search path after loading it if necessary. Subsequent word lookups by the parser will search this vocabulary first." }
+$parsing-note
+{ $errors "Throws an error if the vocabulary does not exist." } ;
+
+HELP: set-use
+{ $values { "seq" "a sequence of strings" } }
+{ $description "Sets the vocabulary search path. Later vocabularies take precedence." }
+{ $errors "Throws an error if one of the vocabularies does not exist." }
+$parsing-note ;
+
+HELP: add-use
+{ $values { "seq" "a sequence of strings" } }
+{ $description "Adds multiple vocabularies to the search path, with later vocabularies taking precedence." }
+{ $errors "Throws an error if one of the vocabularies does not exist." }
+$parsing-note ;
+
+HELP: set-in
+{ $values { "name" string } }
+{ $description "Sets the current vocabulary where new words will be defined, creating the vocabulary first if it does not exist." }
+$parsing-note ;
+
+HELP: create-in
+{ $values { "string" "a word name" } { "word" "a new word" } }
+{ $description "Creates a word in the current vocabulary. Until re-defined, the word throws an error when invoked." }
+$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: } "." }
+$parsing-note ;
+
+HELP: CREATE
+{ $values { "word" word } }
+{ $description "Reads the next token from the line currently being parsed, and creates a word with that name in the current vocabulary." }
+{ $errors "Throws an error if the end of the line is reached." }
+$parsing-note ;
+
+HELP: no-word
+{ $values { "name" string } { "newword" word } }
+{ $description "Throws a " { $link no-word } " error." }
+{ $error-description "Thrown if the parser encounters a token which does not name a word in the current vocabulary search path. If any words with this name exist in vocabularies not part of the search path, a number of restarts will offer to add those vocabularies to the search path and use the chosen word." }
+{ $notes "Apart from a missing " { $link POSTPONE: USE: } ", this error can also indicate an ordering issue. In Factor, words must be defined before they can be called. Mutual recursion can be implemented via " { $link POSTPONE: DEFER: } "." } ;
+
+HELP: search
+{ $values { "str" string } { "word" word } }
+{ $description "Searches for a word by name in the current vocabulary search path. If no such word could be found, throws a " { $link no-word } " error. If the search path does not contain a word with this name but other vocabularies do, the error will have restarts offering to add vocabularies to the search path." }
+$parsing-note ;
+
+HELP: forward-error
+{ $values { "word" word } } 
+{ $description "Throws a " { $link forward-error } "." }
+{ $description "Indicates a word is being referenced prior to the location of its most recent definition. This can only happen if a source file is loaded, and subsequently edited such that two dependent definitions are reversed." } ;
+
+HELP: scan-word
+{ $values { "word/number/f" "a word, number or " { $link f } } }
+{ $description "Reads the next token from parser input. If the token is a valid number literal, it is converted to a number, otherwise the dictionary is searched for a word named by the token. Outputs " { $link f } " if the end of the input has been reached." }
+{ $errors "Throws an error if the token does not name a word, and does not parse as a number." }
+$parsing-note ;
+
+HELP: unexpected
+{ $values { "want" "a " { $link word } " or " { $link f } } { "got" word } }
+{ $description "Throws an " { $link unexpected } " error." }
+{ $error-description "Thrown by the parser if an unmatched closing delimiter is encountered." }
+{ $examples
+    "Parsing the following snippet will throw this error:"
+    { $code "[ 1 2 3 }" }
+} ;
+
+HELP: unexpected-eof
+{ $values { "word" "a " { $link word } } }
+{ $description "Throws an " { $link unexpected } " error indicating the parser was looking for an occurrence of " { $snippet "word" } " but encountered end of file." } ;
+
+HELP: parse-step
+{ $values { "accum" vector } { "end" word } { "?" "a boolean" } }
+{ $description "Parses a token. If the token is a number or an ordinary word, it is added to the accumulator. If it is a parsing word, calls the parsing word with the accumulator on the stack. Outputs " { $link f } " if " { $snippet "end" } " is encountered, " { $link t } " otherwise." }
+$parsing-note ;
+
+HELP: (parse-until)
+{ $values { "accum" vector } { "end" word } }
+{ $description "Parses objects from parser input until " { $snippet "end" } " is encountered, adding them to the accumulator." }
+$parsing-note ;
+
+HELP: parse-until
+{ $values { "end" word } { "vec" "a new vector" } }
+{ $description "Parses objects from parser input until " { $snippet "end" } ". Outputs a new vector with the results." }
+{ $examples "This word is used to implement " { $link POSTPONE: ARTICLE: } "." }
+$parsing-note ;
+
+{ parse-tokens (parse-until) parse-until } related-words
+
+HELP: parsed
+{ $values { "accum" vector } { "obj" object } }
+{ $description "Convenience word for parsing words. It behaves exactly the same as " { $link push } ", except the accumulator remains on the stack." }
+$parsing-note ;
+
+HELP: with-parser
+{ $values { "lexer" lexer } { "quot" "a quotation with stack effect " { $snippet "( -- accum )" } } { "newquot" "a new " { $link quotation } } }
+{ $description "Sets up the parser and calls the quotation. The quotation can make use of parsing words such as " { $link scan } " and " { $link parse-until } ". It must yield a sequence, which is converted to a quotation and output. Any errors thrown by the quotation are wrapped in parse errors." } ;
+
+HELP: (parse-lines)
+{ $values { "lexer" lexer } { "quot" "a new " { $link quotation } } }
+{ $description "Parses Factor source code using a custom lexer. The vocabulary search path is taken from the current scope." }
+{ $errors "Throws a " { $link parse-error } " if the input is malformed." } ;
+
+HELP: parse-lines
+{ $values { "lines" "a sequence of strings" } { "quot" "a new " { $link quotation } } }
+{ $description "Parses Factor source code which has been tokenized into lines. The vocabulary search path is taken from the current scope." }
+{ $errors "Throws a " { $link parse-error } " if the input is malformed." } ;
+
+HELP: lexer-factory
+{ $var-description "A variable holding a quotation with stack effect " { $snippet "( lines -- lexer )" } ". This quotation is called by the parser to create " { $link lexer } " instances. This variable can be rebound to a quotation which outputs a custom tuple delegating to " { $link lexer } " to customize syntax." } ;
+
+HELP: parse-effect
+{ $values { "effect" "an instance of " { $link effect } } }
+{ $description "Parses a stack effect from the current input line." }
+{ $examples "This word is used by " { $link POSTPONE: ( } " to parse stack effect declarations." }
+$parsing-note ;
+
+HELP: parse-base
+{ $values { "base" "an integer between 2 and 36" } { "parsed" integer } }
+{ $description "Reads an integer in a specific numerical base from the parser input." }
+$parsing-note ;
+
+HELP: parse-literal
+{ $values { "accum" vector } { "end" word } { "quot" "a quotation with stack effect " { $snippet "( seq -- obj )" } } }
+{ $description "Parses objects from parser input until " { $snippet "end" } ", applies the quotation to the resulting sequence, and adds the output value to the accumulator." }
+{ $examples "This word is used to implement " { $link POSTPONE: C{ } "." }
+$parsing-note ;
+
+HELP: parse-definition
+{ $values { "quot" "a new " { $link quotation } } }
+{ $description "Parses objects from parser input until " { $link POSTPONE: ; } " and outputs a quotation with the results." }
+{ $examples "This word is used to implement " { $link POSTPONE: : } "." }
+$parsing-note ;
+
+HELP: bootstrap-syntax
+{ $var-description "Only set during bootstrap. Stores a copy of the " { $link vocab-words } " of the host's syntax vocabulary; this allows the host's parsing words to be used during bootstrap source parsing, not the target's." } ;
+
+HELP: file-vocabs
+{ $description "Installs the initial the vocabulary search path for parsing a file. This consists of the " { $snippet "syntax" } " vocabulary together with the " { $snippet "scratchpad" } " vocabulary." } ;
+
+HELP: parse
+{ $values { "str" string } { "quot" quotation } }
+{ $description "Parses Factor source code from a string. The current vocabulary search path is used." }
+{ $errors "Throws a parse error if the input is malformed." } ;
+
+HELP: parse-fresh
+{ $values { "lines" "a sequence of strings" } { "quot" quotation } }
+{ $description "Parses Factor source code in a sequence of lines. The initial vocabulary search path is used (see " { $link file-vocabs } ")." }
+{ $errors "Throws a parse error if the input is malformed." } ;
+
+HELP: eval
+{ $values { "str" string } }
+{ $description "Parses Factor source code from a string, and calls the resulting quotation. The current vocabulary search path is used." }
+{ $errors "Throws an error if the input is malformed, or if the quotation throws an error." } ;
+
+HELP: parse-hook
+{ $var-description "A quotation called by " { $link parse-stream } " after parsing the input stream. The default value recompiles new word definitions; see " { $link "recompile" } " for details." } ;
+
+{ parse-hook no-parse-hook } related-words
+
+HELP: no-parse-hook
+{ $values { "quot" "a quotation" } }
+{ $description "Runs the quotation in a new dynamic scope where " { $link parse-hook } " is set to " { $link f } ", then calls the outer " { $link parse-hook } " after the quotation returns. This has the effect of postponing any recompilation to the end of a quotation." } ;
+
+HELP: start-parsing
+{ $values { "stream" "an input stream" } { "name" "a pathname string" } }
+{ $description "Prepares to parse a source file by reading the entire contents of the stream and setting some variables. The pathname identifies the stream for cross-referencing purposes." }
+{ $errors "Throws an I/O error if there was an error reading from the stream." }
+{ $notes "This is one of the factors of " { $link parse-stream } "." } ;
+
+HELP: outside-usages
+{ $values { "seq" "a sequence of definitions" } { "usages" "an association list mapping definitions to sequences of definitions" } }
+{ $description "Outputs an association list mapping elements of " { $snippet "seq" } " to lists of usages which exclude the definitions in " { $snippet "seq" } " themselves." } ;
+
+HELP: filter-moved
+{ $values { "assoc" "an assoc where the keys are definitions" } { "newassoc" "an assoc where the keys are definitions" } }
+{ $description "Removes all definitions from the assoc which are no longer present in the current " { $link file } "." } ;
+
+HELP: smudged-usage
+{ $values { "usages" "a sequence of definitions which reference removed definitions" } { "referenced" "a sequence of definitions removed from this source file which are still referenced elsewhere" } { "removed" "a sequence of definitions removed from this source file" } }
+{ $description "Collects information about changed word definitioins after parsing." } ;
+
+HELP: forget-smudged
+{ $description "Forgets removed definitions and prints a warning message if any of them are still referenced from other source files." } ;
+
+HELP: record-definitions
+{ $values { "file" source-file } }
+{ $description "Records that all " { $link new-definitions } " were defined in " { $snippet "file" } "." } ;
+
+HELP: finish-parsing
+{ $values { "quot" "the quotation just parsed" } }
+{ $description "Records information to the current " { $link file } " and prints warnings about any removed definitions which are still in use." }
+{ $notes "This is one of the factors of " { $link parse-stream } "." } ;
+
+HELP: undo-parsing
+{ $description "Records information to the current " { $link file } " after an incomplete parse which ended with an error." } ;
+
+HELP: parse-stream
+{ $values { "stream" "an input stream" } { "name" "a file name for error reporting and cross-referencing" } { "quot" quotation } }
+{ $description "Parses Factor source code read from the stream. The initial vocabulary search path is used." }
+{ $errors "Throws an I/O error if there was an error reading from the stream. Throws a parse error if the input is malformed." } ;
+
+HELP: parse-file
+{ $values { "file" "a pathname string" } { "quot" quotation } }
+{ $description "Parses the Factor source code stored in a file. The initial vocabulary search path is used." }
+{ $errors "Throws an I/O error if there was an error reading from the file. Throws a parse error if the input is malformed." } ;
+
+HELP: run-file
+{ $values { "file" "a pathname string" } }
+{ $description "Parses the Factor source code stored in a file and runs it. The initial vocabulary search path is used." }
+{ $errors "Throws an error if loading the file fails, there input is malformed, or if a runtime error occurs while calling the parsed quotation." }  ;
+
+HELP: ?run-file
+{ $values { "path" "a pathname string" } }
+{ $description "If the file exists, runs it with " { $link run-file } ", otherwise does nothing." } ;
+
+HELP: reload
+{ $values { "defspec" "a definition specifier" } }
+{ $description "Reloads the source file containing the definition." }
+{ $examples
+    "Reloading a word definition:"
+    { $code "\\ foo reload" }
+    "A word's documentation:"
+    { $code "\\ foo >link reload" }
+    "A method definition:"
+    { $code "{ editor draw-gadget* } reload" }
+    "A help article:"
+    { $code "\"handbook\" >link reload" }
+} ;
+
+HELP: bootstrap-file
+{ $values { "path" "a pathname string" } }
+{ $description "If bootstrapping, parses the source file and adds its top level form to the quotation being constructed with " { $link make } "; the bootstrap code uses this to build up a boot quotation to be run on image startup. If not bootstrapping, just runs the file normally." } ;
+
+HELP: ?bootstrap-file
+{ $values { "path" "a pathname string" } }
+{ $description "If the file exists, loads it with " { $link bootstrap-file } ", otherwise does nothing." } ;
+
+HELP: eval>string
+{ $values { "str" string } { "output" string } }
+{ $description "Evaluates the Factor code in " { $snippet "str" } " with the " { $link stdio } " stream rebound to a string output stream, then outputs the resulting string." } ;
diff --git a/core/parser/parser-tests.factor b/core/parser/parser-tests.factor
new file mode 100644 (file)
index 0000000..fe565aa
--- /dev/null
@@ -0,0 +1,346 @@
+USING: arrays math parser tools.test kernel generic words
+io.streams.string namespaces classes effects source-files
+assocs sequences strings io.files definitions continuations
+sorting tuples ;
+IN: temporary
+
+[
+    file-vocabs
+
+    [ 1 CHAR: a ]
+    [ 0 "abcd" next-char ] unit-test
+
+    [ 6 CHAR: \s ]
+    [ 1 "\\u0020hello" next-escape ] unit-test
+
+    [ 2 CHAR: \n ]
+    [ 1 "\\nhello" next-escape ] unit-test
+
+    [ 6 CHAR: \s ]
+    [ 0 "\\u0020hello" next-char ] unit-test
+
+    [ [ 1 [ 2 [ 3 ] 4 ] 5 ] ]
+    [ "1\n[\n2\n[\n3\n]\n4\n]\n5" parse ]
+    unit-test
+
+    [ [ t t f f ] ]
+    [ "t t f f" parse ]
+    unit-test
+
+    [ [ "hello world" ] ]
+    [ "\"hello world\"" parse ]
+    unit-test
+
+    [ [ "\n\r\t\\" ] ]
+    [ "\"\\n\\r\\t\\\\\"" parse ]
+    unit-test
+
+    [ "hello world" ]
+    [
+        "IN: temporary : hello \"hello world\" ;"
+        parse call "USE: scratchpad hello" eval
+    ] unit-test
+
+    [ ]
+    [ "! This is a comment, people." parse call ]
+    unit-test
+
+    ! Test escapes
+
+    [ [ " " ] ]
+    [ "\"\\u0020\"" parse ]
+    unit-test
+
+    [ [ "'" ] ]
+    [ "\"\\u0027\"" parse ]
+    unit-test
+
+    [ "\\u123" parse ] unit-test-fails
+
+    ! Test EOL comments in multiline strings.
+    [ [ "Hello" ] ] [ "#! This calls until-eol.\n\"Hello\"" parse ] unit-test
+
+    [ word ] [ \ f class ] unit-test
+
+    ! Test stack effect parsing
+
+    : effect-parsing-test ( a b -- c ) + ;
+
+    [ t ] [
+        "effect-parsing-test" "temporary" lookup
+        \ effect-parsing-test eq?
+    ] unit-test
+
+    [ T{ effect f { "a" "b" } { "c" } f } ]
+    [ \ effect-parsing-test "declared-effect" word-prop ] unit-test
+
+    : baz ( a b -- * ) 2array throw ;
+
+    [ t ]
+    [ \ baz "declared-effect" word-prop effect-terminated? ]
+    unit-test
+
+    [ [ ] ] [ "IN: temporary USE: math : effect-parsing-test ( a b -- d ) - ;" parse ] unit-test
+
+    [ t ] [
+        "effect-parsing-test" "temporary" lookup
+        \ effect-parsing-test eq?
+    ] unit-test
+
+    [ T{ effect f { "a" "b" } { "d" } f } ]
+    [ \ effect-parsing-test "declared-effect" word-prop ] unit-test
+
+    [ [ ] ] [ "IN: temporary : effect-parsing-test ;" parse ] unit-test
+
+    [ f ] [ \ effect-parsing-test "declared-effect" word-prop ] unit-test
+
+    ! Funny bug
+    [ 2 ] [ "IN: temporary : \0. 2 ; \0." eval ] unit-test
+
+    [ "IN: temporary : missing-- ( a b ) ;" eval ] unit-test-fails
+
+    ! These should throw errors
+    [ "HEX: zzz" parse ] unit-test-fails
+    [ "OCT: 999" parse ] unit-test-fails
+    [ "BIN: --0" parse ] unit-test-fails
+
+    [ f ] [
+        "IN: temporary : foo ; TUPLE: foo ;" parse drop
+        "foo" "temporary" lookup symbol?
+    ] unit-test
+
+    ! Another funny bug
+    [ t ] [
+        [
+            "scratchpad" in set
+            { "scratchpad" "arrays" } set-use
+            [
+                ! This shouldn't modify in/use in the outer scope!
+                file-vocabs
+            ] with-scope
+
+            use get { "scratchpad" "arrays" } set-use use get =
+        ] with-scope
+    ] unit-test
+    DEFER: foo
+
+    "IN: temporary USING: math prettyprint ; : foo 2 2 + . ; parsing" eval
+
+    [ [ ] ] [ "USE: temporary foo" parse ] unit-test
+
+    "IN: temporary USING: math prettyprint ; : foo 2 2 + . ;" eval
+
+    [ t ] [
+        "USE: temporary foo" parse
+        first "foo" "temporary" lookup eq?
+    ] unit-test
+
+    ! Test smudging
+
+    [ 1 ] [
+        "IN: temporary : smudge-me ;" <string-reader> "foo"
+        parse-stream drop
+
+        "foo" source-file source-file-definitions assoc-size
+    ] unit-test
+
+    [ t ] [ "smudge-me" "temporary" lookup >boolean ] unit-test
+
+    [ ] [
+        "IN: temporary : smudge-me-more ;" <string-reader> "foo"
+        parse-stream drop
+    ] unit-test
+
+    [ t ] [ "smudge-me-more" "temporary" lookup >boolean ] unit-test
+    [ f ] [ "smudge-me" "temporary" lookup >boolean ] unit-test
+
+    [ 3 ] [
+        "IN: temporary USING: math strings ; GENERIC: smudge-me M: integer smudge-me ; M: string smudge-me ;" <string-reader> "foo"
+        parse-stream drop
+
+        "foo" source-file source-file-definitions assoc-size
+    ] unit-test
+
+    [ 1 ] [
+        "IN: temporary USING: arrays ; M: array smudge-me ;" <string-reader> "bar"
+        parse-stream drop
+
+        "bar" source-file source-file-definitions assoc-size
+    ] unit-test
+
+    [ 2 ] [
+        "IN: temporary USING: math strings ; GENERIC: smudge-me M: integer smudge-me ;" <string-reader> "foo"
+        parse-stream drop
+
+        "foo" source-file source-file-definitions assoc-size
+    ] unit-test
+    
+    [ t ] [
+        array "smudge-me" "temporary" lookup order memq?
+    ] unit-test
+    
+    [ t ] [
+        integer "smudge-me" "temporary" lookup order memq?
+    ] unit-test
+    
+    [ f ] [
+        string "smudge-me" "temporary" lookup order memq?
+    ] unit-test
+
+    [ ] [
+        "IN: temporary USE: math 2 2 +" <string-reader> "a"
+        parse-stream drop
+    ] unit-test
+    
+    [ t ] [
+        "a" <pathname> \ + usage member?
+    ] unit-test
+
+    [ ] [
+        "IN: temporary 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: temporary DEFER: x : y x ; : x y ;"
+            <string-reader> "a" parse-stream drop
+        ] times
+    ] unit-test
+    
+    "a" source-files get delete-at
+
+    [ t ] [
+        [
+            "IN: temporary : x ; : y 3 throw ; parsing y"
+            <string-reader> "a" parse-stream
+        ] catch parse-error?
+    ] unit-test
+
+    [ t ] [
+        "y" "temporary" lookup >boolean
+    ] unit-test
+
+    [ f ] [
+        "IN: temporary : x ;"
+        <string-reader> "a" parse-stream drop
+        
+        "y" "temporary" lookup
+    ] unit-test
+
+    ! Test new forward definition logic
+    [ ] [
+        "IN: axx : axx ;"
+        <string-reader> "axx" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "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
+
+    [ t ] [ "bxx" "axx" 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
+    
+    ! And hope not to get a forward-error!
+
+    ! Turning a generic into a non-generic could cause all
+    ! kinds of funnyness
+    [ ] [
+        "IN: ayy USE: kernel GENERIC: ayy M: object ayy ;"
+        <string-reader> "ayy" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "IN: ayy USE: kernel : ayy ;"
+        <string-reader> "ayy" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "IN: azz TUPLE: my-class ; GENERIC: a-generic"
+        <string-reader> "azz" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "USE: azz M: my-class a-generic ;"
+        <string-reader> "azz-2" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "IN: azz GENERIC: a-generic"
+        <string-reader> "azz" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "USE: azz USE: math M: integer a-generic ;"
+        <string-reader> "azz-2" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "IN: temporary : <bogus-error> ; : bogus <bogus-error> ;"
+        <string-reader> "bogus-error" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "IN: temporary TUPLE: bogus-error ; C: <bogus-error> bogus-error : bogus <bogus-error> ;"
+        <string-reader> "bogus-error" parse-stream drop
+    ] unit-test
+
+    ! Problems with class predicates -vs- ordinary words
+    [ ] [
+        "IN: temporary TUPLE: killer ;"
+        <string-reader> "removing-the-predicate" parse-stream drop
+    ] unit-test
+
+    [ ] [
+        "IN: temporary GENERIC: killer?"
+        <string-reader> "removing-the-predicate" parse-stream drop
+    ] unit-test
+    
+    [ t ] [
+        "killer?" "temporary" lookup >boolean
+    ] unit-test
+
+    [ t ] [
+        [
+            "IN: temporary TUPLE: another-pred-test ; GENERIC: another-pred-test?"
+            <string-reader> "removing-the-predicate" parse-stream
+        ] catch [ redefine-error? ] is?
+    ] unit-test
+] with-scope
+
+[
+    : FILE file get parsed ; parsing
+
+    FILE file set
+
+    : ~a ;
+    : ~b ~a ;
+    : ~c ;
+    : ~d ;
+
+    H{ { ~a ~a } { ~c ~c } { ~d ~d } } old-definitions set
+    
+    H{ { ~d ~d } } new-definitions set
+    
+    [ V{ ~b } { ~a } { ~a ~c } ] [
+        smudged-usage
+        natural-sort
+    ] unit-test
+] with-scope
diff --git a/core/parser/parser.factor b/core/parser/parser.factor
new file mode 100644 (file)
index 0000000..0eb4d31
--- /dev/null
@@ -0,0 +1,522 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions generic assocs kernel math
+namespaces prettyprint sequences strings vectors words
+quotations inspector io.styles io combinators sorting
+splitting math.parser effects continuations debugger 
+io.files io.streams.string io.streams.lines vocabs
+source-files classes hashtables ;
+IN: parser
+
+SYMBOL: file
+
+TUPLE: lexer text line column ;
+
+: <lexer> ( text -- lexer ) 1 0 lexer construct-boa ;
+
+: line-text ( lexer -- str )
+    dup lexer-line 1- swap lexer-text ?nth ;
+
+: location ( -- loc )
+    file get lexer get lexer-line 2dup and
+    [ >r source-file-path r> 2array ] [ 2drop f ] if ;
+
+SYMBOL: old-definitions
+SYMBOL: new-definitions
+
+TUPLE: redefine-error def ;
+
+M: redefine-error error.
+    "Re-definition of " write
+    redefine-error-def . ;
+
+: redefine-error ( definition -- )
+    \ redefine-error construct-boa
+    { { "Continue" t } } throw-restarts drop ;
+
+: redefinition? ( definition -- ? )
+    dup class? [ drop f ] [ new-definitions get key? ] if ;
+
+: (save-location) ( definition loc -- )
+    over redefinition? [ over redefine-error ] when
+    over set-where
+    dup new-definitions get dup [ set-at ] [ 3drop ] if ;
+
+: save-location ( definition -- )
+    location (save-location) ;
+
+SYMBOL: parser-notes
+
+t parser-notes set-global
+
+: parser-notes? ( -- ? )
+    parser-notes get "quiet" get not and ;
+
+: file. ( file -- )
+    [
+        source-file-path <pathname> pprint
+    ] [
+        "<interactive>" write
+    ] if* ":" write ;
+
+: note. ( str -- )
+    parser-notes? [
+        file get file.
+        lexer get [
+            lexer-line number>string print
+        ] [
+            nl
+        ] if*
+        "Note: " write dup print
+    ] when drop ;
+
+: next-line ( lexer -- )
+    0 over set-lexer-column
+    dup lexer-line 1+ swap set-lexer-line ;
+
+: skip ( i seq quot -- n )
+    over >r find* drop
+    [ r> drop ] [ r> length ] if* ; inline
+
+: change-column ( lexer quot -- )
+    swap
+    [ dup lexer-column swap line-text rot call ] keep
+    set-lexer-column ; inline
+
+GENERIC: skip-blank ( lexer -- )
+
+M: lexer skip-blank ( lexer -- )
+    [ [ blank? not ] skip ] change-column ;
+
+GENERIC: skip-word ( lexer -- )
+
+M: lexer skip-word ( lexer -- )
+    [
+        2dup nth CHAR: " =
+        [ drop 1+ ] [ [ blank? ] skip ] if
+    ] change-column ;
+
+: still-parsing? ( lexer -- ? )
+    dup lexer-line swap lexer-text length <= ;
+
+: still-parsing-line? ( lexer -- ? )
+    dup lexer-column swap line-text length < ;
+
+: (parse-token) ( lexer -- str )
+    [ lexer-column ] keep
+    [ skip-word ] keep
+    [ lexer-column ] keep
+    line-text subseq ;
+
+:  parse-token ( lexer -- str/f )
+    dup still-parsing? [
+        dup skip-blank
+        dup still-parsing-line?
+        [ (parse-token) ] [ dup next-line parse-token ] if
+    ] [ drop f ] if ;
+
+: scan ( -- str/f ) lexer get parse-token ;
+
+TUPLE: bad-escape ;
+
+: bad-escape ( -- * ) \ bad-escape construct-empty throw ;
+
+M: bad-escape summary drop "Bad escape code" ;
+
+: escape ( escape -- ch )
+    H{
+        { CHAR: e  CHAR: \e }
+        { CHAR: n  CHAR: \n }
+        { CHAR: r  CHAR: \r }
+        { CHAR: t  CHAR: \t }
+        { CHAR: s  CHAR: \s }
+        { CHAR: \s CHAR: \s }
+        { CHAR: 0  CHAR: \0 }
+        { CHAR: \\ CHAR: \\ }
+        { CHAR: \" CHAR: \" }
+    } at [ bad-escape ] unless* ;
+
+: next-escape ( m str -- n ch )
+    2dup nth CHAR: u =
+    [ >r 1+ dup 4 + tuck r> subseq hex> ]
+    [ over 1+ -rot nth escape ] if ;
+
+: next-char ( m str -- n ch )
+    2dup nth CHAR: \\ =
+    [ >r 1+ r> next-escape ] [ over 1+ -rot nth ] if ;
+
+: (parse-string) ( m str -- n )
+    2dup nth CHAR: " =
+    [ drop 1+ ] [ [ next-char , ] keep (parse-string) ] if ;
+
+: parse-string ( -- str )
+    lexer get [
+        [ (parse-string) ] "" make swap
+    ] change-column ;
+
+TUPLE: parse-error file line col text ;
+
+: <parse-error> ( msg -- error )
+    file get
+    lexer get lexer-line
+    lexer get lexer-column
+    lexer get line-text
+    parse-error construct-boa
+    [ set-delegate ] keep ;
+
+: parse-dump ( error -- )
+    dup parse-error-file file.
+    dup parse-error-line number>string print
+    dup parse-error-text dup string? [ print ] [ drop ] if
+    parse-error-col 0 or CHAR: \s <string> write
+    "^" print ;
+
+M: parse-error error.
+    dup parse-dump  delegate error. ;
+
+SYMBOL: use
+SYMBOL: in
+
+: word/vocab% ( word -- )
+    "(" % dup word-vocabulary % " " % word-name % ")" % ;
+
+: shadow-warning ( new old -- )
+    2dup eq? [
+        2drop
+    ] [
+        [ word/vocab% " shadowed by " % word/vocab% ] "" make
+        note.
+    ] if ;
+
+: shadow-warnings ( vocab vocabs -- )
+    [
+        swapd assoc-stack dup
+        [ shadow-warning ] [ 2drop ] if
+    ] curry assoc-each ;
+
+: (use+) ( vocab -- )
+    vocab-words use get 2dup shadow-warnings push ;
+
+: use+ ( vocab -- )
+    load-vocab (use+) ;
+
+: add-use ( seq -- ) [ use+ ] each ;
+
+: set-use ( seq -- )
+    [ vocab-words ] map [ ] subset >vector use set ;
+
+: check-vocab-string ( name -- name )
+    dup string?
+    [ "Vocabulary name must be a string" throw ] unless ;
+
+: set-in ( name -- )
+    check-vocab-string dup in set create-vocab (use+) ;
+
+: create-in ( string -- word )
+    in get create dup set-word dup save-location ;
+
+TUPLE: unexpected want got ;
+
+: unexpected ( want got -- * )
+    \ unexpected construct-boa throw ;
+
+PREDICATE: unexpected unexpected-eof
+    unexpected-got not ;
+
+: unexpected-eof ( word -- * ) f unexpected ;
+
+: (parse-tokens) ( accum end -- accum )
+    scan 2dup = [
+        2drop
+    ] [
+        [ pick push (parse-tokens) ] [ unexpected-eof ] if*
+    ] if ;
+
+: parse-tokens ( end -- seq )
+    100 <vector> swap (parse-tokens) >array ;
+
+: CREATE ( -- word ) scan create-in ;
+
+: CREATE-CLASS ( -- word )
+    scan create-in dup predicate-word save-location ;
+
+: word-restarts ( possibilities -- restarts )
+    natural-sort [
+        [ "Use the word " swap summary append ] keep
+    ] { } map>assoc ;
+
+TUPLE: no-word name ;
+
+M: no-word summary
+    drop "Word not found in current vocabulary search path" ;
+
+: no-word ( name -- newword )
+    dup \ no-word construct-boa
+    swap words-named word-restarts throw-restarts
+    dup word-vocabulary (use+) ;
+
+: forward-reference? ( word -- ? )
+    dup old-definitions get key?
+    swap new-definitions get key? not and ;
+
+TUPLE: forward-error word ;
+
+M: forward-error error.
+    "Forward reference to " write forward-error-word . ;
+
+: forward-error ( word -- )
+    \ forward-error construct-boa throw ;
+
+: check-forward ( str word -- word )
+    dup forward-reference? [
+        drop
+        dup use get
+        [ at ] curry* map [ ] subset
+        [ forward-reference? not ] find nip
+        [ ] [ forward-error ] ?if
+    ] [
+        nip
+    ] if ;
+
+: search ( str -- word )
+    dup use get assoc-stack [ check-forward ] [ no-word ] if* ;
+
+: scan-word ( -- word/number/f )
+    scan dup [ dup string>number [ ] [ search ] ?if ] when ;
+
+: parse-step ( accum end -- accum ? )
+    scan-word {
+        { [ 2dup eq? ] [ 2drop f ] }
+        { [ dup not ] [ drop unexpected-eof t ] }
+        { [ dup delimiter? ] [ unexpected t ] }
+        { [ dup parsing? ] [ nip execute t ] }
+        { [ t ] [ pick push drop t ] }
+    } cond ;
+
+: (parse-until) ( accum end -- accum )
+    dup >r parse-step [ r> (parse-until) ] [ r> drop ] if ;
+
+: parse-until ( end -- vec )
+    100 <vector> swap (parse-until) ;
+
+: parsed ( accum obj -- accum ) over push ;
+
+: with-parser ( lexer quot -- newquot )
+    swap lexer set
+    [ call >quotation ] [ <parse-error> rethrow ] recover ;
+
+: (parse-lines) ( lexer -- quot )
+    [ f parse-until ] with-parser ;
+
+SYMBOL: lexer-factory
+
+[ <lexer> ] lexer-factory set-global
+
+: parse-lines ( lines -- quot )
+    lexer-factory get call (parse-lines) ;
+
+! Parsing word utilities
+: parse-effect ( -- effect )
+    ")" parse-tokens { "--" } split1 dup [
+        <effect>
+    ] [
+        "Stack effect declaration must contain --" throw
+    ] if ;
+
+TUPLE: bad-number ;
+
+: bad-number ( -- * ) \ bad-number construct-boa throw ;
+
+: parse-base ( parsed base -- parsed )
+    scan swap base> [ bad-number ] unless* parsed ;
+
+: parse-literal ( accum end quot -- accum )
+    >r parse-until r> call parsed ; inline
+
+: parse-definition ( -- quot )
+    \ ; parse-until >quotation ;
+
+GENERIC: expected>string ( obj -- str )
+
+M: f expected>string drop "end of input" ;
+M: word expected>string word-name ;
+M: string expected>string ;
+
+M: unexpected error.
+    "Expected " write
+    dup unexpected-want expected>string write
+    " but got " write
+    unexpected-got expected>string print ;
+
+M: bad-number summary
+    drop "Bad number literal" ;
+
+SYMBOL: bootstrap-syntax
+
+: file-vocabs ( -- )
+    "scratchpad" in set
+    { "syntax" "scratchpad" } set-use
+    bootstrap-syntax get [ use get push ] when* ;
+
+: parse-fresh ( lines -- quot )
+    [ file-vocabs parse-lines ] with-scope ;
+
+SYMBOL: parse-hook
+
+: do-parse-hook ( -- ) parse-hook get [ call ] when* ;
+
+: parsing-file ( file -- )
+    "quiet" get [
+        drop
+    ] [
+        "Loading " write <pathname> . flush
+    ] if ;
+
+: no-parse-hook ( quot -- )
+    >r f parse-hook r> with-variable do-parse-hook ; inline
+
+: start-parsing ( stream name -- )
+    H{ } clone new-definitions set
+    dup [
+        source-file
+        dup file set
+        source-file-definitions clone old-definitions set
+    ] [ drop ] if
+    contents \ contents set ;
+
+: smudged-usage-warning ( usages removed -- )
+    parser-notes? [
+        "Warning: the following definitions were removed from sources," print
+        "but are still referenced from other definitions:" print
+        nl
+        dup stack.
+        nl
+        "The following definitions need to be updated:" print
+        nl
+        over stack.
+    ] when 2drop ;
+
+: outside-usages ( seq -- usages )
+    dup [
+        over usage [ pathname? not ] subset seq-diff
+    ] curry { } map>assoc ;
+
+: filter-moved ( assoc -- newassoc )
+    [
+        drop where dup [ first ] when
+        file get source-file-path =
+    ] assoc-subset ;
+
+: smudged-usage ( -- usages referenced removed )
+    new-definitions get old-definitions get diff filter-moved
+    keys [
+        outside-usages
+        [ empty? swap pathname? or not ] assoc-subset
+        dup values concat prune swap keys
+    ] keep ;
+
+: forget-smudged ( -- )
+    smudged-usage [ forget ] each
+    over empty? [ 2dup smudged-usage-warning ] unless 2drop ;
+
+: record-definitions ( file -- )
+    new-definitions get swap set-source-file-definitions ;
+
+: finish-parsing ( quot -- )
+    file get dup [
+        [ record-form ] keep
+        [ record-modified ] keep
+        [ \ contents get record-checksum ] keep
+        record-definitions
+        forget-smudged
+    ] [
+        2drop
+    ] if ;
+
+: undo-parsing ( -- )
+    file get [
+        dup source-file-definitions new-definitions get union
+        swap set-source-file-definitions
+    ] when* ;
+
+: parse-stream ( stream name -- quot )
+    [
+        [
+            start-parsing
+            \ contents get string-lines parse-fresh
+            dup finish-parsing
+        ] [ ] [ undo-parsing ] cleanup
+    ] no-parse-hook ;
+
+: parse-file-restarts ( file -- restarts )
+    "Load " swap " again" 3append t 2array 1array ;
+
+: parse-file ( file -- quot )
+    [
+        [ parsing-file ] keep
+        [ ?resource-path <file-reader> ] keep
+        parse-stream
+    ] [
+        over parse-file-restarts rethrow-restarts
+        drop parse-file
+    ] recover ;
+
+: run-file ( file -- )
+    [ [ parse-file call ] keep ] assert-depth drop ;
+
+: reload ( defspec -- )
+    where first [ run-file ] when* ;
+
+: ?run-file ( path -- )
+    dup ?resource-path exists? [ run-file ] [ drop ] if ;
+
+: bootstrap-file ( path -- )
+    [
+        parse-file [ call ] curry %
+    ] [
+        run-file
+    ] if-bootstrapping ;
+
+: ?bootstrap-file ( path -- )
+    dup ?resource-path exists? [ bootstrap-file ] [ drop ] if ;
+
+: parse ( str -- quot ) string-lines parse-lines ;
+
+: eval ( str -- ) parse call ;
+
+: eval>string ( str -- output )
+    [
+        parser-notes off
+        [ [ eval ] keep ] try drop
+    ] string-out ;
+
+global [
+    {
+        "scratchpad"
+        "arrays"
+        "assocs"
+        "combinators"
+        "compiler"
+        "continuations"
+        "debugger"
+        "definitions"
+        "generic"
+        "inspector"
+        "io"
+        "kernel"
+        "math"
+        "memory"
+        "namespaces"
+        "parser"
+        "prettyprint"
+        "sequences"
+        "slicing"
+        "sorting"
+        "strings"
+        "syntax"
+        "vocabs"
+        "vocabs.loader"
+        "words"
+    } set-use
+    "scratchpad" set-in
+] bind
diff --git a/core/parser/summary.txt b/core/parser/summary.txt
new file mode 100644 (file)
index 0000000..2b519df
--- /dev/null
@@ -0,0 +1 @@
+Factor source code parser
diff --git a/core/parser/tags.txt b/core/parser/tags.txt
new file mode 100644 (file)
index 0000000..abf53a4
--- /dev/null
@@ -0,0 +1 @@
+reflection
diff --git a/core/prettyprint/authors.txt b/core/prettyprint/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/prettyprint/backend.factor b/core/prettyprint/backend.factor
deleted file mode 100644 (file)
index 57e4a37..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: prettyprint-internals
-USING: arrays generic hashtables io kernel math
-namespaces parser sequences strings styles vectors words
-prettyprint ;
-
-GENERIC: pprint* ( obj -- )
-
-! Atoms
-M: byte-array pprint* drop "( byte array )" text ;
-
-: word-style ( word -- style )
-    [
-        dup presented set
-        parsing? [ bold font-style set ] when
-    ] make-hash ;
-
-: pprint-word ( word -- )
-    dup word-name [ "( no name )" ] unless*
-    swap word-style styled-text ;
-
-M: word pprint*
-    dup parsing? [
-        H{ } <flow \ POSTPONE: pprint-word pprint-word block>
-    ] [
-        pprint-word
-    ] if ;
-
-M: real pprint* number>string text ;
-
-M: f pprint* drop \ f pprint-word ;
-
-! Strings
-: ch>ascii-escape ( ch -- str )
-    H{
-        { CHAR: \e "\\e"  }
-        { CHAR: \n "\\n"  }
-        { CHAR: \r "\\r"  }
-        { CHAR: \t "\\t"  }
-        { CHAR: \0 "\\0"  }
-        { CHAR: \\ "\\\\" }
-        { CHAR: \" "\\\"" }
-    } hash ;
-
-: ch>unicode-escape ( ch -- str )
-    >hex 4 CHAR: 0 pad-left "\\u" swap append ;
-
-: unparse-ch ( ch -- )
-    dup quotable? [
-        ,
-    ] [
-        dup ch>ascii-escape [ ] [ ch>unicode-escape ] ?if %
-    ] if ;
-
-: do-string-limit ( str -- trimmed )
-    string-limit get [
-        dup length margin get > [
-            margin get 3 - head "..." append
-        ] when
-    ] when ;
-
-: pprint-string ( str prefix -- )
-    [ % [ unparse-ch ] each CHAR: " , ] "" make
-    do-string-limit text ;
-
-M: string pprint* "\"" pprint-string ;
-
-M: sbuf pprint* "SBUF\" " pprint-string ;
-
-! Sequences
-: nesting-limit? ( -- ? )
-    nesting-limit get dup [ pprinter-stack get length < ] when ;
-
-: truncated-nesting ( obj str -- )
-    swap presented associate styled-text ;
-
-: check-recursion ( obj quot -- )
-    nesting-limit? [
-        drop "#" truncated-nesting
-    ] [
-        over recursion-check get memq? [
-            drop "&" truncated-nesting
-        ] [
-            over recursion-check get push
-            call
-            recursion-check get pop*
-        ] if
-    ] if ; inline
-
-: length-limit? ( seq -- trimmed ? )
-    length-limit get dup
-    [ over length over > [ head t ] [ drop f ] if ]
-    [ drop f ] if ;
-
-: hilite-style ( -- hash )
-    H{
-        { background { 0.9 0.9 0.9 1 } }
-        { highlight t }
-    } ;
-
-: pprint-hilite ( object n -- )
-    hilite-index get = [
-        hilite-style <flow pprint* block>
-    ] [
-        pprint*
-    ] if ;
-
-: pprint-elements ( seq -- )
-    length-limit? >r dup hilite-quotation get eq? [
-        dup length [ pprint-hilite ] 2each
-    ] [
-        [ pprint* ] each
-    ] if r> [ "..." text ] when ;
-
-GENERIC: >pprint-sequence ( obj -- seq start end narrow? )
-
-M: complex >pprint-sequence >rect 2array \ C{ \ } f ;
-
-M: quotation >pprint-sequence \ [ \ ] f ;
-
-M: array >pprint-sequence \ { \ } t ;
-
-M: vector >pprint-sequence \ V{ \ } t ;
-
-M: hashtable >pprint-sequence hash>alist \ H{ \ } t ;
-
-M: tuple >pprint-sequence tuple>array \ T{ \ } t ;
-
-M: wrapper >pprint-sequence wrapped 1array \ W{ \ } f ;
-
-: pprint-object ( obj -- )
-    [
-        >pprint-sequence H{ } <flow
-        rot [ pprint-word ] when*
-        [ H{ } <narrow ] [ H{ } <inset ] if
-        swap pprint-elements
-        block> [ pprint-word ] when* block>
-    ] check-recursion ;
-    
-M: object pprint* pprint-object ;
-
-M: wrapper pprint*
-    dup wrapped word? [
-        \ \ pprint-word wrapped pprint-word
-    ] [
-        pprint-object
-    ] if ;
diff --git a/core/prettyprint/backend.facts b/core/prettyprint/backend.facts
deleted file mode 100644 (file)
index 3689ac9..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-USING: help io kernel prettyprint prettyprint-internals words ;
-
-HELP: pprint*
-{ $values { "obj" "an object" } }
-{ $contract "Adds sections to the current block corresponding to the prettyprinted representation of the object." }
-$prettyprinting-note
-{ $see-also text newline <inset block> } ;
-
-HELP: pprint-word
-{ $values { "word" "a word" } }
-{ $description "Adds a text section for the word. Unlike the " { $link word } " method of " { $link pprint* } ", this does not add a " { $link POSTPONE: POSTPONE: } " prefix to parsing words." }
-$prettyprinting-note ;
-
-HELP: ch>ascii-escape
-{ $values { "ch" "a character" } { "str" "a string" } }
-{ $description "Converts a character to an escape code." } ;
-
-HELP: ch>unicode-escape
-{ $values { "ch" "a character" } { "str" "a string" } }
-{ $description "Converts a character to a Unicode escape code (" { $snippet "\\u1234"} ")." } ;
-
-HELP: unparse-ch
-{ $values { "ch" "a character" } }
-{ $description "Adds the character to the sequence being constructed (see " { $link "namespaces-make" } "). If the character can appear in a string literal, it is added directly, otherwise an escape code is added." } ;
-
-HELP: do-string-limit
-{ $values { "str" "a string" } { "trimmed" "a possibly trimmed string" } }
-{ $description "If " { $link string-limit } " is on, trims the string such that it does not exceed the margin, appending \"...\" if trimming took place." } ;
-
-HELP: pprint-string
-{ $values { "str" "a string" } { "prefix" "a prefix string" } }
-{ $description "Outputs a text section consisting of the prefix, the string, and a final quote (\")." }
-$prettyprinting-note ;
-
-HELP: nesting-limit?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if the " { $link nesting-limit } " has been reached." }
-$prettyprinting-note ;
-
-HELP: check-recursion
-{ $values { "obj" "an object" } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
-{ $description "If the object is already being printed, that is, if the prettyprinter has encountered a cycle in the object graph, or if the maximum nesting depth has been reached, outputs a dummy string. Otherwise applies the quotation to the object." }
-$prettyprinting-note ;
-
-HELP: length-limit?
-{ $values { "seq" "a sequence" } { "trimmed" "a trimmed sequence" } { "?" "a boolean indicating if trimming took place" } }
-{ $description "If the " { $link length-limit } " is set, trims the sequence if necessary, and outputs a boolean indicating if \"...\" should be output." }
-$prettyprinting-note ;
-
-HELP: pprint-elements
-{ $values { "seq" "a sequence" } }
-{ $description "Prettyprints the elements of a sequence, trimming the sequence to " { $link length-limit } " if necessary." }
-$prettyprinting-note ;
diff --git a/core/prettyprint/backend/authors.txt b/core/prettyprint/backend/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/prettyprint/backend/backend-docs.factor b/core/prettyprint/backend/backend-docs.factor
new file mode 100644 (file)
index 0000000..bf1c5c2
--- /dev/null
@@ -0,0 +1,56 @@
+USING: help.markup help.syntax io kernel prettyprint
+prettyprint.config prettyprint.sections words strings ;
+IN: prettyprint.backend
+
+ABOUT: "prettyprint-extension"
+
+HELP: pprint*
+{ $values { "obj" "an object" } }
+{ $contract "Adds sections to the current block corresponding to the prettyprinted representation of the object." }
+$prettyprinting-note ;
+
+HELP: pprint-word
+{ $values { "word" "a word" } }
+{ $description "Adds a text section for the word. Unlike the " { $link word } " method of " { $link pprint* } ", this does not add a " { $link POSTPONE: POSTPONE: } " prefix to parsing words." }
+$prettyprinting-note ;
+
+HELP: ch>ascii-escape
+{ $values { "ch" "a character" } { "str" string } }
+{ $description "Converts a character to an escape code." } ;
+
+HELP: ch>unicode-escape
+{ $values { "ch" "a character" } { "str" string } }
+{ $description "Converts a character to a Unicode escape code (" { $snippet "\\u1234"} ")." } ;
+
+HELP: unparse-ch
+{ $values { "ch" "a character" } }
+{ $description "Adds the character to the sequence being constructed (see " { $link "namespaces-make" } "). If the character can appear in a string literal, it is added directly, otherwise an escape code is added." } ;
+
+HELP: do-string-limit
+{ $values { "str" string } { "trimmed" "a possibly trimmed string" } }
+{ $description "If " { $link string-limit } " is on, trims the string such that it does not exceed the margin, appending \"...\" if trimming took place." } ;
+
+HELP: pprint-string
+{ $values { "obj" object } { "str" string } { "prefix" "a prefix string" } }
+{ $description "Outputs a text section consisting of the prefix, the string, and a final quote (\")." }
+$prettyprinting-note ;
+
+HELP: nesting-limit?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if the " { $link nesting-limit } " has been reached." }
+$prettyprinting-note ;
+
+HELP: check-recursion
+{ $values { "obj" "an object" } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
+{ $description "If the object is already being printed, that is, if the prettyprinter has encountered a cycle in the object graph, or if the maximum nesting depth has been reached, outputs a dummy string. Otherwise applies the quotation to the object." }
+$prettyprinting-note ;
+
+HELP: do-length-limit
+{ $values { "seq" "a sequence" } { "trimmed" "a trimmed sequence" } { "n/f" "an integer or " { $link f } } }
+{ $description "If the " { $link length-limit } " is set and the sequence length exceeds this limit, trims the sequence and outputs a the number of elements which were chopped off the end. Otherwise outputs " { $link f } "." }
+$prettyprinting-note ;
+
+HELP: pprint-elements
+{ $values { "seq" "a sequence" } }
+{ $description "Prettyprints the elements of a sequence, trimming the sequence to " { $link length-limit } " if necessary." }
+$prettyprinting-note ;
diff --git a/core/prettyprint/backend/backend.factor b/core/prettyprint/backend/backend.factor
new file mode 100644 (file)
index 0000000..4965b8d
--- /dev/null
@@ -0,0 +1,193 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays byte-arrays bit-arrays generic hashtables io
+assocs kernel math namespaces sequences strings sbufs io.styles
+vectors words prettyprint.config prettyprint.sections quotations
+io io.files math.parser effects tuples classes float-arrays ;
+IN: prettyprint.backend
+
+GENERIC: pprint* ( obj -- )
+
+: ?effect-height ( word -- n )
+    stack-effect [ effect-height ] [ 0 ] if* ;
+
+: ?start-group ( word -- )
+    ?effect-height 0 > [ start-group ] when ;
+
+: ?end-group ( word -- )
+    ?effect-height 0 < [ end-group ] when ;
+
+\ >r hard "break-before" set-word-prop
+\ r> hard "break-after" set-word-prop
+
+! Atoms
+: word-style ( word -- style )
+    [
+        dup presented set
+        dup parsing? over delimiter? rot t eq? or or
+        [ bold font-style set ] when
+    ] H{ } make-assoc ;
+
+: word-name* ( word -- str )
+    word-name "( no name )" or ;
+
+: pprint-word ( word -- )
+    dup record-vocab
+    dup word-name* swap word-style styled-text ;
+
+: pprint-prefix ( word quot -- )
+    <block swap pprint-word call block> ; inline
+
+M: word pprint*
+    dup parsing? [
+        \ POSTPONE: [ pprint-word ] pprint-prefix
+    ] [
+        dup "break-before" word-prop break
+        dup pprint-word
+        dup ?start-group dup ?end-group
+        "break-after" word-prop break
+    ] if ;
+
+M: real pprint* number>string text ;
+
+M: f pprint* drop \ f pprint-word ;
+
+! Strings
+: ch>ascii-escape ( ch -- str )
+    H{
+        { CHAR: \e "\\e"  }
+        { CHAR: \n "\\n"  }
+        { CHAR: \r "\\r"  }
+        { CHAR: \t "\\t"  }
+        { CHAR: \0 "\\0"  }
+        { CHAR: \\ "\\\\" }
+        { CHAR: \" "\\\"" }
+    } at ;
+
+: ch>unicode-escape ( ch -- str )
+    >hex 4 CHAR: 0 pad-left "\\u" swap append ;
+
+: unparse-ch ( ch -- )
+    dup quotable? [
+        ,
+    ] [
+        dup ch>ascii-escape [ ] [ ch>unicode-escape ] ?if %
+    ] if ;
+
+: do-string-limit ( str -- trimmed )
+    string-limit get [
+        dup length margin get > [
+            margin get 3 - head "..." append
+        ] when
+    ] when ;
+
+: string-style ( obj -- hash )
+    [
+        presented set
+        { 0.3 0.3 0.3 1.0 } foreground set
+    ] H{ } make-assoc ;
+
+: unparse-string ( str prefix -- str )
+    [
+        % do-string-limit [ unparse-ch ] each CHAR: " ,
+    ] "" make ;
+
+: pprint-string ( obj str prefix -- )
+    unparse-string swap string-style styled-text ;
+
+M: string pprint* dup "\"" pprint-string ;
+
+M: sbuf pprint* dup "SBUF\" " pprint-string ;
+
+M: pathname pprint* dup pathname-string "P\" " pprint-string ;
+
+! Sequences
+: nesting-limit? ( -- ? )
+    nesting-limit get dup [ pprinter-stack get length < ] when ;
+
+: present-text ( str obj -- )
+    presented associate styled-text ;
+
+: check-recursion ( obj quot -- )
+    nesting-limit? [
+        drop
+        "~" over class word-name "~" 3append
+        swap present-text
+    ] [
+        over recursion-check get memq? [
+            drop "~circularity~" swap present-text
+        ] [
+            over recursion-check get push
+            call
+            recursion-check get pop*
+        ] if
+    ] if ; inline
+
+: do-length-limit ( seq -- trimmed n/f )
+    length-limit get dup [
+        over length over [-]
+        dup zero? [ 2drop f ] [ >r head r> ] if
+    ] when ;
+
+: pprint-hilite ( n object -- )
+    pprint* hilite-index get = [ hilite ] when ;
+
+: pprint-elements ( seq -- )
+    do-length-limit >r dup hilite-quotation get eq? [
+        [ length ] keep [ pprint-hilite ] 2each
+    ] [
+        [ pprint* ] each
+    ] if
+    r> [ "~" swap number>string " more~" 3append text ] when* ;
+
+GENERIC: pprint-delims ( obj -- start end )
+
+M: complex pprint-delims drop \ C{ \ } ;
+M: quotation pprint-delims drop \ [ \ ] ;
+M: curry pprint-delims drop \ [ \ ] ;
+M: array pprint-delims drop \ { \ } ;
+M: byte-array pprint-delims drop \ B{ \ } ;
+M: bit-array pprint-delims drop \ ?{ \ } ;
+M: float-array pprint-delims drop \ F{ \ } ;
+M: vector pprint-delims drop \ V{ \ } ;
+M: hashtable pprint-delims drop \ H{ \ } ;
+M: tuple pprint-delims drop \ T{ \ } ;
+M: wrapper pprint-delims drop \ W{ \ } ;
+M: callstack pprint-delims drop \ CS{ \ } ;
+
+GENERIC: >pprint-sequence ( obj -- seq )
+
+M: object >pprint-sequence ;
+
+M: complex >pprint-sequence >rect 2array ;
+M: hashtable >pprint-sequence >alist ;
+M: tuple >pprint-sequence tuple>array ;
+M: wrapper >pprint-sequence wrapped 1array ;
+M: callstack >pprint-sequence callstack>array ;
+
+GENERIC: pprint-narrow? ( obj -- ? )
+
+M: object pprint-narrow? drop f ;
+
+M: array pprint-narrow? drop t ;
+M: vector pprint-narrow? drop t ;
+M: hashtable pprint-narrow? drop t ;
+M: tuple pprint-narrow? drop t ;
+
+: pprint-object ( obj -- )
+    [
+        <flow
+        dup pprint-delims >r pprint-word
+        dup pprint-narrow? <inset
+        >pprint-sequence pprint-elements
+        block> r> pprint-word block>
+    ] check-recursion ;
+    
+M: object pprint* pprint-object ;
+
+M: wrapper pprint*
+    dup wrapped word? [
+        <block \ \ pprint-word wrapped pprint-word block>
+    ] [
+        pprint-object
+    ] if ;
diff --git a/core/prettyprint/backend/summary.txt b/core/prettyprint/backend/summary.txt
new file mode 100644 (file)
index 0000000..31ad5b6
--- /dev/null
@@ -0,0 +1 @@
+Prettyprinter methods for built-in types
diff --git a/core/prettyprint/config/authors.txt b/core/prettyprint/config/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/prettyprint/config/config-docs.factor b/core/prettyprint/config/config-docs.factor
new file mode 100644 (file)
index 0000000..e2a94cd
--- /dev/null
@@ -0,0 +1,35 @@
+USING: help.markup help.syntax io kernel prettyprint
+prettyprint.sections words ;
+IN: prettyprint.config
+
+ABOUT: "prettyprint-variables"
+
+HELP: indent
+{ $var-description "The prettyprinter's current indent level." } ;
+
+HELP: pprinter-stack
+{ $var-description "A stack of " { $link block } " objects currently being constructed by the prettyprinter." } ;
+
+HELP: tab-size
+{ $var-description "Prettyprinter tab size. Indent nesting is always a multiple of the tab size." } ;
+
+HELP: margin
+{ $var-description "The maximum line length, in characters. Lines longer than the margin are wrapped." } ;
+
+HELP: nesting-limit
+{ $var-description "The maximum nesting level. Structures that nest further than this will simply print as a pound sign (#). The default is " { $link f } ", denoting unlimited nesting depth." } ;
+
+HELP: length-limit
+{ $var-description "The maximum printed sequence length. Sequences longer than this are truncated, and \"...\" is output in place of remaining elements. The default is " { $link f } ", denoting unlimited sequence length." } ;
+
+HELP: line-limit
+{ $var-description "The maximum number of lines output by the prettyprinter before output is truncated with \"...\". The default is " { $link f } ", denoting unlimited line count." } ;
+
+HELP: string-limit
+{ $var-description "Toggles whether printed strings are truncated to the margin." } ;
+
+HELP: hilite-quotation
+{ $var-description "If set, printing this quotation will highlight the element with index " { $link hilite-index } " in an output stream-specific manner." } ;
+
+HELP: hilite-index
+{ $var-description "If set, printing the quotation stored in " { $link hilite-quotation } " will highlight the element with this index in an output stream-specific manner." } ;
diff --git a/core/prettyprint/config/config.factor b/core/prettyprint/config/config.factor
new file mode 100644 (file)
index 0000000..a4a331e
--- /dev/null
@@ -0,0 +1,24 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: prettyprint.config
+USING: alien arrays generic assocs io kernel math
+namespaces sequences strings io.styles vectors words
+continuations ;
+
+! Configuration
+SYMBOL: tab-size
+SYMBOL: margin
+SYMBOL: nesting-limit
+SYMBOL: length-limit
+SYMBOL: line-limit
+SYMBOL: string-limit
+
+! Special trick to highlight a word in a quotation
+SYMBOL: hilite-quotation
+SYMBOL: hilite-index
+
+global [
+    4 tab-size set
+    64 margin set
+    string-limit off
+] bind
diff --git a/core/prettyprint/config/summary.txt b/core/prettyprint/config/summary.txt
new file mode 100644 (file)
index 0000000..b39b39d
--- /dev/null
@@ -0,0 +1 @@
+Prettyprinter configuration variables
diff --git a/core/prettyprint/core.factor b/core/prettyprint/core.factor
deleted file mode 100644 (file)
index 7a4cdcc..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: prettyprint
-USING: alien arrays generic hashtables io kernel math
-namespaces parser sequences strings styles vectors words ;
-
-! Configuration
-SYMBOL: tab-size
-SYMBOL: margin
-SYMBOL: nesting-limit
-SYMBOL: length-limit
-SYMBOL: line-limit
-SYMBOL: string-limit
-
-! Special trick to highlight a word in a quotation
-SYMBOL: hilite-quotation
-SYMBOL: hilite-index
-SYMBOL: hilite-next?
-
-IN: prettyprint-internals
-
-! State
-SYMBOL: position
-SYMBOL: last-newline
-SYMBOL: recursion-check
-SYMBOL: line-count
-SYMBOL: end-printing
-SYMBOL: indent
-SYMBOL: pprinter-stack
-
-! Utility words
-: line-limit? ( -- ? )
-    line-limit get dup [ line-count get <= ] when ;
-
-: do-indent ( -- ) indent get CHAR: \s <string> write ;
-
-: fresh-line ( n -- )
-    dup last-newline get = [
-        drop
-    ] [
-        last-newline set
-        line-limit? [ "..." write end-printing get continue ] when
-        line-count inc
-        terpri do-indent
-    ] if ;
-
-: text-fits? ( len -- ? )
-    indent get + margin get <= ;
-
-global [
-    4 tab-size set
-    64 margin set
-    0 position set
-    0 indent set
-    0 last-newline set
-    1 line-count set
-    string-limit off
-] bind
diff --git a/core/prettyprint/core.facts b/core/prettyprint/core.facts
deleted file mode 100644 (file)
index 1c053bb..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-USING: help io kernel prettyprint prettyprint-internals words ;
-
-HELP: position
-{ $var-description "The prettyprinter's current character position." } ;
-
-HELP: last-newline
-{ $var-description "The character position of the last newline output by the prettyprinter." } ;
-
-HELP: recursion-check
-{ $var-description "The current nesting of collections being output by the prettyprinter, used to detect circularity and prevent infinite recursion." } ;
-
-HELP: line-count
-{ $var-description "The number of lines output by the prettyprinter so far, used for line limiting (see " { $link line-limit } ")." } ;
-
-HELP: end-printing
-{ $var-description "A continuation captured by " { $link do-pprint } " that breaks out of the printer." } ;
-
-HELP: indent
-{ $var-description "The prettyprinter's current indent level." } ;
-
-HELP: pprinter-stack
-{ $var-description "A stack of " { $link block } " objects currently being constructed by the prettyprinter." } ;
-
-HELP: tab-size
-{ $var-description "Prettyprinter tab size. Indent nesting is always a multiple of the tab size. The default is 4." } ;
-
-HELP: margin
-{ $var-description "The maximum line length, in characters. Lines longer than the margin are wrapped. The default is 64." } ;
-
-HELP: nesting-limit
-{ $var-description "The maximum nesting level. Structures that nest further than this will simply print as a pound sign (#). The default is " { $link f } ", denoting unlimited nesting depth." } ;
-
-HELP: length-limit
-{ $var-description "The maximum printed sequence length. Sequences longer than this are truncated, and \"...\" is output in place of remaining elements. The default is " { $link f } ", denoting unlimited sequence length." } ;
-
-HELP: line-limit
-{ $var-description "The maximum number of lines output by the prettyprinter before output is truncated with \"...\". The default is " { $link f } ", denoting unlimited line count." } ;
-
-HELP: string-limit
-{ $var-description "Toggles whenever printed strings are truncated to the margin." } ;
diff --git a/core/prettyprint/describe.factor b/core/prettyprint/describe.factor
deleted file mode 100644 (file)
index 5bc2968..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: tools
-USING: arrays generic hashtables io kernel kernel-internals
-math namespaces prettyprint sequences strings styles vectors
-words ;
-
-GENERIC: sheet ( object -- sheet )
-
-: slot-sheet ( object -- sheet )
-    dup class "slots" word-prop [
-        dup third -rot first slot 2array
-    ] map-with ;
-
-M: object sheet slot-sheet ;
-
-M: tuple sheet
-    dup slot-sheet swap delegate [ 1 tail ] unless ;
-
-M: sequence summary
-    [ dup length # " element " % class word-name % ] "" make ;
-
-: sequence-sheet [ 1array ] map ;
-
-M: quotation sheet sequence-sheet ;
-M: vector sheet sequence-sheet ;
-M: array sheet sequence-sheet ;
-
-M: hashtable summary
-    "a hashtable storing " swap hash-size number>string
-    " keys" 3append ;
-
-M: hashtable sheet hash>alist ;
-
-: sheet. ( sheet -- )
-    dup empty? [
-        drop
-    ] [
-        dup first length 1 =
-        { 0 0 } { 10 0 } ? table-gap associate
-        [ dup unparse-short swap write-object ]
-        tabular-output
-    ] if ;
-
-: describe ( object -- ) dup summary print sheet sheet. ;
-
-: stack. ( seq -- ) >array sheet sheet. ;
-
-: .s ( -- ) datastack stack. ;
-: .r ( -- ) retainstack stack. ;
-
-: callframe. ( seq pos -- )
-    [
-        hilite-index set dup hilite-quotation set
-        1 nesting-limit set
-        pprint
-        terpri
-    ] with-scope ;
-
-: callstack. ( seq -- )
-    3 group [ first2 1- callframe. ] each ;
-
-: .c ( -- ) callstack callstack. ;
diff --git a/core/prettyprint/describe.facts b/core/prettyprint/describe.facts
deleted file mode 100644 (file)
index 3b5198a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-IN: tools
-USING: help io kernel prettyprint words ;
-
-HELP: sheet
-{ $values { "object" "an object" } { "sheet" "a sequence of sequences" } }
-{ $contract "Outputs a representation of the object for the " { $link describe } " word, which is a table where each row corresponds to an object slot, and consists of a number of columns, presumably including the slot name and value." } ;
-
-HELP: slot-sheet
-{ $values { "object" "an object" } { "sheet" "a sequence of sequences" } }
-{ $description "Outputs a table of object slot names and values. This is used by the default implementation of " { $link sheet } "." } ;
-
-HELP: describe
-{ $values { "object" "an object" } }
-{ $description "Print a tabular overview of the object."
-$terpri
-"For sequences and hashtables, this outputs the entries of the collection. For all other object types, slot names and values are shown." }
-{ $notes "Slot values are converted to strings using " { $link unparse-short } "." }
-{ $examples { $code "global describe" } } ;
-
-HELP: stack.
-{ $values { "seq" "a sequence" } }
-{ $description "Prints an outliner listing elements of a sequence in reverse order. Elements are coverted to strings using " { $link unparse-short } "." }
-{ $notes "This word is used in the implementation of " { $link .s } " and " { $link .r } "." } ;
-
-HELP: callstack.
-{ $values { "seq" "a sequence" } }
-{ $description "Displays a sequence output by " { $link callstack } " in a nice way, by highlighting the current execution point in every call frame." } ;
-
-HELP: .c
-{ $description "Displays the contents of the call stack, with the top of the stack printed first." } ;
-
-HELP: .r
-{ $description "Displays the contents of the retain stack, with the top of the stack printed first." } ;
-
-HELP: .s
-{ $description "Displays the contents of the data stack, with the top of the stack printed first." } ;
diff --git a/core/prettyprint/frontend.factor b/core/prettyprint/frontend.factor
deleted file mode 100644 (file)
index 7030d0f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: prettyprint
-USING: alien arrays generic hashtables io kernel math
-namespaces parser sequences strings styles vectors words
-prettyprint-internals ;
-
-: with-pprint ( quot -- )
-    [
-        V{ } clone recursion-check set
-        H{ } <flow> f ?push pprinter-stack set
-        call end-blocks do-pprint
-    ] with-scope ; inline
-
-: pprint ( obj -- ) [ pprint* ] with-pprint ;
-
-: . ( obj -- )
-    H{
-       { length-limit 1000 }
-       { nesting-limit 10 }
-    } clone [ pprint ] bind terpri ;
-
-: unparse ( obj -- str ) [ pprint ] string-out ;
-
-: pprint-short ( obj -- )
-    H{
-       { line-limit 1 }
-       { length-limit 15 }
-       { nesting-limit 2 }
-       { string-limit t }
-    } clone [ pprint ] bind ;
-
-: short. ( obj -- ) pprint-short terpri ;
-
-: unparse-short ( obj -- str ) [ pprint-short ] string-out ;
-
-: .b ( n -- ) >bin print ;
-: .o ( n -- ) >oct print ;
-: .h ( n -- ) >hex print ;
-
-GENERIC: summary ( object -- string )
-
-M: object summary
-    "an instance of the " swap class word-name " class" 3append ;
-
-M: input summary
-    "Input: " swap input-string dup string?
-    [ "\n" split1 "..." "" ? append ] [ unparse-short ] if
-    append ;
-
-M: vocab-link summary
-    [
-        vocab-link-name dup %
-        " vocabulary (" %
-        words length #
-        " words)" %
-    ] "" make ;
diff --git a/core/prettyprint/frontend.facts b/core/prettyprint/frontend.facts
deleted file mode 100644 (file)
index 8d037dd..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-IN: prettyprint
-USING: help io kernel prettyprint prettyprint-internals words ;
-
-HELP: with-pprint
-{ $values { "quot" "a quotation" } }
-{ $description "Sets up the prettyprinter and calls the quotation in a new scope. The quotation should add sections to the top-level block. When the quotation returns, the top-level block is printed to the default stream." } ;
-
-HELP: pprint
-{ $values { "obj" "an object" } }
-{ $description "Prettyprints an object to the default stream. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ;
-
-HELP: .
-{ $values { "obj" "an object" } }
-{ $description "Prettyprints an object to the default stream with a trailing line break. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ;
-
-HELP: unparse
-{ $values { "obj" "an object" } { "str" "Factor source string" } }
-{ $description "Outputs a prettyprinted string representation of an object. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ;
-
-HELP: pprint-short
-{ $values { "obj" "an object" } }
-{ $description "Prettyprints an object to the default stream. This word rebinds printer control variables to enforce ``shorter'' output. See " { $link "prettyprint-variables" } "." } ;
-
-HELP: short.
-{ $values { "obj" "an object" } }
-{ $description "Prettyprints an object to the default stream with a trailing line break. This word rebinds printer control variables to enforce ``shorter'' output." } ;
-
-HELP: unparse-short
-{ $values { "obj" "an object" } { "str" "Factor source string" } }
-{ $description "Outputs a prettyprinted string representation of an object. This word rebinds printer control variables to enforce ``shorter'' output. See " { $link "prettyprint-variables" } "." } ;
-
-HELP: .b
-{ $values { "n" "an integer" } }
-{ $description "Outputs an integer in binary." } ;
-
-HELP: .o
-{ $values { "n" "an integer" } }
-{ $description "Outputs an integer in octal." } ;
-
-HELP: .h
-{ $values { "n" "an integer" } }
-{ $description "Outputs an integer in hexadecimal." } ;
-
-HELP: summary
-{ $values { "object" "an object" } { "string" "a string" } }
-{ $contract "Outputs a brief description of the object." } ;
diff --git a/core/prettyprint/prettyprint-docs.factor b/core/prettyprint/prettyprint-docs.factor
new file mode 100644 (file)
index 0000000..3241a25
--- /dev/null
@@ -0,0 +1,256 @@
+USING: prettyprint.backend prettyprint.config
+prettyprint.sections help.markup help.syntax io kernel words
+definitions quotations strings ;
+IN: prettyprint
+
+ARTICLE: "prettyprint-numbers" "Prettyprinting numbers"
+"The " { $link . } " word prints numbers in decimal. A set of words in the " { $vocab-link "prettyprint" } " vocabulary is provided to print integers using another base."
+{ $subsection .b }
+{ $subsection .o }
+{ $subsection .h } ;
+
+ARTICLE: "prettyprint-stacks" "Prettyprinting stacks"
+"Prettyprinting the current data, retain, call stacks:"
+{ $subsection .s }
+{ $subsection .r }
+{ $subsection .c }
+"Prettyprinting any stack:"
+{ $subsection stack. }
+"Prettyprinting any call stack:"
+{ $subsection callstack. } ;
+
+ARTICLE: "prettyprint-variables" "Prettyprint control variables"
+"The following variables affect the " { $link . } " and " { $link pprint } " words if set in the current dynamic scope:"
+{ $subsection tab-size }
+{ $subsection margin }
+{ $subsection nesting-limit }
+{ $subsection length-limit }
+{ $subsection line-limit }
+{ $subsection string-limit }
+"Note that the " { $link short. } " and " { $link pprint-short } " variables override some of these variables."
+{
+    $warning "Treat the global variables as essentially being constants. Only ever rebind them in a nested scope."
+    $nl
+    "Some of the globals are safe to change, like the tab size and wrap margin. However setting limits globally could break code which uses the prettyprinter as a serialization mechanism."
+} ;
+
+ARTICLE: "prettyprint-limitations" "Prettyprinter limitations"
+"When using the prettyprinter as a serialization mechanism, keep the following points in mind:"
+{ $list
+    { "When printing words, " { $link POSTPONE: USING: } " declarations are only output if the " { $link pprint-use } " or " { $link unparse-use } "  words are used." }
+    { "Long output will be truncated if certain " { $link "prettyprint-variables" } " are set." }
+    "Shared structure is not reflected in the printed output; if the output is parsed back in, fresh objects are created for all literal denotations."
+    { "Circular structure is not printed in a readable way. For example, try this:"
+        { $code "{ f } dup dup set-first ." }
+    }
+    "Floating point numbers might not equal themselves after being printed and read, since a decimal representation of a float is inexact."
+}
+"On a final note, the " { $link short. } " and " { $link pprint-short } " words restrict the length and nesting of printed sequences, their output will very likely not be valid syntax. They are only intended for interactive use." ;
+
+ARTICLE: "prettyprint-section-protocol" "Prettyprinter section protocol"
+"Prettyprinter sections must delegate to an instance of " { $link section } ", and they must also obey a protocol."
+$nl
+"Layout queries:"
+{ $subsection section-fits? }
+{ $subsection indent-section? }
+{ $subsection unindent-first-line? }
+{ $subsection newline-after? }
+{ $subsection short-section? }
+"Printing sections:"
+{ $subsection short-section }
+{ $subsection long-section }
+"Utilities to use when implementing sections:"
+{ $subsection <section> }
+{ $subsection delegate>block }
+{ $subsection add-section } ;
+
+ARTICLE: "prettyprint-sections" "Prettyprinter sections"
+"The prettyprinter's formatting engine can be used directly:"
+{ $subsection with-pprint }
+"Code in a " { $link with-pprint } " block or a method on " { $link pprint* } " can build up a tree of " { $emphasis "sections" } ". A section is either a text node or a " { $emphasis "block" } " which itself consists of sections."
+$nl
+"Once the output sections have been generated, the tree of sections is traversed and intelligent decisions are made about indentation and line breaks. Finally, text is output."
+{ $subsection section }
+"Adding leaf sections:"
+{ $subsection break }
+{ $subsection text }
+{ $subsection styled-text }
+"Nesting and denesting sections:"
+{ $subsection <object }
+{ $subsection <block }
+{ $subsection <inset }
+{ $subsection <flow }
+{ $subsection <colon }
+{ $subsection block> }
+"New types of sections can be defined."
+{ $subsection "prettyprint-section-protocol" } ;
+
+ARTICLE: "prettyprint-literal" "Literal prettyprinting protocol"
+"Unless a more specialized method exists for the input class, the " { $link pprint* } " word outputs an object in a standard format, ultimately calling two generic words:"
+{ $subsection pprint-delims }
+{ $subsection >pprint-sequence }
+"For example, consider the following data type, together with a parsing word for creating literals:"
+{ $code
+    "TUPLE: rect w h ;"
+    ""
+    ": RECT["
+    "    scan-word"
+    "    scan-word \\ * assert="
+    "    scan-word"
+    "    scan-word \\ ] assert="
+    "    <rect> parsed ; parsing"
+}
+"An example literal might be:"
+{ $code "RECT[ 100 * 200 ]" }
+"Without further effort, the literal does not print in the same way:"
+{ $unchecked-example "RECT[ 100 * 200 ] ." "T{ rect f 100 200 }" }
+"However, we can define two methods easily enough:"
+{ $code
+    "M: rect pprint-delims drop \\ RECT[ \\ ] ;"
+    "M: rect >pprint-sequence dup rect-w \\ * rot rect-h 3array ;"
+}
+"Now, it will be printed in a custom way:"
+{ $unchecked-example "RECT[ 100 * 200 ] ." "RECT[ 100 * 200 ]" } ;
+
+ARTICLE: "prettyprint-literal-more" "Prettyprinting more complex literals"
+"If the " { $link "prettyprint-literal" } " is insufficient, a method can be defined to control prettyprinting directly:"
+{ $subsection pprint* }
+"Some utilities which can be called from methods on " { $link pprint* } ":"
+{ $subsection pprint-object }
+{ $subsection pprint-word }
+{ $subsection pprint-elements }
+{ $subsection pprint-string }
+{ $subsection pprint-prefix }
+"Custom methods defined on " { $link pprint* } " do not perform I/O directly, instead they call prettyprinter words to construct " { $emphasis "sections" } " of output. See " { $link "prettyprint-sections" } "." ;
+
+ARTICLE: "prettyprint-extension" "Extending the prettyprinter"
+"One can define literal syntax for a new class using the " { $link "parser" } " together with corresponding prettyprinting methods which print instances of the class using this syntax."
+{ $subsection "prettyprint-literal" }
+{ $subsection "prettyprint-literal-more" }
+"The prettyprinter actually exposes a general source code output engine and is not limited to printing object structure."
+{ $subsection "prettyprint-sections" } ;
+
+ARTICLE: "prettyprint" "The prettyprinter"
+"One of Factor's key features is the ability to print almost any object as a valid source literal expression. This greatly aids debugging and provides the building blocks for light-weight object serialization facilities."
+$nl
+"Prettyprinter words are found in the " { $vocab-link "prettyprint" } " vocabulary."
+$nl
+"The key words to print an object to the " { $link stdio } " stream; the first two emit a trailing newline, the second two do not:"
+{ $subsection . }
+{ $subsection short. }
+{ $subsection pprint }
+{ $subsection pprint-short }
+{ $subsection pprint-use }
+"The string representation of an object can be requested:"
+{ $subsection unparse }
+{ $subsection unparse-use }
+"Utility for tabular output:"
+{ $subsection pprint-cell }
+"Printing a definition (see " { $link "definitions" } "):"
+{ $subsection see }
+"More prettyprinter usage:"
+{ $subsection "prettyprint-numbers" }
+{ $subsection "prettyprint-stacks" }
+"Prettyprinter customization:"
+{ $subsection "prettyprint-variables" }
+{ $subsection "prettyprint-extension" }
+{ $subsection "prettyprint-limitations" }
+{ $see-also "number-strings" } ;
+
+ABOUT: "prettyprint"
+
+HELP: with-pprint
+{ $values { "obj" object } { "quot" quotation } }
+{ $description "Sets up the prettyprinter and calls the quotation in a new scope. The quotation should add sections to the top-level block. When the quotation returns, the top-level block is printed to the " { $link stdio } " stream." } ;
+
+HELP: pprint
+{ $values { "obj" object } }
+{ $description "Prettyprints an object to the " { $link stdio } " stream. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ;
+
+{ pprint pprint* with-pprint } related-words
+
+HELP: .
+{ $values { "obj" object } }
+{ $description "Prettyprints an object to the " { $link stdio } " stream with a trailing line break. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ;
+
+HELP: unparse
+{ $values { "obj" object } { "str" "Factor source string" } }
+{ $description "Outputs a prettyprinted string representation of an object. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." } ;
+
+HELP: pprint-short
+{ $values { "obj" object } }
+{ $description "Prettyprints an object to the " { $link stdio } " stream. This word rebinds printer control variables to enforce ``shorter'' output. See " { $link "prettyprint-variables" } "." } ;
+
+HELP: short.
+{ $values { "obj" object } }
+{ $description "Prettyprints an object to the " { $link stdio } " stream with a trailing line break. This word rebinds printer control variables to enforce ``shorter'' output." } ;
+
+HELP: .b
+{ $values { "n" "an integer" } }
+{ $description "Outputs an integer in binary." } ;
+
+HELP: .o
+{ $values { "n" "an integer" } }
+{ $description "Outputs an integer in octal." } ;
+
+HELP: .h
+{ $values { "n" "an integer" } }
+{ $description "Outputs an integer in hexadecimal." } ;
+
+HELP: stack.
+{ $values { "seq" "a sequence" } }
+{ $description "Prints a the elements of the sequence, one per line." }
+{ $notes "This word is used in the implementation of " { $link .s } " and " { $link .r } "." } ;
+
+HELP: callstack.
+{ $values { "callstack" callstack } }
+{ $description "Displays a sequence output by " { $link callstack } " in a nice way, by highlighting the current execution point in every call frame." } ;
+
+HELP: .c
+{ $description "Displays the contents of the call stack, with the top of the stack printed first." } ;
+
+HELP: .r
+{ $description "Displays the contents of the retain stack, with the top of the stack printed first." } ;
+
+HELP: .s
+{ $description "Displays the contents of the data stack, with the top of the stack printed first." } ;
+
+HELP: in.
+{ $values { "vocab" "a vocabulary specifier" } }
+{ $description "Prettyprints a " { $snippet "IN:" } " declaration." }
+$prettyprinting-note ;
+
+HELP: synopsis
+{ $values { "defspec" "a definition specifier" } { "str" string } }
+{ $contract "Prettyprints the prologue of a definition." } ;
+
+HELP: synopsis*
+{ $values { "defspec" "a definition specifier" } }
+{ $contract "Adds sections to the current block corresponding to a the prologue of a definition, in source code-like form." }
+{ $notes "This word should only be called from inside the " { $link with-pprint } " combinator. Client code should call " { $link synopsis } " instead." } ;
+
+HELP: comment.
+{ $values { "string" "a string" } }
+{ $description "Prettyprints some text with the comment style." }
+$prettyprinting-note ;
+
+HELP: see
+{ $values { "defspec" "a definition specifier" } }
+{ $contract "Prettyprints a definition." } ;
+
+HELP: definer
+{ $values { "defspec" "a definition specifier" } { "start" word } { "end" "a word or " { $link f } } }
+{ $contract "Outputs the parsing words which delimit the definition." }
+{ $examples
+    { $example ": foo ; \\ foo definer . ." ";\nPOSTPONE: :" }
+    { $example "SYMBOL: foo \\ foo definer . ." "f\nPOSTPONE: SYMBOL:" }
+}
+{ $notes "This word is used in the implementation of " { $link see } "." } ;
+
+HELP: definition
+{ $values { "defspec" "a definition specifier" } { "seq" "a sequence" } }
+{ $contract "Outputs the body of a definition." }
+{ $examples
+    { $example "USE: math" "\\ sq definition ." "[ dup * ]" }
+}
+{ $notes "This word is used in the implementation of " { $link see } "." } ;
diff --git a/core/prettyprint/prettyprint-tests.factor b/core/prettyprint/prettyprint-tests.factor
new file mode 100644 (file)
index 0000000..a38f68f
--- /dev/null
@@ -0,0 +1,285 @@
+USING: arrays definitions io.streams.string io.streams.duplex
+kernel math namespaces parser prettyprint prettyprint.config
+prettyprint.sections sequences tools.test vectors words
+effects splitting generic.standard ;
+IN: temporary
+
+[ "4" ] [ 4 unparse ] unit-test
+[ "1.0" ] [ 1.0 unparse ] unit-test
+[ "C{ 1/2 2/3 }" ] [ C{ 1/2 2/3 } unparse ] unit-test
+[ "1267650600228229401496703205376" ] [ 1 100 shift unparse ] unit-test
+
+[ "+" ] [ \ + unparse ] unit-test
+
+[ "\\ +" ] [ [ \ + ] first unparse ] unit-test
+
+[ "{ }" ] [ { } unparse ] unit-test
+
+[ "{ 1 2 3 }" ] [ { 1 2 3 } unparse ] unit-test
+
+[ "\"hello\\\\backslash\"" ]
+[ "hello\\backslash" unparse ]
+unit-test
+
+[ "\"\\u1234\"" ]
+[ "\u1234" unparse ]
+unit-test
+
+[ "\"\\e\"" ]
+[ "\e" unparse ]
+unit-test
+
+[ "f" ] [ f unparse ] unit-test
+[ "t" ] [ t unparse ] unit-test
+
+[ "SBUF\" hello world\"" ] [ SBUF" hello world" unparse ] unit-test
+
+
+[ "( a b -- c d )" ] [
+    { "a" "b" } { "c" "d" } <effect> effect>string
+] unit-test
+
+[ "( -- c d )" ] [
+    { } { "c" "d" } <effect> effect>string
+] unit-test
+
+[ "( a b -- )" ] [
+    { "a" "b" } { } <effect> effect>string
+] unit-test
+
+[ "( -- )" ] [
+    { } { } <effect> effect>string
+] unit-test
+
+[ "W{ \\ + }" ] [ [ W{ \ + } ] first unparse ] unit-test
+
+[ "[ 1 2 =>dup<= ]" ]
+[
+    [ 1 2 dup ] dup hilite-quotation set 2 hilite-index set
+    [ pprint ] string-out
+] unit-test
+
+[ t ] [
+    "[ >r \"alloc\" add 0 0 r> ]" dup parse first unparse =
+] unit-test
+
+[ ] [ \ fixnum see ] unit-test
+
+[ ] [ \ integer see ] unit-test
+
+[ ] [ \ general-t see ] unit-test
+
+[ ] [ \ compound see ] unit-test
+
+[ ] [ \ duplex-stream see ] unit-test
+
+[ "[ \\ + ]" ] [ [ \ + ] unparse ] unit-test
+[ "[ \\ [ ]" ] [ [ \ [ ] unparse ] unit-test
+    
+[ t ] [
+    100 \ dup <array> [ pprint-short ] string-out
+    "{" head?
+] unit-test
+
+: foo ( a -- b ) dup * ; inline
+
+[ "USING: kernel math ;\nIN: temporary\n: foo ( a -- b ) dup * ; inline\n" ]
+[ [ \ foo see ] string-out ] unit-test
+
+: bar ( x -- y ) 2 + ;
+
+[ "USING: math ;\nIN: temporary\n: bar ( x -- y ) 2 + ;\n" ]
+[ [ \ bar see ] string-out ] unit-test
+
+: blah 
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop
+    drop ;
+
+[ "drop ;" ] [
+    \ blah f "inferred-effect" set-word-prop
+    [ \ blah see ] string-out "\n" ?tail drop 6 tail*
+] unit-test
+
+: check-see ( expect name -- )
+    [
+        use [ clone ] change
+
+        [
+             parse-lines drop
+             [
+                 "USE: temporary \\ " swap " see" 3append eval
+             ] string-out "\n" split 1 head*
+        ] keep =
+    ] with-scope ;
+
+: method-test
+    {
+        "IN: temporary"
+        "GENERIC: method-layout"
+        ""
+        "USING: math temporary ;"
+        "M: complex method-layout"
+        "    \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\""
+        "    ;"
+        ""
+        "USING: math temporary ;"
+        "M: fixnum method-layout ;"
+        ""
+        "USING: math temporary ;"
+        "M: integer method-layout ;"
+        ""
+        "USING: kernel temporary ;"
+        "M: object method-layout ;"
+    } ;
+
+[ t ] [
+    "method-layout" method-test check-see
+] unit-test
+
+: retain-stack-test
+    {
+        "USING: io kernel sequences words ;"
+        "IN: temporary"
+        ": retain-stack-layout"
+        "    dup stream-readln stream-readln"
+        "    >r [ define-compound ] map r>"
+        "    define-compound ;"
+    } ;
+
+[ t ] [
+    "retain-stack-layout" retain-stack-test check-see
+] unit-test
+
+: soft-break-test
+    {
+        "USING: kernel math sequences strings ;"
+        "IN: temporary"
+        ": soft-break-layout"
+        "    over string? ["
+        "        over hashcode over hashcode number="
+        "        [ sequence= ] [ 2drop f ] if"
+        "    ] [ 2drop f ] if ;"
+    } ;
+
+[ t ] [
+    "soft-break-layout" soft-break-test check-see
+] unit-test
+
+: another-retain-layout-test
+    {
+        "USING: kernel sequences ;"
+        "IN: temporary"
+        ": another-retain-layout ( seq1 seq2 quot -- newseq )"
+        "    -rot 2dup dupd min-length [ each drop roll ] map"
+        "    >r 3drop r> ; inline"
+    } ;
+
+[ t ] [
+    "another-retain-layout" another-retain-layout-test check-see
+] unit-test
+
+: another-soft-break-test
+    {
+        "USING: namespaces parser sequences ;"
+        "IN: temporary"
+        ": another-soft-break-layout ( node -- quot )"
+        "    parse-error-file"
+        "    [ <reversed> \"hello world foo\" add ] [ ] make ;"
+    } ;
+
+[ t ] [
+    "another-soft-break-layout" another-soft-break-test
+    check-see
+] unit-test
+
+: string-layout
+    {
+        "USING: io kernel parser ;"
+        "IN: temporary"
+        ": string-layout-test"
+        "    \"Expected \" write dup unexpected-want expected>string write"
+        "    \" but got \" write unexpected-got expected>string print ;"
+    } ;
+
+
+[ t ] [
+    "string-layout-test" string-layout check-see
+] unit-test
+
+! Define dummy words for the below...
+: <NSRect> ( a b c d -- e ) ;
+: <PixelFormat> ( -- fmt ) ;
+: send ( obj -- ) ;
+
+\ send soft "break-after" set-word-prop
+
+: final-soft-break-test
+    {
+        "USING: kernel sequences ;"
+        "IN: temporary"
+        ": final-soft-break-layout ( class dim -- view )"
+        "    >r \"alloc\" send 0 0 r>"
+        "    first2 <NSRect>"
+        "    <PixelFormat> \"initWithFrame:pixelFormat:\" send"
+        "    dup 1 \"setPostsBoundsChangedNotifications:\" send"
+        "    dup 1 \"setPostsFrameChangedNotifications:\" send ;"
+    } ;
+
+[ t ] [
+    "final-soft-break-layout" final-soft-break-test check-see
+] unit-test
+
+: narrow-test
+    {
+        "USING: arrays combinators continuations kernel sequences ;"
+        "IN: temporary"
+        ": narrow-layout ( obj -- )"
+        "    {"
+        "        { [ dup continuation? ] [ append ] }"
+        "        { [ dup not ] [ drop reverse ] }"
+        "        { [ dup pair? ] [ delete ] }"
+        "    } cond ;"
+    } ;
+
+[ t ] [
+    "narrow-layout" narrow-test check-see
+] unit-test
+
+: another-narrow-test
+    {
+        "IN: temporary"
+        ": another-narrow-layout"
+        "    H{"
+        "        { 1 2 }"
+        "        { 3 4 }"
+        "        { 5 6 }"
+        "        { 7 8 }"
+        "        { 9 10 }"
+        "        { 11 12 }"
+        "        { 13 14 }"
+        "    } ;"
+    } ;
+
+[ t ] [
+    "another-narrow-layout" another-narrow-test check-see
+] unit-test
+
+[ ] [ \ effect-in synopsis drop ] unit-test
diff --git a/core/prettyprint/prettyprint.factor b/core/prettyprint/prettyprint.factor
new file mode 100644 (file)
index 0000000..39c0951
--- /dev/null
@@ -0,0 +1,240 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: prettyprint
+USING: alien arrays generic generic.standard assocs io kernel
+math namespaces sequences strings io.styles io.streams.string
+vectors words prettyprint.backend prettyprint.sections
+prettyprint.config sorting splitting math.parser vocabs
+definitions effects tuples io.files classes continuations
+hashtables classes.mixin classes.union classes.predicate ;
+
+: make-pprint ( obj quot -- block in use )
+    [
+        0 position set
+        H{ } clone pprinter-use set
+        V{ } clone recursion-check set
+        V{ } clone pprinter-stack set
+        over <object
+        call
+        pprinter-block
+        pprinter-in get
+        pprinter-use get keys
+    ] with-scope ; inline
+
+: with-pprint ( obj quot -- )
+    make-pprint 2drop do-pprint ; inline
+
+: pprint-vocab ( vocab -- )
+    dup vocab present-text ;
+
+: write-in ( vocab -- )
+    [ \ IN: pprint-word pprint-vocab ] with-pprint ;
+
+: in. ( vocab -- )
+    [ write-in nl ] when* ;
+
+: use. ( seq -- )
+    dup empty? [ drop ] [
+        natural-sort [
+            \ USING: pprint-word
+            [ pprint-vocab ] each
+            \ ; pprint-word
+        ] with-pprint nl
+    ] if ;
+
+: vocabs. ( in use -- )
+    dupd remove [ { "syntax" "scratchpad" } member? not ] subset
+    use. in. ;
+
+: with-use ( obj quot -- )
+    make-pprint vocabs. do-pprint ; inline
+
+: with-in ( obj quot -- )
+    make-pprint drop [ write-in bl ] when* do-pprint ; inline
+
+: pprint ( obj -- ) [ pprint* ] with-pprint ;
+
+: . ( obj -- )
+    H{
+       { length-limit 1000 }
+       { nesting-limit 10 }
+    } clone [ pprint ] bind nl ;
+
+: pprint-use ( obj -- ) [ pprint* ] with-use ;
+
+: unparse ( obj -- str ) [ pprint ] string-out ;
+
+: unparse-use ( obj -- str ) [ pprint-use ] string-out ;
+
+: pprint-short ( obj -- )
+    H{
+       { line-limit 1 }
+       { length-limit 15 }
+       { nesting-limit 2 }
+       { string-limit t }
+    } clone [ pprint ] bind ;
+
+: short. ( obj -- ) pprint-short nl ;
+
+: .b ( n -- ) >bin print ;
+: .o ( n -- ) >oct print ;
+: .h ( n -- ) >hex print ;
+
+: stack. ( seq -- ) [ short. ] each ;
+
+: .s ( -- ) datastack stack. ;
+: .r ( -- ) retainstack stack. ;
+
+: callframe. ( seq pos -- )
+    [
+        [
+            hilite-index set
+            dup hilite-quotation set
+            2 nesting-limit set
+            .
+        ] with-scope
+    ] [
+        .
+    ] if* ;
+
+: callstack. ( callstack -- )
+    callstack>array 2 <groups> [ callframe. ] assoc-each ;
+
+: .c ( -- ) callstack callstack. ;
+
+: pprint-cell ( obj -- ) [ pprint ] with-cell ;
+
+GENERIC: see ( defspec -- )
+
+: comment. ( string -- )
+    [ H{ { font-style italic } } styled-text ] when* ;
+
+: seeing-word ( word -- )
+    word-vocabulary pprinter-in set ;
+
+: stack-effect. ( word -- )
+    dup parsing? over symbol? or not swap stack-effect and
+    [ effect>string comment. ] when* ;
+
+: word-synopsis ( word name -- )
+    dup seeing-word
+    over definer drop pprint-word
+    pprint-word
+    stack-effect. ;
+
+M: word synopsis*
+    dup word-synopsis ;
+
+M: simple-generic synopsis*
+    dup word-synopsis ;
+
+M: standard-generic synopsis*
+    dup seeing-word
+    \ GENERIC# pprint-word
+    dup pprint-word
+    dup dispatch# pprint*
+    stack-effect. ;
+
+M: hook-generic synopsis*
+    dup seeing-word
+    \ HOOK: pprint-word
+    dup pprint-word
+    dup "combination" word-prop hook-combination-var pprint-word
+    stack-effect. ;
+
+M: method-spec synopsis*
+    dup definer drop pprint-word
+    [ pprint-word ] each ;
+
+M: pathname synopsis* pprint* ;
+
+: synopsis ( defspec -- str )
+    [
+        0 margin set
+        1 line-limit set
+        [ synopsis* ] with-in
+    ] string-out ;
+
+GENERIC: declarations. ( obj -- )
+
+M: object declarations. drop ;
+
+: declaration. ( word prop -- )
+    tuck word-name word-prop [ pprint-word ] [ drop ] if ;
+
+M: word declarations.
+    {
+        POSTPONE: parsing
+        POSTPONE: delimiter
+        POSTPONE: inline
+        POSTPONE: foldable
+    } [ declaration. ] curry* each ;
+
+: pprint-; \ ; pprint-word ;
+
+: (see) ( spec -- )
+    [
+        <colon dup synopsis*
+        <block dup definition pprint-elements block>
+        dup definer nip [ pprint-word ] when* declarations.
+        block>
+    ] with-use nl ;
+
+M: object see (see) ;
+
+GENERIC: see-class* ( word -- )
+
+M: union-class see-class*
+    \ UNION: pprint-word
+    dup pprint-word
+    members pprint-elements pprint-; ;
+
+M: mixin-class see-class*
+    \ MIXIN: pprint-word
+    dup pprint-word <block
+    dup members [
+        hard break
+        \ INSTANCE: pprint-word pprint-word pprint-word
+    ] curry* each block> ;
+
+M: predicate-class see-class*
+    <colon \ PREDICATE: pprint-word
+    dup superclass pprint-word
+    dup pprint-word
+    <block
+    "predicate-definition" word-prop pprint-elements
+    pprint-; block> block> ;
+
+M: tuple-class see-class*
+    \ TUPLE: pprint-word
+    dup pprint-word
+    "slot-names" word-prop [ text ] each
+    pprint-; ;
+
+M: word see-class* drop ;
+
+M: builtin-class see-class*
+    drop "! Built-in class" comment. ;
+
+: see-all ( seq -- ) natural-sort [ nl see ] each ;
+
+: see-implementors ( class -- seq )
+    dup implementors [ 2array ] curry* map ;
+
+: see-class ( class -- )
+    dup class? [
+        nl [ dup see-class* ] with-pprint nl
+    ] when drop ;
+
+: see-methods ( generic -- seq )
+    [ "methods" word-prop keys natural-sort ] keep
+    [ 2array ] curry map ;
+
+M: word see
+    dup (see)
+    dup see-class
+    [
+        dup class? [ dup see-implementors % ] when
+        dup generic? [ dup see-methods % ] when
+        drop
+    ] { } make prune see-all ;
diff --git a/core/prettyprint/sections.factor b/core/prettyprint/sections.factor
deleted file mode 100644 (file)
index 2312a26..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: prettyprint-internals
-USING: alien arrays generic hashtables io kernel math
-namespaces parser sequences strings styles vectors words
-prettyprint ;
-
-! Sections
-TUPLE: section start end style ;
-
-C: section ( style length -- section )
-    >r position [ dup rot + dup ] change r>
-    [ set-section-end ] keep
-    [ set-section-start ] keep
-    [ set-section-style ] keep ;
-
-GENERIC: section-fits? ( section -- ? )
-
-M: section section-fits? ( section -- ? )
-    section-end last-newline get - text-fits? ;
-
-GENERIC: short-section ( section -- )
-
-GENERIC: long-section ( section -- )
-
-GENERIC: block-empty? ( section -- ? )
-
-: pprint-section ( section -- )
-    {
-        { [ margin get zero? ] [ short-section ] }
-        { [ dup section-fits? ] [ short-section ] }
-        { [ t ] [ long-section ] }
-    } cond ;
-
-! Block sections
-TUPLE: block sections ;
-
-C: block ( style -- block )
-    swap 0 <section> over set-delegate
-    V{ } clone over set-block-sections ;
-
-: pprinter-block ( -- block ) pprinter-stack get peek ;
-
-: add-section ( section -- )
-    dup block-empty?
-    [ drop ] [ pprinter-block block-sections push ] if ;
-
-M: block block-empty? block-sections empty? ;
-
-M: block section-fits? ( section -- ? )
-    line-limit? [
-        drop t
-    ] [
-        delegate section-fits?
-    ] if ;
-
-: (<block) pprinter-stack get push ;
-
-: <style section-style stdio [ <nested-style-stream> ] change ;
-
-: style> stdio [ delegate ] change ;
-
-: change-indent ( n -- )
-    tab-size get * indent [ + ] change ;
-
-: <indent ( -- ) 1 change-indent ;
-
-: indent> ( -- ) -1 change-indent ;
-
-! Text section
-TUPLE: text string ;
-
-C: text ( string style -- text )
-    [ >r over length 1+ <section> r> set-delegate ] keep
-    [ set-text-string ] keep ;
-
-M: text block-empty? drop f ;
-
-M: text short-section
-    dup text-string swap section-style format ;
-
-M: text long-section
-    dup section-start fresh-line short-section ;
-
-: styled-text ( string style -- ) <text> add-section ;
-
-: text ( string -- ) H{ } styled-text ;
-
-! Newline section
-TUPLE: newline ;
-
-C: newline ( -- section )
-    H{ } 0 <section> over set-delegate ;
-
-M: newline block-empty? drop f ;
-
-M: newline section-fits? drop t ;
-
-M: newline short-section section-start fresh-line ;
-
-: newline ( -- ) <newline> add-section ;
-
-! Inset section
-TUPLE: inset ;
-
-C: inset ( style -- block )
-    swap <block> over set-delegate ;
-
-M: inset section-fits? ( section -- ? )
-    line-limit? [
-        drop t
-    ] [
-        section-end last-newline get - 2 + text-fits?
-    ] if ;
-
-: advance ( section -- )
-    dup newline? [
-        drop
-    ] [
-        section-start last-newline get = [ bl ] unless
-    ] if ;
-
-M: block short-section ( block -- )
-    dup <style
-    block-sections unclip pprint-section
-    [ dup advance pprint-section ] each
-    style> ;
-
-M: inset long-section
-    <indent
-    dup section-start fresh-line dup short-section
-    indent>
-    section-end fresh-line ;
-
-: <inset ( style -- ) <inset> (<block) ;
-
-! Flow section
-TUPLE: flow ;
-
-C: flow ( style -- block )
-    swap <block> over set-delegate ;
-
-M: flow section-fits? ( section -- ? )
-    dup delegate section-fits? [
-        drop t
-    ] [
-        dup section-end swap section-start - text-fits? not
-    ] if ;
-
-M: flow long-section
-    dup section-start fresh-line short-section ;
-
-: <flow ( style -- ) <flow> (<block) ;
-
-! Narrow section
-TUPLE: narrow ;
-
-C: narrow ( style -- block )
-    swap <block> over set-delegate ;
-
-M: narrow section-fits? ( section -- ? )
-    line-limit? [
-        drop t
-    ] [
-        section-end last-newline get - 2 + text-fits?
-    ] if ;
-
-: narrow-block ( block -- )
-    dup <style
-    block-sections unclip pprint-section
-    [ dup section-start fresh-line pprint-section ] each
-    style> ;
-
-M: narrow long-section 
-    <indent
-    dup section-start fresh-line dup narrow-block
-    indent>
-    section-end fresh-line ;
-
-: <narrow ( style -- ) <narrow> (<block) ;
-
-! Defblock section
-TUPLE: defblock ;
-
-C: defblock ( style -- block )
-    swap <block> over set-delegate ;
-
-M: defblock long-section
-    <indent
-    dup section-start fresh-line short-section
-    indent> ;
-
-: <defblock ( style -- ) <defblock> (<block) ;
-
-: end-block ( block -- ) position get swap set-section-end ;
-
-: (block>) ( -- )
-    pprinter-stack get pop dup end-block add-section ;
-
-: last-block? ( -- ? ) pprinter-stack get length 1 = ;
-
-: block> ( -- ) last-block? [ (block>) ] unless ;
-
-: end-blocks ( -- ) last-block? [ (block>) end-blocks ] unless ;
-
-: do-pprint ( -- )
-    [
-        end-printing set pprinter-block
-        dup block-empty? [ drop ] [ pprint-section ] if
-    ] callcc0 ;
diff --git a/core/prettyprint/sections.facts b/core/prettyprint/sections.facts
deleted file mode 100644 (file)
index cc3f4e5..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-IN: help
-USING: io kernel prettyprint prettyprint-internals words ;
-
-HELP: pprint-section
-{ $values { "section" "a section" } }
-{ $contract "Prettyprints an object delegating to an instance of " { $link section } ", performing wrapping and indentation using the formatting information in the section." } ;
-
-HELP: section
-{ $class-description "A section represents a run of text with a known length and indentation level." } ;
-
-HELP: line-limit?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if the line number limit has been reached, and thus if prettyprinting should stop." } ;
-
-HELP: do-indent
-{ $description "Outputs the current indent nesting to the default stream." } ;
-
-HELP: fresh-line
-{ $values { "n" "the current column position" } }
-{ $description "Advances the prettyprinter by one line unless the current line is empty. If the line limit is exceeded, escapes the prettyprinter by restoring a continuation captured in " { $link do-pprint } "." } ;
-
-HELP: <text>
-{ $values { "string" "a string" } { "style" "a hashtable" } { "text" "a new text section" } }
-{ $description "Creates a text section." } ;
-
-HELP: block
-{ $class-description "A block is a section consisting of whitespace-separated child sections." } ;
-
-HELP: pprinter-block
-{ $values { "block" "a block section" } }
-{ $description "Outputs the block currently being constructed." }
-$prettyprinting-note ;
-
-HELP: block-empty?
-{ $values { "section" "a section" } { "?" "a boolean" } }
-{ $description "Tests if a section is empty. A section is empty if it is a block with no children." } ;
-
-HELP: add-section
-{ $values { "section" "a section" } }
-{ $description "Adds a section to the current block." }
-$prettyprinting-note ;
-
-HELP: text
-{ $values { "string" "a string" } }
-{ $description "Adds a section consisting of a single string to the current block. The current style on the style stack is used; see " { $link with-style } "." }
-$prettyprinting-note ;
-
-HELP: <indent
-{ $values { "section" "a section" } }
-{ $description "Increases indent level by the indent level of the section." }
-$prettyprinting-note ;
-
-HELP: indent>
-{ $values { "section" "a section" } }
-{ $description "Decreases indent level by the indent level of the section." }
-$prettyprinting-note ;
-
-HELP: section-fits?
-{ $values { "section" "a section" } { "?" "a boolean" } }
-{ $description "Tests if a section should be printed on the current line." } ;
-
-HELP: newline
-{ $description "Adds a section introducing an unconditional line break to the current block." }
-$prettyprinting-note ;
-
-HELP: advance
-{ $values { "section" "a section" } }
-{ $description "Emits a space unless the section is the first section on the line." } ;
-
-HELP: <inset
-{ $values { "style" "a style" } }
-{ $description "Begins a nested block." }
-$prettyprinting-note ;
-
-HELP: end-block
-{ $values { "block" "a block" } }
-{ $description "Save the current position as the end position of the block." } ;
-
-HELP: (block>)
-{ $description "Adds the current block to its containing block." }
-$prettyprinting-note ;
-
-HELP: last-block?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if the current block is the top-level block." }
-$prettyprinting-note ;
-
-HELP: block>
-{ $description "Adds the current block to its containing block, unless the current block is the top-level block in which case it does nothing." }
-{ $notes "This word is used to end blocks in order for the prettyprinter to be forgiving in the case of mismatched begin/end pairs (this can happen when printing parsing words)." }
-$prettyprinting-note ;
-
-HELP: end-blocks
-{ $description "Unwind all prettyprinter state to the top level block." }
-$prettyprinting-note ;
-
-HELP: do-pprint
-{ $description "Recursively output all children of the top-level block. The continuation is restored and output terminates if the line length is exceeded; this test is performed in " { $link fresh-line } "." } ;
diff --git a/core/prettyprint/sections/authors.txt b/core/prettyprint/sections/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/prettyprint/sections/sections-docs.factor b/core/prettyprint/sections/sections-docs.factor
new file mode 100644 (file)
index 0000000..24a947c
--- /dev/null
@@ -0,0 +1,226 @@
+USING: prettyprint io kernel help.markup help.syntax
+prettyprint.sections prettyprint.config words hashtables math
+strings definitions ;
+
+HELP: position
+{ $var-description "The prettyprinter's current character position." } ;
+
+HELP: last-newline
+{ $var-description "The character position of the last newline output by the prettyprinter." } ;
+
+HELP: recursion-check
+{ $var-description "The current nesting of collections being output by the prettyprinter, used to detect circularity and prevent infinite recursion." } ;
+
+HELP: line-count
+{ $var-description "The number of lines output by the prettyprinter so far, used for line limiting (see " { $link line-limit } ")." } ;
+
+HELP: end-printing
+{ $var-description "A continuation captured by " { $link do-pprint } " that breaks out of the printer." } ;
+
+HELP: line-limit?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if the line number limit has been reached, and thus if prettyprinting should stop." } ;
+
+
+HELP: do-indent
+{ $description "Outputs the current indent nesting to the " { $link stdio } " stream." } ;
+
+HELP: fresh-line
+{ $values { "n" "the current column position" } }
+{ $description "Advances the prettyprinter by one line unless the current line is empty. If the line limit is exceeded, escapes the prettyprinter by restoring a continuation captured in " { $link do-pprint } "." } ;
+
+HELP: soft
+{ $description "Possible input parameter to " { $link break } "." } ;
+
+HELP: hard
+{ $description "Possible input parameter to " { $link break } "." } ;
+
+{ soft hard } related-words
+
+HELP: section-fits?
+{ $values { "section" section } { "?" "a boolean" } }
+{ $contract "Tests if a section fits in the space that remains on the current line." } ;
+
+HELP: short-section
+{ $values { "section" section } }
+{ $contract "Prints a section which fits in the current line. This should use a layout strategy maximizing line length and minimizing white space." } ;
+
+HELP: long-section
+{ $values { "section" section } }
+{ $contract "Prints a section which spans multiple lines. This should use a layout strategy maximizing readability and minimizing line length." } ;
+
+HELP: indent-section?
+{ $values { "section" section } { "?" "a boolean" } }
+{ $contract "Outputs a boolean indicating if the indent level should be increased when printing this section as a " { $link long-section } ". Default implementation outputs " { $link f } "." } ;
+
+HELP: unindent-first-line?
+{ $values { "section" section } { "?" "a boolean" } }
+{ $contract "Outputs a boolean indicating if the indent level should only be increased for lines after the first line when printing this section as a " { $link long-section } ". Default implementation outputs " { $link f } "." }
+{ $notes "This is used to format " { $link colon } " sections because of the colon definition formatting convention." } ;
+
+HELP: newline-after?
+{ $values { "section" section } { "?" "a boolean" } }
+{ $contract "Outputs a boolean indicating if a newline should be output after printing this section as a " { $link long-section } ". Default implementation outputs " { $link f } "." } ;
+
+HELP: short-section?
+{ $values { "section" section } { "?" "a boolean" } }
+{ $contract "Tests if a section should be output as a " { $link short-section } ". The default implementation calls " { $link section-fits? } " but this behavior can be cutomized." } ;
+
+HELP: section
+{ $class-description "A piece of prettyprinter output. Instances of this class are not used directly, instead one instantiates various classes which delegate to this class:"
+{ $list
+    { $link text }
+    { $link break }
+    { $link block }
+    { $link inset }
+    { $link flow }
+    { $link hilite }
+    { $link colon }
+}
+"Instances of this class have the following slots:"
+{ $list
+    { { $link section-start } " - the start of the section, measured in characters from the beginning of the prettyprinted output" }
+    { { $link section-end } " - the end of the section, measured in characters from the beginning of the prettyprinted output" }
+    { { $link section-start-group? } " - see " { $link start-group } }
+    { { $link section-end } " - see " { $link end-group } }
+    { { $link section-style } " - character and/or paragraph styles to use when outputting this section. See " { $link "styles" } }
+    { { $link section-overhang } " - number of columns which must be left blank before the wrap margin for the prettyprinter to consider emitting this section as a " { $link short-section } ". Avoids lone hanging closing brackets" }
+} } ;
+
+HELP: <section>
+{ $values { "style" hashtable } { "length" integer } { "section" section } }
+{ $description "Creates a new section with the given length starting from " { $link position } ", advancing " { $link position } "." } ;
+
+HELP: change-indent
+{ $values { "section" section } { "n" integer } }
+{ $description "If the section requests indentation, adds " { $snippet "n" } " to the indent level, otherwise does nothing." } ;
+
+HELP: <indent
+{ $values { "section" section } }
+{ $description "Increases indentation by the " { $link tab-size } " if requested by the section." } ;
+
+HELP: indent>
+{ $values { "section" section } }
+{ $description "Decreases indentation by the " { $link tab-size } " if requested by the section." } ;
+
+HELP: <fresh-line
+{ $values { "section" section } }
+{ $description "Prints a line break before the section start." } ;
+
+HELP: fresh-line>
+{ $values { "section" section } }
+{ $description "Prints a line break after the section end if requested by the section." } ;
+
+HELP: <long-section
+{ $values { "section" section } }
+{ $description "Begins printing a long section, taking " { $link indent-section? } " and " { $link unindent-first-line? } " into account." } ;
+
+HELP: long-section>
+{ $values { "section" section } }
+{ $description "Ends printing a long section, taking " { $link indent-section? } " and " { $link newline-after? } " into account." } ;
+
+HELP: pprint-section
+{ $values { "section" section } }
+{ $contract "Prints a section, performing wrapping and indentation using available formatting information." }
+$prettyprinting-note ;
+
+HELP: break
+{ $values { "type" { $link soft } " or " { $link hard } } }
+{ $description "Adds a section introducing a line break to the current block. If the block is output as a " { $link short-section } ", all breaks are ignored. Otherwise, hard breaks introduce unconditional newlines, and soft breaks introduce a newline if the position is more than half of the " { $link margin } "." }
+$prettyprinting-note ;
+
+HELP: block
+{ $class-description "A block is a section containing child sections. Blocks are introduced by calling " { $link <block } " and " { $link block> } "." } ;
+
+HELP: pprinter-block
+{ $values { "block" "a block section" } }
+{ $description "Outputs the block currently being constructed." }
+$prettyprinting-note ;
+
+HELP: add-section
+{ $values { "section" "a section" } }
+{ $description "Adds a section to the current block." }
+$prettyprinting-note ;
+
+HELP: start-group
+{ $description "Marks the start of a group. Sections inside a group are output on one line if possible." } ;
+
+HELP: end-group
+{ $description "Marks the end of a group. Sections inside a group are output on one line if possible." } ;
+
+HELP: advance
+{ $values { "section" section } }
+{ $description "Emits whitespace between sections." }
+$prettyprinting-note ;
+
+HELP: save-end-position
+{ $values { "block" block } }
+{ $description "Save the current position as the end position of the block." } ;
+
+HELP: pprint-sections
+{ $values { "block" block } { "advancer" "a quotation with stack effect " { $snippet "( block -- )" } } }
+{ $description "Prints child sections of a block, ignoring any " { $link break } " sections. The " { $snippet "advancer" } " quotation is called between every pair of sections." } ;
+
+HELP: do-break
+{ $values { "break" break } }
+{ $description "Prints a break section as per the policy outlined in " { $link break } "." } ;
+
+HELP: empty-block?
+{ $values { "block" block } { "?" "a boolean" } }
+{ $description "Tests if the block has no child sections." } ;
+
+HELP: if-nonempty
+{ $values { "block" block } { "quot" "a quotation with stack effect " { $snippet "( block -- )" } } }
+{ $description "If the block has child sections, calls the quotation, otherwise does nothing." } ;
+
+HELP: (<block)
+{ $values { "block" block } }
+{ $description "Begins constructing a nested block." } ;
+
+HELP: <block
+{ $description "Begins a plain block." } ;
+
+HELP: <text>
+{ $values { "string" string } { "style" hashtable } { "text" "a new text section" } }
+{ $description "Creates a text section." } ;
+
+HELP: text
+{ $values { "string" string } }
+{ $description "Adds a string to the current block." }
+$prettyprinting-note ;
+
+HELP: styled-text
+{ $values { "string" string } { "style" hashtable } }
+{ $description "Adds a styled string to the current block." }
+$prettyprinting-note ;
+
+HELP: inset
+{ $class-description "A " { $link block } " section which indents every line when printed as a " { $link long-section } "." } ;
+
+HELP: <inset
+{ $values { "narrow?" "a boolean" } }
+{ $description "Begins an " { $link inset } " section. When printed as a " { $link long-section } ", the output format is determined by the " { $snippet "narrow?" } " flag. If it is " { $link f } ", then longer lines are favored, wrapping at the " { $link margin } ". Otherwise, every child section is printed on its own line." }
+{ $examples
+    "Compare the output of printing a long quotation versus a hashtable. Quotations are printed with " { $snippet "narrow?" } " set to " { $link f } ", and hashtables are printed with " { $snippet "narrow?" } " set to " { $link t } "."
+} ;
+
+HELP: flow
+{ $class-description "A " { $link block } " section printed on its own line if it can fit entirely on one line." } ;
+
+HELP: <flow
+{ $description "Begins a " { $link flow } " section. " } ;
+
+HELP: colon
+{ $class-description "A " { $link block } " section. When printed as a " { $link long-section } ", indents every line except the first." }
+{ $notes "Colon sections are used to enclose compound definitions printed by " { $link see } "." } ;
+
+HELP: <colon
+{ $description "Begins a " { $link colon } " section." } ;
+
+HELP: block>
+{ $description "Adds the current block to its containing block." }
+$prettyprinting-note ;
+
+HELP: do-pprint
+{ $values { "block" block } }
+{ $description "Recursively output all children of the given block. The continuation is restored and output terminates if the line length is exceeded; this test is performed in " { $link fresh-line } "." } ;
diff --git a/core/prettyprint/sections/sections.factor b/core/prettyprint/sections/sections.factor
new file mode 100644 (file)
index 0000000..3531034
--- /dev/null
@@ -0,0 +1,343 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays generic hashtables io kernel math assocs
+namespaces sequences strings io.styles vectors words
+prettyprint.config splitting classes continuations
+io.streams.nested ;
+IN: prettyprint.sections
+
+! State
+SYMBOL: position
+SYMBOL: recursion-check
+SYMBOL: pprinter-stack
+
+SYMBOL: last-newline
+SYMBOL: line-count
+SYMBOL: end-printing
+SYMBOL: indent
+
+! We record vocabs of all words
+SYMBOL: pprinter-in
+SYMBOL: pprinter-use
+
+: record-vocab ( word -- )
+    word-vocabulary [ dup pprinter-use get set-at ] when* ;
+
+! Utility words
+: line-limit? ( -- ? )
+    line-limit get dup [ line-count get <= ] when ;
+
+: do-indent ( -- ) indent get CHAR: \s <string> write ;
+
+: fresh-line ( n -- )
+    dup last-newline get = [
+        drop
+    ] [
+        last-newline set
+        line-limit? [ "..." write end-printing get continue ] when
+        line-count inc
+        nl do-indent
+    ] if ;
+
+: text-fits? ( len -- ? )
+    margin get dup zero?
+    [ 2drop t ] [ >r indent get + r> <= ] if ;
+
+! break only if position margin 2 / >
+SYMBOL: soft
+
+! always breaks
+SYMBOL: hard
+
+! Section protocol
+GENERIC: section-fits? ( section -- ? )
+
+GENERIC: short-section ( section -- )
+
+GENERIC: long-section ( section -- )
+
+GENERIC: indent-section? ( section -- ? )
+
+GENERIC: unindent-first-line? ( section -- ? )
+
+GENERIC: newline-after? ( section -- ? )
+
+GENERIC: short-section? ( section -- ? )
+
+! Sections
+TUPLE: section
+start end
+start-group? end-group?
+style overhang ;
+
+: <section> ( style length -- section )
+    position [ dup rot + dup ] change 0 {
+        set-section-style
+        set-section-start
+        set-section-end
+        set-section-overhang
+    } section construct ;
+
+M: section section-fits? ( section -- ? )
+    dup section-end last-newline get -
+    swap section-overhang + text-fits? ;
+
+M: section indent-section? drop f ;
+
+M: section unindent-first-line? drop f ;
+
+M: section newline-after? drop f ;
+
+M: object short-section? section-fits? ;
+
+: change-indent ( section n -- )
+    swap indent-section? [ indent +@ ] [ drop ] if ;
+
+: <indent ( section -- ) tab-size get change-indent ;
+
+: indent> ( section -- ) tab-size get neg change-indent ;
+
+: <fresh-line ( section -- )
+    section-start fresh-line ;
+
+: fresh-line> ( section -- )
+    dup newline-after? [ section-end fresh-line ] [ drop ] if ;
+
+: <long-section ( section -- )
+    dup unindent-first-line?
+    [ dup <fresh-line <indent ] [ dup <indent <fresh-line ] if ;
+
+: long-section> ( section -- )
+    dup indent> fresh-line> ;
+
+: with-style* ( style quot -- )
+    swap stdio [ <style-stream> ] change
+    call stdio [ delegate ] change ; inline
+
+: pprint-section ( section -- )
+    dup short-section? [
+        dup section-style [ short-section ] with-style*
+    ] [
+        dup <long-section
+        dup section-style [ dup long-section ] with-style*
+        long-section>
+    ] if ;
+
+! Break section
+TUPLE: break type ;
+
+: <break> ( type -- section )
+    H{ } 0 <section>
+    { set-break-type set-delegate } \ break construct ;
+
+M: break short-section drop ;
+
+M: break long-section drop ;
+
+! Block sections
+TUPLE: block sections ;
+
+: <block> ( style -- block )
+    0 <section> V{ } clone
+    { set-delegate set-block-sections } block construct ;
+
+: delegate>block ( obj -- ) H{ } <block> swap set-delegate ;
+
+: pprinter-block ( -- block ) pprinter-stack get peek ;
+
+: add-section ( section -- )
+    pprinter-block block-sections push ;
+
+: last-section ( -- section )
+    pprinter-block block-sections [ break? not ] find-last nip ;
+
+: hilite-style ( -- hash )
+    H{
+        { background { 0.9 0.9 0.9 1 } }
+        { highlight t }
+    } ;
+
+: hilite ( -- )
+    last-section
+    dup section-style hilite-style union
+    swap set-section-style ;
+
+: start-group ( -- )
+    t last-section set-section-start-group? ;
+
+: end-group ( -- )
+    t last-section set-section-end-group? ;
+
+: advance ( section -- )
+    dup section-start last-newline get = not
+    swap short-section? and
+    [ bl ] when ;
+
+: break ( type -- ) [ <break> add-section ] when* ;
+
+M: block section-fits? ( section -- ? )
+    line-limit? [ drop t ] [ delegate section-fits? ] if ;
+
+: pprint-sections ( block advancer -- )
+    swap block-sections [ break? not ] subset
+    unclip pprint-section [
+        dup rot call pprint-section
+    ] curry* each ; inline
+
+M: block short-section ( block -- )
+    [ advance ] pprint-sections ;
+
+: do-break ( break -- )
+    dup break-type hard eq?
+    over section-end last-newline get - margin get 2/ > or
+    [ <fresh-line ] [ drop ] if ;
+
+: empty-block? ( block -- ? ) block-sections empty? ;
+
+: if-nonempty ( block quot -- )
+    >r dup empty-block? [ drop ] r> if ; inline
+
+: (<block) pprinter-stack get push ;
+
+: <block H{ } <block> (<block) ;
+
+: <object ( obj -- ) presented associate <block> (<block) ;
+
+! Text section
+TUPLE: text string ;
+
+: <text> ( string style -- text )
+    over length 1+ <section>
+    { set-text-string set-delegate }
+    \ text construct ;
+
+M: text short-section text-string write ;
+
+M: text long-section short-section ;
+
+: styled-text ( string style -- ) <text> add-section ;
+
+: text ( string -- ) H{ } styled-text ;
+
+! Inset section
+TUPLE: inset narrow? ;
+
+: <inset> ( narrow? -- block )
+    2 H{ } <block>
+    { set-inset-narrow? set-section-overhang set-delegate }
+    inset construct ;
+
+M: inset long-section
+    dup inset-narrow? [
+        [ <fresh-line ] pprint-sections
+    ] [
+        delegate long-section
+    ] if ;
+
+M: inset indent-section? drop t ;
+
+M: inset newline-after? drop t ;
+
+: <inset ( narrow? -- ) <inset> (<block) ;
+
+! Flow section
+TUPLE: flow ;
+
+: <flow> ( -- block )
+    H{ } <block> flow construct-delegate ;
+
+M: flow short-section? ( section -- ? )
+    #! If we can make room for this entire block by inserting
+    #! a newline, do it; otherwise, don't bother, print it as
+    #! a short section
+    dup section-fits?
+    over section-end rot section-start - text-fits? not or ;
+
+: <flow ( -- ) <flow> (<block) ;
+
+! Colon definition section
+TUPLE: colon ;
+
+: <colon> ( -- block )
+    H{ } <block> colon construct-delegate ;
+
+M: colon long-section short-section ;
+
+M: colon indent-section? drop t ;
+
+M: colon unindent-first-line? drop t ;
+
+: <colon ( -- ) <colon> (<block) ;
+
+: save-end-position ( block -- )
+    position get swap set-section-end ;
+
+: block> ( -- )
+    pprinter-stack get pop
+    [ dup save-end-position add-section ] if-nonempty ;
+
+: with-section-state ( quot -- )
+    [
+        0 indent set
+        0 last-newline set
+        1 line-count set
+        call
+    ] with-scope ; inline
+
+: do-pprint ( block -- )
+    [
+        [
+            dup section-style [
+                [ end-printing set dup short-section ] callcc0
+            ] with-nesting drop
+        ] if-nonempty
+    ] with-section-state ;
+
+! Long section layout algorithm
+: chop-break ( seq -- seq )
+    dup peek break? [ 1 head-slice* chop-break ] when ;
+
+SYMBOL: prev
+SYMBOL: next
+
+: split-groups [ t , ] when ;
+
+M: f section-start-group? drop t ;
+
+M: f section-end-group? drop f ;
+
+: split-before ( section -- )
+    dup section-start-group? prev get section-end-group? and
+    swap flow? prev get flow? not and
+    or split-groups ;
+
+: split-after ( section -- )
+    section-end-group? split-groups ;
+
+: group-flow ( seq -- newseq )
+    [
+        dup length [
+            2dup 1- swap ?nth prev set
+            2dup 1+ swap ?nth next set
+            swap nth dup split-before dup , split-after
+        ] curry* each
+    ] { } make { t } split [ empty? not ] subset ;
+
+: break-group? ( seq -- ? )
+    dup first section-fits? swap peek section-fits? not and ;
+
+: ?break-group ( seq -- )
+    dup break-group? [ first <fresh-line ] [ drop ] if ;
+
+M: block long-section ( block -- )
+    [
+        block-sections chop-break group-flow [
+            dup ?break-group [
+                dup break? [
+                    do-break
+                ] [
+                    dup advance pprint-section
+                ] if
+            ] each
+        ] each
+    ] if-nonempty ;
diff --git a/core/prettyprint/sections/summary.txt b/core/prettyprint/sections/summary.txt
new file mode 100644 (file)
index 0000000..a953dff
--- /dev/null
@@ -0,0 +1 @@
+Prettyprinter formatting and layout logic
diff --git a/core/prettyprint/summary.txt b/core/prettyprint/summary.txt
new file mode 100644 (file)
index 0000000..6e69454
--- /dev/null
@@ -0,0 +1 @@
+Factor source code prettyprinter
diff --git a/core/prettyprint/tags.txt b/core/prettyprint/tags.txt
new file mode 100644 (file)
index 0000000..8ba7ae8
--- /dev/null
@@ -0,0 +1,2 @@
+tools
+reflection
diff --git a/core/queues/authors.txt b/core/queues/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/queues/queues-docs.factor b/core/queues/queues-docs.factor
new file mode 100644 (file)
index 0000000..845b95e
--- /dev/null
@@ -0,0 +1,77 @@
+USING: help.markup help.syntax kernel ;
+IN: queues
+
+ARTICLE: "queues" "Queues"
+"Last-in-first-out queues are defined in the " { $vocab-link "queues" } " vocabulary."
+$nl
+"Queues are a class."
+{ $subsection queue }
+{ $subsection queue? }
+{ $subsection <queue> }
+"Testing queues:"
+{ $subsection queue-empty? }
+"Adding elements:"
+{ $subsection deque }
+"Removing elements:"
+{ $subsection enque }
+{ $subsection clear-queue }
+{ $subsection queue-each }
+"An example:"
+{ $code
+    "<queue> \"q\" set"
+    "5 \"q\" get enque"
+    "3 \"q\" get enque"
+    "7 \"q\" get enque"
+    "\"q\" get deque ."
+    "  5"
+    "\"q\" get deque ."
+    "  3"
+    "\"q\" get deque ."
+    "  7"
+} ;
+
+ABOUT: "queues"
+
+HELP: queue
+{ $class-description "A simple first-in-first-out queue. See " { $link "queues" } "." } ;
+
+HELP: entry
+{ $class-description "The class of entries in a " { $link queue } ". Each entry holds an object and a reference to the next entry." } ;
+
+HELP: <entry>
+{ $values { "obj" object } { "entry" entry } }
+{ $description "Creates a new queue entry." }
+{ $notes "This word is a factor of " { $link enque } "." } ;
+
+HELP: <queue>
+{ $values { "queue" queue } }
+{ $description "Makes a new queue with no elements." } ;
+
+HELP: queue-empty?
+{ $values { "queue" queue } { "?" "a boolean" } }
+{ $description "Tests if a queue contains no elements." } ;
+
+HELP: deque
+{ $values { "queue" queue } { "elt" object } }
+{ $description "Removes an element from the front of the queue." }
+{ $errors "Throws an " { $link empty-queue-error } " if the queue has no entries." }
+{ $side-effects "queue" } ;
+
+HELP: enque
+{ $values { "elt" object } { "queue" queue } }
+{ $description "Adds an element to the back of the queue." }
+{ $side-effects "queue" } ;
+
+HELP: empty-queue-error
+{ $description "Throws an " { $link empty-queue-error } "." }
+{ $error-description "Thrown by " { $link deque } " if the queue has no entries." } ;
+
+HELP: clear-queue
+{ $values { "queue" queue } }
+{ $description "Removes all entries from the queue." }
+{ $side-effects "queue" } ;
+
+HELP: queue-each
+{ $values { "queue" queue } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
+{ $description "Applies the quotation to each entry in the queue, starting from the least recently added entry, clearing the queue in the process." }
+{ $side-effects "queue" } ;
diff --git a/core/queues/queues-tests.factor b/core/queues/queues-tests.factor
new file mode 100644 (file)
index 0000000..d8df256
--- /dev/null
@@ -0,0 +1,12 @@
+USING: kernel math namespaces queues sequences tools.test ;
+IN: temporary
+
+<queue> "queue" set
+
+[ t ] [ "queue" get queue-empty? ] unit-test
+
+[ ] [ [ 1 2 3 4 5 ] [ "queue" get enque ] each ] unit-test
+
+[ { 1 2 3 4 5 } ] [ 5 [ drop "queue" get deque ] map ] unit-test
+
+[ "queue" get deque ] unit-test-fails
diff --git a/core/queues/queues.factor b/core/queues/queues.factor
new file mode 100644 (file)
index 0000000..0cd05ea
--- /dev/null
@@ -0,0 +1,57 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: queues
+USING: kernel inspector ;
+
+TUPLE: entry obj next ;
+
+: <entry> ( obj -- entry ) f entry construct-boa ;
+
+TUPLE: queue head tail ;
+
+: <queue> ( -- queue ) queue construct-empty ;
+
+: queue-empty? ( queue -- ? ) queue-head not ;
+
+: (enque) ( entry queue -- )
+    [ set-queue-head ] 2keep set-queue-tail ;
+
+: clear-queue ( queue -- )
+    f swap (enque) ;
+
+: enque ( elt queue -- )
+    >r <entry> r> dup queue-empty? [
+        (enque)
+    ] [
+        [ queue-tail set-entry-next ] 2keep set-queue-tail
+    ] if ;
+
+: clear-entry ( entry -- )
+    f over set-entry-obj f swap set-entry-next ;
+
+: (deque) ( queue -- )
+    dup queue-head over queue-tail eq? [
+        clear-queue
+    ] [
+        dup queue-head dup entry-next rot set-queue-head
+        clear-entry
+    ] if ;
+
+TUPLE: empty-queue-error ;
+: empty-queue-error ( -- * )
+    \ empty-queue-error construct-empty throw ;
+
+: deque ( queue -- elt )
+    dup queue-empty? [
+        empty-queue-error
+    ] [
+        dup queue-head entry-obj >r (deque) r>
+    ] if ;
+
+M: empty-queue-error summary
+    drop "Empty queue" ;
+
+: queue-each ( queue quot -- )
+    over queue-empty?
+    [ 2drop ] [ [ >r deque r> call ] 2keep queue-each ] if ;
+    inline
diff --git a/core/queues/summary.txt b/core/queues/summary.txt
new file mode 100644 (file)
index 0000000..7bc2a8c
--- /dev/null
@@ -0,0 +1 @@
+FIFO queues
diff --git a/core/queues/tags.txt b/core/queues/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/quotations.factor b/core/quotations.factor
deleted file mode 100644 (file)
index 30b73c0..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: kernel
-USING: arrays generic kernel-internals math namespaces sequences
-sequences-internals words ;
-
-: <quotation> ( n -- quot ) f <array> quotation-type become ;
-
-M: wrapper equal?
-    over wrapper? [ [ wrapped ] 2apply = ] [ 2drop f ] if ;
-
-M: quotation clone (clone) ;
-M: quotation length array-capacity ;
-M: quotation nth bounds-check nth-unsafe ;
-M: quotation set-nth bounds-check set-nth-unsafe ;
-M: quotation nth-unsafe >r >fixnum r> array-nth ;
-M: quotation set-nth-unsafe >r >fixnum r> set-array-nth ;
-M: quotation new drop <quotation> ;
-
-: >quotation ( seq -- quot )
-    [ quotation? ] [ <quotation> ] >sequence ; inline
-
-M: quotation like drop dup quotation? [ >quotation ] unless ;
-
-: make-dip ( quot n -- newquot )
-    dup \ >r <array> -rot \ r> <array> 3append >quotation ;
-
-: unit ( obj -- quot ) 1array >quotation ;
-
-GENERIC: literalize ( obj -- wrapped )
-M: object literalize ;
-M: word literalize <wrapper> ;
-M: wrapper literalize <wrapper> ;
-
-: curry ( obj quot -- newquot )
-    [ swap literalize , % ] [ ] make ;
-
-: alist>quot ( default assoc -- quot )
-    [ [ first2 swap % , , \ if , ] [ ] make ] each ;
diff --git a/core/quotations.facts b/core/quotations.facts
deleted file mode 100644 (file)
index 07f5df1..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-IN: kernel
-USING: arrays help strings vectors ;
-
-HELP: quotation
-{ $description "The class of quotations. See " { $link "syntax-quots" } " for syntax and " { $link "quotations" } " for general information." } ;
-
-HELP: <quotation>
-{ $values { "n" "a non-negative integer" } { "quot" "a new quotation" } }
-{ $description "Creates a new quotation with the given length and all elements initially set to " { $link f } "." }
-{ $see-also <array> <string> <sbuf> <vector> } ;
-
-HELP: >quotation
-{ $values { "seq" "a sequence" } { "quot" "a quotation" } }
-{ $description "Outputs a freshly-allocated quotation with the same elements as a given sequence." }
-{ $see-also >array >string >sbuf >vector } ;
-
-HELP: make-dip
-{ $values { "quot" "a quotation" } { "n" "a non-negative integer" } { "newquot" "a new quotation" } }
-{ $description "Constructs a quotation which retains the top " { $snippet "n" } " stack items, and applies " { $snippet "quot" } " to what is underneath." }
-{ $examples
-    { $example "[ 3 + ] 2 make-dip ." "[ >r >r 3 + r> r> ]" }
-} ;
-
-HELP: unit
-{ $values { "obj" "an object" } { "quot" "a new quotation" } }
-{ $description "Constructs a quotation holding one element." }
-{ $notes
-    "The following two phrases are equivalent:"
-    { $code "\\ reverse execute" }
-    { $code "\\ reverse unit call" }
-}
-{ $see-also 1array } ;
-
-HELP: wrapper
-{ $description "The class of wrappers. See " { $link "syntax-words" } " for syntax." } ;
-
-HELP: <wrapper> ( obj -- wrapper )
-{ $values { "obj" "an object" } { "wrapper" "a new wrapper" } }
-{ $description "Creates an object which pushes " { $snippet "obj" } " on the stack when evaluated. User code should call " { $link literalize } " instead, since it avoids wrapping self-evaluating objects (which is redundant)." } ;
-
-HELP: literalize
-{ $values { "obj" "an object" } { "wrapped" "an object" } }
-{ $description "Outputs an object which evaluates to " { $snippet "obj" } " when placed in a quotation. If " { $snippet "obj" } " is not self-evaluating (for example, it is a word), then it will be wrapped." }
-{ $examples
-    { $example "5 literalize ." "5" }
-    { $example "[ + ] [ literalize ] map ." "[ \\ + ]" }
-}
-{ $see-also curry <wrapper> } ;
-
-HELP: curry
-{ $values { "obj" "an object" } { "quot" "a quotation" } { "newquot" "a quotation" } }
-{ $description "Constructs a new quotation which first pushes " { $snippet "obj" } " and then calls " { $snippet "quot" } ". If " { $snippet "obj" } " is not self-evaluating, it will be wrapped." }
-{ $examples
-    { $example "5 [ . ] curry ." "[ 5 . ]" }
-    { $example "\\ = [ see ] curry ." "[ \\ = see ]" }
-} ;
-
-HELP: alist>quot
-{ $values { "default" "a quotation" } { "assoc" "a sequence of quotation pairs" } { "quot" "a new quotation" } }
-{ $description "Constructs a quotation which calls the first quotation in each pair of " { $snippet "assoc" } " until one of them outputs a true value, and then calls the second quotation in the corresponding pair. Quotations are called in reverse order, and if no quotation outputs a true value then " { $snippet "default" } " is called." }
-{ $notes "This word is used to implement compile-time behavior for " { $link cond } ", and it is also used by the generic word system. Note that unlike " { $link cond } ", the constructed quotation performs the tests starting from the end and not the beginning." } ;
diff --git a/core/quotations/authors.txt b/core/quotations/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/quotations/quotations-docs.factor b/core/quotations/quotations-docs.factor
new file mode 100644 (file)
index 0000000..f647bb2
--- /dev/null
@@ -0,0 +1,62 @@
+USING: arrays help.markup help.syntax strings sbufs
+vectors kernel combinators ;
+IN: quotations
+
+ARTICLE: "quotations" "Quotations"
+"Conceptually, a quotation is an anonymous function (a value denoting a snippet of code) which can be passed around and called."
+$nl
+"Concretely, a quotation is an immutable sequence of objects, some of which may be words, together with a block of machine code which may be executed to achieve the effect of evaluating the quotation. The machine code is generated by a fast non-optimizing quotation compiler which is always running and is transparent to the developer."
+$nl
+"Quotations evaluate sequentially from beginning to end. Literals are pushed on the stack and words are executed. Details can be found in " { $link "evaluator" } "."
+$nl
+"Quotation literal syntax is documented in " { $link "syntax-quots" } "."
+$nl
+"Quotations implement the " { $link "sequence-protocol" } ", and existing sequences can be converted into quotations:"
+{ $subsection >quotation }
+{ $subsection 1quotation }
+"Wrappers are used to push words on the data stack; they evaluate to the object being wrapped:"
+{ $subsection wrapper }
+{ $subsection literalize }
+{ $see-also "basic-combinators" "combinators" } ;
+
+ABOUT: "quotations"
+
+HELP: callable
+{ $class-description "The class whose instances can be passed to " { $link call } ". This includes quotations, " { $link f } " (which behaves like an empty quotation), and composed quotations built up with " { $link curry } "." } ;
+
+HELP: quotation
+{ $description "The class of quotations. See " { $link "syntax-quots" } " for syntax and " { $link "quotations" } " for general information." } ;
+
+HELP: <quotation>
+{ $values { "n" "a non-negative integer" } { "quot" quotation } }
+{ $description "Creates a new quotation with the given length and all elements initially set to " { $link f } "." } ;
+
+HELP: >quotation
+{ $values { "seq" "a sequence" } { "quot" quotation } }
+{ $description "Outputs a freshly-allocated quotation with the same elements as a given sequence." } ;
+
+HELP: 1quotation
+{ $values { "obj" object } { "quot" quotation } }
+{ $description "Constructs a quotation holding one element." }
+{ $notes
+    "The following two phrases are equivalent:"
+    { $code "\\ reverse execute" }
+    { $code "\\ reverse 1quotation call" }
+} ;
+
+HELP: wrapper
+{ $description "The class of wrappers. Wrappers are created by calling " { $link literalize } ". See " { $link "syntax-words" } " for syntax." } ;
+
+HELP: <wrapper> ( obj -- wrapper )
+{ $values { "obj" object } { "wrapper" wrapper } }
+{ $description "Creates an object which pushes " { $snippet "obj" } " on the stack when evaluated. User code should call " { $link literalize } " instead, since it avoids wrapping self-evaluating objects (which is redundant)." } ;
+
+HELP: literalize
+{ $values { "obj" object } { "wrapped" object } }
+{ $description "Outputs an object which evaluates to " { $snippet "obj" } " when placed in a quotation. If " { $snippet "obj" } " is not self-evaluating (for example, it is a word), then it will be wrapped." }
+{ $examples
+    { $example "USE: quotations" "5 literalize ." "5" }
+    { $example "USE: quotations" "[ + ] [ literalize ] map ." "[ \\ + ]" }
+} ;
+
+{ literalize curry <wrapper> POSTPONE: \ POSTPONE: W{ } related-words
diff --git a/core/quotations/quotations-tests.factor b/core/quotations/quotations-tests.factor
new file mode 100644 (file)
index 0000000..662b9e9
--- /dev/null
@@ -0,0 +1,16 @@
+USING: math kernel quotations tools.test sequences ;
+IN: temporary
+
+[ [ 3 ] ] [ 3 f curry ] unit-test
+[ [ \ + ] ] [ \ + f curry ] unit-test
+[ [ \ + = ] ] [ \ + [ = ] curry ] unit-test
+
+[ [ 1 + 2 + 3 + ] ] [
+    { 1 2 3 } [ [ + ] curry ] map concat
+] unit-test
+
+[ [ 1 2 3 4 ] ] [ [ 1 2 ] [ 3 4 ] append ] unit-test
+[ [ 1 2 3 ] ] [ [ 1 2 ] 3 add ] unit-test
+[ [ 3 1 2 ] ] [ [ 1 2 ] 3 add* ] unit-test
+
+[ [ "hi" ] ] [ "hi" 1quotation ] unit-test
diff --git a/core/quotations/quotations.factor b/core/quotations/quotations.factor
new file mode 100644 (file)
index 0000000..0905aba
--- /dev/null
@@ -0,0 +1,52 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays sequences sequences.private
+kernel kernel.private math assocs quotations.private ;
+IN: quotations
+
+M: wrapper equal?
+    over wrapper? [ [ wrapped ] 2apply = ] [ 2drop f ] if ;
+
+UNION: callable quotation curry ;
+
+M: callable equal?
+    over callable? [ sequence= ] [ 2drop f ] if ;
+
+: <quotation> ( n -- quot )
+    f <array> array>quotation ; inline
+
+M: quotation length quotation-array length ;
+
+M: quotation nth-unsafe quotation-array nth-unsafe ;
+
+: >quotation ( seq -- quot )
+    >array array>quotation ; inline
+
+M: quotation like drop dup quotation? [ >quotation ] unless ;
+
+INSTANCE: quotation immutable-sequence
+
+: make-dip ( quot n -- newquot )
+    dup \ >r <repetition> -rot \ r> <repetition> 3append
+    >quotation ;
+
+: 1quotation ( obj -- quot ) 1array >quotation ;
+
+GENERIC: literalize ( obj -- wrapped )
+
+M: object literalize ;
+
+M: wrapper literalize <wrapper> ;
+
+M: curry length curry-quot length 1+ ;
+
+M: curry nth
+    over zero? [
+        nip curry-obj literalize
+    ] [
+        >r 1- r> curry-quot nth
+    ] if ;
+
+M: curry like drop [ ] like ;
+
+INSTANCE: curry immutable-sequence
diff --git a/core/quotations/summary.txt b/core/quotations/summary.txt
new file mode 100644 (file)
index 0000000..9944761
--- /dev/null
@@ -0,0 +1 @@
+Code quotations, essentially executable fixed-size arrays
diff --git a/core/quotations/tags.txt b/core/quotations/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/refs/refs-docs.factor b/core/refs/refs-docs.factor
new file mode 100644 (file)
index 0000000..dff671f
--- /dev/null
@@ -0,0 +1,52 @@
+! Copyright (C) 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel ;
+IN: refs
+
+ARTICLE: "refs" "References to assoc entries"
+"A " { $emphasis "reference" } " is an object encapsulating an assoc and a key; the reference then refers to either the key itself, or the value associated to the key. References can be read, written, and deleted."
+{ $subsection get-ref }
+{ $subsection set-ref }
+{ $subsection delete-ref }
+"References to keys:"
+{ $subsection key-ref }
+{ $subsection <key-ref> }
+"References to values:"
+{ $subsection value-ref }
+{ $subsection <value-ref> }
+"References are used by the inspector." ;
+
+ABOUT: "refs"
+
+HELP: ref
+{ $class-description "A class whose instances identify a key or value location in an associative structure. Instances of this clas are never used directly; only instances of " { $link key-ref } " and " { $link value-ref } " should be created." } ;
+
+HELP: delete-ref
+{ $values { "ref" ref } }
+{ $description "Deletes the association entry pointed at by this reference." } ;
+
+HELP: get-ref
+{ $values { "ref" ref } { "obj" object } }
+{ $description "Outputs the key or the value pointed at by this reference." } ;
+
+HELP: set-ref
+{ $values { "obj" object } { "ref" ref } }
+{ $description "Stores a new key or value at by this reference." } ;
+
+HELP: key-ref
+{ $class-description "Instances of this class identify a key in an associative structure. New key references are created by calling " { $link <key-ref> } "." } ;
+
+HELP: <key-ref>
+{ $values { "key" object } { "assoc" "an assoc" } { "ref" key-ref } }
+{ $description "Creates a reference to a key stored in an assoc." } ;
+
+HELP: value-ref
+{ $class-description "Instances of this class identify a value associated to a key in an associative structure. New value references are created by calling " { $link <value-ref> } "." } ;
+
+HELP: <value-ref>
+{ $values { "key" object } { "assoc" "an assoc" } { "ref" value-ref } }
+{ $description "Creates a reference to the value associated with " { $snippet "key" } " in " { $snippet "assoc" } "." } ;
+
+{ get-ref set-ref delete-ref } related-words
+
+{ <key-ref> <value-ref> } related-words
diff --git a/core/refs/refs.factor b/core/refs/refs.factor
new file mode 100644 (file)
index 0000000..fb67db9
--- /dev/null
@@ -0,0 +1,25 @@
+! Copyright (C) 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: tuples kernel assocs ;
+IN: refs
+
+TUPLE: ref assoc key ;
+
+: <ref> ( assoc key class -- tuple )
+    >r ref construct-boa r> construct-delegate ; inline
+
+: >ref< ( ref -- key assoc ) dup ref-key swap ref-assoc ;
+
+: delete-ref ( ref -- ) >ref< delete-at ;
+GENERIC: get-ref ( ref -- obj )
+GENERIC: set-ref ( obj ref -- )
+
+TUPLE: key-ref ;
+: <key-ref> ( assoc key -- ref ) key-ref <ref> ;
+M: key-ref get-ref ref-key ;
+M: key-ref set-ref >ref< rename-at ;
+
+TUPLE: value-ref ;
+: <value-ref> ( assoc key -- ref ) value-ref <ref> ;
+M: value-ref get-ref >ref< at ;
+M: value-ref set-ref >ref< set-at ;
diff --git a/core/sbufs/authors.txt b/core/sbufs/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/sbufs/sbufs-docs.factor b/core/sbufs/sbufs-docs.factor
new file mode 100644 (file)
index 0000000..03769ab
--- /dev/null
@@ -0,0 +1,33 @@
+USING: strings arrays byte-arrays bit-arrays help.markup
+help.syntax kernel vectors ;
+IN: sbufs
+
+ARTICLE: "sbufs" "String buffers"
+"A string buffer is a resizable mutable sequence of characters. The literal syntax is covered in " { $link "syntax-sbufs" } "."
+$nl
+"String buffers can be used to construct new strings by accumilating substrings and characters, however usually they are only used indirectly, since the sequence construction words are more convenient to use in most cases (see " { $link "namespaces-make" } ")."
+$nl
+"String buffer words are found in the " { $vocab-link "sbufs" } " vocabulary."
+$nl
+"String buffers form a class of objects:"
+{ $subsection sbuf }
+{ $subsection sbuf? }
+"Words for creating string buffers:"
+{ $subsection >sbuf }
+{ $subsection <sbuf> }
+"If you don't care about initial capacity, a more elegant way to create a new string buffer is to write:"
+{ $code "SBUF\" \" clone" } ;
+
+ABOUT: "sbufs"
+
+HELP: sbuf
+{ $description "The class of resizable character strings. See " { $link "syntax-sbufs" } " for syntax and " { $link "sbufs" } " for general information." } ;
+
+HELP: <sbuf>
+{ $values { "n" "a positive integer specifying initial capacity" } { "sbuf" sbuf } }
+{ $description "Creates a new string buffer that can hold " { $snippet "n" } " characters before resizing." } ;
+
+HELP: >sbuf
+{ $values { "seq" "a sequence of non-negative integers" } { "sbuf" sbuf } }
+{ $description "Outputs a freshly-allocated string buffer with the same elements as a given sequence." }
+{ $errors "Throws an error if the sequence contains elements other than real numbers." } ;
diff --git a/core/sbufs/sbufs-tests.factor b/core/sbufs/sbufs-tests.factor
new file mode 100644 (file)
index 0000000..c0b03b7
--- /dev/null
@@ -0,0 +1,20 @@
+USING: kernel math namespaces sequences sbufs strings
+tools.test ;
+IN: temporary
+
+[ 5 ] [ "Hello" >sbuf length ] unit-test
+
+[ "Hello" ] [
+    100 <sbuf> "buf" set
+    "Hello" "buf" get push-all
+    "buf" get clone "buf-clone" set
+    "World" "buf-clone" get push-all
+    "buf" get >string
+] unit-test
+
+[ CHAR: h ] [ 0 SBUF" hello world" nth ] unit-test
+[ CHAR: H ] [
+    CHAR: H 0 SBUF" hello world" [ set-nth ] keep first
+] unit-test
+
+[ SBUF" x" ] [ 1 <sbuf> CHAR: x >bignum over push ] unit-test
diff --git a/core/sbufs/sbufs.factor b/core/sbufs/sbufs.factor
new file mode 100644 (file)
index 0000000..4ed47b2
--- /dev/null
@@ -0,0 +1,41 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math strings kernel.private sequences.private
+sequences strings growable strings.private sbufs.private ;
+IN: sbufs
+
+: <sbuf> ( n -- sbuf ) 0 <string> 0 string>sbuf ; inline
+
+M: sbuf set-nth-unsafe
+    underlying >r >r >fixnum r> >fixnum r> set-char-slot ;
+
+M: sbuf new drop [ 0 <string> ] keep string>sbuf ;
+
+: >sbuf ( seq -- sbuf ) SBUF" " clone-like ; inline
+
+M: sbuf like
+    drop dup sbuf? [
+        dup string? [ dup length string>sbuf ] [ >sbuf ] if
+    ] unless ;
+
+M: sbuf new-resizable drop <sbuf> ;
+
+M: sbuf equal?
+    over sbuf? [ sequence= ] [ 2drop f ] if ;
+
+M: string new-resizable drop <sbuf> ;
+
+M: string like
+    drop dup string? [
+        dup sbuf? [
+            dup length over underlying length number= [
+                underlying dup reset-string-hashcode
+            ] [
+                >string
+            ] if
+        ] [
+            >string
+        ] if
+    ] unless ;
+
+INSTANCE: sbuf growable
diff --git a/core/sbufs/summary.txt b/core/sbufs/summary.txt
new file mode 100644 (file)
index 0000000..0e3d708
--- /dev/null
@@ -0,0 +1 @@
+Growable string buffers
diff --git a/core/sbufs/tags.txt b/core/sbufs/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/sequences/authors.txt b/core/sequences/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor
new file mode 100644 (file)
index 0000000..c553eac
--- /dev/null
@@ -0,0 +1,945 @@
+USING: arrays bit-arrays help.markup help.syntax
+sequences.private vectors strings sbufs kernel math math.vectors
+;
+IN: sequences
+
+ARTICLE: "sequences-unsafe" "Unsafe sequence operations"
+"The " { $link nth-unsafe } " and " { $link set-nth-unsafe } " sequence protocol bypasses bounds checks for increased performance."
+$nl
+"These words assume the sequence index given is within bounds; if it is not, memory corruption can occur. Great care must be exercised when using these words. First, make sure the code in question is actually a bottleneck; next, try improving the algorithm first. If all else fails, then the unsafe sequence words can be used."
+$nl
+"There is a very important invariant these word must preserve: if at some point in time, the length of a sequence was " { $snippet "n" } ", then any future lookups of elements with indices below " { $snippet "n" } " must not crash the VM, even if the sequence length is now less than " { $snippet "n" } ". For example, vectors preserve this invariant by never shrinking the underlying storage, only growing it as necessary."
+$nl
+"The justification for this is that the VM should not crash if a resizable sequence is resized during the execution of an iteration combinator."
+$nl
+"Indeed, iteration combinators are the primary use-case for these words; if the iteration index is already guarded by a loop test which ensures it is within bounds, then additional bounds checks are redundant. For example, see the implementation of " { $link each } "." ;
+
+ARTICLE: "sequence-protocol" "Sequence protocol"
+"All sequences must be instances of a mixin class:"
+{ $subsection sequence }
+{ $subsection sequence? }
+"All sequences must know their length:"
+{ $subsection length }
+"At least one of the following two generic words must have a method for accessing elements; the " { $link sequence } " mixin has default definitions which are mutually recursive:"
+{ $subsection nth }
+{ $subsection nth-unsafe }
+"At least one of the following two generic words must have a method for storing elements; the " { $link sequence } " mixin has default definitions which are mutually recursive:"
+{ $subsection set-nth }
+{ $subsection set-nth-unsafe }
+"Note that even if the sequence is immutable, at least one of the generic words must be specialized, otherwise calling them will result in an infinite recursion. There is a standard word which throws an error indicating a sequence is immutable:"
+{ $subsection immutable }
+"The following two generic words are optional, as not all sequences are resizable:"
+{ $subsection set-length }
+{ $subsection lengthen }
+"An optional generic word for creating sequences of the same class as a given sequence:"
+{ $subsection like }
+"Optional generic words for optimization purposes:"
+{ $subsection new }
+{ $subsection new-resizable }
+{ $see-also "sequences-unsafe" } ;
+
+ARTICLE: "sequences-integers" "Integer sequences and counted loops"
+"Integers support the sequence protocol in a trivial fashion; a non-negative integer presents its non-negative predecessors as elements. For example, the integer 3, when viewed as a sequence, contains the elements 0, 1, and 2. This is very useful for performing counted loops."
+$nl
+"For example, the " { $link each } " combinator, given an integer, simply calls a quotation that number of times, pushing a counter on each iteration that ranges from 0 up to that integer:"
+{ $example "3 [ . ] each" "0\n1\n2" }
+"A common idiom is to iterate over a sequence, while also maintaining a loop counter. This can be done using " { $link 2each } ":"
+{ $example "{ \"a\" \"b\" \"c\" } dup length [\n    \"Index: \" write . \"Element: \" write .\n] 2each" "Index: 0\nElement: \"a\"\nIndex: 1\nElement: \"b\"\nIndex: 2\nElement: \"c\"" }
+"Combinators that produce new sequences, such as " { $link map } ", will output an array if the input is an integer." ;
+
+ARTICLE: "sequences-access" "Accessing sequence elements"
+{ $subsection ?nth }
+"Concise way of extracting one of the first four elements:"
+{ $subsection first }
+{ $subsection second }
+{ $subsection third }
+{ $subsection fourth }
+"Unpacking sequences:"
+{ $subsection first2 }
+{ $subsection first3 }
+{ $subsection first4 }
+{ $see-also nth peek } ;
+
+ARTICLE: "sequences-add-remove" "Adding and removing sequence elements"
+"Adding elements:"
+{ $subsection add }
+{ $subsection add* }
+"Removing elements:"
+{ $subsection remove }
+{ $subsection seq-diff } ;
+
+ARTICLE: "sequences-reshape" "Reshaping sequences"
+"A " { $emphasis "repetition" } " is a virtual sequence consisting of a single element repeated multiple times:"
+{ $subsection repetition }
+{ $subsection <repetition> }
+"Reversing a sequence:"
+{ $subsection reverse }
+"A " { $emphasis "reversal" } " presents a reversed view of an underlying sequence:"
+{ $subsection reversed }
+{ $subsection <reversed> }
+"Transposing a matrix:"
+{ $subsection flip }
+"A " { $emphasis "column" } " presents a column of a matrix represented as a sequence of rows:"
+{ $subsection column }
+{ $subsection <column> } ;
+
+ARTICLE: "sequences-appending" "Appending sequences"
+{ $subsection append }
+{ $subsection 3append }
+{ $subsection concat }
+{ $subsection join }
+"A pair of words useful for aligning strings:"
+{ $subsection pad-left }
+{ $subsection pad-right } ;
+
+ARTICLE: "sequences-slices" "Subsequences and slices"
+"Extracting a subsequence:"
+{ $subsection subseq }
+{ $subsection head }
+{ $subsection tail }
+{ $subsection head* }
+{ $subsection tail* }
+"Taking a sequence apart into a head and a tail:"
+{ $subsection unclip }
+{ $subsection cut }
+{ $subsection cut* }
+"A " { $emphasis "slice" } " is a virtual sequence which presents as view of a subsequence of an underlying sequence:"
+{ $subsection slice }
+{ $subsection slice? }
+"Creating slices:"
+{ $subsection <slice> }
+{ $subsection head-slice }
+{ $subsection tail-slice }
+{ $subsection head-slice* }
+{ $subsection tail-slice* }
+"Taking a sequence apart into a head and a tail:"
+{ $subsection unclip-slice }
+{ $subsection cut-slice }
+"A utility for words which use slices as mutable iterators:"
+{ $subsection <flat-slice> } ;
+
+ARTICLE: "sequences-combinators" "Sequence combinators"
+"Iteration:"
+{ $subsection each }
+{ $subsection reduce }
+{ $subsection interleave }
+{ $subsection 2each }
+{ $subsection 2reduce }
+"Mapping:"
+{ $subsection map }
+{ $subsection accumulate }
+{ $subsection 2map }
+"Filtering:"
+{ $subsection push-if }
+{ $subsection subset } ;
+
+ARTICLE: "sequences-tests" "Testing sequences"
+"Testing for an empty sequence:"
+{ $subsection empty? }
+"Testing indices:"
+{ $subsection bounds-check? }
+"Testing if a sequence contains an object:"
+{ $subsection member? }
+{ $subsection memq? }
+"Testing if a sequence contains a subsequence:"
+{ $subsection head? }
+{ $subsection tail? }
+{ $subsection subseq? }
+"Testing if a sequence contains elements satisfying a predicate:"
+{ $subsection contains? }
+{ $subsection all? }
+{ $subsection 2all? }
+"Testing how elements are related:"
+{ $subsection monotonic? }
+{ $subsection all-eq? }
+{ $subsection all-equal? } ;
+
+ARTICLE: "sequences-search" "Searching sequences"
+"Finding the index of an element:"
+{ $subsection index }
+{ $subsection index* }
+{ $subsection last-index }
+{ $subsection last-index* }
+"Finding the start of a subsequence:"
+{ $subsection start }
+{ $subsection start* }
+"Finding the index of an element satisfying a predicate:"
+{ $subsection find }
+{ $subsection find* }
+{ $subsection find-last }
+{ $subsection find-last* } ;
+
+ARTICLE: "sequences-destructive" "Destructive operations"
+"These words modify their input, instead of creating a new sequence."
+$nl
+"In-place variant of " { $link reverse } ":"
+{ $subsection reverse-here }
+"In-place variant of " { $link append } ":"
+{ $subsection push-all }
+"In-place variant of " { $link remove } ":"
+{ $subsection delete }
+"In-place variant of " { $link map } ":"
+{ $subsection change-each }
+"Changing elements:"
+{ $subsection change-nth }
+{ $subsection cache-nth }
+"Deleting elements:"
+{ $subsection delete-nth }
+{ $subsection delete-slice }
+{ $subsection delete-all }
+"Other destructive words:"
+{ $subsection move }
+{ $subsection exchange }
+{ $subsection push-new }
+{ $subsection copy }
+{ $subsection replace-slice }
+{ $see-also set-nth push pop "sequences-stacks" } ;
+
+ARTICLE: "sequences-stacks" "Treating sequences as stacks"
+"The classical stack operations, modifying a sequence in place:"
+{ $subsection peek }
+{ $subsection push }
+{ $subsection pop }
+{ $subsection pop* }
+{ $see-also empty? } ;
+
+ARTICLE: "sequences-comparing" "Comparing sequences"
+"Element equality testing:"
+{ $subsection sequence= }
+{ $subsection mismatch }
+{ $subsection drop-prefix }
+"The " { $link <=> } " generic word performs lexicographic comparison when applied to sequences." ;
+
+ARTICLE: "sequences-f" "The f object as a sequence"
+"The " { $link f } " object supports the sequence protocol in a trivial way. It responds with a length of zero and throws an out of bounds error when an attempt is made to access elements." ;
+
+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
+"Sequences implement a protocol:"
+{ $subsection "sequence-protocol" }
+{ $subsection "sequences-f" }
+{ $subsection "sequences-integers" }
+"Sequence utility words can operate on any object whose class implements the sequence protocol. Most implementations are backed by storage. Some implementations obtain their elements from an underlying sequence, or compute them on the fly. These are known as " { $emphasis "virtual sequences" } "."
+{ $subsection "sequences-access" }
+{ $subsection "sequences-combinators" }
+{ $subsection "sequences-add-remove" }
+{ $subsection "sequences-appending" }
+{ $subsection "sequences-slices" }
+{ $subsection "sequences-reshape" }
+{ $subsection "sequences-tests" }
+{ $subsection "sequences-search" }
+{ $subsection "sequences-comparing" }
+{ $subsection "sequences-destructive" }
+{ $subsection "sequences-stacks" }
+"For inner loops:"
+{ $subsection "sequences-unsafe" } ;
+
+ABOUT: "sequences"
+
+HELP: sequence
+{ $class-description "A mixin class whose instances are sequences. Custom implementations of the sequence protocol should be declared as instances of this mixin for all sequence functionality to work correctly:"
+    { $code "INSTANCE: my-sequence sequence" }
+} ;
+
+HELP: length
+{ $values { "seq" sequence } { "n" "a non-negative integer" } }
+{ $contract "Outputs the length of the sequence. All sequences support this operation." } ;
+
+HELP: set-length
+{ $values { "n" "a non-negative integer" } { "seq" "a resizable sequence" } }
+{ $contract "Resizes the sequence. Not all sequences are resizable." }
+{ $errors "Throws a " { $link bounds-error } " if the new length is negative." }
+{ $side-effects "seq" } ;
+
+HELP: lengthen
+{ $values { "n" "a non-negative integer" } { "seq" "a resizable sequence" } }
+{ $contract "Ensures the sequence has a length of at least " { $snippet "n" } " elements. This word differs from " { $link set-length } " in two respects:"
+    { $list
+        { "This word does not shrink the sequence if " { $snippet "n" } " is less than its length." }
+        { "The word doubles the underlying storage of " { $snippet "seq" } ", whereas " { $link set-length } " is permitted to set it to equal " { $snippet "n" } ". This ensures that repeated calls to this word with constant increments of " { $snippet "n" } " do not result in a quadratic amount of copying, so that for example " { $link push-all } " can run efficiently when used in a loop." }
+    }
+} ;
+
+HELP: nth
+{ $values { "n" "a non-negative integer" } { "seq" sequence } { "elt" "the element at the " { $snippet "n" } "th index" } }
+{ $contract "Outputs the " { $snippet "n" } "th element of the sequence. Elements are numbered from zero, so the last element has an index one less than the length of the sequence. All sequences support this operation." }
+{ $errors "Throws a " { $link bounds-error } " if the index is negative, or greater than or equal to the length of the sequence." } ;
+
+HELP: set-nth
+{ $values { "elt" object } { "n" "a non-negative integer" } { "seq" "a mutable sequence" } }
+{ $contract "Sets the " { $snippet "n" } "th element of the sequence. Storing beyond the end of a resizable sequence such as a vector or string buffer grows the sequence." }
+{ $errors "Throws an error if the index is negative, or if the sequence is not resizable and the index is greater than or equal to the length of the sequence."
+$nl
+"Throws an error if the sequence cannot hold elements of the given type." }
+{ $side-effects "seq" } ;
+
+HELP: immutable
+{ $values { "seq" sequence } }
+{ $description "Throws an " { $link immutable } " error." }
+{ $error-description "Thrown if an attempt is made to modify an immutable sequence." } ;
+
+HELP: new
+{ $values { "len" "a non-negative integer" } { "seq" sequence } { "newseq" "a mutable sequence" } }
+{ $contract "Outputs a mutable sequence of length " { $snippet "n" } " which can hold the elements of " { $snippet "seq" } "." } ;
+
+HELP: new-resizable
+{ $values { "len" "a non-negative integer" } { "seq" sequence } { "newseq" "a resizable mutable sequence" } }
+{ $contract "Outputs a resizable mutable sequence with an initial capacity of " { $snippet "n" } " elements and zero length, which can hold the elements of " { $snippet "seq" } "." }
+{ $examples
+    { $example "300 V{ } new-resizable ." "V{ }" }
+    { $example "300 SBUF\" \" new-resizable ." "SBUF\" \"" }
+} ;
+
+HELP: like
+{ $values { "seq" sequence } { "exemplar" sequence } { "newseq" "a new sequence" } }
+{ $contract "Outputs a sequence with the same elements as " { $snippet "seq" } ", but " { $emphasis "like" } " the template sequence, in the sense that it either has the same class as the template sequence, or if the template sequence is a virtual sequence, the same class as the template sequence's underlying sequence."
+$nl
+"The default implementation does nothing." }
+{ $notes "Unlike " { $link clone-like } ", the output sequence might share storage with the input sequence." } ;
+
+HELP: empty?
+{ $values { "seq" sequence } { "?" "a boolean" } }
+{ $description "Tests if the sequence has zero length." } ;
+
+HELP: delete-all
+{ $values { "seq" "a resizable sequence" } }
+{ $description "Resizes the sequence to zero length, removing all elements. Not all sequences are resizable." }
+{ $errors "Throws a " { $link bounds-error } " if the new length is negative, or if the sequence is not resizable." }
+{ $side-effects "seq" } ;
+
+HELP: resize
+{ $values { "n" "a non-negative integer" } { "seq" sequence } { "newseq" "a new sequence" } }
+{ $description "Creates a new sequence of the same type as " { $snippet "seq" } " with " { $snippet "n" } " elements, and copies the contents of " { $snippet "seq" } " into the new sequence. If " { $snippet "n" } " exceeds the length of " { $snippet "seq" } ", the remaining elements are filled with a default value; " { $link f } " for arrays and 0 for strings." }
+{ $notes "This generic word is only implemented for strings and arrays." } ;
+
+HELP: first
+{ $values { "seq" sequence } { "first" "the first element of the sequence" } }
+{ $description "Outputs the first element of the sequence." }
+{ $errors "Throws an error if the sequence is empty." } ;
+
+HELP: second
+{ $values { "seq" sequence } { "second" "the second element of the sequence" } }
+{ $description "Outputs the second element of the sequence." }
+{ $errors "Throws an error if the sequence contains less than two elements." } ;
+
+HELP: third
+{ $values { "seq" sequence } { "third" "the third element of the sequence" } }
+{ $description "Outputs the third element of the sequence." }
+{ $errors "Throws an error if the sequence contains less than three elements." } ;
+
+HELP: fourth
+{ $values { "seq" sequence } { "fourth" "the fourth element of the sequence" } }
+{ $description "Outputs the fourth element of the sequence." }
+{ $errors "Throws an error if the sequence contains less than four elements." } ;
+
+HELP: push
+{ $values { "elt" object } { "seq" "a resizable mutable sequence" } }
+{ $description "Adds an element at the end of the sequence. The sequence length is adjusted accordingly." }
+{ $errors "Throws an error if " { $snippet "seq" } " is not resizable, or if the type of " { $snippet "elt" } " is not permitted in " { $snippet "seq" } "." }
+{ $side-effects "seq" } ;
+
+HELP: bounds-check?
+{ $values { "n" "an integer" } { "seq" sequence } { "?" "a boolean" } }
+{ $description "Tests if the index is within the bounds of the sequence." } ;
+
+HELP: bounds-error
+{ $values { "n" "a positive integer" } { "seq" sequence } }
+{ $description "Throws a " { $link bounds-error } "." }
+{ $error-description "Thrown by " { $link nth } ", " { $link set-nth } " and " { $link set-length } " if the given index lies beyond the bounds of the sequence." } ;
+
+HELP: bounds-check
+{ $values { "n" "a positive integer" } { "seq" sequence } }
+{ $description "Throws an error if " { $snippet "n" } " is negative or if it is greater than or equal to the length of " { $snippet "seq" } ". Otherwise the two inputs remain on the stack." } ;
+
+HELP: ?nth
+{ $values { "n" "an integer" } { "seq" sequence } { "elt/f" "an object or " { $link f } } }
+{ $description "A forgiving version of " { $link nth } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } "." } ;
+
+HELP: nth-unsafe
+{ $values { "n" "an integer" } { "seq" sequence } { "elt" object } }
+{ $contract "Unsafe variant of " { $link nth } " that does not perform bounds checks." } ;
+
+HELP: set-nth-unsafe
+{ $values { "elt" object } { "n" "an integer" } { "seq" sequence } }
+{ $contract "Unsafe variant of " { $link set-nth } " that does not perform bounds checks." } ;
+
+HELP: exchange-unsafe
+{ $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "seq" "a mutable sequence" } }
+{ $description "Unsafe variant of " { $link exchange } " that does not perform bounds checks." } ;
+
+HELP: first2-unsafe
+{ $values { "seq" sequence } { "first" "the first element" } { "second" "the second element" } }
+{ $contract "Unsafe variant of " { $link first2 } " that does not perform bounds checks." } ;
+
+HELP: first3-unsafe
+{ $values { "seq" sequence } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } }
+{ $contract "Unsafe variant of " { $link first3 } " that does not perform bounds checks." } ;
+
+HELP: first4-unsafe
+{ $values { "seq" sequence } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } { "fourth" "the fourth element" } }
+{ $contract "Unsafe variant of " { $link first4 } " that does not perform bounds checks." } ;
+
+HELP: 2sequence
+{ $values { "obj1" object } { "obj2" object } { "exemplar" sequence } { "seq" sequence } }
+{ $description "Creates a two-element sequence of the same type as " { $snippet "exemplar" } "." } ;
+
+HELP: 3sequence
+{ $values { "obj1" object } { "obj2" object } { "obj3" object } { "exemplar" sequence } { "seq" sequence } }
+{ $description "Creates a three-element sequence of the same type as " { $snippet "exemplar" } "." } ;
+
+HELP: 4sequence
+{ $values { "obj1" object } { "obj2" object } { "exemplar" sequence } { "obj3" object } { "obj4" object } { "seq" sequence } }
+{ $description "Creates a four-element sequence of the same type as " { $snippet "exemplar" } "." } ;
+
+HELP: first2
+{ $values { "seq" sequence } { "first" "the first element" } { "second" "the second element" } }
+{ $description "Pushes the first two elements of a sequence." }
+{ $errors "Throws an error if the sequence has less than two elements." } ;
+
+HELP: first3
+{ $values { "seq" sequence } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } }
+{ $description "Pushes the first three elements of a sequence." }
+{ $errors "Throws an error if the sequence has less than three elements." } ;
+
+HELP: first4
+{ $values { "seq" sequence } { "first" "the first element" } { "second" "the second element" } { "third" "the third element" } { "fourth" "the fourth element" } }
+{ $description "Pushes the first four elements of a sequence." }
+{ $errors "Throws an error if the sequence has less than four elements." } ;
+
+HELP: array-capacity
+{ $values { "array" "an array" } { "n" "a non-negative fixnum" } }
+{ $description "Low-level array length accessor." }
+{ $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it is unsafe. It does not check types, so improper use can corrupt memory." } ;
+
+HELP: array-nth
+{ $values { "n" "a non-negative fixnum" } { "array" "an array" }  { "elt" object } }
+{ $description "Low-level array element accessor." }
+{ $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." } ;
+
+HELP: set-array-nth
+{ $values { "elt" object } { "n" "a non-negative fixnum" } { "array" "an array" }  }
+{ $description "Low-level array element mutator." }
+{ $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." } ;
+
+HELP: collect
+{ $values { "n" "a non-negative integer" } { "quot" "a quotation with stack effect " { $snippet "( 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" "a quotation with stack effect " { $snippet "( elt -- )" } } }
+{ $description "Applies the quotation to each element of the sequence in turn." } ;
+
+HELP: reduce
+{ $values { "seq" sequence } { "identity" object } { "quot" "a quotation with stack effect " { $snippet "( 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 "{ 1 5 3 } 0 [ + ] reduce ." "9" }
+} ;
+
+HELP: accumulate
+{ $values { "identity" object } { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( prev elt -- next )" } } { "final" "the final result" } { "newseq" "a new sequence" } }
+{ $description "Combines successive elements of the sequence using a binary operation, and outputs a sequence of intermediate results together with 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. Given the empty sequence, outputs a one-element sequence consisting of " { $snippet "identity" } "." }
+{ $examples
+    { $example "{ 2 2 2 2 2 } 0 [ + ] accumulate . ." "{ 0 2 4 6 8 }\n10" }
+} ;
+
+HELP: map
+{ $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( old -- new )" } } { "newseq" "a new sequence" } }
+{ $description "Applies the quotation to each element yielding a new element. The new elements are collected into a sequence of the same class as the input sequence." } ;
+
+HELP: change-nth
+{ $values { "i" "a non-negative integer" } { "seq" "a mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( 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: change-each
+{ $values { "seq" "a mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( old -- new )" } } }
+{ $description "Applies the quotation to each element yielding a new element, storing the new elements back in 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" } ;
+
+HELP: min-length
+{ $values { "seq1" sequence } { "seq2" sequence } { "n" "a non-negative integer" } }
+{ $description "Outputs the minimum of the lengths of the two sequences." } ;
+
+HELP: max-length
+{ $values { "seq1" sequence } { "seq2" sequence } { "n" "a non-negative integer" } }
+{ $description "Outputs the maximum of the lengths of the two sequences." } ;
+
+HELP: 2each
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt1 elt2 -- )" } } }
+{ $description "Applies the quotation to pairs of elements from " { $snippet "seq1" } " and " { $snippet "seq2" } "." }
+{ $notes "If one sequence is shorter than the other, than only the prefix having the length of the minimum of the two is examined." } ;
+
+HELP: 2reduce
+{ $values { "seq1" sequence }
+          { "seq2" sequence }
+          { "identity" object }
+          { "quot" "a quotation with stack effect "
+                   { $snippet "( 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" } "." }
+{ $examples "The " { $link v. } " word provides a particularly elegant implementation of the dot product." }
+{ $notes "If one sequence is shorter than the other, then only the prefix having the length of the minimum of the two is examined." } ;
+
+HELP: 2map
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt1 elt2 -- new )" } } { "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" } "." }
+{ $notes "If one sequence is shorter than the other, than only the prefix having the length of the minimum of the two is examined." }
+{ $see-also v+ v- v* v/ } ;
+
+HELP: 2all?
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt1 elt2 -- ? )" } } { "?" "a boolean" } }
+{ $description "Tests the predicate pairwise against elements of " { $snippet "seq1" } " and " { $snippet "seq2" } "." }
+{ $notes "If one sequence is shorter than the other, than only the prefix having the length of the minimum of the two is examined." } ;
+
+HELP: find
+{ $values { "seq" sequence }
+          { "quot" "a quotation with stack effect "
+                   { $snippet "( 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* } " where the starting index is 0." } ;
+
+HELP: find*
+{ $values { "n" "a starting index" }
+          { "seq" sequence }
+          { "quot" "a quotation with stack effect "
+                   { $snippet "( 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 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" "a quotation with stack effect " { $snippet "( 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* } " where the starting index is one less than the length of the sequence." } ;
+
+HELP: find-last*
+{ $values { "n" "a starting index" } { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( 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: contains?
+{ $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( 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" "a quotation with stack effect " { $snippet "( 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 } "." }
+{ $notes
+    "The implementation makes use of a well-known logical identity:" 
+    $nl
+    { $snippet "P[x] for all x <==> not ((not P[x]) for some x)" }
+} ;
+
+HELP: push-if
+{ $values { "elt" object } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "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 subset } "." } ;
+
+HELP: subset
+{ $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( 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: monotonic?
+{ $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt elt -- ? )" } } { "?" "a boolean" } }
+{ $description "Applies the relation to successive pairs of elements in the sequence, testing for a truth value. The relation should be a transitive relation, such as a total order or an equality relation." }
+{ $examples
+    "Testing if a sequence is non-decreasing:"
+    { $example "{ 1 1 2 } [ <= ] monotonic? ." "t" }
+    "Testing if a sequence is decreasing:"
+    { $example "{ 9 8 6 7 } [ < ] monotonic? ." "f" }
+} ;
+
+{ monotonic? all-eq? all-equal? } related-words
+
+HELP: interleave
+{ $values { "seq" sequence } { "between" "a quotation" } { "quot" "a quotation with stack effect " { $snippet "( elt -- )" } } }
+{ $description "Applies " { $snippet "quot" } " to each element in turn, also invoking " { $snippet "between" } " in-between each pair of elements." }
+{ $example "{ \"a\" \"b\" \"c\" } [ \"X\" write ] [ write ] interleave" "aXbXc" } ;
+
+HELP: cache-nth
+{ $values { "i" "a non-negative integer" } { "seq" "a mutable sequence" } { "quot" "a quotation with stack effect " { $snippet "( i -- elt )" } } { "elt" object } }
+{ $description "If the sequence does not contain at least " { $snippet "i" } " elements or if the " { $snippet "i" } "th element of the sequence is " { $link f } ", calls the quotation to produce a new value, and stores it back into the sequence. Otherwise, this word outputs the " { $snippet "i" } "th element of the sequence." }
+{ $side-effects "seq" } ;
+
+HELP: index
+{ $values { "obj" object } { "seq" sequence } { "n" "an index" } }
+{ $description "Outputs the index of the first element in the sequence equal to " { $snippet "obj" } ". If no element is found, outputs " { $link f } "." } ;
+
+{ index index* last-index last-index* member? memq? } related-words
+
+HELP: index*
+{ $values { "obj" object } { "i" "a start index" } { "seq" sequence } { "n" "an index" } }
+{ $description "Outputs the index of the first element in the sequence equal to " { $snippet "obj" } ", starting the search from the " { $snippet "i" } "th element. If no element is found, outputs " { $link f } "." } ;
+
+HELP: last-index
+{ $values { "obj" object } { "seq" sequence } { "n" "an index" } }
+{ $description "Outputs the index of the last element in the sequence equal to " { $snippet "obj" } "; the sequence is traversed back to front. If no element is found, outputs " { $link f } "." } ;
+
+HELP: last-index*
+{ $values { "obj" object } { "i" "a start index" } { "seq" sequence } { "n" "an index" } }
+{ $description "Outputs the index of the last element in the sequence equal to " { $snippet "obj" } ", traversing the sequence backwards starting from the " { $snippet "i" } "th element and finishing at the first. If no element is found, outputs " { $link f } "." } ;
+
+HELP: member?
+{ $values { "obj" object } { "seq" sequence } { "?" "a boolean" } }
+{ $description "Tests if the sequence contains an element equal to the object." } ;
+
+HELP: memq?
+{ $values { "obj" object } { "seq" sequence } { "?" "a boolean" } }
+{ $description "Tests if the sequence contains the object." }
+{ $examples
+    "This word uses identity comparison, so the following will most likely print " { $link f } ":"
+    { $example "\"hello\" { \"hello\" } memq? ." "f" }
+} ;
+
+HELP: remove
+{ $values { "obj" object } { "seq" sequence } { "newseq" "a new sequence" } }
+{ $description "Outputs a new sequence containing all elements of the input sequence except those equal to the given element." } ;
+
+HELP: move
+{ $values { "from" "an index in " { $snippet "seq" } } { "to" "an index in " { $snippet "seq" } } { "seq" "a mutable sequence" } }
+{ $description "Sets the element with index " { $snippet "m" } " to the element with index " { $snippet "n" } "." }
+{ $side-effects "seq" } ;
+
+HELP: delete
+{ $values { "elt" object } { "seq" "a resizable mutable sequence" } }
+{ $description "Removes all elements equal to " { $snippet "elt" } " from " { $snippet "seq" } "." }
+{ $side-effects "seq" } ;
+
+HELP: delete-nth
+{ $values { "n" "a non-negative integer" } { "seq" "a resizable mutable sequence" } }
+{ $description "Removes the " { $snippet "n" } "th element from the sequence, shifting all other elements down and reducing its length by one." }
+{ $side-effects "seq" } ;
+
+HELP: delete-slice
+{ $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "seq" "a resizable mutable sequence" } }
+{ $description "Removes a range of elements beginning at index " { $snippet "from" } " and ending before index " { $snippet "to" } "." }
+{ $side-effects "seq" } ;
+
+HELP: replace-slice
+{ $values { "new" sequence } { "seq" "a mutable sequence" } { "from" "a non-negative integer" } { "to" "a non-negative integer" } }
+{ $description "Replaces a range of elements beginning at index " { $snippet "from" } " and ending before index " { $snippet "to" } " with a new sequence." }
+{ $notes "If the " { $snippet "to - from" } " is equal to the length of " { $snippet "new" } ", the sequence remains the same size, and does not have to support resizing. However, if " { $snippet "to - from" } " is not equal to the length of " { $snippet "new" } ", the " { $link set-length } " word is called on " { $snippet "seq" } ", so fixed-size sequences should not be passed in this case." }
+{ $errors "Throws an error if " { $snippet "new" } " contains elements whose types are not permissible in " { $snippet "seq" } "." }
+{ $side-effects "seq" } ;
+
+HELP: push-new
+{ $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." }
+{ $examples
+    { $example
+        "V{ \"beans\" \"salsa\" \"cheese\" } \"v\" set"
+        "\"nachos\" \"v\" get push-new"
+        "\"salsa\" \"v\" get push-new"
+        "\"v\" get ."
+        "V{ \"beans\" \"cheese\" \"nachos\" \"salsa\" }"
+    }
+}
+{ $side-effects "seq" } ;
+
+{ push push-new add add* } related-words
+
+HELP: add
+{ $values { "seq" sequence } { "elt" object } { "newseq" sequence } }
+{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the end of " { $snippet "seq" } "." }
+{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." }
+{ $examples
+    { $example "{ 1 2 3 } 4 add ." "{ 1 2 3 4 }" }
+} ;
+
+HELP: add*
+{ $values { "seq" sequence } { "elt" object } { "newseq" sequence } }
+{ $description "Outputs a new sequence obtained by adding " { $snippet "elt" } " at the beginning of " { $snippet "seq" } "." }
+{ $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq1" } "." } 
+{ $examples
+    { $example "{ 1 2 3 } 0 add* ." "{ 0 1 2 3 }" }
+} ;
+
+HELP: seq-diff
+{ $values { "seq1" sequence } { "seq2" sequence } { "newseq" sequence } }
+{ $description "Outputs a sequence consisting of elements present in " { $snippet "seq2" } " but not " { $snippet "seq1" } ", comparing elements for equality." } ;
+
+HELP: sum-lengths
+{ $values { "seq" "a sequence of sequences" } { "n" integer } }
+{ $description "Outputs the sum of the lengths of all sequences in " { $snippet "seq" } "." } ;
+
+HELP: concat
+{ $values { "seq" sequence } { "newseq" sequence } }
+{ $description "Concatenates a sequence of sequences together into one sequence. If " { $snippet "seq" } " is empty, outputs " { $snippet "{ }" } ", otherwise the resulting sequence is of the same class as the first element of " { $snippet "seq" } "." }
+{ $errors "Throws an error if one of the sequences in " { $snippet "seq" } " contains elements not permitted in sequences of the same class as the first element of " { $snippet "seq" } "." } ;
+
+HELP: join
+{ $values { "seq" sequence } { "glue" sequence } { "newseq" sequence } }
+{ $description "Concatenates a sequence of sequences together into one sequence, placing a copy of " { $snippet "glue" } " between each pair of sequences. The resulting sequence is of the same class as " { $snippet "glue" } "." }
+{ $errors "Throws an error if one of the sequences in " { $snippet "seq" } " contains elements not permitted in sequences of the same class as " { $snippet "glue" } "." } ;
+
+{ join concat } related-words
+
+HELP: peek
+{ $values { "seq" sequence } { "elt" object } }
+{ $description "Outputs the last element of a sequence." }
+{ $errors "Throws an error if the sequence is empty." } ;
+
+{ peek pop pop* } related-words
+
+HELP: pop*
+{ $values { "seq" "a resizable mutable sequence" } }
+{ $description "Removes the last element and shortens the sequence." }
+{ $side-effects "seq" }
+{ $errors "Throws an error if the sequence is empty." } ;
+
+HELP: pop
+{ $values { "seq" "a resizable mutable sequence" } { "elt" object } }
+{ $description "Outputs the last element after removing it and shortening the sequence." }
+{ $side-effects "seq" }
+{ $errors "Throws an error if the sequence is empty." } ;
+
+HELP: all-equal?
+{ $values { "seq" sequence } { "?" "a boolean" } }
+{ $description "Tests if all elements in the sequence are equal. Yields true with an empty sequence." } ;
+
+HELP: all-eq?
+{ $values { "seq" sequence } { "?" "a boolean" } }
+{ $description "Tests if all elements in the sequence are the same identical object. Yields true with an empty sequence." } ;
+
+HELP: mismatch
+{ $values { "seq1" sequence } { "seq2" sequence } { "i" "an index" } }
+{ $description "Compares pairs of elements up to the minimum of the sequences' lengths, outputting the first index where the two sequences have non-equal elements, or " { $link f } " if all tested elements were equal." } ;
+
+HELP: flip
+{ $values { "matrix" "a sequence of equal-length sequences" } { "newmatrix" "a sequence of equal-length sequences" } }
+{ $description "Transposes the matrix; that is, rows become columns and columns become rows." }
+{ $examples { $example "{ { 1 2 3 } { 4 5 6 } } flip ." "{ { 1 4 } { 2 5 } { 3 6 } }" } } ;
+
+HELP: exchange
+{ $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "seq" "a mutable sequence" } }
+{ $description "Exchanges the " { $snippet "m" } "th and " { $snippet "n" } "th elements of " { $snippet "seq" } "." } ;
+
+HELP: reverse-here
+{ $values { "seq" "a mutable sequence" } }
+{ $description "Reverses a sequence in-place." }
+{ $side-effects "seq" } ;
+
+HELP: padding
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "elt" object } { "quot" "a quotation with stack effect " { $snippet "( 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-left
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "elt" object } { "padded" "a new sequence" } }
+{ $description "Outputs a new sequence consisting of " { $snippet "seq" } " padded on the left with enough repetitions of " { $snippet "elt" } " to have the result be of length " { $snippet "n" } "." }
+{ $examples { $example "{ \"ab\" \"quux\" } [ 5 CHAR: - pad-left print ] each" "---ab\n-quux" } } ;
+
+HELP: pad-right
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "elt" object } { "padded" "a new sequence" } }
+{ $description "Outputs a new sequence consisting of " { $snippet "seq" } " padded on the right with enough repetitions of " { $snippet "elt" } " to have the result be of length " { $snippet "n" } "." }
+{ $examples { $example "{ \"ab\" \"quux\" } [ 5 CHAR: - pad-right print ] each" "ab---\nquux-" } } ;
+
+HELP: sequence=
+{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } }
+{ $description "Tests if the two sequences have the same length and elements. This is weaker than " { $link = } ", since it does not ensure that the sequences are instances of the same class." } ;
+
+HELP: reversed
+{ $class-description "A virtual sequence which presents a reversed view of an underlying sequence. New instances can be created by calling " { $link <reversed> } "." } ;
+
+HELP: reverse
+{ $values { "seq" sequence } { "newseq" "a new sequence" } }
+{ $description "Outputs a new sequence having the same elements as " { $snippet "seq" } " but in reverse order." } ;
+
+{ reverse <reversed> } related-words
+
+HELP: <reversed> ( seq -- reversed )
+{ $values { "seq" sequence } { "reversed" "a new sequence" } }
+{ $description "Creates an instance of the " { $link reversed } " virtual sequence." } ;
+
+HELP: slice-error
+{ $values { "str" "a reason" } }
+{ $description "Throws a " { $link slice-error } "." }
+{ $error-description "Thrown by " { $link <slice> } " if one of the following invalid conditions holds:"
+    { $list
+        "The start index is negative"
+        "The end index is greater than the length of the sequence"
+        "The start index is greater than the end index"
+    }
+} ;
+
+HELP: slice
+{ $class-description "A virtual sequence which presents a subrange of the elements of an underlying sequence. New instances can be created by calling " { $link <slice> } ". Slices are mutable if the underlying sequence is mutable, and mutating a slice changes the underlying sequence." }
+{ $notes "The slots of a slice should not be changed after the slice has been created, because this can break invariants." } ;
+
+HELP: check-slice
+{ $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "seq" sequence } }
+{ $description "Ensures that " { $snippet "m" } " is less than or equal to " { $snippet "m" } ", and that both indices are within bounds for " { $snippet "seq" } "." }
+{ $errors "Throws a " { $link slice-error } " if the preconditions are not met." } ;
+
+HELP: collapse-slice
+{ $values { "m" "a non-negative integer" } { "n" "a non-negative integer" } { "slice" slice } { "m'" "a non-negative integer" } { "n'" "a non-negative integer" } { "seq" sequence } }
+{ $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 " { $link slice-from } " equal to 0 and " { $link slice-to } " equal to the length of " { $snippet "seq" } "." }
+{ $notes "Some words create slices then proceed to read and write the " { $link slice-from } " and " { $link slice-to } " 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" "a 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 " { $link slice-from } " and " { $link slice-to } " being equal to the inputs to this word. The " { $link <flat-slice> } " word might be helpful in such situations." } ;
+
+{ <slice> subseq } related-words
+
+HELP: column
+{ $class-description "A virtual sequence which presents a fixed column of a matrix represented as a sequence of rows. New instances can be created by calling " { $link <column> } "." } ;
+
+HELP: <column> ( seq n -- column )
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "column" column } }
+{ $description "Outputs a new virtual sequence which presents a fixed column of a matrix represented as a sequence of rows." "The " { $snippet "i" } "th element of a column is the " { $snippet "n" } "th element of the " { $snippet "i" } "th element of" { $snippet "seq" } ". Every element of " { $snippet "seq" } " must be a sequence, and all sequences must have equal length." }
+{ $examples
+    { $example
+        "{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } 0 <column> >array ."
+        "{ 1 4 7 }"
+    }
+}
+{ $notes
+    "In the same sense that " { $link <reversed> } " is a virtual variant of " { $link reverse } ", " { $link <column> } " is a virtual variant of " { $snippet "swap [ nth ] curry map" } "."
+} ;
+
+HELP: repetition
+{ $class-description "A virtual sequence consisting of " { $link repetition-elt } " repeated " { $link repetition-len } " times. Repetitions are created by calling " { $link <repetition> } "." } ;
+
+HELP: <repetition> ( len elt -- repetition )
+{ $values { "len" "a non-negative integer" } { "elt" object } { "repetition" repetition } }
+{ $description "Creates a new " { $link repetition } "." }
+{ $examples
+    { $example "10 \"X\" <repetition> >array ." "{ \"X\" \"X\" \"X\" \"X\" \"X\" \"X\" \"X\" \"X\" \"X\" \"X\" }" }
+    { $example "10 \"X\" <repetition> >array concat ." "\"XXXXXXXXXX\"" }
+} ;
+HELP: copy
+{ $values { "src" sequence } { "i" "an index in " { $snippet "dest" } } { "dst" "a mutable sequence" } }
+{ $description "Copies all elements of " { $snippet "src" } " to " { $snippet "dest" } ", with destination indices starting from " { $snippet "i" } ". Grows " { $snippet "to" } " first if necessary." }
+{ $side-effects "dest" }
+{ $errors "An error is thrown if " { $snippet "to" } " is not resizable, and not large enough to hold the copied elements." } ;
+
+HELP: push-all
+{ $values { "src" sequence } { "dest" "a resizable mutable sequence" } }
+{ $description "Appends " { $snippet "src" } " to the end of " { $snippet "dest" } "." }
+{ $side-effects "dest" }
+{ $errors "Throws an error if " { $snippet "src" } " contains elements not permitted in " { $snippet "dest" } "." } ;
+
+HELP: append
+{ $values { "seq1" sequence } { "seq2" sequence } { "newseq" sequence } }
+{ $description "Outputs a new sequence of the same type as " { $snippet "seq1" } " consisting of the elements of " { $snippet "seq1" } " followed by " { $snippet "seq2" } "." }
+{ $errors "Throws an error if " { $snippet "seq2" } " contains elements not permitted in sequences of the same class as " { $snippet "seq1" } "." } ;
+
+HELP: 3append
+{ $values { "seq1" sequence } { "seq2" sequence } { "seq3" sequence } { "newseq" sequence } }
+{ $description "Outputs a new sequence consisting of the elements of " { $snippet "seq1" } ", " { $snippet "seq2" } " and " { $snippet "seq3" } " in turn." }
+{ $errors "Throws an error if " { $snippet "seq2" } " or " { $snippet "seq3" } " contain elements not permitted in sequences of the same class as " { $snippet "seq1" } "." } ;
+
+HELP: subseq
+{ $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "seq" sequence } { "subseq" "a new sequence" } }
+{ $description "Outputs a new sequence consisting of all elements 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." } ;
+
+HELP: clone-like
+{ $values { "seq" sequence } { "exemplar" sequence } { "newseq" "a new sequence" } }
+{ $description "Outputs a newly-allocated sequence with the same elements as " { $snippet "seq" } " but of the same type as " { $snippet "exemplar" } "." }
+{ $notes "Unlike " { $link like } ", this word always creates a new sequence which never shares storage with the original." } ;
+
+HELP: head-slice
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "slice" "a slice" } }
+{ $description "Outputs a virtual sequence sharing storage with the first " { $snippet "n" } " elements of the input sequence." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: tail-slice
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "slice" "a slice" } }
+{ $description "Outputs a virtual sequence sharing storage with all elements from the " { $snippet "n" } "th index until the end of the input sequence." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: head-slice*
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "slice" "a slice" } }
+{ $description "Outputs a virtual sequence sharing storage with all elements of " { $snippet "seq" } " until the " { $snippet "n" } "th element from the end. In other words, it outputs a sequence of the first " { $snippet "l-n" } " elements of the input sequence, where " { $snippet "l" } " is its length." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: tail-slice*
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "slice" "a slice" } }
+{ $description "Outputs a virtual sequence sharing storage with the last " { $snippet "n" } " elements of the input sequence." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: head
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "headseq" "a new sequence" } }
+{ $description "Outputs a new sequence consisting of the first " { $snippet "n" } " elements of the input sequence." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: tail
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "tailseq" "a new sequence" } }
+{ $description "Outputs a new sequence consisting of the input sequence with the first n items removed." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: head*
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "headseq" "a new sequence" } }
+{ $description "Outputs a new sequence consisting of all elements of " { $snippet "seq" } " until the " { $snippet "n" } "th element from the end. In other words, it outputs a sequence of the first " { $snippet "l-n" } " elements of the input sequence, where " { $snippet "l" } " is its length." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: tail*
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "tailseq" "a new sequence" } }
+{ $description "Outputs a new sequence consisting of the last " { $snippet "n" } " elements of the input sequence." }
+{ $errors "Throws an error if the index is out of bounds." } ;
+
+HELP: shorter?
+{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } }
+{ $description "Tets if the length of " { $snippet "seq1" } " is smaller than the length of " { $snippet "seq2" } "." } ;
+
+HELP: head?
+{ $values { "seq" sequence } { "begin" sequence } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If " { $snippet "begin" } " is longer than " { $snippet "seq" } ", this word outputs " { $link f } "." } ;
+
+HELP: tail?
+{ $values { "seq" sequence } { "end" sequence } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "seq" } " ends with " { $snippet "end" } ". If " { $snippet "end" } " is longer than " { $snippet "seq" } ", this word outputs " { $link f } "." } ;
+
+{ delete-nth remove delete } related-words
+
+HELP: cut-slice
+{ $values { "n" "a non-negative integer" } { "seq" sequence } { "before" sequence } { "after" "a slice" } }
+{ $description "Outputs a pair of sequences, where " { $snippet "before" } " consists of the first " { $snippet "n" } " elements of " { $snippet "seq" } " and has the same type, while " { $snippet "after" } " is a slice of the remaining elements." }
+{ $notes "Unlike " { $link cut } ", the run time of this word is proportional to the length of " { $snippet "before" } ", not " { $snippet "after" } ", so it is suitable for use in an iterative algorithm which cuts successive pieces off a sequence." } ;
+
+HELP: cut
+{ $values { "n" "a non-negative integer" } { "seq" sequence } { "before" sequence } { "after" sequence } }
+{ $description "Outputs a pair of sequences, where " { $snippet "before" } " consists of the first " { $snippet "n" } " elements of " { $snippet "seq" } ", while " { $snippet "after" } " holds the remaining elements. Both output sequences have the same type as " { $snippet "seq" } "." }
+{ $notes "Since this word copies the entire tail of the sequence, it should not be used in a loop. If this is important, consider using " { $link cut-slice } " instead, since it returns a slice for the tail instead of copying." } ;
+
+HELP: cut*
+{ $values { "n" "a non-negative integer" } { "seq" sequence } { "before" sequence } { "after" sequence } }
+{ $description "Outputs a pair of sequences, where " { $snippet "after" } " consists of the last " { $snippet "n" } " elements of " { $snippet "seq" } ", while " { $snippet "before" } " holds the remaining elements. Both output sequences have the same type as " { $snippet "seq" } "." } ;
+
+HELP: start*
+{ $values { "subseq" sequence } { "seq" sequence } { "n" "a start index" } { "i" "a start index" } }
+{ $description "Outputs the start index of the first contiguous subsequence equal to " { $snippet "subseq" } ", starting the search from the " { $snippet "n" } "th element. If no matching subsequence is found, outputs " { $link f } "." } ;
+
+HELP: start
+{ $values { "subseq" sequence } { "seq" sequence } { "i" "a start index" } }
+{ $description "Outputs the start index of the first contiguous subsequence equal to " { $snippet "subseq" } ", or " { $link f } " if no matching subsequence is found." } ;
+
+HELP: subseq?
+{ $values { "subseq" sequence } { "seq" sequence } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "seq" } " contains the elements of " { $snippet "subseq" } " as a contiguous subsequence." } ;
+
+HELP: drop-prefix
+{ $values { "seq1" sequence } { "seq2" sequence } { "slice1" "a slice" } { "slice2" "a slice" } }
+{ $description "Outputs a pair of virtual sequences with the common prefix of " { $snippet "seq1" } " and " { $snippet "seq2" } " removed." } ;
+
+HELP: unclip
+{ $values { "seq" sequence } { "rest" sequence } { "first" object } }
+{ $description "Outputs a tail sequence and the first element of " { $snippet "seq" } "; the tail sequence consists of all elements of " { $snippet "seq" } " but the first." }
+{ $examples
+    { $example "{ 1 2 3 } unclip add ." "{ 2 3 1 }" }
+} ;
+
+HELP: unclip-slice
+{ $values { "seq" sequence } { "rest" slice } { "first" object } }
+{ $description "Outputs a tail sequence and the first element of " { $snippet "seq" } "; the tail sequence consists of all elements of " { $snippet "seq" } " but the first. Unlike " { $link unclip } ", this word does not make a copy of the input sequence, and runs in constant time." } ;
diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor
new file mode 100644 (file)
index 0000000..c8c1c02
--- /dev/null
@@ -0,0 +1,244 @@
+USING: arrays kernel math namespaces sequences kernel.private
+sequences.private strings sbufs tools.test vectors bit-arrays
+generic ;
+IN: temporary
+
+[ V{ 1 2 3 4 } ] [ 1 5 dup <slice> >vector ] unit-test
+[ 3 ] [ 1 4 dup <slice> length ] unit-test
+[ 2 ] [ 1 3 { 1 2 3 4 } <slice> length ] unit-test
+[ V{ 2 3 } ] [ 1 3 { 1 2 3 4 } <slice> >vector ] unit-test
+[ V{ 4 5 } ] [ { 1 2 3 4 5 } 2 tail-slice* >vector ] unit-test
+[ V{ 3 4 } ] [ 2 4 1 10 dup <slice> subseq >vector ] unit-test
+[ V{ 3 4 } ] [ 0 2 2 4 1 10 dup <slice> <slice> subseq >vector ] unit-test
+[ "cba" ] [ "abcdef" 3 head-slice reverse ] unit-test
+
+[ 5040 ] [ [ 1 2 3 4 5 6 7 ] 1 [ * ] reduce ] unit-test
+
+[ 5040 [ 1 1 2 6 24 120 720 ] ]
+[ [ 1 2 3 4 5 6 7 ] 1 [ * ] accumulate ] unit-test
+
+[ f f ] [ [ ] [ ] find ] unit-test
+[ 0 1 ] [ [ 1 ] [ ] find ] unit-test
+[ 1 "world" ] [ [ "hello" "world" ] [ "world" = ] find ] unit-test
+[ 2 3 ] [ [ 1 2 3 ] [ 2 > ] find ] unit-test
+[ f f ] [ [ 1 2 3 ] [ 10 > ] find ] unit-test
+
+[ 1 CHAR: e ]
+[ "hello world" "aeiou" [ member? ] curry find ] unit-test
+
+[ 4 CHAR: o ]
+[ 3 "hello world" "aeiou" [ member? ] curry find* ] unit-test
+
+[ f         ] [ 3 [ ]     member? ] unit-test
+[ f         ] [ 3 [ 1 2 ] member? ] unit-test
+[ t ] [ 1 [ 1 2 ] member? ] unit-test
+[ t ] [ 2 [ 1 2 ] member? ] unit-test
+
+[ t ]
+[ [ "hello" "world" ] [ second ] keep memq? ] unit-test
+
+[ 4 ] [ CHAR: x "tuvwxyz" >vector index ] unit-test 
+
+[ f ] [ CHAR: x 5 "tuvwxyz" >vector index* ] unit-test 
+
+[ f ] [ CHAR: a 0 "tuvwxyz" >vector index* ] unit-test
+
+[ f ] [ [ "Hello" { } 4/3 ] [ string? ] all? ] unit-test
+[ t ] [ [ ] [ ] all? ] unit-test
+[ t ] [ [ "hi" t 1/2 ] [ ] all? ] unit-test
+
+[ [ 1 2 3 ] ] [ [ 1 4 2 5 3 6 ] [ 4 < ] subset ] unit-test
+[ { 4 2 6 } ] [ { 1 4 2 5 3 6 } [ 2 mod 0 = ] subset ] unit-test
+
+[ [ 3 ] ] [ [ 1 2 3 ] 2 [ swap < ] curry subset ] unit-test
+
+[ "hello world how are you" ]
+[ { "hello" "world" "how" "are" "you" } " " join ]
+unit-test
+
+[ "" ] [ { } "" join ] unit-test
+
+[ { } ] [ { } flip ] unit-test
+
+[ { "b" "e" } ] [ 1 { { "a" "b" "c" } { "d" "e" "f" } } flip nth ] unit-test
+
+[ { { 1 4 } { 2 5 } { 3 6 } } ]
+[ { { 1 2 3 } { 4 5 6 } } flip ] unit-test
+
+[ f ] [ [ { } { } "Hello" ] all-equal? ] unit-test
+[ f ] [ [ { 2 } { } { } ] all-equal? ] unit-test
+[ t ] [ [ ] all-equal? ] unit-test
+[ t ] [ [ 1/2 ] all-equal? ] unit-test
+[ t ] [ [ 1.0 10/10 1 ] all-equal? ] unit-test
+[ t ] [ { 1 2 3 4 } [ < ] monotonic? ] unit-test
+[ f ] [ { 1 2 3 4 } [ > ] monotonic? ] unit-test
+[ [ 2 3 4 ] ] [ [ 1 2 3 ] 1 [ + ] curry map ] unit-test
+
+[ 1 ] [ 0 [ 1 2 ] nth ] unit-test
+[ 2 ] [ 1 [ 1 2 ] nth ] unit-test
+
+[ [ ]           ] [ [ ]   [ ]       append ] unit-test
+[ [ 1 ]         ] [ [ 1 ] [ ]       append ] unit-test
+[ [ 2 ]         ] [ [ ] [ 2 ]       append ] unit-test
+[ [ 1 2 3 4 ]   ] [ [ 1 2 3 ] [ 4 ] append ] unit-test
+[ [ 1 2 3 4 ]   ] [ [ 1 2 3 ] { 4 } append ] unit-test
+
+[ "a" -1 append ] unit-test-fails
+[ -1 "a" append ] unit-test-fails
+
+[ [ ]       ] [ 1 [ ]           remove ] unit-test
+[ [ ]       ] [ 1 [ 1 ]         remove ] unit-test
+[ [ 3 1 1 ] ] [ 2 [ 3 2 1 2 1 ] remove ] unit-test
+
+[ [ ]       ] [ [ ]       reverse ] unit-test
+[ [ 1 ]     ] [ [ 1 ]     reverse ] unit-test
+[ [ 3 2 1 ] ] [ [ 1 2 3 ] reverse ] unit-test
+
+[ f ] [ f 0 head ] unit-test
+[ [ ] ] [ [ 1 ] 0 head ] unit-test
+[ [ 1 2 3 ] ] [ [ 1 2 3 4 ] 3 head ] unit-test
+[ [ ] ] [ [ 1 2 3 ] 3 tail ] unit-test
+[ [ 3 ] ] [ [ 1 2 3 ] 2 tail ] unit-test
+
+[ t ] [ [ 1 2 3 ] [ 1 2 3 ] sequence= ] unit-test
+[ t ] [ [ 1 2 3 ] { 1 2 3 } sequence= ] unit-test
+[ t ] [ { 1 2 3 } [ 1 2 3 ] sequence= ] unit-test
+[ f ] [ [ ] [ 1 2 3 ] sequence= ] unit-test
+
+[ { 1 3 2 4 } ] [ { 1 2 3 4 } clone 1 2 pick exchange ] unit-test
+
+[ { "" "a" "aa" "aaa" } ]
+[ 4 [ CHAR: a <string> ] map ]
+unit-test
+
+[ V{ } ] [ "f" V{ } clone [ delete ] keep ] unit-test
+[ V{ } ] [ "f" V{ "f" } clone [ delete ] keep ] unit-test
+[ V{ } ] [ "f" V{ "f" "f" } clone [ delete ] keep ] unit-test
+[ V{ "x" } ] [ "f" V{ "f" "x" "f" } clone [ delete ] keep ] unit-test
+[ V{ "y" "x" } ] [ "f" V{ "y" "f" "x" "f" } clone [ delete ] keep ] unit-test
+
+[ V{ 0 1 4 5 } ] [ 6 >vector 2 4 pick delete-slice ] unit-test
+
+[ 6 >vector 2 8 pick delete-slice ] unit-test-fails
+
+[ V{ } ] [ 6 >vector 0 6 pick delete-slice ] unit-test
+
+[ V{ 1 2 "a" "b" 5 6 7 } ] [
+    { "a" "b" } 2 4 V{ 1 2 3 4 5 6 7 } clone
+    [ replace-slice ] keep
+] unit-test
+
+[ V{ 1 2 "a" "b" 6 7 } ] [
+    { "a" "b" } 2 5 V{ 1 2 3 4 5 6 7 } clone
+    [ replace-slice ] keep
+] unit-test
+
+[ V{ 1 2 "a" "b" 4 5 6 7 } ] [
+    { "a" "b" } 2 3 V{ 1 2 3 4 5 6 7 } clone
+    [ replace-slice ] keep
+] unit-test
+
+[ V{ 1 2 3 4 5 6 7 "a" "b" } ] [
+    { "a" "b" } 7 7 V{ 1 2 3 4 5 6 7 } clone
+    [ replace-slice ] keep
+] unit-test
+
+[ V{ "a" 3 } ] [
+    { "a" } 0 2 V{ 1 2 3 } clone [ replace-slice ] keep
+] unit-test
+
+[ { 1 4 9 } ] [ { 1 2 3 } clone dup [ sq ] change-each ] unit-test
+
+[ 5 ] [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
+[ 5 ] [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
+[ 5 ] [ 1 >bignum "\u0001\u0005\u0007" nth-unsafe ] unit-test
+
+[ SBUF" before&after" ] [
+    "&" 6 11 SBUF" before and after" [ replace-slice ] keep
+] unit-test
+
+[ 3 "a" ] [ { "a" "b" "c" "a" "d" } [ "a" = ] find-last ] unit-test
+
+[ f f ] [ 100 { 1 2 3 } [ 1 = ] find* ] unit-test
+[ f f ] [ 100 { 1 2 3 } [ 1 = ] find-last* ] unit-test
+[ f f ] [ -1 { 1 2 3 } [ 1 = ] find* ] unit-test
+
+[ 0 ] [ { "a" "b" "c" } { "A" "B" "C" } mismatch ] unit-test
+
+[ 1 ] [ { "a" "b" "c" } { "a" "B" "C" } mismatch ] unit-test
+
+[ f ] [ { "a" "b" "c" } { "a" "b" "c" } mismatch ] unit-test
+
+[ V{ } V{ } ] [ { "a" "b" } { "a" "b" } drop-prefix [ >vector ] 2apply ] unit-test
+
+[ V{ "C" } V{ "c" } ] [ { "a" "b" "C" } { "a" "b" "c" } drop-prefix [ >vector ] 2apply ] unit-test
+
+[ -1 1 "abc" <slice> ] unit-test-fails
+
+[ V{ "a" "b" } V{ } ] [ { "X" "a" "b" } { "X" } drop-prefix [ >vector ] 2apply ] unit-test
+
+[ -1 ] [ "ab" "abc" <=> ] unit-test
+[ 1 ] [ "abc" "ab" <=> ] unit-test
+
+[ 1 4 9 16 16 V{ f 1 4 9 16 } ] [
+    V{ } clone "cache-test" set
+    1 "cache-test" get [ sq ] cache-nth
+    2 "cache-test" get [ sq ] cache-nth
+    3 "cache-test" get [ sq ] cache-nth
+    4 "cache-test" get [ sq ] cache-nth
+    4 "cache-test" get [ "wrong" ] cache-nth
+    "cache-test" get
+] unit-test
+
+[ 1 ] [ 1/2 { 1 2 3 } nth ] unit-test
+
+! Pathological case
+[ "ihbye" ] [ "hi" <reversed> "bye" append ] unit-test
+
+[ -10 "hi" "bye" copy ] unit-test-fails
+[ 10 "hi" "bye" copy ] unit-test-fails
+
+[ V{ 1 2 3 5 6 } ] [
+    3 V{ 1 2 3 4 5 6 } clone [ delete-nth ] keep
+] unit-test
+
+[ V{ 1 2 3 } ]
+[ 3 V{ 1 2 } clone [ push-new ] keep ] unit-test
+
+[ V{ 1 2 3 } ]
+[ 3 V{ 1 3 2 } clone [ push-new ] keep ] unit-test
+
+! Columns
+{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
+
+[ { 1 4 7 } ] [ "seq" get 0 <column> >array ] unit-test
+[ ] [ "seq" get 1 <column> [ sq ] change-each ] unit-test
+[ { 4 25 64 } ] [ "seq" get 1 <column> >array ] unit-test
+
+! erg's random tester found this one
+[ SBUF" 12341234" ] [
+    9 <sbuf> dup "1234" swap push-all dup dup swap push-all
+] unit-test
+
+[ f ] [ f V{ } like f V{ } like eq? ] unit-test
+
+[ ?{ f t } ] [ 0 2 ?{ f t f } subseq ] unit-test
+
+[ V{ f f f } ] [ 3 V{ } new ] unit-test
+[ SBUF" \0\0\0" ] [ 3 SBUF" " new ] unit-test
+
+[ 0 ] [ f length ] unit-test
+[ f first ] unit-test-fails
+[ 3 ] [ 3 10 nth ] unit-test
+[ 3 ] [ 3 10 nth-unsafe ] unit-test
+[ -3 10 nth ] unit-test-fails
+[ 11 10 nth ] unit-test-fails
+
+[ -1./0. 0 delete-nth ] unit-test-fails
+[ "" ] [ "" [ blank? ] trim ] unit-test
+[ "" ] [ "" [ blank? ] ltrim ] unit-test
+[ "" ] [ "" [ blank? ] rtrim ] unit-test
+[ "asdf" ] [ " asdf " [ blank? ] trim ] unit-test
+[ "asdf " ] [ " asdf " [ blank? ] ltrim ] unit-test
+[ " asdf" ] [ " asdf " [ blank? ] rtrim ] unit-test
+
diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor
new file mode 100644 (file)
index 0000000..8d883dd
--- /dev/null
@@ -0,0 +1,657 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: sequences
+USING: kernel kernel.private slots.private math math.private ;
+
+MIXIN: sequence
+
+GENERIC: length ( seq -- n ) flushable
+GENERIC: set-length ( n seq -- )
+GENERIC: nth ( n seq -- elt ) flushable
+GENERIC: set-nth ( elt n seq -- )
+GENERIC: new ( len seq -- newseq ) flushable
+GENERIC: new-resizable ( len seq -- newseq ) flushable
+GENERIC: like ( seq exemplar -- newseq ) flushable
+GENERIC: clone-like ( seq exemplar -- newseq ) flushable
+
+: new-like ( len exemplar quot -- seq )
+    over >r >r new r> call r> like ; inline
+
+M: sequence like drop ;
+
+GENERIC: lengthen ( n seq -- )
+
+M: sequence lengthen 2dup length > [ set-length ] [ 2drop ] if ;
+
+: empty? ( seq -- ? ) length zero? ; inline
+: delete-all ( seq -- ) 0 swap set-length ;
+
+: first ( seq -- first ) 0 swap nth ; inline
+: second ( seq -- second ) 1 swap nth ; inline
+: third ( seq -- third ) 2 swap nth ; inline
+: fourth  ( seq -- fourth ) 3 swap nth ; inline
+
+: set-first ( first seq -- ) 0 swap set-nth ; inline
+: set-second ( second seq -- ) 1 swap set-nth ; inline
+: set-third ( third seq -- ) 2 swap set-nth ; inline
+: set-fourth  ( fourth seq -- ) 3 swap set-nth ; inline
+
+: push ( elt seq -- ) dup length swap set-nth ;
+
+: bounds-check? ( n seq -- ? )
+    length 1- 0 swap between? ; inline
+
+TUPLE: bounds-error index seq ;
+
+: bounds-error ( n seq -- * )
+    \ bounds-error construct-boa throw ;
+
+: bounds-check ( n seq -- n seq )
+    2dup bounds-check? [ bounds-error ] unless ; inline
+
+MIXIN: immutable-sequence
+
+TUPLE: immutable seq ;
+
+: immutable ( seq -- * ) \ immutable construct-boa throw ;
+
+M: immutable-sequence set-nth immutable ;
+
+INSTANCE: immutable-sequence sequence
+
+<PRIVATE
+
+: max-array-capacity ( -- n )
+    #! A bit of a pain; can't call cell-bits here
+    7 getenv 8 * 5 - 2^ 1- ; foldable
+
+PREDICATE: fixnum array-capacity
+    0 max-array-capacity between? ;
+
+: array-capacity ( array -- n )
+    1 slot { array-capacity } declare ; inline
+
+: array-nth ( n array -- elt )
+    swap 2 fixnum+fast slot ; inline
+
+: set-array-nth ( elt n array -- )
+    swap 2 fixnum+fast set-slot ; inline
+
+GENERIC: resize ( n seq -- newseq ) flushable
+
+! Unsafe sequence protocol for inner loops
+GENERIC: nth-unsafe ( n seq -- elt ) flushable
+GENERIC: set-nth-unsafe ( elt n seq -- )
+
+M: sequence nth bounds-check nth-unsafe ;
+M: sequence set-nth bounds-check set-nth-unsafe ;
+
+M: sequence nth-unsafe nth ;
+M: sequence set-nth-unsafe set-nth ;
+
+! The f object supports the sequence protocol trivially
+M: f length drop 0 ;
+M: f nth-unsafe nip ;
+M: f like drop dup empty? [ drop f ] when ;
+
+INSTANCE: f immutable-sequence
+
+! Integers support the sequence protocol
+M: integer length ;
+M: integer nth-unsafe drop ;
+
+INSTANCE: integer immutable-sequence
+
+: first2-unsafe
+    [ 0 swap nth-unsafe ] keep 1 swap nth-unsafe ; inline
+
+: first3-unsafe
+    [ first2-unsafe ] keep 2 swap nth-unsafe ; inline
+
+: first4-unsafe
+    [ first3-unsafe ] keep 3 swap nth-unsafe ; inline
+
+: exchange-unsafe ( m n seq -- )
+    [ tuck nth-unsafe >r nth-unsafe r> ] 3keep tuck
+    >r >r set-nth-unsafe r> r> set-nth-unsafe ; inline
+
+: (head) ( seq n -- from to seq ) 0 swap rot ; inline
+
+: (tail) ( seq n -- from to seq ) over length rot ; inline
+
+: from-end >r dup length r> - ; inline
+
+: (2sequence)
+    tuck 1 swap set-nth-unsafe
+    tuck 0 swap set-nth-unsafe ; inline
+
+: (3sequence)
+    tuck 2 swap set-nth-unsafe
+    (2sequence) ; inline
+
+: (4sequence)
+    tuck 3 swap set-nth-unsafe
+    (3sequence) ; inline
+
+PRIVATE>
+
+: 2sequence ( obj1 obj2 exemplar -- seq )
+    2 swap [ (2sequence) ] new-like ; inline
+
+: 3sequence ( obj1 obj2 obj3 exemplar -- seq )
+    3 swap [ (3sequence) ] new-like ; inline
+
+: 4sequence ( obj1 obj2 obj3 obj4 exemplar -- seq )
+    4 swap [ (4sequence) ] new-like ; inline
+
+: first2 ( seq -- first second )
+    1 swap bounds-check nip first2-unsafe ; flushable
+
+: first3 ( seq -- first second third )
+    2 swap bounds-check nip first3-unsafe ; flushable
+
+: first4 ( seq -- first second third fourth )
+    3 swap bounds-check nip first4-unsafe ; flushable
+
+: ?nth ( n seq -- elt/f )
+    2dup bounds-check? [ nth-unsafe ] [ 2drop f ] if ; flushable
+
+MIXIN: virtual-sequence
+GENERIC: virtual-seq ( seq -- seq' )
+GENERIC: virtual@ ( n seq -- n' seq' )
+
+M: virtual-sequence nth virtual@ nth ;
+M: virtual-sequence set-nth virtual@ set-nth ;
+M: virtual-sequence nth-unsafe virtual@ nth-unsafe ;
+M: virtual-sequence set-nth-unsafe virtual@ set-nth-unsafe ;
+M: virtual-sequence like virtual-seq like ;
+M: virtual-sequence new virtual-seq new ;
+
+INSTANCE: virtual-sequence sequence
+
+! A reversal of an underlying sequence.
+TUPLE: reversed seq ;
+
+C: <reversed> reversed
+
+M: reversed virtual-seq reversed-seq ;
+M: reversed virtual@ reversed-seq [ length swap - 1- ] keep ;
+M: reversed length reversed-seq length ;
+
+INSTANCE: reversed virtual-sequence
+
+: reverse ( seq -- newseq ) [ <reversed> ] keep like ;
+
+! A slice of another sequence.
+TUPLE: slice from to seq ;
+
+: collapse-slice ( m n slice -- m' n' seq )
+    dup slice-from swap slice-seq >r tuck + >r + r> r> ; inline
+
+TUPLE: slice-error reason ;
+: slice-error ( str -- * ) \ slice-error construct-boa throw ;
+
+: check-slice ( from to seq -- )
+    pick 0 < [ "start < 0" slice-error ] when
+    length over < [ "end > sequence" slice-error ] when
+    > [ "start > end" slice-error ] when ;
+
+: <slice> ( from to seq -- slice )
+    dup slice? [ collapse-slice ] when
+    3dup check-slice
+    slice construct-boa ;
+
+M: slice virtual-seq slice-seq ;
+M: slice virtual@ [ slice-from + ] keep slice-seq ;
+M: slice length dup slice-to swap slice-from - ;
+
+: head-slice ( seq n -- slice ) (head) <slice> ;
+
+: tail-slice ( seq n -- slice ) (tail) <slice> ;
+
+: head-slice* ( seq n -- slice ) from-end head-slice ;
+
+: tail-slice* ( seq n -- slice ) from-end tail-slice ;
+
+INSTANCE: slice virtual-sequence
+
+! A column of a matrix
+TUPLE: column seq col ;
+
+C: <column> column
+
+M: column virtual-seq column-seq ;
+M: column virtual@ dup column-col -rot column-seq nth ;
+M: column length column-seq length ;
+
+INSTANCE: column virtual-sequence
+
+! One element repeated many times
+TUPLE: repetition len elt ;
+
+C: <repetition> repetition
+
+M: repetition length repetition-len ;
+M: repetition nth-unsafe nip repetition-elt ;
+
+INSTANCE: repetition immutable-sequence
+
+<PRIVATE
+
+: ((copy)) ( dst i src j n -- dst i src j n )
+    dup -roll [
+        + swap nth-unsafe -roll [
+            + swap set-nth-unsafe
+        ] 3keep drop
+    ] 3keep ; inline
+
+: (copy) ( dst i src j n -- dst )
+    dup 0 <= [ 2drop 2drop ] [ 1- ((copy)) (copy) ] if ; inline
+
+: prepare-subseq ( from to seq -- dst i src j n )
+    [ >r swap - r> new dup 0 ] 3keep
+    -rot drop roll length ; inline
+
+: check-copy ( src n dst -- )
+    over 0 < [ bounds-error ] when
+    >r swap length + r> lengthen ;
+
+PRIVATE>
+
+: subseq ( from to seq -- subseq )
+    [ 3dup check-slice prepare-subseq (copy) ] keep like ;
+
+: head ( seq n -- headseq ) (head) subseq ;
+
+: tail ( seq n -- tailseq ) (tail) subseq ;
+
+: head* ( seq n -- headseq ) from-end head ;
+
+: tail* ( seq n -- tailseq ) from-end tail ;
+
+: copy ( src i dst -- )
+    pick length >r 3dup check-copy swap rot 0 r>
+    (copy) drop ; inline
+
+M: sequence clone-like
+    >r dup length r> new [ 0 swap copy ] keep ;
+
+M: immutable-sequence clone-like like ;
+
+: push-all ( src dest -- ) [ length ] keep copy ;
+
+: ((append)) ( seq1 seq2 accum -- accum )
+    [ >r over length r> copy ] keep
+    [ 0 swap copy ] keep ; inline
+
+: (append) ( seq1 seq2 exemplar -- newseq )
+    >r over length over length + r>
+    [ ((append)) ] new-like ; inline
+
+: (3append) ( seq1 seq2 seq3 exemplar -- newseq )
+    >r pick length pick length pick length + + r> [
+        [ >r pick length pick length + r> copy ] keep
+        ((append))
+    ] new-like ; inline
+
+: append ( seq1 seq2 -- newseq ) over (append) ;
+
+: 3append ( seq1 seq2 seq3 -- newseq ) pick (3append) ;
+
+: change-nth ( i seq quot -- )
+    [ >r nth r> call ] 3keep drop set-nth ; inline
+
+: min-length ( seq1 seq2 -- n ) [ length ] 2apply min ; inline
+
+: max-length ( seq1 seq2 -- n ) [ length ] 2apply max ; inline
+
+<PRIVATE
+
+: iterate-seq >r dup length swap r> ; inline
+
+: (each) ( seq quot -- n quot' )
+    iterate-seq [ >r nth-unsafe r> call ] 2curry ; inline
+
+: (collect) ( quot into -- quot' )
+    [ >r over slip r> set-nth-unsafe ] 2curry ; inline
+
+: collect ( n quot into -- )
+    (collect) each-integer ; inline
+
+: map-into ( seq quot into -- )
+    >r (each) r> collect ; inline
+
+: 2nth-unsafe ( n seq1 seq2 -- elt1 elt2 )
+    >r over r> nth-unsafe >r nth-unsafe r> ; inline
+
+: (2each) ( seq1 seq2 quot -- n quot' )
+    >r [ min-length ] 2keep r>
+    [ >r 2nth-unsafe r> call ] 3curry ; inline
+
+: finish-find ( i seq -- i elt )
+    over [ dupd nth-unsafe ] [ drop f ] if ; inline
+
+: (find) ( seq quot quot' -- i elt )
+    pick >r >r (each) r> call r> finish-find ; inline
+
+: (find*) ( n seq quot quot' -- i elt )
+    >r >r 2dup bounds-check? [
+        r> r> (find)
+    ] [
+        r> r> 2drop 2drop f f
+    ] if ; inline
+
+: (monotonic) ( seq quot -- ? )
+    [ 2dup nth-unsafe rot 1+ rot nth-unsafe ]
+    swap compose curry ; inline
+
+: (interleave) ( n elt between quot -- )
+    roll zero? [ nip ] [ swapd 2slip ] if call ; inline
+
+PRIVATE>
+
+: each ( seq quot -- )
+    (each) each-integer ; inline
+
+: reduce ( seq identity quot -- result )
+    swapd each ; inline
+
+: map-as ( seq quot exemplar -- newseq )
+    >r over length r> [ [ map-into ] keep ] new-like ; inline
+
+: map ( seq quot -- newseq )
+    over map-as ; inline
+
+: change-each ( seq quot -- )
+    over map-into ; inline
+
+: accumulate ( seq identity quot -- final newseq )
+    swapd [ pick slip ] curry map ; inline
+
+: 2each ( seq1 seq2 quot -- )
+    (2each) each-integer ; inline
+
+: 2reverse-each ( seq1 seq2 quot -- )
+    >r [ <reversed> ] 2apply r> 2each ; inline
+
+: 2reduce ( seq1 seq2 identity quot -- result )
+    >r -rot r> 2each ; inline
+
+: 2map ( seq1 seq2 quot -- newseq )
+    pick >r (2each) over r>
+    [ [ collect ] keep ] new-like ; inline
+
+: 2all? ( seq1 seq2 quot -- ? )
+    (2each) all-integers? ; inline
+
+: find* ( n seq quot -- i elt )
+    [ (find-integer) ] (find*) ; inline
+
+: find ( seq quot -- i elt )
+    [ find-integer ] (find) ; inline
+
+: find-last* ( n seq quot -- i elt )
+    [ nip find-last-integer ] (find*) ; inline
+
+: find-last ( seq quot -- i elt )
+    [ >r 1- r> find-last-integer ] (find) ; inline
+
+: all? ( seq quot -- ? )
+    (each) all-integers? ; inline
+
+: push-if ( elt quot accum -- )
+    >r keep r> rot [ push ] [ 2drop ] if  ; inline
+
+: pusher ( quot -- quot accum )
+    V{ } clone [ [ push-if ] 2curry ] keep ; inline
+
+: subset ( seq quot -- subseq )
+    over >r pusher >r each r> r> like ; inline
+
+: monotonic? ( seq quot -- ? )
+    >r dup length 1- swap r> (monotonic) all? ; inline
+
+: interleave ( seq between quot -- )
+    [ (interleave) ] 2curry iterate-seq 2each ; inline
+
+: index ( obj seq -- n )
+    [ = ] curry* find drop ;
+
+: index* ( obj i seq -- n )
+    rot [ = ] curry find* drop ;
+
+: last-index ( obj seq -- n )
+    [ = ] curry* find-last drop ;
+
+: last-index* ( obj i seq -- n )
+    rot [ = ] curry find-last* drop ;
+
+: contains? ( seq quot -- ? )
+    find drop >boolean ; inline
+
+: member? ( obj seq -- ? )
+    [ = ] curry* contains? ;
+
+: memq? ( obj seq -- ? )
+    [ eq? ] curry* contains? ;
+
+: remove ( obj seq -- newseq )
+    [ = not ] curry* subset ;
+
+: cache-nth ( i seq quot -- elt )
+    pick pick ?nth dup [
+        >r 3drop r>
+    ] [
+        drop swap >r over >r call dup r> r> set-nth
+    ] if ; inline
+
+: mismatch ( seq1 seq2 -- i )
+    [ min-length ] 2keep
+    [ 2nth-unsafe = not ] 2curry
+    find drop ; inline
+
+M: sequence <=>
+    2dup mismatch
+    [ -rot 2nth-unsafe <=> ] [ [ length ] compare ] if* ;
+
+: sequence= ( seq1 seq2 -- ? )
+    2dup [ length ] 2apply number=
+    [ mismatch not ] [ 2drop f ] if ; inline
+
+: move ( to from seq -- )
+    pick pick number=
+    [ 3drop ] [ [ nth swap ] keep set-nth ] if ; inline
+
+: (delete) ( elt store scan seq -- elt store scan seq )
+    2dup length < [
+        3dup move
+        [ nth pick = ] 2keep rot
+        [ >r >r 1+ r> r> ] unless >r 1+ r> (delete)
+    ] when ;
+
+: delete ( elt seq -- ) 0 0 rot (delete) nip set-length drop ;
+
+: push-new ( elt seq -- ) [ delete ] 2keep push ;
+
+: add ( seq elt -- newseq )
+    over >r over length 1+ r> [
+        [ >r over length r> set-nth-unsafe ] keep
+        [ 0 swap copy ] keep
+    ] new-like ;
+
+: add* ( seq elt -- newseq )
+    over >r over length 1+ r> [
+        [ 0 swap set-nth-unsafe ] keep
+        [ 1 swap copy ] keep
+    ] new-like ;
+
+: seq-diff ( seq1 seq2 -- newseq )
+    swap [ member? not ] curry subset ;
+
+: peek ( seq -- elt ) dup length 1- swap nth ;
+
+: pop* ( seq -- ) dup length 1- swap set-length ;
+
+: move-backward ( shift from to seq -- )
+    pick pick number= [
+        2drop 2drop
+    ] [
+        [ >r pick pick + pick r> move >r 1+ r> ] keep
+        move-backward
+    ] if ;
+
+: move-forward ( shift from to seq -- )
+    pick pick number= [
+        2drop 2drop
+    ] [
+        [ >r pick >r dup dup r> + swap r> move 1- ] keep
+        move-forward
+    ] if ;
+
+: (open-slice) ( shift from to seq ? -- )
+    [
+        >r >r 1- r> 1- r> move-forward
+    ] [
+        >r >r over - r> r> move-backward
+    ] if ;
+
+: open-slice ( shift from seq -- )
+    pick zero? [
+        3drop
+    ] [
+        pick over length + over >r >r
+        pick 0 > >r [ length ] keep r> (open-slice)
+        r> r> set-length
+    ] if ;
+
+: delete-slice ( from to seq -- )
+    3dup check-slice >r over >r - r> r> open-slice ;
+
+: delete-nth ( n seq -- )
+    >r dup 1+ r> delete-slice ;
+
+: replace-slice ( new from to seq -- )
+    [ >r >r dup pick length + r> - over r> open-slice ] keep
+    copy ;
+
+: pop ( seq -- elt )
+    dup length 1- swap [ nth ] 2keep set-length ;
+
+: all-equal? ( seq -- ? ) [ = ] monotonic? ;
+
+: all-eq? ( seq -- ? ) [ eq? ] monotonic? ;
+
+: flip ( matrix -- newmatrix )
+    dup empty? [
+        dup first length [ <column> dup like ] curry* map
+    ] unless ;
+
+: exchange ( m n seq -- )
+    pick over bounds-check 2drop 2dup bounds-check 2drop
+    exchange-unsafe ;
+
+: reverse-here ( seq -- )
+    dup length dup 2/ [
+        >r 2dup r>
+        tuck - 1- rot exchange-unsafe
+    ] each 2drop ;
+
+: sum-lengths ( seq -- n )
+    0 [ length + ] reduce ;
+
+: concat ( seq -- newseq )
+    dup empty? [
+        drop { }
+    ] [
+        [ sum-lengths ] keep
+        [ first new-resizable ] keep
+        [ [ over push-all ] each ] keep
+        first like
+    ] if ;
+
+: joined-length ( seq glue -- n )
+    >r dup sum-lengths swap length 1 [-] r> length * + ;
+
+: join ( seq glue -- newseq )
+    [
+        2dup joined-length over new-resizable -rot swap
+        [ dup pick push-all ] [ pick push-all ] interleave drop
+    ] keep like ;
+
+: padding ( seq n elt quot -- newseq )
+    >r >r over length [-] dup zero?
+    [ r> r> 3drop ] [ r> <repetition> r> call ] if ; inline
+
+: pad-left ( seq n elt -- padded )
+    [ swap dup (append) ] padding ;
+
+: pad-right ( seq n elt -- padded )
+    [ append ] padding ;
+
+: shorter? ( seq1 seq2 -- ? ) >r length r> length < ;
+
+: head? ( seq begin -- ? )
+    2dup shorter? [
+        2drop f
+    ] [
+        tuck length head-slice sequence=
+    ] if ;
+
+: tail? ( seq end -- ? )
+    2dup shorter? [
+        2drop f
+    ] [
+        tuck length tail-slice* sequence=
+    ] if ;
+
+: cut-slice ( n seq -- before after )
+    swap [ head ] 2keep tail-slice ;
+
+: cut ( n seq -- before after )
+    swap [ head ] 2keep tail ;
+
+: cut* ( n seq -- before after )
+    swap [ head* ] 2keep tail* ;
+
+<PRIVATE
+
+: (start) ( subseq seq n -- subseq seq ? )
+    pick length [
+        >r 3dup r> [ + swap nth-unsafe ] keep rot nth-unsafe =
+    ] all? nip ; inline
+
+PRIVATE>
+
+: start* ( subseq seq n -- i )
+    pick length pick length swap - 1+
+    [ (start) ] find*
+    swap >r 3drop r> ;
+
+: start ( subseq seq -- i ) 0 start* ; inline
+
+: subseq? ( subseq seq -- ? ) start >boolean ;
+
+: drop-prefix ( seq1 seq2 -- slice1 slice2 )
+    2dup mismatch [ 2dup min-length ] unless*
+    tuck tail-slice >r tail-slice r> ;
+
+: unclip ( seq -- rest first )
+    dup 1 tail swap first ;
+
+: unclip-slice ( seq -- rest first )
+    dup 1 tail-slice swap first ;
+
+: <flat-slice> ( seq -- slice )
+    dup slice? [ { } like ] when 0 over length rot <slice> ;
+    inline
+
+: ltrim ( seq quot -- newseq )
+    over >r [ not ] compose find drop
+    r> swap [ tail ] when* ; inline
+
+: rtrim ( seq quot -- newseq )
+    over >r [ not ] compose find-last drop
+    r> swap [ 1+ head ] when* ; inline
+
+: trim ( seq quot -- newseq )
+    [ ltrim ] keep rtrim ; inline
diff --git a/core/sequences/summary.txt b/core/sequences/summary.txt
new file mode 100644 (file)
index 0000000..045808a
--- /dev/null
@@ -0,0 +1 @@
+Sequence protocol, combinators and utilities
diff --git a/core/sequences/tags.txt b/core/sequences/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/slots/authors.txt b/core/slots/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/slots/slots-docs.factor b/core/slots/slots-docs.factor
new file mode 100644 (file)
index 0000000..04db98c
--- /dev/null
@@ -0,0 +1,134 @@
+USING: help.markup help.syntax generic kernel.private parser
+words kernel quotations namespaces sequences words arrays
+effects generic.standard tuples slots.private classes
+strings math ;
+IN: slots
+
+ARTICLE: "slots" "Slots"
+"A " { $emphasis "slot" } " is a component of an object which can store a value. The " { $vocab-link "slots" } " vocabulary contains words for introspecting the slots of an object."
+$nl
+{ $link "tuples" } " are composed entirely of slots, and instances of " { $link "builtin-classes" } " consist of slots together with intrinsic data."
+$nl
+"The " 
+"The " { $snippet "\"slots\"" } " word property of built-in and tuple classes holds an array of " { $emphasis "slot specifiers" } " describing the slot layout of each instance."
+{ $subsection slot-spec }
+"Each slot has a reader word; mutable slots have an optional writer word. All tuple slots are mutable, but some slots on built-in classes are not."
+{ $subsection slot-spec-reader }
+{ $subsection slot-spec-writer }
+"Given a reader or writer word and a class, it is possible to find the slot specifier corresponding to this word:"
+{ $subsection slot-of-reader }
+{ $subsection slot-of-writer }
+"Reader and writer words form classes:"
+{ $subsection slot-reader }
+{ $subsection slot-writer }
+"Slot readers and writers type check, then call unsafe primitives:"
+{ $subsection slot }
+{ $subsection set-slot } ;
+
+ABOUT: "slots"
+
+HELP: slot-spec
+{ $class-description "A slot specification. The " { $snippet "\"slots\"" } " word property of " { $link builtin-class } " and " { $link tuple-class } " instances holds sequences of slot specifications."
+$nl
+"The slots of a slot specification are:"
+{ $list
+    { { $link slot-spec-type } " - a " { $link class } " declaring the set of possible values for the slot." }
+    { { $link slot-spec-name } " - a " { $link string } " identifying the slot." }
+    { { $link slot-spec-offset } " - an " { $link integer } " offset specifying where the slot value is stored inside instances of the relevant class. This is an implementation detail." }
+    { { $link slot-spec-reader } " - a " { $link word } " for reading the value of this slot." }
+    { { $link slot-spec-writer } " - a " { $link word } " for writing the value of this slot." }
+} } ;
+
+HELP: define-typecheck
+{ $values { "class" class } { "generic" "a generic word" } { "quot" quotation } }
+{ $description
+    "Defines a generic word with the " { $link standard-combination } " using dispatch position 0, and having one method on " { $snippet "class" } "."
+    $nl
+    "This creates a definition analogous to the following code:"
+    { $code
+        "GENERIC: generic"
+        "M: class generic quot ;"
+    }
+    "It checks if the top of the stack is an instance of " { $snippet "class" } ", and if so, executes the quotation. Delegation is respected."
+}
+{ $notes "This word is used internally to wrap low-level code that does not do type-checking in safe user-visible words. For example, see how " { $link word-name } " is implemented." } ;
+
+HELP: define-slot-word
+{ $values { "class" class } { "slot" "a positive integer" } { "word" word } { "quot" quotation } }
+{ $description "Defines " { $snippet "word" } " to be a simple type-checking generic word that receives the slot number on the stack as a fixnum." }
+$low-level-note ;
+
+HELP: reader-effect
+{ $values { "class" class } { "spec" slot-spec } { "effect" "an instance of " { $link effect } } }
+{ $description "The stack effect of slot reader words is " { $snippet "( obj -- value )" } "." } ;
+
+HELP: reader-quot
+{ $values { "decl" class } { "quot" "a quotation with stack effect " { $snippet "( obj n -- value )" } } }
+{ $description "Outputs a quotation which reads the " { $snippet "n" } "th slot of an object and declares it as an instance of a class." } ;
+
+HELP: slot-reader
+{ $class-description "The class of slot reader words." }
+{ $examples
+    { $example "USING: classes slots ;" "TUPLE: circle center radius ;" "\\ circle-center slot-reader? ." "t" }
+} ;
+
+HELP: define-reader
+{ $values { "class" class } { "spec" slot-spec } }
+{ $description "Defines a generic word " { $snippet "reader" } " to read a slot from instances of " { $snippet "class" } "." }
+$low-level-note ;
+
+HELP: writer-effect
+{ $values { "class" class } { "spec" slot-spec } { "effect" "an instance of " { $link effect } } }
+{ $description "The stack effect of slot writer words is " { $snippet "( value obj -- )" } "." } ;
+
+HELP: slot-writer
+{ $class-description "The class of slot writer words." }
+{ $examples
+    { $example "USING: classes slots ;" "TUPLE: circle center radius ;" "\\ set-circle-center slot-writer? ." "t" }
+} ;
+
+HELP: define-writer
+{ $values { "class" class } { "spec" slot-spec } }
+{ $description "Defines a generic word " { $snippet "writer" } " to write a new value to a slot in instances of " { $snippet "class" } "." }
+$low-level-note ;
+
+HELP: define-slot
+{ $values { "class" class } { "spec" slot-spec } }
+{ $description "Defines a pair of generic words for reading and writing a slot value in instances of " { $snippet "class" } "." }
+$low-level-note ;
+
+HELP: define-slots
+{ $values { "class" class } { "specs" "a sequence of " { $link slot-spec } " instances" } }
+{ $description "Defines a set of slot reader/writer words." }
+$low-level-note ;
+
+HELP: simple-slots
+{ $values { "class" class } { "slots" "a sequence of strings" } { "base" "a slot number" } { "specs" "a sequence of " { $link slot-spec } " instances" } }
+{ $description "Constructs a slot specification for " { $link define-slots } " where each slot is named by an element of " { $snippet "slots" } " prefixed by the name of the class. Slots are numbered consecutively starting from " { $snippet "base" } ". Reader and writer words are defined in the current vocabulary, with the reader word having the same name as the slot, and the writer word name prefixed by " { $snippet "\"set-\"" } "." }
+{ $notes "This word is used by " { $link define-tuple-class } " and " { $link POSTPONE: TUPLE: } "." } ;
+
+HELP: slot ( obj m -- value )
+{ $values { "obj" object } { "m" "a non-negative fixnum" } { "value" object } }
+{ $description "Reads the object stored at the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
+{ $warning "This word is in the " { $vocab-link "slots.private" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
+
+HELP: set-slot ( value obj n -- )
+{ $values { "value" object } { "obj" object } { "n" "a non-negative fixnum" } }
+{ $description "Writes " { $snippet "value" } " to the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
+{ $warning "This word is in the " { $vocab-link "slots.private" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
+
+HELP: slot-of-reader
+{ $values { "reader" slot-reader } { "specs" "a sequence of " { $link slot-spec } " instances" } { "spec/f" "a " { $link slot-spec } " or " { $link f } } }
+{ $description "Outputs the " { $link slot-spec } " whose " { $link slot-spec-reader } " is equal to " { $snippet "reader" } "." } ;
+
+HELP: slot-of-writer
+{ $values { "writer" slot-writer } { "specs" "a sequence of " { $link slot-spec } " instances" } { "spec/f" "a " { $link slot-spec } " or " { $link f } } }
+{ $description "Outputs the " { $link slot-spec } " whose " { $link slot-spec-writer } " is equal to " { $snippet "writer" } "." } ;
+
+HELP: reader-word
+{ $values { "class" string } { "name" string } { "vocab" string } { "word" word } }
+{ $description "Creates a word named " { $snippet { $emphasis "class" } "-" { $emphasis "name" } } " in the " { $snippet "vocab" } " vocabulary." } ;
+
+HELP: writer-word
+{ $values { "class" string } { "name" string } { "vocab" string } { "word" word } }
+{ $description "Creates a word named " { $snippet "set-" { $emphasis "class" } "-" { $emphasis "name" } } " in the " { $snippet "vocab" } " vocabulary." } ;
diff --git a/core/slots/slots.factor b/core/slots/slots.factor
new file mode 100644 (file)
index 0000000..0ecc1d8
--- /dev/null
@@ -0,0 +1,105 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel kernel.private math namespaces
+sequences strings words effects generic generic.standard
+classes slots.private ;
+IN: slots
+
+TUPLE: slot-spec type name offset reader writer ;
+
+C: <slot-spec> slot-spec
+
+: define-typecheck ( class generic quot -- )
+    <method> over define-simple-generic -rot define-method ;
+
+: define-slot-word ( class slot word quot -- )
+    rot >fixnum add* define-typecheck ;
+
+: reader-effect ( class spec -- effect )
+    >r ?word-name 1array r> slot-spec-name 1array <effect> ;
+
+: reader-quot ( decl -- quot )
+    [
+        \ slot ,
+        dup object bootstrap-word eq?
+        [ drop ] [ 1array , \ declare , ] if
+    ] [ ] make ;
+
+PREDICATE: compound slot-reader
+    "reading" word-prop >boolean ;
+
+: set-reader-props ( class spec -- )
+    2dup reader-effect
+    over slot-spec-reader
+    swap "declared-effect" set-word-prop
+    slot-spec-reader swap "reading" set-word-prop ;
+
+: define-reader ( class spec -- )
+    dup slot-spec-reader [
+        [ set-reader-props ] 2keep
+        dup slot-spec-offset
+        over slot-spec-reader
+        rot slot-spec-type reader-quot
+        define-slot-word
+    ] [
+        2drop
+    ] if ;
+
+: writer-effect ( class spec -- effect )
+    slot-spec-name swap ?word-name 2array 0 <effect> ;
+
+PREDICATE: compound slot-writer
+    "writing" word-prop >boolean ;
+
+: set-writer-props ( class spec -- )
+    2dup writer-effect
+    over slot-spec-writer
+    swap "declared-effect" set-word-prop
+    slot-spec-writer swap "writing" set-word-prop ;
+
+: define-writer ( class spec -- )
+    dup slot-spec-writer [
+        [ set-writer-props ] 2keep
+        dup slot-spec-offset
+        swap slot-spec-writer
+        [ set-slot ]
+        define-slot-word
+    ] [
+        2drop
+    ] if ;
+
+: define-slot ( class spec -- )
+    2dup define-reader define-writer ;
+
+: define-slots ( class specs -- )
+    [ define-slot ] curry* each ;
+
+: reader-word ( class name vocab -- word )
+    >r >r "-" r> 3append r> create ;
+
+: writer-word ( class name vocab -- word )
+    >r [ swap "set-" % % "-" % % ] "" make r> create ;
+
+: (simple-slot-word) ( class name -- class name vocab )
+    over word-vocabulary >r >r word-name r> r> ;
+
+: simple-reader-word ( class name -- word )
+    (simple-slot-word) reader-word ;
+
+: simple-writer-word ( class name -- word )
+    (simple-slot-word) writer-word ;
+
+: simple-slot ( class name # -- spec )
+    >r object bootstrap-word over r> f f <slot-spec>
+    pick pick simple-reader-word over set-slot-spec-reader
+    rot rot simple-writer-word over set-slot-spec-writer ;
+
+: simple-slots ( class slots base -- specs )
+    over length [ + ] curry* map
+    [ >r >r dup r> r> simple-slot ] 2map nip ;
+
+: slot-of-reader ( reader specs -- spec/f )
+    [ slot-spec-reader eq? ] curry* find nip ;
+
+: slot-of-writer ( writer specs -- spec/f )
+    [ slot-spec-writer eq? ] curry* find nip ;
diff --git a/core/slots/summary.txt b/core/slots/summary.txt
new file mode 100644 (file)
index 0000000..3fae6e8
--- /dev/null
@@ -0,0 +1 @@
+Low-level object introspection support
diff --git a/core/sorting/authors.txt b/core/sorting/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/sorting/sorting-docs.factor b/core/sorting/sorting-docs.factor
new file mode 100644 (file)
index 0000000..4fa5c79
--- /dev/null
@@ -0,0 +1,63 @@
+USING: sorting help.markup help.syntax kernel words math
+sequences ;
+
+ARTICLE: "sequences-sorting" "Sorting and binary search"
+"Sorting and binary search combinators all take comparator quotations with stack effect " { $snippet "( elt1 elt2 -- n )" } " that order the two given elements and output a value whose sign denotes the result:"
+{ $list
+    { "positive - indicates that " { $snippet "elt1" } " follows " { $snippet "elt2" } }
+    { "zero - indicates that " { $snippet "elt1" } " is ordered equivalently to " { $snippet "elt2" } }
+    { "negative - indicates that " { $snippet "elt1" } " precedes " { $snippet "elt2" } }
+}
+"Sorting a sequence with a custom comparator:"
+{ $subsection sort }
+"Sorting a sequence with common comparators:"
+{ $subsection natural-sort }
+{ $subsection sort-keys }
+{ $subsection sort-values }
+"Binary search:"
+{ $subsection binsearch }
+{ $subsection binsearch* } ;
+
+HELP: sort
+{ $values { "seq" "a sequence" } { "quot" "a comparator quotation" } { "sortedseq" "a new sorted sequence" } }
+{ $description "Sorts the elements into a new sequence of the same class as " { $snippet "seq" } "." } ;
+
+HELP: sort-keys
+{ $values { "seq" "an alist" } { "sortedseq" "a new sorted sequence" } }
+{ $description "Sorts the elements comparing first elements of pairs using the " { $link <=> } " word." } ;
+
+HELP: sort-values
+{ $values { "seq" "an alist" } { "sortedseq" "a new sorted sequence" } }
+{ $description "Sorts the elements comparing second elements of pairs using the " { $link <=> } " word." } ;
+
+HELP: natural-sort
+{ $values { "seq" "a sequence of real numbers" } { "sortedseq" "a new sorted sequence" } }
+{ $description "Sorts a sequence of objects in natural order using the " { $link <=> } " word." } ;
+
+HELP: sort-pair
+{ $values { "a" object } { "b" object } { "c" object } { "d" object } }
+{ $description "If " { $snippet "a" } " is greater than " { $snippet "b" } ", exchanges " { $snippet "a" } " with " { $snippet "b" } "." } ;
+
+HELP: midpoint@
+{ $values { "seq" "a sequence" } { "n" integer } }
+{ $description "Outputs the index of the midpoint of " { $snippet "seq" } "." } ;
+
+HELP: midpoint
+{ $values { "seq" "a sequence" } { "elt" object } }
+{ $description "Outputs the element at the midpoint of a sequence." } ;
+
+HELP: partition
+{ $values { "seq" "a sequence" } { "n" integer } { "slice" slice } }
+{ $description "Outputs a slice of the first or second half of the sequence, respectively, depending on the integer's sign." } ;
+
+HELP: binsearch
+{ $values { "elt" object } { "seq" "a sorted sequence" } { "quot" "a comparator quotation" } { "i" "the index of the search result" } }
+{ $description "Given a sequence that is sorted with respect to the " { $snippet "quot" } " comparator, searches for an element equal to " { $snippet "elt" } ", or failing that, the greatest element smaller than " { $snippet "elt" } ". Comparison is performed with " { $snippet "quot" } "."
+$nl
+"Outputs f if the sequence is empty. If the sequence has at least one element, this word always outputs a valid index." } ;
+
+HELP: binsearch*
+{ $values { "elt" object } { "seq" "a sorted sequence" } { "quot" "a comparator quotation" } { "result" "the search result" } }
+{ $description "Variant of " { $link binsearch } " which outputs the found element rather than its index in the sequence."
+$nl
+"Outputs " { $link f } " if the sequence is empty. If the sequence has at least one element, this word always outputs a sequence element." } ;
diff --git a/core/sorting/sorting-tests.factor b/core/sorting/sorting-tests.factor
new file mode 100644 (file)
index 0000000..8325832
--- /dev/null
@@ -0,0 +1,28 @@
+USING: sorting sequences kernel math random tools.test
+vectors ;
+IN: temporary
+
+[ [ ] ] [ [ ] natural-sort ] unit-test
+
+[ { 270000000 270000001 } ]
+[ T{ slice f 270000000 270000002 270000002 } natural-sort ]
+unit-test
+
+[ t ] [
+    100 [
+        drop
+        100 [ drop 20 random [ drop 1000 random ] map ] map natural-sort [ <=> 0 <= ] monotonic?
+    ] all?
+] unit-test
+
+[ ] [ { 1 2 } [ 2drop 1 ] sort drop ] unit-test
+
+[ 3 ] [ { 1 2 3 4 } midpoint ] unit-test
+
+[ f ] [ 3 { } [ - ] binsearch ] unit-test
+[ 0 ] [ 3 { 3 } [ - ] binsearch ] unit-test
+[ 1 ] [ 2 { 1 2 3 } [ - ] binsearch ] unit-test
+[ 3 ] [ 4 { 1 2 3 4 5 6 } [ - ] binsearch ] unit-test
+[ 1 ] [ 3.5 { 1 2 3 4 5 6 7 8 } [ - ] binsearch ] unit-test
+[ 3 ] [ 5.5 { 1 2 3 4 5 6 7 8 } [ - ] binsearch ] unit-test
+[ 10 ] [ 10 20 >vector [ - ] binsearch ] unit-test
diff --git a/core/sorting/sorting.factor b/core/sorting/sorting.factor
new file mode 100644 (file)
index 0000000..0269295
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel math sequences vectors
+sequences sequences.private growable ;
+IN: sorting
+
+: midpoint@ ( seq -- n ) length 2/ ; inline
+
+DEFER: sort
+
+<PRIVATE
+
+: <iterator> 0 tail-slice ; inline
+
+: this ( slice -- obj )
+    dup slice-from swap slice-seq nth-unsafe ; inline
+
+: next ( iterator -- )
+    dup slice-from 1+ swap set-slice-from ; inline
+
+: smallest ( iter1 iter2 quot -- elt )
+    >r over this over this r> call 0 <
+    -rot ? [ this ] keep next ; inline
+
+: (merge) ( iter1 iter2 quot accum -- )
+    >r pick empty? [
+        drop nip r> push-all
+    ] [
+        over empty? [
+            2drop r> push-all
+        ] [
+            3dup smallest r> [ push ] keep (merge)
+        ] if
+    ] if ; inline
+
+: merge ( sorted1 sorted2 quot -- result )
+    >r [ [ <iterator> ] 2apply ] 2keep r>
+    rot length rot length + <vector>
+    [ (merge) ] keep underlying ; inline
+
+: divide ( seq -- first second )
+    dup midpoint@ [ head-slice ] 2keep tail-slice ;
+
+: conquer ( first second quot -- result )
+    [ tuck >r >r sort r> r> sort ] keep merge ; inline
+
+PRIVATE>
+
+: sort ( seq quot -- sortedseq )
+    over length 1 <=
+    [ drop ] [ over >r >r divide r> conquer r> like ] if ;
+    inline
+
+: natural-sort ( seq -- sortedseq ) [ <=> ] sort ;
+
+: sort-keys ( seq -- sortedseq ) [ [ first ] compare ] sort ;
+
+: sort-values ( seq -- sortedseq ) [ [ second ] compare ] sort ;
+
+: sort-pair ( a b -- c d ) 2dup <=> 0 > [ swap ] when ;
+
+: midpoint ( seq -- elt )
+    [ midpoint@ ] keep nth-unsafe ; inline
+
+: partition ( seq n -- slice )
+    >r dup midpoint@ r> 1 < [ head-slice ] [ tail-slice ] if ;
+    inline
+
+: (binsearch) ( elt quot seq -- i )
+    dup length 1 <= [
+        slice-from 2nip
+    ] [
+        [ midpoint swap call ] 3keep roll dup zero?
+        [ drop dup slice-from swap midpoint@ + 2nip ]
+        [ partition (binsearch) ] if
+    ] if ; inline
+
+: binsearch ( elt seq quot -- i )
+    swap dup empty?
+    [ 3drop f ] [ <flat-slice> (binsearch) ] if ; inline
+
+: binsearch* ( elt seq quot -- result )
+    over >r binsearch [ r> ?nth ] [ r> drop f ] if* ; inline
diff --git a/core/sorting/summary.txt b/core/sorting/summary.txt
new file mode 100644 (file)
index 0000000..0029668
--- /dev/null
@@ -0,0 +1 @@
+Merge sort for sequences
diff --git a/core/sorting/tags.txt b/core/sorting/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/source-files/authors.txt b/core/source-files/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/source-files/source-files-docs.factor b/core/source-files/source-files-docs.factor
new file mode 100644 (file)
index 0000000..48ace61
--- /dev/null
@@ -0,0 +1,82 @@
+USING: help.markup help.syntax vocabs.loader io.files strings
+definitions quotations ;
+IN: source-files
+
+ARTICLE: "source-files" "Source files"
+"Words in the " { $vocab-link "source-files" } " vocabulary are used to keep track of loaded source files. This is used to implement features such as " { $link refresh-all } "."
+$nl
+"The source file database:"
+{ $subsection source-files }
+"The class of source files:"
+{ $subsection source-file }
+"Testing if a source file has been changed on disk:"
+{ $subsection source-modified? }
+"Words intended for the parser:"
+{ $subsection record-modified }
+{ $subsection record-checksum }
+{ $subsection record-form }
+{ $subsection xref-source }
+{ $subsection unxref-source }
+"Removing a source file from the database:"
+{ $subsection forget-source }
+"Updating the database:"
+{ $subsection reset-checksums }
+"The " { $link pathname } " class implements the definition protocol by working with the corresponding source file; see " { $link "definitions" } "." ;
+
+ABOUT: "source-files"
+
+HELP: source-files
+{ $var-description "An assoc mapping pathname strings to " { $link source-file } " instances, representing loaded source files." } ;
+
+HELP: source-file
+{ $values { "path" "a pathname string" } { "source-file" source-file } }
+{ $description "Outputs the source file associated to a path name, creating the source file first if it doesn't exist. Source files are retained in the " { $link source-files } " variable." }
+{ $class-description "Instances retain information about loaded source files, and have the following slots:"
+    { $list
+        { { $link source-file-path } " - a pathname string." }
+        { { $link source-file-modified } " - the result of " { $link file-modified } " at the time the source file was most recently loaded." }
+        { { $link source-file-checksum } " - the CRC32 checksum of the source file's contents at the time it was most recently loaded." }
+        { { $link source-file-uses } " - an assoc whose keys are words referenced from this source file's top level form." }
+        { { $link source-file-definitions } " - an assoc whose keys are definitions defined in this source file." }
+    }
+} ;
+
+HELP: source-modified?
+{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $description "Tests if the source file has been modified since it was last loaded. This compares the file's modification time and CRC32 checksum of the file's contents against previously-recorded values." } ;
+
+HELP: record-modified
+{ $values { "source-file" source-file } }
+{ $description "Records the modification time of the source file." } 
+$low-level-note ;
+
+HELP: record-checksum
+{ $values { "source-file" source-file } { "contents" string } }
+{ $description "Records the CRC32 checksm of the source file's contents." } 
+$low-level-note ;
+
+HELP: xref-source
+{ $values { "source-file" source-file } }
+{ $description "Adds the source file to the " { $link crossref } " graph enabling words to find source files which reference them in their top level forms." }
+$low-level-note ;
+
+HELP: unxref-source
+{ $values { "source-file" source-file } }
+{ $description "Removes the source file from the " { $link crossref } " graph." }
+$low-level-note ;
+
+HELP: xref-sources
+{ $description "Adds all loaded source files to the " { $link crossref } " graph. This is done during bootstrap." }
+$low-level-note ;
+
+HELP: record-form
+{ $values { "quot" quotation } { "source-file" source-file } }
+{ $description "Records usage information for a source file's top level form." }
+$low-level-note ;
+
+HELP: reset-checksums
+{ $description "Resets recorded modification times and CRC32 checksums for all loaded source files, creating a checkpoint for " { $link refresh } "." } ;
+
+HELP: forget-source
+{ $values { "path" "a pathname string" } }
+{ $description "Forgets all information known about a source file." } ;
diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor
new file mode 100644 (file)
index 0000000..f544a41
--- /dev/null
@@ -0,0 +1,77 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions generic assocs kernel math
+namespaces prettyprint sequences strings vectors words
+quotations inspector io.styles io combinators sorting
+splitting math.parser effects continuations debugger
+io.files io.crc32 io.streams.string io.streams.lines vocabs
+hashtables graphs ;
+IN: source-files
+
+SYMBOL: source-files
+
+TUPLE: source-file
+path
+modified checksum
+uses definitions ;
+
+: (source-modified?) ( path modified checksum -- ? )
+    pick file-modified rot [ 0 or ] 2apply >
+    [ swap file-crc32 number= not ] [ 2drop f ] if ;
+
+: source-modified? ( path -- ? )
+    dup source-files get at [
+        dup source-file-path ?resource-path
+        over source-file-modified
+        rot source-file-checksum
+        (source-modified?)
+    ] [
+        ?resource-path exists?
+    ] ?if ;
+
+: record-modified ( source-file -- )
+    dup source-file-path ?resource-path file-modified
+    swap set-source-file-modified ;
+
+: record-checksum ( source-file contents -- )
+    crc32 swap set-source-file-checksum ;
+
+: (xref-source) ( source-file -- pathname uses )
+    dup source-file-path <pathname> swap source-file-uses
+    [ interned? ] subset ;
+
+: xref-source ( source-file -- )
+    (xref-source) crossref get add-vertex ;
+
+: unxref-source ( source-file -- )
+    (xref-source) crossref get remove-vertex ;
+
+: xref-sources ( -- )
+    source-files get [ nip xref-source ] assoc-each ;
+
+: record-form ( quot source-file -- )
+    dup unxref-source
+    swap quot-uses keys over set-source-file-uses
+    xref-source ;
+
+: <source-file> ( path -- source-file )
+    { set-source-file-path } \ source-file construct ;
+
+: source-file ( path -- source-file )
+    source-files get [ <source-file> ] cache ;
+
+: reset-checksums ( -- )
+    source-files get [
+        swap ?resource-path dup exists?
+        [ <file-reader> contents record-checksum ] [ 2drop ] if
+    ] assoc-each ;
+
+M: pathname where pathname-string 1 2array ;
+
+: forget-source ( path -- )
+    dup source-file
+    dup unxref-source
+    source-file-definitions [ drop forget ] assoc-each
+    source-files get delete-at ;
+
+M: pathname forget pathname-string forget-source ;
diff --git a/core/source-files/summary.txt b/core/source-files/summary.txt
new file mode 100644 (file)
index 0000000..af6040d
--- /dev/null
@@ -0,0 +1 @@
+Support for tracking loaded source files
diff --git a/core/splitting/authors.txt b/core/splitting/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/splitting/splitting-docs.factor b/core/splitting/splitting-docs.factor
new file mode 100644 (file)
index 0000000..2535f98
--- /dev/null
@@ -0,0 +1,94 @@
+USING: help.markup help.syntax sequences strings ;
+IN: splitting
+
+ARTICLE: "sequences-split" "Splitting sequences"
+"Splitting sequences at occurrences of subsequences:"
+{ $subsection ?head }
+{ $subsection ?head-slice }
+{ $subsection ?tail }
+{ $subsection ?tail-slice }
+{ $subsection split1 }
+{ $subsection split }
+"Grouping elements:"
+{ $subsection group }
+"A virtual sequence for grouping elements:"
+{ $subsection groups }
+{ $subsection <groups> }
+{ $subsection <sliced-groups> }
+"Splitting a string into lines:"
+{ $subsection string-lines } ;
+
+ABOUT: "sequences-split"
+
+HELP: split1
+{ $values { "seq" "a sequence" } { "subseq" "a sequence" } { "before" "a new sequence" } { "after" "a new sequence" } }
+{ $description "Splits " { $snippet "seq" } " at the first occurrence of " { $snippet "subseq" } ", and outputs the pieces before and after the split. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ;
+
+HELP: last-split1
+{ $values { "seq" "a sequence" } { "subseq" "a sequence" } { "before" "a new sequence" } { "after" "a new sequence" } }
+{ $description "Splits " { $snippet "seq" } " at the last occurrence of " { $snippet "subseq" } ", and outputs the pieces before and after the split. If " { $snippet "subseq" } " does not occur in " { $snippet "seq" } ", then " { $snippet "before" } " is just " { $snippet "seq" } " and " { $snippet "after" } " is " { $link f } "." } ;
+
+{ split1 last-split1 } related-words
+
+HELP: split
+{ $values { "seq" "a sequence" } { "separators" "a sequence" } { "pieces" "a new array" } }
+{ $description "Splits " { $snippet "seq" } " at each occurrence of an element of " { $snippet "separators" } ", and outputs an array of pieces. The pieces do not include the elements along which the sequence was split." }
+{ $examples { $example "USE: splitting" "\"hello world-how are you?\" \" -\" split ." "{ \"hello\" \"world\" \"how\" \"are\" \"you?\" }" } } ;
+
+HELP: groups
+{ $class-description "Instances are virtual sequences whose elements are fixed-length subsequences or slices of an underlying sequence. Groups are mutable and resizable if the underlying sequence is mutable and resizable, respectively."
+$nl
+"New groups are created by calling " { $link <groups> } " and " { $link <sliced-groups> } "." }
+{ $see-also group } ;
+
+HELP: group
+{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
+{ $description "Splits the sequence into groups of " { $snippet "n" } " elements and collects the groups into a new array." }
+{ $notes "If the sequence length is not a multiple of " { $snippet "n" } ", the final subsequence in the list will be shorter than " { $snippet "n" } " elements." } ;
+
+HELP: <groups>
+{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } }
+{ $description "Outputs a virtual sequence whose elements are subsequences consisting of groups of " { $snippet "n" } " elements from the underlying sequence." }
+{ $examples
+    { $example
+        "USE: splitting"
+        "9 >array 3 <groups> dup reverse-here concat >array ." "{ 6 7 8 3 4 5 0 1 2 }"
+    }
+} ;
+
+HELP: <sliced-groups>
+{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } }
+{ $description "Outputs a virtual sequence whose elements are slices consisting of groups of " { $snippet "n" } " elements from the underlying sequence." }
+{ $examples
+    { $example
+        "USE: splitting"
+        "9 >array 3 <sliced-groups>"
+        "dup [ reverse-here ] each concat >array ."
+        "{ 2 1 0 5 4 3 8 7 6 }"
+    }
+} ;
+
+{ group <groups> <sliced-groups> } related-words
+
+HELP: ?head
+{ $values { "seq" "a sequence" } { "begin" "a sequence" } { "newseq" "a new sequence" } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "begin" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ;
+
+HELP: ?head-slice
+{ $values { "seq" "a sequence" } { "begin" "a sequence" } { "newseq" slice } { "?" "a boolean" } }
+{ $description "Like " { $link ?head } ", except the resulting sequence is a " { $link slice } "." } ;
+
+HELP: ?tail
+{ $values { "seq" "a sequence" } { "end" "a sequence" } { "newseq" "a new sequence" } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "seq" } " ends with " { $snippet "end" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "end" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ;
+
+HELP: ?tail-slice
+{ $values { "seq" "a sequence" } { "end" "a sequence" } { "newseq" slice } { "?" "a boolean" } }
+{ $description "Like " { $link ?tail } ", except the resulting sequence is a " { $link slice } "." } ;
+
+HELP: string-lines
+{ $values { "str" string } { "seq" "a sequence of strings" } }
+{ $description "Splits a string along line breaks." }
+{ $examples
+    { $example "USE: splitting" "\"Hello\\r\\nworld\\n\" string-lines ." "{ \"Hello\" \"world\" \"\" }" }
+} ;
diff --git a/core/splitting/splitting-tests.factor b/core/splitting/splitting-tests.factor
new file mode 100644 (file)
index 0000000..3ca7824
--- /dev/null
@@ -0,0 +1,58 @@
+USING: splitting tools.test ;
+IN: temporary
+
+[ { 1 2 3 } 0 group ] unit-test-fails
+
+[ { "hell" "o wo" "rld" } ] [ "hello world" 4 group ] unit-test
+
+[ "hello" "world ." ] [ "hello world ." " " split1 ] unit-test
+[ "hello" "world-+." ] [ "hello-+world-+." "-+" split1 ] unit-test
+[ "goodbye" f ] [ "goodbye" " " split1 ] unit-test
+[ "" "" ] [ "great" "great" split1 ] unit-test
+
+[ "hello world" "." ] [ "hello world ." " " last-split1 ] unit-test
+[ "hello-+world" "." ] [ "hello-+world-+." "-+" last-split1 ] unit-test
+[ "goodbye" f ] [ "goodbye" " " last-split1 ] unit-test
+[ "" "" ] [ "great" "great" last-split1 ] unit-test
+
+[ "and end" t ] [ "Beginning and end" "Beginning " ?head ] unit-test
+[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?head ] unit-test
+[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?head ] unit-test
+
+[ "Beginning" t ] [ "Beginning and end" " and end" ?tail ] unit-test
+[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?tail ] unit-test
+[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?tail ] unit-test
+
+[ { "This" "is" "a" "split" "sentence" } ]
+[ "This is a split sentence" " " split ]
+unit-test
+
+[ { "OneWord" } ]
+[ "OneWord" " " split ]
+unit-test
+
+[ { "a" "b" "c" "d" "e" "f" } ]
+[ "aXbYcXdYeXf" "XY" split ] unit-test
+
+[ { "" "" } ]
+[ " " " " split ] unit-test
+
+[ { "hey" } ]
+[ "hey" " " split ] unit-test
+
+[ "Hello world" t ] [ "Hello world\n" "\n" ?tail ] unit-test
+[ "Hello world" f ] [ "Hello world" "\n" ?tail ] unit-test
+[ "" t ] [ "\n" "\n" ?tail ] unit-test
+[ "" f ] [ "" "\n" ?tail ] unit-test
+
+[ { "" } ] [ "" string-lines ] unit-test
+[ { "" "" } ] [ "\n" string-lines ] unit-test
+[ { "" "" } ] [ "\r" string-lines ] unit-test
+[ { "" "" } ] [ "\r\n" string-lines ] unit-test
+[ { "hello" } ] [ "hello" string-lines ] unit-test
+[ { "hello" "" } ] [ "hello\n" string-lines ] unit-test
+[ { "hello" "" } ] [ "hello\r" string-lines ] unit-test
+[ { "hello" "" } ] [ "hello\r\n" string-lines ] unit-test
+[ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test
+[ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test
+[ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test
diff --git a/core/splitting/splitting.factor b/core/splitting/splitting.factor
new file mode 100644 (file)
index 0000000..c6230eb
--- /dev/null
@@ -0,0 +1,80 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math namespaces strings arrays vectors sequences ;
+IN: splitting
+
+TUPLE: groups seq n sliced? ;
+
+: check-groups 0 <= [ "Invalid group count" throw ] when ;
+
+: <groups> ( seq n -- groups )
+    dup check-groups f groups construct-boa ; inline
+
+: <sliced-groups> ( seq n -- groups )
+    <groups> t over set-groups-sliced? ;
+
+M: groups length
+    dup groups-seq length swap groups-n [ + 1- ] keep /i ;
+
+M: groups set-length
+    [ groups-n * ] keep delegate set-length ;
+
+: group@ ( n groups -- from to seq )
+    [ groups-n [ * dup ] keep + ] keep
+    groups-seq [ length min ] keep ;
+
+M: groups nth
+    [ group@ ] keep
+    groups-sliced? [ <slice> ] [ subseq ] if ;
+
+M: groups set-nth
+    group@ <slice> 0 swap copy ;
+
+M: groups like drop { } like ;
+
+INSTANCE: groups sequence
+
+: group ( seq n -- array ) <groups> { } like ;
+
+: ?head ( seq begin -- newseq ? )
+    2dup head? [ length tail t ] [ drop f ] if ;
+
+: ?head-slice ( seq begin -- newseq ? )
+    2dup head? [ length tail-slice t ] [ drop f ] if ;
+
+: ?tail ( seq end -- newseq ? )
+    2dup tail? [ length head* t ] [ drop f ] if ;
+
+: ?tail-slice ( seq end -- newseq ? )
+    2dup tail? [ length head-slice* t ] [ drop f ] if ;
+
+: split1 ( seq subseq -- before after )
+    dup pick start dup [
+        [ >r over r> head -rot length ] keep + tail
+    ] [
+        2drop f
+    ] if ;
+
+: last-split1 ( seq subseq -- before after )
+    [ <reversed> ] 2apply split1 [ reverse ] 2apply
+    dup [ swap ] when ;
+
+: (split) ( separators n seq -- )
+    3dup rot [ member? ] curry find* drop
+    [ [ swap subseq , ] 2keep 1+ swap (split) ]
+    [ swap dup zero? [ drop ] [ tail ] if , drop ] if* ; inline
+
+: split, ( seq separators -- ) 0 rot (split) ;
+
+: split ( seq separators -- pieces ) [ split, ] { } make ;
+
+: string-lines ( str -- seq )
+    dup [ "\r\n" member? ] contains? [
+        "\n" split [
+            1 head-slice* [
+                "\r" ?tail drop "\r" split
+            ] map
+        ] keep peek "\r" split add concat
+    ] [
+        1array
+    ] if ;
diff --git a/core/splitting/summary.txt b/core/splitting/summary.txt
new file mode 100644 (file)
index 0000000..3f9b4b9
--- /dev/null
@@ -0,0 +1 @@
+Splitting sequences and grouping sequence elements
diff --git a/core/splitting/tags.txt b/core/splitting/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/strings/authors.txt b/core/strings/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/strings/strings-docs.factor b/core/strings/strings-docs.factor
new file mode 100644 (file)
index 0000000..d42e8cc
--- /dev/null
@@ -0,0 +1,112 @@
+USING: arrays byte-arrays bit-arrays help.markup help.syntax
+kernel kernel.private strings.private sequences vectors
+sbufs math ;
+IN: strings
+
+ARTICLE: "strings" "Strings"
+"A string is a fixed-size mutable sequence of characters. The literal syntax is covered in " { $link "syntax-strings" } "."
+$nl
+"String words are found in the " { $vocab-link "strings" } " vocabulary."
+$nl
+"Strings form a class:"
+{ $subsection string }
+{ $subsection string? }
+"Creating strings:"
+{ $subsection >string }
+{ $subsection <string> }
+"Creating a string from a single character:"
+{ $subsection 1string }
+"Characters are not a first-class type; they are simply represented as integers between 0 and 65535. A few words operate on characters:"
+{ $subsection blank? }
+{ $subsection letter? }
+{ $subsection LETTER? }
+{ $subsection digit? }
+{ $subsection printable? }
+{ $subsection control? }
+{ $subsection quotable? }
+{ $subsection ch>lower }
+{ $subsection ch>upper } ;
+
+ABOUT: "strings"
+
+HELP: string
+{ $description "The class of fixed-length character strings. See " { $link "syntax-strings" } " for syntax and " { $link "strings" } " for general information." } ;
+
+HELP: char-slot ( n string -- ch )
+{ $values { "n" fixnum } { "string" string } { "ch" "the character at the " { $snippet "n" } "th index" } }
+{ $description "Unsafe string accessor, used to define " { $link nth } " on strings." }
+{ $warning "This word is in the " { $vocab-link "strings.private" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link nth } " instead." } ;
+
+HELP: set-char-slot ( ch n string -- )
+{ $values { "ch" "a character" } { "n" fixnum } { "string" string }  }
+{ $description "Unsafe string mutator, used to define " { $link set-nth } " on strings." }
+{ $warning "This word is in the " { $vocab-link "strings.private" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link set-nth } " instead." } ;
+
+HELP: <string> ( n ch -- string )
+{ $values { "n" "a positive integer specifying string length" } { "ch" "an initial character" } { "string" string } }
+{ $description "Creates a new string with the given length and all characters initially set to " { $snippet "ch" } "." } ;
+
+HELP: blank?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for an ASCII whitespace character." } ;
+
+HELP: letter?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for a lowercase alphabet ASCII character." } ;
+
+HELP: LETTER?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for a uppercase alphabet ASCII character." } ;
+
+HELP: digit?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for an ASCII decimal digit character." } ;
+
+HELP: Letter?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for an ASCII alphabet character, both upper and lower case." } ;
+
+HELP: alpha?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for an alphanumeric ASCII character." } ;
+
+HELP: printable?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for a printable ASCII character." } ;
+
+HELP: control?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for an ASCII control character." } ;
+
+HELP: quotable?
+{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $description "Tests for characters which may appear in a Factor string literal without escaping." } ;
+
+HELP: ch>lower
+{ $values { "ch" "a character" } { "lower" "a character" } }
+{ $description "Converts a character to lowercase." } ;
+
+HELP: ch>upper
+{ $values { "ch" "a character" } { "upper" "a character" } }
+{ $description "Converts a character to uppercase." } ;
+
+HELP: >lower
+{ $values { "str" string } { "lower" string } }
+{ $description "Converts a string to lowercase." } ;
+
+HELP: >upper
+{ $values { "str" string } { "upper" string } }
+{ $description "Converts a string to uppercase." } ;
+
+HELP: 1string
+{ $values { "ch" "a character"} { "str" string } }
+{ $description "Outputs a string of one character." } ;
+
+HELP: >string
+{ $values { "seq" "a sequence of characters" } { "str" string } }
+{ $description "Outputs a freshly-allocated string with the same elements as a given sequence." }
+{ $errors "Throws an error if the sequence contains elements other than real numbers." } ;
+
+HELP: resize-string ( n str -- newstr )
+{ $values { "n" "a non-negative integer" } { "str" string } { "newstr" string } }
+{ $description "Creates a new string " { $snippet "n" } " characters long The contents of the existing string are copied into the new string; if the new string is shorter, only an initial segment is copied, and if the new string is longer the remaining space is filled with " { $snippet "\\u0000" } "." } ;
diff --git a/core/strings/strings-tests.factor b/core/strings/strings-tests.factor
new file mode 100644 (file)
index 0000000..88f6f3e
--- /dev/null
@@ -0,0 +1,68 @@
+USING: continuations kernel math namespaces strings sbufs
+tools.test sequences vectors ;
+IN: temporary
+
+[ CHAR: b ] [ 1 >bignum "abc" nth ] unit-test
+
+[ ] [ 10 [ [ -1000000 <sbuf> ] catch drop ] times ] unit-test
+
+[ "abc" ] [ [ "a" "b" "c" ] [ [ % ] each ] "" make ] unit-test
+
+[ "abc" ] [ "ab" "c" append ] unit-test
+[ "abc" ] [ "a" "b" "c" 3append ] unit-test
+
+[ 3 ] [ "a" "hola" start ] unit-test
+[ f ] [ "x" "hola" start ] unit-test
+[ 0 ] [ "" "a" start ] unit-test
+[ 0 ] [ "" "" start ] unit-test
+[ 0 ] [ "hola" "hola" start ] unit-test
+[ 1 ] [ "ol" "hola" start ] unit-test
+[ f ] [ "amigo" "hola" start ] unit-test
+[ f ] [ "holaa" "hola" start ] unit-test
+
+[ "Beginning" ] [ "Beginning and end" 9 head ] unit-test
+
+[ f ] [ CHAR: I "team" member? ] unit-test
+[ t ] [ "ea" "team" subseq? ] unit-test
+[ f ] [ "actore" "Factor" subseq? ] unit-test
+
+[ "end" ] [ "Beginning and end" 14 tail ] unit-test
+
+[ t ] [ CHAR: a letter? ] unit-test
+[ f ] [ CHAR: A letter? ] unit-test
+[ f ] [ CHAR: a LETTER? ] unit-test
+[ t ] [ CHAR: A LETTER? ] unit-test
+[ t ] [ CHAR: 0 digit? ] unit-test
+[ f ] [ CHAR: x digit? ] unit-test
+
+[ t ] [ "abc" "abd" <=> 0 < ] unit-test
+[ t ] [ "z" "abd" <=> 0 > ] unit-test
+
+[ f ] [ [ 0 10 "hello" subseq ] catch not ] unit-test
+
+[ 4 ] [
+    0 "There are Four Upper Case characters"
+    [ LETTER? [ 1+ ] when ] each
+] unit-test
+
+[ "Replacing+spaces+with+plus" ]
+[
+    "Replacing spaces with plus"
+    [ dup CHAR: \s = [ drop CHAR: + ] when ] map
+]
+unit-test
+
+[ "05" ] [ "5" 2 CHAR: 0 pad-left ] unit-test
+[ "666" ] [ "666" 2 CHAR: 0 pad-left ] unit-test
+
+[ 1 "" nth ] unit-test-fails
+[ -6 "hello" nth ] unit-test-fails
+
+[ t ] [ "hello world" dup >vector >string = ] unit-test 
+
+[ "ab" ] [ 2 "abc" resize-string ] unit-test
+[ "abc\0\0\0" ] [ 6 "abc" resize-string ] unit-test
+
+! Random tester found this
+[ { "kernel-error" 3 12 -7 } ]
+[ [ 2 -7 resize-string ] catch ] unit-test
diff --git a/core/strings/strings.factor b/core/strings/strings.factor
new file mode 100644 (file)
index 0000000..e177a2b
--- /dev/null
@@ -0,0 +1,76 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math.private sequences kernel.private
+math sequences.private slots.private ;
+IN: strings
+
+<PRIVATE
+
+: string-hashcode 2 slot ; inline
+
+: set-string-hashcode 2 set-slot ; inline
+
+: reset-string-hashcode f swap set-string-hashcode ; inline
+
+: rehash-string ( str -- )
+    dup 0 [ swap 31 fixnum*fast fixnum+fast ] reduce
+    swap set-string-hashcode ; inline
+
+PRIVATE>
+
+M: string equal?
+    over string? [
+        over hashcode over hashcode number=
+        [ sequence= ] [ 2drop f ] if
+    ] [
+        2drop f
+    ] if ;
+
+M: string hashcode*
+    nip dup string-hashcode [ ]
+    [ dup rehash-string string-hashcode ] ?if ;
+
+M: string nth-unsafe >r >fixnum r> char-slot ;
+
+M: string set-nth-unsafe 
+    dup reset-string-hashcode
+    >r >fixnum >r >fixnum r> r> set-char-slot ;
+
+M: string clone (clone) ;
+
+M: string resize resize-string ;
+
+! Characters
+: blank? ( ch -- ? ) " \t\n\r" member? ; inline
+: letter? ( ch -- ? ) CHAR: a CHAR: z between? ; inline
+: LETTER? ( ch -- ? ) CHAR: A CHAR: Z between? ; inline
+: digit? ( ch -- ? ) CHAR: 0 CHAR: 9 between? ; inline
+: printable? ( ch -- ? ) CHAR: \s CHAR: ~ between? ; inline
+: control? ( ch -- ? ) "\0\e\r\n\t\u0008\u007f" member? ; inline
+
+: quotable? ( ch -- ? )
+    dup printable? [ "\"\\" member? not ] [ drop f ] if ; inline
+
+: Letter? ( ch -- ? )
+    dup letter? [ drop t ] [ LETTER? ] if ; inline
+
+: alpha? ( ch -- ? )
+    dup Letter? [ drop t ] [ digit? ] if ; inline
+
+: ch>lower ( ch -- lower )
+    dup LETTER? [ HEX: 20 + ] when ; inline
+
+: ch>upper ( ch -- upper )
+    dup letter? [ HEX: 20 - ] when ; inline
+
+: >lower ( str -- lower ) [ ch>lower ] map ;
+
+: >upper ( str -- upper ) [ ch>upper ] map ;
+
+: 1string ( ch -- str ) 1 swap <string> ;
+
+: >string ( seq -- str ) "" clone-like ;
+
+M: string new drop 0 <string> ;
+
+INSTANCE: string sequence
diff --git a/core/strings/summary.txt b/core/strings/summary.txt
new file mode 100644 (file)
index 0000000..3833a9a
--- /dev/null
@@ -0,0 +1 @@
+Fixed-size character arrays
diff --git a/core/strings/tags.txt b/core/strings/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/syntax/authors.txt b/core/syntax/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/syntax/early-parser.factor b/core/syntax/early-parser.factor
deleted file mode 100644 (file)
index 8562736..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: parser
-USING: arrays errors generic hashtables kernel math namespaces
-sequences strings vectors words ;
-
-SYMBOL: use
-SYMBOL: in
-
-SYMBOL: file
-SYMBOL: line-number
-
-SYMBOL: line-text
-SYMBOL: column-number
-
-TUPLE: check-vocab name ;
-: check-vocab ( name -- vocab )
-    dup vocab [ ] [
-        <check-vocab>
-        { { "Continue" f } } condition
-    ] ?if ;
-
-: use+ ( vocab -- ) check-vocab [ use get push ] when* ;
-
-: add-use ( seq -- ) [ use+ ] each ;
-
-: set-use ( seq -- )
-    [ check-vocab ] map [ ] subset >vector use set ;
-
-: set-in ( name -- )
-    dup string?
-    [ "Vocabulary name must be a string" throw ] unless
-    dup ensure-vocab dup in set use+ ;
-
-: parsing? ( obj -- ? )
-    dup word? [ "parsing" word-prop ] [ drop f ] if ;
-
-: location ( -- loc )
-    file get line-number get 2dup and
-    [ 2array ] [ 2drop f ] if ;
-
-: save-location ( word -- )
-    dup set-word location "loc" set-word-prop ;
-
-: create-in ( string -- word )
-    in get create dup save-location ;
-
-: create-constructor ( class -- word )
-    dup word-name swap word-vocabulary constructor-word
-    dup save-location ;
-
-TUPLE: parse-error file line col text ;
-
-C: parse-error ( msg -- error )
-    file get over set-parse-error-file
-    line-number get over set-parse-error-line
-    column-number get over set-parse-error-col
-    line-text get over set-parse-error-text
-    [ set-delegate ] keep ;
diff --git a/core/syntax/early-parser.facts b/core/syntax/early-parser.facts
deleted file mode 100644 (file)
index 96527b3..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-USING: help kernel parser sequences ;
-
-IN: help
-: $parsing-note
-    drop
-    "This word should only be called from parsing words."
-    $notes ;
-
-HELP: use
-{ $var-description "A variable holding the current vocabulary search path as a sequence of hashtables." }
-{ $see-also in use+ set-use POSTPONE: USING: POSTPONE: USE: } ;
-
-HELP: in
-{ $var-description "A variable holding the current vocabulary for new definitions." }
-{ $see-also use set-in POSTPONE: IN: } ;
-
-HELP: check-vocab
-{ $values { "name" "a string" } { "vocab" "a hashtable or " { $link f } } }
-{ $description "Outputs a named vocabulary. If the vocabulary does not exist, throws a restartable " { $link check-vocab } " error. If the user invokes the restart, this word outputs " { $link f } "." }
-{ $error-description "Thrown by " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " when a given vocabulary does not exist. Vocabularies must be created by " { $link POSTPONE: IN: } " before being used." } ;
-
-HELP: use+
-{ $values { "vocab" "a string" } }
-{ $description "Adds a new vocabulary at the front of the search path. Subsequent word lookups by the parser will search this vocabulary first." }
-$parsing-note
-{ $errors "Throws an error if the vocabulary does not exist." }
-{ $see-also in use add-use set-use POSTPONE: USE: } ;
-
-HELP: set-use
-{ $values { "seq" "a sequence of strings" } }
-{ $description "Sets the vocabulary search path. Later vocabularies take precedence." }
-{ $errors "Throws an error if one of the vocabularies does not exist." }
-$parsing-note
-{ $see-also in use use+ add-use file-vocabs } ;
-
-HELP: add-use
-{ $values { "seq" "a sequence of strings" } }
-{ $description "Adds multiple vocabularies to the search path, with later vocabularies taking precedence." }
-{ $errors "Throws an error if one of the vocabularies does not exist." }
-$parsing-note
-{ $see-also in use use+ set-use POSTPONE: USING: } ;
-
-HELP: set-in
-{ $values { "name" "a string" } }
-{ $description "Sets the current vocabulary where new words will be defined, creating the vocabulary first if it does not exist." }
-$parsing-note
-{ $see-also in use POSTPONE: IN: } ;
-
-HELP: parsing?
-{ $values { "obj" "an object" } { "?" "a boolean" } }
-{ $description "Tests if an object is a parsing word." }
-{ $notes "Outputs " { $link f } " if the object is not a word." } ;
-
-HELP: file
-{ $var-description "Variable stores the file name being parsed. This is the input parameter to " { $link parse-stream } "." } ;
-
-HELP: line-number
-{ $var-description "Variable holds the line number being parsed." } ;
-
-HELP: line-text
-{ $var-description "Variable holds the text of the line being parsed." } ;
-
-HELP: column
-{ $var-description "Variable holds the column number being parsed." } ;
-
-HELP: save-location
-{ $values { "word" "a word" } }
-{ $description "Sets the " { $snippet "\"file\"" } " and " {  $snippet "\"line\"" } " word properties to the current parser location." }
-$parsing-note ;
-
-HELP: create-in
-{ $values { "string" "a word name" } { "word" "a new word" } }
-{ $description "Creates a word in the current vocabulary. Until re-defined, the word throws an error when invoked." }
-$parsing-note ;
-
-HELP: create-constructor
-{ $values { "class" "a word" } { "word" "a new word" } }
-{ $description "Creates a new word in the current vocabulary, named by surrounding " { $snippet "class" } " with angle brackets." }
-{ $examples
-    { $example "SYMBOL: foo" "foo create-constructor ." "<foo>" }
-} ;
-
-HELP: parse-error
-{ $error-description "Thrown when the parser encounters invalid input. A parse error wraps an underlying error and holds the file being parsed, line number, and column number." } ;
diff --git a/core/syntax/parse-stream.factor b/core/syntax/parse-stream.factor
deleted file mode 100644 (file)
index 883d6de..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: parser
-USING: arrays errors generic hashtables io kernel math
-namespaces sequences words ;
-
-SYMBOL: source-files
-
-TUPLE: source-file path modified definitions ;
-
-: source-file-modified* ( source-file -- n )
-    source-file-path ?resource-path
-    file-modified [ 0 ] unless* ;
-
-: record-modified ( file -- )
-    dup source-file-modified* swap set-source-file-modified ;
-
-: reset-modified ( -- )
-    source-files get hash-values [ record-modified ] each ;
-
-C: source-file ( path -- source-file )
-    [ set-source-file-path ] keep
-    V{ } clone over set-source-file-definitions
-    dup record-modified ;
-
-: source-modified? ( file -- ? )
-    source-files get hash [
-        dup source-file-modified swap source-file-modified*
-        [ < ] [ drop f ] if*
-    ] [
-        t
-    ] if* ;
-
-: file-vocabs ( -- )
-    "scratchpad" set-in { "syntax" "scratchpad" } set-use ;
-
-: with-parser ( quot -- )
-    0 line-number set [ <parse-error> rethrow ] recover ;
-
-: parse-lines ( lines -- quot )
-    [ f [ (parse) ] reduce >quotation ] with-parser ;
-
-: parse ( str -- quot ) string-lines parse-lines ;
-
-: eval ( str -- ) parse call ;
-
-SYMBOL: parse-hook
-
-: do-parse-hook ( -- ) parse-hook get call ;
-
-: parse-stream ( stream name -- quot )
-    [
-        file set file-vocabs
-        lines parse-lines
-        do-parse-hook
-    ] with-scope ;
-
-: parsing-file ( file -- )
-    "quiet" get [
-        drop
-    ] [
-        "Loading " write write-pathname terpri flush
-    ] if ;
-
-: record-file ( file -- )
-    [ <source-file> ] keep source-files get set-hash ;
-
-: parse-file-restarts ( file -- restarts )
-    "Load " swap " again" 3append t 2array 1array ;
-
-: parse-file ( file -- quot )
-    [
-        [ parsing-file ] keep
-        [ ?resource-path <file-reader> ] keep
-        [ parse-stream ] keep
-        record-file
-    ] [
-        over parse-file-restarts condition drop parse-file
-    ] recover ;
-
-: run-file ( file -- ) parse-file call ;
-
-: no-parse-hook ( quot -- )
-    [ parse-hook off call ] with-scope ; inline
-
-: run-files ( seq -- )
-    [
-        bootstrapping? get
-        [ parse-file % ] [ run-file ] ? each
-    ] no-parse-hook ;
-
-: eval>string ( str -- str )
-    [ [ [ eval ] keep ] try drop ] string-out ;
diff --git a/core/syntax/parse-stream.facts b/core/syntax/parse-stream.facts
deleted file mode 100644 (file)
index bd69d39..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-USING: help io parser definitions ;
-
-HELP: file-vocabs
-{ $description "Installs the initial the vocabulary search path for parsing a file." } ;
-
-HELP: parse-lines
-{ $values { "lines" "a sequence of strings" } { "quot" "a new quotation" } }
-{ $description "Parses the Factor source code which has been tokenized into lines. The vocabulary search path is taken from the current scope." }
-{ $errors "Throws a parse error if the input is malformed." } ;
-
-HELP: with-parser
-{ $values { "quot" "a quotation" } }
-{ $description "Calls a quotation, wrapping any errors thrown inside parse errors." } ;
-
-HELP: parse
-{ $values { "str" "a string" } { "quot" "a new quotation" } }
-{ $description "Parses Factor source code from a string. The current vocabulary search path is used." }
-{ $errors "Throws a parse error if the input is malformed." } ;
-
-HELP: eval
-{ $values { "str" "a string" } }
-{ $description "Parses Factor source code from a string, and calls the resulting quotation. The current vocabulary search path is used." }
-{ $errors "Throws an error if the input is malformed, or if the quotation throws an error." } ;
-
-HELP: parse-hook
-{ $var-description "A quotation called by " { $link parse-stream } " after parsing the input stream. The default value recompiles new word definitions; see " { $link "recompile" } " for details." }
-{ $see-also no-parse-hook } ;
-
-HELP: no-parse-hook
-{ $values { "quot" "a quotation" } }
-{ $description "Runs the quotation in a new dynamic scope where " { $link parse-hook } " is set to " { $link f } ". This disables the default behavior of recompiling changed definitions after a source file is loaded." } ;
-
-HELP: run-files
-{ $values { "seq" "a sequence of strings" } }
-{ $description "Load a collection of source files."
-$terpri
-"If bootstrapping, this word appends the top-level forms to the currently constructing quotation instead." } ;
-
-HELP: parse-stream
-{ $values { "stream" "an input stream" } { "name" "a file name for error reporting" } { "quot" "a new quotation" } }
-{ $description "Parses Factor source code read from the stream. The initial vocabulary search path is used." }
-{ $errors "Throws an I/O error if there was an error reading from the stream. Throws a parse error if the input is malformed." } ;
-
-HELP: parse-file
-{ $values { "file" "a path name string" } { "quot" "a new quotation" } }
-{ $description "Parses the Factor source code stored in a file. The initial vocabulary search path is used." }
-{ $errors "Throws an I/O error if there was an error reading from the file. Throws a parse error if the input is malformed." } ;
-
-HELP: run-file
-{ $values { "file" "a path name string" } }
-{ $description "Parses the Factor source code stored in a file and runs it. The initial vocabulary search path is used." }
-{ $errors "Throws an error if loading the file fails, there input is malformed, or if a runtime error occurs while calling the parsed quotation." }  ;
diff --git a/core/syntax/parse-syntax.factor b/core/syntax/parse-syntax.factor
deleted file mode 100644 (file)
index f62a964..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-
-! We define these words in !syntax with ! prefixes to avoid
-! clashing with the host parsing words when we are building the
-! target image. The end of boot-stage1.factor renames the
-! !syntax vocab to syntax, and removes the ! prefix from each
-! word name.
-IN: !syntax
-USING: alien arrays definitions errors generic
-hashtables kernel math modules namespaces parser sequences
-strings vectors words ;
-
-: !! line-text get length column-number set ; parsing
-: !#! POSTPONE: ! ; parsing
-: !IN: scan set-in ; parsing
-: !USE: scan use+ ; parsing
-: !USING: string-mode on [ string-mode off add-use ] f ; parsing
-: !HEX: 16 parse-base ; parsing
-: !OCT: 8 parse-base ; parsing
-: !BIN: 2 parse-base ; parsing
-SYMBOL: !t
-: !f f parsed ; parsing
-: !CHAR: 0 scan next-char nip parsed ; parsing
-: !" parse-string parsed ; parsing
-: !SBUF" skip-blank parse-string >sbuf parsed ; parsing
-: ![ f ; parsing
-: !] >quotation parsed ; parsing
-: !; >quotation swap call ; parsing
-: !} swap call parsed ; parsing
-: !{ [ >array ] f ; parsing
-: !V{ [ >vector ] f ; parsing
-: !H{ [ alist>hash ] f ; parsing
-: !C{ [ first2 rect> ] f ; parsing
-: !T{ [ >tuple ] f ; parsing
-: !W{ [ first <wrapper> ] f ; parsing
-: !POSTPONE: scan-word parsed ; parsing
-: !\ scan-word literalize parsed ; parsing
-: !parsing word t "parsing" set-word-prop ; parsing
-: !inline word  t "inline" set-word-prop ; parsing
-: !foldable word t "foldable" set-word-prop ; parsing
-: !SYMBOL: CREATE dup reset-generic define-symbol ; parsing
-
-DEFER: !PRIMITIVE: parsing
-: !DEFER: CREATE drop ; parsing
-: !: CREATE dup reset-generic [ define-compound ] f ; parsing
-: !GENERIC: CREATE dup reset-word define-generic ; parsing
-: !G: CREATE dup reset-word [ define-generic* ] f ; parsing
-: !M:
-    f set-word
-    scan-word scan-word location
-    [ <method> -rot define-method ] f ; parsing
-
-: !UNION:
-    CREATE dup intern-symbol dup predicate-word
-    [ dupd unit "predicate" set-word-prop ] keep
-    [ define-union ] f ; parsing
-
-: !PREDICATE:
-    scan-word CREATE dup intern-symbol
-    dup rot "superclass" set-word-prop dup predicate-word
-    [ define-predicate-class ] f ; parsing
-
-: !TUPLE:
-    scan string-mode on [ string-mode off define-tuple ] f ;
-    parsing
-
-: !C:
-    scan-word
-    [ create-constructor dup reset-generic dup set-word ] keep
-    [ define-constructor ] f ; parsing
-
-: !FORGET: scan use get hash-stack [ forget ] when* ; parsing
-
-: !PROVIDE: scan location [ provide ] f ; parsing
-
-: !REQUIRES:
-    string-mode on [
-        string-mode off
-        [ [ require ] each ] no-parse-hook
-    ] f ; parsing
-
-: !MAIN:
-    scan [ swap module set-module-main ] f ; parsing
-
-: !(
-    parse-effect word [
-        swap "declared-effect" set-word-prop
-    ] [
-        drop
-    ] if* ; parsing
-
-SYMBOL: !+files+
-SYMBOL: !+tests+
-SYMBOL: !+help+
-SYMBOL: !+directory+
diff --git a/core/syntax/parse-syntax.facts b/core/syntax/parse-syntax.facts
deleted file mode 100644 (file)
index 4ed9e27..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-USING: generic help kernel math modules parser words ;
-
-HELP: parsing
-{ $syntax "parsing" }
-{ $description "Declares the most recently defined word as a parsing word." }
-{ $examples "In the below example, the " { $snippet "world" } " word is never called, however its body references a parsing word which executes immediately:" { $example ": hello \"Hello parser!\" print ; parsing\n: world hello ;" "Hello parser!" } } ;
-
-HELP: inline
-{ $syntax "inline" }
-{ $description
-    "Declares the most recently defined word as an inline word."
-    $terpri
-    "Combinators must be inlined in order to compile - see " { $link "inference-combinators" } ". For any other word, inlining is merely an optimization. Inlining does not affect the execution of the word in the interpreter."
-} ;
-
-HELP: foldable
-{ $syntax "foldable " }
-{ $description
-    "Declares that the most recently defined word may be evaluated at compile-time if all inputs are literal. Foldable words must satisfy a very strong contract:"
-    { $list
-        "foldable words must not have any observable side effects,"
-        "foldable words must halt - for example, a word computing a series until it coverges should not be foldable, since compilation will not halt in the event the series does not converge."
-        "both inputs and outputs of foldable words must be immutable."
-    }
-    "The last restriction ensures that words such as " { $link clone } " do not satisfy the foldable word contract. Indeed, " { $link clone } " will output a mutable object if its input is mutable, and so it is undesirable to evaluate it at compile-time, since doing so would give incorrect semantics for code that clones mutable objects and proceeds to mutate them."
-}
-{ $examples "Most operations on numbers are foldable. For example, " { $snippet "2 2 +" } " compiles to a literal 4, since " { $link + } " is declared foldable." } ;
-
-HELP: t
-{ $syntax "t" }
-{ $values { "t" "the canonical truth value" } }
-{ $description "The canonical instance of " { $link general-t } ". It is just a symbol." } ;
-
-HELP: f
-{ $syntax "f" }
-{ $values { "f" "the singleton false value" } }
-{ $description "The " { $link f } " parsing word adds the " { $link f } " object to the parse tree, and is also the class whose sole instance is the " { $link f } " object. The " { $link f } " object is the singleton false value, the only object that is not true. The " { $link f } " object is not equal to the " { $link f } " class word, which can be pushed on the stack using word wrapper syntax:"
-{ $code "f    ! the singleton f object denoting falsity\n\\ f  ! the f class word" } } ;
-
-HELP: [
-{ $syntax "[ elements... ]" }
-{ $description "Marks the beginning of a literal quotation." }
-{ $examples { $code "[ 1 2 3 ]" } }
-{ $see-also POSTPONE: ] } ;
-
-HELP: ]
-{ $syntax "]" }
-{ $description "Marks the end of a literal quotation." }
-{ $see-also POSTPONE: [ } ;
-
-HELP: }
-{ $syntax "}" }
-{ $description "Marks the end of an array, vector, hashtable, complex number, tuple, or wrapper." }
-{ $see-also POSTPONE: { POSTPONE: V{ POSTPONE: H{ POSTPONE: C{ POSTPONE: T{ POSTPONE: W{ } ;
-
-HELP: {
-{ $syntax "{ elements... }" }
-{ $values { "elements" "a list of objects" } }
-{ $description "Marks the beginning of a literal array." } 
-{ $examples { $code "{ 1 2 3 }" } } ;
-
-HELP: V{
-{ $syntax "V{ elements... }" }
-{ $values { "elements" "a list of objects" } }
-{ $description "Marks the beginning of a literal vector." } 
-{ $examples { $code "V{ 1 2 3 }" } } ;
-
-HELP: H{
-{ $syntax "H{ { key value }... }" }
-{ $values { "key" "an object" } { "value" "an object" } }
-{ $description "Marks the beginning of a literal hashtable, given as a list of two-element arrays holding key/value pairs." }
-{ $examples { $code "H{ { \"tuna\" \"fish\" } { \"jalapeno\" \"vegetable\" } }" } } ;
-
-HELP: C{
-{ $syntax "C{ real imaginary }" }
-{ $values { "real" "a real number" } { "imaginary" "a real number" } }
-{ $description "Parses a complex number given in rectangular form as a pair of real numbers." } ;
-
-HELP: T{
-{ $syntax "T{ class delegate slots... }" }
-{ $values { "class" "a tuple class word" } { "delegate" "a delegate" } { "slots" "list of objects" } }
-{ $description "Marks the beginning of a literal tuple. The class word must always be specified. If an insufficient number of values is given after the class word, the remaining slots of the tuple are set to " { $link f } ". If too many values are given, an error is thrown." } ;
-
-HELP: W{
-{ $syntax "W{ object }" }
-{ $values { "object" "an object" } }
-{ $description "Marks the beginning of a literal wrapper." }
-{ $see-also POSTPONE: \ <wrapper> literalize } ;
-
-HELP: POSTPONE:
-{ $syntax "POSTPONE: word" }
-{ $values { "word" "a word" } }
-{ $description "Reads the next word from the input string and appends the word to the parse tree, even if it is a parsing word." }
-{ $examples "For an ordinary word " { $snippet "foo" } ", " { $snippet "foo" } " and " { $snippet "POSTPONE: foo" } " are equivalent; however, if " { $snippet "foo" } " is a parsing word, the former will execute it at parse time, while the latter will execute it at runtime." }
-{ $notes "This word is used inside parsing words to delegate further action to another parsing word, and to refer to parsing words literally from literal arrays and such." } ;
-
-HELP: :
-{ $syntax ": word definition... ;" }
-{ $values { "word" "a new word to define" } { "definition" "a word definition" } }
-{ $description "Defines a compound word in the current vocabulary." }
-{ $examples { $code ": ask-name ( -- name )\n    \"What is your name? \" write readln ;\n: greet ( name -- )    \"Greetings, \" write print ;\n: friend ( -- )    ask-name greet ;" } }
-{ $see-also POSTPONE: ; define-compound } ;
-
-HELP: ;
-{ $syntax ";" }
-{ $description
-    "Marks the end of a definition."
-    $terpri
-    "Parsing words can use this word as a generic end delimiter. It has parse-time stack effect " { $snippet "( definer parsed -- )" } "; when parsed, it reverses the " { $snippet "parsed" } " quotation, and passes it as input to the " { $snippet "definer" } " quotation."
-}
-{ $see-also POSTPONE: : POSTPONE: G: POSTPONE: M: POSTPONE: C: POSTPONE: UNION: POSTPONE: PREDICATE: POSTPONE: USING: } ;
-
-HELP: SYMBOL:
-{ $syntax "SYMBOL: word" }
-{ $values { "word" "a new word to define" } }
-{ $description "Defines a new symbol word in the current vocabulary. Symbols push themselves on the stack when executed, and are used to identify variables (see " { $link "namespaces" } ") as well as for storing crufties in word properties (see " { $link "word-props" } ")." }
-{ $examples { $example "SYMBOL: foo\nfoo ." "foo" } } ;
-
-HELP: \
-{ $syntax "\\ word" }
-{ $values { "word" "a word" } }
-{ $description "Reads the next word from the input and appends a wrapper holding the word to the parse tree. When the evaluator encounters a wrapper, it pushes the wrapped word literally on the data stack." }
-{ $examples "The following two lines are equivalent:" { $code "0 \\ <vector> execute\n0 <vector>" } } ;
-
-HELP: DEFER:
-{ $syntax "DEFER: word" }
-{ $values { "word" "a new word to define" } }
-{ $description "Create a word in the current vocabulary that simply raises an error when executed. Usually, the word will be replaced with a real definition later." }
-{ $notes "Due to the way the parser works, words cannot be referenced before they are defined; that is, source files must order definitions in a strictly bottom-up fashion. Mutually-recursive pairs of words can be implemented by " { $emphasis "deferring" } " one of the words in the pair allowing the second word in the pair to parse, then by defining the first word." }
-{ $examples { $code "DEFER: foe\n: fie ... foe ... ;\n: foe ... fie ... ;" } } ;
-
-HELP: FORGET:
-{ $syntax "FORGET: word" }
-{ $values { "word" "a word" } }
-{ $description "Removes the word from its vocabulary, or does nothing if no such word exists. Existing definitions that reference forgotten words will continue to work, but new occurrences of the word will not parse." } ;
-
-HELP: USE:
-{ $syntax "USE: vocabulary" }
-{ $values { "vocabulary" "a vocabulary name" } }
-{ $description "Adds a new vocabulary at the front of the search path. Subsequent word lookups by the parser will search this vocabulary first." }
-{ $errors "Throws an error if the vocabulary does not exist." } ;
-
-HELP: USING:
-{ $syntax "USING: vocabularies... ;" }
-{ $values { "vocabularies" "a list of vocabulary names" } }
-{ $description "Adds a list of vocabularies to the front of the search path, with later vocabularies taking precedence." }
-{ $errors "Throws an error if one of the vocabularies does not exist." } ;
-
-HELP: IN:
-{ $syntax "IN: vocabulary" }
-{ $values { "vocabulary" "a new vocabulary name" } }
-{ $description "Sets the current vocabulary where new words will be defined, creating the vocabulary first if it does not exist. After the vocabulary has been created, it can be listed in " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " declarations." } ;
-
-HELP: CHAR:
-{ $syntax "CHAR: token" }
-{ $values { "token" "a literal character or escape code" } }
-{ $description "Adds the Unicode code point of the character represented by the token to the parse tree." } ;
-
-HELP: "
-{ $syntax "\"string...\"" }
-{ $values { "string" "literal and escaped characters" } }
-{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } ", and appends the resulting string to the parse tree. String literals cannot span multiple lines. Strings containing the " { $link POSTPONE: " } " character and various other special characters can be read by inserting escape sequences." }
-{ $examples { $example "\"Hello\\nworld\" print" "Hello\nworld" } } ;
-
-HELP: SBUF"
-{ $syntax "SBUF\" string... \"" }
-{ $values { "string" "literal and escaped characters" } }
-{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } ", converts the string to a string buffer, and appends it to the parse tree." }
-{ $examples { $example "SBUF\" Hello world\" >string print" "Hello world" } } ;
-
-HELP: (
-{ $syntax "( inputs -- outputs )" }
-{ $values { "inputs" "a list of tokens" } { "outputs" "a list of tokens" } }
-{ $description "Declares the stack effect of the most recently defined word, storing a new " { $link effect } " instance in the " { $snippet "\"declared-effect\"" } " word property." }
-{ $notes "Recursive words must have a declared stack effect to compile. See " { $link "effect-declaration" } " for details." } ;
-
-HELP: !
-{ $syntax "! comment..." }
-{ $values { "comment" "characters" } }
-{ $description "Discards all input until the end of the line." }
-{ $see-also POSTPONE: #! } ;
-
-HELP: #!
-{ $syntax "#! comment..." }
-{ $values { "comment" "characters" } }
-{ $description "Discards all input until the end of the line." }
-{ $see-also POSTPONE: ! } ;
-
-HELP: HEX:
-{ $syntax "HEX: integer" }
-{ $values { "integer" "hexadecimal digits (0-9, a-f, A-F)" } }
-{ $description "Adds an integer read from a hexadecimal literal to the parse tree." }
-{ $examples { $example "HEX: ff ." "255" } } ;
-
-HELP: OCT:
-{ $syntax "OCT: integer" }
-{ $values { "integer" "octal digits (0-7)" } }
-{ $description "Adds an integer read from an octal literal to the parse tree." }
-{ $examples { $example "OCT: 31337 ." "13023" } } ;
-
-HELP: BIN:
-{ $syntax "BIN: integer" }
-{ $values { "integer" "binary digits (0 and 1)" } }
-{ $description "Adds an integer read from an binary literal to the parse tree." }
-{ $examples { $example "BIN: 100 ." "4" } } ;
-
-HELP: GENERIC:
-{ $syntax "GENERIC: word" }
-{ $values { "word" "a new word to define" } }
-{ $description "Defines a new generic word in the current vocabulary. Initially, it contains no methods, and thus will throw a " { $link no-method } " error when called." }
-{ $notes
-    "A " { $link "method-combination" } " facility exists for customizing method dispatch behavior."
-    $terpri
-    "This parsing word is equivalent to the following usage of the more general " { $link POSTPONE: G: } " word:"
-    { $code "G: word 0 standard-combination ;" }
-}
-{ $see-also define-generic } ;
-
-HELP: G:
-{ $syntax "G: word combination... ;" }
-{ $values { "word" "a new word to define" } { "combination" "a method combination definition with stack effect " { $snippet "( word -- quot )" } } }
-{ $description "Defines a generic word using the long-form. A method combination is a quotation that is given the generic word on the stack, and outputs a quotation " { $emphasis "that becomes the definition of the word" } "." }
-{ $contract "The method combination quotation is called each time the generic word has to be updated (for example, when a method is added), and thus must be side-effect free." }
-{ $see-also define-generic* } ;
-
-HELP: M:
-{ $syntax "M: class generic definition... ;" }
-{ $values { "class" "a class word" } { "generic" "a generic word" } { "definition" "a method definition" } }
-{ $description "Defines a method, that is, a behavior for the generic word specialized on instances of the class." }
-{ $see-also define-method } ;
-
-HELP: UNION:
-{ $syntax "UNION: class members... ;" }
-{ $values { "class" "a new class word to define" } { "members" "a list of class words separated by whitespace" } }
-{ $description "Defines a union class. An object is an instance of a union class if it is an instance of one of its members." }
-{ $notes "Union classes are used to associate the same method with several different classes, as well as to conveniently define predicates." }
-{ $see-also define-union } ;
-
-HELP: PREDICATE:
-{ $syntax "PREDICATE: superclass class predicate... ;" }
-{ $values { "superclass" "an existing class word" } { "class" "a new class word to define" } { "predicate" "membership test with stack effect " { $snippet "( superclass -- ? )" } } }
-{ $description
-    "Defines a predicate class deriving from " { $snippet "superclass" } "."
-    $terpri
-    "An object is an instance of a predicate class if two conditions hold:"
-    { $list
-        "it is an instance of the predicate's superclass,"
-        "it satisfies the predicate"
-    }
-    "Each predicate must be defined as a subclass of some other class. This ensures that predicates inheriting from disjoint classes do not need to be exhaustively tested during method dispatch."
-}
-{ $see-also define-predicate-class } ;
-
-HELP: TUPLE:
-{ $syntax "TUPLE: class slots... ;" }
-{ $values { "class" "a new class word to define" } { "slots" "a list of slot names" } }
-{ $description "Defines a new tuple class with membership predicate " { $snippet "name?" } " and constructor " { $snippet "<name>" } "."
-$terpri
-"Tuples are user-defined classes with instances composed of named slots. All tuple classes are subtypes of the built-in " { $link tuple } " type." }
-{ $see-also define-tuple } ;
-
-HELP: C:
-{ $syntax "C: class definition... ;" }
-{ $values { "class" "a class word" } { "definition" "a constructor definition" } }
-{ $description "Define a constructor word for a tuple class. The constructor definition receives a new instance of the class on the stack, with all slots initially set to " { $link f } "."
-$terpri
-"Constructors are named after the tuple class surrounded in angle brackets: " { $snippet "<" } " and " { $snippet ">" } ". Constructor words are defined in the same vocabulary as the tuple class, and the current value of the " { $link in } " variable has no effect."  }
-{ $contract "The definition must only have one output, the new tuple itself." }
-{ $notes "Each tuple class defines a default constructor that reads slot values from the stack. This parsing word redefines the default constructor." }
-{ $see-also define-constructor } ;
-
-HELP: REQUIRES:
-{ $syntax "REQUIRES: modules... ;" }
-{ $values { "modules" "module name strings" } }
-{ $description "Loads a list of modules by calling " { $link require } " on each one." } ;
-
-HELP: PROVIDE:
-{ $syntax "PROVIDE: name pairs... ;" }
-{ $values { "name" "a string" } { "pairs" "a sequence of pairs, with keys described below" } }
-{ $description "Registers a module definition and loads its source files by calling " { $link provide } "."
-$terpri
-"The module name is followed by key/value pairs, where the keys are drawn from the following set:"
-{ $list
-    { { $link +files+ } " - the value is a sequence of source file names" }
-    { { $link +tests+ } " - the value is a sequence of unit test file names" }
-    { { $link +help+ } " - the value is a help topic" }
-}
-"All keys are optional, and path names are relative to the main module directory."
-$terpri
-"Elements of path name lists can optionally be pairs, where the first element is a source file which is conditionally loaded if the quotation in the second element yields a true value." }
-{ $examples
-"An example where the conditional load feature is used to load platform-specific code:"
-{ $code
-"PROVIDE: libs/calendar"
-"{ +files+ {"
-"    { \"os-unix.factor\" [ unix? ] }"
-"    { \"os-win32.factor\" [ windows? ] }"
-"    \"calendar.factor\""
-"} }"
-"{ +tests+ { \"test/calendar.factor\" } } ;"
-} } ;
-
-HELP: MAIN:
-{ $syntax "MAIN: name definition... ;" }
-{ $values { "name" "a module name string" } { "definition" "an entry point definition" } }
-{ $description "Registers a module entry point which can be run by passing the module name to " { $link run-module } ". The entry point quotation must not take any inputs from the stack, or leave any values on the stack when returning." } ;
-
-HELP: +files+
-{ $description "A key which may appear in a " { $link POSTPONE: PROVIDE: } " form." } ;
-
-HELP: +tests+
-{ $description "A key which may appear in a " { $link POSTPONE: PROVIDE: } " form." } ;
-
-HELP: +help+
-{ $description "A key which may appear in a " { $link POSTPONE: PROVIDE: } " form." } ;
-
-HELP: +directory+
-{ $description "A key which may appear in a " { $link POSTPONE: PROVIDE: } " form." } ;
diff --git a/core/syntax/parser.factor b/core/syntax/parser.factor
deleted file mode 100644 (file)
index f6f5198..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: parser
-USING: arrays definitions errors generic hashtables kernel math
-namespaces prettyprint sequences strings vectors words ;
-
-: skip ( i seq quot -- n )
-    over >r find* drop dup -1 =
-    [ drop r> length ] [ r> drop ] if ; inline
-
-: skip-blank ( -- )
-    column-number [ line-text get [ blank? not ] skip ] change ;
-
-: skip-word ( m line -- n )
-    2dup nth CHAR: " = [ drop 1+ ] [ [ blank? ] skip ] if ;
-
-: (scan) ( n line -- start end )
-    dupd 2dup length < [ skip-word ] [ drop ] if ;
-
-: scan ( -- token )
-    skip-blank
-    column-number [ line-text get (scan) dup ] change
-    2dup = [ 2drop f ] [ line-text get subseq ] if ;
-
-: CREATE ( -- word ) scan create-in ;
-
-SYMBOL: string-mode
-
-: do-what-i-mean ( string -- restarts )
-    words-named natural-sort [
-        [ "Use the word " swap summary append ] keep 2array
-    ] map ;
-
-TUPLE: no-word name ;
-
-: no-word ( name -- word )
-    dup <no-word> swap do-what-i-mean condition ;
-
-: search ( str -- word )
-    dup use get hash-stack [ ] [
-        no-word dup word-vocabulary use+
-    ] ?if ;
-
-: scan-word ( -- obj )
-    scan dup [
-        dup ";" = not string-mode get and [
-            dup string>number [ ] [ search ] ?if
-        ] unless
-    ] when ;
-
-: parsed ( parse-tree obj -- parse-tree ) swap ?push ;
-
-: parse-loop ( -- )
-    scan-word [
-        dup parsing? [ execute ] [ parsed ] if  parse-loop
-    ] when* ;
-
-: (parse) ( str -- )
-    line-text set
-    line-number inc
-    0 column-number set
-    parse-loop ;
-
-TUPLE: bad-escape ;
-: bad-escape ( -- * ) <bad-escape> throw ;
-
-! Parsing word utilities
-: escape ( escape -- ch )
-    H{
-        { CHAR: e  CHAR: \e }
-        { CHAR: n  CHAR: \n }
-        { CHAR: r  CHAR: \r }
-        { CHAR: t  CHAR: \t }
-        { CHAR: s  CHAR: \s }
-        { CHAR: \s CHAR: \s }
-        { CHAR: 0  CHAR: \0 }
-        { CHAR: \\ CHAR: \\ }
-        { CHAR: \" CHAR: \" }
-    } hash [ bad-escape ] unless* ;
-
-: next-escape ( n str -- n ch )
-    2dup nth CHAR: u =
-    [ >r 1+ dup 4 + tuck r> subseq hex> ]
-    [ over 1+ -rot nth escape ] if ;
-
-: next-char ( n str -- n ch )
-    2dup nth CHAR: \\ =
-    [ >r 1+ r> next-escape ] [ over 1+ -rot nth ] if ;
-
-: (parse-string) ( n str -- n )
-    2dup nth CHAR: " =
-    [ drop 1+ ] [ [ next-char , ] keep (parse-string) ] if ;
-
-: parse-string ( -- str )
-    column-number
-    [ [ line-text get (parse-string) ] "" make swap ] change ;
-
-: (parse-effect) ( -- )
-    scan [
-        dup ")" = [ drop ] [ , (parse-effect) ] if
-    ] [
-        "Unexpected EOL" throw
-    ] if* ;
-
-: string>effect ( seq -- effect )
-    { "--" } split1 dup [
-        <effect>
-    ] [
-        "Stack effect declaration must contain --" throw
-    ] if ;
-
-: parse-effect ( -- effect )
-    [ (parse-effect) column-number get ] { } make
-    swap column-number set
-    string>effect ;
-
-: parse-base ( parsed base -- parsed ) scan swap base> parsed ;
-
-global [
-    {
-        "scratchpad" "syntax" "arrays" "definitions"
-        "errors" "generic" "hashtables" "help" "inference"
-        "io" "kernel" "listener" "math" "memory" "modules"
-        "namespaces" "parser" "prettyprint" "sequences" "shells"
-        "strings" "styles" "tools" "vectors" "words"
-    } set-use
-    "scratchpad" set-in
-] bind
diff --git a/core/syntax/parser.facts b/core/syntax/parser.facts
deleted file mode 100644 (file)
index 931b2ea..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-USING: help kernel parser sequences words ;
-
-HELP: skip
-{ $values { "n" "a starting index" } { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } }
-{ $description "Variant of " { $link find* } " that outputs the length of the sequence instead of -1 if no elements satisfy the predicate." } ;
-
-HELP: skip-blank
-{ $description "Skips whitespace characters in the line currently being parsed." }
-$parsing-note ;
-
-HELP: skip-word
-{ $values { "m" "a non-negative integer" } { "line" "a string" } { "n" "a non-negative integer" } }
-{ $description "Searches forward in the line for the end of a word starting at index " { $snippet "n" } ". This is a word in the Factor sense; that is, any character other than whitespace is a constituent of the word, and a quote (\") is a word by itself." }
-{ $errors "Throws an error if " { $snippet "n" } " is out of bounds." } ;
-
-HELP: (scan)
-{ $values { "n" "a non-negative integer" } { "line" "a string" } { "start" "start offset of next word" } { "end" "end offset of next word" } }
-{ $description "Scans forward for the next word in the line. If the end of the line is reached, both outputs equal the length of the line." } ;
-
-HELP: scan
-{ $values { "token" "a string" } }
-{ $description "Reads the next token from the line currently being parsed. This is the key word that the Factor parser is built on." }
-$parsing-note ;
-
-HELP: CREATE
-{ $values { "word" "a word" } }
-{ $description "Reads the next token from the line currently being parsed, and creates a word with that name in the current vocabulary." }
-{ $errors "Throws an error if the end of the line is reached." }
-$parsing-note ;
-
-HELP: string-mode
-{ $var-description
-    "Variable toggling string mode. In string mode, the parser does not look up words, and instead just appends strings to the parse tree as they are read."
-    $terpri
-    "Since no parsing words are invoked in string mode, there is a special case that ends it; if the token " { $snippet ";" } " is read, string mode is switched off and the " { $link POSTPONE: ; } " parsing word is called."
-} ;
-
-HELP: no-word
-{ $values { "name" "a string" } { "word" "a word" } }
-{ $description "Throws a " { $link no-word } " error." }
-{ $error-description "Thrown if the parser encounters a token which does not name a word in the current vocabulary search path. If any words with this name exist in vocabularies not part of the search path, a number of restarts will offer to add those vocabularies to the search path and use the chosen word." }
-{ $notes "Apart from a missing " { $link POSTPONE: USE: } ", this error can also indicate an ordering issue. In Factor, words must be defined before they can be called. Mutual recursion can be implemented via " { $link POSTPONE: DEFER: } "." } ;
-
-HELP: scan-word
-{ $values { "obj" "a word or a number" } }
-{ $description "Reads the next token from the line currently being parsed. First tries to look up the word in the dictionary, and if the lookup fails, attempts to convert the token to a number." }
-{ $errors "Throws an error if the token does not name a word, and does not parse as a number." }
-$parsing-note ;
-
-HELP: bad-escape
-{ $error-description "This error is thrown if the parser encounters an invalid escape code following a backslash (" { $snippet "\\" } ") in a string literal. See " { $link "escape" } " for a list of valid escape codes." } ;
-
-HELP: escape
-{ $values { "escape" "a single-character escape" } { "ch" "a character" } }
-{ $description "Converts from a single-character escape code and the corresponding character." }
-{ $examples { $example "CHAR: n escape CHAR: \\n = ." "t" } } ;
-
-HELP: parse-string
-{ $values { "str" "a new string" } }
-{ $description "Parses the line until a quote (\"), interpreting escape codes along the way." } ;
-
-HELP: parse-effect
-{ $values { "effect" "an instance of " { $link effect } } }
-{ $description "Parses a stack effect from the current input line." }
-{ $notes "This word is used by " { $link POSTPONE: ( } " to parse stack effect declarations." } ;
-
-HELP: parse-base
-{ $values { "base" "an integer between 2 and 36" } }
-{ $description "Reads an integer in a specific numerical base from the parser input. This word can only be called from parsing words." } ;
diff --git a/core/syntax/summary.txt b/core/syntax/summary.txt
new file mode 100644 (file)
index 0000000..ca3d8c6
--- /dev/null
@@ -0,0 +1 @@
+Standard Factor syntax
diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..b42a696
--- /dev/null
@@ -0,0 +1,575 @@
+USING: generic help.syntax help.markup kernel math parser words
+effects classes generic.standard tuples generic.math arrays
+io.files vocabs.loader io sequences assocs ;
+IN: syntax
+
+ARTICLE: "parser-algorithm" "Parser algorithm"
+"At the most abstract level, Factor syntax consists of whitespace-separated tokens. The parser tokenizes the input on whitespace boundaries.  The parser is case-sensitive and whitespace between tokens is significant, so the following three expressions tokenize differently:"
+{ $code "2X+\n2 X +\n2 x +" }
+"As the parser reads tokens it makes a distinction between numbers, ordinary words, and parsing words. Tokens are appended to the parse tree, the top level of which is a quotation returned by the original parser invocation. Nested levels of the parse tree are created by parsing words."
+$nl
+"The parser iterates through the input text, checking each character in turn. Here is the parser algorithm in more detail -- some of the concepts therein will be defined shortly:"
+{ $list
+    { "If the current character is a double-quote (\"), the " { $link POSTPONE: " } " parsing word is executed, causing a string to be read." }
+    {
+        "Otherwise, the next token is taken from the input. The parser searches for a word named by the token in the currently used set of vocabularies. If the word is found, one of the following two actions is taken:"
+        { $list
+            "If the word is an ordinary word, it is appended to the parse tree."
+            "If the word is a parsing word, it is executed."
+        }
+    }
+    "Otherwise if the token does not represent a known word, the parser attempts to parse it as a number. If the token is a number, the number object is added to the parse tree. Otherwise, an error is raised and parsing halts."
+}
+"Parsing words play a key role in parsing; while ordinary words and numbers are simply added to the parse tree, parsing words execute in the context of the parser, and can do their own parsing and create nested data structures in the parse tree. Parsing words are also able to define new words."
+$nl
+"While parsing words supporting arbitrary syntax can be defined, the default set is found in the " { $vocab-link "syntax" } " vocabulary and provides the basis for all further syntactic interaction with Factor." ;
+
+ARTICLE: "syntax-comments" "Comments"
+{ $subsection POSTPONE: ! }
+{ $subsection POSTPONE: #! } ;
+
+ARTICLE: "syntax-integers" "Integer syntax"
+"The printed representation of an integer consists of a sequence of digits, optionally prefixed by a sign."
+{ $code
+    "123456"
+    "-10"
+    "2432902008176640000"
+}
+"Integers are entered in base 10 unless prefixed with a base change parsing word."
+{ $subsection POSTPONE: BIN: }
+{ $subsection POSTPONE: OCT: }
+{ $subsection POSTPONE: HEX: }
+"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 (/). No intermediate whitespace is permitted. Either integer may be signed, however the ratio will be normalized into a form where the denominator is positive and the greatest common divisor of the two terms is 1."
+{ $code
+    "75/33"
+    "1/10"
+    "-5/-6"
+}
+"More information on ratios can be found in " { $link "rationals" } ;
+
+ARTICLE: "syntax-floats" "Float syntax"
+"Floating point literals must contain a decimal point, and may contain an exponent:"
+{ $code
+    "10.5"
+    "-3.1456"
+    "7.e13"
+    "1.0e-5"
+}
+"More information on floats can be found in " { $link "floats" } "." ;
+
+ARTICLE: "syntax-complex-numbers" "Complex number syntax"
+"A complex number is given by two components, a ``real'' part and ''imaginary'' part. The components must either be integers, ratios or floats."
+{ $code
+    "C{ 1/2 1/3 }   ! the complex number 1/2+1/3i"
+    "C{ 0 1 }       ! the imaginary unit"
+}
+{ $subsection POSTPONE: C{ }
+"More information on complex numbers can be found in " { $link "complex-numbers" } "." ;
+
+ARTICLE: "syntax-numbers" "Number syntax"
+"If a vocabulary lookup of a token fails, the parser attempts to parse it as a number."
+{ $subsection "syntax-integers" }
+{ $subsection "syntax-ratios" }
+{ $subsection "syntax-floats" }
+{ $subsection "syntax-complex-numbers" } ;
+
+ARTICLE: "syntax-words" "Word syntax"
+"A word occurring inside a quotation is executed when the quotation is called. Sometimes a word needs to be pushed on the data stack instead. The canonical use-case for this is passing the word to the " { $link execute } " combinator, or alternatively, reflectively accessing word properties (" { $link "word-props" } ")."
+{ $subsection POSTPONE: \ }
+{ $subsection POSTPONE: POSTPONE: }
+"The implementation of the " { $link POSTPONE: \ } " word is discussed in detail in " { $link "reading-ahead" } ". Words are documented in " { $link "words" } "." ;
+
+ARTICLE: "escape" "Character escape codes"
+{ $table
+    { "Escape code" "Meaning" }
+    { { $snippet "\\\\" } { $snippet "\\" } }
+    { { $snippet "\\s" } "a space" }
+    { { $snippet "\\t" } "a tab" }
+    { { $snippet "\\n" } "a newline" }
+    { { $snippet "\\r" } "a carriage return" }
+    { { $snippet "\\0" } "a null byte (ASCII 0)" }
+    { { $snippet "\\e" } "escape (ASCII 27)" }
+    { { $snippet "\\\"" } { $snippet "\"" } }
+}
+"A Unicode character can be specified by its code number by writing " { $snippet "\\u" } " followed by a four-digit hexadecimal number. That is, the following two expressions are equivalent:"
+{ $code
+    "CHAR: \\u0078"
+    "78"
+}
+"While not useful for single characters, this syntax is also permitted inside strings." ;
+
+ARTICLE: "syntax-strings" "Character and string syntax"
+"Factor has no distinct character type, however Unicode character value integers can be read by specifying a literal character, or an escaped representation thereof."
+{ $subsection POSTPONE: CHAR: }
+{ $subsection POSTPONE: " }
+{ $subsection "escape" }
+"Strings are documented in " { $link "strings" } "." ;
+
+ARTICLE: "syntax-sbufs" "String buffer syntax"
+{ $subsection POSTPONE: SBUF" }
+"String buffers are documented in " { $link "sbufs" } "." ;
+
+ARTICLE: "syntax-arrays" "Array syntax"
+{ $subsection POSTPONE: { }
+{ $subsection POSTPONE: } }
+"Arrays are documented in " { $link "arrays" } "." ;
+
+ARTICLE: "syntax-vectors" "Vector syntax"
+{ $subsection POSTPONE: V{ }
+"Vectors are documented in " { $link "vectors" } "." ;
+
+ARTICLE: "syntax-hashtables" "Hashtable syntax"
+{ $subsection POSTPONE: H{ }
+"Hashtables are documented in " { $link "hashtables" } "." ;
+
+ARTICLE: "syntax-tuples" "Tuple syntax"
+{ $subsection POSTPONE: T{ }
+"Tuples are documented in " { $link "tuples" } "."  ;
+
+ARTICLE: "syntax-quots" "Quotation syntax"
+{ $subsection POSTPONE: [ }
+{ $subsection POSTPONE: ] }
+"Quotations are documented in " { $link "quotations" } "." ;
+
+ARTICLE: "syntax-bit-arrays" "Bit array syntax"
+{ $subsection POSTPONE: ?{ }
+"Bit arrays are documented in " { $link "bit-arrays" } "." ;
+
+ARTICLE: "syntax-float-arrays" "Float array syntax"
+{ $subsection POSTPONE: F{ }
+"Float arrays are documented in " { $link "float-arrays" } "." ;
+
+ARTICLE: "syntax-byte-arrays" "Byte array syntax"
+{ $subsection POSTPONE: B{ }
+"Byte arrays are documented in " { $link "byte-arrays" } "." ;
+
+ARTICLE: "syntax-pathnames" "Pathname syntax"
+{ $subsection POSTPONE: P" }
+"Pathnames are documented in " { $link "file-streams" } "." ;
+
+ARTICLE: "syntax-literals" "Literals"
+"Many different types of objects can be constructed at parse time via literal syntax. Numbers are a special case since support for reading them is built-in to the parser. All other literals are constructed via parsing words."
+$nl
+"If a quotation contains a literal object, the same literal object instance is used each time the quotation executes; that is, literals are ``live''."
+$nl
+"Using mutable object literals in word definitions requires care, since if those objects are mutated, the actual word definition will be changed, which is in most cases not what you would expect. Literals should be " { $link clone } "d before being passed to word which may potentially mutate them."
+{ $subsection "syntax-numbers" }
+{ $subsection "syntax-words" }
+{ $subsection "syntax-quots" }
+{ $subsection "syntax-arrays" }
+{ $subsection "syntax-vectors" }
+{ $subsection "syntax-strings" }
+{ $subsection "syntax-sbufs" }
+{ $subsection "syntax-byte-arrays" }
+{ $subsection "syntax-bit-arrays" }
+{ $subsection "syntax-hashtables" }
+{ $subsection "syntax-tuples" }
+{ $subsection "syntax-pathnames" } ;
+
+ARTICLE: "syntax" "Syntax"
+"Factor has two main forms of syntax: " { $emphasis "definition" } " syntax and " { $emphasis "literal" } " syntax. Code is data, so the syntax for code is a special case of object literal syntax. This section documents literal syntax. Definition syntax is covered in " { $link "words" } ". Extending the parser is the main topic of " { $link "parser" } "."
+{ $subsection "parser-algorithm" }
+{ $subsection "syntax-comments" }
+{ $subsection "syntax-literals" } ;
+
+ABOUT: "syntax"
+
+HELP: delimiter
+{ $syntax ": foo ... ; delimiter" }
+{ $description "Declares the most recently defined word as a delimiter. Delimiters are words which are only ever valid as the end of a nested block to be read by " { $link parse-until } ". An unpaired occurrence of a delimiter is a parse error." } ;
+
+HELP: parsing
+{ $syntax ": foo ... ; parsing" }
+{ $description "Declares the most recently defined word as a parsing word." }
+{ $examples "In the below example, the " { $snippet "world" } " word is never called, however its body references a parsing word which executes immediately:" { $example ": hello \"Hello parser!\" print ; parsing\n: world hello ;" "Hello parser!" } } ;
+
+HELP: inline
+{ $syntax ": foo ... ; inline" }
+{ $description
+    "Declares the most recently defined word as an inline word. The optimizing compiler copies definitions of inline words when compiling calls to them."
+    $nl
+    "Combinators must be inlined in order to compile with the optimizing compiler - see " { $link "inference-combinators" } ". For any other word, inlining is merely an optimization."
+    $nl
+    "The non-optimizing quotation compiler ignores inlining declarations."
+} ;
+
+HELP: foldable
+{ $syntax ": foo ... ; foldable" }
+{ $description
+    "Declares that the most recently defined word may be evaluated at compile-time if all inputs are literal. Foldable words must satisfy a very strong contract:"
+    { $list
+        "foldable words must not have any observable side effects,"
+        "foldable words must halt - for example, a word computing a series until it coverges should not be foldable, since compilation will not halt in the event the series does not converge."
+        "both inputs and outputs of foldable words must be immutable."
+    }
+    "The last restriction ensures that words such as " { $link clone } " do not satisfy the foldable word contract. Indeed, " { $link clone } " will output a mutable object if its input is mutable, and so it is undesirable to evaluate it at compile-time, since doing so would give incorrect semantics for code that clones mutable objects and proceeds to mutate them."
+}
+{ $examples "Most operations on numbers are foldable. For example, " { $snippet "2 2 +" } " compiles to a literal 4, since " { $link + } " is declared foldable." } ;
+
+HELP: flushable
+{ $syntax ": foo ... ; flushable" }
+{ $description
+    "Declares that the most recently defined word has no side effects, and thus calls to this word may be pruned by the compiler if the outputs are not used."
+    $nl
+    "Note that many words are flushable but not foldable, for example " { $link clone } " and " { $link <array> } "."
+} ;
+
+HELP: t
+{ $syntax "t" }
+{ $values { "t" "the canonical truth value" } }
+{ $description "The canonical instance of " { $link general-t } ". It is just a symbol." } ;
+
+HELP: f
+{ $syntax "f" }
+{ $values { "f" "the singleton false value" } }
+{ $description "The " { $link f } " parsing word adds the " { $link f } " object to the parse tree, and is also the class whose sole instance is the " { $link f } " object. The " { $link f } " object is the singleton false value, the only object that is not true. The " { $link f } " object is not equal to the " { $link f } " class word, which can be pushed on the stack using word wrapper syntax:"
+{ $code "f    ! the singleton f object denoting falsity\n\\ f  ! the f class word" } } ;
+
+HELP: [
+{ $syntax "[ elements... ]" }
+{ $description "Marks the beginning of a literal quotation." }
+{ $examples { $code "[ 1 2 3 ]" } } ;
+
+{ POSTPONE: [ POSTPONE: ] } related-words
+
+HELP: ]
+{ $syntax "]" }
+{ $description "Marks the end of a literal quotation."
+$nl
+"Parsing words can use this word as a generic end delimiter." } ;
+
+HELP: }
+{ $syntax "}" }
+{ $description "Marks the end of an array, vector, hashtable, complex number, tuple, or wrapper."
+$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
+
+HELP: {
+{ $syntax "{ elements... }" }
+{ $values { "elements" "a list of objects" } }
+{ $description "Marks the beginning of a literal array. Literal arrays are terminated by " { $link POSTPONE: } } "." } 
+{ $examples { $code "{ 1 2 3 }" } } ;
+
+HELP: V{
+{ $syntax "V{ elements... }" }
+{ $values { "elements" "a list of objects" } }
+{ $description "Marks the beginning of a literal vector. Literal vectors are terminated by " { $link POSTPONE: } } "." } 
+{ $examples { $code "V{ 1 2 3 }" } } ;
+
+HELP: B{
+{ $syntax "B{ elements... }" }
+{ $values { "elements" "a list of integers" } }
+{ $description "Marks the beginning of a literal byte array. Literal byte arrays are terminated by " { $link POSTPONE: } } "." } 
+{ $examples { $code "B{ 1 2 3 }" } } ;
+
+HELP: ?{
+{ $syntax "?{ elements... }" }
+{ $values { "elements" "a list of booleans" } }
+{ $description "Marks the beginning of a literal bit array. Literal bit arrays are terminated by " { $link POSTPONE: } } "." } 
+{ $examples { $code "?{ t f t }" } } ;
+
+HELP: F{
+{ $syntax "F{ elements... }" }
+{ $values { "elements" "a list of real numbers" } }
+{ $description "Marks the beginning of a literal float array. Literal float arrays are terminated by " { $link POSTPONE: } } "." } 
+{ $examples { $code "F{ 1.0 2.0 3.0 }" } } ;
+
+HELP: H{
+{ $syntax "H{ { key value }... }" }
+{ $values { "key" "an object" } { "value" "an object" } }
+{ $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: C{
+{ $syntax "C{ real imaginary }" }
+{ $values { "real" "a real number" } { "imaginary" "a real number" } }
+{ $description "Parses a complex number given in rectangular form as a pair of real numbers. Literal complex numbers are terminated by " { $link POSTPONE: } } "." }  ;
+
+HELP: T{
+{ $syntax "T{ class delegate slots... }" }
+{ $values { "class" "a tuple class word" } { "delegate" "a delegate" } { "slots" "list of objects" } }
+{ $description "Marks the beginning of a literal tuple. Literal tuples are terminated by " { $link POSTPONE: } } "."
+$nl
+"The class word must always be specified. If an insufficient number of values is given after the class word, the remaining slots of the tuple are set to " { $link f } ". If too many values are given, they are ignored." } ;
+
+HELP: W{
+{ $syntax "W{ object }" }
+{ $values { "object" "an object" } }
+{ $description "Marks the beginning of a literal wrapper. Literal wrappers are terminated by " { $link POSTPONE: } } "." }  ;
+
+HELP: POSTPONE:
+{ $syntax "POSTPONE: word" }
+{ $values { "word" "a word" } }
+{ $description "Reads the next word from the input string and appends the word to the parse tree, even if it is a parsing word." }
+{ $examples "For an ordinary word " { $snippet "foo" } ", " { $snippet "foo" } " and " { $snippet "POSTPONE: foo" } " are equivalent; however, if " { $snippet "foo" } " is a parsing word, the former will execute it at parse time, while the latter will execute it at runtime." }
+{ $notes "This word is used inside parsing words to delegate further action to another parsing word, and to refer to parsing words literally from literal arrays and such." } ;
+
+HELP: :
+{ $syntax ": word definition... ;" }
+{ $values { "word" "a new word to define" } { "definition" "a word definition" } }
+{ $description "Defines a compound word in the current vocabulary." }
+{ $examples { $code ": ask-name ( -- name )\n    \"What is your name? \" write readln ;\n: greet ( name -- )\n    \"Greetings, \" write print ;\n: friend ( -- )\n    ask-name greet ;" } } ;
+
+{ POSTPONE: : POSTPONE: ; define-compound } related-words
+
+HELP: ;
+{ $syntax ";" }
+{ $description
+    "Marks the end of a definition."
+    $nl
+    "Parsing words can use this word as a generic end delimiter."
+} ;
+
+HELP: SYMBOL:
+{ $syntax "SYMBOL: word" }
+{ $values { "word" "a new word to define" } }
+{ $description "Defines a new symbol word in the current vocabulary. Symbols push themselves on the stack when executed, and are used to identify variables (see " { $link "namespaces" } ") as well as for storing crufties in word properties (see " { $link "word-props" } ")." }
+{ $examples { $example "SYMBOL: foo\nfoo ." "foo" } } ;
+
+{ define-symbol POSTPONE: SYMBOL: } related-words
+
+HELP: \
+{ $syntax "\\ word" }
+{ $values { "word" "a word" } }
+{ $description "Reads the next word from the input and appends a wrapper holding the word to the parse tree. When the evaluator encounters a wrapper, it pushes the wrapped word literally on the data stack." }
+{ $examples "The following two lines are equivalent:" { $code "0 \\ <vector> execute\n0 <vector>" } } ;
+
+HELP: DEFER:
+{ $syntax "DEFER: word" }
+{ $values { "word" "a new word to define" } }
+{ $description "Create a word in the current vocabulary that simply raises an error when executed. Usually, the word will be replaced with a real definition later." }
+{ $notes "Due to the way the parser works, words cannot be referenced before they are defined; that is, source files must order definitions in a strictly bottom-up fashion. Mutually-recursive pairs of words can be implemented by " { $emphasis "deferring" } " one of the words in the pair allowing the second word in the pair to parse, then by defining the first word." }
+{ $examples { $code "DEFER: foe\n: fie ... foe ... ;\n: foe ... fie ... ;" } } ;
+
+HELP: FORGET:
+{ $syntax "FORGET: word" }
+{ $values { "word" "a word" } }
+{ $description "Removes the word from its vocabulary, or does nothing if no such word exists. Existing definitions that reference forgotten words will continue to work, but new occurrences of the word will not parse." } ;
+
+HELP: USE:
+{ $syntax "USE: vocabulary" }
+{ $values { "vocabulary" "a vocabulary name" } }
+{ $description "Adds a new vocabulary at the front of the search path. Subsequent word lookups by the parser will search this vocabulary first." }
+{ $errors "Throws an error if the vocabulary does not exist." } ;
+
+HELP: USE-IF:
+{ $syntax "USE-IF: word vocabulary" }
+{ $values { "word" "a word with stack effect " { $snippet "( -- ? )" } } { "vocabulary" "a vocabulary name" } }
+{ $description "Adds a vocabulary at the front of the search path if the word evaluates to a true value." }
+{ $errors "Throws an error if the vocabulary does not exist." } ;
+
+HELP: USING:
+{ $syntax "USING: vocabularies... ;" }
+{ $values { "vocabularies" "a list of vocabulary names" } }
+{ $description "Adds a list of vocabularies to the front of the search path, with later vocabularies taking precedence." }
+{ $errors "Throws an error if one of the vocabularies does not exist." } ;
+
+HELP: IN:
+{ $syntax "IN: vocabulary" }
+{ $values { "vocabulary" "a new vocabulary name" } }
+{ $description "Sets the current vocabulary where new words will be defined, creating the vocabulary first if it does not exist. After the vocabulary has been created, it can be listed in " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " declarations." } ;
+
+HELP: CHAR:
+{ $syntax "CHAR: token" }
+{ $values { "token" "a literal character or escape code" } }
+{ $description "Adds the Unicode code point of the character represented by the token to the parse tree." } ;
+
+HELP: "
+{ $syntax "\"string...\"" }
+{ $values { "string" "literal and escaped characters" } }
+{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } ", and appends the resulting string to the parse tree. String literals cannot span multiple lines. Strings containing the " { $link POSTPONE: " } " character and various other special characters can be read by inserting escape sequences." }
+{ $examples { $example "\"Hello\\nworld\" print" "Hello\nworld" } } ;
+
+HELP: SBUF"
+{ $syntax "SBUF\" string... \"" }
+{ $values { "string" "literal and escaped characters" } }
+{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } ", converts the string to a string buffer, and appends it to the parse tree." }
+{ $examples { $example "SBUF\" Hello world\" >string print" "Hello world" } } ;
+
+HELP: P"
+{ $syntax "P\" pathname\"" }
+{ $values { "pathname" "a pathname string" } }
+{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } ", creates a new " { $link pathname } ", and appends it to the parse tree." }
+{ $examples { $example "USE: io.files" "P\" foo.txt\" pathname-string print" "foo.txt" } } ;
+
+HELP: (
+{ $syntax "( inputs -- outputs )" }
+{ $values { "inputs" "a list of tokens" } { "outputs" "a list of tokens" } }
+{ $description "Declares the stack effect of the most recently defined word, storing a new " { $link effect } " instance in the " { $snippet "\"declared-effect\"" } " word property." }
+{ $notes "Recursive words must have a declared stack effect to compile. See " { $link "effect-declaration" } " for details." } ;
+
+HELP: !
+{ $syntax "! comment..." }
+{ $values { "comment" "characters" } }
+{ $description "Discards all input until the end of the line." } ;
+
+{ POSTPONE: ! POSTPONE: #! } related-words
+
+HELP: #!
+{ $syntax "#! comment..." }
+{ $values { "comment" "characters" } }
+{ $description "Discards all input until the end of the line." } ;
+
+HELP: HEX:
+{ $syntax "HEX: integer" }
+{ $values { "integer" "hexadecimal digits (0-9, a-f, A-F)" } }
+{ $description "Adds an integer read from a hexadecimal literal to the parse tree." }
+{ $examples { $example "HEX: ff ." "255" } } ;
+
+HELP: OCT:
+{ $syntax "OCT: integer" }
+{ $values { "integer" "octal digits (0-7)" } }
+{ $description "Adds an integer read from an octal literal to the parse tree." }
+{ $examples { $example "OCT: 31337 ." "13023" } } ;
+
+HELP: BIN:
+{ $syntax "BIN: integer" }
+{ $values { "integer" "binary digits (0 and 1)" } }
+{ $description "Adds an integer read from an binary literal to the parse tree." }
+{ $examples { $example "BIN: 100 ." "4" } } ;
+
+HELP: GENERIC:
+{ $syntax "GENERIC: word" }
+{ $values { "word" "a new word to define" } }
+{ $description "Defines a new generic word in the current vocabulary. Initially, it contains no methods, and thus will throw a " { $link no-method } " error when called." } ;
+
+HELP: GENERIC#
+{ $syntax "GENERIC# word n" }
+{ $values { "word" "a new word to define" } { "n" "the stack position to dispatch on, either 0, 1 or 2" } }
+{ $description "Defines a new generic word which dispatches on the " { $snippet "n" } "th most element from the top of the stack in the current vocabulary. Initially, it contains no methods, and thus will throw a " { $link no-method } " error when called." }
+{ $notes
+    "The following two definitions are equivalent:"
+    { $code "GENERIC: foo" }
+    { $code "GENERIC# foo 0" }
+} ;
+
+HELP: MATH:
+{ $syntax "MATH: word" }
+{ $values { "word" "a new word to define" } }
+{ $description "Defines a new generic word which uses the " { $link math-combination } " method combination." } ;
+
+HELP: HOOK:
+{ $syntax "HOOK: word variable" }
+{ $values { "word" "a new word to define" } { "variable" word } }
+{ $description "Defines a new hook word in the current vocabulary. Hook words are generic words which dispatch on the value of a variable, so methods are defined with " { $link POSTPONE: M: } ". Hook words differ from other generic words in that the dispatch value is removed from the stack before the chosen method is called." }
+{ $examples
+    { $example
+        "SYMBOL: transport"
+        "TUPLE: land-transport ;"
+        "TUPLE: air-transport ;"
+        "HOOK: deliver transport ( destination -- )"
+        "M: land-transport deliver \"Land delivery to \" write print ;"
+        "M: air-transport deliver \"Air delivery to \"  write print ;"
+        "T{ air-transport } transport set"
+        "\"New York City\" deliver"
+        "Air delivery to New York City"
+    }
+}
+{ $notes
+    "Hook words are really just generic words with a custom method combination (see " { $link "method-combination" } ")."
+} ;
+
+HELP: M:
+{ $syntax "M: class generic definition... ;" }
+{ $values { "class" "a class word" } { "generic" "a generic word" } { "definition" "a method definition" } }
+{ $description "Defines a method, that is, a behavior for the generic word specialized on instances of the class." } ;
+
+HELP: UNION:
+{ $syntax "UNION: class members... ;" }
+{ $values { "class" "a new class word to define" } { "members" "a list of class words separated by whitespace" } }
+{ $description "Defines a union class. An object is an instance of a union class if it is an instance of one of its members." }
+{ $notes "Union classes are used to associate the same method with several different classes, as well as to conveniently define predicates." } ;
+
+HELP: MIXIN:
+{ $syntax "MIXIN: class" }
+{ $values { "class" "a new class word to define" } }
+{ $description "Defines a mixin class. A mixin is similar to a union class, except it has no members initially, and new members can be added with the " { $link POSTPONE: INSTANCE: } " word." }
+{ $notes "Mixins classes are used to mark implementations of a protocol and define default methods." }
+{ $examples "The " { $link sequence } " and " { $link assoc } " mixin classes." } ;
+
+HELP: INSTANCE:
+{ $syntax "INSTANCE: instance mixin" }
+{ $values { "instance" "a class word" } { "instance" "a class word" } }
+{ $description "Makes " { $snippet "instance" } " an instance of " { $snippet "mixin" } "." } ;
+
+HELP: PREDICATE:
+{ $syntax "PREDICATE: superclass class predicate... ;" }
+{ $values { "superclass" "an existing class word" } { "class" "a new class word to define" } { "predicate" "membership test with stack effect " { $snippet "( superclass -- ? )" } } }
+{ $description
+    "Defines a predicate class deriving from " { $snippet "superclass" } "."
+    $nl
+    "An object is an instance of a predicate class if two conditions hold:"
+    { $list
+        "it is an instance of the predicate's superclass,"
+        "it satisfies the predicate"
+    }
+    "Each predicate must be defined as a subclass of some other class. This ensures that predicates inheriting from disjoint classes do not need to be exhaustively tested during method dispatch."
+} ;
+
+HELP: TUPLE:
+{ $syntax "TUPLE: class slots... ;" }
+{ $values { "class" "a new tuple class to define" } { "slots" "a list of slot names" } }
+{ $description "Defines a new tuple class with membership predicate " { $snippet "name?" } " and constructor " { $snippet "<name>" } "."
+$nl
+"Tuples are user-defined classes with instances composed of named slots. All tuple classes are subtypes of the built-in " { $link tuple } " type." } ;
+
+HELP: C:
+{ $syntax "C: constructor class" }
+{ $values { "constructor" "a new word to define" } { "class" tuple-class } }
+{ $description "Define a constructor word for a tuple class which simply performs BOA (by order of arguments) construction using " { $link construct-boa } "." }
+{ $examples
+    "Suppose the following tuple has been defined:"
+    { $code "TUPLE: color red green blue ;" }
+    "The following two lines are equivalent:"
+    { $code
+        "C: <color> color"
+        ": <color> color construct-boa ;"
+    }
+    "In both cases, a word " { $snippet "<color>" } " is defined, which reads three values from the stack and creates a " { $snippet "color" } " instance having these values in the " { $snippet "red" } ", " { $snippet "green" } " and " { $snippet "blue" } " slots, respectively."
+} ;
+
+HELP: MAIN:
+{ $syntax "MAIN: word" }
+{ $values { "word" word } }
+{ $description "Defines the main entry point for the current vocabulary. This word will be executed when this vocabulary is passed to " { $link run } "." } ;
+
+HELP: <PRIVATE
+{ $syntax "<PRIVATE ... PRIVATE>" }
+{ $description "Marks the start of a block of private word definitions. Private word definitions are placed in a vocabulary named by suffixing the current vocabulary with " { $snippet ".private" } "." }
+{ $notes
+    "The following is an example of usage:"
+    { $code
+        "IN: factorial"
+        ""
+        "<PRIVATE"
+        ""
+        ": (fac) ( accum n -- n! )"
+        "    dup 1 <= [ drop ] [ [ * ] keep 1- (fac) ] if ;"
+        ""
+        "PRIVATE>"
+        ""
+        ": fac ( n -- n! ) 1 swap (fac) ;"
+    }
+    "The above is equivalent to:"
+    { $code
+        "IN: factorial.private"
+        ""
+        ": (fac) ( accum n -- n! )"
+        "    dup 1 <= [ drop ] [ [ * ] keep 1- (fac) ] if ;"
+        ""
+        "IN: factorial"
+        ""
+        ": fac ( n -- n! ) 1 swap (fac) ;"
+    }
+} ;
+
+HELP: PRIVATE>
+{ $syntax "<PRIVATE ... PRIVATE>" }
+{ $description "Marks the end of a block of private word definitions." } ;
+
+{ POSTPONE: <PRIVATE POSTPONE: PRIVATE> } related-words
diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..d048f04
--- /dev/null
@@ -0,0 +1,162 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays bit-arrays byte-arrays definitions generic
+hashtables kernel math namespaces parser sequences strings sbufs
+vectors words quotations io assocs splitting tuples
+generic.standard generic.math classes io.files vocabs
+float-arrays classes.union classes.mixin classes.predicate ;
+IN: bootstrap.syntax
+
+! These words are defined as a top-level form, instead of with
+! defining parsing words, because during stage1 bootstrap, the
+! "syntax" vocabulary is copied from the host. When stage1
+! bootstrap completes, the host's syntax vocabulary is deleted
+! from the target, then this top-level form creates the
+! target's "syntax" vocabulary as one of the first things done
+! in stage2.
+
+: define-delimiter ( name -- )
+    "syntax" lookup t "delimiter" set-word-prop ;
+
+: define-syntax ( name quot -- )
+    >r "syntax" lookup dup r> define-compound
+    t "parsing" set-word-prop ;
+
+{ "]" "}" ";" } [ define-delimiter ] each
+
+"!" [ lexer get next-line ] define-syntax
+
+"#!" [ POSTPONE: ! ] define-syntax
+
+"IN:" [ scan set-in ] define-syntax
+
+"PRIVATE>" [ in get ".private" ?tail drop set-in ] define-syntax
+
+"<PRIVATE" [
+    POSTPONE: PRIVATE> in get ".private" append set-in
+] define-syntax
+
+"USE:" [ scan use+ ] define-syntax
+
+"USE-IF:" [
+    scan-word scan swap execute [ use+ ] [ drop ] if
+] define-syntax
+
+"USING:" [ ";" parse-tokens add-use ] define-syntax
+
+"HEX:" [ 16 parse-base ] define-syntax
+"OCT:" [ 8 parse-base ] define-syntax
+"BIN:" [ 2 parse-base ] define-syntax
+
+"f" [ f parsed ] define-syntax
+"t" "syntax" lookup define-symbol
+
+"CHAR:" [ 0 scan next-char nip parsed ] define-syntax
+"\"" [ parse-string parsed ] define-syntax
+
+"SBUF\"" [
+    lexer get skip-blank parse-string >sbuf parsed
+] define-syntax
+
+"P\"" [
+    lexer get skip-blank parse-string <pathname> parsed
+] define-syntax
+
+"[" [ \ ] [ >quotation ] parse-literal ] define-syntax
+"{" [ \ } [ >array ] parse-literal ] define-syntax
+"V{" [ \ } [ >vector ] parse-literal ] define-syntax
+"B{" [ \ } [ >byte-array ] parse-literal ] define-syntax
+"?{" [ \ } [ >bit-array ] parse-literal ] define-syntax
+"F{" [ \ } [ >float-array ] parse-literal ] define-syntax
+"H{" [ \ } [ >hashtable ] parse-literal ] define-syntax
+"C{" [ \ } [ first2 rect> ] parse-literal ] define-syntax
+"T{" [ \ } [ >tuple ] parse-literal ] define-syntax
+"W{" [ \ } [ first <wrapper> ] parse-literal ] define-syntax
+"CS{" [ \ } [ >array array>callstack ] parse-literal ] define-syntax
+
+"POSTPONE:" [ scan-word parsed ] define-syntax
+"\\" [ scan-word literalize parsed ] define-syntax
+"inline" [ word make-inline ] define-syntax
+"foldable" [ word make-foldable ] define-syntax
+"flushable" [ word make-flushable ] define-syntax
+"delimiter" [ word t "delimiter" set-word-prop ] define-syntax
+"parsing" [ word t "parsing" set-word-prop ] define-syntax
+
+"SYMBOL:" [
+    CREATE dup reset-generic define-symbol
+] define-syntax
+
+"DEFER:" [
+    scan in get create
+    dup old-definitions get delete-at
+    set-word
+] define-syntax
+
+":" [
+    CREATE dup reset-generic parse-definition define-compound
+] define-syntax
+
+"GENERIC:" [
+    CREATE dup reset-word
+    define-simple-generic
+] define-syntax
+
+"GENERIC#" [
+    CREATE dup reset-word
+    scan-word <standard-combination> define-generic
+] define-syntax
+
+"MATH:" [
+    CREATE dup reset-word
+    T{ math-combination } define-generic
+] define-syntax
+
+"HOOK:" [
+    CREATE dup reset-word scan-word
+    <hook-combination> define-generic
+] define-syntax
+
+"M:" [
+    f set-word
+    location >r
+    scan-word bootstrap-word scan-word
+    [ parse-definition <method> -rot define-method ] 2keep
+    2array r> (save-location)
+] define-syntax
+
+"UNION:" [
+    CREATE-CLASS parse-definition define-union-class
+] define-syntax
+
+"MIXIN:" [
+    CREATE-CLASS define-mixin-class
+] define-syntax
+
+"INSTANCE:" [ scan-word scan-word add-mixin-instance ] define-syntax
+
+"PREDICATE:" [
+    scan-word
+    CREATE-CLASS
+    parse-definition define-predicate-class
+] define-syntax
+
+"TUPLE:" [
+    CREATE-CLASS ";" parse-tokens define-tuple-class
+] define-syntax
+
+"C:" [
+    CREATE dup reset-generic
+    scan-word dup check-tuple
+    [ construct-boa ] curry define-inline
+] define-syntax
+
+"FORGET:" [ scan use get assoc-stack forget ] define-syntax
+
+"(" [
+    parse-effect word
+    [ swap "declared-effect" set-word-prop ] [ drop ] if*
+] define-syntax
+
+"MAIN:" [ scan-word in get vocab set-vocab-main ] define-syntax
+
+"bootstrap.syntax" forget-vocab
diff --git a/core/system/authors.txt b/core/system/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/system/summary.txt b/core/system/summary.txt
new file mode 100644 (file)
index 0000000..414f0ca
--- /dev/null
@@ -0,0 +1 @@
+OS and CPU queries, environment variables, paths
diff --git a/core/system/system-docs.factor b/core/system/system-docs.factor
new file mode 100644 (file)
index 0000000..8c57d0c
--- /dev/null
@@ -0,0 +1,144 @@
+USING: generic help.markup help.syntax kernel math memory
+namespaces sequences kernel.private io.files ;
+IN: system
+
+ARTICLE: "os" "System interface"
+"Operating system detection:"
+{ $subsection os }
+{ $subsection unix? }
+{ $subsection macosx? }
+{ $subsection solaris? }
+{ $subsection windows? }
+{ $subsection winnt? }
+{ $subsection win32? }
+{ $subsection win64? }
+{ $subsection wince? }
+"Processor detection:"
+{ $subsection cpu }
+"Processor cell size:"
+{ $subsection cell }
+{ $subsection cells }
+{ $subsection cell-bits }
+"Reading environment variables:"
+{ $subsection os-env }
+"Getting the path to the Factor VM and image:"
+{ $subsection vm }
+{ $subsection image }
+"Exiting the Factor VM:"
+{ $subsection exit } ;
+
+ABOUT: "os"
+
+HELP: cpu
+{ $values { "cpu" "a string" } }
+{ $description
+    "Outputs a string descriptor of the current CPU architecture. Currently, this set of descriptors is:"
+    { $code "x86.32" "x86.64" "ppc" "arm" }
+} ;
+
+HELP: os
+{ $values { "os" "a string" } }
+{ $description
+    "Outputs a string descriptor of the current operating system family. Currently, this set of descriptors is:"
+    { $code
+        "freebsd"
+        "linux"
+        "macosx"
+        "openbsd"
+        "solaris"
+        "windows"
+    }
+} ;
+
+HELP: embedded?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if this Factor instance is embedded in another application." } ;
+
+HELP: windows?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on Windows." } ;
+
+HELP: winnt?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on Windows XP or Vista." } ;
+
+HELP: wince?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on Windows CE." } ;
+
+HELP: macosx?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on Mac OS X." } ;
+
+HELP: linux?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on Linux." } ;
+
+HELP: solaris?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on Solaris." } ;
+
+HELP: bsd?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on FreeBSD/OpenBSD/NetBSD." } ;
+
+HELP: exit ( n -- )
+{ $values { "n" "an integer exit code" } }
+{ $description "Exits the Factor process." } ;
+
+HELP: millis ( -- n )
+{ $values { "n" "an integer" } }
+{ $description "Outputs the number of milliseconds ellapsed since midnight January 1, 1970." } ;
+
+HELP: os-env ( key -- value )
+{ $values { "key" "a string" } { "value" "a string" } }
+{ $description "Looks up the value of a shell environment variable." }
+{ $examples 
+    "This is an operating system-specific feature. On Unix, you can do:"
+    { $unchecked-example "\"USER\" os-env print" "jane" }
+}
+{ $errors "Windows CE has no concept of ``environment variables'', so this word throws an error there." } ;
+
+HELP: win32?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on 32-bit Windows." } ;
+
+HELP: win64?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on 64-bit Windows." } ;
+
+HELP: image
+{ $values { "path" "a pathname string" } }
+{ $description "Outputs the pathname of the currently running Factor image." } ;
+
+HELP: vm
+{ $values { "path" "a pathname string" } }
+{ $description "Outputs the pathname of the currently running Factor VM." } ;
+
+HELP: unix?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if Factor is running on a Unix-like system. While this is a rather vague notion, one can use it to make certain assumptions about system calls and file structure which are not valid on Windows." } ;
+
+HELP: cell
+{ $values { "n" "a positive integer" } }
+{ $description "Outputs the pointer size in bytes of the current CPU architecture." } ;
+
+HELP: cells
+{ $values { "m" "an integer" } { "n" "an integer" } }
+{ $description "Computes the number of bytes used by " { $snippet "m" } " CPU operand-sized cells." } ;
+
+HELP: cell-bits
+{ $values { "n" "an integer" } }
+{ $description "Outputs the number of bits in one CPU operand-sized cell." } ;
+
+HELP: bootstrap-cell
+{ $values { "n" "a positive integer" } }
+{ $description "Outputs the pointer size in bytes for the target image (if bootstrapping) or the current CPU architecture (otherwise)." } ;
+
+HELP: bootstrap-cells
+{ $values { "m" "an integer" } { "n" "an integer" } }
+{ $description "Computes the number of bytes used by " { $snippet "m" } " cells in the target image (if bootstrapping) or the current CPU architecture (otherwise)." } ;
+
+HELP: bootstrap-cell-bits
+{ $values { "n" "an integer" } }
+{ $description "Outputs the number of bits in one cell in the target image (if bootstrapping) or the current CPU architecture (otherwise)." } ;
diff --git a/core/system/system-tests.factor b/core/system/system-tests.factor
new file mode 100644 (file)
index 0000000..7b06e6a
--- /dev/null
@@ -0,0 +1,5 @@
+USING: math tools.test system ;
+IN: temporary
+
+[ t ] [ cell integer? ] unit-test
+[ t ] [ bootstrap-cell integer? ] unit-test
diff --git a/core/system/system.factor b/core/system/system.factor
new file mode 100644 (file)
index 0000000..0e42da0
--- /dev/null
@@ -0,0 +1,57 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: system
+USING: kernel kernel.private sequences math namespaces ;
+
+: cell ( -- n ) 7 getenv ; foldable
+
+: cells ( m -- n ) cell * ; inline
+
+: cell-bits ( -- n ) 8 cells ; inline
+
+: cpu ( -- cpu ) 8 getenv ; foldable
+
+: os ( -- os ) 9 getenv ; foldable
+
+: image ( -- path ) 13 getenv ;
+
+: vm ( -- path ) 14 getenv ;
+
+: wince? ( -- ? )
+    os "wince" = ; foldable
+
+: winnt? ( -- ? )
+    os "windows" = ; foldable
+
+: windows? ( -- ? )
+    wince? winnt? or ; foldable
+
+: win32? ( -- ? )
+    winnt? cell 4 = and ; foldable
+
+: win64? ( -- ? )
+    winnt? cell 8 = and ; foldable
+
+: macosx? ( -- ? ) os "macosx" = ; foldable
+
+: embedded? ( -- ? ) 15 getenv ;
+
+: unix? ( -- ? )
+    os {
+        "freebsd" "openbsd" "linux" "macosx" "solaris"
+    } member? ;
+
+: bsd? ( -- ? )
+    os { "freebsd" "openbsd" "macosx" } member? ;
+
+: linux? ( -- ? )
+    os "linux" = ;
+
+: solaris? ( -- ? )
+    os "solaris" = ;
+
+: bootstrap-cell \ cell get cell or ; inline
+
+: bootstrap-cells bootstrap-cell * ; inline
+
+: bootstrap-cell-bits 8 bootstrap-cells ; inline
diff --git a/core/test/binary.factor b/core/test/binary.factor
deleted file mode 100644 (file)
index 986ea45..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-IN: temporary
-USING: io test ;
-
-[ "\0\0\u0004\u00d2" ] [ 1234 4 >be ] unit-test
-[ "\u00d2\u0004\0\0" ] [ 1234 4 >le ] unit-test
-
-[ 1234 ] [ 1234 4 >be be> ] unit-test
-[ 1234 ] [ 1234 4 >le le> ] unit-test
diff --git a/core/test/collections/arrays.factor b/core/test/collections/arrays.factor
deleted file mode 100644 (file)
index 2382629..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: temporary
-USING: arrays kernel sequences sequences-internals test vectors ;
-
-[ -2 { "a" "b" "c" } nth ] unit-test-fails
-[ 10 { "a" "b" "c" } nth ] unit-test-fails
-[ "hi" -2 { "a" "b" "c" } set-nth ] unit-test-fails
-[ "hi" 10 { "a" "b" "c" } set-nth ] unit-test-fails
-[ f ] [ { "a" "b" "c" } dup clone eq? ] unit-test
-[ "hi" ] [ "hi" 1 { "a" "b" "c" } clone [ set-nth ] keep second ] unit-test
-[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } >vector ] unit-test
-[ f ] [ { "a" "b" "c" } dup >array eq? ] unit-test
-[ t ] [ { "a" "b" "c" } dup { } like eq? ] unit-test
-[ t ] [ { "a" "b" "c" } dup array>vector underlying eq? ] unit-test
-[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } V{ } like ] unit-test
-[ { "a" "b" "c" } ] [ { "a" } { "b" "c" } append ] unit-test
-[ { "a" "b" "c" "d" "e" } ]
-[ { "a" } { "b" "c" } { "d" "e" } 3append ] unit-test
diff --git a/core/test/collections/hashtables.factor b/core/test/collections/hashtables.factor
deleted file mode 100644 (file)
index 6e2df4e..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: namespaces
-USE: test
-USE: vectors
-USE: sequences
-USE: sequences-internals
-USE: hashtables
-USE: io
-USE: prettyprint
-USE: errors
-
-[ "hi" V{ 1 2 3 } hash ] unit-test-fails
-
-[ H{ } ] [ { } [ dup ] map>hash ] unit-test
-
-[ ] [ 1000 [ dup sq ] map>hash "testhash" set ] unit-test
-
-[ V{ } ]
-[ 1000 [ dup sq swap "testhash" get hash = not ] subset ]
-unit-test
-
-[ t ]
-[ "testhash" get hashtable? ]
-unit-test
-
-[ f ]
-[ { 1 { 2 3 } } hashtable? ]
-unit-test
-
-! Test some hashcodes.
-
-[ t ] [ [ 1 2 3 ] hashcode [ 1 2 3 ] hashcode = ] unit-test
-[ t ] [ [ 1 [ 2 3 ] 4 ] hashcode [ 1 [ 2 3 ] 4 ] hashcode = ] unit-test
-
-[ t ] [ 12 hashcode 12 hashcode = ] unit-test
-[ t ] [ 12 >bignum hashcode 12 hashcode = ] unit-test
-[ t ] [ 12.0 hashcode 12 >bignum hashcode = ] unit-test
-
-! Test various odd keys to see if they work.
-
-16 <hashtable> "testhash" set
-
-t C{ 2 3 } "testhash" get set-hash
-f 100000000000000000000000000 "testhash" get set-hash
-{ } { [ { } ] } "testhash" get set-hash
-
-[ t ] [ C{ 2 3 } "testhash" get hash ] unit-test
-[ f ] [ 100000000000000000000000000 "testhash" get hash* drop ] unit-test
-[ { } ] [ { [ { } ] } clone "testhash" get hash* drop ] unit-test
-
-! Regression
-3 <hashtable> "broken-remove" set
-1 W{ \ + } dup "x" set "broken-remove" get set-hash
-2 W{ \ = } dup "y" set "broken-remove" get set-hash
-"x" get "broken-remove" get remove-hash
-2 "y" get "broken-remove" get set-hash
-[ 1 ] [ "broken-remove" get hash-keys length ] unit-test
-
-{
-    { "salmon" "fish" }
-    { "crocodile" "reptile" }
-    { "cow" "mammal" }
-    { "visual basic" "language" }
-} alist>hash "testhash" set
-
-[ f f ] [
-    "visual basic" "testhash" get remove-hash
-    "visual basic" "testhash" get hash*
-] unit-test
-
-[ t ] [ H{ } dup subhash? ] unit-test
-[ f ] [ H{ { 1 3 } } H{ } subhash? ] unit-test
-[ t ] [ H{ } H{ { 1 3 } } subhash? ] unit-test
-[ t ] [ H{ { 1 3 } } H{ { 1 3 } } subhash? ] unit-test
-[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } subhash? ] unit-test
-[ f ] [ H{ { 1 f } } H{ } subhash? ] unit-test
-[ t ] [ H{ { 1 f } } H{ { 1 f } } subhash? ] unit-test
-
-[ t ] [ H{ } dup = ] unit-test
-[ f ] [ "xyz" H{ } = ] unit-test
-[ t ] [ H{ } H{ } = ] unit-test
-[ f ] [ H{ { 1 3 } } H{ } = ] unit-test
-[ f ] [ H{ } H{ { 1 3 } } = ] unit-test
-[ t ] [ H{ { 1 3 } } H{ { 1 3 } } = ] unit-test
-[ f ] [ H{ { 1 3 } } H{ { 1 "hey" } } = ] unit-test
-
-! Test some combinators
-[
-    { 4 14 32 }
-] [
-    [
-        2 H{
-            { 1 2 }
-            { 3 4 }
-            { 5 6 }
-        } [ * + , ] hash-each-with
-    ] { } make
-] unit-test
-
-[ t ] [ H{ } [ 2drop f ] hash-all? ] unit-test
-[ t ] [ H{ { 1 1 } } [ = ] hash-all? ] unit-test
-[ f ] [ H{ { 1 2 } } [ = ] hash-all? ] unit-test
-[ t ] [ H{ { 1 1 } { 2 2 } } [ = ] hash-all? ] unit-test
-[ f ] [ H{ { 1 2 } { 2 2 } } [ = ] hash-all? ] unit-test
-
-[ H{ } ] [ H{ { t f } { f t } } [ 2drop f ] hash-subset ] unit-test
-[ H{ { 3 4 } { 4 5 } { 6 7 } } ] [
-    3 H{ { 1 2 } { 2 3 } { 3 4 } { 4 5 } { 6 7 } }
-    [ drop <= ] hash-subset-with
-] unit-test
-
-! Testing the hash element counting
-
-H{ } clone "counting" set
-"value" "key" "counting" get set-hash
-[ 1 ] [ "counting" get hash-size ] unit-test
-"value" "key" "counting" get set-hash
-[ 1 ] [ "counting" get hash-size ] unit-test
-"key" "counting" get remove-hash
-[ 0 ] [ "counting" get hash-size ] unit-test
-"key" "counting" get remove-hash
-[ 0 ] [ "counting" get hash-size ] unit-test
-
-! Test rehashing
-
-2 <hashtable> "rehash" set
-
-1 1 "rehash" get set-hash
-2 2 "rehash" get set-hash
-3 3 "rehash" get set-hash
-4 4 "rehash" get set-hash
-5 5 "rehash" get set-hash
-6 6 "rehash" get set-hash
-
-[ 6 ] [ "rehash" get hash-size ] unit-test
-
-[ 6 ] [ "rehash" get clone hash-size ] unit-test
-
-"rehash" get clear-hash
-
-[ 0 ] [ "rehash" get hash-size ] unit-test
-
-[
-    3
-] [
-    2 H{
-        { 1 2 }
-        { 2 3 }
-    } clone hash
-] unit-test
-
-! There was an assoc in place of assoc* somewhere
-3 <hashtable> "f-hash-test" set
-
-10 [ f f "f-hash-test" get set-hash ] times
-
-[ 1 ] [ "f-hash-test" get hash-size ] unit-test
-
-[ 21 ] [
-    0 H{
-        { 1 2 }
-        { 3 4 }
-        { 5 6 }
-    } [
-        + +
-    ] hash-each
-] unit-test
-
-H{ } clone "cache-test" set
-
-[ 4 ] [ 1 "cache-test" get [ 3 + ] cache ] unit-test
-[ 5 ] [ 2 "cache-test" get [ 3 + ] cache ] unit-test
-[ 4 ] [ 1 "cache-test" get [ 3 + ] cache ] unit-test
-[ 5 ] [ 2 "cache-test" get [ 3 + ] cache ] unit-test
-
-[
-    H{ { "factor" "rocks" } { 3 4 } }
-] [
-    H{ { "factor" "rocks" } { "dup" "sq" } { 3 4 } }
-    H{ { "factor" "rocks" } { 1 2 } { 2 3 } { 3 4 } }
-    hash-intersect
-] unit-test
-
-[
-    H{ { 1 2 } { 2 3 } }
-] [
-    H{ { "factor" "rocks" } { "dup" "sq" } { 3 4 } }
-    H{ { "factor" "rocks" } { 1 2 } { 2 3 } { 3 4 } }
-    hash-diff
-] unit-test
-
-[
-    H{ { 1 2 } { 2 3 } { 6 5 } }
-] [
-    H{ { 2 4 } { 6 5 } } H{ { 1 2 } { 2 3 } }
-    hash-union
-] unit-test
-
-[ { 1 3 } ] [ H{ { 2 2 } } { 1 2 3 } remove-all ] unit-test
-
-! Resource leak...
-H{ } "x" set
-100 [ drop "x" get clear-hash ] each
-
-! Crash discovered by erg
-[ t ] [ 3/4 <hashtable> dup clone = ] unit-test
-
-! Another crash discovered by erg
-[ ] [
-    H{ } clone
-    [ 1 swap set-hash ] catch drop
-    [ 2 swap set-hash ] catch drop
-    [ 3 swap set-hash ] catch drop
-    drop
-] unit-test
diff --git a/core/test/collections/namespaces.factor b/core/test/collections/namespaces.factor
deleted file mode 100644 (file)
index 14c3067..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-IN: temporary
-USE: kernel
-USE: namespaces
-USE: test
-USE: words
-
-H{ } clone "test-namespace" set
-
-: test-namespace ( -- )
-    H{ } clone dup [ namespace = ] bind ;
-
-[ t ] [ test-namespace ] unit-test
-
-[
-    "nested" off
-
-    "nested" nest [ 5 "x" set ] bind
-    [ 5 ] [ "nested" nest [ "x" get ] bind ] unit-test
-
-] with-scope
-
-10 "some-global" set
-[ f ]
-[ H{ } clone [ f "some-global" set "some-global" get ] bind ]
-unit-test
diff --git a/core/test/collections/queues.factor b/core/test/collections/queues.factor
deleted file mode 100644 (file)
index 082381a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-IN: temporary
-USING: kernel math namespaces queues sequences test ;
-
-<queue> "queue" set
-
-[ t ] [ "queue" get queue-empty? ] unit-test
-
-[ ] [ [ 1 2 3 4 5 ] [ "queue" get enque ] each ] unit-test
-
-[ { 1 2 3 4 5 } ] [ 5 [ drop "queue" get deque ] map ] unit-test
-
-[ "queue" get deque ] unit-test-fails
diff --git a/core/test/collections/sbuf.factor b/core/test/collections/sbuf.factor
deleted file mode 100644 (file)
index 4ad90b2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-IN: temporary
-USING: kernel math namespaces sequences strings test ;
-
-[ 5 ] [ "Hello" >sbuf length ] unit-test
-
-[ "Hello" ] [
-    100 <sbuf> "buf" set
-    "Hello" "buf" get swap nappend
-    "buf" get clone "buf-clone" set
-    "World" "buf-clone" get swap nappend
-    "buf" get >string
-] unit-test
-
-[ CHAR: h ] [ 0 SBUF" hello world" nth ] unit-test
-[ CHAR: H ] [
-    CHAR: H 0 SBUF" hello world" [ set-nth ] keep first
-] unit-test
-
-[ SBUF" x" ] [ 1 <sbuf> CHAR: x >bignum over push ] unit-test
diff --git a/core/test/collections/sequences.factor b/core/test/collections/sequences.factor
deleted file mode 100644 (file)
index 16e78ef..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-IN: temporary
-USING: arrays kernel math namespaces sequences
-sequences-internals strings test vectors ;
-
-[ V{ 1 2 3 4 } ] [ 1 5 dup <slice> >vector ] unit-test
-[ 3 ] [ 1 4 dup <slice> length ] unit-test
-[ 2 ] [ 1 3 { 1 2 3 4 } <slice> length ] unit-test
-[ V{ 2 3 } ] [ 1 3 { 1 2 3 4 } <slice> >vector ] unit-test
-[ V{ 4 5 } ] [ { 1 2 3 4 5 } 2 tail-slice* >vector ] unit-test
-[ V{ 3 4 } ] [ 2 4 1 10 dup <slice> subseq >vector ] unit-test
-[ V{ 3 4 } ] [ 0 2 2 4 1 10 dup <slice> <slice> subseq >vector ] unit-test
-[ "cba" ] [ "abcdef" 3 head-slice reverse ] unit-test
-
-[ 5040 ] [ [ 1 2 3 4 5 6 7 ] 1 [ * ] reduce ] unit-test
-
-[ 5040 [ 1 1 2 6 24 120 720 ] ]
-[ [ 1 2 3 4 5 6 7 ] 1 [ * ] accumulate ] unit-test
-
-[ -1 f ] [ [ ] [ ] find ] unit-test
-[ 0 1 ] [ [ 1 ] [ ] find ] unit-test
-[ 1 "world" ] [ [ "hello" "world" ] [ "world" = ] find ] unit-test
-[ 2 3 ] [ [ 1 2 3 ] [ 2 > ] find ] unit-test
-[ -1 f ] [ [ 1 2 3 ] [ 10 > ] find ] unit-test
-
-[ 1 CHAR: e ]
-[ "aeiou" "hello world" [ swap member? ] find-with ] unit-test
-
-[ 4 CHAR: o ]
-[ "aeiou" 3 "hello world" [ swap member? ] find-with* ] unit-test
-
-[ f         ] [ 3 [ ]     member? ] unit-test
-[ f         ] [ 3 [ 1 2 ] member? ] unit-test
-[ t ] [ 1 [ 1 2 ] member? ] unit-test
-[ t ] [ 2 [ 1 2 ] member? ] unit-test
-
-[ t ]
-[ [ "hello" "world" ] [ second ] keep memq? ] unit-test
-
-[ 4 ] [ CHAR: x "tuvwxyz" >vector index ] unit-test 
-
-[ -1 ] [ CHAR: x 5 "tuvwxyz" >vector index* ] unit-test 
-
-[ -1 ] [ CHAR: a 0 "tuvwxyz" >vector index* ] unit-test
-
-[ f ] [ [ "Hello" { } 4/3 ] [ string? ] all? ] unit-test
-[ t ] [ [ ] [ ] all? ] unit-test
-[ t ] [ [ "hi" t 1/2 ] [ ] all? ] unit-test
-
-[ [ 1 2 3 ] ] [ [ 1 4 2 5 3 6 ] [ 4 < ] subset ] unit-test
-[ { 4 2 6 } ] [ { 1 4 2 5 3 6 } [ 2 mod 0 = ] subset ] unit-test
-
-[ [ 3 ] ] [ 2 [ 1 2 3 ] [ < ] subset-with ] unit-test
-
-[ "hello world how are you" ]
-[ { "hello" "world" "how" "are" "you" } " " join ]
-unit-test
-
-[ "" ] [ { } "" join ] unit-test
-
-[ { } ] [ { } flip ] unit-test
-
-[ { "b" "e" } ] [ 1 { { "a" "b" "c" } { "d" "e" "f" } } flip nth ] unit-test
-
-[ { { 1 4 } { 2 5 } { 3 6 } } ]
-[ { { 1 2 3 } { 4 5 6 } } flip ] unit-test
-
-[ f ] [ [ { } { } "Hello" ] all-equal? ] unit-test
-[ f ] [ [ { 2 } { } { } ] all-equal? ] unit-test
-[ t ] [ [ ] all-equal? ] unit-test
-[ t ] [ [ 1/2 ] all-equal? ] unit-test
-[ t ] [ [ 1.0 10/10 1 ] all-equal? ] unit-test
-[ t ] [ { 1 2 3 4 } [ < ] monotonic? ] unit-test
-[ f ] [ { 1 2 3 4 } [ > ] monotonic? ] unit-test
-[ [ 2 3 4 ] ] [ 1 [ 1 2 3 ] [ + ] map-with ] unit-test
-
-[ 1 ] [ 0 [ 1 2 ] nth ] unit-test
-[ 2 ] [ 1 [ 1 2 ] nth ] unit-test
-
-[ [ ]           ] [ [ ]   [ ]       append ] unit-test
-[ [ 1 ]         ] [ [ 1 ] [ ]       append ] unit-test
-[ [ 2 ]         ] [ [ ] [ 2 ]       append ] unit-test
-[ [ 1 2 3 4 ]   ] [ [ 1 2 3 ] [ 4 ] append ] unit-test
-[ [ 1 2 3 4 ]   ] [ [ 1 2 3 ] { 4 } append ] unit-test
-
-[ "a" -1 append ] unit-test-fails
-[ -1 "a" append ] unit-test-fails
-
-[ [ ]       ] [ 1 [ ]           remove ] unit-test
-[ [ ]       ] [ 1 [ 1 ]         remove ] unit-test
-[ [ 3 1 1 ] ] [ 2 [ 3 2 1 2 1 ] remove ] unit-test
-
-[ [ ]       ] [ [ ]       reverse ] unit-test
-[ [ 1 ]     ] [ [ 1 ]     reverse ] unit-test
-[ [ 3 2 1 ] ] [ [ 1 2 3 ] reverse ] unit-test
-
-[ f ] [ f 0 head ] unit-test
-[ [ ] ] [ [ 1 ] 0 head ] unit-test
-[ [ 1 2 3 ] ] [ [ 1 2 3 4 ] 3 head ] unit-test
-[ [ ] ] [ [ 1 2 3 ] 3 tail ] unit-test
-[ [ 3 ] ] [ [ 1 2 3 ] 2 tail ] unit-test
-
-[ t ] [ [ 1 2 3 ] [ 1 2 3 ] sequence= ] unit-test
-[ t ] [ [ 1 2 3 ] { 1 2 3 } sequence= ] unit-test
-[ t ] [ { 1 2 3 } [ 1 2 3 ] sequence= ] unit-test
-[ f ] [ [ ] [ 1 2 3 ] sequence= ] unit-test
-
-[ { 1 3 2 4 } ] [ { 1 2 3 4 } clone 1 2 pick exchange ] unit-test
-
-[ 3 ] [ { 1 2 3 4 } midpoint ] unit-test
-
-[ -1 ] [ 3 { } [ - ] binsearch ] unit-test
-[ 0 ] [ 3 { 3 } [ - ] binsearch ] unit-test
-[ 1 ] [ 2 { 1 2 3 } [ - ] binsearch ] unit-test
-[ 3 ] [ 4 { 1 2 3 4 5 6 } [ - ] binsearch ] unit-test
-[ 1 ] [ 3.5 { 1 2 3 4 5 6 7 8 } [ - ] binsearch ] unit-test
-[ 3 ] [ 5.5 { 1 2 3 4 5 6 7 8 } [ - ] binsearch ] unit-test
-[ 10 ] [ 10 20 >vector [ - ] binsearch ] unit-test
-
-: seq-sorter 0 over length 1- <sorter> ;
-
-[ { 4 2 3 1 } ]
-[ { 1 2 3 4 } clone dup seq-sorter sorter-exchange ] unit-test
-
-[ -1 ] [ [ - ] { 1 2 3 4 } seq-sorter 1 compare ] unit-test
-
-[ 1 ] [ [ - ] { -5 4 -3 5 } seq-sorter 2dup sort-up sorter-start nip ] unit-test
-
-[ 3 ] [ [ - ] { -5 4 -3 -6 5 } seq-sorter 2dup sort-down sorter-end nip ] unit-test
-
-[ { 1 2 3 4 5 6 7 8 9 } ] [
-    [ - ] { 9 8 7 6 5 4 3 2 1 } clone seq-sorter 2dup sort-step
-    sorter-seq >array nip
-] unit-test
-
-[ { 1 2 3 4 5 6 7 8 9 } ] [
-    [ - ] { 1 2 3 4 5 6 7 8 9 } clone seq-sorter 2dup sort-step
-    sorter-seq >array nip
-] unit-test
-
-[ [ ] ] [ [ ] natural-sort ] unit-test
-
-[ t ] [
-    100 [
-        drop
-        100 [ drop 20 random-int [ drop 1000 random-int ] map ] map natural-sort [ <=> 0 <= ] monotonic?
-    ] all?
-] unit-test
-
-[ { "" "a" "aa" "aaa" } ]
-[ 4 [ CHAR: a <string> ] map ]
-unit-test
-
-[ V{ } ] [ "f" V{ } clone [ delete ] keep ] unit-test
-[ V{ } ] [ "f" V{ "f" } clone [ delete ] keep ] unit-test
-[ V{ } ] [ "f" V{ "f" "f" } clone [ delete ] keep ] unit-test
-[ V{ "x" } ] [ "f" V{ "f" "x" "f" } clone [ delete ] keep ] unit-test
-[ V{ "y" "x" } ] [ "f" V{ "y" "f" "x" "f" } clone [ delete ] keep ] unit-test
-
-[ { 1 4 9 } ] [ { 1 2 3 } clone dup [ sq ] inject ] unit-test
-
-[ { "one" "two" "three" 4 5 6 } ]
-[
-    { "one" "two" "three" }
-    { 1 2 3 } { 1 2 3 4 5 6 } clone [ subst ] keep
-] unit-test
-
-[ ] [ { 1 2 } [ 2drop 1 ] sort drop ] unit-test
-
-[ 5 ] [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
-[ 5 ] [ 1 >bignum { 1 5 7 } nth-unsafe ] unit-test
-[ 5 ] [ 1 >bignum "\u0001\u0005\u0007" nth-unsafe ] unit-test
-
-[ "before&after" ] [ "&" 6 11 "before and after" replace-slice ] unit-test
-
-[ 3 "a" ] [ { "a" "b" "c" "a" "d" } [ "a" = ] find-last ] unit-test
-
-[ -1 f ] [ -1 { 1 2 3 } [ 1 = ] find* ] unit-test
-
-[ 0 ] [ { "a" "b" "c" } { "A" "B" "C" } mismatch ] unit-test
-
-[ 1 ] [ { "a" "b" "c" } { "a" "B" "C" } mismatch ] unit-test
-
-[ -1 ] [ { "a" "b" "c" } { "a" "b" "c" } mismatch ] unit-test
-
-[ V{ } V{ } ] [ { "a" "b" } { "a" "b" } drop-prefix [ >vector ] 2apply ] unit-test
-
-[ V{ "C" } V{ "c" } ] [ { "a" "b" "C" } { "a" "b" "c" } drop-prefix [ >vector ] 2apply ] unit-test
-
-[ -1 1 "abc" <slice> ] unit-test-fails
-
-[ V{ "a" "b" } V{ } ] [ { "X" "a" "b" } { "X" } drop-prefix [ >vector ] 2apply ] unit-test
-
-[ -1 ] [ "ab" "abc" <=> ] unit-test
-[ 1 ] [ "abc" "ab" <=> ] unit-test
-
-[ 1 4 9 16 16 V{ f 1 4 9 16 } ] [
-    V{ } clone "cache-test" set
-    1 "cache-test" get [ sq ] cache-nth
-    2 "cache-test" get [ sq ] cache-nth
-    3 "cache-test" get [ sq ] cache-nth
-    4 "cache-test" get [ sq ] cache-nth
-    4 "cache-test" get [ "wrong" ] cache-nth
-    "cache-test" get
-] unit-test
-
-[ 1 ] [ 1/2 { 1 2 3 } nth ] unit-test
-
-! Pathological case
-[ "ihbye" ] [ "hi" <reversed> "bye" append ] unit-test
-
-[ 10 "hi" "bye" copy-into ] unit-test-fails
-
-[ { 1 2 3 5 6 } ] [ 3 { 1 2 3 4 5 6 } remove-nth ] unit-test
-
-[ V{ 1 2 3 } ]
-[ 3 V{ 1 2 } clone [ push-new ] keep ] unit-test
-
-[ V{ 1 2 3 } ]
-[ 3 V{ 1 3 2 } clone [ push-new ] keep ] unit-test
-
-! Columns
-{ { 1 2 3 } { 4 5 6 } { 7 8 9 } } [ clone ] map "seq" set
-
-[ { 1 4 7 } ] [ "seq" get 0 <column> >array ] unit-test
-[ ] [ "seq" get 1 <column> [ sq ] inject ] unit-test
-[ { 4 25 64 } ] [ "seq" get 1 <column> >array ] unit-test
-
-[ { 1 2 3 } 0 group ] unit-test-fails
diff --git a/core/test/collections/strings.factor b/core/test/collections/strings.factor
deleted file mode 100644 (file)
index adf61a4..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-IN: temporary
-USE: errors
-USE: kernel
-USE: math
-USE: namespaces
-USE: strings
-USE: test
-USE: sequences
-USE: vectors
-
-[ CHAR: b ] [ 1 >bignum "abc" nth ] unit-test
-
-[ ] [ 10 [ [ -1000000 <sbuf> ] catch drop ] times ] unit-test
-
-[ "abc" ] [ [ "a" "b" "c" ] [ [ % ] each ] "" make ] unit-test
-
-[ "abc" ] [ "ab" "c" append ] unit-test
-[ "abc" ] [ "a" "b" "c" 3append ] unit-test
-
-[ 3 ] [ "a" "hola" start ] unit-test
-[ -1 ] [ "x" "hola" start ] unit-test
-[ 0 ] [ "" "a" start ] unit-test
-[ 0 ] [ "" "" start ] unit-test
-[ 0 ] [ "hola" "hola" start ] unit-test
-[ 1 ] [ "ol" "hola" start ] unit-test
-[ -1 ] [ "amigo" "hola" start ] unit-test
-[ -1 ] [ "holaa" "hola" start ] unit-test
-
-[ "Beginning" ] [ "Beginning and end" 9 head ] unit-test
-
-[ f ] [ CHAR: I "team" member? ] unit-test
-[ t ] [ "ea" "team" subseq? ] unit-test
-[ f ] [ "actore" "Factor" subseq? ] unit-test
-
-[ "end" ] [ "Beginning and end" 14 tail ] unit-test
-
-[ "hello" "world" ] [ "hello world" " " split1 ] unit-test
-[ "goodbye" f ] [ "goodbye" " " split1 ] unit-test
-[ "" "" ] [ "great" "great" split1 ] unit-test
-
-[ "and end" t ] [ "Beginning and end" "Beginning " ?head ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?head ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?head ] unit-test
-
-[ "Beginning" t ] [ "Beginning and end" " and end" ?tail ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?tail ] unit-test
-[ "Beginning and end" f ] [ "Beginning and end" "eginning " ?tail ] unit-test
-
-[ { "This" "is" "a" "split" "sentence" } ]
-[ "This is a split sentence" " " split ]
-unit-test
-
-[ { "OneWord" } ]
-[ "OneWord" " " split ]
-unit-test
-
-[ { "a" "b" "c" "d" "e" "f" } ]
-[ "aXbYcXdYeXf" "XY" split ] unit-test
-
-[ { "" "" } ]
-[ " " " " split ] unit-test
-
-[ { "hey" } ]
-[ "hey" " " split ] unit-test
-
-[ "Hello world" t ] [ "Hello world\n" "\n" ?tail ] unit-test
-[ "Hello world" f ] [ "Hello world" "\n" ?tail ] unit-test
-[ "" t ] [ "\n" "\n" ?tail ] unit-test
-[ "" f ] [ "" "\n" ?tail ] unit-test
-
-[ t ] [ CHAR: a letter? ] unit-test
-[ f ] [ CHAR: A letter? ] unit-test
-[ f ] [ CHAR: a LETTER? ] unit-test
-[ t ] [ CHAR: A LETTER? ] unit-test
-[ t ] [ CHAR: 0 digit? ] unit-test
-[ f ] [ CHAR: x digit? ] unit-test
-
-[ t ] [ "abc" "abd" <=> 0 < ] unit-test
-[ t ] [ "z" "abd" <=> 0 > ] unit-test
-
-[ f ] [ [ 0 10 "hello" subseq ] catch not ] unit-test
-
-[ { "hell" "o wo" "rld" } ] [ "hello world" 4 group ] unit-test
-
-[ 4 ] [
-    0 "There are Four Upper Case characters"
-    [ LETTER? [ 1+ ] when ] each
-] unit-test
-
-[ "Replacing+spaces+with+plus" ]
-[
-    "Replacing spaces with plus"
-    [ dup CHAR: \s = [ drop CHAR: + ] when ] map
-]
-unit-test
-
-[ "05" ] [ "5" 2 CHAR: 0 pad-left ] unit-test
-[ "666" ] [ "666" 2 CHAR: 0 pad-left ] unit-test
-
-[ 1 "" nth ] unit-test-fails
-[ -6 "hello" nth ] unit-test-fails
-
-[ t ] [ "hello world" dup >vector >string = ] unit-test 
-
-[ "ab" ] [ 2 "abc" resize-string ] unit-test
-[ "abc\0\0\0" ] [ 6 "abc" resize-string ] unit-test
-
-! Random tester found this
-[ { kernel-error 3 12 -7 } ]
-[ [ 2 -7 resize-string ] catch ] unit-test
diff --git a/core/test/collections/vectors.factor b/core/test/collections/vectors.factor
deleted file mode 100644 (file)
index a243338..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-IN: temporary
-USING: arrays errors kernel kernel-internals math namespaces
-sequences sequences-internals strings test vectors ;
-
-[ ] [ 10 [ [ -1000000 <vector> ] catch drop ] times ] unit-test
-
-[ 3 ] [ [ t f t ] length ] unit-test
-[ 3 ] [ V{ t f t } length ] unit-test
-
-[ -3 V{ } nth ] unit-test-fails
-[ 3 V{ } nth ] unit-test-fails
-[ 3 C{ 1 2 } nth ] unit-test-fails
-
-[ "hey" [ 1 2 ] set-length ] unit-test-fails
-[ "hey" V{ 1 2 } set-length ] unit-test-fails
-
-[ 3 ] [ 3 0 <vector> [ set-length ] keep length ] unit-test
-[ "yo" ] [
-    "yo" 4 1 <vector> [ set-nth ] keep 4 swap nth
-] unit-test
-
-[ 1 V{ } nth ] unit-test-fails
-[ -1 V{ } set-length ] unit-test-fails
-[ V{ } ] [ [ ] >vector ] unit-test
-[ V{ 1 2 } ] [ [ 1 2 ] >vector ] unit-test
-
-[ t ] [
-    100 [ drop 100 random-int ] map >vector
-    dup >array >vector =
-] unit-test
-
-[ f ] [ V{ } V{ 1 2 3 } = ] unit-test
-[ f ] [ V{ 1 2 } V{ 1 2 3 } = ] unit-test
-[ f ] [ [ 1 2 ] V{ 1 2 3 } = ] unit-test
-[ f ] [ V{ 1 2 } [ 1 2 3 ] = ] unit-test
-
-[ { 1 4 9 16 } ]
-[
-    [ 1 2 3 4 ]
-    >vector [ dup * ] map >array
-] unit-test
-
-[ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
-[ t ] [ V{ 1 2 3 } hashcode V{ 1 2 3 } hashcode = ] unit-test
-[ t ] [ V{ 1 V{ 2 } 3 } hashcode V{ 1 V{ 2 } 3 } hashcode = ] unit-test
-[ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
-
-[ V{ 1 2 3 } V{ 1 2 3 4 5 6 } ]
-[ V{ 1 2 3 } dup V{ 4 5 6 } append ] unit-test
-
-[ f ] [ f concat ] unit-test
-[ V{ 1 2 3 4 } ] [ [ V{ 1 } [ 2 ] V{ 3 4 } ] concat ] unit-test
-
-[ V{ } ] [ V{ } 0 tail ] unit-test
-[ V{ } ] [ V{ 1 2 } 2 tail ] unit-test
-[ V{ 3 4 } ] [ V{ 1 2 3 4 } 2 tail ] unit-test
-
-[ V{ 3 } ] [ V{ 1 2 3 } 1 tail* ] unit-test
-
-0 <vector> "funny-stack" set
-
-[ ] [ V{ 1 5 } "funny-stack" get push ] unit-test
-[ ] [ V{ 2 3 } "funny-stack" get push ] unit-test
-[ V{ 2 3 } ] [ "funny-stack" get pop ] unit-test
-[ V{ 1 5 } ] [ "funny-stack" get peek ] unit-test
-[ V{ 1 5 } ] [ "funny-stack" get pop ] unit-test
-[ "funny-stack" get pop ] unit-test-fails
-[ "funny-stack" get pop ] unit-test-fails
-[ ] [ "funky" "funny-stack" get push ] unit-test
-[ "funky" ] [ "funny-stack" get pop ] unit-test
-
-[ t ] [
-    V{ 1 2 3 4 } dup underlying length
-    >r clone underlying length r>
-    =
-] unit-test
-
-[ f ] [
-    V{ 1 2 3 4 } dup clone
-    [ underlying ] 2apply eq?
-] unit-test
-
-[ 0 ] [
-    [
-        10 <vector> "x" set
-        "x" get clone length
-    ] with-scope
-] unit-test
-
-[ -1 ] [ 5 V{ } index ] unit-test
-[ 4 ] [ 5 V{ 1 2 3 4 5 } index ] unit-test
-
-[ t ] [
-    100 >array dup >vector <reversed> >array >r reverse r> =
-] unit-test
diff --git a/core/test/combinators.factor b/core/test/combinators.factor
deleted file mode 100644 (file)
index b4c3f7a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-IN: temporary
-USING: alien errors strings ;
-USE: kernel
-USE: math
-USE: test
-USE: io
-USE: prettyprint
-USE: namespaces
-
-[ slip ] unit-test-fails
-[ 1 slip ] unit-test-fails
-[ 1 2 slip ] unit-test-fails
-[ 1 2 3 slip ] unit-test-fails
-
-[ 5 ] [ [ 2 2 + ] 1 slip + ] unit-test
-
-[ [ ] keep ] unit-test-fails
-
-[ 6 ] [ 2 [ sq ] keep + ] unit-test
-
-[ [ ] 2keep ] unit-test-fails
-[ 1 [ ] 2keep ] unit-test-fails
-[ 3 1 2 ] [ 1 2 [ 2drop 3 ] 2keep ] unit-test
-
-[ 0 ] [ f [ sq ] [ 0 ] if* ] unit-test
-[ 4 ] [ 2 [ sq ] [ 0 ] if* ] unit-test
-
-[ 0 ] [ f [ 0 ] unless* ] unit-test
-[ t ] [ t [ "Hello" ] unless* ] unit-test
-
-[ "2\n" ] [ [ 1 2 [ . ] [ sq . ] ?if ] string-out ] unit-test
-[ "9\n" ] [ [ 3 f [ . ] [ sq . ] ?if ] string-out ] unit-test
-
-[ "even" ] [
-    2 {
-        { [ dup 2 mod 0 = ] [ drop "even" ] }
-        { [ dup 2 mod 1 = ] [ drop "odd" ] }
-    } cond
-] unit-test
-
-[ "odd" ] [
-    3 {
-        { [ dup 2 mod 0 = ] [ drop "even" ] }
-        { [ dup 2 mod 1 = ] [ drop "odd" ] }
-    } cond
-] unit-test
-
-[ "neither" ] [
-    3 {
-        { [ dup string? ] [ drop "string" ] }
-        { [ dup float? ] [ drop "float" ] }
-        { [ dup alien? ] [ drop "alien" ] }
-        { [ t ] [ drop "neither" ] }
-    } cond
-] unit-test
-
-[ ] [
-    [
-        [ drop ] catch drop
-        [ drop ] catch drop
-    ] keep-datastack
-] unit-test
diff --git a/core/test/continuations.factor b/core/test/continuations.factor
deleted file mode 100644 (file)
index 86e3869..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: namespaces
-USE: io
-USE: test
-USE: sequences
-USE: vectors
-
-: (callcc1-test)
-    swap 1- tuck swap ?push
-    over 0 = [ "test-cc" get continue-with ] when
-    (callcc1-test) ;
-
-: callcc1-test ( x -- list )
-    [
-        "test-cc" set V{ } clone (callcc1-test)
-    ] callcc1 nip ;
-
-: callcc-namespace-test ( -- ? )
-    [
-        "test-cc" set
-        5 "x" set
-        [
-            6 "x" set "test-cc" get continue
-        ] with-scope
-    ] callcc0 "x" get 5 = ;
-
-[ t ] [ 10 callcc1-test 10 reverse >vector = ] unit-test
-[ t ] [ callcc-namespace-test ] unit-test
diff --git a/core/test/errors.factor b/core/test/errors.factor
deleted file mode 100644 (file)
index 5362b34..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-IN: temporary
-USE: sequences
-USE: errors
-USE: kernel
-USE: namespaces
-USE: test
-USE: parser
-USE: io
-USE: memory
-
-[ clear drop ] unit-test-fails
-
-[ f ] [ [ ] catch ] unit-test
-
-[ 5 ] [ [ 5 throw ] catch ] unit-test
-
-[ t ] [
-    [ "Hello" throw ] catch drop
-    global [ error get ] bind
-    "Hello" =
-] unit-test
-
-"!!! The following error is part of the test" print
-
-[ ] [ [ 6 [ 12 [ "2 car" ] ] ] print-error ] unit-test
-
-"!!! The following error is part of the test" print
-
-[ [ "2 car" ] parse ] catch print-error
-
-[ f throw ] unit-test-fails
-
-! See how well callstack overflow is handled
-: callstack-overflow callstack-overflow f ;
-[ callstack-overflow ] unit-test-fails
-
-! Weird PowerPC bug.
-[ ] [
-    [ "4" throw ] catch drop
-    full-gc
-    full-gc
-] unit-test
-
-[ f ] [ { "A" "B" } kernel-error? ] unit-test
diff --git a/core/test/generic.factor b/core/test/generic.factor
deleted file mode 100644 (file)
index ddf27f9..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-USING: alien arrays definitions generic hashtables io kernel
-math namespaces parser prettyprint sequences strings test
-vectors words ;
-IN: temporary
-
-GENERIC: class-of
-
-M: fixnum class-of drop "fixnum" ;
-M: word   class-of drop "word"   ;
-
-[ "fixnum" ] [ 5 class-of ] unit-test
-[ "word" ] [ \ class-of class-of ] unit-test
-[ 3.4 class-of ] unit-test-fails
-
-GENERIC: foobar
-M: object foobar drop "Hello world" ;
-M: fixnum foobar drop "Goodbye cruel world" ;
-
-[ "Hello world" ] [ 4 foobar foobar ] unit-test
-[ "Goodbye cruel world" ] [ 4 foobar ] unit-test
-
-GENERIC: bool>str
-M: general-t bool>str drop "true" ;
-M: f bool>str drop "false" ;
-
-: str>bool
-    H{
-        { "true" t }
-        { "false" f }
-    } hash ;
-
-[ t ] [ t bool>str str>bool ] unit-test
-[ f ] [ f bool>str str>bool ] unit-test
-
-! Testing method sorting
-GENERIC: sorting-test
-M: fixnum sorting-test drop "fixnum" ;
-M: object sorting-test drop "object" ;
-[ "fixnum" ] [ 3 sorting-test ] unit-test
-[ "object" ] [ f sorting-test ] unit-test
-
-! Testing unions
-UNION: funnies quotation ratio complex ;
-
-GENERIC: funny
-M: funnies funny drop 2 ;
-M: object funny drop 0 ;
-
-[ 2 ] [ [ { } ] funny ] unit-test
-[ 0 ] [ { } funny ] unit-test
-
-PREDICATE: funnies very-funny number? ;
-
-GENERIC: gooey
-M: very-funny gooey sq ;
-
-[ 1/4 ] [ 1/2 gooey ] unit-test
-
-[ object ] [ object object class-and ] unit-test
-[ fixnum ] [ fixnum object class-and ] unit-test
-[ fixnum ] [ object fixnum class-and ] unit-test
-[ fixnum ] [ fixnum fixnum class-and ] unit-test
-[ fixnum ] [ fixnum integer class-and ] unit-test
-[ fixnum ] [ integer fixnum class-and ] unit-test
-[ null ] [ vector fixnum class-and ] unit-test
-[ number ] [ number object class-and ] unit-test
-[ number ] [ object number class-and ] unit-test
-
-[ t ] [ \ fixnum \ integer class< ] unit-test
-[ t ] [ \ fixnum \ fixnum class< ] unit-test
-[ f ] [ \ integer \ fixnum class< ] unit-test
-[ t ] [ \ integer \ object class< ] unit-test
-[ f ] [ \ integer \ null class< ] unit-test
-[ t ] [ \ null \ object class< ] unit-test
-
-[ t ] [ \ generic \ compound class< ] unit-test
-[ f ] [ \ compound \ generic class< ] unit-test
-
-[ f ] [ \ reversed \ slice class< ] unit-test
-[ f ] [ \ slice \ reversed class< ] unit-test
-
-PREDICATE: word no-docs "documentation" word-prop not ;
-
-UNION: no-docs-union no-docs integer ;
-
-[ t ] [ no-docs no-docs-union class< ] unit-test
-[ f ] [ no-docs-union no-docs class< ] unit-test
-
-TUPLE: a ;
-TUPLE: b ;
-UNION: c a b ;
-
-[ t ] [ \ c \ tuple class< ] unit-test
-[ f ] [ \ tuple \ c class< ] unit-test
-
-DEFER: bah
-FORGET: bah
-UNION: bah fixnum alien ;
-[ bah ] [ \ bah? "predicating" word-prop ] unit-test
-
-DEFER: complement-test
-FORGET: complement-test
-GENERIC: complement-test
-
-M: f         complement-test drop "f" ;
-M: general-t complement-test drop "general-t" ;
-
-[ "general-t" ] [ 5 complement-test ] unit-test
-[ "f" ] [ f complement-test ] unit-test
-
-GENERIC: empty-method-test
-M: object empty-method-test ;
-TUPLE: for-arguments-sake ;
-
-M: for-arguments-sake empty-method-test drop "Hi" ;
-
-TUPLE: another-one ;
-
-[ "Hi" ] [ <for-arguments-sake> empty-method-test empty-method-test ] unit-test
-[ T{ another-one f } ] [ <another-one> empty-method-test ] unit-test
-
-! Test generic see and parsing
-[ "IN: temporary SYMBOL: bah\n\nUNION: bah fixnum alien ;\n" ]
-[ [ \ bah see ] string-out ] unit-test
-
-! Weird bug
-GENERIC: stack-underflow
-M: object stack-underflow 2drop ;
-M: word stack-underflow 2drop ;
-
-GENERIC: union-containment
-M: integer union-containment drop 1 ;
-M: number union-containment drop 2 ;
-
-[ 1 ] [ 1 union-containment ] unit-test
-[ 2 ] [ 1.0 union-containment ] unit-test
-
-! Testing recovery from bad method definitions
-"GENERIC: unhappy" eval
-[ "M: vocabularies unhappy ;" eval ] unit-test-fails
-[ ] [ "GENERIC: unhappy" eval ] unit-test
-
-G: complex-combination 1 standard-combination ;
-M: string complex-combination drop ;
-M: object complex-combination nip ;
-
-[ "hi" ] [ "hi" 3 complex-combination ] unit-test
-[ "hi" ] [ 3 "hi" complex-combination ] unit-test
-
-TUPLE: shit ;
-
-M: shit complex-combination 2array ;
-[ { T{ shit f } 5 } ] [ T{ shit f } 5 complex-combination ] unit-test
-
-[ t ] [ \ complex-combination generic? >boolean ] unit-test
-
-GENERIC: big-generic-test
-M: fixnum big-generic-test "fixnum" ;
-M: bignum big-generic-test "bignum" ;
-M: ratio big-generic-test "ratio" ;
-M: string big-generic-test "string" ;
-M: shit big-generic-test "shit" ;
-
-TUPLE: delegating ;
-
-[ T{ shit f } "shit" ] [ T{ shit f } big-generic-test ] unit-test
-[ T{ shit f } "shit" ] [ T{ delegating T{ shit f } } big-generic-test ] unit-test
-
-[ t ] [ \ + 2generic? ] unit-test
-
-[ "SYMBOL: not-a-class C: not-a-class ;" parse ] unit-test-fails
-
-! Test math-combination
-[ [ >r >float r> ] ] [ \ real \ float math-upgrade ] unit-test
-[ [ >float ] ] [ \ float \ real math-upgrade ] unit-test
-[ [ >r >bignum r> ] ] [ \ fixnum \ bignum math-upgrade ] unit-test
-[ [ >float ] ] [ \ float \ integer math-upgrade ] unit-test
-[ number ] [ \ number \ float math-class-max ] unit-test
-[ float ] [ \ real \ float math-class-max ] unit-test
-
-TUPLE: forget-class-test ;
-[ t ] [ forget-class-test tuple class<map get hash hash-member? ] unit-test
-[ ] [ forget-class-test forget ] unit-test
-[ f ] [ forget-class-test class<map get hash-member? ] unit-test
-[ f ] [ forget-class-test tuple class<map get hash hash-member? ] unit-test
diff --git a/core/test/init.factor b/core/test/init.factor
deleted file mode 100644 (file)
index 64b0004..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-IN: temporary
-USE: namespaces
-USE: test
-USE: kernel
-USE: hashtables
-USE: command-line
-
-[
-    [ f ] [ "-no-user-init" cli-arg ] unit-test
-    [ f ] [ "user-init" get ] unit-test
-
-    [ f ] [ "-user-init" cli-arg ] unit-test
-    [ t ] [ "user-init" get ] unit-test
-    
-    [ "sdl.factor" ] [ "sdl.factor" cli-arg ] unit-test
-] with-scope
diff --git a/core/test/io/binary.txt b/core/test/io/binary.txt
deleted file mode 100644 (file)
index ce542ef..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ÿ
\ No newline at end of file
diff --git a/core/test/io/empty-file.txt b/core/test/io/empty-file.txt
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/core/test/io/io.factor b/core/test/io/io.factor
deleted file mode 100644 (file)
index da30d99..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-IN: temporary
-USING: io kernel math parser strings test ;
-
-[ 4 ] [
-    "resource:/core/test/io/no-trailing-eol.factor" run-file
-] unit-test
-
-: <resource-reader> ( resource -- stream )
-    resource-path <file-reader> ;
-
-: lines-test ( stream -- line1 line2 )
-    [ readln readln ] with-stream ;
-
-[
-    "This is a line."
-    "This is another line."
-] [
-    "/core/test/io/windows-eol.txt" <resource-reader> lines-test
-] unit-test
-
-[
-    "This is a line."
-    "This is another line."
-] [
-    "/core/test/io/mac-os-eol.txt" <resource-reader> lines-test
-] unit-test
-
-[
-    "This is a line."
-    "This is another line."
-] [
-    "/core/test/io/unix-eol.txt" <resource-reader> lines-test
-] unit-test
-
-[
-    "This is a line.\rThis is another line.\r"
-] [
-    "/core/test/io/mac-os-eol.txt" <resource-reader>
-    [ 500 read ] with-stream
-] unit-test
-
-[
-    255
-] [
-    "/core/test/io/binary.txt" <resource-reader>
-    [ read1 ] with-stream >fixnum
-] unit-test
-
-! Make sure we use correct to_c_string form when writing
-[ ] [ "\0" write ] unit-test
-
-[ "" ] [ 0 read ] unit-test
-
-! [ ] [ "123" write 9000 CHAR: x <string> write flush ] unit-test
-
-[ "line 1" CHAR: l ]
-[
-    "line 1\nline 2\nline 3" <string-reader>
-    dup stream-readln swap stream-read1
-]
-unit-test
-
-[ f ]
-[ "" <string-reader> stream-readln ]
-unit-test
-
-[ ] [ 10000 f set-timeout ] unit-test
-
-[ "" ] [
-    "/core/test/io/binary.txt" <resource-reader>
-    [ 0.2 read ] with-stream
-] unit-test
-
-[ { } ]
-[ "/core/test/io/empty-file.txt" <resource-reader> lines ]
-unit-test
-
-[ "xyzzy" ] [ [ "xyzzy" write ] string-out ] unit-test
-
-[ { "" } ] [ "" string-lines ] unit-test
-[ { "" "" } ] [ "\n" string-lines ] unit-test
-[ { "" "" } ] [ "\r" string-lines ] unit-test
-[ { "" "" } ] [ "\r\n" string-lines ] unit-test
-[ { "hello" } ] [ "hello" string-lines ] unit-test
-[ { "hello" "" } ] [ "hello\n" string-lines ] unit-test
-[ { "hello" "" } ] [ "hello\r" string-lines ] unit-test
-[ { "hello" "" } ] [ "hello\r\n" string-lines ] unit-test
-[ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test
-[ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test
-[ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test
diff --git a/core/test/io/mac-os-eol.txt b/core/test/io/mac-os-eol.txt
deleted file mode 100644 (file)
index 53c8eaf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-This is a line.\rThis is another line.\r
\ No newline at end of file
diff --git a/core/test/io/nested-style.factor b/core/test/io/nested-style.factor
deleted file mode 100644 (file)
index df25377..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-IN: temporary
-USING: io kernel math namespaces styles test ;
-
-[ "A" ] [
-    [
-        [
-            H{ { highlight t } } [
-                H{ } [ "a" write ] with-nesting
-            ] with-style
-        ] string-out
-    ] with-scope
-] unit-test
-
-[ "a" ] [
-    [
-        [
-            H{ } [
-                H{ { highlight t } } [ "a" write ] with-nesting
-            ] with-style
-        ] string-out
-    ] with-scope
-] unit-test
diff --git a/core/test/io/no-trailing-eol.factor b/core/test/io/no-trailing-eol.factor
deleted file mode 100644 (file)
index 8fbf328..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-USE: math
-2 2 +
\ No newline at end of file
diff --git a/core/test/io/unix-eol.txt b/core/test/io/unix-eol.txt
deleted file mode 100644 (file)
index a0853ee..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-This is a line.
-This is another line.
diff --git a/core/test/io/windows-eol.txt b/core/test/io/windows-eol.txt
deleted file mode 100644 (file)
index c78d007..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-This is a line.\r
-This is another line.\r
diff --git a/core/test/kernel.factor b/core/test/kernel.factor
deleted file mode 100644 (file)
index b6cb453..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-IN: scratchpad
-USING: arrays kernel kernel-internals math memory namespaces
-sequences test errors math-internals ;
-
-[ 0 ] [ f size ] unit-test
-[ t ] [ [ \ = \ = ] all-equal? ] unit-test
-
-! some primitives are missing GC checks
-[ ] [ 1000000 [ drop H{ } clone >n n> drop ] each ] unit-test
-[ ] [ 1.0 10000000 [ 1.0 * ] times drop ] unit-test
-[ ] [ 268435455 >fixnum 10000000 [ dup dup + drop ] times drop ] unit-test
-[ ] [ 268435455 >fixnum 10000000 [ dup dup fixnum+ drop ] times drop ] unit-test
-[ ] [ 10000000 [ drop 1/3 >fixnum drop ] each ] unit-test
-[ ] [ 10000000 [ drop 1/3 >bignum drop ] each ] unit-test
-[ ] [ 10000000 [ drop 1/3 >float drop ] each ] unit-test
-
-! Don't leak extra roots if error is thrown
-[ ] [ 10000 [ [ -1 f <array> ] catch drop ] times ] unit-test
-
-[ t ] [ cell integer? ] unit-test
-[ t ] [ bootstrap-cell integer? ] unit-test
-
-[ [ 3 ] ] [ 3 f curry ] unit-test
-[ [ \ + ] ] [ \ + f curry ] unit-test
-[ [ \ + = ] ] [ \ + [ = ] curry ] unit-test
-
-! Make sure we report the correct error on stack underflow
-[ { kernel-error 12 f f } ]
-[ [ clear drop ] catch ] unit-test
-
-[ -7 <byte-array> ] unit-test-fails
diff --git a/core/test/math/bitops.factor b/core/test/math/bitops.factor
deleted file mode 100644 (file)
index 332c208..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: test
-USE: sequences
-
-[ -2 ] [ 1 bitnot ] unit-test
-[ -2 ] [ 1 >bignum bitnot ] unit-test
-[ -2 ] [ 1 >bignum bitnot ] unit-test
-[ 0 ] [ 123 dup bitnot bitand ] unit-test
-[ 0 ] [ 123 >bignum dup bitnot bitand ] unit-test
-[ 0 ] [ 123 dup bitnot >bignum bitand ] unit-test
-[ 0 ] [ 123 dup bitnot bitand >bignum ] unit-test
-[ -1 ] [ 123 dup bitnot bitor ] unit-test
-[ -1 ] [ 123 >bignum dup bitnot bitor ] unit-test
-[ -1 ] [ 123 dup bitnot >bignum bitor ] unit-test
-[ -1 ] [ 123 dup bitnot bitor >bignum ] unit-test
-[ -1 ] [ 123 dup bitnot bitxor ] unit-test
-[ -1 ] [ 123 >bignum dup bitnot bitxor ] unit-test
-[ -1 ] [ 123 dup bitnot >bignum bitxor ] unit-test
-[ -1 ] [ 123 dup bitnot bitxor >bignum ] unit-test
-[ 4 ] [ 4 7 bitand ] unit-test
-
-[ 256 ] [ 65536 -8 shift ] unit-test
-[ 256 ] [ 65536 >bignum -8 shift ] unit-test
-[ 256 ] [ 65536 -8 >bignum shift ] unit-test
-[ 256 ] [ 65536 >bignum -8 >bignum shift ] unit-test
-[ 4294967296 ] [ 1 16 shift 16 shift ] unit-test
-[ 4294967296 ] [ 1 32 shift ] unit-test
-[ 1267650600228229401496703205376 ] [ 1 100 shift ] unit-test
-
-[ t ] [ 1 27 shift fixnum? ] unit-test
-
-[ t ] [
-    t
-    [ 27 28 29 30 31 32 59 60 61 62 63 64 ]
-    [
-        1 over shift swap 1 >bignum swap shift = and
-    ] each
-] unit-test
-
-[ t ] [
-    t
-    [ 27 28 29 30 31 32 59 60 61 62 63 64 ]
-    [
-        -1 over shift swap -1 >bignum swap shift = and
-    ] each
-] unit-test
-
-[ 12 ] [ 11 4 align ] unit-test
-[ 12 ] [ 12 4 align ] unit-test
-[ 10 ] [ 10 2 align ] unit-test
-[ 14 ] [ 13 2 align ] unit-test
-[ 11 ] [ 11 1 align ] unit-test
diff --git a/core/test/math/complex.factor b/core/test/math/complex.factor
deleted file mode 100644 (file)
index bf63108..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: test
-
-[ 1 C{ 0 1 } rect> ] unit-test-fails
-[ C{ 0 1 } 1 rect> ] unit-test-fails
-
-[ f ] [ C{ 5 12.5 } 5  = ] unit-test
-[ t ] [ C{ 1.0 2.0 } C{ 1 2 }  = ] unit-test
-[ f ] [ C{ 1.0 2.3 } C{ 1 2 }  = ] unit-test
-
-[ C{ 2 5 } ] [ 2 5  rect> ] unit-test
-[ 2 5 ] [ C{ 2 5 }  >rect ] unit-test
-[ C{ 1/2 1 } ] [ 1/2 i  + ] unit-test
-[ C{ 1/2 1 } ] [ i 1/2  + ] unit-test
-[ t ] [ C{ 11 64 } C{ 11 64 }  = ] unit-test
-[ C{ 2 1 } ] [ 2 i  + ] unit-test
-[ C{ 2 1 } ] [ i 2  + ] unit-test
-[ C{ 5 4 } ] [ C{ 2 2 } C{ 3 2 }  + ] unit-test
-[ 5 ] [ C{ 2 2 } C{ 3 -2 }  + ] unit-test
-[ C{ 1.0 1 } ] [ 1.0 i  + ] unit-test
-
-[ C{ 1/2 -1 } ] [ 1/2 i  - ] unit-test
-[ C{ -1/2 1 } ] [ i 1/2  - ] unit-test
-[ C{ 1/3 1/4 } ] [ 1 3 / 1 2 / i * + 1 4 / i *  - ] unit-test
-[ C{ -1/3 -1/4 } ] [ 1 4 / i * 1 3 / 1 2 / i * +  - ] unit-test
-[ C{ 1/5 1/4 } ] [ C{ 3/5 1/2 } C{ 2/5 1/4 }  - ] unit-test
-[ 4 ] [ C{ 5 10/3 } C{ 1 10/3 }  - ] unit-test
-[ C{ 1.0 -1 } ] [ 1.0 i  - ] unit-test
-
-[ C{ 0 1 } ] [ i 1  * ] unit-test
-[ C{ 0 1 } ] [ 1 i  * ] unit-test
-[ C{ 0 1.0 } ] [ 1.0 i  * ] unit-test
-[ -1 ] [ i i  * ] unit-test
-[ C{ 0 1 } ] [ 1 i  * ] unit-test
-[ C{ 0 1 } ] [ i 1  * ] unit-test
-[ C{ 0 1/2 } ] [ 1/2 i  * ] unit-test
-[ C{ 0 1/2 } ] [ i 1/2  * ] unit-test
-[ 2 ] [ C{ 1 1 } C{ 1 -1 }  * ] unit-test
-[ 1 ] [ i -i  * ] unit-test
-
-[ -1 ] [ i -i  / ] unit-test
-[ C{ 0 1 } ] [ 1 -i  / ] unit-test
-[ t ] [ C{ 12 13 } C{ 13 14 } / C{ 13 14 } * C{ 12 13 }  = ] unit-test
-
-[ C{ -3 4 } ] [ C{ 3 -4 }  neg ] unit-test
-
-[ 5 ] [ C{ 3 4 } abs ] unit-test
-[ 5 ] [ -5.0 abs ] unit-test
-
-! Make sure arguments are sane
-[ 0 ] [ 0 arg ] unit-test
-[ 0 ] [ 1 arg ] unit-test
-[ t ] [ -1 arg 3.14 3.15 between? ] unit-test
-[ t ] [ i arg 1.57 1.58 between? ] unit-test
-[ t ] [ -i arg -1.58 -1.57 between? ] unit-test
-
-[ 1 0 ] [ 1 >polar ] unit-test
-[ 1 ] [ -1 >polar drop ] unit-test
-[ t ] [ -1 >polar nip 3.14 3.15 between? ] unit-test
-
-! I broke something
-[ ] [ C{ 1 4 } tanh drop ] unit-test
-[ ] [ C{ 1 4 } tan drop ] unit-test
-[ ] [ C{ 1 4 } coth drop ] unit-test
-[ ] [ C{ 1 4 } cot drop ] unit-test
diff --git a/core/test/math/float.factor b/core/test/math/float.factor
deleted file mode 100644 (file)
index 40f6548..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: test
-
-[ t ] [ 0.0 float? ] unit-test
-[ t ] [ 3.1415 number? ] unit-test
-[ f ] [ 12 float? ] unit-test
-
-[ t ] [ 1 1.0 = ] unit-test
-[ t ] [ 1 >bignum 1.0 = ] unit-test
-[ t ] [ 1.0 1 = ] unit-test
-[ t ] [ 1.0 1 >bignum = ] unit-test
-
-[ f ] [ 1 1.3 = ] unit-test
-[ f ] [ 1 >bignum 1.3 = ] unit-test
-[ f ] [ 1.3 1 = ] unit-test
-[ f ] [ 1.3 1 >bignum = ] unit-test
-
-[ t ] [ 134.3 >fixnum 134 = ] unit-test
-
-[ 3 ] [ 3.5 >bignum ] unit-test
-[ -3 ] [ -3.5 >bignum ] unit-test
-
-[ 3 ] [ 3.5 >fixnum ] unit-test
-[ -3 ] [ -3.5 >fixnum ] unit-test
-
-[ 2.1 ] [ -2.1 neg ] unit-test
-
-[ 1 ] [ 0.5 1/2 + ] unit-test
-[ 1 ] [ 1/2 0.5 + ] unit-test
-
-[ 3 ] [ 3.1415 >fixnum ] unit-test
-[ 3 ] [ 3.1415 >bignum ] unit-test
-
-[ t ] [ pi 3 > ] unit-test
-[ f ] [ e 2 <= ] unit-test
-
-[ t ] [ 1.0 dup float>bits bits>float = ] unit-test
-[ t ] [ pi double>bits bits>double pi = ] unit-test
-[ t ] [ e double>bits bits>double e = ] unit-test
-
-[ 2.0 ] [ 1.0 1+ ] unit-test
-[ 0.0 ] [ 1.0 1- ] unit-test
-
-[ 4.0 ] [ 4.5 truncate ] unit-test
-[ 4.0 ] [ 4.5 floor ] unit-test
-[ 5.0 ] [ 4.5 ceiling ] unit-test
-
-[ -4.0 ] [ -4.5 truncate ] unit-test
-[ -5.0 ] [ -4.5 floor ] unit-test
-[ -4.0 ] [ -4.5 ceiling ] unit-test
-
-[ -4.0 ] [ -4.0 truncate ] unit-test
-[ -4.0 ] [ -4.0 floor ] unit-test
-[ -4.0 ] [ -4.0 ceiling ] unit-test
-
-! [ t ] [ -0.0 -0.0 = ] unit-test
-! [ f ] [ 0.0 -0.0 = ] unit-test
-
-[ t ] [ 0.0 zero? ] unit-test
-[ t ] [ -0.0 zero? ] unit-test
-
-! [ t ] [ 0.0/0.0 0.0/0.0 = ] unit-test
-
-[ 0 ] [ 1/0. >bignum ] unit-test
diff --git a/core/test/math/integer.factor b/core/test/math/integer.factor
deleted file mode 100644 (file)
index e8c4224..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-IN: temporary
-USING: kernel math namespaces prettyprint test math-internals
-errors ;
-
-[ "-8" ] [ -8 unparse ] unit-test
-
-[ t ] [ 0 fixnum? ] unit-test
-[ t ] [ 31415 number? ] unit-test
-[ t ] [ 31415 >bignum number? ] unit-test
-[ t ] [ 2345621 fixnum? ] unit-test
-
-[ t ] [ 2345621 dup >bignum >fixnum = ] unit-test
-
-[ t ] [ 0 >fixnum 0 >bignum = ] unit-test
-[ f ] [ 0 >fixnum 1 >bignum = ] unit-test
-[ f ] [ 1 >bignum 0 >bignum = ] unit-test
-[ t ] [ 0 >bignum 0 >fixnum = ] unit-test
-
-[ t ] [ 0 >bignum bignum? ] unit-test
-[ f ] [ 0 >fixnum bignum? ] unit-test
-[ f ] [ 0 >fixnum bignum? ] unit-test
-[ t ] [ 0 >fixnum fixnum? ] unit-test
-
-[ -1 ] [ 1 neg ] unit-test
-[ -1 ] [ 1 >bignum neg ] unit-test
-[ 268435456 ] [ -268435456 >fixnum -1 * ] unit-test
-[ 268435456 ] [ -268435456 >fixnum neg ] unit-test
-
-[ 9 3 ] [ 93 10 /mod ] unit-test
-[ 9 3 ] [ 93 >bignum 10 /mod ] unit-test
-
-[ 5 ] [ 2 >bignum 3 >bignum + ] unit-test
-
-[ 100 ] [ 100 100 gcd nip ] unit-test
-[ 100 ] [ 1000 100 gcd nip ] unit-test
-[ 100 ] [ 100 1000 gcd nip ] unit-test
-[ 4 ] [ 132 64 gcd nip ] unit-test
-[ 4 ] [ -132 64 gcd nip ] unit-test
-[ 4 ] [ -132 -64 gcd nip ] unit-test
-[ 4 ] [ 132 -64 gcd nip ] unit-test
-[ 4 ] [ -132 -64 gcd nip ] unit-test
-
-[ 100 ] [ 100 >bignum 100 >bignum gcd nip ] unit-test
-[ 100 ] [ 1000 >bignum 100 >bignum gcd nip ] unit-test
-[ 100 ] [ 100 >bignum 1000 >bignum gcd nip ] unit-test
-[ 4 ] [ 132 >bignum 64 >bignum gcd nip ] unit-test
-[ 4 ] [ -132 >bignum 64 >bignum gcd nip ] unit-test
-[ 4 ] [ -132 >bignum -64 >bignum gcd nip ] unit-test
-[ 4 ] [ 132 >bignum -64 >bignum gcd nip ] unit-test
-[ 4 ] [ -132 >bignum -64 >bignum gcd nip ] unit-test
-
-[ 6 ] [
-    1326264299060955293181542400000006
-    1591517158873146351817850880000000
-    gcd nip
-] unit-test
-
-: verify-gcd
-    2dup swap gcd
-    >r rot * swap rem r> = ; 
-
-[ t ] [ 123 124 verify-gcd ] unit-test
-[ t ] [ 50 120 verify-gcd ] unit-test
-
-[ -1 ] [ -1 >bignum >fixnum ] unit-test
-
-[ "8589934592" ]
-[ 134217728 dup + dup + dup + dup + dup + dup + unparse ]
-unit-test
-
-[ t ] [ 0 0 ^ fp-nan? ] unit-test
-[ 1 ] [ 10 0 ^ ] unit-test
-[ 1/8 ] [ 1/2 3 ^ ] unit-test
-[ 1/8 ] [ 2 -3 ^ ] unit-test
-[ t ] [ 1 100 shift 2 100 ^ = ] unit-test
-
-[ t ] [ 256 power-of-2? ] unit-test
-[ f ] [ 123 power-of-2? ] unit-test
-[ 8 ] [ 256 log2 ] unit-test
-[ 0 ] [ 1 log2 ] unit-test
-
-[ 1 ] [ 7/8 ceiling ] unit-test
-[ 2 ] [ 3/2 ceiling ] unit-test
-[ 0 ] [ -7/8 ceiling ] unit-test
-[ -1 ] [ -3/2 ceiling ] unit-test
-
-[ 2 ] [ 0 next-power-of-2 ] unit-test
-[ 2 ] [ 1 next-power-of-2 ] unit-test
-[ 2 ] [ 2 next-power-of-2 ] unit-test
-[ 4 ] [ 3 next-power-of-2 ] unit-test
-[ 16 ] [ 13 next-power-of-2 ] unit-test
-[ 16 ] [ 16 next-power-of-2 ] unit-test
-
-[ 268435456 ] [ -268435456 >fixnum -1 / ] unit-test
-[ 268435456 ] [ -268435456 >fixnum -1 /i ] unit-test
-[ 268435456 0 ] [ -268435456 >fixnum -1 /mod ] unit-test
-[ 1/268435456 ] [ -1 -268435456 >fixnum / ] unit-test
-[ 0 ] [ -1 -268435456 >fixnum /i ] unit-test
-[ 0 -1 ] [ -1 -268435456 >fixnum /mod ] unit-test
-[ 14355 ] [ 1591517158873146351817850880000000 32769 mod ] unit-test
-
-[ -351382792 ] [ -43922849 3 shift ] unit-test
-
-[ t ] [ 0 zero? ] unit-test
-[ f ] [ 30 zero? ] unit-test
-[ t ] [ 0 >bignum zero? ] unit-test
-
-[ 4294967280 ] [ 268435455 >fixnum 16 fixnum* ] unit-test
-
-[ 23603949310011464311086123800853779733506160743636399259558684142844552151041 ]
-[
-    1957739506503920732625800353008742584087090810400921800808997218266517557963281171906190947801528098188887586755474449585677502695226712388326288208691204
-    79562815144503850065234921197651376510595262628033069372760833939060637564931
-    bignum-mod
-] unit-test
-
-! We don't care if this fails or returns 0 (its CPU-specific)
-! as long as it doesn't crash
-[ ] [ [ 0 0 /i ] catch clear ] unit-test
-[ ] [ [ 100000000000000000 0 /i ] catch clear ] unit-test
diff --git a/core/test/math/irrational.factor b/core/test/math/irrational.factor
deleted file mode 100644 (file)
index f62ffb6..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: math-internals
-USE: test
-
-! Lets get the argument order correct, eh?
-[ 0.0 ] [ 0.0 1.0 fatan2 ] unit-test
-[ 0.25 ] [ 2.0 -2.0 fpow ] unit-test
-
-[ 4.0 ] [ 16 sqrt ] unit-test
-[ C{ 0 4.0 } ] [ -16 sqrt ] unit-test
-
-[ 4.0 ] [ 2 2 ^ ] unit-test
-[ 0.25 ] [ 2 -2 ^ ] unit-test
-[ t ] [ 2 0.5 ^ 2 ^ 2 2.00001 between? ] unit-test
-[ t ] [ e pi i * ^ real -1.0 = ] unit-test
-[ t ] [ e pi i * ^ imaginary -0.00001 0.00001 between? ] unit-test
-
-[ t ] [ 0 0 ^ fp-nan? ] unit-test
-[ 1.0/0.0 ] [ 0 -2 ^ ] unit-test
-[ t ] [ 0 0.0 ^ fp-nan? ] unit-test
-[ 1.0/0.0 ] [ 0 -2.0 ^ ] unit-test
-[ 0 ] [ 0 3.0 ^ ] unit-test
-[ 0 ] [ 0 3 ^ ] unit-test
-
-[ 1.0 ] [ 0 cosh ] unit-test
-[ 0.0 ] [ 1 acosh ] unit-test
-            
-[ 1.0 ] [ 0 cos ] unit-test
-[ 0.0 ] [ 1 acos ] unit-test
-            
-[ 0.0 ] [ 0 sinh ] unit-test
-[ 0.0 ] [ 0 asinh ] unit-test
-            
-[ 0.0 ] [ 0 sin ] unit-test
-[ 0.0 ] [ 0 asin ] unit-test
diff --git a/core/test/math/math-combinators.factor b/core/test/math/math-combinators.factor
deleted file mode 100644 (file)
index 0e226eb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: test
-USE: namespaces
-
-[ ] [ 5 [ ] times ] unit-test
-[ ] [ 0 [ ] times ] unit-test
-[ ] [ -1 [ ] times ] unit-test
-
-[ ] [ 5 [ ] repeat ] unit-test
-[ [ 0 1 2 3 4 ] ] [ [ 5 [ dup , ] repeat ] [ ] make ] unit-test
-[ [ ] ] [ [ -1 [ dup , ] repeat ] [ ] make ] unit-test
diff --git a/core/test/math/random.factor b/core/test/math/random.factor
deleted file mode 100644 (file)
index 3f0f38b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-IN: temporary
-USING: kernel math sequences test ;
-
-[ t ] [ 100 [ drop 20 random-int 0 20 between? ] all? ] unit-test
diff --git a/core/test/math/rational.factor b/core/test/math/rational.factor
deleted file mode 100644 (file)
index 2586982..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-IN: temporary
-USE: kernel
-USE: math
-USE: test
-
-[ 1 2 ] [ 1/2 >fraction ] unit-test
-
-[ 1/2 ] [ 1 >bignum 2 >bignum / ] unit-test
-[ t ] [ 10 3 / ratio? ] unit-test
-[ f ] [ 10 2 / ratio? ] unit-test
-[ 10 ] [ 10 numerator ] unit-test
-[ 1 ] [ 10 denominator ] unit-test
-[ 12 ] [ -12 -13 / numerator ] unit-test
-[ 13 ] [ -12 -13 / denominator ] unit-test
-[ 1 ] [ -1 -1 / numerator ] unit-test
-[ 1 ] [ -1 -1 / denominator ] unit-test
-
-[ -1 ] [ 2 -2 / ] unit-test
-[ -1 ] [ -2 2 / ] unit-test
-
-[ t ] [ 1 3 / 1 3 / = ] unit-test
-
-[ -10 ] [ -100 10 /i ] unit-test
-[ 10 ] [ -100 -10 /i ] unit-test
-[ -10 ] [ 100 -10 /i ] unit-test
-[ -10 ] [ -100 >bignum 10 >bignum /i ] unit-test
-[ 10  ] [ -100 >bignum -10 >bignum /i ] unit-test
-[ -10 ] [ 100 >bignum -10 >bignum /i ] unit-test
-
-[ 3/2 ] [ 1 1/2 + ] unit-test
-[ 3/2 ] [ 1 >bignum 1/2 + ] unit-test
-[ -1/2 ] [ 1/2 1 - ] unit-test
-[ -1/2 ] [ 1/2 1 >bignum - ] unit-test
-[ 41/20 ] [ 5/4 4/5 + ] unit-test
-
-[ 1 ] [ 1/2 2 * ] unit-test
-[ 1/3 ] [ 1/2 2/3 * ] unit-test
-
-[ 1 ] [ 1/2 1/2 / ] unit-test
-[ 27/4 ] [ 3/2 2/9 / ] unit-test
-
-[ t ] [ 5768 476343 < ] unit-test
-[ t ] [ 5768 476343 <= ] unit-test
-[ f ] [ 5768 476343 > ] unit-test
-[ f ] [ 5768 476343 >= ] unit-test
-[ t ] [ 3434 >bignum 3434 >= ] unit-test
-[ t ] [ 3434 3434 >bignum <= ] unit-test
-
-[ t ] [ 1 1/3 > ] unit-test
-[ t ] [ 2/3 3/4 <= ] unit-test
-[ f ] [ -2/3 1/3 > ] unit-test
-
-[ t ] [ 1000000000/999999 1000 > ] unit-test
-[ f ] [ 100000 100000000000/999999 > ] unit-test
-[ t ]
-[ 1000000000000/999999999999 1000000000001/999999999998 < ]
-unit-test
-
-[ -3 ] [ -3 10 mod ] unit-test
-[ 7 ] [ -3 10 rem ] unit-test
-[ 7 ] [ -13 10 rem ] unit-test
-[ 0 ] [ 37 37 rem ] unit-test
-
-[ -1 ] [ -12.55 sgn ] unit-test
-[ 1 ] [ 100000000000000000000000000000000 sgn ] unit-test
-[ 0 ] [ 0.0 sgn ] unit-test
-
-[ 1/2 ] [ 1/2 1 mod ] unit-test
-[ 1/3 ] [ 10/3 3 mod ] unit-test
-[ -1/3 ] [ -10/3 3 mod ] unit-test
-
-[ 5 ] [ 5 floor ] unit-test
-[ -5 ] [ -5 floor ] unit-test
-[ 6 ] [ 6 truncate ] unit-test
-[ 3 ] [ 10/3 floor ] unit-test
-[ -4 ] [ -10/3 floor ] unit-test
-[ 4 ] [ 10/3 ceiling ] unit-test
-[ -3 ] [ -10/3 ceiling ] unit-test
-[ 3 ] [ 10/3 truncate ] unit-test
-[ -3 ] [ -10/3 truncate ] unit-test
-
-[ -1/2 ] [ 1/2 1- ] unit-test
-[ 3/2 ] [ 1/2 1+ ] unit-test
diff --git a/core/test/parse-number.factor b/core/test/parse-number.factor
deleted file mode 100644 (file)
index 88ae42b..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-IN: temporary
-USING: errors kernel math parser sequences test ;
-
-[ f ]
-[ f string>number ]
-unit-test
-
-[ f ]
-[ "12345abcdef" string>number ]
-unit-test
-
-[ t ]
-[ "-12" string>number 0 < ]
-unit-test
-
-[ f ]
-[ "--12" string>number ]
-unit-test
-
-[ f ]
-[ "-" string>number ]
-unit-test
-
-[ f ]
-[ "e" string>number ]
-unit-test
-
-[ "100.0" ]
-[ "1.0e2" string>number number>string ]
-unit-test
-
-[ "-100.0" ]
-[ "-1.0e2" string>number number>string ]
-unit-test
-
-[ "0.01" ]
-[ "1.0e-2" string>number number>string ]
-unit-test
-
-[ "-0.01" ]
-[ "-1.0e-2" string>number number>string ]
-unit-test
-
-[ f ]
-[ "-1e-2e4" string>number ]
-unit-test
-
-[ "3.14" ]
-[ "3.14" string>number number>string ]
-unit-test
-
-[ f ]
-[ "." string>number ]
-unit-test
-
-[ f ]
-[ ".e" string>number ]
-unit-test
-
-[ "101.0" ]
-[ "1.01e2" string>number number>string ]
-unit-test
-
-[ "-101.0" ]
-[ "-1.01e2" string>number number>string ]
-unit-test
-
-[ "1.01" ]
-[ "101.0e-2" string>number number>string ]
-unit-test
-
-[ "-1.01" ]
-[ "-101.0e-2" string>number number>string ]
-unit-test
-
-[ 5 ]
-[ "10/2" string>number ]
-unit-test
-
-[ -5 ]
-[ "-10/2" string>number ]
-unit-test
-
-[ -5 ]
-[ "10/-2" string>number ]
-unit-test
-
-[ 5 ]
-[ "-10/-2" string>number ]
-unit-test
-
-[ 5.0 ]
-[ "10.0/2" string>number ]
-unit-test
-
-[ f ]
-[ "1e1/2" string>number ]
-unit-test
-
-[ f ]
-[ "e/2" string>number ]
-unit-test
-
-[ "33/100" ]
-[ "66/200" string>number number>string ]
-unit-test
-
-[ f ] [ "12" bin> ] unit-test
-[ f ] [ "fdsf" bin> ] unit-test
-[ 3 ] [ "11" bin> ] unit-test
-
-[ f ] [ "\0." string>number ] unit-test
-
-! [ t ] [
-!     { "1.0/0.0" "-1.0/0.0" "0.0/0.0" }
-!     [ dup string>number number>string = ] all?
-! ] unit-test
-! 
-! [ t ] [
-!     { 1.0/0.0 -1.0/0.0 0.0/0.0 }
-!     [ dup number>string string>number = ] all?
-! ] unit-test
-
-[ 1 1 >base ] unit-test-fails
-[ 1 0 >base ] unit-test-fails
-[ 1 -1 >base ] unit-test-fails
diff --git a/core/test/parser.factor b/core/test/parser.factor
deleted file mode 100644 (file)
index 2f96bae..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-USING: arrays errors math parser test kernel generic words io
-listener namespaces ;
-IN: temporary
-
-[ 1 CHAR: a ]
-[ 0 "abcd" next-char ] unit-test
-
-[ 6 CHAR: \s ]
-[ 1 "\\u0020hello" next-escape ] unit-test
-
-[ 2 CHAR: \n ]
-[ 1 "\\nhello" next-escape ] unit-test
-
-[ 6 CHAR: \s ]
-[ 0 "\\u0020hello" next-char ] unit-test
-
-[ [ 1 [ 2 [ 3 ] 4 ] 5 ] ]
-[ "1\n[\n2\n[\n3\n]\n4\n]\n5" parse ]
-unit-test
-
-[ [ t t f f ] ]
-[ "t t f f" parse ]
-unit-test
-
-[ [ "hello world" ] ]
-[ "\"hello world\"" parse ]
-unit-test
-
-[ [ "\n\r\t\\" ] ]
-[ "\"\\n\\r\\t\\\\\"" parse ]
-unit-test
-
-[ "hello world" ]
-[
-    "IN: temporary : hello \"hello world\" ;"
-    parse call "USE: scratchpad hello" eval
-] unit-test
-
-[ ]
-[ "! This is a comment, people." parse call ]
-unit-test
-
-! Test escapes
-
-[ [ " " ] ]
-[ "\"\\u0020\"" parse ]
-unit-test
-
-[ [ "'" ] ]
-[ "\"\\u0027\"" parse ]
-unit-test
-
-[ "\\u123" parse ] unit-test-fails
-
-! Test EOL comments in multiline strings.
-[ [ "Hello" ] ] [ "#! This calls until-eol.\n\"Hello\"" parse ] unit-test 
-
-[ word ] [ \ f class ] unit-test
-
-! Test stack effect parsing
-
-: foo ( a b -- c ) + ;
-
-[ T{ effect f { "a" "b" } { "c" } f } ]
-[ \ foo "declared-effect" word-prop ] unit-test
-
-[ t ] [ 1 1 <effect> 2 2 <effect> effect<= ] unit-test
-[ f ] [ 1 0 <effect> 2 2 <effect> effect<= ] unit-test
-[ t ] [ 2 2 <effect> 2 2 <effect> effect<= ] unit-test
-[ f ] [ 3 3 <effect> 2 2 <effect> effect<= ] unit-test
-[ f ] [ 2 3 <effect> 2 2 <effect> effect<= ] unit-test
-
-: baz ( a b -- * ) 2array throw ;
-
-[ t ]
-[ \ baz "declared-effect" word-prop effect-terminated? ]
-unit-test
-
-[ [ ] ] [ "IN: temporary : foo ( a b -- c ) + ;" parse ] unit-test
-[ [ ] ] [ "IN: temporary : foo ;" parse ] unit-test
-[ f ] [ \ foo "declared-effect" word-prop ] unit-test
-
-! Funny bug
-[ 2 ] [ "IN: temporary : \0. 2 ; \0." eval ] unit-test
-
-[ "IN: temporary : missing-- ( a b ) ;" eval ] unit-test-fails
-
-! Test interactive parsing, restarts
-[
-    file-vocabs
-    "errors" use+
-
-    [ [ + 1 2 3 4 ] ]
-    [
-        [
-            "cont" set
-            [
-                "\ + 1 2 3 4" 
-                <string-reader>
-                parse-interactive "cont" get continue-with
-            ] catch
-            "0 :res" eval
-        ] callcc1
-    ] unit-test
-] with-scope
diff --git a/core/test/parsing-word.factor b/core/test/parsing-word.factor
deleted file mode 100644 (file)
index 20f254b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-USING: kernel parser sequences test words ;
-IN: temporary
-
-DEFER: foo
-
-"IN: temporary : foo 2 2 + . ; parsing" eval
-
-[ [ ] ] [ "USE: temporary foo" parse ] unit-test
-
-"IN: temporary : foo 2 2 + . ;" eval
-
-[ [ POSTPONE: foo ] ] [ "USE: temporary foo" parse ] unit-test
diff --git a/core/test/prettyprint.factor b/core/test/prettyprint.factor
deleted file mode 100644 (file)
index e585ed7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-USING: alien definitions inference io kernel math namespaces
-parser prettyprint sequences test vectors words ;
-IN: temporary
-
-[ "4" ] [ 4 unparse ] unit-test
-[ "1.0" ] [ 1.0 unparse ] unit-test
-[ "C{ 1/2 2/3 }" ] [ C{ 1/2 2/3 } unparse ] unit-test
-[ "1267650600228229401496703205376" ] [ 1 100 shift unparse ] unit-test
-
-[ "+" ] [ \ + unparse ] unit-test
-
-[ "\\ +" ] [ [ \ + ] first unparse ] unit-test
-
-[ "{ }" ] [ { } unparse ] unit-test
-
-[ "{ 1 2 3 }" ] [ { 1 2 3 } unparse ] unit-test
-
-[ "\"hello\\\\backslash\"" ]
-[ "hello\\backslash" unparse ]
-unit-test
-
-[ "\"\\u1234\"" ]
-[ "\u1234" unparse ]
-unit-test
-
-[ "\"\\e\"" ]
-[ "\e" unparse ]
-unit-test
-
-[ "f" ] [ f unparse ] unit-test
-[ "t" ] [ t unparse ] unit-test
-
-[ "SBUF\" hello world\"" ] [ SBUF" hello world" unparse ] unit-test
-
-
-[ "( a b -- c d )" ] [
-    { "a" "b" } { "c" "d" } <effect> effect>string
-] unit-test
-
-[ "( -- c d )" ] [
-    { } { "c" "d" } <effect> effect>string
-] unit-test
-
-[ "( a b -- )" ] [
-    { "a" "b" } { } <effect> effect>string
-] unit-test
-
-[ "( -- )" ] [
-    { } { } <effect> effect>string
-] unit-test
-
-[ "ALIEN: 1234" ] [ 1234 <alien> unparse ] unit-test
-
-[ "W{ \\ + }" ] [ [ W{ \ + } ] first unparse ] unit-test
-
-[ "[ 1 2 DUP ]" ]
-[
-    [ 1 2 dup ] dup hilite-quotation set 2 hilite-index set
-    [ pprint ] string-out
-] unit-test
-
-: foo ( a -- b ) dup * ; inline
-
-[ "IN: temporary : foo ( a -- b ) dup * ; inline\n" ]
-[ [ \ foo see ] string-out ] unit-test
-
-: bar ( x -- y ) 2 + ;
-
-[ "IN: temporary : bar ( x -- y ) 2 + ;\n" ]
-[ [ \ bar see ] string-out ] unit-test
-
-[ ] [ \ fixnum see ] unit-test
-
-[ ] [ \ integer see ] unit-test
-
-[ ] [ \ general-t see ] unit-test
-
-[ ] [ \ compound see ] unit-test
-
-[ ] [ \ duplex-stream see ] unit-test
-
-[ "[ \\ + ]" ] [ [ \ + ] unparse ] unit-test
-[ "[ \\ [ ]" ] [ [ \ [ ] unparse ] unit-test
diff --git a/core/test/random.factor b/core/test/random.factor
deleted file mode 100644 (file)
index 67fb031..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-IN: temporary
-USING: errors kernel math namespaces sequences test ;
-
-: check-random-int ( max -- ? )
-    dup >r random-int 0 r> between? ;
-
-[ t ] [ 100 [ drop 674 check-random-int ] all? ] unit-test
-
-: make-100-random-ints
-    [ 100 [ 100 random-int , ] times ] { } make ;
-
-[ f ] [ make-100-random-ints make-100-random-ints = ] unit-test
diff --git a/core/test/redefine.factor b/core/test/redefine.factor
deleted file mode 100644 (file)
index 225dd81..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-USING: compiler definitions generic hashtables inference math
-namespaces parser test words kernel sequences arrays ;
-IN: temporary
-
-DEFER: foo \ foo reset-generic
-DEFER: bar \ bar reset-generic
-
-: short-effect
-    dup effect-in length swap effect-out length 2array nip ;
-
-[   ] [ \ foo [ 1 2 ] define-compound     ] unit-test
-[ { 0 2 } ] [ [ foo ] infer short-effect ] unit-test
-[   ] [ \ foo compile                     ] unit-test
-[   ] [ \ bar [ foo foo ] define-compound ] unit-test
-[   ] [ \ bar compile                     ] unit-test
-[   ] [ \ foo [ 1 2 3 ] define-compound   ] unit-test
-[ t ] [ \ bar changed-words get hash-member?  ] unit-test
-[   ] [ recompile ] unit-test
-[ { 0 3 } ] [ [ foo ] infer short-effect ] unit-test
-[ f ] [ \ bar changed-words get hash-member?  ] unit-test
-[   ] [ \ bar [ 1 2 ] define-compound     ] unit-test
-[ t ] [ \ bar changed-words get hash-member?  ] unit-test
-[   ] [ recompile ] unit-test
-[ { 0 2 } ] [ [ bar ] infer short-effect ] unit-test
-[ f ] [ \ bar changed-words get hash-member?  ] unit-test
-[   ] [ \ foo [ 1 2 3 ] define-compound   ] unit-test
-[ f ] [ \ bar changed-words get hash-member?  ] unit-test
-[   ] [ \ bar [ 1 2 3 ] define-compound   ] unit-test
-[ t ] [ \ bar changed-words get hash-member?  ] unit-test
-[   ] [ \ bar forget ] unit-test
-[ f ] [ \ bar changed-words get hash-member?  ] unit-test
diff --git a/core/test/threads.factor b/core/test/threads.factor
deleted file mode 100644 (file)
index f3c60b2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-IN: temporary
-
-USE: namespaces
-USE: io
-USE: test
-USE: threads
-USE: errors
-
-! This only tests co-operative threads in CFactor.
-! It won't give intended results in Java (or in CFactor if
-! we ever get preemptive threads).
-
-3 "x" set
-[ yield 2 "x" set ] in-thread
-[ 2 ] [ yield "x" get ] unit-test
-[ ] [ [ flush ] in-thread flush ] unit-test
-[ ] [ [ "Errors, errors" throw ] in-thread ] unit-test
-yield
-
-[ ] [ 1/2 sleep ] unit-test
-[ ] [ 0.3 sleep ] unit-test
-[ "hey" sleep ] unit-test-fails
diff --git a/core/test/tuple.factor b/core/test/tuple.factor
deleted file mode 100644 (file)
index bf6b243..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-USING: errors definitions generic kernel kernel-internals math
-parser sequences test words hashtables namespaces ;
-IN: temporary
-
-[ t ] [ \ tuple-class \ class class< ] unit-test
-[ f ] [ \ class \ tuple-class class< ] unit-test
-
-TUPLE: rect x y w h ;
-C: rect
-    [ set-rect-h ] keep
-    [ set-rect-w ] keep
-    [ set-rect-y ] keep
-    [ set-rect-x ] keep ;
-    
-: move ( x rect -- )
-    [ rect-x + ] keep set-rect-x ;
-
-[ f ] [ 10 20 30 40 <rect> dup clone 5 swap [ move ] keep = ] unit-test
-
-[ t ] [ 10 20 30 40 <rect> dup clone 0 swap [ move ] keep = ] unit-test
-
-GENERIC: delegation-test
-M: object delegation-test drop 3 ;
-TUPLE: quux-tuple ;
-C: quux-tuple ;
-M: quux-tuple delegation-test drop 4 ;
-TUPLE: quuux-tuple ;
-C: quuux-tuple
-    [ set-delegate ] keep ;
-
-[ 3 ] [ <quux-tuple> <quuux-tuple> delegation-test ] unit-test
-
-GENERIC: delegation-test-2
-TUPLE: quux-tuple-2 ;
-C: quux-tuple-2 ;
-M: quux-tuple-2 delegation-test-2 drop 4 ;
-TUPLE: quuux-tuple-2 ;
-C: quuux-tuple-2
-    [ set-delegate ] keep ;
-
-[ 4 ] [ <quux-tuple-2> <quuux-tuple-2> delegation-test-2 ] unit-test
-
-! Make sure we handle changing shapes!
-
-[
-    FORGET: point
-    FORGET: point?
-    FORGET: point-x
-    TUPLE: point x y ;
-    C: point [ set-point-y ] keep [ set-point-x ] keep ;
-    
-    100 200 <point>
-    
-    ! Use eval to sequence parsing explicitly
-    "IN: temporary TUPLE: point x y z ;" eval
-    
-    point-x
-] unit-test-fails
-
-TUPLE: predicate-test ;
-: predicate-test drop f ;
-
-[ t ] [ <predicate-test> predicate-test? ] unit-test
-
-PREDICATE: tuple silly-pred
-    class \ rect = ;
-
-GENERIC: area
-M: silly-pred area dup rect-w swap rect-h * ;
-
-TUPLE: circle radius ;
-M: circle area circle-radius sq pi * ;
-
-[ 200 ] [ T{ rect f 0 0 10 20 } area ] unit-test
-
-[ ] [ "IN: temporary  SYMBOL: #x  TUPLE: #x ;" eval ] unit-test
-
-! Hashcode breakage
-TUPLE: empty ;
-[ t ] [ <empty> hashcode fixnum? ] unit-test
-
-TUPLE: delegate-clone ;
-
-[ T{ delegate-clone T{ empty f } } ]
-[ T{ delegate-clone T{ empty f } } clone ] unit-test
-
-FORGET: empty
-
-[ t ] [ \ null \ delegate-clone class< ] unit-test
-[ f ] [ \ object \ delegate-clone class< ] unit-test
-[ f ] [ \ object \ delegate-clone class< ] unit-test
-[ t ] [ \ delegate-clone \ tuple class< ] unit-test
-[ f ] [ \ tuple \ delegate-clone class< ] unit-test
-
-! Compiler regression
-[ t ] [ [ t length ] catch no-method-object ] unit-test
-
-[ "<constructor-test>" ]
-[ "TUPLE: constructor-test ; C: constructor-test ;" eval word word-name ] unit-test
-
-! There was a typo in check-shape; it would unintern the wrong
-! words!
-[ "temporary-1" ]
-[
-    "IN: temporary-1 SYMBOL: foobar IN: temporary TUPLE: foobar ;" eval
-    "foobar" { "temporary" "temporary-1" } [ vocab ] map
-    hash-stack word-vocabulary
-] unit-test
-
-TUPLE: size-test a b c d ;
-
-[ t ] [
-    T{ size-test } array-capacity
-    size-test tuple-size =
-] unit-test
-
-GENERIC: <yo-momma>
-
-TUPLE: yo-momma ;
-
-[ f ] [ \ <yo-momma> generic? ] unit-test
-
-! Test forget
-[ t ] [ \ yo-momma class? ] unit-test
-[ ] [ \ yo-momma forget ] unit-test
-[ f ] [ \ yo-momma typemap get hash-values memq? ] unit-test
-
-[ f ] [ \ yo-momma interned? ] unit-test
-[ f ] [ \ yo-momma? interned? ] unit-test
-[ f ] [ \ <yo-momma> interned? ] unit-test
-
-! Test if C: sets last word correctly
-[ ] [ "IN: temporary TUPLE: C:-test ; C: C:-test ( -- x ) ;" eval ] unit-test
-[ "<C:-test>" ] [ word word-name ] unit-test
-[ "( -- x )" ] [ "<C:-test>" "temporary" lookup stack-effect effect>string ] unit-test
-
-TUPLE: loc-recording ;
-
-[ f ] [ \ loc-recording where not ] unit-test
-[ f ] [ \ <loc-recording> where not ] unit-test
-[ f ] [ \ loc-recording? where not ] unit-test
-
-! Ensure C: puts the word in the right vocabulary
-[ f ] [
-    "IN: temporary TUPLE: xyz ; IN: temporary2 C: xyz ;" eval
-    "<xyz>" "temporary2" lookup
-] unit-test
diff --git a/core/test/words.factor b/core/test/words.factor
deleted file mode 100644 (file)
index 2fd052e..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-IN: temporary
-USING: arrays errors generic hashtables kernel math namespaces
-sequences test words definitions parser ;
-
-[ 4 ] [
-    "poo" "scratchpad" create [ 2 2 + ] define-compound
-    "poo" "scratchpad" lookup execute
-] unit-test
-
-[ t ] [ t vocabs [ words [ word? and ] each ] each ] unit-test
-
-DEFER: plist-test
-
-[ t ] [
-    \ plist-test t "sample-property" set-word-prop
-    \ plist-test "sample-property" word-prop
-] unit-test
-
-[ f ] [
-    \ plist-test f "sample-property" set-word-prop
-    \ plist-test "sample-property" word-prop
-] unit-test
-
-[ f ] [ 5 compound? ] unit-test
-
-"create-test" "scratchpad" create { 1 2 } "testing" set-word-prop
-[ { 1 2 } ] [
-    "create-test" "scratchpad" lookup "testing" word-prop
-] unit-test
-
-[
-    [ t ] [ \ array? "array?" "arrays" lookup = ] unit-test
-
-    "test-scope" "scratchpad" create drop
-] with-scope
-
-[ "test-scope" ] [
-    "test-scope" "scratchpad" lookup word-name
-] unit-test
-
-[ t ] [ vocabs array? ] unit-test
-[ t ] [ vocabs [ words [ word? ] all? ] all? ] unit-test
-
-[ f ] [ gensym gensym = ] unit-test
-
-[ f ] [ 123 compound? ] unit-test
-
-: colon-def ;
-[ t ] [ \ colon-def compound? ] unit-test
-
-SYMBOL: a-symbol
-[ f ] [ \ a-symbol compound? ] unit-test
-[ t ] [ \ a-symbol symbol? ] unit-test
-
-! See if redefining a generic as a colon def clears some
-! word props.
-GENERIC: testing
-: testing ;
-
-[ f ] [ \ testing generic? ] unit-test
-
-[ f ] [ gensym interned? ] unit-test
-
-: forgotten ;
-: another-forgotten ;
-
-[ f ] [ \ forgotten interned? ] unit-test
-
-FORGET: forgotten
-
-[ f ] [ \ another-forgotten interned? ] unit-test
-
-FORGET: another-forgotten
-: another-forgotten ;
-
-[ t ] [ \ + interned? ] unit-test
-
-! I forgot remove-crossref calls!
-: fee ;
-: foe fee ;
-: fie foe ;
-
-[ 0 ] [ \ fee crossref get hash hash-size ] unit-test
-[ t ] [ \ foe crossref get hash not ] unit-test
-
-FORGET: foe
-
-! xref should not retain references to gensyms
-gensym [ * ] define-compound
-[ t ] [ \ * usage [ interned? not ] subset empty? ] unit-test
-
-DEFER: calls-a-gensym
-\ calls-a-gensym gensym dup "x" set unit define-compound
-[ f ] [ "x" get crossref get hash ] unit-test
-
-! more xref buggery
-[ f ] [
-    GENERIC: xyzzle
-    : a ; \ a
-    M: integer xyzzle a ;
-    FORGET: a
-    M: object xyzzle ;
-    crossref get hash
-] unit-test
-
-! regression
-GENERIC: freakish
-: bar freakish ;
-M: array freakish ;
-[ t ] [ \ bar \ freakish usage member? ] unit-test
-
-DEFER: x
-[ t ] [ [ x ] catch third \ x eq? ] unit-test
-
-[ ] [ "no-loc" "temporary" create drop ] unit-test
-[ f ] [ "no-loc" "temporary" lookup where ] unit-test
-
-[ ] [ "IN: temporary : no-loc-2 ;" eval ] unit-test
-[ f ] [ "no-loc-2" "temporary" lookup where ] unit-test
-
-[ ] [ "IN: temporary : test-last ( -- ) ;" eval ] unit-test
-[ "test-last" ] [ word word-name ] unit-test
diff --git a/core/threads.factor b/core/threads.factor
deleted file mode 100644 (file)
index eb87387..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! Copyright (C) 2005 Mackenzie Straight.
-! See http://factorcode.org/license.txt for BSD license.
-IN: threads
-USING: arrays errors hashtables io-internals kernel math
-namespaces queues sequences vectors ;
-
-! Co-operative multitasker.
-
-: run-queue ( -- queue ) \ run-queue get-global ;
-
-: schedule-thread ( continuation -- ) run-queue enque ;
-
-: schedule-thread-with ( obj continuation -- )
-    2array schedule-thread ;
-
-: sleep-queue ( -- vector ) \ sleep-queue get-global ;
-
-: sleep-queue* ( -- vector )
-    sleep-queue dup [ [ first ] 2apply swap - ] nsort ;
-
-: sleep-time ( vector -- ms )
-    dup empty? [ drop 1000 ] [ peek first millis [-] ] if ;
-
-: stop ( -- )
-    get-walker-hook [
-        f swap continue-with
-    ] [
-        run-queue deque dup array?
-        [ first2 continue-with ] [ continue ] if
-    ] if* ;
-
-: yield ( -- ) [ schedule-thread stop ] callcc0 ;
-
-: sleep ( ms -- )
-    >fixnum millis +
-    [ 2array sleep-queue push stop ] callcc0 drop ;
-
-: in-thread ( quot -- )
-    [
-        schedule-thread
-        V{ } set-catchstack
-        V{ } set-callstack
-        V{ } set-retainstack
-        [ print-error ] recover
-        stop
-    ] callcc0 drop ;
-
-IN: kernel-internals
-
-: (idle-thread) ( fast? -- )
-    #! If fast, then we don't sleep, just select()
-    sleep-queue* dup sleep-time dup zero?
-    [ drop pop second schedule-thread drop ]
-    [ nip 0 ? io-multiplex ] if ;
-
-: idle-thread ( -- )
-    #! This thread is always running.
-    #! If run queue is not empty, we don't sleep.
-    run-queue queue-empty? (idle-thread) yield idle-thread ;
-
-: init-threads ( -- )
-    <queue> \ run-queue set-global
-    V{ } clone \ sleep-queue set-global
-    [ idle-thread ] in-thread ;
diff --git a/core/threads.facts b/core/threads.facts
deleted file mode 100644 (file)
index 7ad51cf..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-USING: help threads kernel kernel-internals io ;
-
-HELP: run-queue
-{ $values { "queue" "a queue" } }
-{ $description "Outputs the runnable thread queue." } ;
-
-HELP: schedule-thread
-{ $values { "continuation" "a continuation reified by " { $link callcc0 } } }
-{ $description "Adds a runnable thread to the end of the run queue." } ;
-
-HELP: schedule-thread-with
-{ $values { "obj" "an object" } { "continuation" "a continuation reified by " { $link callcc1 } } }
-{ $description "Adds a runnable thread to the end of the run queue. When the thread runs the object is passed to the continuation using " { $link continue-with } "." } ;
-
-HELP: sleep-queue
-{ $values { "vector" "a vector" } }
-{ $description "Outputs the sleeping thread queue. This is not actually a queue, but a vector of cons cells, where each cons cell consists of a wakeup time and a continuation." } ;
-
-HELP: sleep-queue*
-{ $values { "vector" "a vector" } }
-{ $description "Outputs the sleeping thread queue, sorted by wakeup time." } ;
-
-HELP: sleep-time
-{ $values { "vector" "a sorted sleep queue" } { "ms" "a non-negative integer" } }
-{ $description "Outputs the time until the next sleeping thread is scheduled to wake up, or -1 if there are no sleeping threads. The input must be a sorted sleep queue output by " { $link sleep-queue* } "." } ;
-
-HELP: stop
-{ $description "Stops the current thread." } ;
-
-HELP: yield
-{ $description "Adds the current thread to the end of the run queue, and switches to the next runnable thread." } ;
-
-HELP: sleep
-{ $values { "ms" "a non-negative integer" } }
-{ $description "Suspends the current thread for " { $snippet "ms" } " milliseconds. It will not get woken up before this time period elapses, but since the multitasker is co-operative, the precise wakeup time is dependent on when other threads yield." } ;
-
-HELP: in-thread
-{ $values { "quot" "a quotation" } }
-{ $description "Spawns a new thread. The new thread begins running immediately."
-$terpri
-"The new thread inherits the current data stack and name stack. The call stack initially contains the new quotation only, so when the quotation returns the thread stops. The catch stack contains a default handler which logs errors to the " { $link stdio } " stream." }
-{ $examples
-    { $code "1 2 [ + . ] in-thread" }
-}
-{ $notes
-    "A higher-level concurrency library can be found in the " { $snippet "libs/concurrency" } " module; see " { $link "modules" } "."
-} ;
-
-HELP: idle-thread
-{ $description "Runs the idle thread, which services I/O requests and relinquishes control to the operating system until the next Factor thread has to wake up again." }
-{ $notes "This word should never be called directly. The idle thread is always running." } ;
-
-HELP: init-threads
-{ $description "Called during startup to initialize the threading system. This word should never be called directly." } ;
diff --git a/core/threads/authors.txt b/core/threads/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/threads/summary.txt b/core/threads/summary.txt
new file mode 100644 (file)
index 0000000..0f5c728
--- /dev/null
@@ -0,0 +1 @@
+Co-operative threading
diff --git a/core/threads/threads-docs.factor b/core/threads/threads-docs.factor
new file mode 100644 (file)
index 0000000..b4a7c34
--- /dev/null
@@ -0,0 +1,67 @@
+USING: help.markup help.syntax kernel kernel.private io
+threads.private continuations queues ;
+IN: threads
+
+ARTICLE: "threads" "Threads"
+"A limited form of multiprocessing is supported in the form of cooperative threads, which are implemented on top of continuations. A thread will yield while waiting for I/O operations to complete, or when a yield has been explicitly requested."
+$nl
+"Words for working with threads are in the " { $vocab-link "threads" } " vocabulary."
+{ $subsection in-thread }
+{ $subsection yield }
+{ $subsection sleep }
+{ $subsection stop }
+"Continuations can be added to the run queue directly:"
+{ $subsection schedule-thread }
+{ $subsection schedule-thread-with }
+"Thread implementation:"
+{ $subsection run-queue }
+{ $subsection sleep-queue } ;
+
+ABOUT: "threads"
+
+HELP: run-queue
+{ $values { "queue" queue } }
+{ $description "Outputs the runnable thread queue." } ;
+
+HELP: schedule-thread
+{ $values { "continuation" "a continuation reified by " { $link callcc0 } } }
+{ $description "Adds a runnable thread to the end of the run queue." } ;
+
+HELP: schedule-thread-with
+{ $values { "obj" "an object" } { "continuation" "a continuation reified by " { $link callcc1 } } }
+{ $description "Adds a runnable thread to the end of the run queue. When the thread runs the object is passed to the continuation using " { $link continue-with } "." } ;
+
+HELP: sleep-queue
+{ $var-description "Sleeping thread queue. This is not actually a queue, but an array of pairs of the shape " { $snippet "{ time continuation }" } "." } ;
+
+HELP: sleep-time
+{ $values { "ms" "a non-negative integer" } }
+{ $description "Outputs the time until the next sleeping thread is scheduled to wake up, or a default sleep time if there are no sleeping threads." } ;
+
+HELP: stop
+{ $description "Stops the current thread." } ;
+
+HELP: yield
+{ $description "Adds the current thread to the end of the run queue, and switches to the next runnable thread." } ;
+
+HELP: sleep
+{ $values { "ms" "a non-negative integer" } }
+{ $description "Suspends the current thread for " { $snippet "ms" } " milliseconds. It will not get woken up before this time period elapses, but since the multitasker is co-operative, the precise wakeup time is dependent on when other threads yield." } ;
+
+HELP: in-thread
+{ $values { "quot" "a quotation" } }
+{ $description "Spawns a new thread. The new thread begins running immediately."
+$nl
+"The new thread inherits the current data stack and name stack. The call stack initially contains the new quotation only, so when the quotation returns the thread stops. The catch stack contains a default handler which logs errors to the " { $link stdio } " stream." }
+{ $examples
+    { $code "1 2 [ + . ] in-thread" }
+} ;
+
+HELP: idle-thread
+{ $description "Runs the idle thread, which services I/O requests and relinquishes control to the operating system until the next Factor thread has to wake up again."
+$nl
+"If the run queue is empty, the idle thread will sleep until the next sleeping thread is scheduled to wake up, otherwise it yields immediately after checking for any completed I/O requests." }
+{ $notes "This word should never be called directly. The idle thread is always running." } ;
+
+HELP: init-threads
+{ $description "Called during startup to initialize the threading system. This word should never be called directly." } ;
diff --git a/core/threads/threads-tests.factor b/core/threads/threads-tests.factor
new file mode 100644 (file)
index 0000000..05fda20
--- /dev/null
@@ -0,0 +1,13 @@
+USING: namespaces io tools.test threads kernel ;
+IN: temporary
+
+3 "x" set
+[ yield 2 "x" set ] in-thread
+[ 2 ] [ yield "x" get ] unit-test
+[ ] [ [ flush ] in-thread flush ] unit-test
+[ ] [ [ "Errors, errors" throw ] in-thread ] unit-test
+yield
+
+[ ] [ 1/2 sleep ] unit-test
+[ ] [ 0.3 sleep ] unit-test
+[ "hey" sleep ] unit-test-fails
diff --git a/core/threads/threads.factor b/core/threads/threads.factor
new file mode 100644 (file)
index 0000000..c76118d
--- /dev/null
@@ -0,0 +1,75 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! Copyright (C) 2005 Mackenzie Straight.
+! See http://factorcode.org/license.txt for BSD license.
+IN: threads
+USING: arrays init hashtables io.backend kernel kernel.private
+math namespaces queues sequences vectors io system sorting
+continuations debugger ;
+
+<PRIVATE
+
+SYMBOL: sleep-queue
+
+: sleep-time ( -- ms )
+    sleep-queue get-global
+    dup empty? [ drop 1000 ] [ first first millis [-] ] if ;
+
+: run-queue ( -- queue ) \ run-queue get-global ;
+
+: schedule-sleep ( ms continuation -- )
+    2array global [
+        sleep-queue [ swap add sort-keys ] change
+    ] bind ;
+
+: wake-up ( -- continuation )
+    global [
+        sleep-queue [ unclip second swap ] change
+    ] bind ;
+
+PRIVATE>
+
+: schedule-thread ( continuation -- ) run-queue enque ;
+
+: schedule-thread-with ( obj continuation -- )
+    2array schedule-thread ;
+
+: stop ( -- )
+    walker-hook [
+        f swap continue-with
+    ] [
+        run-queue deque dup array?
+        [ first2 continue-with ] [ continue ] if
+    ] if* ;
+
+: yield ( -- ) [ schedule-thread stop ] callcc0 ;
+
+: sleep ( ms -- )
+    >fixnum millis + [ schedule-sleep stop ] callcc0 drop ;
+
+: in-thread ( quot -- )
+    [
+        >r schedule-thread r> [
+            V{ } set-catchstack
+            { } set-retainstack
+            [ print-error ] recover stop
+        ] (throw)
+    ] curry callcc0 ;
+
+<PRIVATE
+
+: (idle-thread) ( slow? -- )
+    sleep-time dup zero?
+    [ wake-up schedule-thread 2drop ]
+    [ 0 ? io-multiplex ] if ;
+
+: idle-thread ( -- )
+    run-queue queue-empty? (idle-thread) yield idle-thread ;
+
+: init-threads ( -- )
+    <queue> \ run-queue set-global
+    f sleep-queue set-global
+    [ idle-thread ] in-thread ;
+
+[ init-threads ] "threads" add-init-hook
+
+PRIVATE>
diff --git a/core/tools/completion.factor b/core/tools/completion.factor
deleted file mode 100644 (file)
index 18d62bd..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: completion
-USING: kernel arrays sequences math namespaces strings io ;
-
-! Simple fuzzy search.
-
-: fuzzy ( full short -- indices )
-    0 swap >array [ swap pick index* [ 1+ ] keep ] map 2nip
-    -1 over member? [ drop f ] when ;
-
-: (runs) ( n i seq -- )
-    2dup length < [
-        3dup nth [
-            number= [
-                >r >r 1+ r> r>
-            ] [
-                split-next,
-                rot drop [ nth 1+ ] 2keep
-            ] if >r 1+ r>
-        ] keep split, (runs)
-    ] [
-        3drop
-    ] if ;
-
-: runs ( seq -- seq )
-    [
-        split-next,
-        dup first 0 rot (runs)
-    ] { } make ;
-
-: score-1 ( i full -- n )
-    {
-        { [ over zero? ] [ 2drop 10 ] }
-        { [ 2dup length 1- = ] [ 2drop 4 ] }
-        { [ 2dup >r 1- r> nth Letter? not ] [ 2drop 10 ] }
-        { [ 2dup >r 1+ r> nth Letter? not ] [ 2drop 4 ] }
-        { [ t ] [ 2drop 1 ] }
-    } cond ;
-
-: score ( full fuzzy -- n )
-    dup [
-        [ [ length ] 2apply - 15 swap [-] 3 / ] 2keep
-        runs [
-            [ swap score-1 ] map-with dup supremum swap length *
-        ] map-with sum +
-    ] [
-        2drop 0
-    ] if ;
-
-: rank-completions ( results -- newresults )
-    #! Discard results in the low 33%
-    sort-keys <reversed>
-    [ 0 [ first max ] reduce 3 / ] keep
-    [ first < ] subset-with
-    [ second ] map ;
-
-: complete ( full short -- score )
-    #! Match forwards and backwards, see which one has the
-    #! highest score.
-    [ dupd fuzzy score ] 2keep
-    [ <reversed> ] 2apply
-    dupd fuzzy score max ;
-
-: completion ( str quot obj -- pair )
-    #! pair is { obj score }
-    [ swap call swap complete ] keep 2array ; inline
-
-: completions ( str quot candidates -- seq )
-    pick empty? [
-        dup length 1000 > [
-            3drop f
-        ] [
-            2nip
-        ] if
-    ] [
-        [ >r 2dup r> completion ] map 2nip rank-completions
-    ] if ; inline
-
-: string-completions ( str strs -- seq )
-    f swap completions ;
diff --git a/core/tools/debugger.factor b/core/tools/debugger.factor
deleted file mode 100644 (file)
index 66ed6a6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays definitions generic hashtables tools io
-kernel math namespaces parser prettyprint sequences
-sequences-internals strings styles vectors words errors help ;
-IN: errors
-
-: :edit ( -- )
-    error get delegates [ parse-error? ] find-last nip [
-        dup parse-error-file ?resource-path
-        swap parse-error-line edit-location
-    ] when* ;
-
-: (:help-multi)
-    "This error has multiple delegates:" print
-    help-outliner terpri ;
-
-: (:help-none)
-    drop "No help for this error. " print ;
-
-: :help ( -- )
-    error get delegates [ error-help ] map [ ] subset
-    {
-        { [ dup empty? ] [ (:help-none) ] }
-        { [ dup length 1 = ] [ first help ] }
-        { [ t ] [ (:help-multi) ] }
-    } cond ;
diff --git a/core/tools/debugger.facts b/core/tools/debugger.facts
deleted file mode 100644 (file)
index 4259a13..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-IN: errors
-USING: help parser definitions ;
-
-HELP: :help
-{ $description "Displays documentation for the most recent error." } ;
-
-HELP: :edit
-{ $description "If the most recent error was a " { $link parse-error } " thrown while parsing a source file, opens the source file at the failing line in the default editor using the " { $link edit-hook } ". See " { $link "editor" } "." } ;
diff --git a/core/tools/definitions.factor b/core/tools/definitions.factor
deleted file mode 100644 (file)
index 2cb8bd7..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: definitions
-USING: arrays errors generic hashtables io kernel math
-namespaces parser prettyprint prettyprint-internals sequences
-styles words help ;
-
-: reload ( defspec -- )
-    where first [ run-file ] when* ;
-
-TUPLE: no-edit-hook ;
-
-SYMBOL: edit-hook
-
-: edit-location ( file line -- )
-    >r ?resource-path r>
-    edit-hook get [ call ] [ <no-edit-hook> throw ] if* ;
-
-: edit-file ( file -- ) ?resource-path 0 edit-location ;
-
-: edit ( defspec -- )
-    where [
-        first2 edit-location
-    ] [
-        "Not from a source file" throw
-    ] if* ;
-
-: write-vocab ( vocab -- )
-    dup <vocab-link> presented associate styled-text ;
-
-: in. ( word -- )
-    word-vocabulary [
-        H{ } clone <flow \ IN: pprint-word write-vocab block>
-    ] when* ;
-
-: comment. ( string -- )
-    [ H{ { font-style italic } } styled-text ] when* ;
-
-M: word synopsis*
-    dup in.
-    dup definer pprint-word
-    dup pprint-word
-    stack-effect [ effect>string comment. ] when* ;
-
-M: method-spec synopsis*
-    \ M: pprint-word [ pprint-word ] each ;
-
-: synopsis ( defspec -- str )
-    [ 0 margin set [ synopsis* ] with-pprint ] string-out ;
-
-M: word summary synopsis ;
-
-GENERIC: definition ( spec -- quot ? )
-
-M: word definition drop f f ;
-
-M: compound definition word-def t ;
-
-M: generic definition "combination" word-prop t ;
-
-M: method-spec definition first2 method method-def t ;
-
-GENERIC: declarations. ( obj -- )
-
-M: object declarations. drop ;
-
-: declaration. ( word prop -- )
-    tuck word-name word-prop [ pprint-word ] [ drop ] if ;
-
-M: word declarations.
-    {
-        POSTPONE: parsing
-        POSTPONE: inline
-        POSTPONE: foldable
-    } [ declaration. ] each-with ;
-
-: pprint-; \ ; pprint-word ;
-
-: (see) ( spec -- )
-    [
-        dup synopsis*
-        dup definition [
-            H{ } <defblock
-            pprint-elements pprint-; declarations.
-            block>
-        ] [
-            2drop
-        ] if newline
-    ] with-pprint ;
-
-M: object see (see) ;
-
-GENERIC: see-class* ( word -- )
-
-M: union see-class*
-    \ UNION: pprint-word
-    dup pprint-word
-    members pprint-elements pprint-; ;
-
-M: predicate see-class*
-    \ PREDICATE: pprint-word
-    dup superclass pprint-word
-    dup pprint-word
-    H{ } <defblock
-    "definition" word-prop pprint-elements
-    pprint-; block> ;
-
-M: tuple-class see-class*
-    \ TUPLE: pprint-word
-    dup pprint-word
-    "slot-names" word-prop [ text ] each
-    pprint-; ;
-
-M: word see-class* drop ;
-
-: see-class ( word -- )
-    dup class? over builtin? not and [
-        terpri [ see-class* ] with-pprint terpri
-    ] [
-        drop
-    ] if ;
-
-: see-subdefs ( word -- ) subdefs [ terpri see ] each ;
-
-M: word see dup (see) dup see-class see-subdefs ;
-
-M: link where link-name article article-loc ;
-
-M: link synopsis*
-    \ ARTICLE: pprint-word
-    dup link-name pprint*
-    article-title pprint* ;
-
-M: link definition article-content t ;
-
-M: link see (see) ;
-
-PREDICATE: link word-link link-name word? ;
-
-M: word-link where link-name "help-loc" word-prop ;
-
-M: word-link synopsis*
-    \ HELP: pprint-word
-    link-name dup pprint-word
-    stack-effect effect>string comment. ;
-
-M: word-link definition
-    link-name "help" word-prop t ;
-
-M: link forget link-name remove-article ;
-
-M: word-link forget f "help" set-word-prop ;
diff --git a/core/tools/definitions.facts b/core/tools/definitions.facts
deleted file mode 100644 (file)
index cf7094c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-IN: definitions
-USING: help io modules prettyprint ;
-
-HELP: ?resource-path
-{ $values { "path" "a string" } { "newpath" "a string" } }
-{ $description "If the path is prefixed with " { $snippet "\"resource:\"" } ", prepends the resource path." }
-{ $see-also resource-path } ;
-
-HELP: reload
-{ $values { "defspec" "a definition specifier" } }
-{ $description "Reloads the source file containing the definition." }
-{ $examples
-    "To reload a word definition:"
-    { $code "\ foo reload" }
-    "A method definition:"
-    { $code "{ editor draw-gadget* } reload" }
-    "A help article:"
-    { $code "\"handbook\" <link> reload" }
-} ;
-
-HELP: in.
-{ $values { "word" "a word" } }
-{ $description "Prettyprints a " { $snippet "IN:" } " declaration for the word." }
-$prettyprinting-note ;
-
-HELP: synopsis
-{ $values { "defspec" "a definition specifier" } }
-{ $contract "Prettyprints the prologue of a definition." }
-$prettyprinting-note
-{ $see-also summary } ;
-
-HELP: comment.
-{ $values { "string" "a string" } }
-{ $description "Prettyprints some text with the comment style." }
-$prettyprinting-note ;
-
-HELP: edit
-{ $values { "defspec" "a definition specifier" } }
-{ $description "Opens the source file containing the definition using the current " { $link edit-hook } ". See " { $link "editor" } "." } ;
-
-HELP: edit-location
-{ $values { "file" "a path name string" } { "line" "a positive integer" } }
-{ $description "Opens a source file at the specified line number containing using the current " { $link edit-hook } ". Line numbers are indexed starting from 1. See " { $link "editor" } "." } ;
-
-HELP: edit-file
-{ $values { "file" "a path name string" } }
-{ $description "Opens a source file containing using the current " { $link edit-hook } ". See " { $link "editor" } "." } ;
-
-HELP: no-edit-hook
-{ $error-description "Thrown when " { $link edit } " is called when the " { $link edit-hook } " variable is not set. See " { $link "editor" } "." } ;
diff --git a/core/tools/errors.factor b/core/tools/errors.factor
deleted file mode 100644 (file)
index aee7bae..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: errors
-USING: generic help tools io kernel math math-internals parser
-prettyprint queues sequences sequences-internals strings test
-words definitions ;
-
-: expired-error. ( obj -- )
-    "Object did not survive image save/load: " write third . ;
-
-: undefined-word-error. ( obj -- )
-    "Undefined word: " write third . ;
-
-: io-error. ( error -- )
-    "I/O error: " write third print ;
-
-: type-check-error. ( obj -- )
-    "Type check error" print
-    "Object: " write dup fourth short.
-    "Object type: " write dup fourth class .
-    "Expected type: " write third type>class . ;
-
-: divide-by-zero-error. ( obj -- )
-    "Division by zero" print drop ;
-
-: signal-error. ( obj -- )
-    "Operating system signal " write third . ;
-
-: negative-array-size-error. ( obj -- )
-    "Cannot allocate array with negative size " write third . ;
-
-: c-string-error. ( obj -- )
-    "Cannot convert to C string: " write third . ;
-
-: ffi-error. ( obj -- )
-    "FFI: " write
-    dup third [ write ": " write ] when*
-    fourth print ;
-
-: heap-scan-error. ( obj -- )
-    "Cannot do next-object outside begin/end-scan" print drop ;
-
-: undefined-symbol-error. ( obj -- )
-    "The image refers to a library or symbol that was not found"
-    " at load time" append print drop ;
-
-: user-interrupt. ( obj -- )
-    "User interrupt" print drop ;
-
-: stack-underflow. ( obj name -- )
-    write " stack underflow" print drop ;
-
-: stack-overflow. ( obj name -- )
-    write " stack overflow" print drop ;
-
-! Hook for core/ui/cocoa module
-DEFER: objc-error. ( alien -- )
-
-: datastack-underflow. "Data" stack-underflow. ;
-: datastack-overflow. "Data" stack-overflow. ;
-: retainstack-underflow. "Retain" stack-underflow. ;
-: retainstack-overflow. "Retain" stack-overflow. ;
-: callstack-underflow. "Call" stack-underflow. ;
-: callstack-overflow. "Call" stack-overflow. ;
-
-: memory-error.
-    "Data heap allocation request failed" print ;
-
-: kernel-error ( error -- word )
-    #! Kernel errors are indexed by integers.
-    second {
-        expired-error.
-        io-error.
-        undefined-word-error.
-        type-check-error.
-        divide-by-zero-error.
-        signal-error.
-        negative-array-size-error.
-        c-string-error.
-        ffi-error.
-        heap-scan-error.
-        undefined-symbol-error.
-        user-interrupt.
-        datastack-underflow.
-        datastack-overflow.
-        retainstack-underflow.
-        retainstack-overflow.
-        callstack-underflow.
-        callstack-overflow.
-        memory-error.
-        objc-error.
-    } nth ;
-
-M: kernel-error error. dup kernel-error execute ;
-
-M: kernel-error error-help kernel-error ;
-
-M: no-method summary
-    drop "No suitable method" ;
-
-M: no-method error.
-    "Generic word " write
-    dup no-method-generic pprint
-    " does not define a method for the " write
-    dup no-method-object class pprint
-    " class." print
-    "Allowed classes: " write dup no-method-generic order .
-    "Dispatching on object: " write no-method-object short. ;
-
-M: no-math-method summary
-    drop "No suitable arithmetic method" ;
-
-M: bad-escape summary
-    drop "Invalid escape code" ;
-
-M: c-stream-error summary
-    drop "C stream I/O does not support this feature" ;
-
-M: check-closed summary
-    drop "Attempt to perform I/O on closed stream" ;
-
-M: check-method summary
-    drop "Invalid parameters for define-method" ;
-
-M: check-tuple summary
-    drop "Invalid class for define-constructor" ;
-
-M: check-vocab summary
-    drop "Vocabulary does not exist" ;
-
-M: empty-queue summary
-    drop "Empty queue" ;
-
-M: no-article summary
-    drop "Help article does not exist" ;
-
-M: no-cond summary
-    drop "Fall-through in cond" ;
-
-M: slice-error error.
-    "Cannot create slice because " write
-    slice-error-reason print ;
-
-M: no-word summary
-    drop "Word not found in current vocabulary search path" ;
-
-: parse-dump ( error -- )
-    "Parsing " write
-    dup parse-error-file
-    [ "<interactive>" ] unless*
-    write-pathname
-    ":" write
-    dup parse-error-line [ 1 ] unless* number>string print
-    
-    dup parse-error-text dup string? [ print ] [ drop ] if
-    
-    parse-error-col [ 0 ] unless*
-    CHAR: \s <string> write "^" print ;
-
-M: parse-error error.
-    dup parse-dump  delegate error. ;
-
-M: bounds-error summary drop "Sequence index out of bounds" ;
-
-M: condition error. delegate error. ;
-
-M: condition error-help drop f ;
-
-M: assert summary drop "Assertion failed" ;
-
-M: no-edit-hook summary drop "No edit hook is set" ;
diff --git a/core/tools/image.factor b/core/tools/image.factor
deleted file mode 100644 (file)
index 507c9e0..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: alien
-SYMBOL: c-types
-
-USING: arrays errors generic hashtables hashtables-internals
-help io kernel kernel-internals math namespaces parser
-prettyprint sequences sequences-internals strings vectors words
-modules ;
-IN: image
-
-! Constants
-
-: image-magic HEX: 0f0e0d0c ; inline
-: image-version 2 ; inline
-
-: char bootstrap-cell 2 /i ; inline
-
-: untag ( cell -- cell ) tag-mask bitnot bitand ; inline
-: tag ( cell -- tag ) tag-mask bitand ; inline
-
-: data-base 1024 ; inline
-
-: boot-quot-offset      3 ; inline
-: global-offset         4 ; inline
-: t-offset              5 ; inline
-: 0-offset              6 ; inline
-: 1-offset              7 ; inline
-: -1-offset             8 ; inline
-: data-heap-size-offset 9 ; inline
-: code-heap-size-offset 10 ; inline
-
-: header-size 12 ; inline
-
-! The image being constructed; a vector of word-size integers
-SYMBOL: image
-
-! Object cache
-SYMBOL: objects
-
-! Image output format
-SYMBOL: big-endian
-
-! Bootstrap architecture name
-SYMBOL: architecture
-
-: emit ( cell -- ) image get push ;
-
-: emit-64 ( cell -- )
-    bootstrap-cell 8 = [
-        emit
-    ] [
-        d>w/w big-endian get [ swap ] unless emit emit
-    ] if ;
-
-: emit-seq ( seq -- ) image get swap nappend ;
-
-: fixup ( value offset -- ) image get set-nth ;
-
-: here ( -- size ) 
-    image get length header-size - bootstrap-cells data-base + ;
-
-: here-as ( tag -- pointer ) here swap bitor ;
-
-: align-here ( -- )
-    here 8 mod 4 = [ 0 emit ] when ;
-
-: emit-fixnum ( n -- ) fixnum-tag tag-address emit ;
-
-: emit-object ( header tag quot -- addr )
-    swap here-as >r swap tag-header emit call align-here r> ;
-    inline
-
-! Image header
-
-: header ( -- )
-    image-magic emit
-    image-version emit
-     data-base emit ! relocation base at end of header
-     0 emit ! bootstrap quotation set later
-     0 emit ! global namespace set later
-     0 emit ! pointer to t object
-     0 emit ! pointer to bignum 0
-     0 emit ! pointer to bignum 1
-     0 emit ! pointer to bignum -1
-     0 emit ! size of data heap set later
-     0 emit ! size of code heap is 0
-     0 emit ; ! reloc base of code heap is 0
-
-GENERIC: ' ( obj -- ptr )
-#! Write an object to the image.
-
-! Bignums
-
-: bignum-bits bootstrap-cell-bits 2 - ;
-
-: bignum-radix bignum-bits 1 swap shift 1- ;
-
-: (bignum>seq) ( n -- )
-    dup zero? [
-        drop
-    ] [
-        dup bignum-radix bitand ,
-        bignum-bits neg shift (bignum>seq)
-    ] if ;
-
-: bignum>seq ( n -- seq )
-    #! n is positive or zero.
-    [ (bignum>seq) ] { } make ;
-
-: emit-bignum ( n -- )
-    [ 0 < 1 0 ? ] keep abs bignum>seq
-    dup length 1+ emit-fixnum
-    swap emit emit-seq ;
-
-M: bignum '
-    #! This can only emit 0, -1 and 1.
-    bignum-tag bignum-tag [ emit-bignum ] emit-object ;
-
-! Fixnums
-
-M: fixnum '
-    #! When generating a 32-bit image on a 64-bit system,
-    #! some fixnums should be bignums.
-    dup most-negative-fixnum most-positive-fixnum between?
-    [ fixnum-tag tag-address ] [ >bignum ' ] if ;
-
-! Floats
-
-M: float '
-    float-tag float-tag [
-        align-here double>bits emit-64
-    ] emit-object ;
-
-! Special objects
-
-! Padded with fixnums for 8-byte alignment
-
-: t, t t-offset fixup ;
-
-M: f '
-    #! f is #define F RETAG(0,OBJECT_TYPE)
-    drop object-tag ;
-
-:  0,  0 >bignum '  0-offset fixup ;
-:  1,  1 >bignum '  1-offset fixup ;
-: -1, -1 >bignum ' -1-offset fixup ;
-
-! Beginning of the image
-! The image begins with the header, then T,
-! and the bignums 0, 1, and -1.
-
-: begin-image ( -- ) header t, 0, 1, -1, ;
-
-! Words
-
-: emit-word ( word -- )
-    [
-        dup hashcode ' ,
-        dup word-name ' ,
-        dup word-vocabulary ' ,
-        dup word-primitive ' ,
-        dup word-def ' ,
-        dup word-props ' ,
-        f ' ,
-        0 ,
-    ] { } make
-    word-tag word-tag [ emit-seq ] emit-object
-    swap objects get set-hash ;
-
-: word-error ( word msg -- * )
-    [ % dup word-vocabulary % " " % word-name % ] "" make throw ;
-
-: transfer-word ( word -- word )
-    dup target-word [ ] [ "Missing DEFER: " word-error ] ?if ;
-
-: fixup-word ( word -- offset )
-    transfer-word dup objects get hash
-    [ ] [ "Not in image: " word-error ] ?if ;
-
-: fixup-words ( -- )
-    image get [ dup word? [ fixup-word ] when ] inject ;
-
-M: word ' ;
-
-! Wrappers
-
-M: wrapper '
-    wrapped ' wrapper-tag wrapper-tag [ emit ] emit-object ;
-
-! Ratios and complexes
-
-: emit-pair
-    [ [ emit ] 2apply ] emit-object ;
-
-M: ratio '
-    >fraction [ ' ] 2apply ratio-tag ratio-tag emit-pair ;
-
-M: complex '
-    >rect [ ' ] 2apply complex-tag complex-tag emit-pair ;
-
-! Strings
-
-: emit-chars ( seq -- )
-    big-endian get [ [ <reversed> ] map ] unless
-    [ 0 [ swap 16 shift + ] reduce emit ] each ;
-
-: pack-string ( string -- seq )
-    dup length 1+ char align CHAR: \0 pad-right char group ;
-
-: emit-string ( string -- ptr )
-    string-type object-tag [
-        dup length emit-fixnum
-        dup hashcode emit-fixnum
-        pack-string emit-chars
-    ] emit-object ;
-
-M: string '
-    #! We pool strings so that each string is only written once
-    #! to the image
-    objects get [ emit-string ] cache ;
-
-! Arrays and vectors
-
-: emit-array ( list type -- pointer )
-    >r [ ' ] map r> object-tag [
-        dup length emit-fixnum
-        emit-seq
-    ] emit-object ;
-
-: transfer-tuple ( tuple -- tuple )
-    tuple>array
-    dup first transfer-word 0 pick set-nth
-    >tuple ;
-
-M: tuple '
-    transfer-tuple
-    objects get [ tuple>array tuple-type emit-array ] cache ;
-
-M: method '
-    [
-        \ method transfer-word ,
-        f ,
-        dup method-loc ,
-        method-def ,
-    ] { } make tuple-type emit-array ;
-
-M: array '
-    array-type emit-array ;
-
-M: quotation '
-    quotation-type emit-array ;
-
-M: vector '
-    dup underlying ' swap length
-    vector-type object-tag [
-        emit-fixnum ! length
-        emit ! array ptr
-    ] emit-object ;
-
-M: sbuf '
-    dup underlying ' swap length
-    sbuf-type object-tag [
-        emit-fixnum ! length
-        emit ! array ptr
-    ] emit-object ;
-
-! Hashes
-
-M: hashtable '
-    [ hash-array ' ] keep
-    hashtable-type object-tag [
-        dup hash-count emit-fixnum
-        hash-deleted emit-fixnum
-        emit ! array ptr
-    ] emit-object ;
-
-! End of the image
-
-: words, ( -- )
-    all-words [ emit-word ] each ;
-
-: global, ( -- )
-    [
-        {
-            vocabularies typemap builtins c-types crossref
-            articles parent-graph changed-words
-            modules class<map source-files
-        } [ dup get swap bootstrap-word set ] each
-    ] make-hash '
-    global-offset fixup ;
-
-: boot, ( quot -- ) ' boot-quot-offset fixup ;
-
-: heap-size image get length header-size - bootstrap-cells ;
-
-: end-image ( quot -- )
-    "Generating words..." print flush
-    words,
-    "Generating global namespace..." print flush
-    global,
-    "Generating boot quotation..." print flush
-    boot,
-    "Performing some word fixups..." print flush
-    fixup-words
-    heap-size data-heap-size-offset fixup
-    "Image length: " write image get length .
-    "Object cache size: " write objects get hash-size .
-    \ word global remove-hash ;
-
-! Image output
-
-: (write-image) ( image -- )
-    bootstrap-cell swap big-endian get [
-        [ swap >be write ] each-with
-    ] [
-        [ swap >le write ] each-with
-    ] if ;
-
-: image-name
-    "boot.image." architecture get append resource-path ;
-
-: write-image ( image -- )
-    "Writing image to " write dup write "..." print flush
-    <file-writer> [ (write-image) ] with-stream ;
-
-: prepare-profile ( arch -- )
-    "resource:/core/bootstrap/profile-"
-    swap ".factor" 3append
-    run-file ;
-
-: prepare-image ( arch -- )
-    bootstrapping? on dup architecture set prepare-profile
-    800000 <vector> image set 20000 <hashtable> objects set ;
-
-: make-image ( architecture -- )
-    [
-        parse-hook off
-        prepare-image
-        begin-image
-        "resource:/core/bootstrap/boot-stage1.factor" run-file
-        end-image
-        image get image-name write-image
-    ] with-scope ;
-
-: make-images ( -- )
-    { "x86" "pentium4" "ppc" "amd64" } [ make-image ] each ;
diff --git a/core/tools/image.facts b/core/tools/image.facts
deleted file mode 100644 (file)
index 6a29fa8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-IN: image
-USING: help io ;
-
-HELP: make-image
-{ $values { "architecture" "a string" } }
-{ $description "Creates a bootstrap image from sources, where " { $snippet "architecture" } " is one of the following:"
-{ $code "amd64" "pentium4" "ppc" "x86" }
-"The new image file is written to the " { $link resource-path } " and is named " { $snippet "boot.image." { $emphasis "architecture" } } "." } ;
diff --git a/core/tools/inspector.factor b/core/tools/inspector.factor
deleted file mode 100644 (file)
index 9a32dd6..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: tools
-USING: arrays generic io kernel listener math memory namespaces
-prettyprint sequences words ;
-
-SYMBOL: inspector-slots
-
-: sheet-numbers ( sheet -- sheet )
-    dup [ peek ] map inspector-slots set
-    dup length [ 1+ add* ] 2map ;
-
-SYMBOL: inspector-stack
-
-: me ( -- obj ) inspector-stack get peek ;
-
-: (inspect) ( obj -- )
-    dup inspector-stack get push
-    dup summary print
-    sheet sheet-numbers sheet. ;
-
-: go ( n -- ) 1- inspector-slots get nth (inspect) ;
-
-: up ( -- ) inspector-stack get dup pop* pop (inspect) ;
-
-: inspector-help ( -- )
-    "Object inspector." print
-    "up -- return to previous object" print
-    "me ( -- obj ) push this object" print
-    "go ( n -- ) inspect nth slot" print
-    terpri ;
-
-: inspector ( obj -- )
-    inspector-help
-    V{ } clone inspector-stack set
-    (inspect) ;
-
-: inspect ( obj -- )
-    inspector-stack get [ (inspect) ] [ inspector ] if ;
diff --git a/core/tools/inspector.facts b/core/tools/inspector.facts
deleted file mode 100644 (file)
index a8493d5..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-IN: tools
-USING: errors help ;
-
-HELP: inspector-slots
-{ $var-description "If the inspector is running, this variable holds slot values for the object being inspected." }
-{ $see-also go } ;
-
-HELP: inspector-stack
-{ $var-description "If the inspector is running, this variable holds previously-inspected objects." }
-{ $see-also go up } ;
-
-HELP: me
-{ $description "If the inspector is running, outputs the object currently being inspected." } ;
-
-HELP: inspector
-{ $values { "obj" "an object" } }
-{ $description "Starts a new inspector and prints a brief help message. If an inspector is already running, this starts a nested inspector. An alternative word that reuses the current inspector instance is " { $link inspect } "." }
-{ $see-also go up me } ;
-
-HELP: inspect
-{ $values { "obj" "an object" } }
-{ $description "If an inspector is already running, displays the slots of the object in the current inspector. If an inspector is not running, starts a new inspector." }
-{ $see-also go up me } ;
-
-HELP: go
-{ $values { "n" "a non-negative integer" } }
-{ $description "Inspects the " { $snippet "n" } "th slot of the current object. Use " { $link up } " to return." } ;
-
-HELP: up
-{ $description "Returns to the previously-inspected object." } ;
diff --git a/core/tools/interpreter.factor b/core/tools/interpreter.factor
deleted file mode 100644 (file)
index 15a2586..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays errors generic io kernel kernel-internals math
-namespaces prettyprint sequences strings threads vectors words
-hashtables ;
-IN: interpreter
-
-! Metacircular interpreter for single-stepping
-SYMBOL: meta-interp
-
-! Meta-stacks;
-: meta-d meta-interp get continuation-data ;
-: push-d meta-d push ;
-: pop-d meta-d pop ;
-: peek-d meta-d peek ;
-
-: meta-r meta-interp get continuation-retain ;
-: push-r meta-r push ;
-: pop-r meta-r pop ;
-: peek-r meta-r peek ;
-
-: meta-c meta-interp get continuation-call ;
-: push-c meta-c push ;
-: pop-c meta-c pop ;
-: peek-c meta-c peek ;
-
-! Call frame
-SYMBOL: callframe
-SYMBOL: callframe-scan
-SYMBOL: callframe-end
-
-! Hook
-SYMBOL: break-hook
-
-: meta-callframe ( -- seq )
-    { callframe callframe-scan callframe-end } [ get ] map ;
-
-: (meta-call) ( quot -- )
-    dup callframe set
-    length callframe-end set
-    0 callframe-scan set ;
-
-! Callframe.
-
-: break ( -- )
-    continuation get-walker-hook
-    [ continue-with ] [ break-hook get call ] if* ;
-
-: remove-breaks \ break swap remove ;
-
-: up ( -- )
-    pop-c drop
-    pop-c pop-c cut [ remove-breaks ] 2apply
-    >r dup length callframe-scan set r> append
-    dup length callframe-end set callframe set ;
-
-: done-cf? ( -- ? ) callframe-scan get callframe-end get >= ;
-
-: done? ( -- ? ) done-cf? meta-c empty? and ;
-
-: reset-interpreter ( -- )
-    meta-interp off f (meta-call) ;
-
-: (save-callframe) ( -- )
-    callframe get push-c
-    callframe-scan get push-c
-    callframe-end get push-c ;
-
-: save-callframe ( -- )
-    done-cf? [ (save-callframe) ] unless ;
-
-: meta-call ( quot -- )
-    #! Note we do tail call optimization here.
-    save-callframe (meta-call) ;
-
-: restore-normally
-    clone meta-interp set
-    meta-c empty? [ f (meta-call) ] [ up ] if ;
-
-: restore-with
-    first2 restore-normally push-d
-    meta-d [ length 1- dup 1- ] keep exchange ;
-
-: restore-harness ( obj -- )
-    {
-        { [ dup continuation? ] [ restore-normally ] }
-        { [ dup not ] [ drop reset-interpreter ] }
-        { [ dup length 2 = ] [ restore-with ] }
-    } cond ;
-
-: <callframe> ( quot scan -- seq )
-    >r >quotation r> over length 3array >vector ;
-
-: <breakpoint> ( break quot scan -- callframe )
-    >r cut [ break ] swap 3append r> <callframe> ;
-
-: step-to ( n -- )
-    >r meta-c r>
-    callframe get callframe-scan get <breakpoint>
-    nappend
-    [ set-walker-hook meta-interp get (continue) ] callcc1
-    restore-harness ;
-
-! The interpreter loses object identity of the name and catch
-! stacks -- they are copied after each step -- so we execute
-! these atomically and don't allow stepping into these words
-{ >n n> >c c> rethrow continue continue-with continuation
-(continue) (continue-with) }
-[ t "no-meta-word" set-word-prop ] each
-
-\ call [ pop-d meta-call ] "meta-word" set-word-prop
-\ execute [ pop-d unit meta-call ] "meta-word" set-word-prop
-\ if [ pop-d pop-d pop-d [ nip ] [ drop ] if meta-call ] "meta-word" set-word-prop
-\ dispatch [ pop-d pop-d swap nth meta-call ] "meta-word" set-word-prop
-
-! Time travel
-SYMBOL: meta-history
-
-: save-interp ( -- )
-    meta-history get [
-        [
-            callframe [ ] change
-            callframe-scan [ ] change
-            callframe-end [ ] change
-            meta-interp [ clone ] change
-        ] make-hash swap push
-    ] when* ;
-
-: restore-interp ( ns -- )
-    { callframe callframe-scan callframe-end }
-    [ dup pick hash swap set ] each
-    meta-interp swap hash clone meta-interp set ;
-
-: advance ( -- ) callframe-scan inc ;
-
-: (next) callframe-scan get callframe get nth ;
-
-: next ( quot -- )
-    save-interp {
-        { [ done? ] [ drop [ ] (meta-call) ] }
-        { [ done-cf? ] [ drop up ] }
-        { [ >r (next) r> call ] [ ] }
-        { [ t ] [ callframe-scan get 1+ step-to ] }
-    } cond ; inline
-
-GENERIC: (step) ( obj -- ? )
-
-M: wrapper (step) advance wrapped push-d t ;
-
-M: object (step) advance push-d t ;
-
-M: word (step) drop f ;
-
-: step ( -- ) [ (step) ] next ;
-
-: (step-in) ( word -- ? )
-    dup "meta-word" word-prop [
-        advance call t
-    ] [
-        dup "no-meta-word" word-prop not over compound? and [
-            advance word-def meta-call t
-        ] [
-            drop f
-        ] if
-    ] ?if ;
-
-: step-in ( -- )
-    [ dup word? [ (step-in) ] [ (step) ] if ] next ;
-
-: step-out ( -- )
-    save-interp callframe-end get step-to ;
-
-: step-all ( -- )
-    save-callframe meta-interp get schedule-thread ;
-
-: step-back ( -- )
-    meta-history get dup empty?
-    [ drop ] [ pop restore-interp ] if ;
diff --git a/core/tools/load.factor b/core/tools/load.factor
deleted file mode 100644 (file)
index edd70d8..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-PROVIDE: core/tools
-{ +files+ {
-    "definitions.factor"
-    "completion.factor"
-    "memory.factor"
-    "inspector.factor"
-    "word-tools.factor"
-    "test.factor"
-    "modules.factor"
-    "image.factor"
-    "interpreter.factor"
-    "errors.factor"
-    "debugger.factor"
-    "image.facts"
-    "definitions.facts"
-    "word-tools.facts"
-    "inspector.facts"
-    "memory.facts"
-    "test.facts"
-    "modules.facts"
-    "image.facts"
-    "debugger.facts"
-} }
-{ +tests+ {
-    "test/annotate.factor"
-    "test/inspector.factor"
-    "test/interpreter.factor"
-    "test/memory.factor"
-    "test/tools.factor"
-} } ;
diff --git a/core/tools/memory.factor b/core/tools/memory.factor
deleted file mode 100644 (file)
index bb02192..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: memory
-USING: arrays errors generic hashtables io kernel
-kernel-internals math namespaces parser prettyprint sequences
-strings styles vectors words ;
-
-: full-gc ( -- ) generations 1- data-gc ;
-
-! Printing an overview of heap usage.
-
-: total/used/free, ( free total str -- )
-    [
-        ,
-        dup number>string ,
-        over - number>string ,
-        number>string ,
-    ] { } make , ;
-
-: total, ( n str -- )
-    [ , number>string , "" , "" , ] { } make , ;
-
-: simple-table ( table -- )
-    H{ { table-gap { 10 0 } } }
-    [ dup string? [ write ] [ pprint ] if ]
-    tabular-output ;
-
-: room. ( -- )
-    [
-        { "" "Total" "Used" "Free" } ,
-        data-room 2 group 0 [
-            "Generation " pick number>string append
-            >r first2 r> total/used/free, 1+
-        ] reduce drop
-        "Semi-space" total,
-        "Cards" total,
-        code-room "Code space" total/used/free,
-    ] { } make simple-table ;
-
-! Some words for iterating through the heap.
-
-: (each-object) ( quot -- )
-    next-object dup
-    [ swap [ call ] keep (each-object) ] [ 2drop ] if ; inline
-
-: each-object ( quot -- )
-    [ begin-scan [ (each-object) ] keep ]
-    [ end-scan ] cleanup drop ; inline
-
-: (instances) ( obj quot seq -- )
-    >r over >r call [ r> r> push ] [ r> r> 2drop ] if ; inline
-
-: instances ( quot -- seq )
-    10000 <vector> [
-        -rot [ (instances) ] 2keep
-    ] each-object nip ; inline
-
-: heap-stat-step ( counts sizes obj -- )
-    [ dup size swap class rot hash+ ] keep
-    1 swap class rot hash+ ;
-
-: heap-stats ( -- counts sizes )
-    #! Return a list of instance count/total size pairs.
-    H{ } clone H{ } clone
-    [ >r 2dup r> heap-stat-step ] each-object ;
-
-: heap-stats. ( -- )
-    heap-stats dup hash-keys natural-sort [
-        { "Class" "Bytes" "Instances" } ,
-        [
-            [ dup , dup pick hash , pick hash , ] { } make ,
-        ] each 2drop
-    ] { } make simple-table ;
diff --git a/core/tools/memory.facts b/core/tools/memory.facts
deleted file mode 100644 (file)
index e4f737d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-IN: memory
-USING: errors help test ;
-
-HELP: data-gc ( n -- )
-{ $values { "n" "a positive integer" } }
-{ $description "Collects all generations up to and including the " { $snippet "n" } "th generation. The nursery where new objects are allocated is generation 0, and tenured space is generation " { $snippet "g-1" } " where " { $snippet "g" } " is the value output by " { $link generations } "." } ;
-
-HELP: gc-time ( -- n )
-{ $values { "n" "a timestamp in milliseconds" } }
-{ $description "Outputs the total time spent in garbage collection during this Factor session." }
-{ $examples "This word is used by " { $link time } " to measure the time spent in garbage collection during the execution of a quotation." } ;
-
-HELP: data-room ( -- cards semi generations )
-{ $values { "cards" "number of bytes reserved for card marking" } { "semi" "number of bytes reserved for tenured semi-space" } { "generations" "array of free/total bytes pairs" } }
-{ $description "Queries the runtime for memory usage information. Use " { $link room. } " for a pretty memory usage display." }
-{ $see-also code-room } ;
-
-HELP: code-room ( -- code-free code-total )
-{ $values { "code-free" "bytes free in the code heap" } { "code-total" "total bytes in the code heap" } }
-{ $description "Queries the runtime for memory usage information. Use " { $link room. } " for a pretty memory usage display." }
-{ $see-also data-room } ;
-
-HELP: size ( obj -- n )
-{ $values { "obj" "an object" } { "n" "a size in bytes" } }
-{ $description "Outputs the size of the object in memory, in bytes. Tagged immediate objects such as fixnums and " { $link f } " will yield a size of 0." } ;
-
-HELP: full-gc
-{ $description "Performs a full garbage collection." } ;
-
-HELP: room.
-{ $description "Prints an overview of memory usage broken down by generation and zone." } ;
-
-HELP: begin-scan ( -- )
-{ $description "Moves all objects to tenured space, disables the garbage collector, and resets the heap scan pointer to point at the first object in the heap. The " { $link next-object } " word can then be called to advance the heap scan pointer and return successive objects."
-$terpri
-"This word must always be paired with a call to " { $link end-scan } "." }
-{ $notes "This is a low-level facility and can be dangerous. Use the " { $link each-object } " combinator instead." } ;
-
-HELP: next-object ( -- obj )
-{ $description "Outputs the object at the heap scan pointer, and then advances the heap scan pointer. If the end of the heap has been reached, outputs " { $link f } ". This is unambiguous since the " { $link f } " object is tagged immediate and not actually stored in the heap." }
-{ $errors "Throws a " { $link heap-scan-error. } " if called outside a " { $link begin-scan } "/" { $link end-scan } " pair." }
-{ $notes "This is a low-level facility and can be dangerous. Use the " { $link each-object } " combinator instead." } ;
-
-HELP: end-scan ( -- )
-{ $description "Finishes a heap iteration by re-enabling the garbage collector. This word must always be paired with a call to " { $link begin-scan } "." }
-{ $notes "This is a low-level facility and can be dangerous. Use the " { $link each-object } " combinator instead." } ;
-
-HELP: each-object
-{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
-{ $description "Applies a quotation to each object in the heap. The garbage collector is switched off while this combinator runs, so the given quotation must not allocate too much memory." }
-{ $notes "This word is the low-level facility used to implement the " { $link instances } " and " { $link heap-stats. } " words." } ;
-
-HELP: instances
-{ $values { "quot" "a quotation with stack effect " { $snippet "( obj -- ? )" } } { "seq" "a fresh sequence" } }
-{ $description "Outputs a sequence of all objects in the heap which satisfy the quotation." }
-{ $notes "This word relies on " { $link each-object } ", so in particular the garbage collector is switched off while it runs and the given quotation must not allocate too much memory." } ;
-
-HELP: heap-stats
-{ $values { "counts" "a hashtable mapping class words to integers" } { "sizes" "a hashtable mapping class words to integers" } }
-{ $description "Outputs a pair of hashtables, holding class instance counts and instance memory usage, respectively." } ;
-
-HELP: heap-stats.
-{ $description "For each class, prints the number of instances and total memory consumed by those instances." } ;
diff --git a/core/tools/modules.factor b/core/tools/modules.factor
deleted file mode 100644 (file)
index a8ad874..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: modules
-USING: hashtables io kernel namespaces parser sequences
-words strings arrays math help errors prettyprint-internals styles test definitions ;
-
-! For presentations
-TUPLE: module-link name ;
-
-M: module-link module-name module-link-name ;
-
-: module-tests* ( module -- seq )
-    dup module-name swap module-tests process-files ;
-
-: test-module ( name -- )
-    dup require
-    module module-tests* run-tests ;
-
-: test-modules ( -- )
-    modules get [ module-tests* ] map concat run-tests ;
-
-: run-module ( name -- )
-    dup require
-    dup module module-main [
-        assert-depth
-    ] [
-        "The module " write write
-        " does not define an entry point." print
-        "To define one, see the documentation for the " write
-        \ MAIN: ($link) " word." print
-    ] ?if ;
-
-: modules-help ( -- seq )
-    modules get [ module-help ] map [ ] subset ;
-
-M: module synopsis*
-    \ PROVIDE: pprint-word
-    [ module-name ] keep presented associate styled-text ;
-
-M: module definition module>alist t ;
-
-M: module where module-loc ;
-
-: module-dir? ( path -- ? )
-    "load.factor" path+ resource-path exists? ;
-
-: (available-modules) ( path -- )
-    dup resource-path directory [ path+ ] map-with
-    dup [ module-dir? ] subset %
-    [ (available-modules) ] each ;
-
-: small-modules ( path -- seq )
-    dup resource-path directory [ path+ ] map-with
-    [ ".factor" tail? ] subset
-    [ ".factor" ?tail drop ] map ;
-
-: available-modules ( -- seq )
-    [
-        "core" (available-modules)
-        "apps" (available-modules)
-        "apps" small-modules %
-        "libs" (available-modules)
-        "libs" small-modules %
-        "demos" (available-modules)
-        "demos" small-modules %
-    ] { } make natural-sort
-    [ dup module [ ] [ <module-link> ] ?if ] map ;
-
-: module-string ( obj -- str )
-    dup module-name swap module? [ " (loaded)" append ] when ;
-
-: modules. ( -- )
-    available-modules
-    [ [ module-string ] keep write-object terpri ] each ;
diff --git a/core/tools/modules.facts b/core/tools/modules.facts
deleted file mode 100644 (file)
index ea415bd..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: modules
-USING: help ;
-
-HELP: test-module
-{ $values { "name" "a module name string" } }
-{ $description "Runs the unit test files associated to the module by a previous call to " { $link provide } " or " { $link POSTPONE: PROVIDE: } "." } ;
-
-HELP: test-modules
-{ $description "Runs unit test files for all loaded modules." } ;
-
-HELP: run-module
-{ $values { "name" "a module name string" } }
-{ $description "Runs the main entry point of the module, first loading the module if necessary using " { $link require } ". Entry points can be defined with the " { $link POSTPONE: MAIN: } " word." } ;
-
-HELP: modules-help
-{ $values { "seq" "a new sequence" } }
-{ $description "Outputs a sequence of help articles which are the main entry points into the documentation of loaded modules. Modules can define documentation entry points with the " { $link +help+ } " key of the association list given in " { $link POSTPONE: PROVIDE: } "." } ;
diff --git a/core/tools/test.factor b/core/tools/test.factor
deleted file mode 100644 (file)
index 8a47cab..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: test
-USING: arrays errors hashtables tools io kernel math
-memory namespaces parser prettyprint sequences strings words
-vectors ;
-
-: print-test ( input output -- )
-    "----> Quotation: " write .
-    "Expected output: " write . flush ;
-
-: benchmark ( quot -- gctime runtime )
-    millis >r gc-time >r call gc-time r> - millis r> - ;
-
-: time ( quot -- )
-    benchmark
-    [ # " ms run / " % # " ms GC time" % ] "" make print flush ;
-
-: unit-test ( output input -- )
-    [
-        [
-            2dup print-test
-            swap >r >r clear r> call
-            datastack r> >vector assert=
-        ] keep-datastack 2drop
-    ] time ;
-
-: unit-test-fails ( quot -- )
-    [ f ] swap [ [ call t ] [ 2drop f ] recover ]
-    curry unit-test ;
-
-SYMBOL: failures
-
-: failure failures [ ?push ] change ;
-
-: test-handler ( name quot -- ? )
-    catch [ dup error. 2array failure f ] [ t ] if* ;
-
-: run-test ( path -- ? )
-    [
-        "=====> " write dup write "..." print flush
-        [
-            [ [ run-file ] with-scope ] keep
-        ] assert-depth drop
-    ] test-handler ;
-
-: prepare-tests ( -- )
-    failures off "temporary" forget-vocab ;
-
-: passed.
-    "Tests passed:" print . ;
-
-: failed.
-    "Tests failed:" print
-    failures get [
-        first2 swap write-pathname ": " write error.
-    ] each ;
-
-: run-tests ( seq -- )
-    prepare-tests [ run-test ] subset terpri passed. failed. ;
diff --git a/core/tools/test.facts b/core/tools/test.facts
deleted file mode 100644 (file)
index a99e503..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-IN: test
-USING: help kernel ;
-
-HELP: benchmark
-{ $values { "quot" "a quotation" } { "gctime" "an integer denoting milliseconds" } { "runtime" "an integer denoting milliseconds" } }
-{ $description "Runs a quotation, measuring the total wall clock time and the total time spent in the garbage collector." }
-{ $notes "A nicer word for interactive use is " { $link time } "." } ;
-
-HELP: time
-{ $values { "quot" "a quotation" } }
-{ $description "Runs a quotation and then prints the total run time and time spent in the garbage collector." }
-{ $examples
-    { $example "[ 1000000 0 [ + ] reduce drop ] time" "1116 ms run / 6 ms GC time" }
-} ;
-
-HELP: unit-test
-{ $values { "output" "a sequence of expected stack elements" } { "input" "a quotation run with an empty stack" } }
-{ $description "Runs a quotation with an empty stack, comparing the resulting stack with " { $snippet "output" } ". Elements are compared using " { $link = } ". Throws an error if the expected stack does not match the resulting stack." } ;
-
-HELP: unit-test-fails
-{ $values { "quot" "a quotation run with an empty stack" } }
-{ $description "Runs a quotation with an empty stack, expecting it to throw an error. If the quotation throws an error, this word returns normally. If the quotation does not throw an error, this word " { $emphasis "does" } " raise an error." }
-{ $notes "This word is used to test boundary conditions and fail-fast behavior." } ;
diff --git a/core/tools/test/annotate.factor b/core/tools/test/annotate.factor
deleted file mode 100644 (file)
index 02fbd65..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-IN: temporary
-USING: test words tools ;
-
-: foo ;
-\ foo watch
-
-[ ] [ foo ] unit-test
diff --git a/core/tools/test/inspector.factor b/core/tools/test/inspector.factor
deleted file mode 100644 (file)
index aaf96ef..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-IN: temporary
-USING: kernel tools math namespaces prettyprint test
-sequences ;
-
-[ 1 2 3 ] describe
-f describe
-\ + describe
-H{ } describe
-H{ } describe
diff --git a/core/tools/test/interpreter.factor b/core/tools/test/interpreter.factor
deleted file mode 100644 (file)
index 16416cf..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-IN: temporary
-USING: errors interpreter io kernel math math-internals
-namespaces prettyprint sequences test ;
-
-[ V{ [ "Hello world" print readln break + ] 1 5 } ]
-[ 3 [ "Hello world" print readln + ] 1 <breakpoint> ]
-unit-test
-
-: run ( -- ) done? [ step-in run ] unless ;
-
-: init-interpreter ( -- )
-    V{ } clone V{ } clone V{ } clone namestack catchstack
-    <continuation> meta-interp set ;
-
-: test-interpreter
-    init-interpreter (meta-call) run meta-d ;
-
-[ V{ } ] [
-    [ ] test-interpreter
-] unit-test
-
-[ V{ 1 } ] [
-    [ 1 ] test-interpreter
-] unit-test
-
-[ V{ 1 2 3 } ] [
-    [ 1 2 3 ] test-interpreter
-] unit-test
-
-[ V{ "Yo" 2 } ] [
-    [ 2 >r "Yo" r> ] test-interpreter
-] unit-test
-
-[ V{ 2 } ] [
-    [ t [ 2 ] [ "hi" ] if ] test-interpreter
-] unit-test
-
-[ V{ "hi" } ] [
-    [ f [ 2 ] [ "hi" ] if ] test-interpreter
-] unit-test
-
-[ V{ 4 } ] [
-    [ 2 2 fixnum+ ] test-interpreter
-] unit-test
-
-: foo 2 2 fixnum+ ;
-
-[ V{ 8 } ] [
-    [ foo 4 fixnum+ ] test-interpreter
-] unit-test
-
-[ V{ C{ 1 1.5 } { } C{ 1 1.5 } { } } ] [
-    [ C{ 1 1.5 } { } 2dup ] test-interpreter
-] unit-test
-
-[ V{ 3 4 1 2 } ] [
-    [ 1 2 3 4 2swap ] test-interpreter
-] unit-test
-
-[ V{ t } ] [
-    [ 5 5 number= ] test-interpreter
-] unit-test
-
-[ V{ f } ] [
-    [ 5 6 number= ] test-interpreter
-] unit-test
-
-[ V{ -1 } ] [
-    [ "XYZ" "XYZ" 3 (mismatch) ] test-interpreter
-] unit-test
-
-[ V{ t } ] [
-    [ "XYZ" "XYZ" sequence= ] test-interpreter
-] unit-test
-
-[ V{ t } ] [
-    [ "XYZ" "XYZ" = ] test-interpreter
-] unit-test
-
-[ V{ f } ] [
-    [ "XYZ" "XuZ" = ] test-interpreter
-] unit-test
-
-[ V{ 4 } ] [
-    [ 2 2 + ] test-interpreter
-] unit-test
-
-[ V{ } 2 ] [
-    2 "x" set [ [ 3 "x" set ] with-scope ] test-interpreter "x" get
-] unit-test
-
-[ V{ 3 } ] [
-    [ 3 "x" set "x" get ] test-interpreter
-] unit-test
-
-[ V{ "hi\n" } ] [
-    [ [ "hi" print ] string-out ] test-interpreter
-] unit-test
-
-[ V{ "4\n" } ] [
-    [ [ 2 2 + number>string print ] string-out ] test-interpreter
-] unit-test
-
-[ V{ 6 } ]
-[ [ [ 3 throw ] catch 2 * ] test-interpreter ] unit-test
-
-[ V{ 6 } ]
-[ [ [ 3 swap continue-with ] callcc1 2 * ] test-interpreter ] unit-test
-
-: meta-catch meta-interp get continuation-catch ;
-
-! Step back test
-[
-    init-interpreter
-    V{ } clone meta-history set
-
-    V{ f } clone
-    V{ } clone
-    V{ [ 1 2 3 ] 0 3 } clone
-    V{ } clone
-    V{ } clone
-    <continuation>
-    meta-catch push
-
-    [ ] [ [ 2 2 + throw ] (meta-call) ] unit-test
-
-    [ ] [ step ] unit-test
-
-    [ ] [ step ] unit-test
-    
-    [ V{ 2 2 } ] [ meta-d ] unit-test
-
-    [ ] [ step ] unit-test
-    
-    [ V{ 4 } ] [ meta-d ] unit-test
-    [ 3 ] [ callframe-scan get ] unit-test
-    
-    [ ] [ step-back ] unit-test
-    [ 2 ] [ callframe-scan get ] unit-test
-    
-    [ V{ 2 2 } ] [ meta-d ] unit-test
-    
-    [ ] [ step ] unit-test
-    
-    [ [ 1 2 3 ] ] [ meta-catch peek continuation-call first ] unit-test
-
-    [ ] [ step ] unit-test
-    
-    [ [ 1 2 3 ] ] [ callframe get ] unit-test
-    [ ] [ step-back ] unit-test
-    
-    [ V{ 4 } ] [ meta-d ] unit-test
-    
-    [ [ 1 2 3 ] ] [ meta-catch peek continuation-call first ] unit-test
-
-    [ ] [ step ] unit-test
-    
-    [ [ 1 2 3 ] ] [ callframe get ] unit-test
-
-] with-scope
diff --git a/core/tools/test/memory.factor b/core/tools/test/memory.factor
deleted file mode 100644 (file)
index 54bd154..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-IN: temporary
-USING: generic kernel kernel-internals math memory prettyprint
-sequences test words ;
-
-TUPLE: testing x y z ;
-
-[ ] [
-    num-types [
-        type>class [
-            "predicate" word-prop instances [
-                class drop
-            ] each
-        ] when*
-    ] each
-] unit-test
diff --git a/core/tools/test/tools.factor b/core/tools/test/tools.factor
deleted file mode 100644 (file)
index 428ca6b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-IN: temporary
-USING: tools completion words sequences test ;
-
-[ ] [ "" apropos ] unit-test
-[ ] [ "swp" apropos ] unit-test
-[ f ] [ "swp" all-words word-completions empty? ] unit-test
diff --git a/core/tools/word-tools.factor b/core/tools/word-tools.factor
deleted file mode 100644 (file)
index 4df47ea..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: tools
-USING: arrays definitions hashtables help tools io kernel
-math namespaces prettyprint sequences strings styles words
-generic completion ;
-
-: word-outliner ( seq -- )
-    natural-sort [
-        [ synopsis ] keep dup [ see ] curry
-        write-outliner terpri
-    ] each ;
-
-: method-usage ( word generic -- methods )
-    tuck methods
-    [ second flatten memq? ] subset-with
-    0 <column>
-    [ swap 2array ] map-with ;
-
-: usage. ( word -- )
-    dup usage dup
-    [ generic? not ] subset
-    "Words calling " write pick pprint ":" print
-    word-outliner
-    "Methods calling " write over pprint ":" print
-    [ generic? ] subset
-    [ method-usage word-outliner ] each-with ;
-
-: annotate ( word quot -- )
-    over >r >r dup word-def r> call r> swap define-compound ;
-    inline
-
-: watch-msg ( word prefix -- ) write word-name print .s flush ;
-
-: (watch) ( word def -- def )
-    [
-        swap literalize
-        dup , "===> Entering: " , \ watch-msg ,
-        swap %
-        , "===> Leaving:  " , \ watch-msg ,
-    ] [ ] make ;
-
-: watch ( word -- ) [ (watch) ] annotate ;
-
-: profile ( word -- )
-    [
-        swap [ global [ inc ] bind ] curry swap append
-    ] annotate ;
-
-: word-completions ( str words -- seq )
-    [ word-name ] swap completions ;
-
-: apropos ( str -- )
-    all-words word-completions [ summary print ] each ;
diff --git a/core/tools/word-tools.facts b/core/tools/word-tools.facts
deleted file mode 100644 (file)
index 43b3753..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-IN: tools
-USING: help words ;
-
-HELP: usage.
-{ $values { "word" "a word" } }
-{ $description "Prints an outliner listing all callers of a word. This may include the word itself, if it is recursive." }
-{ $examples { $code "\\ reverse usage." } }
-{ $see-also usage } ;
-
-HELP: apropos
-{ $values { "str" "a string" } }
-{ $description "Lists all words whose name contains a subsequence equal to " { $snippet "str" } ". Results are ranked using a simple distance algorithm." } ;
-
-HELP: annotate
-{ $values { "word" "a word" } { "quot" "a quotation with stack effect " { $snippet "( word def -- def )" } } }
-{ $description "Changes a word definition to the result of applying a quotation to the old definition." }
-{ $notes "This word is used to implement " { $link watch } " and " { $link profile } "." } ;
-
-HELP: watch
-{ $values { "word" "a word" } }
-{ $description "Changes a word definition so that a message together with the stack contents is output before and after the word runs." } ;
-
-HELP: profile
-{ $values { "word" "a word" } }
-{ $description "Changes a word definition so the variable named by the word in the global namespace is incremented every time the word is executed." } ;
diff --git a/core/tuples/authors.txt b/core/tuples/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/tuples/summary.txt b/core/tuples/summary.txt
new file mode 100644 (file)
index 0000000..4dbb643
--- /dev/null
@@ -0,0 +1 @@
+Object system implementation
diff --git a/core/tuples/tuples-docs.factor b/core/tuples/tuples-docs.factor
new file mode 100644 (file)
index 0000000..bb6f9e2
--- /dev/null
@@ -0,0 +1,212 @@
+USING: generic help.markup help.syntax kernel
+tuples.private classes slots quotations words arrays
+generic.standard sequences ;
+IN: tuples
+
+ARTICLE: "tuple-constructors" "Constructors and slots"
+"Tuples are created by calling one of a number of words:"
+{ $subsection construct-empty }
+{ $subsection construct-boa }
+{ $subsection construct }
+"By convention, construction logic is encapsulated in a word named after the tuple class surrounded in angle brackets; for example, the constructor word for a " { $snippet "point" } " class might be named " { $snippet "<point>" } "."
+$nl
+"A shortcut for defining BOA constructors:"
+{ $subsection POSTPONE: C: }
+"After construction, slots are read and written using various automatically-defined words with names of the form " { $snippet { $emphasis "class-slot" } } " and " { $snippet "set-" { $emphasis "class-slot" } } "." ;
+
+ARTICLE: "tuple-delegation" "Delegation"
+"If a generic word having the " { $link standard-combination } " method combination is called on a tuple for which it does not have an applicable method, the method call is forwarded to the tuple's " { $emphasis "delegate" } ". If no delegate is set, a " { $link no-method } " error is thrown."
+{ $subsection delegate }
+{ $subsection set-delegate }
+"A tuple's delegate should either be another tuple, or " { $link f } ", indicating no delegate is set. Delegation from a tuple to an object of some other type is not fully supported and should be used with caution."
+$nl
+"Factor uses delegation in place of implementation inheritance, but it is not a direct substitute; in particular, the semantics differ in that a delegated method call receives the delegate on the stack, not the original object."
+$nl
+"A pair of words examine delegation chains:"
+{ $subsection delegates }
+{ $subsection is? }
+"An example:"
+{ $example
+    "TUPLE: ellipse center radius ;"
+    "TUPLE: colored color ;"
+    "{ 0 0 } 10 <ellipse> \"my-ellipse\" set"
+    "{ 1 0 0 } <colored> \"my-shape\" set"
+    "\"my-ellipse\" get \"my-shape\" get set-delegate"
+    "\"my-shape\" get dup colored-color swap ellipse-center .s"
+    "{ 0 0 }\n{ 1 0 0 }"
+} ;
+
+ARTICLE: "tuple-introspection" "Tuple introspection"
+"In addition to the slot reader and writer words which " { $link POSTPONE: TUPLE: } " defines for every tuple class, it is possible to construct and take apart entire tuples in a generic way."
+{ $subsection >tuple }
+{ $subsection tuple>array }
+{ $subsection tuple-slots }
+"Tuple classes can also be defined at run time:"
+{ $subsection define-tuple-class } ;
+
+ARTICLE: "tuples" "Tuples"
+"Tuples are user-defined classes composed of named slots. A parsing word defines tuple classes:"
+{ $subsection POSTPONE: TUPLE: }
+"An example:"
+{ $code "TUPLE: person name address phone ;" }
+"This defines a class word named " { $snippet "person" } ", along with a predicate " { $snippet "person?" } ", and the following reader/writer words:"
+{ $table
+    { "Reader" "Writer" }
+    { { $snippet "person-name" }    { $snippet "set-person-name" }    }
+    { { $snippet "person-address" } { $snippet "set-person-address" } }
+    { { $snippet "person-phone" }   { $snippet "set-person-phone" }   }
+}
+"Initially, no specific words are defined for constructing new instances of the tuple. Constructors must be defined explicitly:"
+{ $subsection "tuple-constructors" }
+"Further topics:"
+{ $subsection "tuple-delegation" }
+{ $subsection "tuple-introspection" } ;
+
+ABOUT: "tuples"
+
+HELP: delegate
+{ $values { "obj" object } { "delegate" object } }
+{ $description "Returns an object's delegate, or " { $link f } " if no delegate is set." }
+{ $notes "A direct consequence of this behavior is that an object may not have a delegate of " { $link f } "." } ;
+
+HELP: set-delegate
+{ $values { "delegate" object } { "tuple" tuple } }
+{ $description "Sets a tuple's delegate. Method calls not handled by the tuple's class will now be passed on to the delegate." } ;
+
+HELP: tuple=
+{ $values { "tuple1" tuple } { "tuple2" tuple } { "?" "a boolean" } }
+{ $description "Low-level tuple equality test. User code should use " { $link = } " instead." }
+{ $warning "This word is in the " { $vocab-link "tuples.private" } " vocabulary because it does not do any type checking. Passing values which are not tuples can result in memory corruption." } ;
+
+HELP: tuple-class-eq?
+{ $values { "obj" object } { "class" tuple-class } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "obj" } " is an instance of " { $snippet "class" } "." } ;
+
+HELP: permutation
+{ $values { "seq1" sequence } { "seq2" sequence } { "permutation" "a sequence whose elements are integers or " { $link f } } }
+{ $description "Outputs a permutation for taking " { $snippet "seq1" } " to " { $snippet "seq2" } "." } ;
+
+HELP: reshape-tuple
+{ $values { "oldtuple" tuple } { "permutation" "a sequence whose elements are integers or " { $link f } } { "newtuple" tuple } }
+{ $description "Permutes the slots of a tuple. If a tuple class is redefined at runtime, this word is called on every instance to change its shape to conform to the new layout." } ;
+
+HELP: reshape-tuples
+{ $values { "class" tuple-class } { "newslots" "a sequence of strings" } }
+{ $description "Changes the shape of every instance of " { $snippet "class" } " for a new slot layout." } ;
+
+HELP: old-slots
+{ $values { "class" tuple-class } { "newslots" "a sequence of strings" } { "seq" "a sequence of strings" } }
+{ $description "Outputs the sequence of existing tuple slot names not in " { $snippet "newslots" } "." } ;
+
+HELP: forget-slots
+{ $values { "class" tuple-class } { "newslots" "a sequence of strings" } }
+{ $description "Forgets accessor words for existing tuple slots which are not in " { $snippet "newslots" } "." } ;
+
+HELP: tuple
+{ $class-description "The class of tuples. This class is further partitioned into disjoint subclasses; each tuple shape defined by " { $link POSTPONE: TUPLE: } " is a new class."
+$nl
+"Tuple classes have additional word properties:"
+{ $list
+    { { $snippet "\"constructor\"" } " - a word for creating instances of this tuple class" }
+    { { $snippet "\"predicate\"" } " - a quotation which tests if the top of the stack is an instance of this tuple class" }
+    { { $snippet "\"slots\"" } " - a sequence of " { $link slot-spec } " instances" }
+    { { $snippet "\"slot-names\"" } " - a sequence of strings naming the tuple's slots" }
+    { { $snippet "\"tuple-size\"" } " - the number of slots" }
+} } ;
+
+HELP: define-tuple-predicate
+{ $values { "class" tuple-class } }
+{ $description "Defines a predicate word that tests if the top of the stack is an instance of " { $snippet "class" } ". This will only work if " { $snippet "class" } " is a tuple class." }
+$low-level-note ;
+
+HELP: check-shape
+{ $values { "class" class } { "newslots" "a sequence of strings" } }
+{ $description "If the new slot layout differs from the existing one, updates all existing instances of this tuple class, and forgets any slot accessor words which are no longer needed."
+$nl
+"If the class is not a tuple class word, this word does nothing." }
+$low-level-note ;
+
+HELP: tuple-slots
+{ $values { "tuple" tuple } { "seq" sequence } }
+{ $description "Pushes a sequence of tuple slot values, not including the tuple class word and delegate." } ;
+
+{ tuple-slots tuple>array } related-words
+
+HELP: define-tuple-slots
+{ $values { "class" tuple-class } { "slots" "a sequence of strings" } }
+{ $description "Defines slot accessor and mutator words for the tuple." }
+$low-level-note ;
+
+HELP: check-tuple
+{ $values { "class" class } }
+{ $description "Throws a " { $link check-tuple } " error if " { $snippet "word" } " is not a tuple class word." }
+{ $error-description "Thrown if " { $link POSTPONE: C: } " is called with a word which does not name a tuple class." } ;
+
+HELP: define-tuple-class
+{ $values { "class" word } { "slots" "a sequence of strings" } }
+{ $description "Defines a tuple class with slots named by " { $snippet "slots" } "." } ;
+
+{ tuple-class define-tuple-class POSTPONE: TUPLE: } related-words
+
+HELP: delegates
+{ $values { "obj" object } { "seq" sequence } }
+{ $description "Outputs the delegation chain of an object. The first element of " { $snippet "seq" } " is " { $snippet "obj" } " itself. If " { $snippet "obj" } " is " { $link f } ", an empty sequence is output." } ;
+
+HELP: is?
+{ $values { "obj" object } { "quot" "a quotation with stack effect " { $snippet "( obj -- ? )" } } { "?" "a boolean" } }
+{ $description "Tests if the object or one of its delegates satisfies the predicate quotation."
+$nl
+"Class membership test predicates only test if an object is a direct instance of that class. Sometimes, you need to check delegates, since this gives a clearer picture of what operations the object supports." } ;
+
+HELP: >tuple
+{ $values { "seq" sequence } { "tuple" tuple } }
+{ $description "Creates a tuple with slot values taken from a sequence. The first element of the sequence must be a tuple class word, the second a delegate, and the remainder the declared slots."
+$nl
+"If the sequence has too many elements, they are ignored, and if it has too few, the remaining slots in the tuple are set to " { $link f } "." }
+{ $errors "Throws an error if the first element of the sequence is not a tuple class word." } ;
+
+HELP: tuple>array ( tuple -- array )
+{ $values { "tuple" tuple } { "array" array } }
+{ $description "Outputs an array having the tuple's slots as elements. The first element is the tuple class word and the second is the delegate; the remainder are declared slots." } ;
+
+HELP: <tuple> ( class n -- tuple )
+{ $values { "class" tuple-class } { "n" "a non-negative integer" } { "tuple" tuple } }
+{ $description "Low-level tuple constructor. User code should never call this directly, and instead use the constructor word which is defined for each tuple. See " { $link "tuples" } "." } ;
+
+HELP: construct-empty
+{ $values { "class" tuple-class } { "tuple" tuple } }
+{ $description "Creates a new instance of " { $snippet "class" } " with all slots initially set to " { $link f } "." }
+{ $examples
+    { $example
+        "TUPLE: employee number name department ;"
+        "employee construct-empty ."
+        "T{ employee f f f f }"
+    }
+} ;
+
+HELP: construct
+{ $values { "..." "slot values" } { "slots" "a sequence of setter words" } { "class" tuple-class } { "tuple" tuple } }
+{ $description "Creates a new instance of " { $snippet "class" } ", storing consecutive stack values into the slots of the new tuple using setter words in " { $snippet "slots" } ". The top-most stack element is stored in the right-most slot." }
+{ $examples
+    "We can define a class:"
+    { $code "TUPLE: color red green blue alpha ;" }
+    "Together with two constructors:"
+    { $code
+        ": <rgb> ( r g b -- color )"
+        "    { set-color-red set-color-green set-color-blue }"
+        "    color construct ;"
+        ""
+        ": <rgba> ( r g b a -- color )"
+        "    { set-color-red set-color-green set-color-blue set-color-alpha }"
+        "    color construct ;"
+    }
+    "The last definition is actually equivalent to the following:"
+    { $code ": <rgba> ( r g b a -- color ) rgba construct-boa ;" }
+    "Which can be abbreviated further:"
+    { $code "C: <rgba> color" }
+} ;
+
+HELP: construct-boa
+{ $values { "..." "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 " { $snippet "-boa" } " suffix is shorthand for ``by order of arguments'', and ``BOA constructor'' is a pun on ``boa constrictor''." } ;
diff --git a/core/tuples/tuples-tests.factor b/core/tuples/tuples-tests.factor
new file mode 100644 (file)
index 0000000..0ac6291
--- /dev/null
@@ -0,0 +1,257 @@
+USING: definitions generic kernel kernel.private math
+math.constants parser sequences tools.test words assocs
+namespaces quotations sequences.private classes continuations
+generic.standard effects tuples tuples.private arrays vectors
+strings ;
+IN: temporary
+
+[ t ] [ \ tuple-class \ class class< ] unit-test
+[ f ] [ \ class \ tuple-class class< ] unit-test
+
+TUPLE: rect x y w h ;
+: <rect> rect construct-boa ;
+
+: move ( x rect -- )
+    [ rect-x + ] keep set-rect-x ;
+
+[ f ] [ 10 20 30 40 <rect> dup clone 5 swap [ move ] keep = ] unit-test
+
+[ t ] [ 10 20 30 40 <rect> dup clone 0 swap [ move ] keep = ] unit-test
+
+GENERIC: delegation-test
+M: object delegation-test drop 3 ;
+TUPLE: quux-tuple ;
+: <quux-tuple> quux-tuple construct-empty ;
+M: quux-tuple delegation-test drop 4 ;
+TUPLE: quuux-tuple ;
+: <quuux-tuple> { set-delegate } quuux-tuple construct ;
+
+[ 3 ] [ <quux-tuple> <quuux-tuple> delegation-test ] unit-test
+
+GENERIC: delegation-test-2
+TUPLE: quux-tuple-2 ;
+: <quux-tuple-2> quux-tuple-2 construct-empty ;
+M: quux-tuple-2 delegation-test-2 drop 4 ;
+TUPLE: quuux-tuple-2 ;
+: <quuux-tuple-2> { set-delegate } quuux-tuple-2 construct ;
+
+[ 4 ] [ <quux-tuple-2> <quuux-tuple-2> delegation-test-2 ] unit-test
+
+! Make sure we handle changing shapes!
+TUPLE: point x y ;
+
+C: <point> point
+
+100 200 <point> "p" set
+
+! Use eval to sequence parsing explicitly
+"IN: temporary TUPLE: point x y z ; do-parse-hook" eval
+
+[ 100 ] [ "p" get point-x ] unit-test
+[ 200 ] [ "p" get point-y ] unit-test
+[ f ] [ "p" get "point-z" "temporary" lookup execute ] unit-test
+
+300 "p" get "set-point-z" "temporary" lookup execute
+
+"IN: temporary TUPLE: point z y ; do-parse-hook" eval
+
+[ "p" get point-x ] unit-test-fails
+[ 200 ] [ "p" get point-y ] unit-test
+[ 300 ] [ "p" get "point-z" "temporary" lookup execute ] unit-test
+
+TUPLE: predicate-test ;
+
+C: <predicate-test> predicate-test
+
+: predicate-test drop f ;
+
+[ t ] [ <predicate-test> predicate-test? ] unit-test
+
+PREDICATE: tuple silly-pred
+    class \ rect = ;
+
+GENERIC: area
+M: silly-pred area dup rect-w swap rect-h * ;
+
+TUPLE: circle radius ;
+M: circle area circle-radius sq pi * ;
+
+[ 200 ] [ T{ rect f 0 0 10 20 } area ] unit-test
+
+[ ] [ "IN: temporary  SYMBOL: #x  TUPLE: #x ;" eval ] unit-test
+
+! Hashcode breakage
+TUPLE: empty ;
+
+C: <empty> empty
+
+[ t ] [ <empty> hashcode fixnum? ] unit-test
+
+TUPLE: delegate-clone ;
+
+[ T{ delegate-clone T{ empty f } } ]
+[ T{ delegate-clone T{ empty f } } clone ] unit-test
+
+[ t ] [ \ null \ delegate-clone class< ] unit-test
+[ f ] [ \ object \ delegate-clone class< ] unit-test
+[ f ] [ \ object \ delegate-clone class< ] unit-test
+[ t ] [ \ delegate-clone \ tuple class< ] unit-test
+[ f ] [ \ tuple \ delegate-clone class< ] unit-test
+
+! Compiler regression
+[ t ] [ [ t length ] catch no-method-object ] unit-test
+
+[ "<constructor-test>" ]
+[ "TUPLE: constructor-test ; C: <constructor-test> constructor-test" eval word word-name ] unit-test
+
+TUPLE: size-test a b c d ;
+
+[ t ] [
+    T{ size-test } array-capacity
+    size-test tuple-size =
+] unit-test
+
+GENERIC: <yo-momma>
+
+TUPLE: yo-momma ;
+
+"IN: temporary C: <yo-momma> yo-momma" eval
+
+[ f ] [ \ <yo-momma> generic? ] unit-test
+
+! Test forget
+[ t ] [ \ yo-momma class? ] unit-test
+[ ] [ \ yo-momma forget ] unit-test
+[ f ] [ \ yo-momma typemap get values memq? ] unit-test
+
+[ f ] [ \ yo-momma interned? ] unit-test
+
+TUPLE: loc-recording ;
+
+[ f ] [ \ loc-recording where not ] unit-test
+
+! 'forget' wasn't robust enough
+
+TUPLE: forget-robustness ;
+
+GENERIC: forget-robustness-generic
+
+M: forget-robustness forget-robustness-generic ;
+
+M: integer forget-robustness-generic ;
+
+[ ] [ \ forget-robustness-generic forget ] unit-test
+[ ] [ \ forget-robustness forget ] unit-test
+[ ] [ { forget-robustness forget-robustness-generic } forget ] unit-test
+
+! rapido found this one
+GENERIC# m1 0 ( s n -- n )
+GENERIC# m2 1 ( s n -- v )
+
+TUPLE: t1 ;
+
+M: t1 m1 drop ;
+M: t1 m2 nip ;
+
+TUPLE: t2 ;
+
+M: t2 m1 drop ;
+M: t2 m2 nip ;
+
+TUPLE: t3 ;
+
+M: t3 m1 drop ;
+M: t3 m2 nip ;
+
+TUPLE: t4 ;
+
+M: t4 m1 drop ;
+M: t4 m2 nip ;
+
+C: <t4> t4
+
+[ 1 ] [ 1 <t4> m1 ] unit-test
+[ 1 ] [ <t4> 1 m2 ] unit-test
+
+! another combination issue
+GENERIC: silly
+
+UNION: my-union slice repetition column array vector reversed ;
+
+M: my-union silly "x" ;
+
+M: array silly "y" ;
+
+M: column silly "fdsfds" ;
+
+M: repetition silly "zzz" ;
+
+M: reversed silly "zz" ;
+
+M: slice silly "tt" ;
+
+M: string silly "t" ;
+
+M: vector silly "z" ;
+
+[ "zz" ] [ 123 <reversed> silly nip ] unit-test
+
+! Typo
+SYMBOL: not-a-tuple-class
+
+[
+    "IN: temporary C: <not-a-tuple-class> not-a-tuple-class"
+    eval
+] unit-test-fails
+
+[ t ] [
+    "not-a-tuple-class" "temporary" lookup symbol?
+] unit-test
+
+! Missing check
+[ not-a-tuple-class construct-boa ] unit-test-fails
+[ not-a-tuple-class construct-empty ] unit-test-fails
+
+! Reshaping bug. It's only an issue when optimizer compiler is
+! enabled.
+parse-hook get [
+    TUPLE: erg's-reshape-problem a b c ;
+
+    C: <erg's-reshape-problem> erg's-reshape-problem
+
+    [ ] [
+        "IN: temporary TUPLE: erg's-reshape-problem a b c d ;" eval
+    ] unit-test
+
+
+    [ 1 2 ] [
+        ! <erg's-reshape-problem> hasn't been recompiled yet, so
+        ! we just created a tuple using an obsolete layout
+        1 2 3 <erg's-reshape-problem>
+
+        ! that's ok, but... this shouldn't fail:
+        "IN: temporary TUPLE: erg's-reshape-problem a b d c ;" eval
+
+        { erg's-reshape-problem-a erg's-reshape-problem-b }
+        get-slots
+    ] unit-test
+] when
+
+! We want to make sure constructors are recompiled when
+! tuples are reshaped
+: cons-test-1 \ erg's-reshape-problem construct-empty ;
+: cons-test-2 \ erg's-reshape-problem construct-boa ;
+: cons-test-3
+    { erg's-reshape-problem-a }
+    \ erg's-reshape-problem construct ;
+
+"IN: temporary TUPLE: erg's-reshape-problem a b c d e f ;" eval
+
+[ t ] [
+    {
+        <erg's-reshape-problem>
+        cons-test-1
+        cons-test-2
+        cons-test-3
+    } [ changed-words get key? ] all?
+] unit-test
diff --git a/core/tuples/tuples.factor b/core/tuples/tuples.factor
new file mode 100644 (file)
index 0000000..eb3f6fc
--- /dev/null
@@ -0,0 +1,145 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions hashtables kernel
+kernel.private math namespaces sequences sequences.private
+strings vectors words quotations memory combinators generic
+classes classes.private slots slots.private ;
+IN: tuples
+
+M: tuple delegate 3 slot ;
+
+M: tuple set-delegate 3 set-slot ;
+
+M: tuple class class-of-tuple ;
+
+<PRIVATE
+
+: tuple= ( tuple1 tuple2 -- ? )
+    over array-capacity over array-capacity dup -rot number= [
+        -rot
+        [ >r over r> array-nth >r array-nth r> = ] 2curry
+        all-integers?
+    ] [
+        3drop f
+    ] if ;
+
+: tuple-class-eq? ( obj class -- ? )
+    over tuple? [ swap 2 slot eq? ] [ 2drop f ] if ; inline
+
+: permutation ( seq1 seq2 -- permutation )
+    swap [ index ] curry map ;
+
+: reshape-tuple ( oldtuple permutation -- newtuple )
+    >r tuple>array 2 swap cut r>
+    [ [ swap ?nth ] [ drop f ] if* ] curry* map
+    append (>tuple) ;
+
+: reshape-tuples ( class newslots -- )
+    >r dup [ swap class eq? ] curry instances dup
+    rot "slot-names" word-prop r> permutation
+    [ reshape-tuple ] curry map become ;
+
+: old-slots ( class newslots -- seq )
+    swap "slots" word-prop 1 tail-slice
+    [ slot-spec-name swap member? not ] curry* subset ;
+
+: forget-slots ( class newslots -- )
+    dupd old-slots [
+        2dup
+        slot-spec-reader 2array forget
+        slot-spec-writer 2array forget
+    ] curry* each ;
+
+: check-shape ( class newslots -- )
+    over tuple-class? [
+        over "slot-names" word-prop over = [
+            2dup forget-slots
+            2dup reshape-tuples
+            over redefined
+        ] unless
+    ] when 2drop ;
+
+GENERIC: tuple-size ( class -- size ) foldable
+
+M: tuple-class tuple-size "slot-names" word-prop length 2 + ;
+
+PRIVATE>
+
+: define-tuple-predicate ( class -- )
+    dup predicate-word
+    over [ tuple-class-eq? ] curry
+    define-predicate ;
+
+: delegate-slot-spec
+    T{ slot-spec f
+        object
+        "delegate"
+        3
+        delegate
+        set-delegate
+    } ;
+
+: define-tuple-slots ( class slots -- )
+    2dup "slot-names" set-word-prop
+    dupd 4 simple-slots
+    2dup delegate-slot-spec add* "slots" set-word-prop
+    define-slots ;
+
+TUPLE: check-tuple class ;
+
+: check-tuple ( class -- )
+    dup tuple-class?
+    [ drop ] [ \ check-tuple construct-boa throw ] if ;
+
+: define-tuple-class ( class slots -- )
+    2dup check-shape
+    over f tuple tuple-class define-class
+    over define-tuple-predicate
+    define-tuple-slots ;
+
+M: tuple clone
+    (clone) dup delegate clone over set-delegate ;
+
+M: tuple equal?
+    over tuple? [ tuple= ] [ 2drop f ] if ;
+
+: (delegates) ( obj -- )
+    [ dup , delegate (delegates) ] when* ;
+
+: delegates ( obj -- seq ) [ (delegates) ] { } make ;
+
+: is? ( obj quot -- ? ) >r delegates r> contains? ; inline
+
+: >tuple ( seq -- tuple )
+    >vector dup first tuple-size over set-length
+    >array (>tuple) ;
+
+M: tuple hashcode*
+    [
+        dup array-capacity -rot 0 -rot [
+            swapd array-nth hashcode* bitxor
+        ] 2curry reduce
+    ] recursive-hashcode ;
+
+: tuple-slots ( tuple -- seq ) tuple>array 2 tail ;
+
+! Definition protocol
+M: tuple-class reset-class
+    {
+        "metaclass" "superclass" "slot-names" "slots"
+    } reset-props ;
+
+M: object get-slots ( obj slots -- ... )
+    [ execute ] curry* each ;
+
+M: object set-slots ( ... obj slots -- )
+    <reversed> get-slots ;
+
+M: object construct-empty ( class -- tuple )
+    dup tuple-size <tuple> ;
+
+M: object construct ( ... slots class -- tuple )
+    construct-empty [ swap set-slots ] keep ;
+
+M: object construct-boa ( ... class -- tuple )
+    dup tuple-size <tuple-boa> ;
diff --git a/core/ui/backend.factor b/core/ui/backend.factor
deleted file mode 100644 (file)
index 57aaaf8..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: generic kernel namespaces opengl ;
-
-DEFER: set-title ( string world -- )
-
-DEFER: draw-world ! defined in world.factor
-
-DEFER: open-window* ( world title -- )
-
-DEFER: raise-window ( world -- )
-
-DEFER: select-gl-context ( handle -- )
-
-DEFER: flush-gl-context ( handle -- )
-
-DEFER: user-input ( string gadget -- )
-
-: with-gl-context ( handle quot -- )
-    swap [ select-gl-context call ] keep
-    glFlush flush-gl-context gl-error ; inline
-
-! Two text transfer buffers
-TUPLE: clipboard contents ;
-C: clipboard "" over set-clipboard-contents ;
-
-GENERIC: paste-clipboard ( gadget clipboard -- )
-
-M: object paste-clipboard
-    clipboard-contents dup [ swap user-input ] [ 2drop ] if ;
-
-GENERIC: copy-clipboard ( string gadget clipboard -- )
-
-M: object copy-clipboard nip set-clipboard-contents ;
-
-SYMBOL: clipboard
-SYMBOL: selection
-
-<clipboard> clipboard set-global
-<clipboard> selection set-global
diff --git a/core/ui/backend.facts b/core/ui/backend.facts
deleted file mode 100644 (file)
index 4f1c172..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-IN: gadgets
-USING: help strings ;
-
-HELP: set-title
-{ $values { "string" string } { "world" world } }
-{ $description "Sets the title bar of the native window containing the world." }
-{ $notes "This word should not be called directly by user code. Instead, change the " { $link world-title } " model; see " { $link "models" } "." } ;
-
-HELP: open-window*
-{ $values { "world" world } { "title" string } }
-{ $description "Opens a native window containing the given world. This grafts the world by calling " { $link graft } ". Each world can only be displayed in one top-level window at a time." }
-{ $notes "This word should not be called directly by user code. Instead, use " { $link open-window } " or " { $link open-titled-window } "." } ;
-
-HELP: raise-window
-{ $values { "world" world } }
-{ $description "Makes the native window containing the given world the front-most window." }
-{ $notes "To raise the window containing a specific gadget, use " { $link find-world } " to find the world containing the gadget first." } ;
-
-HELP: select-gl-context
-{ $values { "handle" "a backend-specific handle" } }
-{ $description "Selects an OpenGL context to be the implicit destination for subsequent GL rendering calls. This word is called automatically by the UI before drawing a " { $link world } "." } ;
-
-HELP: flush-gl-context
-{ $values { "handle" "a backend-specific handle" } }
-{ $description "Ensures all GL rendering calls made to an OpenGL context finish rendering to the screen. This word is called automatically by the UI after drawing a " { $link world } "." } ;
-
-HELP: clipboard
-{ $class-description "A mutable container for a single string implementing the " { $link "clipboard-protocol" } "." } ;
-
-HELP: paste-clipboard
-{ $values { "gadget" gadget } { "clipboard" "an object" } }
-{ $contract "Arranges for the contents of the clipboard to be inserted into the gadget at some point in the near future via a call to " { $link user-input } ". The gadget must be a child of a grafted " { $link world } "." } ;
-
-HELP: copy-clipboard
-{ $values { "string" string } { "gadget" gadget } { "clipboard" "an object" } }
-{ $contract "Arranges for the string to be copied to the clipboard on behalf of the gadget. The gadget must be a child of a grafted " { $link world } "." } ;
-
-HELP: clipboard
-{ $var-description "Global variable holding the system clipboard. By convention, text should only be copied to the clipboard via an explicit user action, for example by pressing " { $snippet "C+c" } "." } ;
-
-HELP: selection
-{ $var-description "Global variable holding the system selection. By convention, text should be copied to the selection as soon as it is selected by the user." } ;
diff --git a/core/ui/cocoa/application-utils.factor b/core/ui/cocoa/application-utils.factor
deleted file mode 100644 (file)
index efed2c7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: cocoa
-USING: alien errors gadgets io kernel namespaces objc
-objc-classes sequences threads ;
-
-: NSApplicationDelegateReplySuccess 0 ;
-: NSApplicationDelegateReplyCancel  1 ;
-: NSApplicationDelegateReplyFailure 2 ;
-
-: with-autorelease-pool ( quot -- )
-    NSAutoreleasePool -> new slip -> release ; inline
-
-: NSApp NSApplication -> sharedApplication ;
-
-: with-cocoa ( quot -- )
-    [ NSApp drop call ] with-autorelease-pool ;
-
-: <NSString> ( str -- alien ) <CFString> -> autorelease ;
-
-: <NSArray> ( seq -- alien ) <CFArray> -> autorelease ;
-
-: CFRunLoopDefaultMode "kCFRunLoopDefaultMode" <NSString> ;
-
-: next-event ( app -- event )
-    0 f CFRunLoopDefaultMode 1
-    -> nextEventMatchingMask:untilDate:inMode:dequeue: ;
-
-: do-event ( app -- ? )
-    [
-        dup next-event [ -> sendEvent: t ] [ drop f ] if*
-    ] with-autorelease-pool ;
-
-: do-events ( app -- )
-    dup do-event [ do-events ] [ drop ] if ;
-
-: event-loop ( -- )
-    [ [ NSApp do-events ui-step ] ui-try ] with-autorelease-pool
-    event-loop ;
-
-: add-observer ( observer selector name object -- )
-    >r >r >r >r NSNotificationCenter -> defaultCenter
-    r> r> sel_registerName
-    r> r> -> addObserver:selector:name:object: ;
-
-: remove-observer ( observer -- )
-    >r NSNotificationCenter -> defaultCenter r>
-    -> removeObserver: ;
-
-: finish-launching ( -- ) NSApp -> finishLaunching ;
-
-: install-delegate ( receiver delegate -- )
-    -> alloc -> init -> setDelegate: ;
-
-IN: errors
-
-: objc-error. ( error -- )
-    "Objective C exception:" print
-    third -> reason CF>string print ;
diff --git a/core/ui/cocoa/core-foundation.factor b/core/ui/cocoa/core-foundation.factor
deleted file mode 100644 (file)
index 08ca9bb..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: cocoa
-USING: alien arrays errors hashtables kernel math memory
-namespaces sequences ;
-
-TYPEDEF: int CFIndex
-
-FUNCTION: void* CFArrayCreateMutable ( void* allocator, CFIndex capacity, void* callbacks ) ;
-
-FUNCTION: void* CFArrayGetValueAtIndex ( void* array, CFIndex idx ) ;
-
-FUNCTION: void CFArraySetValueAtIndex ( void* array, CFIndex index, void* value ) ;
-
-FUNCTION: CFIndex CFArrayGetCount ( void* array ) ;
-
-: kCFURLPOSIXPathStyle 0 ;
-
-FUNCTION: void* CFURLCreateWithFileSystemPath ( void* allocator, void* filePath, int pathStyle, bool isDirectory ) ;
-
-FUNCTION: void* CFURLCreateWithString ( void* allocator, void* string, void* base ) ;
-
-FUNCTION: void* CFURLCopyFileSystemPath ( void* url, int pathStyle ) ;
-
-FUNCTION: void* CFStringCreateWithCharacters ( void* allocator, ushort* cStr, CFIndex numChars ) ;
-
-FUNCTION: CFIndex CFStringGetLength ( void* theString ) ;
-
-FUNCTION: void CFStringGetCharacters ( void* theString, CFIndex start, CFIndex length, void* buffer ) ;
-
-FUNCTION: CFIndex CFStringGetLength ( void* string ) ;
-
-FUNCTION: void* CFBundleCreate ( void* allocator, void* bundleURL ) ;
-
-FUNCTION: bool CFBundleLoadExecutable ( void* bundle ) ;
-
-FUNCTION: void CFRelease ( void* cf ) ;
-
-: CF>array ( alien -- array )
-    dup CFArrayGetCount [ CFArrayGetValueAtIndex ] map-with ;
-
-: <CFArray> ( seq -- array )
-    [ f swap length f CFArrayCreateMutable ] keep
-    [ length ] keep
-    [ >r dupd r> CFArraySetValueAtIndex ] 2each ;
-
-: <CFString> ( string -- cf )
-    f swap dup length CFStringCreateWithCharacters ;
-
-: CF>string ( string -- string )
-    dup CFStringGetLength 1+ "ushort" <c-array> [
-        >r 0 over CFStringGetLength r> CFStringGetCharacters
-    ] keep alien>u16-string ;
-
-: CF>string-array ( alien -- seq )
-    CF>array [ CF>string ] map ;
-
-: <CFFileSystemURL> ( string dir? -- cf )
-    >r <CFString> f over kCFURLPOSIXPathStyle
-    r> CFURLCreateWithFileSystemPath swap CFRelease ;
-
-: <CFURL> ( string -- cf )
-    <CFString>
-    [ f swap f CFURLCreateWithString ] keep
-    CFRelease ;
-
-: <CFBundle> ( string -- cf )
-    t <CFFileSystemURL> [
-        f swap CFBundleCreate
-    ] keep CFRelease ;
-
-: load-framework ( name -- )
-    dup <CFBundle> [
-        CFBundleLoadExecutable drop
-    ] [
-        "Cannot load bundled named " swap append throw
-    ] ?if ;
diff --git a/core/ui/cocoa/dialogs.factor b/core/ui/cocoa/dialogs.factor
deleted file mode 100644 (file)
index e14212d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: cocoa
-USING: kernel objc objc-classes sequences ;
-
-: <NSOpenPanel> ( -- panel )
-    NSOpenPanel -> openPanel
-    dup 1 -> setCanChooseFiles:
-    dup 0 -> setCanChooseDirectories:
-    dup 1 -> setResolvesAliases:
-    dup 1 -> setAllowsMultipleSelection: ;
-
-: <NSSavePanel> ( -- panel )
-    NSSavePanel -> savePanel
-    dup 1 -> setCanChooseFiles:
-    dup 0 -> setCanChooseDirectories:
-    dup 0 -> setAllowsMultipleSelection: ;
-
-: NSOKButton 1 ;
-: NSCancelButton 0 ;
-
-: run-panel ( panel -- paths ) ;
-
-: open-panel ( -- paths )
-    <NSOpenPanel>
-    dup -> runModal NSOKButton =
-    [ -> filenames CF>string-array ] [ drop f ] if ;
-
-: split-path ( path -- dir file )
-    <reversed> "/" split1 [ reverse <NSString> ] 2apply swap ;
-
-: save-panel ( path -- paths )
-    <NSSavePanel> dup
-    rot split-path -> runModalForDirectory:file: NSOKButton =
-    [ -> filename CF>string ] [ drop f ] if ;
diff --git a/core/ui/cocoa/init-cocoa.factor b/core/ui/cocoa/init-cocoa.factor
deleted file mode 100644 (file)
index 1484ea0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-USING: cocoa compiler io kernel objc sequences words ;
-
-"Compiling Objective C bridge..." print
-
-{ "cocoa" "objc" } compile-vocabs
-
-"Importing Cocoa classes..." print
-{
-    "NSApplication"
-    "NSAutoreleasePool"
-    "NSBundle"
-    "NSError"
-    "NSEvent"
-    "NSException"
-    "NSMenu"
-    "NSMenuItem"
-    "NSNotification"
-    "NSNotificationCenter"
-    "NSObject"
-    "NSOpenGLContext"
-    "NSOpenGLView"
-    "NSOpenPanel"
-    "NSPasteboard"
-    "NSSavePanel"
-    "NSView"
-    "NSWindow"
-} [
-    f import-objc-class
-] each
diff --git a/core/ui/cocoa/load.factor b/core/ui/cocoa/load.factor
deleted file mode 100644 (file)
index d41b523..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-USING: compiler io parser sequences words ;
-
-REQUIRES: core/compiler/alien/objc core/ui/tools ;
-
-PROVIDE: core/ui/cocoa
-{ +files+ { 
-    "core-foundation.factor"
-    "types.factor"
-    "init-cocoa.factor"
-    "application-utils.factor"
-    "pasteboard-utils.factor"
-    "view-utils.factor"
-    "window-utils.factor"
-    "dialogs.factor"
-    "services.factor"
-    "ui.factor"
-} }
-{ +tests+ {
-    "test/cocoa.factor"
-} } ;
-
-"Compiling Cocoa bindings..." print
-{ "cocoa" "objc" "objc-classes" "gadgets" } compile-vocabs
diff --git a/core/ui/cocoa/pasteboard-utils.factor b/core/ui/cocoa/pasteboard-utils.factor
deleted file mode 100644 (file)
index e0d0601..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: cocoa
-USING: arrays gadgets kernel namespaces objc objc-classes
-sequences ;
-
-: NSStringPboardType "NSStringPboardType" ;
-
-: pasteboard-string? ( id -- ? )
-    NSStringPboardType swap -> types CF>string-array member? ;
-
-: pasteboard-string ( id -- str )
-    NSStringPboardType <NSString> -> stringForType:
-    dup [ CF>string ] when ;
-
-: set-pasteboard-types ( seq id -- )
-    swap <NSArray> f -> declareTypes:owner: drop ;
-
-: set-pasteboard-string ( str id -- )
-    NSStringPboardType <NSString>
-    dup 1array pick set-pasteboard-types
-    >r swap <NSString> r> -> setString:forType: drop ;
-
-TUPLE: pasteboard handle ;
-
-M: pasteboard clipboard-contents
-    pasteboard-handle pasteboard-string ;
-
-M: pasteboard set-clipboard-contents
-    pasteboard-handle set-pasteboard-string ;
-
-: init-clipboard ( -- )
-    NSPasteboard -> generalPasteboard <pasteboard>
-    clipboard set-global ;
diff --git a/core/ui/cocoa/services.factor b/core/ui/cocoa/services.factor
deleted file mode 100644 (file)
index d7dcbf6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc-classes
-DEFER: FactorServiceProvider
-
-IN: cocoa
-USING: alien io kernel namespaces objc
-parser prettyprint styles gadgets-listener gadgets-workspace ;
-
-: pasteboard-error ( error -- f )
-    "Pasteboard does not hold a string" <NSString>
-    0 swap rot set-void*-nth f ;
-
-: ?pasteboard-string ( pboard error -- str/f )
-    over pasteboard-string? [
-        swap pasteboard-string [ ] [ pasteboard-error ] ?if
-    ] [
-        nip pasteboard-error
-    ] if ;
-
-: do-service ( pboard error quot -- )
-    pick >r >r
-    ?pasteboard-string dup [ r> call ] [ r> 2drop f ] if
-    dup [ r> set-pasteboard-string ] [ r> 2drop ] if ;
-
-"NSObject" "FactorServiceProvider" {
-    {
-        "evalInListener:userData:error:" "void"
-        { "id" "SEL" "id" "id" "void*" }
-        [ nip [ eval-listener f ] do-service 2drop ]
-    }
-    {
-        "evalToString:userData:error:" "void"
-        { "id" "SEL" "id" "id" "void*" }
-        [ nip [ eval>string ] do-service 2drop ]
-    }
-} define-objc-class
-
-: register-services ( -- )
-    NSApp
-    FactorServiceProvider -> alloc -> init
-    -> setServicesProvider: ;
-
-FUNCTION: void NSUpdateDynamicServices ;
diff --git a/core/ui/cocoa/test/cocoa.factor b/core/ui/cocoa/test/cocoa.factor
deleted file mode 100644 (file)
index a169496..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-IN: objc-classes
-DEFER: Foo
-DEFER: Bar
-
-IN: temporary
-USING: cocoa compiler kernel objc namespaces objc-classes test memory ;
-
-"NSObject" "Foo"
-{ { "foo:" "void" { "id" "SEL" "NSRect" } [ full-gc "x" set 2drop ] } }
-define-objc-class
-
-: test-foo
-    Foo -> alloc -> init
-    dup 1.0 2.0 101.0 102.0 <NSRect> -> foo:
-    -> release ;
-
-test-foo
-
-[ 1 ] [ "x" get NSRect-x ] unit-test
-[ 2 ] [ "x" get NSRect-y ] unit-test
-[ 101 ] [ "x" get NSRect-w ] unit-test
-[ 102 ] [ "x" get NSRect-h ] unit-test
-
-"NSObject" "Bar"
-{ { "bar" "NSRect" { "id" "SEL" } [ 2drop test-foo "x" get ] } }
-define-objc-class
-
-Bar [
-    -> alloc -> init
-    dup -> bar "x" set
-    -> release
-] compile-1
-
-[ 1 ] [ "x" get NSRect-x ] unit-test
-[ 2 ] [ "x" get NSRect-y ] unit-test
-[ 101 ] [ "x" get NSRect-w ] unit-test
-[ 102 ] [ "x" get NSRect-h ] unit-test
diff --git a/core/ui/cocoa/types.factor b/core/ui/cocoa/types.factor
deleted file mode 100644 (file)
index d855044..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: cocoa
-USING: alien gadgets kernel math sequences ;
-
-BEGIN-STRUCT: NSRect
-    FIELD: float x
-    FIELD: float y
-    FIELD: float w
-    FIELD: float h
-END-STRUCT
-
-TYPEDEF: NSRect _NSRect
-TYPEDEF: NSRect CGRect
-
-: <NSRect>
-    "NSRect" <c-object>
-    [ set-NSRect-h ] keep
-    [ set-NSRect-w ] keep
-    [ set-NSRect-y ] keep
-    [ set-NSRect-x ] keep ;
-
-: NSRect-x-y ( alien -- origin-x origin-y )
-    [ NSRect-x ] keep NSRect-y ;
-
-: NSRect-x-far-y ( alien -- origin-x far-y )
-    [ NSRect-x-y ] keep NSRect-h + ;
-  
-: <far-y-NSRect> ( x y w h -- alien )
-    tuck >r >r - r> r> <NSRect> ;
-
-BEGIN-STRUCT: NSPoint
-    FIELD: float x
-    FIELD: float y
-END-STRUCT
-
-TYPEDEF: NSPoint _NSPoint
-TYPEDEF: NSPoint CGPoint
-
-: <NSPoint>
-    "NSPoint" <c-object>
-    [ set-NSPoint-y ] keep
-    [ set-NSPoint-x ] keep ;
-
-BEGIN-STRUCT: NSSize
-    FIELD: float w
-    FIELD: float h
-END-STRUCT
-
-TYPEDEF: NSSize _NSSize
-TYPEDEF: NSPoint CGPoint
-
-: <NSSize>
-    "NSSize" <c-object>
-    [ set-NSSize-h ] keep
-    [ set-NSSize-w ] keep ;
diff --git a/core/ui/cocoa/ui.factor b/core/ui/cocoa/ui.factor
deleted file mode 100644 (file)
index 8f2a443..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc-classes
-DEFER: FactorApplicationDelegate
-
-IN: cocoa
-USING: arrays gadgets gadgets-listener gadgets-help
-gadgets-workspace hashtables kernel memory namespaces objc
-sequences errors freetype help timers ;
-
-: finder-run-files ( alien -- )
-    #! We filter out the image name since that might be there on
-    #! first launch.
-    CF>string-array [ image = not ] subset listener-run-files
-    NSApp NSApplicationDelegateReplySuccess
-    -> replyToOpenOrPrint: ;
-
-: menu-run-files ( -- )
-    open-panel [ listener-run-files ] when* ;
-
-: menu-save-image ( -- )
-    image save-panel [ save-image ] when* ;
-
-! Handle Open events from the Finder
-"NSObject" "FactorApplicationDelegate" {
-    { "application:openFiles:" "void" { "id" "SEL" "id" "id" }
-        [ >r 3drop r> finder-run-files ]
-    }
-
-    { "newFactorWorkspace:" "id" { "id" "SEL" "id" }
-        [ 3drop workspace-window f ]
-    }
-
-    { "runFactorFile:" "id" { "id" "SEL" "id" }
-        [ 3drop menu-run-files f ]
-    }
-
-    { "saveFactorImage:" "id" { "id" "SEL" "id" }
-        [ 3drop save f ]
-    }
-
-    { "saveFactorImageAs:" "id" { "id" "SEL" "id" }
-        [ 3drop menu-save-image f ]
-    }
-
-    { "showFactorHelp:" "id" { "id" "SEL" "id" }
-        [ 3drop "handbook" <link> help-gadget call-tool f ]
-    }
-} define-objc-class
-
-: install-app-delegate ( -- )
-    NSApp FactorApplicationDelegate install-delegate ;
-
-: load-nib ( -- )
-    NSBundle
-    "Factor.nib" <NSString> NSApp -> loadNibNamed:owner:
-    drop ;
-
-: init-cocoa ( -- )
-    load-nib
-    install-app-delegate
-    register-services
-    init-clipboard ;
-
-: rect>NSRect
-    dup world-loc first2 rot rect-dim first2 <NSRect> ;
-
-: gadget-window ( world -- )
-    [
-        dup <FactorView>
-        dup rot rect>NSRect <ViewWindow>
-        dup install-window-delegate
-        over -> release
-        2array
-    ] keep set-world-handle ;
-
-IN: gadgets
-
-: set-title ( string world -- )
-    world-handle second swap <NSString> -> setTitle: ;
-
-: auto-position ( world -- )
-    dup world-loc { 0 0 } = [
-        world-handle second -> center
-    ] [
-        drop
-    ] if ;
-
-: open-window* ( world -- )
-    dup gadget-window
-    dup start-world
-    dup auto-position
-    world-handle second f -> makeKeyAndOrderFront: ;
-
-: raise-window ( world -- )
-    world-handle second dup f -> orderFront: -> makeKeyWindow
-    NSApp 1 -> activateIgnoringOtherApps: ;
-
-: select-gl-context ( handle -- )
-    first -> openGLContext -> makeCurrentContext ;
-
-: flush-gl-context ( handle -- )
-    first -> openGLContext -> flushBuffer ;
-
-: running.app? ( -- ? )
-    #! Test if we're running Factor.app.
-    "Factor.app"
-    NSBundle -> mainBundle -> bundlePath CF>string
-    subseq? ;
-
-IN: shells
-
-: ui
-    running.app? [
-        "The Factor UI requires you to run the supplied Factor.app." throw
-    ] unless
-    [
-        [
-            init-timers
-            init-cocoa
-            restore-windows? [
-                restore-windows
-            ] [
-                init-ui
-                workspace-window
-                drop
-            ] if
-            finish-launching
-            event-loop
-        ] with-cocoa
-    ] with-freetype ;
-
-IN: command-line
-
-: default-shell running.app? "ui" "tty" ? ;
diff --git a/core/ui/cocoa/view-utils.factor b/core/ui/cocoa/view-utils.factor
deleted file mode 100644 (file)
index d6bb776..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc-classes
-DEFER: FactorView
-
-IN: cocoa
-USING: arrays gadgets hashtables kernel math namespaces objc
-opengl sequences ;
-
-: <GLView> ( class dim -- view )
-    >r -> alloc 0 0 r> first2 <NSRect>
-    NSOpenGLView -> defaultPixelFormat
-    -> initWithFrame:pixelFormat:
-    dup 1 -> setPostsBoundsChangedNotifications:
-    dup 1 -> setPostsFrameChangedNotifications: ;
-
-: view-dim ( view -- dim )
-    -> bounds
-    dup NSRect-w >fixnum
-    swap NSRect-h >fixnum 2array ;
-
-: mouse-location ( view event -- loc )
-    over >r
-    -> locationInWindow f -> convertPoint:fromView:
-    dup NSPoint-x swap NSPoint-y
-    r> -> frame NSRect-h swap - 2array ;
-
-: send-mouse-moved ( view event -- )
-    over >r mouse-location r> window move-hand fire-motion ;
-
-: button ( event -- n )
-    #! Cocoa -> Factor UI button mapping
-    -> buttonNumber H{ { 0 1 } { 2 2 } { 1 3 } } hash ;
-
-: modifiers
-    {
-        { S+ HEX: 20000 }
-        { C+ HEX: 40000 }
-        { A+ HEX: 80000 }
-        { M+ HEX: 100000 }
-    } ;
-
-: key-codes
-    H{
-        { 71 "CLEAR" }
-        { 36 "RETURN" }
-        { 76 "ENTER" }
-        { 53 "ESCAPE" }
-        { 48 "TAB" }
-        { 51 "BACKSPACE" }
-        { 115 "HOME" }
-        { 117 "DELETE" }
-        { 119 "END" }
-        { 122 "F1" }
-        { 120 "F2" }
-        { 99 "F3" }
-        { 118 "F4" }
-        { 96 "F5" }
-        { 97 "F6" }
-        { 98 "F7" }
-        { 100 "F8" }
-        { 123 "LEFT" }
-        { 124 "RIGHT" }
-        { 125 "DOWN" }
-        { 126 "UP" }
-        { 116 "PAGE_UP" }
-        { 121 "PAGE_DOWN" }
-    } ;
-
-: key-code ( event -- string )
-    dup -> keyCode key-codes hash
-    [ ] [ -> charactersIgnoringModifiers CF>string ] ?if ;
-
-: event-modifiers ( event -- modifiers )
-    -> modifierFlags modifiers modifier ;
-
-: key-event>gesture ( event -- modifiers keycode )
-    dup event-modifiers swap key-code ;
-
-: send-key-event ( view event quot -- ? )
-    >r key-event>gesture r> call swap window-focus
-    send-gesture ; inline
-
-: send-user-input ( view event -- )
-    -> characters CF>string swap window-focus user-input ;
-
-: send-key-down-event ( view event -- )
-    2dup [ <key-down> ] send-key-event
-    [ send-user-input ] [ 2drop ] if ;
-
-: send-key-up-event ( view event -- )
-    [ <key-up> ] send-key-event drop ;
-
-: mouse-event>gesture ( event -- modifiers button )
-    dup event-modifiers swap button ;
-
-: send-button-down$ ( view event -- )
-    [ mouse-event>gesture <button-down> ] 2keep
-    mouse-location rot window send-button-down ;
-
-: send-button-up$ ( view event -- )
-    [ mouse-event>gesture <button-up> ] 2keep
-    mouse-location rot window send-button-up ;
-
-: send-wheel$ ( view event -- )
-    over >r
-    dup -> deltaX sgn neg over -> deltaY sgn neg 2array -rot
-    mouse-location
-    r> window send-wheel ;
-
-: send-action$ ( view event gesture -- junk )
-    >r drop window r> send-action f ;
-
-: add-resize-observer ( observer object -- )
-    >r "updateFactorGadgetSize:"
-    "NSViewFrameDidChangeNotification" <NSString>
-    r> add-observer ;
-
-: string-or-nil? ( NSString -- ? )
-    [ CF>string NSStringPboardType = ] [ t ] if* ;
-
-: valid-service? ( gadget send-type return-type -- ? )
-    over string-or-nil? over string-or-nil? and [
-        drop [ gadget-selection? ] [ drop t ] if
-    ] [
-        3drop f
-    ] if ;
-
-"NSOpenGLView" "FactorView" {
-    ! Events
-    { "acceptsFirstMouse:" "bool" { "id" "SEL" "id" }
-        [ 3drop 1 ]
-    }
-    
-    { "mouseEntered:" "void" { "id" "SEL" "id" }
-        [ [ nip send-mouse-moved ] ui-try ]
-    }
-    
-    { "mouseExited:" "void" { "id" "SEL" "id" }
-        [ [ 3drop forget-rollover ] ui-try ]
-    }
-    
-    { "mouseMoved:" "void" { "id" "SEL" "id" }
-        [ [ nip send-mouse-moved ] ui-try ]
-    }
-    
-    { "mouseDragged:" "void" { "id" "SEL" "id" }
-        [ [ nip send-mouse-moved ] ui-try ]
-    }
-    
-    { "rightMouseDragged:" "void" { "id" "SEL" "id" }
-        [ [ nip send-mouse-moved ] ui-try ]
-    }
-    
-    { "otherMouseDragged:" "void" { "id" "SEL" "id" }
-        [ [ nip send-mouse-moved ] ui-try ]
-    }
-    
-    { "mouseDown:" "void" { "id" "SEL" "id" }
-        [ [ nip send-button-down$ ] ui-try ]
-    }
-    
-    { "mouseUp:" "void" { "id" "SEL" "id" }
-        [ [ nip send-button-up$ ] ui-try ]
-    }
-    
-    { "rightMouseDown:" "void" { "id" "SEL" "id" }
-        [ [ nip send-button-down$ ] ui-try ]
-    }
-    
-    { "rightMouseUp:" "void" { "id" "SEL" "id" }
-        [ [ nip send-button-up$ ] ui-try ]
-    }
-    
-    { "otherMouseDown:" "void" { "id" "SEL" "id" }
-        [ [ nip send-button-down$ ] ui-try ]
-    }
-    
-    { "otherMouseUp:" "void" { "id" "SEL" "id" }
-        [ [ nip send-button-up$ ] ui-try ]
-    }
-    
-    { "scrollWheel:" "void" { "id" "SEL" "id" }
-        [ [ nip send-wheel$ ] ui-try ]
-    }
-    
-    { "keyDown:" "void" { "id" "SEL" "id" }
-        [ [ nip send-key-down-event ] ui-try ]
-    }
-    
-    { "keyUp:" "void" { "id" "SEL" "id" }
-        [ [ nip send-key-up-event ] ui-try ]
-    }
-
-    { "cut:" "id" { "id" "SEL" "id" }
-        [ [ nip T{ cut-action } send-action$ ] ui-try ]
-    }
-
-    { "copy:" "id" { "id" "SEL" "id" }
-        [ [ nip T{ copy-action } send-action$ ] ui-try ]
-    }
-
-    { "paste:" "id" { "id" "SEL" "id" }
-        [ [ nip T{ paste-action } send-action$ ] ui-try ]
-    }
-
-    { "delete:" "id" { "id" "SEL" "id" }
-        [ [ nip T{ delete-action } send-action$ ] ui-try ]
-    }
-
-    { "selectAll:" "id" { "id" "SEL" "id" }
-        [ [ nip T{ select-all-action } send-action$ ] ui-try ]
-    }
-
-    ! Services
-    { "validRequestorForSendType:returnType:" "id" { "id" "SEL" "id" "id" }
-        [
-            ! We return either self or nil
-            >r >r over window-focus r> r>
-            valid-service? [ drop ] [ 2drop f ] if
-        ]
-    }
-
-    { "writeSelectionToPasteboard:types:" "bool" { "id" "SEL" "id" "id" }
-        [
-            CF>string-array NSStringPboardType swap member? [
-                >r drop window-focus gadget-selection dup [
-                    r> set-pasteboard-string t
-                ] [
-                    r> 2drop f
-                ] if
-            ] [
-                3drop f
-            ] if
-        ]
-    }
-
-    { "readSelectionFromPasteboard:" "bool" { "id" "SEL" "id" }
-        [
-            pasteboard-string dup [
-                >r drop window-focus r> swap user-input t
-            ] [
-                3drop f
-            ] if
-        ]
-    }
-
-    { "updateFactorGadgetSize:" "void" { "id" "SEL" "id" }
-        [
-            [
-                2drop dup view-dim swap window set-gadget-dim
-                ui-step
-            ] ui-try
-        ]
-    }
-    
-    { "acceptsFirstResponder" "bool" { "id" "SEL" }
-        [ 2drop 1 ]
-    }
-    
-    { "initWithFrame:pixelFormat:" "id" { "id" "SEL" "NSRect" "id" }
-        [
-            rot drop
-            SUPER-> initWithFrame:pixelFormat:
-            dup dup add-resize-observer
-        ]
-    }
-    
-    { "dealloc" "void" { "id" "SEL" }
-        [
-            drop
-            dup window close-world
-            dup unregister-window
-            dup remove-observer
-            SUPER-> dealloc
-        ]
-    }
-} define-objc-class
-
-: <FactorView> ( world -- view )
-    FactorView over rect-dim <GLView> [ register-window ] keep ;
diff --git a/core/ui/cocoa/window-utils.factor b/core/ui/cocoa/window-utils.factor
deleted file mode 100644 (file)
index 76d93e2..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc-classes
-DEFER: FactorWindowDelegate
-
-IN: cocoa
-USING: arrays gadgets kernel math objc sequences ;
-
-: NSBorderlessWindowMask     0 ; inline
-: NSTitledWindowMask         1 ; inline
-: NSClosableWindowMask       2 ; inline
-: NSMiniaturizableWindowMask 4 ; inline
-: NSResizableWindowMask      8 ; inline
-
-: NSBackingStoreRetained    0 ; inline
-: NSBackingStoreNonretained 1 ; inline
-: NSBackingStoreBuffered    2 ; inline
-
-: standard-window-type
-    NSTitledWindowMask
-    NSClosableWindowMask bitor
-    NSMiniaturizableWindowMask bitor
-    NSResizableWindowMask bitor ; inline
-
-: <NSWindow> ( rect -- window )
-    NSWindow -> alloc swap
-    standard-window-type NSBackingStoreBuffered 1
-    -> initWithContentRect:styleMask:backing:defer: ;
-
-: <ViewWindow> ( view bounds -- window )
-    <NSWindow> [ swap -> setContentView: ] keep
-    dup dup -> contentView -> setInitialFirstResponder:
-    dup 1 -> setAcceptsMouseMovedEvents: ;
-
-: window-pref-dim -> contentView window pref-dim ;
-
-: frame-content-rect ( window rect -- rect )
-    swap -> styleMask NSWindow -rot
-    -> frameRectForContentRect:styleMask: ;
-
-: window-content-rect ( window -- rect )
-    NSWindow over -> frame rot -> styleMask
-    -> contentRectForFrameRect:styleMask: ;
-
-"NSObject" "FactorWindowDelegate" {
-    ! Doesn't work on Intel since we don't support struct
-    ! returns yet
-
-    ! {
-    !     "windowWillUseStandardFrame:defaultFrame:" "NSRect"
-    !     { "id" "SEL" "id" "NSRect" }
-    !     [
-    !         drop 2nip
-    !         dup window-content-rect NSRect-x-far-y
-    !         pick window-pref-dim first2 <far-y-NSRect>
-    !         frame-content-rect
-    !     ]
-    ! }
-
-    {
-        "windowDidMove:" "void" { "id" "SEL" "id" } [
-            2nip -> object
-            dup window-content-rect NSRect-x-y 2array
-            swap -> contentView window set-world-loc
-        ]
-    }
-
-    {
-        "windowDidBecomeKey:" "void" { "id" "SEL" "id" } [
-            2nip -> object -> contentView window focus-world
-        ]
-    }
-
-    {
-        "windowDidResignKey:" "void" { "id" "SEL" "id" } [
-            forget-rollover
-            2nip -> object -> contentView window unfocus-world
-        ]
-    }
-} define-objc-class
-
-: install-window-delegate ( window -- )
-    FactorWindowDelegate install-delegate ;
diff --git a/core/ui/commands.factor b/core/ui/commands.factor
deleted file mode 100644 (file)
index cc97b49..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays definitions kernel gadgets sequences strings math
-words generic namespaces hashtables help ;
-IN: gadgets
-
-TUPLE: command name gesture quot ;
-
-M: command equal? eq? ;
-
-GENERIC: invoke-command ( target command -- )
-
-M: f invoke-command ( target command -- ) 2drop ;
-
-M: command invoke-command ( target command -- )
-    command-quot call ;
-
-GENERIC: gesture>string ( gesture -- string/f )
-
-: modifiers>string ( modifiers -- string )
-    [ word-name ] map concat >string ;
-
-M: key-down gesture>string
-    dup key-down-mods modifiers>string
-    swap key-down-sym append ;
-
-M: button-up gesture>string
-    [
-        dup button-up-mods modifiers>string %
-        "Click Button" %
-        button-up-# [ " " % # ] when*
-    ] "" make ;
-
-M: button-down gesture>string
-    [
-        dup button-down-mods modifiers>string %
-        "Press Button" %
-        button-down-# [ " " % # ] when*
-    ] "" make ;
-
-M: object gesture>string drop f ;
-
-: commands ( class -- hash )
-    dup "commands" word-prop [ ] [
-        H{ } clone [ "commands" set-word-prop ] keep
-    ] ?if ;
-
-: commands>gestures ( class -- hash )
-    commands hash-values concat
-    [ command-gesture ] subset
-    [ dup command-gesture swap [ invoke-command ] curry ]
-    map>hash ;
-
-: define-commands ( class group specs -- )
-    [ dup array? [ first3 <command> ] when ] map
-    swap pick commands set-hash
-    dup commands>gestures "gestures" set-word-prop ;
-
-: command-description ( command -- element )
-    dup command-name swap command-gesture gesture>string
-    2array ;
-
-: commands. ( commands -- )
-    [ command-gesture key-down? ] subset
-    [ command-description ] map
-    { { $strong "Command" } { $strong "Shortcut" } } add*
-    $table ;
-
-: $commands ( element -- )
-    first2 swap commands hash commands. ;
-
-TUPLE: operation predicate primary? secondary? listener? hook ;
-
-SYMBOL: operations
-
-: object-operations ( obj -- operations )
-    operations get [ operation-predicate call ] subset-with ;
-
-: class-operations ( class -- operations )
-    "predicate" word-prop
-    operations get [ operation-predicate = ] subset-with ;
-
-: primary-operation ( obj -- command )
-    object-operations [ operation-primary? ] find-last nip ;
-
-: secondary-operation ( obj -- command )
-    object-operations [ operation-secondary? ] find-last nip ;
-
-: $operations ( element -- )
-    [ class-operations ] map concat commands. ;
diff --git a/core/ui/commands.facts b/core/ui/commands.facts
deleted file mode 100644 (file)
index b215577..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-IN: gadgets
-USING: help strings gadgets-presentations generic kernel ;
-
-HELP: command
-{ $class-description "A command is a named piece of code associated to an input gesture. Commands have the following slots:"
-{ $list
-    { { $link command-name } " - a string naming the command" }
-    { { $link command-gesture } " - a gesture or " { $link f } }
-    { { $link command-quot } " - a quotation with stack effect " { $snippet "( target -- )" } }
-}
-"Classes delegating to " { $link command } " can re-implement the " { $link invoke-command } " generic word." }
-{ $see-also operation <command-button> invoke-command define-commands } ;
-
-HELP: invoke-command
-{ $values { "target" object } { "command" command } }
-{ $contract "Invokes the command on the given target. The default implementation calls " { $link command-quot } "." } ;
-
-HELP: gesture>string
-{ $values { "gesture" "a gesture" } { "string/f" "a " { $link string } " or " { $link f } } }
-{ $contract "Creates a human-readable string from a gesture object, returning " { $link f } " if the gesture does not have a human-readable form." }
-{ $examples
-    { $example "USE: gadgets" "T{ key-down f { C+ } \"x\" } gesture>string print" "C+x" }
-} ;
-
-HELP: commands
-{ $values { "class" "a class word" } }
-{ $description "Outputs a hashtable mapping command group strings to sequences of commands for the given gadget class." }
-{ $see-also define-commands } ;
-
-HELP: define-commands
-{ $values { "class" "a class word" } { "group" string } { "specs" "a sequence of command specifiers" } }
-{ $description
-    "Defines a group of commands for the specified gadget class. The " { $snippet "specs" } " parameter is a sequence of triples " { $snippet "{ name gesture quot }" } ", where " { $snippet "name" } " is a string, " { $snippet "gesture" } " is a gesture, and " { $snippet "quot" } " is a " { $link quotation } "."
-}
-{ $notes "Only one of " { $link define-commands } " and " { $link set-gestures } " can be used on a given gadget class, since each word will overwrite the other word's definitions." }
-{ $see-also commands $commands } ;
-
-HELP: $commands
-{ $values { "element" "a pair" } }
-{ $description "Prints a table of commands, where the first element of the pair is a class word and the second is a command group name." }
-{ $see-also commands define-commands } ;
diff --git a/core/ui/debugger.factor b/core/ui/debugger.factor
deleted file mode 100644 (file)
index 71f5424..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays errors gadgets gadgets-buttons
-gadgets-labels gadgets-panes gadgets-presentations
-gadgets-scrolling gadgets-theme gadgets-viewports gadgets-lists
-generic hashtables io kernel math models namespaces prettyprint
-queues sequences test threads help sequences words timers ;
-
-: <restart-list> ( restarts restart-hook -- gadget )
-    [ restart-name ] rot <model> <list> ;
-
-TUPLE: debugger restarts ;
-
-: <debugger-display> ( error restart-list -- gadget )
-    >r [ print-error ] make-pane r> 2array make-filled-pile ;
-
-C: debugger ( error restarts restart-hook -- gadget )
-    {
-        {
-            [ gadget get { debugger } <toolbar> ]
-            f f @top
-        }
-        {
-            [ <restart-list> ]
-            set-debugger-restarts
-            [ <debugger-display> <scroller> ]
-            @center
-        }
-    } make-frame* dup popup-theme ;
-
-M: debugger focusable-child*
-    debugger-restarts ;
-
-: debugger-window ( error -- )
-    #! No restarts for the debugger window
-    f [ drop ] <debugger>
-    "Error" open-titled-window ;
-
-: ui-try ( quot -- )
-    [ debugger-window ] recover ;
-
-debugger "gestures" {
-    { "Request focus" T{ button-down } [ request-focus ] }
-} define-commands
diff --git a/core/ui/debugger.facts b/core/ui/debugger.facts
deleted file mode 100644 (file)
index d7e76f8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-IN: gadgets
-USING: help kernel errors ;
-
-HELP: <debugger>
-{ $values { "error" "an error" } { "restarts" "a sequence of " { $link restart } " instances" } { "restart-hook" "a quotation with stack effect " { $snippet "( list -- )" } } }
-{ $description
-    "Creates a gadget displaying a description of the error, along with buttons to print the contents of the stacks in the listener, and a list of restarts."
-}
-{ $see-also debugger-window ui-try } ;
-
-HELP: debugger-window
-{ $values { "error" "an error" } }
-{ $description "Opens a window with a description of the error." }
-{ $see-also <debugger> ui-try } ;
-
-HELP: ui-try
-{ $values { "quot" quotation } }
-{ $description "Calls the quotation. If it throws an error, opens a window with the error and restores the data stack." }
-{ $notes "This is essentially a graphical variant of " { $link try } "." }
-{ $see-also <debugger> debugger-window } ;
diff --git a/core/ui/freetype/freetype-gl.factor b/core/ui/freetype/freetype-gl.factor
deleted file mode 100644 (file)
index 67bc0c3..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays errors hashtables io kernel
-libc math namespaces opengl prettyprint
-sequences styles ;
-IN: freetype
-
-SYMBOL: freetype
-SYMBOL: open-fonts
-
-: freetype-error ( n -- )
-    zero? [ "FreeType error" throw ] unless ;
-
-: init-freetype ( -- )
-    global [
-        f <void*> dup FT_Init_FreeType freetype-error
-        *void* freetype set
-        H{ } clone open-fonts set
-    ] bind ;
-
-TUPLE: font ascent descent height handle widths ;
-
-M: font equal? eq? ;
-
-: close-font ( font -- ) font-handle FT_Done_Face ;
-
-: close-freetype ( -- )
-    global [
-        open-fonts [ hash-values [ close-font ] each f ] change
-        freetype [ FT_Done_FreeType f ] change
-    ] bind ;
-
-: with-freetype ( quot -- )
-    freetype get expired? [
-        init-freetype [ close-freetype ] cleanup
-    ] [
-        call
-    ] if ; inline
-
-: ttf-name ( font style -- name )
-    2array H{
-        { { "monospace" plain        } "VeraMono" }
-        { { "monospace" bold         } "VeraMoBd" }
-        { { "monospace" bold-italic  } "VeraMoBI" }
-        { { "monospace" italic       } "VeraMoIt" }
-        { { "sans-serif" plain       } "Vera"     }
-        { { "sans-serif" bold        } "VeraBd"   }
-        { { "sans-serif" bold-italic } "VeraBI"   }
-        { { "sans-serif" italic      } "VeraIt"   }
-        { { "serif" plain            } "VeraSe"   }
-        { { "serif" bold             } "VeraSeBd" }
-        { { "serif" bold-italic      } "VeraBI"   }
-        { { "serif" italic           } "VeraIt"   }
-    } hash ;
-
-: ttf-path ( name -- string )
-    "/fonts/" swap ".ttf" 3append resource-path ;
-
-: open-face ( font style -- face )
-    ttf-name ttf-path >r freetype get r>
-    0 f <void*> [ FT_New_Face freetype-error ] keep *void* ;
-
-: dpi 72 ; inline
-
-: ft-floor -6 shift ; inline
-
-: ft-ceil 63 + -64 bitand -6 shift ; inline
-
-: font-units>pixels ( n font -- n )
-    face-size face-size-y-scale FT_MulFix ;
-
-: init-ascent ( font face -- )
-    dup face-y-max swap font-units>pixels swap set-font-ascent ;
-
-: init-descent ( font face -- )
-    dup face-y-min swap font-units>pixels swap set-font-descent ;
-
-: init-font ( font -- )
-    dup font-handle 2dup init-ascent dupd init-descent
-    dup font-ascent over font-descent - ft-ceil
-    swap set-font-height ;
-
-C: font ( handle -- font )
-    [ set-font-handle ] keep dup init-font
-    V{ } clone over set-font-widths ;
-
-: (open-font) ( font -- open-font )
-    first3 >r open-face dup 0 r> 6 shift
-    dpi dpi FT_Set_Char_Size freetype-error <font> ;
-
-: open-font ( font -- open-font )
-    open-fonts get [ (open-font) ] cache ;
-
-: load-glyph ( font char -- glyph )
-    >r font-handle dup r> 0 FT_Load_Char
-    freetype-error face-glyph ;
-
-: char-width ( open-font char -- w )
-    over font-widths [
-        dupd load-glyph glyph-hori-advance ft-ceil
-    ] cache-nth nip ;
-
-: glyph-size ( glyph -- dim )
-    dup glyph-hori-advance ft-ceil
-    swap glyph-height ft-ceil 2array ;
-
-: render-glyph ( font char -- bitmap )
-    load-glyph dup
-    FT_RENDER_MODE_NORMAL FT_Render_Glyph freetype-error ;
-
-: copy-pixel ( bit tex -- bit tex )
-    255 f pick set-alien-unsigned-1 1+
-    f pick alien-unsigned-1
-    f pick set-alien-unsigned-1 >r 1+ r> 1+ ;
-
-: (copy-row) ( bit tex bitend texend -- bitend texend )
-    >r pick over >= [
-        r> 2swap 2drop
-    ] [
-        >r copy-pixel r> r> (copy-row)
-    ] if ;
-
-: copy-row ( bit tex width width2 -- bitend texend width width2 )
-    [ pick + >r pick + r> (copy-row) ] 2keep ;
-
-: copy-bitmap ( glyph texture -- )
-    over glyph-bitmap-rows >r
-    over glyph-bitmap-width dup next-power-of-2 2 *
-    >r >r >r glyph-bitmap-buffer alien-address r> r> r> r> 
-    [ copy-row ] times 2drop 2drop ;
-
-: bitmap>texture ( glyph sprite -- id )
-    tuck sprite-size2 * 2 * [
-        alien-address [ copy-bitmap ] keep <alien> gray-texture
-    ] with-malloc ;
-
-: glyph-texture-loc ( glyph font -- loc )
-    over glyph-hori-bearing-x ft-floor -rot
-    font-ascent swap glyph-hori-bearing-y - ft-floor 2array ;
-
-: glyph-texture-size ( glyph -- dim )
-    dup glyph-bitmap-width next-power-of-2
-    swap glyph-bitmap-rows next-power-of-2 2array ;
-
-: <char-sprite> ( font char -- sprite )
-    over >r render-glyph dup r> glyph-texture-loc
-    over glyph-size pick glyph-texture-size <sprite>
-    [ bitmap>texture ] keep [ init-sprite ] keep ;
-
-: draw-char ( open-font char sprites -- )
-    [ dupd <char-sprite> ] cache-nth nip
-    sprite-dlist glCallList ;
-
-: (draw-string) ( open-font sprites string loc -- )
-    GL_TEXTURE_2D [
-        [
-            [ >r 2dup r> swap draw-char ] each 2drop
-        ] with-translation
-    ] do-enabled ;
diff --git a/core/ui/freetype/freetype.factor b/core/ui/freetype/freetype.factor
deleted file mode 100644 (file)
index a0aeb20..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien kernel ;
-IN: freetype
-
-windows? [
-    "freetype" "freetype6.dll" "cdecl" add-library
-] when
-
-LIBRARY: freetype
-
-TYPEDEF: uchar FT_Byte
-TYPEDEF: uchar* FT_Bytes
-TYPEDEF: char FT_Char
-TYPEDEF: int FT_Int
-TYPEDEF: int FT_Int32
-TYPEDEF: uint FT_UInt
-TYPEDEF: short FT_Short
-TYPEDEF: ushort FT_UShort
-TYPEDEF: long FT_Long
-TYPEDEF: ulong FT_ULong
-TYPEDEF: uchar FT_Bool
-TYPEDEF: cell FT_Offset
-TYPEDEF: int FT_PtrDist
-TYPEDEF: char FT_String
-TYPEDEF: int FT_Tag
-TYPEDEF: int FT_Error
-TYPEDEF: long FT_Fixed
-TYPEDEF: void* FT_Pointer
-TYPEDEF: long FT_Pos
-TYPEDEF: ushort FT_UFWord
-TYPEDEF: short FT_F2Dot14
-TYPEDEF: long FT_F26Dot6
-
-FUNCTION: FT_Error FT_Init_FreeType ( void* library ) ;
-
-! circular reference between glyph and face
-TYPEDEF: void face
-TYPEDEF: void glyph
-
-BEGIN-STRUCT: glyph
-    FIELD: void*    library
-    FIELD: face*    face
-    FIELD: glyph*   next
-    FIELD: FT_UInt  reserved
-    FIELD: void*    generic
-    FIELD: void*    generic
-
-    FIELD: FT_Pos   width
-    FIELD: FT_Pos   height
-                  
-    FIELD: FT_Pos   hori-bearing-x
-    FIELD: FT_Pos   hori-bearing-y
-    FIELD: FT_Pos   hori-advance
-                  
-    FIELD: FT_Pos   vert-bearing-x
-    FIELD: FT_Pos   vert-bearing-y
-    FIELD: FT_Pos   vert-advance
-
-    FIELD: FT_Fixed linear-hori-advance
-    FIELD: FT_Fixed linear-vert-advance
-    FIELD: FT_Pos   advance-x
-    FIELD: FT_Pos   advance-y
-                    
-    FIELD: long     format
-                    
-    FIELD: int      bitmap-rows
-    FIELD: int      bitmap-width
-    FIELD: int      bitmap-pitch
-    FIELD: uchar*   bitmap-buffer
-    FIELD: short    bitmap-num-grays
-    FIELD: char     bitmap-pixel-mode
-    FIELD: char     bitmap-palette-mode
-    FIELD: void*    bitmap-palette
-
-    FIELD: FT_Int   bitmap-left
-    FIELD: FT_Int   bitmap-top
-
-    FIELD: short    n-contours
-    FIELD: short    n-points
-
-    FIELD: void*    points
-    FIELD: char*    tags
-    FIELD: short*   contours
-
-    FIELD: int      outline-flags
-                    
-    FIELD: FT_UInt  num_subglyphs
-    FIELD: void*    subglyphs
-                    
-    FIELD: void*    control-data
-    FIELD: long     control-len
-                    
-    FIELD: FT_Pos   lsb-delta
-    FIELD: FT_Pos   rsb-delta
-                    
-    FIELD: void*    other
-END-STRUCT
-
-BEGIN-STRUCT: face-size
-    FIELD: face*     face
-    FIELD: void*     generic
-    FIELD: void*     generic
-
-    FIELD: FT_UShort x-ppem
-    FIELD: FT_UShort y-ppem
-                     
-    FIELD: FT_Fixed  x-scale
-    FIELD: FT_Fixed  y-scale
-                     
-    FIELD: FT_Pos    ascender
-    FIELD: FT_Pos    descender
-    FIELD: FT_Pos    height
-    FIELD: FT_Pos    max-advance
-END-STRUCT
-
-BEGIN-STRUCT: face
-    FIELD: FT_Long    num-faces
-    FIELD: FT_Long    index
-                      
-    FIELD: FT_Long    flags
-    FIELD: FT_Long    style-flags
-                      
-    FIELD: FT_Long    num-glyphs
-                      
-    FIELD: FT_Char*   family-name
-    FIELD: FT_Char*   style-name
-                      
-    FIELD: FT_Int     num-fixed-sizes
-    FIELD: void*      available-sizes
-                      
-    FIELD: FT_Int     num-charmaps
-    FIELD: void*      charmaps
-                      
-    FIELD: void*      generic
-    FIELD: void*      generic
-                      
-    FIELD: FT_Pos     x-min
-    FIELD: FT_Pos     y-min
-    FIELD: FT_Pos     x-max
-    FIELD: FT_Pos     y-max
-                      
-    FIELD: FT_UShort  units-per-em
-    FIELD: FT_Short   ascender
-    FIELD: FT_Short   descender
-    FIELD: FT_Short   height
-                      
-    FIELD: FT_Short   max-advance-width
-    FIELD: FT_Short   max-advance-height
-                      
-    FIELD: FT_Short   underline-position
-    FIELD: FT_Short   underline-thickness
-                      
-    FIELD: glyph*     glyph
-    FIELD: face-size* size
-    FIELD: void*      charmap
-END-STRUCT
-
-FUNCTION: FT_Error FT_New_Face ( void* library, FT_Char* font, FT_Long index, face* face ) ;
-
-FUNCTION: FT_Error FT_Set_Char_Size ( face* face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horizontal_dpi, FT_UInt vertical_dpi ) ;
-
-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
-;
-
-FUNCTION: int FT_Render_Glyph ( glyph* slot, int render_mode ) ;
-
-FUNCTION: void FT_Done_Face ( face* face ) ;
-
-FUNCTION: void FT_Done_FreeType ( void* library ) ;
-
-FUNCTION: FT_Long FT_MulFix ( FT_Long a, FT_Long b ) ;
diff --git a/core/ui/freetype/load.factor b/core/ui/freetype/load.factor
deleted file mode 100644 (file)
index f43f560..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-REQUIRES: core/ui/opengl ;
-
-PROVIDE: core/ui/freetype
-{ +files+ { 
-    "freetype.factor"
-    "freetype-gl.factor"
-} } ;
diff --git a/core/ui/gadgets.factor b/core/ui/gadgets.factor
deleted file mode 100644 (file)
index ea0b4ec..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays generic hashtables kernel models math
-namespaces sequences styles timers ;
-
-SYMBOL: origin
-
-{ 0 0 } origin set-global
-
-TUPLE: rect loc dim ;
-
-M: array rect-loc ;
-
-M: array rect-dim drop { 0 0 } ;
-
-: rect-bounds ( rect -- loc dim ) dup rect-loc swap rect-dim ;
-
-: rect-extent ( rect -- loc ext ) rect-bounds over v+ ;
-
-: 2rect-extent ( rect rect -- loc1 loc2 ext1 ext2 )
-    [ rect-extent ] 2apply swapd ;
-
-: <extent-rect> ( loc ext -- rect ) dupd swap [v-] <rect> ;
-
-: offset-rect ( rect loc -- newrect )
-    over rect-loc v+ swap rect-dim <rect> ;
-
-: >absolute ( rect -- rect )
-    origin get offset-rect ;
-
-: (rect-intersect) ( rect rect -- array array )
-    2rect-extent vmin >r vmax r> ;
-
-: rect-intersect ( rect1 rect2 -- newrect )
-    (rect-intersect) <extent-rect> ;
-
-: intersects? ( rect/point rect -- ? )
-    (rect-intersect) [v-] { 0 0 } = ;
-
-TUPLE: gadget
-pref-dim parent children orientation state
-visible? root? clipped? grafted?
-interior boundary ;
-
-M: gadget equal? eq? ;
-
-: gadget-child ( gadget -- child ) gadget-children first ;
-
-: nth-gadget ( n gadget -- child ) gadget-children nth ;
-
-: <zero-rect> ( -- rect ) { 0 0 } dup <rect> ;
-
-C: gadget ( -- gadget )
-    <zero-rect> over set-delegate
-    { 0 1 } over set-gadget-orientation
-    t over set-gadget-visible? ;
-
-: delegate>gadget ( tuple -- ) <gadget> swap set-delegate ;
-
-: relative-loc ( fromgadget togadget -- loc )
-    2dup eq? [
-        2drop { 0 0 }
-    ] [
-        over rect-loc >r
-        >r gadget-parent r> relative-loc
-        r> v+
-    ] if ;
-
-GENERIC: user-input* ( str gadget -- ? )
-
-M: gadget user-input* 2drop t ;
-
-GENERIC: children-on ( rect/point gadget -- list )
-
-M: gadget children-on nip gadget-children ;
-
-: inside? ( bounds gadget -- ? )
-    dup gadget-visible?
-    [ >absolute intersects? ] [ 2drop f ] if ;
-
-: (pick-up) ( point gadget -- gadget/f )
-    dupd children-on <reversed> [ inside? ] find-with nip ;
-
-: translate ( rect/point -- ) rect-loc origin [ v+ ] change ;
-
-: pick-up ( point gadget -- child/f )
-    [
-        2dup inside? [
-            dup translate 2dup (pick-up) dup
-            [ nip pick-up ] [ rot 2drop ] if
-        ] [ 2drop f ] if
-    ] with-scope ;
-
-: max-dim ( dims -- dim ) { 0 0 } [ vmax ] reduce ;
-
-: each-child ( gadget quot -- )
-    >r gadget-children r> each ; inline
-
-: each-child-with ( obj gadget quot -- )
-    >r gadget-children r> each-with ; inline
-
-: set-gadget-delegate ( gadget tuple -- )
-    over [ dup pick [ set-gadget-parent ] each-child-with ] when
-    set-delegate ;
-
-: with-gadget ( gadget quot -- )
-    [ swap gadget set call ] with-scope ; inline
-
-! Title bar protocol
-GENERIC: gadget-title ( gadget -- string )
-
-M: gadget gadget-title drop "Factor" <model> ;
-
-! Selection protocol
-GENERIC: gadget-selection? ( gadget -- ? )
-
-M: gadget gadget-selection? drop f ;
-
-GENERIC: gadget-selection ( gadget -- string/f )
-
-M: gadget gadget-selection drop f ;
-
-! Re-firing gestures while mouse held down, etc. Used by
-! slider gadgets
-TUPLE: timer-gadget quot ;
-
-C: timer-gadget ( gadget -- newgadget )
-    [ set-gadget-delegate ] keep ;
-
-M: timer-gadget tick timer-gadget-quot call ;
-
-: start-timer-gadget ( gadget quot -- )
-    2dup call
-    over >r curry r>
-    [ set-timer-gadget-quot ] keep
-    100 200 add-timer ; inline
-
-: stop-timer-gadget ( gadget -- )
-    dup remove-timer f swap set-timer-gadget-quot ;
diff --git a/core/ui/gadgets.facts b/core/ui/gadgets.facts
deleted file mode 100644 (file)
index cafbedb..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-IN: gadgets
-USING: help gadgets-text opengl generic kernel strings ;
-
-HELP: origin
-{ $var-description "Within the dynamic extent of " { $link draw-world } ", holds the co-ordinate system origin for the gadget currently being drawn." }
-{ $see-also translate draw-gadget } ;
-
-HELP: rect
-{ $class-description "A rectangle with the following slots:"
-    { $list
-        { { $link rect-loc } " - the top-left corner of the rectangle as an x/y pair" }
-        { { $link rect-dim } " - the dimensions of the rectangle as a width/height pair" }
-    }
-}
-{ $see-also <rect> <extent-rect> } ;
-
-HELP: <rect> ( loc dim -- rect )
-{ $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } { "newrect" "a new " { $link rect } } }
-{ $description "Creates a new rectangle with the specified top-left location and dimensions." } ;
-
-HELP: set-rect-dim ( dim rect -- )
-{ $values { "dim" "a pair of integers" } { "rect" rect } }
-{ $description "Modifies the dimensions of a rectangle. To resize a gadget, use " { $link set-gadget-dim } " or " { $link set-layout-dim } " instead." }
-{ $side-effects "rect" } ;
-
-HELP: rect-bounds
-{ $values { "rect" rect } { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
-{ $description "Outputs the location and dimensions of a rectangle." }
-{ $see-also rect-extent } ;
-
-HELP: <extent-rect> ( loc ext -- rect )
-{ $values { "loc" "a pair of integers" } { "ext" "a pair of integers" } { "rect" "a new " { $link rect } } }
-{ $description "Creates a new rectangle with the specified top-left and bottom-right corner locations." } ;
-
-HELP: rect-extent
-{ $values { "rect" rect } { "loc" "a pair of integers" } { "ext" "a pair of integers" } }
-{ $description "Outputs the location of the top-left and bottom-right corners of a rectangle." }
-{ $see-also rect-bounds } ;
-
-HELP: offset-rect
-{ $values { "rect" rect } { "loc" "a pair of integers" } { "newrect" "a new " { $link rect } } }
-{ $description "Creates a new rectangle with the same dimensions, and top-left corner translated by " { $snippet "loc" } "." } ;
-
-HELP: rect-intersect
-{ $values { "rect1" rect } { "rect2" rect } { "newrect" "a new " { $link rect } } }
-{ $description "Computes the intersection of two rectangles." } ;
-
-HELP: intersects?
-{ $values { "rect/point" "a " { $link rect } " or a pair of integers" } { "rect" rect } { "?" "a boolean" } }
-{ $description "Tests if two rectangles (or a point and a rectangle, respectively) have a non-empty intersection." } ;
-
-HELP: gadget
-{ $class-description "An object which displays itself on the screen and acts on user input gestures. Gadgets have the following slots:"
-    { $list
-        { { $link gadget-pref-dim } " - a cached value for " { $link pref-dim } "; do not read or write this slot directly." }
-        { { $link gadget-parent } " - the gadget containing this one, or " { $link f } " if this gadget is not part of the visible gadget hierarchy." }
-        { { $link gadget-children } " - a vector of child gadgets. Do not modify this vector directly, instead use " { $link add-gadget } ", " { $link add-gadgets } ", " { $link unparent } " or " { $link clear-gadget } "." }
-        { { $link gadget-orientation } " - one of " { $snippet "{ 0 1 }" } " or " { $snippet "{ 1 0 }" } ". This slot is used by layout gadgets such as " { $link pack } "." }
-        { { $link gadget-state } " - stores the layout state of the gadget. Do not read or write this slot directly, instead call " { $link relayout } " and " { $link relayout-1 } " if the gadget needs to be relayout." }
-        { { $link gadget-visible? } " - a boolean indicating if the gadget should display and receive user input." }
-        { { $link gadget-root? } " - if set to " { $link t } ", layout changes in this gadget will not propagate to the gadget's parent." }
-        { { $link gadget-clipped? } " - a boolean indicating if clipping will be enabled when drawing this gadget's children." }
-        { { $link gadget-grafted? } " - if set to " { $link t } ", the gadget is parented in a native window. Do not write this slot directly, instead add gadgets to visible gadgets or use " { $link open-window } " to display gadgets in new windows on the screen." }
-        { { $link gadget-interior } " - an object whose class implements the " { $link draw-interior } " generic word." }
-        { { $link gadget-boundary } " - an object whose class implements the " { $link draw-boundary } " generic word." }
-    }
-"Gadgets delegate to " { $link rect } " instances holding their location and dimensions." }
-{ $notes
-"Other classes may delegate to " { $link gadget } " in order to re-implement generic words such as " { $link draw-gadget* } " and " { $link user-input* } ", or to define gestures with " { $link set-gestures } " or " { $link define-commands } "." }
-{ $warning
-"When setting a tuple's delegate to be a gadget, " { $link set-gadget-delegate } " should be used instead of " { $link set-delegate } "." } ;
-
-HELP: gadget-child
-{ $values { "gadget" gadget } { "child" gadget } }
-{ $description "Outputs the first child of the gadget. Typically this word is used with gadgets which are known to have an only child." } ;
-
-HELP: nth-gadget
-{ $values { "n" "a non-negative integer" } { "gadget" gadget } { "child" gadget } }
-{ $description "Outputs the " { $snippet "n" } "th child of the gadget." }
-{ $errors "Throws an error if " { $snippet "n" } " is negative or greater than or equal to the number of children." } ;
-
-HELP: <zero-rect>
-{ $values { "rect" "a new " { $link rect } } }
-{ $description "Creates a rectangle located at the origin with zero dimensions." } ;
-
-HELP: <gadget>
-{ $values { "gadget" "a new " { $link gadget } } }
-{ $description "Creates a new gadget." }
-{ $see-also delegate>gadget } ;
-
-HELP: delegate>gadget
-{ $values { "tuple" tuple } }
-{ $description "Sets the tuple's delegate to a new " { $link gadget } "." }
-{ $side-effects "tuple" }
-{ $see-also <gadget> } ;
-
-HELP: relative-loc
-{ $values { "fromgadget" gadget } { "togadget" gadget } { "loc" "a pair of integers" } }
-{ $description
-    "Outputs the location of the top-left corner of " { $snippet "togadget" } " relative to the co-ordinate system of " { $snippet "fromgadget" } "."
-}
-{ $errors
-    "Throws an error if " { $snippet "togadget" } " is not contained in a child of " { $snippet "fromgadget" } "."
-} ;
-
-HELP: user-input*
-{ $values { "str" string } { "gadget" gadget } { "?" "a boolean" } }
-{ $contract "Handle string input while the gadget has keyboard focus. This word should be used to handle free-form keyboard input, not keyboard shortcut commands; use " { $link set-gestures } " or " { $link define-commands } " for shortcuts." } ;
-
-HELP: children-on
-{ $values { "rect/point" "a " { $link rect } " or a pair of integers" } { "gadget" gadget } }
-{ $contract "Outputs a sequence of gadgets which potentially intersect the rectangle or contain the point, respectively." }
-{ $notes "This does not have to be an accurate intersection test, and simply returning " { $link gadget-children } " is a valid implementation. However, an accurate intersection test reduces the amount of work done when drawing this gadget if it is partially clipped and not all children are visible." } ;
-
-HELP: pick-up
-{ $values { "point" "a pair of integers" } { "gadget" gadget } { "child" gadget } }
-{ $description "Outputs the child at the given location in " { $snippet "gadget" } ", or " { $link f } " if the point is outside the bounds of " { $snippet "gadget" } "." } ;
-
-HELP: max-dim
-{ $values { "dims" "a sequence of pairs of integers" } }
-{ $description "Outputs the smallest dimensions of a rectangle which can fit all the dimensions in the sequence." } ;
-
-HELP: each-child
-{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( child -- )" } } }
-{ $description "Applies the quotation to each child of the gadget." } ;
-
-HELP: each-child
-{ $values { "obj" object } { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( obj child -- )" } } }
-{ $description "Variant of " { $link each-child } " which pushes a retained object on each invocation of the quotation." } ;
-
-HELP: set-gadget-delegate
-{ $values { "gadget" gadget } { "tuple" tuple } }
-{ $description "Sets the delegate of " { $snippet "tuple" } " to " { $snippet "gadget" } ". This is like " { $link set-delegate } ", except that to ensure correct behavior, the parent of each child of " { $snippet "gadget" } " is changed to " { $snippet "tuple" } "." }
-{ $notes "This word should be used instead of " { $link set-delegate } " when setting a tuple's delegate to a gadget." } ;
-
-HELP: gadget-selection?
-{ $values { "gadget" gadget } { "?" "a boolean" } }
-{ $contract "Outputs if the gadget has an active text selection; if so, the selected text can be obtained with a call to " { $link gadget-selection } "." }
-{ $examples "The " { $link editor } " gadget implements the selection protocol." } ;
-
-HELP: gadget-selection
-{ $values { "gadget" gadget } { "string/f" "a " { $link string } " or " { $link f } } }
-{ $contract "Outputs the gadget's text selection, or " { $link f } " if nothing is selected." }
-{ $examples "The " { $link editor } " gadget implements the selection protocol." } ;
-
-HELP: timer-gadget
-{ $class-description "A gadget equipped with a timer which can be switched on and off by calling " { $link start-timer-gadget } " and " { $link stop-timer-gadget } ". The timer fires every 200 milliseconds." }
-{ $notes "More precise control over timer behavior can be achieved by using the timer words directly, instead of this class; see " { $link "timers" } "." } ;
-
-HELP: <timer-gadget>
-{ $values { "gadget" gadget } { "newgadget" "a new " { $link gadget } } }
-{ $description "Creates a new " { $link timer-gadget } " which delegates to the given gadget." }
-{ $see-also start-timer-gadget stop-timer-gadget } ;
-
-HELP: start-timer-gadget
-{ $values { "gadget" timer-gadget } { "quot" "a quotation with stack effect " { $snippet "( gadget -- )" } } }
-{ $description "Starts a timer which calls " { $snippet "quot" } " until a subsequent call to " { $link stop-timer-gadget } "." } ;
-
-HELP: stop-timer-gadget
-{ $values { "gadget" timer-gadget } }
-{ $description "Stops a timer started by a previous call to " { $link start-timer-gadget } "." } ;
diff --git a/core/ui/gadgets/books.factor b/core/ui/gadgets/books.factor
deleted file mode 100644 (file)
index cde10a4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-books
-USING: gadgets gadgets-panes gadgets-scrolling
-kernel sequences models ;
-
-TUPLE: book ;
-
-: hide-all ( book -- ) gadget-children [ hide-gadget ] each ;
-
-: current-page ( book -- gadget )
-    [ control-value ] keep nth-gadget ;
-
-M: book model-changed ( book -- )
-    dup hide-all
-    dup current-page show-gadget
-    dup relayout
-    request-focus ;
-
-C: book ( pages -- book )
-    dup 0 <model> <gadget> delegate>control
-    [ add-gadgets ] keep
-    dup model-changed ;
-
-M: book pref-dim* gadget-children pref-dims max-dim ;
-
-M: book layout*
-    dup rect-dim swap gadget-children
-    [ set-layout-dim ] each-with ;
-
-M: book focusable-child* current-page ;
diff --git a/core/ui/gadgets/books.facts b/core/ui/gadgets/books.facts
deleted file mode 100644 (file)
index b7d32ad..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-IN: gadgets-books
-USING: help gadgets ;
-
-HELP: book
-{ $class-description "A book is a " { $link control } " containing one or more children. The " { $link control-value } " is the index of exactly one child to be visible at any one time, the rest being hidden by having their " { $link gadget-visible? } " slots set to " { $link f } ". The sole visible child assumes the dimensions of the book gadget."
-$terpri
-"Books are created by calling " { $link <book> } "." } ;
-
-HELP: <book>
-{ $values { "pages" "a sequence of gadgets" } { "book" book } }
-{ $description "Creates a " { $link book } { $link control } ", which contains the gadgets in " { $snippet "pages" } " and displays exactly one at a time." } ;
diff --git a/core/ui/gadgets/borders.factor b/core/ui/gadgets/borders.factor
deleted file mode 100644 (file)
index 683a71b..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-borders
-USING: arrays errors gadgets gadgets-theme generic hashtables
-kernel math namespaces vectors sequences ;
-
-TUPLE: border size ;
-
-C: border ( child gap -- border )
-    dup delegate>gadget
-    [ >r dup 2array r> set-border-size ] keep
-    [ add-gadget ] keep ;
-
-: <default-border> ( child -- border ) 5 <border> ;
-
-: layout-border-loc ( border -- )
-    dup rect-dim swap gadget-child
-    [ pref-dim v- 2 v/n [ >fixnum ] map ] keep set-rect-loc ;
-
-M: border pref-dim*
-    [ border-size 2 v*n ] keep
-    gadget-child pref-dim v+ ;
-
-M: border layout*
-    dup layout-border-loc gadget-child prefer ;
diff --git a/core/ui/gadgets/borders.facts b/core/ui/gadgets/borders.facts
deleted file mode 100644 (file)
index 7b1ca27..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-IN: gadgets-borders
-USING: help gadgets ;
-
-HELP: border
-{ $class-description "A border gadget contains a single child and centers it, with a fixed-width border. Borders are created by calling " { $link <border> } " or " { $link <default-border> } "." } ;
-
-HELP: <border>
-{ $values { "child" gadget } { "gap" "a pair of integers" } { "border" "a new " { $link border } } }
-{ $description "Creates a new border around the child with the specified horizontal and vertical gap." }
-{ $see-also <default-border> } ;
-
-HELP: <default-border>
-{ $values { "child" gadget } { "border" "a new " { $link border } } }
-{ $description "Creates a 10-pixel border border around the child." }
-{ $see-also <border> } ;
diff --git a/core/ui/gadgets/buttons.factor b/core/ui/gadgets/buttons.factor
deleted file mode 100644 (file)
index e69e300..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-buttons
-USING: gadgets gadgets-borders gadgets-labels
-gadgets-theme generic io kernel math models namespaces sequences
-strings styles threads words ;
-
-TUPLE: button rollover? pressed? selected? quot ;
-
-: buttons-down? ( -- ? )
-    hand-buttons get-global empty? not ;
-
-: mouse-over? ( gadget -- ? )
-    hand-gadget get-global child? ;
-
-: mouse-clicked? ( gadget -- ? )
-    hand-clicked get-global child? ;
-
-: button-update ( button -- )
-    dup mouse-over? over set-button-rollover?
-    dup mouse-clicked? buttons-down? and
-    over button-rollover? and over set-button-pressed?
-    relayout-1 ;
-
-: if-clicked ( button quot -- )
-    >r dup button-update dup button-rollover? r> [ drop ] if ;
-
-: button-clicked ( button -- )
-    dup button-quot if-clicked ;
-
-button H{
-    { T{ button-up } [ button-clicked ] }
-    { T{ button-down } [ button-update ] }
-    { T{ mouse-leave } [ button-update ] }
-    { T{ mouse-enter } [ button-update ] }
-} set-gestures
-
-GENERIC: >label ( obj -- gadget )
-M: string >label <label> ;
-M: object >label ;
-M: f >label drop <gadget> ;
-
-C: button ( gadget quot -- button )
-    [ set-button-quot ] keep
-    [ set-gadget-delegate ] keep ;
-
-: <roll-button> ( label quot -- button )
-    >r >label r>
-    <button> dup roll-button-theme ;
-
-: <bevel-button> ( label quot -- button )
-    >r >label <default-border> r>
-    <button> dup bevel-button-theme ;
-
-TUPLE: repeat-button ;
-
-repeat-button H{
-    { T{ button-down } [ [ button-clicked ] start-timer-gadget ] }
-    { T{ button-up } [ dup stop-timer-gadget button-update ] }
-} set-gestures
-
-C: repeat-button ( label quot -- button )
-    #! Button that calls the quotation every 100ms as long as
-    #! the mouse is held down.
-    [
-        >r <bevel-button> <timer-gadget> r> set-gadget-delegate
-    ] keep ;
-
-TUPLE: button-paint plain rollover pressed selected ;
-
-: button-paint ( button paint -- button paint )
-    {
-        { [ over button-pressed? ] [ button-paint-pressed ] }
-        { [ over button-selected? ] [ button-paint-selected ] }
-        { [ over button-rollover? ] [ button-paint-rollover ] }
-        { [ t ] [ button-paint-plain ] }
-    } cond ;
-
-M: button-paint draw-interior
-    button-paint draw-interior ;
-
-M: button-paint draw-boundary
-    button-paint draw-boundary ;
-
-: <radio-control> ( model value label -- gadget )
-    over [ swap set-control-value ] curry <bevel-button>
-    swap [ swap >r = r> set-button-selected? ] curry <control> ;
-
-: <radio-box> ( model assoc -- gadget )
-    [ first2 <radio-control> ] map-with make-shelf ;
diff --git a/core/ui/gadgets/buttons.facts b/core/ui/gadgets/buttons.facts
deleted file mode 100644 (file)
index 8ca38b2..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-IN: gadgets-buttons
-USING: help gadgets gadgets-labels gadgets-presentations
-generic models ;
-
-HELP: button
-{ $class-description "A button is a " { $link gadget } " which responds to mouse clicks by invoking a quotation."
-$terpri
-"A button's appearance can vary depending on the state of the mouse button if the " { $link gadget-interior } " or " { $link gadget-boundary } " slots are set to instances of " { $link button-paint } "."
-$terpri
-"A button can be selected, which is distinct from being pressed. This state is held in the " { $link button-selected? } " slot, and is used by the " { $link <radio-box> } " word to construct a row of buttons for choosing among several alternatives." } ;
-
-HELP: >label
-{ $values { "obj" object } }
-{ $description "Convert the object into a gadget suitable for use as the label of a button. If " { $snippet "obj" } " is already a gadget, does nothing. Otherwise creates a " { $link label } " gadget if it is a string and an empty gadget if " { $snippet "obj" } " is " { $link f } "." } ;
-
-HELP: <button>
-{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } { "button" "a new " { $link button } } }
-{ $description "Creates a new " { $link button } " which calls the quotation when clicked. The given gadget becomes the button's delegate." }
-{ $see-also <bevel-button> <command-button> <roll-button> <presentation> } ;
-
-HELP: <roll-button>
-{ $values { "label" object } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } }
-{ $description "Creates a new " { $link button } " which is displayed with a solid border when it is under the mouse, informing the user that the gadget is clickable. The label is converted into a gadget by calling " { $link >label } "." }
-{ $see-also <button> <bevel-button> <command-button> <roll-button> <presentation> } ;
-
-HELP: <bevel-button>
-{ $values { "label" object } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } }
-{ $description "Creates a new " { $link button } " with a shaded border which is always visible. The label is converted into a gadget by calling " { $link >label } ". The button appearance changes in response to mouse gestures using a " { $link button-paint } "." }
-{ $see-also <button> <roll-button> <command-button> <repeat-button> <presentation> } ;
-
-HELP: <repeat-button>
-{ $values { "label" object } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } }
-{ $description "Creates a new " { $link button } " derived from a " { $link <bevel-button> } " which calls the quotation every 100 milliseconds as long as the mouse button is held down." }
-{ $see-also <button> <bevel-button> } ;
-
-HELP: button-paint
-{ $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " gneeric words by delegating to an object in one of four slots which depend on the state of the button being drawn:"
-    { $list
-        { { $link button-paint-plain } " - the button is inactive" }
-        { { $link button-paint-rollover } " - the button is under the mouse" }
-        { { $link button-paint-pressed } " - the button is under the mouse and a mouse button is held down" }
-        { { $link button-paint-selected } " - the button is selected (see " { $link <radio-box> }  }
-    }
-"The " { $link <roll-button> } " and " { $link <bevel-button> } " words create " { $link button } " instances with specific " { $link button-paint } "." } ;
-
-HELP: <radio-control>
-{ $values { "model" model } { "value" object } { "label" object } }
-{ $description
-    "Creates a " { $link <bevel-button> } " which sets the model's value to " { $snippet "value" } " when pressed. After being pressed, the button becomes selected until the value of the model changes again. The label is converted into a gadget by calling " { $link >label } "."
-}
-{ $notes "Typically a row of radio controls should be built together using " { $link <radio-box> } "." } ;
-
-HELP: <radio-box>
-{ $values { "model" model } { "assoc" "an association list mapping labels to objects" } }
-{ $description "Creates a row of labelled " { $link <radio-control> } " gadgets which change the value of the model." } ;
diff --git a/core/ui/gadgets/controls.factor b/core/ui/gadgets/controls.factor
deleted file mode 100644 (file)
index 47a1d0e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel models ;
-IN: gadgets
-
-TUPLE: control self model quot ;
-
-C: control ( model gadget quot -- gadget )
-    dup dup set-control-self
-    [ set-control-quot ] keep
-    [ set-gadget-delegate ] keep
-    [ set-control-model ] keep ;
-
-: control-value ( control -- value )
-    control-model model-value ;
-
-: set-control-value ( value control -- )
-    control-model set-model ;
-
-M: control graft*
-    control-self dup dup control-model add-connection
-    model-changed ;
-
-M: control ungraft*
-    control-self dup control-model remove-connection ;
-
-M: control model-changed
-    control-self
-    [ control-value ] keep
-    [ dup control-quot call ] keep
-    relayout ;
-
-: delegate>control ( gadget model underlying -- )
-    [ 2drop ] <control> over set-gadget-delegate
-    dup set-control-self ;
diff --git a/core/ui/gadgets/controls.facts b/core/ui/gadgets/controls.facts
deleted file mode 100644 (file)
index fed8c7a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-IN: gadgets
-USING: help gadgets-buttons gadgets-panes gadgets-labels
-generic models kernel ;
-
-HELP: control
-{ $class-description "A control is a " { $link gadget } " linked with a " { $link model } " stored in the " { $link control-model } " slot. Changes to the model are reflected in the appearance and behavior of the control, and the control may in turn change the value of the model in response to user input."
-$terpri
-"Controls are created by calling " { $link <control> } " and " { $link delegate>control } ". Other words to create controls include:"
-{ $list
-    { $link <label-control> }
-    { $link <radio-control> }
-    { $link <pane-control> }
-}
-$terpri
-"Objects may delegate to " { $link control } " instances, in which case the " { $link control-self } " slot must be set to the frontmost object in the delegation chain. This ensures that the correct object receives notification of model changes." }
-{ $see-also control-value set-control-value } ;
-
-HELP: <control>
-{ $values { "model" model } { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( value control -- )" } } }
-{ $description "Creates a new control linked to the given model. The gadget parameter becomes the control's delegate. The quotation is called when the model value changes," }
-{ $see-also delegate>control control-value set-control-value } ;
-
-HELP: control-value
-{ $values { "control" control } { "value" object } }
-{ $description "Outputs the value of the control's model." } ;
-
-HELP: set-control-value
-{ $values { "value" object } { "control" control } }
-{ $description "Sets the value of the control's model." } ;
-
-HELP: delegate>control
-{ $values { "tuple" tuple } { "model" model } { "underlying" gadget } }
-{ $description "Creates a new " { $link control } " and creates a delegation chain where " { $snippet "tuple" } " at the front delegates to the new " { $link control } " which delegates to " { $snippet "underlying" } ". The " { $link model-changed } " word is called on " { $snippet "tuple" } " when the model changes." }
-{ $side-effects "tuple" }
-{ $see-also <control> } ;
diff --git a/core/ui/gadgets/frames.factor b/core/ui/gadgets/frames.factor
deleted file mode 100644 (file)
index b1df6d4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays generic kernel math namespaces sequences words ;
-
-! A frame arranges gadgets in a 3x3 grid, where the center
-! gadgets gets left-over space.
-TUPLE: frame ;
-
-: <frame-grid> 9 [ drop <gadget> ] map 3 group ;
-
-: @center 1 1 ;
-: @left 0 1 ;
-: @right 2 1 ;
-: @top 1 0 ;
-: @bottom 1 2 ;
-
-: @top-left 0 0 ;
-: @top-right 2 0 ;
-: @bottom-left 0 2 ;
-: @bottom-right 2 2 ;
-
-C: frame ( -- frame )
-    <frame-grid> <grid> over set-gadget-delegate ;
-
-: delegate>frame ( tuple -- ) <frame> swap set-delegate ;
-
-: (fill-center) ( vec n -- )
-    over first pick third v+ [v-] 1 rot set-nth ;
-
-: fill-center ( horiz vert dim -- )
-    tuck (fill-center) (fill-center) ;
-
-M: frame layout*
-    dup [
-        [ rot rect-dim fill-center ] 2keep grid-layout
-    ] with-grid ;
-
-: make-frame ( specs -- gadget )
-    <frame> [ swap build-grid ] keep ; inline
-
-: make-frame* ( tuple specs -- gadget )
-    over [ delegate>frame build-grid ] keep ; inline
diff --git a/core/ui/gadgets/frames.facts b/core/ui/gadgets/frames.facts
deleted file mode 100644 (file)
index 44a7b24..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-IN: help
-USING: gadgets kernel arrays ;
-
-: $ui-frame-constant ( element -- )
-    drop
-    { $description "Symbolic constant for a common input to " { $link grid-add } "." } print-element ;
-
-IN: gadgets
-
-HELP: @center $ui-frame-constant ;
-HELP: @left $ui-frame-constant ;
-HELP: @right $ui-frame-constant ;
-HELP: @top $ui-frame-constant ;
-HELP: @bottom $ui-frame-constant ;
-HELP: @top-left $ui-frame-constant ;
-HELP: @top-right $ui-frame-constant ;
-HELP: @bottom-left $ui-frame-constant ;
-HELP: @bottom-right $ui-frame-constant ;
-
-HELP: frame
-{ $class-description "A frame is a gadget which lays out its children in a 3x3 grid. If the frame is enlarged past its preferred size, the center gadget fills up available room."
-$terpri
-"Frames are constructed by calling " { $link <frame> } " and since they delegate to " { $link grid } " instances, children can be managed with " { $link grid-add } " and " { $link grid-remove } "." }
-{ $see-also delegate>frame make-frame make-frame* } ;
-
-HELP: <frame>
-{ $values { "frame" frame } }
-{ $description "Creates a new " { $link frame } " for laying out gadgets in a 3x3 grid." }
-{ $see-also delegate>frame make-frame make-frame* } ;
-
-HELP: delegate>frame
-{ $values { "tuple" tuple } }
-{ $description "Sets the tuple's delegate to a new " { $link frame } "." } 
-{ $side-effects "frame" } ;
-
-HELP: make-frame
-{ $values { "specs" array } { "frame" frame } }
-{ $description "Creates a new frame from a declarative specification. See " { $link build-grid } " for a description of the format of " { $snippet "spec" } "." } ;
-
-HELP: make-frame*
-{ $values { "tuple" tuple } { "specs" array } { "frame" frame } }
-{ $description "Creates a new frame from a declarative specification and sets " { $snippet "tuple" } "'s delegate to the new frame. See " { $link build-grid } " for a description of the format of " { $snippet "spec" } "." } ;
diff --git a/core/ui/gadgets/grid-lines.factor b/core/ui/gadgets/grid-lines.factor
deleted file mode 100644 (file)
index 013c432..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: kernel math namespaces opengl sequences ;
-
-TUPLE: grid-lines color ;
-
-SYMBOL: grid-dim
-
-: half-gap gap 2 v/n ; inline
-
-: grid-line-from/to ( orientation point -- from to )
-    half-gap v-
-    [ half-gap swap rot set-axis ] 2keep
-    grid-dim get swap rot set-axis ;
-
-: draw-grid-lines ( gaps orientation -- )
-    swap grid-positions grid get rect-dim { 1 0 } v- add
-    [ grid-line-from/to gl-line ] each-with ;
-
-M: grid-lines draw-boundary
-    origin get [
-        grid-lines-color gl-color [
-            grid get rect-dim half-gap v- grid-dim set
-            { 0 1 } draw-grid-lines
-            { 1 0 } draw-grid-lines
-        ] with-grid
-    ] with-translation ;
diff --git a/core/ui/gadgets/grid-lines.facts b/core/ui/gadgets/grid-lines.facts
deleted file mode 100644 (file)
index 063daa8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-IN: gadgets
-USING: help ;
-
-HELP: grid-lines
-{ $class-description "A class implementing the " { $link draw-boundary } " generic word to draw lines between the cells of a " { $link grid } ". The color of the lines is a color specifier stored in the " { $link grid-lines-color } " slot." } ;
diff --git a/core/ui/gadgets/grids.factor b/core/ui/gadgets/grids.factor
deleted file mode 100644 (file)
index b92717c..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays kernel math namespaces sequences words ;
-
-TUPLE: grid children gap ;
-
-: set-grid-children* ( children grid -- )
-    [ set-grid-children ] 2keep >r concat r> add-gadgets ;
-
-C: grid ( children -- grid )
-    dup delegate>gadget
-    [ set-grid-children* ] keep
-    { 0 0 } over set-grid-gap ;
-
-: grid-child ( grid i j -- gadget ) rot grid-children nth nth ;
-
-: grid-add ( gadget grid i j -- )
-    >r >r 2dup add-gadget r> r>
-    3dup grid-child unparent rot grid-children nth set-nth ;
-
-: grid-remove ( grid i j -- )
-    >r >r >r <gadget> r> r> r> grid-add ;
-
-: pref-dim-grid ( -- dims )
-    grid get grid-children [ [ pref-dim ] map ] map ;
-
-: compute-grid ( -- horiz vert )
-    pref-dim-grid
-    dup flip [ max-dim ] map swap [ max-dim ] map ;
-
-: with-grid ( grid quot -- )
-    [ >r grid set compute-grid r> call ] with-scope ; inline
-
-: gap grid get grid-gap ;
-
-: (pair-up) ( horiz vert -- dim ) >r first r> second 2array ;
-
-M: grid pref-dim*
-    [
-        [ gap [ v+ gap v+ ] reduce ] 2apply (pair-up)
-    ] with-grid ;
-
-: do-grid ( dims quot -- )
-    swap grid get grid-children
-    [ [ pick call ] 2each ] 2each
-    drop ; inline
-
-: pair-up ( horiz vert -- dims )
-    [ swap [ swap (pair-up) ] map-with ] map-with ;
-
-: grid-positions ( dims -- locs )
-    gap [ v+ gap v+ ] accumulate nip ;
-
-: position-grid ( horiz vert -- )
-    [ grid-positions ] 2apply
-    pair-up [ set-rect-loc ] do-grid ;
-
-: resize-grid ( horiz vert -- )
-    pair-up [ set-layout-dim ] do-grid ;
-
-: grid-layout ( horiz vert -- )
-    2dup position-grid resize-grid ;
-
-M: grid layout*
-    [ grid-layout ] with-grid ;
-
-: build-grid ( grid specs -- )
-    swap [ [ grid-add ] build-spec ] with-gadget ; inline
-
-M: grid children-on ( rect gadget -- seq )
-    dup gadget-children empty? [
-        2drop f
-    ] [
-        { 0 1 } swap grid-children
-        [ 0 <column> fast-children-on ] keep
-        <slice> concat
-    ] if ;
diff --git a/core/ui/gadgets/grids.facts b/core/ui/gadgets/grids.facts
deleted file mode 100644 (file)
index d465d89..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-IN: gadgets
-USING: help arrays ;
-
-HELP: grid
-{ $class-description "A grid gadget lays out its children so that all gadgets in a column have equal width and all gadgets in a row have equal height. The " { $link grid-gap } " slot stores a pair of integers, the horizontal and vertical gap between children, respectively."
-$terpri
-"Grids are created by calling " { $link <grid> } " and children are managed with " { $link grid-add } " and " { $link grid-remove } "."
-$terpri
-"The " { $link add-gadget } ", " { $link unparent } " and " { $link clear-gadget } " words should not be used to manage child gadgets of grids." }
-{ $see-also frame } ;
-
-HELP: <grid>
-{ $values { "children" "a sequence of sequences of gadgets" } }
-{ $description "Creates a new " { $link grid } " gadget with the given children." } ;
-
-HELP: grid-child
-{ $values { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } }
-{ $description "Outputs the child gadget at the " { $snippet "i" } "," { $snippet "j" } "th position of the grid." }
-{ $errors "Throws an error if the indices are out of bounds." } ;
-
-HELP: grid-add
-{ $values { "gadget" gadget } { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } }
-{ $description "Adds a child gadget at the specified location." }
-{ $side-effects "grid" } ;
-
-HELP: grid-remove
-{ $values { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } }
-{ $description "Removes a child gadget from the specified location." }
-{ $side-effects "grid" } ;
-
-HELP: build-grid
-{ $values { "grid" grid } { "specs" array } }
-{ $description "Constructs gadgets and adds them to the grid by interpreting " { $snippet "spec" } ", which is an array of quadruples of the form " { $snippet "{ quot setter post loc }" } ". The quadruples break down as follows:"
-    { $list
-        { { $snippet "quot" } " - a quotation which pushes a new gadget on the stack. The quotation is permitted to consume values from the stack, and it is up to the caller of " { $link build-grid } " to prove the correct amount." }
-        { { $snippet "setter" } " - a word with stack effect " { $snippet "( gadget grid -- )" } ". If " { $snippet "grid" } " is a tuple delegating to a " { $link grid } ", this can be used to store the new gadget in a tuple slot." }
-        { { $snippet "post" } " - a quotation with stack effect " { $snippet "( gadget -- newgadget )" } ", applied to the gadget before it is added to the grid" }
-        { { $snippet "loc" } " - a word with stack effect " { $snippet "( -- i j )" } " which pushes the grid location where to add the new gadget, for example " { $link @center } "." }
-    }
-}
-{ $see-also make-frame make-frame* } ;
diff --git a/core/ui/gadgets/incremental.factor b/core/ui/gadgets/incremental.factor
deleted file mode 100644 (file)
index a06d14d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: generic io kernel math namespaces ;
-
-! Incremental layout allows adding lines to panes to be O(1).
-! Note that incremental packs are distinct from ordinary packs
-! defined in layouts.factor, since you don't want all packs to
-! be incremental. In particular, incremental packs do not
-! support non-default values for pack-align, pack-fill and
-! pack-gap.
-
-! The cursor is the current size of the incremental pack.
-! New gadgets are added at cursor-cursor*gadget-orientation.
-
-TUPLE: incremental cursor ;
-
-C: incremental ( pack -- incremental )
-    [ set-gadget-delegate ] keep
-    dup delegate pref-dim over set-incremental-cursor ;
-
-M: incremental pref-dim*
-    dup gadget-state [
-        dup delegate pref-dim over set-incremental-cursor
-    ] when incremental-cursor ;
-
-: next-cursor ( gadget incremental -- cursor )
-    [
-        swap rect-dim swap incremental-cursor
-        2dup v+ >r vmax r>
-    ] keep gadget-orientation set-axis ;
-
-: update-cursor ( gadget incremental -- )
-    [ next-cursor ] keep set-incremental-cursor ;
-
-: incremental-loc ( gadget incremental -- )
-    dup incremental-cursor swap gadget-orientation v*
-    swap set-rect-loc ;
-
-: prefer-incremental ( gadget -- )
-    dup forget-pref-dim dup pref-dim over set-rect-dim layout ;
-
-: add-incremental ( gadget incremental -- )
-    2dup (add-gadget)
-    over prefer-incremental
-    2dup incremental-loc
-    tuck update-cursor
-    dup prefer-incremental
-    gadget-parent [ invalidate* ] when* ;
-
-: clear-incremental ( incremental -- )
-    dup (clear-gadget) dup forget-pref-dim
-    { 0 0 } over set-incremental-cursor
-    gadget-parent [ relayout ] when* ;
diff --git a/core/ui/gadgets/incremental.facts b/core/ui/gadgets/incremental.facts
deleted file mode 100644 (file)
index 6b6acc7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-IN: gadgets
-USING: help ;
-
-HELP: incremental
-{ $class-description "An incremental layout gadget delegates to a " { $link pack } " and implements an optimization which the relayout operation after adding a child to be done in constant time."
-$terpri
-"Incremental layout gadgets are created by calling " { $link <incremental> } "."
-$terpri
-"Children are managed with the " { $link add-incremental } " and " { $link clear-incremental } " words."
-$terpri
-"Not every " { $link pack } " can use incremental layout, since incremental layout does not support non-default values for " { $link pack-align } ", " { $link pack-fill } ", and " { $link pack-gap } "." } ;
-
-HELP: <incremental>
-{ $values { "pack" pack } { "incremental" "a new instance of " { $link incremental } } }
-{ $description "Creates a new incremental layout gadget delegating to " { $snippet "pack" } "." }
-{ $see-also add-incremental clear-incremental } ;
-
-HELP: add-incremental
-{ $values { "gadget" gadget } { "incremental" incremental } }
-{ $description "Adds the gadget to the incremental layout and performs relayout immediately in constant time." }
-{ $side-effects "incremental" }
-{ $see-also add-gadget clear-incremental } ;
-
-HELP: clear-incremental
-{ $values { "incremental" incremental } }
-{ $description "Removes all gadgets from the incremental layout and performs relayout immediately in constant time." }
-{ $side-effects "incremental" }
-{ $see-also add-gadget clear-incremental } ;
diff --git a/core/ui/gadgets/labelled-gadget.factor b/core/ui/gadgets/labelled-gadget.factor
deleted file mode 100644 (file)
index 37b7353..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-IN: gadgets
-USING: arrays errors gadgets gadgets-buttons
-gadgets-labels gadgets-theme gadgets-panes gadgets-scrolling
-generic hashtables io kernel math models namespaces prettyprint
-queues sequences test threads help sequences words timers ;
-
-TUPLE: labelled-gadget content ;
-
-C: labelled-gadget ( gadget title -- newgadget )
-    {
-        { [ <label> dup reverse-video-theme ] f f @top }
-        { f set-labelled-gadget-content f @center }
-    } make-frame* ;
-
-M: labelled-gadget focusable-child* labelled-gadget-content ;
-
-: <labelled-pane> ( model quot title -- gadget )
-    >r <pane-control> t over set-pane-scrolls? <scroller> r>
-    <labelled-gadget> ;
-
-: <close-box> ( quot -- button/f )
-    gray close-box <polygon-gadget> swap <bevel-button> ;
-
-: <title-label> <label> dup title-theme ;
-
-: <title-bar> ( title quot -- gadget )
-    [
-        {
-            { [ <close-box> ] f f @left }
-            { [ <title-label> ] f f @center }
-        } make-frame
-    ] [
-        <title-label>
-    ] if* ;
-
-TUPLE: closable-gadget content ;
-
-C: closable-gadget ( gadget title quot -- gadget )
-    {
-        { [ <title-bar> ] f f @top }
-        { f set-closable-gadget-content f @center }
-    } make-frame* ;
-
-M: closable-gadget focusable-child* closable-gadget-content ;
diff --git a/core/ui/gadgets/labelled-gadget.facts b/core/ui/gadgets/labelled-gadget.facts
deleted file mode 100644 (file)
index a75216a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: gadgets
-USING: help strings ;
-
-HELP: labelled-gadget
-{ $class-description "A labelled gadget can be created by calling " { $link <labelled-gadget> } "." } ;
-
-HELP: <labelled-gadget>
-{ $values { "gadget" gadget } { "title" string } { "newgadget" "a new " { $link <labelled-gadget> } } }
-{ $description "Creates a new " { $link labelled-gadget } " display " { $snippet "gadget" } " with " { $snippet "title" } " on top." } ;
-
-HELP: closable-gadget
-{ $class-description "A closable gadget displays a title bar with a close box on top of another gadget. Clicking the close box invokes a quotation. Closable gadgets are created by calling " { $link <closable-gadget> } "." } ;
-
-HELP: <closable-gadget>
-{ $values { "gadget" gadget } { "title" string } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } }
-{ $description "Creates a new " { $link closable-gadget } ". Clicking the close box calls " { $snippet "quot" } "." }
-{ $notes "The quotation can find the " { $link closable-gadget } " instance, or any other parent gadget by calling " { $link find-parent } " with the gadget it receives on the stack." } ;
diff --git a/core/ui/gadgets/labels.factor b/core/ui/gadgets/labels.factor
deleted file mode 100644 (file)
index ca26b15..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-labels
-USING: arrays freetype gadgets gadgets-theme
-generic hashtables io kernel math namespaces opengl sequences
-styles strings ;
-
-! A label gadget draws a string.
-TUPLE: label text font color ;
-
-: label-string ( label -- string )
-    label-text dup string? [ "\n" join ] unless ; inline
-
-: set-label-string ( string label -- )
-    CHAR: \n pick memq? [
-        >r string-lines r> set-label-text
-    ] [
-        set-label-text
-    ] if ; inline
-
-C: label ( string -- label )
-    dup delegate>gadget
-    [ set-label-string ] keep
-    dup label-theme ;
-
-M: label pref-dim*
-    dup label-font open-font swap label-text text-dim ;
-
-M: label draw-gadget*
-    dup label-color gl-color
-    dup label-font swap label-text origin get draw-text ;
-
-: <label-control> ( model -- gadget )
-    "" <label> [ set-label-string ] <control> ;
diff --git a/core/ui/gadgets/labels.facts b/core/ui/gadgets/labels.facts
deleted file mode 100644 (file)
index 54cb5c0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-IN: gadgets-labels
-USING: help strings gadgets models ;
-
-HELP: label
-{ $class-description "A label displays a piece of text, either a single line string or an array of line strings. Labels are created by calling " { $link <label> } "." }
-{ $see-also label-string set-label-string <label-control> } ;
-
-HELP: <label>
-{ $values { "string" string } { "label" "a new " { $link label } } }
-{ $description "Creates a new " { $link label } " gadget. The string is permitted to contain line breaks." }
-{ $see-also label-string set-label-string <label-control> } ;
-
-HELP: label-string
-{ $values { "label" label } { "string" string } }
-{ $description "Outputs the string currently displayed by the label." } ;
-
-HELP: set-label-string
-{ $values { "label" label } { "string" string } }
-{ $description "Sets the string currently displayed by the label. The string is permitted to contain line breaks. After calling this word, you must also call " { $link relayout } " on the label." } ;
-
-HELP: <label-control>
-{ $values { "model" model } }
-{ $description "Creates a " { $link control } " which displays the value of " { $snippet "model" } ", which is required to be a string. The label control is automatically updated when the model value changes." } ;
diff --git a/core/ui/gadgets/lists.factor b/core/ui/gadgets/lists.factor
deleted file mode 100644 (file)
index f673cee..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-lists
-USING: gadgets gadgets-labels gadgets-scrolling kernel sequences
-generic models opengl math namespaces gadgets-theme
-gadgets-presentations ;
-
-TUPLE: list index presenter color hook ;
-
-: list-theme ( list -- )
-    { 0.8 0.8 1.0 1.0 } swap set-list-color ;
-
-C: list ( hook presenter model -- gadget )
-    [ swap <pile> delegate>control ] keep
-    [ set-list-presenter ] keep
-    [ set-list-hook ] keep
-    0 over set-list-index
-    1 over set-pack-fill
-    dup list-theme ;
-
-: bound-index ( list -- )
-    dup list-index over control-value length 1- max 0 min
-    swap set-list-index ;
-
-: list-presentation-hook ( list -- quot )
-    list-hook [ [ [ list? ] is? ] find-parent ] swap append ;
-
-: <list-presentation> ( hook presenter elt -- gadget )
-    [ swap call ] keep <presentation>
-    [ set-presentation-hook ] keep
-    [ text-theme ] keep ;
-
-: <list-items> ( list -- seq )
-    dup list-presentation-hook
-    over list-presenter
-    rot control-value [
-        >r 2dup r> <list-presentation>
-    ] map 2nip ;
-
-M: list model-changed
-    dup clear-gadget
-    dup <list-items> over add-gadgets
-    bound-index ;
-
-: selected-rect ( list -- rect )
-    dup list-index swap gadget-children 2dup bounds-check?
-    [ nth ] [ 2drop f ] if ;
-
-M: list draw-gadget*
-    origin get [
-        dup list-color gl-color
-        selected-rect [ rect-extent gl-fill-rect ] when*
-    ] with-translation ;
-
-M: list focusable-child* drop t ;
-
-: list-value ( list -- object )
-    dup list-index swap control-value ?nth ;
-
-: scroll>selected ( list -- )
-    #! We change the rectangle's width to zero to avoid
-    #! scrolling right.
-    [ selected-rect rect-bounds { 0 1 } v* <rect> ] keep
-    scroll>rect ;
-
-: list-empty? ( list -- ? ) control-value empty? ;
-
-: select-index ( n list -- )
-    dup list-empty? [
-        2drop
-    ] [
-        [ control-value length rem ] keep
-        [ set-list-index ] keep
-        [ relayout-1 ] keep
-        scroll>selected
-    ] if ;
-
-: select-prev ( list -- )
-    dup list-index 1- swap select-index ;
-
-: select-next ( list -- )
-    dup list-index 1+ swap select-index ;
-
-: list-action ( list -- )
-    dup list-empty? [
-        dup list-hook call
-    ] [
-        dup list-index swap nth-gadget invoke-secondary
-    ] if ; inline
-
-list "commands" {
-    { "Request focus" T{ button-down } [ request-focus ] }
-    { "Select previous value" T{ key-down f f "UP" } [ select-prev ] }
-    { "Select next value" T{ key-down f f "DOWN" } [ select-next ] }
-    { "Invoke value action" T{ key-down f f "RETURN" } [ list-action ] }
-} define-commands
diff --git a/core/ui/gadgets/lists.facts b/core/ui/gadgets/lists.facts
deleted file mode 100644 (file)
index bd290cc..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-IN: gadgets-lists
-USING: help gadgets gadgets-presentations generic models ;
-
-HELP: list
-{ $class-description
-    "A list " { $link control } " is backed by a " { $link model } " holding a sequence of objects, and displays as a list of " { $link presentation } " instances of these objects."
-    $terpri
-    "Lists are created by calling " { $link <list> } "."
-    $terpri
-    "Lists can be navigated from the keyboard:"
-    { $commands list "commands" }
-} ;
-
-HELP: <list>
-{ $values { "hook" "a quotation with stack effect " { $snippet "( list -- )" } } { "presenter" "a quotation with stack effect " { $snippet "( object -- label )" } } { "model" model } }
-{ $description "Creates a new " { $link list } "."
-$terpri
-"The model value must be a sequence. The list displays presentations of elements with labels obtained by applying the " { $snippet "presenter" } " quotation to each object. The " { $snippet "hook" } " quotation is called when a presentation is selected." } ;
-
-HELP: list-value
-{ $values { "list" list } { "object" object } }
-{ $description "Outputs the currently selected list value." } ;
diff --git a/core/ui/gadgets/menus.factor b/core/ui/gadgets/menus.factor
deleted file mode 100644 (file)
index ef70287..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays errors freetype gadgets generic hashtables
-kernel math models namespaces opengl sequences ;
-
-: menu-loc ( world menu -- loc )
-    >r rect-dim r> pref-dim [v-] hand-loc get-global vmin ;
-
-TUPLE: menu-glass ;
-
-C: menu-glass ( menu world -- glass )
-    dup delegate>gadget
-    >r over menu-loc over set-rect-loc r>
-    [ add-gadget ] keep ;
-
-M: menu-glass layout* gadget-child prefer ;
-
-: hide-glass ( world -- )
-    dup world-glass [ unparent ] when*
-    f swap set-world-glass ;
-
-: show-glass ( gadget world -- )
-    over hand-clicked set-global
-    [ hide-glass ] keep
-    [ add-gadget ] 2keep
-    set-world-glass ;
-
-: show-menu ( gadget owner -- )
-    find-world [ <menu-glass> ] keep show-glass ;
-
-\ menu-glass H{
-    { T{ button-down } [ find-world [ hide-glass ] when* ] }
-    { T{ drag } [ update-clicked drop ] }
-} set-gestures
diff --git a/core/ui/gadgets/menus.facts b/core/ui/gadgets/menus.facts
deleted file mode 100644 (file)
index bda0f13..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-IN: gadgets
-USING: help gadgets-presentations ;
-
-HELP: show-menu
-{ $values { "gadget" gadget } { "owner" gadget } }
-{ $description "Displays a popup menu in the " { $link world } " containing " { $snippet "owner" } " at the current mouse location." }
-{ $see-also <commands-menu> operations-menu } ;
diff --git a/core/ui/gadgets/outliner.factor b/core/ui/gadgets/outliner.factor
deleted file mode 100644 (file)
index 71e492b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-outliners
-USING: arrays gadgets gadgets-borders gadgets-buttons
-gadgets-labels gadgets-theme generic io kernel
-math opengl sequences styles namespaces ;
-
-TUPLE: guide color ;
-
-M: guide draw-interior
-    guide-color gl-color
-    rect-dim dup first 2 /i 0 2array origin get v+
-    swap first2 >r 2 /i r> 2array origin get v+ gl-line ;
-
-: guide-theme ( gadget -- )
-    T{ guide f { 0.5 0.5 0.5 1.0 } } swap set-gadget-interior ;
-
-: <guide-gadget> ( -- gadget )
-    <gadget> dup guide-theme ;
-
-TUPLE: outliner quot ;
-
-: find-outliner ( gadget -- outliner )
-    [ outliner? ] find-parent ;
-
-: <expand-arrow> ( ? -- gadget )
-    arrow-right arrow-down ? { 0.5 0.5 0.5 1.0 } swap
-    <polygon-gadget> <default-border> ;
-
-DEFER: set-outliner-expanded?
-
-: <expand-button> ( ? -- button )
-    #! If true, the button expands, otherwise it collapses.
-    dup [ swap find-outliner set-outliner-expanded? ] curry
-    >r <expand-arrow> r> <button> ;
-
-: setup-expand ( expanded? outliner -- )
-    >r not <expand-button> r> @top-left grid-add ;
-
-: setup-center ( expanded? outliner -- )
-    [
-        swap [ outliner-quot call ] [ drop <gadget> ] if
-    ] keep @center grid-add ;
-
-: setup-guide ( expanded? outliner -- )
-    >r [ <guide-gadget> ] [ <gadget> ] if r> @left grid-add ;
-
-: set-outliner-expanded? ( ? outliner -- )
-    2dup setup-expand 2dup setup-center setup-guide ;
-
-C: outliner ( gadget quot -- gadget )
-    dup delegate>frame
-    [ set-outliner-quot ] keep
-    [ >r 1array make-shelf r> @top grid-add ] keep
-    f over set-outliner-expanded? ;
diff --git a/core/ui/gadgets/outliner.facts b/core/ui/gadgets/outliner.facts
deleted file mode 100644 (file)
index ef6a75d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-IN: gadgets-outliners
-USING: help gadgets gadgets-buttons kernel ;
-
-HELP: guide
-{ $class-description "A class implementing the " { $link draw-interior } " generic word to draw a single vertical line." } ;
-
-HELP: outliner
-{ $class-description "An outliner is a " { $link gadget } " with an expander arrow which can be clicked to show and hide a child gadget generated by the quotation stored in the " { $link outliner-quot } " slot. Outliners are created by calling " { $link <outliner> } "." }
-{ $see-also <outliner> "presentations" } ;
-
-HELP: <expand-button>
-{ $values { "?" "a boolean" } { "button" "a new " { $link button } } }
-{ $description "Creates a " { $link button } " which calls " { $link set-outliner-expanded? } " on an " { $link outliner } " parent with the given boolean." } ;
-
-HELP: set-outliner-expanded?
-{ $values { "?" "a boolean" } { "outliner" outliner } }
-{ $description "Shows or hides the content out of the outliner, depending on the value of the boolean. The content is generated by calling " { $link outliner-quot } "." }
-{ $see-also <outliner> } ;
-
-HELP: <outliner>
-{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( -- newgadget )" } } }
-{ $description { "Creates an " { $link outliner } " which displays " { $snippet "gadget" } " together with an expander arrow."
-$terpri
-"Clicking the expander arrow calls the quotation to generate a new gadget, and adds the gadget to the outliner. Clicking the expander arrow again removes the new gadget." } }
-{ $see-also "presentations" } ;
diff --git a/core/ui/gadgets/panes.factor b/core/ui/gadgets/panes.factor
deleted file mode 100644 (file)
index c10252a..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-panes
-USING: arrays gadgets gadgets-borders gadgets-buttons
-gadgets-labels gadgets-scrolling gadgets-paragraphs
-gadgets-theme gadgets-presentations gadgets-outliners
-generic hashtables io kernel namespaces sequences styles
-strings ;
-
-TUPLE: pane output current prototype scrolls? ;
-
-: add-output 2dup set-pane-output add-gadget ;
-
-: add-current 2dup set-pane-current add-gadget ;
-
-: prepare-line ( pane -- )
-    dup pane-prototype clone swap add-current ;
-
-: pane-clear ( pane -- )
-    dup
-    pane-output clear-incremental
-    pane-current clear-gadget ;
-
-C: pane ( -- pane )
-    <pile> over set-delegate
-    <shelf> over set-pane-prototype
-    <pile> <incremental> over add-output
-    dup prepare-line ;
-
-: scroll-pane ( pane -- )
-    dup pane-scrolls? [ scroll>bottom ] [ drop ] if ;
-
-TUPLE: pane-stream pane ;
-
-: prepare-print ( current -- gadget )
-    dup gadget-children {
-        { [ dup empty? ] [ 2drop "" <label> ] }
-        { [ dup length 1 = ] [ nip first ] }
-        { [ t ] [ drop ] }
-    } cond ;
-
-: pane-terpri ( pane -- )
-    dup pane-current dup unparent prepare-print
-    over pane-output add-incremental
-    prepare-line ;
-
-: pane-write ( pane seq -- )
-    [ over pane-current stream-write ]
-    [ dup pane-terpri ] interleave drop ;
-
-: pane-format ( style pane seq -- )
-    [ pick pick pane-current stream-format ]
-    [ dup pane-terpri ] interleave 2drop ;
-
-: do-pane-stream ( pane-stream quot -- )
-    >r pane-stream-pane r> over slip scroll-pane ; inline
-
-M: pane-stream stream-terpri
-    [ pane-terpri ] do-pane-stream ;
-
-M: pane-stream stream-write1
-    [ pane-current stream-write1 ] do-pane-stream ;
-
-M: pane-stream stream-write
-    [ swap string-lines pane-write ] do-pane-stream ;
-
-M: pane-stream stream-format
-    [ rot string-lines pane-format ] do-pane-stream ;
-
-M: pane-stream stream-close drop ;
-
-M: pane-stream stream-flush drop ;
-
-M: pane-stream with-stream-style (with-stream-style) ;
-
-GENERIC: write-gadget ( gadget stream -- )
-
-M: pane-stream write-gadget
-    pane-stream-pane pane-current add-gadget ;
-
-M: duplex-stream write-gadget
-    duplex-stream-out write-gadget ;
-
-: print-gadget ( gadget pane -- )
-    tuck write-gadget stream-terpri ;
-
-: gadget. ( gadget -- )
-    stdio get print-gadget ;
-
-: ?terpri ( stream -- )
-    dup pane-stream-pane pane-current gadget-children empty?
-    [ dup stream-terpri ] unless drop ;
-
-: with-pane ( pane quot -- )
-    over scroll>top
-    over pane-clear >r <pane-stream> r>
-    over >r with-stream r> ?terpri ; inline
-
-: make-pane ( quot -- pane )
-    <pane> [ swap with-pane ] keep ; inline
-
-: <scrolling-pane> ( -- pane )
-    <pane> t over set-pane-scrolls? ;
-
-: <pane-control> ( model quot -- pane )
-    [ with-pane ] curry <pane> swap <control> ;
-
-! Character styles
-
-: apply-style ( style gadget key quot -- style gadget )
-    >r pick hash r> when* ; inline
-
-: apply-foreground-style ( style gadget -- style gadget )
-    foreground [ over set-label-color ] apply-style ;
-
-: apply-background-style ( style gadget -- style gadget )
-    background [ <solid> over set-gadget-interior ] apply-style ;
-
-: specified-font ( style -- font )
-    [ font swap hash [ "monospace" ] unless* ] keep
-    [ font-style swap hash [ plain ] unless* ] keep
-    font-size swap hash [ 12 ] unless* 3array ;
-
-: apply-font-style ( style gadget -- style gadget )
-    over specified-font over set-label-font ;
-
-: apply-presentation-style ( style gadget -- style gadget )
-    presented [ <presentation> ] apply-style ;
-
-: <styled-label> ( style text -- gadget )
-    <label>
-    apply-foreground-style
-    apply-background-style
-    apply-font-style
-    apply-presentation-style
-    nip ;
-
-! Paragraph styles
-
-: apply-wrap-style ( style pane -- style pane )
-    wrap-margin [
-        2dup <paragraph> swap set-pane-prototype
-        <paragraph> over set-pane-current
-    ] apply-style ;
-
-: apply-border-width-style ( style gadget -- style gadget )
-    border-width [ <border> ] apply-style ;
-
-: apply-border-color-style ( style gadget -- style gadget )
-    border-color [
-        <solid> over set-gadget-boundary
-    ] apply-style ;
-
-: apply-page-color-style ( style gadget -- style gadget )
-    page-color [
-        <solid> over set-gadget-interior
-    ] apply-style ;
-
-: apply-outliner-style ( style gadget -- style gadget )
-    outline [ [ make-pane ] curry <outliner> ] apply-style ;
-
-: <styled-paragraph> ( style pane -- gadget )
-    apply-wrap-style
-    apply-border-width-style
-    apply-border-color-style
-    apply-page-color-style
-    apply-presentation-style
-    apply-outliner-style
-    nip ;
-
-: styled-pane ( quot style -- gadget )
-    #! Create a pane, call the quotation to fill it out.
-    >r <pane> dup r> swap <styled-paragraph>
-    >r swap with-pane r> ; inline
-
-: apply-table-gap-style ( style grid -- style grid )
-    table-gap [ over set-grid-gap ] apply-style ;
-
-: apply-table-border-style ( style grid -- style grid )
-    table-border [ <grid-lines> over set-gadget-boundary ]
-    apply-style ;
-
-: styled-grid ( style grid -- grid )
-    <grid>
-    apply-table-gap-style
-    apply-table-border-style
-    nip ;
-
-: <pane-grid> ( quot style grid -- gadget )
-    [
-        [ pick pick >r >r -rot styled-pane r> r> rot ] map
-    ] map styled-grid nip ;
-
-M: pane-stream with-stream-table
-    >r rot <pane-grid> r> print-gadget ;
-
-M: pane-stream with-nested-stream
-    >r styled-pane r> write-gadget ;
-
-! Stream utilities
-M: pack stream-close drop ;
-
-M: paragraph stream-close drop ;
-
-: gadget-write ( string gadget -- )
-    over empty? [
-        2drop
-    ] [
-        >r <label> dup text-theme r> add-gadget
-    ] if ;
-
-M: pack stream-write gadget-write ;
-
-: gadget-bl ( style stream -- )
-    >r " " <styled-label> <word-break-gadget> r> add-gadget ;
-
-M: paragraph stream-write
-    swap " " split
-    [ over gadget-write ] [ H{ } over gadget-bl ] interleave
-    drop ;
-
-: gadget-write1 ( char gadget -- )
-    >r ch>string r> stream-write ;
-
-M: pack stream-write1 gadget-write1 ;
-
-M: paragraph stream-write1
-    over CHAR: \s =
-    [ H{ } swap gadget-bl drop ] [ gadget-write1 ] if ;
-
-: gadget-format ( string style stream -- )
-    pick empty?
-    [ 3drop ] [ >r swap <styled-label> r> add-gadget ] if ;
-
-M: pack stream-format
-    gadget-format ;
-
-M: paragraph stream-format
-    presented pick hash [
-        gadget-format
-    ] [
-        rot " " split
-        [ pick pick gadget-format ]
-        [ 2dup gadget-bl ] interleave
-        2drop
-    ] if ;
diff --git a/core/ui/gadgets/panes.facts b/core/ui/gadgets/panes.facts
deleted file mode 100644 (file)
index b574a82..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-IN: gadgets-panes
-USING: gadgets models help io kernel ;
-
-HELP: pane
-{ $class-description "A pane " { $link gadget } " displays formatted text which is written to a " { $link pane-stream } " targetting the pane. Panes are created by calling " { $link <pane> } ", " { $link <scrolling-pane> } " or " { $link <pane-control> } "." }
-{ $see-also with-pane make-pane write-gadget print-gadget } ;
-
-HELP: <pane>
-{ $values { "pane" "a new " { $link pane } } }
-{ $description "Creates a new " { $link pane } " gadget." }
-{ $see-also <scrolling-pane> <pane-control> make-pane } ;
-
-HELP: pane-stream
-{ $class-description "Pane streams implement the portion of the " { $link "stream-protocol" } " responsible for output of text, including full support for " { $link "styles" } ". Pane streams also support direct output of gadgets via " { $link write-gadget } " and " { $link print-gadget } ". Pane streams are created by calling " { $link <pane-stream> } "." }
-{ $see-also <pane> make-pane with-pane } ;
-
-HELP: <pane-stream> ( pane -- stream )
-{ $values { "pane" pane } { "stream" "a new " { $link pane-stream } } }
-{ $description "Creates a new " { $link pane-stream } " for writing to " { $snippet "pane" } "." }
-{ $see-also <pane> make-pane with-pane } ;
-
-HELP: write-gadget
-{ $values { "gadget" gadget } { "stream" "an output stream" } }
-{ $contract "Writes a gadget to the stream." }
-{ $notes "Not all streams support this operation." }
-{ $see-also pane-stream print-gadget gadget. } ;
-
-HELP: print-gadget
-{ $values { "gadget" gadget } { "stream" "an output stream" } }
-{ $description "Writes a gadget to the stream, followed by a newline." }
-{ $notes "Not all streams support this operation." }
-{ $see-also pane-stream write-gadget gadget. } ;
-
-HELP: gadget.
-{ $values { "gadget" gadget } { "stream" "an output stream" } }
-{ $description "Writes a gadget followed by a newline to the " { $link stdio } " stream." }
-{ $notes "Not all streams support this operation." }
-{ $see-also pane-stream write-gadget print-gadget } ;
-
-HELP: ?terpri
-{ $values { "stream" pane-stream } }
-{ $description "Inserts a line break in the pane unless the current line is empty." } ;
-
-HELP: with-pane
-{ $values { "pane" pane } { "quot" quotation } }
-{ $description "Clears the pane and calls the quotation in a new scope where " { $link stdio } " is rebound to a " { $link pane-stream } " writing to the pane." }
-{ $see-also make-pane } ;
-
-HELP: make-pane
-{ $values { "quot" quotation } { "pane" "a new " { $link pane } } }
-{ $description "Calls the quotation in a new scope where " { $link stdio } " is rebound to a " { $link pane-stream } " writing to a new pane. The pane is output on the stack after the quotation returns." }
-{ $see-also with-pane } ;
-
-HELP: <scrolling-pane>
-{ $values { "pane" "a new " { $link pane } } }
-{ $description "Creates a new " { $link pane } " gadget which scrolls any scroll pane containing it to the bottom on output. behaving much like a terminal or logger." }
-{ $see-also <pane> <pane-control> } ;
-
-HELP: <pane-control>
-{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( value -- )" } } { "pane" "a new " { $link pane } } }
-{ $description "Creates a new " { $link control } " delegating to a " { $link pane } ". When the value of the model changes, the value is pushed on the stack and the quotation is called using " { $link with-pane } "." }
-{ $see-also <pane> <scrolling-pane> } ;
diff --git a/core/ui/gadgets/paragraphs.factor b/core/ui/gadgets/paragraphs.factor
deleted file mode 100644 (file)
index c854833..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-paragraphs
-USING: arrays gadgets gadgets-labels generic kernel math
-namespaces sequences ;
-
-! A word break gadget
-TUPLE: word-break-gadget ;
-
-C: word-break-gadget ( gadget -- gadget )
-    [ set-delegate ] keep ;
-
-M: word-break-gadget draw-gadget* drop ;
-
-! A gadget that arranges its children in a word-wrap style.
-TUPLE: paragraph margin ;
-
-C: paragraph ( margin -- gadget )
-    [ set-paragraph-margin ] keep dup delegate>gadget ;
-
-SYMBOL: x SYMBOL: max-x
-
-SYMBOL: y SYMBOL: max-y
-
-SYMBOL: line-height
-
-SYMBOL: margin
-
-: overrun? ( width -- ? ) x get + margin get >= ;
-
-: wrap-line ( -- )
-    line-height get y +@
-    0 { x line-height } [ set ] each-with ;
-
-: wrap-pos ( -- pos ) x get y get 2array ;
-
-: advance-x ( x -- )
-    x +@
-    x get max-x [ max ] change ;
-
-: advance-y ( y -- )
-    dup line-height [ max ] change
-    y get + max-y [ max ] change ;
-
-: wrap-step ( quot child -- )
-    dup pref-dim [
-        over word-break-gadget? [
-            dup first overrun? [ wrap-line ] when
-        ] unless drop wrap-pos rot call
-    ] keep first2 advance-y advance-x ; inline
-
-: wrap-dim ( -- dim ) max-x get max-y get 2array ;
-
-: init-wrap ( paragraph -- )
-    paragraph-margin margin set
-    0 { x max-x y max-y line-height } [ set ] each-with ;
-
-: do-wrap ( paragraph quot -- dim )
-    [
-        swap dup init-wrap
-        [ wrap-step ] each-child-with wrap-dim
-    ] with-scope ; inline
-
-M: paragraph pref-dim*
-    [ 2drop ] do-wrap ;
-
-M: paragraph layout*
-    [ swap dup prefer set-rect-loc ] do-wrap drop ;
diff --git a/core/ui/gadgets/presentations.factor b/core/ui/gadgets/presentations.factor
deleted file mode 100644 (file)
index 661c8da..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-presentations
-USING: arrays definitions gadgets gadgets-borders
-gadgets-buttons gadgets-labels gadgets-theme
-generic hashtables tools io kernel prettyprint sequences strings
-styles words help math models namespaces ;
-
-TUPLE: presentation object hook ;
-
-: invoke-presentation ( presentation command -- )
-    over dup presentation-hook call
-    >r presentation-object r> invoke-command ;
-
-: invoke-primary ( presentation -- )
-    dup presentation-object primary-operation
-    invoke-presentation ;
-
-: invoke-secondary ( presentation -- )
-    dup presentation-object secondary-operation
-    invoke-presentation ;
-
-: show-mouse-help ( presentation -- )
-    dup presentation-object swap find-world
-    [ world-status set-model ] [ drop ] if* ;
-
-: hide-mouse-help ( presentation -- )
-    find-world [ world-status f swap set-model ] when* ;
-
-M: presentation ungraft* ( presentation -- )
-    dup hide-mouse-help delegate ungraft* ;
-
-C: presentation ( label object -- button )
-    [ drop ] over set-presentation-hook
-    [ set-presentation-object ] keep
-    swap [ invoke-primary ] <roll-button>
-    over set-gadget-delegate ;
-
-: (command-button) ( target command -- label quot )
-    dup command-name -rot
-    [ invoke-command drop ] curry curry ;
-
-: <command-button> ( target command -- button )
-    (command-button) <bevel-button> ;
-
-: <toolbar> ( target classes -- toolbar )
-    [ commands "toolbar" swap hash ] map concat
-    [ <command-button> ] map-with
-    make-shelf ;
-
-: <menu-item> ( hook target command -- button )
-    rot >r
-    (command-button) [ hand-clicked get find-world hide-glass ]
-    r> 3append <roll-button> ;
-
-: <commands-menu> ( hook target commands -- gadget )
-    [ >r 2dup r> <menu-item> ] map 2nip make-filled-pile
-    <default-border>
-    dup menu-theme ;
-
-: operations-menu ( presentation -- )
-    dup
-    dup presentation-hook curry
-    over presentation-object
-    dup object-operations <commands-menu>
-    swap show-menu ;
-
-presentation H{
-    { T{ button-down f f 3 } [ operations-menu ] }
-    { T{ mouse-leave } [ dup hide-mouse-help button-update ] }
-    { T{ motion } [ dup show-mouse-help button-update ] }
-} set-gestures
-
-! Presentation help bar
-: <presentation-help> ( model -- gadget )
-    [ [ summary ] [ "" ] if* ] <filter> <label-control>
-    dup reverse-video-theme ;
diff --git a/core/ui/gadgets/presentations.facts b/core/ui/gadgets/presentations.facts
deleted file mode 100644 (file)
index a7f4b8b..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-IN: gadgets-presentations
-USING: help gadgets gadgets-buttons gadgets-lists prettyprint
-generic models ;
-
-HELP: presentation
-{ $class-description "A presentation is a " { $link button } " which represents an object. Left-clicking a presentation invokes the default " { $link operation } ", and right-clicking displays a menu of possible operations output by " { $link object-operations } "."
-$terpri
-"Presentations are created by calling " { $link <presentation> } "."
-$terpri
-"Presentations have two slots:"
-{ $list
-    { { $link presentation-object } " - the object being presented." }
-    { { $link presentation-hook } " - a quotation with stack effect " { $snippet "( presentation -- )" } ". The default value is " { $snippet "[ drop ]" } "." }
-} }
-{ $see-also "presentations" <command-button> } ;
-
-HELP: invoke-presentation
-{ $values { "presentation" presentation } { "command" command } }
-{ $description "Calls the " { $link presentation-hook } " and then invokes the command on the " { $link presentation-object } "." }
-{ $see-also invoke-primary invoke-secondary } ;
-
-HELP: invoke-primary
-{ $values { "presentation" presentation } } 
-{ $description "Invokes the " { $link primary-operation } " associated to the " { $link presentation-object } ". This word is executed when the presentation is clicked with the left mouse button." }
-{ $see-also invoke-secondary } ;
-
-HELP: invoke-secondary
-{ $values { "presentation" presentation } } 
-{ $description "Invokes the " { $link secondary-operation } " associated to the " { $link presentation-object } ". This word is executed when a " { $link list } " receives a " { $snippet "RETURN" } " key press." }
-{ $see-also invoke-primary } ;
-
-HELP: show-mouse-help
-{ $values { "presentation" presentation } }
-{ $description "Displays a " { $link summary } " of the " { $link presentation-object } "in the status bar of the " { $link world } " containing this presentation. This word is executed when the mouse enters the presentation." }
-{ $see-also hide-mouse-help } ;
-
-HELP: hide-mouse-help
-{ $values { "presentation" presentation } }
-{ $description "Hides the status bar message from the status bar of the " { $link world } " containing this presentation. This word is executed when the mouse leaves the presentation." }
-{ $see-also show-mouse-help } ;
-
-HELP: <presentation>
-{ $values { "label" "a label" } { "object" object } }
-{ $description "Creates a new " { $link presentation } " derived from " { $link <roll-button> } "." }
-{ $see-also "presentations" } ;
-
-HELP: <command-button>
-{ $values { "target" object } { "command" command } { "button" "a new " { $link button } } }
-{ $description "Creates a " { $link <bevel-button> } " which invokes the command on " { $snippet "target" } " when clicked." }
-{ $see-also <button> <roll-button> <presentation> } ;
-
-HELP: <toolbar>
-{ $values { "target" object } { "classes" "a sequence of class words" } }
-{ $description "Creates a row of " { $link <command-button> } " gadgets invoking commands on " { $snippet "target" } ". The commands are taken from the " { $snippet "\"toolbar\"" } " command group of each class in " { $snippet "classes" } "." }
-{ $see-also define-commands } ;
-
-HELP: <commands-menu>
-{ $values { "hook" "a quotation with stack effect " { $snippet "( button -- )" } } { "target" object } { "commands" "a sequence of " { $link command } " instances" } { "gadget" "a new " { $link gadget } } }
-{ $description "Creates a popup menu of commands which are to be invoked on " { $snippet "target" } ". The " { $snippet "hook" } " quotation is run before a command is invoked." }
-{ $see-also <toolbar> operations-menu show-menu } ;
-
-HELP: <presentation-help>
-{ $values { "model" model } }
-{ $description "Creates a new " { $link gadget } " displaying a " { $link summary } " of the model value." }
-{ $notes "If the " { $snippet "model" } " is " { $link world-status } ", this gadget will display " { $link presentation } " mouse over help." }
-{ $see-also show-mouse-help hide-mouse-help } ; 
diff --git a/core/ui/gadgets/scrolling.factor b/core/ui/gadgets/scrolling.factor
deleted file mode 100644 (file)
index 52f52c0..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-scrolling
-USING: arrays gadgets gadgets-theme gadgets-viewports
-gadgets-sliders generic kernel math namespaces sequences
-models ;
-
-TUPLE: scroller viewport x y follows model ;
-
-: find-scroller ( gadget -- scroller/f )
-    [ scroller? ] find-parent ;
-
-: scroll-up-page scroller-y -1 swap slide-by-page ;
-
-: scroll-down-page scroller-y 1 swap slide-by-page ;
-
-: scroll-up-line scroller-y -1 swap slide-by-line ;
-
-: scroll-down-line scroller-y 1 swap slide-by-line ;
-
-: do-mouse-scroll ( scroller -- )
-    scroll-direction get-global first2
-    pick scroller-y slide-by-line
-    swap scroller-x slide-by-line ;
-
-scroller H{
-    { T{ mouse-scroll } [ do-mouse-scroll ] }
-} set-gestures
-
-: init-scroller-model ( scroller -- )
-    dup scroller-x control-model
-    over scroller-y control-model
-    2array <compose> swap set-scroller-model ;
-
-: scroller-value ( scroller -- loc )
-    scroller-model model-value ;
-
-C: scroller ( gadget -- scroller )
-    {
-        { [ <x-slider> ] set-scroller-x f @bottom }
-        { [ <y-slider> ] set-scroller-y f @right  }
-        {
-            [
-                gadget get
-                dup init-scroller-model
-                scroller-model <viewport>
-            ]
-            set-scroller-viewport f @center
-        }
-    } make-frame*
-    t over set-gadget-root?
-    dup faint-boundary ;
-
-: update-slider ( scroller value slider -- )
-    >r swap scroller-viewport dup rect-dim swap viewport-dim
-    r> set-slider ;
-
-: scroll ( scroller value -- )
-    2dup
-    over scroller-x update-slider
-    over scroller-y update-slider ;
-
-: (scroll>rect) ( rect scroller -- )
-    [
-        scroller-value vneg offset-rect
-        viewport-gap offset-rect
-    ] keep
-    [
-        scroller-viewport 2rect-extent
-        >r >r v- { 0 0 } vmin r> r> v- { 0 0 } vmax v+
-    ] keep dup scroller-value rot v+ scroll ;
-
-: relative-scroll-rect ( rect gadget scroller -- newrect )
-    scroller-viewport gadget-child relative-loc offset-rect ;
-
-: scroll>rect ( rect gadget -- )
-    dup find-scroller dup [
-        [ relative-scroll-rect ] keep
-        [ set-scroller-follows ] keep
-        relayout
-    ] [
-        3drop
-    ] if ;
-
-: scroll>bottom ( gadget -- )
-    find-scroller [
-        t over set-scroller-follows relayout
-    ] when* ;
-
-: (scroll>bottom) ( scroller -- )
-    dup scroller-viewport viewport-dim { 0 1 } v* scroll ;
-
-: scroll>top ( gadget -- )
-    <zero-rect> swap scroll>rect ;
-
-: update-scroller ( scroller -- )
-    dup scroller-follows [
-        dup scroller-follows t eq? [
-            dup (scroll>bottom)
-        ] [
-            dup scroller-follows over (scroll>rect)
-        ] if
-        f swap set-scroller-follows
-    ] [
-        dup scroller-value scroll
-    ] if ;
-
-M: scroller layout*
-    dup delegate layout*
-    dup layout-children
-    update-scroller ;
-
-M: scroller focusable-child*
-    scroller-viewport ;
diff --git a/core/ui/gadgets/scrolling.facts b/core/ui/gadgets/scrolling.facts
deleted file mode 100644 (file)
index 3518f39..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-IN: gadgets-scrolling
-USING: help gadgets gadgets-viewports gadgets-sliders ;
-
-HELP: scroller
-{ $class-description "A scroller consists of a " { $link viewport } " containing a child, together with horizontal and vertical " { $link slider } " gadgets which scroll the viewport's child. Scroller gadgets also support using a mouse scroll wheel."
-$terpri
-"Scroller gadgets are created by calling " { $link <scroller> } "." } ;
-
-HELP: find-scroller
-{ $values { "gadget" gadget } { "scroller/f" "a " { $link scroller } " or " { $link f } } }
-{ $description "Finds the first parent of " { $snippet "gadget" } " which is a " { $link scroller } ". Outputs " { $link f } " if the gadget is not contained in a " { $link scroller } "." } ;
-
-HELP: scroller-value
-{ $values { "scroller" scroller } { "loc" "a pair of integers" } }
-{ $description "Outputs the offset of the top-left corner of the scroller's " { $link viewport } "'s child." }
-{ $see-also scroll } ;
-
-HELP: <scroller>
-{ $values { "gadget" gadget } { "scroller" "a new " { $link scroller } } }
-{ $description "Creates a new " { $link scroller } " for scrolling around " { $snippet "gadget" } "." } ;
-
-HELP: scroll
-{ $values { "scroller" scroller } { "value" "a pair of integers" } }
-{ $description "Sets the offset of the top-left corner of the scroller's " { $link viewport } "'s child." }
-{ $see-also scroller-value } ;
-
-HELP: relative-scroll-rect
-{ $values { "rect" rect } { "gadget" gadget } { "scroller" scroller } { "newrect" "a new " { $link rect } } }
-{ $description "Adjusts " { $snippet "rect" } " for the case where the gadget is not the immediate child of the scroller's viewport." } ;
-
-HELP: scroll>rect
-{ $values { "rect" rect } { "gadget" gadget } }
-{ $description "Ensures that a rectangular region relative to the top-left corner of " { $snippet "gadget" } " becomes visible in a " { $link scroller } " containing " { $snippet "gadget" } ". Does nothing if no parent of " { $snippet "gadget" } " is a " { $link scroller } "." }
-{ $see-also scroll>bottom scroll>top } ;
-
-HELP: scroll>bottom
-{ $values { "gadget" gadget } }
-{ $description "Ensures that any " { $link scroller } " containing " { $snippet "gadget" } " is scrolled all the way down. Does nothing if no parent of " { $snippet "gadget" } " is a " { $link scroller } "." }
-{ $see-also scroll>rect scroll>top } ;
-
-HELP: scroll>top
-{ $values { "gadget" gadget } }
-{ $description "Ensures that any scroller containing " { $snippet "gadget" } " is scrolled all the way up. If no parent of " { $snippet "scroller" } " is a gadget, does nothing." }
-{ $see-also scroll>rect scroll>bottom } ;
diff --git a/core/ui/gadgets/sliders.factor b/core/ui/gadgets/sliders.factor
deleted file mode 100644 (file)
index bb03f49..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-sliders
-USING: arrays gadgets gadgets-buttons
-gadgets-theme generic kernel math namespaces
-sequences styles threads vectors models ;
-
-TUPLE: elevator ;
-
-: find-elevator ( gadget -- elevator/f )
-    [ elevator? ] find-parent ;
-
-TUPLE: slider elevator thumb saved max line page ;
-
-: find-slider ( gadget -- slider/f )
-    [ slider? ] find-parent ;
-
-: elevator-length ( slider -- n )
-    dup slider-elevator rect-dim
-    swap gadget-orientation v. ;
-
-: min-thumb-dim 30 ;
-
-: thumb-dim ( slider -- h )
-    dup slider-page over slider-max 1 max / 1 min
-    over elevator-length * min-thumb-dim max
-    over slider-elevator rect-dim
-    rot gadget-orientation v. min ;
-
-: slider-max* dup slider-max swap slider-page [-] ;
-
-: slider-scale ( slider -- n )
-    #! A scaling factor such that if x is a slider co-ordinate,
-    #! x*n is the screen position of the thumb, and conversely
-    #! for x/n. The '1 max' calls avoid division by zero.
-    dup elevator-length over thumb-dim - 1 max
-    swap slider-max* 1 max / ;
-
-: slider>screen slider-scale * ;
-
-: screen>slider slider-scale / ;
-
-: fix-slider-value ( n slider -- n )
-    slider-max* min 0 max >fixnum ;
-
-: set-slider-value ( value slider -- )
-    [ fix-slider-value ] keep set-control-value ;
-
-M: slider model-changed slider-elevator relayout-1 ;
-
-TUPLE: thumb ;
-
-: begin-drag ( thumb -- )
-    find-slider dup control-value swap set-slider-saved ;
-
-: do-drag ( thumb -- )
-    find-slider drag-loc over gadget-orientation v.
-    over screen>slider swap [ slider-saved + ] keep
-    set-slider-value ;
-
-thumb H{
-    { T{ button-down } [ begin-drag ] }
-    { T{ button-up } [ drop ] }
-    { T{ drag } [ do-drag ] }
-} set-gestures
-
-C: thumb ( vector -- thumb )
-    dup delegate>gadget
-    t over set-gadget-root?
-    dup thumb-theme
-    [ set-gadget-orientation ] keep ;
-
-: slide-by ( amount slider -- )
-    [ control-value + ] keep set-slider-value ;
-
-: slide-by-page ( -1/1 slider -- )
-    [ slider-page * ] keep slide-by ;
-
-: page-direction ( elevator -- -1/1 )
-    dup find-slider swap hand-click-rel
-    over gadget-orientation v.
-    over screen>slider
-    swap control-value - sgn ;
-
-: elevator-click ( elevator -- )
-    dup page-direction
-    [ swap find-slider slide-by-page ] curry
-    start-timer-gadget ;
-
-elevator H{
-    { T{ button-down } [ elevator-click ] }
-    { T{ button-up } [ stop-timer-gadget ] }
-} set-gestures
-
-C: elevator ( vector -- elevator )
-    <gadget> <timer-gadget> over set-gadget-delegate
-    [ set-gadget-orientation ] keep
-    dup elevator-theme ;
-
-: (layout-thumb) ( slider n -- n thumb )
-    over gadget-orientation n*v swap slider-thumb ;
-
-: thumb-loc ( slider -- loc )
-    dup control-value swap slider>screen ;
-
-: layout-thumb-loc ( slider -- )
-    dup thumb-loc (layout-thumb)
-    >r [ floor ] map r> set-rect-loc ;
-
-: layout-thumb-dim ( slider -- )
-    dup dup thumb-dim (layout-thumb) >r
-    >r dup rect-dim r>
-    rot gadget-orientation set-axis [ ceiling ] map
-    r> set-layout-dim ;
-
-: layout-thumb ( slider -- )
-    dup layout-thumb-loc layout-thumb-dim ;
-
-M: elevator layout*
-    find-slider layout-thumb ;
-
-: slide-by-line ( -1/1 slider -- )
-    [ slider-line * ] keep slide-by ;
-
-: <slide-button> ( vector polygon amount -- )
-    >r gray swap <polygon-gadget> r>
-    [ swap find-slider slide-by-line ] curry <repeat-button>
-    [ set-gadget-orientation ] keep ;
-
-: <left-button> { 0 1 } arrow-left -1 <slide-button> ;
-: <right-button> { 0 1 } arrow-right 1 <slide-button> ;
-
-: build-x-slider ( slider -- slider )
-    {
-        { [ <left-button> ] f f @left }
-        { [ { 0 1 } <elevator> ] set-slider-elevator f @center }
-        { [ <right-button> ] f f @right }
-    } build-grid ;
-
-: <up-button> { 1 0 } arrow-up -1 <slide-button> ;
-: <down-button> { 1 0 } arrow-down 1 <slide-button> ;
-
-: build-y-slider ( slider -- slider )
-    {
-        { [ <up-button> ] f f @top }
-        { [ { 1 0 } <elevator> ] set-slider-elevator f @center }
-        { [ <down-button> ] f f @bottom }
-    } build-grid ;
-
-: add-thumb ( slider vector -- )
-    <thumb> swap 2dup slider-elevator add-gadget
-    set-slider-thumb ;
-
-C: slider ( orientation -- slider )
-    dup 0 <model> <frame> delegate>control
-    [ set-gadget-orientation ] keep
-    32 over set-slider-line
-    0 over set-slider-page
-    0 over set-slider-max ;
-
-: <x-slider> ( -- slider )
-    { 1 0 } <slider> dup build-x-slider
-    dup { 0 1 } add-thumb ;
-
-: <y-slider> ( -- slider )
-    { 0 1 } <slider> dup build-y-slider
-    dup { 1 0 } add-thumb ;
-
-: set-slider ( value page max slider -- )
-    [ [ gadget-orientation v. ] keep set-slider-max ] keep
-    [ [ gadget-orientation v. ] keep set-slider-page ] keep
-    [ gadget-orientation v. ] keep set-slider-value ;
diff --git a/core/ui/gadgets/sliders.facts b/core/ui/gadgets/sliders.facts
deleted file mode 100644 (file)
index cf2d0d7..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-IN: gadgets-sliders
-USING: help gadgets gadgets-scrolling models ;
-
-HELP: elevator
-{ $class-description "An elevator is the part of a " { $link slider } " between the up/down arrow buttons, where a " { $link thumb } " may be moved up and down." } ;
-
-HELP: find-elevator
-{ $values { "gadget" gadget } { "elevator/f" "an " { $link elevator } " or " { $link f } } }
-{ $description "Finds the first parent of " { $snippet "gadget" } " which is an " { $link elevator } ". Outputs " { $link f } " if the gadget is not contained in an " { $link elevator } "." } ;
-
-HELP: slider
-{ $class-description "A slider is a " { $link control } " for graphically manipulating a " { $link model } " whose value is an integer belonging to a certain range."
-$terpri
-"Sliders are created by calling " { $link <x-slider> } " or " { $link <y-slider> } ", and their canonical use-case is for scrolling; see " { $link scroller } "."
-$terpri
-"Sliders have the following slots:"
-{ $list
-    { { $link slider-max } " - maximum value, an integer" }
-    { { $link slider-line } " - amount to scroll when up/down arrows are clicked, an integer" }
-    { { $link slider-page } " - amount to scroll when paging areas above/below thumb are clicked, an integer" }
-}
-"They should not be changed directly; instead use " { $link set-slider } "." }
-{ $see-also set-slider-value set-slider slide-by slide-by-page } ;
-
-HELP: find-slider
-{ $values { "gadget" gadget } { "slider/f" "a " { $link slider } " or " { $link f } } }
-{ $description "Finds the first parent of " { $snippet "gadget" } " which is a " { $link slider } ". Outputs " { $link f } " if the gadget is not contained in a " { $link slider } "." } ;
-
-HELP: set-slider
-{ $values { "value" "a pair of integers" } { "page" "a pair of integers" } { "max" "a pair of integers" } { "slider" slider } }
-{ $description "Sets a slider's parameters all at once." }
-{ $see-also set-slider-value slide-by-page } ;
-
-HELP: set-slider-value
-{ $values { "value" "a non-negative integer" } { "slider" slider } }
-{ $description "Sets a slider's current position." }
-{ $see-also set-slider slide-by slide-by-page } ;
-
-HELP: thumb
-{ $class-description "A thumb is the gadget contained in a " { $link slider } "'s " { $link elevator } " which indicates the current scroll position and can be dragged up and down with the mouse." } ;
-
-HELP: slide-by
-{ $values { "amount" "an integer" } { "slider" slider } }
-{ $description "Adds the amount (which may be positive or negative) to the slider's current position." }
-{ $see-also set-slider-value set-slider slide-by-page } ;
-
-HELP: slide-by-page
-{ $values { "amount" "an integer" } { "slider" slider } }
-{ $description "Adds the amount multiplied by " { $link slider-page } " to the slider's current position." }
-{ $see-also set-slider-value set-slider slide-by-page } ;
-
-HELP: slide-by-line
-{ $values { "amount" "an integer" } { "slider" slider } }
-{ $description "Adds the amount multiplied by " { $link slider-line } " to the slider's current position." }
-{ $see-also set-slider-value set-slider slide-by-page } ;
-
-HELP: <slider>
-{ $values { "orientation" "either " { $snippet "{ 1 0 }" } " or " { $snippet "{ 0 1 }" } } { "slider" "a new " { $link slider } } }
-{ $description "Internal word for constructing sliders." }
-{ $notes "This does not build a complete slider, and user code should call " { $link <x-slider> } " or " { $link <y-slider> } " instead." } ;
-
-HELP: <x-slider>
-{ $values { "slider" slider } }
-{ $description "Creates a new horizontal " { $link slider } "." }
-{ $see-also <y-slider> } ;
-
-HELP: <y-slider>
-{ $values { "slider" slider } }
-{ $description "Creates a new horizontal " { $link slider } "." }
-{ $see-also <x-slider> } ;
diff --git a/core/ui/gadgets/theme.factor b/core/ui/gadgets/theme.factor
deleted file mode 100644 (file)
index 10a3a71..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-buttons
-DEFER: <button-paint>
-
-IN: gadgets-labels
-DEFER: set-label-color
-DEFER: set-label-font
-
-IN: gadgets-text
-DEFER: set-editor-color
-DEFER: set-editor-caret-color
-DEFER: set-editor-selection-color
-DEFER: set-editor-font
-
-IN: gadgets-theme
-USING: arrays gadgets kernel sequences styles ;
-
-: black { 0.0 0.0 0.0 1.0 } ;
-: white { 1.0 1.0 1.0 1.0 } ;
-: gray { 0.6 0.6 0.6 1.0 } ;
-
-: solid-interior white <solid> swap set-gadget-interior ;
-
-: solid-boundary black <solid> swap set-gadget-boundary ;
-
-: faint-boundary gray <solid> swap set-gadget-boundary ;
-
-: plain-gradient
-    T{ gradient f {
-        { 0.94 0.94 0.94 1.0 }
-        { 0.83 0.83 0.83 1.0 }
-        { 0.83 0.83 0.83 1.0 }
-        { 0.62 0.62 0.62 1.0 }
-    } } ;
-
-: rollover-gradient
-    T{ gradient f {
-        { 1.0 1.0 1.0 1.0 }
-        { 0.9 0.9 0.9 1.0 }
-        { 0.9 0.9 0.9 1.0 }
-        { 0.75 0.75 0.75 1.0 }
-    } } ;
-
-: pressed-gradient
-    T{ gradient f {
-        { 0.75 0.75 0.75 1.0 }
-        { 0.9 0.9 0.9 1.0 }
-        { 0.9 0.9 0.9 1.0 }
-        { 1.0 1.0 1.0 1.0 }
-    } } ;
-
-: selected-gradient
-    T{ gradient f {
-        { 0.65 0.65 0.65 1.0 }
-        { 0.8 0.8 0.8 1.0 }
-        { 0.8 0.8 0.8 1.0 }
-        { 1.0 1.0 1.0 1.0 }
-    } } ;
-
-: bevel-button-theme ( gadget -- )
-    plain-gradient
-    rollover-gradient
-    pressed-gradient
-    selected-gradient
-    <button-paint> over set-gadget-interior
-    faint-boundary ;
-
-: thumb-theme ( thumb -- )
-    plain-gradient over set-gadget-interior faint-boundary ;
-
-: roll-button-theme ( button -- )
-    f black <solid> dup f <button-paint>
-    swap set-gadget-boundary ;
-
-: caret-theme ( caret -- )
-    T{ solid f { 1.0 0.0 0.0 1.0 } } swap set-gadget-interior ;
-
-: elevator-theme ( elevator -- )
-    T{ gradient f {
-        { 0.37 0.37 0.37 1.0 }
-        { 0.43 0.43 0.43 1.0 }
-        { 0.5 0.5 0.5 1.0 }
-    } } swap set-gadget-interior ;
-
-: reverse-video-theme ( label -- )
-    white over set-label-color
-    black <solid> swap set-gadget-interior ;
-
-: label-theme ( gadget -- )
-    black over set-label-color
-    { "sans-serif" plain 12 } swap set-label-font ;
-
-: text-theme ( gadget -- )
-    black over set-label-color
-    { "monospace" plain 12 } swap set-label-font ;
-
-: editor-theme ( editor -- )
-    black over set-editor-color
-    { 1.0 0.0 0.0 1.0 } over set-editor-caret-color
-    { 0.8 0.8 1.0 1.0 } over set-editor-selection-color
-    { "monospace" plain 12 } swap set-editor-font ;
-
-: popup-theme ( gadget -- )
-    T{ solid f { 0.95 0.95 0.95 0.95 } }
-    swap set-gadget-interior ;
-
-: menu-theme ( gadget -- )
-    T{ solid f { 0.95 0.95 0.95 0.95 } }
-    over set-gadget-interior
-    gray <solid> swap set-gadget-boundary ;
-
-: title-theme ( gadget -- )
-    { 1 0 } over set-gadget-orientation
-    T{ gradient f {
-        { 0.65 0.65 1.0 1.0 }
-        { 0.65 0.45 1.0 1.0 }
-    } } swap set-gadget-interior ;
diff --git a/core/ui/gadgets/tracks.factor b/core/ui/gadgets/tracks.factor
deleted file mode 100644 (file)
index 8f1d9c7..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-tracks
-USING: gadgets gadgets-theme generic io kernel
-math namespaces sequences words ;
-
-TUPLE: track sizes ;
-
-C: track ( orientation -- track )
-    [ delegate>pack ] keep
-    1 over set-pack-fill
-    V{ } clone over set-track-sizes ;
-
-: track-layout ( track -- sizes )
-    dup rect-dim swap track-sizes [ v*n ] map-with ;
-
-M: track layout*
-    dup track-layout pack-layout ;
-
-: track-pref-dims ( dims sizes -- dim )
-    [ v/n ] 2map max-dim [ >fixnum ] map ;
-
-M: track pref-dim*
-    [
-        dup gadget-children pref-dims
-        dup rot track-sizes track-pref-dims >r max-dim r>
-    ] keep gadget-orientation set-axis ;
-
-: track-add ( gadget track size -- )
-    over track-sizes push add-gadget ;
-
-: build-track ( track specs -- )
-    swap [ [ track-add ] build-spec ] with-gadget ; inline
-
-: make-track ( specs orientation -- gadget )
-    <track> [ swap build-track ] keep ; inline
-
-: make-track* ( gadget specs orientation -- gadget )
-    <track> pick [ set-delegate build-track ] keep ; inline
diff --git a/core/ui/gadgets/tracks.facts b/core/ui/gadgets/tracks.facts
deleted file mode 100644 (file)
index 4b397f5..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-IN: gadgets-tracks
-USING: help gadgets arrays kernel ;
-
-HELP: track
-{ $class-description "A track is like a " { $link pack } " except each child is resized to a fixed multiple of the track's dimension in the direction of " { $link gadget-orientation } ". Tracks are created by calling " { $link <track> } "." }
-{ $see-also make-track make-track* } ;
-
-HELP: build-track
-{ $values { "track" track } { "specs" array } }
-{ $description "Constructs gadgets and adds them to the track by interpreting " { $snippet "spec" } ", which is an array of quadruples of the form " { $snippet "{ quot setter post ratio }" } ". The quadruples break down as follows:"
-    { $list
-        { { $snippet "quot" } " - a quotation which pushes a new gadget on the stack. The quotation is permitted to consume values from the stack, and it is up to the caller of " { $link build-grid } " to prove the correct amount." }
-        { { $snippet "setter" } " - a word with stack effect " { $snippet "( gadget grid -- )" } ". If " { $snippet "track" } " is a tuple delegating to a " { $link track } ", this can be used to store the new gadget in a tuple slot." }
-        { { $snippet "post" } " - a quotation with stack effect " { $snippet "( gadget -- newgadget )" } ", applied to the gadget before it is added to the grid" }
-        { { $snippet "ratio" } " - a rational number between 0 and 1 which determines the space allocation received by the child." }
-    }
-}
-{ $see-also make-track make-track* } ;
-
-HELP: make-track
-{ $values { "specs" array } { "track" track } }
-{ $description "Creates a new track from a declarative specification. See " { $link build-track } " for a description of the format of " { $snippet "spec" } "." } ;
-
-HELP: make-track*
-{ $values { "tuple" tuple } { "specs" array } { "track" track } }
-{ $description "Creates a new track from a declarative specification and sets " { $snippet "tuple" } "'s delegate to the new track. See " { $link build-track } " for a description of the format of " { $snippet "spec" } "." } ;
diff --git a/core/ui/gadgets/viewports.factor b/core/ui/gadgets/viewports.factor
deleted file mode 100644 (file)
index 8e70943..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-viewports
-USING: arrays gadgets gadgets-borders generic kernel math
-namespaces sequences models ;
-
-: viewport-gap { 3 3 } ; inline
-
-TUPLE: viewport ;
-
-: find-viewport [ viewport? ] find-parent ;
-
-: viewport-dim ( viewport -- dim )
-    gadget-child pref-dim viewport-gap 2 v*n v+ ;
-
-C: viewport ( content model -- viewport )
-    dup rot <gadget> delegate>control
-    t over set-gadget-clipped?
-    [ add-gadget ] keep
-    [ model-changed ] keep ;
-
-M: viewport layout*
-    dup rect-dim viewport-gap 2 v*n v-
-    over gadget-child pref-dim vmax
-    swap gadget-child set-layout-dim ;
-
-M: viewport focusable-child*
-    gadget-child ;
-
-M: viewport pref-dim* viewport-dim ;
-
-M: viewport model-changed
-    dup control-value vneg viewport-gap v+
-    swap gadget-child set-rect-loc ;
diff --git a/core/ui/gadgets/viewports.facts b/core/ui/gadgets/viewports.facts
deleted file mode 100644 (file)
index 20ccca7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-IN: gadgets-viewports
-USING: help gadgets gadgets-scrolling models ;
-
-HELP: viewport
-{ $class-description "A viewport is a " { $link control } " which positions a child gadget translated by the " { $link control-value } " vector. Viewports are used in the implementation of " { $link scroller } " gadgets and can be created directly by calling " { $link <viewport> } "." } ;
-
-HELP: <viewport>
-{ $values { "content" gadget } { "model" model } }
-{ $description "Creates a new " { $link viewport } " containing " { $snippet "content" } "." }
-{ $see-also <scroller> } ;
diff --git a/core/ui/gestures.factor b/core/ui/gestures.factor
deleted file mode 100644 (file)
index 430bfa4..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays generic hashtables kernel math models namespaces
-queues sequences words ;
-
-: set-gestures ( class hash -- ) "gestures" set-word-prop ;
-
-GENERIC: handle-gesture* ( gadget gesture delegate -- ? )
-
-M: object handle-gesture*
-    class "gestures" word-prop ?hash dup
-    [ call f ] [ 2drop t ] if ;
-
-: handle-gesture ( gesture gadget -- ? )
-    tuck delegates [ >r 2dup r> handle-gesture* ] all? 2nip ;
-
-: send-gesture ( gesture gadget -- ? )
-    [ dupd handle-gesture ] each-parent nip ;
-
-: user-input ( str gadget -- )
-    [ dupd user-input* ] each-parent 2drop ;
-
-! Gesture objects
-TUPLE: motion ;
-TUPLE: drag # ;
-TUPLE: button-up mods # ;
-TUPLE: button-down mods # ;
-TUPLE: mouse-scroll ;
-TUPLE: mouse-enter ;
-TUPLE: mouse-leave ;
-TUPLE: lose-focus ;
-TUPLE: gain-focus ;
-
-! Higher-level actions
-TUPLE: cut-action ;
-TUPLE: copy-action ;
-TUPLE: paste-action ;
-TUPLE: delete-action ;
-TUPLE: select-all-action ;
-
-: generalize-gesture ( gesture -- newgesture )
-    tuple>array 1 head* >tuple ;
-
-! Modifiers
-SYMBOL: C+
-SYMBOL: A+
-SYMBOL: M+
-SYMBOL: S+
-
-TUPLE: key-down mods sym ;
-TUPLE: key-up mods sym ;
-
-! Hand state
-
-! Note that these are only really useful inside an event
-! handler, and that the locations hand-loc and hand-click-loc
-! are in the co-ordinate system of the world which contains
-! the gadget in question.
-SYMBOL: hand-gadget
-SYMBOL: hand-world
-SYMBOL: hand-loc
-{ 0 0 } hand-loc set-global
-
-SYMBOL: hand-clicked
-SYMBOL: hand-click-loc
-SYMBOL: hand-click#
-SYMBOL: hand-last-button
-SYMBOL: hand-last-time
-0 hand-last-button set-global
-0 hand-last-time set-global
-
-SYMBOL: hand-buttons
-V{ } clone hand-buttons set-global
-
-SYMBOL: scroll-direction
-{ 0 0 } scroll-direction set-global
-
-SYMBOL: double-click-timeout
-300 double-click-timeout set-global
-
-: button-gesture ( gesture -- )
-    hand-clicked get-global 2dup send-gesture [
-        >r generalize-gesture r> send-gesture drop
-    ] [
-        2drop
-    ] if ;
-
-: drag-gesture ( -- )
-    hand-buttons get-global first <drag> button-gesture ;
-
-: fire-motion ( -- )
-    hand-buttons get-global empty? [
-        T{ motion } hand-gadget get-global send-gesture drop
-    ] [
-        drag-gesture
-    ] if ;
-
-: each-gesture ( gesture seq -- )
-    [ handle-gesture drop ] each-with ;
-
-: hand-gestures ( new old -- )
-    drop-prefix <reversed>
-    T{ mouse-leave } swap each-gesture
-    T{ mouse-enter } swap each-gesture ;
-
-: forget-rollover ( -- )
-    f hand-world set-global
-    hand-gadget get-global >r
-    f hand-gadget set-global
-    f r> parents hand-gestures ;
-
-: focus-gestures ( new old -- )
-    drop-prefix <reversed>
-    T{ lose-focus } swap each-gesture
-    T{ gain-focus } swap each-gesture ;
-
-: focus-receiver ( world -- seq )
-    dup world-focused? [ focused-ancestors ] [ drop f ] if ;
-
-: request-focus* ( gadget world -- )
-    dup focused-ancestors >r
-    [ set-world-focus ] keep
-    focus-receiver r> focus-gestures ;
-
-: request-focus ( gadget -- )
-    dup focusable-child swap find-world
-    [ request-focus* ] [ drop ] if* ;
-
-: modifier ( mod modifiers -- seq )
-    [ second swap bitand 0 > ] subset-with
-    0 <column> prune f like ;
-
-: drag-loc ( -- loc )
-    hand-loc get-global hand-click-loc get-global v- ;
-
-: hand-rel ( gadget -- loc )
-    hand-loc get-global swap screen-loc v- ;
-
-: hand-click-rel ( gadget -- loc )
-    hand-click-loc get-global swap screen-loc v- ;
-
-: multi-click? ( button -- ? )
-    millis hand-last-time get - double-click-timeout get <=
-    swap hand-last-button get = and ;
-
-: update-click# ( button -- )
-    global [
-        multi-click? [
-            hand-click# inc
-        ] [
-            1 hand-click# set
-        ] if
-    ] bind ;
-
-: update-clicked ( -- )
-    hand-gadget get-global hand-clicked set-global
-    hand-loc get-global hand-click-loc set-global ;
-: under-hand ( -- seq )
-    hand-gadget get-global parents <reversed> ;
-
-: move-hand ( loc world -- )
-    dup hand-world set-global
-    under-hand >r over hand-loc set-global
-    pick-up hand-gadget set-global
-    under-hand r> hand-gestures ;
-
-: send-button-down ( gesture loc world -- )
-    move-hand
-    dup button-down-#
-    dup update-click#
-    dup hand-last-button set-global
-    millis hand-last-time set-global
-    update-clicked
-    hand-buttons get-global push
-    button-gesture ;
-
-: send-button-up ( gesture loc world -- )
-    move-hand
-    dup button-up-# hand-buttons get-global delete
-    button-gesture ;
-
-: send-wheel ( direction loc world -- )
-    move-hand
-    scroll-direction set-global
-    T{ mouse-scroll } hand-gadget get-global send-gesture
-    drop ;
-
-: send-action ( world gesture -- )
-    swap world-focus send-gesture drop ;
-
-: resend-button-down ( gesture world -- )
-    hand-loc get-global swap send-button-down ;
-
-: resend-button-up  ( gesture world -- )
-    hand-loc get-global swap send-button-up ;
-
-world H{
-    { T{ key-down f { C+ } "x" } [ T{ cut-action } send-action ] }
-    { T{ key-down f { C+ } "c" } [ T{ copy-action } send-action ] }
-    { T{ key-down f { C+ } "v" } [ T{ paste-action } send-action ] }
-    { T{ key-down f { C+ } "a" } [ T{ select-all-action } send-action ] }
-    { T{ button-down f { C+ } 1 } [ T{ button-down f f 3 } swap resend-button-down ] }
-    { T{ button-down f { A+ } 1 } [ T{ button-down f f 2 } swap resend-button-down ] }
-    { T{ button-up f { C+ } 1 } [ T{ button-up f f 3 } swap resend-button-up ] }
-    { T{ button-up f { A+ } 1 } [ T{ button-up f f 2 } swap resend-button-up ] }
-} set-gestures
diff --git a/core/ui/gestures.facts b/core/ui/gestures.facts
deleted file mode 100644 (file)
index 06131a5..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-IN: gadgets
-USING: help hashtables strings kernel ;
-
-HELP: set-gestures
-{ $values { "class" "a class word" } { "hash" hashtable } }
-{ $description "Sets the gestures a gadget class responds to. The hashtable maps gestures to quotations with stack effect " { $snippet "( gadget -- )" } "." }
-{ $notes "Only one of " { $link define-commands } " and " { $link set-gestures } " can be used on a given gadget class, since each word will overwrite the other word's definitions." } ;
-
-HELP: handle-gesture*
-{ $values { "gadget" "the receiver of the gesture" } { "gesture" "a gesture" } { "delegate" "an object" } { "?" "a boolean" } }
-{ $contract "Handles a gesture sent to a gadget. As the delegation chain is traversed, this generic word is called with every delegate of the gadget at the top of the stack, however the front-most delegate remains fixed as the " { $snippet "gadget" } " parameter."
-$terpri
-"Outputs " { $link f } " if the gesture was handled, and " { $link t } " if the gesture should be passed on to the gadget's delegate." }
-{ $notes "Methods should be defined on this word if you desire to handle an arbitrary set of gestures. To define handlers for a fixed set, it is easier to use " { $link set-gestures } " or " { $link define-commands } "." } ;
-
-HELP: handle-gesture
-{ $values { "gesture" "a gesture" } { "gadget" gadget } { "?" "a boolean" } }
-{ $description "Calls " { $link handle-gesture* } " on every delegate of " { $snippet "gadget" } ". Outputs " { $link f } " if some delegate handled the gesture, else outputs " { $link t } "." }
-{ $see-also set-gestures define-commands } ;
-
-HELP: send-gesture
-{ $values { "gesture" "a gesture" } { "gadget" gadget } { "?" "a boolean" } }
-{ $description "Calls " { $link send-gesture } " on every parent of " { $snippet "gadget" } ". Outputs " { $link f } " if some parent handled the gesture, else outputs " { $link t } "." }
-{ $see-also set-gestures define-commands } ;
-
-HELP: user-input
-{ $values { "str" string } { "gadget" gadget } }
-{ $description "Calls " { $link user-input* } " on every parent of the gadget." } ;
-
-HELP: motion
-{ $class-description "Mouse motion gesture." } ;
-
-HELP: drag
-{ $class-description "Mouse drag gesture. The " { $link drag-# } " slot is either set to a mouse button number, or " { $link f } " indicating no specific button is expected." } ;
-
-HELP: button-up
-{ $class-description "Mouse button up gesture. Instances have two slots:"
-    { $list
-        { { $link button-up-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
-        { { $link button-up-# } " - a mouse button number, or " { $link f } " indicating no specific button is expected" }
-    }
-} ;
-
-HELP: button-down
-{ $class-description "Mouse button down gesture. Instances have two slots:"
-    { $list
-        { { $link button-down-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
-        { { $link button-down-# } " - a mouse button number, or " { $link f } " indicating no specific button is expected" }
-    }
-} ;
-
-HELP: mouse-scroll
-{ $class-description "Scroll wheel motion gesture. When this gesture is sent, the " { $link scroll-direction } " global variable is set to a direction vector." } ;
-
-HELP: mouse-enter
-{ $class-description "Gesture sent when the mouse enters the bounds of a gadget." } ;
-
-HELP: mouse-leave
-{ $class-description "Gesture sent when the mouse leaves the bounds of a gadget." } ;
-
-HELP: gain-focus
-{ $class-description "Gesture sent when a gadget gains keyboard focus." } ;
-
-HELP: lose-focus
-{ $class-description "Gesture sent when a gadget loses keyboard focus." } ;
-
-HELP: cut-action
-{ $class-description "Gesture sent when the " { $emphasis "cut" } " standard window system action is invoked." } ;
-
-HELP: copy-action
-{ $class-description "Gesture sent when the " { $emphasis "copy" } " standard window system action is invoked." } ;
-
-HELP: paste-action
-{ $class-description "Gesture sent when the " { $emphasis "paste" } " standard window system action is invoked." } ;
-
-HELP: delete-action
-{ $class-description "Gesture sent when the " { $emphasis "delete" } " standard window system action is invoked." } ;
-
-HELP: select-all-action
-{ $class-description "Gesture sent when the " { $emphasis "select all" } " standard window system action is invoked." } ;
-
-HELP: generalize-gesture
-{ $values { "gesture" "a gesture" } { "newgesture" "a new gesture" } }
-{ $description "Turns a " { $link button-down } ", " { $link button-up } " or " { $link drag } " action naming a specific mouse button into one which can apply regardless of which mouse button was pressed." } ;
-
-HELP: C+
-{ $description "Control key modifier." } ;
-
-HELP: A+
-{ $description "Alt key modifier." } ;
-
-HELP: M+
-{ $description "Meta key modifier. This is the Command key on Mac OS X." } ;
-
-HELP: S+
-{ $description "Shift key modifier." } ;
-
-HELP: key-down
-{ $class-description "Key down gesture. Instances have two slots:"
-    { $list
-        { { $link key-down-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
-    { { $link key-down-sym } " - a string denoting the key pressed; see " { $link "keyboard-gestures" } }
-    }
-} ;
-
-HELP: key-up
-{ $class-description "Key up gesture. Instances have two slots:"
-    { $list
-        { { $link key-up-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
-    { { $link key-up-sym } " - a string denoting the key pressed; see " { $link "keyboard-gestures" } }
-    }
-} ;
-
-HELP: hand-gadget
-{ $var-description "Global variable. The gadget at the mouse location." } ;
-
-HELP: hand-world
-{ $var-description "Global variable. The " { $link world } " containing the gadget at the mouse location." } ;
-
-HELP: hand-loc
-{ $var-description "Global variable. The mouse location relative to the top-left corner of the " { $link hand-world } "." } 
-{ $see-also hand-rel } ;
-
-HELP: hand-clicked
-{ $var-description "Global variable. The gadget at the location of the most recent click." } ;
-
-HELP: hand-click-loc
-{ $var-description "Global variable. The mouse location at the time of the most recent click relative to the top-left corner of the " { $link hand-world } "." } 
-{ $see-also hand-click-loc } ;
-
-HELP: hand-click#
-{ $var-description "Global variable. The number of times the mouse was clicked in short succession. This counter is reset when " { $link double-click-timeout } " expires." } ;
-
-HELP: hand-last-button
-{ $var-description "Global variable. The mouse button most recently pressed." } ;
-
-HELP: hand-last-time
-{ $var-description "Global variable. The timestamp of the most recent mouse button click. This timestamp has the same format as the output value of " { $link millis } "." } ;
-
-HELP: hand-buttons
-{ $var-description "Global variable. A vector of mouse buttons currently held down." } ;
-
-HELP: scroll-direction
-{ $var-description "Global variable. If the most recent gesture was a " { $link mouse-scroll } ", this holds a pair of integers indicating the direction of the scrolling as a two-dimensional vector." } ;
-
-HELP: double-click-timeout
-{ $var-description "Global variable. The maximum delay between two button presses which will still increment " { $link hand-click# } "." } ;
-
-HELP: button-gesture
-{ $values { "gesture" "a gesture" } }
-{ $description "Sends a gesture to the most recently clicked gadget, and if the gadget does not respond to the gesture, removes specific button number information from the gesture and sends it again." } ;
-
-HELP: fire-motion
-{ $description "Sends a " { $link motion } " or " { $link drag } " gesture to the gadget under the mouse, depending on whenever a mouse button is being held down or not." } ;
-
-HELP: forget-rollover
-{ $description "Sends " { $link mouse-leave } " gestures to all gadgets containing the gadget under the mouse, and resets the " { $link hand-gadget } " variable." } ;
-
-HELP: focus-receiver
-{ $values { "world" world } { "seq" "a new sequence" } }
-{ $description "If the top-level window containing the world has focus, outputs a sequence of parents of the currently focused gadget, otherwise outputs " { $link f } "." }
-{ $notes "This word is used to avoid sending " { $link gain-focus } " gestures to a gadget which requests focus on an unfocused top-level window, so that, for instance, a text editing caret does not appear in this case." } ;
-
-HELP: request-focus
-{ $values { "gadget" gadget } }
-{ $description "Gives keyboard focus to the " { $link focusable-child } " of the gadget. This may result in " { $link lose-focus } " and " { $link gain-focus } " gestures being sent." } ;
-
-HELP: drag-loc
-{ $values { "loc" "a pair of integers" } }
-{ $description "Outputs the distance travelled by the mouse since the most recent press. Only meaningful inside a " { $link drag } " gesture handler." } ;
-
-HELP: hand-rel
-{ $values { "gadget" gadget } { "loc" "a pair of integers" } }
-{ $description "Outputs the location of the mouse relative to the top-left corner of the gadget. Only meaningful inside a " { $link button-down } ", " { $link button-up } ", " { $link motion } " or " { $link drag } " gesture handler, where the gadget is contained in the same world as the gadget receiving the gesture." }
-{ $see-also hand-loc } ;
-
-HELP: hand-click-rel
-{ $values { "gadget" gadget } { "loc" "a pair of integers" } }
-{ $description "Outputs the location of the last mouse relative to the top-left corner of the gadget. Only meaningful inside a " { $link button-down } ", " { $link button-up } ", " { $link motion } " or " { $link drag } " gesture handler, where the gadget is contained in the same world as the gadget receiving the gesture." } ;
-
-HELP: under-hand
-{ $values { "seq" "a new sequence" } }
-{ $description "Outputs a sequence where the first element is the " { $link hand-world } " and the last is the " { $link hand-gadget } ", with all parents in between." } ;
diff --git a/core/ui/handbook/gadgets.facts b/core/ui/handbook/gadgets.facts
deleted file mode 100644 (file)
index 23b066b..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-USING: gadgets gadgets-labels gadgets-buttons gadgets-sliders
-gadgets-panes gadgets-lists gadgets-text gadgets-borders
-gadgets-presentations gadgets-scrolling gadgets-outliners help ;
-
-ARTICLE: "gadgets" "UI gadgets"
-{ $subsection "gadgets-labels" }
-{ $subsection "gadgets-polygons" }
-{ $subsection "gadgets-borders" }
-{ $subsection "gadgets-buttons" }
-{ $subsection "gadgets-sliders" }
-{ $subsection "gadgets-scrolling" }
-{ $subsection "gadgets-editors" }
-{ $subsection "gadgets-panes" }
-{ $subsection "gadgets-presentations" }
-{ $subsection "gadgets-lists" }
-{ $subsection "gadgets-outliners" } ;
-
-ARTICLE: "gadgets-labels" "Label gadgets"
-"A label displays a piece of text, either a single line string or an array of line strings."
-{ $subsection label }
-{ $subsection <label> }
-{ $subsection <label-control> }
-{ $subsection label-string }
-{ $subsection set-label-string } ;
-
-ARTICLE: "gadgets-polygons" "Polygon gadgets"
-"A polygon gadget renders a simple shaded polygon."
-{ $subsection polygon }
-{ $subsection <polygon> }
-{ $subsection <polygon-gadget> }
-"Some pre-made polygons:"
-{ $subsection arrow-up }
-{ $subsection arrow-right }
-{ $subsection arrow-down }
-{ $subsection arrow-left }
-{ $subsection close-box } ;
-
-ARTICLE: "gadgets-borders" "Border gadgets"
-"Border gadgets add empty space around a child gadget."
-{ $subsection border }
-{ $subsection <border> }
-{ $subsection <default-border> }
-"It is also possible to create a labelled border around a child gadget:"
-{ $subsection labelled-gadget }
-{ $subsection <labelled-gadget> }
-"Or a labelled border with a close box:"
-{ $subsection closable-gadget }
-{ $subsection <closable-gadget> } ;
-
-ARTICLE: "gadgets-buttons" "Button gadgets"
-"Buttons respond to mouse clicks by invoking a quotation."
-{ $subsection button }
-"There are many ways to create a new button:"
-{ $subsection <button> }
-{ $subsection <roll-button> }
-{ $subsection <bevel-button> }
-{ $subsection <command-button> }
-{ $subsection <repeat-button> }
-"A radio box is a row of buttons for choosing amongst several distinct possibilities:"
-{ $subsection <radio-box> }
-"Button appearance can be customized:"
-{ $subsection button-paint } ;
-
-ARTICLE: "gadgets-sliders" "Slider gadgets"
-"A slider allows the user to graphically manipulate a value by moving a thumb back and forth."
-{ $subsection slider }
-{ $subsection <x-slider> }
-{ $subsection <y-slider> }
-"Changing slider values:"
-{ $subsection set-slider }
-{ $subsection set-slider-value }
-{ $subsection slide-by }
-{ $subsection slide-by-line }
-{ $subsection slide-by-page } ;
-
-ARTICLE: "gadgets-scrolling" "Scroller gadgets"
-"A scroller displays a gadget which is larger than the visible area."
-{ $subsection scroller }
-{ $subsection <scroller> }
-"Getting and setting the scroll position:"
-{ $subsection scroller-value }
-{ $subsection scroll }
-"Writing scrolling-aware gadgets:"
-{ $subsection scroll>bottom }
-{ $subsection scroll>top }
-{ $subsection scroll>rect }
-{ $subsection find-scroller } ;
-
-ARTICLE: "gadgets-editors-selection" "The caret and mark"
-"If there is no selection, the caret and the mark are at the same location; otherwise the mark delimits the end-point of the selection opposite the caret."
-{ $subsection editor-caret }
-{ $subsection editor-caret* }
-{ $subsection editor-mark }
-{ $subsection editor-mark* }
-{ $subsection change-caret }
-{ $subsection change-caret&mark }
-{ $subsection mark>caret }
-"Getting and setting the selected text:"
-{ $subsection gadget-selection? }
-{ $subsection gadget-selection }
-{ $subsection user-input* }
-"Scrolling to the caret location:"
-{ $subsection scroll>caret } ;
-
-ARTICLE: "documents" "Documents"
-"The " { $link control-model } " of an " { $link editor } " is a " { $link document } "."
-{ $subsection document }
-{ $subsection <document> }
-"Getting and setting the contents of the entire document:"
-{ $subsection doc-string }
-{ $subsection set-doc-string }
-{ $subsection clear-doc }
-"Getting and setting subranges:"
-{ $subsection doc-line }
-{ $subsection doc-lines }
-{ $subsection doc-range }
-{ $subsection set-doc-range }
-{ $subsection remove-doc-range } ;
-
-ARTICLE: "document-locs-elts" "Locations and elements"
-"Locations in the document are represented as a line/column number pair, with both indices being zero-based. There are some words for manipulating locations:"
-{ $subsection +col }
-{ $subsection +line }
-{ $subsection =col }
-{ $subsection =line }
-"New locations can be created out of existing ones by finding the start or end of a document element nearest to a given location."
-{ $subsection prev-elt }
-{ $subsection next-elt }
-"The different types of document elements correspond to the standard editing taxonomy:"
-{ $subsection char-elt }
-{ $subsection one-word-elt }
-{ $subsection word-elt }
-{ $subsection one-line-elt }
-{ $subsection line-elt }
-{ $subsection doc-elt }
-"Miscellaneous words for working with locations:"
-{ $subsection lines-equal? }
-{ $subsection validate-loc } ;
-
-ARTICLE: "gadgets-editors" "Editor gadgets"
-"An editor edits a multi-line passage of text."
-{ $heading "General commands" }
-{ $commands editor "editing" }
-{ $heading "Caret motion commands" }
-{ $commands editor "caret" }
-{ $heading "Selection commands" }
-{ $commands editor "selection" }
-{ $heading "Editor words" }
-{ $subsection editor }
-{ $subsection <editor> }
-{ $subsection editor-string }
-{ $subsection set-editor-string }
-{ $subsection "gadgets-editors-selection" }
-{ $subsection "documents" }
-{ $subsection "document-locs-elts" } ;
-
-ARTICLE: "gadgets-panes" "Pane gadgets"
-"A pane displays formatted text."
-{ $subsection pane }
-{ $subsection <pane> }
-{ $subsection <scrolling-pane> }
-{ $subsection <pane-control> }
-{ $subsection <labelled-pane> }
-"Panes are written to by creating a special output stream:"
-{ $subsection pane-stream }
-{ $subsection <pane-stream> }
-"In addition to the stream output words (" { $link "stream-protocol" } ", pane streams can have gadgets written to them:"
-{ $subsection write-gadget }
-{ $subsection print-gadget }
-{ $subsection gadget. }
-"The " { $link gadget. } " word is useful for interactive debugging of gadgets in the listener."
-$terpri
-"There are a few combinators for working with panes:"
-{ $subsection with-pane }
-{ $subsection make-pane } ;
-
-ARTICLE: "gadgets-presentations" "Presentation gadgets"
-"Outliner gadgets are usually not constructed directly, and instead are written to " { $link "gadgets-panes" } " with formatted stream output words (" { $link "presentations" } ")."
-{ $subsection presentation }
-{ $subsection <presentation> }
-"If you want to display your own windows with mouse-over help for presentations, add this gadget to the window:"
-{ $subsection <presentation-help> } ;
-
-ARTICLE: "gadgets-lists" "List gadgets"
-"A list displays a list of presentations."
-{ $subsection list }
-{ $subsection <list> }
-{ $subsection list-value } ;
-
-ARTICLE: "gadgets-outliners" "Outliner gadgets"
-"Outliner gadgets are usually not constructed directly, and instead are written to " { $link "gadgets-panes" } " with formatted stream output words (" { $link "presentations" } ")."
-{ $subsection outliner }
-{ $subsection <outliner> }
-{ $subsection set-outliner-expanded? } ;
diff --git a/core/ui/handbook/load.factor b/core/ui/handbook/load.factor
deleted file mode 100644 (file)
index 07b16f3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-PROVIDE: core/ui/handbook
-{ +files+ {
-    "tools.facts"
-    "gadgets.facts"
-    "ui.facts"
-} } ;
diff --git a/core/ui/handbook/tools.facts b/core/ui/handbook/tools.facts
deleted file mode 100644 (file)
index e005d55..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-USING: gadgets gadgets-listener gadgets-browser gadgets-help
-gadgets-presentations gadgets-walker gadgets-dataflow
-gadgets-workspace help gadgets-panes gadgets-text listener
-definitions prettyprint io parser modules compiler words
-styles ;
-
-ARTICLE: "ui-presentations" "Presentations in the UI"
-"A " { $emphasis "presentation" } " is a graphical view of an object which is directly linked to the object in some way. The help article links you see in the documentation browser are presentations; and if you " { $link see } " a word in the UI listener, all words in the definition will themselves be presentations."
-$terpri
-"When you move the mouse over a presentation, it is highlighted with a rectangular border and a short summary of the object being presented is shown in the status bar (the summary is produced using the " { $link summary } " word)."
-$terpri
-"Clicking a presentation with the left mouse button invokes a default operation, which usually views the object in some way. For example, clicking a presentation of a word jumps to the word definition in the " { $link "ui-browser" } "."
-$terpri
-"Clicking and holding the right mouse button on a presentation displays a popup menu listing available operations."
-$terpri
-"Presentation gadgets can be constructed directly using the " { $link <presentation> } " word, and they can also be written to " { $link pane } " gadgets using the " { $link write-object } " word." ;
-
-ARTICLE: "ui-listener" "UI listener"
-"The graphical listener is based around the terminal listener (" { $link "listener" } ") and adds the following features:"
-{ $list
-    "Input history"
-    { "Completion (see " { $link "ui-completion" } ")" }
-    { "Clickable presentations (see " { $link "ui-presentations" } ")" }
-}
-{ $heading "Listener commands" }
-{ $commands listener-gadget "toolbar" }
-{ $heading "Interactor commands" }
-{ $commands interactor "interactor" }
-{ $heading "Word commands" }
-"These commands operate on the token at the caret position in the input area."
-{ $commands interactor "words" }
-{ $heading "Quotation commands" }
-"These commands operate on the entire contents of the input area."
-{ $commands interactor "quotations" }
-{ $heading "Editing commands" }
-"The text editing commands are standard; see " { $link "gadgets-editors" } "."
-{ $heading "Implementation" }
-"Listeners are instances of " { $link listener-gadget } ". The listener consists of an output area (instance of " { $link pane } "), and an input area (instance of " { $link interactor } "), and a stack display kept up to date using a " { $link listener-hook } "." ;
-
-ARTICLE: "ui-browser" "UI definition browser"
-"The graphical browser displays word definitions. To show a word definition, click a presentation of a word or use the word and vocabulary completion popups to browse the dictionary (see " { $link "ui-completion" } ")."
-{ $commands browser "toolbar" }
-"Definition browsers are instances of " { $link browser } "." ;
-
-ARTICLE: "ui-help" "UI documentation browser"
-"The documentation browser is used to display Factor documentation, which is rooted at the " { $link "handbook" } " page."
-{ $commands help-gadget "toolbar" }
-"Documentation browsers are instances of " { $link help-gadget } "." ;
-
-ARTICLE: "ui-walker" "UI walker"
-"The walker single-steps through quotations. To use the walker, enter a piece of code in the listener's input area and press " { $snippet "C+A+w" } "."
-$terpri
-"The walker can travel backwards through time, and restore stacks. This does not undo side effects and therefore can only be used reliably on referentially transparent code."
-{ $commands walker-gadget "toolbar" }
-"Walkers are instances of " { $link walker-gadget } "." ;
-
-ARTICLE: "ui-dataflow" "UI dataflow tool"
-"The dataflow viewer displays the stack effect of a quotation in a graphical way. To use it, enter a piece of code in the listener's input area and press " { $snippet "C+A+d" } ", or click the " { $strong "Dataflow" } " button in a definition tile shown by the UI browser."
-$terpri
-"Only quotations and words for which a stack effect can be inferred can be viewed. See " { $link "inference" } "."
-$terpri
-"The dataflow viewer displays the dataflow intermediate representation output by the compiler's optimizer. Therefore inlining and various other optimizations will have already been performed, and the visual representation may not resemble your original code in many ways. An upside of this arrangement is that the dataflow viewer can be used to predict how fast the code will run, because you will see which layers of generic dispatch have been optimized out at compile time."
-{ $commands dataflow-gadget "toolbar" }
-"Dataflow viewers are instances of " { $link dataflow-gadget } "." ;
-
-ARTICLE: "ui-cocoa" "Functionality specific to Mac OS X"
-"On Mac OS X, the Factor UI offers additional features which integrate with this operating system."
-$terpri
-"First, a standard Mac-style menu bar is provided, which offers the bare minimum of what you would expect from a Mac OS X application."
-$terpri
-"Dropping a source file onto the Factor icon in the dock runs the source file in the listener."
-$terpri
-"If you install " { $strong "Factor.app" } " in your " { $strong "Applications" } " folder, then other applications will be able to call Factor via the System Services feature. For example, you can select some text in " { $strong "TextEdit.app" } ", then invoke the " { $strong "TextEdit->Services->Factor->Evaluate Selection" } " menu item, which will replace the selected text with the result of evaluating it in Factor."
-
-;
-
-ARTICLE: "ui-tool-tutorial" "UI tool tutorial"
-"The following is an example of a typical session with the UI which should give you a taste of its power:"
-{ $list
-    { "You decide to refactor some code, and move a few words from a source file you have already loaded, into a new source file." }
-    { "You press " { $snippet "C+e" } " in the listener, which displays a gadget where you can type part of a loaded file's name, and then press " { $snippet "RETURN" } " when the correct completion is highlighted. This opens the file in your editor." } 
-    { "You refactor your words, move them to a new source file, and load the new file using " { $link run-file } "." }
-    { "Interactively testing the new code reveals a problem with one particular code snippet, so you enter it in the listener's input area, and press " { $snippet "C+A+w" } " to invoke the single stepper." }
-    { "Single stepping through the code makes the problem obvious, so you right-click on a presentation of the broken word in the stepper, and choose " { $strong "Edit" } " from the resulting popup menu." }
-    { "After fixing the problem in the source editor, you right click on the word in the stepper and invoke " { $strong "Reload" } "." }
-} ;
-
-ARTICLE: "ui-completion-words" "Word completion popup"
-"Clicking a word in the word completion popup displays the word definition in the " { $link "ui-browser" } ". Pressing " { $snippet "RETURN" } " with a word selected inserts the word name in the listener, along with a " { $link POSTPONE: USE: } " declaration (if necessary)."
-{ $operations word compound } ;
-
-ARTICLE: "ui-completion-vocabs" "Vocabulary completion popup"
-"Clicking a vocabulary in the vocabulary completion popup displays a list of words in the vocabulary in another " { $link "ui-completion-words" } ". Pressing " { $snippet "RETURN" } " adds the vocabulary to the current search path, just as if you invoked " { $link POSTPONE: USE: } "."
-{ $operations vocab-link } ;
-
-ARTICLE: "ui-completion-modules" "Module completion popup"
-"The module completion popup lists loaded and unloaded modules, the list being obtained by calling the " { $link available-modules } " word. Clicking a module in the module completion popup loads the module first if necessary, and then displays a list of source files in a " { $link "ui-completion-sources" } ". Pressing " { $snippet "RETURN" } " loads the module first if necessary, and then runs the module's main entry point with " { $link run-module } "."
-{ $operations module } ;
-
-ARTICLE: "ui-completion-sources" "Source file completion popup"
-"The source file completion popup lists all source files which have been previously loaded by " { $link run-file } ". Clicking a source file  or pressing " { $snippet "RETURN" } " opens the source file in your editor with " { $link edit-file } "."
-{ $operations pathname } ;
-
-ARTICLE: "ui-completion" "UI completion popups"
-"Completion popups allow fast access to aspects of the environment. Completion popups can be invoked by clicking the row of buttons along the bottom of the workspace, or via keyboard commands:"
-{ $commands workspace "toolbar" }
-"A completion popup instantly updates the list of completions as keys are typed. The list of completions can be navigated from the keyboard with the " { $snippet "UP" } " and " { $snippet "DOWN" } " arrow keys. Every completion has a " { $emphasis "primary action" } " and " { $emphasis "secondary action" } ". The primary action is invoked when clicking a completion, and the secondary action is invoked on the currently-selected completion when pressing " { $snippet "RETURN" } "."
-$terpri
-"The primary and secondary actions, along with additional keyboard shortcuts, are documented for some completion popups in the below sections."
-{ $subsection "ui-completion-words" }
-{ $subsection "ui-completion-vocabs" }
-{ $subsection "ui-completion-modules" }
-{ $subsection "ui-completion-sources" } ;
-
-ARTICLE: "ui-workspace-keys" "UI keyboard shortcuts"
-{ $heading "Switching tools" }
-{ $commands workspace "tool-switch" }
-{ $heading "Opening new windows" }
-"Multiple workspace windows can be open at once."
-{ $commands workspace "tool-window" }
-{ $heading "Scrolling" }
-"The current tool's scroll pane can be scrolled from the keyboard."
-{ $commands workspace "scrolling" }
-{ $heading "Workflow" }
-"A pair of commands for invoking " { $link reload-modules } " and " { $link recompile } "."
-{ $commands workspace "workflow" }
-{ $heading "Implementation" }
-"Workspaces are instances of " { $link workspace-window } "." ;
-
-ARTICLE: "ui-tools" "UI development tools"
-"The Factor development environment can seem rather different from what you are used to, because it is very simple and powerful.."
-$terpri
-"To take full advantage of the UI, you should be using a supported text editor, and load the correct editor integration module. See " { $link edit } "."
-{ $subsection "ui-tool-tutorial" }
-{ $subsection "ui-workspace-keys" }
-{ $subsection "ui-presentations" }
-{ $subsection "ui-completion" }
-{ $heading "Tools" }
-"All development tools are integrated into a single-window " { $emphasis "workspace" } "."
-{ $subsection "ui-listener" }
-{ $subsection "ui-browser" }
-{ $subsection "ui-help" }
-{ $subsection "ui-walker" }
-{ $subsection "ui-dataflow" }
-{ $subsection "ui-cocoa" } ;
diff --git a/core/ui/handbook/ui.facts b/core/ui/handbook/ui.facts
deleted file mode 100644 (file)
index a7bb8ac..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-ARTICLE: "models" "Models" ;
-
-ARTICLE: "clipboard-protocol" "Clipboard protocol" ;
-
-ARTICLE: "timers" "Timers" ;
-
-ARTICLE: "keyboard-gestures" "Keyboard gestures" ;
diff --git a/core/ui/hierarchy.factor b/core/ui/hierarchy.factor
deleted file mode 100644 (file)
index 1c9d752..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: generic hashtables inference kernel math namespaces
-sequences vectors words parser ;
-IN: gadgets
-
-GENERIC: graft* ( gadget -- )
-
-M: gadget graft* drop ;
-
-: graft ( gadget -- )
-    t over set-gadget-grafted?
-    dup graft*
-    [ graft ] each-child ;
-
-GENERIC: ungraft* ( gadget -- )
-
-M: gadget ungraft* drop ;
-
-: ungraft ( gadget -- )
-    dup gadget-grafted? [
-        dup [ ungraft ] each-child
-        dup ungraft*
-        f over set-gadget-grafted?
-    ] when drop ;
-
-: (unparent) ( gadget -- )
-    dup ungraft
-    dup forget-pref-dim f swap set-gadget-parent ;
-
-: unparent ( gadget -- )
-    [
-        dup gadget-parent dup [
-            over (unparent)
-            [ gadget-children delete ] keep relayout
-        ] [
-            2drop
-        ] if
-    ] when* ;
-
-: (clear-gadget) ( gadget -- )
-    dup [ (unparent) ] each-child f swap set-gadget-children ;
-
-: clear-gadget ( gadget -- )
-    dup (clear-gadget) relayout ;
-
-: ((add-gadget)) ( gadget box -- )
-    [ gadget-children ?push ] keep set-gadget-children ;
-
-: (add-gadget) ( gadget box -- )
-    over unparent
-    dup pick set-gadget-parent
-    [ ((add-gadget)) ] 2keep
-    gadget-grafted? [ graft ] [ drop ] if ;
-
-: add-gadget ( gadget parent -- )
-    [ (add-gadget) ] keep relayout ;
-
-: add-gadgets ( seq parent -- )
-    swap [ over (add-gadget) ] each relayout ;
-
-: add-spec ( quot spec -- )
-    dup first %
-    dup second [ [ dup gadget get ] % , ] when*
-    dup third %
-    [ gadget get ] %
-    fourth ,
-    % ;
-
-: (build-spec) ( quot spec -- quot )
-    [ [ add-spec ] each-with ] [ ] make ;
-
-: build-spec ( spec quot -- )
-    swap (build-spec) call ;
-
-\ build-spec 2 0 <effect> "inferred-effect" set-word-prop
-
-\ build-spec [
-    pop-literal pop-literal nip (build-spec) infer-quot-value
-] "infer" set-word-prop
-
-: (parents) ( gadget -- )
-    [ dup , gadget-parent (parents) ] when* ;
-
-: parents ( gadget -- seq )
-    [ (parents) ] { } make ;
-
-: each-parent ( gadget quot -- ? )
-    >r parents r> all? ; inline
-
-: find-parent ( gadget quot -- parent )
-    >r parents r> find nip ; inline
-
-: screen-loc ( gadget -- point )
-    parents { 0 0 } [ rect-loc v+ ] reduce ;
-
-: child? ( parent child -- ? ) parents memq? ;
-
-GENERIC: focusable-child* ( gadget -- child/t )
-
-M: gadget focusable-child* drop t ;
-
-: focusable-child ( gadget -- child )
-    dup focusable-child*
-    dup t eq? [ drop ] [ nip focusable-child ] if ;
-
-: make-pile ( children -- pack ) <pile> [ add-gadgets ] keep ;
-
-: make-filled-pile ( children -- pack )
-    make-pile 1 over set-pack-fill ;
-
-: make-shelf ( children -- pack ) <shelf> [ add-gadgets ] keep ;
diff --git a/core/ui/hierarchy.facts b/core/ui/hierarchy.facts
deleted file mode 100644 (file)
index 7e65c22..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-IN: gadgets
-USING: help gadgets-text gadgets-tracks ;
-
-HELP: graft*
-{ $values { "gadget" gadget } }
-{ $contract "Called to notify the gadget it has become visible on the screen. This should set up timers and threads, and acquire any resources used by the gadget." }
-{ $see-also ungraft* } ;
-
-HELP: ungraft*
-{ $values { "gadget" gadget } }
-{ $contract "Called to notify the gadget it is no longer visible on the screen. This should stop timers and threads, and release any resources used by the gadget." }
-{ $see-also graft* } ;
-
-HELP: graft
-{ $values { "gadget" gadget } }
-{ $description "Calls " { $link graft* } " on the gadget and all children." }
-{ $notes "This word should never be called directly." }
-{ $see-also graft* ungraft } ;
-
-HELP: ungraft
-{ $values { "gadget" gadget } }
-{ $description "If the gadget is grafted, calls " { $link ungraft* } " on the gadget and all children." }
-{ $notes "This word should never be called directly." }
-{ $see-also ungraft* graft } ;
-
-HELP: unparent
-{ $values { "gadget" gadget } }
-{ $description "Removes the gadget from its parent. This will relayout the parent." }
-{ $notes "This may result in " { $link ungraft* } " being called on the gadget and its children, if the gadget's parent is visible on the screen." }
-{ $warning "Some gadget classes have their own words for removing children, for example " { $link grid-remove } ". Read the documentation for the class of the gadget's parent before using this word." } ;
-
-HELP: clear-gadget
-{ $values { "gadget" gadget } }
-{ $description "Removes all children from the gadget. This will relayout the gadget." }
-{ $notes "This may result in " { $link ungraft* } " being called on the children, if the gadget is visible on the screen." }
-{ $warning "Some gadget classes have their own words for adding children, for example " { $link grid-remove } ". Read the documentation for the gadget class before using this word." }
-{ $side-effects "gadget" } ;
-
-HELP: add-gadget
-{ $values { "gadget" gadget } { "parent" gadget } }
-{ $description "Adds a child gadget to a parent. If the gadget is contained in another gadget, " { $link unparent } " is called on the gadget first. The parent will be relayout." }
-{ $notes "Adding a gadget to a parent may result in " { $link graft* } " being called on the children, if the parent is visible on the screen." }
-{ $warning "Some gadget classes have their own words for adding children, for example " { $link grid-add } " and " { $link add-incremental } ". Read the documentation for the gadget class before using this word." }
-{ $side-effects "parent" } ;
-
-HELP: add-gadgets
-{ $values { "seq" "a sequence of gadgets" } { "parent" gadget } }
-{ $description "Adds a sequence of gadgets to a parent. The parent will be relayout." }
-{ $notes "This may result in " { $link graft* } " being called on the children, if the parent is visible on the screen." }
-{ $warning "Some gadget classes have their own words for adding children, for example " { $link grid-add } " and " { $link add-incremental } ". Read the documentation for the gadget class before using this word." }
-{ $side-effects "parent" } ;
-
-HELP: parents
-{ $values { "gadget" gadget } }
-{ $description "Outputs a sequence of all parents of the gadget, with the first element being the gadget itself." } ;
-
-HELP: each-parent
-{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( gadget -- )" } } }
-{ $description "Applies the quotation to every parent of the gadget, starting from the gadget itself." } ;
-
-HELP: find-parent
-{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( gadget -- ? )" } } { "parent" gadget } }
-{ $description "Outputs the first parent of the gadget, starting from the gadget itself, for which the quotation outputs a true value, or " { $link f } " if the quotation outputs " { $link f } " for every parent." } ;
-
-HELP: screen-loc
-{ $values { "gadget" gadget } { "loc" "a pair of integers" } }
-{ $description "Outputs the location of the gadget relative to the top-left corner of the world containing the gadget. This word does not output a useful value if the gadget is not grafted." } ;
-
-HELP: child?
-{ $values { "parent" gadget } { "child" gadget } { "?" "a boolean" } }
-{ $description "Tests if " { $snippet "child" } " is contained inside " { $snippet "parent" } "." } ;
-
-HELP: focusable-child*
-{ $values { "gadget" gadget } { "child" gadget } }
-{ $description "Outputs the child of the gadget which would prefer to receive keyboard focus, or " { $link t } " if the gadget itself should receive focus." }
-{ $examples "For example, if your gadget consists of an " { $link editor } " together with an output area whose contents react to changes in editor contents, then the " { $link focusable-child* } " method for your gadget class should return the editor, so that when the gadget is displayed in a window or passed to " { $link request-focus } ", the editor receives keyboard focus automatically." } ;
-
-HELP: focusable-child
-{ $values { "gadget" gadget } { "child" gadget } }
-{ $description "Outputs the child of the gadget which would prefer to receive keyboard focus." } ;
-
-HELP: make-pile
-{ $values { "children" "a sequence of gadgets" } { "pack" "a new " { $link pack } } }
-{ $description "Creates a new " { $link pack } " which lays out a sequence of gadgets vertically." } ;
-
-HELP: make-filled-pile
-{ $values { "children" "a sequence of gadgets" } { "pack" "a new " { $link pack } } }
-{ $description "Creates a new " { $link pack } " which lays out a sequence of gadgets vertically, such that all gadgets have the same width." } ;
-
-HELP: make-shelf
-{ $values { "children" "a sequence of gadgets" } { "pack" "a new " { $link pack } } }
-{ $description "Creates a new " { $link pack } " which lays out a sequence of gadgets horizontally." } ;
diff --git a/core/ui/layouts.factor b/core/ui/layouts.factor
deleted file mode 100644 (file)
index c831c3b..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: errors generic hashtables kernel math
-namespaces queues sequences ;
-IN: gadgets
-
-DEFER: relayout-1
-
-: invalidate ( gadget -- )
-    \ relayout-1 swap set-gadget-state ;
-
-: forget-pref-dim ( gadget -- ) f swap set-gadget-pref-dim ;
-
-: invalid ( -- queue ) \ invalid get-global ;
-
-: add-invalid ( gadget -- )
-    #! When unit testing gadgets without the UI running, the
-    #! invalid queue is not initialized and we simply ignore
-    #! invalidation requests.
-    invalid [ enque ] [ drop ] if* ;
-
-DEFER: relayout
-
-: invalidate* ( gadget -- )
-    \ relayout over set-gadget-state
-    dup forget-pref-dim
-    dup gadget-root?
-    [ add-invalid ] [ gadget-parent [ relayout ] when* ] if ;
-
-: relayout ( gadget -- )
-    dup gadget-state \ relayout eq?
-    [ drop ] [ invalidate* ] if ;
-
-: relayout-1 ( gadget -- )
-    dup gadget-state
-    [ drop ] [ dup invalidate add-invalid ] if ;
-
-: show-gadget t swap set-gadget-visible? ;
-
-: hide-gadget f swap set-gadget-visible? ;
-
-: (set-rect-dim) ( dim gadget quot -- )
-    >r 2dup rect-dim =
-    [ [ 2drop ] [ set-rect-dim ] if ] 2keep
-    [ drop ] r> if ; inline
-
-: set-layout-dim ( dim gadget -- )
-    [ invalidate ] (set-rect-dim) ;
-
-: set-gadget-dim ( dim gadget -- )
-    [ invalidate* ] (set-rect-dim) ;
-
-GENERIC: pref-dim* ( gadget -- dim )
-
-: ?set-gadget-pref-dim ( dim gadget -- )
-    dup gadget-state [ 2drop ] [ set-gadget-pref-dim ] if ;
-
-: pref-dim ( gadget -- dim )
-    dup gadget-pref-dim [ ] [
-        [ pref-dim* dup ] keep ?set-gadget-pref-dim
-    ] ?if ;
-
-M: gadget pref-dim* rect-dim ;
-
-GENERIC: layout* ( gadget -- )
-
-M: gadget layout* drop ;
-
-: prefer ( gadget -- ) dup pref-dim swap set-layout-dim ;
-
-DEFER: layout
-
-: layout-children ( gadget -- ) [ layout ] each-child ;
-
-: layout ( gadget -- )
-    dup gadget-state [
-        f over set-gadget-state
-        dup layout* dup layout-children
-    ] when drop ;
-
-TUPLE: pack align fill gap ;
-
-: pref-dims ( gadget -- list ) [ pref-dim ] map ;
-
-: orient ( gadget seq1 seq2 -- seq )
-    >r >r gadget-orientation r> r> [ pick set-axis ] 2map nip ;
-
-: packed-dim-2 ( gadget sizes -- list )
-    [ over rect-dim over v- rot pack-fill v*n v+ ] map-with ;
-
-: packed-dims ( gadget sizes -- seq )
-    2dup packed-dim-2 swap orient ;
-
-: gap-locs ( gap sizes -- seq )
-    { 0 0 } [ v+ over v+ ] accumulate 2nip ;
-
-: aligned-locs ( gadget sizes -- seq )
-    [ >r dup pack-align swap rect-dim r> v- n*v ] map-with ;
-
-: packed-locs ( gadget sizes -- seq )
-    over pack-gap over gap-locs >r dupd aligned-locs r> orient ;
-
-: round-dims ( seq -- newseq )
-    { 0 0 } swap
-    [ swap v- dup [ ceiling >fixnum ] map [ swap v- ] keep ] map
-    nip ;
-
-: pack-layout ( pack sizes -- )
-    round-dims over gadget-children
-    >r dupd packed-dims r> 2dup [ set-layout-dim ] 2each
-    >r packed-locs r> [ set-rect-loc ] 2each ;
-
-C: pack ( orientation -- pack )
-    dup delegate>gadget
-    [ set-gadget-orientation ] keep
-    0 over set-pack-align
-    0 over set-pack-fill
-    { 0 0 } over set-pack-gap ;
-
-: delegate>pack ( orientation tuple -- )
-    >r <pack> r> set-delegate ;
-
-: <pile> ( -- pack ) { 0 1 } <pack> ;
-
-: <shelf> ( -- pack ) { 1 0 } <pack> ;
-
-: dim-sum ( seq -- dim ) { 0 0 } [ v+ ] reduce ;
-
-: gap-dims ( gap sizes -- seeq )
-    [ dim-sum ] keep length 1 [-] rot n*v v+ ;
-
-: pack-pref-dim ( gadget sizes -- dim )
-    over pack-gap over gap-dims >r max-dim r>
-    rot gadget-orientation set-axis ;
-
-M: pack pref-dim*
-    dup gadget-children pref-dims pack-pref-dim ;
-
-M: pack layout*
-    dup gadget-children pref-dims pack-layout ;
-
-: (fast-children-on) ( dim axis gadgets -- i )
-    swapd [ rect-loc v- over v. ] binsearch nip ;
-
-: fast-children-on ( rect axis children -- from to )
-    3dup
-    >r >r dup rect-loc swap rect-dim v+ origin get v-
-    r> r> (fast-children-on) 1+
-    >r
-    >r >r rect-loc origin get v-
-    r> r> (fast-children-on)
-    0 max
-    r> ;
-
-M: pack children-on ( rect gadget -- seq )
-    dup gadget-orientation swap gadget-children
-    [ fast-children-on ] keep <slice> ;
diff --git a/core/ui/layouts.facts b/core/ui/layouts.facts
deleted file mode 100644 (file)
index 28e4949..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-IN: gadgets
-USING: help generic kernel ;
-
-HELP: relayout
-{ $values { "gadget" gadget } }
-{ $description "Relayout and redraw a gadget before the next iteration of the event loop. Unlike " { $link relayout-1 } ", this relayouts all parents up to a gadget having " { $link gadget-root? } " set, so this word should be used when the gadget's dimensions have potentially changed." }
-{ $see-also relayout-1 } ;
-
-HELP: relayout-1
-{ $values { "gadget" gadget } }
-{ $description "Relayout and redraw a gadget before the next iteration of the event loop. Unlike " { $link relayout } ", this does not propagate requests up to the parent, and so this word should only be used when the gadget's internal layout or appearance has changed, but the dimensions have not." }
-{ $see-also relayout } ;
-
-HELP: set-layout-dim
-{ $values { "dim" "a pair of integers" } { "gadget" gadget } }
-{ $description "Resizes a gadget inside a " { $link layout* } " method." }
-{ $warning "Do not call this word outside of a " { $link layout* } " method, or otherwise the gadget will not be relayout automatically. Instead, use " { $link set-gadget-dim } "." } ;
-
-HELP: set-gadget-dim
-{ $values { "dim" "a pair of integers" } { "gadget" gadget } }
-{ $description "Resizes and relayouts a gadget before the next iteration of the event loop." }
-{ $warning "Do not call this word inside a " { $link layout* } " method, or otherwise unnecessary work will be done by the UI to ensure the gadget is relayout. Instead, use " { $link set-layout-dim } "." } ;
-
-HELP: pref-dim*
-{ $values { "gadget" gadget } { "dim" "a pair of integers" } }
-{ $contract "Outputs the preferred dimensions of the gadget, possibly computing them from the preferred dimensions of the gadget's children." }
-{ $notes "User code should not call this word directly, instead call " { $link pref-dim } "." }
-{ $see-also relayout relayout-1 layout* } ;
-
-HELP: pref-dim
-{ $values { "gadget" gadget } { "dim" "a pair of integers" } }
-{ $description "Outputs the preferred dimensions of the gadget. The value is cached between calls, and invalidated when the gadget needs to be relayout." }
-{ $see-also pref-dim* relayout relayout-1 layout* } ;
-
-HELP: layout*
-{ $values { "gadget" gadget } }
-{ $contract "Lays out the children of the gadget according to the gadget's policy. The dimensions of the gadget are already set by the parent by the time this word is called." }
-{ $notes "User code should not call this word directly, instead call " { $link relayout } " and " { $link relayout-1 } "." }
-{ $see-also pref-dim pref-dim* layout* } ;
-
-HELP: prefer
-{ $values { "gadget" gadget } }
-{ $contract "Resizes the gadget to assume its preferred dimensions." }
-{ $see-also pref-dim* layout* } ;
-
-HELP: layout
-{ $values { "gadget" gadget } }
-{ $description "Lays out the children of the gadget if the gadget needs to be relayout, and otherwise does nothing." }
-{ $notes "User code should not call this word directly, instead call " { $link relayout } " and " { $link relayout-1 } "." }
-{ $see-also pref-dim pref-dim* layout* } ;
-
-HELP: pack
-{ $class-description "A gadget which lays out its children along a single axis stored in the " { $link gadget-orientation } " slot. Can be constructed with one of the following words:"
-{ $list
-    { $link <pack> }
-    { $link <pile> }
-    { $link <shelf> }
-    { $link make-pile }
-    { $link make-filled-pile }
-    { $link make-shelf }
-}
-"Packs have the following slots:"
-{ $list
-    { { $link pack-align } " a rational number between 0 and 1, the alignment of gadgets along the axis perpendicular to the pack's orientation" }
-    { { $link pack-fill } " a rational number between 0 and 1, where 0 gives each gadget its preferred size and 1 fills the dimension perpendicular to the pack's orientation" }
-    { { $link pack-gap } " a pair of integers, the horizontal and vertical gap between children" }
-}
-"Gadgets can delegate to packs and implement their own " { $link pref-dim* } " and " { $link layout* } " methods, reusing pack layout logic by calling " { $link pack-pref-dim } " and " { $link pack-layout } "." }
-{ $see-also delegate>pack } ;
-
-HELP: pack-layout
-{ $values { "pack" "a new " { $link pack } } { "sizes" "a sequence of pairs of integers" } }
-{ $description "Lays out the pack's children along the " { $link gadget-orientation } " of the pack, with each gadget receiving its size from the corresponding index of the " { $snippet "sizes" } " sequence." }
-{ $notes
-    "This word is useful if you are writing your own layout gadget which delegates to a " { $link pack } ". This allows you to reuse layout logic while computing gadget sizes using a custom procedure."
-} ;
-
-HELP: <pack>
-{ $values { "orientation" "either " { $snippet "{ 1 0 }" } " or " { $snippet "{ 0 1 }" } } { "pack" "a new " { $link pack } } }
-{ $description "Creates a new pack which lays out children along the given axis. Children are laid out vertically if the orientation is " { $snippet "{ 0 1 }" } " and horizontally if the orientation is " { $snippet "{ 1 0 }" } "." }
-{ $see-also delegate>pack <pile> <shelf> } ;
-
-HELP: delegate>pack
-{ $values { "orientation" "either " { $snippet "{ 1 0 }" } " or " { $snippet "{ 0 1 }" } } { "tuple" tuple } }
-{ $description "Sets the tuple's delegate to a new pack." }
-{ $side-effects "tuple" }
-{ $see-also <pack> <pile> <shelf> } ;
-
-HELP: <pile>
-{ $values { "pack" "a new " { $link pack } } }
-{ $description "Creates a new " { $link pack } " which lays out its children vertically." } ;
-
-HELP: <shelf>
-{ $values { "pack" "a new " { $link pack } } }
-{ $description "Creates a new " { $link pack } " which lays out its children horizontally." } ;
-
-HELP: pack-pref-dim
-{ $values { "pack" "a new " { $link pack } } { "sizes" "a sequence of pairs of integers" } }
-{ $description "Computes the preferred size of a pack, with each gadget receiving its size from the corresponding index of the " { $snippet "sizes" } " sequence." }
-{ $notes
-    "This word is useful if you are writing your own layout gadget which delegates to a " { $link pack } ". This allows you to reuse layout logic while computing gadget sizes using a custom procedure."
-} ;
diff --git a/core/ui/load.factor b/core/ui/load.factor
deleted file mode 100644 (file)
index 7689cf3..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-REQUIRES: core/ui/opengl core/ui/freetype ;
-
-PROVIDE: core/ui
-{ +files+ {
-    "timers.factor"
-    "models.factor"
-    "backend.factor"
-    "gadgets.factor"
-    "layouts.factor"
-    "hierarchy.factor"
-    "gadgets/grids.factor"
-    "gadgets/frames.factor"
-    "world.factor"
-    "text.factor"
-    "paint.factor"
-    "gestures.factor"
-    "commands.factor"
-    "windows.factor"
-    "gadgets/controls.factor"
-    "gadgets/grid-lines.factor"
-    "gadgets/theme.factor"
-    "gadgets/labels.factor"
-    "gadgets/borders.factor"
-    "gadgets/buttons.factor"
-    "gadgets/sliders.factor"
-    "gadgets/viewports.factor"
-    "gadgets/scrolling.factor"
-    "gadgets/tracks.factor"
-    "gadgets/incremental.factor"
-    "gadgets/paragraphs.factor"
-    "gadgets/outliner.factor"
-    "gadgets/menus.factor"
-    "gadgets/presentations.factor"
-    "gadgets/lists.factor"
-    "gadgets/panes.factor"
-    "gadgets/labelled-gadget.factor"
-    "gadgets/books.factor"
-    "text/document.factor"
-    "text/elements.factor"
-    "text/editor.factor"
-    "text/commands.factor"
-    "text/interactor.factor"
-    "debugger.factor"
-    "ui.factor"
-    "backend.facts"
-    "commands.facts"
-    "debugger.facts"
-    "gadgets.facts"
-    "gestures.facts"
-    "hierarchy.facts"
-    "layouts.facts"
-    "models.facts"
-    "paint.facts"
-    "text.facts"
-    "timers.facts"
-    "world.facts"
-    "windows.facts"
-    "gadgets/books.facts"
-    "gadgets/borders.facts"
-    "gadgets/buttons.facts"
-    "gadgets/controls.facts"
-    "gadgets/frames.facts"
-    "gadgets/grid-lines.facts"
-    "gadgets/grids.facts"
-    "gadgets/incremental.facts"
-    "gadgets/labelled-gadget.facts"
-    "gadgets/labels.facts"
-    "gadgets/lists.facts"
-    "gadgets/menus.facts"
-    "gadgets/outliner.facts"
-    "gadgets/panes.facts"
-    "gadgets/presentations.facts"
-    "gadgets/scrolling.facts"
-    "gadgets/sliders.facts"
-    "gadgets/tracks.facts"
-    "gadgets/viewports.facts"
-    "text/document.facts"
-    "text/editor.facts"
-    "text/elements.facts"
-    "text/interactor.facts"
-} }
-{ +tests+ {
-    "test/editor.factor"
-    "test/gadgets.factor"
-    "test/models.factor"
-    "test/document.factor"
-    "test/lists.factor"
-    "test/rectangles.factor"
-    "test/commands.factor"
-    "test/panes.factor"
-    "test/presentations.factor"
-    "test/scrolling.factor"
-    "test/search.factor"
-    "test/sliders.factor"
-    "test/titled-gadget.factor"
-} } ;
diff --git a/core/ui/models.factor b/core/ui/models.factor
deleted file mode 100644 (file)
index 330f088..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: models
-USING: generic kernel math sequences timers ;
-
-TUPLE: model value connections dependencies ref ;
-
-C: model ( value -- model )
-    [ set-model-value ] keep
-    V{ } clone over set-model-connections
-    V{ } clone over set-model-dependencies
-    0 over set-model-ref ;
-
-M: model equal? eq? ;
-
-: add-dependency ( dep model -- )
-    model-dependencies push ;
-
-: remove-dependency ( dep model -- )
-    model-dependencies delete ;
-
-DEFER: add-connection
-
-GENERIC: model-activated ( model -- )
-
-M: model model-activated drop ;
-
-: ref-model ( model -- n )
-    dup model-ref 1+ dup rot set-model-ref ;
-
-: unref-model ( model -- n )
-    dup model-ref 1- dup rot set-model-ref ;
-
-: activate-model ( model -- )
-    dup ref-model 1 = [
-        dup model-dependencies
-        [ dup activate-model dupd add-connection ] each
-        model-activated
-    ] [
-        drop
-    ] if ;
-
-DEFER: remove-connection
-
-: deactivate-model ( model -- )
-    dup unref-model zero? [
-        dup model-dependencies
-        [ dup deactivate-model remove-connection ] each-with
-    ] [
-        drop
-    ] if ;
-
-GENERIC: model-changed ( observer -- )
-
-: add-connection ( observer model -- )
-    dup model-connections empty? [ dup activate-model ] when
-    model-connections push ;
-
-: remove-connection ( observer model -- )
-    [ model-connections delete ] keep
-    dup model-connections empty? [ dup deactivate-model ] when
-    drop ;
-
-GENERIC: set-model ( value model -- )
-
-M: model set-model
-    [ set-model-value ] keep
-    model-connections [ model-changed ] each ;
-
-: ((change-model)) ( model quot -- newvalue model )
-    over >r >r model-value r> call r> ; inline
-
-: change-model ( model quot -- )
-    ((change-model)) set-model ; inline
-
-: (change-model) ( model quot -- )
-    ((change-model)) set-model-value ; inline
-
-: delegate>model ( tuple -- )
-    f <model> swap set-delegate ;
-
-TUPLE: filter model quot ;
-
-C: filter ( model quot -- filter )
-    dup delegate>model
-    [ set-filter-quot ] keep
-    [ set-filter-model ] 2keep
-    [ add-dependency ] keep ;
-
-M: filter model-changed
-    dup filter-model model-value over filter-quot call
-    swap set-model ;
-
-M: filter model-activated model-changed ;
-
-TUPLE: compose ;
-
-C: compose ( models -- compose )
-    dup delegate>model
-    swap clone over set-model-dependencies ;
-
-M: compose model-changed
-    dup model-dependencies [ model-value ] map
-    swap delegate set-model ;
-
-M: compose model-activated model-changed ;
-
-M: compose set-model
-    model-dependencies [ set-model ] 2each ;
-
-TUPLE: history back forward ;
-
-C: history ( value -- history )
-    [ >r <model> r> set-delegate ] keep
-    V{ } clone over set-history-back
-    V{ } clone over set-history-forward ;
-
-: (add-history)
-    swap model-value dup [ swap push ] [ 2drop ] if ;
-
-: go-back/forward ( history to from -- )
-    dup empty?
-    [ 3drop ]
-    [ >r dupd (add-history) r> pop swap set-model ] if ;
-
-: go-back ( history -- )
-    dup history-forward over history-back go-back/forward ;
-
-: go-forward ( history -- )
-    dup history-back over history-forward go-back/forward ;
-
-: add-history ( history -- )
-    dup history-forward delete-all
-    dup history-back (add-history) ;
-
-TUPLE: delay model timeout ;
-
-: update-delay-model ( delay -- )
-    dup delay-model model-value swap set-model ;
-
-C: delay ( model timeout -- filter )
-    dup delegate>model
-    [ set-delay-timeout ] keep
-    [ set-delay-model ] 2keep
-    [ add-dependency ] keep
-    dup update-delay-model ;
-
-M: delay model-changed 0 over delay-timeout add-timer ;
-
-M: delay model-activated update-delay-model ;
-
-M: delay tick dup remove-timer update-delay-model ;
diff --git a/core/ui/models.facts b/core/ui/models.facts
deleted file mode 100644 (file)
index efcb205..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-IN: models
-USING: help generic kernel ;
-
-HELP: model
-{ $class-description "A mutable placeholder for a single value. When the value is changed, a sequence of connected objects are notified. Models have the following slots:"
-    { $list
-        { { $link model-value } " - the value of the model. Use " { $link set-model } " to change the value." }
-        { { $link model-connections } " - a sequence of objects implementing the " { $link model-changed } " generic word, to be notified when the model's value changes." }
-        { { $link model-dependencies } " - a sequence of models which should have this model added to their sequence of connections when activated." }
-        { { $link model-ref } " - a reference count tracking the number of models which depend on this one." }
-    }
-"Other classes may delegate to " { $link model } "."
-} ;
-
-HELP: <model>
-{ $values { "value" object } { "model" "a new " { $link model } } }
-{ $description "Creates a new model with an initial value." } ;
-
-HELP: add-dependency
-{ $values { "dep" model } { "model" model } }
-{ $description "Registers a dependency. When " { $snippet "model" } " is activated, it will be added to " { $snippet "dep" } "'s connections and notified when " { $snippet "dep" } " changes." }
-{ $notes "This word should not be called directly unless you are implementing your own model class." }
-{ $see-also remove-dependency activate-model deactivate-model } ;
-
-HELP: remove-dependency
-{ $values { "dep" model } { "model" model } }
-{ $description "Unregisters a dependency." }
-{ $notes "This word should not be called directly unless you are implementing your own model class." }
-{ $see-also add-dependency activate-model deactivate-model } ;
-
-HELP: model-activated
-{ $values { "model" model } }
-{ $contract "Called after a model has been activated." }
-{ $see-also activate-model deactivate-model } ;
-
-HELP: activate-model
-{ $values { "model" model } }
-{ $description "Increments the reference count of the model. If it was previously zero, this model is added as a connection to all models registered as dependencies by " { $link add-dependency } "." }
-{ $warning "Calls to " { $link activate-model } " and " { $link deactivate-model } " should be balanced to keep the reference counting consistent, otherwise " { $link model-changed } " might be called at the wrong time or not at all." } ;
-
-HELP: deactivate-model
-{ $values { "model" model } }
-{ $description "Decrements the reference count of the model. If it reaches zero, this model is removed as a connection from all models registered as dependencies by " { $link add-dependency } "." }
-{ $warning "Calls to " { $link activate-model } " and " { $link deactivate-model } " should be balanced to keep the reference counting consistent, otherwise " { $link model-changed } " might be called at the wrong time or not at all." } ;
-
-HELP: model-changed
-{ $values { "observer" object } }
-{ $contract "Called to notify observers of a model that the model value has changed as a result of a call to " { $link set-model } ". Observers can be registered with " { $link add-connection } "." }
-{ $see-also remove-connection } ;
-
-HELP: add-connection
-{ $values { "observer" object } { "model" model } }
-{ $contract "Registers an object interested in being notified of changes to the model's value. When the value is changed as a result of a call to " { $link set-model } ", the " { $link model-changed } " word is called on the observer." }
-{ $see-also remove-connection add-dependency } ;
-
-HELP: remove-connection
-{ $values { "observer" object } { "model" model } }
-{ $contract "Unregisters an object no longer interested in being notified of changes to the model's value." }
-{ $see-also add-connection remove-dependency } ;
-
-HELP: set-model
-{ $values { "value" object } { "model" model } }
-{ $description "Changes the value of a model and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." }
-{ $see-also change-model } ;
-
-HELP: set-model-value ( value model -- )
-{ $values { "value" object } { "model" model } }
-{ $description "Changes the value of a model without notifying any observers registered with " { $link add-connection } "." }
-{ $notes "There are very few reasons for user code to call this word. Instead, call " { $link set-model } ", which notifies observers." }
-{ $see-also change-model } ;
-
-HELP: change-model
-{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } }
-{ $description "Applies the quotation to the current value of the model to yield a new value, then changes the value of the model to the new value, and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." }
-{ $see-also set-model } ;
-
-HELP: (change-model)
-{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } }
-{ $description "Applies the quotation to the current value of the model to yield a new value, then changes the value of the model to the new value without notifying any observers registered with " { $link add-connection } "." }
-{ $notes "There are very few reasons for user code to call this word. Instead, call " { $link change-model } ", which notifies observers." }
-{ $see-also set-model } ;
-
-HELP: delegate>model
-{ $values { "tuple" tuple } }
-{ $description
-    "Sets the tuple's delegate to a new " { $link model } " with an initial value of " { $link f } "."
-} ;
-
-HELP: filter
-{ $class-description "Filter model values are computed by applying a quotation to the value of another model. Filters are automatically updated when the underlying model changes. Filters are constructed by " { $link <filter> } "." } ;
-
-HELP: <filter>
-{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } { "filter" "a new " { $link filter } } }
-{ $description "Creates a new instance of " { $link filter } ". The value of the new filter model is computed by applying the quotation to the value." } ;
-
-HELP: compose
-{ $class-description "Compose model values are computed by collecting the values from a sequence of underlying models into a new sequence. Compose models are automatically updated when underlying models change. Compose models are constructed by " { $link <compose> } "." } ;
-
-HELP: <compose>
-{ $values { "models" "a sequence of models" } { "compose" "a new " { $link compose } } }
-{ $description "Creates a new instance of " { $link compose } ". The value of the new compose model is obtained by mapping " { $link model-value } " over the given sequence of models." } ;
-
-HELP: history
-{ $class-description "History models record a timeline of previous values on calls to " { $link add-history } ", and can travel back and forth on the timeline with " { $link go-back } " and " { $link go-forward } ". History models are constructed by " { $link <history> } "." } ;
-
-HELP: <history>
-{ $values { "value" object } { "history" "a new " { $link history } } }
-{ $description "Creates a new history model with an initial value." }
-{ $see-also add-history go-back go-forward } ;
-
-HELP: go-back
-{ $values { "history" history } }
-{ $description "Restores the previous value and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." }
-{ $see-also add-history go-forward } ;
-
-HELP: go-forward
-{ $values { "history" history } }
-{ $description "Restores the value set prior to the last call to " { $link go-back } " and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." }
-{ $see-also add-history go-back } ;
-
-HELP: add-history
-{ $values { "history" history } }
-{ $description "Adds the current value to the history." } ;
-
-HELP: delay
-{ $class-description "Delay models have the same value as their underlying model, however the value only changes after a timer expires. If the underlying model's value changes again before the timer expires, the timer restarts. Delay models are constructed by " { $link <delay> } "." } ;
-
-HELP: <delay>
-{ $values { "model" model } { "timeout" "a positive integer" } { "delay" delay } }
-{ $description "Creates a new instance of " { $link delay } ". A timer of " { $snippet "timeout" } " milliseconds must elapse from the time the underlying model last changed to when the delay model value is changed and its connections are notified." } ;
diff --git a/core/ui/opengl/gl.factor b/core/ui/opengl/gl.factor
deleted file mode 100644 (file)
index cffdcf3..0000000
+++ /dev/null
@@ -1,1327 +0,0 @@
-! Copyright (C) 2005 Alex Chapman.
-! See http://factorcode.org/license.txt for BSD license.
-
-! This file is based on the gl.h that comes with xorg-x11 6.8.2
-
-IN: opengl 
-USING: alien kernel sequences words ;
-
-windows? [
-    "gl" "opengl32.dll" "stdcall" add-library
-    "glu" "glu32.dll" "stdcall" add-library
-] when
-
-TYPEDEF: uint    GLenum
-TYPEDEF: uchar   GLboolean
-TYPEDEF: uint    GLbitfield
-TYPEDEF: char    GLbyte
-TYPEDEF: short   GLshort
-TYPEDEF: int     GLint
-TYPEDEF: int     GLsizei
-TYPEDEF: uchar   GLubyte
-TYPEDEF: ushort  GLushort
-TYPEDEF: uint    GLuint
-TYPEDEF: float   GLfloat
-TYPEDEF: float   GLclampf
-TYPEDEF: double  GLdouble
-TYPEDEF: double  GLclampd
-TYPEDEF: void*   GLvoid*
-
-! Constants
-
-! Boolean values
-: GL_FALSE                          HEX: 0 ; inline
-: GL_TRUE                           HEX: 1 ; inline
-
-! Data types
-: GL_BYTE                           HEX: 1400 ; inline
-: GL_UNSIGNED_BYTE                  HEX: 1401 ; inline
-: GL_SHORT                          HEX: 1402 ; inline
-: GL_UNSIGNED_SHORT                 HEX: 1403 ; inline
-: GL_INT                            HEX: 1404 ; inline
-: GL_UNSIGNED_INT                   HEX: 1405 ; inline
-: GL_FLOAT                          HEX: 1406 ; inline
-: GL_2_BYTES                        HEX: 1407 ; inline
-: GL_3_BYTES                        HEX: 1408 ; inline
-: GL_4_BYTES                        HEX: 1409 ; inline
-: GL_DOUBLE                         HEX: 140A ; inline
-
-! Primitives
-: GL_POINTS                         HEX: 0000 ; inline
-: GL_LINES                          HEX: 0001 ; inline
-: GL_LINE_LOOP                      HEX: 0002 ; inline
-: GL_LINE_STRIP                     HEX: 0003 ; inline
-: GL_TRIANGLES                      HEX: 0004 ; inline
-: GL_TRIANGLE_STRIP                 HEX: 0005 ; inline
-: GL_TRIANGLE_FAN                   HEX: 0006 ; inline
-: GL_QUADS                          HEX: 0007 ; inline
-: GL_QUAD_STRIP                     HEX: 0008 ; inline
-: GL_POLYGON                        HEX: 0009 ; inline
-
-! Vertex arrays
-: GL_VERTEX_ARRAY                   HEX: 8074 ; inline
-: GL_NORMAL_ARRAY                   HEX: 8075 ; inline
-: GL_COLOR_ARRAY                    HEX: 8076 ; inline
-: GL_INDEX_ARRAY                    HEX: 8077 ; inline
-: GL_TEXTURE_COORD_ARRAY            HEX: 8078 ; inline
-: GL_EDGE_FLAG_ARRAY                HEX: 8079 ; inline
-: GL_VERTEX_ARRAY_SIZE              HEX: 807A ; inline
-: GL_VERTEX_ARRAY_TYPE              HEX: 807B ; inline
-: GL_VERTEX_ARRAY_STRIDE            HEX: 807C ; inline
-: GL_NORMAL_ARRAY_TYPE              HEX: 807E ; inline
-: GL_NORMAL_ARRAY_STRIDE            HEX: 807F ; inline
-: GL_COLOR_ARRAY_SIZE               HEX: 8081 ; inline
-: GL_COLOR_ARRAY_TYPE               HEX: 8082 ; inline
-: GL_COLOR_ARRAY_STRIDE             HEX: 8083 ; inline
-: GL_INDEX_ARRAY_TYPE               HEX: 8085 ; inline
-: GL_INDEX_ARRAY_STRIDE             HEX: 8086 ; inline
-: GL_TEXTURE_COORD_ARRAY_SIZE       HEX: 8088 ; inline
-: GL_TEXTURE_COORD_ARRAY_TYPE       HEX: 8089 ; inline
-: GL_TEXTURE_COORD_ARRAY_STRIDE     HEX: 808A ; inline
-: GL_EDGE_FLAG_ARRAY_STRIDE         HEX: 808C ; inline
-: GL_VERTEX_ARRAY_POINTER           HEX: 808E ; inline
-: GL_NORMAL_ARRAY_POINTER           HEX: 808F ; inline
-: GL_COLOR_ARRAY_POINTER            HEX: 8090 ; inline
-: GL_INDEX_ARRAY_POINTER            HEX: 8091 ; inline
-: GL_TEXTURE_COORD_ARRAY_POINTER    HEX: 8092 ; inline
-: GL_EDGE_FLAG_ARRAY_POINTER        HEX: 8093 ; inline
-: GL_V2F                            HEX: 2A20 ; inline
-: GL_V3F                            HEX: 2A21 ; inline
-: GL_C4UB_V2F                       HEX: 2A22 ; inline
-: GL_C4UB_V3F                       HEX: 2A23 ; inline
-: GL_C3F_V3F                        HEX: 2A24 ; inline
-: GL_N3F_V3F                        HEX: 2A25 ; inline
-: GL_C4F_N3F_V3F                    HEX: 2A26 ; inline
-: GL_T2F_V3F                        HEX: 2A27 ; inline
-: GL_T4F_V4F                        HEX: 2A28 ; inline
-: GL_T2F_C4UB_V3F                   HEX: 2A29 ; inline
-: GL_T2F_C3F_V3F                    HEX: 2A2A ; inline
-: GL_T2F_N3F_V3F                    HEX: 2A2B ; inline
-: GL_T2F_C4F_N3F_V3F                HEX: 2A2C ; inline
-: GL_T4F_C4F_N3F_V4F                HEX: 2A2D ; inline
-
-! Matrix mode
-: GL_MATRIX_MODE                    HEX: 0BA0 ; inline
-: GL_MODELVIEW                      HEX: 1700 ; inline
-: GL_PROJECTION                     HEX: 1701 ; inline
-: GL_TEXTURE                        HEX: 1702 ; inline
-
-! Points
-: GL_POINT_SMOOTH                   HEX: 0B10 ; inline
-: GL_POINT_SIZE                     HEX: 0B11 ; inline
-: GL_POINT_SIZE_GRANULARITY         HEX: 0B13 ; inline
-: GL_POINT_SIZE_RANGE               HEX: 0B12 ; inline
-
-! Lines
-: GL_LINE_SMOOTH                    HEX: 0B20 ; inline
-: GL_LINE_STIPPLE                   HEX: 0B24 ; inline
-: GL_LINE_STIPPLE_PATTERN           HEX: 0B25 ; inline
-: GL_LINE_STIPPLE_REPEAT            HEX: 0B26 ; inline
-: GL_LINE_WIDTH                     HEX: 0B21 ; inline
-: GL_LINE_WIDTH_GRANULARITY         HEX: 0B23 ; inline
-: GL_LINE_WIDTH_RANGE               HEX: 0B22 ; inline
-
-! Polygons
-: GL_POINT                          HEX: 1B00 ; inline
-: GL_LINE                           HEX: 1B01 ; inline
-: GL_FILL                           HEX: 1B02 ; inline
-: GL_CW                             HEX: 0900 ; inline
-: GL_CCW                            HEX: 0901 ; inline
-: GL_FRONT                          HEX: 0404 ; inline
-: GL_BACK                           HEX: 0405 ; inline
-: GL_POLYGON_MODE                   HEX: 0B40 ; inline
-: GL_POLYGON_SMOOTH                 HEX: 0B41 ; inline
-: GL_POLYGON_STIPPLE                HEX: 0B42 ; inline
-: GL_EDGE_FLAG                      HEX: 0B43 ; inline
-: GL_CULL_FACE                      HEX: 0B44 ; inline
-: GL_CULL_FACE_MODE                 HEX: 0B45 ; inline
-: GL_FRONT_FACE                     HEX: 0B46 ; inline
-: GL_POLYGON_OFFSET_FACTOR          HEX: 8038 ; inline
-: GL_POLYGON_OFFSET_UNITS           HEX: 2A00 ; inline
-: GL_POLYGON_OFFSET_POINT           HEX: 2A01 ; inline
-: GL_POLYGON_OFFSET_LINE            HEX: 2A02 ; inline
-: GL_POLYGON_OFFSET_FILL            HEX: 8037 ; inline
-
-! Display Lists
-: GL_COMPILE                        HEX: 1300 ; inline
-: GL_COMPILE_AND_EXECUTE            HEX: 1301 ; inline
-: GL_LIST_BASE                      HEX: 0B32 ; inline
-: GL_LIST_INDEX                     HEX: 0B33 ; inline
-: GL_LIST_MODE                      HEX: 0B30 ; inline
-
-! Depth buffer
-: GL_NEVER                          HEX: 0200 ; inline
-: GL_LESS                           HEX: 0201 ; inline
-: GL_EQUAL                          HEX: 0202 ; inline
-: GL_LEQUAL                         HEX: 0203 ; inline
-: GL_GREATER                        HEX: 0204 ; inline
-: GL_NOTEQUAL                       HEX: 0205 ; inline
-: GL_GEQUAL                         HEX: 0206 ; inline
-: GL_ALWAYS                         HEX: 0207 ; inline
-: GL_DEPTH_TEST                     HEX: 0B71 ; inline
-: GL_DEPTH_BITS                     HEX: 0D56 ; inline
-: GL_DEPTH_CLEAR_VALUE              HEX: 0B73 ; inline
-: GL_DEPTH_FUNC                     HEX: 0B74 ; inline
-: GL_DEPTH_RANGE                    HEX: 0B70 ; inline
-: GL_DEPTH_WRITEMASK                HEX: 0B72 ; inline
-: GL_DEPTH_COMPONENT                HEX: 1902 ; inline
-
-! Lighting
-: GL_LIGHTING                       HEX: 0B50 ; inline
-: GL_LIGHT0                         HEX: 4000 ; inline
-: GL_LIGHT1                         HEX: 4001 ; inline
-: GL_LIGHT2                         HEX: 4002 ; inline
-: GL_LIGHT3                         HEX: 4003 ; inline
-: GL_LIGHT4                         HEX: 4004 ; inline
-: GL_LIGHT5                         HEX: 4005 ; inline
-: GL_LIGHT6                         HEX: 4006 ; inline
-: GL_LIGHT7                         HEX: 4007 ; inline
-: GL_SPOT_EXPONENT                  HEX: 1205 ; inline
-: GL_SPOT_CUTOFF                    HEX: 1206 ; inline
-: GL_CONSTANT_ATTENUATION           HEX: 1207 ; inline
-: GL_LINEAR_ATTENUATION             HEX: 1208 ; inline
-: GL_QUADRATIC_ATTENUATION          HEX: 1209 ; inline
-: GL_AMBIENT                        HEX: 1200 ; inline
-: GL_DIFFUSE                        HEX: 1201 ; inline
-: GL_SPECULAR                       HEX: 1202 ; inline
-: GL_SHININESS                      HEX: 1601 ; inline
-: GL_EMISSION                       HEX: 1600 ; inline
-: GL_POSITION                       HEX: 1203 ; inline
-: GL_SPOT_DIRECTION                 HEX: 1204 ; inline
-: GL_AMBIENT_AND_DIFFUSE            HEX: 1602 ; inline
-: GL_COLOR_INDEXES                  HEX: 1603 ; inline
-: GL_LIGHT_MODEL_TWO_SIDE           HEX: 0B52 ; inline
-: GL_LIGHT_MODEL_LOCAL_VIEWER       HEX: 0B51 ; inline
-: GL_LIGHT_MODEL_AMBIENT            HEX: 0B53 ; inline
-: GL_FRONT_AND_BACK                 HEX: 0408 ; inline
-: GL_SHADE_MODEL                    HEX: 0B54 ; inline
-: GL_FLAT                           HEX: 1D00 ; inline
-: GL_SMOOTH                         HEX: 1D01 ; inline
-: GL_COLOR_MATERIAL                 HEX: 0B57 ; inline
-: GL_COLOR_MATERIAL_FACE            HEX: 0B55 ; inline
-: GL_COLOR_MATERIAL_PARAMETER       HEX: 0B56 ; inline
-: GL_NORMALIZE                      HEX: 0BA1 ; inline
-
-! User clipping planes
-: GL_CLIP_PLANE0                    HEX: 3000 ; inline
-: GL_CLIP_PLANE1                    HEX: 3001 ; inline
-: GL_CLIP_PLANE2                    HEX: 3002 ; inline
-: GL_CLIP_PLANE3                    HEX: 3003 ; inline
-: GL_CLIP_PLANE4                    HEX: 3004 ; inline
-: GL_CLIP_PLANE5                    HEX: 3005 ; inline
-
-! Accumulation buffer
-: GL_ACCUM_RED_BITS                 HEX: 0D58 ; inline
-: GL_ACCUM_GREEN_BITS               HEX: 0D59 ; inline
-: GL_ACCUM_BLUE_BITS                HEX: 0D5A ; inline
-: GL_ACCUM_ALPHA_BITS               HEX: 0D5B ; inline
-: GL_ACCUM_CLEAR_VALUE              HEX: 0B80 ; inline
-: GL_ACCUM                          HEX: 0100 ; inline
-: GL_ADD                            HEX: 0104 ; inline
-: GL_LOAD                           HEX: 0101 ; inline
-: GL_MULT                           HEX: 0103 ; inline
-: GL_RETURN                         HEX: 0102 ; inline
-
-! Alpha testing
-: GL_ALPHA_TEST                     HEX: 0BC0 ; inline
-: GL_ALPHA_TEST_REF                 HEX: 0BC2 ; inline
-: GL_ALPHA_TEST_FUNC                HEX: 0BC1 ; inline
-
-! Blending
-: GL_BLEND                          HEX: 0BE2 ; inline
-: GL_BLEND_SRC                      HEX: 0BE1 ; inline
-: GL_BLEND_DST                      HEX: 0BE0 ; inline
-: GL_ZERO                           HEX: 0 ;  inline
-: GL_ONE                            HEX: 1 ;  inline
-: GL_SRC_COLOR                      HEX: 0300 ; inline
-: GL_ONE_MINUS_SRC_COLOR            HEX: 0301 ; inline
-: GL_SRC_ALPHA                      HEX: 0302 ; inline
-: GL_ONE_MINUS_SRC_ALPHA            HEX: 0303 ; inline
-: GL_DST_ALPHA                      HEX: 0304 ; inline
-: GL_ONE_MINUS_DST_ALPHA            HEX: 0305 ; inline
-: GL_DST_COLOR                      HEX: 0306 ; inline
-: GL_ONE_MINUS_DST_COLOR            HEX: 0307 ; inline
-: GL_SRC_ALPHA_SATURATE             HEX: 0308 ; inline
-
-! Render Mode
-: GL_FEEDBACK                       HEX: 1C01 ; inline
-: GL_RENDER                         HEX: 1C00 ; inline
-: GL_SELECT                         HEX: 1C02 ; inline
-
-! Feedback
-: GL_2D                             HEX: 0600 ; inline
-: GL_3D                             HEX: 0601 ; inline
-: GL_3D_COLOR                       HEX: 0602 ; inline
-: GL_3D_COLOR_TEXTURE               HEX: 0603 ; inline
-: GL_4D_COLOR_TEXTURE               HEX: 0604 ; inline
-: GL_POINT_TOKEN                    HEX: 0701 ; inline
-: GL_LINE_TOKEN                     HEX: 0702 ; inline
-: GL_LINE_RESET_TOKEN               HEX: 0707 ; inline
-: GL_POLYGON_TOKEN                  HEX: 0703 ; inline
-: GL_BITMAP_TOKEN                   HEX: 0704 ; inline
-: GL_DRAW_PIXEL_TOKEN               HEX: 0705 ; inline
-: GL_COPY_PIXEL_TOKEN               HEX: 0706 ; inline
-: GL_PASS_THROUGH_TOKEN             HEX: 0700 ; inline
-: GL_FEEDBACK_BUFFER_POINTER        HEX: 0DF0 ; inline
-: GL_FEEDBACK_BUFFER_SIZE           HEX: 0DF1 ; inline
-: GL_FEEDBACK_BUFFER_TYPE           HEX: 0DF2 ; inline
-
-! Selection
-: GL_SELECTION_BUFFER_POINTER       HEX: 0DF3 ; inline
-: GL_SELECTION_BUFFER_SIZE          HEX: 0DF4 ; inline
-
-! Fog
-: GL_FOG                            HEX: 0B60 ; inline
-: GL_FOG_MODE                       HEX: 0B65 ; inline
-: GL_FOG_DENSITY                    HEX: 0B62 ; inline
-: GL_FOG_COLOR                      HEX: 0B66 ; inline
-: GL_FOG_INDEX                      HEX: 0B61 ; inline
-: GL_FOG_START                      HEX: 0B63 ; inline
-: GL_FOG_END                        HEX: 0B64 ; inline
-: GL_LINEAR                         HEX: 2601 ; inline
-: GL_EXP                            HEX: 0800 ; inline
-: GL_EXP2                           HEX: 0801 ; inline
-
-! Logic Ops
-: GL_LOGIC_OP                       HEX: 0BF1 ; inline
-: GL_INDEX_LOGIC_OP                 HEX: 0BF1 ; inline
-: GL_COLOR_LOGIC_OP                 HEX: 0BF2 ; inline
-: GL_LOGIC_OP_MODE                  HEX: 0BF0 ; inline
-: GL_CLEAR                          HEX: 1500 ; inline
-: GL_SET                            HEX: 150F ; inline
-: GL_COPY                           HEX: 1503 ; inline
-: GL_COPY_INVERTED                  HEX: 150C ; inline
-: GL_NOOP                           HEX: 1505 ; inline
-: GL_INVERT                         HEX: 150A ; inline
-: GL_AND                            HEX: 1501 ; inline
-: GL_NAND                           HEX: 150E ; inline
-: GL_OR                             HEX: 1507 ; inline
-: GL_NOR                            HEX: 1508 ; inline
-: GL_XOR                            HEX: 1506 ; inline
-: GL_EQUIV                          HEX: 1509 ; inline
-: GL_AND_REVERSE                    HEX: 1502 ; inline
-: GL_AND_INVERTED                   HEX: 1504 ; inline
-: GL_OR_REVERSE                     HEX: 150B ; inline
-: GL_OR_INVERTED                    HEX: 150D ; inline
-
-! Stencil
-: GL_STENCIL_TEST                   HEX: 0B90 ; inline
-: GL_STENCIL_WRITEMASK              HEX: 0B98 ; inline
-: GL_STENCIL_BITS                   HEX: 0D57 ; inline
-: GL_STENCIL_FUNC                   HEX: 0B92 ; inline
-: GL_STENCIL_VALUE_MASK             HEX: 0B93 ; inline
-: GL_STENCIL_REF                    HEX: 0B97 ; inline
-: GL_STENCIL_FAIL                   HEX: 0B94 ; inline
-: GL_STENCIL_PASS_DEPTH_PASS        HEX: 0B96 ; inline
-: GL_STENCIL_PASS_DEPTH_FAIL        HEX: 0B95 ; inline
-: GL_STENCIL_CLEAR_VALUE            HEX: 0B91 ; inline
-: GL_STENCIL_INDEX                  HEX: 1901 ; inline
-: GL_KEEP                           HEX: 1E00 ; inline
-: GL_REPLACE                        HEX: 1E01 ; inline
-: GL_INCR                           HEX: 1E02 ; inline
-: GL_DECR                           HEX: 1E03 ; inline
-
-! Buffers, Pixel Drawing/Reading
-: GL_NONE                           HEX:    0 ; inline
-: GL_LEFT                           HEX: 0406 ; inline
-: GL_RIGHT                          HEX: 0407 ; inline
-! defined elsewhere
-! GL_FRONT                          HEX: 0404
-! GL_BACK                           HEX: 0405
-! GL_FRONT_AND_BACK                 HEX: 0408
-: GL_FRONT_LEFT                     HEX: 0400 ; inline
-: GL_FRONT_RIGHT                    HEX: 0401 ; inline
-: GL_BACK_LEFT                      HEX: 0402 ; inline
-: GL_BACK_RIGHT                     HEX: 0403 ; inline
-: GL_AUX0                           HEX: 0409 ; inline
-: GL_AUX1                           HEX: 040A ; inline
-: GL_AUX2                           HEX: 040B ; inline
-: GL_AUX3                           HEX: 040C ; inline
-: GL_COLOR_INDEX                    HEX: 1900 ; inline
-: GL_RED                            HEX: 1903 ; inline
-: GL_GREEN                          HEX: 1904 ; inline
-: GL_BLUE                           HEX: 1905 ; inline
-: GL_ALPHA                          HEX: 1906 ; inline
-: GL_LUMINANCE                      HEX: 1909 ; inline
-: GL_LUMINANCE_ALPHA                HEX: 190A ; inline
-: GL_ALPHA_BITS                     HEX: 0D55 ; inline
-: GL_RED_BITS                       HEX: 0D52 ; inline
-: GL_GREEN_BITS                     HEX: 0D53 ; inline
-: GL_BLUE_BITS                      HEX: 0D54 ; inline
-: GL_INDEX_BITS                     HEX: 0D51 ; inline
-: GL_SUBPIXEL_BITS                  HEX: 0D50 ; inline
-: GL_AUX_BUFFERS                    HEX: 0C00 ; inline
-: GL_READ_BUFFER                    HEX: 0C02 ; inline
-: GL_DRAW_BUFFER                    HEX: 0C01 ; inline
-: GL_DOUBLEBUFFER                   HEX: 0C32 ; inline
-: GL_STEREO                         HEX: 0C33 ; inline
-: GL_BITMAP                         HEX: 1A00 ; inline
-: GL_COLOR                          HEX: 1800 ; inline
-: GL_DEPTH                          HEX: 1801 ; inline
-: GL_STENCIL                        HEX: 1802 ; inline
-: GL_DITHER                         HEX: 0BD0 ; inline
-: GL_RGB                            HEX: 1907 ; inline
-: GL_RGBA                           HEX: 1908 ; inline
-
-! Implementation limits
-: GL_MAX_LIST_NESTING               HEX: 0B31 ; inline
-: GL_MAX_ATTRIB_STACK_DEPTH         HEX: 0D35 ; inline
-: GL_MAX_MODELVIEW_STACK_DEPTH      HEX: 0D36 ; inline
-: GL_MAX_NAME_STACK_DEPTH           HEX: 0D37 ; inline
-: GL_MAX_PROJECTION_STACK_DEPTH     HEX: 0D38 ; inline
-: GL_MAX_TEXTURE_STACK_DEPTH        HEX: 0D39 ; inline
-: GL_MAX_EVAL_ORDER                 HEX: 0D30 ; inline
-: GL_MAX_LIGHTS                     HEX: 0D31 ; inline
-: GL_MAX_CLIP_PLANES                HEX: 0D32 ; inline
-: GL_MAX_TEXTURE_SIZE               HEX: 0D33 ; inline
-: GL_MAX_PIXEL_MAP_TABLE            HEX: 0D34 ; inline
-: GL_MAX_VIEWPORT_DIMS              HEX: 0D3A ; inline
-: GL_MAX_CLIENT_ATTRIB_STACK_DEPTH  HEX: 0D3B ; inline
-
-! Gets
-: GL_ATTRIB_STACK_DEPTH             HEX: 0BB0 ; inline
-: GL_CLIENT_ATTRIB_STACK_DEPTH      HEX: 0BB1 ; inline
-: GL_COLOR_CLEAR_VALUE              HEX: 0C22 ; inline
-: GL_COLOR_WRITEMASK                HEX: 0C23 ; inline
-: GL_CURRENT_INDEX                  HEX: 0B01 ; inline
-: GL_CURRENT_COLOR                  HEX: 0B00 ; inline
-: GL_CURRENT_NORMAL                 HEX: 0B02 ; inline
-: GL_CURRENT_RASTER_COLOR           HEX: 0B04 ; inline
-: GL_CURRENT_RASTER_DISTANCE        HEX: 0B09 ; inline
-: GL_CURRENT_RASTER_INDEX           HEX: 0B05 ; inline
-: GL_CURRENT_RASTER_POSITION        HEX: 0B07 ; inline
-: GL_CURRENT_RASTER_TEXTURE_COORDS  HEX: 0B06 ; inline
-: GL_CURRENT_RASTER_POSITION_VALID  HEX: 0B08 ; inline
-: GL_CURRENT_TEXTURE_COORDS         HEX: 0B03 ; inline
-: GL_INDEX_CLEAR_VALUE              HEX: 0C20 ; inline
-: GL_INDEX_MODE                     HEX: 0C30 ; inline
-: GL_INDEX_WRITEMASK                HEX: 0C21 ; inline
-: GL_MODELVIEW_MATRIX               HEX: 0BA6 ; inline
-: GL_MODELVIEW_STACK_DEPTH          HEX: 0BA3 ; inline
-: GL_NAME_STACK_DEPTH               HEX: 0D70 ; inline
-: GL_PROJECTION_MATRIX              HEX: 0BA7 ; inline
-: GL_PROJECTION_STACK_DEPTH         HEX: 0BA4 ; inline
-: GL_RENDER_MODE                    HEX: 0C40 ; inline
-: GL_RGBA_MODE                      HEX: 0C31 ; inline
-: GL_TEXTURE_MATRIX                 HEX: 0BA8 ; inline
-: GL_TEXTURE_STACK_DEPTH            HEX: 0BA5 ; inline
-: GL_VIEWPORT                       HEX: 0BA2 ; inline
-
-! Evaluators inline
-: GL_AUTO_NORMAL                    HEX: 0D80 ; inline
-: GL_MAP1_COLOR_4                   HEX: 0D90 ; inline
-: GL_MAP1_INDEX                     HEX: 0D91 ; inline
-: GL_MAP1_NORMAL                    HEX: 0D92 ; inline
-: GL_MAP1_TEXTURE_COORD_1           HEX: 0D93 ; inline
-: GL_MAP1_TEXTURE_COORD_2           HEX: 0D94 ; inline
-: GL_MAP1_TEXTURE_COORD_3           HEX: 0D95 ; inline
-: GL_MAP1_TEXTURE_COORD_4           HEX: 0D96 ; inline
-: GL_MAP1_VERTEX_3                  HEX: 0D97 ; inline
-: GL_MAP1_VERTEX_4                  HEX: 0D98 ; inline
-: GL_MAP2_COLOR_4                   HEX: 0DB0 ; inline
-: GL_MAP2_INDEX                     HEX: 0DB1 ; inline
-: GL_MAP2_NORMAL                    HEX: 0DB2 ; inline
-: GL_MAP2_TEXTURE_COORD_1           HEX: 0DB3 ; inline
-: GL_MAP2_TEXTURE_COORD_2           HEX: 0DB4 ; inline
-: GL_MAP2_TEXTURE_COORD_3           HEX: 0DB5 ; inline
-: GL_MAP2_TEXTURE_COORD_4           HEX: 0DB6 ; inline
-: GL_MAP2_VERTEX_3                  HEX: 0DB7 ; inline
-: GL_MAP2_VERTEX_4                  HEX: 0DB8 ; inline
-: GL_MAP1_GRID_DOMAIN               HEX: 0DD0 ; inline
-: GL_MAP1_GRID_SEGMENTS             HEX: 0DD1 ; inline
-: GL_MAP2_GRID_DOMAIN               HEX: 0DD2 ; inline
-: GL_MAP2_GRID_SEGMENTS             HEX: 0DD3 ; inline
-: GL_COEFF                          HEX: 0A00 ; inline
-: GL_DOMAIN                         HEX: 0A02 ; inline
-: GL_ORDER                          HEX: 0A01 ; inline
-
-! Hints inline
-: GL_FOG_HINT                       HEX: 0C54 ; inline
-: GL_LINE_SMOOTH_HINT               HEX: 0C52 ; inline
-: GL_PERSPECTIVE_CORRECTION_HINT    HEX: 0C50 ; inline
-: GL_POINT_SMOOTH_HINT              HEX: 0C51 ; inline
-: GL_POLYGON_SMOOTH_HINT            HEX: 0C53 ; inline
-: GL_DONT_CARE                      HEX: 1100 ; inline
-: GL_FASTEST                        HEX: 1101 ; inline
-: GL_NICEST                         HEX: 1102 ; inline
-
-! Scissor box inline
-: GL_SCISSOR_TEST                   HEX: 0C11 ; inline
-: GL_SCISSOR_BOX                    HEX: 0C10 ; inline
-
-! Pixel Mode / Transfer inline
-: GL_MAP_COLOR                      HEX: 0D10 ; inline
-: GL_MAP_STENCIL                    HEX: 0D11 ; inline
-: GL_INDEX_SHIFT                    HEX: 0D12 ; inline
-: GL_INDEX_OFFSET                   HEX: 0D13 ; inline
-: GL_RED_SCALE                      HEX: 0D14 ; inline
-: GL_RED_BIAS                       HEX: 0D15 ; inline
-: GL_GREEN_SCALE                    HEX: 0D18 ; inline
-: GL_GREEN_BIAS                     HEX: 0D19 ; inline
-: GL_BLUE_SCALE                     HEX: 0D1A ; inline
-: GL_BLUE_BIAS                      HEX: 0D1B ; inline
-: GL_ALPHA_SCALE                    HEX: 0D1C ; inline
-: GL_ALPHA_BIAS                     HEX: 0D1D ; inline
-: GL_DEPTH_SCALE                    HEX: 0D1E ; inline
-: GL_DEPTH_BIAS                     HEX: 0D1F ; inline
-: GL_PIXEL_MAP_S_TO_S_SIZE          HEX: 0CB1 ; inline
-: GL_PIXEL_MAP_I_TO_I_SIZE          HEX: 0CB0 ; inline
-: GL_PIXEL_MAP_I_TO_R_SIZE          HEX: 0CB2 ; inline
-: GL_PIXEL_MAP_I_TO_G_SIZE          HEX: 0CB3 ; inline
-: GL_PIXEL_MAP_I_TO_B_SIZE          HEX: 0CB4 ; inline
-: GL_PIXEL_MAP_I_TO_A_SIZE          HEX: 0CB5 ; inline
-: GL_PIXEL_MAP_R_TO_R_SIZE          HEX: 0CB6 ; inline
-: GL_PIXEL_MAP_G_TO_G_SIZE          HEX: 0CB7 ; inline
-: GL_PIXEL_MAP_B_TO_B_SIZE          HEX: 0CB8 ; inline
-: GL_PIXEL_MAP_A_TO_A_SIZE          HEX: 0CB9 ; inline
-: GL_PIXEL_MAP_S_TO_S               HEX: 0C71 ; inline
-: GL_PIXEL_MAP_I_TO_I               HEX: 0C70 ; inline
-: GL_PIXEL_MAP_I_TO_R               HEX: 0C72 ; inline
-: GL_PIXEL_MAP_I_TO_G               HEX: 0C73 ; inline
-: GL_PIXEL_MAP_I_TO_B               HEX: 0C74 ; inline
-: GL_PIXEL_MAP_I_TO_A               HEX: 0C75 ; inline
-: GL_PIXEL_MAP_R_TO_R               HEX: 0C76 ; inline
-: GL_PIXEL_MAP_G_TO_G               HEX: 0C77 ; inline
-: GL_PIXEL_MAP_B_TO_B               HEX: 0C78 ; inline
-: GL_PIXEL_MAP_A_TO_A               HEX: 0C79 ; inline
-: GL_PACK_ALIGNMENT                 HEX: 0D05 ; inline
-: GL_PACK_LSB_FIRST                 HEX: 0D01 ; inline
-: GL_PACK_ROW_LENGTH                HEX: 0D02 ; inline
-: GL_PACK_SKIP_PIXELS               HEX: 0D04 ; inline
-: GL_PACK_SKIP_ROWS                 HEX: 0D03 ; inline
-: GL_PACK_SWAP_BYTES                HEX: 0D00 ; inline
-: GL_UNPACK_ALIGNMENT               HEX: 0CF5 ; inline
-: GL_UNPACK_LSB_FIRST               HEX: 0CF1 ; inline
-: GL_UNPACK_ROW_LENGTH              HEX: 0CF2 ; inline
-: GL_UNPACK_SKIP_PIXELS             HEX: 0CF4 ; inline
-: GL_UNPACK_SKIP_ROWS               HEX: 0CF3 ; inline
-: GL_UNPACK_SWAP_BYTES              HEX: 0CF0 ; inline
-: GL_ZOOM_X                         HEX: 0D16 ; inline
-: GL_ZOOM_Y                         HEX: 0D17 ; inline
-
-! Texture mapping inline
-: GL_TEXTURE_ENV                    HEX: 2300 ; inline
-: GL_TEXTURE_ENV_MODE               HEX: 2200 ; inline
-: GL_TEXTURE_1D                     HEX: 0DE0 ; inline
-: GL_TEXTURE_2D                     HEX: 0DE1 ; inline
-: GL_TEXTURE_WRAP_S                 HEX: 2802 ; inline
-: GL_TEXTURE_WRAP_T                 HEX: 2803 ; inline
-: GL_TEXTURE_MAG_FILTER             HEX: 2800 ; inline
-: GL_TEXTURE_MIN_FILTER             HEX: 2801 ; inline
-: GL_TEXTURE_ENV_COLOR              HEX: 2201 ; inline
-: GL_TEXTURE_GEN_S                  HEX: 0C60 ; inline
-: GL_TEXTURE_GEN_T                  HEX: 0C61 ; inline
-: GL_TEXTURE_GEN_MODE               HEX: 2500 ; inline
-: GL_TEXTURE_BORDER_COLOR           HEX: 1004 ; inline
-: GL_TEXTURE_WIDTH                  HEX: 1000 ; inline
-: GL_TEXTURE_HEIGHT                 HEX: 1001 ; inline
-: GL_TEXTURE_BORDER                 HEX: 1005 ; inline
-: GL_TEXTURE_COMPONENTS             HEX: 1003 ; inline
-: GL_TEXTURE_RED_SIZE               HEX: 805C ; inline
-: GL_TEXTURE_GREEN_SIZE             HEX: 805D ; inline
-: GL_TEXTURE_BLUE_SIZE              HEX: 805E ; inline
-: GL_TEXTURE_ALPHA_SIZE             HEX: 805F ; inline
-: GL_TEXTURE_LUMINANCE_SIZE         HEX: 8060 ; inline
-: GL_TEXTURE_INTENSITY_SIZE         HEX: 8061 ; inline
-: GL_NEAREST_MIPMAP_NEAREST         HEX: 2700 ; inline
-: GL_NEAREST_MIPMAP_LINEAR          HEX: 2702 ; inline
-: GL_LINEAR_MIPMAP_NEAREST          HEX: 2701 ; inline
-: GL_LINEAR_MIPMAP_LINEAR           HEX: 2703 ; inline
-: GL_OBJECT_LINEAR                  HEX: 2401 ; inline
-: GL_OBJECT_PLANE                   HEX: 2501 ; inline
-: GL_EYE_LINEAR                     HEX: 2400 ; inline
-: GL_EYE_PLANE                      HEX: 2502 ; inline
-: GL_SPHERE_MAP                     HEX: 2402 ; inline
-: GL_DECAL                          HEX: 2101 ; inline
-: GL_MODULATE                       HEX: 2100 ; inline
-: GL_NEAREST                        HEX: 2600 ; inline
-: GL_REPEAT                         HEX: 2901 ; inline
-: GL_CLAMP                          HEX: 2900 ; inline
-: GL_S                              HEX: 2000 ; inline
-: GL_T                              HEX: 2001 ; inline
-: GL_R                              HEX: 2002 ; inline
-: GL_Q                              HEX: 2003 ; inline
-: GL_TEXTURE_GEN_R                  HEX: 0C62 ; inline
-: GL_TEXTURE_GEN_Q                  HEX: 0C63 ; inline
-
-! Utility inline
-: GL_VENDOR                         HEX: 1F00 ; inline
-: GL_RENDERER                       HEX: 1F01 ; inline
-: GL_VERSION                        HEX: 1F02 ; inline
-: GL_EXTENSIONS                     HEX: 1F03 ; inline
-
-! Errors inline
-: GL_NO_ERROR                       HEX:    0 ; inline
-: GL_INVALID_VALUE                  HEX: 0501 ; inline
-: GL_INVALID_ENUM                   HEX: 0500 ; inline
-: GL_INVALID_OPERATION              HEX: 0502 ; inline
-: GL_STACK_OVERFLOW                 HEX: 0503 ; inline
-: GL_STACK_UNDERFLOW                HEX: 0504 ; inline
-: GL_OUT_OF_MEMORY                  HEX: 0505 ; inline
-
-! glPush/PopAttrib bits
-: GL_CURRENT_BIT                    HEX: 00000001 ; inline
-: GL_POINT_BIT                      HEX: 00000002 ; inline
-: GL_LINE_BIT                       HEX: 00000004 ; inline
-: GL_POLYGON_BIT                    HEX: 00000008 ; inline
-: GL_POLYGON_STIPPLE_BIT            HEX: 00000010 ; inline
-: GL_PIXEL_MODE_BIT                 HEX: 00000020 ; inline
-: GL_LIGHTING_BIT                   HEX: 00000040 ; inline
-: GL_FOG_BIT                        HEX: 00000080 ; inline
-: GL_DEPTH_BUFFER_BIT               HEX: 00000100 ; inline
-: GL_ACCUM_BUFFER_BIT               HEX: 00000200 ; inline
-: GL_STENCIL_BUFFER_BIT             HEX: 00000400 ; inline
-: GL_VIEWPORT_BIT                   HEX: 00000800 ; inline
-: GL_TRANSFORM_BIT                  HEX: 00001000 ; inline
-: GL_ENABLE_BIT                     HEX: 00002000 ; inline
-: GL_COLOR_BUFFER_BIT               HEX: 00004000 ; inline
-: GL_HINT_BIT                       HEX: 00008000 ; inline
-: GL_EVAL_BIT                       HEX: 00010000 ; inline
-: GL_LIST_BIT                       HEX: 00020000 ; inline
-: GL_TEXTURE_BIT                    HEX: 00040000 ; inline
-: GL_SCISSOR_BIT                    HEX: 00080000 ; inline
-: GL_ALL_ATTRIB_BITS                HEX: 000FFFFF ; inline
-
-! OpenGL 1.1
-: GL_PROXY_TEXTURE_1D               HEX: 8063 ; inline
-: GL_PROXY_TEXTURE_2D               HEX: 8064 ; inline
-: GL_TEXTURE_PRIORITY               HEX: 8066 ; inline
-: GL_TEXTURE_RESIDENT               HEX: 8067 ; inline
-: GL_TEXTURE_BINDING_1D             HEX: 8068 ; inline
-: GL_TEXTURE_BINDING_2D             HEX: 8069 ; inline
-: GL_TEXTURE_INTERNAL_FORMAT        HEX: 1003 ; inline
-: GL_ALPHA4                         HEX: 803B ; inline
-: GL_ALPHA8                         HEX: 803C ; inline
-: GL_ALPHA12                        HEX: 803D ; inline
-: GL_ALPHA16                        HEX: 803E ; inline
-: GL_LUMINANCE4                     HEX: 803F ; inline
-: GL_LUMINANCE8                     HEX: 8040 ; inline
-: GL_LUMINANCE12                    HEX: 8041 ; inline
-: GL_LUMINANCE16                    HEX: 8042 ; inline
-: GL_LUMINANCE4_ALPHA4              HEX: 8043 ; inline
-: GL_LUMINANCE6_ALPHA2              HEX: 8044 ; inline
-: GL_LUMINANCE8_ALPHA8              HEX: 8045 ; inline
-: GL_LUMINANCE12_ALPHA4             HEX: 8046 ; inline
-: GL_LUMINANCE12_ALPHA12            HEX: 8047 ; inline
-: GL_LUMINANCE16_ALPHA16            HEX: 8048 ; inline
-: GL_INTENSITY                      HEX: 8049 ; inline
-: GL_INTENSITY4                     HEX: 804A ; inline
-: GL_INTENSITY8                     HEX: 804B ; inline
-: GL_INTENSITY12                    HEX: 804C ; inline
-: GL_INTENSITY16                    HEX: 804D ; inline
-: GL_R3_G3_B2                       HEX: 2A10 ; inline
-: GL_RGB4                           HEX: 804F ; inline
-: GL_RGB5                           HEX: 8050 ; inline
-: GL_RGB8                           HEX: 8051 ; inline
-: GL_RGB10                          HEX: 8052 ; inline
-: GL_RGB12                          HEX: 8053 ; inline
-: GL_RGB16                          HEX: 8054 ; inline
-: GL_RGBA2                          HEX: 8055 ; inline
-: GL_RGBA4                          HEX: 8056 ; inline
-: GL_RGB5_A1                        HEX: 8057 ; inline
-: GL_RGBA8                          HEX: 8058 ; inline
-: GL_RGB10_A2                       HEX: 8059 ; inline
-: GL_RGBA12                         HEX: 805A ; inline
-: GL_RGBA16                         HEX: 805B ; inline
-: GL_CLIENT_PIXEL_STORE_BIT         HEX: 00000001 ; inline
-: GL_CLIENT_VERTEX_ARRAY_BIT        HEX: 00000002 ; inline
-: GL_ALL_CLIENT_ATTRIB_BITS         HEX: FFFFFFFF ; inline
-: GL_CLIENT_ALL_ATTRIB_BITS         HEX: FFFFFFFF ; inline
-
-LIBRARY: gl
-
-! Miscellaneous
-
-FUNCTION: void glClearIndex ( GLfloat c ) ;
-FUNCTION: void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ;
-FUNCTION: void glClear ( GLbitfield mask ) ;
-FUNCTION: void glIndexMask ( GLuint mask ) ;
-FUNCTION: void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) ;
-FUNCTION: void glAlphaFunc ( GLenum func, GLclampf ref ) ;
-FUNCTION: void glBlendFunc ( GLenum sfactor, GLenum dfactor ) ;
-FUNCTION: void glLogicOp ( GLenum opcode ) ;
-FUNCTION: void glCullFace ( GLenum mode ) ;
-FUNCTION: void glFrontFace ( GLenum mode ) ;
-FUNCTION: void glPointSize ( GLfloat size ) ;
-FUNCTION: void glLineWidth ( GLfloat width ) ;
-FUNCTION: void glLineStipple ( GLint factor, GLushort pattern ) ;
-FUNCTION: void glPolygonMode ( GLenum face, GLenum mode ) ;
-FUNCTION: void glPolygonOffset ( GLfloat factor, GLfloat units ) ;
-FUNCTION: void glPolygonStipple ( GLubyte* mask ) ;
-FUNCTION: void glGetPolygonStipple ( GLubyte* mask ) ;
-FUNCTION: void glEdgeFlag ( GLboolean flag ) ;
-FUNCTION: void glEdgeFlagv ( GLboolean* flag ) ;
-FUNCTION: void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) ;
-FUNCTION: void glClipPlane ( GLenum plane, GLdouble* equation ) ;
-FUNCTION: void glGetClipPlane ( GLenum plane, GLdouble* equation ) ;
-FUNCTION: void glDrawBuffer ( GLenum mode ) ;
-FUNCTION: void glReadBuffer ( GLenum mode ) ;
-FUNCTION: void glEnable ( GLenum cap ) ;
-FUNCTION: void glDisable ( GLenum cap ) ;
-FUNCTION: GLboolean glIsEnabled ( GLenum cap ) ;
-FUNCTION: void glEnableClientState ( GLenum cap ) ;
-FUNCTION: void glDisableClientState ( GLenum cap ) ;
-FUNCTION: void glGetBooleanv ( GLenum pname, GLboolean* params ) ;
-FUNCTION: void glGetDoublev ( GLenum pname, GLdouble* params ) ;
-FUNCTION: void glGetFloatv ( GLenum pname, GLfloat* params ) ;
-FUNCTION: void glGetIntegerv ( GLenum pname, GLint* params ) ;
-
-FUNCTION: void glPushAttrib ( GLbitfield mask ) ;
-FUNCTION: void glPopAttrib ( ) ;
-
-FUNCTION: void glPushClientAttrib ( GLbitfield mask ) ;
-FUNCTION: void glPopClientAttrib ( ) ;
-
-FUNCTION: GLint glRenderMode ( GLenum mode ) ;
-FUNCTION: GLenum glGetError ( ) ;
-FUNCTION: GLubyte* glGetString ( GLenum name ) ;
-FUNCTION: void glFinish ( ) ;
-FUNCTION: void glFlush ( ) ;
-FUNCTION: void glHint ( GLenum target, GLenum mode ) ;
-
-FUNCTION: void glClearDepth ( GLclampd depth ) ;
-FUNCTION: void glDepthFunc ( GLenum func ) ;
-FUNCTION: void glDepthMask ( GLboolean flag ) ;
-FUNCTION: void glDepthRange ( GLclampd near_val, GLclampd far_val ) ;
-
-FUNCTION: void glClearAccum ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ;
-FUNCTION: void glAccum ( GLenum op, GLfloat value ) ;
-
-FUNCTION: void glMatrixMode ( GLenum mode ) ;
-FUNCTION: void glOrtho ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, 
-                         GLdouble near_val, GLdouble far_val ) ;
-FUNCTION: void glFrustum ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, 
-                           GLdouble near_val, GLdouble far_val ) ;
-FUNCTION: void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) ;
-FUNCTION: void glPushMatrix ( ) ;
-FUNCTION: void glPopMatrix ( ) ;
-FUNCTION: void glLoadIdentity ( ) ;
-FUNCTION: void glLoadMatrixd ( GLdouble* m ) ;
-FUNCTION: void glLoadMatrixf ( GLfloat* m ) ;
-FUNCTION: void glMultMatrixd ( GLdouble* m ) ;
-FUNCTION: void glMultMatrixf ( GLfloat* m ) ;
-FUNCTION: void glRotated ( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) ;
-FUNCTION: void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) ;
-FUNCTION: void glScaled ( GLdouble x, GLdouble y, GLdouble z ) ;
-FUNCTION: void glScalef ( GLfloat x, GLfloat y, GLfloat z ) ;
-FUNCTION: void glTranslated ( GLdouble x, GLdouble y, GLdouble z ) ;
-FUNCTION: void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) ;
-
-
-FUNCTION: GLboolean glIsList ( GLuint list ) ;
-FUNCTION: void glDeleteLists ( GLuint list, GLsizei range ) ;
-FUNCTION: GLuint glGenLists ( GLsizei range ) ;
-FUNCTION: void glNewList ( GLuint list, GLenum mode ) ;
-FUNCTION: void glEndList ( ) ;
-FUNCTION: void glCallList ( GLuint list ) ;
-FUNCTION: void glCallLists ( GLsizei n, GLenum type, GLvoid* lists ) ;
-FUNCTION: void glListBase ( GLuint base ) ;
-
-FUNCTION: void glBegin ( GLenum mode ) ;
-FUNCTION: void glEnd ( ) ;
-
-FUNCTION: void glVertex2d ( GLdouble x, GLdouble y ) ;
-FUNCTION: void glVertex2f ( GLfloat x, GLfloat y ) ;
-FUNCTION: void glVertex2i ( GLint x, GLint y ) ;
-FUNCTION: void glVertex2s ( GLshort x, GLshort y ) ;
-
-FUNCTION: void glVertex3d ( GLdouble x, GLdouble y, GLdouble z ) ;
-FUNCTION: void glVertex3f ( GLfloat x, GLfloat y, GLfloat z ) ;
-FUNCTION: void glVertex3i ( GLint x, GLint y, GLint z ) ;
-FUNCTION: void glVertex3s ( GLshort x, GLshort y, GLshort z ) ;
-
-FUNCTION: void glVertex4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ;
-FUNCTION: void glVertex4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ;
-FUNCTION: void glVertex4i ( GLint x, GLint y, GLint z, GLint w ) ;
-FUNCTION: void glVertex4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ;
-
-FUNCTION: void glVertex2dv ( GLdouble* v ) ;
-FUNCTION: void glVertex2fv ( GLfloat* v ) ;
-FUNCTION: void glVertex2iv ( GLint* v ) ;
-FUNCTION: void glVertex2sv ( GLshort* v ) ;
-
-FUNCTION: void glVertex3dv ( GLdouble* v ) ;
-FUNCTION: void glVertex3fv ( GLfloat* v ) ;
-FUNCTION: void glVertex3iv ( GLint* v ) ;
-FUNCTION: void glVertex3sv ( GLshort* v ) ;
-
-FUNCTION: void glVertex4dv ( GLdouble* v ) ;
-FUNCTION: void glVertex4fv ( GLfloat* v ) ;
-FUNCTION: void glVertex4iv ( GLint* v ) ;
-FUNCTION: void glVertex4sv ( GLshort* v ) ;
-
-FUNCTION: void glNormal3b ( GLbyte nx, GLbyte ny, GLbyte nz ) ;
-FUNCTION: void glNormal3d ( GLdouble nx, GLdouble ny, GLdouble nz ) ;
-FUNCTION: void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) ;
-FUNCTION: void glNormal3i ( GLint nx, GLint ny, GLint nz ) ;
-FUNCTION: void glNormal3s ( GLshort nx, GLshort ny, GLshort nz ) ;
-
-FUNCTION: void glNormal3bv ( GLbyte* v ) ;
-FUNCTION: void glNormal3dv ( GLdouble* v ) ;
-FUNCTION: void glNormal3fv ( GLfloat* v ) ;
-FUNCTION: void glNormal3iv ( GLint* v ) ;
-FUNCTION: void glNormal3sv ( GLshort* v ) ;
-
-FUNCTION: void glIndexd ( GLdouble c ) ;
-FUNCTION: void glIndexf ( GLfloat c ) ;
-FUNCTION: void glIndexi ( GLint c ) ;
-FUNCTION: void glIndexs ( GLshort c ) ;
-FUNCTION: void glIndexub ( GLubyte c ) ;
-
-FUNCTION: void glIndexdv ( GLdouble* c ) ;
-FUNCTION: void glIndexfv ( GLfloat* c ) ;
-FUNCTION: void glIndexiv ( GLint* c ) ;
-FUNCTION: void glIndexsv ( GLshort* c ) ;
-FUNCTION: void glIndexubv ( GLubyte* c ) ;
-
-FUNCTION: void glColor3b ( GLbyte red, GLbyte green, GLbyte blue ) ;
-FUNCTION: void glColor3d ( GLdouble red, GLdouble green, GLdouble blue ) ;
-FUNCTION: void glColor3f ( GLfloat red, GLfloat green, GLfloat blue ) ;
-FUNCTION: void glColor3i ( GLint red, GLint green, GLint blue ) ;
-FUNCTION: void glColor3s ( GLshort red, GLshort green, GLshort blue ) ;
-FUNCTION: void glColor3ub ( GLubyte red, GLubyte green, GLubyte blue ) ;
-FUNCTION: void glColor3ui ( GLuint red, GLuint green, GLuint blue ) ;
-FUNCTION: void glColor3us ( GLushort red, GLushort green, GLushort blue ) ;
-
-FUNCTION: void glColor4b ( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) ;
-FUNCTION: void glColor4d ( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) ;
-FUNCTION: void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ;
-FUNCTION: void glColor4i ( GLint red, GLint green, GLint blue, GLint alpha ) ;
-FUNCTION: void glColor4s ( GLshort red, GLshort green, GLshort blue, GLshort alpha ) ;
-FUNCTION: void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) ;
-FUNCTION: void glColor4ui ( GLuint red, GLuint green, GLuint blue, GLuint alpha ) ;
-FUNCTION: void glColor4us ( GLushort red, GLushort green, GLushort blue, GLushort alpha ) ;
-
-FUNCTION: void glColor3bv ( GLbyte* v ) ;
-FUNCTION: void glColor3dv ( GLdouble* v ) ;
-FUNCTION: void glColor3fv ( GLfloat* v ) ;
-FUNCTION: void glColor3iv ( GLint* v ) ;
-FUNCTION: void glColor3sv ( GLshort* v ) ;
-FUNCTION: void glColor3ubv ( GLubyte* v ) ;
-FUNCTION: void glColor3uiv ( GLuint* v ) ;
-FUNCTION: void glColor3usv ( GLushort* v ) ;
-
-FUNCTION: void glColor4bv ( GLbyte* v ) ;
-FUNCTION: void glColor4dv ( GLdouble* v ) ;
-FUNCTION: void glColor4fv ( GLfloat* v ) ;
-FUNCTION: void glColor4iv ( GLint* v ) ;
-FUNCTION: void glColor4sv ( GLshort* v ) ;
-FUNCTION: void glColor4ubv ( GLubyte* v ) ;
-FUNCTION: void glColor4uiv ( GLuint* v ) ;
-FUNCTION: void glColor4usv ( GLushort* v ) ;
-
-
-FUNCTION: void glTexCoord1d ( GLdouble s ) ;
-FUNCTION: void glTexCoord1f ( GLfloat s ) ;
-FUNCTION: void glTexCoord1i ( GLint s ) ;
-FUNCTION: void glTexCoord1s ( GLshort s ) ;
-
-FUNCTION: void glTexCoord2d ( GLdouble s, GLdouble t ) ;
-FUNCTION: void glTexCoord2f ( GLfloat s, GLfloat t ) ;
-FUNCTION: void glTexCoord2i ( GLint s, GLint t ) ;
-FUNCTION: void glTexCoord2s ( GLshort s, GLshort t ) ;
-
-FUNCTION: void glTexCoord3d ( GLdouble s, GLdouble t, GLdouble r ) ;
-FUNCTION: void glTexCoord3f ( GLfloat s, GLfloat t, GLfloat r ) ;
-FUNCTION: void glTexCoord3i ( GLint s, GLint t, GLint r ) ;
-FUNCTION: void glTexCoord3s ( GLshort s, GLshort t, GLshort r ) ;
-
-FUNCTION: void glTexCoord4d ( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) ;
-FUNCTION: void glTexCoord4f ( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) ;
-FUNCTION: void glTexCoord4i ( GLint s, GLint t, GLint r, GLint q ) ;
-FUNCTION: void glTexCoord4s ( GLshort s, GLshort t, GLshort r, GLshort q ) ;
-
-FUNCTION: void glTexCoord1dv ( GLdouble* v ) ;
-FUNCTION: void glTexCoord1fv ( GLfloat* v ) ;
-FUNCTION: void glTexCoord1iv ( GLint* v ) ;
-FUNCTION: void glTexCoord1sv ( GLshort* v ) ;
-
-FUNCTION: void glTexCoord2dv ( GLdouble* v ) ;
-FUNCTION: void glTexCoord2fv ( GLfloat* v ) ;
-FUNCTION: void glTexCoord2iv ( GLint* v ) ;
-FUNCTION: void glTexCoord2sv ( GLshort* v ) ;
-
-FUNCTION: void glTexCoord3dv ( GLdouble* v ) ;
-FUNCTION: void glTexCoord3fv ( GLfloat* v ) ;
-FUNCTION: void glTexCoord3iv ( GLint* v ) ;
-FUNCTION: void glTexCoord3sv ( GLshort* v ) ;
-
-FUNCTION: void glTexCoord4dv ( GLdouble* v ) ;
-FUNCTION: void glTexCoord4fv ( GLfloat* v ) ;
-FUNCTION: void glTexCoord4iv ( GLint* v ) ;
-FUNCTION: void glTexCoord4sv ( GLshort* v ) ;
-
-FUNCTION: void glRasterPos2d ( GLdouble x, GLdouble y ) ;
-FUNCTION: void glRasterPos2f ( GLfloat x, GLfloat y ) ;
-FUNCTION: void glRasterPos2i ( GLint x, GLint y ) ;
-FUNCTION: void glRasterPos2s ( GLshort x, GLshort y ) ;
-
-FUNCTION: void glRasterPos3d ( GLdouble x, GLdouble y, GLdouble z ) ;
-FUNCTION: void glRasterPos3f ( GLfloat x, GLfloat y, GLfloat z ) ;
-FUNCTION: void glRasterPos3i ( GLint x, GLint y, GLint z ) ;
-FUNCTION: void glRasterPos3s ( GLshort x, GLshort y, GLshort z ) ;
-
-FUNCTION: void glRasterPos4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ;
-FUNCTION: void glRasterPos4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ;
-FUNCTION: void glRasterPos4i ( GLint x, GLint y, GLint z, GLint w ) ;
-FUNCTION: void glRasterPos4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ;
-
-FUNCTION: void glRasterPos2dv ( GLdouble* v ) ;
-FUNCTION: void glRasterPos2fv ( GLfloat* v ) ;
-FUNCTION: void glRasterPos2iv ( GLint* v ) ;
-FUNCTION: void glRasterPos2sv ( GLshort* v ) ;
-
-FUNCTION: void glRasterPos3dv ( GLdouble* v ) ;
-FUNCTION: void glRasterPos3fv ( GLfloat* v ) ;
-FUNCTION: void glRasterPos3iv ( GLint* v ) ;
-FUNCTION: void glRasterPos3sv ( GLshort* v ) ;
-
-FUNCTION: void glRasterPos4dv ( GLdouble* v ) ;
-FUNCTION: void glRasterPos4fv ( GLfloat* v ) ;
-FUNCTION: void glRasterPos4iv ( GLint* v ) ;
-FUNCTION: void glRasterPos4sv ( GLshort* v ) ;
-
-
-FUNCTION: void glRectd ( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ) ;
-FUNCTION: void glRectf ( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) ;
-FUNCTION: void glRecti ( GLint x1, GLint y1, GLint x2, GLint y2 ) ;
-FUNCTION: void glRects ( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ) ;
-
-FUNCTION: void glRectdv ( GLdouble* v1, GLdouble* v2 ) ;
-FUNCTION: void glRectfv ( GLfloat* v1, GLfloat* v2 ) ;
-FUNCTION: void glRectiv ( GLint* v1, GLint* v2 ) ;
-FUNCTION: void glRectsv ( GLshort* v1, GLshort* v2 ) ;
-
-
-! Vertex Arrays (1.1)
-
-FUNCTION: void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLvoid* ptr ) ;
-FUNCTION: void glNormalPointer ( GLenum type, GLsizei stride, GLvoid* ptr ) ;
-FUNCTION: void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLvoid* ptr ) ;
-FUNCTION: void glIndexPointer ( GLenum type, GLsizei stride, GLvoid* ptr ) ;
-FUNCTION: void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLvoid* ptr ) ;
-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) which returns an alien
-FUNCTION: void glGetPointerv ( GLenum pname, GLvoid** params ) ;
-
-FUNCTION: void glArrayElement ( GLint i ) ;
-FUNCTION: void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) ;
-FUNCTION: void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLvoid* indices ) ;
-FUNCTION: void glInterleavedArrays ( GLenum format, GLsizei stride, GLvoid* pointer ) ;
-
-! Lighting
-
-FUNCTION: void glShadeModel ( GLenum mode ) ;
-
-FUNCTION: void glLightf ( GLenum light, GLenum pname, GLfloat param ) ;
-FUNCTION: void glLighti ( GLenum light, GLenum pname, GLint param ) ;
-FUNCTION: void glLightfv ( GLenum light, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glLightiv ( GLenum light, GLenum pname, GLint* params ) ;
-FUNCTION: void glGetLightfv ( GLenum light, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glGetLightiv ( GLenum light, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glLightModelf ( GLenum pname, GLfloat param ) ;
-FUNCTION: void glLightModeli ( GLenum pname, GLint param ) ;
-FUNCTION: void glLightModelfv ( GLenum pname, GLfloat* params ) ;
-FUNCTION: void glLightModeliv ( GLenum pname, GLint* params ) ;
-
-FUNCTION: void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) ;
-FUNCTION: void glMateriali ( GLenum face, GLenum pname, GLint param ) ;
-FUNCTION: void glMaterialfv ( GLenum face, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glMaterialiv ( GLenum face, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glGetMaterialiv ( GLenum face, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glColorMaterial ( GLenum face, GLenum mode ) ;
-
-
-! Raster functions
-
-FUNCTION: void glPixelZoom ( GLfloat xfactor, GLfloat yfactor ) ;
-
-FUNCTION: void glPixelStoref ( GLenum pname, GLfloat param ) ;
-FUNCTION: void glPixelStorei ( GLenum pname, GLint param ) ;
-
-FUNCTION: void glPixelTransferf ( GLenum pname, GLfloat param ) ;
-FUNCTION: void glPixelTransferi ( GLenum pname, GLint param ) ;
-
-FUNCTION: void glPixelMapfv ( GLenum map, GLsizei mapsize, GLfloat* values ) ;
-FUNCTION: void glPixelMapuiv ( GLenum map, GLsizei mapsize, GLuint* values ) ;
-FUNCTION: void glPixelMapusv ( GLenum map, GLsizei mapsize, GLushort* values ) ;
-
-FUNCTION: void glGetPixelMapfv ( GLenum map, GLfloat* values ) ;
-FUNCTION: void glGetPixelMapuiv ( GLenum map, GLuint* values ) ;
-FUNCTION: void glGetPixelMapusv ( GLenum map, GLushort* values ) ;
-
-FUNCTION: void glBitmap ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, 
-                          GLfloat xmove, GLfloat ymove, GLubyte* bitmap ) ;
-
-FUNCTION: void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, 
-                              GLenum format, GLenum type, GLvoid* pixels ) ;
-
-FUNCTION: void glDrawPixels ( GLsizei width, GLsizei height, GLenum format, 
-                              GLenum type, GLvoid* pixels ) ;
-FUNCTION: void glCopyPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) ;
-
-! Stenciling
-FUNCTION: void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) ;
-FUNCTION: void glStencilMask ( GLuint mask ) ;
-FUNCTION: void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) ;
-FUNCTION: void glClearStencil ( GLint s ) ;
-
-
-! Texture mapping
-
-FUNCTION: void glTexGend ( GLenum coord, GLenum pname, GLdouble param ) ;
-FUNCTION: void glTexGenf ( GLenum coord, GLenum pname, GLfloat param ) ;
-FUNCTION: void glTexGeni ( GLenum coord, GLenum pname, GLint param ) ;
-
-FUNCTION: void glTexGendv ( GLenum coord, GLenum pname, GLdouble* params ) ;
-FUNCTION: void glTexGenfv ( GLenum coord, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glTexGeniv ( GLenum coord, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glGetTexGendv ( GLenum coord, GLenum pname, GLdouble* params ) ;
-FUNCTION: void glGetTexGenfv ( GLenum coord, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glGetTexGeniv ( GLenum coord, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) ;
-FUNCTION: void glTexEnvi ( GLenum target, GLenum pname, GLint param ) ;
-FUNCTION: void glTexEnvfv ( GLenum target, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glTexEnviv ( GLenum target, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glGetTexEnvfv ( GLenum target, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glGetTexEnviv ( GLenum target, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) ;
-FUNCTION: void glTexParameteri ( GLenum target, GLenum pname, GLint param ) ;
-
-FUNCTION: void glTexParameterfv ( GLenum target, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glTexParameteriv ( GLenum target, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat* params ) ;
-FUNCTION: void glGetTexParameteriv ( GLenum target, GLenum pname, GLint* params ) ;
-
-FUNCTION: void glGetTexLevelParameterfv ( GLenum target, GLint level, 
-                                          GLenum pname, GLfloat* params ) ;
-FUNCTION: void glGetTexLevelParameteriv ( GLenum target, GLint level,
-                                          GLenum pname, GLint* params ) ;
-
-FUNCTION: void glTexImage1D ( GLenum target, GLint level, GLint internalFormat, GLsizei width,
-                              GLint border, GLenum format, GLenum type, GLvoid* pixels ) ;
-
-FUNCTION: void glTexImage2D ( GLenum target, GLint level, GLint internalFormat, 
-                              GLsizei width, GLsizei height, GLint border, 
-                             GLenum format, GLenum type, GLvoid* pixels ) ;
-
-FUNCTION: void glGetTexImage ( GLenum target, GLint level, GLenum format, 
-                               GLenum type, GLvoid* pixels ) ;
-
-
-! 1.1 functions
-
-FUNCTION: void glGenTextures ( GLsizei n, GLuint* textures ) ;
-
-FUNCTION: void glDeleteTextures ( GLsizei n, GLuint* textures ) ;
-
-FUNCTION: void glBindTexture ( GLenum target, GLuint texture ) ;
-
-FUNCTION: void glPrioritizeTextures ( GLsizei n, GLuint* textures, GLclampf* priorities ) ;
-
-FUNCTION: GLboolean glAreTexturesResident ( GLsizei n, GLuint* textures, GLboolean* residences ) ;
-
-FUNCTION: GLboolean glIsTexture ( GLuint texture ) ;
-
-FUNCTION: void glTexSubImage1D ( GLenum target, GLint level, GLint xoffset, GLsizei width,
-                                 GLenum format, GLenum type, GLvoid* pixels ) ;
-
-FUNCTION: void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset,
-                                 GLsizei width, GLsizei height, GLenum format, 
-                                GLenum type, GLvoid* pixels ) ;
-
-FUNCTION: void glCopyTexImage1D ( GLenum target, GLint level, GLenum internalformat, 
-                                  GLint x, GLint y, GLsizei width, GLint border ) ;
-
-FUNCTION: void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, 
-                                  GLint x, GLint y,
-                                 GLsizei width, GLsizei height, GLint border ) ;
-
-FUNCTION: void glCopyTexSubImage1D ( GLenum target, GLint level, GLint xoffset, 
-                                     GLint x, GLint y, GLsizei width ) ;
-
-FUNCTION: void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset,
-                                     GLint x, GLint y, GLsizei width, GLsizei height ) ;
-
-
-! Evaluators
-
-FUNCTION: void glMap1d ( GLenum target, GLdouble u1, GLdouble u2,
-                         GLint stride, GLint order, GLdouble* points ) ;
-FUNCTION: void glMap1f ( GLenum target, GLfloat u1, GLfloat u2,
-                         GLint stride, GLint order, GLfloat* points ) ;
-
-FUNCTION: void glMap2d ( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
-                         GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
-                        GLdouble* points ) ;
-FUNCTION: void glMap2f ( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
-                         GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
-                        GLfloat* points ) ;
-
-FUNCTION: void glGetMapdv ( GLenum target, GLenum query, GLdouble* v ) ;
-FUNCTION: void glGetMapfv ( GLenum target, GLenum query, GLfloat* v ) ;
-FUNCTION: void glGetMapiv ( GLenum target, GLenum query, GLint* v ) ;
-
-FUNCTION: void glEvalCoord1d ( GLdouble u ) ;
-FUNCTION: void glEvalCoord1f ( GLfloat u ) ;
-
-FUNCTION: void glEvalCoord1dv ( GLdouble* u ) ;
-FUNCTION: void glEvalCoord1fv ( GLfloat* u ) ;
-
-FUNCTION: void glEvalCoord2d ( GLdouble u, GLdouble v ) ;
-FUNCTION: void glEvalCoord2f ( GLfloat u, GLfloat v ) ;
-
-FUNCTION: void glEvalCoord2dv ( GLdouble* u ) ;
-FUNCTION: void glEvalCoord2fv ( GLfloat* u ) ;
-
-FUNCTION: void glMapGrid1d ( GLint un, GLdouble u1, GLdouble u2 ) ;
-FUNCTION: void glMapGrid1f ( GLint un, GLfloat u1, GLfloat u2 ) ;
-
-FUNCTION: void glMapGrid2d ( GLint un, GLdouble u1, GLdouble u2,
-                             GLint vn, GLdouble v1, GLdouble v2 ) ;
-FUNCTION: void glMapGrid2f ( GLint un, GLfloat u1, GLfloat u2,
-                             GLint vn, GLfloat v1, GLfloat v2 ) ;
-
-FUNCTION: void glEvalPoint1 ( GLint i ) ;
-FUNCTION: void glEvalPoint2 ( GLint i, GLint j ) ;
-
-FUNCTION: void glEvalMesh1 ( GLenum mode, GLint i1, GLint i2 ) ;
-FUNCTION: void glEvalMesh2 ( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) ;
-
-
-! Fog
-
-FUNCTION: void glFogf ( GLenum pname, GLfloat param ) ;
-FUNCTION: void glFogi ( GLenum pname, GLint param ) ;
-FUNCTION: void glFogfv ( GLenum pname, GLfloat* params ) ;
-FUNCTION: void glFogiv ( GLenum pname, GLint* params ) ;
-
-
-! Selection and Feedback
-
-FUNCTION: void glFeedbackBuffer ( GLsizei size, GLenum type, GLfloat* buffer ) ;
-
-FUNCTION: void glPassThrough ( GLfloat token ) ;
-FUNCTION: void glSelectBuffer ( GLsizei size, GLuint* buffer ) ;
-FUNCTION: void glInitNames ( ) ;
-FUNCTION: void glLoadName ( GLuint name ) ;
-FUNCTION: void glPushName ( GLuint name ) ;
-FUNCTION: void glPopName ( ) ;
-
-
-! OpenGL 1.2
-
-: GL_PACK_SKIP_IMAGES               HEX: 806B ; inline
-: GL_PACK_IMAGE_HEIGHT              HEX: 806C ; inline
-: GL_UNPACK_SKIP_IMAGES             HEX: 806D ; inline
-: GL_UNPACK_IMAGE_HEIGHT            HEX: 806E ; inline
-: GL_TEXTURE_3D                     HEX: 806F ; inline
-: GL_PROXY_TEXTURE_3D               HEX: 8070 ; inline
-: GL_TEXTURE_DEPTH                  HEX: 8071 ; inline
-: GL_TEXTURE_WRAP_R                 HEX: 8072 ; inline
-: GL_MAX_3D_TEXTURE_SIZE            HEX: 8073 ; inline
-: GL_BGR                            HEX: 80E0 ; inline
-: GL_BGRA                           HEX: 80E1 ; inline
-: GL_UNSIGNED_BYTE_3_3_2            HEX: 8032 ; inline
-: GL_UNSIGNED_BYTE_2_3_3_REV        HEX: 8362 ; inline
-: GL_UNSIGNED_SHORT_5_6_5           HEX: 8363 ; inline
-: GL_UNSIGNED_SHORT_5_6_5_REV       HEX: 8364 ; inline
-: GL_UNSIGNED_SHORT_4_4_4_4         HEX: 8033 ; inline
-: GL_UNSIGNED_SHORT_4_4_4_4_REV     HEX: 8365 ; inline
-: GL_UNSIGNED_SHORT_5_5_5_1         HEX: 8034 ; inline
-: GL_UNSIGNED_SHORT_1_5_5_5_REV     HEX: 8366 ; inline
-: GL_UNSIGNED_INT_8_8_8_8           HEX: 8035 ; inline
-: GL_UNSIGNED_INT_8_8_8_8_REV       HEX: 8367 ; inline
-: GL_UNSIGNED_INT_10_10_10_2        HEX: 8036 ; inline
-: GL_UNSIGNED_INT_2_10_10_10_REV    HEX: 8368 ; inline
-: GL_RESCALE_NORMAL                 HEX: 803A ; inline
-: GL_LIGHT_MODEL_COLOR_CONTROL      HEX: 81F8 ; inline
-: GL_SINGLE_COLOR                   HEX: 81F9 ; inline
-: GL_SEPARATE_SPECULAR_COLOR        HEX: 81FA ; inline
-: GL_CLAMP_TO_EDGE                  HEX: 812F ; inline
-: GL_TEXTURE_MIN_LOD                HEX: 813A ; inline
-: GL_TEXTURE_MAX_LOD                HEX: 813B ; inline
-: GL_TEXTURE_BASE_LEVEL             HEX: 813C ; inline
-: GL_TEXTURE_MAX_LEVEL              HEX: 813D ; inline
-: GL_MAX_ELEMENTS_VERTICES          HEX: 80E8 ; inline
-: GL_MAX_ELEMENTS_INDICES           HEX: 80E9 ; inline
-: GL_ALIASED_POINT_SIZE_RANGE       HEX: 846D ; inline
-: GL_ALIASED_LINE_WIDTH_RANGE       HEX: 846E ; inline
-
-
-FUNCTION: void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end,
-                                     GLsizei count, GLenum type, GLvoid* indices ) ;
-
-FUNCTION: void glTexImage3D ( GLenum target, GLint level, GLint internalFormat,
-                              GLsizei width, GLsizei height, GLsizei depth, GLint border,
-                             GLenum format, GLenum type, GLvoid* pixels ) ;
-
-FUNCTION: void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset,
-                                 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
-                                GLenum format, GLenum type, GLvoid* pixels ) ;
-
-FUNCTION: void glCopyTexSubImage3D ( GLenum target, GLint level,
-                                     GLint xoffset, GLint yoffset, GLint zoffset,
-                                    GLint x, GLint y, GLsizei width, GLsizei height ) ;
-! windows? [
-!     { glDrawRangeElements glTexImage3D glTexSubImage3D glCopyTexSubImage3D } [ forget ] each
-! ] unless
-
-
-! TODO: the rest. looks fiddly
-
-! OpenGL 1.3
-
-: GL_ACTIVE_TEXTURE                 HEX: 84E0 ; inline
-: GL_CLIENT_ACTIVE_TEXTURE          HEX: 84E1 ; inline
-: GL_MAX_TEXTURE_UNITS              HEX: 84E2 ; inline
-: GL_TEXTURE0                       HEX: 84C0 ; inline
-: GL_TEXTURE1                       HEX: 84C1 ; inline
-: GL_TEXTURE2                       HEX: 84C2 ; inline
-: GL_TEXTURE3                       HEX: 84C3 ; inline
-: GL_TEXTURE4                       HEX: 84C4 ; inline
-: GL_TEXTURE5                       HEX: 84C5 ; inline
-: GL_TEXTURE6                       HEX: 84C6 ; inline
-: GL_TEXTURE7                       HEX: 84C7 ; inline
-: GL_TEXTURE8                       HEX: 84C8 ; inline
-: GL_TEXTURE9                       HEX: 84C9 ; inline
-: GL_TEXTURE10                      HEX: 84CA ; inline
-: GL_TEXTURE11                      HEX: 84CB ; inline
-: GL_TEXTURE12                      HEX: 84CC ; inline
-: GL_TEXTURE13                      HEX: 84CD ; inline
-: GL_TEXTURE14                      HEX: 84CE ; inline
-: GL_TEXTURE15                      HEX: 84CF ; inline
-: GL_TEXTURE16                      HEX: 84D0 ; inline
-: GL_TEXTURE17                      HEX: 84D1 ; inline
-: GL_TEXTURE18                      HEX: 84D2 ; inline
-: GL_TEXTURE19                      HEX: 84D3 ; inline
-: GL_TEXTURE20                      HEX: 84D4 ; inline
-: GL_TEXTURE21                      HEX: 84D5 ; inline
-: GL_TEXTURE22                      HEX: 84D6 ; inline
-: GL_TEXTURE23                      HEX: 84D7 ; inline
-: GL_TEXTURE24                      HEX: 84D8 ; inline
-: GL_TEXTURE25                      HEX: 84D9 ; inline
-: GL_TEXTURE26                      HEX: 84DA ; inline
-: GL_TEXTURE27                      HEX: 84DB ; inline
-: GL_TEXTURE28                      HEX: 84DC ; inline
-: GL_TEXTURE29                      HEX: 84DD ; inline
-: GL_TEXTURE30                      HEX: 84DE ; inline
-: GL_TEXTURE31                      HEX: 84DF ; inline
-: GL_NORMAL_MAP                     HEX: 8511 ; inline
-: GL_REFLECTION_MAP                 HEX: 8512 ; inline
-: GL_TEXTURE_CUBE_MAP               HEX: 8513 ; inline
-: GL_TEXTURE_BINDING_CUBE_MAP       HEX: 8514 ; inline
-: GL_TEXTURE_CUBE_MAP_POSITIVE_X    HEX: 8515 ; inline
-: GL_TEXTURE_CUBE_MAP_NEGATIVE_X    HEX: 8516 ; inline
-: GL_TEXTURE_CUBE_MAP_POSITIVE_Y    HEX: 8517 ; inline
-: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    HEX: 8518 ; inline
-: GL_TEXTURE_CUBE_MAP_POSITIVE_Z    HEX: 8519 ; inline
-: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    HEX: 851A ; inline
-: GL_PROXY_TEXTURE_CUBE_MAP         HEX: 851B ; inline
-: GL_MAX_CUBE_MAP_TEXTURE_SIZE      HEX: 851C ; inline
-: GL_COMBINE                        HEX: 8570 ; inline
-: GL_COMBINE_RGB                    HEX: 8571 ; inline
-: GL_COMBINE_ALPHA                  HEX: 8572 ; inline
-: GL_RGB_SCALE                      HEX: 8573 ; inline
-: GL_ADD_SIGNED                     HEX: 8574 ; inline
-: GL_INTERPOLATE                    HEX: 8575 ; inline
-: GL_CONSTANT                       HEX: 8576 ; inline
-: GL_PRIMARY_COLOR                  HEX: 8577 ; inline
-: GL_PREVIOUS                       HEX: 8578 ; inline
-: GL_SOURCE0_RGB                    HEX: 8580 ; inline
-: GL_SOURCE1_RGB                    HEX: 8581 ; inline
-: GL_SOURCE2_RGB                    HEX: 8582 ; inline
-: GL_SOURCE0_ALPHA                  HEX: 8588 ; inline
-: GL_SOURCE1_ALPHA                  HEX: 8589 ; inline
-: GL_SOURCE2_ALPHA                  HEX: 858A ; inline
-: GL_OPERAND0_RGB                   HEX: 8590 ; inline
-: GL_OPERAND1_RGB                   HEX: 8591 ; inline
-: GL_OPERAND2_RGB                   HEX: 8592 ; inline
-: GL_OPERAND0_ALPHA                 HEX: 8598 ; inline
-: GL_OPERAND1_ALPHA                 HEX: 8599 ; inline
-: GL_OPERAND2_ALPHA                 HEX: 859A ; inline
-: GL_SUBTRACT                       HEX: 84E7 ; inline
-: GL_TRANSPOSE_MODELVIEW_MATRIX     HEX: 84E3 ; inline
-: GL_TRANSPOSE_PROJECTION_MATRIX    HEX: 84E4 ; inline
-: GL_TRANSPOSE_TEXTURE_MATRIX       HEX: 84E5 ; inline
-: GL_TRANSPOSE_COLOR_MATRIX         HEX: 84E6 ; inline
-: GL_COMPRESSED_ALPHA               HEX: 84E9 ; inline
-: GL_COMPRESSED_LUMINANCE           HEX: 84EA ; inline
-: GL_COMPRESSED_LUMINANCE_ALPHA     HEX: 84EB ; inline
-: GL_COMPRESSED_INTENSITY           HEX: 84EC ; inline
-: GL_COMPRESSED_RGB                 HEX: 84ED ; inline
-: GL_COMPRESSED_RGBA                HEX: 84EE ; inline
-: GL_TEXTURE_COMPRESSION_HINT       HEX: 84EF ; inline
-: GL_TEXTURE_COMPRESSED_IMAGE_SIZE  HEX: 86A0 ; inline
-: GL_TEXTURE_COMPRESSED             HEX: 86A1 ; inline
-: GL_NUM_COMPRESSED_TEXTURE_FORMATS HEX: 86A2 ; inline
-: GL_COMPRESSED_TEXTURE_FORMATS     HEX: 86A3 ; inline
-: GL_DOT3_RGB                       HEX: 86AE ; inline
-: GL_DOT3_RGBA                      HEX: 86AF ; inline
-: GL_CLAMP_TO_BORDER                HEX: 812D ; inline
-: GL_MULTISAMPLE                    HEX: 809D ; inline
-: GL_SAMPLE_ALPHA_TO_COVERAGE       HEX: 809E ; inline
-: GL_SAMPLE_ALPHA_TO_ONE            HEX: 809F ; inline
-: GL_SAMPLE_COVERAGE                HEX: 80A0 ; inline
-: GL_SAMPLE_BUFFERS                 HEX: 80A8 ; inline
-: GL_SAMPLES                        HEX: 80A9 ; inline
-: GL_SAMPLE_COVERAGE_VALUE          HEX: 80AA ; inline
-: GL_SAMPLE_COVERAGE_INVERT         HEX: 80AB ; inline
-: GL_MULTISAMPLE_BIT                HEX: 20000000 ; inline
-
-
-! OpenGL 1.4
-
-: GL_POINT_SIZE_MIN                 HEX: 8126 ; inline
-: GL_POINT_SIZE_MAX                 HEX: 8127 ; inline
-: GL_POINT_FADE_THRESHOLD_SIZE      HEX: 8128 ; inline
-: GL_POINT_DISTANCE_ATTENUATION     HEX: 8129 ; inline
-: GL_FOG_COORDINATE_SOURCE          HEX: 8450 ; inline
-: GL_FOG_COORDINATE                 HEX: 8451 ; inline
-: GL_FRAGMENT_DEPTH                 HEX: 8452 ; inline
-: GL_CURRENT_FOG_COORDINATE         HEX: 8453 ; inline
-: GL_FOG_COORDINATE_ARRAY_TYPE      HEX: 8454 ; inline
-: GL_FOG_COORDINATE_ARRAY_STRIDE    HEX: 8455 ; inline
-: GL_FOG_COORDINATE_ARRAY_POINTER   HEX: 8456 ; inline
-: GL_FOG_COORDINATE_ARRAY           HEX: 8457 ; inline
-: GL_COLOR_SUM                      HEX: 8458 ; inline
-: GL_CURRENT_SECONDARY_COLOR        HEX: 8459 ; inline
-: GL_SECONDARY_COLOR_ARRAY_SIZE     HEX: 845A ; inline
-: GL_SECONDARY_COLOR_ARRAY_TYPE     HEX: 845B ; inline
-: GL_SECONDARY_COLOR_ARRAY_STRIDE   HEX: 845C ; inline
-: GL_SECONDARY_COLOR_ARRAY_POINTER  HEX: 845D ; inline
-: GL_SECONDARY_COLOR_ARRAY          HEX: 845E ; inline
-: GL_INCR_WRAP                      HEX: 8507 ; inline
-: GL_DECR_WRAP                      HEX: 8508 ; inline
-: GL_MAX_TEXTURE_LOD_BIAS           HEX: 84FD ; inline
-: GL_TEXTURE_FILTER_CONTROL         HEX: 8500 ; inline
-: GL_TEXTURE_LOD_BIAS               HEX: 8501 ; inline
-: GL_GENERATE_MIPMAP                HEX: 8191 ; inline
-: GL_GENERATE_MIPMAP_HINT           HEX: 8192 ; inline
-: GL_BLEND_DST_RGB                  HEX: 80C8 ; inline
-: GL_BLEND_SRC_RGB                  HEX: 80C9 ; inline
-: GL_BLEND_DST_ALPHA                HEX: 80CA ; inline
-: GL_BLEND_SRC_ALPHA                HEX: 80CB ; inline
-: GL_MIRRORED_REPEAT                HEX: 8370 ; inline
-: GL_DEPTH_COMPONENT16              HEX: 81A5 ; inline
-: GL_DEPTH_COMPONENT24              HEX: 81A6 ; inline
-: GL_DEPTH_COMPONENT32              HEX: 81A7 ; inline
-: GL_TEXTURE_DEPTH_SIZE             HEX: 884A ; inline
-: GL_DEPTH_TEXTURE_MODE             HEX: 884B ; inline
-: GL_TEXTURE_COMPARE_MODE           HEX: 884C ; inline
-: GL_TEXTURE_COMPARE_FUNC           HEX: 884D ; inline
-: GL_COMPARE_R_TO_TEXTURE           HEX: 884E ; inline
diff --git a/core/ui/opengl/glu.factor b/core/ui/opengl/glu.factor
deleted file mode 100644 (file)
index 28032a2..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-! Copyright (C) 2005 Alex Chapman.
-! See http://factorcode.org/license.txt for BSD license.
-IN: opengl
-USING: alien kernel sequences words ;
-
-! These are defined as structs in glu.h, but we only ever use pointers to them
-TYPEDEF: void* GLUnurbs*
-TYPEDEF: void* GLUquadric*
-TYPEDEF: void* GLUtesselator*
-TYPEDEF: char* GLubyte* ! is this right?
-TYPEDEF: void* GLUfuncptr ! will this work?
-
-! StringName
-: GLU_VERSION                        100800 ;
-: GLU_EXTENSIONS                     100801 ;
-
-! ErrorCode
-: GLU_INVALID_ENUM                   100900 ;
-: GLU_INVALID_VALUE                  100901 ;
-: GLU_OUT_OF_MEMORY                  100902 ;
-: GLU_INCOMPATIBLE_GL_VERSION        100903 ;
-: GLU_INVALID_OPERATION              100904 ;
-
-! NurbsDisplay
-: GLU_OUTLINE_POLYGON                100240 ;
-: GLU_OUTLINE_PATCH                  100241 ;
-
-! NurbsCallback
-: GLU_NURBS_ERROR                    100103 ;
-: GLU_ERROR                          100103 ;
-: GLU_NURBS_BEGIN                    100164 ;
-: GLU_NURBS_BEGIN_EXT                100164 ;
-: GLU_NURBS_VERTEX                   100165 ;
-: GLU_NURBS_VERTEX_EXT               100165 ;
-: GLU_NURBS_NORMAL                   100166 ;
-: GLU_NURBS_NORMAL_EXT               100166 ;
-: GLU_NURBS_COLOR                    100167 ;
-: GLU_NURBS_COLOR_EXT                100167 ;
-: GLU_NURBS_TEXTURE_COORD            100168 ;
-: GLU_NURBS_TEX_COORD_EXT            100168 ;
-: GLU_NURBS_END                      100169 ;
-: GLU_NURBS_END_EXT                  100169 ;
-: GLU_NURBS_BEGIN_DATA               100170 ;
-: GLU_NURBS_BEGIN_DATA_EXT           100170 ;
-: GLU_NURBS_VERTEX_DATA              100171 ;
-: GLU_NURBS_VERTEX_DATA_EXT          100171 ;
-: GLU_NURBS_NORMAL_DATA              100172 ;
-: GLU_NURBS_NORMAL_DATA_EXT          100172 ;
-: GLU_NURBS_COLOR_DATA               100173 ;
-: GLU_NURBS_COLOR_DATA_EXT           100173 ;
-: GLU_NURBS_TEXTURE_COORD_DATA       100174 ;
-: GLU_NURBS_TEX_COORD_DATA_EXT       100174 ;
-: GLU_NURBS_END_DATA                 100175 ;
-: GLU_NURBS_END_DATA_EXT             100175 ;
-
-! NurbsError
-: GLU_NURBS_ERROR1                   100251 ;
-: GLU_NURBS_ERROR2                   100252 ;
-: GLU_NURBS_ERROR3                   100253 ;
-: GLU_NURBS_ERROR4                   100254 ;
-: GLU_NURBS_ERROR5                   100255 ;
-: GLU_NURBS_ERROR6                   100256 ;
-: GLU_NURBS_ERROR7                   100257 ;
-: GLU_NURBS_ERROR8                   100258 ;
-: GLU_NURBS_ERROR9                   100259 ;
-: GLU_NURBS_ERROR10                  100260 ;
-: GLU_NURBS_ERROR11                  100261 ;
-: GLU_NURBS_ERROR12                  100262 ;
-: GLU_NURBS_ERROR13                  100263 ;
-: GLU_NURBS_ERROR14                  100264 ;
-: GLU_NURBS_ERROR15                  100265 ;
-: GLU_NURBS_ERROR16                  100266 ;
-: GLU_NURBS_ERROR17                  100267 ;
-: GLU_NURBS_ERROR18                  100268 ;
-: GLU_NURBS_ERROR19                  100269 ;
-: GLU_NURBS_ERROR20                  100270 ;
-: GLU_NURBS_ERROR21                  100271 ;
-: GLU_NURBS_ERROR22                  100272 ;
-: GLU_NURBS_ERROR23                  100273 ;
-: GLU_NURBS_ERROR24                  100274 ;
-: GLU_NURBS_ERROR25                  100275 ;
-: GLU_NURBS_ERROR26                  100276 ;
-: GLU_NURBS_ERROR27                  100277 ;
-: GLU_NURBS_ERROR28                  100278 ;
-: GLU_NURBS_ERROR29                  100279 ;
-: GLU_NURBS_ERROR30                  100280 ;
-: GLU_NURBS_ERROR31                  100281 ;
-: GLU_NURBS_ERROR32                  100282 ;
-: GLU_NURBS_ERROR33                  100283 ;
-: GLU_NURBS_ERROR34                  100284 ;
-: GLU_NURBS_ERROR35                  100285 ;
-: GLU_NURBS_ERROR36                  100286 ;
-: GLU_NURBS_ERROR37                  100287 ;
-
-! NurbsProperty
-: GLU_AUTO_LOAD_MATRIX               100200 ;
-: GLU_CULLING                        100201 ;
-: GLU_SAMPLING_TOLERANCE             100203 ;
-: GLU_DISPLAY_MODE                   100204 ;
-: GLU_PARAMETRIC_TOLERANCE           100202 ;
-: GLU_SAMPLING_METHOD                100205 ;
-: GLU_U_STEP                         100206 ;
-: GLU_V_STEP                         100207 ;
-: GLU_NURBS_MODE                     100160 ;
-: GLU_NURBS_MODE_EXT                 100160 ;
-: GLU_NURBS_TESSELLATOR              100161 ;
-: GLU_NURBS_TESSELLATOR_EXT          100161 ;
-: GLU_NURBS_RENDERER                 100162 ;
-: GLU_NURBS_RENDERER_EXT             100162 ;
-
-! NurbsSampling
-: GLU_OBJECT_PARAMETRIC_ERROR        100208 ;
-: GLU_OBJECT_PARAMETRIC_ERROR_EXT    100208 ;
-: GLU_OBJECT_PATH_LENGTH             100209 ;
-: GLU_OBJECT_PATH_LENGTH_EXT         100209 ;
-: GLU_PATH_LENGTH                    100215 ;
-: GLU_PARAMETRIC_ERROR               100216 ;
-: GLU_DOMAIN_DISTANCE                100217 ;
-
-! NurbsTrim
-: GLU_MAP1_TRIM_2                    100210 ;
-: GLU_MAP1_TRIM_3                    100211 ;
-
-! QuadricDrawStyle
-: GLU_POINT                          100010 ;
-: GLU_LINE                           100011 ;
-: GLU_FILL                           100012 ;
-: GLU_SILHOUETTE                     100013 ;
-
-! QuadricNormal
-: GLU_SMOOTH                         100000 ;
-: GLU_FLAT                           100001 ;
-: GLU_NONE                           100002 ;
-
-! QuadricOrientation
-: GLU_OUTSIDE                        100020 ;
-: GLU_INSIDE                         100021 ;
-
-! TessCallback
-: GLU_TESS_BEGIN                     100100 ;
-: GLU_BEGIN                          100100 ;
-: GLU_TESS_VERTEX                    100101 ;
-: GLU_VERTEX                         100101 ;
-: GLU_TESS_END                       100102 ;
-: GLU_END                            100102 ;
-: GLU_TESS_ERROR                     100103 ;
-: GLU_TESS_EDGE_FLAG                 100104 ;
-: GLU_EDGE_FLAG                      100104 ;
-: GLU_TESS_COMBINE                   100105 ;
-: GLU_TESS_BEGIN_DATA                100106 ;
-: GLU_TESS_VERTEX_DATA               100107 ;
-: GLU_TESS_END_DATA                  100108 ;
-: GLU_TESS_ERROR_DATA                100109 ;
-: GLU_TESS_EDGE_FLAG_DATA            100110 ;
-: GLU_TESS_COMBINE_DATA              100111 ;
-
-! TessContour
-: GLU_CW                             100120 ;
-: GLU_CCW                            100121 ;
-: GLU_INTERIOR                       100122 ;
-: GLU_EXTERIOR                       100123 ;
-: GLU_UNKNOWN                        100124 ;
-
-! TessProperty
-: GLU_TESS_WINDING_RULE              100140 ;
-: GLU_TESS_BOUNDARY_ONLY             100141 ;
-: GLU_TESS_TOLERANCE                 100142 ;
-
-! TessError
-: GLU_TESS_ERROR1                    100151 ;
-: GLU_TESS_ERROR2                    100152 ;
-: GLU_TESS_ERROR3                    100153 ;
-: GLU_TESS_ERROR4                    100154 ;
-: GLU_TESS_ERROR5                    100155 ;
-: GLU_TESS_ERROR6                    100156 ;
-: GLU_TESS_ERROR7                    100157 ;
-: GLU_TESS_ERROR8                    100158 ;
-: GLU_TESS_MISSING_BEGIN_POLYGON     100151 ;
-: GLU_TESS_MISSING_BEGIN_CONTOUR     100152 ;
-: GLU_TESS_MISSING_END_POLYGON       100153 ;
-: GLU_TESS_MISSING_END_CONTOUR       100154 ;
-: GLU_TESS_COORD_TOO_LARGE           100155 ;
-: GLU_TESS_NEED_COMBINE_CALLBACK     100156 ;
-
-! TessWinding
-: GLU_TESS_WINDING_ODD               100130 ;
-: GLU_TESS_WINDING_NONZERO           100131 ;
-: GLU_TESS_WINDING_POSITIVE          100132 ;
-: GLU_TESS_WINDING_NEGATIVE          100133 ;
-: GLU_TESS_WINDING_ABS_GEQ_TWO       100134 ;
-
-LIBRARY: glu
-
-FUNCTION: void gluBeginCurve ( GLUnurbs* nurb ) ;
-FUNCTION: void gluBeginPolygon ( GLUtesselator* tess ) ;
-FUNCTION: void gluBeginSurface ( GLUnurbs* nurb ) ;
-FUNCTION: void gluBeginTrim ( GLUnurbs* nurb ) ;
-
-FUNCTION: GLint gluBuild1DMipmapLevels ( GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, void* data ) ;
-FUNCTION: GLint gluBuild1DMipmaps ( GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, void* data ) ;
-FUNCTION: GLint gluBuild2DMipmapLevels ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, void* data ) ;
-FUNCTION: GLint gluBuild2DMipmaps ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, void* data ) ;
-FUNCTION: GLint gluBuild3DMipmapLevels ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, void* data ) ;
-FUNCTION: GLint gluBuild3DMipmaps ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void* data ) ;
-FUNCTION: GLboolean gluCheckExtension ( GLubyte* extName, GLubyte* extString ) ;
-! windows? [
-!     { gluBuild1DMipmapLevels gluBuild1DMipmaps gluBuild2DMipmapLevels gluBuild2DMipmaps gluBuild3DMipmapLevels gluBuild3DMipmaps gluCheckExtension } [ forget ] each
-! ] unless
-FUNCTION: void gluCylinder ( GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks ) ;
-FUNCTION: void gluDeleteNurbsRenderer ( GLUnurbs* nurb ) ;
-FUNCTION: void gluDeleteQuadric ( GLUquadric* quad ) ;
-FUNCTION: void gluDeleteTess ( GLUtesselator* tess ) ;
-FUNCTION: void gluDisk ( GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops ) ;
-FUNCTION: void gluEndCurve ( GLUnurbs* nurb ) ;
-FUNCTION: void gluEndPolygon ( GLUtesselator* tess ) ;
-FUNCTION: void gluEndSurface ( GLUnurbs* nurb ) ;
-FUNCTION: void gluEndTrim ( GLUnurbs* nurb ) ;
-FUNCTION: GLubyte* gluErrorString ( GLenum error ) ;
-FUNCTION: void gluGetNurbsProperty ( GLUnurbs* nurb, GLenum property, GLfloat* data ) ;
-FUNCTION: GLubyte* 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 ) ;
-FUNCTION: GLUnurbs* gluNewNurbsRenderer ( ) ;
-FUNCTION: GLUquadric* gluNewQuadric ( ) ;
-FUNCTION: GLUtesselator* gluNewTess ( ) ;
-FUNCTION: void gluNextContour ( GLUtesselator* tess, GLenum type ) ;
-FUNCTION: void gluNurbsCallback ( GLUnurbs* nurb, GLenum which, GLUfuncptr CallBackFunc ) ;
-FUNCTION: void gluNurbsCallbackData ( GLUnurbs* nurb, GLvoid* userData ) ;
-FUNCTION: void gluNurbsCallbackDataEXT ( GLUnurbs* nurb, GLvoid* userData ) ;
-! windows? [
-!     { gluNurbsCallbackData gluNurbsCallbackDataEXT } [ forget ] each
-! ] unless
-FUNCTION: void gluNurbsCurve ( GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type ) ;
-FUNCTION: void gluNurbsProperty ( GLUnurbs* nurb, GLenum property, GLfloat value ) ;
-FUNCTION: void gluNurbsSurface ( GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type ) ;
-FUNCTION: void gluOrtho2D ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top ) ;
-FUNCTION: void gluPartialDisk ( GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep ) ;
-FUNCTION: void gluPerspective ( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar ) ;
-FUNCTION: void gluPickMatrix ( GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint* viewport ) ;
-FUNCTION: GLint gluProject ( GLdouble objX, GLdouble objY, GLdouble objZ, GLdouble* model, GLdouble* proj, GLint* view, GLdouble* winX, GLdouble* winY, GLdouble* winZ ) ;
-FUNCTION: void gluPwlCurve ( GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type ) ;
-FUNCTION: void gluQuadricCallback ( GLUquadric* quad, GLenum which, GLUfuncptr CallBackFunc ) ;
-FUNCTION: void gluQuadricDrawStyle ( GLUquadric* quad, GLenum draw ) ;
-FUNCTION: void gluQuadricNormals ( GLUquadric* quad, GLenum normal ) ;
-FUNCTION: void gluQuadricOrientation ( GLUquadric* quad, GLenum orientation ) ;
-FUNCTION: void gluQuadricTexture ( GLUquadric* quad, GLboolean texture ) ;
-FUNCTION: GLint gluScaleImage ( GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, void* dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut ) ;
-FUNCTION: void gluSphere ( GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks ) ;
-FUNCTION: void gluTessBeginContour ( GLUtesselator* tess ) ;
-FUNCTION: void gluTessBeginPolygon ( GLUtesselator* tess, GLvoid* data ) ;
-FUNCTION: void gluTessCallback ( GLUtesselator* tess, GLenum which, GLUfuncptr CallBackFunc ) ;
-FUNCTION: void gluTessEndContour ( GLUtesselator* tess ) ;
-FUNCTION: void gluTessEndPolygon ( GLUtesselator* tess ) ;
-FUNCTION: void gluTessNormal ( GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ ) ;
-FUNCTION: void gluTessProperty ( GLUtesselator* tess, GLenum which, GLdouble data ) ;
-FUNCTION: void gluTessVertex ( GLUtesselator* tess, GLdouble* location, GLvoid* data ) ;
-FUNCTION: GLint gluUnProject ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble* model, GLdouble* proj, GLint* view, GLdouble* objX, GLdouble* objY, GLdouble* objZ ) ;
-FUNCTION: GLint gluUnProject4 ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, GLdouble* model, GLdouble* proj, GLint* view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW ) ;
diff --git a/core/ui/opengl/load.factor b/core/ui/opengl/load.factor
deleted file mode 100644 (file)
index b065433..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-PROVIDE: core/ui/opengl
-{ +files+ {
-    "gl.factor"
-    "glu.factor"
-    "utilities.factor"
-    "utilities.facts"
-} } ;
diff --git a/core/ui/opengl/utilities.factor b/core/ui/opengl/utilities.factor
deleted file mode 100644 (file)
index ee42b49..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: opengl
-USING: alien errors io kernel math namespaces opengl
-sequences ;
-
-: gl-color ( color -- ) first4 glColor4d ; inline
-
-: gl-error ( -- )
-    glGetError dup zero? [
-        "GL error: " write dup gluErrorString print flush
-    ] unless drop ;
-
-: do-state ( what quot -- )
-    swap glBegin call glEnd ; inline
-
-: do-enabled ( what quot -- )
-    over glEnable swap slip glDisable ; inline
-
-: do-matrix ( mode quot -- )
-    swap [ glMatrixMode glPushMatrix call ] keep
-    glMatrixMode glPopMatrix ; inline
-
-: gl-vertex ( point -- ) first2 glVertex2d ; inline
-
-: gl-line ( a b -- )
-    GL_LINES [ gl-vertex gl-vertex ] do-state ;
-
-: gl-fill-rect ( loc dim -- )
-    [ first2 ] 2apply glRectd ;
-
-: gl-rect ( loc dim -- )
-    GL_FRONT_AND_BACK GL_LINE glPolygonMode
-    >r { 0.5 0.5 } v+ r> { 0.5 0.5 } v- gl-fill-rect
-    GL_FRONT_AND_BACK GL_FILL glPolygonMode ;
-
-: (gl-poly) [ [ gl-vertex ] each ] do-state ;
-
-: gl-fill-poly ( points -- )
-    dup length 2 > GL_POLYGON GL_LINES ? (gl-poly) ;
-
-: gl-poly ( points -- )
-    GL_LINE_LOOP (gl-poly) ;
-
-: prepare-gradient ( direction dim -- v1 v2 )
-    tuck v* [ v- ] keep ;
-
-: gl-gradient ( direction colors dim -- )
-    GL_QUAD_STRIP [
-        swap >r prepare-gradient r>
-        [ length dup 1- v/n ] keep [
-            >r >r 2dup r> r> gl-color v*n
-            dup gl-vertex v+ gl-vertex
-        ] 2each 2drop
-    ] do-state ;
-
-: gen-texture ( -- id )
-    1 0 <uint> [ glGenTextures ] keep *uint ;
-
-: save-attribs ( bits quot -- )
-    swap glPushAttrib call glPopAttrib ; inline
-
-TUPLE: sprite dlist texture loc dim dim2 ;
-
-C: sprite ( loc dim dim2 -- sprite )
-    [ set-sprite-dim2 ] keep
-    [ set-sprite-dim ] keep
-    [ set-sprite-loc ] keep ;
-
-: sprite-size2 sprite-dim2 first2 ;
-
-: sprite-width sprite-dim first ;
-
-: gray-texture ( sprite pixmap -- id )
-    gen-texture [
-        GL_TEXTURE_BIT [
-            GL_TEXTURE_2D swap glBindTexture
-            >r >r GL_TEXTURE_2D 0 GL_RGBA r>
-            sprite-size2 0 GL_LUMINANCE_ALPHA
-            GL_UNSIGNED_BYTE r> glTexImage2D
-        ] save-attribs
-    ] keep ;
-
-: gen-dlist ( -- id ) 1 glGenLists ;
-
-: make-dlist ( type quot -- id )
-    gen-dlist [ rot glNewList call glEndList ] keep ; inline
-
-: init-texture ( -- )
-    GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_LINEAR glTexParameteri
-    GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_LINEAR glTexParameteri
-    GL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP glTexParameterf
-    GL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP glTexParameterf ;
-
-: gl-translate ( point -- ) first2 0.0 glTranslated ;
-
-: top-left drop 0 0 glTexCoord2i 0.0 0.0 glVertex2d ; inline
-
-: top-right 1 0 glTexCoord2i first 0.0 glVertex2d ; inline
-
-: bottom-left 0 1 glTexCoord2i second 0.0 swap glVertex2d ; inline
-
-: bottom-right 1 1 glTexCoord2i gl-vertex ; inline
-
-: four-sides ( dim -- )
-    dup top-left dup top-right dup bottom-right bottom-left ;
-
-: draw-sprite ( sprite -- )
-    dup sprite-loc gl-translate
-    GL_TEXTURE_2D over sprite-texture glBindTexture
-    init-texture
-    GL_QUADS [ dup sprite-dim2 four-sides ] do-state
-    dup sprite-dim { 1 0 } v*
-    swap sprite-loc v- gl-translate
-    GL_TEXTURE_2D 0 glBindTexture ;
-
-: make-sprite-dlist ( sprite -- id )
-    GL_MODELVIEW [
-        GL_COMPILE [ draw-sprite ] make-dlist
-    ] do-matrix ;
-
-: init-sprite ( texture sprite -- )
-    [ set-sprite-texture ] keep
-    [ make-sprite-dlist ] keep set-sprite-dlist ;
-
-: free-sprite ( sprite -- )
-    dup sprite-dlist 1 glDeleteLists
-    sprite-texture <uint> 1 swap glDeleteTextures ;
-
-: free-sprites ( sprites -- ) [ [ free-sprite ] when* ] each ;
-
-: with-translation ( loc quot -- )
-    GL_MODELVIEW [ >r gl-translate r> call ] do-matrix ; inline
diff --git a/core/ui/opengl/utilities.facts b/core/ui/opengl/utilities.facts
deleted file mode 100644 (file)
index 5c7723c..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-IN: opengl
-USING: help io kernel math ;
-
-HELP: gl-color
-{ $values { "color" "a color specifier" } }
-{ $description "Wrapper for " { $link glColor4d } " taking a color specifier." } ;
-
-HELP: gl-error
-{ $description "If the most recent OpenGL call resulted in an error, print the error to the " { $link stdio } " stream." } ;
-
-HELP: do-state
-{ $values { "what" integer } { "quot" quotation } }
-{ $description "Wraps a quotation in " { $link glBegin } "/" { $link glEnd } " calls." } ;
-
-HELP: do-enabled
-{ $values { "what" integer } { "quot" quotation } }
-{ $description "Wraps a quotation in " { $link glEnable } "/" { $link glDisable } " calls." } ;
-
-HELP: do-matrix
-{ $values { "mode" { $link GL_MODELVIEW } " or " { $link GL_PROJECTION } } { "quot" quotation } }
-{ $description "Saves and restores the matrix specified by " { $snippet "mode" } " before and after calling the quotation." } ;
-
-HELP: gl-vertex
-{ $values { "point" "a pair of integers" } }
-{ $description "Wrapper for " { $link glVertex2d } " taking a point object." } ;
-
-HELP: gl-vertex
-{ $values { "point" "a pair of integers" } }
-{ $description "Wrapper for " { $link glVertex2d } " taking a point object." } ;
-
-HELP: gl-line
-{ $values { "a" "a pair of integers" } { "b" "a pair of integers" } }
-{ $description "Draws a line between two points." } ;
-
-HELP: gl-fill-rect
-{ $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
-{ $description "Draws a filled rectangle with top-left corner " { $snippet "loc" } " and dimensions " { $snippet "dim" } "." } ;
-
-HELP: gl-rect
-{ $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
-{ $description "Draws the outline of a rectangle with top-left corner " { $snippet "loc" } " and dimensions " { $snippet "dim" } "." } ;
-
-HELP: gl-fill-poly
-{ $values { "points" "a sequence of pairs of integers" } }
-{ $description "Draws a filled polygon." } ;
-
-HELP: gl-poly
-{ $values { "points" "a sequence of pairs of integers" } }
-{ $description "Draws the outline of a polygon." } ;
-
-HELP: gl-gradient
-{ $values { "direction" "one of " { $snippet "{ 0 1 }" } " or " { $snippet "{ 1 0 }" } } { "colors" "a sequence of color specifiers" } { "dim" "a pair of integers" } }
-{ $description "Draws a rectangle with top-left corner " { $snippet "{ 0 0 }" } " and dimensions " { $snippet "dim" } ", filled wit ha smoothly shaded transition between the colors in " { $snippet "colors" } "." } ;
-
-HELP: gen-texture
-{ $values { "id" integer } }
-{ $description "Wrapper for " { $link glGenTextures } " to handle the common case of generating a single texture ID." } ;
-
-HELP: save-attribs
-{ $values { "bits" integer } { "quot" quotation } }
-{ $description "Wraps a quotation in " { $link glPushAttrib } "/" { $link glPopAttrib } " calls." } ;
-
-HELP: sprite
-{ $class-description "A sprite is an OpenGL texture together with a display list which renders a textured quad. Sprites are used to draw text in the UI. Sprites have the following slots:"
-    { $list
-        { { $link sprite-dlist } " - an OpenGL display list ID" }
-        { { $link sprite-texture } " - an OpenGL texture ID" }
-        { { $link sprite-loc } " - top-left corner of the sprite" }
-        { { $link sprite-dim } " - dimensions of the sprite" }
-        { { $link sprite-dim2 } " - dimensions of the sprite, rounded up to the nearest powers of two" }
-    }
-} ;
-
-HELP: gray-texture
-{ $values { "sprite" sprite } { "pixmap" "an alien or byte array" } { "id" "an OpenGL texture ID" } }
-{ $description "Creates a new OpenGL texture from a 1 byte per pixel image whose dimensions are equal to " { $link sprite-dim2 } "." } ;
-
-HELP: gen-dlist
-{ $values { "id" integer } }
-{ $description "Wrapper for " { $link glGenLists } " to handle the common case of generating a single display list ID." } ;
-
-HELP: make-dlist
-{ $values { "type" "one of " { $link GL_COMPILE } " or " { $link GL_COMPILE_AND_EXECUTE } } { "quot" quotation } { "id" "an OpenGL texture ID" } }
-{ $description "Compiles the results of calling the quotation into a new OpenGL display list." } ;
-
-HELP: gl-translate
-{ $values { "loc" "a pair of integers" } }
-{ $description "Wrapper for " { $link glTranslated } " taking a point object." } ;
-
-HELP: free-sprites
-{ $values { "sprites" "a sequence of " { $link sprite } " instances" } }
-{ $description "Deallocates native resources associated toa  sequence of sprites." } ;
-
-HELP: with-translation
-{ $values { "loc" "a pair of integers" } { "quot" quotation } }
-{ $description "Calls the quotation with a translation by " { $snippet "loc" } " pixels applied to the current " { $link GL_MODELVIEW } " matrix, restoring the matrix when the quotation is done." } ;
diff --git a/core/ui/paint.factor b/core/ui/paint.factor
deleted file mode 100644 (file)
index 1c3f02d..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays freetype generic hashtables io kernel
-math namespaces opengl sequences strings styles
-vectors ;
-IN: gadgets
-
-SYMBOL: clip
-
-: init-gl ( dim -- )
-    GL_PROJECTION glMatrixMode
-    glLoadIdentity
-    GL_MODELVIEW glMatrixMode
-    glLoadIdentity
-    { 0 0 } over <rect> clip set
-    dup first2 0 0 2swap glViewport
-    0 over first2 0 gluOrtho2D
-    first2 0 0 2swap glScissor
-    GL_SMOOTH glShadeModel
-    GL_BLEND glEnable
-    GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
-    GL_SCISSOR_TEST glEnable
-    1.0 1.0 1.0 1.0 glClearColor
-    GL_COLOR_BUFFER_BIT glClear ;
-
-GENERIC: draw-gadget* ( gadget -- )
-
-M: gadget draw-gadget* drop ;
-
-GENERIC: draw-interior ( gadget interior -- )
-
-GENERIC: draw-boundary ( gadget boundary -- )
-
-: visible-children ( gadget -- seq ) clip get swap children-on ;
-
-DEFER: draw-gadget
-
-: (draw-gadget) ( gadget -- )
-    [
-        dup translate
-        dup dup gadget-interior draw-interior
-        dup draw-gadget*
-        dup visible-children [ draw-gadget ] each
-        dup gadget-boundary draw-boundary
-    ] with-scope ;
-
-: change-clip ( gadget -- )
-    >absolute clip [ rect-intersect ] change ;
-
-: clip-x/y ( loc dim -- x y )
-    >r [ first ] keep r> [ second ] 2apply +
-    world get rect-dim second swap - ;
-
-: gl-set-clip ( loc dim -- )
-    [ clip-x/y ] keep first2 glScissor ;
-
-: do-clip ( -- ) clip get rect-bounds gl-set-clip ;
-
-: with-clipping ( gadget quot -- )
-    clip get >r
-    over change-clip do-clip call
-    r> clip set do-clip ; inline
-
-: draw-gadget ( gadget -- )
-    {
-        { [ dup gadget-visible? not ] [ drop ] }
-        { [ dup gadget-clipped? not ] [ (draw-gadget) ] }
-        { [ t ] [ [ (draw-gadget) ] with-clipping ] }
-    } cond ;
-
-: (draw-world) ( world -- )
-    dup world-handle [
-        dup rect-dim init-gl draw-gadget
-    ] with-gl-context ;
-
-! Pen paint properties
-M: f draw-interior 2drop ;
-M: f draw-boundary 2drop ;
-
-! Solid fill/border
-TUPLE: solid color ;
-
-! Solid pen
-: (solid)
-    solid-color gl-color rect-dim >r origin get dup r> v+ ;
-
-M: solid draw-interior (solid) gl-fill-rect ;
-
-M: solid draw-boundary (solid) gl-rect ;
-
-! Gradient pen
-TUPLE: gradient colors ;
-
-M: gradient draw-interior
-    origin get [
-        over gadget-orientation
-        swap gradient-colors
-        rot rect-dim
-        gl-gradient
-    ] with-translation ;
-
-! Polygon pen
-TUPLE: polygon color points ;
-
-: draw-polygon ( polygon quot -- )
-    origin get [
-        >r dup polygon-color gl-color polygon-points r> call
-    ] with-translation ; inline
-
-M: polygon draw-boundary
-    [ gl-poly ] draw-polygon drop ;
-
-M: polygon draw-interior
-    [ gl-fill-poly ] draw-polygon drop ;
-
-: arrow-up    { { 3 0 } { 6 6 } { 0 6 } } ;
-: arrow-right { { 0 0 } { 6 3 } { 0 6 } } ;
-: arrow-down  { { 0 0 } { 6 0 } { 3 6 } } ;
-: arrow-left  { { 0 3 } { 6 0 } { 6 6 } } ;
-: close-box   { { 0 0 } { 6 0 } { 6 6 } { 0 6 } } ;
-
-: <polygon-gadget> ( color points -- gadget )
-    dup max-dim
-    >r <polygon> <gadget> r> over set-rect-dim
-    [ set-gadget-interior ] keep ;
diff --git a/core/ui/paint.facts b/core/ui/paint.facts
deleted file mode 100644 (file)
index ff24e16..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-IN: gadgets
-USING: help ;
-
-HELP: clip
-{ $var-description "The current clipping rectangle." } ;
-
-HELP: draw-gadget*
-{ $values { "gadget" gadget } } 
-{ $contract "Draws the gadget by making OpenGL calls. The top-left corner of the gadget should be drawn at the location stored in the " { $link origin } " variable." }
-{ $notes "This word should not be called directly. To force a gadget to redraw, call " { $link relayout-1 } "." } ;
-
-HELP: draw-interior
-{ $values { "gadget" gadget } } 
-{ $contract "Draws the interior of a gadget by making OpenGL calls. The " { $link gadget-interior } " slot may be set to objects implementing this generic word." } ;
-
-HELP: draw-boundary
-{ $values { "gadget" gadget } } 
-{ $contract "Draws the boundary of a gadget by making OpenGL calls. The " { $link gadget-boundary } " slot may be set to objects implementing this generic word." } ;
-
-HELP: solid
-{ $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " generic words to draw a solid outline or a solid fill, respectively. The " { $link solid-color } " slot stores a color specifier." } ;
-
-HELP: gradient
-{ $class-description "A class implementing the " { $link draw-interior } " generic word to draw a smoothly shaded transition between colors. The " { $link gradient-colors } " slot stores a sequence of color specifiers and the gradient is drawn in the direction given by the " { $link gadget-orientation } " slot of the gadget." } ;
-
-HELP: polygon
-{ $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " generic words to draw a solid outline or a solid filled polygon, respectively. Instances of " { $link polygon } " have two slots:"
-    { $list
-        { { $link polygon-color } " - a color specifier" }
-        { { $link polygon-points } " - a sequence of points" }
-    }
-} ;
-
-HELP: <polygon>
-{ $values { "color" "a color specifier" } { "points" "a sequence of points" } }
-{ $description "Creates a new instance of " { $link polygon } "." } ;
-
-HELP: <polygon-gadget>
-{ $values { "color" "a color specifier" } { "points" "a sequence of points" } }
-{ $description "Creates a gadget which is drawn as a solid filled polygon. The gadget's size is the minimum bounding box containing all the points of the polygon." } ;
diff --git a/core/ui/test/commands.factor b/core/ui/test/commands.factor
deleted file mode 100644 (file)
index 59b24d9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-IN: temporary
-USING: gadgets test ;
-
-[ "A+a" ] [ T{ key-down f { A+ } "a" } gesture>string ] unit-test
-[ "b" ] [ T{ key-down f f "b" } gesture>string ] unit-test
-[ "Press Button 2" ] [ T{ button-down f f 2 } gesture>string ] unit-test
diff --git a/core/ui/test/document.factor b/core/ui/test/document.factor
deleted file mode 100644 (file)
index c6b49d7..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-IN: temporary
-USING: gadgets-text namespaces test ;
-
-! Tests
-
-[ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
-[ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
-
-[ { 2 0 } ] [
-    <document> "doc" set
-    "Hello world,\nhow are you?\nMore text"
-    "doc" get set-doc-string
-    { 10 0 } "doc" get validate-loc
-] unit-test
-
-[ { 1 12 } ] [
-    <document> "doc" set
-    "Hello world,\nhow are you?\nMore text"
-    "doc" get set-doc-string
-    { 1 20 } "doc" get validate-loc
-] unit-test
-
-[ " world,\nhow are you?\nMore" ] [
-    <document> "doc" set
-    "Hello world,\nhow are you?\nMore text"
-    "doc" get set-doc-string
-    { 0 5 } { 2 4 } "doc" get doc-range
-] unit-test
-
-[ "Hello world,\nhow you?\nMore text" ] [
-    <document> "doc" set
-    "Hello world,\nhow are you?\nMore text"
-    "doc" get set-doc-string
-    { 1 3 } { 1 7 } "doc" get remove-doc-range
-    "doc" get doc-string
-] unit-test
-
-[ "Hello world,\nhow text" ] [
-    <document> "doc" set
-    "Hello world,\nhow are you?\nMore text"
-    "doc" get set-doc-string
-    { 1 3 } { 2 4 } "doc" get remove-doc-range
-    "doc" get doc-string
-] unit-test
-
-[ "Hello world,\nhow you?\nMore text" ] [
-    <document> "doc" set
-    "Hello world,\nhow are you?\nMore text"
-    "doc" get set-doc-string
-    "" { 1 3 } { 1 7 } "doc" get set-doc-range
-    "doc" get doc-string
-] unit-test
-
-[ "Hello world,\nhow text" ] [
-    <document> "doc" set
-    "Hello world,\nhow are you?\nMore text"
-    "doc" get set-doc-string
-    "" { 1 3 } { 2 4 } "doc" get set-doc-range
-    "doc" get doc-string
-] unit-test
-
-<document> "doc" set
-"Hello world" "doc" get set-doc-string
-[ { 0 0 } ] [ { 0 0 } "doc" get T{ one-word-elt } prev-elt ] unit-test
-[ { 0 0 } ] [ { 0 2 } "doc" get T{ one-word-elt } prev-elt ] unit-test
-[ { 0 0 } ] [ { 0 5 } "doc" get T{ one-word-elt } prev-elt ] unit-test
-[ { 0 5 } ] [ { 0 2 } "doc" get T{ one-word-elt } next-elt ] unit-test
-[ { 0 5 } ] [ { 0 5 } "doc" get T{ one-word-elt } next-elt ] unit-test
diff --git a/core/ui/test/editor.factor b/core/ui/test/editor.factor
deleted file mode 100644 (file)
index 60b6103..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-USING: gadgets-text test kernel io definitions namespaces
-gadgets ;
-
-[ t ] [
-    <editor> "editor" set
-    "editor" get graft*
-    "editor" get <plain-writer> [ \ = see ] with-stream
-    "editor" get editor-string [ \ = see ] string-out =
-    "editor" get ungraft*
-] unit-test
-
-[ "foo bar" ] [
-    <editor> "editor" set
-    "editor" get graft*
-    "foo bar" "editor" get set-editor-string
-    "editor" get T{ one-line-elt } select-elt
-    "editor" get gadget-selection
-    "editor" get ungraft*
-] unit-test
-
-[ "baz quux" ] [
-    <editor> "editor" set
-    "editor" get graft*
-    "foo bar\nbaz quux" "editor" get set-editor-string
-    "editor" get T{ one-line-elt } select-elt
-    "editor" get gadget-selection
-    "editor" get ungraft*
-] unit-test
diff --git a/core/ui/test/gadgets.factor b/core/ui/test/gadgets.factor
deleted file mode 100644 (file)
index af0ba87..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-IN: temporary
-USING: gadgets test namespaces ;
-
-TUPLE: fooey ;
-
-[ ] [ <gadget> <fooey> set-gadget-delegate ] unit-test
-[ ] [ f <fooey> set-gadget-delegate ] unit-test
-
-[ { 300 300 } ]
-[
-    ! c contains b contains a
-    <gadget> "a" set
-    <gadget> "b" set
-    "a" get "b" get add-gadget
-    <gadget> "c" set
-    "b" get "c" get add-gadget
-    
-    ! position a and b
-    { 100 200 } "a" get set-rect-loc
-    { 200 100 } "b" get set-rect-loc
-    
-    ! give c a loc, it doesn't matter
-    { -1000 23 } "c" get set-rect-loc
-
-    ! what is the location of a inside c?
-    "a" get "c" get relative-loc
-] unit-test
diff --git a/core/ui/test/lists.factor b/core/ui/test/lists.factor
deleted file mode 100644 (file)
index d51e7f3..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-IN: temporary
-USING: gadgets-lists models prettyprint math test kernel ;
-
-[ ] [ [ drop ] [ 3 + . ] f <model> <list> list-action ] unit-test
diff --git a/core/ui/test/models.factor b/core/ui/test/models.factor
deleted file mode 100644 (file)
index 07edbad..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-IN: temporary
-USING: arrays generic kernel math models namespaces sequences
-test ;
-
-TUPLE: model-tester hit? ;
-
-C: model-tester ;
-
-M: model-tester model-changed t swap set-model-tester-hit? ;
-
-[ T{ model-tester f t } ]
-[
-    T{ model-tester f f } 3 <model> 2dup add-connection
-    5 swap set-model
-] unit-test
-
-3 <model> "model-a" set
-4 <model> "model-b" set
-"model-a" get "model-b" get 2array <compose> "model-c" set
-
-"model-c" get activate-model
-[ { 3 4 } ] [ "model-c" get model-value  ] unit-test
-"model-c" get deactivate-model
-
-T{ model-tester f f } "tester" set
-
-[ T{ model-tester f t } { 6 4 } ]
-[
-    "tester" get "model-c" get add-connection
-    6 "model-a" get set-model
-    "tester" get
-    "model-c" get model-value
-] unit-test
-
-f <history> "history" set
-
-"history" get add-history
-
-[ t ] [ "history" get history-back empty? ] unit-test
-[ t ] [ "history" get history-forward empty? ] unit-test
-
-"history" get add-history
-3 "history" get set-model
-
-[ t ] [ "history" get history-back empty? ] unit-test
-[ t ] [ "history" get history-forward empty? ] unit-test
-
-"history" get add-history
-4 "history" get set-model
-
-[ f ] [ "history" get history-back empty? ] unit-test
-[ t ] [ "history" get history-forward empty? ] unit-test
-
-"history" get go-back
-
-[ 3 ] [ "history" get model-value ] unit-test
-
-[ t ] [ "history" get history-back empty? ] unit-test
-[ f ] [ "history" get history-forward empty? ] unit-test
-
-"history" get go-forward
-
-[ 4 ] [ "history" get model-value ] unit-test
-
-[ f ] [ "history" get history-back empty? ] unit-test
-[ t ] [ "history" get history-forward empty? ] unit-test
-
-! Test multiple filters
-3 <model> "x" set
-"x" get [ 2 * ] <filter> dup "z" set
-[ 1+ ] <filter> "y" set
-[ ] [ "y" get activate-model ] unit-test
-[ t ] [ "z" get "x" get model-connections memq? ] unit-test
-[ 7 ] [ "y" get model-value ] unit-test
-[ ] [ 4 "x" get set-model ] unit-test
-[ 9 ] [ "y" get model-value ] unit-test
-[ ] [ "y" get deactivate-model ] unit-test
-[ f ] [ "z" get "x" get model-connections memq? ] unit-test
-
-3 <model> "x" set
-"x" get [ sq ] <filter> "y" set
-
-4 "x" get set-model
-
-"y" get activate-model
-[ 16 ] [ "y" get model-value ] unit-test
-"y" get deactivate-model
diff --git a/core/ui/test/panes.factor b/core/ui/test/panes.factor
deleted file mode 100644 (file)
index c1c3dd5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-IN: temporary
-USING: alien gadgets-panes gadgets freetype namespaces kernel
-sequences io test prettyprint ;
-
-: #children "pane" get gadget-children length ;
-
-[
-    <pane> "pane" set
-
-    #children "num-children" set
-    
-    "pane" get <pane-stream> [ 10000 [ . ] each ] with-stream*
-    
-    [ t ] [ #children "num-children" get = ] unit-test
-] with-freetype
diff --git a/core/ui/test/presentations.factor b/core/ui/test/presentations.factor
deleted file mode 100644 (file)
index 217a2b3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-IN: temporary
-USING: math gadgets-presentations gadgets generic test
-prettyprint gadgets-buttons io kernel ;
-
-[ t ] [
-    "Hi" \ + <presentation> [ gadget? ] is?
-] unit-test
-
-[ "+" ] [
-    [
-        \ +
-        "Test" f [ pprint ] <command> <command-button>
-        dup button-quot call
-    ] string-out
-] unit-test
diff --git a/core/ui/test/rectangles.factor b/core/ui/test/rectangles.factor
deleted file mode 100644 (file)
index f683331..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-USING: gadgets kernel namespaces test ;
-
-[ T{ rect f { 10 10 } { 20 20 } } ]
-[
-    T{ rect f { 10 10 } { 50 50 } }
-    T{ rect f { -10 -10 } { 40 40 } }
-    rect-intersect
-] unit-test
-
-[ T{ rect f { 200 200 } { 0 0 } } ]
-[
-    T{ rect f { 100 100 } { 50 50 } }
-    T{ rect f { 200 200 } { 40 40 } }
-    rect-intersect
-] unit-test
-
-[ f ] [
-    T{ rect f { 100 100 } { 50 50 } }
-    T{ rect f { 200 200 } { 40 40 } }
-    intersects?
-] unit-test
-
-[ t ] [
-    T{ rect f { 100 100 } { 50 50 } }
-    T{ rect f { 120 120 } { 40 40 } }
-    intersects?
-] unit-test
-
-[ f ] [
-    T{ rect f { 1000 100 } { 50 50 } }
-    T{ rect f { 120 120 } { 40 40 } }
-    intersects?
-] unit-test
diff --git a/core/ui/test/scrolling.factor b/core/ui/test/scrolling.factor
deleted file mode 100644 (file)
index a94bb47..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-IN: temporary
-USING: gadgets gadgets-scrolling namespaces test kernel
-models gadgets-viewports math ;
-
-[ ] [
-    <gadget> "g" set
-    "g" get <scroller> "s" set
-] unit-test
-
-[ { 100 200 } ] [
-    { 100 200 } "g" get scroll>rect
-    "s" get scroller-follows rect-loc
-] unit-test
-
-[ ] [ "s" get scroll>bottom ] unit-test
-[ t ] [ "s" get scroller-follows ] unit-test
-
-[ ] [
-    <gadget> dup "g" set { 10 20 } <model> <viewport> "v" set 
-] unit-test
-
-[ { 10 20 } ] [ "g" get rect-loc vneg { 3 3 } v+ ] unit-test
-
-[ ] [
-    <gadget> { 100 100 } over set-rect-dim
-    dup "g" set <scroller> "s" set
-] unit-test
-
-[ ] [ "s" get graft ] unit-test
-
-[ ] [ "s" get { 10 20 } scroll ] unit-test
-
-[ { 10 20 } ] [ "g" get rect-loc vneg { 3 3 } v+ ] unit-test
-
-[ ] [ "s" get ungraft ] unit-test
diff --git a/core/ui/test/search.factor b/core/ui/test/search.factor
deleted file mode 100644 (file)
index 714e2de..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-IN: temporary
-USING: gadgets-search io test namespaces gadgets 
-sequences threads freetype timers kernel words ;
-
-timers get [ init-timers ] unless
-
-[
-    "set-word-prop" all-words <word-search> "search" set
-    "search" get graft
-    
-    1000 sleep
-    do-timers
-    
-    [ f ]
-    [ "search" get live-search-list control-value empty? ]
-    unit-test
-    
-    "search" get ungraft
-] with-freetype
diff --git a/core/ui/test/sliders.factor b/core/ui/test/sliders.factor
deleted file mode 100644 (file)
index bb2c4bc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-IN: temporary
-USING: gadgets-sliders gadgets test generic kernel timers ;
-
-timers [ init-timers ] unless
-
-[ t ]
-[ <y-slider> slider-elevator [ timer-gadget? ] is? ]
-unit-test
-
-[ ] [
-    <y-slider> slider-elevator
-    dup elevator-click stop-timer-gadget
-] unit-test
diff --git a/core/ui/test/titled-gadget.factor b/core/ui/test/titled-gadget.factor
deleted file mode 100644 (file)
index cc3f6f2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-IN: temporary
-USING: gadgets-labels gadgets namespaces test ;
-
-"Hey" <label> "Foo" <titled-gadget> "t" set
-
-[ t ] [ "t" get focusable-child label? ] unit-test
-[ "Foo" ] [ "t" get gadget-title ] unit-test
diff --git a/core/ui/text.factor b/core/ui/text.factor
deleted file mode 100644 (file)
index 8fefb62..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays errors freetype generic hashtables
-kernel math models namespaces opengl sequences strings ;
-
-: string-width ( open-font string -- w )
-    0 -rot [ char-width + ] each-with ;
-
-: text-height ( open-font text -- n )
-    dup string? [ drop 1 ] [ length ] if
-    swap font-height * ;
-
-: text-width ( open-font text -- n )
-    dup string? [
-        string-width
-    ] [
-        0 -rot [ string-width max ] each-with
-    ] if ;
-
-: text-dim ( open-font text -- dim )
-    [ text-width ] 2keep text-height 2array ;
-
-: font-sprites ( open-font world -- pair )
-    world-fonts [ open-font V{ } clone 2array ] cache ;
-
-: draw-string ( font string loc -- )
-    >r >r world get font-sprites first2 r> r> (draw-string) ;
-
-: draw-text ( font text loc -- )
-    over string? [
-        draw-string
-    ] [
-        [
-            over open-font font-height -rot [
-                >r 2dup r> { 0 0 } draw-string
-                0.0 swap 0.0 glTranslated
-            ] each 2drop
-        ] with-translation
-    ] if ;
diff --git a/core/ui/text.facts b/core/ui/text.facts
deleted file mode 100644 (file)
index d32a76a..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-IN: gadgets
-USING: help freetype strings kernel styles alien opengl ;
-
-HELP: freetype
-{ $var-description "Global variable. Holds a native handle used by the FreeType library." }
-{ $see-also with-freetype } ;
-
-HELP: open-fonts
-{ $var-description "Global variable. Hashtable mapping font descriptors to " { $link font } " instances." }
-{ $see-also open-font } ;
-
-HELP: init-freetype
-{ $description "Initializes the FreeType library." }
-{ $notes "Do not call this word if you are using the UI." } ;
-
-HELP: font
-{ $class-description "A font which has been loaded by FreeType. Font instances have the following slots:"
-    { $list
-        { { $link font-ascent } ", " { $link font-descent } ", " { $link font-height } " - metrics." }
-        { { $link font-handle } " - alien pointer to an " { $snippet "FT_Face" } "." }
-        { { $link font-widths } " - sequence of character widths. Use " { $link char-width } " and " { $link string-width } " to compute string widths instead of reading this sequence directly." }
-    }
-}
-{ $see-also open-font char-width string-width text-dim draw-string draw-text } ;
-
-HELP: close-freetype
-{ $description "Closes the FreeType library." }
-{ $notes "Do not call this word if you are using the UI." } ;
-
-HELP: with-freetype
-{ $values { "quot" quotation } }
-{ $description "Sets up and tears down FreeType before and after calling the quotation. This word is re-entrant, so the quotation itself can call " { $link with-freetype } "." }
-{ $notes "Do not call this word if you are using the UI." } ;
-
-HELP: open-face
-{ $values { "font" string } { "style" "one of " { $link plain } ", " { $link bold } ", " { $link italic } " or " { $link bold-italic } } { "face" "alien pointer to an " { $snippet "FT_Face" } } }
-{ $description "Loads a TrueType font with the requested logical font name and style." }
-{ $notes "This is a low-level word. Call " { $link open-font } " instead." } ;
-
-HELP: open-font
-{ $values { "font" "a font specifier" } { "open-font" font } }
-{ $description "Loads a TrueType font if it has not already been loaded, otherwise outputs the existing " { $link font } " instance." }
-{ $errors "Throws an error if the font does not exist." } ;
-
-HELP: render-glyph
-{ $values  { "font" font } { "char" "a non-negative integer" } { "bitmap" alien } }
-{ $description "Renders a character and outputs a pointer to the bitmap." } ;
-
-HELP: <char-sprite>
-{ $values { "font" font } { "char" "a non-negative integer" } { "sprite" sprite } }
-{ $description "Renders a character to an OpenGL texture and records a display list which draws a quad with this texture. This word allocates native resources which must be freed by " { $link free-sprites } "." } ;
-
-HELP: (draw-string)
-{ $values { "open-font" font } { "sprites" "a vector of " { $link sprite } " instances" } { "string" string } { "loc" "a pair of integers" } }
-{ $description "Draws a line of text." }
-{ $notes "This is a low-level word, UI code should use " { $link draw-string } " or " { $link draw-text } " instead." }
-{ $side-effects "sprites" } ;
-
-HELP: string-width
-{ $values { "open-font" "an instance of " { $link font } } { "string" string } { "w" "a positive integer" } }
-{ $description "Outputs the width of a string." }
-{ $see-also open-font text-dim } ;
-
-HELP: text-dim
-{ $values { "open-font" "an instance of " { $link font } } { "text" "a string or an array of strings" } { "dim" "a pair of integers" } }
-{ $description "Outputs the dimensions of a piece of text, which is either a single-line string or an array of lines." }
-{ $see-also open-font string-width } ;
-
-HELP: draw-string
-{ $values { "font" "a font specifier" } { "string" string } { "loc" "a pair of integers" } }
-{ $description "Draws a line of text." }
-{ $see-also open-font draw-text } ;
-
-HELP: draw-text
-{ $values { "font" "a font specifier" } { "text" "a string or an array of strings" } { "loc" "a pair of integers" } }
-{ $description "Draws text. Text is either a single-line string or an array of lines." }
-{ $see-also open-font draw-text } ;
diff --git a/core/ui/text/commands.factor b/core/ui/text/commands.factor
deleted file mode 100644 (file)
index a0cf1db..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-text
-USING: gadgets kernel models namespaces sequences arrays ;
-
-: editor-extend-selection ( editor -- )
-    dup request-focus
-    dup editor-caret click-loc ;
-
-: editor-mouse-drag ( editor -- )
-    dup editor-caret click-loc ;
-
-: editor-copy ( editor clipboard -- )
-    over gadget-selection? [
-        >r [ gadget-selection ] keep r> copy-clipboard
-    ] [
-        2drop
-    ] if ;
-
-: editor-cut ( editor clipboard -- )
-    dupd editor-copy remove-editor-selection ;
-
-: delete/backspace ( elt editor quot -- )
-    over gadget-selection? [
-        drop nip remove-editor-selection
-    ] [
-        over >r >r dup editor-caret* swap control-model
-        r> call r> control-model remove-doc-range
-    ] if ; inline
-
-: editor-delete ( editor elt -- )
-    swap [ over >r rot next-elt r> swap ] delete/backspace ;
-
-: editor-backspace ( editor elt -- )
-    swap [ over >r rot prev-elt r> ] delete/backspace ;
-
-: editor-select-prev ( editor elt -- )
-    swap [ rot prev-elt ] change-caret ;
-
-: editor-prev ( editor elt -- )
-    dupd editor-select-prev mark>caret ;
-
-: editor-select-next ( editor elt -- )
-    swap [ rot next-elt ] change-caret ;
-
-: editor-next ( editor elt -- )
-    dupd editor-select-next mark>caret ;
-
-: editor-select ( from to editor -- )
-    tuck editor-caret set-model editor-mark set-model ;
-
-: select-elt ( editor elt -- )
-    over >r
-    >r dup editor-caret* swap control-model r>
-    3dup next-elt >r prev-elt r>
-    r> editor-select ;
-
-: select-all ( editor -- ) T{ doc-elt } select-elt ;
-
-: editor-doc-start ( editor -- ) T{ doc-elt } editor-prev ;
-
-: editor-doc-end ( editor -- ) T{ doc-elt } editor-next ;
-
-: selected-word ( editor -- string )
-    dup gadget-selection?
-    [ dup T{ one-word-elt } select-elt ] unless
-    gadget-selection ;
-
-: position-caret ( editor -- )
-    dup editor-extend-selection
-    dup editor-mark click-loc ;
-
-: editor-mouse-down ( editor -- )
-    hand-click# get {
-        [ ]
-        [ dup position-caret ]
-        [ dup T{ one-word-elt } select-elt ]
-        [ dup T{ one-line-elt } select-elt ]
-    } ?nth call drop ;
-
-editor "editing" {
-    { "Insert newline" T{ key-down f f "RETURN" } [ "\n" swap user-input ] }
-    { "Insert newline" T{ key-down f { S+ } "RETURN" } [ "\n" swap user-input ] }
-    { "Insert newline" T{ key-down f f "ENTER" } [ "\n" swap user-input ] }
-    { "Delete next character" T{ key-down f f "DELETE" } [ T{ char-elt } editor-delete ] }
-    { "Delete next character" T{ key-down f { S+ } "DELETE" } [ T{ char-elt } editor-delete ] }
-    { "Delete previous character" T{ key-down f f "BACKSPACE" } [ T{ char-elt } editor-backspace ] }
-    { "Delete previous character" T{ key-down f { S+ } "BACKSPACE" } [ T{ char-elt } editor-backspace ] }
-    { "Delete previous word" T{ key-down f { C+ } "DELETE" } [ T{ word-elt } editor-delete ] }
-    { "Delete next word" T{ key-down f { C+ } "BACKSPACE" } [ T{ word-elt } editor-backspace ] }
-    { "Delete to start of line" T{ key-down f { A+ } "DELETE" } [ T{ one-line-elt } editor-delete ] }
-    { "Delete to end of line" T{ key-down f { A+ } "BACKSPACE" } [ T{ one-line-elt } editor-backspace ] }
-} define-commands
-
-editor "clipboard" {
-    { "Paste" T{ paste-action } [ clipboard get paste-clipboard ] }
-    { "Paste selection" T{ button-up f f 2 } [ selection get paste-clipboard ] }
-    { "Copy" T{ copy-action } [ clipboard get editor-copy ] }
-    { "Copy selection" T{ button-up } [ selection get editor-copy ] }
-    { "Cut" T{ cut-action } [ clipboard get editor-cut ] }
-} define-commands
-
-editor "caret" {
-    { "Position caret" T{ button-down } [ editor-mouse-down ] }
-    { "Previous character" T{ key-down f f "LEFT" } [ T{ char-elt } editor-prev ] }
-    { "Next character" T{ key-down f f "RIGHT" } [ T{ char-elt } editor-next ] }
-    { "Previous line" T{ key-down f f "UP" } [ T{ line-elt } editor-prev ] }
-    { "Next line" T{ key-down f f "DOWN" } [ T{ line-elt } editor-next ] }
-    { "Previous word" T{ key-down f { C+ } "LEFT" } [ T{ word-elt } editor-prev ] }
-    { "Next word" T{ key-down f { C+ } "RIGHT" } [ T{ word-elt } editor-next ] }
-    { "Start of line" T{ key-down f f "HOME" } [ T{ one-line-elt } editor-prev ] }
-    { "End of line" T{ key-down f f "END" } [ T{ one-line-elt } editor-next ] }
-    { "Start of document" T{ key-down f { C+ } "HOME" } [ editor-doc-start ] }
-    { "End of document" T{ key-down f { C+ } "END" } [ editor-doc-end ] }
-} define-commands
-    
-editor "selection" {
-    { "Extend selection" T{ button-down f { S+ } } [ editor-extend-selection ] }
-    { "Start selection" T{ drag } [ editor-mouse-drag ] }
-    { "Focus editor" T{ gain-focus } [ focus-editor ] }
-    { "Unfocus editor" T{ lose-focus } [ unfocus-editor ] }
-    { "Clear" T{ delete-action } [ remove-editor-selection ] }
-    { "Select all" T{ select-all-action } [ T{ doc-elt } select-elt ] }
-    { "Select line" T{ key-down f { C+ } "l" } [ T{ one-line-elt } select-elt ] }
-    { "Select word" f [ T{ one-word-elt } select-elt ] }
-    { "Select previous character" T{ key-down f { S+ } "LEFT" } [ T{ char-elt } editor-select-prev ] }
-    { "Select next character" T{ key-down f { S+ } "RIGHT" } [ T{ char-elt } editor-select-next ] }
-    { "Select previous line" T{ key-down f { S+ } "UP" } [ T{ line-elt } editor-select-prev ] }
-    { "Select next line" T{ key-down f { S+ } "DOWN" } [ T{ line-elt } editor-select-next ] }
-    { "Select previous line" T{ key-down f { S+ C+ } "LEFT" } [ T{ word-elt } editor-select-prev ] }
-    { "Select next line" T{ key-down f { S+ C+ } "RIGHT" } [ T{ word-elt } editor-select-next ] }
-    { "Select to start of line" T{ key-down f { S+ } "HOME" } [ T{ one-line-elt } editor-select-prev ] }
-    { "Select to end of line" T{ key-down f { S+ } "END" } [ T{ one-line-elt } editor-select-next ] }
-    { "Select start of document" T{ key-down f { S+ C+ } "HOME" } [ T{ doc-elt } editor-select-prev ] }
-    { "Select end of document" T{ key-down f { S+ C+ } "END" } [ T{ doc-elt } editor-select-next ] }
-} define-commands
diff --git a/core/ui/text/document.factor b/core/ui/text/document.factor
deleted file mode 100644 (file)
index 50d2647..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-text
-USING: arrays generic io kernel math models namespaces sequences
-strings test ;
-
-: +col ( loc n -- newloc ) >r first2 r> + 2array ;
-
-: +line ( loc n -- newloc ) >r first2 swap r> + swap 2array ;
-
-: =col ( n loc -- newloc ) first swap 2array ;
-
-: =line ( n loc -- newloc ) second 2array ;
-
-: lines-equal? ( loc1 loc2 -- n ) [ first ] 2apply number= ;
-
-TUPLE: document locs ;
-
-C: document ( -- document )
-    V{ "" } clone <model> over set-delegate
-    V{ } clone over set-document-locs ;
-
-: add-loc document-locs push ;
-
-: remove-loc document-locs delete ;
-
-: update-locs ( loc document -- )
-    document-locs [ set-model ] each-with ;
-
-: doc-line ( n document -- string ) model-value nth ;
-
-: doc-lines ( from to document -- slice )
-    >r 1+ r> model-value <slice> ;
-
-: start-on-line ( document from line# -- n1 )
-    >r dup first r> = [ nip second ] [ 2drop 0 ] if ;
-
-: end-on-line ( document to line# -- n2 )
-    over first over = [
-        drop second nip
-    ] [
-        nip swap doc-line length
-    ] if ;
-
-: each-line ( from to quot -- )
-    pick pick = [
-        3drop
-    ] [
-        >r [ first ] 2apply 1+ dup <slice> r> each
-    ] if ; inline
-
-: start/end-on-line ( from to line# -- n1 n2 )
-    tuck >r >r document get -rot start-on-line r> r>
-    document get -rot end-on-line ;
-
-: (doc-range) ( from to line# -- )
-    [ start/end-on-line ] keep document get doc-line <slice> , ;
-
-: doc-range ( from to document -- string )
-    [
-        document set 2dup [
-            >r 2dup r> (doc-range)
-        ] each-line 2drop
-    ] { } make "\n" join ;
-
-: text+loc ( lines loc -- loc )
-    over >r over length 1 = [
-        nip first2
-    ] [
-        first swap length 1- + 0
-    ] if r> peek length + 2array ;
-
-: prepend-first ( str seq -- )
-    0 swap [ append ] change-nth ;
-
-: append-last ( str seq -- )
-    [ length 1- ] keep [ swap append ] change-nth ;
-
-: loc-col/str ( loc document -- str col )
-    >r first2 swap r> nth swap ;
-
-: prepare-insert ( newinput from to lines -- newinput )
-    tuck loc-col/str tail-slice >r loc-col/str head-slice r>
-    pick append-last over prepend-first ;
-
-: (set-doc-range) ( newlines from to lines -- newlines )
-    [ prepare-insert ] 3keep
-    >r [ first ] 2apply 1+ r>
-    replace-slice ;
-
-: set-doc-range ( string from to document -- )
-    [
-        >r >r >r string-lines r> [ text+loc ] 2keep r> r>
-        [ (set-doc-range) ] change-model
-    ] keep update-locs ;
-
-: remove-doc-range ( from to document -- )
-    >r >r >r "" r> r> r> set-doc-range ;
-
-: validate-line ( line document -- line )
-    model-value length 1- min 0 max ;
-
-: validate-col ( col line document -- col )
-    doc-line length min 0 max ;
-
-: validate-loc ( loc document -- newloc )
-    >r first2 swap r> [ validate-line ] keep
-    >r tuck r> validate-col 2array ;
-
-: line-end ( line# document -- loc )
-    dupd doc-line length 2array ;
-
-: line-end? ( loc document -- ? )
-    >r first2 swap r> doc-line length = ;
-
-: doc-end ( document -- loc )
-    model-value dup length 1- swap peek length 2array ;
-
-: doc-string ( document -- str )
-    model-value "\n" join ;
-
-: set-doc-string ( string document -- )
-    >r string-lines r> [ set-model ] keep
-    dup doc-end swap update-locs ;
-
-: clear-doc ( document -- )
-    "" swap set-doc-string ;
diff --git a/core/ui/text/document.facts b/core/ui/text/document.facts
deleted file mode 100644 (file)
index 384f189..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-IN: gadgets-text
-USING: help math models strings sequences ;
-
-HELP: +col
-{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
-{ $description "Adds an integer to the column number of a line/column pair." }
-{ $see-also +line =col =line } ;
-
-HELP: +line
-{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
-{ $description "Adds an integer to the line number of a line/column pair." }
-{ $see-also +col =col =line } ;
-
-HELP: =col
-{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
-{ $description "Sets the column number of a line/column pair." }
-{ $see-also +line +col =line } ;
-
-HELP: =line
-{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
-{ $description "Sets the line number of a line/column pair." }
-{ $see-also +col +col =col } ;
-
-HELP: lines-equal?
-{ $values { "loc1" "a pair of integers" } { "loc2" "a pair of integers" } { "boolean" "a boolean" } }
-{ $description "Tests if both line/column pairs have the same line number." } ;
-
-HELP: document
-{ $class-description "A document is a " { $link model } " containing editable text, stored as an array of lines. Documents are created by calling " { $link <document> } ". Documents can be edited with " { $link editor } " gadgets." } ;
-
-HELP: doc-line
-{ $values { "n" "a non-negative integer" } { "document" document } { "string" string } }
-{ $description "Outputs the " { $snippet "n" } "th line of the document." }
-{ $errors "Throws an error if " { $snippet "n" } " is out of bounds." } ;
-
-HELP: doc-lines
-{ $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "document" document } { "slice" slice } }
-{ $description "Outputs a range of lines from the document." }
-{ $notes "The range is created by calling " { $link <slice> } "." }
-{ $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" "a quotation with stack effect " { $snippet "( string -- )" } } }
-{ $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." } ;
-
-HELP: doc-range
-{ $values { "from" "a pair of integers" } { "to" "a pair of integers" } { "document" document } { "string" "a new " { $link string } } }
-{ $description "Outputs all text in between two line/column number pairs. Lines are separated by " { $snippet "\\n" } "." }
-{ $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." } ;
-
-HELP: set-doc-range
-{ $values { "string" string } { "from" "a pair of integers" } { "to" "a pair of integers" } { "document" document } }
-{ $description "Replaces all text between two line/column number pairs with " { $snippet "string" } ". The string may use either " { $snippet "\\n" } ", " { $snippet "\\r\\n" } " or " { $snippet "\\r" } " line separators." }
-{ $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." }
-{ $side-effects "document" } ;
-
-HELP: remove-doc-range
-{ $values { "from" "a pair of integers" } { "to" "a pair of integers" } { "document" document } }
-{ $description "Removes all text between two line/column number pairs." }
-{ $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." }
-{ $side-effects "document" } ;
-
-HELP: validate-loc
-{ $values { "loc" "a pair of integers" } { "document" document } { "newloc" "a pair of integers" } }
-{ $description "Ensures that the line and column numbers in " { $snippet "loc" } " are valid, clamping them to the permitted range if they are not." } ;
-
-HELP: line-end
-{ $values { "line#" "a non-negative integer" } { "document" document } { "loc" "a pair of integers" } }
-{ $description "Outputs the location where " { $snippet "line#" } " ends." }
-{ $errors "Throws an error if " { $snippet "line#" } " is out of bounds." } ;
-
-HELP: doc-end
-{ $values { "document" document } { "loc" "a pair of integers" } }
-{ $description "Outputs the location of the end of the document." } ;
-
-HELP: doc-string
-{ $values { "document" document } { "string" "a new " { $link string } } }
-{ $description "Outputs the contents of the document as a string. Lines are separated by " { $snippet "\\n" } "." } ;
-
-HELP: set-doc-string
-{ $values { "array" "an array of strings" } { "document" document } }
-{ $description "Sets the contents of the document to a string,  which may use either " { $snippet "\\n" } ", " { $snippet "\\r\\n" } " or " { $snippet "\\r" } " line separators." }
-{ $side-effects "document" } ;
-
-HELP: clear-doc
-{ $values { "document" document } }
-{ $description "Removes all text from the document." }
-{ $side-effects "document" } ;
diff --git a/core/ui/text/editor.factor b/core/ui/text/editor.factor
deleted file mode 100644 (file)
index 95afb6f..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-text
-USING: arrays errors freetype gadgets gadgets-borders
-gadgets-buttons gadgets-labels gadgets-scrolling gadgets-theme
-io kernel math models namespaces opengl sequences strings styles ;
-
-TUPLE: editor
-font color caret-color selection-color
-caret mark
-focused? ;
-
-TUPLE: loc-monitor editor ;
-
-: <loc> ( editor -- loc )
-    <loc-monitor> { 0 0 } <model> [ add-connection ] keep ;
-
-: init-editor-locs ( editor -- )
-    dup <loc> over set-editor-caret
-    dup <loc> swap set-editor-mark ;
-
-C: editor ( -- editor )
-    dup <document> <gadget> delegate>control
-    dup init-editor-locs
-    dup editor-theme ;
-
-: activate-editor-model ( editor model -- )
-    dup activate-model swap control-model add-loc ;
-
-: deactivate-editor-model ( editor model -- )
-    dup deactivate-model swap control-model remove-loc ;
-
-M: editor graft*
-    dup dup editor-caret activate-editor-model
-    dup dup editor-mark activate-editor-model
-    dup control-self swap control-model add-connection ;
-
-M: editor ungraft*
-    dup dup editor-caret deactivate-editor-model
-    dup dup editor-mark deactivate-editor-model
-    dup control-self swap control-model remove-connection ;
-
-M: editor model-changed
-    control-self dup control-model
-    over editor-caret [ over validate-loc ] (change-model)
-    over editor-mark [ over validate-loc ] (change-model)
-    drop relayout ;
-
-: editor-caret* ( editor -- loc ) editor-caret model-value ;
-
-: editor-mark* ( editor -- loc ) editor-mark model-value ;
-
-: change-caret ( editor quot -- )
-    over >r >r dup editor-caret* swap control-model r> call r>
-    [ control-model validate-loc ] keep
-    editor-caret set-model ; inline
-
-: mark>caret ( editor -- )
-    dup editor-caret* swap editor-mark set-model ;
-
-: change-caret&mark ( editor quot -- )
-    over >r change-caret r> mark>caret ; inline
-
-: editor-line ( n editor -- str ) control-value nth ;
-
-: editor-font* ( editor -- font ) editor-font open-font ;
-
-: line-height ( editor -- n )
-    editor-font* font-height ;
-
-: run-char-widths ( string editor -- widths )
-    editor-font* swap >array [ char-width ] map-with
-    dup 0 [ + ] accumulate nip swap 2 v/n v+ ;
-
-: x>offset ( x line# editor -- col# )
-    [ editor-line ] keep
-    over >r run-char-widths [ <= ] find-with drop dup -1 =
-    [ drop r> length ] [ r> drop ] if ;
-
-: y>line ( y editor -- line# )
-    [ line-height / >fixnum ] keep control-model validate-line ;
-
-: point>loc ( point editor -- loc )
-    over second over y>line [
-        >r >r first r> r> swap x>offset
-    ] keep swap 2array ;
-
-: click-loc ( editor model -- )
-    >r [ hand-rel ] keep point>loc r> set-model ;
-
-: focus-editor ( editor -- )
-    t over set-editor-focused? relayout-1 ;
-
-: unfocus-editor ( editor -- )
-    f over set-editor-focused? relayout-1 ;
-
-: (offset>x) ( font col# str -- x )
-    swap head-slice string-width ;
-
-: offset>x ( col# line# editor -- x )
-    [ editor-line ] keep editor-font* -rot (offset>x) ;
-
-: loc>x ( loc editor -- x ) >r first2 swap r> offset>x ;
-
-: line>y ( lines# editor -- y )
-    line-height * ;
-
-: caret-loc ( editor -- loc )
-    [ editor-caret* ] keep 2dup loc>x
-    rot first rot line>y 2array ;
-
-: caret-dim ( editor -- dim )
-    line-height 0 swap 2array ;
-
-: scroll>caret ( editor -- )
-    dup gadget-grafted? [
-        dup caret-loc over caret-dim { 1 0 } v+ <rect>
-        over scroll>rect
-    ] when drop ;
-
-M: loc-monitor model-changed
-    loc-monitor-editor control-self
-    dup relayout-1 scroll>caret ;
-
-: draw-caret ( -- )
-    editor get editor-focused? [
-        editor get
-        dup editor-caret-color gl-color
-        dup caret-loc origin get v+
-        swap caret-dim over v+ gl-line
-    ] when ;
-
-: line-translation ( n -- loc )
-    editor get line-height * 0.0 swap 2array ;
-
-: translate-lines ( n -- )
-    line-translation gl-translate ;
-
-: draw-line ( editor str -- )
-    >r editor-font r> { 0 0 } draw-string ;
-
-: first-visible-line ( editor -- n )
-    clip get rect-loc second origin get second -
-    swap y>line ;
-
-: last-visible-line ( editor -- n )
-    clip get rect-extent nip second origin get second -
-    swap y>line 1+ ;
-
-: with-editor ( editor quot -- )
-    [
-        swap
-        dup first-visible-line \ first-visible-line set
-        dup last-visible-line \ last-visible-line set
-        dup control-model document set
-        editor set
-        call
-    ] with-scope ; inline
-
-: visible-lines ( editor -- seq )
-    \ first-visible-line get
-    \ last-visible-line get
-    rot control-value <slice> ;
-
-: with-editor-translation ( n quot -- )
-    >r line-translation origin get v+ r> with-translation ;
-    inline
-
-: draw-lines ( -- )
-    \ first-visible-line get [
-        editor get dup editor-color gl-color
-        dup visible-lines
-        [ draw-line 1 translate-lines ] each-with
-    ] with-editor-translation ;
-
-: selection-start/end ( editor -- start end )
-    dup editor-mark* swap editor-caret*
-    2dup <=> 0 > [ swap ] when ;
-
-: (draw-selection) ( x1 x2 -- )
-    2dup = [ 2 + ] when
-    0.0 swap editor get line-height glRectd ;
-
-: draw-selected-line ( start end n -- )
-    [ start/end-on-line ] keep tuck
-    >r >r editor get offset>x r> r>
-    editor get offset>x
-    (draw-selection) ;
-
-: draw-selection ( -- )
-    editor get editor-selection-color gl-color
-    editor get selection-start/end
-    over first [
-        2dup [
-            >r 2dup r> draw-selected-line
-            1 translate-lines
-        ] each-line 2drop
-    ] with-editor-translation ;
-
-M: editor draw-gadget*
-    [ draw-selection draw-lines draw-caret ] with-editor ;
-
-M: editor pref-dim*
-    dup editor-font* swap control-value text-dim ;
-
-M: editor gadget-selection?
-    selection-start/end = not ;
-
-M: editor gadget-selection
-    [ selection-start/end ] keep control-model doc-range ;
-
-: remove-editor-selection ( editor -- )
-    [ selection-start/end ] keep control-model
-    remove-doc-range ;
-
-M: editor user-input*
-    [ selection-start/end ] keep control-model set-doc-range t ;
-
-: editor-string ( editor -- string )
-    control-model doc-string ;
-
-: set-editor-string ( string editor -- )
-    control-model set-doc-string ;
-
-! Editors support the stream output protocol
-M: editor stream-write1 >r ch>string r> stream-write ;
-
-M: editor stream-write control-self user-input ;
-
-M: editor stream-close drop ;
diff --git a/core/ui/text/editor.facts b/core/ui/text/editor.facts
deleted file mode 100644 (file)
index ac00d3f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-IN: gadgets-text
-USING: help gadgets gadgets-scrolling models strings ;
-
-HELP: editor
-{ $class-description "An editor is a " { $link control } " for editing a multi-line passage of text stored in a " { $link document } " model. Editors are crated by calling " { $link <editor> } "."
-$terpri
-"The " { $link interactor } " gadget is built off the " { $link editor } " gadget and is used by the " { $link "ui-listener" } "." }
-"Editors have the following slots:"
-{ $list
-    { { $link editor-font } " - a font specifier." }
-    { { $link editor-color } " - text color specifier." }
-    { { $link editor-caret-color } " - caret color specifier." }
-    { { $link editor-selection-color } " - selection background color specifier." }
-    { { $link editor-caret } " - a model storing a line/column pair." }
-    { { $link editor-mark } " - a model storing a line/column pair. If there is no selection, the mark is equal to the caret, otherwise the mark is located at the opposite end of the selection from the caret." }
-    { { $link editor-focused? } " - a boolean." }
-} ;
-
-HELP: loc-monitor
-{ $class-description "Instances of this class are used internally by " { $link editor } " controls to redraw the editor when the caret or mark is moved by calling " { $link set-model } " on " { $link editor-caret } " or " { $link editor-mark } "." } ;
-
-HELP: <editor>
-{ $values { "editor" "a new " { $link editor } } }
-{ $description "Creates a new " { $link editor } " with an empty document." } ;
-
-HELP: editor-caret ( editor -- model )
-{ $values { "editor" editor } { "model" model } }
-{ $values "Outputs a " { $link model } " holding the current caret location." }
-{ $see-also editor-caret editor-mark editor-mark* } ;
-
-HELP: editor-caret*
-{ $values { "editor" editor } { "loc" "a pair of integers" } }
-{ $values "Outputs the current caret location as a line/column number pair." }
-{ $see-also editor-caret editor-mark editor-mark* } ;
-
-HELP: editor-mark ( editor -- model )
-{ $values { "editor" editor } { "model" model } }
-{ $values "Outputs a " { $link model } " holding the current mark location." }
-{ $see-also editor-mark editor-mark editor-mark* } ;
-
-HELP: editor-mark*
-{ $values { "editor" editor } { "loc" "a pair of integers" } }
-{ $values "Outputs the current mark location as a line/column number pair." }
-{ $see-also editor-mark editor-mark editor-mark* } ;
-
-HELP: change-caret
-{ $values { "editor" editor } { "quot" "a quotation with stack effect " { $snippet "( loc -- newloc )" } } }
-{ $description "Applies a quotation to the current caret location and moves the caret to the location output by the quotation." }
-{ $see-also mark>caret change-caret&mark } ;
-
-HELP: mark>caret
-{ $values { "editor" editor } }
-{ $description "Moves the mark to the caret location, effectively deselecting any selected text." }
-{ $see-also editor-caret editor-mark change-caret change-caret&mark } ;
-
-HELP: change-caret&mark
-{ $values { "editor" editor } { "quot" "a quotation with stack effect " { $snippet "( loc -- newloc )" } } }
-{ $description "Applies a quotation to the current caret location and moves the caret and the mark to the location output by the quotation." }
-{ $see-also mark>caret change-caret } ;
-
-HELP: run-char-widths
-{ $values { "string" string } { "editor" editor } { "widths" "a sequence of integers" } }
-{ $description "Outputs a sequence of x co-ordinates of the midpoint of each character in the string." }
-{ $notes "This word is used to convert x offsets to document locations, for example when the user moves the caret by clicking the mouse." } ;
-
-HELP: point>loc
-{ $values { "point" "a pair of integers" } { "editor" editor } { "loc" "a pair of integers" } }
-{ $description "Converts a point to a line/column number pair." } ;
-
-HELP: scroll>caret
-{ $values { "editor" editor } }
-{ $description "Ensures that the caret becomes visible in a " { $link scroller } " containing the editor. Does nothing if no parent of " { $snippet "gadget" } " is a " { $link scroller } "." } ;
-
-HELP: remove-editor-selection
-{ $values { "editor" editor } }
-{ $description "Removes currently selected text from the editor's " { $link document } "." } ;
-
-HELP: editor-string
-{ $values { "editor" editor } { "string" string } }
-{ $description "Outputs the contents of the editor's " { $link document } " as a string. Lines are separated by " { $snippet "\\n" } "." } ;
-
-HELP: set-editor-string
-{ $values { "array" "an array of strings" } { "editor" editor } }
-{ $description "Sets the contents of the editor's " { $link document } " to a string,  which may use either " { $snippet "\\n" } ", " { $snippet "\\r\\n" } " or " { $snippet "\\r" } " line separators." } ;
diff --git a/core/ui/text/elements.factor b/core/ui/text/elements.factor
deleted file mode 100644 (file)
index 376149d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-IN: gadgets-text
-USING: arrays kernel math sequences strings models ;
-
-GENERIC: prev-elt ( loc document elt -- newloc )
-GENERIC: next-elt ( loc document elt -- newloc )
-
-TUPLE: char-elt ;
-
-: (prev-char) ( loc document quot -- loc )
-    -rot {
-        { [ over { 0 0 } = ] [ drop ] }
-        { [ over second zero? ] [ >r first 1- r> line-end ] }
-        { [ t ] [ pick call ] }
-    } cond nip ; inline
-
-: (next-char) ( loc document quot -- loc )
-    -rot {
-        { [ 2dup doc-end = ] [ drop ] }
-        { [ 2dup line-end? ] [ drop first 1+ 0 2array ] }
-        { [ t ] [ pick call ] }
-    } cond nip ; inline
-
-M: char-elt prev-elt
-    drop [ drop -1 +col ] (prev-char) ;
-
-M: char-elt next-elt
-    drop [ drop 1 +col ] (next-char) ;
-
-: (word-elt) ( loc document quot -- loc )
-    pick >r
-    >r >r first2 swap r> doc-line r> call
-    r> =col ; inline
-
-: ((word-elt)) [ ?nth blank? ] 2keep ;
-
-: (prev-word) ( ? col str -- col )
-    [ blank? xor ] find-last-with* drop 1+ ;
-
-: (next-word) ( ? col str -- col )
-    [ [ blank? xor ] find-with* drop ] keep
-    over -1 = [ nip length ] [ drop ] if ;
-
-TUPLE: one-word-elt ;
-
-M: one-word-elt prev-elt
-    drop
-    [ [ f -rot >r 1- r> (prev-word) ] (word-elt) ] (prev-char) ;
-
-M: one-word-elt next-elt
-    drop
-    [ [ f -rot (next-word) ] (word-elt) ] (next-char) ;
-
-TUPLE: word-elt ;
-
-M: word-elt prev-elt
-    drop
-    [ [ >r 1- r> ((word-elt)) (prev-word) ] (word-elt) ]
-    (prev-char) ;
-
-M: word-elt next-elt
-    drop
-    [ [ ((word-elt)) (next-word) ] (word-elt) ]
-    (next-char) ;
-
-TUPLE: one-line-elt ;
-
-M: one-line-elt prev-elt
-    2drop first 0 2array ;
-
-M: one-line-elt next-elt
-    drop >r first dup r> doc-line length 2array ;
-
-TUPLE: line-elt ;
-
-M: line-elt prev-elt 2drop -1 +line ;
-
-M: line-elt next-elt 2drop 1 +line ;
-
-TUPLE: doc-elt ;
-
-M: doc-elt prev-elt 3drop { 0 0 } ;
-
-M: doc-elt next-elt drop nip doc-end ;
diff --git a/core/ui/text/elements.facts b/core/ui/text/elements.facts
deleted file mode 100644 (file)
index 66c3fe2..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-IN: gadgets-text
-USING: help ;
-
-HELP: prev-elt
-{ $values { "loc" "a pair of integers" } { "document" document } { "elt" "an element" } { "newloc" "a pair of integers" } }
-{ $contract "Outputs the location of the first occurrence of the element prior to " { $snippet "loc" } "." }
-{ $see-also next-elt } ;
-
-HELP: next-elt
-{ $values { "loc" "a pair of integers" } { "document" document } { "elt" "an element" } { "newloc" "a pair of integers" } }
-{ $contract "Outputs the location of the first occurrence of the element following " { $snippet "loc" } "." }
-{ $see-also prev-elt } ;
-
-HELP: char-elt
-{ $class-description "An element representing a single character." } ;
-
-HELP: one-word-elt
-{ $class-description "An element representing a single word. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the beginning and the end of the word at the current location." }
-{ $see-also word-elt } ;
-
-HELP: word-elt
-{ $class-description "An element representing a single word. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the previous and next word from the current location." }
-{ $see-also one-word-elt } ;
-
-HELP: one-line-elt
-{ $class-description "An element representing a single line. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the beginning and the end of the line at the current location." }
-{ $see-also line-elt } ;
-
-HELP: line-elt
-{ $class-description "An element representing a single line. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the previous and next line from the current location." }
-{ $see-also one-line-elt } ;
-
-HELP: doc-elt
-{ $class-description "An element representing the entire document. The " { $link prev-elt } " word outputs the start of the document and the " { $link next-elt } " word outputs the end of the document." } ;
diff --git a/core/ui/text/interactor.factor b/core/ui/text/interactor.factor
deleted file mode 100644 (file)
index bd3393c..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-text
-USING: arrays definitions gadgets gadgets-panes
-generic hashtables help io kernel namespaces prettyprint styles
-threads sequences vectors definitions parser words strings
-math listener models errors ;
-
-TUPLE: interactor
-history output
-continuation quot busy?
-use in error-hook ;
-
-C: interactor ( output -- gadget )
-    [ set-interactor-output ] keep
-    <editor> over set-gadget-delegate
-    V{ } clone over set-interactor-history
-    dup dup set-control-self ;
-
-M: interactor graft*
-    f over set-interactor-busy? delegate graft* ;
-
-: write-input ( string input -- )
-    <input> presented associate
-    [ H{ { font-style bold } } format ] with-nesting ;
-
-: interactor-input. ( string interactor -- )
-    interactor-output [
-        dup string? [ dup write-input terpri ] [ short. ] if
-    ] with-stream* ;
-
-: add-interactor-history ( str interactor -- )
-    over empty? [ 2drop ] [ interactor-history push-new ] if ;
-
-: interactor-continue ( obj interactor -- )
-    t over set-interactor-busy?
-    interactor-continuation schedule-thread-with ;
-
-: interactor-finish ( obj interactor -- )
-    [ editor-string ] keep
-    [ interactor-input. ] 2keep
-    [ add-interactor-history ] keep
-    dup control-model clear-doc
-    interactor-continue ;
-
-: interactor-eval ( interactor -- )
-    [
-        [ editor-string ] keep dup interactor-quot call
-    ] in-thread drop ;
-
-: interactor-eof ( interactor -- )
-    f swap interactor-continuation schedule-thread-with ;
-
-: interactor-commit ( interactor -- )
-    dup interactor-busy? [ drop ] [ interactor-eval ] if ;
-
-: interactor-yield ( interactor quot -- )
-    over set-interactor-quot
-    f over set-interactor-busy?
-    [ swap set-interactor-continuation stop ] callcc1 nip ;
-
-M: interactor stream-readln
-    [
-        interactor-finish
-    ] interactor-yield ;
-
-: interactor-call ( quot interactor -- )
-    2dup interactor-input. interactor-continue ;
-
-M: interactor stream-read
-    swap dup zero?
-    [ 2drop "" ] [ >r stream-readln r> head ] if ;
-
-: save-in/use ( interactor -- )
-    use get over set-interactor-use
-    in get over set-interactor-in
-    error-hook get swap set-interactor-error-hook ;
-
-: restore-in/use ( interactor -- )
-    dup interactor-use use set
-    dup interactor-in in set
-    interactor-error-hook error-hook set ;
-
-: go-to-error ( interactor error -- )
-    dup parse-error-line 1- swap parse-error-col 2array
-    over editor-caret set-model mark>caret ;
-
-: handle-parse-error ( interactor error -- )
-    dup parse-error? [ 2dup go-to-error delegate ] when
-    swap interactor-error-hook call ;
-
-: try-parse ( str interactor -- quot/error/f )
-    [
-        [
-            [
-                restore-in/use
-                1array \ parse with-datastack dup length 1 =
-                [ first ] [ drop f ] if
-            ] keep save-in/use
-        ] [
-            2nip
-        ] recover
-    ] with-scope ;
-
-: handle-interactive ( str/f interactor -- )
-    tuck try-parse {
-        { [ dup quotation? ] [ swap interactor-finish ] }
-        { [ dup not ] [ drop "\n" swap user-input ] }
-        { [ t ] [ handle-parse-error ] }
-    } cond ;
-
-M: interactor parse-interactive
-    [ save-in/use ] keep
-    [ [ handle-interactive ] interactor-yield ] keep
-    restore-in/use ;
-
-interactor "interactor" {
-    { "Evaluate" T{ key-down f f "RETURN" } [ interactor-commit ] }
-    { "Clear input" T{ key-down f { C+ } "k" } [ control-model clear-doc ] }
-} define-commands
diff --git a/core/ui/text/interactor.facts b/core/ui/text/interactor.facts
deleted file mode 100644 (file)
index d58fcd5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-IN: gadgets-text
-USING: gadgets listener io help ;
-
-HELP: interactor
-{ $class-description "An interactor is an " { $link editor } " intended to be used as the input component of a " { $link "ui-listener" } "."
-$terpri
-"Interactors are created by calling " { $link <interactor> } "."
-$terpri
-"Interactors implement the " { $link stream-readln } ", " { $link stream-read } " and " { $link parse-interactive } " generic words." } ;
diff --git a/core/ui/timers.factor b/core/ui/timers.factor
deleted file mode 100644 (file)
index 5201efc..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: timers
-USING: hashtables kernel math namespaces sequences ;
-
-TUPLE: timer object delay next ;
-
-C: timer ( object delay initial -- timer )
-    [ >r millis + r> set-timer-next ] keep
-    [ set-timer-delay ] keep
-    [ set-timer-object ] keep ;
-
-GENERIC: tick ( object -- )
-
-: timers \ timers get-global ;
-
-: init-timers ( -- ) H{ } clone \ timers set-global ;
-
-: add-timer ( object delay initial -- )
-    pick >r <timer> r> timers set-hash ;
-
-: remove-timer ( object -- ) timers remove-hash ;
-
-: advance-timer ( ms timer -- )
-    [ timer-delay + ] keep set-timer-next ;
-
-: do-timer ( ms timer -- )
-    dup timer-next pick <=
-    [ [ advance-timer ] keep timer-object tick ] [ 2drop ] if ;
-
-: do-timers ( -- )
-    millis timers hash-values [ do-timer ] each-with ;
diff --git a/core/ui/timers.facts b/core/ui/timers.facts
deleted file mode 100644 (file)
index 643e6f2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-IN: timers
-USING: generic help ;
-
-HELP: tick
-{ $values { "object" object } }
-{ $description "Called to notify an object registered with a timer that the timer has fired." }
-{ $see-also add-timer remove-timer do-timers } ;
-
-HELP: add-timer
-{ $values { "object" object } { "delay" "a positive integer" } { "initial" "a positive integer" } }
-{ $description "Registers a timer. Every " { $snippet "delay" } " milliseconds, " { $link tick } " will be called on the object. The initial delay from the time " { $link add-timer } " is called to when " { $link tick } " is first called is " { $snippet "initial" } " milliseconds." }
-{ $see-also remove-timer do-timers } ;
-
-HELP: remove-timer
-{ $values { "object" object } }
-{ $description "Unregisters a timer." }
-{ $see-also add-timer do-timers } ;
-
-HELP: do-timers
-{ $description "Fires all registered timers which are due to fire." }
-{ $notes "This word is automatically called from the UI event loop, however it should be called manually if timers are being used outside of the UI." }
-{ $see-also tick add-timer remove-timer } ;
diff --git a/core/ui/tools/browser.factor b/core/ui/tools/browser.factor
deleted file mode 100644 (file)
index 62c2e8b..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays sequences kernel gadgets-panes definitions
-prettyprint gadgets-theme gadgets-borders gadgets
-generic gadgets-scrolling math io words models styles
-namespaces gadgets-tracks gadgets-presentations
-gadgets-workspace help gadgets-buttons tools ;
-IN: gadgets-browser
-
-TUPLE: browser definitions ;
-
-TUPLE: definitions showing ;
-
-: find-definitions ( gadget -- definitions )
-    [ definitions? ] find-parent ;
-
-: definition-index ( definition definitions -- n )
-    definitions-showing index ;
-
-: close-definition ( gadget definition -- )
-    over find-definitions definitions-showing delete
-    unparent ;
-
-: close-definitions ( definitions -- )
-    dup clear-gadget definitions-showing delete-all ;
-
-C: definitions ( -- gadget )
-    <pile> over set-delegate
-    { 2 2 } over set-pack-gap
-    V{ } clone over set-definitions-showing ;
-
-TUPLE: tile definition gadget ;
-
-: find-tile [ tile? ] find-parent ;
-
-: close-tile ( tile -- )
-    dup tile-definition over find-definitions
-    definitions-showing delete
-    unparent ;
-
-: <tile-content> ( definition -- gadget )
-    [ [ see ] make-pane <default-border> ] keep
-    unparse [ find-tile close-tile ] <closable-gadget>
-    dup faint-boundary ;
-
-C: tile ( definition -- gadget )
-    over <tile-content> over set-gadget-delegate
-    [ set-tile-definition ] keep ;
-
-: show-definition ( definition definitions -- )
-    2dup definition-index dup 0 >= [
-        over nth-gadget swap scroll>rect drop
-    ] [
-        drop 2dup definitions-showing push
-        swap <tile> over add-gadget
-        scroll>bottom
-    ] if ;
-
-C: browser ( -- gadget )
-    {
-        {
-            [ <definitions> ]
-            set-browser-definitions
-            [ <scroller> ]
-            @center
-        }
-    } make-frame* ;
-
-: clear-browser ( browser -- )
-    browser-definitions close-definitions ;
-
-browser "toolbar" {
-    { "Clear" T{ key-down f f "CLEAR" } [ clear-browser ] }
-} define-commands
-
-M: browser call-tool*
-    browser-definitions show-definition ;
-
-M: browser tool-scroller browser-definitions find-scroller ;
-
-M: browser tool-help drop "ui-browser" ;
diff --git a/core/ui/tools/dataflow.factor b/core/ui/tools/dataflow.factor
deleted file mode 100644 (file)
index 222197e..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-dataflow
-USING: namespaces arrays sequences io inference math kernel
-generic prettyprint words gadgets opengl gadgets-panes
-gadgets-labels gadgets-theme gadgets-presentations
-gadgets-buttons gadgets-borders gadgets-scrolling
-gadgets-workspace optimizer models help ;
-
-GENERIC: node>gadget* ( height node -- gadget )
-
-GENERIC: node-presents ( node -- object )
-
-! Representation of shuffle nodes
-TUPLE: shuffle-gadget value ;
-
-: literal-theme ( shuffle -- )
-    T{ solid f { 0.6 0.6 0.6 1.0 } } swap set-gadget-boundary ;
-
-: word-theme ( shuffle -- )
-    T{ solid f { 1.0 0.6 0.6 1.0 } } swap set-gadget-boundary ;
-
-C: shuffle-gadget ( node -- gadget )
-    [ set-shuffle-gadget-value ] keep
-    dup delegate>gadget ;
-
-: shuffled-offsets ( shuffle -- seq )
-    dup effect-in swap effect-out [ swap index ] map-with ;
-
-: shuffled-endpoints ( w h seq seq -- seq )
-    [ [ 30 * 15 + ] map ] 2apply
-    >r over r> [ - ] map-with >r [ - ] map-with r>
-    [ 0 swap 2array ] map >r [ 2array ] map-with r>
-    [ 2array ] 2map ;
-
-: draw-shuffle ( gadget seq seq -- )
-    origin get [
-        >r >r rect-dim first2 r> r> shuffled-endpoints
-        [ first2 gl-line ] each
-    ] with-translation ;
-
-M: shuffle-gadget draw-gadget*
-    { 0 0 0 1 } gl-color
-    dup shuffle-gadget-value
-    shuffled-offsets [ length ] keep
-    draw-shuffle ;
-
-: node-dim ( n -- dim ) 30 * 10 swap 2array ;
-
-: shuffle-dim ( shuffle -- dim )
-    dup effect-in length swap effect-out length max
-    node-dim ;
-
-M: shuffle-gadget pref-dim*
-    shuffle-gadget-value shuffle-dim ;
-
-M: #shuffle node>gadget* nip node-shuffle <shuffle-gadget> ;
-
-M: #shuffle node-presents drop f ;
-
-! Stack height underneath a node
-TUPLE: height-gadget value ;
-
-C: height-gadget ( value -- gadget )
-    [ set-height-gadget-value ] keep
-    dup delegate>gadget ;
-
-M: height-gadget pref-dim*
-    height-gadget-value node-dim ;
-
-M: height-gadget draw-gadget*
-    { 0 0 0 1 } gl-color
-    dup height-gadget-value dup draw-shuffle ;
-
-! Calls and pushes
-TUPLE: node-gadget value height ;
-
-C: node-gadget ( gadget node height -- gadget )
-    [ set-node-gadget-height ] keep
-    [ set-node-gadget-value ] keep
-    swap <default-border> over set-gadget-delegate ;
-
-M: node-gadget pref-dim*
-    dup delegate pref-dim
-    swap dup node-gadget-height [
-        node-dim
-    ] [
-        node-gadget-value node-shuffle shuffle-dim
-    ] ?if vmax ;
-
-M: #call node>gadget*
-    nip
-    [ node-param word-name <label> ] keep
-    f <node-gadget> dup word-theme ;
-
-M: #call node-presents node-param ;
-
-M: #push node>gadget*
-    nip [
-        >#push< [ literalize unparse ] map " " join <label>
-    ] keep f <node-gadget> dup literal-theme ;
-
-M: #push node-presents >#push< first ;
-
-! #if #dispatch #label etc
-: <child-nodes> ( seq -- seq )
-    [ length ] keep
-    [
-        >r number>string "Child " swap append <label> r>
-        <presentation>
-    ] 2map ;
-
-: default-node-content ( node -- gadget )
-    dup node-children <child-nodes>
-    swap class word-name <label> add* make-pile
-    { 5 5 } over set-pack-gap ;
-
-M: object node>gadget*
-    nip dup default-node-content swap f <node-gadget> ;
-
-M: object node-presents
-    class <link> ;
-
-UNION: full-height-node #if #dispatch #label #merge #return
-#values #entry ;
-
-M: full-height-node node>gadget*
-    dup default-node-content swap rot <node-gadget> ;
-
-! Constructing the graphical representation; first we compute
-! stack heights
-SYMBOL: d-height
-
-DEFER: (compute-heights)
-
-: compute-child-heights ( node -- )
-    node-children dup empty? [
-        drop
-    ] [
-        [
-            [ (compute-heights) d-height get ] { } make drop
-        ] map supremum d-height set
-    ] if ;
-
-: (compute-heights) ( node -- )
-    [
-        d-height get over 2array ,
-        dup node-out-d length over node-in-d length -
-        d-height [ + ] change
-        dup compute-child-heights
-        node-successor (compute-heights)
-    ] when* ;
-
-: normalize-height ( seq -- seq )
-    [
-        [ dup first swap second node-in-d length - ] map infimum
-    ] keep
-    [ first2 >r swap - r> 2array ] map-with ;
-
-: compute-heights ( nodes -- pairs )
-    [ 0 d-height set (compute-heights) ] { } make
-    normalize-height ;
-
-! Then we create gadgets for every node
-: node>gadget ( height node -- gadget )
-    [ node>gadget* ] keep node-presents
-    [ <presentation> dup faint-boundary ] when* ;
-
-: print-node ( d-height node -- )
-    dup full-height-node? [
-        node>gadget
-    ] [
-        [ node-in-d length - <height-gadget> ] 2keep
-        node>gadget swap 2array
-        make-filled-pile
-    ] if , ;
-
-: <dataflow-graph> ( node -- gadget )
-    compute-heights [
-        dup empty? [ dup first first <height-gadget> , ] unless
-        [ first2 print-node ] each
-    ] { } make
-    make-shelf 1 over set-pack-align ;
-
-! The UI tool
-TUPLE: dataflow-gadget history ;
-
-dataflow-gadget "toolbar" {
-    { "Back" T{ key-down f { C+ } "b" } [ dataflow-gadget-history go-back ] }
-    { "Forward" T{ key-down f { C+ } "f" } [ dataflow-gadget-history go-forward ] }
-} define-commands
-
-: <dataflow-pane> ( history -- gadget )
-    gadget get dataflow-gadget-history
-    [ <dataflow-graph> gadget. ]
-    <pane-control> ;
-
-C: dataflow-gadget ( -- gadget )
-    f <history> over set-dataflow-gadget-history {
-        { [ <dataflow-pane> ] f [ <scroller> ] @center }
-    } make-frame* ;
-
-M: dataflow-gadget call-tool* ( node dataflow -- )
-    dup dataflow-gadget-history add-history
-    dataflow-gadget-history set-model ;
-
-M: dataflow-gadget tool-help drop "ui-dataflow" ;
-
-IN: tools
-
-: show-dataflow ( quot -- )
-    dataflow optimize dataflow-gadget call-tool ;
diff --git a/core/ui/tools/help.factor b/core/ui/tools/help.factor
deleted file mode 100644 (file)
index b209e86..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-help
-USING: gadgets gadgets-borders gadgets-buttons
-gadgets-panes gadgets-scrolling help kernel
-models namespaces sequences gadgets-tracks gadgets-workspace ;
-
-TUPLE: help-gadget pane history ;
-
-: show-help ( link help -- )
-    dup help-gadget-history add-history
-    >r >link r> help-gadget-history set-model ;
-
-: go-home ( help -- ) "handbook" swap show-help ;
-
-: <help-pane> ( history -- gadget )
-    gadget get help-gadget-history [ help ] <pane-control> ;
-
-: init-history ( help-gadget -- )
-    "handbook" <history>
-    swap set-help-gadget-history ;
-
-C: help-gadget ( -- gadget )
-    dup init-history {
-        {
-            [ <help-pane> ]
-            set-help-gadget-pane
-            [ <scroller> ]
-            @center
-        }
-    } make-frame* ;
-
-M: help-gadget call-tool* show-help ;
-
-M: help-gadget tool-scroller help-gadget-pane find-scroller ;
-
-M: help-gadget tool-help drop "ui-help" ;
-
-: help-action ( help-gadget -- link )
-    help-gadget-history model-value >link ;
diff --git a/core/ui/tools/listener.factor b/core/ui/tools/listener.factor
deleted file mode 100644 (file)
index ab32aaa..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-listener
-USING: arrays compiler gadgets gadgets-labels
-gadgets-panes gadgets-scrolling gadgets-text
-gadgets-theme gadgets-tracks gadgets-workspace
-generic hashtables tools io kernel listener math models
-namespaces parser prettyprint sequences shells strings styles
-threads words definitions help errors ;
-
-TUPLE: listener-gadget input output stack ;
-
-: ui-listener-hook ( listener -- )
-    >r datastack r> listener-gadget-stack set-model ;
-
-: ui-error-hook ( error listener -- )
-    find-workspace dup workspace-error-hook call ;
-
-: listener-stream ( listener -- stream )
-    dup listener-gadget-input
-    swap listener-gadget-output <pane-stream>
-    <duplex-stream> ;
-
-: <listener-input> ( -- gadget )
-    gadget get listener-gadget-output
-    <pane-stream> <interactor> ;
-
-: <stack-display> ( -- gadget )
-    gadget get listener-gadget-stack
-    [ stack. ] "Stack" <labelled-pane> ;
-
-: init-listener ( listener -- )
-    f <model> swap set-listener-gadget-stack ;
-
-: welcome. ( -- )
-    "If this is your first time with Factor, please read " print
-    "ui-tools" ($link) ", and especially " write
-    "ui-listener" ($link) "." print terpri ;
-
-: listener-thread ( listener -- )
-    dup listener-stream [
-        dup
-        [ ui-listener-hook ] curry listener-hook set
-        [ ui-error-hook ] curry error-hook set
-        find-messages batch-errors set
-        welcome.
-        tty
-    ] with-stream* ;
-
-: start-listener ( listener -- )
-    [ >r clear r> init-namespaces listener-thread ] in-thread
-    drop ;
-
-C: listener-gadget ( -- gadget )
-    dup init-listener {
-        {
-            [ <scrolling-pane> ]
-            set-listener-gadget-output
-            [ <scroller> ]
-            4/6
-        }
-        { [ <stack-display> ] f f 1/6 }
-        {
-            [ <listener-input> ]
-            set-listener-gadget-input
-            [ <scroller> "Input" <labelled-gadget> ]
-            1/6
-        }
-    } { 0 1 } make-track* ;
-
-M: listener-gadget focusable-child*
-    listener-gadget-input ;
-
-M: listener-gadget call-tool* ( input listener -- )
-    >r input-string r> listener-gadget-input set-editor-string ;
-
-M: listener-gadget tool-scroller
-    listener-gadget-output find-scroller ;
-
-M: listener-gadget tool-help
-    drop "ui-listener" ;
-
-: workspace-busy? ( workspace -- ? )
-    listener-gadget swap find-tool nip tool-gadget
-    listener-gadget-input interactor-busy? ;
-
-: get-listener ( -- listener )
-    listener-gadget
-    [ workspace-busy? not ] get-workspace*
-    show-tool tool-gadget ;
-
-: (call-listener) ( quot listener -- )
-    listener-gadget-input interactor-call ;
-
-: call-listener ( quot -- )
-    get-listener (call-listener) ;
-
-: eval-listener ( string -- )
-    get-listener
-    listener-gadget-input [ set-editor-string ] keep
-    interactor-commit ;
-
-: listener-run-files ( seq -- )
-    dup empty? [
-        drop
-    ] [
-        [ run-files recompile ] curry call-listener
-    ] if ;
-
-: listener-eof ( listener -- )
-    listener-gadget-input interactor-eof ;
-
-: clear-listener-output ( listener -- )
-    [ listener-gadget-output [ pane-clear ] curry ] keep
-    (call-listener) ;
-
-: clear-listener-stack ( listener -- )
-    [ clear ] swap (call-listener) ;
-
-listener-gadget "toolbar" {
-    { "Restart" f [ start-listener ] }
-    {
-        "Clear output"
-        T{ key-down f f "CLEAR" }
-        [ clear-listener-output ]
-    }
-    {
-        "Clear stack"
-        T{ key-down f { C+ } "CLEAR" }
-        [ clear-listener-stack ]
-    }
-    { "Send EOF" f [ listener-eof ] }
-} define-commands
-
-debugger "toolbar" {
-    { "Data stack" T{ key-down f f "s" } [ :s ] }
-    { "Retain stack" T{ key-down f f "r" } [ :r ] }
-    { "Call stack" T{ key-down f f "c" } [ :c ] }
-    { "Help" T{ key-down f f "h" } [ :help ] }
-    { "Edit" T{ key-down f f "e" } [ :edit ] }
-} [
-    first3 [ call-listener drop ] curry 3array
-] map define-commands
diff --git a/core/ui/tools/load.factor b/core/ui/tools/load.factor
deleted file mode 100644 (file)
index 95cee0e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-REQUIRES: core/ui ;
-
-PROVIDE: core/ui/tools
-{ +files+ {
-    "tools.factor"
-    "messages.factor"
-    "listener.factor"
-    "walker.factor"
-    "browser.factor"
-    "help.factor"
-    "dataflow.factor"
-    "workspace.factor"
-    "search.factor"
-    "operations.factor"
-} }
-{ +tests+ {
-    "test/listener.factor"
-    "test/workspace.factor"
-} } ;
diff --git a/core/ui/tools/messages.factor b/core/ui/tools/messages.factor
deleted file mode 100644 (file)
index a7c8e8e..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: compiler kernel gadgets-tracks gadgets-scrolling
-gadgets-workspace gadgets-panes gadgets-presentations
-gadgets-buttons inference errors io math gadgets namespaces
-generic ;
-IN: gadgets-messages
-
-TUPLE: messages counter errors errors# warnings warnings# ;
-
-M: messages batch-begins
-    0 over set-messages-errors#
-    0 over set-messages-warnings#
-    dup messages-errors pane-clear
-    messages-warnings pane-clear ;
-
-M: messages compile-begins
-    2drop ;
-
-: messages-errors+
-    dup messages-errors# 1+ swap set-messages-errors# ;
-
-: messages-warnings+
-    dup messages-warnings# 1+ swap set-messages-warnings# ;
-
-M: object inference-error-major? drop t ;
-
-M: messages compile-error
-    over inference-error-major?
-    [ dup messages-errors+ messages-errors ]
-    [ dup messages-warnings+ messages-warnings ] if
-    <pane-stream> [ error. ] with-stream ;
-
-: <messages-button> ( -- gadget )
-    "Compiler messages"
-    [ find-workspace messages select-tool ]
-    <bevel-button> ;
-
-M: messages batch-ends
-    [
-        dup messages-errors# # " compiler error(s), " %
-        messages-warnings# # " compiler warning(s)" %
-    ] "" make print
-    <messages-button> gadget. ;
-
-: <errors> ( gadget -- newgadget )
-    <scroller> "Compiler errors" <labelled-gadget> ;
-
-: <warnings> ( gadget -- newgadget )
-    <scroller> "Compiler warnings" <labelled-gadget> ;
-
-C: messages ( -- gadget )
-    {
-        { [ <pane> ] set-messages-errors [ <errors> ] 1/2 }
-        { [ <pane> ] set-messages-warnings [ <warnings> ] 1/2 }
-    } { 0 1 } make-track* dup batch-begins ;
diff --git a/core/ui/tools/operations.factor b/core/ui/tools/operations.factor
deleted file mode 100644 (file)
index 632f7af..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-workspace
-USING: definitions gadgets gadgets-browser gadgets-dataflow
-gadgets-help gadgets-listener gadgets-search gadgets-text
-gadgets-workspace hashtables help inference kernel namespaces
-parser prettyprint scratchpad sequences strings styles syntax
-test tools words generic models io modules errors ;
-
-V{ } clone operations set-global
-
-SYMBOL: +name+
-SYMBOL: +quot+
-SYMBOL: +listener+
-SYMBOL: +keyboard+
-SYMBOL: +primary+
-SYMBOL: +secondary+
-
-: (command) ( -- command )
-    +name+ get +keyboard+ get +quot+ get <command> ;
-
-C: operation ( predicate hash -- operation )
-    swap [
-        (command) over set-delegate
-        +primary+ get over set-operation-primary?
-        +secondary+ get over set-operation-secondary?
-        +listener+ get over set-operation-listener?
-    ] bind
-    [ set-operation-predicate ] keep ;
-
-M: operation invoke-command
-    [ operation-hook call ] keep
-    dup command-quot swap operation-listener?
-    [ curry call-listener ] [ call ] if ;
-
-: define-operation ( class props -- )
-    <operation> operations get push ;
-
-: modify-command ( quot command -- command )
-    clone
-    [ command-quot append ] keep
-    [ set-command-quot ] keep ;
-
-: modify-commands ( commands quot -- commands )
-    swap [ modify-command ] map-with ;
-
-: listener-operation ( hook quot operation -- operation )
-    modify-command
-    tuck set-operation-hook
-    t over set-operation-listener? ;
-
-: listener-operations ( operations hook quot -- operations )
-    rot [ >r 2dup r> listener-operation ] map 2nip ;
-
-! Objects
-[ drop t ] H{
-    { +primary+ t }
-    { +name+ "Inspect" }
-    { +quot+ [ inspect ] }
-    { +listener+ t }
-} define-operation
-
-[ drop t ] H{
-    { +name+ "Prettyprint" }
-    { +quot+ [ . ] }
-    { +listener+ t }
-} define-operation
-
-[ drop t ] H{
-    { +name+ "Push" }
-    { +quot+ [ ] }
-    { +listener+ t }
-} define-operation
-
-! Input
-[ input? ] H{
-    { +primary+ t }
-    { +secondary+ t }
-    { +name+ "Input" }
-    { +quot+ [ listener-gadget call-tool ] }
-} define-operation
-
-! Restart
-[ restart? ] H{
-    { +primary+ t }
-    { +secondary+ t }
-    { +name+ "Restart" }
-    { +quot+ [ restart ] }
-    { +listener+ t }
-} define-operation
-
-! Pathnames
-[ pathname? ] H{
-    { +primary+ t }
-    { +secondary+ t }
-    { +name+ "Edit" }
-    { +quot+ [ pathname-string edit-file ] }
-} define-operation
-
-[ pathname? ] H{
-    { +name+ "Run file" }
-    { +keyboard+ T{ key-down f { A+ } "r" } }
-    { +quot+ [ pathname-string run-file ] }
-    { +listener+ t }
-} define-operation
-
-! Words
-[ word? ] H{
-    { +primary+ t }
-    { +name+ "Browse" }
-    { +keyboard+ T{ key-down f { A+ } "b" } }
-    { +quot+ [ browser call-tool ] }
-} define-operation
-
-: word-completion-string ( word listener -- string )
-    >r dup word-name swap word-vocabulary dup vocab r>
-    listener-gadget-input interactor-use memq?
-    [ drop ] [ [ "USE: " % % " " % % ] "" make ] if ;
-
-: insert-word ( word -- )
-    get-listener [ word-completion-string ] keep
-    listener-gadget-input user-input ;
-
-[ word? ] H{
-    { +secondary+ t }
-    { +name+ "Insert" }
-    { +quot+ [ insert-word ] }
-} define-operation
-
-[ word? ] H{
-    { +name+ "Edit" }
-    { +keyboard+ T{ key-down f { A+ } "e" } }
-    { +quot+ [ edit ] }
-} define-operation
-
-[ word? ] H{
-    { +name+ "Documentation" }
-    { +keyboard+ T{ key-down f { A+ } "h" } }
-    { +quot+ [ help-gadget call-tool ] }
-} define-operation
-
-[ word? ] H{
-    { +name+ "Usage" }
-    { +keyboard+ T{ key-down f { A+ } "u" } }
-    { +quot+ [ usage. ] }
-    { +listener+ t }
-} define-operation
-
-[ word? ] H{
-    { +name+ "Reload" }
-    { +keyboard+ T{ key-down f { A+ } "r" } }
-    { +quot+ [ reload ] }
-    { +listener+ t }
-} define-operation
-
-[ word? ] H{
-    { +name+ "Watch" }
-    { +quot+ [ watch ] }
-} define-operation
-
-[ word? ] H{
-    { +name+ "Forget" }
-    { +quot+ [ forget ] }
-} define-operation
-
-[ compound? ] H{
-    { +name+ "Word stack effect" }
-    { +quot+ [ word-def infer. ] }
-    { +listener+ t }
-} define-operation
-
-[ compound? ] H{
-    { +name+ "Word dataflow" }
-    { +quot+ [ word-def show-dataflow ] }
-    { +keyboard+ T{ key-down f { A+ } "d" } }
-} define-operation
-
-! Vocabularies
-[ vocab-link? ] H{
-    { +primary+ t }
-    { +name+ "Browse" }
-    { +keyboard+ T{ key-down f { A+ } "b" } }
-    { +quot+ [ vocab-link-name get-workspace swap show-vocab-words ] }
-} define-operation
-
-[ vocab-link? ] H{
-    { +name+ "Enter in" }
-    { +keyboard+ T{ key-down f { A+ } "i" } }
-    { +quot+ [ vocab-link-name set-in ] }
-    { +listener+ t }
-} define-operation
-
-[ vocab-link? ] H{
-    { +secondary+ t }
-    { +name+ "Use" }
-    { +quot+ [ vocab-link-name use+ ] }
-    { +listener+ t }
-} define-operation
-
-[ vocab-link? ] H{
-    { +name+ "Forget" }
-    { +quot+ [ vocab-link-name forget-vocab ] }
-} define-operation
-
-! Modules
-[ module? ] H{
-    { +secondary+ t }
-    { +name+ "Run" }
-    { +quot+ [ module-name run-module ] }
-    { +listener+ t }
-} define-operation
-
-[ module? ] H{
-    { +name+ "Load" }
-    { +quot+ [ module-name require ] }
-    { +listener+ t }
-} define-operation
-
-[ module? ] H{
-    { +name+ "Documentation" }
-    { +keyboard+ T{ key-down f { A+ } "h" } }
-    { +quot+ [ module-help [ help-gadget call-tool ] when* ] }
-} define-operation
-
-[ module? ] H{
-    { +name+ "Edit" }
-    { +keyboard+ T{ key-down f { A+ } "e" } }
-    { +quot+ [ edit ] }
-} define-operation
-
-[ module? ] H{
-    { +primary+ t }
-    { +name+ "Browse" }
-    { +keyboard+ T{ key-down f { A+ } "b" } }
-    { +quot+ [ get-workspace swap show-module-files ] }
-} define-operation
-
-[ module? ] H{
-    { +name+ "See" }
-    { +quot+ [ browser call-tool ] }
-} define-operation
-
-[ module? ] H{
-    { +name+ "Test" }
-    { +quot+ [ module-name test-module ] }
-    { +listener+ t }
-} define-operation
-
-! Module links
-[ module-link? ] H{
-    { +primary+ t }
-    { +secondary+ t }
-    { +name+ "Run" }
-    { +quot+ [ module-name run-module ] }
-    { +listener+ t }
-} define-operation
-
-[ module-link? ] H{
-    { +name+ "Load" }
-    { +quot+ [ module-name require ] }
-    { +listener+ t }
-} define-operation
-
-! Link
-[ link? ] H{
-    { +primary+ t }
-    { +secondary+ t }
-    { +name+ "Follow" }
-    { +quot+ [ help-gadget call-tool ] }
-} define-operation
-
-[ link? ] H{
-    { +name+ "Edit" }
-    { +keyboard+ T{ key-down f { A+ } "e" } }
-    { +quot+ [ edit ] }
-} define-operation
-
-[ link? ] H{
-    { +name+ "Reload" }
-    { +keyboard+ T{ key-down f { A+ } "r" } }
-    { +quot+ [ reload ] }
-} define-operation
-
-[ word-link? ] H{
-    { +name+ "Definition" }
-    { +keyboard+ T{ key-down f { A+ } "b" } }
-    { +quot+ [ link-name browser call-tool ] }
-} define-operation
-
-! Quotations
-[ quotation? ] H{
-    { +name+ "Quotation stack effect" }
-    { +keyboard+ T{ key-down f { C+ } "i" } }
-    { +quot+ [ infer. ] }
-    { +listener+ t }
-} define-operation
-
-[ quotation? ] H{
-    { +name+ "Quotation dataflow" }
-    { +keyboard+ T{ key-down f { C+ } "d" } }
-    { +quot+ [ show-dataflow ] }
-    { +listener+ t }
-} define-operation
-
-[ quotation? ] H{
-    { +name+ "Walk" }
-    { +keyboard+ T{ key-down f { C+ } "w" } }
-    { +quot+ [ walk ] }
-    { +listener+ t }
-} define-operation
-
-[ quotation? ] H{
-    { +name+ "Time" }
-    { +keyboard+ T{ key-down f { C+ } "t" } }
-    { +quot+ [ time ] }
-    { +listener+ t }
-} define-operation
-
-! Dataflow nodes
-[ [ node? ] is? ] H{
-    { +primary+ t }
-    { +name+ "Show dataflow" }
-    { +quot+ [ dataflow-gadget call-tool ] }
-} define-operation
-
-! Define commands in terms of operations
-
-! Interactor commands
-: quot-action ( interactor -- quot )
-    dup editor-string swap select-all ;
-
-interactor "words"
-{ word compound } [ class-operations ] map concat
-[ selected-word ] [ search ] listener-operations
-define-commands
-
-interactor "quotations"
-quotation class-operations
-[ quot-action ] [ parse ] listener-operations
-define-commands
-
-help-gadget "toolbar" {
-    { "Back" T{ key-down f { C+ } "b" } [ help-gadget-history go-back ] }
-    { "Forward" T{ key-down f { C+ } "f" } [ help-gadget-history go-forward ] }
-    { "Home" T{ key-down f { C+ } "1" } [ go-home ] }
-}
-link class-operations [ help-action ] modify-commands
-[ command-name "Follow" = not ] subset
-append
-define-commands
diff --git a/core/ui/tools/search.factor b/core/ui/tools/search.factor
deleted file mode 100644 (file)
index 3d42e5a..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-search
-USING: arrays gadgets gadgets-labels gadgets-panes
-gadgets-scrolling gadgets-text gadgets-theme
-generic help tools kernel models sequences words
-gadgets-borders gadgets-lists gadgets-workspace gadgets-listener
-namespaces parser hashtables io completion styles strings
-modules prettyprint ;
-
-TUPLE: live-search field list ;
-
-: search-gesture ( gesture live-search -- command/f )
-    live-search-list list-value object-operations
-    [ command-gesture = ] find-with nip ;
-
-M: live-search handle-gesture* ( gadget gesture delegate -- ? )
-    drop over search-gesture dup [
-        over find-workspace hide-popup
-        >r live-search-list list-value r> invoke-command f
-    ] [
-        2drop t
-    ] if ;
-
-: find-live-search [ [ live-search? ] is? ] find-parent ;
-
-: find-search-list find-live-search live-search-list ;
-
-TUPLE: search-field ;
-
-C: search-field ( -- gadget )
-    <editor> over set-gadget-delegate
-    dup dup set-control-self
-    [ editor-doc-end ] keep ;
-
-search-field H{
-    { T{ key-down f f "UP" } [ find-search-list select-prev ] }
-    { T{ key-down f f "DOWN" } [ find-search-list select-next ] }
-    { T{ key-down f f "RETURN" } [ find-search-list list-action ] }
-} set-gestures
-
-: <search-model> ( producer -- model )
-    gadget get live-search-field control-model 200 <delay>
-    [ "\n" join ] <filter>
-    swap <filter> ;
-
-: <search-list> ( seq producer presenter -- gadget )
-    -rot curry <search-model>
-    [ find-workspace hide-popup ] -rot
-    <list> ;
-
-C: live-search ( string seq producer presenter -- gadget )
-    {
-        {
-            [ <search-field> ]
-            set-live-search-field
-            f
-            @top
-        }
-        {
-            [ <search-list> ]
-            set-live-search-list
-            [ <scroller> ]
-            @center
-        }
-    } make-frame*
-    [ live-search-field set-editor-string ] keep
-    [ live-search-field editor-doc-end ] keep ;
-
-M: live-search focusable-child* live-search-field ;
-
-: <word-search> ( string words -- gadget )
-    [ word-completions ]
-    [ summary ]
-    <live-search> ;
-
-: help-completions ( str pairs -- seq )
-    >r >lower r>
-    [ second >lower ] swap completions
-    [ first <link> ] map ;
-
-: <help-search> ( string -- gadget )
-    all-articles [ dup article-title 2array ] map sort-values
-    [ help-completions ]
-    [ article-title ]
-    <live-search> ;
-
-: <source-file-search> ( string files -- gadget )
-    [ string-completions [ <pathname> ] map ]
-    [ pathname-string ]
-    <live-search> ;
-
-: module-completions ( str modules -- seq )
-    [ module-name ] swap completions ;
-
-: <module-search> ( string -- gadget )
-    available-modules [ module-completions ]
-    [ module-string ]
-    <live-search> ;
-
-: <vocab-search> ( string -- gadget )
-    vocabs [ string-completions [ <vocab-link> ] map ]
-    [ vocab-link-name ]
-    <live-search> ;
-
-: <history-search> ( string seq -- gadget )
-    [ string-completions [ <input> ] map ]
-    [ input-string ]
-    <live-search> ;
-
-: workspace-listener ( workspace -- listener )
-    listener-gadget swap find-tool tool-gadget nip ;
-
-: current-word ( workspace -- string )
-    workspace-listener listener-gadget-input selected-word ;
-
-: show-word-search ( workspace words -- )
-    >r dup current-word r> <word-search>
-    "Word search" show-titled-popup ;
-
-: show-vocab-words ( workspace vocab -- )
-    "" over words natural-sort <word-search>
-    "Words in " rot append show-titled-popup ;
-
-: show-help-search ( workspace -- )
-    "" <help-search> "Help search" show-titled-popup ;
-
-: all-source-files ( -- seq )
-    source-files get hash-keys natural-sort ;
-
-: show-source-file-search ( workspace -- )
-    "" all-source-files <source-file-search>
-    "Source file search" show-titled-popup ;
-
-: show-module-files ( workspace module -- )
-    "" over module-files* <source-file-search>
-    "Source files in " rot module-name append show-titled-popup ;
-
-: show-vocab-search ( workspace -- )
-    dup current-word <vocab-search>
-    "Vocabulary search" show-titled-popup ;
-
-: show-module-search ( workspace -- )
-    "" <module-search> "Module search" show-titled-popup ;
-
-: listener-history ( listener -- seq )
-    listener-gadget-input interactor-history <reversed> ;
-
-: show-history ( workspace -- )
-    "" over workspace-listener listener-history <history-search>
-    "History search" show-titled-popup ;
-
-workspace "toolbar" {
-    {
-        "History"
-        T{ key-down f { C+ } "p" }
-        [ show-history ]
-    }
-    {
-        "Words"
-        T{ key-down f f "TAB" }
-        [ all-words show-word-search ]
-    }
-    {
-        "Vocabularies"
-        T{ key-down f { C+ } "u" }
-        [ show-vocab-search ]
-    }
-    {
-        "Modules"
-        T{ key-down f { C+ } "m" }
-        [ show-module-search ]
-    }
-    {
-        "Sources"
-        T{ key-down f { C+ } "e" }
-        [ show-source-file-search ]
-    }
-    {
-        "Search help"
-        T{ key-down f { C+ } "h" }
-        [ show-help-search ]
-    }
-} define-commands
diff --git a/core/ui/tools/test/listener.factor b/core/ui/tools/test/listener.factor
deleted file mode 100644 (file)
index e54ccef..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: temporary
-USING: gadgets-listener words arrays namespaces test kernel
-freetype timers gadgets-workspace sequences gadgets-text ;
-
-timers [ init-timers ] unless
-
-[
-    <listener-gadget> "listener" set
-    
-    { "kernel" } [ vocab ] map
-    "listener" get listener-gadget-input set-interactor-use
-    
-    [ "dup" ] [ \ dup "listener" get word-completion-string ] unit-test
-    
-    [ "USE: words word-name" ]
-    [ \ word-name "listener" get word-completion-string ] unit-test
-] with-freetype
diff --git a/core/ui/tools/test/workspace.factor b/core/ui/tools/test/workspace.factor
deleted file mode 100644 (file)
index c4a3bc5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-IN: temporary
-USING: gadgets-workspace namespaces sequences
-gadgets-scrolling test gadgets ;
-
-! Since this is a rarely used feature, it makes sense to unit
-! test it to ensure it still works
-[ ] [ <workspace> "w" set ] unit-test
-[ ] [ "w" get tool-scroll-up ] unit-test
-[ ] [ "w" get tool-scroll-down ] unit-test
-[ t ] [
-    "w" get workspace-book gadget-children
-    [ tool-scroller ] map [ ] subset [ scroller? ] all?
-] unit-test
diff --git a/core/ui/tools/tools.factor b/core/ui/tools/tools.factor
deleted file mode 100644 (file)
index cb65d41..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-messages
-DEFER: messages
-
-IN: gadgets-workspace
-USING: gadgets gadgets-books gadgets-workspace
-generic kernel models scratchpad sequences syntax
-gadgets-messages ;
-
-DEFER: workspace-window
-
-GENERIC: call-tool* ( arg tool -- )
-
-GENERIC: tool-scroller ( tool -- scroller )
-
-M: gadget tool-scroller drop f ;
-
-GENERIC: tool-help ( tool -- topic )
-
-M: gadget tool-help drop f ;
-
-TUPLE: workspace book popup error-hook ;
-
-: find-workspace [ workspace? ] find-parent ;
-
-TUPLE: tool gadget ;
-
-: find-tool ( class workspace -- index tool )
-    workspace-book gadget-children
-    [ tool-gadget class eq? ] find-with ;
-
-: show-tool ( class workspace -- tool )
-    [ find-tool swap ] keep workspace-book control-model
-    set-model ;
-
-: select-tool ( workspace class -- ) swap show-tool drop ;
-
-: get-workspace* ( quot -- workspace )
-    [ dup workspace? [ over call ] [ drop f ] if ] find-window
-    [ nip dup raise-window world-gadget ]
-    [ workspace-window drop get-workspace* ] if* ; inline
-
-: get-workspace ( -- workspace ) [ drop t ] get-workspace* ;
-
-: call-tool ( arg class -- )
-    get-workspace show-tool call-tool* ;
-
-: get-tool ( class -- gadget )
-    get-workspace find-tool nip tool-gadget ;
-
-: find-messages ( -- gadget ) messages get-tool ;
diff --git a/core/ui/tools/walker.factor b/core/ui/tools/walker.factor
deleted file mode 100644 (file)
index 7d03b9f..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-walker
-USING: arrays errors gadgets gadgets-buttons
-gadgets-listener gadgets-panes gadgets-scrolling gadgets-text
-gadgets-tracks gadgets-workspace generic hashtables tools
-interpreter io kernel kernel-internals listener math models
-namespaces sequences shells threads vectors ;
-
-: <callstack-display> ( model -- )
-    [ [ continuation-call callstack. ] when* ]
-    "Call stack" <labelled-pane> ;
-
-: <datastack-display> ( model -- )
-    [ [ continuation-data stack. ] when* ]
-    "Data stack" <labelled-pane> ;
-
-: <retainstack-display> ( model -- )
-    [ [ continuation-retain stack. ] when* ]
-    "Retain stack" <labelled-pane> ;
-
-: <quotation-display> ( quot -- gadget )
-    [ [ first2 callframe. ] when* ]
-    "Current quotation" <labelled-pane> ;
-
-TUPLE: walker-gadget model quot ns ;
-
-: update-stacks ( walker -- )
-    meta-interp get over walker-gadget-model set-model
-    meta-callframe swap walker-gadget-quot set-model ;
-
-: with-walker ( gadget quot -- )
-    swap dup walker-gadget-ns
-    [ slip update-stacks ] bind ; inline
-
-: walker-command ( gadget quot -- )
-    meta-interp pick walker-gadget-ns hash
-    [ with-walker ] [ 2drop ] if ; inline
-
-: reset-walker ( walker -- )
-    dup H{ } clone swap set-walker-gadget-ns
-    update-stacks ;
-
-: walker-step [ step ] walker-command ;
-: walker-step-in [ step-in ] walker-command ;
-: walker-step-out [ step-out ] walker-command ;
-: walker-step-back [ step-back ] walker-command ;
-
-: init-walker-models ( walker -- )
-    f <model> over set-walker-gadget-quot
-    f <model> swap set-walker-gadget-model ;
-
-: walker-gadget-quot$ gadget get walker-gadget-quot ;
-: walker-gadget-model$ gadget get walker-gadget-model ;
-
-C: walker-gadget ( -- gadget )
-    dup init-walker-models {
-        { [ walker-gadget-quot$ <quotation-display> ] f f 1/6 }
-        { [ walker-gadget-model$ <datastack-display> ] f f 1/4 }
-        { [ walker-gadget-model$ <retainstack-display> ] f f 1/4 }
-        { [ walker-gadget-model$ <callstack-display> ] f f 1/3 }
-    } { 0 1 } make-track* ;
-
-M: walker-gadget call-tool* ( continuation walker -- )
-    dup reset-walker [
-        V{ } clone meta-history set
-        restore-normally
-    ] with-walker ;
-
-M: walker-gadget tool-help drop "ui-walker" ;
-
-: walker-inspect ( walker -- )
-    walker-gadget-ns [ meta-interp get ] bind
-    [ inspect ] curry call-listener ;
-
-: walker-step-all ( walker -- )
-    dup [ step-all ] walker-command reset-walker
-    get-workspace listener-gadget select-tool ;
-
-walker-gadget "toolbar" {
-    { "Step" T{ key-down f f "s" } [ walker-step ] }
-    { "Step in" T{ key-down f f "i" } [ walker-step-in ] }
-    { "Step out" T{ key-down f f "o" } [ walker-step-out ] }
-    { "Step back" T{ key-down f f "b" } [ walker-step-back ] }
-    { "Continue" T{ key-down f f "c" } [ walker-step-all ] }
-    { "Inspect" T{ key-down f f "n" } [ walker-inspect ] }
-} define-commands
-
-[ walker-gadget call-tool stop ] break-hook set-global
-
-IN: tools
-
-: walk ( quot -- ) [ break ] swap append call ;
diff --git a/core/ui/tools/workspace.factor b/core/ui/tools/workspace.factor
deleted file mode 100644 (file)
index 497569a..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets-workspace
-USING: help arrays compiler gadgets gadgets-books
-gadgets-browser gadgets-buttons gadgets-dataflow gadgets-help
-gadgets-listener gadgets-presentations gadgets-walker generic
-kernel math modules scratchpad sequences syntax words io
-namespaces hashtables gadgets-scrolling gadgets-panes
-gadgets-messages gadgets-theme errors ;
-
-C: tool ( gadget -- tool )
-    {
-        {
-            [ dup dup class tool 2array <toolbar> ]
-            f
-            f
-            @top
-        }
-        {
-            f
-            set-tool-gadget
-            f
-            @center
-        }
-    } make-frame* ;
-
-M: tool focusable-child* tool-gadget ;
-
-M: tool call-tool* tool-gadget call-tool* ;
-
-M: tool tool-scroller tool-gadget tool-scroller ;
-
-M: tool tool-help tool-gadget tool-help ;
-
-: help-window ( topic -- )
-    [ [ help ] make-pane <scroller> ] keep
-    article-title open-titled-window ;
-
-: tool-help-window ( tool -- )
-    tool-help [ help-window ] when* ;
-
-tool "toolbar" {
-    { "Tool help" T{ key-down f f "F1" } [ tool-help-window ] }
-} define-commands
-
-: workspace-tabs
-    {
-        { "Listener" <listener-gadget> }
-        { "Messages" <messages> }
-        { "Definitions" <browser> } 
-        { "Documentation" <help-gadget> }
-        { "Walker" <walker-gadget> }
-        { "Dataflow" <dataflow-gadget> }
-    } ;
-
-: <workspace-tabs> ( workspace -- tabs )
-    workspace-book control-model
-    workspace-tabs dup length [ swap first 2array ] 2map
-    <radio-box> ;
-
-: <workspace-book> ( -- gadget )
-    workspace-tabs 1 <column> [ execute <tool> ] map <book> ;
-
-M: workspace pref-dim* delegate pref-dim* { 550 650 } vmax ;
-
-: init-status ( world -- )
-    dup world-status <presentation-help> swap @bottom grid-add ;
-
-: hide-popup ( workspace -- )
-    dup workspace-popup unparent
-    f over set-workspace-popup
-    request-focus ;
-
-: show-popup ( gadget workspace -- )
-    dup hide-popup
-    2dup set-workspace-popup
-    dupd add-gadget
-    dup popup-theme
-    request-focus ;
-
-: show-titled-popup ( workspace gadget title -- )
-    [ find-workspace hide-popup ] <closable-gadget>
-    swap show-popup ;
-
-: popup-dim ( workspace -- dim )
-    rect-dim first2 4 /i 2array ;
-
-: popup-loc ( workspace -- loc )
-    dup rect-dim
-    over popup-dim v-
-    swap rect-loc v+ ;
-
-: layout-popup ( workspace gadget -- )
-    over popup-dim over set-gadget-dim
-    swap popup-loc swap set-rect-loc ;
-
-: debugger-popup ( error workspace -- )
-    swap dup compute-restarts
-    [ find-workspace hide-popup ] <debugger>
-    "Error" show-titled-popup ;
-
-C: workspace ( -- workspace )
-    [ debugger-popup ] over set-workspace-error-hook
-    {
-        { [ <workspace-book> ] set-workspace-book f @center }
-        { [ gadget get <workspace-tabs> ] f f @top }
-        { [ gadget get { workspace } <toolbar> ] f f @bottom }
-    } make-frame* ;
-
-M: workspace layout*
-    dup delegate layout*
-    dup workspace-book swap workspace-popup dup
-    [ layout-popup ] [ 2drop ] if ;
-
-M: workspace children-on nip gadget-children ;
-
-M: workspace focusable-child* workspace-book ;
-
-: workspace-window ( -- workspace )
-    <workspace> dup <world>
-    [ init-status ] keep
-    open-window
-    listener-gadget get-tool start-listener ;
-
-: tool-window ( class -- ) workspace-window show-tool 2drop ;
-
-M: workspace tool-scroller ( workspace -- scroller )
-    workspace-book current-page tool-scroller ;
-
-: tool-scroll-up ( workspace -- )
-    tool-scroller [ scroll-up-page ] when* ;
-
-: tool-scroll-down ( workspace -- )
-    tool-scroller [ scroll-down-page ] when* ;
-
-workspace "scrolling" {
-    { "Scroll up" T{ key-down f { C+ } "PAGE_UP" } [ tool-scroll-up ] }
-    { "Scroll down" T{ key-down f { C+ } "PAGE_DOWN" } [ tool-scroll-down ] }
-} define-commands
-
-workspace "tool-switch" {
-    { "Hide popup" T{ key-down f f "ESCAPE" } [ hide-popup ] }
-    { "Listener" T{ key-down f f "F2" } [ listener-gadget select-tool ] }
-    { "Messages" T{ key-down f f "F3" } [ messages select-tool ] }
-    { "Definitions" T{ key-down f f "F4" } [ browser select-tool ] }
-    { "Documentation" T{ key-down f f "F5" } [ help-gadget select-tool ] }
-    { "Walker" T{ key-down f f "F6" } [ walker-gadget select-tool ] }
-    { "Dataflow" T{ key-down f f "F7" } [ dataflow-gadget select-tool ] }
-} define-commands
-
-workspace "tool-window" {
-    { "New listener" T{ key-down f { S+ } "F2" } [ listener-gadget tool-window ] }
-    { "New definitions" T{ key-down f { S+ } "F3" } [ browser tool-window ] }
-    { "New documentation" T{ key-down f { S+ } "F4" } [ help-gadget tool-window ] }
-} define-commands
-
-workspace "workflow" {
-    { "Reload changed sources" T{ key-down f f "F8" } [ drop [ reload-modules ] call-listener ] }
-    { "Recompile changed words" T{ key-down f { S+ } "F8" } [ drop [ recompile ] call-listener ] }
-} define-commands
diff --git a/core/ui/ui.factor b/core/ui/ui.factor
deleted file mode 100644 (file)
index 2010192..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays errors gadgets gadgets-buttons
-gadgets-labels gadgets-panes gadgets-presentations
-gadgets-scrolling gadgets-theme gadgets-viewports gadgets-lists
-generic hashtables io kernel math models namespaces prettyprint
-queues sequences test threads sequences words timers ;
-
-: update-hand ( gadget -- )
-    find-world [
-        dup hand-world get-global eq?
-        [ hand-loc get-global swap move-hand ] [ drop ] if
-    ] when* ;
-
-: post-layout ( gadget -- )
-    find-world [ dup world-handle set ] when* ;
-
-: layout-queued ( -- )
-    invalid dup queue-empty? [
-        drop
-    ] [
-        deque dup layout post-layout layout-queued
-    ] if ;
-
-: init-ui ( -- )
-    <queue> \ invalid set-global
-    V{ } clone windows set-global ;
-
-: ui-step ( -- )
-    [
-        do-timers
-        [ layout-queued ] make-hash hash-values [
-            dup update-hand
-            dup world-handle [ dup draw-world ] when
-            drop
-        ] each
-        10 sleep
-    ] assert-depth ;
-
-TUPLE: world-error world ;
-
-C: world-error ( error world -- error )
-    [ set-world-error-world ] keep
-    [ set-delegate ] keep ;
-
-M: world-error error.
-    "An error occurred while drawing the world " write
-    dup world-error-world pprint-short "." print
-    "This world has been deactivated to prevent cascading errors." print
-    delegate error. ;
-
-: draw-world? ( world -- ? )
-    #! We don't draw deactivated worlds, or those with 0 size.
-    #! On Windows, the latter case results in GL errors.
-    dup world-active? swap rect-dim [ zero? not ] all? and ;
-
-: draw-world ( world -- )
-    dup draw-world? [
-        [
-            dup world set [
-                dup (draw-world)
-            ] [
-                over <world-error> debugger-window
-                f over set-world-active?
-            ] recover
-        ] with-scope
-    ] when drop ;
-
-IN: shells
-
-DEFER: ui
diff --git a/core/ui/ui.facts b/core/ui/ui.facts
deleted file mode 100644 (file)
index 9ed0625..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-IN: gadgets
-
-HELP: ui
-{ $description "Starts the Factor UI." }
-{ $see-also tty } ;
diff --git a/core/ui/windows.factor b/core/ui/windows.factor
deleted file mode 100644 (file)
index 6b6f84e..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays errors gadgets generic hashtables io kernel math
-models namespaces prettyprint sequences test threads
-sequences words timers ;
-
-! Assoc mapping aliens to gadgets
-SYMBOL: windows
-
-: window ( handle -- world ) windows get-global assoc ;
-
-: window-focus ( handle -- gadget ) window world-focus ;
-
-: register-window ( world handle -- )
-    swap 2array windows get-global push ;
-
-: unregister-window ( handle -- )
-    windows get-global
-    [ first = not ] subset-with
-    windows set-global  ;
-
-: raised-window ( world -- )
-    windows get-global [ second eq? ] find-with drop
-    windows get-global [ length 1- ] keep exchange ;
-
-TUPLE: titled-gadget title child ;
-
-M: titled-gadget gadget-title titled-gadget-title ;
-
-M: titled-gadget focusable-child* titled-gadget-child ;
-
-C: titled-gadget ( gadget title -- )
-    [ set-titled-gadget-title ] keep
-    { { f set-titled-gadget-child f @center } } make-frame* ;
-
-: open-window ( world -- )
-    dup pref-dim over set-gadget-dim
-    dup open-window* draw-world ;
-
-: open-titled-window ( gadget title -- )
-    <model> <titled-gadget> <world> open-window ;
-
-: find-window ( quot -- world )
-    windows get 1 <column>
-    [ world-gadget swap call ] find-last-with nip ; inline
-
-: start-world ( world -- )
-    dup graft
-    dup relayout
-    world-gadget request-focus ;
-
-: close-global ( world global -- )
-    dup get-global find-world rot eq?
-    [ f swap set-global ] [ drop ] if ;
-
-: focus-world ( world -- )
-    t over set-world-focused?
-    dup raised-window
-    focused-ancestors f focus-gestures ;
-
-: unfocus-world ( world -- )
-    f over set-world-focused?
-    focused-ancestors f swap focus-gestures ;
-
-: reset-world ( world -- )
-    dup world-fonts clear-hash
-    dup unfocus-world
-    f over set-world-focus
-    f over set-world-handle
-    ungraft ;
-
-: close-world ( world -- )
-    dup hand-clicked close-global
-    dup hand-gadget close-global
-    dup free-fonts
-    reset-world ;
-
-: restore-windows ( -- )
-    windows get [ 1 <column> >array ] keep delete-all
-    [ dup reset-world open-window* ] each
-    forget-rollover ;
-
-: restore-windows? ( -- ? )
-    windows get [ empty? not ] [ f ] if* ;
diff --git a/core/ui/windows.facts b/core/ui/windows.facts
deleted file mode 100644 (file)
index ec877a5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-IN: gadgets
-USING: help strings ;
-
-HELP: windows
-{ $var-description "Global variable holding an association list mapping native window handles to " { $link world } " instances." }
-{ $see-also open-window find-window } ;
-
-HELP: open-window
-{ $values { "world" world } }
-{ $description "Opens a native window containing the given world." }
-{ $see-also open-titled-window } ;
-
-HELP: open-titled-window
-{ $values { "gadget" gadget } { "string" string } }
-{ $description "Opens a native window with the specified title bar string." }
-{ $see-also open-window } ;
-
-HELP: find-window
-{ $values { "quot" "a quotation with stack effect " { $snippet "( world -- ? )" } } { "world" "a " { $link world } " or " { $link f } } }
-{ $description "Finds a native window whose world satisfies the quotation, outputting " { $link f } " if no such world could be found. The front-most native window is checked first." } ;
diff --git a/core/ui/windows/clipboard.factor b/core/ui/windows/clipboard.factor
deleted file mode 100644 (file)
index 9cbb6f6..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-! Copyright (C) 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel win32-api math namespaces io prettyprint errors sequences alien
-    libc gadgets ;
-IN: win32
-
-: crlf>lf CHAR: \r swap remove ;
-: lf>crlf [ [ dup CHAR: \n = [ CHAR: \r , ] when , ] each ] "" make ;
-
-: (enum-clipboard) ( n -- n )
-    EnumClipboardFormats win32-error dup 0 > [ dup , (enum-clipboard) ] when ;
-
-: enum-clipboard ( -- seq )
-    [ 0 (enum-clipboard) ] { } make nip ;
-
-: paste ( -- str )
-    f OpenClipboard drop
-    CF_TEXT IsClipboardFormatAvailable 0 = [
-            ! nothing to paste
-            ""
-        ] [
-            CF_TEXT GetClipboardData
-            dup GlobalLock swap
-            GlobalUnlock drop
-            alien>char-string
-    ] if
-    CloseClipboard drop
-    crlf>lf ;
-
-: copy ( str -- )
-    lf>crlf
-    f OpenClipboard drop
-    EmptyClipboard drop
-    GMEM_MOVEABLE over length 1+ GlobalAlloc dup 0 = [
-        "unable to allocate memory" throw
-    ] when
-
-    dup GlobalLock
-    rot [ string>char-alien ] keep length memcpy
-    dup GlobalUnlock drop
-    CF_TEXT swap SetClipboardData 0 = [ win32-error ] when
-    CloseClipboard drop ;
-
-TUPLE: pasteboard ;
-M: pasteboard clipboard-contents drop paste ;
-M: pasteboard set-clipboard-contents drop copy ;
-
-: init-clipboard ( -- )
-    <pasteboard> clipboard set-global ;
diff --git a/core/ui/windows/load.factor b/core/ui/windows/load.factor
deleted file mode 100644 (file)
index b9d7474..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-REQUIRES: core/windows core/ui/tools ;
-
-PROVIDE: core/ui/windows { +files+ { 
-    "clipboard.factor"
-    "ui.factor"
-} } ;
-
-IN: command-line
-: default-shell "ui" ;
diff --git a/core/ui/windows/ui.factor b/core/ui/windows/ui.factor
deleted file mode 100644 (file)
index 0b14e2e..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays errors freetype gadgets gadgets-listener
-       gadgets-workspace hashtables io kernel math namespaces
-       prettyprint sequences strings vectors words win32-api
-       win32-api-messages tools threads memory timers ;
-IN: win32
-
-! world-handle is a <win>
-TUPLE: win hWnd hDC hRC world ;
-
-SYMBOL: msg-obj
-SYMBOL: class-name
-SYMBOL: track-mouse-state
-
-: random-class-name "Factor" (random-int) number>string append ;
-
-: style ( -- n ) WS_OVERLAPPEDWINDOW ; inline
-: ex-style ( -- n ) WS_EX_APPWINDOW WS_EX_WINDOWEDGE bitor ; inline
-
-: adjust-RECT ( RECT -- )
-    style 0 ex-style AdjustWindowRectEx win32-error=0 ;
-
-: make-RECT ( width height -- RECT )
-    "RECT" <c-object> [ set-RECT-bottom ] keep [ set-RECT-right ] keep ;
-
-: make-adjusted-RECT ( width height -- RECT )
-    make-RECT dup adjust-RECT ;
-
-: get-RECT-dimensions ( RECT -- width height )
-    [ RECT-right ] keep [ RECT-left - ] keep
-    [ RECT-bottom ] keep RECT-top - ;
-
-: handle-wm-paint ( hWnd uMsg wParam lParam -- )
-    #! wParam and lParam are unused
-    #! only paint if width/height both > 0
-    3drop window dup rect-dim first2 [ 0 > ] 2apply and
-    [ draw-world ] [ drop ] if ;
-
-: handle-wm-size ( hWnd uMsg wParam lParam -- )
-    [ lo-word ] keep hi-word make-RECT get-RECT-dimensions 2array
-    2nip
-    dup { 0 0 } = [ 2drop ] [ swap window set-gadget-dim ui-step ] if ;
-
-: wm-keydown-codes ( -- key )
-    H{
-        { 8 "BACKSPACE" }
-        { 9 "TAB" }
-        { 13 "RETURN" }
-        { 27 "ESCAPE" }
-        { 33 "PAGE_UP" }
-        { 34 "PAGE_DOWN" }
-        { 35 "END" }
-        { 36 "HOME" }
-        { 37 "LEFT" }
-        { 38 "UP" }
-        { 39 "RIGHT" }
-        { 40 "DOWN" }
-        { 45 "INSERT" }
-        { 46 "DELETE" }
-        { 112 "F1" }
-        { 113 "F2" }
-        { 114 "F3" }
-        { 115 "F4" }
-        { 116 "F5" }
-        { 117 "F6" }
-        { 118 "F7" }
-        { 119 "F8" }
-        { 120 "F9" }
-        { 121 "F10" }
-        { 122 "F11" }
-        { 123 "F12" }
-    } ;
-
-: key-state-down?
-    GetKeyState 1 16 shift bitand 0 > ;
-
-: left-shift? ( -- ? ) VK_LSHIFT key-state-down? ;
-: left-ctrl? ( -- ? ) VK_LCONTROL key-state-down? ;
-: left-alt? ( -- ? ) VK_LMENU key-state-down? ;
-: right-shift? ( -- ? ) VK_RSHIFT key-state-down? ;
-: right-ctrl? ( -- ? ) VK_RCONTROL key-state-down? ;
-: right-alt? ( -- ? ) VK_RMENU key-state-down? ;
-: shift? ( -- ? ) left-shift? right-shift? or ;
-: ctrl? ( -- ? ) left-ctrl? right-ctrl? or ;
-: alt? ( -- ? ) left-alt? right-alt? or ;
-: caps-lock? ( -- ? ) VK_CAPITAL GetKeyState zero? not ;
-: lower-case? ( -- ? ) shift? caps-lock? and caps-lock? not shift? not and or ;
-
-: key-modifiers ( -- list )
-    [
-        shift? [ S+ , ] when
-        ctrl? [ C+ , ] when
-        alt? [ A+ , ] when
-    ] { } make [ empty? not ] keep f ? ;
-
-: exclude-keys-wm-keydown
-    H{
-        { 16 "SHIFT" }
-        { 17 "CTRL" }
-        { 18 "ALT" }
-        { 20 "CAPS-LOCK" }
-    } ;
-
-: exclude-keys-wm-char
-    ! Values are ignored
-    H{
-        { 8 "BACKSPACE" }
-        { 9 "TAB" }
-        { 13 "RETURN" }
-        { 27 "ESCAPE" }
-    } ;
-
-: exclude-key-wm-keydown? ( n -- bool ) exclude-keys-wm-keydown hash* nip ;
-: exclude-key-wm-char? ( n -- bool ) exclude-keys-wm-char hash* nip ;
-: keystroke>gesture ( n -- sym mods )
-    dup wm-keydown-codes hash*
-    [ nip ] [ drop ch>string lower-case? [ >lower ] when ] if
-    key-modifiers swap ;
-
-SYMBOL: lParam
-SYMBOL: wParam
-SYMBOL: uMsg
-SYMBOL: hWnd
-
-: handle-wm-keydown ( hWnd uMsg wParam lParam -- )
-    lParam set wParam set uMsg set hWnd set
-    wParam get exclude-key-wm-keydown? [
-        wParam get keystroke>gesture <key-down>
-        hWnd get window-focus send-gesture drop 
-    ] unless ;
-
-: handle-wm-char ( hWnd uMsg wParam lParam -- )
-    lParam set wParam set uMsg set hWnd set
-    wParam get exclude-key-wm-char? ctrl? or alt? or [
-        wParam get ch>string
-        hWnd get window-focus user-input
-    ] unless ;
-
-: handle-wm-keyup ( hWnd uMsg wParam lParam -- )
-    lParam set wParam set uMsg set hWnd set
-    wParam get keystroke>gesture <key-up>
-    hWnd get window-focus send-gesture
-    drop ;
-
-: cleanup-window ( handle -- )
-    [ win-hRC wglDeleteContext win32-error=0 ] keep
-    [ win-hWnd ] keep win-hDC ReleaseDC win32-error=0 ;
-
-: handle-wm-close ( hWnd uMsg wParam lParam -- )
-    3drop
-    window [ world-handle ] keep
-    close-world
-    dup win-hWnd unregister-window
-    dup cleanup-window
-    win-hWnd DestroyWindow win32-error=0 ;
-
-: handle-wm-set-focus ( hWnd uMsg wParam lParam -- )
-    3drop window [ focus-world ] when* ;
-
-: handle-wm-kill-focus ( hWnd uMsg wParam lParam -- )
-    3drop window [ unfocus-world ] when* ;
-
-: mouse-lparam ( lParam -- seq ) [ lo-word ] keep hi-word 2array ;
-: mouse-wheel ( lParam -- n ) mouse-lparam [ sgn neg ] map ;
-
-: mouse-event>gesture ( uMsg -- button )
-    key-modifiers swap
-    {
-        { [ dup WM_LBUTTONDOWN = ] [ drop 1 <button-down> ] }
-        { [ dup WM_LBUTTONUP = ] [ drop 1 <button-up> ] }
-        { [ dup WM_MBUTTONDOWN = ] [ drop 2 <button-down> ] }
-        { [ dup WM_MBUTTONUP = ] [ drop 2 <button-up> ] }
-        { [ dup WM_RBUTTONDOWN = ] [ drop 3 <button-down> ] }
-        { [ dup WM_RBUTTONUP = ] [ drop 3 <button-up> ] }
-        { [ t ] [ "bad button" throw ] }
-    } cond ;
-
-: capture-mouse? ( umsg -- ? )
-    { WM_LBUTTONDOWN WM_RBUTTONDOWN } member? ;
-
-: prepare-mouse ( hWnd uMsg wParam lParam -- button coordinate world )
-    nip >r mouse-event>gesture r> mouse-lparam rot window ;
-
-: handle-wm-buttondown ( hWnd uMsg wParam lParam -- )
-    >r over capture-mouse? [ pick SetCapture drop ] when r>
-    prepare-mouse send-button-down ;
-
-: handle-wm-buttonup ( hWnd uMsg wParam lParam -- )
-    pick capture-mouse? [ ReleaseCapture drop ] when
-    prepare-mouse send-button-up ;
-
-: handle-wm-mousemove ( hWnd uMsg wParam lParam -- )
-    2nip
-    track-mouse-state get [
-        over "TRACKMOUSEEVENT" <c-object> [ set-TRACKMOUSEEVENT-hwndTrack ] keep
-        "TRACKMOUSEEVENT" c-size over set-TRACKMOUSEEVENT-cbSize
-        TME_LEAVE over set-TRACKMOUSEEVENT-dwFlags
-        0 over set-TRACKMOUSEEVENT-dwHoverTime
-        TrackMouseEvent drop
-        track-mouse-state on
-    ] unless
-    mouse-lparam swap window move-hand fire-motion ;
-
-: handle-wm-mousewheel ( hWnd uMsg wParam lParam -- )
-    mouse-lparam >r mouse-wheel nip r> rot window send-wheel ;
-
-: handle-wm-cancelmode ( hWnd uMsg wParam lParam -- )
-    #! message sent if windows needs application to stop dragging
-    3drop drop ReleaseCapture drop ;
-
-: handle-wm-mouseleave ( hWnd uMsg wParam lParam -- )
-    #! message sent if mouse leaves main application 
-    3drop drop forget-rollover track-mouse-state off ;
-
-: 4dup ( a b c d -- a b c d a b c d )
-    >r >r 2dup r> r> 2swap >r >r 2dup r> r> 2swap ;
-
-! return 0 if you handle the message, else just let DefWindowProc return its val
-: ui-wndproc ( -- object )
-    "uint" { "void*" "uint" "long" "long" } [
-        [
-        pick
-        ! "Message: " write dup get-windows-message-name write
-            ! " " write dup unparse print flush
-            {
-                { [ dup WM_CLOSE = ]    [ drop handle-wm-close 0 ] }
-                { [ dup WM_PAINT = ]
-                      [ drop 4dup handle-wm-paint DefWindowProc ] }
-                { [ dup WM_SIZE = ]      [ drop handle-wm-size 0 ] }
-
-                ! Keyboard events
-                { [ dup WM_KEYDOWN = over WM_SYSKEYDOWN = or ]
-                    [ drop 4dup handle-wm-keydown DefWindowProc ] }
-                { [ dup WM_CHAR = over WM_SYSCHAR = or ]
-                    [ drop 4dup handle-wm-char DefWindowProc ] }
-                { [ dup WM_KEYUP = over WM_SYSKEYUP = or ]
-                    [ drop 4dup handle-wm-keyup DefWindowProc ] }
-
-                { [ dup WM_SETFOCUS = ] [ drop handle-wm-set-focus 0 ] }
-                { [ dup WM_KILLFOCUS = ] [ drop handle-wm-kill-focus 0 ] }
-
-                ! Mouse events
-                { [ dup WM_LBUTTONDOWN = ] [ drop handle-wm-buttondown 0 ] }
-                { [ dup WM_MBUTTONDOWN = ] [ drop handle-wm-buttondown 0 ] }
-                { [ dup WM_RBUTTONDOWN = ] [ drop handle-wm-buttondown 0 ] }
-                { [ dup WM_LBUTTONUP = ] [ drop handle-wm-buttonup 0 ] }
-                { [ dup WM_MBUTTONUP = ] [ drop handle-wm-buttonup 0 ] }
-                { [ dup WM_RBUTTONUP = ] [ drop handle-wm-buttonup 0 ] }
-                { [ dup WM_MOUSEMOVE = ] [ drop handle-wm-mousemove 0 ] }
-                { [ dup WM_MOUSEWHEEL = ] [ drop handle-wm-mousewheel 0 ] }
-                { [ dup WM_CANCELMODE = ] [ drop handle-wm-cancelmode 0 ] }
-                { [ dup WM_MOUSELEAVE = ] [ drop handle-wm-mouseleave 0 ] }
-
-                { [ t ] [ drop DefWindowProc ] }
-            } cond
-        ] ui-try
-        ! "finished handling message" print .s flush
-     ] alien-callback ;
-
-: do-events ( -- )
-    msg-obj get f 0 0 PM_REMOVE PeekMessage 
-    zero? not [
-        msg-obj get MSG-message WM_QUIT = [
-            msg-obj get [ TranslateMessage drop ] keep DispatchMessage drop
-        ] unless
-    ] when ;
-
-: event-loop ( -- )
-    windows get empty? [
-        [ do-events ui-step ] ui-try event-loop
-    ] unless ;
-
-: register-wndclassex ( classname wndproc -- class )
-    "WNDCLASSEX" <c-object>
-    "WNDCLASSEX" c-size over set-WNDCLASSEX-cbSize
-    CS_HREDRAW CS_VREDRAW bitor CS_OWNDC bitor over set-WNDCLASSEX-style
-    [ set-WNDCLASSEX-lpfnWndProc ] keep
-    0 over set-WNDCLASSEX-cbClsExtra
-    0 over set-WNDCLASSEX-cbWndExtra
-    f GetModuleHandle over set-WNDCLASSEX-hInstance
-    f IDI_APPLICATION LoadIcon over set-WNDCLASSEX-hIcon
-    f IDC_ARROW LoadCursor over set-WNDCLASSEX-hCursor
-    [ set-WNDCLASSEX-lpszClassName ] keep
-    RegisterClassEx dup win32-error=0 ;
-
-: create-window ( width height -- hwnd )
-    make-adjusted-RECT
-    >r class-name get <malloc-string> f r>
-    >r >r >r ex-style r> r>
-        WS_CLIPSIBLINGS WS_CLIPCHILDREN bitor style bitor
-        0 0 r>
-    get-RECT-dimensions
-    f f f GetModuleHandle f CreateWindowEx dup win32-error=0 ;
-
-: show-window ( hWnd -- )
-    dup SW_SHOW ShowWindow drop ! always succeeds
-    dup SetForegroundWindow drop
-    SetFocus drop ;
-
-: init-win32-ui
-    "MSG" <c-object> msg-obj set
-    random-class-name class-name set
-    class-name get <malloc-string> ui-wndproc
-    register-wndclassex win32-error=0
-    GetDoubleClickTime double-click-timeout set-global ;
-
-: cleanup-win32-ui ( -- )
-    class-name get string>char-alien f UnregisterClass drop ;
-
-: setup-pixel-format ( hdc -- )
-    16 make-pfd [ ChoosePixelFormat dup win32-error=0 ] 2keep
-    swapd SetPixelFormat win32-error=0 ;
-
-: get-dc ( hWnd -- hDC ) GetDC dup win32-error=0 ;
-
-: get-rc ( hDC -- hRC )
-    dup wglCreateContext dup win32-error=0
-    [ wglMakeCurrent win32-error=0 ] keep ;
-
-: setup-gl ( hwnd -- hDC hRC )
-    get-dc
-    dup setup-pixel-format
-    dup get-rc ;
-
-IN: gadgets
-
-: open-window* ( world -- ) ! new
-    [ rect-dim first2 create-window dup setup-gl ] keep
-    [ <win> ] keep
-    [ swap win-hWnd register-window ] 2keep
-    [ set-world-handle ] 2keep 
-    start-world win-hWnd show-window ;
-
-: select-gl-context ( handle -- )
-    [ win-hDC ] keep win-hRC wglMakeCurrent win32-error=0 ;
-
-: flush-gl-context ( handle -- )
-    win-hDC SwapBuffers win32-error=0 ;
-
-! Move window to front
-: raise-window ( world -- )
-    world-handle win-hWnd SetFocus drop ReleaseCapture drop ;
-
-: set-title ( string world -- )
-    world-handle win-hWnd
-    swap <malloc-string> alien-address >r WM_SETTEXT 0 r> SendMessage drop ;
-
-IN: shells
-: ui
-    [
-        [
-            init-timers
-            init-clipboard
-            init-win32-ui
-            restore-windows? [
-                restore-windows
-            ] [
-                init-ui
-                workspace-window
-                drop
-            ] if
-            event-loop
-        ] with-freetype
-    ] [ cleanup-win32-ui ] cleanup ;
-
diff --git a/core/ui/world.factor b/core/ui/world.factor
deleted file mode 100644 (file)
index 1d46740..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: gadgets
-USING: arrays errors freetype generic hashtables
-kernel math models namespaces opengl sequences ;
-
-TUPLE: world
-active?
-gadget glass
-title status
-focus focused?
-fonts handle
-loc ;
-
-: free-fonts ( world -- )
-    dup world-handle select-gl-context
-    world-fonts hash-values [ second free-sprites ] each ;
-
-DEFER: request-focus
-
-C: world ( gadget -- world )
-    f <model> over set-world-status
-    [ >r dup gadget-title r> set-world-title ] keep
-    { { f set-world-gadget f @center } } make-frame*
-    t over set-gadget-root?
-    t over set-world-active?
-    H{ } clone over set-world-fonts
-    { 0 0 } over set-world-loc
-    dup world-gadget request-focus ;
-
-: find-world [ world? ] find-parent ;
-
-M: world pref-dim*
-    delegate pref-dim* [ >fixnum ] map { 1024 768 } vmin ;
-
-M: world graft*
-    dup dup world-title add-connection
-    dup dup world-status add-connection
-    model-changed ;
-
-M: world ungraft*
-    dup
-    dup world-title remove-connection
-    dup world-status remove-connection ;
-
-M: world model-changed
-    dup world-handle [
-        dup world-title model-value over set-title
-    ] when drop ;
-
-: focused-ancestors ( world -- seq )
-    world-focus parents <reversed> ;
-
-M: world gadget-title world-gadget gadget-title ;
-
-M: world layout*
-    dup delegate layout*
-    dup world-glass [
-        >r dup rect-dim r> set-layout-dim
-    ] when* drop ;
-
-M: world children-on nip gadget-children ;
diff --git a/core/ui/world.facts b/core/ui/world.facts
deleted file mode 100644 (file)
index f7f9374..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-IN: gadgets
-USING: help models gadgets-presentations prettyprint
-freetype opengl ;
-
-HELP: world
-{ $class-description "A gadget which appears at the top of the gadget hieararchy, and in turn may be displayed in a native window. Worlds delegate to " { $link gadget } " instances and have the following slots:"
-    { $list
-        { { $link world-active? } " - if set to " { $link f } ", the world will not be drawn. This slot is set to " { $link f } " if an error is thrown while drawing the world; this prevents multiple debugger windows from being shown." }
-        { { $link world-gadget } " - the primary gadget in the world." }
-        { { $link world-glass } " - a glass pane in front of the primary gadget, used to implement behaviors such as popup menus which are hidden when the mouse is clicked outside the menu." }
-        { { $link world-title } " - a " { $link model } " holding a string to be displayed in the title bar of the native window containing the world." }
-        { { $link world-title } " - a " { $link model } " holding a " { $link presentation } " whose " { $link summary } " is to be displayed in the world's status bar." }
-        { { $link world-focus } " - the current owner of the keyboard focus in the world." }
-        { { $link world-focused? } " - a boolean indicating if the native window containing the world has keyboard focus." }
-        { { $link world-fonts } " - a hashtable mapping " { $link font } " instances to vectors of " { $link sprite } " instances." }
-        { { $link world-handle } " - a backend-specific native handle representing the native window containing the world, or " { $link f } " if the world is not grafted." }
-        { { $link world-loc } " - the on-screen location of the native window containing the world. The co-ordinate system here is backend-specific." }
-    }
-} ;
-
-HELP: <world>
-{ $values { "gadget" gadget } { "world" "a new " { $link world } } }
-{ $description "Creates a new " { $link world } " containing the given gadget." } ;
-
-HELP: find-world
-{ $values { "gadget" gadget } { "world" "a " { $link world } " or " { $link f } } }
-{ $description "Finds the " { $link world } " containing the gadget, or outputs " { $link f } " if the gadget is not grafted." } ;
diff --git a/core/ui/x11/clipboard.factor b/core/ui/x11/clipboard.factor
deleted file mode 100644 (file)
index 672a79a..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays gadgets kernel math namespaces sequences ;
-IN: x11
-
-! This code was based on by McCLIM's Backends/CLX/port.lisp
-! and http://common-lisp.net/~crhodes/clx/demo/clipboard.lisp.
-
-TUPLE: x-clipboard atom contents ;
-
-C: x-clipboard ( atom -- clipboard )
-    [ set-x-clipboard-atom ] keep
-    "" over set-x-clipboard-contents ;
-
-: selection-property ( -- n )
-    "org.factorcode.Factor.SELECTION" x-atom ;
-
-: convert-selection ( win selection -- )
-    swap >r >r dpy get r> XA_STRING selection-property r>
-    CurrentTime XConvertSelection drop ;
-
-: snarf-property ( prop-return -- string )
-    dup *void* [ *char* ] [ drop f ] if ;
-
-: window-property ( win prop delete? -- string )
-    >r dpy get -rot 0 -1 r> AnyPropertyType
-    0 <Atom> 0 <int> 0 <ulong> 0 <ulong> f <void*>
-    [ XGetWindowProperty drop ] keep snarf-property ;
-
-: selection-from-event ( event window -- string )
-    >r XSelectionEvent-property zero? [
-        r> drop f
-    ] [
-        r> selection-property 1 window-property
-    ] if ;
-
-: own-selection ( prop win -- )
-    dpy get -rot CurrentTime XSetSelectionOwner drop
-    flush-dpy ;
-
-: clipboard-for-atom ( atom -- clipboard )
-    {
-        { [ dup XA_PRIMARY = ] [ drop selection get ] }
-        { [ dup "CLIPBOARD" x-atom = ] [ drop clipboard get ] }
-        { [ t ] [ drop <clipboard> ] }
-    } cond ;
-
-: set-selection-prop ( evt -- )
-    dpy get swap
-    [ XSelectionRequestEvent-requestor ] keep
-    [ XSelectionRequestEvent-property ] keep
-    >r XA_STRING 8 PropModeReplace r>
-    XSelectionRequestEvent-selection
-    clipboard-for-atom x-clipboard-contents
-    dup string>char-alien swap length XChangeProperty drop ;
-
-: set-targets-prop ( evt -- )
-    dpy get swap
-    [ XSelectionRequestEvent-requestor ] keep
-    XSelectionRequestEvent-property
-    "TARGETS" x-atom 32 PropModeReplace
-    { "STRING" "TARGETS" "TIMESTAMP" } [ x-atom ] map >int-array
-    32 XChangeProperty drop ;
-
-: set-timestamp-prop ( evt -- )
-    dpy get swap
-    [ XSelectionRequestEvent-requestor ] keep
-    [ XSelectionRequestEvent-property ] keep
-    >r "TIMESTAMP" x-atom 32 PropModeReplace r>
-    XSelectionRequestEvent-time 1array >int-array
-    32 XChangeProperty drop ;
-
-: send-notify ( evt prop -- )
-    "XSelectionEvent" <c-object>
-    SelectionNotify over set-XSelectionEvent-type
-    [ set-XSelectionEvent-property ] keep
-    over XSelectionRequestEvent-display   over set-XSelectionEvent-display
-    over XSelectionRequestEvent-requestor over set-XSelectionEvent-requestor
-    over XSelectionRequestEvent-selection over set-XSelectionEvent-selection
-    over XSelectionRequestEvent-target    over set-XSelectionEvent-target
-    over XSelectionRequestEvent-time      over set-XSelectionEvent-time
-    >r dpy get swap XSelectionRequestEvent-requestor 0 0 r>
-    XSendEvent drop
-    flush-dpy ;
-
-: send-notify-success ( evt -- )
-    dup XSelectionRequestEvent-property send-notify ;
-
-: send-notify-failure ( evt -- )
-    0 send-notify ;
-
-: x-clipboard@ ( gadget clipboard -- prop win )
-    x-clipboard-atom swap find-world world-handle first ;
-
-M: x-clipboard copy-clipboard
-    [ x-clipboard@ own-selection ] keep
-    set-x-clipboard-contents ;
-
-M: x-clipboard paste-clipboard
-    >r find-world world-handle first r> x-clipboard-atom
-    convert-selection ;
-
-: init-clipboard ( -- )
-    XA_PRIMARY <x-clipboard> selection set-global
-    "CLIPBOARD" x-atom <x-clipboard> clipboard set-global ;
diff --git a/core/ui/x11/constants.factor b/core/ui/x11/constants.factor
deleted file mode 100644 (file)
index c52de26..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-
-! Based on X.h
-
-USING: alien math ; IN: x11
-
-TYPEDEF: ulong Mask
-
-TYPEDEF: uchar KeyCode
-
-! Reserved Resource and Constant Definitions
-
-: ParentRelative 1 ;
-: CopyFromParent 0 ;
-: PointerWindow 0 ;
-: InputFocus 1 ;
-: PointerRoot 1 ;
-: AnyPropertyType 0 ;
-: AnyKey 0 ;
-: AnyButton 0 ;
-: AllTemporary 0 ;
-: CurrentTime 0 ;
-: NoSymbol 0 ;
-
-! Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
-!   state in various key-, mouse-, and button-related events.
-
-
-! modifier names.  Used to build a SetModifierMapping request or
-! to read a GetModifierMapping request.  These correspond to the
-! masks defined above.
-: ShiftMapIndex                0 ;
-: LockMapIndex         1 ;
-: ControlMapIndex      2 ;
-: Mod1MapIndex         3 ;
-: Mod2MapIndex         4 ;
-: Mod3MapIndex         5 ;
-: Mod4MapIndex         6 ;
-: Mod5MapIndex         7 ;
-
-
-! button masks.  Used in same manner as Key masks above. Not to be confused
-! with button names below.
-
-
-: AnyModifier          1 15 shift ; ! used in GrabButton, GrabKey
-
-! button names. Used as arguments to GrabButton and as detail in ButtonPress
-! and ButtonRelease events.  Not to be confused with button masks above.
-! Note that 0 is already defined above as "AnyButton".
-
-! Notify modes
-
-: NotifyNormal         0 ;
-: NotifyGrab           1 ;
-: NotifyUngrab         2 ;
-: NotifyWhileGrabbed   3 ;
-
-: NotifyHint           1 ; ! for MotionNotify events
-                      
-! Notify detail
-
-: NotifyAncestor        0 ;
-: NotifyVirtual                 1 ;
-: NotifyInferior        2 ;
-: NotifyNonlinear       3 ;
-: NotifyNonlinearVirtual 4 ;
-: NotifyPointer                 5 ;
-: NotifyPointerRoot     6 ;
-: NotifyDetailNone      7 ;
-
-! Visibility notify
-
-: VisibilityUnobscured         0 ;
-: VisibilityPartiallyObscured  1 ;
-: VisibilityFullyObscured      2 ;
-
-! Circulation request
-
-: PlaceOnTop           0 ;
-: PlaceOnBottom                1 ;
-
-! protocol families
-
-: FamilyInternet       0 ;     ! IPv4
-: FamilyDECnet         1 ;
-: FamilyChaos          2 ;
-: FamilyInternet6      6 ;     ! IPv6
-
-! authentication families not tied to a specific protocol
-: FamilyServerInterpreted 5 ;
-
-! Property notification
-
-: PropertyNewValue     0 ;
-: PropertyDelete       1 ;
-
-! Color Map notification
-
-: ColormapUninstalled  0 ;
-: ColormapInstalled    1 ;
-
-! GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes
-
-: GrabModeSync         0 ;
-: GrabModeAsync                1 ;
-
-! GrabPointer, GrabKeyboard reply status
-
-: GrabSuccess          0 ;
-: AlreadyGrabbed       1 ;
-: GrabInvalidTime      2 ;
-: GrabNotViewable      3 ;
-: GrabFrozen           4 ;
-
-! AllowEvents modes
-
-: AsyncPointer         0 ;
-: SyncPointer          1 ;
-: ReplayPointer                2 ;
-: AsyncKeyboard                3 ;
-: SyncKeyboard         4 ;
-: ReplayKeyboard       5 ;
-: AsyncBoth            6 ;
-: SyncBoth             7 ;
-
-! Used in SetInputFocus, GetInputFocus
-
-: RevertToNone         None ;
-: RevertToPointerRoot  PointerRoot ;
-: RevertToParent       2 ;
-
-! *****************************************************************
-! * ERROR CODES 
-! *****************************************************************
-
-: Success         0 ; ! everything's okay
-: BadRequest      1 ; ! bad request code
-: BadValue        2 ; ! int parameter out of range
-: BadWindow       3 ; ! parameter not a Window
-: BadPixmap       4 ; ! parameter not a Pixmap
-: BadAtom         5 ; ! parameter not an Atom
-: BadCursor       6 ; ! parameter not a Cursor
-: BadFont         7 ; ! parameter not a Font
-: BadMatch        8 ; ! parameter mismatch
-: BadDrawable     9 ; ! parameter not a Pixmap or Window
-: BadAccess      10 ; ! depending on context:
-                      !         - key/button already grabbed
-                      !         - attempt to free an illegal 
-                      !           cmap entry 
-                      !        - attempt to store into a read-only 
-                      !           color map entry.
-                      !        - attempt to modify the access control
-                      !           list from other than the local host.
-: BadAlloc         11 ; ! insufficient resources
-: BadColor         12 ; ! no such colormap
-: BadGC                    13 ; ! parameter not a GC
-: BadIDChoice      14 ; ! choice not in range or already used
-: BadName           15 ; ! font or color name doesn't exist
-: BadLength        16 ; ! Request length incorrect
-: BadImplementation 17 ; ! server is defective
-
-: FirstExtensionError  128 ;
-: LastExtensionError   255 ;
-
-! *****************************************************************
-! * WINDOW DEFINITIONS 
-! *****************************************************************
-
-! Window classes used by CreateWindow
-! Note that CopyFromParent is already defined as 0 above
-
-: InputOutput          1 ;
-: InputOnly            2 ;
-
-! Used in CreateWindow for backing-store hint
-
-: NotUseful               0 ;
-: WhenMapped              1 ;
-: Always                  2 ;
-
-! Used in ChangeSaveSet
-
-: SetModeInsert           0 ;
-: SetModeDelete           1 ;
-
-! Used in ChangeCloseDownMode
-
-: DestroyAll              0 ;
-: RetainPermanent         1 ;
-: RetainTemporary         2 ;
-
-! Window stacking method (in configureWindow)
-
-: Above                   0 ;
-: Below                   1 ;
-: TopIf                   2 ;
-: BottomIf                3 ;
-: Opposite                4 ;
-
-! Circulation direction
-
-: RaiseLowest             0 ;
-: LowerHighest            1 ;
-
-! Property modes
-
-: PropModeReplace         0 ;
-: PropModePrepend         1 ;
-: PropModeAppend          2 ;
-
-! *****************************************************************
-! * GRAPHICS DEFINITIONS
-! *****************************************************************
-
-! LineStyle
-
-: LineSolid            0 ;
-: LineOnOffDash                1 ;
-: LineDoubleDash       2 ;
-
-! capStyle
-
-: CapNotLast           0 ;
-: CapButt              1 ;
-: CapRound             2 ;
-: CapProjecting                3 ;
-
-! joinStyle
-
-: JoinMiter            0 ;
-: JoinRound            1 ;
-: JoinBevel            2 ;
-
-! fillStyle
-
-: FillSolid            0 ;
-: FillTiled            1 ;
-: FillStippled         2 ;
-: FillOpaqueStippled   3 ;
-
-! fillRule
-
-: EvenOddRule          0 ;
-: WindingRule          1 ;
-
-! subwindow mode
-
-: ClipByChildren       0 ;
-: IncludeInferiors     1 ;
-
-! SetClipRectangles ordering
-
-: Unsorted             0 ;
-: YSorted              1 ;
-: YXSorted             2 ;
-: YXBanded             3 ;
-
-! CoordinateMode for drawing routines
-
-: CoordModeOrigin   0 ; ! relative to the origin
-: CoordModePrevious 1 ; ! relative to previous point
-
-! Polygon shapes
-
-: Complex      0 ; ! paths may intersect
-: Nonconvex    1 ; ! no paths intersect, but not convex
-: Convex       2 ; ! wholly convex
-
-! Arc modes for PolyFillArc
-
-: ArcChord    0 ; ! join endpoints of arc
-: ArcPieSlice 1 ; ! join endpoints to center of arc
-
-! *****************************************************************
-! * FONTS 
-! *****************************************************************
-
-! used in QueryFont -- draw direction
-
-: FontLeftToRight              0 ;
-: FontRightToLeft              1 ;
-
-: FontChange           255 ;
-
-! *****************************************************************
-! *  IMAGING 
-! *****************************************************************
-
-! ImageFormat -- PutImage, GetImage
-
-: XYBitmap             0 ; ! depth 1, XYFormat
-: XYPixmap             1 ; ! depth == drawable depth
-: ZPixmap              2 ; ! depth == drawable depth
-
-! *****************************************************************
-! *  COLOR MAP STUFF 
-! *****************************************************************
-
-! For CreateColormap
-
-: AllocNone            0 ; ! create map with no entries
-: AllocAll             1 ; ! allocate entire map writeable
-
-
-! Flags used in StoreNamedColor, StoreColors
-
-: DoRed                1 0 shift ;
-: DoGreen      1 1 shift ;
-: DoBlue       1 2 shift ;
-
-! *****************************************************************
-! * CURSOR STUFF
-! *****************************************************************
-
-! QueryBestSize Class
-
-: CursorShape          0 ; ! largest size that can be displayed
-: TileShape            1 ; ! size tiled fastest
-: StippleShape         2 ; ! size stippled fastest
-
-! ***************************************************************** 
-! * KEYBOARD/POINTER STUFF
-! *****************************************************************
-
-: AutoRepeatModeOff    0 ;
-: AutoRepeatModeOn     1 ;
-: AutoRepeatModeDefault        2 ;
-
-: LedModeOff           0 ;
-: LedModeOn            1 ;
-
-! masks for ChangeKeyboardControl
-
-: KBKeyClickPercent    1 0 shift ;
-: KBBellPercent                1 1 shift ;
-: KBBellPitch          1 2 shift ;
-: KBBellDuration       1 3 shift ;
-: KBLed                        1 4 shift ;
-: KBLedMode            1 5 shift ;
-: KBKey                        1 6 shift ;
-: KBAutoRepeatMode     1 7 shift ;
-
-: MappingSuccess       0 ;
-: MappingBusy          1 ;
-: MappingFailed                2 ;
-
-: MappingModifier              0 ;
-: MappingKeyboard              1 ;
-: MappingPointer               2 ;
-
-! *****************************************************************
-! * SCREEN SAVER STUFF 
-! *****************************************************************
-
-: DontPreferBlanking   0 ;
-: PreferBlanking       1 ;
-: DefaultBlanking      2 ;
-
-: DisableScreenSaver   0 ;
-: DisableScreenInterval        0 ;
-
-: DontAllowExposures   0 ;
-: AllowExposures       1 ;
-: DefaultExposures     2 ;
-
-! for ForceScreenSaver
-
-: ScreenSaverReset 0 ;
-: ScreenSaverActive 1 ;
-
-! *****************************************************************
-! * HOSTS AND CONNECTIONS
-! *****************************************************************
-
-! for ChangeHosts
-
-: HostInsert           0 ;
-: HostDelete           1 ;
-
-! for ChangeAccessControl
-
-: EnableAccess         1 ;
-: DisableAccess                0 ;
-
-! Display classes  used in opening the connection 
-! Note that the statically allocated ones are even numbered and the
-! dynamically changeable ones are odd numbered
-
-: StaticGray           0 ;
-: GrayScale            1 ;
-: StaticColor          2 ;
-: PseudoColor          3 ;
-: TrueColor            4 ;
-: DirectColor          5 ;
-
-
-! Byte order  used in imageByteOrder and bitmapBitOrder
-
-: LSBFirst             0 ;
-: MSBFirst             1 ;
-
diff --git a/core/ui/x11/events.factor b/core/ui/x11/events.factor
deleted file mode 100644 (file)
index 408526e..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: x11
-USING: alien arrays errors gadgets hashtables io kernel math
-namespaces prettyprint sequences strings test threads ;
-
-GENERIC: expose-event ( event window -- )
-
-GENERIC: configure-event ( event window -- )
-
-GENERIC: button-down-event ( event window -- )
-
-GENERIC: button-up-event ( event window -- )
-
-GENERIC: enter-event ( event window -- )
-
-GENERIC: leave-event ( event window -- )
-
-GENERIC: wheel-event ( event window -- )
-
-GENERIC: motion-event ( event window -- )
-
-GENERIC: key-down-event ( event window -- )
-
-GENERIC: key-up-event ( event window -- )
-
-GENERIC: focus-in-event ( event window -- )
-
-GENERIC: focus-out-event ( event window -- )
-
-GENERIC: selection-notify-event ( event window -- )
-
-GENERIC: selection-request-event ( event window -- )
-
-GENERIC: client-event ( event window -- )
-
-: next-event ( -- event )
-    dpy get "XEvent" <c-object> dup >r XNextEvent drop r> ;
-
-: mask-event ( mask -- event )
-    >r dpy get r> "XEvent" <c-object> dup >r XMaskEvent drop r> ;
-
-: events-queued ( mode -- n ) >r dpy get r> XEventsQueued ;
-
-: wait-event ( -- event )
-    QueuedAfterFlush events-queued 0 >
-    [ next-event ] [ ui-step wait-event ] if ;
-
-: wheel? ( event -- ? ) XButtonEvent-button { 4 5 } member? ;
-
-: button-down-event$ ( event window -- )
-    over wheel? [ wheel-event ] [ button-down-event ] if ;
-
-: button-up-event$ ( event window -- )
-    over wheel? [ 2drop ] [ button-up-event ] if ;
-
-: handle-event ( event window -- )
-    over XAnyEvent-type {
-        { [ dup Expose = ] [ drop expose-event ] }
-        { [ dup ConfigureNotify = ] [ drop configure-event ] }
-        { [ dup ButtonPress = ] [ drop button-down-event$ ] }
-        { [ dup ButtonRelease = ] [ drop button-up-event$ ] }
-        { [ dup EnterNotify = ] [ drop enter-event ] }
-        { [ dup LeaveNotify = ] [ drop leave-event ] }
-        { [ dup MotionNotify = ] [ drop motion-event ] }
-        { [ dup KeyPress = ] [ drop key-down-event ] }
-        { [ dup KeyRelease = ] [ drop key-up-event ] }
-        { [ dup FocusIn = ] [ drop focus-in-event ] }
-        { [ dup FocusOut = ] [ drop focus-out-event ] }
-        { [ dup SelectionNotify = ] [ drop selection-notify-event ] }
-        { [ dup SelectionRequest = ] [ drop selection-request-event ] }
-        { [ dup ClientMessage = ] [ drop client-event ] }
-        { [ t ] [ 3drop ] }
-    } cond ;
-
-: do-events ( -- )
-    wait-event dup XAnyEvent-window window dup
-    [ [ 2dup handle-event ] assert-depth ] when 2drop ;
-
-: char-array>string ( n <char-array> -- string )
-    swap >string [ swap char-nth ] map-with ;
-
-: buf-size 100 ;
-
-: lookup-string ( event -- keysym string )
-    buf-size "char" <c-array> [
-        buf-size 0 <KeySym>
-        [ f XLookupString ] keep
-        *KeySym swap
-    ] keep char-array>string ;
diff --git a/core/ui/x11/glx-utils.factor b/core/ui/x11/glx-utils.factor
deleted file mode 100644 (file)
index 278a292..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos
-! See http://factorcode.org/license.txt for BSD license.
-IN: x11
-USING: alien arrays errors kernel namespaces sequences ;
-
-: choose-visual ( -- XVisualInfo* )
-    dpy get scr get
-    GLX_RGBA GLX_DOUBLEBUFFER 0 3array >int-array
-    glXChooseVisual
-    [ "Could not get a double-buffered GLX RGBA visual" throw ] unless* ;
-
-: create-context ( XVisualInfo* -- GLXContext )
-    >r dpy get r> f 1 glXCreateContext
-    [ "Failed to create GLX context" throw ] unless* ;
-    
-: destroy-context ( GLXContext -- )
-    dpy get swap glXDestroyContext ;
diff --git a/core/ui/x11/glx.factor b/core/ui/x11/glx.factor
deleted file mode 100644 (file)
index c1117a1..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Alex Chapman
-! See http://factorcode.org/license.txt for BSD license.
-!
-! based on glx.h from xfree86, and some of glxtokens.h
-IN: x11
-USING: alien ;
-
-LIBRARY: glx
-
-! Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib)
-: GLX_USE_GL           1  ; ! support GLX rendering
-: GLX_BUFFER_SIZE      2  ; ! depth of the color buffer
-: GLX_LEVEL            3  ; ! level in plane stacking
-: GLX_RGBA             4  ; ! true if RGBA mode
-: GLX_DOUBLEBUFFER     5  ; ! double buffering supported
-: GLX_STEREO           6  ; ! stereo buffering supported
-: GLX_AUX_BUFFERS      7  ; ! number of aux buffers
-: GLX_RED_SIZE         8  ; ! number of red component bits
-: GLX_GREEN_SIZE       9  ; ! number of green component bits
-: GLX_BLUE_SIZE                10 ; ! number of blue component bits
-: GLX_ALPHA_SIZE       11 ; ! number of alpha component bits
-: GLX_DEPTH_SIZE       12 ; ! number of depth bits
-: GLX_STENCIL_SIZE     13 ; ! number of stencil bits
-: GLX_ACCUM_RED_SIZE   14 ; ! number of red accum bits
-: GLX_ACCUM_GREEN_SIZE 15 ; ! number of green accum bits
-: GLX_ACCUM_BLUE_SIZE  16 ; ! number of blue accum bits
-: GLX_ACCUM_ALPHA_SIZE 17 ; ! number of alpha accum bits
-
-TYPEDEF: XID GLXContextID
-TYPEDEF: XID GLXPixmap
-TYPEDEF: XID GLXDrawable
-TYPEDEF: XID GLXPbuffer
-TYPEDEF: XID GLXWindow
-TYPEDEF: XID GLXFBConfigID
-TYPEDEF: void* GLXContext  ! typedef struct __GLXcontextRec *GLXContext;
-TYPEDEF: void* GLXFBConfig ! typedef struct __GLXFBConfigRec *GLXFBConfig;
-
-FUNCTION: XVisualInfo* glXChooseVisual ( Display* dpy, int screen, int* attribList ) ;
-FUNCTION: void glXCopyContext ( Display* dpy, GLXContext src, GLXContext dst, ulong mask ) ;
-FUNCTION: GLXContext glXCreateContext ( Display* dpy, XVisualInfo* vis, GLXContext shareList, bool direct ) ;
-FUNCTION: GLXPixmap glXCreateGLXPixmap ( Display* dpy, XVisualInfo* vis, Pixmap pixmap ) ;
-FUNCTION: void glXDestroyContext ( Display* dpy, GLXContext ctx ) ;
-FUNCTION: void glXDestroyGLXPixmap ( Display* dpy, GLXPixmap pix ) ;
-FUNCTION: int glXGetConfig ( Display* dpy, XVisualInfo* vis, int attrib, int* value) ;
-FUNCTION: GLXContext glXGetCurrentContext ( ) ;
-FUNCTION: GLXDrawable glXGetCurrentDrawable ( ) ;
-FUNCTION: bool glXIsDirect ( Display* dpy, GLXContext ctx ) ;
-FUNCTION: bool glXMakeCurrent ( Display* dpy, GLXDrawable drawable, GLXContext ctx ) ;
-FUNCTION: bool glXQueryExtension ( Display* dpy, int* errorBase, int* eventBase ) ;
-FUNCTION: bool glXQueryVersion ( Display* dpy, int* major, int* minor ) ;
-FUNCTION: void glXSwapBuffers ( Display* dpy, GLXDrawable drawable ) ;
-FUNCTION: void glXUseXFont ( Font font, int first, int count, int listBase ) ;
-FUNCTION: void glXWaitGL ( ) ;
-FUNCTION: void glXWaitX ( ) ;
-FUNCTION: char* glXGetClientString ( Display* dpy, int name ) ;
-FUNCTION: char* glXQueryServerString ( Display* dpy, int screen, int name ) ;
-FUNCTION: char* glXQueryExtensionsString ( Display* dpy, int screen ) ;
-
-! New for GLX 1.3
-FUNCTION: GLXFBConfig* glXGetFBConfigs ( Display* dpy, int screen, int* nelements ) ;
-FUNCTION: GLXFBConfig* glXChooseFBConfig ( Display* dpy, int screen, int* attrib_list, int* nelements ) ;
-FUNCTION: int glXGetFBConfigAttrib ( Display* dpy, GLXFBConfig config, int attribute, int* value ) ;
-FUNCTION: XVisualInfo* glXGetVisualFromFBConfig ( Display* dpy, GLXFBConfig config ) ;
-FUNCTION: GLXWindow glXCreateWindow ( Display* dpy, GLXFBConfig config, Window win, int* attrib_list ) ;
-FUNCTION: void glXDestroyWindow ( Display* dpy, GLXWindow win ) ;
-FUNCTION: GLXPixmap glXCreatePixmap ( Display* dpy, GLXFBConfig config, Pixmap pixmap, int* attrib_list ) ;
-FUNCTION: void glXDestroyPixmap ( Display* dpy, GLXPixmap pixmap ) ;
-FUNCTION: GLXPbuffer glXCreatePbuffer ( Display* dpy, GLXFBConfig config, int* attrib_list ) ;
-FUNCTION: void glXDestroyPbuffer ( Display* dpy, GLXPbuffer pbuf ) ;
-FUNCTION: void glXQueryDrawable ( Display* dpy, GLXDrawable draw, int attribute, uint* value ) ;
-FUNCTION: GLXContext glXCreateNewContext ( Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, bool direct ) ;
-FUNCTION: bool glXMakeContextCurrent ( Display* display, GLXDrawable draw, GLXDrawable read, GLXContext ctx ) ;
-FUNCTION: GLXDrawable glXGetCurrentReadDrawable ( ) ;
-FUNCTION: Display*  glXGetCurrentDisplay ( ) ;
-FUNCTION: int glXQueryContext ( Display* dpy, GLXContext ctx, int attribute, int* value ) ;
-FUNCTION: void glXSelectEvent ( Display* dpy, GLXDrawable draw, ulong event_mask ) ;
-FUNCTION: void glXGetSelectedEvent ( Display* dpy, GLXDrawable draw, ulong* event_mask ) ;
-
-! GLX 1.4 and later
-! extern void (*glXGetProcAddress(const GLubyte* procname))(void ) ;
-
-! glxext stuff skipped
-
-
-! GLX Events
-! (also skipped for now. only has GLXPbufferClobberEvent, the rest is handled by xlib methinks
-
diff --git a/core/ui/x11/load.factor b/core/ui/x11/load.factor
deleted file mode 100644 (file)
index 648453a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos
-! See http://factorcode.org/license.txt for BSD license.
-
-REQUIRES: core/ui/tools ;
-
-PROVIDE: core/ui/x11
-{ +files+ { 
-    "xlib.factor"
-    "glx.factor"
-    "constants.factor"
-    "utilities.factor"
-    "events.factor"
-    "glx-utils.factor"
-    "windows.factor"
-    "clipboard.factor"
-    "ui.factor"
-} } ;
\ No newline at end of file
diff --git a/core/ui/x11/ui.factor b/core/ui/x11/ui.factor
deleted file mode 100644 (file)
index 95bd513..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: x11
-USING: arrays errors freetype gadgets gadgets-listener
-gadgets-workspace hashtables kernel kernel-internals math
-namespaces opengl sequences strings timers ;
-
-! In the X11 backend, world-handle is a pair { window context }.
-! The window is an X11 window ID, and the context is a
-! GLX context pointer.
-
-M: world expose-event nip relayout ;
-
-: configured-loc ( event -- dim )
-    dup XConfigureEvent-x swap XConfigureEvent-y 2array ;
-
-: configured-dim ( event -- dim )
-    dup XConfigureEvent-width swap XConfigureEvent-height 2array ;
-
-M: world configure-event
-    over configured-loc over set-world-loc
-    swap configured-dim swap set-gadget-dim ;
-
-: modifiers
-    {
-        { S+ HEX: 1 }
-        { C+ HEX: 4 }
-        { A+ HEX: 8 }
-    } ;
-    
-: key-codes
-    H{
-        { HEX: FF08 "BACKSPACE" }
-        { HEX: FF09 "TAB"       }
-        { HEX: FF0D "RETURN"    }
-        { HEX: FF8D "ENTER"     }
-        { HEX: FF1B "ESCAPE"    }
-        { HEX: FFFF "DELETE"    }
-        { HEX: FF50 "HOME"      }
-        { HEX: FF51 "LEFT"      }
-        { HEX: FF52 "UP"        }
-        { HEX: FF53 "RIGHT"     }
-        { HEX: FF54 "DOWN"      }
-        { HEX: FF55 "PAGE_UP"   }
-        { HEX: FF56 "PAGE_DOWN" }
-        { HEX: FF57 "END"       }
-        { HEX: FF58 "BEGIN"     }
-        { HEX: FFBE "F1"        }
-        { HEX: FFBF "F2"        }
-        { HEX: FFC0 "F3"        }
-        { HEX: FFC1 "F4"        }
-        { HEX: FFC2 "F5"        }
-        { HEX: FFC3 "F6"        }
-        { HEX: FFC4 "F7"        }
-        { HEX: FFC5 "F8"        }
-        { HEX: FFC6 "F9"        }
-    } ;
-
-: ignored-key? ( keycode -- ? )
-    {
-        HEX: FFE1 HEX: FFE2 HEX: FFE3 HEX: FFE4 HEX: FFE5
-        HEX: FFE6 HEX: FFE7 HEX: FFE8 HEX: FFE9 HEX: FFEA
-        HEX: FFEB HEX: FFEC HEX: FFED HEX: FFEE
-    } member? ;
-
-: key-code ( event -- keycode )
-    lookup-string drop dup ignored-key? [
-        drop f
-    ] [
-        dup key-codes hash [ ] [ ch>string ] ?if
-    ] if ;
-
-: event-modifiers XKeyEvent-state modifiers modifier ;
-
-: key-event>gesture ( event -- modifiers gesture )
-    dup event-modifiers swap key-code ;
-
-: key-down-event>gesture ( event -- gesture )
-    key-event>gesture [ <key-down> ] [ drop f ] if* ;
-
-M: world key-down-event
-    world-focus over key-down-event>gesture [
-        over send-gesture
-        [ swap lookup-string nip swap user-input ] [ 2drop ] if
-    ] [
-        2drop
-    ] if* ;
-
-M: world key-up-event
-    world-focus swap key-event>gesture dup [
-        <key-up> dup [ swap send-gesture drop ] [ 2drop ] if
-    ] [
-        3drop
-    ] if ;
-
-: mouse-event-loc ( event -- loc )
-    dup XButtonEvent-x swap XButtonEvent-y 2array ;
-
-: mouse-event>gesture ( event -- modifiers button loc )
-    dup event-modifiers over XButtonEvent-button
-    rot mouse-event-loc ;
-
-M: world button-down-event
-    >r mouse-event>gesture >r <button-down> r> r>
-    send-button-down ;
-
-M: world button-up-event
-    >r mouse-event>gesture >r <button-up> r> r>
-    send-button-up ;
-
-: mouse-event>scroll-direction ( event -- pair )
-    #! Reminder for myself: 4 is up, 5 is down
-    XButtonEvent-button 5 = 1 -1 ? 0 swap 2array ;
-
-M: world wheel-event
-    >r dup mouse-event>scroll-direction swap mouse-event-loc r>
-    send-wheel ;
-
-M: world enter-event motion-event ;
-
-M: world leave-event 2drop forget-rollover ;
-
-M: world motion-event
-    >r dup XMotionEvent-x swap XMotionEvent-y 2array r>
-    move-hand fire-motion ;
-
-M: world focus-in-event nip focus-world ;
-
-M: world focus-out-event nip unfocus-world ;
-
-M: world selection-notify-event
-    [ world-handle first selection-from-event ] keep
-    world-focus user-input ;
-
-: supported-type? ( atom -- ? )
-    { "STRING" "UTF8_STRING" "TEXT" }
-    [ x-atom = ] contains-with? ;
-
-M: world selection-request-event
-    drop dup XSelectionRequestEvent-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 ] }
-        { [ t ] [ drop send-notify-failure ] }
-    } cond ;
-
-: close-box? ( event -- ? )
-    dup XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom =
-    swap XClientMessageEvent-data0 "WM_DELETE_WINDOW" x-atom =
-    and ;
-
-M: world client-event
-    swap close-box? [
-        dup world-handle
-        >r close-world
-        r> first2 destroy-window*
-    ] [
-        drop
-    ] if ;
-
-: gadget-window ( world -- )
-    [
-        dup world-loc over rect-dim glx-window >r
-        [ register-window ] keep r> 2array
-    ] keep set-world-handle ;
-
-: event-loop ( -- )
-    windows get empty? [
-        [ do-events ] ui-try event-loop
-    ] unless ;
-
-IN: gadgets
-
-: set-title ( string world -- )
-    world-handle first dpy get -rot swap XStoreName drop ;
-
-: open-window* ( world -- )
-    dup gadget-window
-    dup start-world
-    world-handle first dup set-closable map-window ;
-
-: raise-window ( world -- )
-    dpy get swap world-handle first XRaiseWindow drop ;
-
-: select-gl-context ( handle -- )
-    dpy get swap first2 glXMakeCurrent
-    [ "Failed to set current GLX context" throw ] unless ;
-
-: flush-gl-context ( handle -- )
-    dpy get swap first glXSwapBuffers ;
-
-IN: shells
-
-: ui ( -- )
-    [
-        f [
-            init-timers
-            init-clipboard
-            restore-windows? [
-                restore-windows
-            ] [
-                init-ui
-                workspace-window
-                drop
-            ] if
-            event-loop
-        ] with-x
-    ] with-freetype ;
-
-IN: command-line
-
-: default-shell "DISPLAY" os-env empty? "tty" "ui" ? ;
diff --git a/core/ui/x11/utilities.factor b/core/ui/x11/utilities.factor
deleted file mode 100644 (file)
index 5166bed..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: x11
-USING: alien arrays errors gadgets hashtables io kernel math
-namespaces prettyprint sequences threads ;
-
-: >int-array ( seq -- <int-array> )
-    dup length dup "int" <c-array> -rot
-    [ pick set-int-nth ] 2each ;
-
-SYMBOL: dpy
-SYMBOL: scr
-SYMBOL: root
-
-: flush-dpy ( -- ) dpy get XFlush drop ;
-
-: x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
-
-: check-display
-    [ "Cannot connect to X server - check $DISPLAY" throw ] unless* ;
-
-: initialize-x ( display-string -- )
-    dup [ string>char-alien ] when
-    XOpenDisplay check-display dpy set-global
-    dpy get XDefaultScreen scr set-global
-    dpy get scr get XRootWindow root set-global ;
-
-: close-x ( -- ) dpy get XCloseDisplay drop ;
-    
-: with-x ( display-string quot -- )
-    >r initialize-x r> [ close-x ] cleanup ;
diff --git a/core/ui/x11/windows.factor b/core/ui/x11/windows.factor
deleted file mode 100644 (file)
index 2ec8591..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: x11
-USING: alien gadgets hashtables kernel math namespaces sequences ;
-
-: create-window-mask ( -- n )
-    CWBackPixel CWBorderPixel bitor
-    CWColormap bitor CWEventMask bitor ;
-
-: create-colormap ( visinfo -- colormap )
-    dpy get root get rot XVisualInfo-visual AllocNone
-    XCreateColormap ;
-
-: event-mask ( -- n )
-    ExposureMask
-    StructureNotifyMask bitor
-    KeyPressMask bitor
-    KeyReleaseMask bitor
-    ButtonPressMask    bitor
-    ButtonReleaseMask bitor
-    PointerMotionMask bitor
-    FocusChangeMask bitor
-    EnterWindowMask bitor
-    LeaveWindowMask bitor
-    PropertyChangeMask bitor ;
-
-: window-attributes ( visinfo -- attributes )
-    "XSetWindowAttributes" <c-object>
-    0 over set-XSetWindowAttributes-background_pixel
-    0 over set-XSetWindowAttributes-border_pixel
-    [ >r create-colormap r> set-XSetWindowAttributes-colormap ] keep
-    event-mask over set-XSetWindowAttributes-event_mask ;
-
-: set-size-hints ( window -- )
-    "XSizeHints" <c-object>
-    USPosition over set-XSizeHints-flags
-    dpy get -rot XSetWMNormalHints ;
-
-: auto-position ( window loc -- )
-    { 0 0 } = [ drop ] [ set-size-hints ] if ;
-
-: create-window ( loc dim visinfo -- window )
-    pick >r
-    >r >r >r dpy get root get r> first2 r> first2 0 r>
-    [ XVisualInfo-depth InputOutput ] keep
-    [ XVisualInfo-visual create-window-mask ] keep
-    window-attributes XCreateWindow
-    dup r> auto-position ;
-
-: glx-window ( loc dim -- window context )
-    choose-visual
-    [ create-window ] keep [ create-context ] keep
-    XFree ;
-
-: destroy-window ( win -- )
-    dpy get swap XDestroyWindow drop ;
-
-: destroy-window* ( win context -- )
-    destroy-context dup unregister-window destroy-window ;
-
-: set-closable ( win -- )
-    dpy get swap "WM_DELETE_WINDOW" x-atom <Atom> 1
-    XSetWMProtocols drop ;
-
-: map-window ( win -- ) dpy get swap XMapWindow drop ;
-
-: unmap-window ( win -- ) dpy get swap XUnmapWindow drop ;
diff --git a/core/ui/x11/xlib.factor b/core/ui/x11/xlib.factor
deleted file mode 100644 (file)
index 8f5cabc..0000000
+++ /dev/null
@@ -1,1342 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos
-! See http://factorcode.org/license.txt for BSD license.
-!
-! The most popular guides to programming the X Window System are
-! the series from Oreilly. For programming with Xlib, there is
-! the reference manual and the programmers guide. However, a
-! lesser known manual is the free Xlib manual that comes with
-! the MIT X distribution. The arrangement and order of these
-! bindings follows the structure of the free Xlib manual. If you
-! add to this library and are wondering what part of the file to
-! modify, just find the function or data structure in the manual
-! and note the section.
-
-USING: kernel arrays alien math words sequences ;
-IN: x11
-
-LIBRARY: xlib
-
-TYPEDEF: ulong XID
-TYPEDEF: XID Window
-TYPEDEF: XID Drawable
-TYPEDEF: XID Font
-TYPEDEF: XID Pixmap
-TYPEDEF: XID Cursor
-TYPEDEF: XID Colormap
-TYPEDEF: XID GContext
-TYPEDEF: XID KeySym
-
-TYPEDEF: ulong Atom
-
-TYPEDEF: char* XPointer
-TYPEDEF: void* Display*
-TYPEDEF: void* Screen*
-TYPEDEF: void* GC
-TYPEDEF: void* Visual*
-TYPEDEF: void* XExtData*
-TYPEDEF: void* XFontProp*
-TYPEDEF: void* XComposeStatus*
-
-TYPEDEF: int Status
-
-TYPEDEF: int Bool
-
-TYPEDEF: ulong VisualID
-TYPEDEF: ulong Time
-
-TYPEDEF: void* Window**
-TYPEDEF: void* Atom**
-
-: <XID> <ulong> ; inline
-: <Window> <XID> ; inline
-: <Drawable> <XID> ; inline
-: <KeySym> <XID> ; inline
-: <Atom> <ulong> ; inline
-
-: *XID *ulong ; inline
-: *Window *XID ; inline
-: *Drawable *XID ; inline
-: *KeySym *XID ; inline
-: *Atom *ulong ; inline
-!
-! 2 - Display Functions
-!
-
-FUNCTION: Display* XOpenDisplay ( void* display_name ) ;
-
-! 2.2 Obtaining Information about the Display, Image Formats, or Screens
-
-FUNCTION: ulong XBlackPixel ( Display* display, int screen_number ) ;
-FUNCTION: ulong XWhitePixel ( Display* display, int screen_number ) ;
-FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number ) ;
-FUNCTION: int XDefaultDepth ( Display* display, int screen_number ) ;
-FUNCTION: GC XDefaultGC ( Display* display, int screen_number ) ;
-FUNCTION: int XDefaultScreen ( Display* display ) ;
-FUNCTION: Window XRootWindow ( Display* display, int screen_number ) ;
-FUNCTION: Window XDefaultRootWindow ( Display* display ) ;
-FUNCTION: int XProtocolVersion ( Display* display ) ;
-FUNCTION: int XProtocolRevision ( Display* display ) ;
-FUNCTION: int XQLength ( Display* display ) ;
-FUNCTION: int XScreenCount ( Display* display ) ;
-FUNCTION: int XConnectionNumber ( Display* display ) ;
-
-! 2.5 Closing the Display
-FUNCTION: int XCloseDisplay ( Display* display ) ;
-
-!
-! 3 - Window Functions
-!
-
-! 3.2 - Window Attributes
-
-: CWBackPixmap         1 0 shift ; inline
-: CWBackPixel          1 1 shift ; inline
-: CWBorderPixmap       1 2 shift ; inline
-: CWBorderPixel         1 3 shift ; inline
-: CWBitGravity         1 4 shift ; inline
-: CWWinGravity         1 5 shift ; inline
-: CWBackingStore        1 6 shift ; inline
-: CWBackingPlanes      1 7 shift ; inline
-: CWBackingPixel       1 8 shift ; inline
-: CWOverrideRedirect   1 9 shift ; inline
-: CWSaveUnder          1 10 shift ; inline
-: CWEventMask          1 11 shift ; inline
-: CWDontPropagate      1 12 shift ; inline
-: CWColormap           1 13 shift ; inline
-: CWCursor             1 14 shift ; inline
-
-BEGIN-STRUCT: XSetWindowAttributes
-       FIELD: Pixmap background_pixmap
-       FIELD: ulong background_pixel
-       FIELD: Pixmap border_pixmap
-       FIELD: ulong border_pixel
-       FIELD: int bit_gravity
-       FIELD: int win_gravity
-       FIELD: int backing_store
-       FIELD: ulong backing_planes
-       FIELD: ulong backing_pixel
-       FIELD: Bool save_under
-       FIELD: long event_mask
-       FIELD: long do_not_propagate_mask
-       FIELD: Bool override_redirect
-       FIELD: Colormap colormap
-       FIELD: Cursor cursor
-END-STRUCT
-
-: UnmapGravity         0 ; inline
-
-: ForgetGravity                0 ; inline
-: NorthWestGravity     1 ; inline
-: NorthGravity         2 ; inline
-: NorthEastGravity     3 ; inline
-: WestGravity          4 ; inline
-: CenterGravity                5 ; inline
-: EastGravity          6 ; inline
-: SouthWestGravity     7 ; inline
-: SouthGravity         8 ; inline
-: SouthEastGravity     9 ; inline
-: StaticGravity                10 ; inline
-
-! 3.3 - Creating Windows
-
-FUNCTION: Window XCreateWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class, Visual* visual, ulong valuemask, XSetWindowAttributes* attributes ) ;
-FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ;
-FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ;
-FUNCTION: Status XMapWindow ( Display* display, Window window ) ;
-FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ;
-FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ;
-FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ;
-
-! 3.5 Mapping Windows
-
-FUNCTION: int XMapRaised ( Display* display, Window w ) ;
-
-! 3.7 - Configuring Windows
-
-: CWX                  1 0 shift ; inline
-: CWY                  1 1 shift ; inline
-: CWWidth              1 2 shift ; inline
-: CWHeight             1 3 shift ; inline
-: CWBorderWidth                1 4 shift ; inline
-: CWSibling            1 5 shift ; inline
-: CWStackMode          1 6 shift ; inline
-
-BEGIN-STRUCT: XWindowChanges
-       FIELD: int x
-       FIELD: int y
-       FIELD: int width
-       FIELD: int height
-       FIELD: int border_width
-       FIELD: Window sibling
-       FIELD: int stack_mode
-END-STRUCT
-
-FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ;
-FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ;
-FUNCTION: Status XResizeWindow ( Display* display, Window w, uint width, uint height ) ;
-FUNCTION: Status XSetWindowBorderWidth ( Display* display, ulong w, uint width ) ;
-
-
-! 3.8 Changing Window Stacking Order
-
-FUNCTION: Status XRaiseWindow ( Display* display, Window w ) ;
-FUNCTION: Status XLowerWindow ( Display* display, Window w ) ;
-
-! 3.9 - Changing Window Attributes
-
-FUNCTION: Status XChangeWindowAttributes (
-  Display* display, Window w, ulong valuemask, XSetWindowAttributes* attr ) ;
-FUNCTION: Status XSetWindowBackground (
-  Display* display, Window w, ulong background_pixel ) ;
-FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor ) ;
-FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 4 - Window Information Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 4.1 - Obtaining Window Information
-
-FUNCTION: Status XQueryTree (
-  Display* display,
-  Window w,
-  Window* root_return,
-  Window* parent_return,
-  Window** children_return, uint* nchildren_return ) ;
-
-BEGIN-STRUCT: XWindowAttributes
-       FIELD: int x
-       FIELD: int y
-       FIELD: int width
-       FIELD: int  height
-       FIELD: int border_width
-       FIELD: int depth
-       FIELD: Visual* visual
-       FIELD: Window root
-       FIELD: int class
-       FIELD: int bit_gravity
-       FIELD: int win_gravity
-       FIELD: int backing_store
-       FIELD: ulong backing_planes
-       FIELD: ulong backing_pixel
-       FIELD: Bool save_under
-       FIELD: Colormap colormap
-       FIELD: Bool map_installed
-       FIELD: int map_state
-       FIELD: long all_event_masks
-       FIELD: long your_event_mask
-       FIELD: long do_not_propagate_mask
-       FIELD: Bool override_redirect
-       FIELD: Screen* screen
-END-STRUCT
-
-FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
-
-: IsUnmapped           0 ; inline
-: IsUnviewable         1 ; inline
-: IsViewable           2 ; inline
-
-FUNCTION: Status XGetGeometry (
-  Display* display,
-  Drawable d,
-  Window* root_return,
-  int* x_return,
-  int* y_return,
-  uint* width_return,
-  uint* height_return,
-  uint* border_width_return,
-  uint* depth_return ) ;
-
-! 4.2 - Translating Screen Coordinates
-
-FUNCTION: Bool XQueryPointer ( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, uint* mask_return ) ;
-
-! 4.3 - Properties and Atoms
-
-FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
-
-FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
-
-! 4.4 - Obtaining and Changing Window Properties
-
-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 ) ;
-
-FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ;
-
-! 4.5 Selections
-
-FUNCTION: int XSetSelectionOwner ( Display* display, Atom selection, Window owner, Time time ) ;
-
-FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ;
-
-FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 6 - Color Management Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XColor
-       FIELD: ulong pixel
-       FIELD: ushort red
-       FIELD: ushort green
-       FIELD: ushort blue
-       FIELD: char flags
-       FIELD: char pad
-END-STRUCT
-
-FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
-FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
-FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
-
-! 6.4 Creating, Copying, and Destroying Colormaps
-
-FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 7 - Graphics Context Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: GCFunction            1 0 shift ; inline
-: GCPlaneMask           1 1 shift ; inline
-: GCForeground          1 2 shift ; inline
-: GCBackground          1 3 shift ; inline
-: GCLineWidth           1 4 shift ; inline
-: GCLineStyle           1 5 shift ; inline
-: GCCapStyle            1 6 shift ; inline
-: GCJoinStyle          1 7 shift ; inline
-: GCFillStyle          1 8 shift ; inline
-: GCFillRule           1 9 shift ; inline
-: GCTile               1 10 shift ; inline
-: GCStipple            1 11 shift ; inline
-: GCTileStipXOrigin    1 12 shift ; inline
-: GCTileStipYOrigin    1 13 shift ; inline
-: GCFont               1 14 shift ; inline
-: GCSubwindowMode      1 15 shift ; inline
-: GCGraphicsExposures   1 16 shift ; inline
-: GCClipXOrigin                1 17 shift ; inline
-: GCClipYOrigin                1 18 shift ; inline
-: GCClipMask           1 19 shift ; inline
-: GCDashOffset         1 20 shift ; inline
-: GCDashList           1 21 shift ; inline
-: GCArcMode            1 22 shift ; inline
-
-: GXclear              HEX: 0 ; inline
-: GXand                        HEX: 1 ; inline
-: GXandReverse         HEX: 2 ; inline
-: GXcopy               HEX: 3 ; inline
-: GXandInverted                HEX: 4 ; inline
-: GXnoop               HEX: 5 ; inline
-: GXxor                        HEX: 6 ; inline
-: GXor                 HEX: 7 ; inline
-: GXnor                        HEX: 8 ; inline
-: GXequiv              HEX: 9 ; inline
-: GXinvert             HEX: a ; inline
-: GXorReverse          HEX: b ; inline
-: GXcopyInverted       HEX: c ; inline
-: GXorInverted         HEX: d ; inline
-: GXnand               HEX: e ; inline
-: GXset                        HEX: f ; inline
-
-BEGIN-STRUCT: XGCValues
-       FIELD: int function
-       FIELD: ulong plane_mask
-       FIELD: ulong foreground
-       FIELD: ulong background
-       FIELD: int line_width
-       FIELD: int line_style
-       FIELD: int cap_style
-       FIELD: int join_style
-       FIELD: int fill_style
-       FIELD: int fill_rule
-       FIELD: int arc_mode
-       FIELD: Pixmap tile
-       FIELD: Pixmap stipple
-       FIELD: int ts_x_origin
-       FIELD: int ts_y_origin
-       FIELD: Font font
-       FIELD: int subwindow_mode
-       FIELD: Bool graphics_exposures
-       FIELD: int clip_x_origin
-       FIELD: int clip_y_origin
-       FIELD: Pixmap clip_mask
-       FIELD: int dash_offset
-       FIELD: char dashes
-END-STRUCT
-
-FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
-FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
-FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ;
-FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ;
-FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ;
-FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ;
-FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ;
-
-: ClipByChildren 0 ; inline
-: IncludeInferiors 1 ; inline
-
-FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 8 - Graphics Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
-FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
-FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ;
-FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
-FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
-
-! 8.5 - Font Metrics
-
-BEGIN-STRUCT: XCharStruct
-       FIELD: short lbearing;
-       FIELD: short rbearing;
-       FIELD: short width;
-       FIELD: short ascent;
-       FIELD: short descent;
-       FIELD: ushort attributes;
-END-STRUCT
-
-FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
-
-BEGIN-STRUCT: XFontStruct
-       FIELD: XExtData* ext_data
-       FIELD: Font fid
-       FIELD: uint direction
-       FIELD: uint min_char_or_byte2
-       FIELD: uint max_char_or_byte2
-       FIELD: uint min_byte1
-       FIELD: uint max_byte1
-       FIELD: Bool all_chars_exist
-       FIELD: uint default_char
-       FIELD: int n_properties
-       FIELD: XFontProp* properties
-       FIELD: XCharStruct min_bounds
-       FIELD: XCharStruct max_bounds
-       FIELD: XCharStruct* per_char
-       FIELD: int ascent
-       FIELD: int descent
-END-STRUCT
-
-FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
-
-! 8.6 - Drawing Text
-
-FUNCTION: Status XDrawString (
-       Display* display,
-       Drawable d,
-       GC gc,
-       int x,
-       int y,
-       char* string,
-       int length ) ;
-
-!
-! 9 - Window and Session Manager Functions
-!
-
-FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ;
-FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ;
-FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ;
-FUNCTION: Status XGrabServer ( Display* display ) ;
-FUNCTION: Status XUngrabServer ( Display* display ) ;
-FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 10 - Events
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 10.3 - Event Masks
-
-: NoEventMask                  0 ; inline
-: KeyPressMask                 1 0 shift ; inline
-: KeyReleaseMask               1 1 shift ; inline
-: ButtonPressMask              1 2 shift ; inline
-: ButtonReleaseMask            1 3 shift ; inline
-: EnterWindowMask              1 4 shift ; inline
-: LeaveWindowMask              1 5 shift ; inline
-: PointerMotionMask            1 6 shift ; inline
-: PointerMotionHintMask                1 7 shift ; inline
-: Button1MotionMask            1 8 shift ; inline
-: Button2MotionMask            1 9 shift ; inline
-: Button3MotionMask            1 10 shift ; inline
-: Button4MotionMask            1 11 shift ; inline
-: Button5MotionMask            1 12 shift ; inline
-: ButtonMotionMask             1 13 shift ; inline
-: KeymapStateMask              1 14 shift ; inline
-: ExposureMask                 1 15 shift ; inline
-: VisibilityChangeMask         1 16 shift ; inline
-: StructureNotifyMask          1 17 shift ; inline
-: ResizeRedirectMask           1 18 shift ; inline
-: SubstructureNotifyMask       1 19 shift ; inline
-: SubstructureRedirectMask     1 20 shift ; inline
-: FocusChangeMask              1 21 shift ; inline
-: PropertyChangeMask           1 22 shift ; inline
-: ColormapChangeMask           1 23 shift ; inline
-: OwnerGrabButtonMask          1 24 shift ; inline
-
-: KeyPress             2 ; inline
-: KeyRelease           3 ; inline
-: ButtonPress          4 ; inline
-: ButtonRelease                5 ; inline
-: MotionNotify         6 ; inline
-: EnterNotify          7 ; inline
-: LeaveNotify          8 ; inline
-: FocusIn                      9 ; inline
-: FocusOut             10 ; inline
-: KeymapNotify         11 ; inline
-: Expose                       12 ; inline
-: GraphicsExpose               13 ; inline
-: NoExpose             14 ; inline
-: VisibilityNotify     15 ; inline
-: CreateNotify         16 ; inline
-: DestroyNotify                17 ; inline
-: UnmapNotify          18 ; inline
-: MapNotify            19 ; inline
-: MapRequest           20 ; inline
-: ReparentNotify               21 ; inline
-: ConfigureNotify              22 ; inline
-: ConfigureRequest     23 ; inline
-: GravityNotify                24 ; inline
-: ResizeRequest                25 ; inline
-: CirculateNotify              26 ; inline
-: CirculateRequest     27 ; inline
-: PropertyNotify               28 ; inline
-: SelectionClear               29 ; inline
-: SelectionRequest     30 ; inline
-: SelectionNotify              31 ; inline
-: ColormapNotify               32 ; inline
-: ClientMessage                33 ; inline
-: MappingNotify                34 ; inline
-: LASTEvent            35 ; inline
-
-
-
-BEGIN-STRUCT: XAnyEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 10.5 Keyboard and Pointer Events
-
-: Button1 1 ; inline
-: Button2 2 ; inline
-: Button3 3 ; inline
-: Button4 4 ; inline
-: Button5 5 ; inline
-
-: Button1Mask          1 8  shift ; inline
-: Button2Mask          1 9  shift ; inline
-: Button3Mask          1 10 shift ; inline
-: Button4Mask          1 11 shift ; inline
-: Button5Mask          1 12 shift ; inline
-
-: ShiftMask    1 0 shift ; inline
-: LockMask     1 1 shift ; inline
-: ControlMask  1 2 shift ; inline
-: Mod1Mask     1 3 shift ; inline
-: Mod2Mask     1 4 shift ; inline
-: Mod3Mask     1 5 shift ; inline
-: Mod4Mask     1 6 shift ; inline
-: Mod5Mask     1 7 shift ; inline
-
-BEGIN-STRUCT: XButtonEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Window root
-       FIELD: Window subwindow
-       FIELD: Time time
-       FIELD: int x
-       FIELD: int y
-       FIELD: int x_root
-       FIELD: int y_root
-       FIELD: uint state
-       FIELD: uint button
-       FIELD: Bool same_screen
-END-STRUCT
-
-TYPEDEF: XButtonEvent XButtonPressedEvent
-TYPEDEF: XButtonEvent XButtonReleasedEvent
-
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XKeyEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Window root
-       FIELD: Window subwindow
-       FIELD: Time time
-       FIELD: int x
-       FIELD: int y
-       FIELD: int x_root
-       FIELD: int y_root
-       FIELD: uint state
-       FIELD: uint keycode
-       FIELD: Bool same_screen
-END-STRUCT
-
-TYPEDEF: XKeyEvent XKeyPressedEvent
-TYPEDEF: XKeyEvent XKeyReleasedEvent
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XMotionEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Window root
-       FIELD: Window subwindow
-       FIELD: Time time
-       FIELD: int x
-       FIELD: int y
-       FIELD: int x_root
-       FIELD: int y_root
-       FIELD: uint state
-       FIELD: char is_hint
-       FIELD: Bool same_screen
-END-STRUCT
-
-TYPEDEF: XMotionEvent XPointerMovedEvent
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XCrossingEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Window root
-       FIELD: Window subwindow
-       FIELD: Time time
-       FIELD: int x
-       FIELD: int y
-       FIELD: int x_root
-       FIELD: int y_root
-       FIELD: int mode
-       FIELD: int detail
-       FIELD: Bool same_screen
-       FIELD: Bool focus
-       FIELD: uint state
-END-STRUCT
-
-TYPEDEF: XCrossingEvent XEnterWindowEvent
-TYPEDEF: XCrossingEvent XLeaveWindowEvent
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XFocusChangeEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: int mode
-       FIELD: int detail
-END-STRUCT
-
-TYPEDEF: XFocusChangeEvent XFocusInEvent
-TYPEDEF: XFocusChangeEvent XFocusOutEvent
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XExposeEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: int x
-       FIELD: int y
-       FIELD: int width
-       FIELD: int height
-       FIELD: int count
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XGraphicsExposeEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Drawable drawable
-       FIELD: int x
-       FIELD: int y
-       FIELD: int width
-       FIELD: int height
-       FIELD: int count
-       FIELD: int major_code
-       FIELD: int minor_code
-END-STRUCT
-
-BEGIN-STRUCT: XNoExposeEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Drawable drawable
-       FIELD: int major_code
-       FIELD: int minor_code
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XVisibilityEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: int state
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XCreateWindowEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window parent
-       FIELD: Window window
-       FIELD: int x
-       FIELD: int y
-       FIELD: int width
-       FIELD: int height
-       FIELD: int border_width
-       FIELD: Bool override_redirect
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XDestroyWindowEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window event
-       FIELD: Window window
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XUnmapEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window event
-       FIELD: Window window
-       FIELD: Bool from_configure
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XMapEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window event
-       FIELD: Window window
-       FIELD: Bool override_redirect
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XMapRequestEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window parent
-       FIELD: Window window
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XReparentEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window event
-       FIELD: Window window
-       FIELD: Window parent
-       FIELD: int x
-       FIELD: int y
-       FIELD: Bool override_redirect
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XConfigureEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window event
-       FIELD: Window window
-       FIELD: int x
-       FIELD: int y
-       FIELD: int width
-       FIELD: int height
-       FIELD: int border_width
-       FIELD: Window above
-       FIELD: Bool override_redirect
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XGravityEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window event
-       FIELD: Window window
-       FIELD: int x
-       FIELD: int y
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XResizeRequestEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: int width
-       FIELD: int height
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XConfigureRequestEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window parent
-       FIELD: Window window
-       FIELD: int x
-       FIELD: int y
-       FIELD: int width
-       FIELD: int height
-       FIELD: int border_width
-       FIELD: Window above
-       FIELD: int detail
-       FIELD: ulong value_mask
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XCirculateEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window event
-       FIELD: Window window
-       FIELD: int place
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XCirculateRequestEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window parent
-       FIELD: Window window
-       FIELD: int place
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XPropertyEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Atom atom
-       FIELD: Time time
-       FIELD: int state
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XSelectionClearEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Atom selection
-       FIELD: Time time
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XSelectionRequestEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window owner
-       FIELD: Window requestor
-       FIELD: Atom selection
-       FIELD: Atom target
-       FIELD: Atom property
-       FIELD: Time time
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XSelectionEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window requestor
-       FIELD: Atom selection
-       FIELD: Atom target
-       FIELD: Atom property
-       FIELD: Time time
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XColormapEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Colormap colormap
-       FIELD: Bool new
-       FIELD: int state
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XClientMessageEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: Atom message_type
-       FIELD: int format
-       FIELD: long data0
-       FIELD: long data1
-       FIELD: long data2
-       FIELD: long data3
-       FIELD: long data4
-!       union {
-!              char  b[20];
-!              short s[10];
-!              long  l[5];
-!      } data;
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XMappingEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       FIELD: int request
-       FIELD: int first_keycode
-       FIELD: int count
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XErrorEvent
-       FIELD: int type
-       FIELD: Display* display
-       FIELD: XID resourceid
-       FIELD: ulong serial
-       FIELD: uchar error_code
-       FIELD: uchar request_code
-       FIELD: uchar minor_code
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-BEGIN-STRUCT: XKeymapEvent
-       FIELD: int type
-       FIELD: ulong serial
-       FIELD: Bool send_event
-       FIELD: Display* display
-       FIELD: Window window
-       ! char key_vector[32];
-       FIELD: int pad
-       FIELD: int pad
-       FIELD: int pad
-       FIELD: int pad
-       FIELD: int pad
-       FIELD: int pad
-       FIELD: int pad
-       FIELD: int pad
-END-STRUCT
-
-C-UNION: XEvent
-       int
-       XAnyEvent
-       XKeyEvent
-       XButtonEvent
-       XMotionEvent
-       XCrossingEvent
-       XFocusChangeEvent
-       XExposeEvent
-       XGraphicsExposeEvent
-       XNoExposeEvent
-       XVisibilityEvent
-       XCreateWindowEvent
-       XDestroyWindowEvent
-       XUnmapEvent
-       XMapEvent
-       XMapRequestEvent
-       XReparentEvent
-       XConfigureEvent
-       XGravityEvent
-       XResizeRequestEvent
-       XConfigureRequestEvent
-       XCirculateEvent
-       XCirculateRequestEvent
-       XPropertyEvent
-       XSelectionClearEvent
-       XSelectionRequestEvent
-       XSelectionEvent
-       XColormapEvent
-       XClientMessageEvent
-       XMappingEvent
-       XErrorEvent
-       XKeymapEvent
-;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 11 - Event Handling Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
-FUNCTION: Status XFlush ( Display* display ) ;
-FUNCTION: Status XSync ( Display* display, int discard ) ;
-FUNCTION: int XPending ( Display* display ) ;
-FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
-FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
-
-! 11.3 - Event Queue Management
-
-: QueuedAlready 0 ; inline
-: QueuedAfterReading 1 ; inline
-: QueuedAfterFlush 2 ; inline
-
-FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
-FUNCTION: int XPending ( Display* display ) ;
-
-! 11.6 - Sending Events to Other Applications
-
-FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
-
-! 11.8 - Handling Protocol Errors
-
-FUNCTION: int XSetErrorHandler ( void* handler ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 12 - Input Device Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: None 0 ; inline
-: PointerRoot 1 ; inline
-
-: RevertToNone         None ; inline
-: RevertToPointerRoot  PointerRoot ; inline
-: RevertToParent       2 ; inline
-
-: GrabModeSync         0 ; inline
-: GrabModeAsync                1 ; inline
-
-
-FUNCTION: int XGrabPointer (
-  Display* display,
-  Window grab_window,
-  Bool owner_events,
-  uint event_mask,
-  int pointer_mode,
-  int keyboard_mode,
-  Window confine_to,
-  Cursor cursor,
-  Time time ) ;
-
-FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
-FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
-FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
-FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
-FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 14 - Inter-Client Communication Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 14.1 Client to Window Manager Communication
-
-FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
-FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
-
-! 14.1.1.  Manipulating Top-Level Windows
-
-FUNCTION: Status XIconifyWindow (
-       Display* display, Window w, int screen_number ) ;
-
-FUNCTION: Status XWithdrawWindow (
-       Display* display, Window w, int screen_number ) ;
-
-! 14.1.6 - Setting and Reading the WM_HINTS Property
-
-! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
-
-: USPosition   1 0 shift ; inline
-: USSize       1 1 shift ; inline
-: PPosition    1 2 shift ; inline
-: PSize                1 3 shift ; inline
-: PMinSize     1 4 shift ; inline
-: PMaxSize     1 5 shift ; inline
-: PResizeInc   1 6 shift ; inline
-: PAspect      1 7 shift ; inline
-: PBaseSize    1 8 shift ; inline
-: PWinGravity  1 9 shift ; inline
-: PAllHints [ PPosition PSize PMinSize PMaxSize PResizeInc PAspect ]
-0 [ execute bitor ] reduce ; inline
-
-BEGIN-STRUCT: XSizeHints
-    FIELD: long flags
-    FIELD: int x
-    FIELD: int y
-    FIELD: int width
-    FIELD: int height
-    FIELD: int min_width
-    FIELD: int min_height
-    FIELD: int max_width
-    FIELD: int max_height
-    FIELD: int width_inc
-    FIELD: int height_inc
-    FIELD: int min_aspect_x
-    FIELD: int min_aspect_y
-    FIELD: int max_aspect_x
-    FIELD: int max_aspect_y
-    FIELD: int base_width
-    FIELD: int base_height
-    FIELD: int win_gravity;
-END-STRUCT
-
-! 14.1.10.  Setting and Reading the WM_PROTOCOLS Property
-
-FUNCTION: Status XSetWMProtocols (
-       Display* display, Window w, Atom* protocols, int count ) ;
-
-FUNCTION: Status XGetWMProtocols (
-       Display* display,
-       Window w,
-       Atom** protocols_return,
-       int* count_return ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 16 - Application Utility Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 16.1 Keyboard Utility Functions
-
-FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
-
-FUNCTION: int XLookupString (
-       XKeyEvent* event_struct,
-       void* buffer_return,
-       int bytes_buffer,
-       KeySym* keysym_return,
-       XComposeStatus* status_in_out ) ;
-
-! 16.7 Determining the Appropriate Visual Type
-
-: VisualNoMask                 HEX: 0 ; inline
-: VisualIDMask                         HEX: 1 ; inline
-: VisualScreenMask             HEX: 2 ; inline
-: VisualDepthMask              HEX: 4 ; inline
-: VisualClassMask              HEX: 8 ; inline
-: VisualRedMaskMask            HEX: 10 ; inline
-: VisualGreenMaskMask          HEX: 20 ; inline
-: VisualBlueMaskMask           HEX: 40 ; inline
-: VisualColormapSizeMask       HEX: 80 ; inline
-: VisualBitsPerRGBMask         HEX: 100 ; inline
-: VisualAllMask                        HEX: 1FF ; inline
-
-BEGIN-STRUCT: XVisualInfo
-       FIELD: Visual* visual
-       FIELD: VisualID visualid
-       FIELD: int screen
-       FIELD: uint depth
-       FIELD: int class
-       FIELD: ulong red_mask
-       FIELD: ulong green_mask
-       FIELD: ulong blue_mask
-       FIELD: int colormap_size
-       FIELD: int bits_per_rgb
-END-STRUCT
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Appendix D - Compatibility Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-FUNCTION: Status XSetStandardProperties (
-       Display* display,
-       Window w,
-       char* window_name,
-       char* icon_name,
-       Pixmap icon_pixmap,
-       char** argv,
-       int argc,
-       XSizeHints* hints ) ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: CurrentTime 0 ; inline
-
-: XA_PRIMARY  1 ; inline
-: XA_SECONDARY 2 ; inline
-: XA_ARC 3 ; inline
-: XA_ATOM 4 ; inline
-: XA_BITMAP 5 ; inline
-: XA_CARDINAL 6 ; inline
-: XA_COLORMAP 7 ; inline
-: XA_CURSOR 8 ; inline
-: XA_CUT_BUFFER0 9 ; inline
-: XA_CUT_BUFFER1 10 ; inline
-: XA_CUT_BUFFER2 11 ; inline
-: XA_CUT_BUFFER3 12 ; inline
-: XA_CUT_BUFFER4 13 ; inline
-: XA_CUT_BUFFER5 14 ; inline
-: XA_CUT_BUFFER6 15 ; inline
-: XA_CUT_BUFFER7 16 ; inline
-: XA_DRAWABLE 17 ; inline
-: XA_FONT 18 ; inline
-: XA_INTEGER 19 ; inline
-: XA_PIXMAP 20 ; inline
-: XA_POINT 21 ; inline
-: XA_RECTANGLE 22 ; inline
-: XA_RESOURCE_MANAGER 23 ; inline
-: XA_RGB_COLOR_MAP 24 ; inline
-: XA_RGB_BEST_MAP 25 ; inline
-: XA_RGB_BLUE_MAP 26 ; inline
-: XA_RGB_DEFAULT_MAP 27 ; inline
-: XA_RGB_GRAY_MAP 28 ; inline
-: XA_RGB_GREEN_MAP 29 ; inline
-: XA_RGB_RED_MAP 30 ; inline
-: XA_STRING 31 ; inline
-: XA_VISUALID 32 ; inline
-: XA_WINDOW 33 ; inline
-: XA_WM_COMMAND 34 ; inline
-: XA_WM_HINTS 35 ; inline
-: XA_WM_CLIENT_MACHINE 36 ; inline
-: XA_WM_ICON_NAME 37 ; inline
-: XA_WM_ICON_SIZE 38 ; inline
-: XA_WM_NAME 39 ; inline
-: XA_WM_NORMAL_HINTS 40 ; inline
-: XA_WM_SIZE_HINTS 41 ; inline
-: XA_WM_ZOOM_HINTS 42 ; inline
-: XA_MIN_SPACE 43 ; inline
-: XA_NORM_SPACE 44 ; inline
-: XA_MAX_SPACE 45 ; inline
-: XA_END_SPACE 46 ; inline
-: XA_SUPERSCRIPT_X 47 ; inline
-: XA_SUPERSCRIPT_Y 48 ; inline
-: XA_SUBSCRIPT_X 49 ; inline
-: XA_SUBSCRIPT_Y 50 ; inline
-: XA_UNDERLINE_POSITION 51 ; inline
-: XA_UNDERLINE_THICKNESS 52 ; inline
-: XA_STRIKEOUT_ASCENT 53 ; inline
-: XA_STRIKEOUT_DESCENT 54 ; inline
-: XA_ITALIC_ANGLE 55 ; inline
-: XA_X_HEIGHT 56 ; inline
-: XA_QUAD_WIDTH 57 ; inline
-: XA_WEIGHT 58 ; inline
-: XA_POINT_SIZE 59 ; inline
-: XA_RESOLUTION 60 ; inline
-: XA_COPYRIGHT 61 ; inline
-: XA_NOTICE 62 ; inline
-: XA_FONT_NAME 63 ; inline
-: XA_FAMILY_NAME 64 ; inline
-: XA_FULL_NAME 65 ; inline
-: XA_CAP_HEIGHT 66 ; inline
-: XA_WM_CLASS 67 ; inline
-: XA_WM_TRANSIENT_FOR 68 ; inline
-
-: XA_LAST_PREDEFINED 68 ; inline
-
-: PropModeReplace         0 ; inline
-: PropModePrepend         1 ; inline
-: PropModeAppend          2 ; inline
-    
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! The rest of the stuff is not from the book.
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-FUNCTION: void XFree ( void* data ) ;
-FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
-
-: USPosition  1 0 shift ; inline
-: USSize      1 1 shift ; inline
-: PPosition   1 2 shift ; inline
-: PSize       1 3 shift ; inline
-: PMinSize    1 4 shift ; inline
-: PMaxSize    1 5 shift ; inline
-: PResizeInc  1 6 shift ; inline
-: PAspect     1 7 shift ; inline
-: PBaseSize   1 8 shift ; inline
-: PWinGravity 1 9 shift ; inline
-
-BEGIN-STRUCT: XSizeHints
-    FIELD: long flags
-    FIELD: int x
-    FIELD: int y
-    FIELD: int width
-    FIELD: int height
-    FIELD: int min_width
-    FIELD: int min_height
-    FIELD: int max_width
-    FIELD: int max_height
-    FIELD: int width_inc
-    FIELD: int height_inc
-    FIELD: int min_aspect_x
-    FIELD: int min_aspect_y
-    FIELD: int max_aspect_x
-    FIELD: int max_aspect_y
-    FIELD: int base_width
-    FIELD: int base_height
-    FIELD: int win_gravity
-END-STRUCT
-
-FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;
diff --git a/core/vectors/authors.txt b/core/vectors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/vectors/summary.txt b/core/vectors/summary.txt
new file mode 100644 (file)
index 0000000..76857e1
--- /dev/null
@@ -0,0 +1 @@
+Growable arrays
diff --git a/core/vectors/tags.txt b/core/vectors/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/core/vectors/vectors-docs.factor b/core/vectors/vectors-docs.factor
new file mode 100644 (file)
index 0000000..56c59fa
--- /dev/null
@@ -0,0 +1,46 @@
+USING: arrays byte-arrays bit-arrays help.markup
+help.syntax kernel sbufs strings quotations sequences.private
+vectors.private combinators ;
+IN: vectors
+
+ARTICLE: "vectors" "Vectors"
+"A vector is a resizable mutable sequence of objects. The literal syntax is covered in " { $link "syntax-vectors" } ". Vector words are found in the " { $vocab-link "vectors" } " vocabulary."
+$nl
+"Vectors form a class:"
+{ $subsection vector }
+{ $subsection vector? }
+"Creating vectors:"
+{ $subsection >vector }
+{ $subsection <vector> }
+"Creating a vector from a single element:"
+{ $subsection 1vector }
+"If you don't care about initial capacity, a more elegant way to create a new vector is to write:"
+{ $code "V{ } clone" } ;
+
+ABOUT: "vectors"
+
+HELP: vector
+{ $description "The class of resizable vectors. See " { $link "syntax-vectors" } " for syntax and " { $link "vectors" } " for general information." } ;
+
+HELP: <vector>
+{ $values { "n" "a positive integer specifying initial capacity" } { "vector" vector } }
+{ $description "Creates a new vector that can hold " { $snippet "n" } " elements before resizing." } ;
+
+HELP: >vector
+{ $values { "seq" "a sequence" } { "vector" vector } }
+{ $description "Outputs a freshly-allocated vector with the same elements as a given sequence." } ;
+
+HELP: array>vector ( array length -- vector )
+{ $values { "array" "an array" } { "length" "a non-negative integer" } { "vector" vector } }
+{ $description "Creates a new vector using the array for underlying storage with the specified initial length." }
+{ $warning "This word is in the " { $vocab-link "sequences.private" } " vocabulary because it does not perform type or bounds checks. User code should call " { $link >vector } " instead." } ;
+
+HELP: 1vector
+{ $values { "x" object } { "vector" vector } }
+{ $description "Create a new vector with one element." } ;
+
+HELP: ?push
+{ $values { "elt" object } { "seq/f" "a resizable mutable sequence, or " { $link f } } { "seq" "a resizable mutable sequence" } }
+{ $description "If the given sequence is " { $link f } ", creates and outputs a new one-element vector holding " { $snippet "elt" } ". Otherwise, pushes " { $snippet "elt" } " onto the given sequence." }
+{ $errors "Throws an error if " { $snippet "seq" } " is not resizable, or if the type of " { $snippet "elt" } " is not permitted in " { $snippet "seq" } "." }
+{ $side-effects "seq" } ;
diff --git a/core/vectors/vectors-tests.factor b/core/vectors/vectors-tests.factor
new file mode 100644 (file)
index 0000000..ea44df4
--- /dev/null
@@ -0,0 +1,95 @@
+USING: arrays kernel kernel.private math namespaces
+sequences sequences.private strings tools.test vectors
+continuations random growable ;
+IN: temporary
+
+[ ] [ 10 [ [ -1000000 <vector> ] catch drop ] times ] unit-test
+
+[ 3 ] [ [ t f t ] length ] unit-test
+[ 3 ] [ V{ t f t } length ] unit-test
+
+[ -3 V{ } nth ] unit-test-fails
+[ 3 V{ } nth ] unit-test-fails
+[ 3 C{ 1 2 } nth ] unit-test-fails
+
+[ "hey" [ 1 2 ] set-length ] unit-test-fails
+[ "hey" V{ 1 2 } set-length ] unit-test-fails
+
+[ 3 ] [ 3 0 <vector> [ set-length ] keep length ] unit-test
+[ "yo" ] [
+    "yo" 4 1 <vector> [ set-nth ] keep 4 swap nth
+] unit-test
+
+[ 1 V{ } nth ] unit-test-fails
+[ -1 V{ } set-length ] unit-test-fails
+[ V{ } ] [ [ ] >vector ] unit-test
+[ V{ 1 2 } ] [ [ 1 2 ] >vector ] unit-test
+
+[ t ] [
+    100 [ drop 100 random ] map >vector
+    dup >array >vector =
+] unit-test
+
+[ f ] [ V{ } V{ 1 2 3 } = ] unit-test
+[ f ] [ V{ 1 2 } V{ 1 2 3 } = ] unit-test
+[ f ] [ [ 1 2 ] V{ 1 2 3 } = ] unit-test
+[ f ] [ V{ 1 2 } [ 1 2 3 ] = ] unit-test
+
+[ { 1 4 9 16 } ]
+[
+    [ 1 2 3 4 ]
+    >vector [ dup * ] map >array
+] unit-test
+
+[ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
+[ t ] [ V{ 1 2 3 } hashcode V{ 1 2 3 } hashcode = ] unit-test
+[ t ] [ V{ 1 V{ 2 } 3 } hashcode V{ 1 V{ 2 } 3 } hashcode = ] unit-test
+[ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
+
+[ V{ 1 2 3 } V{ 1 2 3 4 5 6 } ]
+[ V{ 1 2 3 } dup V{ 4 5 6 } append ] unit-test
+
+[ V{ 1 2 3 4 } ] [ [ V{ 1 } [ 2 ] V{ 3 4 } ] concat ] unit-test
+
+[ V{ } ] [ V{ } 0 tail ] unit-test
+[ V{ } ] [ V{ 1 2 } 2 tail ] unit-test
+[ V{ 3 4 } ] [ V{ 1 2 3 4 } 2 tail ] unit-test
+
+[ V{ 3 } ] [ V{ 1 2 3 } 1 tail* ] unit-test
+
+0 <vector> "funny-stack" set
+
+[ ] [ V{ 1 5 } "funny-stack" get push ] unit-test
+[ ] [ V{ 2 3 } "funny-stack" get push ] unit-test
+[ V{ 2 3 } ] [ "funny-stack" get pop ] unit-test
+[ V{ 1 5 } ] [ "funny-stack" get peek ] unit-test
+[ V{ 1 5 } ] [ "funny-stack" get pop ] unit-test
+[ "funny-stack" get pop ] unit-test-fails
+[ "funny-stack" get pop ] unit-test-fails
+[ ] [ "funky" "funny-stack" get push ] unit-test
+[ "funky" ] [ "funny-stack" get pop ] unit-test
+
+[ t ] [
+    V{ 1 2 3 4 } dup underlying length
+    >r clone underlying length r>
+    =
+] unit-test
+
+[ f ] [
+    V{ 1 2 3 4 } dup clone
+    [ underlying ] 2apply eq?
+] unit-test
+
+[ 0 ] [
+    [
+        10 <vector> "x" set
+        "x" get clone length
+    ] with-scope
+] unit-test
+
+[ f ] [ 5 V{ } index ] unit-test
+[ 4 ] [ 5 V{ 1 2 3 4 5 } index ] unit-test
+
+[ t ] [
+    100 >array dup >vector <reversed> >array >r reverse r> =
+] unit-test
diff --git a/core/vectors/vectors.factor b/core/vectors/vectors.factor
new file mode 100644 (file)
index 0000000..2973431
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel kernel.private math
+math.private sequences sequences.private vectors.private
+growable ;
+IN: vectors
+
+: <vector> ( n -- vector ) f <array> 0 array>vector ; inline
+
+: >vector ( seq -- vector ) V{ } clone-like ; inline
+
+M: vector like
+    drop dup vector? [
+        dup array? [ dup length array>vector ] [ >vector ] if
+    ] unless ;
+
+M: vector new drop [ f <array> ] keep array>vector ;
+
+M: vector equal?
+    over vector? [ sequence= ] [ 2drop f ] if ;
+
+M: sequence new-resizable drop <vector> ;
+
+INSTANCE: vector growable
+
+: 1vector ( x -- vector ) 1array >vector ;
+
+: ?push ( elt seq/f -- seq )
+    [ 1 <vector> ] unless* [ push ] keep ;
diff --git a/core/version.factor b/core/version.factor
deleted file mode 100644 (file)
index 24f1660..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-IN: kernel
-: version "0.87" ;
diff --git a/core/vocabs/authors.txt b/core/vocabs/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/vocabs/loader/authors.txt b/core/vocabs/loader/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/vocabs/loader/loader-docs.factor b/core/vocabs/loader/loader-docs.factor
new file mode 100644 (file)
index 0000000..160177c
--- /dev/null
@@ -0,0 +1,142 @@
+USING: vocabs help.markup help.syntax words strings io ;
+IN: vocabs.loader
+
+ARTICLE: "vocabs.loader" "Vocabulary loader"
+"The vocabulary loader is defined in the " { $vocab-link "vocabs.loader" } " vocabulary."
+$nl
+"Vocabulary names map directly to source files. When a vocabulary which has not been loaded is accessed, the vocabulary loader searches for it in one of the root directories:"
+{ $subsection vocab-roots }
+"A vocabulary named " { $snippet "foo.bar" } " must be defined in a " { $snippet "bar" } " directory nested inside a " { $snippet "foo" } " directory at the vocabulary root. Any level of vocabulary nesting is permitted."
+$nl
+"The vocabulary directory - " { $snippet "bar" } " in our example - can contain the following files; the first is required while the rest are optional:"
+{ $list
+    { { $snippet "foo/bar/bar.factor" } " - the source file, defines words in the " { $snippet "foo.bar" } " vocabulary" }
+    { { $snippet "foo/bar/bar-docs.factor" } " - documentation, see " { $link "writing-help" } }
+    { { $snippet "foo/bar/bar-tests.factor" } " - unit tests, see " { $link "tools.test" } }
+    { { $snippet "foo/bar/summary.txt" } " - a one-line description" }
+    { { $snippet "foo/bar/tags.txt" } " - a whitespace-separated list of tags which classify the vocabulary" }
+}
+"While " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " load vocabularies which have not been loaded before adding them to the search path, it is also possible to load a vocabulary without adding it to the search path:"
+{ $subsection require }
+"Forcing a reload of a vocabulary, even if it has already been loaded:"
+{ $subsection reload-vocab }
+"Application vocabularies can define a main entry point, giving the user a convenient way to run the application:"
+{ $subsection POSTPONE: MAIN: }
+{ $subsection run }
+"Reloading source files changed on disk:"
+{ $subsection refresh }
+{ $subsection refresh-all }
+{ $see-also "vocabularies" "parser-files" "source-files" } ;
+
+ABOUT: "vocabs.loader"
+
+HELP: load-vocab
+{ $values { "name" "a string" } { "vocab" "a hashtable or " { $link f } } }
+{ $description "Outputs a named vocabulary. If the vocabulary does not exist, throws a restartable " { $link no-vocab } " error. If the user invokes the restart, this word outputs " { $link f } "." }
+{ $error-description "Thrown by " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " when a given vocabulary does not exist. Vocabularies must be created by " { $link POSTPONE: IN: } " before being used." } ;
+
+HELP: vocab-main
+{ $values { "vocab" "a vocabulary specifier" } { "main" word } }
+{ $description "Outputs the main entry point for a vocabulary. The entry point can be executed with " { $link run } " and set with " { $link POSTPONE: MAIN: } "." } ;
+
+HELP: vocab-roots
+{ $var-description "A sequence of pathname strings to search for vocabularies." } ;
+
+HELP: vocab-source
+{ $values { "vocab" "a vocabulary specifier" } { "path" string } }
+{ $description "Outputs a pathname relative to a vocabulary root where the source code for " { $snippet "vocab" } " might be found." } ;
+
+{ vocab-source vocab-source-path } related-words
+
+HELP: vocab-docs
+{ $values { "vocab" "a vocabulary specifier" } { "path" string } }
+{ $description "Outputs a pathname relative to a vocabulary root where the documentation for " { $snippet "vocab" } " might be found." } ;
+
+{ vocab-docs vocab-docs-path } related-words
+
+HELP: vocab-tests
+{ $values { "vocab" "a vocabulary specifier" } { "path" string } }
+{ $description "Outputs a pathname relative to a vocabulary root where the unit tests for " { $snippet "vocab" } " might be found." } ;
+
+{ vocab-tests vocab-tests-path } related-words
+
+HELP: find-vocab-root
+{ $values { "vocab" "a vocabulary specifier" } { "path/f" "a pathname string" } }
+{ $description "Searches for a vocabulary in the vocabulary roots." } ;
+
+{ vocab-root find-vocab-root } related-words
+
+HELP: vocab-files
+{ $values { "vocab" "a vocabulary specifier" } { "seq" "a sequence of pathname strings" } }
+{ $description "Outputs a sequence of files comprising this vocabulary, or " { $link f } " if the vocabulary does not have a directory on disk." } ;
+
+HELP: no-vocab
+{ $values { "name" "a vocabulary name" } } 
+{ $description "Throws a " { $link no-vocab } "." }
+{ $error-description "Thrown when a " { $link POSTPONE: USE: } ", " { $link POSTPONE: USING: } " or " { $link POSTPONE: USE-IF: } " form refers to a non-existent vocabulary." } ;
+
+HELP: load-help?
+{ $var-description "If set to a true value, documentation will be automatically loaded when vocabularies are loaded. This variable is usually on, except when Factor has been bootstrapped without the help system." } ;
+
+HELP: load-source
+{ $values { "root" "a pathname string" } { "name" "a vocabulary name" } }
+{ $description "Loads a vocabulary's source code from the specified vocabulary root." } ;
+
+HELP: load-docs
+{ $values { "root" "a pathname string" } { "name" "a vocabulary name" } }
+{ $description "If " { $link load-help? } " is on, loads a vocabulary's documentation from the specified vocabulary root." } ;
+
+HELP: amend-vocab-from-root
+{ $values { "root" "a pathname string" } { "name" "a vocabulary name" } { "vocab" vocab }  }
+{ $description "Loads a vocabulary's source code and documentation if they have not already been loaded, and outputs the vocabulary." } ;
+
+HELP: load-vocab-from-root
+{ $values { "root" "a pathname string" } { "name" "a vocabulary name" } }
+{ $description "Loads a vocabulary's source code and documentation." } ;
+
+HELP: reload-vocab
+{ $values { "name" "a vocabulary name" } }
+{ $description "Loads it's source code and documentation." }
+{ $errors "Throws a " { $link no-vocab } " error if the vocabulary does not exist on disk." } ;
+
+HELP: require
+{ $values { "vocab" "a vocabulary specifier" } }
+{ $description "Loads a vocabulary if it has not already been loaded." }
+{ $notes "To unconditionally reload a vocabulary, use " { $link reload-vocab } ". To reload changed source files, use " { $link refresh } " or " { $link refresh-all } "." } ;
+
+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." } ;
+
+HELP: vocab-source-path
+{ $values { "vocab" "a vocabulary specifier" } { "path/f" "a pathname string or " { $link f } } }
+{ $description "Outputs a pathname where source code for " { $snippet "vocab" } " might be found. Outputs " { $link f } " if the vocabulary does not have a directory on disk." } ;
+
+HELP: vocab-docs-path
+{ $values { "vocab" "a vocabulary specifier" } { "path/f" "a pathname string or " { $link f } } }
+{ $description "Outputs a pathname where the documentation for " { $snippet "vocab" } " might be found. Outputs " { $link f } " if the vocabulary does not have a directory on disk." } ;
+
+HELP: vocab-tests-path
+{ $values { "vocab" "a vocabulary specifier" } { "path/f" "a pathname string or " { $link f } } }
+{ $description "Outputs a pathname where the unit tests for " { $snippet "vocab" } " might be found. Outputs " { $link f } " if the vocabulary does not have a directory on disk." } ;
+
+HELP: (refresh)
+{ $values { "prefix" string } { "seq" "a sequence of strings" } }
+{ $description "Reloads source files and documentation belonging to loaded vocabularies whose names are prefixed by " { $snippet "prefix" } " which have been modified on disk. Also outputs a sequence of reloaded vocabularies." } ;
+
+HELP: refresh
+{ $values { "prefix" string } }
+{ $description "Reloads source files and documentation belonging to loaded vocabularies whose names are prefixed by " { $snippet "prefix" } " which have been modified on disk." } ;
+
+HELP: refresh-all
+{ $description "Reloads source files and documentation for all loaded vocabularies which have been modified on disk." } ;
+
+{ refresh (refresh) refresh-all } related-words
+
+HELP: vocab-file-contents
+{ $values { "vocab" "a vocabulary specifier" } { "name" string } { "seq" "a sequence of lines, or " { $link f } } }
+{ $description "Outputs the contents of the file named " { $snippet "name" } " from the vocabulary's directory, or " { $link f } " if the file does not exist." } ;
+
+HELP: set-vocab-file-contents
+{ $values { "seq" "a sequence of lines" } { "vocab" "a vocabulary specifier" } { "name" string } }
+{ $description "Stores a sequence of lines to the file named " { $snippet "name" } " from the vocabulary's directory." } ;
diff --git a/core/vocabs/loader/loader-tests.factor b/core/vocabs/loader/loader-tests.factor
new file mode 100644 (file)
index 0000000..1c86f22
--- /dev/null
@@ -0,0 +1,154 @@
+! Unit tests for vocabs.loader vocabulary
+IN: temporary
+USING: vocabs.loader tools.test continuations vocabs math
+kernel arrays sequences namespaces io.streams.string
+parser source-files words assocs tuples definitions
+debugger ;
+
+! This vocab should not exist, but just in case...
+[ ] [ "vocabs.loader.test" forget-vocab ] unit-test
+
+[ T{ vocab-link f "vocabs.loader.test" } ]
+[ "vocabs.loader.test" f >vocab-link ] unit-test
+
+[ t ]
+[ "kernel" f >vocab-link "kernel" vocab = ] unit-test
+
+! This vocab should not exist, but just in case...
+[ ] [ "core" forget-vocab ] unit-test
+
+2 [
+    [ T{ no-vocab f "core" } ]
+    [ [ "core" require ] catch ] unit-test
+] times
+
+[ f ] [ "core" vocab ] unit-test
+
+[ t ] [
+    "kernel" vocab-files
+    "kernel" vocab vocab-files
+    "kernel" f \ vocab-link construct-boa vocab-files
+    3array all-equal?
+] unit-test
+
+IN: vocabs.loader.test.2
+
+: hello 3 ;
+
+MAIN: hello
+
+IN: temporary
+
+[ { 3 3 3 } ] [
+    "vocabs.loader.test.2" run
+    "vocabs.loader.test.2" vocab run
+    "vocabs.loader.test.2" f \ vocab-link construct-boa run
+    3array
+] unit-test
+
+"resource:core/vocabs/loader/test/a/a.factor" forget-source
+
+"vocabs.loader.test.a" forget-vocab
+
+0 "count-me" set-global
+
+2 [
+    [ "vocabs.loader.test.a" require ] unit-test-fails
+    
+    [ f ] [ "vocabs.loader.test.a" vocab-source-loaded? ] unit-test
+    
+    [ t ] [
+        "resource:core/vocabs/loader/test/a/a.factor"
+        source-file source-file-definitions dup USE: prettyprint .
+        "v-l-t-a-hello" "vocabs.loader.test.a" lookup dup .
+        swap key?
+    ] unit-test
+] times
+
+[ 2 ] [ "count-me" get-global ] unit-test
+
+[ t ] [
+    [
+        "IN: vocabs.loader.test.a v-l-t-a-hello"
+        <string-reader>
+        "resource:core/vocabs/loader/test/a/a.factor"
+        parse-stream
+    ] catch [ forward-error? ] is?
+] unit-test
+
+0 "count-me" set-global
+
+[ ] [ "vocabs.loader.test.b" forget-vocab ] unit-test
+
+[ ] [
+    "vocabs.loader.test.b" vocab-files [
+        forget-source
+    ] each
+] unit-test
+
+[ "vocabs.loader.test.b" require ] unit-test-fails
+
+[ 1 ] [ "count-me" get-global ] unit-test
+
+[ ] [
+    "bob" "vocabs.loader.test.b" create [ ] define-compound
+] unit-test
+
+[ ] [ "vocabs.loader.test.b" refresh ] unit-test
+
+[ 2 ] [ "count-me" get-global ] unit-test
+
+[ t ] [ "fred" "vocabs.loader.test.b" lookup compound? ] unit-test
+
+[ ] [
+    "vocabs.loader.test.b" vocab-files [
+        forget-source
+    ] each
+] unit-test
+
+[ ] [ "vocabs.loader.test.b" refresh ] unit-test
+
+[ 3 ] [ "count-me" get-global ] unit-test
+
+[ { "resource:core/kernel/kernel.factor" 1 } ]
+[ "kernel" f \ vocab-link construct-boa where ] unit-test
+
+[ { "resource:core/kernel/kernel.factor" 1 } ]
+[ "kernel" vocab where ] unit-test
+
+[ t ] [
+    [ "vocabs.loader.test.d" require ] catch
+    [ :1 ] when
+    "vocabs.loader.test.d" vocab-source-loaded?
+] unit-test
+
+: forget-junk
+    { "2" "a" "b" "d" "e" "f" }
+    [ "vocabs.loader.test." swap append forget-vocab ] each ;
+
+forget-junk
+
+[ { } ] [
+    "IN: xabbabbja" eval "xabbabbja" vocab-files
+] unit-test
+
+"xabbabbja" forget-vocab
+
+"bootstrap.help" vocab [
+    [
+        "again" off
+        
+        [ "vocabs.loader.test.e" require ] catch drop
+        
+        [ 3 ] [ restarts get length ] unit-test
+        
+        [ ] [
+            "again" get not restarts get length 3 = and [
+                "again" on
+                :2
+            ] when
+        ] unit-test
+    ] with-scope
+] when
+
+forget-junk
diff --git a/core/vocabs/loader/loader.factor b/core/vocabs/loader/loader.factor
new file mode 100644 (file)
index 0000000..48ff041
--- /dev/null
@@ -0,0 +1,194 @@
+! Copyright (C) 2007 Eduardo Cavazos, Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces splitting sequences io.files kernel assocs
+words vocabs definitions parser continuations inspector debugger
+io io.styles io.streams.lines hashtables sorting prettyprint
+source-files arrays combinators strings system math.parser ;
+IN: vocabs.loader
+
+SYMBOL: vocab-roots
+
+V{
+    "resource:core"
+    "resource:extra"
+    "resource:work"
+} clone vocab-roots set-global
+
+! No such thing as current directory on Windows CE
+wince? [ "." vocab-roots get push ] unless
+
+: vocab-dir+ ( vocab str/f -- path )
+    >r vocab-name "." split r>
+    [ >r dup peek r> append add ] when*
+    "/" join ;
+
+: vocab-dir ( vocab -- dir )
+    f vocab-dir+ ;
+
+: vocab-source ( vocab -- path )
+    ".factor" vocab-dir+ ;
+
+: vocab-docs ( vocab -- path )
+    "-docs.factor" vocab-dir+ ;
+
+: vocab-tests ( vocab -- path )
+    "-tests.factor" vocab-dir+ ;
+
+: find-vocab-root ( vocab -- path/f )
+    vocab-dir vocab-roots get
+    swap [ path+ ?resource-path exists? ] curry find nip ;
+
+M: string vocab-root
+    dup vocab [ vocab-root ] [ find-vocab-root ] ?if ;
+
+M: vocab-link vocab-root
+    dup vocab-link-root [ ] [ vocab-link-name vocab-root ] ?if ;
+
+: vocab-files ( vocab -- seq )
+    [
+        dup vocab-root dup [
+            swap
+            2dup vocab-source path+ ,
+            2dup vocab-docs path+ ,
+            2dup vocab-tests path+ ,
+        ] when 2drop
+    ] { } make [ ?resource-path exists? ] subset ;
+
+TUPLE: no-vocab name ;
+
+: no-vocab ( name -- * ) \ no-vocab construct-boa throw ;
+
+M: no-vocab summary drop "Vocabulary does not exist" ;
+
+SYMBOL: load-help?
+
+: source-was-loaded t swap set-vocab-source-loaded? ;
+
+: source-wasn't-loaded f swap set-vocab-source-loaded? ;
+
+: load-source ( root name -- )
+    [ source-was-loaded ] keep [
+        [ vocab-source path+ bootstrap-file ]
+        [ ] [ source-wasn't-loaded ]
+        cleanup
+    ] keep source-was-loaded ;
+
+: docs-were-loaded t swap set-vocab-docs-loaded? ;
+
+: docs-were't-loaded f swap set-vocab-docs-loaded? ;
+
+: load-docs ( root name -- )
+    load-help? get [
+        [ docs-were-loaded ] keep [
+            [ vocab-docs path+ ?bootstrap-file ]
+            [ ] [ docs-were't-loaded ]
+            cleanup
+        ] keep source-was-loaded
+    ] [
+        2drop
+    ] if ;
+
+: amend-vocab-from-root ( root name -- vocab )
+    dup vocab-source-loaded? [ 2dup load-source ] unless
+    dup vocab-docs-loaded? [ 2dup load-docs ] unless
+    nip vocab ;
+
+: load-vocab-from-root ( root name -- )
+    2dup vocab-source path+ ?resource-path exists? [
+        2dup create-vocab set-vocab-root
+        2dup load-source load-docs
+    ] [
+        nip no-vocab
+    ] if ;
+
+: reload-vocab ( name -- )
+    dup find-vocab-root dup [
+        swap load-vocab-from-root
+    ] [
+        drop no-vocab
+    ] if ;
+
+: require ( vocab -- ) load-vocab drop ;
+
+: run ( vocab -- )
+    dup load-vocab vocab-main [
+        execute
+    ] [
+        "The " write vocab-name write
+        " vocabulary does not define an entry point." print
+        "To define one, refer to \\ MAIN: help" print
+    ] ?if ;
+
+: modified ( assoc -- seq )
+    [ nip dup [ source-modified? ] when ] assoc-subset
+    keys ;
+
+: vocab-path+ ( vocab path -- newpath )
+    swap vocab-root dup [ swap path+ ] [ 2drop f ] if ;
+
+: vocab-source-path ( vocab -- path/f )
+    dup vocab-source vocab-path+ ;
+
+: vocab-tests-path ( vocab -- path/f )
+    dup vocab-tests vocab-path+ ;
+
+: vocab-docs-path ( vocab -- path/f )
+    dup vocab-docs vocab-path+ ;
+
+: modified-sources ( vocabs -- seq )
+    [ dup vocab-source-path ] { } map>assoc modified ;
+
+: modified-docs ( vocabs -- seq )
+    [ dup vocab-docs-path ] { } map>assoc modified ;
+
+: (refresh) ( prefix -- seq )
+    child-vocabs
+    dup modified-sources swap modified-docs 2dup
+    [ f swap set-vocab-docs-loaded? ] each
+    [ f swap set-vocab-source-loaded? ] each
+    append prune dup [ [ require ] each ] no-parse-hook ;
+
+: refresh ( prefix -- ) (refresh) drop ;
+
+: refresh-all ( -- ) "" refresh ;
+
+GENERIC: (load-vocab) ( name -- vocab )
+
+M: vocab (load-vocab)
+    dup vocab-root
+    [ swap vocab-name amend-vocab-from-root ] when* ;
+
+M: string (load-vocab)
+    [ ".private" ?tail drop reload-vocab ] keep vocab ;
+
+M: vocab-link (load-vocab)
+    vocab-name (load-vocab) ;
+
+[ dup vocab [ ] [ ] ?if (load-vocab) ]
+load-vocab-hook set-global
+
+: vocab-where ( vocab -- loc )
+    vocab-source-path dup [ 1 2array ] when ;
+
+M: vocab where vocab-where ;
+
+M: vocab-link where vocab-where ;
+
+: vocab-file-contents ( vocab name -- seq )
+    vocab-path+ dup [
+        ?resource-path dup exists? [
+            <file-reader> lines
+        ] [
+            drop f
+        ] if
+    ] when ;
+
+: set-vocab-file-contents ( seq vocab name -- )
+    dupd vocab-path+ [
+        ?resource-path
+        <file-writer> [ [ print ] each ] with-stream
+    ] [
+        "The " swap vocab-name
+        " vocabulary was not loaded from the file system"
+        3append throw
+    ] ?if ;
diff --git a/core/vocabs/loader/summary.txt b/core/vocabs/loader/summary.txt
new file mode 100644 (file)
index 0000000..d0eac4c
--- /dev/null
@@ -0,0 +1 @@
+Vocabulary dependency resolution, reloading and development utilities
diff --git a/core/vocabs/loader/test/a/a.factor b/core/vocabs/loader/test/a/a.factor
new file mode 100644 (file)
index 0000000..d3f4dd9
--- /dev/null
@@ -0,0 +1,12 @@
+USING: namespaces parser ;
+IN: vocabs.loader.test.a
+
+: COUNT-ME global [ "count-me" inc ] bind ; parsing
+
+COUNT-ME
+
+: v-l-t-a-hello 4 ;
+
+: byebye v-l-t-a-hello ;
+
+[ this is an error
diff --git a/core/vocabs/loader/test/b/b.factor b/core/vocabs/loader/test/b/b.factor
new file mode 100644 (file)
index 0000000..113f7af
--- /dev/null
@@ -0,0 +1,7 @@
+USING: namespaces ;
+IN: vocabs.loader.test.b
+
+: COUNT-ME global [ "count-me" inc ] bind ; parsing
+COUNT-ME
+
+: fred bob ;
\ No newline at end of file
diff --git a/core/vocabs/loader/test/c/c.factor b/core/vocabs/loader/test/c/c.factor
new file mode 100644 (file)
index 0000000..80c0c0d
--- /dev/null
@@ -0,0 +1,4 @@
+IN: vocabs.loader.test.c
+
+GENERIC: foo
+M: foo
diff --git a/core/vocabs/loader/test/d/d.factor b/core/vocabs/loader/test/d/d.factor
new file mode 100644 (file)
index 0000000..e4f1c02
--- /dev/null
@@ -0,0 +1,3 @@
+IN: vocabs.loader.test.d
+
+: foo iterate-next ;
\ No newline at end of file
diff --git a/core/vocabs/loader/test/e/e.factor b/core/vocabs/loader/test/e/e.factor
new file mode 100644 (file)
index 0000000..bf9ba22
--- /dev/null
@@ -0,0 +1 @@
+USE: vocabs.loader.test.f
diff --git a/core/vocabs/loader/test/f/f-docs.factor b/core/vocabs/loader/test/f/f-docs.factor
new file mode 100644 (file)
index 0000000..1beaa99
--- /dev/null
@@ -0,0 +1,4 @@
+USE: vocabs.loader.test.e
+
+! a syntax error
+123 iterate-next
diff --git a/core/vocabs/loader/test/f/f.factor b/core/vocabs/loader/test/f/f.factor
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/core/vocabs/summary.txt b/core/vocabs/summary.txt
new file mode 100644 (file)
index 0000000..3572afe
--- /dev/null
@@ -0,0 +1 @@
+Vocabularies are collections of words loaded from a source file
diff --git a/core/vocabs/vocabs-docs.factor b/core/vocabs/vocabs-docs.factor
new file mode 100644 (file)
index 0000000..5734dcf
--- /dev/null
@@ -0,0 +1,110 @@
+USING: help.markup help.syntax strings words ;
+IN: vocabs
+
+ARTICLE: "vocabularies" "Vocabularies"
+"A " { $emphasis "vocabulary" } " is a named collection of words. Vocabularies are defined in the " { $vocab-link "vocabs" } " vocabulary."
+$nl
+"Vocabularies are stored in a global hashtable:"
+{ $subsection dictionary }
+"Vocabularies form a class."
+{ $subsection vocab }
+{ $subsection vocab? }
+"Various vocabulary words are overloaded to accept a " { $emphasis "vocabulary specifier" } ", which is a string naming the vocabulary, the " { $link vocab } " instance itself, or a " { $link vocab-link } ":"
+{ $subsection vocab-link }
+{ $subsection >vocab-link }
+"Looking up vocabularies by name:"
+{ $subsection vocab }
+"Accessors for various vocabulary attributes:"
+{ $subsection vocab-name }
+{ $subsection vocab-root }
+{ $subsection vocab-main }
+{ $subsection vocab-help }
+"Looking up existing vocabularies and creating new vocabularies:"
+{ $subsection vocab }
+{ $subsection child-vocabs }
+{ $subsection create-vocab }
+"Getting words from a vocabulary:"
+{ $subsection vocab-words }
+{ $subsection words }
+{ $subsection all-words }
+{ $subsection words-named }
+"Removing a vocabulary:"
+{ $subsection forget-vocab }
+{ $see-also "words" "vocabs.loader" } ;
+
+ABOUT: "vocabularies"
+
+HELP: dictionary
+{ $var-description "Holds a hashtable mapping vocabulary names to vocabularies." } ;
+
+HELP: vocabs
+{ $values { "seq" "a sequence of strings" } }
+{ $description "Outputs a sequence of all defined vocabulary names." } ;
+
+HELP: vocab
+{ $values { "name" string } { "vocab" vocab } }
+{ $description "Outputs a named vocabulary, or " { $link f } " if no vocabulary with this name exists." }
+{ $class-description "Instances represent vocabularies." } ;
+
+HELP: vocab-name
+{ $values { "vocab" "a vocabulary specifier" } { "name" string } }
+{ $description "Outputs the name of a vocabulary." } ;
+
+HELP: vocab-root
+{ $values { "vocab" "a vocabulary specifier" } { "root" "a pathname string or " { $link f } } }
+{ $description "Outputs the vocabulary root where the source code for a vocabulary is located, or " { $link f } " if the vocabulary is not defined in source files." } ;
+
+HELP: vocab-words
+{ $values { "vocab" "a vocabulary specifier" } { "words" "an assoc mapping strings to words" } }
+{ $description "Outputs the words defined in a vocabulary." } ;
+
+HELP: vocab-source-loaded?
+{ $values { "vocab" "a vocabulary specifier" } { "source-loaded?" "a boolean" } }
+{ $description "Outputs if the source for this vocubulary has been loaded." } ;
+
+HELP: vocab-docs-loaded?
+{ $values { "vocab" "a vocabulary specifier" } { "docs-loaded?" "a boolean" } }
+{ $description "Outputs if the documentation for this vocubulary has been loaded." } ;
+
+HELP: words
+{ $values { "vocab" string } { "seq" "a sequence of words" } }
+{ $description "Outputs a sequence of words defined in the vocabulary, or " { $link f } " if no vocabulary with this name exists." } ;
+
+HELP: all-words
+{ $values { "seq" "a sequence of words" } }
+{ $description "Outputs a sequence of all words in the dictionary." } ;
+
+HELP: forget-vocab
+{ $values { "vocab" string } }
+{ $description "Removes a vocabulary. All words in the vocabulary become uninterned." } ;
+
+HELP: load-vocab-hook
+{ $var-description "a quotation with stack effect " { $snippet "( name -- vocab )" } " which loads a vocabulary. This quotation is called by " { $link load-vocab } ". The default value should not need to be changed; this functinality is implemented via a hook stored in a variable to break a circular dependency which would otherwise exist from " { $vocab-link "vocabs" } " to " { $vocab-link "vocabs.loader" } " to " { $vocab-link "parser" } " back to " { $vocab-link "vocabs" } "." } ;
+
+HELP: words-named
+{ $values { "str" string } { "seq" "a sequence of words" } }
+{ $description "Outputs a sequence of all words named " { $snippet "str" } " from the set of currently-loaded vocabularies." } ;
+
+HELP: create-vocab
+{ $values { "name" string } { "vocab" vocab } }
+{ $description "Creates a new vocabulary if one does not exist with the given name, otherwise outputs an existing vocabulary." } ;
+
+HELP: child-vocabs
+{ $values { "vocab" "a vocabulary specifier" } { "seq" "a sequence of strings" } }
+{ $description "Outputs all vocabularies which are conceptually under " { $snippet "vocab" } " in the hierarchy." }
+{ $examples
+    { $unchecked-example
+        "\"io.streams\" child-vocabs ."
+        "{\n    \"io.streams.c\"\n    \"io.streams.duplex\"\n    \"io.streams.lines\"\n    \"io.streams.nested\"\n    \"io.streams.plain\"\n    \"io.streams.string\"\n}"
+    }
+} ;
+
+HELP: vocab-link
+{ $class-description "Instances of this class identify vocabularies which are potentially not loaded. The " { $link vocab-name } " slot is the vocabulary name, and " { $link vocab-root } " is a pathname string identifying the vocabulary root where the sources to this vocabulary are located, or " { $link f } " if the root is not known."
+$nl
+"Vocabulary links are created by calling " { $link >vocab-link } "."
+} ;
+
+HELP: >vocab-link
+{ $values { "name" string } { "root" "a pathname string or " { $link f } } { "vocab" "a vocabulary specifier" } }
+{ $description "If the vocabulary is loaded, outputs the corresponding " { $link vocab } " instance, otherwise creates a new " { $link vocab-link } "." } ;
diff --git a/core/vocabs/vocabs-tests.factor b/core/vocabs/vocabs-tests.factor
new file mode 100644 (file)
index 0000000..9b05660
--- /dev/null
@@ -0,0 +1,5 @@
+! Unit tests for vocabs vocabulary
+USING: vocabs tools.test ;
+IN: temporary
+
+[ f ] [ "kernel" vocab-main ] unit-test
diff --git a/core/vocabs/vocabs.factor b/core/vocabs/vocabs.factor
new file mode 100644 (file)
index 0000000..cb5e700
--- /dev/null
@@ -0,0 +1,99 @@
+! Copyright (C) 2007 Eduardo Cavazos, Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs strings kernel sorting namespaces sequences
+definitions ;
+IN: vocabs
+
+SYMBOL: dictionary
+
+TUPLE: vocab
+name root
+words
+main help
+source-loaded? docs-loaded? ;
+
+: <vocab> ( name -- vocab )
+    H{ } clone
+    { set-vocab-name set-vocab-words }
+    \ vocab construct ;
+
+GENERIC: vocab ( vocab-spec -- vocab )
+
+M: vocab vocab ;
+
+M: object vocab ( name -- vocab ) vocab-name dictionary get at ;
+
+M: string vocab-name ;
+
+M: object vocab-words vocab vocab-words ;
+
+M: object vocab-help vocab vocab-help ;
+
+M: object vocab-main vocab vocab-main ;
+
+M: object vocab-source-loaded?
+    vocab vocab-source-loaded? ;
+
+M: object set-vocab-source-loaded?
+    vocab set-vocab-source-loaded? ;
+
+M: object vocab-docs-loaded?
+    vocab vocab-docs-loaded? ;
+
+M: object set-vocab-docs-loaded?
+    vocab set-vocab-docs-loaded? ;
+
+M: f vocab-words ;
+
+M: f vocab-source-loaded? ;
+
+M: f set-vocab-source-loaded? 2drop ;
+
+M: f vocab-docs-loaded? ;
+
+M: f set-vocab-docs-loaded? 2drop ;
+
+: create-vocab ( name -- vocab )
+    dictionary get [ <vocab> ] cache
+    t over set-vocab-source-loaded? ;
+
+SYMBOL: load-vocab-hook
+
+: load-vocab ( name -- vocab ) load-vocab-hook get call ;
+
+: vocabs ( -- seq )
+    dictionary get keys natural-sort ;
+
+: words ( vocab -- seq )
+    vocab-words values ;
+
+: all-words ( -- seq )
+    dictionary get values [ words ] map concat ;
+
+: words-named ( str -- seq )
+    dictionary get values
+    [ vocab-words at ] curry* map
+    [ ] subset ;
+
+: forget-vocab ( vocab -- )
+    dup vocab-words [ nip forget ] assoc-each
+    vocab-name dictionary get delete-at ;
+
+: child-vocab? ( prefix name -- ? )
+    2dup = pick empty? or
+    [ 2drop t ] [ swap CHAR: . add head? ] if ;
+
+: child-vocabs ( vocab -- seq )
+    vocab-name vocabs [ child-vocab? ] curry* subset ;
+
+TUPLE: vocab-link name root ;
+
+M: vocab-link vocab-name vocab-link-name ;
+
+: >vocab-link ( name root -- vocab )
+    over vocab dup
+    [ 2nip ] [ drop \ vocab-link construct-boa ] if ;
+
+UNION: vocab-spec vocab vocab-link ;
+
+M: vocab-spec forget vocab-name forget-vocab ;
diff --git a/core/windows/dlls.factor b/core/windows/dlls.factor
deleted file mode 100644 (file)
index cbe5dc2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-IN: scratchpad
-USING: alien sequences ;
-{
-    { "gdi32"    "gdi32.dll"    "stdcall" }
-    { "user32"   "user32.dll"   "stdcall" }
-    { "kernel32" "kernel32.dll" "stdcall" }
-    { "winsock"  "ws2_32.dll"   "stdcall" }
-    { "mswsock"  "mswsock.dll"  "stdcall" }
-    { "libc"     "msvcrt.dll"   "cdecl"   }
-    { "libm"     "msvcrt.dll"   "cdecl"   }
-} [ first3 add-library ] each
-
diff --git a/core/windows/gdi32-constants.factor b/core/windows/gdi32-constants.factor
deleted file mode 100644 (file)
index 4bae2fc..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien kernel errors ;
-IN: win32-api
-
-LIBRARY: gdi32
-
-! Stock Logical Objects
-: WHITE_BRUSH         0 ; inline
-: LTGRAY_BRUSH        1 ; inline
-: GRAY_BRUSH          2 ; inline
-: DKGRAY_BRUSH        3 ; inline
-: BLACK_BRUSH         4 ; inline
-: NULL_BRUSH          5 ; inline
-: HOLLOW_BRUSH        NULL_BRUSH ; inline
-: WHITE_PEN           6 ; inline
-: BLACK_PEN           7 ; inline
-: NULL_PEN            8 ; inline
-: OEM_FIXED_FONT      10 ; inline
-: ANSI_FIXED_FONT     11 ; inline
-: ANSI_VAR_FONT       12 ; inline
-: SYSTEM_FONT         13 ; inline
-: DEVICE_DEFAULT_FONT 14 ; inline
-: DEFAULT_PALETTE     15 ; inline
-: SYSTEM_FIXED_FONT   16 ; inline
-: DEFAULT_GUI_FONT    17 ; inline
-: DC_BRUSH            18 ; inline
-: DC_PEN              19 ; inline
-
-
diff --git a/core/windows/gdi32.factor b/core/windows/gdi32.factor
deleted file mode 100644 (file)
index d1748dd..0000000
+++ /dev/null
@@ -1,616 +0,0 @@
-! FUNCTION: AbortDoc
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien kernel errors ;
-IN: win32-api
-
-LIBRARY: gdi32
-
-! FUNCTION: AbortPath
-! FUNCTION: AddFontMemResourceEx
-! FUNCTION: AddFontResourceA
-! FUNCTION: AddFontResourceExA
-! FUNCTION: AddFontResourceExW
-! FUNCTION: AddFontResourceTracking
-! FUNCTION: AddFontResourceW
-! FUNCTION: AngleArc
-! FUNCTION: AnimatePalette
-! FUNCTION: AnyLinkedFonts
-! FUNCTION: Arc
-! FUNCTION: ArcTo
-! FUNCTION: BeginPath
-! FUNCTION: bInitSystemAndFontsDirectoriesW
-! FUNCTION: BitBlt
-! FUNCTION: bMakePathNameW
-! FUNCTION: BRUSHOBJ_hGetColorTransform
-! FUNCTION: BRUSHOBJ_pvAllocRbrush
-! FUNCTION: BRUSHOBJ_pvGetRbrush
-! FUNCTION: BRUSHOBJ_ulGetBrushColor
-! FUNCTION: CancelDC
-! FUNCTION: cGetTTFFromFOT
-! FUNCTION: CheckColorsInGamut
-FUNCTION: int ChoosePixelFormat ( HDC hDC, PFD* ppfd ) ;
-! FUNCTION: Chord
-! FUNCTION: ClearBitmapAttributes
-! FUNCTION: ClearBrushAttributes
-! FUNCTION: CLIPOBJ_bEnum
-! FUNCTION: CLIPOBJ_cEnumStart
-! FUNCTION: CLIPOBJ_ppoGetPath
-! FUNCTION: CloseEnhMetaFile
-! FUNCTION: CloseFigure
-! FUNCTION: CloseMetaFile
-! FUNCTION: ColorCorrectPalette
-! FUNCTION: ColorMatchToTarget
-! FUNCTION: CombineRgn
-! FUNCTION: CombineTransform
-! FUNCTION: CopyEnhMetaFileA
-! FUNCTION: CopyEnhMetaFileW
-! FUNCTION: CopyMetaFileA
-! FUNCTION: CopyMetaFileW
-! FUNCTION: CreateBitmap
-! FUNCTION: CreateBitmapIndirect
-! FUNCTION: CreateBrushIndirect
-! FUNCTION: CreateColorSpaceA
-! FUNCTION: CreateColorSpaceW
-! FUNCTION: CreateCompatibleBitmap
-! FUNCTION: CreateCompatibleDC
-! FUNCTION: CreateDCA
-! FUNCTION: CreateDCW
-! FUNCTION: CreateDIBitmap
-! FUNCTION: CreateDIBPatternBrush
-! FUNCTION: CreateDIBPatternBrushPt
-! FUNCTION: CreateDIBSection
-! FUNCTION: CreateDiscardableBitmap
-! FUNCTION: CreateEllipticRgn
-! FUNCTION: CreateEllipticRgnIndirect
-! FUNCTION: CreateEnhMetaFileA
-! FUNCTION: CreateEnhMetaFileW
-! FUNCTION: CreateFontA
-! FUNCTION: CreateFontIndirectA
-! FUNCTION: CreateFontIndirectExA
-! FUNCTION: CreateFontIndirectExW
-! FUNCTION: CreateFontIndirectW
-! FUNCTION: CreateFontW
-! FUNCTION: CreateHalftonePalette
-! FUNCTION: CreateHatchBrush
-! FUNCTION: CreateICA
-! FUNCTION: CreateICW
-! FUNCTION: CreateMetaFileA
-! FUNCTION: CreateMetaFileW
-! FUNCTION: CreatePalette
-! FUNCTION: CreatePatternBrush
-! FUNCTION: CreatePen
-! FUNCTION: CreatePenIndirect
-! FUNCTION: CreatePolygonRgn
-! FUNCTION: CreatePolyPolygonRgn
-! FUNCTION: CreateRectRgn
-! FUNCTION: CreateRectRgnIndirect
-! FUNCTION: CreateRoundRectRgn
-! FUNCTION: CreateScalableFontResourceA
-! FUNCTION: CreateScalableFontResourceW
-! FUNCTION: CreateSolidBrush
-! FUNCTION: DdEntry0
-! FUNCTION: DdEntry1
-! FUNCTION: DdEntry10
-! FUNCTION: DdEntry11
-! FUNCTION: DdEntry12
-! FUNCTION: DdEntry13
-! FUNCTION: DdEntry14
-! FUNCTION: DdEntry15
-! FUNCTION: DdEntry16
-! FUNCTION: DdEntry17
-! FUNCTION: DdEntry18
-! FUNCTION: DdEntry19
-! FUNCTION: DdEntry2
-! FUNCTION: DdEntry20
-! FUNCTION: DdEntry21
-! FUNCTION: DdEntry22
-! FUNCTION: DdEntry23
-! FUNCTION: DdEntry24
-! FUNCTION: DdEntry25
-! FUNCTION: DdEntry26
-! FUNCTION: DdEntry27
-! FUNCTION: DdEntry28
-! FUNCTION: DdEntry29
-! FUNCTION: DdEntry3
-! FUNCTION: DdEntry30
-! FUNCTION: DdEntry31
-! FUNCTION: DdEntry32
-! FUNCTION: DdEntry33
-! FUNCTION: DdEntry34
-! FUNCTION: DdEntry35
-! FUNCTION: DdEntry36
-! FUNCTION: DdEntry37
-! FUNCTION: DdEntry38
-! FUNCTION: DdEntry39
-! FUNCTION: DdEntry4
-! FUNCTION: DdEntry40
-! FUNCTION: DdEntry41
-! FUNCTION: DdEntry42
-! FUNCTION: DdEntry43
-! FUNCTION: DdEntry44
-! FUNCTION: DdEntry45
-! FUNCTION: DdEntry46
-! FUNCTION: DdEntry47
-! FUNCTION: DdEntry48
-! FUNCTION: DdEntry49
-! FUNCTION: DdEntry5
-! FUNCTION: DdEntry50
-! FUNCTION: DdEntry51
-! FUNCTION: DdEntry52
-! FUNCTION: DdEntry53
-! FUNCTION: DdEntry54
-! FUNCTION: DdEntry55
-! FUNCTION: DdEntry56
-! FUNCTION: DdEntry6
-! FUNCTION: DdEntry7
-! FUNCTION: DdEntry8
-! FUNCTION: DdEntry9
-! FUNCTION: DeleteColorSpace
-! FUNCTION: DeleteDC
-! FUNCTION: DeleteEnhMetaFile
-! FUNCTION: DeleteMetaFile
-! FUNCTION: DeleteObject
-! FUNCTION: DescribePixelFormat
-! FUNCTION: DeviceCapabilitiesExA
-! FUNCTION: DeviceCapabilitiesExW
-! FUNCTION: DPtoLP
-! FUNCTION: DrawEscape
-! FUNCTION: Ellipse
-! FUNCTION: EnableEUDC
-! FUNCTION: EndDoc
-! FUNCTION: EndFormPage
-! FUNCTION: EndPage
-! FUNCTION: EndPath
-! FUNCTION: EngAcquireSemaphore
-! FUNCTION: EngAlphaBlend
-! FUNCTION: EngAssociateSurface
-! FUNCTION: EngBitBlt
-! FUNCTION: EngCheckAbort
-! FUNCTION: EngComputeGlyphSet
-! FUNCTION: EngCopyBits
-! FUNCTION: EngCreateBitmap
-! FUNCTION: EngCreateClip
-! FUNCTION: EngCreateDeviceBitmap
-! FUNCTION: EngCreateDeviceSurface
-! FUNCTION: EngCreatePalette
-! FUNCTION: EngCreateSemaphore
-! FUNCTION: EngDeleteClip
-! FUNCTION: EngDeletePalette
-! FUNCTION: EngDeletePath
-! FUNCTION: EngDeleteSemaphore
-! FUNCTION: EngDeleteSurface
-! FUNCTION: EngEraseSurface
-! FUNCTION: EngFillPath
-! FUNCTION: EngFindResource
-! FUNCTION: EngFreeModule
-! FUNCTION: EngGetCurrentCodePage
-! FUNCTION: EngGetDriverName
-! FUNCTION: EngGetPrinterDataFileName
-! FUNCTION: EngGradientFill
-! FUNCTION: EngLineTo
-! FUNCTION: EngLoadModule
-! FUNCTION: EngLockSurface
-! FUNCTION: EngMarkBandingSurface
-! FUNCTION: EngMultiByteToUnicodeN
-! FUNCTION: EngMultiByteToWideChar
-! FUNCTION: EngPaint
-! FUNCTION: EngPlgBlt
-! FUNCTION: EngQueryEMFInfo
-! FUNCTION: EngQueryLocalTime
-! FUNCTION: EngReleaseSemaphore
-! FUNCTION: EngStretchBlt
-! FUNCTION: EngStretchBltROP
-! FUNCTION: EngStrokeAndFillPath
-! FUNCTION: EngStrokePath
-! FUNCTION: EngTextOut
-! FUNCTION: EngTransparentBlt
-! FUNCTION: EngUnicodeToMultiByteN
-! FUNCTION: EngUnlockSurface
-! FUNCTION: EngWideCharToMultiByte
-! FUNCTION: EnumEnhMetaFile
-! FUNCTION: EnumFontFamiliesA
-! FUNCTION: EnumFontFamiliesExA
-! FUNCTION: EnumFontFamiliesExW
-! FUNCTION: EnumFontFamiliesW
-! FUNCTION: EnumFontsA
-! FUNCTION: EnumFontsW
-! FUNCTION: EnumICMProfilesA
-! FUNCTION: EnumICMProfilesW
-! FUNCTION: EnumMetaFile
-! FUNCTION: EnumObjects
-! FUNCTION: EqualRgn
-! FUNCTION: Escape
-! FUNCTION: EudcLoadLinkW
-! FUNCTION: EudcUnloadLinkW
-! FUNCTION: ExcludeClipRect
-! FUNCTION: ExtCreatePen
-! FUNCTION: ExtCreateRegion
-! FUNCTION: ExtEscape
-! FUNCTION: ExtFloodFill
-! FUNCTION: ExtSelectClipRgn
-! FUNCTION: ExtTextOutA
-! FUNCTION: ExtTextOutW
-! FUNCTION: FillPath
-! FUNCTION: FillRgn
-! FUNCTION: FixBrushOrgEx
-! FUNCTION: FlattenPath
-! FUNCTION: FloodFill
-! FUNCTION: FontIsLinked
-! FUNCTION: FONTOBJ_cGetAllGlyphHandles
-! FUNCTION: FONTOBJ_cGetGlyphs
-! FUNCTION: FONTOBJ_pfdg
-! FUNCTION: FONTOBJ_pifi
-! FUNCTION: FONTOBJ_pQueryGlyphAttrs
-! FUNCTION: FONTOBJ_pvTrueTypeFontFile
-! FUNCTION: FONTOBJ_pxoGetXform
-! FUNCTION: FONTOBJ_vGetInfo
-! FUNCTION: FrameRgn
-! FUNCTION: GdiAddFontResourceW
-! FUNCTION: GdiAddGlsBounds
-! FUNCTION: GdiAddGlsRecord
-! FUNCTION: GdiAlphaBlend
-! FUNCTION: GdiArtificialDecrementDriver
-! FUNCTION: GdiCleanCacheDC
-! FUNCTION: GdiComment
-! FUNCTION: GdiConsoleTextOut
-! FUNCTION: GdiConvertAndCheckDC
-! FUNCTION: GdiConvertBitmap
-! FUNCTION: GdiConvertBitmapV5
-! FUNCTION: GdiConvertBrush
-! FUNCTION: GdiConvertDC
-! FUNCTION: GdiConvertEnhMetaFile
-! FUNCTION: GdiConvertFont
-! FUNCTION: GdiConvertMetaFilePict
-! FUNCTION: GdiConvertPalette
-! FUNCTION: GdiConvertRegion
-! FUNCTION: GdiConvertToDevmodeW
-! FUNCTION: GdiCreateLocalEnhMetaFile
-! FUNCTION: GdiCreateLocalMetaFilePict
-! FUNCTION: GdiDeleteLocalDC
-! FUNCTION: GdiDeleteSpoolFileHandle
-! FUNCTION: GdiDescribePixelFormat
-! FUNCTION: GdiDllInitialize
-! FUNCTION: GdiDrawStream
-! FUNCTION: GdiEndDocEMF
-! FUNCTION: GdiEndPageEMF
-! FUNCTION: GdiEntry1
-! FUNCTION: GdiEntry10
-! FUNCTION: GdiEntry11
-! FUNCTION: GdiEntry12
-! FUNCTION: GdiEntry13
-! FUNCTION: GdiEntry14
-! FUNCTION: GdiEntry15
-! FUNCTION: GdiEntry16
-! FUNCTION: GdiEntry2
-! FUNCTION: GdiEntry3
-! FUNCTION: GdiEntry4
-! FUNCTION: GdiEntry5
-! FUNCTION: GdiEntry6
-! FUNCTION: GdiEntry7
-! FUNCTION: GdiEntry8
-! FUNCTION: GdiEntry9
-! FUNCTION: GdiFixUpHandle
-! FUNCTION: GdiFlush
-! FUNCTION: GdiFullscreenControl
-! FUNCTION: GdiGetBatchLimit
-! FUNCTION: GdiGetCharDimensions
-! FUNCTION: GdiGetCodePage
-! FUNCTION: GdiGetDC
-! FUNCTION: GdiGetDevmodeForPage
-! FUNCTION: GdiGetLocalBrush
-! FUNCTION: GdiGetLocalDC
-! FUNCTION: GdiGetLocalFont
-! FUNCTION: GdiGetPageCount
-! FUNCTION: GdiGetPageHandle
-! FUNCTION: GdiGetSpoolFileHandle
-! FUNCTION: GdiGetSpoolMessage
-! FUNCTION: GdiGradientFill
-! FUNCTION: GdiInitializeLanguagePack
-! FUNCTION: GdiInitSpool
-! FUNCTION: GdiIsMetaFileDC
-! FUNCTION: GdiIsMetaPrintDC
-! FUNCTION: GdiIsPlayMetafileDC
-! FUNCTION: GdiPlayDCScript
-! FUNCTION: GdiPlayEMF
-! FUNCTION: GdiPlayJournal
-! FUNCTION: GdiPlayPageEMF
-! FUNCTION: GdiPlayPrivatePageEMF
-! FUNCTION: GdiPlayScript
-! FUNCTION: gdiPlaySpoolStream
-! FUNCTION: GdiPrinterThunk
-! FUNCTION: GdiProcessSetup
-! FUNCTION: GdiQueryFonts
-! FUNCTION: GdiQueryTable
-! FUNCTION: GdiRealizationInfo
-! FUNCTION: GdiReleaseDC
-! FUNCTION: GdiReleaseLocalDC
-! FUNCTION: GdiResetDCEMF
-! FUNCTION: GdiSetAttrs
-! FUNCTION: GdiSetBatchLimit
-! FUNCTION: GdiSetLastError
-! FUNCTION: GdiSetPixelFormat
-! FUNCTION: GdiSetServerAttr
-! FUNCTION: GdiStartDocEMF
-! FUNCTION: GdiStartPageEMF
-! FUNCTION: GdiSwapBuffers
-! FUNCTION: GdiTransparentBlt
-! FUNCTION: GdiValidateHandle
-! FUNCTION: GetArcDirection
-! FUNCTION: GetAspectRatioFilterEx
-! FUNCTION: GetBitmapAttributes
-! FUNCTION: GetBitmapBits
-! FUNCTION: GetBitmapDimensionEx
-! FUNCTION: GetBkColor
-! FUNCTION: GetBkMode
-! FUNCTION: GetBoundsRect
-! FUNCTION: GetBrushAttributes
-! FUNCTION: GetBrushOrgEx
-! FUNCTION: GetCharABCWidthsA
-! FUNCTION: GetCharABCWidthsFloatA
-! FUNCTION: GetCharABCWidthsFloatW
-! FUNCTION: GetCharABCWidthsI
-! FUNCTION: GetCharABCWidthsW
-! FUNCTION: GetCharacterPlacementA
-! FUNCTION: GetCharacterPlacementW
-! FUNCTION: GetCharWidth32A
-! FUNCTION: GetCharWidth32W
-! FUNCTION: GetCharWidthA
-! FUNCTION: GetCharWidthFloatA
-! FUNCTION: GetCharWidthFloatW
-! FUNCTION: GetCharWidthI
-! FUNCTION: GetCharWidthInfo
-! FUNCTION: GetCharWidthW
-! FUNCTION: GetClipBox
-! FUNCTION: GetClipRgn
-! FUNCTION: GetColorAdjustment
-! FUNCTION: GetColorSpace
-! FUNCTION: GetCurrentObject
-! FUNCTION: GetCurrentPositionEx
-! FUNCTION: GetDCBrushColor
-! FUNCTION: GetDCOrgEx
-! FUNCTION: GetDCPenColor
-! FUNCTION: GetDeviceCaps
-! FUNCTION: GetDeviceGammaRamp
-! FUNCTION: GetDIBColorTable
-! FUNCTION: GetDIBits
-! FUNCTION: GetEnhMetaFileA
-! FUNCTION: GetEnhMetaFileBits
-! FUNCTION: GetEnhMetaFileDescriptionA
-! FUNCTION: GetEnhMetaFileDescriptionW
-! FUNCTION: GetEnhMetaFileHeader
-! FUNCTION: GetEnhMetaFilePaletteEntries
-! FUNCTION: GetEnhMetaFilePixelFormat
-! FUNCTION: GetEnhMetaFileW
-! FUNCTION: GetETM
-! FUNCTION: GetEUDCTimeStamp
-! FUNCTION: GetEUDCTimeStampExW
-! FUNCTION: GetFontAssocStatus
-! FUNCTION: GetFontData
-! FUNCTION: GetFontLanguageInfo
-! FUNCTION: GetFontResourceInfoW
-! FUNCTION: GetFontUnicodeRanges
-! FUNCTION: GetGlyphIndicesA
-! FUNCTION: GetGlyphIndicesW
-! FUNCTION: GetGlyphOutline
-! FUNCTION: GetGlyphOutlineA
-! FUNCTION: GetGlyphOutlineW
-! FUNCTION: GetGlyphOutlineWow
-! FUNCTION: GetGraphicsMode
-! FUNCTION: GetHFONT
-! FUNCTION: GetICMProfileA
-! FUNCTION: GetICMProfileW
-! FUNCTION: GetKerningPairs
-! FUNCTION: GetKerningPairsA
-! FUNCTION: GetKerningPairsW
-! FUNCTION: GetLayout
-! FUNCTION: GetLogColorSpaceA
-! FUNCTION: GetLogColorSpaceW
-! FUNCTION: GetMapMode
-! FUNCTION: GetMetaFileA
-! FUNCTION: GetMetaFileBitsEx
-! FUNCTION: GetMetaFileW
-! FUNCTION: GetMetaRgn
-! FUNCTION: GetMiterLimit
-! FUNCTION: GetNearestColor
-! FUNCTION: GetNearestPaletteIndex
-! FUNCTION: GetObjectA
-! FUNCTION: GetObjectType
-! FUNCTION: GetObjectW
-! FUNCTION: GetOutlineTextMetricsA
-! FUNCTION: GetOutlineTextMetricsW
-! FUNCTION: GetPaletteEntries
-! FUNCTION: GetPath
-! FUNCTION: GetPixel
-! FUNCTION: GetPixelFormat
-! FUNCTION: GetPolyFillMode
-! FUNCTION: GetRandomRgn
-! FUNCTION: GetRasterizerCaps
-! FUNCTION: GetRegionData
-! FUNCTION: GetRelAbs
-! FUNCTION: GetRgnBox
-! FUNCTION: GetROP2
-FUNCTION: HGDIOBJ GetStockObject ( int fnObject ) ;
-! FUNCTION: GetStretchBltMode
-! FUNCTION: GetStringBitmapA
-! FUNCTION: GetStringBitmapW
-! FUNCTION: GetSystemPaletteEntries
-! FUNCTION: GetSystemPaletteUse
-! FUNCTION: GetTextAlign
-! FUNCTION: GetTextCharacterExtra
-! FUNCTION: GetTextCharset
-! FUNCTION: GetTextCharsetInfo
-! FUNCTION: GetTextColor
-! FUNCTION: GetTextExtentExPointA
-! FUNCTION: GetTextExtentExPointI
-! FUNCTION: GetTextExtentExPointW
-! FUNCTION: GetTextExtentExPointWPri
-! FUNCTION: GetTextExtentPoint32A
-! FUNCTION: GetTextExtentPoint32W
-! FUNCTION: GetTextExtentPointA
-! FUNCTION: GetTextExtentPointI
-! FUNCTION: GetTextExtentPointW
-! FUNCTION: GetTextFaceA
-! FUNCTION: GetTextFaceAliasW
-! FUNCTION: GetTextFaceW
-! FUNCTION: GetTextMetricsA
-! FUNCTION: GetTextMetricsW
-! FUNCTION: GetTransform
-! FUNCTION: GetViewportExtEx
-! FUNCTION: GetViewportOrgEx
-! FUNCTION: GetWindowExtEx
-! FUNCTION: GetWindowOrgEx
-! FUNCTION: GetWinMetaFileBits
-! FUNCTION: GetWorldTransform
-! FUNCTION: HT_Get8BPPFormatPalette
-! FUNCTION: HT_Get8BPPMaskPalette
-! FUNCTION: IntersectClipRect
-! FUNCTION: InvertRgn
-! FUNCTION: IsValidEnhMetaRecord
-! FUNCTION: IsValidEnhMetaRecordOffExt
-! FUNCTION: LineDDA
-! FUNCTION: LineTo
-! FUNCTION: LPtoDP
-! FUNCTION: MaskBlt
-! FUNCTION: MirrorRgn
-! FUNCTION: ModifyWorldTransform
-! FUNCTION: MoveToEx
-! FUNCTION: NamedEscape
-! FUNCTION: OffsetClipRgn
-! FUNCTION: OffsetRgn
-! FUNCTION: OffsetViewportOrgEx
-! FUNCTION: OffsetWindowOrgEx
-! FUNCTION: PaintRgn
-! FUNCTION: PatBlt
-! FUNCTION: PATHOBJ_bEnum
-! FUNCTION: PATHOBJ_bEnumClipLines
-! FUNCTION: PATHOBJ_vEnumStart
-! FUNCTION: PATHOBJ_vEnumStartClipLines
-! FUNCTION: PATHOBJ_vGetBounds
-! FUNCTION: PathToRegion
-! FUNCTION: Pie
-! FUNCTION: PlayEnhMetaFile
-! FUNCTION: PlayEnhMetaFileRecord
-! FUNCTION: PlayMetaFile
-! FUNCTION: PlayMetaFileRecord
-! FUNCTION: PlgBlt
-! FUNCTION: PolyBezier
-! FUNCTION: PolyBezierTo
-! FUNCTION: PolyDraw
-! FUNCTION: Polygon
-! FUNCTION: Polyline
-! FUNCTION: PolylineTo
-! FUNCTION: PolyPatBlt
-! FUNCTION: PolyPolygon
-! FUNCTION: PolyPolyline
-! FUNCTION: PolyTextOutA
-! FUNCTION: PolyTextOutW
-! FUNCTION: PtInRegion
-! FUNCTION: PtVisible
-! FUNCTION: QueryFontAssocStatus
-! FUNCTION: RealizePalette
-! FUNCTION: Rectangle
-! FUNCTION: RectInRegion
-! FUNCTION: RectVisible
-! FUNCTION: RemoveFontMemResourceEx
-! FUNCTION: RemoveFontResourceA
-! FUNCTION: RemoveFontResourceExA
-! FUNCTION: RemoveFontResourceExW
-! FUNCTION: RemoveFontResourceTracking
-! FUNCTION: RemoveFontResourceW
-! FUNCTION: ResetDCA
-! FUNCTION: ResetDCW
-! FUNCTION: ResizePalette
-! FUNCTION: RestoreDC
-! FUNCTION: RoundRect
-! FUNCTION: SaveDC
-! FUNCTION: ScaleViewportExtEx
-! FUNCTION: ScaleWindowExtEx
-! FUNCTION: SelectBrushLocal
-! FUNCTION: SelectClipPath
-! FUNCTION: SelectClipRgn
-! FUNCTION: SelectFontLocal
-! FUNCTION: SelectObject
-! FUNCTION: SelectPalette
-! FUNCTION: SetAbortProc
-! FUNCTION: SetArcDirection
-! FUNCTION: SetBitmapAttributes
-! FUNCTION: SetBitmapBits
-! FUNCTION: SetBitmapDimensionEx
-! FUNCTION: SetBkColor
-! FUNCTION: SetBkMode
-! FUNCTION: SetBoundsRect
-! FUNCTION: SetBrushAttributes
-! FUNCTION: SetBrushOrgEx
-! FUNCTION: SetColorAdjustment
-! FUNCTION: SetColorSpace
-! FUNCTION: SetDCBrushColor
-! FUNCTION: SetDCPenColor
-! FUNCTION: SetDeviceGammaRamp
-! FUNCTION: SetDIBColorTable
-! FUNCTION: SetDIBits
-! FUNCTION: SetDIBitsToDevice
-! FUNCTION: SetEnhMetaFileBits
-! FUNCTION: SetFontEnumeration
-! FUNCTION: SetGraphicsMode
-! FUNCTION: SetICMMode
-! FUNCTION: SetICMProfileA
-! FUNCTION: SetICMProfileW
-! FUNCTION: SetLayout
-! FUNCTION: SetLayoutWidth
-! FUNCTION: SetMagicColors
-! FUNCTION: SetMapMode
-! FUNCTION: SetMapperFlags
-! FUNCTION: SetMetaFileBitsEx
-! FUNCTION: SetMetaRgn
-! FUNCTION: SetMiterLimit
-! FUNCTION: SetPaletteEntries
-! FUNCTION: SetPixel
-FUNCTION: BOOL SetPixelFormat ( HDC hDC, int iPixelFormat, PFD* ppfd ) ;
-! FUNCTION: SetPixelV
-! FUNCTION: SetPolyFillMode
-! FUNCTION: SetRectRgn
-! FUNCTION: SetRelAbs
-! FUNCTION: SetROP2
-! FUNCTION: SetStretchBltMode
-! FUNCTION: SetSystemPaletteUse
-! FUNCTION: SetTextAlign
-! FUNCTION: SetTextCharacterExtra
-! FUNCTION: SetTextColor
-! FUNCTION: SetTextJustification
-! FUNCTION: SetViewportExtEx
-! FUNCTION: SetViewportOrgEx
-! FUNCTION: SetVirtualResolution
-! FUNCTION: SetWindowExtEx
-! FUNCTION: SetWindowOrgEx
-! FUNCTION: SetWinMetaFileBits
-! FUNCTION: SetWorldTransform
-! FUNCTION: StartDocA
-! FUNCTION: StartDocW
-! FUNCTION: StartFormPage
-! FUNCTION: StartPage
-! FUNCTION: StretchBlt
-! FUNCTION: StretchDIBits
-! FUNCTION: STROBJ_bEnum
-! FUNCTION: STROBJ_bEnumPositionsOnly
-! FUNCTION: STROBJ_bGetAdvanceWidths
-! FUNCTION: STROBJ_dwGetCodePage
-! FUNCTION: STROBJ_vEnumStart
-! FUNCTION: StrokeAndFillPath
-! FUNCTION: StrokePath
-FUNCTION: BOOL SwapBuffers ( HDC hDC ) ;
-! FUNCTION: TextOutA
-! FUNCTION: TextOutW
-! FUNCTION: TranslateCharsetInfo
-! FUNCTION: UnloadNetworkFonts
-! FUNCTION: UnrealizeObject
-! FUNCTION: UpdateColors
-! FUNCTION: UpdateICMRegKeyA
-! FUNCTION: UpdateICMRegKeyW
-! FUNCTION: WidenPath
-! FUNCTION: XFORMOBJ_bApplyXform
-! FUNCTION: XFORMOBJ_iGetXform
-! FUNCTION: XLATEOBJ_cGetPalette
-! FUNCTION: XLATEOBJ_hGetColorTransform
-! FUNCTION: XLATEOBJ_iXlate
-! FUNCTION: XLATEOBJ_piVector
diff --git a/core/windows/io.factor b/core/windows/io.factor
deleted file mode 100644 (file)
index e36bcac..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: kernel win32-api ;
-IN: io-internals
-
-! Allows use of the ui without native i/o.
-! Overwritten when native i/o is loaded.
-: io-multiplex ( ms -- ) 0 SleepEx drop ;
-
diff --git a/core/windows/kernel32-constants.factor b/core/windows/kernel32-constants.factor
deleted file mode 100644 (file)
index d882a68..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-IN: win32-api
-USING: alien kernel errors ;
-
-: GHND HEX: 40 ; inline
-: GMEM_FIXED 0 ; inline
-: GMEM_MOVEABLE 2 ; inline
-: GMEM_ZEROINIT HEX: 40 ; inline
-: GPTR HEX: 40 ; inline
-
-: GENERIC_READ    HEX: 80000000 ;
-: GENERIC_WRITE   HEX: 40000000 ;
-: GENERIC_EXECUTE HEX: 20000000 ;
-: GENERIC_ALL     HEX: 10000000 ;
-
-: CREATE_NEW        1 ;
-: CREATE_ALWAYS     2 ;
-: OPEN_EXISTING     3 ;
-: OPEN_ALWAYS       4 ;
-: TRUNCATE_EXISTING 5 ;
-
-: FILE_SHARE_READ 1 ;
-: FILE_SHARE_WRITE 2 ;
-: FILE_SHARE_DELETE 4 ;
-
-: FILE_FLAG_WRITE_THROUGH       HEX: 80000000 ;
-: FILE_FLAG_OVERLAPPED          HEX: 40000000 ;
-: FILE_FLAG_NO_BUFFERING        HEX: 20000000 ;
-: FILE_FLAG_RANDOM_ACCESS       HEX: 10000000 ;
-: FILE_FLAG_SEQUENTIAL_SCAN     HEX: 08000000 ;
-: FILE_FLAG_DELETE_ON_CLOSE     HEX: 04000000 ;
-: FILE_FLAG_BACKUP_SEMANTICS    HEX: 02000000 ;
-: FILE_FLAG_POSIX_SEMANTICS     HEX: 01000000 ;
-: FILE_FLAG_OPEN_REPARSE_POINT  HEX: 00200000 ;
-: FILE_FLAG_OPEN_NO_RECALL      HEX: 00100000 ;
-: FILE_FLAG_FIRST_PIPE_INSTANCE HEX: 00080000 ;
-
-: STD_INPUT_HANDLE  -10 ;
-: STD_OUTPUT_HANDLE -11 ;
-: STD_ERROR_HANDLE  -12 ;
-
-: INVALID_HANDLE_VALUE -1 <alien> ;
-: INVALID_FILE_SIZE HEX: FFFFFFFF ;
-
-: INFINITE HEX: FFFFFFFF ;
-
-! From C:\cygwin\usr\include\w32api\winbase.h
-: FILE_TYPE_UNKNOWN 0 ;
-: FILE_TYPE_DISK 1 ;
-: FILE_TYPE_CHAR 2 ;
-: FILE_TYPE_PIPE 3 ;
-: FILE_TYPE_REMOTE HEX: 8000 ;
-
-: TIME_ZONE_ID_UNKNOWN 0 ; inline
-: TIME_ZONE_ID_STANDARD 1 ; inline
-: TIME_ZONE_ID_DAYLIGHT 2 ; inline
-: TIME_ZONE_ID_INVALID HEX: FFFFFFFF ; inline
-
-
-: CREATE_DEFAULT_ERROR_MODE HEX: 4000000 ; inline
-: DETACHED_PROCESS 8 ; inline
-: PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 ; inline
diff --git a/core/windows/kernel32-structs.factor b/core/windows/kernel32-structs.factor
deleted file mode 100644 (file)
index 31beaee..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-IN: win32-api
-
-USING: alien kernel ;
-
-BEGIN-STRUCT: overlapped-ext
-    FIELD: int internal
-    FIELD: int internal-high
-    FIELD: int offset
-    FIELD: int offset-high
-    FIELD: void* event
-    FIELD: int user-data
-END-STRUCT
-
-BEGIN-STRUCT: SYSTEMTIME
-    FIELD: WORD wYear
-    FIELD: WORD wMonth
-    FIELD: WORD wDayOfWeek
-    FIELD: WORD wDay
-    FIELD: WORD wHour
-    FIELD: WORD wMinute
-    FIELD: WORD wSecond
-    FIELD: WORD wMilliseconds
-END-STRUCT
-
-BEGIN-STRUCT: TIME_ZONE_INFORMATION
-    FIELD: LONG Bias
-    ! FIELD: WCHAR[32] StandardName
-    FIELD: int a0
-    FIELD: int a1
-    FIELD: int a2
-    FIELD: int a3
-    FIELD: int a4
-    FIELD: int a5
-    FIELD: int a6
-    FIELD: int a7
-    FIELD: int a8
-    FIELD: int a9
-    FIELD: int a10
-    FIELD: int a11
-    FIELD: int a12
-    FIELD: int a13
-    FIELD: int a14
-    FIELD: int a15
-    FIELD: SYSTEMTIME StandardDate
-    FIELD: LONG StandardBias
-    ! FIELD: WCHAR[32] DaylightName
-    FIELD: int b0
-    FIELD: int b1
-    FIELD: int b2
-    FIELD: int b3
-    FIELD: int b4
-    FIELD: int b5
-    FIELD: int b6
-    FIELD: int b7
-    FIELD: int b8
-    FIELD: int b9
-    FIELD: int b10
-    FIELD: int b11
-    FIELD: int b12
-    FIELD: int b13
-    FIELD: int b14
-    FIELD: int b15
-    FIELD: SYSTEMTIME DaylightDate
-    FIELD: LONG DaylightBias
-END-STRUCT
-
-
-BEGIN-STRUCT: FILETIME
-    FIELD: DWORD dwLowDateTime
-    FIELD: DWORD dwHighDateTime
-END-STRUCT
-
-BEGIN-STRUCT: STARTUPINFO
-    FIELD: DWORD cb
-    FIELD: LPTSTR lpReserved
-    FIELD: LPTSTR lpDesktop
-    FIELD: LPTSTR lpTitle
-    FIELD: DWORD dwX
-    FIELD: DWORD dwY
-    FIELD: DWORD dwXSize
-    FIELD: DWORD dwYSize
-    FIELD: DWORD dwXCountChars
-    FIELD: DWORD dwYCountChars
-    FIELD: DWORD dwFillAttribute
-    FIELD: DWORD dwFlags
-    FIELD: WORD wShowWindow
-    FIELD: WORD cbReserved2
-    FIELD: LPBYTE lpReserved2
-    FIELD: HANDLE hStdInput
-    FIELD: HANDLE hStdOutput
-    FIELD: HANDLE hStdError
-END-STRUCT
-
-TYPEDEF: void* LPSTARTUPINFO
-
-BEGIN-STRUCT: PROCESS_INFORMATION
-    FIELD: HANDLE hProcess
-    FIELD: HANDLE hThread
-    FIELD: DWORD dwProcessId
-    FIELD: DWORD dwThreadId
-END-STRUCT
-
-BEGIN-STRUCT: SYSTEM_INFO
-    FIELD: DWORD dwOemId
-    ! FIELD: WORD wProcessorArchitecture
-    ! FIELD: WORD wReserved
-    FIELD: DWORD dwPageSize
-    FIELD: LPVOID lpMinimumApplicationAddress
-    FIELD: LPVOID lpMaximumApplicationAddress
-    FIELD: DWORD_PTR dwActiveProcessorMask
-    FIELD: DWORD dwNumberOfProcessors
-    FIELD: DWORD dwProcessorType
-    FIELD: DWORD dwAllocationGranularity
-    FIELD: WORD wProcessorLevel
-    FIELD: WORD wProcessorRevision
-END-STRUCT
-
-TYPEDEF: void* LPSYSTEM_INFO
-
-BEGIN-STRUCT: MEMORYSTATUS
-    FIELD: DWORD dwLength
-    FIELD: DWORD dwMemoryLoad
-    FIELD: SIZE_T dwTotalPhys
-    FIELD: SIZE_T dwAvailPhys
-    FIELD: SIZE_T dwTotalPageFile
-    FIELD: SIZE_T dwAvailPageFile
-    FIELD: SIZE_T dwTotalVirtual
-    FIELD: SIZE_T dwAvailVirtual
-END-STRUCT
-TYPEDEF: void* LPMEMORYSTATUS
-
-BEGIN-STRUCT: MEMORYSTATUSEX
-    FIELD: DWORD dwLength
-    FIELD: DWORD dwMemoryLoad
-    FIELD: DWORDLONG ullTotalPhys
-    FIELD: DWORDLONG ullAvailPhys
-    FIELD: DWORDLONG ullTotalPageFile
-    FIELD: DWORDLONG ullAvailPageFile
-    FIELD: DWORDLONG ullTotalVirtual
-    FIELD: DWORDLONG ullAvailVirtual
-    FIELD: DWORDLONG ullAvailExtendedVirtual
-END-STRUCT
-TYPEDEF: void* LPMEMORYSTATUSEX
-
-BEGIN-STRUCT: OSVERSIONINFO
-    FIELD: DWORD dwOSVersionInfoSize
-    FIELD: DWORD dwMajorVersion
-    FIELD: DWORD dwMinorVersion
-    FIELD: DWORD dwBuildNumber
-    FIELD: DWORD dwPlatformId
-    ! FIELD: char[128] szCSDVersion
-END-STRUCT
-TYPEDEF: void* LPOSVERSIONINFO
diff --git a/core/windows/kernel32-types.factor b/core/windows/kernel32-types.factor
deleted file mode 100644 (file)
index 44595c1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-IN: win32-api
-
-TYPEDEF: void* POVERLAPPED
-TYPEDEF: void* LPOVERLAPPED
-TYPEDEF: void* LPSECURITY_ATTRIBUTES
-TYPEDEF: void* LPPROCESS_INFORMATION
-
-TYPEDEF: SYSTEMTIME SYSTEMTIME
-TYPEDEF: SYSTEMTIME* PSYSTEMTIME
-TYPEDEF: PSYSTEMTIME LPSYSTEMTIME
-
-TYPEDEF: TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION
-TYPEDEF: TIME_ZONE_INFORMATION* PTIME_ZONE_INFORMATION
-TYPEDEF: PTIME_ZONE_INFORMATION LPTIME_ZONE_INFORMATION
-
-TYPEDEF: FILETIME FILETIME
-TYPEDEF: FILETIME* PFILETIME
-TYPEDEF: PFILETIME LPFILETIME
-
diff --git a/core/windows/kernel32.factor b/core/windows/kernel32.factor
deleted file mode 100644 (file)
index 96bca66..0000000
+++ /dev/null
@@ -1,990 +0,0 @@
-IN: win32-api
-
-LIBRARY: kernel32
-! FUNCTION: _hread
-! FUNCTION: _hwrite
-! FUNCTION: _lclose
-! FUNCTION: _lcreat
-! FUNCTION: _llseek
-! FUNCTION: _lopen
-! FUNCTION: _lread
-! FUNCTION: _lwrite
-! FUNCTION: ActivateActCtx
-! FUNCTION: AddAtomA
-! FUNCTION: AddAtomW
-! FUNCTION: AddConsoleAliasA
-! FUNCTION: AddConsoleAliasW
-! FUNCTION: AddLocalAlternateComputerNameA
-! FUNCTION: AddLocalAlternateComputerNameW
-! FUNCTION: AddRefActCtx
-! FUNCTION: AddVectoredExceptionHandler
-! FUNCTION: AllocateUserPhysicalPages
-! FUNCTION: AllocConsole
-! FUNCTION: AreFileApisANSI
-! FUNCTION: AssignProcessToJobObject
-! FUNCTION: AttachConsole
-! FUNCTION: BackupRead
-! FUNCTION: BackupSeek
-! FUNCTION: BackupWrite
-! FUNCTION: BaseCheckAppcompatCache
-! FUNCTION: BaseCleanupAppcompatCache
-! FUNCTION: BaseCleanupAppcompatCacheSupport
-! FUNCTION: BaseDumpAppcompatCache
-! FUNCTION: BaseFlushAppcompatCache
-! FUNCTION: BaseInitAppcompatCache
-! FUNCTION: BaseInitAppcompatCacheSupport
-! FUNCTION: BasepCheckWinSaferRestrictions
-! FUNCTION: BaseProcessInitPostImport
-! FUNCTION: BaseQueryModuleData
-! FUNCTION: BaseUpdateAppcompatCache
-! FUNCTION: Beep
-! FUNCTION: BeginUpdateResourceA
-! FUNCTION: BeginUpdateResourceW
-! FUNCTION: BindIoCompletionCallback
-! FUNCTION: BuildCommDCBA
-! FUNCTION: BuildCommDCBAndTimeoutsA
-! FUNCTION: BuildCommDCBAndTimeoutsW
-! FUNCTION: BuildCommDCBW
-! FUNCTION: CallNamedPipeA
-! FUNCTION: CallNamedPipeW
-! FUNCTION: CancelDeviceWakeupRequest
-FUNCTION: BOOL CancelIo ( HANDLE h ) ;
-! FUNCTION: CancelTimerQueueTimer
-! FUNCTION: CancelWaitableTimer
-! FUNCTION: ChangeTimerQueueTimer
-! FUNCTION: CheckNameLegalDOS8Dot3A
-! FUNCTION: CheckNameLegalDOS8Dot3W
-! FUNCTION: CheckRemoteDebuggerPresent
-! FUNCTION: ClearCommBreak
-! FUNCTION: ClearCommError
-! FUNCTION: CloseConsoleHandle
-FUNCTION: BOOL CloseHandle ( HANDLE h ) ;
-! FUNCTION: CloseProfileUserMapping
-! FUNCTION: CmdBatNotification
-! FUNCTION: CommConfigDialogA
-! FUNCTION: CommConfigDialogW
-! FUNCTION: CompareFileTime
-! FUNCTION: CompareStringA
-! FUNCTION: CompareStringW
-! FUNCTION: ConnectNamedPipe
-! FUNCTION: ConsoleMenuControl
-! FUNCTION: ContinueDebugEvent
-! FUNCTION: ConvertDefaultLocale
-! FUNCTION: ConvertFiberToThread
-! FUNCTION: ConvertThreadToFiber
-! FUNCTION: CopyFileA
-! FUNCTION: CopyFileExA
-! FUNCTION: CopyFileExW
-! FUNCTION: CopyFileW
-! FUNCTION: CopyLZFile
-! FUNCTION: CreateActCtxA
-! FUNCTION: CreateActCtxW
-! FUNCTION: CreateConsoleScreenBuffer
-! FUNCTION: CreateDirectoryA
-! FUNCTION: CreateDirectoryExA
-! FUNCTION: CreateDirectoryExW
-! FUNCTION: CreateDirectoryW
-! FUNCTION: CreateEventA
-! FUNCTION: CreateEventW
-! FUNCTION: CreateFiber
-! FUNCTION: CreateFiberEx
-
-FUNCTION: HANDLE CreateFileA ( char* lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttribures, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) ;
-
-FUNCTION: HANDLE CreateFileW ( char* lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttribures, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) ;
-: CreateFile \ CreateFileW \ CreateFileA unicode-exec ;
-
-FUNCTION: HANDLE  CreateFileMappingA ( HANDLE hFile,
-                                       LPSECURITY_ATTRIBUTES lpAttributes,
-                                       DWORD flProtect,
-                                       DWORD dwMaximumSizeHigh,
-                                       DWORD dwMaximumSizeLow,
-                                       LPCTSTR lpName ) ;
-: CreateFileMapping CreateFileMappingA ;
-
-! FUNCTION: CreateHardLinkA
-! FUNCTION: CreateHardLinkW
-! FUNCTION: HANDLE CreateIoCompletionPort ( HANDLE hFileHandle, HANDLE hExistingCompletionPort, ULONG_PTR uCompletionKey, DWORD dwNumberofConcurrentThreads ) ;
-FUNCTION: HANDLE CreateIoCompletionPort ( HANDLE hFileHandle, HANDLE hExistingCompletionPort, void* uCompletionKey, DWORD dwNumberofConcurrentThreads ) ;
-! FUNCTION: CreateJobObjectA
-! FUNCTION: CreateJobObjectW
-! FUNCTION: CreateJobSet
-! FUNCTION: CreateMailslotA
-! FUNCTION: CreateMailslotW
-! FUNCTION: CreateMemoryResourceNotification
-! FUNCTION: CreateMutexA
-! FUNCTION: CreateMutexW
-! FUNCTION: CreateNamedPipeA
-! FUNCTION: CreateNamedPipeW
-! FUNCTION: CreateNlsSecurityDescriptor
-! FUNCTION: CreatePipe
-FUNCTION: BOOL CreateProcessA ( LPCTSTR lpApplicationname,
-                                LPTSTR lpCommandLine,
-                                LPSECURITY_ATTRIBUTES lpProcessAttributes,
-                                LPSECURITY_ATTRIBUTES lpThreadAttributes,
-                                BOOL bInheritHandles,
-                                DWORD dwCreationFlags,
-                                LPVOID lpEnvironment,
-                                LPCTSTR lpCurrentDirectory,
-                                LPSTARTUPINFO lpStartupInfo,
-                                LPPROCESS_INFORMATION lpProcessInformation ) ;
-: CreateProcess CreateProcessA ;
-! FUNCTION: CreateProcessInternalA
-! FUNCTION: CreateProcessInternalW
-! FUNCTION: CreateProcessInternalWSecure
-! FUNCTION: CreateRemoteThread
-! FUNCTION: CreateSemaphoreA
-! FUNCTION: CreateSemaphoreW
-! FUNCTION: CreateSocketHandle
-! FUNCTION: CreateTapePartition
-! FUNCTION: CreateThread
-! FUNCTION: CreateTimerQueue
-! FUNCTION: CreateTimerQueueTimer
-! FUNCTION: CreateToolhelp32Snapshot
-! FUNCTION: CreateVirtualBuffer
-! FUNCTION: CreateWaitableTimerA
-! FUNCTION: CreateWaitableTimerW
-! FUNCTION: DeactivateActCtx
-! FUNCTION: DebugActiveProcess
-! FUNCTION: DebugActiveProcessStop
-! FUNCTION: DebugBreak
-! FUNCTION: DebugBreakProcess
-! FUNCTION: DebugSetProcessKillOnExit
-! FUNCTION: DecodePointer
-! FUNCTION: DecodeSystemPointer
-! FUNCTION: DefineDosDeviceA
-! FUNCTION: DefineDosDeviceW
-! FUNCTION: DelayLoadFailureHook
-! FUNCTION: DeleteAtom
-! FUNCTION: DeleteCriticalSection
-! FUNCTION: DeleteFiber
-! FUNCTION: DeleteFileA
-! FUNCTION: DeleteFileW
-! FUNCTION: DeleteTimerQueue
-! FUNCTION: DeleteTimerQueueEx
-! FUNCTION: DeleteTimerQueueTimer
-! FUNCTION: DeleteVolumeMountPointA
-! FUNCTION: DeleteVolumeMountPointW
-! FUNCTION: DeviceIoControl
-! FUNCTION: DisableThreadLibraryCalls
-! FUNCTION: DisconnectNamedPipe
-! FUNCTION: DnsHostnameToComputerNameA
-! FUNCTION: DnsHostnameToComputerNameW
-! FUNCTION: DosDateTimeToFileTime
-! FUNCTION: DosPathToSessionPathA
-! FUNCTION: DosPathToSessionPathW
-! FUNCTION: DuplicateConsoleHandle
-! FUNCTION: DuplicateHandle
-! FUNCTION: EncodePointer
-! FUNCTION: EncodeSystemPointer
-! FUNCTION: EndUpdateResourceA
-! FUNCTION: EndUpdateResourceW
-! FUNCTION: EnterCriticalSection
-! FUNCTION: EnumCalendarInfoA
-! FUNCTION: EnumCalendarInfoExA
-! FUNCTION: EnumCalendarInfoExW
-! FUNCTION: EnumCalendarInfoW
-! FUNCTION: EnumDateFormatsA
-! FUNCTION: EnumDateFormatsExA
-! FUNCTION: EnumDateFormatsExW
-! FUNCTION: EnumDateFormatsW
-! FUNCTION: EnumerateLocalComputerNamesA
-! FUNCTION: EnumerateLocalComputerNamesW
-! FUNCTION: EnumLanguageGroupLocalesA
-! FUNCTION: EnumLanguageGroupLocalesW
-! FUNCTION: EnumResourceLanguagesA
-! FUNCTION: EnumResourceLanguagesW
-! FUNCTION: EnumResourceNamesA
-! FUNCTION: EnumResourceNamesW
-! FUNCTION: EnumResourceTypesA
-! FUNCTION: EnumResourceTypesW
-! FUNCTION: EnumSystemCodePagesA
-! FUNCTION: EnumSystemCodePagesW
-! FUNCTION: EnumSystemGeoID
-! FUNCTION: EnumSystemLanguageGroupsA
-! FUNCTION: EnumSystemLanguageGroupsW
-! FUNCTION: EnumSystemLocalesA
-! FUNCTION: EnumSystemLocalesW
-! FUNCTION: EnumTimeFormatsA
-! FUNCTION: EnumTimeFormatsW
-! FUNCTION: EnumUILanguagesA
-! FUNCTION: EnumUILanguagesW
-! FUNCTION: EraseTape
-! FUNCTION: EscapeCommFunction
-! FUNCTION: ExitProcess
-! FUNCTION: ExitThread
-! FUNCTION: ExitVDM
-! FUNCTION: ExpandEnvironmentStringsA
-! FUNCTION: ExpandEnvironmentStringsW
-! FUNCTION: ExpungeConsoleCommandHistoryA
-! FUNCTION: ExpungeConsoleCommandHistoryW
-! FUNCTION: ExtendVirtualBuffer
-! FUNCTION: FatalAppExitA
-! FUNCTION: FatalAppExitW
-! FUNCTION: FatalExit
-! FUNCTION: FileTimeToDosDateTime
-! FUNCTION: FileTimeToLocalFileTime
-! FUNCTION: FileTimeToSystemTime
-! FUNCTION: FillConsoleOutputAttribute
-! FUNCTION: FillConsoleOutputCharacterA
-! FUNCTION: FillConsoleOutputCharacterW
-! FUNCTION: FindActCtxSectionGuid
-! FUNCTION: FindActCtxSectionStringA
-! FUNCTION: FindActCtxSectionStringW
-! FUNCTION: FindAtomA
-! FUNCTION: FindAtomW
-! FUNCTION: FindClose
-! FUNCTION: FindCloseChangeNotification
-! FUNCTION: FindFirstChangeNotificationA
-! FUNCTION: FindFirstChangeNotificationW
-! FUNCTION: FindFirstFileA
-! FUNCTION: FindFirstFileExA
-! FUNCTION: FindFirstFileExW
-! FUNCTION: FindFirstFileW
-! FUNCTION: FindFirstVolumeA
-! FUNCTION: FindFirstVolumeMountPointA
-! FUNCTION: FindFirstVolumeMountPointW
-! FUNCTION: FindFirstVolumeW
-! FUNCTION: FindNextChangeNotification
-! FUNCTION: FindNextFileA
-! FUNCTION: FindNextFileW
-! FUNCTION: FindNextVolumeA
-! FUNCTION: FindNextVolumeMountPointA
-! FUNCTION: FindNextVolumeMountPointW
-! FUNCTION: FindNextVolumeW
-! FUNCTION: FindResourceA
-! FUNCTION: FindResourceExA
-! FUNCTION: FindResourceExW
-! FUNCTION: FindResourceW
-! FUNCTION: FindVolumeClose
-! FUNCTION: FindVolumeMountPointClose
-! FUNCTION: FlushConsoleInputBuffer
-! FUNCTION: FlushFileBuffers
-! FUNCTION: FlushInstructionCache
-! FUNCTION: FlushViewOfFile
-! FUNCTION: FoldStringA
-! FUNCTION: FoldStringW
-! FUNCTION: FormatMessageA
-! FUNCTION: FormatMessageW
-! FUNCTION: FreeConsole
-! FUNCTION: FreeEnvironmentStringsA
-! FUNCTION: FreeEnvironmentStringsW
-! FUNCTION: FreeLibrary
-! FUNCTION: FreeLibraryAndExitThread
-! FUNCTION: FreeResource
-! FUNCTION: FreeUserPhysicalPages
-! FUNCTION: FreeVirtualBuffer
-! FUNCTION: GenerateConsoleCtrlEvent
-! FUNCTION: GetACP
-! FUNCTION: GetAtomNameA
-! FUNCTION: GetAtomNameW
-! FUNCTION: GetBinaryType
-! FUNCTION: GetBinaryTypeA
-! FUNCTION: GetBinaryTypeW
-! FUNCTION: GetCalendarInfoA
-! FUNCTION: GetCalendarInfoW
-! FUNCTION: GetCommandLineA
-! FUNCTION: GetCommandLineW
-! FUNCTION: GetCommConfig
-! FUNCTION: GetCommMask
-! FUNCTION: GetCommModemStatus
-! FUNCTION: GetCommProperties
-! FUNCTION: GetCommState
-! FUNCTION: GetCommTimeouts
-! FUNCTION: GetComPlusPackageInstallStatus
-! FUNCTION: GetCompressedFileSizeA
-! FUNCTION: GetCompressedFileSizeW
-! FUNCTION: GetComputerNameA
-! FUNCTION: GetComputerNameExA
-! FUNCTION: GetComputerNameExW
-! FUNCTION: GetComputerNameW
-! FUNCTION: GetConsoleAliasA
-! FUNCTION: GetConsoleAliasesA
-! FUNCTION: GetConsoleAliasesLengthA
-! FUNCTION: GetConsoleAliasesLengthW
-! FUNCTION: GetConsoleAliasesW
-! FUNCTION: GetConsoleAliasExesA
-! FUNCTION: GetConsoleAliasExesLengthA
-! FUNCTION: GetConsoleAliasExesLengthW
-! FUNCTION: GetConsoleAliasExesW
-! FUNCTION: GetConsoleAliasW
-! FUNCTION: GetConsoleCharType
-! FUNCTION: GetConsoleCommandHistoryA
-! FUNCTION: GetConsoleCommandHistoryLengthA
-! FUNCTION: GetConsoleCommandHistoryLengthW
-! FUNCTION: GetConsoleCommandHistoryW
-! FUNCTION: GetConsoleCP
-! FUNCTION: GetConsoleCursorInfo
-! FUNCTION: GetConsoleCursorMode
-! FUNCTION: GetConsoleDisplayMode
-! FUNCTION: GetConsoleFontInfo
-! FUNCTION: GetConsoleFontSize
-! FUNCTION: GetConsoleHardwareState
-! FUNCTION: GetConsoleInputExeNameA
-! FUNCTION: GetConsoleInputExeNameW
-! FUNCTION: GetConsoleInputWaitHandle
-! FUNCTION: GetConsoleKeyboardLayoutNameA
-! FUNCTION: GetConsoleKeyboardLayoutNameW
-! FUNCTION: GetConsoleMode
-! FUNCTION: GetConsoleNlsMode
-! FUNCTION: GetConsoleOutputCP
-! FUNCTION: GetConsoleProcessList
-! FUNCTION: GetConsoleScreenBufferInfo
-! FUNCTION: GetConsoleSelectionInfo
-FUNCTION: DWORD GetConsoleTitleA ( LPCTSTR lpConsoleTitle, DWORD nSize ) ;
-FUNCTION: DWORD GetConsoleTitleW ( LPWSTR lpConsoleTitle, DWORD nSize ) ;
-: GetConsoleTitle \ GetConsoleTitleW \ GetConsoleTitleA unicode-exec ;
-! FUNCTION: GetConsoleWindow
-! FUNCTION: GetCPFileNameFromRegistry
-! FUNCTION: GetCPInfo
-! FUNCTION: GetCPInfoExA
-! FUNCTION: GetCPInfoExW
-! FUNCTION: GetCurrencyFormatA
-! FUNCTION: GetCurrencyFormatW
-! FUNCTION: GetCurrentActCtx
-! FUNCTION: GetCurrentConsoleFont
-! FUNCTION: GetCurrentDirectoryA
-! FUNCTION: GetCurrentDirectoryW
-! FUNCTION: GetCurrentProcess
-! FUNCTION: GetCurrentProcessId
-! FUNCTION: GetCurrentThread
-! FUNCTION: GetCurrentThreadId
-! FUNCTION: GetDateFormatA
-! FUNCTION: GetDateFormatW
-! FUNCTION: GetDefaultCommConfigA
-! FUNCTION: GetDefaultCommConfigW
-! FUNCTION: GetDefaultSortkeySize
-! FUNCTION: GetDevicePowerState
-! FUNCTION: GetDiskFreeSpaceA
-! FUNCTION: GetDiskFreeSpaceExA
-! FUNCTION: GetDiskFreeSpaceExW
-! FUNCTION: GetDiskFreeSpaceW
-! FUNCTION: GetDllDirectoryA
-! FUNCTION: GetDllDirectoryW
-! FUNCTION: GetDriveTypeA
-! FUNCTION: GetDriveTypeW
-! FUNCTION: GetEnvironmentStrings
-! FUNCTION: GetEnvironmentStringsA
-! FUNCTION: GetEnvironmentStringsW
-! FUNCTION: GetEnvironmentVariableA
-! FUNCTION: GetEnvironmentVariableW
-! FUNCTION: GetExitCodeProcess
-! FUNCTION: GetExitCodeThread
-! FUNCTION: GetExpandedNameA
-! FUNCTION: GetExpandedNameW
-! FUNCTION: GetFileAttributesA
-! FUNCTION: GetFileAttributesExA
-! FUNCTION: GetFileAttributesExW
-! FUNCTION: GetFileAttributesW
-! FUNCTION: GetFileInformationByHandle
-FUNCTION: DWORD GetFileSize ( HANDLE hFile, LPDWORD lpFileSizeHigh ) ;
-! FUNCTION: GetFileSizeEx
-FUNCTION: BOOL GetFileTime ( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ) ;
-FUNCTION: DWORD GetFileType ( HANDLE hFile ) ;
-! FUNCTION: GetFirmwareEnvironmentVariableA
-! FUNCTION: GetFirmwareEnvironmentVariableW
-! FUNCTION: GetFullPathNameA
-! FUNCTION: GetFullPathNameW
-! FUNCTION: GetGeoInfoA
-! FUNCTION: GetGeoInfoW
-! FUNCTION: GetHandleContext
-! FUNCTION: GetHandleInformation
-! FUNCTION: GetLargestConsoleWindowSize
-FUNCTION: DWORD GetLastError ( ) ;
-! FUNCTION: GetLinguistLangSize
-! FUNCTION: GetLocaleInfoA
-! FUNCTION: GetLocaleInfoW
-! FUNCTION: GetLocalTime
-! FUNCTION: GetLogicalDrives
-! FUNCTION: GetLogicalDriveStringsA
-! FUNCTION: GetLogicalDriveStringsW
-! FUNCTION: GetLongPathNameA
-! FUNCTION: GetLongPathNameW
-! FUNCTION: GetMailslotInfo
-! FUNCTION: GetModuleFileNameA
-! FUNCTION: GetModuleFileNameW
-FUNCTION: HMODULE GetModuleHandleA ( LPCTSTR lpModuleName ) ;
-FUNCTION: HMODULE GetModuleHandleW ( LPCWSTR lpModuleName ) ;
-: GetModuleHandle \ GetModuleHandleW \ GetModuleHandleA unicode-exec ;
-! FUNCTION: GetModuleHandleExA
-! FUNCTION: GetModuleHandleExW
-! FUNCTION: GetNamedPipeHandleStateA
-! FUNCTION: GetNamedPipeHandleStateW
-! FUNCTION: GetNamedPipeInfo
-! FUNCTION: GetNativeSystemInfo
-! FUNCTION: GetNextVDMCommand
-! FUNCTION: GetNlsSectionName
-! FUNCTION: GetNumaAvailableMemory
-! FUNCTION: GetNumaAvailableMemoryNode
-! FUNCTION: GetNumaHighestNodeNumber
-! FUNCTION: GetNumaNodeProcessorMask
-! FUNCTION: GetNumaProcessorMap
-! FUNCTION: GetNumaProcessorNode
-! FUNCTION: GetNumberFormatA
-! FUNCTION: GetNumberFormatW
-! FUNCTION: GetNumberOfConsoleFonts
-! FUNCTION: GetNumberOfConsoleInputEvents
-! FUNCTION: GetNumberOfConsoleMouseButtons
-! FUNCTION: GetOEMCP
-! FUNCTION: GetOverlappedResult
-! FUNCTION: GetPriorityClass
-! FUNCTION: GetPrivateProfileIntA
-! FUNCTION: GetPrivateProfileIntW
-! FUNCTION: GetPrivateProfileSectionA
-! FUNCTION: GetPrivateProfileSectionNamesA
-! FUNCTION: GetPrivateProfileSectionNamesW
-! FUNCTION: GetPrivateProfileSectionW
-! FUNCTION: GetPrivateProfileStringA
-! FUNCTION: GetPrivateProfileStringW
-! FUNCTION: GetPrivateProfileStructA
-! FUNCTION: GetPrivateProfileStructW
-! FUNCTION: GetProcAddress
-! FUNCTION: GetProcessAffinityMask
-! FUNCTION: GetProcessHandleCount
-! FUNCTION: GetProcessHeap
-! FUNCTION: GetProcessHeaps
-! FUNCTION: GetProcessId
-! FUNCTION: GetProcessIoCounters
-! FUNCTION: GetProcessPriorityBoost
-! FUNCTION: GetProcessShutdownParameters
-! FUNCTION: GetProcessTimes
-! FUNCTION: GetProcessVersion
-! FUNCTION: GetProcessWorkingSetSize
-! FUNCTION: GetProfileIntA
-! FUNCTION: GetProfileIntW
-! FUNCTION: GetProfileSectionA
-! FUNCTION: GetProfileSectionW
-! FUNCTION: GetProfileStringA
-! FUNCTION: GetProfileStringW
-FUNCTION: BOOL GetQueuedCompletionStatus ( HANDLE hCompletionPort, LPDWORD lpNumberOfBytes, void* lpCompletionKey, LPOVERLAPPED lpOverlapped, DWORD dwMilliseconds ) ;
-! FUNCTION: GetShortPathNameA
-! FUNCTION: GetShortPathNameW
-! FUNCTION: GetStartupInfoA
-! FUNCTION: GetStartupInfoW
-FUNCTION: HANDLE GetStdHandle ( DWORD nStdHandle ) ;
-! FUNCTION: GetStringTypeA
-! FUNCTION: GetStringTypeExA
-! FUNCTION: GetStringTypeExW
-! FUNCTION: GetStringTypeW
-! FUNCTION: GetSystemDefaultLangID
-! FUNCTION: GetSystemDefaultLCID
-! FUNCTION: GetSystemDefaultUILanguage
-! FUNCTION: GetSystemDirectoryA
-! FUNCTION: GetSystemDirectoryW
-FUNCTION: void GetSystemInfo ( LPSYSTEM_INFO lpSystemInfo ) ;
-! FUNCTION: GetSystemPowerStatus
-! FUNCTION: GetSystemRegistryQuota
-FUNCTION: void GetSystemTime ( LPSYSTEMTIME lpSystemTime ) ;
-! FUNCTION: GetSystemTimeAdjustment
-! FUNCTION: GetSystemTimeAsFileTime
-! FUNCTION: GetSystemTimes
-! FUNCTION: GetSystemWindowsDirectoryA
-! FUNCTION: GetSystemWindowsDirectoryW
-! FUNCTION: GetSystemWow64DirectoryA
-! FUNCTION: GetSystemWow64DirectoryW
-! FUNCTION: GetTapeParameters
-! FUNCTION: GetTapePosition
-! FUNCTION: GetTapeStatus
-! FUNCTION: GetTempFileNameA
-! FUNCTION: GetTempFileNameW
-! FUNCTION: GetTempPathA
-! FUNCTION: GetTempPathW
-! FUNCTION: GetThreadContext
-! FUNCTION: GetThreadIOPendingFlag
-! FUNCTION: GetThreadLocale
-! FUNCTION: GetThreadPriority
-! FUNCTION: GetThreadPriorityBoost
-! FUNCTION: GetThreadSelectorEntry
-! FUNCTION: GetThreadTimes
-! FUNCTION: GetTickCount
-! FUNCTION: GetTimeFormatA
-! FUNCTION: GetTimeFormatW
-FUNCTION: DWORD GetTimeZoneInformation ( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ) ;
-! FUNCTION: GetUserDefaultLangID
-! FUNCTION: GetUserDefaultLCID
-! FUNCTION: GetUserDefaultUILanguage
-! FUNCTION: GetUserGeoID
-! FUNCTION: GetVDMCurrentDirectories
-FUNCTION: DWORD GetVersion ( ) ;
-FUNCTION: BOOL GetVersionExA ( LPOSVERSIONINFO lpVersionInfo ) ;
-FUNCTION: BOOL GetVersionExW ( LPOSVERSIONINFO lpVersionInfo ) ;
-: GetVersionEx GetVersionExA ;
-! FUNCTION: GetVolumeInformationA
-! FUNCTION: GetVolumeInformationW
-! FUNCTION: GetVolumeNameForVolumeMountPointA
-! FUNCTION: GetVolumeNameForVolumeMountPointW
-! FUNCTION: GetVolumePathNameA
-! FUNCTION: GetVolumePathNamesForVolumeNameA
-! FUNCTION: GetVolumePathNamesForVolumeNameW
-! FUNCTION: GetVolumePathNameW
-! FUNCTION: GetWindowsDirectoryA
-! FUNCTION: GetWindowsDirectoryW
-! FUNCTION: GetWriteWatch
-! FUNCTION: GlobalAddAtomA
-! FUNCTION: GlobalAddAtomW
-FUNCTION: HGLOBAL GlobalAlloc ( UINT uFlags, SIZE_T dwBytes ) ;
-! FUNCTION: GlobalCompact
-! FUNCTION: GlobalDeleteAtom
-! FUNCTION: GlobalFindAtomA
-! FUNCTION: GlobalFindAtomW
-! FUNCTION: GlobalFix
-! FUNCTION: GlobalFlags
-! FUNCTION: GlobalFree
-! FUNCTION: GlobalGetAtomNameA
-! FUNCTION: GlobalGetAtomNameW
-! FUNCTION: GlobalHandle
-FUNCTION: LPVOID GlobalLock ( HGLOBAL hMem ) ;
-FUNCTION: void GlobalMemoryStatus ( LPMEMORYSTATUS lpBuffer ) ;
-FUNCTION: BOOL GlobalMemoryStatusEx ( LPMEMORYSTATUSEX lpBuffer ) ;
-! FUNCTION: GlobalReAlloc
-! FUNCTION: GlobalSize
-! FUNCTION: GlobalUnfix
-FUNCTION: BOOL GlobalUnlock ( HGLOBAL hMem ) ;
-! FUNCTION: GlobalUnWire
-! FUNCTION: GlobalWire
-! FUNCTION: Heap32First
-! FUNCTION: Heap32ListFirst
-! FUNCTION: Heap32ListNext
-! FUNCTION: Heap32Next
-! FUNCTION: HeapAlloc
-! FUNCTION: HeapCompact
-! FUNCTION: HeapCreate
-! FUNCTION: HeapCreateTagsW
-! FUNCTION: HeapDestroy
-! FUNCTION: HeapExtend
-! FUNCTION: HeapFree
-! FUNCTION: HeapLock
-! FUNCTION: HeapQueryInformation
-! FUNCTION: HeapQueryTagW
-! FUNCTION: HeapReAlloc
-! FUNCTION: HeapSetInformation
-! FUNCTION: HeapSize
-! FUNCTION: HeapSummary
-! FUNCTION: HeapUnlock
-! FUNCTION: HeapUsage
-! FUNCTION: HeapValidate
-! FUNCTION: HeapWalk
-! FUNCTION: InitAtomTable
-! FUNCTION: InitializeCriticalSection
-! FUNCTION: InitializeCriticalSectionAndSpinCount
-! FUNCTION: InitializeSListHead
-! FUNCTION: InterlockedCompareExchange
-! FUNCTION: InterlockedDecrement
-! FUNCTION: InterlockedExchange
-! FUNCTION: InterlockedExchangeAdd
-! FUNCTION: InterlockedFlushSList
-! FUNCTION: InterlockedIncrement
-! FUNCTION: InterlockedPopEntrySList
-! FUNCTION: InterlockedPushEntrySList
-! FUNCTION: InvalidateConsoleDIBits
-! FUNCTION: IsBadCodePtr
-! FUNCTION: IsBadHugeReadPtr
-! FUNCTION: IsBadHugeWritePtr
-! FUNCTION: IsBadReadPtr
-! FUNCTION: IsBadStringPtrA
-! FUNCTION: IsBadStringPtrW
-! FUNCTION: IsBadWritePtr
-! FUNCTION: IsDBCSLeadByte
-! FUNCTION: IsDBCSLeadByteEx
-! FUNCTION: IsDebuggerPresent
-! FUNCTION: IsProcessInJob
-FUNCTION: BOOL IsProcessorFeaturePresent ( DWORD ProcessorFeature ) ;
-! FUNCTION: IsSystemResumeAutomatic
-! FUNCTION: IsValidCodePage
-! FUNCTION: IsValidLanguageGroup
-! FUNCTION: IsValidLocale
-! FUNCTION: IsValidUILanguage
-! FUNCTION: IsWow64Process
-! FUNCTION: LCMapStringA
-! FUNCTION: LCMapStringW
-! FUNCTION: LeaveCriticalSection
-! FUNCTION: LoadLibraryA
-! FUNCTION: LoadLibraryExA
-! FUNCTION: LoadLibraryExW
-! FUNCTION: LoadLibraryW
-! FUNCTION: LoadModule
-! FUNCTION: LoadResource
-! FUNCTION: LocalAlloc
-! FUNCTION: LocalCompact
-! FUNCTION: LocalFileTimeToFileTime
-! FUNCTION: LocalFlags
-FUNCTION: HLOCAL LocalFree ( HLOCAL hMem ) ;
-! FUNCTION: LocalHandle
-! FUNCTION: LocalLock
-! FUNCTION: LocalReAlloc
-! FUNCTION: LocalShrink
-! FUNCTION: LocalSize
-! FUNCTION: LocalUnlock
-! FUNCTION: LockFile
-! FUNCTION: LockFileEx
-! FUNCTION: LockResource
-! FUNCTION: lstrcat
-! FUNCTION: lstrcatA
-! FUNCTION: lstrcatW
-! FUNCTION: lstrcmp
-! FUNCTION: lstrcmpA
-! FUNCTION: lstrcmpi
-! FUNCTION: lstrcmpiA
-! FUNCTION: lstrcmpiW
-! FUNCTION: lstrcmpW
-! FUNCTION: lstrcpy
-! FUNCTION: lstrcpyA
-! FUNCTION: lstrcpyn
-! FUNCTION: lstrcpynA
-! FUNCTION: lstrcpynW
-! FUNCTION: lstrcpyW
-! FUNCTION: lstrlen
-! FUNCTION: lstrlenA
-! FUNCTION: lstrlenW
-! FUNCTION: LZClose
-! FUNCTION: LZCloseFile
-! FUNCTION: LZCopy
-! FUNCTION: LZCreateFileW
-! FUNCTION: LZDone
-! FUNCTION: LZInit
-! FUNCTION: LZOpenFileA
-! FUNCTION: LZOpenFileW
-! FUNCTION: LZRead
-! FUNCTION: LZSeek
-! FUNCTION: LZStart
-! FUNCTION: MapUserPhysicalPages
-! FUNCTION: MapUserPhysicalPagesScatter
-FUNCTION: LPVOID MapViewOfFile ( HANDLE hFileMappingObject,
-                                 DWORD dwDesiredAccess,
-                                 DWORD dwFileOffsetHigh,
-                                 DWORD dwFileOffsetLow,
-                                 SIZE_T dwNumberOfBytesToMap ) ;
-
-FUNCTION: LPVOID MapViewOfFileEx ( HANDLE hFileMappingObject,
-                                 DWORD dwDesiredAccess,
-                                 DWORD dwFileOffsetHigh,
-                                 DWORD dwFileOffsetLow,
-                                 SIZE_T dwNumberOfBytesToMap,
-                                 LPVOID lpBaseAddress ) ;
-
-! FUNCTION: Module32First
-! FUNCTION: Module32FirstW
-! FUNCTION: Module32Next
-! FUNCTION: Module32NextW
-! FUNCTION: MoveFileA
-! FUNCTION: MoveFileExA
-! FUNCTION: MoveFileExW
-! FUNCTION: MoveFileW
-! FUNCTION: MoveFileWithProgressA
-! FUNCTION: MoveFileWithProgressW
-! FUNCTION: MulDiv
-! FUNCTION: MultiByteToWideChar
-! FUNCTION: NlsConvertIntegerToString
-! FUNCTION: NlsGetCacheUpdateCount
-! FUNCTION: NlsResetProcessLocale
-! FUNCTION: NumaVirtualQueryNode
-! FUNCTION: OpenConsoleW
-! FUNCTION: OpenDataFile
-! FUNCTION: OpenEventA
-! FUNCTION: OpenEventW
-! FUNCTION: OpenFile
-FUNCTION: HANDLE OpenFileMappingA ( DWORD dwDesiredAccess,
-                                    BOOL bInheritHandle,
-                                    LPCTSTR lpName ) ;
-: OpenFileMapping OpenFileMappingA ;
-! FUNCTION: OpenJobObjectA
-! FUNCTION: OpenJobObjectW
-! FUNCTION: OpenMutexA
-! FUNCTION: OpenMutexW
-! FUNCTION: OpenProcess
-! FUNCTION: OpenProfileUserMapping
-! FUNCTION: OpenSemaphoreA
-! FUNCTION: OpenSemaphoreW
-! FUNCTION: OpenThread
-! FUNCTION: OpenWaitableTimerA
-! FUNCTION: OpenWaitableTimerW
-! FUNCTION: OutputDebugStringA
-! FUNCTION: OutputDebugStringW
-! FUNCTION: PeekConsoleInputA
-! FUNCTION: PeekConsoleInputW
-! FUNCTION: PeekNamedPipe
-! FUNCTION: PostQueuedCompletionStatus
-! FUNCTION: PrepareTape
-! FUNCTION: PrivCopyFileExW
-! FUNCTION: PrivMoveFileIdentityW
-! FUNCTION: Process32First
-! FUNCTION: Process32FirstW
-! FUNCTION: Process32Next
-! FUNCTION: Process32NextW
-! FUNCTION: ProcessIdToSessionId
-! FUNCTION: PulseEvent
-! FUNCTION: PurgeComm
-! FUNCTION: QueryActCtxW
-! FUNCTION: QueryDepthSList
-! FUNCTION: QueryDosDeviceA
-! FUNCTION: QueryDosDeviceW
-! FUNCTION: QueryInformationJobObject
-! FUNCTION: QueryMemoryResourceNotification
-! FUNCTION: QueryPerformanceCounter
-! FUNCTION: QueryPerformanceFrequency
-! FUNCTION: QueryWin31IniFilesMappedToRegistry
-! FUNCTION: QueueUserAPC
-! FUNCTION: QueueUserWorkItem
-! FUNCTION: RaiseException
-! FUNCTION: ReadConsoleA
-! FUNCTION: ReadConsoleInputA
-! FUNCTION: ReadConsoleInputExA
-! FUNCTION: ReadConsoleInputExW
-! FUNCTION: ReadConsoleInputW
-! FUNCTION: ReadConsoleOutputA
-! FUNCTION: ReadConsoleOutputAttribute
-! FUNCTION: ReadConsoleOutputCharacterA
-! FUNCTION: ReadConsoleOutputCharacterW
-! FUNCTION: ReadConsoleOutputW
-! FUNCTION: ReadConsoleW
-! FUNCTION: ReadDirectoryChangesW
-FUNCTION: BOOL ReadFile ( HANDLE hFile, int lpBuffer, DWORD nNumberOfBytesToRead, void* lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) ;
-! FUNCTION: BOOL ReadFile ( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) ;
-! FUNCTION: ReadFileEx
-! FUNCTION: ReadFileScatter
-! FUNCTION: ReadProcessMemory
-! FUNCTION: RegisterConsoleIME
-! FUNCTION: RegisterConsoleOS2
-! FUNCTION: RegisterConsoleVDM
-! FUNCTION: RegisterWaitForInputIdle
-! FUNCTION: RegisterWaitForSingleObject
-! FUNCTION: RegisterWaitForSingleObjectEx
-! FUNCTION: RegisterWowBaseHandlers
-! FUNCTION: RegisterWowExec
-! FUNCTION: ReleaseActCtx
-! FUNCTION: ReleaseMutex
-! FUNCTION: ReleaseSemaphore
-! FUNCTION: RemoveDirectoryA
-! FUNCTION: RemoveDirectoryW
-! FUNCTION: RemoveLocalAlternateComputerNameA
-! FUNCTION: RemoveLocalAlternateComputerNameW
-! FUNCTION: RemoveVectoredExceptionHandler
-! FUNCTION: ReplaceFile
-! FUNCTION: ReplaceFileA
-! FUNCTION: ReplaceFileW
-! FUNCTION: RequestDeviceWakeup
-! FUNCTION: RequestWakeupLatency
-! FUNCTION: ResetEvent
-! FUNCTION: ResetWriteWatch
-! FUNCTION: RestoreLastError
-! FUNCTION: ResumeThread
-! FUNCTION: RtlCaptureContext
-! FUNCTION: RtlCaptureStackBackTrace
-! FUNCTION: RtlFillMemory
-! FUNCTION: RtlMoveMemory
-! FUNCTION: RtlUnwind
-! FUNCTION: RtlZeroMemory
-! FUNCTION: ScrollConsoleScreenBufferA
-! FUNCTION: ScrollConsoleScreenBufferW
-! FUNCTION: SearchPathA
-! FUNCTION: SearchPathW
-! FUNCTION: SetCalendarInfoA
-! FUNCTION: SetCalendarInfoW
-! FUNCTION: SetClientTimeZoneInformation
-! FUNCTION: SetCommBreak
-! FUNCTION: SetCommConfig
-! FUNCTION: SetCommMask
-! FUNCTION: SetCommState
-! FUNCTION: SetCommTimeouts
-! FUNCTION: SetComPlusPackageInstallStatus
-! FUNCTION: SetComputerNameA
-! FUNCTION: SetComputerNameExA
-! FUNCTION: SetComputerNameExW
-! FUNCTION: SetComputerNameW
-! FUNCTION: SetConsoleActiveScreenBuffer
-! FUNCTION: SetConsoleCommandHistoryMode
-! FUNCTION: SetConsoleCP
-! FUNCTION: SetConsoleCtrlHandler
-! FUNCTION: SetConsoleCursor
-! FUNCTION: SetConsoleCursorInfo
-! FUNCTION: SetConsoleCursorMode
-! FUNCTION: SetConsoleCursorPosition
-! FUNCTION: SetConsoleDisplayMode
-! FUNCTION: SetConsoleFont
-! FUNCTION: SetConsoleHardwareState
-! FUNCTION: SetConsoleIcon
-! FUNCTION: SetConsoleInputExeNameA
-! FUNCTION: SetConsoleInputExeNameW
-! FUNCTION: SetConsoleKeyShortcuts
-! FUNCTION: SetConsoleLocalEUDC
-! FUNCTION: SetConsoleMaximumWindowSize
-! FUNCTION: SetConsoleMenuClose
-! FUNCTION: SetConsoleMode
-! FUNCTION: SetConsoleNlsMode
-! FUNCTION: SetConsoleNumberOfCommandsA
-! FUNCTION: SetConsoleNumberOfCommandsW
-! FUNCTION: SetConsoleOS2OemFormat
-! FUNCTION: SetConsoleOutputCP
-! FUNCTION: SetConsolePalette
-! FUNCTION: SetConsoleScreenBufferSize
-FUNCTION: BOOL SetConsoleTextAttribute ( HANDLE hConsoleOutput, WORD wAttributes ) ;
-FUNCTION: BOOL SetConsoleTitleA ( LPCTSTR lpConsoleTitle ) ;
-FUNCTION: BOOL SetConsoleTitleW ( LPCWSTR lpConsoleTitle ) ;
-: SetConsoleTitle \ SetConsoleTitleW \ SetConsoleTitleA unicode-exec ;
-! FUNCTION: SetConsoleWindowInfo
-! FUNCTION: SetCPGlobal
-! FUNCTION: SetCriticalSectionSpinCount
-! FUNCTION: SetCurrentDirectoryA
-! FUNCTION: SetCurrentDirectoryW
-! FUNCTION: SetDefaultCommConfigA
-! FUNCTION: SetDefaultCommConfigW
-! FUNCTION: SetDllDirectoryA
-! FUNCTION: SetDllDirectoryW
-! FUNCTION: SetEndOfFile
-! FUNCTION: SetEnvironmentVariableA
-! FUNCTION: SetEnvironmentVariableW
-! FUNCTION: SetErrorMode
-! FUNCTION: SetEvent
-! FUNCTION: SetFileApisToANSI
-! FUNCTION: SetFileApisToOEM
-! FUNCTION: SetFileAttributesA
-! FUNCTION: SetFileAttributesW
-! FUNCTION: SetFilePointer
-! FUNCTION: SetFilePointerEx
-! FUNCTION: SetFileShortNameA
-! FUNCTION: SetFileShortNameW
-FUNCTION: BOOL SetFileTime ( HANDLE hFile, FILETIME* lpCreationTime, FILETIME* lpLastAccessTime, FILETIME* lpLastWriteTime ) ;
-! FUNCTION: SetFileValidData
-! FUNCTION: SetFirmwareEnvironmentVariableA
-! FUNCTION: SetFirmwareEnvironmentVariableW
-! FUNCTION: SetHandleContext
-! FUNCTION: SetHandleCount
-! FUNCTION: SetHandleInformation
-! FUNCTION: SetInformationJobObject
-! FUNCTION: SetLastConsoleEventActive
-! FUNCTION: SetLastError
-! FUNCTION: SetLocaleInfoA
-! FUNCTION: SetLocaleInfoW
-! FUNCTION: SetLocalPrimaryComputerNameA
-! FUNCTION: SetLocalPrimaryComputerNameW
-! FUNCTION: SetLocalTime
-! FUNCTION: SetMailslotInfo
-! FUNCTION: SetMessageWaitingIndicator
-! FUNCTION: SetNamedPipeHandleState
-! FUNCTION: SetPriorityClass
-! FUNCTION: SetProcessAffinityMask
-! FUNCTION: SetProcessPriorityBoost
-! FUNCTION: SetProcessShutdownParameters
-! FUNCTION: SetProcessWorkingSetSize
-! FUNCTION: SetStdHandle
-! FUNCTION: SetSystemPowerState
-! FUNCTION: SetSystemTime
-! FUNCTION: SetSystemTimeAdjustment
-! FUNCTION: SetTapeParameters
-! FUNCTION: SetTapePosition
-! FUNCTION: SetTermsrvAppInstallMode
-! FUNCTION: SetThreadAffinityMask
-! FUNCTION: SetThreadContext
-! FUNCTION: SetThreadExecutionState
-! FUNCTION: SetThreadIdealProcessor
-! FUNCTION: SetThreadLocale
-! FUNCTION: SetThreadPriority
-! FUNCTION: SetThreadPriorityBoost
-! FUNCTION: SetThreadUILanguage
-! FUNCTION: SetTimerQueueTimer
-! FUNCTION: SetTimeZoneInformation
-! FUNCTION: SetUnhandledExceptionFilter
-! FUNCTION: SetupComm
-! FUNCTION: SetUserGeoID
-! FUNCTION: SetVDMCurrentDirectories
-! FUNCTION: SetVolumeLabelA
-! FUNCTION: SetVolumeLabelW
-! FUNCTION: SetVolumeMountPointA
-! FUNCTION: SetVolumeMountPointW
-! FUNCTION: SetWaitableTimer
-! FUNCTION: ShowConsoleCursor
-! FUNCTION: SignalObjectAndWait
-! FUNCTION: SizeofResource
-! FUNCTION: Sleep
-FUNCTION: DWORD SleepEx ( DWORD dwMilliSeconds, BOOL bAlertable ) ;
-! FUNCTION: SuspendThread
-! FUNCTION: SwitchToFiber
-! FUNCTION: SwitchToThread
-FUNCTION: BOOL SystemTimeToFileTime ( SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime ) ;
-! FUNCTION: SystemTimeToTzSpecificLocalTime
-! FUNCTION: TerminateJobObject
-! FUNCTION: TerminateProcess
-! FUNCTION: TerminateThread
-! FUNCTION: TermsrvAppInstallMode
-! FUNCTION: Thread32First
-! FUNCTION: Thread32Next
-! FUNCTION: TlsAlloc
-! FUNCTION: TlsFree
-! FUNCTION: TlsGetValue
-! FUNCTION: TlsSetValue
-! FUNCTION: Toolhelp32ReadProcessMemory
-! FUNCTION: TransactNamedPipe
-! FUNCTION: TransmitCommChar
-! FUNCTION: TrimVirtualBuffer
-! FUNCTION: TryEnterCriticalSection
-! FUNCTION: TzSpecificLocalTimeToSystemTime
-! FUNCTION: UnhandledExceptionFilter
-! FUNCTION: UnlockFile
-! FUNCTION: UnlockFileEx
-! FUNCTION: UnmapViewOfFile
-! FUNCTION: UnregisterConsoleIME
-! FUNCTION: UnregisterWait
-! FUNCTION: UnregisterWaitEx
-! FUNCTION: UpdateResourceA
-! FUNCTION: UpdateResourceW
-! FUNCTION: UTRegister
-! FUNCTION: UTUnRegister
-! FUNCTION: ValidateLCType
-! FUNCTION: ValidateLocale
-! FUNCTION: VDMConsoleOperation
-! FUNCTION: VDMOperationStarted
-! FUNCTION: VerifyConsoleIoHandle
-! FUNCTION: VerifyVersionInfoA
-! FUNCTION: VerifyVersionInfoW
-! FUNCTION: VerLanguageNameA
-! FUNCTION: VerLanguageNameW
-! FUNCTION: VerSetConditionMask
-! FUNCTION: VirtualAlloc
-! FUNCTION: VirtualAllocEx
-! FUNCTION: VirtualBufferExceptionHandler
-! FUNCTION: VirtualFree
-! FUNCTION: VirtualFreeEx
-! FUNCTION: VirtualLock
-! FUNCTION: VirtualProtect
-! FUNCTION: VirtualProtectEx
-! FUNCTION: VirtualQuery
-! FUNCTION: VirtualQueryEx
-! FUNCTION: VirtualUnlock
-! FUNCTION: WaitCommEvent
-! FUNCTION: WaitForDebugEvent
-! FUNCTION: WaitForMultipleObjects
-! FUNCTION: WaitForMultipleObjectsEx
-! FUNCTION: WaitForSingleObject
-! FUNCTION: WaitForSingleObjectEx
-! FUNCTION: WaitNamedPipeA
-! FUNCTION: WaitNamedPipeW
-! FUNCTION: WideCharToMultiByte
-! FUNCTION: WinExec
-! FUNCTION: WriteConsoleA
-! FUNCTION: WriteConsoleInputA
-! FUNCTION: WriteConsoleInputVDMA
-! FUNCTION: WriteConsoleInputVDMW
-! FUNCTION: WriteConsoleInputW
-! FUNCTION: WriteConsoleOutputA
-! FUNCTION: WriteConsoleOutputAttribute
-! FUNCTION: WriteConsoleOutputCharacterA
-! FUNCTION: WriteConsoleOutputCharacterW
-! FUNCTION: WriteConsoleOutputW
-! FUNCTION: WriteConsoleW
-FUNCTION: BOOL WriteFile ( HANDLE hFile, int lpBuffer, DWORD nNumberOfBytesToWrite, void* lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ) ;
-! FUNCTION: WriteFileEx
-! FUNCTION: WriteFileGather
-! FUNCTION: WritePrivateProfileSectionA
-! FUNCTION: WritePrivateProfileSectionW
-! FUNCTION: WritePrivateProfileStringA
-! FUNCTION: WritePrivateProfileStringW
-! FUNCTION: WritePrivateProfileStructA
-! FUNCTION: WritePrivateProfileStructW
-! FUNCTION: WriteProcessMemory
-! FUNCTION: WriteProfileSectionA
-! FUNCTION: WriteProfileSectionW
-! FUNCTION: WriteProfileStringA
-! FUNCTION: WriteProfileStringW
-! FUNCTION: WriteTapemark
-! FUNCTION: WTSGetActiveConsoleSessionId
-! FUNCTION: ZombifyActCtx
diff --git a/core/windows/load.factor b/core/windows/load.factor
deleted file mode 100644 (file)
index 636ebda..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-USING: kernel namespaces ;
-PROVIDE: core/windows
-{ +files+ { 
-    "windows-messages.factor"
-    "types.factor"
-    "gdi32-constants.factor"
-    "gdi32.factor"
-    "kernel32-constants.factor"
-    "kernel32-structs.factor"
-    "kernel32-types.factor"
-    "kernel32.factor"
-    "user32-constants.factor"
-    "user32-structs.factor"
-    "user32-types.factor"
-    "user32.factor"
-    "winsock.factor"
-    "opengl32.factor"
-    "utils.factor"
-    { "io.factor" [ "native-io" get not ] }
-} } ;
-
-IN: command-line
-: default-shell "tty" ;
diff --git a/core/windows/opengl32.factor b/core/windows/opengl32.factor
deleted file mode 100644 (file)
index a200581..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien parser namespaces kernel syntax words math io prettyprint ;
-IN: win32-api
-
-! PIXELFORMATDESCRIPTOR flags
-: PFD_DOUBLEBUFFER            HEX: 00000001 ; inline
-: PFD_STEREO                  HEX: 00000002 ; inline
-: PFD_DRAW_TO_WINDOW          HEX: 00000004 ; inline
-: PFD_DRAW_TO_BITMAP          HEX: 00000008 ; inline
-: PFD_SUPPORT_GDI             HEX: 00000010 ; inline
-: PFD_SUPPORT_OPENGL          HEX: 00000020 ; inline
-: PFD_GENERIC_FORMAT          HEX: 00000040 ; inline
-: PFD_NEED_PALETTE            HEX: 00000080 ; inline
-: PFD_NEED_SYSTEM_PALETTE     HEX: 00000100 ; inline
-: PFD_SWAP_EXCHANGE           HEX: 00000200 ; inline
-: PFD_SWAP_COPY               HEX: 00000400 ; inline
-: PFD_SWAP_LAYER_BUFFERS      HEX: 00000800 ; inline
-: PFD_GENERIC_ACCELERATED     HEX: 00001000 ; inline
-: PFD_SUPPORT_DIRECTDRAW      HEX: 00002000 ; inline
-
-! PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only
-: PFD_DEPTH_DONTCARE          HEX: 20000000 ; inline
-: PFD_DOUBLEBUFFER_DONTCARE   HEX: 40000000 ; inline
-: PFD_STEREO_DONTCARE         HEX: 80000000 ; inline
-
-! pixel types
-: PFD_TYPE_RGBA        0 ; inline
-: PFD_TYPE_COLORINDEX  1 ; inline
-! layer types
-: PFD_MAIN_PLANE       0 ; inline
-: PFD_OVERLAY_PLANE    1 ; inline
-: PFD_UNDERLAY_PLANE   -1 ; inline
-
-: LPD_TYPE_RGBA        0 ; inline
-: LPD_TYPE_COLORINDEX  1 ; inline
-
-! wglSwapLayerBuffers flags
-: WGL_SWAP_MAIN_PLANE     HEX: 00000001 ; inline
-: WGL_SWAP_OVERLAY1       HEX: 00000002 ; inline
-: WGL_SWAP_OVERLAY2       HEX: 00000004 ; inline
-: WGL_SWAP_OVERLAY3       HEX: 00000008 ; inline
-: WGL_SWAP_OVERLAY4       HEX: 00000010 ; inline
-: WGL_SWAP_OVERLAY5       HEX: 00000020 ; inline
-: WGL_SWAP_OVERLAY6       HEX: 00000040 ; inline
-: WGL_SWAP_OVERLAY7       HEX: 00000080 ; inline
-: WGL_SWAP_OVERLAY8       HEX: 00000100 ; inline
-: WGL_SWAP_OVERLAY9       HEX: 00000200 ; inline
-: WGL_SWAP_OVERLAY10      HEX: 00000400 ; inline
-: WGL_SWAP_OVERLAY11      HEX: 00000800 ; inline
-: WGL_SWAP_OVERLAY12      HEX: 00001000 ; inline
-: WGL_SWAP_OVERLAY13      HEX: 00002000 ; inline
-: WGL_SWAP_OVERLAY14      HEX: 00004000 ; inline
-: WGL_SWAP_OVERLAY15      HEX: 00008000 ; inline
-: WGL_SWAP_UNDERLAY1      HEX: 00010000 ; inline
-: WGL_SWAP_UNDERLAY2      HEX: 00020000 ; inline
-: WGL_SWAP_UNDERLAY3      HEX: 00040000 ; inline
-: WGL_SWAP_UNDERLAY4      HEX: 00080000 ; inline
-: WGL_SWAP_UNDERLAY5      HEX: 00100000 ; inline
-: WGL_SWAP_UNDERLAY6      HEX: 00200000 ; inline
-: WGL_SWAP_UNDERLAY7      HEX: 00400000 ; inline
-: WGL_SWAP_UNDERLAY8      HEX: 00800000 ; inline
-: WGL_SWAP_UNDERLAY9      HEX: 01000000 ; inline
-: WGL_SWAP_UNDERLAY10     HEX: 02000000 ; inline
-: WGL_SWAP_UNDERLAY11     HEX: 04000000 ; inline
-: WGL_SWAP_UNDERLAY12     HEX: 08000000 ; inline
-: WGL_SWAP_UNDERLAY13     HEX: 10000000 ; inline
-: WGL_SWAP_UNDERLAY14     HEX: 20000000 ; inline
-: WGL_SWAP_UNDERLAY15     HEX: 40000000 ; inline
-
-
-
-: pfd-dwFlags
-    PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL bitor PFD_DOUBLEBUFFER bitor ;
-
-! TODO: compare to http://www.nullterminator.net/opengl32.html
-: make-pfd ( bits -- pfd )
-    "PIXELFORMATDESCRIPTOR" <c-object>
-    "PIXELFORMATDESCRIPTOR" c-size over set-PIXELFORMATDESCRIPTOR-nSize
-    1 over set-PIXELFORMATDESCRIPTOR-nVersion
-    pfd-dwFlags over set-PIXELFORMATDESCRIPTOR-dwFlags
-    PFD_TYPE_RGBA over set-PIXELFORMATDESCRIPTOR-iPixelType
-    [ set-PIXELFORMATDESCRIPTOR-cColorBits ] keep
-    16 over set-PIXELFORMATDESCRIPTOR-cDepthBits
-    PFD_MAIN_PLANE over set-PIXELFORMATDESCRIPTOR-dwLayerMask ;
-
-
-LIBRARY: gl
-
-
-! FUNCTION: int ReleaseDC ( HWND hWnd, HDC hDC ) ;
-! FUNCTION: HDC ResetDC ( HDC hdc, DEVMODE* lpInitData ) ;
-! FUNCTION: BOOL RestoreDC ( HDC hdc, int nSavedDC ) ;
-! FUNCTION: int SaveDC( HDC hDC ) ;
-! FUNCTION: HGDIOBJ SelectObject ( HDC hDC, HGDIOBJ hgdiobj ) ;
-
-FUNCTION: HGLRC wglCreateContext ( HDC hDC ) ;
-FUNCTION: BOOL wglDeleteContext ( HGLRC hRC ) ;
-FUNCTION: BOOL wglMakeCurrent ( HDC hDC, HGLRC hglrc ) ;
-
-
diff --git a/core/windows/types.factor b/core/windows/types.factor
deleted file mode 100644 (file)
index 8afca24..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien namespaces kernel words ;
-IN: win32-api
-
-! http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp
-
-SYMBOL: unicode f unicode set
-: unicode-exec ( unicode-func ascii-func -- func )
-       unicode get [
-               drop execute
-       ] [
-               nip execute
-       ] if ; inline
-
-: unicode? unicode get ; inline
-
-: win64? f ;
-
-! win64
-! char uchar short ushort int uint long ulong longlong ulonglong
-! 1    1     2     2      *   *    ?
-! win32
-! char uchar short ushort int uint long ulong longlong ulonglong
-! 1    1     2     2      *   *    4    4     8        8
-
-
-TYPEDEF: char                CHAR
-TYPEDEF: uchar               UCHAR
-TYPEDEF: uchar               BYTE
-
-TYPEDEF: short               wchar_t
-TYPEDEF: wchar_t             WCHAR
-
-TYPEDEF: short               SHORT
-TYPEDEF: ushort              USHORT
-
-TYPEDEF: ushort              WORD
-TYPEDEF: ulong               DWORD
-
-TYPEDEF: int                 INT
-TYPEDEF: uint                UINT
-
-TYPEDEF: int                 BOOL
-
-TYPEDEF: int*                PINT
-TYPEDEF: int*                LPINT
-TYPEDEF: int                 HFILE
-
-TYPEDEF: long                LONG
-TYPEDEF: long*               LPLONG
-TYPEDEF: long                LONG_PTR
-TYPEDEF: long*               PLONG_PTR
-
-TYPEDEF: int                 ULONG
-TYPEDEF: void*               ULONG_PTR
-TYPEDEF: void*               PULONG_PTR
-
-TYPEDEF: void                VOID
-TYPEDEF: void*               PVOID
-TYPEDEF: void*               LPVOID
-TYPEDEF: void*               LPCVOID
-
-TYPEDEF: float               FLOAT
-TYPEDEF: short       HALF_PTR
-TYPEDEF: ushort      UHALF_PTR
-TYPEDEF: int         INT_PTR
-TYPEDEF: uint        UINT_PTR
-
-TYPEDEF: int         LONG_PTR
-TYPEDEF: ulong       ULONG_PTR
-
-TYPEDEF: int         INT32
-TYPEDEF: uint        UINT32
-TYPEDEF: uint        DWORD32
-TYPEDEF: ulong       ULONG32
-TYPEDEF: ulonglong   ULONG64
-TYPEDEF: long*       POINTER_32
-TYPEDEF: longlong*   POINTER_64
-TYPEDEF: longlong    INT64
-TYPEDEF: ulonglong   UINT64
-TYPEDEF: longlong    LONGLONG
-TYPEDEF: ulonglong   ULONGLONG
-TYPEDEF: longlong    LONG64
-TYPEDEF: ulonglong   DWORD64
-
-TYPEDEF: uchar       TBYTE
-TYPEDEF: char        TCHAR
-
-
-TYPEDEF: WORD                ATOM
-TYPEDEF: BYTE                BOOLEAN
-TYPEDEF: DWORD               COLORREF
-TYPEDEF: ULONGLONG           DWORDLONG
-TYPEDEF: ULONG_PTR           DWORD_PTR
-TYPEDEF: PVOID               HANDLE
-TYPEDEF: HANDLE              HACCEL
-TYPEDEF: HANDLE              HBITMAP
-TYPEDEF: HANDLE              HBRUSH
-TYPEDEF: HANDLE              HCOLORSPACE
-TYPEDEF: HANDLE              HCONV
-TYPEDEF: HANDLE              HCONVLIST
-TYPEDEF: HANDLE              HICON
-TYPEDEF: HICON               HCURSOR
-TYPEDEF: HANDLE              HDC
-TYPEDEF: HANDLE              HDDEDATA
-TYPEDEF: HANDLE              HDESK
-TYPEDEF: HANDLE              HDROP
-TYPEDEF: HANDLE              HDWP
-TYPEDEF: HANDLE              HENMETAFILE
-TYPEDEF: HANDLE              HFONT
-TYPEDEF: HANDLE              HGDIOBJ
-TYPEDEF: HANDLE              HGLOBAL
-TYPEDEF: HANDLE              HHOOK
-TYPEDEF: HANDLE              HINSTANCE
-TYPEDEF: HANDLE              HKEY
-TYPEDEF: HANDLE              HKL
-TYPEDEF: HANDLE              HLOCAL
-TYPEDEF: HANDLE              HMENU
-TYPEDEF: HANDLE              HMETAFILE
-TYPEDEF: HINSTANCE           HMODULE
-TYPEDEF: HANDLE              HMONITOR
-TYPEDEF: HANDLE              HPALETTE
-TYPEDEF: HANDLE              HPEN
-TYPEDEF: LONG                HRESULT
-TYPEDEF: HANDLE              HRGN
-TYPEDEF: HANDLE              HRSRC
-TYPEDEF: HANDLE              HSZ
-TYPEDEF: HANDLE              WINSTA   ! MS docs say  typedef HANDLE WINSTA ;
-TYPEDEF: HANDLE              HWINSTA  ! typo??
-TYPEDEF: HANDLE              HWND
-TYPEDEF: WORD                LANGID
-TYPEDEF: DWORD               LCID
-TYPEDEF: DWORD               LCTYPE
-TYPEDEF: DWORD               LGRPID
-TYPEDEF: LONG_PTR            LPARAM
-TYPEDEF: BOOL*               LPBOOL
-TYPEDEF: BYTE*               LPBYTE
-TYPEDEF: DWORD*              LPCOLORREF
-TYPEDEF: WCHAR*              LPCWSTR
-TYPEDEF: WCHAR*              LPWSTR
-
-! TYPEDEF: LPCWSTR     LPCTSTR
-! TYPEDEF: LPWSTR      LPTSTR
-! TYPEDEF: LPCWSTR     PCTSTR
-! TYPEDEF: LPWSTR      PTSTR
-
-TYPEDEF: WCHAR*              LPWSTR
-TYPEDEF: CHAR*               LPSTR
-! TYPEDEF: CHAR*               LPCSTR
-TYPEDEF: VOID*               LPCSTR
-
-TYPEDEF: LPCSTR      LPCTSTR
-TYPEDEF: LPSTR       LPTSTR
-TYPEDEF: LPCSTR      PCTSTR
-TYPEDEF: LPSTR       PTSTR
-
-TYPEDEF: DWORD*              LPDWORD
-TYPEDEF: HANDLE*             LPHANDLE
-TYPEDEF: WORD*               LPWORD
-TYPEDEF: LONG_PTR            LRESULT
-TYPEDEF: BOOL*               PBOOL
-TYPEDEF: BOOLEAN*            PBOOLEAN
-TYPEDEF: BYTE*               PBYTE
-TYPEDEF: CHAR*               PCHAR
-TYPEDEF: CHAR*               PCSTR
-TYPEDEF: WCHAR*              PCWSTR
-TYPEDEF: DWORD*              PDWORD
-TYPEDEF: DWORDLONG*          PDWORDLONG
-TYPEDEF: DWORD_PTR*          PDWORD_PTR
-TYPEDEF: DWORD32*            PDWORD32
-TYPEDEF: DWORD64*            PDWORD64
-TYPEDEF: FLOAT*              PFLOAT
-TYPEDEF: HALF_PTR*           PHALF_PTR
-TYPEDEF: HANDLE*             PHANDLE
-TYPEDEF: HKEY*               PHKEY
-TYPEDEF: INT_PTR*            PINT_PTR
-TYPEDEF: INT32*              PINT32
-TYPEDEF: INT64*              PINT64
-TYPEDEF: PDWORD              PLCID
-TYPEDEF: LONG*               PLONG
-TYPEDEF: LONGLONG*           PLONGLONG
-TYPEDEF: LONG_PTR*           PLONG_PTR
-TYPEDEF: LONG32*             PLONG32
-TYPEDEF: LONG64*             PLONG64
-TYPEDEF: SHORT*              PSHORT
-TYPEDEF: SIZE_T*             PSIZE_T
-TYPEDEF: SSIZE_T*            PSSIZE_T
-TYPEDEF: CHAR*               PSTR
-TYPEDEF: TBYTE*              PTBYTE
-TYPEDEF: TCHAR*              PTCHAR
-TYPEDEF: UCHAR*              PUCHAR
-TYPEDEF: UHALF_PTR*          PUHALF_PTR
-TYPEDEF: UINT*               PUINT
-TYPEDEF: UINT_PTR*           PUINT_PTR
-TYPEDEF: UINT32*             PUINT32
-TYPEDEF: UINT64*             PUINT64
-TYPEDEF: ULONG*              PULONG
-TYPEDEF: ULONGLONG*          PULONGLONG
-TYPEDEF: ULONG_PTR*          PULONG_PTR
-TYPEDEF: ULONG32*            PULONG32
-TYPEDEF: ULONG64*            PULONG64
-TYPEDEF: USHORT*             PUSHORT
-TYPEDEF: WCHAR*              PWCHAR
-TYPEDEF: WORD*               PWORD
-TYPEDEF: WCHAR*              PWSTR
-TYPEDEF: HANDLE              SC_HANDLE
-TYPEDEF: LPVOID              SC_LOCK
-TYPEDEF: HANDLE              SERVICE_STATUS_HANDLE
-TYPEDEF: ULONG_PTR           SIZE_T
-TYPEDEF: LONG_PTR            SSIZE_T
-TYPEDEF: LONGLONG            USN
-TYPEDEF: UINT_PTR            WPARAM
-
-TYPEDEF: RECT* LPRECT
-TYPEDEF: void* PWNDCLASS
-TYPEDEF: void* PWNDCLASSEX
-TYPEDEF: void* LPWNDCLASS
-TYPEDEF: void* LPWNDCLASSEX
-
-TYPEDEF: void* WNDPROC
-
-! typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
-
-BEGIN-STRUCT: WNDCLASS
-    FIELD: UINT style
-    FIELD: WNDPROC lpfnWndProc
-    FIELD: int cbClsExtra
-    FIELD: int cbWndExtra
-    FIELD: HINSTANCE hInstance
-    FIELD: HICON hIcon
-    FIELD: HCURSOR hCursor
-    FIELD: HBRUSH hbrBackground
-    FIELD: LPCTSTR lpszMenuName
-    FIELD: LPCTSTR lpszClassName
-END-STRUCT
-
-BEGIN-STRUCT: WNDCLASSEX
-    FIELD: UINT cbSize
-    FIELD: UINT style
-    FIELD: WNDPROC lpfnWndProc
-    FIELD: int cbClsExtra
-    FIELD: int cbWndExtra
-    FIELD: HINSTANCE hInstance
-    FIELD: HICON hIcon
-    FIELD: HCURSOR hCursor
-    FIELD: HBRUSH hbrBackground
-    FIELD: LPCTSTR lpszMenuName
-    FIELD: LPCTSTR lpszClassName
-    FIELD: HICON hIconSm
-END-STRUCT
-
-BEGIN-STRUCT: RECT
-    FIELD: LONG left
-    FIELD: LONG top
-    FIELD: LONG right
-    FIELD: LONG bottom
-END-STRUCT
-
-! BEGIN-STRUCT: PAINTSTRUCT
-    ! FIELD: HDC  hdc
-    ! FIELD: BOOL fErase
-    ! FIELD: RECT rcPaint
-    ! FIELD: BOOL fRestore
-    ! FIELD: BOOL fIncUpdate
-    ! FIELD: BYTE[32] rgbReserved
-! END-STRUCT
-
-TYPEDEF: void* LPPAINTSTRUCT
-TYPEDEF: void* PAINTSTRUCT
-
-BEGIN-STRUCT: POINT
-    FIELD: LONG x
-    FIELD: LONG y
-END-STRUCT 
-
-BEGIN-STRUCT: MSG
-    FIELD: HWND        hWnd
-    FIELD: UINT        message
-    FIELD: WPARAM      wParam
-    FIELD: LPARAM      lParam
-    FIELD: DWORD       time
-    FIELD: POINT       pt
-END-STRUCT
-TYPEDEF: MSG*                LPMSG
-
-BEGIN-STRUCT: PIXELFORMATDESCRIPTOR
-  FIELD: WORD  nSize
-  FIELD: WORD  nVersion
-  FIELD: DWORD dwFlags 
-  FIELD: BYTE  iPixelType
-  FIELD: BYTE  cColorBits
-  FIELD: BYTE  cRedBits
-  FIELD: BYTE  cRedShift
-  FIELD: BYTE  cGreenBits
-  FIELD: BYTE  cGreenShift
-  FIELD: BYTE  cBlueBits
-  FIELD: BYTE  cBlueShift
-  FIELD: BYTE  cAlphaBits
-  FIELD: BYTE  cAlphaShift
-  FIELD: BYTE  cAccumBits
-  FIELD: BYTE  cAccumRedBits
-  FIELD: BYTE  cAccumGreenBits
-  FIELD: BYTE  cAccumBlueBits
-  FIELD: BYTE  cAccumAlphaBits
-  FIELD: BYTE  cDepthBits
-  FIELD: BYTE  cStencilBits
-  FIELD: BYTE  cAuxBuffers
-  FIELD: BYTE  iLayerType
-  FIELD: BYTE  bReserved
-  FIELD: DWORD dwLayerMask
-  FIELD: DWORD dwVisibleMask
-  FIELD: DWORD dwDamageMask
-END-STRUCT
-
-BEGIN-STRUCT: RECT
-    FIELD: LONG left
-    FIELD: LONG top
-    FIELD: LONG right
-    FIELD: LONG bottom
-END-STRUCT
-
-TYPEDEF: RECT* PRECT
-TYPEDEF: RECT* LPRECT
-TYPEDEF: PIXELFORMATDESCRIPTOR PFD
-TYPEDEF: PFD* LPPFD
-TYPEDEF: HANDLE HGLRC
-TYPEDEF: HANDLE HRGN
diff --git a/core/windows/user32-constants.factor b/core/windows/user32-constants.factor
deleted file mode 100644 (file)
index b177dc7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-IN: win32-api
diff --git a/core/windows/user32-structs.factor b/core/windows/user32-structs.factor
deleted file mode 100644 (file)
index 16e6268..0000000
+++ /dev/null
@@ -1,502 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien parser namespaces kernel syntax words math io prettyprint ;
-IN: win32-api
-
-! HKL for ActivateKeyboardLayout
-: HKL_PREV 0 ;
-: HKL_NEXT 1 ;
-
-: CW_USEDEFAULT HEX: 80000000 ;
-
-: WS_OVERLAPPED       HEX: 00000000 ;
-: WS_POPUP            HEX: 80000000 ;
-: WS_CHILD            HEX: 40000000 ;
-: WS_MINIMIZE         HEX: 20000000 ;
-: WS_VISIBLE          HEX: 10000000 ;
-: WS_DISABLED         HEX: 08000000 ;
-: WS_CLIPSIBLINGS     HEX: 04000000 ;
-: WS_CLIPCHILDREN     HEX: 02000000 ;
-: WS_MAXIMIZE         HEX: 01000000 ;
-: WS_CAPTION          HEX: 00C00000 ; !    /* WS_BORDER | WS_DLGFRAME  */
-: WS_BORDER           HEX: 00800000 ;
-: WS_DLGFRAME         HEX: 00400000 ;
-: WS_VSCROLL          HEX: 00200000 ;
-: WS_HSCROLL          HEX: 00100000 ;
-: WS_SYSMENU          HEX: 00080000 ;
-: WS_THICKFRAME       HEX: 00040000 ;
-: WS_GROUP            HEX: 00020000 ;
-: WS_TABSTOP          HEX: 00010000 ;
-: WS_MINIMIZEBOX      HEX: 00020000 ;
-: WS_MAXIMIZEBOX      HEX: 00010000 ;
-
-! Common window styles
-: WS_OVERLAPPEDWINDOW WS_OVERLAPPED WS_CAPTION WS_SYSMENU WS_THICKFRAME WS_MINIMIZEBOX WS_MAXIMIZEBOX bitor bitor bitor bitor bitor ;
-
-: WS_POPUPWINDOW      WS_POPUP WS_BORDER WS_SYSMENU bitor bitor ;
-
-: WS_CHILDWINDOW      WS_CHILD ;
-
-: WS_TILED            WS_OVERLAPPED ;
-: WS_ICONIC           WS_MINIMIZE ;
-: WS_SIZEBOX          WS_THICKFRAME ;
-: WS_TILEDWINDOW      WS_OVERLAPPEDWINDOW ;
-
-
-
-! Extended window styles
-
-: WS_EX_DLGMODALFRAME     HEX: 00000001 ; inline
-: WS_EX_NOPARENTNOTIFY    HEX: 00000004 ; inline
-: WS_EX_TOPMOST           HEX: 00000008 ; inline
-: WS_EX_ACCEPTFILES       HEX: 00000010 ; inline
-: WS_EX_TRANSPARENT       HEX: 00000020 ; inline
-: WS_EX_MDICHILD          HEX: 00000040 ; inline
-: WS_EX_TOOLWINDOW        HEX: 00000080 ; inline
-: WS_EX_WINDOWEDGE        HEX: 00000100 ; inline
-: WS_EX_CLIENTEDGE        HEX: 00000200 ; inline
-: WS_EX_CONTEXTHELP       HEX: 00000400 ; inline
-
-: WS_EX_RIGHT             HEX: 00001000 ; inline
-: WS_EX_LEFT              HEX: 00000000 ; inline
-: WS_EX_RTLREADING        HEX: 00002000 ; inline
-: WS_EX_LTRREADING        HEX: 00000000 ; inline
-: WS_EX_LEFTSCROLLBAR     HEX: 00004000 ; inline
-: WS_EX_RIGHTSCROLLBAR    HEX: 00000000 ; inline
-: WS_EX_CONTROLPARENT     HEX: 00010000 ; inline
-: WS_EX_STATICEDGE        HEX: 00020000 ; inline
-: WS_EX_APPWINDOW         HEX: 00040000 ; inline
-: WS_EX_OVERLAPPEDWINDOW WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE bitor ; inline
-: WS_EX_PALETTEWINDOW
-    WS_EX_WINDOWEDGE WS_EX_TOOLWINDOW bitor WS_EX_TOPMOST bitor ; inline
-
-
-: CS_VREDRAW          HEX: 0001 ;
-: CS_HREDRAW          HEX: 0002 ;
-: CS_DBLCLKS          HEX: 0008 ;
-: CS_OWNDC            HEX: 0020 ;
-: CS_CLASSDC          HEX: 0040 ;
-: CS_PARENTDC         HEX: 0080 ;
-: CS_NOCLOSE          HEX: 0200 ;
-: CS_SAVEBITS         HEX: 0800 ;
-: CS_BYTEALIGNCLIENT  HEX: 1000 ;
-: CS_BYTEALIGNWINDOW  HEX: 2000 ;
-: CS_GLOBALCLASS      HEX: 4000 ;
-
-: COLOR_SCROLLBAR         0 ;
-: COLOR_BACKGROUND        1 ;
-: COLOR_ACTIVECAPTION     2 ;
-: COLOR_INACTIVECAPTION   3 ;
-: COLOR_MENU              4 ;
-: COLOR_WINDOW            5 ;
-: COLOR_WINDOWFRAME       6 ;
-: COLOR_MENUTEXT          7 ;
-: COLOR_WINDOWTEXT        8 ;
-: COLOR_CAPTIONTEXT       9 ;
-: COLOR_ACTIVEBORDER      10 ;
-: COLOR_INACTIVEBORDER    11 ;
-: COLOR_APPWORKSPACE      12 ;
-: COLOR_HIGHLIGHT         13 ;
-: COLOR_HIGHLIGHTTEXT     14 ;
-: COLOR_BTNFACE           15 ;
-: COLOR_BTNSHADOW         16 ;
-: COLOR_GRAYTEXT          17 ;
-: COLOR_BTNTEXT           18 ;
-: COLOR_INACTIVECAPTIONTEXT 19 ;
-: COLOR_BTNHIGHLIGHT      20 ;
-
-: IDI_APPLICATION     32512 ;
-: IDI_HAND            32513 ;
-: IDI_QUESTION        32514 ;
-: IDI_EXCLAMATION     32515 ;
-: IDI_ASTERISK        32516 ;
-: IDI_WINLOGO         32517 ;
-
-! ShowWindow() Commands
-: SW_HIDE             0 ;
-: SW_SHOWNORMAL       1 ;
-: SW_NORMAL           1 ;
-: SW_SHOWMINIMIZED    2 ;
-: SW_SHOWMAXIMIZED    3 ;
-: SW_MAXIMIZE         3 ;
-: SW_SHOWNOACTIVATE   4 ;
-: SW_SHOW             5 ;
-: SW_MINIMIZE         6 ;
-: SW_SHOWMINNOACTIVE  7 ;
-: SW_SHOWNA           8 ;
-: SW_RESTORE          9 ;
-: SW_SHOWDEFAULT      10 ;
-: SW_FORCEMINIMIZE    11 ;
-: SW_MAX              11 ;
-
-! PeekMessage
-: PM_NOREMOVE   0 ;
-: PM_REMOVE     1 ;
-: PM_NOYIELD    2 ;
-! : PM_QS_INPUT         (QS_INPUT << 16) ;
-! : PM_QS_POSTMESSAGE   ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16) ;
-! : PM_QS_PAINT         (QS_PAINT << 16) ;
-! : PM_QS_SENDMESSAGE   (QS_SENDMESSAGE << 16) ;
-
-
-! 
-! Standard Cursor IDs
-!
-: IDC_ARROW           32512 ;
-: IDC_IBEAM           32513 ;
-: IDC_WAIT            32514 ;
-: IDC_CROSS           32515 ;
-: IDC_UPARROW         32516 ;
-: IDC_SIZE            32640 ; ! OBSOLETE: use IDC_SIZEALL
-: IDC_ICON            32641 ; ! OBSOLETE: use IDC_ARROW
-: IDC_SIZENWSE        32642 ;
-: IDC_SIZENESW        32643 ;
-: IDC_SIZEWE          32644 ;
-: IDC_SIZENS          32645 ;
-: IDC_SIZEALL         32646 ;
-: IDC_NO              32648 ; ! not in win3.1
-: IDC_HAND            32649 ;
-: IDC_APPSTARTING     32650 ; ! not in win3.1
-: IDC_HELP            32651 ;
-
-
-
-
-
-! Predefined Clipboard Formats
-: CF_TEXT             1 ; inline
-: CF_BITMAP           2 ; inline
-: CF_METAFILEPICT     3 ; inline
-: CF_SYLK             4 ; inline
-: CF_DIF              5 ; inline
-: CF_TIFF             6 ; inline
-: CF_OEMTEXT          7 ; inline
-: CF_DIB              8 ; inline
-: CF_PALETTE          9 ; inline
-: CF_PENDATA          10 ; inline
-: CF_RIFF             11 ; inline
-: CF_WAVE             12 ; inline
-: CF_UNICODETEXT      13 ; inline
-: CF_ENHMETAFILE      14 ; inline
-: CF_HDROP            15 ; inline
-: CF_LOCALE           16 ; inline
-: CF_DIBV5            17 ; inline
-: CF_MAX              18 ; inline
-
-: CF_OWNERDISPLAY HEX: 0080 ; inline
-: CF_DSPTEXT HEX: 0081 ; inline
-: CF_DSPBITMAP HEX: 0082 ; inline
-: CF_DSPMETAFILEPICT HEX: 0083 ; inline
-: CF_DSPENHMETAFILE HEX: 008E ; inline
-
-! "Private" formats don't get GlobalFree()'d
-: CF_PRIVATEFIRST HEX: 200 ; inline
-: CF_PRIVATELAST HEX: 2FF ; inline
-
-
-
-
-
-! "GDIOBJ" formats do get DeleteObject()'d
-: CF_GDIOBJFIRST HEX: 300 ; inline
-: CF_GDIOBJLAST HEX: 3FF ; inline
-
-
-: WM_NULL                         0 ; inline
-: WM_CREATE                       1 ; inline
-: WM_DESTROY                      2 ; inline
-: WM_MOVE                         3 ; inline
-: WM_SIZE                         5 ; inline
-: WM_ACTIVATE                     6 ; inline
-
-
-! Virtual Keys, Standard Set
-: VK_LBUTTON        HEX: 01 ; inline
-: VK_RBUTTON        HEX: 02 ; inline
-: VK_CANCEL         HEX: 03 ; inline
-: VK_MBUTTON        HEX: 04 ; inline  ! NOT contiguous with L & RBUTTON
-: VK_XBUTTON1       HEX: 05 ; inline  ! NOT contiguous with L & RBUTTON
-: VK_XBUTTON2       HEX: 06 ; inline  ! NOT contiguous with L & RBUTTON
-! 0x07 : unassigned
-: VK_BACK           HEX: 08 ; inline
-: VK_TAB            HEX: 09 ; inline
-! 0x0A - 0x0B : reserved
-
-: VK_CLEAR          HEX: 0C ; inline
-: VK_RETURN         HEX: 0D ; inline
-
-: VK_SHIFT          HEX: 10 ; inline
-: VK_CONTROL        HEX: 11 ; inline
-: VK_MENU           HEX: 12 ; inline
-: VK_PAUSE          HEX: 13 ; inline
-: VK_CAPITAL        HEX: 14 ; inline
-
-: VK_KANA           HEX: 15 ; inline
-: VK_HANGEUL        HEX: 15 ; inline ! old name - here for compatibility
-: VK_HANGUL         HEX: 15 ; inline
-: VK_JUNJA          HEX: 17 ; inline
-: VK_FINAL          HEX: 18 ; inline
-: VK_HANJA          HEX: 19 ; inline
-: VK_KANJI          HEX: 19 ; inline
-
-: VK_ESCAPE         HEX: 1B ; inline
-
-: VK_CONVERT        HEX: 1C ; inline
-: VK_NONCONVERT     HEX: 1D ; inline
-: VK_ACCEPT         HEX: 1E ; inline
-: VK_MODECHANGE     HEX: 1F ; inline
-
-: VK_SPACE          HEX: 20 ; inline
-: VK_PRIOR          HEX: 21 ; inline
-: VK_NEXT           HEX: 22 ; inline
-: VK_END            HEX: 23 ; inline
-: VK_HOME           HEX: 24 ; inline
-: VK_LEFT           HEX: 25 ; inline
-: VK_UP             HEX: 26 ; inline
-: VK_RIGHT          HEX: 27 ; inline
-: VK_DOWN           HEX: 28 ; inline
-: VK_SELECT         HEX: 29 ; inline
-: VK_PRINT          HEX: 2A ; inline
-: VK_EXECUTE        HEX: 2B ; inline
-: VK_SNAPSHOT       HEX: 2C ; inline
-: VK_INSERT         HEX: 2D ; inline
-: VK_DELETE         HEX: 2E ; inline
-: VK_HELP           HEX: 2F ; inline
-
-! VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
-! 0x40 : unassigned
-! VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
-
-: VK_LWIN           HEX: 5B ; inline
-: VK_RWIN           HEX: 5C ; inline
-: VK_APPS           HEX: 5D ; inline
-
-! 0x5E : reserved
-
-: VK_SLEEP          HEX: 5F ; inline
-
-: VK_NUMPAD0        HEX: 60 ; inline
-: VK_NUMPAD1        HEX: 61 ; inline
-: VK_NUMPAD2        HEX: 62 ; inline
-: VK_NUMPAD3        HEX: 63 ; inline
-: VK_NUMPAD4        HEX: 64 ; inline
-: VK_NUMPAD5        HEX: 65 ; inline
-: VK_NUMPAD6        HEX: 66 ; inline
-: VK_NUMPAD7        HEX: 67 ; inline
-: VK_NUMPAD8        HEX: 68 ; inline
-: VK_NUMPAD9        HEX: 69 ; inline
-: VK_MULTIPLY       HEX: 6A ; inline
-: VK_ADD            HEX: 6B ; inline
-: VK_SEPARATOR      HEX: 6C ; inline
-: VK_SUBTRACT       HEX: 6D ; inline
-: VK_DECIMAL        HEX: 6E ; inline
-: VK_DIVIDE         HEX: 6F ; inline
-: VK_F1             HEX: 70 ; inline
-: VK_F2             HEX: 71 ; inline
-: VK_F3             HEX: 72 ; inline
-: VK_F4             HEX: 73 ; inline
-: VK_F5             HEX: 74 ; inline
-: VK_F6             HEX: 75 ; inline
-: VK_F7             HEX: 76 ; inline
-: VK_F8             HEX: 77 ; inline
-: VK_F9             HEX: 78 ; inline
-: VK_F10            HEX: 79 ; inline
-: VK_F11            HEX: 7A ; inline
-: VK_F12            HEX: 7B ; inline
-: VK_F13            HEX: 7C ; inline
-: VK_F14            HEX: 7D ; inline
-: VK_F15            HEX: 7E ; inline
-: VK_F16            HEX: 7F ; inline
-: VK_F17            HEX: 80 ; inline
-: VK_F18            HEX: 81 ; inline
-: VK_F19            HEX: 82 ; inline
-: VK_F20            HEX: 83 ; inline
-: VK_F21            HEX: 84 ; inline
-: VK_F22            HEX: 85 ; inline
-: VK_F23            HEX: 86 ; inline
-: VK_F24            HEX: 87 ; inline
-
-! 0x88 - 0x8F : unassigned
-
-: VK_NUMLOCK        HEX: 90 ; inline
-: VK_SCROLL         HEX: 91 ; inline
-
-! NEC PC-9800 kbd definitions
-: VK_OEM_NEC_EQUAL  HEX: 92 ; inline  ! '=' key on numpad
-
-! Fujitsu/OASYS kbd definitions
-: VK_OEM_FJ_JISHO   HEX: 92 ; inline  ! 'Dictionary' key
-: VK_OEM_FJ_MASSHOU HEX: 93 ; inline  ! 'Unregister word' key
-: VK_OEM_FJ_TOUROKU HEX: 94 ; inline  ! 'Register word' key
-: VK_OEM_FJ_LOYA    HEX: 95 ; inline  ! 'Left OYAYUBI' key
-: VK_OEM_FJ_ROYA    HEX: 96 ; inline  ! 'Right OYAYUBI' key
-
-! 0x97 - 0x9F : unassigned
-
-! VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
-! Used only as parameters to GetAsyncKeyState() and GetKeyState().
-! No other API or message will distinguish left and right keys in this way.
-: VK_LSHIFT         HEX: A0 ; inline
-: VK_RSHIFT         HEX: A1 ; inline
-: VK_LCONTROL       HEX: A2 ; inline
-: VK_RCONTROL       HEX: A3 ; inline
-: VK_LMENU          HEX: A4 ; inline
-: VK_RMENU          HEX: A5 ; inline
-
-: VK_BROWSER_BACK        HEX: A6 ; inline
-: VK_BROWSER_FORWARD     HEX: A7 ; inline
-: VK_BROWSER_REFRESH     HEX: A8 ; inline
-: VK_BROWSER_STOP        HEX: A9 ; inline
-: VK_BROWSER_SEARCH      HEX: AA ; inline
-: VK_BROWSER_FAVORITES   HEX: AB ; inline
-: VK_BROWSER_HOME        HEX: AC ; inline
-
-: VK_VOLUME_MUTE         HEX: AD ; inline
-: VK_VOLUME_DOWN         HEX: AE ; inline
-: VK_VOLUME_UP           HEX: AF ; inline
-: VK_MEDIA_NEXT_TRACK    HEX: B0 ; inline
-: VK_MEDIA_PREV_TRACK    HEX: B1 ; inline
-: VK_MEDIA_STOP          HEX: B2 ; inline
-: VK_MEDIA_PLAY_PAUSE    HEX: B3 ; inline
-: VK_LAUNCH_MAIL         HEX: B4 ; inline
-: VK_LAUNCH_MEDIA_SELECT HEX: B5 ; inline
-: VK_LAUNCH_APP1         HEX: B6 ; inline
-: VK_LAUNCH_APP2         HEX: B7 ; inline
-
-! 0xB8 - 0xB9 : reserved
-
-: VK_OEM_1          HEX: BA ; inline  ! ';:' for US
-: VK_OEM_PLUS       HEX: BB ; inline  ! '+' any country
-: VK_OEM_COMMA      HEX: BC ; inline  ! ',' any country
-: VK_OEM_MINUS      HEX: BD ; inline  ! '-' any country
-: VK_OEM_PERIOD     HEX: BE ; inline  ! '.' any country
-: VK_OEM_2          HEX: BF ; inline  ! '/?' for US
-: VK_OEM_3          HEX: C0 ; inline  ! '`~' for US
-
-! 0xC1 - 0xD7 : reserved
-
-! 0xD8 - 0xDA : unassigned
-
-: VK_OEM_4          HEX: DB ; inline !  '[{' for US
-: VK_OEM_5          HEX: DC ; inline !  '\|' for US
-: VK_OEM_6          HEX: DD ; inline !  ']}' for US
-: VK_OEM_7          HEX: DE ; inline !  ''"' for US
-: VK_OEM_8          HEX: DF ; inline
-
-! 0xE0 : reserved
-
-! Various extended or enhanced keyboards
-: VK_OEM_AX         HEX: E1 ; inline !  'AX' key on Japanese AX kbd
-: VK_OEM_102        HEX: E2 ; inline !  "<>" or "\|" on RT 102-key kbd.
-: VK_ICO_HELP       HEX: E3 ; inline !  Help key on ICO
-: VK_ICO_00         HEX: E4 ; inline !  00 key on ICO
-
-: VK_PROCESSKEY     HEX: E5 ; inline
-
-: VK_ICO_CLEAR      HEX: E6 ; inline
-
-: VK_PACKET         HEX: E7 ; inline
-
-! 0xE8 : unassigned
-
-! Nokia/Ericsson definitions
-: VK_OEM_RESET      HEX: E9 ; inline
-: VK_OEM_JUMP       HEX: EA ; inline
-: VK_OEM_PA1        HEX: EB ; inline
-: VK_OEM_PA2        HEX: EC ; inline
-: VK_OEM_PA3        HEX: ED ; inline
-: VK_OEM_WSCTRL     HEX: EE ; inline
-: VK_OEM_CUSEL      HEX: EF ; inline
-: VK_OEM_ATTN       HEX: F0 ; inline
-: VK_OEM_FINISH     HEX: F1 ; inline
-: VK_OEM_COPY       HEX: F2 ; inline
-: VK_OEM_AUTO       HEX: F3 ; inline
-: VK_OEM_ENLW       HEX: F4 ; inline
-: VK_OEM_BACKTAB    HEX: F5 ; inline
-
-: VK_ATTN           HEX: F6 ; inline
-: VK_CRSEL          HEX: F7 ; inline
-: VK_EXSEL          HEX: F8 ; inline
-: VK_EREOF          HEX: F9 ; inline
-: VK_PLAY           HEX: FA ; inline
-: VK_ZOOM           HEX: FB ; inline
-: VK_NONAME         HEX: FC ; inline
-: VK_PA1            HEX: FD ; inline
-: VK_OEM_CLEAR      HEX: FE ; inline
-! 0xFF : reserved
-
-! Key State Masks for Mouse Messages
-: MK_LBUTTON          HEX: 0001 ; inline
-: MK_RBUTTON          HEX: 0002 ; inline
-: MK_SHIFT            HEX: 0004 ; inline
-: MK_CONTROL          HEX: 0008 ; inline
-: MK_MBUTTON          HEX: 0010 ; inline
-: MK_XBUTTON1         HEX: 0020 ; inline
-: MK_XBUTTON2         HEX: 0040 ; inline
-
-
-! Some fields are not defined for win64
-! Window field offsets for GetWindowLong()
-! TODO: win32 only!!
-windows? [
-    : GWL_WNDPROC         -4 ;
-    : GWL_HINSTANCE       -6 ;
-    : GWL_HWNDPARENT      -8 ;
-    : GWL_USERDATA        -21 ;
-    : GWL_ID              -12 ;
-] when
-
-: GWL_STYLE           -16 ;
-: GWL_EXSTYLE         -20 ;
-
-: GWLP_WNDPROC        -4 ;
-: GWLP_HINSTANCE      -6 ;
-: GWLP_HWNDPARENT     -8 ;
-: GWLP_USERDATA       -21 ;
-: GWLP_ID             -12 ;
-
-! Class field offsets for GetClassLong()
-! TODO: win32 only!
-windows? [
-    : GCL_MENUNAME        -8 ;
-    : GCL_HBRBACKGROUND   -10 ;
-    : GCL_HCURSOR         -12 ;
-    : GCL_HICON           -14 ;
-    : GCL_HMODULE         -16 ;
-    : GCL_WNDPROC         -24 ;
-    : GCL_HICONSM         -34 ;
-] when
-: GCL_CBWNDEXTRA      -18 ;
-: GCL_CBCLSEXTRA      -20 ;
-: GCL_STYLE           -26 ;
-: GCW_ATOM            -32 ;
-
-: GCLP_MENUNAME       -8 ;
-: GCLP_HBRBACKGROUND  -10 ;
-: GCLP_HCURSOR        -12 ;
-: GCLP_HICON          -14 ;
-: GCLP_HMODULE        -16 ;
-: GCLP_WNDPROC        -24 ;
-: GCLP_HICONSM        -34 ;
-
-: MB_ICONASTERISK    HEX: 00000040 ;
-: MB_ICONEXCLAMATION HEX: 00000030 ;
-: MB_ICONHAND        HEX: 00000010 ;
-: MB_ICONQUESTION    HEX: 00000020 ;
-: MB_OK              HEX: 00000000 ;
-
-: TME_HOVER 1 ; inline
-: TME_LEAVE 2 ; inline
-: TME_QUERY HEX: 40000000 ; inline
-: TME_CANCEL HEX: 80000000 ; inline
-: HOVER_DEFAULT HEX: ffffffff ; inline
-
-BEGIN-STRUCT: TRACKMOUSEEVENT
-    FIELD: DWORD cbSize
-    FIELD: DWORD dwFlags
-    FIELD: HWND hwndTrack
-    FIELD: DWORD dwHoverTime
-END-STRUCT
-
-TYPEDEF: TRACKMOUSEEVENT* LPTRACKMOUSEEVENT
-
diff --git a/core/windows/user32-types.factor b/core/windows/user32-types.factor
deleted file mode 100644 (file)
index 361ee9a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-IN: win32-api
-
-
diff --git a/core/windows/user32.factor b/core/windows/user32.factor
deleted file mode 100644 (file)
index 4bd2e5b..0000000
+++ /dev/null
@@ -1,1371 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien parser namespaces kernel syntax words math io prettyprint ;
-IN: win32-api
-
-
-TYPEDEF: void* MSGBOXPARAMSA
-TYPEDEF: void* MSGBOXPARAMSW
-
-
-! HKL for ActivateKeyboardLayout
-: HKL_PREV 0 ;
-: HKL_NEXT 1 ;
-
-: CW_USEDEFAULT HEX: 80000000 ;
-
-: WS_OVERLAPPED       HEX: 00000000 ;
-: WS_POPUP            HEX: 80000000 ;
-: WS_CHILD            HEX: 40000000 ;
-: WS_MINIMIZE         HEX: 20000000 ;
-: WS_VISIBLE          HEX: 10000000 ;
-: WS_DISABLED         HEX: 08000000 ;
-: WS_CLIPSIBLINGS     HEX: 04000000 ;
-: WS_CLIPCHILDREN     HEX: 02000000 ;
-: WS_MAXIMIZE         HEX: 01000000 ;
-: WS_CAPTION          HEX: 00C00000 ; !    /* WS_BORDER | WS_DLGFRAME  */
-: WS_BORDER           HEX: 00800000 ;
-: WS_DLGFRAME         HEX: 00400000 ;
-: WS_VSCROLL          HEX: 00200000 ;
-: WS_HSCROLL          HEX: 00100000 ;
-: WS_SYSMENU          HEX: 00080000 ;
-: WS_THICKFRAME       HEX: 00040000 ;
-: WS_GROUP            HEX: 00020000 ;
-: WS_TABSTOP          HEX: 00010000 ;
-: WS_MINIMIZEBOX      HEX: 00020000 ;
-: WS_MAXIMIZEBOX      HEX: 00010000 ;
-
-! Common window styles
-: WS_OVERLAPPEDWINDOW WS_OVERLAPPED WS_CAPTION WS_SYSMENU WS_THICKFRAME WS_MINIMIZEBOX WS_MAXIMIZEBOX bitor bitor bitor bitor bitor ;
-
-: WS_POPUPWINDOW      WS_POPUP WS_BORDER WS_SYSMENU bitor bitor ;
-
-: WS_CHILDWINDOW      WS_CHILD ;
-
-: WS_TILED            WS_OVERLAPPED ;
-: WS_ICONIC           WS_MINIMIZE ;
-: WS_SIZEBOX          WS_THICKFRAME ;
-: WS_TILEDWINDOW      WS_OVERLAPPEDWINDOW ;
-
-
-
-! Extended window styles
-
-: WS_EX_DLGMODALFRAME     HEX: 00000001 ; inline
-: WS_EX_NOPARENTNOTIFY    HEX: 00000004 ; inline
-: WS_EX_TOPMOST           HEX: 00000008 ; inline
-: WS_EX_ACCEPTFILES       HEX: 00000010 ; inline
-: WS_EX_TRANSPARENT       HEX: 00000020 ; inline
-: WS_EX_MDICHILD          HEX: 00000040 ; inline
-: WS_EX_TOOLWINDOW        HEX: 00000080 ; inline
-: WS_EX_WINDOWEDGE        HEX: 00000100 ; inline
-: WS_EX_CLIENTEDGE        HEX: 00000200 ; inline
-: WS_EX_CONTEXTHELP       HEX: 00000400 ; inline
-
-: WS_EX_RIGHT             HEX: 00001000 ; inline
-: WS_EX_LEFT              HEX: 00000000 ; inline
-: WS_EX_RTLREADING        HEX: 00002000 ; inline
-: WS_EX_LTRREADING        HEX: 00000000 ; inline
-: WS_EX_LEFTSCROLLBAR     HEX: 00004000 ; inline
-: WS_EX_RIGHTSCROLLBAR    HEX: 00000000 ; inline
-: WS_EX_CONTROLPARENT     HEX: 00010000 ; inline
-: WS_EX_STATICEDGE        HEX: 00020000 ; inline
-: WS_EX_APPWINDOW         HEX: 00040000 ; inline
-: WS_EX_OVERLAPPEDWINDOW WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE bitor ; inline
-: WS_EX_PALETTEWINDOW
-    WS_EX_WINDOWEDGE WS_EX_TOOLWINDOW bitor WS_EX_TOPMOST bitor ; inline
-
-
-: CS_VREDRAW          HEX: 0001 ;
-: CS_HREDRAW          HEX: 0002 ;
-: CS_DBLCLKS          HEX: 0008 ;
-: CS_OWNDC            HEX: 0020 ;
-: CS_CLASSDC          HEX: 0040 ;
-: CS_PARENTDC         HEX: 0080 ;
-: CS_NOCLOSE          HEX: 0200 ;
-: CS_SAVEBITS         HEX: 0800 ;
-: CS_BYTEALIGNCLIENT  HEX: 1000 ;
-: CS_BYTEALIGNWINDOW  HEX: 2000 ;
-: CS_GLOBALCLASS      HEX: 4000 ;
-
-: COLOR_SCROLLBAR         0 ;
-: COLOR_BACKGROUND        1 ;
-: COLOR_ACTIVECAPTION     2 ;
-: COLOR_INACTIVECAPTION   3 ;
-: COLOR_MENU              4 ;
-: COLOR_WINDOW            5 ;
-: COLOR_WINDOWFRAME       6 ;
-: COLOR_MENUTEXT          7 ;
-: COLOR_WINDOWTEXT        8 ;
-: COLOR_CAPTIONTEXT       9 ;
-: COLOR_ACTIVEBORDER      10 ;
-: COLOR_INACTIVEBORDER    11 ;
-: COLOR_APPWORKSPACE      12 ;
-: COLOR_HIGHLIGHT         13 ;
-: COLOR_HIGHLIGHTTEXT     14 ;
-: COLOR_BTNFACE           15 ;
-: COLOR_BTNSHADOW         16 ;
-: COLOR_GRAYTEXT          17 ;
-: COLOR_BTNTEXT           18 ;
-: COLOR_INACTIVECAPTIONTEXT 19 ;
-: COLOR_BTNHIGHLIGHT      20 ;
-
-: IDI_APPLICATION     32512 ;
-: IDI_HAND            32513 ;
-: IDI_QUESTION        32514 ;
-: IDI_EXCLAMATION     32515 ;
-: IDI_ASTERISK        32516 ;
-: IDI_WINLOGO         32517 ;
-
-! ShowWindow() Commands
-: SW_HIDE             0 ;
-: SW_SHOWNORMAL       1 ;
-: SW_NORMAL           1 ;
-: SW_SHOWMINIMIZED    2 ;
-: SW_SHOWMAXIMIZED    3 ;
-: SW_MAXIMIZE         3 ;
-: SW_SHOWNOACTIVATE   4 ;
-: SW_SHOW             5 ;
-: SW_MINIMIZE         6 ;
-: SW_SHOWMINNOACTIVE  7 ;
-: SW_SHOWNA           8 ;
-: SW_RESTORE          9 ;
-: SW_SHOWDEFAULT      10 ;
-: SW_FORCEMINIMIZE    11 ;
-: SW_MAX              11 ;
-
-! PeekMessage
-: PM_NOREMOVE   0 ;
-: PM_REMOVE     1 ;
-: PM_NOYIELD    2 ;
-! : PM_QS_INPUT         (QS_INPUT << 16) ;
-! : PM_QS_POSTMESSAGE   ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16) ;
-! : PM_QS_PAINT         (QS_PAINT << 16) ;
-! : PM_QS_SENDMESSAGE   (QS_SENDMESSAGE << 16) ;
-
-
-! 
-! Standard Cursor IDs
-!
-: IDC_ARROW           32512 ;
-: IDC_IBEAM           32513 ;
-: IDC_WAIT            32514 ;
-: IDC_CROSS           32515 ;
-: IDC_UPARROW         32516 ;
-: IDC_SIZE            32640 ; ! OBSOLETE: use IDC_SIZEALL
-: IDC_ICON            32641 ; ! OBSOLETE: use IDC_ARROW
-: IDC_SIZENWSE        32642 ;
-: IDC_SIZENESW        32643 ;
-: IDC_SIZEWE          32644 ;
-: IDC_SIZENS          32645 ;
-: IDC_SIZEALL         32646 ;
-: IDC_NO              32648 ; ! not in win3.1
-: IDC_HAND            32649 ;
-: IDC_APPSTARTING     32650 ; ! not in win3.1
-: IDC_HELP            32651 ;
-
-
-
-
-
-! Predefined Clipboard Formats
-: CF_TEXT             1 ; inline
-: CF_BITMAP           2 ; inline
-: CF_METAFILEPICT     3 ; inline
-: CF_SYLK             4 ; inline
-: CF_DIF              5 ; inline
-: CF_TIFF             6 ; inline
-: CF_OEMTEXT          7 ; inline
-: CF_DIB              8 ; inline
-: CF_PALETTE          9 ; inline
-: CF_PENDATA          10 ; inline
-: CF_RIFF             11 ; inline
-: CF_WAVE             12 ; inline
-: CF_UNICODETEXT      13 ; inline
-: CF_ENHMETAFILE      14 ; inline
-: CF_HDROP            15 ; inline
-: CF_LOCALE           16 ; inline
-: CF_DIBV5            17 ; inline
-: CF_MAX              18 ; inline
-
-: CF_OWNERDISPLAY HEX: 0080 ; inline
-: CF_DSPTEXT HEX: 0081 ; inline
-: CF_DSPBITMAP HEX: 0082 ; inline
-: CF_DSPMETAFILEPICT HEX: 0083 ; inline
-: CF_DSPENHMETAFILE HEX: 008E ; inline
-
-! "Private" formats don't get GlobalFree()'d
-: CF_PRIVATEFIRST HEX: 200 ; inline
-: CF_PRIVATELAST HEX: 2FF ; inline
-
-
-
-
-
-! "GDIOBJ" formats do get DeleteObject()'d
-: CF_GDIOBJFIRST HEX: 300 ; inline
-: CF_GDIOBJLAST HEX: 3FF ; inline
-
-
-: WM_NULL                         0 ; inline
-: WM_CREATE                       1 ; inline
-: WM_DESTROY                      2 ; inline
-: WM_MOVE                         3 ; inline
-: WM_SIZE                         5 ; inline
-: WM_ACTIVATE                     6 ; inline
-
-
-! Virtual Keys, Standard Set
-: VK_LBUTTON        HEX: 01 ; inline
-: VK_RBUTTON        HEX: 02 ; inline
-: VK_CANCEL         HEX: 03 ; inline
-: VK_MBUTTON        HEX: 04 ; inline  ! NOT contiguous with L & RBUTTON
-: VK_XBUTTON1       HEX: 05 ; inline  ! NOT contiguous with L & RBUTTON
-: VK_XBUTTON2       HEX: 06 ; inline  ! NOT contiguous with L & RBUTTON
-! 0x07 : unassigned
-: VK_BACK           HEX: 08 ; inline
-: VK_TAB            HEX: 09 ; inline
-! 0x0A - 0x0B : reserved
-
-: VK_CLEAR          HEX: 0C ; inline
-: VK_RETURN         HEX: 0D ; inline
-
-: VK_SHIFT          HEX: 10 ; inline
-: VK_CONTROL        HEX: 11 ; inline
-: VK_MENU           HEX: 12 ; inline
-: VK_PAUSE          HEX: 13 ; inline
-: VK_CAPITAL        HEX: 14 ; inline
-
-: VK_KANA           HEX: 15 ; inline
-: VK_HANGEUL        HEX: 15 ; inline ! old name - here for compatibility
-: VK_HANGUL         HEX: 15 ; inline
-: VK_JUNJA          HEX: 17 ; inline
-: VK_FINAL          HEX: 18 ; inline
-: VK_HANJA          HEX: 19 ; inline
-: VK_KANJI          HEX: 19 ; inline
-
-: VK_ESCAPE         HEX: 1B ; inline
-
-: VK_CONVERT        HEX: 1C ; inline
-: VK_NONCONVERT     HEX: 1D ; inline
-: VK_ACCEPT         HEX: 1E ; inline
-: VK_MODECHANGE     HEX: 1F ; inline
-
-: VK_SPACE          HEX: 20 ; inline
-: VK_PRIOR          HEX: 21 ; inline
-: VK_NEXT           HEX: 22 ; inline
-: VK_END            HEX: 23 ; inline
-: VK_HOME           HEX: 24 ; inline
-: VK_LEFT           HEX: 25 ; inline
-: VK_UP             HEX: 26 ; inline
-: VK_RIGHT          HEX: 27 ; inline
-: VK_DOWN           HEX: 28 ; inline
-: VK_SELECT         HEX: 29 ; inline
-: VK_PRINT          HEX: 2A ; inline
-: VK_EXECUTE        HEX: 2B ; inline
-: VK_SNAPSHOT       HEX: 2C ; inline
-: VK_INSERT         HEX: 2D ; inline
-: VK_DELETE         HEX: 2E ; inline
-: VK_HELP           HEX: 2F ; inline
-
-! VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
-! 0x40 : unassigned
-! VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
-
-: VK_LWIN           HEX: 5B ; inline
-: VK_RWIN           HEX: 5C ; inline
-: VK_APPS           HEX: 5D ; inline
-
-! 0x5E : reserved
-
-: VK_SLEEP          HEX: 5F ; inline
-
-: VK_NUMPAD0        HEX: 60 ; inline
-: VK_NUMPAD1        HEX: 61 ; inline
-: VK_NUMPAD2        HEX: 62 ; inline
-: VK_NUMPAD3        HEX: 63 ; inline
-: VK_NUMPAD4        HEX: 64 ; inline
-: VK_NUMPAD5        HEX: 65 ; inline
-: VK_NUMPAD6        HEX: 66 ; inline
-: VK_NUMPAD7        HEX: 67 ; inline
-: VK_NUMPAD8        HEX: 68 ; inline
-: VK_NUMPAD9        HEX: 69 ; inline
-: VK_MULTIPLY       HEX: 6A ; inline
-: VK_ADD            HEX: 6B ; inline
-: VK_SEPARATOR      HEX: 6C ; inline
-: VK_SUBTRACT       HEX: 6D ; inline
-: VK_DECIMAL        HEX: 6E ; inline
-: VK_DIVIDE         HEX: 6F ; inline
-: VK_F1             HEX: 70 ; inline
-: VK_F2             HEX: 71 ; inline
-: VK_F3             HEX: 72 ; inline
-: VK_F4             HEX: 73 ; inline
-: VK_F5             HEX: 74 ; inline
-: VK_F6             HEX: 75 ; inline
-: VK_F7             HEX: 76 ; inline
-: VK_F8             HEX: 77 ; inline
-: VK_F9             HEX: 78 ; inline
-: VK_F10            HEX: 79 ; inline
-: VK_F11            HEX: 7A ; inline
-: VK_F12            HEX: 7B ; inline
-: VK_F13            HEX: 7C ; inline
-: VK_F14            HEX: 7D ; inline
-: VK_F15            HEX: 7E ; inline
-: VK_F16            HEX: 7F ; inline
-: VK_F17            HEX: 80 ; inline
-: VK_F18            HEX: 81 ; inline
-: VK_F19            HEX: 82 ; inline
-: VK_F20            HEX: 83 ; inline
-: VK_F21            HEX: 84 ; inline
-: VK_F22            HEX: 85 ; inline
-: VK_F23            HEX: 86 ; inline
-: VK_F24            HEX: 87 ; inline
-
-! 0x88 - 0x8F : unassigned
-
-: VK_NUMLOCK        HEX: 90 ; inline
-: VK_SCROLL         HEX: 91 ; inline
-
-! NEC PC-9800 kbd definitions
-: VK_OEM_NEC_EQUAL  HEX: 92 ; inline  ! '=' key on numpad
-
-! Fujitsu/OASYS kbd definitions
-: VK_OEM_FJ_JISHO   HEX: 92 ; inline  ! 'Dictionary' key
-: VK_OEM_FJ_MASSHOU HEX: 93 ; inline  ! 'Unregister word' key
-: VK_OEM_FJ_TOUROKU HEX: 94 ; inline  ! 'Register word' key
-: VK_OEM_FJ_LOYA    HEX: 95 ; inline  ! 'Left OYAYUBI' key
-: VK_OEM_FJ_ROYA    HEX: 96 ; inline  ! 'Right OYAYUBI' key
-
-! 0x97 - 0x9F : unassigned
-
-! VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
-! Used only as parameters to GetAsyncKeyState() and GetKeyState().
-! No other API or message will distinguish left and right keys in this way.
-: VK_LSHIFT         HEX: A0 ; inline
-: VK_RSHIFT         HEX: A1 ; inline
-: VK_LCONTROL       HEX: A2 ; inline
-: VK_RCONTROL       HEX: A3 ; inline
-: VK_LMENU          HEX: A4 ; inline
-: VK_RMENU          HEX: A5 ; inline
-
-: VK_BROWSER_BACK        HEX: A6 ; inline
-: VK_BROWSER_FORWARD     HEX: A7 ; inline
-: VK_BROWSER_REFRESH     HEX: A8 ; inline
-: VK_BROWSER_STOP        HEX: A9 ; inline
-: VK_BROWSER_SEARCH      HEX: AA ; inline
-: VK_BROWSER_FAVORITES   HEX: AB ; inline
-: VK_BROWSER_HOME        HEX: AC ; inline
-
-: VK_VOLUME_MUTE         HEX: AD ; inline
-: VK_VOLUME_DOWN         HEX: AE ; inline
-: VK_VOLUME_UP           HEX: AF ; inline
-: VK_MEDIA_NEXT_TRACK    HEX: B0 ; inline
-: VK_MEDIA_PREV_TRACK    HEX: B1 ; inline
-: VK_MEDIA_STOP          HEX: B2 ; inline
-: VK_MEDIA_PLAY_PAUSE    HEX: B3 ; inline
-: VK_LAUNCH_MAIL         HEX: B4 ; inline
-: VK_LAUNCH_MEDIA_SELECT HEX: B5 ; inline
-: VK_LAUNCH_APP1         HEX: B6 ; inline
-: VK_LAUNCH_APP2         HEX: B7 ; inline
-
-! 0xB8 - 0xB9 : reserved
-
-: VK_OEM_1          HEX: BA ; inline  ! ';:' for US
-: VK_OEM_PLUS       HEX: BB ; inline  ! '+' any country
-: VK_OEM_COMMA      HEX: BC ; inline  ! ',' any country
-: VK_OEM_MINUS      HEX: BD ; inline  ! '-' any country
-: VK_OEM_PERIOD     HEX: BE ; inline  ! '.' any country
-: VK_OEM_2          HEX: BF ; inline  ! '/?' for US
-: VK_OEM_3          HEX: C0 ; inline  ! '`~' for US
-
-! 0xC1 - 0xD7 : reserved
-
-! 0xD8 - 0xDA : unassigned
-
-: VK_OEM_4          HEX: DB ; inline !  '[{' for US
-: VK_OEM_5          HEX: DC ; inline !  '\|' for US
-: VK_OEM_6          HEX: DD ; inline !  ']}' for US
-: VK_OEM_7          HEX: DE ; inline !  ''"' for US
-: VK_OEM_8          HEX: DF ; inline
-
-! 0xE0 : reserved
-
-! Various extended or enhanced keyboards
-: VK_OEM_AX         HEX: E1 ; inline !  'AX' key on Japanese AX kbd
-: VK_OEM_102        HEX: E2 ; inline !  "<>" or "\|" on RT 102-key kbd.
-: VK_ICO_HELP       HEX: E3 ; inline !  Help key on ICO
-: VK_ICO_00         HEX: E4 ; inline !  00 key on ICO
-
-: VK_PROCESSKEY     HEX: E5 ; inline
-
-: VK_ICO_CLEAR      HEX: E6 ; inline
-
-: VK_PACKET         HEX: E7 ; inline
-
-! 0xE8 : unassigned
-
-! Nokia/Ericsson definitions
-: VK_OEM_RESET      HEX: E9 ; inline
-: VK_OEM_JUMP       HEX: EA ; inline
-: VK_OEM_PA1        HEX: EB ; inline
-: VK_OEM_PA2        HEX: EC ; inline
-: VK_OEM_PA3        HEX: ED ; inline
-: VK_OEM_WSCTRL     HEX: EE ; inline
-: VK_OEM_CUSEL      HEX: EF ; inline
-: VK_OEM_ATTN       HEX: F0 ; inline
-: VK_OEM_FINISH     HEX: F1 ; inline
-: VK_OEM_COPY       HEX: F2 ; inline
-: VK_OEM_AUTO       HEX: F3 ; inline
-: VK_OEM_ENLW       HEX: F4 ; inline
-: VK_OEM_BACKTAB    HEX: F5 ; inline
-
-: VK_ATTN           HEX: F6 ; inline
-: VK_CRSEL          HEX: F7 ; inline
-: VK_EXSEL          HEX: F8 ; inline
-: VK_EREOF          HEX: F9 ; inline
-: VK_PLAY           HEX: FA ; inline
-: VK_ZOOM           HEX: FB ; inline
-: VK_NONAME         HEX: FC ; inline
-: VK_PA1            HEX: FD ; inline
-: VK_OEM_CLEAR      HEX: FE ; inline
-! 0xFF : reserved
-
-! Key State Masks for Mouse Messages
-: MK_LBUTTON          HEX: 0001 ; inline
-: MK_RBUTTON          HEX: 0002 ; inline
-: MK_SHIFT            HEX: 0004 ; inline
-: MK_CONTROL          HEX: 0008 ; inline
-: MK_MBUTTON          HEX: 0010 ; inline
-: MK_XBUTTON1         HEX: 0020 ; inline
-: MK_XBUTTON2         HEX: 0040 ; inline
-
-
-! Some fields are not defined for win64
-! Window field offsets for GetWindowLong()
-! TODO: win32 only!!
-windows? [
-    : GWL_WNDPROC         -4 ;
-    : GWL_HINSTANCE       -6 ;
-    : GWL_HWNDPARENT      -8 ;
-    : GWL_USERDATA        -21 ;
-    : GWL_ID              -12 ;
-] when
-
-: GWL_STYLE           -16 ;
-: GWL_EXSTYLE         -20 ;
-
-: GWLP_WNDPROC        -4 ;
-: GWLP_HINSTANCE      -6 ;
-: GWLP_HWNDPARENT     -8 ;
-: GWLP_USERDATA       -21 ;
-: GWLP_ID             -12 ;
-
-! Class field offsets for GetClassLong()
-! TODO: win32 only!
-windows? [
-    : GCL_MENUNAME        -8 ;
-    : GCL_HBRBACKGROUND   -10 ;
-    : GCL_HCURSOR         -12 ;
-    : GCL_HICON           -14 ;
-    : GCL_HMODULE         -16 ;
-    : GCL_WNDPROC         -24 ;
-    : GCL_HICONSM         -34 ;
-] when
-: GCL_CBWNDEXTRA      -18 ;
-: GCL_CBCLSEXTRA      -20 ;
-: GCL_STYLE           -26 ;
-: GCW_ATOM            -32 ;
-
-: GCLP_MENUNAME       -8 ;
-: GCLP_HBRBACKGROUND  -10 ;
-: GCLP_HCURSOR        -12 ;
-: GCLP_HICON          -14 ;
-: GCLP_HMODULE        -16 ;
-: GCLP_WNDPROC        -24 ;
-: GCLP_HICONSM        -34 ;
-
-
-
-LIBRARY: user32
-FUNCTION: HKL ActivateKeyboardLayout ( HKL hkl, UINT Flags ) ;
-
-FUNCTION: BOOL AdjustWindowRect ( LPRECT lpRect, DWORD dwStyle, BOOL bMenu ) ;
-FUNCTION: BOOL AdjustWindowRectEx ( LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle ) ;
-! FUNCTION: AlignRects
-! FUNCTION: AllowForegroundActivation
-! FUNCTION: AllowSetForegroundWindow
-! FUNCTION: AnimateWindow
-
-
-
-FUNCTION: BOOL AnyPopup ( ) ;
-
-! FUNCTION: AppendMenuA
-! FUNCTION: AppendMenuW
-! FUNCTION: ArrangeIconicWindows
-! FUNCTION: AttachThreadInput
-! FUNCTION: BeginDeferWindowPos
-
-
-FUNCTION: HDC BeginPaint ( HWND hwnd, LPPAINTSTRUCT lpPaint ) ;
-
-! FUNCTION: BlockInput
-! FUNCTION: BringWindowToTop
-! FUNCTION: BroadcastSystemMessage
-! FUNCTION: BroadcastSystemMessageA
-! FUNCTION: BroadcastSystemMessageExA
-! FUNCTION: BroadcastSystemMessageExW
-! FUNCTION: BroadcastSystemMessageW
-! FUNCTION: BuildReasonArray
-! FUNCTION: CalcMenuBar
-! FUNCTION: CallMsgFilter
-! FUNCTION: CallMsgFilterA
-! FUNCTION: CallMsgFilterW
-! FUNCTION: CallNextHookEx
-! FUNCTION: CallWindowProcA
-! FUNCTION: CallWindowProcW
-! FUNCTION: CascadeChildWindows
-! FUNCTION: CascadeWindows
-! FUNCTION: ChangeClipboardChain
-! FUNCTION: ChangeDisplaySettingsA
-! FUNCTION: ChangeDisplaySettingsExA
-! FUNCTION: ChangeDisplaySettingsExW
-! FUNCTION: ChangeDisplaySettingsW
-! FUNCTION: ChangeMenuA
-! FUNCTION: ChangeMenuW
-! FUNCTION: CharLowerA
-! FUNCTION: CharLowerBuffA
-! FUNCTION: CharLowerBuffW
-! FUNCTION: CharLowerW
-! FUNCTION: CharNextA
-! FUNCTION: CharNextExA
-! FUNCTION: CharNextW
-! FUNCTION: CharPrevA
-! FUNCTION: CharPrevExA
-! FUNCTION: CharPrevW
-! FUNCTION: CharToOemA
-! FUNCTION: CharToOemBuffA
-! FUNCTION: CharToOemBuffW
-! FUNCTION: CharToOemW
-! FUNCTION: CharUpperA
-! FUNCTION: CharUpperBuffA
-! FUNCTION: CharUpperBuffW
-! FUNCTION: CharUpperW
-! FUNCTION: CheckDlgButton
-! FUNCTION: CheckMenuItem
-! FUNCTION: CheckMenuRadioItem
-! FUNCTION: CheckRadioButton
-! FUNCTION: ChildWindowFromPoint
-! FUNCTION: ChildWindowFromPointEx
-! FUNCTION: ClientThreadSetup
-! FUNCTION: ClientToScreen
-! FUNCTION: CliImmSetHotKey
-! FUNCTION: ClipCursor
-FUNCTION: BOOL CloseClipboard ( ) ;
-! FUNCTION: CloseDesktop
-! FUNCTION: CloseWindow
-! FUNCTION: CloseWindowStation
-! FUNCTION: CopyAcceleratorTableA
-! FUNCTION: CopyAcceleratorTableW
-! FUNCTION: CopyIcon
-! FUNCTION: CopyImage
-! FUNCTION: CopyRect
-! FUNCTION: CountClipboardFormats
-! FUNCTION: CreateAcceleratorTableA
-! FUNCTION: CreateAcceleratorTableW
-! FUNCTION: CreateCaret
-! FUNCTION: CreateCursor
-! FUNCTION: CreateDesktopA
-! FUNCTION: CreateDesktopW
-! FUNCTION: CreateDialogIndirectParamA
-! FUNCTION: CreateDialogIndirectParamAorW
-! FUNCTION: CreateDialogIndirectParamW
-! FUNCTION: CreateDialogParamA
-! FUNCTION: CreateDialogParamW
-! FUNCTION: CreateIcon
-! FUNCTION: CreateIconFromResource
-! FUNCTION: CreateIconFromResourceEx
-! FUNCTION: CreateIconIndirect
-! FUNCTION: CreateMDIWindowA
-! FUNCTION: CreateMDIWindowW
-! FUNCTION: CreateMenu
-! FUNCTION: CreatePopupMenu
-! FUNCTION: CreateSystemThreads
-
-FUNCTION: HWND CreateWindowExA (
-                DWORD dwExStyle,
-                LPCSTR lpClassName,
-                LPCSTR lpWindowName,
-                DWORD dwStyle,
-                uint X,
-                uint Y,
-                uint nWidth,
-                uint nHeight,
-                HWND hWndParent,
-                HMENU hMenu,
-                HINSTANCE hInstance,
-                LPVOID lpParam ) ;
-
-FUNCTION: HWND CreateWindowExW (
-                DWORD dwExStyle,
-                LPCWSTR lpClassName,
-                LPCWSTR lpWindowName,
-                DWORD dwStyle,
-                uint X,
-                uint Y,
-                uint nWidth,
-                uint nHeight,
-                HWND hWndParent,
-                HMENU hMenu,
-                HINSTANCE hInstance,
-                LPVOID lpParam ) ;
-
-: CreateWindowEx \ CreateWindowExW \ CreateWindowExA unicode-exec ;
-
-! 11 >r <r
-: CreateWindow >r >r >r >r >r >r >r >r >r >r >r 0 r> r> r> r> r> r> r> r> r> r> r> CreateWindowEx ;
-
-
-! FUNCTION: CreateWindowStationA
-! FUNCTION: CreateWindowStationW
-! FUNCTION: CsrBroadcastSystemMessageExW
-! FUNCTION: CtxInitUser32
-! FUNCTION: DdeAbandonTransaction
-! FUNCTION: DdeAccessData
-! FUNCTION: DdeAddData
-! FUNCTION: DdeClientTransaction
-! FUNCTION: DdeCmpStringHandles
-! FUNCTION: DdeConnect
-! FUNCTION: DdeConnectList
-! FUNCTION: DdeCreateDataHandle
-! FUNCTION: DdeCreateStringHandleA
-! FUNCTION: DdeCreateStringHandleW
-! FUNCTION: DdeDisconnect
-! FUNCTION: DdeDisconnectList
-! FUNCTION: DdeEnableCallback
-! FUNCTION: DdeFreeDataHandle
-! FUNCTION: DdeFreeStringHandle
-! FUNCTION: DdeGetData
-! FUNCTION: DdeGetLastError
-! FUNCTION: DdeGetQualityOfService
-! FUNCTION: DdeImpersonateClient
-! FUNCTION: DdeInitializeA
-! FUNCTION: DdeInitializeW
-! FUNCTION: DdeKeepStringHandle
-! FUNCTION: DdeNameService
-! FUNCTION: DdePostAdvise
-! FUNCTION: DdeQueryConvInfo
-! FUNCTION: DdeQueryNextServer
-! FUNCTION: DdeQueryStringA
-! FUNCTION: DdeQueryStringW
-! FUNCTION: DdeReconnect
-! FUNCTION: DdeSetQualityOfService
-! FUNCTION: DdeSetUserHandle
-! FUNCTION: DdeUnaccessData
-! FUNCTION: DdeUninitialize
-! FUNCTION: DefDlgProcA
-! FUNCTION: DefDlgProcW
-! FUNCTION: DeferWindowPos
-! FUNCTION: DefFrameProcA
-! FUNCTION: DefFrameProcW
-! FUNCTION: DefMDIChildProcA
-! FUNCTION: DefMDIChildProcW
-! FUNCTION: DefRawInputProc
-FUNCTION: LRESULT DefWindowProcA ( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ) ;
-FUNCTION: LRESULT DefWindowProcW ( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ) ;
-: DefWindowProc \ DefWindowProcW \ DefWindowProcA unicode-exec ;
-! FUNCTION: DeleteMenu
-! FUNCTION: DeregisterShellHookWindow
-! FUNCTION: DestroyAcceleratorTable
-! FUNCTION: DestroyCaret
-! FUNCTION: DestroyCursor
-! FUNCTION: DestroyIcon
-! FUNCTION: DestroyMenu
-! FUNCTION: DestroyReasons
-FUNCTION: BOOL DestroyWindow ( HWND hWnd ) ;
-! FUNCTION: DeviceEventWorker
-! FUNCTION: DialogBoxIndirectParamA
-! FUNCTION: DialogBoxIndirectParamAorW
-! FUNCTION: DialogBoxIndirectParamW
-! FUNCTION: DialogBoxParamA
-! FUNCTION: DialogBoxParamW
-! FUNCTION: DisableProcessWindowsGhosting
-
-FUNCTION: LONG DispatchMessageA ( MSG* lpMsg ) ;
-FUNCTION: LONG DispatchMessageW ( MSG* lpMsg ) ;
-: DispatchMessage \ DispatchMessageW \ DispatchMessageA unicode-exec ;
-
-! FUNCTION: DisplayExitWindowsWarnings
-! FUNCTION: DlgDirListA
-! FUNCTION: DlgDirListComboBoxA
-! FUNCTION: DlgDirListComboBoxW
-! FUNCTION: DlgDirListW
-! FUNCTION: DlgDirSelectComboBoxExA
-! FUNCTION: DlgDirSelectComboBoxExW
-! FUNCTION: DlgDirSelectExA
-! FUNCTION: DlgDirSelectExW
-! FUNCTION: DragDetect
-! FUNCTION: DragObject
-
-
-FUNCTION: BOOL DrawAnimatedRects ( HWND hWnd, int idAni, RECT* lprcFrom, RECT* lprcTo ) ;
-! FUNCTION: BOOL DrawCaption ( HWND hWnd, HDC hdc, LPRECT lprc, UINT uFlags ) ;
-
-! FUNCTION: DrawEdge
-! FUNCTION: DrawFocusRect
-! FUNCTION: DrawFrame
-! FUNCTION: DrawFrameControl
-! FUNCTION: DrawIcon
-! FUNCTION: DrawIconEx
-! FUNCTION: DrawMenuBar
-! FUNCTION: DrawMenuBarTemp
-! FUNCTION: DrawStateA
-! FUNCTION: DrawStateW
-! FUNCTION: DrawTextA
-! FUNCTION: DrawTextExA
-! FUNCTION: DrawTextExW
-! FUNCTION: DrawTextW
-! FUNCTION: EditWndProc
-FUNCTION: BOOL EmptyClipboard ( ) ;
-! FUNCTION: EnableMenuItem
-! FUNCTION: EnableScrollBar
-! FUNCTION: EnableWindow
-! FUNCTION: EndDeferWindowPos
-! FUNCTION: EndDialog
-! FUNCTION: EndMenu
-
-FUNCTION: BOOL EndPaint ( HWND hWnd, PAINTSTRUCT* lpPaint) ;
-
-! FUNCTION: EndTask
-! FUNCTION: EnterReaderModeHelper
-! FUNCTION: EnumChildWindows
-FUNCTION: UINT EnumClipboardFormats ( UINT format ) ;
-! FUNCTION: EnumDesktopsA
-! FUNCTION: EnumDesktopsW
-! FUNCTION: EnumDesktopWindows
-! FUNCTION: EnumDisplayDevicesA
-! FUNCTION: EnumDisplayDevicesW
-! FUNCTION: EnumDisplayMonitors
-! FUNCTION: EnumDisplaySettingsA
-! FUNCTION: EnumDisplaySettingsExA
-! FUNCTION: EnumDisplaySettingsExW
-! FUNCTION: EnumDisplaySettingsW
-! FUNCTION: EnumPropsA
-! FUNCTION: EnumPropsExA
-! FUNCTION: EnumPropsExW
-! FUNCTION: EnumPropsW
-! FUNCTION: EnumThreadWindows
-! FUNCTION: EnumWindows
-! FUNCTION: EnumWindowStationsA
-! FUNCTION: EnumWindowStationsW
-! FUNCTION: EqualRect
-! FUNCTION: ExcludeUpdateRgn
-! FUNCTION: ExitWindowsEx
-! FUNCTION: FillRect
-! FUNCTION: FindWindowA
-! FUNCTION: FindWindowExA
-! FUNCTION: FindWindowExW
-! FUNCTION: FindWindowW
-! FUNCTION: FlashWindow
-! FUNCTION: FlashWindowEx
-! FUNCTION: FrameRect
-! FUNCTION: FreeDDElParam
-! FUNCTION: GetActiveWindow
-! FUNCTION: GetAltTabInfo
-! FUNCTION: GetAltTabInfoA
-! FUNCTION: GetAltTabInfoW
-! FUNCTION: GetAncestor
-! FUNCTION: GetAppCompatFlags
-! FUNCTION: GetAppCompatFlags2
-! FUNCTION: GetAsyncKeyState
-FUNCTION: HWND GetCapture ( ) ;
-! FUNCTION: GetCaretBlinkTime
-! FUNCTION: GetCaretPos
-FUNCTION: BOOL GetClassInfoA ( HINSTANCE hInst, LPCTSTR lpszClass, LPWNDCLASS lpwcx ) ;
-FUNCTION: BOOL GetClassInfoW ( HINSTANCE hInst, LPCWSTR lpszClass, LPWNDCLASS lpwcx ) ;
-: GetClassInfo \ GetClassInfoW \ GetClassInfoA unicode-exec ;
-
-FUNCTION: BOOL GetClassInfoExA ( HINSTANCE hInst, LPCTSTR lpszClass, LPWNDCLASSEX lpwcx ) ;
-FUNCTION: BOOL GetClassInfoExW ( HINSTANCE hInst, LPCWSTR lpszClass, LPWNDCLASSEX lpwcx ) ;
-: GetClassInfoEx \ GetClassInfoExW \ GetClassInfoExA unicode-exec ;
-
-FUNCTION: ULONG_PTR GetClassLongA ( HWND hWnd, int nIndex ) ;
-FUNCTION: ULONG_PTR GetClassLongW ( HWND hWnd, int nIndex ) ;
-: GetClassLong \ GetClassLongW \ GetClassLongA unicode-exec ;
-: GetClassLongPtr \ GetClassLongW \ GetClassLongA unicode-exec ;
-
-
-! FUNCTION: GetClassNameA
-! FUNCTION: GetClassNameW
-! FUNCTION: GetClassWord
-! FUNCTION: BOOL GetClientRect ( HWND hWnd, LPRECT lpRect ) ;
-
-FUNCTION: HANDLE GetClipboardData ( UINT uFormat ) ;
-
-! FUNCTION: GetClipboardFormatNameA
-! FUNCTION: GetClipboardFormatNameW
-FUNCTION: HWND GetClipboardOwner ( ) ;
-FUNCTION: DWORD GetClipboardSequenceNumber ( ) ;
-! FUNCTION: GetClipboardViewer
-! FUNCTION: GetClipCursor
-! FUNCTION: GetComboBoxInfo
-! FUNCTION: GetCursor
-! FUNCTION: GetCursorFrameInfo
-! FUNCTION: GetCursorInfo
-! FUNCTION: GetCursorPos
-FUNCTION: HDC GetDC ( HWND hWnd ) ;
-FUNCTION: HDC GetDCEx ( HWND hWnd, HRGN hrgnClip, DWORD flags ) ;
-! FUNCTION: GetDesktopWindow
-! FUNCTION: GetDialogBaseUnits
-! FUNCTION: GetDlgCtrlID
-! FUNCTION: GetDlgItem
-! FUNCTION: GetDlgItemInt
-! FUNCTION: GetDlgItemTextA
-! FUNCTION: GetDlgItemTextW
-FUNCTION: uint GetDoubleClickTime ( ) ;
-FUNCTION: HWND GetFocus ( ) ;
-! FUNCTION: GetForegroundWindow
-! FUNCTION: GetGuiResources
-! FUNCTION: GetGUIThreadInfo
-! FUNCTION: GetIconInfo
-! FUNCTION: GetInputDesktop
-! FUNCTION: GetInputState
-! FUNCTION: GetInternalWindowPos
-! FUNCTION: GetKBCodePage
-! FUNCTION: GetKeyboardLayout
-! FUNCTION: GetKeyboardLayoutList
-! FUNCTION: GetKeyboardLayoutNameA
-! FUNCTION: GetKeyboardLayoutNameW
-! FUNCTION: GetKeyboardState
-! FUNCTION: GetKeyboardType
-! FUNCTION: GetKeyNameTextA
-! FUNCTION: GetKeyNameTextW
-FUNCTION: SHORT GetKeyState ( int nVirtKey ) ;
-! FUNCTION: GetLastActivePopup
-! FUNCTION: GetLastInputInfo
-! FUNCTION: GetLayeredWindowAttributes
-! FUNCTION: GetListBoxInfo
-! FUNCTION: GetMenu
-! FUNCTION: GetMenuBarInfo
-! FUNCTION: GetMenuCheckMarkDimensions
-! FUNCTION: GetMenuContextHelpId
-! FUNCTION: GetMenuDefaultItem
-! FUNCTION: GetMenuInfo
-! FUNCTION: GetMenuItemCount
-! FUNCTION: GetMenuItemID
-! FUNCTION: GetMenuItemInfoA
-! FUNCTION: GetMenuItemInfoW
-! FUNCTION: GetMenuItemRect
-! FUNCTION: GetMenuState
-! FUNCTION: GetMenuStringA
-! FUNCTION: GetMenuStringW
-
-FUNCTION: BOOL GetMessageA ( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) ;
-FUNCTION: BOOL GetMessageW ( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) ;
-: GetMessage \ GetMessageW \ GetMessageA unicode-exec ;
-
-! FUNCTION: GetMessageExtraInfo
-! FUNCTION: GetMessagePos
-! FUNCTION: GetMessageTime
-! FUNCTION: GetMonitorInfoA
-! FUNCTION: GetMonitorInfoW
-! FUNCTION: GetMouseMovePointsEx
-! FUNCTION: GetNextDlgGroupItem
-! FUNCTION: GetNextDlgTabItem
-! FUNCTION: GetOpenClipboardWindow
-FUNCTION: HWND GetParent ( HWND hWnd ) ;
-FUNCTION: int GetPriorityClipboardFormat ( UINT* paFormatPriorityList, int cFormats ) ;
-! FUNCTION: GetProcessDefaultLayout
-! FUNCTION: GetProcessWindowStation
-! FUNCTION: GetProgmanWindow
-! FUNCTION: GetPropA
-! FUNCTION: GetPropW
-! FUNCTION: GetQueueStatus
-! FUNCTION: GetRawInputBuffer
-! FUNCTION: GetRawInputData
-! FUNCTION: GetRawInputDeviceInfoA
-! FUNCTION: GetRawInputDeviceInfoW
-! FUNCTION: GetRawInputDeviceList
-! FUNCTION: GetReasonTitleFromReasonCode
-! FUNCTION: GetRegisteredRawInputDevices
-! FUNCTION: GetScrollBarInfo
-! FUNCTION: GetScrollInfo
-! FUNCTION: GetScrollPos
-! FUNCTION: GetScrollRange
-! FUNCTION: GetShellWindow
-! FUNCTION: GetSubMenu
-! FUNCTION: GetSysColor
-FUNCTION: HBRUSH GetSysColorBrush ( int nIndex ) ;
-! FUNCTION: GetSystemMenu
-! FUNCTION: GetSystemMetrics
-! FUNCTION: GetTabbedTextExtentA
-! FUNCTION: GetTabbedTextExtentW
-! FUNCTION: GetTaskmanWindow
-! FUNCTION: GetThreadDesktop
-! FUNCTION: GetTitleBarInfo
-
-
-FUNCTION: HWND GetTopWindow ( HWND hWnd ) ;
-! FUNCTION: BOOL GetUpdateRect ( HWND hWnd, LPRECT lpRect, BOOL bErase ) ;
-FUNCTION: int GetUpdateRgn ( HWND hWnd, HRGN hRgn, BOOL bErase ) ;
-
-
-! FUNCTION: GetUserObjectInformationA
-! FUNCTION: GetUserObjectInformationW
-! FUNCTION: GetUserObjectSecurity
-FUNCTION: HWND GetWindow ( HWND hWnd, UINT uCmd ) ;
-! FUNCTION: GetWindowContextHelpId
-! FUNCTION: GetWindowDC
-! FUNCTION: GetWindowInfo
-! FUNCTION: GetWindowLongA
-! FUNCTION: GetWindowLongW
-! FUNCTION: GetWindowModuleFileName
-! FUNCTION: GetWindowModuleFileNameA
-! FUNCTION: GetWindowModuleFileNameW
-! FUNCTION: GetWindowPlacement
-! FUNCTION: BOOL GetWindowRect ( HWND hWnd, LPRECT lpRect ) ;
-! FUNCTION: GetWindowRgn
-! FUNCTION: GetWindowRgnBox
-! FUNCTION: GetWindowTextA
-! FUNCTION: GetWindowTextLengthA
-! FUNCTION: GetWindowTextLengthW
-! FUNCTION: GetWindowTextW
-! FUNCTION: GetWindowThreadProcessId
-! FUNCTION: GetWindowWord
-! FUNCTION: GetWinStationInfo
-! FUNCTION: GrayStringA
-! FUNCTION: GrayStringW
-! FUNCTION: HideCaret
-! FUNCTION: HiliteMenuItem
-! FUNCTION: ImpersonateDdeClientWindow
-! FUNCTION: IMPGetIMEA
-! FUNCTION: IMPGetIMEW
-! FUNCTION: IMPQueryIMEA
-! FUNCTION: IMPQueryIMEW
-! FUNCTION: IMPSetIMEA
-! FUNCTION: IMPSetIMEW
-! FUNCTION: InflateRect
-! FUNCTION: InitializeLpkHooks
-! FUNCTION: InitializeWin32EntryTable
-! FUNCTION: InSendMessage
-! FUNCTION: InSendMessageEx
-! FUNCTION: InsertMenuA
-! FUNCTION: InsertMenuItemA
-! FUNCTION: InsertMenuItemW
-! FUNCTION: InsertMenuW
-! FUNCTION: InternalGetWindowText
-! FUNCTION: IntersectRect
-! FUNCTION: InvalidateRect
-! FUNCTION: InvalidateRgn
-! FUNCTION: InvertRect
-! FUNCTION: IsCharAlphaA
-! FUNCTION: IsCharAlphaNumericA
-! FUNCTION: IsCharAlphaNumericW
-! FUNCTION: IsCharAlphaW
-! FUNCTION: IsCharLowerA
-! FUNCTION: IsCharLowerW
-! FUNCTION: IsCharUpperA
-! FUNCTION: IsCharUpperW
-FUNCTION: BOOL IsChild ( HWND hWndParent, HWND hWnd ) ;
-FUNCTION: BOOL IsClipboardFormatAvailable ( UINT format ) ;
-! FUNCTION: IsDialogMessage
-! FUNCTION: IsDialogMessageA
-! FUNCTION: IsDialogMessageW
-! FUNCTION: IsDlgButtonChecked
-FUNCTION: BOOL IsGUIThread ( BOOL bConvert ) ;
-FUNCTION: BOOL IsHungAppWindow ( HWND hWnd ) ;
-FUNCTION: BOOL IsIconic ( HWND hWnd ) ;
-FUNCTION: BOOL IsMenu ( HMENU hMenu ) ;
-! FUNCTION: BOOL IsRectEmpty
-! FUNCTION: BOOL IsServerSideWindow
-FUNCTION: BOOL IsWindow ( HWND hWnd ) ;
-! FUNCTION: BOOL IsWindowEnabled
-! FUNCTION: BOOL IsWindowInDestroy
-FUNCTION: BOOL IsWindowUnicode ( HWND hWnd ) ;
-FUNCTION: BOOL IsWindowVisible ( HWND hWnd ) ;
-! FUNCTION: BOOL IsWinEventHookInstalled
-FUNCTION: BOOL IsZoomed ( HWND hWnd ) ;
-! FUNCTION: keybd_event
-! FUNCTION: KillSystemTimer
-! FUNCTION: KillTimer
-! FUNCTION: LoadAcceleratorsA
-! FUNCTION: LoadAcceleratorsW
-! FUNCTION: LoadBitmapA
-! FUNCTION: LoadBitmapW
-! FUNCTION: LoadCursorFromFileA
-! FUNCTION: LoadCursorFromFileW
-
-
-! FUNCTION: HCURSOR LoadCursorA ( HINSTANCE hInstance, LPCTSTR lpCursorName ) ;
-! FUNCTION: HCURSOR LoadCursorW ( HINSTANCE hInstance, LPCWSTR lpCursorName ) ;
-FUNCTION: HCURSOR LoadCursorA ( HINSTANCE hInstance, ushort lpCursorName ) ;
-FUNCTION: HCURSOR LoadCursorW ( HINSTANCE hInstance, ushort lpCursorName ) ;
-: LoadCursor \ LoadCursorW \ LoadCursorA unicode-exec ;
-
-! FUNCTION: HICON LoadIconA ( HINSTANCE hInstance, LPCTSTR lpIconName ) ;
-! FUNCTION: HICON LoadIconW ( HINSTANCE hInstance, LPCWSTR lpIconName ) ;
-FUNCTION: HICON LoadIconA ( HINSTANCE hInstance, ushort lpIconName ) ;
-FUNCTION: HICON LoadIconW ( HINSTANCE hInstance, ushort lpIconName ) ;
-: LoadIcon \ LoadIconW \ LoadIconA unicode-exec ;
-
-! FUNCTION: LoadImageA
-! FUNCTION: LoadImageW
-! FUNCTION: LoadKeyboardLayoutA
-! FUNCTION: LoadKeyboardLayoutEx
-! FUNCTION: LoadKeyboardLayoutW
-! FUNCTION: LoadLocalFonts
-! FUNCTION: LoadMenuA
-! FUNCTION: LoadMenuIndirectA
-! FUNCTION: LoadMenuIndirectW
-! FUNCTION: LoadMenuW
-! FUNCTION: LoadRemoteFonts
-! FUNCTION: LoadStringA
-! FUNCTION: LoadStringW
-! FUNCTION: LockSetForegroundWindow
-! FUNCTION: LockWindowStation
-! FUNCTION: LockWindowUpdate
-! FUNCTION: LockWorkStation
-! FUNCTION: LookupIconIdFromDirectory
-! FUNCTION: LookupIconIdFromDirectoryEx
-! FUNCTION: MapDialogRect
-! FUNCTION: MapVirtualKeyA
-! FUNCTION: MapVirtualKeyExA
-! FUNCTION: MapVirtualKeyExW
-! FUNCTION: MapVirtualKeyW
-! FUNCTION: MapWindowPoints
-! FUNCTION: MB_GetString
-! FUNCTION: MBToWCSEx
-! FUNCTION: MenuItemFromPoint
-! FUNCTION: MenuWindowProcA
-! FUNCTION: MenuWindowProcW
-
-
-: MB_ICONASTERISK    HEX: 00000040 ;
-: MB_ICONEXCLAMATION HEX: 00000030 ;
-: MB_ICONHAND        HEX: 00000010 ;
-: MB_ICONQUESTION    HEX: 00000020 ;
-: MB_OK              HEX: 00000000 ;
-! -1 is Simple beep
-FUNCTION: BOOL MessageBeep ( UINT uType ) ;
-
-FUNCTION: int MessageBoxA ( 
-                HWND hWnd,
-                LPCSTR lpText,
-                LPCSTR lpCaption,
-                UINT uType ) ;
-
-FUNCTION: int MessageBoxW (
-                HWND hWnd,
-                LPCWSTR lpText,
-                LPCWSTR lpCaption,
-                UINT uType) ;
-
-FUNCTION: int MessageBoxExA ( HWND hWnd,
-                LPCSTR lpText,
-                LPCSTR lpCaption,
-                UINT uType,
-                WORD wLanguageId
-                ) ;
-
-FUNCTION: int MessageBoxExW (
-                HWND hWnd,
-                LPCWSTR lpText,
-                LPCWSTR lpCaption,
-                UINT uType,
-                WORD wLanguageId ) ;
-
-! FUNCTION: int MessageBoxIndirectA ( MSGBOXPARAMSA* params ) ;
-! FUNCTION: int MessageBoxIndirectW ( MSGBOXPARAMSW* params ) ;
-
-
-: MessageBox
-    \ MessageBoxW \ MessageBoxA unicode-exec ;
-
-: MessageBoxEx
-    \ MessageBoxExW \ MessageBoxExA unicode-exec ;
-
-! : MessageBoxIndirect
-    ! \ MessageBoxIndirectW \ MessageBoxIndirectA unicode-exec ;
-
-! FUNCTION: MessageBoxTimeoutA ! dllexported, not in header
-! FUNCTION: MessageBoxTimeoutW ! dllexported, not in header
-
-! FUNCTION: ModifyMenuA
-! FUNCTION: ModifyMenuW
-! FUNCTION: MonitorFromPoint
-! FUNCTION: MonitorFromRect
-! FUNCTION: MonitorFromWindow
-! FUNCTION: mouse_event
-
-
-
-FUNCTION: BOOL MoveWindow (
-    HWND hWnd,
-    int X,
-    int Y,
-    int nWidth,
-    int nHeight,
-    BOOL bRepaint ) ;
-
-
-! FUNCTION: MsgWaitForMultipleObjects
-! FUNCTION: MsgWaitForMultipleObjectsEx
-! FUNCTION: NotifyWinEvent
-! FUNCTION: OemKeyScan
-! FUNCTION: OemToCharA
-! FUNCTION: OemToCharBuffA
-! FUNCTION: OemToCharBuffW
-! FUNCTION: OemToCharW
-! FUNCTION: OffsetRect
-FUNCTION: BOOL OpenClipboard ( HWND hWndNewOwner ) ;
-! FUNCTION: OpenDesktopA
-! FUNCTION: OpenDesktopW
-! FUNCTION: OpenIcon
-! FUNCTION: OpenInputDesktop
-! FUNCTION: OpenWindowStationA
-! FUNCTION: OpenWindowStationW
-! FUNCTION: PackDDElParam
-! FUNCTION: PaintDesktop
-! FUNCTION: PaintMenuBar
-FUNCTION: BOOL PeekMessageA ( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) ;
-FUNCTION: BOOL PeekMessageW ( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) ;
-: PeekMessage \ PeekMessageW \ PeekMessageA unicode-exec ;
-
-! FUNCTION: PostMessageA
-! FUNCTION: PostMessageW
-FUNCTION: void PostQuitMessage ( int nExitCode ) ;
-! FUNCTION: PostThreadMessageA
-! FUNCTION: PostThreadMessageW
-! FUNCTION: PrintWindow
-! FUNCTION: PrivateExtractIconExA
-! FUNCTION: PrivateExtractIconExW
-! FUNCTION: PrivateExtractIconsA
-! FUNCTION: PrivateExtractIconsW
-! FUNCTION: PrivateSetDbgTag
-! FUNCTION: PrivateSetRipFlags
-! FUNCTION: PtInRect
-! FUNCTION: QuerySendMessage
-! FUNCTION: QueryUserCounters
-! FUNCTION: RealChildWindowFromPoint
-! FUNCTION: RealGetWindowClass
-! FUNCTION: RealGetWindowClassA
-! FUNCTION: RealGetWindowClassW
-! FUNCTION: ReasonCodeNeedsBugID
-! FUNCTION: ReasonCodeNeedsComment
-! FUNCTION: RecordShutdownReason
-! FUNCTION: RedrawWindow
-
-FUNCTION: ATOM RegisterClassA ( WNDCLASS* lpWndClass) ;
-FUNCTION: ATOM RegisterClassW ( WNDCLASS* lpWndClass ) ;
-FUNCTION: ATOM RegisterClassExA ( WNDCLASSEX* lpwcx ) ;
-FUNCTION: ATOM RegisterClassExW ( WNDCLASSEX* lpwcx ) ;
-
-: RegisterClass \ RegisterClassW \ RegisterClassA unicode-exec ;
-: RegisterClassEx \ RegisterClassExW \ RegisterClassExA unicode-exec ;
-
-! FUNCTION: RegisterClipboardFormatA
-! FUNCTION: RegisterClipboardFormatW
-! FUNCTION: RegisterDeviceNotificationA
-! FUNCTION: RegisterDeviceNotificationW
-! FUNCTION: RegisterHotKey
-! FUNCTION: RegisterLogonProcess
-! FUNCTION: RegisterMessagePumpHook
-! FUNCTION: RegisterRawInputDevices
-! FUNCTION: RegisterServicesProcess
-! FUNCTION: RegisterShellHookWindow
-! FUNCTION: RegisterSystemThread
-! FUNCTION: RegisterTasklist
-! FUNCTION: RegisterUserApiHook
-! FUNCTION: RegisterWindowMessageA
-! FUNCTION: RegisterWindowMessageW
-FUNCTION: BOOL ReleaseCapture ( ) ;
-FUNCTION: int ReleaseDC ( HWND hWnd, HDC hDC ) ;
-! FUNCTION: RemoveMenu
-! FUNCTION: RemovePropA
-! FUNCTION: RemovePropW
-! FUNCTION: ReplyMessage
-! FUNCTION: ResolveDesktopForWOW
-! FUNCTION: ReuseDDElParam
-! FUNCTION: ScreenToClient
-! FUNCTION: ScrollChildren
-! FUNCTION: ScrollDC
-! FUNCTION: ScrollWindow
-! FUNCTION: ScrollWindowEx
-! FUNCTION: SendDlgItemMessageA
-! FUNCTION: SendDlgItemMessageW
-! FUNCTION: SendIMEMessageExA
-! FUNCTION: SendIMEMessageExW
-! FUNCTION: UINT SendInput ( UINT nInputs, LPINPUT pInputs, int cbSize ) ;
-FUNCTION: LRESULT SendMessageA ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) ;
-FUNCTION: LRESULT SendMessageW ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) ;
-: SendMessage \ SendMessageW \ SendMessageA unicode-exec ;
-! FUNCTION: SendMessageCallbackA
-! FUNCTION: SendMessageCallbackW
-! FUNCTION: SendMessageTimeoutA
-! FUNCTION: SendMessageTimeoutW
-! FUNCTION: SendNotifyMessageA
-! FUNCTION: SendNotifyMessageW
-! FUNCTION: SetActiveWindow
-FUNCTION: HWND SetCapture ( HWND hWnd ) ;
-! FUNCTION: SetCaretBlinkTime
-! FUNCTION: SetCaretPos
-
-FUNCTION: ULONG_PTR SetClassLongW ( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) ;
-FUNCTION: ULONG_PTR SetClassLongA ( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) ;
-: SetClassLongPtr \ SetClassLongW \ SetClassLongA unicode-exec ;
-: SetClassLong \ SetClassLongW \ SetClassLongA unicode-exec ;
-
-! FUNCTION: SetClassWord
-FUNCTION: HANDLE SetClipboardData ( UINT uFormat, HANDLE hMem ) ;
-! FUNCTION: SetClipboardViewer
-! FUNCTION: SetConsoleReserveKeys
-! FUNCTION: SetCursor
-! FUNCTION: SetCursorContents
-! FUNCTION: SetCursorPos
-! FUNCTION: SetDebugErrorLevel
-! FUNCTION: SetDeskWallpaper
-! FUNCTION: SetDlgItemInt
-! FUNCTION: SetDlgItemTextA
-! FUNCTION: SetDlgItemTextW
-! FUNCTION: SetDoubleClickTime
-FUNCTION: HWND SetFocus ( HWND hWnd ) ;
-FUNCTION: BOOL SetForegroundWindow ( HWND hWnd ) ;
-! FUNCTION: SetInternalWindowPos
-! FUNCTION: SetKeyboardState
-! type is ignored
-FUNCTION: void SetLastErrorEx ( DWORD dwErrCode, DWORD dwType ) ; 
-: SetLastError 0 SetLastErrorEx ;
-! FUNCTION: SetLayeredWindowAttributes
-! FUNCTION: SetLogonNotifyWindow
-! FUNCTION: SetMenu
-! FUNCTION: SetMenuContextHelpId
-! FUNCTION: SetMenuDefaultItem
-! FUNCTION: SetMenuInfo
-! FUNCTION: SetMenuItemBitmaps
-! FUNCTION: SetMenuItemInfoA
-! FUNCTION: SetMenuItemInfoW
-! FUNCTION: SetMessageExtraInfo
-! FUNCTION: SetMessageQueue
-! FUNCTION: SetParent
-! FUNCTION: SetProcessDefaultLayout
-! FUNCTION: SetProcessWindowStation
-! FUNCTION: SetProgmanWindow
-! FUNCTION: SetPropA
-! FUNCTION: SetPropW
-! FUNCTION: SetRect
-! FUNCTION: SetRectEmpty
-! FUNCTION: SetScrollInfo
-! FUNCTION: SetScrollPos
-! FUNCTION: SetScrollRange
-! FUNCTION: SetShellWindow
-! FUNCTION: SetShellWindowEx
-! FUNCTION: SetSysColors
-! FUNCTION: SetSysColorsTemp
-! FUNCTION: SetSystemCursor
-! FUNCTION: SetSystemMenu
-! FUNCTION: SetSystemTimer
-! FUNCTION: SetTaskmanWindow
-! FUNCTION: SetThreadDesktop
-! FUNCTION: SetTimer
-! FUNCTION: SetUserObjectInformationA
-! FUNCTION: SetUserObjectInformationW
-! FUNCTION: SetUserObjectSecurity
-! FUNCTION: SetWindowContextHelpId
-! FUNCTION: SetWindowLongA
-! FUNCTION: SetWindowLongW
-! FUNCTION: SetWindowPlacement
-! FUNCTION: SetWindowPos
-! FUNCTION: SetWindowRgn
-! FUNCTION: SetWindowsHookA
-! FUNCTION: SetWindowsHookExA
-! FUNCTION: SetWindowsHookExW
-! FUNCTION: SetWindowsHookW
-! FUNCTION: SetWindowStationUser
-! FUNCTION: SetWindowTextA
-! FUNCTION: SetWindowTextW
-! FUNCTION: SetWindowWord
-! FUNCTION: SetWinEventHook
-! FUNCTION: ShowCaret
-! FUNCTION: ShowCursor
-! FUNCTION: ShowOwnedPopups
-! FUNCTION: ShowScrollBar
-! FUNCTION: ShowStartGlass
-
-FUNCTION: BOOL ShowWindow ( HWND hWnd, int nCmdShow ) ;
-
-! FUNCTION: ShowWindowAsync
-! FUNCTION: SoftModalMessageBox
-! FUNCTION: SubtractRect
-! FUNCTION: SwapMouseButton
-! FUNCTION: SwitchDesktop
-! FUNCTION: SwitchToThisWindow
-! FUNCTION: SystemParametersInfoA
-! FUNCTION: SystemParametersInfoW
-! FUNCTION: TabbedTextOutA
-! FUNCTION: TabbedTextOutW
-! FUNCTION: TileChildWindows
-! FUNCTION: TileWindows
-! FUNCTION: ToAscii
-! FUNCTION: ToAsciiEx
-! FUNCTION: ToUnicode
-! FUNCTION: ToUnicodeEx
-FUNCTION: BOOL TrackMouseEvent ( LPTRACKMOUSEEVENT lpEventTrack ) ;
-! FUNCTION: TrackPopupMenu
-! FUNCTION: TrackPopupMenuEx
-! FUNCTION: TranslateAccelerator
-! FUNCTION: TranslateAcceleratorA
-! FUNCTION: TranslateAcceleratorW
-! FUNCTION: TranslateMDISysAccel
-FUNCTION: BOOL TranslateMessage ( MSG* lpMsg ) ;
-
-! FUNCTION: UnhookWindowsHook
-! FUNCTION: UnhookWindowsHookEx
-! FUNCTION: UnhookWinEvent
-! FUNCTION: UnionRect
-! FUNCTION: UnloadKeyboardLayout
-! FUNCTION: UnlockWindowStation
-! FUNCTION: UnpackDDElParam
-FUNCTION: BOOL UnregisterClassA ( LPCTSTR lpClassName, HINSTANCE hInstance ) ;
-FUNCTION: BOOL UnregisterClassW ( LPCWSTR lpClassName, HINSTANCE hInstance ) ;
-: UnregisterClass \ UnregisterClassW \ UnregisterClassA unicode-exec ;
-! FUNCTION: UnregisterDeviceNotification
-! FUNCTION: UnregisterHotKey
-! FUNCTION: UnregisterMessagePumpHook
-! FUNCTION: UnregisterUserApiHook
-! FUNCTION: UpdateLayeredWindow
-! FUNCTION: UpdatePerUserSystemParameters
-
-
-FUNCTION: BOOL UpdateWindow ( HWND hWnd ) ;
-
-! FUNCTION: User32InitializeImmEntryTable
-! FUNCTION: UserClientDllInitialize
-! FUNCTION: UserHandleGrantAccess
-! FUNCTION: UserLpkPSMTextOut
-! FUNCTION: UserLpkTabbedTextOut
-! FUNCTION: UserRealizePalette
-! FUNCTION: UserRegisterWowHandlers
-! FUNCTION: ValidateRect
-! FUNCTION: ValidateRgn
-! FUNCTION: VkKeyScanA
-! FUNCTION: VkKeyScanExA
-! FUNCTION: VkKeyScanExW
-! FUNCTION: VkKeyScanW
-! FUNCTION: VRipOutput
-! FUNCTION: VTagOutput
-! FUNCTION: WaitForInputIdle
-! FUNCTION: WaitMessage
-! FUNCTION: WCSToMBEx
-! FUNCTION: Win32PoolAllocationStats
-! FUNCTION: WindowFromDC
-! FUNCTION: WindowFromPoint
-! FUNCTION: WinHelpA
-! FUNCTION: WinHelpW
-! FUNCTION: WINNLSEnableIME
-! FUNCTION: WINNLSGetEnableStatus
-! FUNCTION: WINNLSGetIMEHotkey
-! FUNCTION: wsprintfA
-! FUNCTION: wsprintfW
-! FUNCTION: wvsprintfA
-! FUNCTION: wvsprintfW
-
diff --git a/core/windows/utils.factor b/core/windows/utils.factor
deleted file mode 100644 (file)
index 19030f0..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien errors io kernel math namespaces parser prettyprint words ;
-IN: win32-api
-
-! You must LocalFree the return value!
-FUNCTION: void* error_message ( DWORD id ) ;
-
-: win32-error ( -- )
-    GetLastError dup zero? [
-        drop
-    ] [
-        error_message
-        dup alien>char-string
-        swap LocalFree drop
-        throw
-    ] if ;
-
-: win32-error=0 zero? [ win32-error ] when ;
-: win32-error>0 0 > [ win32-error ] when ;
-: win32-error<0 0 < [ win32-error ] when ;
-: win32-error<>0 zero? [ win32-error ] unless ;
-
-: lo-word ( wparam -- lo ) HEX: ffff bitand ;
-: hi-word ( wparam -- hi ) -16 shift ;
-
-: msgbox ( str -- )
-    f swap "DebugMsg" MB_OK MessageBox drop ;
diff --git a/core/windows/windows-messages.factor b/core/windows/windows-messages.factor
deleted file mode 100644 (file)
index c7cc2fa..0000000
+++ /dev/null
@@ -1,1003 +0,0 @@
-! Copyright (C) 2005, 2006 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: hashtables kernel math namespaces parser prettyprint words ;
-IN: win32-api-messages
-
-SYMBOL: windows-messages
-
-: maybe-create-windows-messages
-    windows-messages get hashtable? 
-    [ H{ } clone global [ windows-messages set ] bind ] unless ;
-
-: add-windows-message ( -- )
-    word [ unparse ] keep execute maybe-create-windows-messages
-    windows-messages get set-hash ; parsing
-
-: get-windows-message-name ( n -- name )
-    windows-messages get hash* [ drop "unknown message" ] unless ;
-
-: WM_NULL HEX: 0000 ; inline add-windows-message
-: WM_CREATE HEX: 0001 ; inline add-windows-message
-: WM_DESTROY HEX: 0002 ; inline add-windows-message
-: WM_MOVE HEX: 0003 ; inline add-windows-message
-: WM_SIZE HEX: 0005 ; inline add-windows-message
-: WM_ACTIVATE HEX: 0006 ; inline add-windows-message
-: WM_SETFOCUS HEX: 0007 ; inline add-windows-message
-: WM_KILLFOCUS HEX: 0008 ; inline add-windows-message
-: WM_ENABLE HEX: 000A ; inline add-windows-message
-: WM_SETREDRAW HEX: 000B ; inline add-windows-message
-: WM_SETTEXT HEX: 000C ; inline add-windows-message
-: WM_GETTEXT HEX: 000D ; inline add-windows-message
-: WM_GETTEXTLENGTH HEX: 000E ; inline add-windows-message
-: WM_PAINT HEX: 000F ; inline add-windows-message
-: WM_CLOSE HEX: 0010 ; inline add-windows-message
-: WM_QUERYENDSESSION HEX: 0011 ; inline add-windows-message
-: WM_QUERYOPEN HEX: 0013 ; inline add-windows-message
-: WM_ENDSESSION HEX: 0016 ; inline add-windows-message
-: WM_QUIT HEX: 0012 ; inline add-windows-message
-: WM_ERASEBKGND HEX: 0014 ; inline add-windows-message
-: WM_SYSCOLORCHANGE HEX: 0015 ; inline add-windows-message
-: WM_SHOWWINDOW HEX: 0018 ; inline add-windows-message
-: WM_WININICHANGE HEX: 001A ; inline add-windows-message
-: WM_SETTINGCHANGE HEX: 001A ; inline add-windows-message
-: WM_DEVMODECHANGE HEX: 001B ; inline add-windows-message
-: WM_ACTIVATEAPP HEX: 001C ; inline add-windows-message
-: WM_FONTCHANGE HEX: 001D ; inline add-windows-message
-: WM_TIMECHANGE HEX: 001E ; inline add-windows-message
-: WM_CANCELMODE HEX: 001F ; inline add-windows-message
-: WM_SETCURSOR HEX: 0020 ; inline add-windows-message
-: WM_MOUSEACTIVATE HEX: 0021 ; inline add-windows-message
-: WM_CHILDACTIVATE HEX: 0022 ; inline add-windows-message
-: WM_QUEUESYNC HEX: 0023 ; inline add-windows-message
-: WM_GETMINMAXINFO HEX: 0024 ; inline add-windows-message
-: WM_PAINTICON HEX: 0026 ; inline add-windows-message
-: WM_ICONERASEBKGND HEX: 0027 ; inline add-windows-message
-: WM_NEXTDLGCTL HEX: 0028 ; inline add-windows-message
-: WM_SPOOLERSTATUS HEX: 002A ; inline add-windows-message
-: WM_DRAWITEM HEX: 002B ; inline add-windows-message
-: WM_MEASUREITEM HEX: 002C ; inline add-windows-message
-: WM_DELETEITEM HEX: 002D ; inline add-windows-message
-: WM_VKEYTOITEM HEX: 002E ; inline add-windows-message
-: WM_CHARTOITEM HEX: 002F ; inline add-windows-message
-: WM_SETFONT HEX: 0030 ; inline add-windows-message
-: WM_GETFONT HEX: 0031 ; inline add-windows-message
-: WM_SETHOTKEY HEX: 0032 ; inline add-windows-message
-: WM_GETHOTKEY HEX: 0033 ; inline add-windows-message
-: WM_QUERYDRAGICON HEX: 0037 ; inline add-windows-message
-: WM_COMPAREITEM HEX: 0039 ; inline add-windows-message
-: WM_GETOBJECT HEX: 003D ; inline add-windows-message
-: WM_COMPACTING HEX: 0041 ; inline add-windows-message
-: WM_COMMNOTIFY HEX: 0044 ; inline add-windows-message
-: WM_WINDOWPOSCHANGING HEX: 0046 ; inline add-windows-message
-: WM_WINDOWPOSCHANGED HEX: 0047 ; inline add-windows-message
-: WM_POWER HEX: 0048 ; inline add-windows-message
-: WM_COPYDATA HEX: 004A ; inline add-windows-message
-: WM_CANCELJOURNAL HEX: 004B ; inline add-windows-message
-: WM_NOTIFY HEX: 004E ; inline add-windows-message
-: WM_INPUTLANGCHANGEREQUEST HEX: 0050 ; inline add-windows-message
-: WM_INPUTLANGCHANGE HEX: 0051 ; inline add-windows-message
-: WM_TCARD HEX: 0052 ; inline add-windows-message
-: WM_HELP HEX: 0053 ; inline add-windows-message
-: WM_USERCHANGED HEX: 0054 ; inline add-windows-message
-: WM_NOTIFYFORMAT HEX: 0055 ; inline add-windows-message
-: WM_CONTEXTMENU HEX: 007B ; inline add-windows-message
-: WM_STYLECHANGING HEX: 007C ; inline add-windows-message
-: WM_STYLECHANGED HEX: 007D ; inline add-windows-message
-: WM_DISPLAYCHANGE HEX: 007E ; inline add-windows-message
-: WM_GETICON HEX: 007F ; inline add-windows-message
-: WM_SETICON HEX: 0080 ; inline add-windows-message
-: WM_NCCREATE HEX: 0081 ; inline add-windows-message
-: WM_NCDESTROY HEX: 0082 ; inline add-windows-message
-: WM_NCCALCSIZE HEX: 0083 ; inline add-windows-message
-: WM_NCHITTEST HEX: 0084 ; inline add-windows-message
-: WM_NCPAINT HEX: 0085 ; inline add-windows-message
-: WM_NCACTIVATE HEX: 0086 ; inline add-windows-message
-: WM_GETDLGCODE HEX: 0087 ; inline add-windows-message
-: WM_SYNCPAINT HEX: 0088 ; inline add-windows-message
-: WM_NCMOUSEMOVE HEX: 00A0 ; inline add-windows-message
-: WM_NCLBUTTONDOWN HEX: 00A1 ; inline add-windows-message
-: WM_NCLBUTTONUP HEX: 00A2 ; inline add-windows-message
-: WM_NCLBUTTONDBLCLK HEX: 00A3 ; inline add-windows-message
-: WM_NCRBUTTONDOWN HEX: 00A4 ; inline add-windows-message
-: WM_NCRBUTTONUP HEX: 00A5 ; inline add-windows-message
-: WM_NCRBUTTONDBLCLK HEX: 00A6 ; inline add-windows-message
-: WM_NCMBUTTONDOWN HEX: 00A7 ; inline add-windows-message
-: WM_NCMBUTTONUP HEX: 00A8 ; inline add-windows-message
-: WM_NCMBUTTONDBLCLK HEX: 00A9 ; inline add-windows-message
-: WM_NCXBUTTONDOWN HEX: 00AB ; inline add-windows-message
-: WM_NCXBUTTONUP HEX: 00AC ; inline add-windows-message
-: WM_NCXBUTTONDBLCLK HEX: 00AD ; inline add-windows-message
-: WM_INPUT HEX: 00FF ; inline add-windows-message
-: WM_KEYFIRST HEX: 0100 ; inline add-windows-message
-: WM_KEYDOWN HEX: 0100 ; inline add-windows-message
-: WM_KEYUP HEX: 0101 ; inline add-windows-message
-: WM_CHAR HEX: 0102 ; inline add-windows-message
-: WM_DEADCHAR HEX: 0103 ; inline add-windows-message
-: WM_SYSKEYDOWN HEX: 0104 ; inline add-windows-message
-: WM_SYSKEYUP HEX: 0105 ; inline add-windows-message
-: WM_SYSCHAR HEX: 0106 ; inline add-windows-message
-: WM_SYSDEADCHAR HEX: 0107 ; inline add-windows-message
-: WM_UNICHAR HEX: 0109 ; inline add-windows-message
-: WM_KEYLAST_NT501 HEX: 0109 ; inline add-windows-message
-: UNICODE_NOCHAR HEX: FFFF ; inline add-windows-message
-: WM_KEYLAST_PRE501 HEX: 0108 ; inline add-windows-message
-: WM_IME_STARTCOMPOSITION HEX: 010D ; inline add-windows-message
-: WM_IME_ENDCOMPOSITION HEX: 010E ; inline add-windows-message
-: WM_IME_COMPOSITION HEX: 010F ; inline add-windows-message
-: WM_IME_KEYLAST HEX: 010F ; inline add-windows-message
-: WM_INITDIALOG HEX: 0110 ; inline add-windows-message
-: WM_COMMAND HEX: 0111 ; inline add-windows-message
-: WM_SYSCOMMAND HEX: 0112 ; inline add-windows-message
-: WM_TIMER HEX: 0113 ; inline add-windows-message
-: WM_HSCROLL HEX: 0114 ; inline add-windows-message
-: WM_VSCROLL HEX: 0115 ; inline add-windows-message
-: WM_INITMENU HEX: 0116 ; inline add-windows-message
-: WM_INITMENUPOPUP HEX: 0117 ; inline add-windows-message
-: WM_MENUSELECT HEX: 011F ; inline add-windows-message
-: WM_MENUCHAR HEX: 0120 ; inline add-windows-message
-: WM_ENTERIDLE HEX: 0121 ; inline add-windows-message
-: WM_MENURBUTTONUP HEX: 0122 ; inline add-windows-message
-: WM_MENUDRAG HEX: 0123 ; inline add-windows-message
-: WM_MENUGETOBJECT HEX: 0124 ; inline add-windows-message
-: WM_UNINITMENUPOPUP HEX: 0125 ; inline add-windows-message
-: WM_MENUCOMMAND HEX: 0126 ; inline add-windows-message
-: WM_CHANGEUISTATE HEX: 0127 ; inline add-windows-message
-: WM_UPDATEUISTATE HEX: 0128 ; inline add-windows-message
-: WM_QUERYUISTATE HEX: 0129 ; inline add-windows-message
-: WM_CTLCOLORMSGBOX HEX: 0132 ; inline add-windows-message
-: WM_CTLCOLOREDIT HEX: 0133 ; inline add-windows-message
-: WM_CTLCOLORLISTBOX HEX: 0134 ; inline add-windows-message
-: WM_CTLCOLORBTN HEX: 0135 ; inline add-windows-message
-: WM_CTLCOLORDLG HEX: 0136 ; inline add-windows-message
-: WM_CTLCOLORSCROLLBAR HEX: 0137 ; inline add-windows-message
-: WM_CTLCOLORSTATIC HEX: 0138 ; inline add-windows-message
-: WM_MOUSEFIRST HEX: 0200 ; inline add-windows-message
-: WM_MOUSEMOVE HEX: 0200 ; inline add-windows-message
-: WM_LBUTTONDOWN HEX: 0201 ; inline add-windows-message
-: WM_LBUTTONUP HEX: 0202 ; inline add-windows-message
-: WM_LBUTTONDBLCLK HEX: 0203 ; inline add-windows-message
-: WM_RBUTTONDOWN HEX: 0204 ; inline add-windows-message
-: WM_RBUTTONUP HEX: 0205 ; inline add-windows-message
-: WM_RBUTTONDBLCLK HEX: 0206 ; inline add-windows-message
-: WM_MBUTTONDOWN HEX: 0207 ; inline add-windows-message
-: WM_MBUTTONUP HEX: 0208 ; inline add-windows-message
-: WM_MBUTTONDBLCLK HEX: 0209 ; inline add-windows-message
-: WM_MOUSEWHEEL HEX: 020A ; inline add-windows-message
-: WM_XBUTTONDOWN HEX: 020B ; inline add-windows-message
-: WM_XBUTTONUP HEX: 020C ; inline add-windows-message
-: WM_XBUTTONDBLCLK HEX: 020D ; inline add-windows-message
-: WM_MOUSELAST_5 HEX: 020D ; inline add-windows-message
-: WM_MOUSELAST_4 HEX: 020A ; inline add-windows-message
-: WM_MOUSELAST_PRE_4 HEX: 0209 ; inline add-windows-message
-: WM_PARENTNOTIFY HEX: 0210 ; inline add-windows-message
-: WM_ENTERMENULOOP HEX: 0211 ; inline add-windows-message
-: WM_EXITMENULOOP HEX: 0212 ; inline add-windows-message
-: WM_NEXTMENU HEX: 0213 ; inline add-windows-message
-: WM_SIZING HEX: 0214 ; inline add-windows-message
-: WM_CAPTURECHANGED HEX: 0215 ; inline add-windows-message
-: WM_MOVING HEX: 0216 ; inline add-windows-message
-: WM_POWERBROADCAST HEX: 0218 ; inline add-windows-message
-: WM_DEVICECHANGE HEX: 0219 ; inline add-windows-message
-: WM_MDICREATE HEX: 0220 ; inline add-windows-message
-: WM_MDIDESTROY HEX: 0221 ; inline add-windows-message
-: WM_MDIACTIVATE HEX: 0222 ; inline add-windows-message
-: WM_MDIRESTORE HEX: 0223 ; inline add-windows-message
-: WM_MDINEXT HEX: 0224 ; inline add-windows-message
-: WM_MDIMAXIMIZE HEX: 0225 ; inline add-windows-message
-: WM_MDITILE HEX: 0226 ; inline add-windows-message
-: WM_MDICASCADE HEX: 0227 ; inline add-windows-message
-: WM_MDIICONARRANGE HEX: 0228 ; inline add-windows-message
-: WM_MDIGETACTIVE HEX: 0229 ; inline add-windows-message
-: WM_MDISETMENU HEX: 0230 ; inline add-windows-message
-: WM_ENTERSIZEMOVE HEX: 0231 ; inline add-windows-message
-: WM_EXITSIZEMOVE HEX: 0232 ; inline add-windows-message
-: WM_DROPFILES HEX: 0233 ; inline add-windows-message
-: WM_MDIREFRESHMENU HEX: 0234 ; inline add-windows-message
-: WM_IME_SETCONTEXT HEX: 0281 ; inline add-windows-message
-: WM_IME_NOTIFY HEX: 0282 ; inline add-windows-message
-: WM_IME_CONTROL HEX: 0283 ; inline add-windows-message
-: WM_IME_COMPOSITIONFULL HEX: 0284 ; inline add-windows-message
-: WM_IME_SELECT HEX: 0285 ; inline add-windows-message
-: WM_IME_CHAR HEX: 0286 ; inline add-windows-message
-: WM_IME_REQUEST HEX: 0288 ; inline add-windows-message
-: WM_IME_KEYDOWN HEX: 0290 ; inline add-windows-message
-: WM_IME_KEYUP HEX: 0291 ; inline add-windows-message
-: WM_MOUSEHOVER HEX: 02A1 ; inline add-windows-message
-: WM_MOUSELEAVE HEX: 02A3 ; inline add-windows-message
-: WM_NCMOUSEHOVER HEX: 02A0 ; inline add-windows-message
-: WM_NCMOUSELEAVE HEX: 02A2 ; inline add-windows-message
-: WM_WTSSESSION_CHANGE HEX: 02B1 ; inline add-windows-message
-: WM_TABLET_FIRST HEX: 02c0 ; inline add-windows-message
-: WM_TABLET_LAST HEX: 02df ; inline add-windows-message
-: WM_CUT HEX: 0300 ; inline add-windows-message
-: WM_COPY HEX: 0301 ; inline add-windows-message
-: WM_PASTE HEX: 0302 ; inline add-windows-message
-: WM_CLEAR HEX: 0303 ; inline add-windows-message
-: WM_UNDO HEX: 0304 ; inline add-windows-message
-: WM_RENDERFORMAT HEX: 0305 ; inline add-windows-message
-: WM_RENDERALLFORMATS HEX: 0306 ; inline add-windows-message
-: WM_DESTROYCLIPBOARD HEX: 0307 ; inline add-windows-message
-: WM_DRAWCLIPBOARD HEX: 0308 ; inline add-windows-message
-: WM_PAINTCLIPBOARD HEX: 0309 ; inline add-windows-message
-: WM_VSCROLLCLIPBOARD HEX: 030A ; inline add-windows-message
-: WM_SIZECLIPBOARD HEX: 030B ; inline add-windows-message
-: WM_ASKCBFORMATNAME HEX: 030C ; inline add-windows-message
-: WM_CHANGECBCHAIN HEX: 030D ; inline add-windows-message
-: WM_HSCROLLCLIPBOARD HEX: 030E ; inline add-windows-message
-: WM_QUERYNEWPALETTE HEX: 030F ; inline add-windows-message
-: WM_PALETTEISCHANGING HEX: 0310 ; inline add-windows-message
-: WM_PALETTECHANGED HEX: 0311 ; inline add-windows-message
-: WM_HOTKEY HEX: 0312 ; inline add-windows-message
-: WM_PRINT HEX: 0317 ; inline add-windows-message
-: WM_PRINTCLIENT HEX: 0318 ; inline add-windows-message
-: WM_APPCOMMAND HEX: 0319 ; inline add-windows-message
-: WM_THEMECHANGED HEX: 031A ; inline add-windows-message
-: WM_HANDHELDFIRST HEX: 0358 ; inline add-windows-message
-: WM_HANDHELDLAST HEX: 035F ; inline add-windows-message
-: WM_AFXFIRST HEX: 0360 ; inline add-windows-message
-: WM_AFXLAST HEX: 037F ; inline add-windows-message
-: WM_PENWINFIRST HEX: 0380 ; inline add-windows-message
-: WM_PENWINLAST HEX: 038F ; inline add-windows-message
-: WM_APP HEX: 8000 ; inline add-windows-message
-: WM_USER HEX: 0400 ; inline add-windows-message
-: EM_GETSEL HEX: 00B0 ; inline add-windows-message
-: EM_SETSEL HEX: 00B1 ; inline add-windows-message
-: EM_GETRECT HEX: 00B2 ; inline add-windows-message
-: EM_SETRECT HEX: 00B3 ; inline add-windows-message
-: EM_SETRECTNP HEX: 00B4 ; inline add-windows-message
-: EM_SCROLL HEX: 00B5 ; inline add-windows-message
-: EM_LINESCROLL HEX: 00B6 ; inline add-windows-message
-: EM_SCROLLCARET HEX: 00B7 ; inline add-windows-message
-: EM_GETMODIFY HEX: 00B8 ; inline add-windows-message
-: EM_SETMODIFY HEX: 00B9 ; inline add-windows-message
-: EM_GETLINECOUNT HEX: 00BA ; inline add-windows-message
-: EM_LINEINDEX HEX: 00BB ; inline add-windows-message
-: EM_SETHANDLE HEX: 00BC ; inline add-windows-message
-: EM_GETHANDLE HEX: 00BD ; inline add-windows-message
-: EM_GETTHUMB HEX: 00BE ; inline add-windows-message
-: EM_LINELENGTH HEX: 00C1 ; inline add-windows-message
-: EM_REPLACESEL HEX: 00C2 ; inline add-windows-message
-: EM_GETLINE HEX: 00C4 ; inline add-windows-message
-: EM_LIMITTEXT HEX: 00C5 ; inline add-windows-message
-: EM_CANUNDO HEX: 00C6 ; inline add-windows-message
-: EM_UNDO HEX: 00C7 ; inline add-windows-message
-: EM_FMTLINES HEX: 00C8 ; inline add-windows-message
-: EM_LINEFROMCHAR HEX: 00C9 ; inline add-windows-message
-: EM_SETTABSTOPS HEX: 00CB ; inline add-windows-message
-: EM_SETPASSWORDCHAR HEX: 00CC ; inline add-windows-message
-: EM_EMPTYUNDOBUFFER HEX: 00CD ; inline add-windows-message
-: EM_GETFIRSTVISIBLELINE HEX: 00CE ; inline add-windows-message
-: EM_SETREADONLY HEX: 00CF ; inline add-windows-message
-: EM_SETWORDBREAKPROC HEX: 00D0 ; inline add-windows-message
-: EM_GETWORDBREAKPROC HEX: 00D1 ; inline add-windows-message
-: EM_GETPASSWORDCHAR HEX: 00D2 ; inline add-windows-message
-: EM_SETMARGINS HEX: 00D3 ; inline add-windows-message
-: EM_GETMARGINS HEX: 00D4 ; inline add-windows-message
-: EM_SETLIMITTEXT EM_LIMITTEXT ; inline add-windows-message
-: EM_GETLIMITTEXT HEX: 00D5 ; inline add-windows-message
-: EM_POSFROMCHAR HEX: 00D6 ; inline add-windows-message
-: EM_CHARFROMPOS HEX: 00D7 ; inline add-windows-message
-: EM_SETIMESTATUS HEX: 00D8 ; inline add-windows-message
-: EM_GETIMESTATUS HEX: 00D9 ; inline add-windows-message
-: BM_GETCHECK HEX: 00F0 ; inline add-windows-message
-: BM_SETCHECK HEX: 00F1 ; inline add-windows-message
-: BM_GETSTATE HEX: 00F2 ; inline add-windows-message
-: BM_SETSTATE HEX: 00F3 ; inline add-windows-message
-: BM_SETSTYLE HEX: 00F4 ; inline add-windows-message
-: BM_CLICK HEX: 00F5 ; inline add-windows-message
-: BM_GETIMAGE HEX: 00F6 ; inline add-windows-message
-: BM_SETIMAGE HEX: 00F7 ; inline add-windows-message
-: STM_SETICON HEX: 0170 ; inline add-windows-message
-: STM_GETICON HEX: 0171 ; inline add-windows-message
-: STM_SETIMAGE HEX: 0172 ; inline add-windows-message
-: STM_GETIMAGE HEX: 0173 ; inline add-windows-message
-: STM_MSGMAX HEX: 0174 ; inline add-windows-message
-: DM_GETDEFID WM_USER ; inline add-windows-message
-: DM_SETDEFID  WM_USER 1 + ; inline add-windows-message
-: DM_REPOSITION WM_USER 2 + ; inline add-windows-message
-: LB_ADDSTRING HEX: 0180 ; inline add-windows-message
-: LB_INSERTSTRING HEX: 0181 ; inline add-windows-message
-: LB_DELETESTRING HEX: 0182 ; inline add-windows-message
-: LB_SELITEMRANGEEX HEX: 0183 ; inline add-windows-message
-: LB_RESETCONTENT HEX: 0184 ; inline add-windows-message
-: LB_SETSEL HEX: 0185 ; inline add-windows-message
-: LB_SETCURSEL HEX: 0186 ; inline add-windows-message
-: LB_GETSEL HEX: 0187 ; inline add-windows-message
-: LB_GETCURSEL HEX: 0188 ; inline add-windows-message
-: LB_GETTEXT HEX: 0189 ; inline add-windows-message
-: LB_GETTEXTLEN HEX: 018A ; inline add-windows-message
-: LB_GETCOUNT HEX: 018B ; inline add-windows-message
-: LB_SELECTSTRING HEX: 018C ; inline add-windows-message
-: LB_DIR HEX: 018D ; inline add-windows-message
-: LB_GETTOPINDEX HEX: 018E ; inline add-windows-message
-: LB_FINDSTRING HEX: 018F ; inline add-windows-message
-: LB_GETSELCOUNT HEX: 0190 ; inline add-windows-message
-: LB_GETSELITEMS HEX: 0191 ; inline add-windows-message
-: LB_SETTABSTOPS HEX: 0192 ; inline add-windows-message
-: LB_GETHORIZONTALEXTENT HEX: 0193 ; inline add-windows-message
-: LB_SETHORIZONTALEXTENT HEX: 0194 ; inline add-windows-message
-: LB_SETCOLUMNWIDTH HEX: 0195 ; inline add-windows-message
-: LB_ADDFILE HEX: 0196 ; inline add-windows-message
-: LB_SETTOPINDEX HEX: 0197 ; inline add-windows-message
-: LB_GETITEMRECT HEX: 0198 ; inline add-windows-message
-: LB_GETITEMDATA HEX: 0199 ; inline add-windows-message
-: LB_SETITEMDATA HEX: 019A ; inline add-windows-message
-: LB_SELITEMRANGE HEX: 019B ; inline add-windows-message
-: LB_SETANCHORINDEX HEX: 019C ; inline add-windows-message
-: LB_GETANCHORINDEX HEX: 019D ; inline add-windows-message
-: LB_SETCARETINDEX HEX: 019E ; inline add-windows-message
-: LB_GETCARETINDEX HEX: 019F ; inline add-windows-message
-: LB_SETITEMHEIGHT HEX: 01A0 ; inline add-windows-message
-: LB_GETITEMHEIGHT HEX: 01A1 ; inline add-windows-message
-: LB_FINDSTRINGEXACT HEX: 01A2 ; inline add-windows-message
-: LB_SETLOCALE HEX: 01A5 ; inline add-windows-message
-: LB_GETLOCALE HEX: 01A6 ; inline add-windows-message
-: LB_SETCOUNT HEX: 01A7 ; inline add-windows-message
-: LB_INITSTORAGE HEX: 01A8 ; inline add-windows-message
-: LB_ITEMFROMPOINT HEX: 01A9 ; inline add-windows-message
-: LB_MULTIPLEADDSTRING HEX: 01B1 ; inline add-windows-message
-: LB_GETLISTBOXINFO HEX: 01B2 ; inline add-windows-message
-: LB_MSGMAX_501 HEX: 01B3 ; inline add-windows-message
-: LB_MSGMAX_WCE4 HEX: 01B1 ; inline add-windows-message
-: LB_MSGMAX_4 HEX: 01B0 ; inline add-windows-message
-: LB_MSGMAX_PRE4 HEX: 01A8 ; inline add-windows-message
-: CB_GETEDITSEL HEX: 0140 ; inline add-windows-message
-: CB_LIMITTEXT HEX: 0141 ; inline add-windows-message
-: CB_SETEDITSEL HEX: 0142 ; inline add-windows-message
-: CB_ADDSTRING HEX: 0143 ; inline add-windows-message
-: CB_DELETESTRING HEX: 0144 ; inline add-windows-message
-: CB_DIR HEX: 0145 ; inline add-windows-message
-: CB_GETCOUNT HEX: 0146 ; inline add-windows-message
-: CB_GETCURSEL HEX: 0147 ; inline add-windows-message
-: CB_GETLBTEXT HEX: 0148 ; inline add-windows-message
-: CB_GETLBTEXTLEN HEX: 0149 ; inline add-windows-message
-: CB_INSERTSTRING HEX: 014A ; inline add-windows-message
-: CB_RESETCONTENT HEX: 014B ; inline add-windows-message
-: CB_FINDSTRING HEX: 014C ; inline add-windows-message
-: CB_SELECTSTRING HEX: 014D ; inline add-windows-message
-: CB_SETCURSEL HEX: 014E ; inline add-windows-message
-: CB_SHOWDROPDOWN HEX: 014F ; inline add-windows-message
-: CB_GETITEMDATA HEX: 0150 ; inline add-windows-message
-: CB_SETITEMDATA HEX: 0151 ; inline add-windows-message
-: CB_GETDROPPEDCONTROLRECT HEX: 0152 ; inline add-windows-message
-: CB_SETITEMHEIGHT HEX: 0153 ; inline add-windows-message
-: CB_GETITEMHEIGHT HEX: 0154 ; inline add-windows-message
-: CB_SETEXTENDEDUI HEX: 0155 ; inline add-windows-message
-: CB_GETEXTENDEDUI HEX: 0156 ; inline add-windows-message
-: CB_GETDROPPEDSTATE HEX: 0157 ; inline add-windows-message
-: CB_FINDSTRINGEXACT HEX: 0158 ; inline add-windows-message
-: CB_SETLOCALE HEX: 0159 ; inline add-windows-message
-: CB_GETLOCALE HEX: 015A ; inline add-windows-message
-: CB_GETTOPINDEX HEX: 015B ; inline add-windows-message
-: CB_SETTOPINDEX HEX: 015C ; inline add-windows-message
-: CB_GETHORIZONTALEXTENT HEX: 015d ; inline add-windows-message
-: CB_SETHORIZONTALEXTENT HEX: 015e ; inline add-windows-message
-: CB_GETDROPPEDWIDTH HEX: 015f ; inline add-windows-message
-: CB_SETDROPPEDWIDTH HEX: 0160 ; inline add-windows-message
-: CB_INITSTORAGE HEX: 0161 ; inline add-windows-message
-: CB_MULTIPLEADDSTRING HEX: 0163 ; inline add-windows-message
-: CB_GETCOMBOBOXINFO HEX: 0164 ; inline add-windows-message
-: CB_MSGMAX_501 HEX: 0165 ; inline add-windows-message
-: CB_MSGMAX_WCE400 HEX: 0163 ; inline add-windows-message
-: CB_MSGMAX_400 HEX: 0162 ; inline add-windows-message
-: CB_MSGMAX_PRE400 HEX: 015B ; inline add-windows-message
-: SBM_SETPOS HEX: 00E0 ; inline add-windows-message 
-: SBM_GETPOS HEX: 00E1 ; inline add-windows-message 
-: SBM_SETRANGE HEX: 00E2 ; inline add-windows-message 
-: SBM_SETRANGEREDRAW HEX: 00E6 ; inline add-windows-message
-: SBM_GETRANGE HEX: 00E3 ; inline add-windows-message
-: SBM_ENABLE_ARROWS HEX: 00E4 ; inline add-windows-message
-: SBM_SETSCROLLINFO HEX: 00E9 ; inline add-windows-message
-: SBM_GETSCROLLINFO HEX: 00EA ; inline add-windows-message
-: SBM_GETSCROLLBARINFO HEX: 00EB ; inline add-windows-message
-: LVM_FIRST HEX: 1000 ; inline add-windows-message ! ListView messages
-: TV_FIRST HEX: 1100 ; inline add-windows-message ! TreeView messages
-: HDM_FIRST HEX: 1200 ; inline add-windows-message ! Header messages
-: TCM_FIRST HEX: 1300 ; inline add-windows-message ! Tab control messages
-: PGM_FIRST HEX: 1400 ; inline add-windows-message ! Pager control messages
-: ECM_FIRST HEX: 1500 ; inline add-windows-message ! Edit control messages
-: BCM_FIRST HEX: 1600 ; inline add-windows-message ! Button control messages
-: CBM_FIRST HEX: 1700 ; inline add-windows-message ! Combobox control messages
-: CCM_FIRST HEX: 2000 ; inline add-windows-message ! Common control shared messages
-: CCM_LAST CCM_FIRST HEX: 0200 + ; inline add-windows-message
-: CCM_SETBKCOLOR CCM_FIRST  1 +  ; inline add-windows-message
-: CCM_SETCOLORSCHEME CCM_FIRST  2 +  ; inline add-windows-message
-: CCM_GETCOLORSCHEME CCM_FIRST  3 +  ; inline add-windows-message
-: CCM_GETDROPTARGET CCM_FIRST  4 +  ; inline add-windows-message
-: CCM_SETUNICODEFORMAT CCM_FIRST  5 +  ; inline add-windows-message
-: CCM_GETUNICODEFORMAT CCM_FIRST  6 +  ; inline add-windows-message
-: CCM_SETVERSION CCM_FIRST  7 +  ; inline add-windows-message
-: CCM_GETVERSION CCM_FIRST  8 +  ; inline add-windows-message
-: CCM_SETNOTIFYWINDOW CCM_FIRST  9 +  ; inline add-windows-message
-: CCM_SETWINDOWTHEME CCM_FIRST  HEX: b +  ; inline add-windows-message
-: CCM_DPISCALE CCM_FIRST  HEX: c +  ; inline add-windows-message
-: HDM_GETITEMCOUNT HDM_FIRST  0 +  ; inline add-windows-message
-: HDM_INSERTITEMA HDM_FIRST  1 +  ; inline add-windows-message
-: HDM_INSERTITEMW HDM_FIRST  10 +  ; inline add-windows-message
-: HDM_DELETEITEM HDM_FIRST  2 +  ; inline add-windows-message
-: HDM_GETITEMA HDM_FIRST  3 +  ; inline add-windows-message
-: HDM_GETITEMW HDM_FIRST  11 +  ; inline add-windows-message
-: HDM_SETITEMA HDM_FIRST  4 +  ; inline add-windows-message
-: HDM_SETITEMW HDM_FIRST  12 +  ; inline add-windows-message
-: HDM_LAYOUT HDM_FIRST  5 +  ; inline add-windows-message
-: HDM_HITTEST HDM_FIRST  6 +  ; inline add-windows-message
-: HDM_GETITEMRECT HDM_FIRST  7 +  ; inline add-windows-message
-: HDM_SETIMAGELIST HDM_FIRST  8 +  ; inline add-windows-message
-: HDM_GETIMAGELIST HDM_FIRST  9 +  ; inline add-windows-message
-: HDM_ORDERTOINDEX HDM_FIRST  15 +  ; inline add-windows-message
-: HDM_CREATEDRAGIMAGE HDM_FIRST  16 +  ; inline add-windows-message
-: HDM_GETORDERARRAY HDM_FIRST  17 +  ; inline add-windows-message
-: HDM_SETORDERARRAY HDM_FIRST  18 +  ; inline add-windows-message
-: HDM_SETHOTDIVIDER HDM_FIRST  19 +  ; inline add-windows-message
-: HDM_SETBITMAPMARGIN HDM_FIRST  20 +  ; inline add-windows-message
-: HDM_GETBITMAPMARGIN HDM_FIRST  21 +  ; inline add-windows-message
-: HDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: HDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: HDM_SETFILTERCHANGETIMEOUT HDM_FIRST 22 + ; inline add-windows-message
-: HDM_EDITFILTER HDM_FIRST 23 + ; inline add-windows-message
-: HDM_CLEARFILTER HDM_FIRST 24 + ; inline add-windows-message
-: TB_ENABLEBUTTON WM_USER 1 + ; inline add-windows-message
-: TB_CHECKBUTTON WM_USER 2 + ; inline add-windows-message
-: TB_PRESSBUTTON WM_USER 3 + ; inline add-windows-message
-: TB_HIDEBUTTON WM_USER  4 +  ; inline add-windows-message
-: TB_INDETERMINATE WM_USER  5 +  ; inline add-windows-message
-: TB_MARKBUTTON WM_USER  6 +  ; inline add-windows-message
-: TB_ISBUTTONENABLED WM_USER  9 +  ; inline add-windows-message
-: TB_ISBUTTONCHECKED WM_USER  10 +  ; inline add-windows-message
-: TB_ISBUTTONPRESSED WM_USER  11 +  ; inline add-windows-message
-: TB_ISBUTTONHIDDEN WM_USER  12 +  ; inline add-windows-message
-: TB_ISBUTTONINDETERMINATE WM_USER  13 +  ; inline add-windows-message
-: TB_ISBUTTONHIGHLIGHTED WM_USER  14 +  ; inline add-windows-message
-: TB_SETSTATE WM_USER  17 +  ; inline add-windows-message
-: TB_GETSTATE WM_USER  18 +  ; inline add-windows-message
-: TB_ADDBITMAP WM_USER  19 +  ; inline add-windows-message
-: TB_ADDBUTTONSA WM_USER  20 +  ; inline add-windows-message
-: TB_INSERTBUTTONA WM_USER  21 +  ; inline add-windows-message
-: TB_ADDBUTTONS WM_USER  20 +  ; inline add-windows-message
-: TB_INSERTBUTTON WM_USER  21 +  ; inline add-windows-message
-: TB_DELETEBUTTON WM_USER  22 +  ; inline add-windows-message
-: TB_GETBUTTON WM_USER  23 +  ; inline add-windows-message
-: TB_BUTTONCOUNT WM_USER  24 +  ; inline add-windows-message
-: TB_COMMANDTOINDEX WM_USER  25 +  ; inline add-windows-message
-: TB_SAVERESTOREA WM_USER  26 +  ; inline add-windows-message
-: TB_SAVERESTOREW WM_USER  76 +  ; inline add-windows-message
-: TB_CUSTOMIZE WM_USER  27 +  ; inline add-windows-message
-: TB_ADDSTRINGA WM_USER  28 +  ; inline add-windows-message
-: TB_ADDSTRINGW WM_USER  77 +  ; inline add-windows-message
-: TB_GETITEMRECT WM_USER  29 +  ; inline add-windows-message
-: TB_BUTTONSTRUCTSIZE WM_USER  30 +  ; inline add-windows-message
-: TB_SETBUTTONSIZE WM_USER  31 +  ; inline add-windows-message
-: TB_SETBITMAPSIZE WM_USER  32 +  ; inline add-windows-message
-: TB_AUTOSIZE WM_USER  33 +  ; inline add-windows-message
-: TB_GETTOOLTIPS WM_USER  35 +  ; inline add-windows-message
-: TB_SETTOOLTIPS WM_USER  36 +  ; inline add-windows-message
-: TB_SETPARENT WM_USER  37 +  ; inline add-windows-message
-: TB_SETROWS WM_USER  39 +  ; inline add-windows-message
-: TB_GETROWS WM_USER  40 +  ; inline add-windows-message
-: TB_SETCMDID WM_USER  42 +  ; inline add-windows-message
-: TB_CHANGEBITMAP WM_USER  43 +  ; inline add-windows-message
-: TB_GETBITMAP WM_USER  44 +  ; inline add-windows-message
-: TB_GETBUTTONTEXTA WM_USER  45 +  ; inline add-windows-message
-: TB_GETBUTTONTEXTW WM_USER  75 +  ; inline add-windows-message
-: TB_REPLACEBITMAP WM_USER  46 +  ; inline add-windows-message
-: TB_SETINDENT WM_USER  47 +  ; inline add-windows-message
-: TB_SETIMAGELIST WM_USER  48 +  ; inline add-windows-message
-: TB_GETIMAGELIST WM_USER  49 +  ; inline add-windows-message
-: TB_LOADIMAGES WM_USER  50 +  ; inline add-windows-message
-: TB_GETRECT WM_USER  51 +  ; inline add-windows-message
-: TB_SETHOTIMAGELIST WM_USER  52 +  ; inline add-windows-message
-: TB_GETHOTIMAGELIST WM_USER  53 +  ; inline add-windows-message
-: TB_SETDISABLEDIMAGELIST WM_USER  54 +  ; inline add-windows-message
-: TB_GETDISABLEDIMAGELIST WM_USER  55 +  ; inline add-windows-message
-: TB_SETSTYLE WM_USER  56 +  ; inline add-windows-message
-: TB_GETSTYLE WM_USER  57 +  ; inline add-windows-message
-: TB_GETBUTTONSIZE WM_USER  58 +  ; inline add-windows-message
-: TB_SETBUTTONWIDTH WM_USER  59 +  ; inline add-windows-message
-: TB_SETMAXTEXTROWS WM_USER  60 +  ; inline add-windows-message
-: TB_GETTEXTROWS WM_USER  61 +  ; inline add-windows-message
-: TB_GETOBJECT WM_USER  62 +  ; inline add-windows-message
-: TB_GETHOTITEM WM_USER  71 +  ; inline add-windows-message
-: TB_SETHOTITEM WM_USER  72 +  ; inline add-windows-message 
-: TB_SETANCHORHIGHLIGHT WM_USER  73 +  ; inline add-windows-message 
-: TB_GETANCHORHIGHLIGHT WM_USER  74 +  ; inline add-windows-message
-: TB_MAPACCELERATORA WM_USER  78 +  ; inline add-windows-message 
-: TB_GETINSERTMARK WM_USER  79 +  ; inline add-windows-message 
-: TB_SETINSERTMARK WM_USER  80 +  ; inline add-windows-message 
-: TB_INSERTMARKHITTEST WM_USER  81 +  ; inline add-windows-message
-: TB_MOVEBUTTON WM_USER  82 +  ; inline add-windows-message
-: TB_GETMAXSIZE WM_USER  83 +  ; inline add-windows-message
-: TB_SETEXTENDEDSTYLE WM_USER  84 +  ; inline add-windows-message
-: TB_GETEXTENDEDSTYLE WM_USER  85 +  ; inline add-windows-message
-: TB_GETPADDING WM_USER  86 +  ; inline add-windows-message
-: TB_SETPADDING WM_USER  87 +  ; inline add-windows-message
-: TB_SETINSERTMARKCOLOR WM_USER  88 +  ; inline add-windows-message
-: TB_GETINSERTMARKCOLOR WM_USER  89 +  ; inline add-windows-message
-: TB_SETCOLORSCHEME CCM_SETCOLORSCHEME ; inline add-windows-message
-: TB_GETCOLORSCHEME CCM_GETCOLORSCHEME ; inline add-windows-message
-: TB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: TB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: TB_MAPACCELERATORW WM_USER  90 +  ; inline add-windows-message
-: TB_GETBITMAPFLAGS WM_USER  41 +  ; inline add-windows-message
-: TB_GETBUTTONINFOW WM_USER  63 +  ; inline add-windows-message
-: TB_SETBUTTONINFOW WM_USER  64 +  ; inline add-windows-message
-: TB_GETBUTTONINFOA WM_USER  65 +  ; inline add-windows-message
-: TB_SETBUTTONINFOA WM_USER  66 +  ; inline add-windows-message
-: TB_INSERTBUTTONW WM_USER  67 +  ; inline add-windows-message
-: TB_ADDBUTTONSW WM_USER  68 +  ; inline add-windows-message
-: TB_HITTEST WM_USER  69 +  ; inline add-windows-message
-: TB_SETDRAWTEXTFLAGS WM_USER  70 +  ; inline add-windows-message
-: TB_GETSTRINGW WM_USER  91 +  ; inline add-windows-message
-: TB_GETSTRINGA WM_USER  92 +  ; inline add-windows-message
-: TB_GETMETRICS WM_USER  101 +  ; inline add-windows-message
-: TB_SETMETRICS WM_USER  102 +  ; inline add-windows-message
-: TB_SETWINDOWTHEME CCM_SETWINDOWTHEME ; inline add-windows-message
-: RB_INSERTBANDA WM_USER  1 +  ; inline add-windows-message
-: RB_DELETEBAND WM_USER  2 +  ; inline add-windows-message
-: RB_GETBARINFO WM_USER  3 +  ; inline add-windows-message
-: RB_SETBARINFO WM_USER  4 +  ; inline add-windows-message
-: RB_GETBANDINFO WM_USER  5 +  ; inline add-windows-message
-: RB_SETBANDINFOA WM_USER  6 +  ; inline add-windows-message
-: RB_SETPARENT WM_USER  7 +  ; inline add-windows-message
-: RB_HITTEST WM_USER  8 +  ; inline add-windows-message
-: RB_GETRECT WM_USER  9 +  ; inline add-windows-message
-: RB_INSERTBANDW WM_USER  10 +  ; inline add-windows-message
-: RB_SETBANDINFOW WM_USER  11 +  ; inline add-windows-message
-: RB_GETBANDCOUNT WM_USER  12 +  ; inline add-windows-message
-: RB_GETROWCOUNT WM_USER  13 +  ; inline add-windows-message
-: RB_GETROWHEIGHT WM_USER  14 +  ; inline add-windows-message
-: RB_IDTOINDEX WM_USER  16 +  ; inline add-windows-message 
-: RB_GETTOOLTIPS WM_USER  17 +  ; inline add-windows-message
-: RB_SETTOOLTIPS WM_USER  18 +  ; inline add-windows-message
-: RB_SETBKCOLOR WM_USER  19 +  ; inline add-windows-message
-: RB_GETBKCOLOR WM_USER  20 +  ; inline add-windows-message
-: RB_SETTEXTCOLOR WM_USER  21 +  ; inline add-windows-message
-: RB_GETTEXTCOLOR WM_USER  22 +  ; inline add-windows-message
-: RB_SIZETORECT WM_USER  23 +  ; inline add-windows-message
-: RB_SETCOLORSCHEME CCM_SETCOLORSCHEME ; inline add-windows-message
-: RB_GETCOLORSCHEME CCM_GETCOLORSCHEME ; inline add-windows-message
-: RB_BEGINDRAG WM_USER  24 +  ; inline add-windows-message
-: RB_ENDDRAG WM_USER  25 +  ; inline add-windows-message
-: RB_DRAGMOVE WM_USER  26 +  ; inline add-windows-message
-: RB_GETBARHEIGHT WM_USER  27 +  ; inline add-windows-message
-: RB_GETBANDINFOW WM_USER  28 +  ; inline add-windows-message
-: RB_GETBANDINFOA WM_USER  29 +  ; inline add-windows-message
-: RB_MINIMIZEBAND WM_USER  30 +  ; inline add-windows-message
-: RB_MAXIMIZEBAND WM_USER  31 +  ; inline add-windows-message
-: RB_GETDROPTARGET CCM_GETDROPTARGET ; inline add-windows-message
-: RB_GETBANDBORDERS WM_USER  34 +  ; inline add-windows-message 
-: RB_SHOWBAND WM_USER  35 +  ; inline add-windows-message 
-: RB_SETPALETTE WM_USER  37 +  ; inline add-windows-message
-: RB_GETPALETTE WM_USER  38 +  ; inline add-windows-message
-: RB_MOVEBAND WM_USER  39 +  ; inline add-windows-message
-: RB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: RB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: RB_GETBANDMARGINS WM_USER  40 +  ; inline add-windows-message
-: RB_SETWINDOWTHEME CCM_SETWINDOWTHEME ; inline add-windows-message
-: RB_PUSHCHEVRON WM_USER  43 +  ; inline add-windows-message
-: TTM_ACTIVATE WM_USER  1 +  ; inline add-windows-message
-: TTM_SETDELAYTIME WM_USER  3 +  ; inline add-windows-message
-: TTM_ADDTOOLA WM_USER  4 +  ; inline add-windows-message
-: TTM_ADDTOOLW WM_USER  50 +  ; inline add-windows-message
-: TTM_DELTOOLA WM_USER  5 +  ; inline add-windows-message
-: TTM_DELTOOLW WM_USER  51 +  ; inline add-windows-message
-: TTM_NEWTOOLRECTA WM_USER  6 +  ; inline add-windows-message
-: TTM_NEWTOOLRECTW WM_USER  52 +  ; inline add-windows-message
-: TTM_RELAYEVENT WM_USER  7 +  ; inline add-windows-message
-: TTM_GETTOOLINFOA WM_USER  8 +  ; inline add-windows-message
-: TTM_GETTOOLINFOW WM_USER  53 +  ; inline add-windows-message
-: TTM_SETTOOLINFOA WM_USER  9 +  ; inline add-windows-message
-: TTM_SETTOOLINFOW WM_USER  54 +  ; inline add-windows-message
-: TTM_HITTESTA WM_USER 10 + ; inline add-windows-message
-: TTM_HITTESTW WM_USER 55 + ; inline add-windows-message
-: TTM_GETTEXTA WM_USER 11 + ; inline add-windows-message
-: TTM_GETTEXTW WM_USER 56 + ; inline add-windows-message
-: TTM_UPDATETIPTEXTA WM_USER 12 + ; inline add-windows-message
-: TTM_UPDATETIPTEXTW WM_USER 57 + ; inline add-windows-message
-: TTM_GETTOOLCOUNT WM_USER 13 + ; inline add-windows-message
-: TTM_ENUMTOOLSA WM_USER 14 + ; inline add-windows-message
-: TTM_ENUMTOOLSW WM_USER 58 + ; inline add-windows-message
-: TTM_GETCURRENTTOOLA WM_USER  15 +  ; inline add-windows-message
-: TTM_GETCURRENTTOOLW WM_USER  59 +  ; inline add-windows-message
-: TTM_WINDOWFROMPOINT WM_USER  16 +  ; inline add-windows-message
-: TTM_TRACKACTIVATE WM_USER  17 +  ; inline add-windows-message
-: TTM_TRACKPOSITION WM_USER  18 +  ; inline add-windows-message
-: TTM_SETTIPBKCOLOR WM_USER  19 +  ; inline add-windows-message
-: TTM_SETTIPTEXTCOLOR WM_USER  20 +  ; inline add-windows-message
-: TTM_GETDELAYTIME WM_USER  21 +  ; inline add-windows-message
-: TTM_GETTIPBKCOLOR WM_USER  22 +  ; inline add-windows-message
-: TTM_GETTIPTEXTCOLOR WM_USER  23 +  ; inline add-windows-message
-: TTM_SETMAXTIPWIDTH WM_USER  24 +  ; inline add-windows-message
-: TTM_GETMAXTIPWIDTH WM_USER  25 +  ; inline add-windows-message
-: TTM_SETMARGIN WM_USER  26 +  ; inline add-windows-message
-: TTM_GETMARGIN WM_USER  27 +  ; inline add-windows-message
-: TTM_POP WM_USER  28 +  ; inline add-windows-message
-: TTM_UPDATE WM_USER  29 +  ; inline add-windows-message
-: TTM_GETBUBBLESIZE WM_USER  30 +  ; inline add-windows-message
-: TTM_ADJUSTRECT WM_USER  31 +  ; inline add-windows-message
-: TTM_SETTITLEA WM_USER  32 +  ; inline add-windows-message
-: TTM_SETTITLEW WM_USER  33 +  ; inline add-windows-message
-: TTM_POPUP WM_USER  34 +  ; inline add-windows-message
-: TTM_GETTITLE WM_USER  35 +  ; inline add-windows-message
-: TTM_SETWINDOWTHEME CCM_SETWINDOWTHEME ; inline add-windows-message
-: SB_SETTEXTA WM_USER 1+  ; inline add-windows-message
-: SB_SETTEXTW WM_USER 11 +  ; inline add-windows-message
-: SB_GETTEXTA WM_USER 2 +  ; inline add-windows-message
-: SB_GETTEXTW WM_USER 13 +  ; inline add-windows-message
-: SB_GETTEXTLENGTHA WM_USER 3 +  ; inline add-windows-message
-: SB_GETTEXTLENGTHW WM_USER 12 +  ; inline add-windows-message
-: SB_SETPARTS WM_USER 4 +  ; inline add-windows-message
-: SB_GETPARTS WM_USER 6 +  ; inline add-windows-message
-: SB_GETBORDERS WM_USER 7 +  ; inline add-windows-message
-: SB_SETMINHEIGHT WM_USER 8 +  ; inline add-windows-message
-: SB_SIMPLE WM_USER 9 +  ; inline add-windows-message
-: SB_GETRECT WM_USER 10 +  ; inline add-windows-message
-: SB_ISSIMPLE WM_USER 14 +  ; inline add-windows-message
-: SB_SETICON WM_USER 15 +  ; inline add-windows-message
-: SB_SETTIPTEXTA WM_USER 16 +  ; inline add-windows-message
-: SB_SETTIPTEXTW WM_USER 17 +  ; inline add-windows-message
-: SB_GETTIPTEXTA WM_USER 18 +  ; inline add-windows-message
-: SB_GETTIPTEXTW WM_USER 19 +  ; inline add-windows-message
-: SB_GETICON WM_USER 20 +  ; inline add-windows-message
-: SB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: SB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: SB_SETBKCOLOR CCM_SETBKCOLOR ; inline add-windows-message
-: SB_SIMPLEID HEX: 00ff ; inline add-windows-message
-: TBM_GETPOS WM_USER ; inline add-windows-message
-: TBM_GETRANGEMIN WM_USER 1 +  ; inline add-windows-message
-: TBM_GETRANGEMAX WM_USER 2 +  ; inline add-windows-message
-: TBM_GETTIC WM_USER 3 +  ; inline add-windows-message
-: TBM_SETTIC WM_USER 4 +  ; inline add-windows-message
-: TBM_SETPOS WM_USER 5 +  ; inline add-windows-message
-: TBM_SETRANGE WM_USER 6 +  ; inline add-windows-message
-: TBM_SETRANGEMIN WM_USER 7 +  ; inline add-windows-message
-: TBM_SETRANGEMAX WM_USER 8 +  ; inline add-windows-message
-: TBM_CLEARTICS WM_USER 9 +  ; inline add-windows-message
-: TBM_SETSEL WM_USER 10 +  ; inline add-windows-message
-: TBM_SETSELSTART WM_USER 11 +  ; inline add-windows-message
-: TBM_SETSELEND WM_USER 12 +  ; inline add-windows-message
-: TBM_GETPTICS WM_USER 14 +  ; inline add-windows-message
-: TBM_GETTICPOS WM_USER 15 +  ; inline add-windows-message
-: TBM_GETNUMTICS WM_USER 16 +  ; inline add-windows-message
-: TBM_GETSELSTART WM_USER 17 +  ; inline add-windows-message
-: TBM_GETSELEND WM_USER 18 +  ; inline add-windows-message
-: TBM_CLEARSEL WM_USER 19 +  ; inline add-windows-message
-: TBM_SETTICFREQ WM_USER 20 +  ; inline add-windows-message
-: TBM_SETPAGESIZE WM_USER 21 +  ; inline add-windows-message
-: TBM_GETPAGESIZE WM_USER 22 +  ; inline add-windows-message
-: TBM_SETLINESIZE WM_USER 23 +  ; inline add-windows-message
-: TBM_GETLINESIZE WM_USER 24 +  ; inline add-windows-message
-: TBM_GETTHUMBRECT WM_USER 25 +  ; inline add-windows-message
-: TBM_GETCHANNELRECT WM_USER 26 +  ; inline add-windows-message
-: TBM_SETTHUMBLENGTH WM_USER 27 +  ; inline add-windows-message
-: TBM_GETTHUMBLENGTH WM_USER 28 +  ; inline add-windows-message
-: TBM_SETTOOLTIPS WM_USER 29 +  ; inline add-windows-message
-: TBM_GETTOOLTIPS WM_USER 30 +  ; inline add-windows-message
-: TBM_SETTIPSIDE WM_USER 31 +  ; inline add-windows-message
-: TBM_SETBUDDY WM_USER 32 +  ; inline add-windows-message 
-: TBM_GETBUDDY WM_USER 33 +  ; inline add-windows-message 
-: TBM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: TBM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: DL_BEGINDRAG WM_USER 133 +  ; inline add-windows-message
-: DL_DRAGGING WM_USER 134 +  ; inline add-windows-message
-: DL_DROPPED WM_USER 135 +  ; inline add-windows-message
-: DL_CANCELDRAG WM_USER 136 +  ; inline add-windows-message
-: UDM_SETRANGE WM_USER 101 +  ; inline add-windows-message
-: UDM_GETRANGE WM_USER 102 +  ; inline add-windows-message
-: UDM_SETPOS WM_USER 103 +  ; inline add-windows-message
-: UDM_GETPOS WM_USER 104 +  ; inline add-windows-message
-: UDM_SETBUDDY WM_USER 105 +  ; inline add-windows-message
-: UDM_GETBUDDY WM_USER 106 +  ; inline add-windows-message
-: UDM_SETACCEL WM_USER 107 +  ; inline add-windows-message
-: UDM_GETACCEL WM_USER 108 +  ; inline add-windows-message
-: UDM_SETBASE WM_USER 109 +  ; inline add-windows-message
-: UDM_GETBASE WM_USER 110 +  ; inline add-windows-message
-: UDM_SETRANGE32 WM_USER 111 +  ; inline add-windows-message
-: UDM_GETRANGE32 WM_USER 112 +  ; inline add-windows-message
-: UDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: UDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: UDM_SETPOS32 WM_USER 113 +  ; inline add-windows-message
-: UDM_GETPOS32 WM_USER 114 +  ; inline add-windows-message
-: PBM_SETRANGE WM_USER 1 +  ; inline add-windows-message
-: PBM_SETPOS WM_USER 2 +  ; inline add-windows-message
-: PBM_DELTAPOS WM_USER 3 +  ; inline add-windows-message
-: PBM_SETSTEP WM_USER 4 +  ; inline add-windows-message
-: PBM_STEPIT WM_USER 5 +  ; inline add-windows-message
-: PBM_SETRANGE32 WM_USER 6 +  ; inline add-windows-message
-: PBM_GETRANGE WM_USER 7 +  ; inline add-windows-message 
-: PBM_GETPOS WM_USER 8 +  ; inline add-windows-message
-: PBM_SETBARCOLOR WM_USER 9 +  ; inline add-windows-message
-: PBM_SETBKCOLOR CCM_SETBKCOLOR ; inline add-windows-message 
-: HKM_SETHOTKEY WM_USER 1 +  ; inline add-windows-message
-: HKM_GETHOTKEY WM_USER 2 +  ; inline add-windows-message
-: HKM_SETRULES WM_USER 3 +  ; inline add-windows-message
-: LVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: LVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: LVM_GETBKCOLOR LVM_FIRST  0 +  ; inline add-windows-message
-: LVM_SETBKCOLOR LVM_FIRST  1 +  ; inline add-windows-message
-: LVM_GETIMAGELIST LVM_FIRST  2 +  ; inline add-windows-message
-: LVM_SETIMAGELIST LVM_FIRST  3 +  ; inline add-windows-message
-: LVM_GETITEMCOUNT LVM_FIRST  4 +  ; inline add-windows-message
-: LVM_GETITEMA LVM_FIRST  5 +  ; inline add-windows-message
-: LVM_GETITEMW LVM_FIRST  75 +  ; inline add-windows-message
-: LVM_SETITEMA LVM_FIRST  6 +  ; inline add-windows-message
-: LVM_SETITEMW LVM_FIRST  76 +  ; inline add-windows-message
-: LVM_INSERTITEMA LVM_FIRST  7 +  ; inline add-windows-message
-: LVM_INSERTITEMW LVM_FIRST  77 +  ; inline add-windows-message
-: LVM_DELETEITEM LVM_FIRST  8 +  ; inline add-windows-message
-: LVM_DELETEALLITEMS LVM_FIRST  9 +  ; inline add-windows-message
-: LVM_GETCALLBACKMASK LVM_FIRST  10 +  ; inline add-windows-message
-: LVM_SETCALLBACKMASK LVM_FIRST  11 +  ; inline add-windows-message
-: LVM_FINDITEMA LVM_FIRST  13 +  ; inline add-windows-message
-: LVM_FINDITEMW LVM_FIRST  83 +  ; inline add-windows-message
-: LVM_GETITEMRECT LVM_FIRST  14 +  ; inline add-windows-message
-: LVM_SETITEMPOSITION LVM_FIRST  15 +  ; inline add-windows-message
-: LVM_GETITEMPOSITION LVM_FIRST  16 +  ; inline add-windows-message
-: LVM_GETSTRINGWIDTHA LVM_FIRST  17 +  ; inline add-windows-message
-: LVM_GETSTRINGWIDTHW LVM_FIRST  87 +  ; inline add-windows-message
-: LVM_HITTEST LVM_FIRST  18 +  ; inline add-windows-message
-: LVM_ENSUREVISIBLE LVM_FIRST  19 +  ; inline add-windows-message
-: LVM_SCROLL LVM_FIRST  20 +  ; inline add-windows-message
-: LVM_REDRAWITEMS LVM_FIRST  21 +  ; inline add-windows-message
-: LVM_ARRANGE LVM_FIRST  22 +  ; inline add-windows-message
-: LVM_EDITLABELA LVM_FIRST  23 +  ; inline add-windows-message
-: LVM_EDITLABELW LVM_FIRST  118 +  ; inline add-windows-message
-: LVM_GETEDITCONTROL LVM_FIRST  24 +  ; inline add-windows-message
-: LVM_GETCOLUMNA LVM_FIRST  25 +  ; inline add-windows-message
-: LVM_GETCOLUMNW LVM_FIRST  95 +  ; inline add-windows-message
-: LVM_SETCOLUMNA LVM_FIRST  26 +  ; inline add-windows-message
-: LVM_SETCOLUMNW LVM_FIRST  96 +  ; inline add-windows-message
-: LVM_INSERTCOLUMNA LVM_FIRST  27 +  ; inline add-windows-message
-: LVM_INSERTCOLUMNW LVM_FIRST  97 +  ; inline add-windows-message
-: LVM_DELETECOLUMN LVM_FIRST  28 +  ; inline add-windows-message
-: LVM_GETCOLUMNWIDTH LVM_FIRST  29 +  ; inline add-windows-message
-: LVM_SETCOLUMNWIDTH LVM_FIRST  30 +  ; inline add-windows-message
-: LVM_CREATEDRAGIMAGE LVM_FIRST  33 +  ; inline add-windows-message
-: LVM_GETVIEWRECT LVM_FIRST  34 +  ; inline add-windows-message
-: LVM_GETTEXTCOLOR LVM_FIRST  35 +  ; inline add-windows-message
-: LVM_SETTEXTCOLOR LVM_FIRST  36 +  ; inline add-windows-message
-: LVM_GETTEXTBKCOLOR LVM_FIRST  37 +  ; inline add-windows-message
-: LVM_SETTEXTBKCOLOR LVM_FIRST  38 +  ; inline add-windows-message
-: LVM_GETTOPINDEX LVM_FIRST  39 +  ; inline add-windows-message
-: LVM_GETCOUNTPERPAGE LVM_FIRST  40 +  ; inline add-windows-message
-: LVM_GETORIGIN LVM_FIRST  41 +  ; inline add-windows-message
-: LVM_UPDATE LVM_FIRST  42 +  ; inline add-windows-message
-: LVM_SETITEMSTATE LVM_FIRST  43 +  ; inline add-windows-message
-: LVM_GETITEMSTATE LVM_FIRST  44 +  ; inline add-windows-message
-: LVM_GETITEMTEXTA LVM_FIRST  45 +  ; inline add-windows-message
-: LVM_GETITEMTEXTW LVM_FIRST  115 +  ; inline add-windows-message
-: LVM_SETITEMTEXTA LVM_FIRST  46 +  ; inline add-windows-message
-: LVM_SETITEMTEXTW LVM_FIRST  116 +  ; inline add-windows-message
-: LVM_SETITEMCOUNT LVM_FIRST  47 +  ; inline add-windows-message
-: LVM_SORTITEMS LVM_FIRST  48 +  ; inline add-windows-message
-: LVM_SETITEMPOSITION32 LVM_FIRST  49 +  ; inline add-windows-message
-: LVM_GETSELECTEDCOUNT LVM_FIRST  50 +  ; inline add-windows-message
-: LVM_GETITEMSPACING LVM_FIRST  51 +  ; inline add-windows-message
-: LVM_GETISEARCHSTRINGA LVM_FIRST  52 +  ; inline add-windows-message
-: LVM_GETISEARCHSTRINGW LVM_FIRST  117 +  ; inline add-windows-message
-: LVM_SETICONSPACING LVM_FIRST  53 +  ; inline add-windows-message
-: LVM_SETEXTENDEDLISTVIEWSTYLE LVM_FIRST  54 +  ; inline add-windows-message
-: LVM_GETEXTENDEDLISTVIEWSTYLE LVM_FIRST  55 +  ; inline add-windows-message
-: LVM_GETSUBITEMRECT LVM_FIRST  56 +  ; inline add-windows-message
-: LVM_SUBITEMHITTEST LVM_FIRST  57 +  ; inline add-windows-message
-: LVM_SETCOLUMNORDERARRAY LVM_FIRST  58 +  ; inline add-windows-message
-: LVM_GETCOLUMNORDERARRAY LVM_FIRST  59 +  ; inline add-windows-message
-: LVM_SETHOTITEM LVM_FIRST  60 +  ; inline add-windows-message
-: LVM_GETHOTITEM LVM_FIRST  61 +  ; inline add-windows-message
-: LVM_SETHOTCURSOR LVM_FIRST  62 +  ; inline add-windows-message
-: LVM_GETHOTCURSOR LVM_FIRST  63 +  ; inline add-windows-message
-: LVM_APPROXIMATEVIEWRECT LVM_FIRST  64 +  ; inline add-windows-message
-: LVM_SETWORKAREAS LVM_FIRST  65 +  ; inline add-windows-message
-: LVM_GETWORKAREAS LVM_FIRST  70 +  ; inline add-windows-message
-: LVM_GETNUMBEROFWORKAREAS LVM_FIRST  73 +  ; inline add-windows-message
-: LVM_GETSELECTIONMARK LVM_FIRST  66 +  ; inline add-windows-message
-: LVM_SETSELECTIONMARK LVM_FIRST  67 +  ; inline add-windows-message
-: LVM_SETHOVERTIME LVM_FIRST  71 +  ; inline add-windows-message
-: LVM_GETHOVERTIME LVM_FIRST  72 +  ; inline add-windows-message
-: LVM_SETTOOLTIPS LVM_FIRST  74 +  ; inline add-windows-message
-: LVM_GETTOOLTIPS LVM_FIRST  78 +  ; inline add-windows-message
-: LVM_SORTITEMSEX LVM_FIRST  81 +  ; inline add-windows-message
-: LVM_SETBKIMAGEA LVM_FIRST  68 +  ; inline add-windows-message
-: LVM_SETBKIMAGEW LVM_FIRST  138 +  ; inline add-windows-message
-: LVM_GETBKIMAGEA LVM_FIRST  69 +  ; inline add-windows-message
-: LVM_GETBKIMAGEW LVM_FIRST  139 +  ; inline add-windows-message
-: LVM_SETSELECTEDCOLUMN LVM_FIRST  140 +  ; inline add-windows-message
-: LVM_SETTILEWIDTH LVM_FIRST  141 +  ; inline add-windows-message
-: LVM_SETVIEW LVM_FIRST  142 +  ; inline add-windows-message
-: LVM_GETVIEW LVM_FIRST  143 +  ; inline add-windows-message
-: LVM_INSERTGROUP LVM_FIRST  145 +  ; inline add-windows-message
-: LVM_SETGROUPINFO LVM_FIRST  147 +  ; inline add-windows-message
-: LVM_GETGROUPINFO LVM_FIRST  149 +  ; inline add-windows-message
-: LVM_REMOVEGROUP LVM_FIRST  150 +  ; inline add-windows-message
-: LVM_MOVEGROUP LVM_FIRST  151 +  ; inline add-windows-message
-: LVM_MOVEITEMTOGROUP LVM_FIRST  154 +  ; inline add-windows-message
-: LVM_SETGROUPMETRICS LVM_FIRST  155 +  ; inline add-windows-message
-: LVM_GETGROUPMETRICS LVM_FIRST  156 +  ; inline add-windows-message
-: LVM_ENABLEGROUPVIEW LVM_FIRST  157 +  ; inline add-windows-message
-: LVM_SORTGROUPS LVM_FIRST  158 +  ; inline add-windows-message
-: LVM_INSERTGROUPSORTED LVM_FIRST  159 +  ; inline add-windows-message
-: LVM_REMOVEALLGROUPS LVM_FIRST  160 +  ; inline add-windows-message
-: LVM_HASGROUP LVM_FIRST  161 +  ; inline add-windows-message
-: LVM_SETTILEVIEWINFO LVM_FIRST  162 +  ; inline add-windows-message
-: LVM_GETTILEVIEWINFO LVM_FIRST  163 +  ; inline add-windows-message
-: LVM_SETTILEINFO LVM_FIRST  164 +  ; inline add-windows-message
-: LVM_GETTILEINFO LVM_FIRST  165 +  ; inline add-windows-message
-: LVM_SETINSERTMARK LVM_FIRST  166 +  ; inline add-windows-message
-: LVM_GETINSERTMARK LVM_FIRST  167 +  ; inline add-windows-message
-: LVM_INSERTMARKHITTEST LVM_FIRST  168 +  ; inline add-windows-message
-: LVM_GETINSERTMARKRECT LVM_FIRST  169 +  ; inline add-windows-message
-: LVM_SETINSERTMARKCOLOR LVM_FIRST  170 +  ; inline add-windows-message
-: LVM_GETINSERTMARKCOLOR LVM_FIRST  171 +  ; inline add-windows-message
-: LVM_SETINFOTIP LVM_FIRST  173 +  ; inline add-windows-message
-: LVM_GETSELECTEDCOLUMN LVM_FIRST  174 +  ; inline add-windows-message
-: LVM_ISGROUPVIEWENABLED LVM_FIRST  175 +  ; inline add-windows-message
-: LVM_GETOUTLINECOLOR LVM_FIRST  176 +  ; inline add-windows-message
-: LVM_SETOUTLINECOLOR LVM_FIRST  177 +  ; inline add-windows-message
-: LVM_CANCELEDITLABEL LVM_FIRST  179 +  ; inline add-windows-message
-: LVM_MAPINDEXTOID LVM_FIRST  180 +  ; inline add-windows-message
-: LVM_MAPIDTOINDEX LVM_FIRST  181 +  ; inline add-windows-message
-: TVM_INSERTITEMA TV_FIRST  0 +  ; inline add-windows-message
-: TVM_INSERTITEMW TV_FIRST  50 +  ; inline add-windows-message
-: TVM_DELETEITEM TV_FIRST  1 +  ; inline add-windows-message
-: TVM_EXPAND TV_FIRST  2 +  ; inline add-windows-message
-: TVM_GETITEMRECT TV_FIRST  4 +  ; inline add-windows-message
-: TVM_GETCOUNT TV_FIRST  5 +  ; inline add-windows-message
-: TVM_GETINDENT TV_FIRST  6 +  ; inline add-windows-message
-: TVM_SETINDENT TV_FIRST  7 +  ; inline add-windows-message
-: TVM_GETIMAGELIST TV_FIRST  8 +  ; inline add-windows-message
-: TVM_SETIMAGELIST TV_FIRST  9 +  ; inline add-windows-message
-: TVM_GETNEXTITEM TV_FIRST  10 +  ; inline add-windows-message
-: TVM_SELECTITEM TV_FIRST  11 +  ; inline add-windows-message
-: TVM_GETITEMA TV_FIRST  12 +  ; inline add-windows-message
-: TVM_GETITEMW TV_FIRST  62 +  ; inline add-windows-message
-: TVM_SETITEMA TV_FIRST  13 +  ; inline add-windows-message
-: TVM_SETITEMW TV_FIRST  63 +  ; inline add-windows-message
-: TVM_EDITLABELA TV_FIRST  14 +  ; inline add-windows-message
-: TVM_EDITLABELW TV_FIRST  65 +  ; inline add-windows-message
-: TVM_GETEDITCONTROL TV_FIRST  15 +  ; inline add-windows-message
-: TVM_GETVISIBLECOUNT TV_FIRST  16 +  ; inline add-windows-message
-: TVM_HITTEST TV_FIRST  17 +  ; inline add-windows-message
-: TVM_CREATEDRAGIMAGE TV_FIRST  18 +  ; inline add-windows-message
-: TVM_SORTCHILDREN TV_FIRST  19 +  ; inline add-windows-message
-: TVM_ENSUREVISIBLE TV_FIRST  20 +  ; inline add-windows-message
-: TVM_SORTCHILDRENCB TV_FIRST  21 +  ; inline add-windows-message
-: TVM_ENDEDITLABELNOW TV_FIRST  22 +  ; inline add-windows-message
-: TVM_GETISEARCHSTRINGA TV_FIRST  23 +  ; inline add-windows-message
-: TVM_GETISEARCHSTRINGW TV_FIRST  64 +  ; inline add-windows-message
-: TVM_SETTOOLTIPS TV_FIRST  24 +  ; inline add-windows-message
-: TVM_GETTOOLTIPS TV_FIRST  25 +  ; inline add-windows-message
-: TVM_SETINSERTMARK TV_FIRST  26 +  ; inline add-windows-message
-: TVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: TVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: TVM_SETITEMHEIGHT TV_FIRST  27 +  ; inline add-windows-message
-: TVM_GETITEMHEIGHT TV_FIRST  28 +  ; inline add-windows-message
-: TVM_SETBKCOLOR TV_FIRST  29 +  ; inline add-windows-message
-: TVM_SETTEXTCOLOR TV_FIRST  30 +  ; inline add-windows-message
-: TVM_GETBKCOLOR TV_FIRST  31 +  ; inline add-windows-message
-: TVM_GETTEXTCOLOR TV_FIRST  32 +  ; inline add-windows-message
-: TVM_SETSCROLLTIME TV_FIRST  33 +  ; inline add-windows-message
-: TVM_GETSCROLLTIME TV_FIRST  34 +  ; inline add-windows-message
-: TVM_SETINSERTMARKCOLOR TV_FIRST  37 +  ; inline add-windows-message
-: TVM_GETINSERTMARKCOLOR TV_FIRST  38 +  ; inline add-windows-message
-: TVM_GETITEMSTATE TV_FIRST  39 +  ; inline add-windows-message
-: TVM_SETLINECOLOR TV_FIRST  40 +  ; inline add-windows-message
-: TVM_GETLINECOLOR TV_FIRST  41 +  ; inline add-windows-message
-: TVM_MAPACCIDTOHTREEITEM TV_FIRST  42 +  ; inline add-windows-message
-: TVM_MAPHTREEITEMTOACCID TV_FIRST  43 +  ; inline add-windows-message
-: CBEM_INSERTITEMA WM_USER  1 +  ; inline add-windows-message
-: CBEM_SETIMAGELIST WM_USER  2 +  ; inline add-windows-message
-: CBEM_GETIMAGELIST WM_USER  3 +  ; inline add-windows-message
-: CBEM_GETITEMA WM_USER  4 +  ; inline add-windows-message
-: CBEM_SETITEMA WM_USER  5 +  ; inline add-windows-message
-: CBEM_DELETEITEM CB_DELETESTRING ; inline add-windows-message
-: CBEM_GETCOMBOCONTROL WM_USER  6 +  ; inline add-windows-message
-: CBEM_GETEDITCONTROL WM_USER  7 +  ; inline add-windows-message
-: CBEM_SETEXTENDEDSTYLE WM_USER  14 +  ; inline add-windows-message
-: CBEM_GETEXTENDEDSTYLE WM_USER  9 +  ; inline add-windows-message
-: CBEM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: CBEM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: CBEM_SETEXSTYLE WM_USER  8 +  ; inline add-windows-message
-: CBEM_GETEXSTYLE WM_USER  9 +  ; inline add-windows-message
-: CBEM_HASEDITCHANGED WM_USER  10 +  ; inline add-windows-message
-: CBEM_INSERTITEMW WM_USER  11 +  ; inline add-windows-message
-: CBEM_SETITEMW WM_USER  12 +  ; inline add-windows-message
-: CBEM_GETITEMW WM_USER  13 +  ; inline add-windows-message
-: TCM_GETIMAGELIST TCM_FIRST  2 +  ; inline add-windows-message
-: TCM_SETIMAGELIST TCM_FIRST  3 +  ; inline add-windows-message
-: TCM_GETITEMCOUNT TCM_FIRST  4 +  ; inline add-windows-message
-: TCM_GETITEMA TCM_FIRST  5 +  ; inline add-windows-message
-: TCM_GETITEMW TCM_FIRST  60 +  ; inline add-windows-message
-: TCM_SETITEMA TCM_FIRST  6 +  ; inline add-windows-message
-: TCM_SETITEMW TCM_FIRST  61 +  ; inline add-windows-message
-: TCM_INSERTITEMA TCM_FIRST  7 +  ; inline add-windows-message
-: TCM_INSERTITEMW TCM_FIRST  62 +  ; inline add-windows-message
-: TCM_DELETEITEM TCM_FIRST  8 +  ; inline add-windows-message
-: TCM_DELETEALLITEMS TCM_FIRST  9 +  ; inline add-windows-message
-: TCM_GETITEMRECT TCM_FIRST  10 +  ; inline add-windows-message
-: TCM_GETCURSEL TCM_FIRST  11 +  ; inline add-windows-message
-: TCM_SETCURSEL TCM_FIRST  12 +  ; inline add-windows-message
-: TCM_HITTEST TCM_FIRST  13 +  ; inline add-windows-message
-: TCM_SETITEMEXTRA TCM_FIRST  14 +  ; inline add-windows-message
-: TCM_ADJUSTRECT TCM_FIRST  40 +  ; inline add-windows-message
-: TCM_SETITEMSIZE TCM_FIRST  41 +  ; inline add-windows-message
-: TCM_REMOVEIMAGE TCM_FIRST  42 +  ; inline add-windows-message
-: TCM_SETPADDING TCM_FIRST  43 +  ; inline add-windows-message
-: TCM_GETROWCOUNT TCM_FIRST  44 +  ; inline add-windows-message
-: TCM_GETTOOLTIPS TCM_FIRST  45 +  ; inline add-windows-message
-: TCM_SETTOOLTIPS TCM_FIRST  46 +  ; inline add-windows-message
-: TCM_GETCURFOCUS TCM_FIRST  47 +  ; inline add-windows-message
-: TCM_SETCURFOCUS TCM_FIRST  48 +  ; inline add-windows-message
-: TCM_SETMINTABWIDTH TCM_FIRST  49 +  ; inline add-windows-message
-: TCM_DESELECTALL TCM_FIRST  50 +  ; inline add-windows-message
-: TCM_HIGHLIGHTITEM TCM_FIRST  51 +  ; inline add-windows-message
-: TCM_SETEXTENDEDSTYLE TCM_FIRST  52 +  ; inline add-windows-message
-: TCM_GETEXTENDEDSTYLE TCM_FIRST  53 +  ; inline add-windows-message
-: TCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: TCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: ACM_OPENA WM_USER 100 +  ; inline add-windows-message
-: ACM_OPENW WM_USER 103 +  ; inline add-windows-message
-: ACM_PLAY WM_USER 101 +  ; inline add-windows-message
-: ACM_STOP WM_USER 102 +  ; inline add-windows-message
-: MCM_FIRST HEX: 1000 ; inline add-windows-message
-: MCM_GETCURSEL MCM_FIRST  1 +  ; inline add-windows-message
-: MCM_SETCURSEL MCM_FIRST  2 +  ; inline add-windows-message
-: MCM_GETMAXSELCOUNT MCM_FIRST  3 +  ; inline add-windows-message
-: MCM_SETMAXSELCOUNT MCM_FIRST  4 +  ; inline add-windows-message
-: MCM_GETSELRANGE MCM_FIRST  5 +  ; inline add-windows-message
-: MCM_SETSELRANGE MCM_FIRST  6 +  ; inline add-windows-message
-: MCM_GETMONTHRANGE MCM_FIRST  7 +  ; inline add-windows-message
-: MCM_SETDAYSTATE MCM_FIRST  8 +  ; inline add-windows-message
-: MCM_GETMINREQRECT MCM_FIRST  9 +  ; inline add-windows-message
-: MCM_SETCOLOR MCM_FIRST  10 +  ; inline add-windows-message
-: MCM_GETCOLOR MCM_FIRST  11 +  ; inline add-windows-message
-: MCM_SETTODAY MCM_FIRST  12 +  ; inline add-windows-message
-: MCM_GETTODAY MCM_FIRST  13 +  ; inline add-windows-message
-: MCM_HITTEST MCM_FIRST  14 +  ; inline add-windows-message
-: MCM_SETFIRSTDAYOFWEEK MCM_FIRST  15 +  ; inline add-windows-message
-: MCM_GETFIRSTDAYOFWEEK MCM_FIRST  16 +  ; inline add-windows-message
-: MCM_GETRANGE MCM_FIRST  17 +  ; inline add-windows-message
-: MCM_SETRANGE MCM_FIRST  18 +  ; inline add-windows-message
-: MCM_GETMONTHDELTA MCM_FIRST  19 +  ; inline add-windows-message
-: MCM_SETMONTHDELTA MCM_FIRST  20 +  ; inline add-windows-message
-: MCM_GETMAXTODAYWIDTH MCM_FIRST  21 +  ; inline add-windows-message
-: MCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
-: MCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
-: DTM_FIRST HEX: 1000 ; inline add-windows-message
-: DTM_GETSYSTEMTIME DTM_FIRST  1 +  ; inline add-windows-message
-: DTM_SETSYSTEMTIME DTM_FIRST  2 +  ; inline add-windows-message
-: DTM_GETRANGE DTM_FIRST  3 +  ; inline add-windows-message
-: DTM_SETRANGE DTM_FIRST  4 +  ; inline add-windows-message
-: DTM_SETFORMATA DTM_FIRST  5 +  ; inline add-windows-message
-: DTM_SETFORMATW DTM_FIRST  50 +  ; inline add-windows-message
-: DTM_SETMCCOLOR DTM_FIRST  6 +  ; inline add-windows-message
-: DTM_GETMCCOLOR DTM_FIRST  7 +  ; inline add-windows-message
-: DTM_GETMONTHCAL DTM_FIRST  8 +  ; inline add-windows-message
-: DTM_SETMCFONT DTM_FIRST  9 +  ; inline add-windows-message
-: DTM_GETMCFONT DTM_FIRST  10 +  ; inline add-windows-message
-: PGM_SETCHILD PGM_FIRST  1 +  ; inline add-windows-message
-: PGM_RECALCSIZE PGM_FIRST  2 +  ; inline add-windows-message
-: PGM_FORWARDMOUSE PGM_FIRST  3 +  ; inline add-windows-message
-: PGM_SETBKCOLOR PGM_FIRST  4 +  ; inline add-windows-message
-: PGM_GETBKCOLOR PGM_FIRST  5 +  ; inline add-windows-message
-: PGM_SETBORDER PGM_FIRST  6 +  ; inline add-windows-message
-: PGM_GETBORDER PGM_FIRST  7 +  ; inline add-windows-message
-: PGM_SETPOS PGM_FIRST  8 +  ; inline add-windows-message
-: PGM_GETPOS PGM_FIRST  9 +  ; inline add-windows-message
-: PGM_SETBUTTONSIZE PGM_FIRST  10 +  ; inline add-windows-message
-: PGM_GETBUTTONSIZE PGM_FIRST  11 +  ; inline add-windows-message
-: PGM_GETBUTTONSTATE PGM_FIRST  12 +  ; inline add-windows-message
-: PGM_GETDROPTARGET CCM_GETDROPTARGET ; inline add-windows-message
-: BCM_GETIDEALSIZE BCM_FIRST  1 +  ; inline add-windows-message
-: BCM_SETIMAGELIST BCM_FIRST  2 +  ; inline add-windows-message
-: BCM_GETIMAGELIST BCM_FIRST  3 +  ; inline add-windows-message
-: BCM_SETTEXTMARGIN BCM_FIRST 4 +  ; inline add-windows-message
-: BCM_GETTEXTMARGIN BCM_FIRST 5 +  ; inline add-windows-message
-: EM_SETCUEBANNER       ECM_FIRST  1 +  ; inline add-windows-message
-: EM_GETCUEBANNER       ECM_FIRST  2 +  ; inline add-windows-message
-: EM_SHOWBALLOONTIP ECM_FIRST  3 +  ; inline add-windows-message
-: EM_HIDEBALLOONTIP ECM_FIRST  4 +  ; inline add-windows-message 
-: CB_SETMINVISIBLE CBM_FIRST  1 +  ; inline add-windows-message
-: CB_GETMINVISIBLE CBM_FIRST  2 +  ; inline add-windows-message
-: LM_HITTEST WM_USER  HEX: 0300 +  ; inline add-windows-message 
-: LM_GETIDEALHEIGHT WM_USER  HEX: 0301 +  ; inline add-windows-message
-: LM_SETITEM WM_USER  HEX: 0302 + ; inline add-windows-message 
-: LM_GETITEM WM_USER  HEX: 0303 + ; inline add-windows-message
diff --git a/core/windows/winsock.factor b/core/windows/winsock.factor
deleted file mode 100644 (file)
index 9eae347..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
-
-IN: win32-api
-USING: alien arrays kernel ;
-
-: <wsadata> ( -- byte-array )
-    HEX: 190 <byte-array> ;
-
-: AF_INET 2 ; inline
-: SOCK_STREAM 1 ; inline
-: WSA_FLAG_OVERLAPPED 1 ; inline
-: INADDR_ANY 0 ; inline
-: INVALID_SOCKET -1 ; inline
-
-BEGIN-STRUCT: sockaddr-in
-    FIELD: short family
-    FIELD: short port
-    FIELD: int addr
-    FIELD: char pad
-    FIELD: char pad
-    FIELD: char pad
-    FIELD: char pad
-    FIELD: char pad
-    FIELD: char pad
-    FIELD: char pad
-    FIELD: char pad
-END-STRUCT
-
-BEGIN-STRUCT: hostent
-    FIELD: char* name
-    FIELD: void* aliases
-    FIELD: short addrtype
-    FIELD: short length
-    FIELD: void* addr-list
-END-STRUCT
-
-: hostent-addr hostent-addr-list *void* *uint ;
-
-LIBRARY: winsock
-
-FUNCTION: int WSAStartup ( short version, void* out-data ) ;
-FUNCTION: void* WSASocketA ( int af,
-                             int type,
-                             int protocol,
-                             void* protocol-info,
-                             void* g,
-                             int flags ) ;
-: WSASocket WSASocketA ;
-
-FUNCTION: ushort htons ( ushort n ) ;
-FUNCTION: ushort ntohs ( ushort n ) ;
-IN: win32-api-internals
-FUNCTION: int bind ( void* socket, sockaddr-in* sockaddr, int len ) ;
-FUNCTION: int listen ( void* socket, int backlog ) ;
-FUNCTION: char* inet_ntoa ( int in-addr ) ;
-IN: win32-api
-: wsa-bind bind ;
-: wsa-listen listen ;
-: inet-ntoa inet_ntoa ;
-FUNCTION: int WSAGetLastError ( ) ;
-FUNCTION: hostent* gethostbyname ( char* name ) ;
-FUNCTION: int connect ( void* socket, sockaddr-in* sockaddr, int addrlen ) ;
-
-LIBRARY: mswsock
-
-FUNCTION: bool AcceptEx ( void* listen, void* accept, void* out-buf, int recv-len, int addr-len, int remote-len, void* out-len, void* overlapped ) ;
-FUNCTION: void GetAcceptExSockaddrs ( void* a, int b, int c, int d, void* e, void* f, void* g, void* h ) ;
diff --git a/core/words.factor b/core/words.factor
deleted file mode 100644 (file)
index 51c9fbe..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: help
-DEFER: remove-word-help
-
-IN: words
-USING: arrays definitions errors generic graphs hashtables
-kernel kernel-internals math namespaces sequences strings
-vectors ;
-
-! Used by the compiler
-SYMBOL: changed-words
-
-: word-changed? ( word -- ? )
-    changed-words get [ hash-member? ] [ drop f ] if* ;
-
-: changed-word ( word -- )
-    dup changed-words get [ set-hash ] [ 2drop ] if* ;
-
-: unchanged-word ( word -- )
-    changed-words get [ remove-hash ] [ drop ] if* ;
-
-M: word <=>
-    [ dup word-name swap word-vocabulary 2array ] 2apply <=> ;
-
-GENERIC: definer ( word -- definer )
-
-PREDICATE: word undefined ( obj -- ? ) word-primitive 0 = ;
-M: undefined definer drop \ DEFER: ;
-
-PREDICATE: word compound  ( obj -- ? ) word-primitive 1 = ;
-M: compound definer drop \ : ;
-
-PREDICATE: word primitive ( obj -- ? ) word-primitive 2 > ;
-M: primitive definer drop \ PRIMITIVE: ;
-
-PREDICATE: word symbol    ( obj -- ? ) word-primitive 2 = ;
-M: symbol definer drop \ SYMBOL: ;
-
-: init-word ( word -- ) H{ } clone swap set-word-props ;
-
-: word-prop ( word name -- value ) swap word-props hash ;
-
-: remove-word-prop ( word name -- )
-    swap word-props remove-hash ;
-
-: set-word-prop ( word value name -- )
-    over
-    [ rot word-props set-hash ]
-    [ nip remove-word-prop ] if ;
-
-SYMBOL: vocabularies
-
-: vocab ( name -- vocab ) vocabularies get hash ;
-
-: lookup ( name vocab -- word ) vocab ?hash ;
-
-: target-word ( word -- target )
-    dup word-name swap word-vocabulary lookup ;
-
-: interned? ( word -- ? ) dup target-word eq? ;
-
-: uses ( word -- seq )
-    word-def flatten
-    [ word? ] subset
-    [ global [ interned? ] bind ] subset
-    prune ;
-
-SYMBOL: crossref
-
-: xref-word ( word -- )
-    dup word-vocabulary [
-        [ uses ] crossref get add-vertex
-    ] [
-        drop
-    ] if ;
-
-: usage ( word -- seq ) crossref get in-edges ;
-
-: reset-props ( word seq -- ) [ remove-word-prop ] each-with ;
-
-: custom-infer? ( word -- ? )
-    dup "infer" word-prop swap "infer-vars" word-prop or ;
-
-: unxref-word* ( word -- )
-    {
-        { [ dup compound? not ] [ drop ] }
-        { [ dup custom-infer? ] [ drop ] }
-        { [ t ] [
-            dup changed-word
-            {
-                "inferred-effect" "inferred-vars"
-                "base-case" "no-effect"
-            } reset-props
-        ] }
-    } cond ;
-
-: unxref-word ( word -- )
-    dup [ usage ] closure [ unxref-word* ] each
-    [ uses ] crossref get remove-vertex ;
-
-: define ( word def primitive -- )
-    pick changed-word
-    pick unxref-word
-    pick set-word-primitive
-    over set-word-def
-    dup update-xt
-    xref-word ;
-
-: define-symbol ( word -- )
-    dup symbol? [ drop ] [ dup 2 define ] if ;
-
-: intern-symbol ( word -- )
-    dup undefined? [ define-symbol ] [ drop ] if ;
-
-: define-compound ( word def -- ) 1 define ;
-
-: reset-word ( word -- )
-    {
-        "parsing" "inline" "foldable"
-        "predicating" "declared-effect"
-    } reset-props ;
-
-: reset-generic ( word -- )
-    dup reset-word { "methods" "combination" } reset-props ;
-
-: <word> ( name vocab -- word ) (word) dup init-word ;
-
-: gensym ( -- word )
-    "G:" \ gensym counter number>string append f <word> ;
-
-: define-temp ( quot -- word )
-    gensym [ swap define-compound ] keep ;
-
-SYMBOL: bootstrapping?
-
-: word ( -- word ) \ word get-global ;
-
-: set-word ( word -- ) \ word set-global ;
-
-: vocabs ( -- seq ) vocabularies get hash-keys natural-sort ;
-
-: ensure-vocab ( name -- ) vocabularies get [ nest drop ] bind ;
-
-: words ( vocab -- seq ) vocab dup [ hash-values ] when ;
-
-: all-words ( -- seq )
-    vocabularies get hash-values [ hash-values ] map concat ;
-
-: xref-words ( -- )
-    all-words [ uses ] crossref get build-graph ;
-
-: create-vocab ( name -- vocab )
-    vocabularies get [ nest ] bind ;
-
-: reveal ( word -- )
-    dup word-name over word-vocabulary create-vocab set-hash ;
-
-TUPLE: check-create name vocab ;
-: check-create ( name vocab -- name vocab )
-    dup string? [ <check-create> throw ] unless
-    over string? [ <check-create> throw ] unless ;
-
-: create ( name vocab -- word )
-    check-create 2dup lookup dup
-    [ 2nip ] [ drop <word> dup reveal ] if ;
-
-: constructor-word ( name vocab -- word )
-    >r "<" swap ">" 3append r> create ;
-
-: forget-vocab ( vocab -- )
-    words [ forget ] each ;
-
-: bootstrap-word ( word -- target )
-    bootstrapping? get [
-        dup word-name swap word-vocabulary
-        dup "syntax" = [ [ CHAR: ! add* ] 2apply ] when lookup
-    ] when ;
-
-: words-named ( str -- seq )
-    all-words [ word-name = ] subset-with ;
-
-! Definition protocol
-M: word where "loc" word-prop ;
-
-M: word subdefs drop f ;
-
-: forget-word ( word -- )
-    dup unxref-word
-    dup remove-word-help
-    dup unchanged-word
-    crossref get [ dupd remove-hash ] when*
-    dup word-name swap word-vocabulary vocab remove-hash ;
-
-M: word forget forget-word ;
diff --git a/core/words.facts b/core/words.facts
deleted file mode 100644 (file)
index fce7235..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-IN: words
-USING: definitions help tools kernel kernel-internals parser
-compiler ;
-
-HELP: execute ( word -- )
-{ $values { "word" "a word" } }
-{ $description "Executes a word." }
-{ $examples
-    { $example ": twice dup execute execute ;\n: hello \"Hello\" print ;\n\\ hello twice" "Hello\nHello" }
-} ;
-
-HELP: word-props ( word -- props )
-{ $values { "word" "a word" } { "props" "a hashtable" } }
-{ $description "Outputs a word's property hashtable." } ;
-
-HELP: set-word-props ( props word -- )
-{ $values { "props" "a hashtable" } { "word" "a word" } }
-{ $description "Sets a word's property hashtable." }
-{ $notes "The given hashtable must not be a literal, since it will get mutated by future calls to " { $link set-word-prop } "." } ;
-
-HELP: word-primitive ( word -- n )
-{ $values { "word" "a word" } { "n" "a non-negative integer" } }
-{ $description "Outputs a word's primitive number." } ;
-
-HELP: set-word-primitive ( n word -- )
-{ $values { "n" "a non-negative integer" } { "word" "a word" } }
-{ $description "Sets a word's primitive number." }
-{ $notes "Changing the primitive number does not update the execution token, and the word will still call its old definition until a subsequent call to " { $link update-xt } "." } ;
-
-HELP: word-def ( word -- obj )
-{ $values { "word" "a word" } { "obj" "an object" } }
-{ $description "Outputs a word's primitive parameter. This parameter is only used if the primitive number is 1 (compound definitions) or 2 (symbols)." } ;
-
-HELP: set-word-def ( obj word -- )
-{ $values { "obj" "an object" } { "word" "a word" } }
-{ $description "Sets a word's primitive parameter." }
-$low-level-note ;
-
-HELP: undefined
-{ $class-description "The class of undefined words created by " { $link POSTPONE: DEFER: } "." }
-{ $see-also POSTPONE: DEFER: } ;
-
-HELP: compound
-{ $description "The class of compound words created by " { $link POSTPONE: : } "." }
-{ $see-also POSTPONE: : define-compound } ;
-
-HELP: primitive
-{ $description "The class of primitive words." } ;
-
-HELP: symbol
-{ $description "The class of symbols created by " { $link POSTPONE: SYMBOL: } "." }
-{ $see-also POSTPONE: SYMBOL: define-symbol intern-symbol } ;
-
-HELP: init-word
-{ $values { "word" "a word" } }
-{ $description "Initializes a word output from the " { $link <word> } " primitive." } ;
-
-HELP: word-prop
-{ $values { "word" "a word" } { "name" "a property name" } { "value" "a property value" } }
-{ $description "Retrieves a word property. Word property names are conventionally strings." } ;
-
-HELP: set-word-prop
-{ $values { "word" "a word" } { "value" "a property value" } { "name" "a property name" } }
-{ $description "Stores a word property. Word property names are conventionally strings." } ;
-
-HELP: remove-word-prop
-{ $values { "word" "a word" } { "name" "a property name" } }
-{ $description "Removes a word property, so future lookups will output " { $link f } " until it is set again. Word property names are conventionally strings." } ;
-
-HELP: word-xt
-{ $values { "word" "a word" } { "xt" "an execution token integer" } }
-{ $description "Outputs the machine code address of the word's definition." } ;
-
-HELP: uses
-{ $values { "word" "a word" } { "seq" "a sequence of words" } }
-{ $description "Outputs a sequence of words directory called by the given word." }
-{ $notes "The sequence will include the word itself if it is recursive." }
-{ $see-also uses } ;
-
-HELP: crossref
-{ $var-description "A graph whose vertices are words and edges are usages. See " { $link "graphs" } "." }
-{ $see-also usage xref-words } ;
-
-HELP: xref-word
-{ $values { "word" "a word" } }
-{ $description "Adds a vertex representing this word, along with edges representing dependencies to the " { $link crossref } " graph." }
-$low-level-note ;
-
-HELP: usage
-{ $values { "word" "a word" } { "seq" "a sequence of words" } }
-{ $description "Outputs a sequence of words that directly call the given word." }
-{ $notes "The sequence will include the word itself if it is recursive." }
-{ $see-also usage } ;
-
-HELP: unxref-word*
-{ $values { "word" "a word" } }
-{ $contract "Updates the word to cope with a callee being redefined." }
-$low-level-note ;
-
-HELP: unxref-word
-{ $values { "word" "a word" } }
-{ $description "Remove the vertex representing the word from the " { $link crossref } " graph." }
-$low-level-note ;
-
-HELP: define
-{ $values { "word" "a word" } { "def" "an object" } { "primitive" "a non-negative integer" } }
-{ $description "Defines a word and updates cross-referencing." }
-$low-level-note
-{ $see-also define-symbol define-compound } ;
-
-HELP: define-symbol
-{ $values { "word" "a word" } }
-{ $description "Defines the word to push itself on the stack when executed." } ;
-
-HELP: intern-symbol
-{ $values { "word" "a word" } }
-{ $description "If the word is undefined, makes it into a symbol which pushes itself on the stack when executed. If the word already has a definition, does nothing." } ;
-
-HELP: define-compound
-{ $values { "word" "a word" } { "def" "a quotation" } }
-{ $description "Defines the word to call a quotation when executed." } ;
-
-HELP: reset-word
-{ $values { "word" "a word" } }
-{ $description "Reset word declarations." }
-$low-level-note ;
-
-HELP: reset-generic
-{ $values { "word" "a word" } }
-{ $description "Reset word declarations and generic word properties." }
-$low-level-note ;
-
-HELP: (word) ( name vocab -- word )
-{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word" } }
-{ $description "Allocates an uninterned word with the specified name and vocabulary. User code should call " { $link gensym } " to create uninterned words and " { $link create } " to create interned words." }
-{ $see-also <word> } ;
-
-HELP: <word>
-{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word" } }
-{ $description "Allocates an uninterned word with the specified name and vocabulary, and a blank word properties hashtable. User code should call " { $link gensym } " to create uninterned words and " { $link create } " to create interned words." } ;
-
-HELP: gensym
-{ $values { "word" "a word" } }
-{ $description "Creates an uninterned word that is not equal to any other word in the system. Gensyms have an automatically-generated name based on a prefix and an incrementing counter." }
-{ $examples { $example "gensym ." "G:260561" } }
-{ $notes "Gensyms are often used as placeholder values that have no meaning of their own but must be unique. For example, the compiler uses gensyms to label sections of assembly code." } ;
-
-HELP: define-temp
-{ $values { "quot" "a quotation" } { "word" "a word" } }
-{ $description "Creates an uninterned word that will call " { $snippet "quot" } " when executed." }
-{ $notes
-    "The following phrases are equivalent:"
-    { $code "[ 2 2 + . ] call" }
-    { $code "[ 2 2 + . ] define-temp execute" }
-} ;
-
-HELP: definer
-{ $values { "word" "a word" } { "definer" "a word" } }
-{ $description "Outputs the parsing word that defines the given word." }
-{ $examples
-    { $example ": foo ; \\ foo definer ." "POSTPONE: :" }
-    { $example "SYMBOL: foo \\ foo definer ." "POSTPONE: SYMBOL:" }
-} ;
-
-HELP: bootstrapping?
-{ $var-description "Set by the library while bootstrap is in progress. Some parsing words need to behave differently during bootstrap." } ;
-
-HELP: vocabularies
-{ $var-description "Holds a hashtable mapping vocabulary names to vocabularies." } ;
-
-HELP: word
-{ $values { "word" "a word" } }
-{ $description "Outputs the most recently defined word." }
-{ $see-also save-location } ;
-
-HELP: set-word
-{ $values { "word" "a word" } }
-{ $description "Sets the recently defined word. Usually you would call " { $link save-location } " on a newly-defined word instead, which will in turn call this word." }
-{ $see-also word } ;
-
-HELP: vocabs
-{ $values { "seq" "a sequence of strings" } }
-{ $description "Outputs a sequence of all defined vocabulary names." } ;
-
-HELP: vocab
-{ $values { "name" "a string" } { "vocab" "a hashtable" } }
-{ $description "Outputs a named vocabulary, or " { $link f } " if no vocabulary with this name exists." } ;
-
-HELP: ensure-vocab
-{ $values { "name" "a string" } }
-{ $description "Creates a vocabulary if it does not already exist." } ;
-
-HELP: words
-{ $values { "vocab" "a string" } { "seq" "a sequence of words" } }
-{ $description "Outputs a sequence of words defined in the vocabulary, or " { $link f } " if no vocabulary with this name exists." } ;
-
-HELP: all-words
-{ $values { "seq" "a sequence of words" } }
-{ $description "Outputs a sequence of all words in the dictionary." } ;
-
-HELP: xref-words
-{ $description "Update the " { $link crossref } " graph of word dependencies. Usually this is done automatically." } ;
-
-HELP: lookup
-{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word or " { $link f } } }
-{ $description "Looks up a word in the dictionary. If the vocabulary or the word is not defined, outputs " { $link f } "." } ;
-
-HELP: reveal
-{ $values { "word" "a word" } }
-{ $description "Adds a newly-created word to the dictionary. Usually this word does not need to be called directly." }
-{ $see-also create } ;
-
-HELP: check-create
-{ $values { "name" "a string" } { "vocab" "a string" } }
-{ $description "Throws a " { $link check-create } " error if " { $snippet "name" } " or " { $snippet "vocab" } " is not a string." }
-{ $error-description "Thrown if " { $link create } " is called with invalid parameters." } ;
-
-HELP: create
-{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word" } }
-{ $description "Creates a new word. Creates the vocabulary first if it does not already exist. If the vocabulary exists and already contains a word with the requested name, outputs the existing word." } ;
-
-HELP: constructor-word
-{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word" } }
-{ $description "Creates a new word, surrounding " { $snippet "name" } " in angle brackets." }
-{ $examples { $example "\"salmon\" \"scratchpad\" constructor-word ." "<salmon>" } } ;
-
-HELP: forget-word
-{ $values { "word" "a word" } }
-{ $description "Removes a word from its vocabulary. User code should call " { $link forget } " instead, since it also does the right thing when forgetting class words." }
-{ $see-also POSTPONE: FORGET: forget-vocab forget } ;
-
-HELP: forget-vocab
-{ $values { "vocab" "a string" } }
-{ $description "Removes a vocabulary. All words in the vocabulary become uninterned." }
-{ $see-also forget } ;
-
-HELP: target-word
-{ $values { "word" "a word" } { "target" "a word" } }
-{ $description "Looks up a word with the same name and vocabulary as the given word. Used during bootstrap to transfer host words to the target dictionary." } ;
-
-HELP: interned?
-{ $values { "word" "a word" } { "?" "a boolean" } }
-{ $description "Test if the word is an interned word." } ;
-
-HELP: bootstrap-word
-{ $values { "word" "a word" } { "target" "a word" } }
-{ $description "Looks up a word with the same name and vocabulary as the given word, performing a transformation to handle parsing words in the target dictionary. Used during bootstrap to transfer host words to the target dictionary." } ;
-
-HELP: update-xt ( word -- )
-{ $values { "word" "a word" } }
-{ $description "Updates a word's execution token based on the value of the " { $link word-primitive } " slot. If the word was compiled, this will lose the compiled definition and make it run in the interpreter." } ;
-
-HELP: changed-words
-{ $var-description "Global variable holding words which need to be recompiled. Implemented as a hashtable where a key equals its value. This hashtable is updated by " { $link define } " when words are redefined, and inspected and cleared by " { $link recompile } "." } ;
diff --git a/core/words/authors.txt b/core/words/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/core/words/summary.txt b/core/words/summary.txt
new file mode 100644 (file)
index 0000000..a2cb938
--- /dev/null
@@ -0,0 +1 @@
+Words are the fundamental units of code
diff --git a/core/words/tags.txt b/core/words/tags.txt
new file mode 100644 (file)
index 0000000..abf53a4
--- /dev/null
@@ -0,0 +1 @@
+reflection
diff --git a/core/words/words-docs.factor b/core/words/words-docs.factor
new file mode 100644 (file)
index 0000000..78f9209
--- /dev/null
@@ -0,0 +1,407 @@
+USING: definitions help.markup help.syntax kernel
+kernel.private parser words.private vocabs classes quotations
+strings effects ;
+IN: words
+
+ARTICLE: "interned-words" "Looking up and creating words"
+"A word is said to be " { $emphasis "interned" } " if it is a member of the vocabulary named by its vocabulary slot. Otherwise, the word is " { $emphasis "uninterned" } "."
+$nl
+"Words whose names are known at parse time -- that is, most words making up your program -- can be referenced in source code by stating their name. However, the parser itself, and sometimes code you write, will need to create look up words dynamically."
+$nl
+"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $vocab-link "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "vocabulary-search" } ")."
+{ $subsection create }
+{ $subsection create-in }
+{ $subsection gensym }
+{ $subsection lookup }
+"Words can output their name and vocabulary:"
+{ $subsection word-name }
+{ $subsection word-vocabulary }
+"Testing if a word object is part of a vocabulary:"
+{ $subsection interned? } ;
+
+ARTICLE: "colon-definition" "Compound definitions"
+"A compound definition associates a word name with a quotation that is called when the word is executed."
+{ $subsection compound }
+{ $subsection compound? }
+"Defining compound words at parse time:"
+{ $subsection POSTPONE: : }
+{ $subsection POSTPONE: ; }
+"Defining compound words at run time:"
+{ $subsection define-compound }
+{ $subsection define-declared }
+{ $subsection define-inline }
+"Compound definitions should declare their stack effect, unless the definition is completely trivial. See " { $link "effect-declaration" } "." ;
+
+ARTICLE: "symbols" "Symbols"
+"A symbol pushes itself on the stack when executed. By convention, symbols are used as variable names (" { $link "namespaces" } ")."
+{ $subsection symbol }
+{ $subsection symbol? }
+"Defining symbols at parse time:"
+{ $subsection POSTPONE: SYMBOL: }
+"Defining symbols at run time:"
+{ $subsection define-symbol } ;
+
+ARTICLE: "primitives" "Primitives"
+"Primitives are words defined in the Factor VM. They provide the essential low-level services to the rest of the system."
+{ $subsection primitive }
+{ $subsection primitive? } ;
+
+ARTICLE: "deferred" "Deferred words and mutual recursion"
+"Words cannot be referenced before they are defined; that is, source files must order definitions in a strictly bottom-up fashion. This is done to simplify the implementation, facilitate better parse-time checking and remove some odd corner cases; it also encourages better coding style. Sometimes this restriction gets in the way, for example when defining mutually-recursive words; one way to get around this limitation is to make a forward definition."
+{ $subsection POSTPONE: DEFER: }
+"The class of forward word definitions:"
+{ $subsection undefined }
+{ $subsection undefined? } ;
+
+ARTICLE: "declarations" "Declarations"
+"Declarations give special behavior to a word. Declarations are parsing words that set a word property in the most recently defined word."
+$nl
+"The first declaration specifies the time when a word runs. It affects both interpreted and compiled definitions."
+{ $subsection POSTPONE: parsing }
+"The remaining declarations only affect compiled definitions. They do not change evaluation semantics of a word, but instead declare that the word follows a certain contract, and thus may be compiled differently."
+{ $warning "If a generic word is declared " { $link POSTPONE: foldable } " or " { $link POSTPONE: flushable } ", all methods must satisfy the contract, otherwise unpredicable behavior will occur." }
+{ $subsection POSTPONE: inline }
+{ $subsection POSTPONE: foldable }
+{ $subsection POSTPONE: flushable }
+"Stack effect declarations are documented in " { $link "effect-declaration" } "." ;
+
+ARTICLE: "word-definition" "Defining words"
+"There are two approaches to creating word definitions:"
+{ $list
+    "using parsing words at parse time,"
+    "using defining words at run time."
+}
+"The latter is a more dynamic feature that can be used to implement code generation and such, and in fact parse time defining words are implemented in terms of run time defining words."
+{ $subsection "colon-definition" }
+{ $subsection "symbols" }
+{ $subsection "primitives" }
+{ $subsection "deferred" }
+{ $subsection "declarations" }
+"Words implement the definition protocol; see " { $link "definitions" } "." ;
+
+ARTICLE: "word-props" "Word properties"
+"Each word has a hashtable of properties."
+{ $subsection word-prop }
+{ $subsection set-word-prop }
+{ $subsection word-props }
+{ $subsection set-word-props }
+"The stack effect of the above two words is designed so that it is most convenient when " { $snippet "name" } " is a literal pushed on the stack right before executing this word."
+$nl
+"The following are some of the properties used by the library:"
+{ $table
+    { "Property" "Documentation" }
+    { { $snippet "\"parsing\"" } { $link "parsing-words" } }
+
+    { { { $snippet "\"inline\"" } ", " { $snippet "\"foldable\"" } ", " { $snippet "flushable" } } { $link "declarations" } }
+
+    { { $snippet "\"loc\"" } { "Location information - " { $link where } } }
+    
+    { { { $snippet "\"methods\"" } ", " { $snippet "\"combination\"" } } { "Set on generic words - " { $link "generic" } } }
+    
+    { { { $snippet "\"reading\"" } ", " { $snippet "\"writing\"" } } { "Set on slot accessor words - " { $link "slots" } } }
+
+    { { $snippet "\"declared-effect\"" } { $link "effect-declaration" } }
+    
+    { { { $snippet "\"help\"" } ", " { $snippet "\"help-loc\"" } ", " { $snippet "\"help-parent\"" } } { "Where word help is stored - " { $link "writing-help" } } }
+
+    { { $snippet "\"infer\"" } { $link "compiler-transforms" } }
+
+    { { { $snippet "\"inferred-effect\"" } } { $link "inference" } }
+
+    { { $snippet "\"specializer\"" } { $link "specializers" } }
+    
+    { { { $snippet "\"intrinsics\"" } ", " { $snippet "\"if-intrinsics\"" } } { $link "generator" } }
+
+    { { $snippet "\"predicating\"" } " Set on class predicates, stores the corresponding class word" }
+    
+    { { { $snippet "\"constructing\"" } ", " { $snippet "\"constructor-quot\"" } } { $link "tuple-constructors" } }
+}
+"Properties which are defined for classes only:"
+{ $table
+    { "Property" "Documentation" }
+    { { $snippet "\"class\"" } { "A boolean indicating whether this word is a class - " { $link "classes" } } }
+
+    { { $snippet "\"coercer\"" } { "A quotation for converting the top of the stack to an instance of this class" } }
+    
+    { { $snippet "\"constructor\"" } { $link "tuple-constructors" } }
+    
+    { { $snippet "\"slot-names\"" } { $link "tuples" } }
+    
+    { { $snippet "\"type\"" } { $link "builtin-classes" } }
+    
+    { { { $snippet "\"superclass\"" } ", " { $snippet "\"predicate-definition\"" } } { $link "predicates" } }
+    
+    { { $snippet "\"members\"" } { $link "unions" } }
+
+    { { $snippet "\"slots\"" } { $link "slots" } }
+
+    { { $snippet "\"predicate\"" } { "A quotation that tests if the top of the stack is an instance of this class - " { $link "class-predicates" } } }
+} ;
+
+ARTICLE: "word.private" "Word implementation details"
+"Primitive definition accessors:"
+{ $subsection word-def }
+{ $subsection set-word-def }
+"An " { $emphasis "XT" } " (execution token) is the machine code address of a word:"
+{ $subsection word-xt }
+{ $subsection update-xt } ;
+
+ARTICLE: "words" "Words"
+"Words are the Factor equivalent of functions or procedures; a word is a body of code with a unique name and some additional meta-data. Words are defined in the " { $vocab-link "words" } " vocabulary."
+$nl
+"A word consists of several parts:"
+{ $list
+    "a word name,"
+    "a vocabulary name,"
+    "a definition, specifying the behavior of the word when executed,"
+    "a set of word properties, including documentation and other meta-data."
+}
+"Words are instances of a class."
+{ $subsection word }
+{ $subsection word? }
+{ $subsection "interned-words" }
+{ $subsection "word-definition" }
+{ $subsection "word.private" }
+{ $see-also "vocabularies" "vocabs.loader" "definitions" } ;
+
+ABOUT: "words"
+
+HELP: compiled? ( word -- ? )
+{ $values { "word" word } { "?" "a boolean" } }
+{ $description "Tests if a word has been compiled." } ;
+
+HELP: execute ( word -- )
+{ $values { "word" word } }
+{ $description "Executes a word." }
+{ $examples
+    { $example ": twice dup execute execute ;\n: hello \"Hello\" print ;\n\\ hello twice" "Hello\nHello" }
+} ;
+
+HELP: word-props ( word -- props )
+{ $values { "word" word } { "props" "an assoc" } }
+{ $description "Outputs a word's property table." } ;
+
+HELP: set-word-props ( props word -- )
+{ $values { "props" "an assoc" } { "word" word } }
+{ $description "Sets a word's property table." }
+{ $notes "The given assoc must not be a literal, since it will be mutated by future calls to " { $link set-word-prop } "." }
+{ $side-effects "word" } ;
+
+HELP: word-def ( word -- obj )
+{ $values { "word" word } { "obj" object } }
+{ $description "Outputs a word's primitive definition." } ;
+
+HELP: set-word-def ( obj word -- )
+{ $values { "obj" object } { "word" word } }
+{ $description "Sets a word's primitive definition." }
+$low-level-note
+{ $side-effects "word" } ;
+
+HELP: undefined
+{ $class-description "The class of undefined words created by " { $link POSTPONE: DEFER: } "." } ;
+
+{ undefined POSTPONE: DEFER: } related-words
+
+HELP: compound
+{ $description "The class of compound words created by " { $link POSTPONE: : } "." } ;
+
+HELP: primitive
+{ $description "The class of primitive words." } ;
+
+HELP: symbol
+{ $description "The class of symbols created by " { $link POSTPONE: SYMBOL: } "." } ;
+
+HELP: word-prop
+{ $values { "word" word } { "name" "a property name" } { "value" "a property value" } }
+{ $description "Retrieves a word property. Word property names are conventionally strings." } ;
+
+HELP: set-word-prop
+{ $values { "word" word } { "value" "a property value" } { "name" "a property name" } }
+{ $description "Stores a word property. Word property names are conventionally strings." }
+{ $side-effects "word" } ;
+
+HELP: remove-word-prop
+{ $values { "word" word } { "name" "a property name" } }
+{ $description "Removes a word property, so future lookups will output " { $link f } " until it is set again. Word property names are conventionally strings." }
+{ $side-effects "word" } ;
+
+HELP: word-xt
+{ $values { "word" word } { "xt" "an execution token integer" } }
+{ $description "Outputs the machine code address of the word's definition." } ;
+
+HELP: define
+{ $values { "word" word } { "def" object } }
+{ $description "Defines a word and updates cross-referencing." }
+$low-level-note
+{ $side-effects "word" }
+{ $see-also define-symbol define-compound } ;
+
+HELP: define-symbol
+{ $values { "word" word } }
+{ $description "Defines the word to push itself on the stack when executed." }
+{ $side-effects "word" } ;
+
+HELP: intern-symbol
+{ $values { "word" word } }
+{ $description "If the word is undefined, makes it into a symbol which pushes itself on the stack when executed. If the word already has a definition, does nothing." } ;
+
+HELP: define-compound
+{ $values { "word" word } { "def" quotation } }
+{ $description "Defines the word to call a quotation when executed." }
+{ $side-effects "word" } ;
+
+HELP: reset-props
+{ $values { "word" word } { "seq" "a sequence of word property names" } }
+{ $description "Removes all listed word properties from the word." }
+{ $side-effects "word" } ;
+
+HELP: reset-word
+{ $values { "word" word } }
+{ $description "Reset word declarations." }
+$low-level-note
+{ $side-effects "word" } ;
+
+HELP: reset-generic
+{ $values { "word" word } }
+{ $description "Reset word declarations and generic word properties." }
+$low-level-note
+{ $side-effects "word" } ;
+
+HELP: <word>
+{ $values { "name" string } { "vocab" string } { "word" word } }
+{ $description "Allocates an uninterned word with the specified name and vocabulary, and a blank word property hashtable. User code should call " { $link gensym } " to create uninterned words and " { $link create } " to create interned words." } ;
+
+HELP: gensym
+{ $values { "word" word } }
+{ $description "Creates an uninterned word that is not equal to any other word in the system. Gensyms have an automatically-generated name based on a prefix and an incrementing counter." }
+{ $examples { $unchecked-example "gensym ." "G:260561" } }
+{ $notes "Gensyms are often used as placeholder values that have no meaning of their own but must be unique. For example, the compiler uses gensyms to label sections of code." } ;
+
+HELP: define-temp
+{ $values { "quot" quotation } { "word" word } }
+{ $description "Creates an uninterned word that will call " { $snippet "quot" } " when executed." }
+{ $notes
+    "The following phrases are equivalent:"
+    { $code "[ 2 2 + . ] call" }
+    { $code "[ 2 2 + . ] define-temp execute" }
+} ;
+
+HELP: bootstrapping?
+{ $var-description "Set by the library while bootstrap is in progress. Some parsing words need to behave differently during bootstrap." } ;
+
+HELP: word
+{ $values { "word" word } }
+{ $description "Outputs the most recently defined word." }
+{ $class-description "The class of words. One notable subclass is " { $link class } ", the class of class words." } ;
+
+{ word set-word save-location } related-words
+
+HELP: set-word
+{ $values { "word" word } }
+{ $description "Sets the recently defined word. Usually you would call " { $link save-location } " on a newly-defined word instead, which will in turn call this word." } ;
+
+HELP: lookup
+{ $values { "name" string } { "vocab" string } { "word" "a word or " { $link f } } }
+{ $description "Looks up a word in the dictionary. If the vocabulary or the word is not defined, outputs " { $link f } "." } ;
+
+HELP: reveal
+{ $values { "word" word } }
+{ $description "Adds a newly-created word to the dictionary. Usually this word does not need to be called directly, and is only called as part of " { $link create } "." } ;
+
+HELP: check-create
+{ $values { "name" string } { "vocab" string } }
+{ $description "Throws a " { $link check-create } " error if " { $snippet "name" } " or " { $snippet "vocab" } " is not a string." }
+{ $error-description "Thrown if " { $link create } " is called with invalid parameters." } ;
+
+HELP: create
+{ $values { "name" string } { "vocab" string } { "word" word } }
+{ $description "Creates a new word. If the vocabulary already contains a word with the requested name, outputs the existing word. The vocabulary must exist already; if it does not, you must call " { $link create-vocab } " first." } ;
+
+HELP: constructor-word
+{ $values { "name" string } { "vocab" string } { "word" word } }
+{ $description "Creates a new word, surrounding " { $snippet "name" } " in angle brackets." }
+{ $examples { $example "\"salmon\" \"scratchpad\" constructor-word ." "<salmon>" } } ;
+
+HELP: forget-word
+{ $values { "word" word } }
+{ $description "Removes a word from its vocabulary. User code should call " { $link forget } " instead, since it also does the right thing when forgetting class words." } ;
+
+{ POSTPONE: FORGET: forget forget-word forget-vocab } related-words
+
+HELP: target-word
+{ $values { "word" word } { "target" word } }
+{ $description "Looks up a word with the same name and vocabulary as the given word. Used during bootstrap to transfer host words to the target dictionary." } ;
+
+HELP: bootstrap-word
+{ $values { "word" word } { "target" word } }
+{ $description "Looks up a word with the same name and vocabulary as the given word, performing a transformation to handle parsing words in the target dictionary. Used during bootstrap to transfer host words to the target dictionary." } ;
+
+HELP: update-xt ( word -- )
+{ $values { "word" word } }
+{ $description "Updates a word's execution token based on the value of the " { $link word-def } " slot. If the word was compiled by the optimizing compiler, this forces the word to revert to its unoptimized definition." }
+{ $side-effects "word" } ;
+
+HELP: parsing?
+{ $values { "obj" object } { "?" "a boolean" } }
+{ $description "Tests if an object is a parsing word declared by " { $link POSTPONE: parsing } "." }
+{ $notes "Outputs " { $link f } " if the object is not a word." } ;
+
+HELP: word-changed?
+{ $values { "word" word } { "?" "a boolean" } }
+{ $description "Tests if a word needs to be recompiled." } ;
+
+HELP: changed-word
+{ $values { "word" word } }
+{ $description "Marks a word as needing recompilation by adding it to the " { $link changed-words } " assoc." }
+$low-level-note ;
+
+HELP: unchanged-word
+{ $values { "word" word } }
+{ $description "Marks a word as no longer needing recompilation by removing it from the " { $link changed-words } " assoc." }
+$low-level-note ;
+
+HELP: define-declared
+{ $values { "word" word } { "def" quotation } { "effect" effect } }
+{ $description "Defines a compound word and declares its stack effect." }
+{ $side-effects "word" } ;
+
+HELP: quot-uses
+{ $values { "quot" quotation } { "assoc" "an assoc with words as keys" } }
+{ $description "Outputs a set of words referenced by the quotation and any quotations it contains." } ;
+
+HELP: delimiter?
+{ $values { "obj" object } { "?" "a boolean" } }
+{ $description "Tests if an object is a delimiter word declared by " { $link POSTPONE: delimiter } "." }
+{ $notes "Outputs " { $link f } " if the object is not a word." } ;
+
+HELP: interned
+{ $class-description "The class of words defined in the " { $link dictionary } "." }
+{ $examples
+    { $example "\\ + interned? ." "t" }
+    { $example "gensym interned? ." "f" }
+} ;
+
+HELP: rename-word
+{ $values { "word" word } { "newname" string } { "newvocab" string } }
+{ $description "Changes the name and vocabulary of a word, and adds it to its new vocabulary." }
+{ $side-effects "word" } ;
+
+HELP: make-flushable
+{ $values { "word" word } }
+{ $description "Declares a word as " { $link POSTPONE: flushable } "." }
+{ $side-effects "word" } ;
+
+HELP: make-foldable
+{ $values { "word" word } }
+{ $description "Declares a word as " { $link POSTPONE: foldable } "." }
+{ $side-effects "word" } ;
+
+HELP: make-inline
+{ $values { "word" word } }
+{ $description "Declares a word as " { $link POSTPONE: inline } "." }
+{ $side-effects "word" } ;
+
+HELP: define-inline
+{ $values { "word" word } { "quot" quotation } }
+{ $description "Defines a compound word and makes it " { $link POSTPONE: inline } "." }
+{ $side-effects "word" } ;
diff --git a/core/words/words-tests.factor b/core/words/words-tests.factor
new file mode 100644 (file)
index 0000000..85c6c81
--- /dev/null
@@ -0,0 +1,145 @@
+USING: arrays generic assocs kernel math namespaces
+sequences tools.test words definitions parser quotations
+vocabs continuations ;
+IN: temporary
+
+[ 4 ] [
+    "poo" "scratchpad" create [ 2 2 + ] define-compound
+    "poo" "scratchpad" lookup execute
+] unit-test
+
+[ t ] [ t vocabs [ words [ word? and ] each ] each ] unit-test
+
+DEFER: plist-test
+
+[ t ] [
+    \ plist-test t "sample-property" set-word-prop
+    \ plist-test "sample-property" word-prop
+] unit-test
+
+[ f ] [
+    \ plist-test f "sample-property" set-word-prop
+    \ plist-test "sample-property" word-prop
+] unit-test
+
+[ f ] [ 5 compound? ] unit-test
+
+"create-test" "scratchpad" create { 1 2 } "testing" set-word-prop
+[ { 1 2 } ] [
+    "create-test" "scratchpad" lookup "testing" word-prop
+] unit-test
+
+[
+    [ t ] [ \ array? "array?" "arrays" lookup = ] unit-test
+
+    "test-scope" "scratchpad" create drop
+] with-scope
+
+[ "test-scope" ] [
+    "test-scope" "scratchpad" lookup word-name
+] unit-test
+
+[ t ] [ vocabs array? ] unit-test
+[ t ] [ vocabs [ words [ word? ] all? ] all? ] unit-test
+
+[ f ] [ gensym gensym = ] unit-test
+
+[ f ] [ 123 compound? ] unit-test
+
+: colon-def ;
+[ t ] [ \ colon-def compound? ] unit-test
+
+SYMBOL: a-symbol
+[ f ] [ \ a-symbol compound? ] unit-test
+[ t ] [ \ a-symbol symbol? ] unit-test
+
+! See if redefining a generic as a colon def clears some
+! word props.
+GENERIC: testing
+"IN: temporary : testing ;" eval
+
+[ f ] [ \ testing generic? ] unit-test
+
+[ f ] [ gensym interned? ] unit-test
+
+: forgotten ;
+: another-forgotten ;
+
+[ f ] [ \ forgotten interned? ] unit-test
+
+FORGET: forgotten
+
+[ f ] [ \ another-forgotten interned? ] unit-test
+
+FORGET: another-forgotten
+: another-forgotten ;
+
+[ t ] [ \ + interned? ] unit-test
+
+! I forgot remove-crossref calls!
+: fee ;
+: foe fee ;
+: fie foe ;
+
+[ t ] [ \ fee usage [ word? ] subset empty? ] unit-test
+[ t ] [ \ foe usage empty? ] unit-test
+[ f ] [ \ foe crossref get key? ] unit-test
+
+FORGET: foe
+
+! xref should not retain references to gensyms
+gensym [ * ] define-compound
+
+[ t ] [
+    \ * usage [ word? ] subset [ interned? not ] subset empty?
+] unit-test
+
+DEFER: calls-a-gensym
+\ calls-a-gensym gensym dup "x" set 1quotation define-compound
+[ f ] [ "x" get crossref get at ] unit-test
+
+! more xref buggery
+[ f ] [
+    GENERIC: xyzzle ( x -- x )
+    : a ; \ a
+    M: integer xyzzle a ;
+    FORGET: a
+    M: object xyzzle ;
+    crossref get at
+] unit-test
+
+! regression
+GENERIC: freakish ( x -- y )
+: bar freakish ;
+M: array freakish ;
+[ t ] [ \ bar \ freakish usage member? ] unit-test
+
+DEFER: x
+[ t ] [ [ x ] catch third \ x eq? ] unit-test
+
+[ ] [ "no-loc" "temporary" create drop ] unit-test
+[ f ] [ "no-loc" "temporary" lookup where ] unit-test
+
+[ ] [ "IN: temporary : no-loc-2 ;" eval ] unit-test
+[ f ] [ "no-loc-2" "temporary" lookup where ] unit-test
+
+[ ] [ "IN: temporary : test-last ( -- ) ;" eval ] unit-test
+[ "test-last" ] [ word word-name ] unit-test
+
+[ t ] [
+    changed-words get assoc-size
+    [ ] define-temp drop
+    changed-words get assoc-size =
+] unit-test
+
+! regression
+SYMBOL: quot-uses-a
+SYMBOL: quot-uses-b
+
+quot-uses-a [ 2 3 + ] define-compound
+
+[ { + } ] [ \ quot-uses-a uses ] unit-test
+
+quot-uses-b 2 [ 3 + ] curry define-compound
+
+[ { + } ] [ \ quot-uses-b uses ] unit-test
diff --git a/core/words/words.factor b/core/words/words.factor
new file mode 100644 (file)
index 0000000..342b205
--- /dev/null
@@ -0,0 +1,218 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: words
+USING: arrays definitions graphs assocs kernel kernel.private
+slots.private math namespaces sequences strings vectors sbufs
+quotations assocs hashtables sorting math.parser words.private
+vocabs ;
+
+GENERIC: execute ( word -- )
+
+M: word execute (execute) ;
+
+: word ( -- word ) \ word get-global ;
+
+: set-word ( word -- ) \ word set-global ;
+
+! Used by the compiler
+SYMBOL: changed-words
+
+: word-changed? ( word -- ? )
+    changed-words get [ key? ] [ drop f ] if* ;
+
+: changed-word ( word -- )
+    dup changed-words get [ set-at ] [ 2drop ] if* ;
+
+: unchanged-word ( word -- )
+    changed-words get [ delete-at ] [ drop ] if* ;
+
+M: word <=>
+    [ dup word-name swap word-vocabulary 2array ] compare ;
+
+M: word definition drop f ;
+
+PREDICATE: word undefined ( obj -- ? ) word-def not ;
+M: undefined definer drop \ DEFER: f ;
+
+PREDICATE: word compound  ( obj -- ? ) word-def quotation? ;
+
+M: compound definer drop \ : \ ; ;
+
+M: compound definition word-def ;
+
+PREDICATE: word primitive ( obj -- ? ) word-def fixnum? ;
+M: primitive definer drop \ PRIMITIVE: f ;
+
+PREDICATE: word symbol    ( obj -- ? ) word-def t eq? ;
+M: symbol definer drop \ SYMBOL: f ;
+
+: word-prop ( word name -- value ) swap word-props at ;
+
+: remove-word-prop ( word name -- )
+    swap word-props delete-at ;
+
+: set-word-prop ( word value name -- )
+    over
+    [ pick word-props ?set-at swap set-word-props ]
+    [ nip remove-word-prop ] if ;
+
+: reset-props ( word seq -- ) [ remove-word-prop ] curry* each ;
+
+: lookup ( name vocab -- word ) vocab-words at ;
+
+: target-word ( word -- target )
+    dup word-name swap word-vocabulary lookup ;
+
+SYMBOL: bootstrapping?
+
+: if-bootstrapping ( true false -- )
+    bootstrapping? get -rot if ; inline
+
+: bootstrap-word ( word -- target )
+    [ target-word ] [ ] if-bootstrapping ;
+
+PREDICATE: word interned dup target-word eq? ;
+
+GENERIC# (quot-uses) 1 ( obj assoc -- )
+
+M: object (quot-uses) 2drop ;
+
+M: interned (quot-uses) dupd set-at ;
+
+: seq-uses ( seq assoc -- ) [ (quot-uses) ] curry each ;
+
+M: array (quot-uses) seq-uses ;
+
+M: callable (quot-uses) seq-uses ;
+
+M: wrapper (quot-uses) >r wrapped r> (quot-uses) ;
+
+: quot-uses ( quot -- assoc )
+    global [ H{ } clone [ (quot-uses) ] keep ] bind ;
+
+M: word uses ( word -- seq )
+    word-def quot-uses keys ;
+
+M: compound redefined* ( word -- )
+    dup changed-word
+    { "inferred-effect" "base-case" "no-effect" } reset-props ;
+
+<PRIVATE
+
+: definition-changed? ( word def -- ? )
+    swap word-def = not ;
+
+: define ( word def -- )
+    2dup definition-changed? [
+        over redefined
+        over unxref
+        over set-word-def
+        dup update-xt
+        dup word-vocabulary [
+            dup changed-word dup xref
+        ] when drop
+    ] [
+        2drop
+    ] if ;
+
+PRIVATE>
+
+: define-symbol ( word -- ) t define ;
+
+: intern-symbol ( word -- )
+    dup undefined? [ define-symbol ] [ drop ] if ;
+
+: define-compound ( word def -- ) [ ] like define ;
+
+: define-declared ( word def effect -- )
+    pick swap "declared-effect" set-word-prop
+    define-compound ;
+
+: make-inline ( word -- )
+    t "inline" set-word-prop ;
+
+: make-flushable ( word -- )
+    t "flushable" set-word-prop ;
+
+: make-foldable ( word -- )
+    dup make-flushable t "foldable" set-word-prop ;
+
+: define-inline ( word quot -- )
+    dupd define-compound make-inline ;
+
+: reset-word ( word -- )
+    {
+        "parsing" "inline" "foldable"
+        "predicating"
+        "reading" "writing"
+        "constructing"
+        "declared-effect" "constructor-quot" "delimiter"
+    } reset-props ;
+
+: reset-generic ( word -- )
+    dup reset-word { "methods" "combination" } reset-props ;
+
+: gensym ( -- word )
+    "G:" \ gensym counter number>string append f <word> ;
+
+: define-temp ( quot -- word )
+    gensym [ swap define-compound ] keep ;
+
+: reveal ( word -- )
+    dup word-name over word-vocabulary vocab-words set-at ;
+
+TUPLE: check-create name vocab ;
+
+: check-create ( name vocab -- name vocab )
+    2dup [ string? ] both? [
+        \ check-create construct-boa throw
+    ] unless ;
+
+: create ( name vocab -- word )
+    check-create 2dup lookup
+    dup [ 2nip ] [ drop <word> dup reveal ] if ;
+
+: constructor-word ( name vocab -- word )
+    >r "<" swap ">" 3append r> create ;
+
+: parsing? ( obj -- ? )
+    dup word? [ "parsing" word-prop ] [ drop f ] if ;
+
+: delimiter? ( obj -- ? )
+    dup word? [ "delimiter" word-prop ] [ drop f ] if ;
+
+! Definition protocol
+M: word where "loc" word-prop ;
+
+M: word set-where swap "loc" set-word-prop ;
+
+GENERIC: (forget-word) ( word -- )
+
+M: interned (forget-word)
+    dup word-name swap word-vocabulary vocab-words delete-at ;
+
+M: word (forget-word)
+    drop ;
+
+: rename-word ( word newname newvocab -- )
+    pick (forget-word)
+    pick set-word-vocabulary
+    over set-word-name
+    reveal ;
+
+: forget-word ( word -- )
+    dup f "methods" set-word-prop
+    dup delete-xref
+    dup unchanged-word
+    (forget-word) ;
+
+M: word forget forget-word ;
+
+M: word hashcode*
+    nip 1 slot { fixnum } declare ;
+
+M: word literalize <wrapper> ;
+
+: ?word-name dup word? [ word-name ] when ;
+
+: xref-words ( -- ) all-words [ xref ] each ;
diff --git a/cp_dir b/cp_dir
index bcb40af43a0bb69c1fd320fe53b9ceab416327c0..76c8a8f03b5737bd4166145d319cc64fb2cd1483 100644 (file)
--- a/cp_dir
+++ b/cp_dir
@@ -1,4 +1,5 @@
 #!/bin/sh
 
-mkdir -p `dirname $2`
-cp $1 $2
+echo $1
+mkdir -p "`dirname \"$2\"`"
+cp "$1" "$2"
diff --git a/demos/all.factor b/demos/all.factor
deleted file mode 100644 (file)
index 023ef66..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-REQUIRES: demos/color-picker demos/haar demos/lcd demos/nehe
-demos/numbers-game demos/hello-world demos/mslug-talk demos/rot13 ;
-
-PROVIDE: demos/all ;
diff --git a/demos/cocoa/speech.factor b/demos/cocoa/speech.factor
deleted file mode 100644 (file)
index 34afd40..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc-classes
-DEFER: NSSpeechSynthesizer
-
-IN: cocoa-speech
-USING: cocoa objc objc-classes kernel ;
-
-"NSSpeechSynthesizer" f import-objc-class
-
-: say ( string -- )
-       NSSpeechSynthesizer -> alloc f -> initWithVoice: swap
-    <NSString> -> startSpeakingString: drop ;
-
-"Hello from Factor" say
diff --git a/demos/color-picker.factor b/demos/color-picker.factor
deleted file mode 100644 (file)
index 4e79535..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: color-picker
-USING: gadgets-sliders gadgets-labels gadgets models arrays
-namespaces kernel math prettyprint sequences ;
-
-! Simple example demonstrating the use of models.
-
-: <color-slider> ( -- gadget )
-    <x-slider>
-    1 over set-slider-line
-    255 over set-slider-max ;
-
-: <color-preview> ( model -- gadget )
-    <gadget> { 100 100 } over set-rect-dim
-    [ set-gadget-interior ] <control> ;
-
-: <color-model> ( model -- model )
-    [ [ 256 /f ] map 1 add <solid> ] <filter> ;
-
-: <color-sliders> ( -- model gadget )
-    [
-        <color-slider> dup , control-model
-        <color-slider> dup , control-model
-        <color-slider> dup , control-model
-        3array <compose>
-    ] { } make make-pile 1 over set-pack-fill ;
-
-: <color-picker> ( -- gadget )
-    {
-        { [ <color-sliders> ] f f @top }
-        { [ dup <color-model> <color-preview> ] f f @center }
-        { [ [ unparse ] <filter> <label-control> ] f f @bottom }
-    } make-frame ;
-
-PROVIDE: demos/color-picker ;
-
-MAIN: demos/color-picker
-    <color-picker> "Color Picker" open-titled-window ;
diff --git a/demos/haar.factor b/demos/haar.factor
deleted file mode 100644 (file)
index 67a85b7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Haar wavelet transform -- http://dmr.ath.cx/gfx/haar/
-IN: haar
-USING: sequences math kernel ;
-
-: averages ( seq -- seq )
-    [ first2 + 2 / ] map ;
-
-: differences ( seq averages -- differences )
-    >r 0 <column> r> [ - ] 2map ;
-
-: haar-step ( seq -- differences averages )
-    2 group dup averages [ differences ] keep ;
-
-: haar ( seq -- seq )
-    dup length 1 <= [ haar-step haar swap append ] unless ;
-
-PROVIDE: demos/haar ;
diff --git a/demos/hello-world.factor b/demos/hello-world.factor
deleted file mode 100644 (file)
index 881d099..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-! This is a bit more complex than the simplest hello world,
-! which is:
-!   "Hello World" print
-! Instead, we define a module, and a main entry hook; when you
-! run the module in the listener with the following command,
-!   "demos/hello-world" run-module
-! It prints the above message.
-
-USING: io ;
-PROVIDE: demos/hello-world ;
-MAIN: demos/hello-world "Hello World" print ;
diff --git a/demos/lcd.factor b/demos/lcd.factor
deleted file mode 100644 (file)
index cf96ebb..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-USING: sequences kernel math io ;
-
-: lcd-digit ( digit row -- str )
-    {
-        "  _       _  _       _   _   _   _   _  "
-        " | |  |   _| _| |_| |_  |_    | |_| |_| "     
-        " |_|  |  |_  _|   |  _| |_|   | |_|   | "
-    } nth >r 4 * dup 4 + r> subseq ;
-
-: lcd-row ( num row -- )
-    swap [ CHAR: 0 - swap lcd-digit write ] each-with ;
-
-: lcd ( digit-str -- )
-    3 [ 2dup lcd-row terpri ] repeat drop ;
-
-PROVIDE: demos/lcd ;
-
-MAIN: demos/lcd "31337" lcd ;
diff --git a/demos/mslug-talk.factor b/demos/mslug-talk.factor
deleted file mode 100644 (file)
index 7cdc95f..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-! Slava Pestov's presentation at the Montreal Scheme/Lisp User's
-! Group, November 22nd 2006.
-
-! http://schemeway.dyndns.org/mslug/mslug-home
-
-USING: gadgets gadgets-books gadgets-borders gadgets-buttons
-gadgets-text gadgets-labels gadgets gadgets-panes
-gadgets-presentations gadgets-theme generic kernel math
-namespaces sequences strings styles models help io arrays
-hashtables modules ;
-IN: mslug
-
-: mslug-stylesheet
-    H{
-        { default-style
-            H{
-                { font "serif" }
-                { font-size 24 }
-                { wrap-margin 700 }
-            }
-        }
-        { code-style
-            H{
-                { font "monospace" }
-                { font-size 24 }
-                { page-color { 0.4 0.4 0.4 0.3 } }
-            }
-        }
-        { table-content-style
-            H{ { wrap-margin 700 } }
-        }
-        { bullet "\u00b7 " }
-    } ;
-
-: $title ( string -- )
-    [ H{ { font "serif" } { font-size 36 } } format ] ($block) ;
-
-: $divider ( -- )
-    [
-        <gadget>
-        T{ gradient f { { 0.25 0.25 0.25 1.0 } { 1.0 1.0 1.0 1.0 } } }
-        over set-gadget-interior
-        { 750 10 } over set-gadget-dim
-        { 1 0 } over set-gadget-orientation
-        gadget.
-    ] ($block) ;
-
-: page-theme
-    T{ gradient f { { 0.8 0.8 1.0 1.0 } { 1.0 0.8 1.0 1.0 } } }
-    swap set-gadget-interior ;
-
-: <page> ( list -- gadget )
-    [
-        mslug-stylesheet clone [
-            [ print-element ] with-default-style
-        ] bind
-    ] make-pane
-    dup page-theme ;
-
-: $slide ( element -- )
-    unclip $title
-    $divider
-    $list ;
-
-: $module ( element -- )
-    first dup module [ write ] ($code) ;
-
-: slides
-{
-{ $slide "Factor programming language"
-    "Inspirations: Forth, Joy, Common Lisp, others..."
-    "Powerful language features"
-    "Interactive development"
-    "Stack-based"
-    "Syntax: ``s-expressions''"
-    "Code is data"
-    { "Simple evaluation semantics; left to right:"
-    { $code "2 3 + 7 * 9 /" } }
-    "Functions are called ``words''"
-    "Vocabularies"
-    "Short definitions, heavy reuse"
-}
-{ $slide "First program"
-    {
-        "Functional ``hello world'':"
-        { $code
-            ": factorial ( n -- n! )"
-            "    dup 0 <= ["
-            "        drop 1"
-            "    ] ["
-            "        dup 1 - factorial *"
-            "    ] if ;"
-        }
-    }
-    "Shuffle words, conditionals, recursion, code as parameters..."
-    "Bignums!"
-    { $code "100 factorial ." }
-    "Reflection:"
-    { $code "\\ factorial see" }
-}
-{ $slide "Data types - sequences"
-    { "Sequences: everything is an array"
-    { $code "{ 1 2 3 } { t f } append reverse ." } }
-    { "Familiar higher order functions"
-    { $code "{ { 1 2 } { 3 4 } } [ reverse ] map ." } }
-    { "Integers are sequences, too:"
-    { $code "100 [ sq ] map ." }
-    { $code "100 [ 4 mod 3 = ] subset ." }
-    { $code "0 100 [ 1 + * ] reduce ." } }
-}
-{ $slide "Data types - hashtables"
-    "Hashtables: literal syntax, utility words, higher-order combinators..."
-    { $code
-        "H{ { \"grass\" \"green\" } { \"chicken\" \"white\" } }"
-        "H{ { \"carrot\" \"orange\" } }"
-        "hash-union"
-    }
-    "Option+h"
-    "Prettyprinter -vs- inspector"
-}
-{ $slide "Data types - others"
-    "Queues, graphs, splay trees, double linked lists, lazy lists..."
-}
-{ $slide "Variables"
-    "Dynamic scope"
-    { $code "SYMBOL: foo" "5 foo set" "foo get ." }
-    { $code "SYMBOL: foo" "[ 6 foo set foo get ] with-scope" }
-    "Dynamic scope can be analyzed statically:"
-    { $code "SYMBOL: bar" "bar get sq foo set" }
-}
-{ $slide "Encapsulating variable usage"
-    { "Stream-like sequence construction:"
-    { $code
-        ": print-name ( name -- )"
-        "    [ \"Greetings, \" % % \".\" % ] \"\" make print ;"
-    } }
-    "Key factors:"
-    { $code "%" }
-    { $code "[ % ] \"\" make" }
-    { "Also, I/O:"
-    { $code ": 100-bytes [ 100 read ] with-stream ;" "\"foo.txt\" <file-reader> 100-bytes" } }
-}
-{ $slide "Custom data types"
-    { "Built-in classes: " { $link integer } ", " { $link array } ", " { $link hashtable } "..." }
-    { "You can define your own:"
-        { $code "TUPLE: rectangle w h ;" "TUPLE: circle r ;" }
-    }
-    { $code "100 200 <rectangle>" }
-    { $code "rectangle-w ." }
-}
-{ $slide "Polymorphism"
-    { "Generic words:"
-        { $code
-            "GENERIC: area ( shape -- n )"
-            "M: rectangle area"
-            "    dup rectangle-w swap rectangle-h * ;"
-            "M: circle area circle-r sq pi * ;"
-        }
-    }
-    { "Methods in classes -vs- methods in functions?" }
-    { "Both: " { $link array } " -vs- " { $link nth } }
-}
-{ $slide "More polymorphism"
-    "Tuples can have custom constructor words"
-    { "Delegation instead of inheritance"
-    { $code
-        "TUPLE: colored-shape color ;"
-        "C: colored-shape ( shape color -- shape )"
-        "    [ set-colored-shape-color ] keep"
-        "    [ set-delegate ] keep ;"
-    } }
-    { $code "100 200 <rectangle>" "{ 0.5 0.5 1 } <colored-shape>" "area ." }
-    "Advanced features: predicate classes, union classes, method combination"
-}
-{ $slide "The Factor UI"
-    "Factor UI is totally implemented in Factor"
-    "OpenGL, FreeType, plus platform-specific code"
-    { "Gadgets:"
-    { $code
-        "USING: gadgets gadgets-labels ;"
-        "\"Hello world\" <label> \"Hi\" open-titled-window"
-    } }
-    "Presentations and operations"
-    "Models"
-}
-{ $slide "Models"
-    { $code
-        "USING: models gadgets-scrolling gadgets-text ;"
-    }
-    "Create an editor, wrap it in a scroller:"
-    { $code
-        "<editor>"
-    }
-    "Length filter:"
-    { $code "dup control-model"
-        "[ concat length number>string ] <filter>"
-    }
-}
-{ $slide "Models continued"
-    "Layout:"
-    { $code "{"
-    "    { [ <label-control> ] f f @top }"
-    "    { [ <scroller> ] f f @center }"
-    "} make-frame"
-    }
-    "Window:"
-    { $code
-    "\"Model test\" open-titled-window"
-    }
-}
-{ $slide "This talk"
-    "Uses Factor help markup language with a tweaked stylesheet"
-    "Each slide is a gadget"
-    "Slides are grouped in a custom gadget which handles Up/Down arrow keys to move between slides"
-    "Let's look at the source code:"
-    { $module "demos/mslug-talk" }
-}
-{ $slide "The compiler"
-    "Performance is a goal"
-    "Compromise: The compiler only compiles words with a static stack effect"
-    "Three stages"
-    { "First stage transforms a quotation into the " { $emphasis "dataflow representation" } }
-    "Second stage: high-level optimizations"
-    "Third stage: register allocation, peephole optimization, code generation"
-    "Compiled code saved in the image"
-    "Compiler invoked explicitly (not a ``JIT'')"
-}
-{ $slide "High-level optimizer"
-    "Quotations <-> dataflow conversion is ``loss-less''"
-    "Really, just rewriting quotations"
-    "Type inference"
-    "Partial evaluation"
-    "Arithmetic identities"
-    "Optimistic specialization"
-}
-{ $slide "Low level optimizer"
-    "Caching stack in registers"
-    "Shuffling renames registers"
-    "Unboxing floats"
-    "Tail call optimization"
-}
-{ $slide "Assember DSL"
-    "The compiler emits machine code:"
-    { $code
-        "char-reg PUSH"
-        "\"n\" operand 2 SHR"
-        "char-reg dup XOR"
-        "\"obj\" operand \"n\" operand ADD"
-        "char-reg-16 \"obj\" operand string-offset [+] MOV"
-        "char-reg tag-bits SHL"
-        "\"obj\" operand char-reg MOV"
-        "char-reg POP"
-    }
-}
-{ $slide "Assember DSL - continued"
-    { "It's all done with " { $link make } }
-    { $code "USE: assembler" "[ EAX ECX MOV ] { } make ." }
-}
-{ $slide "The end"
-    { $url "http://factorcode.org" }
-    { $url "http://factor-language.blogspot.com" }
-    { "irc.freenode.net #concatenative" }
-}
-} ;
-
-TUPLE: mslug ;
-
-C: mslug ( -- gadget )
-    slides [ <page> ] map <book>
-    over set-gadget-delegate ;
-
-: change-page ( book n -- )
-    over control-value + over gadget-children length rem
-    swap control-model set-model ;
-
-: next-page ( book -- ) 1 change-page ;
-
-: prev-page ( book -- ) -1 change-page ;
-
-\ mslug H{
-    { T{ key-down f f "DOWN" } [ next-page ] }
-    { T{ key-down f f "UP" } [ prev-page ] }
-} set-gestures
-
-PROVIDE: demos/mslug-talk ;
-
-MAIN: demos/mslug-talk
-    <mslug> "Presentation" open-titled-window ;
diff --git a/demos/nehe/load.factor b/demos/nehe/load.factor
deleted file mode 100644 (file)
index 2fd18bb..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-PROVIDE: demos/nehe
-{ 
-  +files+ { 
-    "nehe-utils.factor" 
-    "nehe2.factor" 
-    "nehe3.factor" 
-    "nehe4.factor" 
-  }
-} ;
-
-USING: kernel gadgets nehe sequences gadgets-buttons ;
-
-MAIN: demos/nehe
-  { 
-    { "Nehe 2" [ drop run2 ] } 
-    { "Nehe 3" [ drop run3 ] } 
-    { "Nehe 4" [ drop run4 ] } 
-  } [ first2 <bevel-button> ] map make-pile 
-  "Nehe examples" open-titled-window ;
\ No newline at end of file
diff --git a/demos/nehe/nehe-utils.factor b/demos/nehe/nehe-utils.factor
deleted file mode 100644 (file)
index f9a4b8b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-IN: nehe
-USING: kernel opengl ;
-
-: with-gl ( type quot -- )
-  >r glBegin r> call glEnd ; inline
diff --git a/demos/nehe/nehe2.factor b/demos/nehe/nehe2.factor
deleted file mode 100644 (file)
index d75de71..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-IN: nehe
-USING: kernel gadgets opengl math arrays ;
-
-TUPLE: nehe2-gadget ;
-
-: width 256 ;
-: height 256 ;
-
-C: nehe2-gadget (  -- gadget )
-  [ delegate>gadget ] keep ;
-
-M: nehe2-gadget pref-dim* ( gadget -- dim )
-  drop width height 0 3array ;
-
-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
-  ] with-gl
-  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
-  ] with-gl ;
-
-: run2 ( -- )
-  <nehe2-gadget> "NeHe Tutorial 2" open-titled-window ;
diff --git a/demos/nehe/nehe3.factor b/demos/nehe/nehe3.factor
deleted file mode 100644 (file)
index 2269cf5..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-IN: nehe
-USING: kernel gadgets opengl math arrays ;
-
-TUPLE: nehe3-gadget ;
-
-: width 256 ;
-: height 256 ;
-
-C: nehe3-gadget (  -- gadget )
-  [ delegate>gadget ] keep ;
-
-M: nehe3-gadget pref-dim* ( gadget -- dim )
-  drop width height 0 3array ;
-
-M: nehe3-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 [
-    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
-  ] with-gl
-  3.0 0.0 0.0 glTranslatef
-  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
-  ] with-gl ;
-
-: run3 ( -- )
-  <nehe3-gadget> "NeHe Tutorial 3" open-titled-window ;
diff --git a/demos/nehe/nehe4.factor b/demos/nehe/nehe4.factor
deleted file mode 100644 (file)
index b868d61..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-IN: nehe
-USING: kernel gadgets opengl math arrays threads ;
-
-TUPLE: nehe4-gadget rtri rquad thread quit? ;
-
-: width 256 ;
-: height 256 ;
-: redraw-interval 10 ;
-
-C: nehe4-gadget (  -- gadget )
-  [ 0.0 swap set-nehe4-gadget-rtri ] keep
-  [ 0.0 swap set-nehe4-gadget-rquad ] keep
-  [ delegate>gadget ] keep ;
-
-M: nehe4-gadget pref-dim* ( gadget -- dim )
-  drop width height 0 3array ;
-
-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 nehe4-gadget-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
-  ] with-gl
-
-  glLoadIdentity
-
-  1.5 0.0 -6.0 glTranslatef
-  dup nehe4-gadget-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
-  ] with-gl 
-  dup nehe4-gadget-rtri 0.2 + over set-nehe4-gadget-rtri
-  dup nehe4-gadget-rquad 0.15 - swap set-nehe4-gadget-rquad ;
-  
-: nehe4-update-thread ( gadget -- )  
-  dup nehe4-gadget-quit? [
-    redraw-interval sleep 
-    dup relayout-1  
-    nehe4-update-thread 
-  ] unless ;
-
-M: nehe4-gadget graft* ( gadget -- )
- [ f swap set-nehe4-gadget-quit? ] keep
- [ nehe4-update-thread ] in-thread drop ;
-
-M: nehe4-gadget ungraft* ( gadget -- )
- t swap set-nehe4-gadget-quit? ;
-
-: run4 ( -- )
-  <nehe4-gadget> "NeHe Tutorial 4" open-titled-window ;
diff --git a/demos/numbers-game.factor b/demos/numbers-game.factor
deleted file mode 100644 (file)
index 82f64fb..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-IN: numbers-game
-USING: kernel math parser io ;
-
-: read-number ( -- n ) readln string>number ;
-
-: guess-banner
-    "I'm thinking of a number between 0 and 100." print ;
-: guess-prompt "Enter your guess: " write ;
-: too-high "Too high" print ;
-: too-low "Too low" print ;
-: correct "Correct - you win!" print ;
-
-: inexact-guess ( actual guess -- )
-     < [ too-high ] [ too-low ] if ;
-
-: judge-guess ( actual guess -- ? )
-    2dup = [ 2drop correct f ] [ inexact-guess t ] if ;
-
-: number-to-guess ( -- n ) 100 random-int ;
-
-: numbers-game-loop ( actual -- )
-    dup guess-prompt read-number judge-guess
-    [ numbers-game-loop ] [ drop ] if ;
-
-: numbers-game number-to-guess numbers-game-loop ;
-
-PROVIDE: demos/numbers-game ;
-
-MAIN: demos/numbers-game numbers-game ;
diff --git a/demos/rot13.factor b/demos/rot13.factor
deleted file mode 100644 (file)
index c6a00c1..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2006 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-IN: rot13
-USING: kernel math sequences strings ;
-
-: rotate ( ch base -- ch ) tuck - 13 + 26 mod + ;
-
-: rot-letter ( ch -- ch )
-    {
-        { [ dup letter? ] [ CHAR: a rotate ] }
-        { [ dup LETTER? ] [ CHAR: A rotate ] }
-        { [ t ] [ ] }
-    } cond ;
-
-: rot13 ( string -- string ) [ rot-letter ] map ;
-
-PROVIDE: demos/rot13 ;
diff --git a/extra/arrays/lib/lib.factor b/extra/arrays/lib/lib.factor
new file mode 100644 (file)
index 0000000..6530e65
--- /dev/null
@@ -0,0 +1,10 @@
+
+USING: kernel arrays sequences sequences.private macros ;
+
+IN: arrays.lib
+
+MACRO: narray ( n -- quot )
+    dup [ f <array> ] curry
+    swap <reversed> [
+        [ swap [ set-nth-unsafe ] keep ] curry
+    ] map concat append ;
diff --git a/extra/asn1/asn1-tests.factor b/extra/asn1/asn1-tests.factor
new file mode 100644 (file)
index 0000000..822f89c
--- /dev/null
@@ -0,0 +1,51 @@
+USING: asn1 asn1.ldap io.streams.string tools.test ;
+
+[ 6 ] [
+    "\u0002\u0001\u0006" <string-reader> [ asn-syntax read-ber ] with-stream
+] unit-test
+
+[ "testing" ] [
+    "\u0004\u0007testing" <string-reader> [ asn-syntax read-ber ] with-stream
+] unit-test
+
+[ { 1 { 3 "Administrator" "ad_is_bogus" } } ] [
+    "0$\u0002\u0001\u0001`\u001f\u0002\u0001\u0003\u0004\rAdministrator\u0080\u000bad_is_bogus"
+    <string-reader> [ asn-syntax read-ber ] with-stream
+] unit-test
+
+[
+    ! triggers fixnum
+    [ B{ 2 3 131 134 80 } ] [ 50000 >ber ] unit-test
+
+    [ B{ 10 3 131 134 80 } ] [ 50000 >ber-enumerated ] unit-test
+
+    ! triggers bignum
+    [ B{ 2 5 146 208 151 228 0 } ] [ 5000000000 >ber ] unit-test
+
+    ! triggers string
+    [ B{ 4 6 97 98 99 100 101 102 } ] [ "abcdef" >ber ] unit-test
+
+    [ B{ 69 6 97 98 99 100 101 102 } ] [ 
+        5 "abcdef" >ber-application-string 
+    ] unit-test
+
+    [ B{ 133 6 97 98 99 100 101 102 } ] [ 
+        5 "abcdef" >ber-contextspecific 
+    ] unit-test
+
+    ! triggers array
+    [ B{ 48 4 49 50 51 52 } ] [ { 1 2 3 4 } >ber ] unit-test
+
+    [ B{ 49 4 49 50 51 52 } ] [ { 1 2 3 4 } >ber-set ] unit-test
+
+    [ B{ 48 4 49 50 51 52 } ] [ { 1 2 3 4 } >ber-sequence ] unit-test
+
+    [ B{ 96 4 49 50 51 52 } ] [ 
+        { 1 2 3 4 } >ber-appsequence
+    ] unit-test
+
+    [ B{ 160 4 49 50 51 52 } ] [ 
+        { 1 2 3 4 } >ber-contextspecific 
+    ] unit-test
+
+] with-ber
diff --git a/extra/asn1/asn1.factor b/extra/asn1/asn1.factor
new file mode 100644 (file)
index 0000000..8b44c20
--- /dev/null
@@ -0,0 +1,219 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: arrays asn1.ldap assocs byte-arrays combinators
+continuations io io.binary io.streams.string kernel math
+math.parser namespaces pack strings sequences ;
+
+IN: asn1
+
+: tag-classes ( -- seq )
+    { "universal" "application" "context_specific" "private" } ;
+
+: builtin-syntax ( -- hashtable )
+    H{
+        { "universal"
+            H{
+                { "primitive"
+                    H{ 
+                        { 1 "boolean" }
+                        { 2 "integer" }
+                        { 4 "string" }
+                        { 5 "null" }
+                        { 6 "oid" }
+                        { 10 "integer" }
+                        { 13 "string" }   ! relative OID
+                     }
+                }
+                { "constructed"
+                    H{
+                        { 16 "array" }
+                        { 17 "array" }
+                    }
+                }
+             }
+        }
+        { "context_specific"
+            H{
+                { "primitive"
+                    H{
+                        { 10 "integer" }
+                    }
+                }
+            }
+        }
+     } ;
+
+SYMBOL: elements
+
+TUPLE: element syntax id tag tagclass encoding contentlength newobj objtype ;
+
+: <element> element construct-empty ;
+
+: set-id ( -- boolean )
+    read1 dup elements get set-element-id ;
+
+: get-id ( -- id )
+    elements get element-id ;
+
+: (set-tag) ( -- )
+    elements get element-id 31 bitand
+    dup elements get set-element-tag
+    31 < [
+        [ "unsupported tag encoding: #{" % 
+          get-id # "}" %
+        ] "" make throw
+    ] unless ;
+
+: set-tagclass ( -- )
+    get-id -6 shift tag-classes nth
+    elements get set-element-tagclass ;
+
+: set-encoding ( -- )
+    get-id HEX: 20 bitand
+    zero? "primitive" "constructed" ?
+    elements get set-element-encoding ;
+
+: set-content-length ( -- )
+    read1
+    dup 127 <= [ 
+        127 bitand read be>
+    ] unless elements get set-element-contentlength ;
+
+: set-newobj ( -- )
+    elements get element-contentlength read
+    elements get set-element-newobj ;
+
+: set-objtype ( syntax -- )
+    builtin-syntax 2array [
+        elements get element-tagclass swap at
+        elements get element-encoding swap at
+        elements get element-tag
+        swap at [ 
+            elements get set-element-objtype
+        ] when*
+    ] each ;
+
+DEFER: read-ber
+
+SYMBOL: end
+
+: (read-array) ( stream -- )
+    elements get element-id [
+        elements get element-syntax read-ber
+        dup end = [ drop ] [ , (read-array) ] if
+    ] when ;
+
+: read-array ( -- array ) [ (read-array) ] { } make ;
+
+: set-case ( -- )
+    elements get element-newobj
+    elements get element-objtype {
+        { "boolean" [ "\0" = not ] }
+        { "string" [ "" or ] }
+        { "integer" [ be> ] }
+        { "array" [ "" or [ read-array ] string-in ] }
+    } case ;
+
+: read-ber ( syntax -- object )
+    <element> elements set
+    elements get set-element-syntax
+    set-id [
+        (set-tag)
+        set-tagclass
+        set-encoding
+        set-content-length
+        set-newobj
+        elements get element-syntax set-objtype
+        set-case
+    ] [ end ] if ;
+
+! =========================================================
+! Fixnum
+! =========================================================
+
+GENERIC: >ber ( obj -- byte-array )
+M: fixnum >ber ( n -- byte-array )
+    >128-ber dup length 2 swap 2array
+    "cc" pack-native swap append ;
+
+: >ber-enumerated ( n -- byte-array )
+    >128-ber >byte-array dup length 10 swap 2array
+    "CC" pack-native swap append ;
+
+: >ber-length-encoding ( n -- byte-array )
+    dup 127 <= [
+        1array "C" pack-be
+    ] [
+        1array "I" pack-be 0 swap remove dup length
+        HEX: 80 + 1array "C" pack-be swap append
+    ] if ;
+
+! =========================================================
+! Bignum
+! =========================================================
+
+M: bignum >ber ( n -- byte-array )
+    >128-ber >byte-array dup length
+    dup 126 > [
+        "range error in bignum" throw
+    ] [
+        2 swap 2array "CC" pack-native swap append
+    ] if ;
+
+! =========================================================
+! String
+! =========================================================
+
+! Universal octet-string has tag number 4, we should however
+! still be able to assign an arbitrary code number.
+! >ber words should be called within a with-ber.
+SYMBOL: tagnum
+
+TUPLE: tag value ;
+
+: <tag> ( -- <tag> ) 4 tag construct-boa ;
+
+: with-ber ( quot -- )
+    [
+        <tag> tagnum set
+        call
+    ] with-scope ; inline
+
+: set-tag ( value -- )
+    tagnum get set-tag-value ;
+
+M: string >ber ( str -- byte-array )
+    tagnum get tag-value 1array "C" pack-native swap dup
+    length >ber-length-encoding swapd append swap
+    >byte-array append ;
+
+: >ber-application-string ( n str -- byte-array )
+    >r HEX: 40 + set-tag r> >ber ;
+
+GENERIC: >ber-contextspecific ( n obj -- byte-array )
+M: string >ber-contextspecific ( n str -- byte-array )
+    >r HEX: 80 + set-tag r> >ber ;
+
+! =========================================================
+! Array
+! =========================================================
+
+: >ber-seq-internal ( array code -- byte-array )
+    1array "C" pack-native swap dup length >ber-length-encoding
+    swapd append swap [ number>string ] map "" join >array append ;
+
+M: array >ber ( array -- byte-array )
+    HEX: 30 >ber-seq-internal ;
+
+: >ber-set ( array -- byte-array )
+    HEX: 31 >ber-seq-internal ;
+
+: >ber-sequence ( array -- byte-array )
+    HEX: 30 >ber-seq-internal ;
+
+: >ber-appsequence ( array -- byte-array )
+    HEX: 60 >ber-seq-internal ;
+
+M: array >ber-contextspecific ( array -- byte-array )
+    HEX: A0 >ber-seq-internal ;
diff --git a/extra/asn1/authors.txt b/extra/asn1/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/extra/asn1/ldap/ldap.factor b/extra/asn1/ldap/ldap.factor
new file mode 100644 (file)
index 0000000..8e93b14
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: asn1.ldap
+
+: SearchScope_BaseObject      0 ; inline
+: SearchScope_SingleLevel     1 ; inline
+: SearchScope_WholeSubtree    2 ; inline
+
+: asn-syntax ( -- hashtable )
+    H{
+        { "application"
+            H{
+                { "primitive"
+                    H{
+                        { 2 "null" }    ! UnbindRequest body
+                     }
+                }
+                { "constructed"
+                    H{ 
+                        { 0 "array" }   ! BindRequest
+                        { 1 "array" }   ! BindResponse
+                        { 2 "array" }   ! UnbindRequest
+                        { 3 "array" }   ! SearchRequest
+                        { 4 "array" }   ! SearchData
+                        { 5 "array" }   ! SearchResult
+                        { 6 "array" }   ! ModifyRequest
+                        { 7 "array" }   ! ModifyResponse
+                        { 8 "array" }   ! AddRequest
+                        { 9 "array" }   ! AddResponse
+                        { 10 "array" }  ! DelRequest
+                        { 11 "array" }  ! DelResponse
+                        { 12 "array" }  ! ModifyRdnRequest
+                        { 13 "array" }  ! ModifyRdnResponse
+                        { 14 "array" }  ! CompareRequest
+                        { 15 "array" }  ! CompareResponse
+                        { 16 "array" }  ! AbandonRequest
+                        { 19 "array" }  ! SearchResultReferral
+                        { 24 "array" }  ! Unsolicited Notification
+                     }
+                }
+            }
+        }
+        { "context_specific"
+             H{
+                 { "primitive"
+                     H{
+                         { 0 "string" }  ! password
+                         { 1 "string" }  ! Kerberos v4
+                         { 2 "string" }  ! Kerberos v5
+                         { 7 "string" }  ! serverSaslCreds
+                     }
+                 }
+                 { "constructed"
+                     H{
+                         { 0 "array" }    ! RFC-2251 Control and Filter-AND
+                         { 1 "array" }    ! SearchFilter-OR
+                         { 2 "array" }    ! SearchFilter-NOT
+                         { 3 "array" }    ! Seach referral
+                         { 4 "array" }    ! unknown use in Microsoft Outlook
+                         { 5 "array" }    ! SearchFilter-GE
+                         { 6 "array" }    ! SearchFilter-LE
+                         { 7 "array" }    ! serverSaslCreds
+                     }
+                 }
+             }
+        }
+     } ;
diff --git a/extra/asn1/summary.txt b/extra/asn1/summary.txt
new file mode 100644 (file)
index 0000000..0ee8d22
--- /dev/null
@@ -0,0 +1 @@
+ASN.1 parser
diff --git a/extra/automata/authors.txt b/extra/automata/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/automata/automata.factor b/extra/automata/automata.factor
new file mode 100644 (file)
index 0000000..fb80617
--- /dev/null
@@ -0,0 +1,111 @@
+
+USING: kernel math math.parser random arrays hashtables assocs sequences
+       vars strings.lib ;
+
+IN: automata
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! set-rule
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: rule   VAR: rule-number
+
+: init-rule ( -- ) 8 <hashtable> >rule ;
+
+: rule-keys ( -- array )
+{ { 1 1 1 }
+  { 1 1 0 }
+  { 1 0 1 }
+  { 1 0 0 }
+  { 0 1 1 }
+  { 0 1 0 }
+  { 0 0 1 }
+  { 0 0 0 } } ;
+
+: rule-values ( n -- seq ) >bin 8 CHAR: 0 pad-left string>digits ;
+
+: set-rule ( n -- )
+dup >rule-number rule-values rule-keys [ rule> set-at ] 2each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! step-capped-line
+! step-wrapped-line
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: 3nth ( n seq -- slice ) >r dup 3 + r> <slice> ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: map3-i ( seq -- i ) length 2 - ;
+
+: map3-quot ( seq quot -- quot ) >r [ 3nth ] curry r> compose ; inline
+
+: map3 ( seq quot -- seq ) >r dup map3-i swap r> map3-quot map ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: pattern>state ( {_a_b_c_} -- state ) rule> at ;
+
+: cap-line ( line -- 0-line-0 ) { 0 } swap append { 0 } append ;
+
+: wrap-line ( a-line-z -- za-line-za )
+dup peek 1array swap dup first 1array append append ;
+
+: step-line ( line -- new-line ) [ >array pattern>state ] map3 ;
+
+: step-capped-line ( line -- new-line ) cap-line step-line ;
+
+: step-wrapped-line ( line -- new-line ) wrap-line step-line ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VARS: width height ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: random-line ( -- line ) width> [ drop 2 random ] map ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: center-i ( -- i ) width> 2 / >fixnum ;
+
+: center-line ( -- line ) center-i width> [ = 1 0 ? ] curry* map ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: interesting ( -- seq )
+{ 18 22 26 30 41 45 54 60 73 75 82 86 89 90 97 101 102 105 106 107 109
+  110 120 121 122 124 126 129 137 146 147 149 150 151 153 154 161 165 } ;
+
+: mild ( -- seq ) { 6 9 11 57 62 74 118 } ;
+
+: set-interesting ( -- ) interesting random set-rule ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: bitmap
+
+VAR: last-line
+
+: run-rule ( -- )
+last-line> height> [ drop step-capped-line dup ] map >bitmap >last-line ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: start-random ( -- ) random-line >last-line run-rule ;
+
+: start-center ( -- ) center-line >last-line run-rule ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! VAR: loop-flag
+
+! DEFER: loop
+
+! : (loop) ( -- ) run-rule 3000 sleep loop ;
+
+! : loop ( -- ) loop-flag> [ (loop) ] [ ] if ;
+
+! : start-loop ( -- ) t >loop-flag [ loop ] in-thread ;
+
+! : stop-loop ( -- ) f >loop-flag ;
\ No newline at end of file
diff --git a/extra/automata/summary.txt b/extra/automata/summary.txt
new file mode 100644 (file)
index 0000000..a01a8c7
--- /dev/null
@@ -0,0 +1 @@
+Cellular Automata Explorer (one dimensional, two state)
diff --git a/extra/automata/tags.txt b/extra/automata/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/automata/ui/ui.factor b/extra/automata/ui/ui.factor
new file mode 100644 (file)
index 0000000..5cf9ccc
--- /dev/null
@@ -0,0 +1,88 @@
+
+USING: kernel namespaces math quotations arrays hashtables sequences threads
+       opengl
+       opengl.gl
+       colors
+       ui
+       ui.gestures
+       ui.gadgets
+       ui.gadgets.handler
+       ui.gadgets.slate
+       ui.gadgets.labels
+       ui.gadgets.buttons
+       ui.gadgets.frames
+       ui.gadgets.packs
+       ui.gadgets.grids
+       ui.gadgets.theme
+       namespaces.lib hashtables.lib vars
+       rewrite-closures automata ;
+
+IN: automata.ui
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: draw-point ( y x value -- ) 1 = [ swap glVertex2i ] [ 2drop ] if ;
+
+: draw-line ( y line -- ) 0 swap [ >r 2dup r> draw-point 1+ ] each 2drop ;
+
+: (draw-bitmap) ( bitmap -- ) 0 swap [ >r dup r> draw-line 1+ ] each drop ;
+
+: draw-bitmap ( bitmap -- ) GL_POINTS glBegin (draw-bitmap) glEnd ;
+
+: display ( -- ) black gl-color bitmap> draw-bitmap ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: slate
+
+! Call a 'model' quotation with the current 'view'.
+
+: with-view ( quot -- )
+slate> rect-dim first >width
+slate> rect-dim second >height
+call
+slate> relayout-1 ;
+
+! Create a quotation that is appropriate for buttons and gesture handler.
+
+: view-action ( quot -- quot ) [ drop [ ] with-view ] make* closed-quot ;
+
+: view-button ( label quot -- ) >r <label> r> view-action <bevel-button> ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Helper word to make things less verbose
+
+: random-rule ( -- ) set-interesting start-center ;
+
+DEFER: automata-window
+
+: automata-window* ( -- ) init-rule set-interesting <frame>
+
+{
+[ "1 - Center"      [ start-center    ] view-button ]
+[ "2 - Random"      [ start-random    ] view-button ]
+[ "3 - Continue"    [ run-rule               ] view-button ]
+[ "5 - Random Rule" [ random-rule     ] view-button ]
+[ "n - New"        [ automata-window ] view-button ]
+} make*
+[ [ gadget, ] curry ] map concat ! Hack
+make-shelf over @top grid-add
+
+[ display ] closed-quot <slate> { 400 400 } over set-slate-dim dup >slate
+over @center grid-add
+
+{
+{ T{ key-down f f "1" } [ [ start-center    ] view-action ] }
+{ T{ key-down f f "2" } [ [ start-random    ] view-action ] }
+{ T{ key-down f f "3" } [ [ run-rule       ] view-action ] }
+{ T{ key-down f f "5" } [ [ random-rule     ] view-action ] }
+{ T{ key-down f f "n" } [ [ automata-window ] view-action ] }
+} [ make* ] map >hashtable <handler> tuck set-gadget-delegate
+"Automata" open-window ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: automata-window ( -- ) [ [ automata-window* ] with-scope ] with-ui ;
+
+MAIN: automata-window
\ No newline at end of file
diff --git a/extra/bake/bake.factor b/extra/bake/bake.factor
new file mode 100644 (file)
index 0000000..d229b19
--- /dev/null
@@ -0,0 +1,52 @@
+
+USING: kernel parser namespaces quotations vectors strings
+sequences assocs tuples math combinators ;
+
+IN: bake
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: insert-quot expr ;
+
+C: <insert-quot> insert-quot 
+
+: ,[ \ ] [ >quotation <insert-quot> ] parse-literal ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: splice-quot expr ;
+
+C: <splice-quot> splice-quot
+
+: %[ \ ] [ >quotation <splice-quot> ] parse-literal ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: exemplar
+
+: reset-building ( -- ) 1024 <vector> building set ;
+
+: save-exemplar ( seq -- seq ) dup exemplar set ;
+
+: finish-baking ( -- seq ) building get exemplar get like ;
+
+DEFER: bake
+
+: bake-item ( item -- )
+  { { [ dup \ , = ]        [ drop , ] }
+    { [ dup \ % = ]       [ drop % ] }
+    { [ dup insert-quot? ] [ insert-quot-expr call , ] }
+    { [ dup splice-quot? ] [ splice-quot-expr call % ] }
+    { [ dup integer? ]     [ , ] }
+    { [ dup string? ]     [ , ] }
+    { [ dup tuple? ]       [ tuple>array bake >tuple , ] }
+    { [ dup assoc? ]       [ [ >alist bake ] keep assoc-like , ] }
+    { [ dup sequence? ]    [ bake , ] }
+    { [ t ]               [ , ] } }
+  cond ;
+
+: bake-items ( seq -- ) [ bake-item ] each ;
+
+: bake ( seq -- seq )
+  [ reset-building save-exemplar bake-items finish-baking ] with-scope ;
+
diff --git a/extra/balloon-bomber/authors.txt b/extra/balloon-bomber/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/balloon-bomber/balloon-bomber-docs.factor b/extra/balloon-bomber/balloon-bomber-docs.factor
new file mode 100644 (file)
index 0000000..ad7464a
--- /dev/null
@@ -0,0 +1,39 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.syntax help.markup cpu.8080 ;\r
+IN: balloon-bomber\r
+\r
+HELP: run \r
+{ $description \r
+"Run the Balloon Bomber emulator in a new window." $nl\r
+{ $link rom-root } " must be set to the directory containing the "\r
+"location of the Balloon Bomber ROM files. See " \r
+{ $link { "balloon-bomber" "balloon-bomber" } } "  for details."\r
+} ;\r
+\r
+ARTICLE: { "balloon-bomber" "balloon-bomber" } "Balloon Bomber Emulator"\r
+"Provides an emulation of the original 8080 Arcade Game 'Balloon Bomber'." $nl\r
+"More information on the arcade game can be obtained from " { $url "http://www.mameworld.net/maws/romset/ballbomb" } "." $nl\r
+"To play the game you need the ROM files for the arcade game. They should "\r
+"be placed in a directory called 'ballbomb' in the location specified by "\r
+"the variable " { $link rom-root } ". The specific files needed are:"\r
+{ $list\r
+  "ballbomb/tn01"\r
+  "ballbomb/tn02"\r
+  "ballbomb/tn03"\r
+  "ballbomb/tn04"\r
+  "ballbomb/tn05-1"\r
+}\r
+"These are the same ROM files as used by MAME. To run the game use the " \r
+{ $link run } " word." $nl\r
+"Keys:" \r
+{ $table\r
+  { "Backspace" "Insert Coin" }\r
+  { "1" "1 Player" }\r
+  { "2" "2 Player" }\r
+  { "Left" "Move Left" }\r
+  { "Right" "Move Right" }\r
+  { "Up" "Fire" }\r
+}\r
+"If you save the Factor image while a game is running, when you restart "\r
+"the image the game continues where it left off." ;\r
diff --git a/extra/balloon-bomber/balloon-bomber.factor b/extra/balloon-bomber/balloon-bomber.factor
new file mode 100644 (file)
index 0000000..160447d
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+! Balloon Bomber: http://www.mameworld.net/maws/romset/ballbomb\r
+!\r
+USING: kernel space-invaders cpu.8080 ui ;\r
+IN: balloon-bomber\r
+\r
+TUPLE: balloon-bomber ; \r
+\r
+: <balloon-bomber> ( -- cpu )\r
+  <space-invaders> balloon-bomber construct-delegate ;\r
+\r
+: run ( -- )  \r
+  "Balloon Bomber" <balloon-bomber> {\r
+    { HEX: 0000 "ballbomb/tn01" }\r
+    { HEX: 0800 "ballbomb/tn02" }\r
+    { HEX: 1000 "ballbomb/tn03" }\r
+    { HEX: 1800 "ballbomb/tn04" }\r
+    { HEX: 4000 "ballbomb/tn05-1" }\r
+  } [ (run) ] with-ui ;\r
+\r
+MAIN: run\r
diff --git a/extra/balloon-bomber/summary.txt b/extra/balloon-bomber/summary.txt
new file mode 100644 (file)
index 0000000..1009453
--- /dev/null
@@ -0,0 +1 @@
+Intel 8080-based Balloon Bomber arcade machine emulator
diff --git a/extra/balloon-bomber/tags.txt b/extra/balloon-bomber/tags.txt
new file mode 100644 (file)
index 0000000..4717ffd
--- /dev/null
@@ -0,0 +1,2 @@
+games
+applications
diff --git a/extra/base64/authors.txt b/extra/base64/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/base64/base64-docs.factor b/extra/base64/base64-docs.factor
new file mode 100644 (file)
index 0000000..fe948bf
--- /dev/null
@@ -0,0 +1,20 @@
+USING: help.markup help.syntax kernel math ;
+IN: base64
+
+HELP: >base64
+{ $values { "seq" "a sequence" } { "base64" "a string of base64 characters" } }
+{ $description "Converts a sequence to its base64 representation by taking six bits at a time as an index into a lookup table containing alphanumerics, '+', and '/'.  The result is padded with '=' if the input was not a multiple of six bits." }
+{ $examples
+    { $unchecked-example "\"The monorail is a free service.\" >base64 ." "VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==" }
+}
+{ $see-also base64> } ;
+
+HELP: base64>
+{ $values { "base64" "a string of base64 characters" } { "str" "a string" } }
+{ $description "Converts a string in base64 encoding back into its binary representation." }
+{ $examples
+    { $unchecked-example "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\" base64> ." "\"The monorail is a free service.\"" }
+}
+{ $notes "This word will throw if the input string contains characters other than those allowed in base64 encodings." }
+{ $see-also >base64 } ;
+
diff --git a/extra/base64/base64-tests.factor b/extra/base64/base64-tests.factor
new file mode 100644 (file)
index 0000000..23ea6e9
--- /dev/null
@@ -0,0 +1,8 @@
+USING: tools.test base64 ;
+
+[ "abcdefghijklmnopqrstuvwxyz" ] [ "abcdefghijklmnopqrstuvwxyz" >base64 base64>
+] unit-test
+[ "" ] [ "" >base64 base64> ] unit-test
+[ "a" ] [ "a" >base64 base64> ] unit-test
+[ "ab" ] [ "ab" >base64 base64> ] unit-test
+[ "abc" ] [ "abc" >base64 base64> ] unit-test
diff --git a/extra/base64/base64.factor b/extra/base64/base64.factor
new file mode 100644 (file)
index 0000000..c354de9
--- /dev/null
@@ -0,0 +1,47 @@
+USING: kernel math sequences namespaces io.binary splitting
+ strings hashtables ;
+IN: base64
+
+<PRIVATE
+
+: count-end ( seq quot -- count )
+    >r [ length ] keep r> find-last drop dup [ - 1- ] [ 2drop 0 ] if ;
+
+: ch>base64 ( ch -- ch )
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" nth ;
+
+: base64>ch ( ch -- ch )
+    {
+        f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f
+        f f f f f f f f f f 62 f f f 63 52 53 54 55 56 57 58 59 60 61 f f
+        f 0 f f f 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
+        22 23 24 25 f f f f f f 26 27 28 29 30 31 32 33 34 35 36 37 38 39
+        40 41 42 43 44 45 46 47 48 49 50 51
+    } nth ;
+
+: encode3 ( seq -- seq )
+    be> 4 [ 3 swap - -6 * shift HEX: 3f bitand ch>base64 ] curry* map ;
+
+: decode4 ( str -- str )
+    [ base64>ch ] map 0 [ swap 6 shift bitor ] reduce 3 >be ;
+
+: >base64-rem ( str -- str )
+    [ 3 0 pad-right encode3 ] keep length 1+ head 4 CHAR: = pad-right ;
+
+PRIVATE>
+
+: >base64 ( seq -- base64 )
+    #! cut string into two pieces, convert 3 bytes at a time
+    #! pad string with = when not enough bits
+    [ length dup 3 mod - ] keep cut swap
+    [
+        3 group [ encode3 % ] each
+        dup empty? [ drop ] [ >base64-rem % ] if
+    ] "" make ;
+
+: base64> ( base64 -- str )
+    #! input length must be a multiple of 4
+    [
+        [ 4 group [ decode4 % ] each ] keep [ CHAR: = = not ] count-end 
+    ] SBUF" " make swap [ dup pop* ] times >string ;
+
diff --git a/extra/base64/summary.txt b/extra/base64/summary.txt
new file mode 100644 (file)
index 0000000..89950e2
--- /dev/null
@@ -0,0 +1 @@
+Base64 encoding/decoding
diff --git a/extra/benchmark/authors.txt b/extra/benchmark/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/benchmark/benchmark.factor b/extra/benchmark/benchmark.factor
new file mode 100644 (file)
index 0000000..0e7aa60
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel vocabs vocabs.loader tools.time tools.browser
+arrays assocs io.styles io help.markup prettyprint sequences ;
+IN: benchmark
+
+: run-benchmark ( vocab -- result )
+    "=== Benchmark " write dup print flush
+    dup require [ run ] benchmark 2array ;
+
+: run-benchmarks ( -- assoc )
+    "benchmark" load-children
+    "benchmark" dup child-vocabs remove
+    [ dup run-benchmark ] { } map>assoc ;
+
+: benchmarks. ( assoc -- )
+    standard-table-style [
+        [
+            [ "Benchmark" write ] with-cell
+            [ "Run time (ms)" write ] with-cell
+            [ "GC time (ms)" write ] with-cell
+        ] with-row
+        [
+            [
+                swap [ ($vocab-link) ] with-cell
+                first2 pprint-cell pprint-cell
+            ] with-row
+        ] assoc-each
+    ] tabular-output ;
+
+: benchmarks ( -- )
+    run-benchmarks benchmarks. ;
+
+MAIN: benchmarks
+
diff --git a/extra/benchmark/bootstrap1/bootstrap1.factor b/extra/benchmark/bootstrap1/bootstrap1.factor
new file mode 100644 (file)
index 0000000..f824fea
--- /dev/null
@@ -0,0 +1,4 @@
+USING: bootstrap.image ;
+IN: benchmark.bootstrap1
+
+MAIN: make-images
diff --git a/extra/benchmark/bootstrap2/bootstrap2.factor b/extra/benchmark/bootstrap2/bootstrap2.factor
new file mode 100644 (file)
index 0000000..f6c5800
--- /dev/null
@@ -0,0 +1,8 @@
+USING: tools.deploy.private io.files system ;
+IN: benchmark.bootstrap2
+
+: bootstrap-benchmark
+    "." resource-path cd
+    vm { "-output-image=foo.image" "-no-user-init" } stage2 ;
+
+MAIN: bootstrap-benchmark
diff --git a/extra/benchmark/continuations/continuations.factor b/extra/benchmark/continuations/continuations.factor
new file mode 100644 (file)
index 0000000..376a75b
--- /dev/null
@@ -0,0 +1,7 @@
+USING: math kernel continuations ;
+IN: benchmark.continuations
+
+: continuations-main
+    100000 [ drop [ continue ] callcc0 ] each-integer ;
+
+MAIN: continuations-main
diff --git a/extra/benchmark/dispatch1/dispatch1.factor b/extra/benchmark/dispatch1/dispatch1.factor
new file mode 100644 (file)
index 0000000..f81f70a
--- /dev/null
@@ -0,0 +1,77 @@
+USING: classes kernel sequences vocabs math ;
+IN: benchmark.dispatch1
+
+GENERIC: g ( obj -- obj )
+
+TUPLE: x1 ;
+M: x1 g ;
+TUPLE: x2 ;
+M: x2 g ;
+TUPLE: x3 ;
+M: x3 g ;
+TUPLE: x4 ;
+M: x4 g ;
+TUPLE: x5 ;
+M: x5 g ;
+TUPLE: x6 ;
+M: x6 g ;
+TUPLE: x7 ;
+M: x7 g ;
+TUPLE: x8 ;
+M: x8 g ;
+TUPLE: x9 ;
+M: x9 g ;
+TUPLE: x10 ;
+M: x10 g ;
+TUPLE: x11 ;
+M: x11 g ;
+TUPLE: x12 ;
+M: x12 g ;
+TUPLE: x13 ;
+M: x13 g ;
+TUPLE: x14 ;
+M: x14 g ;
+TUPLE: x15 ;
+M: x15 g ;
+TUPLE: x16 ;
+M: x16 g ;
+TUPLE: x17 ;
+M: x17 g ;
+TUPLE: x18 ;
+M: x18 g ;
+TUPLE: x19 ;
+M: x19 g ;
+TUPLE: x20 ;
+M: x20 g ;
+TUPLE: x21 ;
+M: x21 g ;
+TUPLE: x22 ;
+M: x22 g ;
+TUPLE: x23 ;
+M: x23 g ;
+TUPLE: x24 ;
+M: x24 g ;
+TUPLE: x25 ;
+M: x25 g ;
+TUPLE: x26 ;
+M: x26 g ;
+TUPLE: x27 ;
+M: x27 g ;
+TUPLE: x28 ;
+M: x28 g ;
+TUPLE: x29 ;
+M: x29 g ;
+TUPLE: x30 ;
+M: x30 g ;
+
+: my-classes ( -- seq )
+    "benchmark.dispatch1" words [ tuple-class? ] subset ;
+
+: a-bunch-of-objects ( -- seq )
+    my-classes [ construct-empty ] map ;
+
+: dispatch-benchmark ( -- )
+    1000000 a-bunch-of-objects
+    [ [ g drop ] each ] curry times ;
+
+MAIN: dispatch-benchmark
diff --git a/extra/benchmark/dispatch2/dispatch2.factor b/extra/benchmark/dispatch2/dispatch2.factor
new file mode 100644 (file)
index 0000000..d51a723
--- /dev/null
@@ -0,0 +1,30 @@
+USING: namespaces math sequences splitting kernel ;
+IN: benchmark.dispatch2
+
+: sequences
+    [
+        1 ,
+        10 >bignum ,
+        { 1 2 3 } ,
+        "hello world" ,
+        SBUF" sbuf world" ,
+        V{ "a" "b" "c" } ,
+        F{ 1.0 2.0 3.0 } ,
+        "hello world" 4 tail-slice ,
+        10 f <repetition> ,
+        100 2 <sliced-groups> ,
+        "hello" <reversed> ,
+        { { 1 2 } { 3 4 } } 0 <column> ,
+        ?{ t f t } ,
+        B{ 1 2 3 } ,
+        [ "a" "b" "c" ] ,
+        1 [ + ] curry ,
+    ] { } make ;
+
+: don't-flush-me drop ;
+
+: dispatch-test
+    1000000 sequences
+    [ [ 0 swap nth don't-flush-me ] each ] curry times ;
+
+MAIN: dispatch-test
\ No newline at end of file
diff --git a/extra/benchmark/dispatch3/dispatch3.factor b/extra/benchmark/dispatch3/dispatch3.factor
new file mode 100644 (file)
index 0000000..bb4c5ba
--- /dev/null
@@ -0,0 +1,48 @@
+USING: sequences math mirrors splitting kernel namespaces
+assocs alien.syntax ;
+IN: benchmark.dispatch3
+
+GENERIC: g ( obj -- str )
+
+M: assoc g drop "assoc" ;
+
+M: sequence g drop "sequence" ;
+
+M: virtual-sequence g drop "virtual-sequence" ;
+
+M: number g drop "number" ;
+
+M: object g drop "object" ;
+
+: objects
+    [
+        H{ } ,
+        \ + <mirror> ,
+        V{ 2 3 } ,
+        1 ,
+        10 >bignum ,
+        { 1 2 3 } ,
+        "hello world" ,
+        SBUF" sbuf world" ,
+        V{ "a" "b" "c" } ,
+        F{ 1.0 2.0 3.0 } ,
+        "hello world" 4 tail-slice ,
+        10 f <repetition> ,
+        100 2 <sliced-groups> ,
+        "hello" <reversed> ,
+        f ,
+        { { 1 2 } { 3 4 } } 0 <column> ,
+        ?{ t f t } ,
+        B{ 1 2 3 } ,
+        [ "a" "b" "c" ] ,
+        1 [ + ] curry ,
+        123.456 ,
+        1/6 ,
+        C{ 1 2 } ,
+        ALIEN: 1234 ,
+    ] { } make ;
+
+: dispatch-test
+    2000000 objects [ [ g drop ] each ] curry times ;
+
+MAIN: dispatch-test
diff --git a/extra/benchmark/dispatch4/dispatch4.factor b/extra/benchmark/dispatch4/dispatch4.factor
new file mode 100644 (file)
index 0000000..3ad4133
--- /dev/null
@@ -0,0 +1,66 @@
+USING: kernel.private kernel sequences math combinators ;
+IN: benchmark.dispatch4
+
+: foobar-1
+    dup {
+        [ 0 eq? [ 0 ] [ "x" ] if ]
+        [ 1 eq? [ 1 ] [ "x" ] if ]
+        [ 2 eq? [ 2 ] [ "x" ] if ]
+        [ 3 eq? [ 3 ] [ "x" ] if ]
+        [ 4 eq? [ 4 ] [ "x" ] if ]
+        [ 5 eq? [ 5 ] [ "x" ] if ]
+        [ 6 eq? [ 6 ] [ "x" ] if ]
+        [ 7 eq? [ 7 ] [ "x" ] if ]
+        [ 8 eq? [ 8 ] [ "x" ] if ]
+        [ 9 eq? [ 9 ] [ "x" ] if ]
+        [ 10 eq? [ 10 ] [ "x" ] if ]
+        [ 11 eq? [ 11 ] [ "x" ] if ]
+        [ 12 eq? [ 12 ] [ "x" ] if ]
+        [ 13 eq? [ 13 ] [ "x" ] if ]
+        [ 14 eq? [ 14 ] [ "x" ] if ]
+        [ 15 eq? [ 15 ] [ "x" ] if ]
+        [ 16 eq? [ 16 ] [ "x" ] if ]
+        [ 17 eq? [ 17 ] [ "x" ] if ]
+        [ 18 eq? [ 18 ] [ "x" ] if ]
+        [ 19 eq? [ 19 ] [ "x" ] if ]
+    } dispatch ;
+
+: foobar-2
+    {
+        { [ dup 0 eq? ] [ drop 0 ] }
+        { [ dup 1 eq? ] [ drop 1 ] }
+        { [ dup 2 eq? ] [ drop 2 ] }
+        { [ dup 3 eq? ] [ drop 3 ] }
+        { [ dup 4 eq? ] [ drop 4 ] }
+        { [ dup 5 eq? ] [ drop 5 ] }
+        { [ dup 6 eq? ] [ drop 6 ] }
+        { [ dup 7 eq? ] [ drop 7 ] }
+        { [ dup 8 eq? ] [ drop 8 ] }
+        { [ dup 9 eq? ] [ drop 9 ] }
+        { [ dup 10 eq? ] [ drop 10 ] }
+        { [ dup 11 eq? ] [ drop 11 ] }
+        { [ dup 12 eq? ] [ drop 12 ] }
+        { [ dup 13 eq? ] [ drop 13 ] }
+        { [ dup 14 eq? ] [ drop 14 ] }
+        { [ dup 15 eq? ] [ drop 15 ] }
+        { [ dup 16 eq? ] [ drop 16 ] }
+        { [ dup 17 eq? ] [ drop 17 ] }
+        { [ dup 18 eq? ] [ drop 18 ] }
+        { [ dup 19 eq? ] [ drop 19 ] }
+    } cond ;
+
+: foobar-test-1
+    20000000 [
+        20 [
+            foobar-1 drop
+        ] each
+    ] times ;
+
+: foobar-test-2
+    20000000 [
+        20 [
+            foobar-2 drop
+        ] each
+    ] times ;
+
+MAIN: foobar-test-1
diff --git a/extra/benchmark/empty-loop/empty-loop.factor b/extra/benchmark/empty-loop/empty-loop.factor
new file mode 100644 (file)
index 0000000..2f9f4f3
--- /dev/null
@@ -0,0 +1,18 @@
+USING: math math.private kernel sequences ;
+IN: benchmark.empty-loop
+
+: empty-loop-0 ( n -- )
+    dup 0 fixnum< [ drop ] [ 1 fixnum-fast empty-loop-0 ] if ;
+
+: empty-loop-1 ( n -- )
+    [ drop ] each-integer ;
+
+: empty-loop-2 ( n -- )
+    [ drop ] each ;
+
+: empty-loop-main ( -- )
+    5000000 empty-loop-0
+    5000000 empty-loop-1
+    5000000 empty-loop-2 ;
+
+MAIN: empty-loop-main
diff --git a/extra/benchmark/fib1/fib1.factor b/extra/benchmark/fib1/fib1.factor
new file mode 100644 (file)
index 0000000..ad7fb0e
--- /dev/null
@@ -0,0 +1,14 @@
+USING: math.private kernel debugger ;
+IN: benchmark.fib1
+
+: fast-fixnum-fib ( m -- n )
+    dup 1 fixnum<= [
+        drop 1
+    ] [
+        1 fixnum-fast dup fast-fixnum-fib
+        swap 1 fixnum-fast fast-fixnum-fib fixnum+fast
+    ] if ;
+
+: fib-main 34 fast-fixnum-fib 9227465 assert= ;
+
+MAIN: fib-main
diff --git a/extra/benchmark/fib2/fib2.factor b/extra/benchmark/fib2/fib2.factor
new file mode 100644 (file)
index 0000000..bedfedf
--- /dev/null
@@ -0,0 +1,13 @@
+USING: math.private kernel debugger ;
+IN: benchmark.fib2
+
+: fixnum-fib ( m -- n )
+    dup 1 fixnum<= [
+        drop 1
+    ] [
+        1 fixnum- dup fixnum-fib swap 1 fixnum- fixnum-fib fixnum+
+    ] if ;
+
+: fib-main 34 fixnum-fib 9227465 assert= ;
+
+MAIN: fib-main
diff --git a/extra/benchmark/fib3/fib3.factor b/extra/benchmark/fib3/fib3.factor
new file mode 100644 (file)
index 0000000..c2b86f6
--- /dev/null
@@ -0,0 +1,9 @@
+USING: math kernel debugger ;
+IN: benchmark.fib3
+
+: fib ( m -- n )
+    dup 1 <= [ drop 1 ] [ dup 1 - fib swap 2 - fib + ] if ;
+
+: fib-main 34 fib 9227465 assert= ;
+
+MAIN: fib-main
diff --git a/extra/benchmark/fib4/fib4.factor b/extra/benchmark/fib4/fib4.factor
new file mode 100644 (file)
index 0000000..a6415fb
--- /dev/null
@@ -0,0 +1,22 @@
+USING: math kernel debugger ;
+IN: benchmark.fib4
+
+TUPLE: box i ;
+
+C: <box> box
+
+: tuple-fib ( m -- n )
+    dup box-i 1 <= [
+        drop 1 <box>
+    ] [
+        box-i 1- <box>
+        dup tuple-fib
+        swap
+        box-i 1- <box>
+        tuple-fib
+        swap box-i swap box-i + <box>
+    ] if ;
+
+: fib-main T{ box f 34 } tuple-fib T{ box f 9227465 } assert= ;
+
+MAIN: fib-main
diff --git a/extra/benchmark/fib5/fib5.factor b/extra/benchmark/fib5/fib5.factor
new file mode 100644 (file)
index 0000000..6f4765a
--- /dev/null
@@ -0,0 +1,19 @@
+USING: math kernel debugger namespaces ;
+IN: benchmark.fib5
+
+SYMBOL: n
+: namespace-fib ( m -- n )
+    [
+        n set
+        n get 1 <= [
+            1
+        ] [
+            n get 1 - namespace-fib
+            n get 2 - namespace-fib
+            +
+        ] if
+    ] with-scope ;
+
+: fib-main 30 namespace-fib 1346269 assert= ;
+
+MAIN: fib-main
diff --git a/extra/benchmark/iteration/iteration.factor b/extra/benchmark/iteration/iteration.factor
new file mode 100644 (file)
index 0000000..61c22d5
--- /dev/null
@@ -0,0 +1,21 @@
+IN: benchmark.iteration
+USING: sequences vectors arrays strings sbufs math math.vectors
+kernel ;
+
+: <range> ( from to -- seq ) dup <slice> ; inline
+
+: vector-iter 100 [ 0 100000 <range> >vector [ ] map drop ] times ;
+: array-iter 100 [ 0 100000 <range> >array [ ] map drop ] times ;
+: string-iter 100 [ 0 100000 <range> >string [ ] map drop ] times ;
+: sbuf-iter 100 [ 0 100000 <range> >sbuf [ ] map drop ] times ;
+: reverse-iter 100 [ 0 100000 <range> >vector <reversed> [ ] map drop ] times ;
+: dot-iter 100 [ 0 100000 <range> dup v. drop ] times ;
+
+: iter-main
+    vector-iter
+    array-iter
+    string-iter
+    sbuf-iter
+    reverse-iter ;
+
+MAIN: iter-main
diff --git a/extra/benchmark/mandel/mandel.factor b/extra/benchmark/mandel/mandel.factor
new file mode 100644 (file)
index 0000000..5099a5e
--- /dev/null
@@ -0,0 +1,71 @@
+IN: benchmark.mandel
+USING: arrays io kernel math namespaces sequences strings sbufs
+math.functions math.parser io.files colors.hsv ;
+
+: max-color 360 ; inline
+: zoom-fact 0.8 ; inline
+: width 640 ; inline
+: height 480 ; inline
+: nb-iter 40 ; inline
+: center -0.65 ; inline
+
+: scale 255 * >fixnum ; inline
+
+: scale-rgb ( r g b -- n )
+    rot scale rot scale rot scale 3array ;
+
+: sat 0.85 ; inline
+: val 0.85 ; inline
+
+: <color-map> ( nb-cols -- map )
+    dup [
+        360 * swap 1+ / 360 / sat val
+        hsv>rgb scale-rgb
+    ] curry* map ;
+
+: iter ( c z nb-iter -- x )
+    over absq 4.0 >= over zero? or
+    [ 2nip ] [ 1- >r sq dupd + r> iter ] if ; inline
+
+SYMBOL: cols
+
+: x-inc width 200000 zoom-fact * / ; inline
+: y-inc height 150000 zoom-fact * / ; inline
+
+: c ( i j -- c )
+    >r
+    x-inc * center real x-inc width 2 / * - + >float
+    r>
+    y-inc * center imaginary y-inc height 2 / * - + >float
+    rect> ; inline
+
+: render ( -- )
+    height [
+        width swap [
+            c 0 nb-iter iter dup zero? [
+                drop "\0\0\0"
+            ] [
+                cols get [ length mod ] keep nth
+            ] if %
+        ] curry each
+    ] each ;
+
+: ppm-header ( w h -- )
+    "P6\n" % swap # " " % # "\n255\n" % ;
+
+: sbuf-size width height * 3 * 100 + ;
+
+: mandel ( -- string )
+    [
+        sbuf-size <sbuf> building set
+        width height ppm-header
+        nb-iter max-color min <color-map> cols set
+        render
+        building get >string
+    ] with-scope ;
+
+: mandel-main ( file -- )
+    "mandel.ppm" resource-path <file-writer>
+    [ mandel write ] with-stream ;
+
+MAIN: mandel-main
diff --git a/extra/benchmark/nsieve-bits/nsieve-bits.factor b/extra/benchmark/nsieve-bits/nsieve-bits.factor
new file mode 100644 (file)
index 0000000..c2f8e02
--- /dev/null
@@ -0,0 +1,36 @@
+IN: benchmark.nsieve-bits
+USING: math math.parser sequences sequences.private kernel
+bit-arrays namespaces io ;
+
+: clear-flags ( step i seq -- )
+    2dup length >= [
+        3drop
+    ] [
+        f pick pick set-nth-unsafe >r over + r> clear-flags
+    ] if ; inline
+
+: (nsieve-bits) ( count i seq -- count )
+    2dup length <= [
+        2dup nth-unsafe [
+            over dup 2 * pick clear-flags
+            rot 1+ -rot ! increment count
+        ] when >r 1+ r> (nsieve-bits)
+    ] [
+        2drop
+    ] if ; inline
+
+: nsieve-bits ( m -- count )
+    0 2 rot 1+ <bit-array> dup set-bits (nsieve-bits) ;
+
+: nsieve-bits. ( m -- )
+    [ "Primes up to " % dup # " " % nsieve-bits # ] "" make
+    print ;
+
+: nsieve-bits-main ( n -- )
+    dup 2^ 10000 * nsieve-bits.
+    dup 1 - 2^ 10000 * nsieve-bits.
+    2 - 2^ 10000 * nsieve-bits. ;
+
+: nsieve-bits-main* 11 nsieve-bits-main ;
+
+MAIN: nsieve-bits-main*
diff --git a/extra/benchmark/nsieve/nsieve.factor b/extra/benchmark/nsieve/nsieve.factor
new file mode 100644 (file)
index 0000000..b9200fb
--- /dev/null
@@ -0,0 +1,35 @@
+IN: benchmark.nsieve
+USING: math math.parser sequences sequences.private kernel
+arrays namespaces io ;
+
+: clear-flags ( step i seq -- )
+    2dup length >= [
+        3drop
+    ] [
+        f pick pick set-nth-unsafe >r over + r> clear-flags
+    ] if ; inline
+
+: (nsieve) ( count i seq -- count )
+    2dup length <= [
+        2dup nth-unsafe [
+            over dup 2 * pick clear-flags
+            rot 1+ -rot ! increment count
+        ] when >r 1+ r> (nsieve)
+    ] [
+        2drop
+    ] if ; inline
+
+: nsieve ( m -- count )
+    0 2 rot 1+ t <array> (nsieve) ;
+
+: nsieve. ( m -- )
+    [ "Primes up to " % dup # " " % nsieve # ] "" make print ;
+
+: nsieve-main ( n -- )
+    dup 2^ 10000 * nsieve.
+    dup 1 - 2^ 10000 * nsieve.
+    2 - 2^ 10000 * nsieve. ;
+
+: nsieve-main* 9 nsieve-main ;
+
+MAIN: nsieve-main*
diff --git a/extra/benchmark/partial-sums/partial-sums.factor b/extra/benchmark/partial-sums/partial-sums.factor
new file mode 100644 (file)
index 0000000..664b988
--- /dev/null
@@ -0,0 +1,62 @@
+USING: math math.functions kernel sequences io io.styles
+prettyprint words hints ;
+IN: benchmark.partial-sums
+
+: summing ( n quot -- y )
+    [ + ] compose 0.0 -rot 1 -rot (each-integer) ; inline
+
+: 2/3^k ( n -- y ) [ 2.0 3.0 / swap 1- ^ ] summing ;
+
+HINTS: 2/3^k fixnum ;
+
+: k^-0.5 ( n -- y ) [ -0.5 ^ ] summing ;
+
+HINTS: k^-0.5 fixnum ;
+
+: 1/k(k+1) ( n -- y ) [ dup 1+ * recip ] summing ;
+
+HINTS: 1/k(k+1) fixnum ;
+
+: cube ( x -- y ) dup dup * * ; inline
+
+: flint-hills ( n -- y )
+    [ dup cube swap sin sq * recip ] summing ;
+
+HINTS: flint-hills fixnum ;
+
+: cookson-hills ( n -- y )
+    [ dup cube swap cos sq * recip ] summing ;
+
+HINTS: cookson-hills fixnum ;
+
+: harmonic ( n -- y ) [ recip ] summing ;
+
+HINTS: harmonic fixnum ;
+
+: riemann-zeta ( n -- y ) [ sq recip ] summing ;
+
+HINTS: riemann-zeta fixnum ;
+
+: -1^ 2 mod zero? 1 -1 ? ; inline
+
+: alternating-harmonic ( n -- y ) [ dup -1^ swap / ] summing ;
+
+HINTS: alternating-harmonic fixnum ;
+
+: gregory ( n -- y ) [ dup -1^ swap 2 * 1- / ] summing ;
+
+HINTS: gregory fixnum ;
+
+: functions
+    { 2/3^k k^-0.5 1/k(k+1) flint-hills cookson-hills harmonic riemann-zeta alternating-harmonic gregory } ;
+
+: partial-sums ( n -- )
+    standard-table-style [
+        functions [
+            [ tuck execute pprint-cell pprint-cell ] with-row
+        ] curry* each
+    ] tabular-output ;
+
+: partial-sums-main 2500000 partial-sums ;
+
+MAIN: partial-sums-main
diff --git a/extra/benchmark/raytracer/raytracer.factor b/extra/benchmark/raytracer/raytracer.factor
new file mode 100644 (file)
index 0000000..8f447bc
--- /dev/null
@@ -0,0 +1,176 @@
+! Factor port of the raytracer benchmark from
+! http://www.ffconsultancy.com/free/ray_tracer/languages.html
+
+USING: float-arrays compiler generic io io.files kernel math
+math.vectors math.parser namespaces sequences
+sequences.private words ;
+IN: benchmark.raytracer
+
+! parameters
+: light
+    #! Normalized { -1 -3 2 }.
+    F{
+        -0.2672612419124244
+        -0.8017837257372732
+        0.5345224838248488
+    } ; inline
+
+: oversampling 4 ; inline
+
+: levels 3 ; inline
+
+: size 200 ; inline
+
+: delta 1.4901161193847656E-8 ; inline
+
+TUPLE: ray orig dir ;
+
+C: <ray> ray
+
+TUPLE: hit normal lambda ;
+
+C: <hit> hit
+
+GENERIC: intersect-scene ( hit ray scene -- hit )
+
+TUPLE: sphere center radius ;
+
+C: <sphere> sphere
+
+: sphere-v ( sphere ray -- v )
+    swap sphere-center swap ray-orig v- ; inline
+
+: sphere-b ( ray v -- b ) swap ray-dir v. ; inline
+
+: sphere-disc ( sphere v b -- d )
+    sq swap norm-sq - swap sphere-radius sq + ; inline
+
+: -+ ( x y -- x-y x+y ) [ - ] 2keep + ; inline
+
+: sphere-b/d ( b d -- t )
+    -+ dup 0.0 < [ 2drop 1.0/0.0 ] [ >r [ 0.0 > ] keep r> ? ] if ; inline
+
+: ray-sphere ( sphere ray -- t )
+    2dup sphere-v tuck sphere-b [ sphere-disc ] keep
+    over 0.0 < [ 2drop 1.0/0.0 ] [ swap sqrt sphere-b/d ] if ;
+    inline
+
+: sphere-n ( ray sphere l -- n )
+    pick ray-dir n*v swap sphere-center v- swap ray-orig v+ ;
+    inline
+
+: if-ray-sphere ( hit ray sphere quot -- hit )
+    #! quot: hit ray sphere l -- hit
+    >r pick hit-lambda >r 2dup swap ray-sphere dup r> >=
+    [ 3drop ] r> if ; inline
+
+M: sphere intersect-scene ( hit ray sphere -- hit )
+    [ [ sphere-n normalize ] keep <hit> nip ] if-ray-sphere ;
+
+TUPLE: group objs ;
+
+: <group> ( objs bound -- group )
+    { set-group-objs set-delegate } group construct ;
+
+: make-group ( bound quot -- )
+    swap >r { } make r> <group> ; inline
+
+M: group intersect-scene ( hit ray group -- hit )
+    [
+        drop
+        group-objs [ >r tuck r> intersect-scene swap ] each
+        drop
+    ] if-ray-sphere ;
+
+: initial-hit T{ hit f F{ 0.0 0.0 0.0 } 1.0/0.0 } ; inline
+
+: initial-intersect ( ray scene -- hit )
+    initial-hit -rot intersect-scene ; inline
+
+: ray-o ( ray hit -- o )
+    over ray-dir over hit-lambda v*n
+    swap hit-normal delta v*n v+
+    swap ray-orig v+ ; inline
+
+: sray-intersect ( ray scene hit -- ray )
+    swap >r ray-o light vneg <ray> r> initial-intersect ; inline
+
+: ray-g ( hit -- g ) hit-normal light v. ; inline
+
+: cast-ray ( ray scene -- g )
+    2dup initial-intersect dup hit-lambda 1.0/0.0 = [
+        3drop 0.0
+    ] [
+        dup ray-g >r sray-intersect hit-lambda 1.0/0.0 =
+        [ r> neg ] [ r> drop 0.0 ] if
+    ] if ; inline
+
+: create-center ( c r d -- c2 )
+    >r 3.0 12.0 sqrt / * r> n*v v+ ; inline
+
+DEFER: create ( level c r -- scene )
+
+: create-step ( level c r d -- scene )
+    over >r create-center r> 2.0 / >r >r 1 - r> r> create ;
+
+: create-offsets ( quot -- )
+    {
+        F{ -1.0 1.0 -1.0 }
+        F{ 1.0 1.0 -1.0 }
+        F{ -1.0 1.0 1.0 }
+        F{ 1.0 1.0 1.0 }
+    } swap each ; inline
+
+: create-bound ( c r -- sphere ) 3.0 * <sphere> ;
+
+: create-group ( level c r -- scene )
+    2dup create-bound [
+        2dup <sphere> ,
+        [ >r 3dup r> create-step , ] create-offsets 3drop
+    ] make-group ;
+
+: create ( level c r -- scene )
+    pick 1 = [ <sphere> nip ] [ create-group ] if ;
+
+: ss-point ( dx dy -- point )
+    [ oversampling /f ] 2apply 0.0 3float-array ;
+
+: ss-grid ( -- ss-grid )
+    oversampling [ oversampling [ ss-point ] curry* map ] map ;
+
+: ray-grid ( point ss-grid -- ray-grid )
+    [
+        [ v+ normalize { 0.0 0.0 -4.0 } swap <ray> ] curry* map
+    ] curry* map ;
+
+: ray-pixel ( scene point -- n )
+    ss-grid ray-grid 0.0 -rot
+    [ [ swap cast-ray + ] curry* each ] curry* each ;
+
+: pixel-grid ( -- grid )
+    size reverse [
+        size [
+            [ size 0.5 * - ] 2apply swap size
+            3float-array
+        ] curry* map
+    ] map ;
+
+: pgm-header ( w h -- )
+    "P5\n" % swap # " " % # "\n255\n" % ;
+
+: pgm-pixel ( n -- ) 255 * 0.5 + >fixnum , ;
+
+: ray-trace ( scene -- pixels )
+    pixel-grid [ [ ray-pixel ] curry* map ] curry* map ;
+
+: run ( -- string )
+    levels { 0.0 -1.0 0.0 } 1.0 create ray-trace [
+        size size pgm-header
+        [ [ oversampling sq / pgm-pixel ] each ] each
+    ] "" make ;
+
+: raytracer-main
+    "raytracer.pnm" resource-path
+    <file-writer> [ run write ] with-stream ;
+
+MAIN: raytracer-main
diff --git a/extra/benchmark/recursive/recursive.factor b/extra/benchmark/recursive/recursive.factor
new file mode 100644 (file)
index 0000000..79c6dfb
--- /dev/null
@@ -0,0 +1,44 @@
+IN: benchmark.recursive
+USING: math kernel hints prettyprint io ;
+
+: fib ( m -- n )
+    dup 2 < [ drop 1 ] [ dup 1 - fib swap 2 - fib + ] if ;
+
+! HINTS: fib { fixnum float } ;
+! 
+: ack ( m n -- x )
+    over zero? [
+        nip 1+
+    ] [
+        dup zero? [
+            drop 1- 1 ack
+        ] [
+            dupd 1- ack >r 1- r> ack
+        ] if
+    ] if ;
+
+! HINTS: ack fixnum fixnum ;
+
+: tak ( x y z -- t )
+    pick pick swap < [
+        [ rot 1- -rot tak ] 3keep
+        [ -rot 1- -rot tak ] 3keep
+        1- -rot tak
+        tak
+    ] [
+        2nip
+    ] if ;
+
+! HINTS: tak { fixnum float } { fixnum float } { fixnum float } ;
+
+: recursive ( n -- )
+    3 over ack . flush
+    dup 27.0 + fib . flush
+    1-
+    dup 3 * over 2 * rot tak . flush
+    3 fib . flush
+    3.0 2.0 1.0 tak . flush ;
+
+: recursive-main 11 recursive ;
+
+MAIN: recursive-main
diff --git a/extra/benchmark/reverse-complement-test-in.txt b/extra/benchmark/reverse-complement-test-in.txt
new file mode 100644 (file)
index 0000000..f1caba0
--- /dev/null
@@ -0,0 +1,171 @@
+>ONE Homo sapiens alu
+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
+GGCGACAGAGCGAGACTCCG
+>TWO IUB ambiguity codes
+cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg
+tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa
+NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt
+cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga
+gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa
+HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca
+tttHatSttMtWgtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactt
+tattRggaMcDaWaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSSt
+acaStYRctVaNMtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaacct
+tacgtVtcVaattVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYt
+gtttaagaagattattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWa
+accRVacacaaactaccScattRatatKVtactatatttHttaagtttSKtRtacaaagt
+RDttcaaaaWgcacatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgt
+tgDcgtMgcatBtgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacag
+cccccacatYScaMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctg
+ttWaaataaaataRattagHacacaagcgKatacBttRttaagtatttccgatctHSaat
+actcNttMaagtattMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKagg
+YtaaBataSaVatactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSa
+KtWaStVcNKHKttactatccctcatgWHatWaRcttactaggatctataDtDHBttata
+aaaHgtacVtagaYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBa
+aNtgctggMBaKctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacg
+gtttNattgVtttctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgc
+tcttagHVggaYtgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccK
+tcHaaStttMcctagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMt
+ttctWgtNtgtgaaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacg
+ggtaKVattKYagactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNa
+BKRgNacaactgatttcctttaNcgatttctctataScaHtataRagtcRVttacDSDtt
+aRtSatacHgtSKacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacc
+tttYtatgttactttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatc
+cgtaBVttccagccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcac
+aattgcaNtSBaaccgggttattaaBcKatDagttactcttcattVtttHaaggctKKga
+tacatcBggScagtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcga
+aacaHtaagttaRatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaD
+gttVHWgtcHaaHgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtg
+ttHWHacgattBtgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcV
+taBtWaaYatcDRaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaa
+ccctcccctagaWBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagat
+gaaaaHctctaacgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgg
+gaWtactKKMaacatKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaa
+tYttWttaWSSttaHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctt
+tYatcatKgctcctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactt
+taSatcgDataaactaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatca
+cBVctgcaVatVttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBag
+aHSBDgtagcacRHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHt
+cgtYaaMNgBaatttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctctt
+ttVctagctDaaagtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBW
+attccgStaMSaMatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatag
+ttactttacgatcaccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaa
+attBgtataRaaaacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStc
+tHNaaatctBBtcttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHccta
+>THREE Homo sapiens frequency
+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
+ggaagtgaaaagataaatat
diff --git a/extra/benchmark/reverse-complement-test-out.txt b/extra/benchmark/reverse-complement-test-out.txt
new file mode 100644 (file)
index 0000000..14d792a
--- /dev/null
@@ -0,0 +1,171 @@
+>ONE Homo sapiens alu
+CGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAAC
+CTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACA
+GGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCAT
+GTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAA
+AGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTC
+TGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGG
+GTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACC
+ACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTG
+GTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTA
+CAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCT
+GGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTC
+TCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCCGGCTAAT
+TTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTCGAACTCCT
+GACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCA
+CCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGC
+GCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCC
+TCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTA
+GTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGAT
+CCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCT
+TTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTC
+ACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTG
+GGATTACAGGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGT
+TTCACCATGTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGG
+CCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAG
+TCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCG
+CCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGC
+GCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGG
+CCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGC
+TGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCG
+CCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCA
+AGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCC
+CGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTC
+GAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGC
+GTGAGCCACCGCGCCCGGCC
+>TWO IUB ambiguity codes
+TAGGDHACHATCRGTRGVTGAGWTATGYTGCTGTCABACDWVTRTAAGAVVAGATTTNDA
+GASMTCTGCATBYTTCAAKTTACMTATTACTTCATARGGYACMRTGTTTTYTATACVAAT
+TTCTAKGDACKADACTATATNTANTCGTTCACGBCGYSCBHTANGGTGATCGTAAAGTAA
+CTATBAAAAGATSTGWATBCSGAKHTTABBAACGTSYCATGCAAVATKTSKTASCGGAAT
+WVATTTNTCCTTCTTCTTDDAGTGGTTGGATACVGTTAYMTMTBTACTTTHAGCTAGBAA
+AAGAGKAAGTTRATWATCAGATTMDDTTTAAAVAAATATTKTCYTAAATTVCNKTTRACG
+ADTATATTTATGATSADSCAATAWAGCGRTAGTGTAAGTGACVGRADYGTGCTACHVSDT
+CTVCARCSYTTAATATARAAAATTTAATTTACDAATTGBACAGTAYAABATBTGCAGBVG
+TGATGGDCAAAATBNMSTTABKATTGGSTCCTAGBTTACTTGTTTAGTTTATHCGATSTA
+AAGTCGAKAAASTGTTTTAWAKCAGATATACTTTTMTTTTGBATAGAGGAGCMATGATRA
+AAGGNCAYDCCDDGAAAGTHGBTAATCKYTBTACBGTBCTTTTTGDTAASSWTAAWAARA
+TTGGCTAAGWGRADTYACATAGCTCBTAGATAWAGCAATNGTATMATGTTKMMAGTAWTC
+CCNTSGAAWATWCAAAAMACTGAADNTYGATNAATCCGAYWNCTAACGTTAGAGDTTTTC
+ATCTGGKRTAVGAABVCTGWGBTCTDVGKATTBTCTAAGGVADAAAVWTCTAGGGGAGGG
+TTAGAACAATTAAHTAATNAAATGCATKATCTAAYRTDTCAGSAYTTYHGATRTTWAVTA
+BGNTCDACAGBCCRCAGWCRTCABTGMMAWGMCTCAACCGATRTGBCAVAATCGTDWDAA
+CAYAWAATWCTGGTAHCCCTAAGATAACSCTTAGTGSAACAWTBGTCDTTDGACWDBAAC
+HTTTNGSKTYYAAYGGATNTGATTTAARTTAMBAATCTAAGTBTCATYTAACTTADTGTT
+TCGATACGAAHGGCYATATACCWDTKYATDCSHTDTCAAAATGTGBACTGSCCVGATGTA
+TCMMAGCCTTDAAABAATGAAGAGTAACTHATMGVTTAATAACCCGGTTVSANTGCAATT
+GTGAGATTTAMGTTTAMAAYGCTGACAYAAAAAGGCACAMYTAAGVGGCTGGAABVTACG
+GATTSTYGTBVAKTATWACCGTGTKAGTDTGTATGTTTAAAGGAAAAAGTAACATARAAA
+GGTYCAMNYAAABTATAGNTSATANAGTCATCCTATWADKAACTRGTMSACDGTATSAYT
+AAHSHGTAABYGACTYTATADTGSTATAGAGAAATCGNTAAAGGAAATCAGTTGTNCYMV
+TNACDRTATBNATATASTAGAAMSCGGGANRCKKMCAAACATTNAGTCTRMAATBMTACC
+CGTACTTCTBGDSYAATWGAAAATGACADDCHAKAAAYATATTKTTTTCACANACWAGAA
+AKATCCTTATTAYKHKCTAAACARTATTTTDATBTVWCYGCAATACTAGGKAAASTTDGA
+MGGCHTTHAATVCAHDRYAGGRCTATACGTCMAGAGAGCTBTHGNACARTCCBDCTAAGA
+GCGGCTTTARTAAAGAATCCNAGTAWBTGACTTGAATTACWTVACAGAAABCAATNAAAC
+CGTNTRANTTGAYCMAWBADTANABRGGTKTHTWTAGTTVCTMBKTAGMTVKCCAGCANT
+TVAGSWTTAGCCGCRHTTTCCTTHNTATTAAGAAGAATAGGMTRAARTCTABGTACDTTT
+TATAAVDHAHTATAGATCCTAGTAAGYTWATDWCATGAGGGATAGTAAMDMNGBASTWAM
+TSTATRBAYDABATGTATATYCGCACTGTTTTAACMCWBTATAWAGTATBTSTATVTTAR
+CCTMTTAAKADATCAACTAATYTSVTAKGDATTATGCKTCAYCAKAATACTTKAANGAGT
+ATTSDAGATCGGAAATACTTAAYAAVGTATMCGCTTGTGTDCTAATYTATTTTATTTWAA
+CAGWRCTATGTAGMTGTTTGTTYKTNGTTKTCAGAACNTRACCTACKTGSRATGTGGGGG
+CTGTCATTAAGTAAATNGSTTABCCCCTCGCAGCTCWHTCGCGAAGCAVATGCKACGHCA
+ACAKTTAATAACASAAADATTWNYTGTAATTGTTCGTMHACHTWATGTGCWTTTTGAAHY
+ACTTTGTAYAMSAAACTTAADAAATATAGTABMATATYAATGSGGTAGTTTGTGTBYGGT
+TWSGSVGWMATTDMTCCWWCABTCSVACAGBAATGTTKATBGTCAATAATCTTCTTAAAC
+ARVAATHAGYBWCTRWCABGTWWAATCTAAGTCASTAAAKTAAGVKBAATTBGABACGTA
+AGGTTAAATAAAAACTRMDTWBCTTTTTAATAAAAGATMGCCTACKAKNTBAGYRASTGT
+ASSTCGTHCGAAKTTATTATATTYTTTGTAGAACATGTCAAAACTWTWTHGKTCCYAATA
+AAGTGGAYTMCYTAARCSTAAATWAKTGAATTTRAGTCTSSATACGACWAKAASATDAAA
+TGYYACTSAACAAHAKTSHYARGASTATTATTHAGGYGGASTTTBGAKGATSANAACACD
+TRGSTTRAAAAAAAACAAGARTCVTAGTAAGATAWATGVHAAKATWGAAAAGTYAHVTAC
+TCTGRTGTCAWGATRVAAKTCGCAAVCGASWGGTTRTCSAMCCTAACASGWKKAWDAATG
+ACRCBACTATGTGTCTTCAAAHGSCTATATTTCGTVWAGAAGTAYCKGARAKSGKAGTAN
+TTTCYACATWATGTCTAAAADMDTWCAATSTKDACAMAADADBSAAATAGGCTHAHAGTA
+CGACVGAATTATAAAGAHCCVAYHGHTTTACATSTTTATGNCCMTAGCATATGATAVAAG
+>THREE Homo sapiens frequency
+ATATTTATCTTTTCACTTCCTACATTGGTCAGACCATTATTCGACACGTGGCGTCATTTT
+GTCATACCGGGTAATGTTGGAAACAAAACGTACTGATAAAATACTGAGTTGTAAACTCTA
+ATCAGATAACGCGCTTGGATATTAAGATTCACACAGGGGTTTCGGCTGTAAAAAAACTTG
+TGGAGCTGTTCTGGGACAGATAAGTTGTACCTCGTACTTAGCTAATTAATGAACCAACTG
+ATTACGATAGAACAATTCTGAGGCCGCCAGGACAGCCAAATTTTAATCTTATAAAGCTGG
+AAACAGCCGGTATTAGCTTCTCGCATACTTTGCCTGCATTGGTACCTTACAGATATCAGC
+GTAGTCATATACACCTCGGTCTCAGCTAAGCTTGTATCTCTTAGAGTAGTTCAAAGATAG
+TGGACAATACCTGTGGAATCGATTGCAGATATGGATTTATTTAACTACTGAGTCTCATTC
+ACAAGCTAAGCAAGGAGCACGTTTTGGTGCCGGCATACCGATTTGCTATCATGTCAGCAA
+ATTTGCGTTGTATTCCTAGTTGCACCCATTAAGGCCACACTCCGAACCTAATTATTACAT
+CGCAAAGACATGTACGAAGGACCCGATGTCGAATAGAAGGGAGGACTGTTCATTGGAAGC
+TAGACCAGAGGAATCGCAAAGATGCAACTCTTACAATAAAAATCTAATTTCAGTCAACAC
+GCAATTTCTATAAGGTTTCCGATAATAATGAACCGTCTTCCACAGGGGAATTTGCCATGC
+TCGTAAAAGTAGTTAATCCAAGTAGAAGAAATTTTGATAATGTTTTAAGTTGGCACGAAG
+GAATTCAGAGAGATCTTACCTAACAAAGGCATTAGTAGATGTTCCTTGGTTCACACTCGG
+TCAATCAGAGCACATACTACGGGCGATACCGGGAATGACACAACATCAATGAGATTGTTA
+AGTGAGGTAATTGACTTTAGAGGACTCGATCAGTATACTGTCACTATGAACATCGTATTA
+ATTGTTATCCGATATATACACCACCGATTTGCTTGTGCAAGGTTACAGACCCATTCGATA
+AATACAAACACGGAGCGATATTATTTAAGGAGTGCTGTCTTCAAAAGAATTATTCCCACA
+CCGACATAAGAACTTCGCTCCGTCATTCCAGATTTAAATAACATAACGTAACGCTTTGCT
+GATAACATAACATAACCGAGAATTTGCTTAGGAAATTTGGAGCAATATTGCATTGTTTCT
+CAGTCATCACAAGGCCCGCCAAAGAACTCTGAGAATCAGGATTCAACATGATTGGTAAGA
+CTCTATATATATAACTTAATTCTTGTGTCCGGAGATAGAAAGAGGACGAGAGATACTACG
+AAAGAAAGTGTACTTCGATGTATCAATTCAGACGCCTTCTCTATCATCAACATTATAGGT
+CTCGTATATGCTCGGCGCGATCTGCTTCTCTCCGCCAATAGCCCCATAGTGTATTTCAAG
+CGCAGTAACAGTGAAATCGTTACGAAGGTAGGGATGTTGCTTATAATTGTCGTAACTTAT
+CGCTTATGTATCTTTCAAGAATGAACGGCAGCATATACATACGTTCTACCTTTAGCTACA
+AAGCATCCATATACTCCCTCTCATGATTGAAACTCTTCCCTATTTTGTAGCCAATAGTGA
+AAGCGTATTAGTATAAATTCGTCGGTTTTTCACTCGCAACTGTTATACTCTGCAAACAAA
+CGAAAGCCTCATAGTACAAACCTAAAGCTACATACTTCATCATTGGCAGACCAGTGGCGG
+TATTTCTACGGAAGCATCACTATAGATATAAAGTTTCCCTTCATGTACGTCTGTTAACCA
+TATCACAAGAAACTGCTATCTCTGTCACGTAACAATTCACGCGCCTTATCGCCAAATGTT
+CATATATGCGCGGTATACGTATGAACGAATACTAATTAGTATAACGGAGGATTCACGGGA
+GGGATACTTGGGGCATTTATAAATCGTCTAAAAATTTTCTATCAGCACTTGCGGGTTATA
+GTGGATTACTAGGCAACATAATATTCTGTATTGGTCCAAATGACGCTATAGATAAATTAG
+CAAAATACATTGTTTCCATTTATGTAAGTCGAAACTCCAGGACTCCCGGGAACCAGTTAA
+ACCGTCTGGAAAAGACACATTGTGAGCGGGACTTCAATGATAGCTTTCAATGAGCTTCTC
+ATGCTTGGGGTCTGTACATATATGTTGGCGAAATTATCGTCTGTATTCTGTTATGCTTTG
+ATCATGGGTTATTAGTATAGTGTCCGGTTAAGTACCAATACCGCTAGAGACCCGACCTAA
+GTCGATAACTAACGATCATCGACGTAAGGATCGTCTCGATCAGTACTTCAGTCTAGATCT
+GGGAATAGTAACTCGTTAGTGAACTATGTCGTGTCATAACTCTAAAATGCAATCAAATCT
+TATTATTGAGTATTGATTATATAAAGCATCCGCTTAGCTTTACCCTCAAATGTTATATGC
+AATTTAAAGCGCTTGATATCGTCTACTCAAGTTCAGGTTTCACATGGCCGCAACGTGACG
+TTATTAGAGGTGGGTCATCATCTCTGAGGCTAGTGATGTTGAATACTCATTGAATGGGAA
+GTGGAATACCATGCTCGTAGGTAACAGCATGACCTATAAAATATACTATGGGTGTGTGGT
+AGATCAATATTGTTCAAGCATATCGTAACAATAACGGCTGAAATGTTACTGACATGAAAG
+AGGGAGTCCAAACCATTCTAACAGCTGATCAAGTCGTCTAAAAACGCCTGGTTCAGCCTT
+AAGAGTTATAAGCCAGACAAATTGTATCAATAGAGAATCCGTAAATTCCTCGGCCAACCT
+CTTGCAAAGACATCACTATCAATATACTACCGTGATCTTAATTAGTGAACTTATATAAAT
+ATCTACAACCAGATTCAACGGAAAAGCTTTAGTGGATTAGAAATTGCCAAGAATCACATT
+CATGTGGGTTCGAATGCTTTAGTAATACCATTTCGCCGAGTAGTCACTTCGCTGAACTGT
+CGTAAATTGCTATGACATAATCGAAAAGGATTGTCAAGAGTCGATTACTGCGGACTAATA
+ATCCCCACGGGGGTGGTCTCATGTCTCCCCAGGCGAGTGGGGACGGTTGATAAACACGCT
+GCATCGCGGACTGATGTTCCCAGTATTACATAGTCACATTGGATTGCGAGTAGTCTACCT
+ATTTATGAGCGAGAGATGCCTCTAACTACTTCGACTTTTAAAACCTTTCCACGCCAGTAT
+TCGGCGAAAGGGAAGTATTAAGGGTTGTCATAATTAAGCTGATACCACTTCAGACTTTGC
+TCTACTTCTGTCTTTCATTGGTTTAGTAAAGTCTGTCCATTCGTCGAGACCGTCTTTTGC
+AGCCTCATTCTACCAACTGCTCCGACTCTTAGTCTGCTTCTCCCAGCGTTATAACAAGAG
+GCATTTTGTCATCCTTAAAACAATAATAAAGAACTCGGAGCACTGATATAATGACTGAAT
+TAGAACCGCTTAAAAATACAACGAATAGATAAGACTATCGGATAAGATCTAATATGTAGT
+GATTAAGCCCTTTATTAATTAATAATAGTTACCCTTTCTGATGTAACGCGACATATTACG
+ATTTAGTGGCACGTCTGAATTGCAAAGCAGATCTCTACCCGATTTTTATTATAAATCCCG
+TATACATCTTGACTTGAGTAATTGTTCATCTTTTTATATCTCTTCGTACTACAAATAATT
+AATATCTCAACCCGTATTGTGTGATTCTAATTACCAACAGAATACGAGGAGGTTTTTGCT
+TAGGGCCATATATAATGAATCTATCTCGTTTATTCGCGGAACCCGAGATAACATTACGAT
+GTAACTATTTTAGAGAACTTAATACAAGAAACATTGCTGATTACTCATAACTAAATGCTT
+GGTAATATATCCTCAGTGCCCCTACCATCTTTTACGCAGGGATGTAATTACTTAGGATTC
+ATTGTGTAAGAATTACAATGAACGATGGATATGAAGGCATGTTGCGAGGTGTTCCTTGGT
+ATGTGAAGTTCGCAGGGCAACAAAAATTTCGCAGAATAGGCCTCAAAGTATTGGTAAAGA
+AGACAACTAATCATCACGAGCTTCTGATATCAATACGAACGAGTCCTGTGATGGATGAAA
+GAAAGTCGTATCGAAAATGTCAAGAGTCTGCCCAATGTAACTTACTTCAAAAAATAACGC
+TTCCGCCAAGTACGTTCGAATAAACGTAATTTTAAAAATACATAAGGGGTGTTAGAAAGT
+AAGCGACGGGATATAAGTTAGACTCAAGATTCCGCCGTAAAACGAGACTGATTCCGAAGA
+TTGTTCGTGGATCTGGTCATGACTTTCACTGAGTAAGGAGTTTCGACATATGTCAATAAA
+CACAAAAATAGAAGCTATTCGATCTGAAAAATATTAGGACAAGAAACTATCTCACGCTAG
+CCCAGAATATTCACTCACCCACGGGCGATACTAAAGCACTATATAGTCGCGTGATTACTA
+TACATATGGTACACATAAGAATCACGATCAGGTTCTCAATTTTCAACAATATATGTTTAT
+TTGCATAGGTAATATTAGGCCTTTAAGAGAAGGATGGGTGAGATACTCCGGGGATGGCGG
+CAATAAAGAAAAACACGATATGAGTAATAGGATCCTAATATCTTGGCGAGAGACTTAAGG
+TACGAATTTTGCGCAATCTATTTTTTACTTGGCCAGAATTCATGTATGGTATAAGTACGA
+ACTTTTTTGATCACTTTCATGGCTACCTGATTAGGATAGTTTGAGGAATTTCCCAAATAT
+ACCGATTTAATATACACTAGGGCTTGTCACTTTGAGTCAGAAAAAGAATATAATTACTTA
+GGGTAATGCTGCATACATATTCTTATATTGCAAAGGTTCTCTGGGTAATCTTGAGCCTTC
+ACGATACCTGGTGAAGTGTT
diff --git a/extra/benchmark/reverse-complement/reverse-complement.factor b/extra/benchmark/reverse-complement/reverse-complement.factor
new file mode 100644 (file)
index 0000000..7de7ec2
--- /dev/null
@@ -0,0 +1,43 @@
+USING: io io.files io.streams.duplex kernel sequences
+sequences.private strings vectors words memoize splitting
+hints ;
+IN: benchmark.reverse-complement
+
+MEMO: trans-map ( -- str )
+    256 >string
+    "TGCAAKYRMBDHV" "ACGTUMRYKVHDB"
+    [ pick set-nth ] 2each ;
+
+: do-trans-map ( str -- )
+    [ ch>upper trans-map nth ] change-each ;
+
+HINTS: do-trans-map string ;
+
+: translate-seq ( seq -- str )
+    concat dup reverse-here dup do-trans-map ;
+
+: show-seq ( seq -- )
+    translate-seq 60 <groups> [ print ] each ;
+
+: do-line ( seq line -- seq )
+    dup first ">;" memq? [
+        over show-seq print dup delete-all
+    ] [
+        over push
+    ] if ;
+
+: (reverse-complement) ( seq -- )
+    readln [ do-line (reverse-complement) ] [ show-seq ] if* ;
+
+: reverse-complement ( infile outfile -- )
+    <file-writer> >r <file-reader> r> <duplex-stream> [
+        500000 <vector> (reverse-complement)
+    ] with-stream ;
+
+: reverse-complement-main ( -- )
+    "reverse-complement-in.txt"
+    "reverse-complement-out.txt"
+    [ home swap path+ ] 2apply
+    reverse-complement ;
+
+MAIN: reverse-complement-main
diff --git a/extra/benchmark/ring/ring.factor b/extra/benchmark/ring/ring.factor
new file mode 100644 (file)
index 0000000..b0d02c4
--- /dev/null
@@ -0,0 +1,25 @@
+USING: concurrency kernel tools.time math sequences ;
+IN: benchmark.ring
+
+SYMBOL: done
+
+: tunnel ( process -- process )
+    receive 2dup swap send done eq? [ tunnel ] unless ;
+
+: create-ring ( processes -- target )
+    self swap [ [ tunnel ] spawn nip ] times ;
+
+: send-messages ( messages target -- )
+    dupd [ send ] curry each [ receive drop ] times ; 
+
+: destroy-ring ( target -- )
+    done swap send [ done eq? ] receive-if drop ;
+
+: ring-bench ( messages processes -- )
+    create-ring [ send-messages ] keep destroy-ring ; 
+
+: main-ring-bench ( -- )
+    1000 1000 ring-bench ;
+
+MAIN: main-ring-bench
+
diff --git a/extra/benchmark/sort/sort.factor b/extra/benchmark/sort/sort.factor
new file mode 100644 (file)
index 0000000..0a31bf0
--- /dev/null
@@ -0,0 +1,7 @@
+USING: kernel sequences sorting random ;
+IN: benchmark.sort
+
+: sort-benchmark
+    100000 [ drop 100000 random ] map natural-sort drop ;
+
+MAIN: sort-benchmark
diff --git a/extra/benchmark/spectral-norm/spectral-norm.factor b/extra/benchmark/spectral-norm/spectral-norm.factor
new file mode 100644 (file)
index 0000000..196f061
--- /dev/null
@@ -0,0 +1,55 @@
+! Factor port of
+! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
+USING: float-arrays kernel math math.vectors sequences
+sequences.private prettyprint words tools.time hints ;
+IN: benchmark.spectral-norm
+
+: fast-truncate >fixnum >float ; inline
+
+: eval-A ( i j -- n )
+    [ >float ] 2apply
+    dupd + dup 1+ * 2 /f fast-truncate + 1+
+    recip ; inline
+
+: (eval-A-times-u) ( u i j -- x )
+    tuck eval-A >r swap nth-unsafe r> * ; inline
+
+: eval-A-times-u ( n u -- seq )
+    over [
+        pick 0.0 [
+            swap >r >r 2dup r> (eval-A-times-u) r> +
+        ] reduce nip
+    ] F{ } map-as 2nip ; inline
+
+: (eval-At-times-u) ( u i j -- x )
+    tuck swap eval-A >r swap nth-unsafe r> * ; inline
+
+: eval-At-times-u ( n u -- seq )
+    over [
+        pick 0.0 [
+            swap >r >r 2dup r> (eval-At-times-u) r> +
+        ] reduce nip
+    ] F{ } map-as 2nip ; inline
+
+: eval-AtA-times-u ( n u -- seq )
+    dupd eval-A-times-u eval-At-times-u ; inline
+
+: u/v ( n -- u v )
+    dup 1.0 <float-array> dup
+    10 [
+        drop
+        dupd eval-AtA-times-u
+        2dup eval-AtA-times-u
+        swap
+    ] times
+    rot drop ; inline
+
+: spectral-norm ( n -- norm )
+    u/v [ v. ] keep norm-sq /f sqrt ;
+
+HINTS: spectral-norm fixnum ;
+
+: spectral-norm-main ( n -- )
+    2000 spectral-norm . ;
+
+MAIN: spectral-norm-main
diff --git a/extra/benchmark/sum-file/sum-file.factor b/extra/benchmark/sum-file/sum-file.factor
new file mode 100644 (file)
index 0000000..0e64e80
--- /dev/null
@@ -0,0 +1,13 @@
+USING: io io.files math math.parser kernel prettyprint ;
+IN: benchmark.sum-file
+
+: sum-file-loop ( n -- n' )
+    readln [ string>number + sum-file-loop ] when* ;
+
+: sum-file ( file -- n )
+    <file-reader> [ 0 sum-file-loop ] with-stream . ;
+
+: sum-file-main ( -- )
+    home "sum-file-in.txt" path+ sum-file ;
+
+MAIN: sum-file-main
diff --git a/extra/benchmark/summary.txt b/extra/benchmark/summary.txt
new file mode 100644 (file)
index 0000000..eef76d3
--- /dev/null
@@ -0,0 +1 @@
+Various benchmarks to test Factor's optimizer
diff --git a/extra/benchmark/typecheck1/typecheck1.factor b/extra/benchmark/typecheck1/typecheck1.factor
new file mode 100644 (file)
index 0000000..25f5432
--- /dev/null
@@ -0,0 +1,10 @@
+USING: math kernel ;
+IN: benchmark.typecheck1
+
+TUPLE: hello n ;
+
+: foo 0 100000000 [ over hello-n + ] times ;
+
+: typecheck-main 0 hello construct-boa foo 2drop ;
+
+MAIN: typecheck-main
diff --git a/extra/benchmark/typecheck2/typecheck2.factor b/extra/benchmark/typecheck2/typecheck2.factor
new file mode 100644 (file)
index 0000000..d797706
--- /dev/null
@@ -0,0 +1,12 @@
+USING: math kernel kernel.private slots.private ;
+IN: benchmark.typecheck2
+
+TUPLE: hello n ;
+
+: hello-n* dup tuple? [ 4 slot ] [ 3 throw ] if ;
+
+: foo 0 100000000 [ over hello-n* + ] times ;
+
+: typecheck-main 0 hello construct-boa foo 2drop ;
+
+MAIN: typecheck-main
diff --git a/extra/benchmark/typecheck3/typecheck3.factor b/extra/benchmark/typecheck3/typecheck3.factor
new file mode 100644 (file)
index 0000000..e85fb28
--- /dev/null
@@ -0,0 +1,12 @@
+USING: math kernel kernel.private slots.private ;
+IN: benchmark.typecheck3
+
+TUPLE: hello n ;
+
+: hello-n* dup tag 2 eq? [ 4 slot ] [ 3 throw ] if ;
+
+: foo 0 100000000 [ over hello-n* + ] times ;
+
+: typecheck-main 0 hello construct-boa foo 2drop ;
+
+MAIN: typecheck-main
diff --git a/extra/benchmark/typecheck4/typecheck4.factor b/extra/benchmark/typecheck4/typecheck4.factor
new file mode 100644 (file)
index 0000000..a1362a6
--- /dev/null
@@ -0,0 +1,12 @@
+USING: math kernel kernel.private slots.private ;
+IN: benchmark.typecheck4
+
+TUPLE: hello n ;
+
+: hello-n* 4 slot ;
+
+: foo 0 100000000 [ over hello-n* + ] times ;
+
+: typecheck-main 0 hello construct-boa foo 2drop ;
+
+MAIN: typecheck-main
diff --git a/extra/bitfields/authors.txt b/extra/bitfields/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/bitfields/bitfields-docs.factor b/extra/bitfields/bitfields-docs.factor
new file mode 100644 (file)
index 0000000..b170c10
--- /dev/null
@@ -0,0 +1,16 @@
+USING: help.markup help.syntax bitfields ;
+
+HELP: BITFIELD:
+{ $syntax "BITFIELD: name slot:size... ;" }
+{ $values { "name" "name of bitfield" }  { "slot" "names of slots" } { "size" "sizes of slots" } }
+{ $description "Creates a new bitfield specification, with the constructor <name> and slot accessors of the form name-slot. Slots' values can be changed by words of the form with-name-slot, with the stack effect " { $code "( newvalue bitfield -- newbitfield )" } ". The slots have the amount of space specified, in bits, after the colon. The constructor and setters do not check to make sure there is no overflow, and any inappropriately high value (except in the first field) will corrupt the bitfield. To check overflow, use " { $link POSTPONE: SAFE-BITFIELD: } " instead. Padding can be included by writing the binary number to be used as a pad in the middle of the bitfield specification. The first slot written will have the most significant digits. Note that bitfields do not form a class; they are merely integers. For efficiency across platforms, it is often the best to keep the total size at or below 29, allowing fixnums to be used on all platforms." }
+{ $see-also define-bitfield } ;
+
+HELP: define-bitfield
+{ $values { "classname" "a string" } { "slots" "slot specifications" } }
+{ $description "Defines a bitfield constructor and slot accessors and setters. The workings of these are described in more detail at " { $link POSTPONE: BITFIELD: } ". The slot specifications should be an assoc. Any key which looks like a binary number will be treated as padding." } ;
+
+HELP: SAFE-BITFIELD:
+{ $syntax "SAFE-BITFIELD: name slot:size... ;" }
+{ $values { "name" "name of bitfield" } { "slot" "name of slots" } { "size" "size in bits of slots" } }
+{ $description "Defines a bitfield in the same way as " { $link POSTPONE: BITFIELD: } " but the constructor and slot setters check for overflow." } ;
diff --git a/extra/bitfields/bitfields-tests.factor b/extra/bitfields/bitfields-tests.factor
new file mode 100644 (file)
index 0000000..6c82ec0
--- /dev/null
@@ -0,0 +1,21 @@
+USING: tools.test bitfields kernel ;
+
+SAFE-BITFIELD: foo bar:5 baz:10 111 bing:2 ;
+
+[ 21 ] [ 21 852 3 <foo> foo-bar ] unit-test
+[ 852 ] [ 21 852 3 <foo> foo-baz ] unit-test
+[ 3 ] [ 21 852 3 <foo> foo-bing ] unit-test
+
+[ 23 ] [ 21 852 3 <foo> 23 swap with-foo-bar foo-bar ] unit-test
+[ 855 ] [ 21 852 3 <foo> 855 swap with-foo-baz foo-baz ] unit-test
+[ 1 ] [ 21 852 3 <foo> 1 swap with-foo-bing foo-bing ] unit-test
+
+[ 100 0 0 <foo> ] unit-test-fails
+[ 0 5000 0 <foo> ] unit-test-fails
+[ 0 0 10 <foo> ] unit-test-fails
+
+[ 100 0 with-foo-bar ] unit-test-fails
+[ 5000 0 with-foo-baz ] unit-test-fails
+[ 10 0 with-foo-bing ] unit-test-fails
+
+[ BIN: 00101100000000111111 ] [ BIN: 101 BIN: 1000000001 BIN: 11 <foo> ] unit-test
diff --git a/extra/bitfields/bitfields.factor b/extra/bitfields/bitfields.factor
new file mode 100644 (file)
index 0000000..b727fdb
--- /dev/null
@@ -0,0 +1,109 @@
+USING: parser kernel math sequences namespaces assocs inspector
+words splitting math.parser arrays sequences.next mirrors
+shuffle ;
+IN: bitfields
+
+! Example:
+! BITFIELD: blah short:16 char:8 nothing:5 ;
+! defines <blah> blah-short blah-char blah-nothing.
+
+! An efficient bitfield has a sum of 29 bits or less
+! so it can fit in a fixnum.
+! No class is defined and there is no overflow checking.
+! The first field is the most significant.
+
+: >ranges ( slots/sizes -- slots/ranges )
+    ! range is { start length }
+    reverse 0 swap [
+        swap >r tuck >r [ + ] keep r> 2array r> swap
+    ] assoc-map nip reverse ;
+
+SYMBOL: safe-bitfields? ! default f; set at parsetime
+
+TUPLE: check< number bound ;
+M: check< summary drop "Number exceeds upper bound" ;
+
+: check< ( num cmp -- num )
+    2dup < [ drop ] [ \ check< construct-boa throw ] if ;
+
+: ?check ( length -- )
+    safe-bitfields? get [ 2^ , \ check< , ] [ drop ] if ;
+
+: put-together ( lengths -- )
+    ! messy because of bounds checking
+    dup length 1- [ \ >r , ] times [ 0 swap ] % [
+        ?check [ \ bitor , , [ shift r> ] % ] when*
+    ] each-next \ bitor , ;
+
+: padding-name? ( string -- ? )
+    [ "10" member? ] all? ;
+
+: pad ( i name -- )
+    bin> , , \ -nrot , ;
+
+: add-padding ( names -- ) 
+    <enum>
+    [ dup padding-name? [ pad ] [ 2drop ] if ] assoc-each ;
+
+: [constructor] ( names lengths -- quot )
+    [ swap add-padding put-together ] [ ] make ;
+
+: define-constructor ( classname slots -- )
+    [ keys ] keep values [constructor]
+    >r in get constructor-word dup save-location r>
+    define-compound ;
+
+: range>accessor ( range -- quot )
+    [
+        dup first neg , \ shift ,
+        second 2^ 1- , \ bitand ,
+    ] [ ] make ;
+
+: [accessors] ( lengths -- accessors )
+    [ range>accessor ] map ;
+
+: clear-range ( range -- num )
+    first2 dupd + [ 2^ 1- ] 2apply bitnot bitor ;
+
+: range>setter ( range -- quot )
+    [
+        \ >r , dup second ?check \ r> ,
+        dup clear-range ,
+        [ bitand >r ] %
+        first , [ shift r> bitor ] %
+    ] [ ] make ;
+
+: [setters] ( lengths -- setters )
+    [ range>setter ] map ;
+
+: parse-slots ( slotspecs -- slots )
+    [ ":" split1 string>number [ dup length ] unless* ] { } map>assoc ;
+
+: define-slots ( prefix names quots -- )
+    >r [ "-" swap 3append create-in ] curry* map r>
+    [ define-compound ] 2each ;
+
+: define-accessors ( classname slots -- )
+    dup values [accessors]
+    >r keys r> define-slots ;
+
+: define-setters ( classname slots -- )
+    >r "with-" swap append r>
+    dup values [setters]
+    >r keys r> define-slots ;
+
+: filter-pad ( slots -- slots )
+    [ drop padding-name? not ] assoc-subset ;
+
+: define-bitfield ( classname slots -- ) 
+    [ define-constructor ] 2keep
+    >ranges filter-pad [ define-setters ] 2keep define-accessors ;
+
+: parse-bitfield 
+    scan ";" parse-tokens parse-slots define-bitfield ;
+
+: BITFIELD:
+    parse-bitfield ; parsing
+
+: SAFE-BITFIELD:
+    [ safe-bitfields? on parse-bitfield ] with-scope ; parsing
diff --git a/extra/bitfields/summary.txt b/extra/bitfields/summary.txt
new file mode 100644 (file)
index 0000000..fa2f7ff
--- /dev/null
@@ -0,0 +1 @@
+Simple system for specifying packed bitfields
diff --git a/extra/bitfields/tags.txt b/extra/bitfields/tags.txt
new file mode 100644 (file)
index 0000000..9ffc038
--- /dev/null
@@ -0,0 +1,2 @@
+collections
+extensions
diff --git a/extra/boids/authors.txt b/extra/boids/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/boids/boids.factor b/extra/boids/boids.factor
new file mode 100644 (file)
index 0000000..397ce6e
--- /dev/null
@@ -0,0 +1,233 @@
+
+USING: kernel namespaces
+       math
+       math.constants
+       math.functions
+       math.vectors
+       math.trig
+       combinators arrays sequences random vars combinators.lib ;
+
+IN: boids
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: boid pos vel ;
+
+C: <boid> boid
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: boids
+VAR: world-size
+VAR: time-slice
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: cohesion-weight
+VAR: alignment-weight
+VAR: separation-weight
+
+VAR: cohesion-view-angle
+VAR: alignment-view-angle
+VAR: separation-view-angle
+
+VAR: cohesion-radius
+VAR: alignment-radius
+VAR: separation-radius
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-variables ( -- )
+1.0 >cohesion-weight
+1.0 >alignment-weight
+1.0 >separation-weight
+
+75 >cohesion-radius
+50 >alignment-radius
+25 >separation-radius
+
+180 >cohesion-view-angle
+180 >alignment-view-angle
+180 >separation-view-angle
+
+10 >time-slice ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! random-boid and random-boids
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: random-range ( a b -- n ) 1 + dupd swap - random + ;
+
+: random-pos ( -- pos ) world-size> [ random ] map ;
+
+: random-vel ( -- vel ) 2 [ drop -10 10 random-range ] map ;
+
+: random-boid ( -- boid ) random-pos random-vel <boid> ;
+
+: random-boids ( n -- boids ) [ drop random-boid ] map ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: distance ( boid boid -- n ) boid-pos swap boid-pos v- norm ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: constrain ( n a b -- n ) rot min max ;
+
+: angle-between ( vec vec -- angle )
+2dup v. -rot norm swap norm * / -1 1 constrain acos rad>deg ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: relative-position ( self other -- v ) boid-pos swap boid-pos v- ;
+
+: relative-angle ( self other -- angle )
+over boid-vel -rot relative-position angle-between ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: vsum ( vector-of-vectors -- vec ) { 0 0 } [ v+ ] reduce ;
+
+: vaverage ( seq-of-vectors -- seq ) dup vsum swap length v/n ;
+
+: average-position ( boids -- pos ) [ boid-pos ] map vaverage ;
+
+: average-velocity ( boids -- vel ) [ boid-vel ] map vaverage ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: in-range? ( self other radius -- ? ) >r distance r> <= ;
+
+: in-view? ( self other angle -- ? ) >r relative-angle r> 2 / <= ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: normalize* ( u -- v ) { 0.001 0.001 } v+ normalize ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! average_position(neighbors) - self_position
+
+: within-cohesion-neighborhood? ( self other -- ? )
+  { [ cohesion-radius> in-range? ]
+    [ cohesion-view-angle> in-view? ]
+    [ eq? not ] }
+  <--&& ;
+
+: cohesion-neighborhood ( self -- boids )
+  boids> [ within-cohesion-neighborhood? ] curry* subset ;
+
+: cohesion-force ( self -- force )
+  dup cohesion-neighborhood
+  dup empty?
+  [ 2drop { 0 0 } ]
+  [ average-position swap boid-pos v- normalize* cohesion-weight> v*n ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! self_position - average_position(neighbors)
+
+: within-separation-neighborhood? ( self other -- ? )
+  { [ separation-radius> in-range? ]
+    [ separation-view-angle> in-view? ]
+    [ eq? not ] }
+  <--&& ;
+
+: separation-neighborhood ( self -- boids )
+  boids> [ within-separation-neighborhood? ] curry* subset ;
+
+: separation-force ( self -- force )
+  dup separation-neighborhood
+  dup empty?
+  [ 2drop { 0 0 } ]
+  [ average-position swap boid-pos swap v- normalize* separation-weight> v*n ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! average_velocity(neighbors)
+
+: within-alignment-neighborhood? ( self other -- ? )
+  { [ alignment-radius> in-range? ]
+    [ alignment-view-angle> in-view? ]
+    [ eq? not ] }
+  <--&& ;
+
+: alignment-neighborhood ( self -- boids )
+boids> [ within-alignment-neighborhood? ] curry* subset ;
+
+: alignment-force ( self -- force )
+  alignment-neighborhood
+  dup empty?
+  [ drop { 0 0 } ]
+  [ average-velocity normalize* alignment-weight> v*n ]
+  if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! F = m a
+!
+! We let m be equal to 1 so then this is simply: F = a
+
+: acceleration ( boid -- acceleration )
+  { separation-force alignment-force cohesion-force } map-exec-with vsum ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! iterate-boid
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: world-width ( -- w ) world-size> first ;
+
+: world-height ( -- w ) world-size> second ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: below? ( n a b -- ? ) drop < ;
+
+: above? ( n a b -- ? ) nip > ;
+
+: wrap ( n a b -- n )
+{ { [ 3dup below? ]
+    [ 2nip ] }
+  { [ 3dup above? ]
+    [ drop nip ] }
+  { [ t ]
+    [ 2drop ] } }
+cond ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: wrap-x ( x -- x ) 0 world-width 1- wrap ;
+
+: wrap-y ( y -- y ) 0 world-height 1- wrap ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: new-pos ( boid -- pos ) dup boid-vel time-slice> v*n swap boid-pos v+ ;
+
+: new-vel ( boid -- vel )
+dup acceleration time-slice> v*n swap boid-vel v+ normalize* ;
+
+: wrap-pos ( pos -- pos ) { [ wrap-x ] [ wrap-y ] } parallel-call ;
+
+: iterate-boid ( self -- self ) dup >r new-pos wrap-pos r> new-vel <boid> ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: iterate-boids ( -- ) boids> [ iterate-boid ] map >boids ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-boids ( -- ) 50 random-boids >boids ;
+
+: init-world-size ( -- ) { 100 100 } >world-size ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: randomize ( -- ) boids> length random-boids >boids ;
+
+: inc* ( variable -- ) dup  get 0.1 +  0 1 constrain  swap set ;
+
+: dec* ( variable -- ) dup  get 0.1 -  0 1 constrain  swap set ;
+
diff --git a/extra/boids/summary.txt b/extra/boids/summary.txt
new file mode 100644 (file)
index 0000000..3641e2d
--- /dev/null
@@ -0,0 +1 @@
+Artificial life program simulating simulating the flocking behaviour of birds
diff --git a/extra/boids/tags.txt b/extra/boids/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/boids/ui/ui.factor b/extra/boids/ui/ui.factor
new file mode 100644 (file)
index 0000000..8b8b466
--- /dev/null
@@ -0,0 +1,167 @@
+
+USING: kernel namespaces
+       math
+       math.vectors
+       math.parser
+       hashtables sequences threads
+       colors
+       opengl
+       opengl.gl
+       ui
+       ui.gadgets
+       ui.gadgets.handler
+       ui.gadgets.slate
+       ui.gadgets.theme
+       ui.gadgets.frames
+       ui.gadgets.labels
+       ui.gadgets.buttons
+       ui.gadgets.packs
+       ui.gadgets.grids
+       ui.gestures
+       hashtables.lib vars rewrite-closures boids ;
+
+IN: boids.ui
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! draw-boid
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: boid-point-a ( boid -- a ) boid-pos ;
+
+: boid-point-b ( boid -- b ) dup boid-pos swap boid-vel normalize* 20 v*n v+ ;
+
+: boid-points ( boid -- point-a point-b ) dup boid-point-a swap boid-point-b ;
+
+: draw-line ( a b -- )
+GL_LINES glBegin first2 glVertex2d first2 glVertex2d glEnd ;
+
+: draw-boid ( boid -- ) boid-points draw-line ;
+
+: draw-boids ( -- ) boids> [ draw-boid ] each ;
+
+: display ( -- ) black gl-color draw-boids ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: slate
+
+VAR: loop
+
+: run ( -- )
+  slate> rect-dim >world-size
+  iterate-boids
+  slate> relayout-1
+  yield
+  loop> [ run ] when ;
+
+: button* ( string quot -- button ) closed-quot <bevel-button> ;
+
+: toggle-loop ( -- ) loop> [ loop off ] [ loop on [ run ] in-thread ] if ;
+
+VARS: population-label cohesion-label alignment-label separation-label ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: update-population-label ( -- )
+  "Population: " boids> length number>string append
+  20 32 pad-right population-label> set-label-string ;
+
+: add-10-boids ( -- )
+  boids> 10 random-boids append >boids update-population-label ;
+
+: sub-10-boids ( -- )
+  boids> 10 tail >boids update-population-label ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: truncate-value ( n -- n ) 10 * round 10 / ;
+
+: update-cohesion-label ( -- )
+  "Cohesion: " cohesion-weight> truncate-value number>string append
+  20 32 pad-right cohesion-label> set-label-string ;
+
+: update-alignment-label ( -- )
+  "Alignment: " alignment-weight> truncate-value number>string append
+  20 32 pad-right alignment-label> set-label-string ;
+
+: update-separation-label ( -- )
+  "Separation: " separation-weight> truncate-value number>string append
+  20 32 pad-right separation-label> set-label-string ;
+
+: inc-cohesion-weight ( -- ) cohesion-weight inc* update-cohesion-label ;
+: dec-cohesion-weight ( -- ) cohesion-weight dec* update-cohesion-label ;
+
+: inc-alignment-weight ( -- ) alignment-weight inc* update-alignment-label ;
+: dec-alignment-weight ( -- ) alignment-weight dec* update-alignment-label ;
+
+: inc-separation-weight ( -- ) separation-weight inc* update-separation-label ;
+: dec-separation-weight ( -- ) separation-weight dec* update-separation-label ;
+
+: boids-window* ( -- )
+  init-variables init-world-size init-boids loop on
+
+  C[ display ] <slate> >slate
+    t                      slate> set-gadget-clipped?
+    { 600 400 }            slate> set-slate-dim
+    C[ [ run ] in-thread ] slate> set-slate-graft
+    C[ loop off ]          slate> set-slate-ungraft
+
+  "" <label> dup reverse-video-theme >population-label update-population-label
+
+  "" <label> dup reverse-video-theme >cohesion-label   update-cohesion-label
+  "" <label> dup reverse-video-theme >alignment-label  update-alignment-label
+  "" <label> dup reverse-video-theme >separation-label update-separation-label
+
+  <frame>
+
+  {
+    [ "ESC - Pause" [ drop toggle-loop ] button* ]
+
+    [ "1 - Randomize" [ drop randomize ] button* ]
+
+    [ <pile> 1 over set-pack-fill
+      population-label> over add-gadget
+      "3 - Add 10" [ drop add-10-boids ] button* over add-gadget
+      "2 - Sub 10" [ drop sub-10-boids ] button* over add-gadget ]
+
+    [ <pile> 1 over set-pack-fill
+      cohesion-label> over add-gadget
+      "q - +0.1" [ drop inc-cohesion-weight ] button* over add-gadget
+      "a - -0.1" [ drop dec-cohesion-weight ] button* over add-gadget ]
+
+    [ <pile> 1 over set-pack-fill
+      alignment-label> over add-gadget
+      "w - +0.1" [ drop inc-alignment-weight ] button* over add-gadget
+      "s - -0.1" [ drop dec-alignment-weight ] button* over add-gadget ]
+
+    [ <pile> 1 over set-pack-fill
+      separation-label> over add-gadget
+      "e - +0.1" [ drop inc-separation-weight ] button* over add-gadget
+      "d - -0.1" [ drop dec-separation-weight ] button* over add-gadget ]
+
+  } [ call ] map [ [ gadget, ] each ] make-shelf
+    1 over set-pack-fill
+    over @top grid-add
+
+  slate> over @center grid-add
+
+  H{ } clone
+    T{ key-down f f "1" } C[ drop randomize    ] put-hash
+    T{ key-down f f "2" } C[ drop sub-10-boids ] put-hash
+    T{ key-down f f "3" } C[ drop add-10-boids ] put-hash
+
+    T{ key-down f f "q" } C[ drop inc-cohesion-weight ] put-hash
+    T{ key-down f f "a" } C[ drop dec-cohesion-weight ] put-hash
+
+    T{ key-down f f "w" } C[ drop inc-alignment-weight ] put-hash
+    T{ key-down f f "s" } C[ drop dec-alignment-weight ] put-hash
+
+    T{ key-down f f "e" } C[ drop inc-separation-weight ] put-hash
+    T{ key-down f f "d" } C[ drop dec-separation-weight ] put-hash
+
+    T{ key-down f f "ESC" } C[ drop toggle-loop ] put-hash
+  <handler> tuck set-gadget-delegate "Boids" open-window ;
+
+: boids-window ( -- ) [ [ boids-window* ] with-scope ] with-ui ;
+
+MAIN: boids-window
\ No newline at end of file
diff --git a/extra/browser/analyzer/analyzer.factor b/extra/browser/analyzer/analyzer.factor
new file mode 100644 (file)
index 0000000..2384252
--- /dev/null
@@ -0,0 +1,83 @@
+USING: assocs browser.parser kernel math sequences strings ;
+IN: browser.analyzer
+
+: remove-blank-text ( vector -- vector )
+    [
+        dup tag-name text = [
+            tag-text [ blank? not ] all?
+        ] [
+            drop t
+        ] if
+    ] subset ;
+
+: find-by-id ( id vector -- vector )
+    [ tag-attributes "id" swap at = ] curry* subset ;
+
+: find-by-class ( id vector -- vector )
+    [ tag-attributes "class" swap at = ] curry* subset ;
+
+: find-by-name ( str vector -- vector )
+    >r >lower r>
+    [ tag-name = ] curry* subset ;
+
+: find-first-name ( str vector -- i/f tag/f )
+    >r >lower r>
+    [ tag-name = ] curry* find ;
+
+: find-matching-close ( str vector -- i/f tag/f )
+    >r >lower r>
+    [ [ tag-name = ] keep tag-closing? and ] curry* find ;
+
+: find-by-attribute-key ( key vector -- vector )
+    >r >lower r>
+    [ tag-attributes at ] curry* subset
+    [ ] subset ;
+
+: find-by-attribute-key-value ( value key vector -- vector )
+    >r >lower r>
+    [ tag-attributes at over = ] curry* subset nip
+    [ ] subset ;
+
+: find-first-attribute-key-value ( value key vector -- i/f tag/f )
+    >r >lower r>
+    [ tag-attributes at over = ] curry* find rot drop ;
+
+: find-between ( i/f tag/f vector -- vector )
+    pick integer? [
+        rot 1+ tail-slice
+        >r tag-name r>
+        [ find-matching-close drop ] keep swap head
+    ] [
+        3drop V{ } clone
+    ] if ;
+
+: find-links ( vector -- vector )
+    [ tag-name "a" = ] subset
+    [ tag-attributes "href" swap at ] map
+    [ ] subset ;
+
+
+
+! : find-last-tag ( name vector -- index tag )
+    ! [
+        ! dup tag-matched? [ 2drop f ] [ tag-name = ] if
+    ! ] curry* find-last ;
+
+! : find-last-tag* ( name n vector -- tag )
+    ! 0 -rot <slice> find-last-tag ;
+
+! : find-matching-tag ( tag -- tag )
+    ! dup tag-closing? [
+        ! find-last-tag
+    ! ] [
+    ! ] if ;
+
+
+! clear "/Users/erg/web/fark.html" <file-reader> contents parse-html find-links [ "go.pl" swap start ] subset [ "=" split peek ] map
+! clear "http://fark.com" http-get parse-html find-links [ "go.pl" swap start ] subset [ "=" split peek ] map
+
+! clear "/Users/erg/web/hostels.html" <file-reader> contents parse-html "Currency" "name" pick find-first-attribute-key-value
+
+! clear "/Users/erg/web/hostels.html" <file-reader> contents parse-html
+! "Currency" "name" pick find-first-attribute-key-value 
+! pick find-between remove-blank-text
diff --git a/extra/browser/parser/parser-tests.factor b/extra/browser/parser/parser-tests.factor
new file mode 100644 (file)
index 0000000..b4cd87d
--- /dev/null
@@ -0,0 +1,63 @@
+USING: browser.parser kernel tools.test ;
+IN: temporary
+
+[
+    V{ T{ tag f "html" H{ } f f f } }
+] [ "<html>" parse-html ] unit-test
+
+[
+    V{ T{ tag f "html" H{ } f f t } }
+] [ "</html>" parse-html ] unit-test
+
+[
+    V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f f } }
+] [ "<a href=\"http://factorcode.org/\">" parse-html ] unit-test
+
+[
+    V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f f } }
+] [ "<a   href  =  \"http://factorcode.org/\"   >" parse-html ] unit-test
+
+[
+V{
+    T{
+        tag
+        f
+        "a"
+        H{ { "baz" "\"quux\"" } { "foo" "bar's" } }
+        f
+        f
+        f
+    }
+}
+] [ "<a   foo=\"bar's\" baz='\"quux\"'  >" parse-html ] unit-test
+
+[
+V{
+    T{ tag f "a"
+        H{
+            { "a" "pirsqd" }
+            { "foo" "bar" }
+            { "href" "http://factorcode.org/" }
+            { "baz" "quux" }
+        } f f f }
+}
+] [ "<a   href  =    \"http://factorcode.org/\"    foo   =  bar baz='quux'a=pirsqd  >" parse-html ] unit-test
+
+[
+V{
+    T{ tag f "html" H{ } f f f }
+    T{ tag f "head" H{ } f f f }
+    T{ tag f "head" H{ } f f t }
+    T{ tag f "html" H{ } f f t }
+}
+] [ "<html<head</head</html" parse-html ] unit-test
+
+[
+V{
+    T{ tag f "head" H{ } f f f }
+    T{ tag f "title" H{ } f f f }
+    T{ tag f text f "Spagna" f f }
+    T{ tag f "title" H{ } f f t }
+    T{ tag f "head" H{ } f f t }
+}
+] [ "<head<title>Spagna</title></head" parse-html ] unit-test
diff --git a/extra/browser/parser/parser.factor b/extra/browser/parser/parser.factor
new file mode 100644 (file)
index 0000000..9ef6113
--- /dev/null
@@ -0,0 +1,156 @@
+USING: arrays browser.utils hashtables io kernel namespaces
+prettyprint quotations
+sequences splitting state-parser strings ;
+USE: tools.interpreter
+IN: browser.parser
+
+TUPLE: tag name attributes text matched? closing? ;
+
+SYMBOL: text
+SYMBOL: dtd
+SYMBOL: comment
+SYMBOL: javascript
+SYMBOL: tagstack
+
+: push-tag ( tag -- )
+    tagstack get push ;
+
+: closing-tag? ( string -- ? )
+    dup empty? [
+        drop f
+    ] [
+        dup first CHAR: / =
+        swap peek CHAR: / = or
+    ] if ;
+
+: <tag> ( name attributes closing? -- tag )
+    { set-tag-name set-tag-attributes set-tag-closing? }
+    tag construct ;
+
+: make-tag ( str attribs -- tag )
+    >r [ closing-tag? ] keep "/" trim1 r> rot <tag> ;
+
+: make-text-tag ( str -- tag )
+    T{ tag f text } clone [ set-tag-text ] keep ;
+
+: make-comment-tag ( str -- tag )
+    T{ tag f comment } clone [ set-tag-text ] keep ;
+
+: make-dtd-tag ( str -- tag )
+    T{ tag f dtd } clone [ set-tag-text ] keep ;
+
+: read-whitespace ( -- str )
+    [ get-char blank? not ] take-until ;
+
+: read-whitespace* ( -- )
+    read-whitespace drop ;
+
+: read-token ( -- str )
+    read-whitespace*
+    [ get-char blank? ] take-until ;
+
+: read-single-quote ( -- str )
+    [ get-char CHAR: ' = ] take-until ;
+
+: read-double-quote ( -- str )
+    [ get-char CHAR: " = ] take-until ;
+
+: read-quote ( -- str )
+    get-char next* CHAR: ' = [
+        read-single-quote
+    ] [
+        read-double-quote
+    ] if next* ;
+
+: read-key ( -- str )
+    read-whitespace*
+    [ get-char CHAR: = = get-char blank? or ] take-until ;
+
+: read-= ( -- )
+    read-whitespace*
+    [ get-char CHAR: = = ] take-until drop next* ;
+
+: read-value ( -- str )
+    read-whitespace*
+    get-char quote? [
+        read-quote
+    ] [
+        read-token
+    ] if ;
+
+: read-comment ( -- )
+    "-->" take-string* make-comment-tag push-tag ;
+
+: read-dtd ( -- )
+    ">" take-string* make-dtd-tag push-tag ;
+
+: read-bang ( -- )
+    next* get-char CHAR: - = get-next CHAR: - = and [
+        next* next*
+        read-comment
+    ] [
+        read-dtd
+    ] if ;
+
+: read-tag ( -- )
+    [ get-char CHAR: > = get-char CHAR: < = or ] take-until
+    get-char CHAR: < = [ next* ] unless ;
+
+: read-< ( -- str )
+    next* get-char CHAR: ! = [
+        read-bang f
+    ] [
+        read-tag
+    ] if ;
+
+: read-until-< ( -- str )
+    [ get-char CHAR: < = ] take-until ;
+
+: parse-text ( -- )
+    read-until-< dup empty? [
+        drop
+    ] [
+        make-text-tag push-tag
+    ] if ;
+
+: (parse-attributes) ( -- )
+    read-whitespace*
+    string-parse-end? [
+        read-key >lower read-= read-value
+        2array , (parse-attributes)
+    ] unless ;
+
+: parse-attributes ( -- hashtable )
+    [ (parse-attributes) ] { } make >hashtable ; 
+
+: (parse-tag)
+    [
+        read-token >lower
+        parse-attributes
+    ] string-parse ;
+
+: parse-tag ( -- )
+    read-< dup empty? [
+        drop
+    ] [
+        (parse-tag) make-tag push-tag
+    ] if ;
+
+: (parse-html) ( tag -- )
+    get-next [
+        parse-text
+        parse-tag
+        (parse-html)
+    ] when ;
+
+: tag-parse ( quot -- vector )
+    [
+        V{ } clone tagstack set
+        string-parse
+    ] with-scope ;
+
+: parse-html ( string -- vector )
+    [
+        (parse-html)
+        tagstack get
+    ] tag-parse ;
diff --git a/extra/browser/printer/printer.factor b/extra/browser/printer/printer.factor
new file mode 100644 (file)
index 0000000..a68d588
--- /dev/null
@@ -0,0 +1,109 @@
+USING: assocs browser.parser browser.utils combinators
+continuations hashtables
+hashtables.private io kernel math
+namespaces prettyprint quotations sequences splitting
+state-parser strings ;
+IN: browser.printer
+
+SYMBOL: no-section
+SYMBOL: html
+SYMBOL: head
+SYMBOL: body
+TUPLE: state section ;
+
+! TUPLE: text bold? underline? strikethrough? ;
+
+TUPLE: text-printer ;
+TUPLE: ui-printer ;
+TUPLE: src-printer ;
+UNION: printer text-printer ui-printer src-printer ;
+HOOK: print-tag printer ( tag -- )
+HOOK: print-text-tag printer ( tag -- )
+HOOK: print-comment-tag printer ( tag -- )
+HOOK: print-dtd-tag printer ( tag -- )
+HOOK: print-opening-named-tag printer ( tag -- )
+HOOK: print-closing-named-tag printer ( tag -- )
+
+: print-tags ( vector -- )
+    [ print-tag ] each ;
+
+: html-text. ( vector -- )
+    [
+        T{ text-printer } printer set
+        print-tags
+    ] with-scope ;
+
+: html-src. ( vector -- )
+    [
+        T{ src-printer } printer set
+        print-tags
+    ] with-scope ;
+
+M: printer print-text-tag ( tag -- )
+    tag-text write ;
+
+M: printer print-comment-tag ( tag -- ) 
+    "<!--" write
+    tag-text write
+    "-->" write ;
+
+M: printer print-dtd-tag
+    "<!" write
+    tag-text write
+    ">" write ;
+
+M: printer print-opening-named-tag ( tag -- )
+    dup tag-name {
+        { "html" [ drop ] }
+        { "head" [ drop ] }
+        { "body" [ drop ] }
+        { "title" [ "Title: " write tag-text print ] }
+    } case ;
+
+M: printer print-closing-named-tag ( tag -- )
+    drop ;
+
+: print-attributes ( hashtable -- )
+    [
+        swap bl write "=" write ?quote write
+    ] assoc-each ;
+        
+
+M: src-printer print-opening-named-tag ( tag -- )
+    "<" write
+    dup tag-name write
+    tag-attributes dup assoc-empty? [ drop ] [ print-attributes ] if
+    ">" write ;
+
+M: src-printer print-closing-named-tag ( tag -- )
+    "</" write
+    tag-name write
+    ">" write ;
+
+TUPLE: unknown-tag-error tag ;
+
+C: <unknown-tag-error> unknown-tag-error
+
+M: printer print-tag ( tag -- )
+    {
+        { [ dup tag-name text = ] [ print-text-tag ] }
+        { [ dup tag-name comment = ] [ print-comment-tag ] }
+        { [ dup tag-name dtd = ] [ print-dtd-tag ] }
+        { [ dup tag-name string? over tag-closing? and ]
+            [ print-closing-named-tag ] }
+        { [ dup tag-name string? ]
+            [ print-opening-named-tag ] }
+        { [ t ] [ <unknown-tag-error> throw ] }
+    } cond ;
+
+SYMBOL: tablestack
+
+: with-html-printer
+    [
+        V{ } clone tablestack set
+    ] with-scope ;
+    
+! { { 1 2 } { 3 4 } }
+! H{ { table-gap { 10 10 } } } [
+    ! [ [ [ [ . ] with-cell ] each ] with-row ] each
+! ] tabular-output
diff --git a/extra/browser/utils/utils-tests.factor b/extra/browser/utils/utils-tests.factor
new file mode 100644 (file)
index 0000000..9ae54c7
--- /dev/null
@@ -0,0 +1,24 @@
+USING: assocs combinators continuations hashtables
+hashtables.private io kernel math
+namespaces prettyprint quotations sequences splitting
+state-parser strings tools.test ;
+USING: browser.utils ;
+IN: temporary
+
+[ "'Rome'" ] [ "Rome" single-quote ] unit-test
+[ "\"Roma\"" ] [ "Roma" double-quote ] unit-test
+[ "'Firenze'" ] [ "Firenze" quote ] unit-test
+[ "\"Caesar's\"" ] [ "Caesar's" quote ] unit-test
+[ f ] [ "" quoted? ] unit-test
+[ t ] [ "''" quoted? ] unit-test
+[ t ] [ "\"\"" quoted? ] unit-test
+[ t ] [ "\"Circus Maximus\"" quoted? ] unit-test
+[ t ] [ "'Circus Maximus'" quoted? ] unit-test
+[ f ] [ "Circus Maximus" quoted? ] unit-test
+[ "'Italy'" ] [ "Italy" ?quote ] unit-test
+[ "'Italy'" ] [ "'Italy'" ?quote ] unit-test
+[ "\"Italy\"" ] [ "\"Italy\"" ?quote ] unit-test
+[ "Italy" ] [ "Italy" unquote ] unit-test
+[ "Italy" ] [ "'Italy'" unquote ] unit-test
+[ "Italy" ] [ "\"Italy\"" unquote ] unit-test
+
diff --git a/extra/browser/utils/utils.factor b/extra/browser/utils/utils.factor
new file mode 100644 (file)
index 0000000..827c60d
--- /dev/null
@@ -0,0 +1,43 @@
+USING: assocs circular combinators continuations hashtables
+hashtables.private io kernel math
+namespaces prettyprint quotations sequences splitting
+state-parser strings ;
+USING: browser.parser ;
+IN: browser.utils
+
+: string-parse-end?
+    get-next not ;
+
+: take-string* ( match -- string )
+    dup length <circular-string>
+    [ 2dup string-matches? ] take-until nip
+    dup length rot length 1- - head next* ;
+
+: trim1 ( seq ch -- newseq )
+    [ ?head drop ] keep ?tail drop ;
+
+: single-quote ( str -- newstr )
+    >r "'" r> "'" 3append ;
+
+: double-quote ( str -- newstr )
+    >r "\"" r> "\"" 3append ;
+
+: quote ( str -- newstr )
+    CHAR: ' over member?
+    [ double-quote ] [ single-quote ] if ;
+
+: quoted? ( str -- ? )
+    dup length 1 > [
+        [ first ] keep peek [ = ] keep "'\"" member? and
+    ] [
+        drop f
+    ] if ;
+
+: ?quote ( str -- newstr )
+    dup quoted? [ quote ] unless ;
+
+: unquote ( str -- newstr )
+    dup quoted? [ 1 head-slice* 1 tail-slice >string ] when ;
+
+: quote? ( ch -- ? ) "'\"" member? ;
+
diff --git a/extra/bunny/authors.txt b/extra/bunny/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/bunny/bunny.factor b/extra/bunny/bunny.factor
new file mode 100644 (file)
index 0000000..c33acb0
--- /dev/null
@@ -0,0 +1,115 @@
+! From http://www.ffconsultancy.com/ocaml/bunny/index.html
+USING: alien alien.c-types arrays sequences math
+math.vectors math.matrices math.parser io io.files kernel opengl
+opengl.gl opengl.glu shuffle http.client vectors timers
+namespaces ui.gadgets ui.gadgets.canvas ui.render ui splitting
+combinators tools.time system combinators.lib ;
+IN: bunny
+
+: numbers ( str -- seq )
+    " " split [ string>number ] map [ ] subset ;
+
+: (parse-model) ( vs is -- vs is )
+    readln [
+        numbers {
+            { [ dup length 5 = ] [ 3 head pick push ] }
+            { [ dup first 3 = ] [ 1 tail over push ] }
+            { [ t ] [ drop ] }
+        } cond (parse-model)
+    ] when* ;
+
+: parse-model ( stream -- vs is )
+    [
+        100000 <vector> 100000 <vector> (parse-model)
+    ] with-stream
+    [
+        over length # " vertices, " %
+        dup length # " triangles" %
+    ] "" make print ;
+
+: n ( vs triple -- n )
+    swap [ nth ] curry map
+    dup third over first v- >r dup second swap first v- r> cross
+    vneg normalize ;
+
+: normal ( ns vs triple -- )
+    [ n ] keep [ rot [ v+ ] change-nth ] each-with2 ;
+
+: normals ( vs is -- ns )
+    over length { 0.0 0.0 0.0 } <array> -rot
+    [ >r 2dup r> normal ] each drop
+    [ normalize ] map ;
+
+: read-model ( stream -- model )
+    "Reading model" print flush [
+        <file-reader> parse-model [ normals ] 2keep 3array
+    ] time ;
+
+: model-path "bun_zipper.ply" ;
+
+: model-url "http://factorcode.org/bun_zipper.ply" ;
+
+: maybe-download ( -- path )
+    model-path resource-path dup exists? [
+        "Downloading bunny from " write
+        model-url dup print flush
+        over download
+    ] unless ;
+
+: draw-triangle ( ns vs triple -- )
+    [
+        dup roll nth first3 glNormal3d
+        swap nth first3 glVertex3d
+    ] each-with2 ;
+
+: draw-bunny ( ns vs is -- )
+    GL_TRIANGLES [ [ draw-triangle ] each-with2 ] do-state ;
+
+TUPLE: bunny-gadget model ;
+
+: <bunny-gadget> ( model -- gadget )
+    <canvas>
+    { set-bunny-gadget-model set-delegate }
+    bunny-gadget construct ;
+
+M: bunny-gadget graft* 10 10 add-timer ;
+
+M: bunny-gadget ungraft* dup delegate ungraft* remove-timer ;
+
+M: bunny-gadget tick relayout-1 ;
+
+: aspect ( gadget -- x ) rect-dim first2 /f ;
+
+M: bunny-gadget draw-gadget*
+    GL_DEPTH_TEST glEnable
+    GL_SCISSOR_TEST glDisable
+    1.0 glClearDepth
+    0.0 0.0 0.0 1.0 glClearColor
+    GL_DEPTH_BUFFER_BIT GL_COLOR_BUFFER_BIT bitor glClear
+    GL_PROJECTION glMatrixMode
+    glLoadIdentity
+    45.0 over aspect 0.1 1.0 gluPerspective
+    0.0 0.12 -0.25  0.0 0.1 0.0  0.0 1.0 0.0 gluLookAt
+    GL_MODELVIEW glMatrixMode
+    glLoadIdentity
+    GL_LEQUAL glDepthFunc
+    GL_LIGHTING glEnable
+    GL_LIGHT0 glEnable
+    GL_COLOR_MATERIAL glEnable
+    GL_LIGHT0 GL_POSITION { 1.0 -1.0 1.0 1.0 } >c-float-array glLightfv
+    millis 24000 mod 0.015 * 0.0 1.0 0.0 glRotated
+    GL_FRONT_AND_BACK GL_SHININESS 100.0 glMaterialf
+    GL_FRONT_AND_BACK GL_SPECULAR glColorMaterial
+    GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE glColorMaterial
+    0.6 0.5 0.5 1.0 glColor4d
+    [ bunny-gadget-model first3 draw-bunny ] draw-canvas ;
+
+M: bunny-gadget pref-dim* drop { 400 300 } ;
+
+: bunny-window ( -- )
+    [
+        maybe-download read-model <bunny-gadget>
+        "Bunny" open-window
+    ] with-ui ;
+
+MAIN: bunny-window
diff --git a/extra/bunny/deploy.factor b/extra/bunny/deploy.factor
new file mode 100644 (file)
index 0000000..b94a1de
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? t }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? t }
+    { deploy-ui? t }
+    { "bundle-name" "Bunny.app" }
+}
diff --git a/extra/bunny/summary.txt b/extra/bunny/summary.txt
new file mode 100644 (file)
index 0000000..c3d7e5f
--- /dev/null
@@ -0,0 +1 @@
+Stanford Bunny OpenGL demo
diff --git a/extra/bunny/tags.txt b/extra/bunny/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/cabal/cabal.factor b/extra/cabal/cabal.factor
new file mode 100644 (file)
index 0000000..278729f
--- /dev/null
@@ -0,0 +1,92 @@
+
+USING: kernel
+       io
+       io.streams.duplex
+       io.sockets
+       io.server
+       combinators continuations
+       namespaces generic threads sequences arrays vars ;
+
+IN: cabal
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: user name ;
+
+: <user> ( client -- user )
+user construct-empty
+tuck set-delegate
+dup [ "name: " write flush readln ] with-stream* over set-user-name ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: users
+
+: init-users ( -- ) V{ } clone >users ;
+
+: show-users ( -- ) users> [ user-name print ] each flush ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: conversation
+
+: init-conversation ( -- ) V{ } clone >conversation ;
+
+: show-conversation ( -- ) conversation> [ print ] each flush ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VARS: input user ;
+
+: ((send-input)) ( other -- ) [ input> print flush ] with-stream* ;
+
+: (send-input) ( other -- )
+[ ((send-input)) ] catch [ print dup stream-close users> delete ] when ;
+
+: send-input ( other -- )
+dup duplex-stream-closed? [ users> delete ] [ (send-input) ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: tag-input ( -- ) user> user-name ": " input> 3append >input ;
+
+: log-input ( -- ) input> conversation> push ;
+
+! : send-message ( -- ) tag-input users> >array [ send-input ] each ;
+
+: send-message ( -- ) tag-input log-input users> >array [ send-input ] each ;
+
+: handle-user-loop ( -- )
+readln >input
+{ { [ input> f eq? ] [ user> users> delete ] }
+  { [ input> "/log" = ] [ show-conversation handle-user-loop ] }
+  { [ input> "/users" = ] [ show-users handle-user-loop ] }
+  { [ t ] [ send-message handle-user-loop ] } }
+cond ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : handle-client ( client -- ) <user> dup users> push
+! dup [ >user [ handle-user-loop ] with-stream* ] with-scope ;
+
+: handle-client ( client -- ) <user> dup users> push
+dup [ >user [ handle-user-loop ] with-stream ] with-scope ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: accept-client-loop ( server -- )
+dup >r accept [ handle-client ] in-thread r> accept-client-loop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : start-cabal ( -- )
+! init-users
+! init-conversation
+! 8000 <server> accept-client-loop ;
+
+: start-cabal ( -- )
+init-users
+init-conversation
+8000 internet-server [ inet4? ] find nip <server> accept-client-loop ;
+
+MAIN: start-cabal
\ No newline at end of file
diff --git a/extra/cabal/ui/ui.factor b/extra/cabal/ui/ui.factor
new file mode 100644 (file)
index 0000000..70999c3
--- /dev/null
@@ -0,0 +1,52 @@
+USING: kernel
+       io
+       io.streams.duplex
+       io.sockets
+       namespaces sequences math math.parser threads quotations splitting
+       ui
+       ui.gadgets 
+       ui.gadgets.panes
+       ui.gadgets.scrollers
+       ui.gadgets.tracks
+       ui.tools.interactor ;
+
+IN: cabal.ui
+
+TUPLE: cabal-gadget input output ;
+
+: <cabal-input> ( -- gadget )
+    gadget get cabal-gadget-output <pane-stream> <interactor> ;
+
+: <cabal-gadget> ( -- gadget )
+cabal-gadget construct-empty
+dup
+[ <scrolling-pane> over dupd set-cabal-gadget-output <scroller> 5/6 track,
+  <cabal-input>    over dupd set-cabal-gadget-input  <scroller> 1/6 track,
+  drop ]
+curry
+{ 0 1 }
+build-track ;
+
+M: cabal-gadget pref-dim* drop { 550 650 } ;
+
+: cabal-stream ( cabal -- stream )
+    dup cabal-gadget-input swap cabal-gadget-output <pane-stream>
+    <duplex-stream> ;
+
+: incoming-loop ( stream -- ) dup stream-readln print incoming-loop ;
+
+: outgoing-loop ( stream -- )
+readln over stream-print dup stream-flush outgoing-loop ;
+
+: cabal-thread ( -- )
+    "cabal://" write readln 
+    ":" split1 string>number <inet> <client> 
+    [ outgoing-loop ] in-thread incoming-loop ;
+
+: cabal-client ( -- )
+    <cabal-gadget> dup "Cabal Client" open-window
+    cabal-stream [ [ cabal-thread ] with-stream ] in-thread drop ;
+
+: cabal-client* ( -- ) [ cabal-client ] with-ui ;
+
+MAIN: cabal-client*
\ No newline at end of file
diff --git a/extra/cairo/authors.txt b/extra/cairo/authors.txt
new file mode 100644 (file)
index 0000000..4a2736d
--- /dev/null
@@ -0,0 +1 @@
+Sampo Vuori
diff --git a/extra/cairo/cairo.factor b/extra/cairo/cairo.factor
new file mode 100644 (file)
index 0000000..8cf79da
--- /dev/null
@@ -0,0 +1,330 @@
+! Cairo binding
+IN: cairo
+USING: alien alien.syntax ;
+
+! cairo_status_t
+C-ENUM:
+    CAIRO_STATUS_SUCCESS
+    CAIRO_STATUS_NO_MEMORY
+    CAIRO_STATUS_INVALID_RESTORE
+    CAIRO_STATUS_INVALID_POP_GROUP
+    CAIRO_STATUS_NO_CURRENT_POINT
+    CAIRO_STATUS_INVALID_MATRIX
+    CAIRO_STATUS_NO_TARGET_SURFACE
+    CAIRO_STATUS_NULL_POINTER
+    CAIRO_STATUS_INVALID_STRING
+;
+
+! cairo_operator_t
+C-ENUM:
+    CAIRO_OPERATOR_CLEAR
+    CAIRO_OPERATOR_SRC
+    CAIRO_OPERATOR_DST
+    CAIRO_OPERATOR_OVER
+    CAIRO_OPERATOR_OVER_REVERSE
+    CAIRO_OPERATOR_IN
+    CAIRO_OPERATOR_IN_REVERSE
+    CAIRO_OPERATOR_OUT
+    CAIRO_OPERATOR_OUT_REVERSE
+    CAIRO_OPERATOR_ATOP
+    CAIRO_OPERATOR_ATOP_REVERSE
+    CAIRO_OPERATOR_XOR
+    CAIRO_OPERATOR_ADD
+    CAIRO_OPERATOR_SATURATE
+;
+
+! cairo_line_cap_t
+C-ENUM:
+    CAIRO_LINE_CAP_BUTT
+    CAIRO_LINE_CAP_ROUND
+    CAIRO_LINE_CAP_SQUARE
+;
+
+! cair_line_join_t
+C-ENUM:
+    CAIRO_LINE_JOIN_MITER
+    CAIRO_LINE_JOIN_ROUND
+    CAIRO_LINE_JOIN_BEVEL
+;
+
+! cairo_fill_rule_t
+C-ENUM:
+    CAIRO_FILL_RULE_WINDING
+    CAIRO_FILL_RULE_EVEN_ODD
+;
+
+! cairo_font_slant_t
+C-ENUM:
+    CAIRO_FONT_SLANT_NORMAL
+    CAIRO_FONT_SLANT_ITALIC
+    CAIRO_FONT_SLANT_OBLIQUE
+;
+
+! cairo_font_weight_t
+C-ENUM:
+    CAIRO_FONT_WEIGHT_NORMAL
+    CAIRO_FONT_WEIGHT_BOLD
+;
+
+C-STRUCT: cairo_font_t
+    { "int" "refcount" }
+    { "uint" "scale" } ;
+
+C-STRUCT: cairo_rectangle_t
+    { "short" "x" }
+    { "short" "y" }
+    { "ushort" "width" }
+    { "ushort" "height" } ;
+
+C-STRUCT: cairo_clip_rec_t
+    { "cairo_rectangle_t" "rect" }
+    { "void*" "region" }
+    { "void*" "surface" } ;
+
+C-STRUCT: cairo_matrix_t
+    { "void*" "m" } ;
+
+C-STRUCT: cairo_gstate_t
+    { "uint" "operator" }
+    { "double" "tolerance" }
+    { "double" "line_width" }
+    { "uint" "line_cap" }
+    { "uint" "line_join" }
+    { "double" "miter_limit" }
+    { "uint" "fill_rule" }
+    { "void*" "dash" }
+    { "int" "num_dashes" }
+    { "double" "dash_offset" }
+    { "char*" "font_family " }
+    { "uint" "font_slant" }
+    { "uint" "font_weight" }
+    { "void*" "font" }
+    { "void*" "surface" }
+    { "void*" "pattern " }
+    { "double" "alpha" }
+    { "cairo_clip_rec_t" "clip" }
+    { "double" "pixels_per_inch" }
+    { "cairo_matrix_t" "font_matrix" }
+    { "cairo_matrix_t" "ctm" }
+    { "cairo_matrix_t" "ctm_inverse" }
+    { "void*" "path" }
+    { "void*" "pen_regular" }
+    { "void*" "next" } ;
+
+C-STRUCT: cairo_t
+    { "uint" "ref_count" }
+    { "cairo_gstate_t*" "gstate" }
+    { "uint" "status ! cairo_status_t" } ;
+
+! cairo_format_t
+C-ENUM:
+    CAIRO_FORMAT_ARGB32
+    CAIRO_FORMAT_RGB24
+    CAIRO_FORMAT_A8
+    CAIRO_FORMAT_A1
+;
+
+! cairo_antialias_t
+C-ENUM:
+    CAIRO_ANTIALIAS_DEFAULT
+    CAIRO_ANTIALIAS_NONE
+    CAIRO_ANTIALIAS_GRAY
+    CAIRO_ANTIALIAS_SUBPIXEL
+;
+
+! cairo_subpixel_order_t
+C-ENUM:
+    CAIRO_SUBPIXEL_ORDER_DEFAULT
+    CAIRO_SUBPIXEL_ORDER_RGB
+    CAIRO_SUBPIXEL_ORDER_BGR
+    CAIRO_SUBPIXEL_ORDER_VRGB
+    CAIRO_SUBPIXEL_ORDER_VBGR
+;
+
+! cairo_hint_style_t
+C-ENUM:
+    CAIRO_HINT_STYLE_DEFAULT
+    CAIRO_HINT_STYLE_NONE
+    CAIRO_HINT_STYLE_SLIGHT
+    CAIRO_HINT_STYLE_MEDIUM
+    CAIRO_HINT_STYLE_FULL
+;
+
+! cairo_hint_metrics_t
+C-ENUM:
+    CAIRO_HINT_METRICS_DEFAULT
+    CAIRO_HINT_METRICS_OFF
+    CAIRO_HINT_METRICS_ON
+;
+
+: cairo_create ( cairo_surface_t -- cairo_t )
+    "cairo_t*" "cairo" "cairo_create" [ "void*" ] alien-invoke ;
+
+: cairo_destroy ( cairo_t -- )
+    "void" "cairo" "cairo_destroy" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_set_operator ( cairo_t cairo_operator_t -- )
+    "void" "cairo" "cairo_set_operator" [ "cairo_t*" "int" ] alien-invoke ;
+
+: cairo_image_surface_create_for_data ( data format width height stride -- cairo_surface_t )
+    "void*" "cairo" "cairo_image_surface_create_for_data" [ "void*" "uint" "int" "int" "int" ] alien-invoke ;
+    
+: cairo_set_source_rgb ( cairo_t red green blue -- )
+    "void" "cairo" "cairo_set_source_rgb" [ "cairo_t*" "double" "double" "double" ] alien-invoke ;
+
+: cairo_set_source_rgba ( cairo_t red green blue alpha -- )
+    "void" "cairo" "cairo_set_source_rgb" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_set_source_surface ( cairo_t cairo_surface_t x y -- )
+    "void" "cairo" "cairo_set_source_surface" [ "cairo_t*" "void*" "double" "double" ] alien-invoke ;
+
+: cairo_set_tolerance ( cairo_t tolerance -- )
+    "void" "cairo" "cairo_set_tolerance" [ "cairo_t*" "double" ] alien-invoke ;
+
+: cairo_set_antialias ( cairo_t cairo_antialias_t -- )
+    "void" "cairo" "cairo_set_antialias" [ "cairo_t*" "int" ] alien-invoke ;
+
+: cairo_set_fill_rule ( cairo_t cairo_fill_rule_t -- )
+    "void" "cairo" "cairo_set_fill_rule" [ "cairo_t*" "int" ] alien-invoke ;
+
+: cairo_set_line_width ( cairo_t width -- )
+    "void" "cairo" "cairo_set_line_width" [ "cairo_t*" "double" ] alien-invoke ;
+
+: cairo_set_line_cap ( cairo_t cairo_line_cap_t -- )
+    "void" "cairo" "cairo_set_line_cap" [ "cairo_t*" "int" ] alien-invoke ;
+
+: cairo_set_line_join ( cairo_t cairo_line_join_t -- )
+    "void" "cairo" "cairo_set_line_join" [ "cairo_t*" "int" ] alien-invoke ;
+
+: cairo_set_dash ( cairo_t dashes num_dashes offset -- )
+    "void" "cairo" "cairo_set_dash" [ "cairo_t*" "double" "int" "double" ] alien-invoke ;
+
+: cairo_set_miter_limit ( cairo_t limit -- )
+    "void" "cairo" "cairo_set_miter_limit" [ "cairo_t*" "double" ] alien-invoke ;
+
+: cairo_translate ( cairo_t x y -- )
+    "void" "cairo" "cairo_translate" [ "cairo_t*" "double" "double" ] alien-invoke ;
+
+: cairo_scale ( cairo_t sx sy -- )
+    "void" "cairo" "cairo_scale" [ "cairo_t*" "double" "double" ] alien-invoke ;
+
+: cairo_rotate ( cairo_t angle -- )
+    "void" "cairo" "cairo_rotate" [ "cairo_t*" "double" ] alien-invoke ;
+
+
+! cairo path creating functions
+
+: cairo_new_path ( cairo_t -- )
+    "void" "cairo" "cairo_new_path" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_move_to ( cairo_t x y -- )
+    "void" "cairo" "cairo_move_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
+    
+: cairo_line_to ( cairo_t x y -- )
+    "void" "cairo" "cairo_line_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
+
+: cairo_curve_to ( cairo_t x1 y1 x2 y2 x3 y3 -- )
+    "void" "cairo" "cairo_curve_to" [ "cairo_t*" "double" "double" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_arc ( cairo_t xc yc radius angle1 angle2 -- )
+    "void" "cairo" "cairo_arc" [ "cairo_t*" "double" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_arc_negative ( cairo_t xc yc radius angle1 angle2 -- )
+    "void" "cairo" "cairo_arc_negative" [ "cairo_t*" "double" "double" "double" "double" "double" ] alien-invoke ;
+    
+: cairo_rel_move_to ( cairo_t dx dy -- )
+    "void" "cairo" "cairo_rel_move_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
+    
+: cairo_rel_line_to ( cairo_t dx dy -- )
+    "void" "cairo" "cairo_rel_line_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
+
+: cairo_rel_curve_to ( cairo_t dx1 dy1 dx2 dy2 dx3 dy3 -- )
+    "void" "cairo" "cairo_rel_curve_to" [ "cairo_t*" "double" "double" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_rectangle ( cairo_t x y width height -- )
+    "void" "cairo" "cairo_rectangle" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_close_path ( cairo_t -- )
+    "void" "cairo" "cairo_close_path" [ "cairo_t*" ] alien-invoke ;
+
+! painting functions
+: cairo_paint ( cairo_t -- )
+    "void" "cairo" "cairo_paint" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_paint_with_alpha ( cairo_t alpha -- )
+    "void" "cairo" "cairo_paint_with_alpha" [ "cairo_t*" "double" ] alien-invoke ;
+
+: cairo_mask ( cairo_t cairo_pattern_t -- )
+    "void" "cairo" "cairo_mask" [ "cairo_t*" "void*" ] alien-invoke ;
+
+: cairo_mask_surface ( cairo_t cairo_pattern_t surface-x surface-y -- )
+    "void" "cairo" "cairo_mask_surface" [ "cairo_t*" "void*" "double" "double" ] alien-invoke ;
+
+: cairo_stroke ( cairo_t -- )
+    "void" "cairo" "cairo_stroke" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_stroke_preserve ( cairo_t -- )
+    "void" "cairo" "cairo_stroke_preserve" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_fill ( cairo_t -- )
+    "void" "cairo" "cairo_fill" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_fill_preserve ( cairo_t -- )
+    "void" "cairo" "cairo_fill_preserve" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_copy_page ( cairo_t -- )
+    "void" "cairo" "cairo_copy_page" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_show_page ( cairo_t -- )
+    "void" "cairo" "cairo_show_page" [ "cairo_t*" ] alien-invoke ;
+
+! insideness testing
+: cairo_in_stroke ( cairo_t x y -- t/f )
+    "int" "cairo" "cairo_in_stroke" [ "cairo_t*" "double" "double" ] alien-invoke ;
+
+: cairo_in_fill ( cairo_t x y -- t/f )
+    "int" "cairo" "cairo_in_fill" [ "cairo_t*" "double" "double" ] alien-invoke ;
+
+! rectangular extents
+: cairo_stroke_extents ( cairo_t x1 y1 x2 y2 -- )
+    "void" "cairo" "cairo_stroke_extents" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_fill_extents ( cairo_t x1 y1 x2 y2 -- )
+    "void" "cairo" "cairo_fill_extents" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
+
+! clipping
+: cairo_reset_clip ( cairo_t -- )
+    "void" "cairo" "cairo_reset_clip" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_clip ( cairo_t -- )
+    "void" "cairo" "cairo_clip" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_clip_preserve ( cairo_t -- )
+    "void" "cairo" "cairo_clip_preserve" [ "cairo_t*" ] alien-invoke ;
+
+: cairo_set_source ( cairo_t cairo_pattern_t -- )
+    "void" "cairo" "cairo_set_source" [ "cairo_t*" "void*" ] alien-invoke ;
+
+: cairo_pattern_create_linear ( x0 y0 x1 y1 -- cairo_pattern_t )
+    "void*" "cairo" "cairo_pattern_create_linear" [ "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_pattern_create_radial ( cx0 cy0 radius0 cx1 cy1 radius1 -- cairo_pattern_t )
+    "void*" "cairo" "cairo_pattern_create_radial" [ "double" "double" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_pattern_add_color_stop_rgba ( pattern offset red green blue alpha -- status )
+    "uint" "cairo" "cairo_pattern_add_color_stop_rgba" [ "void*" "double" "double" "double" "double" "double" ] alien-invoke ;
+
+: cairo_show_text ( cairo_t msg_utf8 -- )
+    "void" "cairo" "cairo_show_text" [ "cairo_t*" "char*" ] alien-invoke ;
+
+: cairo_text_path ( cairo_t msg_utf8 -- )
+    "void" "cairo" "cairo_text_path" [ "cairo_t*" "char*" ] alien-invoke ;
+
+: cairo_select_font_face ( cairo_t family font_slant font_weight -- )
+    "void" "cairo" "cairo_select_font_face" [ "cairo_t*" "char*" "uint" "uint" ] alien-invoke ;
+
+: cairo_set_font_size ( cairo_t scale -- )
+    "void" "cairo" "cairo_set_font_size" [ "cairo_t*" "double" ] alien-invoke ;
+
+: cairo_identity_matrix ( cairo_t -- )
+    "void" "cairo" "cairo_identity_matrix" [ "cairo_t*" ] alien-invoke ;
diff --git a/extra/cairo/summary.txt b/extra/cairo/summary.txt
new file mode 100644 (file)
index 0000000..f6cb370
--- /dev/null
@@ -0,0 +1 @@
+Cairo graphics library binding
diff --git a/extra/cairo/tags.txt b/extra/cairo/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/calendar/authors.txt b/extra/calendar/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/calendar/calendar-tests.factor b/extra/calendar/calendar-tests.factor
new file mode 100644 (file)
index 0000000..b145617
--- /dev/null
@@ -0,0 +1,143 @@
+USING: arrays calendar kernel math sequences tools.test
+continuations system ;
+
+[ "invalid timestamp" ] [ [ 2004 12 32 0 0 0 0 make-timestamp ] catch ] unit-test
+[ "invalid timestamp" ] [ [ 2004 2 30 0 0 0 0 make-timestamp ] catch ] unit-test
+[ "invalid timestamp" ] [ [ 2003 2 29 0 0 0 0 make-timestamp ] catch ] unit-test
+[ "invalid timestamp" ] [ [ 2004 -2 9 0 0 0 0 make-timestamp ] catch ] unit-test
+[ "invalid timestamp" ] [ [ 2004 12 0 0 0 0 0 make-timestamp ] catch ] unit-test
+[ "invalid timestamp" ] [ [ 2004 12 1 24 0 0 0 make-timestamp ] catch ] unit-test
+[ "invalid timestamp" ] [ [ 2004 12 1 23 60 0 0 make-timestamp ] catch ] unit-test
+[ "invalid timestamp" ] [ [ 2004 12 1 23 59 60 0 0 make-timestamp ] catch ] unit-test
+
+[ f ] [ 1900 leap-year? ] unit-test
+[ t ] [ 1904 leap-year? ] unit-test
+[ t ] [ 2000 leap-year? ] unit-test
+[ f ] [ 2001 leap-year? ] unit-test
+[ f ] [ 2006 leap-year? ] unit-test
+
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 1 seconds +dt
+        2006 10 10 0 0 1 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 100 seconds +dt
+        2006 10 10 0 1 40 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -100 seconds +dt
+        2006 10 9 23 58 20 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 86400 seconds +dt
+        2006 10 11 0 0 0 0 make-timestamp = ] unit-test
+
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 10 minutes +dt
+        2006 10 10 0 10 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 10.5 minutes +dt
+        2006 10 10 0 10 30 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 3/4 minutes +dt
+        2006 10 10 0 0 45 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -3/4 minutes +dt
+        2006 10 9 23 59 15 0 make-timestamp = ] unit-test
+
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 7200 minutes +dt
+        2006 10 15 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -10 minutes +dt
+        2006 10 9 23 50 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -100 minutes +dt
+        2006 10 9 22 20 0 0 make-timestamp = ] unit-test
+
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 hours +dt
+        2006 1 1 1 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 24 hours +dt
+        2006 1 2 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -24 hours +dt
+        2005 12 31 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 12 hours +dt
+        2006 1 1 12 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 72 hours +dt
+        2006 1 4 0 0 0 0 make-timestamp = ] unit-test
+
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 days +dt
+        2006 1 2 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -1 days +dt
+        2005 12 31 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 365 days +dt
+        2007 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -365 days +dt
+        2005 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2004 1 1 0 0 0 0 make-timestamp 365 days +dt
+        2004 12 31 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2004 1 1 0 0 0 0 make-timestamp 366 days +dt
+        2005 1 1 0 0 0 0 make-timestamp = ] unit-test
+
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 11 months +dt
+        2006 12 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 12 months +dt
+        2007 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 24 months +dt
+        2008 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 13 months +dt
+        2007 2 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 months +dt
+        2006 2 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 0 months +dt
+        2006 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -1 months +dt
+        2005 12 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -2 months +dt
+        2005 11 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -13 months +dt
+        2004 12 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -24 months +dt
+        2004 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2004 2 29 0 0 0 0 make-timestamp 12 months +dt
+        2005 3 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2004 2 29 0 0 0 0 make-timestamp -12 months +dt
+        2003 3 1 0 0 0 0 make-timestamp = ] unit-test
+
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 0 years +dt
+        2006 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 years +dt
+        2007 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -1 years +dt
+        2005 1 1 0 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -100 years +dt
+        1906 1 1 0 0 0 0 make-timestamp = ] unit-test
+! [ t ] [ 2004 2 29 0 0 0 0 make-timestamp -1 years +dt
+        ! 2003 2 28 0 0 0 0 make-timestamp = ] unit-test
+
+[ 5 ] [ 2006 7 14 0 0 0 0 make-timestamp day-of-week ] unit-test
+
+[ t ] [ 2006 7 14 [ julian-day-number julian-day-number>date 0 0 0 0 make-timestamp ] 3keep 0 0 0 0 make-timestamp = ] unit-test
+
+[ 1 ] [ 2006 1 1 0 0 0 0 make-timestamp day-of-year ] unit-test
+[ 60 ] [ 2004 2 29 0 0 0 0 make-timestamp day-of-year ] unit-test
+[ 61 ] [ 2004 3 1 0 0 0 0 make-timestamp day-of-year ] unit-test
+[ 366 ] [ 2004 12 31 0 0 0 0 make-timestamp day-of-year ] unit-test
+[ 365 ] [ 2003 12 31 0 0 0 0 make-timestamp day-of-year ] unit-test
+[ 60 ] [ 2003 3 1 0 0 0 0 make-timestamp day-of-year ] unit-test
+
+[ t ] [ 2004 12 31 0 0 0 0 make-timestamp dup = ] unit-test
+[ t ] [ 2004 1 1 0 0 0 0 make-timestamp 10 seconds 5 years +dts +dt
+        2009 1 1 0 0 10 0 make-timestamp = ] unit-test
+[ t ] [ 2004 1 1 0 0 0 0 make-timestamp -10 seconds -5 years +dts +dt
+        1998 12 31 23 59 50 0 make-timestamp = ] unit-test
+
+[ t ] [ 2004 1 1 23 0 0 12 make-timestamp 0 convert-timezone
+        2004 1 1 11 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2004 1 1 5 0 0 -11 make-timestamp 0 convert-timezone
+        2004 1 1 16 0 0 0 make-timestamp = ] unit-test
+[ t ] [ 2004 1 1 23 0 0 9.5 make-timestamp 0 convert-timezone
+        2004 1 1 13 30 0 0 make-timestamp = ] unit-test
+
+[ 0 ] [ 2004 1 1 13 30 0 0 make-timestamp
+        2004 1 1 12 30 0 -1 make-timestamp compare-timestamps ] unit-test
+
+[ 1 ] [ 2004 1 1 13 30 0 0 make-timestamp
+        2004 1 1 12 30 0 0 make-timestamp compare-timestamps ] unit-test
+
+[ -1 ] [ 2004 1 1 12 30 0 0 make-timestamp
+        2004 1 1 13 30 0 0 make-timestamp compare-timestamps ] unit-test
+
+[ 1 ] [ 2005 1 1 12 30 0 0 make-timestamp
+        2004 1 1 13 30 0 0 make-timestamp compare-timestamps ] unit-test
+
+[ t ] [ now timestamp>unix-time millis 1000 /f - 10 < ] unit-test
+[ t ] [ 0 unix-time>timestamp unix-1970 = ] unit-test
+[ t ] [ 123456789 [ unix-time>timestamp timestamp>unix-time ] keep = ] unit-test
+[ t ] [ 123456789123456789 [ unix-time>timestamp timestamp>unix-time ] keep = ] unit-test
diff --git a/extra/calendar/calendar.factor b/extra/calendar/calendar.factor
new file mode 100644 (file)
index 0000000..27857e0
--- /dev/null
@@ -0,0 +1,338 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: arrays hashtables io io.streams.string kernel math
+math.vectors math.parser
+namespaces sequences strings tuples system ;
+IN: calendar
+
+TUPLE: timestamp year month day hour minute second gmt-offset ;
+
+C: <timestamp> timestamp
+
+TUPLE: dt year month day hour minute second ;
+
+C: <dt> dt
+
+DEFER: gmt-offset
+
+: month-names
+    {
+        "Not a month" "January" "February" "March" "April" "May" "June"
+        "July" "August" "September" "October" "November" "December"
+    } ;
+
+: month-abbreviations
+    {
+        "Not a month"
+        "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"
+    } ;
+
+: day-names
+    {
+        "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"
+    } ;
+
+: day-abbreviations2 { "Su" "Mo" "Tu" "We" "Th" "Fr" "Sa" } ;
+: day-abbreviations3 { "Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" } ;
+
+: average-month ( -- x )
+    #! length of average month in days
+    30.41666666666667 ;
+
+SYMBOL: a
+SYMBOL: b
+SYMBOL: c
+SYMBOL: d
+SYMBOL: e
+SYMBOL: y
+SYMBOL: m
+
+: julian-day-number ( year month day -- n )
+    #! Returns a composite date number
+    #! Not valid before year -4800
+    [
+        14 pick - 12 /i a set
+        pick 4800 + a get - y set
+        over 12 a get * + 3 - m set
+        2nip 153 m get * 2 + 5 /i + 365 y get * +
+        y get 4 /i + y get 100 /i - y get 400 /i + 32045 -
+    ] with-scope ;
+
+: julian-day-number>date ( n -- year month day )
+    #! Inverse of julian-day-number
+    [
+        32044 + a set
+        4 a get * 3 + 146097 /i b set
+        a get 146097 b get * 4 /i - c set
+        4 c get * 3 + 1461 /i d set
+        c get 1461 d get * 4 /i - e set
+        5 e get * 2 + 153 /i m set
+        100 b get * d get + 4800 -
+        m get 10 /i + m get 3 +
+        12 m get 10 /i * -
+        e get 153 m get * 2 + 5 /i - 1+
+    ] with-scope ;
+
+: set-date ( year month day timestamp -- )
+    [ set-timestamp-day ] keep
+    [ set-timestamp-month ] keep
+    set-timestamp-year ;
+
+: set-time ( hour minute second timestamp -- )
+    [ set-timestamp-second ] keep
+    [ set-timestamp-minute ] keep
+    set-timestamp-hour ;
+
+: >date< ( timestamp -- year month day )
+    [ timestamp-year ] keep
+    [ timestamp-month ] keep
+    timestamp-day ;
+
+: >time< ( timestamp -- hour minute second )
+    [ timestamp-hour ] keep
+    [ timestamp-minute ] keep
+    timestamp-second ;
+
+: zero-dt ( -- <dt> ) 0 0 0 0 0 0 <dt> ;
+: years ( n -- dt ) zero-dt [ set-dt-year ] keep ;
+: months ( n -- dt ) zero-dt [ set-dt-month ] keep ;
+: weeks ( n -- dt ) 7 * zero-dt [ set-dt-day ] keep ;
+: days ( n -- dt ) zero-dt [ set-dt-day ] keep ;
+: hours ( n -- dt ) zero-dt [ set-dt-hour ] keep ;
+: minutes ( n -- dt ) zero-dt [ set-dt-minute ] keep ;
+: seconds ( n -- dt ) zero-dt [ set-dt-second ] keep ;
+: milliseconds ( n -- dt ) 1000 /f zero-dt [ set-dt-second ] keep ;
+
+: julian-day-number>timestamp ( n -- timestamp )
+    julian-day-number>date 0 0 0 0 <timestamp> ;
+
+GENERIC: +year ( timestamp x -- timestamp )
+GENERIC: +month ( timestamp x -- timestamp )
+GENERIC: +day ( timestamp x -- timestamp )
+GENERIC: +hour ( timestamp x -- timestamp )
+GENERIC: +minute ( timestamp x -- timestamp )
+GENERIC: +second ( timestamp x -- timestamp )
+
+: /rem ( f n -- q r )
+    #! q is positive or negative, r is positive from 0 <= r < n
+    [ /f floor >bignum ] 2keep rem ;
+
+: float>whole-part ( float -- int float )
+    [ floor >bignum ] keep over - ;
+
+: leap-year? ( year -- ? )
+    dup 100 mod zero? 400 4 ? mod zero? ;
+
+: adjust-leap-year ( timestamp -- timestamp )
+    dup >date< 29 = swap 2 = and swap leap-year? not and [
+        dup >r timestamp-year 3 1 r> [ set-date ] keep
+    ] when ;
+
+M: integer +year ( timestamp n -- timestamp )
+    over timestamp-year + swap [ set-timestamp-year ] keep
+    adjust-leap-year ;
+M: real +year ( timestamp n -- timestamp )
+    float>whole-part rot swap 365.2425 * +day swap +year ;
+
+M: integer +month ( timestamp n -- timestamp )
+    over timestamp-month + 12 /rem
+    dup zero? [ drop 12 >r 1- r> ] when pick set-timestamp-month
+    +year ;
+M: real +month ( timestamp n -- timestamp )
+    float>whole-part rot swap average-month * +day swap +month ;
+
+M: integer +day ( timestamp n -- timestamp )
+    swap [
+        >date< julian-day-number + julian-day-number>timestamp
+    ] keep swap >r >time< r> [ set-time ] keep ;
+M: real +day ( timestamp n -- timestamp )
+    float>whole-part rot swap 24 * +hour swap +day ;
+
+M: integer +hour ( timestamp n -- timestamp )
+    over timestamp-hour + 24 /rem pick set-timestamp-hour
+    +day ;
+M: real +hour ( timestamp n -- timestamp )
+    float>whole-part rot swap 60 * +minute swap +hour ;
+
+M: integer +minute ( timestamp n -- timestamp )
+    over timestamp-minute + 60 /rem pick
+    set-timestamp-minute +hour ;
+M: real +minute ( timestamp n -- timestamp )
+    float>whole-part rot swap 60 * +second swap +minute ; 
+
+M: number +second ( timestamp n -- timestamp )
+    over timestamp-second + 60 /rem >r >bignum r>
+    pick set-timestamp-second +minute ;
+
+: +dt ( timestamp dt -- timestamp )
+    dupd
+    [ dt-second +second ] keep
+    [ dt-minute +minute ] keep
+    [ dt-hour +hour ] keep
+    [ dt-day +day ] keep
+    [ dt-month +month ] keep
+    dt-year +year
+    swap timestamp-gmt-offset over set-timestamp-gmt-offset ;
+
+: make-timestamp ( year month day hour minute second gmt-offset -- timestamp )
+    <timestamp> [ 0 seconds +dt ] keep
+    [ = [ "invalid timestamp" throw ] unless ] keep ;
+
+: array>dt ( vec -- dt ) { dt f } swap append >tuple ;
+: +dts ( dt dt -- dt ) [ tuple-slots ] 2apply v+ array>dt ;
+
+: dt>years ( dt -- x )
+    #! Uses average month/year length since dt loses calendar
+    #! data
+    tuple-slots
+    { 1 12 365.2425 8765.82 525949.2 31556952.0 }
+    [ / ] 2map sum ;
+: dt>months ( dt -- x ) dt>years 12 * ;
+: dt>days ( dt -- x ) dt>years 365.2425 * ;
+: dt>hours ( dt -- x ) dt>years 8765.82 * ;
+: dt>minutes ( dt -- x ) dt>years 525949.2 * ;
+: dt>seconds ( dt -- x ) dt>years 31556952 * ;
+: dt>milliseconds ( dt -- x ) dt>years 31556952000 * ;
+
+: convert-timezone ( timestamp n -- timestamp )
+    [ over timestamp-gmt-offset - hours +dt ] keep
+    over set-timestamp-gmt-offset ;
+
+: >local-time ( timestamp -- timestamp )
+    gmt-offset convert-timezone ;
+
+: >gmt ( timestamp -- timestamp )
+    0 convert-timezone ;
+
+: compare-timestamps ( tuple tuple -- n )
+    [ >gmt tuple-slots ] compare ;
+
+: timestamp- ( timestamp timestamp -- seconds )
+    #! Exact calendar-time difference
+    [ >gmt ] 2apply
+    [ [ >date< julian-day-number ] 2apply - 86400 * ] 2keep
+    [ >time< >r >r 3600 * r> 60 * r> + + ] 2apply - + ;
+
+: unix-1970
+    1970 1 1 0 0 0 0 <timestamp> ;
+
+: unix-time>timestamp ( n -- timestamp )
+    >r unix-1970 r> seconds +dt ; 
+
+: timestamp>unix-time ( timestamp -- n )
+    unix-1970 timestamp- >bignum ;
+
+: gmt ( -- timestamp )
+    #! GMT time, right now
+    unix-1970 millis 1000 /f seconds +dt ; 
+
+: now ( -- timestamp ) gmt >local-time ;
+: before ( dt -- -dt ) tuple-slots [ neg ] map array>dt ;
+: from-now ( dt -- timestamp ) now swap +dt ;
+: ago ( dt -- timestamp ) before from-now ;
+
+: days-in-year ( year -- n ) leap-year? 366 365 ? ;
+: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 } ;
+: days-in-month ( year month -- n )
+    swap leap-year? [
+        [ day-counts nth ] keep 2 = [ 1+ ] when
+    ] [
+        day-counts nth
+    ] if ;
+
+: zeller-congruence ( year month day -- n )
+    #! Zeller Congruence
+    #! http://web.textfiles.com/computers/formulas.txt
+    #! good for any date since October 15, 1582
+    >r dup 2 <= [ 12 + >r 1- r> ] when
+    >r dup [ 4 /i + ] keep [ 100 /i - ] keep 400 /i + r>
+        [ 1+ 3 * 5 /i + ] keep 2 * + r>
+    1+ + 7 mod ;
+
+: day-of-week ( timestamp -- n )
+    [ timestamp-year ] keep
+    [ timestamp-month ] keep
+    timestamp-day
+    zeller-congruence ;
+
+: day-of-year ( timestamp -- n )
+    [
+        [ timestamp-year leap-year? ] keep
+        [ >date< 3array ] keep timestamp-year 3 1 3array <=>
+        0 >= and 1 0 ?
+    ] keep 
+    [ timestamp-month day-counts swap head-slice sum + ] keep
+    timestamp-day + ;
+
+: print-day ( n -- )
+    number>string dup length 2 < [ bl ] when write ;
+
+: print-month ( year month -- )
+    [ month-names nth write bl number>string print ] 2keep
+    [ 1 zeller-congruence ] 2keep
+    days-in-month day-abbreviations2 " " join print
+    over "   " <repetition> concat write
+    [
+        [ 1+ print-day ] keep
+        1+ + 7 mod zero? [ nl ] [ bl ] if
+    ] curry* each nl ;
+
+: print-year ( year -- )
+    12 [ 1+ print-month nl ] curry* each ;
+
+: pad-00 number>string 2 CHAR: 0 pad-left write ;
+
+: (timestamp>string) ( timestamp -- )
+    dup day-of-week day-abbreviations3 nth write ", " write
+    dup timestamp-day number>string write bl
+    dup timestamp-month month-abbreviations nth write bl
+    dup timestamp-year number>string write bl
+    dup timestamp-hour pad-00 ":" write
+    dup timestamp-minute pad-00 ":" write
+    timestamp-second >fixnum pad-00 ;
+
+: timestamp>string ( timestamp -- str )
+    [
+        (timestamp>string)
+    ] string-out ;
+
+: timestamp>http-string ( timestamp -- str )
+    #! http timestamp format
+    #! Example: Tue, 15 Nov 1994 08:12:31 GMT
+    >gmt [
+        (timestamp>string)
+        " GMT" write
+    ] string-out ;
+
+: (timestamp>rfc3339) ( timestamp -- )
+    dup timestamp-year number>string write CHAR: - write1
+    dup timestamp-month pad-00 CHAR: - write1
+    dup timestamp-day pad-00 CHAR: T write1
+    dup timestamp-hour pad-00 CHAR: : write1
+    dup timestamp-minute pad-00 CHAR: : write1
+    timestamp-second >fixnum pad-00 CHAR: Z write1 ;
+
+: timestamp>rfc3339 ( timestamp -- str )
+    >gmt [
+        (timestamp>rfc3339)
+     ] string-out ;
+
+: file-time-string ( timestamp -- string )
+    [
+        [ timestamp-month month-abbreviations nth write ] keep bl
+        [ timestamp-day number>string 2 32 pad-left write ] keep bl
+        dup now [ timestamp-year ] 2apply = [
+            [ timestamp-hour pad-00 ] keep ":" write
+            timestamp-minute pad-00
+        ] [
+            timestamp-year number>string 5 32 pad-left write
+        ] if
+    ] string-out ;
+
+SYMBOL: calendar-impl
+
+HOOK: gmt-offset calendar-impl ( -- n )
+
+USE-IF: unix? calendar.unix
+USE-IF: windows? calendar.windows
diff --git a/extra/calendar/summary.txt b/extra/calendar/summary.txt
new file mode 100644 (file)
index 0000000..e2d2488
--- /dev/null
@@ -0,0 +1 @@
+Date and time classes
diff --git a/extra/calendar/unix/unix-tests.factor b/extra/calendar/unix/unix-tests.factor
new file mode 100644 (file)
index 0000000..a35a60c
--- /dev/null
@@ -0,0 +1,13 @@
+USING: alien alien.c-types calendar calendar.unix
+kernel math tools.test ;
+
+[ t ] [ 239293000 [
+    unix-time>timestamp timestamp>timeval
+    timeval>timestamp timestamp>timeval *ulong
+] keep = ] unit-test
+
+
+[ t ] [ 23929000.3 [
+    unix-time>timestamp timestamp>timeval
+    timeval>timestamp timestamp>timeval *ulong
+] keep >bignum = ] unit-test
diff --git a/extra/calendar/unix/unix.factor b/extra/calendar/unix/unix.factor
new file mode 100644 (file)
index 0000000..39dc527
--- /dev/null
@@ -0,0 +1,32 @@
+USING: alien alien.c-types arrays kernel structs
+math unix calendar namespaces ;
+IN: calendar.unix
+
+TUPLE: unix-calendar ;
+
+T{ unix-calendar } calendar-impl set-global
+
+: get-time
+    f time <uint> localtime ;
+
+: timezone-name
+    get-time tm-zone ;
+
+M: unix-calendar gmt-offset
+    get-time tm-gmtoff 3600 / ;
+
+: timestamp>timeval ( timestamp -- timeval )
+    timestamp>unix-time 1000 * make-timeval ;
+
+: timeval>timestamp ( timeval -- timestamp )
+    [ timeval-sec ] keep
+    timeval-usec 1000000 / + unix-time>timestamp ;
+
+: timestamp>timespec ( timestamp -- timespec )
+    timestamp>unix-time "timespec" <c-object>
+    [ set-timespec-sec ] keep ;
+
+: timespec>timestamp ( timespec -- timestamp )
+    [ timespec-sec ] keep
+    timespec-nsec 1000000000 / +
+    unix-time>timestamp ;
diff --git a/extra/calendar/windows/windows-tests.factor b/extra/calendar/windows/windows-tests.factor
new file mode 100644 (file)
index 0000000..ed0dcae
--- /dev/null
@@ -0,0 +1,6 @@
+USING: calendar calendar.windows kernel tools.test ;\r
+\r
+[ t ] [ windows-1601 [ timestamp>FILETIME FILETIME>timestamp ] keep = ] unit-test\r
+[ t ] [ windows-time [ windows-time>FILETIME FILETIME>windows-time ] keep = ] unit-test\r
+[ t ] [ windows-1601 400 years +dt [ timestamp>FILETIME FILETIME>timestamp ] keep = ] unit-test\r
+\r
diff --git a/extra/calendar/windows/windows.factor b/extra/calendar/windows/windows.factor
new file mode 100644 (file)
index 0000000..9d9c3f9
--- /dev/null
@@ -0,0 +1,48 @@
+USING: alien alien.c-types kernel math
+windows windows.kernel32 calendar namespaces ;
+IN: calendar.windows
+
+TUPLE: windows-calendar ;
+
+T{ windows-calendar } calendar-impl set-global
+
+M: windows-calendar gmt-offset ( -- float )
+    "TIME_ZONE_INFORMATION" <c-object>
+    [ GetTimeZoneInformation win32-error=0/f ] keep
+    [ TIME_ZONE_INFORMATION-Bias ] keep
+    TIME_ZONE_INFORMATION-DaylightBias + 60 /f neg ;
+
+: >64bit ( lo hi -- n )
+    32 shift bitor ;
+
+: windows-1601 ( -- timestamp )
+    1601 1 1 0 0 0 0 <timestamp> ;
+
+: FILETIME>windows-time ( FILETIME -- n )
+    [ FILETIME-dwLowDateTime ] keep
+    FILETIME-dwHighDateTime >64bit ;
+
+: windows-time>timestamp ( n -- timestamp )
+    10000000 /i seconds windows-1601 swap +dt ;
+
+: windows-time ( -- n )
+    "FILETIME" <c-object> [ GetSystemTimeAsFileTime ] keep
+    FILETIME>windows-time ;
+
+: timestamp>windows-time ( timestamp -- n )
+    #! 64bit number representing # of nanoseconds since Jan 1, 1601 (UTC)
+    >gmt windows-1601 timestamp- >bignum 10000000 * ;
+
+: windows-time>FILETIME ( n -- FILETIME )
+    "FILETIME" <c-object>
+    [
+        [ >r HEX: ffffffff bitand r> set-FILETIME-dwLowDateTime ] 2keep
+        >r -32 shift r> set-FILETIME-dwHighDateTime
+    ] keep ;
+
+: timestamp>FILETIME ( timestamp -- FILETIME/f )
+    [ >gmt timestamp>windows-time windows-time>FILETIME ] [ f ] if* ;
+
+: FILETIME>timestamp ( FILETIME -- timestamp/f )
+    FILETIME>windows-time windows-time>timestamp ;
+
diff --git a/extra/catalyst-talk/authors.txt b/extra/catalyst-talk/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/catalyst-talk/catalyst-talk.factor b/extra/catalyst-talk/catalyst-talk.factor
new file mode 100644 (file)
index 0000000..20e3238
--- /dev/null
@@ -0,0 +1,132 @@
+USING: slides help.markup math arrays hashtables namespaces
+sequences kernel sequences parser ;
+IN: catalyst-talk
+
+: catalyst-slides
+{
+    { $slide "What is Factor?"
+        "Originally scripting for a Java game"
+        "Language dev more fun than game dev"
+        "Start with ideas which were mostly dead"
+        "Throw in features from crazy languages"
+        "Develop practical libraries and tools"
+    }
+    { $slide "Factor: a stack language"
+        "Implicit parameter passing"
+        { "Each " { $emphasis "word" } " is a function call" }
+        { $code ": sq dup * ;" }
+        { $code "2 3 + sq ." }
+        "Minimal syntax and semantics = easy meta-programming"
+        { "Related languages: Forth, Joy, PostScript" }
+    }
+    { $slide "Factor: a functional language"
+        { { $emphasis "Quotations" } " can be passed around, constructed..." }
+        { $code "[ sq 3 + ]" }
+        { { $emphasis "Combinators" } " are words which take quotations, eg " { $link if } }
+        { "For FP buffs: " { $link each } ", " { $link map } ", " { $link reduce } ", " { $link accumulate } ", " { $link interleave } ", " { $link subset } }
+        { $code "{ 42 69 666 } [ sq 3 + ] map ." }
+    }
+    { $slide "Factor: an object-oriented language"
+        { "Everything is an " { $emphasis "object" } }
+        { "An object is an instance of a " { $emphasis "class" } }
+        "Methods"
+        "Generic words"
+        "For CLOS buffs: we allow custom method combination, classes are objects too, there's a MOP"
+    }
+    
+: (strip-tease) ( data n -- data )
+    >r first3 r> head 3array ;
+
+: strip-tease ( data -- seq )
+    dup third length 1 - [
+        2 + (strip-tease)
+    ] curry* map ;
+
+: STRIP-TEASE:
+    parse-definition strip-tease [ parsed ] each ; parsing
+
+    STRIP-TEASE:
+        $slide "Primary school geometry recap"
+        { $code
+            "GENERIC: area ( shape -- meters^2 )"
+            "TUPLE: square dimension ;"
+            "M: square area square-dimension sq ;"
+            "TUPLE: circle radius ;"
+            "M: circle area circle-radius sq pi * ;"
+            "TUPLE: rectangle width height ;"
+            "M: rectangle area"
+            "    dup rectangle-width"
+            "    swap rectangle-height"
+            "    * ;"
+        }
+    ;
+
+    { $slide "Geometry example"
+        { $code "10 <square> area ." }
+        { $code "18 <circle> area ." }
+        { $code "20 40 <rectangle> area ." }
+    }
+!    { $slide "Factor: a meta language"
+!        "Writing code which writes code"
+!        "Extensible parser: define new syntax"
+!        "Compiler transforms"
+!        "Here's an inefficient word:"
+!        { $code
+!            ": fib ( x -- y )"
+!            "    dup 1 > ["
+!            "        1 - dup fib swap 1 - fib +"
+!            "    ] when ;"
+!        }
+!    }
+!    { $slide "Memoization"
+!        { { $link POSTPONE: : } " is just another word" }
+!        "What if we could define a word which caches its results?"
+!        { "The " { $vocab-link "memoize" } " library provides such a feature" }
+!        { "Just change " { $link POSTPONE: : } " to " { $link POSTPONE: MEMO: } }
+!        { $code
+!            "MEMO: fib ( x -- y )"
+!            "    dup 1 > ["
+!            "        1 - dup fib swap 1 - fib +"
+!            "    ] when ;"
+!        }
+!    }
+    { $slide "Factor: a tool-building language"
+        "Tools are not monolithic, but are themselves just sets of words"
+        "Examples: parser, compiler, etc"
+        "Parser: turns strings into objects"
+        { $code "\"1\" <file-reader> contents parse" }
+        "Prettyprinter: turns objects into strings"
+        { $code "\"2\" <file-writer> [ . ] with-stream" }
+    }
+    { $slide "Factor: an interactive language"
+        { "Let's hack " { $vocab-link "tetris" } }
+        "Editor integration"
+        { $code "\\ tetrominoes edit" }
+        "Inspector"
+        { $code "\\ tetrominoes get inspect" }
+    }
+    { $slide "C library interface"
+        "No need to write C glue code!"
+        "Callbacks from C to Factor"
+        "Factor can be embedded in C apps"
+        { "Example: " { $vocab-link "ogg.vorbis" } }
+        { "Other bindings: OpenGL, OpenAL, X11, Win32, Cocoa, OpenSSL, memory mapped files, ..." }
+    }
+    { $slide "Native libraries"
+        "XML, HTTP, SMTP, Unicode, calendar, ..."
+        "Lazy lists, pattern matching, packed arrays, ..."
+    }
+    { $slide "Factor: a fun language"
+        { "Let's play "
+        { $vocab-link "space-invaders" }
+        }
+        { $url "http://factorcode.org" }
+        { $url "http://factor-language.blogspot.com" }
+        "irc.freenode.net #concatenative"
+        "Have fun!"
+    }
+} ;
+
+: catalyst-talk catalyst-slides slides-window ;
+
+MAIN: catalyst-talk
diff --git a/extra/catalyst-talk/summary.txt b/extra/catalyst-talk/summary.txt
new file mode 100644 (file)
index 0000000..f2efe74
--- /dev/null
@@ -0,0 +1 @@
+Slides for a talk at Catalyst IT NZ, July 2007
diff --git a/extra/catalyst-talk/tags.txt b/extra/catalyst-talk/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/cfdg/authors.txt b/extra/cfdg/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/cfdg/cfdg.factor b/extra/cfdg/cfdg.factor
new file mode 100644 (file)
index 0000000..cbb7417
--- /dev/null
@@ -0,0 +1,232 @@
+
+USING: kernel alien.c-types combinators namespaces arrays
+       sequences sequences.lib namespaces.lib splitting
+       math math.functions math.vectors math.trig
+       opengl.gl opengl.glu ui ui.gadgets.slate vars mortar slot-accessors
+       random-weighted cfdg.hsv cfdg.gl ;
+
+IN: cfdg
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: <hsba>
+
+<hsba>
+  { "hue" "saturation" "brightness" "alpha" } accessors
+define-independent-class
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: hsv>rgb* ( h s v -- r g b ) 3array hsv>rgb first3 ;
+
+: gl-set-hsba ( color -- ) object-values first4 >r hsv>rgb* r> glColor4d ;
+
+: gl-clear-hsba ( color -- ) object-values first4 >r hsv>rgb* r> glClearColor ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: color
+
+: init-color ( -- ) 0 0 0 1 <hsba> new >color ;
+
+: hue ( num -- ) color> tuck $hue + 360 mod >>hue drop ;
+
+: h ( num -- ) hue ;
+
+! if (adjustment < 0)
+!   base + base * adjustment
+
+! if (adjustment > 0)
+!   base + (1 - base) * adjustment
+
+: adjust ( val num -- val ) dup 0 > [ 1 pick - * + ] [ dupd * + ] if ;
+
+: saturation ( num -- ) color> dup $saturation rot adjust >>saturation drop ;
+
+: sat ( num -- ) saturation ;
+
+: brightness ( num -- ) color> dup $brightness rot adjust >>brightness drop ;
+
+: b ( num -- ) brightness ;
+
+: alpha ( num -- ) color> dup $alpha rot adjust >>alpha drop ;
+
+: a ( num -- ) alpha ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: color-stack
+
+: init-color-stack ( -- ) V{ } clone >color-stack ;
+
+: clone-color ( hsba -- hsba ) object-values first4 <hsba> new ;
+
+: push-color ( -- )
+color> color-stack> push
+color> clone-color >color ;
+
+: pop-color ( -- ) color-stack> pop dup >color gl-set-hsba ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : check-size ( modelview-matrix -- num )
+! { 0 1 4 5 } swap [ double-nth ] curry map
+! [ abs ] map
+! [ <=> ] maximum ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : check-size ( modelview-matrix -- num )
+!   { 0 1 4 5 } swap [ double-nth ] curry map
+!   [ abs ] map
+!   biggest ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: double-nth* ( c-array indices -- seq ) swap [ double-nth ] curry map ;
+
+: check-size ( modelview-matrix -- num )
+  { 0 1 4 5 } double-nth* [ abs ] map biggest ;
+
+VAR: threshold
+
+: iterate? ( -- ? ) get-modelview-matrix check-size threshold get > ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! cos 2a   sin 2a  0  0
+! sin 2a  -cos 2a  0  0
+!      0        0  1  0
+!      0        0  0  1
+
+! column major order
+
+: gl-flip ( angle -- ) deg>rad
+{ [ dup 2 * cos ] [ dup 2 * sin ] 0 0
+  [ dup 2 * sin ] [ 2 * cos neg ] 0 0
+  0 0 1 0
+  0 0 0 1 } make* >c-double-array glMultMatrixd ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: circle ( -- )
+color> gl-set-hsba
+gluNewQuadric dup 0 0.5 20 10 gluDisk gluDeleteQuadric ;
+
+: triangle ( -- )
+color> gl-set-hsba
+GL_POLYGON glBegin
+   0    0.577 glVertex2d
+   0.5 -0.289 glVertex2d
+  -0.5 -0.289 glVertex2d
+glEnd ;
+
+: square ( -- )
+color> gl-set-hsba
+GL_POLYGON glBegin
+  -0.5  0.5 glVertex2d
+   0.5  0.5 glVertex2d
+   0.5 -0.5 glVertex2d
+  -0.5 -0.5 glVertex2d
+glEnd ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: size ( scale -- ) dup 1 glScaled ;
+
+: s ( scale -- ) size ;
+
+: size* ( scale-x scale-y -- ) 1 glScaled ;
+
+: s* ( scale-x scale-y -- ) size* ;
+
+: rotate ( angle -- ) 0 0 1 glRotated ;
+
+: r ( angle -- ) rotate ;
+
+: x ( x -- ) 0 0 glTranslated ;
+
+: y ( y -- ) 0 swap 0 glTranslated ;
+
+: flip ( angle -- ) gl-flip ;
+
+: f ( angle -- ) flip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: do ( quot -- )
+push-modelview-matrix
+push-color
+call
+pop-modelview-matrix
+pop-color ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: recursive ( quot -- ) iterate? swap when ;
+
+: multi ( seq -- ) random-weighted* call ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: background
+
+: initial-background ( -- hsba ) 0 0 1 1 <hsba> new ;
+
+: set-background ( -- )
+  initial-background >color
+  background> call
+  color> gl-clear-hsba ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USING: rewrite-closures ;
+
+VAR: viewport ! { left width bottom height }
+
+VAR: start-shape
+
+: initial-color ( -- hsba ) 0 0 0 1 <hsba> new ;
+
+: display ( -- )
+
+!   GL_LINE_SMOOTH glEnable
+!   GL_BLEND glEnable
+!   GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
+!   GL_POINT_SMOOTH_HINT GL_NICEST glHint
+
+!   GL_FOG glEnable
+!   GL_FOG_MODE GL_LINEAR glFogi
+!   GL_FOG_COLOR { 0.5 0.5 0.5 1.0 } >c-double-array glFogfv
+!   GL_FOG_DENSITY 0.35 glFogf
+!   GL_FOG_HINT GL_DONT_CARE glHint
+!   GL_FOG_START 1.0 glFogf
+!   GL_FOG_END 5.0 glFogf
+
+  GL_PROJECTION glMatrixMode
+  glLoadIdentity
+  viewport> first  dup  viewport> second  +
+  viewport> third  dup  viewport> fourth  + gluOrtho2D
+
+  GL_MODELVIEW glMatrixMode
+  glLoadIdentity
+
+  set-background
+
+  GL_COLOR_BUFFER_BIT glClear
+
+  init-modelview-matrix-stack
+  init-color-stack
+
+  initial-color >color
+
+  color> gl-set-hsba
+
+  start-shape> call ;
+
+: cfdg-window* ( -- )
+[ display ] closed-quot <slate>
+  { 500 500 } over set-slate-dim
+  dup "CFDG" open-window ;
+
+: cfdg-window ( -- ) [ cfdg-window* ] with-ui ;
\ No newline at end of file
diff --git a/extra/cfdg/gl/gl.factor b/extra/cfdg/gl/gl.factor
new file mode 100644 (file)
index 0000000..e405769
--- /dev/null
@@ -0,0 +1,17 @@
+
+USING: kernel alien.c-types namespaces sequences opengl.gl ;
+
+IN: cfdg.gl
+
+: get-modelview-matrix ( -- alien )
+GL_MODELVIEW_MATRIX 16 "GLdouble" <c-array> tuck glGetDoublev ;
+
+SYMBOL: modelview-matrix-stack
+
+: init-modelview-matrix-stack ( -- )
+V{ } clone modelview-matrix-stack set ;
+
+: push-modelview-matrix ( -- )
+get-modelview-matrix modelview-matrix-stack get push ;
+
+: pop-modelview-matrix ( -- ) modelview-matrix-stack get pop glLoadMatrixd ;
\ No newline at end of file
diff --git a/extra/cfdg/hsv/hsv.factor b/extra/cfdg/hsv/hsv.factor
new file mode 100644 (file)
index 0000000..bd33eb3
--- /dev/null
@@ -0,0 +1,39 @@
+
+USING: kernel combinators arrays sequences math ;
+
+IN: cfdg.hsv
+
+<PRIVATE
+
+: H ( hsv -- H ) first ;
+
+: S ( hsv -- S ) second ;
+
+: V ( hsv -- V ) third ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: Hi ( hsv -- Hi ) H 60 / floor 6 mod ;
+
+: f ( hsv -- f ) dup H 60 / swap Hi - ;
+
+: p ( hsv -- p ) 1 over S - swap V * ;
+
+: q ( hsv -- q ) dup f over S * 1 swap - swap V * ;
+
+: t ( hsv -- t ) 1 over f - over S * 1 swap - swap V * ;
+
+PRIVATE>
+
+! h [0,360)
+! s [0,1]
+! v [0,1]
+
+: hsv>rgb ( hsv -- rgb )
+dup Hi
+{ { 0 [ dup V swap dup t swap p ] }
+  { 1 [ dup q over V rot p ] }
+  { 2 [ dup p over V rot t ] }
+  { 3 [ dup p over q rot V ] }
+  { 4 [ dup t over p rot V ] }
+  { 5 [ dup V over p rot q ] } } case 3array ;
\ No newline at end of file
diff --git a/extra/cfdg/models/aqua-star/aqua-star.factor b/extra/cfdg/models/aqua-star/aqua-star.factor
new file mode 100644 (file)
index 0000000..ee42b9a
--- /dev/null
@@ -0,0 +1,34 @@
+
+USING: kernel namespaces math random opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.aqua-star
+
+: tentacle ( -- )
+iterate? [
+  { [ circle
+      [ .23 y .99 s .002 b tentacle ] do ]
+    [ circle
+      [ .17 y 2 r .99 s .002 b tentacle ] do ]
+    [ circle
+      [ .12 y -2 r .99 s .001 b tentacle ] do ] } random call
+] when ;
+
+: anemone ( -- )
+iterate? [
+  tentacle
+  [ 10 x -11 r .995 s -.002 b anemone ] do
+] when ;
+
+: anemone-begin ( -- ) [ 196 hue 0.8324 sat 1 b anemone ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run ( -- )
+[ -1 b ] >background
+{ -60 140 -120 140 } viewport set
+0.1 threshold set
+[ anemone-begin ] start-shape set
+cfdg-window ;
+
+MAIN: run
diff --git a/extra/cfdg/models/chiaroscuro/chiaroscuro.factor b/extra/cfdg/models/chiaroscuro/chiaroscuro.factor
new file mode 100644 (file)
index 0000000..08c4308
--- /dev/null
@@ -0,0 +1,35 @@
+
+USING: kernel namespaces sequences math
+       opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.chiaroscuro
+
+DEFER: white
+
+: black ( -- ) iterate? [
+{ { 60 [ [ 0.6 s circle ] do
+                [ 0.1 x 5 r 0.99 s -0.01 b -0.01 a black ] do ] }
+  { 1 [ white black ] } }
+random-weighted* call
+] when ;
+
+: white ( -- ) iterate? [
+{ { 60 [ [ 0.6 s circle ] do
+                [ 0.1 x -5 r 0.99 s 0.01 b -0.01 a white ] do ] }
+  { 1 [ black white ] } }
+random-weighted* call
+] when ;
+
+: chiaroscuro ( -- ) [ 0.5 b black ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run ( -- )
+[ -0.5 b ] >background
+{ -3 6 -2 6 } viewport set
+0.01 threshold set
+[ chiaroscuro ] start-shape set
+cfdg-window ;
+
+MAIN: run
diff --git a/extra/cfdg/models/flower6/flower6.factor b/extra/cfdg/models/flower6/flower6.factor
new file mode 100644 (file)
index 0000000..cae8024
--- /dev/null
@@ -0,0 +1,28 @@
+
+USING: kernel namespaces sequences math
+       opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.flower6
+
+: petal6 ( -- )
+iterate? [
+  [ 1 0.001 s* square ] do
+  [ -0.5 x 0.01 s -1 b circle ] do
+  [ 0.5 x 120.21 r 0.996 s 0.5 x 0.005 b petal6 ] do
+] when ;
+
+: flower6 ( -- )
+12 [ [ [ 30 r ] times petal6 ] do ] each
+12 [ [ [ 30 r ] times 90 flip petal6 ] do ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run ( -- )
+{ -1 2 -1 2 } viewport set
+0.01 threshold set
+[ flower6 ] start-shape set
+cfdg-window ;
+
+MAIN: run
+
diff --git a/extra/cfdg/models/game1-turn6/game1-turn6.factor b/extra/cfdg/models/game1-turn6/game1-turn6.factor
new file mode 100644 (file)
index 0000000..6289c35
--- /dev/null
@@ -0,0 +1,48 @@
+
+
+USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
+       mortar random-weighted cfdg ;
+
+IN: cfdg.models.game1-turn6
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: f-triangles ( -- ) iterate? [
+[ 0.1 x 0.1 y -0.33 alpha 20 hue 0.7 sat 0.8 b triangle ] do
+[ 10 hue 0.9 sat 0.33 b triangle ] do
+[ 0.9 s 10 hue 0.5 sat 1 b triangle ] do
+[ 0.8 s 5 r f-triangles ] do
+] when ;
+
+: f-squares ( -- ) iterate? [
+[ 0.1 x 0.1 y -0.33 alpha 250 hue 0.7 sat 0.8 b square ] do
+[ 220 hue 0.9 sat 0.33 b square ] do
+[ 0.9 s 220 hue 0.25 sat 1 b square ] do
+[ 0.8 s 5 r f-squares ] do
+] when ;
+
+DEFER: start
+
+: spiral ( -- ) iterate? [
+{ { 1 [ f-squares
+       [ 0.5 x 0.5 y 45 r f-triangles ] do
+       [ 1 y 25 r 0.9 s spiral ] do ] }
+  { 0.022 [ [ 90 flip 50 hue start ] do ] } }
+random-weighted* call
+] when ;
+
+: start ( -- )
+[       spiral ] do
+[ 120 r spiral ] do
+[ 240 r spiral ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run ( -- )
+[ 66 hue 0.4 sat 0.5 b ] >background
+{ -5 10 -5 10 } viewport set
+0.001 >threshold
+[ start ] >start-shape
+cfdg-window ;
+
+MAIN: run
\ No newline at end of file
diff --git a/extra/cfdg/models/lesson/lesson.factor b/extra/cfdg/models/lesson/lesson.factor
new file mode 100644 (file)
index 0000000..bd3f791
--- /dev/null
@@ -0,0 +1,106 @@
+
+USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.lesson
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: shapes ( -- )
+[            square ]   do
+[ 0.3 b      circle ]   do
+[ 0.5 b      triangle ] do
+[ 0.7 b 60 r triangle ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: chapter-1 ( -- )
+[ 2 x 5 y 3 size square ] do
+[ 6 x 5 y 3 size circle ] do
+[ 4 x 2 y 3 size triangle ] do
+[     1 y 3 size shapes ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: foursquare ( -- )
+[ 0 x 0 y 5 3 size* square ] do
+[ 0 x 5 y 2 4 size* square ] do
+[ 5 x 5 y   3 size  square ] do
+[ 5 x 0 y   2 size  square ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: chapter-2 ( -- )
+[ square ] do
+[ 3 x 7 y square ] do
+[ 5 x 7 y 30 r square ] do
+[ 3 x 5 y 0.75 size square ] do
+[ 5 x 5 y 0.5 b square ] do
+[ 7 x 6 y 45 r 0.7 size 0.7 b square ] do
+[ 5 x 1 y 10 r 0.2 size foursquare ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: spiral ( -- )
+iterate? [
+  [ 0.5 size circle ] do
+  [ 0.2 y -3 r 0.995 size spiral ] do
+] when ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: chapter-3 ( -- ) [ 0 x 3 y spiral ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: tree
+
+: branch-left ( -- )
+{ { 1 [ 20 r tree ] }
+  { 1 [ 30 r tree ] }
+  { 1 [ 40 r tree ] }
+  { 1 [ ] } } random-weighted* do ;
+
+: branch-right ( -- )
+{ { 1 [ -20 r tree ] }
+  { 1 [ -30 r tree ] }
+  { 1 [ -40 r tree ] }
+  { 1 [ ] } } random-weighted* do ;
+
+: branch ( -- ) branch-left branch-right ;
+
+: tree ( -- )
+iterate? [
+  { 
+    { 20  [ [ 0.25 size circle ] do
+           [ 0.1 y 0.97 size tree ] do ] }
+    { 1.5 [ branch ] }
+  } random-weighted* do
+] when ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: chapter-4 ( -- )
+[ 1 x 0 y tree ] do
+[ 6 x 0 y tree ] do
+[ 1 x 4 y tree ] do
+[ 6 x 4 y tree ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: toc ( -- )
+[ 0  x   0 y chapter-1 ] do
+[ 10 x   0 y chapter-2 ] do
+[ 0  x -10 y chapter-3 ] do
+[ 10 x -10 y chapter-4 ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run ( -- )
+{ -5 25 -15 25 } viewport set
+0.03 threshold set
+[ toc ] start-shape set
+cfdg-window ;
+
+MAIN: run
+
diff --git a/extra/cfdg/models/sierpinski/sierpinski.factor b/extra/cfdg/models/sierpinski/sierpinski.factor
new file mode 100644 (file)
index 0000000..1acee83
--- /dev/null
@@ -0,0 +1,39 @@
+
+USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
+       mortar random-weighted cfdg ;
+
+IN: cfdg.models.sierpinski
+
+: shape ( -- ) circle ;
+
+! : sierpinski ( -- )
+! iterate? [
+!   shape
+!   [ 0.6 s 5 r  0.2 b -1.5  y          0 x sierpinski ] do
+!   [ 0.6 s 5 r -0.2 b  0.75 y -1.2990375 x sierpinski ] do
+!   [ 0.6 s 5 r         0.75 y  1.2990375 x sierpinski ] do
+! ] when ;
+
+: sierpinski ( -- )
+iterate? [
+  shape
+  [ -1.5 y          0 x 0.6 s 5 r  0.2 b sierpinski ] do
+  [ 0.75 y -1.2990375 x 0.6 s 5 r -0.2 b sierpinski ] do
+  [ 0.75 y  1.2990375 x 0.6 s 5 r        sierpinski ] do
+] when ;
+
+: top ( -- ) [ -13.5 r 0.5 b sierpinski ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run ( -- )
+[ ] >background
+{ -4 8 -4 8 } viewport set
+0.01 >threshold
+[ top ] >start-shape
+cfdg-window ;
+
+MAIN: run
+
+
+
diff --git a/extra/cfdg/models/snowflake/snowflake.factor b/extra/cfdg/models/snowflake/snowflake.factor
new file mode 100644 (file)
index 0000000..42e0b3e
--- /dev/null
@@ -0,0 +1,35 @@
+
+USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
+       random-weighted cfdg ;
+
+IN: cfdg.models.snowflake
+
+: spike ( -- )
+iterate? [
+  { { 1    [ square
+            [ 0.95 y 0.97 s spike ] do ] }
+    { 0.03 [ square
+            [ 60 r spike ] do
+            [ -60 r spike ] do
+            [ 0.95 y 0.97 s spike ] do ] }
+  } random-weighted* call
+] when ;
+
+: snowflake ( -- )
+spike
+[ 60 r spike ] do
+[ 120 r spike ] do
+[ 180 r spike ] do
+[ 240 r spike ] do
+[ 300 r spike ] do ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: run ( -- )
+{ -40 80 -40 80 } viewport set
+0.1 threshold set
+[ snowflake ] start-shape set
+cfdg-window ;
+
+MAIN: run
+
diff --git a/extra/channels/authors.txt b/extra/channels/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/channels/channels-docs.factor b/extra/channels/channels-docs.factor
new file mode 100644 (file)
index 0000000..8487d59
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.syntax help.markup channels ;
+IN: channels
+
+HELP: <channel>
+{ $values { "channel" "a channel object" } 
+}
+{ $description "Create a channel that can be used for communicating between "
+"concurrent processes and threads. " { $link to } " and " { $link from }
+" can be used to send and receive data to/from the channel respectively. "
+"There can be multiple readers and writers on a channel. If there are "
+"multiple readers or writers, only one is selected at random to resume."
+}
+{ $see-also from to } ;
+
+HELP: to
+{ $values { "value" "an object" } 
+          { "channel" "a channel object" } 
+}
+{ $description "Sends an object to a channel. The send operation is synchronous."
+" It will block the calling thread until there is a receiver waiting "
+"for data on the channel. It will return when the receiver has received "
+"the data successfully." 
+}
+{ $see-also <channel> from } ;
+
+HELP: from
+{ $values  { "channel" "a channel object" } 
+           { "value" "an object" }
+}
+{ $description "Receives an object from a channel. The operation is synchronous."
+" It will block the calling thread until there is data in the channel." 
+}
+{ $see-also <channel> to } ;
diff --git a/extra/channels/channels-tests.factor b/extra/channels/channels-tests.factor
new file mode 100644 (file)
index 0000000..4b79f20
--- /dev/null
@@ -0,0 +1,48 @@
+! Copyright (C) 2005 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel tools.test math channels channels.private 
+sequences threads ;
+IN: temporary
+
+{ 3 t } [
+    V{ 1 2 3 4 } clone [ delete-random ] keep length swap integer?
+] unit-test
+
+{ V{ 10 } } [
+   V{ } clone <channel>
+   [ from swap push ] in-thread
+   10 swap to 
+] unit-test
+
+{ 20 } [
+   <channel>
+   [ 20 swap to ] in-thread
+   from 
+] unit-test
+
+{ V{ 1 2 3 4 } } [
+   V{ } clone <channel>
+   [ from swap push ] in-thread
+   [ from swap push ] in-thread
+   [ from swap push ] in-thread
+   [ from swap push ] in-thread
+   4 over to 
+   2 over to 
+   1 over to 
+   3 swap to 
+   [ <=> ] sort
+] unit-test
+
+{ V{ 1 2 4 9 } } [
+   V{ } clone <channel>
+   [ 4 swap to ] in-thread
+   [ 2 swap to ] in-thread
+   [ 1 swap to ] in-thread
+   [ 9 swap to ] in-thread
+   2dup from swap push 
+   2dup from swap push 
+   2dup from swap push 
+   dupd from swap push 
+   [ <=> ] sort
+] unit-test
diff --git a/extra/channels/channels.factor b/extra/channels/channels.factor
new file mode 100644 (file)
index 0000000..54f0d7d
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Channels - based on ideas from newsqueak
+USING: kernel sequences threads continuations random math ;
+IN: channels
+
+TUPLE: channel receivers senders ;
+
+: <channel> ( -- channel )
+    V{ } clone V{ } clone channel construct-boa ;
+
+GENERIC: to ( value channel -- )
+GENERIC: from ( channel -- value )
+
+<PRIVATE
+
+: delete-random ( seq -- value )
+    [ length random ] keep [ nth ] 2keep delete-nth ;
+
+: wait ( channel -- )
+    [ channel-senders push stop ] curry callcc0 ;
+
+: (to) ( value receivers -- )
+    delete-random schedule-thread-with yield ;
+
+: notify ( continuation channel -- channel )
+    [ channel-receivers push ] keep ;
+
+: (from) ( senders -- * )
+    delete-random continue ;
+
+PRIVATE>
+
+M: channel to ( value channel -- )
+    dup channel-receivers
+    dup empty? [ drop dup wait to ] [ nip (to) ] if ;
+
+M: channel from ( channel -- value )
+    [
+        notify channel-senders
+        dup empty? [ stop ] [ (from) ] if
+    ] curry callcc1 ;
diff --git a/extra/channels/examples/authors.txt b/extra/channels/examples/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/channels/examples/examples.factor b/extra/channels/examples/examples.factor
new file mode 100644 (file)
index 0000000..3c87680
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Examples of using channels
+USING: kernel concurrency channels math namespaces locals
+sequences ;
+IN: channels.examples
+
+: (counter) ( channel n -- )
+    [ swap to ] 2keep 1+ (counter) ;
+    
+: counter ( channel -- )
+    2 (counter) ;    
+
+: counter-test ( -- n1 n2 n3 )
+    <channel> [ counter ] spawn drop 
+    [ from ] keep [ from ] keep from ;
+
+: filter ( send prime recv -- )
+    #! Receives numbers from the 'send' channel,
+    #! filters out all those divisible by 'prime',
+    #! and sends to the 'recv' channel.
+    [
+        from swap dupd mod zero? not [ swap to ] [ 2drop ] if     
+    ] 3keep filter ;
+
+:: (sieve) | prime c |
+    [let | p [ c from ] 
+           newc [ <channel> ] |
+        p prime to
+        [ newc p c filter ] spawn drop
+        prime newc (sieve)
+    ] ;
+
+: sieve ( prime -- ) 
+    #! Send prime numbers to 'prime' channel
+    <channel> [ counter ] spawn drop
+    (sieve) ;
+
+: sieve-test ( -- seq )
+    <channel> [ sieve ] spawn drop
+    V{ } clone swap 
+    [ from swap push ] 2keep
+    [ from swap push ] 2keep
+    [ from swap push ] 2keep
+    [ from swap push ] 2keep
+    [ from swap push ] 2keep
+    [ from swap push ] 2keep
+    [ from swap push ] 2keep
+    [ from swap push ] 2keep
+    drop ;
diff --git a/extra/channels/examples/summary.txt b/extra/channels/examples/summary.txt
new file mode 100644 (file)
index 0000000..32f7e57
--- /dev/null
@@ -0,0 +1 @@
+Examples of using Channels
diff --git a/extra/channels/examples/tags.txt b/extra/channels/examples/tags.txt
new file mode 100644 (file)
index 0000000..1e107f5
--- /dev/null
@@ -0,0 +1 @@
+examples
diff --git a/extra/channels/remote/authors.txt b/extra/channels/remote/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/channels/remote/remote-docs.factor b/extra/channels/remote/remote-docs.factor
new file mode 100644 (file)
index 0000000..3cce6fd
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.syntax help.markup channels channels.remote concurrency.distributed ;
+IN: channels.remote
+
+HELP: <remote-channel>
+{ $values { "node" "a node object" }
+          { "id" "the id of the published channel on the node" } 
+}
+{ $description "Create a remote channel that acts as a proxy for a "
+"channel on another node. The remote node's channel must have been "
+"published using " { $link publish } " and the id should be the id "
+"returned by " { $link publish }
+}
+{ $examples 
+  { $example "\"localhost\" 9000 <node> \"ID123456\" <remote-channel> \"foo\" over to" }
+}
+{ $see-also publish unpublish } ;
+
+HELP: unpublish
+{ $values { "id" "a string" }
+}
+{ $description "Stop a previously published channel from being "
+"accessible by remote nodes."
+}
+{ $examples 
+  { $example "<channel> publish unpublish" }
+}
+{ $see-also <remote-channel> publish } ;
+
+HELP: publish
+{ $values { "channel" "a channel object" }
+          { "id" "a string" }
+}
+{ $description "Make a channel accessible via remote Factor nodes. "
+"An id is returned that can be used by another node to use " 
+{ $link to } " and " { $link from } " to access the channel."
+}
+{ $examples 
+  { $example "<channel> publish" }
+}
+{ $see-also <remote-channel> unpublish } ;
+
+ARTICLE: { "remote-channels" "remote-channels" } "Remote Channels"
+"Remote channels are channels that can be accessed by other Factor instances. It uses distributed concurrency to serialize and send data between channels."
+$nl
+"To start a remote node, distributed concurrency must have been started. This can be done using " { $link start-node } "."
+$nl
+{ $snippet "\"myhost.com\" 9001 start-node" } 
+$nl
+"Once the node is started, channels can be published using " { $link publish }
+" to be accessed remotely. " { $link publish } " returns an id which a remote node "
+"needs to know to access the channel."
+$nl
+{ $snippet "channel [ from . ] spawn drop dup publish" }
+$nl
+"Given the id from the snippet above, a remote node can put items in the channel."
+$nl
+{ $snippet "\"myhost.com\" 9001 <node> \"ID123456\" <remote-channel>\n\"hello\" over to" } 
+;
+
+ABOUT: { "remote-channels" "remote-channels" }
\ No newline at end of file
diff --git a/extra/channels/remote/remote-tests.factor b/extra/channels/remote/remote-tests.factor
new file mode 100644 (file)
index 0000000..939b051
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (C) 2005 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel tools.test math assocs channels channels.remote ;
+IN: temporary
+
+{ t } [
+    remote-channels assoc?
+] unit-test
+
+{ t f } [
+    <channel> publish [
+        get-channel channel?
+    ] keep 
+    [ unpublish ] keep
+    get-channel
+] unit-test
+
diff --git a/extra/channels/remote/remote.factor b/extra/channels/remote/remote.factor
new file mode 100644 (file)
index 0000000..5d62d17
--- /dev/null
@@ -0,0 +1,64 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Remote Channels
+USING: kernel init namespaces assocs arrays 
+sequences channels match concurrency concurrency.distributed ;
+IN: channels.remote
+
+<PRIVATE
+
+: remote-channels ( -- hash )
+    \ remote-channels get-global ;
+PRIVATE>
+
+: publish ( channel -- id )
+    random-64 dup >r remote-channels set-at r> ;
+
+: get-channel ( id -- channel )
+    remote-channels at ;
+
+: unpublish ( id -- )
+    remote-channels delete-at ;
+    
+<PRIVATE
+
+MATCH-VARS: ?id ?value ;
+
+SYMBOL: no-channel
+
+: channel-process ( -- )
+    receive
+    {
+        { { ?from ?tag { to ?id ?value  } }
+          [ ?value ?id get-channel [ to f ] [ no-channel ] if* ?tag swap 2array ?from send ] }
+        { { ?from ?tag { from ?id  } }
+          [ ?id get-channel [ from ] [ no-channel ] if* ?tag swap 2array ?from send ] }
+    } match-cond 
+    channel-process ;
+
+PRIVATE>
+
+: start-channel-node ( -- )
+    "remote-channels" get-process [ 
+      [ channel-process ] spawn "remote-channels" swap register-process 
+    ] unless ;
+
+TUPLE: remote-channel node id ;
+
+C: <remote-channel> remote-channel 
+
+M: remote-channel to ( value remote-channel -- )
+    dup >r [ \ to , remote-channel-id , , ] { } make r>
+    remote-channel-node "remote-channels" <remote-process> 
+    send-synchronous no-channel = [ no-channel throw ] when ;
+
+M: remote-channel from ( remote-channel -- value )
+    dup >r [ \ from , remote-channel-id , ] { } make r>
+    remote-channel-node "remote-channels" <remote-process> 
+    send-synchronous dup no-channel = [ no-channel throw ] when* ;
+
+[
+    H{ } clone \ remote-channels set-global
+    start-channel-node
+] "channel-registry" add-init-hook
diff --git a/extra/channels/remote/summary.txt b/extra/channels/remote/summary.txt
new file mode 100644 (file)
index 0000000..b2d6285
--- /dev/null
@@ -0,0 +1 @@
+Distributed Channels
diff --git a/extra/channels/remote/tags.txt b/extra/channels/remote/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/channels/sniffer/bsd/bsd.factor b/extra/channels/sniffer/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..dd72279
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Wrap a sniffer in a channel
+USING: kernel channels channels.sniffer concurrency io
+io.sniffer io.sniffer.bsd ;
+
+M: unix-io sniff-channel ( -- channel ) 
+  "/dev/bpf0" "en1" <sniffer-spec> <sniffer> <channel> [
+   (sniff-channel) 
+  ] spawn drop nip ;
+
diff --git a/extra/channels/sniffer/sniffer.factor b/extra/channels/sniffer/sniffer.factor
new file mode 100644 (file)
index 0000000..7c97c2e
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Wrap a sniffer in a channel
+USING: kernel channels concurrency io io.backend
+io.sniffer system ;
+
+: (sniff-channel) ( stream channel -- ) 
+  4096 pick stream-read-partial over to (sniff-channel) ;
+
+HOOK: sniff-channel io-backend ( -- channel ) 
+
+USE-IF: bsd? channels.sniffer.bsd
+
diff --git a/extra/channels/summary.txt b/extra/channels/summary.txt
new file mode 100644 (file)
index 0000000..62971c1
--- /dev/null
@@ -0,0 +1 @@
+Communicating Sequential Processes
diff --git a/extra/channels/tags.txt b/extra/channels/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/circular/authors.txt b/extra/circular/authors.txt
new file mode 100644 (file)
index 0000000..39c1f37
--- /dev/null
@@ -0,0 +1,2 @@
+Alex Chapman
+Daniel Ehrenberg
diff --git a/extra/circular/circular-tests.factor b/extra/circular/circular-tests.factor
new file mode 100644 (file)
index 0000000..01504a0
--- /dev/null
@@ -0,0 +1,27 @@
+! Copyright (C) 2005, 2006 Alex Chapman, Daniel Ehrenberg
+! See http;//factorcode.org/license.txt for BSD license
+USING: arrays kernel tools.test sequences sequences.private
+circular strings ;
+
+[ 0 ] [ { 0 1 2 3 4 } <circular> 0 swap virtual@ drop ] unit-test
+[ 2 ] [ { 0 1 2 3 4 } <circular> 2 swap virtual@ drop ] unit-test
+
+[ CHAR: t ] [ "test" <circular> 0 swap nth ] unit-test
+[ "test"  ] [ "test" <circular> >string ] unit-test
+
+[ "test" <circular> 5 swap nth ] unit-test-fails
+[ CHAR: e ] [ "test" <circular> 5 swap nth-unsafe ] unit-test
+[ [ 1 2 3 ] ] [ { 1 2 3 } <circular> [ ] like ] unit-test
+[ [ 2 3 1 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start [ ] like ] unit-test
+[ [ 3 1 2 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start 1 over change-circular-start [ ] like ] unit-test
+[ [ 3 1 2 ] ] [ { 1 2 3 } <circular> -100 over change-circular-start [ ] like ] unit-test
+
+[ "fob" ] [ "foo" <circular> CHAR: b 2 pick set-nth >string ] unit-test
+[ "foo" <circular> CHAR: b 3 rot set-nth ] unit-test-fails
+[ "boo" ] [ "foo" <circular> CHAR: b 3 pick set-nth-unsafe >string ] unit-test
+[ "ornact" ] [ "factor" <circular> 4 over change-circular-start CHAR: n 2 pick set-nth >string ] unit-test
+
+[ "bcd" ] [ 3 <circular-string> "abcd" [ over push-circular ] each >string ] unit-test
+
+[ { 0 0 } ] [ { 0 0 } <circular> -1 over change-circular-start >array ] unit-test
diff --git a/extra/circular/circular.factor b/extra/circular/circular.factor
new file mode 100644 (file)
index 0000000..8760e26
--- /dev/null
@@ -0,0 +1,37 @@
+! Copyright (C) 2005, 2006 Alex Chapman, Daniel Ehrenberg
+! See http;//factorcode.org/license.txt for BSD license
+USING: kernel sequences math sequences.private strings ;
+IN: circular
+
+! a circular sequence wraps another sequence, but begins at an
+! arbitrary element in the underlying sequence.
+TUPLE: circular seq start ;
+
+: <circular> ( seq -- circular )
+    0 circular construct-boa ;
+
+: circular-wrap ( n circular -- n circular )
+    [ circular-start + ] keep
+    [ circular-seq length rem ] keep ; inline
+
+M: circular length circular-seq length ;
+
+M: circular virtual@ circular-wrap circular-seq ;
+
+M: circular nth bounds-check virtual@ nth ;
+
+M: circular set-nth bounds-check virtual@ set-nth ;
+
+: change-circular-start ( n circular -- )
+    #! change start to (start + n) mod length
+    circular-wrap set-circular-start ;
+
+: push-circular ( elt circular -- )
+    [ set-first ] keep 1 swap change-circular-start ;
+
+: <circular-string> ( n -- circular )
+    0 <string> <circular> ;
+
+M: circular virtual-seq circular-seq ;
+
+INSTANCE: circular virtual-sequence
diff --git a/extra/circular/summary.txt b/extra/circular/summary.txt
new file mode 100644 (file)
index 0000000..bf95b90
--- /dev/null
@@ -0,0 +1 @@
+Virtual sequence presenting a rotation of an underlying sequence
diff --git a/extra/circular/tags.txt b/extra/circular/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/cocoa/application/application-docs.factor b/extra/cocoa/application/application-docs.factor
new file mode 100644 (file)
index 0000000..edca5ca
--- /dev/null
@@ -0,0 +1,45 @@
+USING: cocoa.application debugger quotations help.markup
+help.syntax strings alien core-foundation ;
+
+HELP: with-autorelease-pool
+{ $values { "quot" quotation } }
+{ $description "Sets up a new " { $snippet "NSAutoreleasePool"  } ", calls the quotation and frees the pool." } ;
+
+HELP: NSApp
+{ $values { "app" "an " { $snippet "NSApplication" } } }
+{ $description "Pushes the current " { $snippet "NSApplication" } " singleton." } ;
+
+HELP: with-cocoa
+{ $values { "quot" quotation } }
+{ $description "Sets up an autorelease pool, initializes the " { $snippet "NSApplication" } " singleton, and calls the quotation." } ;
+
+HELP: do-events
+{ $values { "app" "an " { $snippet "NSApplication" } } }
+{ $description "Processes any pending events in the queue. Does not block." } ;
+
+HELP: add-observer
+{ $values { "observer" "an " { $snippet "NSObject" } } { "selector" string } { "name" "an " { $snippet "NSString" } } { "object" "an " { $snippet "NSObject" } } }
+{ $description "Registers an observer with the " { $snippet "NSNotificationCenter" } " singleton." } ;
+
+HELP: remove-observer
+{ $values { "observer" "an " { $snippet "NSObject" } } }
+{ $description "Unregisters an observer from the " { $snippet "NSNotificationCenter" } " singleton." } ;
+
+HELP: install-delegate
+{ $values { "receiver" "an " { $snippet "NSObject" } } { "delegate" "an Objective C class" } }
+{ $description "Sets the receiver's delegate to a new instance of the delegate class." } ;
+
+HELP: objc-error
+{ $error-description "Thrown by the Objective C runtime when an error occurs, for example, sending a message to an object with an unrecognized selector." } ;
+
+ARTICLE: "cocoa-application-utils" "Cocoa application utilities"
+{ $subsection NSApp }
+{ $subsection with-autorelease-pool }
+{ $subsection with-cocoa }
+{ $subsection do-events }
+{ $subsection add-observer }
+{ $subsection remove-observer }
+{ $subsection install-delegate } ;
+
+IN: cocoa.application
+ABOUT: "cocoa-application-utils"
diff --git a/extra/cocoa/application/application.factor b/extra/cocoa/application/application.factor
new file mode 100644 (file)
index 0000000..43df84f
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien io kernel namespaces core-foundation cocoa.messages
+cocoa cocoa.classes cocoa.runtime sequences threads debugger
+init inspector kernel.private ;
+IN: cocoa.application
+
+: NSApplicationDelegateReplySuccess 0 ;
+: NSApplicationDelegateReplyCancel  1 ;
+: NSApplicationDelegateReplyFailure 2 ;
+
+: with-autorelease-pool ( quot -- )
+    NSAutoreleasePool -> new slip -> release ; inline
+
+: NSApp ( -- app ) NSApplication -> sharedApplication ;
+
+: with-cocoa ( quot -- )
+    [ NSApp drop call ] with-autorelease-pool ;
+
+: CFRunLoopDefaultMode "kCFRunLoopDefaultMode" <NSString> ;
+
+: next-event ( app -- event )
+    0 f CFRunLoopDefaultMode 1
+    -> nextEventMatchingMask:untilDate:inMode:dequeue: ;
+
+: do-event ( app -- ? )
+    dup next-event [ -> sendEvent: t ] [ drop f ] if* ;
+
+: do-events ( app -- )
+    dup do-event [ do-events ] [ drop ] if ;
+
+: add-observer ( observer selector name object -- )
+    >r >r >r >r NSNotificationCenter -> defaultCenter
+    r> r> sel_registerName
+    r> r> -> addObserver:selector:name:object: ;
+
+: remove-observer ( observer -- )
+    >r NSNotificationCenter -> defaultCenter r>
+    -> removeObserver: ;
+
+: finish-launching ( -- ) NSApp -> finishLaunching ;
+
+: install-delegate ( receiver delegate -- )
+    -> alloc -> init -> setDelegate: ;
+
+TUPLE: objc-error alien reason ;
+
+: objc-error ( alien -- * )
+    dup -> reason CF>string \ objc-error construct-boa throw ;
+
+M: objc-error summary ( error -- )
+    drop "Objective C exception" ;
+
+[ [ objc-error ] 19 setenv ] "cocoa.application" add-init-hook
+
+: running.app? ( -- ? )
+    #! Test if we're running a .app.
+    ".app"
+    NSBundle -> mainBundle -> bundlePath CF>string
+    subseq? ;
+
+: assert.app ( message -- )
+    running.app? [
+        drop
+    ] [
+        "The " swap " requires you to run Factor from an application bundle."
+        3append throw
+    ] if ;
diff --git a/extra/cocoa/application/authors.txt b/extra/cocoa/application/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/application/summary.txt b/extra/cocoa/application/summary.txt
new file mode 100644 (file)
index 0000000..9ed3953
--- /dev/null
@@ -0,0 +1 @@
+NSApplication-related utilities
diff --git a/extra/cocoa/authors.txt b/extra/cocoa/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/callbacks/authors.txt b/extra/cocoa/callbacks/authors.txt
new file mode 100644 (file)
index 0000000..3021230
--- /dev/null
@@ -0,0 +1 @@
+Kevin P. Reid
diff --git a/extra/cocoa/callbacks/callbacks.factor b/extra/cocoa/callbacks/callbacks.factor
new file mode 100644 (file)
index 0000000..4ed9d7d
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2005, 2006 Kevin Reid.
+! See http://factorcode.org/license.txt for BSD license.
+IN: cocoa.callbacks
+USING: assocs kernel namespaces cocoa cocoa.classes
+cocoa.subclassing debugger ;
+
+SYMBOL: callbacks
+
+: reset-callbacks ( -- )
+    H{ } clone callbacks set-global ;
+
+reset-callbacks
+
+CLASS: {
+    { +name+ "FactorCallback" }
+    { +superclass+ "NSObject" }
+}
+
+{ "perform:" "void" { "id" "SEL" "id" }
+    [ 2drop callbacks get at try ]
+}
+
+{ "dealloc" "void" { "id" "SEL" }
+    [
+        drop
+        dup callbacks get delete-at
+        SUPER-> dealloc
+    ]
+} ;
+
+: <FactorCallback> ( quot -- id )
+    FactorCallback -> alloc -> init
+    [ callbacks get set-at ] keep ;
diff --git a/extra/cocoa/callbacks/summary.txt b/extra/cocoa/callbacks/summary.txt
new file mode 100644 (file)
index 0000000..0e0fad5
--- /dev/null
@@ -0,0 +1 @@
+Allows you to use Factor quotations as Cocoa actions
diff --git a/extra/cocoa/cocoa-docs.factor b/extra/cocoa/cocoa-docs.factor
new file mode 100644 (file)
index 0000000..b2da1c9
--- /dev/null
@@ -0,0 +1,43 @@
+USING: cocoa cocoa.messages help.markup help.syntax strings
+alien core-foundation ;
+
+HELP: ->
+{ $syntax "-> selector" }
+{ $values { "selector" "an Objective C method name" } }
+{ $description "A sugared form of the following:" }
+{ $code "\"selector\" send" } ;
+
+HELP: SUPER->
+{ $syntax "-> selector" }
+{ $values { "selector" "an Objective C method name" } }
+{ $description "A sugared form of the following:" }
+{ $code "\"selector\" send-super" } ;
+
+{ send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words
+
+HELP: <NSString>
+{ $values { "str" string } { "alien" alien } }
+{ $description "Allocates an autoreleased " { $snippet "CFString" } "." } ;
+
+{ <NSString> <CFString> CF>string } related-words
+
+HELP: <NSArray>
+{ $values { "seq" "a sequence of " { $link alien } " instances" } { "alien" alien } }
+{ $description "Allocates an autoreleased " { $snippet "CFArray" } "." } ;
+
+{ <NSArray> <CFArray> } related-words
+
+ARTICLE: "objc-calling" "Calling Objective C code"
+"Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed."
+{ $subsection import-objc-class }
+"Every imported Objective C class has as corresponding class word in the " { $vocab-link "objc-classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked."
+$nl
+"Messages can be sent to classes and instances using a pair of parsing words:"
+{ $subsection POSTPONE: -> }
+{ $subsection POSTPONE: SUPER-> }
+"These parsing words are actually syntax sugar for a pair of ordinary words; they can be used instead of the parsing words if the selector name is dynamically computed:"
+{ $subsection send }
+{ $subsection super-send } ;
+
+IN: cocoa
+ABOUT: "objc-calling"
diff --git a/extra/cocoa/cocoa-tests.factor b/extra/cocoa/cocoa-tests.factor
new file mode 100644 (file)
index 0000000..03e3ebe
--- /dev/null
@@ -0,0 +1,50 @@
+IN: temporary
+USING: cocoa cocoa.messages cocoa.subclassing cocoa.types
+compiler kernel namespaces cocoa.classes tools.test memory ;
+
+CLASS: {
+    { +superclass+ "NSObject" }
+    { +name+ "Foo" }
+} {
+    "foo:"
+    "void"
+    { "id" "SEL" "NSRect" }
+    [ data-gc "x" set 2drop ]
+} ;
+
+recompile
+
+: test-foo
+    Foo -> alloc -> init
+    dup 1.0 2.0 101.0 102.0 <NSRect> -> foo:
+    -> release ;
+
+test-foo
+
+[ 1 ] [ "x" get NSRect-x ] unit-test
+[ 2 ] [ "x" get NSRect-y ] unit-test
+[ 101 ] [ "x" get NSRect-w ] unit-test
+[ 102 ] [ "x" get NSRect-h ] unit-test
+
+CLASS: {
+    { +superclass+ "NSObject" }
+    { +name+ "Bar" }
+} {
+    "bar"
+    "NSRect"
+    { "id" "SEL" }
+    [ 2drop test-foo "x" get ]
+} ;
+
+recompile
+
+Bar [
+    -> alloc -> init
+    dup -> bar "x" set
+    -> release
+] compile-1
+
+[ 1 ] [ "x" get NSRect-x ] unit-test
+[ 2 ] [ "x" get NSRect-y ] unit-test
+[ 101 ] [ "x" get NSRect-w ] unit-test
+[ 102 ] [ "x" get NSRect-h ] unit-test
diff --git a/extra/cocoa/cocoa.factor b/extra/cocoa/cocoa.factor
new file mode 100644 (file)
index 0000000..ddfb601
--- /dev/null
@@ -0,0 +1,67 @@
+! Copyright (C) 2006 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: compiler io kernel cocoa.runtime cocoa.subclassing
+cocoa.messages cocoa.types sequences words vocabs parser
+core-foundation namespaces assocs hashtables ;
+IN: cocoa
+
+: (remember-send) ( selector variable -- )
+    global [ dupd ?set-at ] change-at ;
+
+SYMBOL: sent-messages
+
+: remember-send ( selector -- )
+    sent-messages (remember-send) ;
+
+: ->
+    scan dup remember-send parsed \ send parsed ;
+    parsing
+
+SYMBOL: super-sent-messages
+
+: remember-super-send ( selector -- )
+    super-sent-messages (remember-send) ;
+
+: SUPER->
+    scan dup remember-super-send parsed \ super-send parsed ;
+    parsing
+
+"Compiling Objective C bridge..." print
+
+"cocoa.classes" create-vocab drop
+
+{
+    "cocoa" "cocoa.runtime" "cocoa.messages" "cocoa.subclassing"
+} compile-vocabs
+
+"Importing Cocoa classes..." print
+{
+    "NSApplication"
+    "NSArray"
+    "NSAutoreleasePool"
+    "NSBundle"
+    "NSError"
+    "NSEvent"
+    "NSException"
+    "NSMenu"
+    "NSMenuItem"
+    "NSNib"
+    "NSNotification"
+    "NSNotificationCenter"
+    "NSObject"
+    "NSOpenGLContext"
+    "NSOpenGLPixelFormat"
+    "NSOpenGLView"
+    "NSOpenPanel"
+    "NSPasteboard"
+    "NSResponder"
+    "NSSavePanel"
+    "NSView"
+    "NSWindow"
+} [
+    f import-objc-class
+] each
+
+: <NSString> ( str -- alien ) <CFString> -> autorelease ;
+
+: <NSArray> ( seq -- alien ) <CFArray> -> autorelease ;
diff --git a/extra/cocoa/dialogs/authors.txt b/extra/cocoa/dialogs/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/dialogs/dialogs-docs.factor b/extra/cocoa/dialogs/dialogs-docs.factor
new file mode 100644 (file)
index 0000000..5f14282
--- /dev/null
@@ -0,0 +1,28 @@
+USING: cocoa.dialogs help.markup help.syntax ;
+
+HELP: <NSOpenPanel>
+{ $values { "panel" "an " { $snippet "NSOpenPanel" } } }
+{ $description "Creates a new " { $snippet "NSOpenPanel" } "." } ;
+
+HELP: <NSSavePanel>
+{ $values { "panel" "an " { $snippet "NSSavePanel" } } }
+{ $description "Creates a new " { $snippet "NSSavePanel" } "." } ;
+
+HELP: open-panel
+{ $values { "paths" "a sequence of pathname strings" } }
+{ $description "Displays a file open panel, and outputs a sequence of selected pathnames." } ;
+
+HELP: save-panel
+{ $values { "path" "a pathname string, or " { $link f } } { "paths" "a sequence of pathname strings" } }
+{ $description "Displays a file save panel, and outputs the selected path, or " { $link f } " if the user cancelled the operation." } ;
+
+ARTICLE: "cocoa-dialogs" "Cocoa file dialogs"
+"Open dialogs:"
+{ $subsection <NSOpenPanel> }
+{ $subsection open-panel }
+"Save dialogs:"
+{ $subsection <NSSavePanel> }
+{ $subsection save-panel } ;
+
+IN: cocoa.dialogs
+ABOUT: "cocoa-dialogs"
diff --git a/extra/cocoa/dialogs/dialogs.factor b/extra/cocoa/dialogs/dialogs.factor
new file mode 100644 (file)
index 0000000..ea77c49
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel cocoa cocoa.messages cocoa.classes
+cocoa.application sequences splitting core-foundation ;
+IN: cocoa.dialogs
+
+: <NSOpenPanel> ( -- panel )
+    NSOpenPanel -> openPanel
+    dup 1 -> setCanChooseFiles:
+    dup 0 -> setCanChooseDirectories:
+    dup 1 -> setResolvesAliases:
+    dup 1 -> setAllowsMultipleSelection: ;
+
+: <NSSavePanel> ( -- panel )
+    NSSavePanel -> savePanel
+    dup 1 -> setCanChooseFiles:
+    dup 0 -> setCanChooseDirectories:
+    dup 0 -> setAllowsMultipleSelection: ;
+
+: NSOKButton 1 ;
+: NSCancelButton 0 ;
+
+: open-panel ( -- paths )
+    <NSOpenPanel>
+    dup -> runModal NSOKButton =
+    [ -> filenames CF>string-array ] [ drop f ] if ;
+
+: split-path ( path -- dir file )
+    "/" last-split1 [ <NSString> ] 2apply ;
+
+: save-panel ( path -- paths )
+    <NSSavePanel> dup
+    rot split-path -> runModalForDirectory:file: NSOKButton =
+    [ -> filename CF>string ] [ drop f ] if ;
diff --git a/extra/cocoa/dialogs/summary.txt b/extra/cocoa/dialogs/summary.txt
new file mode 100644 (file)
index 0000000..9cf98b5
--- /dev/null
@@ -0,0 +1 @@
+NSOpenPanel/NSSavePanel utilities
diff --git a/extra/cocoa/messages/authors.txt b/extra/cocoa/messages/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/messages/messages-docs.factor b/extra/cocoa/messages/messages-docs.factor
new file mode 100644 (file)
index 0000000..6a36ee7
--- /dev/null
@@ -0,0 +1,42 @@
+USING: cocoa.messages help.markup help.syntax strings alien ;
+
+HELP: send
+{ $values { "args..." "method arguments" } { "receiver" alien } { "selector" string } { "return..." "value returned by method, if any" } }
+{ $description "Sends an Objective C message named by " { $snippet "selector" } " to " { $snippet "receiver" } ". The arguments must be on the stack in left-to-right order." }
+{ $errors "Throws an error if the receiver does not recognize the message, or if the arguments have inappropriate types." }
+{ $notes "This word uses a special fast code path if " { $snippet "selector" } " is a literal and the word containing the call to " { $link send } " is compiled." } ;
+
+HELP: super-send
+{ $values { "args..." "method arguments" } { "receiver" alien } { "selector" string } { "return..." "value returned by method, if any" } }
+{ $description "Sends an Objective C message named by " { $snippet "selector" } " to the super class of " { $snippet "receiver" } ". Otherwise behaves identically to " { $link send } "." } ;
+
+HELP: objc-class
+{ $values { "string" string } { "class" alien } }
+{ $description "Outputs the Objective C class named by " { $snippet "string" } ". This class can then be used as the receiver in message sends calling class methods, for example:"
+{ $code "NSMutableArray -> alloc" } }
+{ $errors "Throws an error if there is no class named by " { $snippet "string" } "." } ;
+
+HELP: objc-meta-class
+{ $values { "string" string } { "class" alien } }
+{ $description "Outputs the meta class of the Objective C class named by " { $snippet "string" } "." }
+{ $errors "Throws an error if there is no meta class named by " { $snippet "string" } "." } ;
+
+HELP: objc>alien-types
+{ $var-description "Hashtable mapping Objective C type identifiers to alien types. See " { $link "c-data" } "." } ;
+
+HELP: alien>objc-types
+{ $var-description "Hashtable mapping alien types to Objective C type identifiers. See " { $link "c-data" } "." } ;
+
+{ objc>alien-types alien>objc-types } related-words
+
+HELP: import-objc-class
+{ $values { "name" string } { "quot" "a quotation with stack effect " { $snippet "( -- )" } } }
+{ $description "If a class named " { $snippet "name" } " is already known to the Objective C interface, does nothing. Otherwise, first calls the quotation. The quotation should make the class available to the Objective C runtime if necessary, either by loading a framework or defining it directly. After the quotation returns, this word makes the class available to Factor programs by importing methods and creating a class word the class object in the " { $vocab-link "cocoa.classes" } " vocabulary." }
+{ $notes "In most cases, the quotation should be " { $link f } "." }
+{ $examples
+    { $code "\"QTMovie\" f import-objc-class" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" }
+} ;
+
+HELP: root-class
+{ $values { "class" alien } { "root" alien } }
+{ $description "Outputs the class at the root of the inheritance hierarchy for " { $snippet "class" } ". In most cases this will be the " { $snippet "NSObject" } " class." } ;
diff --git a/extra/cocoa/messages/messages.factor b/extra/cocoa/messages/messages.factor
new file mode 100644 (file)
index 0000000..5276e15
--- /dev/null
@@ -0,0 +1,212 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.compiler
+arrays assocs combinators compiler inference.transforms kernel
+math namespaces parser prettyprint prettyprint.sections
+quotations sequences strings words cocoa.runtime io macros ;
+IN: cocoa.messages
+
+: make-sender ( method function -- quot )
+    [ over first , f , , second , \ alien-invoke , ] [ ] make ;
+
+: sender-stub-name ( method function -- string )
+    [ % "_" % unparse % ] "" make ;
+
+: sender-stub ( method function -- word )
+    [ sender-stub-name f <word> dup ] 2keep
+    over first large-struct? [ "_stret" append ] when
+    make-sender define-compound dup compile ;
+
+SYMBOL: message-senders
+SYMBOL: super-message-senders
+
+global [
+    message-senders [ H{ } assoc-like ] change
+    super-message-senders [ H{ } assoc-like ] change
+] bind
+
+: cache-stub ( method function hash -- )
+    [
+        over get [ 2drop ] [ over >r sender-stub r> set ] if
+    ] bind ;
+
+: cache-stubs ( method -- )
+    dup
+    "objc_msgSendSuper" super-message-senders get cache-stub
+    "objc_msgSend" message-senders get cache-stub ;
+
+: <super> ( receiver -- super )
+    "objc-super" <c-object> [
+        >r dup objc-object-isa objc-class-super-class r>
+        set-objc-super-class
+    ] keep
+    [ set-objc-super-receiver ] keep ;
+
+TUPLE: selector name object ;
+
+: <selector> ( name -- sel ) f \ selector construct-boa ;
+
+: selector ( selector -- alien )
+    dup selector-object expired? [
+        dup selector-name sel_registerName
+        dup rot set-selector-object
+    ] [
+        selector-object
+    ] if ;
+
+SYMBOL: selectors
+
+H{ } clone selectors set-global
+
+: cache-selector ( string -- selector )
+    selectors get-global [ <selector> ] cache ;
+
+SYMBOL: objc-methods
+
+H{ } clone objc-methods set-global
+
+: lookup-method ( selector -- method )
+    dup objc-methods get at
+    [ ] [ "No such method: " swap append throw ] ?if ;
+
+: make-prepare-send ( selector method super? -- quot )
+    [
+        [ \ <super> , ] when
+        swap cache-selector , \ selector ,
+    ] [ ] make
+    swap second length 2 - make-dip ;
+
+MACRO: (send) ( selector super? -- quot )
+    [
+        >r dup lookup-method r>
+        [ make-prepare-send % ] 2keep
+        super-message-senders message-senders ? get at ,
+    ] [ ] make ;
+
+: send ( args... receiver selector -- return... ) f (send) ; inline
+
+\ send soft "break-after" set-word-prop
+
+: super-send ( args... receiver selector -- return... ) t (send) ; inline
+
+\ super-send soft "break-after" set-word-prop
+
+! Runtime introspection
+: (objc-class) ( string word -- class )
+    dupd execute
+    [ ] [ "No such class: " swap append throw ] ?if ; inline
+
+: objc-class ( string -- class )
+    \ objc_getClass (objc-class) ;
+
+: objc-protocol ( string -- class )
+    \ objc_getProtocol (objc-class) ;
+
+: objc-meta-class ( string -- class )
+    \ objc_getMetaClass (objc-class) ;
+
+: method-arg-type ( method i -- type )
+    f <void*> 0 <int> over
+    >r method_getArgumentInfo drop
+    r> *char* ;
+
+SYMBOL: objc>alien-types
+
+H{
+    { "c" "char" }
+    { "i" "int" }
+    { "s" "short" }
+    { "l" "long" }
+    { "q" "longlong" }
+    { "C" "uchar" }
+    { "I" "uint" }
+    { "S" "ushort" }
+    { "L" "ulong" }
+    { "Q" "ulonglong" }
+    { "f" "float" }
+    { "d" "double" }
+    { "B" "bool" }
+    { "v" "void" }
+    { "*" "char*" }
+    { "@" "id" }
+    { "#" "id" }
+    { ":" "SEL" }
+} objc>alien-types set-global
+
+! The transpose of the above map
+SYMBOL: alien>objc-types
+
+objc>alien-types get [ swap ] assoc-map
+! A hack...
+H{
+    { "NSPoint" "{_NSPoint=ff}" }
+    { "NSRect" "{_NSRect=ffff}" }
+    { "NSSize" "{_NSSize=ff}" }
+    { "NSRange" "{_NSRange=II}" }
+} union alien>objc-types set-global
+
+: objc-struct-type ( i string -- ctype )
+    2dup CHAR: = -rot index* swap subseq
+    dup c-types get key? [
+        "Warning: no such C type: " write dup print
+        drop "void*"
+    ] unless ;
+
+: (parse-objc-type) ( i string -- ctype )
+    2dup nth >r >r 1+ r> r> {
+        { [ dup "rnNoORV" member? ] [ drop (parse-objc-type) ] }
+        { [ dup CHAR: ^ = ] [ 3drop "void*" ] }
+        { [ dup CHAR: { = ] [ drop objc-struct-type ] }
+        { [ dup CHAR: [ = ] [ 3drop "void*" ] }
+        { [ t ] [ 2nip 1string objc>alien-types get at ] }
+    } cond ;
+
+: parse-objc-type ( string -- ctype ) 0 swap (parse-objc-type) ;
+
+: method-arg-types ( method -- args )
+    dup method_getNumberOfArguments
+    [ method-arg-type parse-objc-type ] curry* map ;
+
+: method-return-type ( method -- ctype )
+    #! Undocumented hack! Apple does not support this feature!
+    objc-method-types parse-objc-type ;
+
+: register-objc-method ( method -- )
+    dup method-return-type over method-arg-types 2array
+    dup cache-stubs
+    swap objc-method-name sel_getName
+    objc-methods get set-at ;
+
+: method-list@ ( ptr -- ptr )
+    "objc-method-list" heap-size swap <displaced-alien> ;
+
+: (register-objc-methods) ( objc-class iterator -- )
+    2dup class_nextMethodList [
+        dup objc-method-list-count swap method-list@ [
+            objc-method-nth register-objc-method
+        ] curry each (register-objc-methods)
+    ] [
+        2drop
+    ] if* ;
+
+: register-objc-methods ( class -- )
+    f <void*> (register-objc-methods) ;
+
+: class-exists? ( string -- class ) objc_getClass >boolean ;
+
+: unless-defined ( class quot -- )
+    >r class-exists? r> unless ; inline
+
+: define-objc-class-word ( name quot -- )
+    [
+        over , , \ unless-defined , dup , \ objc-class ,
+    ] [ ] make >r "cocoa.classes" create r> define-compound ;
+
+: import-objc-class ( name quot -- )
+    2dup unless-defined
+    dupd define-objc-class-word
+    dup objc-class register-objc-methods
+    objc-meta-class register-objc-methods ;
+
+: root-class ( class -- root )
+    dup objc-class-super-class [ root-class ] [ ] ?if ;
diff --git a/extra/cocoa/messages/summary.txt b/extra/cocoa/messages/summary.txt
new file mode 100644 (file)
index 0000000..a9e2c98
--- /dev/null
@@ -0,0 +1 @@
+Support and syntax for Objective C message sending
diff --git a/extra/cocoa/nibs/authors.txt b/extra/cocoa/nibs/authors.txt
new file mode 100644 (file)
index 0000000..5645cd9
--- /dev/null
@@ -0,0 +1 @@
+Matthew Willis
diff --git a/extra/cocoa/nibs/nibs-docs.factor b/extra/cocoa/nibs/nibs-docs.factor
new file mode 100644 (file)
index 0000000..a697201
--- /dev/null
@@ -0,0 +1,15 @@
+USING: help.markup help.syntax cocoa.nibs strings ;
+
+HELP: load-nib
+{ $values { "name" string } }
+{ $description "Loads an Interface Builder " { $snippet ".nib" } " file with the given name." } ;
+
+HELP: nib-named
+{ $values { "nib-name" string } { "anNSNib" "an instance of NSNib" } }
+{ $description "Looks up the " { $snippet ".nib" } " in the main bundle with the given name, instantiating an autoreleased NSNib object.  Useful when combined with the " { $link nib-objects } " word. " { $snippet "f" } " is returned in case of error." } 
+{ $see-also nib-objects } ;
+
+HELP: nib-objects
+{ $values { "anNSNib" "an instance of NSNib" } { "objects/f" "a sequence" } }
+{ $description "Instantiates the top-level objects of the " { $snippet ".nib" } " file loaded by anNSNib.  First create an NSNib instance using " { $link nib-named } "." } 
+{ $see-also nib-named } ;
\ No newline at end of file
diff --git a/extra/cocoa/nibs/nibs.factor b/extra/cocoa/nibs/nibs.factor
new file mode 100644 (file)
index 0000000..31dac25
--- /dev/null
@@ -0,0 +1,16 @@
+USING: cocoa.application cocoa.messages cocoa.classes cocoa.runtime 
+kernel cocoa core-foundation alien.c-types ;
+IN: cocoa.nibs
+
+: load-nib ( name -- )
+    NSBundle
+    swap <NSString> NSApp -> loadNibNamed:owner:
+    drop ;
+
+: nib-named ( nib-name -- anNSNib )
+    <NSString> NSNib -> alloc swap f -> initWithNibNamed:bundle:
+    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
diff --git a/extra/cocoa/nibs/summary.txt b/extra/cocoa/nibs/summary.txt
new file mode 100644 (file)
index 0000000..85b9b69
--- /dev/null
@@ -0,0 +1 @@
+Cocoa NSNib and .nib-related handy words
diff --git a/extra/cocoa/pasteboard/authors.txt b/extra/cocoa/pasteboard/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/pasteboard/pasteboard-docs.factor b/extra/cocoa/pasteboard/pasteboard-docs.factor
new file mode 100644 (file)
index 0000000..afd5ea2
--- /dev/null
@@ -0,0 +1,21 @@
+USING: cocoa.pasteboard help.markup help.syntax strings ;
+
+HELP: pasteboard-string?
+{ $values { "pasteboard" "an " { $snippet "NSPasteBoard" } } { "?" "a boolean" } }
+{ $description "Tests if the pasteboard holds a string." } ;
+
+HELP: pasteboard-string
+{ $values { "pasteboard" "an " { $snippet "NSPasteBoard" } } { "str" string } }
+{ $description "Outputs the contents of the pasteboard." } ;
+
+HELP: set-pasteboard-string
+{ $values { "str" string } { "pasteboard" "an " { $snippet "NSPasteBoard" } } }
+{ $description "Sets the contents of the pasteboard." } ;
+
+ARTICLE: "cocoa-pasteboard-utils" "Cocoa pasteboard utilities"
+{ $subsection pasteboard-string? }
+{ $subsection pasteboard-string }
+{ $subsection set-pasteboard-string } ;
+
+IN: cocoa.pasteboard
+ABOUT: "cocoa-pasteboard-utils"
diff --git a/extra/cocoa/pasteboard/pasteboard.factor b/extra/cocoa/pasteboard/pasteboard.factor
new file mode 100644 (file)
index 0000000..58cbc88
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types arrays kernel cocoa.messages
+cocoa.classes cocoa.application cocoa core-foundation
+sequences ;
+IN: cocoa.pasteboard
+
+: NSStringPboardType "NSStringPboardType" ;
+
+: pasteboard-string? ( pasteboard -- ? )
+    NSStringPboardType swap -> types CF>string-array member? ;
+
+: pasteboard-string ( pasteboard -- str )
+    NSStringPboardType <NSString> -> stringForType:
+    dup [ CF>string ] when ;
+
+: set-pasteboard-types ( seq pasteboard -- )
+    swap <NSArray> f -> declareTypes:owner: drop ;
+
+: set-pasteboard-string ( str pasteboard -- )
+    NSStringPboardType <NSString>
+    dup 1array pick set-pasteboard-types
+    >r swap <NSString> r> -> setString:forType: drop ;
+
+: pasteboard-error ( error -- f )
+    "Pasteboard does not hold a string" <NSString>
+    0 swap rot set-void*-nth f ;
+
+: ?pasteboard-string ( pboard error -- str/f )
+    over pasteboard-string? [
+        swap pasteboard-string [ ] [ pasteboard-error ] ?if
+    ] [
+        nip pasteboard-error
+    ] if ;
diff --git a/extra/cocoa/pasteboard/summary.txt b/extra/cocoa/pasteboard/summary.txt
new file mode 100644 (file)
index 0000000..7258ac2
--- /dev/null
@@ -0,0 +1 @@
+NSPasteboard utilities
diff --git a/extra/cocoa/plists/plists.factor b/extra/cocoa/plists/plists.factor
new file mode 100644 (file)
index 0000000..32b35e9
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: strings arrays hashtables assocs sequences
+xml.writer xml.utilities kernel namespaces ;
+
+GENERIC: >plist ( obj -- tag )
+
+M: string >plist "string" build-tag ;
+
+M: array >plist
+    [ >plist ] map "array" build-tag* ;
+
+M: hashtable >plist
+    >alist [ >r "key" build-tag r> >plist ] assoc-map concat
+    "dict" build-tag* ;
+
+: build-plist ( obj -- tag )
+    >plist 1array "plist" build-tag*
+    dup { { "version" "1.0" } } update ;
+
+: print-plist ( obj -- )
+    build-plist build-xml print-xml ;
diff --git a/extra/cocoa/runtime/authors.txt b/extra/cocoa/runtime/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/runtime/runtime.factor b/extra/cocoa/runtime/runtime.factor
new file mode 100644 (file)
index 0000000..7bfc31b
--- /dev/null
@@ -0,0 +1,87 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: cocoa.runtime
+
+TYPEDEF: void* SEL
+
+TYPEDEF: void* id
+
+FUNCTION: char* sel_getName ( SEL aSelector ) ;
+
+FUNCTION: bool sel_isMapped ( SEL aSelector ) ;
+
+FUNCTION: SEL sel_registerName ( char* str ) ;
+
+C-STRUCT: objc-super
+    { "id" "receiver" }
+    { "void*" "class" } ;
+
+: CLS_CLASS        HEX: 1   ;
+: CLS_META         HEX: 2   ;
+: CLS_INITIALIZED  HEX: 4   ;
+: CLS_POSING       HEX: 8   ;
+: CLS_MAPPED       HEX: 10  ;
+: CLS_FLUSH_CACHE  HEX: 20  ;
+: CLS_GROW_CACHE   HEX: 40  ;
+: CLS_NEED_BIND    HEX: 80  ;
+: CLS_METHOD_ARRAY HEX: 100 ;
+
+C-STRUCT: objc-class
+    { "void*" "isa" }
+    { "void*" "super-class" }
+    { "char*" "name" }
+    { "long" "version" }
+    { "long" "info" }
+    { "long" "instance-size" }
+    { "void*" "ivars" }
+    { "void*" "methodLists" }
+    { "void*" "cache" }
+    { "void*" "protocols" } ;
+
+C-STRUCT: objc-object
+    { "objc-class*" "isa" } ;
+
+FUNCTION: int objc_getClassList ( void* buffer, int bufferLen ) ;
+
+FUNCTION: objc-class* objc_getClass ( char* class ) ;
+
+FUNCTION: objc-class* objc_getMetaClass ( char* class ) ;
+
+FUNCTION: objc-class* objc_getProtocol ( char* class ) ;
+
+FUNCTION: void objc_addClass ( objc-class* class ) ;
+
+FUNCTION: id class_createInstance ( objc-class* class, uint additionalByteCount ) ;
+
+FUNCTION: id class_createInstanceFromZone ( objc-class* class, uint additionalByteCount, void* zone ) ;
+
+C-STRUCT: objc-method
+    { "SEL" "name" }
+    { "char*" "types" }
+    { "void*" "imp" } ;
+
+FUNCTION: objc-method* class_getInstanceMethod ( objc-class* class, SEL selector ) ;
+
+FUNCTION: objc-method* class_getClassMethod ( objc-class* class, SEL selector ) ;
+
+C-STRUCT: objc-method-list
+    { "void*" "obsolete" }
+    { "int" "count" } ;
+
+FUNCTION: objc-method-list* class_nextMethodList ( objc-class* class, void** iterator ) ;
+
+FUNCTION: void class_addMethods ( objc-class* class, objc-method-list* methodList ) ;
+
+FUNCTION: void class_removeMethods ( objc-class* class, objc-method-list* methodList ) ;
+
+FUNCTION: uint method_getNumberOfArguments ( objc-method* method ) ;
+
+FUNCTION: uint method_getSizeOfArguments ( objc-method* method ) ;
+
+FUNCTION: uint method_getArgumentInfo ( objc-method* method, int argIndex, char** type, int* offset ) ;
+
+C-STRUCT: objc-protocol-list
+    { "void*" "next" }
+    { "int" "count" }
+    { "objc-class*" "class" } ;
diff --git a/extra/cocoa/runtime/summary.txt b/extra/cocoa/runtime/summary.txt
new file mode 100644 (file)
index 0000000..eb8c0fd
--- /dev/null
@@ -0,0 +1 @@
+Low-level Objective C runtime binding
diff --git a/extra/cocoa/subclassing/authors.txt b/extra/cocoa/subclassing/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/subclassing/subclassing-docs.factor b/extra/cocoa/subclassing/subclassing-docs.factor
new file mode 100644 (file)
index 0000000..b3c22b1
--- /dev/null
@@ -0,0 +1,46 @@
+USING: cocoa.subclassing help.markup help.syntax strings alien
+hashtables ;
+
+HELP: define-objc-class
+{ $values { "hash" hashtable } { "imeth" "a sequence of instance method definitions" } }
+{ $description "Defines a new Objective C class. The hashtable can contain the following keys:"
+    { $list
+        { { $link +name+ } " - a string naming the new class. Required." }
+        { { $link +superclass+ } " - a string naming the superclass. Required." }
+        { { $link +protocols+ } " - an array of strings naming protocols implemented by the superclass. Optional." }
+    }
+"Every element of " { $snippet "imeth" } " defines an instance method, and is an array having the shape "
+{ $snippet "{ name return args quot }" }
+".:"
+{ $table
+    { "name" { "a selector name" } }
+    { "name" { "a C type name; see " { $link "c-data" } } }
+    { "args" { "a sequence of C type names; see " { $link "c-data" } } }
+    { "quot" { "a quotation to be run as a callback when the method is invoked; see " { $link alien-callback } } }
+}
+"The quotation is run with the following values on the stack:"
+{ $list
+    { "the receiver of the message; an " { $link alien } " pointing to an instance of this class" }
+    { "the selector naming the message; in most cases this value can be ignored" }
+    "arguments passed to the message, if any"
+}
+"There is no way to define instance variables or class methods using this mechanism. However, instance variables can be simulated by using the receiver to key into a hashtable." } ;
+
+HELP: CLASS:
+{ $syntax "CLASS: spec imeth... ;" }
+{ $values { "spec" "an array of pairs" } { "name" "a new class name" } { "imeth" "instance method definitions" } }
+{ $description "A sugared form of the following:"
+    { $code "{ imeth... } \"spec\" define-objc-class" }
+"This word is preferred to calling " { $link define-objc-class } ", because it creates a class word in the " { $vocab-link "cocoa.classes" } " vocabulary at parse time, allowing code to refer to the class word in the same source file where the class is defined." } ;
+
+{ define-objc-class POSTPONE: CLASS: } related-words
+
+ARTICLE: "objc-subclassing" "Subclassing Objective C classes"
+"Objective C classes can be subclassed, with new methods defined in Factor, using a parsing word:"
+{ $subsection POSTPONE: CLASS: }
+"This word is actually syntax sugar for an ordinary word:"
+{ $subsection define-objc-class }
+"Objective C class definitions are saved in the image. If the image is saved and Factor is restarted with the saved image, custom class definitions are made available to the Objective C runtime when they are first accessed from within Factor." ;
+
+IN: cocoa.subclassing
+ABOUT: "objc-subclassing"
diff --git a/extra/cocoa/subclassing/subclassing.factor b/extra/cocoa/subclassing/subclassing.factor
new file mode 100644 (file)
index 0000000..9cc8709
--- /dev/null
@@ -0,0 +1,117 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types arrays assocs combinators compiler
+hashtables kernel libc math namespaces parser sequences words
+cocoa.messages cocoa.runtime ;
+IN: cocoa.subclassing
+
+: init-method ( method alien -- )
+    >r first3 r>
+    [ >r execute r> set-objc-method-imp ] keep
+    [ >r malloc-char-string r> set-objc-method-types ] keep
+    >r sel_registerName r> set-objc-method-name ;
+
+: <empty-method-list> ( n -- alien )
+    "objc-method-list" heap-size
+    "objc-method" heap-size pick * + 1 calloc
+    [ set-objc-method-list-count ] keep ;
+
+: <method-list> ( methods -- alien )
+    dup length dup <empty-method-list> -rot
+    [ pick method-list@ objc-method-nth init-method ] 2each ;
+
+: define-objc-methods ( class methods -- )
+    <method-list> class_addMethods ;
+
+: <objc-class> ( name info -- class )
+    "objc-class" malloc-object
+    [ set-objc-class-info ] keep
+    [ >r malloc-char-string r> set-objc-class-name ] keep ;
+
+: <protocol-list> ( name -- protocol-list )
+    "objc-protocol-list" malloc-object
+    1 over set-objc-protocol-list-count
+    swap objc-protocol over set-objc-protocol-list-class ;
+
+! The Objective C object model is a bit funny.
+! Every class has a metaclass.
+
+! The superclass of the metaclass of X is the metaclass of the
+! superclass of X.
+
+! The metaclass of the metaclass of X is the metaclass of the
+! root class of X.
+: meta-meta-class ( class -- class ) root-class objc-class-isa ;
+
+: copy-instance-size ( class -- )
+    dup objc-class-super-class objc-class-instance-size
+    swap set-objc-class-instance-size ;
+
+: <meta-class> ( superclass name -- class )
+    CLS_META <objc-class>
+    [ >r dup objc-class-isa r> set-objc-class-super-class ] keep
+    [ >r meta-meta-class r> set-objc-class-isa ] keep
+    dup copy-instance-size ;
+
+: set-protocols ( protocols class -- )
+    swap {
+        { [ dup empty? ] [ 2drop ] }
+        { [ dup length 1 = ] [
+            first <protocol-list>
+            swap set-objc-class-protocols
+        ] }
+    } cond ;
+
+: <new-class> ( protocols metaclass superclass name -- class )
+    CLS_CLASS <objc-class>
+    [ set-objc-class-super-class ] keep
+    [ set-objc-class-isa ] keep
+    [ set-protocols ] keep
+    dup copy-instance-size ;
+
+: (define-objc-class) ( protocols superclass name imeth -- )
+    >r
+    >r objc-class r>
+    [ <meta-class> ] 2keep <new-class> dup objc_addClass
+    r> <method-list> class_addMethods ;
+
+: encode-types ( return types -- encoding )
+    swap add* [
+        alien>objc-types get at "0" append
+    ] map concat ;
+
+: prepare-method ( ret types quot -- type imp )
+    >r [ encode-types ] 2keep r> [
+        "cdecl" swap 4array % \ alien-callback ,
+    ] [ ] make compile-quot ;
+
+: prepare-methods ( methods -- methods )
+    [ first4 prepare-method 3array ] map ;
+
+: redefine-objc-methods ( imeth name -- )
+    dup class-exists? [
+        objc_getClass swap define-objc-methods
+    ] [
+        2drop
+    ] if ;
+
+SYMBOL: +name+
+SYMBOL: +protocols+
+SYMBOL: +superclass+
+
+: define-objc-class ( imeth hash -- )
+    clone [
+        prepare-methods
+        +name+ get 2dup redefine-objc-methods swap [
+            +protocols+ get , +superclass+ get , +name+ get , ,
+            \ (define-objc-class) ,
+        ] [ ] make import-objc-class
+    ] bind ;
+
+: define-objc-class-early ( hash -- )
+    +name+ swap at "cocoa.classes" create drop ;
+
+: CLASS:
+    parse-definition unclip >r parsed r>
+    >hashtable dup define-objc-class-early parsed
+    \ define-objc-class parsed ; parsing
diff --git a/extra/cocoa/subclassing/summary.txt b/extra/cocoa/subclassing/summary.txt
new file mode 100644 (file)
index 0000000..7b64e70
--- /dev/null
@@ -0,0 +1 @@
+Support and syntax for Objective C subclassing
diff --git a/extra/cocoa/summary.txt b/extra/cocoa/summary.txt
new file mode 100644 (file)
index 0000000..35c51fb
--- /dev/null
@@ -0,0 +1 @@
+Objective C/Cocoa bridge
diff --git a/extra/cocoa/tags.txt b/extra/cocoa/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/cocoa/types/authors.txt b/extra/cocoa/types/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/types/summary.txt b/extra/cocoa/types/summary.txt
new file mode 100644 (file)
index 0000000..2e3f7b2
--- /dev/null
@@ -0,0 +1 @@
+NSPoint, NSRect, and other simple Cocoa types
diff --git a/extra/cocoa/types/types-docs.factor b/extra/cocoa/types/types-docs.factor
new file mode 100644 (file)
index 0000000..7f53d5f
--- /dev/null
@@ -0,0 +1,28 @@
+USING: cocoa.types math help.markup help.syntax ;
+
+HELP: <NSRect>
+{ $values { "x" real } { "y" real } { "w" real } { "h" real } { "rect" "an " { $snippet "NSRect" } } }
+{ $description "Allocates a new " { $snippet "NSRect" } " in the Factor heap." } ;
+
+HELP: <NSPoint>
+{ $values { "x" real } { "y" real } { "point" "an " { $snippet "NSPoint" } } }
+{ $description "Allocates a new " { $snippet "NSPoint" } " in the Factor heap." } ;
+
+HELP: <NSSize>
+{ $values { "w" real } { "h" real } { "size" "an " { $snippet "NSSize" } } }
+{ $description "Allocates a new " { $snippet "NSSize" } " in the Factor heap." } ;
+
+ARTICLE: "cocoa-types" "Cocoa types"
+"The Cocoa binding defines some common C structs:"
+{ $code
+    "NSRect"
+    "NSPoint"
+    "NSSize"
+}
+"Some words for working with the above:"
+{ $subsection <NSRect> }
+{ $subsection <NSPoint> }
+{ $subsection <NSSize> } ;
+
+IN: cocoa.types
+ABOUT: "cocoa-types"
diff --git a/extra/cocoa/types/types.factor b/extra/cocoa/types/types.factor
new file mode 100644 (file)
index 0000000..7d21687
--- /dev/null
@@ -0,0 +1,66 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.syntax kernel ;
+IN: cocoa.types
+
+C-STRUCT: NSRect
+    { "float" "x" }
+    { "float" "y" }
+    { "float" "w" }
+    { "float" "h" } ;
+
+TYPEDEF: NSRect _NSRect
+TYPEDEF: NSRect CGRect
+
+: <NSRect> ( x y w h -- rect )
+    "NSRect" <c-object>
+    [ set-NSRect-h ] keep
+    [ set-NSRect-w ] keep
+    [ set-NSRect-y ] keep
+    [ set-NSRect-x ] keep ;
+
+: NSRect-x-y ( alien -- origin-x origin-y )
+    [ NSRect-x ] keep NSRect-y ;
+
+C-STRUCT: NSPoint
+    { "float" "x" }
+    { "float" "y" } ;
+
+TYPEDEF: NSPoint _NSPoint
+TYPEDEF: NSPoint CGPoint
+
+: <NSPoint> ( x y -- point )
+    "NSPoint" <c-object>
+    [ set-NSPoint-y ] keep
+    [ set-NSPoint-x ] keep ;
+
+C-STRUCT: NSSize
+    { "float" "w" }
+    { "float" "h" } ;
+
+TYPEDEF: NSSize _NSSize
+TYPEDEF: NSPoint CGPoint
+
+: <NSSize> ( w h -- size )
+    "NSSize" <c-object>
+    [ set-NSSize-h ] keep
+    [ set-NSSize-w ] keep ;
+
+C-STRUCT: NSRange
+    { "uint" "location" }
+    { "uint" "length" } ;
+
+TYPEDEF: NSRange _NSRange
+
+: <NSRange> ( length location -- size )
+    "NSRange" <c-object>
+    [ set-NSRange-length ] keep
+    [ set-NSRange-location ] keep ;
+
+C-STRUCT: CGAffineTransform
+    { "float" "a" }
+    { "float" "b" }
+    { "float" "c" }
+    { "float" "d" }
+    { "float" "tx" }
+    { "float" "ty" } ;
diff --git a/extra/cocoa/views/authors.txt b/extra/cocoa/views/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/views/summary.txt b/extra/cocoa/views/summary.txt
new file mode 100644 (file)
index 0000000..fefe67a
--- /dev/null
@@ -0,0 +1 @@
+NSView and NSOpenGLView utilities
diff --git a/extra/cocoa/views/views-docs.factor b/extra/cocoa/views/views-docs.factor
new file mode 100644 (file)
index 0000000..7e84400
--- /dev/null
@@ -0,0 +1,26 @@
+USING: cocoa.views help.syntax help.markup ;
+
+HELP: <PixelFormat>
+{ $values { "pixelfmt" "an " { $snippet "NSOpenGLPixelFormat" } } }
+{ $description "Creates an " { $snippet "NSOpenGLPixelFormat" } " with some reasonable defaults." } ;
+
+HELP: <GLView>
+{ $values { "class" "an subclass of " { $snippet "NSOpenGLView" } } { "dim" "a pair of real numbers" } { "view" "a new " { $snippet "NSOpenGLView" } } }
+{ $description "Creates a new instance of the specified class, giving it a default pixel format and the given size." } ;
+
+HELP: view-dim
+{ $values { "view" "an " { $snippet "NSView" } } { "dim" "a pair of real numbers" } }
+{ $description "Outputs the dimensions of the given view." } ;
+
+HELP: mouse-location
+{ $values { "view" "an " { $snippet "NSView" } } { "event" "an " { $snippet "NSEvent" } } { "loc" "a pair of real numbers" } }
+{ $description "Outputs the current mouse location." } ;
+
+ARTICLE: "cocoa-view-utils" "Cocoa view utilities"
+{ $subsection <PixelFormat> }
+{ $subsection <GLView> }
+{ $subsection view-dim }
+{ $subsection mouse-location } ;
+
+IN: cocoa.views
+ABOUT: "cocoa-view-utils"
diff --git a/extra/cocoa/views/views.factor b/extra/cocoa/views/views.factor
new file mode 100644 (file)
index 0000000..cc948df
--- /dev/null
@@ -0,0 +1,63 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types arrays kernel math namespaces cocoa
+cocoa.messages cocoa.classes cocoa.types sequences ;
+IN: cocoa.views
+
+: NSOpenGLPFAAllRenderers 1 ;
+: NSOpenGLPFADoubleBuffer 5 ;
+: NSOpenGLPFAStereo 6 ;
+: NSOpenGLPFAAuxBuffers 7 ;
+: NSOpenGLPFAColorSize 8 ;
+: NSOpenGLPFAAlphaSize 11 ;
+: NSOpenGLPFADepthSize 12 ;
+: NSOpenGLPFAStencilSize 13 ;
+: NSOpenGLPFAAccumSize 14 ;
+: NSOpenGLPFAMinimumPolicy 51 ;
+: NSOpenGLPFAMaximumPolicy 52 ;
+: NSOpenGLPFAOffScreen 53 ;
+: NSOpenGLPFAFullScreen 54 ;
+: NSOpenGLPFASampleBuffers 55 ;
+: NSOpenGLPFASamples 56 ;
+: NSOpenGLPFAAuxDepthStencil 57 ;
+: NSOpenGLPFARendererID 70 ;
+: NSOpenGLPFASingleRenderer 71 ;
+: NSOpenGLPFANoRecovery 72 ;
+: NSOpenGLPFAAccelerated 73 ;
+: NSOpenGLPFAClosestPolicy 74 ;
+: NSOpenGLPFARobust 75 ;
+: NSOpenGLPFABackingStore 76 ;
+: NSOpenGLPFAMPSafe 78 ;
+: NSOpenGLPFAWindow 80 ;
+: NSOpenGLPFAMultiScreen 81 ;
+: NSOpenGLPFACompliant 83 ;
+: NSOpenGLPFAScreenMask 84 ;
+: NSOpenGLPFAPixelBuffer 90 ;
+: NSOpenGLPFAVirtualScreenCount 128 ;
+
+: <PixelFormat> ( -- pixelfmt )
+    NSOpenGLPixelFormat -> alloc [
+        NSOpenGLPFAWindow ,
+        NSOpenGLPFADoubleBuffer ,
+        NSOpenGLPFADepthSize , 16 ,
+        0 ,
+    ] { } make >c-int-array
+    -> initWithAttributes:
+    -> autorelease ;
+
+: <GLView> ( class dim -- view )
+    >r -> alloc 0 0 r> first2 <NSRect> <PixelFormat>
+    -> initWithFrame:pixelFormat:
+    dup 1 -> setPostsBoundsChangedNotifications:
+    dup 1 -> setPostsFrameChangedNotifications: ;
+
+: view-dim ( view -- dim )
+    -> bounds
+    dup NSRect-w >fixnum
+    swap NSRect-h >fixnum 2array ;
+
+: mouse-location ( view event -- loc )
+    over >r
+    -> locationInWindow f -> convertPoint:fromView:
+    dup NSPoint-x swap NSPoint-y
+    r> -> frame NSRect-h swap - 2array ;
diff --git a/extra/cocoa/windows/authors.txt b/extra/cocoa/windows/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/cocoa/windows/summary.txt b/extra/cocoa/windows/summary.txt
new file mode 100644 (file)
index 0000000..e7f63cb
--- /dev/null
@@ -0,0 +1 @@
+NSWindow utilities
diff --git a/extra/cocoa/windows/windows-docs.factor b/extra/cocoa/windows/windows-docs.factor
new file mode 100644 (file)
index 0000000..1cf49e3
--- /dev/null
@@ -0,0 +1,16 @@
+USING: cocoa.windows help.markup help.syntax ;
+
+HELP: <NSWindow>
+{ $values { "rect" "an " { $snippet "NSRect" } } { "window" "an " { $snippet "NSWindow" } } }
+{ $description "Creates a new " { $snippet "NSWindow" } " with the specified dimensions." } ;
+
+HELP: <ViewWindow>
+{ $values { "view" "an " { $snippet "NSView" } } { "rect" "an " { $snippet "NSRect" } } { "window" "an " { $snippet "NSWindow" } } }
+{ $description "Creates a new " { $snippet "NSWindow" } " with the specified dimensions, containing the given view." } ;
+
+ARTICLE: "cocoa-window-utils" "Cocoa window utilities"
+{ $subsection <NSWindow> }
+{ $subsection <ViewWindow> } ;
+
+IN: cocoa.windows
+ABOUT: "cocoa-window-utils"
diff --git a/extra/cocoa/windows/windows.factor b/extra/cocoa/windows/windows.factor
new file mode 100644 (file)
index 0000000..f1c66f5
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel math cocoa cocoa.messages cocoa.classes
+sequences ;
+IN: cocoa.windows
+
+: NSBorderlessWindowMask     0 ; inline
+: NSTitledWindowMask         1 ; inline
+: NSClosableWindowMask       2 ; inline
+: NSMiniaturizableWindowMask 4 ; inline
+: NSResizableWindowMask      8 ; inline
+
+: NSBackingStoreRetained    0 ; inline
+: NSBackingStoreNonretained 1 ; inline
+: NSBackingStoreBuffered    2 ; inline
+
+: standard-window-type
+    NSTitledWindowMask
+    NSClosableWindowMask bitor
+    NSMiniaturizableWindowMask bitor
+    NSResizableWindowMask bitor ; inline
+
+: <NSWindow> ( rect -- window )
+    NSWindow -> alloc swap
+    standard-window-type NSBackingStoreBuffered 1
+    -> initWithContentRect:styleMask:backing:defer: ;
+
+: <ViewWindow> ( view rect -- window )
+    <NSWindow> [ swap -> setContentView: ] keep
+    dup dup -> contentView -> setInitialFirstResponder:
+    dup 1 -> setAcceptsMouseMovedEvents: ;
+
+: window-content-rect ( window -- rect )
+    NSWindow over -> frame rot -> styleMask
+    -> contentRectForFrameRect:styleMask: ;
diff --git a/extra/color-picker/authors.txt b/extra/color-picker/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/color-picker/color-picker.factor b/extra/color-picker/color-picker.factor
new file mode 100644 (file)
index 0000000..7082afc
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math math.parser models sequences ui ui.gadgets
+ui.gadgets.controls ui.gadgets.frames ui.gadgets.labels
+ui.gadgets.packs ui.gadgets.sliders ui.render ;
+IN: color-picker
+
+! Simple example demonstrating the use of models.
+
+: <color-slider> ( model -- gadget )
+    <x-slider> 1 over set-slider-line ;
+
+: <color-preview> ( model -- gadget )
+    <gadget> { 100 100 } over set-rect-dim
+    [ set-gadget-interior ] <control> ;
+
+: <color-model> ( model -- model )
+    [ [ 256 /f ] map 1 add <solid> ] <filter> ;
+
+: <color-sliders> ( -- model gadget )
+    3 [ drop 0 0 0 255 <range> ] map
+    dup [ range-model ] map <compose>
+    swap [ [ <color-slider> gadget, ] each ] make-filled-pile ;
+
+: <color-picker> ( -- gadget )
+    [
+        <color-sliders> @top frame,
+        dup <color-model> <color-preview> @center frame,
+        [ [ truncate number>string ] map " " join ] <filter>
+        <label-control> @bottom frame,
+    ] make-frame ;
+
+: color-picker-window ( -- )
+    [ <color-picker> "Color Picker" open-window ] with-ui ;
+
+MAIN: color-picker-window
diff --git a/extra/color-picker/deploy.factor b/extra/color-picker/deploy.factor
new file mode 100644 (file)
index 0000000..f3426fb
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? t }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? t }
+    { "bundle-name" "Color Picker.app" }
+}
diff --git a/extra/color-picker/summary.txt b/extra/color-picker/summary.txt
new file mode 100644 (file)
index 0000000..040c7b5
--- /dev/null
@@ -0,0 +1 @@
+Color picker gadget demo
diff --git a/extra/color-picker/tags.txt b/extra/color-picker/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/colors/authors.txt b/extra/colors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/colors/colors.factor b/extra/colors/colors.factor
new file mode 100644 (file)
index 0000000..911f3d0
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: colors
+
+: black { 0.0 0.0 0.0 1.0 } ;
+: blue { 0.0 0.0 1.0 1.0 } ;
+: cyan { 0 0.941 0.941 1 } ;
+: gray { 0.6 0.6 0.6 1.0 } ;
+: green { 0.0 1.0 0.0 1.0 } ;
+: light-gray { 0.95 0.95 0.95 0.95 } ;
+: light-purple { 0.8 0.8 1.0 1.0 } ;
+: magenta { 0.941 0 0.941 1 } ;
+: orange  { 0.941 0.627 0 1 } ;
+: purple  { 0.627 0 0.941 1 } ;
+: red { 1.0 0.0 0.0 1.0 } ;
+: white { 1.0 1.0 1.0 1.0 } ;
+: yellow { 1.0 1.0 0.0 1.0 } ;
diff --git a/extra/colors/hsv/hsv.factor b/extra/colors/hsv/hsv.factor
new file mode 100644 (file)
index 0000000..88c8c2f
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences math ;
+IN: colors.hsv
+
+<PRIVATE
+
+: f_ >r swap rot >r 2dup r> 6 * r> - ;
+: p ( v s x -- v p x ) >r dupd neg 1 + * r> ;
+: q ( v s f -- q ) * neg 1 + * ;
+: t_ ( v s f -- t_ ) neg 1 + * neg 1 + * ;
+
+PRIVATE>
+
+: mod-cond ( p vector -- )
+    #! Call p mod q'th entry of the vector of quotations, where
+    #! q is the length of the vector. The value q remains on the
+    #! stack.
+    [ dupd length mod ] keep nth call ;
+
+: hsv>rgb ( h s v -- r g b )
+    pick 6 * >fixnum {
+        [ f_ t_ p swap     ] ! v p t
+        [ f_ q  p -rot     ] ! q v p
+        [ f_ t_ p swapd    ] ! p v t
+        [ f_ q  p rot      ] ! p q v
+        [ f_ t_ p swap rot ] ! t p v
+        [ f_ q  p          ] ! v p q
+    } mod-cond ;
diff --git a/extra/combinators/lib/lib-docs.factor b/extra/combinators/lib/lib-docs.factor
new file mode 100644 (file)
index 0000000..719af59
--- /dev/null
@@ -0,0 +1,99 @@
+USING: help.syntax help.markup kernel prettyprint sequences ;
+IN: combinators.lib
+
+HELP: generate
+{ $values { "generator" "a quotation" } { "predicate" "a quotation" } { "obj" "an object" } }
+{ $description "Loop until the generator quotation generates an object that satisfies predicate quotation." }
+{ $unchecked-example
+    "! Generate a random 20-bit prime number congruent to 3 (mod 4)"
+    "USE: math.miller-rabin"
+    "[ 20 random-prime ] [ 4 mod 3 = ] generate ."
+    "526367"
+} ;
+
+HELP: ndip
+{ $values { "quot" "a quotation" } { "n" "a number" } }
+{ $description "A generalisation of " { $link dip } " that can work " 
+"for any stack depth. The quotation will be called with a stack that "
+"has 'n' items removed first. The 'n' items are then put back on the "
+"stack. The quotation can consume and produce any number of items."
+} 
+{ $examples
+  { $example "USE: combinators.lib" "1 2 [ dup ] 1 ndip .s" "1\n1\n2" }
+  { $example "USE: combinators.lib" "1 2 3 [ drop ] 2 ndip .s" "2\n3" }
+}
+{ $see-also dip dipd } ;
+
+HELP: nslip
+{ $values { "n" "a number" } }
+{ $description "A generalisation of " { $link slip } " that can work " 
+"for any stack depth. The first " { $snippet "n" } " items after the quotation will be "
+"removed from the stack, the quotation called, and the items restored."
+} 
+{ $examples
+  { $example "USE: combinators.lib" "[ 99 ] 1 2 3 4 5 5 nslip .s" "99\n1\n2\n3\n4\n5" }
+}
+{ $see-also slip nkeep } ;
+
+HELP: nkeep
+{ $values { "quot" "a quotation" } { "n" "a number" } }
+{ $description "A generalisation of " { $link keep } " that can work " 
+"for any stack depth. The first " { $snippet "n" } " items after the quotation will be "
+"saved, the quotation called, and the items restored."
+} 
+{ $examples
+  { $example "USE: combinators.lib" "1 2 3 4 5 [ drop drop drop drop drop 99 ] 5 nkeep .s" "99\n1\n2\n3\n4\n5" }
+}
+{ $see-also keep nslip } ;
+
+HELP: map-withn
+{ $values { "seq" "a sequence" } { "quot" "a quotation" } { "n" "a number" } { "newseq" "a sequence" } }
+{ $description "A generalisation of " { $link map } ". The first " { $snippet "n" } " items after the quotation will be "
+"passed to the quotation given to map-withn for each element in the sequence."
+} 
+{ $examples
+  { $example "USE: combinators.lib" "1 2 3 4 { 6 7 8 9 10 } [ + + + + ] 4 map-withn .s" "{ 16 17 18 19 20 }" }
+}
+{ $see-also each-withn } ;
+
+HELP: each-withn
+{ $values { "seq" "a sequence" } { "quot" "a quotation" } { "n" "a number" } }
+{ $description "A generalisation of " { $link each } ". The first " { $snippet "n" } " items after the quotation will be "
+"passed to the quotation given to each-withn for each element in the sequence."
+} 
+{ $see-also map-withn } ;
+
+HELP: sigma
+{ $values { "seq" "a sequence" } { "quot" "a quotation" } }
+{ $description "Like map sum, but without creating an intermediate sequence." }
+{ $example
+    "! Find the sum of the squares [0,99]"
+    "USE: math.ranges"
+    "100 [1,b] [ sq ] sigma"
+    "338350"
+} ;
+
+HELP: count
+{ $values { "seq" "a sequence" } { "quot" "a quotation" } }
+{ $description "Efficiently returns the number of elements that the predicate quotation matches." }
+{ $example
+    "USE: math.ranges"
+    "100 [1,b] [ even? ] count ."
+    "50"
+} ;
+
+HELP: all-unique?
+{ $values { "seq" "a sequence" } { "?" "a boolean" } }
+{ $description "Tests whether a sequence contains any repeated elements." }
+{ $example
+    "{ 0 1 1 2 3 5 } all-unique? ."
+    "f"
+} ;
+
+HELP: &&
+{ $values { "quots" "a sequence of quotations with stack effect " { $snippet "( ... -- ... ? )" } } }
+{ $description "Calls each quotation in turn; outputs " { $link f } " if one of the quotations output " { $link f } ", otherwise outputs " { $link t } ". As soon as a quotation outputs " { $link f } ", evaluation stops and subsequent quotations are not called." } ;
+
+HELP: ||
+{ $values { "quots" "a sequence of quotations with stack effect " { $snippet "( ... -- ... ? )" } } }
+{ $description "Calls each quotation in turn; outputs " { $link t } " if one of the quotations output " { $link t } ", otherwise outputs " { $link f } ". As soon as a quotation outputs " { $link t } ", evaluation stops and subsequent quotations are not called." } ;
diff --git a/extra/combinators/lib/lib-tests.factor b/extra/combinators/lib/lib-tests.factor
new file mode 100644 (file)
index 0000000..aa7fc00
--- /dev/null
@@ -0,0 +1,59 @@
+USING: combinators.lib kernel math math.ranges random sequences
+tools.test ;
+IN: temporary
+
+[ 5 ] [ [ 10 random ] [ 5 = ] generate ] unit-test
+[ t ] [ [ 10 random ] [ even? ] generate even? ] unit-test
+[ 50 ] [ 100 [1,b] [ even? ] count ] unit-test
+[ 50 ] [ 100 [1,b] [ odd? ] count ] unit-test
+[ 328350 ] [ 100 [ sq ] sigma ] unit-test
+[ f ] [ { 0 1 1 2 3 5 } all-unique? ] unit-test
+[ t ] [ { 0 1 2 3 4 5 } all-unique? ] unit-test
+
+
+[ { 910 911 912 } ] [ 10 900 3 [ + + ] map-with2 ] unit-test
+{ 6 2 } [ 1 2 [ 5 + ] dip ] unit-test
+{ 6 2 1 } [ 1 2 1 [ 5 + ] dipd ] unit-test
+{ t } [ [ [ 99 ] 1 2 3 4 5 5 nslip ] compile-quot compiled? ] unit-test
+{ 99 1 2 3 4 5 } [ [ 99 ] 1 2 3 4 5 5 nslip ] unit-test
+{ t } [ [ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] compile-quot compiled? ] unit-test
+{ 2 1 2 3 4 5 } [ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] unit-test
+[ [ 1 2 3 + ] ] [ 1 2 3 [ + ] 3 ncurry ] unit-test
+{ t } [ [ 1 2 { 3 4 } [ + + ] 2 map-withn ] compile-quot compiled? ] unit-test
+{ { 6 7 } } [ 1 2 { 3 4 } [ + + ] 2 map-withn ] unit-test
+{ { 16 17 18 19 20 } } [ 1 2 3 4 { 6 7 8 9 10 } [ + + + + ] 4 map-withn ] unit-test
+{ t } [ [ 1 2 { 3 4 } [ + + drop ] 2 each-withn  ] compile-quot compiled? ] unit-test
+{ 13 } [ 1 2 { 3 4 } [ + + ] 2 each-withn + ] unit-test
+[ 1 1 2 2 3 3 ] [ 1 2 3 [ dup ] 3apply ] unit-test
+[ 1 4 9 ] [ 1 2 3 [ sq ] 3apply ] unit-test
+[ t ] [ [ [ sq ] 3apply ] compile-quot compiled? ] unit-test
+[ { 1 2 } { 2 4 } { 3 8 } { 4 16 } { 5 32 } ] [ 1 2 3 4 5 [ dup 2^ 2array ] 5 napply ] unit-test
+[ t ] [ [ [ dup 2^ 2array ] 5 napply ] compile-quot compiled? ] unit-test
+
+! &&
+
+[ t ] [
+    3 {
+        [ dup number? ] [ dup odd? ] [ dup 0 > ]
+    } && nip
+] unit-test
+
+[ f ] [
+    3 {
+        [ dup number? ] [ dup even? ] [ dup 0 > ]
+    } && nip
+] unit-test
+
+! ||
+
+[ t ] [
+    4 {
+        [ dup array? ] [ dup number? ] [ 3 throw ]
+    } || nip
+] unit-test
+
+[ f ] [
+    4 {
+        [ dup array? ] [ dup vector? ] [ dup float? ]
+    } || nip
+] unit-test
diff --git a/extra/combinators/lib/lib.factor b/extra/combinators/lib/lib.factor
new file mode 100644 (file)
index 0000000..1b69ae5
--- /dev/null
@@ -0,0 +1,184 @@
+! Copyright (C) 2007 Slava Pestov, Chris Double, Doug Coleman,
+!                    Eduardo Cavazos, Daniel Ehrenberg.
+! 
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel combinators namespaces quotations hashtables sequences assocs
+       arrays inference effects math math.ranges arrays.lib shuffle macros
+       bake ;
+
+IN: combinators.lib
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: generate ( generator predicate -- obj )
+    #! Call 'generator' until the result satisfies 'predicate'.
+    [ slip over slip ] 2keep
+    roll [ 2drop ] [ rot drop generate ] if ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! The cleaver family
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bi ( obj quot quot -- val val ) >r over slip r> call ; inline
+
+: tri ( obj quot quot quot -- val val val )
+  >r pick >r bi r> r> call ; inline
+
+: tetra ( obj quot quot quot quot -- val val val val )
+  >r >r pick >r bi r> r> r> bi ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! The spread family
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bi* ( obj obj quot quot -- val val ) >r swap >r call r> r> call ; inline
+
+: tri* ( obj obj obj quot quot quot -- val val val )
+  >r rot >r bi* r> r> call ; inline
+
+: tetra* ( obj obj obj obj quot quot quot quot -- val val val val )
+  >r roll >r tri* r> r> call ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Generalized versions of core combinators
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MACRO: ndip ( quot n -- ) dup saver -rot restorer 3append ;
+
+MACRO: nslip ( n -- ) dup saver [ call ] rot restorer 3append ;
+
+: 4slip ( quot a b c d -- a b c d ) 4 nslip ; inline
+
+MACRO: nkeep ( n -- )
+  [ ] [ 1+ ] [ ] tri
+  [ [ , ndup ] dip , -nrot , nslip ]
+  bake ;
+
+: 4keep ( w x y z quot -- w x y z ) 4 nkeep ; inline 
+
+MACRO: ncurry ( n -- ) [ curry ] n*quot ;
+
+MACRO: ncurry* ( quot n -- )
+  tuck 1+ dup
+  [ , -nrot [ , nrot , call ] , ncurry ]
+  bake ;
+
+MACRO: napply ( n -- )
+  2 [a,b]
+  [ [ ] [ 1- ] bi
+    [ , ntuck , nslip ]
+    bake ]
+  map concat >quotation [ call ] append ;
+
+: 3apply ( obj obj obj quot -- ) 3 napply ; inline
+
+: dipd ( x y quot -- y ) 2 ndip ; inline
+
+! each-with
+
+: each-withn ( seq quot n -- ) ncurry* each ; inline
+
+: each-with ( seq quot -- ) curry* each ; inline
+
+: each-with2 ( obj obj list quot -- ) 2 each-withn ; inline
+
+! map-with
+
+: map-withn ( seq quot n -- newseq ) ncurry* map ; inline
+
+: map-with ( seq quot -- ) curry* map ; inline
+
+: map-with2 ( obj obj list quot -- newseq ) 2 map-withn ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: sigma ( seq quot -- n ) [ rot slip + ] curry 0 swap reduce ;
+
+: count ( seq quot -- n ) [ 1 0 ? ] compose sigma ;
+
+: all-unique? ( seq -- ? ) [ prune ] keep [ length ] 2apply = ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! short circuiting words
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : short-circuit ( quots quot default -- quot )
+!   >r { } map>assoc <reversed> r>
+!   1quotation swap alist>quot ;
+
+: short-circuit ( quots quot default -- quot )
+  1quotation -rot { } map>assoc <reversed> alist>quot ;
+
+! : short-circuit ( quots quot default -- quot )
+!   1quotation -rot map>alist <reversed> alist>quot ;
+
+MACRO: && ( quots -- ? ) [ [ not ] append [ f ] ] t short-circuit ;
+
+MACRO: <-&& ( quots -- )
+  [ [ dup ] swap append [ not ] append [ f ] ] t short-circuit
+  [ nip ] append ;
+
+MACRO: <--&& ( quots -- )
+  [ [ 2dup ] swap append [ not ] append [ f ] ] t short-circuit
+  [ 2nip ] append ;
+
+MACRO: || ( quots -- ? ) [ [ t ] ] f short-circuit ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! ifte
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MACRO: ifte ( quot quot quot -- )
+  pick infer effect-in
+  dup 1+ swap
+  [ >r >r , nkeep , nrot r> r> if ]
+  bake ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! switch
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: preserving ( predicate -- quot )
+  dup infer effect-in
+  dup 1+ swap rot
+  [ , , nkeep , nrot ]
+  bake ;
+
+MACRO: switch ( quot -- )
+  [ [ preserving ] [ ] bi* ] assoc-map
+  [ , cond ]
+  bake ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Conceptual implementation:
+
+! : pcall ( seq quots -- seq ) [ call ] 2map ;
+
+MACRO: parallel-call ( quots -- )
+  [ [ unclip % r> dup >r push ] bake ] map concat
+  [ V{ } clone >r % drop r> >array ] bake ;
+
+! MACRO: parallel-call ( quots -- )
+!   [ [ unclip ] swap append ] map
+!   [ [ r> swap add >r ] append ] map
+!   concat
+!   [ { } >r ] swap append ! pre
+!   [ drop r> ] append ;   ! post
+
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! map-call and friends
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+MACRO: map-call-with ( quots -- )
+  [ [ [ keep ] curry ] map concat ] keep length [ nip narray ] curry compose ;
+
+MACRO: map-call-with2 ( quots -- )
+  dup >r
+  [ [ 2dup >r >r ] swap append [ r> r> ] append ] map concat
+  [ 2drop ] append
+  r> length [ narray ] curry append ;
+
+MACRO: map-exec-with ( words -- ) [ 1quotation ] map [ map-call-with ] curry ;
diff --git a/extra/concurrency/authors.txt b/extra/concurrency/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/concurrency/concurrency-docs.factor b/extra/concurrency/concurrency-docs.factor
new file mode 100644 (file)
index 0000000..cf09f3b
--- /dev/null
@@ -0,0 +1,171 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.syntax help.markup concurrency concurrency.private match ;
+IN: concurrency
+
+HELP: make-mailbox
+{ $values { "mailbox" "a mailbox object" } 
+}
+{ $description "A mailbox is an object that can be used for safe thread communication. Items can be put in the mailbox and retrieved in a FIFO order. If the mailbox is empty when a get operation is performed then the thread will block until another thread places something in the mailbox. If multiple threads are waiting on the same mailbox, only one of the waiting threads will be unblocked to process the get operation." } 
+{ $see-also mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
+
+HELP: mailbox-empty?
+{ $values { "mailbox" "a mailbox object" } 
+          { "bool" "a boolean value" }
+}
+{ $description "Return true if the mailbox is empty." } 
+{ $see-also make-mailbox mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
+
+HELP: mailbox-put
+{ $values { "obj" "an object" } 
+          { "mailbox" "a mailbox object" } 
+}
+{ $description "Put the object into the mailbox. Any threads that have a blocking get on the mailbox are resumed. Only one of those threads will successfully get the object, the rest will immediately block waiting for the next item in the mailbox." } 
+{ $see-also make-mailbox mailbox-empty? mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
+
+HELP: (mailbox-block-unless-pred)
+{ $values { "pred" "a quotation with stack effect " { $snippet "( X -- bool )" } } 
+          { "mailbox" "a mailbox object" } 
+         { "pred2" "same object as 'pred'" }
+         { "mailbox2" "same object as 'mailbox'" }
+}
+{ $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. The predicate must have stack effect " { $snippet "( X -- bool )" } "." } 
+{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
+
+HELP: (mailbox-block-if-empty)
+{ $values { "mailbox" "a mailbox object" } 
+         { "mailbox2" "same object as 'mailbox'" }
+}
+{ $description "Block the thread if the mailbox is empty." } 
+{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
+
+HELP: mailbox-get
+{ $values { "mailbox" "a mailbox object" } 
+         { "obj" "an object" }
+}
+{ $description "Get the first item put into the mailbox. If it is empty the thread blocks until an item is put into it. The thread then resumes, leaving the item on the stack." } 
+{ $see-also make-mailbox mailbox-empty? mailbox-put while-mailbox-empty mailbox-get-all mailbox-get? } ;
+
+HELP: mailbox-get-all
+{ $values { "mailbox" "a mailbox object" } 
+         { "array" "an array" }
+}
+{ $description "Blocks the thread if the mailbox is empty, otherwise removes all objects in the mailbox and returns an array containing the objects." } 
+{ $see-also make-mailbox mailbox-empty? mailbox-put while-mailbox-empty mailbox-get-all mailbox-get? } ;
+
+HELP: while-mailbox-empty
+{ $values { "mailbox" "a mailbox object" } 
+         { "quot" "a quotation with stack effect " { $snippet "( -- )" } }
+}
+{ $description "Repeatedly call the quotation while there are no items in the mailbox. Quotation should have stack effect " { $snippet "( -- )" } "." } 
+{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all mailbox-get? } ;
+
+HELP: mailbox-get?
+{ $values { "pred" "a quotation with stack effect " { $snippet "( X -- bool )" } }
+          { "mailbox" "a mailbox object" } 
+         { "obj" "an object" }
+}
+{ $description "Get the first item in the mailbox which satisfies the predicate. 'pred' will be called repeatedly for each item in the mailbox. When 'pred' returns true that item will be returned. If nothing in the mailbox satisfies the predicate then the thread will block until something does. 'pred' must have stack effect " { $snippet "( X -- bool }" } "." } 
+{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty } ;
+
+HELP: <process>
+{ $values { "links" "an array of processes" } 
+          { "pid" "the process id" } 
+          { "mailbox" "a mailbox object" } 
+}
+{ $description "Constructs a process object. A process is a lightweight thread with a mailbox that can be used to communicate with other processes. Each process has a unique process id." } 
+{ $see-also spawn send receive } ;
+
+HELP: self
+{ $values { "process" "a process object" } 
+}
+{ $description "Returns the currently running process object." } 
+{ $see-also <process> send receive receive-if } ;
+
+HELP: send
+{ $values { "message" "an object" } 
+          { "process" "a process object" } 
+}
+{ $description "Send the message to the process by placing it in the processes mailbox. This is an asynchronous operation and will return immediately. The receving process will act on the message the next time it retrieves that item from its mailbox (usually using the " { $link receive } " word. The message can be any Factor object. For destinations that are instances of remote-process the message must be a serializable Factor type." } 
+{ $see-also <process> receive receive-if } ;
+
+HELP: receive
+{ $values { "message" "an object" } 
+}
+{ $description "Return a message from the current processes mailbox. If the box is empty, suspend the process until another process places an item in the mailbox (usually via the " { $link send } " word." } 
+{ $see-also send receive-if } ;
+
+HELP: receive-if
+{ $values { "pred" "a predicate with stack effect " { $snippet "( X -- bool )" } }  
+          { "message" "an object" } 
+}
+{ $description "Return the first message from the current processes mailbox that satisfies the predicate. To satisfy the predicate, 'pred' is called  with the item on the stack and the predicate should leave a boolean indicating whether it was satisfied or not. The predicate must have stack effect " { $snippet "( X -- bool )" } ". If nothing in the mailbox satisfies the predicate then the process will block until something does." } 
+{ $see-also send receive } ;
+
+HELP: spawn
+{ $values { "quot" "a predicate with stack effect " { $snippet "( -- )" } }  
+          { "process" "a process object" } 
+}
+{ $description "Start a process which runs the given quotation." } 
+{ $see-also send receive receive-if self spawn-link } ;
+
+HELP: spawn-link
+{ $values { "quot" "a predicate with stack effect " { $snippet "( -- )" } }  
+          { "process" "a process object" } 
+}
+{ $description "Start a process which runs the given quotation. If that quotation throws an error which is not caught then the error will get propagated to the process that spawned it. This can be used to set up 'supervisor' processes that restart child processes that crash due to uncaught errors.\n" } 
+{ $see-also spawn } ;
+
+ARTICLE: { "concurrency" "loading" } "Loading"
+"The Factor module system can be used to load the Concurrency library:" 
+{ $code "USING: concurrency ;" } ;
+
+ARTICLE: { "concurrency" "processes" } "Processes"
+"A process is basically a thread with a message queue. Other processes can place items on this queue by sending the process a message. A process can check its queue for messages, blocking if none are pending, and process them as they are queued.\n\nFactor processes are very lightweight. Each process can take as little as 900 bytes of memory. This library has been tested running hundreds of thousands of simple processes.\n\nThe messages that are sent from process to process are any Factor value. Factor tuples are ideal for this sort of thing as you can send a tuple to a process and the predicate dispatch mechanism can be used to perform actions depending on what the type of the tuple is.\n\nProcesses are usually created using " { $link spawn } ". This word takes a quotation on the stack and starts a process that will execute that quotation asynchronously. When the quotation completes the process will die. 'spawn'  leaves on the stack the process object that was started. This object can be used to send messages to the process using " { $link send }  ".\n\n'send' will return immediately after placing the message in the target processes message queue.\n\nA process can get a message from its queue using " { $link receive } ". This will get the most recent message and leave it on the stack. If there are no messages in the queue the process will 'block' until a message is available. When a process is blocked it takes no CPU time at all." 
+{ $code "[ receive print ] spawn\n\"Hello Process!\" swap send" } 
+"This example spawns a process that first blocks, waiting to receive a message. When a message is received, the 'receive' call returns leaving it on the stack. It then prints the message and exits. 'spawn' left the process on the stack so it's available to send the 'Hello Process!' message to it. Immediately after the 'send' you should see 'Hello Process!' printed on the console.\n\nIt is also possible to selectively retrieve messages from the message queue. " { $link receive-if } " takes a predicate quotation on the stack and returns the first message in the queue that satisfies the predicate. If no items satisfy the predicate then the process is blocked until a message is received that does." 
+{ $code ": odd? ( n -- ? ) 2 mod 1 = ;\n1 self send 2 self send 3 self send\n\nreceive .\n => 1\n\n[ odd? ] receive-if .\n => 3\n\nreceive .\n => 2" } ;
+
+ARTICLE: { "concurrency" "self" } "Self"
+"A process can get access to its own process object using " { $link self } " so it can pass it to other processes. This allows the other processes to send messages back. A simple example of using this gets the current processes 'self' and spawns a process which sends a message to it. We then receive the message from the original process:" 
+{ $code "self [ \"Hello!\" swap send ] spawn 2drop receive .\n => \"Hello!\"" } ;
+
+ARTICLE: { "concurrency" "servers" } "Servers"
+"A common idiom is to create 'server' processes that act on messages that are sent to it. These follow a basic pattern of blocking until a message is received, processing that message then looping back to blocking for a message.\n\nThe following example shows a very simple server that expects an array as its message. The first item of the array should be the senders process object. If the second item is 'ping' then the server sends 'pong' back to the caller. If the second item is anything else then the server exits:" 
+{ $code ": pong-server ( -- )\n  receive {\n    { { ?from \"ping\" } [ \"pong\" ?from send pong-server ] }\n    { { ?from _ } [ \"server shutdown\" ?from send ] }\n  } match-cond ;\n\n[ pong-server ] spawn" } 
+"Handling the deconstructing of messages and dispatching based on the message can be a bit of a chore. Especially in servers that take a number of different messages. The approach taken above is to use the 'match' library which allows easy deconstructing of messages using " { $link match-cond } "." ;
+
+ARTICLE: { "concurrency" "synchronous-sends" } "Synchronous Sends"
+{ $link send } " sends a message asynchronously, and the sending process continues immediately. The 'pong server' example shown previously all sent messages to the server and waited for a reply back from the server. This pattern of synchronous sending is made easier with " { $link send-synchronous } ".\n\nThis word will send a message to the given process and immediately block until a reply is received for this particular message send. It leaves the reply on the stack. Note that it doesn't wait for just any reply, it waits for a reply specifically to this send.\n\nTo do this it wraps the requested message inside a tagged message format using " { $link tag-message } ":"
+{ $code "\"My Message\" tag-message .\n => { ...from... ...tag... \"My Message\" }" }
+"The message is wrapped in array where the first item is the sending process object, the second is a unique tag, and the third is the original message. Server processes can use the 'from' to reply to the process that originally sent the message. The tag can is used in the receiving server to include the value in the reply. After the send-synchronous call the current process will block waiting for a reply that has the exact same tag. In this way you can be sure that the reply you got was for the specific message sent. Here is the pong-server recoded to use 'send-synchronous':"
+{ $code ": pong-server ( -- )\n  receive {\n    { { ?from ?tag \"ping\" } [ ?tag \"pong\" 2array ?from send pong-server ] }\n    { { ?from _ } [ ?tag \"server shutdown\" 2array ?from send ] }\n  } match-cond ;\n\n[ pong-server ] spawn \"ping\" swap send-synchronous .\n => \"pong\"" } 
+"Notice that the code to send the reply back to the original caller wraps the reply in an array where the first item is the tag originally sent. 'send-synchronous' only returns if it receives a reply containing that specific tag." ;
+
+ARTICLE: { "concurrency" "exceptions" } "Exceptions"
+"A process can handle exceptions using the standard Factor exception handling mechanism. If an exception is uncaught the process will terminate. For example:" 
+{ $code "[ 1 0 / \"This will not print\" print ] spawn" } 
+"Processes can be linked so that a parent process can receive the exception that caused the child process to terminate. In this way 'supervisor' processes can be created that are notified when child processes terminate and possibly restart them.\n\nThe easiest way to form this link is using " { $link spawn-link } ". This will create a unidirectional link, such that if an uncaught exception causes the child to terminate, the parent process can catch it:"
+{ $code "[\n  [ 1 0 / \"This will not print\" print ] spawn-link drop\n  receive\n] catch [ \"Exception caught.\" print ] when" } 
+"Exceptions are only raised in the parent when the parent does a " { $link receive } " or " { $link receive-if } ". This is because the exception is sent from the child to the parent as a message." ;
+
+ARTICLE: { "concurrency" "futures" } "Futures"
+"A future is a placeholder for the result of a computation that is being calculated in a process. When the process has completed the computation the future can be queried to find out the result. If the computation has not completed when the future is queried them the process will block until the result is completed. <p>A future is created using " { $link future } ".\n\nThe quotation will be run in a spawned process, and a future object is immediately returned. This future object can be resolved using " { $link ?future } ".\n\nFutures are useful for starting calculations that take a long time to run but aren't needed until later in the process. When the process needs the value it can use '?future' to get the result or block until the result is available. For example:"
+{ $code "[ 30 fib ] future\n...do stuff...\n?future" } ;
+
+ARTICLE: { "concurrency" "promises" } "Promises"
+"A promise is similar to a future but it is not produced by calculating something in the background. It represents a promise to provide a value sometime later. A process can request the value of a promise and will block if the promise is not fulfilled. Later, another process can fulfill the promise, providing a value. All threads waiting on the promise will then resume with that value on the stack. Use " { $link <promise> } " to create a promise, " { $link fulfill } " to set it to a value, and " { $link ?promise } " to retrieve the value, or block until the promise is fulfilled:"
+{ $code "<promise>\n[ ?promise \"Promise fulfilled: \" write print ] spawn drop\n[ ?promise \"Promise fulfilled: \" write print ] spawn drop\n[ ?promise \"Promise fulfilled: \" write print ] spawn drop\n\"hello\" swap fulfill\n => Promise fulfilled: hello\n    Promise fulfilled: hello\n    Promise fulfilled: hello" } ;
+
+ARTICLE: { "concurrency" "concurrency" } "Concurrency"
+"The concurrency library is based upon the style of concurrency used in systems like Erlang and Termite. It is built on top of the standard Factor lightweight thread system.\nA concurrency oriented program is one in which multiple processes run simultaneously in a single Factor image or across multiple running Factor instances. The processes can communicate with each other by asynchronous message sends. Although processes can share data via Factor's mutable data structures it is not recommended as the use of shared state concurrency is often a cause of problems."
+{ $subsection { "concurrency" "loading" } } 
+{ $subsection { "concurrency" "processes" } } 
+{ $subsection { "concurrency" "self" } } 
+{ $subsection { "concurrency" "servers" } } 
+{ $subsection { "concurrency" "synchronous-sends" } } 
+{ $subsection { "concurrency" "exceptions" } } 
+{ $subsection { "concurrency" "futures" } } 
+{ $subsection { "concurrency" "promises" } } ;
+
+ABOUT: { "concurrency" "concurrency" }
\ No newline at end of file
diff --git a/extra/concurrency/concurrency-tests.factor b/extra/concurrency/concurrency-tests.factor
new file mode 100644 (file)
index 0000000..ded0996
--- /dev/null
@@ -0,0 +1,131 @@
+! Copyright (C) 2005 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel concurrency threads vectors arrays sequences
+namespaces tools.test continuations dlists strings math words
+match quotations ;
+IN: temporary
+
+[ V{ 1 2 3 } ] [
+  0 <vector>
+  make-mailbox
+  2dup [ mailbox-get swap push ] 2curry in-thread
+  2dup [ mailbox-get swap push ] 2curry in-thread
+  2dup [ mailbox-get swap push ] 2curry in-thread
+  1 over mailbox-put
+  2 over mailbox-put
+  3 swap mailbox-put
+] unit-test
+
+[ V{ 1 2 3 } ] [
+  0 <vector>
+  make-mailbox
+  2dup [ [ integer? ] swap mailbox-get? swap push ] 2curry in-thread
+  2dup [ [ integer? ] swap mailbox-get? swap push ] 2curry in-thread
+  2dup [ [ integer? ] swap mailbox-get? swap push ] 2curry in-thread
+  1 over mailbox-put
+  2 over mailbox-put
+  3 swap mailbox-put
+] unit-test
+
+[ V{ 1 "junk" 3 "junk2" } [ 456 ] ] [
+  0 <vector>
+  make-mailbox
+  2dup [ [ integer? ] swap mailbox-get? swap push ] 2curry in-thread
+  2dup [ [ integer? ] swap mailbox-get? swap push ] 2curry in-thread
+  2dup [ [ string? ] swap mailbox-get? swap push ] 2curry in-thread
+  2dup [ [ string? ] swap mailbox-get? swap push ] 2curry in-thread
+  1 over mailbox-put
+  "junk" over mailbox-put
+  [ 456 ] over mailbox-put
+  3 over mailbox-put
+  "junk2" over mailbox-put
+  mailbox-get
+] unit-test
+
+[ "test" ] [
+  [ self ] "test" with-process
+] unit-test
+
+
+[ "received" ] [ 
+  [
+    receive { 
+      { { ?from ?tag _ } [ ?tag "received" 2array ?from send ] } 
+    } match-cond
+  ] spawn
+  "sent" swap send-synchronous
+] unit-test
+
+[ 1 3 2 ] [
+  1 self send
+  2 self send
+  3 self send
+  receive
+  [ 2 mod 0 = not ] receive-if
+  receive
+] unit-test
+
+
+[ "crash" ] [
+  [
+    [
+      "crash" throw
+    ] spawn-link drop
+    receive
+  ] 
+  catch
+] unit-test 
+
+[ 50 ] [
+  [ 50 ] future ?future
+] unit-test
+
+[ V{ 50 50 50 } ] [
+  0 <vector>
+  <promise>
+  2dup [ ?promise swap push ] 2curry spawn drop
+  2dup [ ?promise swap push ] 2curry spawn drop
+  2dup [ ?promise swap push ] 2curry spawn drop
+  50 swap fulfill
+] unit-test  
+
+MATCH-VARS: ?value ;
+SYMBOL: increment
+SYMBOL: decrement
+SYMBOL: value
+
+: counter ( value -- )
+  receive {
+    { { increment ?value } [ ?value + counter ] }
+    { { decrement ?value } [ ?value - counter ] }
+    { { value ?from }      [ dup ?from send counter ] }
+  } match-cond ;
+
+[ -5 ] [
+  [ 0 counter ] spawn
+  { increment 10 } over send
+  { decrement 15 } over send
+  [ value , self , ] { } make swap send 
+  receive
+] unit-test
+
+! The following unit test blocks forever if the
+! exception does not propogate. Uncomment when
+! this is fixed (via a timeout).
+! [
+!  [ "this should propogate" throw ] future ?future 
+! ] unit-test-fails
+
+[ ] [
+  [ "this should not propogate" throw ] future drop 
+] unit-test
+
+[ f ] [
+  [ 1 drop ] spawn 100 sleep process-pid get-process
+] unit-test
+
+[ f ] [
+  [ "testing unregistering on error" throw ] spawn 
+  100 sleep process-pid get-process
+] unit-test 
\ No newline at end of file
diff --git a/extra/concurrency/concurrency.factor b/extra/concurrency/concurrency.factor
new file mode 100644 (file)
index 0000000..391e6b4
--- /dev/null
@@ -0,0 +1,354 @@
+! Copyright (C) 2005 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Concurrency library for Factor based on Erlang/Termite style
+! concurrency.
+USING: vectors dlists threads sequences continuations
+       namespaces random math quotations words kernel match
+       arrays io assocs init ;
+IN: concurrency
+
+TUPLE: mailbox threads data ;
+
+: make-mailbox ( -- mailbox )
+    V{ } clone <dlist> mailbox construct-boa ;
+
+: mailbox-empty? ( mailbox -- bool )
+    mailbox-data dlist-empty? ;
+
+: mailbox-put ( obj mailbox -- )
+    [ mailbox-data dlist-push-end ] keep
+    [ mailbox-threads ] keep 0 <vector> swap set-mailbox-threads
+    [ schedule-thread ] each yield ;
+
+<PRIVATE
+: (mailbox-block-unless-pred) ( pred mailbox -- )
+    2dup mailbox-data dlist-contains? [
+        2drop
+    ] [
+        [ swap mailbox-threads push stop ] callcc0
+        (mailbox-block-unless-pred)
+    ] if ; inline
+
+: (mailbox-block-if-empty) ( mailbox -- mailbox2 )
+    dup mailbox-empty? [
+        [ swap mailbox-threads push stop ] callcc0
+        (mailbox-block-if-empty)
+    ] when ;
+PRIVATE>
+: mailbox-get ( mailbox -- obj )
+    (mailbox-block-if-empty)
+    mailbox-data dlist-pop-front ;
+
+<PRIVATE
+: (mailbox-get-all) ( mailbox -- )
+    dup mailbox-empty? [
+        drop
+    ] [
+        dup mailbox-data dlist-pop-front , (mailbox-get-all)
+    ] if ;
+PRIVATE>
+: mailbox-get-all ( mailbox -- array )
+    (mailbox-block-if-empty)
+    [ (mailbox-get-all) ] { } make ;
+
+: while-mailbox-empty ( mailbox quot -- )
+    over mailbox-empty? [
+        dup >r swap slip r> while-mailbox-empty
+    ] [
+        2drop
+    ] if ; inline
+
+: mailbox-get? ( pred mailbox -- obj )
+    2dup (mailbox-block-unless-pred)
+    mailbox-data dlist-remove ;
+    inline
+
+TUPLE: process links pid mailbox ;
+
+C: <process> process
+
+GENERIC: send ( message process -- )
+
+: random-64 ( -- id )
+    #! Generate a random id to use for pids
+    "ID" 64 [ drop 10 random CHAR: 0 + ] map append ;
+
+<PRIVATE
+: make-process ( -- process )
+    #! Return a process set to run on the local node. A process is
+    #! similar to a thread but can send and receive messages to and
+    #! from other processes. It may also be linked to other processes so
+    #! that it receives a message if that process terminates.
+    [ ] random-64 make-mailbox <process> ;
+
+: make-linked-process ( process -- process )
+    #! Return a process set to run on the local node. That process is
+    #! linked to the process on the stack. It will receive a message if
+    #! that process terminates.
+    1quotation random-64 make-mailbox <process> ;
+PRIVATE>
+
+: self ( -- process )
+    \ self get  ;
+
+<PRIVATE
+: init-main-process ( -- )
+    #! Setup the main process.
+    make-process \ self set-global ;
+
+: with-process ( quot process -- )
+    #! Calls the quotation with 'self' set
+    #! to the given process.
+    \ self rot with-variable ; inline
+
+PRIVATE>
+
+DEFER: register-process
+DEFER: unregister-process
+
+<PRIVATE
+: ((spawn)) ( quot -- )
+    self dup process-pid swap register-process
+    [ self process-pid unregister-process ] [ ] cleanup ; inline
+
+: (spawn) ( quot -- process )
+    [ in-thread ] make-process [ with-process ] keep ; inline
+
+PRIVATE>
+
+: spawn ( quot -- process )
+    [ ((spawn)) ] curry (spawn) ; inline
+
+TUPLE: linked-exception error ;
+
+C: <linked-exception> linked-exception
+
+: while-no-messages ( quot -- )
+    #! Run the quotation in a loop while no messages are in
+    #! the processes mailbox. The quot should have stack effect
+    #! ( -- ).
+    >r self process-mailbox r> while-mailbox-empty ; inline
+
+M: process send ( message process -- )
+    process-mailbox mailbox-put ;
+
+: receive ( -- message )
+    self process-mailbox mailbox-get dup linked-exception? [
+        linked-exception-error throw
+    ] when ;
+
+: receive-if ( pred -- message )
+    self process-mailbox mailbox-get? dup linked-exception? [
+        linked-exception-error throw
+    ] when ; inline
+
+: rethrow-linked ( error -- )
+    #! Rethrow the error to the linked process
+    self process-links [
+        over <linked-exception> swap send
+    ] each drop ;
+
+<PRIVATE
+: (spawn-link) ( quot -- process )
+    [ in-thread ] self make-linked-process
+    [ with-process ] keep ; inline
+PRIVATE>
+
+: spawn-link ( quot -- process )
+    [ catch [ rethrow-linked ] when* ] curry
+    [ ((spawn)) ] curry (spawn-link) ; inline
+
+<PRIVATE
+: (recv) ( msg form -- )
+    #! Process a form with the following format:
+    #!   [ pred match-quot ]
+    #! 'pred' is a word that has stack effect ( msg -- bool ). It is
+    #! executed with the message on the stack. It should return a
+    #! boolean if it is a message this form should process.
+    #! 'match-quot' is a quotation with stack effect ( msg -- ). It
+    #! will be called with the message on the top of the stack if
+    #! the 'pred' word returned true.
+    [ first execute ] 2keep rot [ second call ] [ 2drop ] if ;
+PRIVATE>
+
+: recv ( forms -- )
+    #! Get a message from the processes mailbox. Compare it against the
+    #! forms to run a quotation if it matches the given message. 'forms'
+    #! is a list of quotations in the following format:
+    #!   [ pred match-quot ]
+    #! 'pred' is a word that has stack effect ( msg -- bool ). It is
+    #! executed with the message on the stack. It should return a
+    #! boolean if it is a message this form should process.
+    #! 'match-quot' is a quotation with stack effect ( msg -- ). It
+    #! will be called with the message on the top of the stack if
+    #! the 'pred' word returned true.
+    #! Each form in the list will be matched against the message,
+    #! even if a prior match succeeded. This means multiple quotations
+    #! may be run against the message.
+    receive swap [ dupd (recv) ] each drop ;
+
+MATCH-VARS: ?from ?tag ;
+
+<PRIVATE
+: tag-message ( message -- tagged-message )
+    #! Given a message, wrap it with the sending process and a unique tag.
+    >r self random-64 r> 3array ;
+PRIVATE>
+
+: send-synchronous ( message process -- reply )
+    #! Sends a message to the process synchronously. The
+    #! message will be wrapped to include the process of the sender
+    #! and a unique tag. After being sent the sending process will
+    #! block for a reply tagged with the same unique tag.
+    >r tag-message dup r> send second _ 2array [ match ] curry
+    receive-if second ;
+
+<PRIVATE
+: forever ( quot -- )
+    #! Loops forever executing the quotation.
+    dup slip forever ;
+
+SYMBOL: quit-cc
+
+: (spawn-server) ( quot -- )
+    #! Receive a message, and run 'quot' on it. If 'quot'
+    #! returns true, start again, otherwise exit loop.
+    #! The quotation should have stack effect ( message -- bool ).
+    "Waiting for message in server: " write
+    self process-pid print
+    receive over call [ (spawn-server) ] when ;
+PRIVATE>
+
+: spawn-server ( quot -- process )
+    #! Spawn a server that receives messages, calling the
+    #! quotation on the message. If the quotation returns false
+    #! the spawned process exits. If it returns true, the process
+    #! starts from the beginning again. The quotation should have
+    #! stack effect ( message -- bool ).
+    [
+        (spawn-server)
+        "Exiting process: " write self process-pid print
+    ] curry spawn ;
+
+: spawn-linked-server ( quot -- process )
+    #! Similar to 'spawn-server' but the parent process will be linked
+    #! to the child.
+    [
+        (spawn-server)
+        "Exiting process: " write self process-pid print
+    ] curry spawn-link ;
+
+: server-cc ( -- cc | process )
+    #! Captures the current continuation and returns the value.
+    #! If that CC is called with a process on the stack it will
+    #! set 'self' for the current process to it. Otherwise it will
+    #! return the value. This allows capturing a continuation in a server,
+    #! and jumping back into it from a spawn and keeping the 'self'
+    #! variable correct. It's a workaround until I can find out how to
+    #! stop 'self' from being clobbered back to its old value.
+    [ ] callcc1 dup process? [ \ self set-global f ] when ;
+
+: call-server-cc ( server-cc -- )
+    #! Calls the server continuation passing the current 'self'
+    #! so the server continuation gets its new self updated.
+    self swap call ;
+
+: future ( quot -- future )
+    #! Spawn a process to call the quotation and immediately return
+    #! a 'future' on the stack. The future can later be queried with
+    #! ?future. If the quotation has completed the result will be returned.
+    #! If not, the process will block until the quotation completes.
+    #! 'quot' must have stack effect ( -- X ).
+    [ self send ] compose spawn ;
+
+: ?future ( future -- result )
+    #! Block the process until the future has completed and then
+    #! place the result on the stack. Return the result
+    #! immediately if the future has completed.
+    process-mailbox mailbox-get ;
+
+: parallel-map ( seq quot -- newseq )
+    #! Spawn a process to apply quot to each element of seq,
+    #! joining the results into a sequence at the end.
+    [ curry future ] curry map [ ?future ] map ;
+
+: parallel-each ( seq quot -- )
+    #! Spawn a process to apply quot to each element of seq,
+    #! and waits for all processes to complete.
+    [ f ] compose parallel-map drop ;
+
+TUPLE: promise fulfilled? value processes ;
+
+: <promise> ( -- <promise> )
+    f f V{ } clone promise construct-boa ;
+
+: fulfill ( value promise  -- )
+    #! Set the future of the promise to the given value. Threads
+    #! blocking on the promise will then be released.
+    dup promise-fulfilled? [
+        [ set-promise-value ] keep
+        [ t swap set-promise-fulfilled? ] keep
+        [ promise-processes ] keep
+        0 <vector> swap set-promise-processes
+        [ schedule-thread ] each yield
+    ] unless ;
+
+<PRIVATE
+ : (maybe-block-promise) ( promise -- promise )
+    #! Block the process if the promise is unfulfilled. This is different from
+    #! (mailbox-block-if-empty) in that when a promise is fulfilled, all threads
+    #! need to be resumed, rather than just one.
+    dup promise-fulfilled? [
+        [ swap promise-processes push stop ] callcc0
+    ] unless ;
+PRIVATE>
+
+: ?promise ( promise -- result )
+    (maybe-block-promise) promise-value ;
+
+! ******************************
+! Experimental code below
+! ******************************
+<PRIVATE
+: (lazy) ( v -- )
+    receive {
+        { { ?from ?tag _ }
+            [ ?tag over 2array ?from send (lazy) ] }
+    } match-cond ;
+PRIVATE>
+
+: lazy ( quot -- lazy )
+    #! Spawn a process that immediately blocks and return it.
+    #! When '?lazy' is called on the returned process, call the quotation
+    #! and return the result. The quotation must have stack effect ( -- X ).
+    [
+        receive {
+            { { ?from ?tag _ }
+                [ call ?tag over 2array ?from send (lazy) ] }
+        } match-cond
+    ] spawn nip ;
+
+: ?lazy ( lazy -- result )
+    #! Given a process spawned using 'lazy', evaluate it and return the result.
+    f swap send-synchronous ;
+
+<PRIVATE
+: remote-processes ( -- hash )
+   \ remote-processes get-global ;
+PRIVATE>
+
+: register-process ( name process -- )
+    swap remote-processes set-at ;
+
+: unregister-process ( name -- )
+    remote-processes delete-at ;
+
+: get-process ( name -- process )
+    remote-processes at ;
+
+[
+    H{ } clone \ remote-processes set-global
+    init-main-process
+    self [ process-pid ] keep register-process
+] "process-registry" add-init-hook
diff --git a/extra/concurrency/distributed/authors.txt b/extra/concurrency/distributed/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/concurrency/distributed/distributed-docs.factor b/extra/concurrency/distributed/distributed-docs.factor
new file mode 100644 (file)
index 0000000..23af641
--- /dev/null
@@ -0,0 +1,25 @@
+USING: help.markup help.syntax concurrency ;
+IN: concurrency.distributed
+
+HELP: <remote-process>
+{ $values { "node" "a node object" } 
+          { "pid" "a process id" } 
+          { "remote-process" "the constructed remote-process object" } 
+}
+{ $description "Constructs a proxy to a process running on another node. It can be used to send messages to the process it is acting as a proxy for." } 
+{ $see-also <node> <process> spawn send } ;
+
+
+HELP: <node> 
+{ $values { "hostname" "the hostname of the node as a string" } 
+          { "port" "the integer port number of the node" } 
+          { "node" "the constructed node object" } 
+}
+{ $description "Processes run on nodes. Each node has a hostname and a port." } 
+{ $see-also localnode } ;
+
+HELP: localnode
+{ $values { "node" "a node object" } 
+}
+{ $description "Return the node the process is currently running on." } 
+{ $see-also <node> } ;
diff --git a/extra/concurrency/distributed/distributed.factor b/extra/concurrency/distributed/distributed.factor
new file mode 100644 (file)
index 0000000..9024c06
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2005 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+USING: serialize sequences concurrency io io.server qualified
+threads arrays namespaces kernel ;
+QUALIFIED: io.sockets
+IN: concurrency.distributed
+
+TUPLE: node hostname port ;
+
+C: <node> node
+
+: handle-node-client ( -- )
+    deserialize first2 get-process send ;
+
+: node-server ( port -- )
+    internet-server
+    "concurrency"
+    [ handle-node-client ] with-server ;
+
+: send-to-node ( msg pid  host port -- )
+    io.sockets:<inet> io.sockets:<client> [
+        2array serialize
+    ] with-stream ;
+
+: localnode ( -- node )
+    \ localnode get ;
+
+: start-node ( hostname port -- )
+    [ node-server ] in-thread
+    <node> \ localnode set-global ;
+
+TUPLE: remote-process node pid ;
+
+C: <remote-process> remote-process
+
+M: remote-process send ( message process -- )
+    #! Send the message via the inter-node protocol
+    { remote-process-pid remote-process-node } get-slots
+    { node-hostname node-port } get-slots
+    send-to-node ;
+
+M: process (serialize) ( obj -- )
+    localnode swap process-pid <remote-process> (serialize) ;
diff --git a/extra/concurrency/distributed/summary.txt b/extra/concurrency/distributed/summary.txt
new file mode 100644 (file)
index 0000000..0107089
--- /dev/null
@@ -0,0 +1 @@
+Erlang-style distributed concurrency
diff --git a/extra/concurrency/distributed/tags.txt b/extra/concurrency/distributed/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/concurrency/summary.txt b/extra/concurrency/summary.txt
new file mode 100644 (file)
index 0000000..7f48dd4
--- /dev/null
@@ -0,0 +1 @@
+Erlang-style concurrency
diff --git a/extra/concurrency/tags.txt b/extra/concurrency/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/const/const.factor b/extra/const/const.factor
new file mode 100644 (file)
index 0000000..589f5f7
--- /dev/null
@@ -0,0 +1,16 @@
+USING: kernel parser words sequences ;
+IN: const
+
+: define-const ( word value -- )
+    [ parsed ] curry dupd define-compound
+    t "parsing" set-word-prop ;
+
+: CONST:
+    CREATE scan-word dup parsing?
+    [ execute dup pop ] when define-const ; parsing
+
+: define-enum ( words -- )
+    dup length [ define-const ] 2each ;
+
+: ENUM:
+    ";" parse-tokens [ create-in ] map define-enum ; parsing
diff --git a/extra/contributors/authors.txt b/extra/contributors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/contributors/contributors.factor b/extra/contributors/contributors.factor
new file mode 100644 (file)
index 0000000..7db2965
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: memory io io.files io.styles io.launcher
+sequences prettyprint kernel arrays xml xml.utilities system
+hashtables sorting math.parser assocs ;
+IN: contributors
+
+: changelog ( -- xml )
+    image parent-dir cd
+    "darcs changes --xml-output" <process-stream> read-xml ;
+
+: authors ( xml -- seq )
+    children-tags [ "author" swap at ] map ;
+
+: patch-count ( authors author -- n )
+    [ = ] curry subset length ;
+
+: patch-counts ( authors -- assoc )
+    dup prune [ [ patch-count ] keep 2array ] curry* map ;
+
+: contributors ( -- )
+    changelog authors patch-counts sort-keys <reversed>
+    standard-table-style [
+        [
+            [
+                first2
+                [ write ] with-cell
+                [ number>string write ] with-cell
+            ] with-row
+        ] each
+    ] tabular-output ;
+
+MAIN: contributors
diff --git a/extra/contributors/summary.txt b/extra/contributors/summary.txt
new file mode 100644 (file)
index 0000000..ca6fc06
--- /dev/null
@@ -0,0 +1 @@
+Contributor patch count tally from darcs demo
diff --git a/extra/contributors/tags.txt b/extra/contributors/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/core-foundation/authors.txt b/extra/core-foundation/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/core-foundation/core-foundation-docs.factor b/extra/core-foundation/core-foundation-docs.factor
new file mode 100644 (file)
index 0000000..9914ffe
--- /dev/null
@@ -0,0 +1,57 @@
+USING: core-foundation alien strings arrays help.markup
+help.syntax ;
+
+HELP: CF>array
+{ $values { "alien" "a " { $snippet "CFArray" } } { "array" "an array of " { $link alien } " instances" } }
+{ $description "Creates a Factor array from a Core Foundation array." } ;
+
+HELP: <CFArray>
+{ $values { "seq" "a sequence of " { $link alien } " instances" } { "alien" "a " { $snippet "CFArray" } } }
+{ $description "Creates a Core Foundation array from a Factor array." } ;
+
+HELP: <CFString>
+{ $values { "string" string } { "alien" "a " { $snippet "CFString" } } }
+{ $description "Creates a Core Foundation string from a Factor string." } ;
+
+HELP: CF>string
+{ $values { "alien" "a " { $snippet "CFString" } } { "string" string } }
+{ $description "Creates a Factor string from a Core Foundation string." } ;
+
+HELP: CF>string-array
+{ $values { "alien" "a " { $snippet "CFArray" } " of " { $snippet "CFString" } " instances" } { "seq" string } }
+{ $description "Creates an array of Factor strings from a " { $snippet "CFArray" } " of " { $snippet "CFString" } "s." } ;
+
+HELP: <CFFileSystemURL>
+{ $values { "string" "a pathname string" } { "dir?" "a boolean indicating if the pathname is a directory" } { "url" "a " { $snippet "CFURL" } } }
+{ $description "Creates a new " { $snippet "CFURL" } " pointing to the given local pathname." } ;
+
+HELP: <CFURL>
+{ $values { "string" "a URL string" } { "url" "a " { $snippet "CFURL" } } }
+{ $description "Creates a new " { $snippet "CFURL" } "." } ;
+
+HELP: <CFBundle>
+{ $values { "string" "a pathname string" } { "bundle" "a " { $snippet "CFBundle" } } }
+{ $description "Creates a new " { $snippet "CFBundle" } "." } ;
+
+HELP: load-framework
+{ $values { "name" "a pathname string" } }
+{ $description "Loads a Core Foundation framework." } ;
+
+ARTICLE: "core-foundation" "Core foundation utilities"
+"The " { $vocab-link "core-foundation" } " vocabulary defines bindings for some frequently-used Core Foundation functions. It also provides some utility words."
+$nl
+"Strings:"
+{ $subsection <CFString> }
+{ $subsection CF>string }
+"Arrays:"
+{ $subsection <CFArray> }
+{ $subsection CF>array }
+{ $subsection CF>string-array }
+"URLs:"
+{ $subsection <CFFileSystemURL> }
+{ $subsection <CFURL> }
+"Frameworks:"
+{ $subsection load-framework } ;
+
+IN: core-foundation
+ABOUT: "core-foundation"
diff --git a/extra/core-foundation/core-foundation.factor b/extra/core-foundation/core-foundation.factor
new file mode 100644 (file)
index 0000000..457abda
--- /dev/null
@@ -0,0 +1,74 @@
+! Copyright (C) 2006 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.syntax kernel math sequences ;
+IN: core-foundation
+
+TYPEDEF: int CFIndex
+
+FUNCTION: void* CFArrayCreateMutable ( void* allocator, CFIndex capacity, void* callbacks ) ;
+
+FUNCTION: void* CFArrayGetValueAtIndex ( void* array, CFIndex idx ) ;
+
+FUNCTION: void CFArraySetValueAtIndex ( void* array, CFIndex index, void* value ) ;
+
+FUNCTION: CFIndex CFArrayGetCount ( void* array ) ;
+
+: kCFURLPOSIXPathStyle 0 ;
+
+FUNCTION: void* CFURLCreateWithFileSystemPath ( void* allocator, void* filePath, int pathStyle, bool isDirectory ) ;
+
+FUNCTION: void* CFURLCreateWithString ( void* allocator, void* string, void* base ) ;
+
+FUNCTION: void* CFURLCopyFileSystemPath ( void* url, int pathStyle ) ;
+
+FUNCTION: void* CFStringCreateWithCharacters ( void* allocator, ushort* cStr, CFIndex numChars ) ;
+
+FUNCTION: CFIndex CFStringGetLength ( void* theString ) ;
+
+FUNCTION: void CFStringGetCharacters ( void* theString, CFIndex start, CFIndex length, void* buffer ) ;
+
+FUNCTION: void* CFBundleCreate ( void* allocator, void* bundleURL ) ;
+
+FUNCTION: bool CFBundleLoadExecutable ( void* bundle ) ;
+
+FUNCTION: void CFRelease ( void* cf ) ;
+
+: CF>array ( alien -- array )
+    dup CFArrayGetCount [ CFArrayGetValueAtIndex ] curry* map ;
+
+: <CFArray> ( seq -- alien )
+    [ f swap length f CFArrayCreateMutable ] keep
+    [ length ] keep
+    [ >r dupd r> CFArraySetValueAtIndex ] 2each ;
+
+: <CFString> ( string -- alien )
+    f swap dup length CFStringCreateWithCharacters ;
+
+: CF>string ( alien -- string )
+    dup CFStringGetLength 1+ "ushort" <c-array> [
+        >r 0 over CFStringGetLength r> CFStringGetCharacters
+    ] keep alien>u16-string ;
+
+: CF>string-array ( alien -- seq )
+    CF>array [ CF>string ] map ;
+
+: <CFFileSystemURL> ( string dir? -- url )
+    >r <CFString> f over kCFURLPOSIXPathStyle
+    r> CFURLCreateWithFileSystemPath swap CFRelease ;
+
+: <CFURL> ( string -- url )
+    <CFString>
+    [ f swap f CFURLCreateWithString ] keep
+    CFRelease ;
+
+: <CFBundle> ( string -- bundle )
+    t <CFFileSystemURL> [
+        f swap CFBundleCreate
+    ] keep CFRelease ;
+
+: load-framework ( name -- )
+    dup <CFBundle> [
+        CFBundleLoadExecutable drop
+    ] [
+        "Cannot load bundled named " swap append throw
+    ] ?if ;
diff --git a/extra/core-foundation/summary.txt b/extra/core-foundation/summary.txt
new file mode 100644 (file)
index 0000000..c5f2d1b
--- /dev/null
@@ -0,0 +1 @@
+Mac OS X CoreFoundation binding
diff --git a/extra/core-foundation/tags.txt b/extra/core-foundation/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/coroutines/authors.txt b/extra/coroutines/authors.txt
new file mode 100644 (file)
index 0000000..7edcfdd
--- /dev/null
@@ -0,0 +1,2 @@
+Chris Double
+Clemens F. Hofreither
diff --git a/extra/coroutines/coroutines-docs.factor b/extra/coroutines/coroutines-docs.factor
new file mode 100644 (file)
index 0000000..ed3788d
--- /dev/null
@@ -0,0 +1,54 @@
+! Copyright (C) 2005 Chris Double, 2007 Clemens Hofreither.
+USING: help.markup help.syntax coroutines ;
+
+HELP: cocreate
+{ $values { "quot" "a quotation with stack effect ( value -- )" } { "co" "a coroutine" } }
+{ $description "Create a new coroutine which will execute the quotation when resumed. The quotation will have an initial value (received from " { $link coresume } ") on the stack when first resumed.\n\nCoroutines should never terminate normally by \"falling off\" the end of the quotation; instead, they should call " { $link coterminate } "." }
+;
+
+HELP: coresume
+{ $values { "v" "an object" } { "co" "a coroutine" } { "result" "an object" } }
+{ $description "Resume a coroutine with v as the first item on the stack. The result placed on the stack is the value of the topmost argument on the stack when " { $link coyield } " is called within the coroutine." }
+{ $see-also *coresume coresume* }
+;
+
+HELP: *coresume
+{ $values { "co" "a coroutine" } { "result" "an object" } }
+{ $description "Variant of " { $link coresume } " that passes a default value of " { $link f } " to the coroutine." }
+{ $see-also coresume coresume* }
+;
+
+HELP: coresume*
+{ $values { "v" "an object" } { "co" "a coroutine" } }
+{ $description "Variant of " { $link coresume } " that discards the result of the coroutine invocation." }
+{ $see-also coresume *coresume }
+;
+
+HELP: coyield
+{ $values { "v" "an object" } { "result" "an object" } }
+{ $description "Suspend the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. When this coroutine is later resumed, result will contain the value passed to " { $link coyield } "." }
+{ $see-also *coyield coyield* coterminate }
+;
+
+HELP: *coyield
+{ $values { "v" "an object" } }
+{ $description "Variant of " { $link coyield } " that returns a default value of " { $link f } " to the caller." }
+{ $see-also coyield coyield* }
+;
+
+HELP: coyield*
+{ $values { "v" "an object" } }
+{ $description "Variant of " { $link coyield } " that discards the value passed in via " { $link coresume } "." }
+{ $see-also coyield *coyield }
+;
+
+HELP: coterminate
+{ $values { "v" "an object" } }
+{ $description "Terminate the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. Resuming a terminated coroutine is a no-op." }
+{ $see-also coyield }
+;
+
+HELP: current-coro
+{ $description "Variable which contains the currently executing coroutine, or " { $link f } " if none is executing. User code should treat this variable as read-only." }
+{ $see-also cocreate coresume coyield }
+;
\ No newline at end of file
diff --git a/extra/coroutines/coroutines-tests.factor b/extra/coroutines/coroutines-tests.factor
new file mode 100644 (file)
index 0000000..283a128
--- /dev/null
@@ -0,0 +1,19 @@
+! Copyright (C) 2005 Chris Double, 2007 Clemens Hofreither.
+! See http://factorcode.org/license.txt for BSD license.
+IN: temporary
+USING: coroutines kernel sequences prettyprint tools.test math ;
+
+: test1 ( -- co )
+  [ drop 1 coyield* 2 coyield* 3 coterminate ] cocreate ;
+
+: test2 ( -- co )
+  [ 1+ coyield* ] cocreate ;
+
+test1 dup *coresume . dup *coresume . dup *coresume . dup *coresume 2drop
+[ test2 42 over coresume . dup *coresume . drop ] unit-test-fails
+{ 43 } [ 42 test2 coresume ] unit-test
+
+: test3 ( -- co )
+  [ [ coyield* ] each ] cocreate ;
+
+{ "c" "b" "a" } [ test3 { "a" "b" "c" } over coresume >r dup *coresume >r *coresume r> r> ] unit-test
diff --git a/extra/coroutines/coroutines.factor b/extra/coroutines/coroutines.factor
new file mode 100644 (file)
index 0000000..2a84894
--- /dev/null
@@ -0,0 +1,44 @@
+! Copyright (C) 2005 Chris Double, 2007 Clemens Hofreither.
+! See http://factorcode.org/license.txt for BSD license.
+IN: coroutines
+USING: kernel hashtables namespaces continuations quotations ;
+
+SYMBOL: current-coro
+
+TUPLE: coroutine resumecc exitcc ;
+
+: cocreate ( quot -- co )
+  coroutine construct-empty
+  dup current-coro associate
+  [ swapd , , \ bind , 
+    "Coroutine has terminated illegally." , \ throw ,
+  ] [ ] make
+  over set-coroutine-resumecc ;
+
+: coresume ( v co -- result )
+  [ 
+    over set-coroutine-exitcc
+    coroutine-resumecc call
+    #! At this point, the coroutine quotation must have terminated
+    #! normally (without calling coyield or coterminate). This shouldn't happen.
+    f over
+  ] callcc1 2nip ;
+
+: coresume* ( v co -- ) coresume drop ; inline
+: *coresume ( co -- result ) f swap coresume ; inline
+
+: coyield ( v -- result )
+  current-coro get
+  [  
+    [ continue-with ] curry
+    over set-coroutine-resumecc  
+    coroutine-exitcc continue-with
+  ] callcc1 2nip ;
+
+: coyield* ( v -- ) coyield drop ; inline
+: *coyield ( -- v ) f coyield ; inline
+
+: coterminate ( v -- )
+  current-coro get
+  f over set-coroutine-resumecc
+  coroutine-exitcc continue-with ;
diff --git a/extra/coroutines/summary.txt b/extra/coroutines/summary.txt
new file mode 100644 (file)
index 0000000..330a0de
--- /dev/null
@@ -0,0 +1 @@
+Coroutines implementation
diff --git a/extra/coroutines/tags.txt b/extra/coroutines/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/cpu/8080/8080-docs.factor b/extra/cpu/8080/8080-docs.factor
new file mode 100644 (file)
index 0000000..c92d26e
--- /dev/null
@@ -0,0 +1,47 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.markup help.syntax sequences strings ;\r
+IN: cpu.8080\r
+\r
+HELP: load-rom \r
+{ $values { "filename" string } { "cpu" cpu } }\r
+{ $description \r
+"Read the ROM file into the cpu's memory starting at address 0000. " \r
+"The filename is relative to the path stored in the " { $link rom-root }\r
+" variable. An exception is thrown if this variable is not set."\r
+}\r
+{ $see-also load-rom* } ;\r
+\r
+HELP: load-rom*\r
+{ $values { "seq" sequence } { "cpu" cpu } }\r
+{ $description \r
+"Loads one or more ROM files into the cpu's memory. Each file is "\r
+"loaded at a particular starting address. 'seq' is a sequence of "\r
+"2 element arrays. The first element is the address and the second "\r
+"element is the file to load at that address." $nl\r
+"The filenames are relative to the path stored in the " { $link rom-root }\r
+" variable. An exception is thrown if this variable is not set."\r
+}\r
+{ $examples\r
+  { $code "{ { HEX: 0000 \"invaders.rom\" } } <cpu> load-rom*" }\r
+}\r
+{ $see-also load-rom } ;\r
+\r
+HELP: rom-root\r
+{ $description \r
+"Holds the path where the ROM files are stored. Used for expanding "\r
+"the relative filenames passed to " { $link load-rom } " and "\r
+{ $link load-rom* } "."\r
+}\r
+{ $see-also load-rom load-rom* } ;\r
+\r
+ARTICLE: { "cpu-8080" "cpu-8080" } "Intel 8080 CPU Emulator"\r
+"The cpu-8080 library provides an emulator for the Intel 8080 CPU"\r
+" instruction set. It is complete enough to emulate some 8080"\r
+" based arcade games." $nl \r
+"The emulated CPU can load 'ROM' files from disk using the "\r
+{ $link load-rom } " and " { $link load-rom* } " words. These expect "\r
+"the " { $link rom-root } " variable to be set to the path "\r
+"containing the ROM file's." ;\r
+\r
+ABOUT: { "cpu-8080" "cpu-8080" } \r
diff --git a/extra/cpu/8080/8080.factor b/extra/cpu/8080/8080.factor
new file mode 100644 (file)
index 0000000..34666b3
--- /dev/null
@@ -0,0 +1,1627 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel math sequences words arrays io 
+       io.files namespaces math.parser kernel.private
+       assocs quotations parser parser-combinators tools.time ;
+IN: cpu.8080
+
+TUPLE: cpu b c d e f h l a pc sp halted? last-interrupt cycles ram ;
+
+GENERIC: reset        ( cpu            -- )
+GENERIC: update-video ( value addr cpu -- )
+GENERIC: read-port    ( port cpu       -- byte )
+GENERIC: write-port   ( value port cpu -- )
+
+M: cpu update-video ( value addr cpu -- )
+  3drop ;
+
+M: cpu read-port ( port cpu -- byte )
+  #! Read a byte from the hardware port. 'port' should
+  #! be an 8-bit value.
+  2drop 0 ;
+
+M: cpu write-port ( value port cpu -- )
+  #! Write a byte to the hardware port, where 'port' is
+  #! an 8-bit value.
+  3drop ;
+
+: carry-flag        HEX: 01 ; inline
+: parity-flag       HEX: 04 ; inline
+: half-carry-flag   HEX: 10 ; inline
+: interrupt-flag    HEX: 20 ; inline
+: zero-flag         HEX: 40 ; inline
+: sign-flag         HEX: 80 ; inline
+
+: >word< ( word -- byte byte )
+  #! Explode a word into its two 8 bit values.
+  dup HEX: FF bitand swap -8 shift HEX: FF bitand swap ;
+
+: cpu-af ( cpu -- word )
+  #! Return the 16-bit pseudo register AF.
+  [ cpu-a 8 shift ] keep cpu-f bitor ;
+
+: set-cpu-af ( value cpu -- )
+  #! Set the value of the 16-bit pseudo register AF
+  >r >word< r> tuck set-cpu-f set-cpu-a ;
+
+: cpu-bc ( cpu -- word )
+  #! Return the 16-bit pseudo register BC.
+  [ cpu-b 8 shift ] keep cpu-c bitor ;
+
+: set-cpu-bc ( value cpu -- )
+  #! Set the value of the 16-bit pseudo register BC
+  >r >word< r> tuck set-cpu-c set-cpu-b ;
+
+: cpu-de ( cpu -- word )
+  #! Return the 16-bit pseudo register DE.
+  [ cpu-d 8 shift ] keep cpu-e bitor ;
+
+: set-cpu-de ( value cpu -- )
+  #! Set the value of the 16-bit pseudo register DE
+  >r >word< r> tuck set-cpu-e set-cpu-d ;
+
+: cpu-hl ( cpu -- word )
+  #! Return the 16-bit pseudo register HL.
+  [ cpu-h 8 shift ] keep cpu-l bitor ;
+
+: set-cpu-hl ( value cpu -- )
+  #! Set the value of the 16-bit pseudo register HL
+  >r >word< r> tuck set-cpu-l set-cpu-h ;
+
+: flag-set? ( flag cpu -- bool )
+  cpu-f bitand 0 = not ;
+
+: flag-clear? ( flag cpu -- bool )
+  cpu-f bitand 0 = ;
+
+: flag-nz? ( cpu -- bool )
+  #! Test flag status
+  cpu-f zero-flag bitand 0 = ;
+
+: flag-z? ( cpu -- bool )
+  #! Test flag status
+  cpu-f zero-flag bitand 0 = not ;
+
+: flag-nc? ( cpu -- bool )
+  #! Test flag status
+  cpu-f carry-flag bitand 0 = ;
+
+: flag-c? ( cpu -- bool )
+  #! Test flag status
+  cpu-f carry-flag bitand 0 = not ;
+
+: flag-po? ( cpu -- bool )
+  #! Test flag status
+  cpu-f parity-flag bitand 0 =  ;
+
+: flag-pe? ( cpu -- bool )
+  #! Test flag status
+  cpu-f parity-flag bitand 0 = not ;
+
+: flag-p? ( cpu -- bool )
+  #! Test flag status
+  cpu-f sign-flag bitand 0 = ;
+
+: flag-m? ( cpu -- bool )
+  #! Test flag status
+  cpu-f sign-flag bitand 0 = not ;
+
+: read-byte ( addr cpu -- byte )
+  #! Read one byte from memory at the specified address.
+  #! The address is 16-bit, but if a value greater than
+  #! 0xFFFF is provided then return a default value.
+  over HEX: FFFF <= [
+    cpu-ram nth
+  ] [
+    2drop HEX: FF
+  ] if ;
+
+: read-word ( addr cpu -- word )  
+  #! Read a 16-bit word from memory at the specified address.
+  #! The address is 16-bit, but if a value greater than
+  #! 0xFFFF is provided then return a default value.
+  [ read-byte ] 2keep >r 1 + r> read-byte 8 shift bitor ;
+: next-byte ( cpu -- byte )
+  #! Return the value of the byte at PC, and increment PC.
+  [ cpu-pc ] keep
+  [ read-byte ] keep 
+  [ cpu-pc 1 + ] keep
+  set-cpu-pc ;
+
+: next-word ( cpu -- word )
+  #! Return the value of the word at PC, and increment PC.
+  [ cpu-pc ] keep
+  [ read-word ] keep 
+  [ cpu-pc 2 + ] keep
+  set-cpu-pc ;
+
+
+: write-byte ( value addr cpu -- )
+  #! Write a byte to the specified memory address.
+  over dup HEX: 2000 < swap HEX: FFFF > or [
+    3drop
+  ] [
+    3dup cpu-ram set-nth
+    update-video
+  ] if ;
+
+
+: write-word ( value addr cpu -- )
+  #! Write a 16-bit word to the specified memory address.
+  >r >r >word< r> r> [ write-byte ] 2keep >r 1 + r> write-byte ;
+
+: cpu-a-bitand ( quot cpu -- )
+  #! A &= quot call 
+  [ cpu-a swap call bitand ] keep set-cpu-a ; inline
+
+: cpu-a-bitor ( quot cpu -- )
+  #! A |= quot call 
+  [ cpu-a swap call bitor ] keep set-cpu-a ; inline
+
+: cpu-a-bitxor ( quot cpu -- )
+  #! A ^= quot call 
+  [ cpu-a swap call bitxor ] keep set-cpu-a ; inline
+
+: cpu-a-bitxor= ( value cpu -- )
+  #! cpu-a ^= value
+  [ cpu-a bitxor ] keep set-cpu-a ;
+
+: cpu-f-bitand ( quot cpu -- )
+  #! F &= quot call 
+  [ cpu-f swap call bitand ] keep set-cpu-f ; inline
+
+: cpu-f-bitor ( quot cpu -- )
+  #! F |= quot call 
+  [ cpu-f swap call bitor ] keep set-cpu-f ; inline
+
+: cpu-f-bitxor ( quot cpu -- )
+  #! F |= quot call 
+  [ cpu-f swap call bitxor ] keep set-cpu-f ; inline
+
+: cpu-f-bitor= ( value cpu -- )
+  #! cpu-f |= value
+  [ cpu-f bitor ] keep set-cpu-f ;
+
+: cpu-f-bitand= ( value cpu -- )
+  #! cpu-f &= value
+  [ cpu-f bitand ] keep set-cpu-f ;
+
+: cpu-f-bitxor= ( value cpu -- )
+  #! cpu-f ^= value
+  [ cpu-f bitxor ] keep set-cpu-f ;
+
+: set-flag ( cpu flag -- )
+  swap cpu-f-bitor= ;
+
+: clear-flag ( cpu flag -- )
+   bitnot HEX: FF bitand swap cpu-f-bitand= ;
+
+: update-zero-flag ( result cpu -- )
+  #! If the result of an instruction has the value 0, this
+  #! flag is set, otherwise it is reset.
+  swap HEX: FF bitand 0 = [ zero-flag set-flag ] [ zero-flag clear-flag ] if ;
+
+: update-sign-flag ( result cpu -- )
+  #! If the most significant bit of the result 
+  #! has the value 1 then the flag is set, otherwise
+  #! it is reset.
+  swap HEX: 80 bitand 0 = [ sign-flag clear-flag ] [ sign-flag set-flag ] if ;
+
+: update-parity-flag ( result cpu -- )
+  #! If the modulo 2 sum of the bits of the result
+  #! is 0, (ie. if the result has even parity) this flag
+  #! is set, otherwise it is reset.
+  swap HEX: FF bitand 2 mod 0 = [ parity-flag set-flag ] [ parity-flag clear-flag ] if ;
+
+: update-carry-flag ( result cpu -- )
+  #! If the instruction resulted in a carry (from addition) 
+  #! or a borrow (from subtraction or a comparison) out of the
+  #! higher order bit, this flag is set, otherwise it is reset.
+  swap dup HEX: 100 >= swap 0 < or [ carry-flag set-flag ] [ carry-flag clear-flag ] if ;
+
+: update-half-carry-flag ( original change-by result cpu -- )
+  #! If the instruction caused a carry out of bit 3 and into bit 4 of the
+  #! resulting value, the half carry flag is set, otherwise it is reset.
+  #! The 'original' is the original value of the register being changed.
+  #! 'change-by' is the amount it is being added or decremented by.
+  #! 'result' is the result of that change.
+  >r bitxor bitxor HEX: 10 bitand 0 = not r> 
+  swap [ half-carry-flag set-flag ] [ half-carry-flag clear-flag ] if ;
+
+: update-flags ( result cpu -- )
+  2dup update-carry-flag
+  2dup update-parity-flag
+  2dup update-sign-flag
+  update-zero-flag ;
+
+: update-flags-no-carry ( result cpu -- )
+  2dup update-parity-flag
+  2dup update-sign-flag
+  update-zero-flag ;
+
+: add-byte ( lhs rhs cpu -- result )
+  #! Add rhs to lhs
+  >r 2dup + r> ! lhs rhs result cpu
+  [ update-flags ] 2keep 
+  [ update-half-carry-flag ] 2keep
+  drop HEX: FF bitand ;
+
+: add-carry ( change-by result cpu -- change-by result )
+  #! Add the effect of the carry flag to the result
+  flag-c? [ 1 + >r 1 + r> ] when ;
+
+: add-byte-with-carry ( lhs rhs cpu -- result )
+  #! Add rhs to lhs plus carry.
+  >r 2dup + r> ! lhs rhs result cpu
+  [ add-carry ] keep
+  [ update-flags ] 2keep 
+  [ update-half-carry-flag ] 2keep
+  drop HEX: FF bitand ;
+
+: sub-carry ( change-by result cpu -- change-by result ) 
+  #! Subtract the effect of the carry flag from the result
+  flag-c? [ 1 - >r 1 - r>  ] when ;
+
+: sub-byte ( lhs rhs cpu -- result )
+  #! Subtract rhs from lhs
+  >r 2dup - r> 
+  [ update-flags ] 2keep 
+  [ update-half-carry-flag ] 2keep
+  drop HEX: FF bitand ;
+
+: sub-byte-with-carry ( lhs rhs cpu -- result )
+  #! Subtract rhs from lhs and take carry into account
+  >r 2dup - r> 
+  [ sub-carry ] keep 
+  [ update-flags ] 2keep 
+  [ update-half-carry-flag ] 2keep
+  drop HEX: FF bitand ;
+: inc-byte ( byte cpu -- result )
+  #! Increment byte by one. Note that carry flag is not affected
+  #! by this operation.
+  >r 1 2dup + r> ! lhs rhs result cpu
+  [ update-flags-no-carry ] 2keep 
+  [ update-half-carry-flag ] 2keep
+  drop HEX: FF bitand ;
+
+: dec-byte ( byte cpu -- result )
+  #! Decrement byte by one. Note that carry flag is not affected
+  #! by this operation.
+  >r 1 2dup - r> ! lhs rhs result cpu
+  [ update-flags-no-carry ] 2keep 
+  [ update-half-carry-flag ] 2keep
+  drop HEX: FF bitand ;
+
+: inc-word ( w cpu -- w )
+  #! Increment word by one. Note that no flags are modified.
+  drop 1 + HEX: FFFF bitand ;
+
+: dec-word ( w cpu -- w )
+  #! Decrement word by one. Note that no flags are modified.
+  drop 1 - HEX: FFFF bitand ;
+
+: add-word ( lhs rhs cpu -- result )
+  #! Add rhs to lhs. Note that only the carry flag is modified
+  #! and only if there is a carry out of the double precision add.
+  >r + r> over HEX: FFFF > [ carry-flag set-flag ] [ drop ] if HEX: FFFF bitand ;
+
+: bit3or ( lhs rhs -- 0|1 )
+  #! bitor bit 3 of the two numbers on the stack
+  BIN: 00001000 bitand -3 shift >r
+  BIN: 00001000 bitand -3 shift r> 
+  bitor ;
+
+: and-byte ( lhs rhs cpu -- result )
+  #! Logically and rhs to lhs. The carry flag is cleared and
+  #! the half carry is set to the ORing of bits 3 of the operands.
+  [ drop bit3or ] 3keep ! bit3or lhs rhs cpu
+  >r bitand r> [ update-flags ] 2keep 
+  [ carry-flag clear-flag ] keep
+  rot 0 = [ half-carry-flag set-flag ] [ half-carry-flag clear-flag ] if
+  HEX: FF bitand ;
+
+: xor-byte ( lhs rhs cpu -- result )
+  #! Logically xor rhs to lhs. The carry and half-carry flags are cleared.
+  >r bitxor r> [ update-flags ] 2keep 
+  [ half-carry-flag carry-flag bitor clear-flag ] keep
+  drop HEX: FF bitand ;
+
+: or-byte ( lhs rhs cpu -- result )
+  #! Logically or rhs to lhs. The carry and half-carry flags are cleared.
+  >r bitor r> [ update-flags ] 2keep 
+  [ half-carry-flag carry-flag bitor clear-flag ] keep
+  drop HEX: FF bitand ;
+
+: flags ( seq -- seq )
+  [ 0 [ execute bitor ] reduce ] map ;
+
+: decrement-sp ( n cpu -- )
+  #! Decrement the stackpointer by n.  
+  [ cpu-sp ] keep 
+  >r swap - r> set-cpu-sp ;
+
+: save-pc ( cpu -- )
+  #! Save the value of the PC on the stack.
+  [ cpu-pc ] keep ! pc cpu
+  [ cpu-sp ] keep ! pc sp cpu
+  write-word ;
+
+: push-pc ( cpu -- )
+  #! Push the value of the PC on the stack.
+  2 over decrement-sp
+  save-pc ;
+
+: pop-pc ( cpu -- pc )
+  #! Pop the value of the PC off the stack.
+  [ cpu-sp ] keep
+  [ read-word ] keep 
+  -2 swap decrement-sp ;
+
+: push-sp ( value cpu -- )
+  [ 2 swap decrement-sp ] keep
+  [ cpu-sp ] keep
+  write-word ;
+  
+: pop-sp ( cpu -- value )
+  [ cpu-sp ] keep
+  [ read-word ] keep
+  -2 swap decrement-sp ;
+
+: call-sub ( addr cpu -- )
+  #! Call the address as a subroutine.
+  dup push-pc 
+  >r HEX: FFFF bitand r> set-cpu-pc ;
+
+: ret-from-sub ( cpu -- )
+  [ pop-pc ] keep set-cpu-pc ;
+: interrupt ( number cpu -- )
+  #! Perform a hardware interrupt
+!  "***Interrupt: " write over 16 >base print 
+  dup cpu-f interrupt-flag bitand 0 = not [
+    dup push-pc
+    set-cpu-pc
+  ] [
+    2drop
+  ] if ;
+
+: inc-cycles ( n cpu -- )
+  #! Increment the number of cpu cycles
+  [ cpu-cycles + ] keep set-cpu-cycles ;
+  
+: instruction-cycles ( -- vector )
+  #! Return a 256 element vector containing the cycles for
+  #! each opcode in the 8080 instruction set.
+  { 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f } ;
+
+: instructions ( -- vector )
+  #! Return a 256 element vector containing the emulation words for
+  #! each opcode in the 8080 instruction set.
+  { 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f 
+    f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f } ; 
+
+: not-implemented ( <cpu> -- )
+  drop ;
+
+instructions length [ 
+  dup instructions nth [
+    drop
+  ] [
+    [ not-implemented ] swap instructions set-nth 
+  ] if
+] each
+
+M: cpu reset ( cpu -- )
+  #! Reset the CPU to its poweron state
+  [ 0 swap set-cpu-b  ] keep
+  [ 0 swap set-cpu-c  ] keep
+  [ 0 swap set-cpu-d  ] keep
+  [ 0 swap set-cpu-e  ] keep
+  [ 0 swap set-cpu-h  ] keep
+  [ 0 swap set-cpu-l  ] keep
+  [ 0 swap set-cpu-a  ] keep
+  [ 0 swap set-cpu-f  ] keep
+  [ 0 swap set-cpu-pc  ] keep
+  [ HEX: F000 swap set-cpu-sp  ] keep 
+  [ HEX: FFFF 0 <array> swap set-cpu-ram ] keep
+  [ f swap set-cpu-halted? ] keep
+  [ HEX: 10 swap set-cpu-last-interrupt ] keep
+  0 swap set-cpu-cycles ;
+
+: <cpu> ( -- cpu ) cpu construct-empty dup reset ;
+
+: (load-rom) ( n ram -- )
+  read1 [ ! n ram ch
+    -rot [ set-nth ] 2keep >r 1 + r> (load-rom)
+  ] [
+    2drop
+  ] if* ;
+
+  #! Reads the ROM from stdin and stores it in ROM from
+  #! offset n.
+: load-rom ( filename cpu -- )
+  #! Load the contents of the file into ROM.
+  #! (address 0x0000-0x1FFF).
+  cpu-ram swap <file-reader> [ 
+    0 swap (load-rom)
+  ] with-stream ;
+
+SYMBOL: rom-root
+
+: rom-dir ( -- string )
+  rom-root get [ home "roms" path+ dup exists? [ drop f ] unless ] unless* ;
+
+: load-rom* ( seq cpu -- )
+  #! 'seq' is an array of arrays. Each array contains
+  #! an address and filename of a ROM file. The ROM
+  #! file will be loaded at the specified address. This
+  #! file path shoul dbe relative to the '/roms' resource path.
+  rom-dir [
+    cpu-ram [
+      swap first2 rom-dir swap path+ <file-reader> [      
+        swap (load-rom)
+      ] with-stream
+    ] curry each 
+  ] [
+    ! 
+    ! the ROM files.
+    "Set 'rom-root' to the path containing the root of the 8080 ROM files." throw
+  ] if ;
+
+: read-instruction ( cpu -- word )
+  #! Read the next instruction from the cpu's program 
+  #! counter, and increment the program counter.
+  [ cpu-pc ] keep ! pc cpu
+  [ over 1 + swap set-cpu-pc ] keep
+  read-byte ;
+
+: get-cycles ( n -- opcode )
+  #! Returns the cycles for the given instruction value.
+  #! If the opcode is not defined throw an error.
+  dup instruction-cycles nth [ 
+    nip  
+  ] [
+    [ "Undefined 8080 opcode: " % number>string % ] "" make throw
+  ] if* ;
+
+: process-interrupts ( cpu -- )
+  #! Process any hardware interrupts
+  [ cpu-cycles ] keep 
+  over 16667 < [
+    2drop
+  ] [ 
+    [ >r 16667 - r> set-cpu-cycles ] keep
+    dup cpu-last-interrupt HEX: 10 = [
+      HEX: 08 over set-cpu-last-interrupt HEX: 08 swap interrupt
+    ] [
+      HEX: 10 over set-cpu-last-interrupt HEX: 10 swap interrupt
+    ] if     
+  ] if ;
+
+: step ( cpu -- )
+  #! Run a single 8080 instruction
+  [ read-instruction ] keep ! n cpu
+  over get-cycles over inc-cycles
+  [ swap instructions dispatch ] keep
+  [ cpu-pc HEX: FFFF bitand ] keep 
+  [ set-cpu-pc ] keep 
+  process-interrupts ;
+
+: peek-instruction ( cpu -- word )
+  #! Return the next instruction from the cpu's program
+  #! counter, but don't increment the counter.
+  [ cpu-pc ] keep read-byte instructions nth first ;
+
+: cpu. ( cpu -- )
+  [ " PC: " write cpu-pc 16 >base 4 CHAR: \s pad-left write ] keep 
+  [ " B: " write cpu-b 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " C: " write cpu-c 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " D: " write cpu-d 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " E: " write cpu-e 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " F: " write cpu-f 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " H: " write cpu-h 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " L: " write cpu-l 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " A: " write cpu-a 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " SP: " write cpu-sp 16 >base 4 CHAR: \s pad-left write ] keep 
+  [ " cycles: " write cpu-cycles number>string 5 CHAR: \s pad-left write ] keep 
+  [ " " write peek-instruction word-name write " " write ] keep
+  nl drop ;
+
+: cpu*. ( cpu -- )
+  [ " PC: " write cpu-pc 16 >base 4 CHAR: \s pad-left write ] keep 
+  [ " B: " write cpu-b 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " C: " write cpu-c 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " D: " write cpu-d 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " E: " write cpu-e 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " F: " write cpu-f 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " H: " write cpu-h 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " L: " write cpu-l 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " A: " write cpu-a 16 >base 2 CHAR: \s pad-left write ] keep 
+  [ " SP: " write cpu-sp 16 >base 4 CHAR: \s pad-left write ] keep 
+  [ " cycles: " write cpu-cycles number>string 5 CHAR: \s pad-left write ] keep 
+  nl drop ;
+
+: test-step ( cpu -- cpu )
+  [ step ] keep dup cpu. ;
+
+: test-cpu ( -- cpu )
+  <cpu> "invaders.rom" over load-rom dup cpu. ;
+
+: test-n ( n -- )
+  test-cpu swap [ test-step ] times ;
+
+: run-n ( cpu n -- cpu )
+  [ dup step ] times ;
+
+: register-lookup ( string -- vector )
+  #! Given a string containing a register name, return a vector
+  #! where the 1st item is the getter and the 2nd is the setter
+  #! for that register.
+  H{
+    { "A"  { cpu-a  set-cpu-a  } }
+    { "B"  { cpu-b  set-cpu-b  } }
+    { "C"  { cpu-c  set-cpu-c  } }
+    { "D"  { cpu-d  set-cpu-d  } }
+    { "E"  { cpu-e  set-cpu-e  } }
+    { "H"  { cpu-h  set-cpu-h  } }
+    { "L"  { cpu-l  set-cpu-l  } }
+    { "AF" { cpu-af set-cpu-af } }
+    { "BC" { cpu-bc set-cpu-bc } }
+    { "DE" { cpu-de set-cpu-de } }
+    { "HL" { cpu-hl set-cpu-hl } }
+    { "SP" { cpu-sp set-cpu-sp } }
+  } at ;
+
+
+: flag-lookup ( string -- vector )
+  #! 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?  } }
+    { "Z"  { flag-z?  } }
+    { "C"  { flag-c? } }
+    { "P"  { flag-p?  } }
+    { "M" { flag-m?  } }
+  } at ;
+
+SYMBOL: $1
+SYMBOL: $2
+SYMBOL: $3
+SYMBOL: $4
+
+: replace-patterns ( vector tree -- tree )
+  #! Copy the tree, replacing each occurence of 
+  #! $1, $2, etc with the relevant item from the 
+  #! given index.
+  dup quotation? over [ ] = not and [ ! vector tree
+    dup first swap 1 tail ! vector car cdr
+    >r dupd replace-patterns ! vector v R: cdr
+    swap r> replace-patterns >r 1quotation r> append
+  ] [ ! vector value
+    dup $1 = [ drop 0 over nth  ] when 
+    dup $2 = [ drop 1 over nth  ] when 
+    dup $3 = [ drop 2 over nth  ] when 
+    dup $4 = [ drop 3 over nth  ] when 
+    nip
+  ] if ;
+
+: test-rp 
+  { 4 5 3 } [ 1 $2 [ $1 4 ] ] replace-patterns ;
+
+: (emulate-RST) ( n cpu -- )
+  #! RST nn
+  [ cpu-sp 2 - dup ] keep ! sp sp cpu
+  [ set-cpu-sp ] keep ! sp cpu
+  [ cpu-pc ] keep ! sp pc cpu
+  swapd [ write-word ] keep ! cpu
+  >r 8 * r> set-cpu-pc ;
+
+: (emulate-CALL) ( cpu -- )
+  #! 205 - CALL nn
+  [ next-word HEX: FFFF bitand ] keep ! addr cpu
+  [ cpu-sp 2 - dup ] keep ! addr sp sp cpu
+  [ set-cpu-sp ] keep ! addr sp cpu
+  [ cpu-pc ] keep ! addr sp pc cpu
+  swapd [ write-word ] keep ! addr cpu
+  set-cpu-pc ;
+
+: (emulate-RLCA) ( cpu -- )
+  #! The content of the accumulator is rotated left
+  #! one position. The low order bit and the carry flag
+  #! are both set to the value shifd out of the high
+  #! order bit position. Only the carry flag is affected.
+  [ cpu-a -7 shift ] keep 
+  over 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
+  [ cpu-a 1 shift HEX: FF bitand ] keep 
+  >r bitor r> set-cpu-a ;
+
+: (emulate-RRCA) ( cpu -- )
+  #! The content of the accumulator is rotated right
+  #! one position. The high order bit and the carry flag
+  #! are both set to the value shifd out of the low
+  #! order bit position. Only the carry flag is affected.
+  [ cpu-a 1 bitand 7 shift ] keep 
+  over 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
+  [ cpu-a 254 bitand -1 shift ] keep 
+  >r bitor r> set-cpu-a ;
+
+: (emulate-RLA) ( cpu -- )  
+  #! The content of the accumulator is rotated left
+  #! one position through the carry flag. The low
+  #! order bit is set equal to the carry flag and
+  #! the carry flag is set to the value shifd out 
+  #! of the high order bit. Only the carry flag is
+  #! affected.
+  [ carry-flag swap flag-set? [ 1 ] [ 0 ] if ] keep 
+  [ cpu-a 127 bitand 7 shift ] keep 
+  dup cpu-a 128 bitand 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
+  >r bitor r> set-cpu-a ;
+
+: (emulate-RRA) ( cpu -- )  
+  #! The content of the accumulator is rotated right
+  #! one position through the carry flag. The high order
+  #! bit is set to the carry flag and the carry flag is
+  #! set to the value shifd out of the low order bit. 
+  #! Only the carry flag is affected.
+  [ carry-flag swap flag-set? [ BIN: 10000000 ] [ 0 ] if ] keep 
+  [ cpu-a 254 bitand -1 shift ] keep 
+  dup cpu-a 1 bitand 0 = [ dup carry-flag clear-flag ] [ dup carry-flag set-flag ] if
+  >r bitor r> set-cpu-a ;
+
+: (emulate-CPL) ( cpu -- )  
+  #! The contents of the accumulator are complemented
+  #! (zero bits become one, one bits becomes zero).
+  #! No flags are affected.
+  HEX: FF swap cpu-a-bitxor= ;
+
+: (emulate-DAA) ( cpu -- )  
+  #! The eight bit number in the accumulator is
+  #! adjusted to form two four-bit binary-coded-decimal
+  #! digits.
+  [
+    dup half-carry-flag swap flag-set? swap 
+    cpu-a BIN: 1111 bitand 9 > or [ 6 ] [ 0 ] if 
+  ] keep 
+  [ cpu-a + ] keep
+  [ update-flags ] 2keep  
+  [ swap HEX: FF bitand swap set-cpu-a ] keep 
+  [
+    dup carry-flag swap flag-set? swap 
+    cpu-a -4 shift BIN: 1111 bitand 9 > or [ 96 ] [ 0 ] if 
+  ] keep 
+  [ cpu-a + ] keep
+  [ update-flags ] 2keep  
+  swap HEX: FF bitand swap set-cpu-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"      [ [ cpu-a ] keep [ next-byte ] keep sub-byte drop ] }
+    { "CP-R"      [ [ cpu-a ] keep [ $1 ] keep sub-byte drop  ] }
+    { "CP-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep sub-byte drop ] }
+    { "OR-N"      [ [ cpu-a ] keep [ next-byte ] keep [ or-byte ] keep set-cpu-a ] }
+    { "OR-R"      [ [ cpu-a ] keep [ $1 ] keep [ or-byte ] keep set-cpu-a ] }
+    { "OR-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ or-byte ] keep set-cpu-a  ] }
+    { "XOR-N"      [ [ cpu-a ] keep [ next-byte ] keep [ xor-byte ] keep set-cpu-a ] }
+    { "XOR-R"      [ [ cpu-a ] keep [ $1 ] keep [ xor-byte ] keep set-cpu-a ] }
+    { "XOR-(RR)"   [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ xor-byte ] keep set-cpu-a  ] }
+    { "AND-N"      [ [ cpu-a ] keep [ next-byte ] keep [ and-byte ] keep set-cpu-a  ] }
+    { "AND-R"      [ [ cpu-a ] keep [ $1 ] keep [ and-byte ] keep set-cpu-a ] }
+    { "AND-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ and-byte ] keep set-cpu-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"      [ [ cpu-a ] keep [ $1 ] keep [ sub-byte ] keep set-cpu-a ] }
+    { "SUB-(RR)"      [ [ cpu-a ] keep [ $1 ] keep [ read-byte ] keep [ sub-byte ] keep set-cpu-a ] }
+    { "SUB-N"      [ [ cpu-a ] keep [ next-byte ] keep [ sub-byte ] keep set-cpu-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"           [ [ cpu-pc ] keep [ read-word ] keep set-cpu-pc ]               }
+    { "JP-F|FF,NN"      [ [ $1 ] keep swap [ [ next-word ] keep [ set-cpu-pc ] keep [ cpu-cycles ] keep swap 5 + swap set-cpu-cycles ] [ [ cpu-pc 2 + ] keep set-cpu-pc ] if ] }
+    { "JP-(RR)"      [ [ $1 ] keep set-cpu-pc ] }
+    { "CALL-NN"         [ (emulate-CALL) ] }
+    { "CALL-F|FF,NN"    [ [ $1 ] keep swap [ 7 over inc-cycles (emulate-CALL) ] [ [ cpu-pc 2 + ] keep set-cpu-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 set-cpu-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 )
+  #! A parser for 8-bit registers. On a successfull parse the
+  #! parse tree contains a vector. The first item in the vector
+  #! is the getter word for that register with stack effect
+  #! ( cpu -- value ). The second item is the setter word with
+  #! stack effect ( value cpu -- ).
+  "A" token 
+  "B" token  <|>
+  "C" token  <|>
+  "D" token  <|>
+  "E" token  <|>
+  "H" token  <|>
+  "L" token  <|> [ register-lookup ] <@ ;
+
+: all-flags
+  #! A parser for 16-bit flags. 
+  "NZ" token  
+  "NC" token <|>
+  "PO" token <|>
+  "PE" token <|> 
+  "Z" token <|> 
+  "C" token <|> 
+  "P" token <|> 
+  "M" token <|> [ flag-lookup ] <@ ;
+
+: 16-bit-registers
+  #! A parser for 16-bit registers. On a successfull parse the
+  #! parse tree contains a vector. The first item in the vector
+  #! is the getter word for that register with stack effect
+  #! ( cpu -- value ). The second item is the setter word with
+  #! stack effect ( value cpu -- ).
+  "AF" token  
+  "BC" token <|>
+  "DE" token <|>
+  "HL" token <|>
+  "SP" token <|> [ register-lookup ] <@ ;
+
+: all-registers ( -- parser )
+  #! Return a parser that can parse the format
+  #! for 8 bit or 16 bit registers. 
+  8-bit-registers 16-bit-registers <|> ;
+
+: indirect ( parser -- parser )
+  #! Given a parser, return a parser which parses the original
+  #! wrapped in brackets, representing an indirect reference.
+  #! eg. BC -> (BC). The value of the original parser is left in
+  #! the parse tree.
+  "(" token swap &> ")" token <& ;
+
+: generate-instruction ( vector string -- quot )
+  #! Generate the quotation for an instruction, given the instruction in 
+  #! the 'string' and a vector containing the arguments for that instruction.
+  patterns at replace-patterns ;
+
+: simple-instruction ( token -- parser )
+  #! Return a parser for then instruction identified by the token. 
+  #! The parser return parses the token only and expects no additional
+  #! arguments to the instruction.
+  token [ [ { } clone , , \ generate-instruction , ] [ ] make ] <@ ;
+
+: complex-instruction ( type token -- parser )
+  #! Return a parser for an instruction identified by the token. 
+  #! The instruction is expected to take additional arguments by 
+  #! being combined with other parsers. Then 'type' is used for a lookup
+  #! in a pattern hashtable to return the instruction quotation pattern.
+  token swap [ nip [ , \ generate-instruction , ] [ ] make ] curry <@ ;
+
+: NOP-instruction ( -- parser )
+  "NOP" simple-instruction ;
+
+: RET-NN-instruction ( -- parser )  
+  "RET-NN" "RET" complex-instruction  
+  "nn" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-0-instruction ( -- parser )  
+  "RST-0" "RST" complex-instruction  
+  "0" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-8-instruction ( -- parser )  
+  "RST-8" "RST" complex-instruction  
+  "8" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-10H-instruction ( -- parser )  
+  "RST-10H" "RST" complex-instruction  
+  "10H" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-18H-instruction ( -- parser )  
+  "RST-18H" "RST" complex-instruction  
+  "18H" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-20H-instruction ( -- parser )  
+  "RST-20H" "RST" complex-instruction  
+  "20H" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-28H-instruction ( -- parser )  
+  "RST-28H" "RST" complex-instruction  
+  "28H" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-30H-instruction ( -- parser )  
+  "RST-30H" "RST" complex-instruction  
+  "30H" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: RST-38H-instruction ( -- parser )  
+  "RST-38H" "RST" complex-instruction  
+  "38H" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: JP-NN-instruction ( -- parser )  
+  "JP-NN" "JP" complex-instruction  
+  "nn" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: JP-F|FF,NN-instruction ( -- parser )
+  "JP-F|FF,NN" "JP" complex-instruction  
+  all-flags sp <&> 
+  ",nn" token <&
+  just [ first2 swap curry ] <@ ;
+
+: JP-(RR)-instruction ( -- parser )
+  "JP-(RR)" "JP" complex-instruction  
+  16-bit-registers indirect sp <&>
+  just [ first2 swap curry ] <@ ;
+
+: CALL-NN-instruction ( -- parser )  
+  "CALL-NN" "CALL" complex-instruction  
+  "nn" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: CALL-F|FF,NN-instruction ( -- parser )
+  "CALL-F|FF,NN" "CALL" complex-instruction  
+  all-flags sp <&> 
+  ",nn" token <&
+  just [ first2 swap curry ] <@ ;
+
+: RLCA-instruction ( -- parser )
+  "RLCA" simple-instruction ;
+
+: RRCA-instruction ( -- parser )
+  "RRCA" simple-instruction ;
+
+: HALT-instruction ( -- parser )
+  "HALT" simple-instruction ;
+
+: DI-instruction ( -- parser )
+  "DI" simple-instruction ;
+
+: EI-instruction ( -- parser )
+  "EI" simple-instruction ;
+
+: CPL-instruction ( -- parser )
+  "CPL" simple-instruction ;
+
+: CCF-instruction ( -- parser )
+  "CCF" simple-instruction ;
+
+: SCF-instruction ( -- parser )
+  "SCF" simple-instruction ;
+
+: DAA-instruction ( -- parser )
+  "DAA" simple-instruction ;
+
+: RLA-instruction ( -- parser )
+  "RLA" simple-instruction ;
+
+: RRA-instruction ( -- parser )
+  "RRA" simple-instruction ;
+
+: DEC-R-instruction ( -- parser )
+  "DEC-R" "DEC" complex-instruction  8-bit-registers sp <&> 
+  just [ first2 swap curry ] <@ ;
+
+: DEC-RR-instruction ( -- parser )
+  "DEC-RR" "DEC" complex-instruction  16-bit-registers sp <&> 
+  just [ first2 swap curry ] <@ ;
+
+: DEC-(RR)-instruction ( -- parser )
+  "DEC-(RR)" "DEC" complex-instruction  
+  16-bit-registers indirect sp <&>
+  just [ first2 swap curry ] <@ ;
+
+: POP-RR-instruction ( -- parser )
+  "POP-RR" "POP" complex-instruction  all-registers sp <&> 
+  just [ first2 swap curry ] <@ ;
+
+: PUSH-RR-instruction ( -- parser )
+  "PUSH-RR" "PUSH" complex-instruction  all-registers sp <&> 
+  just [ first2 swap curry ] <@ ;
+
+: INC-R-instruction ( -- parser )
+  "INC-R" "INC" complex-instruction  8-bit-registers sp <&> 
+  just [ first2 swap curry ] <@ ;
+
+: INC-RR-instruction ( -- parser )
+  "INC-RR" "INC" complex-instruction  16-bit-registers sp <&> 
+  just [ first2 swap curry ] <@ ;
+   
+: INC-(RR)-instruction  ( -- parser )
+  "INC-(RR)" "INC" complex-instruction
+  all-registers indirect sp <&> just [ first2 swap curry ] <@ ;
+
+: RET-F|FF-instruction ( -- parser )
+  "RET-F|FF" "RET" complex-instruction  all-flags sp <&> 
+  just [ first2 swap curry ] <@ ;
+
+: AND-N-instruction ( -- parser )
+  "AND-N" "AND" complex-instruction
+  "n" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: AND-R-instruction  ( -- parser )
+  "AND-R" "AND" complex-instruction
+  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
+
+: AND-(RR)-instruction  ( -- parser )
+  "AND-(RR)" "AND" complex-instruction
+  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
+
+: XOR-N-instruction ( -- parser )
+  "XOR-N" "XOR" complex-instruction
+  "n" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: XOR-R-instruction  ( -- parser )
+  "XOR-R" "XOR" complex-instruction
+  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
+
+: XOR-(RR)-instruction  ( -- parser )
+  "XOR-(RR)" "XOR" complex-instruction
+  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
+
+: OR-N-instruction ( -- parser )
+  "OR-N" "OR" complex-instruction
+  "n" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: OR-R-instruction  ( -- parser )
+  "OR-R" "OR" complex-instruction
+  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
+
+: OR-(RR)-instruction  ( -- parser )
+  "OR-(RR)" "OR" complex-instruction
+  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
+
+: CP-N-instruction ( -- parser )
+  "CP-N" "CP" complex-instruction
+  "n" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: CP-R-instruction  ( -- parser )
+  "CP-R" "CP" complex-instruction
+  8-bit-registers sp <&> just [ first2 swap curry ] <@ ;
+
+: CP-(RR)-instruction  ( -- parser )
+  "CP-(RR)" "CP" complex-instruction
+  16-bit-registers indirect sp <&> just [ first2 swap curry ] <@ ;
+
+: ADC-R,N-instruction ( -- parser )
+  "ADC-R,N" "ADC" complex-instruction
+  8-bit-registers sp <&>
+  ",n" token <& 
+  just [ first2 swap curry ] <@ ;  
+
+: ADC-R,R-instruction ( -- parser )
+  "ADC-R,R" "ADC" complex-instruction
+  8-bit-registers sp <&>
+  "," token <& 
+  8-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: ADC-R,(RR)-instruction ( -- parser )
+  "ADC-R,(RR)" "ADC" complex-instruction
+  8-bit-registers sp <&>
+  "," token <& 
+  16-bit-registers indirect <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: SBC-R,N-instruction ( -- parser )
+  "SBC-R,N" "SBC" complex-instruction
+  8-bit-registers sp <&>
+  ",n" token <& 
+  just [ first2 swap curry ] <@ ;  
+
+: SBC-R,R-instruction ( -- parser )
+  "SBC-R,R" "SBC" complex-instruction
+  8-bit-registers sp <&>
+  "," token <& 
+  8-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry  ] <@ ;  
+
+: SBC-R,(RR)-instruction ( -- parser )
+  "SBC-R,(RR)" "SBC" complex-instruction
+  8-bit-registers sp <&>
+  "," token <& 
+  16-bit-registers indirect  <&>
+  just [ first2 swap first2 swap >r swap append r> curry  ] <@ ;  
+
+: SUB-R-instruction ( -- parser )
+  "SUB-R" "SUB" complex-instruction
+  8-bit-registers sp <&>
+  just [ first2 swap curry ] <@ ;  
+
+: SUB-(RR)-instruction ( -- parser )
+  "SUB-(RR)" "SUB" complex-instruction
+  16-bit-registers indirect sp <&>
+  just [ first2 swap curry ] <@ ;  
+
+: SUB-N-instruction ( -- parser )
+  "SUB-N" "SUB" complex-instruction
+  "n" token sp <&
+  just [ { } clone swap curry  ] <@ ;
+
+: ADD-R,N-instruction ( -- parser )
+  "ADD-R,N" "ADD" complex-instruction
+  8-bit-registers sp <&>
+  ",n" token <& 
+  just [ first2 swap curry ] <@ ;  
+
+: ADD-R,R-instruction ( -- parser )
+  "ADD-R,R" "ADD" complex-instruction
+  8-bit-registers sp <&>
+  "," token <& 
+  8-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: ADD-RR,RR-instruction ( -- parser )
+  "ADD-RR,RR" "ADD" complex-instruction
+  16-bit-registers sp <&>
+  "," token <& 
+  16-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: ADD-R,(RR)-instruction ( -- parser )
+  "ADD-R,(RR)" "ADD" complex-instruction
+  8-bit-registers sp <&>
+  "," token <& 
+  16-bit-registers indirect <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+  
+: LD-RR,NN-instruction
+  #! LD BC,nn
+  "LD-RR,NN" "LD" complex-instruction
+  16-bit-registers sp <&>
+  ",nn" token <& 
+  just [ first2 swap curry ] <@ ;
+
+: LD-R,N-instruction
+  #! LD B,n
+  "LD-R,N" "LD" complex-instruction
+  8-bit-registers sp <&>
+  ",n" token <& 
+  just [ first2 swap curry ] <@ ;
+  
+: LD-(RR),N-instruction
+  "LD-(RR),N" "LD" complex-instruction
+  16-bit-registers indirect sp <&> 
+  ",n" token <&
+  just [ first2 swap curry ] <@ ;
+
+: LD-(RR),R-instruction
+  #! LD (BC),A
+  "LD-(RR),R" "LD" complex-instruction
+  16-bit-registers indirect sp <&> 
+  "," token <&
+  8-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: LD-R,R-instruction
+  "LD-R,R" "LD" complex-instruction
+  8-bit-registers sp <&> 
+  "," token <&
+  8-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: LD-RR,RR-instruction
+  "LD-RR,RR" "LD" complex-instruction
+  16-bit-registers sp <&> 
+  "," token <&
+  16-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: LD-R,(RR)-instruction
+  "LD-R,(RR)" "LD" complex-instruction
+  8-bit-registers sp <&> 
+  "," token <&
+  16-bit-registers indirect <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: LD-(NN),RR-instruction
+  "LD-(NN),RR" "LD" complex-instruction
+  "nn" token indirect sp <&
+  "," token <&
+  16-bit-registers <&>
+  just [ first2 swap curry ] <@ ;
+
+: LD-(NN),R-instruction
+  "LD-(NN),R" "LD" complex-instruction
+  "nn" token indirect sp <&
+  "," token <&
+  8-bit-registers <&>
+  just [ first2 swap curry ] <@ ;
+
+: LD-RR,(NN)-instruction
+  "LD-RR,(NN)" "LD" complex-instruction
+  16-bit-registers sp <&>
+  "," token <&
+  "nn" token indirect <&
+  just [ first2 swap curry ] <@ ;
+
+: LD-R,(NN)-instruction
+  "LD-R,(NN)" "LD" complex-instruction
+  8-bit-registers sp <&>
+  "," token <&
+  "nn" token indirect <&
+  just [ first2 swap curry ] <@ ;
+
+: OUT-(N),R-instruction
+  "OUT-(N),R" "OUT" complex-instruction
+  "n" token indirect sp <&
+  "," token <&
+  8-bit-registers <&>
+  just [ first2 swap curry ] <@ ;
+
+: IN-R,(N)-instruction
+  "IN-R,(N)" "IN" complex-instruction
+  8-bit-registers sp <&>
+  "," token <&
+  "n" token indirect <&
+  just [ first2 swap curry ] <@ ;
+
+: EX-(RR),RR-instruction
+  "EX-(RR),RR" "EX" complex-instruction
+  16-bit-registers indirect sp <&> 
+  "," token <&
+  16-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: EX-RR,RR-instruction
+  "EX-RR,RR" "EX" complex-instruction
+  16-bit-registers sp <&> 
+  "," token <&
+  16-bit-registers <&>
+  just [ first2 swap first2 swap >r swap append r> curry ] <@ ;  
+
+: 8080-generator-parser
+  NOP-instruction 
+  RST-0-instruction <|> 
+  RST-8-instruction <|> 
+  RST-10H-instruction <|> 
+  RST-18H-instruction <|> 
+  RST-20H-instruction <|> 
+  RST-28H-instruction <|> 
+  RST-30H-instruction <|> 
+  RST-38H-instruction <|> 
+  JP-F|FF,NN-instruction <|> 
+  JP-NN-instruction <|> 
+  JP-(RR)-instruction <|> 
+  CALL-F|FF,NN-instruction <|> 
+  CALL-NN-instruction <|> 
+  CPL-instruction <|> 
+  CCF-instruction <|> 
+  SCF-instruction <|> 
+  DAA-instruction <|> 
+  RLA-instruction <|> 
+  RRA-instruction <|> 
+  RLCA-instruction <|> 
+  RRCA-instruction <|> 
+  HALT-instruction <|> 
+  DI-instruction <|> 
+  EI-instruction <|> 
+  AND-N-instruction <|> 
+  AND-R-instruction <|> 
+  AND-(RR)-instruction <|> 
+  XOR-N-instruction <|> 
+  XOR-R-instruction <|> 
+  XOR-(RR)-instruction <|> 
+  OR-N-instruction <|> 
+  OR-R-instruction <|> 
+  OR-(RR)-instruction <|> 
+  CP-N-instruction <|> 
+  CP-R-instruction <|> 
+  CP-(RR)-instruction <|> 
+  DEC-RR-instruction <|> 
+  DEC-R-instruction <|> 
+  DEC-(RR)-instruction <|> 
+  POP-RR-instruction <|> 
+  PUSH-RR-instruction <|> 
+  INC-RR-instruction <|> 
+  INC-R-instruction <|> 
+  INC-(RR)-instruction <|>
+  LD-RR,NN-instruction <|> 
+  LD-R,N-instruction <|> 
+  LD-R,R-instruction <|> 
+  LD-RR,RR-instruction <|> 
+  LD-(RR),N-instruction <|> 
+  LD-(RR),R-instruction <|> 
+  LD-R,(RR)-instruction <|> 
+  LD-(NN),RR-instruction <|> 
+  LD-(NN),R-instruction <|> 
+  LD-RR,(NN)-instruction <|> 
+  LD-R,(NN)-instruction <|> 
+  ADC-R,N-instruction <|> 
+  ADC-R,R-instruction <|> 
+  ADC-R,(RR)-instruction <|> 
+  ADD-R,N-instruction <|> 
+  ADD-R,R-instruction <|> 
+  ADD-RR,RR-instruction <|> 
+  ADD-R,(RR)-instruction <|> 
+  SBC-R,N-instruction <|> 
+  SBC-R,R-instruction <|> 
+  SBC-R,(RR)-instruction <|> 
+  SUB-R-instruction <|> 
+  SUB-(RR)-instruction <|> 
+  SUB-N-instruction <|> 
+  RET-F|FF-instruction <|> 
+  RET-NN-instruction <|>
+  OUT-(N),R-instruction <|>
+  IN-R,(N)-instruction <|>
+  EX-(RR),RR-instruction <|>
+  EX-RR,RR-instruction <|>
+  just ;
+
+: instruction-quotations ( string -- emulate-quot )
+  #! Given an instruction string, return the emulation quotation for
+  #! it. This will later be expanded to produce the disassembly and
+  #! assembly quotations.
+  8080-generator-parser some parse call ;
+
+SYMBOL: last-instruction
+SYMBOL: last-opcode
+
+: parse-instructions ( list -- emulate-quot )
+  #! Process the list of strings, which should make
+  #! up an 8080 instruction, and output a quotation
+  #! that would implement that instruction.
+  dup " " join instruction-quotations
+  >r "_" join [ "emulate-" % % ] "" make create-in dup last-instruction global set-at  
+  r> define-compound ;
+
+: INSTRUCTION: ";" parse-tokens parse-instructions ; parsing
+
+: cycles ( -- )
+  #! Set the number of cycles for the last instruction that was defined. 
+  scan string>number last-opcode global at instruction-cycles set-nth ; parsing
+
+: opcode ( -- )
+  #! Set the opcode number for the last instruction that was defined.
+  last-instruction global at 1quotation scan 16 base>
+  dup last-opcode global set-at instructions set-nth ; parsing
+
+INSTRUCTION: NOP          ; opcode 00 cycles 04 
+INSTRUCTION: LD   BC,nn   ; opcode 01 cycles 10 
+INSTRUCTION: LD   (BC),A  ; opcode 02 cycles 07 
+INSTRUCTION: INC  BC      ; opcode 03 cycles 06 
+INSTRUCTION: INC  B       ; opcode 04 cycles 05 
+INSTRUCTION: DEC  B       ; opcode 05 cycles 05 
+INSTRUCTION: LD   B,n     ; opcode 06 cycles 07 
+INSTRUCTION: RLCA         ; opcode 07 cycles 04 
+! INSTRUCTION: NOP          ; opcode 08 cycles 04 
+INSTRUCTION: ADD  HL,BC   ; opcode 09 cycles 11 
+INSTRUCTION: LD   A,(BC)  ; opcode 0A cycles 07 
+INSTRUCTION: DEC  BC      ; opcode 0B cycles 06 
+INSTRUCTION: INC  C       ; opcode 0C cycles 05 
+INSTRUCTION: DEC  C       ; opcode 0D cycles 05 
+INSTRUCTION: LD   C,n     ; opcode 0E cycles 07 
+INSTRUCTION: RRCA         ; opcode 0F cycles 04 
+INSTRUCTION: LD   DE,nn   ; opcode 11 cycles 10 
+INSTRUCTION: LD   (DE),A  ; opcode 12 cycles 07 
+INSTRUCTION: INC  DE      ; opcode 13 cycles 06 
+INSTRUCTION: INC  D       ; opcode 14 cycles 05 
+INSTRUCTION: DEC  D       ; opcode 15 cycles 05 
+INSTRUCTION: LD   D,n     ; opcode 16 cycles 07 
+INSTRUCTION: RLA          ; opcode 17 cycles 04 
+INSTRUCTION: ADD  HL,DE   ; opcode 19 cycles 11 
+INSTRUCTION: LD   A,(DE)  ; opcode 1A cycles 07 
+INSTRUCTION: DEC  DE      ; opcode 1B cycles 06 
+INSTRUCTION: INC  E       ; opcode 1C cycles 05 
+INSTRUCTION: DEC  E       ; opcode 1D cycles 05 
+INSTRUCTION: LD   E,n     ; opcode 1E cycles 07 
+INSTRUCTION: RRA          ; opcode 1F cycles 04 
+INSTRUCTION: LD   HL,nn   ; opcode 21 cycles 10 
+INSTRUCTION: LD   (nn),HL ; opcode 22 cycles 16 
+INSTRUCTION: INC  HL      ; opcode 23 cycles 06 
+INSTRUCTION: INC  H       ; opcode 24 cycles 05 
+INSTRUCTION: DEC  H       ; opcode 25 cycles 05 
+INSTRUCTION: LD   H,n     ; opcode 26 cycles 07 
+INSTRUCTION: DAA          ; opcode 27 cycles 04 
+INSTRUCTION: ADD  HL,HL   ; opcode 29 cycles 11 
+INSTRUCTION: LD   HL,(nn) ; opcode 2A cycles 16 
+INSTRUCTION: DEC  HL      ; opcode 2B cycles 06 
+INSTRUCTION: INC  L       ; opcode 2C cycles 05 
+INSTRUCTION: DEC  L       ; opcode 2D cycles 05 
+INSTRUCTION: LD   L,n     ; opcode 2E cycles 07 
+INSTRUCTION: CPL          ; opcode 2F cycles 04 
+INSTRUCTION: LD   SP,nn   ; opcode 31 cycles 10 
+INSTRUCTION: LD   (nn),A  ; opcode 32 cycles 13 
+INSTRUCTION: INC  SP      ; opcode 33 cycles 06 
+INSTRUCTION: INC  (HL)    ; opcode 34 cycles 10 
+INSTRUCTION: DEC  (HL)    ; opcode 35 cycles 10 
+INSTRUCTION: LD   (HL),n  ; opcode 36 cycles 10 
+INSTRUCTION: SCF          ; opcode 37 cycles 04 
+INSTRUCTION: ADD  HL,SP   ; opcode 39 cycles 11 
+INSTRUCTION: LD   A,(nn)  ; opcode 3A cycles 13 
+INSTRUCTION: DEC  SP      ; opcode 3B cycles 06 
+INSTRUCTION: INC  A       ; opcode 3C cycles 05 
+INSTRUCTION: DEC  A       ; opcode 3D cycles 05 
+INSTRUCTION: LD   A,n     ; opcode 3E cycles 07 
+INSTRUCTION: CCF          ; opcode 3F cycles 04 
+INSTRUCTION: LD   B,B     ; opcode 40 cycles 05 
+INSTRUCTION: LD   B,C     ; opcode 41 cycles 05 
+INSTRUCTION: LD   B,D     ; opcode 42 cycles 05 
+INSTRUCTION: LD   B,E     ; opcode 43 cycles 05 
+INSTRUCTION: LD   B,H     ; opcode 44 cycles 05 
+INSTRUCTION: LD   B,L     ; opcode 45 cycles 05 
+INSTRUCTION: LD   B,(HL)  ; opcode 46 cycles 07 
+INSTRUCTION: LD   B,A     ; opcode 47 cycles 05 
+INSTRUCTION: LD   C,B     ; opcode 48 cycles 05 
+INSTRUCTION: LD   C,C     ; opcode 49 cycles 05 
+INSTRUCTION: LD   C,D     ; opcode 4A cycles 05 
+INSTRUCTION: LD   C,E     ; opcode 4B cycles 05 
+INSTRUCTION: LD   C,H     ; opcode 4C cycles 05 
+INSTRUCTION: LD   C,L     ; opcode 4D cycles 05 
+INSTRUCTION: LD   C,(HL)  ; opcode 4E cycles 07 
+INSTRUCTION: LD   C,A     ; opcode 4F cycles 05 
+INSTRUCTION: LD   D,B     ; opcode 50 cycles 05 
+INSTRUCTION: LD   D,C     ; opcode 51 cycles 05 
+INSTRUCTION: LD   D,D     ; opcode 52 cycles 05 
+INSTRUCTION: LD   D,E     ; opcode 53 cycles 05 
+INSTRUCTION: LD   D,H     ; opcode 54 cycles 05 
+INSTRUCTION: LD   D,L     ; opcode 55 cycles 05 
+INSTRUCTION: LD   D,(HL)  ; opcode 56 cycles 07 
+INSTRUCTION: LD   D,A     ; opcode 57 cycles 05 
+INSTRUCTION: LD   E,B     ; opcode 58 cycles 05 
+INSTRUCTION: LD   E,C     ; opcode 59 cycles 05 
+INSTRUCTION: LD   E,D     ; opcode 5A cycles 05 
+INSTRUCTION: LD   E,E     ; opcode 5B cycles 05 
+INSTRUCTION: LD   E,H     ; opcode 5C cycles 05 
+INSTRUCTION: LD   E,L     ; opcode 5D cycles 05 
+INSTRUCTION: LD   E,(HL)  ; opcode 5E cycles 07 
+INSTRUCTION: LD   E,A     ; opcode 5F cycles 05 
+INSTRUCTION: LD   H,B     ; opcode 60 cycles 05 
+INSTRUCTION: LD   H,C     ; opcode 61 cycles 05 
+INSTRUCTION: LD   H,D     ; opcode 62 cycles 05 
+INSTRUCTION: LD   H,E     ; opcode 63 cycles 05 
+INSTRUCTION: LD   H,H     ; opcode 64 cycles 05 
+INSTRUCTION: LD   H,L     ; opcode 65 cycles 05 
+INSTRUCTION: LD   H,(HL)  ; opcode 66 cycles 07 
+INSTRUCTION: LD   H,A     ; opcode 67 cycles 05 
+INSTRUCTION: LD   L,B     ; opcode 68 cycles 05 
+INSTRUCTION: LD   L,C     ; opcode 69 cycles 05 
+INSTRUCTION: LD   L,D     ; opcode 6A cycles 05 
+INSTRUCTION: LD   L,E     ; opcode 6B cycles 05 
+INSTRUCTION: LD   L,H     ; opcode 6C cycles 05 
+INSTRUCTION: LD   L,L     ; opcode 6D cycles 05 
+INSTRUCTION: LD   L,(HL)  ; opcode 6E cycles 07 
+INSTRUCTION: LD   L,A     ; opcode 6F cycles 05 
+INSTRUCTION: LD   (HL),B  ; opcode 70 cycles 07 
+INSTRUCTION: LD   (HL),C  ; opcode 71 cycles 07 
+INSTRUCTION: LD   (HL),D  ; opcode 72 cycles 07 
+INSTRUCTION: LD   (HL),E  ; opcode 73 cycles 07 
+INSTRUCTION: LD   (HL),H  ; opcode 74 cycles 07 
+INSTRUCTION: LD   (HL),L  ; opcode 75 cycles 07 
+INSTRUCTION: HALT         ; opcode 76 cycles 07 
+INSTRUCTION: LD   (HL),A  ; opcode 77 cycles 07 
+INSTRUCTION: LD   A,B     ; opcode 78 cycles 05 
+INSTRUCTION: LD   A,C     ; opcode 79 cycles 05 
+INSTRUCTION: LD   A,D     ; opcode 7A cycles 05 
+INSTRUCTION: LD   A,E     ; opcode 7B cycles 05 
+INSTRUCTION: LD   A,H     ; opcode 7C cycles 05 
+INSTRUCTION: LD   A,L     ; opcode 7D cycles 05 
+INSTRUCTION: LD   A,(HL)  ; opcode 7E cycles 07 
+INSTRUCTION: LD   A,A     ; opcode 7F cycles 05 
+INSTRUCTION: ADD  A,B     ; opcode 80 cycles 04 
+INSTRUCTION: ADD  A,C     ; opcode 81 cycles 04 
+INSTRUCTION: ADD  A,D     ; opcode 82 cycles 04 
+INSTRUCTION: ADD  A,E     ; opcode 83 cycles 04 
+INSTRUCTION: ADD  A,H     ; opcode 84 cycles 04 
+INSTRUCTION: ADD  A,L     ; opcode 85 cycles 04 
+INSTRUCTION: ADD  A,(HL)  ; opcode 86 cycles 07 
+INSTRUCTION: ADD  A,A     ; opcode 87 cycles 04 
+INSTRUCTION: ADC  A,B     ; opcode 88 cycles 04 
+INSTRUCTION: ADC  A,C     ; opcode 89 cycles 04 
+INSTRUCTION: ADC  A,D     ; opcode 8A cycles 04 
+INSTRUCTION: ADC  A,E     ; opcode 8B cycles 04 
+INSTRUCTION: ADC  A,H     ; opcode 8C cycles 04 
+INSTRUCTION: ADC  A,L     ; opcode 8D cycles 04 
+INSTRUCTION: ADC  A,(HL)  ; opcode 8E cycles 07 
+INSTRUCTION: ADC  A,A     ; opcode 8F cycles 04 
+INSTRUCTION: SUB  B       ; opcode 90 cycles 04 
+INSTRUCTION: SUB  C       ; opcode 91 cycles 04 
+INSTRUCTION: SUB  D       ; opcode 92 cycles 04 
+INSTRUCTION: SUB  E       ; opcode 93 cycles 04 
+INSTRUCTION: SUB  H       ; opcode 94 cycles 04 
+INSTRUCTION: SUB  L       ; opcode 95 cycles 04 
+INSTRUCTION: SUB  (HL)    ; opcode 96 cycles 07 
+INSTRUCTION: SUB  A       ; opcode 97 cycles 04 
+INSTRUCTION: SBC  A,B     ; opcode 98 cycles 04 
+INSTRUCTION: SBC  A,C     ; opcode 99 cycles 04 
+INSTRUCTION: SBC  A,D     ; opcode 9A cycles 04 
+INSTRUCTION: SBC  A,E     ; opcode 9B cycles 04 
+INSTRUCTION: SBC  A,H     ; opcode 9C cycles 04 
+INSTRUCTION: SBC  A,L     ; opcode 9D cycles 04 
+INSTRUCTION: SBC  A,(HL)  ; opcode 9E cycles 07 
+INSTRUCTION: SBC  A,A     ; opcode 9F cycles 04 
+INSTRUCTION: AND  B       ; opcode A0 cycles 04 
+INSTRUCTION: AND  C       ; opcode A1 cycles 04 
+INSTRUCTION: AND  D       ; opcode A2 cycles 04 
+INSTRUCTION: AND  E       ; opcode A3 cycles 04 
+INSTRUCTION: AND  H       ; opcode A4 cycles 04 
+INSTRUCTION: AND  L       ; opcode A5 cycles 04 
+INSTRUCTION: AND  (HL)    ; opcode A6 cycles 07 
+INSTRUCTION: AND  A       ; opcode A7 cycles 04 
+INSTRUCTION: XOR  B       ; opcode A8 cycles 04 
+INSTRUCTION: XOR  C       ; opcode A9 cycles 04 
+INSTRUCTION: XOR  D       ; opcode AA cycles 04 
+INSTRUCTION: XOR  E       ; opcode AB cycles 04 
+INSTRUCTION: XOR  H       ; opcode AC cycles 04 
+INSTRUCTION: XOR  L       ; opcode AD cycles 04 
+INSTRUCTION: XOR  (HL)    ; opcode AE cycles 07 
+INSTRUCTION: XOR  A       ; opcode AF cycles 04 
+INSTRUCTION: OR   B       ; opcode B0 cycles 04 
+INSTRUCTION: OR   C       ; opcode B1 cycles 04 
+INSTRUCTION: OR   D       ; opcode B2 cycles 04 
+INSTRUCTION: OR   E       ; opcode B3 cycles 04 
+INSTRUCTION: OR   H       ; opcode B4 cycles 04 
+INSTRUCTION: OR   L       ; opcode B5 cycles 04 
+INSTRUCTION: OR   (HL)    ; opcode B6 cycles 07 
+INSTRUCTION: OR   A       ; opcode B7 cycles 04 
+INSTRUCTION: CP   B       ; opcode B8 cycles 04 
+INSTRUCTION: CP   C       ; opcode B9 cycles 04 
+INSTRUCTION: CP   D       ; opcode BA cycles 04 
+INSTRUCTION: CP   E       ; opcode BB cycles 04 
+INSTRUCTION: CP   H       ; opcode BC cycles 04 
+INSTRUCTION: CP   L       ; opcode BD cycles 04 
+INSTRUCTION: CP   (HL)    ; opcode BE cycles 07 
+INSTRUCTION: CP   A       ; opcode BF cycles 04 
+INSTRUCTION: RET  NZ      ; opcode C0 cycles 05 
+INSTRUCTION: POP  BC      ; opcode C1 cycles 10 
+INSTRUCTION: JP   NZ,nn   ; opcode C2 cycles 10 
+INSTRUCTION: JP   nn      ; opcode C3 cycles 10 
+INSTRUCTION: CALL NZ,nn   ; opcode C4 cycles 11 
+INSTRUCTION: PUSH BC      ; opcode C5 cycles 11 
+INSTRUCTION: ADD  A,n     ; opcode C6 cycles 07 
+INSTRUCTION: RST  0       ; opcode C7 cycles 11 
+INSTRUCTION: RET  Z       ; opcode C8 cycles 05 
+INSTRUCTION: RET  nn      ; opcode C9 cycles 10 
+INSTRUCTION: JP   Z,nn    ; opcode CA cycles 10 
+INSTRUCTION: CALL Z,nn    ; opcode CC cycles 11 
+INSTRUCTION: CALL nn      ; opcode CD cycles 17 
+INSTRUCTION: ADC  A,n     ; opcode CE cycles 07 
+INSTRUCTION: RST  8       ; opcode CF cycles 11 
+INSTRUCTION: RET  NC      ; opcode D0 cycles 05 
+INSTRUCTION: POP  DE      ; opcode D1 cycles 10 
+INSTRUCTION: JP   NC,nn   ; opcode D2 cycles 10 
+INSTRUCTION: OUT  (n),A   ; opcode D3 cycles 10 
+INSTRUCTION: CALL NC,nn   ; opcode D4 cycles 11 
+INSTRUCTION: PUSH DE      ; opcode D5 cycles 11 
+INSTRUCTION: SUB  n       ; opcode D6 cycles 07 
+INSTRUCTION: RST  10H     ; opcode D7 cycles 11 
+INSTRUCTION: RET  C       ; opcode D8 cycles 05 
+INSTRUCTION: JP   C,nn    ; opcode DA cycles 10 
+INSTRUCTION: IN   A,(n)   ; opcode DB cycles 10 
+INSTRUCTION: CALL C,nn    ; opcode DC cycles 11 
+INSTRUCTION: SBC  A,n     ; opcode DE cycles 07 
+INSTRUCTION: RST  18H     ; opcode DF cycles 11 
+INSTRUCTION: RET  PO      ; opcode E0 cycles 05 
+INSTRUCTION: POP  HL      ; opcode E1 cycles 10 
+INSTRUCTION: JP   PO,nn   ; opcode E2 cycles 10 
+INSTRUCTION: EX   (SP),HL ; opcode E3 cycles 04 
+INSTRUCTION: CALL PO,nn   ; opcode E4 cycles 11 
+INSTRUCTION: PUSH HL      ; opcode E5 cycles 11 
+INSTRUCTION: AND  n       ; opcode E6 cycles 07 
+INSTRUCTION: RST  20H     ; opcode E7 cycles 11 
+INSTRUCTION: RET  PE      ; opcode E8 cycles 05 
+INSTRUCTION: JP   (HL)    ; opcode E9 cycles 04 
+INSTRUCTION: JP   PE,nn   ; opcode EA cycles 10 
+INSTRUCTION: EX   DE,HL   ; opcode EB cycles 04 
+INSTRUCTION: CALL PE,nn   ; opcode EC cycles 11 
+INSTRUCTION: XOR  n       ; opcode EE cycles 07 
+INSTRUCTION: RST  28H     ; opcode EF cycles 11 
+INSTRUCTION: RET  P       ; opcode F0 cycles 05 
+INSTRUCTION: POP  AF      ; opcode F1 cycles 10 
+INSTRUCTION: JP   P,nn    ; opcode F2 cycles 10 
+INSTRUCTION: DI           ; opcode F3 cycles 04 
+INSTRUCTION: CALL P,nn    ; opcode F4 cycles 11 
+INSTRUCTION: PUSH AF      ; opcode F5 cycles 11 
+INSTRUCTION: OR   n       ; opcode F6 cycles 07 
+INSTRUCTION: RST  30H     ; opcode F7 cycles 11 
+INSTRUCTION: RET  M       ; opcode F8 cycles 05 
+INSTRUCTION: LD   SP,HL   ; opcode F9 cycles 06 
+INSTRUCTION: JP   M,nn    ; opcode FA cycles 10 
+INSTRUCTION: EI           ; opcode FB cycles 04 
+INSTRUCTION: CALL M,nn    ; opcode FC cycles 11 
+INSTRUCTION: CP   n       ; opcode FE cycles 07 
+INSTRUCTION: RST  38H     ; opcode FF cycles 11 
+
+! : each-8bit ( n quot -- )
+!   8 [ ! n quot bit
+!    pick over -1 * shift 1 bitand pick call 
+!   ] repeat 2drop ;
+! 
+! : >ppm ( cpu filename -- cpu )
+!   #! Dump the current screen image to a ppm image file with the given name.
+!   <file-writer> [
+!     "P3" print
+!     "256 224" print
+!     "1" print
+!     224 [
+!       32 [
+!         over 32 * over +  HEX: 2400 + ! cpu h w addr
+!         >r pick r> swap cpu-ram nth [
+!           0 = [
+!             " 0 0 0" write
+!           ] [
+!             " 1 1 1" write
+!           ] if
+!         ] each-8bit
+!       ] repeat nl
+!     ] repeat
+!   ] with-stream ;
+
+: time-test ( -- )
+  test-cpu [ 1000000 run-n ] time ;
+
diff --git a/extra/cryptlib/authors.txt b/extra/cryptlib/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/extra/cryptlib/cryptlib-tests.factor b/extra/cryptlib/cryptlib-tests.factor
new file mode 100644 (file)
index 0000000..8cce407
--- /dev/null
@@ -0,0 +1,376 @@
+USING: cryptlib.libcl cryptlib prettyprint kernel alien sequences libc math 
+tools.test io io.files continuations alien.c-types splitting generic.math ;
+
+"=========================================================" print
+"Envelope/de-envelop test..." print
+"=========================================================" print
+
+[
+    ! envelope
+    CRYPT_FORMAT_CRYPTLIB [
+        "Hello world" set-pop-buffer
+        envelope-handle CRYPT_ENVINFO_DATASIZE
+        get-pop-buffer alien>char-string length set-attribute
+        envelope-handle get-pop-buffer dup alien>char-string length push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle 1024 pop-data
+        get-bytes-copied .
+        pop-buffer-string .
+    ] with-envelope
+
+    ! de-envelope
+    CRYPT_FORMAT_AUTO [
+        envelope-handle get-pop-buffer get-bytes-copied push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle get-bytes-copied pop-data
+        get-bytes-copied .
+        [ "Hello world" ] [ pop-buffer-string ] unit-test
+    ] with-envelope
+
+] with-cryptlib
+
+"=========================================================" print
+"Password encryption test..." print
+"=========================================================" print
+
+[
+    ! envelope
+    CRYPT_FORMAT_CRYPTLIB [
+        envelope-handle CRYPT_ENVINFO_PASSWORD "password" set-attribute-string
+        "Hello world" set-pop-buffer
+        envelope-handle CRYPT_ENVINFO_DATASIZE
+        get-pop-buffer alien>char-string length set-attribute
+        envelope-handle get-pop-buffer dup alien>char-string length push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle 1024 pop-data
+        get-bytes-copied .
+        pop-buffer-string .
+    ] with-envelope
+
+        ! de-envelope
+    CRYPT_FORMAT_AUTO [
+        [ envelope-handle get-pop-buffer get-bytes-copied push-data ] [
+            dup CRYPT_ENVELOPE_RESOURCE = [ 
+                envelope-handle CRYPT_ENVINFO_PASSWORD
+                "password" set-attribute-string 
+            ] [ 
+                rethrow
+            ] if 
+        ] recover drop
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle get-bytes-copied pop-data
+        get-bytes-copied .
+        [ "Hello world" ] [ pop-buffer-string ] unit-test
+    ] with-envelope
+] with-cryptlib
+
+"=========================================================" print
+"Compression test..." print
+"=========================================================" print
+
+[
+    ! envelope
+    CRYPT_FORMAT_CRYPTLIB [
+        envelope-handle CRYPT_ENVINFO_COMPRESSION CRYPT_UNUSED set-attribute
+        "Hello world" set-pop-buffer
+        envelope-handle CRYPT_ENVINFO_DATASIZE
+        get-pop-buffer alien>char-string length set-attribute
+        envelope-handle get-pop-buffer dup alien>char-string length push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle 1024 pop-data
+        get-bytes-copied .
+        pop-buffer-string .
+    ] with-envelope
+
+    ! de-envelope
+    CRYPT_FORMAT_AUTO [
+        envelope-handle get-pop-buffer get-bytes-copied push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle get-bytes-copied pop-data
+        get-bytes-copied .
+        [ "Hello world" ] [ pop-buffer-string ] unit-test
+    ] with-envelope
+] with-cryptlib
+
+"=========================================================" print
+"Conventional encryption test..." print
+"=========================================================" print
+
+[
+    ! envelope
+    CRYPT_FORMAT_CRYPTLIB [
+        CRYPT_ALGO_IDEA [
+            context-handle CRYPT_CTXINFO_KEY "0123456789ABCDEF" set-attribute-string
+            envelope-handle CRYPT_ENVINFO_SESSIONKEY context-handle *int set-attribute
+        ] with-context
+
+        "Hello world" set-pop-buffer
+        envelope-handle CRYPT_ENVINFO_DATASIZE
+        get-pop-buffer alien>char-string length set-attribute
+        envelope-handle get-pop-buffer dup alien>char-string length push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle 1024 pop-data
+        get-bytes-copied .
+        pop-buffer-string .
+    ] with-envelope
+
+    ! de-envelope
+    CRYPT_FORMAT_AUTO [
+        [ envelope-handle get-pop-buffer get-bytes-copied push-data ] [
+            dup CRYPT_ENVELOPE_RESOURCE = [ 
+                CRYPT_ALGO_IDEA create-context
+                context-handle CRYPT_CTXINFO_KEY "0123456789ABCDEF"
+                set-attribute-string
+                envelope-handle CRYPT_ENVINFO_SESSIONKEY context-handle *int 
+                set-attribute
+            ] [ 
+                rethrow 
+            ] if 
+        ] recover drop
+        
+        get-bytes-copied .
+        destroy-context
+        envelope-handle flush-data
+        envelope-handle get-bytes-copied pop-data
+        get-bytes-copied .
+        [ "Hello world" ] [ pop-buffer-string ] unit-test
+    ] with-envelope
+] with-cryptlib
+
+"=========================================================" print
+"Large data size envelope/de-envelop test..." print
+"=========================================================" print
+
+[
+    ! envelope
+    CRYPT_FORMAT_CRYPTLIB [
+        "extra/cryptlib/test/large_data.txt" resource-path <file-reader>
+        contents set-pop-buffer
+        envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE
+        get-pop-buffer alien>char-string length 10000 + set-attribute
+        envelope-handle CRYPT_ENVINFO_DATASIZE
+        get-pop-buffer alien>char-string length set-attribute
+        envelope-handle get-pop-buffer dup alien>char-string length push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle get-pop-buffer alien>char-string length 10000 + pop-data
+        get-bytes-copied .
+        ! pop-buffer-string .
+    ] with-envelope
+
+    ! de-envelope
+    CRYPT_FORMAT_AUTO [
+        envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE
+        get-pop-buffer alien>char-string length 10000 + set-attribute
+        envelope-handle get-pop-buffer get-bytes-copied push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle get-bytes-copied pop-data
+        get-bytes-copied .
+        ! pop-buffer-string .
+        [ "/opt/local/lib/libcl.dylib(dylib1.o):" ] 
+        [ pop-buffer-string "\n" split first ] unit-test
+        [ "00000000 t __mh_dylib_header" ] 
+        [ pop-buffer-string "\n" split last/first first ] unit-test
+    ] with-envelope
+] with-cryptlib
+
+"=========================================================" print
+"Large data size password encryption test..." print
+"=========================================================" print
+
+[
+
+    ! envelope
+    CRYPT_FORMAT_CRYPTLIB [
+        envelope-handle CRYPT_ENVINFO_PASSWORD "password" set-attribute-string
+        "extra/cryptlib/test/large_data.txt" resource-path
+        <file-reader> contents set-pop-buffer
+        envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE
+        get-pop-buffer alien>char-string length 10000 + set-attribute
+        envelope-handle CRYPT_ENVINFO_DATASIZE
+        get-pop-buffer alien>char-string length set-attribute
+        envelope-handle get-pop-buffer dup alien>char-string length push-data
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle get-pop-buffer alien>char-string length 10000 + pop-data
+        get-bytes-copied .
+        pop-buffer-string .
+    ] with-envelope
+    
+    ! de-envelope
+    CRYPT_FORMAT_AUTO [
+        envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE 130000 set-attribute
+        [ envelope-handle get-pop-buffer get-bytes-copied push-data ] [
+            dup CRYPT_ENVELOPE_RESOURCE = [ 
+                envelope-handle CRYPT_ENVINFO_PASSWORD
+                "password" set-attribute-string
+            ] [ 
+                rethrow 
+            ] if 
+        ] recover drop
+
+        get-bytes-copied .
+        envelope-handle flush-data
+        envelope-handle get-bytes-copied pop-data
+        get-bytes-copied .
+        ! pop-buffer-string .
+
+        [ "/opt/local/lib/libcl.dylib(dylib1.o):" ]
+        [ pop-buffer-string "\n" split first ] unit-test
+
+        [ "00000000 t __mh_dylib_header" ] 
+        [ pop-buffer-string "\n" split last/first first ] unit-test
+    ] with-envelope
+] with-cryptlib
+
+"=========================================================" print
+"Generating a key pair test..." print
+"=========================================================" print
+
+[
+    CRYPT_ALGO_RSA [
+        context-handle CRYPT_CTXINFO_LABEL "private key" set-attribute-string
+
+        ! a particular key length can be set (e.g. 1536-bit/192-byte key)
+        context-handle CRYPT_CTXINFO_KEYSIZE 1536 8 / set-attribute
+
+        context-handle generate-key
+
+        CRYPT_KEYSET_FILE "extra/cryptlib/test/keys.p15" resource-path
+        CRYPT_KEYOPT_CREATE [
+            "password" add-private-key
+        ] with-keyset
+    ] with-context
+] with-cryptlib
+
+"Passed" print
+
+"=========================================================" print
+"Simple certificate creation test..." print
+"=========================================================" print
+
+[
+    CRYPT_ALGO_RSA [
+        context-handle CRYPT_CTXINFO_LABEL "private key" set-attribute-string
+        context-handle generate-key
+        CRYPT_KEYSET_FILE "extra/cryptlib/test/keys.p15" resource-path
+        CRYPT_KEYOPT_CREATE [
+            "password" add-private-key
+            CRYPT_CERTTYPE_CERTIFICATE [
+                certificate-handle CRYPT_CERTINFO_XYZZY 1 set-attribute
+                certificate-handle CRYPT_CERTINFO_SUBJECTPUBLICKEYINFO
+                context-handle *int set-attribute
+                certificate-handle CRYPT_CERTINFO_COMMONNAME "Dave Smith"
+                set-attribute-string
+                sign-certificate
+                check-certificate
+                add-public-key
+                f 0 CRYPT_CERTFORMAT_TEXT_CERTIFICATE export-certificate
+                get-cert-length *int dup malloc swap 
+                CRYPT_CERTFORMAT_TEXT_CERTIFICATE export-certificate
+                get-cert-buffer alien>char-string print
+            ] with-certificate
+        ] with-keyset
+    ] with-context
+] with-cryptlib
+
+: ssh-session ( -- )
+    "=========================================================" print
+    "SSH session test..." print
+    "=========================================================" print
+
+    ! start client connection with:
+    ! ssh -v localhost -p3000
+    "waiting for: ssh -v localhost -p3000" print flush
+
+    ! Are you sure you want to continue connecting (yes/no)? yes
+    ! ...
+    ! <at> localhost's password: (any password will be accepted)
+
+    ! If you want to run the test again you should clean the [localhost]:3000 
+    ! ssh-rsa entry in the known_hosts file, in your home directory under the .ssh 
+    ! folder, since the test generates a new RSA certificate on every run.
+
+    [
+        CRYPT_KEYSET_FILE "extra/cryptlib/test/keys.p15" resource-path
+        CRYPT_KEYOPT_READONLY [
+            CRYPT_KEYID_NAME "private key" "password" get-private-key
+        
+            CRYPT_SESSION_SSH_SERVER [
+
+                session-handle CRYPT_SESSINFO_SERVER_NAME "localhost"
+                set-attribute-string
+
+                session-handle CRYPT_SESSINFO_SERVER_PORT 3000 set-attribute
+
+                session-handle CRYPT_SESSINFO_PRIVATEKEY
+            
+                context-handle *int set-attribute
+
+                [ session-handle CRYPT_SESSINFO_ACTIVE 1 set-attribute ] [
+                    dup CRYPT_ENVELOPE_RESOURCE = [
+                        session-handle CRYPT_SESSINFO_AUTHRESPONSE 1
+                        set-attribute
+
+                        session-handle CRYPT_SESSINFO_ACTIVE 1 set-attribute
+
+                        "Welcome to cryptlib, now go away.\r\n" set-pop-buffer
+
+                        session-handle  get-pop-buffer dup alien>char-string
+                        length push-data
+
+                        session-handle flush-data
+                    ] [ 
+                        rethrow 
+                    ] if 
+                ] recover drop
+            ] with-session
+        ] with-keyset
+    ] with-cryptlib
+
+    "Passed" print
+;
+
+: ssl-session ( -- )
+    "=========================================================" print
+    "SSL session test..." print
+    "=========================================================" print
+
+    ! start client connection with:
+    ! curl -k https://localhost:3000
+    "waiting for: curl -k https://localhost:3000" print flush
+
+    [
+        CRYPT_KEYSET_FILE "extra/cryptlib/test/keys.p15" resource-path
+        CRYPT_KEYOPT_READONLY [
+            CRYPT_KEYID_NAME "private key" "password" get-private-key
+
+            CRYPT_SESSION_SSL_SERVER [
+                session-handle CRYPT_SESSINFO_SERVER_NAME "localhost"
+                set-attribute-string
+                session-handle CRYPT_SESSINFO_SERVER_PORT 3000 set-attribute
+                session-handle CRYPT_OPTION_NET_WRITETIMEOUT 10 set-attribute
+                session-handle CRYPT_OPTION_NET_READTIMEOUT 10 set-attribute
+                session-handle CRYPT_OPTION_NET_CONNECTTIMEOUT 10 set-attribute
+                session-handle CRYPT_SESSINFO_PRIVATEKEY
+                context-handle *int set-attribute
+
+                session-handle CRYPT_SESSINFO_ACTIVE 1 set-attribute
+                "Welcome to cryptlib, now go away.\r\n" set-pop-buffer
+                session-handle  get-pop-buffer dup alien>char-string
+                length push-data
+                session-handle flush-data
+            ] with-session
+        ] with-keyset
+    ] with-cryptlib
+
+    "Passed" print
+;
diff --git a/extra/cryptlib/cryptlib.factor b/extra/cryptlib/cryptlib.factor
new file mode 100644 (file)
index 0000000..65d2ffe
--- /dev/null
@@ -0,0 +1,234 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+
+! libs/cryptib/cryptlib.factor
+
+! Adapted from cryptlib.h
+! Tested with cryptlib 3.3.1.0
+USING: cryptlib.libcl kernel hashtables alien math 
+namespaces sequences assocs libc alien.c-types continuations ;
+
+IN: cryptlib
+
+SYMBOL: keyset
+SYMBOL: certificate
+SYMBOL: cert-buffer
+SYMBOL: cert-length
+SYMBOL: context
+SYMBOL: envelope
+SYMBOL: bytes-copied
+SYMBOL: pop-buffer
+SYMBOL: session
+
+! =========================================================
+! Error-handling routines
+! =========================================================
+
+: check-result ( result -- )
+    dup CRYPT_OK = [ 
+        drop
+    ] [
+        dup CRYPT_ENVELOPE_RESOURCE = [
+            throw
+        ] [
+            dup error-messages >hashtable at throw
+        ] if     
+    ] if ;
+
+! =========================================================
+! Secure pointer-freeing routines
+! =========================================================
+
+: secure-free ( ptr n -- )
+    [ dupd 0 -rot set-alien-unsigned-1 ] each free ;
+
+: secure-free-array ( ptr n type -- )
+    heap-size * [ dupd 0 -rot set-alien-unsigned-1 ] each free ;
+
+: secure-free-object ( ptr type -- )
+    1 swap secure-free-array ;
+
+! =========================================================
+! Initialise and shut down cryptlib
+! =========================================================
+
+: init ( -- )
+    cryptInit check-result ;
+
+: end ( -- )
+    cryptEnd check-result ;
+
+: with-cryptlib ( quot -- )
+       [ init [ end ] [ ] cleanup ] with-scope ; inline
+
+! =========================================================
+! Create and destroy an encryption context
+! =========================================================
+
+: create-context ( algo -- )
+    >r "int" <c-object> dup swap CRYPT_UNUSED r> cryptCreateContext
+    check-result context set ;
+
+: destroy-context ( -- )
+    context get [ *int cryptDestroyContext check-result ] when*
+       context off ;
+
+: with-context ( algo quot -- )
+       swap create-context [ destroy-context ] [ ] cleanup ; inline
+
+! =========================================================
+! Keyset routines
+! =========================================================
+
+: open-keyset ( type name options -- )
+    >r >r >r "int" <c-object> dup swap CRYPT_UNUSED r> r> string>char-alien
+    r> cryptKeysetOpen check-result keyset set ;
+
+: close-keyset ( -- )
+    keyset get *int cryptKeysetClose check-result
+       destroy-context ;
+
+: with-keyset ( type name options quot -- )
+       >r open-keyset r> [ close-keyset ] [ ] cleanup ; inline
+
+: get-public-key ( idtype id -- )
+    >r >r keyset get *int "int*" <c-object> tuck r> r> string>char-alien
+    cryptGetPublicKey check-result context set ;
+
+: get-private-key ( idtype id password -- )
+    >r >r >r keyset get *int "int*" <c-object> tuck r>
+    r> string>char-alien r> string>char-alien cryptGetPrivateKey
+    check-result context set ;
+
+: get-key ( idtype id password -- )
+    >r >r >r keyset get *int "int*" <c-object> tuck r>
+    r> string>char-alien r> string>char-alien cryptGetKey
+    check-result context set ;
+
+: add-public-key ( -- )
+    keyset get *int certificate get *int cryptAddPublicKey check-result ;
+
+: add-private-key ( password -- )
+    >r keyset get *int context get *int r> string>char-alien
+    cryptAddPrivateKey check-result ;
+
+: delete-key ( type id -- )
+    >r >r keyset get *int r> r> string>char-alien cryptDeleteKey
+    check-result ;
+
+! =========================================================
+! Certificate routines
+! =========================================================
+
+: create-certificate ( type -- )
+    >r "int" <c-object> dup swap CRYPT_UNUSED r>
+    cryptCreateCert check-result certificate set ;
+
+: destroy-certificate ( -- )
+    certificate get *int cryptDestroyCert check-result ;
+
+: with-certificate ( type quot -- )
+       swap create-certificate [ destroy-certificate ] [ ] cleanup ; inline
+
+: sign-certificate ( -- )
+    certificate get *int context get *int cryptSignCert check-result ;
+
+: check-certificate ( -- )
+    certificate get *int context get *int cryptCheckCert check-result ;
+
+: import-certificate ( certbuffer length -- )
+    >r r> CRYPT_UNUSED "int*" malloc-object dup >r
+    cryptImportCert check-result r> certificate set ;
+
+: export-certificate ( certbuffer maxlength format -- )
+    >r >r dup swap r> "int*" malloc-object dup r> swap >r
+    certificate get *int cryptExportCert check-result
+    cert-buffer set r> cert-length set ;
+
+! =========================================================
+! Generate a key into a context
+! =========================================================
+
+: generate-key ( handle -- )
+    *int cryptGenerateKey check-result ;
+
+! =========================================================
+! Get/set/delete attribute functions
+! =========================================================
+
+: set-attribute ( handle attribute value -- )
+    >r >r *int r> r> cryptSetAttribute check-result ;
+
+: set-attribute-string ( handle attribute value -- )
+    >r >r *int r> r> dup length swap string>char-alien swap
+    cryptSetAttributeString check-result ;
+
+! =========================================================
+! Envelope and Session routines
+! =========================================================
+
+: create-envelope ( format -- )
+    >r "int" <c-object> dup swap CRYPT_UNUSED r> cryptCreateEnvelope
+    check-result envelope set ;
+
+: destroy-envelope ( -- )
+    envelope get *int cryptDestroyEnvelope check-result ;
+
+: with-envelope ( format quot -- )
+       swap create-envelope [ destroy-envelope ] [ ] cleanup ;
+
+: create-session ( format -- )
+    >r "int" <c-object> dup swap CRYPT_UNUSED r> cryptCreateSession
+    check-result session set ;
+
+: destroy-session ( -- )
+    session get *int cryptDestroySession check-result ;
+
+: with-session ( format quot -- )
+       swap create-session [ destroy-session ] [ ] cleanup ;
+
+: push-data ( handle buffer length -- )
+    >r >r *int r> r> "int" <c-object> [ cryptPushData ]
+    keep swap check-result bytes-copied set ;
+
+: flush-data ( handle -- )
+    *int cryptFlushData check-result ;
+
+: pop-data ( handle length -- )
+    dup >r >r *int r> "uchar*" malloc-array 
+    dup r> swap >r "int" <c-object> [ cryptPopData ] keep
+    swap check-result bytes-copied set r> pop-buffer set ;
+
+! =========================================================
+! Public routines
+! =========================================================
+
+: envelope-handle ( -- envelope )
+    envelope get ;
+
+: context-handle ( -- context )
+    context get ;
+
+: certificate-handle ( -- certificate )
+    certificate get ;
+
+: session-handle ( -- session )
+    session get ;
+
+: set-pop-buffer ( data -- )
+    string>char-alien pop-buffer set ;
+
+: get-pop-buffer ( -- buffer )
+    pop-buffer get ;
+
+: pop-buffer-string ( -- s )
+    pop-buffer get alien>char-string ;
+
+: get-bytes-copied ( -- value )
+    bytes-copied get *int ;
+
+: get-cert-buffer ( -- certreq )
+    cert-buffer get ;
+
+: get-cert-length ( -- certlength )
+    cert-length get ;
diff --git a/extra/cryptlib/libcl/libcl.factor b/extra/cryptlib/libcl/libcl.factor
new file mode 100644 (file)
index 0000000..3cc0d50
--- /dev/null
@@ -0,0 +1,1057 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+
+! libs/cryptlib/libcl.factor
+
+! Adapted from cryptlib.h
+! Tested with cryptlib 3.3.1.0
+
+! export LD_LIBRARY_PATH=/opt/local/lib
+
+USING: alien kernel system combinators alien.syntax ;
+
+IN: cryptlib.libcl
+
+: load-libcl ( -- )
+    "libcl" {
+        { [ win32? ] [ "cl32.dll" "stdcall" ] }
+        { [ macosx? ] [ "libcl.dylib" "cdecl" ] }
+        { [ unix? ] [ "libcl.so" "cdecl" ] }
+    } cond add-library ; parsing
+
+load-libcl
+
+! ===============================================
+! Machine-dependant types
+! ===============================================
+
+TYPEDEF: int C_RET
+
+! ===============================================
+! Algorithm and Object Types
+! ===============================================
+
+! Algorithm and mode types
+
+! CRYPT_ALGO_TYPE
+: CRYPT_ALGO_NONE                    0   ; inline ! No encryption
+: CRYPT_ALGO_DES                     1   ; inline ! DES
+: CRYPT_ALGO_3DES                    2   ; inline ! Triple DES
+: CRYPT_ALGO_IDEA                    3   ; inline ! IDEA
+: CRYPT_ALGO_CAST                    4   ; inline ! CAST-128
+: CRYPT_ALGO_RC2                     5   ; inline ! RC2
+: CRYPT_ALGO_RC4                     6   ; inline ! RC4
+: CRYPT_ALGO_RC5                     7   ; inline ! RC5
+: CRYPT_ALGO_AES                     8   ; inline ! AES
+: CRYPT_ALGO_BLOWFISH                9   ; inline ! Blowfish
+: CRYPT_ALGO_SKIPJACK                10  ; inline ! Skipjack
+: CRYPT_ALGO_DH                      100 ; inline ! Diffie-Hellman
+: CRYPT_ALGO_RSA                     101 ; inline ! RSA
+: CRYPT_ALGO_DSA                     102 ; inline ! DSA
+: CRYPT_ALGO_ELGAMAL                 103 ; inline ! ElGamal
+: CRYPT_ALGO_KEA                     104 ; inline ! KEA
+: CRYPT_ALGO_ECDSA                   105 ; inline ! ECDSA
+: CRYPT_ALGO_MD2                     200 ; inline ! MD2
+: CRYPT_ALGO_MD4                     201 ; inline ! MD4
+: CRYPT_ALGO_MD5                     202 ; inline ! MD5
+: CRYPT_ALGO_SHA                     203 ; inline ! SHA/SHA1
+: CRYPT_ALGO_RIPEMD160               204 ; inline ! RIPE-MD 160
+: CRYPT_ALGO_SHA2                    205 ; inline ! SHA2 (SHA-256/384/512)
+: CRYPT_ALGO_HMAC_MD5                300 ; inline ! HMAC-MD5
+: CRYPT_ALGO_HMAC_SHA1               301 ; inline ! HMAC-SHA
+: CRYPT_ALGO_HMAC_SHA                301 ; inline ! Older form
+: CRYPT_ALGO_HMAC_RIPEMD160          302 ; inline ! HMAC-RIPEMD-160
+: CRYPT_ALGO_LAST                    303 ; inline ! Last possible crypt algo value
+: CRYPT_ALGO_FIRST_CONVENTIONAL      1   ; inline
+: CRYPT_ALGO_LAST_CONVENTIONAL       99  ; inline
+: CRYPT_ALGO_FIRST_PKC               100 ; inline
+: CRYPT_ALGO_LAST_PKC                199 ; inline
+: CRYPT_ALGO_FIRST_HASH              200 ; inline
+: CRYPT_ALGO_LAST_HASH               299 ; inline
+: CRYPT_ALGO_FIRST_MAC               300 ; inline
+: CRYPT_ALGO_LAST_MAC                399 ; inline ! End of mac algo.range
+
+TYPEDEF: int CRYPT_ALGO_TYPE
+
+! CRYPT_MODE_TYPE
+: CRYPT_MODE_NONE                    0 ; inline ! No encryption mode
+: CRYPT_MODE_ECB                     1 ; inline ! ECB
+: CRYPT_MODE_CBC                     2 ; inline ! CBC
+: CRYPT_MODE_CFB                     3 ; inline ! CFB
+: CRYPT_MODE_OFB                     4 ; inline ! OFB
+: CRYPT_MODE_LAST                    5 ; inline ! Last possible crypt mode value
+
+
+! Keyset subtypes
+
+! CRYPT_KEYSET_TYPE
+: CRYPT_KEYSET_NONE                   0  ; inline ! No keyset type
+: CRYPT_KEYSET_FILE                   1  ; inline ! Generic flat file keyset
+: CRYPT_KEYSET_HTTP                   2  ; inline ! Web page containing cert/CRL
+: CRYPT_KEYSET_LDAP                   3  ; inline ! LDAP directory service
+: CRYPT_KEYSET_ODBC                   4  ; inline ! Generic ODBC interface
+: CRYPT_KEYSET_DATABASE               5  ; inline ! Generic RDBMS interface
+: CRYPT_KEYSET_PLUGIN                 6  ; inline ! Generic database plugin
+: CRYPT_KEYSET_ODBC_STORE             7  ; inline ! ODBC certificate store
+: CRYPT_KEYSET_DATABASE_STORE         8  ; inline ! Database certificate store
+: CRYPT_KEYSET_PLUGIN_STORE           9  ; inline ! Database plugin certificate store
+: CRYPT_KEYSET_LAST                   10 ; inline ! Last possible keyset type
+
+TYPEDEF: int CRYPT_KEYSET_TYPE
+
+! Device subtypes
+
+! CRYPT_DEVICE_TYPE
+: CRYPT_DEVICE_NONE                   0 ; inline ! No crypto device
+: CRYPT_DEVICE_FORTEZZA               1 ; inline ! Fortezza card
+: CRYPT_DEVICE_PKCS11                 2 ; inline ! PKCS #11 crypto token
+: CRYPT_DEVICE_CRYPTOAPI              3 ; inline ! Microsoft CryptoAPI
+: CRYPT_DEVICE_LAST                   4 ; inline ! Last possible crypto device type
+
+! Certificate subtypes
+
+! CRYPT_CERTTYPE_TYPE
+: CRYPT_CERTTYPE_NONE                 0  ; inline ! No certificate type
+: CRYPT_CERTTYPE_CERTIFICATE          1  ; inline ! Certificate
+: CRYPT_CERTTYPE_ATTRIBUTE_CERT       2  ; inline ! Attribute certificate
+: CRYPT_CERTTYPE_CERTCHAIN            3  ; inline ! PKCS #7 certificate chain
+: CRYPT_CERTTYPE_CERTREQUEST          4  ; inline ! PKCS #10 certification request
+: CRYPT_CERTTYPE_REQUEST_CERT         5  ; inline ! CRMF certification request
+: CRYPT_CERTTYPE_REQUEST_REVOCATION   6  ; inline ! CRMF revocation request
+: CRYPT_CERTTYPE_CRL                  7  ; inline ! CRL
+: CRYPT_CERTTYPE_CMS_ATTRIBUTES       8  ; inline ! CMS attributes
+: CRYPT_CERTTYPE_RTCS_REQUEST         9  ; inline ! RTCS request
+: CRYPT_CERTTYPE_RTCS_RESPONSE        10 ; inline ! RTCS response
+: CRYPT_CERTTYPE_OCSP_REQUEST         11 ; inline ! OCSP request
+: CRYPT_CERTTYPE_OCSP_RESPONSE        12 ; inline ! OCSP response
+: CRYPT_CERTTYPE_PKIUSER              13 ; inline ! PKI user information
+: CRYPT_CERTTYPE_LAST                 14 ; inline ! Last possible cert.type
+
+TYPEDEF: int CRYPT_CERTTYPE_TYPE
+
+! Envelope/data format subtypes
+
+! CRYPT_FORMAT_TYPE
+: CRYPT_FORMAT_NONE                   0 ; inline ! No format type
+: CRYPT_FORMAT_AUTO                   1 ; inline ! Deenv, auto-determine type
+: CRYPT_FORMAT_CRYPTLIB               2 ; inline ! cryptlib native format
+: CRYPT_FORMAT_CMS                    3 ; inline ! PKCS #7 / CMS / S/MIME fmt.
+: CRYPT_FORMAT_PKCS7                  3 ; inline
+: CRYPT_FORMAT_SMIME                  4 ; inline ! As CMS with MSG-style behaviour
+: CRYPT_FORMAT_PGP                    5 ; inline ! PGP format
+: CRYPT_FORMAT_LAST                   6 ; inline ! Last possible format type
+
+TYPEDEF: int CRYPT_FORMAT_TYPE
+
+! Session subtypes
+
+! CRYPT_SESSION_TYPE
+: CRYPT_SESSION_NONE                  0  ; inline ! No session type
+: CRYPT_SESSION_SSH                   1  ; inline ! SSH
+: CRYPT_SESSION_SSH_SERVER            2  ; inline ! SSH server
+: CRYPT_SESSION_SSL                   3  ; inline ! SSL/TLS
+: CRYPT_SESSION_SSL_SERVER            4  ; inline ! SSL/TLS server
+: CRYPT_SESSION_RTCS                  5  ; inline ! RTCS
+: CRYPT_SESSION_RTCS_SERVER           6  ; inline ! RTCS server
+: CRYPT_SESSION_OCSP                  7  ; inline ! OCSP
+: CRYPT_SESSION_OCSP_SERVER           8  ; inline ! OCSP server
+: CRYPT_SESSION_TSP                   9  ; inline ! TSP
+: CRYPT_SESSION_TSP_SERVER            10 ; inline ! TSP server
+: CRYPT_SESSION_CMP                   11 ; inline ! CMP
+: CRYPT_SESSION_CMP_SERVER            12 ; inline ! CMP server
+: CRYPT_SESSION_SCEP                  13 ; inline ! SCEP
+: CRYPT_SESSION_SCEP_SERVER           14 ; inline ! SCEP server
+: CRYPT_SESSION_CERTSTORE_SERVER      15 ; inline ! HTTP cert store interface
+: CRYPT_SESSION_LAST                  16 ; inline ! Last possible session type
+
+TYPEDEF: int CRYPT_SESSION_TYPE
+
+! User subtypes
+
+! CRYPT_USER_TYPE
+: CRYPT_USER_NONE                     0 ; inline ! No user type
+: CRYPT_USER_NORMAL                   1 ; inline ! Normal user
+: CRYPT_USER_SO                       2 ; inline ! Security officer
+: CRYPT_USER_CA                       3 ; inline ! CA user
+: CRYPT_USER_LAST                     4 ; inline ! Last possible user type
+
+! ===============================================
+! Attribute Types
+! ===============================================
+
+! Attribute types.  These are arranged in the following order:
+!
+!   PROPERTY    - Object property
+!   ATTRIBUTE   - Generic attributes
+!   OPTION      - Global or object-specific config.option
+!   CTXINFO     - Context-specific attribute
+!   CERTINFO    - Certificate-specific attribute
+!   KEYINFO     - Keyset-specific attribute
+!   DEVINFO     - Device-specific attribute
+!   ENVINFO     - Envelope-specific attribute
+!   SESSINFO    - Session-specific attribute
+!   USERINFO    - User-specific attribute
+
+! CRYPT_ATTRIBUTE_TYPE
+: CRYPT_ATTRIBUTE_NONE                                0    ; inline ! Non-value
+: CRYPT_PROPERTY_FIRST                                1    ; inline ! *******************
+: CRYPT_PROPERTY_HIGHSECURITY                         2    ; inline ! Owned+non-forwardcount+locked
+: CRYPT_PROPERTY_OWNER                                3    ; inline ! Object owner
+: CRYPT_PROPERTY_FORWARDCOUNT                         4    ; inline ! No.of times object can be forwarded
+: CRYPT_PROPERTY_LOCKED                               5    ; inline ! Whether properties can be chged/read
+: CRYPT_PROPERTY_USAGECOUNT                           6    ; inline ! Usage count before object expires
+: CRYPT_PROPERTY_NONEXPORTABLE                        7    ; inline ! Whether key is nonexp.from context
+: CRYPT_PROPERTY_LAST                                 8    ; inline
+: CRYPT_GENERIC_FIRST                                 9    ; inline ! Extended error information
+: CRYPT_ATTRIBUTE_ERRORTYPE                           10   ; inline ! Type of last error
+: CRYPT_ATTRIBUTE_ERRORLOCUS                          11   ; inline ! Locus of last error
+: CRYPT_ATTRIBUTE_INT_ERRORCODE                       12   ; inline ! Low-level software-specific
+: CRYPT_ATTRIBUTE_INT_ERRORMESSAGE                    13   ; inline ! error code and message
+: CRYPT_ATTRIBUTE_CURRENT_GROUP                       14   ; inline ! Cursor mgt: Group in attribute list
+: CRYPT_ATTRIBUTE_CURRENT                             15   ; inline ! Cursor mgt: Entry in attribute list
+: CRYPT_ATTRIBUTE_CURRENT_INSTANCE                    16   ; inline ! Cursor mgt: Instance in attribute list
+: CRYPT_ATTRIBUTE_BUFFERSIZE                          17   ; inline ! Internal data buffer size
+: CRYPT_GENERIC_LAST                                  18   ; inline
+: CRYPT_OPTION_FIRST                                  100  ; inline ! **************************
+: CRYPT_OPTION_INFO_DESCRIPTION                       101  ; inline ! Text description
+: CRYPT_OPTION_INFO_COPYRIGHT                         102  ; inline ! Copyright notice
+: CRYPT_OPTION_INFO_MAJORVERSION                      103  ; inline ! Major release version
+: CRYPT_OPTION_INFO_MINORVERSION                      104  ; inline ! Minor release version
+: CRYPT_OPTION_INFO_STEPPING                          105  ; inline ! Release stepping
+: CRYPT_OPTION_ENCR_ALGO                              106  ; inline ! Encryption algorithm
+: CRYPT_OPTION_ENCR_HASH                              107  ; inline ! Hash algorithm
+: CRYPT_OPTION_ENCR_MAC                               108  ; inline ! MAC algorithm
+: CRYPT_OPTION_PKC_ALGO                               109  ; inline ! Public-key encryption algorithm
+: CRYPT_OPTION_PKC_KEYSIZE                            110  ; inline ! Public-key encryption key size
+: CRYPT_OPTION_SIG_ALGO                               111  ; inline ! Signature algorithm
+: CRYPT_OPTION_SIG_KEYSIZE                            112  ; inline ! Signature keysize
+: CRYPT_OPTION_KEYING_ALGO                            113  ; inline ! Key processing algorithm
+: CRYPT_OPTION_KEYING_ITERATIONS                      114  ; inline ! Key processing iterations
+: CRYPT_OPTION_CERT_SIGNUNRECOGNISEDATTRIBUTES        115  ; inline ! Whether to sign unrecog.attrs
+: CRYPT_OPTION_CERT_VALIDITY                          116  ; inline ! Certificate validity period
+: CRYPT_OPTION_CERT_UPDATEINTERVAL                    117  ; inline ! CRL update interval
+: CRYPT_OPTION_CERT_COMPLIANCELEVEL                   118  ; inline ! PKIX compliance level for cert chks.
+: CRYPT_OPTION_CERT_REQUIREPOLICY                     119  ; inline ! Whether explicit policy req'd for certs
+: CRYPT_OPTION_CMS_DEFAULTATTRIBUTES                  120  ; inline ! Add default CMS attributes
+: CRYPT_OPTION_SMIME_DEFAULTATTRIBUTES                120  ; inline ! LDAP keyset options
+: CRYPT_OPTION_KEYS_LDAP_OBJECTCLASS                  121  ; inline ! Object class
+: CRYPT_OPTION_KEYS_LDAP_OBJECTTYPE                   122  ; inline ! Object type to fetch
+: CRYPT_OPTION_KEYS_LDAP_FILTER                       123  ; inline ! Query filter
+: CRYPT_OPTION_KEYS_LDAP_CACERTNAME                   124  ; inline ! CA certificate attribute name
+: CRYPT_OPTION_KEYS_LDAP_CERTNAME                     125  ; inline ! Certificate attribute name
+: CRYPT_OPTION_KEYS_LDAP_CRLNAME                      126  ; inline ! CRL attribute name
+: CRYPT_OPTION_KEYS_LDAP_EMAILNAME                    127  ; inline ! Email attribute name
+: CRYPT_OPTION_DEVICE_PKCS11_DVR01                    128  ; inline ! Name of first PKCS #11 driver
+: CRYPT_OPTION_DEVICE_PKCS11_DVR02                    129  ; inline ! Name of second PKCS #11 driver
+: CRYPT_OPTION_DEVICE_PKCS11_DVR03                    130  ; inline ! Name of third PKCS #11 driver
+: CRYPT_OPTION_DEVICE_PKCS11_DVR04                    131  ; inline ! Name of fourth PKCS #11 driver
+: CRYPT_OPTION_DEVICE_PKCS11_DVR05                    132  ; inline ! Name of fifth PKCS #11 driver
+: CRYPT_OPTION_DEVICE_PKCS11_HARDWAREONLY             133  ; inline ! Use only hardware mechanisms
+: CRYPT_OPTION_NET_SOCKS_SERVER                       134  ; inline ! Socks server name
+: CRYPT_OPTION_NET_SOCKS_USERNAME                     135  ; inline ! Socks user name
+: CRYPT_OPTION_NET_HTTP_PROXY                         136  ; inline ! Web proxy server
+: CRYPT_OPTION_NET_CONNECTTIMEOUT                     137  ; inline ! Timeout for network connection setup
+: CRYPT_OPTION_NET_READTIMEOUT                        138  ; inline ! Timeout for network reads
+: CRYPT_OPTION_NET_WRITETIMEOUT                       139  ; inline ! Timeout for network writes
+: CRYPT_OPTION_MISC_ASYNCINIT                         140  ; inline ! Whether to init cryptlib async'ly
+: CRYPT_OPTION_MISC_SIDECHANNELPROTECTION             141  ; inline ! Protect against side-channel attacks
+: CRYPT_OPTION_CONFIGCHANGED                          142  ; inline ! Whether in-mem.opts match on-disk ones
+: CRYPT_OPTION_SELFTESTOK                             143  ; inline ! Whether self-test was completed and OK
+: CRYPT_OPTION_LAST                                   144  ; inline
+: CRYPT_CTXINFO_FIRST                                 1000 ; inline ! ********************
+: CRYPT_CTXINFO_ALGO                                  1001 ; inline ! Algorithm
+: CRYPT_CTXINFO_MODE                                  1002 ; inline ! Mode
+: CRYPT_CTXINFO_NAME_ALGO                             1003 ; inline ! Algorithm name
+: CRYPT_CTXINFO_NAME_MODE                             1004 ; inline ! Mode name
+: CRYPT_CTXINFO_KEYSIZE                               1005 ; inline ! Key size in bytes
+: CRYPT_CTXINFO_BLOCKSIZE                             1006 ; inline ! Block size
+: CRYPT_CTXINFO_IVSIZE                                1007 ; inline ! IV size
+: CRYPT_CTXINFO_KEYING_ALGO                           1008 ; inline ! Key processing algorithm
+: CRYPT_CTXINFO_KEYING_ITERATIONS                     1009 ; inline ! Key processing iterations
+: CRYPT_CTXINFO_KEYING_SALT                           1010 ; inline ! Key processing salt
+: CRYPT_CTXINFO_KEYING_VALUE                          1011 ; inline ! Value used to derive key
+: CRYPT_CTXINFO_KEY                                   1012 ; inline ! Key
+: CRYPT_CTXINFO_KEY_COMPONENTS                        1013 ; inline ! Public-key components
+: CRYPT_CTXINFO_IV                                    1014 ; inline ! IV
+: CRYPT_CTXINFO_HASHVALUE                             1015 ; inline ! Hash value
+: CRYPT_CTXINFO_LABEL                                 1016 ; inline ! Label for private/secret key
+: CRYPT_CTXINFO_PERSISTENT                            1017 ; inline ! Obj.is backed by device or keyset
+: CRYPT_CTXINFO_LAST                                  1018 ; inline
+: CRYPT_CERTINFO_FIRST                                2000 ; inline ! ************************
+: CRYPT_CERTINFO_SELFSIGNED                           2001 ; inline ! Cert is self-signed
+: CRYPT_CERTINFO_IMMUTABLE                            2002 ; inline ! Cert is signed and immutable
+: CRYPT_CERTINFO_XYZZY                                2003 ; inline ! Cert is a magic just-works cert
+: CRYPT_CERTINFO_CERTTYPE                             2004 ; inline ! Certificate object type
+: CRYPT_CERTINFO_FINGERPRINT                          2005 ; inline ! Certificate fingerprints
+: CRYPT_CERTINFO_FINGERPRINT_MD5                      2005 ; inline
+: CRYPT_CERTINFO_FINGERPRINT_SHA                      2006 ; inline
+: CRYPT_CERTINFO_CURRENT_CERTIFICATE                  2007 ; inline ! Cursor mgt: Rel.pos in chain/CRL/OCSP
+: CRYPT_CERTINFO_TRUSTED_USAGE                        2008 ; inline ! Usage that cert is trusted for
+: CRYPT_CERTINFO_TRUSTED_IMPLICIT                     2009 ; inline ! Whether cert is implicitly trusted
+: CRYPT_CERTINFO_SIGNATURELEVEL                       2010 ; inline ! Amount of detail to include in sigs.
+: CRYPT_CERTINFO_VERSION                              2011 ; inline ! Cert.format version
+: CRYPT_CERTINFO_SERIALNUMBER                         2012 ; inline ! Serial number
+: CRYPT_CERTINFO_SUBJECTPUBLICKEYINFO                 2013 ; inline ! Public key
+: CRYPT_CERTINFO_CERTIFICATE                          2014 ; inline ! User certificate
+: CRYPT_CERTINFO_USERCERTIFICATE                      2014 ; inline
+: CRYPT_CERTINFO_CACERTIFICATE                        2015 ; inline ! CA certificate
+: CRYPT_CERTINFO_ISSUERNAME                           2016 ; inline ! Issuer DN
+: CRYPT_CERTINFO_VALIDFROM                            2017 ; inline ! Cert valid-from time
+: CRYPT_CERTINFO_VALIDTO                              2018 ; inline ! Cert valid-to time
+: CRYPT_CERTINFO_SUBJECTNAME                          2019 ; inline ! Subject DN
+: CRYPT_CERTINFO_ISSUERUNIQUEID                       2020 ; inline ! Issuer unique ID
+: CRYPT_CERTINFO_SUBJECTUNIQUEID                      2021 ; inline ! Subject unique ID
+: CRYPT_CERTINFO_CERTREQUEST                          2022 ; inline ! Cert.request (DN + public key)
+: CRYPT_CERTINFO_THISUPDATE                           2023 ; inline ! CRL/OCSP current-update time
+: CRYPT_CERTINFO_NEXTUPDATE                           2024 ; inline ! CRL/OCSP next-update time
+: CRYPT_CERTINFO_REVOCATIONDATE                       2025 ; inline ! CRL/OCSP cert-revocation time
+: CRYPT_CERTINFO_REVOCATIONSTATUS                     2026 ; inline ! OCSP revocation status
+: CRYPT_CERTINFO_CERTSTATUS                           2027 ; inline ! RTCS certificate status
+: CRYPT_CERTINFO_DN                                   2028 ; inline ! Currently selected DN in string form
+: CRYPT_CERTINFO_PKIUSER_ID                           2029 ; inline ! PKI user ID
+: CRYPT_CERTINFO_PKIUSER_ISSUEPASSWORD                2030 ; inline ! PKI user issue password
+: CRYPT_CERTINFO_PKIUSER_REVPASSWORD                  2031 ; inline ! PKI user revocation password
+: CRYPT_CERTINFO_COUNTRYNAME                          2100 ; inline ! countryName
+: CRYPT_CERTINFO_STATEORPROVINCENAME                  2101 ; inline ! stateOrProvinceName
+: CRYPT_CERTINFO_LOCALITYNAME                         2102 ; inline ! localityName
+: CRYPT_CERTINFO_ORGANIZATIONNAME                     2103 ; inline ! organizationName
+: CRYPT_CERTINFO_ORGANISATIONNAME                     2103 ; inline
+: CRYPT_CERTINFO_ORGANIZATIONALUNITNAME               2104 ; inline ! organizationalUnitName
+: CRYPT_CERTINFO_ORGANISATIONALUNITNAME               2104 ; inline
+: CRYPT_CERTINFO_COMMONNAME                           2105 ; inline ! commonName
+: CRYPT_CERTINFO_OTHERNAME_TYPEID                     2106 ; inline ! otherName.typeID
+: CRYPT_CERTINFO_OTHERNAME_VALUE                      2107 ; inline ! otherName.value
+: CRYPT_CERTINFO_RFC822NAME                           2108 ; inline ! rfc822Name
+: CRYPT_CERTINFO_EMAIL                                2108 ; inline
+: CRYPT_CERTINFO_DNSNAME                              2109 ; inline ! dNSName
+: CRYPT_CERTINFO_DIRECTORYNAME                        2110 ; inline ! directoryName
+: CRYPT_CERTINFO_EDIPARTYNAME_NAMEASSIGNER            2111 ; inline ! ediPartyName.nameAssigner
+: CRYPT_CERTINFO_EDIPARTYNAME_PARTYNAME               2112 ; inline ! ediPartyName.partyName
+: CRYPT_CERTINFO_UNIFORMRESOURCEIDENTIFIER            2113 ; inline ! uniformResourceIdentifier
+: CRYPT_CERTINFO_IPADDRESS                            2114 ; inline ! iPAddress
+: CRYPT_CERTINFO_REGISTEREDID                         2115 ; inline ! registeredID
+: CRYPT_CERTINFO_CHALLENGEPASSWORD                    2200 ; inline ! 1 3 6 1 4 1 3029 3 1 4 cRLExtReason
+: CRYPT_CERTINFO_CRLEXTREASON                         2201 ; inline ! 1 3 6 1 4 1 3029 3 1 5 keyFeatures
+: CRYPT_CERTINFO_KEYFEATURES                          2202 ; inline ! 1 3 6 1 5 5 7 1 1 authorityInfoAccess
+: CRYPT_CERTINFO_AUTHORITYINFOACCESS                  2203 ; inline
+: CRYPT_CERTINFO_AUTHORITYINFO_RTCS                   2204 ; inline ! accessDescription.accessLocation
+: CRYPT_CERTINFO_AUTHORITYINFO_OCSP                   2205 ; inline ! accessDescription.accessLocation
+: CRYPT_CERTINFO_AUTHORITYINFO_CAISSUERS              2206 ; inline ! accessDescription.accessLocation
+: CRYPT_CERTINFO_AUTHORITYINFO_CERTSTORE              2207 ; inline ! accessDescription.accessLocation
+: CRYPT_CERTINFO_AUTHORITYINFO_CRLS                   2208 ; inline ! accessDescription.accessLocation
+: CRYPT_CERTINFO_BIOMETRICINFO                        2209 ; inline
+: CRYPT_CERTINFO_BIOMETRICINFO_TYPE                   2210 ; inline ! biometricData.typeOfData
+: CRYPT_CERTINFO_BIOMETRICINFO_HASHALGO               2211 ; inline ! biometricData.hashAlgorithm
+: CRYPT_CERTINFO_BIOMETRICINFO_HASH                   2212 ; inline ! biometricData.dataHash
+: CRYPT_CERTINFO_BIOMETRICINFO_URL                    2213 ; inline ! biometricData.sourceDataUri
+: CRYPT_CERTINFO_QCSTATEMENT                          2214 ; inline
+: CRYPT_CERTINFO_QCSTATEMENT_SEMANTICS                2215 ; inline ! qcStatement.statementInfo.semanticsIdentifier
+: CRYPT_CERTINFO_QCSTATEMENT_REGISTRATIONAUTHORITY    2216 ; inline ! qcStatement.statementInfo.nameRegistrationAuthorities
+: CRYPT_CERTINFO_OCSP_NONCE                           2217 ; inline ! nonce
+: CRYPT_CERTINFO_OCSP_RESPONSE                        2218 ; inline
+: CRYPT_CERTINFO_OCSP_RESPONSE_OCSP                   2219 ; inline ! OCSP standard response
+: CRYPT_CERTINFO_OCSP_NOCHECK                         2220 ; inline ! 1 3 6 1 5 5 7 48 1 6 ocspArchiveCutoff
+: CRYPT_CERTINFO_OCSP_ARCHIVECUTOFF                   2221 ; inline ! 1 3 6 1 5 5 7 48 1 11 subjectInfoAccess
+: CRYPT_CERTINFO_SUBJECTINFOACCESS                    2222 ; inline
+: CRYPT_CERTINFO_SUBJECTINFO_CAREPOSITORY             2223 ; inline ! accessDescription.accessLocation
+: CRYPT_CERTINFO_SUBJECTINFO_TIMESTAMPING             2224 ; inline ! accessDescription.accessLocation
+: CRYPT_CERTINFO_SIGG_DATEOFCERTGEN                   2225 ; inline ! 1 3 36 8 3 2 siggProcuration
+: CRYPT_CERTINFO_SIGG_PROCURATION                     2226 ; inline
+: CRYPT_CERTINFO_SIGG_PROCURE_COUNTRY                 2227 ; inline ! country
+: CRYPT_CERTINFO_SIGG_PROCURE_TYPEOFSUBSTITUTION      2228 ; inline ! typeOfSubstitution
+: CRYPT_CERTINFO_SIGG_PROCURE_SIGNINGFOR              2229 ; inline ! signingFor.thirdPerson
+: CRYPT_CERTINFO_SIGG_MONETARYLIMIT                   2230 ; inline
+: CRYPT_CERTINFO_SIGG_MONETARY_CURRENCY               2231 ; inline ! currency
+: CRYPT_CERTINFO_SIGG_MONETARY_AMOUNT                 2232 ; inline ! amount
+: CRYPT_CERTINFO_SIGG_MONETARY_EXPONENT               2233 ; inline ! exponent
+: CRYPT_CERTINFO_SIGG_RESTRICTION                     2234 ; inline ! 1 3 101 1 4 1 strongExtranet
+: CRYPT_CERTINFO_STRONGEXTRANET                       2235 ; inline
+: CRYPT_CERTINFO_STRONGEXTRANET_ZONE                  2236 ; inline ! sxNetIDList.sxNetID.zone
+: CRYPT_CERTINFO_STRONGEXTRANET_ID                    2237 ; inline ! sxNetIDList.sxNetID.id
+: CRYPT_CERTINFO_SUBJECTDIRECTORYATTRIBUTES           2238 ; inline
+: CRYPT_CERTINFO_SUBJECTDIR_TYPE                      2239 ; inline ! attribute.type
+: CRYPT_CERTINFO_SUBJECTDIR_VALUES                    2240 ; inline ! attribute.values
+: CRYPT_CERTINFO_SUBJECTKEYIDENTIFIER                 2241 ; inline ! 2 5 29 15 keyUsage
+: CRYPT_CERTINFO_KEYUSAGE                             2242 ; inline ! 2 5 29 16 privateKeyUsagePeriod
+: CRYPT_CERTINFO_PRIVATEKEYUSAGEPERIOD                2243 ; inline
+: CRYPT_CERTINFO_PRIVATEKEY_NOTBEFORE                 2244 ; inline ! notBefore
+: CRYPT_CERTINFO_PRIVATEKEY_NOTAFTER                  2245 ; inline ! notAfter
+: CRYPT_CERTINFO_SUBJECTALTNAME                       2246 ; inline ! 2 5 29 18 issuerAltName
+: CRYPT_CERTINFO_ISSUERALTNAME                        2247 ; inline ! 2 5 29 19 basicConstraints
+: CRYPT_CERTINFO_BASICCONSTRAINTS                     2248 ; inline
+: CRYPT_CERTINFO_CA                                   2249 ; inline ! cA
+: CRYPT_CERTINFO_AUTHORITY                            2249 ; inline
+: CRYPT_CERTINFO_PATHLENCONSTRAINT                    2250 ; inline ! pathLenConstraint
+: CRYPT_CERTINFO_CRLNUMBER                            2251 ; inline ! 2 5 29 21 cRLReason
+: CRYPT_CERTINFO_CRLREASON                            2252 ; inline ! 2 5 29 23 holdInstructionCode
+: CRYPT_CERTINFO_HOLDINSTRUCTIONCODE                  2253 ; inline ! 2 5 29 24 invalidityDate
+: CRYPT_CERTINFO_INVALIDITYDATE                       2254 ; inline ! 2 5 29 27 deltaCRLIndicator
+: CRYPT_CERTINFO_DELTACRLINDICATOR                    2255 ; inline ! 2 5 29 28 issuingDistributionPoint
+: CRYPT_CERTINFO_ISSUINGDISTRIBUTIONPOINT             2256 ; inline
+: CRYPT_CERTINFO_ISSUINGDIST_FULLNAME                 2257 ; inline ! distributionPointName.fullName
+: CRYPT_CERTINFO_ISSUINGDIST_USERCERTSONLY            2258 ; inline ! onlyContainsUserCerts
+: CRYPT_CERTINFO_ISSUINGDIST_CACERTSONLY              2259 ; inline ! onlyContainsCACerts
+: CRYPT_CERTINFO_ISSUINGDIST_SOMEREASONSONLY          2260 ; inline ! onlySomeReasons
+: CRYPT_CERTINFO_ISSUINGDIST_INDIRECTCRL              2261 ; inline ! indirectCRL
+: CRYPT_CERTINFO_CERTIFICATEISSUER                    2262 ; inline ! 2 5 29 30 nameConstraints
+: CRYPT_CERTINFO_NAMECONSTRAINTS                      2263 ; inline
+: CRYPT_CERTINFO_PERMITTEDSUBTREES                    2264 ; inline ! permittedSubtrees
+: CRYPT_CERTINFO_EXCLUDEDSUBTREES                     2265 ; inline ! excludedSubtrees
+: CRYPT_CERTINFO_CRLDISTRIBUTIONPOINT                 2266 ; inline
+: CRYPT_CERTINFO_CRLDIST_FULLNAME                     2267 ; inline ! distributionPointName.fullName
+: CRYPT_CERTINFO_CRLDIST_REASONS                      2268 ; inline ! reasons
+: CRYPT_CERTINFO_CRLDIST_CRLISSUER                    2269 ; inline ! cRLIssuer
+: CRYPT_CERTINFO_CERTIFICATEPOLICIES                  2270 ; inline
+: CRYPT_CERTINFO_CERTPOLICYID                         2271 ; inline ! policyInformation.policyIdentifier
+: CRYPT_CERTINFO_CERTPOLICY_CPSURI                    2272 ; inline ! policyInformation.policyQualifiers.qualifier.cPSuri
+: CRYPT_CERTINFO_CERTPOLICY_ORGANIZATION              2273 ; inline ! policyInformation.policyQualifiers.qualifier.userNotice.noticeRef.organization
+: CRYPT_CERTINFO_CERTPOLICY_NOTICENUMBERS             2274 ; inline ! policyInformation.policyQualifiers.qualifier.userNotice.noticeRef.noticeNumbers
+: CRYPT_CERTINFO_CERTPOLICY_EXPLICITTEXT              2275 ; inline ! policyInformation.policyQualifiers.qualifier.userNotice.explicitText
+: CRYPT_CERTINFO_POLICYMAPPINGS                       2276 ; inline
+: CRYPT_CERTINFO_ISSUERDOMAINPOLICY                   2277 ; inline ! policyMappings.issuerDomainPolicy
+: CRYPT_CERTINFO_SUBJECTDOMAINPOLICY                  2278 ; inline ! policyMappings.subjectDomainPolicy
+: CRYPT_CERTINFO_AUTHORITYKEYIDENTIFIER               2279 ; inline
+: CRYPT_CERTINFO_AUTHORITY_KEYIDENTIFIER              2280 ; inline ! keyIdentifier
+: CRYPT_CERTINFO_AUTHORITY_CERTISSUER                 2281 ; inline ! authorityCertIssuer
+: CRYPT_CERTINFO_AUTHORITY_CERTSERIALNUMBER           2282 ; inline ! authorityCertSerialNumber
+: CRYPT_CERTINFO_POLICYCONSTRAINTS                    2283 ; inline
+: CRYPT_CERTINFO_REQUIREEXPLICITPOLICY                2284 ; inline ! policyConstraints.requireExplicitPolicy
+: CRYPT_CERTINFO_INHIBITPOLICYMAPPING                 2285 ; inline ! policyConstraints.inhibitPolicyMapping
+: CRYPT_CERTINFO_EXTKEYUSAGE                          2286 ; inline
+: CRYPT_CERTINFO_EXTKEY_MS_INDIVIDUALCODESIGNING      2287 ; inline ! individualCodeSigning
+: CRYPT_CERTINFO_EXTKEY_MS_COMMERCIALCODESIGNING      2288 ; inline ! commercialCodeSigning
+: CRYPT_CERTINFO_EXTKEY_MS_CERTTRUSTLISTSIGNING       2289 ; inline ! certTrustListSigning
+: CRYPT_CERTINFO_EXTKEY_MS_TIMESTAMPSIGNING           2290 ; inline ! timeStampSigning
+: CRYPT_CERTINFO_EXTKEY_MS_SERVERGATEDCRYPTO          2291 ; inline ! serverGatedCrypto
+: CRYPT_CERTINFO_EXTKEY_MS_ENCRYPTEDFILESYSTEM        2292 ; inline ! encrypedFileSystem
+: CRYPT_CERTINFO_EXTKEY_SERVERAUTH                    2293 ; inline ! serverAuth
+: CRYPT_CERTINFO_EXTKEY_CLIENTAUTH                    2294 ; inline ! clientAuth
+: CRYPT_CERTINFO_EXTKEY_CODESIGNING                   2295 ; inline ! codeSigning
+: CRYPT_CERTINFO_EXTKEY_EMAILPROTECTION               2296 ; inline ! emailProtection
+: CRYPT_CERTINFO_EXTKEY_IPSECENDSYSTEM                2297 ; inline ! ipsecEndSystem
+: CRYPT_CERTINFO_EXTKEY_IPSECTUNNEL                   2298 ; inline ! ipsecTunnel
+: CRYPT_CERTINFO_EXTKEY_IPSECUSER                     2299 ; inline ! ipsecUser
+: CRYPT_CERTINFO_EXTKEY_TIMESTAMPING                  2300 ; inline ! timeStamping
+: CRYPT_CERTINFO_EXTKEY_OCSPSIGNING                   2301 ; inline ! ocspSigning
+: CRYPT_CERTINFO_EXTKEY_DIRECTORYSERVICE              2302 ; inline ! directoryService
+: CRYPT_CERTINFO_EXTKEY_ANYKEYUSAGE                   2303 ; inline ! anyExtendedKeyUsage
+: CRYPT_CERTINFO_EXTKEY_NS_SERVERGATEDCRYPTO          2304 ; inline ! serverGatedCrypto
+: CRYPT_CERTINFO_EXTKEY_VS_SERVERGATEDCRYPTO_CA       2305 ; inline ! serverGatedCrypto CA
+: CRYPT_CERTINFO_FRESHESTCRL                          2306 ; inline
+: CRYPT_CERTINFO_FRESHESTCRL_FULLNAME                 2307 ; inline ! distributionPointName.fullName
+: CRYPT_CERTINFO_FRESHESTCRL_REASONS                  2308 ; inline ! reasons
+: CRYPT_CERTINFO_FRESHESTCRL_CRLISSUER                2309 ; inline ! cRLIssuer
+: CRYPT_CERTINFO_INHIBITANYPOLICY                     2310 ; inline ! 2 16 840 1 113730 1 x Netscape extensions
+: CRYPT_CERTINFO_NS_CERTTYPE                          2311 ; inline ! netscape-cert-type
+: CRYPT_CERTINFO_NS_BASEURL                           2312 ; inline ! netscape-base-url
+: CRYPT_CERTINFO_NS_REVOCATIONURL                     2313 ; inline ! netscape-revocation-url
+: CRYPT_CERTINFO_NS_CAREVOCATIONURL                   2314 ; inline ! netscape-ca-revocation-url
+: CRYPT_CERTINFO_NS_CERTRENEWALURL                    2315 ; inline ! netscape-cert-renewal-url
+: CRYPT_CERTINFO_NS_CAPOLICYURL                       2316 ; inline ! netscape-ca-policy-url
+: CRYPT_CERTINFO_NS_SSLSERVERNAME                     2317 ; inline ! netscape-ssl-server-name
+: CRYPT_CERTINFO_NS_COMMENT                           2318 ; inline ! netscape-comment
+: CRYPT_CERTINFO_SET_HASHEDROOTKEY                    2319 ; inline
+: CRYPT_CERTINFO_SET_ROOTKEYTHUMBPRINT                2320 ; inline ! rootKeyThumbPrint
+: CRYPT_CERTINFO_SET_CERTIFICATETYPE                  2321 ; inline ! 2 23 42 7 2 SET merchantData
+: CRYPT_CERTINFO_SET_MERCHANTDATA                     2322 ; inline
+: CRYPT_CERTINFO_SET_MERID                            2323 ; inline ! merID
+: CRYPT_CERTINFO_SET_MERACQUIRERBIN                   2324 ; inline ! merAcquirerBIN
+: CRYPT_CERTINFO_SET_MERCHANTLANGUAGE                 2325 ; inline ! merNames.language
+: CRYPT_CERTINFO_SET_MERCHANTNAME                     2326 ; inline ! merNames.name
+: CRYPT_CERTINFO_SET_MERCHANTCITY                     2327 ; inline ! merNames.city
+: CRYPT_CERTINFO_SET_MERCHANTSTATEPROVINCE            2328 ; inline ! merNames.stateProvince
+: CRYPT_CERTINFO_SET_MERCHANTPOSTALCODE               2329 ; inline ! merNames.postalCode
+: CRYPT_CERTINFO_SET_MERCHANTCOUNTRYNAME              2330 ; inline ! merNames.countryName
+: CRYPT_CERTINFO_SET_MERCOUNTRY                       2331 ; inline ! merCountry
+: CRYPT_CERTINFO_SET_MERAUTHFLAG                      2332 ; inline ! merAuthFlag
+: CRYPT_CERTINFO_SET_CERTCARDREQUIRED                 2333 ; inline ! 2 23 42 7 4 SET tunneling
+: CRYPT_CERTINFO_SET_TUNNELING                        2334 ; inline
+: CRYPT_CERTINFO_SET_TUNNELLING                       2334 ; inline
+: CRYPT_CERTINFO_SET_TUNNELINGFLAG                    2335 ; inline ! tunneling
+: CRYPT_CERTINFO_SET_TUNNELLINGFLAG                   2335 ; inline
+: CRYPT_CERTINFO_SET_TUNNELINGALGID                   2336 ; inline ! tunnelingAlgID
+: CRYPT_CERTINFO_SET_TUNNELLINGALGID                  2336 ; inline ! S/MIME attributes
+: CRYPT_CERTINFO_CMS_CONTENTTYPE                      2500 ; inline ! 1 2 840 113549 1 9 4 messageDigest
+: CRYPT_CERTINFO_CMS_MESSAGEDIGEST                    2501 ; inline ! 1 2 840 113549 1 9 5 signingTime
+: CRYPT_CERTINFO_CMS_SIGNINGTIME                      2502 ; inline ! 1 2 840 113549 1 9 6 counterSignature
+: CRYPT_CERTINFO_CMS_COUNTERSIGNATURE                 2503 ; inline ! counterSignature
+: CRYPT_CERTINFO_CMS_SIGNINGDESCRIPTION               2504 ; inline ! 1 2 840 113549 1 9 15 sMIMECapabilities
+: CRYPT_CERTINFO_CMS_SMIMECAPABILITIES                2505 ; inline
+: CRYPT_CERTINFO_CMS_SMIMECAP_3DES                    2506 ; inline ! 3DES encryption
+: CRYPT_CERTINFO_CMS_SMIMECAP_AES                     2507 ; inline ! AES encryption
+: CRYPT_CERTINFO_CMS_SMIMECAP_CAST128                 2508 ; inline ! CAST-128 encryption
+: CRYPT_CERTINFO_CMS_SMIMECAP_IDEA                    2509 ; inline ! IDEA encryption
+: CRYPT_CERTINFO_CMS_SMIMECAP_RC2                     2510 ; inline ! RC2 encryption (w.128 key)
+: CRYPT_CERTINFO_CMS_SMIMECAP_RC5                     2511 ; inline ! RC5 encryption (w.128 key)
+: CRYPT_CERTINFO_CMS_SMIMECAP_SKIPJACK                2512 ; inline ! Skipjack encryption
+: CRYPT_CERTINFO_CMS_SMIMECAP_DES                     2513 ; inline ! DES encryption
+: CRYPT_CERTINFO_CMS_SMIMECAP_PREFERSIGNEDDATA        2514 ; inline ! preferSignedData
+: CRYPT_CERTINFO_CMS_SMIMECAP_CANNOTDECRYPTANY        2515 ; inline ! canNotDecryptAny
+: CRYPT_CERTINFO_CMS_RECEIPTREQUEST                   2516 ; inline
+: CRYPT_CERTINFO_CMS_RECEIPT_CONTENTIDENTIFIER        2517 ; inline ! contentIdentifier
+: CRYPT_CERTINFO_CMS_RECEIPT_FROM                     2518 ; inline ! receiptsFrom
+: CRYPT_CERTINFO_CMS_RECEIPT_TO                       2519 ; inline ! receiptsTo
+: CRYPT_CERTINFO_CMS_SECURITYLABEL                    2520 ; inline
+: CRYPT_CERTINFO_CMS_SECLABEL_POLICY                  2521 ; inline ! securityPolicyIdentifier
+: CRYPT_CERTINFO_CMS_SECLABEL_CLASSIFICATION          2522 ; inline ! securityClassification
+: CRYPT_CERTINFO_CMS_SECLABEL_PRIVACYMARK             2523 ; inline ! privacyMark
+: CRYPT_CERTINFO_CMS_SECLABEL_CATTYPE                 2524 ; inline ! securityCategories.securityCategory.type
+: CRYPT_CERTINFO_CMS_SECLABEL_CATVALUE                2525 ; inline ! securityCategories.securityCategory.value
+: CRYPT_CERTINFO_CMS_MLEXPANSIONHISTORY               2526 ; inline
+: CRYPT_CERTINFO_CMS_MLEXP_ENTITYIDENTIFIER           2527 ; inline ! mlData.mailListIdentifier.issuerAndSerialNumber
+: CRYPT_CERTINFO_CMS_MLEXP_TIME                       2528 ; inline ! mlData.expansionTime
+: CRYPT_CERTINFO_CMS_MLEXP_NONE                       2529 ; inline ! mlData.mlReceiptPolicy.none
+: CRYPT_CERTINFO_CMS_MLEXP_INSTEADOF                  2530 ; inline ! mlData.mlReceiptPolicy.insteadOf.generalNames.generalName
+: CRYPT_CERTINFO_CMS_MLEXP_INADDITIONTO               2531 ; inline ! mlData.mlReceiptPolicy.inAdditionTo.generalNames.generalName
+: CRYPT_CERTINFO_CMS_CONTENTHINTS                     2532 ; inline
+: CRYPT_CERTINFO_CMS_CONTENTHINT_DESCRIPTION          2533 ; inline ! contentDescription
+: CRYPT_CERTINFO_CMS_CONTENTHINT_TYPE                 2534 ; inline ! contentType
+: CRYPT_CERTINFO_CMS_EQUIVALENTLABEL                  2535 ; inline
+: CRYPT_CERTINFO_CMS_EQVLABEL_POLICY                  2536 ; inline ! securityPolicyIdentifier
+: CRYPT_CERTINFO_CMS_EQVLABEL_CLASSIFICATION          2537 ; inline ! securityClassification
+: CRYPT_CERTINFO_CMS_EQVLABEL_PRIVACYMARK             2538 ; inline ! privacyMark
+: CRYPT_CERTINFO_CMS_EQVLABEL_CATTYPE                 2539 ; inline ! securityCategories.securityCategory.type
+: CRYPT_CERTINFO_CMS_EQVLABEL_CATVALUE                2540 ; inline ! securityCategories.securityCategory.value
+: CRYPT_CERTINFO_CMS_SIGNINGCERTIFICATE               2541 ; inline
+: CRYPT_CERTINFO_CMS_SIGNINGCERT_ESSCERTID            2542 ; inline ! certs.essCertID
+: CRYPT_CERTINFO_CMS_SIGNINGCERT_POLICIES             2543 ; inline ! policies.policyInformation.policyIdentifier
+: CRYPT_CERTINFO_CMS_SIGNATUREPOLICYID                2544 ; inline
+: CRYPT_CERTINFO_CMS_SIGPOLICYID                      2545 ; inline ! sigPolicyID
+: CRYPT_CERTINFO_CMS_SIGPOLICYHASH                    2546 ; inline ! sigPolicyHash
+: CRYPT_CERTINFO_CMS_SIGPOLICY_CPSURI                 2547 ; inline ! sigPolicyQualifiers.sigPolicyQualifier.cPSuri
+: CRYPT_CERTINFO_CMS_SIGPOLICY_ORGANIZATION           2548 ; inline ! sigPolicyQualifiers.sigPolicyQualifier.userNotice.noticeRef.organization
+: CRYPT_CERTINFO_CMS_SIGPOLICY_NOTICENUMBERS          2549 ; inline ! sigPolicyQualifiers.sigPolicyQualifier.userNotice.noticeRef.noticeNumbers
+: CRYPT_CERTINFO_CMS_SIGPOLICY_EXPLICITTEXT           2550 ; inline ! sigPolicyQualifiers.sigPolicyQualifier.userNotice.explicitText
+: CRYPT_CERTINFO_CMS_SIGTYPEIDENTIFIER                2551 ; inline
+: CRYPT_CERTINFO_CMS_SIGTYPEID_ORIGINATORSIG          2552 ; inline ! originatorSig
+: CRYPT_CERTINFO_CMS_SIGTYPEID_DOMAINSIG              2553 ; inline ! domainSig
+: CRYPT_CERTINFO_CMS_SIGTYPEID_ADDITIONALATTRIBUTES   2554 ; inline ! additionalAttributesSig
+: CRYPT_CERTINFO_CMS_SIGTYPEID_REVIEWSIG              2555 ; inline ! reviewSig
+: CRYPT_CERTINFO_CMS_NONCE                            2556 ; inline ! randomNonce
+: CRYPT_CERTINFO_SCEP_MESSAGETYPE                     2557 ; inline ! messageType
+: CRYPT_CERTINFO_SCEP_PKISTATUS                       2558 ; inline ! pkiStatus
+: CRYPT_CERTINFO_SCEP_FAILINFO                        2559 ; inline ! failInfo
+: CRYPT_CERTINFO_SCEP_SENDERNONCE                     2560 ; inline ! senderNonce
+: CRYPT_CERTINFO_SCEP_RECIPIENTNONCE                  2561 ; inline ! recipientNonce
+: CRYPT_CERTINFO_SCEP_TRANSACTIONID                   2562 ; inline ! transID
+: CRYPT_CERTINFO_CMS_SPCAGENCYINFO                    2563 ; inline
+: CRYPT_CERTINFO_CMS_SPCAGENCYURL                     2564 ; inline ! spcAgencyInfo.url
+: CRYPT_CERTINFO_CMS_SPCSTATEMENTTYPE                 2565 ; inline
+: CRYPT_CERTINFO_CMS_SPCSTMT_INDIVIDUALCODESIGNING    2566 ; inline ! individualCodeSigning
+: CRYPT_CERTINFO_CMS_SPCSTMT_COMMERCIALCODESIGNING    2567 ; inline ! commercialCodeSigning
+: CRYPT_CERTINFO_CMS_SPCOPUSINFO                      2568 ; inline
+: CRYPT_CERTINFO_CMS_SPCOPUSINFO_NAME                 2569 ; inline ! spcOpusInfo.name
+: CRYPT_CERTINFO_CMS_SPCOPUSINFO_URL                  2570 ; inline ! spcOpusInfo.url
+: CRYPT_CERTINFO_LAST                                 2571 ; inline
+: CRYPT_KEYINFO_FIRST                                 3000 ; inline ! *******************
+: CRYPT_KEYINFO_QUERY                                 3001 ; inline ! Keyset query
+: CRYPT_KEYINFO_QUERY_REQUESTS                        3002 ; inline ! Query of requests in cert store
+: CRYPT_KEYINFO_LAST                                  3003 ; inline
+: CRYPT_DEVINFO_FIRST                                 4000 ; inline ! *******************
+: CRYPT_DEVINFO_INITIALISE                            4001 ; inline ! Initialise device for use
+: CRYPT_DEVINFO_INITIALIZE                            4001 ; inline
+: CRYPT_DEVINFO_AUTHENT_USER                          4002 ; inline ! Authenticate user to device
+: CRYPT_DEVINFO_AUTHENT_SUPERVISOR                    4003 ; inline ! Authenticate supervisor to dev.
+: CRYPT_DEVINFO_SET_AUTHENT_USER                      4004 ; inline ! Set user authent.value
+: CRYPT_DEVINFO_SET_AUTHENT_SUPERVISOR                4005 ; inline ! Set supervisor auth.val.
+: CRYPT_DEVINFO_ZEROISE                               4006 ; inline ! Zeroise device
+: CRYPT_DEVINFO_ZEROIZE                               4006 ; inline
+: CRYPT_DEVINFO_LOGGEDIN                              4007 ; inline ! Whether user is logged in
+: CRYPT_DEVINFO_LABEL                                 4008 ; inline ! Device/token label
+: CRYPT_DEVINFO_LAST                                  4009 ; inline
+: CRYPT_ENVINFO_FIRST                                 5000 ; inline ! *********************
+: CRYPT_ENVINFO_DATASIZE                              5001 ; inline ! Data size information
+: CRYPT_ENVINFO_COMPRESSION                           5002 ; inline ! Compression information
+: CRYPT_ENVINFO_CONTENTTYPE                           5003 ; inline ! Inner CMS content type
+: CRYPT_ENVINFO_DETACHEDSIGNATURE                     5004 ; inline ! Generate CMS detached signature
+: CRYPT_ENVINFO_SIGNATURE_RESULT                      5005 ; inline ! Signature check result
+: CRYPT_ENVINFO_MAC                                   5006 ; inline ! Use MAC instead of encrypting
+: CRYPT_ENVINFO_PASSWORD                              5007 ; inline ! User password
+: CRYPT_ENVINFO_KEY                                   5008 ; inline ! Conventional encryption key
+: CRYPT_ENVINFO_SIGNATURE                             5009 ; inline ! Signature/signature check key
+: CRYPT_ENVINFO_SIGNATURE_EXTRADATA                   5010 ; inline ! Extra information added to CMS sigs
+: CRYPT_ENVINFO_RECIPIENT                             5011 ; inline ! Recipient email address
+: CRYPT_ENVINFO_PUBLICKEY                             5012 ; inline ! PKC encryption key
+: CRYPT_ENVINFO_PRIVATEKEY                            5013 ; inline ! PKC decryption key
+: CRYPT_ENVINFO_PRIVATEKEY_LABEL                      5014 ; inline ! Label of PKC decryption key
+: CRYPT_ENVINFO_ORIGINATOR                            5015 ; inline ! Originator info/key
+: CRYPT_ENVINFO_SESSIONKEY                            5016 ; inline ! Session key
+: CRYPT_ENVINFO_HASH                                  5017 ; inline ! Hash value
+: CRYPT_ENVINFO_TIMESTAMP                             5018 ; inline ! Timestamp information
+: CRYPT_ENVINFO_KEYSET_SIGCHECK                       5019 ; inline ! Signature check keyset
+: CRYPT_ENVINFO_KEYSET_ENCRYPT                        5020 ; inline ! PKC encryption keyset
+: CRYPT_ENVINFO_KEYSET_DECRYPT                        5021 ; inline ! PKC decryption keyset
+: CRYPT_ENVINFO_LAST                                  5022 ; inline
+: CRYPT_SESSINFO_FIRST                                6000 ; inline ! ********************
+: CRYPT_SESSINFO_ACTIVE                               6001 ; inline ! Whether session is active
+: CRYPT_SESSINFO_CONNECTIONACTIVE                     6002 ; inline ! Whether network connection is active
+: CRYPT_SESSINFO_USERNAME                             6003 ; inline ! User name
+: CRYPT_SESSINFO_PASSWORD                             6004 ; inline ! Password
+: CRYPT_SESSINFO_PRIVATEKEY                           6005 ; inline ! Server/client private key
+: CRYPT_SESSINFO_KEYSET                               6006 ; inline ! Certificate store
+: CRYPT_SESSINFO_AUTHRESPONSE                         6007 ; inline ! Session authorisation OK
+: CRYPT_SESSINFO_SERVER_NAME                          6008 ; inline ! Server name
+: CRYPT_SESSINFO_SERVER_PORT                          6009 ; inline ! Server port number
+: CRYPT_SESSINFO_SERVER_FINGERPRINT                   6010 ; inline ! Server key fingerprint
+: CRYPT_SESSINFO_CLIENT_NAME                          6011 ; inline ! Client name
+: CRYPT_SESSINFO_CLIENT_PORT                          6012 ; inline ! Client port number
+: CRYPT_SESSINFO_SESSION                              6013 ; inline ! Transport mechanism
+: CRYPT_SESSINFO_NETWORKSOCKET                        6014 ; inline ! User-supplied network socket
+: CRYPT_SESSINFO_VERSION                              6015 ; inline ! Protocol version
+: CRYPT_SESSINFO_REQUEST                              6016 ; inline ! Cert.request object
+: CRYPT_SESSINFO_RESPONSE                             6017 ; inline ! Cert.response object
+: CRYPT_SESSINFO_CACERTIFICATE                        6018 ; inline ! Issuing CA certificate
+: CRYPT_SESSINFO_TSP_MSGIMPRINT                       6019 ; inline ! TSP message imprint
+: CRYPT_SESSINFO_CMP_REQUESTTYPE                      6020 ; inline ! Request type
+: CRYPT_SESSINFO_CMP_PKIBOOT                          6021 ; inline ! Enable PKIBoot facility
+: CRYPT_SESSINFO_CMP_PRIVKEYSET                       6022 ; inline ! Private-key keyset
+: CRYPT_SESSINFO_SSH_CHANNEL                          6023 ; inline ! SSH current channel
+: CRYPT_SESSINFO_SSH_CHANNEL_TYPE                     6024 ; inline ! SSH channel type
+: CRYPT_SESSINFO_SSH_CHANNEL_ARG1                     6025 ; inline ! SSH channel argument 1
+: CRYPT_SESSINFO_SSH_CHANNEL_ARG2                     6026 ; inline ! SSH channel argument 2
+: CRYPT_SESSINFO_SSH_CHANNEL_ACTIVE                   6027 ; inline ! SSH channel active
+: CRYPT_SESSINFO_LAST                                 6028 ; inline
+: CRYPT_USERINFO_FIRST                                7000 ; inline ! ********************
+: CRYPT_USERINFO_PASSWORD                             7001 ; inline ! Password
+: CRYPT_USERINFO_CAKEY_CERTSIGN                       7002 ; inline ! CA cert signing key
+: CRYPT_USERINFO_CAKEY_CRLSIGN                        7003 ; inline ! CA CRL signing key
+: CRYPT_USERINFO_CAKEY_RTCSSIGN                       7004 ; inline ! CA RTCS signing key
+: CRYPT_USERINFO_CAKEY_OCSPSIGN                       7005 ; inline ! CA OCSP signing key
+: CRYPT_USERINFO_LAST                                 7006 ; inline
+: CRYPT_ATTRIBUTE_LAST                                7006 ; inline
+
+TYPEDEF: int CRYPT_ATTRIBUTE_TYPE
+
+! ===============================================
+! Attribute Subtypes and Related Values
+! ===============================================
+
+! Flags for the X.509 keyUsage extension
+: CRYPT_KEYUSAGE_NONE                            HEX: 000 ; inline
+: CRYPT_KEYUSAGE_DIGITALSIGNATURE                HEX: 001 ; inline
+: CRYPT_KEYUSAGE_NONREPUDIATION                  HEX: 002 ; inline
+: CRYPT_KEYUSAGE_KEYENCIPHERMENT                 HEX: 004 ; inline
+: CRYPT_KEYUSAGE_DATAENCIPHERMENT                HEX: 008 ; inline
+: CRYPT_KEYUSAGE_KEYAGREEMENT                    HEX: 010 ; inline
+: CRYPT_KEYUSAGE_KEYCERTSIGN                     HEX: 020 ; inline
+: CRYPT_KEYUSAGE_CRLSIGN                         HEX: 040 ; inline
+: CRYPT_KEYUSAGE_ENCIPHERONLY                    HEX: 080 ; inline
+: CRYPT_KEYUSAGE_DECIPHERONLY                    HEX: 100 ; inline
+: CRYPT_KEYUSAGE_LAST                            HEX: 200 ; inline ! Last possible value
+
+! X.509 cRLReason and cryptlib cRLExtReason codes
+: CRYPT_CRLREASON_UNSPECIFIED             0  ; inline
+: CRYPT_CRLREASON_KEYCOMPROMISE           1  ; inline
+: CRYPT_CRLREASON_CACOMPROMISE            2  ; inline
+: CRYPT_CRLREASON_AFFILIATIONCHANGED      3  ; inline
+: CRYPT_CRLREASON_SUPERSEDED              4  ; inline
+: CRYPT_CRLREASON_CESSATIONOFOPERATION    5  ; inline
+: CRYPT_CRLREASON_CERTIFICATEHOLD         6  ; inline
+: CRYPT_CRLREASON_REMOVEFROMCRL           8  ; inline
+: CRYPT_CRLREASON_PRIVILEGEWITHDRAWN      9  ; inline
+: CRYPT_CRLREASON_AACOMPROMISE            10 ; inline
+: CRYPT_CRLREASON_LAST                    11 ; inline ! End of standard CRL reasons
+: CRYPT_CRLREASON_NEVERVALID              20 ; inline
+: CRYPT_CRLEXTREASON_LAST                 21 ; inline
+
+! X.509 CRL reason flags.  These identify the same thing as the cRLReason
+! codes but allow for multiple reasons to be specified.  Note that these
+! don't follow the X.509 naming since in that scheme the enumerated types
+! and bitflags have the same names
+: CRYPT_CRLREASONFLAG_UNUSED                     HEX: 001 ; inline
+: CRYPT_CRLREASONFLAG_KEYCOMPROMISE              HEX: 002 ; inline
+: CRYPT_CRLREASONFLAG_CACOMPROMISE               HEX: 004 ; inline
+: CRYPT_CRLREASONFLAG_AFFILIATIONCHANGED         HEX: 008 ; inline
+: CRYPT_CRLREASONFLAG_SUPERSEDED                 HEX: 010 ; inline
+: CRYPT_CRLREASONFLAG_CESSATIONOFOPERATION       HEX: 020 ; inline
+: CRYPT_CRLREASONFLAG_CERTIFICATEHOLD            HEX: 040 ; inline
+: CRYPT_CRLREASONFLAG_LAST                       HEX: 080 ; inline ! Last poss.value
+
+! X.509 CRL holdInstruction codes
+: CRYPT_HOLDINSTRUCTION_NONE           0 ; inline
+: CRYPT_HOLDINSTRUCTION_CALLISSUER     1 ; inline
+: CRYPT_HOLDINSTRUCTION_REJECT         2 ; inline
+: CRYPT_HOLDINSTRUCTION_PICKUPTOKEN    3 ; inline
+: CRYPT_HOLDINSTRUCTION_LAST           4 ; inline
+
+! Certificate checking compliance levels
+: CRYPT_COMPLIANCELEVEL_OBLIVIOUS       0 ; inline
+: CRYPT_COMPLIANCELEVEL_REDUCED         1 ; inline
+: CRYPT_COMPLIANCELEVEL_STANDARD        2 ; inline
+: CRYPT_COMPLIANCELEVEL_PKIX_PARTIAL    3 ; inline
+: CRYPT_COMPLIANCELEVEL_PKIX_FULL       4 ; inline
+: CRYPT_COMPLIANCELEVEL_LAST            5 ; inline
+
+! Flags for the Netscape netscape-cert-type extension
+: CRYPT_NS_CERTTYPE_SSLCLIENT                    HEX: 001 ; inline
+: CRYPT_NS_CERTTYPE_SSLSERVER                    HEX: 002 ; inline
+: CRYPT_NS_CERTTYPE_SMIME                        HEX: 004 ; inline
+: CRYPT_NS_CERTTYPE_OBJECTSIGNING                HEX: 008 ; inline
+: CRYPT_NS_CERTTYPE_RESERVED                     HEX: 010 ; inline
+: CRYPT_NS_CERTTYPE_SSLCA                        HEX: 020 ; inline
+: CRYPT_NS_CERTTYPE_SMIMECA                      HEX: 040 ; inline
+: CRYPT_NS_CERTTYPE_OBJECTSIGNINGCA              HEX: 080 ; inline
+: CRYPT_NS_CERTTYPE_LAST                         HEX: 100 ; inline ! Last possible value
+
+! Flags for the SET certificate-type extension
+: CRYPT_SET_CERTTYPE_CARD                        HEX: 001 ; inline
+: CRYPT_SET_CERTTYPE_MER                         HEX: 002 ; inline
+: CRYPT_SET_CERTTYPE_PGWY                        HEX: 004 ; inline
+: CRYPT_SET_CERTTYPE_CCA                         HEX: 008 ; inline
+: CRYPT_SET_CERTTYPE_MCA                         HEX: 010 ; inline
+: CRYPT_SET_CERTTYPE_PCA                         HEX: 020 ; inline
+: CRYPT_SET_CERTTYPE_GCA                         HEX: 040 ; inline
+: CRYPT_SET_CERTTYPE_BCA                         HEX: 080 ; inline
+: CRYPT_SET_CERTTYPE_RCA                         HEX: 100 ; inline
+: CRYPT_SET_CERTTYPE_ACQ                         HEX: 200 ; inline
+: CRYPT_SET_CERTTYPE_LAST                        HEX: 400 ; inline ! Last possible value
+
+! CMS contentType values
+! CRYPT_CONTENT_TYPE
+: CRYPT_CONTENT_NONE                        0  ; inline
+: CRYPT_CONTENT_DATA                        1  ; inline
+: CRYPT_CONTENT_SIGNEDDATA                  2  ; inline
+: CRYPT_CONTENT_ENVELOPEDDATA               3  ; inline
+: CRYPT_CONTENT_SIGNEDANDENVELOPEDDATA      4  ; inline
+: CRYPT_CONTENT_DIGESTEDDATA                5  ; inline
+: CRYPT_CONTENT_ENCRYPTEDDATA               6  ; inline
+: CRYPT_CONTENT_COMPRESSEDDATA              7  ; inline
+: CRYPT_CONTENT_TSTINFO                     8  ; inline
+: CRYPT_CONTENT_SPCINDIRECTDATACONTEXT      9  ; inline
+: CRYPT_CONTENT_RTCSREQUEST                 10 ; inline
+: CRYPT_CONTENT_RTCSRESPONSE                11 ; inline
+: CRYPT_CONTENT_RTCSRESPONSE_EXT            12 ; inline
+: CRYPT_CONTENT_LAST                        13 ; inline
+
+! ESS securityClassification codes
+: CRYPT_CLASSIFICATION_UNMARKED            0   ; inline
+: CRYPT_CLASSIFICATION_UNCLASSIFIED        1   ; inline
+: CRYPT_CLASSIFICATION_RESTRICTED          2   ; inline
+: CRYPT_CLASSIFICATION_CONFIDENTIAL        3   ; inline
+: CRYPT_CLASSIFICATION_SECRET              4   ; inline
+: CRYPT_CLASSIFICATION_TOP_SECRET          5   ; inline
+: CRYPT_CLASSIFICATION_LAST                255 ; inline
+
+! RTCS certificate status
+: CRYPT_CERTSTATUS_VALID               0 ; inline
+: CRYPT_CERTSTATUS_NOTVALID            1 ; inline
+: CRYPT_CERTSTATUS_NONAUTHORITATIVE    2 ; inline
+: CRYPT_CERTSTATUS_UNKNOWN             3 ; inline
+
+! OCSP revocation status
+: CRYPT_OCSPSTATUS_NOTREVOKED    0 ; inline
+: CRYPT_OCSPSTATUS_REVOKED       1 ; inline
+: CRYPT_OCSPSTATUS_UNKNOWN       2 ; inline
+
+! The amount of detail to include in signatures when signing certificate
+!  objects
+! CRYPT_SIGNATURELEVEL_TYPE
+: CRYPT_SIGNATURELEVEL_NONE          0 ; inline ! Include only signature
+: CRYPT_SIGNATURELEVEL_SIGNERCERT    1 ; inline ! Include signer cert
+: CRYPT_SIGNATURELEVEL_ALL           2 ; inline ! Include all relevant info
+: CRYPT_SIGNATURELEVEL_LAST          3 ; inline ! Last possible sig.level type
+
+! The certificate export format type, which defines the format in which a
+!  certificate object is exported
+! CRYPT_CERTFORMAT_TYPE
+: CRYPT_CERTFORMAT_NONE                0 ; inline ! No certificate format
+: CRYPT_CERTFORMAT_CERTIFICATE         1 ; inline ! DER-encoded certificate
+: CRYPT_CERTFORMAT_CERTCHAIN           2 ; inline ! PKCS #7 certificate chain
+: CRYPT_CERTFORMAT_TEXT_CERTIFICATE    3 ; inline ! base-64 wrapped cert
+: CRYPT_CERTFORMAT_TEXT_CERTCHAIN      4 ; inline ! base-64 wrapped cert chain
+: CRYPT_CERTFORMAT_XML_CERTIFICATE     5 ; inline ! XML wrapped cert
+: CRYPT_CERTFORMAT_XML_CERTCHAIN       6 ; inline ! XML wrapped cert chain
+: CRYPT_CERTFORMAT_LAST                7 ; inline ! Last possible cert.format type
+
+TYPEDEF: int CRYPT_CERTFORMAT_TYPE
+
+! CMP request types
+! CRYPT_REQUESTTYPE_TYPE
+: CRYPT_REQUESTTYPE_NONE              0 ; inline ! No request type
+: CRYPT_REQUESTTYPE_INITIALISATION    1 ; inline ! Initialisation request
+: CRYPT_REQUESTTYPE_INITIALIZATION    1 ; inline
+: CRYPT_REQUESTTYPE_CERTIFICATE       2 ; inline ! Certification request
+: CRYPT_REQUESTTYPE_KEYUPDATE         3 ; inline ! Key update request
+: CRYPT_REQUESTTYPE_REVOCATION        4 ; inline ! Cert revocation request
+: CRYPT_REQUESTTYPE_PKIBOOT           5 ; inline ! PKIBoot request
+: CRYPT_REQUESTTYPE_LAST              6 ; inline ! Last possible request type
+
+! Key ID types
+! CRYPT_KEYID_TYPE
+: CRYPT_KEYID_NONE      0 ; inline ! No key ID type
+: CRYPT_KEYID_NAME      1 ; inline ! Key owner name
+: CRYPT_KEYID_URI       2 ; inline ! Key owner URI
+: CRYPT_KEYID_EMAIL     2 ; inline ! Synonym: owner email addr.
+: CRYPT_KEYID_LAST      3 ; inline ! Last possible key ID type
+
+TYPEDEF: int CRYPT_KEYID_TYPE
+
+! The encryption object types
+! CRYPT_OBJECT_TYPE
+: CRYPT_OBJECT_NONE                0 ; inline ! No object type
+: CRYPT_OBJECT_ENCRYPTED_KEY       1 ; inline ! Conventionally encrypted key
+: CRYPT_OBJECT_PKCENCRYPTED_KEY    2 ; inline ! PKC-encrypted key
+: CRYPT_OBJECT_KEYAGREEMENT        3 ; inline ! Key agreement information
+: CRYPT_OBJECT_SIGNATURE           4 ; inline ! Signature
+: CRYPT_OBJECT_LAST                5 ; inline ! Last possible object type
+
+! Object/attribute error type information
+! CRYPT_ERRTYPE_TYPE
+: CRYPT_ERRTYPE_NONE                0 ; inline ! No error information
+: CRYPT_ERRTYPE_ATTR_SIZE           1 ; inline ! Attribute data too small or large
+: CRYPT_ERRTYPE_ATTR_VALUE          2 ; inline ! Attribute value is invalid
+: CRYPT_ERRTYPE_ATTR_ABSENT         3 ; inline ! Required attribute missing
+: CRYPT_ERRTYPE_ATTR_PRESENT        4 ; inline ! Non-allowed attribute present
+: CRYPT_ERRTYPE_CONSTRAINT          5 ; inline ! Cert: Constraint violation in object
+: CRYPT_ERRTYPE_ISSUERCONSTRAINT    6 ; inline ! Cert: Constraint viol.in issuing cert
+: CRYPT_ERRTYPE_LAST                7 ; inline ! Last possible error info type
+
+! Cert store management action type
+! CRYPT_CERTACTION_TYPE
+: CRYPT_CERTACTION_NONE                      0  ; inline ! No cert management action
+: CRYPT_CERTACTION_CREATE                    1  ; inline ! Create cert store
+: CRYPT_CERTACTION_CONNECT                   2  ; inline ! Connect to cert store
+: CRYPT_CERTACTION_DISCONNECT                3  ; inline ! Disconnect from cert store
+: CRYPT_CERTACTION_ERROR                     4  ; inline ! Error information
+: CRYPT_CERTACTION_ADDUSER                   5  ; inline ! Add PKI user
+: CRYPT_CERTACTION_DELETEUSER                6  ; inline ! Delete PKI user
+: CRYPT_CERTACTION_REQUEST_CERT              7  ; inline ! Cert request
+: CRYPT_CERTACTION_REQUEST_RENEWAL           8  ; inline ! Cert renewal request
+: CRYPT_CERTACTION_REQUEST_REVOCATION        9  ; inline ! Cert revocation request
+: CRYPT_CERTACTION_CERT_CREATION             10 ; inline ! Cert creation
+: CRYPT_CERTACTION_CERT_CREATION_COMPLETE    11 ; inline ! Confirmation of cert creation
+: CRYPT_CERTACTION_CERT_CREATION_DROP        12 ; inline ! Cancellation of cert creation
+: CRYPT_CERTACTION_CERT_CREATION_REVERSE     13 ; inline ! Cancel of creation w.revocation
+: CRYPT_CERTACTION_RESTART_CLEANUP           14 ; inline ! Delete reqs after restart
+: CRYPT_CERTACTION_RESTART_REVOKE_CERT       15 ; inline ! Complete revocation after restart
+: CRYPT_CERTACTION_ISSUE_CERT                16 ; inline ! Cert issue
+: CRYPT_CERTACTION_ISSUE_CRL                 17 ; inline ! CRL issue
+: CRYPT_CERTACTION_REVOKE_CERT               18 ; inline ! Cert revocation
+: CRYPT_CERTACTION_EXPIRE_CERT               19 ; inline ! Cert expiry
+: CRYPT_CERTACTION_CLEANUP                   20 ; inline ! Clean up on restart
+: CRYPT_CERTACTION_LAST                      21 ; inline ! Last possible cert store log action
+
+! ===============================================
+! General Constants
+! ===============================================
+
+! The maximum user key size - 2048 bits
+: CRYPT_MAX_KEYSIZE          256 ; inline
+
+! The maximum IV size - 256 bits
+: CRYPT_MAX_IVSIZE           32 ; inline
+
+! The maximum public-key component size - 4096 bits, and maximum component
+! size for ECCs - 256 bits
+: CRYPT_MAX_PKCSIZE          512 ; inline
+: CRYPT_MAX_PKCSIZE_ECC      32 ; inline
+
+! The maximum hash size - 256 bits
+: CRYPT_MAX_HASHSIZE         32 ; inline
+
+! The maximum size of a text string (e.g.key owner name)
+: CRYPT_MAX_TEXTSIZE         64 ; inline
+
+! A magic value indicating that the default setting for this parameter
+! should be used
+: CRYPT_USE_DEFAULT         -100 ; inline
+
+! A magic value for unused parameters
+: CRYPT_UNUSED              -101 ; inline
+
+! Cursor positioning codes for certificate/CRL extensions
+: CRYPT_CURSOR_FIRST        -200 ; inline
+: CRYPT_CURSOR_PREVIOUS     -201 ; inline
+: CRYPT_CURSOR_NEXT         -202 ; inline
+: CRYPT_CURSOR_LAST         -203 ; inline
+
+! The type of information polling to perform to get random seed 
+! information.  These values have to be negative because they're used
+! as magic length values for cryptAddRandom()
+: CRYPT_RANDOM_FASTPOLL     -300 ; inline
+: CRYPT_RANDOM_SLOWPOLL     -301 ; inline
+
+! Whether the PKC key is a public or private key
+: CRYPT_KEYTYPE_PRIVATE      0 ; inline
+: CRYPT_KEYTYPE_PUBLIC       1 ; inline
+
+! Keyset open options
+! CRYPT_KEYOPT_TYPE
+! (No options, Open keyset in read-only mode, Create a new keyset)
+! 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
+;
+
+: CRYPT_KEYOPT_LAST_EXTERNAL   3 ; inline ! = CRYPT_KEYOPT_CREATE + 1
+
+TYPEDEF: int CRYPT_KEYOPT_TYPE
+
+! The various cryptlib objects - these are just integer handles
+TYPEDEF: int CRYPT_CERTIFICATE
+TYPEDEF: int CRYPT_CONTEXT
+TYPEDEF: int CRYPT_DEVICE
+TYPEDEF: int CRYPT_ENVELOPE
+TYPEDEF: int CRYPT_KEYSET
+TYPEDEF: int CRYPT_SESSION
+TYPEDEF: int CRYPT_USER
+
+! Sometimes we don't know the exact type of a cryptlib object, so we use a
+! generic handle type to identify it
+TYPEDEF: int CRYPT_HANDLE
+
+! ===============================================
+! Status Codes
+! ===============================================
+
+! No error in function call
+: CRYPT_OK                   0 ; inline ! No error
+
+! Error in parameters passed to function
+: CRYPT_ERROR_PARAM1        -1 ; inline ! Bad argument, parameter 1
+: CRYPT_ERROR_PARAM2        -2 ; inline ! Bad argument, parameter 2
+: CRYPT_ERROR_PARAM3        -3 ; inline ! Bad argument, parameter 3
+: CRYPT_ERROR_PARAM4        -4 ; inline ! Bad argument, parameter 4
+: CRYPT_ERROR_PARAM5        -5 ; inline ! Bad argument, parameter 5
+: CRYPT_ERROR_PARAM6        -6 ; inline ! Bad argument, parameter 6
+: CRYPT_ERROR_PARAM7        -7 ; inline ! Bad argument, parameter 7
+
+! Errors due to insufficient resources
+: CRYPT_ERROR_MEMORY        -10 ; inline ! Out of memory
+: CRYPT_ERROR_NOTINITED     -11 ; inline ! Data has not been initialised
+: CRYPT_ERROR_INITED        -12 ; inline ! Data has already been init'd
+: CRYPT_ERROR_NOSECURE      -13 ; inline ! Opn.not avail.at requested sec.level
+: CRYPT_ERROR_RANDOM        -14 ; inline ! No reliable random data available
+: CRYPT_ERROR_FAILED        -15 ; inline ! Operation failed
+: CRYPT_ERROR_INTERNAL      -16 ; inline ! Internal consistency check failed
+
+! Security violations
+: CRYPT_ERROR_NOTAVAIL      -20 ; inline ! This type of opn.not available
+: CRYPT_ERROR_PERMISSION    -21 ; inline ! No permiss.to perform this operation
+: CRYPT_ERROR_WRONGKEY      -22 ; inline ! Incorrect key used to decrypt data
+: CRYPT_ERROR_INCOMPLETE    -23 ; inline ! Operation incomplete/still in progress
+: CRYPT_ERROR_COMPLETE      -24 ; inline ! Operation complete/can't continue
+: CRYPT_ERROR_TIMEOUT       -25 ; inline ! Operation timed out before completion
+: CRYPT_ERROR_INVALID       -26 ; inline ! Invalid/inconsistent information
+: CRYPT_ERROR_SIGNALLED     -27 ; inline ! Resource destroyed by extnl.event
+
+! High-level function errors
+: CRYPT_ERROR_OVERFLOW      -30 ; inline ! Resources/space exhausted
+: CRYPT_ERROR_UNDERFLOW     -31 ; inline ! Not enough data available
+: CRYPT_ERROR_BADDATA       -32 ; inline ! Bad/unrecognised data format
+: CRYPT_ERROR_SIGNATURE     -33 ; inline ! Signature/integrity check failed
+
+! Data access function errors
+: CRYPT_ERROR_OPEN          -40 ; inline ! Cannot open object
+: CRYPT_ERROR_READ          -41 ; inline ! Cannot read item from object
+: CRYPT_ERROR_WRITE         -42 ; inline ! Cannot write item to object
+: CRYPT_ERROR_NOTFOUND      -43 ; inline ! Requested item not found in object
+: CRYPT_ERROR_DUPLICATE     -44 ; inline ! Item already present in object
+
+! Data enveloping errors
+: CRYPT_ENVELOPE_RESOURCE    -50 ; inline ! Need resource to proceed
+
+! Error messages sequence
+: error-messages ( -- seq ) {
+    { -1   "Bad argument, parameter 1" }
+    { -2   "Bad argument, parameter 2" }
+    { -3   "Bad argument, parameter 3" }
+    { -4   "Bad argument, parameter 4" }
+    { -5   "Bad argument, parameter 5" }
+    { -6   "Bad argument, parameter 6" }
+    { -7   "Bad argument, parameter 7" }
+    { -10  "Out of memory" }
+    { -11  "Data has not been initialised" }
+    { -12  "Data has already been init'd" }
+    { -13  "Opn.not avail.at requested sec.level" }
+    { -14  "No reliable random data available" }
+    { -15  "Operation failed" }
+    { -16  "Internal consistency check failed" }
+    { -20  "This type of opn.not available" }
+    { -21  "No permiss.to perform this operation" }
+    { -22  "Incorrect key used to decrypt data" }
+    { -23  "Operation incomplete/still in progress" }
+    { -24  "Operation complete/can't continue" }
+    { -25  "Operation timed out before completion" }
+    { -26  "Invalid/inconsistent information" }
+    { -27  "Resource destroyed by extnl.event" }
+    { -30  "Resources/space exhausted" }
+    { -31  "Not enough data available" }
+    { -32  "Bad/unrecognised data format" }
+    { -33  "Signature/integrity check failed" }
+    { -40  "Cannot open object" }
+    { -41  "Cannot read item from object" }
+    { -42  "Cannot write item to object" }
+    { -43  "Requested item not found in object" }
+    { -44  "Item already present in object" }
+    { -50  "Need resource to proceed" }
+} ;
+
+LIBRARY: libcl
+
+! ===============================================
+! cryptlib.h
+! ===============================================
+
+! Initialise and shut down cryptlib
+FUNCTION: C_RET cryptInit (  ) ;
+FUNCTION: C_RET cryptEnd (  ) ;
+
+! Create and destroy an encryption context
+
+FUNCTION: C_RET cryptCreateContext ( CRYPT_CONTEXT* cryptContext, CRYPT_USER cryptUser, CRYPT_ALGO_TYPE cryptAlgo ) ;
+FUNCTION: C_RET cryptDestroyContext ( CRYPT_CONTEXT cryptContext ) ;
+
+! Create/destroy an envelope
+FUNCTION: C_RET cryptCreateEnvelope ( CRYPT_ENVELOPE* envelope, CRYPT_USER cryptUser, CRYPT_FORMAT_TYPE formatType ) ;
+FUNCTION: C_RET cryptDestroyEnvelope ( CRYPT_ENVELOPE envelope ) ;
+
+! Add/remove data to/from and envelope or session
+FUNCTION: C_RET cryptPushData ( CRYPT_HANDLE envelope, void* buffer, int length, int* bytesCopied ) ;
+FUNCTION: C_RET cryptFlushData ( CRYPT_HANDLE envelope ) ;
+FUNCTION: C_RET cryptPopData ( CRYPT_HANDLE envelope, void* buffer, int length, int* bytesCopied ) ;
+
+! Get/set/delete attribute functions
+FUNCTION: C_RET cryptSetAttribute ( CRYPT_HANDLE cryptHandle, CRYPT_ATTRIBUTE_TYPE attributeType, int value ) ;
+FUNCTION: C_RET cryptSetAttributeString ( CRYPT_HANDLE cryptHandle, CRYPT_ATTRIBUTE_TYPE attributeType, void* value, int valueLength ) ;
+
+! Generate a key into a context
+FUNCTION: C_RET cryptGenerateKey ( CRYPT_CONTEXT cryptContext ) ;
+
+! Open and close a keyset
+FUNCTION: C_RET cryptKeysetOpen ( CRYPT_KEYSET* keyset, CRYPT_USER cryptUser, CRYPT_KEYSET_TYPE keysetType,
+                                  char* name, CRYPT_KEYOPT_TYPE options ) ;
+FUNCTION: C_RET cryptKeysetClose ( CRYPT_KEYSET keyset ) ;
+
+! Add/delete a key to/from a keyset or device
+FUNCTION: C_RET cryptAddPublicKey ( CRYPT_KEYSET keyset, CRYPT_CERTIFICATE certificate ) ;
+FUNCTION: C_RET cryptAddPrivateKey ( CRYPT_KEYSET keyset, CRYPT_HANDLE cryptKey, char* password ) ;
+FUNCTION: C_RET cryptDeleteKey ( CRYPT_KEYSET keyset, CRYPT_KEYID_TYPE keyIDtype, char* keyID ) ;
+
+! Create/destroy a certificate
+FUNCTION: C_RET cryptCreateCert ( CRYPT_CERTIFICATE* certificate, CRYPT_USER cryptUser, CRYPT_CERTTYPE_TYPE certType ) ;
+FUNCTION: C_RET cryptDestroyCert ( CRYPT_CERTIFICATE certificate ) ;
+
+! Sign/sig.check a certificate/certification request
+FUNCTION: C_RET cryptSignCert ( CRYPT_CERTIFICATE certificate, CRYPT_CONTEXT signContext ) ;
+FUNCTION: C_RET cryptCheckCert ( CRYPT_CERTIFICATE certificate, CRYPT_HANDLE sigCheckKey ) ;
+
+! Import/export a certificate/certification request
+FUNCTION: C_RET cryptImportCert ( void* certObject, int certObjectLength, CRYPT_USER cryptUser, CRYPT_CERTIFICATE* certificate ) ;
+FUNCTION: C_RET cryptExportCert ( void* certObject, int certObjectMaxLength, int* certObjectLength,
+                                  CRYPT_CERTFORMAT_TYPE certFormatType, CRYPT_CERTIFICATE certificate ) ;
+
+! Get a key from a keyset or device
+FUNCTION: C_RET cryptGetPublicKey ( CRYPT_KEYSET keyset, CRYPT_CONTEXT* cryptContext, CRYPT_KEYID_TYPE keyIDtype, char* keyID ) ;
+FUNCTION: C_RET cryptGetPrivateKey ( CRYPT_KEYSET keyset, CRYPT_CONTEXT* cryptContext, CRYPT_KEYID_TYPE keyIDtype, char* keyID, char* password ) ;
+FUNCTION: C_RET cryptGetKey ( CRYPT_KEYSET keyset, CRYPT_CONTEXT* cryptContext, CRYPT_KEYID_TYPE keyIDtype, char* keyID, char* password ) ;
+
+! Create/destroy a session
+FUNCTION: C_RET cryptCreateSession ( CRYPT_SESSION* session, CRYPT_USER cryptUser, CRYPT_SESSION_TYPE formatType ) ;
+FUNCTION: C_RET cryptDestroySession ( CRYPT_SESSION session ) ;
diff --git a/extra/cryptlib/notes.txt b/extra/cryptlib/notes.txt
new file mode 100644 (file)
index 0000000..b5f95cf
--- /dev/null
@@ -0,0 +1,51 @@
+Read remaining data:
+
+ USING: alien libc kernel-internals byte-arrays ;
+ SYMBOL: buffer
+ 11 "uchar*" malloc-array buffer set
+ "Hello world" buffer get string>memory
+ buffer get 11 memory>string .
+ "Hello world"
+ 11 [ buffer get swap alien-unsigned-1 ] each
+ .s
+ 72
+ 101
+ 108
+ 108
+ 111
+ 32
+ 119
+ 111
+ 114
+ 108
+ 100 
+ 11 [ buffer get swap alien-unsigned-1 ] map
+ >byte-array .
+ { 72 101 108 108 111 32 119 111 114 108 100 }
+
+Parse a file:
+
+ openssl asn1parse -in file.pem
+
+Parse a DER file:
+
+ openssl asn1parse -inform DER -in file.der
+
+Generate a PKCS#12 file:
+
+ openssl pkcs12 -export -in certs.pem -out file.p12 -name "MY Certificate"
+
+ The export option specifies that a PKCS#12 file will be generated (rather 
+ than parsed).
+
diff --git a/extra/cryptlib/streams/streams.factor b/extra/cryptlib/streams/streams.factor
new file mode 100644 (file)
index 0000000..77a34e8
--- /dev/null
@@ -0,0 +1,157 @@
+! Copyright (C) 2007 Matthew Willis
+! See http://factorcode.org/license.txt for BSD license.
+USING: cryptlib cryptlib.libcl kernel alien sequences
+byte-arrays namespaces io.buffers math generic io strings
+io.streams.lines io.streams.plain io.streams.duplex combinators
+alien.c-types ;
+
+IN: cryptlib.streams
+
+: set-attribute ( handle attribute value -- )
+    cryptSetAttribute check-result ;
+
+: set-attribute-string ( handle attribute value -- )
+    dup length swap string>char-alien swap
+    cryptSetAttributeString check-result ;
+
+: default-buffer-size 64 1024 * ; inline
+
+TUPLE: crypt-stream handle eof? ;
+
+: init-crypt-stream ( handle -- )
+    dup CRYPT_OPTION_NET_READTIMEOUT 1 set-attribute
+    CRYPT_SESSINFO_ACTIVE 1 set-attribute ;
+
+: <crypt-stream> ( handle -- stream )
+    crypt-stream construct-empty
+    over init-crypt-stream
+    default-buffer-size <buffer> over set-delegate
+    tuck set-crypt-stream-handle 
+    dup <line-reader> swap <plain-writer> <duplex-stream> ;
+
+: check-read ( err -- eof? )
+    {
+        { [ dup CRYPT_ERROR_READ = ] [ drop t ] }
+        { [ dup CRYPT_ERROR_COMPLETE = ] [ drop t ] }
+        { [ dup CRYPT_ERROR_TIMEOUT = ] [ drop f ] }
+        { [ t ] [ check-result f ] }
+    } cond ;
+
+: (refill) ( stream -- err )
+    dup [ crypt-stream-handle ] keep [ buffer@ ] keep buffer-capacity
+    "int" <c-object> dup >r cryptPopData r> *int rot n>buffer ;
+
+: refill ( stream -- )
+    dup (refill) check-read swap set-crypt-stream-eof? ;
+
+: read-step ( n stream -- )
+    dup refill tuck buffer-length 2dup <= 
+    [ drop swap buffer> % ]
+    [
+        - swap dup buffer>> % dup crypt-stream-eof? 
+        [ 2drop ] [ read-step ] if
+    ] if ;
+
+M: crypt-stream stream-read ( n stream -- str/f )
+    tuck buffer-length 2dup <= [ drop swap buffer> ] [
+        pick buffer>> [ % - swap read-step ] "" make f like
+    ] if ;
+
+M: crypt-stream stream-read1 ( stream -- ch/f )
+    1 swap stream-read [ first ] [ f ] if* ;
+
+: read-until-step ( seps stream -- sep/f )
+    dup refill 2dup buffer-until [ swap % 2nip ]
+    [ 
+        % dup crypt-stream-eof? [ 2drop f ] [ read-until-step ] if
+    ] if* ;
+
+M: crypt-stream stream-read-until ( seps stream -- str/f sep/f )
+    2dup buffer-until [ >r 2nip r> ] [
+        [ % read-until-step ] "" make f like swap
+    ] if* ;
+M: crypt-stream stream-flush ( cl-stream -- )
+    crypt-stream-handle cryptFlushData check-result ;
+
+M: crypt-stream stream-write ( str stream -- )
+    crypt-stream-handle over string>char-alien rot length
+    "int" <c-object> cryptPushData check-result ;
+
+M: crypt-stream stream-write1 ( ch stream -- )
+    >r 1string r> stream-write ;
+
+: check-close ( err -- )
+    dup CRYPT_ERROR_PARAM1 = [ drop ] [ check-result ] if ;
+    
+M: crypt-stream stream-close ( stream -- )
+    crypt-stream-handle cryptDestroySession check-close ;
+
+: create-session ( format -- session )
+    "int" <c-object> tuck CRYPT_UNUSED rot
+    cryptCreateSession check-result *int ;
+
+: crypt-client ( server port -- handle )
+    CRYPT_SESSION_SSL create-session
+    [ CRYPT_SESSINFO_SERVER_PORT rot set-attribute ] keep
+    [ CRYPT_SESSINFO_SERVER_NAME rot set-attribute-string ] keep ;
+
+: crypt-server ( port -- handle )
+    CRYPT_SESSION_SSL_SERVER create-session
+    [ CRYPT_SESSINFO_SERVER_PORT rot set-attribute ] keep ;
+
+: crypt-login ( handle user pass -- )
+    swap pick CRYPT_SESSINFO_USERNAME rot set-attribute-string
+    CRYPT_SESSINFO_PASSWORD swap set-attribute-string ;
+
+: test-server ( -- stream )
+    init
+    8888 crypt-server
+    dup "user" "pass" crypt-login
+    <crypt-stream>
+    
+    "Welcome to cryptlib!" over stream-print 
+    dup stream-flush
+    
+    dup stream-readln print
+    
+    stream-close 
+    end 
+    ;
+    
+: test-client ( -- stream )
+    init
+    "localhost" 8888 crypt-client
+    dup "user" "pass" crypt-login
+    <crypt-stream>
+    
+    dup stream-readln print
+    
+    "Thanks!" over stream-print
+    dup stream-flush
+    
+    stream-close
+    end 
+    ;
+    
+: (rpl) ( stream -- stream )
+    readln
+    {
+        { [ dup "." = ] 
+            [ drop dup stream-readln "READ: " write print flush (rpl) ] }
+        { [ dup "q" = ] [ drop ] }
+        { [ t ] [ over stream-print dup stream-flush (rpl) ] }
+    } cond ;
+
+: test-rpl ( client? -- )
+    ! a server where you type responses to the client manually
+    init
+    [ "localhost" 8888 crypt-client ] [ 8888 crypt-server ] if
+    dup "user" "pass" crypt-login
+    <crypt-stream>
+    
+    (rpl)
+    
+    stream-close 
+    end 
+    ;
\ No newline at end of file
diff --git a/extra/cryptlib/streams/tags.txt b/extra/cryptlib/streams/tags.txt
new file mode 100644 (file)
index 0000000..992ae12
--- /dev/null
@@ -0,0 +1 @@
+network
diff --git a/extra/cryptlib/summary.txt b/extra/cryptlib/summary.txt
new file mode 100644 (file)
index 0000000..8bc4f0e
--- /dev/null
@@ -0,0 +1 @@
+Cryptlib public-key encryption library binding
diff --git a/extra/cryptlib/tags.txt b/extra/cryptlib/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/cryptlib/test/keys.p15 b/extra/cryptlib/test/keys.p15
new file mode 100644 (file)
index 0000000..deacec6
Binary files /dev/null and b/extra/cryptlib/test/keys.p15 differ
diff --git a/extra/cryptlib/test/large_data.txt b/extra/cryptlib/test/large_data.txt
new file mode 100644 (file)
index 0000000..03ce8bd
--- /dev/null
@@ -0,0 +1,4928 @@
+/opt/local/lib/libcl.dylib(dylib1.o):
+000007c4 t ___initialize_Cplusplus
+000007a4 t __dyld_func_lookup
+         u __mh_dylib_header
+0000079c t cfm_stub_binding_helper
+000d8000 d dyld__mh_dylib_header
+000dacbc s dyld_func_lookup_pointer
+000dacb8 s dyld_lazy_symbol_binding_entry_point
+0000076c t dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_add.o):
+00000c48 T _BN_add
+00000e54 T _BN_sub
+00000ac8 T _BN_uadd
+         U _BN_ucmp
+0000083c T _BN_usub
+         U _bn_add_words
+         U _bn_expand2
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_asm.o):
+         U _BN_num_bits_word
+000017a8 T _bn_add_words
+00001648 T _bn_div_words
+000010a8 T _bn_mul_add_words
+00002738 T _bn_mul_comba4
+000019c0 T _bn_mul_comba8
+000012fc T _bn_mul_words
+000037b0 T _bn_sqr_comba4
+00002a90 T _bn_sqr_comba8
+00001560 T _bn_sqr_words
+000018c8 T _bn_sub_words
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_ctx.o):
+00003bfc T _BN_CTX_end
+00003b08 T _BN_CTX_free
+00003ba4 T _BN_CTX_get
+00003ae0 T _BN_CTX_init
+00003c4c T _BN_CTX_new
+00003b7c T _BN_CTX_start
+         U _BN_clear_free
+         U _free
+         U _malloc
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_div.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+         U _BN_add
+         U _BN_copy
+00003c98 T _BN_div
+         U _BN_init
+         U _BN_lshift
+         U _BN_num_bits
+         U _BN_rshift
+         U _BN_set_word
+         U _BN_sub
+         U _BN_ucmp
+         U _BN_usub
+         U _bn_div_words
+         U _bn_expand2
+         U _bn_mul_words
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_exp.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+         U _BN_MONT_CTX_free
+         U _BN_MONT_CTX_new
+         U _BN_MONT_CTX_set
+         U _BN_RECP_CTX_free
+         U _BN_RECP_CTX_init
+         U _BN_RECP_CTX_set
+         U _BN_clear_free
+         U _BN_copy
+         U _BN_div
+000041b4 T _BN_exp
+         U _BN_from_montgomery
+         U _BN_init
+         U _BN_is_bit_set
+00004f6c T _BN_mod_exp
+000046e8 T _BN_mod_exp_mont
+00004b78 T _BN_mod_exp_mont_word
+00004318 T _BN_mod_exp_recp
+00004fec T _BN_mod_exp_simple
+         U _BN_mod_mul
+         U _BN_mod_mul_montgomery
+         U _BN_mod_mul_reciprocal
+         U _BN_mul
+         U _BN_mul_word
+         U _BN_nnmod
+         U _BN_num_bits
+         U _BN_set_word
+         U _BN_sqr
+         U _BN_ucmp
+         U _BN_value_one
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_exp2.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+         U _BN_MONT_CTX_free
+         U _BN_MONT_CTX_new
+         U _BN_MONT_CTX_set
+         U _BN_clear_free
+         U _BN_div
+         U _BN_from_montgomery
+         U _BN_init
+         U _BN_is_bit_set
+00005350 T _BN_mod_exp2_mont
+         U _BN_mod_mul_montgomery
+         U _BN_num_bits
+         U _BN_set_word
+         U _BN_ucmp
+         U _BN_value_one
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_gcd.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+         U _BN_add
+         U _BN_cmp
+         U _BN_copy
+         U _BN_div
+         U _BN_free
+00005b30 T _BN_gcd
+         U _BN_is_bit_set
+         U _BN_lshift
+         U _BN_lshift1
+00005d44 T _BN_mod_inverse
+         U _BN_mul
+         U _BN_mul_word
+         U _BN_new
+         U _BN_nnmod
+         U _BN_num_bits
+         U _BN_rshift
+         U _BN_rshift1
+         U _BN_set_word
+         U _BN_sub
+         U _BN_uadd
+         U _BN_ucmp
+         U _BN_usub
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_lib.o):
+000078d0 T _BN_bin2bn
+00007128 T _BN_bn2bin
+00006a0c T _BN_clear
+00006be0 T _BN_clear_bit
+00006614 T _BN_clear_free
+00006af0 T _BN_cmp
+000076fc T _BN_copy
+00007350 T _BN_dup
+000066b4 T _BN_free
+00006498 T _BN_get_params
+0000701c T _BN_get_word
+00007250 T _BN_high_bit
+00006730 T _BN_init
+00006c84 T _BN_is_bit_set
+00006ccc T _BN_mask_bits
+0000674c T _BN_new
+00006e30 T _BN_num_bits
+00006584 T _BN_num_bits_word
+0000651c T _BN_options
+00007a60 T _BN_set_bit
+000063d4 T _BN_set_params
+00007834 T _BN_set_word
+00006998 T _BN_swap
+00006a5c T _BN_ucmp
+00006500 T _BN_value_one
+000c1b58 s _bits.2749
+00006ef0 T _bn_cmp_part_words
+00006d8c T _bn_cmp_words
+000074f8 T _bn_dup_expand
+00006930 T _bn_expand2
+00006794 t _bn_expand_internal
+000e5eec b _bn_limit_bits
+000e5ee8 b _bn_limit_bits_high
+000e5ee4 b _bn_limit_bits_low
+000e5ee0 b _bn_limit_bits_mont
+000d8010 d _bn_limit_num
+000d800c d _bn_limit_num_high
+000d8008 d _bn_limit_num_low
+000d8004 d _bn_limit_num_mont
+000d8014 d _const_one.2736
+000e5ef0 b _data.2742
+000d8028 d _data_one.2735
+         U _free
+000e5f00 b _init.2741
+         U _malloc
+         U _memset
+         u _sprintf$LDBLStub
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_mod.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+         U _BN_add
+         U _BN_cmp
+         U _BN_copy
+         U _BN_div
+         U _BN_dup
+         U _BN_free
+         U _BN_lshift
+         U _BN_lshift1
+00007e88 T _BN_mod_add
+00007bdc T _BN_mod_add_quick
+000081dc T _BN_mod_lshift
+0000811c T _BN_mod_lshift1
+00007d24 T _BN_mod_lshift1_quick
+00007d98 T _BN_mod_lshift_quick
+00008008 T _BN_mod_mul
+00007cbc T _BN_mod_sqr
+00007f48 T _BN_mod_sub
+00007c50 T _BN_mod_sub_quick
+         U _BN_mul
+00007b2c T _BN_nnmod
+         U _BN_num_bits
+         U _BN_sqr
+         U _BN_sub
+         U _BN_ucmp
+         U _BN_usub
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_mont.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+00008a30 T _BN_MONT_CTX_copy
+000087e0 T _BN_MONT_CTX_free
+00008794 T _BN_MONT_CTX_init
+00008abc T _BN_MONT_CTX_new
+00008848 T _BN_MONT_CTX_set
+         U _BN_copy
+         U _BN_div
+         U _BN_free
+00008384 T _BN_from_montgomery
+         U _BN_init
+         U _BN_lshift
+         U _BN_mod_inverse
+000086dc T _BN_mod_mul_montgomery
+         U _BN_mul
+         U _BN_num_bits
+         U _BN_set_bit
+         U _BN_set_word
+         U _BN_sqr
+         U _BN_sub_word
+         U _BN_ucmp
+         U _BN_usub
+         U _bn_expand2
+         U _bn_mul_add_words
+         U _free
+         U _malloc
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_mul.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+         U _BN_copy
+000090cc T _BN_mul
+         U _BN_num_bits_word
+         U _BN_set_word
+         U _bn_add_words
+         U _bn_cmp_words
+         U _bn_expand2
+         U _bn_mul_add_words
+         U _bn_mul_comba4
+         U _bn_mul_comba8
+0000938c T _bn_mul_high
+00008b1c T _bn_mul_low_normal
+00009bd0 T _bn_mul_low_recursive
+00008bdc T _bn_mul_normal
+000097f8 T _bn_mul_part_recursive
+00008ce8 T _bn_mul_recursive
+         U _bn_mul_words
+         U _bn_sub_words
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_recp.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+00009e44 T _BN_RECP_CTX_free
+00009e04 T _BN_RECP_CTX_init
+00009fa0 T _BN_RECP_CTX_new
+00009ea0 T _BN_RECP_CTX_set
+         U _BN_add_word
+         U _BN_copy
+         U _BN_div
+00009ff4 T _BN_div_recp
+         U _BN_free
+         U _BN_init
+0000a2d4 T _BN_mod_mul_reciprocal
+         U _BN_mul
+         U _BN_num_bits
+00009f04 T _BN_reciprocal
+         U _BN_rshift
+         U _BN_set_bit
+         U _BN_set_word
+         U _BN_sqr
+         U _BN_ucmp
+         U _BN_usub
+         U _free
+         U _malloc
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_shift.o):
+0000a5dc T _BN_lshift
+0000a3a0 T _BN_lshift1
+0000a76c T _BN_rshift
+0000a498 T _BN_rshift1
+         U _BN_set_word
+         U _bn_expand2
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_sqr.o):
+         U _BN_CTX_end
+         U _BN_CTX_get
+         U _BN_CTX_start
+         U _BN_copy
+         U _BN_num_bits_word
+0000acd8 T _BN_sqr
+         U _bn_add_words
+         U _bn_cmp_words
+         U _bn_expand2
+         U _bn_mul_add_words
+         U _bn_mul_words
+         U _bn_sqr_comba4
+         U _bn_sqr_comba8
+0000a910 T _bn_sqr_normal
+0000aa1c T _bn_sqr_recursive
+         U _bn_sqr_words
+         U _bn_sub_words
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bn_word.o):
+0000b3e8 T _BN_add_word
+0000b0d8 T _BN_div_word
+0000b050 T _BN_mod_word
+0000b198 T _BN_mul_word
+         U _BN_set_word
+0000b238 T _BN_sub_word
+         u ___umoddi3
+         U _bn_div_words
+         U _bn_expand2
+         U _bn_mul_words
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certcget.o):
+         U _addAttributeField
+         U _certWriteTable
+         U _deleteAttribute
+         U _deleteAttributeField
+0000c088 T _deleteCertComponent
+         U _deleteDN
+         U _deleteDNComponent
+         U _encodePKIUserValue
+         U _findAttribute
+         U _findAttributeField
+         U _findAttributeFieldEx
+0000b760 t _getCertAttributeComponent
+0000c660 T _getCertComponent
+         U _getDNComponentValue
+         U _getDefaultFieldValue
+         U _getHashParameters
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+0000b5e4 T _moveCursorToField
+0000b4e8 T _oidToText
+         U _sMemClose
+         U _sMemDisconnect
+         U _sMemOpen
+0000be0c T _selectDN
+0000ba64 T _selectGeneralName
+         U _sizeofObject
+         u _sprintf$LDBLStub
+         U _strlen
+         U _swrite
+0000b910 T _syncSelection
+000d7f38 s _value.5917
+         U _writeConstructed
+         U _writeDNstring
+         U _writeInteger
+         U _writeOctetString
+         U _writeSequence
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certchk.o):
+000c1c64 s _certTypeInfo
+         U _checkAttributePresent
+0000ec8c T _checkCert
+0000d4bc T _checkCertUsage
+0000e678 T _checkNameConstraints
+0000d40c T _checkPolicyConstraints
+         U _compareDN
+000c1cac s _extendedUsageInfo
+         U _findAttributeField
+0000d774 T _getKeyUsageFromExtKeyUsage
+         U _getTime
+         U _krnlSendMessage
+         U _memcmp
+0000ddd4 t _wildcardStringMatch
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certchn.o):
+00010ec4 T _assembleCertChain
+00010a0c t _buildCertChain
+00010020 t _buildCertChainInfo
+         U _checkAttributePresent
+         U _checkCert
+0001013c T _checkCertChain
+         U _checkEOC
+         U _checkNameConstraints
+         U _checkPolicyConstraints
+         U _checkX509signature
+         U _compareSerialNumber
+00010700 T _copyCertChain
+         U _findAttribute
+         U _findAttributeField
+         U _importCert
+         U _krnlGetObject
+         U _krnlReleaseObject
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+0001106c T _readCertChain
+         U _readConstructed
+         U _readConstructedI
+         U _readGenericHole
+         U _readRawObjectTag
+         U _readSequence
+         U _readSequenceI
+         U _readSet
+         U _readShortIntegerTag
+         U _readUniversal
+         U _sMemConnect
+         U _sMemDisconnect
+00011698 T _sizeofCertSet
+         U _sizeofObject
+0000fde4 t _sortCertChain
+         U _sseek
+         U _swrite
+000113c0 T _writeCertChain
+000118ac T _writeCertSequence
+00011740 T _writeCertSet
+         U _writeConstructed
+         U _writeSequence
+         U _writeSet
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certcset.o):
+         U _addAttributeField
+00011da0 T _addCertComponent
+         U _addRevocationEntry
+         U _addValidityEntry
+         U _compareDN
+         U _copyAttributes
+         U _copyCertChain
+         U _copyDN
+00011bc4 t _copyPublicKeyInfo
+         U _copyRequestAttributes
+         U _copyRevocationAttributes
+         U _copyRevocationEntries
+         U _copyValidityEntries
+         U _deleteCertComponent
+         U _deleteDN
+         U _findAttribute
+         U _findAttributeField
+         U _findAttributeFieldEx
+         U _free
+         U _getApproxTime
+         U _getCertComponent
+         U _getDNComponentValue
+         U _getHashParameters
+         U _insertDNComponent
+         U _krnlGetObject
+         U _krnlReleaseObject
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _messageValueTrue
+         U _moveAttributeCursor
+         U _moveCursorToField
+         U _readBitStringHole
+         U _readCRLentry
+         U _readDNstring
+         U _readSequence
+         U _readUniversal
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _selectDN
+         U _selectGeneralName
+00011a14 T _setSerialNumber
+00013788 t _setXyzzyInfo
+         U _sizeofAlgoID
+         U _sizeofDN
+         U _sizeofObject
+         U _syncSelection
+         U _writeAlgoID
+         U _writeDN
+         U _writeInteger
+         U _writeOctetString
+         U _writeSequence
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certdn.o):
+         U ___toupper
+         U _addCertComponent
+000db844 s _certInfoOIDs
+00014618 T _checkDN
+00013d20 T _compareDN
+00014450 T _convertEmail
+00014df0 T _copyDN
+         U _copyFromAsn1String
+         U _copyToAsn1String
+000c1d3c s _countryCodes.5570
+00015038 T _deleteDN
+00014f20 T _deleteDNComponent
+000d802c d _dnSortTable
+         U _free
+00013c80 T _getDNComponentValue
+00013c74 T _insertDNComponent
+000138e0 t _insertDNstring
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _readBitStringHole
+00013df4 T _readDN
+00014710 T _readDNstring
+         U _readGenericHole
+         U _readRawObjectTag
+         U _readSequence
+         U _readSet
+         U _readUniversal
+         U _sPeek
+000150dc T _sizeofDN
+         U _sizeofObject
+         U _sputc
+         U _sseek
+         U _strlen
+         U _strncasecmp
+         U _swrite
+         U _writeCharacterString
+         U _writeConstructed
+000140f0 T _writeDN
+000142bc T _writeDNstring
+         U _writeSequence
+         U _writeSet
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certechk.o):
+00015320 t _checkAttribute
+00015888 T _checkAttributes
+         U _memset
+         U _selectAttributeInfo
+         U _sizeofObject
+000151d0 t _updateStackedInfo
+         U _writeAttributeField
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certedef.o):
+         U __DefaultRuneLocale
+         U ___maskrune
+         U _checkDN
+00015dc0 t _checkDNS
+00015a60 t _checkDirectoryName
+00015dd0 t _checkHTTP
+00015db0 t _checkRFC822
+00015da0 t _checkURL
+00015ab8 t _checkURLString
+000ddcc0 s _cmsAttributeInfo
+000dea64 s _contentTypeInfo
+000dbdf4 s _extensionInfo
+000dda38 s _generalNameInfo
+000dd984 s _holdInstructionInfo
+00015a30 T _selectAttributeInfo
+         U _strncasecmp
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certexrd.o):
+         U _addAttribute
+         U _addAttributeField
+         U _deleteDN
+000d7f38 s _dummy.5586
+         U _krnlSendMessage
+         U _memcmp
+         U _oidToAttribute
+0001638c t _readAttribute
+00015fd4 t _readAttributeField
+00016c24 T _readAttributes
+         U _readBitStringTag
+         U _readBooleanTag
+         U _readConstructed
+         U _readDN
+         U _readEnumeratedTag
+         U _readGeneralizedTimeTag
+00015de0 t _readIdentifierFields
+         U _readOctetStringHole
+         U _readOctetStringTag
+         U _readRawObjectTag
+         U _readSequence
+         U _readSet
+         U _readShortIntegerTag
+         U _readUTCTimeTag
+         U _readUniversal
+         U _sPeek
+         U _sgetc
+         U _sseek
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certext.o):
+         U __DefaultRuneLocale
+00017bdc T _addAttribute
+00018598 T _addAttributeField
+00017dcc T _checkAttributePresent
+         U _checkTextStringData
+000c1ddc s _completeAttribute.5704
+         U _convertEmail
+00017e0c t _copyAttribute
+00018e1c T _copyAttributes
+         U _copyDN
+00019134 T _copyIssuerAttributes
+0001952c T _copyRequestAttributes
+00018144 T _copyRevocationAttributes
+000c1e70 s _defaultField.5703
+00018240 T _deleteAttribute
+000176f4 T _deleteAttributeField
+000184d8 T _deleteAttributes
+         U _deleteDN
+00017248 t _fieldIDToAttribute
+00017604 T _findAttribute
+00017394 T _findAttributeByOID
+0001741c T _findAttributeField
+000174cc T _findAttributeFieldEx
+00018c1c T _fixAttributes
+         U _free
+000176b8 T _getDefaultFieldValue
+         U _getObjectLength
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+000177f0 T _moveAttributeCursor
+000171b8 T _oidToAttribute
+         U _selectAttributeInfo
+         U _textToOID
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certexwr.o):
+00019658 t _getNextEncodedAttribute
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _sMemDisconnect
+         U _sMemOpen
+00019870 T _sizeofAttributes
+         U _sizeofDN
+         U _sizeofObject
+         U _sputc
+         U _sseek
+         U _swrite
+0001a0c4 t _writeAttribute
+000199dc T _writeAttributeField
+0001a348 T _writeAttributes
+         U _writeBitString
+         U _writeBoolean
+         U _writeCharacterString
+         U _writeConstructed
+         U _writeDN
+         U _writeEnumerated
+         U _writeGeneralizedTime
+         U _writeInteger
+         U _writeNull
+         U _writeOctetString
+         U _writeOctetStringHole
+         U _writeSequence
+         U _writeSet
+         U _writeShortInteger
+         U _writeUTCTime
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certio.o):
+         U _base64checkHeader
+         U _base64decode
+         U _base64decodeLen
+         U _base64encode
+         U _base64encodeLen
+         U _certReadTable
+         U _checkEOC
+         U _checkObjectEncoding
+         U _createCertificateInfo
+0001b414 T _exportCert
+         U _free
+         U _getLongObjectLength
+         U _getObjectLength
+0001a650 T _importCert
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _messageValueCryptOK
+         U _messageValueCryptUnused
+         U _readCertChain
+         U _readConstructed
+         U _readConstructedI
+         U _readLongSequence
+         U _readOID
+         U _readOctetStringHole
+         U _readRawObjectTag
+         U _readSequence
+         U _readSequenceI
+         U _readSet
+         U _readShortIntegerTag
+         U _readUniversal
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sPeek
+         U _sgetc
+         U _sizeofCertSet
+         U _sizeofObject
+         U _sseek
+         U _writeCertChain
+         U _writeCertSequence
+         U _writeCertSet
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certrd.o):
+000dec38 S _certReadTable
+         U _fixAttributes
+         U _getStreamObjectLength
+         U _iCryptReadSubjectPublicKey
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memset
+         U _readAlgoID
+0001c4bc t _readAttributeCertInfo
+         U _readAttributes
+         U _readBitStringHole
+0001cac8 t _readCRLInfo
+         U _readCRLentry
+0001ce00 t _readCertInfo
+0001d2b4 t _readCertRequestInfo
+0001b674 t _readCmsAttributes
+         U _readConstructed
+         U _readContextAlgoID
+0001b9f8 t _readCrmfRequestInfo
+         U _readDN
+         U _readGeneralizedTimeTag
+         U _readGenericHole
+         U _readIntegerTag
+         U _readLongSequence
+         U _readOcspRequestEntry
+0001c09c t _readOcspRequestInfo
+         U _readOcspResponseEntry
+0001c25c t _readOcspResponseInfo
+         U _readOctetStringTag
+0001b690 t _readPkiUserInfo
+0001c818 t _readRevRequestInfo
+         U _readRtcsRequestEntry
+0001be10 t _readRtcsRequestInfo
+         U _readRtcsResponseEntry
+0001bf68 t _readRtcsResponseInfo
+         U _readSequence
+         U _readShortIntegerTag
+         U _readUTCTimeTag
+         U _readUniversal
+0001b908 t _readValidity
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+         U _setSerialNumber
+         U _sread
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certrev.o):
+         U _addAttributeField
+0001d4c0 T _addRevocationEntry
+0001e19c T _checkRevocation
+         U _checksumData
+0001d6e0 T _copyRevocationEntries
+         U _deleteAttributes
+0001d644 T _deleteRevocationEntries
+         U _findAttributeField
+         U _free
+         U _getCertComponent
+         U _getHashParameters
+         U _getStreamObjectLength
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _readAttributes
+0001d824 T _readCRLentry
+         U _readConstructed
+         U _readEnumeratedTag
+         U _readGeneralizedTimeTag
+         U _readIntegerTag
+0001d9f4 t _readOcspID
+0001dbe4 T _readOcspRequestEntry
+0001dcdc T _readOcspResponseEntry
+         U _readSequence
+         U _readUTCTimeTag
+         U _readUniversal
+         U _sPeek
+         U _sizeofAttributes
+0001d7b8 T _sizeofCRLentry
+         U _sizeofObject
+0001e038 T _sizeofOcspRequestEntry
+0001e088 T _sizeofOcspResponseEntry
+         U _sread
+         U _sseek
+         U _swrite
+         U _writeAttributes
+0001d92c T _writeCRLentry
+         U _writeConstructed
+         U _writeGeneralizedTime
+         U _writeInteger
+         U _writeNull
+0001e104 T _writeOcspRequestEntry
+0001df34 T _writeOcspResponseEntry
+         U _writeSequence
+         U _writeUTCTime
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certsig.o):
+         U _certWriteTable
+         U _checkCert
+         U _checkCertChain
+         U _checkCertUsage
+0001f374 T _checkCertValidity
+0001f1e0 T _checkOCSPResponse
+0001f124 T _checkRTCSResponse
+         U _checkRevocation
+         U _checkX509signature
+         U _copyCertChain
+         U _copyRevocationAttributes
+         U _createX509signature
+         U _exportCert
+         U _exportCertToStream
+         U _free
+         U _getHashParameters
+         U _getReliableTime
+         U _getTime
+         U _iCryptReadSubjectPublicKey
+         U _krnlGetObject
+         U _krnlReleaseObject
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memset
+         U _messageValueCryptUnused
+         U _messageValueTrue
+         U _readConstructed
+         U _readSequence
+         U _readUniversal
+0001e318 t _recoverCertData
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sPeek
+         U _setSerialNumber
+0001e600 T _signCert
+         U _sizeofObject
+         U _sseek
+         U _swrite
+         U _writeConstructed
+         U _writeInteger
+         U _writeSequence
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certstr.o):
+         U __DefaultRuneLocale
+         U ___maskrune
+000c1f04 s _asn1CharFlags
+000c2184 s _charMap.5789
+0001fd48 T _checkTextStringData
+000200bc T _copyFromAsn1String
+0001fe28 T _copyToAsn1String
+         U _memcpy
+         U _memmove
+000c2104 s _utf8bytesTbl
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certrust.o):
+00020c9c t _addEntry
+000212e0 T _addTrustEntry
+         U _checksumData
+000206e8 T _deleteTrustEntry
+         U _dynCreate
+         U _dynDestroy
+00020a50 T _endTrustInfo
+000208a0 T _enumTrustedCerts
+00020b60 T _findTrustEntry
+         U _free
+         U _getHashParameters
+0002079c T _getTrustedCert
+000e5f04 b _hashFunction.5424
+0002084c T _initTrustInfo
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _messageValueCursorFirst
+         U _messageValueCursorNext
+         U _messageValueFalse
+         U _messageValueTrue
+         U _readConstructed
+         U _readSequence
+         U _readUniversal
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+         U _sizeofObject
+         U _sseek
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certval.o):
+00021500 T _addValidityEntry
+000218e0 T _checkValidity
+         U _checksumData
+00021670 T _copyValidityEntries
+         U _deleteAttributes
+000215f8 T _deleteValidityEntries
+         U _free
+         U _getCertComponent
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _readAttributes
+         U _readBooleanTag
+         U _readConstructed
+         U _readEnumeratedTag
+         U _readOctetStringTag
+00021984 T _readRtcsRequestEntry
+00021b10 T _readRtcsResponseEntry
+         U _readSequence
+         U _readUniversal
+         U _sizeofAttributes
+         U _sizeofObject
+00021710 T _sizeofRtcsRequestEntry
+0002178c T _sizeofRtcsResponseEntry
+         U _writeAttributes
+         U _writeBoolean
+         U _writeEnumerated
+         U _writeOctetString
+0002173c T _writeRtcsRequestEntry
+000217f8 T _writeRtcsResponseEntry
+         U _writeSequence
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(certwr.o):
+         U _addAttributeField
+         U _addCertComponent
+         U _adjustPKIUserValue
+000decb0 S _certWriteTable
+         U _checkAttributePresent
+         U _checkAttributes
+         U _checkCert
+         U _checkDN
+         U _compareDN
+         U _copyDN
+         U _copyIssuerAttributes
+         U _findAttributeField
+         U _getApproxTime
+         U _getKeyUsageFromExtKeyUsage
+         U _getTime
+         U _krnlSendMessage
+00021d14 t _preEncodeCertificate
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sizeofAttributes
+         U _sizeofCRLentry
+         U _sizeofContextAlgoID
+         U _sizeofDN
+         U _sizeofObject
+         U _sizeofOcspRequestEntry
+         U _sizeofOcspResponseEntry
+         U _sizeofRtcsRequestEntry
+         U _sizeofRtcsResponseEntry
+         U _swrite
+000224d0 t _writeAttributeCertInfo
+         U _writeAttributes
+00022c50 t _writeCRLInfo
+         U _writeCRLentry
+00022290 t _writeCertInfo
+000226e4 t _writeCertRequestInfo
+00022ea0 t _writeCmsAttributes
+         U _writeConstructed
+         U _writeContextAlgoID
+00022884 t _writeCrmfRequestInfo
+         U _writeDN
+         U _writeGeneralizedTime
+         U _writeInteger
+         U _writeOcspRequestEntry
+00023368 t _writeOcspRequestInfo
+         U _writeOcspResponseEntry
+00023674 t _writeOcspResponseInfo
+         U _writeOctetString
+00023868 T _writePkiUserInfo
+00022b04 t _writeRevRequestInfo
+         U _writeRtcsRequestEntry
+00023010 t _writeRtcsRequestInfo
+         U _writeRtcsResponseEntry
+00023210 t _writeRtcsResponseInfo
+         U _writeSequence
+         U _writeShortInteger
+         U _writeUTCTime
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(aescrypt.o):
+00024c44 T _aes_decrypt
+00023bf8 T _aes_encrypt
+         U _t_fl
+         U _t_fn
+         U _t_il
+         U _t_in
+
+/opt/local/lib/libcl.dylib(aeskey.o):
+00028934 T _aes_decrypt_key
+00026c8c T _aes_decrypt_key128
+00027424 T _aes_decrypt_key192
+00027cc4 T _aes_decrypt_key256
+00026c34 T _aes_encrypt_key
+00025c78 T _aes_encrypt_key128
+0002612c T _aes_encrypt_key192
+000265f4 T _aes_encrypt_key256
+         U _t_fl
+         U _t_im
+         U _t_rc
+
+/opt/local/lib/libcl.dylib(aestab.o):
+0002898c T _gen_tabs
+000c51bc S _t_fl
+000c61bc S _t_fn
+000c31bc S _t_il
+000c21bc S _t_im
+000c41bc S _t_in
+000c71bc S _t_rc
+
+/opt/local/lib/libcl.dylib(bfecb.o):
+         U _BF_decrypt
+000289ac T _BF_ecb_encrypt
+         U _BF_encrypt
+00028990 T _BF_options
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(bfenc.o):
+0002935c T _BF_cbc_encrypt
+00028ef4 T _BF_decrypt
+00028a8c T _BF_encrypt
+
+/opt/local/lib/libcl.dylib(bfskey.o):
+         U _BF_encrypt
+000298ec T _BF_set_key
+000c71e4 s _bf_init
+         U _memcpy
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(castecb.o):
+         U _CAST_decrypt
+00029a3c T _CAST_ecb_encrypt
+         U _CAST_encrypt
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(castenc.o):
+         U _CAST_S_table0
+         U _CAST_S_table1
+         U _CAST_S_table2
+         U _CAST_S_table3
+0002a400 T _CAST_cbc_encrypt
+00029f78 T _CAST_decrypt
+00029b1c T _CAST_encrypt
+
+/opt/local/lib/libcl.dylib(castskey.o):
+000c9e2c S _CAST_S_table0
+000c9a2c S _CAST_S_table1
+000c962c S _CAST_S_table2
+000c922c S _CAST_S_table3
+000c8e2c S _CAST_S_table4
+000c8a2c S _CAST_S_table5
+000c862c S _CAST_S_table6
+000c822c S _CAST_S_table7
+0002a990 T _CAST_set_key
+
+/opt/local/lib/libcl.dylib(descbc.o):
+         U _des_encrypt1
+0002b598 T _des_ncbc_encrypt
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(desecb.o):
+000e5f08 b _buf.2415
+000ca22c S _des_SPtrans
+0002bbec T _des_ecb_encrypt
+         U _des_encrypt1
+0002bb6c T _des_options
+000d8044 d _init.2414
+         u _sprintf$LDBLStub
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(desecb3.o):
+         U _des_decrypt3
+0002bcbc T _des_ecb3_encrypt
+         U _des_encrypt3
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(desenc.o):
+         U _des_SPtrans
+0002e41c T _des_decrypt3
+0002e5a8 T _des_ede3_cbc_encrypt
+0002bda4 T _des_encrypt1
+0002d0b4 T _des_encrypt2
+0002e294 T _des_encrypt3
+000d804c D _version1
+000d8048 D _version2
+
+/opt/local/lib/libcl.dylib(desskey.o):
+000d8050 D _des_check_key
+0002ec04 T _des_check_key_parity
+0002ef5c T _des_fixup_key_parity
+0002ec6c T _des_is_weak_key
+0002f068 T _des_key_sched
+0002f144 T _des_set_key
+0002ef98 T _des_set_key_checked
+0002ecd8 T _des_set_key_unchecked
+0002ebc8 T _des_set_odd_parity
+000caa2c s _des_skb
+         U _memcmp
+000cb22c s _odd_parity
+000d80d4 d _shifts2.2471
+000d8054 d _weak_keys
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(icbc.o):
+0002fad4 T _idea_cbc_encrypt
+0002f220 T _idea_encrypt
+
+/opt/local/lib/libcl.dylib(iecb.o):
+00030080 T _idea_ecb_encrypt
+         U _idea_encrypt
+00030064 T _idea_options
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(iskey.o):
+00030334 T _idea_set_decrypt_key
+0003014c T _idea_set_encrypt_key
+
+/opt/local/lib/libcl.dylib(rc2cbc.o):
+0003076c T _RC2_cbc_encrypt
+000305f4 T _RC2_decrypt
+0003049c T _RC2_encrypt
+
+/opt/local/lib/libcl.dylib(rc2ecb.o):
+         U _RC2_decrypt
+00030cfc T _RC2_ecb_encrypt
+         U _RC2_encrypt
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(rc2skey.o):
+00030ddc T _RC2_set_key
+000d8114 d _key_table
+
+/opt/local/lib/libcl.dylib(rc4enc.o):
+00030f24 T _RC4
+000cb32c s _is_endian.1921
+
+/opt/local/lib/libcl.dylib(rc4skey.o):
+00031968 T _RC4_options
+00031984 T _RC4_set_key
+
+/opt/local/lib/libcl.dylib(rc5ecb.o):
+         U _RC5_32_decrypt
+00031a90 T _RC5_32_ecb_encrypt
+         U _RC5_32_encrypt
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(rc5enc.o):
+00032530 T _RC5_32_cbc_encrypt
+000320b4 T _RC5_32_decrypt
+00031b70 T _RC5_32_encrypt
+
+/opt/local/lib/libcl.dylib(rc5skey.o):
+00032ac0 T _RC5_32_set_key
+
+/opt/local/lib/libcl.dylib(skipjack.o):
+000cb330 s _fTable
+00033680 T _skipjackDecrypt
+00032dec T _skipjackEncrypt
+00032d94 T _skipjackMakeKey
+
+/opt/local/lib/libcl.dylib(dev_fort.o):
+
+/opt/local/lib/libcl.dylib(dev_pk11.o):
+
+/opt/local/lib/libcl.dylib(dev_sys.o):
+00033f30 T _addRandomData
+00034654 T _addRandomLong
+         U _aesDecryptCBC
+         U _aesDecryptCFB
+         U _aesDecryptECB
+         U _aesDecryptOFB
+         U _aesEncryptCBC
+         U _aesEncryptCFB
+         U _aesEncryptECB
+         U _aesEncryptOFB
+         U _aesGetInfo
+         U _aesInitKey
+         U _aesSelfTest
+         U _blowfishDecryptCBC
+         U _blowfishDecryptCFB
+         U _blowfishDecryptECB
+         U _blowfishDecryptOFB
+         U _blowfishEncryptCBC
+         U _blowfishEncryptCFB
+         U _blowfishEncryptECB
+         U _blowfishEncryptOFB
+         U _blowfishGetInfo
+         U _blowfishInitKey
+         U _blowfishSelfTest
+000d8214 d _capabilities
+         U _castDecryptCBC
+         U _castDecryptCFB
+         U _castDecryptECB
+         U _castDecryptOFB
+         U _castEncryptCBC
+         U _castEncryptCFB
+         U _castEncryptECB
+         U _castEncryptOFB
+         U _castGetInfo
+         U _castInitKey
+         U _castSelfTest
+         U _checkForked
+00034780 t _controlFunction
+         U _createCertificate
+         U _createContext
+         U _createDevice
+         U _createEnvelope
+         U _createKeyset
+000dee28 s _createObjectFunctions
+         U _createSession
+         U _createUser
+00034358 T _cryptAddRandom
+         U _deriveCMP
+         U _derivePGP
+         U _derivePKCS5
+         U _deriveSSL
+         U _deriveTLS
+         U _des3DecryptCBC
+         U _des3DecryptCFB
+         U _des3DecryptECB
+         U _des3DecryptOFB
+         U _des3EncryptCBC
+         U _des3EncryptCFB
+         U _des3EncryptECB
+         U _des3EncryptOFB
+         U _des3GetInfo
+         U _des3InitKey
+         U _des3SelfTest
+0003428c t _des3TestLoop
+         U _desDecryptCBC
+         U _desDecryptCFB
+         U _desDecryptECB
+         U _desDecryptOFB
+         U _desEncryptCBC
+         U _desEncryptCFB
+         U _desEncryptECB
+         U _desEncryptOFB
+         U _desGetInfo
+         U _desInitKey
+         U _desSelfTest
+         U _des_ecb3_encrypt
+         U _des_key_sched
+         U _des_set_key_unchecked
+         U _des_set_odd_parity
+         U _dhDecrypt
+         U _dhEncrypt
+         U _dhGenerateKey
+         U _dhInitKey
+         U _dhSelfTest
+         U _dsaGenerateKey
+         U _dsaInitKey
+         U _dsaSelfTest
+         U _dsaSigCheck
+         U _dsaSign
+         U _elgamalDecrypt
+         U _elgamalEncrypt
+         U _elgamalGenerateKey
+         U _elgamalInitKey
+         U _elgamalSelfTest
+00034058 T _endRandomData
+         U _exportCMS
+         U _exportPKCS1
+         U _exportPKCS1PGP
+         U _exportPrivateKey
+         U _exportPrivateKeyPKCS8
+         U _fastPoll
+00034128 t _generateX917
+         U _getHashParameters
+         U _getInfo
+00034b14 t _getRandomFunction
+         U _getTime
+000dee68 s _hashData.5201
+000e5f2c b _hashFunction.5408
+000e5f28 b _hashSize.5409
+         U _hmacMD5GetInfo
+         U _hmacMD5Hash
+         U _hmacMD5InitKey
+         U _hmacMD5SelfTest
+         U _hmacRIPEMD160GetInfo
+         U _hmacRIPEMD160Hash
+         U _hmacRIPEMD160InitKey
+         U _hmacRIPEMD160SelfTest
+         U _hmacSHAGetInfo
+         U _hmacSHAHash
+         U _hmacSHAInitKey
+         U _hmacSHASelfTest
+         U _ideaDecryptCBC
+         U _ideaDecryptCFB
+         U _ideaDecryptECB
+         U _ideaDecryptOFB
+         U _ideaEncryptCBC
+         U _ideaEncryptCFB
+         U _ideaEncryptECB
+         U _ideaEncryptOFB
+         U _ideaGetInfo
+         U _ideaInitKey
+         U _ideaSelfTest
+         U _importCMS
+         U _importPKCS1
+         U _importPKCS1PGP
+         U _importPrivateKey
+         U _importPrivateKeyOpenPGP
+         U _importPrivateKeyPGP
+         U _importPrivateKeyPKCS8
+00034458 t _initFunction
+         U _initKeyParams
+00033f18 T _initRandomData
+         U _initRandomPolling
+         U _krnlMemalloc
+         U _krnlMemfree
+         U _krnlSendMessage
+         U _md2GetInfo
+         U _md2Hash
+         U _md2SelfTest
+         U _md4GetInfo
+         U _md4Hash
+         U _md4SelfTest
+         U _md5GetInfo
+         U _md5Hash
+         U _md5SelfTest
+000ded20 s _mechanismFunctions
+         U _memcmp
+         U _memcpy
+         U _memset
+000e5f30 b _nonceData.5407
+000e5f58 b _nonceDataInitialised.5406
+         U _rc2DecryptCBC
+         U _rc2DecryptCFB
+         U _rc2DecryptECB
+         U _rc2DecryptOFB
+         U _rc2EncryptCBC
+         U _rc2EncryptCFB
+         U _rc2EncryptECB
+         U _rc2EncryptOFB
+         U _rc2GetInfo
+         U _rc2InitKey
+         U _rc2SelfTest
+         U _rc4Encrypt
+         U _rc4GetInfo
+         U _rc4InitKey
+         U _rc4SelfTest
+         U _rc5DecryptCBC
+         U _rc5DecryptCFB
+         U _rc5DecryptECB
+         U _rc5DecryptOFB
+         U _rc5EncryptCBC
+         U _rc5EncryptCFB
+         U _rc5EncryptECB
+         U _rc5EncryptOFB
+         U _rc5GetInfo
+         U _rc5InitKey
+         U _rc5SelfTest
+         U _ripemd160GetInfo
+         U _ripemd160Hash
+         U _ripemd160SelfTest
+         U _rsaDecrypt
+         U _rsaEncrypt
+         U _rsaGenerateKey
+         U _rsaInitKey
+         U _rsaSelfTest
+000343ec T _setDeviceSystem
+         U _shaGetInfo
+         U _shaHash
+         U _shaSelfTest
+00034610 t _shutdownFunction
+         U _sigcheckPKCS1
+         U _signPKCS1
+         U _skipjackDecryptCBC
+         U _skipjackDecryptCFB
+         U _skipjackDecryptECB
+         U _skipjackDecryptOFB
+         U _skipjackEncryptCBC
+         U _skipjackEncryptCFB
+         U _skipjackEncryptECB
+         U _skipjackEncryptOFB
+         U _skipjackGetInfo
+         U _skipjackInitKey
+         U _skipjackSelfTest
+         U _slowPoll
+000cb5f8 s _testDP
+000cc438 s _testIP
+000cb8f8 s _testKP
+000cb430 s _testSB
+000cbe38 s _testVP
+         U _waitforRandomCompletion
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(denv_cms.o):
+         U _addAction
+000355e4 t _addContentListItem
+         U _appendContentListItem
+         U _checkEOC
+         U _createContentListItem
+000def6c s _envelopeOIDselection
+         U _free
+         U _getStreamObjectLength
+         U _inflateInit_
+00036420 T _initCMSDeenveloping
+         U _initEnvelopeEncryption
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memmove
+000deebc s _nestedContentOIDselection
+00035f4c t _processPostamble
+000358b4 t _processPreamble
+         U _queryAsn1Object
+         U _readCMSencrHeader
+         U _readCMSheader
+         U _readConstructed
+         U _readContextAlgoID
+         U _readRawObjectTag
+         U _readSetI
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+         U _sread
+         U _sseek
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(denv_pgp.o):
+         U _addAction
+00036454 t _addContentListItem
+         U _appendContentListItem
+         U _createContentListItem
+         U _deleteContentList
+         U _free
+         U _inflateInit2_
+         U _inflateInit_
+00036a7c T _initPGPDeenveloping
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memmove
+         U _pgpProcessIV
+         U _pgpReadPacketHeader
+0003682c t _processPostamble
+00036ab0 t _processPreamble
+         U _queryPgpObject
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sgetc
+         U _sread
+         U _sseek
+000cca4c s _typeMapTbl.5403
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(env_cms.o):
+         U _addAction
+         U _checkAlgoID
+00037458 t _checkCryptAlgo
+0003748c t _checkHashAlgo
+000df02c s _contentOIDs
+         U _deleteUnusedActions
+00038660 t _emitPostamble
+000377a0 t _emitPreamble
+         U _exportCertToStream
+         U _findAction
+         U _iCryptCreateSignatureEx
+         U _iCryptExportKeyEx
+000cca8c s _indefEOC.5447
+000374c4 T _initCMSEnveloping
+         U _initEnvelopeEncryption
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memmove
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sizeofCMSencrHeader
+         U _sizeofContextAlgoID
+         U _sizeofObject
+         U _swrite
+         U _writeCMSencrHeader
+         U _writeCMSheader
+         U _writeContextAlgoID
+         U _writeSet
+         U _writeShortInteger
+000375cc t _writeSignedDataHeader
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(env_dec.o):
+         U _checkEOC
+00038bdc t _copyFromDeenvelope
+0003913c t _copyToDeenvelope
+         U _inflate
+000390f8 T _initDeenvelopeStreaming
+         U _krnlSendMessage
+         U _memcpy
+         U _memmove
+0003901c t _processExtraData
+         U _readLongGenericHole
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sseek
+00038f1c t _syncDeenvelopeData
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(env_enc.o):
+00039bcc t _copyFromEnvelope
+00039d8c t _copyToEnvelope
+         U _deflate
+0003990c t _encodeSegmentHeader
+00039d60 T _initEnvelopeStreaming
+         U _krnlSendMessage
+         U _memcpy
+         U _memmove
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(env_pgp.o):
+         U _addAction
+0003a52c t _checkCryptAlgo
+0003a574 t _checkHashAlgo
+         U _cryptlibToPgpAlgo
+         U _deleteUnusedActions
+0003ae54 t _emitPostamble
+0003a5a8 t _emitPreamble
+         U _findAction
+         U _iCryptCreateSignatureEx
+         U _iCryptExportKeyEx
+         U _initEnvelopeEncryption
+0003af58 T _initPGPEnveloping
+000d7f3c s _keySize.5252
+         U _krnlSendMessage
+000ccab0 s _mode.5251
+         U _pgpProcessIV
+         U _pgpWritePacketHeader
+         U _sMemClose
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sputc
+         U _swrite
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(pgp_misc.o):
+0003b088 T _cryptlibToPgpAlgo
+         U _getHashParameters
+         U _krnlSendMessage
+         U _memcpy
+         U _memset
+000ccabc s _pgpAlgoMap
+0003b1ec T _pgpPasswordToKey
+0003b390 T _pgpProcessIV
+0003b100 T _pgpReadMPI
+0003b02c T _pgpToCryptlibAlgo
+0003b198 T _pgpWriteMPI
+         U _sgetc
+         U _sputc
+         U _sread
+         U _sseek
+         U _swrite
+000ccbd0 s _zeroIV.4881
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(resource.o):
+0003bdf8 T _addAction
+0003c10c t _addDeenvelopeInfo
+0003ccbc t _addEnvelopeInfo
+0003b658 T _appendContentListItem
+0003ba08 t _checkAction
+0003bbb4 t _checkMissingInfo
+         U _checkObjectEncoding
+0003b5dc T _createContentListItem
+         U _deflateInit_
+0003c004 T _deleteAction
+0003b514 T _deleteActionList
+0003b688 T _deleteContentList
+0003bec0 T _deleteUnusedActions
+0003b4dc T _findAction
+0003b9b0 T _findLastAction
+         U _free
+         U _freeMemPool
+         U _getMemPool
+         U _iCryptCheckSignatureEx
+         U _iCryptImportKeyEx
+0003b750 T _initEnvelopeEncryption
+0003b968 T _initResourceHandling
+         U _krnlSendMessage
+         U _memcmp
+         U _memset
+000ccbf0 s _mode.5850
+         U _pgpPasswordToKey
+         U _readConstructed
+         U _readRawObjectTag
+         U _readSequence
+         U _readSet
+         U _readUniversal
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sizeofAlgoIDex
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(md2dgst.o):
+0003d908 T _MD2_Final
+0003d618 T _MD2_Init
+0003d82c T _MD2_Update
+0003d5fc T _MD2_options
+000d8bc8 d _S
+0003d678 t _md2_block
+         U _memcpy
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(md4dgst.o):
+0003ec84 T _MD4_Final
+0003ee94 T _MD4_Init
+0003ec7c T _MD4_Transform
+0003e85c T _MD4_Update
+000ccbf4 s _end.4274
+0003e004 T _md4_block_data_order
+0003d9ec T _md4_block_host_order
+
+/opt/local/lib/libcl.dylib(md5dgst.o):
+00040770 T _MD5_Final
+00040980 T _MD5_Init
+00040768 T _MD5_Transform
+00040348 T _MD5_Update
+000ccbf8 s _end.4274
+0003f7f0 T _md5_block_data_order
+0003eed8 T _md5_block_host_order
+
+/opt/local/lib/libcl.dylib(rmddgst.o):
+00043f74 T _RIPEMD160_Final
+000441a4 T _RIPEMD160_Init
+00043f6c T _RIPEMD160_Transform
+00043b4c T _RIPEMD160_Update
+000ccbfc s _end.4275
+00042148 T _ripemd160_block_data_order
+000409c4 T _ripemd160_block_host_order
+
+/opt/local/lib/libcl.dylib(sha1dgst.o):
+00046ae8 T _SHA1_Final
+00046d14 T _SHA1_Init
+00046ad0 T _SHA1_Transform
+0004667c T _SHA1_Update
+000ccc00 s _end.4011
+00045314 T _sha1_block_data_order
+000441f4 T _sha1_block_host_order
+
+/opt/local/lib/libcl.dylib(dbxdbms.o):
+         U __DefaultRuneLocale
+         U ___maskrune
+000471f8 t _closeDatabase
+000ccc04 s _cmdTemplate.5440
+000ccc3c s _cmdTemplate.5457
+000ccc74 s _cmdTemplate.5464
+000ccce8 s _cmdTemplate.5481
+000cccac s _cmdTemplate.5539
+00047560 T _dbmsFormatQuery
+00047458 T _dbmsFormatSQL
+00047818 T _dbmsParseName
+00046d64 t _dispatchCommand
+00047b84 T _endDbxSession
+         U _free
+00047a3c T _initDbxSession
+         U _malloc
+         U _memcpy
+         U _memset
+00047dd0 T _netProcessCommand
+00047164 t _openDatabase
+00047250 t _performQuery
+00047444 t _performStaticQuery
+00047dbc t _performStaticUpdate
+00047bd8 t _performUpdate
+         U _sNetConnect
+         U _sNetDisconnect
+         U _sread
+         U _strchr
+         U _strlen
+         U _strncasecmp
+         U _swrite
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxdbx.o):
+0004915c T _addCRL
+000493b0 T _addCert
+         U _base64decode
+         U _base64encode
+         U _caAddCertRequest
+         U _caAddPKIUser
+         U _caGetIssuingUser
+         U _dbmsFormatQuery
+         U _dbmsFormatSQL
+         U _decodePKIUserValue
+00049fdc t _deleteItemFunction
+         U _dynCreate
+         U _dynDestroy
+         U _endDbxSession
+00049354 T _getCertKeyID
+00048d50 t _getFirstItemFunction
+         U _getHashParameters
+000488d4 T _getItemData
+00049ce4 t _getItemFunction
+00048fe8 T _getKeyID
+0004809c T _getKeyName
+000490c4 t _getNextItemFunction
+         U _iCryptImportCertIndirect
+         U _initDBMSCA
+         U _initDbxSession
+0004814c t _initFunction
+00048134 t _isBusyFunction
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _messageValueCryptUnused
+         U _messageValueCursorFirst
+         U _messageValueCursorNext
+         U _messageValueFalse
+         U _messageValueTrue
+0004881c T _setAccessMethodDBMS
+00049b14 t _setItemFunction
+00048774 t _shutdownFunction
+         U _strcpy
+         U _strlen
+         U _strncasecmp
+         U _updateCertLog
+000d7f40 s _value.5149
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxdca.o):
+         U _addCRL
+         U _addCert
+         U _base64decode
+         U _base64encode
+0004a7e0 T _caAddCertRequest
+0004a6f4 T _caAddPKIUser
+0004aad0 T _caGetIssuingUser
+0004acc0 t _caRevokeCert
+0004b2ec t _certMgmtFunction
+0004a50c t _checkRequest
+000d7f48 s _crlReason.5294
+000d7f44 s _crlReason.5295
+         U _dbmsFormatSQL
+         U _getApproxTime
+         U _getCertKeyID
+         U _getItemData
+         U _getKeyID
+         U _getKeyName
+         U _getTime
+0004ac98 T _initDBMSCA
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _messageValueCryptUnused
+0004b134 t _revokeCertDirect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sizeofObject
+         u _sprintf$LDBLStub
+         U _strcat
+         U _strcpy
+         U _strlen
+0004a3f4 t _updateCertErrorLog
+0004a168 T _updateCertLog
+         U _writeCharacterString
+         U _writeSequence
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxhttp.o):
+0004cb70 t _bufferAdjustCallback
+         U _free
+0004cbe0 t _getItemFunction
+         U _getLongObjectLength
+0004ce50 t _initFunction
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memset
+         U _sNetConnect
+         U _sNetDisconnect
+         U _sNetGetErrorInfo
+0004cf10 T _setAccessMethodHTTP
+0004ceb8 t _shutdownFunction
+         U _sioctl
+         U _sread
+         U _strcpy
+         U _strlen
+         U _strncasecmp
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxldap.o):
+
+/opt/local/lib/libcl.dylib(dbxmysql.o):
+
+/opt/local/lib/libcl.dylib(dbxoracl.o):
+
+/opt/local/lib/libcl.dylib(dbxpgp.o):
+         U ___toupper
+0004cf4c t _checkKeyMatch
+000d7f4c s _cryptMode.5856
+         U _free
+         U _getHashParameters
+0004e48c t _getItemFunction
+0004e8b8 t _initPrivateFunction
+0004d1a8 t _initPublicFunction
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueFalse
+         U _messageValueTrue
+         U _pgpPasswordToKey
+         U _pgpReadPacketHeader
+         U _pgpToCryptlibAlgo
+0004d64c t _readKeyring
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+0004d270 T _setAccessMethodPGPPrivate
+0004d228 T _setAccessMethodPGPPublic
+0004d3a0 t _setItemFunction
+         U _sgetc
+0004d2b8 t _shutdownFunction
+         U _sioctl
+         U _sread
+         U _sseek
+         U _strncasecmp
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxp12.o):
+
+/opt/local/lib/libcl.dylib(dbxp15.o):
+0004f6c8 t _deleteItemFunction
+0004e944 T _findEntry
+         U _free
+0004ec1c T _getValidityInfo
+0004f3b0 t _initFunction
+         U _initPKCS15read
+         U _initPKCS15write
+000df094 s _keyFileOIDselection
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memset
+0004f5d8 T _pkcs15Free
+0004eb64 T _pkcs15freeEntry
+         U _readCMSheader
+         U _readKeyset
+         U _readLongSequence
+         U _readUniversal
+         U _sPeek
+0004ecfc T _setAccessMethodPKCS15
+         U _sflush
+0004ed60 t _shutdownFunction
+         U _sioctl
+         U _sizeofObject
+         U _sseek
+         U _swrite
+         U _writeCMSheader
+         U _writeCharacterString
+         U _writeConstructed
+         U _writeSequence
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxp15r.o):
+         U _checkObjectEncoding
+000df0e4 s _cryptlibDataOIDselection
+000df0c4 s _dataOIDselection
+         U _dynCreate
+         U _dynDestroy
+         U _findEntry
+         U _free
+00051124 t _getFirstItemFunction
+         U _getHashParameters
+00050680 t _getItemFunction
+00050520 t _getNextItemFunction
+         U _getValidityInfo
+         U _iCryptImportCertIndirect
+         U _iCryptImportKeyEx
+         U _iCryptReadSubjectPublicKey
+00050648 T _initPKCS15read
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _queryAsn1Object
+         U _readBitStringTag
+         U _readBooleanTag
+         U _readCMSencrHeader
+         U _readCharacterString
+         U _readConstructed
+         U _readGeneralizedTimeTag
+         U _readGenericHole
+0004f7a8 T _readKeyset
+         U _readLongConstructed
+         U _readOID
+         U _readOIDSelection
+         U _readOctetStringTag
+         U _readSequence
+         U _readSet
+         U _readShortIntegerTag
+         U _readUTCTimeTag
+         U _readUniversal
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+         U _sizeofObject
+         U _sread
+         U _sseek
+000e5f5c b _trustedCertIndex.5976
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxp15w.o):
+0005124c t _addCert
+00051dc8 t _addCertChain
+         U _dynCreate
+         U _dynDestroy
+         U _exportAttributeToStream
+         U _findEntry
+         U _free
+         U _getApproxTime
+         U _getHashParameters
+         U _getValidityInfo
+         U _iCryptExportKeyEx
+0005122c T _initPKCS15write
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueCursorFirst
+         U _messageValueCursorNext
+         U _messageValueFalse
+         U _messageValueTrue
+         U _pkcs15freeEntry
+         U _readIntegerTag
+         U _readSequence
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sPeek
+00051f98 t _setItemFunction
+         U _sizeofAlgoIDex
+         U _sizeofObject
+         U _sseek
+         U _swrite
+         U _writeBitString
+         U _writeBoolean
+         U _writeCMSencrHeader
+         U _writeCharacterString
+         U _writeConstructed
+         U _writeGeneralizedTime
+         U _writeOctetString
+         U _writeSequence
+         U _writeSet
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(dbxpostg.o):
+
+/opt/local/lib/libcl.dylib(cryptapi.o):
+0005361c t _cmdCreateObject
+0005391c t _cmdGetAttribute
+00053a74 t _cmdGetKey
+00053c14 t _cmdSetAttribute
+000ccdc0 s _cmdTemplate.4698
+000cce0c s _cmdTemplate.4716
+000cce54 s _cmdTemplate.4734
+000ccea0 s _cmdTemplate.4753
+000ccee8 s _cmdTemplate.4777
+000ccf38 s _cmdTemplate.4797
+000ccf80 s _cmdTemplate.4821
+000ccfc8 s _cmdTemplate.4839
+000ccd74 s _cmdTemplate.4861
+000cd010 s _cmdTemplate.4911
+000cd05c s _cmdTemplate.4929
+000cd0a4 s _cmdTemplate.4947
+000cd0f0 s _cmdTemplate.4964
+000cd134 s _cmdTemplate.4981
+000cd174 s _cmdTemplate.4995
+000cd1b4 s _cmdTemplate.5007
+000cd1f4 s _cmdTemplate.5019
+000cd234 s _cmdTemplate.5031
+000cd27c s _cmdTemplate.5045
+000cd2c4 s _cmdTemplate.5060
+000cd308 s _cmdTemplate.5073
+000cd34c s _cmdTemplate.5088
+000cd398 s _cmdTemplate.5105
+000cd3e4 s _cmdTemplate.5121
+000cd428 s _cmdTemplate.5137
+000cd478 s _cmdTemplate.5155
+000cd4c0 s _cmdTemplate.5180
+000cd510 s _cmdTemplate.5203
+000cd59c s _cmdTemplate.5231
+000cd5e8 s _cmdTemplate.5249
+000cd550 s _cmdTemplate.5264
+000cd634 s _cmdTemplate.5279
+000cd684 s _cmdTemplate.5302
+000cd6c8 s _cmdTemplate.5328
+000cd710 s _cmdTemplate.5344
+000cd758 s _cmdTemplate.5366
+000cd7a0 s _cmdTemplate.5386
+000ccd34 s _cmdTemplate.5399
+000585bc T _cryptAddPrivateKey
+00058364 T _cryptAddPublicKey
+000563bc T _cryptAsyncCancel
+00056260 T _cryptAsyncQuery
+0005720c T _cryptCAAddItem
+000577c4 T _cryptCACertManagement
+00057614 T _cryptCADeleteItem
+000573f8 T _cryptCAGetItem
+00056c1c T _cryptCheckCert
+00054c90 T _cryptCreateCert
+00054970 T _cryptCreateContext
+00055000 T _cryptCreateEnvelope
+0005536c T _cryptCreateSession
+0005681c T _cryptDecrypt
+00055e40 T _cryptDeleteAttribute
+000588a8 T _cryptDeleteKey
+00054800 T _cryptDestroyCert
+00054690 T _cryptDestroyContext
+00054520 T _cryptDestroyEnvelope
+000556a8 T _cryptDestroyObject
+000540d0 T _cryptDestroySession
+000543b0 T _cryptDeviceClose
+00054b0c T _cryptDeviceCreateContext
+00054e24 T _cryptDeviceOpen
+00053d88 T _cryptDeviceQueryCapability
+00056518 T _cryptEncrypt
+00053d68 T _cryptEnd
+00056f94 T _cryptExportCert
+00057e98 T _cryptFlushData
+00055fe0 T _cryptGenerateKey
+00056120 T _cryptGenerateKeyAsync
+00055818 T _cryptGetAttribute
+0005598c T _cryptGetAttributeString
+00058184 T _cryptGetPrivateKey
+00057fc8 T _cryptGetPublicKey
+00056d8c T _cryptImportCert
+00053d24 T _cryptInit
+00054240 T _cryptKeysetClose
+00055194 T _cryptKeysetOpen
+00055500 T _cryptLogin
+00053f60 T _cryptLogout
+00057cf8 T _cryptPopData
+00057a74 T _cryptPushData
+00058a58 T _cryptQueryCapability
+00055b50 T _cryptSetAttribute
+00055ca4 T _cryptSetAttributeString
+00056adc T _cryptSignCert
+         U _endCryptlib
+000ccdac s _errorMap.4699
+000ccdf8 s _errorMap.4717
+000cce44 s _errorMap.4735
+000cce8c s _errorMap.4754
+000cced8 s _errorMap.4778
+000ccf20 s _errorMap.4798
+000ccf70 s _errorMap.4822
+000ccfb8 s _errorMap.4840
+000ccd6c s _errorMap.4862
+000cd000 s _errorMap.4912
+000cd048 s _errorMap.4930
+000cd094 s _errorMap.4948
+000cd0dc s _errorMap.4965
+000cd128 s _errorMap.4982
+000cd16c s _errorMap.4996
+000cd1ac s _errorMap.5008
+000cd1ec s _errorMap.5020
+000cd22c s _errorMap.5032
+000cd26c s _errorMap.5046
+000cd2b4 s _errorMap.5061
+000cd2fc s _errorMap.5074
+000cd340 s _errorMap.5089
+000cd384 s _errorMap.5106
+000cd3d0 s _errorMap.5122
+000cd41c s _errorMap.5138
+000cd460 s _errorMap.5156
+000cd4b0 s _errorMap.5181
+000cd4f8 s _errorMap.5204
+000cd588 s _errorMap.5232
+000cd5d4 s _errorMap.5250
+000cd548 s _errorMap.5265
+000cd620 s _errorMap.5280
+000cd66c s _errorMap.5303
+000cd6bc s _errorMap.5329
+000cd700 s _errorMap.5345
+000cd748 s _errorMap.5367
+000cd790 s _errorMap.5387
+000ccd20 s _errorMap.5400
+000e5f60 b _initCalled
+         U _initCryptlib
+         U _krnlSendMessage
+         U _memcpy
+         U _memset
+         U _messageValueCryptOK
+         U _messageValueFalse
+         U _messageValueTrue
+         U _strlen
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptcfg.o):
+         U _addTrustEntry
+00059560 T _commitConfigData
+         U _dynCreate
+         U _dynDestroy
+00059058 T _encodeConfigData
+00058f98 T _endOptions
+         U _enumTrustedCerts
+         U _fileBuildCryptlibPath
+         U _fileErase
+000df124 s _fixedOptionInfo
+         U _free
+00058ec4 T _getOption
+00058ed4 T _getOptionString
+00058ee4 T _initOptions
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _readBooleanTag
+00059684 T _readConfig
+         U _readGenericHole
+         U _readSequence
+         U _readShortIntegerTag
+         U _readUniversal
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sPeek
+00058c34 T _setOption
+00058d00 T _setOptionString
+         U _sizeofObject
+         U _sseek
+         U _strlen
+         U _writeBoolean
+         U _writeCharacterString
+         U _writeSequence
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptcrt.o):
+         U __DefaultRuneLocale
+         U _addAttribute
+         U _addCertComponent
+         U _assembleCertChain
+0005a060 T _certManagementFunction
+         U _certWriteTable
+0005a068 t _certificateMessageFunction
+         U _checkCertUsage
+         U _checkCertValidity
+         U _checkObjectEncoding
+00059ab0 T _compareSerialNumber
+0005a910 T _createCertificate
+0005a004 T _createCertificateIndirect
+00059df4 T _createCertificateInfo
+0005b18c T _cryptAddCertExtension
+0005b038 T _cryptDeleteCertExtension
+0005b364 T _cryptGetCertExtension
+         U _deleteAttribute
+         U _deleteAttributes
+         U _deleteCertComponent
+         U _deleteDN
+         U _deleteRevocationEntries
+         U _exportCert
+         U _findAttributeByOID
+         U _free
+         U _getCertComponent
+         U _getObjectLength
+00059b68 T _iCryptImportCertIndirect
+00059b6c T _iCryptReadSubjectPublicKey
+         U _importCert
+         U _krnlCreateObject
+         U _krnlGetObject
+         U _krnlReleaseObject
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _messageValueCryptOK
+         U _messageValueTrue
+00059cc4 t _processCertData
+         U _readAlgoID
+         U _readGenericHole
+         U _readSequence
+         U _readUniversal
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _signCert
+         U _sizeofObject
+         U _sseek
+         U _strlen
+0005ab50 T _textToOID
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptctx.o):
+         U _BN_CTX_free
+         U _BN_CTX_init
+         U _BN_MONT_CTX_free
+         U _BN_MONT_CTX_init
+         U _BN_clear
+         U _BN_clear_free
+         U _BN_init
+000d7f58 s _actionFlags.6324
+000d7f54 s _actionFlagsDH.6325
+000d7f50 s _actionFlagsPGP.6326
+         U _attributeCopy
+         U _calculateKeyID
+0005b800 T _clearTempBignums
+0005c1c0 t _contextMessageFunction
+0005c11c T _createContext
+0005b844 T _createContextFromCapability
+0005b5ac T _findCapabilityInfo
+         U _free
+0005b548 T _getCapabilityInfo
+0005b754 T _getInfo
+         U _initKeyHandling
+0005b5e8 T _initKeyParams
+         U _initKeyReadWrite
+         U _krnlCreateObject
+         U _krnlMemfree
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _messageValueCryptOK
+         U _messageValueCryptUnused
+0005be24 t _processDeleteAttribute
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _strcpy
+         U _strlen
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptdbx.o):
+         U _attributeCopy
+0005de68 T _createKeyset
+         U _fileClearToEOF
+         U _fileErase
+         U _fileReadonly
+         U _free
+         U _getHashParameters
+000e5f64 b _initLevel.6088
+0005e6b4 T _keysetManagementFunction
+0005e708 t _keysetMessageFunction
+         U _krnlCreateObject
+         U _krnlSendMessage
+         U _memcpy
+         U _memset
+         U _messageValueCryptOK
+         U _pgpReadPacketHeader
+         U _readLongSequence
+         U _readOID
+         U _readShortIntegerTag
+0005ddbc T _retExtFnKeyset
+         U _sFileClose
+         U _sFileOpen
+         U _sPeek
+         U _setAccessMethodDBMS
+         U _setAccessMethodHTTP
+         U _setAccessMethodPGPPrivate
+         U _setAccessMethodPGPPublic
+         U _setAccessMethodPKCS15
+         U _sgetc
+         U _sioctl
+         U _sseek
+         U _strcpy
+         U _strlen
+         U _strncasecmp
+         u _vsprintf$LDBLStub
+         U _waitSemaphore
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptdev.o):
+         U _attributeCopy
+         U _checkEntropy
+         U _createCertificateIndirect
+         U _createContext
+0005fb40 T _createDevice
+000df480 s _defaultCreateFunctions
+0005ef10 T _deviceManagementFunction
+0005f0bc t _deviceMessageFunction
+         U _findCapabilityInfo
+         U _free
+         U _getCapabilityInfo
+000e5f68 b _initFlags.4785
+         U _krnlCreateObject
+         U _krnlGetObject
+         U _krnlReleaseObject
+         U _krnlSendMessage
+         U _memset
+         U _messageValueCryptOK
+         U _messageValueCryptUnused
+         U _setDeviceSystem
+         U _strlen
+         U _waitSemaphore
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptenv.o):
+         U _attributeCopy
+000cd7d8 s _checkTable.5338
+00060144 T _createEnvelope
+0005fdf0 t _deenvelopePush
+         U _deflateEnd
+         U _deleteActionList
+         U _deleteContentList
+0006030c t _envelopeMessageFunction
+         U _free
+         U _inflateEnd
+         U _initCMSDeenveloping
+         U _initCMSEnveloping
+         U _initDeenvelopeStreaming
+         U _initEnvelopeStreaming
+         U _initMemPool
+         U _initPGPDeenveloping
+         U _initPGPEnveloping
+         U _initResourceHandling
+         U _krnlCreateObject
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memset
+         U _messageValueCryptOK
+         U _messageValueCryptUnused
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptkey.o):
+         U _clearTempBignums
+00061e5c t _generateKeyConvFunction
+00062014 t _generateKeyMacFunction
+00061f28 t _generateKeyPKCFunction
+         U _getApproxTime
+000620d8 T _initKeyHandling
+         U _krnlSendMessage
+00061b90 t _loadKeyConvFunction
+00061da0 t _loadKeyMacFunction
+00061bd0 t _loadKeyPKCFunction
+         U _messageValueCryptOK
+         U _pthread_create
+         U _pthread_exit
+00061db0 T _threadKeygen
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptkrn.o):
+000cd8a4 s _OBJECT_INFO_TEMPLATE
+000cd898 s _OBJECT_STATE_INFO_TEMPLATE
+000cd88c s _SEMAPHORE_INFO_TEMPLATE
+000ceaec s _accessTypeTbl.4954
+000e60e8 b _allocatedListHead
+000e60e4 b _allocatedListTail
+000e6064 b _allocationMutex
+000e6090 b _allocationMutexInitialised
+000e60cc b _allocationMutexLockcount
+000e60ec b _allocationMutexOwner
+000cea64 s _allowedCertCursorSubranges
+000cea4c s _allowedIPAddressSizes
+000cea88 s _allowedKeyingAlgos
+000cea9c s _allowedLDAPObjectTypes
+000ce96c s _allowedObjectStatusValues
+000cea7c s _allowedPKCKeysizes
+000643a8 T _beginInitialisation
+000e1e94 s _certExtensionACL
+000e326c s _certNameACL
+000e14bc s _certSmimeACL
+000e34ec s _certificateACL
+00062fd4 t _checkTargetType
+00063944 T _clearSemaphore
+00066e90 t _cloneObject
+000e3b2c s _contextACL
+00066a60 t _decRefCount
+00066bdc T _destroyObjects
+000e132c s _deviceACL
+000644bc T _endInitialisation
+00064554 T _endInternalFunctions
+00063c50 T _enterMutex
+000e0e54 s _envelopeACL
+00063dbc T _exitMutex
+000663ac T _exportPrivateKeyData
+00064324 T _extractKeyData
+000679b0 t _findCompareMessageTarget
+00062bb4 t _findTargetType
+000e45cc s _formatPseudoACL.5249
+         U _free
+000e4414 s _genericACL
+0006410c t _getContext
+00066f58 t _getDependentObject
+         U _getTime
+000662c4 T _importPrivateKeyData
+00062b80 t _incRefCount
+0006471c T _initInternalFunctions
+000e609c b _initialisationMutex
+000e6098 b _initialisationMutexInitialised
+000e60c8 b _initialisationMutexLockcount
+000e6274 b _initialisationMutexOwner
+000dfa54 s _internalACL
+000e5f70 b _isClosingDown
+000e6094 b _isInitialised
+000cd8e8 s _keyManagementACL
+000e146c s _keysetACL
+00064a78 T _krnlCreateObject
+000624cc T _krnlGetObject
+00063e5c T _krnlMemalloc
+00063fac T _krnlMemfree
+000640f0 T _krnlMemsize
+000627d8 T _krnlReacquireSystemObject
+00062708 T _krnlReleaseObject
+00062710 T _krnlReleaseSystemObject
+00064f4c T _krnlSendMessage
+000ceaac s _lfsrPolyTable.4289
+         U _malloc
+000cdb94 s _mechanismDeriveACL
+000cdef8 s _mechanismSigCheckACL
+000cdff0 s _mechanismSignACL
+000ce0e8 s _mechanismUnwrapACL
+000ce544 s _mechanismWrapACL
+         U _memcpy
+         U _memset
+000df490 s _messageHandlingInfo
+000e6118 b _messageQueue
+000d7f74 S _messageValueCryptError
+000d7f78 S _messageValueCryptOK
+000d7f70 S _messageValueCryptSignalled
+000d7f38 S _messageValueCryptUnused
+000d7f6c S _messageValueCryptUseDefault
+000d7f68 S _messageValueCursorFirst
+000d7f5c S _messageValueCursorLast
+000d7f64 S _messageValueCursorNext
+000d7f60 S _messageValueCursorPrevious
+000d7f78 S _messageValueFalse
+000d7f7c S _messageValueTrue
+         U _mlock
+         U _munlock
+000e5fa4 b _mutex1Mutex
+000e5fd0 b _mutex1MutexInitialised
+000e60d8 b _mutex1MutexLockcount
+000e60f8 b _mutex1MutexOwner
+000e5fd4 b _mutex2Mutex
+000e6000 b _mutex2MutexInitialised
+000e60d4 b _mutex2MutexLockcount
+000e60f4 b _mutex2MutexOwner
+000e6004 b _mutex3Mutex
+000e6030 b _mutex3MutexInitialised
+000e60d0 b _mutex3MutexLockcount
+000e60f0 b _mutex3MutexOwner
+000cea34 s _objectCMSAttr
+000ce948 s _objectCertOCSPRequest
+000ce9a4 s _objectCertOCSPResponse
+000ce930 s _objectCertPKIUser
+000ce954 s _objectCertRTCSRequest
+000ce9b0 s _objectCertRTCSResponse
+000cea58 s _objectCertRequest
+000ce93c s _objectCertRevRequest
+000ce9c8 s _objectCertSessionCMPRequest
+000ce9d4 s _objectCertSessionOCSPRequest
+000ce9e0 s _objectCertSessionRTCSRequest
+000ce9bc s _objectCertSessionUnsignedPKCS10Request
+000ce960 s _objectCertificate
+000cea40 s _objectCtxConv
+000ce98c s _objectCtxHash
+000cea10 s _objectCtxPKC
+000ce998 s _objectDeenvelope
+000cea1c s _objectKeyset
+000cea04 s _objectKeysetCerts
+000ce924 s _objectKeysetConfigdata
+000ce980 s _objectKeysetPrivate
+000ce9f8 s _objectSessionDataClient
+000ce9ec s _objectSessionDataServer
+000cea28 s _objectSessionTSP
+000e6258 b _objectStateInfo
+000e6270 b _objectTable
+000e5f78 b _objectTableMutex
+000e5f6c b _objectTableMutexInitialised
+000e5f74 b _objectTableMutexLockcount
+000e6268 b _objectTableMutexOwner
+000e626c b _objectTableSize
+000e6264 b _objectUniqueID
+000e3dac s _optionACL
+000cd85c s _paramACLTbl
+000637d0 t _postDispatchChangeState
+00063804 t _postDispatchChangeStateOpt
+00066484 t _postDispatchForwardToDependentObject
+000665b4 t _postDispatchMakeObjectExternal
+00063794 t _postDispatchUpdateUsageCount
+0006301c t _preDispatchCheckActionAccess
+00067304 t _preDispatchCheckAttributeAccess
+00063434 t _preDispatchCheckCertMgmtAccess
+00063014 t _preDispatchCheckCompareParam
+00063350 t _preDispatchCheckData
+00067964 t _preDispatchCheckExportAccess
+00068574 t _preDispatchCheckKeysetAccess
+000633d8 t _preDispatchCheckMechanismDeriveAccess
+000681e8 t _preDispatchCheckMechanismSignAccess
+00067da8 t _preDispatchCheckMechanismWrapAccess
+00063108 t _preDispatchCheckParamHandleOpt
+000630cc t _preDispatchCheckState
+00063224 t _preDispatchCheckStateParamHandle
+00063394 t _preDispatchSetObjectOwner
+00066b60 t _preDispatchSignalDependentObjects
+000e44dc s _propertyACL
+         U _pthread_equal
+         U _pthread_join
+         U _pthread_mutex_destroy
+         U _pthread_mutex_init
+         U _pthread_mutex_lock
+         U _pthread_mutex_trylock
+         U _pthread_mutex_unlock
+         U _pthread_self
+         U _pthread_yield_np
+000e60e0 b _queueEnd
+000622d0 t _releaseObject
+000e6100 b _semaphoreInfo
+000e6034 b _semaphoreMutex
+000e6060 b _semaphoreMutexInitialised
+000e60dc b _semaphoreMutexLockcount
+000e60fc b _semaphoreMutexOwner
+000e04cc s _sessionACL
+00066708 t _setDependentObject
+000628a0 t _setPropertyAttribute
+00063844 T _setSemaphore
+000e3ab4 s _subACL_CertinfoFingerprintSHA
+000e3a3c s _subACL_CertinfoSerialNumber
+000e12b4 s _subACL_EnvinfoContentType
+000e123c s _subACL_EnvinfoSignature
+000e11c4 s _subACL_EnvinfoSignatureExtraData
+000e038c s _subACL_IAttributeSubject
+000e0ddc s _subACL_SessinfoActive
+000e0c4c s _subACL_SessinfoPassword
+000e0864 s _subACL_SessinfoPortforward
+000e0bd4 s _subACL_SessinfoPrivatekey
+000e0a94 s _subACL_SessinfoRequest
+000e0954 s _subACL_SessinfoRequesttype
+000e09cc s _subACL_SessinfoResponse
+000e0b5c s _subACL_SessinfoSession
+000e08dc s _subACL_SessinfoSubsystem
+000e0d14 s _subACL_SessinfoUsername
+000e0404 s _userACL
+00062158 t _waitForObject
+00063a5c T _waitSemaphore
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptlib.o):
+000e47a0 s _asyncInitFunctions
+         U _beginInitialisation
+         U _clearSemaphore
+00068964 t _des3TestLoop
+         U _des_ecb3_encrypt
+         U _des_set_key_unchecked
+         U _destroyObjects
+         U _deviceManagementFunction
+00069734 T _endCryptlib
+         U _endInitialisation
+         U _endInternalFunctions
+         U _getHashParameters
+00068a8c T _initCryptlib
+000e47b0 s _initFunctions
+         U _initInternalFunctions
+000d011c s _key.4482
+         U _keysetManagementFunction
+         U _krnlSendMessage
+000e4814 s _md5Vectors.4435
+         U _memcmp
+         U _memset
+         U _messageValueFalse
+         U _messageValueTrue
+000e47b8 s _preInitFunctions
+000e4794 s _preShutdownFunctions
+         U _pthread_create
+         U _pthread_exit
+         U _sessionManagementFunction
+         U _setSemaphore
+000e47c0 s _sha1Vectors.4440
+000e4784 s _shutdownFunctions
+000cecdc s _testDP
+000cfb1c s _testIP
+000cefdc s _testKP
+000ceb14 s _testSB
+000cf51c s _testVP
+00068a30 T _threadedBind
+         U _userManagementFunction
+         U _waitSemaphore
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptmch.o):
+         U _cryptlibToPgpAlgo
+0006999c T _deriveCMP
+00069a78 T _derivePGP
+0006b9bc T _derivePKCS5
+00069800 T _deriveSSL
+0006be58 T _deriveTLS
+0006a464 T _exportCMS
+0006af3c T _exportPKCS1
+0006af30 T _exportPKCS1PGP
+0006ac10 T _exportPrivateKey
+         U _exportPrivateKeyData
+0006ac20 T _exportPrivateKeyPKCS8
+         U _extractKeyData
+         U _getHashParameters
+         U _getObjectLength
+0006a644 T _importCMS
+0006a444 T _importPKCS1
+0006a458 T _importPKCS1PGP
+0006ac18 T _importPrivateKey
+         U _importPrivateKeyData
+0006b9ac T _importPrivateKeyOpenPGP
+0006b9b4 T _importPrivateKeyPGP
+0006ac28 T _importPrivateKeyPKCS8
+         U _krnlMemalloc
+         U _krnlMemfree
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+000d0128 s _mode.5351
+         U _pgpToCryptlibAlgo
+00069f84 t _pkcs1Unwrap
+0006ac30 t _pkcs1Wrap
+0006aa94 t _privateKeyUnwrap
+0006b244 t _privateKeyUnwrapPGP
+0006a870 t _privateKeyWrap
+         U _readMessageDigest
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sgetc
+0006af54 T _sigcheckPKCS1
+00069d10 T _signPKCS1
+         U _sizeofAlgoID
+         U _sizeofObject
+         U _sputc
+         U _sseek
+         U _writeMessageDigest
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptmis.o):
+000d026c s _C.13.5014
+         U __DefaultRuneLocale
+         U ___maskrune
+         U ___toupper
+0006e48c T _addMIMEchar
+0006df84 T _adjustPKIUserValue
+0006cc9c T _algoAvailable
+000d016c s _asciiToBin
+0006cc34 T _attributeCopy
+0006e64c T _base64checkHeader
+0006dabc T _base64decode
+0006ddfc T _base64decodeLen
+0006d844 T _base64encode
+0006de90 T _base64encodeLen
+000bb924 s _binToAscii
+0006cafc T _checkEntropy
+0006ca0c T _checksumData
+000bb734 s _codeTable
+0006dfd0 T _decodePKIUserValue
+0006ccd4 T _dynCreate
+0006cde4 T _dynDestroy
+0006e2a0 T _encodePKIUserValue
+0006d83c T _endMIMEstate
+0006d5b8 T _envelopeSigCheck
+0006d384 T _envelopeSign
+0006d1ec T _envelopeUnwrap
+0006d010 T _envelopeWrap
+0006cec0 T _exportAttributeToStream
+0006cf68 T _exportCertToStream
+         U _free
+0006ce94 T _freeMemPool
+0006c914 T _getApproxTime
+0006ca4c T _getHashParameters
+0006ce5c T _getMemPool
+0006c950 T _getReliableTime
+0006c8dc T _getTime
+000e48d4 s _headerInfo
+000d014c s _hiMask
+0006d81c T _initMIMEstate
+0006ce48 T _initMemPool
+0006ea74 T _isPKIUserValue
+         U _krnlSendMessage
+000d012c s _loMask
+         U _malloc
+         U _md2HashBuffer
+         U _md5HashBuffer
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _messageValueTrue
+         U _ripemd160HashBuffer
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+         U _sgetc
+         U _shaHashBuffer
+         U _sread
+         U _sseek
+         U _strcpy
+         U _strlen
+         U _strncasecmp
+         U _strncmp
+         U _time
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptses.o):
+         U _attributeCopy
+         U _checkObjectEncoding
+0006ef08 T _createSession
+         U _decodePKIUserValue
+00070dec t _defaultClientStartupFunction
+0006ec68 t _defaultGetAttributeFunction
+00070c38 t _defaultServerStartupFunction
+0006ec60 t _defaultShutdownFunction
+         U _endSessionCache
+         U _free
+000e6278 b _initLevel.6256
+         U _initSessionCache
+0006ebc0 T _initSessionNetConnectInfo
+         U _isPKIUserValue
+         U _krnlCreateObject
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueCryptOK
+         U _messageValueCryptUnused
+         U _messageValueTrue
+         U _netEndTCP
+         U _netInitTCP
+         U _netSignalShutdown
+0006f3a4 t _processSetAttribute
+0006ecc4 T _readFixedHeader
+0006edd0 T _readPkiDatagram
+0006eb58 T _retExtFnSession
+         U _sNetConnect
+         U _sNetDisconnect
+         U _sNetGetErrorInfo
+         U _sNetListen
+         U _sNetParseURL
+0006f2cc T _sessionManagementFunction
+0006fbcc t _sessionMessageFunction
+000d027c s _sessionTypes.6172
+         U _setAccessMethodCMP
+         U _setAccessMethodOCSP
+         U _setAccessMethodRTCS
+         U _setAccessMethodSCEP
+         U _setAccessMethodSSH
+         U _setAccessMethodSSL
+         U _setAccessMethodTSP
+         U _sioctl
+         U _sread
+         U _strlen
+         U _strncasecmp
+         U _swrite
+         u _vsprintf$LDBLStub
+         U _waitSemaphore
+0006eea8 T _writePkiDatagram
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cryptusr.o):
+         U _addTrustEntry
+         U _attributeCopy
+         U _commitConfigData
+0007134c T _createUser
+000d0330 s _defaultUserInfo
+         U _deleteTrustEntry
+         U _encodeConfigData
+         U _endOptions
+         U _endTrustInfo
+         U _enumTrustedCerts
+         U _fileBuildCryptlibPath
+         U _fileClearToEOF
+         U _fileErase
+         U _findTrustEntry
+00070f78 t _findUser
+         U _free
+         U _getOption
+         U _getOptionString
+         U _getTrustedCert
+         U _iCryptCheckSignatureEx
+         U _initOptions
+         U _initTrustInfo
+         U _krnlCreateObject
+         U _krnlGetObject
+         U _krnlReleaseObject
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueCryptOK
+         U _messageValueCryptUnused
+         U _messageValueTrue
+000d7f80 s _minBufferSize.5569
+000710fc t _openUser
+000d03ac s _primarySOInfo
+         U _readAlgoID
+         U _readCharacterString
+         U _readConfig
+         U _readConstructed
+         U _readEnumeratedTag
+         U _readGenericHole
+         U _readOctetStringTag
+         U _readSequence
+         U _readSet
+         U _readShortIntegerTag
+         U _readUniversal
+         U _sFileClose
+         U _sFileOpen
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _setOption
+         U _setOptionString
+         U _sizeofObject
+         u _sprintf$LDBLStub
+         U _strlen
+         U _strncasecmp
+00071270 T _userManagementFunction
+00072044 t _userMessageFunction
+         U _writeCharacterString
+         U _writeEnumerated
+         U _writeOctetString
+         U _writeSequence
+         U _writeShortInteger
+000d0428 s _zeroUserData.5612
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_3des.o):
+000734ac T _des3DecryptCBC
+0007363c T _des3DecryptCFB
+000733f4 T _des3DecryptECB
+000738dc T _des3DecryptOFB
+0007346c T _des3EncryptCBC
+000734ec T _des3EncryptCFB
+0007337c T _des3EncryptECB
+000737b0 T _des3EncryptOFB
+00073368 T _des3GetInfo
+00073a08 T _des3InitKey
+000732b8 T _des3SelfTest
+000731ec t _des3TestLoop
+         U _des_ecb3_encrypt
+         U _des_ede3_cbc_encrypt
+         U _des_key_sched
+         U _des_set_key_unchecked
+         U _des_set_odd_parity
+         U _getInfo
+         U _memcmp
+         U _memcpy
+000d05f2 s _testDP
+000d1432 s _testIP
+000d08f2 s _testKP
+000d042a s _testSB
+000d0e32 s _testVP
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_aes.o):
+00073de0 T _aesDecryptCBC
+00073ff0 T _aesDecryptCFB
+00073cc4 T _aesDecryptECB
+00074268 T _aesDecryptOFB
+00073d2c T _aesEncryptCBC
+00073eb4 T _aesEncryptCFB
+00073c60 T _aesEncryptECB
+00074150 T _aesEncryptOFB
+00073c4c T _aesGetInfo
+00074380 T _aesInitKey
+00073ad8 T _aesSelfTest
+         U _aes_decrypt
+         U _aes_decrypt_key
+         U _aes_decrypt_key128
+         U _aes_decrypt_key192
+         U _aes_decrypt_key256
+         U _aes_encrypt
+         U _aes_encrypt_key
+         U _aes_encrypt_key128
+         U _aes_encrypt_key192
+         U _aes_encrypt_key256
+         U _getInfo
+         U _memcmp
+         U _memcpy
+000d1a34 s _testAES
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_bf.o):
+         U _BF_cbc_encrypt
+         U _BF_ecb_encrypt
+         U _BF_set_key
+000d1b28 s _C.0.6292
+000d1b20 s _C.1.6293
+000d1b18 s _C.2.6294
+000d1b10 s _C.3.6295
+000d1b08 s _C.4.6296
+000d1b00 s _C.5.6297
+0007474c T _blowfishDecryptCBC
+000748c4 T _blowfishDecryptCFB
+000746ac T _blowfishDecryptECB
+00074b44 T _blowfishDecryptOFB
+00074714 T _blowfishEncryptCBC
+00074784 T _blowfishEncryptCFB
+00074644 T _blowfishEncryptECB
+00074a28 T _blowfishEncryptOFB
+00074630 T _blowfishGetInfo
+00074c60 T _blowfishInitKey
+000743ec T _blowfishSelfTest
+         U _getInfo
+         U _memcmp
+         U _memcpy
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_cast.o):
+         U _CAST_cbc_encrypt
+         U _CAST_ecb_encrypt
+         U _CAST_set_key
+00074e58 T _castDecryptCBC
+00074fcc T _castDecryptCFB
+00074dbc T _castDecryptECB
+00075244 T _castDecryptOFB
+00074e20 T _castEncryptCBC
+00074e90 T _castEncryptCFB
+00074d58 T _castEncryptECB
+0007512c T _castEncryptOFB
+00074d44 T _castGetInfo
+0007535c T _castInitKey
+00074cb8 T _castSelfTest
+         U _getInfo
+         U _memcmp
+         U _memcpy
+000d1b30 s _testCAST
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_des.o):
+000754c8 T _desDecryptCBC
+0007563c T _desDecryptCFB
+0007542c T _desDecryptECB
+000758b4 T _desDecryptOFB
+00075490 T _desEncryptCBC
+00075500 T _desEncryptCFB
+000753c8 T _desEncryptECB
+0007579c T _desEncryptOFB
+000753b4 T _desGetInfo
+000759cc T _desInitKey
+00075a38 T _desSelfTest
+         U _des_ecb_encrypt
+         U _des_key_sched
+         U _des_ncbc_encrypt
+         U _des_set_key_unchecked
+         U _des_set_odd_parity
+         U _getInfo
+         U _memcmp
+         U _memcpy
+000d1d18 s _testDP
+000d3098 s _testIP
+000d2558 s _testKP
+000d2018 s _testRS
+000d1b50 s _testSB
+000d2a98 s _testVP
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_dh.o):
+         U _BN_CTX_free
+         U _BN_CTX_init
+         U _BN_MONT_CTX_free
+         U _BN_MONT_CTX_init
+         U _BN_bin2bn
+         U _BN_bn2bin
+         U _BN_clear_free
+         U _BN_init
+         U _BN_mod_exp_mont
+         U _calculateKeyID
+000d3794 s _capabilityInfo.6258
+         U _checkDLPkey
+00075cf4 T _dhDecrypt
+00075cb8 T _dhEncrypt
+00075f38 T _dhGenerateKey
+00075de0 T _dhInitKey
+00075f8c T _dhSelfTest
+000d3698 s _dlpTestKey
+         U _generateDLPkey
+         U _initDLPkey
+         U _initKeyReadWrite
+         U _memcmp
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_dsa.o):
+         U _BN_CTX_free
+         U _BN_CTX_init
+         U _BN_MONT_CTX_free
+         U _BN_MONT_CTX_init
+         U _BN_add
+         U _BN_bin2bn
+         U _BN_clear_free
+         U _BN_cmp
+         U _BN_div
+         U _BN_init
+         U _BN_mod_exp2_mont
+         U _BN_mod_exp_mont
+         U _BN_mod_inverse
+         U _BN_mod_mul
+         U _BN_sub
+         U _calculateKeyID
+000d3924 s _capabilityInfo.6258
+         U _checkDLPkey
+         U _decodeDLValues
+000d3828 s _dlpTestKey
+00076c4c T _dsaGenerateKey
+00076880 T _dsaInitKey
+000769a8 T _dsaSelfTest
+000766f4 T _dsaSigCheck
+00076514 T _dsaSign
+         U _encodeDLValues
+         U _generateBignum
+         U _generateDLPkey
+         U _initDLPkey
+         U _initKeyReadWrite
+000d3800 s _kVal
+         U _memset
+000d3814 s _shaM
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_elg.o):
+         U _BN_CTX_free
+         U _BN_CTX_init
+         U _BN_MONT_CTX_free
+         U _BN_MONT_CTX_init
+         U _BN_bin2bn
+         U _BN_bn2bin
+         U _BN_clear_free
+         U _BN_cmp
+         U _BN_copy
+         U _BN_div
+         U _BN_gcd
+         U _BN_init
+         U _BN_mod_exp_mont
+         U _BN_mod_inverse
+         U _BN_mod_mul
+         U _BN_num_bits
+         U _BN_sub_word
+         U _calculateKeyID
+000d3acc s _capabilityInfo.6258
+         U _checkDLPkey
+         U _decodeDLValues
+000d39d0 s _dlpTestKey
+00076f18 T _elgamalDecrypt
+00076cac T _elgamalEncrypt
+000774d8 T _elgamalGenerateKey
+00077078 T _elgamalInitKey
+000771fc T _elgamalSelfTest
+         U _encodeDLValues
+         U _generateBignum
+         U _generateDLPkey
+         U _initDLPkey
+         U _initKeyReadWrite
+000d3990 s _kRandomVal
+         U _memcmp
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_hmd5.o):
+         U _MD5_Final
+         U _MD5_Init
+         U _MD5_Update
+         U _getInfo
+0007752c T _hmacMD5GetInfo
+00077658 T _hmacMD5Hash
+00077540 T _hmacMD5InitKey
+00077780 T _hmacMD5SelfTest
+000e4928 s _hmacValues
+         U _memcmp
+         U _memcpy
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_hrmd.o):
+         U _RIPEMD160_Final
+         U _RIPEMD160_Init
+         U _RIPEMD160_Update
+         U _getInfo
+0007789c T _hmacRIPEMD160GetInfo
+000779c0 T _hmacRIPEMD160Hash
+000778b0 T _hmacRIPEMD160InitKey
+00077ae8 T _hmacRIPEMD160SelfTest
+000e4a08 s _hmacValues
+         U _memcmp
+         U _memcpy
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_hsha.o):
+         U _SHA1_Final
+         U _SHA1_Init
+         U _SHA1_Update
+         U _getInfo
+00077c00 T _hmacSHAGetInfo
+00077d24 T _hmacSHAHash
+00077c14 T _hmacSHAInitKey
+00077e4c T _hmacSHASelfTest
+000e4a2c s _hmacValues
+         U _memcmp
+         U _memcpy
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_idea.o):
+         U _getInfo
+0007815c T _ideaDecryptCBC
+000782d4 T _ideaDecryptCFB
+000780bc T _ideaDecryptECB
+0007854c T _ideaDecryptOFB
+00078124 T _ideaEncryptCBC
+00078198 T _ideaEncryptCFB
+00078058 T _ideaEncryptECB
+00078434 T _ideaEncryptOFB
+00078044 T _ideaGetInfo
+00078664 T _ideaInitKey
+00077f64 T _ideaSelfTest
+         U _idea_cbc_encrypt
+         U _idea_ecb_encrypt
+         U _idea_set_decrypt_key
+         U _idea_set_encrypt_key
+         U _memcmp
+         U _memcpy
+000d3b38 s _testIdea
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_kg.o):
+         U _BN_MONT_CTX_init
+         U _BN_MONT_CTX_set
+         U _BN_add_word
+         U _BN_bin2bn
+         U _BN_clear_free
+         U _BN_cmp
+         U _BN_copy
+         U _BN_div
+         U _BN_get_word
+         U _BN_init
+         U _BN_is_bit_set
+         U _BN_lshift1
+         U _BN_mod_exp
+         U _BN_mod_exp_mont
+         U _BN_mod_inverse
+         U _BN_mod_mul
+         U _BN_mod_word
+         U _BN_mul
+         U _BN_num_bits
+         U _BN_rshift
+         U _BN_rshift1
+         U _BN_set_word
+         U _BN_sub
+         U _BN_sub_word
+         U _BN_swap
+000790e8 T _checkDLPkey
+         U _free
+000786c8 T _generateBignum
+00079de0 T _generateDLPkey
+00079c28 t _generateDLPrivateValue
+000795f8 t _generateDLPublicValues
+000792f8 t _generatePrime
+00079e94 T _generateRSAkey
+000789c8 T _initCheckRSAkey
+0007a0d8 T _initDLPkey
+         U _krnlSendMessage
+         U _malloc
+         U _memset
+000787c4 t _primeProbable
+000d3c98 s _primes
+000d5c98 s _smallPrimes.5983
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_md2.o):
+         U _MD2_Final
+         U _MD2_Init
+         U _MD2_Update
+000e4b28 s _digestValues
+         U _getInfo
+0007a2e0 T _md2GetInfo
+0007a2f4 T _md2Hash
+0007a370 T _md2HashBuffer
+0007a438 T _md2SelfTest
+         U _memcmp
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_md4.o):
+         U _MD4_Final
+         U _MD4_Init
+         U _MD4_Update
+000e4be8 s _digestValues
+         U _getInfo
+0007a5a8 T _md4GetInfo
+0007a5bc T _md4Hash
+0007a4f8 T _md4SelfTest
+         U _memcmp
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_md5.o):
+         U _MD5_Final
+         U _MD5_Init
+         U _MD5_Update
+000e4ca8 s _digestValues
+         U _getInfo
+0007a638 T _md5GetInfo
+0007a64c T _md5Hash
+0007a6c8 T _md5HashBuffer
+0007a790 T _md5SelfTest
+         U _memcmp
+         U _memset
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_rc2.o):
+         U _RC2_cbc_encrypt
+         U _RC2_ecb_encrypt
+         U _RC2_set_key
+         U _getInfo
+         U _memcmp
+         U _memcpy
+0007a9fc T _rc2DecryptCBC
+0007ab74 T _rc2DecryptCFB
+0007a95c T _rc2DecryptECB
+0007adf4 T _rc2DecryptOFB
+0007a9c4 T _rc2EncryptCBC
+0007aa34 T _rc2EncryptCFB
+0007a8f4 T _rc2EncryptECB
+0007acd8 T _rc2EncryptOFB
+0007a8e0 T _rc2GetInfo
+0007af10 T _rc2InitKey
+0007a850 T _rc2SelfTest
+000d5f3c s _testRC2
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_rc4.o):
+         U _RC4
+         U _RC4_set_key
+         U _getInfo
+         U _memcmp
+         U _memcpy
+0007af84 T _rc4Encrypt
+0007af70 T _rc4GetInfo
+0007afc0 T _rc4InitKey
+0007b018 T _rc4SelfTest
+000d63c8 s _testRC4ciphertext1
+000d63b0 s _testRC4ciphertext2
+000d6398 s _testRC4ciphertext3
+000d637c s _testRC4ciphertext4
+000d5f74 s _testRC4ciphertext5
+000d5f5c s _testRC4ciphertext6
+000d63d8 s _testRC4key1
+000d63c0 s _testRC4key2
+000d63a8 s _testRC4key3
+000d6394 s _testRC4key4
+000d6374 s _testRC4key5
+000d5f6c s _testRC4key6
+000d63d0 s _testRC4plaintext1
+000d63b8 s _testRC4plaintext2
+000d63a0 s _testRC4plaintext3
+000d6388 s _testRC4plaintext4
+000d6174 s _testRC4plaintext5
+000d5f64 s _testRC4plaintext6
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_rc5.o):
+         U _RC5_32_cbc_encrypt
+         U _RC5_32_ecb_encrypt
+         U _RC5_32_set_key
+         U _getInfo
+         U _memcmp
+         U _memcpy
+0007b454 T _rc5DecryptCBC
+0007b5cc T _rc5DecryptCFB
+0007b3b4 T _rc5DecryptECB
+0007b84c T _rc5DecryptOFB
+0007b41c T _rc5EncryptCBC
+0007b48c T _rc5EncryptCFB
+0007b34c T _rc5EncryptECB
+0007b730 T _rc5EncryptOFB
+0007b338 T _rc5GetInfo
+0007b968 T _rc5InitKey
+0007b284 T _rc5SelfTest
+000d63e0 s _testRC5
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_ripe.o):
+         U _RIPEMD160_Final
+         U _RIPEMD160_Init
+         U _RIPEMD160_Update
+000e4d68 s _digestValues
+         U _getInfo
+         U _memcmp
+         U _memset
+0007b9c8 T _ripemd160GetInfo
+0007b9dc T _ripemd160Hash
+0007ba58 T _ripemd160HashBuffer
+0007bb20 T _ripemd160SelfTest
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_rsa.o):
+         U _BN_CTX_free
+         U _BN_CTX_init
+         U _BN_MONT_CTX_free
+         U _BN_MONT_CTX_init
+         U _BN_add
+         U _BN_bin2bn
+         U _BN_bn2bin
+         U _BN_clear_free
+         U _BN_div
+         U _BN_init
+         U _BN_mod_exp_mont
+         U _BN_mod_mul
+         U _BN_mul
+         U _BN_num_bits
+         U _BN_sub
+         U _calculateKeyID
+000d65c4 s _capabilityInfo.6262
+         U _generateRSAkey
+         U _initCheckRSAkey
+         U _initKeyReadWrite
+         U _memcmp
+         U _memset
+0007bcf4 T _rsaDecrypt
+0007bbe0 T _rsaEncrypt
+0007c120 T _rsaGenerateKey
+0007bfc8 T _rsaInitKey
+0007c16c T _rsaSelfTest
+000d6480 s _rsaTestKey
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_sha.o):
+         U _SHA1_Final
+         U _SHA1_Init
+         U _SHA1_Update
+000e4e64 s _digestValues
+         U _getInfo
+         U _memcmp
+         U _memset
+0007c7e4 T _shaGetInfo
+0007c7f8 T _shaHash
+0007c874 T _shaHashBuffer
+0007c93c T _shaSelfTest
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(lib_skip.o):
+         U _getInfo
+         U _memcmp
+         U _memcpy
+         U _skipjackDecrypt
+0007cbf4 T _skipjackDecryptCBC
+0007cdd8 T _skipjackDecryptCFB
+0007caf4 T _skipjackDecryptECB
+0007d048 T _skipjackDecryptOFB
+         U _skipjackEncrypt
+0007cb54 T _skipjackEncryptCBC
+0007cca0 T _skipjackEncryptCFB
+0007ca94 T _skipjackEncryptECB
+0007cf34 T _skipjackEncryptOFB
+0007ca80 T _skipjackGetInfo
+0007d15c T _skipjackInitKey
+         U _skipjackMakeKey
+0007c9fc T _skipjackSelfTest
+000d6630 s _testSkipjack
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(asn1_rw.o):
+         U _BN_bin2bn
+         U _BN_bn2bin
+         U _BN_high_bit
+         U _BN_num_bits
+0007fd10 t _checkASN1
+0007d7a8 T _checkEOC
+000805a0 T _checkObjectEncoding
+000804a8 T _getLongObjectLength
+00080704 T _getObjectLength
+00080624 T _getStreamObjectLength
+         U _gmtime
+         U _memset
+         U _mktime
+0007da1c T _readBignumTag
+00080d84 T _readBitStringHole
+0007df70 T _readBitStringTag
+0007dd80 T _readBooleanTag
+0007de44 T _readCharacterString
+00080a9c T _readConstructed
+00080b94 T _readConstructedI
+0007dba0 T _readEnumeratedTag
+0007e934 T _readGeneralizedTimeTag
+0007e0e4 T _readGenericHole
+0007ed94 T _readIntegerTag
+0007d81c t _readLengthValue
+0007eb1c T _readLongConstructed
+0007e1d4 T _readLongGenericHole
+0007ea74 T _readLongSequence
+0007dce4 T _readNullTag
+00080c8c T _readOctetStringHole
+0007ef04 T _readOctetStringTag
+0007ec14 T _readRawObjectTag
+000807fc T _readSequence
+000808a4 T _readSequenceI
+0008094c T _readSet
+000809f4 T _readSetI
+0007e324 T _readShortIntegerTag
+0007e59c t _readTime
+0007e9d4 T _readUTCTimeTag
+0007e2c4 T _readUniversal
+0007db48 T _readUniversalData
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+         U _sgetc
+0007d218 T _signedBignumSize
+0007d1b0 T _sizeofObject
+         u _sprintf$LDBLStub
+         U _sputc
+         U _sread
+         U _sseek
+         U _swrite
+0007f04c T _writeBignumTag
+0007d534 T _writeBitString
+0007fad8 T _writeBitStringHole
+0007d4d0 T _writeBoolean
+0007f574 T _writeCharacterString
+0007f8a0 T _writeConstructed
+0007d34c T _writeEnumerated
+0007d6d4 T _writeGeneralizedTime
+0007fc08 T _writeGenericHole
+0007f2ac T _writeInteger
+0007d260 T _writeLength
+0007d484 T _writeNull
+0007f444 T _writeOctetString
+0007f9bc T _writeOctetStringHole
+0007f690 T _writeSequence
+0007f798 T _writeSet
+0007e464 T _writeShortInteger
+0007d5e4 T _writeUTCTime
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(asn1s_rw.o):
+000e4eb8 s _algoIDmap
+00082250 T _checkAlgoID
+         U _checkEOC
+         U _krnlSendMessage
+         U _memcmp
+         U _memset
+000824d8 T _readAlgoID
+00082358 T _readAlgoIDex
+000825c4 T _readCMSencrHeader
+00081c08 T _readCMSheader
+         U _readConstructed
+000816c8 T _readContextAlgoID
+         U _readLongConstructed
+         U _readLongGenericHole
+         U _readLongSequence
+000824e4 T _readMessageDigest
+         U _readNullTag
+00080e9c T _readOID
+00080f20 T _readOIDSelection
+         U _readOctetStringTag
+         U _readRawObjectTag
+         U _readSequence
+         U _readShortIntegerTag
+         U _sMemClose
+         U _sMemOpen
+         U _sPeek
+00082548 T _sizeofAlgoID
+000822cc T _sizeofAlgoIDex
+00082070 T _sizeofCMSencrHeader
+000827a4 T _sizeofContextAlgoID
+         U _sizeofObject
+         U _sputc
+         U _sseek
+         U _swrite
+00082a34 T _writeAlgoID
+000815e4 T _writeAlgoIDex
+00082120 T _writeCMSencrHeader
+00081e78 T _writeCMSheader
+         U _writeConstructed
+00082af8 T _writeContextAlgoID
+00081020 t _writeContextCryptAlgoID
+000828d0 T _writeMessageDigest
+         U _writeNull
+         U _writeOctetString
+         U _writeOctetStringHole
+         U _writeSequence
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(key_rw.o):
+         U _BN_bin2bn
+         U _BN_bn2bin
+         U _BN_num_bits
+00084090 T _calculateKeyID
+00083ed0 T _decodeDLValues
+00083d70 T _encodeDLValues
+         U _getHashParameters
+00083ff0 T _initKeyReadWrite
+         U _krnlSendMessage
+         U _memcmp
+         U _readAlgoID
+         U _readAlgoIDex
+         U _readBignumInteger16Ubits
+         U _readBignumInteger32
+         U _readBignumTag
+         U _readBitStringHole
+         U _readConstructed
+         U _readGenericHole
+         U _readIntegerTag
+         U _readOctetStringHole
+00082fe4 T _readPgpDlpPublicKey
+00082ee4 T _readPgpRsaPublicKey
+000835d8 t _readPrivateKeyDlpFunction
+00083374 t _readPrivateKeyRsaFunction
+000830f0 t _readPublicKeyDlpFunction
+000845d0 t _readPublicKeyRsaFunction
+         U _readSequence
+         U _readShortIntegerTag
+00082c00 T _readSsh1RsaPublicKey
+00082d54 T _readSsh2DlpPublicKey
+00082c90 T _readSsh2RsaPublicKey
+         U _readString32
+         U _readUint32
+         U _readUint32Time
+         U _readUniversal
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sPeek
+         U _sgetc
+         U _signedBignumSize
+         U _sizeofAlgoID
+         U _sizeofAlgoIDex
+         U _sizeofBignumInteger32
+         U _sizeofObject
+         U _sputc
+         U _sseek
+         U _strcmp
+         U _swrite
+         U _writeAlgoID
+         U _writeAlgoIDex
+         U _writeBignumInteger16Ubits
+         U _writeBignumInteger32
+         U _writeBignumTag
+         U _writeBitStringHole
+00083b00 T _writeFlatPublicKey
+         U _writeInteger
+         U _writeOctetStringHole
+000832d0 T _writePgpDlpPublicKey
+00083270 T _writePgpRsaPublicKey
+00083a4c t _writePrivateKeyDlpFunction
+00083684 t _writePrivateKeyRsaFunction
+000847b8 t _writePublicKeyDlpFunction
+0008439c t _writePublicKeyRsaFunction
+         U _writeSequence
+         U _writeShortInteger
+         U _writeString32
+         U _writeUint32
+         U _writeUint32Time
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(keyex.o):
+00085c94 T _cryptExportKey
+0008599c T _cryptExportKeyEx
+00085994 T _cryptImportKey
+00085530 T _cryptImportKeyEx
+00085f0c T _cryptQueryObject
+         U _cryptlibToPgpAlgo
+         U _dynCreate
+         U _dynDestroy
+00084b6c t _exportConventionalKey
+00084e78 t _exportPublicKey
+         U _getObjectLength
+00085da0 T _iCryptExportKeyEx
+00085cdc T _iCryptImportKeyEx
+000850cc t _importConventionalKey
+000852e4 t _importPublicKey
+         U _kekReadTable
+         U _kekWriteTable
+         U _keytransReadTable
+         U _keytransWriteTable
+         U _krnlSendMessage
+         U _memcpy
+         U _memset
+         U _messageValueFalse
+         U _messageValueTrue
+         U _pgpReadPacketHeader
+         U _queryAsn1Object
+         U _queryPgpObject
+         U _readConstructed
+         U _readSequence
+         U _readShortIntegerTag
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sizeofAlgoIDex
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(keyex_rw.o):
+         U _cryptlibToPgpAlgo
+00086018 T _getPacketInfo
+         U _getStreamObjectLength
+000e5288 S _kekReadTable
+000e526c S _kekWriteTable
+000e52c0 S _keytransReadTable
+000e52a4 S _keytransWriteTable
+         U _krnlSendMessage
+         U _memset
+         U _pgpReadMPI
+         U _pgpReadPacketHeader
+         U _pgpToCryptlibAlgo
+         U _pgpWriteMPI
+         U _pgpWritePacketHeader
+00086da8 T _queryAsn1Object
+0008705c T _queryPgpObject
+         U _readAlgoID
+00086950 t _readCmsKeytrans
+         U _readConstructed
+         U _readContextAlgoID
+00086154 t _readCryptlibKek
+00086bdc t _readCryptlibKeytrans
+         U _readGenericHole
+         U _readOID
+         U _readOctetStringHole
+         U _readOctetStringTag
+         U _readOnepassSigPacket
+000872bc t _readPgpKek
+000874ec t _readPgpKeytrans
+         U _readSequence
+         U _readShortIntegerTag
+         U _readUniversal
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sPeek
+         U _sgetc
+         U _sigReadTable
+         U _sizeofContextAlgoID
+         U _sizeofObject
+         U _sputc
+         U _sread
+         U _sseek
+         U _swrite
+00086a4c t _writeCmsKeytrans
+         U _writeConstructed
+         U _writeContextAlgoID
+000863bc t _writeCryptlibKek
+00086afc t _writeCryptlibKeytrans
+         U _writeOctetString
+00086804 t _writePgpKek
+00086ca8 t _writePgpKeytrans
+         U _writeSequence
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(misc_rw.o):
+         U _BN_bin2bn
+         U _BN_bn2bin
+         U _BN_high_bit
+         U _BN_num_bits
+000d6664 s _lengthOfLength.5932
+         U _memcmp
+         U _memmove
+         U _memset
+000885b4 t _pgpReadLength
+0008871c T _pgpReadPacketHeader
+00088870 T _pgpReadShortLength
+00087a18 T _pgpWriteLength
+00087be8 T _pgpWritePacketHeader
+000884e8 T _readBignumInteger16Ubits
+00088158 T _readBignumInteger32
+00088594 T _readInteger16Ubits
+000885a4 T _readInteger32
+00088584 T _readInteger32Ubits
+000882f4 t _readIntegerData
+00088014 T _readString32
+00087780 T _readUint32
+00087850 T _readUint32Time
+00087f50 T _readUint64
+00087b14 T _readUint64Time
+         U _sPeek
+         U _sgetc
+00087960 T _sizeofBignumInteger32
+         U _sputc
+         U _sread
+         U _sseek
+         U _strlen
+         U _swrite
+000879ac T _writeBignumInteger16Ubits
+00087e7c T _writeBignumInteger32
+0008790c T _writeInteger16Ubits
+00087d84 T _writeInteger32
+00087e10 T _writeInteger32Ubits
+00087d00 T _writeString32
+00087808 T _writeUint32
+000878c4 T _writeUint32Time
+00087c90 T _writeUint64
+00087aa4 T _writeUint64Time
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(net_cmp.o):
+         U _memcpy
+000888c0 t _readFunction
+00088ae8 T _setStreamLayerCMP
+         U _sioctl
+00088a38 t _writeFunction
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(net_http.o):
+         U __DefaultRuneLocale
+         U ___maskrune
+         U ___tolower
+         U ___toupper
+         U _addMIMEchar
+000d8fc8 d _allowedChars.5143
+         U _atoi
+         U _endMIMEstate
+000e56dc s _httpHeaderInfo
+000e52dc s _httpStatusInfo
+         U _initMIMEstate
+00089a5c t _readFunction
+00089090 t _readHTTPStatus
+00089248 t _readHeaderLines
+         U _retExtStreamFn
+         U _sMemDisconnect
+         U _sMemOpen
+00089060 T _setStreamLayerHTTP
+         U _sioctl
+         u _sprintf$LDBLStub
+         U _sputc
+         U _strcat
+         U _strlen
+         U _strncasecmp
+         U _swrite
+00088eac t _writeFunction
+00088b18 t _writeRequestHeader
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(net_tcp.o):
+000d6674 s _SOCKET_INFO_TEMPLATE
+         U ___dn_skipname
+         U ___error
+         U _accept
+         U _atoi
+         U _bind
+0008a9c8 t _checkSocketFunction
+         U _checksumData
+         U _close
+0008c488 t _closeSocketFunction
+         U _connect
+         U _dn_expand
+         U _enterMutex
+         U _exitMutex
+         U _fcntl
+0008b110 t _findHostInfo
+         U _free
+         U _freeaddrinfo
+         U _getTime
+         U _getaddrinfo
+         U _gethostbyname
+         U _gethostname
+         U _getnameinfo
+         U _getsockopt
+         U _h_errno
+000e5858 s _hostErrorInfo
+         U _listen
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+0008a758 T _netEndTCP
+0008a6e0 T _netInitTCP
+0008a944 T _netSignalShutdown
+0008a774 t _newSocket
+0008b5a0 t _openSocketFunction
+0008acf4 t _readSocketFunction
+         U _recv
+         U _res_query
+         U _select
+         U _send
+0008ab28 T _setAccessMethodTCP
+         U _setsockopt
+         U _shutdown
+         U _socket
+000e5778 s _socketErrorInfo
+000e627c b _socketInfo
+         u _sprintf$LDBLStub
+         U _strcasecmp
+         U _strchr
+         U _strcpy
+0008a6d8 t _transportOKFunction
+000d7f7c s _trueValue.6161
+000d7f7c s _trueValue.6212
+0008ab88 t _writeSocketFunction
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(rndunix.o):
+000d66a8 s _C.15.5311
+         U ___error
+         U ___sF
+         U _abort
+         U _access
+         U _addRandomData
+         U _addRandomLong
+0008d2cc T _checkForked
+         U _close
+         U _connect
+000d8fcc d _dataSources
+         U _dup2
+000d9a34 d _egdSources.5170
+         U _endRandomData
+         U _enterMutex
+         U _execl
+         U _exit
+         U _exitMutex
+0008c5ec T _fastPoll
+         U _fclose
+         U _fcntl
+         U _fdopen
+         U _fileno
+         U _fork
+         u _fprintf$LDBLStub
+         U _fread
+000e6284 b _gathererBufSize
+000e628c b _gathererBuffer
+000d9a2c d _gathererGID.5112
+000e6288 b _gathererMemID
+000e6280 b _gathererProcess
+000d9a30 d _gathererUID.5111
+         U _getTime
+         U _getdtablesize
+         U _geteuid
+         U _getpagesize
+         U _getpid
+         U _getpwnam
+         U _getrusage
+         U _gettimeofday
+         U _initRandomData
+0008d334 T _initRandomPolling
+         U _kill
+         U _krnlSendMessage
+         U _memcpy
+         U _memset
+         U _open
+000d9a6c d _originalPID.5399
+         U _pipe
+000d9a44 d _procSources.5200
+000d7f88 s _quality.5162
+000d7f84 s _quality.5173
+000d7f48 s _quality.5203
+         U _read
+         U _sched_yield
+         U _select
+         U _setregid
+         U _setreuid
+         U _setrlimit
+         U _shmat
+         U _shmctl
+         U _shmdt
+         U _shmget
+         U _sigaction
+0008c684 T _slowPoll
+         U _socket
+         U _strcpy
+         U _wait4
+0008d14c T _waitforRandomCompletion
+         U _waitpid
+         U _write
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(sign.o):
+         U _algoAvailable
+0008def0 T _checkRawSignature
+0008d680 t _checkSignature
+0008e770 t _checkSignatureCMS
+0008f1ec t _checkSignaturePGP
+0008dc38 T _checkX509signature
+0008dee8 T _createRawSignature
+0008d338 t _createSignature
+0008def8 t _createSignatureCMS
+0008edbc t _createSignaturePGP
+0008d988 T _createX509signature
+0008f9b8 T _cryptCheckSignature
+0008f66c T _cryptCheckSignatureEx
+0008f618 T _cryptCreateSignature
+0008f368 T _cryptCreateSignatureEx
+         U _cryptlibToPgpAlgo
+         U _dynCreate
+         U _dynDestroy
+         U _exportAttributeToStream
+         U _free
+         U _getApproxTime
+         U _getObjectLength
+         U _getReliableTime
+0008fb4c T _iCryptCheckSignatureEx
+0008f9c0 T _iCryptCreateSignatureEx
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueCryptUnused
+         U _messageValueCursorFirst
+         U _messageValueFalse
+         U _messageValueTrue
+         U _pgpReadPacketHeader
+         U _pgpWriteLength
+         U _pgpWritePacketHeader
+         U _queryAsn1Object
+         U _readAlgoIDex
+         U _readConstructed
+         U _readLongSequence
+         U _readOctetStringHole
+         U _readSequence
+         U _readShortIntegerTag
+         U _readUniversal
+         U _sMemClose
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+000d66b8 s _setTag.5558
+         U _sigReadTable
+         U _sigWriteTable
+         U _sizeofAlgoID
+         U _sizeofObject
+         U _sputc
+         U _sseek
+         U _swrite
+         U _writeAlgoID
+         U _writeConstructed
+0008ea5c t _writePgpSigPacketHeader
+         U _writeSequence
+         U _writeSet
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(sign_rw.o):
+         U _getPacketInfo
+         U _getStreamObjectLength
+         U _krnlSendMessage
+         U _memcmp
+000d9a70 d _nameString.5740
+         U _pgpReadMPI
+         U _pgpReadShortLength
+         U _pgpToCryptlibAlgo
+         U _readAlgoID
+         U _readAlgoIDex
+         U _readBitStringHole
+0008fdbc t _readCmsSignature
+         U _readConstructed
+00090064 t _readCryptlibSignature
+         U _readOctetStringHole
+         U _readOctetStringTag
+00090448 T _readOnepassSigPacket
+00090520 t _readPgpSignature
+0008fc38 t _readRawSignature
+         U _readSequence
+         U _readShortIntegerTag
+00090240 t _readSignatureSubpackets
+00090908 t _readSshSignature
+         U _readString32
+         U _readUint32
+0008fce4 t _readX509Signature
+         U _sPeek
+         U _sgetc
+000e58b0 S _sigReadTable
+000e5888 S _sigWriteTable
+         U _sizeofAlgoID
+         U _sizeofContextAlgoID
+         U _sizeofObject
+         U _sputc
+         U _sread
+         U _sseek
+         U _strlen
+         U _swrite
+         U _writeAlgoID
+         U _writeBitStringHole
+00090018 t _writeCmsSignature
+         U _writeContextAlgoID
+00090140 t _writeCryptlibSignature
+         U _writeOctetString
+00090898 t _writePgpSignature
+0008fc9c t _writeRawSignature
+         U _writeSequence
+         U _writeShortInteger
+00090a34 t _writeSshSignature
+         U _writeString32
+         U _writeUint32
+0008fd68 t _writeX509Signature
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(str_file.o):
+         U ___error
+         U _access
+         U _chmod
+         U _close
+00090c38 T _fileBuildCryptlibPath
+0009107c T _fileClearToEOF
+00090f78 T _fileErase
+00090bc4 T _fileFlush
+00090b50 T _fileRead
+00090ab8 T _fileReadonly
+00090bec T _fileSeek
+00090b80 T _fileWrite
+         U _flock
+         U _fstat
+         U _fsync
+         U _ftruncate
+         U _getpwuid
+         U _getuid
+         U _krnlSendMessage
+         U _lseek
+         U _lstat
+         U _memcpy
+         U _memset
+         U _mkdir
+000d66c4 s _modes.4855
+         U _open
+         U _read
+00090b00 T _sFileClose
+00090d64 T _sFileOpen
+         U _strcat
+         U _strlen
+         U _unlink
+         U _utimes
+         U _write
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(str_mem.o):
+         U _memset
+000911cc T _sMemClose
+00091228 T _sMemConnect
+00091284 T _sMemDisconnect
+00091144 T _sMemOpen
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(str_net.o):
+         U _atoi
+000912b0 t _bufferedTransportReadFunction
+00091474 t _bufferedTransportWriteFunction
+000915c8 t _cleanupStream
+00092418 t _completeConnect
+000d7f8c s _fixedTimeout.5036
+         U _free
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueTrue
+00091a50 t _parseURL
+         U _retExtStreamFn
+00092ad4 T _sNetConnect
+000916a0 T _sNetDisconnect
+000916c8 T _sNetGetErrorInfo
+00092870 T _sNetListen
+00092410 T _sNetParseURL
+         U _setAccessMethodTCP
+         U _setStreamLayerCMP
+         U _setStreamLayerHTTP
+         U _sioctl
+         U _strcasecmp
+         U _strcmp
+         U _strcpy
+         U _strlen
+         U _strncasecmp
+0009158c t _transportDirectReadFunction
+0009159c t _transportDirectWriteFunction
+0009175c t _transportSessionConnectFunction
+000915ac t _transportSessionDisconnectFunction
+000915c0 t _transportSessionOKFunction
+000918ec t _transportSessionReadFunction
+00091828 t _transportSessionWriteFunction
+000e58d8 s _urlSchemaInfo.4743
+         U _waitSemaphore
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(stream.o):
+         U _fileFlush
+         U _fileRead
+         U _fileSeek
+         U _fileWrite
+         U _free
+         U _krnlSendMessage
+         U _malloc
+         U _memcpy
+         U _memset
+00092e50 t _refillStream
+00092de0 T _retExtStreamFn
+000931bc T _sPeek
+0009301c T _sflush
+00092f38 T _sgetc
+00093280 T _sioctl
+000936dc T _sputc
+00093528 T _sread
+00093100 T _sseek
+         U _strcpy
+00093824 T _swrite
+         U _vsprintf
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cmp.o):
+000d6754 s _C.17.5690
+000d674c s _C.18.5698
+000e5974 s _altProtocolInfo.5703
+00094030 t _clientStartup
+00094fb0 t _clientTransact
+0009568c t _clientTransactWrapper
+         U _decodePKIUserValue
+000941f8 t _getAttributeFunction
+00093f7c T _hashMessageContents
+00093a74 T _initMacInfo
+00093c6c T _initServerAuthentMAC
+00093db4 T _initServerAuthentSign
+         U _initSessionNetConnectInfo
+         U _krnlSendMessage
+         U _memcpy
+         U _memset
+         U _pnpPkiSession
+000e5938 s _protocolInfo.5704
+         U _readPkiDatagram
+         U _readPkiMessage
+000d66d4 s _reqRespMapTbl
+000939f8 T _reqToResp
+         U _retExtFnSession
+         U _sMemClose
+         U _sMemOpen
+         U _sNetConnect
+         U _sNetDisconnect
+00094674 t _serverTransact
+000945ec T _setAccessMethodCMP
+0009427c t _setAttributeFunction
+00093b24 t _setProtocolInfo
+00094194 t _shutdownFunction
+         U _sioctl
+         U _strlen
+         U _writePkiDatagram
+         U _writePkiMessage
+         U _writeSequence
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cmp_rd.o):
+         U _checkRawSignature
+         U _decodePKIUserValue
+         U _encodePKIUserValue
+         U _envelopeUnwrap
+000d9a74 d _failureStrings.5695
+         U _hashMessageContents
+         U _initMacInfo
+         U _initServerAuthentMAC
+         U _initServerAuthentSign
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+         U _readAlgoIDex
+         U _readBitStringHole
+         U _readBitStringTag
+         U _readCharacterString
+         U _readConstructed
+         U _readContextAlgoID
+         U _readOID
+         U _readOctetStringTag
+000956f8 t _readPkiHeader
+00096380 T _readPkiMessage
+00095ec8 T _readPkiStatusInfo
+         U _readRawObjectTag
+         U _readSequence
+         U _readSet
+         U _readShortIntegerTag
+         U _readUniversal
+         U _retExtFnSession
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sPeek
+         u _sprintf$LDBLStub
+         U _sseek
+         U _strlen
+         U _strncat
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(cmp_wr.o):
+         U _createRawSignature
+         U _envelopeWrap
+         U _exportAttributeToStream
+         U _exportCertToStream
+         U _hashMessageContents
+         U _krnlSendMessage
+         U _memcpy
+         U _memmove
+         U _reqToResp
+         U _sMemClose
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sizeofAlgoID
+         U _sizeofObject
+         U _sseek
+         U _swrite
+         U _writeAlgoID
+         U _writeBitString
+         U _writeBitStringHole
+00097934 t _writeCertID
+         U _writeConstructed
+         U _writeContextAlgoID
+00097a60 t _writeMacInfo
+         U _writeNull
+         U _writeOctetString
+00097b88 T _writePkiMessage
+         U _writeSequence
+         U _writeSet
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ocsp.o):
+000d676c s _C.7.5322
+00098b98 t _clientTransact
+         U _exportCertToStream
+         U _krnlSendMessage
+         U _memcmp
+000e5980 s _ocspOIDselection
+000e59a0 s _protocolInfo.5332
+         U _readConstructed
+         U _readEnumeratedTag
+         U _readGenericHole
+         U _readOIDSelection
+         U _readPkiDatagram
+         U _readSequence
+         U _readUniversal
+000d6764 s _respBadRequest
+000d675c s _respIntError
+         U _retExtFnSession
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sPeek
+00099034 t _serverTransact
+00098fdc T _setAccessMethodOCSP
+00098f04 t _setAttributeFunction
+         U _sizeofObject
+         U _swrite
+         U _writeConstructed
+         U _writeEnumerated
+         U _writeOctetStringHole
+         U _writePkiDatagram
+         U _writeSequence
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(pnppki.o):
+00099624 t _createCertRequest
+         U _free
+000994cc t _generateKey
+000e59dc s _keyInfo
+         U _krnlSendMessage
+         U _malloc
+         U _messageValueCursorFirst
+         U _messageValueCursorNext
+00099790 T _pnpPkiSession
+         U _retExtFnSession
+         U _sioctl
+         U _strlen
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(rtcs.o):
+000d6774 s _C.8.5301
+0009a6a4 t _clientTransact
+000e5a18 s _envelopeOIDselection
+         U _envelopeSigCheck
+         U _envelopeSign
+         U _envelopeUnwrap
+         U _envelopeWrap
+         U _krnlSendMessage
+         U _memcmp
+         U _memset
+000e5a78 s _protocolInfo.5311
+         U _readCMSheader
+         U _readPkiDatagram
+         U _retExtFnSession
+         U _sMemConnect
+         U _sMemDisconnect
+0009aaf4 t _serverTransact
+0009aa9c T _setAccessMethodRTCS
+0009a9c4 t _setAttributeFunction
+         U _writePkiDatagram
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(scep.o):
+         U _atoi
+0009b200 t _checkAttributeFunction
+0009bbb8 t _clientTransact
+0009aed8 t _createScepAttributes
+         U _decodePKIUserValue
+         U _envelopeSigCheck
+         U _envelopeSign
+         U _envelopeUnwrap
+         U _envelopeWrap
+         U _free
+         U _isPKIUserValue
+000d7f90 s _keyUsage.5238
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _messageValueTrue
+000e5ab4 s _protocolInfo.5527
+         U _readPkiDatagram
+         U _retExtFnSession
+0009b2bc t _serverTransact
+0009b258 T _setAccessMethodSCEP
+0009b0f8 t _setAttributeFunction
+         U _sioctl
+         U _strlen
+         U _writePkiDatagram
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssh.o):
+         U _attributeCopy
+0009c804 t _completeStartup
+0009c35c T _encodeString
+0009c3dc t _getAttributeFunction
+         U _initSSH1processing
+         U _initSSH2processing
+0009c570 T _initSecurityContexts
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _retExtFnSession
+         U _sNetGetErrorInfo
+         U _sNetParseURL
+0009d0ac t _serverStartup
+0009c4e8 T _setAccessMethodSSH
+0009c430 t _setAttributeFunction
+         U _sioctl
+         U _sread
+         U _strlen
+         U _strstr
+         U _swrite
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssh1.o):
+         U _algoAvailable
+0009ee34 t _beginClientHandshake
+0009dc20 t _beginServerHandshake
+0009e934 t _completeClientHandshake
+0009f33c t _completeServerHandshake
+000d677c s _crc32table
+         U _encodeString
+0009d968 t _exchangeClientKeys
+0009f590 t _exchangeServerKeys
+         U _getHashParameters
+0009d5ec T _initSSH1processing
+         U _initSecurityContexts
+0009d364 t _initSecurityInfoSSH1
+000d6b7c s _iv.5166
+000d7f94 s _keyLength.5687
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+0009dfdc t _processBodyFunction
+0009d134 t _processPublickeyData
+000d6b9c s _protocolInfo.6008
+         U _readFixedHeader
+0009d504 t _readHeaderFunction
+0009e42c t _readPacketSSH1
+         U _retExtFnSession
+         U _sNetDisconnect
+         U _sNetGetErrorInfo
+0009d698 t _sendPacketSsh1
+0009d5e4 t _shutdownFunction
+         U _sread
+         U _strlen
+         U _swrite
+0009df5c t _writeDataFunction
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssh2.o):
+         U _algoAvailable
+000e5b20 s _algoStringCoprTbl
+000e5b48 s _algoStringEncrTblClient
+000e5b80 s _algoStringEncrTblServer
+000e5bb0 s _algoStringKeyexTbl
+000e5b30 s _algoStringMACTbl
+000e5bc8 s _algoStringMapTbl.5135
+000e5b08 s _algoStringPubkeyTbl
+000e5af0 s _algoStringUserauthentTbl
+000a0dac T _completeKeyex
+000d6f60 s _dh1024SPKI
+000d6e88 s _dh1536SSH
+000d6d70 s _dh2048SSH
+000d6bd8 s _dh3072SSH
+0009fea4 T _encodeMPI
+         U _encodeString
+000d7088 s _errorMap.5502
+         U _getAddressAndPort
+0009fd38 T _getAlgoID
+0009fa6c t _getAlgoIDEx
+000a01b4 t _getDisconnectInfo
+         U _getHashParameters
+0009ffd4 T _hashAsMPI
+0009ff20 T _hashAsString
+0009f8a0 T _initDHcontext
+         U _initSSH2clientProcessing
+000a0d0c T _initSSH2processing
+         U _initSSH2serverProcessing
+         U _initSecurityContexts
+000a2224 T _initSecurityInfo
+000d9af4 d _invalidRequests.5877
+         U _krnlSendMessage
+000a0078 t _macPayload
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+000a1c14 t _processBodyFunction
+         U _processChannelOpen
+000a117c T _processHello
+000a17b4 T _processRequest
+000d70b8 s _protocolInfo.6266
+0009fdb8 T _putAlgoID
+         U _readFixedHeader
+000a0ad4 t _readHeaderFunction
+000a034c T _readPacketSSH2
+         U _retExtFnSession
+         U _sNetDisconnect
+         U _sNetGetErrorInfo
+000a0a58 T _sendPacketSSH2
+000a1fd0 t _shutdownFunction
+         U _sioctl
+         U _sread
+         U _strcat
+         U _strlen
+         U _swrite
+000d9ae4 d _validRequests.5878
+000a0854 T _wrapPacket
+000a1f0c t _writeDataFunction
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssh2_cli.o):
+000a29cc t _beginClientHandshake
+000a3420 t _completeClientHandshake
+         U _completeKeyex
+         U _encodeMPI
+         U _encodeString
+000a2f54 t _exchangeClientKeys
+         U _getAlgoID
+         U _getHashParameters
+         U _hashAsString
+         U _iCryptCheckSignatureEx
+         U _iCryptCreateSignatureEx
+         U _initDHcontext
+000a3ba8 T _initSSH2clientProcessing
+         U _initSecurityInfo
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+         U _processHello
+         U _putAlgoID
+         U _readPacketSSH2
+         U _retExtFnSession
+         U _sNetGetErrorInfo
+         U _sNetParseURL
+         U _sendPacketSSH2
+         U _strlen
+         U _swrite
+         U _wrapPacket
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssh2_svr.o):
+         U _algoAvailable
+000d7100 s _algoEncrList
+000d7118 s _algoKeyexList
+000d70f4 s _algoMACList
+000d9b00 d _algoStringCoprList
+000e5c30 s _algoStringMapTbl.4959
+000e5c98 s _algoStringPubkeyDSATbl.5177
+000e5ca8 s _algoStringPubkeyRSATbl.5176
+000d9afc d _algoStringUserauthentList
+000a4158 t _beginServerHandshake
+         U _completeKeyex
+000a4884 t _completeServerHandshake
+         U _encodeMPI
+         U _encodeString
+000a46a4 t _exchangeServerKeys
+000a3d78 T _getAddressAndPort
+         U _hashAsString
+         U _iCryptCreateSignatureEx
+         U _initDHcontext
+000a4d00 T _initSSH2serverProcessing
+         U _initSecurityInfo
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+000a3e84 T _processChannelOpen
+         U _processHello
+         U _processRequest
+         U _putAlgoID
+000a3be0 t _putAlgoList
+         U _readPacketSSH2
+         U _retExtFnSession
+         U _sendPacketSSH2
+         U _sprintf
+         U _strlen
+         U _wrapPacket
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssl.o):
+000a6408 t _abortStartup
+         U _addSessionCacheEntry
+000e5cb8 s _alertInfo.5525
+000d7168 s _changeCipherSpecTemplate
+000a5a38 T _checkPacketHeader
+000a84a0 t _clientStartup
+000d7120 s _closeAlertTemplate
+000a73fc t _commonStartup
+000a5b28 t _completeSSLDualMAC
+000a6078 T _createSharedMasterSecret
+         U _decodePKIUserValue
+000a4e90 t _decryptData
+         U _deleteSessionCacheEntry
+000a5410 T _dualMacData
+         U _findSessionCacheEntryID
+000d7180 s _finishedTemplate
+000a5d80 t _getAttributeFunction
+000d71c8 s _handshakeFailAlertTemplate
+         U _iCryptCheckSignatureEx
+         U _iCryptCreateSignatureEx
+000a4d38 T _initCiphersuiteInfo
+         U _initSSLclientProcessing
+         U _initSSLserverProcessing
+         U _krnlSendMessage
+000a5004 t _macDataSSL
+000a5278 t _macDataTLS
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueCursorFirst
+         U _messageValueCursorNext
+         U _messageValueFalse
+         U _messageValueTrue
+000a5dec t _processBodyFunction
+000a579c T _processCertVerify
+000a598c T _processVersionInfo
+000d7210 s _protocolInfo.6088
+         U _readFixedHeader
+000a7070 t _readHandshakeCompletionData
+000a6b38 t _readHeaderFunction
+000a65cc t _readPacketHeader
+000a6ce4 T _readPacketSSL
+         U _retExtFnSession
+         U _sNetDisconnect
+         U _sNetGetErrorInfo
+000a84a8 t _serverStartup
+000a5fe0 T _setAccessMethodSSL
+000a6280 t _setAttributeFunction
+000a8504 t _shutdownFunction
+         U _sioctl
+         U _sread
+         U _strcat
+         U _swrite
+         U _waitSemaphore
+000a54b8 t _wrapData
+000a5a14 T _wrapHandshakePacket
+000a5f7c t _writeDataFunction
+000a561c T _writeSSLCertChain
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssl_cli.o):
+         U _algoAvailable
+000a8614 T _beginClientHandshake
+         U _checkPacketHeader
+         U _createSharedMasterSecret
+         U _dualMacData
+000a8bfc T _exchangeClientKeys
+         U _initCiphersuiteInfo
+000a937c T _initSSLclientProcessing
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memset
+000d7254 s _noCertAlertSSLTemplate
+000d724c s _noCertTLSTemplate
+         U _processCertVerify
+         U _processVersionInfo
+         U _readPacketSSL
+         U _retExtFnSession
+         U _sNetGetErrorInfo
+000d725c s _serverHelloDoneTemplate
+         U _swrite
+         U _wrapHandshakePacket
+         U _writeSSLCertChain
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(ssl_svr.o):
+000d7274 s _SESSIONCACHE_INDEX_TEMPLATE
+000aa7dc T _addSessionCacheEntry
+         U _algoAvailable
+000a9db8 T _beginServerHandshake
+         U _checkPacketHeader
+         U _checksumData
+000a93a8 T _deleteSessionCacheEntry
+         U _dualMacData
+000a9578 T _endSessionCache
+         U _enterMutex
+000a95fc T _exchangeServerKeys
+         U _exitMutex
+000aa7f4 T _findSessionCacheEntryID
+         U _free
+         U _getHashParameters
+         U _getTime
+000a9a6c t _handleSessionCache
+000e6290 b _hashFunction.5077
+         U _initCiphersuiteInfo
+000a9a40 T _initSSLserverProcessing
+000a9480 T _initSessionCache
+         U _krnlMemalloc
+         U _krnlMemfree
+         U _krnlSendMessage
+         U _malloc
+         U _memcmp
+         U _memcpy
+         U _memset
+         U _processCertVerify
+         U _processVersionInfo
+         U _readPacketSSL
+         U _retExtFnSession
+         U _sNetGetErrorInfo
+000d7264 s _serverCertRequestTemplate
+000d7260 s _serverHelloDoneTemplate
+000e6294 b _sesionCacheUniqueID
+000e629c b _sessionCacheData
+000e62a0 b _sessionCacheIndex
+000e6298 b _sessionCacheLastEntry
+         U _swrite
+         U _wrapHandshakePacket
+         U _writeSSLCertChain
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(tsp.o):
+000e5e5c s _altProtocolInfo.5671
+         U _attributeCopy
+000aaeb0 t _checkAttributeFunction
+000aa804 t _clientTransact
+000d7f98 s _contentType.5273
+         U _dynCreate
+         U _dynDestroy
+000aac94 t _getAttributeFunction
+         U _getReliableTime
+         U _krnlSendMessage
+         U _memcmp
+         U _memcpy
+         U _memmove
+         U _memset
+         U _messageValueFalse
+000d7f80 s _minBufferSize.5272
+000e5e20 s _protocolInfo.5672
+         U _readBooleanTag
+         U _readConstructed
+         U _readOctetStringHole
+         U _readPkiDatagram
+         U _readPkiStatusInfo
+         U _readRawObjectTag
+         U _readSequence
+         U _readShortIntegerTag
+         U _readUniversal
+000d7298 s _respBadData
+000d72a8 s _respBadExtension
+000d72bc s _respBadGeneric
+         U _retExtFnSession
+         U _sMemConnect
+         U _sMemDisconnect
+         U _sMemOpen
+         U _sNetGetErrorInfo
+         U _sPeek
+000aafc8 t _serverTransact
+000aaf5c T _setAccessMethodTSP
+000aae08 t _setAttributeFunction
+         U _sizeofAlgoID
+         U _sizeofObject
+         U _sread
+         U _sseek
+         U _swrite
+         U _writeBoolean
+         U _writeGeneralizedTime
+         U _writeInteger
+         U _writeMessageDigest
+         U _writePkiDatagram
+         U _writeSequence
+         U _writeShortInteger
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(adler32.o):
+000ab874 T _adler32
+
+/opt/local/lib/libcl.dylib(deflate.o):
+         U __dist_code
+         U __length_code
+         U __tr_align
+         U __tr_flush_block
+         U __tr_init
+         U __tr_stored_block
+         U _adler32
+000e5e68 s _configuration_table
+000ad980 T _deflate
+000ac6bc T _deflateCopy
+000aba14 T _deflateEnd
+000ac1f0 T _deflateInit2_
+000ac6a0 T _deflateInit_
+000adee4 T _deflateParams
+000abc98 T _deflateReset
+000abb50 T _deflateSetDictionary
+000c1844 S _deflate_copyright
+000acd1c t _deflate_fast
+000ad278 t _deflate_slow
+000ac988 t _deflate_stored
+000abfd0 t _fill_window
+000abdf0 t _longest_match
+         U _memcpy
+         U _memset
+000d9b04 d _my_version.4220
+         U _z_errmsg
+         U _zcalloc
+         U _zcfree
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(infblock.o):
+000d72d0 s _border
+000ae0a8 T _inflate_blocks
+000aef34 T _inflate_blocks_free
+000aede8 T _inflate_blocks_new
+000adfe4 T _inflate_blocks_reset
+000aedd4 T _inflate_blocks_sync_point
+         U _inflate_codes
+         U _inflate_codes_free
+         U _inflate_codes_new
+         U _inflate_flush
+         U _inflate_mask
+000aed90 T _inflate_set_dictionary
+         U _inflate_trees_bits
+         U _inflate_trees_dynamic
+         U _inflate_trees_fixed
+         U _memcpy
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(infcodes.o):
+000af0a4 T _inflate_codes
+000af990 T _inflate_codes_free
+000af034 T _inflate_codes_new
+         U _inflate_fast
+         U _inflate_flush
+         U _inflate_mask
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(inffast.o):
+000af9a8 T _inflate_fast
+         U _inflate_mask
+
+/opt/local/lib/libcl.dylib(inflate.o):
+         U _adler32
+000aff58 T _inflate
+000afed4 T _inflateEnd
+000b07c0 T _inflateInit2_
+000b09fc T _inflateInit_
+000afe58 T _inflateReset
+000b0540 T _inflateSetDictionary
+000b0628 T _inflateSync
+000b05fc T _inflateSyncPoint
+         U _inflate_blocks
+         U _inflate_blocks_free
+         U _inflate_blocks_new
+         U _inflate_blocks_reset
+         U _inflate_blocks_sync_point
+         U _inflate_set_dictionary
+000d731c s _mark.2280
+         U _zcalloc
+         U _zcfree
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(inftrees.o):
+000d7320 s _cpdext
+000d7398 s _cpdist
+000d748c s _cplens
+000d7410 s _cplext
+000dac08 d _fixed_bd
+000dac0c d _fixed_bl
+000d9b08 d _fixed_td
+000d9c08 d _fixed_tl
+000b0a0c t _huft_build
+000c1994 S _inflate_copyright
+000b0fe4 T _inflate_trees_bits
+000b10e4 T _inflate_trees_dynamic
+000b12cc T _inflate_trees_fixed
+
+/opt/local/lib/libcl.dylib(infutil.o):
+000b1314 T _inflate_flush
+000dac10 D _inflate_mask
+         U _memcpy
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(trees.o):
+000d7608 S __dist_code
+000d7508 S __length_code
+000b28f0 T __tr_align
+000b2c48 T __tr_flush_block
+000b269c T __tr_init
+000b2770 T __tr_stored_block
+000b25ac T __tr_tally
+000d7d14 s _base_dist
+000d7e04 s _base_length
+000d7d00 s _bl_order
+000b1594 t _build_tree
+000b2154 t _compress_block
+000d7eec s _extra_blbits
+000d7d8c s _extra_dbits
+000d7e78 s _extra_lbits
+000b148c t _pqdownheap
+000b1be4 t _send_tree
+000dac54 d _static_bl_desc
+000dac68 d _static_d_desc
+000d7808 s _static_dtree
+000dac7c d _static_l_desc
+000d7880 s _static_ltree
+
+/opt/local/lib/libcl.dylib(zutil.o):
+         U _calloc
+         U _free
+000b353c T _zError
+000dac90 D _z_errmsg
+000b3564 T _zcalloc
+000b3570 T _zcfree
+000b3520 T _zlibVersion
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(_umoddi3.o):
+000d7f9c s EH_frame1
+000b3578 t ___umoddi3
+000d7fb0 s ___umoddi3.eh
+
+/opt/local/lib/libcl.dylib(s_sprintf.o):
+         u ___stub_getrealaddr
+000e62a4 b _funcptr
+000b3918 t _sprintf$LDBLStub
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(s_vsprintf.o):
+         u ___stub_getrealaddr
+000e62a8 b _funcptr
+000b39c4 t _vsprintf$LDBLStub
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(s_fprintf.o):
+         u ___stub_getrealaddr
+000b3a70 t _fprintf$LDBLStub
+000e62ac b _funcptr
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(getrealaddr.o):
+         U _NSAddressOfSymbol
+         U _NSIsSymbolNameDefinedWithHint
+         U _NSLookupAndBindSymbolWithHint
+000b3b1c t ___stub_getrealaddr
+         U _strcpy
+         U _strlen
+         u dyld_stub_binding_helper
+
+/opt/local/lib/libcl.dylib(link editor):
+00000000 t __mh_dylib_header
\ No newline at end of file
diff --git a/extra/crypto/authors.txt b/extra/crypto/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/crypto/barrett/barrett-tests.factor b/extra/crypto/barrett/barrett-tests.factor
new file mode 100644 (file)
index 0000000..be52240
--- /dev/null
@@ -0,0 +1,4 @@
+USING: crypto.barrett kernel math namespaces tools.test ;
+
+[ HEX: 1f63edfb7e838622c7412eafaf0439cf0cdf3aae8bdd09e2de69b509a53883a83560d5ce50ea039e4 ] [  HEX: 827c67f31b2b46afa49ed95d7f7a3011e5875f7052d4c55437ce726d3c6ce0dc9c445fda63b6dc4e 16 barrett-mu ] unit-test
+
diff --git a/extra/crypto/barrett/barrett.factor b/extra/crypto/barrett/barrett.factor
new file mode 100644 (file)
index 0000000..55da972
--- /dev/null
@@ -0,0 +1,8 @@
+USING: kernel math math.functions ;
+IN: crypto.barrett
+
+: barrett-mu ( n size -- mu )
+    #! Calculates Barrett's reduction parameter mu
+    #! size = word size in bits (8, 16, 32, 64, ...)
+    over log2 1+ over / 2 * >r 2 swap ^ r> ^ swap / floor ;
+
diff --git a/extra/crypto/blum-blum-shub.factor b/extra/crypto/blum-blum-shub.factor
new file mode 100644 (file)
index 0000000..a1c196d
--- /dev/null
@@ -0,0 +1,36 @@
+USING: kernel math sequences namespaces crypto math-contrib ;
+IN: crypto-internals
+
+! TODO: take (log log M) bits instead of 1 bit
+! Blum Blum Shub, M = pq
+TUPLE: bbs x n ;
+
+: generate-bbs-primes ( numbits -- p q )
+    #! two primes congruent to 3 (mod 4)
+    dup [ random-miller-rabin-prime==3(mod4) ] 2apply ;
+
+IN: crypto
+: make-bbs ( numbits -- blum-blum-shub )
+    #! returns a Blum-Blum-Shub tuple
+    generate-bbs-primes * [ find-relative-prime ] keep <bbs> ;
+
+IN: crypto-internals
+SYMBOL: blum-blum-shub 256 make-bbs blum-blum-shub set-global
+
+: next-bbs-bit ( bbs -- bit )
+    #! x = x^2 mod n, return low bit of calculated x
+    [ [ bbs-x ] keep 2 swap bbs-n ^mod ] keep
+    [ set-bbs-x ] keep bbs-x 1 bitand ;
+
+SYMBOL: temp-bbs
+: (bbs-bits) ( numbits bbs -- n )
+    temp-bbs set [ [ temp-bbs get next-bbs-bit ] swap make-bits ] with-scope ;
+
+IN: crypto
+: random-bbs-bits* ( numbits bbs -- n ) (bbs-bits) ;
+: random-bits ( numbits -- n ) blum-blum-shub get (bbs-bits) ;
+: random-bytes ( numbits -- n ) 8 * random-bits ;
+: random ( n -- n )
+    ! #! Cryptographically secure random number using Blum-Blum-Shub 256
+    [ log2 1+ random-bits ] keep dupd >= [ -1 shift ] when ;
+
diff --git a/extra/crypto/common/common-docs.factor b/extra/crypto/common/common-docs.factor
new file mode 100644 (file)
index 0000000..1be85a3
--- /dev/null
@@ -0,0 +1,29 @@
+USING: help.markup help.syntax kernel math sequences quotations
+crypto.common math.private ;
+
+HELP: >32-bit
+{ $values { "x" "an integer" } { "y" "an integer" } }
+{ $description "Used to implement 32-bit integer overflow." } ;
+
+HELP: >64-bit
+{ $values { "x" "an integer" } { "y" "an integer" } }
+{ $description "Used to implement 64-bit integer overflow." } ;
+
+HELP: bitroll
+{ $values { "x" "an integer (input)" } { "s" "an integer (shift)" } { "w" "an integer (wrap)" } { "y" "an integer" } }
+{ $description "Roll n by s bits to the left, wrapping around after w bits." }
+{ $examples
+    { $example "1 -1 32 bitroll .b" "10000000000000000000000000000000" }
+    { $example "HEX: ffff0000 8 32 bitroll .h" "ff0000ff" }
+} ;
+
+
+HELP: hex-string
+{ $values { "seq" "a sequence" } { "str" "a string" } }
+{ $description "Converts a sequence of values from 0-255 to a string of hex numbers from 0-ff." }
+{ $examples
+    { $example "B{ 1 2 3 4 } hex-string print" "01020304" }
+}
+{ $notes "Numbers are zero-padded on the left." } ;
+
+
diff --git a/extra/crypto/common/common.factor b/extra/crypto/common/common.factor
new file mode 100644 (file)
index 0000000..e98f0cd
--- /dev/null
@@ -0,0 +1,78 @@
+USING: arrays kernel io io.binary sbufs splitting strings sequences
+namespaces math math.parser parser hints ;
+IN: crypto.common
+
+: >32-bit ( x -- y ) HEX: ffffffff bitand ; inline
+: >64-bit ( x -- y ) HEX: ffffffffffffffff bitand ; inline
+
+: w+ ( int int -- int ) + >32-bit ; inline
+
+: (nth-int) ( string n -- int )
+    2 shift dup 4 + rot <slice> ; inline
+    
+: nth-int ( string n -- int ) (nth-int) le> ; inline
+    
+: nth-int-be ( string n -- int ) (nth-int) be> ; inline
+
+: update ( num var -- ) [ w+ ] change ; inline
+    
+: calculate-pad-length ( length -- pad-length )
+    dup 56 < 55 119 ? swap - ;
+
+: preprocess-plaintext ( string big-endian? -- padded-string )
+    #! pad 0x80 then 00 til 8 bytes left, then 64bit length in bits
+    >r >sbuf r> over [
+        HEX: 80 ,
+        dup length HEX: 3f bitand
+        calculate-pad-length 0 <string> %
+        length 3 shift 8 rot [ >be ] [ >le ] if %
+    ] "" make over push-all ;
+
+SYMBOL: bytes-read
+SYMBOL: big-endian?
+
+: pad-last-block ( str big-endian? length -- str )
+    [
+        rot %
+        HEX: 80 ,
+        dup HEX: 3f bitand calculate-pad-length 0 <string> %
+        3 shift 8 rot [ >be ] [ >le ] if %
+    ] "" make 64 group ;
+
+: shift-mod ( n s w -- n )
+    >r shift r> 1 swap shift 1 - bitand ; inline
+
+: update-old-new ( old new -- )
+    [ get >r get r> ] 2keep >r >r w+ dup r> set r> set ; inline
+
+: bitroll ( x s w -- y )
+     [ 1 - bitand ] keep
+     over 0 < [ [ + ] keep ] when
+     [ shift-mod ] 3keep
+     [ - ] keep shift-mod bitor ; inline
+
+: bitroll-32 ( n s -- n' ) 32 bitroll ;
+
+HINTS: bitroll-32 bignum fixnum ;
+
+: bitroll-64 ( n s -- n' ) 64 bitroll ;
+
+HINTS: bitroll-64 bignum fixnum ;
+
+: hex-string ( seq -- str )
+    [ [ >hex 2 48 pad-left % ] each ] "" make ;
+
+: slice3 ( n seq -- a b c ) >r dup 3 + r> <slice> first3 ;
+
+: seq>2seq ( seq -- seq1 seq2 )
+    #! { abcdefgh } -> { aceg } { bdfh }
+    2 group flip dup empty? [ drop { } { } ] [ first2 ] if ;
+
+: 2seq>seq ( seq1 seq2 -- seq )
+    #! { aceg } { bdfh } -> { abcdefgh }
+    swap ! error?
+    [ 2array flip concat ] keep like ;
+
+: mod-nth ( n seq -- elt )
+    #! 5 "abcd" -> b
+    [ length mod ] keep nth ;
diff --git a/extra/crypto/hmac/hmac-tests.factor b/extra/crypto/hmac/hmac-tests.factor
new file mode 100644 (file)
index 0000000..ccb380e
--- /dev/null
@@ -0,0 +1,11 @@
+USING: kernel io strings sequences namespaces math parser crypto.hmac tools.test ;
+IN: temporary
+
+[ "\u0092\u0094rz68\u00bb\u001c\u0013\u00f4\u008e\u00f8\u0015\u008b\u00fc\u009d" ] [ 16 11 <string> "Hi There" string>md5-hmac >string ] unit-test
+[ "u\u000cx>j\u00b0\u00b5\u0003\u00ea\u00a8n1\n]\u00b78" ] [ "Jefe" "what do ya want for nothing?" string>md5-hmac >string ] unit-test
+[ "V\u00be4R\u001d\u0014L\u0088\u00db\u00b8\u00c73\u00f0\u00e8\u00b3\u00f6" ] [ 16 HEX: aa <string> 50 HEX: dd <string> string>md5-hmac >string ] unit-test
+
+[ "g[\u000b:\eM\u00dfN\u0012Hr\u00dal/c+\u00fe\u00d9W\u00e9" ] [ 16 11 <string> "Hi There" string>sha1-hmac >string ] unit-test
+[ "\u00ef\u00fc\u00dfj\u00e5\u00eb/\u00a2\u00d2t\u0016\u00d5\u00f1\u0084\u00df\u009c%\u009a|y" ] [ "Jefe" "what do ya want for nothing?" string>sha1-hmac >string ] unit-test
+[ "\u00d70YM\u0016~5\u00d5\u0095o\u00d8\0=\r\u00b3\u00d3\u00f4m\u00c7\u00bb" ] [ 16 HEX: aa <string> 50 HEX: dd <string> string>sha1-hmac >string ] unit-test
+
diff --git a/extra/crypto/hmac/hmac.factor b/extra/crypto/hmac/hmac.factor
new file mode 100644 (file)
index 0000000..7c358a8
--- /dev/null
@@ -0,0 +1,49 @@
+USING: arrays combinators crypto.common crypto.md5 crypto.sha1
+crypto.md5.private io io.binary io.files io.streams.string
+kernel math math.vectors memoize sequences ;
+IN: crypto.hmac
+
+: sha1-hmac ( Ko Ki -- hmac )
+    initialize-sha1 process-sha1-block
+    (stream>sha1) get-sha1
+    initialize-sha1
+    >r process-sha1-block r>
+    process-sha1-block get-sha1 ;
+
+: md5-hmac ( Ko Ki -- hmac )
+    initialize-md5 process-md5-block
+    (stream>md5) get-md5
+    initialize-md5
+    >r process-md5-block r>
+    process-md5-block get-md5 ;
+
+: seq-bitxor ( seq seq -- seq )
+    [ bitxor ] 2map ;
+
+MEMO: ipad ( -- seq ) 64 HEX: 36 <array> ;
+MEMO: opad ( -- seq ) 64 HEX: 5c <array> ;
+
+: init-hmac ( K -- o i )
+    64 0 pad-right 
+    [ opad seq-bitxor ] keep
+    ipad seq-bitxor ;
+
+: stream>sha1-hmac ( K stream -- hmac )
+    [ init-hmac sha1-hmac ] with-stream ;
+
+: file>sha1-hmac ( K path -- hmac )
+    <file-reader> stream>sha1-hmac ;
+
+: string>sha1-hmac ( K string -- hmac )
+    <string-reader> stream>sha1-hmac ;
+
+
+: stream>md5-hmac ( K stream -- hmac )
+    [ init-hmac md5-hmac ] with-stream ;
+
+: file>md5-hmac ( K path -- hmac )
+    <file-reader> stream>md5-hmac ;
+
+: string>md5-hmac ( K string -- hmac )
+    <string-reader> stream>md5-hmac ;
+
diff --git a/extra/crypto/md5/md5-docs.factor b/extra/crypto/md5/md5-docs.factor
new file mode 100644 (file)
index 0000000..53c7375
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax kernel math sequences quotations
+crypto.common crypto.md5 ;
+
+HELP: stream>md5
+{ $values { "stream" "a stream" } { "byte-array" "md5 hash" } }
+{ $description "Take the MD5 hash until end of stream." }
+{ $notes "Used to implement " { $link string>md5 } " and " { $link file>md5 } ".  Call " { $link hex-string } " to convert to the canonical string representation." } ;
+
+HELP: string>md5
+{ $values { "string" "a string" } { "byte-array" "byte-array md5 hash" } }
+{ $description "Outputs the MD5 hash of a string." }
+{ $notes "Call " { $link hex-string } " to convert to the canonical string representation." } ;
+
+HELP: file>md5
+{ $values { "path" "a path" } { "byte-array" "byte-array md5 hash" } }
+{ $description "Outputs the MD5 hash of a file." }
+{ $notes "Call " { $link hex-string } " to convert to the canonical string representation." } ;
diff --git a/extra/crypto/md5/md5-tests.factor b/extra/crypto/md5/md5-tests.factor
new file mode 100644 (file)
index 0000000..9a361eb
--- /dev/null
@@ -0,0 +1,10 @@
+USING: kernel math namespaces crypto.md5 tools.test ;
+
+[ "d41d8cd98f00b204e9800998ecf8427e" ] [ "" string>md5str ] unit-test
+[ "0cc175b9c0f1b6a831c399e269772661" ] [ "a" string>md5str ] unit-test
+[ "900150983cd24fb0d6963f7d28e17f72" ] [ "abc" string>md5str ] unit-test
+[ "f96b697d7cb7938d525a2f31aaf161d0" ] [ "message digest" string>md5str ] unit-test
+[ "c3fcd3d76192e4007dfb496cca67e13b" ] [ "abcdefghijklmnopqrstuvwxyz" string>md5str ] unit-test
+[ "d174ab98d277d9f5a5611c2c9f419d9f" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" string>md5str ] unit-test
+[ "57edf4a22be3c955ac49da2e2107b67a" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" string>md5str ] unit-test
+
diff --git a/extra/crypto/md5/md5.factor b/extra/crypto/md5/md5.factor
new file mode 100644 (file)
index 0000000..c95b3f4
--- /dev/null
@@ -0,0 +1,190 @@
+! See http://www.faqs.org/rfcs/rfc1321.html
+
+USING: kernel io io.binary io.files io.streams.string math
+math.functions math.parser namespaces splitting strings
+sequences crypto.common byte-arrays locals sequences.private ;
+IN: crypto.md5
+
+<PRIVATE
+
+SYMBOL: a
+SYMBOL: b
+SYMBOL: c
+SYMBOL: d
+SYMBOL: old-a
+SYMBOL: old-b
+SYMBOL: old-c
+SYMBOL: old-d
+
+: T ( N -- Y )
+    sin abs 4294967296 * >bignum ; foldable
+
+: initialize-md5 ( -- )
+    0 bytes-read set
+    HEX: 67452301 dup a set old-a set
+    HEX: efcdab89 dup b set old-b set
+    HEX: 98badcfe dup c set old-c set
+    HEX: 10325476 dup d set old-d set ;
+
+: update-md ( -- )
+    old-a a update-old-new
+    old-b b update-old-new
+    old-c c update-old-new
+    old-d d update-old-new ;
+
+:: (ABCD) | x s i k func a b c d |
+    #! a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s)
+    a [
+        b get c get d get func call w+
+        k x nth-unsafe w+
+        i T w+
+        s bitroll-32
+        b get w+
+    ] change ; inline
+
+: ABCD a b c d (ABCD) ; inline
+: BCDA b c d a (ABCD) ; inline
+: CDAB c d a b (ABCD) ; inline
+: DABC d a b c (ABCD) ; inline
+
+: F ( X Y Z -- FXYZ )
+    #! F(X,Y,Z) = XY v not(X) Z
+    pick bitnot bitand >r bitand r> bitor ;
+
+: G ( X Y Z -- GXYZ )
+    #! G(X,Y,Z) = XZ v Y not(Z)
+    dup bitnot rot bitand >r bitand r> bitor ;
+
+: H ( X Y Z -- HXYZ )
+    #! H(X,Y,Z) = X xor Y xor Z
+    bitxor bitxor ;
+
+: I ( X Y Z -- IXYZ )
+    #! I(X,Y,Z) = Y xor (X v not(Z))
+    rot swap bitnot bitor bitxor ;
+
+: S11 7  ; inline
+: S12 12 ; inline
+: S13 17 ; inline
+: S14 22 ; inline
+: S21 5  ; inline
+: S22 9  ; inline
+: S23 14 ; inline
+: S24 20 ; inline
+: S31 4 ;  inline
+: S32 11 ; inline
+: S33 16 ; inline
+: S34 23 ; inline
+: S41 6  ; inline
+: S42 10 ; inline
+: S43 15 ; inline
+: S44 21 ; inline
+
+: (process-md5-block-F)
+    dup S11 1  0  [ F ] ABCD
+    dup S12 2  1  [ F ] DABC
+    dup S13 3  2  [ F ] CDAB
+    dup S14 4  3  [ F ] BCDA
+    dup S11 5  4  [ F ] ABCD
+    dup S12 6  5  [ F ] DABC
+    dup S13 7  6  [ F ] CDAB
+    dup S14 8  7  [ F ] BCDA
+    dup S11 9  8  [ F ] ABCD
+    dup S12 10 9  [ F ] DABC
+    dup S13 11 10 [ F ] CDAB
+    dup S14 12 11 [ F ] BCDA
+    dup S11 13 12 [ F ] ABCD
+    dup S12 14 13 [ F ] DABC
+    dup S13 15 14 [ F ] CDAB
+    dup S14 16 15 [ F ] BCDA ;
+
+: (process-md5-block-G)
+    dup S21 17 1  [ G ] ABCD
+    dup S22 18 6  [ G ] DABC
+    dup S23 19 11 [ G ] CDAB
+    dup S24 20 0  [ G ] BCDA
+    dup S21 21 5  [ G ] ABCD
+    dup S22 22 10 [ G ] DABC
+    dup S23 23 15 [ G ] CDAB
+    dup S24 24 4  [ G ] BCDA
+    dup S21 25 9  [ G ] ABCD
+    dup S22 26 14 [ G ] DABC
+    dup S23 27 3  [ G ] CDAB
+    dup S24 28 8  [ G ] BCDA
+    dup S21 29 13 [ G ] ABCD
+    dup S22 30 2  [ G ] DABC
+    dup S23 31 7  [ G ] CDAB
+    dup S24 32 12 [ G ] BCDA ;
+
+: (process-md5-block-H)
+    dup S31 33 5  [ H ] ABCD
+    dup S32 34 8  [ H ] DABC
+    dup S33 35 11 [ H ] CDAB
+    dup S34 36 14 [ H ] BCDA
+    dup S31 37 1  [ H ] ABCD
+    dup S32 38 4  [ H ] DABC
+    dup S33 39 7  [ H ] CDAB
+    dup S34 40 10 [ H ] BCDA
+    dup S31 41 13 [ H ] ABCD
+    dup S32 42 0  [ H ] DABC
+    dup S33 43 3  [ H ] CDAB
+    dup S34 44 6  [ H ] BCDA
+    dup S31 45 9  [ H ] ABCD
+    dup S32 46 12 [ H ] DABC
+    dup S33 47 15 [ H ] CDAB
+    dup S34 48 2  [ H ] BCDA ;
+
+: (process-md5-block-I)
+    dup S41 49 0  [ I ] ABCD
+    dup S42 50 7  [ I ] DABC
+    dup S43 51 14 [ I ] CDAB
+    dup S44 52 5  [ I ] BCDA
+    dup S41 53 12 [ I ] ABCD
+    dup S42 54 3  [ I ] DABC
+    dup S43 55 10 [ I ] CDAB
+    dup S44 56 1  [ I ] BCDA
+    dup S41 57 8  [ I ] ABCD
+    dup S42 58 15 [ I ] DABC
+    dup S43 59 6  [ I ] CDAB
+    dup S44 60 13 [ I ] BCDA
+    dup S41 61 4  [ I ] ABCD
+    dup S42 62 11 [ I ] DABC
+    dup S43 63 2  [ I ] CDAB
+    dup S44 64 9  [ I ] BCDA ;
+
+: (process-md5-block) ( block -- )
+    4 group [ le> ] map
+
+    (process-md5-block-F)
+    (process-md5-block-G)
+    (process-md5-block-H)
+    (process-md5-block-I)
+
+    drop
+
+    update-md ;
+
+: process-md5-block ( str -- )
+    dup length [ bytes-read [ + ] change ] keep 64 = [
+        (process-md5-block)
+    ] [
+        f bytes-read get pad-last-block
+        [ (process-md5-block) ] each
+    ] if ;
+    
+: (stream>md5) ( -- )
+    64 read [ process-md5-block ] keep
+    length 64 = [ (stream>md5) ] when ;
+
+: get-md5 ( -- str )
+    [ a b c d ] [ get 4 >le ] map concat >byte-array ;
+
+PRIVATE>
+
+: stream>md5 ( stream -- byte-array )
+    [ initialize-md5 (stream>md5) get-md5 ] with-stream ;
+
+: string>md5 ( string -- byte-array ) <string-reader> stream>md5 ;
+: string>md5str ( string -- md5-string ) string>md5 hex-string ;
+: file>md5 ( path -- byte-array ) <file-reader> stream>md5 ;
+: file>md5str ( path -- md5-string ) file>md5 hex-string ;
diff --git a/extra/crypto/random.factor b/extra/crypto/random.factor
new file mode 100644 (file)
index 0000000..74dd2db
--- /dev/null
@@ -0,0 +1,40 @@
+USING: kernel math math-contrib sequences namespaces errors
+hashtables words arrays parser compiler syntax io threads ;
+IN: crypto
+: make-bits ( quot numbits -- n | quot: -- 0/1 )
+    0 -rot [ drop dup call rot 1 shift bitor swap ] each drop ;
+
+: random-bytes ( m -- n )
+    >r [ 2 random ] r> 8 * make-bits ;
+
+! DEFER: random-bits
+: add-bit ( bit integer -- integer ) 1 shift bitor ;
+: append-bits ( inta intb nbits -- int ) swapd shift bitor ;
+: large-random-bits ( n -- int )
+    #! random number with high bit and low bit enabled (odd)
+    2 swap ^ [ random ] keep -1 shift 1 bitor bitor ;
+! : next-double ( -- f ) 53 random-bits 9007199254740992 /f ;
+
+: 0count ( integer -- n ) 0 swap [ 0 = [ 1+ ] when ] each-bit ;
+: 1count ( integer -- n ) 0 swap [ 1 = [ 1+ ] when ] each-bit ;
+
+: bit-reverse-table
+{
+    HEX: 00 HEX: 80 HEX: 40 HEX: C0 HEX: 20 HEX: A0 HEX: 60 HEX: E0 HEX: 10 HEX: 90 HEX: 50 HEX: D0 HEX: 30 HEX: B0 HEX: 70 HEX: F0 
+    HEX: 08 HEX: 88 HEX: 48 HEX: C8 HEX: 28 HEX: A8 HEX: 68 HEX: E8 HEX: 18 HEX: 98 HEX: 58 HEX: D8 HEX: 38 HEX: B8 HEX: 78 HEX: F8 
+    HEX: 04 HEX: 84 HEX: 44 HEX: C4 HEX: 24 HEX: A4 HEX: 64 HEX: E4 HEX: 14 HEX: 94 HEX: 54 HEX: D4 HEX: 34 HEX: B4 HEX: 74 HEX: F4 
+    HEX: 0C HEX: 8C HEX: 4C HEX: CC HEX: 2C HEX: AC HEX: 6C HEX: EC HEX: 1C HEX: 9C HEX: 5C HEX: DC HEX: 3C HEX: BC HEX: 7C HEX: FC 
+    HEX: 02 HEX: 82 HEX: 42 HEX: C2 HEX: 22 HEX: A2 HEX: 62 HEX: E2 HEX: 12 HEX: 92 HEX: 52 HEX: D2 HEX: 32 HEX: B2 HEX: 72 HEX: F2 
+    HEX: 0A HEX: 8A HEX: 4A HEX: CA HEX: 2A HEX: AA HEX: 6A HEX: EA HEX: 1A HEX: 9A HEX: 5A HEX: DA HEX: 3A HEX: BA HEX: 7A HEX: FA
+    HEX: 06 HEX: 86 HEX: 46 HEX: C6 HEX: 26 HEX: A6 HEX: 66 HEX: E6 HEX: 16 HEX: 96 HEX: 56 HEX: D6 HEX: 36 HEX: B6 HEX: 76 HEX: F6 
+    HEX: 0E HEX: 8E HEX: 4E HEX: CE HEX: 2E HEX: AE HEX: 6E HEX: EE HEX: 1E HEX: 9E HEX: 5E HEX: DE HEX: 3E HEX: BE HEX: 7E HEX: FE
+    HEX: 01 HEX: 81 HEX: 41 HEX: C1 HEX: 21 HEX: A1 HEX: 61 HEX: E1 HEX: 11 HEX: 91 HEX: 51 HEX: D1 HEX: 31 HEX: B1 HEX: 71 HEX: F1
+    HEX: 09 HEX: 89 HEX: 49 HEX: C9 HEX: 29 HEX: A9 HEX: 69 HEX: E9 HEX: 19 HEX: 99 HEX: 59 HEX: D9 HEX: 39 HEX: B9 HEX: 79 HEX: F9 
+    HEX: 05 HEX: 85 HEX: 45 HEX: C5 HEX: 25 HEX: A5 HEX: 65 HEX: E5 HEX: 15 HEX: 95 HEX: 55 HEX: D5 HEX: 35 HEX: B5 HEX: 75 HEX: F5
+    HEX: 0D HEX: 8D HEX: 4D HEX: CD HEX: 2D HEX: AD HEX: 6D HEX: ED HEX: 1D HEX: 9D HEX: 5D HEX: DD HEX: 3D HEX: BD HEX: 7D HEX: FD
+    HEX: 03 HEX: 83 HEX: 43 HEX: C3 HEX: 23 HEX: A3 HEX: 63 HEX: E3 HEX: 13 HEX: 93 HEX: 53 HEX: D3 HEX: 33 HEX: B3 HEX: 73 HEX: F3 
+    HEX: 0B HEX: 8B HEX: 4B HEX: CB HEX: 2B HEX: AB HEX: 6B HEX: EB HEX: 1B HEX: 9B HEX: 5B HEX: DB HEX: 3B HEX: BB HEX: 7B HEX: FB
+    HEX: 07 HEX: 87 HEX: 47 HEX: C7 HEX: 27 HEX: A7 HEX: 67 HEX: E7 HEX: 17 HEX: 97 HEX: 57 HEX: D7 HEX: 37 HEX: B7 HEX: 77 HEX: F7 
+    HEX: 0F HEX: 8F HEX: 4F HEX: CF HEX: 2F HEX: AF HEX: 6F HEX: EF HEX: 1F HEX: 9F HEX: 5F HEX: DF HEX: 3F HEX: BF HEX: 7F HEX: FF
+} ; inline
+
diff --git a/extra/crypto/rc4.factor b/extra/crypto/rc4.factor
new file mode 100644 (file)
index 0000000..24f5231
--- /dev/null
@@ -0,0 +1,36 @@
+USING: kernel math sequences namespaces math-contrib ;
+IN: crypto-internals
+
+! http://en.wikipedia.org/wiki/RC4_%28cipher%29
+
+SYMBOL: i
+SYMBOL: j
+SYMBOL: s
+SYMBOL: key
+SYMBOL: l
+
+
+! key scheduling algorithm, initialize s
+: ksa ( -- )
+    256 [ ] map s set
+    0 j set
+    256 [
+        dup s get nth j get + over l get mod key get nth + 255 bitand j set
+        dup j get s get exchange
+    ] repeat ;
+
+: generate ( -- n )
+    i get 1+ 255 bitand i set
+    j get i get s get nth + 255 bitand j set
+    i get j get s get exchange
+    i get s get nth j get s get nth + 255 bitand s get nth ;
+
+IN: crypto
+
+: rc4 ( key -- )
+    [ key set ] keep
+    length l set
+    ksa
+    0 i set
+    0 j set ;
+
diff --git a/extra/crypto/rsa.factor b/extra/crypto/rsa.factor
new file mode 100644 (file)
index 0000000..e082e43
--- /dev/null
@@ -0,0 +1,26 @@
+USING: kernel math namespaces math-contrib errors ;
+
+IN: crypto
+SYMBOL: d
+SYMBOL: p
+SYMBOL: q
+SYMBOL: n
+SYMBOL: m
+SYMBOL: ee
+
+! e = public key, d = private key, n = public modulus
+TUPLE: rsa e d n ;
+
+! n bits
+: generate-rsa-keypair ( bitlen -- <rsa> )
+    [
+        2 /i generate-two-unique-primes [ q set p set ] 2keep [ * n set ] 2keep
+        [ 1- ] 2apply * m set
+        65537 ee set
+        m get ee get mod-inv m get + d set
+        ee get d get n get <rsa>
+    ] with-scope ;
+
+: rsa-encrypt ( message rsa -- encrypted ) [ rsa-e ] keep rsa-n ^mod ;
+: rsa-decrypt ( encrypted rsa -- message ) [ rsa-d ] keep rsa-n ^mod ;
+
diff --git a/extra/crypto/rsa/rsa-tests.factor b/extra/crypto/rsa/rsa-tests.factor
new file mode 100644 (file)
index 0000000..10ff28a
--- /dev/null
@@ -0,0 +1,7 @@
+USING: kernel math namespaces crypto.rsa tools.test ;
+
+[ 123456789 ] [ 128 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+[ 123456789 ] [ 129 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+[ 123456789 ] [ 130 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+[ 123 ] [ 17 2753 3233 <rsa> 123 over rsa-encrypt swap rsa-decrypt ] unit-test
+
diff --git a/extra/crypto/rsa/rsa.factor b/extra/crypto/rsa/rsa.factor
new file mode 100644 (file)
index 0000000..ad5822b
--- /dev/null
@@ -0,0 +1,29 @@
+USING: math.miller-rabin kernel math math.functions namespaces
+sequences ;
+IN: crypto.rsa
+
+SYMBOL: d
+SYMBOL: p
+SYMBOL: q
+SYMBOL: n
+SYMBOL: m
+SYMBOL: ee
+
+! e = public key, d = private key, n = public modulus
+TUPLE: rsa e d n ;
+
+C: <rsa> rsa
+
+! n bits
+: generate-rsa-keypair ( numbits -- <rsa> )
+    [
+        2 /i 2 unique-primes first2 [ q set p set ] 2keep [ * n set ] 2keep
+        [ 1- ] 2apply * m set
+        65537 ee set
+        m get ee get mod-inv m get + d set
+        ee get d get n get <rsa>
+    ] with-scope ;
+
+: rsa-encrypt ( message rsa -- encrypted ) [ rsa-e ] keep rsa-n ^mod ;
+: rsa-decrypt ( encrypted rsa -- message ) [ rsa-d ] keep rsa-n ^mod ;
+
diff --git a/extra/crypto/sha1/sha1-tests.factor b/extra/crypto/sha1/sha1-tests.factor
new file mode 100644 (file)
index 0000000..c4f0680
--- /dev/null
@@ -0,0 +1,14 @@
+USING: arrays kernel math namespaces sequences tools.test crypto.sha1 ;
+
+[ "a9993e364706816aba3e25717850c26c9cd0d89d" ] [ "abc" string>sha1str ] unit-test
+[ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" ] [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" string>sha1str ] unit-test
+! [ "34aa973cd4c4daa4f61eeb2bdbad27316534016f" ] [ 1000000 CHAR: a fill string>sha1str ] unit-test ! takes a long time...
+[ "dea356a2cddd90c7a7ecedc5ebb563934f460452" ] [ "0123456701234567012345670123456701234567012345670123456701234567"
+10 swap <array> concat string>sha1str ] unit-test
+
+[
+    ";\u009b\u00fd\u00cdK\u00a3^s\u00d0*\u00e3\\\u00b5\u0013<\u00e8wA\u00b2\u0083\u00d20\u00f1\u00e6\u00cc\u00d8\u001e\u009c\u0004\u00d7PT]\u00ce,\u0001\u0012\u0080\u0096\u0099"
+] [
+    "\u0066\u0053\u00f1\u000c\u001a\u00fa\u00b5\u004c\u0061\u00c8\u0025\u0075\u00a8\u004a\u00fe\u0030\u00d8\u00aa\u001a\u003a\u0096\u0096\u00b3\u0018\u0099\u0092\u00bf\u00e1\u00cb\u007f\u00a6\u00a7"
+    string>sha1-interleave
+] unit-test
diff --git a/extra/crypto/sha1/sha1.factor b/extra/crypto/sha1/sha1.factor
new file mode 100644 (file)
index 0000000..3497e33
--- /dev/null
@@ -0,0 +1,133 @@
+USING: arrays combinators crypto.common kernel io io.binary
+io.files io.streams.string math.vectors strings sequences
+namespaces math parser sequences vectors
+hashtables ;
+IN: crypto.sha1
+
+! Implemented according to RFC 3174.
+
+SYMBOL: h0
+SYMBOL: h1
+SYMBOL: h2
+SYMBOL: h3
+SYMBOL: h4
+SYMBOL: A
+SYMBOL: B
+SYMBOL: C
+SYMBOL: D
+SYMBOL: E
+SYMBOL: w
+SYMBOL: K
+
+: get-wth ( n -- wth ) w get nth ; inline
+: shift-wth ( n -- x ) get-wth 1 bitroll-32 ; inline
+
+: initialize-sha1 ( -- )
+    0 bytes-read set
+    HEX: 67452301 dup h0 set A set
+    HEX: efcdab89 dup h1 set B set
+    HEX: 98badcfe dup h2 set C set
+    HEX: 10325476 dup h3 set D set
+    HEX: c3d2e1f0 dup h4 set E set
+    [
+        20 HEX: 5a827999 <array> %
+        20 HEX: 6ed9eba1 <array> %
+        20 HEX: 8f1bbcdc <array> %
+        20 HEX: ca62c1d6 <array> %
+    ] { } make K set ;
+
+! W(t) = S^1(W(t-3) XOR W(t-8) XOR W(t-14) XOR W(t-16))
+: sha1-W ( t -- W_t )
+     dup 3 - get-wth
+     over 8 - get-wth bitxor
+     over 14 - get-wth bitxor
+     swap 16 - get-wth bitxor 1 bitroll-32 ;
+
+! f(t;B,C,D) = (B AND C) OR ((NOT B) AND D)         ( 0 <= t <= 19)
+! f(t;B,C,D) = B XOR C XOR D                        (20 <= t <= 39)
+! f(t;B,C,D) = (B AND C) OR (B AND D) OR (C AND D)  (40 <= t <= 59)
+! f(t;B,C,D) = B XOR C XOR D                        (60 <= t <= 79)
+: sha1-f ( B C D t -- f_tbcd )
+    #! Maybe use dispatch
+    20 /i
+    {   
+        { [ dup 0 = ] [ drop >r over bitnot r> bitand >r bitand r> bitor ] }
+        { [ dup 1 = ] [ drop bitxor bitxor ] }
+        { [ dup 2 = ] [ drop 2dup bitand >r pick bitand >r bitand r> r> bitor bitor ] }
+        { [ dup 3 = ] [ drop bitxor bitxor ] }
+    } cond ;
+
+: make-w ( str -- )
+    #! compute w, steps a-b of RFC 3174, section 6.1
+    16 [ nth-int-be w get push ] curry* each
+    16 80 dup <slice> [ sha1-W w get push ] each ;
+
+: init-letters ( -- )
+    ! step c of RFC 3174, section 6.1
+    h0 get A set
+    h1 get B set
+    h2 get C set
+    h3 get D set
+    h4 get E set ;
+
+: inner-loop ( n -- temp )
+    ! TEMP = S^5(A) + f(t;B,C,D) + E + W(t) + K(t);
+    [
+        [ B get C get D get ] keep sha1-f ,
+        dup get-wth ,
+        K get nth ,
+        A get 5 bitroll-32 ,
+        E get ,
+    ] { } make sum 4294967295 bitand ; inline
+
+: set-vars ( temp -- )
+    ! E = D;  D = C;  C = S^30(B);  B = A; A = TEMP;
+    D get E set
+    C get D set
+    B get 30 bitroll-32 C set
+    A get B set
+    A set ;
+
+: calculate-letters ( -- )
+    ! step d of RFC 3174, section 6.1
+    80 [ inner-loop set-vars ] each ;
+
+: update-hs ( -- )
+    ! step e of RFC 3174, section 6.1
+    A h0 update-old-new
+    B h1 update-old-new
+    C h2 update-old-new
+    D h3 update-old-new
+    E h4 update-old-new ;
+
+: (process-sha1-block) ( str -- )
+    80 <vector> w set make-w init-letters calculate-letters update-hs ;
+
+: process-sha1-block ( str -- )
+    dup length [ bytes-read [ + ] change ] keep 64 = [
+        (process-sha1-block)
+    ] [
+        t bytes-read get pad-last-block
+        [ (process-sha1-block) ] each
+    ] if ;
+
+: (stream>sha1) ( -- )
+    64 read [ process-sha1-block ] keep
+    length 64 = [ (stream>sha1) ] when ;
+
+: get-sha1 ( -- str )
+    [ [ h0 h1 h2 h3 h4 ] [ get 4 >be % ] each ] "" make ;
+
+: stream>sha1 ( stream -- sha1 )
+    [ [ initialize-sha1 (stream>sha1) get-sha1 ] with-stream ] with-scope ;
+
+: string>sha1 ( string -- sha1 ) <string-reader> stream>sha1 ;
+: string>sha1str ( string -- str ) string>sha1 hex-string ;
+: string>sha1-bignum ( string -- n ) string>sha1 be> ;
+: file>sha1 ( file -- sha1 ) <file-reader> stream>sha1 ;
+
+: string>sha1-interleave ( string -- )
+    [ zero? ] ltrim
+    dup length odd? [ 1 tail ] when
+    seq>2seq [ string>sha1 ] 2apply
+    swap 2seq>seq ;
diff --git a/extra/crypto/sha2/sha2-tests.factor b/extra/crypto/sha2/sha2-tests.factor
new file mode 100644 (file)
index 0000000..25da4e1
--- /dev/null
@@ -0,0 +1,7 @@
+USING: arrays kernel math namespaces sequences tools.test crypto.sha2 ;
+[ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ] [ "" string>sha-256-string ] unit-test
+[ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ] [ "abc" string>sha-256-string ] unit-test
+[ "f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650" ] [ "message digest" string>sha-256-string ] unit-test
+[ "71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73" ] [ "abcdefghijklmnopqrstuvwxyz" string>sha-256-string ] unit-test
+[ "db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" string>sha-256-string ] unit-test
+[ "f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" string>sha-256-string ] unit-test
diff --git a/extra/crypto/sha2/sha2.factor b/extra/crypto/sha2/sha2.factor
new file mode 100644 (file)
index 0000000..dd72bfc
--- /dev/null
@@ -0,0 +1,142 @@
+USING: crypto.common kernel splitting math sequences namespaces
+io.binary ;
+IN: crypto.sha2
+
+<PRIVATE
+
+SYMBOL: vars
+SYMBOL: M
+SYMBOL: K
+SYMBOL: H
+SYMBOL: S0
+SYMBOL: S1
+SYMBOL: process-M
+SYMBOL: word-size
+SYMBOL: block-size
+SYMBOL: >word
+
+: a 0 ;
+: b 1 ;
+: c 2 ;
+: d 3 ;
+: e 4 ;
+: f 5 ;
+: g 6 ;
+: h 7 ;
+
+: initial-H-256 ( -- seq )
+    {
+        HEX: 6a09e667 HEX: bb67ae85 HEX: 3c6ef372 HEX: a54ff53a
+        HEX: 510e527f HEX: 9b05688c HEX: 1f83d9ab HEX: 5be0cd19
+    } ;
+
+: K-256 ( -- seq )
+    {
+        HEX: 428a2f98 HEX: 71374491 HEX: b5c0fbcf HEX: e9b5dba5
+        HEX: 3956c25b HEX: 59f111f1 HEX: 923f82a4 HEX: ab1c5ed5
+        HEX: d807aa98 HEX: 12835b01 HEX: 243185be HEX: 550c7dc3
+        HEX: 72be5d74 HEX: 80deb1fe HEX: 9bdc06a7 HEX: c19bf174
+        HEX: e49b69c1 HEX: efbe4786 HEX: 0fc19dc6 HEX: 240ca1cc
+        HEX: 2de92c6f HEX: 4a7484aa HEX: 5cb0a9dc HEX: 76f988da
+        HEX: 983e5152 HEX: a831c66d HEX: b00327c8 HEX: bf597fc7
+        HEX: c6e00bf3 HEX: d5a79147 HEX: 06ca6351 HEX: 14292967
+        HEX: 27b70a85 HEX: 2e1b2138 HEX: 4d2c6dfc HEX: 53380d13
+        HEX: 650a7354 HEX: 766a0abb HEX: 81c2c92e HEX: 92722c85
+        HEX: a2bfe8a1 HEX: a81a664b HEX: c24b8b70 HEX: c76c51a3
+        HEX: d192e819 HEX: d6990624 HEX: f40e3585 HEX: 106aa070
+        HEX: 19a4c116 HEX: 1e376c08 HEX: 2748774c HEX: 34b0bcb5
+        HEX: 391c0cb3 HEX: 4ed8aa4a HEX: 5b9cca4f HEX: 682e6ff3
+        HEX: 748f82ee HEX: 78a5636f HEX: 84c87814 HEX: 8cc70208
+        HEX: 90befffa HEX: a4506ceb HEX: bef9a3f7 HEX: c67178f2
+    } ;
+
+: s0-256 ( x -- x' )
+    [ -7 bitroll-32 ] keep
+    [ -18 bitroll-32 ] keep
+    -3 shift bitxor bitxor ; inline
+
+: s1-256 ( x -- x' )
+    [ -17 bitroll-32 ] keep
+    [ -19 bitroll-32 ] keep
+    -10 shift bitxor bitxor ; inline
+
+: process-M-256 ( seq n -- )
+    [ 16 - swap nth ] 2keep
+    [ 15 - swap nth s0-256 ] 2keep
+    [ 7 - swap nth ] 2keep
+    [ 2 - swap nth s1-256 ] 2keep
+    >r >r + + w+ r> r> swap set-nth ; inline
+
+: prepare-message-schedule ( seq -- w-seq )
+    word-size get group [ be> ] map block-size get 0 pad-right
+    dup 16 64 dup <slice> [
+        process-M-256
+    ] curry* each ;
+
+: ch ( x y z -- x' )
+    [ bitxor bitand ] keep bitxor ;
+
+: maj ( x y z -- x' )
+    >r [ bitand ] 2keep bitor r> bitand bitor ;
+
+: S0-256 ( x -- x' )
+    [ -2 bitroll-32 ] keep
+    [ -13 bitroll-32 ] keep
+    -22 bitroll-32 bitxor bitxor ; inline
+
+: S1-256 ( x -- x' )
+    [ -6 bitroll-32 ] keep
+    [ -11 bitroll-32 ] keep
+    -25 bitroll-32 bitxor bitxor ; inline
+
+: T1 ( W n -- T1 )
+    [ swap nth ] keep
+    K get nth +
+    e vars get slice3 ch +
+    e vars get nth S1-256 +
+    h vars get nth w+ ;
+
+: T2 ( -- T2 )
+    a vars get nth S0-256
+    a vars get slice3 maj w+ ;
+
+: update-vars ( T1 T2 -- )
+    vars get
+    h g pick exchange
+    g f pick exchange
+    f e pick exchange
+    pick d pick nth w+ e pick set-nth
+    d c pick exchange
+    c b pick exchange
+    b a pick exchange
+    >r w+ a r> set-nth ;
+
+: process-chunk ( M -- )
+    H get clone vars set
+    prepare-message-schedule block-size get [
+        T1 T2 update-vars
+    ] curry* each vars get H get [ w+ ] 2map H set ;
+
+: seq>string ( n seq -- string )
+    [ swap [ >be % ] curry each ] "" make ;
+
+: string>sha2 ( string -- string )
+    t preprocess-plaintext
+    block-size get group [ process-chunk ] each
+    4 H get seq>string ;
+
+PRIVATE>
+
+: string>sha-256 ( string -- string )
+    [
+        K-256 K set
+        initial-H-256 H set
+        4 word-size set
+        64 block-size set
+        \ >32-bit >word set
+        string>sha2
+    ] with-scope ;
+
+: string>sha-256-string ( string -- hexstring )
+    string>sha-256 hex-string ;
+
diff --git a/extra/crypto/summary.txt b/extra/crypto/summary.txt
new file mode 100644 (file)
index 0000000..edd7c44
--- /dev/null
@@ -0,0 +1 @@
+Cryptographic algorithms implemented in Factor, such as MD5 and SHA1
diff --git a/extra/crypto/test/blum-blum-shub.factor b/extra/crypto/test/blum-blum-shub.factor
new file mode 100644 (file)
index 0000000..b1b6034
--- /dev/null
@@ -0,0 +1,5 @@
+USING: kernel math test namespaces crypto crypto-internals ;
+
+[ 6 ] [ 5 T{ bbs f 590695557939 811977232793 } random-bbs-bits* ] unit-test
+[ 792723710536787233474130382522 ] [ 100 T{ bbs f 200352954495 846054538649 } [ random-bbs-bits* drop ] 2keep random-bbs-bits* ] unit-test
+
diff --git a/extra/crypto/test/common.factor b/extra/crypto/test/common.factor
new file mode 100644 (file)
index 0000000..6050454
--- /dev/null
@@ -0,0 +1,15 @@
+USING: kernel math test namespaces crypto ;
+
+[ 0 ] [ 1 0 0 bitroll ] unit-test
+[ 1 ] [ 1 0 1 bitroll ] unit-test
+[ 1 ] [ 1 1 1 bitroll ] unit-test
+[ 1 ] [ 1 0 2 bitroll ] unit-test
+[ 1 ] [ 1 0 1 bitroll ] unit-test
+[ 1 ] [ 1 20 2 bitroll ] unit-test
+[ 1 ] [ 1 8 8 bitroll ] unit-test
+[ 1 ] [ 1 -8 8 bitroll ] unit-test
+[ 1 ] [ 1 -32 8 bitroll ] unit-test
+[ 128 ] [ 1 -1 8 bitroll ] unit-test
+[ 8 ] [ 1 3 32 bitroll ] unit-test
+
+
diff --git a/extra/crypto/test/rsa.factor b/extra/crypto/test/rsa.factor
new file mode 100644 (file)
index 0000000..cddad58
--- /dev/null
@@ -0,0 +1,7 @@
+USING: kernel math test namespaces crypto ;
+
+[ 123456789 ] [ 128 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+[ 123456789 ] [ 129 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+[ 123456789 ] [ 130 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
+[ 123 ] [ 17 2753 3233 <rsa> 123 over rsa-encrypt swap rsa-decrypt ] unit-test
+
diff --git a/extra/crypto/test/xor.factor b/extra/crypto/test/xor.factor
new file mode 100644 (file)
index 0000000..2a77cf0
--- /dev/null
@@ -0,0 +1,23 @@
+USING: crypto errors kernel test strings ;
+
+! No key
+[ T{ no-xor-key f } ] [ [ "" dup xor-crypt ] catch ] unit-test
+[ T{ no-xor-key f } ] [ [ { } dup xor-crypt ] catch ] unit-test
+[ T{ no-xor-key f } ] [ [ V{ } dup xor-crypt ] catch ] unit-test
+[ T{ no-xor-key f } ] [ [ "" "asdf" dupd xor-crypt xor-crypt ] catch ] unit-test
+
+! a xor a = 0
+[ { 0 0 0 0 0 0 0 } ] [ "abcdefg" dup xor-crypt ] unit-test
+
+[ { 15 15 15 15 } ] [ { 10 10 10 10 } { 5 5 5 5 } xor-crypt ] unit-test
+
+[ "asdf" ] [ "key" "asdf" dupd xor-crypt xor-crypt >string ] unit-test
+[ "" ] [ "key" "" xor-crypt >string ] unit-test
+[ "a longer message...!" ] [
+    "."
+    "a longer message...!" dupd xor-crypt xor-crypt >string
+] unit-test
+[ "a longer message...!" ] [
+    "a very long key, longer than the message even."
+    "a longer message...!" dupd xor-crypt xor-crypt >string
+] unit-test
diff --git a/extra/crypto/timing/timing-tests.factor b/extra/crypto/timing/timing-tests.factor
new file mode 100644 (file)
index 0000000..9fafa73
--- /dev/null
@@ -0,0 +1,4 @@
+USING: crypto.timing kernel tools.test ;
+IN: temporary
+
+[ t ] [ millis [ ] 1000 with-timing millis swap - 1000 >= ] unit-test
diff --git a/extra/crypto/timing/timing.factor b/extra/crypto/timing/timing.factor
new file mode 100644 (file)
index 0000000..da2603d
--- /dev/null
@@ -0,0 +1,7 @@
+USING: kernel math threads system ;
+IN: crypto.timing
+
+: with-timing ( ... quot n -- )
+    #! force the quotation to execute in, at minimum, n milliseconds
+    millis 2slip millis - + sleep ;
+
diff --git a/extra/crypto/xor.factor b/extra/crypto/xor.factor
new file mode 100644 (file)
index 0000000..a2b3161
--- /dev/null
@@ -0,0 +1,9 @@
+USING: errors kernel math sequences ;
+IN: crypto
+
+TUPLE: no-xor-key ;
+
+: xor-crypt ( key seq -- seq )
+    over empty? [ <no-xor-key> throw ] when
+    [ length ] keep
+    [ >r over mod-nth r> bitxor ] 2map nip ;
diff --git a/extra/destructors/authors.txt b/extra/destructors/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/destructors/destructors-docs.factor b/extra/destructors/destructors-docs.factor
new file mode 100644 (file)
index 0000000..104641d
--- /dev/null
@@ -0,0 +1,25 @@
+USING: help.markup help.syntax kernel destructors ;
+IN: destructors
+
+HELP: add-destructor
+{ $values { "obj" "an object" }
+          { "quot" "a quotation" }
+          { "always?" "always cleanup?" }
+} { $description "Adds a destructor to be invoked by the " { $link call-destructors } " word to the current dynamic scope.  Setting the 'always cleanup?' flag to f allows for keeping resources, such as a successfully opened file descriptor, open after a call to " { $link with-destructors } "." }
+{ $notes "The use of the " { $link with-destructors } " word is preferred over calling " { $link call-destructors } " manually." $nl
+"Destructors are not allowed to throw exceptions.  No exceptions." }
+{ $see-also call-destructors with-destructors } ;
+
+HELP: call-destructors
+{ $description "Iterates through a sequence of destructor tuples, calling the destructor quotation on each one." }
+{ $notes "The use of the " { $link with-destructors } " word is preferred over calling " { $link call-destructors } " manually." }
+{ $see-also add-destructor with-destructors } ;
+
+HELP: with-destructors
+{ $values { "quot" "a quotation" } }
+{ $description "Calls a quotation within a new dynamic scope.  This quotation may register destructors, on any object, by calling " { $link add-destructor } ".  After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown.  However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." } 
+{ $notes "Destructors are not allowed to throw exceptions.  No exceptions." }
+{ $examples
+    { $code "[ 10 malloc dup [ free \"free 10 bytes\" print ] t add-destructor drop ] with-destructors" }
+}
+{ $see-also add-destructor call-destructors } ;
diff --git a/extra/destructors/destructors-tests.factor b/extra/destructors/destructors-tests.factor
new file mode 100644 (file)
index 0000000..526c672
--- /dev/null
@@ -0,0 +1,40 @@
+USING: destructors kernel tools.test ;
+IN: temporary
+
+TUPLE: dummy-obj destroyed? ;
+
+: <dummy-obj>
+    \ dummy-obj construct-empty ;
+
+[ t ] [
+    [
+        <dummy-obj>
+        dup [ t swap set-dummy-obj-destroyed? ] t add-destructor
+    ] with-destructors dummy-obj-destroyed? 
+] unit-test
+
+[ f ] [
+    [
+        <dummy-obj>
+        dup [ t swap set-dummy-obj-destroyed? ] f add-destructor
+    ] with-destructors dummy-obj-destroyed? 
+] unit-test
+
+[ t ] [
+    <dummy-obj> [
+        [
+            dup [ t swap set-dummy-obj-destroyed? ] t add-destructor
+            "foo" throw
+        ] with-destructors
+    ] catch drop dummy-obj-destroyed? 
+] unit-test
+
+[ t ] [
+    <dummy-obj> [
+        [
+            dup [ t swap set-dummy-obj-destroyed? ] f add-destructor
+            "foo" throw
+        ] with-destructors
+    ] catch drop dummy-obj-destroyed? 
+] unit-test
+
diff --git a/extra/destructors/destructors.factor b/extra/destructors/destructors.factor
new file mode 100644 (file)
index 0000000..a4007bd
--- /dev/null
@@ -0,0 +1,75 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: continuations kernel namespaces sequences vectors ;
+IN: destructors
+
+SYMBOL: destructors
+SYMBOL: errored?
+TUPLE: destructor obj quot always? ;
+
+<PRIVATE
+
+: filter-destructors ( -- )
+    errored? get [
+        destructors [ [ destructor-always? ] subset ] change
+    ] unless ;
+
+PRIVATE>
+
+: add-destructor ( obj quot always? -- )
+    \ destructor construct-boa destructors [ ?push ] change ;
+
+: call-destructors ( -- )
+    destructors get [
+        dup destructor-obj swap destructor-quot call
+    ] each ;
+
+: with-destructors ( quot -- )
+    [
+        [ call ] [ errored? on ] recover
+        filter-destructors call-destructors
+        errored? get [ rethrow ] when
+    ] with-scope ; inline
+
+
+
+! : add-destructor ( word quot -- )
+    ! >quotation
+    ! "slot-destructor" set-word-prop ;
+
+! MACRO: destruct ( class -- )
+    ! "slots" word-prop
+    ! [ slot-spec-reader "slot-destructor" word-prop ] subset
+    ! [
+        ! [
+            ! slot-spec-reader [ 1quotation ] keep
+            ! "slot-destructor" word-prop [ when* ] curry compose
+            ! [ keep f swap ] curry
+        ! ] keep slot-spec-writer 1quotation compose
+        ! dupd curry
+    ! ] map concat nip ;
+
+! : DTOR: scan-word parse-definition add-destructor ; parsing
+
+! : free-destructor ( word -- )
+    ! [ free ] add-destructor ;
+
+! : stream-destructor ( word -- )
+    ! [ stream-close ] add-destructor ;
+
+
+! TUPLE: foo a b c ;
+! C: <foo> foo
+
+! DTOR: foo-a "lol, a destructor" print drop ;
+! DTOR: foo-b "lol, b destructor" print drop ;
+
+! TUPLE: stuff mem stream ;
+! : <stuff>
+    ! 100 malloc
+    ! "license.txt" resource-path <file-reader>
+    ! \ stuff construct-boa ;
+
+! DTOR: stuff-mem free-destructor ;
+! DTOR: stuff-stream stream-destructor ;
+
diff --git a/extra/destructors/summary.txt b/extra/destructors/summary.txt
new file mode 100644 (file)
index 0000000..3ed5042
--- /dev/null
@@ -0,0 +1 @@
+Object destructors
diff --git a/extra/dlists/authors.txt b/extra/dlists/authors.txt
new file mode 100644 (file)
index 0000000..09839c9
--- /dev/null
@@ -0,0 +1 @@
+Mackenzie Straight
diff --git a/extra/dlists/dlists-tests.factor b/extra/dlists/dlists-tests.factor
new file mode 100644 (file)
index 0000000..cdcee84
--- /dev/null
@@ -0,0 +1,54 @@
+IN: temporary
+USING: dlists kernel strings tools.test math ;
+
+[ "junk" ] [ 
+  <dlist> 
+  5 over dlist-push-end 
+  "junk" over dlist-push-end 
+  20 over dlist-push-end 
+  [ string? ] swap dlist-remove 
+] unit-test
+
+[ 5 20 ] [ 
+  <dlist> 
+  5 over dlist-push-end 
+  "junk" over dlist-push-end 
+  20 over dlist-push-end 
+  [ string? ] over dlist-remove drop
+  [ ] dlist-each
+] unit-test
+
+[ "junk" ] [ 
+  <dlist> 
+  5 over dlist-push-end 
+  "junk" over dlist-push-end 
+  20 over dlist-push-end 
+  [ integer? ] over dlist-remove drop
+  [ integer? ] over dlist-remove drop
+  [ ] dlist-each
+] unit-test
+
+[ t ] [ 
+  <dlist> 
+  5 over dlist-push-end 
+  "junk" over dlist-push-end 
+  20 over dlist-push-end 
+  [ string? ] swap dlist-contains?
+] unit-test
+
+[ t ] [ 
+  <dlist> 
+  5 over dlist-push-end 
+  "junk" over dlist-push-end 
+  20 over dlist-push-end 
+  [ integer? ] swap dlist-contains?
+] unit-test
+
+[ f ] [ 
+  <dlist> 
+  5 over dlist-push-end 
+  "junk" over dlist-push-end 
+  20 over dlist-push-end 
+  [ string? ] over dlist-remove drop
+  [ string? ] swap dlist-contains?
+] unit-test
diff --git a/extra/dlists/dlists.factor b/extra/dlists/dlists.factor
new file mode 100644 (file)
index 0000000..9ff7ce5
--- /dev/null
@@ -0,0 +1,100 @@
+! Copyright (C) 2005 Mackenzie Straight.
+! See http://factorcode.org/license.txt for BSD license.
+IN: dlists
+USING: kernel math  ;
+
+! Double-linked lists.
+
+TUPLE: dlist first last ;
+
+: <dlist> dlist construct-empty ;
+
+TUPLE: dlist-node data prev next ;
+
+C: <dlist-node> dlist-node
+
+: dlist-push-end ( data dlist -- )
+    [ dlist-last f <dlist-node> ] keep
+    [ dlist-last [ dupd set-dlist-node-next ] when* ] keep
+    2dup set-dlist-last
+    dup dlist-first [ 2drop ] [ set-dlist-first ] if ;
+
+: dlist-empty? ( dlist -- ? )
+    dlist-first f = ;
+    
+: (unlink-prev) ( dlist dnode -- )
+    dup dlist-node-prev [
+        dupd swap dlist-node-next swap set-dlist-node-next
+    ] when*
+    2dup swap dlist-first eq? [ 
+        dlist-node-next swap set-dlist-first 
+    ] [ 2drop ] if ;
+
+: (unlink-next) ( dlist dnode -- )
+    dup dlist-node-next [
+        dupd swap dlist-node-prev swap set-dlist-node-prev
+    ] when*
+    2dup swap dlist-last eq? [
+        dlist-node-prev swap set-dlist-last
+    ] [ 2drop ] if ;
+
+: (dlist-unlink) ( dlist dnode -- )
+    [ (unlink-prev) ] 2keep (unlink-next) ;
+
+: (dlist-pop-front) ( dlist -- data )
+    [ dlist-first dlist-node-data ] keep dup dlist-first (dlist-unlink) ;
+
+: dlist-pop-front ( dlist -- data )
+    dup dlist-empty? [ drop f ] [ (dlist-pop-front) ] if ;
+
+: (dlist-remove) ( dlist quot dnode -- obj/f )
+    [
+        [ dlist-node-data swap call ] 2keep rot [
+            swapd [ (dlist-unlink) ] keep dlist-node-data nip
+        ] [
+            dlist-node-next (dlist-remove)
+        ] if
+    ] [
+        2drop f
+    ] if* ; inline
+
+: dlist-remove ( quot dlist -- obj/f )
+    #! Return first item in the dlist that when passed to the
+    #! predicate quotation, true is left on the stack. The
+    #! item is removed from the dlist. The quotation
+    #! must have stack effect ( obj -- bool ).
+    #! TODO: needs a better name.
+    dup dlist-first swapd (dlist-remove) ; inline
+
+: (dlist-contains?) ( pred dnode -- bool )
+    [
+        [ dlist-node-data swap call ] 2keep rot [
+            2drop t
+        ] [
+            dlist-node-next (dlist-contains?)
+        ] if
+    ] [
+        drop f
+    ] if* ; inline
+
+: dlist-contains? ( quot dlist -- obj/f )
+    #! Return true if any item in the dlist that when passed to the
+    #! predicate quotation, true is left on the stack.
+    #! The 'pred' quotation must have stack effect ( obj -- bool ).
+    #! TODO: needs a better name.
+    dlist-first (dlist-contains?) ; inline
+
+: (dlist-each) ( quot dnode -- )
+    [
+        [ dlist-node-data swap call ] 2keep 
+        dlist-node-next (dlist-each)
+    ] [
+        drop
+    ] if* ; inline
+
+: dlist-each ( dlist quot -- )
+    swap dlist-first (dlist-each) ; inline
+
+: dlist-length ( dlist -- length )
+    0 swap [ drop 1+ ] dlist-each ;
+
diff --git a/extra/dlists/summary.txt b/extra/dlists/summary.txt
new file mode 100644 (file)
index 0000000..cde8942
--- /dev/null
@@ -0,0 +1 @@
+Double-linked lists/deques
diff --git a/extra/dlists/tags.txt b/extra/dlists/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/documents/authors.txt b/extra/documents/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/documents/documents-docs.factor b/extra/documents/documents-docs.factor
new file mode 100644 (file)
index 0000000..61fab30
--- /dev/null
@@ -0,0 +1,161 @@
+USING: help.markup help.syntax math models strings sequences ;
+IN: documents
+
+HELP: +col
+{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
+{ $description "Adds an integer to the column number of a line/column pair." } ;
+
+{ +col +line =col =line } related-words
+
+HELP: +line
+{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
+{ $description "Adds an integer to the line number of a line/column pair." } ;
+
+HELP: =col
+{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
+{ $description "Sets the column number of a line/column pair." } ;
+
+HELP: =line
+{ $values { "loc" "a pair of integers" } { "n" integer } { "newloc" "a pair of integers" } }
+{ $description "Sets the line number of a line/column pair." } ;
+
+HELP: lines-equal?
+{ $values { "loc1" "a pair of integers" } { "loc2" "a pair of integers" } { "?" "a boolean" } }
+{ $description "Tests if both line/column pairs have the same line number." } ;
+
+HELP: document
+{ $class-description "A document is a " { $link model } " containing editable text, stored as an array of lines. Documents are created by calling " { $link <document> } ". Documents can be edited with editor gadgets; see " { $vocab-link "ui.gadgets.editors" } "." } ;
+
+HELP: <document>
+{ $values { "document" "a new " { $link document } } }
+{ $description "Creates a new, empty " { $link document } "." } ;
+
+HELP: doc-line
+{ $values { "n" "a non-negative integer" } { "document" document } { "string" string } }
+{ $description "Outputs the " { $snippet "n" } "th line of the document." }
+{ $errors "Throws an error if " { $snippet "n" } " is out of bounds." } ;
+
+HELP: doc-lines
+{ $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "document" document } { "slice" slice } }
+{ $description "Outputs a range of lines from the document." }
+{ $notes "The range is created by calling " { $link <slice> } "." }
+{ $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" "a quotation with stack effect " { $snippet "( string -- )" } } }
+{ $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." } ;
+
+HELP: doc-range
+{ $values { "from" "a pair of integers" } { "to" "a pair of integers" } { "document" document } { "string" "a new " { $link string } } }
+{ $description "Outputs all text in between two line/column number pairs. Lines are separated by " { $snippet "\\n" } "." }
+{ $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." } ;
+
+HELP: set-doc-range
+{ $values { "string" string } { "from" "a pair of integers" } { "to" "a pair of integers" } { "document" document } }
+{ $description "Replaces all text between two line/column number pairs with " { $snippet "string" } ". The string may use either " { $snippet "\\n" } ", " { $snippet "\\r\\n" } " or " { $snippet "\\r" } " line separators." }
+{ $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." }
+{ $side-effects "document" } ;
+
+HELP: remove-doc-range
+{ $values { "from" "a pair of integers" } { "to" "a pair of integers" } { "document" document } }
+{ $description "Removes all text between two line/column number pairs." }
+{ $errors "Throws an error if " { $snippet "from" } " or " { $snippet "to" } " is out of bounds." }
+{ $side-effects "document" } ;
+
+HELP: validate-loc
+{ $values { "loc" "a pair of integers" } { "document" document } { "newloc" "a pair of integers" } }
+{ $description "Ensures that the line and column numbers in " { $snippet "loc" } " are valid, clamping them to the permitted range if they are not." } ;
+
+HELP: line-end
+{ $values { "line#" "a non-negative integer" } { "document" document } { "loc" "a pair of integers" } }
+{ $description "Outputs the location where " { $snippet "line#" } " ends." }
+{ $errors "Throws an error if " { $snippet "line#" } " is out of bounds." } ;
+
+HELP: doc-end
+{ $values { "document" document } { "loc" "a pair of integers" } }
+{ $description "Outputs the location of the end of the document." } ;
+
+HELP: doc-string
+{ $values { "document" document } { "str" "a new " { $link string } } }
+{ $description "Outputs the contents of the document as a string. Lines are separated by " { $snippet "\\n" } "." } ;
+
+HELP: set-doc-string
+{ $values { "string" string } { "document" document } }
+{ $description "Sets the contents of the document to a string,  which may use either " { $snippet "\\n" } ", " { $snippet "\\r\\n" } " or " { $snippet "\\r" } " line separators." }
+{ $side-effects "document" } ;
+
+HELP: clear-doc
+{ $values { "document" document } }
+{ $description "Removes all text from the document." }
+{ $side-effects "document" } ;
+
+HELP: prev-elt
+{ $values { "loc" "a pair of integers" } { "document" document } { "elt" "an element" } { "newloc" "a pair of integers" } }
+{ $contract "Outputs the location of the first occurrence of the element prior to " { $snippet "loc" } "." } ;
+
+{ prev-elt next-elt } related-words
+
+HELP: next-elt
+{ $values { "loc" "a pair of integers" } { "document" document } { "elt" "an element" } { "newloc" "a pair of integers" } }
+{ $contract "Outputs the location of the first occurrence of the element following " { $snippet "loc" } "." } ;
+
+HELP: char-elt
+{ $class-description "An element representing a single character." } ;
+
+HELP: one-word-elt
+{ $class-description "An element representing a single word. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the beginning and the end of the word at the current location." } ;
+
+{ one-word-elt word-elt } related-words
+
+HELP: word-elt
+{ $class-description "An element representing a single word. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the previous and next word from the current location." } ;
+
+HELP: one-line-elt
+{ $class-description "An element representing a single line. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the beginning and the end of the line at the current location." } ;
+
+{ one-line-elt line-elt } related-words
+
+HELP: line-elt
+{ $class-description "An element representing a single line. The " { $link prev-elt } " and " { $link next-elt } " words return the location of the previous and next line from the current location." } ;
+
+HELP: doc-elt
+{ $class-description "An element representing the entire document. The " { $link prev-elt } " word outputs the start of the document and the " { $link next-elt } " word outputs the end of the document." } ;
+
+ARTICLE: "documents" "Documents"
+{ $subsection document }
+{ $subsection <document> }
+"Getting and setting the contents of the entire document:"
+{ $subsection doc-string }
+{ $subsection set-doc-string }
+{ $subsection clear-doc }
+"Getting and setting subranges:"
+{ $subsection doc-line }
+{ $subsection doc-lines }
+{ $subsection doc-range }
+{ $subsection set-doc-range }
+{ $subsection remove-doc-range }
+"A combinator:"
+{ $subsection each-line }
+{ $see-also "gadgets-editors" } ;
+
+ARTICLE: "document-locs-elts" "Locations and elements"
+"Locations in the document are represented as a line/column number pair, with both indices being zero-based. There are some words for manipulating locations:"
+{ $subsection +col }
+{ $subsection +line }
+{ $subsection =col }
+{ $subsection =line }
+"New locations can be created out of existing ones by finding the start or end of a document element nearest to a given location."
+{ $subsection prev-elt }
+{ $subsection next-elt }
+"The different types of document elements correspond to the standard editing taxonomy:"
+{ $subsection char-elt }
+{ $subsection one-word-elt }
+{ $subsection word-elt }
+{ $subsection one-line-elt }
+{ $subsection line-elt }
+{ $subsection doc-elt }
+"Miscellaneous words for working with locations:"
+{ $subsection lines-equal? }
+{ $subsection validate-loc } ;
diff --git a/extra/documents/documents-tests.factor b/extra/documents/documents-tests.factor
new file mode 100644 (file)
index 0000000..dfa24c6
--- /dev/null
@@ -0,0 +1,77 @@
+IN: temporary
+USING: documents namespaces tools.test ;
+
+! Tests
+
+[ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
+[ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
+
+[ { 2 9 } ] [
+    <document> "doc" set
+    "Hello world,\nhow are you?\nMore text"
+    "doc" get set-doc-string
+    { 10 0 } "doc" get validate-loc
+] unit-test
+
+[ { 1 12 } ] [
+    <document> "doc" set
+    "Hello world,\nhow are you?\nMore text"
+    "doc" get set-doc-string
+    { 1 20 } "doc" get validate-loc
+] unit-test
+
+[ " world,\nhow are you?\nMore" ] [
+    <document> "doc" set
+    "Hello world,\nhow are you?\nMore text"
+    "doc" get set-doc-string
+    { 0 5 } { 2 4 } "doc" get doc-range
+] unit-test
+
+[ "Hello world,\nhow you?\nMore text" ] [
+    <document> "doc" set
+    "Hello world,\nhow are you?\nMore text"
+    "doc" get set-doc-string
+    { 1 3 } { 1 7 } "doc" get remove-doc-range
+    "doc" get doc-string
+] unit-test
+
+[ "Hello world,\nhow text" ] [
+    <document> "doc" set
+    "Hello world,\nhow are you?\nMore text"
+    "doc" get set-doc-string
+    { 1 3 } { 2 4 } "doc" get remove-doc-range
+    "doc" get doc-string
+] unit-test
+
+[ "Hello world,\nhow you?\nMore text" ] [
+    <document> "doc" set
+    "Hello world,\nhow are you?\nMore text"
+    "doc" get set-doc-string
+    "" { 1 3 } { 1 7 } "doc" get set-doc-range
+    "doc" get doc-string
+] unit-test
+
+[ "Hello world,\nhow text" ] [
+    <document> "doc" set
+    "Hello world,\nhow are you?\nMore text"
+    "doc" get set-doc-string
+    "" { 1 3 } { 2 4 } "doc" get set-doc-range
+    "doc" get doc-string
+] unit-test
+
+<document> "doc" set
+"Hello world" "doc" get set-doc-string
+[ { 0 0 } ] [ { 0 0 } "doc" get T{ one-word-elt } prev-elt ] unit-test
+[ { 0 0 } ] [ { 0 2 } "doc" get T{ one-word-elt } prev-elt ] unit-test
+[ { 0 0 } ] [ { 0 5 } "doc" get T{ one-word-elt } prev-elt ] unit-test
+[ { 0 5 } ] [ { 0 2 } "doc" get T{ one-word-elt } next-elt ] unit-test
+[ { 0 5 } ] [ { 0 5 } "doc" get T{ one-word-elt } next-elt ] unit-test
+
+<document> "doc" set
+"Hello\nworld, how are\nyou?" "doc" get set-doc-string
+
+[ { 2 4 } ] [ "doc" get doc-end ] unit-test
+
+[ { 0 0 } ] [ { 0 3 } "doc" get T{ line-elt } prev-elt ] unit-test
+[ { 0 3 } ] [ { 1 3 } "doc" get T{ line-elt } prev-elt ] unit-test
+[ { 2 4 } ] [ { 2 1 } "doc" get T{ line-elt } next-elt ] unit-test
diff --git a/extra/documents/documents.factor b/extra/documents/documents.factor
new file mode 100644 (file)
index 0000000..bc4dc41
--- /dev/null
@@ -0,0 +1,231 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays io kernel math models namespaces sequences strings
+splitting io.streams.lines combinators ;
+IN: documents
+
+: +col ( loc n -- newloc ) >r first2 r> + 2array ;
+
+: +line ( loc n -- newloc ) >r first2 swap r> + swap 2array ;
+
+: =col ( n loc -- newloc ) first swap 2array ;
+
+: =line ( n loc -- newloc ) second 2array ;
+
+: lines-equal? ( loc1 loc2 -- ? ) [ first ] 2apply number= ;
+
+TUPLE: document locs ;
+
+: <document> ( -- document )
+    V{ "" } clone <model> V{ } clone
+    { set-delegate set-document-locs } document construct ;
+
+: add-loc document-locs push ;
+
+: remove-loc document-locs delete ;
+
+: update-locs ( loc document -- )
+    document-locs [ set-model ] curry* each ;
+
+: doc-line ( n document -- string ) model-value nth ;
+
+: doc-lines ( from to document -- slice )
+    >r 1+ r> model-value <slice> ;
+
+: start-on-line ( document from line# -- n1 )
+    >r dup first r> = [ nip second ] [ 2drop 0 ] if ;
+
+: end-on-line ( document to line# -- n2 )
+    over first over = [
+        drop second nip
+    ] [
+        nip swap doc-line length
+    ] if ;
+
+: each-line ( from to quot -- )
+    pick pick = [
+        3drop
+    ] [
+        >r [ first ] 2apply 1+ dup <slice> r> each
+    ] if ; inline
+
+: start/end-on-line ( from to line# -- n1 n2 )
+    tuck >r >r document get -rot start-on-line r> r>
+    document get -rot end-on-line ;
+
+: (doc-range) ( from to line# -- )
+    [ start/end-on-line ] keep document get doc-line <slice> , ;
+
+: doc-range ( from to document -- string )
+    [
+        document set 2dup [
+            >r 2dup r> (doc-range)
+        ] each-line 2drop
+    ] { } make "\n" join ;
+
+: text+loc ( lines loc -- loc )
+    over >r over length 1 = [
+        nip first2
+    ] [
+        first swap length 1- + 0
+    ] if r> peek length + 2array ;
+
+: prepend-first ( str seq -- )
+    0 swap [ append ] change-nth ;
+
+: append-last ( str seq -- )
+    [ length 1- ] keep [ swap append ] change-nth ;
+
+: loc-col/str ( loc document -- str col )
+    >r first2 swap r> nth swap ;
+
+: prepare-insert ( newinput from to lines -- newinput )
+    tuck loc-col/str tail-slice >r loc-col/str head-slice r>
+    pick append-last over prepend-first ;
+
+: (set-doc-range) ( newlines from to lines -- )
+    [ prepare-insert ] 3keep
+    >r [ first ] 2apply 1+ r>
+    replace-slice ;
+
+: set-doc-range ( string from to document -- )
+    [
+        >r >r >r string-lines r> [ text+loc ] 2keep r> r>
+        [ [ (set-doc-range) ] keep ] change-model
+    ] keep update-locs ;
+
+: remove-doc-range ( from to document -- )
+    >r >r >r "" r> r> r> set-doc-range ;
+
+: last-line# ( document -- line )
+    model-value length 1- ;
+
+: validate-line ( line document -- line )
+    last-line# min 0 max ;
+
+: validate-col ( col line document -- col )
+    doc-line length min 0 max ;
+
+: line-end ( line# document -- loc )
+    dupd doc-line length 2array ;
+
+: line-end? ( loc document -- ? )
+    >r first2 swap r> doc-line length = ;
+
+: doc-end ( document -- loc )
+    [ last-line# ] keep line-end ;
+
+: validate-loc ( loc document -- newloc )
+    over first over model-value length >= [
+        nip doc-end
+    ] [
+        over first 0 < [
+            2drop { 0 0 }
+        ] [
+            >r first2 swap tuck r> validate-col 2array
+        ] if
+    ] if ;
+
+: doc-string ( document -- str )
+    model-value "\n" join ;
+
+: set-doc-string ( string document -- )
+    >r string-lines V{ } like r> [ set-model ] keep
+    dup doc-end swap update-locs ;
+
+: clear-doc ( document -- )
+    "" swap set-doc-string ;
+
+GENERIC: prev-elt ( loc document elt -- newloc )
+GENERIC: next-elt ( loc document elt -- newloc )
+
+: prev/next-elt ( loc document elt -- start end )
+    3dup next-elt >r prev-elt r> ;
+
+: elt-string ( loc document elt -- string )
+    over >r prev/next-elt r> doc-range ;
+
+TUPLE: char-elt ;
+
+: (prev-char) ( loc document quot -- loc )
+    -rot {
+        { [ over { 0 0 } = ] [ drop ] }
+        { [ over second zero? ] [ >r first 1- r> line-end ] }
+        { [ t ] [ pick call ] }
+    } cond nip ; inline
+
+: (next-char) ( loc document quot -- loc )
+    -rot {
+        { [ 2dup doc-end = ] [ drop ] }
+        { [ 2dup line-end? ] [ drop first 1+ 0 2array ] }
+        { [ t ] [ pick call ] }
+    } cond nip ; inline
+
+M: char-elt prev-elt
+    drop [ drop -1 +col ] (prev-char) ;
+
+M: char-elt next-elt
+    drop [ drop 1 +col ] (next-char) ;
+
+: (word-elt) ( loc document quot -- loc )
+    pick >r
+    >r >r first2 swap r> doc-line r> call
+    r> =col ; inline
+
+: ((word-elt)) [ ?nth blank? ] 2keep ;
+
+: break-detector ( ? -- quot )
+    [ >r blank? r> xor ] curry ; inline
+
+: (prev-word) ( ? col str -- col )
+    rot break-detector find-last*
+    drop [ 1+ ] [ 0 ] if* ;
+
+: (next-word) ( ? col str -- col )
+    [ rot break-detector find* drop ] keep
+    over not [ nip length ] [ drop ] if ;
+
+TUPLE: one-word-elt ;
+
+M: one-word-elt prev-elt
+    drop
+    [ [ f -rot >r 1- r> (prev-word) ] (word-elt) ] (prev-char) ;
+
+M: one-word-elt next-elt
+    drop
+    [ [ f -rot (next-word) ] (word-elt) ] (next-char) ;
+
+TUPLE: word-elt ;
+
+M: word-elt prev-elt
+    drop
+    [ [ >r 1- r> ((word-elt)) (prev-word) ] (word-elt) ]
+    (prev-char) ;
+
+M: word-elt next-elt
+    drop
+    [ [ ((word-elt)) (next-word) ] (word-elt) ]
+    (next-char) ;
+
+TUPLE: one-line-elt ;
+
+M: one-line-elt prev-elt
+    2drop first 0 2array ;
+
+M: one-line-elt next-elt
+    drop >r first dup r> doc-line length 2array ;
+
+TUPLE: line-elt ;
+
+M: line-elt prev-elt
+    2drop dup first zero? [ drop { 0 0 } ] [ -1 +line ] if ;
+
+M: line-elt next-elt
+    drop over first over last-line# number=
+    [ nip doc-end ] [ drop 1 +line ] if ;
+
+TUPLE: doc-elt ;
+
+M: doc-elt prev-elt 3drop { 0 0 } ;
+
+M: doc-elt next-elt drop nip doc-end ;
diff --git a/extra/documents/summary.txt b/extra/documents/summary.txt
new file mode 100644 (file)
index 0000000..e8c28bb
--- /dev/null
@@ -0,0 +1 @@
+Mutable structure for storing a plain text document being edited in memory
diff --git a/extra/editors/authors.txt b/extra/editors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/editors/editors-docs.factor b/extra/editors/editors-docs.factor
new file mode 100644 (file)
index 0000000..9fa5053
--- /dev/null
@@ -0,0 +1,38 @@
+USING: help.markup help.syntax parser vocabs.loader ;
+IN: editors
+
+ARTICLE: "editor" "Editor integration"
+"Factor development is best done with one of the supported editors; this allows you to quickly jump to definitions from the Factor environment."
+{ $subsection edit }
+"Depending on the editor you are using, you must load one of the child vocabularies of the " { $vocab-link "editors" } " vocabulary, for example " { $vocab-link "editors.emacs" } "."
+$nl
+"Editor integration vocabularies store a quotation in a global variable when loaded:"
+{ $subsection edit-hook }
+"If a syntax error was thrown while loading a source file, you can jump to the location of the error in your editor:"
+{ $subsection :edit } ;
+
+ABOUT: "editor"
+
+HELP: edit
+{ $values { "defspec" "a definition specifier" } }
+{ $description "Opens the source file containing the definition using the current " { $link edit-hook } ". See " { $link "editor" } "." }
+{ $examples
+    "Editing a word definition:"
+    { $code "\\ foo edit" }
+    "A word's documentation:"
+    { $code "\\ foo >link edit" }
+    "A method definition:"
+    { $code "{ editor draw-gadget* } edit" }
+    "A help article:"
+    { $code "\"handbook\" >link edit" }
+} ;
+
+HELP: edit-location
+{ $values { "file" "a pathname string" } { "line" "a positive integer" } }
+{ $description "Opens a source file at the specified line number containing using the current " { $link edit-hook } ". Line numbers are indexed starting from 1. See " { $link "editor" } "." } ;
+
+HELP: no-edit-hook
+{ $error-description "Thrown when " { $link edit } " is called when the " { $link edit-hook } " variable is not set. See " { $link "editor" } "." } ;
+
+HELP: :edit
+{ $description "If the most recent error was a " { $link parse-error } " thrown while parsing a source file, opens the source file at the failing line in the default editor using the " { $link edit-hook } ". See " { $link "editor" } "." } ;
diff --git a/extra/editors/editors.factor b/extra/editors/editors.factor
new file mode 100644 (file)
index 0000000..930a39d
--- /dev/null
@@ -0,0 +1,37 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: parser kernel namespaces sequences definitions io.files
+inspector continuations tuples tools.crossref io prettyprint
+source-files ;
+IN: editors
+
+TUPLE: no-edit-hook ;
+
+M: no-edit-hook summary drop "No edit hook is set" ;
+
+SYMBOL: edit-hook
+
+: edit-location ( file line -- )
+    >r ?resource-path r>
+    edit-hook get dup [
+        \ no-edit-hook construct-empty throw
+    ] if ;
+
+: edit ( defspec -- )
+    where [ first2 edit-location ] when* ;
+
+: :edit ( -- )
+    error get delegates [ parse-error? ] find-last nip [
+        dup parse-error-file source-file-path ?resource-path
+        swap parse-error-line edit-location
+    ] when* ;
+
+: fix ( word -- )
+    "Fixing " write dup pprint " and all usages..." print nl
+    dup smart-usage swap add* [
+        "Editing " write dup .
+        "RETURN moves on to the next usage, C+d stops." print
+        flush
+        edit
+        readln
+    ] all? drop ;
diff --git a/extra/editors/editpadpro/authors.txt b/extra/editors/editpadpro/authors.txt
new file mode 100644 (file)
index 0000000..74f700d
--- /dev/null
@@ -0,0 +1 @@
+Ryan Murphy
diff --git a/extra/editors/editpadpro/editpadpro-docs.factor b/extra/editors/editpadpro/editpadpro-docs.factor
new file mode 100644 (file)
index 0000000..f348491
--- /dev/null
@@ -0,0 +1,6 @@
+USING: help.syntax help.markup ;
+
+ARTICLE: "editpadpro" "EditPad Pro support"
+"Just load this module and you will be able to edit documentation with EditPadPro.  Be sure to put EditPadPro in your system path so that it will be found.  Windows only." ;
+
+ABOUT: "editpadpro"
\ No newline at end of file
diff --git a/extra/editors/editpadpro/editpadpro.factor b/extra/editors/editpadpro/editpadpro.factor
new file mode 100644 (file)
index 0000000..b79ac6a
--- /dev/null
@@ -0,0 +1,8 @@
+USING: definitions kernel parser words sequences math.parser
+namespaces editors io.launcher ;
+IN: editors.editpadpro
+
+: editpadpro ( file line -- )
+    [ "editpadpro.exe /l" % # " \"" % % "\"" % ] "" make run-process ;
+
+[ editpadpro ] edit-hook set-global
diff --git a/extra/editors/emacs/authors.txt b/extra/editors/emacs/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/editors/emacs/emacs-docs.factor b/extra/editors/emacs/emacs-docs.factor
new file mode 100644 (file)
index 0000000..2ef1ced
--- /dev/null
@@ -0,0 +1,13 @@
+USING: help help.syntax help.markup ;
+
+ARTICLE: { "emacs" "emacs" } "Integration with Emacs"
+
+"Put this in your .emacs file:"
+
+{ $code "(server-start)" }
+
+"If you would like a new window to open when you ask Factor to edit an object, put this in your .emacs file:"
+
+{ $code "(setq server-window 'switch-to-buffer-other-frame)" }
+
+{ $see-also "editor" } ;
diff --git a/extra/editors/emacs/emacs.factor b/extra/editors/emacs/emacs.factor
new file mode 100644 (file)
index 0000000..e131179
--- /dev/null
@@ -0,0 +1,14 @@
+USING: definitions io.launcher kernel parser words sequences math
+math.parser namespaces editors ;
+IN: editors.emacs
+
+: emacsclient ( file line -- )
+    [
+        "emacsclient --no-wait +" % # " " % %
+    ] "" make run-process ;
+
+: emacs ( word -- )
+    where first2 emacsclient ;
+
+[ emacsclient ] edit-hook set-global
+
diff --git a/extra/editors/gvim/authors.txt b/extra/editors/gvim/authors.txt
new file mode 100644 (file)
index 0000000..6960742
--- /dev/null
@@ -0,0 +1,2 @@
+Alex Chapman
+Doug Coleman
diff --git a/extra/editors/gvim/gvim.factor b/extra/editors/gvim/gvim.factor
new file mode 100644 (file)
index 0000000..009379e
--- /dev/null
@@ -0,0 +1,12 @@
+USING: kernel math math.parser namespaces editors.vim ;
+IN: editors.gvim
+
+TUPLE: gvim ;
+
+M: gvim vim-command ( file line -- string )
+    [
+        "\"" % vim-path get % "\" --remote-tab-silent " %
+        "+" % # " \"" % % "\"" %
+    ] "" make ;
+
+T{ gvim } vim-editor set-global
diff --git a/extra/editors/jedit/authors.txt b/extra/editors/jedit/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/editors/jedit/jedit.factor b/extra/editors/jedit/jedit.factor
new file mode 100644 (file)
index 0000000..a3a2446
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions io kernel math
+namespaces parser prettyprint sequences strings words
+editors io.files io.sockets io.streams.string io.binary
+math.parser ;
+IN: editors.jedit
+
+: jedit-server-info ( -- port auth )
+    home "/.jedit/server" path+ <file-reader> [
+        readln drop
+        readln string>number
+        readln string>number
+    ] with-stream ;
+
+: make-jedit-request ( files -- code )
+    [
+        "EditServer.handleClient(false,false,false," write
+        cwd pprint
+        "," write
+        "new String[] {" write
+        [ pprint "," write ] each
+        "null});\n" write
+    ] string-out ;
+
+: send-jedit-request ( request -- )
+    jedit-server-info swap "localhost" swap <inet> <client> [
+        4 >be write
+        dup length 2 >be write
+        write
+    ] with-stream ;
+
+: jedit-location ( file line -- )
+    number>string "+line:" swap append 2array
+    make-jedit-request send-jedit-request ;
+
+: jedit-file ( file -- )
+    1array make-jedit-request send-jedit-request ;
+
+[ jedit-location ] edit-hook set-global
diff --git a/extra/editors/jedit/summary.txt b/extra/editors/jedit/summary.txt
new file mode 100644 (file)
index 0000000..c41d312
--- /dev/null
@@ -0,0 +1 @@
+jEdit editor integration
diff --git a/extra/editors/scite/authors.txt b/extra/editors/scite/authors.txt
new file mode 100644 (file)
index 0000000..6c19104
--- /dev/null
@@ -0,0 +1 @@
+Clemens F. Hofreither
diff --git a/extra/editors/scite/scite.factor b/extra/editors/scite/scite.factor
new file mode 100644 (file)
index 0000000..529d11b
--- /dev/null
@@ -0,0 +1,31 @@
+! Basic SciTE integration for Factor.
+!
+! By Clemens F. Hofreither, 2007.
+! clemens.hofreither@gmx.net
+!
+! In your .factor-rc or .factor-boot-rc,
+! require this module and set the scite-path
+! variable to point to your executable,
+! if not on the path.
+!
+USING: io.launcher kernel namespaces math math.parser
+editors ;
+IN: editors.scite
+
+SYMBOL: scite-path
+
+"scite" scite-path set-global
+
+: scite-command ( file line -- cmd )
+  swap
+  [ scite-path get %
+    " \"" %
+    %
+    "\" -goto:" %
+    #
+  ] "" make ;
+
+: scite-location ( file line -- )
+  scite-command run-detached ;
+
+[ scite-location ] edit-hook set-global
diff --git a/extra/editors/summary.txt b/extra/editors/summary.txt
new file mode 100644 (file)
index 0000000..3dd9322
--- /dev/null
@@ -0,0 +1 @@
+Editor integration
diff --git a/extra/editors/tags.txt b/extra/editors/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/editors/textmate/authors.txt b/extra/editors/textmate/authors.txt
new file mode 100644 (file)
index 0000000..156fc82
--- /dev/null
@@ -0,0 +1 @@
+Benjamin Pollack
diff --git a/extra/editors/textmate/textmate.factor b/extra/editors/textmate/textmate.factor
new file mode 100644 (file)
index 0000000..18c7dbd
--- /dev/null
@@ -0,0 +1,9 @@
+USING: definitions io.launcher kernel math math.parser parser
+namespaces prettyprint editors ;
+
+IN: editors.textmate
+
+: textmate-location ( file line -- )
+    [ "mate -a -l " % # " " % unparse % ] "" make run-process ;
+
+[ textmate-location ] edit-hook set-global
diff --git a/extra/editors/vim/authors.txt b/extra/editors/vim/authors.txt
new file mode 100644 (file)
index 0000000..6960742
--- /dev/null
@@ -0,0 +1,2 @@
+Alex Chapman
+Doug Coleman
diff --git a/extra/editors/vim/generate-vim-syntax.factor b/extra/editors/vim/generate-vim-syntax.factor
new file mode 100644 (file)
index 0000000..23bd49c
--- /dev/null
@@ -0,0 +1,10 @@
+! Generate a new factor.vim file for syntax highlighting
+REQUIRES: apps/http-server ;
+
+IN: vim
+
+USING: embedded io ;
+
+"extras/factor.vim.fgen" resource-path
+"extras/factor.vim" resource-path
+embedded-convert
diff --git a/extra/editors/vim/vim-docs.factor b/extra/editors/vim/vim-docs.factor
new file mode 100644 (file)
index 0000000..9f141f5
--- /dev/null
@@ -0,0 +1,17 @@
+USING: definitions editors.vim help help.markup help.syntax io io.files
+editors words ;
+
+ARTICLE: { "vim" "vim" } "Vim support"
+"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim-location } ". The " { $link vim-path } " variable contains the name of the vim executable.  The default " { $link vim-path } " is " { $snippet "\"gvim\"" } "."
+$nl
+"If you intend to use this module regularly, it helps to have it load during stage 2 bootstrap. On Windows, place the following example " { $snippet ".factor-boot-rc" } " in the directory returned by " { $link home } ":"
+{ $code
+"USING: modules namespaces ;"
+"REQUIRES: libs/vim ;"
+"USE: vim"
+"\"c:\\\\program files\\\\vim\\\\vim70\\\\gvim\" vim-path set-global"
+}
+"On Unix, you may omit the last line if " { $snippet "\"vim\"" } " is in your " { $snippet "$PATH" } "."
+$nl
+"If you are running the terminal version of Vim, you want it to block Factor until exiting, but for GVim the opposite is desired, so that one can work in Factor and GVim concurrently. The " { $link vim-detach } " global variable can be set to " { $link t } " to detach the Vim process. The default is " { $link f } "." ;
+
diff --git a/extra/editors/vim/vim.factor b/extra/editors/vim/vim.factor
new file mode 100644 (file)
index 0000000..040e3fb
--- /dev/null
@@ -0,0 +1,23 @@
+USING: definitions io io.launcher kernel math math.parser
+namespaces parser prettyprint sequences editors ;
+IN: editors.vim
+
+SYMBOL: vim-path
+SYMBOL: vim-detach
+
+SYMBOL: vim-editor
+HOOK: vim-command vim-editor
+
+TUPLE: vim ;
+
+M: vim vim-command ( file line -- string )
+    [ "\"" % vim-path get % "\" \"" % swap % "\" +" % # ] "" make ;
+
+: vim-location ( file line -- )
+    vim-command
+    vim-detach get-global
+    [ run-detached ] [ run-process ] if ;
+
+"vim" vim-path set-global
+[ vim-location ] edit-hook set-global
+T{ vim } vim-editor set-global
diff --git a/extra/eval-server/authors.txt b/extra/eval-server/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/eval-server/eval-server.factor b/extra/eval-server/eval-server.factor
new file mode 100644 (file)
index 0000000..3bfae61
--- /dev/null
@@ -0,0 +1,11 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: listener io.server strings parser byte-arrays ;
+IN: eval-server
+
+: eval-server ( -- )
+    9998 local-server "eval-server" [
+        >string eval>string >byte-array
+    ] with-datagrams ;
+
+MAIN: eval-server
diff --git a/extra/eval-server/summary.txt b/extra/eval-server/summary.txt
new file mode 100644 (file)
index 0000000..b75930a
--- /dev/null
@@ -0,0 +1 @@
+Listens for UDP packets on localhost:9998, evaluates them and sends back result
diff --git a/extra/eval-server/tags.txt b/extra/eval-server/tags.txt
new file mode 100644 (file)
index 0000000..f628c95
--- /dev/null
@@ -0,0 +1,4 @@
+demos
+network
+tools
+applications
diff --git a/extra/factory/authors.txt b/extra/factory/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/factory/commands/commands.factor b/extra/factory/commands/commands.factor
new file mode 100644 (file)
index 0000000..35fab82
--- /dev/null
@@ -0,0 +1,75 @@
+
+USING: kernel combinators sequences math math.vectors mortar slot-accessors
+       x x.widgets.wm.root x.widgets.wm.frame combinators.lib ;
+
+IN: factory.commands
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: up-till-frame ( window -- wm-frame )
+{ { [ dup <wm-frame> is? ]
+    [ ] }
+  { [ dup $dpy $default-root $id over $id = ]
+    [ drop f ] }
+  { [ t ]
+    [ <- parent up-till-frame ] } } cond ;
+
+: pointer-window ( -- window ) dpy> <- pointer-window ;
+
+: pointer-frame ( -- wm-frame )
+pointer-window up-till-frame dup <wm-frame> is? [ ] [ drop f ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: maximize ( -- ) pointer-frame wm-frame-maximize drop ;
+
+: minimize ( -- ) pointer-frame <- unmap drop ;
+
+: maximize-vertical ( -- ) pointer-frame wm-frame-maximize-vertical drop ;
+
+: restore ( -- ) pointer-frame <- restore-state drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+
+: tile-master ( -- )
+
+wm-root>
+  <- children
+  [ <- mapped? ] subset
+  [ check-window-table ] map
+  reverse
+
+unclip
+  { 0 0 } <-- move
+  wm-root> <- size { 1/2 1 } v*
+  [ floor ] map <-- resize
+  <- adjust-child
+drop
+
+dup empty? [ drop ] [
+
+wm-root> <- width 2 / floor [ <-- set-width ] curry map
+wm-root> <- height over length / floor [ <-- set-height ] curry map
+
+wm-root> <- width 2 / floor [ <-- set-x ] curry map
+
+wm-root> <- height over length /   over length   [ * floor ] map-with
+[ <-- set-y <- adjust-child ] 2map
+
+drop
+
+] if ;
+
+! : tile-master ( -- )
+
+! wm-root>
+!   <- children
+!   [ <- mapped? ] subset
+!   [ check-window-table ] map
+!   reverse
+
+! { { [ dup empty? ] [ drop ] }
+!   { [ dup length 1 = ] [ drop maximize ] }
+!   { [ t ] [ tile-master* ] }
\ No newline at end of file
diff --git a/extra/factory/deploy.factor b/extra/factory/deploy.factor
new file mode 100644 (file)
index 0000000..f7f4026
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy ;
+V{
+    { strip-globals? f }
+    { strip-word-props? f }
+    { strip-word-names? f }
+    { strip-dictionary? f }
+    { strip-debugger? f }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? f }
+}
diff --git a/extra/factory/factory-menus b/extra/factory/factory-menus
new file mode 100644 (file)
index 0000000..94b249a
--- /dev/null
@@ -0,0 +1,121 @@
+! -*-factor-*-
+
+USING: kernel unix vars mortar slot-accessors
+       x.widgets.wm.menu x.widgets.wm.unmapped-frames-menu ;
+
+IN: factory
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Helper words
+
+: new-wm-menu ( -- menu ) <wm-menu> new* 1 <-- set-border-width ;
+
+: shrink-wrap ( menu -- ) dup <- calc-size <-- resize drop ;
+
+: set-menu-items ( items menu -- ) swap >>items shrink-wrap ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: apps-menu
+
+apps-menu> not [ new-wm-menu >apps-menu ] when
+
+{ { "Emacs"     [ "emacs &" system drop ] }
+  { "KMail"     [ "kmail &" system drop ] }
+  { "Akregator" [ "akregator &" system drop ] }
+  { "Amarok"   [ "amarok &" system drop ] }
+  { "K3b"      [ "k3b &" system drop ] }
+  { "xchat"    [ "xchat &" system drop ] }
+  { "Nautilus"  [ "nautilus --no-desktop &" system drop ] }
+  { "synaptic" [ "gksudo synaptic &" system drop ] }
+  { "Volume control" [ "gnome-volume-control &" system drop ] }
+  { "Azureus"        [ "~/azureus/azureus &" system drop ] }
+  { "Xephyr"        [ "Xephyr -host-cursor :1 &" system drop ] }
+  { "Stop Xephyr"    [ "pkill Xephyr &" system drop ] }
+  { "Stop Firefox"   [ "pkill firefox &" system drop ] }
+} apps-menu> set-menu-items
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: emacs-menu
+
+emacs-menu> not [ new-wm-menu >emacs-menu ] when
+
+{ { "Start Emacs" [ "emacs &" system drop ] }
+  { "Small"  [ "emacsclient -e '(make-small-frame-command)' &" system drop ] }
+  { "Large"  [ "emacsclient -e '(make-frame-command)' &" system drop ] }
+  { "Full"   [ "emacsclient -e '(make-full-frame-command)' &" system drop ] }
+  { "Gnus"   [ "emacsclient -e '(gnus-other-frame)' &" system drop ] }
+  { "Factor" [ "emacsclient -e '(run-factor-other-frame)' &" system drop ] }
+} emacs-menu> set-menu-items
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: mail-menu
+
+mail-menu> not [ new-wm-menu >mail-menu ] when
+
+{ { "Kmail"   [ "kmail &" system drop ] }
+  { "compose" [ "kmail --composer &" system drop ] }
+  { "slava"   [ "kmail slava@factorcode.org &" system drop ] }
+  { "erg"     [ "kmail doug.coleman@gmail.com &" system drop ] }
+  { "doublec" [ "kmail chris.double@double.co.nz &" system drop ] }
+  { "yuuki"   [ "kmail matthew.willis@mac.com &" system drop ] }
+} mail-menu> set-menu-items
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: factor-menu
+
+factor-menu> not [ new-wm-menu >factor-menu ] when
+
+{ { "Factor" [ "cd /scratch/repos/Factor ; ./factor &" system drop ] }
+  { "Factor (tty)"
+    [ "cd /scratch/repos/Factor ; xterm -e ./factor -run=listener &"
+      system drop ] }
+  { "Terminal : repos/Factor"
+    [ "cd /scratch/repos/Factor ; xterm &" system drop ] }
+  { "darcs whatsnew"
+    [ "cd /scratch/repos/Factor ; xterm -e 'darcs whatsnew | less' &"
+      system drop ] }
+  { "darcs pull"
+    [ "cd /scratch/repos/Factor ; xterm -e 'darcs pull http://factorcode.org/repos' &" system drop ] }
+  { "darcs push"
+    [ "cd /scratch/repos/Factor ; xterm -e 'darcs push dharmatech@onigirihouse.com:doc-root/repos' &" system drop ] }
+} factor-menu> set-menu-items
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: factory-menu
+
+factory-menu> not [ new-wm-menu >factory-menu ] when
+
+{ { "Maximize"          [ maximize ] }
+  { "Maximize Vertical" [ maximize-vertical ] }
+  { "Restore"           [ restore ] }
+  { "Hide"             [ minimize ] }
+  { "Tile Master"      [ tile-master ] }
+}
+
+factory-menu> set-menu-items
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! VAR: root-menu
+
+{ { "xterm"             [ "xterm &" system drop ] }
+  { "Firefox"          [ "firefox &" system drop ] }
+  { "xclock"           [ "xclock &" system drop ] }
+  { "Apps >"           [ apps-menu> <- popup ] }
+  { "Factor >"          [ factor-menu> <- popup ] }
+  { "Unmapped frames >" [ unmapped-frames-menu> <- popup ] }
+  { "Emacs >"          [ emacs-menu> <- popup ] }
+  { "Mail >"           [ mail-menu> <- popup ] }
+  { "onigirihouse"     [ "xterm -e 'ssh dharmatech@onigirihouse.com' &"
+                         system drop ] }
+  { "Edit menus"       [ edit-factory-menus ] }
+  { "Reload menus"      [ load-factory-menus ] }
+  { "Factory >"                [ factory-menu> <- popup ] }
+} root-menu> set-menu-items
+
diff --git a/extra/factory/factory-rc b/extra/factory/factory-rc
new file mode 100644 (file)
index 0000000..6a0c31d
--- /dev/null
@@ -0,0 +1,25 @@
+! -*-factor-*-
+
+USING: kernel mortar x
+       x.widgets.wm.root
+       x.widgets.wm.workspace
+       x.widgets.wm.unmapped-frames-menu
+       tty-server ;
+
+IN: factory
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+create-root-menu
+create-unmapped-frames-menu
+load-factory-menus
+6 setup-workspaces
+
+wm-root>
+ no-modifiers "F12"   [ root-menu> <- popup ] <---- set-key-action
+ control-alt  "LEFT"  [ prev-workspace ]  <---- set-key-action
+ control-alt  "RIGHT" [ next-workspace ]  <---- set-key-action
+ alt          "TAB"   [ circulate-focus ] <---- set-key-action
+drop
+
+9010 tty-server
diff --git a/extra/factory/factory.factor b/extra/factory/factory.factor
new file mode 100644 (file)
index 0000000..a5755c2
--- /dev/null
@@ -0,0 +1,37 @@
+
+USING: kernel parser io io.files namespaces sequences editors threads vars
+       mortar slot-accessors
+       x
+       x.widgets.wm.root
+       x.widgets.wm.frame 
+       x.widgets.wm.menu
+       factory.load
+       factory.commands ;
+
+IN: factory
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: manage-windows ( -- )
+dpy get $default-root <- children [ <- mapped? ] subset
+[ $id <wm-frame> new* drop ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: root-menu
+
+: create-root-menu ( -- ) <wm-menu> new* 1 <-- set-border-width >root-menu ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: start-factory ( display-string -- )
+<display> new* >dpy
+install-default-error-handler
+create-wm-root
+init-atoms
+manage-windows 
+load-factory-rc ;
+
+: factory ( -- ) f start-factory stop ;
+
+MAIN: factory
\ No newline at end of file
diff --git a/extra/factory/load/load.factor b/extra/factory/load/load.factor
new file mode 100644 (file)
index 0000000..018fe5e
--- /dev/null
@@ -0,0 +1,32 @@
+
+USING: kernel io.files parser editors sequences ;
+
+IN: factory.load
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: file-or ( file file -- file ) over exists? [ drop ] [ nip ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: personal-factory-rc ( -- path ) home "/.factory-rc" append ;
+
+: system-factory-rc ( -- path ) "extra/factory/factory-rc" resource-path ;
+
+: factory-rc ( -- path ) personal-factory-rc system-factory-rc file-or ;
+
+: load-factory-rc ( -- ) factory-rc run-file ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: personal-factory-menus ( -- path ) home "/.factory-menus" append ;
+
+: system-factory-menus ( -- path )
+"extra/factory/factory-menus" resource-path ;
+
+: factory-menus ( -- path )
+personal-factory-menus system-factory-menus file-or ;
+
+: load-factory-menus ( -- ) factory-menus run-file ;
+
+: edit-factory-menus ( -- ) factory-menus 0 edit-location ;
diff --git a/extra/factory/summary.txt b/extra/factory/summary.txt
new file mode 100644 (file)
index 0000000..e3b9c11
--- /dev/null
@@ -0,0 +1 @@
+Window manager for the X Window System
diff --git a/extra/factory/tags.txt b/extra/factory/tags.txt
new file mode 100644 (file)
index 0000000..bf31fdb
--- /dev/null
@@ -0,0 +1 @@
+applications
diff --git a/extra/fjsc/authors.txt b/extra/fjsc/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/fjsc/fjsc-tests.factor b/extra/fjsc/fjsc-tests.factor
new file mode 100644 (file)
index 0000000..8dda62f
--- /dev/null
@@ -0,0 +1,54 @@
+! Copyright (C) 2006 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel tools.test parser-combinators lazy-lists fjsc ;
+IN: temporary
+
+{ T{ ast-expression f { T{ ast-number f 55 } T{ ast-identifier f "2abc1" } T{ ast-number f 100 } } } } [
+  "55 2abc1 100" 'expression' parse car parse-result-parsed
+] unit-test
+
+{ T{ ast-quotation f { T{ ast-number f 55 } T{ ast-identifier f "2abc1" } T{ ast-number f 100 } } } } [
+  "[ 55 2abc1 100 ]" 'quotation' parse car parse-result-parsed
+] unit-test
+
+{ T{ ast-array f { T{ ast-number f 55 } T{ ast-identifier f "2abc1" } T{ ast-number f 100 } } } } [
+  "{ 55 2abc1 100 }" 'array' parse car parse-result-parsed
+] unit-test
+
+{ T{ ast-stack-effect f { } { "d" "e" "f" } } } [
+  "( -- d e f )" 'stack-effect' parse car parse-result-parsed 
+] unit-test
+
+{ T{ ast-stack-effect f { "a" "b" "c" } { "d" "e" "f" } } } [
+  "( a b c -- d e f )" 'stack-effect' parse car parse-result-parsed 
+] unit-test
+
+{ T{ ast-stack-effect f { "a" "b" "c" } { } } } [
+  "( a b c -- )" 'stack-effect' parse car parse-result-parsed 
+] unit-test
+
+{ T{ ast-stack-effect f { } { } } } [
+  "( -- )" 'stack-effect' parse car parse-result-parsed 
+] unit-test
+
+{ } [
+  ": foo ( a b -- c d ) abcdefghijklmn 123 ;" 'expression' parse car drop
+] unit-test
+
+{ T{ ast-expression f { T{ ast-string f "abcd" } } } } [ 
+  "\"abcd\"" 'statement' parse car parse-result-parsed 
+] unit-test 
+
+{ T{ ast-expression f { T{ ast-use f "foo" } } } } [
+  "USE: foo" 'statement' parse car parse-result-parsed
+] unit-test
+
+{ T{ ast-expression f { T{ ast-in f "foo" } } } } [
+  "IN: foo" 'statement' parse car parse-result-parsed
+] unit-test
+
+{ T{ ast-expression f { T{ ast-using f { "foo" "bar" }  } } } } [
+  "USING: foo bar ;" 'statement' parse car parse-result-parsed
+] unit-test
+
diff --git a/extra/fjsc/fjsc.factor b/extra/fjsc/fjsc.factor
new file mode 100644 (file)
index 0000000..c6572f1
--- /dev/null
@@ -0,0 +1,360 @@
+! Copyright (C) 2006 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel lazy-lists parser-combinators  parser-combinators.simple
+       strings promises sequences math math.parser namespaces words 
+       quotations arrays hashtables io io.streams.string assocs ;
+IN: fjsc
+
+TUPLE: ast-number value ;
+C: <ast-number> ast-number
+
+TUPLE: ast-identifier value vocab ;
+C: <ast-identifier> ast-identifier
+
+TUPLE: ast-string value ;
+C: <ast-string> ast-string
+
+TUPLE: ast-quotation values ;
+C: <ast-quotation> ast-quotation
+
+TUPLE: ast-array elements ;
+C: <ast-array> ast-array
+
+TUPLE: ast-define name stack-effect expression ;
+C: <ast-define> ast-define
+
+TUPLE: ast-expression values ;
+C: <ast-expression> ast-expression
+
+TUPLE: ast-word value vocab ;
+C: <ast-word> ast-word
+
+TUPLE: ast-comment ;
+C: <ast-comment> ast-comment
+
+TUPLE: ast-stack-effect in out ;
+C: <ast-stack-effect> ast-stack-effect
+
+TUPLE: ast-use name ;
+C: <ast-use> ast-use
+
+TUPLE: ast-using names ;
+C: <ast-using> ast-using
+
+TUPLE: ast-in name ;
+C: <ast-in> ast-in
+
+TUPLE: ast-hashtable elements ;
+C: <ast-hashtable> ast-hashtable
+
+: identifier-middle? ( ch -- bool )
+  [ blank? not ] keep
+  [ CHAR: } = not ] keep
+  [ CHAR: ] = not ] keep
+  [ CHAR: ;" = not ] keep
+  [ CHAR: " = not ] keep
+  digit? not 
+  and and and and and ;
+
+LAZY: 'identifier-ends' ( -- parser )  
+  [ 
+    [ blank? not ] keep
+    [ CHAR: " = not ] keep
+    [ CHAR: ;" = not ] keep
+    [ LETTER? not ] keep
+    [ letter? not ] keep
+    identifier-middle? not
+    and and and and and
+  ] satisfy <!*> ;
+
+LAZY: 'identifier-middle' ( -- parser )  
+  [ identifier-middle? ] satisfy <!+> ;
+
+LAZY: 'identifier' ( -- parser )
+  'identifier-ends' 
+  'identifier-middle' <&>
+  'identifier-ends' <:&> 
+  [ concat >string f <ast-identifier> ] <@ ;
+
+  
+DEFER: 'expression'
+
+LAZY: 'effect-name' ( -- parser )
+  [ 
+    [ blank? not ] keep
+    CHAR: - = not
+    and    
+  ] satisfy <!+> [ >string ] <@ ;
+
+LAZY: 'stack-effect' ( -- parser )
+  "(" token sp
+  'effect-name' sp <*> &>
+  "--" token sp <&
+  'effect-name' sp <*> <&>
+  ")" token sp <& [ first2 <ast-stack-effect> ] <@ ;
+
+LAZY: 'define' ( -- parser )
+  ":" token sp 
+  'identifier' sp [ ast-identifier-value ] <@ &>
+  'stack-effect' sp <!?> <&>
+  'expression' <:&>
+  ";" token sp <& [ first3 <ast-define> ] <@ ;
+
+LAZY: 'quotation' ( -- parser )
+  "[" token sp 
+  'expression' [ ast-expression-values ] <@ &>
+  "]" token sp <& [ <ast-quotation> ] <@ ;
+
+LAZY: 'array' ( -- parser )
+  "{" token sp 
+  'expression' [ ast-expression-values ] <@ &>
+  "}" token sp <& [ <ast-array> ] <@ ;
+
+LAZY: 'word' ( -- parser )
+  "\\" token sp 
+  'identifier' sp &> [ ast-identifier-value f <ast-word> ] <@ ;
+
+LAZY: 'atom' ( -- parser )
+  'identifier' 'integer' [ <ast-number> ] <@ <|> 'string' [ <ast-string> ] <@ <|> ;
+
+LAZY: 'comment' ( -- parser )
+  "#!" token sp
+  "!" token sp <|> [
+    dup CHAR: \n = swap CHAR: \r = or not
+  ] satisfy <*> <&> [ drop <ast-comment> ] <@ ;
+
+LAZY: 'USE:' ( -- parser )
+  "USE:" token sp
+  'identifier' sp &> [ ast-identifier-value <ast-use> ] <@ ;
+
+LAZY: 'IN:' ( -- parser )
+  "IN:" token sp
+  'identifier' sp &> [ ast-identifier-value <ast-in> ] <@ ;
+
+LAZY: 'USING:' ( -- parser )
+  "USING:" token sp
+  'identifier' sp [ ast-identifier-value ] <@ <+> &>
+  ";" token sp <& [ <ast-using> ] <@ ;
+
+LAZY: 'hashtable' ( -- parser )
+  "H{" token sp 
+  'expression' [ ast-expression-values ] <@ &>
+  "}" token sp <& [ <ast-hashtable> ] <@ ;
+
+LAZY: 'parsing-word' ( -- parser )
+  'USE:'
+  'USING:' <|>
+  'IN:' <|> ;
+
+LAZY: 'expression' ( -- parser )
+  'comment' 
+  'parsing-word' sp <|> 
+  'quotation' sp <|> 
+  'define' sp <|>
+  'array' sp <|>
+  'hashtable' sp <|>
+  'word' sp <|>
+  'atom' sp <|> 
+  <*> [ <ast-expression> ] <@ ;
+
+LAZY: 'statement' ( -- parser )
+  'expression' ;
+
+GENERIC: (compile) ( ast -- )
+GENERIC: (literal) ( ast -- )
+
+M: ast-number (literal) 
+  ast-number-value number>string , ;
+
+M: ast-number (compile) 
+  "factor.push_data(" ,
+  (literal)  
+  "," , ;
+
+M: ast-string (literal) 
+  "\"" ,
+  ast-string-value ,
+  "\"" , ;
+
+M: ast-string (compile) 
+  "factor.push_data(" ,
+  (literal)
+  "," , ;
+
+M: ast-identifier (literal) 
+  dup ast-identifier-vocab [
+   "factor.get_word(\"" , 
+   dup ast-identifier-vocab ,
+   "\",\"" ,
+   ast-identifier-value , 
+   "\")" ,  
+  ] [
+   "factor.find_word(\"" , ast-identifier-value , "\")" ,  
+  ] if ;
+
+M: ast-identifier (compile) 
+  (literal) ".execute(" ,  ;
+
+M: ast-define (compile) 
+  "factor.define_word(\"" , 
+  dup ast-define-name , 
+  "\",\"source\"," ,
+  ast-define-expression (compile)
+  "," , ;
+
+: do-expressions ( seq -- )
+  dup empty? not [
+    unclip
+    dup ast-comment? not [
+      "function() {" ,
+      (compile) 
+      do-expressions
+      ")}" ,
+    ] [
+      drop do-expressions
+    ] if
+  ] [
+    drop "factor.cont.next" ,
+  ] if  ;
+
+M: ast-quotation (literal)   
+  "factor.make_quotation(\"source\"," ,
+  ast-quotation-values do-expressions
+  ")" , ;
+
+M: ast-quotation (compile)   
+  "factor.push_data(factor.make_quotation(\"source\"," ,
+  ast-quotation-values do-expressions
+  ")," , ;
+
+M: ast-array (literal)   
+  "[" ,  
+  ast-array-elements [ "," , ] [ (literal) ] interleave
+  "]" , ;
+
+M: ast-array (compile)   
+  "factor.push_data(" , (literal) "," , ;
+
+M: ast-hashtable (literal)   
+  "new Hashtable().fromAlist([" ,  
+  ast-hashtable-elements [ "," , ] [ (literal) ] interleave
+  "])" , ;
+
+M: ast-hashtable (compile)   
+  "factor.push_data(" , (literal) "," , ;
+
+
+M: ast-expression (literal)
+  ast-expression-values [
+    (literal) 
+  ] each ;
+  
+M: ast-expression (compile)
+  ast-expression-values do-expressions ;
+
+M: ast-word (literal)   
+  dup ast-word-vocab [
+   "factor.get_word(\"" , 
+   dup ast-word-vocab ,
+   "\",\"" ,
+   ast-word-value , 
+   "\")" ,  
+  ] [
+   "factor.find_word(\"" , ast-word-value , "\")" ,  
+  ] if ;
+
+M: ast-word (compile)
+  "factor.push_data(" ,
+  (literal)
+  "," , ;
+  
+M: ast-comment (compile)
+  drop ;
+
+M: ast-stack-effect (compile)
+  drop ;
+
+M: ast-use (compile) 
+  "factor.use(\"" ,
+  ast-use-name , 
+  "\"," , ;
+
+M: ast-in (compile) 
+  "factor.set_in(\"" ,
+  ast-in-name , 
+  "\"," , ;
+
+M: ast-using (compile) 
+  "factor.using([" ,
+  ast-using-names [
+    "," ,
+  ] [
+    "\"" , , "\"" ,
+  ] interleave
+  "]," , ;
+
+GENERIC: (parse-factor-quotation) ( object -- ast )
+
+M: number (parse-factor-quotation) ( object -- ast )
+  <ast-number> ;
+
+M: symbol (parse-factor-quotation) ( object -- ast )
+  dup >string swap word-vocabulary <ast-identifier> ;
+
+M: word (parse-factor-quotation) ( object -- ast )
+  dup word-name swap word-vocabulary <ast-identifier> ;
+
+M: string (parse-factor-quotation) ( object -- ast )
+  <ast-string> ;
+
+M: quotation (parse-factor-quotation) ( object -- ast )
+  [ 
+    [ (parse-factor-quotation) , ] each
+  ] { } make <ast-quotation> ;
+
+M: array (parse-factor-quotation) ( object -- ast )
+  [ 
+    [ (parse-factor-quotation) , ] each
+  ] { } make <ast-array> ;
+
+M: hashtable (parse-factor-quotation) ( object -- ast )
+  >alist [ 
+    [ (parse-factor-quotation) , ] each
+  ] { } make <ast-hashtable> ;
+
+M: wrapper (parse-factor-quotation) ( object -- ast )
+  wrapped dup word-name swap word-vocabulary <ast-word> ;
+
+GENERIC: fjsc-parse ( object -- ast )
+
+M: string fjsc-parse ( object -- ast )
+  'expression' parse car parse-result-parsed ;
+
+M: quotation fjsc-parse ( object -- ast )
+  [
+    [ (parse-factor-quotation) , ] each 
+  ] { } make <ast-expression> ;
+
+: fjsc-compile ( ast -- string )
+  [
+    [ 
+      "(" ,
+      (compile) 
+      ")" ,
+    ] { } make [ write ] each
+  ] string-out ;
+  
+: fjsc-compile* ( string -- string )
+  'statement' parse car parse-result-parsed fjsc-compile ;
+
+: fc* ( string -- string )
+  [
+  'statement' parse car parse-result-parsed ast-expression-values do-expressions 
+  ] { } make [ write ] each ;
+  
+
+: fjsc-literal ( ast -- string )
+  [
+    [ (literal) ] { } make [ write ] each
+  ] string-out ;
+  
diff --git a/extra/fjsc/resources/bootstrap.factor b/extra/fjsc/resources/bootstrap.factor
new file mode 100644 (file)
index 0000000..13fef4a
--- /dev/null
@@ -0,0 +1,40 @@
+IN: namespaces
+USE: kernel-internals
+: bind ( ns quot -- )
+  swap >n call n> drop ;
+
+: alert ( string -- )
+  #! Display the string in an alert box
+  window { } "" "alert" { "string" } alien-invoke ;
+
+"browser-dom" set-in
+
+: elements ( string -- result )
+  #! Call JQuery's $ function
+  window { "result" } "" "$" { "string" } alien-invoke ;
+  
+: html ( string -- element ) 
+  #! Set the innerHTML of element using jQuery
+  { } "" "html" { "string" } alien-invoke ;
+
+: bind-event ( name element quot -- )
+  >function swap { } "" "bind" { "string" "function" } alien-invoke ;
+
+"scratchpad" set-in
+
+: example1 ( -- )
+  "<button id='test'>Press Me</button>" "#playground" elements html ;
+
+: example2 ( -- )
+  "click" "#test" elements [ "clicked" alert ] bind-event ;
+
+: example3 ( -- )
+  [
+    [
+      >r "click" "#test" elements r> [ continue ] curry bind-event
+      "Waiting for click on button" alert
+      continue
+    ] callcc0
+    drop "Click done!" alert 
+  ] callcc0 ;
+  
diff --git a/extra/fjsc/resources/bootstrap.js b/extra/fjsc/resources/bootstrap.js
new file mode 100644 (file)
index 0000000..43d100e
--- /dev/null
@@ -0,0 +1,737 @@
+function Word(vocab, name, source, func) {
+  this.vocab = vocab;
+  this.name = name;
+  this.source = source;
+  this.func = func;
+}
+
+Word.prototype.execute = function(next) {
+  this.func(next);
+}
+
+Word.prototype.toString = function() {
+  var html = [];
+  html.push("<a href='/responder/browser/browse?vocab=")
+  html.push(this.vocab);
+  html.push("&amp;word=")
+  html.push(this.name);
+  html.push("'>")
+  html.push(this.name);
+  html.push("</a>");
+  return html.join("");
+}
+
+function Hashtable() {
+  this.table = { }
+}
+
+Hashtable.prototype.fromAlist = function(alist) {
+  var obj = { }
+  for(var i=0;i<alist.length;++i) {  
+    var item = alist[i];
+    obj[item[0]] = item[1];
+  }
+  this.table = obj;
+  return this;
+}
+
+Hashtable.prototype.toAlist = function() {
+  var table = this.table;
+  var alist = [ ];
+  for(k in table) {
+    var v = table[k];
+    alist.push([k,v]);
+  }
+  return alist;
+}
+
+Hashtable.prototype.get = function(key) {
+  var table = this.table;
+  if(table.hasOwnProperty(key)) {
+    return table[key];
+  }
+  return false;
+}
+
+Hashtable.prototype.set = function(key, value) {
+  this.table[key] = value;
+}
+
+Hashtable.prototype.toString = function() {
+  var table = this.table;
+  var result = [];
+  result.push("H{")
+  for(k in table) {
+    var v = table[k];
+    result.push(" { ");
+    result.push(k);
+    result.push(" ");
+    result.push(v);
+    result.push(" }");
+  }
+  result.push("}");
+  return result.join("");    
+}
+
+function Continuation() {
+  this.data_stack = [ ];
+  this.retain_stack = [ ];
+  this.name_stack = [ ];
+  this.next = false;
+  this.nesting = 0;
+}
+
+Continuation.prototype.clone = function() {
+  var c = new Continuation();
+  c.data_stack = this.data_stack.slice(0);
+  c.retain_stack = this.retain_stack.slice(0);
+  c.name_stack = this.name_stack.slice(0);
+  c.nesting = this.nesting;
+  c.next = this.next;
+  return c;
+}
+
+function Factor() {
+  this.vocabs = { scratchpad: { }, io: { } };
+  this.in_vocab = "scratchpad";
+  this.using_vocabs = [ "scratchpad", "kernel","math","sequences","parser","alien","browser-dom", "words", "io", "hashtables" ];
+  this.cont = new Continuation();
+}
+
+var factor = new Factor();
+
+Factor.prototype.call_next = function(next) {
+  if(next) {
+    if(this.cont.nesting++ > 150) {
+      this.cont.nesting = 0;
+      setTimeout(next, 0);
+   }
+    else {
+      next();
+    }
+  }
+}
+
+Factor.prototype.push_data = function(v, next) {
+  factor.cont.data_stack.push(v);
+  factor.call_next(next);
+}
+
+Factor.prototype.use = function(v, next) {
+  factor.cont.data_stack.push(v);
+  factor.get_word("kernel", "use+").execute(next);
+}
+
+Factor.prototype.using = function(v, next) {
+  factor.cont.data_stack.push(v);
+  factor.get_word("kernel", "using").execute(next);
+}
+
+Factor.prototype.set_in = function(v, next) {
+  factor.cont.data_stack.push(v);
+  factor.get_word("kernel", "set-in").execute(next);
+}
+
+Factor.prototype.get_word = function(vocab,name) {
+  return factor.vocabs[vocab][name];
+}
+
+Factor.prototype.find_word = function(name) {
+  for(var v = 0; v<factor.using_vocabs.length; ++v) {
+    var w = factor.vocabs[factor.using_vocabs[v]][name];
+    if(w)
+      return w;
+  }
+  return false;
+}
+
+Factor.prototype.add_word = function(vocab,name, source, func) {
+  var v = factor.vocabs[vocab];
+  if(!v) {
+    v = { };
+    factor.vocabs[vocab] = v;
+  }
+  v[name] = new Word(vocab,name,source,func);
+}
+
+Factor.prototype.remove_word = function(vocab,name) {
+  var v = factor.vocabs[vocab];
+  if(!v) {
+    v = { };
+    factor.vocabs[vocab] = v;
+  }
+  delete v[name];
+}
+    
+Factor.prototype.define_word = function(name, source, func, next) {
+  factor.vocabs[factor.in_vocab][name] = new Word(factor.in_vocab, name, source, function(next) {
+    var old = factor.cont.next;
+    factor.cont.next = function() {
+      factor.cont.next = old;
+      factor.call_next(next);
+    }
+    func();
+  });
+  factor.call_next(next);
+}
+
+Factor.prototype.make_quotation = function(source, func) {
+  return new Word("quotations", "quotation", source, function(next) {
+    var old = factor.cont.next;
+    factor.cont.next = function() {
+      factor.cont.next = old;
+      factor.call_next(next);
+    }
+    func();
+  });
+}
+
+Factor.prototype.server_eval = function(text, handler, next) {
+   var self = this;
+   $.post("/responder/fjsc/compile", { code: text }, function(result) {
+     factor.run_eval = function(func) {
+       factor.cont.next = function() { handler(text,result); } 
+       try {
+         func(factor);
+       } catch(ex) {
+         alert("Error Parsing Javascript: " + ex); 
+         handler(text, result);
+       }
+       if(next) 
+         factor.call_next(next);
+     }
+     try {
+       eval("factor.run_eval" + result);
+     } catch(e) {
+       factor.run_eval(function() { alert("Error Parsing Javascript: " + e); });
+     }
+   });
+}
+
+/* kernel-internals vocabulary */
+factor.add_word("kernel-internals", ">n", "primitive", function(next) {
+  var data_stack = factor.cont.data_stack;
+  var name_stack = factor.cont.name_stack;
+  name_stack.push(data_stack.pop());
+  factor.call_next(next);
+});
+
+factor.add_word("kernel-internals", "n>", "primitive", function(next) {
+  var data_stack = factor.cont.data_stack;
+  var name_stack = factor.cont.name_stack;
+  data_stack.push(name_stack.pop());
+  factor.call_next(next);
+});
+
+/* Kernel Vocabulary */
+factor.add_word("kernel","dup", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  stack[stack.length] = stack[stack.length-1];
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "drop", "primitive", function(next) {
+  factor.cont.data_stack.pop();
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "nip", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  stack[stack.length-2] = stack[stack.length-1];
+  stack.pop();
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "over", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  stack[stack.length] = stack[stack.length-2];
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "pick", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  stack[stack.length] = stack[stack.length-3];
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "swap", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  var temp = stack[stack.length-2];
+  stack[stack.length-2] = stack[stack.length-1];
+  stack[stack.length-1] = temp;
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", ">r", "primitive", function(next) {
+  var data_stack = factor.cont.data_stack;
+  var retain_stack = factor.cont.retain_stack;
+  retain_stack.push(data_stack.pop());
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "r>", "primitive", function(next) {
+  var data_stack = factor.cont.data_stack;
+  var retain_stack = factor.cont.retain_stack;
+  data_stack.push(retain_stack.pop());
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "call", "primitive", function(next) {
+  var quot = factor.cont.data_stack.pop();
+  quot.execute(next);
+});
+
+factor.add_word("kernel", "execute", "primitive", function(next) {
+  var quot = factor.cont.data_stack.pop();
+  quot.execute(next);
+});
+
+factor.add_word("kernel", "clear", "primitive", function(next) {
+  factor.cont.data_stack = [];
+  factor.cont.retain_stack = [];
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "if", "primitive", function(next) {  
+  var stack = factor.cont.data_stack;
+  var else_quot = stack.pop();
+  var then_quot = stack.pop();
+  var condition = stack.pop();
+  if(condition) {
+    then_quot.execute(next);
+  } else {
+    else_quot.execute(next);
+  }
+});
+
+factor.add_word("kernel", "f", "primitive", function(next) {  
+  factor.cont.data_stack.push(false);
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "t", "primitive", function(next) {  
+  factor.cont.data_stack.push(true);
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "=", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  stack.push(stack.pop()==stack.pop());
+  factor.call_next(next);
+});
+
+factor.add_word("kernel", "bootstrap", "primitive", function(next) {  
+  factor.cont.data_stack.push("/responder/fjsc-resources/bootstrap.factor");
+  factor.get_word("parser", "run-file").execute(next);
+});
+
+factor.add_word("kernel", "callcc0", "primitive", function(next) {  
+  var data_stack = factor.cont.data_stack;
+  var quot = data_stack.pop();
+  var new_cont = factor.cont.clone();  
+  var old_next = factor.cont.next;
+  factor.cont.next = function() {
+      factor.cont.next = old_next;
+      factor.call_next(next);
+  }
+  new_cont.data_stack.push(factor.cont);
+  factor.cont = new_cont;
+  quot.execute(next);  
+});
+
+factor.add_word("kernel", "callcc1", "primitive", function(next) {  
+  factor.get_word("kernel", "callcc0").execute(next);
+});
+
+factor.add_word("kernel", "continue", "primitive", function(next) {  
+  var data_stack = factor.cont.data_stack;
+  var cont = data_stack.pop(); 
+  factor.cont = cont.clone();
+  factor.call_next(cont.next);
+});
+
+factor.add_word("kernel", "continue-with", "primitive", function(next) {  
+  var data_stack = factor.cont.data_stack;
+  var cont = data_stack.pop(); 
+  var data = data_stack.pop(); 
+  factor.cont = cont.clone();
+  factor.cont.data_stack.push(data);
+  factor.call_next(cont.next);
+});
+
+factor.add_word("kernel", "set-in", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var vocab = stack.pop();
+  var v = factor.vocabs[vocab];
+  if(!v) {
+    v = { };
+    factor.vocabs[vocab] = v;
+  }
+  factor.in_vocab = vocab;
+  factor.call_next(next);  
+});
+
+factor.add_word("kernel", "current-vocab", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  stack.push(factor.in_vocab);
+  factor.call_next(next);  
+});
+
+factor.add_word("kernel", "use+", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var vocab = stack.pop();
+  var v = factor.vocabs[vocab];
+  if(!v) {
+    v = { };
+    factor.vocabs[vocab] = v;
+  }
+  factor.using_vocabs.push(vocab);
+  factor.call_next(next);  
+});
+
+factor.add_word("kernel", "using", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var vocabs = stack.pop();
+
+  for(var i=0;i<vocabs.length;++i) {  
+    var v = factor.vocabs[vocabs[i]];
+    if(!v) {
+      v = { };
+      factor.vocabs[vocabs[i]] = v;
+    }
+    factor.using_vocabs.push(vocabs[i]);
+  }
+  factor.call_next(next);  
+});
+
+factor.add_word("kernel", "current-using", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  stack.push(factor.using_vocabs);
+  factor.call_next(next);  
+});
+
+factor.add_word("kernel", "forget", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var word = stack.pop();
+  factor.remove_word(word.vocab, word.name);
+  factor.call_next(next);  
+});
+
+factor.add_word("kernel", ">function", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var word = stack.pop();
+  stack.push(function() { word.func(function() { }) });
+  factor.call_next(next);  
+});
+
+factor.add_word("kernel", "curry", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var quot = stack.pop();
+  var value = stack.pop();
+  
+  stack.push(factor.make_quotation("quotation", function(next) {
+    factor.cont.data_stack.push(value);   
+    quot.execute(factor.cont.next);
+  }));
+  factor.call_next(next);
+});
+
+/* Math vocabulary */
+factor.add_word("math", "*", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  stack.push(stack.pop() * stack.pop());
+  factor.call_next(next);
+});
+
+factor.add_word("math", "+", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  stack.push(stack.pop() + stack.pop());
+  factor.call_next(next);
+});
+
+factor.add_word("math", "-", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  var v1 = stack.pop();
+  var v2 = stack.pop();
+  stack.push(v2 - v1);
+  factor.call_next(next);
+});
+
+factor.add_word("math", "/", "primitive", function(next) {
+  var stack = factor.cont.data_stack;
+  var v1 = stack.pop();
+  var v2 = stack.pop();
+  stack.push(v2 / v1);
+  factor.call_next(next);
+});
+
+factor.add_word("parser", "run-file", "primitive", function(next) {  
+  var stack = factor.cont.data_stack;
+  var url = stack.pop();
+  $.get(url, function(result) {
+    factor.server_eval(result, function() { }, next);
+  });
+});
+
+
+factor.add_word("alien", "alien-invoke", "primitive", function(next) {  
+  var stack = factor.cont.data_stack;
+  var arg_types = stack.pop();
+  var method_name = stack.pop();
+  var library_name = stack.pop();
+  var return_values = stack.pop();
+  var obj = stack.pop();
+  var args = [ ];
+  for(var i = 0; i < arg_types.length; ++i) {
+    args[i] = stack.pop();
+  }
+  var func = obj[method_name];
+  if(method_name=="alert") {
+    func = function(a) { alert(a); }
+  }
+  var v = func.apply(obj, args.reverse());
+  if(return_values.length > 0)
+    stack.push(v);
+  factor.call_next(next);
+});
+
+factor.add_word("alien", "alien-property", "primitive", function(next) {  
+  var stack = factor.cont.data_stack;
+  var obj = stack.pop();
+  var property_name = stack.pop();
+  var v = obj[property_name];
+  stack.push(v);
+  factor.call_next(next);
+});
+
+factor.add_word("alien", "set-alien-property", "primitive", function(next) {  
+  var stack = factor.cont.data_stack;
+  var obj = stack.pop();
+  var property_name = stack.pop();
+  var data = stack.pop();
+  obj[property_name] = v;
+  factor.call_next(next);
+});
+
+factor.add_word("words", "vocabs", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var result = [];
+  for(v in factor.vocabs) {
+    result.push(v);
+  }
+  stack.push(result);
+  factor.call_next(next);
+});
+
+factor.add_word("words", "words", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var vocab = factor.vocabs[stack.pop()];
+  var result = [];
+  for(w in vocab) {
+    result.push(vocab[w]);
+  }
+  stack.push(result);
+  factor.call_next(next);
+});
+
+factor.add_word("words", "all-words", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var result = [];
+  for(v in factor.vocabs) {
+    for(w in factor.vocabs[v]) {
+      result.push(factor.vocabs[v][w]);
+    }
+  }
+  stack.push(result);
+  factor.call_next(next);
+});
+
+/* Sequences vocabulary */
+factor.add_word("sequences", "nth", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  var index = stack.pop();
+  stack.push(seq[index]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "first", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  stack.push(seq[0]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "second", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  stack.push(seq[1]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "third", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  stack.push(seq[2]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "fourth", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  stack.push(seq[0]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "first2", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  stack.push(seq[0],seq[1]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "first3", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  stack.push(seq[0],seq[1],seq[2]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "first4", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var seq = stack.pop();
+  stack.push(seq[0],seq[1],seq[2],seq[3]);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "each", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var quot = stack.pop();
+  var seq = stack.pop();
+  for(var i=0;i<seq.length;++i) {  
+    stack.push(seq[i]);
+    quot.execute();
+  }
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "map", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var quot = stack.pop();
+  var seq = stack.pop();
+  var result = [ ];
+  for(var i=0;i<seq.length;++i) {  
+    stack.push(seq[i]);
+    quot.execute();
+    result[i]=stack.pop();
+  }
+  stack.push(result);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "reduce", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var quot = stack.pop();
+  var prev = stack.pop();
+  var seq = stack.pop();
+  for(var i=0;i<seq.length;++i) {  
+    stack.push(prev);
+    stack.push(seq[i]);
+    quot.execute();
+    prev=stack.pop();Al
+  }
+  stack.push(prev);
+  factor.call_next(next);
+});
+
+/* hashtables vocabulary */
+factor.add_word("hashtables", "alist>hash", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var alist = stack.pop();
+  stack.push(new Hashtable().fromAlist(alist));
+  factor.call_next(next);
+});
+
+factor.add_word("hashtables", "hash>alist", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var hashtable = stack.pop();
+  stack.push(hashtable.toAlist());
+  factor.call_next(next);
+});
+
+factor.add_word("hashtables", "hash", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var hashtable = stack.pop();
+  var key = stack.pop();
+  stack.push(hashtable.get(key));
+  factor.call_next(next);
+});
+
+factor.add_word("hashtables", "set-hash", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var hashtable = stack.pop();
+  var key = stack.pop();
+  var value = stack.pop();
+  hashtable.set(key, value);
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "hash-each", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var quot = stack.pop();
+  var hashtable = stack.pop().table;
+  for(k in hashtable) {  
+    var v = hashtable[k]; 
+    stack.push(k, v);
+    quot.execute();
+  }
+  factor.call_next(next);
+});
+
+factor.add_word("sequences", "hash-map", "primitive", function(next) {   
+  var stack = factor.cont.data_stack;
+  var quot = stack.pop();
+  var hashtable = stack.pop().table;
+  var result = [ ];
+  for(k in hashtable) {  
+    var v = hashtable[k];
+    stack.push(k,v);
+    quot.execute();
+    result.push(stack.pop());
+  }
+  stack.push(result);
+  factor.call_next(next);
+});
+
+/* browser-dom vocab */
+factor.add_word("browser-dom", "window", "primitive", function(next) {  
+  factor.cont.data_stack.push(window);
+  factor.call_next(next);
+});
+
+factor.add_word("browser-dom", "document", "primitive", function(next) {  
+  factor.cont.data_stack.push(document);
+  factor.call_next(next);
+});
+
+factor.add_word("browser-dom", "load-script", "primitive", function(next) {  
+  var stack = factor.cont.data_stack;
+  $("head/script#jsonrequest").remove();
+  var script = document.createElement("script");
+  script.id = "jsonrequest";    
+  script.type = "text/javascript";
+  script.src = stack.pop();
+  $("head").append(script);
+  factor.call_next(next); 
+});
+
+var handle_json = false;
+factor.add_word("browser-dom", "json-request", "primitive", function(next) {  
+  var stack = factor.cont.data_stack;
+  handle_json = function(data) { 
+    factor.cont.data_stack.push(data);
+    factor.call_next(next);
+  }
+  factor.get_word("browser-dom", "load-script").execute();
+});
+
diff --git a/extra/fjsc/resources/jquery.js b/extra/fjsc/resources/jquery.js
new file mode 100644 (file)
index 0000000..2531342
--- /dev/null
@@ -0,0 +1 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('l(1T 1z.6=="Q"){1z.Q=1z.Q;u 6=q(a,c){l(a&&1T a=="q"&&6.C.1W)v 6(17).1W(a);a=a||6.1o||17;l(a.3E)v 6(6.1X(a,[]));l(c&&c.3E)v 6(c).1V(a);l(1z==7)v 1h 6(a,c);l(a.O==1C){u m=/^[^<]*(<.+>)[^>]*$/.3d(a);l(m)a=6.3D([m[1]])}7.1n(a.O==2z||a.D&&!a.1R&&a[0]!=Q&&a[0].1R?6.1X(a,[]):6.1V(a,c));u C=19[19.D-1];l(C&&1T C=="q")7.W(C);v 7};l(1T $!="Q")6.44$=$;u $=6;6.C=6.8b={3E:"1.0.3",5J:q(){v 7.D},1n:q(23){l(23&&23.O==2z){7.D=0;[].1k.16(7,23);v 7}G v 23==Q?6.1X(7,[]):7[23]},W:q(C,1g){v 6.W(7,C,1g)},8g:q(15){u 2j=-1;7.W(q(i){l(7==15)2j=i});v 2j},1t:q(1L,Y,B){v 1L.O!=1C||Y!=Q?7.W(q(){l(Y==Q)I(u E 1r 1L)6.1t(B?7.1a:7,E,1L[E]);G 6.1t(B?7.1a:7,1L,Y)}):6[B||"1t"](7[0],1L)},1f:q(1L,Y){v 7.1t(1L,Y,"26")},2B:q(e){e=e||7;u t="";I(u j=0;j<e.D;j++){u r=e[j].2f;I(u i=0;i<r.D;i++)l(r[i].1R!=8)t+=r[i].1R!=1?r[i].4Z:6.C.2B([r[i]])}v t},1Y:q(){u a=6.3D(19);v 7.W(q(){u b=a[0].3f(T);7.1i.2Y(b,7);24(b.2a)b=b.2a;b.4e(7)})},5g:q(){v 7.2T(19,T,1,q(a){7.4e(a)})},5h:q(){v 7.2T(19,T,-1,q(a){7.2Y(a,7.2a)})},5i:q(){v 7.2T(19,U,1,q(a){7.1i.2Y(a,7)})},5j:q(){v 7.2T(19,U,-1,q(a){7.1i.2Y(a,7.8j)})},4q:q(){v 7.1n(7.33.8k())},1V:q(t){v 7.2n(6.2r(7,q(a){v 6.1V(t,a)}),19)},4f:q(4D){v 7.2n(6.2r(7,q(a){v a.3f(4D!=Q?4D:T)}),19)},1c:q(t){v 7.2n(t.O==2z&&6.2r(7,q(a){I(u i=0;i<t.D;i++)l(6.1c(t[i],[a]).r.D)v a;v U})||t.O==8l&&(t?7.1n():[])||1T t=="q"&&6.2O(7,t)||6.1c(t,7).r,19)},2t:q(t){v 7.2n(t.O==1C?6.1c(t,7,U).r:6.2O(7,q(a){v a!=t}),19)},2g:q(t){v 7.2n(6.1X(7,t.O==1C?6.1V(t):t.O==2z?t:[t]),19)},4E:q(2u){v 2u?6.1c(2u,7).r.D>0:U},2T:q(1g,22,2X,C){u 4f=7.5J()>1;u a=6.3D(1g);v 7.W(q(){u 15=7;l(22&&7.2p.2b()=="8m"&&a[0].2p.2b()!="62"){u 29=7.4S("29");l(!29.D){15=17.5N("29");7.4e(15)}G 15=29[0]}I(u i=(2X<0?a.D-1:0);i!=(2X<0?2X:a.D);i+=2X){C.16(15,[4f?a[i].3f(T):a[i]])}})},2n:q(a,1g){u C=1g&&1g[1g.D-1];u 2d=1g&&1g[1g.D-2];l(C&&C.O!=1v)C=M;l(2d&&2d.O!=1v)2d=M;l(!C){l(!7.33)7.33=[];7.33.1k(7.1n());7.1n(a)}G{u 1Z=7.1n();7.1n(a);l(2d&&a.D||!2d)7.W(2d||C).1n(1Z);G 7.1n(1Z).W(C)}v 7}};6.1y=6.C.1y=q(15,E){l(19.D>1&&(E===M||E==Q))v 15;l(!E){E=15;15=7}I(u i 1r E)15[i]=E[i];v 15};6.1y({5C:q(){6.65=T;6.W(6.2e.5r,q(i,n){6.C[i]=q(a){u L=6.2r(7,n);l(a&&a.O==1C)L=6.1c(a,L).r;v 7.2n(L,19)}});6.W(6.2e.2o,q(i,n){6.C[i]=q(){u a=19;v 7.W(q(){I(u j=0;j<a.D;j++)6(a[j])[n](7)})}});6.W(6.2e.W,q(i,n){6.C[i]=q(){v 7.W(n,19)}});6.W(6.2e.1c,q(i,n){6.C[n]=q(23,C){v 7.1c(":"+n+"("+23+")",C)}});6.W(6.2e.1t,q(i,n){n=n||i;6.C[i]=q(h){v h==Q?7.D?7[0][n]:M:7.1t(n,h)}});6.W(6.2e.1f,q(i,n){6.C[n]=q(h){v h==Q?(7.D?6.1f(7[0],n):M):7.1f(n,h)}})},W:q(15,C,1g){l(15.D==Q)I(u i 1r 15)C.16(15[i],1g||[i,15[i]]);G I(u i=0;i<15.D;i++)l(C.16(15[i],1g||[i,15[i]])===U)45;v 15},1j:{2g:q(o,c){l(6.1j.3t(o,c))v;o.1j+=(o.1j?" ":"")+c},25:q(o,c){l(!c){o.1j=""}G{u 2L=o.1j.3b(" ");I(u i=0;i<2L.D;i++){l(2L[i]==c){2L.67(i,1);45}}o.1j=2L.5Z(\' \')}},3t:q(e,a){l(e.1j!=Q)e=e.1j;v 1h 43("(^|\\\\s)"+a+"(\\\\s|$)").28(e)}},4A:q(e,o,f){I(u i 1r o){e.1a["1Z"+i]=e.1a[i];e.1a[i]=o[i]}f.16(e,[]);I(u i 1r o)e.1a[i]=e.1a["1Z"+i]},1f:q(e,p){l(p=="1G"||p=="2c"){u 1Z={},3K,3F,d=["68","6O","69","7c"];I(u i 1r d){1Z["6b"+d[i]]=0;1Z["6c"+d[i]+"6e"]=0}6.4A(e,1Z,q(){l(6.1f(e,"1u")!="20"){3K=e.6f;3F=e.6g}G{e=6(e.3f(T)).1V(":3W").5u("2J").4q().1f({3U:"1S",2H:"6i",1u:"2F",6j:"0",5l:"0"}).4H(e.1i)[0];u 31=6.1f(e.1i,"2H");l(31==""||31=="3R")e.1i.1a.2H="6k";3K=e.6l;3F=e.6m;l(31==""||31=="3R")e.1i.1a.2H="3R";e.1i.3s(e)}});v p=="1G"?3K:3F}v 6.26(e,p)},26:q(F,E,4I){u L;l(E==\'1m\'&&6.11.1p)v 6.1t(F.1a,\'1m\');l(E=="3p"||E=="2y")E=6.11.1p?"37":"2y";l(!4I&&F.1a[E]){L=F.1a[E]}G l(F.34){u 5S=E.1B(/\\-(\\w)/g,q(m,c){v c.2b()});L=F.34[E]||F.34[5S]}G l(17.3g&&17.3g.4u){l(E=="2y"||E=="37")E="3p";E=E.1B(/([A-Z])/g,"-$1").4d();u 1l=17.3g.4u(F,M);l(1l)L=1l.5P(E);G l(E==\'1u\')L=\'20\';G 6.4A(F,{1u:\'2F\'},q(){L=17.3g.4u(7,M).5P(E)})}v L},3D:q(a){u r=[];I(u i=0;i<a.D;i++){u 1M=a[i];l(1M.O==1C){u s=6.2K(1M),21=17.5N("21"),1Y=[0,"",""];l(!s.1b("<6v"))1Y=[1,"<3c>","</3c>"];G l(!s.1b("<6w")||!s.1b("<29"))1Y=[1,"<22>","</22>"];G l(!s.1b("<4t"))1Y=[2,"<22>","</22>"];G l(!s.1b("<6x")||!s.1b("<6z"))1Y=[3,"<22><29><4t>","</4t></29></22>"];21.2V=1Y[1]+s+1Y[2];24(1Y[0]--)21=21.2a;I(u j=0;j<21.2f.D;j++)r.1k(21.2f[j])}G l(1M.D!=Q&&!1M.1R)I(u n=0;n<1M.D;n++)r.1k(1M[n]);G r.1k(1M.1R?1M:17.6A(1M.6C()))}v r},2u:{"":"m[2]== \'*\'||a.2p.2b()==m[2].2b()","#":"a.3a(\'3H\')&&a.3a(\'3H\')==m[2]",":":{5o:"i<m[3]-0",5X:"i>m[3]-0",5L:"m[3]-0==i",5n:"m[3]-0==i",2h:"i==0",1N:"i==r.D-1",52:"i%2==0",53:"i%2","5L-3x":"6.1x(a,m[3]).1l","2h-3x":"6.1x(a,0).1l","1N-3x":"6.1x(a,0).1N","6D-3x":"6.1x(a).D==1",5s:"a.2f.D",5B:"!a.2f.D",5p:"6.C.2B.16([a]).1b(m[3])>=0",6E:"a.B!=\'1S\'&&6.1f(a,\'1u\')!=\'20\'&&6.1f(a,\'3U\')!=\'1S\'",1S:"a.B==\'1S\'||6.1f(a,\'1u\')==\'20\'||6.1f(a,\'3U\')==\'1S\'",6F:"!a.2P",2P:"a.2P",2J:"a.2J",3V:"a.3V || 6.1t(a, \'3V\')",2B:"a.B==\'2B\'",3W:"a.B==\'3W\'",5y:"a.B==\'5y\'",3Q:"a.B==\'3Q\'",5v:"a.B==\'5v\'",4x:"a.B==\'4x\'",5w:"a.B==\'5w\'",4w:"a.B==\'4w\'",4s:"a.B==\'4s\'",5z:"a.2p.4d().4T(/5z|3c|6L|4s/)"},".":"6.1j.3t(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z && !z.1b(m[4])","$=":"z && z.32(z.D - m[4].D,m[4].D)==m[4]","*=":"z && z.1b(m[4])>=0","":"z"},"[":"6.1V(m[2],a).D"},3B:["\\\\.\\\\.|/\\\\.\\\\.","a.1i",">|/","6.1x(a.2a)","\\\\+","6.1x(a).3z","~",q(a){u r=[];u s=6.1x(a);l(s.n>0)I(u i=s.n;i<s.D;i++)r.1k(s[i]);v r}],1V:q(t,1o){l(1o&&1o.1R==Q)1o=M;1o=1o||6.1o||17;l(t.O!=1C)v[t];l(!t.1b("//")){1o=1o.4Q;t=t.32(2,t.D)}G l(!t.1b("/")){1o=1o.4Q;t=t.32(1,t.D);l(t.1b("/")>=1)t=t.32(t.1b("/"),t.D)}u L=[1o];u 1K=[];u 1N=M;24(t.D>0&&1N!=t){u r=[];1N=t;t=6.2K(t).1B(/^\\/\\//i,"");u 36=U;I(u i=0;i<6.3B.D;i+=2){l(36)51;u 2v=1h 43("^("+6.3B[i]+")");u m=2v.3d(t);l(m){r=L=6.2r(L,6.3B[i+1]);t=6.2K(t.1B(2v,""));36=T}}l(!36){l(!t.1b(",")||!t.1b("|")){l(L[0]==1o)L.4h();1K=6.1X(1K,L);r=L=[1o];t=" "+t.32(1,t.D)}G{u 3Z=/^([#.]?)([a-4Y-9\\\\*44-]*)/i;u m=3Z.3d(t);l(m[1]=="#"){u 4l=17.5V(m[2]);r=L=4l?[4l]:[];t=t.1B(3Z,"")}G{l(!m[2]||m[1]==".")m[2]="*";I(u i=0;i<L.D;i++)r=6.1X(r,m[2]=="*"?6.40(L[i]):L[i].4S(m[2]))}}}l(t){u 1D=6.1c(t,r);L=r=1D.r;t=6.2K(1D.t)}}l(L&&L[0]==1o)L.4h();1K=6.1X(1K,L);v 1K},40:q(o,r){r=r||[];u s=o.2f;I(u i=0;i<s.D;i++)l(s[i].1R==1){r.1k(s[i]);6.40(s[i],r)}v r},1t:q(F,1d,Y){u 2m={"I":"7v","6P":"1j","3p":6.11.1p?"37":"2y",2y:6.11.1p?"37":"2y",2V:"2V",1j:"1j",Y:"Y",2P:"2P",2J:"2J",6R:"6S"};l(1d=="1m"&&6.11.1p&&Y!=Q){F[\'6U\']=1;l(Y==1)v F["1c"]=F["1c"].1B(/3k\\([^\\)]*\\)/5c,"");G v F["1c"]=F["1c"].1B(/3k\\([^\\)]*\\)/5c,"")+"3k(1m="+Y*4U+")"}G l(1d=="1m"&&6.11.1p){v F["1c"]?4c(F["1c"].4T(/3k\\(1m=(.*)\\)/)[1])/4U:1}l(1d=="1m"&&6.11.2I&&Y==1)Y=0.6W;l(2m[1d]){l(Y!=Q)F[2m[1d]]=Y;v F[2m[1d]]}G l(Y==Q&&6.11.1p&&F.2p&&F.2p.2b()==\'6X\'&&(1d==\'7f\'||1d==\'7e\')){v F.70(1d).4Z}G l(F.3a!=Q&&F.7b){l(Y!=Q)F.72(1d,Y);v F.3a(1d)}G{1d=1d.1B(/-([a-z])/73,q(z,b){v b.2b()});l(Y!=Q)F[1d]=Y;v F[1d]}},4X:["\\\\[ *(@)S *([!*$^=]*) *(\'?\\"?)(.*?)\\\\4 *\\\\]","(\\\\[)\\s*(.*?)\\s*\\\\]","(:)S\\\\(\\"?\'?([^\\\\)]*?)\\"?\'?\\\\)","([:.#]*)S"],1c:q(t,r,2t){u g=2t!==U?6.2O:q(a,f){v 6.2O(a,f,T)};24(t&&/^[a-z[({<*:.#]/i.28(t)){u p=6.4X;I(u i=0;i<p.D;i++){u 2v=1h 43("^"+p[i].1B("S","([a-z*44-][a-4Y-76-]*)"),"i");u m=2v.3d(t);l(m){l(!i)m=["",m[1],m[3],m[2],m[5]];t=t.1B(2v,"");45}}l(m[1]==":"&&m[2]=="2t")r=6.1c(m[3],r,U).r;G{u f=6.2u[m[1]];l(f.O!=1C)f=6.2u[m[1]][m[2]];3A("f = q(a,i){"+(m[1]=="@"?"z=6.1t(a,m[3]);":"")+"v "+f+"}");r=g(r,f)}}v{r:r,t:t}},2K:q(t){v t.1B(/^\\s+|\\s+$/g,"")},3L:q(F){u 47=[];u 1l=F.1i;24(1l&&1l!=17){47.1k(1l);1l=1l.1i}v 47},1x:q(F,2j,2t){u 14=[];l(F){u 2k=F.1i.2f;I(u i=0;i<2k.D;i++){l(2t===T&&2k[i]==F)51;l(2k[i].1R==1)14.1k(2k[i]);l(2k[i]==F)14.n=14.D-1}}v 6.1y(14,{1N:14.n==14.D-1,1l:2j=="52"&&14.n%2==0||2j=="53"&&14.n%2||14[2j]==F,4j:14[14.n-1],3z:14[14.n+1]})},1X:q(2h,35){u 1J=[];I(u k=0;k<2h.D;k++)1J[k]=2h[k];I(u i=0;i<35.D;i++){u 48=T;I(u j=0;j<2h.D;j++)l(35[i]==2h[j])48=U;l(48)1J.1k(35[i])}v 1J},2O:q(14,C,4a){l(C.O==1C)C=1h 1v("a","i","v "+C);u 1J=[];I(u i=0;i<14.D;i++)l(!4a&&C(14[i],i)||4a&&!C(14[i],i))1J.1k(14[i]);v 1J},2r:q(14,C){l(C.O==1C)C=1h 1v("a","v "+C);u 1J=[];I(u i=0;i<14.D;i++){u 1D=C(14[i],i);l(1D!==M&&1D!=Q){l(1D.O!=2z)1D=[1D];1J=6.1X(1J,1D)}}v 1J},J:{2g:q(P,B,1H){l(6.11.1p&&P.42!=Q)P=1z;l(!1H.2q)1H.2q=7.2q++;l(!P.1E)P.1E={};u 2W=P.1E[B];l(!2W){2W=P.1E[B]={};l(P["2N"+B])2W[0]=P["2N"+B]}2W[1H.2q]=1H;P["2N"+B]=7.58;l(!7.1e[B])7.1e[B]=[];7.1e[B].1k(P)},2q:1,1e:{},25:q(P,B,1H){l(P.1E)l(B&&P.1E[B])l(1H)57 P.1E[B][1H.2q];G I(u i 1r P.1E[B])57 P.1E[B][i];G I(u j 1r P.1E)7.25(P,j)},1P:q(B,K,P){K=K||[];l(!P){u g=7.1e[B];l(g)I(u i=0;i<g.D;i++)7.1P(B,K,g[i])}G l(P["2N"+B]){K.59(7.2m({B:B,2G:P}));P["2N"+B].16(P,K)}},58:q(J){l(1T 6=="Q")v U;J=J||6.J.2m(1z.J);l(!J)v U;u 3m=T;u c=7.1E[J.B];u 1g=[].7h.3O(19,1);1g.59(J);I(u j 1r c){l(c[j].16(7,1g)===U){J.4p();J.5a();3m=U}}v 3m},2m:q(J){l(6.11.1p){J=1z.J;J.2G=J.7i}G l(6.11.2M&&J.2G.1R==3){J=6.1y({},J);J.2G=J.2G.1i}J.4p=q(){7.3m=U};J.5a=q(){7.7l=T};v J}}});1h q(){u b=5I.5K.4d();6.11={2M:/5e/.28(b),30:/30/.28(b),1p:/1p/.28(b)&&!/30/.28(b),2I:/2I/.28(b)&&!/(7m|5e)/.28(b)};6.7n=!6.11.1p||17.7o=="7p"};6.2e={2o:{4H:"5g",7q:"5h",2Y:"5i",7r:"5j"},1f:"2c,1G,7s,5l,2H,3p,3h,7t,7u".3b(","),1c:["5n","5o","5X","5p"],1t:{1D:"Y",38:"2V",3H:M,7x:M,1d:M,7z:M,3w:M,7A:M},5r:{5s:"a.1i",7B:6.3L,3L:6.3L,3z:"6.1x(a).3z",4j:"6.1x(a).4j",2k:"6.1x(a, M, T)",7C:"6.1x(a.2a)"},W:{5u:q(1L){7.7E(1L)},1A:q(){7.1a.1u=7.2A?7.2A:"";l(6.1f(7,"1u")=="20")7.1a.1u="2F"},1s:q(){7.2A=7.2A||6.1f(7,"1u");l(7.2A=="20")7.2A="2F";7.1a.1u="20"},4o:q(){6(7)[6(7).4E(":1S")?"1A":"1s"].16(6(7),19)},7F:q(c){6.1j.2g(7,c)},7G:q(c){6.1j.25(7,c)},7H:q(c){6.1j[6.1j.3t(7,c)?"25":"2g"](7,c)},25:q(a){l(!a||6.1c(a,[7]).r)7.1i.3s(7)},5B:q(){24(7.2a)7.3s(7.2a)},2Z:q(B,C){l(C.O==1C)C=1h 1v("e",(!C.1b(".")?"6(7)":"v ")+C);6.J.2g(7,B,C)},4C:q(B,C){6.J.25(7,B,C)},1P:q(B,K){6.J.1P(B,K,7)}}};6.5C();6.C.1y({5E:6.C.4o,4o:q(a,b){v a&&b&&a.O==1v&&b.O==1v?7.5M(q(e){7.1N=7.1N==a?b:a;e.4p();v 7.1N.16(7,[e])||U}):7.5E.16(7,19)},7K:q(f,g){q 4r(e){u p=(e.B=="3C"?e.7M:e.7N)||e.7O;24(p&&p!=7)3u{p=p.1i}3o(e){p=7};l(p==7)v U;v(e.B=="3C"?f:g).16(7,[e])}v 7.3C(4r).5Q(4r)},1W:q(f){l(6.3y)f.16(17);G{6.2C.1k(f)}v 7}});6.1y({3y:U,2C:[],1W:q(){l(!6.3y){6.3y=T;l(6.2C){I(u i=0;i<6.2C.D;i++)6.2C[i].16(17);6.2C=M}l(6.11.2I||6.11.30)17.7P("5T",6.1W,U)}}});1h q(){u e=("7R,7S,2S,7T,7U,4z,5M,7V,"+"7X,7Y,81,3C,5Q,83,4w,3c,"+"4x,86,87,88,2l").3b(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v f?7.2Z(o,f):7.1P(o)};6.C["89"+o]=q(f){v 7.4C(o,f)};6.C["8a"+o]=q(f){u P=6(7);u 1H=q(){P.4C(o,1H);P=M;f.16(7,19)};v 7.2Z(o,1H)}};l(6.11.2I||6.11.30){17.8c("5T",6.1W,U)}G l(6.11.1p){17.8d("<8e"+"8f 3H=5W 8n=T "+"3w=//:><\\/27>");u 27=17.5V("5W");27.2w=q(){l(7.3n!="1I")v;7.1i.3s(7);6.1W()};27=M}G l(6.11.2M){6.3N=42(q(){l(17.3n=="63"||17.3n=="1I"){56(6.3N);6.3N=M;6.1W()}},10)}6.J.2g(1z,"2S",6.1W)};l(6.11.1p)6(1z).4z(q(){u J=6.J,1e=J.1e;I(u B 1r 1e){u 3P=1e[B],i=3P.D;l(i>0)6a l(B!=\'4z\')J.25(3P[i-1],B);24(--i)}});6.C.1y({60:6.C.1A,1A:q(12,H){v 12?7.1U({1G:"1A",2c:"1A",1m:"1A"},12,H):7.60()},5U:6.C.1s,1s:q(12,H){v 12?7.1U({1G:"1s",2c:"1s",1m:"1s"},12,H):7.5U()},6n:q(12,H){v 7.1U({1G:"1A"},12,H)},6o:q(12,H){v 7.1U({1G:"1s"},12,H)},6p:q(12,H){v 7.W(q(){u 4J=6(7).4E(":1S")?"1A":"1s";6(7).1U({1G:4J},12,H)})},6r:q(12,H){v 7.1U({1m:"1A"},12,H)},6s:q(12,H){v 7.1U({1m:"1s"},12,H)},6t:q(12,2o,H){v 7.1U({1m:2o},12,H)},1U:q(E,12,H){v 7.1w(q(){7.2U=6.1y({},E);I(u p 1r E){u e=1h 6.2R(7,6.12(12,H),p);l(E[p].O==4O)e.3e(e.1l(),E[p]);G e[E[p]](E)}})},1w:q(B,C){l(!C){C=B;B="2R"}v 7.W(q(){l(!7.1w)7.1w={};l(!7.1w[B])7.1w[B]=[];7.1w[B].1k(C);l(7.1w[B].D==1)C.16(7)})}});6.1y({5f:q(e,p){l(e.5F)v;l(p=="1G"&&e.4L!=3l(6.26(e,p)))v;l(p=="2c"&&e.4M!=3l(6.26(e,p)))v;u a=e.1a[p];u o=6.26(e,p,1);l(p=="1G"&&e.4L!=o||p=="2c"&&e.4M!=o)v;e.1a[p]=e.34?"":"5H";u n=6.26(e,p,1);l(o!=n&&n!="5H"){e.1a[p]=a;e.5F=T}},12:q(s,o){o=o||{};l(o.O==1v)o={1I:o};u 5D={6G:6H,6J:4K};o.2E=(s&&s.O==4O?s:5D[s])||5k;o.3J=o.1I;o.1I=q(){6.4R(7,"2R");l(o.3J&&o.3J.O==1v)o.3J.16(7)};v o},1w:{},4R:q(F,B){B=B||"2R";l(F.1w&&F.1w[B]){F.1w[B].4h();u f=F.1w[B][0];l(f)f.16(F)}},2R:q(F,2x,E){u z=7;z.o={2E:2x.2E||5k,1I:2x.1I,2s:2x.2s};z.V=F;u y=z.V.1a;z.a=q(){l(2x.2s)2x.2s.16(F,[z.2i]);l(E=="1m")6.1t(y,"1m",z.2i);G l(3l(z.2i))y[E]=3l(z.2i)+"5d";y.1u="2F"};z.61=q(){v 4c(6.1f(z.V,E))};z.1l=q(){u r=4c(6.26(z.V,E));v r&&r>-6Z?r:z.61()};z.3e=q(41,2o){z.3M=(1h 54()).55();z.2i=41;z.a();z.49=42(q(){z.2s(41,2o)},13)};z.1A=q(){l(!z.V.1Q)z.V.1Q={};z.V.1Q[E]=7.1l();z.3e(0,z.V.1Q[E]);l(E!="1m")y[E]="77"};z.1s=q(){l(!z.V.1Q)z.V.1Q={};z.V.1Q[E]=7.1l();z.o.1s=T;z.3e(z.V.1Q[E],0)};l(!z.V.4b)z.V.4b=6.1f(z.V,"3h");y.3h="1S";z.2s=q(4B,4g){u t=(1h 54()).55();l(t>z.o.2E+z.3M){56(z.49);z.49=M;z.2i=4g;z.a();z.V.2U[E]=T;u 1K=T;I(u i 1r z.V.2U)l(z.V.2U[i]!==T)1K=U;l(1K){y.3h=z.V.4b;l(z.o.1s)y.1u=\'20\';l(z.o.1s){I(u p 1r z.V.2U){l(p=="1m")6.1t(y,p,z.V.1Q[p]);G y[p]=z.V.1Q[p]+"5d";l(p==\'1G\'||p==\'2c\')6.5f(z.V,p)}}}l(1K&&z.o.1I&&z.o.1I.O==1v)z.o.1I.16(z.V)}G{u p=(t-7.3M)/z.o.2E;z.2i=((-5q.7w(p*5q.7y)/2)+0.5)*(4g-4B)+4B;z.a()}}}});6.C.1y({7D:q(N,1O,H){7.2S(N,1O,H,1)},2S:q(N,1O,H,1F){l(N.O==1v)v 7.2Z("2S",N);H=H||q(){};u B="3T";l(1O){l(1O.O==1v){H=1O;1O=M}G{1O=6.2Q(1O);B="4W"}}u 4m=7;6.3I(B,N,1O,q(3v,18){l(18=="2D"||!1F&&18=="5m"){4m.38(3v.3G).3X().W(H,[3v.3G,18])}G H.16(4m,[3v.3G,18])},1F);v 7},7J:q(){v 6.2Q(7)},3X:q(){v 7.1V(\'27\').W(q(){l(7.3w)6.5Y(7.3w,q(){});G 3A.3O(1z,7.2B||7.7L||7.2V||"")}).4q()}});l(6.11.1p&&1T 3i=="Q")3i=q(){v 1h 7Q(5I.5K.1b("7W 5")>=0?"82.5R":"84.5R")};1h q(){u e="5O,5G,5A,5x,5t".3b(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v 7.2Z(o,f)}}};6.1y({1n:q(N,K,H,B,1F){l(K&&K.O==1v){B=H;H=K;K=M}l(K)N+=((N.1b("?")>-1)?"&":"?")+6.2Q(K);6.3I("3T",N,M,q(r,18){l(H)H(6.3r(r,B),18)},1F)},8h:q(N,K,H,B){6.1n(N,K,H,B,1)},5Y:q(N,H){l(H)6.1n(N,M,H,"27");G{6.1n(N,M,M,"27")}},64:q(N,K,H){l(H)6.1n(N,K,H,"3S");G{6.1n(N,K,"3S")}},8o:q(N,K,H,B){6.3I("4W",N,6.2Q(K),q(r,18){l(H)H(6.3r(r,B),18)})},1q:0,6h:q(1q){6.1q=1q},39:{},3I:q(B,N,K,L,1F){u 1e=T;u 1q=6.1q;l(!N){L=B.1I;u 2D=B.2D;u 2l=B.2l;u 4k=B.4k;u 1e=1T B.1e=="6q"?B.1e:T;u 1q=1T B.1q=="6u"?B.1q:6.1q;1F=B.1F||U;K=B.K;N=B.N;B=B.B}l(1e&&!6.4v++)6.J.1P("5O");u 4y=U;u R=1h 3i();R.6B(B||"3T",N,T);l(K)R.3j("6I-6K","6M/x-6N-6Q-6T");l(1F)R.3j("6V-3Y-6Y",6.39[N]||"71, 74 75 78 46:46:46 79");R.3j("X-7a-7d","3i");l(R.7g)R.3j("7j","7k");u 2w=q(4F){l(R&&(R.3n==4||4F=="1q")){4y=T;u 18=6.4G(R)&&4F!="1q"?1F&&6.4N(R,N)?"5m":"2D":"2l";l(18!="2l"){u 3q;3u{3q=R.4i("4P-3Y")}3o(e){}l(1F&&3q)6.39[N]=3q;l(2D)2D(6.3r(R,4k),18);l(1e)6.J.1P("5t")}G{l(2l)2l(R,18);l(1e)6.J.1P("5x")}l(1e)6.J.1P("5A");l(1e&&!--6.4v)6.J.1P("5G");l(L)L(R,18);R.2w=q(){};R=M}};R.2w=2w;l(1q>0)7Z(q(){l(R){R.85();l(!4y)2w("1q");R=M}},1q);R.8i(K)},4v:0,4G:q(r){3u{v!r.18&&66.6d=="3Q:"||(r.18>=4K&&r.18<6y)||r.18==5b||6.11.2M&&r.18==Q}3o(e){}v U},4N:q(R,N){3u{u 4V=R.4i("4P-3Y");v R.18==5b||4V==6.39[N]||6.11.2M&&R.18==Q}3o(e){}v U},3r:q(r,B){u 4n=r.4i("7I-B");u K=!B&&4n&&4n.1b("R")>=0;K=B=="R"||K?r.80:r.3G;l(B=="27")3A.3O(1z,K);l(B=="3S")3A("K = "+K);l(B=="38")$("<21>").38(K).3X();v K},2Q:q(a){u s=[];l(a.O==2z||a.3E){I(u i=0;i<a.D;i++)s.1k(a[i].1d+"="+50(a[i].Y))}G{I(u j 1r a)s.1k(j+"="+50(a[j]))}v s.5Z("&")}})}',62,521,'||||||jQuery|this||||||||||||||if|||||function||||var|return||||||type|fn|length|prop|elem|else|callback|for|event|data|ret|null|url|constructor|element|undefined|xml||true|false|el|each||value|||browser|speed||elems|obj|apply|document|status|arguments|style|indexOf|filter|name|global|css|args|new|parentNode|className|push|cur|opacity|get|context|msie|timeout|in|hide|attr|display|Function|queue|sibling|extend|window|show|replace|String|val|events|ifModified|height|handler|complete|result|done|key|arg|last|params|trigger|orig|nodeType|hidden|typeof|animate|find|ready|merge|wrap|old|none|div|table|num|while|remove|curCSS|script|test|tbody|firstChild|toUpperCase|width|fn2|macros|childNodes|add|first|now|pos|siblings|error|fix|pushStack|to|nodeName|guid|map|step|not|expr|re|onreadystatechange|options|cssFloat|Array|oldblock|text|readyList|success|duration|block|target|position|mozilla|checked|trim|classes|safari|on|grep|disabled|param|fx|load|domManip|curAnim|innerHTML|handlers|dir|insertBefore|bind|opera|parPos|substr|stack|currentStyle|second|foundToken|styleFloat|html|lastModified|getAttribute|split|select|exec|custom|cloneNode|defaultView|overflow|XMLHttpRequest|setRequestHeader|alpha|parseInt|returnValue|readyState|catch|float|modRes|httpData|removeChild|has|try|res|src|child|isReady|next|eval|token|mouseover|clean|jquery|oWidth|responseText|id|ajax|oldComplete|oHeight|parents|startTime|safariTimer|call|els|file|static|json|GET|visibility|selected|radio|evalScripts|Modified|re2|getAll|from|setInterval|RegExp|_|break|00|matched|noCollision|timer|inv|oldOverflow|parseFloat|toLowerCase|appendChild|clone|lastNum|shift|getResponseHeader|prev|dataType|oid|self|ct|toggle|preventDefault|end|handleHover|button|tr|getComputedStyle|active|reset|submit|requestDone|unload|swap|firstNum|unbind|deep|is|istimeout|httpSuccess|appendTo|force|state|200|scrollHeight|scrollWidth|httpNotModified|Number|Last|documentElement|dequeue|getElementsByTagName|match|100|xmlRes|POST|parse|z0|nodeValue|encodeURIComponent|continue|even|odd|Date|getTime|clearInterval|delete|handle|unshift|stopPropagation|304|gi|px|webkit|setAuto|append|prepend|before|after|400|left|notmodified|eq|lt|contains|Math|axis|parent|ajaxSuccess|removeAttr|password|image|ajaxError|checkbox|input|ajaxComplete|empty|init|ss|_toggle|notAuto|ajaxStop|auto|navigator|size|userAgent|nth|click|createElement|ajaxStart|getPropertyValue|mouseout|XMLHTTP|newProp|DOMContentLoaded|_hide|getElementById|__ie_init|gt|getScript|join|_show|max|THEAD|loaded|getJSON|initDone|location|splice|Top|Right|do|padding|border|protocol|Width|offsetHeight|offsetWidth|ajaxTimeout|absolute|right|relative|clientHeight|clientWidth|slideDown|slideUp|slideToggle|boolean|fadeIn|fadeOut|fadeTo|number|opt|thead|td|300|th|createTextNode|open|toString|only|visible|enabled|slow|600|Content|fast|Type|textarea|application|www|Bottom|class|form|readonly|readOnly|urlencoded|zoom|If|9999|FORM|Since|10000|getAttributeNode|Thu|setAttribute|ig|01|Jan|9_|1px|1970|GMT|Requested|tagName|Left|With|method|action|overrideMimeType|slice|srcElement|Connection|close|cancelBubble|compatible|boxModel|compatMode|CSS1Compat|prependTo|insertAfter|top|color|background|htmlFor|cos|title|PI|href|rel|ancestors|children|loadIfModified|removeAttribute|addClass|removeClass|toggleClass|content|serialize|hover|textContent|fromElement|toElement|relatedTarget|removeEventListener|ActiveXObject|blur|focus|resize|scroll|dblclick|MSIE|mousedown|mouseup|setTimeout|responseXML|mousemove|Microsoft|change|Msxml2|abort|keydown|keypress|keyup|un|one|prototype|addEventListener|write|scr|ipt|index|getIfModified|send|nextSibling|pop|Boolean|TABLE|defer|post'.split('|'),0,{}))
diff --git a/extra/fjsc/summary.txt b/extra/fjsc/summary.txt
new file mode 100644 (file)
index 0000000..81bc3dc
--- /dev/null
@@ -0,0 +1 @@
+A 'subset of Factor' to Javascript compiler
diff --git a/extra/freetype/authors.txt b/extra/freetype/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/freetype/freetype.factor b/extra/freetype/freetype.factor
new file mode 100644 (file)
index 0000000..b7fc1d6
--- /dev/null
@@ -0,0 +1,180 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax kernel system combinators ;
+IN: freetype
+
+: load-freetype-library ( -- )
+    "freetype" {
+        { [ macosx? ] [ "@executable_path/../Frameworks/libfreetype.6.dylib" "cdecl" add-library ] }
+        { [ windows? ] [ "freetype6.dll" "cdecl" add-library ] }
+        { [ t ] [ drop ] }
+    } cond ; parsing
+
+load-freetype-library
+
+LIBRARY: freetype
+
+TYPEDEF: uchar FT_Byte
+TYPEDEF: void* FT_Bytes
+TYPEDEF: char FT_Char
+TYPEDEF: int FT_Int
+TYPEDEF: int FT_Int32
+TYPEDEF: uint FT_UInt
+TYPEDEF: short FT_Short
+TYPEDEF: ushort FT_UShort
+TYPEDEF: long FT_Long
+TYPEDEF: ulong FT_ULong
+TYPEDEF: uchar FT_Bool
+TYPEDEF: cell FT_Offset
+TYPEDEF: int FT_PtrDist
+TYPEDEF: char FT_String
+TYPEDEF: int FT_Tag
+TYPEDEF: int FT_Error
+TYPEDEF: long FT_Fixed
+TYPEDEF: void* FT_Pointer
+TYPEDEF: long FT_Pos
+TYPEDEF: ushort FT_UFWord
+TYPEDEF: short FT_F2Dot14
+TYPEDEF: long FT_F26Dot6
+
+FUNCTION: FT_Error FT_Init_FreeType ( void* library ) ;
+
+! circular reference between glyph and face
+TYPEDEF: void face
+TYPEDEF: void glyph
+
+C-STRUCT: glyph
+    { "void*" "library" }
+    { "face*" "face" }
+    { "glyph*" "next" }
+    { "FT_UInt" "reserved" }
+    { "void*" "generic" }
+    { "void*" "generic" }
+
+    { "FT_Pos" "width" }
+    { "FT_Pos" "height" }
+                  
+    { "FT_Pos" "hori-bearing-x" }
+    { "FT_Pos" "hori-bearing-y" }
+    { "FT_Pos" "hori-advance" }
+                  
+    { "FT_Pos" "vert-bearing-x" }
+    { "FT_Pos" "vert-bearing-y" }
+    { "FT_Pos" "vert-advance" }
+
+    { "FT_Fixed" "linear-hori-advance" }
+    { "FT_Fixed" "linear-vert-advance" }
+    { "FT_Pos" "advance-x" }
+    { "FT_Pos" "advance-y" }
+                    
+    { "long" "format" }
+                    
+    { "int" "bitmap-rows" }
+    { "int" "bitmap-width" }
+    { "int" "bitmap-pitch" }
+    { "void*" "bitmap-buffer" }
+    { "short" "bitmap-num-grays" }
+    { "char" "bitmap-pixel-mode" }
+    { "char" "bitmap-palette-mode" }
+    { "void*" "bitmap-palette" }
+
+    { "FT_Int" "bitmap-left" }
+    { "FT_Int" "bitmap-top" }
+
+    { "short" "n-contours" }
+    { "short" "n-points" }
+
+    { "void*" "points" }
+    { "char*" "tags" }
+    { "short*" "contours" }
+
+    { "int" "outline-flags" }
+                    
+    { "FT_UInt" "num_subglyphs" }
+    { "void*" "subglyphs" }
+                    
+    { "void*" "control-data" }
+    { "long" "control-len" }
+                    
+    { "FT_Pos" "lsb-delta" }
+    { "FT_Pos" "rsb-delta" }
+                    
+    { "void*" "other" } ;
+
+C-STRUCT: face-size
+    { "face*" "face" }
+    { "void*" "generic" }
+    { "void*" "generic" }
+
+    { "FT_UShort" "x-ppem" }
+    { "FT_UShort" "y-ppem" }
+                     
+    { "FT_Fixed" "x-scale" }
+    { "FT_Fixed" "y-scale" }
+                     
+    { "FT_Pos" "ascender" }
+    { "FT_Pos" "descender" }
+    { "FT_Pos" "height" }
+    { "FT_Pos" "max-advance" } ;
+
+C-STRUCT: face
+    { "FT_Long" "num-faces" }
+    { "FT_Long" "index" }
+                      
+    { "FT_Long" "flags" }
+    { "FT_Long" "style-flags" }
+                      
+    { "FT_Long" "num-glyphs" }
+                      
+    { "FT_Char*" "family-name" }
+    { "FT_Char*" "style-name" }
+                      
+    { "FT_Int" "num-fixed-sizes" }
+    { "void*" "available-sizes" }
+                      
+    { "FT_Int" "num-charmaps" }
+    { "void*" "charmaps" }
+                      
+    { "void*" "generic" }
+    { "void*" "generic" }
+                      
+    { "FT_Pos" "x-min" }
+    { "FT_Pos" "y-min" }
+    { "FT_Pos" "x-max" }
+    { "FT_Pos" "y-max" }
+                      
+    { "FT_UShort" "units-per-em" }
+    { "FT_Short" "ascender" }
+    { "FT_Short" "descender" }
+    { "FT_Short" "height" }
+                      
+    { "FT_Short" "max-advance-width" }
+    { "FT_Short" "max-advance-height" }
+                      
+    { "FT_Short" "underline-position" }
+    { "FT_Short" "underline-thickness" }
+                      
+    { "glyph*" "glyph" }
+    { "face-size*" "size" }
+    { "void*" "charmap" } ;
+
+FUNCTION: FT_Error FT_New_Face ( void* library, FT_Char* font, FT_Long index, face* face ) ;
+
+FUNCTION: FT_Error FT_Set_Char_Size ( face* face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horizontal_dpi, FT_UInt vertical_dpi ) ;
+
+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 ;
+
+FUNCTION: int FT_Render_Glyph ( glyph* slot, int render_mode ) ;
+
+FUNCTION: void FT_Done_Face ( face* face ) ;
+
+FUNCTION: void FT_Done_FreeType ( void* library ) ;
+
+FUNCTION: FT_Long FT_MulFix ( FT_Long a, FT_Long b ) ;
diff --git a/extra/freetype/summary.txt b/extra/freetype/summary.txt
new file mode 100644 (file)
index 0000000..48506b0
--- /dev/null
@@ -0,0 +1 @@
+FreeType text rendering library binding
diff --git a/extra/freetype/tags.txt b/extra/freetype/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/furnace/furnace-tests.factor b/extra/furnace/furnace-tests.factor
new file mode 100644 (file)
index 0000000..85fc6c8
--- /dev/null
@@ -0,0 +1,47 @@
+USING: kernel sequences namespaces math tools.test furnace furnace.validator ;
+IN: temporary
+
+TUPLE: test-tuple m n ;
+
+[ H{ { "m" 3 } { "n" 2 } } ]
+[
+    [ T{ test-tuple f 3 2 } explode-tuple ] H{ } make-assoc
+] unit-test
+
+[
+    { 3 }
+] [
+    H{ { "n" "3" } } { { "n" v-number } }
+    [ action-param drop ] curry* map
+] unit-test
+
+: foo ;
+
+\ foo { { "foo" "2" v-default } { "bar" v-required } } define-action
+
+[ t ] [ [ 1 2 foo ] action-call? ] unit-test
+[ f ] [ [ 2 + ] action-call? ] unit-test
+
+[
+    { "2" "hello" }
+] [
+    [
+        H{
+            { "bar" "hello" }
+        } \ foo query>quot
+    ] with-scope
+] unit-test
+
+[
+    H{ { "foo" "1" } { "bar" "2" } }
+] [
+    { "1" "2" } \ foo quot>query
+] unit-test
+
+[
+    "/responder/temporary/foo?foo=3"
+] [
+    [
+        [ "3" foo ] quot-link
+    ] with-scope
+] unit-test
diff --git a/extra/furnace/furnace.factor b/extra/furnace/furnace.factor
new file mode 100644 (file)
index 0000000..8a475b9
--- /dev/null
@@ -0,0 +1,143 @@
+! Copyright (C) 2006 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel vectors io assocs quotations splitting strings 
+       words sequences namespaces arrays hashtables debugger
+       continuations tuples classes io.files 
+       http http.server.templating http.basic-authentication 
+       http.server.responders.callback html html.elements 
+       http.server.responders furnace.validator ;
+IN: furnace
+
+SYMBOL: default-action
+
+SYMBOL: template-path
+
+: define-authenticated-action ( word params realm -- )
+    pick swap "action-realm" set-word-prop
+    over t "action" set-word-prop
+    "action-params" set-word-prop ;
+
+: define-action ( word params -- )
+    f define-authenticated-action ;
+
+: define-redirect ( word quot -- )
+    "action-redirect" set-word-prop ;
+
+: responder-vocab ( name -- vocab )
+    "webapps." swap append ;
+
+: lookup-action ( name webapp -- word )
+    responder-vocab lookup dup [
+        dup "action" word-prop [ drop f ] unless
+    ] when ;
+
+: truncate-url ( url -- action-name )
+  CHAR: / over index [ head ] when* ;
+
+: current-action ( url -- word/f )
+    dup empty? [ drop default-action get ] when
+    truncate-url "responder" get lookup-action ;
+
+PREDICATE: word action "action" word-prop ;
+
+: quot>query ( seq action -- hash )
+    >r >array r> "action-params" word-prop
+    [ first swap 2array ] 2map >hashtable ;
+
+: action-link ( query action -- url )
+    [
+        "/responder/" %
+        dup word-vocabulary "webapps." ?head drop %
+        "/" %
+        word-name %
+    ] "" make swap build-url ;
+
+: action-call? ( quot -- ? )
+    >vector dup pop action? >r [ word? not ] all? r> and ;
+
+: unclip* dup 1 head* swap peek ;
+
+: quot-link ( quot -- url )
+    dup action-call? [
+        unclip* [ quot>query ] keep action-link
+    ] [
+        t register-html-callback
+    ] if ;
+
+: render-link ( quot name -- )
+    <a swap quot-link =href a> write </a> ;
+
+: action-param ( params paramspec -- obj error/f )
+    unclip rot at swap >quotation apply-validators ;
+
+: query>quot ( params action -- seq )
+    "action-params" word-prop [ action-param drop ] curry* map ;
+
+SYMBOL: request-params
+
+: perform-redirect ( action -- )
+    "action-redirect" word-prop
+    [ dup string? [ request-params get at ] when ] map
+    [ quot-link permanent-redirect ] when* ;
+
+: (call-action) ( params action -- )
+    over request-params set
+    [ query>quot ] keep [ add >quotation call ] keep
+    perform-redirect ;
+
+: call-action ( params action -- )
+    dup "action-realm" word-prop [
+        [ (call-action) ] with-basic-authentication
+    ] [ (call-action) ] if* ;
+
+: service-request ( params url -- )
+    current-action [
+        [ call-action ] [ <pre> print-error </pre> ] recover
+    ] [
+        "404 no such action: " "argument" get append httpd-error
+    ] if* ;
+
+: service-get ( url -- ) "query" get swap service-request ;
+
+: service-post ( url -- ) "response" get swap service-request ;
+
+: explode-tuple ( tuple -- )
+    dup tuple-slots swap class "slot-names" word-prop
+    [ set ] 2each ;
+
+SYMBOL: model
+
+: call-template ( model template -- )
+    [
+        >r [ dup model set explode-tuple ] when* r>
+        ".furnace" append resource-path run-template-file
+    ] with-scope ;
+
+: render-template ( model template -- )
+    template-path get swap path+ call-template ;
+
+: render-page* ( model body-template head-template -- )
+    [
+        [ render-template ] [ f rot render-template ] html-document* 
+    ] serve-html ;
+
+: render-titled-page* ( model body-template head-template title -- )
+    [ 
+        [ render-template ] swap [ <title> write </title> f rot render-template ] curry html-document* 
+    ] serve-html ;
+
+
+: render-page ( model template title -- )
+    [
+        [ render-template ] html-document
+    ] serve-html ;
+
+: web-app ( name default path -- )
+    [
+        template-path set
+        default-action set
+        "responder" set
+        [ service-get ] "get" set
+        [ service-post ] "post" set
+        ! [ service-head ] "head" set
+    ] make-responder ;
diff --git a/extra/furnace/scaffold/crud-templates/edit.furnace b/extra/furnace/scaffold/crud-templates/edit.furnace
new file mode 100644 (file)
index 0000000..249ad0a
--- /dev/null
@@ -0,0 +1,21 @@
+<% USING: namespaces io kernel furnace words prettyprint
+generic sequences parser ; %>
+
+<% "model" get %>
+
+<form action="<% dup class dup word-vocabulary use+ unparse write %>-update" method="post">
+
+<% dup crud-index [ %>
+
+<input type="hidden" name="crud-index" value="<% write %>"/>
+
+<% ] when* %>
+
+<table>
+
+<% dup tuple-slots swap class "slot-names" word-prop [ %> <tr><td><% dup write %>:</td>
+    <td><input type="text" name="<% write %>" value="<% write %>"/></td></tr><% ] 2each %>
+    
+</table>
+<input type="submit" name="submit" value="submit"/>
+</form>
\ No newline at end of file
diff --git a/extra/furnace/scaffold/crud-templates/list.furnace b/extra/furnace/scaffold/crud-templates/list.furnace
new file mode 100644 (file)
index 0000000..a472f29
--- /dev/null
@@ -0,0 +1,27 @@
+<% USING: namespaces kernel io sequences generic words
+prettyprint furnace parser ; %>
+
+<% "model" get dup sequence? not [ unparse %>
+<p><a href="<% write %>-new">New</a></p><% ] [ %>
+
+<p><a href="<% first class unparse write %>-new">New</a></p>
+
+<table>
+<% "model" get dup first class dup
+    word-vocabulary use+ "slot-names" word-prop %>
+<tr><% [ %><th><% write %></th><% ] each %></tr>
+
+<% [ %>
+    
+<tr><% dup tuple-slots [ %><td><% write %></td><% ] each %>
+    
+    <% dup crud-index swap class dup "crud-index" word-prop swap unparse %>
+    <td><a href="<% 3dup write %>-show?<% write %>=<% write %>">Show</a></td>
+    <td><a href="<% 3dup write %>-edit?<% write %>=<% write %>">Edit</a></td>
+    <td><a href="<% write %>-delete?<% write %>=<% write %>">Delete</a></td></tr>
+
+<% ] each %>
+
+</table>
+
+<% ] if %>
\ No newline at end of file
diff --git a/extra/furnace/scaffold/crud-templates/show.furnace b/extra/furnace/scaffold/crud-templates/show.furnace
new file mode 100644 (file)
index 0000000..3500f24
--- /dev/null
@@ -0,0 +1,20 @@
+<% USING: namespaces io kernel words generic sequences 
+prettyprint furnace parser ; %>
+
+<% "model" get [ %>
+
+<% dup tuple-slots over class dup
+    word-vocabulary use+ "slot-names" word-prop %>
+
+<table>
+    
+<% [ %><tr><td><% write %>:</td><td><% write %></td></tr><% ] 2each %>
+
+</table>
+
+<% dup crud-index swap class dup "crud-index" word-prop swap unparse %>
+<p><a href="<% 3dup write %>-edit?<% write %>=<% write %>">Edit</a> |
+    <a href="<% [ write %>-delete?<% write %>=<% write  ] keep %>">Delete</a> |
+    <a href="<% dup write %>-new">New</a> | <a href="<% write %>-list">List</a></p>
+
+<% ] [ %><p>No such tuple</p><% ] if* %>
\ No newline at end of file
diff --git a/extra/furnace/scaffold/scaffold.factor b/extra/furnace/scaffold/scaffold.factor
new file mode 100644 (file)
index 0000000..f0c2850
--- /dev/null
@@ -0,0 +1,123 @@
+USING: http.server help.markup help.syntax kernel prettyprint
+sequences parser namespaces words classes math tuples.private
+quotations arrays strings ;
+
+IN: furnace
+
+TUPLE: furnace-model model ;
+C: <furnace-model> furnace-model
+
+HELP: furnace-model "This definition exists to circumvent a limitation in furnace with regard to sending arbitrary objects as models to .furnace templates." ;
+
+: crud-create ( class string -- word )
+    swap unparse "-" rot 3append in get create ;
+
+HELP: crud-create
+{ $values { "class" class } { "string" string } { "word" word } }
+{ $description "A CRUD utility function - creates a new action word for a given class and suffix string" } ;
+
+: crud-word ( class string -- word )
+    swap unparse "-" rot 3append parse first ;
+HELP: crud-word
+{ $values { "class" class } { "string" string } { "word" word } }
+{ $description "A CRUD utility function - looks up a word that has been crud-created" } ;
+
+: crud-index ( tuple -- )
+    dup class dup "crud-index" word-prop crud-word execute ;
+
+: crud-lookup ( string class -- obj )
+    get-global [ crud-index = ] curry* subset
+    dup empty? [ drop f ] [ first ] if ;
+HELP: crud-lookup
+{ $values { "string" string } { "class" class } { "obj" object } }
+{ $description "A CRUD utility function - looks up an object in the store by the pre-designated index." } ;
+
+: crud-lookup* ( string class -- tuple )
+    tuck crud-lookup
+    [ ] [ dup "slot-names" word-prop length 2 + <tuple> ] ?if ;
+
+HELP: crud-lookup*
+{ $values { "string" string } { "class" class } { "tuple" tuple } }
+"A CRUD utility function - same as crud-lookup, but always returns a tuple of the given class.  When the lookup fails, returns a tuple of the given class with all slots set to f." ;
+
+: crud-page ( model template title -- )
+    [ "libs/furnace/crud-templates" template-path set render-page ]
+    with-scope ;
+
+: define-list ( class -- word )
+    dup "list" crud-create swap
+    [ dup get-global dup empty? -rot ? <furnace-model> "list" "List" crud-page ]
+    curry dupd define-compound ;
+
+: define-show ( class -- word )
+    dup "show" crud-create swap
+    [ crud-lookup <furnace-model> "show" "Show" crud-page ] 
+    curry dupd define-compound ;
+
+: define-edit ( class -- word )
+    dup "edit" crud-create swap
+    [ crud-lookup* <furnace-model> "edit" "Edit" crud-page ] 
+    curry dupd define-compound ;
+    
+: define-new ( class -- word )
+    dup "new" crud-create swap "edit" crud-word
+    [ f swap execute ]
+    curry dupd define-compound ;
+    
+: define-update ( class -- word )
+    dup "update" crud-create swap
+    [ 
+        tuck crud-lookup [ over get-global remove over set-global ] when* 
+        dup >r "constructor" word-prop execute
+        r> 2dup get-global swap add over set-global swap
+        crud-index swap "show" crud-word execute
+    ] curry dupd define-compound ;
+
+: define-delete ( class -- word )
+    dup "delete" crud-create swap
+    [ 
+        tuck crud-lookup [ over get-global remove over set-global ] when* 
+        "list" crud-word execute
+    ] curry dupd define-compound ;
+
+: define-lookup ( class -- )
+    dup "crud-index" word-prop ">" pick unparse 3append in get create
+    swap [ crud-lookup ] curry define-compound ;
+
+: define-lookup* ( class -- )
+    dup "crud-index" word-prop ">" pick unparse "*" append 3append 
+    in get create swap [ crud-lookup* ] curry define-compound ;
+
+: scaffold-params ( class -- array )
+    "crud-index" word-prop 1array 1array ;
+
+: scaffold ( class index realm -- )
+    -rot dupd "crud-index" set-word-prop
+    [ define-lookup ] keep [ define-lookup* ] keep
+    [ get-global [ { } over set-global ] unless ] keep
+    [ define-list { } rot define-authenticated-action ] 2keep
+    [ dup define-show swap scaffold-params rot 
+        define-authenticated-action ] 2keep
+    [ dup define-edit swap scaffold-params rot
+        define-authenticated-action ] 2keep
+    [ define-new { } rot define-authenticated-action ] 2keep
+    [ dup define-update swap "slot-names" word-prop 
+        "crud-index" add [ 1array ] map rot 
+        define-authenticated-action ] 2keep
+    dup define-delete swap scaffold-params rot
+    define-authenticated-action ;
+
+HELP: scaffold
+{ $values { "class" class } { "index" "an index" } { "realm" "a realm" } }
+"If realm is not f, then realm is used as the basic authentication realm for the scaffolding actions." ;
+
+ARTICLE: { "furnace" "crud" } "CRUD Scaffolding"
+{ $code 
+    "\"libs/furnace\" require"
+    "USING: furnace httpd threads ;"
+    "IN: furnace:crud-example"
+    "TUPLE: foo bar baz ;"
+    "\"crud-example\" \"foo-list\" f web-app"
+    "foo \"bar\" f scaffold"
+    "[ 8888 httpd ] in-thread"
+} ;
\ No newline at end of file
diff --git a/extra/furnace/validator/validator-tests.factor b/extra/furnace/validator/validator-tests.factor
new file mode 100644 (file)
index 0000000..06d8ac8
--- /dev/null
@@ -0,0 +1,30 @@
+IN: temporary
+USING: kernel sequences tools.test furnace.validator furnace ;
+
+[
+    123 f
+] [
+    H{ { "foo" "123" } } { "foo" v-number } action-param
+] unit-test
+
+: validation-fails
+    [ action-param nip not ] append [ f ] swap unit-test ;
+
+[ H{ { "foo" "12X3" } } { "foo" v-number } ] validation-fails
+
+[ H{ { "foo" "" } } { "foo" 4 v-min-length } ] validation-fails
+
+[ "ABCD" f ]
+[ H{ { "foo" "ABCD" } } { "foo" 4 v-min-length } action-param ]
+unit-test
+
+[ H{ { "foo" "ABCD" } } { "foo" 2 v-max-length } ]
+validation-fails
+
+[ "AB" f ]
+[ H{ { "foo" "AB" } } { "foo" 2 v-max-length } action-param ]
+unit-test
+
+[ "AB" f ]
+[ H{ { "foo" f } } { "foo" "AB" v-default } action-param ]
+unit-test
diff --git a/extra/furnace/validator/validator.factor b/extra/furnace/validator/validator.factor
new file mode 100644 (file)
index 0000000..698c77f
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2006 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel continuations sequences math namespaces math.parser ;
+IN: furnace.validator
+
+TUPLE: validation-error reason ;
+
+: apply-validators ( string quot -- obj error/f )
+    [
+        call f
+    ] [
+        dup validation-error? [ >r 2drop f r> ] [ rethrow ] if
+    ] recover ;
+
+: validation-error ( msg -- * )
+    \ validation-error construct-boa throw ;
+
+: v-default ( obj value -- obj )
+    over empty? [ nip ] [ drop ] if ;
+
+: v-required ( str -- str )
+    dup empty? [ "required" validation-error ] when ;
+
+: v-min-length ( str n -- str )
+    over length over < [
+        [ "must be at least " % # " characters" % ] "" make
+        validation-error
+    ] [
+        drop
+    ] if ;
+
+: v-max-length ( str n -- str )
+    over length over > [
+        [ "must be no more than " % # " characters" % ] "" make
+        validation-error
+    ] [
+        drop
+    ] if ;
+
+: v-number ( str -- n )
+    string>number [
+        "must be a number" validation-error
+    ] unless* ;
diff --git a/extra/gap-buffer/authors.txt b/extra/gap-buffer/authors.txt
new file mode 100644 (file)
index 0000000..e9c193b
--- /dev/null
@@ -0,0 +1 @@
+Alex Chapman
diff --git a/extra/gap-buffer/cursortree/authors.txt b/extra/gap-buffer/cursortree/authors.txt
new file mode 100644 (file)
index 0000000..e9c193b
--- /dev/null
@@ -0,0 +1 @@
+Alex Chapman
diff --git a/extra/gap-buffer/cursortree/cursortree-tests.factor b/extra/gap-buffer/cursortree/cursortree-tests.factor
new file mode 100644 (file)
index 0000000..36b5efd
--- /dev/null
@@ -0,0 +1,14 @@
+USING: kernel gap-buffer.cursortree tools.test sequences trees arrays strings ;
+
+[ t ] [ "this is a test string" <cursortree> 0 <left-cursor> at-beginning? ] unit-test
+[ t ] [ "this is a test string" <cursortree> dup length  <left-cursor> at-end? ] unit-test
+[ 3 ] [ "this is a test string" <cursortree> 3 <left-cursor> cursor-pos ] unit-test
+[ CHAR: i ] [ "this is a test string" <cursortree> 3 <left-cursor> element< ] unit-test
+[ CHAR: s ] [ "this is a test string" <cursortree> 3 <left-cursor> element> ] unit-test
+[ t ] [ "this is a test string" <cursortree> 3 <left-cursor> CHAR: a over set-element< CHAR: t over set-element> cursor-tree "that is a test string" sequence= ] unit-test
+[ t ] [ "this is a test string" <cursortree> 3 <left-cursor> 8 over set-cursor-pos dup 1array swap cursor-tree cursortree-cursors tree-values sequence= ] unit-test
+[ "this is no longer a test string" ] [ "this is a test string" <cursortree> 8 <left-cursor> "no longer " over insert cursor-tree >string ] unit-test
+[ "refactor" ] [ "factor" <cursortree> 0 <left-cursor> CHAR: e over insert CHAR: r over insert cursor-tree >string ] unit-test
+[ "refactor" ] [ "factor" <cursortree> 0 <right-cursor> CHAR: r over insert CHAR: e over insert cursor-tree >string ] unit-test
+[ "this a test string" 5 ] [ "this is a test string" <cursortree> 5 <right-cursor> dup delete> dup delete> dup delete> dup cursor-tree >string swap cursor-pos ] unit-test
+[ "this a test string" 5 ] [ "this is a test string" <cursortree> 8 <right-cursor> dup delete< dup delete< dup delete< dup cursor-tree >string swap cursor-pos ] unit-test
diff --git a/extra/gap-buffer/cursortree/cursortree.factor b/extra/gap-buffer/cursortree/cursortree.factor
new file mode 100644 (file)
index 0000000..de56770
--- /dev/null
@@ -0,0 +1,90 @@
+! Copyright (C) 2007 Alex Chapman All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel gap-buffer generic trees trees.avl-tree math sequences quotations ;
+IN: gap-buffer.cursortree
+
+TUPLE: cursortree cursors ;
+
+: <cursortree> ( seq -- cursortree )
+    <gb> cursortree construct-empty tuck set-delegate <avl-tree>
+    over set-cursortree-cursors ;
+
+GENERIC: cursortree-gb ( cursortree -- gb )
+M: cursortree cursortree-gb ( cursortree -- gb ) delegate ;
+GENERIC: set-cursortree-gb ( gb cursortree -- )
+M: cursortree set-cursortree-gb ( gb cursortree -- ) set-delegate ;
+
+TUPLE: cursor i tree ;
+TUPLE: left-cursor ;
+TUPLE: right-cursor ;
+
+: cursor-index ( cursor -- i ) cursor-i ; inline
+
+: add-cursor ( cursortree cursor -- ) dup cursor-index rot tree-insert ; 
+
+: remove-cursor ( cursortree cursor -- )
+    dup [ eq? ] curry swap cursor-index rot cursortree-cursors tree-delete-if ;
+
+: set-cursor-index ( index cursor -- )
+    dup cursor-tree over remove-cursor tuck set-cursor-i
+    dup cursor-tree cursortree-cursors swap add-cursor ;
+
+GENERIC: cursor-pos ( cursor -- n )
+GENERIC: set-cursor-pos ( n cursor -- )
+M: left-cursor cursor-pos ( cursor -- n ) [ cursor-i 1+ ] keep cursor-tree index>position ;
+M: right-cursor cursor-pos ( cursor -- n ) [ cursor-i ] keep cursor-tree index>position ;
+M: left-cursor set-cursor-pos ( n cursor -- ) >r 1- r> [ cursor-tree position>index ] keep set-cursor-index ;
+M: right-cursor set-cursor-pos ( n cursor -- ) [ cursor-tree position>index ] keep set-cursor-index ;
+
+: <cursor> ( cursortree -- cursor )
+    cursor construct-empty tuck set-cursor-tree ;
+
+: make-cursor ( cursortree pos cursor -- cursor )
+    >r swap <cursor> r> tuck set-delegate tuck set-cursor-pos ;
+
+: <left-cursor> ( cursortree pos -- left-cursor )
+    left-cursor construct-empty make-cursor ;
+
+: <right-cursor> ( cursortree pos -- right-cursor )
+    right-cursor construct-empty make-cursor ;
+
+: cursor-positions ( cursortree -- seq )
+    cursortree-cursors tree-values [ cursor-pos ] map ;
+
+M: cursortree move-gap ( n cursortree -- )
+    #! Get the position of each cursor before the move, then re-set the
+    #! position afterwards. This will update any changed cursor indices.
+    dup cursor-positions >r tuck cursortree-gb move-gap
+    cursortree-cursors tree-values r> swap [ set-cursor-pos ] 2each ;
+
+: element@< ( cursor -- pos cursortree ) [ cursor-pos 1- ] keep cursor-tree ;
+: element@> ( cursor -- pos cursortree ) [ cursor-pos ] keep cursor-tree ;
+
+: at-beginning? ( cursor -- ? ) cursor-pos 0 = ;
+: at-end? ( cursor -- ? ) element@> length = ;
+
+: insert ( obj cursor -- ) element@> insert* ;
+
+: element< ( cursor -- elem ) element@< nth ;
+: element> ( cursor -- elem ) element@> nth ;
+
+: set-element< ( elem cursor -- ) element@< set-nth ;
+: set-element> ( elem cursor -- ) element@> set-nth ;
+
+GENERIC: fix-cursor ( cursortree cursor -- )
+
+M: left-cursor fix-cursor ( cursortree cursor -- )
+    >r gb-gap-start 1- r> set-cursor-index ;
+
+M: right-cursor fix-cursor ( cursortree cursor -- )
+    >r gb-gap-end r> set-cursor-index ;
+
+: fix-cursors ( old-gap-end cursortree -- )
+    tuck cursortree-cursors tree-get-all [ fix-cursor ] curry* each ; 
+
+M: cursortree delete* ( pos cursortree -- )
+    tuck move-gap dup gb-gap-end swap dup (delete*) fix-cursors ;
+
+: delete< ( cursor -- ) element@< delete* ;
+: delete> ( cursor -- ) element@> delete* ;
+
diff --git a/extra/gap-buffer/cursortree/summary.txt b/extra/gap-buffer/cursortree/summary.txt
new file mode 100644 (file)
index 0000000..e57688f
--- /dev/null
@@ -0,0 +1 @@
+Collection of 'cursors' representing locations in a gap buffer
diff --git a/extra/gap-buffer/gap-buffer-tests.factor b/extra/gap-buffer/gap-buffer-tests.factor
new file mode 100644 (file)
index 0000000..85dc7b3
--- /dev/null
@@ -0,0 +1,40 @@
+USING: kernel sequences tools.test gap-buffer strings math ;
+
+! test copy-elements
+[ { 0 3 4 3 4 5 } ] [ { 0 1 2 3 4 5 } dup >r -2 3 5 r> copy-elements ] unit-test
+[ { 0 1 2 1 2 5 } ] [ { 0 1 2 3 4 5 } dup >r 2 2 0 r> copy-elements ] unit-test
+[ "01234567856" ] [ "01234567890" dup >r 4 6 4 r> copy-elements ] unit-test
+
+! test sequence protocol (like, length, nth, set-nth)
+[ "gap buffers are cool" ] [ "gap buffers are cool" <gb> "" like ] unit-test
+
+! test move-gap-back-inside
+[ t f ] [ 5 "0123456" <gb> move-gap-forward? >r move-gap-back-inside? 2nip r> ] unit-test
+[ "0123456" ] [ "0123456" <gb> 5 over move-gap >string ] unit-test
+! test move-gap-forward-inside
+[ t ] [ "I once ate a spaniel" <gb> 15 over move-gap 17 swap move-gap-forward-inside? 2nip ] unit-test
+[ "I once ate a spaniel" ] [ "I once ate a spaniel" <gb> 15 over move-gap 17 over move-gap >string ] unit-test
+! test move-gap-back-around
+[ f f ] [ 2 "terriers are ok too" <gb> move-gap-forward? >r move-gap-back-inside? 2nip r> ] unit-test
+[ "terriers are ok too" ] [ "terriers are ok too" <gb> 2 over move-gap >string ] unit-test
+! test move-gap-forward-around
+[ f t ] [ "god is nam's best friend" <gb> 2 over move-gap 22 over position>index swap move-gap-forward? >r move-gap-forward-inside? 2nip r> ] unit-test
+[ "god is nam's best friend" ] [ "god is nam's best friend" <gb> 2 over move-gap 22 over move-gap >string ] unit-test
+
+! test changing buffer contents
+[ "factory" ] [ "factor" <gb> CHAR: y 6 pick insert* >string ] unit-test
+! test inserting multiple elements in different places. buffer should grow
+[ "refractory" ] [ "factor" <gb> CHAR: y 6 pick insert* "re" 0 pick insert* CHAR: r 3 pick insert* >string ] unit-test
+! test deleting elements. buffer should shrink
+[ "for" ] [ "factor" <gb> 3 [ 1 over delete* ] times >string ] unit-test
+! more testing of nth and set-nth
+[ "raptor" ] [ "factor" <gb> CHAR: p 2 pick set-nth 5 over nth 0 pick set-nth >string ] unit-test
+
+! test stack/queue operations
+[ "slaughter" ] [ "laughter" <gb> CHAR: s over push-start >string ] unit-test
+[ "pantonio" ] [ "pant" <gb> "onio" over push-end >string ] unit-test
+[ CHAR: f "actor" ] [ "factor" <gb> dup pop-start swap >string ] unit-test
+[ CHAR: s "pant" ] [ "pants" <gb> dup pop-end swap >string ] unit-test
+[ "end this is the " ] [ "this is the end " <gb> 4 over rotate >string ] unit-test
+[ "your jedi training is finished " ] [ "finished your jedi training is " <gb> -9 over rotate >string ] unit-test
+
diff --git a/extra/gap-buffer/gap-buffer.factor b/extra/gap-buffer/gap-buffer.factor
new file mode 100644 (file)
index 0000000..75d5be4
--- /dev/null
@@ -0,0 +1,271 @@
+! Copyright (C) 2007 Alex Chapman All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! gap buffer -- largely influenced by Strandh and Villeneuve's Flexichain
+! for a good introduction see:
+! http://p-cos.net/lisp-ecoop/submissions/StrandhVilleneuveMoore.pdf
+USING: kernel arrays sequences sequences.private circular math generic ;
+IN: gap-buffer
+
+! gap-start     -- the first element of the gap
+! gap-end       -- the first element after the gap
+! expand-factor -- should be > 1
+! min-size      -- < 5 is not sensible
+
+TUPLE: gb
+    gap-start
+    gap-end
+    expand-factor
+    min-size ;
+
+GENERIC: gb-seq ( gb -- seq )
+GENERIC: set-gb-seq ( seq gb -- )
+M: gb gb-seq ( gb -- seq ) delegate ;
+M: gb set-gb-seq ( seq gb -- ) set-delegate ;
+
+: required-space ( n gb -- n )
+    tuck gb-expand-factor * ceiling >fixnum swap gb-min-size max ;
+
+: <gb> ( seq -- gb )
+    gb construct-empty
+    5 over set-gb-min-size
+    1.5 over set-gb-expand-factor
+    [ >r length r> set-gb-gap-start ] 2keep
+    [ swap length over required-space swap set-gb-gap-end ] 2keep
+    [
+        over length over required-space rot { } like resize-array <circular> swap set-gb-seq
+    ] keep ;
+
+M: gb like ( seq gb -- seq ) drop <gb> ;
+
+: gap-length ( gb -- n ) [ gb-gap-end ] keep gb-gap-start - ;
+
+: buffer-length ( gb -- n ) gb-seq length ;
+
+M: gb length ( gb -- n ) [ buffer-length ] keep gap-length - ;
+
+: position>index ( pos gb -- i )
+    2dup gb-gap-start >= [
+        gap-length +
+    ] [ drop ] if ;
+
+: index>position ( i gb -- pos )
+    2dup gb-gap-end >= [
+        gap-length -
+    ] [ drop ] if ;
+
+M: gb virtual@ ( n gb -- n seq ) [ position>index ] keep gb-seq ;
+    
+M: gb nth ( n gb -- elt ) bounds-check virtual@ nth-unsafe ;
+
+M: gb nth-unsafe ( n gb -- elt ) virtual@ nth-unsafe ;
+
+M: gb set-nth ( elt n seq -- ) bounds-check virtual@ set-nth-unsafe ;
+
+M: gb set-nth-unsafe ( elt n seq -- ) virtual@ set-nth-unsafe ;
+
+M: gb virtual-seq gb-seq ;
+
+INSTANCE: gb virtual-sequence
+
+! ------------- moving the gap -------------------------------
+
+: (copy-element) ( to start seq -- ) tuck nth -rot set-nth ;
+
+: copy-element ( dst start seq -- ) >r [ + ] keep r> (copy-element) ;
+
+: copy-elements-back ( dst start seq n -- )
+    dup 0 > [
+        >r [ copy-element ] 3keep >r 1+ r> r> 1- copy-elements-back
+    ] [ 3drop drop ] if ;
+
+: copy-elements-forward ( dst start seq n -- )
+    dup 0 > [
+        >r [ copy-element ] 3keep >r 1- r> r> 1- copy-elements-forward
+    ] [ 3drop drop ] if ;
+
+: copy-elements ( dst start end seq -- )
+    pick pick > [
+        >r dupd - r> swap copy-elements-forward
+    ] [
+        >r over - r> swap copy-elements-back
+    ] if ;
+
+! the gap can be moved either forward or back. Moving the gap 'inside' means
+! moving elements across the gap. Moving the gap 'around' means changing the
+! start of the circular buffer to avoid moving as many elements.
+
+! We decide which method (inside or around) to pick based on the number of
+! elements that will need to be moved. We always try to move as few elements as
+! possible.
+
+: move-gap? ( i gb -- i gb ? ) 2dup gb-gap-end = not ;
+
+: move-gap-forward? ( i gb -- i gb ? ) 2dup gb-gap-start >= ;
+
+: move-gap-back-inside? ( i gb -- i gb ? )
+    #! is it cheaper to move the gap inside than around?
+    2dup [ gb-gap-start swap 2 * - ] keep [ buffer-length ] keep gb-gap-end - <= ;
+
+: move-gap-forward-inside? ( i gb -- i gb ? )
+    #! is it cheaper to move the gap inside than around?
+    2dup [ gb-gap-end >r 2 * r> - ] keep [ gb-gap-start ] keep buffer-length + <= ;
+
+: move-gap-forward-inside ( i gb -- )
+    [ dup gap-length neg swap gb-gap-end rot ] keep gb-seq copy-elements ;
+
+: move-gap-back-inside ( i gb -- )
+    [ dup gap-length swap gb-gap-start 1- rot 1- ] keep gb-seq copy-elements ;
+
+: move-gap-forward-around ( i gb -- )
+    0 over move-gap-back-inside [
+        dup buffer-length [
+            swap gap-length - neg swap
+        ] keep
+    ] keep [
+        gb-seq copy-elements
+    ] keep dup gap-length swap gb-seq change-circular-start ;
+
+: move-gap-back-around ( i gb -- )
+    dup buffer-length over move-gap-forward-inside [
+        length swap -1
+    ] keep [
+        gb-seq copy-elements
+    ] keep dup length swap gb-seq change-circular-start ;
+
+: move-gap-forward ( i gb -- )
+    move-gap-forward-inside? [
+        move-gap-forward-inside
+    ] [
+        move-gap-forward-around
+    ] if ;
+
+: move-gap-back ( i gb -- )
+    move-gap-back-inside? [
+        move-gap-back-inside
+    ] [
+        move-gap-back-around
+    ] if ;
+
+: (move-gap) ( i gb -- )
+    move-gap? [
+        move-gap-forward? [
+            move-gap-forward
+        ] [
+            move-gap-back
+        ] if
+    ] [ 2drop ] if ;
+
+: fix-gap ( n gb -- )
+    2dup [ gap-length + ] keep set-gb-gap-end set-gb-gap-start ;
+
+GENERIC: move-gap ( n gb -- )
+
+M: gb move-gap ( n gb -- ) 2dup [ position>index ] keep (move-gap) fix-gap ;
+
+! ------------ resizing -------------------------------------
+
+: enough-room? ( n gb -- ? )
+    #! is there enough room to add 'n' elements to gb?
+    tuck length + swap buffer-length <= ;
+
+: set-new-gap-end ( array gb -- )
+    [ buffer-length swap length swap - ] keep
+    [ gb-gap-end + ] keep set-gb-gap-end ;
+
+: after-gap ( gb -- gb )
+    dup gb-seq swap gb-gap-end tail ;
+
+: before-gap ( gb -- gb )
+    dup gb-gap-start head ;
+
+: copy-after-gap ( array gb -- )
+    #! copy everything after the gap in 'gb' into the end of 'array',
+    #! and change 'gb's gap-end to reflect the gap-end in 'array'
+    dup after-gap >r 2dup set-new-gap-end gb-gap-end swap r> -rot copy ;
+
+: copy-before-gap ( array gb -- )
+    #! copy everything before the gap in 'gb' into the start of 'array'
+    before-gap 0 rot copy ; ! gap start doesn't change
+
+: resize-buffer ( gb new-size -- )
+    f <array> swap 2dup copy-before-gap 2dup copy-after-gap
+    >r <circular> r> set-gb-seq ;
+
+: decrease-buffer-size ( gb -- )
+    #! the gap is too big, so resize to something sensible
+    dup length over required-space resize-buffer ;
+
+: increase-buffer-size ( n gb -- )
+    #! increase the buffer to fit at least 'n' more elements
+    tuck length + over required-space resize-buffer ;
+
+: gb-too-big? ( gb -- ? )
+    dup buffer-length over gb-min-size > [
+        dup length over buffer-length rot gb-expand-factor sq / <
+    ] [ drop f ] if ;
+
+: ?decrease ( gb -- )
+    dup gb-too-big? [
+        decrease-buffer-size
+    ] [ drop ] if ;
+
+: ensure-room ( n gb -- )
+    #! ensure that ther will be enough room for 'n' more elements
+    2dup enough-room? [ 2drop ] [
+        increase-buffer-size
+    ] if ;
+
+! ------- editing operations ---------------
+
+GENERIC# insert* 2 ( seq position gb -- )
+
+: prepare-insert ( seq position gb -- seq gb )
+    tuck move-gap over length over ensure-room ;
+
+: insert-elements ( seq gb -- )
+    dup gb-gap-start swap gb-seq copy ;
+
+: increment-gap-start ( gb n -- )
+    over gb-gap-start + swap set-gb-gap-start ;
+
+! generic dispatch identifies numbers as sequences before numbers...
+! M: number insert* ( elem position gb -- ) >r >r 1array r> r> insert* ;
+: number-insert ( num position gb -- ) >r >r 1array r> r> insert* ;
+
+M: sequence insert* ( seq position gb -- )
+    pick number? [
+        number-insert
+    ] [
+        prepare-insert [ insert-elements ] 2keep swap length increment-gap-start
+    ] if ;
+
+: (delete*) ( gb -- )
+    dup gb-gap-end 1+ over set-gb-gap-end ?decrease ;
+
+GENERIC: delete* ( pos gb -- )
+
+M: gb delete* ( position gb -- )
+    tuck move-gap (delete*) ;
+
+! -------- stack/queue operations -----------
+
+: push-start ( obj gb -- ) 0 swap insert* ;
+
+: push-end ( obj gb -- ) [ length ] keep insert* ;
+
+: pop-elem ( position gb -- elem ) [ nth ] 2keep delete* ;
+
+: pop-start ( gb -- elem ) 0 swap pop-elem ;
+
+: pop-end ( gb -- elem ) [ length 1- ] keep pop-elem ;
+
+: rotate ( n gb -- )
+    dup length 1 > [
+        swap dup 0 > [
+            [ dup [ pop-end ] keep push-start ]
+        ] [
+            neg [ dup [ pop-start ] keep push-end ]
+        ] if times drop
+    ] [ 2drop ] if ;
+
diff --git a/extra/gap-buffer/summary.txt b/extra/gap-buffer/summary.txt
new file mode 100644 (file)
index 0000000..0da4c00
--- /dev/null
@@ -0,0 +1 @@
+Gap buffer data structure
diff --git a/extra/gap-buffer/tags.txt b/extra/gap-buffer/tags.txt
new file mode 100644 (file)
index 0000000..57de004
--- /dev/null
@@ -0,0 +1 @@
+collections sequences
diff --git a/extra/generic/lib/lib.factor b/extra/generic/lib/lib.factor
new file mode 100644 (file)
index 0000000..975a47e
--- /dev/null
@@ -0,0 +1,6 @@
+
+USING: kernel generic sequences ;
+
+IN: generic.lib
+
+: chain ( seq -- object ) unclip swap [ tuck set-delegate ] each ;
\ No newline at end of file
diff --git a/extra/geom/dim/dim.factor b/extra/geom/dim/dim.factor
new file mode 100644 (file)
index 0000000..1cac5d7
--- /dev/null
@@ -0,0 +1,16 @@
+
+USING: sequences mortar slot-accessors ;
+
+IN: geom.dim
+
+SYMBOL: <dim>
+
+<dim> { "dim" } accessors define-independent-class
+
+<dim> {
+
+"width" !( dim -- width ) [ $dim first ]
+
+"height" !( dim -- second ) [ $dim second ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/geom/pos/pos.factor b/extra/geom/pos/pos.factor
new file mode 100644 (file)
index 0000000..b626c40
--- /dev/null
@@ -0,0 +1,28 @@
+
+USING: kernel arrays sequences math.vectors mortar slot-accessors ;
+
+IN: geom.pos
+
+SYMBOL: <pos>
+
+<pos> { "pos" } accessors define-independent-class
+
+<pos> {
+
+"x" !( pos -- x ) [ $pos first ]
+
+"y" !( pos -- y ) [ $pos second ]
+
+"set-x" !( pos x -- pos ) [ 0 pick $pos set-nth ]
+
+"set-y" !( pos y -- pos ) [ 1 pick $pos set-nth ]
+
+"distance" !( pos pos -- distance ) [ $pos swap $pos v- norm ]
+
+"move-by" !( pos offset -- pos ) [ over $pos v+ >>pos ]
+
+"move-by-x" !( pos x-offset -- pos ) [ 0 2array <-- move-by ]
+
+"move-by-y" !( pos y-offset -- pos ) [ 0 swap 2array <-- move-by ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/geom/rect/rect.factor b/extra/geom/rect/rect.factor
new file mode 100644 (file)
index 0000000..573b8e0
--- /dev/null
@@ -0,0 +1,41 @@
+
+USING: kernel namespaces arrays sequences math.vectors
+       mortar slot-accessors geom.pos geom.dim ;
+
+IN: geom.rect
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USE: math
+
+: v+y ( pos y -- pos ) 0 swap 2array v+ ;
+
+: v-y ( pos y -- pos ) 0 swap 2array v- ;
+
+: v+x ( pos x -- pos ) 0 2array v+ ;
+
+: v-x ( pos x -- pos ) 0 2array v- ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: <rect>
+
+<rect>
+  <pos> class-slots <dim> class-slots append
+  <pos> class-methods <dim> class-methods append { H{ } } append
+  { H{ } }
+4array <rect> set-global
+
+! { 0 0 } { 0 0 } <rect> new
+
+<rect> {
+
+"top-left" !( rect -- point ) [ $pos ]
+
+"top-right" !( rect -- point ) [ dup $pos swap <- width 1- v+x ]
+
+"bottom-left" !( rect -- point ) [ dup $pos swap <- height 1- v+y ]
+
+"bottom-right" !( rect -- point ) [ dup $pos swap $dim { 1 1 } v- v+ ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/gesture-logger/authors.txt b/extra/gesture-logger/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/gesture-logger/deploy.factor b/extra/gesture-logger/deploy.factor
new file mode 100644 (file)
index 0000000..a4531a9
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? f }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? t }
+    { strip-prettyprint? f }
+    { "bundle-name" "Gesture Logger.app" }
+}
diff --git a/extra/gesture-logger/gesture-logger.factor b/extra/gesture-logger/gesture-logger.factor
new file mode 100644 (file)
index 0000000..1977efd
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io kernel prettyprint ui ui.gadgets ui.gadgets.panes
+ui.gadgets.scrollers ui.gadgets.theme ui.gestures colors ;
+IN: gesture-logger
+
+TUPLE: gesture-logger stream ;
+
+: <gesture-logger> ( stream -- gadget )
+    \ gesture-logger construct-gadget
+    [ set-gesture-logger-stream ] keep
+    { 100 100 } over set-rect-dim
+    dup black solid-interior ;
+
+M: gesture-logger handle-gesture*
+    drop
+    dup T{ button-down } = [ over request-focus ] when
+    swap gesture-logger-stream [ . ] with-stream*
+    t ;
+
+M: gesture-logger user-input*
+    gesture-logger-stream [
+        "User input: " write print
+    ] with-stream* t ;
+
+: gesture-logger ( -- )
+    [
+        <scrolling-pane> dup <scroller>
+        "Gesture log" open-window
+        <pane-stream> <gesture-logger>
+        "Gesture input" open-window
+    ] with-ui ;
+
+MAIN: gesture-logger
diff --git a/extra/gesture-logger/summary.txt b/extra/gesture-logger/summary.txt
new file mode 100644 (file)
index 0000000..739aa81
--- /dev/null
@@ -0,0 +1 @@
+Gadget which logs all received gestures, for debugging
diff --git a/extra/golden-section/authors.txt b/extra/golden-section/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/golden-section/deploy.factor b/extra/golden-section/deploy.factor
new file mode 100644 (file)
index 0000000..733ba5c
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? t }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? t }
+    { "bundle-name" "Golden Section.app" }
+}
diff --git a/extra/golden-section/golden-section.factor b/extra/golden-section/golden-section.factor
new file mode 100644 (file)
index 0000000..f56c1f8
--- /dev/null
@@ -0,0 +1,67 @@
+USING: kernel namespaces math math.constants math.functions
+arrays sequences opengl opengl.gl opengl.glu ui ui.render
+ui.gadgets ui.gadgets.theme ui.gadgets.slate colors ;
+IN: golden-section
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! To run:
+! 
+! "demos.golden-section" run
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: disk ( quadric radius center -- )
+glPushMatrix
+gl-translate
+dup 0 glScalef
+0 1 10 10 gluDisk
+glPopMatrix ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: phi ( -- phi ) 5 sqrt 1 + 2 / 1 - ;
+
+: omega ( i -- omega ) phi * 2 * pi * ;
+
+: x ( i -- x ) dup omega cos * 0.5 * ;
+
+: y ( i -- y ) dup omega sin * 0.5 * ;
+
+: center ( i -- point ) dup x swap y 2array ;
+
+: radius ( i -- radius ) pi * 720 / sin 10 * ;
+
+: color ( i -- color ) 360.0 / dup 0.25 1 4array ;
+
+: rim ( quadric i -- )
+black gl-color dup radius 1.5 * swap center disk ;
+
+: inner ( quadric i -- )
+dup color gl-color dup radius swap center disk ;
+
+: dot ( quadric i -- ) 2dup rim inner ;
+
+: golden-section ( quadric -- ) 720 [ dot ] curry* each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: with-quadric ( quot -- )
+gluNewQuadric [ swap call ] keep gluDeleteQuadric ; inline
+
+: display ( -- )
+GL_PROJECTION glMatrixMode
+glLoadIdentity
+-400 400 -400 400 -1 1 glOrtho
+GL_MODELVIEW glMatrixMode
+glLoadIdentity
+[ golden-section ] with-quadric ;
+
+: golden-section-window ( -- )
+[
+    [ display ] <slate>
+    { 600 600 } over set-slate-dim
+    "Golden Section" open-window
+] with-ui ;
+
+MAIN: golden-section-window
\ No newline at end of file
diff --git a/extra/golden-section/summary.txt b/extra/golden-section/summary.txt
new file mode 100644 (file)
index 0000000..5f44091
--- /dev/null
@@ -0,0 +1 @@
+Golden section demo
diff --git a/extra/golden-section/tags.txt b/extra/golden-section/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/graphics/authors.txt b/extra/graphics/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/graphics/bitmap/bitmap.factor b/extra/graphics/bitmap/bitmap.factor
new file mode 100644 (file)
index 0000000..9539d9e
--- /dev/null
@@ -0,0 +1,132 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: alien arrays byte-arrays combinators
+graphics.viewer io io.binary io.files kernel libc math
+math.functions namespaces opengl opengl.gl prettyprint
+sequences strings ui ui.gadgets.panes ;
+IN: graphics.bitmap
+
+! Currently can only handle 24bit bitmaps.
+! Handles row-reversed bitmaps (their height is negative)
+
+TUPLE: bitmap magic size reserved offset header-length width
+    height planes bit-count compression size-image
+    x-pels y-pels color-used color-important rgb-quads color-index array ;
+
+: raw-bitmap>string ( str n -- str )
+    {
+        { 32 [ "32bit" throw ] }
+        { 24 [ ] }
+        { 16 [ "16bit" throw ] }
+        { 8 [ "8bit" throw ] }
+        { 4 [ "4bit" throw ] }
+        { 2 [ "2bit" throw ] }
+        { 1 [ "1bit" throw ] }
+    } case ;
+
+: parse-file-header ( bitmap -- )
+    2 read [ over set-bitmap-magic ] keep "BM" = [
+        "BITMAPFILEHEADER: First two bytes must be BM" throw
+    ] unless
+    4 read le> over set-bitmap-size
+    4 read le> over set-bitmap-reserved
+    4 read le> swap set-bitmap-offset ;
+
+: parse-bitmap-header ( bitmap -- )
+    4 read le> over set-bitmap-header-length
+    4 read le> over set-bitmap-width
+    4 read le> over set-bitmap-height
+    2 read le> over set-bitmap-planes
+    2 read le> over set-bitmap-bit-count
+    4 read le> over set-bitmap-compression
+    4 read le> over set-bitmap-size-image
+    4 read le> over set-bitmap-x-pels
+    4 read le> over set-bitmap-y-pels
+    4 read le> over set-bitmap-color-used
+    4 read le> swap set-bitmap-color-important ;
+
+: rgb-quads-length ( bitmap -- n )
+    [ bitmap-offset 14 - ] keep bitmap-header-length - ;
+
+: color-index-length ( bitmap -- n )
+    [ bitmap-width ] keep [ bitmap-planes * ] keep
+    [ bitmap-bit-count * 31 + 32 /i 4 * ] keep
+    bitmap-height abs * ;
+
+: parse-bitmap ( bitmap -- )
+    dup rgb-quads-length read over set-bitmap-rgb-quads
+    dup color-index-length read swap set-bitmap-color-index ;
+
+: load-bitmap ( path -- bitmap )
+    <file-reader> [
+        T{ bitmap } clone
+        dup parse-file-header
+        dup parse-bitmap-header
+        dup parse-bitmap
+    ] with-stream
+    dup bitmap-color-index over bitmap-bit-count
+    raw-bitmap>string >byte-array over set-bitmap-array ;
+
+: save-bitmap ( bitmap path -- )
+    <file-writer> [
+        "BM" write
+        dup bitmap-array length 14 + 40 + 4 >le write
+        0 4 >le write
+        54 4 >le write
+
+        40 4 >le write
+        dup bitmap-width 4 >le write
+        dup bitmap-height 4 >le write
+        dup bitmap-planes 1 or 2 >le write
+        dup bitmap-bit-count 24 or 2 >le write
+        dup bitmap-compression 0 or 4 >le write
+        dup bitmap-size-image 4 >le write
+        dup bitmap-x-pels 4 >le write
+        dup bitmap-y-pels 4 >le write
+        dup bitmap-color-used 4 >le write
+        dup bitmap-color-important 4 >le write
+        dup bitmap-rgb-quads write
+        bitmap-color-index write
+    ] with-stream ;
+
+M: bitmap draw-image ( bitmap -- )
+    dup bitmap-height 0 < [
+        0 0 glRasterPos2i
+        1.0 -1.0 glPixelZoom
+    ] [
+        0 over bitmap-height abs glRasterPos2i
+        1.0 1.0 glPixelZoom
+    ] if
+    [ bitmap-width ] keep
+    [
+        [ bitmap-height abs ] keep
+        bitmap-bit-count {
+            ! { 32 [ GL_BGRA GL_UNSIGNED_INT_8_8_8_8 ] } ! broken
+            { 24 [ GL_BGR GL_UNSIGNED_BYTE ] }
+        } case
+    ] keep bitmap-array glDrawPixels ;
+
+M: bitmap width ( bitmap -- ) bitmap-width ;
+M: bitmap height ( bitmap -- ) bitmap-height ;
+
+: bitmap. ( path -- )
+    load-bitmap <graphics-gadget> gadget. ;
+
+: bitmap-window ( path -- )
+    load-bitmap [ <graphics-gadget> "bitmap" open-window ] keep ;
+
+: test-bitmap24 ( -- )
+    "misc/graphics/bmps/thiswayup24.bmp" resource-path bitmap. ;
+
+: test-bitmap8 ( -- )
+    "misc/graphics/bmps/rgb8bit.bmp" resource-path bitmap. ;
+
+: test-bitmap4 ( -- )
+    "misc/graphics/bmps/rgb4bit.bmp" resource-path
+    load-bitmap ;
+    ! bitmap. ;
+
+: test-bitmap1 ( -- )
+    "misc/graphics/bmps/1bit.bmp" resource-path bitmap. ;
+
diff --git a/extra/graphics/tags.txt b/extra/graphics/tags.txt
new file mode 100644 (file)
index 0000000..04b54a0
--- /dev/null
@@ -0,0 +1 @@
+bitmap graphics
diff --git a/extra/graphics/viewer/viewer.factor b/extra/graphics/viewer/viewer.factor
new file mode 100644 (file)
index 0000000..938dc61
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: arrays kernel math math.functions namespaces opengl
+ui.gadgets ui.render ;
+IN: graphics.viewer
+
+TUPLE: graphics-gadget image ;
+
+GENERIC: draw-image ( image -- )
+GENERIC: width ( image -- w )
+GENERIC: height ( image -- h )
+
+M: graphics-gadget pref-dim*
+    graphics-gadget-image
+    [ width ] keep height abs 2array ;
+
+M: graphics-gadget draw-gadget* ( gadget -- )
+    origin get [
+        graphics-gadget-image draw-image
+    ] with-translation ;
+
+: <graphics-gadget> ( bitmap -- gadget )
+    \ graphics-gadget construct-gadget
+    [ set-graphics-gadget-image ] keep ;
+
diff --git a/extra/hardware-info/authors.txt b/extra/hardware-info/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/hardware-info/hardware-info.factor b/extra/hardware-info/hardware-info.factor
new file mode 100644 (file)
index 0000000..521ec3d
--- /dev/null
@@ -0,0 +1,23 @@
+USING: alien.syntax math prettyprint system ;
+IN: hardware-info
+
+SYMBOL: os
+HOOK: cpus os ( -- n )
+
+HOOK: memory-load os ( -- n )
+HOOK: physical-mem os ( -- n )
+HOOK: available-mem os ( -- n )
+HOOK: total-page-file os ( -- n )
+HOOK: available-page-file os ( -- n )
+HOOK: total-virtual-mem os ( -- n )
+HOOK: available-virtual-mem os ( -- n )
+HOOK: available-virtual-extended-mem os ( -- n )
+
+: kb. ( x -- ) 10 2^ /f . ;
+: megs. ( x -- ) 20 2^ /f . ;
+: gigs. ( x -- ) 30 2^ /f . ;
+
+USE-IF: windows? hardware-info.windows
+USE-IF: linux? hardware-info.linux
+USE-IF: macosx? hardware-info.macosx
+
diff --git a/extra/hardware-info/linux/linux.factor b/extra/hardware-info/linux/linux.factor
new file mode 100644 (file)
index 0000000..de7b3f4
--- /dev/null
@@ -0,0 +1,21 @@
+USING: alien alien.c-types kernel math sequences strings
+io.unix.backend splitting ;
+IN: hardware-info.linux
+
+: (uname) ( buf -- int )
+    "int" f "uname" { "char*" } alien-invoke ;
+
+: uname ( -- seq )
+    65536 "char" <c-array> [ (uname) io-error ] keep
+    "\0" split [ empty? not ] subset [ >string ] map
+    6 "" pad-right ;
+
+: sysname ( -- string ) uname first ;
+: nodename ( -- string ) uname second ;
+: release ( -- string ) uname third ;
+: version ( -- string ) uname fourth ;
+: machine ( -- string ) uname 4 swap nth ;
+: domainname ( -- string ) uname 5 swap nth ;
+
+: kernel-version ( -- seq )
+    release ".-" split [ ] subset 5 "" pad-right ;
diff --git a/extra/hardware-info/macosx/macosx.factor b/extra/hardware-info/macosx/macosx.factor
new file mode 100644 (file)
index 0000000..ad30609
--- /dev/null
@@ -0,0 +1,53 @@
+USING: alien alien.c-types alien.syntax byte-arrays kernel
+namespaces sequences unix hardware-info ;
+IN: hardware-info.macosx
+
+TUPLE: macosx ;
+T{ macosx } os set-global
+
+! See /usr/include/sys/sysctl.h for constants
+
+LIBRARY: libc
+FUNCTION: int sysctl ( int* name, uint namelen, void* oldp, size_t* oldlenp, void* newp, size_t newlen ) ;
+
+: make-int-array ( seq -- byte-array )
+    [ <int> ] map concat ;
+
+: (sysctl-query) ( name namelen oldp oldlenp -- oldp error/f )
+    over >r
+        f 0 sysctl -1 = [ err_no strerror ] [ f ] if
+    r> swap ;
+
+: sysctl-query ( seq n -- byte-array )
+    >r [ make-int-array ] keep length r>
+    [ <byte-array> ] keep <uint>
+    (sysctl-query) [ throw ] when* ;
+
+: sysctl-query-string ( seq -- n )
+    4096 sysctl-query alien>char-string ;
+
+: sysctl-query-uint ( seq -- n )
+    4 sysctl-query *uint ;
+
+: sysctl-query-ulonglong ( seq -- n )
+    8 sysctl-query *ulonglong ;
+
+: machine ( -- str ) { 6 1 } sysctl-query-string ;
+: model ( -- str ) { 6 2 } sysctl-query-string ;
+M: macosx cpus ( -- n ) { 6 3 } sysctl-query-uint ;
+: byte-order ( -- n ) { 6 4 } sysctl-query-uint ;
+: user-mem ( -- n ) { 6 4 } sysctl-query-uint ;
+: page-size ( -- n ) { 6 7 } sysctl-query-uint ;
+: bus-frequency ( -- n ) { 6 14 } sysctl-query-uint ;
+: cpu-frequency ( -- n ) { 6 15 } sysctl-query-uint ;
+: cacheline-size ( -- n ) { 6 16 } sysctl-query-uint ;
+: l1-icache-size ( -- n ) { 6 17 } sysctl-query-uint ;
+: l1-dcache-size ( -- n ) { 6 18 } sysctl-query-uint ;
+: l2-cache-settings ( -- n ) { 6 19 } sysctl-query-uint ;
+: l2-cache-size ( -- n ) { 6 20 } sysctl-query-uint ;
+: l3-cache-settings ( -- n ) { 6 21 } sysctl-query-uint ;
+: l3-cache-size ( -- n ) { 6 22 } sysctl-query-uint ;
+: bus-frequency2 ( -- n ) { 6 23 } sysctl-query-uint ;
+M: macosx physical-mem ( -- n ) { 6 24 } sysctl-query-ulonglong ;
+: available-cpus ( -- n ) { 6 25 } sysctl-query-uint ;
+
diff --git a/extra/hardware-info/summary.txt b/extra/hardware-info/summary.txt
new file mode 100644 (file)
index 0000000..404da13
--- /dev/null
@@ -0,0 +1 @@
+Query the operating system for hardware information in a platform-independent way
diff --git a/extra/hardware-info/windows/ce/ce.factor b/extra/hardware-info/windows/ce/ce.factor
new file mode 100644 (file)
index 0000000..1ae908c
--- /dev/null
@@ -0,0 +1,33 @@
+USING: alien.c-types hardware-info kernel math namespaces windows windows.kernel32 ;
+IN: hardware-info.windows.ce
+
+TUPLE: wince ;
+T{ wince } os set-global
+
+: memory-status ( -- MEMORYSTATUS )
+    "MEMORYSTATUS" <c-object>
+    "MEMORYSTATUS" heap-size over set-MEMORYSTATUS-dwLength
+    [ GlobalMemoryStatus ] keep ;
+
+M: wince memory-load ( -- n )
+    memory-status MEMORYSTATUS-dwMemoryLoad ;
+
+M: wince physical-mem ( -- n )
+    memory-status MEMORYSTATUS-dwTotalPhys ;
+
+M: wince available-mem ( -- n )
+    memory-status MEMORYSTATUS-dwAvailPhys ;
+
+M: wince total-page-file ( -- n )
+    memory-status MEMORYSTATUS-dwTotalPageFile ;
+
+M: wince available-page-file ( -- n )
+    memory-status MEMORYSTATUS-dwAvailPageFile ;
+
+M: wince total-virtual-mem ( -- n )
+    memory-status MEMORYSTATUS-dwTotalVirtual ;
+
+M: wince available-virtual-mem ( -- n )
+    memory-status MEMORYSTATUS-dwAvailVirtual ;
+
+
diff --git a/extra/hardware-info/windows/nt/nt.factor b/extra/hardware-info/windows/nt/nt.factor
new file mode 100644 (file)
index 0000000..fafcb58
--- /dev/null
@@ -0,0 +1,49 @@
+USING: alien alien.c-types hardware-info kernel libc math namespaces
+windows windows.advapi32 windows.kernel32 ;
+IN: hardware-info.windows.nt
+
+TUPLE: winnt ;
+T{ winnt } os set-global
+
+: memory-status ( -- MEMORYSTATUSEX )
+    "MEMORYSTATUSEX" <c-object>
+    "MEMORYSTATUSEX" heap-size over set-MEMORYSTATUSEX-dwLength
+    [ GlobalMemoryStatusEx ] keep swap zero? [ win32-error ] when ;
+
+M: winnt memory-load ( -- n )
+    memory-status MEMORYSTATUSEX-dwMemoryLoad ;
+
+M: winnt physical-mem ( -- n )
+    memory-status MEMORYSTATUSEX-ullTotalPhys ;
+
+M: winnt available-mem ( -- n )
+    memory-status MEMORYSTATUSEX-ullAvailPhys ;
+
+M: winnt total-page-file ( -- n )
+    memory-status MEMORYSTATUSEX-ullTotalPageFile ;
+
+M: winnt available-page-file ( -- n )
+    memory-status MEMORYSTATUSEX-ullAvailPageFile ;
+
+M: winnt total-virtual-mem ( -- n )
+    memory-status MEMORYSTATUSEX-ullTotalVirtual ;
+
+M: winnt available-virtual-mem ( -- n )
+    memory-status MEMORYSTATUSEX-ullAvailVirtual ;
+
+: computer-name ( -- string )
+    MAX_COMPUTERNAME_LENGTH 1+ [ malloc ] keep
+    <int> dupd GetComputerName zero? [
+        free win32-error f
+    ] [
+        [ alien>u16-string ] keep free
+    ] if ;
+: username ( -- string )
+    UNLEN 1+ [ malloc ] keep
+    <int> dupd GetUserName zero? [
+        free win32-error f
+    ] [
+        [ alien>u16-string ] keep free
+    ] if ;
+
diff --git a/extra/hardware-info/windows/windows.factor b/extra/hardware-info/windows/windows.factor
new file mode 100644 (file)
index 0000000..bbae541
--- /dev/null
@@ -0,0 +1,58 @@
+USING: alien alien.c-types kernel libc math namespaces
+windows windows.kernel32 windows.advapi32 hardware-info ;
+IN: hardware-info.windows
+
+TUPLE: wince ;
+TUPLE: winnt ;
+UNION: windows wince winnt ;
+USE: system
+
+: system-info ( -- SYSTEM_INFO )
+    "SYSTEM_INFO" <c-object> [ GetSystemInfo ] keep ;
+
+: page-size ( -- n )
+    system-info SYSTEM_INFO-dwPageSize ;
+
+M: windows cpus ( -- n )
+    system-info SYSTEM_INFO-dwNumberOfProcessors ;
+
+! 386, 486, 586, 2200 (IA64), 8664 (AMD_X8664)
+: processor-type ( -- n )
+    system-info SYSTEM_INFO-dwProcessorType ;
+
+! 0 = x86, 6 = Intel Itanium, 9 = x64 (AMD or Intel), 10 = WOW64, 0xffff = Unk
+: processor-architecture ( -- n )
+    system-info SYSTEM_INFO-dwOemId HEX: ffff0000 bitand ;
+
+: os-version
+    "OSVERSIONINFO" <c-object>
+    "OSVERSIONINFO" heap-size over set-OSVERSIONINFO-dwOSVersionInfoSize
+    [ GetVersionEx ] keep swap zero? [ win32-error ] when ;
+
+: windows-major ( -- n )
+    os-version OSVERSIONINFO-dwMajorVersion ;
+
+: windows-minor ( -- n )
+    os-version OSVERSIONINFO-dwMinorVersion ;
+
+: windows-build# ( -- n )
+    os-version OSVERSIONINFO-dwBuildNumber ;
+
+: windows-platform-id ( -- n )
+    os-version OSVERSIONINFO-dwPlatformId ;
+
+: windows-service-pack ( -- string )
+    os-version OSVERSIONINFO-szCSDVersion alien>u16-string ;
+
+: feature-present? ( n -- ? )
+    IsProcessorFeaturePresent zero? not ;
+
+: sse2? ( -- ? )
+    PF_XMMI64_INSTRUCTIONS_AVAILABLE feature-present? ;
+
+: sse3? ( -- ? )
+    PF_SSE3_INSTRUCTIONS_AVAILABLE feature-present? ;
+
+USE-IF: wince? hardware-info.windows.ce
+USE-IF: winnt? hardware-info.windows.nt
+
diff --git a/extra/hash2/authors.txt b/extra/hash2/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/hash2/hash2-docs.factor b/extra/hash2/hash2-docs.factor
new file mode 100644 (file)
index 0000000..f39ddb1
--- /dev/null
@@ -0,0 +1,25 @@
+USING: hash2 help.syntax help.markup ;
+
+ARTICLE: { "hash2" "intro" }
+"The hash2 vocabulary specifies a simple minimal datastructure for hash tables with two integers as keys. These hash tables are fixed size and do not conform to the associative mapping protocol. Words used in creating and manipulating these hash tables include:"
+{ $subsection <hash2> }
+{ $subsection hash2 }
+{ $subsection set-hash2 }
+{ $subsection alist>hash2 } ;
+
+HELP: <hash2>
+{ $values { "size" "size of the underlying array" } { "hash2" hash2 } }
+{ $description "Creates a " { $link hash2 } " object with the given size of the underlying array. Initially, the hash2 contains nothing." } ;
+
+HELP: hash2
+{ $values { "a" "first key" } { "b" "second key" } { "hash2" hash2 } { "value/f" "the associated value or f" } }
+{ $description "Looks up the associated value in the hash2 table with the given keys. If a value is found, it is returned, otherwise f is returned. Note that it is significant which order the keys are in." }
+{ $class-description "A hash2 table, with two integers as the key for each value. Hash2 tables are of fixed size and do not conform to the associative mapping protocol." } ;
+
+HELP: set-hash2
+{ $values { "a" "first key" } { "b" "second key" } { "value" "the new value" } { "hash2" hash2 } }
+{ $description "Sets the hash2 at the given key combination to the given value. Note that the order of keys is significant and that this will never grow the hash2 table. Both keys must be integers." } ;
+
+HELP: alist>hash2
+{ $values { "alist" "a sequence of the form " { $snippet "{ { a b value } ... }" } } { "size" "the size of the new underlying array" } { "hash2" hash2 } }
+{ $description "Converts an association list, where the first and second elements of each inner sequence is a key and the third is the value, into a " { $link hash2 } " of the given size. Both keys must be integers." } ;
diff --git a/extra/hash2/hash2-tests.factor b/extra/hash2/hash2-tests.factor
new file mode 100644 (file)
index 0000000..b7a4f42
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.test hash2 kernel ;
+
+: sample-hash
+    5 <hash2>
+    dup 2 3 "foo" roll set-hash2
+    dup 4 2 "bar" roll set-hash2
+    dup 4 7 "other" roll set-hash2 ;
+
+[ "foo" ] [ 2 3 sample-hash hash2 ] unit-test
+[ "bar" ] [ 4 2 sample-hash hash2 ] unit-test
+[ "other" ] [ 4 7 sample-hash hash2 ] unit-test
+[ f ] [ 4 12 sample-hash hash2 ] unit-test
+[ f ] [ 1 1 sample-hash hash2 ] unit-test
diff --git a/extra/hash2/hash2.factor b/extra/hash2/hash2.factor
new file mode 100644 (file)
index 0000000..893273e
--- /dev/null
@@ -0,0 +1,38 @@
+USING: kernel sequences arrays math vectors ;
+IN: hash2
+
+! Little ad-hoc datastructure used to map two numbers
+! to a single value.
+! Created for the NFC mapping table.
+! We could use a hashtable of 2arrays, but that
+! involves creating too many objects.
+! Does not allow duplicate keys.
+
+: hashcode2 ( a b -- hashcode )
+    swap 8 shift + ; inline
+
+: <hash2> ( size -- hash2 ) f <array> ;
+
+: 2= ( a b pair -- ? )
+    first2 swapd >r >r = r> r> = and ; inline
+
+: (assoc2) ( a b alist -- {a,b,val} )
+    [ >r 2dup r> 2= ] find >r 3drop r> ; inline
+
+: assoc2 ( a b alist -- value )
+    (assoc2) dup [ third ] when ; inline
+
+: set-assoc2 ( value a b alist -- alist )
+    >r rot 3array r> ?push ; inline
+
+: hash2@ ( a b hash2 -- a b bucket hash2 )
+    >r 2dup hashcode2 r> [ length mod ] keep ; inline
+
+: hash2 ( a b hash2 -- value/f )
+    hash2@ nth [ assoc2 ] [ 2drop f ] if* ;
+
+: set-hash2 ( a b value hash2 -- )
+    >r -rot r> hash2@ [ set-assoc2 ] change-nth ;
+
+: alist>hash2 ( alist size -- hash2 )
+    <hash2> [ over >r first3 r> set-hash2 ] reduce ; inline
diff --git a/extra/hash2/summary.txt b/extra/hash2/summary.txt
new file mode 100644 (file)
index 0000000..307a003
--- /dev/null
@@ -0,0 +1 @@
+Special-purpose fixed-size hashtable where keys are pairs of integers
diff --git a/extra/hash2/tags.txt b/extra/hash2/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/hashtables/lib/authors.txt b/extra/hashtables/lib/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/hashtables/lib/lib.factor b/extra/hashtables/lib/lib.factor
new file mode 100644 (file)
index 0000000..1bcd139
--- /dev/null
@@ -0,0 +1,19 @@
+
+USING: kernel sequences assocs ;
+
+IN: hashtables.lib
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: ref-hash ( table key -- value ) swap at ;
+
+! set-hash with alternative stack effects
+
+: put-hash* ( table key value -- ) swap rot set-at ;
+
+: put-hash ( table key value -- table ) swap pick set-at ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-hash-stack ( value key seq -- )
+  dupd [ key? ] curry* find-last nip set-at ;
diff --git a/extra/hashtables/lib/summary.txt b/extra/hashtables/lib/summary.txt
new file mode 100644 (file)
index 0000000..1bc1c27
--- /dev/null
@@ -0,0 +1 @@
+Non-core hashtable words
diff --git a/extra/hashtables/lib/tags.txt b/extra/hashtables/lib/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/hello-ui/authors.txt b/extra/hello-ui/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/hello-ui/deploy.factor b/extra/hello-ui/deploy.factor
new file mode 100644 (file)
index 0000000..9e21e5b
--- /dev/null
@@ -0,0 +1,12 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? t }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? t }
+    { "bundle-name" "Hello World.app" }
+}
diff --git a/extra/hello-ui/hello-ui.factor b/extra/hello-ui/hello-ui.factor
new file mode 100644 (file)
index 0000000..3843eec
--- /dev/null
@@ -0,0 +1,7 @@
+USING: ui ui.gadgets.labels ;
+IN: hello-ui
+
+: hello ( -- )
+    [ "Hello world" <label> "Hi" open-window ] with-ui ;
+
+MAIN: hello
diff --git a/extra/hello-ui/summary.txt b/extra/hello-ui/summary.txt
new file mode 100644 (file)
index 0000000..cacda7d
--- /dev/null
@@ -0,0 +1 @@
+Graphical hello world demo
diff --git a/extra/hello-ui/tags.txt b/extra/hello-ui/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/hello-world/authors.txt b/extra/hello-world/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/hello-world/deploy.factor b/extra/hello-world/deploy.factor
new file mode 100644 (file)
index 0000000..f039c5f
--- /dev/null
@@ -0,0 +1,11 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? t }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { deploy-math? f }
+    { deploy-compiled? f }
+    { deploy-io? f }
+    { deploy-ui? f }
+}
diff --git a/extra/hello-world/hello-world.factor b/extra/hello-world/hello-world.factor
new file mode 100644 (file)
index 0000000..709ecb1
--- /dev/null
@@ -0,0 +1,6 @@
+USE: io
+IN: hello-world
+
+: hello "Hello world" print ;
+
+MAIN: hello
diff --git a/extra/hello-world/summary.txt b/extra/hello-world/summary.txt
new file mode 100644 (file)
index 0000000..2e48aae
--- /dev/null
@@ -0,0 +1 @@
+Textual hello world demo
diff --git a/extra/hello-world/tags.txt b/extra/hello-world/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/help/authors.txt b/extra/help/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/cookbook/cookbook.factor b/extra/help/cookbook/cookbook.factor
new file mode 100644 (file)
index 0000000..d5d4b16
--- /dev/null
@@ -0,0 +1,277 @@
+USING: help.markup help.syntax io kernel math namespaces parser
+prettyprint sequences vocabs.loader namespaces inference ;
+
+ARTICLE: "cookbook-syntax" "Basic syntax cookbook"
+"The following is a simple snippet of Factor code:"
+{ $example "10 sq 5 - ." "95" }
+"You can click on it to evaluate it in the listener, and it will print the same output value as indicated above."
+$nl
+"Factor has a very simple syntax. Your program consists of " { $emphasis "words" } " and " { $emphasis "literals" } ". In the above snippet, the words are " { $link sq } ", " { $link - } " and " { $link . } ". The two integers 10 and 5 are literals."
+$nl
+"Factor evaluates code left to right, and stores intermediate values on a " { $emphasis "stack" } ". If you think of the stack as a pile of papers, then " { $emphasis "pushing" } " a value on the stack corresponds to placing a piece of paper at the top of the pile, while " { $emphasis "popping" } " a value corresponds to removing the topmost piece."
+$nl
+"Most words have a " { $emphasis "stack effect declaration" } ", for example " { $snippet "( x y -- z )" } " denotes that a word takes two inputs, with " { $snippet "y" } " at the top of the stack, and returns one output. Stack effect declarations can be viewed by browsing source code, or using tools such as " { $link see } ". See " { $link "effect-declaration" } "."
+$nl
+"Coming back to the example in the beginning of this article, the following series of steps occurs as the code is evaluated:"
+{ $table
+    { "Action" "Stack contents" }
+    { "10 is pushed on the stack." { $snippet "10" } }
+    { { "The " { $link sq } " word is executed. It pops one input from the stack - the integer 10 - and squares it, pushing the result." } { $snippet "100" } }
+    { { "5 is pushed on the stack." } { $snippet "100 5" } }
+    { { "The " { $link - } " word is executed. It pops two inputs from the stack - the integers 100 and 5 - and subtracts 5 from 100, pushing the result." } { $snippet "95" } }
+    { { "The " { $link . } " word is executed. It pops one input from the stack - the integer 95 - and prints it in the listener's output area." } { } }
+}
+"Factor supports many other data types:"
+{ $code
+    "10.5"
+    "\"character strings\""
+    "{ 1 2 3 }"
+    "! by the way, this is a comment"
+    "#! and so is this"
+}
+{ $references
+    { "Factor's syntax can be extended, the parser can be called reflectively, and the " { $link . } " word is in fact a general facility for turning almost any object into a form which can be parsed back in again. If this interests you, consult the following sections:" }
+    "syntax"
+    "parser"
+    "prettyprint"
+} ;
+
+ARTICLE: "cookbook-colon-defs" "Shuffle word and definition cookbook"
+"The " { $link dup } " word makes a copy of the value at the top of the stack:"
+{ $example "5 dup * ." "25" }
+"The " { $link sq } " word is actually defined as follows:"
+{ $code ": sq dup * ;" }
+"(You could have looked this up yourself by clicking on the " { $link sq } " word itself.)"
+$nl
+"Note the key elements in a word definition: The colon " { $link POSTPONE: : } " denotes the start of a word definition. The name of the new word must immediately follow. The word definition then continues on until the " { $link POSTPONE: ; } " token signifies the end of the definition. This type of word definition is called a " { $emphasis "compound definition." }
+$nl
+"Factor is all about code reuse through short and logical colon definitions. Breaking up a problem into small pieces which are easy to test is called " { $emphasis "factoring." }
+$nl
+"Another example of a colon definition:"
+{ $code ": neg ( x -- -x ) 0 swap - ;" }
+"Here the " { $link swap } " shuffle word is used to interchange the top two stack elements. Note the difference that " { $link swap } " makes in the following two snippets:"
+{ $code
+    "5 0 -       ! Computes 5-0"
+    "5 0 swap -  ! Computes 0-5"
+}
+"Also, in the above example a stack effect declaration is written between " { $snippet "(" } " and " { $snippet ")" } " with a mnemonic description of what the word does to the stack. See " { $link "effect-declaration" } " for details."
+{ $curious
+    "This syntax will be familiar to anybody who has used Forth before. However the behavior is slightly different. In most Forth systems, the below code prints 2, because the definition of " { $snippet "b" } " still refers to the previous definition of " { $snippet "a" } ":"
+    { $code
+        ": a 1 ;"
+        ": b a 1 + ;"
+        ": a 2 ;"
+        "b ."
+    }
+    "In Factor, this example will print 3 since word redefinition is explicitly supported."
+}
+{ $references
+    { "A whole slew of shuffle words can be used to rearrange the stack. There are forms of word definition other than colon definition, words can be defined entirely at runtime, and word definitions can be " { $emphasis "annotated" } " with tracing calls and breakpoints without modifying the source code." }
+    "shuffle-words"
+    "words"
+    "generic"
+    "tools"
+} ;
+
+ARTICLE: "cookbook-combinators" "Control flow cookbook"
+"A " { $emphasis "quotation" } " is an object containing code which can be evaluated."
+{ $code
+    "2 2 + .     ! Prints 4"
+    "[ 2 2 + . ] ! Pushes a quotation"
+}
+"The quotation pushed by the second example will print 4 when called by " { $link call } "."
+$nl
+"Quotations are used to implement control flow. For example, conditional execution is done with " { $link if } ":"
+{ $code
+    ": sign-test ( n -- )"
+    "    dup 0 < ["
+    "        drop \"negative\""
+    "    ] ["
+    "        zero? [ \"zero\" ] [ \"positive\" ] if"
+    "    ] if print ;"
+}
+"The " { $link if } " word takes a boolean, a true quotation, and a false quotation, and executes one of the two quotations depending on the value of the boolean. In Factor, any object not equal to the special value " { $link f } " is considered true, while " { $link f } " is false."
+$nl
+"Another useful form of control flow is iteration. You can do something several times:"
+{ $code "10 [ \"Factor rocks!\" print ] times" }
+"Now we can look at a new data type, the array:"
+{ $code "{ 1 2 3 }" }
+"An array looks like a quotation except it cannot be evaluated; it simply stores data."
+$nl
+"You can perform an operation on each element of an array:"
+{ $example
+    "{ 1 2 3 } [ \"The number is \" write . ] each"
+    "The number is 1"
+    "The number is 2"
+    "The number is 3"
+}
+"You can transform each element, collecting the results in a new array:"
+{ $example "{ 5 12 0 -12 -5 } [ sq ] map ." "{ 25 144 0 144 25 }" }
+"You can create a new array, only containing elements which satisfy some condition:"
+{ $example
+    ": negative? ( n -- ? ) 0 < ;"
+    "{ -12 10 16 0 -1 -3 -9 } [ negative? ] subset ."
+    "{ -12 -1 -3 -9 }"
+}
+{ $references
+    { "Since quotations are real objects, they can be constructed and taken apart at will. You can write code that writes code. Arrays are just one of the various types of sequences, and the sequence operations such as " { $link each } " and " { $link map } " operate on all types of sequences. There are many more sequence iteration operations than the ones above, too." }
+    "dataflow"
+    "sequences"
+} ;
+
+ARTICLE: "cookbook-variables" "Variables cookbook"
+"Before using a variable, you must define a symbol for it:"
+{ $code "SYMBOL: name" }
+"A symbol is a word which pushes itself on the stack when executed. Try it:"
+{ $example "SYMBOL: foo" "foo ." "foo" }
+"Symbols can be passed to the " { $link get } " and " { $link set } " words to read and write variable values:"
+{ $example "\"Slava\" name set" "name get print" "Slava" }
+"If you set variables inside a " { $link with-scope } ", their values will be lost after leaving the scope:"
+{ $example
+    ": print-name name get print ;"
+    "\"Slava\" name set"
+    "["
+    "    \"Diana\" name set"
+    "    \"There, the name is \" write  print-name"
+    "] with-scope"
+    "\"Here, the name is \" write  print-name"
+    "There, the name is Diana\nHere, the name is Slava"
+}
+{ $curious
+    "Variables are dynamically-scoped in Factor."
+}
+{ $references
+    "There is a lot more to be said about variables and namespaces."
+    "namespaces"
+} ;
+
+ARTICLE: "cookbook-vocabs" "Vocabularies cookbook"
+"Rather than being in one flat list, words belong to vocabularies; every word is contained in exactly one. When parsing a word name, the parser searches the " { $emphasis "vocabulary search path" } ". When working at the listener, a useful set of vocabularies is already available. In a source file, all used vocabularies must be imported."
+$nl
+"For example, a source file containing the following code will print a parse error if you try loading it:"
+{ $code "\"Hello world\" print" }
+"The " { $link print } " word is contained inside the " { $vocab-link "io" } " vocabulary, which is available in the listener but must be explicitly added to the search path in source files:"
+{ $code
+    "USE: io"
+    "\"Hello world\" print"
+}
+"Typically a source file will refer to words in multiple vocabularies, and they can all be added to the search path in one go:"
+{ $code "USING: arrays kernel math ;" }
+"New words go into the " { $vocab-link "scratchpad" } " vocabulary by default. You can change this with " { $link POSTPONE: IN: } ":"
+{ $code
+    "IN: time-machine"
+    ": time-travel ( when what -- ) frob fizz flap ;"
+}
+"Note that words must be defined before being referenced. The following is generally invalid:"
+{ $code
+    ": frob accelerate particles ;"
+    ": accelerate accelerator on ;"
+    ": particles [ (particles) ] each ;"
+}
+"You would have to place the first definition after the two others for the parser to accept the file."
+{ $references
+    { }
+    "vocabulary-search"
+    "words"
+    "parser"
+} ;
+
+ARTICLE: "cookbook-sources" "Source file cookbook"
+"By convention, code  is stored in files with the " { $snippet ".factor" } " filename extension. You can load source files using " { $link run-file } ":"
+{ $code "\"hello.factor\" run-file" }
+{ $references
+    "Programs larger than one source file or programs which depend on other libraries should be loaded via the vocabulary system instead. Advanced functionality can be implemented by calling the parser and source reader at run time."
+    "parser-files"
+    "vocabs.loader"
+} ;
+
+ARTICLE: "cookbook-io" "I/O cookbook"
+"Ask the user for their age, and print it back:"
+{ $code
+    ": ask-age ( -- ) \"How old are you?\" print ;"
+    ": read-age ( -- n ) readln string>number ;"
+    ": print-age ( n -- )"
+    "    \"You are \" write"
+    "    number>string write"
+    "    \" years old.\" print ;"
+    ": example ( -- ) ask-age read-age print-age ;"
+    "example"
+}
+"Print the lines of a file in sorted order:"
+{ $code
+    "\"lines.txt\" <file-reader> lines natural-sort [ print ] each"
+}
+"Read 1024 bytes from a file:"
+{ $code
+    "\"data.bin\" <file-reader> [ 1024 read ] with-stream"
+}
+"Send some bytes to a remote host:"
+{ $code
+    "\"myhost\" 1033 <inet> <client>"
+    "[ { 12 17 102 } >string write ] with-stream"
+}
+{ $references
+    { }
+    "number-strings"
+    "io"
+} ;
+
+ARTICLE: "cookbook-philosophy" "Factor philosophy"
+"Factor is a high-level language with automatic memory management, runtime type checking, and strong typing. Factor code should be as simple as possible, but not simpler. If you are coming to Factor from another programming language, one of your first observations might me related to the amount of code you " { $emphasis "don't" } " have to write."
+$nl
+"If you try to write Factor word definitions which are longer than a couple of lines, you will find it hard to keep track of the stack contents. Well-written Factor code is " { $emphasis "factored" } " into short definitions, where each definition is easy to test interactively, and has a clear purpose. Well-chosen word names are critical, and having a thesaurus on hand really helps."
+$nl
+"If you run into problems with stack shuffling, take a deep breath and a step back, and reconsider the problem. A much simpler solution is waiting right around the corner, a natural solution which requires far less stack shuffling and far less code. As a last resort, if no simple solution exists, consider defining a domain-specific language."
+$nl
+"Every time you define a word which simply manipulates sequences, hashtables or objects in an abstract way which is not related to your program domain, check the library to see if you can reuse an existing definition and save yourself some debugging time."
+$nl
+"In addition to writing short definitions and testing them interactively, a great habit to get into is writing unit tests. Factor provides good support for unit testing; see " { $link "tools.test" } "."
+$nl
+"Factor tries to implement as much of itself as possible, because this improves simplicity and performance. One consequence is that Factor exposes its internals for extension and study. You even have the option of using low-level features not usually found in high-level languages, such manual memory management, pointer arithmetic, and inline assembly code."
+$nl
+"Unsafe features are tucked away so that you will not invoke them by accident, or have to use them to solve conventional programming problems. However when the need arises, unsafe features are invaluable, for example you might have to do some pointer arithmetic when interfacing directly with C libraries." ;
+ARTICLE: "cookbook-pitfalls" "Pitfalls to avoid"
+"Factor is a very clean and consistent language. However, it has some limitations and leaky abstractions you should keep in mind, as well as behaviors which differ from other languages you may be used to."
+{ $list
+    "Factor only makes use of one native thread, and Factor threads are scheduled co-operatively. C library calls block the entire VM."
+    "Factor does not hide anything from the programmer, all internals are exposed. It is your responsibility to avoid writing fragile code which depends too much on implementation detail."
+    { "When a source file uses two vocabularies which define words with the same name, the order of the vocabularies in the " { $link POSTPONE: USE: } " or " { $link POSTPONE: USING: } " forms is important. The parser prints warnings when vocabularies shadow words from other vocabularies; see " { $link "vocabulary-search-shadow" } ". The " { $vocab-link "qualified" } " vocabulary implements qualified naming, which can be used to resolve ambiguities." }
+    { "If a literal object appears in a word definition, the object itself is pushed on the stack when the word executes, not a copy. If you intend to mutate this object, you must " { $link clone } " it first. See " { $link "syntax-literals" } "." }
+    { "For a discussion of potential issues surrounding the " { $link f } " object, see " { $link "booleans" } "." }
+    { "Performance-sensitive code should have a static stack effect so that it can be compiled by the optimizing word compiler, which generates more efficient code than the non-optimizing quotation compiler. See " { $link "inference" } " and " { $link "compiler" } "."
+    $nl
+    "This means that methods defined on performance sensitive, frequently-called core generic words such as " { $link nth } " should have static stack effects which are consistent with each other, since a generic word will only have a static stack effect if all methods do."
+    $nl
+    "Unit tests for the " { $vocab-link "inference" } " vocabulary can be used to ensure that any methods your vocabulary defines on core generic words have static stack effects:"
+    { $code "\"inference\" test" }
+    "In general, you should strive to write code with inferrable stack effects, even for sections of a program which are not performance sensitive; the " { $link infer. } " tool together with the optimizing compiler's error reporting can catch many bugs ahead of time." }
+    { "Be careful when calling words which access variables from a " { $link make-assoc } " which constructs an assoc with arbitrary keys, since those keys might shadow variables." }
+    { "If " { $link run-file } " throws a stack depth assertion, it means that the top-level form in the file left behind values on the stack. The stack depth is compared before and after loading a source file, since this type of situation is almost always an error. If you have a legitimate need to load a source file which returns data in some manner, define a word in the source file which produces this data on the stack and call the word after loading the file." }
+} ;
+
+ARTICLE: "cookbook" "Factor cookbook"
+{ $list
+    { "Factor is a dynamically-typed, stack-based language." }
+    { { $link .s } " prints the contents of the stack." }
+    { { $link . } " prints the object at the top of the stack." }
+    { { "You can load vocabularies from " { $snippet "core/" } ", " { $snippet "extra/" } " or " { $snippet "work/" } " with " { $link require } ":" }
+    { $code "\"http.server\" require" } }
+    { { "Some vocabularies have a defined main entry point, and can be run just like applications in an operating system:" }
+        { $code "\"tetris\" run" }
+    }
+    { "Make sure to browse the " { $link "vocab-index" } "." }
+    
+    { "You can load source files with " { $link run-file } ":"
+    { $code "\"my-program.factor\" run-file" }
+    "However, the vocabulary system should be used instead of loading source files directly; it provides automatic code organization and dependency management." }
+    { "If you are reading this from the Factor UI, take a look at " { $link "ui-tools" } "." }
+}
+{ $subsection "cookbook-syntax" }
+{ $subsection "cookbook-colon-defs" }
+{ $subsection "cookbook-combinators" }
+{ $subsection "cookbook-variables" }
+{ $subsection "cookbook-vocabs" }
+{ $subsection "cookbook-sources" }
+{ $subsection "cookbook-io" }
+{ $subsection "cookbook-philosophy" }
+{ $subsection "cookbook-pitfalls" } ;
diff --git a/extra/help/crossref/authors.txt b/extra/help/crossref/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/crossref/crossref-docs.factor b/extra/help/crossref/crossref-docs.factor
new file mode 100644 (file)
index 0000000..5c1f687
--- /dev/null
@@ -0,0 +1,26 @@
+USING: help.crossref help.topics help.syntax help.markup ;
+
+HELP: article-children
+{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
+{ $description "Outputs a sequence of all subsections of " { $snippet "topic" } "." } ;
+
+HELP: article-parent
+{ $values { "topic" "an article name or a word" } { "parent" "an article name or a word" } }
+{ $description "Outputs a help topic which contains " { $snippet "topic" } " as a subsection, or " { $link f } "." } ;
+
+HELP: help-path
+{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
+{ $description "Outputs a sequence of all help articles which contain " { $snippet "topic" } " as a subsection, traversing all the way up to the root." }
+{ $examples
+    { $example "USE: help.crossref" "\"sequences\" help-path ." "{ \"collections\" \"handbook\" }" }
+} ;
+
+HELP: xref-article
+{ $values { "topic" "an article name or a word" } }
+{ $description "Sets the " { $link article-parent } " of each child of this article." }
+$low-level-note ;
+
+HELP: unxref-article
+{ $values { "topic" "an article name or a word" } }
+{ $description "Clears the " { $link article-parent } " of each child of this article." }
+$low-level-note ;
diff --git a/extra/help/crossref/crossref-tests.factor b/extra/help/crossref/crossref-tests.factor
new file mode 100644 (file)
index 0000000..444c7ca
--- /dev/null
@@ -0,0 +1,54 @@
+IN: temporary
+USING: help.crossref help.topics help.markup tools.test words
+definitions assocs sequences kernel namespaces parser arrays
+io.streams.string continuations debugger ;
+
+[ ] [
+    "IN: temporary USING: help.syntax help.markup ; : foo ; HELP: foo \"foo is great\" ; ARTICLE: \"foo\" \"Foo\" { $subsection foo } ;" eval
+] unit-test
+
+[ $subsection ] [
+    "foo" article-content first first
+] unit-test
+
+[ t ] [
+    "foo" article-children
+    "foo" "temporary" lookup 1array sequence=
+] unit-test
+
+[ "foo" ] [ "foo" "temporary" lookup article-parent ] unit-test
+
+[ ] [ "foo" "temporary" lookup forget ] unit-test
+
+[ ] [
+    "IN: temporary USING: help.syntax help.markup ; : bar ; HELP: bar \"bar is great\" ; ARTICLE: \"bar\" \"Bar\" { $subsection bar } ;" eval
+] unit-test
+
+[ ] [
+    "IN: ayy USE: help.syntax ARTICLE: \"b\" \"B\" ;"
+    <string-reader> "ayy" parse-stream drop
+] unit-test
+
+[ ] [
+    "IN: azz USE: help.syntax USE: help.markup ARTICLE: \"a\" \"A\" { $subsection \"b\" } ;"
+    <string-reader> "ayy" parse-stream drop
+] unit-test
+
+[ ] [
+    "IN: ayy USE: help.syntax ARTICLE: \"c\" \"C\" ;"
+    <string-reader> "ayy" parse-stream drop
+] unit-test
+
+[ ] [
+    "IN: azz USE: help.syntax USE: help.markup ARTICLE: \"a\" \"A\" { $subsection \"c\" } ;"
+    <string-reader> "ayy" parse-stream drop
+] unit-test
+
+[ ] [
+    [
+        "IN: azz USE: help.syntax USE: help.markup ARTICLE: \"yyy\" \"YYY\" ; ARTICLE: \"xxx\" \"XXX\" { $subsection \"yyy\" } ; ARTICLE: \"yyy\" \"YYY\" ;"
+        <string-reader> "parent-test" parse-stream drop
+    ] catch [ :1 ] when
+] unit-test
+
+[ "xxx" ] [ "yyy" article-parent ] unit-test
diff --git a/extra/help/crossref/crossref.factor b/extra/help/crossref/crossref.factor
new file mode 100644 (file)
index 0000000..2dae83f
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions generic assocs
+io kernel namespaces prettyprint prettyprint.sections
+sequences words inspector classes help.topics help.markup ;
+IN: help.crossref
+
+: article-children ( topic -- seq )
+    article-content { $subsection } collect-elements ;
+
+M: link uses
+    article-content
+    { $subsection $link $see-also }
+    collect-elements [ \ f or ] map ;
+
+: (help-path) ( topic -- )
+    article-parent [ dup , (help-path) ] when* ;
+
+: help-path ( topic -- seq )
+    [ (help-path) ] { } make ;
+
+: set-article-parents ( parent article -- )
+    article-children [ set-article-parent ] curry* each ;
+
+: xref-article ( topic -- )
+    dup >link xref dup set-article-parents ;
+
+: unxref-article ( topic -- )
+    >link unxref ;
diff --git a/extra/help/crossref/summary.txt b/extra/help/crossref/summary.txt
new file mode 100644 (file)
index 0000000..1a04fcb
--- /dev/null
@@ -0,0 +1 @@
+Help article cross-referencing
diff --git a/extra/help/definitions/authors.txt b/extra/help/definitions/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/definitions/definitions-tests.factor b/extra/help/definitions/definitions-tests.factor
new file mode 100644 (file)
index 0000000..6f67032
--- /dev/null
@@ -0,0 +1,42 @@
+USING: math definitions help.topics help tools.test
+prettyprint parser io.streams.string kernel source-files
+assocs namespaces words io ;
+IN: temporary
+
+[ ] [ \ + >link see ] unit-test
+
+[
+    file-vocabs
+
+    [ 4 ] [
+        "IN: temporary USING: help.syntax ; : hello ; HELP: hello \"test\" ; ARTICLE: \"hello\" \"world\" ; ARTICLE: \"hello2\" \"world\" ;" <string-reader> "foo"
+        parse-stream drop
+
+        "foo" source-file source-file-definitions assoc-size
+    ] unit-test
+
+    [ t ] [ "hello" articles get key? ] unit-test
+    [ t ] [ "hello2" articles get key? ] unit-test
+    [ t ] [
+        "hello" "temporary" lookup "help" word-prop >boolean
+    ] unit-test
+
+    [ 2 ] [
+        "IN: temporary USING: help.syntax ; : hello ; ARTICLE: \"hello\" \"world\" ;" <string-reader> "foo"
+        parse-stream drop
+
+        "foo" source-file source-file-definitions assoc-size
+    ] unit-test
+
+    [ t ] [ "hello" articles get key? ] unit-test
+    [ f ] [ "hello2" articles get key? ] unit-test
+    [ f ] [
+        "hello" "temporary" lookup "help" word-prop
+    ] unit-test
+
+    [ [ ] ] [ "IN: temporary USING: help.syntax ; : xxx ; HELP: xxx ;" parse ] unit-test
+
+    [ ] [ "xxx" "temporary" lookup help ] unit-test
+
+    [ ] [ "xxx" "temporary" lookup >link synopsis print ] unit-test
+] with-scope
diff --git a/extra/help/definitions/definitions.factor b/extra/help/definitions/definitions.factor
new file mode 100644 (file)
index 0000000..76940b5
--- /dev/null
@@ -0,0 +1,39 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: definitions help help.topics help.syntax
+prettyprint.backend prettyprint words kernel effects ;
+IN: help.definitions
+
+! Definition protocol implementation
+
+M: link definer drop \ ARTICLE: \ ; ;
+
+M: link where link-name article article-loc ;
+
+M: link set-where link-name article set-article-loc ;
+
+M: link forget link-name remove-article ;
+
+M: link definition article-content ;
+
+M: link see (see) ;
+
+M: link synopsis*
+    \ ARTICLE: pprint-word
+    dup link-name pprint*
+    article-title pprint* ;
+
+M: word-link definer drop \ HELP: \ ; ;
+
+M: word-link where link-name "help-loc" word-prop ;
+
+M: word-link set-where link-name swap "help-loc" set-word-prop ;
+
+M: word-link definition link-name "help" word-prop ;
+
+M: word-link synopsis*
+    \ HELP: pprint-word
+    link-name dup pprint-word
+    stack-effect. ;
+
+M: word-link forget link-name remove-word-help ;
diff --git a/extra/help/definitions/summary.txt b/extra/help/definitions/summary.txt
new file mode 100644 (file)
index 0000000..a6d82de
--- /dev/null
@@ -0,0 +1 @@
+Help article definition protocol implementation
diff --git a/extra/help/handbook/authors.txt b/extra/help/handbook/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/handbook/handbook.factor b/extra/help/handbook/handbook.factor
new file mode 100644 (file)
index 0000000..9460903
--- /dev/null
@@ -0,0 +1,279 @@
+USING: help help.markup help.syntax help.topics
+namespaces words sequences classes assocs vocabs kernel
+arrays prettyprint.backend kernel.private io tools.browser
+generic ;
+IN: help.handbook
+
+ARTICLE: "conventions" "Conventions"
+"Various conventions are used throughout the Factor documentation and source code."
+{ $heading "Documentation conventions" }
+"Factor documentation consists of two distinct bodies of text. There is a hierarchy of articles, much like this one, and there is word documentation. Help articles reference word documentation, and vice versa, but not every documented word is referenced from some help article."
+$nl
+"Every article has links to parent articles at the top. These can be persued if the article is too specific."
+$nl
+"Some generic words have " { $strong "Description" } " headings, and others have " { $strong "Contract" } " headings. A distinction is made between words which are not intended to be extended with user-defined methods, and those that are."
+{ $heading "Vocabulary naming conventions" }
+"A vocabulary name ending in " { $snippet ".private" } " contains words which are either implementation detail, unsafe, or both. For example, the " { $snippet "sequence.private" } " vocabulary contains words which access sequence elements without bounds checking (" { $link "sequences-unsafe" } ")."
+$nl
+"You should should avoid using internal words from the Factor library unless absolutely necessary. Similarly, your own code can place words in internal vocabularies if you do not want other people to use them unless they have a good reason."
+{ $heading "Word naming conventions" }
+"These conventions are not hard and fast, but are usually a good first step in understanding a word's behavior:"
+{ $table
+    { "General form" "Description" "Examples" }
+    { { $snippet { $emphasis "foo" } "?" } "outputs a boolean" { { $link empty? } } }
+    { { $snippet "?" { $emphasis "foo" } } { "conditionally performs " { $snippet { $emphasis "foo" } } } { { $links ?nth } } }
+    { { $snippet "<" { $emphasis "foo" } ">" } { "creates a new " { $snippet "foo" } } { { $link <array> } } }
+    { { $snippet { $emphasis "foo" } "*" } { "alternative form of " { $snippet "foo" } ", or a generic word called by " { $snippet "foo" } } { { $links at* pprint* } } }
+    { { $snippet "(" { $emphasis "foo" } ")" } { "implementation detail word used by " { $snippet "foo" } } { { $link (clone) } } }
+    { { $snippet "set-" { $emphasis "foo" } } { "sets " { $snippet "foo" } " to a new value" } { $links set-length } }
+    { { $snippet { $emphasis "foo" } "-" { $emphasis "bar" } } { "(tuple accessors) outputs the value of the " { $snippet "bar" } " slot of the " { $snippet "foo" } " at the top of the stack" } { } }
+    { { $snippet "set-" { $emphasis "foo" } "-" { $emphasis "bar" } } { "(tuple mutators) sets the value of the " { $snippet "bar" } " slot of the " { $snippet "foo" } " at the top of the stack" } { } }
+    { { $snippet "with-" { $emphasis "foo" } } { "performs some kind of initialization and cleanup related to " { $snippet "foo" } ", usually in a new dynamic scope" } { $links with-scope with-stream } }
+    { { $snippet "$" { $emphasis "foo" } } { "help markup" } { $links $heading $emphasis } }
+}
+{ $heading "Glossary of terms" }
+"Common terminology and abbreviations used throughout Factor and its documentation:"
+{ $table
+    { "Term" "Definition" }
+    { "alist" { "an association list. See " { $link "alists" } } }
+    { "assoc" "an associative mapping" }
+    { "associative mapping" { "an object whose class implements the " { $link "assocs-protocol" } } }
+    { "boolean"               { { $link t } " or " { $link f } } }
+    { "class"                 { "a set of objects identified by a " { $emphasis "class word" } " together with a discriminating predicate. See " { $link "classes" } } }
+    { "definition specifier"  { "a " { $link word } ", " { $link method-spec } ", " { $link link } ", vocabulary specifier, or any other object whose class implements the " { $link "definition-protocol" } } }
+    { "generalized boolean"   { "an object interpreted as a boolean; a value of " { $link f } " denotes false and anything else denotes true" } }
+    { "generic word"          { "a word whose behavior depends can be specialized on the class of one of its inputs. See " { $link "generic" } } }
+    { "method"                { "a specialized behavior of a generic word on a class. See " { $link "generic" } } }
+    { "object"                { "any datum which can be identified" } }
+    { "pathname string"       { "an OS-specific pathname which identifies a file" } }
+    { "sequence" { "an object whose class implements the " { $link "sequence-protocol" } } }
+    { "slot"                  { "a component of an object which can store a value" } }
+    { "true value"            { "any object not equal to " { $link f } } }
+    { "vocabulary" { "a named set of words. See " { $link "vocabularies" } } }
+    { "vocabulary specifier"  { "a " { $link vocab } ", " { $link vocab-link } " or a string naming a vocabulary" } }
+    { "word"                  { "the basic unit of code, analogous to a function or procedure in other programming languages. See " { $link "words" } } }
+} ;
+
+ARTICLE: "evaluator" "Evaluation semantics"
+{ $link "quotations" } " are evaluated sequentially from beginning to end. When the end is reached, the quotation returns to its caller. As each object in the quotation is evaluated in turn, an action is taken based on its type:"
+{ $list
+    { "a " { $link symbol } " - pushed on the data stack. See " { $link "symbols" } }
+    { "a " { $link compound } " - the associated definition is called. See " { $link "colon-definition" } }
+    { "a" { $link primitive } " - a primitive in the Factor VM is called. See " { $link "primitives" } }
+    { "an " { $link undefined } " -  an error is raised. See " { $link "deferred" } }
+    { "a " { $link wrapper } " - the wrapped object is pushed on the data stack. Wrappers are used to push word objects directly on the stack when they would otherwise execute. See the " { $link POSTPONE: \ } " parsing word." }
+    { "All other types of objects are pushed on the data stack." }
+}
+"If the last action performed is the execution of a word, the current quotation is not saved on the call stack; this is known as " { $snippet "tail-recursion" } " and allows iterative algorithms to execute without incurring unbounded call stack usage."
+$nl
+"There are various ways of implementing these evaluation semantics. See " { $link "compiler" } " and " { $link "meta-interpreter" } "." ;
+
+ARTICLE: "dataflow" "Data and control flow"
+{ $subsection "evaluator" }
+{ $subsection "words" }
+{ $subsection "shuffle-words" }
+{ $subsection "booleans" }
+{ $subsection "conditionals" }
+{ $subsection "basic-combinators" }
+{ $subsection "combinators" }
+{ $subsection "continuations" }
+{ $subsection "threads" } ;
+
+ARTICLE: "objects" "Objects"
+"An " { $emphasis "object" } " is any datum which may be identified. All values are objects in Factor. Each object carries type information, and types are checked at runtime; Factor is dynamically typed."
+{ $subsection "equality" }
+{ $subsection "classes" }
+{ $subsection "tuples" }
+{ $subsection "generic" }
+{ $subsection "mirrors" } ;
+
+USE: random
+
+ARTICLE: "numbers" "Numbers"
+{ $subsection "arithmetic" }
+{ $subsection "math-constants" }
+{ $subsection "math-functions" }
+{ $subsection "number-strings" }
+{ $subsection "random-numbers" }
+"Number implementations:"
+{ $subsection "integers" }
+{ $subsection "rationals" }
+{ $subsection "floats" }
+{ $subsection "complex-numbers" }
+"Advanced features:"
+{ $subsection "math-vectors" }
+{ $subsection "math-intervals" }
+{ $subsection "math-bitfields" } ;
+
+USE: io.buffers
+
+ARTICLE: "collections" "Collections" 
+{ $heading "Sequences" }
+{ $subsection "sequences" }
+"Sequence implementations:"
+{ $subsection "arrays" }
+{ $subsection "vectors" }
+{ $subsection "bit-arrays" }
+{ $subsection "byte-arrays" }
+{ $subsection "float-arrays" }
+{ $subsection "strings" }
+{ $subsection "sbufs" }
+{ $subsection "quotations" }
+{ $heading "Associative mappings" }
+{ $subsection "assocs" }
+{ $subsection "namespaces" }
+{ $subsection "graphs" }
+"Implementations:"
+{ $subsection "hashtables" }
+{ $subsection "alists" }
+{ $heading "Other collections" }
+{ $subsection "queues" }
+{ $subsection "buffers" } ;
+
+USE: io.sockets
+
+ARTICLE: "io" "Input and output" 
+{ $subsection "streams" }
+"Stream implementations:"
+{ $subsection "file-streams" }
+{ $subsection "io.streams.duplex" }
+{ $subsection "io.streams.lines" }
+{ $subsection "io.streams.plain" }
+{ $subsection "io.streams.string" }
+"Advanced features:"
+{ $subsection "stream-binary" }
+{ $subsection "styles" }
+{ $subsection "network-streams" } ;
+
+ARTICLE: "tools" "Developer tools"
+{ $subsection "tools.annotations" }
+{ $subsection "tools.crossref" }
+{ $subsection "editor" }
+{ $subsection "inspector" }
+{ $subsection "meta-interpreter" }
+{ $subsection "tools.memory" }
+{ $subsection "profiling" }
+{ $subsection "tools.test" }
+{ $subsection "timing" }
+{ $subsection "tools.deploy" } ;
+
+ARTICLE: "article-index" "Article index"
+{ $index [ articles get keys ] } ;
+
+ARTICLE: "primitive-index" "Primitive index"
+{ $index [ all-words [ primitive? ] subset ] } ;
+
+ARTICLE: "error-index" "Error index"
+{ $index [ all-errors ] } ;
+
+ARTICLE: "type-index" "Type index"
+{ $index [ builtins get [ ] subset ] } ;
+
+ARTICLE: "class-index" "Class index"
+{ $index [ classes ] } ;
+
+ARTICLE: "program-org" "Program organization"
+{ $subsection "definitions" }
+{ $subsection "vocabularies" }
+{ $subsection "parser" }
+{ $subsection "vocabs.loader" } ;
+
+USE: help.cookbook
+
+ARTICLE: "handbook" "Factor documentation"
+{ $heading "Starting points" }
+{ $subsection "cookbook" }
+{ $subsection "vocab-index" }
+{ $subsection "changes" }
+{ $subsection "cli" }
+{ $heading "Language reference" }
+{ $subsection "conventions" }
+{ $subsection "syntax" }
+{ $subsection "dataflow" }
+{ $subsection "objects" }
+{ $subsection "program-org" }
+{ $heading "Library reference" }
+{ $subsection "numbers" }
+{ $subsection "collections" }
+{ $subsection "io" }
+{ $subsection "os" }
+{ $subsection "alien" }
+{ $heading "Environment reference" }
+{ $subsection "prettyprint" }
+{ $subsection "tools" }
+{ $subsection "help" }
+{ $subsection "inference" }
+{ $subsection "compiler" }
+{ $heading "User interface" }
+{ $about "ui" }
+{ $about "ui.tools" }
+{ $heading "Index" }
+{ $subsection "primitive-index" }
+{ $subsection "error-index" }
+{ $subsection "type-index" }
+{ $subsection "class-index" } ;
+
+
+USING: io.files io.sockets float-arrays inference ;
+
+ARTICLE: "changes" "Changes in the latest release"
+{ $heading "Factor 0.90" }
+{ $subheading "Core" }
+{ $list
+    { "New module system; see " { $link "vocabs.loader" } ". (Eduardo Cavazos)" }
+    { "Tuple constructors are defined differently now; see " { $link "tuple-constructors" } "." }
+    { "Mixin classes implemented; these are essentially extensible unions. See " { $link "mixins" } "."  }
+    { "New " { $link float-array } " data type implements a space-efficient sequence of floats." }
+    { "Moved " { $link <file-appender> } ", " { $link delete-file } ", " { $link make-directory } ", " { $link delete-directory } " words from " { $snippet "libs/io" } " into the core, and fixed them to work on more platforms." }
+    { "New " { $link host-name } " word." }
+    { "The " { $link directory } " word now outputs an array of pairs, with the second element of each pair indicating if that entry is a subdirectory. This saves an unnecessary " { $link stat } " call when traversing directory hierarchies, which speeds things up." }
+    { "IPv6 is now supported, along with Unix domain sockets (the latter on Unix systems only). The stack effects of " { $link <client> } " and " { $link <server> } " have changed, since they now take generic address specifiers; see " { $link "network-streams" } "." }
+    { "The stage 2 bootstrap process is more flexible, and various subsystems such as help, tools and the UI can be omitted by supplying command line switches; see " { $link "bootstrap-cli-args" } "." }
+    { "The " { $snippet "-shell" } " command line switch has been replaced by a " { $snippet "-run" } " command line switch; see " { $link "standard-cli-args" } "." }
+    { "Variable usage inference has been removed; the " { $link infer } " word no longer reports this information." }
+
+}
+{ $subheading "Tools" }
+{ $list
+    { "Stand-alone image deployment; see " { $link "tools.deploy" } "." }
+    { "Stand-alone application bundle deployment on Mac OS X; see " { $vocab-link "tools.deploy.app" } "." }
+    { "New vocabulary browser tool in the UI." }
+    { "New profiler tool in the UI." }
+}
+{ $subheading "Extras" }
+"Most existing libraries were improved when ported to the new module system; the most notable changes include:"
+{ $list
+    { { $vocab-link "asn1" } ": ASN1 parser and writer. (Elie Chaftari)" }
+    { { $vocab-link "benchmarks" } ": new set of benchmarks." }
+    { { $vocab-link "cfdg" } ": Context-free design grammar implementation; see " { $url "http://www.chriscoyne.com/cfdg/" } ". (Eduardo Cavazos)" }
+    { { $vocab-link "cryptlib" } ": Cryptlib library binding. (Elie Chaftari)" }
+    { { $vocab-link "cryptlib.streams" } ": Streams which perform SSL encryption and decryption. (Matthew Willis)" }
+    { { $vocab-link "hints" } ": Give type specialization hints to the compiler." }
+    { { $vocab-link "inverse" } ": Invertible computation and concatenative pattern matching. (Daniel Ehrenberg)" }
+    { { $vocab-link "ldap" } ": OpenLDAP library binding. (Elie Chaftari)" }
+    { { $vocab-link "locals" } ": Efficient lexically scoped locals, closures, and local words." }
+    { { $vocab-link "mortar" } ": Experimental message-passing object system. (Eduardo Cavazos)" }
+    { { $vocab-link "openssl" } ": OpenSSL library binding. (Elie Chaftari)" }
+    { { $vocab-link "pack" } ": Utility for reading and writing binary data. (Doug Coleman)" }
+    { { $vocab-link "pdf" } ": Haru PDF library binding. (Elie Chaftari)" }
+    { { $vocab-link "qualified" } ": Refer to words from another vocabulary without adding the entire vocabulary to the search path. (Daniel Ehrenberg)" }
+    { { $vocab-link "roman" } ": Reading and writing Roman numerals. (Doug Coleman)" }
+    { { $vocab-link "scite" } ": SciTE editor integration. (Clemens Hofreither)" }
+    { { $vocab-link "smtp" } ": SMTP client with support for CRAM-MD5 authentication. (Elie Chaftari, Dirk Vleugels)" }
+    { { $vocab-link "tuple-arrays" } ": Space-efficient packed tuple arrays. (Daniel Ehrenberg)" }
+    { { $vocab-link "unicode" } ": major new functionality added. (Daniel Ehrenberg)" }
+}
+{ $subheading "Performance" }
+{ $list
+    { "The " { $link curry } " word now runs in constant time, and curried quotations can be called from compiled code; this allows for abstractions and idioms which were previously impractical due to performance issues. In particular, words such as " { $snippet "each-with" } " and " { $snippet "map-with" } " are gone; " { $snippet "each-with" } " can now be written as " { $snippet "curry* each" } ", and similarly for other " { $snippet "-with" } " combinators." }
+    "Improved generational promotion strategy in garbage collector reduces the amount of junk which makes its way into tenured space, which in turn reduces the frequency of full garbage collections."
+    "Faster generic word dispatch and union membership testing."
+    { "Alien memory accessors (" { $link "reading-writing-memory" } ") are compiled as intrinsics where possible, which improves performance in code which iteroperates with C libraries." }
+}
+{ $subheading "Platforms" }
+{ $list
+    "Networking support added for Windows CE. (Doug Coleman)"
+    "UDP/IP networking support added for all Windows platforms. (Doug Coleman)"
+    "Solaris/x86 fixes. (Samuel Tardieu)"
+    "Linux/AMD64 port works again."
+} ;
diff --git a/extra/help/handbook/summary.txt b/extra/help/handbook/summary.txt
new file mode 100644 (file)
index 0000000..de1154b
--- /dev/null
@@ -0,0 +1 @@
+Factor developer's handbook
diff --git a/extra/help/help-docs.factor b/extra/help/help-docs.factor
new file mode 100644 (file)
index 0000000..2d53e4e
--- /dev/null
@@ -0,0 +1,156 @@
+USING: help.markup help.crossref help.topics help.syntax
+definitions io prettyprint inspector ;
+IN: help
+
+ARTICLE: "printing-elements" "Printing markup elements"
+"When writing documentation, it is useful to be able to print markup elements for testing purposes. Markup elements which are strings or arrays of elements are printed in the obvious way. Markup elements of the form " { $snippet "{ $directive content... }" } " are printed by executing the " { $snippet "$directive" } " word with the element content on the stack."
+{ $subsection print-element }
+{ $subsection print-content } ;
+
+ARTICLE: "span-elements" "Span elements"
+{ $subsection $emphasis }
+{ $subsection $strong }
+{ $subsection $link }
+{ $subsection $vocab-link }
+{ $subsection $snippet }
+{ $subsection $url } ;
+
+ARTICLE: "block-elements" "Block elements"
+"Paragraph break:"
+{ $subsection $nl }
+"Standard headings for word documentation:"
+{ $subsection $values }
+{ $subsection $description }
+{ $subsection $class-description }
+{ $subsection $error-description }
+{ $subsection $var-description }
+{ $subsection $contract }
+{ $subsection $examples }
+{ $subsection $warning }
+{ $subsection $notes }
+{ $subsection $side-effects }
+{ $subsection $errors }
+{ $subsection $see-also }
+"Boilerplate paragraphs:"
+{ $subsection $low-level-note }
+{ $subsection $io-error }
+"Some additional elements:"
+{ $subsection $code }
+{ $subsection $curious }
+{ $subsection $example }
+{ $subsection $heading }
+{ $subsection $links }
+{ $subsection $list }
+{ $subsection $markup-example }
+{ $subsection $references }
+{ $subsection $see }
+{ $subsection $subsection }
+{ $subsection $table } ;
+
+ARTICLE: "markup-utils" "Markup element utilities"
+"Utility words to assist in defining new elements:"
+{ $subsection simple-element }
+{ $subsection ($span) }
+{ $subsection ($block) } ;
+
+ARTICLE: "element-types" "Element types"
+"Markup elements can be classified into two broad categories, block elements and span elements. Block elements are inset with newlines before and after, whereas span elements flow with the paragraph text."
+{ $subsection "span-elements" }
+{ $subsection "block-elements" }
+{ $subsection "markup-utils" } ;
+
+ARTICLE: "browsing-help" "Browsing documentation"
+"The easiest way to browse the help is from the help browser tool in the UI, however you can also display help topics in the listener. Help topics are identified by article name strings, or words. You can request a specific help topic:"
+{ $subsection help }
+"You can also display the main help article for a vocabulary:"
+{ $subsection about } ;
+
+ARTICLE: "writing-help" "Writing documentation"
+"By convention, documentation is written in files whose names end with " { $snippet "-docs.factor" } ". Vocabulary documentation should be placed in the same directory as the vocabulary source code; see " { $link "vocabs.loader" } "."
+$nl
+"A pair of parsing words are used to define free-standing articles and to associate documentation with words:"
+{ $subsection POSTPONE: ARTICLE: }
+{ $subsection POSTPONE: HELP: }
+"A parsing word defines the main help article for a vocabulary:"
+{ $subsection POSTPONE: ABOUT: }
+"The " { $emphasis "content" } " in both cases is a " { $emphasis "markup element" } ", a recursive structure taking one of the following forms:"
+{ $list
+    { "a string," }
+    { "an array of markup elements," }
+    { "or an array of the form " { $snippet "{ $directive content... }" } ", where " { $snippet "$directive" } " is a markup word whose name starts with " { $snippet "$" } ", and " { $snippet "content..." } " is a series of markup elements" }
+}
+{ $subsection "element-types" }
+"Related words can be cross-referenced:"
+{ $subsection related-words } ;
+
+ARTICLE: "help-impl" "Help system implementation"
+"Help topic protocol:"
+{ $subsection article-name }
+{ $subsection article-title }
+{ $subsection article-content }
+{ $subsection article-parent }
+{ $subsection set-article-parent }
+"Boilerplate word help can be automatically generated (for example, slot accessor help):"
+{ $subsection word-help }
+{ $subsection word-help* }
+"Help article implementation:"
+{ $subsection article }
+{ $subsection articles }
+"Links:"
+{ $subsection link }
+{ $subsection >link }
+"Utilities for traversing markup element trees:"
+{ $subsection elements }
+{ $subsection collect-elements }
+"Links and " { $link article } " instances implement the definition protocol; refer to " { $link "definitions" } "." ;
+
+ARTICLE: "help" "Help system"
+"The help system maintains documentation written in a simple markup language, along with cross-referencing and search. Documentation can either exist as free-standing " { $emphasis "articles" } " or be associated with words."
+{ $subsection "browsing-help" }
+{ $subsection "writing-help" }
+{ $subsection "help-impl" } ;
+
+ABOUT: "help"
+
+HELP: $title
+{ $values { "topic" "a help article name or a word" } }
+{ $description "Prints a help article's title, or a word's " { $link summary } ", depending on the type of " { $snippet "topic" } "." } ;
+
+HELP: help
+{ $values { "topic" "an article name or a word" } }
+{ $description
+    "Displays a help article or documentation associated to a word on the " { $link stdio } " stream."
+} ;
+
+HELP: about
+{ $values { "vocab" "a vocabulary specifier" } }
+{ $description
+    "Displays the main help article for the vocabulary. The main help article is set with the " { $link POSTPONE: ABOUT: } " parsing word."
+} ;
+
+HELP: :help
+{ $description "Displays documentation for the most recent error." } ;
+
+HELP: $subsection
+{ $values { "element" "a markup element of the form " { $snippet "{ topic }" } } }
+{ $description "Prints a large clickable link to the help topic named by the first string element of " { $snippet "element" } "." }
+{ $examples
+    { $code "{ $subsection \"sequences\" }" }
+} ;
+
+HELP: $index
+{ $values { "element" "a markup element containing one quotation with stack effect " { $snippet "( quot -- )" } } }
+{ $description "Calls the quotation to generate a sequence of help topics, and outputs a " { $link $subsection } " for each one." } ;
+
+HELP: ($index)
+{ $values { "seq" "a sequence of help article names and words" } { "quot" "a quotation with stack effect " { $snippet "( topic -- )" } } }
+{ $description "Writes a list of " { $link $subsection } " elements to the " { $link stdio } " stream." } ;
+
+HELP: xref-help
+{ $description "Update help cross-referencing. Usually this is done automatically." } ;
+
+HELP: sort-articles
+{ $values { "seq" "a sequence of help topics" } { "newseq" "a sequence of help topics" } }
+{ $description "Sorts a sequence of help topics." } ;
+
+{ article-children article-parent xref-help } related-words
diff --git a/extra/help/help.factor b/extra/help/help.factor
new file mode 100644 (file)
index 0000000..975ed73
--- /dev/null
@@ -0,0 +1,142 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays io kernel namespaces parser prettyprint sequences
+words assocs definitions generic quotations effects
+slots continuations tuples debugger combinators
+vocabs help.stylesheet help.topics help.crossref help.markup
+sorting ;
+IN: help
+
+GENERIC: word-help* ( word -- content )
+
+: word-help ( word -- content )
+    dup "help" word-prop [ ] [
+        dup word-help* dup
+        [ swap 2array 1array ] [ 2drop f ] if
+    ] ?if ;
+
+M: word word-help* drop f ;
+
+M: slot-reader word-help* drop \ $slot-reader ;
+
+M: slot-writer word-help* drop \ $slot-writer ;
+
+: all-articles ( -- seq )
+    articles get keys
+    all-words [ word-help ] subset append ;
+
+: xref-help ( -- )
+    all-articles [ xref-article ] each ;
+
+: error? ( word -- ? )
+    \ $error-description swap word-help elements empty? not ;
+
+: sort-articles ( seq -- newseq )
+    [ dup article-title ] { } map>assoc sort-values 0 <column> ;
+
+: all-errors ( -- seq )
+    all-words [ error? ] subset sort-articles ;
+
+M: word article-name word-name ;
+
+M: word article-title
+    dup parsing? over symbol? or [
+        word-name
+    ] [
+        dup word-name
+        swap stack-effect
+        [ effect>string " " swap 3append ] when*
+    ] if ;
+
+M: word article-content
+    [
+        \ $vocabulary over 2array ,
+        dup word-help %
+        \ $related over 2array ,
+        dup get-global [ \ $value swap 2array , ] when*
+        \ $definition swap 2array ,
+    ] { } make ;
+
+M: word article-parent "help-parent" word-prop ;
+
+M: word set-article-parent swap "help-parent" set-word-prop ;
+
+: $doc-path ( article -- )
+    help-path dup empty? [
+        drop
+    ] [
+        [
+            help-path-style get [
+                "Parent topics: " write $links
+            ] with-style
+        ] ($block)
+    ] if ;
+
+: $title ( topic -- )
+    title-style get [
+        title-style get [
+            dup [
+                dup article-title swap >link write-object
+            ] ($block) $doc-path
+        ] with-nesting
+    ] with-style nl ;
+
+: help ( topic -- )
+    last-element off dup $title
+    article-content print-content nl ;
+
+: about ( vocab -- )
+    dup vocab-help [
+        help
+    ] [
+        "The " write vocab-name write
+        " vocabulary does not define a main help article." print
+        "To define one, refer to \\ ABOUT: help" print
+    ] ?if ;
+
+: ($index) ( articles -- )
+    subsection-style get [
+        sort-articles [ nl ] [ ($subsection) ] interleave
+    ] with-style ;
+
+: $index ( element -- )
+    first call dup empty?
+    [ drop ] [ [ ($index) ] ($block) ] if ;
+
+: $about ( element -- )
+    first vocab-help [ 1array $subsection ] when* ;
+
+: (:help-multi)
+    "This error has multiple delegates:" print
+    ($index) nl ;
+
+: (:help-none)
+    drop "No help for this error. " print ;
+
+: :help ( -- )
+    error get delegates [ error-help ] map [ ] subset
+    {
+        { [ dup empty? ] [ (:help-none) ] }
+        { [ dup length 1 = ] [ first help ] }
+        { [ t ] [ (:help-multi) ] }
+    } cond ;
+
+: remove-article ( name -- )
+    dup articles get key? [
+        dup unxref-article
+        dup articles get delete-at
+    ] when drop ;
+
+: add-article ( article name -- )
+    [ remove-article ] keep
+    [ articles get set-at ] keep
+    xref-article ;
+
+: remove-word-help ( word -- )
+    dup word-help [ dup unxref-article ] when
+    f "help" set-word-prop ;
+
+: set-word-help ( content word -- )
+    [ remove-word-help ] keep
+    [ swap "help" set-word-prop ] keep
+    xref-article ;
diff --git a/extra/help/lint/authors.txt b/extra/help/lint/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/lint/lint-docs.factor b/extra/help/lint/lint-docs.factor
new file mode 100644 (file)
index 0000000..6ff0699
--- /dev/null
@@ -0,0 +1,14 @@
+USING: help.markup help.syntax ;
+IN: help.lint
+
+ARTICLE: "help.lint" "Help lint tool"
+"A quick and dirty tool to check documentation in an automated fashion."
+{ $list
+    "ensures examples run and produce stated output"
+    { "ensures " { $link $see-also } " elements don't contain duplicate entries" }
+    { "ensures " { $link $vocab-link } " elements point to modules which actually exist" }
+    { "ensures that " { $link $values } " match the stack effect declaration" }
+    { "ensures that word help articles actually render (this catches broken links, improper nesting, etc)" }
+} ;
+
+ABOUT: "help.lint"
diff --git a/extra/help/lint/lint.factor b/extra/help/lint/lint.factor
new file mode 100644 (file)
index 0000000..3621b3c
--- /dev/null
@@ -0,0 +1,121 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: sequences parser kernel help help.markup help.topics
+words strings classes tools.browser namespaces io
+io.streams.string prettyprint definitions arrays vectors
+combinators splitting debugger hashtables sorting effects vocabs
+vocabs.loader assocs editors continuations classes.predicate ;
+IN: help.lint
+
+: check-example ( element -- )
+    1 tail [
+        1 head* "\n" join 1vector
+        [
+            use [ clone ] change
+            [ eval>string ] with-datastack
+        ] with-scope peek "\n" ?tail drop
+    ] keep
+    peek assert= ;
+
+: check-examples ( word element -- )
+    nip \ $example swap elements [ check-example ] each ;
+
+: extract-values ( element -- seq )
+    \ $values swap elements dup empty? [
+        first 1 tail [ first ] map prune natural-sort
+    ] unless ;
+
+: effect-values ( word -- seq )
+    stack-effect dup effect-in swap effect-out
+    append [ string? ] subset prune natural-sort ;
+
+: check-values ( word element -- )
+    {
+        $shuffle
+        $values-x/y
+        $slot-reader
+        $slot-writer
+        $predicate
+        $class-description
+        $error-description
+    }
+    over [ elements empty? ] curry all?
+    pick "declared-effect" word-prop and
+    [ extract-values >array >r effect-values >array r> assert= ]
+    [ 2drop ] if ;
+
+: check-see-also ( word element -- )
+    nip \ $see-also swap elements [
+        1 tail dup prune [ length ] 2apply assert=
+    ] each ;
+
+: vocab-exists? ( name -- ? )
+    dup vocab swap "all-vocabs" get member? or ;
+
+: check-modules ( word element -- )
+    nip \ $vocab-link swap elements [
+        second
+        vocab-exists? [ "Missing vocabulary" throw ] unless
+    ] each ;
+
+: check-rendering ( word element -- )
+    [ help ] string-out drop ;
+
+: all-word-help ( -- seq )
+    all-words [ word-help ] subset ;
+
+TUPLE: help-error topic ;
+
+: <help-error> ( topic delegate -- error )
+    { set-help-error-topic set-delegate } help-error construct ;
+
+: fix-help ( error -- )
+    dup delegate error.
+    help-error-topic >link edit
+    "Press ENTER when done." print flush readln drop
+    refresh-all ;
+
+: check-word ( word -- )
+    dup . flush
+    [
+        dup word-help [
+            2dup check-examples
+            2dup check-values
+            2dup check-see-also
+            2dup check-modules
+            2dup drop check-rendering
+        ] assert-depth 2drop
+    ] [
+        dupd <help-error> fix-help check-word
+    ] recover ;
+
+: check-words ( -- )
+    [
+        all-vocabs-seq [ vocab-name ] map
+        "all-vocabs" set
+        all-word-help [ check-word ] each
+    ] with-scope ;
+
+: check-article ( article -- )
+    dup . flush
+    [
+        [ dup check-rendering ] assert-depth drop
+    ] [
+        dupd <help-error> fix-help check-article
+    ] recover ;
+
+: check-articles ( -- )
+    articles get keys [ check-article ] each ;
+
+: check-help ( -- ) check-words check-articles ;
+
+: unlinked-words ( -- seq )
+    all-word-help [ article-parent not ] subset ;
+
+: linked-undocumented-words ( -- seq )
+    all-words
+    [ word-help not ] subset
+    [ article-parent ] subset
+    [ "predicating" word-prop not ] subset ;
+
+MAIN: check-help
diff --git a/extra/help/lint/summary.txt b/extra/help/lint/summary.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/extra/help/lint/tags.txt b/extra/help/lint/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/help/markup/authors.txt b/extra/help/markup/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/markup/markup-docs.factor b/extra/help/markup/markup-docs.factor
new file mode 100644 (file)
index 0000000..0af6595
--- /dev/null
@@ -0,0 +1,206 @@
+USING: help.syntax help.stylesheet arrays
+definitions io math prettyprint sequences ;
+IN: help.markup
+
+ABOUT: "element-types"
+
+HELP: print-element
+{ $values { "element" "a markup element" } }
+{ $description "Prints a markup element to the " { $link stdio } " stream." } ;
+
+HELP: print-content
+{ $values { "element" "a markup element" } }
+{ $description "Prints a top-level markup element to the " { $link stdio } " stream." } ;
+
+HELP: simple-element
+{ $class-description "Class of simple elements, which are just arrays of elements." } ;
+
+HELP: ($span)
+{ $values { "quot" "a quotation" } }
+{ $description "Prints an inline markup element." } ;
+
+HELP: ($block)
+{ $values { "quot" "a quotation" } }
+{ $description "Prints a block markup element with newlines before and after." } ;
+
+HELP: $heading
+{ $values { "element" "a markup element" } }
+{ $description "Prints a markup element, usually a string, as a block with the " { $link heading-style } "." }
+{ $examples
+    { $markup-example { $heading "What remains to be discovered" } }
+} ;
+
+HELP: $subheading
+{ $values { "element" "a markup element of the form " { $snippet "{ title content }" } } }
+{ $description "Prints a markup element, usually a string, as a block with the " { $link strong-style } "." }
+{ $examples
+    { $markup-example { $subheading "Developers, developers, developers!" } }
+} ;
+
+HELP: $code
+{ $values { "element" "a markup element of the form " { $snippet "{ string... }" } } }
+{ $description "Prints code examples, as seen in many help articles. The markup element must be an array of strings." }
+{ $notes
+    "The code becomes clickable if the output stream supports it, and clicking it opens a listener window with the text inserted at the input prompt."
+    $nl
+    "If you want to show code along with sample output, use the " { $link $example } " element."
+}
+{ $examples
+    { $markup-example { $code "2 2 + ." } }
+} ;
+
+HELP: $vocabulary
+{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
+{ $description "Prints a word's vocabulary. This markup element is automatically output by the help system, so help descriptions of parsing words should not call it." } ;
+
+HELP: $description
+{ $values { "element" "a markup element" } }
+{ $description "Prints the description subheading found on the help page of most words." } ;
+
+HELP: $contract
+{ $values { "element" "a markup element" } }
+{ $description "Prints a heading followed by a contract, found on the help page of generic words. Every generic word should document a contract which specifies method behavior that callers can rely upon, and implementations must obey." }
+{ $examples
+    { $markup-example { $contract "Methods of this generic word must always crash." } }
+} ;
+
+HELP: $examples
+{ $values { "element" "a markup element" } }
+{ $description "Prints a heading followed by some examples. Word documentation should include examples, at least if the usage of the word is not entirely obvious." }
+{ $examples
+    { $markup-example { $examples { $example "2 2 + ." "4" } } }
+} ;
+
+HELP: $example
+{ $values { "element" "a markup element of the form " { $snippet "{ inputs... output }" } } }
+{ $description "Prints a clickable example with sample output. The markup element must be an array of strings. All but the last string are joined by newlines and taken as the input text, and the last string is the output. The example becomes clickable if the output stream supports it, and clicking it opens a listener window with the input text inserted at the input prompt." }
+{ $examples
+    "The output text should be a string of what the input prints when executed, not the final stack contents or anything like that. So the following is an incorrect example:"
+    { $markup-example { $unchecked-example "2 2 +" "4" } }
+    "However the following is right:"
+    { $markup-example { $example "2 2 + ." "4" } }
+    "Examples can incorporate a call to " { $link .s } " to show multiple output values; the convention is that you may assume the stack is empty before the example evaluates."
+} ;
+
+HELP: $markup-example
+{ $values { "element" "a markup element" } }
+{ $description "Prints a clickable example showing the prettyprinted source text of " { $snippet "element" } " followed by rendered output. The example becomes clickable if the output stream supports it." }
+{ $examples
+    { $markup-example { $markup-example { $emphasis "Hi" } } }
+} ;
+
+HELP: $warning
+{ $values { "element" "a markup element" } }
+{ $description "Prints an element inset in a block styled as so to draw the reader's attention towards it." }
+{ $examples
+    { $markup-example { $warning "Incorrect use of this product may cause serious injury or death." } }
+} ;
+
+HELP: $link
+{ $values { "element" "a markup element of the form " { $snippet "{ topic }" } } }
+{ $description "Prints a link to a help article or word." }
+{ $examples
+    { $markup-example { $link "queues" } }
+    { $markup-example { $link + } }
+} ;
+
+HELP: textual-list
+{ $values { "seq" "a sequence" } { "quot" "a quotation with stack effect " { $snippet "( elt -- )" } } }
+{ $description "Applies the quotation to each element of the sequence, printing a comma between each pair of elements." }
+{ $examples
+    { $example "USE: help.markup" "{ \"fish\" \"chips\" \"salt\" } [ write ] textual-list" "fish, chips, salt" }
+} ;
+
+HELP: $links
+{ $values { "topics" "a sequence of article names or words" } }
+{ $description "Prints a series of links to help articles or word documentation." }
+{ $notes "This markup element is used to implement " { $link $links } "." }
+{ $examples
+    { $markup-example { $links + - * / } }
+} ;
+
+HELP: $see-also
+{ $values { "topics" "a sequence of article names or words" } }
+{ $description "Prints a heading followed by a series of links." }
+{ $examples
+    { $markup-example { $see-also "graphs" "queues" } }
+} ;
+
+{ $see-also $related related-words } related-words
+
+HELP: $table
+{ $values { "element" "an array of arrays of markup elements" } }
+{ $description "Prints a table given as an array of rows, where each row must have the same number of columns." }
+{ $examples
+    { $markup-example
+        { $table
+            { "a" "b" "c" }
+            { "d" "e" "f" } 
+        }
+    }
+} ;
+
+HELP: $values
+{ $values { "element" "an array of pairs of markup elements" } }
+{ $description "Prints the description of arguments and values found on every word help page. The first element of a pair is the argument name and is output with " { $link $snippet } ". The remainder can be an element of any form." } ;
+
+HELP: $list
+{ $values { "element" "an array of markup elements" } }
+{ $description "Prints a bulleted list of markup elements." }
+{ $notes
+    "A common mistake is that if an item consists of more than just a string, it will be broken up as several items:"
+    { $markup-example
+        { $list
+            "First item"
+            "Second item " { $emphasis "with emphasis" }
+        }
+    }
+    "The fix is easy; just group the two markup elements making up the second item into one markup element:"
+    { $markup-example
+        { $list
+            "First item"
+            { "Second item " { $emphasis "with emphasis" } }
+        }
+    }
+} ;
+
+HELP: $errors
+{ $values { "element" "a markup element" } }
+{ $description "Prints the errors subheading found on the help page of some words. This section should document any errors thrown by the word." }
+{ $examples
+    { $markup-example { $errors "I/O errors, network errors, hardware errors... oh my!" } }
+} ;
+
+HELP: $side-effects
+{ $values { "element" "a markup element of the form " { $snippet "{ string... }" } } }
+{ $description "Prints a heading followed by a list of input values or variables which are modified by the word being documented." }
+{ $examples
+    { $markup-example
+        { { $values { "seq" "a mutable sequence" } } { $side-effects "seq" } }
+    }
+} ;
+
+HELP: $notes
+{ $values { "element" "a markup element" } }
+{ $description "Prints the errors subheading found on the help page of some words. This section should usage tips and pitfalls." } ;
+
+HELP: $see
+{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
+{ $description "Prints the definition of " { $snippet "word" } " by calling " { $link see } "." }
+{ $examples
+    { $markup-example { "Here is a word definition:" { $see reverse } } }
+} ;
+
+HELP: $definition
+{ $values { "element" "a markup element of the form " { $snippet "{ word }" } } }
+{ $description "Prints a heading followed by the definition of " { $snippet "word" } " by calling " { $link see } "." } ;
+
+HELP: $curious
+{ $values { "element" "a markup element" } }
+{ $description "Prints a heading followed by a markup element." }
+{ $notes "This element type is used by the cookbook-style introductory articles in the " { $link "handbook" } "." } ;
+
+HELP: $references
+{ $values { "element" "a markup element of the form " { $snippet "{ topic... }" } } }
+{ $description "Prints a heading followed by a series of links." }
+{ $notes "This element type is used by the cookbook-style introductory articles in the " { $link "handbook" } "." } ;
diff --git a/extra/help/markup/markup-tests.factor b/extra/help/markup/markup-tests.factor
new file mode 100644 (file)
index 0000000..f8675be
--- /dev/null
@@ -0,0 +1,29 @@
+USING: definitions help help.markup kernel sequences tools.test
+words parser namespaces assocs generic io.streams.string ;
+IN: temporary
+
+TUPLE: blahblah quux ;
+
+: test-slot blahblah "slots" word-prop second ;
+
+[
+    { { "blahblah" { $instance blahblah } } { "quux" { $instance object } } }
+] [
+    test-slot blahblah ($spec-reader-values)
+] unit-test
+
+[ ] [
+    test-slot blahblah $spec-reader-values
+] unit-test
+
+[ "an int" ] [ [ { "int" } $instance ] string-out ] unit-test
+
+[ ] [ \ blahblah-quux help ] unit-test
+[ ] [ \ set-blahblah-quux help ] unit-test
+[ ] [ \ blahblah? help ] unit-test
+
+: fooey "fooey" throw ;
+
+[ ] [ \ fooey help ] unit-test
+
+[ ] [ gensym help ] unit-test
diff --git a/extra/help/markup/markup.factor b/extra/help/markup/markup.factor
new file mode 100644 (file)
index 0000000..c2eddaf
--- /dev/null
@@ -0,0 +1,361 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions generic io kernel assocs hashtables
+namespaces parser prettyprint sequences strings io.styles
+vectors words math sorting splitting classes
+slots vocabs help.stylesheet help.topics vocabs.loader ;
+IN: help.markup
+
+! Simple markup language.
+
+! <element> ::== <string> | <simple-element> | <fancy-element>
+! <simple-element> ::== { <element>* }
+! <fancy-element> ::== { <type> <element> }
+
+! Element types are words whose name begins with $.
+
+PREDICATE: array simple-element
+    dup empty? [ drop t ] [ first word? not ] if ;
+
+SYMBOL: last-element
+SYMBOL: span
+SYMBOL: block
+SYMBOL: table
+
+: last-span? last-element get span eq? ;
+: last-block? last-element get block eq? ;
+
+: ($span) ( quot -- )
+    last-block? [ nl ] when
+    span last-element set
+    call ; inline
+
+GENERIC: print-element ( element -- )
+
+M: simple-element print-element [ print-element ] each ;
+M: string print-element [ write ] ($span) ;
+M: array print-element unclip execute ;
+M: word print-element { } swap execute ;
+M: f print-element drop ;
+
+: print-element* ( element style -- )
+    [ print-element ] with-style ;
+
+: with-default-style ( quot -- )
+    default-style get [
+        last-element off
+        H{ } swap with-nesting
+    ] with-style ; inline
+
+: print-content ( element -- )
+    [ print-element ] with-default-style ;
+
+: ($block) ( quot -- )
+    last-element get { f table } member? [ nl ] unless
+    span last-element set
+    call
+    block last-element set ; inline
+
+! Some spans
+
+: $snippet [ snippet-style get print-element* ] ($span) ;
+
+: $emphasis [ emphasis-style get print-element* ] ($span) ;
+
+: $strong [ strong-style get print-element* ] ($span) ;
+
+: $url [ url-style get print-element* ] ($span) ;
+
+: $nl nl nl drop ;
+
+! Some blocks
+: ($heading)
+    last-element get [ nl ] when ($block) ; inline
+
+: $heading ( element -- )
+    [ heading-style get print-element* ] ($heading) ;
+
+: $subheading ( element -- )
+    [ strong-style get print-element* ] ($heading) ;
+
+: ($code-style) ( presentation -- hash )
+    presented associate code-style get union ;
+
+: ($code) ( presentation quot -- )
+    [
+        snippet-style get [
+            last-element off
+            >r ($code-style) r> with-nesting
+        ] with-style
+    ] ($block) ; inline
+
+: $code ( element -- )
+    "\n" join dup <input> [ write ] ($code) ;
+
+: $syntax ( element -- ) "Syntax" $heading $code ;
+
+: $description ( element -- )
+    "Word description" $heading print-element ;
+
+: $class-description ( element -- )
+    "Class description" $heading print-element ;
+
+: $error-description ( element -- )
+    "Error description" $heading print-element ;
+
+: $var-description ( element -- )
+    "Variable description" $heading print-element ;
+
+: $contract ( element -- )
+    "Generic word contract" $heading print-element ;
+
+: $examples ( element -- )
+    "Examples" $heading print-element ;
+
+: $example ( element -- )
+    1 swap cut* swap "\n" join dup <input> [
+        input-style get format nl print-element
+    ] ($code) ;
+
+: $unchecked-example ( element -- )
+    #! help-lint ignores these.
+    $example ;
+
+: $markup-example ( element -- )
+    first dup unparse " print-element" append 1array $code
+    print-element ;
+
+: $warning ( element -- )
+    [
+        warning-style get [
+            last-element off
+            "Warning" $heading print-element
+        ] with-nesting
+    ] ($heading) ;
+
+! Some links
+: write-link ( string object -- )
+    link-style get [ write-object ] with-style ;
+
+: ($link) ( article -- )
+    dup article-name swap >link write-link
+    span last-element set ;
+
+: $link ( element -- )
+    first ($link) ;
+
+: ($subsection) ( object -- )
+    [ article-title ] keep >link write-object ;
+
+: $subsection ( element -- )
+    [
+        subsection-style get [
+            bullet get write bl
+            first ($subsection)
+        ] with-style
+    ] ($block) ;
+
+: ($vocab-link) ( vocab -- ) dup f >vocab-link write-link ;
+
+: $vocab-link ( element -- ) first ($vocab-link) ;
+
+: $vocabulary ( element -- )
+    first word-vocabulary [
+        "Vocabulary" $heading nl ($vocab-link)
+    ] when* ;
+
+: textual-list ( seq quot -- )
+    [ ", " print-element ] swap interleave ; inline
+
+: $links ( topics -- )
+    [ [ ($link) ] textual-list ] ($span) ;
+
+: $see-also ( topics -- )
+    "See also" $heading $links ;
+
+: related-words ( seq -- )
+    dup [ "related" set-word-prop ] curry each ;
+
+: $related ( element -- )
+    first dup "related" word-prop remove dup empty?
+    [ drop ] [ $see-also ] if ;
+
+: ($grid) ( style quot -- )
+    [
+        table-content-style get [
+            swap [ last-element off call ] tabular-output
+        ] with-style
+    ] ($block) table last-element set ; inline
+
+: $list ( element -- )
+    list-style get [
+        [
+            [
+                bullet get write-cell
+                [ print-element ] with-cell
+            ] with-row
+        ] each
+    ] ($grid) ;
+
+: $table ( element -- )
+    table-style get [
+        [
+            [
+                [ [ print-element ] with-cell ] each
+            ] with-row
+        ] each
+    ] ($grid) ;
+
+: a/an ( str -- str )
+    first "aeiou" member? "an" "a" ? ;
+
+GENERIC: ($instance) ( element -- )
+
+M: word ($instance)
+    dup word-name a/an write bl ($link) ;
+
+M: string ($instance)
+    dup a/an write bl $snippet ;
+
+: $instance first ($instance) ;
+
+: values-row ( seq -- seq )
+    unclip \ $snippet swap ?word-name 2array
+    swap dup first word? [ \ $instance add* ] when 2array ;
+
+: $values ( element -- )
+    "Inputs and outputs" $heading
+    [ values-row ] map $table ;
+
+: $side-effects ( element -- )
+    "Side effects" $heading "Modifies " print-element
+    [ $snippet ] textual-list ;
+
+: $errors ( element -- )
+    "Errors" $heading print-element ;
+
+: $notes ( element -- )
+    "Notes" $heading print-element ;
+
+: ($see) ( word -- )
+    [
+        snippet-style get [
+            code-style get [ see ] with-nesting
+        ] with-style
+    ] ($block) ;
+
+: $see ( element -- ) first ($see) ;
+
+: $definition ( element -- )
+    "Definition" $heading $see ;
+
+: $value ( object -- )
+    "Variable value" $heading
+    "Current value in global namespace:" print-element
+    first dup [ pprint-short ] ($code) ;
+
+: $curious ( element -- )
+    "For the curious..." $heading print-element ;
+
+: $references ( element -- )
+    "References" $heading
+    unclip print-element [ \ $link swap ] { } map>assoc $list ;
+
+: $shuffle ( element -- )
+    drop
+    "Shuffle word. Re-arranges the stack according to the stack effect pattern." $description ;
+
+: $low-level-note
+    drop
+    "Calling this word directly is not necessary in most cases. Higher-level words call it automatically." $notes ;
+
+: $values-x/y
+    drop { { "x" number } { "y" number } } $values ;
+
+: $io-error
+    drop
+    "Throws an error if the I/O operation fails." $errors ;
+
+: $prettyprinting-note
+    drop {
+        "This word should only be called from inside the "
+        { $link with-pprint } " combinator."
+    } $notes ;
+
+: ($spec-reader-values) ( slot-spec class -- element )
+    dup ?word-name swap 2array
+    over slot-spec-name
+    rot slot-spec-type 2array 2array
+    [ { $instance } swap add ] assoc-map ;
+
+: $spec-reader-values ( slot-spec class -- )
+    ($spec-reader-values) $values ;
+
+: $spec-reader-description ( slot-spec class -- )
+    [
+        "Outputs the value stored in the " ,
+        { $snippet } rot slot-spec-name add ,
+        " slot of " ,
+        { $instance } swap add ,
+        " instance." ,
+    ] { } make $description ;
+
+: $spec-reader ( reader slot-specs class -- )
+    >r slot-of-reader r>
+    over [
+        2dup $spec-reader-values
+        2dup $spec-reader-description
+    ] when 2drop ;
+
+GENERIC: slot-specs ( help-type -- specs )
+
+M: word slot-specs "slots" word-prop ;
+
+: $slot-reader ( reader -- )
+    first dup "reading" word-prop [ slot-specs ] keep
+    $spec-reader ;
+
+: $spec-writer-values ( slot-spec class -- )
+    ($spec-reader-values) reverse $values ;
+
+: $spec-writer-description ( slot-spec class -- )
+    [
+        "Stores a new value to the " ,
+        { $snippet } rot slot-spec-name add ,
+        " slot of " ,
+        { $instance } swap add ,
+        " instance." ,
+    ] { } make $description ;
+
+: $spec-writer ( writer slot-specs class -- )
+    >r slot-of-writer r>
+    over [
+        2dup $spec-writer-values
+        2dup $spec-writer-description
+        dup ?word-name 1array $side-effects
+    ] when 2drop ;
+
+: $slot-writer ( reader -- )
+    first dup "writing" word-prop [ slot-specs ] keep
+    $spec-writer ;
+
+GENERIC: elements* ( elt-type element -- )
+
+M: simple-element elements* [ elements* ] curry* each ;
+
+M: object elements* 2drop ;
+
+M: array elements*
+    [ [ elements* ] curry* each ] 2keep
+    [ first eq? ] keep swap [ , ] [ drop ] if ;
+
+: elements ( elt-type element -- seq ) [ elements* ] { } make ;
+
+: collect-elements ( element seq -- elements )
+    [
+        swap [
+            elements [
+                1 tail [ dup set ] each
+            ] each
+        ] curry each
+    ] H{ } make-assoc keys ;
diff --git a/extra/help/markup/summary.txt b/extra/help/markup/summary.txt
new file mode 100644 (file)
index 0000000..356b3f2
--- /dev/null
@@ -0,0 +1 @@
+Help markup language
diff --git a/extra/help/stylesheet/authors.txt b/extra/help/stylesheet/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/stylesheet/stylesheet.factor b/extra/help/stylesheet/stylesheet.factor
new file mode 100644 (file)
index 0000000..3c5271d
--- /dev/null
@@ -0,0 +1,98 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io.styles namespaces ;
+IN: help.stylesheet
+
+SYMBOL: default-style
+H{
+    { font "sans-serif" }
+    { font-size 12 }
+    { font-style plain }
+    { wrap-margin 500 }
+} default-style set-global
+
+SYMBOL: link-style
+H{
+    { foreground { 0 0 0.3 1 } }
+    { font-style bold }
+} link-style set-global
+
+SYMBOL: emphasis-style
+H{ { font-style italic } } emphasis-style set-global
+
+SYMBOL: strong-style
+H{ { font-style bold } } strong-style set-global
+
+SYMBOL: title-style
+H{
+    { font "sans-serif" }
+    { font-size 18 }
+    { font-style bold }
+    { wrap-margin 500 }
+    { page-color { 0.8 0.8 0.8 1 } }
+    { border-width 5 }
+} title-style set-global
+
+SYMBOL: help-path-style
+H{ { font-size 10 } } help-path-style set-global
+
+SYMBOL: heading-style
+H{
+    { font "sans-serif" }
+    { font-size 16 }
+    { font-style bold }
+} heading-style set-global
+
+SYMBOL: subsection-style
+H{
+    { font "sans-serif" }
+    { font-size 14 }
+    { font-style bold }
+} subsection-style set-global
+
+SYMBOL: snippet-style
+H{
+    { font "monospace" }
+    { font-size 12 }
+    { foreground { 0.1 0.1 0.4 1 } }
+} snippet-style set-global
+
+SYMBOL: code-style
+H{
+    { page-color { 0.8 0.8 0.8 0.5 } }
+    { border-width 5 }
+    { wrap-margin f }
+} code-style set-global
+
+SYMBOL: input-style
+H{ { font-style bold } } input-style set-global
+
+SYMBOL: url-style
+H{
+    { font "monospace" }
+    { foreground { 0.0 0.0 1.0 1.0 } }
+} url-style set-global
+
+SYMBOL: warning-style
+H{
+    { page-color { 0.95 0.95 0.95 1 } }
+    { border-color { 1 0 0 1 } }
+    { border-width 5 }
+} warning-style set-global
+
+SYMBOL: table-content-style
+H{
+    { wrap-margin 350 }
+} table-content-style set-global
+
+SYMBOL: table-style
+H{
+    { table-gap { 5 5 } }
+    { table-border { 0.8 0.8 0.8 1.0 } }
+} table-style set-global
+
+SYMBOL: list-style
+H{ { table-gap { 10 2 } } } list-style set-global
+
+SYMBOL: bullet
+"- " bullet set-global
diff --git a/extra/help/stylesheet/summary.txt b/extra/help/stylesheet/summary.txt
new file mode 100644 (file)
index 0000000..82c5a12
--- /dev/null
@@ -0,0 +1 @@
+Default help stylesheet
diff --git a/extra/help/summary.txt b/extra/help/summary.txt
new file mode 100644 (file)
index 0000000..3bcd1d4
--- /dev/null
@@ -0,0 +1 @@
+Online help system
diff --git a/extra/help/syntax/authors.txt b/extra/help/syntax/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/syntax/summary.txt b/extra/help/syntax/summary.txt
new file mode 100644 (file)
index 0000000..17f1544
--- /dev/null
@@ -0,0 +1 @@
+Parsing words for defining help articles
diff --git a/extra/help/syntax/syntax-docs.factor b/extra/help/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..6aab791
--- /dev/null
@@ -0,0 +1,35 @@
+USING: help.markup help.syntax vocabs ;
+
+HELP: HELP:
+{ $syntax "HELP: word content... ;" }
+{ $values { "word" "a word" } { "content" "markup elements" } }
+{ $description "Defines documentation for a word." }
+{ $examples
+    { $code
+        ": foo 2 + ;"
+        "HELP: foo"
+        "{ $values { \"m\" \"an integer\" } { \"n\" \"an integer\" } }"
+        "{ $description \"Increments a value by 2.\" } ;"
+        "\\ foo help"
+    }
+} ;
+
+HELP: ARTICLE:
+{ $syntax "ARTICLE: topic title content... ;" }
+{ $values { "topic" "an object" } { "title" "a string" } { "content" "markup elements" } }
+{ $description "Defines a help article. String topic names are reserved for core documentation. Contributed modules should name articles by arrays, where the first element of an array identifies the module; for example, " { $snippet "{ \"httpd\" \"intro\" }" } "." }
+{ $examples
+    { $code
+        "ARTICLE: \"example\" \"An example article\""
+        "\"Hello world.\" ;"
+    }
+} ;
+
+HELP: ABOUT:
+{ $syntax "MAIN: article" }
+{ $values { "article" "a help article" } }
+{ $description "Defines the main documentation article for the current vocabulary." } ;
+
+HELP: vocab-help
+{ $values { "vocab" "a vocabulary specifier" } { "help" "a help article" } }
+{ $description "Outputs the main help article for a vocabulary. The main help article can be set with " { $link POSTPONE: ABOUT:  } "." } ;
diff --git a/extra/help/syntax/syntax-tests.factor b/extra/help/syntax/syntax-tests.factor
new file mode 100644 (file)
index 0000000..74e7d29
--- /dev/null
@@ -0,0 +1,23 @@
+IN: temporary
+USING: tools.test parser vocabs help.syntax namespaces ;
+
+[
+    file-vocabs
+
+    [ "foobar" ] [
+        "IN: temporary USE: help.syntax ABOUT: \"foobar\"" eval
+        "temporary" vocab vocab-help
+    ] unit-test
+    
+    [ { "foobar" } ] [
+        "IN: temporary USE: help.syntax ABOUT: { \"foobar\" }" eval
+        "temporary" vocab vocab-help
+    ] unit-test
+    
+    SYMBOL: xyz
+    
+    [ xyz ] [
+        "IN: temporary USE: help.syntax ABOUT: xyz" eval
+        "temporary" vocab vocab-help
+    ] unit-test
+] with-scope
diff --git a/extra/help/syntax/syntax.factor b/extra/help/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..a1acd6a
--- /dev/null
@@ -0,0 +1,21 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel parser sequences words help help.topics
+namespaces vocabs ;
+IN: help.syntax
+
+: HELP:
+    scan-word bootstrap-word
+    dup set-word
+    dup >link save-location
+    \ ; parse-until >array swap set-word-help ; parsing
+
+: ARTICLE:
+    location >r
+    \ ; parse-until >array [ first2 ] keep 2 tail <article>
+    over add-article >link r> (save-location) ; parsing
+
+: ABOUT:
+    scan-word dup parsing? [
+        V{ } clone swap execute first
+    ] when in get vocab set-vocab-help ; parsing
diff --git a/extra/help/topics/authors.txt b/extra/help/topics/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/help/topics/summary.txt b/extra/help/topics/summary.txt
new file mode 100644 (file)
index 0000000..adcbaec
--- /dev/null
@@ -0,0 +1 @@
+Help topic management
diff --git a/extra/help/topics/topics-docs.factor b/extra/help/topics/topics-docs.factor
new file mode 100644 (file)
index 0000000..8afdb59
--- /dev/null
@@ -0,0 +1,42 @@
+USING: help.markup help.syntax help.topics help.crossref help io
+hashtables ;
+
+HELP: articles
+{ $var-description "Hashtable mapping article names to " { $link article } " instances." } ;
+
+HELP: no-article
+{ $values { "name" "an article name" } }
+{ $description "Throws a " { $link no-article } " error." }
+{ $error-description "Thrown by " { $link help } " if the given help topic does not exist, or if the help topic being dispayed links to a help topic which does not exist." } ;
+
+HELP: article
+{ $values { "name" "an article name" } { "article" "an " { $link article } " object" } }
+{ $description "Outputs a named " { $link article } " object." } ;
+
+HELP: article-title
+{ $values { "article" "an article name or a word" } { "title" "a string" } }
+{ $description "Outputs the title of a specific help article." } ;
+
+HELP: article-content
+{ $values { "article" "an article name or a word" } { "content" "a markup element" } }
+{ $description "Outputs the content of a specific help article." } ;
+
+HELP: all-articles
+{ $values { "seq" "a sequence" } }
+{ $description "Outputs a sequence of all help article names, and all words with documentation." } ;
+
+HELP: elements
+{ $values { "elt-type" "a word" } { "element" "a markup element" } { "seq" "a new sequence" } }
+{ $description "Outputs a sequence of all elements of type " { $snippet "elt-type" } " found by traversing " { $snippet "element" } "." } ;
+
+HELP: collect-elements
+{ $values { "element" "a markup element" } { "seq" "a sequence of words" } { "elements" "a new sequence" } }
+{ $description "Collects the arguments of all sub-elements of " { $snippet "element" } " whose markup element type occurs in " { $snippet "seq" } "." }
+{ $notes "Used to implement " { $link article-children } "." } ;
+
+HELP: link
+{ $class-description "Class of help article presentations. Instances can be passed to " { $link write-object } " to output a clickable hyperlink. Also, instances of this class are valid definition specifiers; see " { $link "definitions" } "." } ;
+
+HELP: related-words
+{ $values { "seq" "a sequence of words" } }
+{ $description "Defines a set of related words. Each word's documentation will contain links to all other words in the set." } ;
diff --git a/extra/help/topics/topics-tests.factor b/extra/help/topics/topics-tests.factor
new file mode 100644 (file)
index 0000000..c4c22b5
--- /dev/null
@@ -0,0 +1,34 @@
+USING: definitions help help.topics help.crossref help.markup
+help.syntax kernel sequences tools.test words parser namespaces
+assocs source-files ;
+IN: temporary
+
+! Test help cross-referencing
+
+[ ] [ "Test B" { "Hello world." } <article> { "test" "b" } add-article ] unit-test
+
+[ ] [ "Test A" { { $subsection { "test" "b" } } } <article> { "test" "a" } add-article ] unit-test
+
+SYMBOL: foo
+
+[ ] [ { "test" "a" } "Test A" { { $subsection foo } } <article> add-article ] unit-test
+
+! Test article location recording
+
+[ ] [
+    {
+        "USE: help.syntax"
+        "ARTICLE: { \"test\" 1 } \"Hello\""
+        "\"abc\""
+        "\"def\" ;"
+    } "\n" join
+    [
+        "testfile" source-file file set
+        eval
+    ] with-scope
+] unit-test
+
+[ { "testfile" 2 } ]
+[ { "test" 1 } articles get at article-loc ] unit-test
+
+[ ] [ { "test" 1 } remove-article ] unit-test
diff --git a/extra/help/topics/topics.factor b/extra/help/topics/topics.factor
new file mode 100644 (file)
index 0000000..c5abc19
--- /dev/null
@@ -0,0 +1,70 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.x
+USING: arrays definitions generic assocs
+io kernel namespaces prettyprint prettyprint.sections
+sequences words inspector classes strings vocabs ;
+IN: help.topics
+
+TUPLE: link name ;
+
+GENERIC: >link ( obj -- obj )
+M: link >link ;
+M: vocab-spec >link ;
+M: object >link link construct-boa ;
+
+PREDICATE: link word-link link-name word? ;
+
+M: link summary
+    [
+        "Link: " %
+        link-name dup word? [ summary ] [ unparse ] if %
+    ] "" make ;
+
+! Help articles
+SYMBOL: articles
+
+articles global [ H{ } assoc-like ] change-at
+    
+SYMBOL: article-xref
+
+article-xref global [ H{ } assoc-like ] change-at
+
+GENERIC: article-name ( topic -- string )
+GENERIC: article-parent ( topic -- parent )
+GENERIC: set-article-parent ( parent topic -- )
+
+TUPLE: article title content loc ;
+
+: <article> ( title content -- article )
+    f \ article construct-boa ;
+
+M: article article-name article-title ;
+
+TUPLE: no-article name ;
+
+: no-article ( name -- * ) \ no-article construct-boa throw ;
+
+M: no-article summary
+    drop "Help article does not exist" ;
+
+: article ( name -- article )
+    dup articles get at* [ nip ] [ drop no-article ] if ;
+
+M: object article-name article article-name ;
+M: object article-title article article-title ;
+M: object article-content article article-content ;
+M: object article-parent article-xref get at ;
+M: object set-article-parent article-xref get set-at ;
+
+M: link article-name link-name article-name ;
+M: link article-title link-name article-title ;
+M: link article-content link-name article-content ;
+M: link article-parent link-name article-parent ;
+M: link set-article-parent link-name set-article-parent ;
+
+! Special case: f help
+M: f article-name drop \ f article-name ;
+M: f article-title drop \ f article-title ;
+M: f article-content drop \ f article-content ;
+M: f article-parent drop \ f article-parent ;
+M: f set-article-parent drop \ f set-article-parent ;
diff --git a/extra/hexdump/authors.txt b/extra/hexdump/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/hexdump/hexdump-docs.factor b/extra/hexdump/hexdump-docs.factor
new file mode 100644 (file)
index 0000000..3fe9bd9
--- /dev/null
@@ -0,0 +1,11 @@
+USING: help.markup help.syntax hexdump kernel ;
+
+HELP: hexdump.
+{ $values { "seq" "a sequence" } }
+{ $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time and writes it to standard out." } ;
+
+HELP: hexdump
+{ $values { "seq" "a sequence" } { "str" "a string" } }
+{ $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time.  Lines are separated by a newline character." }
+{ $see-also hexdump. } ;
+
diff --git a/extra/hexdump/hexdump-tests.factor b/extra/hexdump/hexdump-tests.factor
new file mode 100644 (file)
index 0000000..3ddfe72
--- /dev/null
@@ -0,0 +1,8 @@
+IN: temporary
+USING: hexdump kernel sequences tools.test ;
+
+[ t ] [ "" hexdump "Length: 0, 0h\n" = ] unit-test
+[ t ] [ "abcdefghijklmnopqrstuvwxyz" hexdump "Length: 26, 1ah\n00000000h: 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop\n00000010h: 71 72 73 74 75 76 77 78 79 7a                   qrstuvwxyz\n" = ] unit-test
+
+[ t ] [ 256 [ ] map hexdump "Length: 256, 100h\n00000000h: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................\n00000010h: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................\n00000020h: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f  !\"#$%&'()*+,-./\n00000030h: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 0123456789:;<=>?\n00000040h: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO\n00000050h: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVWXYZ[\\]^_\n00000060h: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f `abcdefghijklmno\n00000070h: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvwxyz{|}~.\n00000080h: 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f ................\n00000090h: 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f ................\n000000a0h: a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af ................\n000000b0h: b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf ................\n000000c0h: c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf ................\n000000d0h: d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df ................\n000000e0h: e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef ................\n000000f0h: f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff ................\n" = ] unit-test
+
diff --git a/extra/hexdump/hexdump.factor b/extra/hexdump/hexdump.factor
new file mode 100644 (file)
index 0000000..57bbbe2
--- /dev/null
@@ -0,0 +1,27 @@
+USING: arrays io io.streams.string kernel math math.parser namespaces prettyprint sequences splitting strings ;
+IN: hexdump
+
+<PRIVATE
+
+: header. ( len -- )
+    "Length: " write dup unparse write ", " write >hex write "h" write nl ;
+
+: offset. ( lineno -- ) 16 * >hex 8 CHAR: 0 pad-left write "h: " write ;
+: h-pad. ( digit -- ) >hex 2 CHAR: 0 pad-left write ;
+: line. ( str n -- )
+    offset.
+    dup [ h-pad. " " write ] each
+    16 over length - "   " <array> concat write
+    [ dup printable? [ drop CHAR: . ] unless write1 ] each
+    nl ;
+
+PRIVATE>
+: hexdump ( seq -- str )
+    [
+        dup length header.
+        16 <sliced-groups> dup length [ line. ] 2each
+    ] string-out ;
+
+: hexdump. ( seq -- )
+    hexdump write ;
+
diff --git a/extra/hexdump/summary.txt b/extra/hexdump/summary.txt
new file mode 100644 (file)
index 0000000..d860bd7
--- /dev/null
@@ -0,0 +1 @@
+Prints formatted hex dump of an arbitrary sequence
diff --git a/extra/hints/authors.txt b/extra/hints/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/hints/hints.factor b/extra/hints/hints.factor
new file mode 100644 (file)
index 0000000..266e635
--- /dev/null
@@ -0,0 +1,6 @@
+IN: hints
+USING: parser words ;
+
+: HINTS: 
+    scan-word parse-definition "specializer" set-word-prop ;
+    parsing
diff --git a/extra/hints/summary.txt b/extra/hints/summary.txt
new file mode 100644 (file)
index 0000000..9ded081
--- /dev/null
@@ -0,0 +1 @@
+Syntax sugar for the Factor compiler's specializer hints facility
diff --git a/extra/hints/tags.txt b/extra/hints/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/html/authors.txt b/extra/html/authors.txt
new file mode 100644 (file)
index 0000000..65da810
--- /dev/null
@@ -0,0 +1,3 @@
+Slava Pestov
+Matthew Willis
+Chris Double
diff --git a/extra/html/elements/elements.factor b/extra/html/elements/elements.factor
new file mode 100644 (file)
index 0000000..09ef3a4
--- /dev/null
@@ -0,0 +1,156 @@
+! cont-html v0.6
+!
+! Copyright (C) 2004 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: io kernel namespaces prettyprint quotations
+sequences strings words ;
+
+IN: html.elements
+
+! These words are used to provide a means of writing
+! formatted HTML to standard output with a familiar 'html' look
+! and feel in the code. 
+!
+! HTML tags can be used in a number of different ways. The highest
+! level involves a similar syntax to HTML:
+! 
+! <p> "someoutput" write </p>
+!
+! <p> will output the opening tag and </p> will output the closing
+! tag with no attributes.
+!
+! <p "red" =class p> "someoutput" write </p>
+!
+! This time the opening tag does not have the '>'. It pushes
+! a namespace on the stack to hold the attributes and values.
+! Any attribute words used will store the attribute and values
+! in that namespace. Before the attribute word should come the
+! value of that attribute.
+! The finishing word will print out the operning tag including
+! attributes. 
+! Any writes after this will appear after the opening tag.
+!
+! Values for attributes can be used directly without any stack
+! operations:
+!
+! (url -- )
+! <a =href a> "Click me" write </a>
+!
+! (url -- )
+! <a "http://" swap append =href a> "click" write </a>
+!
+! (url -- )
+! <a [ "http://" % % ] "" make =href a> "click" write </a>
+!
+! Tags that have no 'closing' equivalent have a trailing tag/> form:
+!
+! <input "text" =type "name" =name "20" =size input/>
+
+: elements-vocab ( -- vocab-name ) "html.elements" ;
+
+SYMBOL: html
+
+: write-html ( str -- )
+    H{ { html t } } format ;
+
+: print-html ( str -- )
+    write-html "\n" write-html ;
+
+: html-word ( name def -- )
+    #! Define 'word creating' word to allow
+    #! dynamically creating words.
+    >r elements-vocab create r> define-compound ;
+: <foo> "<" swap ">" 3append ;
+
+: def-for-html-word-<foo> ( name -- )
+    #! Return the name and code for the <foo> patterned
+    #! word.
+    dup <foo> swap [ <foo> write-html ] curry html-word ;
+
+: <foo "<" swap append ;
+
+: def-for-html-word-<foo ( name -- )
+    #! Return the name and code for the <foo patterned
+    #! word.
+    <foo dup [ write-html ] curry html-word ;
+
+: foo> ">" append ;
+
+: def-for-html-word-foo> ( name -- )
+    #! Return the name and code for the foo> patterned
+    #! word.
+    foo> [ ">" write-html ] html-word ;
+
+: </foo> [ "</" % % ">" % ] "" make ;
+
+: def-for-html-word-</foo> ( name -- )
+    #! Return the name and code for the </foo> patterned
+    #! word.    
+    </foo> dup [ write-html ] curry html-word ;
+
+: <foo/> [ "<" % % "/>" % ] "" make ;
+
+: def-for-html-word-<foo/> ( name -- )
+    #! Return the name and code for the <foo/> patterned
+    #! word.
+    dup <foo/> swap [ <foo/> write-html ] curry html-word ;
+
+: foo/> "/>" append ;
+
+: def-for-html-word-foo/> ( name -- )
+    #! Return the name and code for the foo/> patterned
+    #! word.    
+    foo/> [ "/>" write-html ] html-word ;
+
+: define-closed-html-word ( name -- ) 
+    #! Given an HTML tag name, define the words for
+    #! that closable HTML tag.
+    dup def-for-html-word-<foo>
+    dup def-for-html-word-<foo
+    dup def-for-html-word-foo>
+    def-for-html-word-</foo> ;
+
+: define-open-html-word ( name -- ) 
+    #! Given an HTML tag name, define the words for
+    #! that open HTML tag.
+    dup def-for-html-word-<foo/>
+    dup def-for-html-word-<foo
+    def-for-html-word-foo/> ;
+
+: write-attr ( value name -- )
+    " " write-html
+    write-html
+    "='" write-html
+    write
+    "'" write-html ;
+
+: define-attribute-word ( name -- )
+    dup "=" swap append swap
+    [ write-attr ] curry html-word ;
+
+! Define some closed HTML tags
+[
+    "h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8" "h9"    
+    "ol" "li" "form" "a" "p" "html" "head" "body" "title"
+    "b" "i" "ul" "table" "tbody" "tr" "td" "th" "pre" "textarea"
+    "script" "div" "span" "select" "option" "style"
+] [ define-closed-html-word ] each
+
+! Define some open HTML tags
+[ 
+    "input" 
+    "br" 
+    "link"
+    "img"
+] [ define-open-html-word ] each
+
+! Define some attributes
+[ 
+    "method" "action" "type" "value" "name" 
+    "size" "href" "class" "border" "rows" "cols" 
+    "id" "onclick" "style" "valign" "accesskey"
+    "src" "language" "colspan" "onchange" "rel"
+    "width" "selected" "onsubmit"
+] [ define-attribute-word ] each 
diff --git a/extra/html/html-tests.factor b/extra/html/html-tests.factor
new file mode 100644 (file)
index 0000000..5beb81b
--- /dev/null
@@ -0,0 +1,46 @@
+USING: html http io io.streams.string io.styles kernel
+namespaces tools.test xml.writer ;
+IN: temporary
+
+[
+    "/responder/foo?z=%20"
+] [
+    "/responder/foo" H{ { "z" " " } } build-url
+] unit-test
+
+[
+    "&lt;html&gt;&amp;&apos;sgml&apos;"
+] [ "<html>&'sgml'" chars>entities ] unit-test
+
+[ "" ]
+[
+    [
+        H{ } [ drop ] span-tag
+    ] string-out
+] unit-test
+
+: html-format ( string style -- string )
+    [ format ] with-html-stream ;
+
+[ "hello world" ]
+[
+    [ "hello world" H{ } html-format ] string-out
+] unit-test
+
+[ "<span style='font-family: monospace; '>car</span>" ]
+[
+    [
+        "car"
+        H{ { font "monospace" } }
+        html-format
+    ] string-out
+] unit-test
+
+[ "<span style='color: #ff00ff; '>car</span>" ]
+[
+    [
+        "car"
+        H{ { foreground { 1 0 1 1 } } }
+        html-format
+    ] string-out
+] unit-test
diff --git a/extra/html/html.factor b/extra/html/html.factor
new file mode 100644 (file)
index 0000000..8d15190
--- /dev/null
@@ -0,0 +1,193 @@
+! Copyright (C) 2004, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: generic assocs help http io io.styles io.files io.streams.string
+kernel math math.parser namespaces xml.writer quotations
+assocs sequences strings words html.elements ;
+IN: html
+
+: hex-color, ( triplet -- )
+    3 head-slice
+    [ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ;
+
+: fg-css, ( color -- )
+    "color: #" % hex-color, "; " % ;
+
+: bg-css, ( color -- )
+    "background-color: #" % hex-color, "; " % ;
+
+: style-css, ( flag -- )
+    dup
+    { italic bold-italic } member?
+    "font-style: " % "italic" "normal" ? % "; " %
+    { bold bold-italic } member?
+    "font-weight: " % "bold" "normal" ? % "; " % ;
+
+: size-css, ( size -- )
+    "font-size: " % # "pt; " % ;
+
+: font-css, ( font -- )
+    "font-family: " % % "; " % ;
+
+: hash-apply ( value-hash quot-hash -- )
+    #! Looks up the key of each pair in the first list in the
+    #! second list to produce a quotation. The quotation is
+    #! applied to the value of the pair. If there is no
+    #! corresponding quotation, the value is popped off the
+    #! stack.
+    [ swapd at dup [ call ] [ 2drop ] if ] curry assoc-each ;
+
+: span-css-style ( style -- str )
+    [
+        H{
+            { foreground  [ fg-css,        ] }
+            { background  [ bg-css,        ] }
+            { font        [ font-css,      ] }
+            { font-style  [ style-css,     ] }
+            { font-size   [ size-css,      ] }
+        } hash-apply
+    ] "" make ;
+
+: span-tag ( style quot -- )
+    over span-css-style dup empty? [
+        drop call
+    ] [
+        <span =style span> call </span>
+    ] if ;
+
+: border-css, ( border -- )
+    "border: 1px solid #" % hex-color, "; " % ;
+
+: padding-css, ( padding -- ) "padding: " % # "px; " % ;
+
+: pre-css, ( -- )
+    "white-space: pre; font-family: monospace; " % ;
+
+: div-css-style ( style -- str )
+    [
+        H{
+            { page-color [ bg-css, ] }
+            { border-color [ border-css, ] }
+            { border-width [ padding-css, ] }
+            { wrap-margin [ [ pre-css, ] unless ] }
+        } hash-apply
+    ] "" make ;
+
+: div-tag ( style quot -- )
+    swap div-css-style dup empty? [
+        drop call
+    ] [
+        <div =style div> call </div>
+    ] if ;
+
+: do-escaping ( string style -- string )
+    html swap at [ chars>entities ] unless ;
+
+GENERIC: browser-link-href ( presented -- href )
+
+M: object browser-link-href drop f ;
+
+: object-link-tag ( style quot -- )
+    presented pick at browser-link-href
+    [ <a =href a> call </a> ] [ call ] if* ;
+
+TUPLE: nested-stream ;
+
+: <nested-stream> ( stream -- stream )
+    nested-stream construct-delegate ;
+
+M: nested-stream stream-close drop ;
+
+TUPLE: html-stream ;
+
+: <html-stream> ( stream -- stream )
+    html-stream construct-delegate ;
+
+M: html-stream stream-write1 ( char stream -- )
+    >r 1string r> stream-write ;
+
+: delegate-write delegate stream-write ;
+
+M: html-stream stream-write ( str stream -- )
+    >r chars>entities r> delegate-write ;
+
+: with-html-style ( quot style stream -- )
+    [ [ swap span-tag ] object-link-tag ] with-stream* ; inline
+
+M: html-stream with-stream-style ( quot style stream -- )
+    [ drop call ] -rot with-html-style ;
+
+M: html-stream stream-format ( str style stream -- )
+    [ do-escaping stdio get delegate-write ] -rot
+    with-html-style ;
+
+: with-html-stream ( quot -- )
+    stdio get <html-stream> swap with-stream* ;
+
+M: html-stream with-nested-stream ( quot style stream -- )
+    [
+        [
+            [
+                stdio get <nested-stream> swap with-stream*
+            ] div-tag
+        ] object-link-tag
+    ] with-stream* ;
+
+: border-spacing-css,
+    "padding: " % first2 max 2 /i # "px; " % ;
+
+: table-style ( style -- str )
+    [
+        H{
+            { table-border [ border-css,         ] }
+            { table-gap    [ border-spacing-css, ] }
+        } hash-apply
+    ] "" make ;
+
+: table-attrs ( style -- )
+    table-style " border-collapse: collapse;" append =style ;
+
+M: html-stream stream-write-table ( grid style stream -- )
+    [
+        <table dup table-attrs table> swap [
+            <tr> [
+                <td "top" =valign swap table-style =style td>
+                    write-html
+                </td>
+            ] curry* each </tr>
+        ] curry* each </table>
+    ] with-stream* ;
+
+M: html-stream make-table-cell ( quot style stream -- table-cell )
+    2drop [ with-html-stream ] string-out ;
+
+M: html-stream stream-nl [ <br/> ] with-stream* ;
+
+: default-css ( -- )
+    <link
+    "stylesheet" =rel "text/css" =type
+    "/responder/resources/stylesheet.css" =href
+    link/> ;
+
+: xhtml-preamble
+    "<?xml version=\"1.0\"?>" write-html
+    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" write-html ;
+
+: html-document* ( body-quot head-quot -- )
+    #! head-quot is called to produce output to go
+    #! in the html head portion of the document.
+    #! body-quot is called to produce output to go
+    #! in the html body portion of the document.
+    xhtml-preamble
+    <html " xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"" write-html html>
+        <head> call </head>
+        <body> call </body>
+    </html> ;
+  
+: html-document ( title quot -- )
+    swap [
+        <title> write </title>
+        default-css
+    ] html-document* ;
+
+: simple-html-document ( title quot -- )
+    swap [ <pre> with-html-stream </pre> ] html-document ;
diff --git a/extra/html/summary.txt b/extra/html/summary.txt
new file mode 100644 (file)
index 0000000..29ec8d3
--- /dev/null
@@ -0,0 +1 @@
+HTML reader, writer and utilities
diff --git a/extra/html/tags.txt b/extra/html/tags.txt
new file mode 100644 (file)
index 0000000..c077218
--- /dev/null
@@ -0,0 +1 @@
+web
diff --git a/extra/http/authors.txt b/extra/http/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/http/basic-authentication/authors.txt b/extra/http/basic-authentication/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/http/basic-authentication/basic-authentication-docs.factor b/extra/http/basic-authentication/basic-authentication-docs.factor
new file mode 100644 (file)
index 0000000..9add842
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax http.basic-authentication crypto.sha2 ;
+
+HELP: realms
+{ $description 
+   "A hashtable mapping a basic authentication realm (a string) "
+   "to either a quotation or a hashtable. The quotation has "
+   "stack effect ( username sha-256-string -- bool ). It "
+   "is expected to perform the user authentication when called." $nl
+   "If the realm maps to a hashtable then the hashtable should be a "
+   "mapping of usernames to sha-256 hashed passwords." $nl
+   "If the 'realms' variable does not exist in the current scope then "
+   "authentication will always fail." }
+{ $see-also add-realm with-basic-authentication } ;
+
+HELP: add-realm
+{ $values 
+  { "data" "a quotation or a hashtable" } { "name" "a string" } }
+{ $description 
+   "Adds the authentication data to the " { $link realms } ". 'data' can be "
+   "a quotation with stack effect ( username sha-256-string -- bool ) or "
+   "a hashtable mapping username strings to sha-256-string passwords." }
+{ $examples
+  { $code "H{ { \"admin\" \"...\" } { \"user\" \"...\" } } \"my-realm\" add-realm" }
+  { $code "[ \"...\" = swap \"admin\" = and ] \"my-realm\" add-realm" }
+}
+{ $see-also with-basic-authentication realms } ;
+
+HELP: with-basic-authentication
+{ $values 
+  { "realm" "a string" } { "quot" "a quotation with stack effect ( -- )" } }
+{ $description 
+   "Checks if the HTTP request has the correct authorisation headers "
+   "for basic authentication within the named realm. If the headers "
+   "are not present then a '401' HTTP response results from the "
+   "request, otherwise the quotation is called." }
+{ $examples
+{ $code "\"my-realm\" [\n  serving-html \"<html><body>Success!</body></html>\" write\n] with-basic-authentication" } }
+{ $see-also add-realm realms }
+ ;
+
+ARTICLE: { "http-authentication" "basic-authentication" } "Basic Authentication"
+"The Basic Authentication system provides a simple browser based " 
+"authentication method to web applications. When the browser requests "
+"a resource protected with basic authentication the server responds with "
+"a '401' response code which means the user is unauthorized."
+$nl
+"When the browser receives this it prompts the user for a username and " 
+"password. This is sent back to the server in a special HTTP header. The "
+"server then checks this against its authentication information and either "
+"accepts or rejects the users request."
+$nl
+"Authentication is split up into " { $link realms } ". Each realm can have "
+"a different database of username and password information. A responder can "
+"require basic authentication by using the " { $link with-basic-authentication } " word."
+$nl
+"Username and password information can be maintained using " { $link realms } " and " { $link add-realm } "."
+$nl
+"All passwords on the server should be stored as sha-256 strings generated with the " { $link string>sha-256-string } " word."
+$nl
+"Note that Basic Authentication itself is insecure in that it "
+"sends the username and password as clear text (although it is "
+"base64 encoded this is not much help). To prevent eavesdropping "
+"it is best to use Basic Authentication with SSL."  ;
+
+IN: http.basic-authentication
+ABOUT: { "http-authentication" "basic-authentication" }
\ No newline at end of file
diff --git a/extra/http/basic-authentication/basic-authentication-tests.factor b/extra/http/basic-authentication/basic-authentication-tests.factor
new file mode 100644 (file)
index 0000000..318123b
--- /dev/null
@@ -0,0 +1,66 @@
+! Copyright (c) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel crypto.sha2 http.basic-authentication tools.test 
+       namespaces base64 sequences ;
+
+{ t } [
+  [
+    H{ } clone realms set    
+    H{ { "admin" "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" } } "test-realm" add-realm
+    "test-realm" "Basic " "admin:password" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
+
+{ f } [
+  [
+    H{ } clone realms set    
+    H{ { "admin" "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" } } "test-realm" add-realm
+    "test-realm" "Basic " "admin:passwordx" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
+
+{ f } [
+  [
+    H{ } clone realms set    
+    H{ { "admin" "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" } } "test-realm" add-realm
+    "test-realm" "Basic " "xadmin:password" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
+
+{ t } [
+  [
+    H{ } clone realms set    
+    [ "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" = swap "admin" = and ] "test-realm" add-realm
+    "test-realm" "Basic " "admin:password" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
+
+{ f } [
+  [
+    H{ } clone realms set    
+    [ "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" = swap "admin" = and ] "test-realm" add-realm
+    "test-realm" "Basic " "xadmin:password" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
+
+{ f } [
+  [
+    H{ } clone realms set    
+    [ "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" = swap "admin" = and ] "test-realm" add-realm
+    "test-realm" "Basic " "admin:xpassword" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
+
+{ f } [
+  [
+    f realms set    
+    "test-realm" "Basic " "admin:password" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
+
+{ f } [
+  [
+    H{ } clone realms set    
+    "test-realm" "Basic " "admin:password" >base64 append authorization-ok?
+  ] with-scope 
+] unit-test 
diff --git a/extra/http/basic-authentication/basic-authentication.factor b/extra/http/basic-authentication/basic-authentication.factor
new file mode 100644 (file)
index 0000000..040cb21
--- /dev/null
@@ -0,0 +1,66 @@
+! Copyright (c) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel base64 http.server crypto.sha2 namespaces assocs
+       quotations hashtables combinators splitting sequences
+       http.server.responders io  ;
+IN: http.basic-authentication
+
+! 'realms' is a hashtable mapping a realm (a string) to 
+! either a quotation or a hashtable. The quotation 
+! has stack effect ( username sha-256-string -- bool ).
+! It should perform the user authentication. 'sha-256-string'
+! is the plain text password provided by the user passed through
+! 'string>sha-256-string'. If 'realms' maps to a hashtable then
+! it is a mapping of usernames to sha-256 hashed passwords. 
+!
+! 'realms' can be set on a per vhost basis in the vhosts 
+! table.
+!
+! If there are no realms then authentication fails.
+SYMBOL: realms
+: add-realm ( data name  -- )
+  #! Add the named realm to the realms table.
+  #! 'data' should be a hashtable or a quotation.
+  realms get [ H{ } clone dup realms set ] unless* 
+  set-at ;
+
+: user-authorized? ( username password realm -- bool )
+  realms get dup [
+    at {
+      { [ dup quotation? ] [ call ] }
+      { [ dup hashtable? ] [ swapd at = ] }
+      { [ t ] [ 3drop f ] }
+    } cond 
+  ] [
+    3drop drop f
+  ] if ;
+
+: authorization-ok? ( realm header -- bool )  
+  #! Given the realm and the 'Authorization' header,
+  #! authenticate the user.
+  dup [
+    " " split dup first "Basic" = [
+      second base64> ":" split first2 string>sha-256-string rot 
+      user-authorized?
+    ] [
+      2drop f
+    ] if   
+  ] [
+    2drop f
+  ] if ;
+  
+: with-basic-authentication ( realm quot -- )
+  #! Check if the user is authenticated in the given realm
+  #! to run the specified quotation. If not, use Basic
+  #! Authentication to ask for authorization details.
+  over "Authorization" "header" get at authorization-ok? [
+    nip call
+  ] [
+    drop "Basic realm=\"" swap "\"" 3append "WWW-Authenticate" associate 
+    "401 Unauthorized" response nl 
+    "<html><body>Username or Password is invalid</body></html>" write 
+  ] if ;
+
+
+
diff --git a/extra/http/basic-authentication/summary.txt b/extra/http/basic-authentication/summary.txt
new file mode 100644 (file)
index 0000000..60cef7e
--- /dev/null
@@ -0,0 +1 @@
+HTTP Basic Authentication implementation
diff --git a/extra/http/basic-authentication/tags.txt b/extra/http/basic-authentication/tags.txt
new file mode 100644 (file)
index 0000000..c077218
--- /dev/null
@@ -0,0 +1 @@
+web
diff --git a/extra/http/client/authors.txt b/extra/http/client/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/http/client/client-tests.factor b/extra/http/client/client-tests.factor
new file mode 100644 (file)
index 0000000..5c57099
--- /dev/null
@@ -0,0 +1,9 @@
+USING: http.client tools.test ;
+[ "localhost" 80 ] [ "localhost" parse-host ] unit-test
+[ "localhost" 8888 ] [ "localhost:8888" parse-host ] unit-test
+[ "localhost:8888" "/foo" ] [ "http://localhost:8888/foo" parse-url ] unit-test
+[ "localhost:8888" "/" ] [ "http://localhost:8888" parse-url ] unit-test
+[ 404 ] [ "HTTP/1.1 404 File not found" parse-response ] unit-test
+[ 404 ] [ "404 File not found" parse-response ] unit-test
+[ 200 ] [ "HTTP/1.0 200" parse-response ] unit-test
+[ 200 ] [ "HTTP/1.0 200 Success" parse-response ] unit-test
diff --git a/extra/http/client/client.factor b/extra/http/client/client.factor
new file mode 100644 (file)
index 0000000..08c5185
--- /dev/null
@@ -0,0 +1,74 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs http kernel math math.parser namespaces sequences
+io io.sockets io.streams.string io.files strings splitting
+continuations ;
+IN: http.client
+
+: parse-host ( url -- host port )
+    #! Extract the host name and port number from an HTTP URL.
+    ":" split1 [ string>number ] [ 80 ] if* ;
+
+: parse-url ( url -- host resource )
+    "http://" ?head [
+        "URL must begin with http://" throw
+    ] unless
+    "/" split1 [ "/" swap append ] [ "/" ] if* ;
+
+: parse-response ( line -- code )
+    "HTTP/" ?head [ " " split1 nip ] when
+    " " split1 drop string>number [
+        "Premature end of stream" throw
+    ] unless* ;
+
+: read-response ( -- code header )
+    #! After sending a GET or POST we read a response line and
+    #! header.
+    flush readln parse-response read-header ;
+
+: crlf "\r\n" write ;
+
+: http-request ( host resource method -- )
+    write " " write write " HTTP/1.0" write crlf
+    "Host: " write write crlf ;
+
+: get-request ( host resource -- )
+    "GET" http-request crlf ;
+
+DEFER: http-get-stream
+
+: do-redirect ( code headers stream -- code headers stream )
+    #! Should this support Location: headers that are
+    #! relative URLs?
+    pick 100 /i 3 = [
+        stream-close "Location" swap at nip http-get-stream
+    ] when ;
+
+: http-get-stream ( url -- code headers stream )
+    #! Opens a stream for reading from an HTTP URL.
+    parse-url over parse-host <inet> <client> [
+        [ [ get-request read-response ] with-stream* ] keep
+    ] [ >r stream-close r> rethrow ] recover do-redirect ;
+
+: http-get ( url -- code headers string )
+    #! Opens a stream for reading from an HTTP URL.
+    http-get-stream [ stdio get contents ] with-stream ;
+
+: download ( url file -- )
+    #! Downloads the contents of a URL to a file.
+    >r http-get 2nip r> <file-writer> [ write ] with-stream ;
+
+: post-request ( content-type content host resource -- )
+    #! Note: It is up to the caller to url encode the content if
+    #! it is required according to the content-type.
+    "POST" http-request [
+        "Content-Length: " write length number>string write crlf
+        "Content-Type: " write url-encode write crlf
+        crlf
+    ] keep write ;
+
+: http-post ( content-type content url -- code headers string )
+    #! Make a POST request. The content is URL encoded for you.
+    parse-url over parse-host <inet> <client> [
+        post-request flush read-response stdio get contents
+    ] with-stream ;
diff --git a/extra/http/client/summary.txt b/extra/http/client/summary.txt
new file mode 100644 (file)
index 0000000..5609c91
--- /dev/null
@@ -0,0 +1 @@
+HTTP client
diff --git a/extra/http/client/tags.txt b/extra/http/client/tags.txt
new file mode 100644 (file)
index 0000000..93e65ae
--- /dev/null
@@ -0,0 +1,2 @@
+web
+network
diff --git a/extra/http/http-tests.factor b/extra/http/http-tests.factor
new file mode 100644 (file)
index 0000000..853ac28
--- /dev/null
@@ -0,0 +1,16 @@
+USING: http tools.test ;
+IN: temporary
+
+[ "hello%20world" ] [ "hello world" url-encode ] unit-test
+[ "hello world" ] [ "hello%20world" url-decode ] unit-test
+[ "~hello world" ] [ "%7ehello+world" url-decode ] unit-test
+[ "" ] [ "%XX%XX%XX" url-decode ] unit-test
+[ "" ] [ "%XX%XX%X" url-decode ] unit-test
+
+[ "hello world"   ] [ "hello+world"    url-decode ] unit-test
+[ "hello world"   ] [ "hello%20world"  url-decode ] unit-test
+[ " ! "           ] [ "%20%21%20"      url-decode ] unit-test
+[ "hello world"   ] [ "hello world%"   url-decode ] unit-test
+[ "hello world"   ] [ "hello world%x"  url-decode ] unit-test
+[ "hello%20world" ] [ "hello world"    url-encode ] unit-test
+[ "%20%21%20"     ] [ " ! "            url-encode ] unit-test
diff --git a/extra/http/http.factor b/extra/http/http.factor
new file mode 100644 (file)
index 0000000..687fa80
--- /dev/null
@@ -0,0 +1,70 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: hashtables io kernel math namespaces math.parser assocs
+sequences strings splitting ;
+IN: http
+
+: header-line ( line -- )
+    ": " split1 dup [ swap set ] [ 2drop ] if ;
+
+: (read-header) ( hash -- hash )
+    readln dup
+    empty? [ drop ] [ header-line (read-header) ] if ;
+
+: read-header ( -- hash )
+    [ (read-header) ] H{ } make-assoc ;
+
+: url-quotable? ( ch -- ? )
+    #! In a URL, can this character be used without
+    #! URL-encoding?
+    dup letter?
+    over LETTER? or
+    over digit? or
+    swap "/_?." member? or ; foldable
+
+: url-encode ( str -- str )
+    [
+        [
+            dup url-quotable? [
+                ,
+            ] [
+                CHAR: % , >hex 2 CHAR: 0 pad-left %
+            ] if
+        ] each
+    ] "" make ;
+
+: url-decode-hex ( index str -- )
+    2dup length 2 - >= [
+        2drop
+    ] [
+        >r 1+ dup 2 + r> subseq  hex> [ , ] when*
+    ] if ;
+
+: url-decode-% ( index str -- index str )
+    2dup url-decode-hex >r 3 + r> ;
+
+: url-decode-+-or-other ( index str ch -- index str )
+    dup CHAR: + = [ drop CHAR: \s ] when , >r 1+ r> ;
+
+: url-decode-iter ( index str -- )
+    2dup length >= [
+        2drop
+    ] [
+        2dup nth dup CHAR: % = [
+            drop url-decode-%
+        ] [
+            url-decode-+-or-other
+        ] if url-decode-iter
+    ] if ;
+
+: url-decode ( str -- str )
+    [ 0 swap url-decode-iter ] "" make ;
+
+: build-url ( path query-params -- str )
+    [
+        swap % dup assoc-empty? [
+            "?" % dup
+            [ [ url-encode ] 2apply "=" swap 3append ] { } assoc>map
+            "&" join %
+        ] unless drop
+    ] "" make ;
diff --git a/extra/http/mime/mime.factor b/extra/http/mime/mime.factor
new file mode 100644 (file)
index 0000000..3365127
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2004, 2005 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io assocs kernel sequences math namespaces splitting ;
+
+IN: http.mime
+
+: file-extension ( filename -- extension )
+    "." split dup length 1 <= [ drop f ] [ peek ] if ;
+
+: mime-type ( filename -- mime-type )
+    file-extension "mime-types" get at "application/octet-stream" or ;
+
+H{
+    { "html"   "text/html"                        }
+    { "txt"    "text/plain"                       }
+    { "xml"    "text/xml"                         }
+    { "css"    "text/css"                         }
+                                                    
+    { "gif"    "image/gif"                        }
+    { "png"    "image/png"                        }
+    { "jpg"    "image/jpeg"                       }
+    { "jpeg"   "image/jpeg"                       }
+                                                    
+    { "jar"    "application/octet-stream"         }
+    { "zip"    "application/octet-stream"         }
+    { "tgz"    "application/octet-stream"         }
+    { "tar.gz" "application/octet-stream"         }
+    { "gz"     "application/octet-stream"         }
+
+    { "pdf"    "application/pdf"                  }
+
+    { "factor" "text/plain"                       }
+    { "fhtml"  "application/x-factor-server-page" }
+} "mime-types" set-global
diff --git a/extra/http/server/resources/prototype.js b/extra/http/server/resources/prototype.js
new file mode 100644 (file)
index 0000000..0e85338
--- /dev/null
@@ -0,0 +1,1781 @@
+/*  Prototype JavaScript framework, version 1.4.0
+ *  (c) 2005 Sam Stephenson <sam@conio.net>
+ *
+ *  Prototype is freely distributable under the terms of an MIT-style license.
+ *  For details, see the Prototype web site: http://prototype.conio.net/
+ *
+/*--------------------------------------------------------------------------*/
+
+var Prototype = {
+  Version: '1.4.0',
+  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
+
+  emptyFunction: function() {},
+  K: function(x) {return x}
+}
+
+var Class = {
+  create: function() {
+    return function() {
+      this.initialize.apply(this, arguments);
+    }
+  }
+}
+
+var Abstract = new Object();
+
+Object.extend = function(destination, source) {
+  for (property in source) {
+    destination[property] = source[property];
+  }
+  return destination;
+}
+
+Object.inspect = function(object) {
+  try {
+    if (object == undefined) return 'undefined';
+    if (object == null) return 'null';
+    return object.inspect ? object.inspect() : object.toString();
+  } catch (e) {
+    if (e instanceof RangeError) return '...';
+    throw e;
+  }
+}
+
+Function.prototype.bind = function() {
+  var __method = this, args = $A(arguments), object = args.shift();
+  return function() {
+    return __method.apply(object, args.concat($A(arguments)));
+  }
+}
+
+Function.prototype.bindAsEventListener = function(object) {
+  var __method = this;
+  return function(event) {
+    return __method.call(object, event || window.event);
+  }
+}
+
+Object.extend(Number.prototype, {
+  toColorPart: function() {
+    var digits = this.toString(16);
+    if (this < 16) return '0' + digits;
+    return digits;
+  },
+
+  succ: function() {
+    return this + 1;
+  },
+
+  times: function(iterator) {
+    $R(0, this, true).each(iterator);
+    return this;
+  }
+});
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0; i < arguments.length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) {}
+    }
+
+    return returnValue;
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create();
+PeriodicalExecuter.prototype = {
+  initialize: function(callback, frequency) {
+    this.callback = callback;
+    this.frequency = frequency;
+    this.currentlyExecuting = false;
+
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    if (!this.currentlyExecuting) {
+      try {
+        this.currentlyExecuting = true;
+        this.callback();
+      } finally {
+        this.currentlyExecuting = false;
+      }
+    }
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+function $() {
+  var elements = new Array();
+
+  for (var i = 0; i < arguments.length; i++) {
+    var element = arguments[i];
+    if (typeof element == 'string')
+      element = document.getElementById(element);
+
+    if (arguments.length == 1)
+      return element;
+
+    elements.push(element);
+  }
+
+  return elements;
+}
+Object.extend(String.prototype, {
+  stripTags: function() {
+    return this.replace(/<\/?[^>]+>/gi, '');
+  },
+
+  stripScripts: function() {
+    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+  },
+
+  extractScripts: function() {
+    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+    return (this.match(matchAll) || []).map(function(scriptTag) {
+      return (scriptTag.match(matchOne) || ['', ''])[1];
+    });
+  },
+
+  evalScripts: function() {
+    return this.extractScripts().map(eval);
+  },
+
+  escapeHTML: function() {
+    var div = document.createElement('div');
+    var text = document.createTextNode(this);
+    div.appendChild(text);
+    return div.innerHTML;
+  },
+
+  unescapeHTML: function() {
+    var div = document.createElement('div');
+    div.innerHTML = this.stripTags();
+    return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
+  },
+
+  toQueryParams: function() {
+    var pairs = this.match(/^\??(.*)$/)[1].split('&');
+    return pairs.inject({}, function(params, pairString) {
+      var pair = pairString.split('=');
+      params[pair[0]] = pair[1];
+      return params;
+    });
+  },
+
+  toArray: function() {
+    return this.split('');
+  },
+
+  camelize: function() {
+    var oStringList = this.split('-');
+    if (oStringList.length == 1) return oStringList[0];
+
+    var camelizedString = this.indexOf('-') == 0
+      ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
+      : oStringList[0];
+
+    for (var i = 1, len = oStringList.length; i < len; i++) {
+      var s = oStringList[i];
+      camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
+    }
+
+    return camelizedString;
+  },
+
+  inspect: function() {
+    return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'";
+  }
+});
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+var $break    = new Object();
+var $continue = new Object();
+
+var Enumerable = {
+  each: function(iterator) {
+    var index = 0;
+    try {
+      this._each(function(value) {
+        try {
+          iterator(value, index++);
+        } catch (e) {
+          if (e != $continue) throw e;
+        }
+      });
+    } catch (e) {
+      if (e != $break) throw e;
+    }
+  },
+
+  all: function(iterator) {
+    var result = true;
+    this.each(function(value, index) {
+      result = result && !!(iterator || Prototype.K)(value, index);
+      if (!result) throw $break;
+    });
+    return result;
+  },
+
+  any: function(iterator) {
+    var result = true;
+    this.each(function(value, index) {
+      if (result = !!(iterator || Prototype.K)(value, index))
+        throw $break;
+    });
+    return result;
+  },
+
+  collect: function(iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      results.push(iterator(value, index));
+    });
+    return results;
+  },
+
+  detect: function (iterator) {
+    var result;
+    this.each(function(value, index) {
+      if (iterator(value, index)) {
+        result = value;
+        throw $break;
+      }
+    });
+    return result;
+  },
+
+  findAll: function(iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      if (iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  grep: function(pattern, iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      var stringValue = value.toString();
+      if (stringValue.match(pattern))
+        results.push((iterator || Prototype.K)(value, index));
+    })
+    return results;
+  },
+
+  include: function(object) {
+    var found = false;
+    this.each(function(value) {
+      if (value == object) {
+        found = true;
+        throw $break;
+      }
+    });
+    return found;
+  },
+
+  inject: function(memo, iterator) {
+    this.each(function(value, index) {
+      memo = iterator(memo, value, index);
+    });
+    return memo;
+  },
+
+  invoke: function(method) {
+    var args = $A(arguments).slice(1);
+    return this.collect(function(value) {
+      return value[method].apply(value, args);
+    });
+  },
+
+  max: function(iterator) {
+    var result;
+    this.each(function(value, index) {
+      value = (iterator || Prototype.K)(value, index);
+      if (value >= (result || value))
+        result = value;
+    });
+    return result;
+  },
+
+  min: function(iterator) {
+    var result;
+    this.each(function(value, index) {
+      value = (iterator || Prototype.K)(value, index);
+      if (value <= (result || value))
+        result = value;
+    });
+    return result;
+  },
+
+  partition: function(iterator) {
+    var trues = [], falses = [];
+    this.each(function(value, index) {
+      ((iterator || Prototype.K)(value, index) ?
+        trues : falses).push(value);
+    });
+    return [trues, falses];
+  },
+
+  pluck: function(property) {
+    var results = [];
+    this.each(function(value, index) {
+      results.push(value[property]);
+    });
+    return results;
+  },
+
+  reject: function(iterator) {
+    var results = [];
+    this.each(function(value, index) {
+      if (!iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  sortBy: function(iterator) {
+    return this.collect(function(value, index) {
+      return {value: value, criteria: iterator(value, index)};
+    }).sort(function(left, right) {
+      var a = left.criteria, b = right.criteria;
+      return a < b ? -1 : a > b ? 1 : 0;
+    }).pluck('value');
+  },
+
+  toArray: function() {
+    return this.collect(Prototype.K);
+  },
+
+  zip: function() {
+    var iterator = Prototype.K, args = $A(arguments);
+    if (typeof args.last() == 'function')
+      iterator = args.pop();
+
+    var collections = [this].concat(args).map($A);
+    return this.map(function(value, index) {
+      iterator(value = collections.pluck(index));
+      return value;
+    });
+  },
+
+  inspect: function() {
+    return '#<Enumerable:' + this.toArray().inspect() + '>';
+  }
+}
+
+Object.extend(Enumerable, {
+  map:     Enumerable.collect,
+  find:    Enumerable.detect,
+  select:  Enumerable.findAll,
+  member:  Enumerable.include,
+  entries: Enumerable.toArray
+});
+var $A = Array.from = function(iterable) {
+  if (!iterable) return [];
+  if (iterable.toArray) {
+    return iterable.toArray();
+  } else {
+    var results = [];
+    for (var i = 0; i < iterable.length; i++)
+      results.push(iterable[i]);
+    return results;
+  }
+}
+
+Object.extend(Array.prototype, Enumerable);
+
+Array.prototype._reverse = Array.prototype.reverse;
+
+Object.extend(Array.prototype, {
+  _each: function(iterator) {
+    for (var i = 0; i < this.length; i++)
+      iterator(this[i]);
+  },
+
+  clear: function() {
+    this.length = 0;
+    return this;
+  },
+
+  first: function() {
+    return this[0];
+  },
+
+  last: function() {
+    return this[this.length - 1];
+  },
+
+  compact: function() {
+    return this.select(function(value) {
+      return value != undefined || value != null;
+    });
+  },
+
+  flatten: function() {
+    return this.inject([], function(array, value) {
+      return array.concat(value.constructor == Array ?
+        value.flatten() : [value]);
+    });
+  },
+
+  without: function() {
+    var values = $A(arguments);
+    return this.select(function(value) {
+      return !values.include(value);
+    });
+  },
+
+  indexOf: function(object) {
+    for (var i = 0; i < this.length; i++)
+      if (this[i] == object) return i;
+    return -1;
+  },
+
+  reverse: function(inline) {
+    return (inline !== false ? this : this.toArray())._reverse();
+  },
+
+  shift: function() {
+    var result = this[0];
+    for (var i = 0; i < this.length - 1; i++)
+      this[i] = this[i + 1];
+    this.length--;
+    return result;
+  },
+
+  inspect: function() {
+    return '[' + this.map(Object.inspect).join(', ') + ']';
+  }
+});
+var Hash = {
+  _each: function(iterator) {
+    for (key in this) {
+      var value = this[key];
+      if (typeof value == 'function') continue;
+
+      var pair = [key, value];
+      pair.key = key;
+      pair.value = value;
+      iterator(pair);
+    }
+  },
+
+  keys: function() {
+    return this.pluck('key');
+  },
+
+  values: function() {
+    return this.pluck('value');
+  },
+
+  merge: function(hash) {
+    return $H(hash).inject($H(this), function(mergedHash, pair) {
+      mergedHash[pair.key] = pair.value;
+      return mergedHash;
+    });
+  },
+
+  toQueryString: function() {
+    return this.map(function(pair) {
+      return pair.map(encodeURIComponent).join('=');
+    }).join('&');
+  },
+
+  inspect: function() {
+    return '#<Hash:{' + this.map(function(pair) {
+      return pair.map(Object.inspect).join(': ');
+    }).join(', ') + '}>';
+  }
+}
+
+function $H(object) {
+  var hash = Object.extend({}, object || {});
+  Object.extend(hash, Enumerable);
+  Object.extend(hash, Hash);
+  return hash;
+}
+ObjectRange = Class.create();
+Object.extend(ObjectRange.prototype, Enumerable);
+Object.extend(ObjectRange.prototype, {
+  initialize: function(start, end, exclusive) {
+    this.start = start;
+    this.end = end;
+    this.exclusive = exclusive;
+  },
+
+  _each: function(iterator) {
+    var value = this.start;
+    do {
+      iterator(value);
+      value = value.succ();
+    } while (this.include(value));
+  },
+
+  include: function(value) {
+    if (value < this.start)
+      return false;
+    if (this.exclusive)
+      return value < this.end;
+    return value <= this.end;
+  }
+});
+
+var $R = function(start, end, exclusive) {
+  return new ObjectRange(start, end, exclusive);
+}
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')},
+      function() {return new XMLHttpRequest()}
+    ) || false;
+  },
+
+  activeRequestCount: 0
+}
+
+Ajax.Responders = {
+  responders: [],
+
+  _each: function(iterator) {
+    this.responders._each(iterator);
+  },
+
+  register: function(responderToAdd) {
+    if (!this.include(responderToAdd))
+      this.responders.push(responderToAdd);
+  },
+
+  unregister: function(responderToRemove) {
+    this.responders = this.responders.without(responderToRemove);
+  },
+
+  dispatch: function(callback, request, transport, json) {
+    this.each(function(responder) {
+      if (responder[callback] && typeof responder[callback] == 'function') {
+        try {
+          responder[callback].apply(responder, [request, transport, json]);
+        } catch (e) {}
+      }
+    });
+  }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+  onCreate: function() {
+    Ajax.activeRequestCount++;
+  },
+
+  onComplete: function() {
+    Ajax.activeRequestCount--;
+  }
+});
+
+Ajax.Base = function() {};
+Ajax.Base.prototype = {
+  setOptions: function(options) {
+    this.options = {
+      method:       'post',
+      asynchronous: true,
+      parameters:   ''
+    }
+    Object.extend(this.options, options || {});
+  },
+
+  responseIsSuccess: function() {
+    return this.transport.status == undefined
+        || this.transport.status == 0
+        || (this.transport.status >= 200 && this.transport.status < 300);
+  },
+
+  responseIsFailure: function() {
+    return !this.responseIsSuccess();
+  }
+}
+
+Ajax.Request = Class.create();
+Ajax.Request.Events =
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(url, options) {
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+    this.request(url);
+  },
+
+  request: function(url) {
+    var parameters = this.options.parameters || '';
+    if (parameters.length > 0) parameters += '&_=';
+
+    try {
+      this.url = url;
+      if (this.options.method == 'get' && parameters.length > 0)
+        this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
+
+      Ajax.Responders.dispatch('onCreate', this, this.transport);
+
+      this.transport.open(this.options.method, this.url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous) {
+        this.transport.onreadystatechange = this.onStateChange.bind(this);
+        setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
+      }
+
+      this.setRequestHeaders();
+
+      var body = this.options.postBody ? this.options.postBody : parameters;
+      this.transport.send(this.options.method == 'post' ? body : null);
+
+    } catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  setRequestHeaders: function() {
+    var requestHeaders =
+      ['X-Requested-With', 'XMLHttpRequest',
+       'X-Prototype-Version', Prototype.Version];
+
+    if (this.options.method == 'post') {
+      requestHeaders.push('Content-type',
+        'application/x-www-form-urlencoded');
+
+      /* Force "Connection: close" for Mozilla browsers to work around
+       * a bug where XMLHttpReqeuest sends an incorrect Content-length
+       * header. See Mozilla Bugzilla #246651.
+       */
+      if (this.transport.overrideMimeType)
+        requestHeaders.push('Connection', 'close');
+    }
+
+    if (this.options.requestHeaders)
+      requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
+
+    for (var i = 0; i < requestHeaders.length; i += 2)
+      this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState != 1)
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  header: function(name) {
+    try {
+      return this.transport.getResponseHeader(name);
+    } catch (e) {}
+  },
+
+  evalJSON: function() {
+    try {
+      return eval(this.header('X-JSON'));
+    } catch (e) {}
+  },
+
+  evalResponse: function() {
+    try {
+      return eval(this.transport.responseText);
+    } catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  respondToReadyState: function(readyState) {
+    var event = Ajax.Request.Events[readyState];
+    var transport = this.transport, json = this.evalJSON();
+
+    if (event == 'Complete') {
+      try {
+        (this.options['on' + this.transport.status]
+         || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
+         || Prototype.emptyFunction)(transport, json);
+      } catch (e) {
+        this.dispatchException(e);
+      }
+
+      if ((this.header('Content-type') || '').match(/^text\/javascript/i))
+        this.evalResponse();
+    }
+
+    try {
+      (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
+      Ajax.Responders.dispatch('on' + event, this, transport, json);
+    } catch (e) {
+      this.dispatchException(e);
+    }
+
+    /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
+    if (event == 'Complete')
+      this.transport.onreadystatechange = Prototype.emptyFunction;
+  },
+
+  dispatchException: function(exception) {
+    (this.options.onException || Prototype.emptyFunction)(this, exception);
+    Ajax.Responders.dispatch('onException', this, exception);
+  }
+});
+
+Ajax.Updater = Class.create();
+
+Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
+  initialize: function(container, url, options) {
+    this.containers = {
+      success: container.success ? $(container.success) : $(container),
+      failure: container.failure ? $(container.failure) :
+        (container.success ? null : $(container))
+    }
+
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+
+    var onComplete = this.options.onComplete || Prototype.emptyFunction;
+    this.options.onComplete = (function(transport, object) {
+      this.updateContent();
+      onComplete(transport, object);
+    }).bind(this);
+
+    this.request(url);
+  },
+
+  updateContent: function() {
+    var receiver = this.responseIsSuccess() ?
+      this.containers.success : this.containers.failure;
+    var response = this.transport.responseText;
+
+    if (!this.options.evalScripts)
+      response = response.stripScripts();
+
+    if (receiver) {
+      if (this.options.insertion) {
+        new this.options.insertion(receiver, response);
+      } else {
+        Element.update(receiver, response);
+      }
+    }
+
+    if (this.responseIsSuccess()) {
+      if (this.onComplete)
+        setTimeout(this.onComplete.bind(this), 10);
+    }
+  }
+});
+
+Ajax.PeriodicalUpdater = Class.create();
+Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(container, url, options) {
+    this.setOptions(options);
+    this.onComplete = this.options.onComplete;
+
+    this.frequency = (this.options.frequency || 2);
+    this.decay = (this.options.decay || 1);
+
+    this.updater = {};
+    this.container = container;
+    this.url = url;
+
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+  },
+
+  stop: function() {
+    this.updater.onComplete = undefined;
+    clearTimeout(this.timer);
+    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+  },
+
+  updateComplete: function(request) {
+    if (this.options.decay) {
+      this.decay = (request.responseText == this.lastText ?
+        this.decay * this.options.decay : 1);
+
+      this.lastText = request.responseText;
+    }
+    this.timer = setTimeout(this.onTimerEvent.bind(this),
+      this.decay * this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);
+  }
+});
+document.getElementsByClassName = function(className, parentElement) {
+  var children = ($(parentElement) || document.body).getElementsByTagName('*');
+  return $A(children).inject([], function(elements, child) {
+    if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
+      elements.push(child);
+    return elements;
+  });
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Element) {
+  var Element = new Object();
+}
+
+Object.extend(Element, {
+  visible: function(element) {
+    return $(element).style.display != 'none';
+  },
+
+  toggle: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      Element[Element.visible(element) ? 'hide' : 'show'](element);
+    }
+  },
+
+  hide: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = 'none';
+    }
+  },
+
+  show: function() {
+    for (var i = 0; i < arguments.length; i++) {
+      var element = $(arguments[i]);
+      element.style.display = '';
+    }
+  },
+
+  remove: function(element) {
+    element = $(element);
+    element.parentNode.removeChild(element);
+  },
+
+  update: function(element, html) {
+    $(element).innerHTML = html.stripScripts();
+    setTimeout(function() {html.evalScripts()}, 10);
+  },
+
+  getHeight: function(element) {
+    element = $(element);
+    return element.offsetHeight;
+  },
+
+  classNames: function(element) {
+    return new Element.ClassNames(element);
+  },
+
+  hasClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    return Element.classNames(element).include(className);
+  },
+
+  addClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    return Element.classNames(element).add(className);
+  },
+
+  removeClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    return Element.classNames(element).remove(className);
+  },
+
+  // removes whitespace-only text node children
+  cleanWhitespace: function(element) {
+    element = $(element);
+    for (var i = 0; i < element.childNodes.length; i++) {
+      var node = element.childNodes[i];
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+        Element.remove(node);
+    }
+  },
+
+  empty: function(element) {
+    return $(element).innerHTML.match(/^\s*$/);
+  },
+
+  scrollTo: function(element) {
+    element = $(element);
+    var x = element.x ? element.x : element.offsetLeft,
+        y = element.y ? element.y : element.offsetTop;
+    window.scrollTo(x, y);
+  },
+
+  getStyle: function(element, style) {
+    element = $(element);
+    var value = element.style[style.camelize()];
+    if (!value) {
+      if (document.defaultView && document.defaultView.getComputedStyle) {
+        var css = document.defaultView.getComputedStyle(element, null);
+        value = css ? css.getPropertyValue(style) : null;
+      } else if (element.currentStyle) {
+        value = element.currentStyle[style.camelize()];
+      }
+    }
+
+    if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
+      if (Element.getStyle(element, 'position') == 'static') value = 'auto';
+
+    return value == 'auto' ? null : value;
+  },
+
+  setStyle: function(element, style) {
+    element = $(element);
+    for (name in style)
+      element.style[name.camelize()] = style[name];
+  },
+
+  getDimensions: function(element) {
+    element = $(element);
+    if (Element.getStyle(element, 'display') != 'none')
+      return {width: element.offsetWidth, height: element.offsetHeight};
+
+    // All *Width and *Height properties give 0 on elements with display none,
+    // so enable the element temporarily
+    var els = element.style;
+    var originalVisibility = els.visibility;
+    var originalPosition = els.position;
+    els.visibility = 'hidden';
+    els.position = 'absolute';
+    els.display = '';
+    var originalWidth = element.clientWidth;
+    var originalHeight = element.clientHeight;
+    els.display = 'none';
+    els.position = originalPosition;
+    els.visibility = originalVisibility;
+    return {width: originalWidth, height: originalHeight};
+  },
+
+  makePositioned: function(element) {
+    element = $(element);
+    var pos = Element.getStyle(element, 'position');
+    if (pos == 'static' || !pos) {
+      element._madePositioned = true;
+      element.style.position = 'relative';
+      // Opera returns the offset relative to the positioning context, when an
+      // element is position relative but top and left have not been defined
+      if (window.opera) {
+        element.style.top = 0;
+        element.style.left = 0;
+      }
+    }
+  },
+
+  undoPositioned: function(element) {
+    element = $(element);
+    if (element._madePositioned) {
+      element._madePositioned = undefined;
+      element.style.position =
+        element.style.top =
+        element.style.left =
+        element.style.bottom =
+        element.style.right = '';
+    }
+  },
+
+  makeClipping: function(element) {
+    element = $(element);
+    if (element._overflow) return;
+    element._overflow = element.style.overflow;
+    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
+      element.style.overflow = 'hidden';
+  },
+
+  undoClipping: function(element) {
+    element = $(element);
+    if (element._overflow) return;
+    element.style.overflow = element._overflow;
+    element._overflow = undefined;
+  }
+});
+
+var Toggle = new Object();
+Toggle.display = Element.toggle;
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.Insertion = function(adjacency) {
+  this.adjacency = adjacency;
+}
+
+Abstract.Insertion.prototype = {
+  initialize: function(element, content) {
+    this.element = $(element);
+    this.content = content.stripScripts();
+
+    if (this.adjacency && this.element.insertAdjacentHTML) {
+      try {
+        this.element.insertAdjacentHTML(this.adjacency, this.content);
+      } catch (e) {
+        if (this.element.tagName.toLowerCase() == 'tbody') {
+          this.insertContent(this.contentFromAnonymousTable());
+        } else {
+          throw e;
+        }
+      }
+    } else {
+      this.range = this.element.ownerDocument.createRange();
+      if (this.initializeRange) this.initializeRange();
+      this.insertContent([this.range.createContextualFragment(this.content)]);
+    }
+
+    setTimeout(function() {content.evalScripts()}, 10);
+  },
+
+  contentFromAnonymousTable: function() {
+    var div = document.createElement('div');
+    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
+    return $A(div.childNodes[0].childNodes[0].childNodes);
+  }
+}
+
+var Insertion = new Object();
+
+Insertion.Before = Class.create();
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
+  initializeRange: function() {
+    this.range.setStartBefore(this.element);
+  },
+
+  insertContent: function(fragments) {
+    fragments.each((function(fragment) {
+      this.element.parentNode.insertBefore(fragment, this.element);
+    }).bind(this));
+  }
+});
+
+Insertion.Top = Class.create();
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(true);
+  },
+
+  insertContent: function(fragments) {
+    fragments.reverse(false).each((function(fragment) {
+      this.element.insertBefore(fragment, this.element.firstChild);
+    }).bind(this));
+  }
+});
+
+Insertion.Bottom = Class.create();
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
+  initializeRange: function() {
+    this.range.selectNodeContents(this.element);
+    this.range.collapse(this.element);
+  },
+
+  insertContent: function(fragments) {
+    fragments.each((function(fragment) {
+      this.element.appendChild(fragment);
+    }).bind(this));
+  }
+});
+
+Insertion.After = Class.create();
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
+  initializeRange: function() {
+    this.range.setStartAfter(this.element);
+  },
+
+  insertContent: function(fragments) {
+    fragments.each((function(fragment) {
+      this.element.parentNode.insertBefore(fragment,
+        this.element.nextSibling);
+    }).bind(this));
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+  initialize: function(element) {
+    this.element = $(element);
+  },
+
+  _each: function(iterator) {
+    this.element.className.split(/\s+/).select(function(name) {
+      return name.length > 0;
+    })._each(iterator);
+  },
+
+  set: function(className) {
+    this.element.className = className;
+  },
+
+  add: function(classNameToAdd) {
+    if (this.include(classNameToAdd)) return;
+    this.set(this.toArray().concat(classNameToAdd).join(' '));
+  },
+
+  remove: function(classNameToRemove) {
+    if (!this.include(classNameToRemove)) return;
+    this.set(this.select(function(className) {
+      return className != classNameToRemove;
+    }).join(' '));
+  },
+
+  toString: function() {
+    return this.toArray().join(' ');
+  }
+}
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+var Field = {
+  clear: function() {
+    for (var i = 0; i < arguments.length; i++)
+      $(arguments[i]).value = '';
+  },
+
+  focus: function(element) {
+    $(element).focus();
+  },
+
+  present: function() {
+    for (var i = 0; i < arguments.length; i++)
+      if ($(arguments[i]).value == '') return false;
+    return true;
+  },
+
+  select: function(element) {
+    $(element).select();
+  },
+
+  activate: function(element) {
+    element = $(element);
+    element.focus();
+    if (element.select)
+      element.select();
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Form = {
+  serialize: function(form) {
+    var elements = Form.getElements($(form));
+    var queryComponents = new Array();
+
+    for (var i = 0; i < elements.length; i++) {
+      var queryComponent = Form.Element.serialize(elements[i]);
+      if (queryComponent)
+        queryComponents.push(queryComponent);
+    }
+
+    return queryComponents.join('&');
+  },
+
+  getElements: function(form) {
+    form = $(form);
+    var elements = new Array();
+
+    for (tagName in Form.Element.Serializers) {
+      var tagElements = form.getElementsByTagName(tagName);
+      for (var j = 0; j < tagElements.length; j++)
+        elements.push(tagElements[j]);
+    }
+    return elements;
+  },
+
+  getInputs: function(form, typeName, name) {
+    form = $(form);
+    var inputs = form.getElementsByTagName('input');
+
+    if (!typeName && !name)
+      return inputs;
+
+    var matchingInputs = new Array();
+    for (var i = 0; i < inputs.length; i++) {
+      var input = inputs[i];
+      if ((typeName && input.type != typeName) ||
+          (name && input.name != name))
+        continue;
+      matchingInputs.push(input);
+    }
+
+    return matchingInputs;
+  },
+
+  disable: function(form) {
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      element.blur();
+      element.disabled = 'true';
+    }
+  },
+
+  enable: function(form) {
+    var elements = Form.getElements(form);
+    for (var i = 0; i < elements.length; i++) {
+      var element = elements[i];
+      element.disabled = '';
+    }
+  },
+
+  findFirstElement: function(form) {
+    return Form.getElements(form).find(function(element) {
+      return element.type != 'hidden' && !element.disabled &&
+        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+    });
+  },
+
+  focusFirstElement: function(form) {
+    Field.activate(Form.findFirstElement(form));
+  },
+
+  reset: function(form) {
+    $(form).reset();
+  }
+}
+
+Form.Element = {
+  serialize: function(element) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    var parameter = Form.Element.Serializers[method](element);
+
+    if (parameter) {
+      var key = encodeURIComponent(parameter[0]);
+      if (key.length == 0) return;
+
+      if (parameter[1].constructor != Array)
+        parameter[1] = [parameter[1]];
+
+      return parameter[1].map(function(value) {
+        return key + '=' + encodeURIComponent(value);
+      }).join('&');
+    }
+  },
+
+  getValue: function(element) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    var parameter = Form.Element.Serializers[method](element);
+
+    if (parameter)
+      return parameter[1];
+  }
+}
+
+Form.Element.Serializers = {
+  input: function(element) {
+    switch (element.type.toLowerCase()) {
+      case 'submit':
+      case 'hidden':
+      case 'password':
+      case 'text':
+        return Form.Element.Serializers.textarea(element);
+      case 'checkbox':
+      case 'radio':
+        return Form.Element.Serializers.inputSelector(element);
+    }
+    return false;
+  },
+
+  inputSelector: function(element) {
+    if (element.checked)
+      return [element.name, element.value];
+  },
+
+  textarea: function(element) {
+    return [element.name, element.value];
+  },
+
+  select: function(element) {
+    return Form.Element.Serializers[element.type == 'select-one' ?
+      'selectOne' : 'selectMany'](element);
+  },
+
+  selectOne: function(element) {
+    var value = '', opt, index = element.selectedIndex;
+    if (index >= 0) {
+      opt = element.options[index];
+      value = opt.value;
+      if (!value && !('value' in opt))
+        value = opt.text;
+    }
+    return [element.name, value];
+  },
+
+  selectMany: function(element) {
+    var value = new Array();
+    for (var i = 0; i < element.length; i++) {
+      var opt = element.options[i];
+      if (opt.selected) {
+        var optValue = opt.value;
+        if (!optValue && !('value' in opt))
+          optValue = opt.text;
+        value.push(optValue);
+      }
+    }
+    return [element.name, value];
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var $F = Form.Element.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = function() {}
+Abstract.TimedObserver.prototype = {
+  initialize: function(element, frequency, callback) {
+    this.frequency = frequency;
+    this.element   = $(element);
+    this.callback  = callback;
+
+    this.lastValue = this.getValue();
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  }
+}
+
+Form.Element.Observer = Class.create();
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.Observer = Class.create();
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = function() {}
+Abstract.EventObserver.prototype = {
+  initialize: function(element, callback) {
+    this.element  = $(element);
+    this.callback = callback;
+
+    this.lastValue = this.getValue();
+    if (this.element.tagName.toLowerCase() == 'form')
+      this.registerFormCallbacks();
+    else
+      this.registerCallback(this.element);
+  },
+
+  onElementEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  },
+
+  registerFormCallbacks: function() {
+    var elements = Form.getElements(this.element);
+    for (var i = 0; i < elements.length; i++)
+      this.registerCallback(elements[i]);
+  },
+
+  registerCallback: function(element) {
+    if (element.type) {
+      switch (element.type.toLowerCase()) {
+        case 'checkbox':
+        case 'radio':
+          Event.observe(element, 'click', this.onElementEvent.bind(this));
+          break;
+        case 'password':
+        case 'text':
+        case 'textarea':
+        case 'select-one':
+        case 'select-multiple':
+          Event.observe(element, 'change', this.onElementEvent.bind(this));
+          break;
+      }
+    }
+  }
+}
+
+Form.Element.EventObserver = Class.create();
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.EventObserver = Class.create();
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+if (!window.Event) {
+  var Event = new Object();
+}
+
+Object.extend(Event, {
+  KEY_BACKSPACE: 8,
+  KEY_TAB:       9,
+  KEY_RETURN:   13,
+  KEY_ESC:      27,
+  KEY_LEFT:     37,
+  KEY_UP:       38,
+  KEY_RIGHT:    39,
+  KEY_DOWN:     40,
+  KEY_DELETE:   46,
+
+  element: function(event) {
+    return event.target || event.srcElement;
+  },
+
+  isLeftClick: function(event) {
+    return (((event.which) && (event.which == 1)) ||
+            ((event.button) && (event.button == 1)));
+  },
+
+  pointerX: function(event) {
+    return event.pageX || (event.clientX +
+      (document.documentElement.scrollLeft || document.body.scrollLeft));
+  },
+
+  pointerY: function(event) {
+    return event.pageY || (event.clientY +
+      (document.documentElement.scrollTop || document.body.scrollTop));
+  },
+
+  stop: function(event) {
+    if (event.preventDefault) {
+      event.preventDefault();
+      event.stopPropagation();
+    } else {
+      event.returnValue = false;
+      event.cancelBubble = true;
+    }
+  },
+
+  // find the first node with the given tagName, starting from the
+  // node the event was triggered on; traverses the DOM upwards
+  findElement: function(event, tagName) {
+    var element = Event.element(event);
+    while (element.parentNode && (!element.tagName ||
+        (element.tagName.toUpperCase() != tagName.toUpperCase())))
+      element = element.parentNode;
+    return element;
+  },
+
+  observers: false,
+
+  _observeAndCache: function(element, name, observer, useCapture) {
+    if (!this.observers) this.observers = [];
+    if (element.addEventListener) {
+      this.observers.push([element, name, observer, useCapture]);
+      element.addEventListener(name, observer, useCapture);
+    } else if (element.attachEvent) {
+      this.observers.push([element, name, observer, useCapture]);
+      element.attachEvent('on' + name, observer);
+    }
+  },
+
+  unloadCache: function() {
+    if (!Event.observers) return;
+    for (var i = 0; i < Event.observers.length; i++) {
+      Event.stopObserving.apply(this, Event.observers[i]);
+      Event.observers[i][0] = null;
+    }
+    Event.observers = false;
+  },
+
+  observe: function(element, name, observer, useCapture) {
+    var element = $(element);
+    useCapture = useCapture || false;
+
+    if (name == 'keypress' &&
+        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+        || element.attachEvent))
+      name = 'keydown';
+
+    this._observeAndCache(element, name, observer, useCapture);
+  },
+
+  stopObserving: function(element, name, observer, useCapture) {
+    var element = $(element);
+    useCapture = useCapture || false;
+
+    if (name == 'keypress' &&
+        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
+        || element.detachEvent))
+      name = 'keydown';
+
+    if (element.removeEventListener) {
+      element.removeEventListener(name, observer, useCapture);
+    } else if (element.detachEvent) {
+      element.detachEvent('on' + name, observer);
+    }
+  }
+});
+
+/* prevent memory leaks in IE */
+Event.observe(window, 'unload', Event.unloadCache, false);
+var Position = {
+  // set to true if needed, warning: firefox performance problems
+  // NOT neeeded for page scrolling, only if draggable contained in
+  // scrollable elements
+  includeScrollOffsets: false,
+
+  // must be called before calling withinIncludingScrolloffset, every time the
+  // page is scrolled
+  prepare: function() {
+    this.deltaX =  window.pageXOffset
+                || document.documentElement.scrollLeft
+                || document.body.scrollLeft
+                || 0;
+    this.deltaY =  window.pageYOffset
+                || document.documentElement.scrollTop
+                || document.body.scrollTop
+                || 0;
+  },
+
+  realOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.scrollTop  || 0;
+      valueL += element.scrollLeft || 0;
+      element = element.parentNode;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  cumulativeOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  positionedOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+      if (element) {
+        p = Element.getStyle(element, 'position');
+        if (p == 'relative' || p == 'absolute') break;
+      }
+    } while (element);
+    return [valueL, valueT];
+  },
+
+  offsetParent: function(element) {
+    if (element.offsetParent) return element.offsetParent;
+    if (element == document.body) return element;
+
+    while ((element = element.parentNode) && element != document.body)
+      if (Element.getStyle(element, 'position') != 'static')
+        return element;
+
+    return document.body;
+  },
+
+  // caches x/y coordinate pair to use with overlap
+  within: function(element, x, y) {
+    if (this.includeScrollOffsets)
+      return this.withinIncludingScrolloffsets(element, x, y);
+    this.xcomp = x;
+    this.ycomp = y;
+    this.offset = this.cumulativeOffset(element);
+
+    return (y >= this.offset[1] &&
+            y <  this.offset[1] + element.offsetHeight &&
+            x >= this.offset[0] &&
+            x <  this.offset[0] + element.offsetWidth);
+  },
+
+  withinIncludingScrolloffsets: function(element, x, y) {
+    var offsetcache = this.realOffset(element);
+
+    this.xcomp = x + offsetcache[0] - this.deltaX;
+    this.ycomp = y + offsetcache[1] - this.deltaY;
+    this.offset = this.cumulativeOffset(element);
+
+    return (this.ycomp >= this.offset[1] &&
+            this.ycomp <  this.offset[1] + element.offsetHeight &&
+            this.xcomp >= this.offset[0] &&
+            this.xcomp <  this.offset[0] + element.offsetWidth);
+  },
+
+  // within must be called directly before
+  overlap: function(mode, element) {
+    if (!mode) return 0;
+    if (mode == 'vertical')
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+        element.offsetHeight;
+    if (mode == 'horizontal')
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+        element.offsetWidth;
+  },
+
+  clone: function(source, target) {
+    source = $(source);
+    target = $(target);
+    target.style.position = 'absolute';
+    var offsets = this.cumulativeOffset(source);
+    target.style.top    = offsets[1] + 'px';
+    target.style.left   = offsets[0] + 'px';
+    target.style.width  = source.offsetWidth + 'px';
+    target.style.height = source.offsetHeight + 'px';
+  },
+
+  page: function(forElement) {
+    var valueT = 0, valueL = 0;
+
+    var element = forElement;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+
+      // Safari fix
+      if (element.offsetParent==document.body)
+        if (Element.getStyle(element,'position')=='absolute') break;
+
+    } while (element = element.offsetParent);
+
+    element = forElement;
+    do {
+      valueT -= element.scrollTop  || 0;
+      valueL -= element.scrollLeft || 0;
+    } while (element = element.parentNode);
+
+    return [valueL, valueT];
+  },
+
+  clone: function(source, target) {
+    var options = Object.extend({
+      setLeft:    true,
+      setTop:     true,
+      setWidth:   true,
+      setHeight:  true,
+      offsetTop:  0,
+      offsetLeft: 0
+    }, arguments[2] || {})
+
+    // find page position of source
+    source = $(source);
+    var p = Position.page(source);
+
+    // find coordinate system to use
+    target = $(target);
+    var delta = [0, 0];
+    var parent = null;
+    // delta [0,0] will do fine with position: fixed elements,
+    // position:absolute needs offsetParent deltas
+    if (Element.getStyle(target,'position') == 'absolute') {
+      parent = Position.offsetParent(target);
+      delta = Position.page(parent);
+    }
+
+    // correct by body offsets (fixes Safari)
+    if (parent == document.body) {
+      delta[0] -= document.body.offsetLeft;
+      delta[1] -= document.body.offsetTop;
+    }
+
+    // set position
+    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
+    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
+    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
+    if(options.setHeight) target.style.height = source.offsetHeight + 'px';
+  },
+
+  absolutize: function(element) {
+    element = $(element);
+    if (element.style.position == 'absolute') return;
+    Position.prepare();
+
+    var offsets = Position.positionedOffset(element);
+    var top     = offsets[1];
+    var left    = offsets[0];
+    var width   = element.clientWidth;
+    var height  = element.clientHeight;
+
+    element._originalLeft   = left - parseFloat(element.style.left  || 0);
+    element._originalTop    = top  - parseFloat(element.style.top || 0);
+    element._originalWidth  = element.style.width;
+    element._originalHeight = element.style.height;
+
+    element.style.position = 'absolute';
+    element.style.top    = top + 'px';;
+    element.style.left   = left + 'px';;
+    element.style.width  = width + 'px';;
+    element.style.height = height + 'px';;
+  },
+
+  relativize: function(element) {
+    element = $(element);
+    if (element.style.position == 'relative') return;
+    Position.prepare();
+
+    element.style.position = 'relative';
+    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
+    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
+
+    element.style.top    = top + 'px';
+    element.style.left   = left + 'px';
+    element.style.height = element._originalHeight;
+    element.style.width  = element._originalWidth;
+  }
+}
+
+// Safari returns margins on body which is incorrect if the child is absolutely
+// positioned.  For performance reasons, redefine Position.cumulativeOffset for
+// KHTML/WebKit only.
+if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
+  Position.cumulativeOffset = function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      if (element.offsetParent == document.body)
+        if (Element.getStyle(element, 'position') == 'absolute') break;
+
+      element = element.offsetParent;
+    } while (element);
+
+    return [valueL, valueT];
+  }
+}
\ No newline at end of file
diff --git a/extra/http/server/resources/stylesheet.css b/extra/http/server/resources/stylesheet.css
new file mode 100644 (file)
index 0000000..a1afce7
--- /dev/null
@@ -0,0 +1,4 @@
+a:link { text-decoration: none; color: black; }
+a:visited { text-decoration: none; color: black; }
+a:active { text-decoration: none; color: black; }
+a:hover { text-decoration: underline; color: black; }
diff --git a/extra/http/server/responders/callback/callback.factor b/extra/http/server/responders/callback/callback.factor
new file mode 100644 (file)
index 0000000..1203350
--- /dev/null
@@ -0,0 +1,126 @@
+! Copyright (C) 2004 Chris Double.
+! Copyright (C) 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: html http http.server.responders io kernel math namespaces
+continuations random system sequences assocs ;
+
+IN: http.server.responders.callback
+
+#! Name of the variable holding the continuation used to exit
+#! back to the httpd responder.
+SYMBOL: exit-continuation 
+
+#! Tuple to hold global request data. This gets passed to
+#! the continuation when resumed so it can restore things
+#! like 'stdio' so it writes to the correct socket. 
+TUPLE: request stream exitcc method url raw-query query header response ;
+
+: <request> ( -- request )
+  stdio get
+  exit-continuation get
+  "method" get
+  "request" get
+  "raw-query" get
+  "query" get
+  "header" get
+  "response" get
+  request construct-boa ;
+
+: restore-request ( -- )
+  request get 
+  dup request-stream stdio set 
+  dup request-method "method" set 
+  dup request-raw-query "raw-query" set 
+  dup request-query "query" set 
+  dup request-header "header" set 
+  dup request-response "response" set 
+  request-exitcc exit-continuation set ;
+
+: update-request ( request new-request -- )
+  [ request-stream over set-request-stream ] keep 
+  [ request-method over set-request-method ] keep 
+  [ request-url over set-request-url ] keep 
+  [ request-raw-query over set-request-raw-query ] keep 
+  [ request-query over set-request-query ] keep 
+  [ request-header over set-request-header ] keep 
+  [ request-response over set-request-response ] keep 
+  request-exitcc swap set-request-exitcc ;
+  
+: with-exit-continuation ( quot -- ) 
+    #! Call the quotation with the variable exit-continuation bound 
+    #! such that when the exit continuation is called, computation 
+    #! will resume from the end of this 'with-exit-continuation' call. 
+    [ 
+        exit-continuation set call exit-continuation get continue
+    ] callcc0 drop ;
+
+: expiry-timeout ( -- ms ) 900 1000 * ;
+
+: get-random-id ( -- id ) 
+    #! Generate a random id to use for continuation URL's
+    "ID" 32 [ drop 9 random CHAR: 0 + ] map append ;
+
+: callback-table ( -- <hashtable> ) 
+    #! Return the global table of continuations
+    \ callback-table get-global ;
+
+: reset-callback-table ( -- ) 
+    #! Create the initial global table
+    H{ } clone \ callback-table set-global ;
+
+reset-callback-table
+
+#! Tuple for holding data related to a callback.
+TUPLE: item quot expire? request id  time-added ;
+
+: <item> ( quot expire? request id -- item )
+    millis item construct-boa ;
+
+: expired? ( item -- ? )
+    #! Return true if the callback item is expirable
+    #! and has expired (ie. was added to the table more than
+    #! timeout milliseconds ago).
+    [ item-time-added expiry-timeout + millis < ] keep
+    item-expire? and ;
+
+: expire-callbacks ( -- )
+    #! Expire all continuations in the continuation table
+    #! if they are 'timeout-seconds' old (ie. were added
+    #! more than 'timeout-seconds' ago.
+    callback-table clone [
+        expired? [ callback-table delete-at ] [ drop ] if
+    ] assoc-each ;
+
+: id>url ( id -- string )
+    #! Convert the continuation id to an URL suitable for
+    #! embedding in an HREF or other HTML.
+    "/responder/callback/?id=" swap url-encode append ;
+
+: register-callback ( quot expire? -- url ) 
+    #! Store a continuation in the table and associate it with
+    #! a random id. That continuation will be expired after
+    #! a certain period of time if 'expire?' is true.  
+    request get get-random-id [ <item> ] keep
+    [ callback-table set-at ] keep
+    id>url ;
+
+: register-html-callback ( quot expire? -- url )
+    >r [ serving-html ] swap append r> register-callback ;
+
+: callback-responder ( -- )   
+    expire-callbacks
+    "id" query-param callback-table at [
+        [
+         dup item-request [
+            <request> update-request
+          ] when*
+          item-quot call 
+          exit-continuation get continue 
+        ] with-exit-continuation drop
+    ] [
+        "404 Callback not available" httpd-error
+    ] if* ;
+
+global [
+    "callback" [ callback-responder ] add-simple-responder
+] bind
diff --git a/extra/http/server/responders/continuation/continuation.factor b/extra/http/server/responders/continuation/continuation.factor
new file mode 100644 (file)
index 0000000..601dd37
--- /dev/null
@@ -0,0 +1,191 @@
+! Copyright (C) 2004 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: http math namespaces io strings kernel html html.elements 
+hashtables continuations quotations parser generic
+sequences http.server.responders.callback http.server.responders ;
+IN: http.server.responders.continuation
+
+#! Used inside the session state of responders to indicate whether the
+#! next request should use the post-refresh-get pattern. It is set to
+#! true after each request.
+SYMBOL: post-refresh-get?
+
+: >callable ( quot|interp|f -- interp )
+    dup continuation? [        
+        [ continue ] curry
+    ] when ;
+
+: forward-to-url ( url -- )
+    #! When executed inside a 'show' call, this will force a
+    #! HTTP 302 to occur to instruct the browser to forward to
+    #! the request URL.
+    [ 
+        "HTTP/1.1 302 Document Moved\nLocation: " % %
+        "\nContent-Length: 0\nContent-Type: text/plain\n\n" %
+    ] "" make write exit-continuation get continue ;
+
+: forward-to-id ( id -- )
+    #! When executed inside a 'show' call, this will force a
+    #! HTTP 302 to occur to instruct the browser to forward to
+    #! the request URL.
+    >r "request" get r> id>url append forward-to-url ;
+
+SYMBOL: current-show
+
+: store-current-show ( -- )
+  #! Store the current continuation in the variable 'current-show' 
+  #! so it can be returned to later by href callbacks. Note that it
+  #! recalls itself when the continuation is called to ensure that
+  #! it resets its value back to the most recent show call.
+  [  ( 0 -- )
+    [ ( 0 1 -- )
+      current-show set ( 0 -- )
+      continue
+    ] callcc1 ! 0 [ ] ==
+    nip
+    restore-request
+    call
+    store-current-show
+  ] callcc0 restore-request ;
+
+: redirect-to-here ( -- )
+  #! Force a redirect to the client browser so that the browser
+  #! goes to the current point in the code. This forces an URL
+  #! change on the browser so that refreshing that URL will
+  #! immediately run from this code point. This prevents the 
+  #! "this request will issue a POST" warning from the browser
+  #! and prevents re-running the previous POST logic. This is
+  #! known as the 'post-refresh-get' pattern.
+  post-refresh-get? get [
+    [ 
+      >callable t register-callback forward-to-url
+    ] callcc0  restore-request
+  ] [
+    t post-refresh-get? set
+  ] if ;
+
+: (show) ( quot -- hashtable )   
+    #! See comments for show. The difference is the 
+    #! quotation MUST set the content-type using 'serving-html'
+    #! or similar.
+    store-current-show redirect-to-here
+    [ 
+        >callable t register-callback swap with-scope 
+        exit-continuation get  continue
+    ] callcc0 drop restore-request "response" get ;
+
+: show ( quot -- namespace )   
+    #! Call the quotation with the URL associated with the current
+    #! continuation. All output from the quotation goes to the client
+    #! browser. When the URL is later referenced then 
+    #! computation will resume from this 'show' call with a hashtable on
+    #! the stack containing any query or post parameters.
+    #! 'quot' has stack effect ( url -- )
+    #! NOTE: On return from 'show' the stack is exactly the same as
+    #! initial entry with 'quot' popped off and the hashtable pushed on. Even
+    #! if the quotation consumes items on the stack.
+    [ serving-html ] swap append (show) ;
+
+: (show-final) ( quot -- namespace )
+    #! See comments for show-final. The difference is the 
+    #! quotation MUST set the content-type using 'serving-html'
+    #! or similar.
+    store-current-show redirect-to-here
+    with-scope exit-continuation get continue ;
+
+: show-final ( quot -- namespace )
+    #! Similar to 'show', except the quotation does not receive the URL
+    #! to resume computation following 'show-final'. No continuation is
+    #! stored for this resumption. As a result, 'show-final' is for use
+    #! when a page is to be displayed with no further action to occur. Its
+    #! use is an optimisation to save having to generate and save a continuation
+    #! in that special case.
+    #! 'quot' has stack effect ( -- ).
+    [ serving-html ] swap append (show-final) ;
+
+#! Name of variable for holding initial continuation id that starts
+#! the responder.
+SYMBOL: root-callback
+
+: cont-get/post-responder ( id-or-f -- ) 
+    #! httpd responder that handles the root continuation request.
+    #! The requests for actual continuation are processed by the
+    #! 'callback-responder'.
+    [         
+        [ f post-refresh-get? set <request> request set root-callback get call ] with-scope
+        exit-continuation get continue
+    ] with-exit-continuation  drop ;
+
+: quot-url ( quot -- url )
+    current-show get [ continue-with ] 2curry t register-callback ;
+
+: quot-href ( text quot -- )
+    #! Write to standard output an HTML HREF where the href,
+    #! when referenced, will call the quotation and then return
+    #! back to the most recent 'show' call (via the callback-cc).
+    #! The text of the link will be the 'text' argument on the 
+    #! stack.
+    <a quot-url =href a> write </a> ;
+
+: install-cont-responder ( name quot -- )
+    #! Install a cont-responder with the given name
+    #! that will initially run the given quotation.
+    #!
+    #! Convert the quotation so it is run within a session namespace
+    #! and that namespace is initialized first.
+    [ 
+        [ cont-get/post-responder ] "get" set 
+        [ cont-get/post-responder ] "post" set 
+        swap "responder" set
+        root-callback set        
+    ] make-responder ;
+
+: simple-page ( title quot -- )
+    #! Call the quotation, with all output going to the
+    #! body of an html page with the given title.
+    <html>  
+        <head> <title> swap write </title> </head> 
+        <body> call </body>
+    </html> ;
+
+: styled-page ( title stylesheet-quot quot -- )
+    #! Call the quotation, with all output going to the
+    #! body of an html page with the given title. stylesheet-quot
+    #! is called to generate the required stylesheet.
+    <html>  
+        <head>  
+             <title> rot write </title> 
+             swap call 
+        </head> 
+        <body> call </body>
+    </html> ;
+
+: paragraph ( str -- )
+    #! Output the string as an html paragraph
+    <p> write </p> ;
+
+: show-message-page ( message -- )
+    #! Display the message in an HTML page with an OK button.
+    [
+        "Press OK to Continue" [
+            swap paragraph 
+            <a =href a> "OK" write </a>
+        ] simple-page 
+    ] show 2drop ;
+
+: vertical-layout ( list -- )
+    #! Given a list of HTML components, arrange them vertically.
+    <table> 
+    [ <tr> <td> call </td> </tr> ] each
+    </table> ;
+
+: horizontal-layout ( list -- )
+    #! Given a list of HTML components, arrange them horizontally.
+    <table> 
+     <tr "top" =valign tr> [ <td> call </td> ] each </tr>
+    </table> ;
+
+: button ( label -- )
+    #! Output an HTML submit button with the given label.
+    <input "submit" =type =value input/> ;
diff --git a/extra/http/server/responders/continuation/examples/examples.factor b/extra/http/server/responders/continuation/examples/examples.factor
new file mode 100644 (file)
index 0000000..2a2eae7
--- /dev/null
@@ -0,0 +1,114 @@
+! Copyright (C) 2004 Chris Double.
+! 
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions are met:
+! 
+! 1. Redistributions of source code must retain the above copyright notice,
+!    this list of conditions and the following disclaimer.
+! 
+! 2. Redistributions in binary form must reproduce the above copyright notice,
+!    this list of conditions and the following disclaimer in the documentation
+!    and/or other materials provided with the distribution.
+! 
+! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+!
+! Simple test applications
+USING: hashtables html kernel io html html.elements strings math assocs quotations
+http.server.responders.continuation namespaces prettyprint sequences ;
+
+IN: http.server.responders.continuation.examples
+
+: display-page ( title -- ) 
+  #! Display a page with some text to test the cont-responder.
+  #! The page has a link to the 'next' continuation.
+  [ 
+    <h1> over write </h1>
+    swap [ 
+      <a =href a> "Next" write </a>
+    ] html-document 
+  ] show 2drop ;
+
+: display-get-name-page ( -- name )
+  #! Display a page prompting for input of a name and return that name.
+  [ 
+    "Enter your name" [
+      <h1> swap write </h1>
+      <form "post" =method =action form> 
+        "Name: " write
+        <input "text" =type "name" =name "20" =size input/>
+        <input "submit" =type "Ok" =value input/>
+      </form>
+    ] html-document
+  ] show "name" swap at ;
+
+: test-cont-responder ( -- )
+  #! Test the cont-responder responder by displaying a few pages in a row.
+  "Page one" display-page 
+  "Hello " display-get-name-page append display-page
+  "Page three" display-page ;
+
+: test-cont-responder2 ( -- )
+  #! Test the cont-responder responder by displaying a few pages in a loop.
+  [ "one" "two" "three" "four" ] [ display-page ]  each 
+  "Done!" display-page  ;
+
+: test-cont-responder3 ( -- )
+  #! Test the quot-href word by displaying a menu of the current
+  #! test words. Note that we use show-final as we don't link to a 'next' page.
+  [ 
+    "Menu" [ 
+      <h1> "Menu" write </h1>
+      <ol> 
+        <li> "Test responder1" [ test-cont-responder ] quot-href </li>
+        <li> "Test responder2" [ test-cont-responder2 ] quot-href </li>
+      </ol>
+    ] html-document 
+  ] show-final ;
+
+: counter-example ( count -- )
+  #! Display a counter which can be incremented or decremented
+  #! using anchors.
+  #!
+  #! Don't need the original alist
+  [ 
+    #! And we don't need the 'url' argument
+    drop         
+    "Counter: " over unparse append [ 
+      dup <h2> unparse write </h2>
+      "++" over 1quotation [ f ] swap append [ 1 + counter-example ] append quot-href
+      "--" over 1quotation [ f ] swap append [ 1 - counter-example ] append quot-href
+      drop
+    ] html-document 
+  ] show drop ;
+
+: counter-example2 ( -- )
+  #! Display a counter which can be incremented or decremented
+  #! using anchors.
+  #!
+  0 "counter" set
+  [ 
+    #! We don't need the 'url' argument
+    drop   
+    "Counter: " "counter" get unparse append [ 
+      <h2> "counter" get unparse write </h2>
+      "++" [ "counter" get 1 + "counter" set ] quot-href
+      "--" [ "counter" get 1 - "counter" set ] quot-href
+    ] html-document 
+  ] show 
+  drop ;
+
+! Install the examples
+"counter1" [ drop 0 counter-example ] install-cont-responder
+"counter2" [ drop counter-example2 ] install-cont-responder
+"test1" [ test-cont-responder ] install-cont-responder
+"test2" [ drop test-cont-responder2 ] install-cont-responder
+"test3" [ drop test-cont-responder3 ] install-cont-responder
diff --git a/extra/http/server/responders/continuation/examples/numbers/numbers.factor b/extra/http/server/responders/continuation/examples/numbers/numbers.factor
new file mode 100644 (file)
index 0000000..84418bf
--- /dev/null
@@ -0,0 +1,95 @@
+! cont-number-guess
+!
+! Copyright (C) 2004 Chris Double.
+! 
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions are met:
+! 
+! 1. Redistributions of source code must retain the above copyright notice,
+!    this list of conditions and the following disclaimer.
+! 
+! 2. Redistributions in binary form must reproduce the above copyright notice,
+!    this list of conditions and the following disclaimer in the documentation
+!    and/or other materials provided with the distribution.
+! 
+! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+!
+! This example modifies the console based 'numbers-game' example
+! in a very minimal way to demonstrate conversion of a console
+! program to a web based application.
+!
+! All that was required was changing the input and output functions
+! to use HTML. The remaining code was untouched. 
+!
+! The result is not that pretty but it shows the basic idea.
+USING: kernel math parser html html.elements io namespaces math.parser
+random http.server.responders.continuation ;
+
+IN: http.server.responders.continuation.examples.numbers
+
+: web-print ( str -- )
+  #! Display the string in a web page.
+  [
+    swap dup
+    <html>
+      <head> <title> write </title> </head>
+      <body>
+        <p> write </p>
+        <p> <a =href a> "Press to continue" write </a> </p>
+      </body>
+    </html>
+  ] show 2drop ;
+
+: read-number ( -- )
+  [
+    <html>
+      <head> <title> "Enter a number" write </title> </head>
+      <body>
+        <form =action "post" =method form>
+          <p> 
+            "Enter a number:" write
+            <input "text" =type "num" =name "20" =size input/>
+            <input "submit" =type "Press to continue" =value input/>
+          </p>
+        </form>
+      </body>
+    </html>
+  ] show [ "num" get ] bind string>number ;
+
+: guess-banner
+  "I'm thinking of a number between 0 and 100." web-print ;
+: guess-prompt  ;
+: too-high "Too high" web-print ;
+: too-low "Too low" web-print ;
+: correct "Correct - you win!" web-print ;
+: inexact-guess ( actual guess -- )
+     < [ too-high ] [ too-low ] if ;
+
+: judge-guess ( actual guess -- ? )
+    2dup = [
+        2drop correct f
+    ] [
+        inexact-guess t
+    ] if ;
+
+: number-to-guess ( -- n ) 100 random ;
+
+: numbers-game-loop ( actual -- )
+    dup guess-prompt read-number judge-guess [
+        numbers-game-loop
+    ] [
+        drop
+    ] if ;
+
+: numbers-game number-to-guess numbers-game-loop ;
+
+"numbers-game" [ numbers-game ] install-cont-responder
diff --git a/extra/http/server/responders/file/file.factor b/extra/http/server/responders/file/file.factor
new file mode 100644 (file)
index 0000000..e6af805
--- /dev/null
@@ -0,0 +1,116 @@
+! Copyright (C) 2004, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: calendar html io io.files kernel math math.parser http.server.responders
+http.server.templating namespaces parser sequences strings assocs hashtables
+debugger http.mime sorting ;
+
+IN: http.server.responders.file
+
+: serving-path ( filename -- filename )
+    "" or "doc-root" get swap path+ ;
+
+: file-http-date ( filename -- string )
+    file-modified unix-time>timestamp timestamp>http-string ;
+
+: file-response ( filename mime-type -- )
+    [
+        "Content-Type" set
+        dup file-length number>string "Content-Length" set
+        file-http-date "Last-Modified" set
+        now timestamp>http-string "Date" set
+    ] H{ } make-assoc "200 OK" response nl ;
+
+: last-modified-matches? ( filename -- bool )
+    file-http-date dup [
+        "If-Modified-Since" "header" get at = 
+    ] when ;
+
+: not-modified-response ( -- )
+    now timestamp>http-string "Date" associate
+    "304 Not Modified" response nl ;  
+
+: serve-static ( filename mime-type -- )
+    over last-modified-matches? [
+        2drop not-modified-response
+    ] [
+        dupd file-response
+        "method" get "head" = [
+            drop
+        ] [
+            <file-reader> stdio get stream-copy
+        ] if 
+    ] if ;
+
+SYMBOL: page
+
+: run-page ( filename -- )
+    dup
+    [ [ dup page set run-template-file ] with-scope ] try
+    drop ;
+
+: include-page ( filename -- )
+    "doc-root" get swap path+ run-page ;
+
+: serve-file ( filename -- )
+    dup mime-type dup "application/x-factor-server-page" =
+    [ drop serving-html run-page ] [ serve-static ] if ;
+
+: file. ( path name dirp -- )
+    "[DIR] " "      " ? write
+    dup <pathname> write-object nl ;
+
+: directory. ( path -- )
+    directory sort-keys [ first2 file. ] each ;
+
+: list-directory ( directory -- )
+    serving-html
+     "method" get "head" = [
+        drop
+    ] [
+        "request" get [ directory. ] simple-html-document
+    ] if ;
+
+: find-index ( filename -- path )
+    { "index.html" "index.fhtml" }
+    [ dupd path+ exists? ] find nip
+    dup [ path+ ] [ nip ] if ;
+
+: serve-directory ( filename -- )
+    dup "/" tail? [
+        dup find-index
+        [ serve-file ] [ list-directory ] ?if
+    ] [
+        drop directory-no/
+    ] if ;
+
+: serve-object ( filename -- )
+    dup directory? [ serve-directory ] [ serve-file ] if ;
+
+: file-responder ( -- )
+    "doc-root" get [
+        "argument" get serving-path dup exists? [
+            serve-object
+        ] [
+            drop "404 not found" httpd-error
+        ] if
+    ] [
+        "404 doc-root not set" httpd-error
+    ] if ;
+
+global [
+    ! Javascript source used by ajax libraries
+    "resources" [ 
+        [
+            "extra/http/server/resources/" resource-path "doc-root" set
+            file-responder
+        ] with-scope
+    ] add-simple-responder
+    
+    ! Serves files from a directory stored in the "doc-root"
+    ! variable. You can set the variable in the global namespace,
+    ! or inside the responder.
+    "file" [ file-responder ] add-simple-responder
+    
+    ! The root directory is served by...
+    "file" set-default-responder
+] bind
\ No newline at end of file
diff --git a/extra/http/server/responders/responders.factor b/extra/http/server/responders/responders.factor
new file mode 100644 (file)
index 0000000..b13239a
--- /dev/null
@@ -0,0 +1,210 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs hashtables html html.elements splitting
+http io kernel math math.parser namespaces parser sequences
+strings io.server ;
+
+IN: http.server.responders
+
+! Variables
+SYMBOL: vhosts
+SYMBOL: responders
+
+: print-header ( alist -- )
+    [ swap write ": " write print ] assoc-each ;
+
+: response ( header msg -- )
+    "HTTP/1.0 " write print print-header ;
+
+: error-body ( error -- body )
+    <html> <body> <h1> write </h1> </body> </html> ;
+
+: error-head ( error -- )
+    dup log-error
+    H{ { "Content-Type" "text/html" } } over response ;
+
+: httpd-error ( error -- )
+    #! This must be run from handle-request
+    error-head
+    "head" "method" get = [ drop ] [ nl error-body ] if ;
+
+: bad-request ( -- )
+    [
+        ! Make httpd-error print a body
+        "get" "method" set
+        "400 Bad request" httpd-error
+    ] with-scope ;
+
+: serving-content ( mime -- )
+    "Content-Type" associate
+    "200 Document follows" response nl ;
+
+: serving-html "text/html" serving-content ;
+
+: serve-html ( quot -- )
+    serving-html with-html-stream ;
+
+: serving-text "text/plain" serving-content ;
+
+: (redirect) ( to response -- )
+    >r "Location" associate r> response nl ;
+
+: permanent-redirect ( to -- )
+    "301 Moved Permanently" (redirect) ;
+
+: temporary-redirect ( to -- )
+    "307 Temporary Redirect" (redirect) ;
+
+: directory-no/ ( -- )
+    [
+        "request" get % CHAR: / ,
+        "raw-query" get [ CHAR: ? , % ] when*
+    ] "" make permanent-redirect ;
+
+: query>hash ( query -- hash )
+    dup [
+        "&" split [
+            "=" split1 [ dup [ url-decode ] when ] 2apply 2array
+        ] map
+    ] when >hashtable ;
+
+SYMBOL: max-post-request
+
+1024 256 * max-post-request set-global
+
+: content-length ( header -- n )
+    "Content-Length" swap at string>number dup [
+        dup max-post-request get > [
+            "Content-Length > max-post-request" throw
+        ] when
+    ] when ;
+
+: read-post-request ( header -- str hash )
+    content-length [ read dup query>hash ] [ f f ] if* ;
+
+: log-headers ( hash -- )
+    [
+        drop {
+            "User-Agent"
+            "Referer"
+            "X-Forwarded-For"
+            "Host"
+        } member?
+    ] assoc-subset [
+        ": " swap 3append log-message
+    ] assoc-each ;
+
+: prepare-url ( url -- url )
+    #! This is executed in the with-request namespace.
+    "?" split1
+    dup "raw-query" set query>hash "query" set
+    dup "request" set ;
+
+: prepare-header ( -- )
+    read-header dup "header" set
+    dup log-headers
+    read-post-request "response" set "raw-response" set ;
+
+! Responders are called in a new namespace with these
+! variables:
+
+! - method -- one of get, post, or head.
+! - request -- the entire URL requested, including responder
+!              name
+! - responder-url -- the component of the URL for the responder
+! - raw-query -- raw query string
+! - query -- a hashtable of query parameters, eg
+!            foo.bar?a=b&c=d becomes
+!            H{ { "a" "b" } { "c" "d" } }
+! - header -- a hashtable of headers from the user's client
+! - response -- a hashtable of the POST request response
+! - raw-response -- raw POST request response
+
+: query-param ( key -- value ) "query" get at ;
+
+: add-responder ( responder -- )
+    #! Add a responder object to the list.
+    "responder" over at  responders get set-at ;
+
+: add-simple-responder ( name quot -- )
+    [
+        [ drop ] swap append dup "get" set "post" set
+        "responder" set
+    ] H{ } make-assoc add-responder ;
+
+: make-responder ( quot -- responder )
+    #! quot has stack effect ( url -- )
+    [
+        [
+            drop "GET method not implemented" httpd-error
+        ] "get" set
+        [
+            drop "POST method not implemented" httpd-error
+        ] "post" set
+        [
+            drop "HEAD method not implemented" httpd-error
+        ] "head" set
+        [
+            drop bad-request
+        ] "bad" set
+        
+        call
+    ] H{ } make-assoc add-responder ;
+
+: vhost ( name -- vhost )
+    vhosts get at [ "default" vhost ] unless* ;
+
+: responder ( name -- responder )
+    responders get at [ "404" responder ] unless* ;
+
+: set-default-responder ( name -- )
+    responder "default" responders get set-at ;
+
+: call-responder ( method argument responder -- )
+    over "argument" set [ swap get with-scope ] bind ;
+
+: serve-default-responder ( method url -- )
+    "/" "responder-url" set
+    "default" responder call-responder ;
+
+: log-responder ( path -- )
+    "Calling responder " swap append log-message ;
+
+: trim-/ ( url -- url )
+    #! Trim a leading /, if there is one.
+    "/" ?head drop ;
+
+: serve-explicit-responder ( method url -- )
+    "/" split1 
+    "/responder/" pick "/" 3append "responder-url" set
+    dup [
+        swap responder call-responder
+    ] [
+        ! Just a responder name by itself
+        drop "request" get "/" append permanent-redirect 2drop
+    ] if ;
+
+: serve-responder ( method path host -- )
+    #! Responder paths come in two forms:
+    #! /foo/bar... - default responder used
+    #! /responder/foo/bar - responder foo, argument bar
+    vhost [
+        dup log-responder trim-/ "responder/" ?head [
+            serve-explicit-responder
+        ] [
+            serve-default-responder
+        ] if
+    ] bind ;
+
+: no-such-responder ( -- )
+    "404 No such responder" httpd-error ;
+
+! create a responders hash if it doesn't already exist
+global [ 
+    responders [ H{ } assoc-like ] change
+    
+    ! 404 error message pages are served by this guy
+    "404" [ no-such-responder ] add-simple-responder
+    
+    H{ } clone "default" associate vhosts set
+] bind
diff --git a/extra/http/server/server-tests.factor b/extra/http/server/server-tests.factor
new file mode 100644 (file)
index 0000000..97fac31
--- /dev/null
@@ -0,0 +1,42 @@
+USING: http.server.responders.file http.server.responders http
+http.server namespaces io tools.test strings io.server ;
+IN: temporary
+
+[ ] [ f [ "404 not found" httpd-error ] with-logging ] unit-test
+
+[ "inspect/global" ] [ "/inspect/global" trim-/ ] unit-test
+
+[ ] [
+    f [ "unit/test" log-responder ] with-logging
+] unit-test
+
+[ "index.html" ]
+[ "http://www.jedit.org/index.html" url>path ] unit-test
+
+[ "foo/bar" ]
+[ "http://www.jedit.org/foo/bar" url>path ] unit-test
+
+[ "" ]
+[ "http://www.jedit.org/" url>path ] unit-test
+
+[ "" ]
+[ "http://www.jedit.org" url>path ] unit-test
+
+[ "foobar" ]
+[ "foobar" secure-path ] unit-test
+
+[ f ]
+[ "foobar/../baz" secure-path ] unit-test
+
+[ ] [ f [ "GET ../index.html" parse-request ] with-logging ] unit-test
+[ ] [ f [ "POO" parse-request ] with-logging ] unit-test
+
+[ H{ { "Foo" "Bar" } } ] [ "Foo=Bar" query>hash ] unit-test
+
+[ H{ { "Foo" "Bar" } { "Baz" "Quux" } } ]
+[ "Foo=Bar&Baz=Quux" query>hash ] unit-test
+
+[ H{ { "Baz" " " } } ]
+[ "Baz=%20" query>hash ] unit-test
+
+[ H{ { "Foo" f } } ] [ "Foo" query>hash ] unit-test
diff --git a/extra/http/server/server.factor b/extra/http/server/server.factor
new file mode 100644 (file)
index 0000000..a6903a3
--- /dev/null
@@ -0,0 +1,65 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs kernel namespaces io strings splitting
+threads http http.server.responders sequences prettyprint
+io.server http.server.responders.file
+http.server.responders.callback
+http.server.responders.continuation ;
+
+IN: http.server
+
+: (url>path) ( uri -- path )
+    url-decode "http://" ?head [
+        "/" split1 dup "" ? nip
+    ] when ;
+
+: url>path ( uri -- path )
+    "?" split1 dup [
+      >r (url>path) "?" r> 3append
+    ] [
+      drop (url>path)
+    ] if ;
+
+: secure-path ( path -- path )
+    ".." over subseq? [ drop f ] when ;
+
+: request-method ( cmd -- method )
+    H{
+        { "GET" "get" }
+        { "POST" "post" }
+        { "HEAD" "head" }
+    } at "bad" or ;
+
+: host ( -- string )
+    #! The host the current responder was called from.
+    "Host" "header" get at ":" split1 drop ;
+
+: (handle-request) ( arg cmd -- method path host )
+    request-method dup "method" set swap
+    prepare-url prepare-header host ;
+
+: handle-request ( arg cmd -- )
+    [ (handle-request) serve-responder ] with-scope ;
+
+: parse-request ( request -- )
+    dup log-message
+    " " split1 dup [
+        " HTTP" split1 drop url>path secure-path dup [
+            swap handle-request
+        ] [
+            2drop bad-request
+        ] if
+    ] [
+        2drop bad-request
+    ] if ;
+
+: httpd ( port -- )
+    "Starting HTTP server on port " write dup . flush
+    internet-server "http.server" [
+        60000 stdio get set-timeout
+        readln [ parse-request ] when*
+    ] with-server ;
+
+: httpd-main ( -- ) 8888 httpd ;
+
+MAIN: httpd-main
diff --git a/extra/http/server/summary.txt b/extra/http/server/summary.txt
new file mode 100644 (file)
index 0000000..e6d2ca6
--- /dev/null
@@ -0,0 +1 @@
+HTTP server
diff --git a/extra/http/server/tags.txt b/extra/http/server/tags.txt
new file mode 100644 (file)
index 0000000..ebb39bc
--- /dev/null
@@ -0,0 +1,2 @@
+network
+web
diff --git a/extra/http/server/templating/authors.txt b/extra/http/server/templating/authors.txt
new file mode 100644 (file)
index 0000000..b47eafb
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+Matthew Willis
diff --git a/extra/http/server/templating/templating-tests.factor b/extra/http/server/templating/templating-tests.factor
new file mode 100644 (file)
index 0000000..6ccf3ed
--- /dev/null
@@ -0,0 +1,21 @@
+USING: io io.files io.streams.string http.server.templating 
+kernel tools.test sequences ;
+IN: temporary
+
+: test-template ( path -- ? )
+    "extra/http/server/templating/test/" swap append
+    
+    [
+        ".fhtml" append resource-path
+        [ run-template-file ] string-out
+    ] keep
+
+    ".html" append resource-path
+    <file-reader> contents
+    = ;
+
+[ t ] [ "example" test-template ] unit-test
+[ t ] [ "bug" test-template ] unit-test
+[ t ] [ "stack" test-template ] unit-test
+
+[ ] [ "<%\n%>" parse-template drop ] unit-test
diff --git a/extra/http/server/templating/templating.factor b/extra/http/server/templating/templating.factor
new file mode 100644 (file)
index 0000000..73535d7
--- /dev/null
@@ -0,0 +1,85 @@
+! Copyright (C) 2005 Alex Chapman
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: sequences kernel parser namespaces io io.files
+io.streams.lines io.streams.string html html.elements
+source-files debugger combinators math quotations generic
+strings splitting ;
+
+IN: http.server.templating
+
+: templating-vocab ( -- vocab-name ) "http.server.templating" ;
+
+! See apps/http-server/test/ or libs/furnace/ for template usage
+! examples
+
+! We use a custom lexer so that %> ends a token even if not
+! followed by whitespace
+TUPLE: template-lexer ;
+
+: <template-lexer> ( lines -- lexer )
+    <lexer> template-lexer construct-delegate ;
+
+M: template-lexer skip-word
+    [
+        {
+            { [ 2dup nth CHAR: " = ] [ drop 1+ ] }
+            { [ 2dup swap tail-slice "%>" head? ] [ drop 2 + ] }
+            { [ t ] [ [ blank? ] skip ] }
+        } cond
+    ] change-column ;
+
+DEFER: <% delimiter
+
+: check-<% ( lexer -- col )
+    "<%" over line-text rot lexer-column start* ;
+
+: found-<% ( accum lexer col -- accum )
+    [
+        over line-text >r >r lexer-column r> r> subseq parsed
+        \ write-html parsed
+    ] 2keep 2 + swap set-lexer-column ;
+
+: still-looking ( accum lexer -- accum )
+    [
+        dup line-text swap lexer-column tail
+        parsed \ print-html parsed
+    ] keep next-line ;
+
+: parse-%> ( accum lexer -- accum )
+    dup still-parsing? [
+        dup check-<%
+        [ found-<% ] [ [ still-looking ] keep parse-%> ] if*
+    ] [
+        drop
+    ] if ;
+
+: %> lexer get parse-%> ; parsing
+
+: parse-template-lines ( lines -- quot )
+    <template-lexer> [
+        V{ } clone lexer get parse-%> f (parse-until)
+    ] with-parser ;
+
+: parse-template ( string -- quot )
+    [
+        use [ clone ] change
+        templating-vocab use+
+        string-lines parse-template-lines
+    ] with-scope ;
+
+: eval-template ( string -- ) parse-template call ;
+
+: run-template-file ( filename -- )
+    [
+        [
+            file-vocabs
+            parser-notes off
+            templating-vocab use+
+            dup source-file file set ! so that reload works properly
+            [ <file-reader> contents eval-template ] keep
+        ] with-scope
+    ] assert-depth drop ;
+
+: template-convert ( infile outfile -- )
+    <file-writer> [ run-template-file ] with-stream ;
diff --git a/extra/http/server/templating/test/bug.fhtml b/extra/http/server/templating/test/bug.fhtml
new file mode 100644 (file)
index 0000000..cb66599
--- /dev/null
@@ -0,0 +1,5 @@
+<%
+    USING: prettyprint ;
+    ! Hello world
+    5 pprint
+%>
diff --git a/extra/http/server/templating/test/bug.html b/extra/http/server/templating/test/bug.html
new file mode 100644 (file)
index 0000000..51d7b8d
--- /dev/null
@@ -0,0 +1,2 @@
+5
+
diff --git a/extra/http/server/templating/test/example.fhtml b/extra/http/server/templating/test/example.fhtml
new file mode 100644 (file)
index 0000000..211f44a
--- /dev/null
@@ -0,0 +1,8 @@
+<% USING: math ; %>
+
+<html>
+    <head><title>Simple Embedded Factor Example</title></head>
+    <body>
+        <% 5 [ %><p>I like repetition</p><% ] times %>
+    </body>
+</html>
diff --git a/extra/http/server/templating/test/example.html b/extra/http/server/templating/test/example.html
new file mode 100644 (file)
index 0000000..9bf4a08
--- /dev/null
@@ -0,0 +1,9 @@
+
+
+<html>
+    <head><title>Simple Embedded Factor Example</title></head>
+    <body>
+        <p>I like repetition</p><p>I like repetition</p><p>I like repetition</p><p>I like repetition</p><p>I like repetition</p>
+    </body>
+</html>
+
diff --git a/extra/http/server/templating/test/stack.fhtml b/extra/http/server/templating/test/stack.fhtml
new file mode 100644 (file)
index 0000000..399711a
--- /dev/null
@@ -0,0 +1 @@
+The stack: <% USING: prettyprint ;  .s %>
diff --git a/extra/http/server/templating/test/stack.html b/extra/http/server/templating/test/stack.html
new file mode 100644 (file)
index 0000000..ee923a6
--- /dev/null
@@ -0,0 +1,2 @@
+The stack: 
+
diff --git a/extra/http/summary.txt b/extra/http/summary.txt
new file mode 100644 (file)
index 0000000..8791a6f
--- /dev/null
@@ -0,0 +1 @@
+Common code shared by HTTP client and server
diff --git a/extra/http/tags.txt b/extra/http/tags.txt
new file mode 100644 (file)
index 0000000..93e65ae
--- /dev/null
@@ -0,0 +1,2 @@
+web
+network
diff --git a/extra/icfp/2006/2006.factor b/extra/icfp/2006/2006.factor
new file mode 100644 (file)
index 0000000..317a5ae
--- /dev/null
@@ -0,0 +1,145 @@
+! Copyright (C) 2007 Gavin Harrison
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel math sequences kernel.private namespaces arrays
+io io.files splitting io.binary math.functions vectors ;
+IN: universal-machine
+
+SYMBOL: regs
+SYMBOL: arrays
+SYMBOL: finger
+SYMBOL: open-arrays
+
+: call-nth ( n array -- )
+    >r >fixnum r> 2dup nth quotation?
+    [ dispatch ] [ "Not a quotation" throw ] if ; inline
+
+: reg-val ( m -- n ) regs get nth ;
+
+: set-reg ( val n -- ) regs get set-nth ;
+
+: arr-val ( index loc -- z )
+    arrays get nth nth ;
+
+: set-arr ( val index loc -- )
+    arrays get nth set-nth ;
+
+: get-op ( num -- op )
+    -28 shift BIN: 1111 bitand ;
+
+: get-value ( platter -- register )
+    HEX: 1ffffff bitand ;
+
+: >32bit ( m -- n ) HEX: ffffffff bitand ; inline
+
+: get-a ( platter -- register )
+    -6 shift BIN: 111 bitand ; inline
+
+: get-b ( platter -- register )
+    -3 shift BIN: 111 bitand ; inline
+
+: get-c ( platter -- register )
+    BIN: 111 bitand ; inline
+
+: get-cb ( platter -- b c ) [ get-c ] keep get-b ;
+: get-cba ( platter -- c b a ) [ get-cb ] keep get-a ;
+: get-special ( platter -- register )
+    -25 shift BIN: 111 bitand ; inline
+
+: op0 ( opcode -- ? )
+    get-cba rot reg-val zero? [
+        2drop
+    ] [
+        >r reg-val r> set-reg
+    ] if f ;
+
+: binary-op ( quot -- ? )
+    >r get-cba r>
+    swap >r >r [ reg-val ] 2apply swap r> call r>
+    set-reg f ; inline
+    
+: op1 ( opcode -- ? )
+    [ swap arr-val ] binary-op ;
+
+: op2 ( opcode -- ? )
+    get-cba >r [ reg-val ] 2apply r> reg-val set-arr f ;
+
+: op3 ( opcode -- ? )
+    [ + >32bit ] binary-op ;
+
+: op4 ( opcode -- ? )
+    [ * >32bit ] binary-op ;
+
+: op5 ( opcode -- ? )
+    [ /i ] binary-op ;
+
+: op6 ( opcode -- ? )
+    [ bitand HEX: ffffffff swap - ] binary-op ;
+
+: new-array ( size location -- )
+    >r 0 <array> r> arrays get set-nth ;
+
+: ?grow-storage ( -- )
+    open-arrays get dup empty? [
+        >r arrays get length r> push
+    ] [
+        drop
+    ] if ;
+
+: op8 ( opcode -- ? )
+    ?grow-storage
+    get-cb >r reg-val open-arrays get pop [ new-array ] keep r> 
+    set-reg f ;
+
+: op9 ( opcode -- ? )
+    get-c reg-val dup open-arrays get push
+    f swap arrays get set-nth f ;
+
+: op10 ( opcode -- ? )
+    get-c reg-val write1 flush f ;
+
+: op11 ( opcode -- ? )
+    drop f ;
+
+: op12 ( opcode -- ? )
+    get-cb reg-val dup zero? [
+        drop
+    ] [
+        arrays get [ nth clone 0 ] keep set-nth
+    ] if reg-val finger set f ;
+
+: op13 ( opcode -- ? )
+    [ get-value ] keep get-special set-reg f ;
+    
+: advance ( -- val opcode )
+    finger get arrays get first nth
+    finger inc dup get-op ;
+
+: run-op ( -- bool )
+    advance
+    {
+        [ op0 ] [ op1 ] [ op2 ] [ op3 ]
+        [ op4 ] [ op5 ] [ op6 ] [ drop t ]
+        [ op8 ] [ op9 ] [ op10 ] [ op11 ]
+        [ op12 ] [ op13 ]
+    } call-nth ;
+
+: exec-loop ( bool -- )
+    [ run-op exec-loop ] unless ;
+
+: load-platters ( path -- )
+    <file-reader> contents 4 group [ be> ] map
+    0 arrays get set-nth ;
+
+: init ( path -- )
+    8 0 <array> regs set
+    2 16 ^ <vector> arrays set
+    0 finger set
+    V{ } clone open-arrays set
+    load-platters ;
+
+: run-prog ( path -- )
+    init f exec-loop ;
+
+: run-sand ( -- )
+    "extra/icfp/2006/sandmark.umz" resource-path run-prog ;
diff --git a/extra/icfp/2006/authors.txt b/extra/icfp/2006/authors.txt
new file mode 100644 (file)
index 0000000..194cb22
--- /dev/null
@@ -0,0 +1 @@
+Gavin Harrison
diff --git a/extra/icfp/2006/sandmark.umz b/extra/icfp/2006/sandmark.umz
new file mode 100644 (file)
index 0000000..1bb2145
Binary files /dev/null and b/extra/icfp/2006/sandmark.umz differ
diff --git a/extra/icfp/2006/summary.txt b/extra/icfp/2006/summary.txt
new file mode 100644 (file)
index 0000000..7ec7471
--- /dev/null
@@ -0,0 +1 @@
+Implementation of task for ICFP 2006
diff --git a/extra/icfp/2006/tags.txt b/extra/icfp/2006/tags.txt
new file mode 100644 (file)
index 0000000..7102ccb
--- /dev/null
@@ -0,0 +1 @@
+icfp
diff --git a/extra/id3/authors.txt b/extra/id3/authors.txt
new file mode 100644 (file)
index 0000000..bbc876e
--- /dev/null
@@ -0,0 +1 @@
+Adam Wendt
diff --git a/extra/id3/id3-docs.factor b/extra/id3/id3-docs.factor
new file mode 100644 (file)
index 0000000..47edee7
--- /dev/null
@@ -0,0 +1,28 @@
+! Coyright (C) 2007 Adam Wendt
+! See http://factorcode.org/license.txt for BSD license.
+USING: id3 help.syntax help.markup ;
+
+ARTICLE: "id3-tags" "ID3 Tags"
+"The " { $vocab-link "id3" } " vocabulary is used to read ID3 tags from MP3 audio streams."
+{ $subsection id3v2 }
+{ $subsection read-tag }
+{ $subsection id3v2? }
+{ $subsection read-id3v2 } ;
+
+ABOUT: "id3-tags"
+
+HELP: id3v2
+{ $values { "filename" "a pathname string" } { "tag/f" "a tag or f" } }
+{ $description "Outputs a " { $link tag } " or " { $link f } " if file does not start with an ID3 tag." } ;
+
+HELP: read-tag
+{ $values { "stream" "a stream" } { "tag/f" "a tag or f" } }
+{ $description "Outputs a " { $link tag } " or " { $link f } " if stream does not start with an ID3 tag." } ;
+
+HELP: id3v2?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if the current input stream begins with an ID3 tag." } ;
+
+HELP: read-id3v2
+{ $values { "tag/f" "a tag or f" } }
+{ $description "Outputs a " { $link tag } " or " { $link f } " if the current input stream does not start with an ID3 tag." } ;
diff --git a/extra/id3/id3.factor b/extra/id3/id3.factor
new file mode 100644 (file)
index 0000000..f1ef5b7
--- /dev/null
@@ -0,0 +1,153 @@
+! Copyright (C) 2007 Adam Wendt.
+! See http://factorcode.org/license.txt for BSD license.
+!
+
+USING: arrays combinators io io.binary io.files io.utf16 kernel math math.parser namespaces sequences splitting strings assocs ;
+
+IN: id3
+
+TUPLE: tag header frames ;
+C: <tag> tag
+
+TUPLE: header version revision flags size extended-header ;
+C: <header> header
+
+TUPLE: frame id size flags data ;
+C: <frame> frame
+
+TUPLE: extended-header size flags update crc restrictions ;
+C: <extended-header> extended-header
+
+: debug-stream ( msg -- )
+!  global [ . flush ] bind ;
+  drop ;
+
+: >hexstring ( str -- hex )
+  >array [ >hex 2 CHAR: 0 pad-left ] map concat ;
+
+: good-frame-id? ( id -- ? )
+  [ [ LETTER? ] keep digit? or ] all? ;
+
+! 4 byte syncsafe integer (28 effective bits)
+: >syncsafe ( seq -- int )
+  0 [ >r 7 shift r> bitor ] reduce ;
+
+: read-size ( -- size )
+  4 read >syncsafe ; 
+
+: read-frame-id ( -- id )
+  4 read ;
+
+: read-frame-flags ( -- flags )
+  2 read ;
+
+: read-frame-size ( -- size )
+  4 read be> ;
+
+: text-frame? ( id -- ? )
+  "T" head? ;
+
+: read-text ( size -- text )
+  read1 swap 1 - read swap 1 = [ decode-utf16 ] [ ] if
+  "\0" ?tail drop ; ! remove null terminator
+
+: read-popm ( size -- popm )
+  read-text ; 
+
+: read-frame-data ( id size -- data )
+  swap
+  {
+    { [ dup text-frame? ] [ drop read-text ] }
+    { [ "POPM" = ] [ read-popm ] }
+    { [ t ] [ read ] }
+  } cond ;
+
+: (read-frame) ( id -- frame )
+  read-frame-size read-frame-flags pick pick read-frame-data <frame> ;
+
+: read-frame ( -- frame/f )
+  read-frame-id dup good-frame-id? [ (read-frame) ] [ drop f ] if ;
+
+: (read-frames) ( vector -- frames )
+  read-frame [ over push (read-frames) ] when* ;
+
+: read-frames ( -- frames )
+  V{ } clone (read-frames) ;
+
+: read-eh-flags ( -- flags )
+  read1 read le> ;
+  
+: read-eh-data ( size -- data )
+  6 - read ;
+
+: read-crc ( flags -- crc )
+  5 bit? [ read1 read >syncsafe ] [ f ] if ; 
+
+: tag-is-update? ( flags -- ? )
+  6 bit? dup [ read1 drop ] [ ] if ;
+
+: (read-tag-restrictions) ( -- restrictions )
+  read1 dup read le> ; 
+
+: read-tag-restrictions ( flags -- restrictions/f )
+  4 bit? [ (read-tag-restrictions) ] [ f ] if ;
+
+: (read-extended-header) ( -- extended-header )
+  read-size read-eh-flags dup tag-is-update? over dup
+  read-crc swap read-tag-restrictions <extended-header> ;
+
+: read-extended-header ( flags -- extended-header/f )
+  6 bit? [ (read-extended-header) ] [ f ] if ;
+
+: read-header ( version -- header )
+  read1 read1 read-size over read-extended-header <header> ;
+
+: (read-id3v2) ( version -- tag )
+  read-header read-frames <tag> ;
+
+: supported-version? ( version -- ? )
+  [ 3 4 ] member? ;
+
+: read-id3v2 ( -- tag/f )
+  read1 dup supported-version?
+  [ (read-id3v2) ] [ drop f ] if ;
+
+: id3v2? ( -- ? )
+  3 read "ID3" = ;
+
+: read-tag ( stream -- tag/f )
+  id3v2? [ read-id3v2 ] [ f ] if ;
+
+: id3v2 ( filename -- tag/f )
+  <file-reader> [ read-tag ] with-stream ;
+
+: append-path ( path files -- paths )
+  [ path+ ] curry* map ;
+
+: get-paths ( dir -- paths )
+  dup directory keys append-path ;
+
+: (walk-dir) ( path -- )
+  dup directory? [ get-paths dup % [ (walk-dir) ] each ] [ drop ] if ;
+
+: walk-dir ( path -- seq )
+  [ (walk-dir) ] { } make ;
+
+: file? ( path -- ? )
+  stat 3drop not ;
+
+: files ( paths -- files )
+  [ file? ] subset ;
+
+: mp3? ( path -- ? )
+  ".mp3" tail? ;
+  
+: mp3s ( paths -- mp3s )
+  [ mp3? ] subset ;
+
+: id3? ( file -- ? )
+  <file-reader> [ id3v2? ] with-stream ;
+
+: id3s ( files -- id3s )
+  [ id3? ] subset ;
+
diff --git a/extra/id3/summary.txt b/extra/id3/summary.txt
new file mode 100644 (file)
index 0000000..6201617
--- /dev/null
@@ -0,0 +1 @@
+ID3 music file tag parser
diff --git a/extra/inverse/authors.txt b/extra/inverse/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/inverse/inverse-docs.factor b/extra/inverse/inverse-docs.factor
new file mode 100644 (file)
index 0000000..1551776
--- /dev/null
@@ -0,0 +1,52 @@
+USING: inverse help.syntax help.markup ;
+
+HELP: [undo]
+{ $values { "quot" "a quotation" } { "undo" "the inverse of the quotation" } }
+{ $description "Creates the inverse of the given quotation" }
+{ $see-also undo } ;
+
+HELP: undo
+{ $values { "quot" "a quotation" } }
+{ $description "Executes the inverse of the given quotation" }
+{ $see-also [undo] } ;
+
+HELP: define-inverse
+{ $values { "word" "a word" } { "quot" "the inverse" } }
+{ $description "Defines the inverse of a given word, taking no arguments from the quotation, only the stack." }
+{ $see-also define-pop-inverse } ;
+
+HELP: define-pop-inverse
+{ $values { "word" "a word" } { "n" "number of arguments to be taken from the inverted quotation" } { "quot" "a quotation" } }
+{ $description "Defines the inverse of the given word, taking the given number of arguments from the inverted quotation. The quotation given should generate an inverse quotation." }
+{ $see-also define-inverse } ;
+
+HELP: matches?
+{ $values { "quot" "a quotation" } { "?" "a boolean" } }
+{ $description "Tests if the stack can match the given quotation. The quotation is inverted, and if the inverse can run without a unification failure, then t is returned. Else f is returned. If a different error is encountered (such as stack underflow), this will be propagated." } ;
+
+HELP: which
+{ $values { "quot-alist" "an alist from inverse quots to quots" } }
+{ $description "The equivalent of a case expression in a programming language with buitlin pattern matchining. It attempts to match the stack with each of the patterns, in order, by treating them as inverse quotations. Failure causes the next pattern to be tested." }
+{ $code
+"TUPLE: cons car cdr ;"
+"C: <cons> cons"
+": sum ( list -- sum )"
+"    {"
+"        { [ <cons> ] [ sum + ] }"
+"        { [ f ] [ 0 ] }"
+"    } which ;" }
+{ $see-also undo } ;
+
+ARTICLE: { "inverse" "intro" } "Invertible quotations"
+"The inverse vocab defines a way to 'undo' quotations, and builds a pattern matching framework on that basis. A quotation can be inverted by reversing it and inverting each word. To define the inverse for particular word, use"
+{ $subsection define-inverse }
+{ $subsection define-pop-inverse }
+"To build an inverse quotation"
+{ $subsection [undo] }
+"To use the inverse quotation for pattern matching"
+{ $subsection undo }
+{ $subsection matches? }
+{ $subsection which } ;
+
+IN: inverse
+ABOUT: { "inverse" "intro" }
diff --git a/extra/inverse/inverse-tests.factor b/extra/inverse/inverse-tests.factor
new file mode 100644 (file)
index 0000000..176be09
--- /dev/null
@@ -0,0 +1,59 @@
+USING: inverse tools.test arrays math kernel sequences ;
+
+[ 2 ] [ { 3 2 } [ 3 swap 2array ] undo ] unit-test
+[ { 3 4 } [ dup 2array ] undo ] unit-test-fails
+
+TUPLE: foo bar baz ;
+
+C: <foo> foo
+
+[ 1 2 ] [ 1 2 <foo> [ <foo> ] undo ] unit-test
+
+: 2same ( x -- {x,x} ) dup 2array ;
+
+[ t ] [ { 3 3 } [ 2same ] matches? ] unit-test
+[ f ] [ { 3 4 } [ 2same ] matches? ] unit-test
+[ [ 2same ] matches? ] unit-test-fails
+
+: something ( array -- num )
+    {
+        { [ dup 1+ 2array ] [ 3 * ] }
+        { [ 3array ] [ + + ] }
+    } which ;
+
+[ 5 ] [ { 1 2 2 } something ] unit-test
+[ 6 ] [ { 2 3 } something ] unit-test
+[ { 1 } something ] unit-test-fails
+
+[ 1 2 [ eq? ] undo ] unit-test-fails
+
+: f>c ( *fahrenheit -- *celsius )
+    32 - 1.8 / ;
+
+[ { 212 32 } ] [ { 100 0 } [ [ f>c ] map ] undo ] unit-test
+[ { t t f } ] [ { t f 1 } [ [ >boolean ] matches? ] map ] unit-test
+[ { t f } ] [ { { 1 2 3 } 4 } [ [ >array ] matches? ] map ] unit-test
+[ 9 9 ] [ 3 [ 1/2 ^ ] undo 3 [ sqrt ] undo ] unit-test
+
+TUPLE: cons car cdr ;
+
+C: <cons> cons
+
+TUPLE: nil ;
+
+C: <nil> nil
+
+: list-sum ( list -- sum )
+    {
+        { [ <cons> ] [ list-sum + ] }
+        { [ <nil> ] [ 0 ] }
+        { [ ] [ "Malformed list" throw ] }
+    } which ;
+
+[ 10 ] [ 1 2 3 4 <nil> <cons> <cons> <cons> <cons> list-sum ] unit-test
+
+: empty-cons ( -- cons ) cons construct-empty ;
+: cons* ( cdr car -- cons ) { set-cons-cdr set-cons-car } cons construct ;
+
+[ ] [ T{ cons f f f } [ empty-cons ] undo ] unit-test
+[ 1 2 ] [ 2 1 <cons> [ cons* ] undo ] unit-test
diff --git a/extra/inverse/inverse.factor b/extra/inverse/inverse.factor
new file mode 100644 (file)
index 0000000..5d0981f
--- /dev/null
@@ -0,0 +1,216 @@
+USING: kernel words inspector slots quotations sequences assocs
+math arrays inference effects shuffle continuations debugger
+tuples namespaces vectors bit-arrays byte-arrays strings sbufs
+math.functions macros ;
+IN: inverse
+
+: (repeat) ( from to quot -- )
+    pick pick >= [
+        3drop
+    ] [
+        [ swap >r call 1+ r> ] keep (repeat)
+    ] if ; inline
+
+: repeat ( n quot -- ) 0 -rot (repeat) ; inline
+
+TUPLE: fail ;
+: fail ( -- * ) \ fail construct-empty throw ;
+M: fail summary drop "Unification failed" ;
+
+: assure ( ? -- ) [ fail ] unless ;
+
+: =/fail ( obj1 obj2 -- )
+    = assure ;
+
+! Inverse of a quotation
+
+: define-inverse ( word quot -- ) "inverse" set-word-prop ;
+
+DEFER: [undo]
+
+: make-inverse ( word -- quot )
+    word-def [undo] ;
+
+TUPLE: no-inverse word ;
+: no-inverse ( word -- * ) \ no-inverse construct-empty throw ;
+M: no-inverse summary
+    drop "The word cannot be used in pattern matching" ;
+
+GENERIC: inverse ( word -- quot )
+
+M: word inverse
+    dup "inverse" word-prop [ ]
+    [ dup primitive? [ no-inverse ] [ make-inverse ] if ] ?if ;
+
+: undo-literal ( object -- quot )
+    [ =/fail ] curry ;
+
+M: object inverse undo-literal ;
+M: symbol inverse undo-literal ;
+
+: ?word-prop ( word/object name -- value/f )
+    over word? [ word-prop ] [ 2drop f ] if ;
+
+: group-pops ( seq -- matrix )
+    [
+        dup length [
+            2dup swap nth dup "pop-length" ?word-prop
+            [ 1+ dupd + tuck >r pick r> swap subseq , 1- ]
+            [ 1quotation , ] ?if
+        ] repeat drop
+    ] [ ] make ;
+
+: inverse-pop ( quot -- inverse )
+    unclip >r reverse r> "pop-inverse" word-prop call ;
+
+: firstn ( n -- quot )
+    { [ drop ] [ first ] [ first2 ] [ first3 ] [ first4 ] } nth ;
+
+: define-pop-inverse ( word n quot -- )
+    -rot 2dup "pop-length" set-word-prop
+    firstn rot append "pop-inverse" set-word-prop ;
+
+: [undo] ( quot -- undo )
+    reverse group-pops [
+        dup length 1 = [ first inverse ] [ inverse-pop ] if
+    ] map concat [ ] like ;
+
+MACRO: undo ( quot -- ) [undo] ;
+
+! Inversions of selected words
+
+\ swap [ swap ] define-inverse
+\ dup [ [ =/fail ] keep ] define-inverse
+\ 2dup [ over =/fail over =/fail ] define-inverse
+\ 3dup [ pick =/fail pick =/fail pick =/fail ] define-inverse
+\ pick [ >r pick r> =/fail ] define-inverse
+\ tuck [ swapd [ =/fail ] keep ] define-inverse
+
+\ >r [ r> ] define-inverse
+\ r> [ >r ] define-inverse
+
+\ tuple>array [ >tuple ] define-inverse
+\ >tuple [ tuple>array ] define-inverse
+\ reverse [ reverse ] define-inverse
+
+\ undo 1 [ [ call ] curry ] define-pop-inverse
+\ map 1 [ [undo] [ over sequence? assure map ] curry ] define-pop-inverse
+
+\ neg [ neg ] define-inverse
+\ recip [ recip ] define-inverse
+\ exp [ log ] define-inverse
+\ log [ exp ] define-inverse
+\ not [ not ] define-inverse
+\ sq [ sqrt ] define-inverse
+\ sqrt [ sq ] define-inverse
+
+: assert-literal ( n -- n )
+    dup [ word? ] keep symbol? not and
+    [ "Literal missing in pattern matching" throw ] when ;
+\ + 1 [ assert-literal [ - ] curry ] define-pop-inverse
+\ - 1 [ assert-literal [ + ] curry ] define-pop-inverse
+\ * 1 [ assert-literal [ / ] curry ] define-pop-inverse
+\ / 1 [ assert-literal [ * ] curry ] define-pop-inverse
+\ ^ 1 [ assert-literal recip [ ^ ] curry ] define-pop-inverse
+
+\ ? 2 [
+    [ assert-literal ] 2apply
+    [ swap >r over = r> swap [ 2drop f ] [ = [ t ] [ fail ] if ] if ]
+    2curry
+] define-pop-inverse
+
+: _ f ;
+\ _ [ drop ] define-inverse
+
+: both ( object object -- object )
+    dupd assert= ;
+\ both [ dup ] define-inverse
+
+: assure-length ( seq length -- seq )
+    over length =/fail ;
+
+{
+    { >array array? }
+    { >vector vector? }
+    { >fixnum fixnum? }
+    { >bignum bignum? }
+    { >bit-array bit-array? }
+    { >float float? }
+    { >byte-array byte-array? }
+    { >string string? }
+    { >sbuf sbuf? }
+    { >quotation quotation? }
+} [ \ dup swap \ assure 3array >quotation define-inverse ] assoc-each
+
+! These actually work on all seqs--should they?
+\ 1array [ 1 assure-length first ] define-inverse
+\ 2array [ 2 assure-length first2 ] define-inverse
+\ 3array [ 3 assure-length first3 ] define-inverse
+\ 4array [ 4 assure-length first4 ] define-inverse
+
+\ first [ 1array ] define-inverse
+\ first2 [ 2array ] define-inverse
+\ first3 [ 3array ] define-inverse
+\ first4 [ 4array ] define-inverse
+
+! Constructor inverse
+: deconstruct-pred ( class -- quot )
+    "predicate" word-prop [ dupd call assure ] curry ;
+
+: slot-readers ( class -- quot )
+    "slots" word-prop 1 tail ! tail gets rid of delegate
+    [ slot-spec-reader 1quotation [ keep ] curry ] map concat
+    [ drop ] append ;
+
+: ?wrapped ( object -- wrapped )
+    dup wrapper? [ wrapped ] when ;
+
+: boa-inverse ( class -- quot )
+    [ deconstruct-pred ] keep slot-readers append ;
+
+\ construct-boa 1 [ ?wrapped boa-inverse ] define-pop-inverse
+
+: empty-inverse ( class -- quot )
+    deconstruct-pred
+    [ tuple>array 1 tail [ ] contains? [ fail ] when ]
+    compose ;
+
+\ construct-empty 1 [ ?wrapped empty-inverse ] define-pop-inverse
+
+: writer>reader ( word -- word' )
+    [ "writing" word-prop "slots" word-prop ] keep
+    [ swap slot-spec-writer = ] curry find nip slot-spec-reader ;
+
+: construct-inverse ( class setters -- quot )
+    >r deconstruct-pred r>
+    [ writer>reader ] map [ get-slots ] curry
+    compose ;
+
+\ construct 2 [ ?wrapped swap construct-inverse ] define-pop-inverse
+
+! More useful inverse-based combinators
+
+: recover-fail ( try fail -- )
+    [ drop call ] [
+        >r nip r> dup fail?
+        [ drop call ] [ nip throw ] if
+    ] recover ; inline
+
+: infer-out ( quot -- #out )
+    infer effect-out ;
+
+MACRO: matches? ( quot -- ? )
+    [undo] [ t ] append
+    [ [ [ f ] recover-fail ] curry ] keep
+    infer-out 1- [ nnip ] curry append ;
+
+TUPLE: no-match ;
+: no-match ( -- * ) \ no-match construct-empty throw ;
+M: no-match summary drop "Fall through in which" ;
+
+: recover-chain ( seq -- quot )
+    [ no-match ] [ swap \ recover-fail 3array >quotation ] reduce ;
+
+MACRO: which ( quot-alist -- )
+    reverse [ >r [undo] r> append ] { } assoc>map
+    recover-chain ;
diff --git a/extra/inverse/tags.txt b/extra/inverse/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/io/launcher/authors.txt b/extra/io/launcher/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/io/launcher/launcher.factor b/extra/io/launcher/launcher.factor
new file mode 100644 (file)
index 0000000..cb951de
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io.backend system ;
+IN: io.launcher
+
+HOOK: run-process io-backend ( string -- )
+
+HOOK: run-detached io-backend ( string -- )
+
+HOOK: <process-stream> io-backend ( string -- stream )
+
+USE-IF: unix? io.unix.launcher
+USE-IF: windows? io.windows.launcher
diff --git a/extra/io/launcher/summary.txt b/extra/io/launcher/summary.txt
new file mode 100644 (file)
index 0000000..1044a84
--- /dev/null
@@ -0,0 +1 @@
+Support for launching OS processes
diff --git a/extra/io/mmap/mmap-tests.factor b/extra/io/mmap/mmap-tests.factor
new file mode 100644 (file)
index 0000000..b35efac
--- /dev/null
@@ -0,0 +1,10 @@
+USING: io io.mmap kernel tools.test ;
+IN: temporary
+
+[ "mmap-test-file.txt" resource-path delete-file ] catch drop
+[ ] [ "mmap-test-file.txt" resource-path <file-writer> [ "12345" write ] with-stream ] unit-test
+[ ] [ "mmap-test-file.txt" resource-path dup file-length [ CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
+[ 5 ] [ "mmap-test-file.txt" resource-path dup file-length [ length ] with-mapped-file ] unit-test
+[ "22345" ] [ "mmap-test-file.txt" resource-path <file-reader> contents ] unit-test
+[ "mmap-test-file.txt" resource-path delete-file ] catch drop
+
diff --git a/extra/io/mmap/mmap.factor b/extra/io/mmap/mmap.factor
new file mode 100644 (file)
index 0000000..f9ccd61
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: continuations io.backend kernel quotations sequences
+system alien sequences.private ;
+IN: io.mmap
+
+TUPLE: mapped-file length address handle ;
+
+M: mapped-file length mapped-file-length ;
+
+M: mapped-file nth-unsafe
+    mapped-file-address swap alien-unsigned-1 ;
+
+M: mapped-file set-nth-unsafe
+    mapped-file-address swap set-alien-unsigned-1 ;
+
+INSTANCE: mapped-file sequence
+
+HOOK: <mapped-file> io-backend ( path length -- mmap )
+HOOK: close-mapped-file io-backend ( mmap -- )
+
+: with-mapped-file ( path length quot -- )
+    >r <mapped-file> r>
+    [ keep ] curry
+    [ close-mapped-file ] [ ] cleanup ; inline
+
+USE-IF: unix? io.unix.mmap
+USE-IF: windows? io.windows.mmap
diff --git a/extra/io/nonblocking/authors.txt b/extra/io/nonblocking/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/io/nonblocking/nonblocking-docs.factor b/extra/io/nonblocking/nonblocking-docs.factor
new file mode 100644 (file)
index 0000000..049c3bf
--- /dev/null
@@ -0,0 +1,107 @@
+USING: io io.buffers io.backend help.markup help.syntax kernel
+strings sbufs ;
+IN: io.nonblocking
+
+ARTICLE: "io.nonblocking" "Non-blocking I/O implementation"
+"On Windows and Unix, Factor implements blocking file and network streams on top of a non-blocking I/O substrate, ensuring that Factor threads will yield when performing I/O. This substrate is implemented in the " { $vocab-link "io.nonblocking" } " vocabulary."
+$nl
+"A " { $emphasis "port" } " is a stream using non-blocking I/O substrate:"
+{ $subsection port }
+{ $subsection <port> }
+{ $subsection <buffered-port> }
+"Input ports:"
+{ $subsection input-port }
+{ $subsection <reader> }
+"Output ports:"
+{ $subsection output-port }
+{ $subsection <writer> }
+"Global native I/O protocol:"
+{ $subsection io-backend }
+{ $subsection init-io }
+{ $subsection init-stdio }
+{ $subsection io-multiplex }
+"Per-port native I/O protocol:"
+{ $subsection init-handle }
+{ $subsection (wait-to-read) }
+"Additionally, the I/O backend must provide an implementation of the " { $link stream-flush } " and " { $link stream-close } " generic words."
+$nl
+"Dummy ports which should be used to implement networking:"
+{ $subsection server-port }
+{ $subsection datagram-port } ;
+
+ABOUT: "io.nonblocking"
+
+HELP: port
+{ $class-description "Instances of this class present a blocking stream interface on top of an underlying non-blocking I/O system, giving the illusion of blocking by yielding the thread which is waiting for input or output."
+$nl
+"Ports have the following slots:"
+{ $list
+    { { $link port-handle } " - a native handle identifying the underlying native resource used by the port" }
+    { { $link port-error } " - the most recent I/O error, if any. This error is thrown to the waiting thread when " { $link pending-error } " is called by stream operations" }
+    { { $link port-timeout } " - a timeout, specifying the maximum length of time, in milliseconds, for which input operations can block before throwing an error. A value of 0 denotes no timeout is desired." }
+    { { $link port-cutoff } " - the time when the current timeout expires; if no input data arrives before this time, an error is thrown" }
+    { { $link port-type } " - a symbol identifying the port's intended purpose. Can be " { $link input } ", " { $link output } ", " { $link closed } ", or any other symbol" }
+    { { $link port-eof? } " - a flag indicating if the port has reached the end of file while reading" }
+} } ;
+
+HELP: input-port
+{ $class-description "The class of ports implementing the input stream protocol." } ;
+
+HELP: output-port
+{ $class-description "The class of ports implementing the output stream protocol." } ;
+
+HELP: init-handle
+{ $values { "handle" "a native handle identifying an I/O resource" } }
+{ $contract "Prepares a native handle for use by the port; called by " { $link <port> } "." } ;
+
+HELP: <port>
+{ $values { "handle" "a native handle identifying an I/O resource" } { "buffer" "a " { $link buffer } " or " { $link f } } { "port" "a new " { $link port } } }
+{ $description "Creates a new " { $link port } " using the specified native handle and I/O buffer." }
+$low-level-note ;
+
+HELP: <buffered-port>
+{ $values { "handle" "a native handle identifying an I/O resource" } { "port" "a new " { $link port } } }
+{ $description "Creates a new " { $link port } " using the specified native handle and a default-sized I/O buffer." } 
+$low-level-note ;
+
+HELP: <reader>
+{ $values { "handle" "a native handle identifying an I/O resource" } { "stream" "a new " { $link input-port } } }
+{ $description "Creates a new " { $link input-port } " using the specified native handle and a default-sized input buffer." } 
+$low-level-note ;
+
+HELP: <writer>
+{ $values { "handle" "a native handle identifying an I/O resource" } { "stream" "a new " { $link output-port } } }
+{ $description "Creates a new " { $link output-port } " using the specified native handle and a default-sized input buffer." } 
+$low-level-note ;
+
+HELP: pending-error
+{ $values { "port" port } }
+{ $description "If an error occurred while the I/O thread was performing input or output on this port, this error will be thrown to the caller." } ;
+
+HELP: (wait-to-read)
+{ $values { "port" input-port } }
+{ $contract "Suspends the current thread until the port's buffer has data available for reading." } ;
+
+HELP: wait-to-read
+{ $values { "count" "a non-negative integer" } { "port" input-port } }
+{ $description "If the port's buffer has at least " { $snippet "count" } " unread bytes, returns immediately, otherwise suspends the current thread until some data is available for reading." } ;
+
+HELP: wait-to-read1
+{ $values { "port" input-port } }
+{ $description "If the port's buffer has unread data, returns immediately, otherwise suspends the current thread until some data is available for reading." } ;
+
+HELP: unless-eof
+{ $values { "port" input-port } { "quot" "a quotation with stack effect " { $snippet "( port -- value )" } } { "value" object } }
+{ $description "If the port has reached end of file, outputs " { $link f } ", otherwise applies the quotation to the port." } ;
+
+HELP: read-until-step
+{ $values { "separators" string } { "port" input-port } { "string/f" "a string or " { $link f } } { "separator/f" "a character or " { $link f } } }
+{ $description "If the port has reached end of file, outputs " { $link f } { $link f } ", otherwise scans the buffer for a separator and outputs a string up to but not including the separator." } ;
+
+HELP: read-until-loop
+{ $values { "seps" string } { "port" input-port } { "sbuf" sbuf } { "separator/f" "a character or " { $link f } } }
+{ $description "Accumulates data in the string buffer, calling " { $link (wait-to-read) } " as many times as necessary, until either an occurrence of a separator is read, or end of file is reached." } ;
+
+HELP: can-write?
+{ $values { "len" "a positive integer" } { "writer" output-port } { "?" "a boolean" } }
+{ $description "Tests if the port's output buffer can accomodate " { $snippet "len" } " bytes. If the buffer is empty, this always outputs " { $link t } ", since in that case the buffer will be grown automatically." } ;
diff --git a/extra/io/nonblocking/nonblocking.factor b/extra/io/nonblocking/nonblocking.factor
new file mode 100644 (file)
index 0000000..6741732
--- /dev/null
@@ -0,0 +1,176 @@
+! Copyright (C) 2007 Slava Pestov, Doug Coleman
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.nonblocking
+USING: math kernel io sequences io.buffers generic sbufs
+system io.streams.lines io.streams.plain io.streams.duplex
+continuations debugger classes byte-arrays ;
+
+: default-buffer-size 64 1024 * ; inline
+
+! Common delegate of native stream readers and writers
+TUPLE: port handle error timeout cutoff type eof? ;
+
+SYMBOL: input
+SYMBOL: output
+SYMBOL: closed
+
+PREDICATE: port input-port port-type input eq? ;
+PREDICATE: port output-port port-type output eq? ;
+
+GENERIC: init-handle ( handle -- )
+
+: <port> ( handle buffer -- port )
+    over init-handle
+    0 0 {
+        set-port-handle
+        set-delegate
+        set-port-timeout
+        set-port-cutoff
+    } port construct ;
+
+: <buffered-port> ( handle -- port )
+    default-buffer-size <buffer> <port> ;
+
+: <reader> ( handle -- stream )
+    <buffered-port> input over set-port-type <line-reader> ;
+
+: <writer> ( handle -- stream )
+    <buffered-port> output over set-port-type <plain-writer> ;
+
+: handle>duplex-stream ( in-handle out-handle -- stream )
+    <writer>
+    [ >r <reader> r> <duplex-stream> ]
+    [ ] [ stream-close ]
+    cleanup ;
+
+: touch-port ( port -- )
+    dup port-timeout dup zero?
+    [ 2drop ] [ millis + swap set-port-cutoff ] if ;
+
+: timeout? ( port -- ? )
+    port-cutoff dup zero? not swap millis < and ;
+
+: pending-error ( port -- )
+    dup port-error f rot set-port-error [ throw ] when* ;
+
+M: port set-timeout
+    [ set-port-timeout ] keep touch-port ;
+
+GENERIC: (wait-to-read) ( port -- )
+
+: wait-to-read ( count port -- )
+    tuck buffer-length > [ (wait-to-read) ] [ drop ] if ;
+
+: wait-to-read1 ( port -- )
+    1 swap wait-to-read ;
+
+: unless-eof ( port quot -- value )
+    >r dup buffer-empty? over port-eof? and
+    [ f swap set-port-eof? f ] r> if ; inline
+
+M: input-port stream-read1
+    dup wait-to-read1 [ buffer-pop ] unless-eof ;
+
+: read-step ( count port -- string/f )
+    [ wait-to-read ] 2keep
+    [ dupd buffer> ] unless-eof nip ;
+
+: read-loop ( count port sbuf -- )
+    pick over length - dup 0 > [
+        pick read-step dup [
+            over push-all read-loop
+        ] [
+            2drop 2drop
+        ] if
+    ] [
+        2drop 2drop
+    ] if ;
+
+M: input-port stream-read
+    >r 0 max >fixnum r>
+    2dup read-step dup [
+        pick over length > [
+            pick <sbuf>
+            [ push-all ] keep
+            [ read-loop ] keep
+            "" like
+        ] [
+            2nip
+        ] if
+    ] [
+        2nip
+    ] if ;
+
+: read-until-step ( separators port -- string/f separator/f )
+    dup wait-to-read1
+    dup port-eof? [
+        f swap set-port-eof? drop f f
+    ] [
+        buffer-until
+    ] if ;
+
+: read-until-loop ( seps port sbuf -- separator/f )
+    pick pick read-until-step over [
+        >r over push-all r> dup [
+            >r 3drop r>
+        ] [
+            drop read-until-loop
+        ] if
+    ] [
+        >r 2drop 2drop r>
+    ] if ;
+
+M: input-port stream-read-until ( seps port -- str/f sep/f )
+    2dup read-until-step dup [
+        >r 2nip r>
+    ] [
+        over [
+            drop >sbuf [ read-until-loop ] keep "" like swap
+        ] [
+            >r 2nip r>
+        ] if
+    ] if ;
+
+M: input-port stream-read-partial ( max stream -- string/f )
+    >r 0 max >fixnum r> read-step ;
+
+: can-write? ( len writer -- ? )
+    dup buffer-empty? [
+        2drop t
+    ] [
+        [ buffer-fill + ] keep buffer-capacity <=
+    ] if ;
+
+: wait-to-write ( len port -- )
+    tuck can-write? [ drop ] [ stream-flush ] if ;
+
+M: output-port stream-write1
+    1 over wait-to-write ch>buffer ;
+
+M: output-port stream-write
+    over length over wait-to-write >buffer ;
+
+TUPLE: server-port addr client ;
+
+: <server-port> ( port addr -- server )
+    server-port pick set-port-type
+    { set-delegate set-server-port-addr }
+    server-port construct ;
+
+: check-server-port ( port -- )
+    port-type server-port assert= ;
+
+TUPLE: datagram-port addr packet packet-addr ;
+
+: <datagram-port> ( port addr -- datagram )
+    datagram-port pick set-port-type
+    { set-delegate set-datagram-port-addr }
+    datagram-port construct ;
+
+: check-datagram-port ( port -- )
+    port-type datagram-port assert= ;
+
+: check-datagram-send ( packet addrspec port -- )
+    dup check-datagram-port
+    datagram-port-addr [ class ] 2apply assert=
+    class byte-array assert= ;
diff --git a/extra/io/nonblocking/summary.txt b/extra/io/nonblocking/summary.txt
new file mode 100644 (file)
index 0000000..d5722db
--- /dev/null
@@ -0,0 +1 @@
+Low-level implementation support for native I/O
diff --git a/extra/io/server/server-docs.factor b/extra/io/server/server-docs.factor
new file mode 100644 (file)
index 0000000..ea8320f
--- /dev/null
@@ -0,0 +1,37 @@
+USING: help help.syntax help.markup io ;
+IN: io.server
+
+HELP: log-stream
+{ $var-description "Holds an output stream for logging messages." }
+{ $see-also log-error log-client with-logging } ;
+
+HELP: log-message
+{ $values { "str" "a string" } }
+{ $description "Logs a message to the log stream. If " { $link log-stream } " is not set, logs to the " { $link stdio } " stream." }
+{ $see-also log-error log-client } ;
+
+HELP: log-error
+{ $values { "str" "a string" } }
+{ $description "Logs an error message." }
+{ $see-also log-message log-client } ;
+
+HELP: log-client
+{ $values { "client" "a client socket stream" } }
+{ $description "Logs an incoming client connection." }
+{ $see-also log-message log-error } ;
+
+HELP: with-logging
+{ $values { "service" "a string or " { $link f } } { "quot" "a quotation" } }
+{ $description "Calls the quotation in a new dynamic scope where the " { $link log-stream } " is set to a file stream appending to a log file (if " { $snippet "service" } " is not " { $link f } ") or the " { $link stdio } " stream at the time " { $link with-logging } " is called (if " { $snippet "service" } " is " { $link f } ")." } ;
+
+HELP: with-client
+{ $values { "quot" "a quotation" } { "client" "a client socket stream" } }
+{ $description "Logs a client connection and spawns a new thread that calls the quotation, with the " { $link stdio } " stream set to the client stream. If the quotation throws an error, the client connection is closed, and the error is printed to the " { $link stdio } " stream at the time the thread was spawned." } ;
+
+HELP: with-server
+{ $values { "seq" "a sequence of address specifiers" } { "service" "a string or " { $link f } } { "quot" "a quotation" } }
+{ $description "Starts a TCP/IP server. The quotation is called in a new thread for each client connection, with the client connection being the " { $link stdio } " stream. Client connections are logged to the " { $link stdio } " stream at the time the server was started." } ;
+
+HELP: with-datagrams
+{ $values { "seq" "a sequence of address specifiers" } { "service" "a string or " { $link f } } { "quot" "a quotation" } }
+{ $description "Starts a UDP/IP server. The quotation is called for each datagram packet received. Datagram packets are logged to the " { $link stdio } " stream at the time the server was started." } ;
diff --git a/extra/io/server/server.factor b/extra/io/server/server.factor
new file mode 100644 (file)
index 0000000..6b42d1d
--- /dev/null
@@ -0,0 +1,94 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io io.sockets io.files continuations kernel math
+math.parser namespaces parser sequences strings
+prettyprint debugger quotations calendar qualified ;
+QUALIFIED: concurrency
+
+IN: io.server
+
+SYMBOL: log-stream
+
+: log-message ( str -- )
+    log-stream get [
+        "[" write now timestamp>string write "] " write
+        print flush
+    ] with-stream* ;
+
+: log-error ( str -- ) "Error: " swap append log-message ;
+
+: log-client ( client -- )
+    "Accepted connection from "
+    swap client-stream-addr unparse append log-message ;
+
+: log-file ( service -- path )
+    ".log" append resource-path ;
+
+: with-log-stream ( stream quot -- )
+    log-stream swap with-variable ; inline
+
+: with-log-file ( file quot -- )
+    >r <file-appender> r>
+    [ [ with-log-stream ] 2keep ]
+    [ drop stream-close ] [ ] cleanup ; inline
+
+: with-log-stdio ( quot -- )
+    stdio get swap with-log-stream ;
+
+: with-logging ( service quot -- )
+    over [
+        >r log-file
+        "Writing log messages to " write dup print flush r>
+        with-log-file
+    ] [
+        nip with-log-stdio
+    ] if ; inline
+
+: with-client ( quot client -- )
+    dup log-client
+    [ swap with-stream ] 2curry concurrency:spawn drop ; inline
+
+: accept-loop ( server quot -- )
+    [ swap accept with-client ] 2keep accept-loop ; inline
+
+: server-loop ( server quot -- )
+    [ accept-loop ] [ drop stream-close ] [ ] cleanup ; inline
+
+: spawn-server ( addrspec quot -- )
+    "Waiting for connections on " pick unparse append
+    log-message
+    [
+        >r <server> r> server-loop
+    ] [
+        "Cannot spawn server: " print
+        print-error
+    ] recover ; inline
+
+: local-server ( port -- seq )
+    "localhost" swap t resolve-host ;
+
+: internet-server ( port -- seq )
+    f swap t resolve-host ;
+
+: with-server ( seq service quot -- )
+    [
+        [ spawn-server ] curry concurrency:parallel-each
+    ] curry with-logging ; inline
+
+: log-datagram ( addrspec -- )
+    "Received datagram from " swap unparse append log-message ;
+
+: datagram-loop ( quot datagram -- )
+    [
+        [ receive dup log-datagram >r swap call r> ] keep send
+    ] 2keep datagram-loop ; inline
+
+: spawn-datagrams ( quot addrspec -- )
+    "Waiting for datagrams on " over unparse append log-message
+    <datagram> [ datagram-loop ] [ stream-close ] [ ] cleanup ;
+    inline
+
+: with-datagrams ( seq service quot -- )
+    [
+        [ swap spawn-datagrams ] curry concurrency:parallel-each
+    ] with-logging ; inline
diff --git a/extra/io/sniffer/bsd/bsd.factor b/extra/io/sniffer/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..71e71ce
--- /dev/null
@@ -0,0 +1,87 @@
+! Copyright (C) 2007 Elie Chaftari, Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.syntax destructors hexdump io
+io.buffers io.nonblocking io.sniffer io.sockets io.streams.lines
+io.unix.backend io.unix.files kernel libc locals math qualified
+sequences ;
+QUALIFIED: unix
+IN: io.sniffer.bsd
+
+C-UNION: ifreq_props "sockaddr-in" "short" "int" "caddr_t" ;
+C-STRUCT: ifreq { { "char" 16 } "name" } { "ifreq_props" "props" } ;
+
+TUPLE: sniffer-spec path ifname ;
+
+C: <sniffer-spec> sniffer-spec
+
+: IOCPARM_MASK   HEX: 1fff ; inline
+: IOCPARM_MAX    IOCPARM_MASK 1 + ; inline
+: IOC_VOID       HEX: 20000000 ; inline
+: IOC_OUT        HEX: 40000000 ; inline
+: IOC_IN         HEX: 80000000 ; inline
+: IOC_INOUT      IOC_IN IOC_OUT bitor ; inline
+: IOC_DIRMASK    HEX: e0000000 ; inline
+
+:: ioc | inout group num len |
+    group first 8 shift num bitor
+    len IOCPARM_MASK bitand 16 shift bitor
+    inout bitor ;
+
+: io-len ( type -- n )
+    dup zero? [ heap-size ] unless ;
+
+: io ( group num -- n )
+    IOC_VOID -rot 0 io-len ioc ;
+
+: ior ( group num type -- n )
+    IOC_OUT -roll io-len ioc ;
+
+: iow ( group num type -- n )
+    IOC_IN -roll io-len ioc ;
+
+: iowr ( group num type -- n )
+    IOC_INOUT -roll io-len ioc ;
+
+: BIOCGBLEN ( -- n ) "B" 102 "uint" ior ; inline
+: BIOCSETIF ( -- n ) "B" 108 "ifreq" iow ; inline
+: BIOCPROMISC ( -- n ) "B" 105 io ; inline 
+: BIOCIMMEDIATE ( -- n ) "B" 112 "uint" iow ; inline
+
+: make-ifreq-props ( ifname -- ifreq )
+    "ifreq" <c-object>
+    12 <short> 16 0 pad-right over set-ifreq-props
+    swap malloc-char-string dup [ free ] t add-destructor
+    over set-ifreq-name ;
+
+: make-ioctl-buffer ( fd -- buffer )
+    BIOCGBLEN "char*" <c-object>
+    [ unix:ioctl io-error ] keep
+    *int <buffer> ;
+
+: ioctl-BIOSETIF ( fd ifreq -- )
+    >r BIOCSETIF r> unix:ioctl io-error ;
+
+: ioctl-BIOPROMISC ( fd -- )
+    BIOCPROMISC f unix:ioctl io-error ;
+
+: ioctl-BIOCIMMEDIATE
+    BIOCIMMEDIATE 1 <int> unix:ioctl io-error ;
+
+: ioctl-sniffer-fd ( fd ifname -- )
+    dupd make-ifreq-props ioctl-BIOSETIF
+    dup ioctl-BIOPROMISC
+    ioctl-BIOCIMMEDIATE ;
+
+M: unix-io <sniffer> ( obj -- sniffer )
+    [
+        [
+            sniffer-spec-path
+            open-read
+            dup [ unix:close ] f add-destructor
+        ] keep
+        dupd sniffer-spec-ifname ioctl-sniffer-fd
+        dup make-ioctl-buffer
+        <port> input over set-port-type <line-reader>
+        \ sniffer construct-delegate
+    ] with-destructors ;
+
diff --git a/extra/io/sniffer/filter/bsd/bsd.factor b/extra/io/sniffer/filter/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..c986a09
--- /dev/null
@@ -0,0 +1,32 @@
+USING: alien.c-types hexdump io io.backend io.sockets.headers
+io.sockets.headers.bsd kernel io.sniffer io.sniffer.bsd
+io.sniffer.filter io.streams.string io.unix.backend math
+sequences system ;
+IN: io.sniffer.filter.bsd
+
+! http://www.iana.org/assignments/ethernet-numbers
+
+: bpf-align ( n -- n' )
+    #! Align to next higher word size
+    "long" heap-size 1- [ + ] keep bitnot bitand ;
+
+M: unix-io packet. ( string -- )
+    18 swap cut swap >byte-array bpfh.
+    (packet.) ;
+
+M: unix-io sniffer-loop ( stream -- )
+    nl nl
+    4096 over stream-read-partial
+        dup hexdump.
+    packet.
+    sniffer-loop ;
+
+
+! Mac 
+: sniff-wired ( -- )
+    "/dev/bpf0" "en0" <sniffer-spec> <sniffer> sniffer-loop ;
+
+! Macbook
+: sniff-wireless ( -- )
+    "/dev/bpf0" "en1" <sniffer-spec> <sniffer> sniffer-loop ;
+
diff --git a/extra/io/sniffer/filter/filter.factor b/extra/io/sniffer/filter/filter.factor
new file mode 100644 (file)
index 0000000..9a9a5be
--- /dev/null
@@ -0,0 +1,22 @@
+USING: alien.c-types byte-arrays combinators hexdump io io.backend
+io.streams.string io.sockets.headers kernel math prettyprint
+io.sniffer sequences system ;
+IN: io.sniffer.filter
+
+HOOK: sniffer-loop io-backend ( stream -- )
+HOOK: packet. io-backend ( string -- )
+
+: (packet.) ( string -- )
+    dup 14 head >byte-array
+    "--Ethernet Header--" print
+        dup etherneth.
+    dup etherneth-type {
+        ! HEX: 800 [ ] ! IP
+        ! HEX: 806 [ ] ! ARP
+        [ "Unknown type: " write .h ]
+    } case
+    
+    drop drop ;
+
+USE-IF: bsd? io.sniffer.filter.bsd
+
diff --git a/extra/io/sniffer/sniffer.factor b/extra/io/sniffer/sniffer.factor
new file mode 100644 (file)
index 0000000..69ebc0b
--- /dev/null
@@ -0,0 +1,10 @@
+USING: io.backend kernel system ;
+IN: io.sniffer
+
+SYMBOL: sniffer-type
+
+TUPLE: sniffer ;
+
+HOOK: <sniffer> io-backend ( obj -- sniffer )
+
+USE-IF: bsd? io.sniffer.bsd
diff --git a/extra/io/sockets/authors.txt b/extra/io/sockets/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/io/sockets/headers/bsd/bsd.factor b/extra/io/sockets/headers/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..c67cc95
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.syntax byte-arrays io
+kernel math prettyprint ;
+IN: io.sockets.headers.bsd
+
+C-STRUCT: bpfh
+    { "timeval" "timestamp" }
+    { "ulong" "caplen" }
+    { "ulong" "datalen" }
+    { "ushort" "hdrlen" } ;
+
+: bpfh. ( bpfh -- )
+    [
+        bpfh-timestamp "Timestamp: " write
+        "timeval" heap-size memory>string >byte-array .
+    ] keep
+    [ bpfh-caplen "caplen: " write . ] keep
+    [ bpfh-datalen "datalen: " write . ] keep
+    [ bpfh-hdrlen "hdrlen: " write . ] keep
+    drop ;
+
diff --git a/extra/io/sockets/headers/headers.factor b/extra/io/sockets/headers/headers.factor
new file mode 100644 (file)
index 0000000..3a46f29
--- /dev/null
@@ -0,0 +1,81 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.syntax byte-arrays io
+io.sockets.impl kernel structs math prettyprint ;
+IN: io.sockets.headers
+
+C-STRUCT: etherneth
+    { { "char" 6 } "dmac" }
+    { { "char" 6 } "smac" }
+    { "ushort" "type" } ;
+
+: etherneth. ( etherneth -- )
+    [ etherneth-dmac "Dest   MAC: " write >mac-address . ] keep
+    [ etherneth-smac "Source MAC: " write >mac-address . ] keep
+    [ etherneth-type "Type      : " write .h ] keep
+    drop ;
+
+C-STRUCT: iph
+    { "uchar" "hl|v" } ! hl is 4 bits, v is 4 bits
+    { "uchar" "tos" }
+    { "short" "len" }
+    { "short" "id" }
+    { "short" "off" }
+    { "uchar" "ttl" }
+    { "uchar" "p" }
+    { "ushort" "ip_sum" }
+    { "uint" "ip_src" }
+    { "uint" "ip_dst" } ;
+
+: iph-hl ( iph -- n )
+    iph-hl|v -4 shift ;
+
+: iph-v ( iph -- n )
+    iph-hl|v HEX: 0f bitand ;
+
+: set-iph-hl ( n iph -- )
+    [ iph-hl|v HEX: 0f bitand >r 4 shift r> bitor ] keep
+    set-iph-hl|v ;
+
+: set-iph-v ( n iph -- )
+    [ iph-hl|v HEX: f0 bitand bitor ] keep
+    set-iph-hl|v ;
+
+C-STRUCT: icmph
+    { "uchar" "type" }
+    { "uchar" "code" }
+    { "short" "chksum" }
+    { "ushort" "id" }
+    { "ushort" "seq" } ;
+
+C-STRUCT: udph
+    { "ushort" "sport" }
+    { "ushort" "dport" }
+    { "ushort" "len" }
+    { "ushort" "check" } ;
+
+C-STRUCT: tcph
+    { "ushort" "sport" }
+    { "ushort" "dport" }
+    { "uint" "seq" }
+    { "uint" "ack" }
+    { "uchar" "x2|off" }
+    { "uchar" "flags" }
+    { "ushort" "win" }
+    { "ushort" "sum" }
+    { "ushort" "urp" } ;
+
+: tcph-x2 ( iph -- n )
+    tcph-x2|off -4 shift ;
+
+: tcph-off ( iph -- n )
+    tcph-x2|off HEX: 0f bitand ;
+
+: set-tcph-x2 ( n iph -- )
+    [ tcph-x2|off HEX: 0f bitand >r 4 shift r> bitor ] keep
+    set-tcph-x2|off ;
+
+: set-tcph-off ( n iph -- )
+    [ tcph-x2|off HEX: 0f bitand bitor ] keep
+    set-tcph-x2|off ;
+
diff --git a/extra/io/sockets/impl/impl-tests.factor b/extra/io/sockets/impl/impl-tests.factor
new file mode 100644 (file)
index 0000000..51305db
--- /dev/null
@@ -0,0 +1,45 @@
+USING: io.sockets.impl io.sockets kernel tools.test ;
+IN: temporary
+
+[ B{ 1 2 3 4 } ]
+[ "1.2.3.4" T{ inet4 } inet-pton ] unit-test
+
+[ "1.2.3.4" ]
+[ B{ 1 2 3 4 } T{ inet4 } inet-ntop ] unit-test
+
+[ "255.255.255.255" ]
+[ B{ 255 255 255 255 } T{ inet4 } inet-ntop ] unit-test
+
+[ B{ 255 255 255 255 } ]
+[ "255.255.255.255" T{ inet4 } inet-pton ] unit-test
+
+[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } ]
+[ "1:2:3:4:5:6:7:8" T{ inet6 } inet-pton ] unit-test
+
+[ "1:2:3:4:5:6:7:8" ]
+[ B{ 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 } T{ inet6 } inet-ntop ] unit-test
+
+[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ]
+[ "::" T{ inet6 } inet-pton ] unit-test
+
+[ "0:0:0:0:0:0:0:0" ]
+[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } T{ inet6 } inet-ntop ] unit-test
+
+[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } ]
+[ "1::" T{ inet6 } inet-pton ] unit-test
+
+[ B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } ]
+[ "::1" T{ inet6 } inet-pton ] unit-test
+
+[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 } ]
+[ "1::2" T{ inet6 } inet-pton ] unit-test
+
+[ B{ 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 3 } ]
+[ "1::2:3" T{ inet6 } inet-pton ] unit-test
+
+[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } ]
+[ "1:2::3:4" T{ inet6 } inet-pton ] unit-test
+
+[ "1:2:0:0:0:0:3:4" ]
+[ B{ 0 1 0 2 0 0 0 0 0 0 0 0 0 3 0 4 } T{ inet6 } inet-ntop ] unit-test
+
diff --git a/extra/io/sockets/impl/impl.factor b/extra/io/sockets/impl/impl.factor
new file mode 100644 (file)
index 0000000..e99c8d2
--- /dev/null
@@ -0,0 +1,121 @@
+! Copyright (C) 2007 Doug Coleman, Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays byte-arrays io.backend io.binary io.sockets
+kernel math math.parser sequences splitting system
+alien.c-types combinators namespaces alien ;
+IN: io.sockets.impl
+
+USE-IF: windows? windows.winsock
+USE-IF: unix? unix
+
+GENERIC: protocol-family ( addrspec -- af )
+
+GENERIC: sockaddr-type ( addrspec -- type )
+
+GENERIC: make-sockaddr ( addrspec -- sockaddr type )
+
+GENERIC: parse-sockaddr ( sockaddr addrspec -- newaddrspec )
+
+HOOK: addrinfo-error io-backend ( n -- )
+
+! IPV4 and IPV6
+GENERIC: address-size ( addrspec -- n )
+
+GENERIC: inet-ntop ( data addrspec -- str )
+
+GENERIC: inet-pton ( str addrspec -- data )
+
+
+M: inet4 inet-ntop ( data addrspec -- str )
+    drop 4 memory>string [ number>string ] { } map-as "." join ;
+
+M: inet4 inet-pton ( str addrspec -- data )
+    drop "." split [ string>number ] B{ } map-as ;
+
+M: inet4 address-size drop 4 ;
+
+M: inet4 protocol-family drop PF_INET ;
+
+M: inet4 sockaddr-type drop "sockaddr-in" ;
+
+M: inet4 make-sockaddr ( inet -- sockaddr type )
+    "sockaddr-in" <c-object>
+    AF_INET over set-sockaddr-in-family
+    over inet4-port htons over set-sockaddr-in-port
+    over inet4-host
+    "0.0.0.0" or
+    rot inet-pton *uint over set-sockaddr-in-addr
+    "sockaddr-in" ;
+
+M: inet4 parse-sockaddr
+    >r dup sockaddr-in-addr <uint> r> inet-ntop
+    swap sockaddr-in-port ntohs <inet4> ;
+
+
+M: inet6 inet-ntop ( data addrspec -- str )
+    drop 16 memory>string 2 <groups> [ be> >hex ] map ":" join ;
+
+M: inet6 inet-pton ( str addrspec -- data )
+    drop "::" split1
+    [ [ ":" split [ hex> dup 0 ? ] map ] [ f ] if* ] 2apply
+    2dup [ length ] 2apply + 8 swap - 0 <array> swap 3append
+    [ 2 >be ] map concat >byte-array ;
+
+M: inet6 address-size drop 16 ;
+
+M: inet6 protocol-family drop PF_INET6 ;
+
+M: inet6 sockaddr-type drop "sockaddr-in6" ;
+
+M: inet6 make-sockaddr ( inet -- sockaddr type )
+    "sockaddr-in6" <c-object>
+    AF_INET6 over set-sockaddr-in6-family
+    over inet6-port htons over set-sockaddr-in6-port
+    over inet6-host "::" or
+    rot inet-pton over set-sockaddr-in6-addr
+    "sockaddr-in6" ;
+
+M: inet6 parse-sockaddr
+    >r dup sockaddr-in6-addr r> inet-ntop
+    swap sockaddr-in6-port ntohs <inet6> ;
+
+: addrspec-of-family ( af -- addrspec )
+    {
+        { [ dup AF_INET = ] [ T{ inet4 } ] }
+        { [ dup AF_INET6 = ] [ T{ inet6 } ] }
+        { [ dup AF_UNIX = ] [ T{ local } ] }
+        { [ t ] [ f ] }
+    } cond nip ;
+
+M: f parse-sockaddr nip ;
+
+: addrinfo>addrspec ( addrinfo -- addrspec )
+    dup addrinfo-addr
+    swap addrinfo-family addrspec-of-family
+    parse-sockaddr ;
+
+: addrspec, ( addrinfo -- )
+    [ dup addrinfo>addrspec , addrinfo-next addrspec, ] when* ;
+
+: parse-addrinfo-list ( addrinfo -- seq )
+    [ addrspec, ] { } make [ ] subset ;
+
+M: object resolve-host ( host serv passive? -- seq )
+    >r dup integer? [ number>string ] when
+    "addrinfo" <c-object>
+    r> [ AI_PASSIVE over set-addrinfo-flags ] when
+    PF_UNSPEC over set-addrinfo-family
+    IPPROTO_TCP over set-addrinfo-protocol
+    f <void*> [ getaddrinfo addrinfo-error ] keep *void*
+    [ parse-addrinfo-list ] keep
+    freeaddrinfo ;
+
+M: object host-name ( -- name )
+    256 <byte-array> dup dup length gethostname
+    zero? [ "gethostname failed" throw ] unless
+    alien>char-string ;
+
+: >mac-address ( byte-array -- string )
+    6 memory>string >byte-array
+    [ >hex 2 48 pad-left ] { } map-as ":" join ;
+
diff --git a/extra/io/sockets/sockets-docs.factor b/extra/io/sockets/sockets-docs.factor
new file mode 100644 (file)
index 0000000..a5c623b
--- /dev/null
@@ -0,0 +1,153 @@
+USING: help.markup help.syntax io io.backend threads
+strings byte-arrays ;
+IN: io.sockets
+
+ARTICLE: "network-addressing" "Address specifiers"
+"The networking words are quite general and work with " { $emphasis "address specifiers" } " rather than concrete concepts such as host names. There are four types of address specifiers:"
+{ $subsection local }
+{ $subsection inet }
+{ $subsection inet4 }
+{ $subsection inet6 }
+"While the " { $link inet } " addressing specifier is capable of performing name lookups when passed to " { $link <client> } ", sometimes it is necessary to look up a host name without making a connection:"
+{ $subsection resolve-host } ;
+
+ARTICLE: "network-connection" "Connection-oriented networking"
+"Network connections can be established with this word:"
+{ $subsection <client> }
+"Connection-oriented network servers are implemented by first opening a server socket, then waiting for connections:"
+{ $subsection <server> }
+{ $subsection accept }
+"The stream returned by " { $link accept } " holds the address specifier of the remote client:"
+{ $subsection client-stream-addr }
+"Server sockets are closed by calling " { $link stream-close } ", but they do not respond to the rest of the stream protocol."
+$nl
+"Address specifiers have the following interpretation with connection-oriented networking words:"
+{ $list
+    { { $link local } " - Unix domain stream sockets on Unix systems" }
+    { { $link inet } " - a TCP/IP connection to a host name/port number pair which can resolve to an IPv4 or IPv6 address" }
+    { { $link inet4 } " - a TCP/IP connection to an IPv4 address and port number; no name lookup is performed" }
+    { { $link inet6 } " - a TCP/IP connection to an IPv6 address and port number; no name lookup is performed" }
+}
+"The " { $vocab-link "io.server" } " library defines a nice high-level wrapper around " { $link <server> } " which makes it easy to listen for IPv4 and IPv6 connections simultaneously, perform logging, and optionally only allow connections from the loopback interface." ;
+
+ARTICLE: "network-packet" "Packet-oriented networking"
+"A packet-oriented socket can be opened with this word:"
+{ $subsection <datagram> }
+"Packets can be sent and received with a pair of words:"
+{ $subsection send }
+{ $subsection receive }
+"Packet-oriented sockets are closed by calling " { $link stream-close } ", but they do not respond to the rest of the stream protocol."
+$nl
+"Address specifiers have the following interpretation with connection-oriented networking words:"
+{ $list
+    { { $link local } " - Unix domain datagram sockets on Unix systems" }
+    { { $link inet4 } " - a TCP/IP connection to an IPv4 address and port number; no name lookup is performed" }
+    { { $link inet6 } " - a TCP/IP connection to an IPv6 address and port number; no name lookup is performed" }
+}
+"The " { $link inet } " address specifier is not supported by the " { $link send } " word because a single host name can resolve to any number of IPv4 or IPv6 addresses, therefore there is no way to know which address should be used. Applications should call " { $link resolve-host } " then use some kind of strategy to pick the correct address (for example, by sending a packet to each one and waiting for a response, or always assuming IPv4)." ;
+
+ARTICLE: "network-streams" "Networking"
+"Factor supports connection-oriented and packet-oriented communication over a variety of protocols:"
+{ $list
+    "TCP/IP and UDP/IP, over IPv4 and IPv6"
+    "Unix domain sockets"
+}
+{ $subsection "network-addressing" }
+{ $subsection "network-connection" }
+{ $subsection "network-packet" } ;
+
+ABOUT: "network-streams"
+
+HELP: local
+{ $class-description "Local address specifier for Unix domain sockets on Unix systems. The " { $link local-path } " slot holds the path name of the socket. New instances are created by calling " { $link <local> } "." }
+{ $examples
+    { $code "\"/tmp/.X11-unix/0\" <local>" }
+} ;
+
+HELP: inet
+{ $class-description "Host name/port number specifier for TCP/IP and UDP/IP connections. The " { $link inet-host } " and " { $link inet-port } " slots hold the host name and port name or number, respectively. New instances are created by calling " { $link <inet> } "." }
+{ $notes
+    "This address specifier is only supported by " { $link <client> } ", which calls " { $link resolve-host }  " to obtain a list of IP addresses associated with the host name, and attempts a connection to each one in turn until one succeeds. Other network words do not accept this address specifier, and " { $link resolve-host } " must be called directly; it is then up to the application to pick the correct address from the (possibly several) addresses associated to the host name."
+}
+{ $examples
+    { $code "\"www.apple.com\" \"http\" <inet>" }
+    { $code "\"localhost\" 8080 <inet>" }
+} ;
+
+HELP: inet4
+{ $class-description "IPv4 address/port number specifier for TCP/IP and UDP/IP connections. The " { $link inet4-host } " and " { $link inet4-port } " slots hold the IPv4 address and port number, respectively. New instances are created by calling " { $link <inet4> } "." }
+{ $notes
+"New instances should not be created directly; instead, use " { $link resolve-host } " to look up the address associated to a host name. Also, try to support IPv6 where possible."
+}
+{ $examples
+    { $code "\"127.0.0.1\" 8080 <inet4>" }
+} ;
+
+HELP: inet6
+{ $class-description "IPv6 address/port number specifier for TCP/IP and UDP/IP connections. The " { $link inet6-host } " and " { $link inet6-port } " slots hold the IPv6 address and port number, respectively. New instances are created by calling " { $link <inet6> } "." }
+{ $notes
+"New instances should not be created directly; instead, use " { $link resolve-host } " to look up the address associated to a host name." }
+{ $examples
+    { $code "\"::1\" 8080 <inet6>" }
+} ;
+
+HELP: <client>
+{ $values { "addrspec" "an address specifier" } { "stream" "a bidirectional stream" } }
+{ $description "Opens a network connection and outputs a bidirectional stream." }
+{ $errors "Throws an error if the connection cannot be established." }
+{ $examples
+    { $code "\"www.apple.com\" \"http\" <inet> <client>" }
+} ;
+
+HELP: <server>
+{ $values  { "addrspec" "an address specifier" } { "server" "a handle" } }
+{ $description
+    "Begins listening for network connections to a local address. Server objects responds to two words:"
+    { $list
+        { { $link stream-close } " - stops listening on the port and frees all associated resources" }
+        { { $link accept } " - blocks until there is a connection" }
+    }
+}
+{ $notes
+    "To start a TCP/IP server which listens for connections from any host, use an address specifier returned by the following code, where 1234 is the desired port number:"
+    { $code "f 1234 t resolve-host" }
+    "To start a server which listens for connections from the loopback interface only, use an address specifier returned by the following code, where 1234 is the desired port number:"
+    { $code "\"localhost\" 1234 t resolve-host" }
+    "Since " { $link resolve-host } " can return multiple address specifiers, your server code must listen on them all to work properly. The " { $vocab-link "io.server" } " vocabulary can be used to help with this."
+}
+{ $errors "Throws an error if the address is already in use, or if it if the system forbids access." } ;
+
+HELP: accept
+{ $values { "server" "a handle" } { "client" "a bidirectional stream" } }
+{ $description "Waits for a connection to a server socket created by " { $link <server> } ", and outputs a bidirectional stream when the connection has been established."
+$nl
+"The returned client stream responds to the " { $link client-stream-addr } " word with the address of the incoming connection." }
+{ $errors "Throws an error if the server socket is closed or otherwise is unavailable." } ;
+
+HELP: <datagram>
+{ $values { "addrspec" "an address specifier" } { "datagram" "a handle" } }
+{ $description "Creates a datagram socket bound to a local address. Datagram socket objects responds to three words:"
+    { $list
+        { { $link stream-close } " - stops listening on the port and frees all associated resources" }
+        { { $link receive } " - waits for a packet" }
+        { { $link send } " - sends a packet" }
+    }
+}
+{ $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 t 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 t resolve-host" }
+    "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."
+}
+{ $errors "Throws an error if the port is already in use, or if the OS forbids access." } ;
+
+HELP: receive
+{ $values { "datagram" "a datagram socket" } { "packet" byte-array } { "addrspec" "an address specifier" } }
+{ $description "Waits for an incoming packet on the given datagram socket. Outputs the packet data, as well as the sender's address." }
+{ $errors "Throws an error if the packet could not be received." } ;
+
+HELP: send
+{ $values { "packet" byte-array } { "addrspec" "an address specifier" } { "datagram" "a datagram socket" } }
+{ $description "Sends a packet to the given address." }
+{ $errors "Throws an error if the packet could not be sent." } ;
diff --git a/extra/io/sockets/sockets.factor b/extra/io/sockets/sockets.factor
new file mode 100644 (file)
index 0000000..1afffcc
--- /dev/null
@@ -0,0 +1,54 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.sockets
+USING: generic kernel io.backend namespaces continuations
+sequences arrays ;
+
+TUPLE: local path ;
+
+C: <local> local
+
+TUPLE: inet4 host port ;
+
+C: <inet4> inet4
+
+TUPLE: inet6 host port ;
+
+C: <inet6> inet6
+
+TUPLE: inet host port ;
+
+C: <inet> inet
+
+TUPLE: client-stream addr ;
+
+: <client-stream> ( addrspec delegate -- stream )
+    { set-client-stream-addr set-delegate }
+    client-stream construct ;
+
+HOOK: (client) io-backend ( addrspec -- stream )
+
+GENERIC: <client> ( addrspec -- stream )
+
+M: array <client> [ (client) ] attempt-all ;
+
+M: object <client> (client) ;
+
+HOOK: <server> io-backend ( addrspec -- server )
+
+HOOK: accept io-backend ( server -- client )
+
+HOOK: <datagram> io-backend ( addrspec -- datagram )
+
+HOOK: receive io-backend ( datagram -- packet addrspec )
+
+HOOK: send io-backend ( packet addrspec datagram -- )
+
+HOOK: resolve-host io-backend ( host serv passive? -- seq )
+
+HOOK: host-name io-backend ( -- string )
+
+M: inet <client>
+    dup inet-host swap inet-port f resolve-host
+    dup empty? [ "Host name lookup failed" throw ] when
+    <client> ;
diff --git a/extra/io/sockets/summary.txt b/extra/io/sockets/summary.txt
new file mode 100644 (file)
index 0000000..7119aaf
--- /dev/null
@@ -0,0 +1 @@
+Client and server TCP/IP sockets, UDP/IP datagram sockets
diff --git a/extra/io/sockets/tags.txt b/extra/io/sockets/tags.txt
new file mode 100644 (file)
index 0000000..992ae12
--- /dev/null
@@ -0,0 +1 @@
+network
diff --git a/extra/io/streams/null/null.factor b/extra/io/streams/null/null.factor
new file mode 100644 (file)
index 0000000..7c11130
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: io.streams.null
+USING: kernel io ;
+
+TUPLE: null-stream ;
+
+M: null-stream stream-close drop ;
+M: null-stream set-timeout 2drop ;
+M: null-stream stream-readln drop f ;
+M: null-stream stream-read1 drop f ;
+M: null-stream stream-read-until 2drop f f ;
+M: null-stream stream-read 2drop f ;
+M: null-stream stream-write1 2drop ;
+M: null-stream stream-write 2drop ;
+M: null-stream stream-nl drop ;
+M: null-stream stream-flush drop ;
+M: null-stream stream-format 3drop ;
+M: null-stream with-nested-stream rot drop with-stream* ;
+
+: with-null-stream ( quot -- )
+    T{ null-stream } swap with-stream* ; inline
diff --git a/extra/io/unix/authors.txt b/extra/io/unix/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/io/unix/backend/authors.txt b/extra/io/unix/backend/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/io/unix/backend/backend.factor b/extra/io/unix/backend/backend.factor
new file mode 100644 (file)
index 0000000..a0d8658
--- /dev/null
@@ -0,0 +1,199 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien bit-arrays generic assocs io kernel
+kernel.private math io.nonblocking sequences strings structs
+sbufs threads unix vectors io.buffers io.backend
+io.streams.duplex math.parser continuations system libc ;
+IN: io.unix.backend
+
+TUPLE: unix-io ;
+
+! We want namespaces::bind to shadow the bind system call from
+! unix
+USING: namespaces ;
+
+! Global variables
+SYMBOL: read-fdset
+SYMBOL: read-tasks
+SYMBOL: write-fdset
+SYMBOL: write-tasks
+
+! Some general stuff
+: file-mode OCT: 0666 ;
+
+: (io-error) ( -- * ) err_no strerror throw ;
+
+: check-null ( n -- ) zero? [ (io-error) ] when ;
+
+: io-error ( n -- ) 0 < [ (io-error) ] when ;
+M: integer init-handle ( fd -- )
+    #! We drop the error code rather than calling io-error,
+    #! since on OS X 10.3, this operation fails from init-io
+    #! when running the Factor.app (presumably because fd 0 and
+    #! 1 are closed).
+    F_SETFL O_NONBLOCK fcntl drop ;
+
+: report-error ( error port -- )
+    [ "Error on fd " % dup port-handle # ": " % swap % ] "" make
+    swap set-port-error ;
+
+: ignorable-error? ( n -- ? )
+    dup EAGAIN number= swap EINTR number= or ;
+
+: defer-error ( port -- ? )
+    #! Return t if it is an unrecoverable error.
+    err_no dup ignorable-error?
+    [ 2drop f ] [ strerror swap report-error t ] if ;
+
+! Associates a port with a list of continuations waiting on the
+! port to finish I/O
+TUPLE: io-task port callbacks ;
+
+: <io-task> ( port class -- task )
+    >r V{ } clone io-task construct-boa
+    { set-delegate } r> construct ; inline
+
+! Multiplexer
+GENERIC: do-io-task ( task -- ? )
+GENERIC: task-container ( task -- vector )
+
+: io-task-fd io-task-port port-handle ;
+
+: add-io-task ( callback task -- )
+    [ io-task-callbacks push ] keep
+    dup io-task-fd over task-container 2dup at [
+        "Cannot perform multiple reads from the same port" throw
+    ] when set-at ;
+
+: remove-io-task ( task -- )
+    dup io-task-fd swap task-container delete-at ;
+
+: pop-callbacks ( task -- )
+    dup io-task-callbacks swap remove-io-task
+    [ schedule-thread ] each ;
+
+: handle-fd ( task -- )
+    dup io-task-port touch-port
+    dup do-io-task [ pop-callbacks ] [ drop ] if ;
+
+: handle-fdset ( fdset tasks -- )
+    swap [
+        swap dup io-task-port timeout? [
+            dup io-task-port "Timeout" swap report-error
+            nip pop-callbacks
+        ] [
+            tuck io-task-fd swap nth
+            [ handle-fd ] [ drop ] if
+        ] if drop
+    ] curry assoc-each ;
+
+: init-fdset ( fdset tasks -- )
+    swap dup clear-bits
+    [ >r drop t swap r> set-nth ] curry assoc-each ;
+
+: read-fdset/tasks
+    read-fdset get-global read-tasks get-global ;
+
+: write-fdset/tasks
+    write-fdset get-global write-tasks get-global ;
+
+: init-fdsets ( -- read write except )
+    read-fdset/tasks dupd init-fdset
+    write-fdset/tasks dupd init-fdset
+    f ;
+
+: (io-multiplex) ( ms -- )
+    >r FD_SETSIZE init-fdsets r> make-timeval select 0 < [
+        err_no ignorable-error? [ (io-error) ] unless
+    ] when ;
+
+M: unix-io io-multiplex ( ms -- )
+    (io-multiplex)
+    read-fdset/tasks handle-fdset
+    write-fdset/tasks handle-fdset ;
+
+! Readers
+: reader-eof ( reader -- )
+    dup buffer-empty? [ t over set-port-eof? ] when drop ;
+
+: (refill) ( port -- n )
+    dup port-handle over buffer-end rot buffer-capacity read ;
+
+: refill ( port -- ? )
+    #! Return f if there is a recoverable error
+    dup buffer-empty? [
+        dup (refill)  dup 0 >= [
+            swap n>buffer t
+        ] [
+            drop defer-error
+        ] if
+    ] [
+        drop t
+    ] if ;
+
+TUPLE: read-task ;
+
+: <read-task> ( port -- task ) read-task <io-task> ;
+
+M: read-task do-io-task
+    io-task-port dup refill
+    [ [ reader-eof ] [ drop ] if ] keep ;
+
+M: read-task task-container drop read-tasks get-global ;
+
+M: input-port (wait-to-read)
+    [ swap <read-task> add-io-task stop ] callcc0
+    pending-error ;
+
+! Writers
+: write-step ( port -- ? )
+    dup port-handle over buffer@ pick buffer-length write
+    dup 0 >= [ swap buffer-consume f ] [ drop defer-error ] if ;
+
+TUPLE: write-task ;
+
+: <write-task> ( port -- task ) write-task <io-task> ;
+
+M: write-task do-io-task
+    io-task-port dup buffer-length zero? over port-error or
+    [ 0 swap buffer-reset t ] [ write-step ] if ;
+
+M: write-task task-container drop write-tasks get-global ;
+
+: add-write-io-task ( callback task -- )
+    dup io-task-fd write-tasks get-global at
+    [ io-task-callbacks push ] [ add-io-task ] ?if ;
+
+: (wait-to-write) ( port -- )
+    [ swap <write-task> add-write-io-task stop ] callcc0 drop ;
+
+: port-flush ( port -- )
+    dup buffer-empty? [ drop ] [ (wait-to-write) ] if ;
+
+M: output-port stream-flush
+    dup port-flush pending-error ;
+
+M: port stream-close
+    dup port-type closed eq? [
+        dup port-type >r closed over set-port-type r>
+        output eq? [ dup port-flush ] when
+        dup port-handle close
+        dup delegate [ buffer-free ] when*
+        f over set-delegate
+    ] unless drop ;
+
+USE: io
+
+M: unix-io init-io ( -- )
+    #! Should only be called on startup. Calling this at any
+    #! other time can have unintended consequences.
+    global [
+        H{ } clone read-tasks set
+        FD_SETSIZE 8 * <bit-array> read-fdset set
+        H{ } clone write-tasks set
+        FD_SETSIZE 8 * <bit-array> write-fdset set
+    ] bind ;
+
+M: unix-io init-stdio ( -- )
+    0 1 handle>duplex-stream stdio set ;
diff --git a/extra/io/unix/backend/summary.txt b/extra/io/unix/backend/summary.txt
new file mode 100644 (file)
index 0000000..8f66d88
--- /dev/null
@@ -0,0 +1 @@
+Non-blocking I/O and sockets on Unix-like systems
diff --git a/extra/io/unix/files/authors.txt b/extra/io/unix/files/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/io/unix/files/files-tests.factor b/extra/io/unix/files/files-tests.factor
new file mode 100644 (file)
index 0000000..9e3fb44
--- /dev/null
@@ -0,0 +1,8 @@
+USING: tools.test io.files ;
+IN: temporary
+
+[ "/usr/libexec/" ] [ "/usr/libexec/awk/" parent-dir ] unit-test
+[ "/etc/" ] [ "/etc/passwd" parent-dir ] unit-test
+[ "/" ] [ "/etc/" parent-dir ] unit-test
+[ "/" ] [ "/etc" parent-dir ] unit-test
+[ "/" ] [ "/" parent-dir ] unit-test
diff --git a/extra/io/unix/files/files.factor b/extra/io/unix/files/files.factor
new file mode 100644 (file)
index 0000000..9c0ef54
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io.backend io.nonblocking io.unix.backend io.files io
+unix kernel math continuations ;
+IN: io.unix.files
+
+M: unix-io root-directory? ( path -- ? )
+    "/" = ;
+
+: open-read ( path -- fd )
+    O_RDONLY file-mode open dup io-error ;
+
+M: unix-io <file-reader> ( path -- stream )
+    open-read <reader> ;
+
+: write-flags O_WRONLY O_CREAT O_TRUNC bitor bitor ;
+
+: open-write ( path -- fd )
+    write-flags file-mode open dup io-error ;
+
+M: unix-io <file-writer> ( path -- stream )
+    open-write <writer> ;
+
+: append-flags O_WRONLY O_APPEND O_CREAT bitor bitor ;
+
+: open-append ( path -- fd )
+    append-flags file-mode open dup io-error
+    [ dup 0 SEEK_END lseek io-error ] [ ] [ close ] cleanup ;
+
+M: unix-io <file-appender> ( path -- stream )
+    open-append <writer> ;
+
+M: unix-io rename-file ( from to -- )
+    rename io-error ;
+
+M: unix-io delete-file ( path -- )
+    unlink io-error ;
+
+M: unix-io make-directory ( path -- )
+    OCT: 777 mkdir io-error ;
+
+M: unix-io delete-directory ( path -- )
+    rmdir io-error ;
diff --git a/extra/io/unix/files/summary.txt b/extra/io/unix/files/summary.txt
new file mode 100644 (file)
index 0000000..57527be
--- /dev/null
@@ -0,0 +1 @@
+Implementation of reading and writing files on Unix-like systems
diff --git a/extra/io/unix/launcher/launcher.factor b/extra/io/unix/launcher/launcher.factor
new file mode 100644 (file)
index 0000000..c3fe6d0
--- /dev/null
@@ -0,0 +1,69 @@
+IN: io.unix.launcher
+USING: io io.launcher io.unix.backend io.nonblocking
+sequences kernel namespaces math system alien.c-types
+debugger continuations ;
+
+! Search unix first
+USE: unix
+
+: with-fork ( quot -- pid )
+    fork [ zero? -rot if ] keep ; inline
+
+: prepare-execve ( args -- cmd args envp )
+    #! Doesn't free any memory, so we only call this word
+    #! after forking.
+    [ malloc-char-string ] map
+    [ first ] keep
+    f add >c-void*-array
+    f ;
+
+: (spawn-process) ( args -- )
+    [ prepare-execve execve ] catch 1 exit ;
+
+: spawn-process ( args -- pid )
+    [ (spawn-process) ] [ drop ] with-fork ;
+
+: wait-for-process ( pid -- )
+    0 <int> 0 waitpid drop ;
+
+: shell-command ( string -- args )
+    { "/bin/sh" "-c" } swap add ;
+
+M: unix-io run-process ( string -- )
+    shell-command spawn-process wait-for-process ;
+
+: detached-shell-command ( string -- args )
+    shell-command "&" add ;
+
+M: unix-io run-detached ( string -- )
+    detached-shell-command spawn-process wait-for-process ;
+
+: open-pipe ( -- pair )
+    2 "int" <c-array> dup pipe zero?
+    [ 2 c-int-array> ] [ drop f ] if ;
+
+: setup-stdio-pipe ( stdin stdout -- )
+    2dup first close second close
+    >r first 0 dup2 drop r> second 1 dup2 drop ;
+
+: spawn-process-stream ( args -- in out pid )
+    open-pipe open-pipe [
+        setup-stdio-pipe
+        (spawn-process)
+    ] [
+        2dup second close first close
+        rot drop
+    ] with-fork >r first swap second r> ;
+
+TUPLE: pipe-stream pid ;
+
+: <pipe-stream> ( in out pid -- stream )
+    pipe-stream construct-boa
+    -rot handle>duplex-stream over set-delegate ;
+
+M: pipe-stream stream-close
+    dup delegate stream-close
+    pipe-stream-pid wait-for-process ;
+
+M: unix-io <process-stream>
+    shell-command spawn-process-stream <pipe-stream> ;
diff --git a/extra/io/unix/mmap/mmap.factor b/extra/io/unix/mmap/mmap.factor
new file mode 100644 (file)
index 0000000..50e928f
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien io io.files kernel math system unix io.unix.backend
+io.mmap ;
+IN: io.unix.mmap
+
+: open-r/w ( path -- fd ) O_RDWR file-mode open dup io-error ;
+
+: mmap-open ( length prot flags path -- alien fd )
+    >r f -roll r> open-r/w [ 0 mmap ] keep
+    over MAP_FAILED = [ close (io-error) ] when ;
+
+M: unix-io <mapped-file> ( path length -- obj )
+    swap >r
+    dup PROT_READ PROT_WRITE bitor MAP_FILE MAP_SHARED bitor
+    r> mmap-open \ mapped-file construct-boa ;
+
+M: unix-io close-mapped-file ( mmap -- )
+    [ mapped-file-address ] keep
+    [ mapped-file-length munmap ] keep
+    mapped-file-handle close
+    io-error ;
diff --git a/extra/io/unix/sockets/authors.txt b/extra/io/unix/sockets/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/io/unix/sockets/sockets.factor b/extra/io/unix/sockets/sockets.factor
new file mode 100644 (file)
index 0000000..43c8224
--- /dev/null
@@ -0,0 +1,210 @@
+! Copyright (C) 2004, 2007 Slava Pestov, Ivan Tikhonov.
+! See http://factorcode.org/license.txt for BSD license.
+
+! We need to fiddle with the exact search order here, since
+! unix::accept shadows streams::accept.
+IN: io.unix.sockets
+USING: alien alien.c-types generic io
+kernel math namespaces io.nonblocking parser threads unix
+sequences byte-arrays io.sockets io.binary io.unix.backend
+io.streams.duplex io.sockets.impl math.parser continuations
+libc combinators ;
+
+: pending-init-error ( port -- )
+    #! We close it here to avoid a resource leak; callers of
+    #! <client> don't set up error handlers until after <client>
+    #! returns (and if they did before, they wouldn't have
+    #! anything to close!)
+    dup port-error dup
+    [ swap stream-close throw ] [ 2drop ] if ;
+
+: socket-fd ( domain type -- socket )
+    0 socket dup io-error dup init-handle ;
+
+: sockopt ( fd level opt -- )
+    1 <int> "int" heap-size setsockopt io-error ;
+
+M: unix-io addrinfo-error ( n -- )
+    dup zero? [ drop ] [ gai_strerror throw ] if ;
+
+! Client sockets - TCP and Unix domain
+: init-client-socket ( fd -- )
+    SOL_SOCKET SO_OOBINLINE sockopt ;
+
+TUPLE: connect-task ;
+
+: <connect-task> ( port -- task ) connect-task <io-task> ;
+
+M: connect-task do-io-task
+    io-task-port dup port-handle f 0 write
+    0 < [ defer-error ] [ drop t ] if ;
+
+M: connect-task task-container drop write-tasks get-global ;
+
+: wait-to-connect ( port -- )
+    [ swap <connect-task> add-io-task stop ] callcc0 drop ;
+
+M: unix-io (client) ( addrspec -- stream )
+    dup make-sockaddr >r >r
+    protocol-family SOCK_STREAM socket-fd
+    dup r> r> heap-size connect
+    zero? err_no EINPROGRESS = or [
+        dup init-client-socket
+        dup handle>duplex-stream
+        dup duplex-stream-out
+        dup wait-to-connect
+        pending-init-error
+    ] [
+        dup close (io-error)
+    ] if ;
+
+! Server sockets - TCP and Unix domain
+USE: unix
+
+: init-server-socket ( fd -- )
+    SOL_SOCKET SO_REUSEADDR sockopt ;
+
+TUPLE: accept-task ;
+
+: <accept-task> ( port -- task ) accept-task <io-task> ;
+
+M: accept-task task-container drop read-tasks get ;
+
+: accept-sockaddr ( port -- fd sockaddr )
+    dup port-handle swap server-port-addr sockaddr-type
+    dup <c-object> [ swap heap-size <int> accept ] keep ; inline
+
+: do-accept ( port fd sockaddr -- )
+    rot [
+        server-port-addr parse-sockaddr
+        swap dup handle>duplex-stream <client-stream>
+    ] keep set-server-port-client ;
+
+M: accept-task do-io-task
+    io-task-port dup accept-sockaddr
+    over 0 >= [ do-accept t ] [ 2drop defer-error ] if ;
+
+: wait-to-accept ( server -- )
+    [ swap <accept-task> add-io-task stop ] callcc0 drop ;
+
+USE: io.sockets
+
+: server-fd ( addrspec type -- fd )
+    >r dup protocol-family r>  socket-fd
+    dup init-server-socket
+    dup rot make-sockaddr heap-size bind
+    zero? [ dup close (io-error) ] unless ;
+
+M: unix-io <server> ( addrspec -- stream )
+    [
+        SOCK_STREAM server-fd
+        dup 10 listen zero? [ dup close (io-error) ] unless
+        f <port>
+    ] keep <server-port> ;
+
+M: unix-io accept ( server -- client )
+    #! Wait for a client connection.
+    dup check-server-port
+    dup wait-to-accept
+    dup pending-error
+    server-port-client ;
+
+! Datagram sockets - UDP and Unix domain
+M: unix-io <datagram>
+    [ SOCK_DGRAM server-fd f <port> ] keep <datagram-port> ;
+
+SYMBOL: receive-buffer
+
+: packet-size 65536 ; inline
+
+packet-size <byte-array> receive-buffer set-global
+
+: setup-receive ( port -- s buffer len flags from fromlen )
+    dup port-handle
+    swap datagram-port-addr sockaddr-type
+    dup <c-object> swap heap-size <int>
+    >r >r receive-buffer get-global packet-size 0 r> r> ;
+
+: do-receive ( s buffer len flags from fromlen -- sockaddr data )
+    over >r recvfrom r>
+    over -1 = [
+        2drop f f
+    ] [
+        receive-buffer get-global
+        rot head
+    ] if ;
+
+TUPLE: receive-task ;
+
+: <receive-task> ( stream -- task ) receive-task <io-task> ;
+
+M: receive-task do-io-task
+    io-task-port
+    dup setup-receive do-receive dup [
+        pick set-datagram-port-packet
+        over datagram-port-addr parse-sockaddr
+        swap set-datagram-port-packet-addr
+        t
+    ] [
+        2drop defer-error
+    ] if ;
+
+M: receive-task task-container drop read-tasks get ;
+
+: wait-receive ( stream -- )
+    [ swap <receive-task> add-io-task stop ] callcc0 drop ;
+
+M: unix-io receive ( datagram -- packet addrspec )
+    dup check-datagram-port
+    dup wait-receive
+    dup pending-error
+    dup datagram-port-packet
+    swap datagram-port-packet-addr ;
+
+: do-send ( socket data sockaddr len -- n )
+    >r >r dup length 0 r> r> sendto ;
+
+TUPLE: send-task packet sockaddr len ;
+
+: <send-task> ( packet sockaddr len port -- task )
+    send-task <io-task> [
+        {
+            set-send-task-packet
+            set-send-task-sockaddr
+            set-send-task-len
+        } set-slots
+    ] keep ;
+
+M: send-task do-io-task
+    [ io-task-port port-handle ] keep
+    [ send-task-packet ] keep
+    [ send-task-sockaddr ] keep
+    [ send-task-len do-send ] keep
+    swap 0 < [ io-task-port defer-error ] [ drop t ] if ;
+
+M: send-task task-container drop write-tasks get ;
+
+: wait-send ( packet sockaddr len stream -- )
+    [ >r <send-task> r> swap add-io-task stop ] callcc0
+    2drop 2drop ;
+
+M: unix-io send ( packet addrspec datagram -- )
+    3dup check-datagram-send
+    [ >r make-sockaddr heap-size r> wait-send ] keep
+    pending-error ;
+
+M: local protocol-family drop PF_UNIX ;
+
+M: local sockaddr-type drop "sockaddr-un" ;
+
+M: local make-sockaddr
+    local-path
+    dup length 1 + max-un-path > [ "Path too long" throw ] when
+    "sockaddr-un" <c-object>
+    AF_UNIX over set-sockaddr-un-family
+    dup sockaddr-un-path rot string>char-alien dup length memcpy
+   "sockaddr-un" ;
+
+M: local parse-sockaddr
+    drop
+    sockaddr-un-path alien>char-string <local> ;
diff --git a/extra/io/unix/sockets/summary.txt b/extra/io/unix/sockets/summary.txt
new file mode 100644 (file)
index 0000000..22342ec
--- /dev/null
@@ -0,0 +1 @@
+Implementation of TCP/IP and UDP/IP sockets on Unix-like systems
diff --git a/extra/io/unix/summary.txt b/extra/io/unix/summary.txt
new file mode 100644 (file)
index 0000000..8f66d88
--- /dev/null
@@ -0,0 +1 @@
+Non-blocking I/O and sockets on Unix-like systems
diff --git a/extra/io/unix/unix-tests.factor b/extra/io/unix/unix-tests.factor
new file mode 100644 (file)
index 0000000..e328e7b
--- /dev/null
@@ -0,0 +1,146 @@
+USING: io.files io.sockets io kernel threads namespaces
+tools.test continuations strings byte-arrays sequences
+prettyprint system ;
+IN: temporary
+
+! Unix domain stream sockets
+[
+    [
+        "unix-domain-socket-test" resource-path delete-file
+    ] catch drop
+
+    "unix-domain-socket-test" resource-path <local>
+    <server> [
+        stdio get accept [
+            "Hello world" print flush
+            readln "XYZ" = "FOO" "BAR" ? print flush
+        ] with-stream
+    ] with-stream
+
+    "unix-domain-socket-test" resource-path delete-file
+] in-thread
+
+yield
+
+[ { "Hello world" "FOO" } ] [
+    [
+        "unix-domain-socket-test" resource-path <local> <client>
+        [
+            readln ,
+            "XYZ" print flush
+            readln ,
+        ] with-stream
+    ] { } make
+] unit-test
+
+! Unix domain datagram sockets
+[
+    "unix-domain-datagram-test" resource-path delete-file
+] catch drop
+
+: server-addr "unix-domain-datagram-test" resource-path <local> ;
+: client-addr "unix-domain-datagram-test-2" resource-path <local> ;
+
+[
+    [
+        server-addr <datagram> "d" set
+
+        "Receive 1" print
+
+        "d" get receive >r reverse r>
+        
+        "Send 1" print
+        dup .
+
+        "d" get send
+
+        "Receive 2" print
+
+        "d" get receive >r >upper r>
+        
+        "Send 1" print
+        dup .
+
+         "d" get send
+
+        "d" get stream-close
+
+        "Done" print
+
+        "unix-domain-datagram-test" resource-path delete-file
+    ] with-scope
+] in-thread
+
+yield
+
+[
+    "unix-domain-datagram-test-2" resource-path delete-file
+] catch drop
+
+client-addr <datagram>
+"d" set
+
+[ ] [
+    "hello" >byte-array
+    server-addr
+    "d" get send
+] unit-test
+
+[ "olleh" t ] [
+    "d" get receive
+    server-addr =
+    >r >string r>
+] unit-test
+
+[ ] [
+    "hello" >byte-array
+    server-addr
+    "d" get send
+] unit-test
+
+[ "HELLO" t ] [
+    "d" get receive
+    server-addr =
+    >r >string r>
+] unit-test
+
+[ ] [ "d" get stream-close ] unit-test
+
+! Test error behavior
+
+[
+    "unix-domain-datagram-test-3" resource-path delete-file
+] catch drop
+
+"unix-domain-datagram-test-2" resource-path delete-file
+
+[ ] [ client-addr <datagram> "d" set ] unit-test
+
+[
+    B{ 1 2 3 } "unix-domain-datagram-test-3" <local> "d" get send
+] unit-test-fails
+
+[ ] [ "d" get stream-close ] unit-test
+
+! See what happens on send/receive after close
+
+[ "d" get receive ] unit-test-fails
+
+[ B{ 1 2 } server-addr "d" get send ] unit-test-fails
+
+! Invalid parameter tests
+
+[
+    image <file-reader> [ stdio get accept ] with-stream
+] unit-test-fails
+
+[
+    image <file-reader> [ stdio get receive ] with-stream
+] unit-test-fails
+
+[
+    image <file-reader> [
+        B{ 1 2 } server-addr
+        stdio get send
+    ] with-stream
+] unit-test-fails
diff --git a/extra/io/unix/unix.factor b/extra/io/unix/unix.factor
new file mode 100644 (file)
index 0000000..030b118
--- /dev/null
@@ -0,0 +1,7 @@
+USE: io.unix.backend
+USE: io.unix.files
+USE: io.unix.sockets
+USE: io.backend
+USE: namespaces
+
+T{ unix-io } io-backend set-global
diff --git a/extra/io/windows/authors.txt b/extra/io/windows/authors.txt
new file mode 100644 (file)
index 0000000..781acc2
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Mackenzie Straight
diff --git a/extra/io/windows/ce/authors.txt b/extra/io/windows/ce/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/io/windows/ce/ce.factor b/extra/io/windows/ce/ce.factor
new file mode 100644 (file)
index 0000000..7023d88
--- /dev/null
@@ -0,0 +1,235 @@
+USING: alien alien.c-types combinators
+io io.backend io.buffers io.files io.nonblocking io.sockets
+io.sockets.impl io.windows kernel libc math namespaces
+prettyprint qualified sequences strings threads threads.private
+windows windows.kernel32 ;
+QUALIFIED: windows.winsock
+IN: io.windows.ce
+
+! M: windows-ce-io normalize-pathname ( string -- string )
+    ! dup 1 tail* CHAR: \\ = [ "*" append ] [ "\\*" append ] if ;
+
+M: windows-ce-io CreateFile-flags ( -- DWORD ) FILE_ATTRIBUTE_NORMAL ;
+M: windows-ce-io FileArgs-overlapped ( port -- f ) drop f ;
+M: windows-ce-io io-multiplex ( ms -- ) (sleep) ;
+M: windows-ce-io add-completion ( port -- ? ) drop f ;
+
+: port-errored ( port -- )
+    win32-error-string swap set-port-error ;
+
+GENERIC: wince-read ( port port-handle -- )
+
+M: win32-file wince-read
+    drop dup make-FileArgs dup setup-read ReadFile zero? [
+        drop port-errored
+    ] [
+        FileArgs-lpNumberOfBytesRet *uint dup zero? [
+            drop
+            t swap set-port-eof?
+        ] [
+            swap n>buffer
+        ] if
+    ] if ;
+
+TUPLE: WSAArgs
+    s
+    lpBuffers
+    dwBufferCount
+    lpNumberOfBytesRet
+    lpFlags
+    lpOverlapped
+    lpCompletionRoutine ;
+C: <WSAArgs> WSAArgs
+
+: make-WSAArgs ( port -- <WSARecv> )
+    [ port-handle win32-file-handle ] keep
+    delegate 1 "DWORD" <c-object> f f f <WSAArgs> ;
+
+: setup-WSARecv ( <WSAArgs> -- s lpBuffers dwBufferCount lpNumberOfBytesRet lpFlags lpOverlapped lpCompletionRoutine )
+    [ WSAArgs-s ] keep
+    [
+        WSAArgs-lpBuffers [ buffer-capacity ] keep
+        buffer-end
+        "WSABUF" <c-object>
+        [ windows.winsock:set-WSABUF-buf ] keep
+        [ windows.winsock:set-WSABUF-len ] keep
+    ] keep
+    [ WSAArgs-dwBufferCount ] keep
+    [ WSAArgs-lpNumberOfBytesRet ] keep
+    [ WSAArgs-lpFlags ] keep
+    [ WSAArgs-lpOverlapped ] keep
+    WSAArgs-lpCompletionRoutine ;
+
+! M: win32-socket wince-read ( port port-handle -- )
+    ! drop dup make-WSAArgs dup setup-WSARecv WSARecv zero? [
+        ! drop port-errored
+    ! ] [
+        ! WSAArgs-lpNumberOfBytesRet *uint dup zero? [
+            ! drop
+            ! t swap set-port-eof?
+        ! ] [
+            ! swap n>buffer
+        ! ] if
+    ! ] if ;
+
+M: win32-socket wince-read ( port port-handle -- )
+    win32-file-handle over
+    delegate [ buffer-end ] keep buffer-capacity 0
+    windows.winsock:recv dup windows.winsock:SOCKET_ERROR = [
+        drop port-errored
+    ] [
+        dup zero? [
+            drop
+            t swap set-port-eof?
+        ] [
+            swap n>buffer
+        ] if
+    ] if ;
+
+M: input-port (wait-to-read) ( port -- )
+    dup port-handle wince-read ;
+
+GENERIC: wince-write ( port port-handle -- )
+
+M: win32-file wince-write ( port port-handle -- )
+    drop dup make-FileArgs dup setup-write WriteFile zero? [
+        drop port-errored
+    ] [
+        FileArgs-lpNumberOfBytesRet *uint ! *DWORD
+        over delegate [ buffer-consume ] keep
+        buffer-length 0 > [
+            flush-output
+        ] [
+            drop
+        ] if
+    ] if ;
+
+: setup-WSASend ( <WSAArgs> -- s lpBuffers dwBufferCount lpNumberOfBytesRet lpFlags lpOverlapped lpCompletionRoutine )
+    [ WSAArgs-s ] keep
+    [
+        WSAArgs-lpBuffers [ buffer-length ] keep
+        buffer@
+        "WSABUF" <c-object>
+        [ windows.winsock:set-WSABUF-buf ] keep
+        [ windows.winsock:set-WSABUF-len ] keep
+    ] keep
+    [ WSAArgs-dwBufferCount ] keep
+    [ WSAArgs-lpNumberOfBytesRet ] keep
+    [ WSAArgs-lpFlags ] keep
+    [ WSAArgs-lpOverlapped ] keep
+    WSAArgs-lpCompletionRoutine ;
+
+! M: win32-socket wince-write ( port port-handle -- )
+    ! drop dup make-WSAArgs dup setup-WSASend WSASend zero? [
+        ! drop port-errored
+    ! ] [
+        ! FileArgs-lpNumberOfBytesRet *uint ! *DWORD
+        ! over delegate [ buffer-consume ] keep
+        ! buffer-length 0 > [
+            ! flush-output
+        ! ] [
+            ! drop
+        ! ] if
+    ! ] if ;
+
+M: win32-socket wince-write ( port port-handle -- )
+    win32-file-handle over
+    delegate [ buffer@ ] keep
+    buffer-length 0 windows.winsock:send dup windows.winsock:SOCKET_ERROR = [
+        drop port-errored
+    ] [
+        over delegate [ buffer-consume ] keep
+        buffer-length 0 > [
+            flush-output
+        ] [
+            drop
+        ] if
+    ] if ;
+
+M: windows-ce-io flush-output ( port -- )
+    dup port-handle wince-write ;
+
+M: windows-ce-io WSASocket-flags ( -- DWORD ) 0 ;
+
+: do-connect ( addrspec -- socket )
+    [ tcp-socket dup ] keep
+    make-sockaddr heap-size
+    f f f f windows.winsock:WSAConnect zero? [
+        winsock-error-string throw
+    ] unless ;
+
+M: windows-ce-io (client) ( addrspec -- duplex-stream )
+    do-connect <win32-socket> dup handle>duplex-stream ;
+
+M: windows-ce-io <server> ( addrspec -- duplex-stream )
+    [
+        windows.winsock:SOCK_STREAM server-fd
+        dup listen-on-socket
+        <win32-socket> f <port>
+    ] keep <server-port> ;
+
+M: windows-ce-io accept ( server -- client )
+    dup check-server-port
+    [
+        [ touch-port ] keep
+        [ port-handle win32-file-handle ] keep
+        server-port-addr sockaddr-type heap-size
+        [ "char" <c-array> ] keep [
+            <int>
+            f 0
+            windows.winsock:WSAAccept dup windows.winsock:INVALID_SOCKET = [
+                winsock-error-string throw
+            ] when
+        ] keep
+    ] keep server-port-addr parse-sockaddr swap
+    <win32-socket> dup handle>duplex-stream <client-stream> ;
+
+T{ windows-ce-io } io-backend set-global
+
+M: windows-ce-io init-io ( -- )
+    init-winsock ;
+
+M: windows-ce-io <datagram> ( addrspec -- datagram )
+    [
+        windows.winsock:SOCK_DGRAM server-fd <win32-socket> f <port>
+    ] keep <datagram-port> ;
+
+M: windows-ce-io receive ( datagram -- packet addrspec )
+    dup check-datagram-port
+    [
+        port-handle delegate win32-file-handle
+        "WSABUF" <c-object>
+        default-buffer-size over windows.winsock:set-WSABUF-len
+        default-buffer-size "char" <c-array> over windows.winsock:set-WSABUF-buf
+        [
+            1
+            0 <uint> [
+                0 <uint>
+                64 "char" <c-array> [
+                    64 <int>
+                    f
+                    f
+                    windows.winsock:WSARecvFrom zero? [
+                        winsock-error-string throw
+                    ] unless
+                ] keep
+            ] keep *uint
+        ] keep
+    ] keep
+    ! sockaddr count buf datagram
+    >r windows.winsock:WSABUF-buf swap memory>string swap r>
+    datagram-port-addr parse-sockaddr ;
+
+M: windows-ce-io send ( packet addrspec datagram -- )
+    3dup check-datagram-send
+    delegate port-handle delegate win32-file-handle
+    rot dup length "WSABUF" <c-object>
+    [ windows.winsock:set-WSABUF-len ] keep
+    [ windows.winsock:set-WSABUF-buf ] keep
+    
+    rot make-sockaddr heap-size
+    >r >r 1 0 <uint> 0 r> r> f f 
+    windows.winsock:WSASendTo zero? [
+        winsock-error-string throw
+    ] unless ;
+
diff --git a/extra/io/windows/ce/summary.txt b/extra/io/windows/ce/summary.txt
new file mode 100644 (file)
index 0000000..0c660f7
--- /dev/null
@@ -0,0 +1 @@
+Microsoft Windows CE native I/O implementation
diff --git a/extra/io/windows/launcher/launcher.factor b/extra/io/windows/launcher/launcher.factor
new file mode 100644 (file)
index 0000000..98d241c
--- /dev/null
@@ -0,0 +1,166 @@
+USING: alien alien.c-types destructors io.windows libc
+io.nonblocking io.streams.duplex windows.types math
+windows.kernel32 windows namespaces io.launcher kernel ;
+IN: io.windows.launcher
+
+! From MSDN: "Handles in PROCESS_INFORMATION must be closed with CloseHandle when they are no longer needed."
+
+TUPLE: CreateProcess-args
+                            lpApplicationName
+                            lpCommandLine
+                            lpProcessAttributes
+                            lpThreadAttributes
+                            bInheritHandles
+                            dwCreateFlags
+                            lpEnvironment
+                            lpCurrentDirectory
+                            lpStartupInfo
+                            lpProcessInformation
+                            stdout-pipe stdin-pipe ;
+
+: default-CreateProcess-args ( lpCommandLine -- obj )
+    0
+    0
+    "STARTUPINFO" <c-object>
+    "STARTUPINFO" heap-size over set-STARTUPINFO-cb
+    "PROCESS_INFORMATION" <c-object>
+    {
+        set-CreateProcess-args-lpCommandLine
+        set-CreateProcess-args-bInheritHandles
+        set-CreateProcess-args-dwCreateFlags
+        set-CreateProcess-args-lpStartupInfo
+        set-CreateProcess-args-lpProcessInformation
+    } \ CreateProcess-args construct ;
+
+: call-CreateProcess ( CreateProcess-args -- )
+    {
+        CreateProcess-args-lpApplicationName
+        CreateProcess-args-lpCommandLine
+        CreateProcess-args-lpProcessAttributes
+        CreateProcess-args-lpThreadAttributes
+        CreateProcess-args-bInheritHandles
+        CreateProcess-args-dwCreateFlags
+        CreateProcess-args-lpEnvironment
+        CreateProcess-args-lpCurrentDirectory
+        CreateProcess-args-lpStartupInfo
+        CreateProcess-args-lpProcessInformation
+    } get-slots CreateProcess win32-error=0/f ;
+
+M: windows-io run-process ( string -- )
+    default-CreateProcess-args
+    call-CreateProcess ;
+
+M: windows-io run-detached ( string -- )
+    default-CreateProcess-args
+    DETACHED_PROCESS over set-CreateProcess-args-dwCreateFlags
+    call-CreateProcess ;
+
+: default-security-attributes ( -- obj )
+    "SECURITY_ATTRIBUTES" <c-object>
+    "SECURITY_ATTRIBUTES" heap-size over set-SECURITY_ATTRIBUTES-nLength ;
+
+: security-attributes-inherit ( -- obj )
+    default-security-attributes
+    TRUE over set-SECURITY_ATTRIBUTES-bInheritHandle ;
+
+: set-inherit ( handle ? -- )
+    >r HANDLE_FLAG_INHERIT r> >BOOLEAN SetHandleInformation win32-error=0/f ;
+
+! http://msdn2.microsoft.com/en-us/library/ms682499.aspx
+
+TUPLE: pipe hRead hWrite ;
+
+C: <pipe> pipe
+
+: factor-pipe-name
+    "\\\\.\\pipe\\Factor" ;
+
+: create-named-pipe ( str -- handle )
+    PIPE_ACCESS_DUPLEX FILE_FLAG_OVERLAPPED bitor
+    PIPE_TYPE_BYTE PIPE_READMODE_BYTE PIPE_NOWAIT bitor bitor
+    PIPE_UNLIMITED_INSTANCES
+    default-buffer-size
+    default-buffer-size
+    0
+    security-attributes-inherit
+    CreateNamedPipe dup invalid-handle? ;
+
+: ERROR_PIPE_CONNECT 535 ; inline
+
+M: windows-nt-io <process-stream> ( command -- stream )
+    [
+        default-CreateProcess-args
+        TRUE over set-CreateProcess-args-bInheritHandles
+
+        ! over set-CreateProcess-args-stdin-pipe
+
+        dup CreateProcess-args-lpStartupInfo
+        STARTF_USESTDHANDLES over set-STARTUPINFO-dwFlags
+
+        factor-pipe-name create-named-pipe
+        dup t set-inherit
+        [ add-completion ] keep
+        ! CreateFile
+        ! factor-pipe-name open-pipe-r/w
+        factor-pipe-name GENERIC_READ GENERIC_WRITE bitor 0 f OPEN_EXISTING FILE_FLAG_OVERLAPPED f CreateFile dup invalid-handle? dup [ CloseHandle drop ] f add-destructor
+        dup add-completion
+
+        swap (make-overlapped) ConnectNamedPipe zero? [
+            GetLastError ERROR_PIPE_CONNECT = [
+                win32-error-string throw
+            ] unless
+        ] when
+
+        dup t set-inherit
+
+        ! ERROR_PIPE_CONNECTED
+        [ pick set-CreateProcess-args-stdin-pipe ] keep
+        [ over set-STARTUPINFO-hStdOutput ] keep
+        [ over set-STARTUPINFO-hStdInput ] keep
+        swap set-STARTUPINFO-hStdError
+! 
+        [ call-CreateProcess ] keep
+        [ CreateProcess-args-stdin-pipe f <win32-file> dup handle>duplex-stream ] keep
+        drop ! TODO: close handles instead of drop
+    ] with-destructors ;
+
+: create-pipe ( -- pipe )
+    "HANDLE" <c-object>
+    "HANDLE" <c-object>
+    [
+        security-attributes-inherit
+        0
+        CreatePipe win32-error=0/f
+    ] 2keep
+    [ *void* dup [ CloseHandle ] f add-destructor ] 2apply <pipe> ;
+
+M: windows-ce-io <process-stream>
+    [
+        default-CreateProcess-args
+        TRUE over set-CreateProcess-args-bInheritHandles
+
+        create-pipe  ! for child's STDOUT
+        dup pipe-hRead f set-inherit
+        over set-CreateProcess-args-stdout-pipe
+
+        create-pipe  ! for child's STDIN
+        dup pipe-hWrite f set-inherit
+        over set-CreateProcess-args-stdin-pipe
+
+        dup CreateProcess-args-lpStartupInfo
+        STARTF_USESTDHANDLES over set-STARTUPINFO-dwFlags
+
+        over CreateProcess-args-stdout-pipe
+            pipe-hWrite over set-STARTUPINFO-hStdOutput
+        over CreateProcess-args-stdout-pipe
+            pipe-hWrite over set-STARTUPINFO-hStdError
+        over CreateProcess-args-stdin-pipe
+            pipe-hRead swap set-STARTUPINFO-hStdInput
+
+        [ call-CreateProcess ] keep
+        [ CreateProcess-args-stdin-pipe pipe-hRead f <win32-file> <reader> ] keep
+        [ CreateProcess-args-stdout-pipe pipe-hWrite f <win32-file> <writer> <duplex-stream> ] keep
+        drop ! TODO: close handles instead of drop
+    ] with-destructors ;
+
diff --git a/extra/io/windows/mmap/mmap.factor b/extra/io/windows/mmap/mmap.factor
new file mode 100644 (file)
index 0000000..cf8318e
--- /dev/null
@@ -0,0 +1,87 @@
+USING: alien alien.c-types alien.syntax arrays continuations
+destructors generic io.mmap io.nonblocking io.windows
+kernel libc math namespaces quotations sequences windows
+windows.advapi32 windows.kernel32 ;
+IN: io.windows.mmap
+
+TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
+
+! Security tokens
+!  http://msdn.microsoft.com/msdnmag/issues/05/03/TokenPrivileges/
+
+: (open-process-token) ( handle -- handle )
+    TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY bitor "PHANDLE" <c-object>
+    [ OpenProcessToken win32-error=0/f ] keep *void* ;
+
+: open-process-token ( -- handle )
+    #! remember to handle-close this
+    GetCurrentProcess (open-process-token) ;
+
+: with-process-token ( quot -- )
+    #! quot: ( token-handle -- token-handle )
+    >r open-process-token r>
+    [ keep ] curry
+    [ CloseHandle drop ] [ ] cleanup ; inline
+
+: lookup-privilege ( string -- luid )
+    >r f r> "LUID" <c-object>
+    [ LookupPrivilegeValue win32-error=0/f ] keep ;
+
+: make-token-privileges ( name ? -- obj )
+    "TOKEN_PRIVILEGES" <c-object>
+    1 [ over set-TOKEN_PRIVILEGES-PrivilegeCount ] keep
+    "LUID_AND_ATTRIBUTES" malloc-array
+    dup [ free ] t add-destructor over set-TOKEN_PRIVILEGES-Privileges
+
+    swap [
+        SE_PRIVILEGE_ENABLED over TOKEN_PRIVILEGES-Privileges
+        set-LUID_AND_ATTRIBUTES-Attributes
+    ] when
+
+    >r lookup-privilege r>
+    [
+        TOKEN_PRIVILEGES-Privileges
+        >r 0 r> LUID_AND_ATTRIBUTES-nth
+        set-LUID_AND_ATTRIBUTES-Luid
+    ] keep ;
+
+: set-privilege ( name ? -- )
+    [
+        -rot 0 -rot make-token-privileges
+        dup length f f AdjustTokenPrivileges win32-error=0/f
+    ] with-process-token ;
+
+: with-privileges ( seq quot -- )
+    over [ [ t set-privilege ] each ] curry compose
+    swap [ [ f set-privilege ] each ] curry [ ] cleanup ;
+
+: mmap-open ( path access-mode create-mode flProtect access length -- handle handle address )
+    drop
+    { "SeCreateGlobalPrivilege" "SeLockMemoryPrivilege" } [
+        >r >r open-file dup f r> 0 0 f
+        CreateFileMapping [ win32-error=0/f ] keep
+        dup [ CloseHandle drop ] f add-destructor
+        dup
+        r> 0 0 0 MapViewOfFile [ win32-error=0/f ] keep
+        dup [ CloseHandle drop ] f add-destructor
+    ] with-privileges ;
+    
+M: windows-io <mapped-file> ( path length -- mmap )
+    [
+        [
+            >r
+            GENERIC_WRITE GENERIC_READ bitor
+            OPEN_ALWAYS
+            PAGE_READWRITE SEC_COMMIT bitor
+            FILE_MAP_ALL_ACCESS r> mmap-open
+        ] keep
+    -roll -rot 2array \ mapped-file construct-boa
+    ] with-destructors ;
+
+M: windows-io close-mapped-file ( mapped-file -- )
+    [
+        dup mapped-file-handle [
+            [ CloseHandle drop ] t add-destructor
+        ] each
+        mapped-file-address UnmapViewOfFile win32-error=0/f
+    ] with-destructors ;
diff --git a/extra/io/windows/nt/authors.txt b/extra/io/windows/nt/authors.txt
new file mode 100644 (file)
index 0000000..781acc2
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Mackenzie Straight
diff --git a/extra/io/windows/nt/backend/backend.factor b/extra/io/windows/nt/backend/backend.factor
new file mode 100644 (file)
index 0000000..06d508e
--- /dev/null
@@ -0,0 +1,101 @@
+USING: alien alien.c-types arrays assocs combinators continuations
+destructors io io.backend io.nonblocking io.windows io.windows.nt libc
+kernel math namespaces sequences threads tuples.lib windows
+windows.errors windows.kernel32 prettyprint ;
+IN: io.windows.nt.backend
+
+SYMBOL: io-hash
+
+TUPLE: io-callback port continuation ;
+C: <io-callback> io-callback
+
+: (make-overlapped) ( -- overlapped-ext )
+    "OVERLAPPED" malloc-object dup [ free ] t add-destructor
+    0 over set-OVERLAPPED-internal
+    0 over set-OVERLAPPED-internal-high
+    0 over set-OVERLAPPED-offset-high
+    0 over set-OVERLAPPED-offset
+    f over set-OVERLAPPED-event ;
+
+: make-overlapped ( port -- overlapped-ext )
+    >r (make-overlapped) r> port-handle win32-file-ptr
+    [ over set-OVERLAPPED-offset ] when* ;
+
+: completion-port ( handle existing -- handle )
+     f 1 CreateIoCompletionPort dup win32-error=0/f ;
+
+: master-completion-port ( -- handle )
+    INVALID_HANDLE_VALUE f completion-port ;
+
+M: windows-nt-io add-completion ( handle -- )
+    \ master-completion-port get-global completion-port drop ;
+
+TUPLE: GetOverlappedResult-args hFile* lpOverlapped* lpNumberOfBytesTransferred* bWait* port ;
+
+C: <GetOverlappedResult-args> GetOverlappedResult-args
+
+: get-overlapped-result ( port -- n )
+    [
+        port-handle dup win32-file-handle
+        swap win32-file-overlapped 0 <int> 0
+    ] keep <GetOverlappedResult-args> [
+        \ GetOverlappedResult-args >tuple<
+        >r GetOverlappedResult r> swap overlapped-error? drop
+    ] keep GetOverlappedResult-args-lpNumberOfBytesTransferred* *int ;
+
+: (save-callback) ( io-callback -- )
+    dup io-callback-port port-handle win32-file-overlapped
+    \ io-hash get-global set-at ;
+
+: save-callback ( port -- )
+    [
+        <io-callback> (save-callback) stop
+    ] callcc0 drop ;
+
+TUPLE: GetQueuedCompletionStatusParams hCompletionPort* lpNumberOfBytes* lpCompletionKey* lpOverlapped* dwMilliseconds* ;
+
+C: <GetQueuedCompletionStatusParams> GetQueuedCompletionStatusParams
+
+: wait-for-overlapped ( ms -- GetQueuedCompletionStatus-Params ret )
+    >r \ master-completion-port get-global 0 <int>
+    0 <int> 0 <int> r> <GetQueuedCompletionStatusParams> [
+        GetQueuedCompletionStatusParams >tuple*<
+        GetQueuedCompletionStatus
+    ] keep swap ;
+
+: lookup-callback ( GetQueuedCompletion-args -- callback ? )
+    GetQueuedCompletionStatusParams-lpOverlapped* *void*
+    \ io-hash get-global delete-at* ;
+
+: wait-for-io ( timeout -- continuation/f )
+    wait-for-overlapped
+    zero? [
+        GetLastError dup (expected-io-error?) [
+            2drop f
+        ] [
+            (win32-error-string) swap lookup-callback [
+                [ io-callback-port set-port-error ] keep
+                io-callback-continuation
+            ] [
+                drop "No callback found" 2array throw
+            ] if
+        ] if
+    ] [
+        lookup-callback [ io-callback-continuation ] when
+    ] if ;
+
+: maybe-expire ( io-callbck -- )
+    io-callback-port
+    dup timeout? [
+        port-handle win32-file-handle CancelIo drop
+    ] [
+        drop
+    ] if ;
+
+: cancel-timedout ( -- )
+    io-hash get-global values [ maybe-expire ] each ;
+
+M: windows-nt-io io-multiplex ( ms -- )
+    cancel-timedout
+    [ wait-for-io ] [ global [ "error: " write . flush ] bind drop f ] recover
+    [ schedule-thread ] when* ;
diff --git a/extra/io/windows/nt/files/files.factor b/extra/io/windows/nt/files/files.factor
new file mode 100644 (file)
index 0000000..791b03a
--- /dev/null
@@ -0,0 +1,70 @@
+USING: continuations destructors io.buffers io.nonblocking io.windows
+io.windows.nt io.windows.nt.backend kernel libc math
+threads windows windows.kernel32 ;
+IN: io.windows.nt.files
+
+M: windows-nt-io CreateFile-flags ( -- DWORD )
+    FILE_FLAG_OVERLAPPED ;
+
+M: windows-nt-io FileArgs-overlapped ( port -- overlapped )
+    make-overlapped ;
+
+: update-file-ptr ( n port -- )
+    port-handle
+    dup win32-file-ptr [
+        rot + swap set-win32-file-ptr
+    ] [
+        2drop
+    ] if* ;
+
+DEFER: (flush-output)
+: finish-flush ( port -- )
+    dup pending-error
+    dup get-overlapped-result
+    [ over update-file-ptr ] keep
+    over delegate [ buffer-consume ] keep
+    buffer-length 0 > [
+        (flush-output)
+    ] [
+        drop
+    ] if ;
+
+: (flush-output) ( port -- )
+    dup touch-port
+    dup make-FileArgs
+    [ setup-write WriteFile ] keep
+    >r dupd overlapped-error? r> swap [
+        FileArgs-lpOverlapped over set-port-overlapped
+        dup save-callback
+        finish-flush
+    ] [
+        2drop
+    ] if ;
+
+M: windows-nt-io flush-output ( port -- )
+    [ (flush-output) ] with-destructors ;
+
+: finish-read ( port -- )
+    dup pending-error
+    dup get-overlapped-result dup zero? [
+        drop t swap set-port-eof?
+    ] [
+        [ over n>buffer ] keep
+        swap update-file-ptr
+    ] if ;
+
+: ((wait-to-read)) ( port -- )
+    dup touch-port
+    dup make-FileArgs
+    [ setup-read ReadFile ] keep
+    >r dupd overlapped-error? r> swap [
+        FileArgs-lpOverlapped over set-port-overlapped
+        dup save-callback
+        finish-read
+    ] [
+        2drop
+    ] if ;
+
+M: input-port (wait-to-read) ( port -- )
+    [ ((wait-to-read)) ] with-destructors ;
+
diff --git a/extra/io/windows/nt/nt.factor b/extra/io/windows/nt/nt.factor
new file mode 100644 (file)
index 0000000..5370580
--- /dev/null
@@ -0,0 +1,51 @@
+! Copyright (C) 2004, 2007 Mackenzie Straight, Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types assocs byte-arrays combinators
+io.backend io.files io.nonblocking io.windows
+kernel libc math namespaces qualified sequences
+splitting strings threads windows windows.errors windows.winsock
+windows.kernel32 ;
+QUALIFIED: windows.winsock
+IN: io.windows.nt
+
+: unicode-prefix ( -- seq )
+    "\\\\?\\" ; inline
+M: windows-nt-io normalize-pathname ( string -- string )
+    dup string? [ "pathname must be a string" throw ] unless
+    "/" split "\\" join
+    {
+        ! empty
+        { [ dup empty? ] [ "empty path" throw ] }
+        ! .\\foo
+        { [ dup ".\\" head? ] [
+            >r unicode-prefix cwd r> 1 tail 3append
+        ] }
+        ! c:\\
+        { [ dup 1 tail ":" head? ] [ >r unicode-prefix r> append ] }
+        ! \\\\?\\c:\\foo
+        { [ dup unicode-prefix head? ] [ ] }
+        ! foo.txt ..\\foo.txt
+        { [ t ] [
+            [
+                unicode-prefix % cwd %
+                dup first CHAR: \\ = [ CHAR: \\ , ] unless %
+            ] "" make
+        ] }
+    } cond [ "/\\." member? ] rtrim ;
+
+USE: io.windows.nt.backend
+USE: io.windows.nt.files
+USE: io.windows.nt.sockets
+
+T{ windows-nt-io } io-backend set-global
+
+M: windows-nt-io init-io ( -- )
+    #! Should only be called on startup. Calling this at any
+    #! other time can have unintended consequences.
+    global [
+        master-completion-port \ master-completion-port set
+        H{ } clone \ io-hash set
+        init-winsock
+    ] bind ;
+
diff --git a/extra/io/windows/nt/sockets/sockets.factor b/extra/io/windows/nt/sockets/sockets.factor
new file mode 100644 (file)
index 0000000..1817320
--- /dev/null
@@ -0,0 +1,270 @@
+USING: alien alien.c-types byte-arrays continuations destructors
+io.nonblocking io io.sockets io.sockets.impl
+io.streams.duplex io.windows io.windows.nt io.windows.nt.backend
+windows.winsock kernel libc math sequences threads tuples.lib ;
+IN: io.windows.nt.sockets
+
+: malloc-int ( object -- object )
+    "int" heap-size malloc tuck 0 set-alien-signed-4 ; inline
+
+M: windows-nt-io WSASocket-flags ( -- DWORD )
+    WSA_FLAG_OVERLAPPED ;
+
+: get-ConnectEx-ptr ( socket -- void* )
+    SIO_GET_EXTENSION_FUNCTION_POINTER
+    WSAID_CONNECTEX
+    "GUID" heap-size
+    "void*" <c-object>
+    [
+        "void*" heap-size
+        "DWORD" <c-object>
+        f
+        f
+        WSAIoctl SOCKET_ERROR = [
+            winsock-error-string throw
+        ] when
+    ] keep *void* ;
+
+TUPLE: ConnectEx-args port
+    s* name* namelen* lpSendBuffer* dwSendDataLength*
+    lpdwBytesSent* lpOverlapped* ptr* ;
+
+: init-connect ( sockaddr sockaddr-name ConnectEx -- )
+    >r heap-size r>
+    [ set-ConnectEx-args-namelen* ] keep
+    [ set-ConnectEx-args-name* ] keep
+    f over set-ConnectEx-args-lpSendBuffer*
+    0 over set-ConnectEx-args-dwSendDataLength*
+    f over set-ConnectEx-args-lpdwBytesSent*
+    (make-overlapped) swap set-ConnectEx-args-lpOverlapped* ;
+
+: (ConnectEx) ( ConnectEx -- )
+    \ ConnectEx-args >tuple*<
+    "int"
+    { "SOCKET" "sockaddr_in*" "int" "PVOID" "DWORD" "LPDWORD" "void*" }
+    "stdcall" alien-indirect drop
+    winsock-error-string [ throw ] when* ;
+
+: check-connect-error ( ConnectEx -- )
+    ConnectEx-args-port duplex-stream-in get-overlapped-result drop ;
+
+: connect-continuation ( duplex-stream ConnectEx -- )
+    [ ConnectEx-args-port duplex-stream-in save-callback ] keep
+    check-connect-error ;
+
+M: windows-nt-io (client) ( addrspec -- duplex-stream )
+    [
+        \ ConnectEx-args construct-empty
+        over make-sockaddr pick init-connect
+        over tcp-socket over set-ConnectEx-args-s*
+        dup ConnectEx-args-s* add-completion
+        dup ConnectEx-args-s* get-ConnectEx-ptr over set-ConnectEx-args-ptr*
+        dup ConnectEx-args-s* INADDR_ANY roll bind-socket
+        dup (ConnectEx)
+
+        dup ConnectEx-args-s* <win32-socket> dup handle>duplex-stream
+        over set-ConnectEx-args-port
+
+        [
+            dup ConnectEx-args-lpOverlapped*
+            swap ConnectEx-args-port duplex-stream-in set-port-overlapped
+        ] keep
+        dup connect-continuation
+        ConnectEx-args-port
+        [ duplex-stream-in pending-error ] keep
+        [ duplex-stream-out pending-error ] keep
+    ] with-destructors ;
+
+TUPLE: AcceptEx-args port
+    sListenSocket* sAcceptSocket* lpOutputBuffer* dwReceiveDataLength*
+    dwLocalAddressLength* dwRemoteAddressLength* lpdwBytesReceived* lpOverlapped* ;
+
+: init-accept-buffer ( server-port AcceptEx -- )
+    >r server-port-addr sockaddr-type heap-size 16 +
+    dup dup 2 * malloc dup [ free ] t add-destructor r>
+    [ set-AcceptEx-args-lpOutputBuffer* ] keep
+    [ set-AcceptEx-args-dwLocalAddressLength* ] keep
+    set-AcceptEx-args-dwRemoteAddressLength* ;
+
+: init-accept ( server-port AcceptEx -- )
+    [ init-accept-buffer ] 2keep
+    [ set-AcceptEx-args-port ] 2keep
+    >r port-handle win32-file-handle r> [ set-AcceptEx-args-sListenSocket* ] keep
+    dup AcceptEx-args-port server-port-addr tcp-socket
+    over set-AcceptEx-args-sAcceptSocket*
+    0 over set-AcceptEx-args-dwReceiveDataLength*
+    f over set-AcceptEx-args-lpdwBytesReceived*
+    (make-overlapped) over set-AcceptEx-args-lpOverlapped*
+    dup AcceptEx-args-lpOverlapped* swap AcceptEx-args-port set-port-overlapped ;
+
+: (accept) ( AcceptEx -- )
+    \ AcceptEx-args >tuple*<
+    AcceptEx drop
+    winsock-error-string [ throw ] when* ;
+
+: make-accept-continuation ( AcceptEx -- )
+    AcceptEx-args-port save-callback ;
+
+: check-accept-error ( AcceptEx -- )
+    AcceptEx-args-port get-overlapped-result drop ;
+
+: extract-remote-host ( AcceptEx -- addrspec )
+    [
+        [ AcceptEx-args-lpOutputBuffer* ] keep
+        [ AcceptEx-args-dwReceiveDataLength* ] keep
+        [ AcceptEx-args-dwLocalAddressLength* ] keep
+        AcceptEx-args-dwRemoteAddressLength*
+        f <void*>
+        0 <int>
+        f <void*> [
+            0 <int> GetAcceptExSockaddrs
+        ] keep *void*
+    ] keep AcceptEx-args-port server-port-addr parse-sockaddr ;
+
+: accept-continuation ( AcceptEx -- client )
+    [ make-accept-continuation ] keep
+    [ check-accept-error ] keep
+    [ extract-remote-host ] keep
+    ! addrspec AcceptEx
+    [
+        AcceptEx-args-sAcceptSocket* add-completion
+    ] keep
+    AcceptEx-args-sAcceptSocket* <win32-socket> dup handle>duplex-stream
+    <client-stream> ;
+
+M: windows-nt-io accept ( server -- client )
+    [
+        dup check-server-port
+        dup touch-port
+        \ AcceptEx-args construct-empty
+        [ init-accept ] keep
+        [ (accept) ] keep
+        [ accept-continuation ] keep
+        AcceptEx-args-port pending-error
+        dup duplex-stream-in pending-error
+        dup duplex-stream-out pending-error
+    ] with-destructors ;
+
+M: windows-nt-io <server> ( addrspec -- server )
+    [
+        [
+            SOCK_STREAM server-fd dup listen-on-socket
+            dup add-completion
+            <win32-socket> f <port>
+        ] keep <server-port>
+    ] with-destructors ;
+
+
+M: windows-nt-io <datagram> ( addrspec -- datagram )
+    [
+        [
+            SOCK_DGRAM server-fd
+            dup add-completion
+            <win32-socket> f <port>
+        ] keep <datagram-port>
+    ] with-destructors ;
+
+TUPLE: WSARecvFrom-args port
+       s* lpBuffers* dwBufferCount* lpNumberOfBytesRecvd*
+       lpFlags* lpFrom* lpFromLen* lpOverlapped* lpCompletionRoutine* ;
+
+: init-WSARecvFrom ( datagram WSARecvFrom -- )
+    [ set-WSARecvFrom-args-port ] 2keep
+    [
+        >r delegate port-handle delegate win32-file-handle r>
+        set-WSARecvFrom-args-s*
+    ] 2keep [
+        >r datagram-port-addr sockaddr-type heap-size r>
+        2dup >r malloc dup [ free ] t add-destructor r> set-WSARecvFrom-args-lpFrom*
+        >r malloc-int dup [ free ] t add-destructor r> set-WSARecvFrom-args-lpFromLen*
+    ] keep
+    "WSABUF" malloc-object dup [ free ] t add-destructor
+    2dup swap set-WSARecvFrom-args-lpBuffers*
+    default-buffer-size [ malloc dup [ free ] t add-destructor ] keep
+    pick set-WSABUF-len
+    swap set-WSABUF-buf
+    1 over set-WSARecvFrom-args-dwBufferCount*
+    0 malloc-int dup [ free ] t add-destructor over set-WSARecvFrom-args-lpFlags*
+    0 malloc-int dup [ free ] t add-destructor over set-WSARecvFrom-args-lpNumberOfBytesRecvd*
+    (make-overlapped) [ over set-WSARecvFrom-args-lpOverlapped* ] keep
+    swap WSARecvFrom-args-port set-port-overlapped ;
+
+: make-WSARecvFrom-continuation ( WSARecvFrom -- )
+    WSARecvFrom-args-port save-callback ;
+
+: call-WSARecvFrom ( WSARecvFrom -- )
+    \ WSARecvFrom-args >tuple*<
+    WSARecvFrom
+    socket-error* ;
+
+: WSARecvFrom-continuation ( WSARecvFrom -- n )
+    [ make-WSARecvFrom-continuation ] keep
+    WSARecvFrom-args-port get-overlapped-result ;
+
+: parse-WSARecvFrom ( n WSARecvFrom -- packet addrspec )
+    [
+        WSARecvFrom-args-lpBuffers* WSABUF-buf
+        swap memory>string >byte-array
+    ] keep
+    [ WSARecvFrom-args-lpFrom* ] keep
+    WSARecvFrom-args-port datagram-port-addr parse-sockaddr ;
+
+M: windows-nt-io receive ( datagram -- packet addrspec )
+    [
+        dup check-datagram-port
+        \ WSARecvFrom-args construct-empty
+        [ init-WSARecvFrom ] keep
+        [ call-WSARecvFrom ] keep
+        [ WSARecvFrom-continuation ] keep
+        [ WSARecvFrom-args-port pending-error ] keep
+        parse-WSARecvFrom
+    ] with-destructors ;
+
+TUPLE: WSASendTo-args port
+       s* lpBuffers* dwBufferCount* lpNumberOfBytesSent*
+       dwFlags* lpTo* iToLen* lpOverlapped* lpCompletionRoutine* ;
+
+: init-WSASendTo ( packet addrspec datagram WSASendTo -- )
+    [ set-WSASendTo-args-port ] 2keep
+    [
+        >r delegate port-handle delegate win32-file-handle r>
+        set-WSASendTo-args-s*
+    ] keep [
+        >r make-sockaddr >r
+        malloc-byte-array dup [ free ] t add-destructor
+        r> heap-size r>
+        [ set-WSASendTo-args-iToLen* ] keep
+        set-WSASendTo-args-lpTo*
+    ] keep [
+        "WSABUF" malloc-object dup [ free ] t add-destructor
+        dup rot set-WSASendTo-args-lpBuffers*
+        swap [ malloc-byte-array dup [ free ] t add-destructor ] keep length
+        rot [ set-WSABUF-len ] keep
+        set-WSABUF-buf
+    ] keep
+    1 over set-WSASendTo-args-dwBufferCount*
+    0 over set-WSASendTo-args-dwFlags*
+    (make-overlapped) [ over set-WSASendTo-args-lpOverlapped* ] keep
+    swap WSASendTo-args-port set-port-overlapped ;
+
+: make-WSASendTo-continuation ( WSASendTo -- )
+    WSASendTo-args-port save-callback ;
+
+: WSASendTo-continuation ( WSASendTo -- )
+    [ make-WSASendTo-continuation ] keep
+    WSASendTo-args-port get-overlapped-result drop ;
+
+: call-WSASendTo ( WSASendTo -- )
+    \ WSASendTo-args >tuple*<
+    WSASendTo socket-error* ;
+
+M: windows-nt-io send ( packet addrspec datagram -- )
+    [
+        3dup check-datagram-send
+        \ WSASendTo-args construct-empty
+        [ init-WSASendTo ] keep
+        [ call-WSASendTo ] keep
+        [ WSASendTo-continuation ] keep
+        WSASendTo-args-port pending-error
+    ] with-destructors ;
+
diff --git a/extra/io/windows/nt/summary.txt b/extra/io/windows/nt/summary.txt
new file mode 100644 (file)
index 0000000..0e1b3e2
--- /dev/null
@@ -0,0 +1 @@
+Microsoft Windows XP/Vista native I/O implementation
diff --git a/extra/io/windows/summary.txt b/extra/io/windows/summary.txt
new file mode 100644 (file)
index 0000000..2a2d544
--- /dev/null
@@ -0,0 +1 @@
+Microsoft Windows native I/O implementation
diff --git a/extra/io/windows/windows-tests.factor b/extra/io/windows/windows-tests.factor
new file mode 100644 (file)
index 0000000..09c043c
--- /dev/null
@@ -0,0 +1,16 @@
+USING: kernel ;
+IN: temporary
+
+[ "c:\\foo\\" ] [ "c:\\foo\\bar" parent-dir ] unit-test
+[ "c:\\" ] [ "c:\\foo\\" parent-dir ] unit-test
+[ "c:\\" ] [ "c:\\foo" parent-dir ] unit-test
+! { "c:" "c:\\" "c:/" } [ directory ] each -- all do the same thing
+[ "c:\\" ] [ "c:\\" parent-dir ] unit-test
+[ "Z:\\" ] [ "Z:\\" parent-dir ] unit-test
+[ "c:" ] [ "c:" parent-dir ] unit-test
+[ "Z:" ] [ "Z:" parent-dir ] unit-test
+[ t ] [ "c:\\" root-directory? ] unit-test
+[ t ] [ "Z:\\" root-directory? ] unit-test
+[ f ] [ "c:\\foo" root-directory? ] unit-test
+[ f ] [ "." root-directory? ] unit-test
+[ f ] [ ".." root-directory? ] unit-test
diff --git a/extra/io/windows/windows.factor b/extra/io/windows/windows.factor
new file mode 100644 (file)
index 0000000..b564869
--- /dev/null
@@ -0,0 +1,191 @@
+USING: alien alien.c-types arrays destructors io
+io.backend io.buffers io.files io.nonblocking io.sockets
+io.sockets.impl windows.errors strings io.streams.duplex
+kernel math namespaces sequences windows
+windows.kernel32 windows.winsock windows.winsock.private ;
+USE: prettyprint
+IN: io.windows
+
+TUPLE: windows-nt-io ;
+TUPLE: windows-ce-io ;
+UNION: windows-io windows-nt-io windows-ce-io ;
+
+M: windows-io root-directory? ( path -- ? )
+    [ path-separator? ] rtrim
+    dup length 2 = [
+        dup first Letter?
+        swap second CHAR: : = and
+    ] [
+        drop f
+    ] if ;
+
+TUPLE: win32-file handle ptr overlapped ;
+
+: <win32-file>  ( handle ptr -- obj )
+    { set-win32-file-handle set-win32-file-ptr }
+    \ win32-file construct ;
+
+: set-port-overlapped ( overlapped port -- )
+    port-handle set-win32-file-overlapped ;
+
+: port-overlapped ( port -- overlapped )
+    port-handle win32-file-overlapped ;
+
+HOOK: CreateFile-flags io-backend ( -- DWORD )
+HOOK: flush-output io-backend ( port -- )
+HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f )
+HOOK: add-completion io-backend ( port -- )
+
+M: windows-io normalize-directory ( string -- string )
+    dup peek CHAR: \\ = "*" "\\*" ? append ;
+
+: share-mode ( -- fixnum )
+    FILE_SHARE_READ FILE_SHARE_WRITE bitor ; inline
+
+M: win32-file init-handle ( handle -- ) drop ;
+
+! Clean up resources (open handle) if add-completion fails
+: open-file ( path access-mode create-mode -- handle )
+    [
+        >r share-mode f r> CreateFile-flags f CreateFile
+        dup invalid-handle? dup [ CloseHandle drop ] f add-destructor
+        dup add-completion
+    ] with-destructors ;
+
+: open-pipe-r/w ( path -- handle )
+    GENERIC_READ GENERIC_WRITE bitor OPEN_EXISTING open-file ;
+
+: open-read ( path -- handle length )
+    normalize-pathname GENERIC_READ OPEN_EXISTING open-file 0 ;
+
+: open-write ( path -- handle length )
+    normalize-pathname GENERIC_WRITE CREATE_ALWAYS open-file 0 ;
+
+: (open-append) ( path -- handle )
+    normalize-pathname GENERIC_WRITE OPEN_ALWAYS open-file ;
+
+: open-append ( path -- handle length )
+    dup file-length dup
+    [ >r (open-append) r> ] [ drop open-write ] if ;
+
+TUPLE: FileArgs
+    hFile lpBuffer nNumberOfBytesToRead lpNumberOfBytesRet lpOverlapped ;
+
+C: <FileArgs> FileArgs
+
+: make-FileArgs ( port -- <FileArgs> )
+    [ port-handle win32-file-handle ] keep
+    [ delegate ] keep
+    [
+        buffer-length
+        "DWORD" <c-object>
+    ] keep FileArgs-overlapped <FileArgs> ;
+
+: setup-read ( <FileArgs> -- hFile lpBuffer nNumberOfBytesToRead lpNumberOfBytesRead lpOverlapped )
+    [ FileArgs-hFile ] keep
+    [ FileArgs-lpBuffer buffer-end ] keep
+    [ FileArgs-lpBuffer buffer-capacity ] keep
+    [ FileArgs-lpNumberOfBytesRet ] keep
+    FileArgs-lpOverlapped ;
+
+: setup-write ( <FileArgs> -- hFile lpBuffer nNumberOfBytesToWrite lpNumberOfBytesWritten lpOverlapped )
+    [ FileArgs-hFile ] keep
+    [ FileArgs-lpBuffer buffer@ ] keep
+    [ FileArgs-lpBuffer buffer-length ] keep
+    [ FileArgs-lpNumberOfBytesRet ] keep
+    FileArgs-lpOverlapped ;
+
+M: output-port stream-flush ( port -- )
+    dup buffer-empty? [
+        dup flush-output
+    ] unless pending-error ;
+
+M: port stream-close ( port -- )
+    dup port-type closed = [
+        drop
+    ] [
+        ! For duplex-streams, we call CloseHandle twice on the same handle
+        [ dup port-type output = [ stream-flush ] [ drop ] if ] keep
+        [ closed swap set-port-type ] keep
+        [ port-handle win32-file-handle CloseHandle drop ] keep
+        USE: namespaces
+        [ delegate [ buffer-free ] [
+            global [ "delegate was empty!!" print flush ] bind
+            USE: windows.winsock.private
+        ] if* ] keep
+        f swap set-delegate
+    ] if ;
+
+M: windows-io <file-reader> ( path -- stream )
+    open-read <win32-file> <reader> ;
+
+M: windows-io <file-writer> ( path -- stream )
+    open-write <win32-file> <writer> ;
+
+M: windows-io <file-appender> ( path -- stream )
+    open-append <win32-file> <writer> ;
+
+M: windows-io rename-file ( from to -- )
+    [ normalize-pathname ] 2apply
+    MoveFile win32-error=0/f ;
+
+M: windows-io delete-file ( path -- )
+    normalize-pathname
+    DeleteFile win32-error=0/f ;
+
+M: windows-io make-directory ( path -- )
+    normalize-pathname
+    f CreateDirectory win32-error=0/f ;
+
+M: windows-io delete-directory ( path -- )
+    normalize-pathname
+    RemoveDirectory win32-error=0/f ;
+
+HOOK: WSASocket-flags io-backend ( -- DWORD )
+
+TUPLE: win32-socket ;
+
+: <win32-socket> ( handle -- win32-socket )
+    f <win32-file>
+    \ win32-socket construct-delegate ;
+
+: open-socket ( family type -- socket )
+    0 f 0 WSASocket-flags WSASocket dup socket-error ;
+
+USE: windows.winsock
+: init-sockaddr ( port# addrspec -- sockaddr )
+    dup sockaddr-type <c-object>
+    [ swap protocol-family swap set-sockaddr-in-family ] keep
+    [ >r htons r> set-sockaddr-in-port ] keep ;
+
+: server-sockaddr ( port# addrspec -- sockaddr )
+    init-sockaddr
+    [ INADDR_ANY swap set-sockaddr-in-addr ] keep ;
+
+: bind-socket ( socket sockaddr addrspec -- )
+    [ server-sockaddr ] keep
+    sockaddr-type heap-size bind socket-error ;
+
+: server-fd ( addrspec type -- fd )
+    >r dup protocol-family r> open-socket
+        dup [ closesocket drop ] f add-destructor
+    dup rot make-sockaddr heap-size bind socket-error ;
+
+USE: namespaces
+
+! http://support.microsoft.com/kb/127144
+! NOTE: Possibly tweak this because of SYN flood attacks
+: listen-backlog ( -- n ) HEX: 7fffffff ; inline
+
+: listen-on-socket ( socket -- )
+    listen-backlog listen winsock-error!=0/f ;
+
+M: win32-socket stream-close ( stream -- )
+    win32-file-handle closesocket drop ;
+
+M: windows-io addrinfo-error ( n -- )
+    winsock-error!=0/f ;
+
+: tcp-socket ( addrspec -- socket )
+    protocol-family SOCK_STREAM open-socket ;
+
diff --git a/extra/irc/authors.txt b/extra/irc/authors.txt
new file mode 100644 (file)
index 0000000..5674120
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Slava Pestov
diff --git a/extra/irc/irc.factor b/extra/irc/irc.factor
new file mode 100644 (file)
index 0000000..0f2a0fb
--- /dev/null
@@ -0,0 +1,210 @@
+! Copyright (C) 2007 Doug Coleman, Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays calendar io io.sockets kernel match namespaces
+sequences splitting strings continuations threads ;
+IN: irc
+
+! "setup" objects
+TUPLE: profile server port nickname password default-channels ;
+C: <profile> profile
+
+TUPLE: channel-profile name password auto-rejoin ;
+C: <channel-profile> channel-profile
+
+! "live" objects
+TUPLE: irc-client profile nick stream stream-process controller-process ;
+C: <irc-client> irc-client
+
+TUPLE: nick name channels log ;
+C: <nick> nick
+
+TUPLE: channel name topic members log attributes ;
+C: <channel> channel
+
+! the delegate of all irc messages
+TUPLE: irc-message timestamp ;
+C: <irc-message> irc-message
+
+! "irc message" objects
+TUPLE: logged-in name text ;
+C: <logged-in> logged-in
+
+TUPLE: ping name ;
+C: <ping> ping
+
+TUPLE: join name channel ;
+C: <join> join
+
+TUPLE: part name channel text ;
+C: <part> part
+
+TUPLE: quit text ;
+C: <quit> quit
+
+TUPLE: privmsg name text ;
+C: <privmsg> privmsg
+
+TUPLE: kick channel er ee text ;
+C: <kick> kick
+
+TUPLE: roomlist channel names ;
+C: <roomlist> roomlist
+
+TUPLE: nick-in-use name ;
+C: <nick-in-use> nick-in-use
+
+TUPLE: notice type text ;
+C: <notice> notice
+
+TUPLE: mode name channel mode text ;
+C: <mode> mode
+! TUPLE: members
+
+TUPLE: unhandled text ;
+C: <unhandled> unhandled
+
+! "control message" objects
+TUPLE: command sender ;
+TUPLE: service predicate quot enabled? ;
+TUPLE: chat-command from to text ;
+TUPLE: join-command channel password ;
+TUPLE: part-command channel text ;
+
+SYMBOL: irc-client
+: irc-stream> ( -- stream ) irc-client get irc-client-stream ;
+: trim-: ( seq -- seq ) [ CHAR: : = ] ltrim ;
+: parse-name ( string -- string )
+    trim-: "!" split first ;
+: irc-split ( string -- seq )
+    1 swap [ [ CHAR: : = ] find* ] keep
+    swap [ cut trim-: ] [ nip f ] if >r [ blank? ] trim trim-:
+    " " split r> [ 1array append ] when* ;
+: me? ( name -- ? )
+    irc-client get irc-client-nick nick-name = ;
+
+: irc-write ( s -- )
+    irc-stream> stream-write ;
+
+: irc-print ( s -- )
+    irc-stream> [ stream-print ] keep stream-flush ;
+
+: nick ( nick -- )
+    "NICK " irc-write irc-print ;
+
+: login ( nick -- )
+    dup nick
+    "USER " irc-write irc-write
+    " hostname servername :irc.factor" irc-print ;
+
+: connect* ( server port -- )
+    <inet> <client> irc-client get set-irc-client-stream ;
+
+: connect ( server -- ) 6667 connect* ;
+
+: join ( channel password -- )
+    "JOIN " irc-write
+    [ >r " :" r> 3append ] when* irc-print ;
+
+: part ( channel text -- )
+    >r "PART " irc-write irc-write r>
+    " :" irc-write irc-print ;
+
+: say ( line nick -- )
+    "PRIVMSG " irc-write irc-write " :" irc-write irc-print ;
+
+: quit ( text -- )
+    "QUIT :" irc-write irc-print ;
+
+
+GENERIC: handle-irc ( obj -- )
+
+M: object handle-irc ( obj -- )
+    "Unhandled irc object" print drop ;
+
+M: logged-in handle-irc ( obj -- )
+    logged-in-name irc-client get [ irc-client-nick set-nick-name ] keep
+    
+    irc-client-profile profile-default-channels
+    [
+        [ channel-profile-name ] keep
+        channel-profile-password join
+    ] each ;
+
+M: ping handle-irc ( obj -- )
+    "PONG " irc-write
+    ping-name irc-print ;
+
+M: nick-in-use handle-irc ( obj -- )
+    nick-in-use-name "_" append nick ;
+
+: delegate-timestamp ( obj -- obj )
+    now <irc-message> over set-delegate ;
+
+MATCH-VARS: ?name ?name2 ?channel ?text ?mode ;
+SYMBOL: line
+: match-irc ( string -- )
+    dup line set
+    dup print flush
+    irc-split
+    {
+        { { "PING" ?name }
+          [ ?name <ping> ] }
+        { { ?name "001" ?name2 ?text }
+          [ ?name2 ?text <logged-in> ] }
+        { { ?name "433" _ ?name2 "Nickname is already in use." }
+          [ ?name2 <nick-in-use> ] }
+
+        { { ?name "JOIN" ?channel }
+          [ ?name ?channel <join> ] }
+        { { ?name "PART" ?channel ?text }
+          [ ?name ?channel ?text <part> ] }
+        { { ?name "PRIVMSG" ?channel ?text }
+          [ ?name ?channel ?text <privmsg> ] }
+        { { ?name "QUIT" ?text }
+          [ ?name ?text <quit> ] }
+
+        { { "NOTICE" ?name ?text }
+          [ ?name ?text <notice> ] }
+        { { ?name "MODE" ?channel ?mode ?text }
+          [ ?name ?channel ?mode ?text <mode> ] }
+        { { ?name "KICK" ?channel ?name2 ?text }
+          [  ?channel ?name ?name2 ?text <kick> ] }
+
+        ! { { ?name "353" ?name2 _ ?channel ?text }
+         ! [ ?text ?channel ?name2 make-member-list ] }
+        { _ [ line get <unhandled> ] }
+    } match-cond
+    delegate-timestamp handle-irc flush ;
+
+: irc-loop ( -- )
+    irc-stream> stream-readln
+    [ match-irc irc-loop ] when* ;
+
+: do-irc ( irc-client -- )
+    dup irc-client set
+    dup irc-client-profile profile-server
+    over irc-client-profile profile-port connect*
+    dup irc-client-profile profile-nickname login
+    [ irc-loop ] [ irc-stream> stream-close ] [ ] cleanup ;
+
+: with-infinite-loop ( quot timeout -- quot timeout )
+    "looping" print flush
+    over catch drop dup sleep with-infinite-loop ;
+
+: start-irc ( irc-client -- )
+    ! [ [ do-irc ] curry 3000 with-infinite-loop ] with-scope ;
+    [ do-irc ] curry 3000 with-infinite-loop ;
+
+
+! For testing
+: make-factorbot
+    "irc.freenode.org" 6667 "factorbot" f
+    [
+        "#concatenative-flood" f f <channel-profile> ,
+    ] { } make <profile>
+    f V{ } clone V{ } clone <nick>
+    f f f <irc-client> ;
+
+: test-factorbot
+    make-factorbot start-irc ;
+
diff --git a/extra/irc/summary.txt b/extra/irc/summary.txt
new file mode 100644 (file)
index 0000000..a263cfe
--- /dev/null
@@ -0,0 +1 @@
+An IRC client framework
diff --git a/extra/json/reader/authors.txt b/extra/json/reader/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/json/reader/reader-docs.factor b/extra/json/reader/reader-docs.factor
new file mode 100644 (file)
index 0000000..43edb6c
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax json.reader ;
+
+HELP: json> "( string -- object )"
+{ $values { "string" "a string in JSON format" } { "object" "yhe object deserialized from the JSON string" } }
+{ $description "Deserializes the JSON formatted string into a Factor object. JSON objects are converted to Factor hashtables. All other JSON objects convert to their obvious Factor equivalents." } ;
\ No newline at end of file
diff --git a/extra/json/reader/reader.factor b/extra/json/reader/reader.factor
new file mode 100644 (file)
index 0000000..0f77410
--- /dev/null
@@ -0,0 +1,160 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel parser-combinators namespaces sequences promises strings 
+       assocs math math.parser math.vectors math.functions
+       lazy-lists hashtables ;
+IN: json.reader
+
+! Grammar for JSON from RFC 4627
+
+: [<&>] ( quot -- quot )
+  { } make unclip [ <&> ] reduce ;
+
+: [<|>] ( quot -- quot )
+  { } make unclip [ <|> ] reduce ;
+
+LAZY: 'ws' ( -- parser )
+  " " token 
+  "\n" token <|>
+  "\r" token <|>
+  "\t" token <|> 
+  "" token <|> ;
+
+LAZY: spaced ( parser -- parser )
+  'ws' swap &> 'ws' <& ;
+
+LAZY: 'begin-array' ( -- parser )
+  "[" token spaced ;
+
+LAZY: 'begin-object' ( -- parser )
+  "{" token spaced ;
+
+LAZY: 'end-array' ( -- parser )
+  "]" token spaced ;
+
+LAZY: 'end-object' ( -- parser )
+  "}" token spaced ;
+
+LAZY: 'name-separator' ( -- parser )
+  ":" token spaced ;
+
+LAZY: 'value-separator' ( -- parser )
+  "," token spaced ;
+
+LAZY: 'false' ( -- parser )
+  "false" token ;
+
+LAZY: 'null' ( -- parser )
+  "null" token ;
+
+LAZY: 'true' ( -- parser )
+  "true" token ;
+
+LAZY: 'quot' ( -- parser )
+  "\"" token ;
+
+LAZY: 'string' ( -- parser )
+  'quot' 
+  [ 
+    [ quotable? ] keep
+    [ CHAR: \\ = or ] keep 
+    CHAR: " = not and 
+  ] satisfy <*> &> 
+  'quot' <& [ >string ] <@  ;
+
+DEFER: 'value'
+
+LAZY: 'member' ( -- parser )
+  'string'
+  'name-separator' <&  
+  'value' <&> ;
+
+USE: prettyprint 
+LAZY: 'object' ( -- parser )
+  'begin-object' 
+  'member' 'value-separator' list-of &>
+  'end-object' <& [ >hashtable ] <@ ;
+
+LAZY: 'array' ( -- parser )
+  'begin-array' 
+  'value' 'value-separator' list-of &>
+  'end-array' <&  ;
+  
+LAZY: 'minus' ( -- parser )
+  "-" token ;
+
+LAZY: 'plus' ( -- parser )
+  "+" token ;
+
+LAZY: 'zero' ( -- parser )
+  "0" token [ drop 0 ] <@ ;
+
+LAZY: 'decimal-point' ( -- parser )
+  "." token ;
+
+LAZY: 'digit1-9' ( -- parser )
+  [ 
+    dup integer? [ 
+      CHAR: 1 CHAR: 9 between? 
+    ] [ 
+      drop f 
+    ] if 
+  ] satisfy [ digit> ] <@ ;
+
+LAZY: 'digit0-9' ( -- parser )
+  [ digit? ] satisfy [ digit> ] <@ ;
+
+: decimal>integer ( seq -- num ) 10 swap digits>integer ;
+
+LAZY: 'int' ( -- parser )
+  'zero' 
+  'digit1-9' 'digit0-9' <*> <&:> [ decimal>integer ] <@ <|>  ;
+
+LAZY: 'e' ( -- parser )
+  "e" token "E" token <|> ;
+
+: sign-number ( pair -- number )
+  #! Pair is { minus? num }
+  #! Convert the json number value to a factor number
+  dup second swap first [ -1 * ] when ;
+
+LAZY: 'exp' ( -- parser )
+    'e' 
+    'minus' 'plus' <|> <?> &>
+    'digit0-9' <+> [ decimal>integer ] <@ <&> [ sign-number ] <@ ;
+
+: sequence>frac ( seq -- num ) 
+  #! { 1 2 3 } => 0.123
+  reverse 0 [ swap 10 / + ] reduce 10 / >float ;
+
+LAZY: 'frac' ( -- parser )
+  'decimal-point' 'digit0-9' <+> &> [ sequence>frac ] <@ ;
+
+: raise-to-power ( pair -- num )
+  #! Pair is { num exp }.
+  #! Multiply 'num' by 10^exp
+  dup second dup [ 10 swap first ^ swap first * ] [ drop first ] if ;
+
+LAZY: 'number' ( -- parser )
+  'minus' <?>
+  [ 'int' , 'frac' 0 succeed <|> , ] [<&>] [ sum ] <@ 
+  'exp' <?> <&> [ raise-to-power ] <@ <&> [ sign-number ] <@ ;
+
+LAZY: 'value' ( -- parser )
+  [
+    'false' ,
+    'null' ,
+    'true' ,
+    'string' ,
+    'object' ,
+    'array' ,
+    'number' ,
+  ] [<|>] ;
+
+: json> ( string -- object )
+  #! Parse a json formatted string to a factor object
+  'value' parse dup nil? [ 
+    "Could not parse json" throw
+  ] [ 
+    car parse-result-parsed 
+  ] if ;
diff --git a/extra/json/reader/summary.txt b/extra/json/reader/summary.txt
new file mode 100644 (file)
index 0000000..ca038f1
--- /dev/null
@@ -0,0 +1 @@
+JSON to Factor serializer
diff --git a/extra/json/writer/authors.txt b/extra/json/writer/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/json/writer/summary.txt b/extra/json/writer/summary.txt
new file mode 100644 (file)
index 0000000..0a45ce2
--- /dev/null
@@ -0,0 +1 @@
+Factor to JSON serializer
diff --git a/extra/json/writer/writer-docs.factor b/extra/json/writer/writer-docs.factor
new file mode 100644 (file)
index 0000000..cc26f74
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax json.writer ;
+
+HELP: >json "( obj -- string )"
+{ $values { "obj" "an object" } { "string" "the object converted to JSON format" } }
+{ $description "Serializes the object into a JSON formatted string." } 
+{ $see-also json-print } ;
+
+HELP: json-print "( obj -- )"
+{ $values { "obj" "an object" } }
+{ $description "Serializes the object into a JSON formatted string and outputs it to the standard output stream." } 
+{ $see-also >json } ;
+
diff --git a/extra/json/writer/writer.factor b/extra/json/writer/writer.factor
new file mode 100644 (file)
index 0000000..fc11904
--- /dev/null
@@ -0,0 +1,58 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel io.streams.string io strings splitting sequences math 
+       math.parser assocs tuples classes words namespaces 
+       hashtables ;
+IN: json.writer
+
+#! Writes the object out to a stream in JSON format
+GENERIC: json-print ( obj -- )
+
+: >json ( obj -- string )
+  #! Returns a string representing the factor object in JSON format
+  [ json-print ] string-out ;
+
+M: f json-print ( f -- )
+  "false" write ;
+
+M: string json-print ( obj -- )
+  CHAR: " write1 "\"" split "\\\"" join CHAR: \r swap remove "\n" split "\\r\\n" join write CHAR: " write1 ;
+
+M: number json-print ( num -- )  
+  number>string write ;
+
+M: sequence json-print ( array -- string ) 
+  CHAR: [ write1 [ >json ] map "," join write CHAR: ] write1 ;
+
+: (jsvar-encode) ( char -- char )
+  #! Convert the given character to a character usable in
+  #! javascript variable names.
+  dup H{ { CHAR: - CHAR: _ } } at dup [ nip ] [ drop ] if ;
+
+: jsvar-encode ( string -- string )
+  #! Convert the string so that it contains characters usable within
+  #! javascript variable names.
+  [ (jsvar-encode) ] map ;
+  
+: slots ( object -- values names )
+  #! Given an object return an array of slots names and a sequence of slot values
+  #! the slot name and the slot value. 
+  [ tuple-slots ] keep class "slot-names" word-prop ;
+
+: slots>fields ( values names -- array )
+  #! Convert the arrays containing the slot names and values
+  #! to an array of strings suitable for describing that slot
+  #! as a field in a javascript object.
+  [ 
+    [ jsvar-encode >json % " : " % >json % ] "" make 
+  ] 2map ;
+
+M: object json-print ( object -- string )
+  CHAR: { write1 slots slots>fields "," join write CHAR: } write1 ;
+
+M: hashtable json-print ( hashtable -- string )
+  CHAR: { write1 
+  [ [ swap jsvar-encode >json % CHAR: : , >json % ] "" make ]
+  { } assoc>map "," join write 
+  CHAR: } write1 ;
+  
diff --git a/extra/koszul/koszul-tests.factor b/extra/koszul/koszul-tests.factor
new file mode 100644 (file)
index 0000000..3f5cc0e
--- /dev/null
@@ -0,0 +1,74 @@
+USING: koszul tools.test kernel sequences assocs namespaces ;
+IN: temporary
+
+[
+    { V{ { } } V{ { 1 } } V{ { 2 3 } { 7 8 } } V{ { 4 5 6 } } }
+] [
+    { { 1 } { 2 3 } { 4 5 6 } { 7 8 } { } } graded
+] unit-test
+
+SYMBOLS: x1 x2 x3 x4 z1 z2 ;
+
+[ H{ { { x1 } 3 } } ] [ x1 3 wedge ] unit-test
+
+[ H{ { { x1 } 3 } { { x2 } 4 } } ]
+[ x1 3 wedge x2 4 wedge alt+ ] unit-test
+
+x1 x2 wedge z1 d=
+x3 x4 wedge z2 d=
+
+[ H{ { { x1 x2 z2 } 1 } { { x3 x4 z1 } -1 } } ]
+[ z1 z2 wedge d ] unit-test
+
+! Unimodular example
+boundaries get clear-assoc
+
+SYMBOLS: x y z ;
+
+x y wedge z d=
+y z wedge x d=
+z x wedge y d=
+
+[ { 1 0 0 1 } ] [ { x y z } graded-betti ] unit-test
+
+! Solvable example
+boundaries get clear-assoc
+
+x y wedge y d=
+
+[ { 1 1 0 } ] [ { x y } graded-betti ] unit-test
+
+! Nilpotent example
+boundaries get clear-assoc
+
+x1 x2 wedge x3 x4 wedge alt+ z d=
+
+[ { 1 4 5 5 4 1 } ]
+[ { x1 x2 x3 x4 z } graded-betti ] unit-test
+
+[ { { 1 4 5 0 0 } { 0 0 5 4 1 } } ]
+[ { x1 x2 x3 x4 } { z } bigraded-betti ] unit-test
+
+! Free 2-step on 4 generators
+boundaries get clear-assoc
+
+SYMBOLS: e12 e13 e14 e23 e24 e34 ;
+
+x1 x2 wedge e12 d=
+x1 x3 wedge e13 d=
+x1 x4 wedge e14 d=
+x2 x3 wedge e23 d=
+x2 x4 wedge e24 d=
+x3 x4 wedge e34 d=
+
+[ { 1 4 20 56 84 90 84 56 20 4 1 } ]
+[ { x1 x2 x3 x4 e12 e13 e14 e23 e24 e34 } graded-betti ]
+unit-test
+
+! Make sure this works
+[ ] [ e12 d alt. ] unit-test
+
+[ ] [
+    { x1 x2 x3 x4 x5 x6 } { w z }
+    bigraded-laplacian-kernel bigraded-basis.
+] unit-test
diff --git a/extra/koszul/koszul.factor b/extra/koszul/koszul.factor
new file mode 100644 (file)
index 0000000..eb15336
--- /dev/null
@@ -0,0 +1,302 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs hashtables assocs io kernel math
+math.vectors math.matrices math.matrices.elimination namespaces
+parser prettyprint sequences words combinators math.parser
+splitting sorting shuffle ;
+IN: koszul
+
+! Utilities
+: SYMBOLS:
+    ";" parse-tokens [ create-in define-symbol ] each ;
+    parsing
+
+: -1^ odd? -1 1 ? ;
+
+: >alt ( obj -- vec )
+    {
+        { [ dup not ] [ drop 0 >alt ] }
+        { [ dup number? ] [ { } associate ] }
+        { [ dup array? ] [ 1 swap associate ] }
+        { [ dup hashtable? ] [ ] }
+        { [ t ] [ 1array >alt ] }
+    } cond ;
+
+: canonicalize
+    [ nip zero? not ] assoc-subset ;
+
+SYMBOL: terms
+
+: with-terms ( quot -- hash )
+    [
+        H{ } clone terms set call terms get canonicalize
+    ] with-scope ; inline
+
+! Printing elements
+: num-alt. ( n -- str )
+    {
+        { [ dup 1 = ] [ drop " + " ] }
+        { [ dup -1 = ] [ drop " - " ] }
+        { [ t ] [ number>string " + " swap append ] }
+    } cond ;
+
+: (alt.) ( basis n -- str )
+    over empty? [
+        nip number>string
+    ] [
+        num-alt.
+        swap [ word-name ] map "." join
+        append
+    ] if ;
+
+: alt. ( assoc -- )
+    dup assoc-empty? [
+        drop 0 .
+    ] [
+        [ (alt.) ] { } assoc>map concat " + " ?head drop print
+    ] if ;
+
+! Addition
+: (alt+) ( x -- )
+    terms get [ [ swap +@ ] assoc-each ] bind ;
+
+: alt+ ( x y -- x+y )
+    [ >alt ] 2apply [ (alt+) (alt+) ] with-terms ;
+
+! Multiplication
+: alt*n ( vec n -- vec )
+    dup zero? [
+        2drop H{ }
+    ] [
+        [ * ] curry assoc-map
+    ] if ;
+
+: permutation ( seq -- perm )
+    [ natural-sort ] keep [ index ] curry map ;
+
+: (inversions) ( n seq -- n )
+    [ > ] curry* subset length ;
+
+: inversions ( seq -- n )
+    0 swap [ length ] keep [
+        [ nth ] 2keep swap 1+ tail-slice (inversions) +
+    ] curry each ;
+
+: duplicates? ( seq -- ? )
+    dup prune [ length ] 2apply > ;
+
+: (wedge) ( n basis1 basis2 -- n basis )
+    append dup duplicates? [
+        2drop 0 { }
+    ] [
+        dup permutation inversions -1^ rot *
+        swap natural-sort
+    ] if ;
+
+: wedge ( x y -- x.y )
+    [ >alt ] 2apply [
+        swap [
+            [
+                2swap [
+                    swapd * -rot (wedge) +@
+                ] 2keep
+            ] assoc-each 2drop
+        ] curry assoc-each
+    ] H{ } make-assoc canonicalize ;
+
+! Differential
+SYMBOL: boundaries
+
+: d= ( value basis -- )
+    boundaries [ ?set-at ] change ;
+
+: ((d)) ( basis -- value ) boundaries get at ;
+
+: dx.y ( x y -- vec ) >r ((d)) r> wedge ;
+
+DEFER: (d)
+
+: x.dy ( x y -- vec ) (d) wedge -1 alt*n ;
+
+: (d) ( product -- value )
+    dup empty?
+    [ drop H{ } ] [ unclip swap [ x.dy ] 2keep dx.y alt+ ] if ;
+
+: linear-op ( vec quot -- vec )
+       [
+        [
+            -rot >r swap call r> alt*n (alt+)
+        ] curry assoc-each
+    ] with-terms ; inline
+
+: d ( x -- dx )
+    >alt [ (d) ] linear-op ;
+
+! Interior product
+: (interior) ( y basis-elt -- i_y[basis-elt] )
+    2dup index dup [
+        -rot remove associate
+    ] [
+        3drop 0
+    ] if ;
+
+: interior ( x y -- i_y[x] )
+    #! y is a generator
+    swap >alt [ dupd (interior) ] linear-op nip ;
+
+! Computing a basis
+: graded ( seq -- seq )
+    dup 0 [ length max ] reduce 1+ [ drop V{ } clone ] map
+    [ dup length pick nth push ] reduce ;
+
+: nth-basis-elt ( generators n -- elt )
+    over length [
+        3dup bit? [ nth ] [ 2drop f ] if
+    ] map [ ] subset 2nip ;
+
+: basis ( generators -- seq )
+    natural-sort dup length 2^ [ nth-basis-elt ] curry* map ;
+
+: (tensor) ( seq1 seq2 -- seq )
+    [
+        [ swap append natural-sort ] curry map
+    ] curry* map concat ;
+
+: tensor ( graded-basis1 graded-basis2 -- bigraded-basis )
+    [ [ swap (tensor) ] curry map ] curry* map ;
+
+! Computing cohomology
+: (op-matrix) ( range quot basis-elt -- row )
+    swap call [ at 0 or ] curry map ; inline
+
+: op-matrix ( domain range quot -- matrix )
+    rot [ >r 2dup r> (op-matrix) ] map 2nip ; inline
+
+: d-matrix ( domain range -- matrix )
+    [ (d) ] op-matrix ;
+
+: dim-im/ker-d ( domain range -- null/rank )
+    d-matrix null/rank 2array ;
+
+! Graded by degree
+: (graded-ker/im-d) ( n seq -- null/rank )
+    #! d: C(n) ---> C(n+1)
+    [ ?nth ] 2keep >r 1+ r> ?nth
+    dim-im/ker-d ;
+
+: graded-ker/im-d ( graded-basis -- seq )
+    [ length ] keep [ (graded-ker/im-d) ] curry map ;
+
+: graded-betti ( generators -- seq )
+    basis graded graded-ker/im-d flip first2 1 head* 0 add* v- ;
+
+! Bi-graded for two-step complexes
+: (bigraded-ker/im-d) ( u-deg z-deg bigraded-basis -- null/rank )
+    #! d: C(u,z) ---> C(u+2,z-1)
+    [ ?nth ?nth ] 3keep >r >r 2 + r> 1 - r> ?nth ?nth
+    dim-im/ker-d ;
+
+: bigraded-ker/im-d ( bigraded-basis -- seq )
+    dup length [
+        over first length [
+            >r 2dup r> swap rot (bigraded-ker/im-d)
+        ] map 2nip
+    ] curry* map ;
+
+: bigraded-betti ( u-generators z-generators -- seq )
+    [ basis graded ] 2apply tensor bigraded-ker/im-d
+    [ [ [ first ] map ] map ] keep
+    [ [ second ] map 2 head* { 0 0 } swap append ] map
+    1 tail dup first length 0 <array> add
+    [ v- ] 2map ;
+
+! Laplacian
+: m.m' dup flip m. ;
+: m'.m dup flip swap m. ;
+
+: empty-matrix? ( matrix -- ? )
+    dup empty? [ drop t ] [ first empty? ] if ;
+
+: ?m+ ( m1 m2 -- m3 )
+    over empty-matrix? [
+        nip
+    ] [
+        dup empty-matrix? [
+            drop
+        ] [
+            m+
+        ] if
+    ] if ;
+
+: laplacian-matrix ( basis1 basis2 basis3 -- matrix )
+    dupd d-matrix m.m' >r d-matrix m'.m r> ?m+ ;
+
+: laplacian-betti ( basis1 basis2 basis3 -- n )
+    laplacian-matrix null/rank drop ;
+
+: laplacian-kernel ( basis1 basis2 basis3 -- basis )
+    >r tuck r>
+    laplacian-matrix dup empty-matrix? [
+        2drop f
+    ] [
+        nullspace [
+            [ [ wedge (alt+) ] 2each ] with-terms
+        ] curry* map
+    ] if ;
+
+: graded-triple ( seq n -- triple )
+    3 [ 1- + ] curry* map swap [ ?nth ] curry map ;
+
+: graded-triples ( seq -- triples )
+    dup length [ graded-triple ] curry* map ;
+
+: graded-laplacian ( generators quot -- seq )
+    >r basis graded graded-triples [ first3 ] r> compose map ;
+    inline
+
+: graded-laplacian-betti ( generators -- seq )
+    [ laplacian-betti ] graded-laplacian ;
+
+: graded-laplacian-kernel ( generators -- seq )
+    [ laplacian-kernel ] graded-laplacian ;
+
+: graded-basis. ( seq -- )
+    dup length [
+        "=== Degree " write pprint
+        ": dimension " write dup length .
+        [ alt. ] each
+    ] 2each ;
+
+: bigraded-triple ( u-deg z-deg bigraded-basis -- triple )
+    #! d: C(u,z) ---> C(u+2,z-1)
+    [ >r >r 2 - r> 1 + r> ?nth ?nth ] 3keep
+    [ ?nth ?nth ] 3keep
+    >r >r 2 + r> 1 - r> ?nth ?nth
+    3array ;
+
+: bigraded-triples ( grid -- triples )
+    dup length [
+        over first length [
+            >r 2dup r> swap rot bigraded-triple
+        ] map 2nip
+    ] curry* map ;
+
+: bigraded-laplacian ( u-generators z-generators quot -- seq )
+    >r [ basis graded ] 2apply tensor bigraded-triples r>
+    [ [ first3 ] swap compose map ] curry map ; inline
+
+: bigraded-laplacian-betti ( u-generators z-generators -- seq )
+    [ laplacian-betti ] bigraded-laplacian ;
+
+: bigraded-laplacian-kernel ( u-generators z-generators -- seq )
+    [ laplacian-kernel ] bigraded-laplacian ;
+
+: bigraded-basis. ( seq -- )
+    dup length [
+        "=== U-degree " write .
+        dup length [
+            "  === Z-degree " write pprint
+            ": dimension " write dup length .
+            [ "  " write alt. ] each
+        ] 2each
+    ] 2each ;
diff --git a/extra/lazy-lists/authors.txt b/extra/lazy-lists/authors.txt
new file mode 100644 (file)
index 0000000..6d23bca
--- /dev/null
@@ -0,0 +1,2 @@
+Chris Double
+Matthew Willis
diff --git a/extra/lazy-lists/examples/examples-tests.factor b/extra/lazy-lists/examples/examples-tests.factor
new file mode 100644 (file)
index 0000000..14798de
--- /dev/null
@@ -0,0 +1,5 @@
+USING: lazy-lists.examples lazy-lists tools.test ;
+IN: temporary
+
+[ { 1 3 5 7 } ] [ 4 odds ltake list>array ] unit-test
+[ { 0 1 4 9 16 } ] [ first-five-squares ] unit-test
diff --git a/extra/lazy-lists/examples/examples.factor b/extra/lazy-lists/examples/examples.factor
new file mode 100644 (file)
index 0000000..2f7646a
--- /dev/null
@@ -0,0 +1,15 @@
+! Rewritten by Matthew Willis, July 2006
+! Copyright (C) 2004 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: lazy-lists math kernel sequences quotations ;
+IN: lazy-lists.examples
+
+: naturals 0 lfrom ;
+: positives 1 lfrom ;
+: evens 0 [ 2 + ] lfrom-by ;
+: odds 1 lfrom [ 2 mod 1 = ] lsubset ;
+: powers-of-2 1 [ 2 * ] lfrom-by ;
+: ones 1 [ ] lfrom-by ;
+: squares naturals [ dup * ] lmap ;
+: first-five-squares 5 squares ltake list>array ;
diff --git a/extra/lazy-lists/lazy-lists-docs.factor b/extra/lazy-lists/lazy-lists-docs.factor
new file mode 100644 (file)
index 0000000..5b53b80
--- /dev/null
@@ -0,0 +1,197 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: help.markup help.syntax sequences strings ;
+IN: lazy-lists 
+
+HELP: cons 
+{ $values { "car" "the head of the lazy list" } { "cdr" "the tail of the lazy list" } { "cons" "a cons object" } }
+{ $description "Constructs a cons cell." }
+{ $see-also cons car cdr nil nil? list? } ;
+
+HELP: car
+{ $values { "cons" "a cons object" } { "car" "the first item in the list" } }
+{ $description "Returns the first item in the list." } 
+{ $see-also cons cdr nil nil? list? } ;
+
+HELP: cdr
+{ $values { "cons" "a cons object" } { "cdr" "a cons object" } }
+{ $description "Returns the tail of the list." } 
+{ $see-also cons car nil nil? list? } ;
+
+HELP: nil 
+{ $values { "cons" "An empty cons" } }
+{ $description "Returns a representation of an empty list" } 
+{ $see-also cons car cdr nil? list? } ;
+
+HELP: nil? 
+{ $values { "cons" "a cons object" } { "?" "a boolean" } }
+{ $description "Return true if the cons object is the nil cons." } 
+{ $see-also cons car cdr nil list? } ;
+
+HELP: list? 
+{ $values { "object" "an object" } { "?" "a boolean" } }
+{ $description "Returns true if the object conforms to the list protocol." } 
+{ $see-also cons car cdr nil } ;
+
+HELP: 1list
+{ $values { "obj" "an object" } { "cons" "a cons object" } }
+{ $description "Create a list with 1 element." } 
+{ $see-also 2list 3list } ;
+
+HELP: 2list
+{ $values { "a" "an object" } { "b" "an object" } { "cons" "a cons object" } }
+{ $description "Create a list with 2 elements." } 
+{ $see-also 1list 3list } ;
+
+HELP: 3list
+{ $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" "a cons object" } }
+{ $description "Create a list with 3 elements." } 
+{ $see-also 1list 2list } ;
+
+HELP: lazy-cons
+{ $values { "car" "a quotation with stack effect ( -- X )" } { "cdr" "a quotation with stack effect ( -- cons )" } { "promise" "the resulting cons object" } }
+{ $description "Constructs a cons object for a lazy list from two quotations. The " { $snippet "car" } " quotation should return the head of the list, and the " { $snippet "cons" } " quotation the tail when called. When " { $link cons } " or " { $link cdr } " are called on the lazy-cons object then the appropriate quotation is called." } 
+{ $see-also cons car cdr nil nil? } ;
+
+HELP: 1lazy-list
+{ $values { "a" "a quotation with stack effect ( -- X )" } { "lazy-cons" "a lazy-cons object" } }
+{ $description "Create a lazy list with 1 element. The element is the result of calling the quotation. The quotation is only called when the list element is requested." } 
+{ $see-also 2lazy-list 3lazy-list } ;
+
+HELP: 2lazy-list
+{ $values { "a" "a quotation with stack effect ( -- X )" } { "b" "a quotation with stack effect ( -- X )" } { "lazy-cons" "a lazy-cons object" } }
+{ $description "Create a lazy list with 2 elements. The elements are the result of calling the quotations. The quotations are only called when the list elements are requested." } 
+{ $see-also 1lazy-list 3lazy-list } ;
+
+HELP: 3lazy-list
+{ $values { "a" "a quotation with stack effect ( -- X )" } { "b" "a quotation with stack effect ( -- X )" } { "c" "a quotation with stack effect ( -- X )" } { "lazy-cons" "a lazy-cons object" } }
+{ $description "Create a lazy list with 3 elements. The elements are the result of calling the quotations. The quotations are only called when the list elements are requested." } 
+{ $see-also 1lazy-list 2lazy-list } ;
+
+HELP: <memoized-cons>
+{ $values { "cons" "a cons object" } { "memoized-cons" "the resulting memoized-cons object" } }
+{ $description "Constructs a cons object that wraps an existing cons object. Requests for the car, cdr and nil? will be remembered after the first call, and the previous result returned on subsequent calls." } 
+{ $see-also cons car cdr nil nil? } ;
+
+HELP: lnth
+{ $values { "n" "an integer index" } { "list" "a cons object" } { "elt" "the element at the nth index" } }
+{ $description "Outputs the nth element of the list." } 
+{ $see-also llength cons car cdr } ;
+
+HELP: llength
+{ $values { "list" "a cons object" } { "n" "a non-negative integer" } }
+{ $description "Outputs the length of the list. This should not be called on an infinite list." } 
+{ $see-also lnth cons car cdr } ;
+
+HELP: uncons
+{ $values { "cons" "a cons object" } { "car" "the head of the list" } { "cdr" "the tail of the list" } }
+{ $description "Put the head and tail of the list on the stack." } 
+{ $see-also cons car cdr } ;
+
+HELP: leach
+{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- )" } }
+{ $description "Call the quotation for each item in the list." } 
+{ $see-also lmap lmap-with ltake lsubset lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: lmap
+{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- X )" } { "result" "resulting cons object" } }
+{ $description "Perform a similar functionality to that of the " { $link map } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-map> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } 
+{ $see-also leach ltake lsubset lappend lmap-with  lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: lmap-with
+{ $values { "value" "an object" } { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj elt -- X )" } { "result" "resulting cons object" } }
+{ $description "Variant of " { $link lmap } " which pushes a retained object on each invocation of the quotation." } 
+{ $see-also leach ltake lsubset lappend lmap lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: ltake
+{ $values { "n" "a non negative integer" } { "list" "a cons object" } { "result" "resulting cons object" } }
+{ $description "Outputs a lazy list containing the first n items in the list. This is done a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-take> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } 
+{ $see-also leach lmap lmap-with lsubset lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: lsubset
+{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( -- X )" } { "result" "resulting cons object" } }
+{ $description "Perform a similar functionality to that of the " { $link subset } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-subset> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } 
+{ $see-also leach lmap lmap-with ltake lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: list>vector
+{ $values { "list" "a cons object" } { "vector" "the list converted to a vector" } }
+{ $description "Convert a list to a vector. If the list is a lazy infinite list then this will enter an infinite loop." } 
+{ $see-also list>array } ;
+
+HELP: list>array
+{ $values { "list" "a cons object" } { "array" "the list converted to an array" } }
+{ $description "Convert a list to an array. If the list is a lazy infinite list then this will enter an infinite loop." } 
+{ $see-also list>vector } ;
+
+HELP: lappend
+{ $values { "list1" "a cons object" } { "list2" "a cons object" } { "result" "a lazy list of list2 appended to list1" } }
+{ $description "Perform a similar functionality to that of the " { $link append } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-append> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required. Successive calls to " { $link cdr } " will iterate through list1, followed by list2." } 
+{ $see-also leach lmap lmap-with ltake lsubset lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: lfrom-by
+{ $values { "n" "an integer" } { "quot" "a quotation with stack effect ( -- int )" } { "list" "a lazy list of integers" } }
+{ $description "Return an infinite lazy list of values starting from n, with each successive value being the result of applying quot to n." } 
+{ $see-also leach lmap lmap-with ltake lsubset lfrom lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: lfrom
+{ $values { "n" "an integer" } { "list" "a lazy list of integers" } }
+{ $description "Return an infinite lazy list of incrementing integers starting from n." } 
+{ $see-also leach lmap lmap-with ltake lsubset lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: seq>list
+{ $values { "index" "an integer 0 or greater" } { "seq" "a sequence" } { "list" "a list" } }
+{ $description "Convert the sequence into a list, starting from the 'index' offset into the sequence." } 
+{ $see-also >list } ;
+
+HELP: >list
+{ $values { "object" "an object" } { "list" "a list" } }
+{ $description "Convert the object into a list. Existing lists are passed through intact, sequences are converted using " { $link seq>list } " and other objects cause an error to be thrown." } 
+{ $see-also seq>list } ;
+
+HELP: lconcat
+{ $values { "list" "a list of lists" } { "result" "a list" } }
+{ $description "Concatenates a list of lists together into one list." } 
+{ $see-also leach lmap lmap-with ltake lsubset lcartesian-product lcartesian-product* lfrom-by lcomp lcomp* lmerge } ;
+
+HELP: lcartesian-product
+{ $values { "list1" "a list" } { "list2" "a list" } { "result" "list of cartesian products" } }
+{ $description "Given two lists, return a list containing the cartesian product of those lists." } 
+{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product* lcomp lcomp* lmerge } ;
+
+HELP: lcartesian-product*
+{ $values { "lists" "a list of lists" } { "result" "list of cartesian products" } }
+{ $description "Given a list of lists, return a list containing the cartesian product of those lists." } 
+{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp lcomp* lmerge } ;
+
+HELP: lcomp
+{ $values { "list" "a list of lists" } { "quot" "a quotation with stack effect ( seq -- X )" } { "result" "the resulting list" } }
+{ $description "Get the cartesian product of the lists in " { $snippet "list" } " and call " { $snippet "quot" } " call with each element from the cartesian product on the stack, the result of which is returned in the final " { $snippet "list" } "." } 
+{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp* lmerge } ;
+
+HELP: lcomp*
+{ $values { "list" "a list of lists" } { "guards" "a sequence of quotations with stack effect ( seq -- bool )" } { "quot" "a quotation with stack effect ( seq -- X )" } { "list" "the resulting list" } { "result" "a list" } }
+{ $description "Get the cartesian product of the lists in " { $snippet "list" } ", filter it by applying each guard quotation to it and call " { $snippet "quot" } " call with each element from the remaining cartesian product items on the stack, the result of which is returned in the final " { $snippet "list" } "." } 
+{ $examples
+  { $code "{ 1 2 3 } >list { 4 5 6 } >list 2list { [ first odd? ] } [ first2 + ] lcomp*" }
+}
+{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp lmerge } ;
+
+HELP: lmerge
+{ $values { "list1" "a list" } { "list2" "a list" } { "result" "lazy list merging list1 and list2" } }
+{ $description "Return the result of merging the two lists in a lazy manner." } 
+{ $examples
+  { $example "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array ." "{ 1 4 2 5 3 6 }" }
+}
+{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp } ;
+
+HELP: lcontents
+{ $values { "stream" "a stream" } { "result" string } }
+{ $description "Returns a lazy list of all characters in the file. " { $link car } " returns the next character in the file, " { $link cdr } " returns the remaining characters as a lazy list. " { $link nil? } " indicates end of file." } 
+{ $see-also llines } ;
+
+HELP: llines
+{ $values { "stream" "a stream" } { "result" "a list" } }
+{ $description "Returns a lazy list of all lines in the file. " { $link car } " returns the next lines in the file, " { $link cdr } " returns the remaining lines as a lazy list. " { $link nil? } " indicates end of file." } 
+{ $see-also lcontents } ;
+
diff --git a/extra/lazy-lists/lazy-lists-tests.factor b/extra/lazy-lists/lazy-lists-tests.factor
new file mode 100644 (file)
index 0000000..9b7f0ef
--- /dev/null
@@ -0,0 +1,25 @@
+! Copyright (C) 2006 Matthew Willis and Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: lazy-lists tools.test kernel math io sequences ;
+IN: temporary
+
+[ { 1 2 3 4 } ] [
+  { 1 2 3 4 } >list list>array
+] unit-test
+
+[ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
+  { 1 2 3 } >list { 4 5 } >list 2list lcartesian-product* list>array
+] unit-test
+
+[ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
+  { 1 2 3 } >list { 4 5 } >list lcartesian-product list>array
+] unit-test
+
+[ { 5 6 6 7 7 8 } ] [ 
+  { 1 2 3 } >list { 4 5 } >list 2list [ first2 + ] lcomp list>array
+] unit-test
+
+[ { 5 6 7 8 } ] [ 
+  { 1 2 3 } >list { 4 5 } >list 2list { [ first odd? ] } [ first2 + ] lcomp* list>array
+] unit-test
diff --git a/extra/lazy-lists/lazy-lists.factor b/extra/lazy-lists/lazy-lists.factor
new file mode 100644 (file)
index 0000000..2e3dc91
--- /dev/null
@@ -0,0 +1,464 @@
+! Copyright (C) 2004 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Updated by Matthew Willis, July 2006
+! Updated by Chris Double, September 2006
+!
+USING: kernel sequences math vectors arrays namespaces
+quotations promises combinators io ;
+IN: lazy-lists
+
+! Lazy List Protocol
+GENERIC: car   ( cons -- car )
+GENERIC: cdr   ( cons -- cdr )
+GENERIC: nil?  ( cons -- ? )
+GENERIC: list? ( object -- ? )
+
+M: object list? ( object -- bool )
+  drop f ;
+
+M: promise car ( promise -- car )
+  force car ;
+
+M: promise cdr ( promise -- cdr )
+  force cdr ;
+
+M: promise nil? ( cons -- bool )
+  force nil? ;
+
+M: promise list? ( object -- bool )
+  drop t ;
+
+TUPLE: cons car cdr ;
+
+C: cons cons
+
+M: cons car ( cons -- car )
+    cons-car ;
+
+M: cons cdr ( cons -- cdr )
+    cons-cdr ;
+
+: nil ( -- cons )
+  T{ cons f f f } ;
+
+M: cons nil? ( cons -- bool )
+    nil eq? ;
+
+M: cons list? ( object -- bool )
+  drop t ;
+
+: 1list ( obj -- cons )
+    nil cons ;
+
+: 2list ( a b -- cons )
+    nil cons cons ;
+
+: 3list ( a b c -- cons )
+    nil cons cons cons ;
+
+! Both 'car' and 'cdr' are promises
+TUPLE: lazy-cons car cdr ;
+
+: lazy-cons ( car cdr -- promise )
+    [ promise ] 2apply \ lazy-cons construct-boa
+    T{ promise f f t f } clone
+    [ set-promise-value ] keep ;
+
+M: lazy-cons car ( lazy-cons -- car )
+    lazy-cons-car force ;
+
+M: lazy-cons cdr ( lazy-cons -- cdr )
+    lazy-cons-cdr force ;
+
+M: lazy-cons nil? ( lazy-cons -- bool )
+    nil eq? ;
+
+M: lazy-cons list? ( object -- bool )
+  drop t ;
+
+: 1lazy-list ( a -- lazy-cons )
+  [ nil ] lazy-cons ;
+
+: 2lazy-list ( a b -- lazy-cons )
+  1lazy-list 1quotation lazy-cons ;
+
+: 3lazy-list ( a b c -- lazy-cons )
+  2lazy-list 1quotation lazy-cons ;
+
+: lnth ( n list -- elt )
+  swap [ cdr ] times car ;
+
+: (llength) ( list acc -- n )
+  over nil? [ nip ] [ >r cdr r> 1+ (llength) ] if ;
+
+: llength ( list -- n )
+  0 (llength) ;
+
+: uncons ( cons -- car cdr )
+    #! Return the car and cdr of the lazy list
+    dup car swap cdr ;
+
+: leach ( list quot -- )
+  swap dup nil? [
+    2drop
+  ] [
+    uncons swap pick call swap leach
+  ] if ;
+
+TUPLE: memoized-cons original car cdr nil? ;
+
+: not-memoized ( -- obj )
+  { } ;
+
+: not-memoized? ( obj -- bool )
+  not-memoized eq? ;
+
+: <memoized-cons> ( cons -- memoized-cons )
+  not-memoized not-memoized not-memoized
+  memoized-cons construct-boa ;
+
+M: memoized-cons car ( memoized-cons -- car )
+  dup memoized-cons-car not-memoized? [
+    dup memoized-cons-original car [ swap set-memoized-cons-car ] keep
+  ] [
+    memoized-cons-car
+  ] if ;
+
+M: memoized-cons cdr ( memoized-cons -- cdr )
+  dup memoized-cons-cdr not-memoized? [
+    dup memoized-cons-original cdr [ swap set-memoized-cons-cdr ] keep
+  ] [
+    memoized-cons-cdr
+  ] if ;
+
+M: memoized-cons nil? ( memoized-cons -- bool )
+  dup memoized-cons-nil? not-memoized? [
+    dup memoized-cons-original nil? [ swap set-memoized-cons-nil? ] keep
+  ] [
+    memoized-cons-nil?
+  ] if ;
+
+M: memoized-cons list? ( object -- bool )
+  drop t ;
+
+TUPLE: lazy-map cons quot ;
+
+C: <lazy-map> lazy-map
+
+: lmap ( list quot -- result )
+    over nil? [ 2drop nil ] [ <lazy-map> <memoized-cons> ] if ;
+
+M: lazy-map car ( lazy-map -- car )
+  [ lazy-map-cons car ] keep
+  lazy-map-quot call ;
+
+M: lazy-map cdr ( lazy-map -- cdr )
+  [ lazy-map-cons cdr ] keep
+  lazy-map-quot lmap ;
+
+M: lazy-map nil? ( lazy-map -- bool )
+  lazy-map-cons nil? ;
+
+M: lazy-map list? ( object -- bool )
+  drop t ;
+
+TUPLE: lazy-map-with value cons quot ;
+
+C: <lazy-map-with> lazy-map-with
+
+: lmap-with ( value list quot -- result )
+  over nil? [ 3drop nil ] [ <lazy-map-with> <memoized-cons> ] if ;
+
+M: lazy-map-with car ( lazy-map-with -- car )
+  [ lazy-map-with-value ] keep
+  [ lazy-map-with-cons car ] keep
+  lazy-map-with-quot call ;
+
+M: lazy-map-with cdr ( lazy-map-with -- cdr )
+  [ lazy-map-with-value ] keep
+  [ lazy-map-with-cons cdr ] keep
+  lazy-map-with-quot lmap-with ;
+
+M: lazy-map-with nil? ( lazy-map-with -- bool )
+  lazy-map-with-cons nil? ;
+
+M: lazy-map-with list? ( object -- bool )
+  drop t ;
+
+TUPLE: lazy-take n cons ;
+
+C: <lazy-take> lazy-take
+
+: ltake ( n list -- result )
+    over zero? [ 2drop nil ] [ <lazy-take> ] if ;
+
+M: lazy-take car ( lazy-take -- car )
+  lazy-take-cons car ;
+
+M: lazy-take cdr ( lazy-take -- cdr )
+  [ lazy-take-n 1- ] keep
+  lazy-take-cons cdr ltake ;
+
+M: lazy-take nil? ( lazy-take -- bool )
+  dup lazy-take-n zero? [
+    drop t
+  ] [
+    lazy-take-cons nil?
+  ] if ;
+
+M: lazy-take list? ( object -- bool )
+  drop t ;
+
+TUPLE: lazy-subset cons quot ;
+
+C: <lazy-subset> lazy-subset
+
+: lsubset ( list quot -- result )
+    over nil? [ 2drop nil ] [ <lazy-subset> <memoized-cons> ] if ;
+
+: car-subset?  ( lazy-subset -- )
+  [ lazy-subset-cons car ] keep
+  lazy-subset-quot call ;
+
+: skip ( lazy-subset -- )
+  [ lazy-subset-cons cdr ] keep
+  set-lazy-subset-cons ;
+
+M: lazy-subset car ( lazy-subset -- car )
+  dup car-subset? [
+    lazy-subset-cons car
+  ] [
+    dup skip car
+  ] if ;
+
+M: lazy-subset cdr ( lazy-subset -- cdr )
+  dup car-subset? [
+    [ lazy-subset-cons cdr ] keep
+    lazy-subset-quot lsubset
+  ] [
+    dup skip cdr
+  ] if ;
+
+M: lazy-subset nil? ( lazy-subset -- bool )
+  dup lazy-subset-cons nil? [
+    drop t
+  ] [
+    dup car-subset? [
+      drop f
+    ] [
+      dup skip nil?
+    ] if
+  ] if ;
+
+M: lazy-subset list? ( object -- bool )
+  drop t ;
+
+: list>vector ( list -- vector )
+  [ [ , ] leach ] V{ } make ;
+
+: list>array ( list -- array )
+  [ [ , ] leach ] { } make ;
+
+TUPLE: lazy-append list1 list2 ;
+
+C: <lazy-append> lazy-append
+
+: lappend ( list1 list2 -- result )
+  over nil? [ nip ] [ <lazy-append> ] if ;
+
+M: lazy-append car ( lazy-append -- car )
+  lazy-append-list1 car ;
+
+M: lazy-append cdr ( lazy-append -- cdr )
+  [ lazy-append-list1 cdr  ] keep
+  lazy-append-list2 lappend ;
+
+M: lazy-append nil? ( lazy-append -- bool )
+  dup lazy-append-list1 nil? [
+    lazy-append-list2 nil?
+  ] [
+    drop f
+  ] if ;
+
+M: lazy-append list? ( object -- bool )
+  drop t ;
+
+TUPLE: lazy-from-by n quot ;
+
+C: lfrom-by lazy-from-by ( n quot -- list )
+
+: lfrom ( n -- list )
+  [ 1 + ] lfrom-by ;
+
+M: lazy-from-by car ( lazy-from-by -- car )
+  lazy-from-by-n ;
+
+M: lazy-from-by cdr ( lazy-from-by -- cdr )
+  [ lazy-from-by-n ] keep
+  lazy-from-by-quot dup >r call r> lfrom-by ;
+
+M: lazy-from-by nil? ( lazy-from-by -- bool )
+  drop f ;
+
+M: lazy-from-by list? ( object -- bool )
+  drop t ;
+
+TUPLE: lazy-zip list1 list2 ;
+
+C: <lazy-zip> lazy-zip
+
+: lzip ( list1 list2 -- lazy-zip )
+    over nil? over nil? or
+    [ 2drop nil ] [ <lazy-zip> ] if ;
+
+M: lazy-zip car ( lazy-zip -- car )
+    [ lazy-zip-list1 car ] keep lazy-zip-list2 car 2array ;
+
+M: lazy-zip cdr ( lazy-zip -- cdr )
+    [ lazy-zip-list1 cdr ] keep lazy-zip-list2 cdr lzip ;
+
+M: lazy-zip nil? ( lazy-zip -- bool )
+    drop f ;
+
+M: lazy-zip list? ( object -- bool )
+  drop t ;
+
+TUPLE: sequence-cons index seq ;
+
+C: <sequence-cons> sequence-cons
+
+: seq>list ( index seq -- list )
+  2dup length >= [
+    2drop nil
+  ] [
+    <sequence-cons>
+  ] if ;
+
+M: sequence-cons car ( sequence-cons -- car )
+  [ sequence-cons-index ] keep
+  sequence-cons-seq nth ;
+
+M: sequence-cons cdr ( sequence-cons -- cdr )
+  [ sequence-cons-index 1+ ] keep
+  sequence-cons-seq seq>list ;
+
+M: sequence-cons nil? ( sequence-cons -- bool )
+    drop f ;
+
+M: sequence-cons list? ( object -- bool )
+  drop t ;
+
+: >list ( object -- list )
+  {
+    { [ dup sequence? ] [ 0 swap seq>list ] }
+    { [ dup list?     ] [ ] }
+    { [ t ] [ "Could not convert object to a list" throw ] }
+  } cond ;
+
+TUPLE: lazy-concat car cdr ;
+
+C: <lazy-concat> lazy-concat
+
+DEFER: lconcat
+
+: (lconcat) ( car cdr -- list )
+  over nil? [
+    nip lconcat
+  ] [
+    <lazy-concat>
+  ] if ;
+
+: lconcat ( list -- result )
+  dup nil? [
+    drop nil
+  ] [
+    uncons (lconcat)
+  ] if ;
+
+M: lazy-concat car ( lazy-concat -- car )
+  lazy-concat-car car ;
+
+M: lazy-concat cdr ( lazy-concat -- cdr )
+  [ lazy-concat-car cdr ] keep lazy-concat-cdr (lconcat) ;
+
+M: lazy-concat nil? ( lazy-concat -- bool )
+  dup lazy-concat-car nil? [
+    lazy-concat-cdr nil?
+  ] [
+    drop f
+  ] if ;
+
+M: lazy-concat list? ( object -- bool )
+  drop t ;
+
+: lcartesian-product ( list1 list2 -- result )
+  swap [ swap [ 2array ] lmap-with ] lmap-with lconcat ;
+
+: lcartesian-product* ( lists -- result )
+  dup nil? [
+    drop nil
+  ] [
+    [ car ] keep cdr [ car lcartesian-product ] keep cdr list>array swap [
+      swap [ swap [ add ] lmap-with ] lmap-with lconcat
+    ] reduce
+  ] if ;
+
+: lcomp ( list quot -- result )
+  >r lcartesian-product* r> lmap ;
+
+: lcomp* ( list guards quot -- result )
+  >r >r lcartesian-product* r> [ lsubset ] each r> lmap ;
+
+DEFER: lmerge
+
+: (lmerge) ( list1 list2 -- result )
+  over [ car ] curry -rot
+  [
+    dup [ car ] curry -rot
+    [
+      >r cdr r> cdr lmerge
+    ] 2curry lazy-cons
+  ] 2curry lazy-cons ;
+
+: lmerge ( list1 list2 -- result )
+  {
+    { [ over nil? ] [ nip   ] }
+    { [ dup nil?  ]  [ drop ] }
+    { [ t         ]  [ (lmerge) ] }
+  } cond ;
+
+TUPLE: lazy-io stream car cdr quot ;
+
+C: <lazy-io> lazy-io
+
+: lcontents ( stream -- result )
+  f f [ stream-read1 ] <lazy-io> ;
+
+: llines ( stream -- result )
+  f f [ stream-readln ] <lazy-io> ;
+
+M: lazy-io car ( lazy-io -- car )
+  dup lazy-io-car dup [
+    nip
+  ] [
+    drop dup lazy-io-stream over lazy-io-quot call
+    swap dupd set-lazy-io-car
+  ] if ;
+
+M: lazy-io cdr ( lazy-io -- cdr )
+  dup lazy-io-cdr dup [
+    nip
+  ] [
+    drop dup
+    [ lazy-io-stream ] keep
+    [ lazy-io-quot ] keep
+    car [
+      >r f f r> <lazy-io> [ swap set-lazy-io-cdr ] keep
+    ] [
+      3drop nil
+    ] if
+  ] if ;
+
+M: lazy-io nil? ( lazy-io -- bool )
+  car not ;
diff --git a/extra/lazy-lists/old-doc.html b/extra/lazy-lists/old-doc.html
new file mode 100644 (file)
index 0000000..4c04301
--- /dev/null
@@ -0,0 +1,361 @@
+<html>
+  <head>
+    <title>Lazy Evaluation</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+      </head>
+  <body>
+    <h1>Lazy Evaluation</h1>
+<p>The 'lazy' vocabulary adds lazy lists to Factor. This provides the
+    ability to describe infinite structures, and to delay execution of
+    expressions until they are actually used.</p>
+<p>Lazy lists, like normal lists, are composed of a head and tail. In
+    a lazy list the head and tail are something called a 'promise'. 
+    To convert a
+    'promise' into its actual value a word called 'force' is used. To
+    convert a value into a 'promise' the word to use is 'delay'.</p>
+<table border="1">
+<tr><td><a href="#delay">delay</a></td></tr>
+<tr><td><a href="#force">force</a></td></tr>
+</table>
+
+<p>Many of the lazy list words are named similar to the standard list
+    words but with an 'l' suffixed to it. Here are the commonly used
+    words and their equivalent list operation:</p>
+<table border="1">
+<tr><th>Lazy List</th><th>Normal List</th></tr>
+<tr><td><a href="#lnil">lnil</a></td><td>[ ]</td></tr>
+<tr><td><a href="#lnilp">lnil?</a></td><td>Test for nil value</td></tr>
+<tr><td><a href="#lcons">lcons</a></td><td>cons</td></tr>
+<tr><td><a href="#lunit">lunit</a></td><td>unit</td></tr>
+<tr><td><a href="#lcar">lcar</a></td><td>car</td></tr>
+<tr><td><a href="#lcdr">lcdr</a></td><td>cdr</td></tr>
+<tr><td><a href="#lnth">lnth</a></td><td>nth</td></tr>
+<tr><td><a href="#luncons">luncons</a></td><td>uncons</td></tr>
+<tr><td><a href="#lmap">lmap</a></td><td>map</td></tr>
+<tr><td><a href="#lsubset">lsubset</a></td><td>subset</td></tr>
+<tr><td><a href="#leach">leach</a></td><td>each</td></tr>
+<tr><td><a href="#lappend">lappend</a></td><td>append</td></tr>
+</table>
+<p>A few additional words specific to lazy lists are:</p>
+<table border="1">
+<tr><td><a href="#ltake">ltake</a></td><td>Returns a normal list containing a specified
+number of items from the lazy list.</td></tr>
+<tr><td><a href="#lappendstar">lappend*</a></td><td>Given a lazy list of lazy lists,
+concatenate them together in a lazy manner, returning a single lazy
+list.</td></tr>
+<tr><td><a href="#list>llist">list>llist</a></td><td>Given a normal list, return a lazy list
+that contains the same elements as the normal list.</td></tr>
+</table>
+<h2>Reference</h2>
+<!-- delay description -->
+<a name="delay">
+<h3>delay ( quot -- &lt;promise&gt; )</h3>
+<p>'delay' is used to convert a value or expression into a promise.
+   The word 'force' is used to convert that promise back to its
+   value, or to force evaluation of the expression to return a value.
+</p>
+<p>The value on the stack that 'delay' expects must be quoted. This is
+   a requirement to prevent it from being evaluated.
+</p>
+<pre class="code">
+  ( 1 ) [ 42 ] <a href="#delay">delay</a> dup .
+       => &lt;&lt; promise [ ] [ 42 ] [ ] [ ] &gt;&gt;
+  ( 2 ) <a href="#force">force</a> .
+       => 42
+</pre>
+
+<!-- force description -->
+<a name="force">
+<h3>force ( &lt;promise&gt; -- value )</h3>
+<p>'force' will evaluate a promises original expression
+   and leave the value of that expression on the stack.
+</p>
+<p>A promise can be forced multiple times but the expression
+   is only evaluated once. Future calls of 'force' on the promise
+   will returned the cached value of the original force. If the
+   expression contains side effects, such as i/o, then that i/o
+   will only occur on the first 'force'. See below for an example
+   (steps 3-5).
+</p>
+<p>If a promise is itself delayed, a force will evaluate all promises
+   until a value is returned. Due to this behaviour it is generally not
+   possible to delay a promise. The example below shows what happens
+   in this case.
+</p>
+<pre class="code">       
+  ( 1 ) [ 42 ] <a href="#delay">delay</a> dup .
+       => &lt;&lt; promise [ ] [ 42 ] [ ] [ ] &gt;&gt;
+  ( 2 ) <a href="#force">force</a> .
+       => 42
+       
+        #! Multiple forces on a promise returns cached value
+  ( 3 ) [ "hello" print 42 ] <a href="#delay">delay</a> dup .
+       => << promise [ ] [ "hello" print 42 ] [ ] [ ] >>
+  ( 4 ) dup <a href="#force">force</a> .
+       => hello
+          42
+  ( 5 ) <a href="#force">force</a> .
+       => 42
+
+        #! Forcing a delayed promise cascades up to return
+        #! original value, rather than the promise.
+  ( 6 ) [ [ 42 ] <a href="#delay">delay</a> ] <a href="#delay">delay</a> dup .
+       => << promise [ ] [ [ 42 ] delay ] [ ] [ ] >>
+  ( 7 ) <a href="#force">force</a> .
+       => 42
+</pre>
+
+<!-- lnil description -->
+<a name="lnil">
+<h3>lnil ( -- lcons )</h3>
+<p>Returns a value representing the empty lazy list.</p>
+<pre class="code">
+  ( 1 ) <a href="#lnil">lnil</a> .
+       => << promise [ ] [ [ ] ] t [ ] >>
+</pre>
+
+<!-- lnil description -->
+<a name="lnilp">
+<h3>lnil? ( lcons -- bool )</h3>
+<p>Returns true if the given lazy cons is the value representing 
+   the empty lazy list.</p>
+<pre class="code">
+  ( 1 ) <a href="#lnil">lnil</a> <a href="#lnilp">lnil?</a> .
+       => t
+  ( 2 ) [ 1 ] <a href="#list2llist">list&gt;llist</a> dup <a href="#lnilp">lnil?</a> .
+       => [ ]
+  ( 3 ) <a href="#lcdr">lcdr</a> <a href="#lnilp">lnil?</a> .
+       => t
+</pre>
+
+<!-- lcons description -->
+<a name="lcons">
+<h3>lcons ( car-promise cdr-promise -- lcons )</h3>
+<p>Provides the same effect as 'cons' does for normal lists. 
+   Both values provided must be promises (ie. expressions that have
+   had <a href="#delay">delay</a> called on them).
+</p>
+<p>As the car and cdr passed on the stack are promises, they are not
+   evaluated until <a href="#lcar">lcar</a> or <a href="#lcdr">lcdr</a>
+   are called on the lazy cons.</p>
+<pre class="code">
+  ( 1 ) [ "car" ] <a href="#delay">delay</a> [ "cdr" ] <a href="#delay">delay</a> <a href="#lcons">lcons</a> dup .
+       => &lt;&lt; promise ... &gt;&gt;
+  ( 2 ) dup <a href="#lcar">lcar</a> .
+       => "car"
+  ( 3 ) dup <a href="#lcdr">lcdr</a> .
+       => "cdr"
+</pre>
+  
+<!-- lunit description -->
+<a name="lunit">
+<h3>lunit ( value-promise -- llist )</h3>
+<p>Provides the same effect as 'unit' does for normal lists. It
+creates a lazy list where the first element is the value given.</p>
+<p>Like <a href="#lcons">lcons</a>, the value on the stack must be
+   a promise and is not evaluated until the <a href="#lcar">lcar</a>
+   of the list is requested.</a>
+<pre class="code">
+  ( 1 ) [ 42 ] <a href="#delay">delay</a> <a href="#lunit">lunit</a> dup .
+       => &lt;&lt; promise ... &gt;&gt;
+  ( 2 ) dup <a href="#lcar">lcar</a> .
+       => 42
+  ( 3 ) dup <a href="#lcdr">lcdr</a> <a href="#lnilp">lnil?</a> .
+       => t
+  ( 4 ) [ . ] <a href="#leach">leach</a>
+       => 42
+</pre>
+
+<!-- lcar description -->
+<a name="lcar">
+<h3>lcar ( lcons -- value )</h3>
+<p>Provides the same effect as 'car' does for normal lists. It
+returns the first element in a lazy cons cell. This will force
+the evaluation of that element.</p>
+<pre class="code">
+  ( 1 ) [ 42 ] <a href="#delay">delay</a> <a href="#lunit">lunit</a> dup .
+       => &lt;&lt; promise ... &gt;&gt;
+  ( 2 ) <a href="#lcar">lcar</a> .
+       => 42
+</pre>
+
+<!-- lcdr description -->
+<a name="lcdr">
+<h3>lcdr ( lcons -- value )</h3>
+<p>Provides the same effect as 'cdr' does for normal lists. It
+returns the second element in a lazy cons cell and forces it. This
+causes that element to be evaluated immediately.</p>
+<pre class="code">
+  ( 1 ) [ 1 ] <a href="#delay">delay</a> [ 5 6 + ] <a href="#delay">delay</a> <a href="#lcons">lcons</a> dup .
+       => &lt;&lt; promise ... &gt;&gt;
+  ( 2 ) <a href="#lcdr">lcdr</a> .
+       => 11
+</pre>
+
+<pre class="code">
+  ( 1 ) 5 <a href="#lfrom">lfrom</a> dup .
+       => &lt;&lt; promise ... &gt;&gt;
+  ( 2 ) <a href="#lcdr">lcdr</a> dup <a href="#lcar">lcar</a> .
+       => 6
+  ( 3 ) <a href="#lcdr">lcdr</a> dup <a href="#lcar">lcar</a> .
+       => 7
+  ( 4 ) <a href="#lcdr">lcdr</a> dup <a href="#lcar">lcar</a> .
+       => 8
+</pre>
+
+<!-- lnth description -->
+<a name="lnth">
+<h3>lnth ( n llist -- value )</h3>
+<p>Provides the same effect as 'nth' does for normal lists. It
+returns the nth value in the lazy list. It causes all the values up to
+'n' to be evaluated.</p>
+<pre class="code">
+  ( 1 ) 1 <a href="#lfrom">lfrom</a> dup .
+       => &lt;&lt; promise ... &gt;&gt;
+  ( 2 ) 5 swap <a href="#lnth">lnth</a> .
+       => 6
+</pre>
+
+<!-- luncons description -->
+<a name="luncons">
+<h3>luncons ( lcons -- car cdr )</h3>
+<p>Provides the same effect as 'uncons' does for normal lists. It
+returns the car and cdr of the lazy list.</p>
+<pre class="code">
+  ( 1 ) [ 5 ] <a href="#delay">delay</a> [ 6 ] <a  href="#delay">delay</a> <a href="#lcons">lcons</a> dup .
+       => &lt;&lt; promise ... &gt;&gt;
+  ( 2 ) <a href="#luncons">luncons</a> . .
+       => 6
+          5
+</pre>
+
+<!-- lmap description -->
+<a name="lmap">
+<h3>lmap ( llist quot -- llist )</h3>
+<p>Lazily maps over a lazy list applying the quotation to each element.
+A new lazy list is returned which contains the results of the
+quotation.</p>
+<p>When intially called nothing in the original lazy list is
+evaluated. Only when <a href="#lcar">lcar</a> is called will the item
+in the list be evaluated and applied to the quotation. Ditto with <a
+href="#lcdr">lcdr</a>, thus allowing infinite lists to be mapped over.</p>
+<pre class="code">
+  ( 1 ) 1 <a href="#lfrom">lfrom</a>
+       => < infinite list of incrementing numbers >
+  ( 2 ) [ 2 * ] <a href="#lmap">lmap</a>
+       => < infinite list of numbers incrementing by 2 >
+  ( 3 ) 5 swap <a href="#ltake">ltake</a> <a  href="#llist2list">llist&gt;list</a> .
+       => [ 2 4 6 8 10 ]
+</pre>
+
+<!-- lsubset description -->
+<a name="lsubset">
+<h3>lsubset ( llist pred -- llist )</h3>
+<p>Provides the same effect as 'subset' does for normal lists. It
+lazily iterates over a lazy list applying the predicate quotation to each
+element. If that quotation returns true, the element will be included
+in the resulting lazy list. If it is false, the element will be skipped.
+A new lazy list is returned which contains  all elements where the
+predicate returned true.</p>
+<p>Like <a href="#lmap">lmap</a>, when initially called no evaluation
+will occur. A lazy list is returned that when values are retrieved
+from in then items are evaluated and checked against the predicate.</p>
+<pre class="code">
+  ( 1 ) 1 <a href="#lfrom">lfrom</a>
+       => < infinite list of incrementing numbers >
+  ( 2 ) [ <a href="#primep">prime?</a> ] <a href="#lsubset">lsubset</a>
+       => < infinite list of prime numbers >
+  ( 3 ) 5 swap <a href="#ltake">ltake</a> <a  href="#llist2list">llist&gt;list</a> .
+       => [ 2 3 5 7 11 ]
+</pre>
+
+<!-- leach description -->
+<a name="leach">
+<h3>leach ( llist quot --  )</h3>
+<p>Provides the same effect as 'each' does for normal lists. It
+lazily iterates over a lazy list applying the quotation to each
+element. If this operation is applied to an infinite list it will
+never return unless the quotation escapes out by calling a continuation.</p>
+<pre class="code">
+  ( 1 ) 1 <a href="#lfrom">lfrom</a>
+       => < infinite list of incrementing numbers >
+  ( 2 ) [ 2 mod 1 = ] <a href="#lsubset">lsubset</a>
+       => < infinite list of odd numbers >
+  ( 3 ) [ . ] <a href="#leach">leach</a> 
+       => 1
+          3
+          5
+          7
+          ... for ever ...
+</pre>
+
+<!-- ltake description -->
+<a name="ltake">
+<h3>ltake ( n llist -- llist )</h3>
+<p>Iterates over the lazy list 'n' times, appending each element to a
+lazy list. This provides a convenient way of getting elements out of
+an infinite lazy list.</p>
+<pre class="code">
+  ( 1 ) : ones [ 1 ] delay [ ones ] delay <a href="#lcons">lcons</a> ;
+  ( 2 ) 5 ones <a href="#ltake">ltake</a> <a  href="#llist2list">llist&gt;list</a> .
+       => [ 1 1 1 1 1  ]
+</pre>
+
+<!-- lappend description -->
+<a name="lappend">
+<h3>lappend ( llist1 llist2 -- llist )</h3>
+<p>Lazily appends two lists together. The actual appending is done
+lazily on iteration rather than immediately so it works very fast no
+matter how large the list.</p>
+<pre class="code">
+  ( 1 ) [ 1 2 3 ] <a href="#list2llist">list&gt;llist</a> [ 4 5 6 ] <a href="#list2llist">list&gt;llist</a> <a href="#lappend">lappend</a>
+  ( 2 ) [ . ] <a href="#leach">leach</a>
+       => 1
+          2
+          3
+          4
+          5
+          6
+</pre>
+
+<!-- lappend* description -->
+<a name="lappendstar">
+<h3>lappend* ( llists -- llist )</h3>
+<p>Given a lazy list of lazy lists, concatenate them together in a
+lazy fashion. The actual appending is done lazily on iteration rather
+than immediately so it works very fast no matter how large the lists.</p>
+<pre class="code">
+  ( 1 ) [ 1 2 3 ] <a href="#list2>llist">list&gt;llist</a> 
+  ( 2 ) [ 4 5 6 ] <a href="#list2llist">list&gt;llist</a> 
+  ( 3 ) [ 7 8 9 ] <a href="#list2llist">list&gt;llist</a>
+  ( 4 ) 3list <a href="#list2llist">list&gt;llist</a> <a href="#lappendstar">lappend*</a>
+  ( 5 ) [ . ] <a href="#leach">leach</a>
+       => 1
+          2
+          3
+          4
+          5
+          6
+          7
+          8
+          9
+</pre>
+
+<!-- list>llist description -->
+<a name="list2llist">
+<h3>list&gt;llist ( list  -- llist )</h3>
+<p>Converts a normal list into a lazy list. This is done lazily so the
+initial list is not iterated through immediately.</p>
+<pre class="code">
+  ( 1 ) [ 1 2 3 ] <a href="#list2llist">list&gt;llist</a> 
+  ( 2 ) [ . ] <a href="#leach">leach</a>
+       => 1
+          2
+          3
+</pre>
+
+<p class="footer">
+News and updates to this software can be obtained from the authors
+weblog: <a href="http://radio.weblogs.com/0102385">Chris Double</a>.</p>
+<p id="copyright">Copyright (c) 2004, Chris Double. All Rights Reserved.</p>
+</body> </html>
diff --git a/extra/lazy-lists/summary.txt b/extra/lazy-lists/summary.txt
new file mode 100644 (file)
index 0000000..5d2f302
--- /dev/null
@@ -0,0 +1 @@
+Lazy lists
diff --git a/extra/lazy-lists/tags.txt b/extra/lazy-lists/tags.txt
new file mode 100644 (file)
index 0000000..dd23829
--- /dev/null
@@ -0,0 +1,2 @@
+extensions
+collections
diff --git a/extra/lcd/authors.txt b/extra/lcd/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/lcd/lcd.factor b/extra/lcd/lcd.factor
new file mode 100644 (file)
index 0000000..763df60
--- /dev/null
@@ -0,0 +1,19 @@
+USING: sequences kernel math io ;
+IN: lcd
+
+: lcd-digit ( digit row -- str )
+    {
+        "  _       _  _       _   _   _   _   _  "
+        " | |  |   _| _| |_| |_  |_    | |_| |_| "     
+        " |_|  |  |_  _|   |  _| |_|   | |_|   | "
+    } nth >r 4 * dup 4 + r> subseq ;
+
+: lcd-row ( num row -- )
+    swap [ CHAR: 0 - swap lcd-digit write ] curry* each ;
+
+: lcd ( digit-str -- )
+    3 [ lcd-row nl ] curry* each ;
+
+: lcd-demo ( -- ) "31337" lcd ;
+
+MAIN: lcd-demo
diff --git a/extra/lcd/summary.txt b/extra/lcd/summary.txt
new file mode 100644 (file)
index 0000000..1b6436a
--- /dev/null
@@ -0,0 +1 @@
+7-segment numeric display demo
diff --git a/extra/lcd/tags.txt b/extra/lcd/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/ldap/authors.txt b/extra/ldap/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/extra/ldap/conf/addentry.ldif b/extra/ldap/conf/addentry.ldif
new file mode 100644 (file)
index 0000000..e42a119
--- /dev/null
@@ -0,0 +1,25 @@
+## ADD a single entry to people level
+
+dn: cn=John Spider,ou=people,dc=example,dc=com
+objectclass: inetOrgPerson
+cn: John Spider
+sn: Spider
+uid: 1
+userpassword: jSpider
+carlicense: HISCAR 124
+homephone: 555-111-2223
+mail: j.spider@example.com
+# ou: Sales
+
+## ADD another single entry to people level
+
+dn: cn=Sheri Matsumo,ou=people,dc=example,dc=com
+objectclass: inetOrgPerson
+cn: Sheri Matsumo
+sn: Matsumo
+uid: 2
+userpassword: sMatsumo
+carlicense: HERCAR 125
+homephone: 555-111-2225
+mail: s.matsumo@example.com
+# ou: IT
\ No newline at end of file
diff --git a/extra/ldap/conf/createdit.ldif b/extra/ldap/conf/createdit.ldif
new file mode 100644 (file)
index 0000000..02e3c12
--- /dev/null
@@ -0,0 +1,45 @@
+# this is a comment # MUST be in FIRST column - very picky
+
+## DEFINE DIT ROOT/BASE/SUFFIX ####
+## uses RFC 2377 format
+## replace example and com as necessary below
+## or for experimentation leave as is
+
+## dcObject is an AUXILLIARY objectclass and MUST
+## have a STRUCTURAL objectclass (organization in this case)
+# this is an ENTRY sequence and is preceded by a BLANK line
+
+dn: dc=example,dc=com
+dc: example
+description: My wonderful company as much text as you want to place in this line up to 32K
+ continuation data for the line above must have &lt;CR> or &lt;CR>&lt;LF> i.e. ENTER works 
+ on both Windows and *nix system - new line MUST begin with ONE SPACE
+objectClass: dcObject
+objectClass: organization
+o: Example, Inc.
+
+## FIRST Level hierarchy - people 
+## uses mixed upper and lower case for objectclass
+# this is an ENTRY sequence and is preceded by a BLANK line
+
+dn: ou=people, dc=example,dc=com
+ou: people
+description: All people in organisation
+objectclass: organizationalunit
+
+## SECOND Level hierarchy
+## ADD a single entry under FIRST (people) level
+# this is an ENTRY sequence and is preceded by a BLANK line
+# the ou: Human Resources is the department name
+
+dn: cn=Robert Forest,ou=people,dc=example,dc=com
+objectclass: inetOrgPerson
+cn: Robert Forest
+sn: Forest
+uid: 0
+userpassword: rForest
+carlicense: HISCAR 123
+homephone: 555-111-2222
+mail: r.forest@example.com
+description: swell guy
+# ou: Human Resources
\ No newline at end of file
diff --git a/extra/ldap/conf/slapd.conf b/extra/ldap/conf/slapd.conf
new file mode 100644 (file)
index 0000000..bbf4f8f
--- /dev/null
@@ -0,0 +1,67 @@
+#
+###### SAMPLE 1 - SIMPLE DIRECTORY ############
+#
+# NOTES: inetorgperson picks up attributes and objectclasses
+#        from all three schemas
+#
+# NB: RH Linux schemas in /etc/openldap
+#
+include                /opt/local/etc/openldap/schema/core.schema
+include                /opt/local/etc/openldap/schema/cosine.schema
+include                /opt/local/etc/openldap/schema/inetorgperson.schema
+
+
+# NO SECURITY - no access clause
+# defaults to anonymous access for read
+# only rootdn can write
+
+# NO REFERRALS
+
+# DON'T bother with ARGS file unless you feel strongly
+# slapd scripts stop scripts need this to work
+pidfile /opt/local/var/run/run/slapd.pid
+
+# enable a lot of logging - we might need it
+# but generates huge logs
+loglevel       -1 
+
+# NO dynamic backend modules
+
+# NO TLS-enabled connections
+
+# backend definition not required
+
+#######################################################################
+# bdb database definitions
+# 
+# replace example and com below with a suitable domain
+# 
+# If you don't have a domain you can leave it since example.com
+# is reserved for experimentation or change them to my and inc
+#
+#######################################################################
+
+database bdb
+suffix "dc=example, dc=com"
+
+# root or superuser
+rootdn "cn=jimbob, dc=example, dc=com"
+rootpw secret
+# The database directory MUST exist prior to running slapd AND 
+# change path as necessary
+directory      /opt/local/var/run/openldap-data
+
+# Indices to maintain for this directory
+# unique id so equality match only
+index  uid     eq
+# allows general searching on commonname, givenname and email
+index  cn,gn,mail eq,sub
+# allows multiple variants on surname searching
+index sn eq,sub,subany,subfinal
+# optimise department searches
+index ou eq
+# shows use of default index parameter
+index default eq,sub
+# indices missing - uses default eq,sub
+index telephonenumber
+
diff --git a/extra/ldap/ldap-tests.factor b/extra/ldap/ldap-tests.factor
new file mode 100644 (file)
index 0000000..e433861
--- /dev/null
@@ -0,0 +1,54 @@
+USING: alien alien.c-types io kernel ldap ldap.libldap namespaces prettyprint 
+tools.test ;
+
+"void*" <c-object> "ldap://localhost:389" initialize
+
+get-ldp LDAP_OPT_PROTOCOL_VERSION LDAP_VERSION3 <int> set-option
+
+[ B{ 0 0 0 3 } ] [ 
+    get-ldp LDAP_OPT_PROTOCOL_VERSION "int*" <c-object> [ get-option ] keep
+] unit-test
+
+get-ldp "cn=jimbob,dc=example,dc=com" "secret" [
+
+    ! get-ldp "dc=example,dc=com" LDAP_SCOPE_ONELEVEL "(objectclass=*)" f 0
+    ! "void*" <c-object> [ search-s ] keep *int .
+
+    [ 2 ] [ 
+        get-ldp "dc=example,dc=com" LDAP_SCOPE_SUBTREE "(objectclass=*)" f 0
+        search
+    ] unit-test
+
+    ! get-ldp LDAP_RES_ANY 0 f "void*" <c-object> result .
+
+    get-ldp LDAP_RES_ANY LDAP_MSG_ALL f "void*" <c-object> result
+
+    ! get-message *int .
+
+    "Message ID: " write
+
+    get-message msgid .
+
+    get-ldp get-message get-dn .
+
+    "Entries count: " write
+
+    get-ldp get-message count-entries .
+
+    SYMBOL: entry
+    SYMBOL: attr
+
+    "Attribute: " write
+
+    get-ldp get-message first-entry entry set get-ldp entry get
+    "void*" <c-object> first-attribute dup . attr set
+
+    "Value: " write
+
+    get-ldp entry get attr get get-values *char* .
+
+    get-ldp get-message first-message msgtype result-type
+
+    get-ldp get-message next-message msgtype result-type
+
+] with-bind
diff --git a/extra/ldap/ldap.factor b/extra/ldap/ldap.factor
new file mode 100644 (file)
index 0000000..2ada976
--- /dev/null
@@ -0,0 +1,133 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Tested with OpenLDAP 2.2.7.0.21 on Mac OS X 10.4.9 PowerPC
+
+USING: alien alien.c-types assocs continuations hashtables io kernel
+ldap.libldap math namespaces sequences ;
+
+IN: ldap
+
+SYMBOL: message
+SYMBOL: ldp
+
+! =========================================================
+! Error interpretation routines
+! =========================================================
+
+: result-to-error ( ld res freeit -- num )
+    ldap_result2error ;
+
+: err-to-string ( err -- str )
+    ldap_err2string ;
+
+: check-result ( result -- )
+    dup zero? [ drop ] [
+        err-to-string throw
+    ] if ;
+
+: result-type ( result -- )
+    result-types >hashtable at print ;
+
+! =========================================================
+! Initialization routines
+! =========================================================
+
+! deprecated in favor of ldap_initialize
+: open ( host port -- ld )
+    ldap_open ;
+
+! deprecated in favor of ldap_initialize
+: init ( host port -- ld )
+    ldap_init ;
+
+: initialize ( ld url -- )
+    dupd ldap_initialize swap *void* ldp set check-result ;
+
+: get-option ( ld option outvalue -- )
+    ldap_get_option check-result ;
+
+: set-option ( ld option invalue -- )
+    ldap_set_option check-result ;
+
+! =========================================================
+! Bind operations
+! =========================================================
+
+: simple-bind ( ld who passwd -- id )
+    ldap_simple_bind ;
+
+: simple-bind-s ( ld who passwd -- )
+    ldap_simple_bind_s check-result ;
+
+: unbind-s ( ld -- )
+    ldap_unbind_s check-result ;
+
+: with-bind ( ld who passwd quot -- )
+    -roll [ simple-bind-s [ ldp get unbind-s ] [ ] cleanup ] with-scope ; inline
+
+! =========================================================
+! Search operations
+! =========================================================
+
+: search ( ld base scope filter attrs attrsonly -- id )
+    ldap_search ;
+
+: search-s ( ld base scope filter attrs attrsonly res -- )
+    ldap_search_s check-result ;
+
+! =========================================================
+! Return results of asynchronous operation routines
+! =========================================================
+
+: result ( ld msgid all timeout result -- )
+    [ ldap_result ] keep *void* message set result-type ;
+
+: parse-result ( ld result errcodep matcheddnp errmsgp referralsp serverctrlsp freeit -- )
+    ldap_parse_result check-result ;
+
+: count-messages ( ld result -- count )
+    ldap_count_messages ;
+
+: first-message ( ld result -- message )
+    ldap_first_message ;
+
+: next-message ( ld message -- message )
+    ldap_next_message ;
+
+: msgtype ( msg -- num )
+    ldap_msgtype ;
+
+: msgid ( msg -- num )
+    ldap_msgid ;
+
+: count-entries ( ld result -- count )
+    ldap_count_entries ;
+
+: first-entry ( ld result -- entry )
+    ldap_first_entry ;
+
+: next-entry ( ld entry -- entry )
+    ldap_next_entry ;
+
+: first-attribute ( ld entry berptr -- str )
+    ldap_first_attribute ;
+
+: next-attribute ( ld entry ber -- str )
+    ldap_next_attribute ;
+
+: get-values ( ld entry attr -- values )
+    ldap_get_values ;
+
+: get-dn ( ld entry -- str )
+    ldap_get_dn ;
+
+! =========================================================
+! Public routines
+! =========================================================
+
+: get-message ( -- message )
+    message get ;
+
+: get-ldp ( -- ldp )
+    ldp get ;
diff --git a/extra/ldap/libldap/libldap.factor b/extra/ldap/libldap/libldap.factor
new file mode 100644 (file)
index 0000000..6113fe5
--- /dev/null
@@ -0,0 +1,150 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Tested with OpenLDAP 2.2.7.0.21 on Mac OS X 10.4.9 PowerPC
+!
+! export LD_LIBRARY_PATH=/opt/local/lib
+
+USING: alien alien.syntax combinators kernel system ;
+
+IN: ldap.libldap
+
+"libldap" {
+    { [ win32? ] [ "libldap.dll" "stdcall" ] }
+    { [ macosx? ] [ "libldap.dylib" "cdecl" ] }
+    { [ unix? ] [ "$LD_LIBRARY_PATH/libldap.so" "cdecl" ] }
+} cond add-library
+: LDAP_VERSION1     1 ; inline
+: LDAP_VERSION2     2 ; inline 
+: LDAP_VERSION3     3 ; inline
+
+: LDAP_VERSION_MIN  LDAP_VERSION2 ; inline  
+: LDAP_VERSION      LDAP_VERSION2 ; inline
+: LDAP_VERSION_MAX  LDAP_VERSION3 ; inline
+
+: LDAP_PORT         389 ; inline ! ldap:///   default LDAP port
+: LDAPS_PORT        636 ; inline ! ldaps:///  default LDAP over TLS port
+
+: LDAP_SCOPE_BASE         HEX: 0000              ; inline
+: LDAP_SCOPE_BASEOBJECT   LDAP_SCOPE_BASE        ; inline
+: LDAP_SCOPE_ONELEVEL     HEX: 0001              ; inline
+: LDAP_SCOPE_ONE          LDAP_SCOPE_ONELEVEL    ; inline
+: LDAP_SCOPE_SUBTREE      HEX: 0002              ; inline
+: LDAP_SCOPE_SUB          LDAP_SCOPE_SUBTREE     ; inline
+: LDAP_SCOPE_SUBORDINATE  HEX: 0003              ; inline ! OpenLDAP extension
+: LDAP_SCOPE_CHILDREN     LDAP_SCOPE_SUBORDINATE ; inline
+: LDAP_SCOPE_DEFAULT      -1                     ; inline ! OpenLDAP extension
+
+: LDAP_RES_ANY            -1 ; inline
+: LDAP_RES_UNSOLICITED     0 ; inline
+
+! how many messages to retrieve results for
+: LDAP_MSG_ONE                HEX: 00 ; inline
+: LDAP_MSG_ALL                HEX: 01 ; inline
+: LDAP_MSG_RECEIVED           HEX: 02 ; inline
+
+! the possible result types returned
+: LDAP_RES_BIND             HEX: 61 ; inline
+: LDAP_RES_SEARCH_ENTRY     HEX: 64 ; inline
+: LDAP_RES_SEARCH_REFERENCE HEX: 73 ; inline
+: LDAP_RES_SEARCH_RESULT    HEX: 65 ; inline
+: LDAP_RES_MODIFY           HEX: 67 ; inline
+: LDAP_RES_ADD              HEX: 69 ; inline
+: LDAP_RES_DELETE           HEX: 6b ; inline
+: LDAP_RES_MODDN            HEX: 6d ; inline
+: LDAP_RES_COMPARE          HEX: 6f ; inline
+: LDAP_RES_EXTENDED         HEX: 78 ; inline
+: LDAP_RES_EXTENDED_PARTIAL HEX: 79 ; inline
+
+: result-types ( -- seq ) {
+    { HEX: 61  "LDAP_RES_BIND" }
+    { HEX: 64  "LDAP_RES_SEARCH_ENTRY" }
+    { HEX: 73  "LDAP_RES_SEARCH_REFERENCE" }
+    { HEX: 65  "LDAP_RES_SEARCH_RESULT" }
+    { HEX: 67  "LDAP_RES_MODIFY" }
+    { HEX: 69  "LDAP_RES_ADD" }
+    { HEX: 6b  "LDAP_RES_DELETE" }
+    { HEX: 6d  "LDAP_RES_MODDN" }
+    { HEX: 6f  "LDAP_RES_COMPARE" }
+    { HEX: 78  "LDAP_RES_EXTENDED" }
+    { HEX: 79  "LDAP_RES_EXTENDED_PARTIAL" }
+} ;
+
+: LDAP_OPT_PROTOCOL_VERSION    HEX: 0011 ; inline
+
+C-STRUCT: ldap 
+    { "char" "ld_lberoptions" }
+    { "int" "ld_deref" }
+    { "int" "ld_timelimit" }
+    { "int" "ld_sizelimit" }
+    { "int" "ld_errno" }
+    { "char*" "ld_error" }
+    { "char*" "ld_matched" }
+    { "int" "ld_refhoplimit" }
+    { "ulong" "ld_options" } ;
+
+LIBRARY: libldap
+
+! ===============================================
+! ldap.h
+! ===============================================
+
+! Will be depreciated in a later release (ldap_init() is preferred)
+FUNCTION: void* ldap_open ( char* host, int port ) ;
+
+FUNCTION: void* ldap_init ( char* host, int port ) ;
+
+FUNCTION: int ldap_initialize ( ldap* ld, char* url ) ;
+
+FUNCTION: int ldap_get_option ( void* ld, int option, void* outvalue ) ;
+
+FUNCTION: int ldap_set_option ( void* ld, int option, void* invalue ) ;
+
+FUNCTION: int ldap_simple_bind ( void* ld, char* who, char* passwd ) ;
+
+FUNCTION: int ldap_simple_bind_s ( void* ld, char* who, char* passwd ) ;
+
+FUNCTION: int ldap_unbind_s ( void* ld ) ;
+
+FUNCTION: int ldap_result2error ( void* ld, void* res, int freeit ) ;
+
+FUNCTION: char* ldap_err2string ( int err ) ;
+
+FUNCTION: int ldap_search ( void* ld, char* base, int scope, char* filter, 
+                           char* attrs, int attrsonly ) ;
+
+FUNCTION: int ldap_search_s ( void* ld, char* base, int scope, char* filter,
+                             char* attrs, int attrsonly, void* res ) ;
+
+FUNCTION: int ldap_result ( void* ld, int msgid, int all, void* timeout,
+                            void* result ) ;
+
+FUNCTION: int ldap_parse_result ( void* ld, void* result, int* errcodep,
+                                 char* matcheddnp, char* errmsgp, 
+                                 char* referralsp, void* serverctrlsp, 
+                                 int freeit ) ;
+
+FUNCTION: int ldap_count_messages ( void* ld, void* result ) ;
+
+FUNCTION: void* ldap_first_message ( void* ld, void* result ) ;
+
+FUNCTION: void* ldap_next_message ( void* ld, void* message ) ;
+
+FUNCTION: int ldap_msgtype ( void* msg ) ;
+
+FUNCTION: int ldap_msgid ( void* msg ) ;
+
+FUNCTION: int ldap_count_entries ( void* ld, void* result ) ;
+
+FUNCTION: void* ldap_first_entry ( void* ld, void* result ) ;
+
+FUNCTION: void* ldap_next_entry ( void* ld, void* entry ) ;
+
+FUNCTION: char* ldap_first_attribute ( void* ld, void* entry, void* berptr ) ;
+
+FUNCTION: char* ldap_next_attribute ( void* ld, void* entry, void* ber ) ;
+
+FUNCTION: char** ldap_get_values ( void* ld, void* entry, char* attr ) ;
+
+FUNCTION: char* ldap_get_dn ( void* ld, void* entry ) ;
diff --git a/extra/ldap/libldap/tags.txt b/extra/ldap/libldap/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/ldap/summary.txt b/extra/ldap/summary.txt
new file mode 100644 (file)
index 0000000..d695d4b
--- /dev/null
@@ -0,0 +1 @@
+OpenLDAP binding
diff --git a/extra/ldap/tags.txt b/extra/ldap/tags.txt
new file mode 100644 (file)
index 0000000..992ae12
--- /dev/null
@@ -0,0 +1 @@
+network
diff --git a/extra/levenshtein/authors.txt b/extra/levenshtein/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/levenshtein/levenshtein-tests.factor b/extra/levenshtein/levenshtein-tests.factor
new file mode 100644 (file)
index 0000000..40e0556
--- /dev/null
@@ -0,0 +1,9 @@
+! Copyright (C) 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: temporary
+USING: tools.test levenshtein ;
+
+[ 3 ] [ "sitting" "kitten" levenshtein ] unit-test
+[ 3 ] [ "kitten" "sitting" levenshtein ] unit-test
+[ 1 ] [ "freshpak" "freshpack" levenshtein ] unit-test
+[ 1 ] [ "freshpack" "freshpak" levenshtein ] unit-test
diff --git a/extra/levenshtein/levenshtein.factor b/extra/levenshtein/levenshtein.factor
new file mode 100644 (file)
index 0000000..4ea4a33
--- /dev/null
@@ -0,0 +1,46 @@
+! Copyright (C) 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays help io kernel math namespaces sequences ;
+IN: levenshtein
+
+: <matrix> ( m n -- matrix )
+    [ drop 0 <array> ] curry* map ; inline
+
+: matrix-> nth nth ; inline
+: ->matrix nth set-nth ; inline
+
+SYMBOL: d
+
+: ->d ( n i j -- ) d get ->matrix ; inline
+: d-> ( i j -- n ) d get matrix-> ; inline
+
+SYMBOL: costs
+
+: init-d ( str1 str2 -- )
+    [ length 1+ ] 2apply 2dup <matrix> d set
+    [ 0 over ->d ] each
+    [ dup 0 ->d ] each ; inline
+
+: compute-costs ( str1 str2 -- )
+    swap [
+        [ = 0 1 ? ] curry* { } map-as
+    ] curry { } map-as costs set ; inline
+
+: levenshtein-step ( i j -- )
+    [ 1+ d-> 1+ ] 2keep
+    [ >r 1+ r> d-> 1+ ] 2keep
+    [ d-> ] 2keep
+    [ costs get matrix-> + min min ] 2keep
+    >r 1+ r> 1+ ->d ; inline
+
+: levenshtein-result ( -- n ) d get peek peek ; inline
+
+: levenshtein ( str1 str2 -- n )
+    [
+        2dup init-d
+        2dup compute-costs
+        [ length ] 2apply [
+            [ levenshtein-step ] curry each
+        ] curry* each
+        levenshtein-result
+    ] with-scope ;
diff --git a/extra/levenshtein/summary.txt b/extra/levenshtein/summary.txt
new file mode 100644 (file)
index 0000000..583669a
--- /dev/null
@@ -0,0 +1 @@
+Levenshtein edit distance algorithm
diff --git a/extra/lint/authors.txt b/extra/lint/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/lint/lint-tests.factor b/extra/lint/lint-tests.factor
new file mode 100644 (file)
index 0000000..707d34b
--- /dev/null
@@ -0,0 +1,18 @@
+USING: io lint kernel math tools.test ;
+IN: temporary
+
+! Don't write code like this
+: lint1
+    [ "hi" print ] [ ] if ; ! when
+
+[ { [ [ ] if ] } ] [ \ lint1 lint ] unit-test
+
+: lint2
+    1 + ; ! 1+
+[ { [ 1 + ] } ] [ \ lint2 lint ] unit-test
+
+: lint3
+    dup -rot ; ! tuck
+
+[ { [ dup -rot ] } ] [ \ lint3 lint ] unit-test
+
diff --git a/extra/lint/lint.factor b/extra/lint/lint.factor
new file mode 100644 (file)
index 0000000..bd2be80
--- /dev/null
@@ -0,0 +1,158 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays assocs combinators.lib io kernel
+macros math namespaces prettyprint quotations sequences
+vectors vocabs words ;
+USING: html.elements slots.private tar ;
+IN: lint
+
+SYMBOL: def-hash
+SYMBOL: def-hash-keys
+
+: set-hash-vector ( val key hash -- )
+    2dup at -rot >r >r ?push r> r> set-at ;
+
+: add-word-def ( word quot -- )
+    dup quotation? [
+        def-hash get-global set-hash-vector
+    ] [
+        2drop
+    ] if ;
+
+: more-defs
+    {
+        { [ swap >r swap r> ] -rot }
+        { [ swap swapd ] -rot }
+        { [ >r swap r> swap ] rot }
+        { [ swapd swap ] rot }
+        { [ dup swap ] over }
+        { [ dup -rot ] tuck }
+        { [ >r swap r> ] swapd }
+        { [ nip nip ] 2nip }
+        { [ drop drop ] 2drop }
+        { [ drop drop drop ] 3drop }
+        { [ 0 = ] zero? }
+        { [ pop drop ] pop* }
+    } [ first2 swap add-word-def ] each ;
+
+: accessor-words ( -- seq )
+{
+    alien-signed-1 alien-signed-2 alien-signed-4 alien-signed-8
+    alien-unsigned-1 alien-unsigned-2 alien-unsigned-4 alien-unsigned-8
+    <displaced-alien> alien-unsigned-cell set-alien-signed-cell
+    set-alien-unsigned-1 set-alien-signed-1 set-alien-unsigned-2
+    set-alien-signed-2 set-alien-unsigned-4 set-alien-signed-4
+    set-alien-unsigned-8 set-alien-signed-8
+    alien-cell alien-signed-cell set-alien-cell set-alien-unsigned-cell
+    set-alien-float alien-float
+} ;
+
+: trivial-defs
+    {
+        [ get ] [ t ] [ { } ] [ . ] [ drop f ]
+        [ drop ] [ f ] [ first ] [ second ] [ third ] [ fourth ]
+        [ ">" write-html ] [ <unimplemented-typeflag> throw ]
+        [ "/>" write-html ]
+    } ;
+
+H{ } clone def-hash set-global
+all-words [ dup word-def add-word-def ] each
+more-defs
+
+! Remove empty word defs
+def-hash get-global [
+    drop empty? not
+] assoc-subset
+
+! Remove constants [ 1 ]
+[
+    drop dup length 1 = swap first number? and not
+] assoc-subset
+
+! Remove set-alien-cell, etc.
+[
+    drop [ accessor-words swap seq-diff ] keep [ length ] 2apply =
+] assoc-subset
+
+! Remove trivial defs
+[
+    drop trivial-defs member? not
+] assoc-subset
+
+! Remove n m shift defs
+[
+    drop dup length 3 = [
+        dup first2 [ number? ] 2apply and swap third \ shift = and not
+    ] [ drop t ] if
+] assoc-subset 
+
+! Remove [ n slot ]
+[
+    drop dup length 2 = [
+        first2 \ slot = swap number? and not
+    ] [ drop t ] if
+] assoc-subset def-hash set-global
+
+: find-duplicates
+    def-hash get-global [
+        nip length 1 >
+    ] assoc-subset ;
+
+def-hash get-global keys def-hash-keys set-global
+
+GENERIC: lint ( obj -- seq )
+
+M: object lint ( obj -- seq )
+    drop f ;
+
+: subseq/member? ( subseq/member seq -- ? )
+    { [ 2dup start ] [ 2dup member? ] } || 2nip ;
+
+M: quotation lint ( quot -- seq )
+    def-hash-keys get [
+        swap subseq/member?
+    ] curry* subset ;
+
+M: word lint ( word -- seq )
+    word-def dup quotation? [ lint ] [ drop f ] if ;
+
+: word-path. ( word -- )
+    [ word-vocabulary ":" ] keep unparse 3append write nl ;
+
+: lint. ( array -- )
+    first2 >r word-path. r> [
+        bl bl bl bl
+        dup .
+        "-----------------------------------" print
+        def-hash get at [ bl bl bl bl word-path. ] each
+        nl
+    ] each nl nl ;
+    
+
+GENERIC: run-lint ( obj -- obj )
+
+: trim-self ( seq -- newseq )
+    [
+        first2 [
+            def-hash get-global at* [
+                dupd remove empty? not
+            ] [
+                drop f
+            ] if
+        ] subset 2array
+    ] map ;
+
+M: sequence run-lint ( seq -- seq )
+    [
+        global [ dup . flush ] bind
+        dup lint 2array
+    ] map
+    trim-self
+    [ second empty? not ] subset ;
+
+M: word run-lint ( word -- seq )
+    1array run-lint ;
+
+: lint-all ( -- seq )
+    all-words run-lint dup [ lint. ] each ;
+
diff --git a/extra/lint/tags.txt b/extra/lint/tags.txt
new file mode 100644 (file)
index 0000000..90cd671
--- /dev/null
@@ -0,0 +1 @@
+lint refactor
diff --git a/extra/lisp/README b/extra/lisp/README
new file mode 100644 (file)
index 0000000..b33a662
--- /dev/null
@@ -0,0 +1,15 @@
+
+USE: lisp.listener lisp-listener
+
+This only works with a tty listener. lisp-listener doesn't play well
+with the ui listener.
+
+There is no run-file. Just paste in your code. :-)
+
+If you pick a name for a symbol that's already used in some Factor
+vocabulary, Factor Lisp will complain. For example, x and y are words
+in the gadgets-paragraphs vocabulary. To use these as symbols in
+Factor Lisp, just do this before you use them:
+
+       SYMBOL: x
+       SYMBOL: y
\ No newline at end of file
diff --git a/extra/lisp/authors.txt b/extra/lisp/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/lisp/lexer/lexer.factor b/extra/lisp/lexer/lexer.factor
new file mode 100644 (file)
index 0000000..14f0719
--- /dev/null
@@ -0,0 +1,13 @@
+
+USING: kernel parser generic math sequences strings ;
+
+IN: lisp.lexer
+
+TUPLE: sexp-lexer ;
+
+: <sexp-lexer> ( text -- lexer )
+    <lexer> sexp-lexer construct-delegate ;
+
+M: sexp-lexer skip-word ( lexer -- )
+[ 2dup nth "\"()" member?
+  [ drop 1+ ] [ [ dup blank? swap ")" member? or ] skip ] if ] change-column ;
\ No newline at end of file
diff --git a/extra/lisp/lisp.factor b/extra/lisp/lisp.factor
new file mode 100644 (file)
index 0000000..f13081d
--- /dev/null
@@ -0,0 +1,164 @@
+
+USING: kernel words namespaces combinators math
+       quotations strings arrays hashtables sequences
+       namespaces.lib rewrite-closures ;
+
+IN: lisp
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: && ( obj seq -- ? ) [ call ] curry* all? ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (quote sym)
+
+SYMBOL: quote
+
+: quote-exp? ( exp -- ? ) { [ array? ] [ length 2 = ] [ first quote = ] } && ;
+
+: eval-quote ( exp -- val ) second ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: eval-symbol ( exp -- val ) get ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: eval
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (begin ...)
+
+SYMBOL: begin
+
+: begin-exp? ( exp -- ? ) { [ array? ] [ length 2 >= ] [ first begin = ] } && ;
+
+: eval-begin ( exp -- val ) 1 tail dup peek >r 1 head* [ eval ] each r> eval ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (omega parameters ...)
+
+SYMBOL: omega
+
+: omega-exp? ( exp -- ? ) { [ array? ] [ length 3 >= ] [ first omega = ] } && ;
+
+: eval-omega ( exp -- val )
+dup second swap 2 tail { begin } swap append [ eval ] curry lambda ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (let ((var val) ...) exp ...)
+
+SYMBOL: let
+
+: let-exp? ( exp -- ? ) { [ array? ] [ length 2 >= ] [ first let = ] } && ;
+
+: eval-let ( exp -- val )
+dup >r second [ second ] map r>
+dup 2 tail swap second [ first ] map add* omega add* add* eval ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (df name (param ...) exp ...)
+
+SYMBOL: df
+
+: df-exp? ( exp -- ? ) { [ array? ] [ length 3 >= ] [ first df = ] } && ;
+
+: eval-df ( exp -- val ) dup 2 tail omega add* eval swap second tuck set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (dv var val)
+
+SYMBOL: dv
+
+: dv-exp? ( exp -- ? ) { [ array? ] [ length 3 = ] [ first dv = ] } && ;
+
+: eval-dv ( exp -- val ) dup >r third eval r> second set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (set! var val)
+
+SYMBOL: set!
+
+: set!-exp? ( exp -- ? ) { [ array? ] [ length 3 = ] [ first set! = ] } && ;
+
+: eval-set! ( exp -- val ) dup >r third eval r> second set* ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (dyn (param ...) exp ...)
+
+SYMBOL: dyn
+
+: dyn-exp? ( exp -- ? ) { [ array? ] [ length 3 >= ] [ first dyn = ] } && ;
+
+: eval-dyn ( exp -- val )
+dup second swap 2 tail begin add* [ eval ] curry parametric-quot scoped-quot ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (dy name (param ...) exp ...)
+
+SYMBOL: dy
+
+: dy-exp? ( exp -- ? ) { [ array? ] [ length 3 >= ] [ first dy = ] } && ;
+
+: eval-dy ( exp -- val ) dup 2 tail dyn add* eval swap second tuck set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : eval-list ( exp -- val )
+! [ eval ] map unclip >r [ ] each r>
+! { { [ dup quotation? ] [ call ] }
+!   { [ dup word? ]      [ execute ] } }
+! cond ;
+
+: eval-list ( exp -- val )
+unclip eval >r [ eval ] each r>
+{ { [ dup quotation? ] [ call ] }
+  { [ dup word? ]      [ execute ] } }
+cond ;
+
+! should probably be:
+
+! : eval-list ( exp -- val )
+! unclip >r [ eval ] each r> eval
+! { { [ dup quotation? ] [ call ] }
+!   { [ dup word? ]      [ execute ] } }
+! cond ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: eval ( exp -- val )
+{ { [ dup t eq? ]   [ ] }
+  { [ dup f eq? ]   [ ] }
+  { [ dup number? ] [ ] }
+  { [ dup string? ] [ ] }
+  { [ dup quotation? ] [ ] }
+  { [ dup hashtable? ] [ ] }
+  { [ dup quote-exp? ] [ eval-quote ] }
+  { [ dup begin-exp? ] [ eval-begin ] }
+  { [ dup omega-exp? ] [ eval-omega ] }
+  { [ dup let-exp? ]   [ eval-let ] }
+  { [ dup df-exp? ]    [ eval-df ] }
+  { [ dup dv-exp? ]    [ eval-dv ] }
+  { [ dup set!-exp? ]  [ eval-set! ] }
+  { [ dup dyn-exp? ]   [ eval-dyn ] }
+  { [ dup dy-exp? ]   [ eval-dy ] }
+  { [ dup symbol? ] [ eval-symbol ] }
+  { [ dup word? ] [ ] }
+  { [ dup array? ]  [ eval-list ] }
+} cond ;
+
+! : eval-quot-call ( exp -- val ) [ eval ] map unclip >r [ ] each r> call ;
+
+! : eval-word-call ( exp -- val ) [ eval ] map unclip >r [ ] each r> execute ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/extra/lisp/listener/listener.factor b/extra/lisp/listener/listener.factor
new file mode 100644 (file)
index 0000000..5af44ba
--- /dev/null
@@ -0,0 +1,28 @@
+
+USING: kernel parser namespaces io prettyprint math arrays sequences
+       words listener debugger
+       lisp lisp.lexer lisp.parser.mod lisp.listener.mod ;
+
+IN: lisp.listener
+
+: parse-stdio ( -- quot/f ) stdio get parse-interactive ;
+
+: stuff? ( -- ? ) datastack length 0 > ;
+
+: lisp-listen ( -- )
+[ parse-stdio [ call stuff? [ eval ] when ] [ bye ] if* ] try ;
+
+: until-quit ( -- )
+quit-flag get
+[ quit-flag off ]
+[ listener-hook get call prompt. lisp-listen until-quit ]
+if ;
+
+: lisp-listener ( -- ) [
+use [ clone ] change
+[ <sexp-lexer> ] >listener-lexer
+[ in get create dup define-symbol ] >new-symbol-action
+{ "lisp" "lisp.syntax" } add-use
+! [ listener-hook get call prompt. lisp-listen ] until-quit
+until-quit
+] with-scope ;
\ No newline at end of file
diff --git a/extra/lisp/listener/mod/mod.factor b/extra/lisp/listener/mod/mod.factor
new file mode 100644 (file)
index 0000000..06ea7f2
--- /dev/null
@@ -0,0 +1,20 @@
+! Broken by recent changes
+
+USING: kernel continuations namespaces parser combinators tuples generic vars ;
+! 
+IN: listener
+! 
+! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 
+VAR: listener-lexer
+! 
+! [ <lexer> ] listener-lexer set-global
+! 
+! : listener-parse-lines ( lines -- quot ) listener-lexer> call (parse-lines) ;
+! 
+! : parse-interactive-step ( lines -- quot/f )
+! [ listener-parse-lines ] catch {
+!     { [ dup [ unexpected-eof? ] is? ] [ 2drop f ] }
+!     { [ dup not ]                  [ drop ] }
+!     { [ t ]                        [ rethrow ] }
+! } cond ;
diff --git a/extra/lisp/parser/mod/mod.factor b/extra/lisp/parser/mod/mod.factor
new file mode 100644 (file)
index 0000000..e09562b
--- /dev/null
@@ -0,0 +1,38 @@
+! Broken by recent changes
+
+USING: kernel vocabs words combinators math
+       namespaces arrays sequences assocs sorting
+       inspector vars ;
+
+IN: parser
+! 
+! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 
+! : word-restarts ( string -- restarts )
+! words-named natural-sort
+! [ [ "Use the word " swap summary append ] keep 2array ] map
+! { "Define this word as a symbol" 0 } add
+! { "Defer this word in the 'scratchpad' vocabulary" f } add ;
+! 
+! : no-word-option ( obj -- word )
+! { { [ dup f = ] [ drop in get create ] }
+!   { [ dup 0 = ] [ drop in get create dup define-symbol ] }
+!   { [ t ]       [ nip dup word-vocabulary use+ ] }
+! } cond ;
+! 
+VAR: new-symbol-action ! ( str -- word )
+! 
+! [ dup no-word no-word-option ] new-symbol-action set-global 
+! 
+! ! For lisp:
+! ! 
+! ! [ in get create dup define-symbol ] >new-symbol-action
+! 
+! : search ( str -- word )
+! { { [ dup use get assoc-stack ]
+!     [ use get assoc-stack ] }
+!   { [ dup words-named empty? ]
+!     [ new-symbol-action> call ] }
+!   { [ dup words-named length 0 > ]
+!     [ dup no-word no-word-option ] }
+! } cond ;
diff --git a/extra/lisp/summary.txt b/extra/lisp/summary.txt
new file mode 100644 (file)
index 0000000..e25e24c
--- /dev/null
@@ -0,0 +1,2 @@
+Factor Lisp Interpreter
+
diff --git a/extra/lisp/syntax/syntax.factor b/extra/lisp/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..4c46538
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: parser arrays ;
+
+IN: lisp.syntax
+
+DEFER: )
+
+: ( \ ) [ >array ] parse-literal ; parsing
\ No newline at end of file
diff --git a/extra/lisp/tags.txt b/extra/lisp/tags.txt
new file mode 100644 (file)
index 0000000..f732384
--- /dev/null
@@ -0,0 +1,2 @@
+extensions
+languages
diff --git a/extra/lisppaste/authors.txt b/extra/lisppaste/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/lisppaste/lisppaste.factor b/extra/lisppaste/lisppaste.factor
new file mode 100644 (file)
index 0000000..df85f01
--- /dev/null
@@ -0,0 +1,12 @@
+USING: arrays kernel xml-rpc ;
+IN: lisppaste
+
+: url "http://www.common-lisp.net:8185/RPC2" ;
+
+: channels ( -- seq )
+    { } "listchannels" url invoke-method ;
+
+: lisppaste ( seq -- response )
+    ! seq is { channel user title contents }
+    ! or { channel user title contents annotation-number }
+    "newpaste" url invoke-method ;
diff --git a/extra/lisppaste/summary.txt b/extra/lisppaste/summary.txt
new file mode 100644 (file)
index 0000000..1f650d3
--- /dev/null
@@ -0,0 +1 @@
+XML-RPC interface to http://paste.lisp.org
diff --git a/extra/lisppaste/tags.txt b/extra/lisppaste/tags.txt
new file mode 100644 (file)
index 0000000..d17547f
--- /dev/null
@@ -0,0 +1,3 @@
+demos
+web
+network
diff --git a/extra/locals/authors.txt b/extra/locals/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/locals/locals-docs.factor b/extra/locals/locals-docs.factor
new file mode 100644 (file)
index 0000000..92d64d5
--- /dev/null
@@ -0,0 +1,115 @@
+USING: help.syntax help.markup kernel macros prettyprint ;
+IN: locals
+
+<PRIVATE
+
+: $with-locals-note
+    {
+        "This form must appear either in a word defined by " { $link POSTPONE: :: } " or " { $link POSTPONE: MACRO:: } ", or alternatively, " { $link with-locals } " must be called on the top-level form of the word to perform closure conversion."
+    } $notes ;
+
+PRIVATE>
+
+HELP: [|
+{ $syntax "[| bindings... | body... ]" }
+{ $description "A lambda abstraction. When called, reads stack values into the bindings from left to right; the body may then refer to these bindings." }
+{ $examples
+    { $example
+        "USE: locals"
+        ":: adder | n | [| m | m n + ] ;"
+        "3 5 adder call ."
+        "8"
+    }
+}
+$with-locals-note ;
+
+HELP: [let
+{ $syntax "[let | binding1 [ value1... ]\n       binding2 [ value2... ]\n       ... |\n    body... ]" }
+{ $description "Introduces a set of lexical bindings and evaluates the body. The values are evaluated in parallel, and may not refer to other bindings within the same " { $link POSTPONE: [let } " form; for Lisp programmers, this means that Factor's " { $link POSTPONE: [let } " is equivalent to the Lisp " { $snippet "let" } ", not " { $snippet "let*" } "." }
+{ $examples
+    { $example
+        "USE: locals"
+        ":: frobnicate | n seq |"
+        "    [let | n' [ n 6 * ] |"
+        "        seq [ n' gcd ] map ] ;"
+        "6 { 36 14 } frobnicate ."
+        "{ 36 2 }"
+    }
+}
+$with-locals-note ;
+
+HELP: [wlet
+{ $syntax "[wlet | binding1 [ body1... ]\n        binding2 [ body2... ]\n        ... |\n     body... ]" }
+{ $description "Introduces a set of lexically-scoped non-recursive local functions. The bodies may not refer to other bindings within the same " { $link POSTPONE: [wlet } " form; for Lisp programmers, this means that Factor's " { $link POSTPONE: [wlet } " is equivalent to the Lisp " { $snippet "flet" } ", not " { $snippet "labels" } "." }
+{ $examples
+    { $example
+        "USE: locals"
+        ":: quuxify | n seq |"
+        "    [wlet | add-n [| m | m n + ] |"
+        "        seq [ add-n ] map ] ;"
+        "2 { 1 2 3 } quuxify ."
+        "{ 3 4 5 }"
+    }
+} ;
+
+HELP: with-locals
+{ $values { "form" "a quotation, lambda, let or wlet form" } { "quot" "a quotation" } }
+{ $description "Performs closure conversion of a lexically-scoped form. All nested sub-forms are converted. This word must be applied to a " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [wlet } " used in an ordinary definition, however forms in " { $link POSTPONE: :: } " and " { $link POSTPONE: MACRO:: } " definitions are automatically closure-converted and there is no need to use this word." } ;
+
+HELP: ::
+{ $syntax ":: word | bindings... | body... ;" }
+{ $description "Defines a word with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope. Any " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [wlet } " forms used in the body of the word definition are automatically closure-converted." }
+{ $examples "See " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " and " { $link POSTPONE: [wlet } "." } ;
+
+HELP: MACRO::
+{ $syntax "MACRO:: word | bindings... | body... ;" }
+{ $description "Defines a macro with named inputs; it reads stack values into bindings from left to right, then executes the body with those bindings in lexical scope. Any " { $link POSTPONE: [| } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [wlet } " forms used in the body of the word definition are automatically closure-converted." } ;
+
+{ POSTPONE: MACRO: POSTPONE: MACRO:: } related-words
+
+ARTICLE: "locals-mutable" "Mutable locals"
+"In the list of bindings supplied to " { $link POSTPONE: :: } ", " { $link POSTPONE: [let } " or " { $link POSTPONE: [| } ", a mutable binding may be introduced by suffixing its named with " { $snippet "!" } ". Mutable bindings are read by giving their name as usual; the suffix is not part of the binding's name. To write to a mutable binding, use the binding's with the " { $snippet "!" } " suffix."
+$nl
+"Here is a example word which outputs a pair of quotations which increment and decrement an internal counter, and then return the new value. The quotations are closed over the counter and each invocation of the word yields new quotations with their unique internal counter:"
+{ $code
+    ":: counter | |"
+    "    [let | value! [ 0 ] |"
+    "        [ value 1+ dup value! ]"
+    "        [ value 1- dup value! ] ] ;"
+}
+"Mutable bindings are implemented in a manner similar to the ML language; each mutable binding is actually an immutable binding of a mutable cell (in Factor's case, a 1-element array); reading the binding automatically dereferences the array, and writing to the binding stores into the array."
+$nl
+"Unlike some languages such as Python and Java, writing to mutable locals in outer scopes is fully supported and has the expected semantics." ;
+
+ARTICLE: "locals-limitations" "Limitations of locals"
+"The first limitation is that the " { $link >r } " and " { $link r> } " words may not be used together with locals. Instead, use the " { $link dip } " combinator."
+$nl
+"Another limitation is that closure conversion does not descend into arrays, hashtables or other types of literals. For example, the following does not work:"
+{ $code
+    ":: bad-cond-usage | a |"
+    "    { [ a 0 < ] [ ... ] }"
+    "    { [ a 0 > ] [ ... ] }"
+    "    { [ a 0 = ] [ ... ] } ;"
+} ;
+
+ARTICLE: "locals" "Local variables and lexical closures"
+"The " { $vocab-link "locals" } " vocabulary implements lexical scope with full closures, both downward and upward. Mutable bindings are supported, including assignment to bindings in outer scope."
+$nl
+"Compile-time transformation is used to compile local variables to efficient code; prettyprinter extensions are defined so that " { $link see } " can display original word definitions with local variables and not the closure-converted concatenative code which results."
+$nl
+"Applicative word definitions where the inputs are named local variables:"
+{ $subsection POSTPONE: :: }
+{ $subsection POSTPONE: MACRO:: }
+"Explicit closure conversion outside of applicative word definitions:"
+{ $subsection with-locals }
+"Lexical binding forms:"
+{ $subsection POSTPONE: [let }
+{ $subsection POSTPONE: [wlet }
+"Lambda abstractions:"
+{ $subsection POSTPONE: [| }
+"Additional topics:"
+{ $subsection "locals-mutable" }
+{ $subsection "locals-limitations" }
+"Locals complement dynamically scoped variables implemented in the " { $vocab-link "namespaces" } " vocabulary." ;
+
+ABOUT: "locals"
diff --git a/extra/locals/locals-tests.factor b/extra/locals/locals-tests.factor
new file mode 100644 (file)
index 0000000..f9ff881
--- /dev/null
@@ -0,0 +1,110 @@
+USING: locals math sequences tools.test hashtables words kernel
+namespaces ;
+IN: temporary
+
+:: foo | a b | a a ;
+
+[ 1 1 ] [ 1 2 foo ] unit-test
+
+:: add-test | a b | a b + ;
+
+[ 3 ] [ 1 2 add-test ] unit-test
+
+:: sub-test | a b | a b - ;
+
+[ -1 ] [ 1 2 sub-test ] unit-test
+
+:: map-test | a b | a [ b + ] map ;
+
+[ { 5 6 7 } ] [ { 1 2 3 } 4 map-test ] unit-test
+
+:: map-test-2 | seq inc | seq [| elt | elt inc + ] map ;
+
+[ { 5 6 7 } ] [ { 1 2 3 } 4 map-test-2 ] unit-test
+
+:: let-test | c |
+    [let | a [ 1 ] b [ 2 ] | a b + c + ] ;
+
+[ 7 ] [ 4 let-test ] unit-test
+
+:: let-test-2 | |
+    [let | a [ ] | [let | b [ a ] | a ] ] ;
+
+[ 3 ] [ 3 let-test-2 ] unit-test
+
+:: let-test-3 | |
+    [let | a [ ] | [let | b [ [ a ] ] | [let | a [ 3 ] | b ] ] ] ;
+
+[ -1 ] [ -1 let-test-3 call ] unit-test
+
+[ 5 ] [
+    [let | a [ 3 ] | [wlet | func [ a + ] | 2 func ] ]
+    with-locals
+] unit-test
+
+:: wlet-test-2 | a b |
+    [wlet | add-b [ b + ] |
+        a [ add-b ] map ] ;
+
+
+[ { 4 5 6 } ] [ { 2 3 4 } 2 wlet-test-2 ] unit-test
+    
+:: wlet-test-3 | a |
+    [wlet | add-a [ a + ] | [ add-a ] ]
+    [let | a [ 3 ] | a swap call ] ;
+
+[ 5 ] [ 2 wlet-test-3 ] unit-test
+
+:: wlet-test-4 | a |
+    [wlet | sub-a [| b | b a - ] |
+        3 sub-a ] ;
+
+[ -7 ] [ 10 wlet-test-4 ] unit-test
+
+:: write-test-1 | n! |
+    [| i | n i + dup n! ] ;
+
+0 write-test-1 "q" set
+
+[ 1 ] [ 1 "q" get call ] unit-test
+
+[ 2 ] [ 1 "q" get call ] unit-test
+
+[ 3 ] [ 1 "q" get call ] unit-test
+
+[ 5 ] [ 2 "q" get call ] unit-test
+
+:: write-test-2 | |
+    [let | n! [ 0 ] |
+        [| i | n i + dup n! ] ] ;
+
+write-test-2 "q" set
+
+[ 1 ] [ 1 "q" get call ] unit-test
+
+[ 2 ] [ 1 "q" get call ] unit-test
+
+[ 3 ] [ 1 "q" get call ] unit-test
+
+[ 5 ] [ 2 "q" get call ] unit-test
+
+[ 10 20 ]
+[
+    20 10 [| a! | [| b! | a b ] ] with-locals call call
+] unit-test
+
+:: write-test-3 | a! | [| b | b a! ] ;
+
+[ ] [ 1 2 write-test-3 call ] unit-test
+
+:: write-test-4 | x! | [ [let | y! [ 0 ] | f x! ] ] ;
+
+[ ] [ 5 write-test-4 drop ] unit-test
+
+SYMBOL: a
+
+:: use-test | a b c |
+    USE: kernel
+    ;
+
+[ t ] [ a symbol? ] unit-test
diff --git a/extra/locals/locals.factor b/extra/locals/locals.factor
new file mode 100644 (file)
index 0000000..ca157fa
--- /dev/null
@@ -0,0 +1,336 @@
+! Inspired by
+! http://cat-language.googlecode.com/svn/trunk/CatPointFreeForm.cs
+
+USING: kernel namespaces sequences sequences.private assocs
+       math inference.transforms parser words quotations debugger
+       macros arrays macros splitting combinators prettyprint.backend
+       definitions prettyprint hashtables combinators.lib ;
+
+IN: locals
+
+<PRIVATE
+
+TUPLE: lambda vars body ;
+
+C: <lambda> lambda
+
+TUPLE: let bindings vars body ;
+
+C: <let> let
+
+TUPLE: wlet bindings vars body ;
+
+C: <wlet> wlet
+
+PREDICATE: word local "local?" word-prop ;
+
+: <local> ( name -- word )
+    #! Create a local variable identifier
+    f <word> dup t "local?" set-word-prop ;
+
+PREDICATE: word local-word "local-word?" word-prop ;
+
+: <local-word> ( name -- word )
+    f <word> dup t "local-word?" set-word-prop ;
+
+PREDICATE: word local-reader "local-reader?" word-prop ;
+
+: <local-reader> ( name -- word )
+    f <word> dup t "local-reader?" set-word-prop ;
+
+PREDICATE: word local-writer "local-writer?" word-prop ;
+
+: <local-writer> ( reader -- word )
+    dup word-name "!" append f <word>
+    [ t "local-writer?" set-word-prop ] keep
+    [ "local-writer" set-word-prop ] 2keep
+    [ swap "local-reader" set-word-prop ] keep ;
+
+TUPLE: quote local ;
+
+C: <quote> quote
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! read-local
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: local-index ( obj args -- n )
+    [ dup quote? [ quote-local ] when eq? ] curry* find drop ;
+
+: read-local ( obj args -- quot )
+    local-index 1+
+    dup [ r> ] <repetition> concat [ dup ] append
+    swap [ swap >r ] <repetition> concat append ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! localize
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: localize-writer ( obj args -- quot )
+  >r "local-reader" word-prop r> read-local [ set-first ] append ;
+
+: localize ( obj args -- quot )
+    {
+        { [ over local? ]        [ read-local ] }
+        { [ over quote? ]        [ >r quote-local r> read-local ] }
+        { [ over local-word? ]   [ read-local [ call ] append ] }
+        { [ over local-reader? ] [ read-local [ first ] append ] }
+        { [ over local-writer? ] [ localize-writer ] }
+        { [ over \ lambda eq? ]  [ 2drop [ ] ] }
+        { [ t ]                  [ drop 1quotation ] }
+    } cond ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! point-free
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+UNION: special local quote local-word local-reader local-writer ;
+
+: load-local ( arg -- quot ) 
+    local-reader? [ 1array >r ] [ >r ] ? ;
+
+: load-locals ( quot args -- quot )
+    nip <reversed> [ load-local ] map concat ;
+
+: drop-locals ( args -- args quot )
+    dup length [ r> drop ] <repetition> concat ;
+
+: point-free-body ( quot args -- newquot )
+    >r 1 head-slice* r> [ localize ] curry map concat ;
+
+: point-free-end ( quot args -- newquot )
+    over peek special?
+    [ drop-locals >r >r peek r> localize r> append ]
+    [ drop-locals nip swap peek add ]
+    if ;
+
+: (point-free) ( quot args -- newquot )
+    { [ load-locals ] [ point-free-body ] [ point-free-end ] }
+    map-call-with2 concat >quotation ;
+
+: point-free ( quot args -- newquot )
+    over empty? [ drop ] [ (point-free) ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! free-vars
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+UNION: lexical local local-reader local-writer local-word ;
+
+GENERIC: free-vars ( form -- vars )
+
+: add-if-free ( vars object -- vars )
+  {
+      { [ dup local-writer? ] [ "local-reader" word-prop add ] }
+      { [ dup lexical? ]      [ add ] }
+      { [ dup quote? ]        [ quote-local add ] }
+      { [ t ]                 [ free-vars append ] }
+  } cond ;
+
+M: object free-vars drop { } ;
+
+M: quotation free-vars { } [ add-if-free ] reduce ;
+
+M: lambda free-vars
+    dup lambda-vars swap lambda-body free-vars seq-diff ;
+
+M: let free-vars
+    dup let-vars swap let-body free-vars seq-diff ;
+
+M: wlet free-vars
+    dup wlet-vars swap wlet-body free-vars seq-diff ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! lambda-rewrite
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+GENERIC: lambda-rewrite* ( obj -- )
+
+: lambda-rewrite [ lambda-rewrite* ] [ ] make ;
+
+UNION: block quotation lambda ;
+
+GENERIC: block-vars ( block -- seq )
+
+GENERIC: block-body ( block -- quot )
+
+M: quotation block-vars drop { } ;
+
+M: quotation block-body ;
+
+M: lambda block-vars lambda-vars ;
+
+M: lambda block-body lambda-body ;
+
+M: block lambda-rewrite*
+    #! Turn free variables into bound variables, curry them
+    #! onto the body
+    dup free-vars [ <quote> ] map dup % [
+        over block-vars swap append
+        swap block-body [ [ lambda-rewrite* ] each ] [ ] make
+        swap point-free ,
+    ] keep length \ curry <repetition> % ;
+
+M: object lambda-rewrite* , ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make-locals ( seq -- words assoc )
+    [
+        "!" ?tail [ <local-reader> ] [ <local> ] if
+    ] map dup [
+        dup
+        [ dup word-name set ] each
+        [
+            dup local-reader? [
+                <local-writer> dup word-name set
+            ] [
+                drop
+            ] if
+        ] each
+    ] H{ } make-assoc ;
+
+: make-local-words ( seq -- words assoc )
+    [ dup <local-word> ] { } map>assoc
+    dup values swap ;
+
+: push-locals ( assoc -- )
+    use get push ;
+
+: parse-locals ( -- words assoc )
+    "|" parse-tokens make-locals ;
+
+: pop-locals ( assoc -- )
+    use get delete ;
+
+: (parse-lambda) ( assoc end -- quot )
+    over push-locals parse-until >quotation swap pop-locals ;
+
+: parse-lambda ( -- lambda )
+    parse-locals \ ] (parse-lambda) <lambda> ;
+
+: (parse-bindings) ( -- )
+    scan dup "|" = [
+        drop
+    ] [
+        scan {
+            { "[" [ \ ] parse-until >quotation ] }
+            { "[|" [ parse-lambda ] }
+        } case 2array ,
+        (parse-bindings)
+    ] if ;
+
+: parse-bindings ( -- alist )
+    scan "|" assert= [ (parse-bindings) ] { } make dup keys ;
+
+: let-rewrite ( words body -- )
+    <lambda> lambda-rewrite* \ call , ;
+
+M: let lambda-rewrite*
+    dup let-bindings values [ lambda-rewrite* \ call , ] each
+    { let-vars let-body } get-slots let-rewrite ;
+
+M: wlet lambda-rewrite*
+    dup wlet-bindings values [ lambda-rewrite* ] each
+    { wlet-vars wlet-body } get-slots let-rewrite ;
+
+: (::) ( prop -- word quot n )
+    >r CREATE dup reset-generic
+    scan "|" assert= parse-locals \ ; (parse-lambda) <lambda>
+    2dup r> set-word-prop
+    [ lambda-rewrite first ] keep lambda-vars length ;
+
+PRIVATE>
+
+: [| parse-lambda parsed ; parsing
+
+: [let
+    parse-bindings
+    make-locals \ ] (parse-lambda)
+    <let> parsed ; parsing
+
+: [wlet
+    parse-bindings
+    make-local-words \ ] (parse-lambda)
+    <wlet> parsed ; parsing
+
+MACRO: with-locals ( form -- quot ) lambda-rewrite ;
+
+: :: "lambda" (::) drop define-compound ; parsing
+
+: MACRO:: "lambda-macro" (::) (MACRO:) ; parsing
+
+<PRIVATE
+
+! Pretty-printing locals
+SYMBOL: |
+
+: pprint-var ( var -- )
+    #! Prettyprint a read/write local as its writer, just like
+    #! in the input syntax: [| x! | ... x 3 + x! ]
+    dup local-reader? [
+        "local-writer" word-prop
+    ] when pprint-word ;
+
+: pprint-vars ( vars -- ) [ pprint-var ] each ;
+
+M: lambda pprint*
+    <flow
+    \ [| pprint-word
+    dup lambda-vars pprint-vars
+    \ | pprint-word
+    f <inset lambda-body pprint-elements block>
+    \ ] pprint-word
+    block> ;
+
+: pprint-let ( body vars bindings -- )
+    \ | pprint-word
+    t <inset
+    <block
+    values [ <block >r pprint-word r> pprint* block> ] 2each
+    block>
+    \ | pprint-word
+    <block pprint-elements block>
+    block> ;
+
+M: let pprint*
+    \ [let pprint-word
+    { let-body let-vars let-bindings } get-slots pprint-let
+    \ ] pprint-word ;
+
+M: wlet pprint*
+    \ [let pprint-word
+    { wlet-body wlet-vars wlet-bindings } get-slots pprint-let
+    \ ] pprint-word ;
+
+PREDICATE: compound lambda-word
+    "lambda" word-prop >boolean ;
+
+M: lambda-word definer drop \ :: \ ; ;
+
+M: lambda-word definition
+    "lambda" word-prop lambda-body ;
+
+: lambda-word-synopsis ( word prop definer -- )
+    pick seeing-word pprint-word over pprint-word
+    \ | pprint-word
+    word-prop lambda-vars pprint-vars
+    \ | pprint-word ;
+
+M: lambda-word synopsis*
+    "lambda" \ :: lambda-word-synopsis ;
+
+PREDICATE: macro lambda-macro
+    "lambda-macro" word-prop >boolean ;
+
+M: lambda-macro definer drop \ MACRO:: \ ; ;
+
+M: lambda-macro definition
+    "lambda-macro" word-prop lambda-body ;
+
+M: lambda-macro synopsis*
+    "lambda-macro" \ MACRO:: lambda-word-synopsis ;
+
+PRIVATE>
diff --git a/extra/locals/summary.txt b/extra/locals/summary.txt
new file mode 100644 (file)
index 0000000..4f2a44e
--- /dev/null
@@ -0,0 +1 @@
+Efficient named local variables and lexical closures
diff --git a/extra/locals/tags.txt b/extra/locals/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/lsys/authors.txt b/extra/lsys/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/lsys/strings/strings.factor b/extra/lsys/strings/strings.factor
new file mode 100644 (file)
index 0000000..64fe648
--- /dev/null
@@ -0,0 +1,60 @@
+
+USING: kernel combinators math math.parser assocs sequences quotations vars ;
+
+IN: lsys.strings
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Lindenmayer string rewriting
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Maybe use an array instead of a quot in the work of segment
+
+VAR: rules
+
+: segment ( str -- seq )
+{ { [ dup "" = ] [ drop [ ] ] }
+  { [ dup length 1 = ] [ 1quotation ] }
+  { [ 1 over nth CHAR: ( = ]
+    [ CHAR: ) over index 1 +           ! str i
+      2dup head                                ! str i head
+      -rot tail                                ! head tail
+      segment swap add* ] }
+  { [ t ] [ dup 1 head swap 1 tail segment swap add* ] } }
+cond ;
+
+: lookup ( str -- str ) dup 1 head rules> at dup [ nip ] [ drop ] if ;
+
+: rewrite ( str -- str ) segment [ lookup ] map concat ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: result
+
+: iterate ( -- ) result> rewrite >result ;
+
+: iterations ( n -- ) [ iterate ] times ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Lindenmayer string interpretation
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: command-table
+
+: segment-command ( seg -- command ) 1 head ;
+
+: segment-parameter ( seg -- parameter )
+dup length 1 - 2 swap rot subseq string>number ;
+
+: segment-parts ( seg -- param command )
+dup segment-parameter swap segment-command ;
+
+: exec-command ( str -- ) command-table> at dup [ call ] [ drop ] if ;
+
+: exec-command-with-param ( param command -- )
+command-table> at dup [ peek 1quotation call ] [ 2drop ] if ;
+
+: (interpret) ( seg -- )
+dup length 1 =
+[ exec-command ] [ segment-parts exec-command-with-param ] if ;
+
+: interpret ( str -- ) segment [ (interpret) ] each ;
diff --git a/extra/lsys/summary.txt b/extra/lsys/summary.txt
new file mode 100644 (file)
index 0000000..bce1465
--- /dev/null
@@ -0,0 +1 @@
+L-system explorer
diff --git a/extra/lsys/tags.txt b/extra/lsys/tags.txt
new file mode 100644 (file)
index 0000000..bf31fdb
--- /dev/null
@@ -0,0 +1 @@
+applications
diff --git a/extra/lsys/tortoise/graphics/graphics.factor b/extra/lsys/tortoise/graphics/graphics.factor
new file mode 100644 (file)
index 0000000..23bf66c
--- /dev/null
@@ -0,0 +1,149 @@
+
+USING: kernel math vectors sequences opengl.gl math.vectors math.matrices
+       vars opengl.lib self pos ori turtle lsys.tortoise lsys.strings ;
+
+IN: lsys.tortoise.graphics
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (v0 - v1) x (v1 - v2)
+
+: polygon-normal ( {_v0_v1_v2_} -- normal ) first3 dupd v- -rot v- swap cross ;
+
+: (polygon) ( vertices -- )
+GL_POLYGON glBegin
+dup polygon-normal gl-normal-3f [ gl-vertex-3f ] each
+glEnd ;
+
+: polygon ( vertices -- ) dup length 3 >= [ (polygon) ] [ drop ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: vertices
+
+! : init-vertices ( -- ) 0 <vector> >vertices ;
+
+: start-polygon ( -- ) vertices> delete-all ;
+
+: finish-polygon ( -- ) vertices> polygon ;
+
+: polygon-vertex ( -- ) pos> vertices> push ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: record-vertex ( -- ) pos> gl-vertex-3f ;
+
+: draw-forward ( length -- )
+GL_LINES glBegin record-vertex step-turtle record-vertex glEnd ;
+
+: move-forward ( length -- ) step-turtle polygon-vertex ;
+
+: sneak-forward ( length -- ) step-turtle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: scale-len ( m -- ) len> * >len ;
+
+: scale-angle ( m -- ) angle> * >angle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-thickness ( i -- ) dup >thickness glLineWidth ;
+
+: scale-thickness ( m -- ) thickness> * 0.5 max set-thickness ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: color-table
+
+: init-color-table ( -- )
+{ { 0    0    0 }    ! black
+  { 0.5  0.5  0.5 }  ! grey
+  { 1    0    0 }    ! red
+  { 1    1    0 }    ! yellow
+  { 0    1    0 }    ! green
+  { 0.25 0.88 0.82 } ! turquoise
+  { 0    0    1 }    ! blue
+  { 0.63 0.13 0.94 } ! purple
+  { 0.00 0.50 0.00 } ! dark green
+  { 0.00 0.82 0.82 } ! dark turquoise
+  { 0.00 0.00 0.50 } ! dark blue
+  { 0.58 0.00 0.82 } ! dark purple
+  { 0.50 0.00 0.00 } ! dark red
+  { 0.25 0.25 0.25 } ! dark grey
+  { 0.75 0.75 0.75 } ! medium grey
+  { 1    1    1 }    ! white
+} [ 1 add ] map >color-table ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: material-color ( color -- )
+GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE rot gl-material-fv ;
+
+: set-color ( i -- )
+dup >color color-table> nth dup gl-color-4f material-color ;
+
+: inc-color ( -- ) color> 1+ set-color ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: tortoise-stack
+
+! : init-tortoise-stack ( -- ) V{ } clone >tortoise-stack ;
+
+! : save-tortoise ( -- ) self> tortoise-stack> push ;
+
+! : save-tortoise ( -- ) self> tortoise-stack> push   self> clone >self ;
+
+: save-tortoise ( -- ) self> clone tortoise-stack> push ;
+
+: restore-tortoise ( -- )
+tortoise-stack> pop >self
+color> set-color
+thickness> set-thickness ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: default-values
+VAR: model-values
+
+: lparser-dialect ( -- )
+
+[ 1 >len   45 >angle   1 >thickness   2 >color ] >default-values
+
+H{ { "+" [ angle>     turn-left ] }
+   { "-" [ angle>     turn-right ] }
+   { "&" [ angle>     pitch-down ] }
+   { "^" [ angle>     pitch-up ] }
+   { "<" [ angle>     roll-left ] }
+   { ">" [ angle>     roll-right ] }
+
+   { "|" [ 180.0         rotate-y ] }
+   { "%" [ 180.0         rotate-z ] }
+   { "$" [ roll-until-horizontal ]  }
+
+   { "F" [ len>     draw-forward ] }
+   { "Z" [ len> 2 / draw-forward ] }
+   { "f" [ len>     move-forward ] }
+   { "z" [ len> 2 / move-forward ] }
+   { "g" [ len>     sneak-forward ] }
+   { "." [ polygon-vertex ] }
+
+   { "[" [ save-tortoise ] }
+   { "]" [ restore-tortoise ] }
+   { "{" [ start-polygon ] }
+   { "}" [ finish-polygon ] }
+
+   { "/" [ 1.1 scale-len ] } ! double quote command in lparser
+   { "'" [ 0.9 scale-len ] }
+   { ";" [ 1.1 scale-angle ] }
+   { ":" [ 0.9 scale-angle ] }
+   { "?" [ 1.4 scale-thickness ] }
+   { "!" [ 0.7 scale-thickness ] }
+
+   { "c" [ color> 1 + color-table> length mod set-color ] }
+
+} >command-table ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/extra/lsys/tortoise/tortoise.factor b/extra/lsys/tortoise/tortoise.factor
new file mode 100644 (file)
index 0000000..8c4ac60
--- /dev/null
@@ -0,0 +1,31 @@
+
+USING: kernel generic math arrays
+       math.matrices generic.lib pos ori self turtle ;
+
+IN: lsys.tortoise
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: tortoise angle len thickness color ;
+
+: <tortoise> ( -- tortoise )
+    <turtle> tortoise construct-delegate ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: angle> ( -- val ) self> tortoise-angle ;
+
+: >angle ( val -- ) self> set-tortoise-angle ;
+
+: len> ( -- val ) self> tortoise-len ;
+
+: >len ( val -- ) self> set-tortoise-len ;
+
+: thickness> ( -- val ) self> tortoise-thickness ;
+
+: >thickness ( val -- ) self> set-tortoise-thickness ;
+
+: color> ( -- val ) self> tortoise-color ;
+
+: >color ( val -- ) self> set-tortoise-color ;
+
diff --git a/extra/lsys/ui/ui.factor b/extra/lsys/ui/ui.factor
new file mode 100644 (file)
index 0000000..efdaa9c
--- /dev/null
@@ -0,0 +1,493 @@
+
+USING: kernel namespaces threads math math.vectors quotations sequences
+       opengl.gl
+       colors
+       ui
+       ui.gestures
+       ui.gadgets
+       ui.gadgets.packs
+       ui.gadgets.labels
+       ui.gadgets.buttons
+       ui.gadgets.lib
+       ui.gadgets.slate
+       ui.gadgets.theme
+       vars rewrite-closures opengl.lib 
+       self pos ori turtle opengl.camera
+       lsys.tortoise lsys.tortoise.graphics lsys.strings
+;
+
+IN: lsys.ui
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: slate
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: camera
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: model
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: display ( -- )
+
+black gl-clear-color
+
+GL_FLAT glShadeModel
+
+GL_PROJECTION glMatrixMode
+glLoadIdentity
+-1 1 -1 1 1.5 200 glFrustum
+
+GL_MODELVIEW glMatrixMode
+
+glLoadIdentity
+
+camera> do-look-at
+
+GL_COLOR_BUFFER_BIT glClear
+
+GL_FRONT_AND_BACK GL_LINE glPolygonMode
+
+white gl-color-4f
+
+GL_LINES glBegin { 0 0 0 } gl-vertex-3f { 0 0 1 } gl-vertex-3f glEnd
+
+color> set-color
+
+model> glCallList ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: result>model ( -- )
+slate> find-gl-context
+model> GL_COMPILE glNewList result> interpret glEndList ;
+
+: build-model ( -- )
+tortoise-stack> delete-all
+vertices> delete-all
+reset-turtle
+default-values> call
+model-values> call
+result>model
+[ display ] closed-quot slate> set-slate-action
+slate> relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USING: hashtables namespaces.lib ui.gadgets.handler ;
+
+: camera-action ( quot -- quot )
+[ drop [ ] camera> with-self slate> relayout-1 ] make* closed-quot ;
+
+VAR: frame
+VAR: handler
+
+DEFER: model-chooser
+DEFER: scene-chooser
+DEFER: empty-model
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: lsys-controller ( -- )
+
+{
+
+[ "Load" <label> dup reverse-video-theme ]
+
+[ "Models" <label> [ drop model-chooser ] closed-quot <bevel-button> ]
+[ "Scenes" <label> [ drop scene-chooser ] closed-quot <bevel-button> ]
+
+[ "Model" <label> dup reverse-video-theme ]
+
+[ "Iterate" <label> [ drop iterate build-model ] closed-quot <bevel-button> ]
+[ "Build model" <label> [ drop build-model ] closed-quot <bevel-button> ]
+
+[ "Camera" <label> dup reverse-video-theme ]
+
+[ "Turn left" <label> [ 5 turn-left ] camera-action <bevel-button> ]
+[ "Turn right" <label> [ 5 turn-right ] camera-action <bevel-button> ]
+[ "Pitch down" <label> [ 5 pitch-down ] camera-action <bevel-button> ]
+[ "Pitch up" <label> [ 5 pitch-up ] camera-action <bevel-button> ]
+
+[ "Forward - a"  <label> [  1 step-turtle ] camera-action <bevel-button> ]
+[ "Backward - z" <label> [ -1 step-turtle ] camera-action <bevel-button> ]
+
+[ "Roll left - q" <label> [ 5 roll-left ] camera-action <bevel-button> ]
+[ "Roll right - w" <label> [ 5 roll-right ] camera-action <bevel-button> ]
+
+[ "Strafe left - (alt)" <label> [ 1 strafe-left ] camera-action <bevel-button> ]
+[ "Strafe right - (alt)" <label> [ 1 strafe-right ] camera-action <bevel-button> ]
+[ "Strafe down - (alt)" <label> [ 1 strafe-up ] camera-action <bevel-button> ]
+[ "Strafe up - (alt)" <label> [ 1 strafe-down ] camera-action <bevel-button> ]
+
+[ "View 1 - 1" <label>
+  [ pos> norm reset-turtle 90 turn-left step-turtle 180 turn-left ]
+  camera-action <bevel-button> ]
+
+[ "View 2 - 2" <label>
+  [ pos> norm reset-turtle 90 pitch-up step-turtle 180 pitch-down ]
+  camera-action <bevel-button> ]
+
+[ "View 3 - 3" <label>
+  [ pos> norm reset-turtle step-turtle 180 turn-left ]
+  camera-action <bevel-button> ]
+
+[ "View 4 - 4" <label>
+  [ pos> norm reset-turtle 45 turn-left 45 pitch-up step-turtle 180 turn-left ]
+  camera-action <bevel-button> ]
+
+} make*
+[ [ gadget, ] curry ] map concat ! Hack
+make-pile 1 over set-pack-fill "L-system control" open-window ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: lsys-viewer ( -- )
+
+f <slate> >slate
+{ 400 400 } clone slate> set-slate-dim
+
+{
+
+{ T{ key-down f f "LEFT" }  [ [ 5 turn-left ] camera-action ] }
+{ T{ key-down f f "RIGHT" } [ [ 5 turn-right ] camera-action ] }
+{ T{ key-down f f "UP" }    [ [ 5 pitch-down ] camera-action ] }
+{ T{ key-down f f "DOWN" }  [ [ 5 pitch-up ] camera-action ] }
+
+{ T{ key-down f f "a" } [ [ 1 step-turtle ] camera-action ] }
+{ T{ key-down f f "z" } [ [ -1 step-turtle ] camera-action ] }
+
+{ T{ key-down f f "q" } [ [ 5 roll-left ] camera-action ] }
+{ T{ key-down f f "w" } [ [ 5 roll-right ] camera-action ] }
+
+{ T{ key-down f { A+ } "LEFT" }  [ [ 1 strafe-left ] camera-action ] }
+{ T{ key-down f { A+ } "RIGHT" } [ [ 1 strafe-right ] camera-action ] }
+{ T{ key-down f { A+ } "UP" }    [ [ 1 strafe-up ] camera-action ] }
+{ T{ key-down f { A+ } "DOWN" }  [ [ 1 strafe-down ] camera-action ] }
+
+{ T{ key-down f f "1" }
+  [ [ pos> norm reset-turtle 90 turn-left step-turtle 180 turn-left ]
+    camera-action ] }
+
+{ T{ key-down f f "2" }
+  [ [ pos> norm reset-turtle 90 pitch-up step-turtle 180 pitch-down ]
+    camera-action ] }
+
+{ T{ key-down f f "3" }
+[ [ pos> norm reset-turtle step-turtle 180 turn-left ]
+    camera-action ] }
+
+{ T{ key-down f f "4" }
+[ [ pos> norm reset-turtle 45 turn-left 45 pitch-up step-turtle 180 turn-left ]
+    camera-action ] }
+
+! } [ make* ] map alist>hash <handler> >handler
+
+} [ make* ] map >hashtable <handler> >handler
+
+slate> handler> set-gadget-delegate
+
+handler> "L-system view" open-window
+
+slate> find-gl-context
+1 glGenLists >model
+
+<turtle> >camera
+
+[ camera> >self
+  reset-turtle 45 turn-left 45 pitch-up 5 step-turtle 180 turn-left
+] with-scope
+
+init-color-table
+
+<tortoise> >self
+
+V{ } clone >tortoise-stack
+
+V{ } clone >vertices
+
+empty-model
+
+build-model
+
+;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Examples
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: koch ( -- ) lparser-dialect   [ 90 >angle ] >model-values
+
+H{ { "K" "[[a|b] '(0.41)f'(2.439) |<(60) [a|b]]" }
+   { "k" "[ c'(0.5) K]" }
+   { "a" "[d <(120) d <(120) d ]" }
+   { "b" "e" }
+   { "e" "[^ '(.2887)f'(3.4758) &(180)      +z{.-(120)f-(120)f}]" }
+   { "d" "[^ '(.2887)f'(3.4758) &(109.5111) +zk{.-(120)f-(120)f}]" }
+} >rules
+
+"K" >result ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: spiral-0 ( -- ) lparser-dialect   [ 10 >angle 5 >thickness ] >model-values
+
+"[P]|[P]" >result
+
+H{ { "P" "[A]>>>>>>>>>[cB]>>>>>>>>>[ccC]>>>>>>>>>[cccD]" }
+   { "A" "F+;'A" }
+   { "B" "F!+F+;'B" }
+   { "C" "F!^+F^+;'C" }
+   { "D" "F!>^+F>^+;'D" }
+} >rules ;
+
+: spiral-0-scene ( -- )
+spiral-0
+22 iterations
+build-model
+[ reset-turtle 90 turn-left 16 step-turtle 180 turn-left ]
+camera> with-self slate> relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: tree-5 ( -- ) lparser-dialect   [ 5 >angle   1 >thickness ] >model-values
+
+"c(4)FFS" >result
+
+H{ { "S" "FFR>(60)R>(60)R>(60)R>(60)R>(60)R>(30)S" }
+   { "R" "[Ba]" }
+   { "a" "$tF[Cx]Fb" }
+   { "b" "$tF[Dy]Fa" }
+   { "B" "&B" }
+   { "C" "+C" }
+   { "D" "-D" }
+
+   { "x" "a" }
+   { "y" "b" }
+
+   { "F" "'(1.25)F'(.8)" }
+} >rules ;
+
+: tree-5-scene ( -- )
+tree-5
+9 iterations
+build-model
+[ reset-turtle 90 pitch-down -70 step-turtle 50 strafe-up ] camera> with-self
+slate> relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-1 ( -- ) lparser-dialect   [ 45 >angle   5 >thickness ] >model-values
+
+H{ { "A" "F[&'(.8)!BL]>(137)'!(.9)A" }
+   { "B" "F[-'(.8)!(.9)$CL]'!(.9)C" }
+   { "C" "F[+'(.8)!(.9)$BL]'!(.9)B" }
+
+   { "L" "~c(8){+(30)f-(120)f-(120)f}" }
+} >rules
+
+"c(12)FFAL" >result ;
+
+: abop-1-scene ( -- )
+abop-1
+8 iterations
+build-model
+[ reset-turtle
+  90 pitch-up 7 step-turtle 90 pitch-down 4 step-turtle 90 pitch-down ]
+camera> with-self slate> relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-2 ( -- ) lparser-dialect   [ 30 >angle   5 >thickness ] >model-values
+
+H{ { "A" "F[&'(.7)!BL]>(137)[&'(.6)!BL]>(137)'(.9)!(.9)A" }
+   { "B" "F[-'(.7)!(.9)$CL]'(.9)!(.9)C" }
+   { "C" "F[+'(.7)!(.9)$BL]'(.9)!(.9)B" }
+
+   { "L" "~c(8){+(45)f(.1)-(45)f(.1)-(45)f(.1)+(45)|+(45)f(.1)-(45)f(.1)-(45)f(.1)}" }
+
+} >rules
+
+"c(12)FAL" >result ;
+
+: abop-2-scene ( -- )
+abop-2
+7 iterations
+build-model
+[ reset-turtle { 0 4 4 } >pos 90 pitch-down ]
+camera> with-self slate> relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-3 ( -- ) lparser-dialect   [ 30 >angle   5 >thickness ] >model-values
+
+H{ { "A" "!(.9)t(.4)FB>(94)B>(132)B" }
+   { "B" "[&t(.4)F$A]" }
+   { "F" "'(1.25)F'(.8)" }
+} >rules
+
+"c(12)FA" >result ;
+
+: abop-3-scene ( -- )
+abop-3 11 iterations build-model
+[ reset-turtle { 0 47 29 } >pos 90 pitch-down ] camera> with-self
+slate> relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-4 ( -- ) lparser-dialect   [ 18 >angle   5 >thickness ] >model-values
+
+H{ { "N" "FII[&(60)rY]>(90)[&(45)'(0.8)rA]>(90)[&(60)rY]>(90)[&(45)'(0.8)rD]!FIK" }
+   { "Y" "[c(4){++l.--l.--l.++|++l.--l.--l.}]" }
+   { "l" "g(.2)l" }
+   { "K" "[!c(2)FF>w>(72)w>(72)w>(72)w>(72)w]" }
+   { "w" "[c(2)^!F][c(5)&(72){-(54)f(3)+(54)f(3)|-(54)f(3)+(54)f(3)}]" }
+   { "f" "_" }
+
+   { "A" "B" }
+   { "B" "C" }
+   { "C" "D" }
+   { "D" "E" }
+   { "E" "G" }
+   { "G" "H" }
+   { "H" "N" }
+
+   { "I" "FoO" }
+   { "O" "FoP" }
+   { "P" "FoQ" }
+   { "Q" "FoR" }
+   { "R" "FoS" }
+   { "S" "FoT" }
+   { "T" "FoU" }
+   { "U" "FoV" }
+   { "V" "FoW" }
+   { "W" "FoX" }
+   { "X" "_" }
+
+   { "o" "$t(-0.03)" }
+   { "r" "~(30)" }
+} >rules
+
+"c(12)&(20)N" >result ;
+
+: abop-4-scene ( -- )
+abop-4 21 iterations build-model
+[ reset-turtle
+  { 53 25 36 } >pos
+  { { 0.57 -0.14 -0.80 } { -0.81 -0.18 -0.54 } { -0.07 0.97 -0.22 } }
+  >ori
+] camera> with-self slate> relayout-1 ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-5 ( -- ) lparser-dialect   [ 5 >angle   5 >thickness ] >model-values
+
+H{ { "a" "F[+(45)l][-(45)l]^;ca" }
+
+   { "l" "j" }
+   { "j" "h" }
+   { "h" "s" }
+   { "s" "d" }
+   { "d" "x" }
+   { "x" "a" }
+
+   { "F" "'(1.17)F'(.855)" }
+} >rules
+
+"&(90)+(90)a" >result ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-6 ( -- ) lparser-dialect   [ 5 >angle   5 >thickness ] >model-values
+
+"&(90)+(90)FFF[-(120)'(.6)x][-(60)'(.8)x][+(120)'(.6)x][+(60)'(.8)x]x" >result
+
+H{ { "a" "F[cdx][cex]F!(.9)a" }
+   { "x" "a" }
+
+   { "d" "+d" }
+   { "e" "-e" }
+
+   { "F" "'(1.25)F'(.8)" }
+} >rules ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: airhorse ( -- ) lparser-dialect [ 10 >angle 5 >thickness ] >model-values
+
+"C" >result
+
+H{ { "C" "LBW" }
+
+   { "B" "[[''aH]|[g]]" }
+   { "a" "Fs+;'a" }
+   { "g" "Ft+;'g" }
+   { "s" "[::cc!!!!&&[FFcccZ]^^^^FFcccZ]" }
+   { "t" "[c!!!!&[FF]^^FF]" }
+
+   { "L" "O" }
+   { "O" "P" }
+   { "P" "Q" }
+   { "Q" "R" }
+   { "R" "U" }
+   { "U" "X" }
+   { "X" "Y" }
+   { "Y" "V" }
+   { "V" "[cc!!!&(90)[Zp]|[Zp]]" }
+   { "p" "h>(120)h>(120)h" }
+   { "h" "[+(40)!F'''p]" }
+
+   { "H" "[cccci[>(50)dcFFF][<(50)ecFFF]]" }
+   { "d" "Z!&Z!&:'d" }
+   { "e" "Z!^Z!^:'e" }
+   { "i" "-:/i" }
+
+   { "W" "[%[!!cb][<<<!!cb][>>>!!cb]]" }
+   { "b" "Fl!+Fl+;'b" }
+   { "l" "[-cc{--z++z++z--|--z++z++z}]" }
+} >rules ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: empty-model ( -- )
+lparser-dialect
+[ ] >model-values
+" " >result
+H{ } >rules ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: model-chooser ( -- )
+
+{
+[ "abop-1" <label> [ drop abop-1 build-model ] closed-quot <bevel-button> ]
+[ "abop-2" <label> [ drop abop-2 build-model ] closed-quot <bevel-button> ]
+[ "abop-3" <label> [ drop abop-3 build-model ] closed-quot <bevel-button> ]
+[ "abop-4" <label> [ drop abop-4 build-model ] closed-quot <bevel-button> ]
+[ "abop-5" <label> [ drop abop-5 build-model ] closed-quot <bevel-button> ]
+[ "abop-6" <label> [ drop abop-6 build-model ] closed-quot <bevel-button> ]
+[ "tree-5" <label> [ drop tree-5 build-model ] closed-quot <bevel-button> ]
+[ "airhorse" <label> [ drop airhorse build-model ] closed-quot <bevel-button> ]
+[ "spiral-0" <label> [ drop spiral-0 build-model ] closed-quot <bevel-button> ]
+[ "koch" <label> [ drop koch build-model ] closed-quot <bevel-button> ]
+} make*
+[ [ gadget, ] curry ] map concat ! Hack
+make-pile 1 over set-pack-fill "L-system models" open-window ;
+
+: scene-chooser ( -- )
+{
+[ "abop-1" <label> [ drop abop-1-scene ] closed-quot <bevel-button> ]
+[ "abop-2" <label> [ drop abop-2-scene ] closed-quot <bevel-button> ]
+[ "tree-5" <label> [ drop tree-5-scene ] closed-quot <bevel-button> ]
+} make*
+[ [ gadget, ] curry ] map concat ! Hack
+make-pile 1 over set-pack-fill "L-system scenes" open-window ;
+
+: lsys-window* ( -- )
+[ lsys-controller lsys-viewer ] with-ui ;
+
+MAIN: lsys-window*
\ No newline at end of file
diff --git a/extra/lunar-rescue/authors.txt b/extra/lunar-rescue/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/lunar-rescue/lunar-rescue-docs.factor b/extra/lunar-rescue/lunar-rescue-docs.factor
new file mode 100644 (file)
index 0000000..7755415
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.syntax help.markup cpu.8080 ;\r
+IN: lunar-rescue \r
+\r
+HELP: run \r
+{ $description \r
+"Run the Lunar Rescue emulator in a new window." $nl\r
+{ $link rom-root } " must be set to the directory containing the "\r
+"location of the Lunar Rescue ROM files. See " \r
+{ $link { "lunar-rescue" "lunar-rescue" } } "  for details."\r
+} ;\r
+\r
+ARTICLE: { "lunar-rescue" "lunar-rescue" } "Lunar Rescue Emulator"\r
+"Provides an emulation of the original 8080 Arcade Game 'Lunar Rescue'." $nl\r
+"More information on the arcade game can be obtained from " { $url "http://www.mameworld.net/maws/romset/lrescue" } "." $nl\r
+"To play the game you need the ROM files for the arcade game. They should "\r
+"be placed in a directory called 'lrescue' in the location specified by "\r
+"the variable " { $link rom-root } ". The specific files needed are:"\r
+{ $list\r
+  "lrescue/lrescue.1"\r
+  "lrescue/lrescue.2"\r
+  "lrescue/lrescue.3"\r
+  "lrescue/lrescue.4"\r
+  "lrescue/lrescue.5"\r
+  "lrescue/lrescue.6"\r
+}\r
+"These are the same ROM files as used by MAME. To run the game use the " \r
+{ $link run } " word." $nl\r
+"Keys:" \r
+{ $table\r
+  { "Backspace" "Insert Coin" }\r
+  { "1" "1 Player" }\r
+  { "2" "2 Player" }\r
+  { "Left" "Move Left" }\r
+  { "Right" "Move Right" }\r
+  { "Up" "Fire or apply thrusters" }\r
+}\r
+"If you save the Factor image while a game is running, when you restart "\r
+"the image the game continues where it left off." ;\r
diff --git a/extra/lunar-rescue/lunar-rescue.factor b/extra/lunar-rescue/lunar-rescue.factor
new file mode 100644 (file)
index 0000000..558b715
--- /dev/null
@@ -0,0 +1,24 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+! Lunar Rescue: http://www.mameworld.net/maws/romset/lrescue\r
+!\r
+USING: kernel space-invaders cpu.8080 ui ;\r
+IN: lunar-rescue\r
+\r
+TUPLE: lunar-rescue ; \r
+\r
+: <lunar-rescue> ( -- cpu )\r
+  <space-invaders> lunar-rescue construct-delegate ;\r
+\r
+: run ( -- )  \r
+  "Lunar Rescue" <lunar-rescue> {\r
+    { HEX: 0000 "lrescue/lrescue.1" }\r
+    { HEX: 0800 "lrescue/lrescue.2" }\r
+    { HEX: 1000 "lrescue/lrescue.3" }\r
+    { HEX: 1800 "lrescue/lrescue.4" }\r
+    { HEX: 4000 "lrescue/lrescue.5" }\r
+    { HEX: 4800 "lrescue/lrescue.6" }\r
+  } [ (run) ] with-ui ;\r
+\r
+MAIN: run\r
diff --git a/extra/lunar-rescue/summary.txt b/extra/lunar-rescue/summary.txt
new file mode 100644 (file)
index 0000000..9cde8f1
--- /dev/null
@@ -0,0 +1 @@
+Intel 8080-based Lunar Rescue arcade machine emulator
diff --git a/extra/lunar-rescue/tags.txt b/extra/lunar-rescue/tags.txt
new file mode 100644 (file)
index 0000000..4717ffd
--- /dev/null
@@ -0,0 +1,2 @@
+games
+applications
diff --git a/extra/macros/authors.txt b/extra/macros/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/macros/macros-docs.factor b/extra/macros/macros-docs.factor
new file mode 100644 (file)
index 0000000..44d1f32
--- /dev/null
@@ -0,0 +1,39 @@
+USING: help.markup help.syntax quotations kernel ;
+IN: macros
+
+HELP: MACRO:
+{ $syntax "MACRO: word ( inputs... -- ) definition... ;" }
+{ $description "Defines a compile-time code transformation. If all inputs to the word are literal, then the macro body is invoked at compile-time to produce a quotation; this quotation is then spliced into the compiled code. If the inputs are not literal, or if the word is invoked from interpreted code, the macro body will execute every time and the result will be passed to " { $link call } "."
+$nl
+"The stack effect declaration must be present because it tells the compiler how many literal inputs to expect."
+}
+{ $notes
+    "Semantically, the following two definitions are equivalent:"
+    { $code "MACRO: foo ... ;" }
+    { $code ": foo ... call ;" }
+    "However, the compiler folds in macro definitions at compile-time where possible; if the macro body performs an expensive calculation, it can lead to a performance boost."
+} ;
+
+HELP: macro
+{ $class-description "Class of words defined with " { $link POSTPONE: MACRO: } "." } ;
+
+HELP: macro-expand
+{ $values { "..." "inputs to a macro" } { "word" macro } { "quot" quotation } }
+{ $description "Expands a macro. Useful for debugging." }
+{ $examples
+    { $code "{ [ dup integer? ] [ dup 0 > ] [ dup 13 mod zero? ] } \ && macro-expand ." }
+} ;
+
+ARTICLE: "macros" "Macros"
+"The " { $vocab-link "macros" } " vocabulary implements macros in the Lisp sense; compile-time code transformers and generators. Macros can be used to calculate lookup tables and generate code at compile time, which can improve performance, the level of abstraction and simplify code."
+$nl
+"Defining new macros:"
+{ $subsection POSTPONE: MACRO: }
+"Expanding macros for debugging purposes:"
+{ $subsection macro-expand }
+! "Two sample macros which implement short-circuiting boolean operators (as found in C, Java and similar languages):"
+! { $subsection && }
+! { $subsection || }
+"Macros are really just a very thin layer of syntax sugar over " { $link "compiler-transforms" } "." ;
+
+ABOUT: "macros"
diff --git a/extra/macros/macros-tests.factor b/extra/macros/macros-tests.factor
new file mode 100644 (file)
index 0000000..d410037
--- /dev/null
@@ -0,0 +1,4 @@
+IN: temporary
+USING: tools.test macros math kernel arrays
+vectors ;
+
diff --git a/extra/macros/macros.factor b/extra/macros/macros.factor
new file mode 100644 (file)
index 0000000..9c06822
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: parser kernel sequences words effects inference.transforms
+       combinators assocs definitions quotations namespaces ;
+
+IN: macros
+
+: (:)
+    CREATE dup reset-generic parse-definition
+    over "declared-effect" word-prop effect-in length ;
+
+: (MACRO:)
+    >r
+    2dup "macro" set-word-prop
+    2dup [ call ] append define-compound
+    r> define-transform ;
+
+: MACRO:
+    (:) (MACRO:) ; parsing
+
+PREDICATE: word macro
+    "macro" word-prop >boolean ;
+
+M: macro definer drop \ MACRO: \ ; ;
+
+M: macro definition "macro" word-prop ;
+
+: macro-expand ( ... word -- quot ) "macro" word-prop call ;
+
+: n*quot ( n seq -- seq' ) <repetition> concat >quotation ;
+
+: saver \ >r <repetition> >quotation ;
+
+: restorer \ r> <repetition> >quotation ;
diff --git a/extra/macros/summary.txt b/extra/macros/summary.txt
new file mode 100644 (file)
index 0000000..93ecb60
--- /dev/null
@@ -0,0 +1 @@
+Utility for defining compiler transforms, and short-circuiting boolean operators
diff --git a/extra/macros/tags.txt b/extra/macros/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/macros/zoo/zoo.factor b/extra/macros/zoo/zoo.factor
new file mode 100644 (file)
index 0000000..21edc39
--- /dev/null
@@ -0,0 +1,38 @@
+
+USING: kernel quotations arrays sequences sequences.private macros ;
+
+IN: macros.zoo
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! MACRO: narray ( n -- quot )
+!     dup [ f <array> ] curry
+!     swap <reversed> [
+!         [ swap [ set-nth-unsafe ] keep ] curry
+!     ] map concat append ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! MACRO: map-call-with ( quots -- )
+!   [ [ [ keep ] curry ] map concat ] keep length [ nip narray ] curry compose ;
+
+! MACRO: map-call-with2 ( quots -- )
+!   dup >r
+!   [ [ 2dup >r >r ] swap append [ r> r> ] append ] map concat
+!   [ 2drop ] append
+!   r> length [ narray ] curry append ;
+
+! MACRO: map-exec-with ( words -- ) [ 1quotation ] map [ map-call-with ] curry ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Conceptual implementation:
+
+! : pcall ( seq quots -- seq ) [ call ] 2map ;
+
+! MACRO: pcall ( quots -- )
+!   [ [ unclip ] swap append ] map
+!   [ [ r> swap add >r ] append ] map
+!   concat
+!   [ { } >r ] swap append ! pre
+!   [ drop r> ] append ;   ! post
diff --git a/extra/mad/api/api.factor b/extra/mad/api/api.factor
new file mode 100644 (file)
index 0000000..4905424
--- /dev/null
@@ -0,0 +1,102 @@
+! Copyright (C) 2007 Adam Wendt.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+USING: alien alien.c-types byte-arrays io io.binary io.files kernel mad namespaces prettyprint sbufs sequences tools.interpreter vars ;\r
+IN: mad.api\r
+\r
+VARS: buffer-start buffer-length output-callback-var ;\r
+\r
+: create-mad-callback-generic ( sequence parameters -- alien )\r
+  swap >r >r "mad_flow" r> "cdecl" r> alien-callback ; inline\r
+\r
+: create-input-callback ( sequence -- alien )\r
+  { "void*" "mad_stream*" } create-mad-callback-generic ; inline\r
+\r
+: create-header-callback ( sequence -- alien )\r
+  { "void*" "mad_header*" } create-mad-callback-generic ; inline\r
+\r
+: create-filter-callback ( sequence -- alien )\r
+  { "void*" "mad_stream*" "mad_frame*" } create-mad-callback-generic ; inline \r
+\r
+: create-output-callback ( sequence -- alien )\r
+  { "void*" "mad_header*" "mad_pcm*" } create-mad-callback-generic ; inline \r
+\r
+: create-error-callback ( sequence -- alien )\r
+  { "void*" "mad_stream*" "mad_frame*" } create-mad-callback-generic ; inline \r
+\r
+: create-message-callback ( sequence -- alien )\r
+  { "void*" "void*" "uint*" } create-mad-callback-generic ; inline \r
+\r
+: input ( buffer mad_stream -- mad_flow )\r
+  "input" print flush\r
+  nip                       ! mad_stream \r
+  buffer-start get          ! mad_stream start\r
+  buffer-length get         ! mad_stream start length\r
+  dup 0 =                   ! mad-stream start length bool\r
+  [ 3drop MAD_FLOW_STOP ]   ! mad_flow\r
+  [ mad_stream_buffer       !\r
+  0 buffer-length set       !\r
+  MAD_FLOW_CONTINUE ] if ;  ! mad_flow \r
+\r
+: input-callback ( -- callback )\r
+  [ input ] create-input-callback ;\r
+\r
+: header-callback ( -- callback )\r
+  [ "header" print flush drop drop MAD_FLOW_CONTINUE ] create-header-callback ;\r
+\r
+: filter-callback ( -- callback )\r
+  [ "filter" print flush 3drop MAD_FLOW_CONTINUE ] create-filter-callback ;\r
\r
+: write-sample ( sample -- )\r
+  4 >le write ; \r
+\r
+: output ( data header pcm -- mad_flow ) \r
+  "output" . flush\r
+  break\r
+  -rot 2drop output-callback-var> call\r
+  [ MAD_FLOW_CONTINUE ] [ MAD_FLOW_STOP ] if ;\r
+\r
+: output-stdout ( pcm -- ? )\r
+  [ mad_pcm-channels ] keep\r
+  [ mad_pcm-length ] keep swap\r
+  [\r
+    [ mad_pcm-sample-right ] 2keep\r
+    [ mad_pcm-sample-left ] 2keep\r
+    drop -rot write-sample pick\r
+    2 = [ write-sample ] [ drop ] if\r
+  ] each drop t ;\r
+\r
+: output-callback ( -- callback )\r
+  [ output ] create-output-callback ;\r
+\r
+: error-callback ( -- callback )\r
+  [ "error" print flush drop drop drop MAD_FLOW_CONTINUE ] create-error-callback ;\r
+\r
+: message-callback ( -- callback )\r
+  [ "message" print flush drop drop drop MAD_FLOW_CONTINUE ] create-message-callback ;\r
+\r
+: mad-init ( decoder -- )\r
+  0 <alien> input-callback 0 <alien> 0 <alien> output-callback error-callback message-callback mad_decoder_init ;\r
+\r
+: make-decoder ( -- decoder )\r
+  "mad_decoder" malloc-object ;\r
+\r
+: file-contents ( path -- string )\r
+  dup <file-reader> swap file-length <sbuf> [ stream-copy ] keep >byte-array ;\r
+\r
+: malloc-file-contents ( path -- alien )\r
+  file-contents malloc-byte-array ;\r
+\r
+: mad-run ( -- int )\r
+  make-decoder [ mad-init ] keep MAD_DECODER_MODE_SYNC mad_decoder_run ;\r
+\r
+: init-vars ( alien length -- )\r
+  buffer-length set buffer-start set ;\r
+\r
+: decode-mp3 ( filename -- results )\r
+  [ malloc-file-contents ] keep file-length init-vars mad-run ;\r
+\r
+: mad-test ( -- results )\r
+  [ output-stdout ] >output-callback-var\r
+  "/home/adam/download/mp3/Misc/wutbf.mp3" decode-mp3 ;\r
+\r
diff --git a/extra/mad/authors.txt b/extra/mad/authors.txt
new file mode 100644 (file)
index 0000000..bbc876e
--- /dev/null
@@ -0,0 +1 @@
+Adam Wendt
diff --git a/extra/mad/mad-tests.factor b/extra/mad/mad-tests.factor
new file mode 100644 (file)
index 0000000..c53b14f
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2007 Adam Wendt.
+! See http://factorcode.org/license.txt for BSD license.
+!
+IN: temporary
+
+USING: kernel mad mad.api alien alien.c-types tools.test
+namespaces ;
+
+: setup-buffer ( -- )
+  0 <alien> buffer-start set 0 buffer-length set ;
+
+[ t ] [ 0 "mad_stream" malloc-object setup-buffer input MAD_FLOW_STOP = ] unit-test
diff --git a/extra/mad/mad.factor b/extra/mad/mad.factor
new file mode 100644 (file)
index 0000000..27b0533
--- /dev/null
@@ -0,0 +1,159 @@
+! Copyright (C) 2007 Adam Wendt.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: alien alien.c-types alien.syntax combinators kernel math system ;
+IN: mad
+
+: load-mad-library ( -- )
+  "mad" {
+    { [ macosx? ] [ "libmad.0.dylib" ] }
+    { [ unix? ] [ "libmad.so" ] }
+    { [ windows? ] [ "mad.dll" ] }
+  } cond "cdecl" add-library ; parsing
+
+load-mad-library
+
+LIBRARY: mad
+
+TYPEDEF: int mad_fixed_t 
+TYPEDEF: int mad_fixed64hi_t
+TYPEDEF: uint mad_fixed64lo_t
+
+TYPEDEF: int mad_flow
+TYPEDEF: int mad_decoder_mode
+TYPEDEF: int mad_error
+TYPEDEF: int mad_layer
+TYPEDEF: int mad_mode
+TYPEDEF: int mad_emphasis
+
+C-STRUCT: mad_timer_t 
+    { "long" "seconds" }
+    { "ulong" "fraction" }
+;
+
+C-STRUCT: mad_bitptr 
+    { "uchar*" "byte" }
+    { "short" "cache" }
+    { "short" "left" }
+;
+
+C-STRUCT: mad_stream 
+    { "uchar*" "buffer" }
+    { "uchar*" "buffend" }
+    { "long" "skiplen" }
+    { "int" "sync" }
+    { "ulong" "freerate" }
+    { "uchar*" "this_frame" }
+    { "uchar*" "next_frame" }
+    { "mad_bitptr" "ptr" }
+    { "mad_bitptr" "anc_ptr" }
+    { "uchar*" "main_data" }
+    { "int" "md_len" }
+    { "int" "options" }
+    { "mad_error" "error" }
+;
+
+C-STRUCT: struct_async 
+    { "long" "pid" }
+    { "int" "in" }
+    { "int" "out" }
+;
+
+C-STRUCT: mad_header 
+    { "mad_layer" "layer" }
+    { "mad_mode" "mode" }
+    { "int" "mode_extension" }
+    { "mad_emphasis" "emphasis" }
+    { "ulong" "bitrate" }
+    { "uint" "samplerate" }
+    { "ushort" "crc_check" }
+    { "ushort" "crc_target" }
+    { "int" "flags" }
+    { "int" "private_bits" }
+    { "mad_timer_t" "duration" }
+;
+
+C-STRUCT: mad_frame 
+    { "mad_header" "header" }
+    { "int" "options" }
+    { { "mad_fixed_t" 2304 } "sbsample" }
+    { "mad_fixed_t*" "overlap" }
+;
+
+C-STRUCT: mad_pcm 
+    { "uint" "samplerate" }
+    { "ushort" "channels" }
+    { "ushort" "length" }
+    { { "mad_fixed_t" 2304 } "samples" }
+;
+
+: mad_pcm-sample-left ( pcm int -- sample ) 
+  swap mad_pcm-samples int-nth ;
+: mad_pcm-sample-right ( pcm int -- sample ) 
+  1152 + swap mad_pcm-samples int-nth ;
+
+C-STRUCT: mad_synth 
+    { { "mad_fixed_t" 1024 } "filter" }
+    { "uint" "phase" }
+    { "mad_pcm" "pcm" }
+;
+
+C-STRUCT: struct_sync 
+    { "mad_stream" "stream" }
+    { "mad_frame" "frame" }
+    { "mad_synth" "synth" }
+;
+
+C-STRUCT: mad_decoder 
+    { "mad_decoder_mode" "mode" }
+    { "int" "options" }
+    { "struct_async" "async" }
+    { "struct_sync*" "sync" }
+    { "void*" "cb_data" }
+    { "void*" "input_func" }
+    { "void*" "header_func" }
+    { "void*" "filter_func" }
+    { "void*" "output_func" }
+    { "void*" "error_func" }
+    { "void*" "message_func" }
+;
+
+: MAD_F_FRACBITS ( -- number ) 28 ; inline
+: MAD_F_ONE HEX: 10000000 ;
+
+: MAD_DECODER_MODE_SYNC  ( -- number ) HEX: 0 ; inline
+: MAD_DECODER_MODE_ASYNC ( -- number ) HEX: 1 ; inline
+
+: MAD_FLOW_CONTINUE ( -- number ) HEX:  0 ; inline
+: MAD_FLOW_STOP     ( -- number ) HEX: 10 ; inline
+: MAD_FLOW_BREAK    ( -- number ) HEX: 11 ; inline
+: MAD_FLOW_IGNORE   ( -- number ) HEX: 20 ; inline
+
+: MAD_ERROR_NONE            ( -- number ) HEX: 0 ; inline
+: MAD_ERROR_BUFLEN          ( -- number ) HEX: 1 ; inline
+: MAD_ERROR_BUFPTR          ( -- number ) HEX: 2 ; inline
+: MAD_ERROR_NOMEM           ( -- number ) HEX: 31 ; inline
+: MAD_ERROR_LOSTSYNC        ( -- number ) HEX: 101 ; inline
+: MAD_ERROR_BADLAYER        ( -- number ) HEX: 102 ; inline
+: MAD_ERROR_BADBITRATE      ( -- number ) HEX: 103 ; inline
+: MAD_ERROR_BADSAMPLERATE   ( -- number ) HEX: 104 ; inline
+: MAD_ERROR_BADEMPHASIS     ( -- number ) HEX: 105 ; inline
+: MAD_ERROR_BADCRC          ( -- number ) HEX: 201 ; inline
+: MAD_ERROR_BADBITALLOC     ( -- number ) HEX: 211 ; inline
+: MAD_ERROR_BADSCALEFACTOR  ( -- number ) HEX: 221 ; inline
+: MAD_ERROR_BADMODE         ( -- number ) HEX: 222 ; inline
+: MAD_ERROR_BADFRAMELEN     ( -- number ) HEX: 231 ; inline
+: MAD_ERROR_BADBIGVALUES    ( -- number ) HEX: 232 ; inline
+: MAD_ERROR_BADBLOCKTYPE    ( -- number ) HEX: 233 ; inline
+: MAD_ERROR_BADSCFSI        ( -- number ) HEX: 234 ; inline
+: MAD_ERROR_BADDATAPTR      ( -- number ) HEX: 235 ; inline
+: MAD_ERROR_BADPART3LEN     ( -- number ) HEX: 236 ; inline
+: MAD_ERROR_BADHUFFTABLE    ( -- number ) HEX: 237 ; inline
+: MAD_ERROR_BADHUFFDATA     ( -- number ) HEX: 238 ; inline
+: MAD_ERROR_BADSTEREO       ( -- number ) HEX: 239 ; inline
+
+
+FUNCTION: void mad_decoder_init ( mad_decoder* decoder, void* data, void* input_func, void* header_func, void* filter_func, void* output_func, void* error_func, void* message_func ) ; 
+FUNCTION: int mad_decoder_run ( mad_decoder* decoder, mad_decoder_mode mode ) ;
+FUNCTION: void mad_stream_buffer ( mad_stream* stream, uchar* start, ulong length ) ;
+
diff --git a/extra/mad/player/player.factor b/extra/mad/player/player.factor
new file mode 100644 (file)
index 0000000..417fc51
--- /dev/null
@@ -0,0 +1,59 @@
+! Copyright (C) 2007 Adam Wendt.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+USING: alien.c-types io kernel libc mad mad.api math namespaces openal prettyprint sequences tools.interpreter vars ;\r
+IN: mad.player\r
+\r
+VARS: openal-buffer ;\r
+\r
+: get-format ( pcm -- format )\r
+  mad_pcm-channels 2 =\r
+  [ AL_FORMAT_STEREO16 ] [ AL_FORMAT_MONO16 ] if ;\r
+\r
+: no-error? ( -- ? )\r
+  alGetError dup . flush AL_NO_ERROR = ;\r
+\r
+: round ( sample -- rounded )\r
+  1 MAD_F_FRACBITS 16 - shift + ;\r
+\r
+: clip ( sample -- clipped ) MAD_F_ONE 1- min MAD_F_ONE neg max ;\r
+\r
+: quantize ( sample -- quantized )\r
+  MAD_F_FRACBITS 1+ 16 - neg shift ;\r
+\r
+: scale-sample ( sample -- scaled )\r
+  round clip quantize ;\r
+\r
+: get-needed-size ( pcm -- size )\r
+  [ mad_pcm-channels ] keep mad_pcm-length 2 * * ;\r
+\r
+: make-data ( pcm -- )\r
+  [ mad_pcm-channels ] keep     ! channels pcm\r
+  [ mad_pcm-length ] keep swap  ! channels pcm length\r
+  [                             ! channels pcm counter\r
+    [ mad_pcm-sample-right ] 2keep ! channels right pcm counter\r
+    [ mad_pcm-sample-left ] 2keep  ! channels right left pcm counter\r
+    drop -rot scale-sample , pick  ! channels pcm right channels\r
+    2 = [ scale-sample , ] [ drop ] if ! channels pcm right\r
+  ] each 2drop ;\r
+\r
+: array>alien ( alien array -- ) dup length [ pick set-int-nth ] 2each drop ;\r
+  \r
+: fill-data ( pcm alien -- )\r
+  swap [ make-data ] { } make array>alien ;\r
+\r
+: get-data ( pcm -- size alien )\r
+  [ get-needed-size ] keep over\r
+  malloc [ fill-data ] keep ;\r
+\r
+: output-openal ( pcm -- ? )\r
+  break\r
+  openal-buffer> swap     ! buffer pcm\r
+  [ get-format ] keep     ! buffer format pcm\r
+  [ get-data ] keep       ! buffer format size alien pcm\r
+  mad_pcm-samplerate      ! buffer format size alien samplerate\r
+  swapd alBufferData no-error?\r
+  ;\r
+\r
+: play-mp3 ( filename -- )\r
+  gen-buffer >openal-buffer [ output-openal ] >output-callback-var decode-mp3 ;\r
diff --git a/extra/mad/summary.txt b/extra/mad/summary.txt
new file mode 100644 (file)
index 0000000..a9a9020
--- /dev/null
@@ -0,0 +1 @@
+libmad MP3 library binding
diff --git a/extra/match/authors.txt b/extra/match/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/match/match-docs.factor b/extra/match/match-docs.factor
new file mode 100644 (file)
index 0000000..96d2ea9
--- /dev/null
@@ -0,0 +1,64 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax namespaces assocs sequences
+kernel combinators ;
+IN: match
+
+HELP: match 
+{ $values { "value1" object } { "value2" object } { "bindings" assoc }
+}
+{ $description "Pattern match value1 against value2. These values can be any Factor value, including sequences and tuples. The values can contain pattern variables, which are symbols that begin with '?'. The result is a hashtable of the bindings, mapping the pattern variables from one sequence to the equivalent value in the other sequence. The '_' symbol can be used to ignore the value at that point in the pattern for the match. " } 
+{ $examples 
+    { $unchecked-example "USE: match" "MATCH-VARS: ?a ?b ;\n{ ?a { 2 ?b } 5 } { 1 { 2 3 } _ } match ." "H{ { ?a 1 } { ?b 3 } }" }
+}
+{ $see-also match-cond POSTPONE: MATCH-VARS: replace-patterns match-replace } ;
+
+HELP: match-cond
+{ $values { "assoc" "a sequence of pairs" } }
+{ $description "Calls the second quotation in the first pair whose first sequence yields a successful " { $link match } " against the top of the stack. The second quotation, when called, has the hashtable returned from the " { $link match } " call bound as the top namespace so " { $link get } " can be used to retrieve the values. To have a fallthrough match clause use the '_' match variable." } 
+{ $examples 
+    { $code "USE: match" "MATCH-VARS: ?value ;\n{ increment ?value } {\n  { { increment ?value } [ ?value do-something ] }\n  { { decrement ?value } [ ?value do-something-else ] }\n  { _ [ no-match-found ] }\n} match-cond" }
+}
+{ $see-also match POSTPONE: MATCH-VARS: replace-patterns match-replace } ;
+
+
+HELP: MATCH-VARS:
+{ $syntax "MATCH-VARS: var ... ;" }
+{ $values { "var" "a match variable name beginning with '?'" } }
+{ $description "Creates a symbol that can be used in " { $link match } " and " { $link match-cond } " for binding values in the matched sequence. The symbol name is created as a word that is defined to get the value of the symbol out of the current namespace. This can be used in " { $link match-cond } " to retrive the values in the quotation body." }
+{ $examples 
+    { $code "USE: match" "MATCH-VARS: ?value ;\n{ increment ?value } {\n  { { increment ?value } [ ?value do-something ] }\n  { { decrement ?value } [ ?value do-something-else ] }\n  { _ [ no-match-found ] }\n} match-cond" }
+}
+{ $see-also match match-cond replace-patterns match-replace } ;
+
+HELP: replace-patterns
+{ $values { "object" object } { "result" object } }
+{ $description "Copy the object, replacing each occurrence of a pattern matching variable with the actual value of that variable." } 
+{ $see-also match-cond POSTPONE: MATCH-VARS: match-replace } ;
+
+HELP: match-replace
+{ $values { "object" object } { "pattern1" object } { "pattern2" object } { "result" object } }
+{ $description "Matches the " { $snippet "object" } " against " { $snippet "pattern1" } ". The pattern match variables in " { $snippet "pattern1" } " are assigned the values from the matching " { $snippet "object" } ". These are then replaced into the " { $snippet "pattern2" } " pattern match variables." } 
+{ $examples
+  { $example
+      "USE: match"
+      "MATCH-VARS: ?a ?b ;"
+      "{ 1 2 } { ?a ?b } { ?b ?a } match-replace ." 
+      "{ 2 1 }"
+  }
+}
+{ $see-also match-cond POSTPONE: MATCH-VARS: } ;
+
+ARTICLE: "match" "Pattern matching"
+"The " { $vocab-link "match" } " vocabulary implements ML-style pattern matching."
+$nl
+"Variables used for pattern matching must be explicitly defined first:"
+{ $subsection POSTPONE: MATCH-VARS: }
+"A basic pattern match:"
+{ $subsection match }
+"A conditional form analogous to " { $link cond } ":"
+{ $subsection match-cond }
+"Pattern replacement:"
+{ $subsection match-replace } ;
+
+ABOUT: "match"
diff --git a/extra/match/match-tests.factor b/extra/match/match-tests.factor
new file mode 100644 (file)
index 0000000..6761557
--- /dev/null
@@ -0,0 +1,85 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test match namespaces arrays ;
+IN: temporary
+
+MATCH-VARS: ?a ?b ;
+
+[ H{ { ?a 1 } { ?b 2 } } ] [
+ { ?a ?b } { 1 2 } match
+] unit-test
+
+[ { 1 2 } ] [ 
+  { 1 2 } 
+  {
+    { { ?a ?b } [ ?a ?b 2array ] }
+  } match-cond
+] unit-test
+
+[ t ] [ 
+  { 1 2 } 
+  {
+    { { 1 2 } [ t ] }
+    { f [ f ] }
+  } match-cond
+] unit-test
+
+[ t ] [ 
+  { 1 3 } 
+  {
+    { { 1 2 } [ t ] }
+    { { 1 3 } [ t ] }
+  } match-cond
+] unit-test
+
+[ f ] [ 
+  { 1 5 } 
+  {
+    { { 1 2 } [ t ] }
+    { { 1 3 } [ t ] }
+    { _       [ f ] }
+  } match-cond
+] unit-test
+
+TUPLE: foo a b ;
+
+C: <foo> foo
+
+{ 1 2 } [
+  1 2 <foo> T{ foo f ?a ?b } match [
+    ?a ?b
+  ] bind
+] unit-test
+
+{ 1 2 } [
+  1 2 <foo> \ ?a \ ?b <foo> match [
+    ?a ?b
+  ] bind
+] unit-test
+
+{ H{ { ?a ?a } } } [ 
+  \ ?a \ ?a match 
+] unit-test
+
+[ "match" ] [ 
+  "abcd" {
+    { ?a [ "match" ] }
+  } match-cond
+] unit-test
+
+[
+  { 2 1 }
+] [
+  { "a" 1 2 "b" } { _ ?a ?b _ } { ?b ?a } match-replace
+] unit-test
+
+TUPLE: match-replace-test a b ;
+
+[
+    T{ match-replace-test f 2 1 }
+] [
+  T{ match-replace-test f 1 2 }
+  T{ match-replace-test f ?a ?b }
+  T{ match-replace-test f ?b ?a }
+  match-replace
+] unit-test
diff --git a/extra/match/match.factor b/extra/match/match.factor
new file mode 100644 (file)
index 0000000..296bcf7
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Based on pattern matching code from Paul Graham's book 'On Lisp'.
+USING: parser kernel words namespaces sequences tuples
+combinators macros ;
+IN: match
+
+SYMBOL: _
+
+: define-match-var ( name -- )
+    create-in
+    dup t "match-var" set-word-prop
+    dup [ get ] curry define-compound ;
+
+: define-match-vars ( seq -- )
+    [ define-match-var ] each ;
+
+: MATCH-VARS: ! vars ...
+    ";" parse-tokens define-match-vars ; parsing
+
+: match-var? ( symbol -- bool )
+    dup word? [ "match-var" word-prop ] [ drop f ] if ;
+
+: (match) ( value1 value2 -- matched? )
+    {
+        { [ dup match-var? ] [ set t ] }
+        { [ over match-var? ] [ swap set t ] }
+        { [ 2dup = ] [ 2drop t ] }
+        { [ 2dup [ _ eq? ] either? ] [ 2drop t ] }
+        { [ 2dup [ sequence? ] both? ] [
+            2dup [ length ] 2apply =
+            [ [ (match) ] 2all? ] [ 2drop f ] if ] }
+        { [ 2dup [ tuple? ] both? ]
+          [ [ tuple>array ] 2apply [ (match) ] 2all? ] }
+        { [ t ] [ 2drop f ] }
+    } cond ;
+
+: match ( value1 value2 -- bindings )
+    [ (match) ] H{ } make-assoc swap [ drop f ] unless ;
+
+MACRO: match-cond ( assoc -- )
+    <reversed>
+    [ "Fall-through in match-cond" throw ]
+    [
+        first2
+        >r [ dupd match ] curry r>
+        [ bind ] curry rot
+        [ ?if ] 2curry append
+    ] reduce ;
+
+: replace-patterns ( object -- result )
+    {
+        { [ dup match-var? ] [ get ] }
+        { [ dup sequence? ] [ [ replace-patterns ] map ] }
+        { [ dup tuple? ] [ tuple>array replace-patterns >tuple ] }
+        { [ t ] [ ] }
+    } cond ;
+
+: match-replace ( object pattern1 pattern2 -- result )
+    -rot match [ replace-patterns ] bind ;
diff --git a/extra/match/summary.txt b/extra/match/summary.txt
new file mode 100644 (file)
index 0000000..1666a2c
--- /dev/null
@@ -0,0 +1 @@
+ML-style pattern matching
diff --git a/extra/match/tags.txt b/extra/match/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/math/analysis/analysis-tests.factor b/extra/math/analysis/analysis-tests.factor
new file mode 100644 (file)
index 0000000..7ef869c
--- /dev/null
@@ -0,0 +1,34 @@
+USING: kernel math math.functions tools.test ;
+IN: temporary
+
+: eps
+    .00000001 ;
+
+[ t ] [ -9000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
+[ t ] [ -1.5 gamma 2.363271801207344 eps ~ ] unit-test
+[ t ] [ -1 gamma 1/0. = ] unit-test
+[ t ] [ -0.5 gamma -3.544907701811 eps ~ ] unit-test
+[ t ] [ 0 gamma 1/0. = ] unit-test
+[ t ] [ .5 gamma 1.772453850905479 eps ~ ] unit-test
+[ t ] [ 1 gamma 1 eps ~ ] unit-test
+[ t ] [ 2 gamma 1 eps ~ ] unit-test
+[ t ] [ 3 gamma 2 eps ~ ] unit-test
+[ t ] [ 11 gamma 3628800.000015679 eps ~ ] unit-test
+[ t ] [ 90000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
+! some fun identities
+[ t ] [ 2/3 gamma 2 pi * 3 sqrt 1/3 gamma * / eps ~ ] unit-test
+[ t ] [ 3/4 gamma 2 sqrt pi * 1/4 gamma / eps ~ ] unit-test
+[ t ] [ 4/5 gamma 2 5 sqrt / 2 + sqrt pi * 1/5 gamma / eps ~ ] unit-test
+[ t ] [ 3/5 gamma 2 2 5 sqrt / - sqrt pi * 2/5 gamma / eps ~ ] unit-test
+[ t ] [ -90000000000000000000000000000000000000000000 gammaln 1/0. = ] unit-test
+[ t ] [ -1.5 gammaln 1/0. = ] unit-test
+[ t ] [ -1 gammaln 1/0. = ] unit-test
+[ t ] [ -0.5 gammaln 1/0. = ] unit-test
+! [ t ] [ 0 gammaln 1/0. = ] unit-test
+[ t ] [ .5 gammaln 0.572364942924679 eps ~ ] unit-test
+[ t ] [ 1 gammaln 0 eps ~ ] unit-test
+[ t ] [ 2 gammaln 1.110223024625157e-16 eps ~ ] unit-test
+[ t ] [ 3 gammaln 0.6931471805599456 eps ~ ] unit-test
+[ t ] [ 11 gammaln 15.10441257307984 eps ~ ] unit-test
+[ t ] [ 9000000000000000000000000000000000000000000 gammaln 8.811521863477754e+44 eps ~ ] unit-test
+
diff --git a/extra/math/analysis/analysis.factor b/extra/math/analysis/analysis.factor
new file mode 100644 (file)
index 0000000..b48f600
--- /dev/null
@@ -0,0 +1,110 @@
+USING: kernel math math.constants math.functions math.intervals
+math.vectors namespaces sequences ;
+IN: math.analysis
+
+<PRIVATE
+
+! http://www.rskey.org/gamma.htm  "Lanczos Approximation"
+! n=6: error ~ 3 x 10^-11
+
+: gamma-g6 5.15 ; inline
+
+: gamma-p6
+    {
+        2.50662827563479526904 225.525584619175212544 -268.295973841304927459
+        80.9030806934622512966 -5.00757863970517583837 0.0114684895434781459556 
+    } ; inline
+
+: gamma-z ( x n -- seq )
+    [ + recip ] curry* map 1.0 0 pick set-nth ;
+
+: (gamma-lanczos6) ( x -- log[gamma[x+1]] )
+    #! log(gamma(x+1)
+    dup 0.5 + dup gamma-g6 + dup >r log * r> -
+    swap 6 gamma-z gamma-p6 v. log + ;
+
+: gamma-lanczos6 ( x -- gamma[x] )
+    #! gamma(x) = gamma(x+1) / x
+    dup (gamma-lanczos6) exp swap / ;
+
+: gammaln-lanczos6 ( x -- gammaln[x] )
+    #! log(gamma(x)) = log(gamma(x+1)) - log(x)
+    dup (gamma-lanczos6) swap log - ;
+
+: gamma-neg ( gamma[abs[x]] x -- gamma[x] )
+    dup pi * sin * * pi neg swap / ; inline
+
+PRIVATE>
+
+: gamma ( x -- y )
+    #! gamma(x) = integral 0..inf [ t^(x-1) exp(-t) ] dt
+    #! gamma(n+1) = n! for n > 0
+    dup 0.0 <= over 1.0 mod zero? and [
+            drop 1./0.
+        ] [
+            dup abs gamma-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if
+    ] if ;
+
+: gammaln ( x -- gamma[x] )
+    #! gammaln(x) is an alternative when gamma(x)'s range
+    #! varies too widely
+    dup 0 < [
+            drop 1./0.
+        ] [
+            dup abs gammaln-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if
+    ] if ;
+
+: nth-root ( n x -- y )
+    over 0 = [ "0th root is undefined" throw ] when >r recip r> swap ^ ;
+
+! Forth Scientific Library Algorithm #1
+!
+! Evaluates the Real Exponential Integral,
+!     E1(x) = - Ei(-x) =   int_x^\infty exp^{-u}/u du      for x > 0
+! using a rational approximation
+!
+! Collected Algorithms from ACM, Volume 1 Algorithms 1-220,
+! 1980; Association for Computing Machinery Inc., New York,
+! ISBN 0-89791-017-6
+!
+! (c) Copyright 1994 Everett F. Carter.  Permission is granted by the
+! author to use this software for any application provided the
+! copyright notice is preserved.
+
+: exp-int ( x -- y )
+    #! For real values of x only. Accurate to 7 decimals.
+    dup 1.0 < [
+        dup 0.00107857 * 0.00976004 -
+        over *
+        0.05519968 +
+        over *
+        0.24991055 -
+        over *
+        0.99999193 +
+        over *
+        0.57721566 -
+        swap log -
+    ] [
+        dup 8.5733287401 +
+        over *
+        18.059016973 +
+        over *
+        8.6347608925 +
+        over *
+        0.2677737343 +
+
+        over
+        dup 9.5733223454 +
+        over *
+        25.6329561486 +
+        over *
+        21.0996530827 +
+        over *
+        3.9584969228 +
+
+        nip
+        /
+        over /
+        swap -1.0 * exp
+        *
+    ] if ;
diff --git a/extra/math/analysis/authors.txt b/extra/math/analysis/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/math/analysis/summary.txt b/extra/math/analysis/summary.txt
new file mode 100644 (file)
index 0000000..980009c
--- /dev/null
@@ -0,0 +1 @@
+Various special functions from complex analysis
diff --git a/extra/math/combinatorics/authors.txt b/extra/math/combinatorics/authors.txt
new file mode 100644 (file)
index 0000000..f372b57
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+Doug Coleman
diff --git a/extra/math/combinatorics/combinatorics.factor b/extra/math/combinatorics/combinatorics.factor
new file mode 100644 (file)
index 0000000..a0f331e
--- /dev/null
@@ -0,0 +1,21 @@
+USING: kernel math math.ranges math.vectors
+sequences sorting mirrors assocs ;
+IN: math.combinatorics
+
+: possible? 0 rot between? ; inline
+
+: nPk ( n k -- n!/k! )
+    2dup possible? [ [a,b) product ] [ 2drop 0 ] if ;
+
+: factorial ( n -- n! ) 1 nPk ;
+
+: (nCk) ( n k -- nCk )
+    [ nPk ] 2keep - factorial / ;
+
+: twiddle 2dup - dupd < [ dupd - ] when ; inline
+
+: nCk ( n k -- nCk )
+    2dup possible? [ twiddle (nCk) ] [ 2drop 0 ] if ;
+
+: inverse-permutation ( seq -- seq )
+    <enum> >alist sort-values keys ;
diff --git a/extra/math/combinatorics/summary.txt b/extra/math/combinatorics/summary.txt
new file mode 100644 (file)
index 0000000..ecd43de
--- /dev/null
@@ -0,0 +1 @@
+Permutations and combinations
diff --git a/extra/math/fft/authors.txt b/extra/math/fft/authors.txt
new file mode 100644 (file)
index 0000000..3b4a4af
--- /dev/null
@@ -0,0 +1 @@
+Hans Schmid
diff --git a/extra/math/fft/fft.factor b/extra/math/fft/fft.factor
new file mode 100644 (file)
index 0000000..a21351f
--- /dev/null
@@ -0,0 +1,15 @@
+! Fast Fourier Transform, copyright (C) 2007 Hans Schmid
+! http://dressguardmeister.blogspot.com/2007/01/fft.html
+USING: arrays sequences math math.vectors math.constants
+math.functions kernel splitting ;
+IN: math.fft
+
+: n^v ( n v -- w ) [ ^ ] curry* map ;
+: even ( seq -- seq ) 2 group 0 <column> ;
+: odd ( seq -- seq ) 2 group 1 <column> ;
+DEFER: fft
+: two ( seq -- seq ) fft 2 v/n dup append ;
+: omega ( n -- n ) recip -2 pi i * * * exp ;
+: twiddle ( seq -- seq ) dup length dup omega swap n^v v* ;
+: (fft) ( seq -- seq ) dup odd two twiddle swap even two v+ ;
+: fft ( seq -- seq ) dup length 1 = [ (fft) ] unless ;
diff --git a/extra/math/fft/summary.txt b/extra/math/fft/summary.txt
new file mode 100644 (file)
index 0000000..3d71dfa
--- /dev/null
@@ -0,0 +1 @@
+Fast fourier transform
diff --git a/extra/math/haar/haar.factor b/extra/math/haar/haar.factor
new file mode 100644 (file)
index 0000000..13eaa47
--- /dev/null
@@ -0,0 +1,15 @@
+! Haar wavelet transform -- http://dmr.ath.cx/gfx/haar/
+USING: sequences math kernel splitting ;
+IN: math.haar
+
+: averages ( seq -- seq )
+    [ first2 + 2 / ] map ;
+
+: differences ( seq averages -- differences )
+    >r 0 <column> r> [ - ] 2map ;
+
+: haar-step ( seq -- differences averages )
+    2 group dup averages [ differences ] keep ;
+
+: haar ( seq -- seq )
+    dup length 1 <= [ haar-step haar swap append ] unless ;
diff --git a/extra/math/haar/summary.txt b/extra/math/haar/summary.txt
new file mode 100644 (file)
index 0000000..5bb26dc
--- /dev/null
@@ -0,0 +1 @@
+Haar wavelet transform
diff --git a/extra/math/matrices/authors.txt b/extra/math/matrices/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/math/matrices/elimination/authors.txt b/extra/math/matrices/elimination/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/math/matrices/elimination/elimination-tests.factor b/extra/math/matrices/elimination/elimination-tests.factor
new file mode 100644 (file)
index 0000000..b9fedf5
--- /dev/null
@@ -0,0 +1,168 @@
+IN: temporary
+USING: kernel math.matrices math.matrices.elimination
+tools.test ;
+
+[
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 1 0 }
+        { 0 0 0 1 }
+    }
+] [
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 1 0 }
+        { 0 0 0 1 }
+    } echelon
+] unit-test
+
+[
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 1 0 }
+        { 0 0 0 1 }
+    }
+] [
+    {
+        { 1 0 0 0 }
+        { 1 1 0 0 }
+        { 1 0 1 0 }
+        { 1 0 0 1 }
+    } echelon
+] unit-test
+
+[
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 1 0 }
+        { 0 0 0 1 }
+    }
+] [
+    {
+        { 1 0 0 0 }
+        { 1 1 0 0 }
+        { 1 0 1 0 }
+        { 1 1 0 1 }
+    } echelon
+] unit-test
+
+[
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 1 0 }
+        { 0 0 0 1 }
+    }
+] [
+    {
+        { 1 0 0 0 }
+        { 1 1 0 0 }
+        { 1 1 0 1 }
+        { 1 0 1 0 }
+    } echelon
+] unit-test
+
+[
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 0 0 }
+        { 0 0 0 0 }
+    }
+] [
+    {
+        { 0 1 0 0 }
+        { 1 0 0 0 }
+        { 1 0 0 0 }
+        { 1 0 0 0 }
+    } [
+        [ 1 ] [ 0 0 pivot-row ] unit-test
+        1 0 do-row
+    ] with-matrix
+] unit-test
+
+[
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 0 0 }
+        { 0 0 0 0 }
+    }
+] [
+    {
+        { 0 1 0 0 }
+        { 1 0 0 0 }
+        { 1 0 0 0 }
+        { 1 0 0 0 }
+    } echelon
+] unit-test
+
+[
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 0 0 0 1 }
+        { 0 0 0 0 }
+    }
+] [
+    {
+        { 1 0 0 0 }
+        { 0 1 0 0 }
+        { 1 0 0 1 }
+        { 1 0 0 1 }
+    } echelon
+] unit-test
+
+[
+    {
+        { 1 0 0 1 }
+        { 0 1 0 1 }
+        { 0 0 0 -1 }
+        { 0 0 0 0 }
+    }
+] [
+    {
+        { 0 1 0 1 }
+        { 1 0 0 1 }
+        { 1 0 0 0 }
+        { 1 1 0 1 }
+    } echelon
+] unit-test
+
+[
+    2
+] [
+    {
+        { 0 0 }
+        { 0 0 }
+    } nullspace length
+] unit-test
+
+[
+    1 3
+] [
+    {
+        { 0 1 0 1 }
+        { 1 0 0 1 }
+        { 1 0 0 0 }
+        { 1 1 0 1 }
+    } null/rank
+] unit-test
+
+[
+    1 3
+] [
+    {
+        { 0 0 0 0 0 1 0 1 }
+        { 0 0 0 0 1 0 0 1 }
+        { 0 0 0 0 1 0 0 0 }
+        { 0 0 0 0 1 1 0 1 }
+    } null/rank
+] unit-test
+
+[ { { 1 0 -1 } { 0 1 2 } } ]
+[ { { 1 2 3 } { 4 5 6 } } solution ] unit-test
diff --git a/extra/math/matrices/elimination/elimination.factor b/extra/math/matrices/elimination/elimination.factor
new file mode 100644 (file)
index 0000000..b11ef5b
--- /dev/null
@@ -0,0 +1,110 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math math.vectors math.matrices namespaces
+sequences parser ;
+IN: math.matrices.elimination
+
+SYMBOL: matrix
+
+: with-matrix ( matrix quot -- )
+    [ swap matrix set call matrix get ] with-scope ; inline
+
+: nth-row ( row# -- seq ) matrix get nth ;
+
+: change-row ( row# quot -- | quot: seq -- seq )
+    matrix get swap change-nth ; inline
+
+: exchange-rows ( row# row# -- ) matrix get exchange ;
+
+: rows ( -- n ) matrix get length ;
+
+: cols ( -- n ) 0 nth-row length ;
+
+: first-col ( row# -- n )
+    #! First non-zero column
+    0 swap nth-row [ zero? not ] skip ;
+
+: clear-scale ( col# pivot-row i-row -- n )
+    >r over r> nth dup zero? [
+        3drop 0
+    ] [
+        >r nth dup zero? [
+            r> 2drop 0
+        ] [
+            r> swap / neg
+        ] if
+    ] if ;
+
+: (clear-col) ( col# pivot-row i -- )
+    [ [ clear-scale ] 2keep >r n*v r> v+ ] change-row ;
+
+: rows-from ( row# -- slice )
+    rows dup <slice> ;
+
+: clear-col ( col# row# rows -- )
+    >r nth-row r> [ >r 2dup r> (clear-col) ] each 2drop ;
+
+: do-row ( exchange-with row# -- )
+    [ exchange-rows ] keep
+    [ first-col ] keep
+    dup 1+ rows-from clear-col ;
+
+: find-row ( row# quot -- i elt )
+    >r rows-from r> find ; inline
+
+: pivot-row ( col# row# -- n )
+    [ dupd nth-row nth zero? not ] find-row 2nip ;
+
+: (echelon) ( col# row# -- )
+    over cols < over rows < and [
+        2dup pivot-row [ over do-row 1+ ] when*
+        >r 1+ r> (echelon)
+    ] [
+        2drop
+    ] if ;
+
+: echelon ( matrix -- matrix' )
+    [ 0 0 (echelon) ] with-matrix ;
+
+: nonzero-rows [ [ zero? ] all? not ] subset ;
+
+: null/rank ( matrix -- null rank )
+    echelon dup length swap nonzero-rows length [ - ] keep ;
+
+: leading ( seq -- n elt ) [ zero? not ] find ;
+
+: reduced ( matrix' -- matrix'' )
+    [
+        rows <reversed> [
+            dup nth-row leading drop
+            dup [ swap dup clear-col ] [ 2drop ] if
+        ] each
+    ] with-matrix ;
+
+: basis-vector ( row col# -- )
+    >r clone r>
+    [ swap nth neg recip ] 2keep
+    [ 0 swap rot set-nth ] 2keep
+    >r n*v r>
+    matrix get set-nth ;
+
+: nullspace ( matrix -- seq )
+    echelon reduced dup empty? [
+        dup first length identity-matrix [
+            [
+                dup leading drop
+                dup [ basis-vector ] [ 2drop ] if
+            ] each
+        ] with-matrix flip nonzero-rows
+    ] unless ;
+
+: 1-pivots ( matrix -- matrix )
+    [ dup leading nip [ recip v*n ] when* ] map ;
+
+: solution ( matrix -- matrix )
+    echelon nonzero-rows reduced 1-pivots ;
+
+: inverse ( matrix -- matrix ) ! Assumes an invertible matrix
+    dup length
+    [ identity-matrix [ append ] 2map solution ] keep
+    [ tail ] curry map ;
diff --git a/extra/math/matrices/elimination/summary.txt b/extra/math/matrices/elimination/summary.txt
new file mode 100644 (file)
index 0000000..83972ab
--- /dev/null
@@ -0,0 +1 @@
+Solving systems of linear equations
diff --git a/extra/math/matrices/matrices-tests.factor b/extra/math/matrices/matrices-tests.factor
new file mode 100644 (file)
index 0000000..9670ab8
--- /dev/null
@@ -0,0 +1,104 @@
+IN: temporary
+USING: math.matrices math.vectors tools.test math ;
+
+[
+    { { 0 } { 0 } { 0 } }
+] [
+    3 1 zero-matrix
+] unit-test
+
+[
+    { { 1 0 0 }
+       { 0 1 0 }
+       { 0 0 1 } }
+] [
+    3 identity-matrix
+] unit-test
+
+[
+    { { 1 0 4 }
+       { 0 7 0 }
+       { 6 0 3 } }
+] [
+    { { 1 0 0 }
+       { 0 2 0 }
+       { 0 0 3 } }
+       
+    { { 0 0 4 }
+       { 0 5 0 }
+       { 6 0 0 } }
+
+    m+
+] unit-test
+
+[
+    { { 1 0 4 }
+       { 0 7 0 }
+       { 6 0 3 } }
+] [
+    { { 1 0 0 }
+       { 0 2 0 }
+       { 0 0 3 } }
+       
+    { { 0 0 -4 }
+       { 0 -5 0 }
+       { -6 0 0 } }
+
+    m-
+] unit-test
+
+[
+    { 10 20 30 }
+] [
+    10 { 1 2 3 } n*v
+] unit-test
+
+[
+    { 3 4 }
+] [
+    { { 1 0 }
+       { 0 1 } }
+
+    { 3 4 }
+
+    m.v
+] unit-test
+
+[
+    { 4 3 }
+] [
+    { { 0 1 }
+       { 1 0 } }
+
+    { 3 4 }
+
+    m.v
+] unit-test
+
+[
+    { { 6 } }
+] [
+    { { 3 } } { { 2 } } m.
+] unit-test
+
+[
+    { { 11 } }
+] [
+    { { 1 3 } } { { 5 } { 2 } } m.
+] unit-test
+
+[
+    { { 28 } }
+] [
+    { { 2 4 6 } }
+
+    { { 1 }
+       { 2 }
+       { 3 } }
+    
+    m.
+] 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
diff --git a/extra/math/matrices/matrices.factor b/extra/math/matrices/matrices.factor
new file mode 100644 (file)
index 0000000..c133bd7
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel sequences math math.functions
+math.vectors ;
+IN: math.matrices
+
+! Matrices
+: zero-matrix ( m n -- matrix )
+    [ nip 0 <array> ] curry map ;
+
+: identity-matrix ( n -- matrix )
+    #! Make a nxn identity matrix.
+    dup [ [ = 1 0 ? ] curry* map ] curry map ;
+
+! Matrix operations
+: mneg ( m -- m ) [ vneg ] map ;
+
+: n*m ( n m -- m ) [ n*v ] curry* map ;
+: m*n ( m n -- m ) [ v*n ] curry map ;
+: n/m ( n m -- m ) [ n/v ] curry* map ;
+: m/n ( m n -- m ) [ v/n ] curry map ;
+
+: m+   ( m m -- m ) [ v+ ] 2map ;
+: m-   ( m m -- m ) [ v- ] 2map ;
+: m*   ( m m -- m ) [ v* ] 2map ;
+: m/   ( m m -- m ) [ v/ ] 2map ;
+
+: v.m ( v m -- v ) flip [ v. ] curry* map ;
+: m.v ( m v -- v ) [ v. ] curry map ;
+: m.  ( m m -- m ) flip [ swap m.v ] curry map ;
+
+: mmin ( m -- n ) >r 1/0. r> [ [ min ] each ] each ;
+: mmax ( m -- n ) >r -1/0. r> [ [ max ] each ] each ;
+: mnorm ( m -- n ) dup mmax abs m/n ;
+
+: cross-i ( vec1 vec2 -- i )
+    over third over second * >r
+    swap second swap third * r> - ;
+
+: cross-j ( vec1 vec2 -- j )
+    over first over third * >r
+    swap third swap first * r> - ;
+
+: cross-k ( vec1 vec2 -- k )
+    over first over second * >r
+    swap second swap first * r> - ;
+
+: cross ( vec1 vec2 -- vec3 )
+    [ cross-i ] 2keep [ cross-j ] 2keep cross-k 3array ;
+
+: proj ( v u -- w )
+    [ [ v. ] keep norm-sq / ] keep n*v ;
+
+: (gram-schmidt) ( v seq -- newseq )
+    [ dupd proj v- ] each ;
+
+: gram-schmidt ( seq -- orthogonal )
+    V{ } clone [ over (gram-schmidt) over push ] reduce ;
+
+: norm-gram-schmidt ( seq -- orthonormal )
+    gram-schmidt [ normalize ] map ;
diff --git a/extra/math/matrices/summary.txt b/extra/math/matrices/summary.txt
new file mode 100644 (file)
index 0000000..0e9fa9a
--- /dev/null
@@ -0,0 +1 @@
+Matrix arithmetic
diff --git a/extra/math/miller-rabin/miller-rabin-tests.factor b/extra/math/miller-rabin/miller-rabin-tests.factor
new file mode 100644 (file)
index 0000000..42e4164
--- /dev/null
@@ -0,0 +1,10 @@
+USING: math.miller-rabin kernel math namespaces tools.test ;
+
+[ f ] [ 473155932665450549999756893736999469773678960651272093993257221235459777950185377130233556540099119926369437865330559863 miller-rabin ] unit-test
+[ t ] [ 2 miller-rabin ] unit-test
+[ t ] [ 3 miller-rabin ] unit-test
+[ f ] [ 36 miller-rabin ] unit-test
+[ t ] [ 37 miller-rabin ] unit-test
+[ 101 ] [ 100 next-prime ] unit-test
+[ 100000000000031 ] [ 100000000000000 next-prime ] unit-test
+
diff --git a/extra/math/miller-rabin/miller-rabin.factor b/extra/math/miller-rabin/miller-rabin.factor
new file mode 100644 (file)
index 0000000..ea2f30b
--- /dev/null
@@ -0,0 +1,90 @@
+USING: combinators combinators.lib io locals kernel math
+math.functions math.ranges namespaces random sequences ;
+IN: math.miller-rabin
+
+SYMBOL: a
+SYMBOL: n
+SYMBOL: r
+SYMBOL: s
+SYMBOL: count
+SYMBOL: trials
+
+: >even ( n -- int )
+    dup even? [ 1- ] unless ; foldable
+
+: >odd ( n -- int )
+    dup even? [ 1+ ] when ; foldable
+
+: next-odd ( m -- n )
+    dup even? [ 1+ ] [ 2 + ] if ;
+
+: random-bits ( m -- n )
+    #! Top bit is always set
+    2^ [ random ] keep -1 shift bitor ; foldable
+
+: (factor-2s) ( s n -- s n )
+    dup even? [ -1 shift >r 1+ r> (factor-2s) ] when ;
+
+: factor-2s ( n -- r s )
+    #! factor an even number into 2 ^ s * m
+    dup even? over 0 > and [
+        "input must be positive and even" throw
+    ] unless 0 swap (factor-2s) ;
+
+:: (miller-rabin) | n prime?! |
+    n dup 1 = over even? or [
+        drop f
+    ] [
+        1- factor-2s s set r set
+        trials get [
+            n 1- [1,b] random a set
+            a get s get n ^mod 1 = [
+                0 count set
+                r get [
+                    2^ s get * a get swap n ^mod n - -1 = [
+                        count [ 1+ ] change
+                        r get +
+                    ] when
+                ] each
+                count get zero? [
+                    f prime?!
+                    trials get +
+                ] when
+            ] unless
+            drop
+        ] each
+        prime?
+    ] if ;
+
+TUPLE: miller-rabin-bounds ;
+
+: miller-rabin* ( n numtrials -- ? )
+    over {
+        { [ dup 1 <= ] [ 3drop f ] }
+        { [ dup 2 = ] [ 3drop t ] }
+        { [ t ] [ [ drop trials set t (miller-rabin) ] with-scope ] }
+    } cond ;
+
+: miller-rabin ( n -- ? ) 10 miller-rabin* ;
+
+: next-prime ( n -- p )
+    next-odd dup miller-rabin [ next-prime ] unless ;
+
+: random-prime ( numbits -- p )
+    random-bits next-prime ;
+
+: (find-relative-prime) ( n guess -- p )
+    2dup gcd nip 1 > [ 2 + (find-relative-prime) ] [ nip ] if ;
+
+: find-relative-prime* ( n guess -- p )
+    #! find a prime relative to n with initial guess
+    >odd (find-relative-prime) ;
+
+: find-relative-prime ( n -- p )
+    dup random >odd (find-relative-prime) ;
+
+: unique-primes ( numbits n -- seq )
+    #! generate two primes
+    over 5 < [ "not enough primes below 5 bits" throw ] when
+    [ [ drop random-prime ] curry* map ] [ all-unique? ] generate ;
+
diff --git a/extra/math/numerical-integration/authors.txt b/extra/math/numerical-integration/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/math/numerical-integration/numerical-integration-tests.factor b/extra/math/numerical-integration/numerical-integration-tests.factor
new file mode 100644 (file)
index 0000000..ce7f679
--- /dev/null
@@ -0,0 +1,9 @@
+USING: kernel math.numerical-integration ;
+IN: temporary
+
+[ 50 ] [ 0 10 [ ] integrate-simpson ] unit-test
+[ 1000/3 ] [ 0 10 [ sq ] integrate-simpson ] unit-test
+[ t ] [ 0 pi 2 / [ sin ] integrate-simpson 1 .000000001 ~abs ] unit-test
+[ t ] [ 0 pi [ sin ] integrate-simpson 2 .00000001 ~abs ] unit-test
+[ t ] [  0 pi 2 * [ sin ] integrate-simpson 0 .00000000001 ~abs ] unit-test
+
diff --git a/extra/math/numerical-integration/numerical-integration.factor b/extra/math/numerical-integration/numerical-integration.factor
new file mode 100644 (file)
index 0000000..163fc40
--- /dev/null
@@ -0,0 +1,18 @@
+USING: arrays kernel sequences namespaces math math.ranges
+math.vectors vectors ;
+IN: math.numerical-integration
+
+SYMBOL: num-steps 180 num-steps set-global
+: setup-simpson-range ( from to -- frange )
+    2dup swap - num-steps get / <range> ;
+
+: generate-simpson-weights ( seq -- seq )
+    [
+        { 1 4 } % length 2 / 2 - { 2 4 } <repetition> concat % 1 ,
+    ] { } make ;
+
+: integrate-simpson ( from to f -- x )
+    >r setup-simpson-range r>
+    dupd map dup generate-simpson-weights
+    v. swap [ third ] keep first - 6 / * ;
+
diff --git a/extra/math/numerical-integration/summary.txt b/extra/math/numerical-integration/summary.txt
new file mode 100644 (file)
index 0000000..8e983a9
--- /dev/null
@@ -0,0 +1 @@
+Numerical integration using Simpson's method
diff --git a/extra/math/polynomials/authors.txt b/extra/math/polynomials/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/math/polynomials/polynomials-tests.factor b/extra/math/polynomials/polynomials-tests.factor
new file mode 100644 (file)
index 0000000..80375c3
--- /dev/null
@@ -0,0 +1,31 @@
+IN: temporary
+USING: kernel math tools.test ;
+
+! Tests
+[ { 0 1 } ] [ { 0 1 0 0 } ptrim ] unit-test
+[ { 1 } ] [ { 1 0 0 } ptrim ] unit-test
+[ { 0 } ] [ { 0 } ptrim ] unit-test
+[ { 3 10 8 } ] [ { 1 2 } { 3 4 } p* ] unit-test
+[ { 3 10 8 } ] [ { 3 4 } { 1 2 } p* ] unit-test
+[ { 0 0 0 0 0 0 0 0 0 0 } ] [ { 0 0 0 } { 0 0 0 0 0 0 0 0 } p* ] unit-test
+[ { 0 1 } ] [ { 0 1 } { 1 } p* ] unit-test
+[ { 0 } ] [ { } { } p* ] unit-test
+[ { 0 } ] [ { 0 } { } p* ] unit-test
+[ { 0 } ] [ { } { 0 } p* ] unit-test
+[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p+ ] unit-test
+[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p- ] unit-test
+[ { 0 0 0 } ] [ 4 { 0 0 0 } n*p ] unit-test
+[ { 4 8 0 12 } ] [ 4 { 1 2 0 3 } n*p ] unit-test
+[ { 1 4 7 6 0 0 0 0 0 } ] [ { 1 2 3 0 0 0 } { 1 2 0 0 } p* ] unit-test
+[ V{ 7 -2 1 } V{ -20 0 0 } ] [ { 1 1 1 1 } { 3 1 } p/mod ] unit-test
+[ V{ 0 0 } V{ 1 1 } ] [ { 1 1 } { 1 1 1 1 } p/mod ] unit-test
+[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 } p/mod ] unit-test
+[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 0 0 0 0 0 0 } p/mod ] unit-test
+[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 0 0 0 0 } { 1 1 0 0 } p/mod ] unit-test
+[ V{ 5.0 } V{ 0.0 } ] [ { 10.0 } { 2.0 } p/mod ] unit-test
+[ V{ 15/16 } V{ 0 } ] [ { 3/4 } { 4/5 } p/mod ] unit-test
+[ t ] [ { 0 1 } { 0 1 0 } p= ] unit-test
+[ f ] [ { 0 0 1 } { 0 1 0 } p= ] unit-test
+[ t ] [ { 1 1 1 } { 1 1 1 } p= ] unit-test
+[ { 0 0 } { 1 1 } ] [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test
+
diff --git a/extra/math/polynomials/polynomials.factor b/extra/math/polynomials/polynomials.factor
new file mode 100644 (file)
index 0000000..5a4cc2b
--- /dev/null
@@ -0,0 +1,86 @@
+USING: arrays kernel sequences vectors math math.vectors namespaces
+shuffle splitting ;
+IN: math.polynomials
+
+! Polynomials are vectors with the highest powers on the right:
+! { 1 1 0 1 } -> 1 + x + x^3
+! { } -> 0
+
+: powers ( n x -- seq )
+    #! Output sequence has n elements, { 1 x x^2 x^3 ... }
+    <array> 1 [ * ] accumulate nip ;
+
+<PRIVATE
+: 2pad-left ( p p n -- p p ) 0 [ pad-left swap ] 2keep pad-left swap ;
+: 2pad-right ( p p n -- p p ) 0 [ pad-right swap ] 2keep pad-right swap ;
+: pextend ( p p -- p p ) 2dup [ length ] 2apply max 2pad-right ;
+: pextend-left ( p p -- p p ) 2dup [ length ] 2apply max 2pad-left ;
+: unempty ( seq -- seq ) dup empty? [ drop { 0 } ] when ;
+: 2unempty ( seq seq -- seq seq ) [ unempty ] 2apply ;
+
+PRIVATE>
+: p= ( p p -- ? ) pextend = ;
+
+: ptrim ( p -- p )
+    dup length 1 = [ [ zero? ] rtrim ] unless ;
+
+: 2ptrim ( p p -- p p ) [ ptrim ] 2apply ;
+: p+ ( p p -- p ) pextend v+ ;
+: p- ( p p -- p ) pextend v- ;
+: n*p ( n p -- n*p ) n*v ;
+
+! convolution
+: pextend-conv ( p p -- p p )
+    #! extend to: p_m + p_n - 1 
+    2dup [ length ] 2apply + 1- 2pad-right [ >vector ] 2apply ;
+
+: p* ( p p -- p )
+    #! Multiply two polynomials.
+    2unempty pextend-conv <reversed> dup length
+    [ over length pick <slice> pick [ * ] 2map sum ] map 2nip reverse ;
+    
+: p-sq ( p -- p-sq )
+    dup p* ;
+
+<PRIVATE
+
+: p/mod-setup ( p p -- p p n )
+    2ptrim
+    2dup [ length ] 2apply -
+    dup 1 < [ drop 1 ] when
+    [ over length + 0 pad-left pextend ] keep 1+ ;
+
+: /-last ( seq seq -- a )
+    #! divide the last two numbers in the sequences
+    [ peek ] 2apply / ;
+
+: (p/mod)
+    2dup /-last
+    2dup , n*p swapd
+    p- >vector
+    dup pop* swap 1 tail-slice ;
+
+PRIVATE>
+
+: p/mod ( a b -- / mod )
+    p/mod-setup [ [ (p/mod) ] times ] V{ } make
+    reverse nip swap 2ptrim pextend ;
+
+: (pgcd) ( b a y x -- a d )
+    dup V{ 0 } clone p= [
+        drop nip
+    ] [
+        tuck p/mod >r pick p* swap >r swapd p- r> r> (pgcd)
+    ] if ;
+
+: pgcd ( p p -- p q )
+    swap V{ 0 } clone V{ 1 } clone 2swap (pgcd) [ >array ] 2apply ;
+
+: pdiff ( p -- p' )
+    #! Polynomial derivative.
+    dup length v* { 0 } ?head drop ;
+
+: polyval ( p x -- p[x] )
+    #! Evaluate a polynomial.
+    >r dup length r> powers v. ;
+
diff --git a/extra/math/polynomials/summary.txt b/extra/math/polynomials/summary.txt
new file mode 100644 (file)
index 0000000..5c237a2
--- /dev/null
@@ -0,0 +1 @@
+Polynomial arithmetic
diff --git a/extra/math/primes/list/list.factor b/extra/math/primes/list/list.factor
new file mode 100644 (file)
index 0000000..115c852
--- /dev/null
@@ -0,0 +1,6421 @@
+IN: math.primes.list
+
+: primes-under-million ( -- seq )
+{
+2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 
+107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 
+223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 
+337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 
+457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 
+593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 
+719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 
+857 859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 
+997 
+1009 1013 1019 1021 1031 1033 1039 1049 1051 1061 1063 1069 1087 1091 1093 1097 
+1103 1109 1117 1123 1129 1151 1153 1163 1171 1181 1187 1193 1201 1213 1217 1223 
+1229 1231 1237 1249 1259 1277 1279 1283 1289 1291 1297 1301 1303 1307 1319 1321 
+1327 1361 1367 1373 1381 1399 1409 1423 1427 1429 1433 1439 1447 1451 1453 1459 
+1471 1481 1483 1487 1489 1493 1499 1511 1523 1531 1543 1549 1553 1559 1567 1571 
+1579 1583 1597 1601 1607 1609 1613 1619 1621 1627 1637 1657 1663 1667 1669 1693 
+1697 1699 1709 1721 1723 1733 1741 1747 1753 1759 1777 1783 1787 1789 1801 1811 
+1823 1831 1847 1861 1867 1871 1873 1877 1879 1889 1901 1907 1913 1931 1933 1949 
+1951 1973 1979 1987 1993 1997 1999 2003 2011 2017 2027 2029 2039 2053 2063 2069 
+2081 2083 2087 2089 2099 2111 2113 2129 2131 2137 2141 2143 2153 2161 2179 2203 
+2207 2213 2221 2237 2239 2243 2251 2267 2269 2273 2281 2287 2293 2297 2309 2311 
+2333 2339 2341 2347 2351 2357 2371 2377 2381 2383 2389 2393 2399 2411 2417 2423 
+2437 2441 2447 2459 2467 2473 2477 2503 2521 2531 2539 2543 2549 2551 2557 2579 
+2591 2593 2609 2617 2621 2633 2647 2657 2659 2663 2671 2677 2683 2687 2689 2693 
+2699 2707 2711 2713 2719 2729 2731 2741 2749 2753 2767 2777 2789 2791 2797 2801 
+2803 2819 2833 2837 2843 2851 2857 2861 2879 2887 2897 2903 2909 2917 2927 2939 
+2953 2957 2963 2969 2971 2999 3001 3011 3019 3023 3037 3041 3049 3061 3067 3079 
+3083 3089 3109 3119 3121 3137 3163 3167 3169 3181 3187 3191 3203 3209 3217 3221 
+3229 3251 3253 3257 3259 3271 3299 3301 3307 3313 3319 3323 3329 3331 3343 3347 
+3359 3361 3371 3373 3389 3391 3407 3413 3433 3449 3457 3461 3463 3467 3469 3491 
+3499 3511 3517 3527 3529 3533 3539 3541 3547 3557 3559 3571 3581 3583 3593 3607 
+3613 3617 3623 3631 3637 3643 3659 3671 3673 3677 3691 3697 3701 3709 3719 3727 
+3733 3739 3761 3767 3769 3779 3793 3797 3803 3821 3823 3833 3847 3851 3853 3863 
+3877 3881 3889 3907 3911 3917 3919 3923 3929 3931 3943 3947 3967 3989 4001 4003 
+4007 4013 4019 4021 4027 4049 4051 4057 4073 4079 4091 4093 4099 4111 4127 4129 
+4133 4139 4153 4157 4159 4177 4201 4211 4217 4219 4229 4231 4241 4243 4253 4259 
+4261 4271 4273 4283 4289 4297 4327 4337 4339 4349 4357 4363 4373 4391 4397 4409 
+4421 4423 4441 4447 4451 4457 4463 4481 4483 4493 4507 4513 4517 4519 4523 4547 
+4549 4561 4567 4583 4591 4597 4603 4621 4637 4639 4643 4649 4651 4657 4663 4673 
+4679 4691 4703 4721 4723 4729 4733 4751 4759 4783 4787 4789 4793 4799 4801 4813 
+4817 4831 4861 4871 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 
+4969 4973 4987 4993 4999 5003 5009 5011 5021 5023 5039 5051 5059 5077 5081 5087 
+5099 5101 5107 5113 5119 5147 5153 5167 5171 5179 5189 5197 5209 5227 5231 5233 
+5237 5261 5273 5279 5281 5297 5303 5309 5323 5333 5347 5351 5381 5387 5393 5399 
+5407 5413 5417 5419 5431 5437 5441 5443 5449 5471 5477 5479 5483 5501 5503 5507 
+5519 5521 5527 5531 5557 5563 5569 5573 5581 5591 5623 5639 5641 5647 5651 5653 
+5657 5659 5669 5683 5689 5693 5701 5711 5717 5737 5741 5743 5749 5779 5783 5791 
+5801 5807 5813 5821 5827 5839 5843 5849 5851 5857 5861 5867 5869 5879 5881 5897 
+5903 5923 5927 5939 5953 5981 5987 6007 6011 6029 6037 6043 6047 6053 6067 6073 
+6079 6089 6091 6101 6113 6121 6131 6133 6143 6151 6163 6173 6197 6199 6203 6211 
+6217 6221 6229 6247 6257 6263 6269 6271 6277 6287 6299 6301 6311 6317 6323 6329 
+6337 6343 6353 6359 6361 6367 6373 6379 6389 6397 6421 6427 6449 6451 6469 6473 
+6481 6491 6521 6529 6547 6551 6553 6563 6569 6571 6577 6581 6599 6607 6619 6637 
+6653 6659 6661 6673 6679 6689 6691 6701 6703 6709 6719 6733 6737 6761 6763 6779 
+6781 6791 6793 6803 6823 6827 6829 6833 6841 6857 6863 6869 6871 6883 6899 6907 
+6911 6917 6947 6949 6959 6961 6967 6971 6977 6983 6991 6997 7001 7013 7019 7027 
+7039 7043 7057 7069 7079 7103 7109 7121 7127 7129 7151 7159 7177 7187 7193 7207 
+7211 7213 7219 7229 7237 7243 7247 7253 7283 7297 7307 7309 7321 7331 7333 7349 
+7351 7369 7393 7411 7417 7433 7451 7457 7459 7477 7481 7487 7489 7499 7507 7517 
+7523 7529 7537 7541 7547 7549 7559 7561 7573 7577 7583 7589 7591 7603 7607 7621 
+7639 7643 7649 7669 7673 7681 7687 7691 7699 7703 7717 7723 7727 7741 7753 7757 
+7759 7789 7793 7817 7823 7829 7841 7853 7867 7873 7877 7879 7883 7901 7907 7919 
+7927 7933 7937 7949 7951 7963 7993 8009 8011 8017 8039 8053 8059 8069 8081 8087 
+8089 8093 8101 8111 8117 8123 8147 8161 8167 8171 8179 8191 8209 8219 8221 8231 
+8233 8237 8243 8263 8269 8273 8287 8291 8293 8297 8311 8317 8329 8353 8363 8369 
+8377 8387 8389 8419 8423 8429 8431 8443 8447 8461 8467 8501 8513 8521 8527 8537 
+8539 8543 8563 8573 8581 8597 8599 8609 8623 8627 8629 8641 8647 8663 8669 8677 
+8681 8689 8693 8699 8707 8713 8719 8731 8737 8741 8747 8753 8761 8779 8783 8803 
+8807 8819 8821 8831 8837 8839 8849 8861 8863 8867 8887 8893 8923 8929 8933 8941 
+8951 8963 8969 8971 8999 9001 9007 9011 9013 9029 9041 9043 9049 9059 9067 9091 
+9103 9109 9127 9133 9137 9151 9157 9161 9173 9181 9187 9199 9203 9209 9221 9227 
+9239 9241 9257 9277 9281 9283 9293 9311 9319 9323 9337 9341 9343 9349 9371 9377 
+9391 9397 9403 9413 9419 9421 9431 9433 9437 9439 9461 9463 9467 9473 9479 9491 
+9497 9511 9521 9533 9539 9547 9551 9587 9601 9613 9619 9623 9629 9631 9643 9649 
+9661 9677 9679 9689 9697 9719 9721 9733 9739 9743 9749 9767 9769 9781 9787 9791 
+9803 9811 9817 9829 9833 9839 9851 9857 9859 9871 9883 9887 9901 9907 9923 9929 
+9931 9941 9949 9967 9973 
+10007 10009 10037 10039 10061 10067 10069 10079 10091 10093 10099 10103 10111 10133 
+10139 10141 10151 10159 10163 10169 10177 10181 10193 10211 10223 10243 10247 10253 
+10259 10267 10271 10273 10289 10301 10303 10313 10321 10331 10333 10337 10343 10357 
+10369 10391 10399 10427 10429 10433 10453 10457 10459 10463 10477 10487 10499 10501 
+10513 10529 10531 10559 10567 10589 10597 10601 10607 10613 10627 10631 10639 10651 
+10657 10663 10667 10687 10691 10709 10711 10723 10729 10733 10739 10753 10771 10781 
+10789 10799 10831 10837 10847 10853 10859 10861 10867 10883 10889 10891 10903 10909 
+10937 10939 10949 10957 10973 10979 10987 10993 11003 11027 11047 11057 11059 11069 
+11071 11083 11087 11093 11113 11117 11119 11131 11149 11159 11161 11171 11173 11177 
+11197 11213 11239 11243 11251 11257 11261 11273 11279 11287 11299 11311 11317 11321 
+11329 11351 11353 11369 11383 11393 11399 11411 11423 11437 11443 11447 11467 11471 
+11483 11489 11491 11497 11503 11519 11527 11549 11551 11579 11587 11593 11597 11617 
+11621 11633 11657 11677 11681 11689 11699 11701 11717 11719 11731 11743 11777 11779 
+11783 11789 11801 11807 11813 11821 11827 11831 11833 11839 11863 11867 11887 11897 
+11903 11909 11923 11927 11933 11939 11941 11953 11959 11969 11971 11981 11987 12007 
+12011 12037 12041 12043 12049 12071 12073 12097 12101 12107 12109 12113 12119 12143 
+12149 12157 12161 12163 12197 12203 12211 12227 12239 12241 12251 12253 12263 12269 
+12277 12281 12289 12301 12323 12329 12343 12347 12373 12377 12379 12391 12401 12409 
+12413 12421 12433 12437 12451 12457 12473 12479 12487 12491 12497 12503 12511 12517 
+12527 12539 12541 12547 12553 12569 12577 12583 12589 12601 12611 12613 12619 12637 
+12641 12647 12653 12659 12671 12689 12697 12703 12713 12721 12739 12743 12757 12763 
+12781 12791 12799 12809 12821 12823 12829 12841 12853 12889 12893 12899 12907 12911 
+12917 12919 12923 12941 12953 12959 12967 12973 12979 12983 13001 13003 13007 13009 
+13033 13037 13043 13049 13063 13093 13099 13103 13109 13121 13127 13147 13151 13159 
+13163 13171 13177 13183 13187 13217 13219 13229 13241 13249 13259 13267 13291 13297 
+13309 13313 13327 13331 13337 13339 13367 13381 13397 13399 13411 13417 13421 13441 
+13451 13457 13463 13469 13477 13487 13499 13513 13523 13537 13553 13567 13577 13591 
+13597 13613 13619 13627 13633 13649 13669 13679 13681 13687 13691 13693 13697 13709 
+13711 13721 13723 13729 13751 13757 13759 13763 13781 13789 13799 13807 13829 13831 
+13841 13859 13873 13877 13879 13883 13901 13903 13907 13913 13921 13931 13933 13963 
+13967 13997 13999 14009 14011 14029 14033 14051 14057 14071 14081 14083 14087 14107 
+14143 14149 14153 14159 14173 14177 14197 14207 14221 14243 14249 14251 14281 14293 
+14303 14321 14323 14327 14341 14347 14369 14387 14389 14401 14407 14411 14419 14423 
+14431 14437 14447 14449 14461 14479 14489 14503 14519 14533 14537 14543 14549 14551 
+14557 14561 14563 14591 14593 14621 14627 14629 14633 14639 14653 14657 14669 14683 
+14699 14713 14717 14723 14731 14737 14741 14747 14753 14759 14767 14771 14779 14783 
+14797 14813 14821 14827 14831 14843 14851 14867 14869 14879 14887 14891 14897 14923 
+14929 14939 14947 14951 14957 14969 14983 15013 15017 15031 15053 15061 15073 15077 
+15083 15091 15101 15107 15121 15131 15137 15139 15149 15161 15173 15187 15193 15199 
+15217 15227 15233 15241 15259 15263 15269 15271 15277 15287 15289 15299 15307 15313 
+15319 15329 15331 15349 15359 15361 15373 15377 15383 15391 15401 15413 15427 15439 
+15443 15451 15461 15467 15473 15493 15497 15511 15527 15541 15551 15559 15569 15581 
+15583 15601 15607 15619 15629 15641 15643 15647 15649 15661 15667 15671 15679 15683 
+15727 15731 15733 15737 15739 15749 15761 15767 15773 15787 15791 15797 15803 15809 
+15817 15823 15859 15877 15881 15887 15889 15901 15907 15913 15919 15923 15937 15959 
+15971 15973 15991 16001 16007 16033 16057 16061 16063 16067 16069 16073 16087 16091 
+16097 16103 16111 16127 16139 16141 16183 16187 16189 16193 16217 16223 16229 16231 
+16249 16253 16267 16273 16301 16319 16333 16339 16349 16361 16363 16369 16381 16411 
+16417 16421 16427 16433 16447 16451 16453 16477 16481 16487 16493 16519 16529 16547 
+16553 16561 16567 16573 16603 16607 16619 16631 16633 16649 16651 16657 16661 16673 
+16691 16693 16699 16703 16729 16741 16747 16759 16763 16787 16811 16823 16829 16831 
+16843 16871 16879 16883 16889 16901 16903 16921 16927 16931 16937 16943 16963 16979 
+16981 16987 16993 17011 17021 17027 17029 17033 17041 17047 17053 17077 17093 17099 
+17107 17117 17123 17137 17159 17167 17183 17189 17191 17203 17207 17209 17231 17239 
+17257 17291 17293 17299 17317 17321 17327 17333 17341 17351 17359 17377 17383 17387 
+17389 17393 17401 17417 17419 17431 17443 17449 17467 17471 17477 17483 17489 17491 
+17497 17509 17519 17539 17551 17569 17573 17579 17581 17597 17599 17609 17623 17627 
+17657 17659 17669 17681 17683 17707 17713 17729 17737 17747 17749 17761 17783 17789 
+17791 17807 17827 17837 17839 17851 17863 17881 17891 17903 17909 17911 17921 17923 
+17929 17939 17957 17959 17971 17977 17981 17987 17989 18013 18041 18043 18047 18049 
+18059 18061 18077 18089 18097 18119 18121 18127 18131 18133 18143 18149 18169 18181 
+18191 18199 18211 18217 18223 18229 18233 18251 18253 18257 18269 18287 18289 18301 
+18307 18311 18313 18329 18341 18353 18367 18371 18379 18397 18401 18413 18427 18433 
+18439 18443 18451 18457 18461 18481 18493 18503 18517 18521 18523 18539 18541 18553 
+18583 18587 18593 18617 18637 18661 18671 18679 18691 18701 18713 18719 18731 18743 
+18749 18757 18773 18787 18793 18797 18803 18839 18859 18869 18899 18911 18913 18917 
+18919 18947 18959 18973 18979 19001 19009 19013 19031 19037 19051 19069 19073 19079 
+19081 19087 19121 19139 19141 19157 19163 19181 19183 19207 19211 19213 19219 19231 
+19237 19249 19259 19267 19273 19289 19301 19309 19319 19333 19373 19379 19381 19387 
+19391 19403 19417 19421 19423 19427 19429 19433 19441 19447 19457 19463 19469 19471 
+19477 19483 19489 19501 19507 19531 19541 19543 19553 19559 19571 19577 19583 19597 
+19603 19609 19661 19681 19687 19697 19699 19709 19717 19727 19739 19751 19753 19759 
+19763 19777 19793 19801 19813 19819 19841 19843 19853 19861 19867 19889 19891 19913 
+19919 19927 19937 19949 19961 19963 19973 19979 19991 19993 19997 20011 20021 20023 
+20029 20047 20051 20063 20071 20089 20101 20107 20113 20117 20123 20129 20143 20147 
+20149 20161 20173 20177 20183 20201 20219 20231 20233 20249 20261 20269 20287 20297 
+20323 20327 20333 20341 20347 20353 20357 20359 20369 20389 20393 20399 20407 20411 
+20431 20441 20443 20477 20479 20483 20507 20509 20521 20533 20543 20549 20551 20563 
+20593 20599 20611 20627 20639 20641 20663 20681 20693 20707 20717 20719 20731 20743 
+20747 20749 20753 20759 20771 20773 20789 20807 20809 20849 20857 20873 20879 20887 
+20897 20899 20903 20921 20929 20939 20947 20959 20963 20981 20983 21001 21011 21013 
+21017 21019 21023 21031 21059 21061 21067 21089 21101 21107 21121 21139 21143 21149 
+21157 21163 21169 21179 21187 21191 21193 21211 21221 21227 21247 21269 21277 21283 
+21313 21317 21319 21323 21341 21347 21377 21379 21383 21391 21397 21401 21407 21419 
+21433 21467 21481 21487 21491 21493 21499 21503 21517 21521 21523 21529 21557 21559 
+21563 21569 21577 21587 21589 21599 21601 21611 21613 21617 21647 21649 21661 21673 
+21683 21701 21713 21727 21737 21739 21751 21757 21767 21773 21787 21799 21803 21817 
+21821 21839 21841 21851 21859 21863 21871 21881 21893 21911 21929 21937 21943 21961 
+21977 21991 21997 22003 22013 22027 22031 22037 22039 22051 22063 22067 22073 22079 
+22091 22093 22109 22111 22123 22129 22133 22147 22153 22157 22159 22171 22189 22193 
+22229 22247 22259 22271 22273 22277 22279 22283 22291 22303 22307 22343 22349 22367 
+22369 22381 22391 22397 22409 22433 22441 22447 22453 22469 22481 22483 22501 22511 
+22531 22541 22543 22549 22567 22571 22573 22613 22619 22621 22637 22639 22643 22651 
+22669 22679 22691 22697 22699 22709 22717 22721 22727 22739 22741 22751 22769 22777 
+22783 22787 22807 22811 22817 22853 22859 22861 22871 22877 22901 22907 22921 22937 
+22943 22961 22963 22973 22993 23003 23011 23017 23021 23027 23029 23039 23041 23053 
+23057 23059 23063 23071 23081 23087 23099 23117 23131 23143 23159 23167 23173 23189 
+23197 23201 23203 23209 23227 23251 23269 23279 23291 23293 23297 23311 23321 23327 
+23333 23339 23357 23369 23371 23399 23417 23431 23447 23459 23473 23497 23509 23531 
+23537 23539 23549 23557 23561 23563 23567 23581 23593 23599 23603 23609 23623 23627 
+23629 23633 23663 23669 23671 23677 23687 23689 23719 23741 23743 23747 23753 23761 
+23767 23773 23789 23801 23813 23819 23827 23831 23833 23857 23869 23873 23879 23887 
+23893 23899 23909 23911 23917 23929 23957 23971 23977 23981 23993 24001 24007 24019 
+24023 24029 24043 24049 24061 24071 24077 24083 24091 24097 24103 24107 24109 24113 
+24121 24133 24137 24151 24169 24179 24181 24197 24203 24223 24229 24239 24247 24251 
+24281 24317 24329 24337 24359 24371 24373 24379 24391 24407 24413 24419 24421 24439 
+24443 24469 24473 24481 24499 24509 24517 24527 24533 24547 24551 24571 24593 24611 
+24623 24631 24659 24671 24677 24683 24691 24697 24709 24733 24749 24763 24767 24781 
+24793 24799 24809 24821 24841 24847 24851 24859 24877 24889 24907 24917 24919 24923 
+24943 24953 24967 24971 24977 24979 24989 25013 25031 25033 25037 25057 25073 25087 
+25097 25111 25117 25121 25127 25147 25153 25163 25169 25171 25183 25189 25219 25229 
+25237 25243 25247 25253 25261 25301 25303 25307 25309 25321 25339 25343 25349 25357 
+25367 25373 25391 25409 25411 25423 25439 25447 25453 25457 25463 25469 25471 25523 
+25537 25541 25561 25577 25579 25583 25589 25601 25603 25609 25621 25633 25639 25643 
+25657 25667 25673 25679 25693 25703 25717 25733 25741 25747 25759 25763 25771 25793 
+25799 25801 25819 25841 25847 25849 25867 25873 25889 25903 25913 25919 25931 25933 
+25939 25943 25951 25969 25981 25997 25999 26003 26017 26021 26029 26041 26053 26083 
+26099 26107 26111 26113 26119 26141 26153 26161 26171 26177 26183 26189 26203 26209 
+26227 26237 26249 26251 26261 26263 26267 26293 26297 26309 26317 26321 26339 26347 
+26357 26371 26387 26393 26399 26407 26417 26423 26431 26437 26449 26459 26479 26489 
+26497 26501 26513 26539 26557 26561 26573 26591 26597 26627 26633 26641 26647 26669 
+26681 26683 26687 26693 26699 26701 26711 26713 26717 26723 26729 26731 26737 26759 
+26777 26783 26801 26813 26821 26833 26839 26849 26861 26863 26879 26881 26891 26893 
+26903 26921 26927 26947 26951 26953 26959 26981 26987 26993 27011 27017 27031 27043 
+27059 27061 27067 27073 27077 27091 27103 27107 27109 27127 27143 27179 27191 27197 
+27211 27239 27241 27253 27259 27271 27277 27281 27283 27299 27329 27337 27361 27367 
+27397 27407 27409 27427 27431 27437 27449 27457 27479 27481 27487 27509 27527 27529 
+27539 27541 27551 27581 27583 27611 27617 27631 27647 27653 27673 27689 27691 27697 
+27701 27733 27737 27739 27743 27749 27751 27763 27767 27773 27779 27791 27793 27799 
+27803 27809 27817 27823 27827 27847 27851 27883 27893 27901 27917 27919 27941 27943 
+27947 27953 27961 27967 27983 27997 28001 28019 28027 28031 28051 28057 28069 28081 
+28087 28097 28099 28109 28111 28123 28151 28163 28181 28183 28201 28211 28219 28229 
+28277 28279 28283 28289 28297 28307 28309 28319 28349 28351 28387 28393 28403 28409 
+28411 28429 28433 28439 28447 28463 28477 28493 28499 28513 28517 28537 28541 28547 
+28549 28559 28571 28573 28579 28591 28597 28603 28607 28619 28621 28627 28631 28643 
+28649 28657 28661 28663 28669 28687 28697 28703 28711 28723 28729 28751 28753 28759 
+28771 28789 28793 28807 28813 28817 28837 28843 28859 28867 28871 28879 28901 28909 
+28921 28927 28933 28949 28961 28979 29009 29017 29021 29023 29027 29033 29059 29063 
+29077 29101 29123 29129 29131 29137 29147 29153 29167 29173 29179 29191 29201 29207 
+29209 29221 29231 29243 29251 29269 29287 29297 29303 29311 29327 29333 29339 29347 
+29363 29383 29387 29389 29399 29401 29411 29423 29429 29437 29443 29453 29473 29483 
+29501 29527 29531 29537 29567 29569 29573 29581 29587 29599 29611 29629 29633 29641 
+29663 29669 29671 29683 29717 29723 29741 29753 29759 29761 29789 29803 29819 29833 
+29837 29851 29863 29867 29873 29879 29881 29917 29921 29927 29947 29959 29983 29989 
+30011 30013 30029 30047 30059 30071 30089 30091 30097 30103 30109 30113 30119 30133 
+30137 30139 30161 30169 30181 30187 30197 30203 30211 30223 30241 30253 30259 30269 
+30271 30293 30307 30313 30319 30323 30341 30347 30367 30389 30391 30403 30427 30431 
+30449 30467 30469 30491 30493 30497 30509 30517 30529 30539 30553 30557 30559 30577 
+30593 30631 30637 30643 30649 30661 30671 30677 30689 30697 30703 30707 30713 30727 
+30757 30763 30773 30781 30803 30809 30817 30829 30839 30841 30851 30853 30859 30869 
+30871 30881 30893 30911 30931 30937 30941 30949 30971 30977 30983 31013 31019 31033 
+31039 31051 31063 31069 31079 31081 31091 31121 31123 31139 31147 31151 31153 31159 
+31177 31181 31183 31189 31193 31219 31223 31231 31237 31247 31249 31253 31259 31267 
+31271 31277 31307 31319 31321 31327 31333 31337 31357 31379 31387 31391 31393 31397 
+31469 31477 31481 31489 31511 31513 31517 31531 31541 31543 31547 31567 31573 31583 
+31601 31607 31627 31643 31649 31657 31663 31667 31687 31699 31721 31723 31727 31729 
+31741 31751 31769 31771 31793 31799 31817 31847 31849 31859 31873 31883 31891 31907 
+31957 31963 31973 31981 31991 32003 32009 32027 32029 32051 32057 32059 32063 32069 
+32077 32083 32089 32099 32117 32119 32141 32143 32159 32173 32183 32189 32191 32203 
+32213 32233 32237 32251 32257 32261 32297 32299 32303 32309 32321 32323 32327 32341 
+32353 32359 32363 32369 32371 32377 32381 32401 32411 32413 32423 32429 32441 32443 
+32467 32479 32491 32497 32503 32507 32531 32533 32537 32561 32563 32569 32573 32579 
+32587 32603 32609 32611 32621 32633 32647 32653 32687 32693 32707 32713 32717 32719 
+32749 32771 32779 32783 32789 32797 32801 32803 32831 32833 32839 32843 32869 32887 
+32909 32911 32917 32933 32939 32941 32957 32969 32971 32983 32987 32993 32999 33013 
+33023 33029 33037 33049 33053 33071 33073 33083 33091 33107 33113 33119 33149 33151 
+33161 33179 33181 33191 33199 33203 33211 33223 33247 33287 33289 33301 33311 33317 
+33329 33331 33343 33347 33349 33353 33359 33377 33391 33403 33409 33413 33427 33457 
+33461 33469 33479 33487 33493 33503 33521 33529 33533 33547 33563 33569 33577 33581 
+33587 33589 33599 33601 33613 33617 33619 33623 33629 33637 33641 33647 33679 33703 
+33713 33721 33739 33749 33751 33757 33767 33769 33773 33791 33797 33809 33811 33827 
+33829 33851 33857 33863 33871 33889 33893 33911 33923 33931 33937 33941 33961 33967 
+33997 34019 34031 34033 34039 34057 34061 34123 34127 34129 34141 34147 34157 34159 
+34171 34183 34211 34213 34217 34231 34253 34259 34261 34267 34273 34283 34297 34301 
+34303 34313 34319 34327 34337 34351 34361 34367 34369 34381 34403 34421 34429 34439 
+34457 34469 34471 34483 34487 34499 34501 34511 34513 34519 34537 34543 34549 34583 
+34589 34591 34603 34607 34613 34631 34649 34651 34667 34673 34679 34687 34693 34703 
+34721 34729 34739 34747 34757 34759 34763 34781 34807 34819 34841 34843 34847 34849 
+34871 34877 34883 34897 34913 34919 34939 34949 34961 34963 34981 35023 35027 35051 
+35053 35059 35069 35081 35083 35089 35099 35107 35111 35117 35129 35141 35149 35153 
+35159 35171 35201 35221 35227 35251 35257 35267 35279 35281 35291 35311 35317 35323 
+35327 35339 35353 35363 35381 35393 35401 35407 35419 35423 35437 35447 35449 35461 
+35491 35507 35509 35521 35527 35531 35533 35537 35543 35569 35573 35591 35593 35597 
+35603 35617 35671 35677 35729 35731 35747 35753 35759 35771 35797 35801 35803 35809 
+35831 35837 35839 35851 35863 35869 35879 35897 35899 35911 35923 35933 35951 35963 
+35969 35977 35983 35993 35999 36007 36011 36013 36017 36037 36061 36067 36073 36083 
+36097 36107 36109 36131 36137 36151 36161 36187 36191 36209 36217 36229 36241 36251 
+36263 36269 36277 36293 36299 36307 36313 36319 36341 36343 36353 36373 36383 36389 
+36433 36451 36457 36467 36469 36473 36479 36493 36497 36523 36527 36529 36541 36551 
+36559 36563 36571 36583 36587 36599 36607 36629 36637 36643 36653 36671 36677 36683 
+36691 36697 36709 36713 36721 36739 36749 36761 36767 36779 36781 36787 36791 36793 
+36809 36821 36833 36847 36857 36871 36877 36887 36899 36901 36913 36919 36923 36929 
+36931 36943 36947 36973 36979 36997 37003 37013 37019 37021 37039 37049 37057 37061 
+37087 37097 37117 37123 37139 37159 37171 37181 37189 37199 37201 37217 37223 37243 
+37253 37273 37277 37307 37309 37313 37321 37337 37339 37357 37361 37363 37369 37379 
+37397 37409 37423 37441 37447 37463 37483 37489 37493 37501 37507 37511 37517 37529 
+37537 37547 37549 37561 37567 37571 37573 37579 37589 37591 37607 37619 37633 37643 
+37649 37657 37663 37691 37693 37699 37717 37747 37781 37783 37799 37811 37813 37831 
+37847 37853 37861 37871 37879 37889 37897 37907 37951 37957 37963 37967 37987 37991 
+37993 37997 38011 38039 38047 38053 38069 38083 38113 38119 38149 38153 38167 38177 
+38183 38189 38197 38201 38219 38231 38237 38239 38261 38273 38281 38287 38299 38303 
+38317 38321 38327 38329 38333 38351 38371 38377 38393 38431 38447 38449 38453 38459 
+38461 38501 38543 38557 38561 38567 38569 38593 38603 38609 38611 38629 38639 38651 
+38653 38669 38671 38677 38693 38699 38707 38711 38713 38723 38729 38737 38747 38749 
+38767 38783 38791 38803 38821 38833 38839 38851 38861 38867 38873 38891 38903 38917 
+38921 38923 38933 38953 38959 38971 38977 38993 39019 39023 39041 39043 39047 39079 
+39089 39097 39103 39107 39113 39119 39133 39139 39157 39161 39163 39181 39191 39199 
+39209 39217 39227 39229 39233 39239 39241 39251 39293 39301 39313 39317 39323 39341 
+39343 39359 39367 39371 39373 39383 39397 39409 39419 39439 39443 39451 39461 39499 
+39503 39509 39511 39521 39541 39551 39563 39569 39581 39607 39619 39623 39631 39659 
+39667 39671 39679 39703 39709 39719 39727 39733 39749 39761 39769 39779 39791 39799 
+39821 39827 39829 39839 39841 39847 39857 39863 39869 39877 39883 39887 39901 39929 
+39937 39953 39971 39979 39983 39989 40009 40013 40031 40037 40039 40063 40087 40093 
+40099 40111 40123 40127 40129 40151 40153 40163 40169 40177 40189 40193 40213 40231 
+40237 40241 40253 40277 40283 40289 40343 40351 40357 40361 40387 40423 40427 40429 
+40433 40459 40471 40483 40487 40493 40499 40507 40519 40529 40531 40543 40559 40577 
+40583 40591 40597 40609 40627 40637 40639 40693 40697 40699 40709 40739 40751 40759 
+40763 40771 40787 40801 40813 40819 40823 40829 40841 40847 40849 40853 40867 40879 
+40883 40897 40903 40927 40933 40939 40949 40961 40973 40993 41011 41017 41023 41039 
+41047 41051 41057 41077 41081 41113 41117 41131 41141 41143 41149 41161 41177 41179 
+41183 41189 41201 41203 41213 41221 41227 41231 41233 41243 41257 41263 41269 41281 
+41299 41333 41341 41351 41357 41381 41387 41389 41399 41411 41413 41443 41453 41467 
+41479 41491 41507 41513 41519 41521 41539 41543 41549 41579 41593 41597 41603 41609 
+41611 41617 41621 41627 41641 41647 41651 41659 41669 41681 41687 41719 41729 41737 
+41759 41761 41771 41777 41801 41809 41813 41843 41849 41851 41863 41879 41887 41893 
+41897 41903 41911 41927 41941 41947 41953 41957 41959 41969 41981 41983 41999 42013 
+42017 42019 42023 42043 42061 42071 42073 42083 42089 42101 42131 42139 42157 42169 
+42179 42181 42187 42193 42197 42209 42221 42223 42227 42239 42257 42281 42283 42293 
+42299 42307 42323 42331 42337 42349 42359 42373 42379 42391 42397 42403 42407 42409 
+42433 42437 42443 42451 42457 42461 42463 42467 42473 42487 42491 42499 42509 42533 
+42557 42569 42571 42577 42589 42611 42641 42643 42649 42667 42677 42683 42689 42697 
+42701 42703 42709 42719 42727 42737 42743 42751 42767 42773 42787 42793 42797 42821 
+42829 42839 42841 42853 42859 42863 42899 42901 42923 42929 42937 42943 42953 42961 
+42967 42979 42989 43003 43013 43019 43037 43049 43051 43063 43067 43093 43103 43117 
+43133 43151 43159 43177 43189 43201 43207 43223 43237 43261 43271 43283 43291 43313 
+43319 43321 43331 43391 43397 43399 43403 43411 43427 43441 43451 43457 43481 43487 
+43499 43517 43541 43543 43573 43577 43579 43591 43597 43607 43609 43613 43627 43633 
+43649 43651 43661 43669 43691 43711 43717 43721 43753 43759 43777 43781 43783 43787 
+43789 43793 43801 43853 43867 43889 43891 43913 43933 43943 43951 43961 43963 43969 
+43973 43987 43991 43997 44017 44021 44027 44029 44041 44053 44059 44071 44087 44089 
+44101 44111 44119 44123 44129 44131 44159 44171 44179 44189 44201 44203 44207 44221 
+44249 44257 44263 44267 44269 44273 44279 44281 44293 44351 44357 44371 44381 44383 
+44389 44417 44449 44453 44483 44491 44497 44501 44507 44519 44531 44533 44537 44543 
+44549 44563 44579 44587 44617 44621 44623 44633 44641 44647 44651 44657 44683 44687 
+44699 44701 44711 44729 44741 44753 44771 44773 44777 44789 44797 44809 44819 44839 
+44843 44851 44867 44879 44887 44893 44909 44917 44927 44939 44953 44959 44963 44971 
+44983 44987 45007 45013 45053 45061 45077 45083 45119 45121 45127 45131 45137 45139 
+45161 45179 45181 45191 45197 45233 45247 45259 45263 45281 45289 45293 45307 45317 
+45319 45329 45337 45341 45343 45361 45377 45389 45403 45413 45427 45433 45439 45481 
+45491 45497 45503 45523 45533 45541 45553 45557 45569 45587 45589 45599 45613 45631 
+45641 45659 45667 45673 45677 45691 45697 45707 45737 45751 45757 45763 45767 45779 
+45817 45821 45823 45827 45833 45841 45853 45863 45869 45887 45893 45943 45949 45953 
+45959 45971 45979 45989 46021 46027 46049 46051 46061 46073 46091 46093 46099 46103 
+46133 46141 46147 46153 46171 46181 46183 46187 46199 46219 46229 46237 46261 46271 
+46273 46279 46301 46307 46309 46327 46337 46349 46351 46381 46399 46411 46439 46441 
+46447 46451 46457 46471 46477 46489 46499 46507 46511 46523 46549 46559 46567 46573 
+46589 46591 46601 46619 46633 46639 46643 46649 46663 46679 46681 46687 46691 46703 
+46723 46727 46747 46751 46757 46769 46771 46807 46811 46817 46819 46829 46831 46853 
+46861 46867 46877 46889 46901 46919 46933 46957 46993 46997 47017 47041 47051 47057 
+47059 47087 47093 47111 47119 47123 47129 47137 47143 47147 47149 47161 47189 47207 
+47221 47237 47251 47269 47279 47287 47293 47297 47303 47309 47317 47339 47351 47353 
+47363 47381 47387 47389 47407 47417 47419 47431 47441 47459 47491 47497 47501 47507 
+47513 47521 47527 47533 47543 47563 47569 47581 47591 47599 47609 47623 47629 47639 
+47653 47657 47659 47681 47699 47701 47711 47713 47717 47737 47741 47743 47777 47779 
+47791 47797 47807 47809 47819 47837 47843 47857 47869 47881 47903 47911 47917 47933 
+47939 47947 47951 47963 47969 47977 47981 48017 48023 48029 48049 48073 48079 48091 
+48109 48119 48121 48131 48157 48163 48179 48187 48193 48197 48221 48239 48247 48259 
+48271 48281 48299 48311 48313 48337 48341 48353 48371 48383 48397 48407 48409 48413 
+48437 48449 48463 48473 48479 48481 48487 48491 48497 48523 48527 48533 48539 48541 
+48563 48571 48589 48593 48611 48619 48623 48647 48649 48661 48673 48677 48679 48731 
+48733 48751 48757 48761 48767 48779 48781 48787 48799 48809 48817 48821 48823 48847 
+48857 48859 48869 48871 48883 48889 48907 48947 48953 48973 48989 48991 49003 49009 
+49019 49031 49033 49037 49043 49057 49069 49081 49103 49109 49117 49121 49123 49139 
+49157 49169 49171 49177 49193 49199 49201 49207 49211 49223 49253 49261 49277 49279 
+49297 49307 49331 49333 49339 49363 49367 49369 49391 49393 49409 49411 49417 49429 
+49433 49451 49459 49463 49477 49481 49499 49523 49529 49531 49537 49547 49549 49559 
+49597 49603 49613 49627 49633 49639 49663 49667 49669 49681 49697 49711 49727 49739 
+49741 49747 49757 49783 49787 49789 49801 49807 49811 49823 49831 49843 49853 49871 
+49877 49891 49919 49921 49927 49937 49939 49943 49957 49991 49993 49999 50021 50023 
+50033 50047 50051 50053 50069 50077 50087 50093 50101 50111 50119 50123 50129 50131 
+50147 50153 50159 50177 50207 50221 50227 50231 50261 50263 50273 50287 50291 50311 
+50321 50329 50333 50341 50359 50363 50377 50383 50387 50411 50417 50423 50441 50459 
+50461 50497 50503 50513 50527 50539 50543 50549 50551 50581 50587 50591 50593 50599 
+50627 50647 50651 50671 50683 50707 50723 50741 50753 50767 50773 50777 50789 50821 
+50833 50839 50849 50857 50867 50873 50891 50893 50909 50923 50929 50951 50957 50969 
+50971 50989 50993 51001 51031 51043 51047 51059 51061 51071 51109 51131 51133 51137 
+51151 51157 51169 51193 51197 51199 51203 51217 51229 51239 51241 51257 51263 51283 
+51287 51307 51329 51341 51343 51347 51349 51361 51383 51407 51413 51419 51421 51427 
+51431 51437 51439 51449 51461 51473 51479 51481 51487 51503 51511 51517 51521 51539 
+51551 51563 51577 51581 51593 51599 51607 51613 51631 51637 51647 51659 51673 51679 
+51683 51691 51713 51719 51721 51749 51767 51769 51787 51797 51803 51817 51827 51829 
+51839 51853 51859 51869 51871 51893 51899 51907 51913 51929 51941 51949 51971 51973 
+51977 51991 52009 52021 52027 52051 52057 52067 52069 52081 52103 52121 52127 52147 
+52153 52163 52177 52181 52183 52189 52201 52223 52237 52249 52253 52259 52267 52289 
+52291 52301 52313 52321 52361 52363 52369 52379 52387 52391 52433 52453 52457 52489 
+52501 52511 52517 52529 52541 52543 52553 52561 52567 52571 52579 52583 52609 52627 
+52631 52639 52667 52673 52691 52697 52709 52711 52721 52727 52733 52747 52757 52769 
+52783 52807 52813 52817 52837 52859 52861 52879 52883 52889 52901 52903 52919 52937 
+52951 52957 52963 52967 52973 52981 52999 53003 53017 53047 53051 53069 53077 53087 
+53089 53093 53101 53113 53117 53129 53147 53149 53161 53171 53173 53189 53197 53201 
+53231 53233 53239 53267 53269 53279 53281 53299 53309 53323 53327 53353 53359 53377 
+53381 53401 53407 53411 53419 53437 53441 53453 53479 53503 53507 53527 53549 53551 
+53569 53591 53593 53597 53609 53611 53617 53623 53629 53633 53639 53653 53657 53681 
+53693 53699 53717 53719 53731 53759 53773 53777 53783 53791 53813 53819 53831 53849 
+53857 53861 53881 53887 53891 53897 53899 53917 53923 53927 53939 53951 53959 53987 
+53993 54001 54011 54013 54037 54049 54059 54083 54091 54101 54121 54133 54139 54151 
+54163 54167 54181 54193 54217 54251 54269 54277 54287 54293 54311 54319 54323 54331 
+54347 54361 54367 54371 54377 54401 54403 54409 54413 54419 54421 54437 54443 54449 
+54469 54493 54497 54499 54503 54517 54521 54539 54541 54547 54559 54563 54577 54581 
+54583 54601 54617 54623 54629 54631 54647 54667 54673 54679 54709 54713 54721 54727 
+54751 54767 54773 54779 54787 54799 54829 54833 54851 54869 54877 54881 54907 54917 
+54919 54941 54949 54959 54973 54979 54983 55001 55009 55021 55049 55051 55057 55061 
+55073 55079 55103 55109 55117 55127 55147 55163 55171 55201 55207 55213 55217 55219 
+55229 55243 55249 55259 55291 55313 55331 55333 55337 55339 55343 55351 55373 55381 
+55399 55411 55439 55441 55457 55469 55487 55501 55511 55529 55541 55547 55579 55589 
+55603 55609 55619 55621 55631 55633 55639 55661 55663 55667 55673 55681 55691 55697 
+55711 55717 55721 55733 55763 55787 55793 55799 55807 55813 55817 55819 55823 55829 
+55837 55843 55849 55871 55889 55897 55901 55903 55921 55927 55931 55933 55949 55967 
+55987 55997 56003 56009 56039 56041 56053 56081 56087 56093 56099 56101 56113 56123 
+56131 56149 56167 56171 56179 56197 56207 56209 56237 56239 56249 56263 56267 56269 
+56299 56311 56333 56359 56369 56377 56383 56393 56401 56417 56431 56437 56443 56453 
+56467 56473 56477 56479 56489 56501 56503 56509 56519 56527 56531 56533 56543 56569 
+56591 56597 56599 56611 56629 56633 56659 56663 56671 56681 56687 56701 56711 56713 
+56731 56737 56747 56767 56773 56779 56783 56807 56809 56813 56821 56827 56843 56857 
+56873 56891 56893 56897 56909 56911 56921 56923 56929 56941 56951 56957 56963 56983 
+56989 56993 56999 57037 57041 57047 57059 57073 57077 57089 57097 57107 57119 57131 
+57139 57143 57149 57163 57173 57179 57191 57193 57203 57221 57223 57241 57251 57259 
+57269 57271 57283 57287 57301 57329 57331 57347 57349 57367 57373 57383 57389 57397 
+57413 57427 57457 57467 57487 57493 57503 57527 57529 57557 57559 57571 57587 57593 
+57601 57637 57641 57649 57653 57667 57679 57689 57697 57709 57713 57719 57727 57731 
+57737 57751 57773 57781 57787 57791 57793 57803 57809 57829 57839 57847 57853 57859 
+57881 57899 57901 57917 57923 57943 57947 57973 57977 57991 58013 58027 58031 58043 
+58049 58057 58061 58067 58073 58099 58109 58111 58129 58147 58151 58153 58169 58171 
+58189 58193 58199 58207 58211 58217 58229 58231 58237 58243 58271 58309 58313 58321 
+58337 58363 58367 58369 58379 58391 58393 58403 58411 58417 58427 58439 58441 58451 
+58453 58477 58481 58511 58537 58543 58549 58567 58573 58579 58601 58603 58613 58631 
+58657 58661 58679 58687 58693 58699 58711 58727 58733 58741 58757 58763 58771 58787 
+58789 58831 58889 58897 58901 58907 58909 58913 58921 58937 58943 58963 58967 58979 
+58991 58997 59009 59011 59021 59023 59029 59051 59053 59063 59069 59077 59083 59093 
+59107 59113 59119 59123 59141 59149 59159 59167 59183 59197 59207 59209 59219 59221 
+59233 59239 59243 59263 59273 59281 59333 59341 59351 59357 59359 59369 59377 59387 
+59393 59399 59407 59417 59419 59441 59443 59447 59453 59467 59471 59473 59497 59509 
+59513 59539 59557 59561 59567 59581 59611 59617 59621 59627 59629 59651 59659 59663 
+59669 59671 59693 59699 59707 59723 59729 59743 59747 59753 59771 59779 59791 59797 
+59809 59833 59863 59879 59887 59921 59929 59951 59957 59971 59981 59999 60013 60017 
+60029 60037 60041 60077 60083 60089 60091 60101 60103 60107 60127 60133 60139 60149 
+60161 60167 60169 60209 60217 60223 60251 60257 60259 60271 60289 60293 60317 60331 
+60337 60343 60353 60373 60383 60397 60413 60427 60443 60449 60457 60493 60497 60509 
+60521 60527 60539 60589 60601 60607 60611 60617 60623 60631 60637 60647 60649 60659 
+60661 60679 60689 60703 60719 60727 60733 60737 60757 60761 60763 60773 60779 60793 
+60811 60821 60859 60869 60887 60889 60899 60901 60913 60917 60919 60923 60937 60943 
+60953 60961 61001 61007 61027 61031 61043 61051 61057 61091 61099 61121 61129 61141 
+61151 61153 61169 61211 61223 61231 61253 61261 61283 61291 61297 61331 61333 61339 
+61343 61357 61363 61379 61381 61403 61409 61417 61441 61463 61469 61471 61483 61487 
+61493 61507 61511 61519 61543 61547 61553 61559 61561 61583 61603 61609 61613 61627 
+61631 61637 61643 61651 61657 61667 61673 61681 61687 61703 61717 61723 61729 61751 
+61757 61781 61813 61819 61837 61843 61861 61871 61879 61909 61927 61933 61949 61961 
+61967 61979 61981 61987 61991 62003 62011 62017 62039 62047 62053 62057 62071 62081 
+62099 62119 62129 62131 62137 62141 62143 62171 62189 62191 62201 62207 62213 62219 
+62233 62273 62297 62299 62303 62311 62323 62327 62347 62351 62383 62401 62417 62423 
+62459 62467 62473 62477 62483 62497 62501 62507 62533 62539 62549 62563 62581 62591 
+62597 62603 62617 62627 62633 62639 62653 62659 62683 62687 62701 62723 62731 62743 
+62753 62761 62773 62791 62801 62819 62827 62851 62861 62869 62873 62897 62903 62921 
+62927 62929 62939 62969 62971 62981 62983 62987 62989 63029 63031 63059 63067 63073 
+63079 63097 63103 63113 63127 63131 63149 63179 63197 63199 63211 63241 63247 63277 
+63281 63299 63311 63313 63317 63331 63337 63347 63353 63361 63367 63377 63389 63391 
+63397 63409 63419 63421 63439 63443 63463 63467 63473 63487 63493 63499 63521 63527 
+63533 63541 63559 63577 63587 63589 63599 63601 63607 63611 63617 63629 63647 63649 
+63659 63667 63671 63689 63691 63697 63703 63709 63719 63727 63737 63743 63761 63773 
+63781 63793 63799 63803 63809 63823 63839 63841 63853 63857 63863 63901 63907 63913 
+63929 63949 63977 63997 64007 64013 64019 64033 64037 64063 64067 64081 64091 64109 
+64123 64151 64153 64157 64171 64187 64189 64217 64223 64231 64237 64271 64279 64283 
+64301 64303 64319 64327 64333 64373 64381 64399 64403 64433 64439 64451 64453 64483 
+64489 64499 64513 64553 64567 64577 64579 64591 64601 64609 64613 64621 64627 64633 
+64661 64663 64667 64679 64693 64709 64717 64747 64763 64781 64783 64793 64811 64817 
+64849 64853 64871 64877 64879 64891 64901 64919 64921 64927 64937 64951 64969 64997 
+65003 65011 65027 65029 65033 65053 65063 65071 65089 65099 65101 65111 65119 65123 
+65129 65141 65147 65167 65171 65173 65179 65183 65203 65213 65239 65257 65267 65269 
+65287 65293 65309 65323 65327 65353 65357 65371 65381 65393 65407 65413 65419 65423 
+65437 65447 65449 65479 65497 65519 65521 65537 65539 65543 65551 65557 65563 65579 
+65581 65587 65599 65609 65617 65629 65633 65647 65651 65657 65677 65687 65699 65701 
+65707 65713 65717 65719 65729 65731 65761 65777 65789 65809 65827 65831 65837 65839 
+65843 65851 65867 65881 65899 65921 65927 65929 65951 65957 65963 65981 65983 65993 
+66029 66037 66041 66047 66067 66071 66083 66089 66103 66107 66109 66137 66161 66169 
+66173 66179 66191 66221 66239 66271 66293 66301 66337 66343 66347 66359 66361 66373 
+66377 66383 66403 66413 66431 66449 66457 66463 66467 66491 66499 66509 66523 66529 
+66533 66541 66553 66569 66571 66587 66593 66601 66617 66629 66643 66653 66683 66697 
+66701 66713 66721 66733 66739 66749 66751 66763 66791 66797 66809 66821 66841 66851 
+66853 66863 66877 66883 66889 66919 66923 66931 66943 66947 66949 66959 66973 66977 
+67003 67021 67033 67043 67049 67057 67061 67073 67079 67103 67121 67129 67139 67141 
+67153 67157 67169 67181 67187 67189 67211 67213 67217 67219 67231 67247 67261 67271 
+67273 67289 67307 67339 67343 67349 67369 67391 67399 67409 67411 67421 67427 67429 
+67433 67447 67453 67477 67481 67489 67493 67499 67511 67523 67531 67537 67547 67559 
+67567 67577 67579 67589 67601 67607 67619 67631 67651 67679 67699 67709 67723 67733 
+67741 67751 67757 67759 67763 67777 67783 67789 67801 67807 67819 67829 67843 67853 
+67867 67883 67891 67901 67927 67931 67933 67939 67943 67957 67961 67967 67979 67987 
+67993 68023 68041 68053 68059 68071 68087 68099 68111 68113 68141 68147 68161 68171 
+68207 68209 68213 68219 68227 68239 68261 68279 68281 68311 68329 68351 68371 68389 
+68399 68437 68443 68447 68449 68473 68477 68483 68489 68491 68501 68507 68521 68531 
+68539 68543 68567 68581 68597 68611 68633 68639 68659 68669 68683 68687 68699 68711 
+68713 68729 68737 68743 68749 68767 68771 68777 68791 68813 68819 68821 68863 68879 
+68881 68891 68897 68899 68903 68909 68917 68927 68947 68963 68993 69001 69011 69019 
+69029 69031 69061 69067 69073 69109 69119 69127 69143 69149 69151 69163 69191 69193 
+69197 69203 69221 69233 69239 69247 69257 69259 69263 69313 69317 69337 69341 69371 
+69379 69383 69389 69401 69403 69427 69431 69439 69457 69463 69467 69473 69481 69491 
+69493 69497 69499 69539 69557 69593 69623 69653 69661 69677 69691 69697 69709 69737 
+69739 69761 69763 69767 69779 69809 69821 69827 69829 69833 69847 69857 69859 69877 
+69899 69911 69929 69931 69941 69959 69991 69997 70001 70003 70009 70019 70039 70051 
+70061 70067 70079 70099 70111 70117 70121 70123 70139 70141 70157 70163 70177 70181 
+70183 70199 70201 70207 70223 70229 70237 70241 70249 70271 70289 70297 70309 70313 
+70321 70327 70351 70373 70379 70381 70393 70423 70429 70439 70451 70457 70459 70481 
+70487 70489 70501 70507 70529 70537 70549 70571 70573 70583 70589 70607 70619 70621 
+70627 70639 70657 70663 70667 70687 70709 70717 70729 70753 70769 70783 70793 70823 
+70841 70843 70849 70853 70867 70877 70879 70891 70901 70913 70919 70921 70937 70949 
+70951 70957 70969 70979 70981 70991 70997 70999 71011 71023 71039 71059 71069 71081 
+71089 71119 71129 71143 71147 71153 71161 71167 71171 71191 71209 71233 71237 71249 
+71257 71261 71263 71287 71293 71317 71327 71329 71333 71339 71341 71347 71353 71359 
+71363 71387 71389 71399 71411 71413 71419 71429 71437 71443 71453 71471 71473 71479 
+71483 71503 71527 71537 71549 71551 71563 71569 71593 71597 71633 71647 71663 71671 
+71693 71699 71707 71711 71713 71719 71741 71761 71777 71789 71807 71809 71821 71837 
+71843 71849 71861 71867 71879 71881 71887 71899 71909 71917 71933 71941 71947 71963 
+71971 71983 71987 71993 71999 72019 72031 72043 72047 72053 72073 72077 72089 72091 
+72101 72103 72109 72139 72161 72167 72169 72173 72211 72221 72223 72227 72229 72251 
+72253 72269 72271 72277 72287 72307 72313 72337 72341 72353 72367 72379 72383 72421 
+72431 72461 72467 72469 72481 72493 72497 72503 72533 72547 72551 72559 72577 72613 
+72617 72623 72643 72647 72649 72661 72671 72673 72679 72689 72701 72707 72719 72727 
+72733 72739 72763 72767 72797 72817 72823 72859 72869 72871 72883 72889 72893 72901 
+72907 72911 72923 72931 72937 72949 72953 72959 72973 72977 72997 73009 73013 73019 
+73037 73039 73043 73061 73063 73079 73091 73121 73127 73133 73141 73181 73189 73237 
+73243 73259 73277 73291 73303 73309 73327 73331 73351 73361 73363 73369 73379 73387 
+73417 73421 73433 73453 73459 73471 73477 73483 73517 73523 73529 73547 73553 73561 
+73571 73583 73589 73597 73607 73609 73613 73637 73643 73651 73673 73679 73681 73693 
+73699 73709 73721 73727 73751 73757 73771 73783 73819 73823 73847 73849 73859 73867 
+73877 73883 73897 73907 73939 73943 73951 73961 73973 73999 74017 74021 74027 74047 
+74051 74071 74077 74093 74099 74101 74131 74143 74149 74159 74161 74167 74177 74189 
+74197 74201 74203 74209 74219 74231 74257 74279 74287 74293 74297 74311 74317 74323 
+74353 74357 74363 74377 74381 74383 74411 74413 74419 74441 74449 74453 74471 74489 
+74507 74509 74521 74527 74531 74551 74561 74567 74573 74587 74597 74609 74611 74623 
+74653 74687 74699 74707 74713 74717 74719 74729 74731 74747 74759 74761 74771 74779 
+74797 74821 74827 74831 74843 74857 74861 74869 74873 74887 74891 74897 74903 74923 
+74929 74933 74941 74959 75011 75013 75017 75029 75037 75041 75079 75083 75109 75133 
+75149 75161 75167 75169 75181 75193 75209 75211 75217 75223 75227 75239 75253 75269 
+75277 75289 75307 75323 75329 75337 75347 75353 75367 75377 75389 75391 75401 75403 
+75407 75431 75437 75479 75503 75511 75521 75527 75533 75539 75541 75553 75557 75571 
+75577 75583 75611 75617 75619 75629 75641 75653 75659 75679 75683 75689 75703 75707 
+75709 75721 75731 75743 75767 75773 75781 75787 75793 75797 75821 75833 75853 75869 
+75883 75913 75931 75937 75941 75967 75979 75983 75989 75991 75997 76001 76003 76031 
+76039 76079 76081 76091 76099 76103 76123 76129 76147 76157 76159 76163 76207 76213 
+76231 76243 76249 76253 76259 76261 76283 76289 76303 76333 76343 76367 76369 76379 
+76387 76403 76421 76423 76441 76463 76471 76481 76487 76493 76507 76511 76519 76537 
+76541 76543 76561 76579 76597 76603 76607 76631 76649 76651 76667 76673 76679 76697 
+76717 76733 76753 76757 76771 76777 76781 76801 76819 76829 76831 76837 76847 76871 
+76873 76883 76907 76913 76919 76943 76949 76961 76963 76991 77003 77017 77023 77029 
+77041 77047 77069 77081 77093 77101 77137 77141 77153 77167 77171 77191 77201 77213 
+77237 77239 77243 77249 77261 77263 77267 77269 77279 77291 77317 77323 77339 77347 
+77351 77359 77369 77377 77383 77417 77419 77431 77447 77471 77477 77479 77489 77491 
+77509 77513 77521 77527 77543 77549 77551 77557 77563 77569 77573 77587 77591 77611 
+77617 77621 77641 77647 77659 77681 77687 77689 77699 77711 77713 77719 77723 77731 
+77743 77747 77761 77773 77783 77797 77801 77813 77839 77849 77863 77867 77893 77899 
+77929 77933 77951 77969 77977 77983 77999 78007 78017 78031 78041 78049 78059 78079 
+78101 78121 78137 78139 78157 78163 78167 78173 78179 78191 78193 78203 78229 78233 
+78241 78259 78277 78283 78301 78307 78311 78317 78341 78347 78367 78401 78427 78437 
+78439 78467 78479 78487 78497 78509 78511 78517 78539 78541 78553 78569 78571 78577 
+78583 78593 78607 78623 78643 78649 78653 78691 78697 78707 78713 78721 78737 78779 
+78781 78787 78791 78797 78803 78809 78823 78839 78853 78857 78877 78887 78889 78893 
+78901 78919 78929 78941 78977 78979 78989 79031 79039 79043 79063 79087 79103 79111 
+79133 79139 79147 79151 79153 79159 79181 79187 79193 79201 79229 79231 79241 79259 
+79273 79279 79283 79301 79309 79319 79333 79337 79349 79357 79367 79379 79393 79397 
+79399 79411 79423 79427 79433 79451 79481 79493 79531 79537 79549 79559 79561 79579 
+79589 79601 79609 79613 79621 79627 79631 79633 79657 79669 79687 79691 79693 79697 
+79699 79757 79769 79777 79801 79811 79813 79817 79823 79829 79841 79843 79847 79861 
+79867 79873 79889 79901 79903 79907 79939 79943 79967 79973 79979 79987 79997 79999 
+80021 80039 80051 80071 80077 80107 80111 80141 80147 80149 80153 80167 80173 80177 
+80191 80207 80209 80221 80231 80233 80239 80251 80263 80273 80279 80287 80309 80317 
+80329 80341 80347 80363 80369 80387 80407 80429 80447 80449 80471 80473 80489 80491 
+80513 80527 80537 80557 80567 80599 80603 80611 80621 80627 80629 80651 80657 80669 
+80671 80677 80681 80683 80687 80701 80713 80737 80747 80749 80761 80777 80779 80783 
+80789 80803 80809 80819 80831 80833 80849 80863 80897 80909 80911 80917 80923 80929 
+80933 80953 80963 80989 81001 81013 81017 81019 81023 81031 81041 81043 81047 81049 
+81071 81077 81083 81097 81101 81119 81131 81157 81163 81173 81181 81197 81199 81203 
+81223 81233 81239 81281 81283 81293 81299 81307 81331 81343 81349 81353 81359 81371 
+81373 81401 81409 81421 81439 81457 81463 81509 81517 81527 81533 81547 81551 81553 
+81559 81563 81569 81611 81619 81629 81637 81647 81649 81667 81671 81677 81689 81701 
+81703 81707 81727 81737 81749 81761 81769 81773 81799 81817 81839 81847 81853 81869 
+81883 81899 81901 81919 81929 81931 81937 81943 81953 81967 81971 81973 82003 82007 
+82009 82013 82021 82031 82037 82039 82051 82067 82073 82129 82139 82141 82153 82163 
+82171 82183 82189 82193 82207 82217 82219 82223 82231 82237 82241 82261 82267 82279 
+82301 82307 82339 82349 82351 82361 82373 82387 82393 82421 82457 82463 82469 82471 
+82483 82487 82493 82499 82507 82529 82531 82549 82559 82561 82567 82571 82591 82601 
+82609 82613 82619 82633 82651 82657 82699 82721 82723 82727 82729 82757 82759 82763 
+82781 82787 82793 82799 82811 82813 82837 82847 82883 82889 82891 82903 82913 82939 
+82963 82981 82997 83003 83009 83023 83047 83059 83063 83071 83077 83089 83093 83101 
+83117 83137 83177 83203 83207 83219 83221 83227 83231 83233 83243 83257 83267 83269 
+83273 83299 83311 83339 83341 83357 83383 83389 83399 83401 83407 83417 83423 83431 
+83437 83443 83449 83459 83471 83477 83497 83537 83557 83561 83563 83579 83591 83597 
+83609 83617 83621 83639 83641 83653 83663 83689 83701 83717 83719 83737 83761 83773 
+83777 83791 83813 83833 83843 83857 83869 83873 83891 83903 83911 83921 83933 83939 
+83969 83983 83987 84011 84017 84047 84053 84059 84061 84067 84089 84121 84127 84131 
+84137 84143 84163 84179 84181 84191 84199 84211 84221 84223 84229 84239 84247 84263 
+84299 84307 84313 84317 84319 84347 84349 84377 84389 84391 84401 84407 84421 84431 
+84437 84443 84449 84457 84463 84467 84481 84499 84503 84509 84521 84523 84533 84551 
+84559 84589 84629 84631 84649 84653 84659 84673 84691 84697 84701 84713 84719 84731 
+84737 84751 84761 84787 84793 84809 84811 84827 84857 84859 84869 84871 84913 84919 
+84947 84961 84967 84977 84979 84991 85009 85021 85027 85037 85049 85061 85081 85087 
+85091 85093 85103 85109 85121 85133 85147 85159 85193 85199 85201 85213 85223 85229 
+85237 85243 85247 85259 85297 85303 85313 85331 85333 85361 85363 85369 85381 85411 
+85427 85429 85439 85447 85451 85453 85469 85487 85513 85517 85523 85531 85549 85571 
+85577 85597 85601 85607 85619 85621 85627 85639 85643 85661 85667 85669 85691 85703 
+85711 85717 85733 85751 85781 85793 85817 85819 85829 85831 85837 85843 85847 85853 
+85889 85903 85909 85931 85933 85991 85999 86011 86017 86027 86029 86069 86077 86083 
+86111 86113 86117 86131 86137 86143 86161 86171 86179 86183 86197 86201 86209 86239 
+86243 86249 86257 86263 86269 86287 86291 86293 86297 86311 86323 86341 86351 86353 
+86357 86369 86371 86381 86389 86399 86413 86423 86441 86453 86461 86467 86477 86491 
+86501 86509 86531 86533 86539 86561 86573 86579 86587 86599 86627 86629 86677 86689 
+86693 86711 86719 86729 86743 86753 86767 86771 86783 86813 86837 86843 86851 86857 
+86861 86869 86923 86927 86929 86939 86951 86959 86969 86981 86993 87011 87013 87037 
+87041 87049 87071 87083 87103 87107 87119 87121 87133 87149 87151 87179 87181 87187 
+87211 87221 87223 87251 87253 87257 87277 87281 87293 87299 87313 87317 87323 87337 
+87359 87383 87403 87407 87421 87427 87433 87443 87473 87481 87491 87509 87511 87517 
+87523 87539 87541 87547 87553 87557 87559 87583 87587 87589 87613 87623 87629 87631 
+87641 87643 87649 87671 87679 87683 87691 87697 87701 87719 87721 87739 87743 87751 
+87767 87793 87797 87803 87811 87833 87853 87869 87877 87881 87887 87911 87917 87931 
+87943 87959 87961 87973 87977 87991 88001 88003 88007 88019 88037 88069 88079 88093 
+88117 88129 88169 88177 88211 88223 88237 88241 88259 88261 88289 88301 88321 88327 
+88337 88339 88379 88397 88411 88423 88427 88463 88469 88471 88493 88499 88513 88523 
+88547 88589 88591 88607 88609 88643 88651 88657 88661 88663 88667 88681 88721 88729 
+88741 88747 88771 88789 88793 88799 88801 88807 88811 88813 88817 88819 88843 88853 
+88861 88867 88873 88883 88897 88903 88919 88937 88951 88969 88993 88997 89003 89009 
+89017 89021 89041 89051 89057 89069 89071 89083 89087 89101 89107 89113 89119 89123 
+89137 89153 89189 89203 89209 89213 89227 89231 89237 89261 89269 89273 89293 89303 
+89317 89329 89363 89371 89381 89387 89393 89399 89413 89417 89431 89443 89449 89459 
+89477 89491 89501 89513 89519 89521 89527 89533 89561 89563 89567 89591 89597 89599 
+89603 89611 89627 89633 89653 89657 89659 89669 89671 89681 89689 89753 89759 89767 
+89779 89783 89797 89809 89819 89821 89833 89839 89849 89867 89891 89897 89899 89909 
+89917 89923 89939 89959 89963 89977 89983 89989 90001 90007 90011 90017 90019 90023 
+90031 90053 90059 90067 90071 90073 90089 90107 90121 90127 90149 90163 90173 90187 
+90191 90197 90199 90203 90217 90227 90239 90247 90263 90271 90281 90289 90313 90353 
+90359 90371 90373 90379 90397 90401 90403 90407 90437 90439 90469 90473 90481 90499 
+90511 90523 90527 90529 90533 90547 90583 90599 90617 90619 90631 90641 90647 90659 
+90677 90679 90697 90703 90709 90731 90749 90787 90793 90803 90821 90823 90833 90841 
+90847 90863 90887 90901 90907 90911 90917 90931 90947 90971 90977 90989 90997 91009 
+91019 91033 91079 91081 91097 91099 91121 91127 91129 91139 91141 91151 91153 91159 
+91163 91183 91193 91199 91229 91237 91243 91249 91253 91283 91291 91297 91303 91309 
+91331 91367 91369 91373 91381 91387 91393 91397 91411 91423 91433 91453 91457 91459 
+91463 91493 91499 91513 91529 91541 91571 91573 91577 91583 91591 91621 91631 91639 
+91673 91691 91703 91711 91733 91753 91757 91771 91781 91801 91807 91811 91813 91823 
+91837 91841 91867 91873 91909 91921 91939 91943 91951 91957 91961 91967 91969 91997 
+92003 92009 92033 92041 92051 92077 92083 92107 92111 92119 92143 92153 92173 92177 
+92179 92189 92203 92219 92221 92227 92233 92237 92243 92251 92269 92297 92311 92317 
+92333 92347 92353 92357 92363 92369 92377 92381 92383 92387 92399 92401 92413 92419 
+92431 92459 92461 92467 92479 92489 92503 92507 92551 92557 92567 92569 92581 92593 
+92623 92627 92639 92641 92647 92657 92669 92671 92681 92683 92693 92699 92707 92717 
+92723 92737 92753 92761 92767 92779 92789 92791 92801 92809 92821 92831 92849 92857 
+92861 92863 92867 92893 92899 92921 92927 92941 92951 92957 92959 92987 92993 93001 
+93047 93053 93059 93077 93083 93089 93097 93103 93113 93131 93133 93139 93151 93169 
+93179 93187 93199 93229 93239 93241 93251 93253 93257 93263 93281 93283 93287 93307 
+93319 93323 93329 93337 93371 93377 93383 93407 93419 93427 93463 93479 93481 93487 
+93491 93493 93497 93503 93523 93529 93553 93557 93559 93563 93581 93601 93607 93629 
+93637 93683 93701 93703 93719 93739 93761 93763 93787 93809 93811 93827 93851 93871 
+93887 93889 93893 93901 93911 93913 93923 93937 93941 93949 93967 93971 93979 93983 
+93997 94007 94009 94033 94049 94057 94063 94079 94099 94109 94111 94117 94121 94151 
+94153 94169 94201 94207 94219 94229 94253 94261 94273 94291 94307 94309 94321 94327 
+94331 94343 94349 94351 94379 94397 94399 94421 94427 94433 94439 94441 94447 94463 
+94477 94483 94513 94529 94531 94541 94543 94547 94559 94561 94573 94583 94597 94603 
+94613 94621 94649 94651 94687 94693 94709 94723 94727 94747 94771 94777 94781 94789 
+94793 94811 94819 94823 94837 94841 94847 94849 94873 94889 94903 94907 94933 94949 
+94951 94961 94993 94999 95003 95009 95021 95027 95063 95071 95083 95087 95089 95093 
+95101 95107 95111 95131 95143 95153 95177 95189 95191 95203 95213 95219 95231 95233 
+95239 95257 95261 95267 95273 95279 95287 95311 95317 95327 95339 95369 95383 95393 
+95401 95413 95419 95429 95441 95443 95461 95467 95471 95479 95483 95507 95527 95531 
+95539 95549 95561 95569 95581 95597 95603 95617 95621 95629 95633 95651 95701 95707 
+95713 95717 95723 95731 95737 95747 95773 95783 95789 95791 95801 95803 95813 95819 
+95857 95869 95873 95881 95891 95911 95917 95923 95929 95947 95957 95959 95971 95987 
+95989 96001 96013 96017 96043 96053 96059 96079 96097 96137 96149 96157 96167 96179 
+96181 96199 96211 96221 96223 96233 96259 96263 96269 96281 96289 96293 96323 96329 
+96331 96337 96353 96377 96401 96419 96431 96443 96451 96457 96461 96469 96479 96487 
+96493 96497 96517 96527 96553 96557 96581 96587 96589 96601 96643 96661 96667 96671 
+96697 96703 96731 96737 96739 96749 96757 96763 96769 96779 96787 96797 96799 96821 
+96823 96827 96847 96851 96857 96893 96907 96911 96931 96953 96959 96973 96979 96989 
+96997 97001 97003 97007 97021 97039 97073 97081 97103 97117 97127 97151 97157 97159 
+97169 97171 97177 97187 97213 97231 97241 97259 97283 97301 97303 97327 97367 97369 
+97373 97379 97381 97387 97397 97423 97429 97441 97453 97459 97463 97499 97501 97511 
+97523 97547 97549 97553 97561 97571 97577 97579 97583 97607 97609 97613 97649 97651 
+97673 97687 97711 97729 97771 97777 97787 97789 97813 97829 97841 97843 97847 97849 
+97859 97861 97871 97879 97883 97919 97927 97931 97943 97961 97967 97973 97987 98009 
+98011 98017 98041 98047 98057 98081 98101 98123 98129 98143 98179 98207 98213 98221 
+98227 98251 98257 98269 98297 98299 98317 98321 98323 98327 98347 98369 98377 98387 
+98389 98407 98411 98419 98429 98443 98453 98459 98467 98473 98479 98491 98507 98519 
+98533 98543 98561 98563 98573 98597 98621 98627 98639 98641 98663 98669 98689 98711 
+98713 98717 98729 98731 98737 98773 98779 98801 98807 98809 98837 98849 98867 98869 
+98873 98887 98893 98897 98899 98909 98911 98927 98929 98939 98947 98953 98963 98981 
+98993 98999 99013 99017 99023 99041 99053 99079 99083 99089 99103 99109 99119 99131 
+99133 99137 99139 99149 99173 99181 99191 99223 99233 99241 99251 99257 99259 99277 
+99289 99317 99347 99349 99367 99371 99377 99391 99397 99401 99409 99431 99439 99469 
+99487 99497 99523 99527 99529 99551 99559 99563 99571 99577 99581 99607 99611 99623 
+99643 99661 99667 99679 99689 99707 99709 99713 99719 99721 99733 99761 99767 99787 
+99793 99809 99817 99823 99829 99833 99839 99859 99871 99877 99881 99901 99907 99923 
+99929 99961 99971 99989 99991 
+100003 100019 100043 100049 100057 100069 100103 100109 100129 100151 100153 100169 
+100183 100189 100193 100207 100213 100237 100267 100271 100279 100291 100297 100313 
+100333 100343 100357 100361 100363 100379 100391 100393 100403 100411 100417 100447 
+100459 100469 100483 100493 100501 100511 100517 100519 100523 100537 100547 100549 
+100559 100591 100609 100613 100621 100649 100669 100673 100693 100699 100703 100733 
+100741 100747 100769 100787 100799 100801 100811 100823 100829 100847 100853 100907 
+100913 100927 100931 100937 100943 100957 100981 100987 100999 101009 101021 101027 
+101051 101063 101081 101089 101107 101111 101113 101117 101119 101141 101149 101159 
+101161 101173 101183 101197 101203 101207 101209 101221 101267 101273 101279 101281 
+101287 101293 101323 101333 101341 101347 101359 101363 101377 101383 101399 101411 
+101419 101429 101449 101467 101477 101483 101489 101501 101503 101513 101527 101531 
+101533 101537 101561 101573 101581 101599 101603 101611 101627 101641 101653 101663 
+101681 101693 101701 101719 101723 101737 101741 101747 101749 101771 101789 101797 
+101807 101833 101837 101839 101863 101869 101873 101879 101891 101917 101921 101929 
+101939 101957 101963 101977 101987 101999 102001 102013 102019 102023 102031 102043 
+102059 102061 102071 102077 102079 102101 102103 102107 102121 102139 102149 102161 
+102181 102191 102197 102199 102203 102217 102229 102233 102241 102251 102253 102259 
+102293 102299 102301 102317 102329 102337 102359 102367 102397 102407 102409 102433 
+102437 102451 102461 102481 102497 102499 102503 102523 102533 102539 102547 102551 
+102559 102563 102587 102593 102607 102611 102643 102647 102653 102667 102673 102677 
+102679 102701 102761 102763 102769 102793 102797 102811 102829 102841 102859 102871 
+102877 102881 102911 102913 102929 102931 102953 102967 102983 103001 103007 103043 
+103049 103067 103069 103079 103087 103091 103093 103099 103123 103141 103171 103177 
+103183 103217 103231 103237 103289 103291 103307 103319 103333 103349 103357 103387 
+103391 103393 103399 103409 103421 103423 103451 103457 103471 103483 103511 103529 
+103549 103553 103561 103567 103573 103577 103583 103591 103613 103619 103643 103651 
+103657 103669 103681 103687 103699 103703 103723 103769 103787 103801 103811 103813 
+103837 103841 103843 103867 103889 103903 103913 103919 103951 103963 103967 103969 
+103979 103981 103991 103993 103997 104003 104009 104021 104033 104047 104053 104059 
+104087 104089 104107 104113 104119 104123 104147 104149 104161 104173 104179 104183 
+104207 104231 104233 104239 104243 104281 104287 104297 104309 104311 104323 104327 
+104347 104369 104381 104383 104393 104399 104417 104459 104471 104473 104479 104491 
+104513 104527 104537 104543 104549 104551 104561 104579 104593 104597 104623 104639 
+104651 104659 104677 104681 104683 104693 104701 104707 104711 104717 104723 104729 
+104743 104759 104761 104773 104779 104789 104801 104803 104827 104831 104849 104851 
+104869 104879 104891 104911 104917 104933 104947 104953 104959 104971 104987 104999 
+105019 105023 105031 105037 105071 105097 105107 105137 105143 105167 105173 105199 
+105211 105227 105229 105239 105251 105253 105263 105269 105277 105319 105323 105331 
+105337 105341 105359 105361 105367 105373 105379 105389 105397 105401 105407 105437 
+105449 105467 105491 105499 105503 105509 105517 105527 105529 105533 105541 105557 
+105563 105601 105607 105613 105619 105649 105653 105667 105673 105683 105691 105701 
+105727 105733 105751 105761 105767 105769 105817 105829 105863 105871 105883 105899 
+105907 105913 105929 105943 105953 105967 105971 105977 105983 105997 106013 106019 
+106031 106033 106087 106103 106109 106121 106123 106129 106163 106181 106187 106189 
+106207 106213 106217 106219 106243 106261 106273 106277 106279 106291 106297 106303 
+106307 106319 106321 106331 106349 106357 106363 106367 106373 106391 106397 106411 
+106417 106427 106433 106441 106451 106453 106487 106501 106531 106537 106541 106543 
+106591 106619 106621 106627 106637 106649 106657 106661 106663 106669 106681 106693 
+106699 106703 106721 106727 106739 106747 106751 106753 106759 106781 106783 106787 
+106801 106823 106853 106859 106861 106867 106871 106877 106903 106907 106921 106937 
+106949 106957 106961 106963 106979 106993 107021 107033 107053 107057 107069 107071 
+107077 107089 107099 107101 107119 107123 107137 107171 107183 107197 107201 107209 
+107227 107243 107251 107269 107273 107279 107309 107323 107339 107347 107351 107357 
+107377 107441 107449 107453 107467 107473 107507 107509 107563 107581 107599 107603 
+107609 107621 107641 107647 107671 107687 107693 107699 107713 107717 107719 107741 
+107747 107761 107773 107777 107791 107827 107837 107839 107843 107857 107867 107873 
+107881 107897 107903 107923 107927 107941 107951 107971 107981 107999 108007 108011 
+108013 108023 108037 108041 108061 108079 108089 108107 108109 108127 108131 108139 
+108161 108179 108187 108191 108193 108203 108211 108217 108223 108233 108247 108263 
+108271 108287 108289 108293 108301 108343 108347 108359 108377 108379 108401 108413 
+108421 108439 108457 108461 108463 108497 108499 108503 108517 108529 108533 108541 
+108553 108557 108571 108587 108631 108637 108643 108649 108677 108707 108709 108727 
+108739 108751 108761 108769 108791 108793 108799 108803 108821 108827 108863 108869 
+108877 108881 108883 108887 108893 108907 108917 108923 108929 108943 108947 108949 
+108959 108961 108967 108971 108991 109001 109013 109037 109049 109063 109073 109097 
+109103 109111 109121 109133 109139 109141 109147 109159 109169 109171 109199 109201 
+109211 109229 109253 109267 109279 109297 109303 109313 109321 109331 109357 109363 
+109367 109379 109387 109391 109397 109423 109433 109441 109451 109453 109469 109471 
+109481 109507 109517 109519 109537 109541 109547 109567 109579 109583 109589 109597 
+109609 109619 109621 109639 109661 109663 109673 109717 109721 109741 109751 109789 
+109793 109807 109819 109829 109831 109841 109843 109847 109849 109859 109873 109883 
+109891 109897 109903 109913 109919 109937 109943 109961 109987 110017 110023 110039 
+110051 110059 110063 110069 110083 110119 110129 110161 110183 110221 110233 110237 
+110251 110261 110269 110273 110281 110291 110311 110321 110323 110339 110359 110419 
+110431 110437 110441 110459 110477 110479 110491 110501 110503 110527 110533 110543 
+110557 110563 110567 110569 110573 110581 110587 110597 110603 110609 110623 110629 
+110641 110647 110651 110681 110711 110729 110731 110749 110753 110771 110777 110807 
+110813 110819 110821 110849 110863 110879 110881 110899 110909 110917 110921 110923 
+110927 110933 110939 110947 110951 110969 110977 110989 111029 111031 111043 111049 
+111053 111091 111103 111109 111119 111121 111127 111143 111149 111187 111191 111211 
+111217 111227 111229 111253 111263 111269 111271 111301 111317 111323 111337 111341 
+111347 111373 111409 111427 111431 111439 111443 111467 111487 111491 111493 111497 
+111509 111521 111533 111539 111577 111581 111593 111599 111611 111623 111637 111641 
+111653 111659 111667 111697 111721 111731 111733 111751 111767 111773 111779 111781 
+111791 111799 111821 111827 111829 111833 111847 111857 111863 111869 111871 111893 
+111913 111919 111949 111953 111959 111973 111977 111997 112019 112031 112061 112067 
+112069 112087 112097 112103 112111 112121 112129 112139 112153 112163 112181 112199 
+112207 112213 112223 112237 112241 112247 112249 112253 112261 112279 112289 112291 
+112297 112303 112327 112331 112337 112339 112349 112361 112363 112397 112403 112429 
+112459 112481 112501 112507 112543 112559 112571 112573 112577 112583 112589 112601 
+112603 112621 112643 112657 112663 112687 112691 112741 112757 112759 112771 112787 
+112799 112807 112831 112843 112859 112877 112901 112909 112913 112919 112921 112927 
+112939 112951 112967 112979 112997 113011 113017 113021 113023 113027 113039 113041 
+113051 113063 113081 113083 113089 113093 113111 113117 113123 113131 113143 113147 
+113149 113153 113159 113161 113167 113171 113173 113177 113189 113209 113213 113227 
+113233 113279 113287 113327 113329 113341 113357 113359 113363 113371 113381 113383 
+113417 113437 113453 113467 113489 113497 113501 113513 113537 113539 113557 113567 
+113591 113621 113623 113647 113657 113683 113717 113719 113723 113731 113749 113759 
+113761 113777 113779 113783 113797 113809 113819 113837 113843 113891 113899 113903 
+113909 113921 113933 113947 113957 113963 113969 113983 113989 114001 114013 114031 
+114041 114043 114067 114073 114077 114083 114089 114113 114143 114157 114161 114167 
+114193 114197 114199 114203 114217 114221 114229 114259 114269 114277 114281 114299 
+114311 114319 114329 114343 114371 114377 114407 114419 114451 114467 114473 114479 
+114487 114493 114547 114553 114571 114577 114593 114599 114601 114613 114617 114641 
+114643 114649 114659 114661 114671 114679 114689 114691 114713 114743 114749 114757 
+114761 114769 114773 114781 114797 114799 114809 114827 114833 114847 114859 114883 
+114889 114901 114913 114941 114967 114973 114997 115001 115013 115019 115021 115057 
+115061 115067 115079 115099 115117 115123 115127 115133 115151 115153 115163 115183 
+115201 115211 115223 115237 115249 115259 115279 115301 115303 115309 115319 115321 
+115327 115331 115337 115343 115361 115363 115399 115421 115429 115459 115469 115471 
+115499 115513 115523 115547 115553 115561 115571 115589 115597 115601 115603 115613 
+115631 115637 115657 115663 115679 115693 115727 115733 115741 115751 115757 115763 
+115769 115771 115777 115781 115783 115793 115807 115811 115823 115831 115837 115849 
+115853 115859 115861 115873 115877 115879 115883 115891 115901 115903 115931 115933 
+115963 115979 115981 115987 116009 116027 116041 116047 116089 116099 116101 116107 
+116113 116131 116141 116159 116167 116177 116189 116191 116201 116239 116243 116257 
+116269 116273 116279 116293 116329 116341 116351 116359 116371 116381 116387 116411 
+116423 116437 116443 116447 116461 116471 116483 116491 116507 116531 116533 116537 
+116539 116549 116579 116593 116639 116657 116663 116681 116687 116689 116707 116719 
+116731 116741 116747 116789 116791 116797 116803 116819 116827 116833 116849 116867 
+116881 116903 116911 116923 116927 116929 116933 116953 116959 116969 116981 116989 
+116993 117017 117023 117037 117041 117043 117053 117071 117101 117109 117119 117127 
+117133 117163 117167 117191 117193 117203 117209 117223 117239 117241 117251 117259 
+117269 117281 117307 117319 117329 117331 117353 117361 117371 117373 117389 117413 
+117427 117431 117437 117443 117497 117499 117503 117511 117517 117529 117539 117541 
+117563 117571 117577 117617 117619 117643 117659 117671 117673 117679 117701 117703 
+117709 117721 117727 117731 117751 117757 117763 117773 117779 117787 117797 117809 
+117811 117833 117839 117841 117851 117877 117881 117883 117889 117899 117911 117917 
+117937 117959 117973 117977 117979 117989 117991 118033 118037 118043 118051 118057 
+118061 118081 118093 118127 118147 118163 118169 118171 118189 118211 118213 118219 
+118247 118249 118253 118259 118273 118277 118297 118343 118361 118369 118373 118387 
+118399 118409 118411 118423 118429 118453 118457 118463 118471 118493 118529 118543 
+118549 118571 118583 118589 118603 118619 118621 118633 118661 118669 118673 118681 
+118687 118691 118709 118717 118739 118747 118751 118757 118787 118799 118801 118819 
+118831 118843 118861 118873 118891 118897 118901 118903 118907 118913 118927 118931 
+118967 118973 119027 119033 119039 119047 119057 119069 119083 119087 119089 119099 
+119101 119107 119129 119131 119159 119173 119179 119183 119191 119227 119233 119237 
+119243 119267 119291 119293 119297 119299 119311 119321 119359 119363 119389 119417 
+119419 119429 119447 119489 119503 119513 119533 119549 119551 119557 119563 119569 
+119591 119611 119617 119627 119633 119653 119657 119659 119671 119677 119687 119689 
+119699 119701 119723 119737 119747 119759 119771 119773 119783 119797 119809 119813 
+119827 119831 119839 119849 119851 119869 119881 119891 119921 119923 119929 119953 
+119963 119971 119981 119983 119993 120011 120017 120041 120047 120049 120067 120077 
+120079 120091 120097 120103 120121 120157 120163 120167 120181 120193 120199 120209 
+120223 120233 120247 120277 120283 120293 120299 120319 120331 120349 120371 120383 
+120391 120397 120401 120413 120427 120431 120473 120503 120511 120539 120551 120557 
+120563 120569 120577 120587 120607 120619 120623 120641 120647 120661 120671 120677 
+120689 120691 120709 120713 120721 120737 120739 120749 120763 120767 120779 120811 
+120817 120823 120829 120833 120847 120851 120863 120871 120877 120889 120899 120907 
+120917 120919 120929 120937 120941 120943 120947 120977 120997 121001 121007 121013 
+121019 121021 121039 121061 121063 121067 121081 121123 121139 121151 121157 121169 
+121171 121181 121189 121229 121259 121267 121271 121283 121291 121309 121313 121321 
+121327 121333 121343 121349 121351 121357 121367 121369 121379 121403 121421 121439 
+121441 121447 121453 121469 121487 121493 121501 121507 121523 121531 121547 121553 
+121559 121571 121577 121579 121591 121607 121609 121621 121631 121633 121637 121661 
+121687 121697 121711 121721 121727 121763 121787 121789 121843 121853 121867 121883 
+121889 121909 121921 121931 121937 121949 121951 121963 121967 121993 121997 122011 
+122021 122027 122029 122033 122039 122041 122051 122053 122069 122081 122099 122117 
+122131 122147 122149 122167 122173 122201 122203 122207 122209 122219 122231 122251 
+122263 122267 122273 122279 122299 122321 122323 122327 122347 122363 122387 122389 
+122393 122399 122401 122443 122449 122453 122471 122477 122489 122497 122501 122503 
+122509 122527 122533 122557 122561 122579 122597 122599 122609 122611 122651 122653 
+122663 122693 122701 122719 122741 122743 122753 122761 122777 122789 122819 122827 
+122833 122839 122849 122861 122867 122869 122887 122891 122921 122929 122939 122953 
+122957 122963 122971 123001 123007 123017 123031 123049 123059 123077 123083 123091 
+123113 123121 123127 123143 123169 123191 123203 123209 123217 123229 123239 123259 
+123269 123289 123307 123311 123323 123341 123373 123377 123379 123397 123401 123407 
+123419 123427 123433 123439 123449 123457 123479 123491 123493 123499 123503 123517 
+123527 123547 123551 123553 123581 123583 123593 123601 123619 123631 123637 123653 
+123661 123667 123677 123701 123707 123719 123727 123731 123733 123737 123757 123787 
+123791 123803 123817 123821 123829 123833 123853 123863 123887 123911 123923 123931 
+123941 123953 123973 123979 123983 123989 123997 124001 124021 124067 124087 124097 
+124121 124123 124133 124139 124147 124153 124171 124181 124183 124193 124199 124213 
+124231 124247 124249 124277 124291 124297 124301 124303 124309 124337 124339 124343 
+124349 124351 124363 124367 124427 124429 124433 124447 124459 124471 124477 124489 
+124493 124513 124529 124541 124543 124561 124567 124577 124601 124633 124643 124669 
+124673 124679 124693 124699 124703 124717 124721 124739 124753 124759 124769 124771 
+124777 124781 124783 124793 124799 124819 124823 124847 124853 124897 124907 124909 
+124919 124951 124979 124981 124987 124991 125003 125017 125029 125053 125063 125093 
+125101 125107 125113 125117 125119 125131 125141 125149 125183 125197 125201 125207 
+125219 125221 125231 125243 125261 125269 125287 125299 125303 125311 125329 125339 
+125353 125371 125383 125387 125399 125407 125423 125429 125441 125453 125471 125497 
+125507 125509 125527 125539 125551 125591 125597 125617 125621 125627 125639 125641 
+125651 125659 125669 125683 125687 125693 125707 125711 125717 125731 125737 125743 
+125753 125777 125789 125791 125803 125813 125821 125863 125887 125897 125899 125921 
+125927 125929 125933 125941 125959 125963 126001 126011 126013 126019 126023 126031 
+126037 126041 126047 126067 126079 126097 126107 126127 126131 126143 126151 126173 
+126199 126211 126223 126227 126229 126233 126241 126257 126271 126307 126311 126317 
+126323 126337 126341 126349 126359 126397 126421 126433 126443 126457 126461 126473 
+126481 126487 126491 126493 126499 126517 126541 126547 126551 126583 126601 126611 
+126613 126631 126641 126653 126683 126691 126703 126713 126719 126733 126739 126743 
+126751 126757 126761 126781 126823 126827 126839 126851 126857 126859 126913 126923 
+126943 126949 126961 126967 126989 127031 127033 127037 127051 127079 127081 127103 
+127123 127133 127139 127157 127163 127189 127207 127217 127219 127241 127247 127249 
+127261 127271 127277 127289 127291 127297 127301 127321 127331 127343 127363 127373 
+127399 127403 127423 127447 127453 127481 127487 127493 127507 127529 127541 127549 
+127579 127583 127591 127597 127601 127607 127609 127637 127643 127649 127657 127663 
+127669 127679 127681 127691 127703 127709 127711 127717 127727 127733 127739 127747 
+127763 127781 127807 127817 127819 127837 127843 127849 127859 127867 127873 127877 
+127913 127921 127931 127951 127973 127979 127997 128021 128033 128047 128053 128099 
+128111 128113 128119 128147 128153 128159 128173 128189 128201 128203 128213 128221 
+128237 128239 128257 128273 128287 128291 128311 128321 128327 128339 128341 128347 
+128351 128377 128389 128393 128399 128411 128413 128431 128437 128449 128461 128467 
+128473 128477 128483 128489 128509 128519 128521 128549 128551 128563 128591 128599 
+128603 128621 128629 128657 128659 128663 128669 128677 128683 128693 128717 128747 
+128749 128761 128767 128813 128819 128831 128833 128837 128857 128861 128873 128879 
+128903 128923 128939 128941 128951 128959 128969 128971 128981 128983 128987 128993 
+129001 129011 129023 129037 129049 129061 129083 129089 129097 129113 129119 129121 
+129127 129169 129187 129193 129197 129209 129221 129223 129229 129263 129277 129281 
+129287 129289 129293 129313 129341 129347 129361 129379 129401 129403 129419 129439 
+129443 129449 129457 129461 129469 129491 129497 129499 129509 129517 129527 129529 
+129533 129539 129553 129581 129587 129589 129593 129607 129629 129631 129641 129643 
+129671 129707 129719 129733 129737 129749 129757 129763 129769 129793 129803 129841 
+129853 129887 129893 129901 129917 129919 129937 129953 129959 129967 129971 130003 
+130021 130027 130043 130051 130057 130069 130073 130079 130087 130099 130121 130127 
+130147 130171 130183 130199 130201 130211 130223 130241 130253 130259 130261 130267 
+130279 130303 130307 130337 130343 130349 130363 130367 130369 130379 130399 130409 
+130411 130423 130439 130447 130457 130469 130477 130483 130489 130513 130517 130523 
+130531 130547 130553 130579 130589 130619 130621 130631 130633 130639 130643 130649 
+130651 130657 130681 130687 130693 130699 130729 130769 130783 130787 130807 130811 
+130817 130829 130841 130843 130859 130873 130927 130957 130969 130973 130981 130987 
+131009 131011 131023 131041 131059 131063 131071 131101 131111 131113 131129 131143 
+131149 131171 131203 131213 131221 131231 131249 131251 131267 131293 131297 131303 
+131311 131317 131321 131357 131363 131371 131381 131413 131431 131437 131441 131447 
+131449 131477 131479 131489 131497 131501 131507 131519 131543 131561 131581 131591 
+131611 131617 131627 131639 131641 131671 131687 131701 131707 131711 131713 131731 
+131743 131749 131759 131771 131777 131779 131783 131797 131837 131839 131849 131861 
+131891 131893 131899 131909 131927 131933 131939 131941 131947 131959 131969 132001 
+132019 132047 132049 132059 132071 132103 132109 132113 132137 132151 132157 132169 
+132173 132199 132229 132233 132241 132247 132257 132263 132283 132287 132299 132313 
+132329 132331 132347 132361 132367 132371 132383 132403 132409 132421 132437 132439 
+132469 132491 132499 132511 132523 132527 132529 132533 132541 132547 132589 132607 
+132611 132619 132623 132631 132637 132647 132661 132667 132679 132689 132697 132701 
+132707 132709 132721 132739 132749 132751 132757 132761 132763 132817 132833 132851 
+132857 132859 132863 132887 132893 132911 132929 132947 132949 132953 132961 132967 
+132971 132989 133013 133033 133039 133051 133069 133073 133087 133097 133103 133109 
+133117 133121 133153 133157 133169 133183 133187 133201 133213 133241 133253 133261 
+133271 133277 133279 133283 133303 133319 133321 133327 133337 133349 133351 133379 
+133387 133391 133403 133417 133439 133447 133451 133481 133493 133499 133519 133541 
+133543 133559 133571 133583 133597 133631 133633 133649 133657 133669 133673 133691 
+133697 133709 133711 133717 133723 133733 133769 133781 133801 133811 133813 133831 
+133843 133853 133873 133877 133919 133949 133963 133967 133979 133981 133993 133999 
+134033 134039 134047 134053 134059 134077 134081 134087 134089 134093 134129 134153 
+134161 134171 134177 134191 134207 134213 134219 134227 134243 134257 134263 134269 
+134287 134291 134293 134327 134333 134339 134341 134353 134359 134363 134369 134371 
+134399 134401 134417 134437 134443 134471 134489 134503 134507 134513 134581 134587 
+134591 134593 134597 134609 134639 134669 134677 134681 134683 134699 134707 134731 
+134741 134753 134777 134789 134807 134837 134839 134851 134857 134867 134873 134887 
+134909 134917 134921 134923 134947 134951 134989 134999 135007 135017 135019 135029 
+135043 135049 135059 135077 135089 135101 135119 135131 135151 135173 135181 135193 
+135197 135209 135211 135221 135241 135257 135271 135277 135281 135283 135301 135319 
+135329 135347 135349 135353 135367 135389 135391 135403 135409 135427 135431 135433 
+135449 135461 135463 135467 135469 135479 135497 135511 135533 135559 135571 135581 
+135589 135593 135599 135601 135607 135613 135617 135623 135637 135647 135649 135661 
+135671 135697 135701 135719 135721 135727 135731 135743 135757 135781 135787 135799 
+135829 135841 135851 135859 135887 135893 135899 135911 135913 135929 135937 135977 
+135979 136013 136027 136033 136043 136057 136067 136069 136093 136099 136111 136133 
+136139 136163 136177 136189 136193 136207 136217 136223 136237 136247 136261 136273 
+136277 136303 136309 136319 136327 136333 136337 136343 136351 136361 136373 136379 
+136393 136397 136399 136403 136417 136421 136429 136447 136453 136463 136471 136481 
+136483 136501 136511 136519 136523 136531 136537 136541 136547 136559 136573 136601 
+136603 136607 136621 136649 136651 136657 136691 136693 136709 136711 136727 136733 
+136739 136751 136753 136769 136777 136811 136813 136841 136849 136859 136861 136879 
+136883 136889 136897 136943 136949 136951 136963 136973 136979 136987 136991 136993 
+136999 137029 137077 137087 137089 137117 137119 137131 137143 137147 137153 137177 
+137183 137191 137197 137201 137209 137219 137239 137251 137273 137279 137303 137321 
+137339 137341 137353 137359 137363 137369 137383 137387 137393 137399 137413 137437 
+137443 137447 137453 137477 137483 137491 137507 137519 137537 137567 137573 137587 
+137593 137597 137623 137633 137639 137653 137659 137699 137707 137713 137723 137737 
+137743 137771 137777 137791 137803 137827 137831 137849 137867 137869 137873 137909 
+137911 137927 137933 137941 137947 137957 137983 137993 137999 138007 138041 138053 
+138059 138071 138077 138079 138101 138107 138113 138139 138143 138157 138163 138179 
+138181 138191 138197 138209 138239 138241 138247 138251 138283 138289 138311 138319 
+138323 138337 138349 138371 138373 138389 138401 138403 138407 138427 138433 138449 
+138451 138461 138469 138493 138497 138511 138517 138547 138559 138563 138569 138571 
+138577 138581 138587 138599 138617 138629 138637 138641 138647 138661 138679 138683 
+138727 138731 138739 138763 138793 138797 138799 138821 138829 138841 138863 138869 
+138883 138889 138893 138899 138917 138923 138937 138959 138967 138977 139021 139033 
+139067 139079 139091 139109 139121 139123 139133 139169 139177 139187 139199 139201 
+139241 139267 139273 139291 139297 139301 139303 139309 139313 139333 139339 139343 
+139361 139367 139369 139387 139393 139397 139409 139423 139429 139439 139457 139459 
+139483 139487 139493 139501 139511 139537 139547 139571 139589 139591 139597 139609 
+139619 139627 139661 139663 139681 139697 139703 139709 139721 139729 139739 139747 
+139753 139759 139787 139801 139813 139831 139837 139861 139871 139883 139891 139901 
+139907 139921 139939 139943 139967 139969 139981 139987 139991 139999 140009 140053 
+140057 140069 140071 140111 140123 140143 140159 140167 140171 140177 140191 140197 
+140207 140221 140227 140237 140249 140263 140269 140281 140297 140317 140321 140333 
+140339 140351 140363 140381 140401 140407 140411 140417 140419 140423 140443 140449 
+140453 140473 140477 140521 140527 140533 140549 140551 140557 140587 140593 140603 
+140611 140617 140627 140629 140639 140659 140663 140677 140681 140683 140689 140717 
+140729 140731 140741 140759 140761 140773 140779 140797 140813 140827 140831 140837 
+140839 140863 140867 140869 140891 140893 140897 140909 140929 140939 140977 140983 
+140989 141023 141041 141061 141067 141073 141079 141101 141107 141121 141131 141157 
+141161 141179 141181 141199 141209 141221 141223 141233 141241 141257 141263 141269 
+141277 141283 141301 141307 141311 141319 141353 141359 141371 141397 141403 141413 
+141439 141443 141461 141481 141497 141499 141509 141511 141529 141539 141551 141587 
+141601 141613 141619 141623 141629 141637 141649 141653 141667 141671 141677 141679 
+141689 141697 141707 141709 141719 141731 141761 141767 141769 141773 141793 141803 
+141811 141829 141833 141851 141853 141863 141871 141907 141917 141931 141937 141941 
+141959 141961 141971 141991 142007 142019 142031 142039 142049 142057 142061 142067 
+142097 142099 142111 142123 142151 142157 142159 142169 142183 142189 142193 142211 
+142217 142223 142231 142237 142271 142297 142319 142327 142357 142369 142381 142391 
+142403 142421 142427 142433 142453 142469 142501 142529 142537 142543 142547 142553 
+142559 142567 142573 142589 142591 142601 142607 142609 142619 142657 142673 142697 
+142699 142711 142733 142757 142759 142771 142787 142789 142799 142811 142837 142841 
+142867 142871 142873 142897 142903 142907 142939 142949 142963 142969 142973 142979 
+142981 142993 143053 143063 143093 143107 143111 143113 143137 143141 143159 143177 
+143197 143239 143243 143249 143257 143261 143263 143281 143287 143291 143329 143333 
+143357 143387 143401 143413 143419 143443 143461 143467 143477 143483 143489 143501 
+143503 143509 143513 143519 143527 143537 143551 143567 143569 143573 143593 143609 
+143617 143629 143651 143653 143669 143677 143687 143699 143711 143719 143729 143743 
+143779 143791 143797 143807 143813 143821 143827 143831 143833 143873 143879 143881 
+143909 143947 143953 143971 143977 143981 143999 144013 144031 144037 144061 144071 
+144073 144103 144139 144161 144163 144167 144169 144173 144203 144223 144241 144247 
+144253 144259 144271 144289 144299 144307 144311 144323 144341 144349 144379 144383 
+144407 144409 144413 144427 144439 144451 144461 144479 144481 144497 144511 144539 
+144541 144563 144569 144577 144583 144589 144593 144611 144629 144659 144667 144671 
+144701 144709 144719 144731 144737 144751 144757 144763 144773 144779 144791 144817 
+144829 144839 144847 144883 144887 144889 144899 144917 144931 144941 144961 144967 
+144973 144983 145007 145009 145021 145031 145037 145043 145063 145069 145091 145109 
+145121 145133 145139 145177 145193 145207 145213 145219 145253 145259 145267 145283 
+145289 145303 145307 145349 145361 145381 145391 145399 145417 145423 145433 145441 
+145451 145459 145463 145471 145477 145487 145501 145511 145513 145517 145531 145543 
+145547 145549 145577 145589 145601 145603 145633 145637 145643 145661 145679 145681 
+145687 145703 145709 145721 145723 145753 145757 145759 145771 145777 145799 145807 
+145819 145823 145829 145861 145879 145897 145903 145931 145933 145949 145963 145967 
+145969 145987 145991 146009 146011 146021 146023 146033 146051 146057 146059 146063 
+146077 146093 146099 146117 146141 146161 146173 146191 146197 146203 146213 146221 
+146239 146249 146273 146291 146297 146299 146309 146317 146323 146347 146359 146369 
+146381 146383 146389 146407 146417 146423 146437 146449 146477 146513 146519 146521 
+146527 146539 146543 146563 146581 146603 146609 146617 146639 146647 146669 146677 
+146681 146683 146701 146719 146743 146749 146767 146777 146801 146807 146819 146833 
+146837 146843 146849 146857 146891 146893 146917 146921 146933 146941 146953 146977 
+146983 146987 146989 147011 147029 147031 147047 147073 147083 147089 147097 147107 
+147137 147139 147151 147163 147179 147197 147209 147211 147221 147227 147229 147253 
+147263 147283 147289 147293 147299 147311 147319 147331 147341 147347 147353 147377 
+147391 147397 147401 147409 147419 147449 147451 147457 147481 147487 147503 147517 
+147541 147547 147551 147557 147571 147583 147607 147613 147617 147629 147647 147661 
+147671 147673 147689 147703 147709 147727 147739 147743 147761 147769 147773 147779 
+147787 147793 147799 147811 147827 147853 147859 147863 147881 147919 147937 147949 
+147977 147997 148013 148021 148061 148063 148073 148079 148091 148123 148139 148147 
+148151 148153 148157 148171 148193 148199 148201 148207 148229 148243 148249 148279 
+148301 148303 148331 148339 148361 148367 148381 148387 148399 148403 148411 148429 
+148439 148457 148469 148471 148483 148501 148513 148517 148531 148537 148549 148573 
+148579 148609 148627 148633 148639 148663 148667 148669 148691 148693 148711 148721 
+148723 148727 148747 148763 148781 148783 148793 148817 148829 148853 148859 148861 
+148867 148873 148891 148913 148921 148927 148931 148933 148949 148957 148961 148991 
+148997 149011 149021 149027 149033 149053 149057 149059 149069 149077 149087 149099 
+149101 149111 149113 149119 149143 149153 149159 149161 149173 149183 149197 149213 
+149239 149249 149251 149257 149269 149287 149297 149309 149323 149333 149341 149351 
+149371 149377 149381 149393 149399 149411 149417 149419 149423 149441 149459 149489 
+149491 149497 149503 149519 149521 149531 149533 149543 149551 149561 149563 149579 
+149603 149623 149627 149629 149689 149711 149713 149717 149729 149731 149749 149759 
+149767 149771 149791 149803 149827 149837 149839 149861 149867 149873 149893 149899 
+149909 149911 149921 149939 149953 149969 149971 149993 150001 150011 150041 150053 
+150061 150067 150077 150083 150089 150091 150097 150107 150131 150151 150169 150193 
+150197 150203 150209 150211 150217 150221 150223 150239 150247 150287 150299 150301 
+150323 150329 150343 150373 150377 150379 150383 150401 150407 150413 150427 150431 
+150439 150473 150497 150503 150517 150523 150533 150551 150559 150571 150583 150587 
+150589 150607 150611 150617 150649 150659 150697 150707 150721 150743 150767 150769 
+150779 150791 150797 150827 150833 150847 150869 150881 150883 150889 150893 150901 
+150907 150919 150929 150959 150961 150967 150979 150989 150991 151007 151009 151013 
+151027 151049 151051 151057 151091 151121 151141 151153 151157 151163 151169 151171 
+151189 151201 151213 151237 151241 151243 151247 151253 151273 151279 151289 151303 
+151337 151339 151343 151357 151379 151381 151391 151397 151423 151429 151433 151451 
+151471 151477 151483 151499 151507 151517 151523 151531 151537 151549 151553 151561 
+151573 151579 151597 151603 151607 151609 151631 151637 151643 151651 151667 151673 
+151681 151687 151693 151703 151717 151729 151733 151769 151771 151783 151787 151799 
+151813 151817 151841 151847 151849 151871 151883 151897 151901 151903 151909 151937 
+151939 151967 151969 152003 152017 152027 152029 152039 152041 152063 152077 152081 
+152083 152093 152111 152123 152147 152183 152189 152197 152203 152213 152219 152231 
+152239 152249 152267 152287 152293 152297 152311 152363 152377 152381 152389 152393 
+152407 152417 152419 152423 152429 152441 152443 152459 152461 152501 152519 152531 
+152533 152539 152563 152567 152597 152599 152617 152623 152629 152639 152641 152657 
+152671 152681 152717 152723 152729 152753 152767 152777 152783 152791 152809 152819 
+152821 152833 152837 152839 152843 152851 152857 152879 152897 152899 152909 152939 
+152941 152947 152953 152959 152981 152989 152993 153001 153059 153067 153071 153073 
+153077 153089 153107 153113 153133 153137 153151 153191 153247 153259 153269 153271 
+153277 153281 153287 153313 153319 153337 153343 153353 153359 153371 153379 153407 
+153409 153421 153427 153437 153443 153449 153457 153469 153487 153499 153509 153511 
+153521 153523 153529 153533 153557 153563 153589 153607 153611 153623 153641 153649 
+153689 153701 153719 153733 153739 153743 153749 153757 153763 153817 153841 153871 
+153877 153887 153889 153911 153913 153929 153941 153947 153949 153953 153991 153997 
+154001 154027 154043 154057 154061 154067 154073 154079 154081 154087 154097 154111 
+154127 154153 154157 154159 154181 154183 154211 154213 154229 154243 154247 154267 
+154277 154279 154291 154303 154313 154321 154333 154339 154351 154369 154373 154387 
+154409 154417 154423 154439 154459 154487 154493 154501 154523 154543 154571 154573 
+154579 154589 154591 154613 154619 154621 154643 154667 154669 154681 154691 154699 
+154723 154727 154733 154747 154753 154769 154787 154789 154799 154807 154823 154841 
+154849 154871 154873 154877 154883 154897 154927 154933 154937 154943 154981 154991 
+155003 155009 155017 155027 155047 155069 155081 155083 155087 155119 155137 155153 
+155161 155167 155171 155191 155201 155203 155209 155219 155231 155251 155269 155291 
+155299 155303 155317 155327 155333 155371 155377 155381 155383 155387 155399 155413 
+155423 155443 155453 155461 155473 155501 155509 155521 155537 155539 155557 155569 
+155579 155581 155593 155599 155609 155621 155627 155653 155657 155663 155671 155689 
+155693 155699 155707 155717 155719 155723 155731 155741 155747 155773 155777 155783 
+155797 155801 155809 155821 155833 155849 155851 155861 155863 155887 155891 155893 
+155921 156007 156011 156019 156041 156059 156061 156071 156089 156109 156119 156127 
+156131 156139 156151 156157 156217 156227 156229 156241 156253 156257 156259 156269 
+156307 156319 156329 156347 156353 156361 156371 156419 156421 156437 156467 156487 
+156491 156493 156511 156521 156539 156577 156589 156593 156601 156619 156623 156631 
+156641 156659 156671 156677 156679 156683 156691 156703 156707 156719 156727 156733 
+156749 156781 156797 156799 156817 156823 156833 156841 156887 156899 156901 156913 
+156941 156943 156967 156971 156979 157007 157013 157019 157037 157049 157051 157057 
+157061 157081 157103 157109 157127 157133 157141 157163 157177 157181 157189 157207 
+157211 157217 157219 157229 157231 157243 157247 157253 157259 157271 157273 157277 
+157279 157291 157303 157307 157321 157327 157349 157351 157363 157393 157411 157427 
+157429 157433 157457 157477 157483 157489 157513 157519 157523 157543 157559 157561 
+157571 157579 157627 157637 157639 157649 157667 157669 157679 157721 157733 157739 
+157747 157769 157771 157793 157799 157813 157823 157831 157837 157841 157867 157877 
+157889 157897 157901 157907 157931 157933 157951 157991 157999 158003 158009 158017 
+158029 158047 158071 158077 158113 158129 158141 158143 158161 158189 158201 158209 
+158227 158231 158233 158243 158261 158269 158293 158303 158329 158341 158351 158357 
+158359 158363 158371 158393 158407 158419 158429 158443 158449 158489 158507 158519 
+158527 158537 158551 158563 158567 158573 158581 158591 158597 158611 158617 158621 
+158633 158647 158657 158663 158699 158731 158747 158749 158759 158761 158771 158777 
+158791 158803 158843 158849 158863 158867 158881 158909 158923 158927 158941 158959 
+158981 158993 159013 159017 159023 159059 159073 159079 159097 159113 159119 159157 
+159161 159167 159169 159179 159191 159193 159199 159209 159223 159227 159233 159287 
+159293 159311 159319 159337 159347 159349 159361 159389 159403 159407 159421 159431 
+159437 159457 159463 159469 159473 159491 159499 159503 159521 159539 159541 159553 
+159563 159569 159571 159589 159617 159623 159629 159631 159667 159671 159673 159683 
+159697 159701 159707 159721 159737 159739 159763 159769 159773 159779 159787 159791 
+159793 159799 159811 159833 159839 159853 159857 159869 159871 159899 159911 159931 
+159937 159977 159979 160001 160009 160019 160031 160033 160049 160073 160079 160081 
+160087 160091 160093 160117 160141 160159 160163 160169 160183 160201 160207 160217 
+160231 160243 160253 160309 160313 160319 160343 160357 160367 160373 160387 160397 
+160403 160409 160423 160441 160453 160481 160483 160499 160507 160541 160553 160579 
+160583 160591 160603 160619 160621 160627 160637 160639 160649 160651 160663 160669 
+160681 160687 160697 160709 160711 160723 160739 160751 160753 160757 160781 160789 
+160807 160813 160817 160829 160841 160861 160877 160879 160883 160903 160907 160933 
+160967 160969 160981 160997 161009 161017 161033 161039 161047 161053 161059 161071 
+161087 161093 161123 161137 161141 161149 161159 161167 161201 161221 161233 161237 
+161263 161267 161281 161303 161309 161323 161333 161339 161341 161363 161377 161387 
+161407 161411 161453 161459 161461 161471 161503 161507 161521 161527 161531 161543 
+161561 161563 161569 161573 161591 161599 161611 161627 161639 161641 161659 161683 
+161717 161729 161731 161741 161743 161753 161761 161771 161773 161779 161783 161807 
+161831 161839 161869 161873 161879 161881 161911 161921 161923 161947 161957 161969 
+161971 161977 161983 161999 162007 162011 162017 162053 162059 162079 162091 162109 
+162119 162143 162209 162221 162229 162251 162257 162263 162269 162277 162287 162289 
+162293 162343 162359 162389 162391 162413 162419 162439 162451 162457 162473 162493 
+162499 162517 162523 162527 162529 162553 162557 162563 162577 162593 162601 162611 
+162623 162629 162641 162649 162671 162677 162683 162691 162703 162709 162713 162727 
+162731 162739 162749 162751 162779 162787 162791 162821 162823 162829 162839 162847 
+162853 162859 162881 162889 162901 162907 162917 162937 162947 162971 162973 162989 
+162997 163003 163019 163021 163027 163061 163063 163109 163117 163127 163129 163147 
+163151 163169 163171 163181 163193 163199 163211 163223 163243 163249 163259 163307 
+163309 163321 163327 163337 163351 163363 163367 163393 163403 163409 163411 163417 
+163433 163469 163477 163481 163483 163487 163517 163543 163561 163567 163573 163601 
+163613 163621 163627 163633 163637 163643 163661 163673 163679 163697 163729 163733 
+163741 163753 163771 163781 163789 163811 163819 163841 163847 163853 163859 163861 
+163871 163883 163901 163909 163927 163973 163979 163981 163987 163991 163993 163997 
+164011 164023 164039 164051 164057 164071 164089 164093 164113 164117 164147 164149 
+164173 164183 164191 164201 164209 164231 164233 164239 164249 164251 164267 164279 
+164291 164299 164309 164321 164341 164357 164363 164371 164377 164387 164413 164419 
+164429 164431 164443 164447 164449 164471 164477 164503 164513 164531 164569 164581 
+164587 164599 164617 164621 164623 164627 164653 164663 164677 164683 164701 164707 
+164729 164743 164767 164771 164789 164809 164821 164831 164837 164839 164881 164893 
+164911 164953 164963 164987 164999 165001 165037 165041 165047 165049 165059 165079 
+165083 165089 165103 165133 165161 165173 165181 165203 165211 165229 165233 165247 
+165287 165293 165311 165313 165317 165331 165343 165349 165367 165379 165383 165391 
+165397 165437 165443 165449 165457 165463 165469 165479 165511 165523 165527 165533 
+165541 165551 165553 165559 165569 165587 165589 165601 165611 165617 165653 165667 
+165673 165701 165703 165707 165709 165713 165719 165721 165749 165779 165799 165811 
+165817 165829 165833 165857 165877 165883 165887 165901 165931 165941 165947 165961 
+165983 166013 166021 166027 166031 166043 166063 166081 166099 166147 166151 166157 
+166169 166183 166189 166207 166219 166237 166247 166259 166273 166289 166297 166301 
+166303 166319 166349 166351 166357 166363 166393 166399 166403 166409 166417 166429 
+166457 166471 166487 166541 166561 166567 166571 166597 166601 166603 166609 166613 
+166619 166627 166631 166643 166657 166667 166669 166679 166693 166703 166723 166739 
+166741 166781 166783 166799 166807 166823 166841 166843 166847 166849 166853 166861 
+166867 166871 166909 166919 166931 166949 166967 166973 166979 166987 167009 167017 
+167021 167023 167033 167039 167047 167051 167071 167077 167081 167087 167099 167107 
+167113 167117 167119 167149 167159 167173 167177 167191 167197 167213 167221 167249 
+167261 167267 167269 167309 167311 167317 167329 167339 167341 167381 167393 167407 
+167413 167423 167429 167437 167441 167443 167449 167471 167483 167491 167521 167537 
+167543 167593 167597 167611 167621 167623 167627 167633 167641 167663 167677 167683 
+167711 167729 167747 167759 167771 167777 167779 167801 167809 167861 167863 167873 
+167879 167887 167891 167899 167911 167917 167953 167971 167987 168013 168023 168029 
+168037 168043 168067 168071 168083 168089 168109 168127 168143 168151 168193 168197 
+168211 168227 168247 168253 168263 168269 168277 168281 168293 168323 168331 168347 
+168353 168391 168409 168433 168449 168451 168457 168463 168481 168491 168499 168523 
+168527 168533 168541 168559 168599 168601 168617 168629 168631 168643 168673 168677 
+168697 168713 168719 168731 168737 168743 168761 168769 168781 168803 168851 168863 
+168869 168887 168893 168899 168901 168913 168937 168943 168977 168991 169003 169007 
+169009 169019 169049 169063 169067 169069 169079 169093 169097 169111 169129 169151 
+169159 169177 169181 169199 169217 169219 169241 169243 169249 169259 169283 169307 
+169313 169319 169321 169327 169339 169343 169361 169369 169373 169399 169409 169427 
+169457 169471 169483 169489 169493 169501 169523 169531 169553 169567 169583 169591 
+169607 169627 169633 169639 169649 169657 169661 169667 169681 169691 169693 169709 
+169733 169751 169753 169769 169777 169783 169789 169817 169823 169831 169837 169843 
+169859 169889 169891 169909 169913 169919 169933 169937 169943 169951 169957 169987 
+169991 170003 170021 170029 170047 170057 170063 170081 170099 170101 170111 170123 
+170141 170167 170179 170189 170197 170207 170213 170227 170231 170239 170243 170249 
+170263 170267 170279 170293 170299 170327 170341 170347 170351 170353 170363 170369 
+170371 170383 170389 170393 170413 170441 170447 170473 170483 170497 170503 170509 
+170537 170539 170551 170557 170579 170603 170609 170627 170633 170641 170647 170669 
+170689 170701 170707 170711 170741 170749 170759 170761 170767 170773 170777 170801 
+170809 170813 170827 170837 170843 170851 170857 170873 170881 170887 170899 170921 
+170927 170953 170957 170971 171007 171023 171029 171043 171047 171049 171053 171077 
+171079 171091 171103 171131 171161 171163 171167 171169 171179 171203 171233 171251 
+171253 171263 171271 171293 171299 171317 171329 171341 171383 171401 171403 171427 
+171439 171449 171467 171469 171473 171481 171491 171517 171529 171539 171541 171553 
+171559 171571 171583 171617 171629 171637 171641 171653 171659 171671 171673 171679 
+171697 171707 171713 171719 171733 171757 171761 171763 171793 171799 171803 171811 
+171823 171827 171851 171863 171869 171877 171881 171889 171917 171923 171929 171937 
+171947 172001 172009 172021 172027 172031 172049 172069 172079 172093 172097 172127 
+172147 172153 172157 172169 172171 172181 172199 172213 172217 172219 172223 172243 
+172259 172279 172283 172297 172307 172313 172321 172331 172343 172351 172357 172373 
+172399 172411 172421 172423 172427 172433 172439 172441 172489 172507 172517 172519 
+172541 172553 172561 172573 172583 172589 172597 172603 172607 172619 172633 172643 
+172649 172657 172663 172673 172681 172687 172709 172717 172721 172741 172751 172759 
+172787 172801 172807 172829 172849 172853 172859 172867 172871 172877 172883 172933 
+172969 172973 172981 172987 172993 172999 173021 173023 173039 173053 173059 173081 
+173087 173099 173137 173141 173149 173177 173183 173189 173191 173207 173209 173219 
+173249 173263 173267 173273 173291 173293 173297 173309 173347 173357 173359 173429 
+173431 173473 173483 173491 173497 173501 173531 173539 173543 173549 173561 173573 
+173599 173617 173629 173647 173651 173659 173669 173671 173683 173687 173699 173707 
+173713 173729 173741 173743 173773 173777 173779 173783 173807 173819 173827 173839 
+173851 173861 173867 173891 173897 173909 173917 173923 173933 173969 173977 173981 
+173993 174007 174017 174019 174047 174049 174061 174067 174071 174077 174079 174091 
+174101 174121 174137 174143 174149 174157 174169 174197 174221 174241 174257 174259 
+174263 174281 174289 174299 174311 174329 174331 174337 174347 174367 174389 174407 
+174413 174431 174443 174457 174467 174469 174481 174487 174491 174527 174533 174569 
+174571 174583 174599 174613 174617 174631 174637 174649 174653 174659 174673 174679 
+174703 174721 174737 174749 174761 174763 174767 174773 174799 174821 174829 174851 
+174859 174877 174893 174901 174907 174917 174929 174931 174943 174959 174989 174991 
+175003 175013 175039 175061 175067 175069 175079 175081 175103 175129 175141 175211 
+175229 175261 175267 175277 175291 175303 175309 175327 175333 175349 175361 175391 
+175393 175403 175411 175433 175447 175453 175463 175481 175493 175499 175519 175523 
+175543 175573 175601 175621 175631 175633 175649 175663 175673 175687 175691 175699 
+175709 175723 175727 175753 175757 175759 175781 175783 175811 175829 175837 175843 
+175853 175859 175873 175891 175897 175909 175919 175937 175939 175949 175961 175963 
+175979 175991 175993 176017 176021 176023 176041 176047 176051 176053 176063 176081 
+176087 176089 176123 176129 176153 176159 176161 176179 176191 176201 176207 176213 
+176221 176227 176237 176243 176261 176299 176303 176317 176321 176327 176329 176333 
+176347 176353 176357 176369 176383 176389 176401 176413 176417 176419 176431 176459 
+176461 176467 176489 176497 176503 176507 176509 176521 176531 176537 176549 176551 
+176557 176573 176591 176597 176599 176609 176611 176629 176641 176651 176677 176699 
+176711 176713 176741 176747 176753 176777 176779 176789 176791 176797 176807 176809 
+176819 176849 176857 176887 176899 176903 176921 176923 176927 176933 176951 176977 
+176983 176989 177007 177011 177013 177019 177043 177091 177101 177109 177113 177127 
+177131 177167 177173 177209 177211 177217 177223 177239 177257 177269 177283 177301 
+177319 177323 177337 177347 177379 177383 177409 177421 177427 177431 177433 177467 
+177473 177481 177487 177493 177511 177533 177539 177553 177589 177601 177623 177647 
+177677 177679 177691 177739 177743 177761 177763 177787 177791 177797 177811 177823 
+177839 177841 177883 177887 177889 177893 177907 177913 177917 177929 177943 177949 
+177953 177967 177979 178001 178021 178037 178039 178067 178069 178091 178093 178103 
+178117 178127 178141 178151 178169 178183 178187 178207 178223 178231 178247 178249 
+178259 178261 178289 178301 178307 178327 178333 178349 178351 178361 178393 178397 
+178403 178417 178439 178441 178447 178469 178481 178487 178489 178501 178513 178531 
+178537 178559 178561 178567 178571 178597 178601 178603 178609 178613 178621 178627 
+178639 178643 178681 178691 178693 178697 178753 178757 178781 178793 178799 178807 
+178813 178817 178819 178831 178853 178859 178873 178877 178889 178897 178903 178907 
+178909 178921 178931 178933 178939 178951 178973 178987 179021 179029 179033 179041 
+179051 179057 179083 179089 179099 179107 179111 179119 179143 179161 179167 179173 
+179203 179209 179213 179233 179243 179261 179269 179281 179287 179317 179321 179327 
+179351 179357 179369 179381 179383 179393 179407 179411 179429 179437 179441 179453 
+179461 179471 179479 179483 179497 179519 179527 179533 179549 179563 179573 179579 
+179581 179591 179593 179603 179623 179633 179651 179657 179659 179671 179687 179689 
+179693 179717 179719 179737 179743 179749 179779 179801 179807 179813 179819 179821 
+179827 179833 179849 179897 179899 179903 179909 179917 179923 179939 179947 179951 
+179953 179957 179969 179981 179989 179999 180001 180007 180023 180043 180053 180071 
+180073 180077 180097 180137 180161 180179 180181 180211 180221 180233 180239 180241 
+180247 180259 180263 180281 180287 180289 180307 180311 180317 180331 180337 180347 
+180361 180371 180379 180391 180413 180419 180437 180463 180473 180491 180497 180503 
+180511 180533 180539 180541 180547 180563 180569 180617 180623 180629 180647 180667 
+180679 180701 180731 180749 180751 180773 180779 180793 180797 180799 180811 180847 
+180871 180883 180907 180949 180959 181001 181003 181019 181031 181039 181061 181063 
+181081 181087 181123 181141 181157 181183 181193 181199 181201 181211 181213 181219 
+181243 181253 181273 181277 181283 181297 181301 181303 181361 181387 181397 181399 
+181409 181421 181439 181457 181459 181499 181501 181513 181523 181537 181549 181553 
+181603 181607 181609 181619 181639 181667 181669 181693 181711 181717 181721 181729 
+181739 181751 181757 181759 181763 181777 181787 181789 181813 181837 181871 181873 
+181889 181891 181903 181913 181919 181927 181931 181943 181957 181967 181981 181997 
+182009 182011 182027 182029 182041 182047 182057 182059 182089 182099 182101 182107 
+182111 182123 182129 182131 182141 182159 182167 182177 182179 182201 182209 182233 
+182239 182243 182261 182279 182297 182309 182333 182339 182341 182353 182387 182389 
+182417 182423 182431 182443 182453 182467 182471 182473 182489 182503 182509 182519 
+182537 182549 182561 182579 182587 182593 182599 182603 182617 182627 182639 182641 
+182653 182657 182659 182681 182687 182701 182711 182713 182747 182773 182779 182789 
+182803 182813 182821 182839 182851 182857 182867 182887 182893 182899 182921 182927 
+182929 182933 182953 182957 182969 182981 182999 183023 183037 183041 183047 183059 
+183067 183089 183091 183119 183151 183167 183191 183203 183247 183259 183263 183283 
+183289 183299 183301 183307 183317 183319 183329 183343 183349 183361 183373 183377 
+183383 183389 183397 183437 183439 183451 183461 183473 183479 183487 183497 183499 
+183503 183509 183511 183523 183527 183569 183571 183577 183581 183587 183593 183611 
+183637 183661 183683 183691 183697 183707 183709 183713 183761 183763 183797 183809 
+183823 183829 183871 183877 183881 183907 183917 183919 183943 183949 183959 183971 
+183973 183979 184003 184007 184013 184031 184039 184043 184057 184073 184081 184087 
+184111 184117 184133 184153 184157 184181 184187 184189 184199 184211 184231 184241 
+184259 184271 184273 184279 184291 184309 184321 184333 184337 184351 184369 184409 
+184417 184441 184447 184463 184477 184487 184489 184511 184517 184523 184553 184559 
+184567 184571 184577 184607 184609 184627 184631 184633 184649 184651 184669 184687 
+184693 184703 184711 184721 184727 184733 184753 184777 184823 184829 184831 184837 
+184843 184859 184879 184901 184903 184913 184949 184957 184967 184969 184993 184997 
+184999 185021 185027 185051 185057 185063 185069 185071 185077 185089 185099 185123 
+185131 185137 185149 185153 185161 185167 185177 185183 185189 185221 185233 185243 
+185267 185291 185299 185303 185309 185323 185327 185359 185363 185369 185371 185401 
+185429 185441 185467 185477 185483 185491 185519 185527 185531 185533 185539 185543 
+185551 185557 185567 185569 185593 185599 185621 185641 185651 185677 185681 185683 
+185693 185699 185707 185711 185723 185737 185747 185749 185753 185767 185789 185797 
+185813 185819 185821 185831 185833 185849 185869 185873 185893 185897 185903 185917 
+185923 185947 185951 185957 185959 185971 185987 185993 186007 186013 186019 186023 
+186037 186041 186049 186071 186097 186103 186107 186113 186119 186149 186157 186161 
+186163 186187 186191 186211 186227 186229 186239 186247 186253 186259 186271 186283 
+186299 186301 186311 186317 186343 186377 186379 186391 186397 186419 186437 186451 
+186469 186479 186481 186551 186569 186581 186583 186587 186601 186619 186629 186647 
+186649 186653 186671 186679 186689 186701 186707 186709 186727 186733 186743 186757 
+186761 186763 186773 186793 186799 186841 186859 186869 186871 186877 186883 186889 
+186917 186947 186959 187003 187009 187027 187043 187049 187067 187069 187073 187081 
+187091 187111 187123 187127 187129 187133 187139 187141 187163 187171 187177 187181 
+187189 187193 187211 187217 187219 187223 187237 187273 187277 187303 187337 187339 
+187349 187361 187367 187373 187379 187387 187393 187409 187417 187423 187433 187441 
+187463 187469 187471 187477 187507 187513 187531 187547 187559 187573 187597 187631 
+187633 187637 187639 187651 187661 187669 187687 187699 187711 187721 187751 187763 
+187787 187793 187823 187843 187861 187871 187877 187883 187897 187907 187909 187921 
+187927 187931 187951 187963 187973 187987 188011 188017 188021 188029 188107 188137 
+188143 188147 188159 188171 188179 188189 188197 188249 188261 188273 188281 188291 
+188299 188303 188311 188317 188323 188333 188351 188359 188369 188389 188401 188407 
+188417 188431 188437 188443 188459 188473 188483 188491 188519 188527 188533 188563 
+188579 188603 188609 188621 188633 188653 188677 188681 188687 188693 188701 188707 
+188711 188719 188729 188753 188767 188779 188791 188801 188827 188831 188833 188843 
+188857 188861 188863 188869 188891 188911 188927 188933 188939 188941 188953 188957 
+188983 188999 189011 189017 189019 189041 189043 189061 189067 189127 189139 189149 
+189151 189169 189187 189199 189223 189229 189239 189251 189253 189257 189271 189307 
+189311 189337 189347 189349 189353 189361 189377 189389 189391 189401 189407 189421 
+189433 189437 189439 189463 189467 189473 189479 189491 189493 189509 189517 189523 
+189529 189547 189559 189583 189593 189599 189613 189617 189619 189643 189653 189661 
+189671 189691 189697 189701 189713 189733 189743 189757 189767 189797 189799 189817 
+189823 189851 189853 189859 189877 189881 189887 189901 189913 189929 189947 189949 
+189961 189967 189977 189983 189989 189997 190027 190031 190051 190063 190093 190097 
+190121 190129 190147 190159 190181 190207 190243 190249 190261 190271 190283 190297 
+190301 190313 190321 190331 190339 190357 190367 190369 190387 190391 190403 190409 
+190471 190507 190523 190529 190537 190543 190573 190577 190579 190583 190591 190607 
+190613 190633 190639 190649 190657 190667 190669 190699 190709 190711 190717 190753 
+190759 190763 190769 190783 190787 190793 190807 190811 190823 190829 190837 190843 
+190871 190889 190891 190901 190909 190913 190921 190979 190997 191021 191027 191033 
+191039 191047 191057 191071 191089 191099 191119 191123 191137 191141 191143 191161 
+191173 191189 191227 191231 191237 191249 191251 191281 191297 191299 191339 191341 
+191353 191413 191441 191447 191449 191453 191459 191461 191467 191473 191491 191497 
+191507 191509 191519 191531 191533 191537 191551 191561 191563 191579 191599 191621 
+191627 191657 191669 191671 191677 191689 191693 191699 191707 191717 191747 191749 
+191773 191783 191791 191801 191803 191827 191831 191833 191837 191861 191899 191903 
+191911 191929 191953 191969 191977 191999 192007 192013 192029 192037 192043 192047 
+192053 192091 192097 192103 192113 192121 192133 192149 192161 192173 192187 192191 
+192193 192229 192233 192239 192251 192259 192263 192271 192307 192317 192319 192323 
+192341 192343 192347 192373 192377 192383 192391 192407 192431 192461 192463 192497 
+192499 192529 192539 192547 192553 192557 192571 192581 192583 192587 192601 192611 
+192613 192617 192629 192631 192637 192667 192677 192697 192737 192743 192749 192757 
+192767 192781 192791 192799 192811 192817 192833 192847 192853 192859 192877 192883 
+192887 192889 192917 192923 192931 192949 192961 192971 192977 192979 192991 193003 
+193009 193013 193031 193043 193051 193057 193073 193093 193133 193139 193147 193153 
+193163 193181 193183 193189 193201 193243 193247 193261 193283 193301 193327 193337 
+193357 193367 193373 193379 193381 193387 193393 193423 193433 193441 193447 193451 
+193463 193469 193493 193507 193513 193541 193549 193559 193573 193577 193597 193601 
+193603 193607 193619 193649 193663 193679 193703 193723 193727 193741 193751 193757 
+193763 193771 193789 193793 193799 193811 193813 193841 193847 193859 193861 193871 
+193873 193877 193883 193891 193937 193939 193943 193951 193957 193979 193993 194003 
+194017 194027 194057 194069 194071 194083 194087 194093 194101 194113 194119 194141 
+194149 194167 194179 194197 194203 194239 194263 194267 194269 194309 194323 194353 
+194371 194377 194413 194431 194443 194471 194479 194483 194507 194521 194527 194543 
+194569 194581 194591 194609 194647 194653 194659 194671 194681 194683 194687 194707 
+194713 194717 194723 194729 194749 194767 194771 194809 194813 194819 194827 194839 
+194861 194863 194867 194869 194891 194899 194911 194917 194933 194963 194977 194981 
+194989 195023 195029 195043 195047 195049 195053 195071 195077 195089 195103 195121 
+195127 195131 195137 195157 195161 195163 195193 195197 195203 195229 195241 195253 
+195259 195271 195277 195281 195311 195319 195329 195341 195343 195353 195359 195389 
+195401 195407 195413 195427 195443 195457 195469 195479 195493 195497 195511 195527 
+195539 195541 195581 195593 195599 195659 195677 195691 195697 195709 195731 195733 
+195737 195739 195743 195751 195761 195781 195787 195791 195809 195817 195863 195869 
+195883 195887 195893 195907 195913 195919 195929 195931 195967 195971 195973 195977 
+195991 195997 196003 196033 196039 196043 196051 196073 196081 196087 196111 196117 
+196139 196159 196169 196171 196177 196181 196187 196193 196201 196247 196271 196277 
+196279 196291 196303 196307 196331 196337 196379 196387 196429 196439 196453 196459 
+196477 196499 196501 196519 196523 196541 196543 196549 196561 196579 196583 196597 
+196613 196643 196657 196661 196663 196681 196687 196699 196709 196717 196727 196739 
+196751 196769 196771 196799 196817 196831 196837 196853 196871 196873 196879 196901 
+196907 196919 196927 196961 196991 196993 197003 197009 197023 197033 197059 197063 
+197077 197083 197089 197101 197117 197123 197137 197147 197159 197161 197203 197207 
+197221 197233 197243 197257 197261 197269 197273 197279 197293 197297 197299 197311 
+197339 197341 197347 197359 197369 197371 197381 197383 197389 197419 197423 197441 
+197453 197479 197507 197521 197539 197551 197567 197569 197573 197597 197599 197609 
+197621 197641 197647 197651 197677 197683 197689 197699 197711 197713 197741 197753 
+197759 197767 197773 197779 197803 197807 197831 197837 197887 197891 197893 197909 
+197921 197927 197933 197947 197957 197959 197963 197969 197971 198013 198017 198031 
+198043 198047 198073 198083 198091 198097 198109 198127 198139 198173 198179 198193 
+198197 198221 198223 198241 198251 198257 198259 198277 198281 198301 198313 198323 
+198337 198347 198349 198377 198391 198397 198409 198413 198427 198437 198439 198461 
+198463 198469 198479 198491 198503 198529 198533 198553 198571 198589 198593 198599 
+198613 198623 198637 198641 198647 198659 198673 198689 198701 198719 198733 198761 
+198769 198811 198817 198823 198827 198829 198833 198839 198841 198851 198859 198899 
+198901 198929 198937 198941 198943 198953 198959 198967 198971 198977 198997 199021 
+199033 199037 199039 199049 199081 199103 199109 199151 199153 199181 199193 199207 
+199211 199247 199261 199267 199289 199313 199321 199337 199343 199357 199373 199379 
+199399 199403 199411 199417 199429 199447 199453 199457 199483 199487 199489 199499 
+199501 199523 199559 199567 199583 199601 199603 199621 199637 199657 199669 199673 
+199679 199687 199697 199721 199729 199739 199741 199751 199753 199777 199783 199799 
+199807 199811 199813 199819 199831 199853 199873 199877 199889 199909 199921 199931 
+199933 199961 199967 199999 200003 200009 200017 200023 200029 200033 200041 200063 
+200087 200117 200131 200153 200159 200171 200177 200183 200191 200201 200227 200231 
+200237 200257 200273 200293 200297 200323 200329 200341 200351 200357 200363 200371 
+200381 200383 200401 200407 200437 200443 200461 200467 200483 200513 200569 200573 
+200579 200587 200591 200597 200609 200639 200657 200671 200689 200699 200713 200723 
+200731 200771 200779 200789 200797 200807 200843 200861 200867 200869 200881 200891 
+200899 200903 200909 200927 200929 200971 200983 200987 200989 201007 201011 201031 
+201037 201049 201073 201101 201107 201119 201121 201139 201151 201163 201167 201193 
+201203 201209 201211 201233 201247 201251 201281 201287 201307 201329 201337 201359 
+201389 201401 201403 201413 201437 201449 201451 201473 201491 201493 201497 201499 
+201511 201517 201547 201557 201577 201581 201589 201599 201611 201623 201629 201653 
+201661 201667 201673 201683 201701 201709 201731 201743 201757 201767 201769 201781 
+201787 201791 201797 201809 201821 201823 201827 201829 201833 201847 201881 201889 
+201893 201907 201911 201919 201923 201937 201947 201953 201961 201973 201979 201997 
+202001 202021 202031 202049 202061 202063 202067 202087 202099 202109 202121 202127 
+202129 202183 202187 202201 202219 202231 202243 202277 202289 202291 202309 202327 
+202339 202343 202357 202361 202381 202387 202393 202403 202409 202441 202471 202481 
+202493 202519 202529 202549 202567 202577 202591 202613 202621 202627 202637 202639 
+202661 202667 202679 202693 202717 202729 202733 202747 202751 202753 202757 202777 
+202799 202817 202823 202841 202859 202877 202879 202889 202907 202921 202931 202933 
+202949 202967 202973 202981 202987 202999 203011 203017 203023 203039 203051 203057 
+203117 203141 203173 203183 203207 203209 203213 203221 203227 203233 203249 203279 
+203293 203309 203311 203317 203321 203323 203339 203341 203351 203353 203363 203381 
+203383 203387 203393 203417 203419 203429 203431 203449 203459 203461 203531 203549 
+203563 203569 203579 203591 203617 203627 203641 203653 203657 203659 203663 203669 
+203713 203761 203767 203771 203773 203789 203807 203809 203821 203843 203857 203869 
+203873 203897 203909 203911 203921 203947 203953 203969 203971 203977 203989 203999 
+204007 204013 204019 204023 204047 204059 204067 204101 204107 204133 204137 204143 
+204151 204161 204163 204173 204233 204251 204299 204301 204311 204319 204329 204331 
+204353 204359 204361 204367 204371 204377 204397 204427 204431 204437 204439 204443 
+204461 204481 204487 204509 204511 204517 204521 204557 204563 204583 204587 204599 
+204601 204613 204623 204641 204667 204679 204707 204719 204733 204749 204751 204781 
+204791 204793 204797 204803 204821 204857 204859 204871 204887 204913 204917 204923 
+204931 204947 204973 204979 204983 205019 205031 205033 205043 205063 205069 205081 
+205097 205103 205111 205129 205133 205141 205151 205157 205171 205187 205201 205211 
+205213 205223 205237 205253 205267 205297 205307 205319 205327 205339 205357 205391 
+205397 205399 205417 205421 205423 205427 205433 205441 205453 205463 205477 205483 
+205487 205493 205507 205519 205529 205537 205549 205553 205559 205589 205603 205607 
+205619 205627 205633 205651 205657 205661 205663 205703 205721 205759 205763 205783 
+205817 205823 205837 205847 205879 205883 205913 205937 205949 205951 205957 205963 
+205967 205981 205991 205993 206009 206021 206027 206033 206039 206047 206051 206069 
+206077 206081 206083 206123 206153 206177 206179 206183 206191 206197 206203 206209 
+206221 206233 206237 206249 206251 206263 206273 206279 206281 206291 206299 206303 
+206341 206347 206351 206369 206383 206399 206407 206411 206413 206419 206447 206461 
+206467 206477 206483 206489 206501 206519 206527 206543 206551 206593 206597 206603 
+206623 206627 206639 206641 206651 206699 206749 206779 206783 206803 206807 206813 
+206819 206821 206827 206879 206887 206897 206909 206911 206917 206923 206933 206939 
+206951 206953 206993 207013 207017 207029 207037 207041 207061 207073 207079 207113 
+207121 207127 207139 207169 207187 207191 207197 207199 207227 207239 207241 207257 
+207269 207287 207293 207301 207307 207329 207331 207341 207343 207367 207371 207377 
+207401 207409 207433 207443 207457 207463 207469 207479 207481 207491 207497 207509 
+207511 207517 207521 207523 207541 207547 207551 207563 207569 207589 207593 207619 
+207629 207643 207653 207661 207671 207673 207679 207709 207719 207721 207743 207763 
+207769 207797 207799 207811 207821 207833 207847 207869 207877 207923 207931 207941 
+207947 207953 207967 207971 207973 207997 208001 208003 208009 208037 208049 208057 
+208067 208073 208099 208111 208121 208129 208139 208141 208147 208189 208207 208213 
+208217 208223 208231 208253 208261 208277 208279 208283 208291 208309 208319 208333 
+208337 208367 208379 208387 208391 208393 208409 208433 208441 208457 208459 208463 
+208469 208489 208493 208499 208501 208511 208513 208519 208529 208553 208577 208589 
+208591 208609 208627 208631 208657 208667 208673 208687 208697 208699 208721 208729 
+208739 208759 208787 208799 208807 208837 208843 208877 208889 208891 208907 208927 
+208931 208933 208961 208963 208991 208993 208997 209021 209029 209039 209063 209071 
+209089 209123 209147 209159 209173 209179 209189 209201 209203 209213 209221 209227 
+209233 209249 209257 209263 209267 209269 209299 209311 209317 209327 209333 209347 
+209353 209357 209359 209371 209381 209393 209401 209431 209441 209449 209459 209471 
+209477 209497 209519 209533 209543 209549 209563 209567 209569 209579 209581 209597 
+209621 209623 209639 209647 209659 209669 209687 209701 209707 209717 209719 209743 
+209767 209771 209789 209801 209809 209813 209819 209821 209837 209851 209857 209861 
+209887 209917 209927 209929 209939 209953 209959 209971 209977 209983 209987 210011 
+210019 210031 210037 210053 210071 210097 210101 210109 210113 210127 210131 210139 
+210143 210157 210169 210173 210187 210191 210193 210209 210229 210233 210241 210247 
+210257 210263 210277 210283 210299 210317 210319 210323 210347 210359 210361 210391 
+210401 210403 210407 210421 210437 210461 210467 210481 210487 210491 210499 210523 
+210527 210533 210557 210599 210601 210619 210631 210643 210659 210671 210709 210713 
+210719 210731 210739 210761 210773 210803 210809 210811 210823 210827 210839 210853 
+210857 210869 210901 210907 210911 210913 210923 210929 210943 210961 210967 211007 
+211039 211049 211051 211061 211063 211067 211073 211093 211097 211129 211151 211153 
+211177 211187 211193 211199 211213 211217 211219 211229 211231 211241 211247 211271 
+211283 211291 211297 211313 211319 211333 211339 211349 211369 211373 211403 211427 
+211433 211441 211457 211469 211493 211499 211501 211507 211543 211559 211571 211573 
+211583 211597 211619 211639 211643 211657 211661 211663 211681 211691 211693 211711 
+211723 211727 211741 211747 211777 211781 211789 211801 211811 211817 211859 211867 
+211873 211877 211879 211889 211891 211927 211931 211933 211943 211949 211969 211979 
+211997 212029 212039 212057 212081 212099 212117 212123 212131 212141 212161 212167 
+212183 212203 212207 212209 212227 212239 212243 212281 212293 212297 212353 212369 
+212383 212411 212419 212423 212437 212447 212453 212461 212467 212479 212501 212507 
+212557 212561 212573 212579 212587 212593 212627 212633 212651 212669 212671 212677 
+212683 212701 212777 212791 212801 212827 212837 212843 212851 212867 212869 212873 
+212881 212897 212903 212909 212917 212923 212969 212981 212987 212999 213019 213023 
+213029 213043 213067 213079 213091 213097 213119 213131 213133 213139 213149 213173 
+213181 213193 213203 213209 213217 213223 213229 213247 213253 213263 213281 213287 
+213289 213307 213319 213329 213337 213349 213359 213361 213383 213391 213397 213407 
+213449 213461 213467 213481 213491 213523 213533 213539 213553 213557 213589 213599 
+213611 213613 213623 213637 213641 213649 213659 213713 213721 213727 213737 213751 
+213791 213799 213821 213827 213833 213847 213859 213881 213887 213901 213919 213929 
+213943 213947 213949 213953 213973 213977 213989 214003 214007 214009 214021 214031 
+214033 214043 214051 214063 214069 214087 214091 214129 214133 214141 214147 214163 
+214177 214189 214211 214213 214219 214237 214243 214259 214283 214297 214309 214351 
+214363 214373 214381 214391 214399 214433 214439 214451 214457 214463 214469 214481 
+214483 214499 214507 214517 214519 214531 214541 214559 214561 214589 214603 214607 
+214631 214639 214651 214657 214663 214667 214673 214691 214723 214729 214733 214741 
+214759 214763 214771 214783 214787 214789 214807 214811 214817 214831 214849 214853 
+214867 214883 214891 214913 214939 214943 214967 214987 214993 215051 215063 215077 
+215087 215123 215141 215143 215153 215161 215179 215183 215191 215197 215239 215249 
+215261 215273 215279 215297 215309 215317 215329 215351 215353 215359 215381 215389 
+215393 215399 215417 215443 215447 215459 215461 215471 215483 215497 215503 215507 
+215521 215531 215563 215573 215587 215617 215653 215659 215681 215687 215689 215693 
+215723 215737 215753 215767 215771 215797 215801 215827 215833 215843 215851 215857 
+215863 215893 215899 215909 215921 215927 215939 215953 215959 215981 215983 216023 
+216037 216061 216071 216091 216103 216107 216113 216119 216127 216133 216149 216157 
+216173 216179 216211 216217 216233 216259 216263 216289 216317 216319 216329 216347 
+216371 216373 216379 216397 216401 216421 216431 216451 216481 216493 216509 216523 
+216551 216553 216569 216571 216577 216607 216617 216641 216647 216649 216653 216661 
+216679 216703 216719 216731 216743 216751 216757 216761 216779 216781 216787 216791 
+216803 216829 216841 216851 216859 216877 216899 216901 216911 216917 216919 216947 
+216967 216973 216991 217001 217003 217027 217033 217057 217069 217081 217111 217117 
+217121 217157 217163 217169 217199 217201 217207 217219 217223 217229 217241 217253 
+217271 217307 217309 217313 217319 217333 217337 217339 217351 217361 217363 217367 
+217369 217387 217397 217409 217411 217421 217429 217439 217457 217463 217489 217499 
+217517 217519 217559 217561 217573 217577 217579 217619 217643 217661 217667 217681 
+217687 217691 217697 217717 217727 217733 217739 217747 217771 217781 217793 217823 
+217829 217849 217859 217901 217907 217909 217933 217937 217969 217979 217981 218003 
+218021 218047 218069 218077 218081 218083 218087 218107 218111 218117 218131 218137 
+218143 218149 218171 218191 218213 218227 218233 218249 218279 218287 218357 218363 
+218371 218381 218389 218401 218417 218419 218423 218437 218447 218453 218459 218461 
+218479 218509 218513 218521 218527 218531 218549 218551 218579 218591 218599 218611 
+218623 218627 218629 218641 218651 218657 218677 218681 218711 218717 218719 218723 
+218737 218749 218761 218783 218797 218809 218819 218833 218839 218843 218849 218857 
+218873 218887 218923 218941 218947 218963 218969 218971 218987 218989 218993 219001 
+219017 219019 219031 219041 219053 219059 219071 219083 219091 219097 219103 219119 
+219133 219143 219169 219187 219217 219223 219251 219277 219281 219293 219301 219311 
+219313 219353 219361 219371 219377 219389 219407 219409 219433 219437 219451 219463 
+219467 219491 219503 219517 219523 219529 219533 219547 219577 219587 219599 219607 
+219613 219619 219629 219647 219649 219677 219679 219683 219689 219707 219721 219727 
+219731 219749 219757 219761 219763 219767 219787 219797 219799 219809 219823 219829 
+219839 219847 219851 219871 219881 219889 219911 219917 219931 219937 219941 219943 
+219953 219959 219971 219977 219979 219983 220009 220013 220019 220021 220057 220063 
+220123 220141 220147 220151 220163 220169 220177 220189 220217 220243 220279 220291 
+220301 220307 220327 220333 220351 220357 220361 220369 220373 220391 220399 220403 
+220411 220421 220447 220469 220471 220511 220513 220529 220537 220543 220553 220559 
+220573 220579 220589 220613 220663 220667 220673 220681 220687 220699 220709 220721 
+220747 220757 220771 220783 220789 220793 220807 220811 220841 220859 220861 220873 
+220877 220879 220889 220897 220901 220903 220907 220919 220931 220933 220939 220973 
+221021 221047 221059 221069 221071 221077 221083 221087 221093 221101 221159 221171 
+221173 221197 221201 221203 221209 221219 221227 221233 221239 221251 221261 221281 
+221303 221311 221317 221327 221393 221399 221401 221411 221413 221447 221453 221461 
+221471 221477 221489 221497 221509 221537 221539 221549 221567 221581 221587 221603 
+221621 221623 221653 221657 221659 221671 221677 221707 221713 221717 221719 221723 
+221729 221737 221747 221773 221797 221807 221813 221827 221831 221849 221873 221891 
+221909 221941 221951 221953 221957 221987 221989 221999 222007 222011 222023 222029 
+222041 222043 222059 222067 222073 222107 222109 222113 222127 222137 222149 222151 
+222161 222163 222193 222197 222199 222247 222269 222289 222293 222311 222317 222323 
+222329 222337 222347 222349 222361 222367 222379 222389 222403 222419 222437 222461 
+222493 222499 222511 222527 222533 222553 222557 222587 222601 222613 222619 222643 
+222647 222659 222679 222707 222713 222731 222773 222779 222787 222791 222793 222799 
+222823 222839 222841 222857 222863 222877 222883 222913 222919 222931 222941 222947 
+222953 222967 222977 222979 222991 223007 223009 223019 223037 223049 223051 223061 
+223063 223087 223099 223103 223129 223133 223151 223207 223211 223217 223219 223229 
+223241 223243 223247 223253 223259 223273 223277 223283 223291 223303 223313 223319 
+223331 223337 223339 223361 223367 223381 223403 223423 223429 223439 223441 223463 
+223469 223481 223493 223507 223529 223543 223547 223549 223577 223589 223621 223633 
+223637 223667 223679 223681 223697 223711 223747 223753 223757 223759 223781 223823 
+223829 223831 223837 223841 223843 223849 223903 223919 223921 223939 223963 223969 
+223999 224011 224027 224033 224041 224047 224057 224069 224071 224101 224113 224129 
+224131 224149 224153 224171 224177 224197 224201 224209 224221 224233 224239 224251 
+224261 224267 224291 224299 224303 224309 224317 224327 224351 224359 224363 224401 
+224423 224429 224443 224449 224461 224467 224473 224491 224501 224513 224527 224563 
+224569 224579 224591 224603 224611 224617 224629 224633 224669 224677 224683 224699 
+224711 224717 224729 224737 224743 224759 224771 224797 224813 224831 224863 224869 
+224881 224891 224897 224909 224911 224921 224929 224947 224951 224969 224977 224993 
+225023 225037 225061 225067 225077 225079 225089 225109 225119 225133 225143 225149 
+225157 225161 225163 225167 225217 225221 225223 225227 225241 225257 225263 225287 
+225289 225299 225307 225341 225343 225347 225349 225353 225371 225373 225383 225427 
+225431 225457 225461 225479 225493 225499 225503 225509 225523 225527 225529 225569 
+225581 225583 225601 225611 225613 225619 225629 225637 225671 225683 225689 225697 
+225721 225733 225749 225751 225767 225769 225779 225781 225809 225821 225829 225839 
+225859 225871 225889 225919 225931 225941 225943 225949 225961 225977 225983 225989 
+226001 226007 226013 226027 226063 226087 226099 226103 226123 226129 226133 226141 
+226169 226183 226189 226199 226201 226217 226231 226241 226267 226283 226307 226313 
+226337 226357 226367 226379 226381 226397 226409 226427 226433 226451 226453 226463 
+226483 226487 226511 226531 226547 226549 226553 226571 226601 226609 226621 226631 
+226637 226643 226649 226657 226663 226669 226691 226697 226741 226753 226769 226777 
+226783 226789 226799 226813 226817 226819 226823 226843 226871 226901 226903 226907 
+226913 226937 226943 226991 227011 227027 227053 227081 227089 227093 227111 227113 
+227131 227147 227153 227159 227167 227177 227189 227191 227207 227219 227231 227233 
+227251 227257 227267 227281 227299 227303 227363 227371 227377 227387 227393 227399 
+227407 227419 227431 227453 227459 227467 227471 227473 227489 227497 227501 227519 
+227531 227533 227537 227561 227567 227569 227581 227593 227597 227603 227609 227611 
+227627 227629 227651 227653 227663 227671 227693 227699 227707 227719 227729 227743 
+227789 227797 227827 227849 227869 227873 227893 227947 227951 227977 227989 227993 
+228013 228023 228049 228061 228077 228097 228103 228113 228127 228131 228139 228181 
+228197 228199 228203 228211 228223 228233 228251 228257 228281 228299 228301 228307 
+228311 228331 228337 228341 228353 228359 228383 228409 228419 228421 228427 228443 
+228451 228457 228461 228469 228479 228509 228511 228517 228521 228523 228539 228559 
+228577 228581 228587 228593 228601 228611 228617 228619 228637 228647 228677 228707 
+228713 228731 228733 228737 228751 228757 228773 228793 228797 228799 228829 228841 
+228847 228853 228859 228869 228881 228883 228887 228901 228911 228913 228923 228929 
+228953 228959 228961 228983 228989 229003 229027 229037 229081 229093 229123 229127 
+229133 229139 229153 229157 229171 229181 229189 229199 229213 229217 229223 229237 
+229247 229249 229253 229261 229267 229283 229309 229321 229343 229351 229373 229393 
+229399 229403 229409 229423 229433 229459 229469 229487 229499 229507 229519 229529 
+229547 229549 229553 229561 229583 229589 229591 229601 229613 229627 229631 229637 
+229639 229681 229693 229699 229703 229711 229717 229727 229739 229751 229753 229759 
+229763 229769 229771 229777 229781 229799 229813 229819 229837 229841 229847 229849 
+229897 229903 229937 229939 229949 229961 229963 229979 229981 230003 230017 230047 
+230059 230063 230077 230081 230089 230101 230107 230117 230123 230137 230143 230149 
+230189 230203 230213 230221 230227 230233 230239 230257 230273 230281 230291 230303 
+230309 230311 230327 230339 230341 230353 230357 230369 230383 230387 230389 230393 
+230431 230449 230453 230467 230471 230479 230501 230507 230539 230551 230561 230563 
+230567 230597 230611 230647 230653 230663 230683 230693 230719 230729 230743 230761 
+230767 230771 230773 230779 230807 230819 230827 230833 230849 230861 230863 230873 
+230891 230929 230933 230939 230941 230959 230969 230977 230999 231001 231017 231019 
+231031 231041 231053 231067 231079 231107 231109 231131 231169 231197 231223 231241 
+231269 231271 231277 231289 231293 231299 231317 231323 231331 231347 231349 231359 
+231367 231379 231409 231419 231431 231433 231443 231461 231463 231479 231481 231493 
+231503 231529 231533 231547 231551 231559 231563 231571 231589 231599 231607 231611 
+231613 231631 231643 231661 231677 231701 231709 231719 231779 231799 231809 231821 
+231823 231827 231839 231841 231859 231871 231877 231893 231901 231919 231923 231943 
+231947 231961 231967 232003 232007 232013 232049 232051 232073 232079 232081 232091 
+232103 232109 232117 232129 232153 232171 232187 232189 232207 232217 232259 232303 
+232307 232333 232357 232363 232367 232381 232391 232409 232411 232417 232433 232439 
+232451 232457 232459 232487 232499 232513 232523 232549 232567 232571 232591 232597 
+232607 232621 232633 232643 232663 232669 232681 232699 232709 232711 232741 232751 
+232753 232777 232801 232811 232819 232823 232847 232853 232861 232871 232877 232891 
+232901 232907 232919 232937 232961 232963 232987 233021 233069 233071 233083 233113 
+233117 233141 233143 233159 233161 233173 233183 233201 233221 233231 233239 233251 
+233267 233279 233293 233297 233323 233327 233329 233341 233347 233353 233357 233371 
+233407 233417 233419 233423 233437 233477 233489 233509 233549 233551 233557 233591 
+233599 233609 233617 233621 233641 233663 233669 233683 233687 233689 233693 233713 
+233743 233747 233759 233777 233837 233851 233861 233879 233881 233911 233917 233921 
+233923 233939 233941 233969 233983 233993 234007 234029 234043 234067 234083 234089 
+234103 234121 234131 234139 234149 234161 234167 234181 234187 234191 234193 234197 
+234203 234211 234217 234239 234259 234271 234281 234287 234293 234317 234319 234323 
+234331 234341 234343 234361 234383 234431 234457 234461 234463 234467 234473 234499 
+234511 234527 234529 234539 234541 234547 234571 234587 234589 234599 234613 234629 
+234653 234659 234673 234683 234713 234721 234727 234733 234743 234749 234769 234781 
+234791 234799 234803 234809 234811 234833 234847 234851 234863 234869 234893 234907 
+234917 234931 234947 234959 234961 234967 234977 234979 234989 235003 235007 235009 
+235013 235043 235051 235057 235069 235091 235099 235111 235117 235159 235171 235177 
+235181 235199 235211 235231 235241 235243 235273 235289 235307 235309 235337 235349 
+235369 235397 235439 235441 235447 235483 235489 235493 235513 235519 235523 235537 
+235541 235553 235559 235577 235591 235601 235607 235621 235661 235663 235673 235679 
+235699 235723 235747 235751 235783 235787 235789 235793 235811 235813 235849 235871 
+235877 235889 235891 235901 235919 235927 235951 235967 235979 235997 236017 236021 
+236053 236063 236069 236077 236087 236107 236111 236129 236143 236153 236167 236207 
+236209 236219 236231 236261 236287 236293 236297 236323 236329 236333 236339 236377 
+236381 236387 236399 236407 236429 236449 236461 236471 236477 236479 236503 236507 
+236519 236527 236549 236563 236573 236609 236627 236641 236653 236659 236681 236699 
+236701 236707 236713 236723 236729 236737 236749 236771 236773 236779 236783 236807 
+236813 236867 236869 236879 236881 236891 236893 236897 236909 236917 236947 236981 
+236983 236993 237011 237019 237043 237053 237067 237071 237073 237089 237091 237137 
+237143 237151 237157 237161 237163 237173 237179 237203 237217 237233 237257 237271 
+237277 237283 237287 237301 237313 237319 237331 237343 237361 237373 237379 237401 
+237409 237467 237487 237509 237547 237563 237571 237581 237607 237619 237631 237673 
+237683 237689 237691 237701 237707 237733 237737 237749 237763 237767 237781 237791 
+237821 237851 237857 237859 237877 237883 237901 237911 237929 237959 237967 237971 
+237973 237977 237997 238001 238009 238019 238031 238037 238039 238079 238081 238093 
+238099 238103 238109 238141 238151 238157 238159 238163 238171 238181 238201 238207 
+238213 238223 238229 238237 238247 238261 238267 238291 238307 238313 238321 238331 
+238339 238361 238363 238369 238373 238397 238417 238423 238439 238451 238463 238471 
+238477 238481 238499 238519 238529 238531 238547 238573 238591 238627 238639 238649 
+238657 238673 238681 238691 238703 238709 238723 238727 238729 238747 238759 238781 
+238789 238801 238829 238837 238841 238853 238859 238877 238879 238883 238897 238919 
+238921 238939 238943 238949 238967 238991 239017 239023 239027 239053 239069 239081 
+239087 239119 239137 239147 239167 239171 239179 239201 239231 239233 239237 239243 
+239251 239263 239273 239287 239297 239329 239333 239347 239357 239383 239387 239389 
+239417 239423 239429 239431 239441 239461 239489 239509 239521 239527 239531 239539 
+239543 239557 239567 239579 239587 239597 239611 239623 239633 239641 239671 239689 
+239699 239711 239713 239731 239737 239753 239779 239783 239803 239807 239831 239843 
+239849 239851 239857 239873 239879 239893 239929 239933 239947 239957 239963 239977 
+239999 240007 240011 240017 240041 240043 240047 240049 240059 240073 240089 240101 
+240109 240113 240131 240139 240151 240169 240173 240197 240203 240209 240257 240259 
+240263 240271 240283 240287 240319 240341 240347 240349 240353 240371 240379 240421 
+240433 240437 240473 240479 240491 240503 240509 240517 240551 240571 240587 240589 
+240599 240607 240623 240631 240641 240659 240677 240701 240707 240719 240727 240733 
+240739 240743 240763 240769 240797 240811 240829 240841 240853 240859 240869 240881 
+240883 240893 240899 240913 240943 240953 240959 240967 240997 241013 241027 241037 
+241049 241051 241061 241067 241069 241079 241093 241117 241127 241141 241169 241177 
+241183 241207 241229 241249 241253 241259 241261 241271 241291 241303 241313 241321 
+241327 241333 241337 241343 241361 241363 241391 241393 241421 241429 241441 241453 
+241463 241469 241489 241511 241513 241517 241537 241543 241559 241561 241567 241589 
+241597 241601 241603 241639 241643 241651 241663 241667 241679 241687 241691 241711 
+241727 241739 241771 241781 241783 241793 241807 241811 241817 241823 241847 241861 
+241867 241873 241877 241883 241903 241907 241919 241921 241931 241939 241951 241963 
+241973 241979 241981 241993 242009 242057 242059 242069 242083 242093 242101 242119 
+242129 242147 242161 242171 242173 242197 242201 242227 242243 242257 242261 242273 
+242279 242309 242329 242357 242371 242377 242393 242399 242413 242419 242441 242447 
+242449 242453 242467 242479 242483 242491 242509 242519 242521 242533 242551 242591 
+242603 242617 242621 242629 242633 242639 242647 242659 242677 242681 242689 242713 
+242729 242731 242747 242773 242779 242789 242797 242807 242813 242819 242863 242867 
+242873 242887 242911 242923 242927 242971 242989 242999 243011 243031 243073 243077 
+243091 243101 243109 243119 243121 243137 243149 243157 243161 243167 243197 243203 
+243209 243227 243233 243239 243259 243263 243301 243311 243343 243367 243391 243401 
+243403 243421 243431 243433 243437 243461 243469 243473 243479 243487 243517 243521 
+243527 243533 243539 243553 243577 243583 243587 243589 243613 243623 243631 243643 
+243647 243671 243673 243701 243703 243707 243709 243769 243781 243787 243799 243809 
+243829 243839 243851 243857 243863 243871 243889 243911 243917 243931 243953 243973 
+243989 244003 244009 244021 244033 244043 244087 244091 244109 244121 244129 244141 
+244147 244157 244159 244177 244199 244217 244219 244243 244247 244253 244261 244291 
+244297 244301 244303 244313 244333 244339 244351 244357 244367 244379 244381 244393 
+244399 244403 244411 244423 244429 244451 244457 244463 244471 244481 244493 244507 
+244529 244547 244553 244561 244567 244583 244589 244597 244603 244619 244633 244637 
+244639 244667 244669 244687 244691 244703 244711 244721 244733 244747 244753 244759 
+244781 244787 244813 244837 244841 244843 244859 244861 244873 244877 244889 244897 
+244901 244939 244943 244957 244997 245023 245029 245033 245039 245071 245083 245087 
+245107 245129 245131 245149 245171 245173 245177 245183 245209 245251 245257 245261 
+245269 245279 245291 245299 245317 245321 245339 245383 245389 245407 245411 245417 
+245419 245437 245471 245473 245477 245501 245513 245519 245521 245527 245533 245561 
+245563 245587 245591 245593 245621 245627 245629 245639 245653 245671 245681 245683 
+245711 245719 245723 245741 245747 245753 245759 245771 245783 245789 245821 245849 
+245851 245863 245881 245897 245899 245909 245911 245941 245963 245977 245981 245983 
+245989 246011 246017 246049 246073 246097 246119 246121 246131 246133 246151 246167 
+246173 246187 246193 246203 246209 246217 246223 246241 246247 246251 246271 246277 
+246289 246317 246319 246329 246343 246349 246361 246371 246391 246403 246439 246469 
+246473 246497 246509 246511 246523 246527 246539 246557 246569 246577 246599 246607 
+246611 246613 246637 246641 246643 246661 246683 246689 246707 246709 246713 246731 
+246739 246769 246773 246781 246787 246793 246803 246809 246811 246817 246833 246839 
+246889 246899 246907 246913 246919 246923 246929 246931 246937 246941 246947 246971 
+246979 247001 247007 247031 247067 247069 247073 247087 247099 247141 247183 247193 
+247201 247223 247229 247241 247249 247259 247279 247301 247309 247337 247339 247343 
+247363 247369 247381 247391 247393 247409 247421 247433 247439 247451 247463 247501 
+247519 247529 247531 247547 247553 247579 247591 247601 247603 247607 247609 247613 
+247633 247649 247651 247691 247693 247697 247711 247717 247729 247739 247759 247769 
+247771 247781 247799 247811 247813 247829 247847 247853 247873 247879 247889 247901 
+247913 247939 247943 247957 247991 247993 247997 247999 248021 248033 248041 248051 
+248057 248063 248071 248077 248089 248099 248117 248119 248137 248141 248161 248167 
+248177 248179 248189 248201 248203 248231 248243 248257 248267 248291 248293 248299 
+248309 248317 248323 248351 248357 248371 248389 248401 248407 248431 248441 248447 
+248461 248473 248477 248483 248509 248533 248537 248543 248569 248579 248587 248593 
+248597 248609 248621 248627 248639 248641 248657 248683 248701 248707 248719 248723 
+248737 248749 248753 248779 248783 248789 248797 248813 248821 248827 248839 248851 
+248861 248867 248869 248879 248887 248891 248893 248903 248909 248971 248981 248987 
+249017 249037 249059 249079 249089 249097 249103 249107 249127 249131 249133 249143 
+249181 249187 249199 249211 249217 249229 249233 249253 249257 249287 249311 249317 
+249329 249341 249367 249377 249383 249397 249419 249421 249427 249433 249437 249439 
+249449 249463 249497 249499 249503 249517 249521 249533 249539 249541 249563 249583 
+249589 249593 249607 249647 249659 249671 249677 249703 249721 249727 249737 249749 
+249763 249779 249797 249811 249827 249833 249853 249857 249859 249863 249871 249881 
+249911 249923 249943 249947 249967 249971 249973 249989 250007 250013 250027 250031 
+250037 250043 250049 250051 250057 250073 250091 250109 250123 250147 250153 250169 
+250199 250253 250259 250267 250279 250301 250307 250343 250361 250403 250409 250423 
+250433 250441 250451 250489 250499 250501 250543 250583 250619 250643 250673 250681 
+250687 250693 250703 250709 250721 250727 250739 250741 250751 250753 250777 250787 
+250793 250799 250807 250813 250829 250837 250841 250853 250867 250871 250889 250919 
+250949 250951 250963 250967 250969 250979 250993 251003 251033 251051 251057 251059 
+251063 251071 251081 251087 251099 251117 251143 251149 251159 251171 251177 251179 
+251191 251197 251201 251203 251219 251221 251231 251233 251257 251261 251263 251287 
+251291 251297 251323 251347 251353 251359 251387 251393 251417 251429 251431 251437 
+251443 251467 251473 251477 251483 251491 251501 251513 251519 251527 251533 251539 
+251543 251561 251567 251609 251611 251621 251623 251639 251653 251663 251677 251701 
+251707 251737 251761 251789 251791 251809 251831 251833 251843 251857 251861 251879 
+251887 251893 251897 251903 251917 251939 251941 251947 251969 251971 251983 252001 
+252013 252017 252029 252037 252079 252101 252139 252143 252151 252157 252163 252169 
+252173 252181 252193 252209 252223 252233 252253 252277 252283 252289 252293 252313 
+252319 252323 252341 252359 252383 252391 252401 252409 252419 252431 252443 252449 
+252457 252463 252481 252509 252533 252541 252559 252583 252589 252607 252611 252617 
+252641 252667 252691 252709 252713 252727 252731 252737 252761 252767 252779 252817 
+252823 252827 252829 252869 252877 252881 252887 252893 252899 252911 252913 252919 
+252937 252949 252971 252979 252983 253003 253013 253049 253063 253081 253103 253109 
+253133 253153 253157 253159 253229 253243 253247 253273 253307 253321 253343 253349 
+253361 253367 253369 253381 253387 253417 253423 253427 253433 253439 253447 253469 
+253481 253493 253501 253507 253531 253537 253543 253553 253567 253573 253601 253607 
+253609 253613 253633 253637 253639 253651 253661 253679 253681 253703 253717 253733 
+253741 253751 253763 253769 253777 253787 253789 253801 253811 253819 253823 253853 
+253867 253871 253879 253901 253907 253909 253919 253937 253949 253951 253969 253987 
+253993 253999 254003 254021 254027 254039 254041 254047 254053 254071 254083 254119 
+254141 254147 254161 254179 254197 254207 254209 254213 254249 254257 254279 254281 
+254291 254299 254329 254369 254377 254383 254389 254407 254413 254437 254447 254461 
+254489 254491 254519 254537 254557 254593 254623 254627 254647 254659 254663 254699 
+254713 254729 254731 254741 254747 254753 254773 254777 254783 254791 254803 254827 
+254831 254833 254857 254869 254873 254879 254887 254899 254911 254927 254929 254941 
+254959 254963 254971 254977 254987 254993 255007 255019 255023 255043 255049 255053 
+255071 255077 255083 255097 255107 255121 255127 255133 255137 255149 255173 255179 
+255181 255191 255193 255197 255209 255217 255239 255247 255251 255253 255259 255313 
+255329 255349 255361 255371 255383 255413 255419 255443 255457 255467 255469 255473 
+255487 255499 255503 255511 255517 255523 255551 255571 255587 255589 255613 255617 
+255637 255641 255649 255653 255659 255667 255679 255709 255713 255733 255743 255757 
+255763 255767 255803 255839 255841 255847 255851 255859 255869 255877 255887 255907 
+255917 255919 255923 255947 255961 255971 255973 255977 255989 256019 256021 256031 
+256033 256049 256057 256079 256093 256117 256121 256129 256133 256147 256163 256169 
+256181 256187 256189 256199 256211 256219 256279 256301 256307 256313 256337 256349 
+256363 256369 256391 256393 256423 256441 256469 256471 256483 256489 256493 256499 
+256517 256541 256561 256567 256577 256579 256589 256603 256609 256639 256643 256651 
+256661 256687 256699 256721 256723 256757 256771 256799 256801 256813 256831 256873 
+256877 256889 256901 256903 256931 256939 256957 256967 256981 257003 257017 257053 
+257069 257077 257093 257099 257107 257123 257141 257161 257171 257177 257189 257219 
+257221 257239 257249 257263 257273 257281 257287 257293 257297 257311 257321 257339 
+257351 257353 257371 257381 257399 257401 257407 257437 257443 257447 257459 257473 
+257489 257497 257501 257503 257519 257539 257561 257591 257611 257627 257639 257657 
+257671 257687 257689 257707 257711 257713 257717 257731 257783 257791 257797 257837 
+257857 257861 257863 257867 257869 257879 257893 257903 257921 257947 257953 257981 
+257987 257989 257993 258019 258023 258031 258061 258067 258101 258107 258109 258113 
+258119 258127 258131 258143 258157 258161 258173 258197 258211 258233 258241 258253 
+258277 258283 258299 258317 258319 258329 258331 258337 258353 258373 258389 258403 
+258407 258413 258421 258437 258443 258449 258469 258487 258491 258499 258521 258527 
+258539 258551 258563 258569 258581 258607 258611 258613 258617 258623 258631 258637 
+258659 258673 258677 258691 258697 258703 258707 258721 258733 258737 258743 258763 
+258779 258787 258803 258809 258827 258847 258871 258887 258917 258919 258949 258959 
+258967 258971 258977 258983 258991 259001 259009 259019 259033 259099 259121 259123 
+259151 259157 259159 259163 259169 259177 259183 259201 259211 259213 259219 259229 
+259271 259277 259309 259321 259339 259379 259381 259387 259397 259411 259421 259429 
+259451 259453 259459 259499 259507 259517 259531 259537 259547 259577 259583 259603 
+259619 259621 259627 259631 259639 259643 259657 259667 259681 259691 259697 259717 
+259723 259733 259751 259771 259781 259783 259801 259813 259823 259829 259837 259841 
+259867 259907 259933 259937 259943 259949 259967 259991 259993 260003 260009 260011 
+260017 260023 260047 260081 260089 260111 260137 260171 260179 260189 260191 260201 
+260207 260209 260213 260231 260263 260269 260317 260329 260339 260363 260387 260399 
+260411 260413 260417 260419 260441 260453 260461 260467 260483 260489 260527 260539 
+260543 260549 260551 260569 260573 260581 260587 260609 260629 260647 260651 260671 
+260677 260713 260717 260723 260747 260753 260761 260773 260791 260807 260809 260849 
+260857 260861 260863 260873 260879 260893 260921 260941 260951 260959 260969 260983 
+260987 260999 261011 261013 261017 261031 261043 261059 261061 261071 261077 261089 
+261101 261127 261167 261169 261223 261229 261241 261251 261271 261281 261301 261323 
+261329 261337 261347 261353 261379 261389 261407 261427 261431 261433 261439 261451 
+261463 261467 261509 261523 261529 261557 261563 261577 261581 261587 261593 261601 
+261619 261631 261637 261641 261643 261673 261697 261707 261713 261721 261739 261757 
+261761 261773 261787 261791 261799 261823 261847 261881 261887 261917 261959 261971 
+261973 261977 261983 262007 262027 262049 262051 262069 262079 262103 262109 262111 
+262121 262127 262133 262139 262147 262151 262153 262187 262193 262217 262231 262237 
+262253 262261 262271 262303 262313 262321 262331 262337 262349 262351 262369 262387 
+262391 262399 262411 262433 262459 262469 262489 262501 262511 262513 262519 262541 
+262543 262553 262567 262583 262597 262621 262627 262643 262649 262651 262657 262681 
+262693 262697 262709 262723 262733 262739 262741 262747 262781 262783 262807 262819 
+262853 262877 262883 262897 262901 262909 262937 262949 262957 262981 263009 263023 
+263047 263063 263071 263077 263083 263089 263101 263111 263119 263129 263167 263171 
+263183 263191 263201 263209 263213 263227 263239 263257 263267 263269 263273 263287 
+263293 263303 263323 263369 263383 263387 263399 263401 263411 263423 263429 263437 
+263443 263489 263491 263503 263513 263519 263521 263533 263537 263561 263567 263573 
+263591 263597 263609 263611 263621 263647 263651 263657 263677 263723 263729 263737 
+263759 263761 263803 263819 263821 263827 263843 263849 263863 263867 263869 263881 
+263899 263909 263911 263927 263933 263941 263951 263953 263957 263983 264007 264013 
+264029 264031 264053 264059 264071 264083 264091 264101 264113 264127 264133 264137 
+264139 264167 264169 264179 264211 264221 264263 264269 264283 264289 264301 264323 
+264331 264343 264349 264353 264359 264371 264391 264403 264437 264443 264463 264487 
+264527 264529 264553 264559 264577 264581 264599 264601 264619 264631 264637 264643 
+264659 264697 264731 264739 264743 264749 264757 264763 264769 264779 264787 264791 
+264793 264811 264827 264829 264839 264871 264881 264889 264893 264899 264919 264931 
+264949 264959 264961 264977 264991 264997 265003 265007 265021 265037 265079 265091 
+265093 265117 265123 265129 265141 265151 265157 265163 265169 265193 265207 265231 
+265241 265247 265249 265261 265271 265273 265277 265313 265333 265337 265339 265381 
+265399 265403 265417 265423 265427 265451 265459 265471 265483 265493 265511 265513 
+265541 265543 265547 265561 265567 265571 265579 265607 265613 265619 265621 265703 
+265709 265711 265717 265729 265739 265747 265757 265781 265787 265807 265813 265819 
+265831 265841 265847 265861 265871 265873 265883 265891 265921 265957 265961 265987 
+266003 266009 266023 266027 266029 266047 266051 266053 266059 266081 266083 266089 
+266093 266099 266111 266117 266129 266137 266153 266159 266177 266183 266221 266239 
+266261 266269 266281 266291 266293 266297 266333 266351 266353 266359 266369 266381 
+266401 266411 266417 266447 266449 266477 266479 266489 266491 266521 266549 266587 
+266599 266603 266633 266641 266647 266663 266671 266677 266681 266683 266687 266689 
+266701 266711 266719 266759 266767 266797 266801 266821 266837 266839 266863 266867 
+266891 266897 266899 266909 266921 266927 266933 266947 266953 266957 266971 266977 
+266983 266993 266999 267017 267037 267049 267097 267131 267133 267139 267143 267167 
+267187 267193 267199 267203 267217 267227 267229 267233 267259 267271 267277 267299 
+267301 267307 267317 267341 267353 267373 267389 267391 267401 267403 267413 267419 
+267431 267433 267439 267451 267469 267479 267481 267493 267497 267511 267517 267521 
+267523 267541 267551 267557 267569 267581 267587 267593 267601 267611 267613 267629 
+267637 267643 267647 267649 267661 267667 267671 267677 267679 267713 267719 267721 
+267727 267737 267739 267749 267763 267781 267791 267797 267803 267811 267829 267833 
+267857 267863 267877 267887 267893 267899 267901 267907 267913 267929 267941 267959 
+267961 268003 268013 268043 268049 268063 268069 268091 268123 268133 268153 268171 
+268189 268199 268207 268211 268237 268253 268267 268271 268283 268291 268297 268343 
+268403 268439 268459 268487 268493 268501 268507 268517 268519 268529 268531 268537 
+268547 268573 268607 268613 268637 268643 268661 268693 268721 268729 268733 268747 
+268757 268759 268771 268777 268781 268783 268789 268811 268813 268817 268819 268823 
+268841 268843 268861 268883 268897 268909 268913 268921 268927 268937 268969 268973 
+268979 268993 268997 268999 269023 269029 269039 269041 269057 269063 269069 269089 
+269117 269131 269141 269167 269177 269179 269183 269189 269201 269209 269219 269221 
+269231 269237 269251 269257 269281 269317 269327 269333 269341 269351 269377 269383 
+269387 269389 269393 269413 269419 269429 269431 269441 269461 269473 269513 269519 
+269527 269539 269543 269561 269573 269579 269597 269617 269623 269641 269651 269663 
+269683 269701 269713 269719 269723 269741 269749 269761 269779 269783 269791 269851 
+269879 269887 269891 269897 269923 269939 269947 269953 269981 269987 270001 270029 
+270031 270037 270059 270071 270073 270097 270121 270131 270133 270143 270157 270163 
+270167 270191 270209 270217 270223 270229 270239 270241 270269 270271 270287 270299 
+270307 270311 270323 270329 270337 270343 270371 270379 270407 270421 270437 270443 
+270451 270461 270463 270493 270509 270527 270539 270547 270551 270553 270563 270577 
+270583 270587 270593 270601 270619 270631 270653 270659 270667 270679 270689 270701 
+270709 270719 270737 270749 270761 270763 270791 270797 270799 270821 270833 270841 
+270859 270899 270913 270923 270931 270937 270953 270961 270967 270973 271003 271013 
+271021 271027 271043 271057 271067 271079 271097 271109 271127 271129 271163 271169 
+271177 271181 271211 271217 271231 271241 271253 271261 271273 271277 271279 271289 
+271333 271351 271357 271363 271367 271393 271409 271429 271451 271463 271471 271483 
+271489 271499 271501 271517 271549 271553 271571 271573 271597 271603 271619 271637 
+271639 271651 271657 271693 271703 271723 271729 271753 271769 271771 271787 271807 
+271811 271829 271841 271849 271853 271861 271867 271879 271897 271903 271919 271927 
+271939 271967 271969 271981 272003 272009 272011 272029 272039 272053 272059 272093 
+272131 272141 272171 272179 272183 272189 272191 272201 272203 272227 272231 272249 
+272257 272263 272267 272269 272287 272299 272317 272329 272333 272341 272347 272351 
+272353 272359 272369 272381 272383 272399 272407 272411 272417 272423 272449 272453 
+272477 272507 272533 272537 272539 272549 272563 272567 272581 272603 272621 272651 
+272659 272683 272693 272717 272719 272737 272759 272761 272771 272777 272807 272809 
+272813 272863 272879 272887 272903 272911 272917 272927 272933 272959 272971 272981 
+272983 272989 272999 273001 273029 273043 273047 273059 273061 273067 273073 273083 
+273107 273113 273127 273131 273149 273157 273181 273187 273193 273233 273253 273269 
+273271 273281 273283 273289 273311 273313 273323 273349 273359 273367 273433 273457 
+273473 273503 273517 273521 273527 273551 273569 273601 273613 273617 273629 273641 
+273643 273653 273697 273709 273719 273727 273739 273773 273787 273797 273803 273821 
+273827 273857 273881 273899 273901 273913 273919 273929 273941 273943 273967 273971 
+273979 273997 274007 274019 274033 274061 274069 274081 274093 274103 274117 274121 
+274123 274139 274147 274163 274171 274177 274187 274199 274201 274213 274223 274237 
+274243 274259 274271 274277 274283 274301 274333 274349 274357 274361 274403 274423 
+274441 274451 274453 274457 274471 274489 274517 274529 274579 274583 274591 274609 
+274627 274661 274667 274679 274693 274697 274709 274711 274723 274739 274751 274777 
+274783 274787 274811 274817 274829 274831 274837 274843 274847 274853 274861 274867 
+274871 274889 274909 274931 274943 274951 274957 274961 274973 274993 275003 275027 
+275039 275047 275053 275059 275083 275087 275129 275131 275147 275153 275159 275161 
+275167 275183 275201 275207 275227 275251 275263 275269 275299 275309 275321 275323 
+275339 275357 275371 275389 275393 275399 275419 275423 275447 275449 275453 275459 
+275461 275489 275491 275503 275521 275531 275543 275549 275573 275579 275581 275591 
+275593 275599 275623 275641 275651 275657 275669 275677 275699 275711 275719 275729 
+275741 275767 275773 275783 275813 275827 275837 275881 275897 275911 275917 275921 
+275923 275929 275939 275941 275963 275969 275981 275987 275999 276007 276011 276019 
+276037 276041 276043 276047 276049 276079 276083 276091 276113 276137 276151 276173 
+276181 276187 276191 276209 276229 276239 276247 276251 276257 276277 276293 276319 
+276323 276337 276343 276347 276359 276371 276373 276389 276401 276439 276443 276449 
+276461 276467 276487 276499 276503 276517 276527 276553 276557 276581 276587 276589 
+276593 276599 276623 276629 276637 276671 276673 276707 276721 276739 276763 276767 
+276779 276781 276817 276821 276823 276827 276833 276839 276847 276869 276883 276901 
+276907 276917 276919 276929 276949 276953 276961 276977 277003 277007 277021 277051 
+277063 277073 277087 277097 277099 277157 277163 277169 277177 277183 277213 277217 
+277223 277231 277247 277259 277261 277273 277279 277297 277301 277309 277331 277363 
+277373 277411 277421 277427 277429 277483 277493 277499 277513 277531 277547 277549 
+277567 277577 277579 277597 277601 277603 277637 277639 277643 277657 277663 277687 
+277691 277703 277741 277747 277751 277757 277787 277789 277793 277813 277829 277847 
+277859 277883 277889 277891 277897 277903 277919 277961 277993 277999 278017 278029 
+278041 278051 278063 278071 278087 278111 278119 278123 278143 278147 278149 278177 
+278191 278207 278209 278219 278227 278233 278237 278261 278269 278279 278321 278329 
+278347 278353 278363 278387 278393 278413 278437 278459 278479 278489 278491 278497 
+278501 278503 278543 278549 278557 278561 278563 278581 278591 278609 278611 278617 
+278623 278627 278639 278651 278671 278687 278689 278701 278717 278741 278743 278753 
+278767 278801 278807 278809 278813 278819 278827 278843 278849 278867 278879 278881 
+278891 278903 278909 278911 278917 278947 278981 279001 279007 279023 279029 279047 
+279073 279109 279119 279121 279127 279131 279137 279143 279173 279179 279187 279203 
+279211 279221 279269 279311 279317 279329 279337 279353 279397 279407 279413 279421 
+279431 279443 279451 279479 279481 279511 279523 279541 279551 279553 279557 279571 
+279577 279583 279593 279607 279613 279619 279637 279641 279649 279659 279679 279689 
+279707 279709 279731 279751 279761 279767 279779 279817 279823 279847 279857 279863 
+279883 279913 279919 279941 279949 279967 279977 279991 280001 280009 280013 280031 
+280037 280061 280069 280097 280099 280103 280121 280129 280139 280183 280187 280199 
+280207 280219 280223 280229 280243 280249 280253 280277 280297 280303 280321 280327 
+280337 280339 280351 280373 280409 280411 280451 280463 280487 280499 280507 280513 
+280537 280541 280547 280549 280561 280583 280589 280591 280597 280603 280607 280613 
+280627 280639 280673 280681 280697 280699 280703 280711 280717 280729 280751 280759 
+280769 280771 280811 280817 280837 280843 280859 280871 280879 280883 280897 280909 
+280913 280921 280927 280933 280939 280949 280957 280963 280967 280979 280997 281023 
+281033 281053 281063 281069 281081 281117 281131 281153 281159 281167 281189 281191 
+281207 281227 281233 281243 281249 281251 281273 281279 281291 281297 281317 281321 
+281327 281339 281353 281357 281363 281381 281419 281423 281429 281431 281509 281527 
+281531 281539 281549 281551 281557 281563 281579 281581 281609 281621 281623 281627 
+281641 281647 281651 281653 281663 281669 281683 281717 281719 281737 281747 281761 
+281767 281777 281783 281791 281797 281803 281807 281833 281837 281839 281849 281857 
+281867 281887 281893 281921 281923 281927 281933 281947 281959 281971 281989 281993 
+282001 282011 282019 282053 282059 282071 282089 282091 282097 282101 282103 282127 
+282143 282157 282167 282221 282229 282239 282241 282253 282281 282287 282299 282307 
+282311 282313 282349 282377 282383 282389 282391 282407 282409 282413 282427 282439 
+282461 282481 282487 282493 282559 282563 282571 282577 282589 282599 282617 282661 
+282671 282677 282679 282683 282691 282697 282703 282707 282713 282767 282769 282773 
+282797 282809 282827 282833 282847 282851 282869 282881 282889 282907 282911 282913 
+282917 282959 282973 282977 282991 283001 283007 283009 283027 283051 283079 283093 
+283097 283099 283111 283117 283121 283133 283139 283159 283163 283181 283183 283193 
+283207 283211 283267 283277 283289 283303 283369 283397 283403 283411 283447 283463 
+283487 283489 283501 283511 283519 283541 283553 283571 283573 283579 283583 283601 
+283607 283609 283631 283637 283639 283669 283687 283697 283721 283741 283763 283769 
+283771 283793 283799 283807 283813 283817 283831 283837 283859 283861 283873 283909 
+283937 283949 283957 283961 283979 284003 284023 284041 284051 284057 284059 284083 
+284093 284111 284117 284129 284131 284149 284153 284159 284161 284173 284191 284201 
+284227 284231 284233 284237 284243 284261 284267 284269 284293 284311 284341 284357 
+284369 284377 284387 284407 284413 284423 284429 284447 284467 284477 284483 284489 
+284507 284509 284521 284527 284539 284551 284561 284573 284587 284591 284593 284623 
+284633 284651 284657 284659 284681 284689 284701 284707 284723 284729 284731 284737 
+284741 284743 284747 284749 284759 284777 284783 284803 284807 284813 284819 284831 
+284833 284839 284857 284881 284897 284899 284917 284927 284957 284969 284989 285007 
+285023 285031 285049 285071 285079 285091 285101 285113 285119 285121 285139 285151 
+285161 285179 285191 285199 285221 285227 285251 285281 285283 285287 285289 285301 
+285317 285343 285377 285421 285433 285451 285457 285463 285469 285473 285497 285517 
+285521 285533 285539 285553 285557 285559 285569 285599 285611 285613 285629 285631 
+285641 285643 285661 285667 285673 285697 285707 285709 285721 285731 285749 285757 
+285763 285767 285773 285781 285823 285827 285839 285841 285871 285937 285949 285953 
+285977 285979 285983 285997 286001 286009 286019 286043 286049 286061 286063 286073 
+286103 286129 286163 286171 286199 286243 286249 286289 286301 286333 286367 286369 
+286381 286393 286397 286411 286421 286427 286453 286457 286459 286469 286477 286483 
+286487 286493 286499 286513 286519 286541 286543 286547 286553 286589 286591 286609 
+286613 286619 286633 286651 286673 286687 286697 286703 286711 286721 286733 286751 
+286753 286763 286771 286777 286789 286801 286813 286831 286859 286873 286927 286973 
+286981 286987 286999 287003 287047 287057 287059 287087 287093 287099 287107 287117 
+287137 287141 287149 287159 287167 287173 287179 287191 287219 287233 287237 287239 
+287251 287257 287269 287279 287281 287291 287297 287321 287327 287333 287341 287347 
+287383 287387 287393 287437 287449 287491 287501 287503 287537 287549 287557 287579 
+287597 287611 287629 287669 287671 287681 287689 287701 287731 287747 287783 287789 
+287801 287813 287821 287849 287851 287857 287863 287867 287873 287887 287921 287933 
+287939 287977 288007 288023 288049 288053 288061 288077 288089 288109 288137 288179 
+288181 288191 288199 288203 288209 288227 288241 288247 288257 288283 288293 288307 
+288313 288317 288349 288359 288361 288383 288389 288403 288413 288427 288433 288461 
+288467 288481 288493 288499 288527 288529 288539 288551 288559 288571 288577 288583 
+288647 288649 288653 288661 288679 288683 288689 288697 288731 288733 288751 288767 
+288773 288803 288817 288823 288833 288839 288851 288853 288877 288907 288913 288929 
+288931 288947 288973 288979 288989 288991 288997 289001 289019 289021 289031 289033 
+289039 289049 289063 289067 289099 289103 289109 289111 289127 289129 289139 289141 
+289151 289169 289171 289181 289189 289193 289213 289241 289243 289249 289253 289273 
+289283 289291 289297 289309 289319 289343 289349 289361 289369 289381 289397 289417 
+289423 289439 289453 289463 289469 289477 289489 289511 289543 289559 289573 289577 
+289589 289603 289607 289637 289643 289657 289669 289717 289721 289727 289733 289741 
+289759 289763 289771 289789 289837 289841 289843 289847 289853 289859 289871 289889 
+289897 289937 289951 289957 289967 289973 289987 289999 290011 290021 290023 290027 
+290033 290039 290041 290047 290057 290083 290107 290113 290119 290137 290141 290161 
+290183 290189 290201 290209 290219 290233 290243 290249 290317 290327 290347 290351 
+290359 290369 290383 290393 290399 290419 290429 290441 290443 290447 290471 290473 
+290489 290497 290509 290527 290531 290533 290539 290557 290593 290597 290611 290617 
+290621 290623 290627 290657 290659 290663 290669 290671 290677 290701 290707 290711 
+290737 290761 290767 290791 290803 290821 290827 290837 290839 290861 290869 290879 
+290897 290923 290959 290963 290971 290987 290993 290999 291007 291013 291037 291041 
+291043 291077 291089 291101 291103 291107 291113 291143 291167 291169 291173 291191 
+291199 291209 291217 291253 291257 291271 291287 291293 291299 291331 291337 291349 
+291359 291367 291371 291373 291377 291419 291437 291439 291443 291457 291481 291491 
+291503 291509 291521 291539 291547 291559 291563 291569 291619 291647 291649 291661 
+291677 291689 291691 291701 291721 291727 291743 291751 291779 291791 291817 291829 
+291833 291853 291857 291869 291877 291887 291899 291901 291923 291971 291979 291983 
+291997 292021 292027 292037 292057 292069 292079 292081 292091 292093 292133 292141 
+292147 292157 292181 292183 292223 292231 292241 292249 292267 292283 292301 292309 
+292319 292343 292351 292363 292367 292381 292393 292427 292441 292459 292469 292471 
+292477 292483 292489 292493 292517 292531 292541 292549 292561 292573 292577 292601 
+292627 292631 292661 292667 292673 292679 292693 292703 292709 292711 292717 292727 
+292753 292759 292777 292793 292801 292807 292819 292837 292841 292849 292867 292879 
+292909 292921 292933 292969 292973 292979 292993 293021 293071 293081 293087 293093 
+293099 293107 293123 293129 293147 293149 293173 293177 293179 293201 293207 293213 
+293221 293257 293261 293263 293269 293311 293329 293339 293351 293357 293399 293413 
+293431 293441 293453 293459 293467 293473 293483 293507 293543 293599 293603 293617 
+293621 293633 293639 293651 293659 293677 293681 293701 293717 293723 293729 293749 
+293767 293773 293791 293803 293827 293831 293861 293863 293893 293899 293941 293957 
+293983 293989 293999 294001 294013 294023 294029 294043 294053 294059 294067 294103 
+294127 294131 294149 294157 294167 294169 294179 294181 294199 294211 294223 294227 
+294241 294247 294251 294269 294277 294289 294293 294311 294313 294317 294319 294337 
+294341 294347 294353 294383 294391 294397 294403 294431 294439 294461 294467 294479 
+294499 294509 294523 294529 294551 294563 294629 294641 294647 294649 294659 294673 
+294703 294731 294751 294757 294761 294773 294781 294787 294793 294799 294803 294809 
+294821 294829 294859 294869 294887 294893 294911 294919 294923 294947 294949 294953 
+294979 294989 294991 294997 295007 295033 295037 295039 295049 295073 295079 295081 
+295111 295123 295129 295153 295187 295199 295201 295219 295237 295247 295259 295271 
+295277 295283 295291 295313 295319 295333 295357 295363 295387 295411 295417 295429 
+295433 295439 295441 295459 295513 295517 295541 295553 295567 295571 295591 295601 
+295663 295693 295699 295703 295727 295751 295759 295769 295777 295787 295819 295831 
+295837 295843 295847 295853 295861 295871 295873 295877 295879 295901 295903 295909 
+295937 295943 295949 295951 295961 295973 295993 296011 296017 296027 296041 296047 
+296071 296083 296099 296117 296129 296137 296159 296183 296201 296213 296221 296237 
+296243 296249 296251 296269 296273 296279 296287 296299 296347 296353 296363 296369 
+296377 296437 296441 296473 296477 296479 296489 296503 296507 296509 296519 296551 
+296557 296561 296563 296579 296581 296587 296591 296627 296651 296663 296669 296683 
+296687 296693 296713 296719 296729 296731 296741 296749 296753 296767 296771 296773 
+296797 296801 296819 296827 296831 296833 296843 296909 296911 296921 296929 296941 
+296969 296971 296981 296983 296987 297019 297023 297049 297061 297067 297079 297083 
+297097 297113 297133 297151 297161 297169 297191 297233 297247 297251 297257 297263 
+297289 297317 297359 297371 297377 297391 297397 297403 297421 297439 297457 297467 
+297469 297481 297487 297503 297509 297523 297533 297581 297589 297601 297607 297613 
+297617 297623 297629 297641 297659 297683 297691 297707 297719 297727 297757 297779 
+297793 297797 297809 297811 297833 297841 297853 297881 297889 297893 297907 297911 
+297931 297953 297967 297971 297989 297991 298013 298021 298031 298043 298049 298063 
+298087 298093 298099 298153 298157 298159 298169 298171 298187 298201 298211 298213 
+298223 298237 298247 298261 298283 298303 298307 298327 298339 298343 298349 298369 
+298373 298399 298409 298411 298427 298451 298477 298483 298513 298559 298579 298583 
+298589 298601 298607 298621 298631 298651 298667 298679 298681 298687 298691 298693 
+298709 298723 298733 298757 298759 298777 298799 298801 298817 298819 298841 298847 
+298853 298861 298897 298937 298943 298993 298999 299011 299017 299027 299029 299053 
+299059 299063 299087 299099 299107 299113 299137 299147 299171 299179 299191 299197 
+299213 299239 299261 299281 299287 299311 299317 299329 299333 299357 299359 299363 
+299371 299389 299393 299401 299417 299419 299447 299471 299473 299477 299479 299501 
+299513 299521 299527 299539 299567 299569 299603 299617 299623 299653 299671 299681 
+299683 299699 299701 299711 299723 299731 299743 299749 299771 299777 299807 299843 
+299857 299861 299881 299891 299903 299909 299933 299941 299951 299969 299977 299983 
+299993 300007 300017 300023 300043 300073 300089 300109 300119 300137 300149 300151 
+300163 300187 300191 300193 300221 300229 300233 300239 300247 300277 300299 300301 
+300317 300319 300323 300331 300343 300347 300367 300397 300413 300427 300431 300439 
+300463 300481 300491 300493 300497 300499 300511 300557 300569 300581 300583 300589 
+300593 300623 300631 300647 300649 300661 300667 300673 300683 300691 300719 300721 
+300733 300739 300743 300749 300757 300761 300779 300787 300799 300809 300821 300823 
+300851 300857 300869 300877 300889 300893 300929 300931 300953 300961 300967 300973 
+300977 300997 301013 301027 301039 301051 301057 301073 301079 301123 301127 301141 
+301153 301159 301177 301181 301183 301211 301219 301237 301241 301243 301247 301267 
+301303 301319 301331 301333 301349 301361 301363 301381 301403 301409 301423 301429 
+301447 301459 301463 301471 301487 301489 301493 301501 301531 301577 301579 301583 
+301591 301601 301619 301627 301643 301649 301657 301669 301673 301681 301703 301711 
+301747 301751 301753 301759 301789 301793 301813 301831 301841 301843 301867 301877 
+301897 301901 301907 301913 301927 301933 301943 301949 301979 301991 301993 301997 
+301999 302009 302053 302111 302123 302143 302167 302171 302173 302189 302191 302213 
+302221 302227 302261 302273 302279 302287 302297 302299 302317 302329 302399 302411 
+302417 302429 302443 302459 302483 302507 302513 302551 302563 302567 302573 302579 
+302581 302587 302593 302597 302609 302629 302647 302663 302681 302711 302723 302747 
+302759 302767 302779 302791 302801 302831 302833 302837 302843 302851 302857 302873 
+302891 302903 302909 302921 302927 302941 302959 302969 302971 302977 302983 302989 
+302999 303007 303011 303013 303019 303029 303049 303053 303073 303089 303091 303097 
+303119 303139 303143 303151 303157 303187 303217 303257 303271 303283 303287 303293 
+303299 303307 303313 303323 303337 303341 303361 303367 303371 303377 303379 303389 
+303409 303421 303431 303463 303469 303473 303491 303493 303497 303529 303539 303547 
+303551 303553 303571 303581 303587 303593 303613 303617 303619 303643 303647 303649 
+303679 303683 303689 303691 303703 303713 303727 303731 303749 303767 303781 303803 
+303817 303827 303839 303859 303871 303889 303907 303917 303931 303937 303959 303983 
+303997 304009 304013 304021 304033 304039 304049 304063 304067 304069 304081 304091 
+304099 304127 304151 304153 304163 304169 304193 304211 304217 304223 304253 304259 
+304279 304301 304303 304331 304349 304357 304363 304373 304391 304393 304411 304417 
+304429 304433 304439 304457 304459 304477 304481 304489 304501 304511 304517 304523 
+304537 304541 304553 304559 304561 304597 304609 304631 304643 304651 304663 304687 
+304709 304723 304729 304739 304751 304757 304763 304771 304781 304789 304807 304813 
+304831 304847 304849 304867 304879 304883 304897 304901 304903 304907 304933 304937 
+304943 304949 304961 304979 304981 305017 305021 305023 305029 305033 305047 305069 
+305093 305101 305111 305113 305119 305131 305143 305147 305209 305219 305231 305237 
+305243 305267 305281 305297 305329 305339 305351 305353 305363 305369 305377 305401 
+305407 305411 305413 305419 305423 305441 305449 305471 305477 305479 305483 305489 
+305497 305521 305533 305551 305563 305581 305593 305597 305603 305611 305621 305633 
+305639 305663 305717 305719 305741 305743 305749 305759 305761 305771 305783 305803 
+305821 305839 305849 305857 305861 305867 305873 305917 305927 305933 305947 305971 
+305999 306011 306023 306029 306041 306049 306083 306091 306121 306133 306139 306149 
+306157 306167 306169 306191 306193 306209 306239 306247 306253 306259 306263 306301 
+306329 306331 306347 306349 306359 306367 306377 306389 306407 306419 306421 306431 
+306437 306457 306463 306473 306479 306491 306503 306511 306517 306529 306533 306541 
+306563 306577 306587 306589 306643 306653 306661 306689 306701 306703 306707 306727 
+306739 306749 306763 306781 306809 306821 306827 306829 306847 306853 306857 306871 
+306877 306883 306893 306899 306913 306919 306941 306947 306949 306953 306991 307009 
+307019 307031 307033 307067 307079 307091 307093 307103 307121 307129 307147 307163 
+307169 307171 307187 307189 307201 307243 307253 307259 307261 307267 307273 307277 
+307283 307289 307301 307337 307339 307361 307367 307381 307397 307399 307409 307423 
+307451 307471 307481 307511 307523 307529 307537 307543 307577 307583 307589 307609 
+307627 307631 307633 307639 307651 307669 307687 307691 307693 307711 307733 307759 
+307817 307823 307831 307843 307859 307871 307873 307891 307903 307919 307939 307969 
+308003 308017 308027 308041 308051 308081 308093 308101 308107 308117 308129 308137 
+308141 308149 308153 308213 308219 308249 308263 308291 308293 308303 308309 308311 
+308317 308323 308327 308333 308359 308383 308411 308423 308437 308447 308467 308489 
+308491 308501 308507 308509 308519 308521 308527 308537 308551 308569 308573 308587 
+308597 308621 308639 308641 308663 308681 308701 308713 308723 308761 308773 308801 
+308809 308813 308827 308849 308851 308857 308887 308899 308923 308927 308929 308933 
+308939 308951 308989 308999 309007 309011 309013 309019 309031 309037 309059 309079 
+309083 309091 309107 309109 309121 309131 309137 309157 309167 309173 309193 309223 
+309241 309251 309259 309269 309271 309277 309289 309293 309311 309313 309317 309359 
+309367 309371 309391 309403 309433 309437 309457 309461 309469 309479 309481 309493 
+309503 309521 309523 309539 309541 309559 309571 309577 309583 309599 309623 309629 
+309637 309667 309671 309677 309707 309713 309731 309737 309769 309779 309781 309797 
+309811 309823 309851 309853 309857 309877 309899 309929 309931 309937 309977 309989 
+310019 310021 310027 310043 310049 310081 310087 310091 310111 310117 310127 310129 
+310169 310181 310187 310223 310229 310231 310237 310243 310273 310283 310291 310313 
+310333 310357 310361 310363 310379 310397 310423 310433 310439 310447 310459 310463 
+310481 310489 310501 310507 310511 310547 310553 310559 310567 310571 310577 310591 
+310627 310643 310663 310693 310697 310711 310721 310727 310729 310733 310741 310747 
+310771 310781 310789 310801 310819 310823 310829 310831 310861 310867 310883 310889 
+310901 310927 310931 310949 310969 310987 310997 311009 311021 311027 311033 311041 
+311099 311111 311123 311137 311153 311173 311177 311183 311189 311197 311203 311237 
+311279 311291 311293 311299 311303 311323 311329 311341 311347 311359 311371 311393 
+311407 311419 311447 311453 311473 311533 311537 311539 311551 311557 311561 311567 
+311569 311603 311609 311653 311659 311677 311681 311683 311687 311711 311713 311737 
+311743 311747 311749 311791 311803 311807 311821 311827 311867 311869 311881 311897 
+311951 311957 311963 311981 312007 312023 312029 312031 312043 312047 312071 312073 
+312083 312089 312101 312107 312121 312161 312197 312199 312203 312209 312211 312217 
+312229 312233 312241 312251 312253 312269 312281 312283 312289 312311 312313 312331 
+312343 312349 312353 312371 312383 312397 312401 312407 312413 312427 312451 312469 
+312509 312517 312527 312551 312553 312563 312581 312583 312589 312601 312617 312619 
+312623 312643 312673 312677 312679 312701 312703 312709 312727 312737 312743 312757 
+312773 312779 312799 312839 312841 312857 312863 312887 312899 312929 312931 312937 
+312941 312943 312967 312971 312979 312989 313003 313009 313031 313037 313081 313087 
+313109 313127 313129 313133 313147 313151 313153 313163 313207 313211 313219 313241 
+313249 313267 313273 313289 313297 313301 313307 313321 313331 313333 313343 313351 
+313373 313381 313387 313399 313409 313471 313477 313507 313517 313543 313549 313553 
+313561 313567 313571 313583 313589 313597 313603 313613 313619 313637 313639 313661 
+313669 313679 313699 313711 313717 313721 313727 313739 313741 313763 313777 313783 
+313829 313849 313853 313879 313883 313889 313897 313909 313921 313931 313933 313949 
+313961 313969 313979 313981 313987 313991 313993 313997 314003 314021 314059 314063 
+314077 314107 314113 314117 314129 314137 314159 314161 314173 314189 314213 314219 
+314227 314233 314239 314243 314257 314261 314263 314267 314299 314329 314339 314351 
+314357 314359 314399 314401 314407 314423 314441 314453 314467 314491 314497 314513 
+314527 314543 314549 314569 314581 314591 314597 314599 314603 314623 314627 314641 
+314651 314693 314707 314711 314719 314723 314747 314761 314771 314777 314779 314807 
+314813 314827 314851 314879 314903 314917 314927 314933 314953 314957 314983 314989 
+315011 315013 315037 315047 315059 315067 315083 315097 315103 315109 315127 315179 
+315181 315193 315199 315223 315247 315251 315257 315269 315281 315313 315349 315361 
+315373 315377 315389 315407 315409 315421 315437 315449 315451 315461 315467 315481 
+315493 315517 315521 315527 315529 315547 315551 315559 315569 315589 315593 315599 
+315613 315617 315631 315643 315671 315677 315691 315697 315701 315703 315739 315743 
+315751 315779 315803 315811 315829 315851 315857 315881 315883 315893 315899 315907 
+315937 315949 315961 315967 315977 316003 316031 316033 316037 316051 316067 316073 
+316087 316097 316109 316133 316139 316153 316177 316189 316193 316201 316213 316219 
+316223 316241 316243 316259 316271 316291 316297 316301 316321 316339 316343 316363 
+316373 316391 316403 316423 316429 316439 316453 316469 316471 316493 316499 316501 
+316507 316531 316567 316571 316577 316583 316621 316633 316637 316649 316661 316663 
+316681 316691 316697 316699 316703 316717 316753 316759 316769 316777 316783 316793 
+316801 316817 316819 316847 316853 316859 316861 316879 316891 316903 316907 316919 
+316937 316951 316957 316961 316991 317003 317011 317021 317029 317047 317063 317071 
+317077 317087 317089 317123 317159 317171 317179 317189 317197 317209 317227 317257 
+317263 317267 317269 317279 317321 317323 317327 317333 317351 317353 317363 317371 
+317399 317411 317419 317431 317437 317453 317459 317483 317489 317491 317503 317539 
+317557 317563 317587 317591 317593 317599 317609 317617 317621 317651 317663 317671 
+317693 317701 317711 317717 317729 317731 317741 317743 317771 317773 317777 317783 
+317789 317797 317827 317831 317839 317857 317887 317903 317921 317923 317957 317959 
+317963 317969 317971 317983 317987 318001 318007 318023 318077 318103 318107 318127 
+318137 318161 318173 318179 318181 318191 318203 318209 318211 318229 318233 318247 
+318259 318271 318281 318287 318289 318299 318301 318313 318319 318323 318337 318347 
+318349 318377 318403 318407 318419 318431 318443 318457 318467 318473 318503 318523 
+318557 318559 318569 318581 318589 318601 318629 318641 318653 318671 318677 318679 
+318683 318691 318701 318713 318737 318743 318749 318751 318781 318793 318809 318811 
+318817 318823 318833 318841 318863 318881 318883 318889 318907 318911 318917 318919 
+318949 318979 319001 319027 319031 319037 319049 319057 319061 319069 319093 319097 
+319117 319127 319129 319133 319147 319159 319169 319183 319201 319211 319223 319237 
+319259 319279 319289 319313 319321 319327 319339 319343 319351 319357 319387 319391 
+319399 319411 319427 319433 319439 319441 319453 319469 319477 319483 319489 319499 
+319511 319519 319541 319547 319567 319577 319589 319591 319601 319607 319639 319673 
+319679 319681 319687 319691 319699 319727 319729 319733 319747 319757 319763 319811 
+319817 319819 319829 319831 319849 319883 319897 319901 319919 319927 319931 319937 
+319967 319973 319981 319993 320009 320011 320027 320039 320041 320053 320057 320063 
+320081 320083 320101 320107 320113 320119 320141 320143 320149 320153 320179 320209 
+320213 320219 320237 320239 320267 320269 320273 320291 320293 320303 320317 320329 
+320339 320377 320387 320389 320401 320417 320431 320449 320471 320477 320483 320513 
+320521 320533 320539 320561 320563 320591 320609 320611 320627 320647 320657 320659 
+320669 320687 320693 320699 320713 320741 320759 320767 320791 320821 320833 320839 
+320843 320851 320861 320867 320899 320911 320923 320927 320939 320941 320953 321007 
+321017 321031 321037 321047 321053 321073 321077 321091 321109 321143 321163 321169 
+321187 321193 321199 321203 321221 321227 321239 321247 321289 321301 321311 321313 
+321319 321323 321329 321331 321341 321359 321367 321371 321383 321397 321403 321413 
+321427 321443 321449 321467 321469 321509 321547 321553 321569 321571 321577 321593 
+321611 321617 321619 321631 321647 321661 321679 321707 321709 321721 321733 321743 
+321751 321757 321779 321799 321817 321821 321823 321829 321833 321847 321851 321889 
+321901 321911 321947 321949 321961 321983 321991 322001 322009 322013 322037 322039 
+322051 322057 322067 322073 322079 322093 322097 322109 322111 322139 322169 322171 
+322193 322213 322229 322237 322243 322247 322249 322261 322271 322319 322327 322339 
+322349 322351 322397 322403 322409 322417 322429 322433 322459 322463 322501 322513 
+322519 322523 322537 322549 322559 322571 322573 322583 322589 322591 322607 322613 
+322627 322631 322633 322649 322669 322709 322727 322747 322757 322769 322771 322781 
+322783 322807 322849 322859 322871 322877 322891 322901 322919 322921 322939 322951 
+322963 322969 322997 322999 323003 323009 323027 323053 323077 323083 323087 323093 
+323101 323123 323131 323137 323149 323201 323207 323233 323243 323249 323251 323273 
+323333 323339 323341 323359 323369 323371 323377 323381 323383 323413 323419 323441 
+323443 323467 323471 323473 323507 323509 323537 323549 323567 323579 323581 323591 
+323597 323599 323623 323641 323647 323651 323699 323707 323711 323717 323759 323767 
+323789 323797 323801 323803 323819 323837 323879 323899 323903 323923 323927 323933 
+323951 323957 323987 324011 324031 324053 324067 324073 324089 324097 324101 324113 
+324119 324131 324143 324151 324161 324179 324199 324209 324211 324217 324223 324239 
+324251 324293 324299 324301 324319 324329 324341 324361 324391 324397 324403 324419 
+324427 324431 324437 324439 324449 324451 324469 324473 324491 324497 324503 324517 
+324523 324529 324557 324587 324589 324593 324617 324619 324637 324641 324647 324661 
+324673 324689 324697 324707 324733 324743 324757 324763 324773 324781 324791 324799 
+324809 324811 324839 324847 324869 324871 324889 324893 324901 324931 324941 324949 
+324953 324977 324979 324983 324991 324997 325001 325009 325019 325021 325027 325043 
+325051 325063 325079 325081 325093 325133 325153 325163 325181 325187 325189 325201 
+325217 325219 325229 325231 325249 325271 325301 325307 325309 325319 325333 325343 
+325349 325379 325411 325421 325439 325447 325453 325459 325463 325477 325487 325513 
+325517 325537 325541 325543 325571 325597 325607 325627 325631 325643 325667 325673 
+325681 325691 325693 325697 325709 325723 325729 325747 325751 325753 325769 325777 
+325781 325783 325807 325813 325849 325861 325877 325883 325889 325891 325901 325921 
+325939 325943 325951 325957 325987 325993 325999 326023 326057 326063 326083 326087 
+326099 326101 326113 326119 326141 326143 326147 326149 326153 326159 326171 326189 
+326203 326219 326251 326257 326309 326323 326351 326353 326369 326437 326441 326449 
+326467 326479 326497 326503 326537 326539 326549 326561 326563 326567 326581 326593 
+326597 326609 326611 326617 326633 326657 326659 326663 326681 326687 326693 326701 
+326707 326737 326741 326773 326779 326831 326863 326867 326869 326873 326881 326903 
+326923 326939 326941 326947 326951 326983 326993 326999 327001 327007 327011 327017 
+327023 327059 327071 327079 327127 327133 327163 327179 327193 327203 327209 327211 
+327247 327251 327263 327277 327289 327307 327311 327317 327319 327331 327337 327343 
+327347 327401 327407 327409 327419 327421 327433 327443 327463 327469 327473 327479 
+327491 327493 327499 327511 327517 327529 327553 327557 327559 327571 327581 327583 
+327599 327619 327629 327647 327661 327667 327673 327689 327707 327721 327737 327739 
+327757 327779 327797 327799 327809 327823 327827 327829 327839 327851 327853 327869 
+327871 327881 327889 327917 327923 327941 327953 327967 327979 327983 328007 328037 
+328043 328051 328061 328063 328067 328093 328103 328109 328121 328127 328129 328171 
+328177 328213 328243 328249 328271 328277 328283 328291 328303 328327 328331 328333 
+328343 328357 328373 328379 328381 328397 328411 328421 328429 328439 328481 328511 
+328513 328519 328543 328579 328589 328591 328619 328621 328633 328637 328639 328651 
+328667 328687 328709 328721 328753 328777 328781 328787 328789 328813 328829 328837 
+328847 328849 328883 328891 328897 328901 328919 328921 328931 328961 328981 329009 
+329027 329053 329059 329081 329083 329089 329101 329111 329123 329143 329167 329177 
+329191 329201 329207 329209 329233 329243 329257 329267 329269 329281 329293 329297 
+329299 329309 329317 329321 329333 329347 329387 329393 329401 329419 329431 329471 
+329473 329489 329503 329519 329533 329551 329557 329587 329591 329597 329603 329617 
+329627 329629 329639 329657 329663 329671 329677 329683 329687 329711 329717 329723 
+329729 329761 329773 329779 329789 329801 329803 329863 329867 329873 329891 329899 
+329941 329947 329951 329957 329969 329977 329993 329999 330017 330019 330037 330041 
+330047 330053 330061 330067 330097 330103 330131 330133 330139 330149 330167 330199 
+330203 330217 330227 330229 330233 330241 330247 330271 330287 330289 330311 330313 
+330329 330331 330347 330359 330383 330389 330409 330413 330427 330431 330433 330439 
+330469 330509 330557 330563 330569 330587 330607 330611 330623 330641 330643 330653 
+330661 330679 330683 330689 330697 330703 330719 330721 330731 330749 330767 330787 
+330791 330793 330821 330823 330839 330853 330857 330859 330877 330887 330899 330907 
+330917 330943 330983 330997 331013 331027 331031 331043 331063 331081 331099 331127 
+331141 331147 331153 331159 331171 331183 331207 331213 331217 331231 331241 331249 
+331259 331277 331283 331301 331307 331319 331333 331337 331339 331349 331367 331369 
+331391 331399 331423 331447 331451 331489 331501 331511 331519 331523 331537 331543 
+331547 331549 331553 331577 331579 331589 331603 331609 331613 331651 331663 331691 
+331693 331697 331711 331739 331753 331769 331777 331781 331801 331819 331841 331843 
+331871 331883 331889 331897 331907 331909 331921 331937 331943 331957 331967 331973 
+331997 331999 332009 332011 332039 332053 332069 332081 332099 332113 332117 332147 
+332159 332161 332179 332183 332191 332201 332203 332207 332219 332221 332251 332263 
+332273 332287 332303 332309 332317 332393 332399 332411 332417 332441 332447 332461 
+332467 332471 332473 332477 332489 332509 332513 332561 332567 332569 332573 332611 
+332617 332623 332641 332687 332699 332711 332729 332743 332749 332767 332779 332791 
+332803 332837 332851 332873 332881 332887 332903 332921 332933 332947 332951 332987 
+332989 332993 333019 333023 333029 333031 333041 333049 333071 333097 333101 333103 
+333107 333131 333139 333161 333187 333197 333209 333227 333233 333253 333269 333271 
+333283 333287 333299 333323 333331 333337 333341 333349 333367 333383 333397 333419 
+333427 333433 333439 333449 333451 333457 333479 333491 333493 333497 333503 333517 
+333533 333539 333563 333581 333589 333623 333631 333647 333667 333673 333679 333691 
+333701 333713 333719 333721 333737 333757 333769 333779 333787 333791 333793 333803 
+333821 333857 333871 333911 333923 333929 333941 333959 333973 333989 333997 334021 
+334031 334043 334049 334057 334069 334093 334099 334127 334133 334157 334171 334177 
+334183 334189 334199 334231 334247 334261 334289 334297 334319 334331 334333 334349 
+334363 334379 334387 334393 334403 334421 334423 334427 334429 334447 334487 334493 
+334507 334511 334513 334541 334547 334549 334561 334603 334619 334637 334643 334651 
+334661 334667 334681 334693 334699 334717 334721 334727 334751 334753 334759 334771 
+334777 334783 334787 334793 334843 334861 334877 334889 334891 334897 334931 334963 
+334973 334987 334991 334993 335009 335021 335029 335033 335047 335051 335057 335077 
+335081 335089 335107 335113 335117 335123 335131 335149 335161 335171 335173 335207 
+335213 335221 335249 335261 335273 335281 335299 335323 335341 335347 335381 335383 
+335411 335417 335429 335449 335453 335459 335473 335477 335507 335519 335527 335539 
+335557 335567 335579 335591 335609 335633 335641 335653 335663 335669 335681 335689 
+335693 335719 335729 335743 335747 335771 335807 335809 335813 335821 335833 335843 
+335857 335879 335893 335897 335917 335941 335953 335957 335999 336029 336031 336041 
+336059 336079 336101 336103 336109 336113 336121 336143 336151 336157 336163 336181 
+336199 336211 336221 336223 336227 336239 336247 336251 336253 336263 336307 336317 
+336353 336361 336373 336397 336403 336419 336437 336463 336491 336499 336503 336521 
+336527 336529 336533 336551 336563 336571 336577 336587 336593 336599 336613 336631 
+336643 336649 336653 336667 336671 336683 336689 336703 336727 336757 336761 336767 
+336769 336773 336793 336799 336803 336823 336827 336829 336857 336863 336871 336887 
+336899 336901 336911 336929 336961 336977 336983 336989 336997 337013 337021 337031 
+337039 337049 337069 337081 337091 337097 337121 337153 337189 337201 337213 337217 
+337219 337223 337261 337277 337279 337283 337291 337301 337313 337327 337339 337343 
+337349 337361 337367 337369 337397 337411 337427 337453 337457 337487 337489 337511 
+337517 337529 337537 337541 337543 337583 337607 337609 337627 337633 337639 337651 
+337661 337669 337681 337691 337697 337721 337741 337751 337759 337781 337793 337817 
+337837 337853 337859 337861 337867 337871 337873 337891 337901 337903 337907 337919 
+337949 337957 337969 337973 337999 338017 338027 338033 338119 338137 338141 338153 
+338159 338161 338167 338171 338183 338197 338203 338207 338213 338231 338237 338251 
+338263 338267 338269 338279 338287 338293 338297 338309 338321 338323 338339 338341 
+338347 338369 338383 338389 338407 338411 338413 338423 338431 338449 338461 338473 
+338477 338497 338531 338543 338563 338567 338573 338579 338581 338609 338659 338669 
+338683 338687 338707 338717 338731 338747 338753 338761 338773 338777 338791 338803 
+338839 338851 338857 338867 338893 338909 338927 338959 338993 338999 339023 339049 
+339067 339071 339091 339103 339107 339121 339127 339137 339139 339151 339161 339173 
+339187 339211 339223 339239 339247 339257 339263 339289 339307 339323 339331 339341 
+339373 339389 339413 339433 339467 339491 339517 339527 339539 339557 339583 339589 
+339601 339613 339617 339631 339637 339649 339653 339659 339671 339673 339679 339707 
+339727 339749 339751 339761 339769 339799 339811 339817 339821 339827 339839 339841 
+339863 339887 339907 339943 339959 339991 340007 340027 340031 340037 340049 340057 
+340061 340063 340073 340079 340103 340111 340117 340121 340127 340129 340169 340183 
+340201 340211 340237 340261 340267 340283 340297 340321 340337 340339 340369 340381 
+340387 340393 340397 340409 340429 340447 340451 340453 340477 340481 340519 340541 
+340559 340573 340577 340579 340583 340591 340601 340619 340633 340643 340649 340657 
+340661 340687 340693 340709 340723 340757 340777 340787 340789 340793 340801 340811 
+340819 340849 340859 340877 340889 340897 340903 340909 340913 340919 340927 340931 
+340933 340937 340939 340957 340979 340999 341017 341027 341041 341057 341059 341063 
+341083 341087 341123 341141 341171 341179 341191 341203 341219 341227 341233 341269 
+341273 341281 341287 341293 341303 341311 341321 341323 341333 341339 341347 341357 
+341423 341443 341447 341459 341461 341477 341491 341501 341507 341521 341543 341557 
+341569 341587 341597 341603 341617 341623 341629 341641 341647 341659 341681 341687 
+341701 341729 341743 341749 341771 341773 341777 341813 341821 341827 341839 341851 
+341863 341879 341911 341927 341947 341951 341953 341959 341963 341983 341993 342037 
+342047 342049 342059 342061 342071 342073 342077 342101 342107 342131 342143 342179 
+342187 342191 342197 342203 342211 342233 342239 342241 342257 342281 342283 342299 
+342319 342337 342341 342343 342347 342359 342371 342373 342379 342389 342413 342421 
+342449 342451 342467 342469 342481 342497 342521 342527 342547 342553 342569 342593 
+342599 342607 342647 342653 342659 342673 342679 342691 342697 342733 342757 342761 
+342791 342799 342803 342821 342833 342841 342847 342863 342869 342871 342889 342899 
+342929 342949 342971 342989 343019 343037 343051 343061 343073 343081 343087 343127 
+343141 343153 343163 343169 343177 343193 343199 343219 343237 343243 343253 343261 
+343267 343289 343303 343307 343309 343313 343327 343333 343337 343373 343379 343381 
+343391 343393 343411 343423 343433 343481 343489 343517 343529 343531 343543 343547 
+343559 343561 343579 343583 343589 343591 343601 343627 343631 343639 343649 343661 
+343667 343687 343709 343727 343769 343771 343787 343799 343801 343813 343817 343823 
+343829 343831 343891 343897 343901 343913 343933 343939 343943 343951 343963 343997 
+344017 344021 344039 344053 344083 344111 344117 344153 344161 344167 344171 344173 
+344177 344189 344207 344209 344213 344221 344231 344237 344243 344249 344251 344257 
+344263 344269 344273 344291 344293 344321 344327 344347 344353 344363 344371 344417 
+344423 344429 344453 344479 344483 344497 344543 344567 344587 344599 344611 344621 
+344629 344639 344653 344671 344681 344683 344693 344719 344749 344753 344759 344791 
+344797 344801 344807 344819 344821 344843 344857 344863 344873 344887 344893 344909 
+344917 344921 344941 344957 344959 344963 344969 344987 345001 345011 345017 345019 
+345041 345047 345067 345089 345109 345133 345139 345143 345181 345193 345221 345227 
+345229 345259 345263 345271 345307 345311 345329 345379 345413 345431 345451 345461 
+345463 345473 345479 345487 345511 345517 345533 345547 345551 345571 345577 345581 
+345599 345601 345607 345637 345643 345647 345659 345673 345679 345689 345701 345707 
+345727 345731 345733 345739 345749 345757 345769 345773 345791 345803 345811 345817 
+345823 345853 345869 345881 345887 345889 345907 345923 345937 345953 345979 345997 
+346013 346039 346043 346051 346079 346091 346097 346111 346117 346133 346139 346141 
+346147 346169 346187 346201 346207 346217 346223 346259 346261 346277 346303 346309 
+346321 346331 346337 346349 346361 346369 346373 346391 346393 346397 346399 346417 
+346421 346429 346433 346439 346441 346447 346453 346469 346501 346529 346543 346547 
+346553 346559 346561 346589 346601 346607 346627 346639 346649 346651 346657 346667 
+346669 346699 346711 346721 346739 346751 346763 346793 346831 346849 346867 346873 
+346877 346891 346903 346933 346939 346943 346961 346963 347003 347033 347041 347051 
+347057 347059 347063 347069 347071 347099 347129 347131 347141 347143 347161 347167 
+347173 347177 347183 347197 347201 347209 347227 347233 347239 347251 347257 347287 
+347297 347299 347317 347329 347341 347359 347401 347411 347437 347443 347489 347509 
+347513 347519 347533 347539 347561 347563 347579 347587 347591 347609 347621 347629 
+347651 347671 347707 347717 347729 347731 347747 347759 347771 347773 347779 347801 
+347813 347821 347849 347873 347887 347891 347899 347929 347933 347951 347957 347959 
+347969 347981 347983 347987 347989 347993 348001 348011 348017 348031 348043 348053 
+348077 348083 348097 348149 348163 348181 348191 348209 348217 348221 348239 348241 
+348247 348253 348259 348269 348287 348307 348323 348353 348367 348389 348401 348407 
+348419 348421 348431 348433 348437 348443 348451 348457 348461 348463 348487 348527 
+348547 348553 348559 348563 348571 348583 348587 348617 348629 348637 348643 348661 
+348671 348709 348731 348739 348757 348763 348769 348779 348811 348827 348833 348839 
+348851 348883 348889 348911 348917 348919 348923 348937 348949 348989 348991 349007 
+349039 349043 349051 349079 349081 349093 349099 349109 349121 349133 349171 349177 
+349183 349187 349199 349207 349211 349241 349291 349303 349313 349331 349337 349343 
+349357 349369 349373 349379 349381 349387 349397 349399 349403 349409 349411 349423 
+349471 349477 349483 349493 349499 349507 349519 349529 349553 349567 349579 349589 
+349603 349637 349663 349667 349697 349709 349717 349729 349753 349759 349787 349793 
+349801 349813 349819 349829 349831 349837 349841 349849 349871 349903 349907 349913 
+349919 349927 349931 349933 349939 349949 349963 349967 349981 350003 350029 350033 
+350039 350087 350089 350093 350107 350111 350137 350159 350179 350191 350213 350219 
+350237 350249 350257 350281 350293 350347 350351 350377 350381 350411 350423 350429 
+350431 350437 350443 350447 350453 350459 350503 350521 350549 350561 350563 350587 
+350593 350617 350621 350629 350657 350663 350677 350699 350711 350719 350729 350731 
+350737 350741 350747 350767 350771 350783 350789 350803 350809 350843 350851 350869 
+350881 350887 350891 350899 350941 350947 350963 350971 350981 350983 350989 351011 
+351023 351031 351037 351041 351047 351053 351059 351061 351077 351079 351097 351121 
+351133 351151 351157 351179 351217 351223 351229 351257 351259 351269 351287 351289 
+351293 351301 351311 351341 351343 351347 351359 351361 351383 351391 351397 351401 
+351413 351427 351437 351457 351469 351479 351497 351503 351517 351529 351551 351563 
+351587 351599 351643 351653 351661 351667 351691 351707 351727 351731 351733 351749 
+351751 351763 351773 351779 351797 351803 351811 351829 351847 351851 351859 351863 
+351887 351913 351919 351929 351931 351959 351971 351991 352007 352021 352043 352049 
+352057 352069 352073 352081 352097 352109 352111 352123 352133 352181 352193 352201 
+352217 352229 352237 352249 352267 352271 352273 352301 352309 352327 352333 352349 
+352357 352361 352367 352369 352381 352399 352403 352409 352411 352421 352423 352441 
+352459 352463 352481 352483 352489 352493 352511 352523 352543 352549 352579 352589 
+352601 352607 352619 352633 352637 352661 352691 352711 352739 352741 352753 352757 
+352771 352813 352817 352819 352831 352837 352841 352853 352867 352883 352907 352909 
+352931 352939 352949 352951 352973 352991 353011 353021 353047 353053 353057 353069 
+353081 353099 353117 353123 353137 353147 353149 353161 353173 353179 353201 353203 
+353237 353263 353293 353317 353321 353329 353333 353341 353359 353389 353401 353411 
+353429 353443 353453 353459 353471 353473 353489 353501 353527 353531 353557 353567 
+353603 353611 353621 353627 353629 353641 353653 353657 353677 353681 353687 353699 
+353711 353737 353747 353767 353777 353783 353797 353807 353813 353819 353833 353867 
+353869 353879 353891 353897 353911 353917 353921 353929 353939 353963 354001 354007 
+354017 354023 354031 354037 354041 354043 354047 354073 354091 354097 354121 354139 
+354143 354149 354163 354169 354181 354209 354247 354251 354253 354257 354259 354271 
+354301 354307 354313 354317 354323 354329 354337 354353 354371 354373 354377 354383 
+354391 354401 354421 354439 354443 354451 354461 354463 354469 354479 354533 354539 
+354551 354553 354581 354587 354619 354643 354647 354661 354667 354677 354689 354701 
+354703 354727 354737 354743 354751 354763 354779 354791 354799 354829 354833 354839 
+354847 354869 354877 354881 354883 354911 354953 354961 354971 354973 354979 354983 
+354997 355007 355009 355027 355031 355037 355039 355049 355057 355063 355073 355087 
+355093 355099 355109 355111 355127 355139 355171 355193 355211 355261 355297 355307 
+355321 355331 355339 355343 355361 355363 355379 355417 355427 355441 355457 355463 
+355483 355499 355501 355507 355513 355517 355519 355529 355541 355549 355559 355571 
+355573 355591 355609 355633 355643 355651 355669 355679 355697 355717 355721 355723 
+355753 355763 355777 355783 355799 355811 355819 355841 355847 355853 355867 355891 
+355909 355913 355933 355937 355939 355951 355967 355969 356023 356039 356077 356093 
+356101 356113 356123 356129 356137 356141 356143 356171 356173 356197 356219 356243 
+356261 356263 356287 356299 356311 356327 356333 356351 356387 356399 356441 356443 
+356449 356453 356467 356479 356501 356509 356533 356549 356561 356563 356567 356579 
+356591 356621 356647 356663 356693 356701 356731 356737 356749 356761 356803 356819 
+356821 356831 356869 356887 356893 356927 356929 356933 356947 356959 356969 356977 
+356981 356989 356999 357031 357047 357073 357079 357083 357103 357107 357109 357131 
+357139 357169 357179 357197 357199 357211 357229 357239 357241 357263 357271 357281 
+357283 357293 357319 357347 357349 357353 357359 357377 357389 357421 357431 357437 
+357473 357503 357509 357517 357551 357559 357563 357569 357571 357583 357587 357593 
+357611 357613 357619 357649 357653 357659 357661 357667 357671 357677 357683 357689 
+357703 357727 357733 357737 357739 357767 357779 357781 357787 357793 357809 357817 
+357823 357829 357839 357859 357883 357913 357967 357977 357983 357989 357997 358031 
+358051 358069 358073 358079 358103 358109 358153 358157 358159 358181 358201 358213 
+358219 358223 358229 358243 358273 358277 358279 358289 358291 358297 358301 358313 
+358327 358331 358349 358373 358417 358427 358429 358441 358447 358459 358471 358483 
+358487 358499 358531 358541 358571 358573 358591 358597 358601 358607 358613 358637 
+358667 358669 358681 358691 358697 358703 358711 358723 358727 358733 358747 358753 
+358769 358783 358793 358811 358829 358847 358859 358861 358867 358877 358879 358901 
+358903 358907 358909 358931 358951 358973 358979 358987 358993 358999 359003 359017 
+359027 359041 359063 359069 359101 359111 359129 359137 359143 359147 359153 359167 
+359171 359207 359209 359231 359243 359263 359267 359279 359291 359297 359299 359311 
+359323 359327 359353 359357 359377 359389 359407 359417 359419 359441 359449 359477 
+359479 359483 359501 359509 359539 359549 359561 359563 359581 359587 359599 359621 
+359633 359641 359657 359663 359701 359713 359719 359731 359747 359753 359761 359767 
+359783 359837 359851 359869 359897 359911 359929 359981 359987 360007 360023 360037 
+360049 360053 360071 360089 360091 360163 360167 360169 360181 360187 360193 360197 
+360223 360229 360233 360257 360271 360277 360287 360289 360293 360307 360317 360323 
+360337 360391 360407 360421 360439 360457 360461 360497 360509 360511 360541 360551 
+360589 360593 360611 360637 360649 360653 360749 360769 360779 360781 360803 360817 
+360821 360823 360827 360851 360853 360863 360869 360901 360907 360947 360949 360953 
+360959 360973 360977 360979 360989 361001 361003 361013 361033 361069 361091 361093 
+361111 361159 361183 361211 361213 361217 361219 361223 361237 361241 361271 361279 
+361313 361321 361327 361337 361349 361351 361357 361363 361373 361409 361411 361421 
+361433 361441 361447 361451 361463 361469 361481 361499 361507 361511 361523 361531 
+361541 361549 361561 361577 361637 361643 361649 361651 361663 361679 361687 361723 
+361727 361747 361763 361769 361787 361789 361793 361799 361807 361843 361871 361873 
+361877 361901 361903 361909 361919 361927 361943 361961 361967 361973 361979 361993 
+362003 362027 362051 362053 362059 362069 362081 362093 362099 362107 362137 362143 
+362147 362161 362177 362191 362203 362213 362221 362233 362237 362281 362291 362293 
+362303 362309 362333 362339 362347 362353 362357 362363 362371 362377 362381 362393 
+362407 362419 362429 362431 362443 362449 362459 362473 362521 362561 362569 362581 
+362599 362629 362633 362657 362693 362707 362717 362723 362741 362743 362749 362753 
+362759 362801 362851 362863 362867 362897 362903 362911 362927 362941 362951 362953 
+362969 362977 362983 362987 363017 363019 363037 363043 363047 363059 363061 363067 
+363119 363149 363151 363157 363161 363173 363179 363199 363211 363217 363257 363269 
+363271 363277 363313 363317 363329 363343 363359 363361 363367 363371 363373 363379 
+363397 363401 363403 363431 363437 363439 363463 363481 363491 363497 363523 363529 
+363533 363541 363551 363557 363563 363569 363577 363581 363589 363611 363619 363659 
+363677 363683 363691 363719 363731 363751 363757 363761 363767 363773 363799 363809 
+363829 363833 363841 363871 363887 363889 363901 363911 363917 363941 363947 363949 
+363959 363967 363977 363989 364027 364031 364069 364073 364079 364103 364127 364129 
+364141 364171 364183 364187 364193 364213 364223 364241 364267 364271 364289 364291 
+364303 364313 364321 364333 364337 364349 364373 364379 364393 364411 364417 364423 
+364433 364447 364451 364459 364471 364499 364513 364523 364537 364541 364543 364571 
+364583 364601 364607 364621 364627 364643 364657 364669 364687 364691 364699 364717 
+364739 364747 364751 364753 364759 364801 364829 364853 364873 364879 364883 364891 
+364909 364919 364921 364937 364943 364961 364979 364993 364997 365003 365017 365021 
+365039 365063 365069 365089 365107 365119 365129 365137 365147 365159 365173 365179 
+365201 365213 365231 365249 365251 365257 365291 365293 365297 365303 365327 365333 
+365357 365369 365377 365411 365413 365419 365423 365441 365461 365467 365471 365473 
+365479 365489 365507 365509 365513 365527 365531 365537 365557 365567 365569 365587 
+365591 365611 365627 365639 365641 365669 365683 365689 365699 365747 365749 365759 
+365773 365779 365791 365797 365809 365837 365839 365851 365903 365929 365933 365941 
+365969 365983 366001 366013 366019 366029 366031 366053 366077 366097 366103 366127 
+366133 366139 366161 366167 366169 366173 366181 366193 366199 366211 366217 366221 
+366227 366239 366259 366269 366277 366287 366293 366307 366313 366329 366341 366343 
+366347 366383 366397 366409 366419 366433 366437 366439 366461 366463 366467 366479 
+366497 366511 366517 366521 366547 366593 366599 366607 366631 366677 366683 366697 
+366701 366703 366713 366721 366727 366733 366787 366791 366811 366829 366841 366851 
+366853 366859 366869 366881 366889 366901 366907 366917 366923 366941 366953 366967 
+366973 366983 366997 367001 367007 367019 367021 367027 367033 367049 367069 367097 
+367121 367123 367127 367139 367163 367181 367189 367201 367207 367219 367229 367231 
+367243 367259 367261 367273 367277 367307 367309 367313 367321 367357 367369 367391 
+367397 367427 367453 367457 367469 367501 367519 367531 367541 367547 367559 367561 
+367573 367597 367603 367613 367621 367637 367649 367651 367663 367673 367687 367699 
+367711 367721 367733 367739 367751 367771 367777 367781 367789 367819 367823 367831 
+367841 367849 367853 367867 367879 367883 367889 367909 367949 367957 368021 368029 
+368047 368059 368077 368083 368089 368099 368107 368111 368117 368129 368141 368149 
+368153 368171 368189 368197 368227 368231 368233 368243 368273 368279 368287 368293 
+368323 368327 368359 368363 368369 368399 368411 368443 368447 368453 368471 368491 
+368507 368513 368521 368531 368539 368551 368579 368593 368597 368609 368633 368647 
+368651 368653 368689 368717 368729 368737 368743 368773 368783 368789 368791 368801 
+368803 368833 368857 368873 368881 368899 368911 368939 368947 368957 369007 369013 
+369023 369029 369067 369071 369077 369079 369097 369119 369133 369137 369143 369169 
+369181 369191 369197 369211 369247 369253 369263 369269 369283 369293 369301 369319 
+369331 369353 369361 369407 369409 369419 369469 369487 369491 369539 369553 369557 
+369581 369637 369647 369659 369661 369673 369703 369709 369731 369739 369751 369791 
+369793 369821 369827 369829 369833 369841 369851 369877 369893 369913 369917 369947 
+369959 369961 369979 369983 369991 369997 370003 370009 370021 370033 370057 370061 
+370067 370081 370091 370103 370121 370133 370147 370159 370169 370193 370199 370207 
+370213 370217 370241 370247 370261 370373 370387 370399 370411 370421 370423 370427 
+370439 370441 370451 370463 370471 370477 370483 370493 370511 370529 370537 370547 
+370561 370571 370597 370603 370609 370613 370619 370631 370661 370663 370673 370679 
+370687 370693 370723 370759 370793 370801 370813 370837 370871 370873 370879 370883 
+370891 370897 370919 370949 371027 371029 371057 371069 371071 371083 371087 371099 
+371131 371141 371143 371153 371177 371179 371191 371213 371227 371233 371237 371249 
+371251 371257 371281 371291 371299 371303 371311 371321 371333 371339 371341 371353 
+371359 371383 371387 371389 371417 371447 371453 371471 371479 371491 371509 371513 
+371549 371561 371573 371587 371617 371627 371633 371639 371663 371669 371699 371719 
+371737 371779 371797 371831 371837 371843 371851 371857 371869 371873 371897 371927 
+371929 371939 371941 371951 371957 371971 371981 371999 372013 372023 372037 372049 
+372059 372061 372067 372107 372121 372131 372137 372149 372167 372173 372179 372223 
+372241 372263 372269 372271 372277 372289 372293 372299 372311 372313 372353 372367 
+372371 372377 372397 372401 372409 372413 372443 372451 372461 372473 372481 372497 
+372511 372523 372539 372607 372611 372613 372629 372637 372653 372661 372667 372677 
+372689 372707 372709 372719 372733 372739 372751 372763 372769 372773 372797 372803 
+372809 372817 372829 372833 372839 372847 372859 372871 372877 372881 372901 372917 
+372941 372943 372971 372973 372979 373003 373007 373019 373049 373063 373073 373091 
+373127 373151 373157 373171 373181 373183 373187 373193 373199 373207 373211 373213 
+373229 373231 373273 373291 373297 373301 373327 373339 373343 373349 373357 373361 
+373363 373379 373393 373447 373453 373459 373463 373487 373489 373501 373517 373553 
+373561 373567 373613 373621 373631 373649 373657 373661 373669 373693 373717 373721 
+373753 373757 373777 373783 373823 373837 373859 373861 373903 373909 373937 373943 
+373951 373963 373969 373981 373987 373999 374009 374029 374039 374041 374047 374063 
+374069 374083 374089 374093 374111 374117 374123 374137 374149 374159 374173 374177 
+374189 374203 374219 374239 374287 374291 374293 374299 374317 374321 374333 374347 
+374351 374359 374389 374399 374441 374443 374447 374461 374483 374501 374531 374537 
+374557 374587 374603 374639 374641 374653 374669 374677 374681 374683 374687 374701 
+374713 374719 374729 374741 374753 374761 374771 374783 374789 374797 374807 374819 
+374837 374839 374849 374879 374887 374893 374903 374909 374929 374939 374953 374977 
+374981 374987 374989 374993 375017 375019 375029 375043 375049 375059 375083 375091 
+375097 375101 375103 375113 375119 375121 375127 375149 375157 375163 375169 375203 
+375209 375223 375227 375233 375247 375251 375253 375257 375259 375281 375283 375311 
+375341 375359 375367 375371 375373 375391 375407 375413 375443 375449 375451 375457 
+375467 375481 375509 375511 375523 375527 375533 375553 375559 375563 375569 375593 
+375607 375623 375631 375643 375647 375667 375673 375703 375707 375709 375743 375757 
+375761 375773 375779 375787 375799 375833 375841 375857 375899 375901 375923 375931 
+375967 375971 375979 375983 375997 376001 376003 376009 376021 376039 376049 376063 
+376081 376097 376099 376127 376133 376147 376153 376171 376183 376199 376231 376237 
+376241 376283 376291 376297 376307 376351 376373 376393 376399 376417 376463 376469 
+376471 376477 376483 376501 376511 376529 376531 376547 376573 376577 376583 376589 
+376603 376609 376627 376631 376633 376639 376657 376679 376687 376699 376709 376721 
+376729 376757 376759 376769 376787 376793 376801 376807 376811 376819 376823 376837 
+376841 376847 376853 376889 376891 376897 376921 376927 376931 376933 376949 376963 
+376969 377011 377021 377051 377059 377071 377099 377123 377129 377137 377147 377171 
+377173 377183 377197 377219 377231 377257 377263 377287 377291 377297 377327 377329 
+377339 377347 377353 377369 377371 377387 377393 377459 377471 377477 377491 377513 
+377521 377527 377537 377543 377557 377561 377563 377581 377593 377599 377617 377623 
+377633 377653 377681 377687 377711 377717 377737 377749 377761 377771 377779 377789 
+377801 377809 377827 377831 377843 377851 377873 377887 377911 377963 377981 377999 
+378011 378019 378023 378041 378071 378083 378089 378101 378127 378137 378149 378151 
+378163 378167 378179 378193 378223 378229 378239 378241 378253 378269 378277 378283 
+378289 378317 378353 378361 378379 378401 378407 378439 378449 378463 378467 378493 
+378503 378509 378523 378533 378551 378559 378569 378571 378583 378593 378601 378619 
+378629 378661 378667 378671 378683 378691 378713 378733 378739 378757 378761 378779 
+378793 378809 378817 378821 378823 378869 378883 378893 378901 378919 378929 378941 
+378949 378953 378967 378977 378997 379007 379009 379013 379033 379039 379073 379081 
+379087 379097 379103 379123 379133 379147 379157 379163 379177 379187 379189 379199 
+379207 379273 379277 379283 379289 379307 379319 379333 379343 379369 379387 379391 
+379397 379399 379417 379433 379439 379441 379451 379459 379499 379501 379513 379531 
+379541 379549 379571 379573 379579 379597 379607 379633 379649 379663 379667 379679 
+379681 379693 379699 379703 379721 379723 379727 379751 379777 379787 379811 379817 
+379837 379849 379853 379859 379877 379889 379903 379909 379913 379927 379931 379963 
+379979 379993 379997 379999 380041 380047 380059 380071 380117 380129 380131 380141 
+380147 380179 380189 380197 380201 380203 380207 380231 380251 380267 380269 380287 
+380291 380299 380309 380311 380327 380329 380333 380363 380377 380383 380417 380423 
+380441 380447 380453 380459 380461 380483 380503 380533 380557 380563 380591 380621 
+380623 380629 380641 380651 380657 380707 380713 380729 380753 380777 380797 380803 
+380819 380837 380839 380843 380867 380869 380879 380881 380909 380917 380929 380951 
+380957 380971 380977 380983 381001 381011 381019 381037 381047 381061 381071 381077 
+381097 381103 381167 381169 381181 381209 381221 381223 381233 381239 381253 381287 
+381289 381301 381319 381323 381343 381347 381371 381373 381377 381383 381389 381401 
+381413 381419 381439 381443 381461 381467 381481 381487 381509 381523 381527 381529 
+381533 381541 381559 381569 381607 381629 381631 381637 381659 381673 381697 381707 
+381713 381737 381739 381749 381757 381761 381791 381793 381817 381841 381853 381859 
+381911 381917 381937 381943 381949 381977 381989 381991 382001 382003 382021 382037 
+382061 382069 382073 382087 382103 382117 382163 382171 382189 382229 382231 382241 
+382253 382267 382271 382303 382331 382351 382357 382363 382373 382391 382427 382429 
+382457 382463 382493 382507 382511 382519 382541 382549 382553 382567 382579 382583 
+382589 382601 382621 382631 382643 382649 382661 382663 382693 382703 382709 382727 
+382729 382747 382751 382763 382769 382777 382801 382807 382813 382843 382847 382861 
+382867 382871 382873 382883 382919 382933 382939 382961 382979 382999 383011 383023 
+383029 383041 383051 383069 383077 383081 383083 383099 383101 383107 383113 383143 
+383147 383153 383171 383179 383219 383221 383261 383267 383281 383291 383297 383303 
+383321 383347 383371 383393 383399 383417 383419 383429 383459 383483 383489 383519 
+383521 383527 383533 383549 383557 383573 383587 383609 383611 383623 383627 383633 
+383651 383657 383659 383681 383683 383693 383723 383729 383753 383759 383767 383777 
+383791 383797 383807 383813 383821 383833 383837 383839 383869 383891 383909 383917 
+383923 383941 383951 383963 383969 383983 383987 384001 384017 384029 384049 384061 
+384067 384079 384089 384107 384113 384133 384143 384151 384157 384173 384187 384193 
+384203 384227 384247 384253 384257 384259 384277 384287 384289 384299 384301 384317 
+384331 384343 384359 384367 384383 384403 384407 384437 384469 384473 384479 384481 
+384487 384497 384509 384533 384547 384577 384581 384589 384599 384611 384619 384623 
+384641 384673 384691 384697 384701 384719 384733 384737 384751 384757 384773 384779 
+384817 384821 384827 384841 384847 384851 384889 384907 384913 384919 384941 384961 
+384973 385001 385013 385027 385039 385057 385069 385079 385081 385087 385109 385127 
+385129 385139 385141 385153 385159 385171 385193 385199 385223 385249 385261 385267 
+385279 385289 385291 385321 385327 385331 385351 385379 385391 385393 385397 385403 
+385417 385433 385471 385481 385493 385501 385519 385531 385537 385559 385571 385573 
+385579 385589 385591 385597 385607 385621 385631 385639 385657 385661 385663 385709 
+385739 385741 385771 385783 385793 385811 385817 385831 385837 385843 385859 385877 
+385897 385901 385907 385927 385939 385943 385967 385991 385997 386017 386039 386041 
+386047 386051 386083 386093 386117 386119 386129 386131 386143 386149 386153 386159 
+386161 386173 386219 386227 386233 386237 386249 386263 386279 386297 386299 386303 
+386329 386333 386339 386363 386369 386371 386381 386383 386401 386411 386413 386429 
+386431 386437 386471 386489 386501 386521 386537 386543 386549 386569 386587 386609 
+386611 386621 386629 386641 386647 386651 386677 386689 386693 386713 386719 386723 
+386731 386747 386777 386809 386839 386851 386887 386891 386921 386927 386963 386977 
+386987 386989 386993 387007 387017 387031 387047 387071 387077 387083 387089 387109 
+387137 387151 387161 387169 387173 387187 387197 387199 387203 387227 387253 387263 
+387269 387281 387307 387313 387329 387341 387371 387397 387403 387433 387437 387449 
+387463 387493 387503 387509 387529 387551 387577 387587 387613 387623 387631 387641 
+387659 387677 387679 387683 387707 387721 387727 387743 387749 387763 387781 387791 
+387799 387839 387853 387857 387911 387913 387917 387953 387967 387971 387973 387977 
+388009 388051 388057 388067 388081 388099 388109 388111 388117 388133 388159 388163 
+388169 388177 388181 388183 388187 388211 388231 388237 388253 388259 388273 388277 
+388301 388313 388319 388351 388363 388369 388373 388391 388403 388459 388471 388477 
+388481 388483 388489 388499 388519 388529 388541 388567 388573 388621 388651 388657 
+388673 388691 388693 388697 388699 388711 388727 388757 388777 388781 388789 388793 
+388813 388823 388837 388859 388879 388891 388897 388901 388903 388931 388933 388937 
+388961 388963 388991 389003 389023 389027 389029 389041 389047 389057 389083 389089 
+389099 389111 389117 389141 389149 389161 389167 389171 389173 389189 389219 389227 
+389231 389269 389273 389287 389297 389299 389303 389357 389369 389381 389399 389401 
+389437 389447 389461 389479 389483 389507 389513 389527 389531 389533 389539 389561 
+389563 389567 389569 389579 389591 389621 389629 389651 389659 389663 389687 389699 
+389713 389723 389743 389749 389761 389773 389783 389791 389797 389819 389839 389849 
+389867 389891 389897 389903 389911 389923 389927 389941 389947 389953 389957 389971 
+389981 389989 389999 390001 390043 390067 390077 390083 390097 390101 390107 390109 
+390113 390119 390151 390157 390161 390191 390193 390199 390209 390211 390223 390263 
+390281 390289 390307 390323 390343 390347 390353 390359 390367 390373 390389 390391 
+390407 390413 390419 390421 390433 390437 390449 390463 390479 390487 390491 390493 
+390499 390503 390527 390539 390553 390581 390647 390653 390671 390673 390703 390707 
+390721 390727 390737 390739 390743 390751 390763 390781 390791 390809 390821 390829 
+390851 390869 390877 390883 390889 390893 390953 390959 390961 390967 390989 390991 
+391009 391019 391021 391031 391049 391057 391063 391067 391073 391103 391117 391133 
+391151 391159 391163 391177 391199 391217 391219 391231 391247 391249 391273 391283 
+391291 391301 391331 391337 391351 391367 391373 391379 391387 391393 391397 391399 
+391403 391441 391451 391453 391487 391519 391537 391553 391579 391613 391619 391627 
+391631 391639 391661 391679 391691 391693 391711 391717 391733 391739 391751 391753 
+391757 391789 391801 391817 391823 391847 391861 391873 391879 391889 391891 391903 
+391907 391921 391939 391961 391967 391987 391999 392011 392033 392053 392059 392069 
+392087 392099 392101 392111 392113 392131 392143 392149 392153 392159 392177 392201 
+392209 392213 392221 392233 392239 392251 392261 392263 392267 392269 392279 392281 
+392297 392299 392321 392333 392339 392347 392351 392363 392383 392389 392423 392437 
+392443 392467 392473 392477 392489 392503 392519 392531 392543 392549 392569 392593 
+392599 392611 392629 392647 392663 392669 392699 392723 392737 392741 392759 392761 
+392767 392803 392807 392809 392827 392831 392837 392849 392851 392857 392879 392893 
+392911 392923 392927 392929 392957 392963 392969 392981 392983 393007 393013 393017 
+393031 393059 393073 393077 393079 393083 393097 393103 393109 393121 393137 393143 
+393157 393161 393181 393187 393191 393203 393209 393241 393247 393257 393271 393287 
+393299 393301 393311 393331 393361 393373 393377 393383 393401 393403 393413 393451 
+393473 393479 393487 393517 393521 393539 393541 393551 393557 393571 393577 393581 
+393583 393587 393593 393611 393629 393637 393649 393667 393671 393677 393683 393697 
+393709 393713 393721 393727 393739 393749 393761 393779 393797 393847 393853 393857 
+393859 393863 393871 393901 393919 393929 393931 393947 393961 393977 393989 393997 
+394007 394019 394039 394049 394063 394073 394099 394123 394129 394153 394157 394169 
+394187 394201 394211 394223 394241 394249 394259 394271 394291 394319 394327 394357 
+394363 394367 394369 394393 394409 394411 394453 394481 394489 394501 394507 394523 
+394529 394549 394571 394577 394579 394601 394619 394631 394633 394637 394643 394673 
+394699 394717 394721 394727 394729 394733 394739 394747 394759 394787 394811 394813 
+394817 394819 394829 394837 394861 394879 394897 394931 394943 394963 394967 394969 
+394981 394987 394993 395023 395027 395039 395047 395069 395089 395093 395107 395111 
+395113 395119 395137 395141 395147 395159 395173 395189 395191 395201 395231 395243 
+395251 395261 395273 395287 395293 395303 395309 395321 395323 395377 395383 395407 
+395429 395431 395443 395449 395453 395459 395491 395509 395513 395533 395537 395543 
+395581 395597 395611 395621 395627 395657 395671 395677 395687 395701 395719 395737 
+395741 395749 395767 395803 395849 395851 395873 395887 395891 395897 395909 395921 
+395953 395959 395971 396001 396029 396031 396041 396043 396061 396079 396091 396103 
+396107 396119 396157 396173 396181 396197 396199 396203 396217 396239 396247 396259 
+396269 396293 396299 396301 396311 396323 396349 396353 396373 396377 396379 396413 
+396427 396437 396443 396449 396479 396509 396523 396527 396533 396541 396547 396563 
+396577 396581 396601 396619 396623 396629 396631 396637 396647 396667 396679 396703 
+396709 396713 396719 396733 396833 396871 396881 396883 396887 396919 396931 396937 
+396943 396947 396953 396971 396983 396997 397013 397027 397037 397051 397057 397063 
+397073 397093 397099 397127 397151 397153 397181 397183 397211 397217 397223 397237 
+397253 397259 397283 397289 397297 397301 397303 397337 397351 397357 397361 397373 
+397379 397427 397429 397433 397459 397469 397489 397493 397517 397519 397541 397543 
+397547 397549 397567 397589 397591 397597 397633 397643 397673 397687 397697 397721 
+397723 397729 397751 397753 397757 397759 397763 397799 397807 397811 397829 397849 
+397867 397897 397907 397921 397939 397951 397963 397973 397981 398011 398023 398029 
+398033 398039 398053 398059 398063 398077 398087 398113 398117 398119 398129 398143 
+398149 398171 398207 398213 398219 398227 398249 398261 398267 398273 398287 398303 
+398311 398323 398339 398341 398347 398353 398357 398369 398393 398407 398417 398423 
+398441 398459 398467 398471 398473 398477 398491 398509 398539 398543 398549 398557 
+398569 398581 398591 398609 398611 398621 398627 398669 398681 398683 398693 398711 
+398729 398731 398759 398771 398813 398819 398821 398833 398857 398863 398887 398903 
+398917 398921 398933 398941 398969 398977 398989 399023 399031 399043 399059 399067 
+399071 399079 399097 399101 399107 399131 399137 399149 399151 399163 399173 399181 
+399197 399221 399227 399239 399241 399263 399271 399277 399281 399283 399353 399379 
+399389 399391 399401 399403 399409 399433 399439 399473 399481 399491 399493 399499 
+399523 399527 399541 399557 399571 399577 399583 399587 399601 399613 399617 399643 
+399647 399667 399677 399689 399691 399719 399727 399731 399739 399757 399761 399769 
+399781 399787 399793 399851 399853 399871 399887 399899 399911 399913 399937 399941 
+399953 399979 399983 399989 400009 400031 400033 400051 400067 400069 400087 400093 
+400109 400123 400151 400157 400187 400199 400207 400217 400237 400243 400247 400249 
+400261 400277 400291 400297 400307 400313 400321 400331 400339 400381 400391 400409 
+400417 400429 400441 400457 400471 400481 400523 400559 400579 400597 400601 400607 
+400619 400643 400651 400657 400679 400681 400703 400711 400721 400723 400739 400753 
+400759 400823 400837 400849 400853 400859 400871 400903 400927 400931 400943 400949 
+400963 400997 401017 401029 401039 401053 401057 401069 401077 401087 401101 401113 
+401119 401161 401173 401179 401201 401209 401231 401237 401243 401279 401287 401309 
+401311 401321 401329 401341 401347 401371 401381 401393 401407 401411 401417 401473 
+401477 401507 401519 401537 401539 401551 401567 401587 401593 401627 401629 401651 
+401669 401671 401689 401707 401711 401743 401771 401773 401809 401813 401827 401839 
+401861 401867 401887 401903 401909 401917 401939 401953 401957 401959 401981 401987 
+401993 402023 402029 402037 402043 402049 402053 402071 402089 402091 402107 402131 
+402133 402137 402139 402197 402221 402223 402239 402253 402263 402277 402299 402307 
+402313 402329 402331 402341 402343 402359 402361 402371 402379 402383 402403 402419 
+402443 402487 402503 402511 402517 402527 402529 402541 402551 402559 402581 402583 
+402587 402593 402601 402613 402631 402691 402697 402739 402751 402757 402761 402763 
+402767 402769 402797 402803 402817 402823 402847 402851 402859 402863 402869 402881 
+402923 402943 402947 402949 402991 403001 403003 403037 403043 403049 403057 403061 
+403063 403079 403097 403103 403133 403141 403159 403163 403181 403219 403241 403243 
+403253 403261 403267 403289 403301 403309 403327 403331 403339 403363 403369 403387 
+403391 403433 403439 403483 403499 403511 403537 403547 403549 403553 403567 403577 
+403591 403603 403607 403621 403649 403661 403679 403681 403687 403703 403717 403721 
+403729 403757 403783 403787 403817 403829 403831 403849 403861 403867 403877 403889 
+403901 403933 403951 403957 403969 403979 403981 403993 404009 404011 404017 404021 
+404029 404051 404081 404099 404113 404119 404123 404161 404167 404177 404189 404191 
+404197 404213 404221 404249 404251 404267 404269 404273 404291 404309 404321 404323 
+404357 404381 404387 404389 404399 404419 404423 404429 404431 404449 404461 404483 
+404489 404497 404507 404513 404527 404531 404533 404539 404557 404597 404671 404693 
+404699 404713 404773 404779 404783 404819 404827 404837 404843 404849 404851 404941 
+404951 404959 404969 404977 404981 404983 405001 405011 405029 405037 405047 405049 
+405071 405073 405089 405091 405143 405157 405179 405199 405211 405221 405227 405239 
+405241 405247 405253 405269 405277 405287 405299 405323 405341 405343 405347 405373 
+405401 405407 405413 405437 405439 405473 405487 405491 405497 405499 405521 405527 
+405529 405541 405553 405577 405599 405607 405611 405641 405659 405667 405677 405679 
+405683 405689 405701 405703 405709 405719 405731 405749 405763 405767 405781 405799 
+405817 405827 405829 405857 405863 405869 405871 405893 405901 405917 405947 405949 
+405959 405967 405989 405991 405997 406013 406027 406037 406067 406073 406093 406117 
+406123 406169 406171 406177 406183 406207 406247 406253 406267 406271 406309 406313 
+406327 406331 406339 406349 406361 406381 406397 406403 406423 406447 406481 406499 
+406501 406507 406513 406517 406531 406547 406559 406561 406573 406577 406579 406583 
+406591 406631 406633 406649 406661 406673 406697 406699 406717 406729 406739 406789 
+406807 406811 406817 406837 406859 406873 406883 406907 406951 406969 406981 406993 
+407023 407047 407059 407083 407119 407137 407149 407153 407177 407179 407191 407203 
+407207 407219 407221 407233 407249 407257 407263 407273 407287 407291 407299 407311 
+407317 407321 407347 407357 407359 407369 407377 407383 407401 407437 407471 407483 
+407489 407501 407503 407509 407521 407527 407567 407573 407579 407587 407599 407621 
+407633 407639 407651 407657 407669 407699 407707 407713 407717 407723 407741 407747 
+407783 407789 407791 407801 407807 407821 407833 407843 407857 407861 407879 407893 
+407899 407917 407923 407947 407959 407969 407971 407977 407993 408011 408019 408041 
+408049 408071 408077 408091 408127 408131 408137 408169 408173 408197 408203 408209 
+408211 408217 408223 408229 408241 408251 408263 408271 408283 408311 408337 408341 
+408347 408361 408379 408389 408403 408413 408427 408431 408433 408437 408461 408469 
+408479 408491 408497 408533 408539 408553 408563 408607 408623 408631 408637 408643 
+408659 408677 408689 408691 408701 408703 408713 408719 408743 408763 408769 408773 
+408787 408803 408809 408817 408841 408857 408869 408911 408913 408923 408943 408953 
+408959 408971 408979 408997 409007 409021 409027 409033 409043 409063 409069 409081 
+409099 409121 409153 409163 409177 409187 409217 409237 409259 409261 409267 409271 
+409289 409291 409327 409333 409337 409349 409351 409369 409379 409391 409397 409429 
+409433 409441 409463 409471 409477 409483 409499 409517 409523 409529 409543 409573 
+409579 409589 409597 409609 409639 409657 409691 409693 409709 409711 409723 409729 
+409733 409753 409769 409777 409781 409813 409817 409823 409831 409841 409861 409867 
+409879 409889 409891 409897 409901 409909 409933 409943 409951 409961 409967 409987 
+409993 409999 410009 410029 410063 410087 410093 410117 410119 410141 410143 410149 
+410171 410173 410203 410231 410233 410239 410243 410257 410279 410281 410299 410317 
+410323 410339 410341 410353 410359 410383 410387 410393 410401 410411 410413 410453 
+410461 410477 410489 410491 410497 410507 410513 410519 410551 410561 410587 410617 
+410621 410623 410629 410651 410659 410671 410687 410701 410717 410731 410741 410747 
+410749 410759 410783 410789 410801 410807 410819 410833 410857 410899 410903 410929 
+410953 410983 410999 411001 411007 411011 411013 411031 411041 411049 411067 411071 
+411083 411101 411113 411119 411127 411143 411157 411167 411193 411197 411211 411233 
+411241 411251 411253 411259 411287 411311 411337 411347 411361 411371 411379 411409 
+411421 411443 411449 411469 411473 411479 411491 411503 411527 411529 411557 411563 
+411569 411577 411583 411589 411611 411613 411617 411637 411641 411667 411679 411683 
+411703 411707 411709 411721 411727 411737 411739 411743 411751 411779 411799 411809 
+411821 411823 411833 411841 411883 411919 411923 411937 411941 411947 411967 411991 
+412001 412007 412019 412031 412033 412037 412039 412051 412067 412073 412081 412099 
+412109 412123 412127 412133 412147 412157 412171 412187 412189 412193 412201 412211 
+412213 412219 412249 412253 412273 412277 412289 412303 412333 412339 412343 412387 
+412397 412411 412457 412463 412481 412487 412493 412537 412561 412567 412571 412589 
+412591 412603 412609 412619 412627 412637 412639 412651 412663 412667 412717 412739 
+412771 412793 412807 412831 412849 412859 412891 412901 412903 412939 412943 412949 
+412967 412987 413009 413027 413033 413053 413069 413071 413081 413087 413089 413093 
+413111 413113 413129 413141 413143 413159 413167 413183 413197 413201 413207 413233 
+413243 413251 413263 413267 413293 413299 413353 413411 413417 413429 413443 413461 
+413477 413521 413527 413533 413537 413551 413557 413579 413587 413597 413629 413653 
+413681 413683 413689 413711 413713 413719 413737 413753 413759 413779 413783 413807 
+413827 413849 413863 413867 413869 413879 413887 413911 413923 413951 413981 414013 
+414017 414019 414031 414049 414053 414061 414077 414083 414097 414101 414107 414109 
+414131 414157 414179 414199 414203 414209 414217 414221 414241 414259 414269 414277 
+414283 414311 414313 414329 414331 414347 414361 414367 414383 414389 414397 414413 
+414431 414433 414451 414457 414461 414467 414487 414503 414521 414539 414553 414559 
+414571 414577 414607 414611 414629 414641 414643 414653 414677 414679 414683 414691 
+414697 414703 414707 414709 414721 414731 414737 414763 414767 414769 414773 414779 
+414793 414803 414809 414833 414857 414871 414889 414893 414899 414913 414923 414929 
+414949 414959 414971 414977 414991 415013 415031 415039 415061 415069 415073 415087 
+415097 415109 415111 415133 415141 415147 415153 415159 415171 415187 415189 415201 
+415213 415231 415253 415271 415273 415319 415343 415379 415381 415391 415409 415427 
+415447 415469 415477 415489 415507 415517 415523 415543 415553 415559 415567 415577 
+415603 415607 415609 415627 415631 415643 415651 415661 415669 415673 415687 415691 
+415697 415717 415721 415729 415759 415783 415787 415799 415801 415819 415823 415861 
+415873 415879 415901 415931 415937 415949 415951 415957 415963 415969 415979 415993 
+415999 416011 416023 416071 416077 416089 416107 416147 416149 416153 416159 416167 
+416201 416219 416239 416243 416249 416257 416263 416281 416291 416333 416359 416387 
+416389 416393 416399 416401 416407 416413 416417 416419 416441 416443 416459 416473 
+416477 416491 416497 416501 416503 416513 416531 416543 416573 416579 416593 416621 
+416623 416629 416659 416677 416693 416719 416761 416797 416821 416833 416839 416849 
+416851 416873 416881 416887 416947 416957 416963 416989 417007 417017 417019 417023 
+417037 417089 417097 417113 417119 417127 417133 417161 417169 417173 417181 417187 
+417191 417203 417217 417227 417239 417251 417271 417283 417293 417311 417317 417331 
+417337 417371 417377 417379 417383 417419 417437 417451 417457 417479 417491 417493 
+417509 417511 417523 417541 417553 417559 417577 417581 417583 417617 417623 417631 
+417643 417649 417671 417691 417719 417721 417727 417731 417733 417737 417751 417763 
+417773 417793 417811 417821 417839 417863 417869 417881 417883 417899 417931 417941 
+417947 417953 417959 417961 417983 417997 418007 418009 418027 418031 418043 418051 
+418069 418073 418079 418087 418109 418129 418157 418169 418177 418181 418189 418199 
+418207 418219 418259 418273 418279 418289 418303 418321 418331 418337 418339 418343 
+418349 418351 418357 418373 418381 418391 418423 418427 418447 418459 418471 418493 
+418511 418553 418559 418597 418601 418603 418631 418633 418637 418657 418667 418699 
+418709 418721 418739 418751 418763 418771 418783 418787 418793 418799 418811 418813 
+418819 418837 418843 418849 418861 418867 418871 418883 418889 418909 418921 418927 
+418933 418939 418961 418981 418987 418993 418997 419047 419051 419053 419057 419059 
+419087 419141 419147 419161 419171 419183 419189 419191 419201 419231 419249 419261 
+419281 419291 419297 419303 419317 419329 419351 419383 419401 419417 419423 419429 
+419443 419449 419459 419467 419473 419477 419483 419491 419513 419527 419537 419557 
+419561 419563 419567 419579 419591 419597 419599 419603 419609 419623 419651 419687 
+419693 419701 419711 419743 419753 419777 419789 419791 419801 419803 419821 419827 
+419831 419873 419893 419921 419927 419929 419933 419953 419959 419999 420001 420029 
+420037 420041 420047 420073 420097 420103 420149 420163 420191 420193 420221 420241 
+420253 420263 420269 420271 420293 420307 420313 420317 420319 420323 420331 420341 
+420349 420353 420361 420367 420383 420397 420419 420421 420439 420457 420467 420479 
+420481 420499 420503 420521 420551 420557 420569 420571 420593 420599 420613 420671 
+420677 420683 420691 420731 420737 420743 420757 420769 420779 420781 420799 420803 
+420809 420811 420851 420853 420857 420859 420899 420919 420929 420941 420967 420977 
+420997 421009 421019 421033 421037 421049 421079 421081 421093 421103 421121 421123 
+421133 421147 421159 421163 421177 421181 421189 421207 421241 421273 421279 421303 
+421313 421331 421339 421349 421361 421381 421397 421409 421417 421423 421433 421453 
+421459 421469 421471 421483 421493 421501 421517 421559 421607 421609 421621 421633 
+421639 421643 421657 421661 421691 421697 421699 421703 421709 421711 421717 421727 
+421739 421741 421783 421801 421807 421831 421847 421891 421907 421913 421943 421973 
+421987 421997 422029 422041 422057 422063 422069 422077 422083 422087 422089 422099 
+422101 422111 422113 422129 422137 422141 422183 422203 422209 422231 422239 422243 
+422249 422267 422287 422291 422309 422311 422321 422339 422353 422363 422369 422377 
+422393 422407 422431 422453 422459 422479 422537 422549 422551 422557 422563 422567 
+422573 422581 422621 422627 422657 422689 422701 422707 422711 422749 422753 422759 
+422761 422789 422797 422803 422827 422857 422861 422867 422869 422879 422881 422893 
+422897 422899 422911 422923 422927 422969 422987 423001 423013 423019 423043 423053 
+423061 423067 423083 423091 423097 423103 423109 423121 423127 423133 423173 423179 
+423191 423209 423221 423229 423233 423251 423257 423259 423277 423281 423287 423289 
+423299 423307 423323 423341 423347 423389 423403 423413 423427 423431 423439 423457 
+423461 423463 423469 423481 423497 423503 423509 423541 423547 423557 423559 423581 
+423587 423601 423617 423649 423667 423697 423707 423713 423727 423749 423751 423763 
+423769 423779 423781 423791 423803 423823 423847 423853 423859 423869 423883 423887 
+423931 423949 423961 423977 423989 423991 424001 424003 424007 424019 424027 424037 
+424079 424091 424093 424103 424117 424121 424129 424139 424147 424157 424163 424169 
+424187 424199 424223 424231 424243 424247 424261 424267 424271 424273 424313 424331 
+424339 424343 424351 424397 424423 424429 424433 424451 424471 424481 424493 424519 
+424537 424547 424549 424559 424573 424577 424597 424601 424639 424661 424667 424679 
+424687 424693 424709 424727 424729 424757 424769 424771 424777 424811 424817 424819 
+424829 424841 424843 424849 424861 424867 424889 424891 424903 424909 424913 424939 
+424961 424967 424997 425003 425027 425039 425057 425059 425071 425083 425101 425107 
+425123 425147 425149 425189 425197 425207 425233 425237 425251 425273 425279 425281 
+425291 425297 425309 425317 425329 425333 425363 425377 425387 425393 425417 425419 
+425423 425441 425443 425471 425473 425489 425501 425519 425521 425533 425549 425563 
+425591 425603 425609 425641 425653 425681 425701 425713 425779 425783 425791 425801 
+425813 425819 425837 425839 425851 425857 425861 425869 425879 425899 425903 425911 
+425939 425959 425977 425987 425989 426007 426011 426061 426073 426077 426089 426091 
+426103 426131 426161 426163 426193 426197 426211 426229 426233 426253 426287 426301 
+426311 426319 426331 426353 426383 426389 426401 426407 426421 426427 426469 426487 
+426527 426541 426551 426553 426563 426583 426611 426631 426637 426641 426661 426691 
+426697 426707 426709 426731 426737 426739 426743 426757 426761 426763 426773 426779 
+426787 426799 426841 426859 426863 426871 426889 426893 426913 426917 426919 426931 
+426941 426971 426973 426997 427001 427013 427039 427043 427067 427069 427073 427079 
+427081 427103 427117 427151 427169 427181 427213 427237 427241 427243 427247 427249 
+427279 427283 427307 427309 427327 427333 427351 427369 427379 427381 427403 427417 
+427421 427423 427429 427433 427439 427447 427451 427457 427477 427513 427517 427523 
+427529 427541 427579 427591 427597 427619 427621 427681 427711 427717 427723 427727 
+427733 427751 427781 427787 427789 427813 427849 427859 427877 427879 427883 427913 
+427919 427939 427949 427951 427957 427967 427969 427991 427993 427997 428003 428023 
+428027 428033 428039 428041 428047 428083 428093 428137 428143 428147 428149 428161 
+428167 428173 428177 428221 428227 428231 428249 428251 428273 428297 428299 428303 
+428339 428353 428369 428401 428411 428429 428471 428473 428489 428503 428509 428531 
+428539 428551 428557 428563 428567 428569 428579 428629 428633 428639 428657 428663 
+428671 428677 428683 428693 428731 428741 428759 428777 428797 428801 428807 428809 
+428833 428843 428851 428863 428873 428899 428951 428957 428977 429007 429017 429043 
+429083 429101 429109 429119 429127 429137 429139 429161 429181 429197 429211 429217 
+429223 429227 429241 429259 429271 429277 429281 429283 429329 429347 429349 429361 
+429367 429389 429397 429409 429413 429427 429431 429449 429463 429467 429469 429487 
+429497 429503 429509 429511 429521 429529 429547 429551 429563 429581 429587 429589 
+429599 429631 429643 429659 429661 429673 429677 429679 429683 429701 429719 429727 
+429731 429733 429773 429791 429797 429817 429823 429827 429851 429853 429881 429887 
+429889 429899 429901 429907 429911 429917 429929 429931 429937 429943 429953 429971 
+429973 429991 430007 430009 430013 430019 430057 430061 430081 430091 430093 430121 
+430139 430147 430193 430259 430267 430277 430279 430289 430303 430319 430333 430343 
+430357 430393 430411 430427 430433 430453 430487 430499 430511 430513 430517 430543 
+430553 430571 430579 430589 430601 430603 430649 430663 430691 430697 430699 430709 
+430723 430739 430741 430747 430751 430753 430769 430783 430789 430799 430811 430819 
+430823 430841 430847 430861 430873 430879 430883 430891 430897 430907 430909 430921 
+430949 430957 430979 430981 430987 430999 431017 431021 431029 431047 431051 431063 
+431077 431083 431099 431107 431141 431147 431153 431173 431191 431203 431213 431219 
+431237 431251 431257 431267 431269 431287 431297 431311 431329 431339 431363 431369 
+431377 431381 431399 431423 431429 431441 431447 431449 431479 431513 431521 431533 
+431567 431581 431597 431603 431611 431617 431621 431657 431659 431663 431671 431693 
+431707 431729 431731 431759 431777 431797 431801 431803 431807 431831 431833 431857 
+431863 431867 431869 431881 431887 431891 431903 431911 431929 431933 431947 431983 
+431993 432001 432007 432023 432031 432037 432043 432053 432059 432067 432073 432097 
+432121 432137 432139 432143 432149 432161 432163 432167 432199 432203 432227 432241 
+432251 432277 432281 432287 432301 432317 432323 432337 432343 432349 432359 432373 
+432389 432391 432401 432413 432433 432437 432449 432457 432479 432491 432499 432503 
+432511 432527 432539 432557 432559 432569 432577 432587 432589 432613 432631 432637 
+432659 432661 432713 432721 432727 432737 432743 432749 432781 432793 432797 432799 
+432833 432847 432857 432869 432893 432907 432923 432931 432959 432961 432979 432983 
+432989 433003 433033 433049 433051 433061 433073 433079 433087 433093 433099 433117 
+433123 433141 433151 433187 433193 433201 433207 433229 433241 433249 433253 433259 
+433261 433267 433271 433291 433309 433319 433337 433351 433357 433361 433369 433373 
+433393 433399 433421 433429 433439 433453 433469 433471 433501 433507 433513 433549 
+433571 433577 433607 433627 433633 433639 433651 433661 433663 433673 433679 433681 
+433703 433723 433729 433747 433759 433777 433781 433787 433813 433817 433847 433859 
+433861 433877 433883 433889 433931 433943 433963 433967 433981 434009 434011 434029 
+434039 434081 434087 434107 434111 434113 434117 434141 434167 434179 434191 434201 
+434209 434221 434237 434243 434249 434261 434267 434293 434297 434303 434311 434323 
+434347 434353 434363 434377 434383 434387 434389 434407 434411 434431 434437 434459 
+434461 434471 434479 434501 434509 434521 434561 434563 434573 434593 434597 434611 
+434647 434659 434683 434689 434699 434717 434719 434743 434761 434783 434803 434807 
+434813 434821 434827 434831 434839 434849 434857 434867 434873 434881 434909 434921 
+434923 434927 434933 434939 434947 434957 434963 434977 434981 434989 435037 435041 
+435059 435103 435107 435109 435131 435139 435143 435151 435161 435179 435181 435187 
+435191 435221 435223 435247 435257 435263 435277 435283 435287 435307 435317 435343 
+435349 435359 435371 435397 435401 435403 435419 435427 435437 435439 435451 435481 
+435503 435529 435541 435553 435559 435563 435569 435571 435577 435583 435593 435619 
+435623 435637 435641 435647 435649 435653 435661 435679 435709 435731 435733 435739 
+435751 435763 435769 435779 435817 435839 435847 435857 435859 435881 435889 435893 
+435907 435913 435923 435947 435949 435973 435983 435997 436003 436013 436027 436061 
+436081 436087 436091 436097 436127 436147 436151 436157 436171 436181 436217 436231 
+436253 436273 436279 436283 436291 436307 436309 436313 436343 436357 436399 436417 
+436427 436439 436459 436463 436477 436481 436483 436507 436523 436529 436531 436547 
+436549 436571 436591 436607 436621 436627 436649 436651 436673 436687 436693 436717 
+436727 436729 436739 436741 436757 436801 436811 436819 436831 436841 436853 436871 
+436889 436913 436957 436963 436967 436973 436979 436993 436999 437011 437033 437071 
+437077 437083 437093 437111 437113 437137 437141 437149 437153 437159 437191 437201 
+437219 437237 437243 437263 437273 437279 437287 437293 437321 437351 437357 437363 
+437387 437389 437401 437413 437467 437471 437473 437497 437501 437509 437519 437527 
+437533 437539 437543 437557 437587 437629 437641 437651 437653 437677 437681 437687 
+437693 437719 437729 437743 437753 437771 437809 437819 437837 437849 437861 437867 
+437881 437909 437923 437947 437953 437959 437977 438001 438017 438029 438047 438049 
+438091 438131 438133 438143 438169 438203 438211 438223 438233 438241 438253 438259 
+438271 438281 438287 438301 438313 438329 438341 438377 438391 438401 438409 438419 
+438439 438443 438467 438479 438499 438517 438521 438523 438527 438533 438551 438569 
+438589 438601 438611 438623 438631 438637 438661 438667 438671 438701 438707 438721 
+438733 438761 438769 438793 438827 438829 438833 438847 438853 438869 438877 438887 
+438899 438913 438937 438941 438953 438961 438967 438979 438983 438989 439007 439009 
+439063 439081 439123 439133 439141 439157 439163 439171 439183 439199 439217 439253 
+439273 439279 439289 439303 439339 439349 439357 439367 439381 439409 439421 439427 
+439429 439441 439459 439463 439471 439493 439511 439519 439541 439559 439567 439573 
+439577 439583 439601 439613 439631 439639 439661 439667 439687 439693 439697 439709 
+439723 439729 439753 439759 439763 439771 439781 439787 439799 439811 439823 439849 
+439853 439861 439867 439883 439891 439903 439919 439949 439961 439969 439973 439981 
+439991 440009 440023 440039 440047 440087 440093 440101 440131 440159 440171 440177 
+440179 440183 440203 440207 440221 440227 440239 440261 440269 440281 440303 440311 
+440329 440333 440339 440347 440371 440383 440389 440393 440399 440431 440441 440443 
+440471 440497 440501 440507 440509 440527 440537 440543 440549 440551 440567 440569 
+440579 440581 440641 440651 440653 440669 440677 440681 440683 440711 440717 440723 
+440731 440753 440761 440773 440807 440809 440821 440831 440849 440863 440893 440903 
+440911 440939 440941 440953 440959 440983 440987 440989 441011 441029 441041 441043 
+441053 441073 441079 441101 441107 441109 441113 441121 441127 441157 441169 441179 
+441187 441191 441193 441229 441247 441251 441257 441263 441281 441307 441319 441349 
+441359 441361 441403 441421 441443 441449 441461 441479 441499 441517 441523 441527 
+441547 441557 441563 441569 441587 441607 441613 441619 441631 441647 441667 441697 
+441703 441713 441737 441751 441787 441797 441799 441811 441827 441829 441839 441841 
+441877 441887 441907 441913 441923 441937 441953 441971 442003 442007 442009 442019 
+442027 442031 442033 442061 442069 442097 442109 442121 442139 442147 442151 442157 
+442171 442177 442181 442193 442201 442207 442217 442229 442237 442243 442271 442283 
+442291 442319 442327 442333 442363 442367 442397 442399 442439 442447 442457 442469 
+442487 442489 442499 442501 442517 442531 442537 442571 442573 442577 442579 442601 
+442609 442619 442633 442691 442699 442703 442721 442733 442747 442753 442763 442769 
+442777 442781 442789 442807 442817 442823 442829 442831 442837 442843 442861 442879 
+442903 442919 442961 442963 442973 442979 442987 442991 442997 443011 443017 443039 
+443041 443057 443059 443063 443077 443089 443117 443123 443129 443147 443153 443159 
+443161 443167 443171 443189 443203 443221 443227 443231 443237 443243 443249 443263 
+443273 443281 443291 443293 443341 443347 443353 443363 443369 443389 443407 443413 
+443419 443423 443431 443437 443453 443467 443489 443501 443533 443543 443551 443561 
+443563 443567 443587 443591 443603 443609 443629 443659 443687 443689 443701 443711 
+443731 443749 443753 443759 443761 443771 443777 443791 443837 443851 443867 443869 
+443873 443879 443881 443893 443899 443909 443917 443939 443941 443953 443983 443987 
+443999 444001 444007 444029 444043 444047 444079 444089 444109 444113 444121 444127 
+444131 444151 444167 444173 444179 444181 444187 444209 444253 444271 444281 444287 
+444289 444293 444307 444341 444343 444347 444349 444401 444403 444421 444443 444449 
+444461 444463 444469 444473 444487 444517 444523 444527 444529 444539 444547 444553 
+444557 444569 444589 444607 444623 444637 444641 444649 444671 444677 444701 444713 
+444739 444767 444791 444793 444803 444811 444817 444833 444841 444859 444863 444869 
+444877 444883 444887 444893 444901 444929 444937 444953 444967 444971 444979 445001 
+445019 445021 445031 445033 445069 445087 445091 445097 445103 445141 445157 445169 
+445183 445187 445199 445229 445261 445271 445279 445283 445297 445307 445321 445339 
+445363 445427 445433 445447 445453 445463 445477 445499 445507 445537 445541 445567 
+445573 445583 445589 445597 445619 445631 445633 445649 445657 445691 445699 445703 
+445741 445747 445769 445771 445789 445799 445807 445829 445847 445853 445871 445877 
+445883 445891 445931 445937 445943 445967 445969 446003 446009 446041 446053 446081 
+446087 446111 446123 446129 446141 446179 446189 446191 446197 446221 446227 446231 
+446261 446263 446273 446279 446293 446309 446323 446333 446353 446363 446387 446389 
+446399 446401 446417 446441 446447 446461 446473 446477 446503 446533 446549 446561 
+446569 446597 446603 446609 446647 446657 446713 446717 446731 446753 446759 446767 
+446773 446819 446827 446839 446863 446881 446891 446893 446909 446911 446921 446933 
+446951 446969 446983 447001 447011 447019 447053 447067 447079 447101 447107 447119 
+447133 447137 447173 447179 447193 447197 447211 447217 447221 447233 447247 447257 
+447259 447263 447311 447319 447323 447331 447353 447401 447409 447427 447439 447443 
+447449 447451 447463 447467 447481 447509 447521 447527 447541 447569 447571 447611 
+447617 447637 447641 447677 447683 447701 447703 447743 447749 447757 447779 447791 
+447793 447817 447823 447827 447829 447841 447859 447877 447883 447893 447901 447907 
+447943 447961 447983 447991 448003 448013 448027 448031 448057 448067 448073 448093 
+448111 448121 448139 448141 448157 448159 448169 448177 448187 448193 448199 448207 
+448241 448249 448303 448309 448313 448321 448351 448363 448367 448373 448379 448387 
+448397 448421 448451 448519 448531 448561 448597 448607 448627 448631 448633 448667 
+448687 448697 448703 448727 448733 448741 448769 448793 448801 448807 448829 448843 
+448853 448859 448867 448871 448873 448879 448883 448907 448927 448939 448969 448993 
+448997 448999 449003 449011 449051 449077 449083 449093 449107 449117 449129 449131 
+449149 449153 449161 449171 449173 449201 449203 449209 449227 449243 449249 449261 
+449263 449269 449287 449299 449303 449311 449321 449333 449347 449353 449363 449381 
+449399 449411 449417 449419 449437 449441 449459 449473 449543 449549 449557 449563 
+449567 449569 449591 449609 449621 449629 449653 449663 449671 449677 449681 449689 
+449693 449699 449741 449759 449767 449773 449783 449797 449807 449821 449833 449851 
+449879 449921 449929 449941 449951 449959 449963 449971 449987 449989 450001 450011 
+450019 450029 450067 450071 450077 450083 450101 450103 450113 450127 450137 450161 
+450169 450193 450199 450209 450217 450223 450227 450239 450257 450259 450277 450287 
+450293 450299 450301 450311 450343 450349 450361 450367 450377 450383 450391 450403 
+450413 450421 450431 450451 450473 450479 450481 450487 450493 450503 450529 450533 
+450557 450563 450581 450587 450599 450601 450617 450641 450643 450649 450677 450691 
+450707 450719 450727 450761 450767 450787 450797 450799 450803 450809 450811 450817 
+450829 450839 450841 450847 450859 450881 450883 450887 450893 450899 450913 450917 
+450929 450943 450949 450971 450991 450997 451013 451039 451051 451057 451069 451093 
+451097 451103 451109 451159 451177 451181 451183 451201 451207 451249 451277 451279 
+451301 451303 451309 451313 451331 451337 451343 451361 451387 451397 451411 451439 
+451441 451481 451499 451519 451523 451541 451547 451553 451579 451601 451609 451621 
+451637 451657 451663 451667 451669 451679 451681 451691 451699 451709 451723 451747 
+451753 451771 451783 451793 451799 451823 451831 451837 451859 451873 451879 451897 
+451901 451903 451909 451921 451933 451937 451939 451961 451967 451987 452009 452017 
+452027 452033 452041 452077 452083 452087 452131 452159 452161 452171 452191 452201 
+452213 452227 452233 452239 452269 452279 452293 452297 452329 452363 452377 452393 
+452401 452443 452453 452497 452519 452521 452531 452533 452537 452539 452549 452579 
+452587 452597 452611 452629 452633 452671 452687 452689 452701 452731 452759 452773 
+452797 452807 452813 452821 452831 452857 452869 452873 452923 452953 452957 452983 
+452989 453023 453029 453053 453073 453107 453119 453133 453137 453143 453157 453161 
+453181 453197 453199 453209 453217 453227 453239 453247 453269 453289 453293 453301 
+453311 453317 453329 453347 453367 453371 453377 453379 453421 453451 453461 453527 
+453553 453559 453569 453571 453599 453601 453617 453631 453637 453641 453643 453659 
+453667 453671 453683 453703 453707 453709 453737 453757 453797 453799 453823 453833 
+453847 453851 453877 453889 453907 453913 453923 453931 453949 453961 453977 453983 
+453991 454009 454021 454031 454033 454039 454061 454063 454079 454109 454141 454151 
+454159 454183 454199 454211 454213 454219 454229 454231 454247 454253 454277 454297 
+454303 454313 454331 454351 454357 454361 454379 454387 454409 454417 454451 454453 
+454483 454501 454507 454513 454541 454543 454547 454577 454579 454603 454609 454627 
+454637 454673 454679 454709 454711 454721 454723 454759 454763 454777 454799 454823 
+454843 454847 454849 454859 454889 454891 454907 454919 454921 454931 454943 454967 
+454969 454973 454991 455003 455011 455033 455047 455053 455093 455099 455123 455149 
+455159 455167 455171 455177 455201 455219 455227 455233 455237 455261 455263 455269 
+455291 455309 455317 455321 455333 455339 455341 455353 455381 455393 455401 455407 
+455419 455431 455437 455443 455461 455471 455473 455479 455489 455491 455513 455527 
+455531 455537 455557 455573 455579 455597 455599 455603 455627 455647 455659 455681 
+455683 455687 455701 455711 455717 455737 455761 455783 455789 455809 455827 455831 
+455849 455863 455881 455899 455921 455933 455941 455953 455969 455977 455989 455993 
+455999 456007 456013 456023 456037 456047 456061 456091 456107 456109 456119 456149 
+456151 456167 456193 456223 456233 456241 456283 456293 456329 456349 456353 456367 
+456377 456403 456409 456427 456439 456451 456457 456461 456499 456503 456517 456523 
+456529 456539 456553 456557 456559 456571 456581 456587 456607 456611 456613 456623 
+456641 456647 456649 456653 456679 456683 456697 456727 456737 456763 456767 456769 
+456791 456809 456811 456821 456871 456877 456881 456899 456901 456923 456949 456959 
+456979 456991 457001 457003 457013 457021 457043 457049 457057 457087 457091 457097 
+457099 457117 457139 457151 457153 457183 457189 457201 457213 457229 457241 457253 
+457267 457271 457277 457279 457307 457319 457333 457339 457363 457367 457381 457393 
+457397 457399 457403 457411 457421 457433 457459 457469 457507 457511 457517 457547 
+457553 457559 457571 457607 457609 457621 457643 457651 457661 457669 457673 457679 
+457687 457697 457711 457739 457757 457789 457799 457813 457817 457829 457837 457871 
+457889 457903 457913 457943 457979 457981 457987 458009 458027 458039 458047 458053 
+458057 458063 458069 458119 458123 458173 458179 458189 458191 458197 458207 458219 
+458239 458309 458317 458323 458327 458333 458357 458363 458377 458399 458401 458407 
+458449 458477 458483 458501 458531 458533 458543 458567 458569 458573 458593 458599 
+458611 458621 458629 458639 458651 458663 458669 458683 458701 458719 458729 458747 
+458789 458791 458797 458807 458819 458849 458863 458879 458891 458897 458917 458921 
+458929 458947 458957 458959 458963 458971 458977 458981 458987 458993 459007 459013 
+459023 459029 459031 459037 459047 459089 459091 459113 459127 459167 459169 459181 
+459209 459223 459229 459233 459257 459271 459293 459301 459313 459317 459337 459341 
+459343 459353 459373 459377 459383 459397 459421 459427 459443 459463 459467 459469 
+459479 459509 459521 459523 459593 459607 459611 459619 459623 459631 459647 459649 
+459671 459677 459691 459703 459749 459763 459791 459803 459817 459829 459841 459847 
+459883 459913 459923 459929 459937 459961 460013 460039 460051 460063 460073 460079 
+460081 460087 460091 460099 460111 460127 460147 460157 460171 460181 460189 460211 
+460217 460231 460247 460267 460289 460297 460301 460337 460349 460373 460379 460387 
+460393 460403 460409 460417 460451 460463 460477 460531 460543 460561 460571 460589 
+460609 460619 460627 460633 460637 460643 460657 460673 460697 460709 460711 460721 
+460771 460777 460787 460793 460813 460829 460841 460843 460871 460891 460903 460907 
+460913 460919 460937 460949 460951 460969 460973 460979 460981 460987 460991 461009 
+461011 461017 461051 461053 461059 461093 461101 461119 461143 461147 461171 461183 
+461191 461207 461233 461239 461257 461269 461273 461297 461299 461309 461317 461323 
+461327 461333 461359 461381 461393 461407 461411 461413 461437 461441 461443 461467 
+461479 461507 461521 461561 461569 461581 461599 461603 461609 461627 461639 461653 
+461677 461687 461689 461693 461707 461717 461801 461803 461819 461843 461861 461887 
+461891 461917 461921 461933 461957 461971 461977 461983 462013 462041 462067 462073 
+462079 462097 462103 462109 462113 462131 462149 462181 462191 462199 462221 462239 
+462263 462271 462307 462311 462331 462337 462361 462373 462377 462401 462409 462419 
+462421 462437 462443 462467 462481 462491 462493 462499 462529 462541 462547 462557 
+462569 462571 462577 462589 462607 462629 462641 462643 462653 462659 462667 462673 
+462677 462697 462713 462719 462727 462733 462739 462773 462827 462841 462851 462863 
+462871 462881 462887 462899 462901 462911 462937 462947 462953 462983 463003 463031 
+463033 463093 463103 463157 463181 463189 463207 463213 463219 463231 463237 463247 
+463249 463261 463283 463291 463297 463303 463313 463319 463321 463339 463343 463363 
+463387 463399 463433 463447 463451 463453 463457 463459 463483 463501 463511 463513 
+463523 463531 463537 463549 463579 463613 463627 463633 463643 463649 463663 463679 
+463693 463711 463717 463741 463747 463753 463763 463781 463787 463807 463823 463829 
+463831 463849 463861 463867 463873 463889 463891 463907 463919 463921 463949 463963 
+463973 463987 463993 464003 464011 464021 464033 464047 464069 464081 464089 464119 
+464129 464131 464137 464141 464143 464171 464173 464197 464201 464213 464237 464251 
+464257 464263 464279 464281 464291 464309 464311 464327 464351 464371 464381 464383 
+464413 464419 464437 464447 464459 464467 464479 464483 464521 464537 464539 464549 
+464557 464561 464587 464591 464603 464617 464621 464647 464663 464687 464699 464741 
+464747 464749 464753 464767 464771 464773 464777 464801 464803 464809 464813 464819 
+464843 464857 464879 464897 464909 464917 464923 464927 464939 464941 464951 464953 
+464963 464983 464993 464999 465007 465011 465013 465019 465041 465061 465067 465071 
+465077 465079 465089 465107 465119 465133 465151 465161 465163 465167 465169 465173 
+465187 465209 465211 465259 465271 465277 465281 465293 465299 465317 465319 465331 
+465337 465373 465379 465383 465407 465419 465433 465463 465469 465523 465529 465541 
+465551 465581 465587 465611 465631 465643 465649 465659 465679 465701 465721 465739 
+465743 465761 465781 465797 465799 465809 465821 465833 465841 465887 465893 465901 
+465917 465929 465931 465947 465977 465989 466009 466019 466027 466033 466043 466061 
+466069 466073 466079 466087 466091 466121 466139 466153 466171 466181 466183 466201 
+466243 466247 466261 466267 466273 466283 466303 466321 466331 466339 466357 466369 
+466373 466409 466423 466441 466451 466483 466517 466537 466547 466553 466561 466567 
+466573 466579 466603 466619 466637 466649 466651 466673 466717 466723 466729 466733 
+466747 466751 466777 466787 466801 466819 466853 466859 466897 466909 466913 466919 
+466951 466957 466997 467003 467009 467017 467021 467063 467081 467083 467101 467119 
+467123 467141 467147 467171 467183 467197 467209 467213 467237 467239 467261 467293 
+467297 467317 467329 467333 467353 467371 467399 467417 467431 467437 467447 467471 
+467473 467477 467479 467491 467497 467503 467507 467527 467531 467543 467549 467557 
+467587 467591 467611 467617 467627 467629 467633 467641 467651 467657 467669 467671 
+467681 467689 467699 467713 467729 467737 467743 467749 467773 467783 467813 467827 
+467833 467867 467869 467879 467881 467893 467897 467899 467903 467927 467941 467953 
+467963 467977 468001 468011 468019 468029 468049 468059 468067 468071 468079 468107 
+468109 468113 468121 468133 468137 468151 468157 468173 468187 468191 468199 468239 
+468241 468253 468271 468277 468289 468319 468323 468353 468359 468371 468389 468421 
+468439 468451 468463 468473 468491 468493 468499 468509 468527 468551 468557 468577 
+468581 468593 468599 468613 468619 468623 468641 468647 468653 468661 468667 468683 
+468691 468697 468703 468709 468719 468737 468739 468761 468773 468781 468803 468817 
+468821 468841 468851 468859 468869 468883 468887 468889 468893 468899 468913 468953 
+468967 468973 468983 469009 469031 469037 469069 469099 469121 469127 469141 469153 
+469169 469193 469207 469219 469229 469237 469241 469253 469267 469279 469283 469303 
+469321 469331 469351 469363 469367 469369 469379 469397 469411 469429 469439 469457 
+469487 469501 469529 469541 469543 469561 469583 469589 469613 469627 469631 469649 
+469657 469673 469687 469691 469717 469723 469747 469753 469757 469769 469787 469793 
+469801 469811 469823 469841 469849 469877 469879 469891 469907 469919 469939 469957 
+469969 469979 469993 470021 470039 470059 470077 470081 470083 470087 470089 470131 
+470149 470153 470161 470167 470179 470201 470207 470209 470213 470219 470227 470243 
+470251 470263 470279 470297 470299 470303 470317 470333 470347 470359 470389 470399 
+470411 470413 470417 470429 470443 470447 470453 470461 470471 470473 470489 470501 
+470513 470521 470531 470539 470551 470579 470593 470597 470599 470609 470621 470627 
+470647 470651 470653 470663 470669 470689 470711 470719 470731 470749 470779 470783 
+470791 470819 470831 470837 470863 470867 470881 470887 470891 470903 470927 470933 
+470941 470947 470957 470959 470993 470999 471007 471041 471061 471073 471089 471091 
+471101 471137 471139 471161 471173 471179 471187 471193 471209 471217 471241 471253 
+471259 471277 471281 471283 471299 471301 471313 471353 471389 471391 471403 471407 
+471439 471451 471467 471481 471487 471503 471509 471521 471533 471539 471553 471571 
+471589 471593 471607 471617 471619 471641 471649 471659 471671 471673 471677 471683 
+471697 471703 471719 471721 471749 471769 471781 471791 471803 471817 471841 471847 
+471853 471871 471893 471901 471907 471923 471929 471931 471943 471949 471959 471997 
+472019 472027 472051 472057 472063 472067 472103 472111 472123 472127 472133 472139 
+472151 472159 472163 472189 472193 472247 472249 472253 472261 472273 472289 472301 
+472309 472319 472331 472333 472349 472369 472391 472393 472399 472411 472421 472457 
+472469 472477 472523 472541 472543 472559 472561 472573 472597 472631 472639 472643 
+472669 472687 472691 472697 472709 472711 472721 472741 472751 472763 472793 472799 
+472817 472831 472837 472847 472859 472883 472907 472909 472921 472937 472939 472963 
+472993 473009 473021 473027 473089 473101 473117 473141 473147 473159 473167 473173 
+473191 473197 473201 473203 473219 473227 473257 473279 473287 473293 473311 473321 
+473327 473351 473353 473377 473381 473383 473411 473419 473441 473443 473453 473471 
+473477 473479 473497 473503 473507 473513 473519 473527 473531 473533 473549 473579 
+473597 473611 473617 473633 473647 473659 473719 473723 473729 473741 473743 473761 
+473789 473833 473839 473857 473861 473867 473887 473899 473911 473923 473927 473929 
+473939 473951 473953 473971 473981 473987 473999 474017 474029 474037 474043 474049 
+474059 474073 474077 474101 474119 474127 474137 474143 474151 474163 474169 474197 
+474211 474223 474241 474263 474289 474307 474311 474319 474337 474343 474347 474359 
+474379 474389 474391 474413 474433 474437 474443 474479 474491 474497 474499 474503 
+474533 474541 474547 474557 474569 474571 474581 474583 474619 474629 474647 474659 
+474667 474671 474707 474709 474737 474751 474757 474769 474779 474787 474809 474811 
+474839 474847 474857 474899 474907 474911 474917 474923 474931 474937 474941 474949 
+474959 474977 474983 475037 475051 475073 475081 475091 475093 475103 475109 475141 
+475147 475151 475159 475169 475207 475219 475229 475243 475271 475273 475283 475289 
+475297 475301 475327 475331 475333 475351 475367 475369 475379 475381 475403 475417 
+475421 475427 475429 475441 475457 475469 475483 475511 475523 475529 475549 475583 
+475597 475613 475619 475621 475637 475639 475649 475669 475679 475681 475691 475693 
+475697 475721 475729 475751 475753 475759 475763 475777 475789 475793 475807 475823 
+475831 475837 475841 475859 475877 475879 475889 475897 475903 475907 475921 475927 
+475933 475957 475973 475991 475997 476009 476023 476027 476029 476039 476041 476059 
+476081 476087 476089 476101 476107 476111 476137 476143 476167 476183 476219 476233 
+476237 476243 476249 476279 476299 476317 476347 476351 476363 476369 476381 476401 
+476407 476419 476423 476429 476467 476477 476479 476507 476513 476519 476579 476587 
+476591 476599 476603 476611 476633 476639 476647 476659 476681 476683 476701 476713 
+476719 476737 476743 476753 476759 476783 476803 476831 476849 476851 476863 476869 
+476887 476891 476911 476921 476929 476977 476981 476989 477011 477013 477017 477019 
+477031 477047 477073 477077 477091 477131 477149 477163 477209 477221 477229 477259 
+477277 477293 477313 477317 477329 477341 477359 477361 477383 477409 477439 477461 
+477469 477497 477511 477517 477523 477539 477551 477553 477557 477571 477577 477593 
+477619 477623 477637 477671 477677 477721 477727 477731 477739 477767 477769 477791 
+477797 477809 477811 477821 477823 477839 477847 477857 477863 477881 477899 477913 
+477941 477947 477973 477977 477991 478001 478039 478063 478067 478069 478087 478099 
+478111 478129 478139 478157 478169 478171 478189 478199 478207 478213 478241 478243 
+478253 478259 478271 478273 478321 478339 478343 478351 478391 478399 478403 478411 
+478417 478421 478427 478433 478441 478451 478453 478459 478481 478483 478493 478523 
+478531 478571 478573 478579 478589 478603 478627 478631 478637 478651 478679 478697 
+478711 478727 478729 478739 478741 478747 478763 478769 478787 478801 478811 478813 
+478823 478831 478843 478853 478861 478871 478879 478897 478901 478913 478927 478931 
+478937 478943 478963 478967 478991 478999 479023 479027 479029 479041 479081 479131 
+479137 479147 479153 479189 479191 479201 479209 479221 479231 479239 479243 479263 
+479267 479287 479299 479309 479317 479327 479357 479371 479377 479387 479419 479429 
+479431 479441 479461 479473 479489 479497 479509 479513 479533 479543 479561 479569 
+479581 479593 479599 479623 479629 479639 479701 479749 479753 479761 479771 479777 
+479783 479797 479813 479821 479833 479839 479861 479879 479881 479891 479903 479909 
+479939 479951 479953 479957 479971 480013 480017 480019 480023 480043 480047 480049 
+480059 480061 480071 480091 480101 480107 480113 480133 480143 480157 480167 480169 
+480203 480209 480287 480299 480317 480329 480341 480343 480349 480367 480373 480379 
+480383 480391 480409 480419 480427 480449 480451 480461 480463 480499 480503 480509 
+480517 480521 480527 480533 480541 480553 480563 480569 480583 480587 480647 480661 
+480707 480713 480731 480737 480749 480761 480773 480787 480803 480827 480839 480853 
+480881 480911 480919 480929 480937 480941 480959 480967 480979 480989 481001 481003 
+481009 481021 481043 481051 481067 481073 481087 481093 481097 481109 481123 481133 
+481141 481147 481153 481157 481171 481177 481181 481199 481207 481211 481231 481249 
+481297 481301 481303 481307 481343 481363 481373 481379 481387 481409 481417 481433 
+481447 481469 481489 481501 481513 481531 481549 481571 481577 481589 481619 481633 
+481639 481651 481667 481673 481681 481693 481697 481699 481721 481751 481753 481769 
+481787 481801 481807 481813 481837 481843 481847 481849 481861 481867 481879 481883 
+481909 481939 481963 481997 482017 482021 482029 482033 482039 482051 482071 482093 
+482099 482101 482117 482123 482179 482189 482203 482213 482227 482231 482233 482243 
+482263 482281 482309 482323 482347 482351 482359 482371 482387 482393 482399 482401 
+482407 482413 482423 482437 482441 482483 482501 482507 482509 482513 482519 482527 
+482539 482569 482593 482597 482621 482627 482633 482641 482659 482663 482683 482687 
+482689 482707 482711 482717 482719 482731 482743 482753 482759 482767 482773 482789 
+482803 482819 482827 482837 482861 482863 482873 482897 482899 482917 482941 482947 
+482957 482971 483017 483031 483061 483071 483097 483127 483139 483163 483167 483179 
+483209 483211 483221 483229 483233 483239 483247 483251 483281 483289 483317 483323 
+483337 483347 483367 483377 483389 483397 483407 483409 483433 483443 483467 483481 
+483491 483499 483503 483523 483541 483551 483557 483563 483577 483611 483619 483629 
+483643 483649 483671 483697 483709 483719 483727 483733 483751 483757 483761 483767 
+483773 483787 483809 483811 483827 483829 483839 483853 483863 483869 483883 483907 
+483929 483937 483953 483971 483991 484019 484027 484037 484061 484067 484079 484091 
+484111 484117 484123 484129 484151 484153 484171 484181 484193 484201 484207 484229 
+484243 484259 484283 484301 484303 484327 484339 484361 484369 484373 484397 484411 
+484417 484439 484447 484457 484459 484487 484489 484493 484531 484543 484577 484597 
+484607 484609 484613 484621 484639 484643 484691 484703 484727 484733 484751 484763 
+484769 484777 484787 484829 484853 484867 484927 484951 484987 484999 485021 485029 
+485041 485053 485059 485063 485081 485101 485113 485123 485131 485137 485161 485167 
+485171 485201 485207 485209 485263 485311 485347 485351 485363 485371 485383 485389 
+485411 485417 485423 485437 485447 485479 485497 485509 485519 485543 485567 485587 
+485593 485603 485609 485647 485657 485671 485689 485701 485717 485729 485731 485753 
+485777 485819 485827 485831 485833 485893 485899 485909 485923 485941 485959 485977 
+485993 486023 486037 486041 486043 486053 486061 486071 486091 486103 486119 486133 
+486139 486163 486179 486181 486193 486203 486221 486223 486247 486281 486293 486307 
+486313 486323 486329 486331 486341 486349 486377 486379 486389 486391 486397 486407 
+486433 486443 486449 486481 486491 486503 486509 486511 486527 486539 486559 486569 
+486583 486589 486601 486617 486637 486641 486643 486653 486667 486671 486677 486679 
+486683 486697 486713 486721 486757 486767 486769 486781 486797 486817 486821 486833 
+486839 486869 486907 486923 486929 486943 486947 486949 486971 486977 486991 487007 
+487013 487021 487049 487051 487057 487073 487079 487093 487099 487111 487133 487177 
+487183 487187 487211 487213 487219 487247 487261 487283 487303 487307 487313 487349 
+487363 487381 487387 487391 487397 487423 487427 487429 487447 487457 487463 487469 
+487471 487477 487481 487489 487507 487561 487589 487601 487603 487607 487637 487649 
+487651 487657 487681 487691 487703 487709 487717 487727 487733 487741 487757 487769 
+487783 487789 487793 487811 487819 487829 487831 487843 487873 487889 487891 487897 
+487933 487943 487973 487979 487997 488003 488009 488011 488021 488051 488057 488069 
+488119 488143 488149 488153 488161 488171 488197 488203 488207 488209 488227 488231 
+488233 488239 488249 488261 488263 488287 488303 488309 488311 488317 488321 488329 
+488333 488339 488347 488353 488381 488399 488401 488407 488417 488419 488441 488459 
+488473 488503 488513 488539 488567 488573 488603 488611 488617 488627 488633 488639 
+488641 488651 488687 488689 488701 488711 488717 488723 488729 488743 488749 488759 
+488779 488791 488797 488821 488827 488833 488861 488879 488893 488897 488909 488921 
+488947 488959 488981 488993 489001 489011 489019 489043 489053 489061 489101 489109 
+489113 489127 489133 489157 489161 489179 489191 489197 489217 489239 489241 489257 
+489263 489283 489299 489329 489337 489343 489361 489367 489389 489407 489409 489427 
+489431 489439 489449 489457 489479 489487 489493 489529 489539 489551 489553 489557 
+489571 489613 489631 489653 489659 489673 489677 489679 489689 489691 489733 489743 
+489761 489791 489793 489799 489803 489817 489823 489833 489847 489851 489869 489871 
+489887 489901 489911 489913 489941 489943 489959 489961 489977 489989 490001 490003 
+490019 490031 490033 490057 490097 490103 490111 490117 490121 490151 490159 490169 
+490183 490201 490207 490223 490241 490247 490249 490267 490271 490277 490283 490309 
+490313 490339 490367 490393 490417 490421 490453 490459 490463 490481 490493 490499 
+490519 490537 490541 490543 490549 490559 490571 490573 490577 490579 490591 490619 
+490627 490631 490643 490661 490663 490697 490733 490741 490769 490771 490783 490829 
+490837 490849 490859 490877 490891 490913 490921 490927 490937 490949 490951 490957 
+490967 490969 490991 490993 491003 491039 491041 491059 491081 491083 491129 491137 
+491149 491159 491167 491171 491201 491213 491219 491251 491261 491273 491279 491297 
+491299 491327 491329 491333 491339 491341 491353 491357 491371 491377 491417 491423 
+491429 491461 491483 491489 491497 491501 491503 491527 491531 491537 491539 491581 
+491591 491593 491611 491627 491633 491639 491651 491653 491669 491677 491707 491719 
+491731 491737 491747 491773 491783 491789 491797 491819 491833 491837 491851 491857 
+491867 491873 491899 491923 491951 491969 491977 491983 492007 492013 492017 492029 
+492047 492053 492059 492061 492067 492077 492083 492103 492113 492227 492251 492253 
+492257 492281 492293 492299 492319 492377 492389 492397 492403 492409 492413 492421 
+492431 492463 492467 492487 492491 492511 492523 492551 492563 492587 492601 492617 
+492619 492629 492631 492641 492647 492659 492671 492673 492707 492719 492721 492731 
+492757 492761 492763 492769 492781 492799 492839 492853 492871 492883 492893 492901 
+492911 492967 492979 493001 493013 493021 493027 493043 493049 493067 493093 493109 
+493111 493121 493123 493127 493133 493139 493147 493159 493169 493177 493193 493201 
+493211 493217 493219 493231 493243 493249 493277 493279 493291 493301 493313 493333 
+493351 493369 493393 493397 493399 493403 493433 493447 493457 493463 493481 493523 
+493531 493541 493567 493573 493579 493583 493607 493621 493627 493643 493657 493693 
+493709 493711 493721 493729 493733 493747 493777 493793 493807 493811 493813 493817 
+493853 493859 493873 493877 493897 493919 493931 493937 493939 493967 493973 493979 
+493993 494023 494029 494041 494051 494069 494077 494083 494093 494101 494107 494129 
+494141 494147 494167 494191 494213 494237 494251 494257 494267 494269 494281 494287 
+494317 494327 494341 494353 494359 494369 494381 494383 494387 494407 494413 494441 
+494443 494471 494497 494519 494521 494539 494561 494563 494567 494587 494591 494609 
+494617 494621 494639 494647 494651 494671 494677 494687 494693 494699 494713 494719 
+494723 494731 494737 494743 494749 494759 494761 494783 494789 494803 494843 494849 
+494873 494899 494903 494917 494927 494933 494939 494959 494987 495017 495037 495041 
+495043 495067 495071 495109 495113 495119 495133 495139 495149 495151 495161 495181 
+495199 495211 495221 495241 495269 495277 495289 495301 495307 495323 495337 495343 
+495347 495359 495361 495371 495377 495389 495401 495413 495421 495433 495437 495449 
+495457 495461 495491 495511 495527 495557 495559 495563 495569 495571 495587 495589 
+495611 495613 495617 495619 495629 495637 495647 495667 495679 495701 495707 495713 
+495749 495751 495757 495769 495773 495787 495791 495797 495799 495821 495827 495829 
+495851 495877 495893 495899 495923 495931 495947 495953 495959 495967 495973 495983 
+496007 496019 496039 496051 496063 496073 496079 496123 496127 496163 496187 496193 
+496211 496229 496231 496259 496283 496289 496291 496297 496303 496313 496333 496339 
+496343 496381 496399 496427 496439 496453 496459 496471 496477 496481 496487 496493 
+496499 496511 496549 496579 496583 496609 496631 496669 496681 496687 496703 496711 
+496733 496747 496763 496789 496813 496817 496841 496849 496871 496877 496889 496891 
+496897 496901 496913 496919 496949 496963 496997 496999 497011 497017 497041 497047 
+497051 497069 497093 497111 497113 497117 497137 497141 497153 497171 497177 497197 
+497239 497257 497261 497269 497279 497281 497291 497297 497303 497309 497323 497339 
+497351 497389 497411 497417 497423 497449 497461 497473 497479 497491 497501 497507 
+497509 497521 497537 497551 497557 497561 497579 497587 497597 497603 497633 497659 
+497663 497671 497677 497689 497701 497711 497719 497729 497737 497741 497771 497773 
+497801 497813 497831 497839 497851 497867 497869 497873 497899 497929 497957 497963 
+497969 497977 497989 497993 497999 498013 498053 498061 498073 498089 498101 498103 
+498119 498143 498163 498167 498181 498209 498227 498257 498259 498271 498301 498331 
+498343 498361 498367 498391 498397 498401 498403 498409 498439 498461 498467 498469 
+498493 498497 498521 498523 498527 498551 498557 498577 498583 498599 498611 498613 
+498643 498647 498653 498679 498689 498691 498733 498739 498749 498761 498767 498779 
+498781 498787 498791 498803 498833 498857 498859 498881 498907 498923 498931 498937 
+498947 498961 498973 498977 498989 499021 499027 499033 499039 499063 499067 499099 
+499117 499127 499129 499133 499139 499141 499151 499157 499159 499181 499183 499189 
+499211 499229 499253 499267 499277 499283 499309 499321 499327 499349 499361 499363 
+499391 499397 499403 499423 499439 499459 499481 499483 499493 499507 499519 499523 
+499549 499559 499571 499591 499601 499607 499621 499633 499637 499649 499661 499663 
+499669 499673 499679 499687 499691 499693 499711 499717 499729 499739 499747 499781 
+499787 499801 499819 499853 499879 499883 499897 499903 499927 499943 499957 499969 
+499973 499979 500009 500029 500041 500057 500069 500083 500107 500111 500113 500119 
+500153 500167 500173 500177 500179 500197 500209 500231 500233 500237 500239 500249 
+500257 500287 500299 500317 500321 500333 500341 500363 500369 500389 500393 500413 
+500417 500431 500443 500459 500471 500473 500483 500501 500509 500519 500527 500567 
+500579 500587 500603 500629 500671 500677 500693 500699 500713 500719 500723 500729 
+500741 500777 500791 500807 500809 500831 500839 500861 500873 500881 500887 500891 
+500909 500911 500921 500923 500933 500947 500953 500957 500977 501001 501013 501019 
+501029 501031 501037 501043 501077 501089 501103 501121 501131 501133 501139 501157 
+501173 501187 501191 501197 501203 501209 501217 501223 501229 501233 501257 501271 
+501287 501299 501317 501341 501343 501367 501383 501401 501409 501419 501427 501451 
+501463 501493 501503 501511 501563 501577 501593 501601 501617 501623 501637 501659 
+501691 501701 501703 501707 501719 501731 501769 501779 501803 501817 501821 501827 
+501829 501841 501863 501889 501911 501931 501947 501953 501967 501971 501997 502001 
+502013 502039 502043 502057 502063 502079 502081 502087 502093 502121 502133 502141 
+502171 502181 502217 502237 502247 502259 502261 502277 502301 502321 502339 502393 
+502409 502421 502429 502441 502451 502487 502499 502501 502507 502517 502543 502549 
+502553 502591 502597 502613 502631 502633 502643 502651 502669 502687 502699 502703 
+502717 502729 502769 502771 502781 502787 502807 502819 502829 502841 502847 502861 
+502883 502919 502921 502937 502961 502973 503003 503017 503039 503053 503077 503123 
+503131 503137 503147 503159 503197 503207 503213 503227 503231 503233 503249 503267 
+503287 503297 503303 503317 503339 503351 503359 503369 503381 503383 503389 503407 
+503413 503423 503431 503441 503453 503483 503501 503543 503549 503551 503563 503593 
+503599 503609 503611 503621 503623 503647 503653 503663 503707 503717 503743 503753 
+503771 503777 503779 503791 503803 503819 503821 503827 503851 503857 503869 503879 
+503911 503927 503929 503939 503947 503959 503963 503969 503983 503989 504001 504011 
+504017 504047 504061 504073 504103 504121 504139 504143 504149 504151 504157 504181 
+504187 504197 504209 504221 504247 504269 504289 504299 504307 504311 504323 504337 
+504349 504353 504359 504377 504379 504389 504403 504457 504461 504473 504479 504521 
+504523 504527 504547 504563 504593 504599 504607 504617 504619 504631 504661 504667 
+504671 504677 504683 504727 504767 504787 504797 504799 504817 504821 504851 504853 
+504857 504871 504877 504893 504901 504929 504937 504943 504947 504953 504967 504983 
+504989 504991 505027 505031 505033 505049 505051 505061 505067 505073 505091 505097 
+505111 505117 505123 505129 505139 505157 505159 505181 505187 505201 505213 505231 
+505237 505277 505279 505283 505301 505313 505319 505321 505327 505339 505357 505367 
+505369 505399 505409 505411 505429 505447 505459 505469 505481 505493 505501 505511 
+505513 505523 505537 505559 505573 505601 505607 505613 505619 505633 505639 505643 
+505657 505663 505669 505691 505693 505709 505711 505727 505759 505763 505777 505781 
+505811 505819 505823 505867 505871 505877 505907 505919 505927 505949 505961 505969 
+505979 506047 506071 506083 506101 506113 506119 506131 506147 506171 506173 506183 
+506201 506213 506251 506263 506269 506281 506291 506327 506329 506333 506339 506347 
+506351 506357 506381 506393 506417 506423 506449 506459 506461 506479 506491 506501 
+506507 506531 506533 506537 506551 506563 506573 506591 506593 506599 506609 506629 
+506647 506663 506683 506687 506689 506699 506729 506731 506743 506773 506783 506791 
+506797 506809 506837 506843 506861 506873 506887 506893 506899 506903 506911 506929 
+506941 506963 506983 506993 506999 507029 507049 507071 507077 507079 507103 507109 
+507113 507119 507137 507139 507149 507151 507163 507193 507197 507217 507289 507301 
+507313 507317 507329 507347 507349 507359 507361 507371 507383 507401 507421 507431 
+507461 507491 507497 507499 507503 507523 507557 507571 507589 507593 507599 507607 
+507631 507641 507667 507673 507691 507697 507713 507719 507743 507757 507779 507781 
+507797 507803 507809 507821 507827 507839 507883 507901 507907 507917 507919 507937 
+507953 507961 507971 507979 508009 508019 508021 508033 508037 508073 508087 508091 
+508097 508103 508129 508159 508171 508187 508213 508223 508229 508237 508243 508259 
+508271 508273 508297 508301 508327 508331 508349 508363 508367 508373 508393 508433 
+508439 508451 508471 508477 508489 508499 508513 508517 508531 508549 508559 508567 
+508577 508579 508583 508619 508621 508637 508643 508661 508693 508709 508727 508771 
+508789 508799 508811 508817 508841 508847 508867 508901 508903 508909 508913 508919 
+508931 508943 508951 508957 508961 508969 508973 508987 509023 509027 509053 509063 
+509071 509087 509101 509123 509137 509147 509149 509203 509221 509227 509239 509263 
+509281 509287 509293 509297 509317 509329 509359 509363 509389 509393 509413 509417 
+509429 509441 509449 509477 509513 509521 509543 509549 509557 509563 509569 509573 
+509581 509591 509603 509623 509633 509647 509653 509659 509681 509687 509689 509693 
+509699 509723 509731 509737 509741 509767 509783 509797 509801 509833 509837 509843 
+509863 509867 509879 509909 509911 509921 509939 509947 509959 509963 509989 510007 
+510031 510047 510049 510061 510067 510073 510077 510079 510089 510101 510121 510127 
+510137 510157 510179 510199 510203 510217 510227 510233 510241 510247 510253 510271 
+510287 510299 510311 510319 510331 510361 510379 510383 510401 510403 510449 510451 
+510457 510463 510481 510529 510551 510553 510569 510581 510583 510589 510611 510613 
+510617 510619 510677 510683 510691 510707 510709 510751 510767 510773 510793 510803 
+510817 510823 510827 510847 510889 510907 510919 510931 510941 510943 510989 511001 
+511013 511019 511033 511039 511057 511061 511087 511109 511111 511123 511151 511153 
+511163 511169 511171 511177 511193 511201 511211 511213 511223 511237 511243 511261 
+511279 511289 511297 511327 511333 511337 511351 511361 511387 511391 511409 511417 
+511439 511447 511453 511457 511463 511477 511487 511507 511519 511523 511541 511549 
+511559 511573 511579 511583 511591 511603 511627 511631 511633 511669 511691 511703 
+511711 511723 511757 511787 511793 511801 511811 511831 511843 511859 511867 511873 
+511891 511897 511909 511933 511939 511961 511963 511991 511997 512009 512011 512021 
+512047 512059 512093 512101 512137 512147 512167 512207 512249 512251 512269 512287 
+512311 512321 512333 512353 512389 512419 512429 512443 512467 512497 512503 512507 
+512521 512531 512537 512543 512569 512573 512579 512581 512591 512593 512597 512609 
+512621 512641 512657 512663 512671 512683 512711 512713 512717 512741 512747 512761 
+512767 512779 512797 512803 512819 512821 512843 512849 512891 512899 512903 512917 
+512921 512927 512929 512959 512977 512989 512999 513001 513013 513017 513031 513041 
+513047 513053 513059 513067 513083 513101 513103 513109 513131 513137 513157 513167 
+513169 513173 513203 513239 513257 513269 513277 513283 513307 513311 513313 513319 
+513341 513347 513353 513367 513371 513397 513407 513419 513427 513431 513439 513473 
+513479 513481 513509 513511 513529 513533 513593 513631 513641 513649 513673 513679 
+513683 513691 513697 513719 513727 513731 513739 513749 513761 513767 513769 513781 
+513829 513839 513841 513871 513881 513899 513917 513923 513937 513943 513977 513991 
+514001 514009 514013 514021 514049 514051 514057 514061 514079 514081 514093 514103 
+514117 514123 514127 514147 514177 514187 514201 514219 514229 514243 514247 514249 
+514271 514277 514289 514309 514313 514333 514343 514357 514361 514379 514399 514417 
+514429 514433 514453 514499 514513 514519 514523 514529 514531 514543 514561 514571 
+514621 514637 514639 514643 514649 514651 514669 514681 514711 514733 514739 514741 
+514747 514751 514757 514769 514783 514793 514819 514823 514831 514841 514847 514853 
+514859 514867 514873 514889 514903 514933 514939 514949 514967 515041 515087 515089 
+515111 515143 515149 515153 515173 515191 515227 515231 515233 515237 515279 515293 
+515311 515323 515351 515357 515369 515371 515377 515381 515401 515429 515477 515507 
+515519 515539 515563 515579 515587 515597 515611 515621 515639 515651 515653 515663 
+515677 515681 515687 515693 515701 515737 515741 515761 515771 515773 515777 515783 
+515803 515813 515839 515843 515857 515861 515873 515887 515917 515923 515929 515941 
+515951 515969 515993 516017 516023 516049 516053 516077 516091 516127 516151 516157 
+516161 516163 516169 516179 516193 516199 516209 516223 516227 516233 516247 516251 
+516253 516277 516283 516293 516319 516323 516349 516359 516361 516371 516377 516391 
+516407 516421 516431 516433 516437 516449 516457 516469 516493 516499 516517 516521 
+516539 516541 516563 516587 516589 516599 516611 516617 516619 516623 516643 516653 
+516673 516679 516689 516701 516709 516713 516721 516727 516757 516793 516811 516821 
+516829 516839 516847 516871 516877 516883 516907 516911 516931 516947 516949 516959 
+516973 516977 516979 516991 517003 517043 517061 517067 517073 517079 517081 517087 
+517091 517129 517151 517169 517177 517183 517189 517207 517211 517217 517229 517241 
+517243 517249 517261 517267 517277 517289 517303 517337 517343 517367 517373 517381 
+517393 517399 517403 517411 517417 517457 517459 517469 517471 517481 517487 517499 
+517501 517507 517511 517513 517547 517549 517553 517571 517577 517589 517597 517603 
+517609 517613 517619 517637 517639 517711 517717 517721 517729 517733 517739 517747 
+517817 517823 517831 517861 517873 517877 517901 517919 517927 517931 517949 517967 
+517981 517991 517999 518017 518047 518057 518059 518083 518099 518101 518113 518123 
+518129 518131 518137 518153 518159 518171 518179 518191 518207 518209 518233 518237 
+518239 518249 518261 518291 518299 518311 518327 518341 518387 518389 518411 518417 
+518429 518431 518447 518467 518471 518473 518509 518521 518533 518543 518579 518587 
+518597 518611 518621 518657 518689 518699 518717 518729 518737 518741 518743 518747 
+518759 518761 518767 518779 518801 518803 518807 518809 518813 518831 518863 518867 
+518893 518911 518933 518953 518981 518983 518989 519011 519031 519037 519067 519083 
+519089 519091 519097 519107 519119 519121 519131 519151 519161 519193 519217 519227 
+519229 519247 519257 519269 519283 519287 519301 519307 519349 519353 519359 519371 
+519373 519383 519391 519413 519427 519433 519457 519487 519499 519509 519521 519523 
+519527 519539 519551 519553 519577 519581 519587 519611 519619 519643 519647 519667 
+519683 519691 519703 519713 519733 519737 519769 519787 519793 519797 519803 519817 
+519863 519881 519889 519907 519917 519919 519923 519931 519943 519947 519971 519989 
+519997 520019 520021 520031 520043 520063 520067 520073 520103 520111 520123 520129 
+520151 520193 520213 520241 520279 520291 520297 520307 520309 520313 520339 520349 
+520357 520361 520363 520369 520379 520381 520393 520409 520411 520423 520427 520433 
+520447 520451 520529 520547 520549 520567 520571 520589 520607 520609 520621 520631 
+520633 520649 520679 520691 520699 520703 520717 520721 520747 520759 520763 520787 
+520813 520837 520841 520853 520867 520889 520913 520921 520943 520957 520963 520967 
+520969 520981 521009 521021 521023 521039 521041 521047 521051 521063 521107 521119 
+521137 521153 521161 521167 521173 521177 521179 521201 521231 521243 521251 521267 
+521281 521299 521309 521317 521329 521357 521359 521363 521369 521377 521393 521399 
+521401 521429 521447 521471 521483 521491 521497 521503 521519 521527 521533 521537 
+521539 521551 521557 521567 521581 521603 521641 521657 521659 521669 521671 521693 
+521707 521723 521743 521749 521753 521767 521777 521789 521791 521809 521813 521819 
+521831 521861 521869 521879 521881 521887 521897 521903 521923 521929 521981 521993 
+521999 522017 522037 522047 522059 522061 522073 522079 522083 522113 522127 522157 
+522161 522167 522191 522199 522211 522227 522229 522233 522239 522251 522259 522281 
+522283 522289 522317 522323 522337 522371 522373 522383 522391 522409 522413 522439 
+522449 522469 522479 522497 522517 522521 522523 522541 522553 522569 522601 522623 
+522637 522659 522661 522673 522677 522679 522689 522703 522707 522719 522737 522749 
+522757 522761 522763 522787 522811 522827 522829 522839 522853 522857 522871 522881 
+522883 522887 522919 522943 522947 522959 522961 522989 523007 523021 523031 523049 
+523093 523097 523109 523129 523169 523177 523207 523213 523219 523261 523297 523307 
+523333 523349 523351 523357 523387 523403 523417 523427 523433 523459 523463 523487 
+523489 523493 523511 523519 523541 523543 523553 523571 523573 523577 523597 523603 
+523631 523637 523639 523657 523667 523669 523673 523681 523717 523729 523741 523759 
+523763 523771 523777 523793 523801 523829 523847 523867 523877 523903 523907 523927 
+523937 523949 523969 523987 523997 524047 524053 524057 524063 524071 524081 524087 
+524099 524113 524119 524123 524149 524171 524189 524197 524201 524203 524219 524221 
+524231 524243 524257 524261 524269 524287 524309 524341 524347 524351 524353 524369 
+524387 524389 524411 524413 524429 524453 524497 524507 524509 524519 524521 524591 
+524593 524599 524633 524669 524681 524683 524701 524707 524731 524743 524789 524801 
+524803 524827 524831 524857 524863 524869 524873 524893 524899 524921 524933 524939 
+524941 524947 524957 524959 524963 524969 524971 524981 524983 524999 525001 525013 
+525017 525029 525043 525101 525127 525137 525143 525157 525163 525167 525191 525193 
+525199 525209 525221 525241 525247 525253 525257 525299 525313 525353 525359 525361 
+525373 525377 525379 525391 525397 525409 525431 525433 525439 525457 525461 525467 
+525491 525493 525517 525529 525533 525541 525571 525583 525593 525599 525607 525641 
+525649 525671 525677 525697 525709 525713 525719 525727 525731 525739 525769 525773 
+525781 525809 525817 525839 525869 525871 525887 525893 525913 525923 525937 525947 
+525949 525953 525961 525979 525983 526027 526037 526049 526051 526063 526067 526069 
+526073 526087 526117 526121 526139 526157 526159 526189 526193 526199 526213 526223 
+526231 526249 526271 526283 526289 526291 526297 526307 526367 526373 526381 526387 
+526391 526397 526423 526429 526441 526453 526459 526483 526499 526501 526511 526531 
+526543 526571 526573 526583 526601 526619 526627 526633 526637 526649 526651 526657 
+526667 526679 526681 526703 526709 526717 526733 526739 526741 526759 526763 526777 
+526781 526829 526831 526837 526853 526859 526871 526909 526913 526931 526937 526943 
+526951 526957 526963 526993 526997 527053 527057 527063 527069 527071 527081 527099 
+527123 527129 527143 527159 527161 527173 527179 527203 527207 527209 527237 527251 
+527273 527281 527291 527327 527333 527347 527353 527377 527381 527393 527399 527407 
+527411 527419 527441 527447 527453 527489 527507 527533 527557 527563 527581 527591 
+527599 527603 527623 527627 527633 527671 527699 527701 527729 527741 527749 527753 
+527789 527803 527809 527819 527843 527851 527869 527881 527897 527909 527921 527929 
+527941 527981 527983 527987 527993 528001 528013 528041 528043 528053 528091 528097 
+528107 528127 528131 528137 528163 528167 528191 528197 528217 528223 528247 528263 
+528289 528299 528313 528317 528329 528373 528383 528391 528401 528403 528413 528419 
+528433 528469 528487 528491 528509 528511 528527 528559 528611 528623 528629 528631 
+528659 528667 528673 528679 528691 528707 528709 528719 528763 528779 528791 528799 
+528811 528821 528823 528833 528863 528877 528881 528883 528911 528929 528947 528967 
+528971 528973 528991 529003 529007 529027 529033 529037 529043 529049 529051 529097 
+529103 529117 529121 529127 529129 529153 529157 529181 529183 529213 529229 529237 
+529241 529259 529271 529273 529301 529307 529313 529327 529343 529349 529357 529381 
+529393 529411 529421 529423 529471 529489 529513 529517 529519 529531 529547 529577 
+529579 529603 529619 529637 529649 529657 529673 529681 529687 529691 529693 529709 
+529723 529741 529747 529751 529807 529811 529813 529819 529829 529847 529871 529927 
+529933 529939 529957 529961 529973 529979 529981 529987 529999 530017 530021 530027 
+530041 530051 530063 530087 530093 530129 530137 530143 530177 530183 530197 530203 
+530209 530227 530237 530249 530251 530261 530267 530279 530293 530297 530303 530329 
+530333 530339 530353 530359 530389 530393 530401 530429 530443 530447 530501 530507 
+530513 530527 530531 530533 530539 530549 530567 530597 530599 530603 530609 530641 
+530653 530659 530669 530693 530701 530711 530713 530731 530741 530743 530753 530767 
+530773 530797 530807 530833 530837 530843 530851 530857 530861 530869 530897 530911 
+530947 530969 530977 530983 530989 531017 531023 531043 531071 531079 531101 531103 
+531121 531133 531143 531163 531169 531173 531197 531203 531229 531239 531253 531263 
+531281 531287 531299 531331 531337 531343 531347 531353 531359 531383 531457 531481 
+531497 531521 531547 531551 531569 531571 531581 531589 531611 531613 531623 531631 
+531637 531667 531673 531689 531701 531731 531793 531799 531821 531823 531827 531833 
+531841 531847 531857 531863 531871 531877 531901 531911 531919 531977 531983 531989 
+531997 532001 532009 532027 532033 532061 532069 532093 532099 532141 532153 532159 
+532163 532183 532187 532193 532199 532241 532249 532261 532267 532277 532283 532307 
+532313 532327 532331 532333 532349 532373 532379 532391 532403 532417 532421 532439 
+532447 532451 532453 532489 532501 532523 532529 532531 532537 532547 532561 532601 
+532603 532607 532619 532621 532633 532639 532663 532669 532687 532691 532709 532733 
+532739 532751 532757 532771 532781 532783 532789 532801 532811 532823 532849 532853 
+532867 532907 532919 532949 532951 532981 532993 532999 533003 533009 533011 533033 
+533051 533053 533063 533077 533089 533111 533129 533149 533167 533177 533189 533191 
+533213 533219 533227 533237 533249 533257 533261 533263 533297 533303 533317 533321 
+533327 533353 533363 533371 533389 533399 533413 533447 533453 533459 533509 533543 
+533549 533573 533581 533593 533633 533641 533671 533693 533711 533713 533719 533723 
+533737 533747 533777 533801 533809 533821 533831 533837 533857 533879 533887 533893 
+533909 533921 533927 533959 533963 533969 533971 533989 533993 533999 534007 534013 
+534019 534029 534043 534047 534049 534059 534073 534077 534091 534101 534113 534137 
+534167 534173 534199 534203 534211 534229 534241 534253 534283 534301 534307 534311 
+534323 534329 534341 534367 534371 534403 534407 534431 534439 534473 534491 534511 
+534529 534553 534571 534577 534581 534601 534607 534617 534629 534631 534637 534647 
+534649 534659 534661 534671 534697 534707 534739 534799 534811 534827 534839 534841 
+534851 534857 534883 534889 534913 534923 534931 534943 534949 534971 535013 535019 
+535033 535037 535061 535099 535103 535123 535133 535151 535159 535169 535181 535193 
+535207 535219 535229 535237 535243 535273 535303 535319 535333 535349 535351 535361 
+535387 535391 535399 535481 535487 535489 535499 535511 535523 535529 535547 535571 
+535573 535589 535607 535609 535627 535637 535663 535669 535673 535679 535697 535709 
+535727 535741 535751 535757 535771 535783 535793 535811 535849 535859 535861 535879 
+535919 535937 535939 535943 535957 535967 535973 535991 535999 536017 536023 536051 
+536057 536059 536069 536087 536099 536101 536111 536141 536147 536149 536189 536191 
+536203 536213 536219 536227 536233 536243 536267 536273 536279 536281 536287 536293 
+536311 536323 536353 536357 536377 536399 536407 536423 536441 536443 536447 536449 
+536453 536461 536467 536479 536491 536509 536513 536531 536533 536561 536563 536593 
+536609 536621 536633 536651 536671 536677 536687 536699 536717 536719 536729 536743 
+536749 536771 536773 536777 536779 536791 536801 536803 536839 536849 536857 536867 
+536869 536891 536909 536917 536923 536929 536933 536947 536953 536971 536989 536999 
+537001 537007 537011 537023 537029 537037 537041 537067 537071 537079 537091 537127 
+537133 537143 537157 537169 537181 537191 537197 537221 537233 537241 537269 537281 
+537287 537307 537331 537343 537347 537373 537379 537401 537403 537413 537497 537527 
+537547 537569 537583 537587 537599 537611 537637 537661 537673 537679 537703 537709 
+537739 537743 537749 537769 537773 537781 537787 537793 537811 537841 537847 537853 
+537877 537883 537899 537913 537919 537941 537991 538001 538019 538049 538051 538073 
+538079 538093 538117 538121 538123 538127 538147 538151 538157 538159 538163 538199 
+538201 538247 538249 538259 538267 538283 538297 538301 538303 538309 538331 538333 
+538357 538367 538397 538399 538411 538423 538457 538471 538481 538487 538511 538513 
+538519 538523 538529 538553 538561 538567 538579 538589 538597 538621 538649 538651 
+538697 538709 538711 538721 538723 538739 538751 538763 538771 538777 538789 538799 
+538801 538817 538823 538829 538841 538871 538877 538921 538927 538931 538939 538943 
+538987 539003 539009 539039 539047 539089 539093 539101 539107 539111 539113 539129 
+539141 539153 539159 539167 539171 539207 539219 539233 539237 539261 539267 539269 
+539293 539303 539309 539311 539321 539323 539339 539347 539351 539389 539401 539447 
+539449 539479 539501 539503 539507 539509 539533 539573 539621 539629 539633 539639 
+539641 539653 539663 539677 539687 539711 539713 539723 539729 539743 539761 539783 
+539797 539837 539839 539843 539849 539863 539881 539897 539899 539921 539947 539993 
+540041 540061 540079 540101 540119 540121 540139 540149 540157 540167 540173 540179 
+540181 540187 540203 540217 540233 540251 540269 540271 540283 540301 540307 540343 
+540347 540349 540367 540373 540377 540383 540389 540391 540433 540437 540461 540469 
+540509 540511 540517 540539 540541 540557 540559 540577 540587 540599 540611 540613 
+540619 540629 540677 540679 540689 540691 540697 540703 540713 540751 540769 540773 
+540779 540781 540803 540809 540823 540851 540863 540871 540877 540901 540907 540961 
+540989 541001 541007 541027 541049 541061 541087 541097 541129 541133 541141 541153 
+541181 541193 541201 541217 541231 541237 541249 541267 541271 541283 541301 541309 
+541339 541349 541361 541363 541369 541381 541391 541417 541439 541447 541469 541483 
+541507 541511 541523 541529 541531 541537 541543 541547 541549 541571 541577 541579 
+541589 541613 541631 541657 541661 541669 541693 541699 541711 541721 541727 541759 
+541763 541771 541777 541781 541799 541817 541831 541837 541859 541889 541901 541927 
+541951 541967 541987 541991 541993 541999 542021 542023 542027 542053 542063 542071 
+542081 542083 542093 542111 542117 542119 542123 542131 542141 542149 542153 542167 
+542183 542189 542197 542207 542219 542237 542251 542261 542263 542281 542293 542299 
+542323 542371 542401 542441 542447 542461 542467 542483 542489 542497 542519 542533 
+542537 542539 542551 542557 542567 542579 542587 542599 542603 542683 542687 542693 
+542713 542719 542723 542747 542761 542771 542783 542791 542797 542821 542831 542837 
+542873 542891 542911 542921 542923 542933 542939 542947 542951 542981 542987 542999 
+543017 543019 543029 543061 543097 543113 543131 543139 543143 543149 543157 543161 
+543163 543187 543203 543217 543223 543227 543233 543241 543253 543259 543281 543287 
+543289 543299 543307 543311 543313 543341 543349 543353 543359 543379 543383 543407 
+543427 543463 543497 543503 543509 543539 543551 543553 543593 543601 543607 543611 
+543617 543637 543659 543661 543671 543679 543689 543703 543707 543713 543769 543773 
+543787 543791 543793 543797 543811 543827 543841 543853 543857 543859 543871 543877 
+543883 543887 543889 543901 543911 543929 543967 543971 543997 544001 544007 544009 
+544013 544021 544031 544097 544099 544109 544123 544129 544133 544139 544171 544177 
+544183 544199 544223 544259 544273 544277 544279 544367 544373 544399 544403 544429 
+544451 544471 544477 544487 544501 544513 544517 544543 544549 544601 544613 544627 
+544631 544651 544667 544699 544717 544721 544723 544727 544757 544759 544771 544781 
+544793 544807 544813 544837 544861 544877 544879 544883 544889 544897 544903 544919 
+544927 544937 544961 544963 544979 545023 545029 545033 545057 545063 545087 545089 
+545093 545117 545131 545141 545143 545161 545189 545203 545213 545231 545239 545257 
+545267 545291 545329 545371 545387 545429 545437 545443 545449 545473 545477 545483 
+545497 545521 545527 545533 545543 545549 545551 545579 545599 545609 545617 545621 
+545641 545647 545651 545663 545711 545723 545731 545747 545749 545759 545773 545789 
+545791 545827 545843 545863 545873 545893 545899 545911 545917 545929 545933 545939 
+545947 545959 546001 546017 546019 546031 546047 546053 546067 546071 546097 546101 
+546103 546109 546137 546149 546151 546173 546179 546197 546211 546233 546239 546241 
+546253 546263 546283 546289 546317 546323 546341 546349 546353 546361 546367 546373 
+546391 546461 546467 546479 546509 546523 546547 546569 546583 546587 546599 546613 
+546617 546619 546631 546643 546661 546671 546677 546683 546691 546709 546719 546731 
+546739 546781 546841 546859 546863 546869 546881 546893 546919 546937 546943 546947 
+546961 546967 546977 547007 547021 547037 547061 547087 547093 547097 547103 547121 
+547133 547139 547171 547223 547229 547237 547241 547249 547271 547273 547291 547301 
+547321 547357 547361 547363 547369 547373 547387 547397 547399 547411 547441 547453 
+547471 547483 547487 547493 547499 547501 547513 547529 547537 547559 547567 547577 
+547583 547601 547609 547619 547627 547639 547643 547661 547663 547681 547709 547727 
+547741 547747 547753 547763 547769 547787 547817 547819 547823 547831 547849 547853 
+547871 547889 547901 547909 547951 547957 547999 548003 548039 548059 548069 548083 
+548089 548099 548117 548123 548143 548153 548189 548201 548213 548221 548227 548239 
+548243 548263 548291 548309 548323 548347 548351 548363 548371 548393 548399 548407 
+548417 548423 548441 548453 548459 548461 548489 548501 548503 548519 548521 548533 
+548543 548557 548567 548579 548591 548623 548629 548657 548671 548677 548687 548693 
+548707 548719 548749 548753 548761 548771 548783 548791 548827 548831 548833 548837 
+548843 548851 548861 548869 548893 548897 548903 548909 548927 548953 548957 548963 
+549001 549011 549013 549019 549023 549037 549071 549089 549091 549097 549121 549139 
+549149 549161 549163 549167 549169 549193 549203 549221 549229 549247 549257 549259 
+549281 549313 549319 549323 549331 549379 549391 549403 549421 549431 549443 549449 
+549481 549503 549509 549511 549517 549533 549547 549551 549553 549569 549587 549589 
+549607 549623 549641 549643 549649 549667 549683 549691 549701 549707 549713 549719 
+549733 549737 549739 549749 549751 549767 549817 549833 549839 549863 549877 549883 
+549911 549937 549943 549949 549977 549979 550007 550009 550027 550049 550061 550063 
+550073 550111 550117 550127 550129 550139 550163 550169 550177 550181 550189 550211 
+550213 550241 550267 550279 550283 550289 550309 550337 550351 550369 550379 550427 
+550439 550441 550447 550457 550469 550471 550489 550513 550519 550531 550541 550553 
+550577 550607 550609 550621 550631 550637 550651 550657 550661 550663 550679 550691 
+550703 550717 550721 550733 550757 550763 550789 550801 550811 550813 550831 550841 
+550843 550859 550861 550903 550909 550937 550939 550951 550961 550969 550973 550993 
+550997 551003 551017 551027 551039 551059 551063 551069 551093 551099 551107 551113 
+551129 551143 551179 551197 551207 551219 551231 551233 551269 551281 551297 551311 
+551321 551339 551347 551363 551381 551387 551407 551423 551443 551461 551483 551489 
+551503 551519 551539 551543 551549 551557 551569 551581 551587 551597 551651 551653 
+551659 551671 551689 551693 551713 551717 551723 551729 551731 551743 551753 551767 
+551773 551801 551809 551813 551843 551849 551861 551909 551911 551917 551927 551933 
+551951 551959 551963 551981 552001 552011 552029 552031 552047 552053 552059 552089 
+552091 552103 552107 552113 552127 552137 552179 552193 552217 552239 552241 552259 
+552263 552271 552283 552301 552317 552341 552353 552379 552397 552401 552403 552469 
+552473 552481 552491 552493 552511 552523 552527 552553 552581 552583 552589 552611 
+552649 552659 552677 552703 552707 552709 552731 552749 552751 552757 552787 552791 
+552793 552809 552821 552833 552841 552847 552859 552883 552887 552899 552913 552917 
+552971 552983 552991 553013 553037 553043 553051 553057 553067 553073 553093 553097 
+553099 553103 553123 553139 553141 553153 553171 553181 553193 553207 553211 553229 
+553249 553253 553277 553279 553309 553351 553363 553369 553411 553417 553433 553439 
+553447 553457 553463 553471 553481 553507 553513 553517 553529 553543 553549 553561 
+553573 553583 553589 553591 553601 553607 553627 553643 553649 553667 553681 553687 
+553699 553703 553727 553733 553747 553757 553759 553769 553789 553811 553837 553849 
+553867 553873 553897 553901 553919 553921 553933 553961 553963 553981 553991 554003 
+554011 554017 554051 554077 554087 554089 554117 554123 554129 554137 554167 554171 
+554179 554189 554207 554209 554233 554237 554263 554269 554293 554299 554303 554317 
+554347 554377 554383 554417 554419 554431 554447 554453 554467 554503 554527 554531 
+554569 554573 554597 554611 554627 554633 554639 554641 554663 554669 554677 554699 
+554707 554711 554731 554747 554753 554759 554767 554779 554789 554791 554797 554803 
+554821 554833 554837 554839 554843 554849 554887 554891 554893 554899 554923 554927 
+554951 554959 554969 554977 555029 555041 555043 555053 555073 555077 555083 555091 
+555097 555109 555119 555143 555167 555209 555221 555251 555253 555257 555277 555287 
+555293 555301 555307 555337 555349 555361 555383 555391 555419 555421 555439 555461 
+555487 555491 555521 555523 555557 555589 555593 555637 555661 555671 555677 555683 
+555691 555697 555707 555739 555743 555761 555767 555823 555827 555829 555853 555857 
+555871 555931 555941 555953 555967 556007 556021 556027 556037 556043 556051 556067 
+556069 556093 556103 556123 556159 556177 556181 556211 556219 556229 556243 556253 
+556261 556267 556271 556273 556279 556289 556313 556321 556327 556331 556343 556351 
+556373 556399 556403 556441 556459 556477 556483 556487 556513 556519 556537 556559 
+556573 556579 556583 556601 556607 556609 556613 556627 556639 556651 556679 556687 
+556691 556693 556697 556709 556723 556727 556741 556753 556763 556769 556781 556789 
+556793 556799 556811 556817 556819 556823 556841 556849 556859 556861 556867 556883 
+556891 556931 556939 556943 556957 556967 556981 556987 556999 557017 557021 557027 
+557033 557041 557057 557059 557069 557087 557093 557153 557159 557197 557201 557261 
+557269 557273 557281 557303 557309 557321 557329 557339 557369 557371 557377 557423 
+557443 557449 557461 557483 557489 557519 557521 557533 557537 557551 557567 557573 
+557591 557611 557633 557639 557663 557671 557693 557717 557729 557731 557741 557743 
+557747 557759 557761 557779 557789 557801 557803 557831 557857 557861 557863 557891 
+557899 557903 557927 557981 557987 558007 558017 558029 558053 558067 558083 558091 
+558109 558113 558121 558139 558149 558167 558179 558197 558203 558209 558223 558241 
+558251 558253 558287 558289 558307 558319 558343 558401 558413 558421 558427 558431 
+558457 558469 558473 558479 558491 558497 558499 558521 558529 558533 558539 558541 
+558563 558583 558587 558599 558611 558629 558643 558661 558683 558703 558721 558731 
+558757 558769 558781 558787 558791 558793 558827 558829 558863 558869 558881 558893 
+558913 558931 558937 558947 558973 558979 558997 559001 559049 559051 559067 559081 
+559093 559099 559123 559133 559157 559177 559183 559201 559211 559213 559217 559219 
+559231 559243 559259 559277 559297 559313 559319 559343 559357 559367 559369 559397 
+559421 559451 559459 559469 559483 559511 559513 559523 559529 559541 559547 559549 
+559561 559571 559577 559583 559591 559597 559631 559633 559639 559649 559667 559673 
+559679 559687 559703 559709 559739 559747 559777 559781 559799 559807 559813 559831 
+559841 559849 559859 559877 559883 559901 559907 559913 559939 559967 559973 559991 
+560017 560023 560029 560039 560047 560081 560083 560089 560093 560107 560113 560117 
+560123 560137 560149 560159 560171 560173 560179 560191 560207 560213 560221 560227 
+560233 560237 560239 560243 560249 560281 560293 560297 560299 560311 560317 560341 
+560353 560393 560411 560437 560447 560459 560471 560477 560479 560489 560491 560501 
+560503 560531 560543 560551 560561 560597 560617 560621 560639 560641 560653 560669 
+560683 560689 560701 560719 560737 560753 560761 560767 560771 560783 560797 560803 
+560827 560837 560863 560869 560873 560887 560891 560893 560897 560929 560939 560941 
+560969 560977 561019 561047 561053 561059 561061 561079 561083 561091 561097 561101 
+561103 561109 561161 561173 561181 561191 561199 561229 561251 561277 561307 561313 
+561343 561347 561359 561367 561373 561377 561389 561409 561419 561439 561461 561521 
+561529 561551 561553 561559 561599 561607 561667 561703 561713 561733 561761 561767 
+561787 561797 561809 561829 561839 561907 561917 561923 561931 561943 561947 561961 
+561973 561983 561997 562007 562019 562021 562043 562091 562103 562129 562147 562169 
+562181 562193 562201 562231 562259 562271 562273 562283 562291 562297 562301 562307 
+562313 562333 562337 562349 562351 562357 562361 562399 562403 562409 562417 562421 
+562427 562439 562459 562477 562493 562501 562517 562519 562537 562577 562579 562589 
+562591 562607 562613 562621 562631 562633 562651 562663 562669 562673 562691 562693 
+562699 562703 562711 562721 562739 562753 562759 562763 562781 562789 562813 562831 
+562841 562871 562897 562901 562909 562931 562943 562949 562963 562967 562973 562979 
+562987 562997 563009 563011 563021 563039 563041 563047 563051 563077 563081 563099 
+563113 563117 563119 563131 563149 563153 563183 563197 563219 563249 563263 563287 
+563327 563351 563357 563359 563377 563401 563411 563413 563417 563419 563447 563449 
+563467 563489 563501 563503 563543 563551 563561 563587 563593 563599 563623 563657 
+563663 563723 563743 563747 563777 563809 563813 563821 563831 563837 563851 563869 
+563881 563887 563897 563929 563933 563947 563971 563987 563999 564013 564017 564041 
+564049 564059 564061 564089 564097 564103 564127 564133 564149 564163 564173 564191 
+564197 564227 564229 564233 564251 564257 564269 564271 564299 564301 564307 564313 
+564323 564353 564359 564367 564371 564373 564391 564401 564407 564409 564419 564437 
+564449 564457 564463 564467 564491 564497 564523 564533 564593 564607 564617 564643 
+564653 564667 564671 564679 564701 564703 564709 564713 564761 564779 564793 564797 
+564827 564871 564881 564899 564917 564919 564923 564937 564959 564973 564979 564983 
+564989 564997 565013 565039 565049 565057 565069 565109 565111 565127 565163 565171 
+565177 565183 565189 565207 565237 565241 565247 565259 565261 565273 565283 565289 
+565303 565319 565333 565337 565343 565361 565379 565381 565387 565391 565393 565427 
+565429 565441 565451 565463 565469 565483 565489 565507 565511 565517 565519 565549 
+565553 565559 565567 565571 565583 565589 565597 565603 565613 565637 565651 565661 
+565667 565723 565727 565769 565771 565787 565793 565813 565849 565867 565889 565891 
+565907 565909 565919 565921 565937 565973 565979 565997 566011 566023 566047 566057 
+566077 566089 566101 566107 566131 566149 566161 566173 566179 566183 566201 566213 
+566227 566231 566233 566273 566311 566323 566347 566387 566393 566413 566417 566429 
+566431 566437 566441 566443 566453 566521 566537 566539 566543 566549 566551 566557 
+566563 566567 566617 566633 566639 566653 566659 566677 566681 566693 566701 566707 
+566717 566719 566723 566737 566759 566767 566791 566821 566833 566851 566857 566879 
+566911 566939 566947 566963 566971 566977 566987 566999 567011 567013 567031 567053 
+567059 567067 567097 567101 567107 567121 567143 567179 567181 567187 567209 567257 
+567263 567277 567319 567323 567367 567377 567383 567389 567401 567407 567439 567449 
+567451 567467 567487 567493 567499 567527 567529 567533 567569 567601 567607 567631 
+567649 567653 567659 567661 567667 567673 567689 567719 567737 567751 567761 567767 
+567779 567793 567811 567829 567841 567857 567863 567871 567877 567881 567883 567899 
+567937 567943 567947 567949 567961 567979 567991 567997 568019 568027 568033 568049 
+568069 568091 568097 568109 568133 568151 568153 568163 568171 568177 568187 568189 
+568193 568201 568207 568231 568237 568241 568273 568279 568289 568303 568349 568363 
+568367 568387 568391 568433 568439 568441 568453 568471 568481 568493 568523 568541 
+568549 568577 568609 568619 568627 568643 568657 568669 568679 568691 568699 568709 
+568723 568751 568783 568787 568807 568823 568831 568853 568877 568891 568903 568907 
+568913 568921 568963 568979 568987 568991 568999 569003 569011 569021 569047 569053 
+569057 569071 569077 569081 569083 569111 569117 569137 569141 569159 569161 569189 
+569197 569201 569209 569213 569237 569243 569249 569251 569263 569267 569269 569321 
+569323 569369 569417 569419 569423 569431 569447 569461 569479 569497 569507 569533 
+569573 569579 569581 569599 569603 569609 569617 569623 569659 569663 569671 569683 
+569711 569713 569717 569729 569731 569747 569759 569771 569773 569797 569809 569813 
+569819 569831 569839 569843 569851 569861 569869 569887 569893 569897 569903 569927 
+569939 569957 569983 570001 570013 570029 570041 570043 570047 570049 570071 570077 
+570079 570083 570091 570107 570109 570113 570131 570139 570161 570173 570181 570191 
+570217 570221 570233 570253 570329 570359 570373 570379 570389 570391 570403 570407 
+570413 570419 570421 570461 570463 570467 570487 570491 570497 570499 570509 570511 
+570527 570529 570539 570547 570553 570569 570587 570601 570613 570637 570643 570649 
+570659 570667 570671 570677 570683 570697 570719 570733 570737 570743 570781 570821 
+570827 570839 570841 570851 570853 570859 570881 570887 570901 570919 570937 570949 
+570959 570961 570967 570991 571001 571019 571031 571037 571049 571069 571093 571099 
+571111 571133 571147 571157 571163 571199 571201 571211 571223 571229 571231 571261 
+571267 571279 571303 571321 571331 571339 571369 571381 571397 571399 571409 571433 
+571453 571471 571477 571531 571541 571579 571583 571589 571601 571603 571633 571657 
+571673 571679 571699 571709 571717 571721 571741 571751 571759 571777 571783 571789 
+571799 571801 571811 571841 571847 571853 571861 571867 571871 571873 571877 571903 
+571933 571939 571969 571973 572023 572027 572041 572051 572053 572059 572063 572069 
+572087 572093 572107 572137 572161 572177 572179 572183 572207 572233 572239 572251 
+572269 572281 572303 572311 572321 572323 572329 572333 572357 572387 572399 572417 
+572419 572423 572437 572449 572461 572471 572479 572491 572497 572519 572521 572549 
+572567 572573 572581 572587 572597 572599 572609 572629 572633 572639 572651 572653 
+572657 572659 572683 572687 572699 572707 572711 572749 572777 572791 572801 572807 
+572813 572821 572827 572833 572843 572867 572879 572881 572903 572909 572927 572933 
+572939 572941 572963 572969 572993 573007 573031 573047 573101 573107 573109 573119 
+573143 573161 573163 573179 573197 573247 573253 573263 573277 573289 573299 573317 
+573329 573341 573343 573371 573379 573383 573409 573437 573451 573457 573473 573479 
+573481 573487 573493 573497 573509 573511 573523 573527 573557 573569 573571 573637 
+573647 573673 573679 573691 573719 573737 573739 573757 573761 573763 573787 573791 
+573809 573817 573829 573847 573851 573863 573871 573883 573887 573899 573901 573929 
+573941 573953 573967 573973 573977 574003 574031 574033 574051 574061 574081 574099 
+574109 574127 574157 574159 574163 574169 574181 574183 574201 574219 574261 574279 
+574283 574289 574297 574307 574309 574363 574367 574373 574393 574423 574429 574433 
+574439 574477 574489 574493 574501 574507 574529 574543 574547 574597 574619 574621 
+574627 574631 574643 574657 574667 574687 574699 574703 574711 574723 574727 574733 
+574741 574789 574799 574801 574813 574817 574859 574907 574913 574933 574939 574949 
+574963 574967 574969 575009 575027 575033 575053 575063 575077 575087 575119 575123 
+575129 575131 575137 575153 575173 575177 575203 575213 575219 575231 575243 575249 
+575251 575257 575261 575303 575317 575359 575369 575371 575401 575417 575429 575431 
+575441 575473 575479 575489 575503 575513 575551 575557 575573 575579 575581 575591 
+575593 575611 575623 575647 575651 575669 575677 575689 575693 575699 575711 575717 
+575723 575747 575753 575777 575791 575821 575837 575849 575857 575863 575867 575893 
+575903 575921 575923 575941 575957 575959 575963 575987 576001 576013 576019 576029 
+576031 576041 576049 576089 576101 576119 576131 576151 576161 576167 576179 576193 
+576203 576211 576217 576221 576223 576227 576287 576293 576299 576313 576319 576341 
+576377 576379 576391 576421 576427 576431 576439 576461 576469 576473 576493 576509 
+576523 576529 576533 576539 576551 576553 576577 576581 576613 576617 576637 576647 
+576649 576659 576671 576677 576683 576689 576701 576703 576721 576727 576731 576739 
+576743 576749 576757 576769 576787 576791 576881 576883 576889 576899 576943 576949 
+576967 576977 577007 577009 577033 577043 577063 577067 577069 577081 577097 577111 
+577123 577147 577151 577153 577169 577177 577193 577219 577249 577259 577271 577279 
+577307 577327 577331 577333 577349 577351 577363 577387 577397 577399 577427 577453 
+577457 577463 577471 577483 577513 577517 577523 577529 577531 577537 577547 577559 
+577573 577589 577601 577613 577627 577637 577639 577667 577721 577739 577751 577757 
+577781 577799 577807 577817 577831 577849 577867 577873 577879 577897 577901 577909 
+577919 577931 577937 577939 577957 577979 577981 578021 578029 578041 578047 578063 
+578077 578093 578117 578131 578167 578183 578191 578203 578209 578213 578251 578267 
+578297 578299 578309 578311 578317 578327 578353 578363 578371 578399 578401 578407 
+578419 578441 578453 578467 578477 578483 578489 578497 578503 578509 578533 578537 
+578563 578573 578581 578587 578597 578603 578609 578621 578647 578659 578687 578689 
+578693 578701 578719 578729 578741 578777 578779 578789 578803 578819 578821 578827 
+578839 578843 578857 578861 578881 578917 578923 578957 578959 578971 578999 579011 
+579017 579023 579053 579079 579083 579107 579113 579119 579133 579179 579197 579199 
+579239 579251 579259 579263 579277 579281 579283 579287 579311 579331 579353 579379 
+579407 579409 579427 579433 579451 579473 579497 579499 579503 579517 579521 579529 
+579533 579539 579541 579563 579569 579571 579583 579587 579611 579613 579629 579637 
+579641 579643 579653 579673 579701 579707 579713 579721 579737 579757 579763 579773 
+579779 579809 579829 579851 579869 579877 579881 579883 579893 579907 579947 579949 
+579961 579967 579973 579983 580001 580031 580033 580079 580081 580093 580133 580163 
+580169 580183 580187 580201 580213 580219 580231 580259 580291 580301 580303 580331 
+580339 580343 580357 580361 580373 580379 580381 580409 580417 580471 580477 580487 
+580513 580529 580549 580553 580561 580577 580607 580627 580631 580633 580639 580663 
+580673 580687 580691 580693 580711 580717 580733 580747 580757 580759 580763 580787 
+580793 580807 580813 580837 580843 580859 580871 580889 580891 580901 580913 580919 
+580927 580939 580969 580981 580997 581029 581041 581047 581069 581071 581089 581099 
+581101 581137 581143 581149 581171 581173 581177 581183 581197 581201 581227 581237 
+581239 581261 581263 581293 581303 581311 581323 581333 581341 581351 581353 581369 
+581377 581393 581407 581411 581429 581443 581447 581459 581473 581491 581521 581527 
+581549 581551 581557 581573 581597 581599 581617 581639 581657 581663 581683 581687 
+581699 581701 581729 581731 581743 581753 581767 581773 581797 581809 581821 581843 
+581857 581863 581869 581873 581891 581909 581921 581941 581947 581953 581981 581983 
+582011 582013 582017 582031 582037 582067 582083 582119 582137 582139 582157 582161 
+582167 582173 582181 582203 582209 582221 582223 582227 582247 582251 582299 582317 
+582319 582371 582391 582409 582419 582427 582433 582451 582457 582469 582499 582509 
+582511 582541 582551 582563 582587 582601 582623 582643 582649 582677 582689 582691 
+582719 582721 582727 582731 582737 582761 582763 582767 582773 582781 582793 582809 
+582821 582851 582853 582859 582887 582899 582931 582937 582949 582961 582971 582973 
+582983 583007 583013 583019 583021 583031 583069 583087 583127 583139 583147 583153 
+583169 583171 583181 583189 583207 583213 583229 583237 583249 583267 583273 583279 
+583291 583301 583337 583339 583351 583367 583391 583397 583403 583409 583417 583421 
+583447 583459 583469 583481 583493 583501 583511 583519 583523 583537 583543 583577 
+583603 583613 583619 583621 583631 583651 583657 583669 583673 583697 583727 583733 
+583753 583769 583777 583783 583789 583801 583841 583853 583859 583861 583873 583879 
+583903 583909 583937 583969 583981 583991 583997 584011 584027 584033 584053 584057 
+584063 584081 584099 584141 584153 584167 584183 584203 584249 584261 584279 584281 
+584303 584347 584357 584359 584377 584387 584393 584399 584411 584417 584429 584447 
+584471 584473 584509 584531 584557 584561 584587 584593 584599 584603 584609 584621 
+584627 584659 584663 584677 584693 584699 584707 584713 584719 584723 584737 584767 
+584777 584789 584791 584809 584849 584863 584869 584873 584879 584897 584911 584917 
+584923 584951 584963 584971 584981 584993 584999 585019 585023 585031 585037 585041 
+585043 585049 585061 585071 585073 585077 585107 585113 585119 585131 585149 585163 
+585199 585217 585251 585269 585271 585283 585289 585313 585317 585337 585341 585367 
+585383 585391 585413 585437 585443 585461 585467 585493 585503 585517 585547 585551 
+585569 585577 585581 585587 585593 585601 585619 585643 585653 585671 585677 585691 
+585721 585727 585733 585737 585743 585749 585757 585779 585791 585799 585839 585841 
+585847 585853 585857 585863 585877 585881 585883 585889 585899 585911 585913 585917 
+585919 585953 585989 585997 586009 586037 586051 586057 586067 586073 586087 586111 
+586121 586123 586129 586139 586147 586153 586189 586213 586237 586273 586277 586291 
+586301 586309 586319 586349 586361 586363 586367 586387 586403 586429 586433 586457 
+586459 586463 586471 586493 586499 586501 586541 586543 586567 586571 586577 586589 
+586601 586603 586609 586627 586631 586633 586667 586679 586693 586711 586723 586741 
+586769 586787 586793 586801 586811 586813 586819 586837 586841 586849 586871 586897 
+586903 586909 586919 586921 586933 586939 586951 586961 586973 586979 586981 587017 
+587021 587033 587051 587053 587057 587063 587087 587101 587107 587117 587123 587131 
+587137 587143 587149 587173 587179 587189 587201 587219 587263 587267 587269 587281 
+587287 587297 587303 587341 587371 587381 587387 587413 587417 587429 587437 587441 
+587459 587467 587473 587497 587513 587519 587527 587533 587539 587549 587551 587563 
+587579 587599 587603 587617 587621 587623 587633 587659 587669 587677 587687 587693 
+587711 587731 587737 587747 587749 587753 587771 587773 587789 587813 587827 587833 
+587849 587863 587887 587891 587897 587927 587933 587947 587959 587969 587971 587987 
+587989 587999 588011 588019 588037 588043 588061 588073 588079 588083 588097 588113 
+588121 588131 588151 588167 588169 588173 588191 588199 588229 588239 588241 588257 
+588277 588293 588311 588347 588359 588361 588383 588389 588397 588403 588433 588437 
+588463 588481 588493 588503 588509 588517 588521 588529 588569 588571 588619 588631 
+588641 588647 588649 588667 588673 588683 588703 588733 588737 588743 588767 588773 
+588779 588811 588827 588839 588871 588877 588881 588893 588911 588937 588941 588947 
+588949 588953 588977 589021 589027 589049 589063 589109 589111 589123 589139 589159 
+589163 589181 589187 589189 589207 589213 589219 589231 589241 589243 589273 589289 
+589291 589297 589327 589331 589349 589357 589387 589409 589439 589451 589453 589471 
+589481 589493 589507 589529 589531 589579 589583 589591 589601 589607 589609 589639 
+589643 589681 589711 589717 589751 589753 589759 589763 589783 589793 589807 589811 
+589829 589847 589859 589861 589873 589877 589903 589921 589933 589993 589997 590021 
+590027 590033 590041 590071 590077 590099 590119 590123 590129 590131 590137 590141 
+590153 590171 590201 590207 590243 590251 590263 590267 590269 590279 590309 590321 
+590323 590327 590357 590363 590377 590383 590389 590399 590407 590431 590437 590489 
+590537 590543 590567 590573 590593 590599 590609 590627 590641 590647 590657 590659 
+590669 590713 590717 590719 590741 590753 590771 590797 590809 590813 590819 590833 
+590839 590867 590899 590921 590923 590929 590959 590963 590983 590987 591023 591053 
+591061 591067 591079 591089 591091 591113 591127 591131 591137 591161 591163 591181 
+591193 591233 591259 591271 591287 591289 591301 591317 591319 591341 591377 591391 
+591403 591407 591421 591431 591443 591457 591469 591499 591509 591523 591553 591559 
+591581 591599 591601 591611 591623 591649 591653 591659 591673 591691 591709 591739 
+591743 591749 591751 591757 591779 591791 591827 591841 591847 591863 591881 591887 
+591893 591901 591937 591959 591973 592019 592027 592049 592057 592061 592073 592087 
+592099 592121 592129 592133 592139 592157 592199 592217 592219 592223 592237 592261 
+592289 592303 592307 592309 592321 592337 592343 592351 592357 592367 592369 592387 
+592391 592393 592429 592451 592453 592463 592469 592483 592489 592507 592517 592531 
+592547 592561 592577 592589 592597 592601 592609 592621 592639 592643 592649 592661 
+592663 592681 592693 592723 592727 592741 592747 592759 592763 592793 592843 592849 
+592853 592861 592873 592877 592897 592903 592919 592931 592939 592967 592973 592987 
+592993 593003 593029 593041 593051 593059 593071 593081 593083 593111 593119 593141 
+593143 593149 593171 593179 593183 593207 593209 593213 593227 593231 593233 593251 
+593261 593273 593291 593293 593297 593321 593323 593353 593381 593387 593399 593401 
+593407 593429 593447 593449 593473 593479 593491 593497 593501 593507 593513 593519 
+593531 593539 593573 593587 593597 593603 593627 593629 593633 593641 593647 593651 
+593689 593707 593711 593767 593777 593783 593839 593851 593863 593869 593899 593903 
+593933 593951 593969 593977 593987 593993 594023 594037 594047 594091 594103 594107 
+594119 594137 594151 594157 594161 594163 594179 594193 594203 594211 594227 594241 
+594271 594281 594283 594287 594299 594311 594313 594329 594359 594367 594379 594397 
+594401 594403 594421 594427 594449 594457 594467 594469 594499 594511 594521 594523 
+594533 594551 594563 594569 594571 594577 594617 594637 594641 594653 594667 594679 
+594697 594709 594721 594739 594749 594751 594773 594793 594821 594823 594827 594829 
+594857 594889 594899 594911 594917 594929 594931 594953 594959 594961 594977 594989 
+595003 595037 595039 595043 595057 595069 595073 595081 595087 595093 595097 595117 
+595123 595129 595139 595141 595157 595159 595181 595183 595201 595207 595229 595247 
+595253 595261 595267 595271 595277 595291 595303 595313 595319 595333 595339 595351 
+595363 595373 595379 595381 595411 595451 595453 595481 595513 595519 595523 595547 
+595549 595571 595577 595579 595613 595627 595687 595703 595709 595711 595717 595733 
+595741 595801 595807 595817 595843 595873 595877 595927 595939 595943 595949 595951 
+595957 595961 595963 595967 595981 596009 596021 596027 596047 596053 596059 596069 
+596081 596083 596093 596117 596119 596143 596147 596159 596179 596209 596227 596231 
+596243 596251 596257 596261 596273 596279 596291 596293 596317 596341 596363 596369 
+596399 596419 596423 596461 596489 596503 596507 596537 596569 596573 596579 596587 
+596593 596599 596611 596623 596633 596653 596663 596669 596671 596693 596707 596737 
+596741 596749 596767 596779 596789 596803 596821 596831 596839 596851 596857 596861 
+596863 596879 596899 596917 596927 596929 596933 596941 596963 596977 596983 596987 
+597031 597049 597053 597059 597073 597127 597131 597133 597137 597169 597209 597221 
+597239 597253 597263 597269 597271 597301 597307 597349 597353 597361 597367 597383 
+597391 597403 597407 597409 597419 597433 597437 597451 597473 597497 597521 597523 
+597539 597551 597559 597577 597581 597589 597593 597599 597613 597637 597643 597659 
+597671 597673 597677 597679 597689 597697 597757 597761 597767 597769 597781 597803 
+597823 597827 597833 597853 597859 597869 597889 597899 597901 597923 597929 597967 
+597997 598007 598049 598051 598057 598079 598093 598099 598123 598127 598141 598151 
+598159 598163 598187 598189 598193 598219 598229 598261 598303 598307 598333 598363 
+598369 598379 598387 598399 598421 598427 598439 598447 598457 598463 598487 598489 
+598501 598537 598541 598571 598613 598643 598649 598651 598657 598669 598681 598687 
+598691 598711 598721 598727 598729 598777 598783 598789 598799 598817 598841 598853 
+598867 598877 598883 598891 598903 598931 598933 598963 598967 598973 598981 598987 
+598999 599003 599009 599021 599023 599069 599087 599117 599143 599147 599149 599153 
+599191 599213 599231 599243 599251 599273 599281 599303 599309 599321 599341 599353 
+599359 599371 599383 599387 599399 599407 599413 599419 599429 599477 599479 599491 
+599513 599519 599537 599551 599561 599591 599597 599603 599611 599623 599629 599657 
+599663 599681 599693 599699 599701 599713 599719 599741 599759 599779 599783 599803 
+599831 599843 599857 599869 599891 599899 599927 599933 599939 599941 599959 599983 
+599993 599999 600011 600043 600053 600071 600073 600091 600101 600109 600167 600169 
+600203 600217 600221 600233 600239 600241 600247 600269 600283 600289 600293 600307 
+600311 600317 600319 600337 600359 600361 600367 600371 600401 600403 600407 600421 
+600433 600449 600451 600463 600469 600487 600517 600529 600557 600569 600577 600601 
+600623 600631 600641 600659 600673 600689 600697 600701 600703 600727 600751 600791 
+600823 600827 600833 600841 600857 600877 600881 600883 600889 600893 600931 600947 
+600949 600959 600961 600973 600979 600983 601021 601031 601037 601039 601043 601061 
+601067 601079 601093 601127 601147 601187 601189 601193 601201 601207 601219 601231 
+601241 601247 601259 601267 601283 601291 601297 601309 601313 601319 601333 601339 
+601357 601379 601397 601411 601423 601439 601451 601457 601487 601507 601541 601543 
+601589 601591 601607 601631 601651 601669 601687 601697 601717 601747 601751 601759 
+601763 601771 601801 601807 601813 601819 601823 601831 601849 601873 601883 601889 
+601897 601903 601943 601949 601961 601969 601981 602029 602033 602039 602047 602057 
+602081 602083 602087 602093 602099 602111 602137 602141 602143 602153 602179 602197 
+602201 602221 602227 602233 602257 602267 602269 602279 602297 602309 602311 602317 
+602321 602333 602341 602351 602377 602383 602401 602411 602431 602453 602461 602477 
+602479 602489 602501 602513 602521 602543 602551 602593 602597 602603 602621 602627 
+602639 602647 602677 602687 602689 602711 602713 602717 602729 602743 602753 602759 
+602773 602779 602801 602821 602831 602839 602867 602873 602887 602891 602909 602929 
+602947 602951 602971 602977 602983 602999 603011 603013 603023 603047 603077 603091 
+603101 603103 603131 603133 603149 603173 603191 603203 603209 603217 603227 603257 
+603283 603311 603319 603349 603389 603391 603401 603431 603443 603457 603467 603487 
+603503 603521 603523 603529 603541 603553 603557 603563 603569 603607 603613 603623 
+603641 603667 603679 603689 603719 603731 603739 603749 603761 603769 603781 603791 
+603793 603817 603821 603833 603847 603851 603853 603859 603881 603893 603899 603901 
+603907 603913 603917 603919 603923 603931 603937 603947 603949 603989 604001 604007 
+604013 604031 604057 604063 604069 604073 604171 604189 604223 604237 604243 604249 
+604259 604277 604291 604309 604313 604319 604339 604343 604349 604361 604369 604379 
+604397 604411 604427 604433 604441 604477 604481 604517 604529 604547 604559 604579 
+604589 604603 604609 604613 604619 604649 604651 604661 604697 604699 604711 604727 
+604729 604733 604753 604759 604781 604787 604801 604811 604819 604823 604829 604837 
+604859 604861 604867 604883 604907 604931 604939 604949 604957 604973 604997 605009 
+605021 605023 605039 605051 605069 605071 605113 605117 605123 605147 605167 605173 
+605177 605191 605221 605233 605237 605239 605249 605257 605261 605309 605323 605329 
+605333 605347 605369 605393 605401 605411 605413 605443 605471 605477 605497 605503 
+605509 605531 605533 605543 605551 605573 605593 605597 605599 605603 605609 605617 
+605629 605639 605641 605687 605707 605719 605779 605789 605809 605837 605849 605861 
+605867 605873 605879 605887 605893 605909 605921 605933 605947 605953 605977 605987 
+605993 606017 606029 606031 606037 606041 606049 606059 606077 606079 606083 606091 
+606113 606121 606131 606173 606181 606223 606241 606247 606251 606299 606301 606311 
+606313 606323 606341 606379 606383 606413 606433 606443 606449 606493 606497 606503 
+606521 606527 606539 606559 606569 606581 606587 606589 606607 606643 606649 606653 
+606659 606673 606721 606731 606733 606737 606743 606757 606791 606811 606829 606833 
+606839 606847 606857 606863 606899 606913 606919 606943 606959 606961 606967 606971 
+606997 607001 607003 607007 607037 607043 607049 607063 607067 607081 607091 607093 
+607097 607109 607127 607129 607147 607151 607153 607157 607163 607181 607199 607213 
+607219 607249 607253 607261 607301 607303 607307 607309 607319 607331 607337 607339 
+607349 607357 607363 607417 607421 607423 607471 607493 607517 607531 607549 607573 
+607583 607619 607627 607667 607669 607681 607697 607703 607721 607723 607727 607741 
+607769 607813 607819 607823 607837 607843 607861 607883 607889 607909 607921 607931 
+607933 607939 607951 607961 607967 607991 607993 608011 608029 608033 608087 608089 
+608099 608117 608123 608129 608131 608147 608161 608177 608191 608207 608213 608269 
+608273 608297 608299 608303 608339 608347 608357 608359 608369 608371 608383 608389 
+608393 608401 608411 608423 608429 608431 608459 608471 608483 608497 608519 608521 
+608527 608581 608591 608593 608609 608611 608633 608653 608659 608669 608677 608693 
+608701 608737 608743 608749 608759 608767 608789 608819 608831 608843 608851 608857 
+608863 608873 608887 608897 608899 608903 608941 608947 608953 608977 608987 608989 
+608999 609043 609047 609067 609071 609079 609101 609107 609113 609143 609149 609163 
+609173 609179 609199 609209 609221 609227 609233 609241 609253 609269 609277 609283 
+609289 609307 609313 609337 609359 609361 609373 609379 609391 609397 609403 609407 
+609421 609437 609443 609461 609487 609503 609509 609517 609527 609533 609541 609571 
+609589 609593 609599 609601 609607 609613 609617 609619 609641 609673 609683 609701 
+609709 609743 609751 609757 609779 609781 609803 609809 609821 609859 609877 609887 
+609907 609911 609913 609923 609929 609979 609989 609991 609997 610031 610063 610081 
+610123 610157 610163 610187 610193 610199 610217 610219 610229 610243 610271 610279 
+610289 610301 610327 610331 610339 610391 610409 610417 610429 610439 610447 610457 
+610469 610501 610523 610541 610543 610553 610559 610567 610579 610583 610619 610633 
+610639 610651 610661 610667 610681 610699 610703 610721 610733 610739 610741 610763 
+610781 610783 610787 610801 610817 610823 610829 610837 610843 610847 610849 610867 
+610877 610879 610891 610913 610919 610921 610933 610957 610969 610993 611011 611027 
+611033 611057 611069 611071 611081 611101 611111 611113 611131 611137 611147 611189 
+611207 611213 611257 611263 611279 611293 611297 611323 611333 611389 611393 611411 
+611419 611441 611449 611453 611459 611467 611483 611497 611531 611543 611549 611551 
+611557 611561 611587 611603 611621 611641 611657 611671 611693 611707 611729 611753 
+611791 611801 611803 611827 611833 611837 611839 611873 611879 611887 611903 611921 
+611927 611939 611951 611953 611957 611969 611977 611993 611999 612011 612023 612037 
+612041 612043 612049 612061 612067 612071 612083 612107 612109 612113 612133 612137 
+612149 612169 612173 612181 612193 612217 612223 612229 612259 612263 612301 612307 
+612317 612319 612331 612341 612349 612371 612373 612377 612383 612401 612407 612439 
+612481 612497 612511 612553 612583 612589 612611 612613 612637 612643 612649 612671 
+612679 612713 612719 612727 612737 612751 612763 612791 612797 612809 612811 612817 
+612823 612841 612847 612853 612869 612877 612889 612923 612929 612947 612967 612971 
+612977 613007 613009 613013 613049 613061 613097 613099 613141 613153 613163 613169 
+613177 613181 613189 613199 613213 613219 613229 613231 613243 613247 613253 613267 
+613279 613289 613297 613337 613357 613363 613367 613381 613421 613427 613439 613441 
+613447 613451 613463 613469 613471 613493 613499 613507 613523 613549 613559 613573 
+613577 613597 613607 613609 613633 613637 613651 613661 613667 613673 613699 613733 
+613741 613747 613759 613763 613807 613813 613817 613829 613841 613849 613861 613883 
+613889 613903 613957 613967 613969 613981 613993 613999 614041 614051 614063 614071 
+614093 614101 614113 614129 614143 614147 614153 614167 614177 614179 614183 614219 
+614267 614279 614291 614293 614297 614321 614333 614377 614387 614413 614417 614437 
+614477 614483 614503 614527 614531 614543 614561 614563 614569 614609 614611 614617 
+614623 614633 614639 614657 614659 614671 614683 614687 614693 614701 614717 614729 
+614741 614743 614749 614753 614759 614773 614827 614843 614849 614851 614863 614881 
+614893 614909 614917 614927 614963 614981 614983 615019 615031 615047 615053 615067 
+615101 615103 615107 615137 615151 615161 615187 615229 615233 615253 615259 615269 
+615289 615299 615313 615337 615341 615343 615367 615379 615389 615401 615403 615413 
+615427 615431 615437 615449 615473 615479 615491 615493 615497 615509 615521 615539 
+615557 615577 615599 615607 615617 615623 615661 615677 615679 615709 615721 615731 
+615739 615743 615749 615751 615761 615767 615773 615793 615799 615821 615827 615829 
+615833 615869 615883 615887 615907 615919 615941 615949 615971 615997 616003 616027 
+616051 616069 616073 616079 616103 616111 616117 616129 616139 616141 616153 616157 
+616169 616171 616181 616207 616211 616219 616223 616229 616243 616261 616277 616289 
+616307 616313 616321 616327 616361 616367 616387 616391 616393 616409 616411 616433 
+616439 616459 616463 616481 616489 616501 616507 616513 616519 616523 616529 616537 
+616547 616579 616589 616597 616639 616643 616669 616673 616703 616717 616723 616729 
+616741 616757 616769 616783 616787 616789 616793 616799 616829 616841 616843 616849 
+616871 616877 616897 616909 616933 616943 616951 616961 616991 616997 616999 617011 
+617027 617039 617051 617053 617059 617077 617087 617107 617119 617129 617131 617147 
+617153 617161 617189 617191 617231 617233 617237 617249 617257 617269 617273 617293 
+617311 617327 617333 617339 617341 617359 617363 617369 617387 617401 617411 617429 
+617447 617453 617467 617471 617473 617479 617509 617521 617531 617537 617579 617587 
+617647 617651 617657 617677 617681 617689 617693 617699 617707 617717 617719 617723 
+617731 617759 617761 617767 617777 617791 617801 617809 617819 617843 617857 617873 
+617879 617887 617917 617951 617959 617963 617971 617983 618029 618031 618041 618049 
+618053 618083 618119 618131 618161 618173 618199 618227 618229 618253 618257 618269 
+618271 618287 618301 618311 618323 618329 618337 618347 618349 618361 618377 618407 
+618413 618421 618437 618439 618463 618509 618521 618547 618559 618571 618577 618581 
+618587 618589 618593 618619 618637 618643 618671 618679 618703 618707 618719 618799 
+618823 618833 618841 618847 618857 618859 618869 618883 618913 618929 618941 618971 
+618979 618991 618997 619007 619009 619019 619027 619033 619057 619061 619067 619079 
+619111 619117 619139 619159 619169 619181 619187 619189 619207 619247 619253 619261 
+619273 619277 619279 619303 619309 619313 619331 619363 619373 619391 619397 619471 
+619477 619511 619537 619543 619561 619573 619583 619589 619603 619607 619613 619621 
+619657 619669 619681 619687 619693 619711 619739 619741 619753 619763 619771 619793 
+619807 619811 619813 619819 619831 619841 619849 619867 619897 619909 619921 619967 
+619979 619981 619987 619999 620003 620029 620033 620051 620099 620111 620117 620159 
+620161 620171 620183 620197 620201 620227 620233 620237 620239 620251 620261 620297 
+620303 620311 620317 620329 620351 620359 620363 620377 620383 620393 620401 620413 
+620429 620437 620441 620461 620467 620491 620507 620519 620531 620549 620561 620567 
+620569 620579 620603 620623 620639 620647 620657 620663 620671 620689 620693 620717 
+620731 620743 620759 620771 620773 620777 620813 620821 620827 620831 620849 620869 
+620887 620909 620911 620929 620933 620947 620957 620981 620999 621007 621013 621017 
+621029 621031 621043 621059 621083 621097 621113 621133 621139 621143 621217 621223 
+621227 621239 621241 621259 621289 621301 621317 621337 621343 621347 621353 621359 
+621371 621389 621419 621427 621431 621443 621451 621461 621473 621521 621527 621541 
+621583 621611 621617 621619 621629 621631 621641 621671 621679 621697 621701 621703 
+621721 621739 621749 621757 621769 621779 621799 621821 621833 621869 621871 621883 
+621893 621913 621923 621937 621941 621983 621997 622009 622019 622043 622049 622051 
+622067 622073 622091 622103 622109 622123 622129 622133 622151 622157 622159 622177 
+622187 622189 622241 622243 622247 622249 622277 622301 622313 622331 622333 622337 
+622351 622367 622397 622399 622423 622477 622481 622483 622493 622513 622519 622529 
+622547 622549 622561 622571 622577 622603 622607 622613 622619 622621 622637 622639 
+622663 622669 622709 622723 622729 622751 622777 622781 622793 622813 622849 622861 
+622879 622889 622901 622927 622943 622957 622967 622987 622997 623003 623009 623017 
+623023 623041 623057 623059 623071 623107 623171 623209 623221 623261 623263 623269 
+623279 623281 623291 623299 623303 623321 623327 623341 623351 623353 623383 623387 
+623393 623401 623417 623423 623431 623437 623477 623521 623531 623537 623563 623591 
+623617 623621 623633 623641 623653 623669 623671 623677 623681 623683 623699 623717 
+623719 623723 623729 623743 623759 623767 623771 623803 623839 623851 623867 623869 
+623879 623881 623893 623923 623929 623933 623947 623957 623963 623977 623983 623989 
+624007 624031 624037 624047 624049 624067 624089 624097 624119 624133 624139 624149 
+624163 624191 624199 624203 624209 624229 624233 624241 624251 624259 624271 624277 
+624311 624313 624319 624329 624331 624347 624391 624401 624419 624443 624451 624467 
+624469 624479 624487 624497 624509 624517 624521 624539 624541 624577 624593 624599 
+624601 624607 624643 624649 624667 624683 624707 624709 624721 624727 624731 624737 
+624763 624769 624787 624791 624797 624803 624809 624829 624839 624847 624851 624859 
+624917 624961 624973 624977 624983 624997 625007 625033 625057 625063 625087 625103 
+625109 625111 625129 625133 625169 625171 625181 625187 625199 625213 625231 625237 
+625253 625267 625279 625283 625307 625319 625343 625351 625367 625369 625397 625409 
+625451 625477 625483 625489 625507 625517 625529 625543 625589 625591 625609 625621 
+625627 625631 625637 625643 625657 625661 625663 625697 625699 625763 625777 625789 
+625811 625819 625831 625837 625861 625871 625883 625909 625913 625927 625939 625943 
+625969 625979 625997 626009 626011 626033 626051 626063 626113 626117 626147 626159 
+626173 626177 626189 626191 626201 626207 626239 626251 626261 626317 626323 626333 
+626341 626347 626363 626377 626389 626393 626443 626477 626489 626519 626533 626539 
+626581 626597 626599 626609 626611 626617 626621 626623 626627 626629 626663 626683 
+626687 626693 626701 626711 626713 626723 626741 626749 626761 626771 626783 626797 
+626809 626833 626837 626861 626887 626917 626921 626929 626947 626953 626959 626963 
+626987 627017 627041 627059 627071 627073 627083 627089 627091 627101 627119 627131 
+627139 627163 627169 627191 627197 627217 627227 627251 627257 627269 627271 627293 
+627301 627329 627349 627353 627377 627379 627383 627391 627433 627449 627479 627481 
+627491 627511 627541 627547 627559 627593 627611 627617 627619 627637 627643 627659 
+627661 627667 627673 627709 627721 627733 627749 627773 627787 627791 627797 627799 
+627811 627841 627859 627901 627911 627919 627943 627947 627953 627961 627973 628013 
+628021 628037 628049 628051 628057 628063 628093 628097 628127 628139 628171 628183 
+628189 628193 628207 628213 628217 628219 628231 628261 628267 628289 628301 628319 
+628357 628363 628373 628379 628391 628399 628423 628427 628447 628477 628487 628493 
+628499 628547 628561 628583 628591 628651 628673 628679 628681 628687 628699 628709 
+628721 628753 628757 628759 628781 628783 628787 628799 628801 628811 628819 628841 
+628861 628877 628909 628913 628921 628937 628939 628973 628993 628997 629003 629009 
+629011 629023 629029 629059 629081 629113 629137 629143 629171 629177 629203 629243 
+629249 629263 629281 629311 629339 629341 629351 629371 629381 629383 629401 629411 
+629417 629429 629449 629467 629483 629491 629509 629513 629537 629567 629569 629591 
+629593 629609 629611 629617 629623 629653 629683 629687 629689 629701 629711 629723 
+629737 629743 629747 629767 629773 629779 629803 629807 629819 629843 629857 629861 
+629873 629891 629897 629899 629903 629921 629927 629929 629939 629963 629977 629987 
+629989 630017 630023 630029 630043 630067 630101 630107 630127 630151 630163 630167 
+630169 630181 630193 630197 630229 630247 630263 630281 630299 630307 630319 630349 
+630353 630391 630433 630451 630467 630473 630481 630493 630521 630523 630529 630559 
+630577 630583 630587 630589 630593 630607 630613 630659 630677 630689 630701 630709 
+630713 630719 630733 630737 630797 630803 630823 630827 630841 630863 630871 630893 
+630899 630901 630907 630911 630919 630941 630967 630997 631003 631013 631039 631061 
+631121 631133 631139 631151 631153 631157 631171 631181 631187 631223 631229 631247 
+631249 631259 631271 631273 631291 631307 631339 631357 631361 631387 631391 631399 
+631409 631429 631453 631457 631459 631469 631471 631483 631487 631507 631513 631529 
+631531 631537 631549 631559 631573 631577 631583 631597 631613 631619 631643 631667 
+631679 631681 631711 631717 631723 631733 631739 631751 631753 631789 631817 631819 
+631843 631847 631853 631859 631861 631867 631889 631901 631903 631913 631927 631931 
+631937 631979 631987 631991 631993 632029 632041 632053 632081 632083 632087 632089 
+632101 632117 632123 632141 632147 632153 632189 632209 632221 632227 632231 632251 
+632257 632267 632273 632297 632299 632321 632323 632327 632329 632347 632351 632353 
+632363 632371 632381 632389 632393 632447 632459 632473 632483 632497 632501 632503 
+632521 632557 632561 632591 632609 632623 632627 632629 632647 632669 632677 632683 
+632699 632713 632717 632743 632747 632773 632777 632813 632839 632843 632851 632857 
+632881 632897 632911 632923 632939 632941 632971 632977 632987 632993 633001 633013 
+633037 633053 633067 633079 633091 633133 633151 633161 633187 633197 633209 633221 
+633253 633257 633263 633271 633287 633307 633317 633337 633359 633377 633379 633383 
+633401 633407 633427 633449 633461 633463 633467 633469 633473 633487 633497 633559 
+633569 633571 633583 633599 633613 633623 633629 633649 633653 633667 633739 633751 
+633757 633767 633781 633791 633793 633797 633799 633803 633823 633833 633877 633883 
+633923 633931 633937 633943 633953 633961 633967 633991 634003 634013 634031 634061 
+634079 634091 634097 634103 634141 634157 634159 634169 634177 634181 634187 634199 
+634211 634223 634237 634241 634247 634261 634267 634273 634279 634301 634307 634313 
+634327 634331 634343 634367 634373 634397 634421 634441 634471 634483 634493 634499 
+634511 634519 634523 634531 634541 634567 634573 634577 634597 634603 634609 634643 
+634649 634651 634679 634681 634687 634703 634709 634717 634727 634741 634747 634757 
+634759 634793 634807 634817 634841 634853 634859 634861 634871 634891 634901 634903 
+634927 634937 634939 634943 634969 634979 635003 635021 635039 635051 635057 635087 
+635119 635147 635149 635197 635203 635207 635249 635251 635263 635267 635279 635287 
+635291 635293 635309 635317 635333 635339 635347 635351 635353 635359 635363 635387 
+635389 635413 635423 635431 635441 635449 635461 635471 635483 635507 635519 635527 
+635533 635563 635567 635599 635603 635617 635639 635653 635659 635689 635707 635711 
+635729 635731 635737 635777 635801 635809 635813 635821 635837 635849 635867 635879 
+635891 635893 635909 635917 635923 635939 635959 635969 635977 635981 635983 635989 
+636017 636023 636043 636059 636061 636071 636073 636107 636109 636133 636137 636149 
+636193 636211 636217 636241 636247 636257 636263 636277 636283 636287 636301 636313 
+636319 636331 636343 636353 636359 636403 636407 636409 636421 636469 636473 636499 
+636533 636539 636541 636547 636553 636563 636569 636613 636619 636631 636653 636673 
+636697 636719 636721 636731 636739 636749 636761 636763 636773 636781 636809 636817 
+636821 636829 636851 636863 636877 636917 636919 636931 636947 636953 636967 636983 
+636997 637001 637003 637067 637073 637079 637097 637129 637139 637157 637163 637171 
+637199 637201 637229 637243 637271 637277 637283 637291 637297 637309 637319 637321 
+637327 637337 637339 637349 637369 637379 637409 637421 637423 637447 637459 637463 
+637471 637489 637499 637513 637519 637529 637531 637543 637573 637597 637601 637603 
+637607 637627 637657 637669 637691 637699 637709 637711 637717 637723 637727 637729 
+637751 637771 637781 637783 637787 637817 637829 637831 637841 637873 637883 637909 
+637933 637937 637939 638023 638047 638051 638059 638063 638081 638117 638123 638147 
+638159 638161 638171 638177 638179 638201 638233 638263 638269 638303 638317 638327 
+638347 638359 638371 638423 638431 638437 638453 638459 638467 638489 638501 638527 
+638567 638581 638587 638621 638629 638633 638663 638669 638689 638699 638717 638719 
+638767 638801 638819 638839 638857 638861 638893 638923 638933 638959 638971 638977 
+638993 638999 639007 639011 639043 639049 639053 639083 639091 639137 639143 639151 
+639157 639167 639169 639181 639211 639253 639257 639259 639263 639269 639299 639307 
+639311 639329 639337 639361 639371 639391 639433 639439 639451 639487 639491 639493 
+639511 639517 639533 639547 639563 639571 639577 639589 639599 639601 639631 639637 
+639647 639671 639677 639679 639689 639697 639701 639703 639713 639719 639731 639739 
+639757 639833 639839 639851 639853 639857 639907 639911 639937 639941 639949 639959 
+639983 639997 640007 640009 640019 640027 640039 640043 640049 640061 640069 640099 
+640109 640121 640127 640139 640151 640153 640163 640193 640219 640223 640229 640231 
+640247 640249 640259 640261 640267 640279 640303 640307 640333 640363 640369 640411 
+640421 640457 640463 640477 640483 640499 640529 640531 640579 640583 640589 640613 
+640621 640631 640649 640663 640667 640669 640687 640691 640727 640733 640741 640771 
+640777 640793 640837 640847 640853 640859 640873 640891 640901 640907 640919 640933 
+640943 640949 640957 640963 640967 640973 640993 641051 641057 641077 641083 641089 
+641093 641101 641129 641131 641143 641167 641197 641203 641213 641227 641239 641261 
+641279 641287 641299 641317 641327 641371 641387 641411 641413 641419 641437 641441 
+641453 641467 641471 641479 641491 641513 641519 641521 641549 641551 641579 641581 
+641623 641633 641639 641681 641701 641713 641747 641749 641761 641789 641791 641803 
+641813 641819 641821 641827 641833 641843 641863 641867 641873 641881 641891 641897 
+641909 641923 641929 641959 641969 641981 642011 642013 642049 642071 642077 642079 
+642113 642121 642133 642149 642151 642157 642163 642197 642199 642211 642217 642223 
+642233 642241 642247 642253 642281 642359 642361 642373 642403 642407 642419 642427 
+642457 642487 642517 642527 642529 642533 642547 642557 642563 642581 642613 642623 
+642673 642683 642701 642737 642739 642769 642779 642791 642797 642799 642809 642833 
+642853 642869 642871 642877 642881 642899 642907 642931 642937 642947 642953 642973 
+642977 642997 643009 643021 643031 643039 643043 643051 643061 643073 643081 643087 
+643099 643121 643129 643183 643187 643199 643213 643217 643231 643243 643273 643301 
+643303 643369 643373 643403 643421 643429 643439 643453 643457 643463 643469 643493 
+643507 643523 643547 643553 643567 643583 643589 643619 643633 643639 643649 643651 
+643661 643681 643691 643693 643697 643703 643723 643729 643751 643781 643847 643849 
+643859 643873 643879 643883 643889 643919 643927 643949 643957 643961 643969 643991 
+644009 644029 644047 644051 644053 644057 644089 644101 644107 644117 644123 644129 
+644131 644141 644143 644153 644159 644173 644191 644197 644201 644227 644239 644257 
+644261 644291 644297 644327 644341 644353 644359 644363 644377 644381 644383 644401 
+644411 644431 644443 644447 644489 644491 644507 644513 644519 644531 644549 644557 
+644563 644569 644593 644597 644599 644617 644629 644647 644653 644669 644671 644687 
+644701 644717 644729 644731 644747 644753 644767 644783 644789 644797 644801 644837 
+644843 644857 644863 644867 644869 644881 644899 644909 644911 644923 644933 644951 
+644977 644999 645011 645013 645019 645023 645037 645041 645049 645067 645077 645083 
+645091 645097 645131 645137 645149 645179 645187 645233 645257 645313 645329 645347 
+645353 645367 645383 645397 645409 645419 645431 645433 645443 645467 645481 645493 
+645497 645499 645503 645521 645527 645529 645571 645577 645581 645583 645599 645611 
+645629 645641 645647 645649 645661 645683 645691 645703 645713 645727 645737 645739 
+645751 645763 645787 645803 645833 645839 645851 645857 645877 645889 645893 645901 
+645907 645937 645941 645973 645979 646003 646013 646027 646039 646067 646073 646099 
+646103 646147 646157 646159 646169 646181 646183 646189 646193 646199 646237 646253 
+646259 646267 646271 646273 646291 646301 646307 646309 646339 646379 646397 646403 
+646411 646421 646423 646433 646453 646519 646523 646537 646543 646549 646571 646573 
+646577 646609 646619 646631 646637 646643 646669 646687 646721 646757 646771 646781 
+646823 646831 646837 646843 646859 646873 646879 646883 646889 646897 646909 646913 
+646927 646937 646957 646979 646981 646991 646993 647011 647033 647039 647047 647057 
+647069 647081 647099 647111 647113 647117 647131 647147 647161 647189 647201 647209 
+647219 647261 647263 647293 647303 647321 647327 647333 647341 647357 647359 647363 
+647371 647399 647401 647417 647429 647441 647453 647477 647489 647503 647509 647527 
+647531 647551 647557 647579 647587 647593 647609 647617 647627 647641 647651 647659 
+647663 647687 647693 647719 647723 647741 647743 647747 647753 647771 647783 647789 
+647809 647821 647837 647839 647851 647861 647891 647893 647909 647917 647951 647953 
+647963 647987 648007 648019 648029 648041 648047 648059 648061 648073 648079 648097 
+648101 648107 648119 648133 648173 648181 648191 648199 648211 648217 648229 648239 
+648257 648259 648269 648283 648289 648293 648317 648331 648341 648343 648371 648377 
+648379 648383 648391 648433 648437 648449 648481 648509 648563 648607 648617 648619 
+648629 648631 648649 648653 648671 648677 648689 648709 648719 648731 648763 648779 
+648803 648841 648859 648863 648871 648887 648889 648911 648917 648931 648937 648953 
+648961 648971 648997 649001 649007 649039 649063 649069 649073 649079 649081 649087 
+649093 649123 649141 649147 649151 649157 649183 649217 649261 649273 649277 649279 
+649283 649291 649307 649321 649361 649379 649381 649403 649421 649423 649427 649457 
+649469 649471 649483 649487 649499 649501 649507 649511 649529 649541 649559 649567 
+649573 649577 649613 649619 649631 649633 649639 649643 649651 649657 649661 649697 
+649709 649717 649739 649751 649769 649771 649777 649783 649787 649793 649799 649801 
+649813 649829 649843 649849 649867 649871 649877 649879 649897 649907 649921 649937 
+649969 649981 649991 650011 650017 650059 650071 650081 650099 650107 650179 650183 
+650189 650213 650227 650261 650269 650281 650291 650317 650327 650329 650347 650359 
+650387 650401 650413 650449 650477 650479 650483 650519 650537 650543 650549 650563 
+650567 650581 650591 650599 650609 650623 650627 650669 650701 650759 650761 650779 
+650813 650821 650827 650833 650851 650861 650863 650869 650873 650911 650917 650927 
+650933 650953 650971 650987 651017 651019 651029 651043 651067 651071 651097 651103 
+651109 651127 651139 651143 651169 651179 651181 651191 651193 651221 651223 651239 
+651247 651251 651257 651271 651281 651289 651293 651323 651331 651347 651361 651397 
+651401 651437 651439 651461 651473 651481 651487 651503 651509 651517 651587 651617 
+651641 651647 651649 651667 651683 651689 651697 651727 651731 651733 651767 651769 
+651793 651803 651809 651811 651821 651839 651841 651853 651857 651863 651869 651877 
+651881 651901 651913 651943 651971 651997 652019 652033 652039 652063 652079 652081 
+652087 652117 652121 652153 652189 652207 652217 652229 652237 652241 652243 652261 
+652279 652283 652291 652319 652321 652331 652339 652343 652357 652361 652369 652373 
+652381 652411 652417 652429 652447 652451 652453 652493 652499 652507 652541 652543 
+652549 652559 652567 652573 652577 652591 652601 652607 652609 652621 652627 652651 
+652657 652667 652699 652723 652727 652733 652739 652741 652747 652753 652759 652787 
+652811 652831 652837 652849 652853 652871 652903 652909 652913 652921 652931 652933 
+652937 652943 652957 652969 652991 652997 652999 653033 653057 653083 653111 653113 
+653117 653143 653153 653197 653203 653207 653209 653243 653267 653273 653281 653311 
+653321 653339 653357 653363 653431 653461 653473 653491 653501 653503 653507 653519 
+653537 653539 653561 653563 653579 653593 653617 653621 653623 653641 653647 653651 
+653659 653687 653693 653707 653711 653713 653743 653749 653761 653777 653789 653797 
+653801 653819 653831 653879 653881 653893 653899 653903 653927 653929 653941 653951 
+653963 653969 653977 653993 654001 654011 654019 654023 654029 654047 654053 654067 
+654089 654107 654127 654149 654161 654163 654167 654169 654187 654191 654209 654221 
+654223 654229 654233 654257 654293 654301 654307 654323 654343 654349 654371 654397 
+654413 654421 654427 654439 654491 654499 654509 654527 654529 654539 654541 654553 
+654571 654587 654593 654601 654611 654613 654623 654629 654671 654679 654697 654701 
+654727 654739 654743 654749 654767 654779 654781 654799 654803 654817 654821 654827 
+654839 654853 654877 654889 654917 654923 654931 654943 654967 654991 655001 655003 
+655013 655021 655033 655037 655043 655069 655087 655103 655111 655121 655157 655181 
+655211 655219 655223 655229 655241 655243 655261 655267 655273 655283 655289 655301 
+655331 655337 655351 655357 655373 655379 655387 655399 655439 655453 655471 655489 
+655507 655511 655517 655531 655541 655547 655559 655561 655579 655583 655597 655601 
+655637 655643 655649 655651 655657 655687 655693 655717 655723 655727 655757 655807 
+655847 655849 655859 655883 655901 655909 655913 655927 655943 655961 655987 656023 
+656039 656063 656077 656113 656119 656129 656141 656147 656153 656171 656221 656237 
+656263 656267 656273 656291 656297 656303 656311 656321 656323 656329 656333 656347 
+656371 656377 656389 656407 656423 656429 656459 656471 656479 656483 656519 656527 
+656561 656587 656597 656599 656603 656609 656651 656657 656671 656681 656683 656687 
+656701 656707 656737 656741 656749 656753 656771 656783 656791 656809 656819 656833 
+656839 656891 656917 656923 656939 656951 656959 656977 656989 656993 657017 657029 
+657047 657049 657061 657071 657079 657089 657091 657113 657121 657127 657131 657187 
+657193 657197 657233 657257 657269 657281 657289 657299 657311 657313 657323 657347 
+657361 657383 657403 657413 657431 657439 657451 657469 657473 657491 657493 657497 
+657499 657523 657529 657539 657557 657581 657583 657589 657607 657617 657649 657653 
+657659 657661 657703 657707 657719 657743 657779 657793 657809 657827 657841 657863 
+657893 657911 657929 657931 657947 657959 657973 657983 658001 658043 658051 658057 
+658069 658079 658111 658117 658123 658127 658139 658153 658159 658169 658187 658199 
+658211 658219 658247 658253 658261 658277 658279 658303 658309 658319 658321 658327 
+658349 658351 658367 658379 658391 658403 658417 658433 658447 658453 658477 658487 
+658507 658547 658549 658573 658579 658589 658591 658601 658607 658613 658633 658639 
+658643 658649 658663 658681 658703 658751 658753 658783 658807 658817 658831 658837 
+658841 658871 658873 658883 658897 658907 658913 658919 658943 658961 658963 658969 
+658979 658991 658997 659011 659023 659047 659059 659063 659069 659077 659101 659137 
+659159 659171 659173 659177 659189 659221 659231 659237 659251 659279 659299 659317 
+659327 659333 659353 659371 659419 659423 659437 659453 659467 659473 659497 659501 
+659513 659521 659531 659539 659563 659569 659591 659597 659609 659611 659621 659629 
+659639 659653 659657 659669 659671 659689 659693 659713 659723 659741 659759 659761 
+659783 659819 659831 659843 659849 659863 659873 659881 659899 659917 659941 659947 
+659951 659963 659983 659999 660001 660013 660029 660047 660053 660061 660067 660071 
+660073 660097 660103 660119 660131 660137 660157 660167 660181 660197 660199 660217 
+660227 660241 660251 660271 660277 660281 660299 660329 660337 660347 660349 660367 
+660377 660379 660391 660403 660409 660449 660493 660503 660509 660521 660529 660547 
+660557 660559 660563 660589 660593 660599 660601 660607 660617 660619 660643 660659 
+660661 660683 660719 660727 660731 660733 660757 660769 660787 660791 660799 660809 
+660811 660817 660833 660851 660853 660887 660893 660899 660901 660917 660923 660941 
+660949 660973 660983 661009 661019 661027 661049 661061 661091 661093 661097 661099 
+661103 661109 661117 661121 661139 661183 661187 661189 661201 661217 661231 661237 
+661253 661259 661267 661321 661327 661343 661361 661373 661393 661417 661421 661439 
+661459 661477 661481 661483 661513 661517 661541 661547 661553 661603 661607 661613 
+661621 661663 661673 661679 661697 661721 661741 661769 661777 661823 661849 661873 
+661877 661879 661883 661889 661897 661909 661931 661939 661949 661951 661961 661987 
+661993 662003 662021 662029 662047 662059 662063 662083 662107 662111 662141 662143 
+662149 662177 662203 662227 662231 662251 662261 662267 662281 662287 662309 662323 
+662327 662339 662351 662353 662357 662369 662401 662407 662443 662449 662477 662483 
+662491 662513 662527 662531 662537 662539 662551 662567 662591 662617 662639 662647 
+662657 662671 662681 662689 662693 662713 662719 662743 662771 662773 662789 662797 
+662819 662833 662839 662843 662867 662897 662899 662917 662939 662941 662947 662951 
+662953 662957 662999 663001 663007 663031 663037 663049 663053 663071 663097 663127 
+663149 663161 663163 663167 663191 663203 663209 663239 663241 663263 663269 663281 
+663283 663301 663319 663331 663349 663359 663371 663407 663409 663437 663463 663517 
+663529 663539 663541 663547 663557 663563 663569 663571 663581 663583 663587 663589 
+663599 663601 663631 663653 663659 663661 663683 663709 663713 663737 663763 663787 
+663797 663821 663823 663827 663853 663857 663869 663881 663893 663907 663937 663959 
+663961 663967 663973 663977 663979 663983 663991 663997 664009 664019 664043 664061 
+664067 664091 664099 664109 664117 664121 664123 664133 664141 664151 664177 664193 
+664199 664211 664243 664253 664271 664273 664289 664319 664331 664357 664369 664379 
+664381 664403 664421 664427 664441 664459 664471 664507 664511 664529 664537 664549 
+664561 664571 664579 664583 664589 664597 664603 664613 664619 664621 664633 664661 
+664663 664667 664669 664679 664687 664691 664693 664711 664739 664757 664771 664777 
+664789 664793 664799 664843 664847 664849 664879 664891 664933 664949 664967 664973 
+664997 665011 665017 665029 665039 665047 665051 665053 665069 665089 665111 665113 
+665117 665123 665131 665141 665153 665177 665179 665201 665207 665213 665221 665233 
+665239 665251 665267 665279 665293 665299 665303 665311 665351 665359 665369 665381 
+665387 665419 665429 665447 665479 665501 665503 665507 665527 665549 665557 665563 
+665569 665573 665591 665603 665617 665629 665633 665659 665677 665713 665719 665723 
+665747 665761 665773 665783 665789 665801 665803 665813 665843 665857 665897 665921 
+665923 665947 665953 665981 665983 665993 666013 666019 666023 666031 666041 666067 
+666073 666079 666089 666091 666109 666119 666139 666143 666167 666173 666187 666191 
+666203 666229 666233 666269 666277 666301 666329 666353 666403 666427 666431 666433 
+666437 666439 666461 666467 666493 666511 666527 666529 666541 666557 666559 666599 
+666607 666637 666643 666647 666649 666667 666671 666683 666697 666707 666727 666733 
+666737 666749 666751 666769 666773 666811 666821 666823 666829 666857 666871 666889 
+666901 666929 666937 666959 666979 666983 666989 667013 667019 667021 667081 667091 
+667103 667123 667127 667129 667141 667171 667181 667211 667229 667241 667243 667273 
+667283 667309 667321 667333 667351 667361 667363 667367 667379 667417 667421 667423 
+667427 667441 667463 667477 667487 667501 667507 667519 667531 667547 667549 667553 
+667559 667561 667577 667631 667643 667649 667657 667673 667687 667691 667697 667699 
+667727 667741 667753 667769 667781 667801 667817 667819 667829 667837 667859 667861 
+667867 667883 667903 667921 667949 667963 667987 667991 667999 668009 668029 668033 
+668047 668051 668069 668089 668093 668111 668141 668153 668159 668179 668201 668203 
+668209 668221 668243 668273 668303 668347 668407 668417 668471 668509 668513 668527 
+668531 668533 668539 668543 668567 668579 668581 668599 668609 668611 668617 668623 
+668671 668677 668687 668699 668713 668719 668737 668741 668747 668761 668791 668803 
+668813 668821 668851 668867 668869 668873 668879 668903 668929 668939 668947 668959 
+668963 668989 668999 669023 669029 669049 669077 669089 669091 669107 669113 669121 
+669127 669133 669167 669173 669181 669241 669247 669271 669283 669287 669289 669301 
+669311 669329 669359 669371 669377 669379 669391 669401 669413 669419 669433 669437 
+669451 669463 669479 669481 669527 669551 669577 669607 669611 669637 669649 669659 
+669661 669667 669673 669677 669679 669689 669701 669707 669733 669763 669787 669791 
+669839 669847 669853 669857 669859 669863 669869 669887 669901 669913 669923 669931 
+669937 669943 669947 669971 669989 670001 670031 670037 670039 670049 670051 670097 
+670099 670129 670139 670147 670177 670193 670199 670211 670217 670223 670231 670237 
+670249 670261 670279 670297 670303 670321 670333 670343 670349 670363 670379 670399 
+670409 670447 670457 670471 670487 670489 670493 670507 670511 670517 670541 670543 
+670559 670577 670583 670597 670613 670619 670627 670639 670669 670673 670693 670711 
+670727 670729 670739 670763 670777 670781 670811 670823 670849 670853 670867 670877 
+670897 670903 670919 670931 670951 670963 670987 670991 671003 671017 671029 671039 
+671059 671063 671081 671087 671093 671123 671131 671141 671159 671161 671189 671201 
+671219 671233 671249 671257 671261 671269 671287 671299 671303 671323 671339 671353 
+671357 671369 671383 671401 671417 671431 671443 671467 671471 671477 671501 671519 
+671533 671537 671557 671581 671591 671603 671609 671633 671647 671651 671681 671701 
+671717 671729 671743 671753 671777 671779 671791 671831 671837 671851 671887 671893 
+671903 671911 671917 671921 671933 671939 671941 671947 671969 671971 671981 671999 
+672019 672029 672041 672043 672059 672073 672079 672097 672103 672107 672127 672131 
+672137 672143 672151 672167 672169 672181 672193 672209 672223 672227 672229 672251 
+672271 672283 672289 672293 672311 672317 672323 672341 672349 672377 672379 672439 
+672443 672473 672493 672499 672521 672557 672577 672587 672593 672629 672641 672643 
+672653 672667 672703 672743 672757 672767 672779 672781 672787 672799 672803 672811 
+672817 672823 672827 672863 672869 672871 672883 672901 672913 672937 672943 672949 
+672953 672967 672977 672983 673019 673039 673063 673069 673073 673091 673093 673109 
+673111 673117 673121 673129 673157 673193 673199 673201 673207 673223 673241 673247 
+673271 673273 673291 673297 673313 673327 673339 673349 673381 673391 673397 673399 
+673403 673411 673427 673429 673441 673447 673451 673457 673459 673469 673487 673499 
+673513 673529 673549 673553 673567 673573 673579 673609 673613 673619 673637 673639 
+673643 673649 673667 673669 673747 673769 673781 673787 673793 673801 673811 673817 
+673837 673879 673891 673921 673943 673951 673961 673979 673991 674017 674057 674059 
+674071 674083 674099 674117 674123 674131 674159 674161 674173 674183 674189 674227 
+674231 674239 674249 674263 674269 674273 674299 674321 674347 674357 674363 674371 
+674393 674419 674431 674449 674461 674483 674501 674533 674537 674551 674563 674603 
+674647 674669 674677 674683 674693 674699 674701 674711 674717 674719 674731 674741 
+674749 674759 674761 674767 674771 674789 674813 674827 674831 674833 674837 674851 
+674857 674867 674879 674903 674929 674941 674953 674957 674977 674987 675029 675067 
+675071 675079 675083 675097 675109 675113 675131 675133 675151 675161 675163 675173 
+675179 675187 675197 675221 675239 675247 675251 675253 675263 675271 675299 675313 
+675319 675341 675347 675391 675407 675413 675419 675449 675457 675463 675481 675511 
+675539 675541 675551 675553 675559 675569 675581 675593 675601 675607 675611 675617 
+675629 675643 675713 675739 675743 675751 675781 675797 675817 675823 675827 675839 
+675841 675859 675863 675877 675881 675889 675923 675929 675931 675959 675973 675977 
+675979 676007 676009 676031 676037 676043 676051 676057 676061 676069 676099 676103 
+676111 676129 676147 676171 676211 676217 676219 676241 676253 676259 676279 676289 
+676297 676337 676339 676349 676363 676373 676387 676391 676409 676411 676421 676427 
+676463 676469 676493 676523 676573 676589 676597 676601 676649 676661 676679 676703 
+676717 676721 676727 676733 676747 676751 676763 676771 676807 676829 676859 676861 
+676883 676891 676903 676909 676919 676927 676931 676937 676943 676961 676967 676979 
+676981 676987 676993 677011 677021 677029 677041 677057 677077 677081 677107 677111 
+677113 677119 677147 677167 677177 677213 677227 677231 677233 677239 677309 677311 
+677321 677323 677333 677357 677371 677387 677423 677441 677447 677459 677461 677471 
+677473 677531 677533 677539 677543 677561 677563 677587 677627 677639 677647 677657 
+677681 677683 677687 677717 677737 677767 677779 677783 677791 677813 677827 677857 
+677891 677927 677947 677953 677959 677983 678023 678037 678047 678061 678077 678101 
+678103 678133 678157 678169 678179 678191 678199 678203 678211 678217 678221 678229 
+678253 678289 678299 678329 678341 678343 678367 678371 678383 678401 678407 678409 
+678413 678421 678437 678451 678463 678479 678481 678493 678499 678533 678541 678553 
+678563 678577 678581 678593 678599 678607 678611 678631 678637 678641 678647 678649 
+678653 678659 678719 678721 678731 678739 678749 678757 678761 678763 678767 678773 
+678779 678809 678823 678829 678833 678859 678871 678883 678901 678907 678941 678943 
+678949 678959 678971 678989 679033 679037 679039 679051 679067 679087 679111 679123 
+679127 679153 679157 679169 679171 679183 679207 679219 679223 679229 679249 679277 
+679279 679297 679309 679319 679333 679361 679363 679369 679373 679381 679403 679409 
+679417 679423 679433 679451 679463 679487 679501 679517 679519 679531 679537 679561 
+679597 679603 679607 679633 679639 679669 679681 679691 679699 679709 679733 679741 
+679747 679751 679753 679781 679793 679807 679823 679829 679837 679843 679859 679867 
+679879 679883 679891 679897 679907 679909 679919 679933 679951 679957 679961 679969 
+679981 679993 679999 680003 680027 680039 680059 680077 680081 680083 680107 680123 
+680129 680159 680161 680177 680189 680203 680209 680213 680237 680249 680263 680291 
+680293 680297 680299 680321 680327 680341 680347 680353 680377 680387 680399 680401 
+680411 680417 680431 680441 680443 680453 680489 680503 680507 680509 680531 680539 
+680567 680569 680587 680597 680611 680623 680633 680651 680657 680681 680707 680749 
+680759 680767 680783 680803 680809 680831 680857 680861 680873 680879 680881 680917 
+680929 680959 680971 680987 680989 680993 681001 681011 681019 681041 681047 681049 
+681061 681067 681089 681091 681113 681127 681137 681151 681167 681179 681221 681229 
+681251 681253 681257 681259 681271 681293 681311 681337 681341 681361 681367 681371 
+681403 681407 681409 681419 681427 681449 681451 681481 681487 681493 681497 681521 
+681523 681539 681557 681563 681589 681607 681613 681623 681631 681647 681673 681677 
+681689 681719 681727 681731 681763 681773 681781 681787 681809 681823 681833 681839 
+681841 681883 681899 681913 681931 681943 681949 681971 681977 681979 681983 681997 
+682001 682009 682037 682049 682063 682069 682079 682141 682147 682151 682153 682183 
+682207 682219 682229 682237 682247 682259 682277 682289 682291 682303 682307 682321 
+682327 682333 682337 682361 682373 682411 682417 682421 682427 682439 682447 682463 
+682471 682483 682489 682511 682519 682531 682547 682597 682607 682637 682657 682673 
+682679 682697 682699 682723 682729 682733 682739 682751 682763 682777 682789 682811 
+682819 682901 682933 682943 682951 682967 683003 683021 683041 683047 683071 683083 
+683087 683119 683129 683143 683149 683159 683201 683231 683251 683257 683273 683299 
+683303 683317 683323 683341 683351 683357 683377 683381 683401 683407 683437 683447 
+683453 683461 683471 683477 683479 683483 683489 683503 683513 683567 683591 683597 
+683603 683651 683653 683681 683687 683693 683699 683701 683713 683719 683731 683737 
+683747 683759 683777 683783 683789 683807 683819 683821 683831 683833 683843 683857 
+683861 683863 683873 683887 683899 683909 683911 683923 683933 683939 683957 683983 
+684007 684017 684037 684053 684091 684109 684113 684119 684121 684127 684157 684163 
+684191 684217 684221 684239 684269 684287 684289 684293 684311 684329 684337 684347 
+684349 684373 684379 684407 684419 684427 684433 684443 684451 684469 684473 684493 
+684527 684547 684557 684559 684569 684581 684587 684599 684617 684637 684643 684647 
+684683 684713 684727 684731 684751 684757 684767 684769 684773 684791 684793 684799 
+684809 684829 684841 684857 684869 684889 684923 684949 684961 684973 684977 684989 
+685001 685019 685031 685039 685051 685057 685063 685073 685081 685093 685099 685103 
+685109 685123 685141 685169 685177 685199 685231 685247 685249 685271 685297 685301 
+685319 685337 685339 685361 685367 685369 685381 685393 685417 685427 685429 685453 
+685459 685471 685493 685511 685513 685519 685537 685541 685547 685591 685609 685613 
+685621 685631 685637 685649 685669 685679 685697 685717 685723 685733 685739 685747 
+685753 685759 685781 685793 685819 685849 685859 685907 685939 685963 685969 685973 
+685987 685991 686003 686009 686011 686027 686029 686039 686041 686051 686057 686087 
+686089 686099 686117 686131 686141 686143 686149 686173 686177 686197 686201 686209 
+686267 686269 686293 686317 686321 686333 686339 686353 686359 686363 686417 686423 
+686437 686449 686453 686473 686479 686503 686513 686519 686551 686563 686593 686611 
+686639 686669 686671 686687 686723 686729 686731 686737 686761 686773 686789 686797 
+686801 686837 686843 686863 686879 686891 686893 686897 686911 686947 686963 686969 
+686971 686977 686989 686993 687007 687013 687017 687019 687023 687031 687041 687061 
+687073 687083 687101 687107 687109 687121 687131 687139 687151 687161 687163 687179 
+687223 687233 687277 687289 687299 687307 687311 687317 687331 687341 687343 687359 
+687383 687389 687397 687403 687413 687431 687433 687437 687443 687457 687461 687473 
+687481 687499 687517 687521 687523 687541 687551 687559 687581 687593 687623 687637 
+687641 687647 687679 687683 687691 687707 687721 687737 687749 687767 687773 687779 
+687787 687809 687823 687829 687839 687847 687893 687901 687917 687923 687931 687949 
+687961 687977 688003 688013 688027 688031 688063 688067 688073 688087 688097 688111 
+688133 688139 688147 688159 688187 688201 688217 688223 688249 688253 688277 688297 
+688309 688333 688339 688357 688379 688393 688397 688403 688411 688423 688433 688447 
+688451 688453 688477 688511 688531 688543 688561 688573 688591 688621 688627 688631 
+688637 688657 688661 688669 688679 688697 688717 688729 688733 688741 688747 688757 
+688763 688777 688783 688799 688813 688861 688867 688871 688889 688907 688939 688951 
+688957 688969 688979 688999 689021 689033 689041 689063 689071 689077 689081 689089 
+689093 689107 689113 689131 689141 689167 689201 689219 689233 689237 689257 689261 
+689267 689279 689291 689309 689317 689321 689341 689357 689369 689383 689389 689393 
+689411 689431 689441 689459 689461 689467 689509 689551 689561 689581 689587 689597 
+689599 689603 689621 689629 689641 689693 689699 689713 689723 689761 689771 689779 
+689789 689797 689803 689807 689827 689831 689851 689867 689869 689873 689879 689891 
+689893 689903 689917 689921 689929 689951 689957 689959 689963 689981 689987 690037 
+690059 690073 690089 690103 690119 690127 690139 690143 690163 690187 690233 690259 
+690269 690271 690281 690293 690323 690341 690367 690377 690397 690407 690419 690427 
+690433 690439 690449 690467 690491 690493 690509 690511 690533 690541 690553 690583 
+690589 690607 690611 690629 690661 690673 690689 690719 690721 690757 690787 690793 
+690817 690839 690841 690869 690871 690887 690889 690919 690929 690953 690997 691001 
+691037 691051 691063 691079 691109 691111 691121 691129 691147 691151 691153 691181 
+691183 691189 691193 691199 691231 691241 691267 691289 691297 691309 691333 691337 
+691343 691349 691363 691381 691399 691409 691433 691451 691463 691489 691499 691531 
+691553 691573 691583 691589 691591 691631 691637 691651 691661 691681 691687 691693 
+691697 691709 691721 691723 691727 691729 691739 691759 691763 691787 691799 691813 
+691829 691837 691841 691843 691871 691877 691891 691897 691903 691907 691919 691921 
+691931 691949 691973 691979 691991 691997 692009 692017 692051 692059 692063 692071 
+692089 692099 692117 692141 692147 692149 692161 692191 692221 692239 692249 692269 
+692273 692281 692287 692297 692299 692309 692327 692333 692347 692353 692371 692387 
+692389 692399 692401 692407 692413 692423 692431 692441 692453 692459 692467 692513 
+692521 692537 692539 692543 692567 692581 692591 692621 692641 692647 692651 692663 
+692689 692707 692711 692717 692729 692743 692753 692761 692771 692779 692789 692821 
+692851 692863 692893 692917 692927 692929 692933 692957 692963 692969 692983 693019 
+693037 693041 693061 693079 693089 693097 693103 693127 693137 693149 693157 693167 
+693169 693179 693223 693257 693283 693317 693323 693337 693353 693359 693373 693397 
+693401 693403 693409 693421 693431 693437 693487 693493 693503 693523 693527 693529 
+693533 693569 693571 693601 693607 693619 693629 693659 693661 693677 693683 693689 
+693691 693697 693701 693727 693731 693733 693739 693743 693757 693779 693793 693799 
+693809 693827 693829 693851 693859 693871 693877 693881 693943 693961 693967 693989 
+694019 694033 694039 694061 694069 694079 694081 694087 694091 694123 694189 694193 
+694201 694207 694223 694259 694261 694271 694273 694277 694313 694319 694327 694333 
+694339 694349 694357 694361 694367 694373 694381 694387 694391 694409 694427 694457 
+694471 694481 694483 694487 694511 694513 694523 694541 694549 694559 694567 694571 
+694591 694597 694609 694619 694633 694649 694651 694717 694721 694747 694763 694781 
+694783 694789 694829 694831 694867 694871 694873 694879 694901 694919 694951 694957 
+694979 694987 694997 694999 695003 695017 695021 695047 695059 695069 695081 695087 
+695089 695099 695111 695117 695131 695141 695171 695207 695239 695243 695257 695263 
+695269 695281 695293 695297 695309 695323 695327 695329 695347 695369 695371 695377 
+695389 695407 695411 695441 695447 695467 695477 695491 695503 695509 695561 695567 
+695573 695581 695593 695599 695603 695621 695627 695641 695659 695663 695677 695687 
+695689 695701 695719 695743 695749 695771 695777 695791 695801 695809 695839 695843 
+695867 695873 695879 695881 695899 695917 695927 695939 695999 696019 696053 696061 
+696067 696077 696079 696083 696107 696109 696119 696149 696181 696239 696253 696257 
+696263 696271 696281 696313 696317 696323 696343 696349 696359 696361 696373 696379 
+696403 696413 696427 696433 696457 696481 696491 696497 696503 696517 696523 696533 
+696547 696569 696607 696611 696617 696623 696629 696653 696659 696679 696691 696719 
+696721 696737 696743 696757 696763 696793 696809 696811 696823 696827 696833 696851 
+696853 696887 696889 696893 696907 696929 696937 696961 696989 696991 697009 697013 
+697019 697033 697049 697063 697069 697079 697087 697093 697111 697121 697127 697133 
+697141 697157 697181 697201 697211 697217 697259 697261 697267 697271 697303 697327 
+697351 697373 697379 697381 697387 697397 697399 697409 697423 697441 697447 697453 
+697457 697481 697507 697511 697513 697519 697523 697553 697579 697583 697591 697601 
+697603 697637 697643 697673 697681 697687 697691 697693 697703 697727 697729 697733 
+697757 697759 697787 697819 697831 697877 697891 697897 697909 697913 697937 697951 
+697967 697973 697979 697993 697999 698017 698021 698039 698051 698053 698077 698083 
+698111 698171 698183 698239 698249 698251 698261 698263 698273 698287 698293 698297 
+698311 698329 698339 698359 698371 698387 698393 698413 698417 698419 698437 698447 
+698471 698483 698491 698507 698521 698527 698531 698539 698543 698557 698567 698591 
+698641 698653 698669 698701 698713 698723 698729 698773 698779 698821 698827 698849 
+698891 698899 698903 698923 698939 698977 698983 699001 699007 699037 699053 699059 
+699073 699077 699089 699113 699119 699133 699151 699157 699169 699187 699191 699197 
+699211 699217 699221 699241 699253 699271 699287 699289 699299 699319 699323 699343 
+699367 699373 699379 699383 699401 699427 699437 699443 699449 699463 699469 699493 
+699511 699521 699527 699529 699539 699541 699557 699571 699581 699617 699631 699641 
+699649 699697 699709 699719 699733 699757 699761 699767 699791 699793 699817 699823 
+699863 699931 699943 699947 699953 699961 699967 700001 700027 700057 700067 700079 
+700081 700087 700099 700103 700109 700127 700129 700171 700199 700201 700211 700223 
+700229 700237 700241 700277 700279 700303 700307 700319 700331 700339 700361 700363 
+700367 700387 700391 700393 700423 700429 700433 700459 700471 700499 700523 700537 
+700561 700571 700573 700577 700591 700597 700627 700633 700639 700643 700673 700681 
+700703 700717 700751 700759 700781 700789 700801 700811 700831 700837 700849 700871 
+700877 700883 700897 700907 700919 700933 700937 700949 700963 700993 701009 701011 
+701023 701033 701047 701089 701117 701147 701159 701177 701179 701209 701219 701221 
+701227 701257 701279 701291 701299 701329 701341 701357 701359 701377 701383 701399 
+701401 701413 701417 701419 701443 701447 701453 701473 701479 701489 701497 701507 
+701509 701527 701531 701549 701579 701581 701593 701609 701611 701621 701627 701629 
+701653 701669 701671 701681 701699 701711 701719 701731 701741 701761 701783 701791 
+701819 701837 701863 701881 701903 701951 701957 701963 701969 702007 702011 702017 
+702067 702077 702101 702113 702127 702131 702137 702139 702173 702179 702193 702199 
+702203 702211 702239 702257 702269 702281 702283 702311 702313 702323 702329 702337 
+702341 702347 702349 702353 702379 702391 702407 702413 702431 702433 702439 702451 
+702469 702497 702503 702511 702517 702523 702529 702539 702551 702557 702587 702589 
+702599 702607 702613 702623 702671 702679 702683 702701 702707 702721 702731 702733 
+702743 702773 702787 702803 702809 702817 702827 702847 702851 702853 702869 702881 
+702887 702893 702913 702937 702983 702991 703013 703033 703039 703081 703117 703121 
+703123 703127 703139 703141 703169 703193 703211 703217 703223 703229 703231 703243 
+703249 703267 703277 703301 703309 703321 703327 703331 703349 703357 703379 703393 
+703411 703441 703447 703459 703463 703471 703489 703499 703531 703537 703559 703561 
+703631 703643 703657 703663 703673 703679 703691 703699 703709 703711 703721 703733 
+703753 703763 703789 703819 703837 703849 703861 703873 703883 703897 703903 703907 
+703943 703949 703957 703981 703991 704003 704009 704017 704023 704027 704029 704059 
+704069 704087 704101 704111 704117 704131 704141 704153 704161 704177 704183 704189 
+704213 704219 704233 704243 704251 704269 704279 704281 704287 704299 704303 704309 
+704321 704357 704393 704399 704419 704441 704447 704449 704453 704461 704477 704507 
+704521 704527 704549 704551 704567 704569 704579 704581 704593 704603 704617 704647 
+704657 704663 704681 704687 704713 704719 704731 704747 704761 704771 704777 704779 
+704783 704797 704801 704807 704819 704833 704839 704849 704857 704861 704863 704867 
+704897 704929 704933 704947 704983 704989 704993 704999 705011 705013 705017 705031 
+705043 705053 705073 705079 705097 705113 705119 705127 705137 705161 705163 705167 
+705169 705181 705191 705197 705209 705247 705259 705269 705277 705293 705307 705317 
+705389 705403 705409 705421 705427 705437 705461 705491 705493 705499 705521 705533 
+705559 705613 705631 705643 705689 705713 705737 705751 705763 705769 705779 705781 
+705787 705821 705827 705829 705833 705841 705863 705871 705883 705899 705919 705937 
+705949 705967 705973 705989 706001 706003 706009 706019 706033 706039 706049 706051 
+706067 706099 706109 706117 706133 706141 706151 706157 706159 706183 706193 706201 
+706207 706213 706229 706253 706267 706283 706291 706297 706301 706309 706313 706337 
+706357 706369 706373 706403 706417 706427 706463 706481 706487 706499 706507 706523 
+706547 706561 706597 706603 706613 706621 706631 706633 706661 706669 706679 706703 
+706709 706729 706733 706747 706751 706753 706757 706763 706787 706793 706801 706829 
+706837 706841 706847 706883 706897 706907 706913 706919 706921 706943 706961 706973 
+706987 706999 707011 707027 707029 707053 707071 707099 707111 707117 707131 707143 
+707153 707159 707177 707191 707197 707219 707249 707261 707279 707293 707299 707321 
+707341 707359 707383 707407 707429 707431 707437 707459 707467 707501 707527 707543 
+707561 707563 707573 707627 707633 707647 707653 707669 707671 707677 707683 707689 
+707711 707717 707723 707747 707753 707767 707789 707797 707801 707813 707827 707831 
+707849 707857 707869 707873 707887 707911 707923 707929 707933 707939 707951 707953 
+707957 707969 707981 707983 708007 708011 708017 708023 708031 708041 708047 708049 
+708053 708061 708091 708109 708119 708131 708137 708139 708161 708163 708179 708199 
+708221 708223 708229 708251 708269 708283 708287 708293 708311 708329 708343 708347 
+708353 708359 708361 708371 708403 708437 708457 708473 708479 708481 708493 708497 
+708517 708527 708559 708563 708569 708583 708593 708599 708601 708641 708647 708667 
+708689 708703 708733 708751 708803 708823 708839 708857 708859 708893 708899 708907 
+708913 708923 708937 708943 708959 708979 708989 708991 708997 709043 709057 709097 
+709117 709123 709139 709141 709151 709153 709157 709201 709211 709217 709231 709237 
+709271 709273 709279 709283 709307 709321 709337 709349 709351 709381 709409 709417 
+709421 709433 709447 709451 709453 709469 709507 709519 709531 709537 709547 709561 
+709589 709603 709607 709609 709649 709651 709663 709673 709679 709691 709693 709703 
+709729 709739 709741 709769 709777 709789 709799 709817 709823 709831 709843 709847 
+709853 709861 709871 709879 709901 709909 709913 709921 709927 709957 709963 709967 
+709981 709991 710009 710023 710027 710051 710053 710081 710089 710119 710189 710207 
+710219 710221 710257 710261 710273 710293 710299 710321 710323 710327 710341 710351 
+710371 710377 710383 710389 710399 710441 710443 710449 710459 710473 710483 710491 
+710503 710513 710519 710527 710531 710557 710561 710569 710573 710599 710603 710609 
+710621 710623 710627 710641 710663 710683 710693 710713 710777 710779 710791 710813 
+710837 710839 710849 710851 710863 710867 710873 710887 710903 710909 710911 710917 
+710929 710933 710951 710959 710971 710977 710987 710989 711001 711017 711019 711023 
+711041 711049 711089 711097 711121 711131 711133 711143 711163 711173 711181 711187 
+711209 711223 711259 711287 711299 711307 711317 711329 711353 711371 711397 711409 
+711427 711437 711463 711479 711497 711499 711509 711517 711523 711539 711563 711577 
+711583 711589 711617 711629 711649 711653 711679 711691 711701 711707 711709 711713 
+711727 711731 711749 711751 711757 711793 711811 711817 711829 711839 711847 711859 
+711877 711889 711899 711913 711923 711929 711937 711947 711959 711967 711973 711983 
+712007 712021 712051 712067 712093 712109 712121 712133 712157 712169 712171 712183 
+712199 712219 712237 712279 712289 712301 712303 712319 712321 712331 712339 712357 
+712409 712417 712427 712429 712433 712447 712477 712483 712489 712493 712499 712507 
+712511 712531 712561 712571 712573 712601 712603 712631 712651 712669 712681 712687 
+712693 712697 712711 712717 712739 712781 712807 712819 712837 712841 712843 712847 
+712883 712889 712891 712909 712913 712927 712939 712951 712961 712967 712973 712981 
+713021 713039 713059 713077 713107 713117 713129 713147 713149 713159 713171 713177 
+713183 713189 713191 713227 713233 713239 713243 713261 713267 713281 713287 713309 
+713311 713329 713347 713351 713353 713357 713381 713389 713399 713407 713411 713417 
+713467 713477 713491 713497 713501 713509 713533 713563 713569 713597 713599 713611 
+713627 713653 713663 713681 713737 713743 713747 713753 713771 713807 713827 713831 
+713833 713861 713863 713873 713891 713903 713917 713927 713939 713941 713957 713981 
+713987 714029 714037 714061 714073 714107 714113 714139 714143 714151 714163 714169 
+714199 714223 714227 714247 714257 714283 714341 714349 714361 714377 714443 714463 
+714479 714481 714487 714503 714509 714517 714521 714529 714551 714557 714563 714569 
+714577 714601 714619 714673 714677 714691 714719 714739 714751 714773 714781 714787 
+714797 714809 714827 714839 714841 714851 714853 714869 714881 714887 714893 714907 
+714911 714919 714943 714947 714949 714971 714991 715019 715031 715049 715063 715069 
+715073 715087 715109 715123 715151 715153 715157 715159 715171 715189 715193 715223 
+715229 715237 715243 715249 715259 715289 715301 715303 715313 715339 715357 715361 
+715373 715397 715417 715423 715439 715441 715453 715457 715489 715499 715523 715537 
+715549 715567 715571 715577 715579 715613 715621 715639 715643 715651 715657 715679 
+715681 715699 715727 715739 715753 715777 715789 715801 715811 715817 715823 715843 
+715849 715859 715867 715873 715877 715879 715889 715903 715909 715919 715927 715943 
+715961 715963 715969 715973 715991 715999 716003 716033 716063 716087 716117 716123 
+716137 716143 716161 716171 716173 716249 716257 716279 716291 716299 716321 716351 
+716383 716389 716399 716411 716413 716447 716449 716453 716459 716477 716479 716483 
+716491 716501 716531 716543 716549 716563 716581 716591 716621 716629 716633 716659 
+716663 716671 716687 716693 716707 716713 716731 716741 716743 716747 716783 716789 
+716809 716819 716827 716857 716861 716869 716897 716899 716917 716929 716951 716953 
+716959 716981 716987 717001 717011 717047 717089 717091 717103 717109 717113 717127 
+717133 717139 717149 717151 717161 717191 717229 717259 717271 717289 717293 717317 
+717323 717331 717341 717397 717413 717419 717427 717443 717449 717463 717491 717511 
+717527 717529 717533 717539 717551 717559 717581 717589 717593 717631 717653 717659 
+717667 717679 717683 717697 717719 717751 717797 717803 717811 717817 717841 717851 
+717883 717887 717917 717919 717923 717967 717979 717989 718007 718043 718049 718051 
+718087 718093 718121 718139 718163 718169 718171 718183 718187 718241 718259 718271 
+718303 718321 718331 718337 718343 718349 718357 718379 718381 718387 718391 718411 
+718423 718427 718433 718453 718457 718463 718493 718511 718513 718541 718547 718559 
+718579 718603 718621 718633 718657 718661 718691 718703 718717 718723 718741 718747 
+718759 718801 718807 718813 718841 718847 718871 718897 718901 718919 718931 718937 
+718943 718973 718999 719009 719011 719027 719041 719057 719063 719071 719101 719119 
+719143 719149 719153 719167 719177 719179 719183 719189 719197 719203 719227 719237 
+719239 719267 719281 719297 719333 719351 719353 719377 719393 719413 719419 719441 
+719447 719483 719503 719533 719557 719567 719569 719573 719597 719599 719633 719639 
+719659 719671 719681 719683 719689 719699 719713 719717 719723 719731 719749 719753 
+719773 719779 719791 719801 719813 719821 719833 719839 719893 719903 719911 719941 
+719947 719951 719959 719981 719989 720007 720019 720023 720053 720059 720089 720091 
+720101 720127 720133 720151 720173 720179 720193 720197 720211 720221 720229 720241 
+720253 720257 720281 720283 720289 720299 720301 720311 720319 720359 720361 720367 
+720373 720397 720403 720407 720413 720439 720481 720491 720497 720527 720547 720569 
+720571 720607 720611 720617 720619 720653 720661 720677 720683 720697 720703 720743 
+720763 720767 720773 720779 720791 720793 720829 720847 720857 720869 720877 720887 
+720899 720901 720913 720931 720943 720947 720961 720971 720983 720991 720997 721003 
+721013 721037 721043 721051 721057 721079 721087 721109 721111 721117 721129 721139 
+721141 721159 721163 721169 721177 721181 721199 721207 721213 721219 721223 721229 
+721243 721261 721267 721283 721291 721307 721319 721321 721333 721337 721351 721363 
+721379 721381 721387 721397 721439 721451 721481 721499 721529 721547 721561 721571 
+721577 721597 721613 721619 721621 721631 721661 721663 721687 721697 721703 721709 
+721733 721739 721783 721793 721843 721849 721859 721883 721891 721909 721921 721951 
+721961 721979 721991 721997 722011 722023 722027 722047 722063 722069 722077 722093 
+722119 722123 722147 722149 722153 722159 722167 722173 722213 722237 722243 722257 
+722273 722287 722291 722299 722311 722317 722321 722333 722341 722353 722363 722369 
+722377 722389 722411 722417 722431 722459 722467 722479 722489 722509 722521 722537 
+722539 722563 722581 722599 722611 722633 722639 722663 722669 722713 722723 722737 
+722749 722783 722791 722797 722807 722819 722833 722849 722881 722899 722903 722921 
+722933 722963 722971 722977 722983 723029 723031 723043 723049 723053 723067 723071 
+723089 723101 723103 723109 723113 723119 723127 723133 723157 723161 723167 723169 
+723181 723193 723209 723221 723227 723257 723259 723263 723269 723271 723287 723293 
+723319 723337 723353 723361 723379 723391 723407 723409 723413 723421 723439 723451 
+723467 723473 723479 723491 723493 723529 723551 723553 723559 723563 723587 723589 
+723601 723607 723617 723623 723661 723721 723727 723739 723761 723791 723797 723799 
+723803 723823 723829 723839 723851 723857 723859 723893 723901 723907 723913 723917 
+723923 723949 723959 723967 723973 723977 723997 724001 724007 724021 724079 724093 
+724099 724111 724117 724121 724123 724153 724187 724211 724219 724259 724267 724277 
+724291 724303 724309 724313 724331 724393 724403 724433 724441 724447 724453 724459 
+724469 724481 724487 724499 724513 724517 724519 724531 724547 724553 724567 724573 
+724583 724597 724601 724609 724621 724627 724631 724639 724643 724651 724721 724723 
+724729 724733 724747 724751 724769 724777 724781 724783 724807 724813 724837 724847 
+724853 724879 724901 724903 724939 724949 724961 724967 724991 724993 725009 725041 
+725057 725071 725077 725099 725111 725113 725119 725147 725149 725159 725161 725189 
+725201 725209 725273 725293 725303 725317 725321 725323 725327 725341 725357 725359 
+725371 725381 725393 725399 725423 725437 725447 725449 725479 725507 725519 725531 
+725537 725579 725587 725597 725603 725639 725653 725663 725671 725687 725723 725731 
+725737 725749 725789 725801 725807 725827 725861 725863 725867 725891 725897 725909 
+725929 725939 725953 725981 725983 725993 725999 726007 726013 726023 726043 726071 
+726091 726097 726101 726107 726109 726137 726139 726149 726157 726163 726169 726181 
+726191 726221 726287 726289 726301 726307 726331 726337 726367 726371 726377 726379 
+726391 726413 726419 726431 726457 726463 726469 726487 726497 726521 726527 726533 
+726559 726589 726599 726601 726611 726619 726623 726629 726641 726647 726659 726679 
+726689 726697 726701 726707 726751 726779 726787 726797 726809 726811 726839 726841 
+726853 726893 726899 726911 726917 726923 726941 726953 726983 726989 726991 727003 
+727009 727019 727021 727049 727061 727063 727079 727121 727123 727157 727159 727169 
+727183 727189 727201 727211 727241 727247 727249 727261 727267 727271 727273 727289 
+727297 727313 727327 727343 727351 727369 727399 727409 727427 727451 727459 727471 
+727483 727487 727499 727501 727541 727561 727577 727589 727613 727621 727633 727667 
+727673 727691 727703 727711 727717 727729 727733 727747 727759 727763 727777 727781 
+727799 727807 727817 727823 727843 727847 727877 727879 727891 727933 727939 727949 
+727981 727997 728003 728017 728027 728047 728069 728087 728113 728129 728131 728173 
+728191 728207 728209 728261 728267 728269 728281 728293 728303 728317 728333 728369 
+728381 728383 728417 728423 728437 728471 728477 728489 728521 728527 728537 728551 
+728557 728561 728573 728579 728627 728639 728647 728659 728681 728687 728699 728701 
+728713 728723 728729 728731 728743 728747 728771 728809 728813 728831 728837 728839 
+728843 728851 728867 728869 728873 728881 728891 728899 728911 728921 728927 728929 
+728941 728947 728953 728969 728971 728993 729019 729023 729037 729041 729059 729073 
+729139 729143 729173 729187 729191 729199 729203 729217 729257 729269 729271 729293 
+729301 729329 729331 729359 729367 729371 729373 729389 729403 729413 729451 729457 
+729473 729493 729497 729503 729511 729527 729551 729557 729559 729569 729571 729577 
+729587 729601 729607 729613 729637 729643 729649 729661 729671 729679 729689 729713 
+729719 729737 729749 729761 729779 729787 729791 729821 729851 729871 729877 729907 
+729913 729919 729931 729941 729943 729947 729977 729979 729991 730003 730021 730033 
+730049 730069 730091 730111 730139 730157 730187 730199 730217 730237 730253 730277 
+730283 730297 730321 730339 730363 730397 730399 730421 730447 730451 730459 730469 
+730487 730537 730553 730559 730567 730571 730573 730589 730591 730603 730619 730633 
+730637 730663 730669 730679 730727 730747 730753 730757 730777 730781 730783 730789 
+730799 730811 730819 730823 730837 730843 730853 730867 730879 730889 730901 730909 
+730913 730943 730969 730973 730993 730999 731033 731041 731047 731053 731057 731113 
+731117 731141 731173 731183 731189 731191 731201 731209 731219 731233 731243 731249 
+731251 731257 731261 731267 731287 731299 731327 731333 731359 731363 731369 731389 
+731413 731447 731483 731501 731503 731509 731531 731539 731567 731587 731593 731597 
+731603 731611 731623 731639 731651 731681 731683 731711 731713 731719 731729 731737 
+731741 731761 731767 731779 731803 731807 731821 731827 731831 731839 731851 731869 
+731881 731893 731909 731911 731921 731923 731933 731957 731981 731999 732023 732029 
+732041 732073 732077 732079 732097 732101 732133 732157 732169 732181 732187 732191 
+732197 732209 732211 732217 732229 732233 732239 732257 732271 732283 732287 732293 
+732299 732311 732323 732331 732373 732439 732449 732461 732467 732491 732493 732497 
+732509 732521 732533 732541 732601 732617 732631 732653 732673 732689 732703 732709 
+732713 732731 732749 732761 732769 732799 732817 732827 732829 732833 732841 732863 
+732877 732889 732911 732923 732943 732959 732967 732971 732997 733003 733009 733067 
+733097 733099 733111 733123 733127 733133 733141 733147 733157 733169 733177 733189 
+733237 733241 733273 733277 733283 733289 733301 733307 733321 733331 733333 733339 
+733351 733373 733387 733391 733393 733399 733409 733427 733433 733459 733477 733489 
+733511 733517 733519 733559 733561 733591 733619 733639 733651 733687 733697 733741 
+733751 733753 733757 733793 733807 733813 733823 733829 733841 733847 733849 733867 
+733871 733879 733883 733919 733921 733937 733939 733949 733963 733973 733981 733991 
+734003 734017 734021 734047 734057 734087 734113 734131 734143 734159 734171 734177 
+734189 734197 734203 734207 734221 734233 734263 734267 734273 734291 734303 734329 
+734347 734381 734389 734401 734411 734423 734429 734431 734443 734471 734473 734477 
+734479 734497 734537 734543 734549 734557 734567 734627 734647 734653 734659 734663 
+734687 734693 734707 734717 734729 734737 734743 734759 734771 734803 734807 734813 
+734819 734837 734849 734869 734879 734887 734897 734911 734933 734941 734953 734957 
+734959 734971 735001 735019 735043 735061 735067 735071 735073 735083 735107 735109 
+735113 735139 735143 735157 735169 735173 735181 735187 735193 735209 735211 735239 
+735247 735263 735271 735283 735307 735311 735331 735337 735341 735359 735367 735373 
+735389 735391 735419 735421 735431 735439 735443 735451 735461 735467 735473 735479 
+735491 735529 735533 735557 735571 735617 735649 735653 735659 735673 735689 735697 
+735719 735731 735733 735739 735751 735781 735809 735821 735829 735853 735871 735877 
+735883 735901 735919 735937 735949 735953 735979 735983 735997 736007 736013 736027 
+736037 736039 736051 736061 736063 736091 736093 736097 736111 736121 736147 736159 
+736181 736187 736243 736247 736249 736259 736273 736277 736279 736357 736361 736363 
+736367 736369 736381 736387 736399 736403 736409 736429 736433 736441 736447 736469 
+736471 736511 736577 736607 736639 736657 736679 736691 736699 736717 736721 736741 
+736787 736793 736817 736823 736843 736847 736867 736871 736889 736903 736921 736927 
+736937 736951 736961 736973 736987 736993 737017 737039 737041 737047 737053 737059 
+737083 737089 737111 737119 737129 737131 737147 737159 737179 737183 737203 737207 
+737251 737263 737279 737281 737287 737291 737293 737309 737327 737339 737351 737353 
+737411 737413 737423 737431 737479 737483 737497 737501 737507 737509 737531 737533 
+737537 737563 737567 737573 737591 737593 737617 737629 737641 737657 737663 737683 
+737687 737717 737719 737729 737747 737753 737767 737773 737797 737801 737809 737819 
+737843 737857 737861 737873 737887 737897 737921 737927 737929 737969 737981 737999 
+738011 738029 738043 738053 738071 738083 738107 738109 738121 738151 738163 738173 
+738197 738211 738217 738223 738247 738263 738301 738313 738317 738319 738341 738349 
+738373 738379 738383 738391 738401 738403 738421 738443 738457 738469 738487 738499 
+738509 738523 738539 738547 738581 738583 738589 738623 738643 738677 738707 738713 
+738721 738743 738757 738781 738791 738797 738811 738827 738839 738847 738851 738863 
+738877 738889 738917 738919 738923 738937 738953 738961 738977 738989 739003 739021 
+739027 739031 739051 739061 739069 739087 739099 739103 739111 739117 739121 739153 
+739163 739171 739183 739187 739199 739201 739217 739241 739253 739273 739283 739301 
+739303 739307 739327 739331 739337 739351 739363 739369 739373 739379 739391 739393 
+739397 739399 739433 739439 739463 739469 739493 739507 739511 739513 739523 739549 
+739553 739579 739601 739603 739621 739631 739633 739637 739649 739693 739699 739723 
+739751 739759 739771 739777 739787 739799 739813 739829 739847 739853 739859 739861 
+739909 739931 739943 739951 739957 739967 739969 740011 740021 740023 740041 740053 
+740059 740087 740099 740123 740141 740143 740153 740161 740171 740189 740191 740227 
+740237 740279 740287 740303 740321 740323 740329 740351 740359 740371 740387 740423 
+740429 740461 740473 740477 740483 740513 740521 740527 740533 740549 740561 740581 
+740591 740599 740603 740651 740653 740659 740671 740681 740687 740693 740711 740713 
+740717 740737 740749 740801 740849 740891 740893 740897 740903 740923 740939 740951 
+740969 740989 741001 741007 741011 741031 741043 741053 741061 741071 741077 741079 
+741101 741119 741121 741127 741131 741137 741163 741187 741193 741227 741229 741233 
+741253 741283 741337 741341 741343 741347 741373 741401 741409 741413 741431 741457 
+741467 741469 741473 741479 741491 741493 741509 741541 741547 741563 741569 741593 
+741599 741641 741661 741667 741677 741679 741683 741691 741709 741721 741781 741787 
+741803 741809 741827 741833 741847 741857 741859 741869 741877 741883 741913 741929 
+741941 741967 741973 741991 742009 742031 742037 742057 742069 742073 742111 742117 
+742127 742151 742153 742193 742199 742201 742211 742213 742219 742229 742241 742243 
+742253 742277 742283 742289 742307 742327 742333 742351 742369 742381 742393 742409 
+742439 742457 742499 742507 742513 742519 742531 742537 742541 742549 742559 742579 
+742591 742607 742619 742657 742663 742673 742681 742697 742699 742711 742717 742723 
+742757 742759 742783 742789 742801 742817 742891 742897 742909 742913 742943 742949 
+742967 742981 742991 742993 742999 743027 743047 743059 743069 743089 743111 743123 
+743129 743131 743137 743143 743159 743161 743167 743173 743177 743179 743203 743209 
+743221 743251 743263 743269 743273 743279 743297 743321 743333 743339 743363 743377 
+743401 743423 743447 743507 743549 743551 743573 743579 743591 743609 743657 743669 
+743671 743689 743693 743711 743731 743747 743777 743779 743791 743803 743819 743833 
+743837 743849 743851 743881 743891 743917 743921 743923 743933 743947 743987 743989 
+744019 744043 744071 744077 744083 744113 744127 744137 744179 744187 744199 744203 
+744221 744239 744251 744253 744283 744301 744313 744353 744371 744377 744389 744391 
+744397 744407 744409 744431 744451 744493 744503 744511 744539 744547 744559 744599 
+744607 744637 744641 744649 744659 744661 744677 744701 744707 744721 744727 744739 
+744761 744767 744791 744811 744817 744823 744829 744833 744859 744893 744911 744917 
+744941 744949 744959 744977 745001 745013 745027 745033 745037 745051 745067 745103 
+745117 745133 745141 745181 745187 745189 745201 745231 745243 745247 745249 745273 
+745301 745307 745337 745343 745357 745369 745379 745391 745397 745471 745477 745517 
+745529 745531 745543 745567 745573 745601 745609 745621 745631 745649 745673 745697 
+745699 745709 745711 745727 745733 745741 745747 745751 745753 745757 745817 745837 
+745859 745873 745903 745931 745933 745939 745951 745973 745981 745993 745999 746017 
+746023 746033 746041 746047 746069 746099 746101 746107 746117 746129 746153 746167 
+746171 746177 746183 746191 746197 746203 746209 746227 746231 746233 746243 746267 
+746287 746303 746309 746329 746353 746363 746371 746411 746413 746429 746477 746479 
+746483 746497 746503 746507 746509 746531 746533 746561 746563 746597 746653 746659 
+746671 746677 746723 746737 746743 746747 746749 746773 746777 746791 746797 746807 
+746813 746839 746843 746869 746873 746891 746899 746903 746939 746951 746957 746959 
+746969 746981 746989 747037 747049 747053 747073 747107 747113 747139 747157 747161 
+747199 747203 747223 747239 747259 747277 747283 747287 747319 747323 747343 747361 
+747377 747391 747401 747407 747421 747427 747449 747451 747457 747463 747493 747497 
+747499 747521 747529 747547 747557 747563 747583 747587 747599 747611 747619 747647 
+747673 747679 747713 747731 747737 747743 747763 747781 747811 747827 747829 747833 
+747839 747841 747853 747863 747869 747871 747889 747917 747919 747941 747953 747977 
+747979 747991 748003 748019 748021 748039 748057 748091 748093 748133 748169 748183 
+748199 748207 748211 748217 748219 748249 748271 748273 748283 748301 748331 748337 
+748339 748343 748361 748379 748387 748441 748453 748463 748471 748481 748487 748499 
+748513 748523 748541 748567 748589 748597 748603 748609 748613 748633 748637 748639 
+748669 748687 748691 748703 748711 748717 748723 748729 748763 748777 748789 748801 
+748807 748817 748819 748823 748829 748831 748849 748861 748871 748877 748883 748889 
+748921 748933 748963 748973 748981 748987 749011 749027 749051 749069 749081 749083 
+749093 749129 749137 749143 749149 749153 749167 749171 749183 749197 749209 749219 
+749237 749249 749257 749267 749279 749297 749299 749323 749339 749347 749351 749383 
+749393 749401 749423 749429 749431 749443 749449 749453 749461 749467 749471 749543 
+749557 749587 749641 749653 749659 749677 749701 749711 749729 749741 749747 749761 
+749773 749779 749803 749807 749809 749843 749851 749863 749891 749893 749899 749909 
+749923 749927 749939 749941 749971 749993 750019 750037 750059 750077 750083 750097 
+750119 750121 750131 750133 750137 750151 750157 750161 750163 750173 750179 750203 
+750209 750223 750229 750287 750311 750313 750353 750383 750401 750413 750419 750437 
+750457 750473 750487 750509 750517 750521 750553 750571 750599 750613 750641 750653 
+750661 750667 750679 750691 750707 750713 750719 750721 750749 750769 750787 750791 
+750797 750803 750809 750817 750829 750853 750857 750863 750917 750929 750943 750961 
+750977 750983 751001 751007 751021 751027 751057 751061 751087 751103 751123 751133 
+751139 751141 751147 751151 751181 751183 751189 751193 751199 751207 751217 751237 
+751259 751273 751277 751291 751297 751301 751307 751319 751321 751327 751343 751351 
+751357 751363 751367 751379 751411 751423 751447 751453 751463 751481 751523 751529 
+751549 751567 751579 751609 751613 751627 751631 751633 751637 751643 751661 751669 
+751691 751711 751717 751727 751739 751747 751753 751759 751763 751787 751799 751813 
+751823 751841 751853 751867 751871 751879 751901 751909 751913 751921 751943 751957 
+751969 751987 751997 752009 752023 752033 752053 752083 752093 752107 752111 752117 
+752137 752149 752177 752183 752189 752197 752201 752203 752207 752251 752263 752273 
+752281 752287 752291 752293 752299 752303 752351 752359 752383 752413 752431 752447 
+752449 752459 752483 752489 752503 752513 752519 752527 752569 752581 752593 752603 
+752627 752639 752651 752681 752683 752699 752701 752707 752747 752771 752789 752797 
+752803 752809 752819 752821 752831 752833 752861 752867 752881 752891 752903 752911 
+752929 752933 752977 752993 753001 753007 753019 753023 753031 753079 753091 753127 
+753133 753139 753143 753161 753187 753191 753197 753229 753257 753307 753329 753341 
+753353 753367 753373 753383 753409 753421 753427 753437 753439 753461 753463 753497 
+753499 753527 753547 753569 753583 753587 753589 753611 753617 753619 753631 753647 
+753659 753677 753679 753689 753691 753707 753719 753721 753737 753743 753751 753773 
+753793 753799 753803 753811 753821 753839 753847 753859 753931 753937 753941 753947 
+753959 753979 753983 754003 754027 754037 754043 754057 754067 754073 754081 754093 
+754099 754109 754111 754121 754123 754133 754153 754157 754181 754183 754207 754211 
+754217 754223 754241 754249 754267 754279 754283 754289 754297 754301 754333 754337 
+754343 754367 754373 754379 754381 754399 754417 754421 754427 754451 754463 754483 
+754489 754513 754531 754549 754573 754577 754583 754597 754627 754639 754651 754703 
+754709 754711 754717 754723 754739 754751 754771 754781 754811 754829 754861 754877 
+754891 754903 754907 754921 754931 754937 754939 754967 754969 754973 754979 754981 
+754991 754993 755009 755033 755057 755071 755077 755081 755087 755107 755137 755143 
+755147 755171 755173 755203 755213 755233 755239 755257 755267 755273 755309 755311 
+755317 755329 755333 755351 755357 755371 755387 755393 755399 755401 755413 755437 
+755441 755449 755473 755483 755509 755539 755551 755561 755567 755569 755593 755597 
+755617 755627 755663 755681 755707 755717 755719 755737 755759 755767 755771 755789 
+755791 755809 755813 755861 755863 755869 755879 755899 755903 755959 755969 755977 
+756011 756023 756043 756053 756097 756101 756127 756131 756139 756149 756167 756179 
+756191 756199 756227 756247 756251 756253 756271 756281 756289 756293 756319 756323 
+756331 756373 756403 756419 756421 756433 756443 756463 756467 756527 756533 756541 
+756563 756571 756593 756601 756607 756629 756641 756649 756667 756673 756683 756689 
+756703 756709 756719 756727 756739 756773 756799 756829 756839 756853 756869 756881 
+756887 756919 756923 756961 756967 756971 757019 757039 757063 757067 757109 757111 
+757151 757157 757171 757181 757201 757241 757243 757247 757259 757271 757291 757297 
+757307 757319 757327 757331 757343 757363 757381 757387 757403 757409 757417 757429 
+757433 757457 757481 757487 757507 757513 757517 757543 757553 757577 757579 757583 
+757607 757633 757651 757661 757693 757699 757709 757711 757727 757751 757753 757763 
+757793 757807 757811 757819 757829 757879 757903 757909 757927 757937 757943 757951 
+757993 757997 758003 758029 758041 758053 758071 758083 758099 758101 758111 758137 
+758141 758159 758179 758189 758201 758203 758227 758231 758237 758243 758267 758269 
+758273 758279 758299 758323 758339 758341 758357 758363 758383 758393 758411 758431 
+758441 758449 758453 758491 758501 758503 758519 758521 758551 758561 758573 758579 
+758599 758617 758629 758633 758671 758687 758699 758707 758711 758713 758729 758731 
+758741 758743 758753 758767 758783 758789 758819 758827 758837 758851 758867 758887 
+758893 758899 758929 758941 758957 758963 758969 758971 758987 759001 759019 759029 
+759037 759047 759053 759089 759103 759113 759131 759149 759167 759173 759179 759181 
+759193 759223 759229 759263 759287 759293 759301 759313 759329 759359 759371 759377 
+759397 759401 759431 759433 759457 759463 759467 759491 759503 759523 759547 759553 
+759557 759559 759569 759571 759581 759589 759599 759617 759623 759631 759637 759641 
+759653 759659 759673 759691 759697 759701 759709 759719 759727 759739 759757 759763 
+759797 759799 759821 759833 759881 759893 759911 759923 759929 759947 759953 759959 
+759961 759973 760007 760043 760063 760079 760093 760103 760117 760129 760141 760147 
+760153 760163 760169 760183 760187 760211 760229 760231 760237 760241 760261 760267 
+760273 760289 760297 760301 760321 760343 760367 760373 760411 760423 760433 760447 
+760453 760457 760477 760489 760499 760511 760519 760531 760537 760549 760553 760561 
+760567 760579 760607 760619 760621 760637 760649 760657 760693 760723 760729 760759 
+760769 760783 760807 760813 760841 760843 760847 760871 760891 760897 760901 760913 
+760927 760933 760939 760951 760961 760993 760997 761003 761009 761023 761051 761069 
+761087 761113 761119 761129 761153 761161 761177 761179 761183 761203 761207 761213 
+761227 761249 761251 761261 761263 761291 761297 761347 761351 761357 761363 761377 
+761381 761389 761393 761399 761407 761417 761429 761437 761441 761443 761459 761471 
+761477 761483 761489 761521 761531 761533 761543 761561 761567 761591 761597 761603 
+761611 761623 761633 761669 761671 761681 761689 761711 761713 761731 761773 761777 
+761779 761807 761809 761833 761861 761863 761869 761879 761897 761927 761939 761963 
+761977 761983 761993 762001 762007 762017 762031 762037 762049 762053 762061 762101 
+762121 762187 762211 762227 762233 762239 762241 762253 762257 762277 762319 762329 
+762367 762371 762373 762379 762389 762397 762401 762407 762409 762479 762491 762499 
+762529 762539 762547 762557 762563 762571 762577 762583 762599 762647 762653 762659 
+762667 762721 762737 762743 762761 762779 762791 762809 762821 762823 762847 762871 
+762877 762893 762899 762901 762913 762917 762919 762959 762967 762973 762989 763001 
+763013 763027 763031 763039 763043 763067 763073 763093 763111 763123 763141 763157 
+763159 763183 763201 763223 763237 763261 763267 763271 763303 763307 763339 763349 
+763369 763381 763391 763403 763409 763417 763423 763429 763447 763457 763471 763481 
+763493 763513 763523 763549 763559 763573 763579 763583 763597 763601 763613 763619 
+763621 763627 763649 763663 763673 763699 763739 763751 763753 763757 763771 763787 
+763801 763811 763823 763843 763859 763879 763883 763897 763901 763907 763913 763921 
+763927 763937 763943 763957 763967 763999 764003 764011 764017 764021 764041 764051 
+764053 764059 764081 764089 764111 764131 764143 764149 764171 764189 764209 764233 
+764249 764251 764261 764273 764293 764317 764321 764327 764339 764341 764369 764381 
+764399 764431 764447 764459 764471 764501 764521 764539 764551 764563 764587 764591 
+764593 764611 764623 764627 764629 764657 764683 764689 764717 764719 764723 764783 
+764789 764809 764837 764839 764849 764857 764887 764891 764893 764899 764903 764947 
+764969 764971 764977 764989 764993 764999 765007 765031 765041 765043 765047 765059 
+765091 765097 765103 765109 765131 765137 765139 765143 765151 765169 765181 765199 
+765203 765209 765211 765227 765229 765241 765251 765257 765283 765287 765293 765307 
+765313 765319 765329 765353 765379 765383 765389 765409 765437 765439 765461 765467 
+765487 765497 765503 765521 765533 765539 765577 765581 765587 765613 765619 765623 
+765649 765659 765673 765707 765727 765749 765763 765767 765773 765781 765823 765827 
+765847 765851 765857 765859 765881 765889 765893 765899 765907 765913 765931 765949 
+765953 765971 765983 765991 766021 766039 766049 766067 766079 766091 766097 766109 
+766111 766127 766163 766169 766177 766187 766211 766223 766229 766231 766237 766247 
+766261 766273 766277 766301 766313 766321 766333 766357 766361 766369 766373 766387 
+766393 766399 766421 766439 766453 766457 766471 766477 766487 766501 766511 766531 
+766541 766543 766553 766559 766583 766609 766637 766639 766651 766679 766687 766721 
+766739 766757 766763 766769 766793 766807 766811 766813 766817 766861 766867 766873 
+766877 766891 766901 766907 766937 766939 766943 766957 766967 766999 767017 767029 
+767051 767071 767089 767093 767101 767111 767131 767147 767153 767161 767167 767203 
+767243 767279 767287 767293 767309 767317 767321 767323 767339 767357 767359 767381 
+767399 767423 767443 767471 767489 767509 767513 767521 767527 767537 767539 767549 
+767551 767587 767597 767603 767617 767623 767633 767647 767677 767681 767707 767729 
+767747 767749 767759 767761 767773 767783 767813 767827 767831 767843 767857 767863 
+767867 767869 767881 767909 767951 767957 768013 768029 768041 768049 768059 768073 
+768101 768107 768127 768133 768139 768161 768167 768169 768191 768193 768197 768199 
+768203 768221 768241 768259 768263 768301 768319 768323 768329 768343 768347 768353 
+768359 768371 768373 768377 768389 768401 768409 768419 768431 768437 768457 768461 
+768479 768491 768503 768541 768563 768571 768589 768613 768623 768629 768631 768641 
+768643 768653 768671 768727 768751 768767 768773 768787 768793 768799 768811 768841 
+768851 768853 768857 768869 768881 768923 768931 768941 768953 768979 768983 769003 
+769007 769019 769033 769039 769057 769073 769081 769091 769117 769123 769147 769151 
+769159 769169 769207 769231 769243 769247 769259 769261 769273 769289 769297 769309 
+769319 769339 769357 769387 769411 769421 769423 769429 769453 769459 769463 769469 
+769487 769541 769543 769547 769553 769577 769579 769589 769591 769597 769619 769627 
+769661 769663 769673 769687 769723 769729 769733 769739 769751 769781 769789 769799 
+769807 769837 769871 769903 769919 769927 769943 769961 769963 769973 769987 769997 
+769999 770027 770039 770041 770047 770053 770057 770059 770069 770101 770111 770113 
+770123 770129 770167 770177 770179 770183 770191 770207 770227 770233 770239 770261 
+770281 770291 770309 770311 770353 770359 770387 770401 770417 770437 770447 770449 
+770459 770503 770519 770527 770533 770537 770551 770557 770573 770579 770587 770591 
+770597 770611 770639 770641 770647 770657 770663 770669 770741 770761 770767 770771 
+770789 770801 770813 770837 770839 770843 770863 770867 770873 770881 770897 770909 
+770927 770929 770951 770971 770981 770993 771011 771013 771019 771031 771037 771047 
+771049 771073 771079 771091 771109 771143 771163 771179 771181 771209 771217 771227 
+771233 771269 771283 771289 771293 771299 771301 771349 771359 771389 771401 771403 
+771427 771431 771437 771439 771461 771473 771481 771499 771503 771509 771517 771527 
+771553 771569 771583 771587 771607 771619 771623 771629 771637 771643 771653 771679 
+771691 771697 771703 771739 771763 771769 771781 771809 771853 771863 771877 771887 
+771889 771899 771917 771937 771941 771961 771971 771973 771997 772001 772003 772019 
+772061 772073 772081 772091 772097 772127 772139 772147 772159 772169 772181 772207 
+772229 772231 772273 772279 772297 772313 772333 772339 772349 772367 772379 772381 
+772391 772393 772403 772439 772441 772451 772459 772477 772493 772517 772537 772567 
+772571 772573 772591 772619 772631 772649 772657 772661 772663 772669 772691 772697 
+772703 772721 772757 772771 772789 772843 772847 772853 772859 772867 772903 772907 
+772909 772913 772921 772949 772963 772987 772991 773021 773023 773027 773029 773039 
+773057 773063 773081 773083 773093 773117 773147 773153 773159 773207 773209 773231 
+773239 773249 773251 773273 773287 773299 773317 773341 773363 773371 773387 773393 
+773407 773417 773447 773453 773473 773491 773497 773501 773533 773537 773561 773567 
+773569 773579 773599 773603 773609 773611 773657 773659 773681 773683 773693 773713 
+773719 773723 773767 773777 773779 773803 773821 773831 773837 773849 773863 773867 
+773869 773879 773897 773909 773933 773939 773951 773953 773987 773989 773999 774001 
+774017 774023 774047 774071 774073 774083 774107 774119 774127 774131 774133 774143 
+774149 774161 774173 774181 774199 774217 774223 774229 774233 774239 774283 774289 
+774313 774317 774337 774343 774377 774427 774439 774463 774467 774491 774511 774523 
+774541 774551 774577 774583 774589 774593 774601 774629 774643 774661 774667 774671 
+774679 774691 774703 774733 774757 774773 774779 774791 774797 774799 774803 774811 
+774821 774833 774853 774857 774863 774901 774919 774929 774931 774959 774997 775007 
+775037 775043 775057 775063 775079 775087 775091 775097 775121 775147 775153 775157 
+775163 775189 775193 775237 775241 775259 775267 775273 775309 775343 775349 775361 
+775363 775367 775393 775417 775441 775451 775477 775507 775513 775517 775531 775553 
+775573 775601 775603 775613 775627 775633 775639 775661 775669 775681 775711 775729 
+775739 775741 775757 775777 775787 775807 775811 775823 775861 775871 775889 775919 
+775933 775937 775939 775949 775963 775987 776003 776029 776047 776057 776059 776077 
+776099 776117 776119 776137 776143 776159 776173 776177 776179 776183 776201 776219 
+776221 776233 776249 776257 776267 776287 776317 776327 776357 776389 776401 776429 
+776449 776453 776467 776471 776483 776497 776507 776513 776521 776551 776557 776561 
+776563 776569 776599 776627 776651 776683 776693 776719 776729 776749 776753 776759 
+776801 776813 776819 776837 776851 776861 776869 776879 776887 776899 776921 776947 
+776969 776977 776983 776987 777001 777011 777013 777031 777041 777071 777097 777103 
+777109 777137 777143 777151 777167 777169 777173 777181 777187 777191 777199 777209 
+777221 777241 777247 777251 777269 777277 777313 777317 777349 777353 777373 777383 
+777389 777391 777419 777421 777431 777433 777437 777451 777463 777473 777479 777541 
+777551 777571 777583 777589 777617 777619 777641 777643 777661 777671 777677 777683 
+777731 777737 777743 777761 777769 777781 777787 777817 777839 777857 777859 777863 
+777871 777877 777901 777911 777919 777977 777979 777989 778013 778027 778049 778051 
+778061 778079 778081 778091 778097 778109 778111 778121 778123 778153 778163 778187 
+778201 778213 778223 778237 778241 778247 778301 778307 778313 778319 778333 778357 
+778361 778363 778391 778397 778403 778409 778417 778439 778469 778507 778511 778513 
+778523 778529 778537 778541 778553 778559 778567 778579 778597 778633 778643 778663 
+778667 778681 778693 778697 778699 778709 778717 778727 778733 778759 778763 778769 
+778777 778793 778819 778831 778847 778871 778873 778879 778903 778907 778913 778927 
+778933 778951 778963 778979 778993 779003 779011 779021 779039 779063 779069 779081 
+779101 779111 779131 779137 779159 779173 779189 779221 779231 779239 779249 779267 
+779327 779329 779341 779347 779351 779353 779357 779377 779413 779477 779489 779507 
+779521 779531 779543 779561 779563 779573 779579 779591 779593 779599 779609 779617 
+779621 779657 779659 779663 779693 779699 779707 779731 779747 779749 779761 779767 
+779771 779791 779797 779827 779837 779869 779873 779879 779887 779899 779927 779939 
+779971 779981 779983 779993 780029 780037 780041 780047 780049 780061 780119 780127 
+780163 780173 780179 780191 780193 780211 780223 780233 780253 780257 780287 780323 
+780343 780347 780371 780379 780383 780389 780397 780401 780421 780433 780457 780469 
+780499 780523 780553 780583 780587 780601 780613 780631 780649 780667 780671 780679 
+780683 780697 780707 780719 780721 780733 780799 780803 780809 780817 780823 780833 
+780841 780851 780853 780869 780877 780887 780889 780917 780931 780953 780961 780971 
+780973 780991 781003 781007 781021 781043 781051 781063 781069 781087 781111 781117 
+781127 781129 781139 781163 781171 781199 781211 781217 781229 781243 781247 781271 
+781283 781301 781307 781309 781321 781327 781351 781357 781367 781369 781387 781397 
+781399 781409 781423 781427 781433 781453 781481 781483 781493 781511 781513 781519 
+781523 781531 781559 781567 781589 781601 781607 781619 781631 781633 781661 781673 
+781681 781721 781733 781741 781771 781799 781801 781817 781819 781853 781861 781867 
+781883 781889 781897 781919 781951 781961 781967 781969 781973 781987 781997 781999 
+782003 782009 782011 782053 782057 782071 782083 782087 782107 782113 782123 782129 
+782137 782141 782147 782149 782183 782189 782191 782209 782219 782231 782251 782263 
+782267 782297 782311 782329 782339 782371 782381 782387 782389 782393 782429 782443 
+782461 782473 782489 782497 782501 782519 782539 782581 782611 782641 782659 782669 
+782671 782687 782689 782707 782711 782723 782777 782783 782791 782839 782849 782861 
+782891 782911 782921 782941 782963 782981 782983 782993 783007 783011 783019 783023 
+783043 783077 783089 783119 783121 783131 783137 783143 783149 783151 783191 783193 
+783197 783227 783247 783257 783259 783269 783283 783317 783323 783329 783337 783359 
+783361 783373 783379 783407 783413 783421 783473 783487 783527 783529 783533 783553 
+783557 783569 783571 783599 783613 783619 783641 783647 783661 783677 783689 783691 
+783701 783703 783707 783719 783721 783733 783737 783743 783749 783763 783767 783779 
+783781 783787 783791 783793 783799 783803 783829 783869 783877 783931 783953 784009 
+784039 784061 784081 784087 784097 784103 784109 784117 784129 784153 784171 784181 
+784183 784211 784213 784219 784229 784243 784249 784283 784307 784309 784313 784321 
+784327 784349 784351 784367 784373 784379 784387 784409 784411 784423 784447 784451 
+784457 784463 784471 784481 784489 784501 784513 784541 784543 784547 784561 784573 
+784577 784583 784603 784627 784649 784661 784687 784697 784717 784723 784727 784753 
+784789 784799 784831 784837 784841 784859 784867 784897 784913 784919 784939 784957 
+784961 784981 785003 785017 785033 785053 785093 785101 785107 785119 785123 785129 
+785143 785153 785159 785167 785203 785207 785219 785221 785227 785249 785269 785287 
+785293 785299 785303 785311 785321 785329 785333 785341 785347 785353 785357 785363 
+785377 785413 785423 785431 785459 785461 785483 785501 785503 785527 785537 785549 
+785569 785573 785579 785591 785597 785623 785627 785641 785651 785671 785693 785717 
+785731 785737 785753 785773 785777 785779 785801 785803 785809 785839 785857 785861 
+785879 785903 785921 785923 785947 785951 785963 786001 786013 786017 786031 786047 
+786053 786059 786061 786077 786109 786127 786151 786167 786173 786179 786197 786211 
+786223 786241 786251 786271 786307 786311 786319 786329 786337 786349 786371 786407 
+786419 786431 786433 786449 786469 786491 786547 786551 786553 786587 786589 786613 
+786629 786659 786661 786673 786691 786697 786701 786703 786707 786719 786739 786763 
+786803 786823 786829 786833 786859 786881 786887 786889 786901 786931 786937 786941 
+786949 786959 786971 786979 786983 787021 787043 787051 787057 787067 787069 787079 
+787091 787099 787123 787139 787153 787181 787187 787207 787217 787243 787261 787277 
+787289 787309 787331 787333 787337 787357 787361 787427 787429 787433 787439 787447 
+787469 787477 787483 787489 787513 787517 787519 787529 787537 787541 787547 787573 
+787601 787609 787621 787639 787649 787667 787697 787711 787747 787751 787757 787769 
+787771 787777 787783 787793 787807 787811 787817 787823 787837 787879 787883 787903 
+787907 787939 787973 787981 787993 787999 788009 788023 788027 788033 788041 788071 
+788077 788087 788089 788093 788107 788129 788153 788159 788167 788173 788189 788209 
+788213 788231 788261 788267 788287 788309 788317 788321 788351 788353 788357 788363 
+788369 788377 788383 788387 788393 788399 788413 788419 788429 788449 788467 788479 
+788497 788521 788527 788531 788537 788549 788561 788563 788569 788603 788621 788651 
+788659 788677 788687 788701 788719 788761 788779 788789 788813 788819 788849 788863 
+788867 788869 788873 788891 788897 788903 788927 788933 788941 788947 788959 788971 
+788993 788999 789001 789017 789029 789031 789067 789077 789091 789097 789101 789109 
+789121 789133 789137 789149 789169 789181 789221 789227 789251 789311 789323 789331 
+789343 789367 789377 789389 789391 789407 789419 789443 789473 789491 789493 789511 
+789527 789533 789557 789571 789577 789587 789589 789611 789623 789631 789653 789671 
+789673 789683 789689 789709 789713 789721 789731 789739 789749 789793 789823 789829 
+789847 789851 789857 789883 789941 789959 789961 789967 789977 789979 790003 790021 
+790033 790043 790051 790057 790063 790087 790093 790099 790121 790169 790171 790189 
+790199 790201 790219 790241 790261 790271 790277 790289 790291 790327 790331 790333 
+790351 790369 790379 790397 790403 790417 790421 790429 790451 790459 790481 790501 
+790513 790519 790523 790529 790547 790567 790583 790589 790607 790613 790633 790637 
+790649 790651 790693 790697 790703 790709 790733 790739 790747 790753 790781 790793 
+790817 790819 790831 790843 790861 790871 790879 790883 790897 790927 790957 790961 
+790967 790969 790991 790997 791003 791009 791017 791029 791047 791053 791081 791093 
+791099 791111 791117 791137 791159 791191 791201 791209 791227 791233 791251 791257 
+791261 791291 791309 791311 791317 791321 791347 791363 791377 791387 791411 791419 
+791431 791443 791447 791473 791489 791519 791543 791561 791563 791569 791573 791599 
+791627 791629 791657 791663 791677 791699 791773 791783 791789 791797 791801 791803 
+791827 791849 791851 791887 791891 791897 791899 791909 791927 791929 791933 791951 
+791969 791971 791993 792023 792031 792037 792041 792049 792061 792067 792073 792101 
+792107 792109 792119 792131 792151 792163 792179 792223 792227 792229 792241 792247 
+792257 792263 792277 792283 792293 792299 792301 792307 792317 792359 792371 792377 
+792383 792397 792413 792443 792461 792479 792481 792487 792521 792529 792551 792553 
+792559 792563 792581 792593 792601 792613 792629 792637 792641 792643 792647 792667 
+792679 792689 792691 792697 792703 792709 792713 792731 792751 792769 792793 792797 
+792821 792871 792881 792893 792907 792919 792929 792941 792959 792973 792983 792989 
+792991 793043 793069 793099 793103 793123 793129 793139 793159 793181 793187 793189 
+793207 793229 793253 793279 793297 793301 793327 793333 793337 793343 793379 793399 
+793439 793447 793453 793487 793489 793493 793511 793517 793519 793537 793547 793553 
+793561 793591 793601 793607 793621 793627 793633 793669 793673 793691 793699 793711 
+793717 793721 793733 793739 793757 793769 793777 793787 793789 793813 793841 793843 
+793853 793867 793889 793901 793927 793931 793939 793957 793967 793979 793981 793999 
+794009 794011 794023 794033 794039 794041 794063 794071 794077 794089 794111 794113 
+794119 794137 794141 794149 794153 794161 794173 794179 794191 794201 794203 794207 
+794221 794231 794239 794249 794327 794341 794363 794383 794389 794399 794407 794413 
+794449 794471 794473 794477 794483 794491 794509 794531 794537 794543 794551 794557 
+794569 794579 794587 794593 794641 794653 794657 794659 794669 794693 794711 794741 
+794743 794749 794779 794831 794879 794881 794887 794921 794923 794953 794957 794993 
+794999 795001 795007 795023 795071 795077 795079 795083 795097 795101 795103 795121 
+795127 795139 795149 795161 795187 795203 795211 795217 795233 795239 795251 795253 
+795299 795307 795323 795329 795337 795343 795349 795427 795449 795461 795467 795479 
+795493 795503 795517 795527 795533 795539 795551 795581 795589 795601 795643 795647 
+795649 795653 795659 795661 795667 795679 795703 795709 795713 795727 795737 795761 
+795763 795791 795793 795797 795799 795803 795827 795829 795871 795877 795913 795917 
+795931 795937 795941 795943 795947 795979 795983 795997 796001 796009 796063 796067 
+796091 796121 796139 796141 796151 796171 796177 796181 796189 796193 796217 796247 
+796259 796267 796291 796303 796307 796337 796339 796361 796363 796373 796379 796387 
+796391 796409 796447 796451 796459 796487 796493 796517 796531 796541 796553 796561 
+796567 796571 796583 796591 796619 796633 796657 796673 796687 796693 796699 796709 
+796711 796751 796759 796769 796777 796781 796799 796801 796813 796819 796847 796849 
+796853 796867 796871 796877 796889 796921 796931 796933 796937 796951 796967 796969 
+796981 797003 797009 797021 797029 797033 797039 797051 797053 797057 797063 797077 
+797119 797131 797143 797161 797171 797201 797207 797273 797281 797287 797309 797311 
+797333 797353 797359 797383 797389 797399 797417 797429 797473 797497 797507 797509 
+797539 797549 797551 797557 797561 797567 797569 797579 797581 797591 797593 797611 
+797627 797633 797647 797681 797689 797701 797711 797729 797743 797747 797767 797773 
+797813 797833 797851 797869 797887 797897 797911 797917 797933 797947 797957 797977 
+797987 798023 798043 798059 798067 798071 798079 798089 798097 798101 798121 798131 
+798139 798143 798151 798173 798179 798191 798197 798199 798221 798223 798227 798251 
+798257 798263 798271 798293 798319 798331 798373 798383 798397 798403 798409 798443 
+798451 798461 798481 798487 798503 798517 798521 798527 798533 798569 798599 798613 
+798641 798647 798649 798667 798691 798697 798701 798713 798727 798737 798751 798757 
+798773 798781 798799 798823 798871 798887 798911 798923 798929 798937 798943 798961 
+799003 799021 799031 799061 799063 799091 799093 799103 799147 799151 799171 799217 
+799219 799223 799259 799291 799301 799303 799307 799313 799333 799343 799361 799363 
+799369 799417 799427 799441 799453 799471 799481 799483 799489 799507 799523 799529 
+799543 799553 799573 799609 799613 799619 799621 799633 799637 799651 799657 799661 
+799679 799723 799727 799739 799741 799753 799759 799789 799801 799807 799817 799837 
+799853 799859 799873 799891 799921 799949 799961 799979 799991 799993 799999 800011 
+800029 800053 800057 800077 800083 800089 800113 800117 800119 800123 800131 800143 
+800159 800161 800171 800209 800213 800221 800231 800237 800243 800281 800287 800291 
+800311 800329 800333 800351 800357 800399 800407 800417 800419 800441 800447 800473 
+800477 800483 800497 800509 800519 800521 800533 800537 800539 800549 800557 800573 
+800587 800593 800599 800621 800623 800647 800651 800659 800663 800669 800677 800687 
+800693 800707 800711 800729 800731 800741 800743 800759 800773 800783 800801 800861 
+800873 800879 800897 800903 800909 800923 800953 800959 800971 800977 800993 800999 
+801001 801007 801011 801019 801037 801061 801077 801079 801103 801107 801127 801137 
+801179 801187 801197 801217 801247 801277 801289 801293 801301 801331 801337 801341 
+801349 801371 801379 801403 801407 801419 801421 801461 801469 801487 801503 801517 
+801539 801551 801557 801569 801571 801607 801611 801617 801631 801641 801677 801683 
+801701 801707 801709 801733 801761 801791 801809 801811 801817 801833 801841 801859 
+801883 801947 801949 801959 801973 801989 802007 802019 802027 802031 802037 802073 
+802103 802121 802127 802129 802133 802141 802147 802159 802163 802177 802181 802183 
+802189 802231 802253 802279 802283 802297 802331 802339 802357 802387 802421 802441 
+802453 802463 802471 802499 802511 802523 802531 802573 802583 802589 802597 802603 
+802609 802643 802649 802651 802661 802667 802709 802721 802729 802733 802751 802759 
+802777 802783 802787 802793 802799 802811 802829 802831 802873 802909 802913 802933 
+802951 802969 802979 802987 803027 803041 803053 803057 803059 803087 803093 803119 
+803141 803171 803189 803207 803227 803237 803251 803269 803273 803287 803311 803323 
+803333 803347 803359 803389 803393 803399 803417 803441 803443 803447 803449 803461 
+803479 803483 803497 803501 803513 803519 803549 803587 803591 803609 803611 803623 
+803629 803651 803659 803669 803687 803717 803729 803731 803741 803749 803813 803819 
+803849 803857 803867 803893 803897 803911 803921 803927 803939 803963 803977 803987 
+803989 804007 804017 804031 804043 804059 804073 804077 804091 804107 804113 804119 
+804127 804157 804161 804179 804191 804197 804203 804211 804239 804259 804281 804283 
+804313 804317 804329 804337 804341 804367 804371 804383 804409 804443 804449 804473 
+804493 804497 804511 804521 804523 804541 804553 804571 804577 804581 804589 804607 
+804611 804613 804619 804653 804689 804697 804703 804709 804743 804751 804757 804761 
+804767 804803 804823 804829 804833 804847 804857 804877 804889 804893 804901 804913 
+804919 804929 804941 804943 804983 804989 804997 805019 805027 805031 805033 805037 
+805061 805067 805073 805081 805097 805099 805109 805111 805121 805153 805159 805177 
+805187 805213 805219 805223 805241 805249 805267 805271 805279 805289 805297 805309 
+805313 805327 805331 805333 805339 805369 805381 805397 805403 805421 805451 805463 
+805471 805487 805499 805501 805507 805517 805523 805531 805537 805559 805573 805583 
+805589 805633 805639 805687 805703 805711 805723 805729 805741 805757 805789 805799 
+805807 805811 805843 805853 805859 805867 805873 805877 805891 805901 805913 805933 
+805967 805991 806009 806011 806017 806023 806027 806033 806041 806051 806059 806087 
+806107 806111 806129 806137 806153 806159 806177 806203 806213 806233 806257 806261 
+806263 806269 806291 806297 806317 806329 806363 806369 806371 806381 806383 806389 
+806447 806453 806467 806483 806503 806513 806521 806543 806549 806579 806581 806609 
+806639 806657 806671 806719 806737 806761 806783 806789 806791 806801 806807 806821 
+806857 806893 806903 806917 806929 806941 806947 806951 806977 806999 807011 807017 
+807071 807077 807083 807089 807097 807113 807119 807127 807151 807181 807187 807193 
+807197 807203 807217 807221 807241 807251 807259 807281 807299 807337 807371 807379 
+807383 807403 807407 807409 807419 807427 807463 807473 807479 807487 807491 807493 
+807509 807511 807523 807539 807559 807571 807607 807613 807629 807637 807647 807689 
+807707 807731 807733 807749 807757 807787 807797 807809 807817 807869 807871 807901 
+807907 807923 807931 807941 807943 807949 807973 807997 808019 808021 808039 808081 
+808097 808111 808147 808153 808169 808177 808187 808211 808217 808229 808237 808261 
+808267 808307 808309 808343 808349 808351 808361 808363 808369 808373 808391 808399 
+808417 808421 808439 808441 808459 808481 808517 808523 808553 808559 808579 808589 
+808597 808601 808603 808627 808637 808651 808679 808681 808693 808699 808721 808733 
+808739 808747 808751 808771 808777 808789 808793 808837 808853 808867 808919 808937 
+808957 808961 808981 808991 808993 809023 809041 809051 809063 809087 809093 809101 
+809141 809143 809147 809173 809177 809189 809201 809203 809213 809231 809239 809243 
+809261 809269 809273 809297 809309 809323 809339 809357 809359 809377 809383 809399 
+809401 809407 809423 809437 809443 809447 809453 809461 809491 809507 809521 809527 
+809563 809569 809579 809581 809587 809603 809629 809701 809707 809719 809729 809737 
+809741 809747 809749 809759 809771 809779 809797 809801 809803 809821 809827 809833 
+809839 809843 809869 809891 809903 809909 809917 809929 809981 809983 809993 810013 
+810023 810049 810053 810059 810071 810079 810091 810109 810137 810149 810151 810191 
+810193 810209 810223 810239 810253 810259 810269 810281 810307 810319 810343 810349 
+810353 810361 810367 810377 810379 810389 810391 810401 810409 810419 810427 810437 
+810443 810457 810473 810487 810493 810503 810517 810533 810539 810541 810547 810553 
+810571 810581 810583 810587 810643 810653 810659 810671 810697 810737 810757 810763 
+810769 810791 810809 810839 810853 810871 810881 810893 810907 810913 810923 810941 
+810949 810961 810967 810973 810989 811037 811039 811067 811081 811099 811123 811127 
+811147 811157 811163 811171 811183 811193 811199 811207 811231 811241 811253 811259 
+811273 811277 811289 811297 811337 811351 811379 811387 811411 811429 811441 811457 
+811469 811493 811501 811511 811519 811523 811553 811561 811583 811607 811619 811627 
+811637 811649 811651 811667 811691 811697 811703 811709 811729 811747 811753 811757 
+811763 811771 811777 811799 811819 811861 811871 811879 811897 811919 811931 811933 
+811957 811961 811981 811991 811997 812011 812033 812047 812051 812057 812081 812101 
+812129 812137 812167 812173 812179 812183 812191 812213 812221 812233 812249 812257 
+812267 812281 812297 812299 812309 812341 812347 812351 812353 812359 812363 812381 
+812387 812393 812401 812431 812443 812467 812473 812477 812491 812501 812503 812519 
+812527 812587 812597 812599 812627 812633 812639 812641 812671 812681 812689 812699 
+812701 812711 812717 812731 812759 812761 812807 812849 812857 812869 812921 812939 
+812963 812969 813013 813017 813023 813041 813049 813061 813083 813089 813091 813097 
+813107 813121 813133 813157 813167 813199 813203 813209 813217 813221 813227 813251 
+813269 813277 813283 813287 813299 813301 813311 813343 813361 813367 813377 813383 
+813401 813419 813427 813443 813493 813499 813503 813511 813529 813541 813559 813577 
+813583 813601 813613 813623 813647 813677 813697 813707 813721 813749 813767 813797 
+813811 813817 813829 813833 813847 813863 813871 813893 813907 813931 813961 813971 
+813991 813997 814003 814007 814013 814019 814031 814043 814049 814061 814063 814067 
+814069 814081 814097 814127 814129 814139 814171 814183 814193 814199 814211 814213 
+814237 814241 814243 814279 814309 814327 814337 814367 814379 814381 814393 814399 
+814403 814423 814447 814469 814477 814493 814501 814531 814537 814543 814559 814577 
+814579 814601 814603 814609 814631 814633 814643 814687 814699 814717 814741 814747 
+814763 814771 814783 814789 814799 814823 814829 814841 814859 814873 814883 814889 
+814901 814903 814927 814937 814939 814943 814949 814991 815029 815033 815047 815053 
+815063 815123 815141 815149 815159 815173 815197 815209 815231 815251 815257 815261 
+815273 815279 815291 815317 815333 815341 815351 815389 815401 815411 815413 815417 
+815431 815453 815459 815471 815491 815501 815519 815527 815533 815539 815543 815569 
+815587 815599 815621 815623 815627 815653 815663 815669 815671 815681 815687 815693 
+815713 815729 815809 815819 815821 815831 815851 815869 815891 815897 815923 815933 
+815939 815953 815963 815977 815989 816019 816037 816043 816047 816077 816091 816103 
+816113 816121 816131 816133 816157 816161 816163 816169 816191 816203 816209 816217 
+816223 816227 816239 816251 816271 816317 816329 816341 816353 816367 816377 816401 
+816427 816443 816451 816469 816499 816521 816539 816547 816559 816581 816587 816589 
+816593 816649 816653 816667 816689 816691 816703 816709 816743 816763 816769 816779 
+816811 816817 816821 816839 816841 816847 816857 816859 816869 816883 816887 816899 
+816911 816917 816919 816929 816941 816947 816961 816971 817013 817027 817039 817049 
+817051 817073 817081 817087 817093 817111 817123 817127 817147 817151 817153 817163 
+817169 817183 817211 817237 817273 817277 817279 817291 817303 817319 817321 817331 
+817337 817357 817379 817403 817409 817433 817457 817463 817483 817519 817529 817549 
+817561 817567 817603 817637 817651 817669 817679 817697 817709 817711 817721 817723 
+817727 817757 817769 817777 817783 817787 817793 817823 817837 817841 817867 817871 
+817877 817889 817891 817897 817907 817913 817919 817933 817951 817979 817987 818011 
+818017 818021 818093 818099 818101 818113 818123 818143 818171 818173 818189 818219 
+818231 818239 818249 818281 818287 818291 818303 818309 818327 818339 818341 818347 
+818353 818359 818371 818383 818393 818399 818413 818429 818453 818473 818509 818561 
+818569 818579 818581 818603 818621 818659 818683 818687 818689 818707 818717 818723 
+818813 818819 818821 818827 818837 818887 818897 818947 818959 818963 818969 818977 
+818999 819001 819017 819029 819031 819037 819061 819073 819083 819101 819131 819149 
+819157 819167 819173 819187 819229 819239 819241 819251 819253 819263 819271 819289 
+819307 819311 819317 819319 819367 819373 819389 819391 819407 819409 819419 819431 
+819437 819443 819449 819457 819463 819473 819487 819491 819493 819499 819503 819509 
+819523 819563 819583 819593 819607 819617 819619 819629 819647 819653 819659 819673 
+819691 819701 819719 819737 819739 819761 819769 819773 819781 819787 819799 819811 
+819823 819827 819829 819853 819899 819911 819913 819937 819943 819977 819989 819991 
+820037 820051 820067 820073 820093 820109 820117 820129 820133 820163 820177 820187 
+820201 820213 820223 820231 820241 820243 820247 820271 820273 820279 820319 820321 
+820331 820333 820343 820349 820361 820367 820399 820409 820411 820427 820429 820441 
+820459 820481 820489 820537 820541 820559 820577 820597 820609 820619 820627 820637 
+820643 820649 820657 820679 820681 820691 820711 820723 820733 820747 820753 820759 
+820763 820789 820793 820837 820873 820891 820901 820907 820909 820921 820927 820957 
+820969 820991 820997 821003 821027 821039 821053 821057 821063 821069 821081 821089 
+821099 821101 821113 821131 821143 821147 821153 821167 821173 821207 821209 821263 
+821281 821291 821297 821311 821329 821333 821377 821383 821411 821441 821449 821459 
+821461 821467 821477 821479 821489 821497 821507 821519 821551 821573 821603 821641 
+821647 821651 821663 821677 821741 821747 821753 821759 821771 821801 821803 821809 
+821819 821827 821833 821851 821857 821861 821869 821879 821897 821911 821939 821941 
+821971 821993 821999 822007 822011 822013 822037 822049 822067 822079 822113 822131 
+822139 822161 822163 822167 822169 822191 822197 822221 822223 822229 822233 822253 
+822259 822277 822293 822299 822313 822317 822323 822329 822343 822347 822361 822379 
+822383 822389 822391 822407 822431 822433 822517 822539 822541 822551 822553 822557 
+822571 822581 822587 822589 822599 822607 822611 822631 822667 822671 822673 822683 
+822691 822697 822713 822721 822727 822739 822743 822761 822763 822781 822791 822793 
+822803 822821 822823 822839 822853 822881 822883 822889 822893 822901 822907 822949 
+822971 822973 822989 823001 823003 823013 823033 823051 823117 823127 823129 823153 
+823169 823177 823183 823201 823219 823231 823237 823241 823243 823261 823271 823283 
+823309 823337 823349 823351 823357 823373 823399 823421 823447 823451 823457 823481 
+823483 823489 823499 823519 823541 823547 823553 823573 823591 823601 823619 823621 
+823637 823643 823651 823663 823679 823703 823709 823717 823721 823723 823727 823729 
+823741 823747 823759 823777 823787 823789 823799 823819 823829 823831 823841 823843 
+823877 823903 823913 823961 823967 823969 823981 823993 823997 824017 824029 824039 
+824063 824069 824077 824081 824099 824123 824137 824147 824179 824183 824189 824191 
+824227 824231 824233 824269 824281 824287 824339 824393 824399 824401 824413 824419 
+824437 824443 824459 824477 824489 824497 824501 824513 824531 824539 824563 824591 
+824609 824641 824647 824651 824669 824671 824683 824699 824701 824723 824741 824749 
+824753 824773 824777 824779 824801 824821 824833 824843 824861 824893 824899 824911 
+824921 824933 824939 824947 824951 824977 824981 824983 825001 825007 825017 825029 
+825047 825049 825059 825067 825073 825101 825107 825109 825131 825161 825191 825193 
+825199 825203 825229 825241 825247 825259 825277 825281 825283 825287 825301 825329 
+825337 825343 825347 825353 825361 825389 825397 825403 825413 825421 825439 825443 
+825467 825479 825491 825509 825527 825533 825547 825551 825553 825577 825593 825611 
+825613 825637 825647 825661 825679 825689 825697 825701 825709 825733 825739 825749 
+825763 825779 825791 825821 825827 825829 825857 825883 825889 825919 825947 825959 
+825961 825971 825983 825991 825997 826019 826037 826039 826051 826061 826069 826087 
+826093 826097 826129 826151 826153 826169 826171 826193 826201 826211 826271 826283 
+826289 826303 826313 826333 826339 826349 826351 826363 826379 826381 826391 826393 
+826403 826411 826453 826477 826493 826499 826541 826549 826559 826561 826571 826583 
+826603 826607 826613 826621 826663 826667 826669 826673 826681 826697 826699 826711 
+826717 826723 826729 826753 826759 826783 826799 826807 826811 826831 826849 826867 
+826879 826883 826907 826921 826927 826939 826957 826963 826967 826979 826997 827009 
+827023 827039 827041 827063 827087 827129 827131 827143 827147 827161 827213 827227 
+827231 827251 827269 827293 827303 827311 827327 827347 827369 827389 827417 827423 
+827429 827443 827447 827461 827473 827501 827521 827537 827539 827549 827581 827591 
+827599 827633 827639 827677 827681 827693 827699 827719 827737 827741 827767 827779 
+827791 827803 827809 827821 827833 827837 827843 827851 827857 827867 827873 827899 
+827903 827923 827927 827929 827941 827969 827987 827989 828007 828011 828013 828029 
+828043 828059 828067 828071 828101 828109 828119 828127 828131 828133 828169 828199 
+828209 828221 828239 828277 828349 828361 828371 828379 828383 828397 828407 828409 
+828431 828449 828517 828523 828547 828557 828577 828587 828601 828637 828643 828649 
+828673 828677 828691 828697 828701 828703 828721 828731 828743 828757 828787 828797 
+828809 828811 828823 828829 828833 828859 828871 828881 828889 828899 828901 828917 
+828923 828941 828953 828967 828977 829001 829013 829057 829063 829069 829093 829097 
+829111 829121 829123 829151 829159 829177 829187 829193 829211 829223 829229 829237 
+829249 829267 829273 829289 829319 829349 829399 829453 829457 829463 829469 829501 
+829511 829519 829537 829547 829561 829601 829613 829627 829637 829639 829643 829657 
+829687 829693 829709 829721 829723 829727 829729 829733 829757 829789 829811 829813 
+829819 829831 829841 829847 829849 829867 829877 829883 829949 829967 829979 829987 
+829993 830003 830017 830041 830051 830099 830111 830117 830131 830143 830153 830173 
+830177 830191 830233 830237 830257 830267 830279 830293 830309 830311 830327 830329 
+830339 830341 830353 830359 830363 830383 830387 830411 830413 830419 830441 830447 
+830449 830477 830483 830497 830503 830513 830549 830551 830561 830567 830579 830587 
+830591 830597 830617 830639 830657 830677 830693 830719 830729 830741 830743 830777 
+830789 830801 830827 830833 830839 830849 830861 830873 830887 830891 830899 830911 
+830923 830939 830957 830981 830989 831023 831031 831037 831043 831067 831071 831073 
+831091 831109 831139 831161 831163 831167 831191 831217 831221 831239 831253 831287 
+831301 831323 831329 831361 831367 831371 831373 831407 831409 831431 831433 831437 
+831443 831461 831503 831529 831539 831541 831547 831553 831559 831583 831587 831599 
+831617 831619 831631 831643 831647 831653 831659 831661 831679 831683 831697 831707 
+831709 831713 831731 831739 831751 831757 831769 831781 831799 831811 831821 831829 
+831847 831851 831863 831881 831889 831893 831899 831911 831913 831917 831967 831983 
+832003 832063 832079 832081 832103 832109 832121 832123 832129 832141 832151 832157 
+832159 832189 832211 832217 832253 832291 832297 832309 832327 832331 832339 832361 
+832367 832369 832373 832379 832399 832411 832421 832427 832451 832457 832477 832483 
+832487 832493 832499 832519 832583 832591 832597 832607 832613 832621 832627 832631 
+832633 832639 832673 832679 832681 832687 832693 832703 832709 832717 832721 832729 
+832747 832757 832763 832771 832787 832801 832837 832841 832861 832879 832883 832889 
+832913 832919 832927 832933 832943 832957 832963 832969 832973 832987 833009 833023 
+833033 833047 833057 833099 833101 833117 833171 833177 833179 833191 833197 833201 
+833219 833251 833269 833281 833293 833299 833309 833347 833353 833363 833377 833389 
+833429 833449 833453 833461 833467 833477 833479 833491 833509 833537 833557 833563 
+833593 833597 833617 833633 833659 833669 833689 833711 833713 833717 833719 833737 
+833747 833759 833783 833801 833821 833839 833843 833857 833873 833887 833893 833897 
+833923 833927 833933 833947 833977 833999 834007 834013 834023 834059 834107 834131 
+834133 834137 834143 834149 834151 834181 834199 834221 834257 834259 834269 834277 
+834283 834287 834299 834311 834341 834367 834433 834439 834469 834487 834497 834503 
+834511 834523 834527 834569 834571 834593 834599 834607 834611 834623 834629 834641 
+834643 834653 834671 834703 834709 834721 834761 834773 834781 834787 834797 834809 
+834811 834829 834857 834859 834893 834913 834941 834947 834949 834959 834961 834983 
+834991 835001 835013 835019 835033 835039 835097 835099 835117 835123 835139 835141 
+835207 835213 835217 835249 835253 835271 835313 835319 835321 835327 835369 835379 
+835391 835399 835421 835427 835441 835451 835453 835459 835469 835489 835511 835531 
+835553 835559 835591 835603 835607 835609 835633 835643 835661 835663 835673 835687 
+835717 835721 835733 835739 835759 835789 835811 835817 835819 835823 835831 835841 
+835847 835859 835897 835909 835927 835931 835937 835951 835957 835973 835979 835987 
+835993 835997 836047 836063 836071 836107 836117 836131 836137 836149 836153 836159 
+836161 836183 836189 836191 836203 836219 836233 836239 836243 836267 836291 836299 
+836317 836327 836347 836351 836369 836377 836387 836413 836449 836471 836477 836491 
+836497 836501 836509 836567 836569 836573 836609 836611 836623 836657 836663 836677 
+836683 836699 836701 836707 836713 836729 836747 836749 836753 836761 836789 836807 
+836821 836833 836839 836861 836863 836873 836879 836881 836917 836921 836939 836951 
+836971 837017 837043 837047 837059 837071 837073 837077 837079 837107 837113 837139 
+837149 837157 837191 837203 837257 837271 837283 837293 837307 837313 837359 837367 
+837373 837377 837379 837409 837413 837439 837451 837461 837467 837497 837503 837509 
+837521 837533 837583 837601 837611 837619 837631 837659 837667 837673 837677 837679 
+837721 837731 837737 837773 837779 837797 837817 837833 837847 837853 837887 837923 
+837929 837931 837937 837943 837979 838003 838021 838037 838039 838043 838063 838069 
+838091 838093 838099 838133 838139 838141 838153 838157 838169 838171 838193 838207 
+838247 838249 838349 838351 838363 838367 838379 838391 838393 838399 838403 838421 
+838429 838441 838447 838459 838463 838471 838483 838517 838547 838553 838561 838571 
+838583 838589 838597 838601 838609 838613 838631 838633 838657 838667 838687 838693 
+838711 838751 838757 838769 838771 838777 838781 838807 838813 838837 838853 838889 
+838897 838909 838913 838919 838927 838931 838939 838949 838951 838963 838969 838991 
+838993 839009 839029 839051 839071 839087 839117 839131 839161 839203 839207 839221 
+839227 839261 839269 839303 839323 839327 839351 839353 839369 839381 839413 839429 
+839437 839441 839453 839459 839471 839473 839483 839491 839497 839519 839539 839551 
+839563 839599 839603 839609 839611 839617 839621 839633 839651 839653 839669 839693 
+839723 839731 839767 839771 839791 839801 839809 839831 839837 839873 839879 839887 
+839897 839899 839903 839911 839921 839957 839959 839963 839981 839999 840023 840053 
+840061 840067 840083 840109 840137 840139 840149 840163 840179 840181 840187 840197 
+840223 840239 840241 840253 840269 840277 840289 840299 840319 840331 840341 840347 
+840353 840439 840451 840457 840467 840473 840479 840491 840523 840547 840557 840571 
+840589 840601 840611 840643 840661 840683 840703 840709 840713 840727 840733 840743 
+840757 840761 840767 840817 840821 840823 840839 840841 840859 840863 840907 840911 
+840923 840929 840941 840943 840967 840979 840989 840991 841003 841013 841019 841021 
+841063 841069 841079 841081 841091 841097 841103 841147 841157 841189 841193 841207 
+841213 841219 841223 841231 841237 841241 841259 841273 841277 841283 841289 841297 
+841307 841327 841333 841349 841369 841391 841397 841411 841427 841447 841457 841459 
+841541 841549 841559 841573 841597 841601 841637 841651 841661 841663 841691 841697 
+841727 841741 841751 841793 841801 841849 841859 841873 841879 841889 841913 841921 
+841927 841931 841933 841979 841987 842003 842021 842041 842047 842063 842071 842077 
+842081 842087 842089 842111 842113 842141 842147 842159 842161 842167 842173 842183 
+842203 842209 842249 842267 842279 842291 842293 842311 842321 842323 842339 842341 
+842351 842353 842371 842383 842393 842399 842407 842417 842419 842423 842447 842449 
+842473 842477 842483 842489 842497 842507 842519 842521 842531 842551 842581 842587 
+842599 842617 842623 842627 842657 842701 842729 842747 842759 842767 842771 842791 
+842801 842813 842819 842857 842869 842879 842887 842923 842939 842951 842957 842969 
+842977 842981 842987 842993 843043 843067 843079 843091 843103 843113 843127 843131 
+843137 843173 843179 843181 843209 843211 843229 843253 843257 843289 843299 843301 
+843307 843331 843347 843361 843371 843377 843379 843383 843397 843443 843449 843457 
+843461 843473 843487 843497 843503 843527 843539 843553 843559 843587 843589 843607 
+843613 843629 843643 843649 843677 843679 843701 843737 843757 843763 843779 843781 
+843793 843797 843811 843823 843833 843841 843881 843883 843889 843901 843907 843911 
+844001 844013 844043 844061 844069 844087 844093 844111 844117 844121 844127 844139 
+844141 844153 844157 844163 844183 844187 844199 844201 844243 844247 844253 844279 
+844289 844297 844309 844321 844351 844369 844421 844427 844429 844433 844439 844447 
+844453 844457 844463 844469 844483 844489 844499 844507 844511 844513 844517 844523 
+844549 844553 844601 844603 844609 844619 844621 844631 844639 844643 844651 844709 
+844717 844733 844757 844763 844769 844771 844777 844841 844847 844861 844867 844891 
+844897 844903 844913 844927 844957 844999 845003 845017 845021 845027 845041 845069 
+845083 845099 845111 845129 845137 845167 845179 845183 845197 845203 845209 845219 
+845231 845237 845261 845279 845287 845303 845309 845333 845347 845357 845363 845371 
+845381 845387 845431 845441 845447 845459 845489 845491 845531 845567 845599 845623 
+845653 845657 845659 845683 845717 845723 845729 845749 845753 845771 845777 845809 
+845833 845849 845863 845879 845881 845893 845909 845921 845927 845941 845951 845969 
+845981 845983 845987 845989 846037 846059 846061 846067 846113 846137 846149 846161 
+846179 846187 846217 846229 846233 846247 846259 846271 846323 846341 846343 846353 
+846359 846361 846383 846389 846397 846401 846403 846407 846421 846427 846437 846457 
+846487 846493 846499 846529 846563 846577 846589 846647 846661 846667 846673 846689 
+846721 846733 846739 846749 846751 846757 846779 846823 846841 846851 846869 846871 
+846877 846913 846917 846919 846931 846943 846949 846953 846961 846973 846977 846983 
+846997 847009 847031 847037 847043 847051 847069 847073 847079 847097 847103 847109 
+847129 847139 847151 847157 847163 847169 847193 847201 847213 847219 847237 847247 
+847271 847277 847279 847283 847309 847321 847339 847361 847367 847373 847393 847423 
+847453 847477 847493 847499 847507 847519 847531 847537 847543 847549 847577 847589 
+847601 847607 847621 847657 847663 847673 847681 847687 847697 847703 847727 847729 
+847741 847787 847789 847813 847817 847853 847871 847883 847901 847919 847933 847937 
+847949 847967 847969 847991 847993 847997 848017 848051 848087 848101 848119 848123 
+848131 848143 848149 848173 848201 848203 848213 848227 848251 848269 848273 848297 
+848321 848359 848363 848383 848387 848399 848417 848423 848429 848443 848461 848467 
+848473 848489 848531 848537 848557 848567 848579 848591 848593 848599 848611 848629 
+848633 848647 848651 848671 848681 848699 848707 848713 848737 848747 848761 848779 
+848789 848791 848797 848803 848807 848839 848843 848849 848851 848857 848879 848893 
+848909 848921 848923 848927 848933 848941 848959 848983 848993 849019 849047 849049 
+849061 849083 849097 849103 849119 849127 849131 849143 849161 849179 849197 849203 
+849217 849221 849223 849241 849253 849271 849301 849311 849347 849349 849353 849383 
+849391 849419 849427 849461 849467 849481 849523 849533 849539 849571 849581 849587 
+849593 849599 849601 849649 849691 849701 849703 849721 849727 849731 849733 849743 
+849763 849767 849773 849829 849833 849839 849857 849869 849883 849917 849923 849931 
+849943 849967 849973 849991 849997 850009 850021 850027 850033 850043 850049 850061 
+850063 850081 850093 850121 850133 850139 850147 850177 850181 850189 850207 850211 
+850229 850243 850247 850253 850261 850271 850273 850301 850303 850331 850337 850349 
+850351 850373 850387 850393 850397 850403 850417 850427 850433 850439 850453 850457 
+850481 850529 850537 850567 850571 850613 850631 850637 850673 850679 850691 850711 
+850727 850753 850781 850807 850823 850849 850853 850879 850891 850897 850933 850943 
+850951 850973 850979 851009 851017 851033 851041 851051 851057 851087 851093 851113 
+851117 851131 851153 851159 851171 851177 851197 851203 851209 851231 851239 851251 
+851261 851267 851273 851293 851297 851303 851321 851327 851351 851359 851363 851381 
+851387 851393 851401 851413 851419 851423 851449 851471 851491 851507 851519 851537 
+851549 851569 851573 851597 851603 851623 851633 851639 851647 851659 851671 851677 
+851689 851723 851731 851749 851761 851797 851801 851803 851813 851821 851831 851839 
+851843 851863 851881 851891 851899 851953 851957 851971 852011 852013 852031 852037 
+852079 852101 852121 852139 852143 852149 852151 852167 852179 852191 852197 852199 
+852211 852233 852239 852253 852259 852263 852287 852289 852301 852323 852347 852367 
+852391 852409 852427 852437 852457 852463 852521 852557 852559 852563 852569 852581 
+852583 852589 852613 852617 852623 852641 852661 852671 852673 852689 852749 852751 
+852757 852763 852769 852793 852799 852809 852827 852829 852833 852847 852851 852857 
+852871 852881 852889 852893 852913 852937 852953 852959 852989 852997 853007 853031 
+853033 853049 853057 853079 853091 853103 853123 853133 853159 853187 853189 853211 
+853217 853241 853283 853289 853291 853319 853339 853357 853387 853403 853427 853429 
+853439 853477 853481 853493 853529 853543 853547 853571 853577 853597 853637 853663 
+853667 853669 853687 853693 853703 853717 853733 853739 853759 853763 853793 853799 
+853807 853813 853819 853823 853837 853843 853873 853889 853901 853903 853913 853933 
+853949 853969 853981 853999 854017 854033 854039 854041 854047 854053 854083 854089 
+854093 854099 854111 854123 854129 854141 854149 854159 854171 854213 854257 854263 
+854299 854303 854323 854327 854333 854351 854353 854363 854383 854387 854407 854417 
+854419 854423 854431 854443 854459 854461 854467 854479 854527 854533 854569 854587 
+854593 854599 854617 854621 854629 854647 854683 854713 854729 854747 854771 854801 
+854807 854849 854869 854881 854897 854899 854921 854923 854927 854929 854951 854957 
+854963 854993 854999 855031 855059 855061 855067 855079 855089 855119 855131 855143 
+855187 855191 855199 855203 855221 855229 855241 855269 855271 855277 855293 855307 
+855311 855317 855331 855359 855373 855377 855391 855397 855401 855419 855427 855431 
+855461 855467 855499 855511 855521 855527 855581 855601 855607 855619 855641 855667 
+855671 855683 855697 855709 855713 855719 855721 855727 855731 855733 855737 855739 
+855781 855787 855821 855851 855857 855863 855887 855889 855901 855919 855923 855937 
+855947 855983 855989 855997 856021 856043 856057 856061 856073 856081 856099 856111 
+856117 856133 856139 856147 856153 856169 856181 856187 856213 856237 856241 856249 
+856277 856279 856301 856309 856333 856343 856351 856369 856381 856391 856393 856411 
+856417 856421 856441 856459 856469 856483 856487 856507 856519 856529 856547 856549 
+856553 856567 856571 856627 856637 856649 856693 856697 856699 856703 856711 856717 
+856721 856733 856759 856787 856789 856799 856811 856813 856831 856841 856847 856853 
+856897 856901 856903 856909 856927 856939 856943 856949 856969 856993 857009 857011 
+857027 857029 857039 857047 857053 857069 857081 857083 857099 857107 857137 857161 
+857167 857201 857203 857221 857249 857267 857273 857281 857287 857309 857321 857333 
+857341 857347 857357 857369 857407 857411 857419 857431 857453 857459 857471 857513 
+857539 857551 857567 857569 857573 857579 857581 857629 857653 857663 857669 857671 
+857687 857707 857711 857713 857723 857737 857741 857743 857749 857809 857821 857827 
+857839 857851 857867 857873 857897 857903 857929 857951 857953 857957 857959 857963 
+857977 857981 858001 858029 858043 858073 858083 858101 858103 858113 858127 858149 
+858161 858167 858217 858223 858233 858239 858241 858251 858259 858269 858281 858293 
+858301 858307 858311 858317 858373 858397 858427 858433 858457 858463 858467 858479 
+858497 858503 858527 858563 858577 858589 858623 858631 858673 858691 858701 858707 
+858709 858713 858749 858757 858763 858769 858787 858817 858821 858833 858841 858859 
+858877 858883 858899 858911 858919 858931 858943 858953 858961 858989 858997 859003 
+859031 859037 859049 859051 859057 859081 859091 859093 859109 859121 859181 859189 
+859213 859223 859249 859259 859267 859273 859277 859279 859297 859321 859361 859363 
+859373 859381 859393 859423 859433 859447 859459 859477 859493 859513 859553 859559 
+859561 859567 859577 859601 859603 859609 859619 859633 859657 859667 859669 859679 
+859681 859697 859709 859751 859783 859787 859799 859801 859823 859841 859849 859853 
+859861 859891 859913 859919 859927 859933 859939 859973 859981 859987 860009 860011 
+860029 860051 860059 860063 860071 860077 860087 860089 860107 860113 860117 860143 
+860239 860257 860267 860291 860297 860309 860311 860317 860323 860333 860341 860351 
+860357 860369 860381 860383 860393 860399 860413 860417 860423 860441 860479 860501 
+860507 860513 860533 860543 860569 860579 860581 860593 860599 860609 860623 860641 
+860647 860663 860689 860701 860747 860753 860759 860779 860789 860791 860809 860813 
+860819 860843 860861 860887 860891 860911 860917 860921 860927 860929 860939 860941 
+860957 860969 860971 861001 861013 861019 861031 861037 861043 861053 861059 861079 
+861083 861089 861109 861121 861131 861139 861163 861167 861191 861199 861221 861239 
+861293 861299 861317 861347 861353 861361 861391 861433 861437 861439 861491 861493 
+861499 861541 861547 861551 861559 861563 861571 861589 861599 861613 861617 861647 
+861659 861691 861701 861703 861719 861733 861739 861743 861761 861797 861799 861803 
+861823 861829 861853 861857 861871 861877 861881 861899 861901 861907 861929 861937 
+861941 861947 861977 861979 861997 862009 862013 862031 862033 862061 862067 862097 
+862117 862123 862129 862139 862157 862159 862171 862177 862181 862187 862207 862219 
+862229 862231 862241 862249 862259 862261 862273 862283 862289 862297 862307 862319 
+862331 862343 862369 862387 862397 862399 862409 862417 862423 862441 862447 862471 
+862481 862483 862487 862493 862501 862541 862553 862559 862567 862571 862573 862583 
+862607 862627 862633 862649 862651 862669 862703 862727 862739 862769 862777 862783 
+862789 862811 862819 862861 862879 862907 862909 862913 862919 862921 862943 862957 
+862973 862987 862991 862997 863003 863017 863047 863081 863087 863119 863123 863131 
+863143 863153 863179 863197 863231 863251 863279 863287 863299 863309 863323 863363 
+863377 863393 863479 863491 863497 863509 863521 863537 863539 863561 863593 863609 
+863633 863641 863671 863689 863693 863711 863729 863743 863749 863767 863771 863783 
+863801 863803 863833 863843 863851 863867 863869 863879 863887 863897 863899 863909 
+863917 863921 863959 863983 864007 864011 864013 864029 864037 864047 864049 864053 
+864077 864079 864091 864103 864107 864119 864121 864131 864137 864151 864167 864169 
+864191 864203 864211 864221 864223 864251 864277 864289 864299 864301 864307 864319 
+864323 864341 864359 864361 864379 864407 864419 864427 864439 864449 864491 864503 
+864509 864511 864533 864541 864551 864581 864583 864587 864613 864623 864629 864631 
+864641 864673 864679 864691 864707 864733 864737 864757 864781 864793 864803 864811 
+864817 864883 864887 864901 864911 864917 864947 864953 864959 864967 864979 864989 
+865001 865003 865043 865049 865057 865061 865069 865087 865091 865103 865121 865153 
+865159 865177 865201 865211 865213 865217 865231 865247 865253 865259 865261 865301 
+865307 865313 865321 865327 865339 865343 865349 865357 865363 865379 865409 865457 
+865477 865481 865483 865493 865499 865511 865537 865577 865591 865597 865609 865619 
+865637 865639 865643 865661 865681 865687 865717 865721 865729 865741 865747 865751 
+865757 865769 865771 865783 865801 865807 865817 865819 865829 865847 865859 865867 
+865871 865877 865889 865933 865937 865957 865979 865993 866003 866009 866011 866029 
+866051 866053 866057 866081 866083 866087 866093 866101 866119 866123 866161 866183 
+866197 866213 866221 866231 866279 866293 866309 866311 866329 866353 866389 866399 
+866417 866431 866443 866461 866471 866477 866513 866519 866573 866581 866623 866629 
+866639 866641 866653 866683 866689 866693 866707 866713 866717 866737 866743 866759 
+866777 866783 866819 866843 866849 866851 866857 866869 866909 866917 866927 866933 
+866941 866953 866963 866969 867001 867007 867011 867023 867037 867059 867067 867079 
+867091 867121 867131 867143 867151 867161 867173 867203 867211 867227 867233 867253 
+867257 867259 867263 867271 867281 867301 867319 867337 867343 867371 867389 867397 
+867401 867409 867413 867431 867443 867457 867463 867467 867487 867509 867511 867541 
+867547 867553 867563 867571 867577 867589 867617 867619 867623 867631 867641 867653 
+867677 867679 867689 867701 867719 867733 867743 867773 867781 867793 867803 867817 
+867827 867829 867857 867871 867887 867913 867943 867947 867959 867991 868019 868033 
+868039 868051 868069 868073 868081 868103 868111 868121 868123 868151 868157 868171 
+868177 868199 868211 868229 868249 868267 868271 868277 868291 868313 868327 868331 
+868337 868349 868369 868379 868381 868397 868409 868423 868451 868453 868459 868487 
+868489 868493 868529 868531 868537 868559 868561 868577 868583 868603 868613 868639 
+868663 868669 868691 868697 868727 868739 868741 868771 868783 868787 868793 868799 
+868801 868817 868841 868849 868867 868873 868877 868883 868891 868909 868937 868939 
+868943 868951 868957 868993 868997 868999 869017 869021 869039 869053 869059 869069 
+869081 869119 869131 869137 869153 869173 869179 869203 869233 869249 869251 869257 
+869273 869291 869293 869299 869303 869317 869321 869339 869369 869371 869381 869399 
+869413 869419 869437 869443 869461 869467 869471 869489 869501 869521 869543 869551 
+869563 869579 869587 869597 869599 869657 869663 869683 869689 869707 869717 869747 
+869753 869773 869777 869779 869807 869809 869819 869849 869863 869879 869887 869893 
+869899 869909 869927 869951 869959 869983 869989 870007 870013 870031 870047 870049 
+870059 870083 870097 870109 870127 870131 870137 870151 870161 870169 870173 870197 
+870211 870223 870229 870239 870241 870253 870271 870283 870301 870323 870329 870341 
+870367 870391 870403 870407 870413 870431 870433 870437 870461 870479 870491 870497 
+870517 870533 870547 870577 870589 870593 870601 870613 870629 870641 870643 870679 
+870691 870703 870731 870739 870743 870773 870787 870809 870811 870823 870833 870847 
+870853 870871 870889 870901 870907 870911 870917 870929 870931 870953 870967 870977 
+870983 870997 871001 871021 871027 871037 871061 871103 871147 871159 871163 871177 
+871181 871229 871231 871249 871259 871271 871289 871303 871337 871349 871393 871439 
+871459 871463 871477 871513 871517 871531 871553 871571 871589 871597 871613 871621 
+871639 871643 871649 871657 871679 871681 871687 871727 871763 871771 871789 871817 
+871823 871837 871867 871883 871901 871919 871931 871957 871963 871973 871987 871993 
+872017 872023 872033 872041 872057 872071 872077 872089 872099 872107 872129 872141 
+872143 872149 872159 872161 872173 872177 872189 872203 872227 872231 872237 872243 
+872251 872257 872269 872281 872317 872323 872351 872353 872369 872381 872383 872387 
+872393 872411 872419 872429 872437 872441 872453 872471 872477 872479 872533 872549 
+872561 872563 872567 872587 872609 872611 872621 872623 872647 872657 872659 872671 
+872687 872731 872737 872747 872749 872761 872789 872791 872843 872863 872923 872947 
+872951 872953 872959 872999 873017 873043 873049 873073 873079 873083 873091 873109 
+873113 873121 873133 873139 873157 873209 873247 873251 873263 873293 873317 873319 
+873331 873343 873349 873359 873403 873407 873419 873421 873427 873437 873461 873463 
+873469 873497 873527 873529 873539 873541 873553 873569 873571 873617 873619 873641 
+873643 873659 873667 873671 873689 873707 873709 873721 873727 873739 873767 873773 
+873781 873787 873863 873877 873913 873959 873979 873989 873991 874001 874009 874037 
+874063 874087 874091 874099 874103 874109 874117 874121 874127 874151 874193 874213 
+874217 874229 874249 874267 874271 874277 874301 874303 874331 874337 874343 874351 
+874373 874387 874397 874403 874409 874427 874457 874459 874477 874487 874537 874543 
+874547 874567 874583 874597 874619 874637 874639 874651 874661 874673 874681 874693 
+874697 874711 874721 874723 874729 874739 874763 874771 874777 874799 874807 874813 
+874823 874831 874847 874859 874873 874879 874889 874891 874919 874957 874967 874987 
+875011 875027 875033 875089 875107 875113 875117 875129 875141 875183 875201 875209 
+875213 875233 875239 875243 875261 875263 875267 875269 875297 875299 875317 875323 
+875327 875333 875339 875341 875363 875377 875389 875393 875417 875419 875429 875443 
+875447 875477 875491 875503 875509 875513 875519 875521 875543 875579 875591 875593 
+875617 875621 875627 875629 875647 875659 875663 875681 875683 875689 875701 875711 
+875717 875731 875741 875759 875761 875773 875779 875783 875803 875821 875837 875851 
+875893 875923 875929 875933 875947 875969 875981 875983 876011 876013 876017 876019 
+876023 876041 876067 876077 876079 876097 876103 876107 876121 876131 876137 876149 
+876181 876191 876193 876199 876203 876229 876233 876257 876263 876287 876301 876307 
+876311 876329 876331 876341 876349 876371 876373 876431 876433 876443 876479 876481 
+876497 876523 876529 876569 876581 876593 876607 876611 876619 876643 876647 876653 
+876661 876677 876719 876721 876731 876749 876751 876761 876769 876787 876791 876797 
+876817 876823 876833 876851 876853 876871 876893 876913 876929 876947 876971 877003 
+877027 877043 877057 877073 877091 877109 877111 877117 877133 877169 877181 877187 
+877199 877213 877223 877237 877267 877291 877297 877301 877313 877321 877333 877343 
+877351 877361 877367 877379 877397 877399 877403 877411 877423 877463 877469 877531 
+877543 877567 877573 877577 877601 877609 877619 877621 877651 877661 877699 877739 
+877771 877783 877817 877823 877837 877843 877853 877867 877871 877873 877879 877883 
+877907 877909 877937 877939 877949 877997 878011 878021 878023 878039 878041 878077 
+878083 878089 878099 878107 878113 878131 878147 878153 878159 878167 878173 878183 
+878191 878197 878201 878221 878239 878279 878287 878291 878299 878309 878359 878377 
+878387 878411 878413 878419 878443 878453 878467 878489 878513 878539 878551 878567 
+878573 878593 878597 878609 878621 878629 878641 878651 878659 878663 878677 878681 
+878699 878719 878737 878743 878749 878777 878783 878789 878797 878821 878831 878833 
+878837 878851 878863 878869 878873 878893 878929 878939 878953 878957 878987 878989 
+879001 879007 879023 879031 879061 879089 879097 879103 879113 879119 879133 879143 
+879167 879169 879181 879199 879227 879239 879247 879259 879269 879271 879283 879287 
+879299 879331 879341 879343 879353 879371 879391 879401 879413 879449 879457 879493 
+879523 879533 879539 879553 879581 879583 879607 879617 879623 879629 879649 879653 
+879661 879667 879673 879679 879689 879691 879701 879707 879709 879713 879721 879743 
+879797 879799 879817 879821 879839 879859 879863 879881 879917 879919 879941 879953 
+879961 879973 879979 880001 880007 880021 880027 880031 880043 880057 880067 880069 
+880091 880097 880109 880127 880133 880151 880153 880199 880211 880219 880223 880247 
+880249 880259 880283 880301 880303 880331 880337 880343 880349 880361 880367 880409 
+880421 880423 880427 880483 880487 880513 880519 880531 880541 880543 880553 880559 
+880571 880573 880589 880603 880661 880667 880673 880681 880687 880699 880703 880709 
+880723 880727 880729 880751 880793 880799 880801 880813 880819 880823 880853 880861 
+880871 880883 880903 880907 880909 880939 880949 880951 880961 880981 880993 881003 
+881009 881017 881029 881057 881071 881077 881099 881119 881141 881143 881147 881159 
+881171 881173 881191 881197 881207 881219 881233 881249 881269 881273 881311 881317 
+881327 881333 881351 881357 881369 881393 881407 881411 881417 881437 881449 881471 
+881473 881477 881479 881509 881527 881533 881537 881539 881591 881597 881611 881641 
+881663 881669 881681 881707 881711 881729 881743 881779 881813 881833 881849 881897 
+881899 881911 881917 881939 881953 881963 881983 881987 882017 882019 882029 882031 
+882047 882061 882067 882071 882083 882103 882139 882157 882169 882173 882179 882187 
+882199 882239 882241 882247 882251 882253 882263 882289 882313 882359 882367 882377 
+882389 882391 882433 882439 882449 882451 882461 882481 882491 882517 882529 882551 
+882571 882577 882587 882593 882599 882617 882631 882653 882659 882697 882701 882703 
+882719 882727 882733 882751 882773 882779 882823 882851 882863 882877 882881 882883 
+882907 882913 882923 882943 882953 882961 882967 882979 883013 883049 883061 883073 
+883087 883093 883109 883111 883117 883121 883163 883187 883193 883213 883217 883229 
+883231 883237 883241 883247 883249 883273 883279 883307 883327 883331 883339 883343 
+883357 883391 883397 883409 883411 883423 883429 883433 883451 883471 883483 883489 
+883517 883537 883549 883577 883579 883613 883621 883627 883639 883661 883667 883691 
+883697 883699 883703 883721 883733 883739 883763 883777 883781 883783 883807 883871 
+883877 883889 883921 883933 883963 883969 883973 883979 883991 884003 884011 884029 
+884057 884069 884077 884087 884111 884129 884131 884159 884167 884171 884183 884201 
+884227 884231 884243 884251 884267 884269 884287 884293 884309 884311 884321 884341 
+884353 884363 884369 884371 884417 884423 884437 884441 884453 884483 884489 884491 
+884497 884501 884537 884573 884579 884591 884593 884617 884651 884669 884693 884699 
+884717 884743 884789 884791 884803 884813 884827 884831 884857 884881 884899 884921 
+884951 884959 884977 884981 884987 884999 885023 885041 885061 885083 885091 885097 
+885103 885107 885127 885133 885161 885163 885169 885187 885217 885223 885233 885239 
+885251 885257 885263 885289 885301 885307 885331 885359 885371 885383 885389 885397 
+885403 885421 885427 885449 885473 885487 885497 885503 885509 885517 885529 885551 
+885553 885589 885607 885611 885623 885679 885713 885721 885727 885733 885737 885769 
+885791 885793 885803 885811 885821 885823 885839 885869 885881 885883 885889 885893 
+885919 885923 885931 885943 885947 885959 885961 885967 885971 885977 885991 886007 
+886013 886019 886021 886031 886043 886069 886097 886117 886129 886163 886177 886181 
+886183 886189 886199 886241 886243 886247 886271 886283 886307 886313 886337 886339 
+886349 886367 886381 886387 886421 886427 886429 886433 886453 886463 886469 886471 
+886493 886511 886517 886519 886537 886541 886547 886549 886583 886591 886607 886609 
+886619 886643 886651 886663 886667 886741 886747 886751 886759 886777 886793 886799 
+886807 886819 886859 886867 886891 886909 886913 886967 886969 886973 886979 886981 
+886987 886993 886999 887017 887057 887059 887069 887093 887101 887113 887141 887143 
+887153 887171 887177 887191 887203 887233 887261 887267 887269 887291 887311 887323 
+887333 887377 887387 887399 887401 887423 887441 887449 887459 887479 887483 887503 
+887533 887543 887567 887569 887573 887581 887599 887617 887629 887633 887641 887651 
+887657 887659 887669 887671 887681 887693 887701 887707 887717 887743 887749 887759 
+887819 887827 887837 887839 887849 887867 887903 887911 887921 887923 887941 887947 
+887987 887989 888001 888011 888047 888059 888061 888077 888091 888103 888109 888133 
+888143 888157 888161 888163 888179 888203 888211 888247 888257 888263 888271 888287 
+888313 888319 888323 888359 888361 888373 888389 888397 888409 888413 888427 888431 
+888443 888451 888457 888469 888479 888493 888499 888533 888541 888557 888623 888631 
+888637 888653 888659 888661 888683 888689 888691 888721 888737 888751 888761 888773 
+888779 888781 888793 888799 888809 888827 888857 888869 888871 888887 888917 888919 
+888931 888959 888961 888967 888983 888989 888997 889001 889027 889037 889039 889043 
+889051 889069 889081 889087 889123 889139 889171 889177 889211 889237 889247 889261 
+889271 889279 889289 889309 889313 889327 889337 889349 889351 889363 889367 889373 
+889391 889411 889429 889439 889453 889481 889489 889501 889519 889579 889589 889597 
+889631 889639 889657 889673 889687 889697 889699 889703 889727 889747 889769 889783 
+889829 889871 889873 889877 889879 889891 889901 889907 889909 889921 889937 889951 
+889957 889963 889997 890003 890011 890027 890053 890063 890083 890107 890111 890117 
+890119 890129 890147 890159 890161 890177 890221 890231 890237 890287 890291 890303 
+890317 890333 890371 890377 890419 890429 890437 890441 890459 890467 890501 890531 
+890543 890551 890563 890597 890609 890653 890657 890671 890683 890707 890711 890717 
+890737 890761 890789 890797 890803 890809 890821 890833 890843 890861 890863 890867 
+890881 890887 890893 890927 890933 890941 890957 890963 890969 890993 890999 891001 
+891017 891047 891049 891061 891067 891091 891101 891103 891133 891151 891161 891173 
+891179 891223 891239 891251 891277 891287 891311 891323 891329 891349 891377 891379 
+891389 891391 891409 891421 891427 891439 891481 891487 891491 891493 891509 891521 
+891523 891551 891557 891559 891563 891571 891577 891587 891593 891601 891617 891629 
+891643 891647 891659 891661 891677 891679 891707 891743 891749 891763 891767 891797 
+891799 891809 891817 891823 891827 891829 891851 891859 891887 891889 891893 891899 
+891907 891923 891929 891967 891983 891991 891997 892019 892027 892049 892057 892079 
+892091 892093 892097 892103 892123 892141 892153 892159 892169 892189 892219 892237 
+892249 892253 892261 892267 892271 892291 892321 892351 892357 892387 892391 892421 
+892433 892439 892457 892471 892481 892513 892523 892531 892547 892553 892559 892579 
+892597 892603 892609 892627 892643 892657 892663 892667 892709 892733 892747 892757 
+892763 892777 892781 892783 892817 892841 892849 892861 892877 892901 892919 892933 
+892951 892973 892987 892999 893003 893023 893029 893033 893041 893051 893059 893093 
+893099 893107 893111 893117 893119 893131 893147 893149 893161 893183 893213 893219 
+893227 893237 893257 893261 893281 893317 893339 893341 893351 893359 893363 893381 
+893383 893407 893413 893419 893429 893441 893449 893479 893489 893509 893521 893549 
+893567 893591 893603 893609 893653 893657 893671 893681 893701 893719 893723 893743 
+893777 893797 893821 893839 893857 893863 893873 893881 893897 893903 893917 893929 
+893933 893939 893989 893999 894011 894037 894059 894067 894073 894097 894109 894119 
+894137 894139 894151 894161 894167 894181 894191 894193 894203 894209 894211 894221 
+894227 894233 894239 894247 894259 894277 894281 894287 894301 894329 894343 894371 
+894391 894403 894407 894409 894419 894427 894431 894449 894451 894503 894511 894521 
+894527 894541 894547 894559 894581 894589 894611 894613 894637 894643 894667 894689 
+894709 894713 894721 894731 894749 894763 894779 894791 894793 894811 894869 894871 
+894893 894917 894923 894947 894973 894997 895003 895007 895009 895039 895049 895051 
+895079 895087 895127 895133 895151 895157 895159 895171 895189 895211 895231 895241 
+895243 895247 895253 895277 895283 895291 895309 895313 895319 895333 895343 895351 
+895357 895361 895387 895393 895421 895423 895457 895463 895469 895471 895507 895529 
+895553 895571 895579 895591 895613 895627 895633 895649 895651 895667 895669 895673 
+895681 895691 895703 895709 895721 895729 895757 895771 895777 895787 895789 895799 
+895801 895813 895823 895841 895861 895879 895889 895901 895903 895913 895927 895933 
+895957 895987 896003 896009 896047 896069 896101 896107 896111 896113 896123 896143 
+896167 896191 896201 896263 896281 896293 896297 896299 896323 896327 896341 896347 
+896353 896369 896381 896417 896443 896447 896449 896453 896479 896491 896509 896521 
+896531 896537 896543 896549 896557 896561 896573 896587 896617 896633 896647 896669 
+896677 896681 896717 896719 896723 896771 896783 896803 896837 896867 896879 896897 
+896921 896927 896947 896953 896963 896983 897007 897011 897019 897049 897053 897059 
+897067 897077 897101 897103 897119 897133 897137 897157 897163 897191 897223 897229 
+897241 897251 897263 897269 897271 897301 897307 897317 897319 897329 897349 897359 
+897373 897401 897433 897443 897461 897467 897469 897473 897497 897499 897517 897527 
+897553 897557 897563 897571 897577 897581 897593 897601 897607 897629 897647 897649 
+897671 897691 897703 897707 897709 897727 897751 897779 897781 897817 897829 897847 
+897877 897881 897887 897899 897907 897931 897947 897971 897983 898013 898019 898033 
+898063 898067 898069 898091 898097 898109 898129 898133 898147 898153 898171 898181 
+898189 898199 898211 898213 898223 898231 898241 898243 898253 898259 898279 898283 
+898291 898307 898319 898327 898361 898369 898409 898421 898423 898427 898439 898459 
+898477 898481 898483 898493 898519 898523 898543 898549 898553 898561 898607 898613 
+898621 898661 898663 898669 898673 898691 898717 898727 898753 898763 898769 898787 
+898813 898819 898823 898853 898867 898873 898889 898897 898921 898927 898951 898981 
+898987 899009 899051 899057 899069 899123 899149 899153 899159 899161 899177 899179 
+899183 899189 899209 899221 899233 899237 899263 899273 899291 899309 899321 899387 
+899401 899413 899429 899447 899467 899473 899477 899491 899519 899531 899537 899611 
+899617 899659 899671 899681 899687 899693 899711 899719 899749 899753 899761 899779 
+899791 899807 899831 899849 899851 899863 899881 899891 899893 899903 899917 899939 
+899971 899981 900001 900007 900019 900037 900061 900089 900091 900103 900121 900139 
+900143 900149 900157 900161 900169 900187 900217 900233 900241 900253 900259 900283 
+900287 900293 900307 900329 900331 900349 900397 900409 900443 900461 900481 900491 
+900511 900539 900551 900553 900563 900569 900577 900583 900587 900589 900593 900607 
+900623 900649 900659 900671 900673 900689 900701 900719 900737 900743 900751 900761 
+900763 900773 900797 900803 900817 900821 900863 900869 900917 900929 900931 900937 
+900959 900971 900973 900997 901007 901009 901013 901063 901067 901079 901093 901097 
+901111 901133 901141 901169 901171 901177 901183 901193 901207 901211 901213 901247 
+901249 901253 901273 901279 901309 901333 901339 901367 901399 901403 901423 901427 
+901429 901441 901447 901451 901457 901471 901489 901499 901501 901513 901517 901529 
+901547 901567 901591 901613 901643 901657 901679 901687 901709 901717 901739 901741 
+901751 901781 901787 901811 901819 901841 901861 901891 901907 901909 901919 901931 
+901937 901963 901973 901993 901997 902009 902017 902029 902039 902047 902053 902087 
+902089 902119 902137 902141 902179 902191 902201 902227 902261 902263 902281 902299 
+902303 902311 902333 902347 902351 902357 902389 902401 902413 902437 902449 902471 
+902477 902483 902501 902507 902521 902563 902569 902579 902591 902597 902599 902611 
+902639 902653 902659 902669 902677 902687 902719 902723 902753 902761 902767 902771 
+902777 902789 902807 902821 902827 902849 902873 902903 902933 902953 902963 902971 
+902977 902981 902987 903017 903029 903037 903073 903079 903103 903109 903143 903151 
+903163 903179 903197 903211 903223 903251 903257 903269 903311 903323 903337 903347 
+903359 903367 903389 903391 903403 903407 903421 903443 903449 903451 903457 903479 
+903493 903527 903541 903547 903563 903569 903607 903613 903641 903649 903673 903677 
+903691 903701 903709 903751 903757 903761 903781 903803 903827 903841 903871 903883 
+903899 903913 903919 903949 903967 903979 904019 904027 904049 904067 904069 904073 
+904087 904093 904097 904103 904117 904121 904147 904157 904181 904193 904201 904207 
+904217 904219 904261 904283 904289 904297 904303 904357 904361 904369 904399 904441 
+904459 904483 904489 904499 904511 904513 904517 904523 904531 904559 904573 904577 
+904601 904619 904627 904633 904637 904643 904661 904663 904667 904679 904681 904693 
+904697 904721 904727 904733 904759 904769 904777 904781 904789 904793 904801 904811 
+904823 904847 904861 904867 904873 904879 904901 904903 904907 904919 904931 904933 
+904987 904997 904999 905011 905053 905059 905071 905083 905087 905111 905123 905137 
+905143 905147 905161 905167 905171 905189 905197 905207 905209 905213 905227 905249 
+905269 905291 905297 905299 905329 905339 905347 905381 905413 905449 905453 905461 
+905477 905491 905497 905507 905551 905581 905587 905599 905617 905621 905629 905647 
+905651 905659 905677 905683 905687 905693 905701 905713 905719 905759 905761 905767 
+905783 905803 905819 905833 905843 905897 905909 905917 905923 905951 905959 905963 
+905999 906007 906011 906013 906023 906029 906043 906089 906107 906119 906121 906133 
+906179 906187 906197 906203 906211 906229 906233 906259 906263 906289 906293 906313 
+906317 906329 906331 906343 906349 906371 906377 906383 906391 906403 906421 906427 
+906431 906461 906473 906481 906487 906497 906517 906523 906539 906541 906557 906589 
+906601 906613 906617 906641 906649 906673 906679 906691 906701 906707 906713 906727 
+906749 906751 906757 906767 906779 906793 906809 906817 906823 906839 906847 906869 
+906881 906901 906911 906923 906929 906931 906943 906949 906973 907019 907021 907031 
+907063 907073 907099 907111 907133 907139 907141 907163 907169 907183 907199 907211 
+907213 907217 907223 907229 907237 907259 907267 907279 907297 907301 907321 907331 
+907363 907367 907369 907391 907393 907397 907399 907427 907433 907447 907457 907469 
+907471 907481 907493 907507 907513 907549 907561 907567 907583 907589 907637 907651 
+907657 907663 907667 907691 907693 907703 907717 907723 907727 907733 907757 907759 
+907793 907807 907811 907813 907831 907843 907849 907871 907891 907909 907913 907927 
+907957 907967 907969 907997 907999 908003 908041 908053 908057 908071 908081 908101 
+908113 908129 908137 908153 908179 908183 908197 908213 908221 908233 908249 908287 
+908317 908321 908353 908359 908363 908377 908381 908417 908419 908441 908449 908459 
+908471 908489 908491 908503 908513 908521 908527 908533 908539 908543 908549 908573 
+908581 908591 908597 908603 908617 908623 908627 908653 908669 908671 908711 908723 
+908731 908741 908749 908759 908771 908797 908807 908813 908819 908821 908849 908851 
+908857 908861 908863 908879 908881 908893 908909 908911 908927 908953 908959 908993 
+909019 909023 909031 909037 909043 909047 909061 909071 909089 909091 909107 909113 
+909119 909133 909151 909173 909203 909217 909239 909241 909247 909253 909281 909287 
+909289 909299 909301 909317 909319 909329 909331 909341 909343 909371 909379 909383 
+909401 909409 909437 909451 909457 909463 909481 909521 909529 909539 909541 909547 
+909577 909599 909611 909613 909631 909637 909679 909683 909691 909697 909731 909737 
+909743 909761 909767 909773 909787 909791 909803 909809 909829 909833 909859 909863 
+909877 909889 909899 909901 909907 909911 909917 909971 909973 909977 910003 910031 
+910051 910069 910093 910097 910099 910103 910109 910121 910127 910139 910141 910171 
+910177 910199 910201 910207 910213 910219 910229 910277 910279 910307 910361 910369 
+910421 910447 910451 910453 910457 910471 910519 910523 910561 910577 910583 910603 
+910619 910621 910627 910631 910643 910661 910691 910709 910711 910747 910751 910771 
+910781 910787 910799 910807 910817 910849 910853 910883 910909 910939 910957 910981 
+911003 911011 911023 911033 911039 911063 911077 911087 911089 911101 911111 911129 
+911147 911159 911161 911167 911171 911173 911179 911201 911219 911227 911231 911233 
+911249 911269 911291 911293 911303 911311 911321 911327 911341 911357 911359 911363 
+911371 911413 911419 911437 911453 911459 911503 911507 911527 911549 911593 911597 
+911621 911633 911657 911663 911671 911681 911683 911689 911707 911719 911723 911737 
+911749 911773 911777 911783 911819 911831 911837 911839 911851 911861 911873 911879 
+911893 911899 911903 911917 911947 911951 911957 911959 911969 912007 912031 912047 
+912049 912053 912061 912083 912089 912103 912167 912173 912187 912193 912211 912217 
+912227 912239 912251 912269 912287 912337 912343 912349 912367 912391 912397 912403 
+912409 912413 912449 912451 912463 912467 912469 912481 912487 912491 912497 912511 
+912521 912523 912533 912539 912559 912581 912631 912647 912649 912727 912763 912773 
+912797 912799 912809 912823 912829 912839 912851 912853 912859 912869 912871 912911 
+912929 912941 912953 912959 912971 912973 912979 912991 913013 913027 913037 913039 
+913063 913067 913103 913139 913151 913177 913183 913217 913247 913259 913279 913309 
+913321 913327 913331 913337 913373 913397 913417 913421 913433 913441 913447 913457 
+913483 913487 913513 913571 913573 913579 913589 913637 913639 913687 913709 913723 
+913739 913753 913771 913799 913811 913853 913873 913889 913907 913921 913933 913943 
+913981 913999 914021 914027 914041 914047 914117 914131 914161 914189 914191 914213 
+914219 914237 914239 914257 914269 914279 914293 914321 914327 914339 914351 914357 
+914359 914363 914369 914371 914429 914443 914449 914461 914467 914477 914491 914513 
+914519 914521 914533 914561 914569 914579 914581 914591 914597 914609 914611 914629 
+914647 914657 914701 914713 914723 914731 914737 914777 914783 914789 914791 914801 
+914813 914819 914827 914843 914857 914861 914867 914873 914887 914891 914897 914941 
+914951 914971 914981 915007 915017 915029 915041 915049 915053 915067 915071 915113 
+915139 915143 915157 915181 915191 915197 915199 915203 915221 915223 915247 915251 
+915253 915259 915283 915301 915311 915353 915367 915379 915391 915437 915451 915479 
+915487 915527 915533 915539 915547 915557 915587 915589 915601 915611 915613 915623 
+915631 915641 915659 915683 915697 915703 915727 915731 915737 915757 915763 915769 
+915799 915839 915851 915869 915881 915911 915917 915919 915947 915949 915961 915973 
+915991 916031 916033 916049 916057 916061 916073 916099 916103 916109 916121 916127 
+916129 916141 916169 916177 916183 916187 916189 916213 916217 916219 916259 916261 
+916273 916291 916319 916337 916339 916361 916367 916387 916411 916417 916441 916451 
+916457 916463 916469 916471 916477 916501 916507 916511 916537 916561 916571 916583 
+916613 916621 916633 916649 916651 916679 916703 916733 916771 916781 916787 916831 
+916837 916841 916859 916871 916879 916907 916913 916931 916933 916939 916961 916973 
+916999 917003 917039 917041 917051 917053 917083 917089 917093 917101 917113 917117 
+917123 917141 917153 917159 917173 917179 917209 917219 917227 917237 917239 917243 
+917251 917281 917291 917317 917327 917333 917353 917363 917381 917407 917443 917459 
+917461 917471 917503 917513 917519 917549 917557 917573 917591 917593 917611 917617 
+917629 917633 917641 917659 917669 917687 917689 917713 917729 917737 917753 917759 
+917767 917771 917773 917783 917789 917803 917809 917827 917831 917837 917843 917849 
+917869 917887 917893 917923 917927 917951 917971 917993 918011 918019 918041 918067 
+918079 918089 918103 918109 918131 918139 918143 918149 918157 918161 918173 918193 
+918199 918209 918223 918257 918259 918263 918283 918301 918319 918329 918341 918347 
+918353 918361 918371 918389 918397 918431 918433 918439 918443 918469 918481 918497 
+918529 918539 918563 918581 918583 918587 918613 918641 918647 918653 918677 918679 
+918683 918733 918737 918751 918763 918767 918779 918787 918793 918823 918829 918839 
+918857 918877 918889 918899 918913 918943 918947 918949 918959 918971 918989 919013 
+919019 919021 919031 919033 919063 919067 919081 919109 919111 919129 919147 919153 
+919169 919183 919189 919223 919229 919231 919249 919253 919267 919301 919313 919319 
+919337 919349 919351 919381 919393 919409 919417 919421 919423 919427 919447 919511 
+919519 919531 919559 919571 919591 919613 919621 919631 919679 919691 919693 919703 
+919729 919757 919759 919769 919781 919799 919811 919817 919823 919859 919871 919883 
+919901 919903 919913 919927 919937 919939 919949 919951 919969 919979 920011 920021 
+920039 920053 920107 920123 920137 920147 920149 920167 920197 920201 920203 920209 
+920219 920233 920263 920267 920273 920279 920281 920291 920323 920333 920357 920371 
+920377 920393 920399 920407 920411 920419 920441 920443 920467 920473 920477 920497 
+920509 920519 920539 920561 920609 920641 920651 920653 920677 920687 920701 920707 
+920729 920741 920743 920753 920761 920783 920789 920791 920807 920827 920833 920849 
+920863 920869 920891 920921 920947 920951 920957 920963 920971 920999 921001 921007 
+921013 921029 921031 921073 921079 921091 921121 921133 921143 921149 921157 921169 
+921191 921197 921199 921203 921223 921233 921241 921257 921259 921287 921293 921331 
+921353 921373 921379 921407 921409 921457 921463 921467 921491 921497 921499 921517 
+921523 921563 921581 921589 921601 921611 921629 921637 921643 921647 921667 921677 
+921703 921733 921737 921743 921749 921751 921761 921779 921787 921821 921839 921841 
+921871 921887 921889 921901 921911 921913 921919 921931 921959 921989 922021 922027 
+922037 922039 922043 922057 922067 922069 922073 922079 922081 922087 922099 922123 
+922169 922211 922217 922223 922237 922247 922261 922283 922289 922291 922303 922309 
+922321 922331 922333 922351 922357 922367 922391 922423 922451 922457 922463 922487 
+922489 922499 922511 922513 922517 922531 922549 922561 922601 922613 922619 922627 
+922631 922637 922639 922643 922667 922679 922681 922699 922717 922729 922739 922741 
+922781 922807 922813 922853 922861 922897 922907 922931 922973 922993 923017 923023 
+923029 923047 923051 923053 923107 923123 923129 923137 923141 923147 923171 923177 
+923179 923183 923201 923203 923227 923233 923239 923249 923309 923311 923333 923341 
+923347 923369 923371 923387 923399 923407 923411 923437 923441 923449 923453 923467 
+923471 923501 923509 923513 923539 923543 923551 923561 923567 923579 923581 923591 
+923599 923603 923617 923641 923653 923687 923693 923701 923711 923719 923743 923773 
+923789 923809 923833 923849 923851 923861 923869 923903 923917 923929 923939 923947 
+923953 923959 923963 923971 923977 923983 923987 924019 924023 924031 924037 924041 
+924043 924059 924073 924083 924097 924101 924109 924139 924151 924173 924191 924197 
+924241 924269 924281 924283 924299 924323 924337 924359 924361 924383 924397 924401 
+924403 924419 924421 924431 924437 924463 924493 924499 924503 924523 924527 924529 
+924551 924557 924601 924617 924641 924643 924659 924661 924683 924697 924709 924713 
+924719 924727 924731 924743 924751 924757 924769 924773 924779 924793 924809 924811 
+924827 924829 924841 924871 924877 924881 924907 924929 924961 924967 924997 925019 
+925027 925033 925039 925051 925063 925073 925079 925081 925087 925097 925103 925109 
+925117 925121 925147 925153 925159 925163 925181 925189 925193 925217 925237 925241 
+925271 925273 925279 925291 925307 925339 925349 925369 925373 925387 925391 925399 
+925409 925423 925447 925469 925487 925499 925501 925513 925517 925523 925559 925577 
+925579 925597 925607 925619 925621 925637 925649 925663 925669 925679 925697 925721 
+925733 925741 925783 925789 925823 925831 925843 925849 925891 925901 925913 925921 
+925937 925943 925949 925961 925979 925987 925997 926017 926027 926033 926077 926087 
+926089 926099 926111 926113 926129 926131 926153 926161 926171 926179 926183 926203 
+926227 926239 926251 926273 926293 926309 926327 926351 926353 926357 926377 926389 
+926399 926411 926423 926437 926461 926467 926489 926503 926507 926533 926537 926557 
+926561 926567 926581 926587 926617 926623 926633 926657 926659 926669 926671 926689 
+926701 926707 926741 926747 926767 926777 926797 926803 926819 926843 926851 926867 
+926879 926899 926903 926921 926957 926963 926971 926977 926983 927001 927007 927013 
+927049 927077 927083 927089 927097 927137 927149 927161 927167 927187 927191 927229 
+927233 927259 927287 927301 927313 927317 927323 927361 927373 927397 927403 927431 
+927439 927491 927497 927517 927529 927533 927541 927557 927569 927587 927629 927631 
+927643 927649 927653 927671 927677 927683 927709 927727 927743 927763 927769 927779 
+927791 927803 927821 927833 927841 927847 927853 927863 927869 927961 927967 927973 
+928001 928043 928051 928063 928079 928097 928099 928111 928139 928141 928153 928157 
+928159 928163 928177 928223 928231 928253 928267 928271 928273 928289 928307 928313 
+928331 928337 928351 928399 928409 928423 928427 928429 928453 928457 928463 928469 
+928471 928513 928547 928559 928561 928597 928607 928619 928621 928637 928643 928649 
+928651 928661 928679 928699 928703 928769 928771 928787 928793 928799 928813 928817 
+928819 928849 928859 928871 928883 928903 928913 928927 928933 928979 929003 929009 
+929011 929023 929029 929051 929057 929059 929063 929069 929077 929083 929087 929113 
+929129 929141 929153 929161 929171 929197 929207 929209 929239 929251 929261 929281 
+929293 929303 929311 929323 929333 929381 929389 929393 929399 929417 929419 929431 
+929459 929483 929497 929501 929507 929527 929549 929557 929561 929573 929581 929587 
+929609 929623 929627 929629 929639 929641 929647 929671 929693 929717 929737 929741 
+929743 929749 929777 929791 929807 929809 929813 929843 929861 929869 929881 929891 
+929897 929941 929953 929963 929977 929983 930011 930043 930071 930073 930077 930079 
+930089 930101 930113 930119 930157 930173 930179 930187 930191 930197 930199 930211 
+930229 930269 930277 930283 930287 930289 930301 930323 930337 930379 930389 930409 
+930437 930467 930469 930481 930491 930499 930509 930547 930551 930569 930571 930583 
+930593 930617 930619 930637 930653 930667 930689 930707 930719 930737 930749 930763 
+930773 930779 930817 930827 930841 930847 930859 930863 930889 930911 930931 930973 
+930977 930989 930991 931003 931013 931067 931087 931097 931123 931127 931129 931153 
+931163 931169 931181 931193 931199 931213 931237 931241 931267 931289 931303 931309 
+931313 931319 931351 931363 931387 931417 931421 931487 931499 931517 931529 931537 
+931543 931571 931573 931577 931597 931621 931639 931657 931691 931709 931727 931729 
+931739 931747 931751 931757 931781 931783 931789 931811 931837 931849 931859 931873 
+931877 931883 931901 931907 931913 931921 931933 931943 931949 931967 931981 931999 
+932003 932021 932039 932051 932081 932101 932117 932119 932131 932149 932153 932177 
+932189 932203 932207 932209 932219 932221 932227 932231 932257 932303 932317 932333 
+932341 932353 932357 932413 932417 932419 932431 932441 932447 932471 932473 932483 
+932497 932513 932521 932537 932549 932557 932563 932567 932579 932587 932593 932597 
+932609 932647 932651 932663 932677 932681 932683 932749 932761 932779 932783 932801 
+932803 932819 932839 932863 932879 932887 932917 932923 932927 932941 932947 932951 
+932963 932969 932983 932999 933001 933019 933047 933059 933061 933067 933073 933151 
+933157 933173 933199 933209 933217 933221 933241 933259 933263 933269 933293 933301 
+933313 933319 933329 933349 933389 933397 933403 933407 933421 933433 933463 933479 
+933497 933523 933551 933553 933563 933601 933607 933613 933643 933649 933671 933677 
+933703 933707 933739 933761 933781 933787 933797 933809 933811 933817 933839 933847 
+933851 933853 933883 933893 933923 933931 933943 933949 933953 933967 933973 933979 
+934001 934009 934033 934039 934049 934051 934057 934067 934069 934079 934111 934117 
+934121 934127 934151 934159 934187 934223 934229 934243 934253 934259 934277 934291 
+934301 934319 934343 934387 934393 934399 934403 934429 934441 934463 934469 934481 
+934487 934489 934499 934517 934523 934537 934543 934547 934561 934567 934579 934597 
+934603 934607 934613 934639 934669 934673 934693 934721 934723 934733 934753 934763 
+934771 934793 934799 934811 934831 934837 934853 934861 934883 934889 934891 934897 
+934907 934909 934919 934939 934943 934951 934961 934979 934981 935003 935021 935023 
+935059 935063 935071 935093 935107 935113 935147 935149 935167 935183 935189 935197 
+935201 935213 935243 935257 935261 935303 935339 935353 935359 935377 935381 935393 
+935399 935413 935423 935443 935447 935461 935489 935507 935513 935531 935537 935581 
+935587 935591 935593 935603 935621 935639 935651 935653 935677 935687 935689 935699 
+935707 935717 935719 935761 935771 935777 935791 935813 935819 935827 935839 935843 
+935861 935899 935903 935971 935999 936007 936029 936053 936097 936113 936119 936127 
+936151 936161 936179 936181 936197 936203 936223 936227 936233 936253 936259 936281 
+936283 936311 936319 936329 936361 936379 936391 936401 936407 936413 936437 936451 
+936469 936487 936493 936499 936511 936521 936527 936539 936557 936577 936587 936599 
+936619 936647 936659 936667 936673 936679 936697 936709 936713 936731 936737 936739 
+936769 936773 936779 936797 936811 936827 936869 936889 936907 936911 936917 936919 
+936937 936941 936953 936967 937003 937007 937009 937031 937033 937049 937067 937121 
+937127 937147 937151 937171 937187 937207 937229 937231 937241 937243 937253 937331 
+937337 937351 937373 937379 937421 937429 937459 937463 937477 937481 937501 937511 
+937537 937571 937577 937589 937591 937613 937627 937633 937637 937639 937661 937663 
+937667 937679 937681 937693 937709 937721 937747 937751 937777 937789 937801 937813 
+937819 937823 937841 937847 937877 937883 937891 937901 937903 937919 937927 937943 
+937949 937969 937991 938017 938023 938027 938033 938051 938053 938057 938059 938071 
+938083 938089 938099 938107 938117 938129 938183 938207 938219 938233 938243 938251 
+938257 938263 938279 938293 938309 938323 938341 938347 938351 938359 938369 938387 
+938393 938437 938447 938453 938459 938491 938507 938533 938537 938563 938569 938573 
+938591 938611 938617 938659 938677 938681 938713 938747 938761 938803 938807 938827 
+938831 938843 938857 938869 938879 938881 938921 938939 938947 938953 938963 938969 
+938981 938983 938989 939007 939011 939019 939061 939089 939091 939109 939119 939121 
+939157 939167 939179 939181 939193 939203 939229 939247 939287 939293 939299 939317 
+939347 939349 939359 939361 939373 939377 939391 939413 939431 939439 939443 939451 
+939469 939487 939511 939551 939581 939599 939611 939613 939623 939649 939661 939677 
+939707 939713 939737 939739 939749 939767 939769 939773 939791 939793 939823 939839 
+939847 939853 939871 939881 939901 939923 939931 939971 939973 939989 939997 940001 
+940003 940019 940031 940067 940073 940087 940097 940127 940157 940169 940183 940189 
+940201 940223 940229 940241 940249 940259 940271 940279 940297 940301 940319 940327 
+940349 940351 940361 940369 940399 940403 940421 940469 940477 940483 940501 940523 
+940529 940531 940543 940547 940549 940553 940573 940607 940619 940649 940669 940691 
+940703 940721 940727 940733 940739 940759 940781 940783 940787 940801 940813 940817 
+940829 940853 940871 940879 940889 940903 940913 940921 940931 940949 940957 940981 
+940993 941009 941011 941023 941027 941041 941093 941099 941117 941119 941123 941131 
+941153 941159 941167 941179 941201 941207 941209 941221 941249 941251 941263 941267 
+941299 941309 941323 941329 941351 941359 941383 941407 941429 941441 941449 941453 
+941461 941467 941471 941489 941491 941503 941509 941513 941519 941537 941557 941561 
+941573 941593 941599 941609 941617 941641 941653 941663 941669 941671 941683 941701 
+941723 941737 941741 941747 941753 941771 941791 941813 941839 941861 941879 941903 
+941911 941929 941933 941947 941971 941981 941989 941999 942013 942017 942031 942037 
+942041 942043 942049 942061 942079 942091 942101 942113 942143 942163 942167 942169 
+942187 942199 942217 942223 942247 942257 942269 942301 942311 942313 942317 942341 
+942367 942371 942401 942433 942437 942439 942449 942479 942509 942521 942527 942541 
+942569 942577 942583 942593 942607 942637 942653 942659 942661 942691 942709 942719 
+942727 942749 942763 942779 942787 942811 942827 942847 942853 942857 942859 942869 
+942883 942889 942899 942901 942917 942943 942979 942983 943003 943009 943013 943031 
+943043 943057 943073 943079 943081 943091 943097 943127 943139 943153 943157 943183 
+943199 943213 943219 943231 943249 943273 943277 943289 943301 943303 943307 943321 
+943343 943357 943363 943367 943373 943387 943403 943409 943421 943429 943471 943477 
+943499 943511 943541 943543 943567 943571 943589 943601 943603 943637 943651 943693 
+943699 943729 943741 943751 943757 943763 943769 943777 943781 943783 943799 943801 
+943819 943837 943841 943843 943849 943871 943903 943909 943913 943931 943951 943967 
+944003 944017 944029 944039 944071 944077 944123 944137 944143 944147 944149 944161 
+944179 944191 944233 944239 944257 944261 944263 944297 944309 944329 944369 944387 
+944389 944393 944399 944417 944429 944431 944453 944467 944473 944491 944497 944519 
+944521 944527 944533 944543 944551 944561 944563 944579 944591 944609 944621 944651 
+944659 944677 944687 944689 944701 944711 944717 944729 944731 944773 944777 944803 
+944821 944833 944857 944873 944887 944893 944897 944899 944929 944953 944963 944969 
+944987 945031 945037 945059 945089 945103 945143 945151 945179 945209 945211 945227 
+945233 945289 945293 945331 945341 945349 945359 945367 945377 945389 945391 945397 
+945409 945431 945457 945463 945473 945479 945481 945521 945547 945577 945587 945589 
+945601 945629 945631 945647 945671 945673 945677 945701 945731 945733 945739 945767 
+945787 945799 945809 945811 945817 945823 945851 945881 945883 945887 945899 945907 
+945929 945937 945941 945943 945949 945961 945983 946003 946021 946031 946037 946079 
+946081 946091 946093 946109 946111 946123 946133 946163 946177 946193 946207 946223 
+946249 946273 946291 946307 946327 946331 946367 946369 946391 946397 946411 946417 
+946453 946459 946469 946487 946489 946507 946511 946513 946549 946573 946579 946607 
+946661 946663 946667 946669 946681 946697 946717 946727 946733 946741 946753 946769 
+946783 946801 946819 946823 946853 946859 946861 946873 946877 946901 946919 946931 
+946943 946949 946961 946969 946987 946993 946997 947027 947033 947083 947119 947129 
+947137 947171 947183 947197 947203 947239 947263 947299 947327 947341 947351 947357 
+947369 947377 947381 947383 947389 947407 947411 947413 947417 947423 947431 947449 
+947483 947501 947509 947539 947561 947579 947603 947621 947627 947641 947647 947651 
+947659 947707 947711 947719 947729 947741 947743 947747 947753 947773 947783 947803 
+947819 947833 947851 947857 947861 947873 947893 947911 947917 947927 947959 947963 
+947987 948007 948019 948029 948041 948049 948053 948061 948067 948089 948091 948133 
+948139 948149 948151 948169 948173 948187 948247 948253 948263 948281 948287 948293 
+948317 948331 948349 948377 948391 948401 948403 948407 948427 948439 948443 948449 
+948457 948469 948487 948517 948533 948547 948551 948557 948581 948593 948659 948671 
+948707 948713 948721 948749 948767 948797 948799 948839 948847 948853 948877 948887 
+948901 948907 948929 948943 948947 948971 948973 948989 949001 949019 949021 949033 
+949037 949043 949051 949111 949121 949129 949147 949153 949159 949171 949211 949213 
+949241 949243 949253 949261 949303 949307 949381 949387 949391 949409 949423 949427 
+949439 949441 949451 949453 949471 949477 949513 949517 949523 949567 949583 949589 
+949607 949609 949621 949631 949633 949643 949649 949651 949667 949673 949687 949691 
+949699 949733 949759 949771 949777 949789 949811 949849 949853 949889 949891 949903 
+949931 949937 949939 949951 949957 949961 949967 949973 949979 949987 949997 950009 
+950023 950029 950039 950041 950071 950083 950099 950111 950149 950161 950177 950179 
+950207 950221 950227 950231 950233 950239 950251 950269 950281 950329 950333 950347 
+950357 950363 950393 950401 950423 950447 950459 950461 950473 950479 950483 950497 
+950501 950507 950519 950527 950531 950557 950569 950611 950617 950633 950639 950647 
+950671 950681 950689 950693 950699 950717 950723 950737 950743 950753 950783 950791 
+950809 950813 950819 950837 950839 950867 950869 950879 950921 950927 950933 950947 
+950953 950959 950993 951001 951019 951023 951029 951047 951053 951059 951061 951079 
+951089 951091 951101 951107 951109 951131 951151 951161 951193 951221 951259 951277 
+951281 951283 951299 951331 951341 951343 951361 951367 951373 951389 951407 951413 
+951427 951437 951449 951469 951479 951491 951497 951553 951557 951571 951581 951583 
+951589 951623 951637 951641 951647 951649 951659 951689 951697 951749 951781 951787 
+951791 951803 951829 951851 951859 951887 951893 951911 951941 951943 951959 951967 
+951997 952001 952009 952037 952057 952073 952087 952097 952111 952117 952123 952129 
+952141 952151 952163 952169 952183 952199 952207 952219 952229 952247 952253 952277 
+952279 952291 952297 952313 952349 952363 952379 952381 952397 952423 952429 952439 
+952481 952487 952507 952513 952541 952547 952559 952573 952583 952597 952619 952649 
+952657 952667 952669 952681 952687 952691 952709 952739 952741 952753 952771 952789 
+952811 952813 952823 952829 952843 952859 952873 952877 952883 952921 952927 952933 
+952937 952943 952957 952967 952979 952981 952997 953023 953039 953041 953053 953077 
+953081 953093 953111 953131 953149 953171 953179 953191 953221 953237 953243 953261 
+953273 953297 953321 953333 953341 953347 953399 953431 953437 953443 953473 953483 
+953497 953501 953503 953507 953521 953539 953543 953551 953567 953593 953621 953639 
+953647 953651 953671 953681 953699 953707 953731 953747 953773 953789 953791 953831 
+953851 953861 953873 953881 953917 953923 953929 953941 953969 953977 953983 953987 
+954001 954007 954011 954043 954067 954097 954103 954131 954133 954139 954157 954167 
+954181 954203 954209 954221 954229 954253 954257 954259 954263 954269 954277 954287 
+954307 954319 954323 954367 954377 954379 954391 954409 954433 954451 954461 954469 
+954491 954497 954509 954517 954539 954571 954599 954619 954623 954641 954649 954671 
+954677 954697 954713 954719 954727 954743 954757 954763 954827 954829 954847 954851 
+954853 954857 954869 954871 954911 954917 954923 954929 954971 954973 954977 954979 
+954991 955037 955039 955051 955061 955063 955091 955093 955103 955127 955139 955147 
+955153 955183 955193 955211 955217 955223 955243 955261 955267 955271 955277 955307 
+955309 955313 955319 955333 955337 955363 955379 955391 955433 955439 955441 955457 
+955469 955477 955481 955483 955501 955511 955541 955601 955607 955613 955649 955657 
+955693 955697 955709 955711 955727 955729 955769 955777 955781 955793 955807 955813 
+955819 955841 955853 955879 955883 955891 955901 955919 955937 955939 955951 955957 
+955963 955967 955987 955991 955993 956003 956051 956057 956083 956107 956113 956119 
+956143 956147 956177 956231 956237 956261 956269 956273 956281 956303 956311 956341 
+956353 956357 956377 956383 956387 956393 956399 956401 956429 956477 956503 956513 
+956521 956569 956587 956617 956633 956689 956699 956713 956723 956749 956759 956789 
+956801 956831 956843 956849 956861 956881 956903 956909 956929 956941 956951 956953 
+956987 956993 956999 957031 957037 957041 957043 957059 957071 957091 957097 957107 
+957109 957119 957133 957139 957161 957169 957181 957193 957211 957221 957241 957247 
+957263 957289 957317 957331 957337 957349 957361 957403 957409 957413 957419 957431 
+957433 957499 957529 957547 957553 957557 957563 957587 957599 957601 957611 957641 
+957643 957659 957701 957703 957709 957721 957731 957751 957769 957773 957811 957821 
+957823 957851 957871 957877 957889 957917 957937 957949 957953 957959 957977 957991 
+958007 958021 958039 958043 958049 958051 958057 958063 958121 958123 958141 958159 
+958163 958183 958193 958213 958259 958261 958289 958313 958319 958327 958333 958339 
+958343 958351 958357 958361 958367 958369 958381 958393 958423 958439 958459 958481 
+958487 958499 958501 958519 958523 958541 958543 958547 958549 958553 958577 958609 
+958627 958637 958667 958669 958673 958679 958687 958693 958729 958739 958777 958787 
+958807 958819 958829 958843 958849 958871 958877 958883 958897 958901 958921 958931 
+958933 958957 958963 958967 958973 959009 959083 959093 959099 959131 959143 959149 
+959159 959173 959183 959207 959209 959219 959227 959237 959263 959267 959269 959279 
+959323 959333 959339 959351 959363 959369 959377 959383 959389 959449 959461 959467 
+959471 959473 959477 959479 959489 959533 959561 959579 959597 959603 959617 959627 
+959659 959677 959681 959689 959719 959723 959737 959759 959773 959779 959801 959809 
+959831 959863 959867 959869 959873 959879 959887 959911 959921 959927 959941 959947 
+959953 959969 960017 960019 960031 960049 960053 960059 960077 960119 960121 960131 
+960137 960139 960151 960173 960191 960199 960217 960229 960251 960259 960293 960299 
+960329 960331 960341 960353 960373 960383 960389 960419 960467 960493 960497 960499 
+960521 960523 960527 960569 960581 960587 960593 960601 960637 960643 960647 960649 
+960667 960677 960691 960703 960709 960737 960763 960793 960803 960809 960829 960833 
+960863 960889 960931 960937 960941 960961 960977 960983 960989 960991 961003 961021 
+961033 961063 961067 961069 961073 961087 961091 961097 961099 961109 961117 961123 
+961133 961139 961141 961151 961157 961159 961183 961187 961189 961201 961241 961243 
+961273 961277 961283 961313 961319 961339 961393 961397 961399 961427 961447 961451 
+961453 961459 961487 961507 961511 961529 961531 961547 961549 961567 961601 961613 
+961619 961627 961633 961637 961643 961657 961661 961663 961679 961687 961691 961703 
+961729 961733 961739 961747 961757 961769 961777 961783 961789 961811 961813 961817 
+961841 961847 961853 961861 961871 961879 961927 961937 961943 961957 961973 961981 
+961991 961993 962009 962011 962033 962041 962051 962063 962077 962099 962119 962131 
+962161 962177 962197 962233 962237 962243 962257 962267 962303 962309 962341 962363 
+962413 962417 962431 962441 962447 962459 962461 962471 962477 962497 962503 962509 
+962537 962543 962561 962569 962587 962603 962609 962617 962623 962627 962653 962669 
+962671 962677 962681 962683 962737 962743 962747 962779 962783 962789 962791 962807 
+962837 962839 962861 962867 962869 962903 962909 962911 962921 962959 962963 962971 
+962993 963019 963031 963043 963047 963097 963103 963121 963143 963163 963173 963181 
+963187 963191 963211 963223 963227 963239 963241 963253 963283 963299 963301 963311 
+963323 963331 963341 963343 963349 963367 963379 963397 963419 963427 963461 963481 
+963491 963497 963499 963559 963581 963601 963607 963629 963643 963653 963659 963667 
+963689 963691 963701 963707 963709 963719 963731 963751 963761 963763 963779 963793 
+963799 963811 963817 963839 963841 963847 963863 963871 963877 963899 963901 963913 
+963943 963973 963979 964009 964021 964027 964039 964049 964081 964097 964133 964151 
+964153 964199 964207 964213 964217 964219 964253 964259 964261 964267 964283 964289 
+964297 964303 964309 964333 964339 964351 964357 964363 964373 964417 964423 964433 
+964463 964499 964501 964507 964517 964519 964531 964559 964571 964577 964583 964589 
+964609 964637 964661 964679 964693 964697 964703 964721 964753 964757 964783 964787 
+964793 964823 964829 964861 964871 964879 964883 964889 964897 964913 964927 964933 
+964939 964967 964969 964973 964981 965023 965047 965059 965087 965089 965101 965113 
+965117 965131 965147 965161 965171 965177 965179 965189 965191 965197 965201 965227 
+965233 965249 965267 965291 965303 965317 965329 965357 965369 965399 965401 965407 
+965411 965423 965429 965443 965453 965467 965483 965491 965507 965519 965533 965551 
+965567 965603 965611 965621 965623 965639 965647 965659 965677 965711 965749 965759 
+965773 965777 965779 965791 965801 965843 965851 965857 965893 965927 965953 965963 
+965969 965983 965989 966011 966013 966029 966041 966109 966113 966139 966149 966157 
+966191 966197 966209 966211 966221 966227 966233 966241 966257 966271 966293 966307 
+966313 966319 966323 966337 966347 966353 966373 966377 966379 966389 966401 966409 
+966419 966431 966439 966463 966481 966491 966499 966509 966521 966527 966547 966557 
+966583 966613 966617 966619 966631 966653 966659 966661 966677 966727 966751 966781 
+966803 966817 966863 966869 966871 966883 966893 966907 966913 966919 966923 966937 
+966961 966971 966991 966997 967003 967019 967049 967061 967111 967129 967139 967171 
+967201 967229 967259 967261 967289 967297 967319 967321 967327 967333 967349 967361 
+967363 967391 967397 967427 967429 967441 967451 967459 967481 967493 967501 967507 
+967511 967529 967567 967583 967607 967627 967663 967667 967693 967699 967709 967721 
+967739 967751 967753 967763 967781 967787 967819 967823 967831 967843 967847 967859 
+967873 967877 967903 967919 967931 967937 967951 967961 967979 967999 968003 968017 
+968021 968027 968041 968063 968089 968101 968111 968113 968117 968137 968141 968147 
+968159 968173 968197 968213 968237 968239 968251 968263 968267 968273 968291 968299 
+968311 968321 968329 968333 968353 968377 968381 968389 968419 968423 968431 968437 
+968459 968467 968479 968501 968503 968519 968521 968537 968557 968567 968573 968593 
+968641 968647 968659 968663 968689 968699 968713 968729 968731 968761 968801 968809 
+968819 968827 968831 968857 968879 968897 968909 968911 968917 968939 968959 968963 
+968971 969011 969037 969041 969049 969071 969083 969097 969109 969113 969131 969139 
+969167 969179 969181 969233 969239 969253 969257 969259 969271 969301 969341 969343 
+969347 969359 969377 969403 969407 969421 969431 969433 969443 969457 969461 969467 
+969481 969497 969503 969509 969533 969559 969569 969593 969599 969637 969641 969667 
+969671 969677 969679 969713 969719 969721 969743 969757 969763 969767 969791 969797 
+969809 969821 969851 969863 969869 969877 969889 969907 969911 969919 969923 969929 
+969977 969989 970027 970031 970043 970051 970061 970063 970069 970087 970091 970111 
+970133 970147 970201 970213 970217 970219 970231 970237 970247 970259 970261 970267 
+970279 970297 970303 970313 970351 970391 970421 970423 970433 970441 970447 970457 
+970469 970481 970493 970537 970549 970561 970573 970583 970603 970633 970643 970657 
+970667 970687 970699 970721 970747 970777 970787 970789 970793 970799 970813 970817 
+970829 970847 970859 970861 970867 970877 970883 970903 970909 970927 970939 970943 
+970961 970967 970969 970987 970997 970999 971021 971027 971029 971039 971051 971053 
+971063 971077 971093 971099 971111 971141 971143 971149 971153 971171 971177 971197 
+971207 971237 971251 971263 971273 971279 971281 971291 971309 971339 971353 971357 
+971371 971381 971387 971389 971401 971419 971429 971441 971473 971479 971483 971491 
+971501 971513 971521 971549 971561 971563 971569 971591 971639 971651 971653 971683 
+971693 971699 971713 971723 971753 971759 971767 971783 971821 971833 971851 971857 
+971863 971899 971903 971917 971921 971933 971939 971951 971959 971977 971981 971989 
+972001 972017 972029 972031 972047 972071 972079 972091 972113 972119 972121 972131 
+972133 972137 972161 972163 972197 972199 972221 972227 972229 972259 972263 972271 
+972277 972313 972319 972329 972337 972343 972347 972353 972373 972403 972407 972409 
+972427 972431 972443 972469 972473 972481 972493 972533 972557 972577 972581 972599 
+972611 972613 972623 972637 972649 972661 972679 972683 972701 972721 972787 972793 
+972799 972823 972827 972833 972847 972869 972887 972899 972901 972941 972943 972967 
+972977 972991 973001 973003 973031 973033 973051 973057 973067 973069 973073 973081 
+973099 973129 973151 973169 973177 973187 973213 973253 973277 973279 973283 973289 
+973321 973331 973333 973367 973373 973387 973397 973409 973411 973421 973439 973459 
+973487 973523 973529 973537 973547 973561 973591 973597 973631 973657 973669 973681 
+973691 973727 973757 973759 973781 973787 973789 973801 973813 973823 973837 973853 
+973891 973897 973901 973919 973957 974003 974009 974033 974041 974053 974063 974089 
+974107 974123 974137 974143 974147 974159 974161 974167 974177 974179 974189 974213 
+974249 974261 974269 974273 974279 974293 974317 974329 974359 974383 974387 974401 
+974411 974417 974419 974431 974437 974443 974459 974473 974489 974497 974507 974513 
+974531 974537 974539 974551 974557 974563 974581 974591 974599 974651 974653 974657 
+974707 974711 974713 974737 974747 974749 974761 974773 974803 974819 974821 974837 
+974849 974861 974863 974867 974873 974879 974887 974891 974923 974927 974957 974959 
+974969 974971 974977 974983 974989 974999 975011 975017 975049 975053 975071 975083 
+975089 975133 975151 975157 975181 975187 975193 975199 975217 975257 975259 975263 
+975277 975281 975287 975313 975323 975343 975367 975379 975383 975389 975421 975427 
+975433 975439 975463 975493 975497 975509 975521 975523 975551 975553 975581 975599 
+975619 975629 975643 975649 975661 975671 975691 975701 975731 975739 975743 975797 
+975803 975811 975823 975827 975847 975857 975869 975883 975899 975901 975907 975941 
+975943 975967 975977 975991 976009 976013 976033 976039 976091 976093 976103 976109 
+976117 976127 976147 976177 976187 976193 976211 976231 976253 976271 976279 976301 
+976303 976307 976309 976351 976369 976403 976411 976439 976447 976453 976457 976471 
+976477 976483 976489 976501 976513 976537 976553 976559 976561 976571 976601 976607 
+976621 976637 976639 976643 976669 976699 976709 976721 976727 976777 976799 976817 
+976823 976849 976853 976883 976909 976919 976933 976951 976957 976991 977021 977023 
+977047 977057 977069 977087 977107 977147 977149 977167 977183 977191 977203 977209 
+977233 977239 977243 977257 977269 977299 977323 977351 977357 977359 977363 977369 
+977407 977411 977413 977437 977447 977507 977513 977521 977539 977567 977591 977593 
+977609 977611 977629 977671 977681 977693 977719 977723 977747 977761 977791 977803 
+977813 977819 977831 977849 977861 977881 977897 977923 977927 977971 978001 978007 
+978011 978017 978031 978037 978041 978049 978053 978067 978071 978073 978077 978079 
+978091 978113 978149 978151 978157 978179 978181 978203 978209 978217 978223 978233 
+978239 978269 978277 978283 978287 978323 978337 978343 978347 978349 978359 978389 
+978403 978413 978427 978449 978457 978463 978473 978479 978491 978511 978521 978541 
+978569 978599 978611 978617 978619 978643 978647 978683 978689 978697 978713 978727 
+978743 978749 978773 978797 978799 978821 978839 978851 978853 978863 978871 978883 
+978907 978917 978931 978947 978973 978997 979001 979009 979031 979037 979061 979063 
+979093 979103 979109 979117 979159 979163 979171 979177 979189 979201 979207 979211 
+979219 979229 979261 979273 979283 979291 979313 979327 979333 979337 979343 979361 
+979369 979373 979379 979403 979423 979439 979457 979471 979481 979519 979529 979541 
+979543 979549 979553 979567 979651 979691 979709 979717 979747 979757 979787 979807 
+979819 979831 979873 979883 979889 979907 979919 979921 979949 979969 979987 980027 
+980047 980069 980071 980081 980107 980117 980131 980137 980149 980159 980173 980179 
+980197 980219 980249 980261 980293 980299 980321 980327 980363 980377 980393 980401 
+980417 980423 980431 980449 980459 980471 980489 980491 980503 980549 980557 980579 
+980587 980591 980593 980599 980621 980641 980677 980687 980689 980711 980717 980719 
+980729 980731 980773 980801 980803 980827 980831 980851 980887 980893 980897 980899 
+980909 980911 980921 980957 980963 980999 981011 981017 981023 981037 981049 981061 
+981067 981073 981077 981091 981133 981137 981139 981151 981173 981187 981199 981209 
+981221 981241 981263 981271 981283 981287 981289 981301 981311 981319 981373 981377 
+981391 981397 981419 981437 981439 981443 981451 981467 981473 981481 981493 981517 
+981523 981527 981569 981577 981587 981599 981601 981623 981637 981653 981683 981691 
+981697 981703 981707 981713 981731 981769 981797 981809 981811 981817 981823 981887 
+981889 981913 981919 981941 981947 981949 981961 981979 981983 982021 982057 982061 
+982063 982067 982087 982097 982099 982103 982117 982133 982147 982151 982171 982183 
+982187 982211 982213 982217 982231 982271 982273 982301 982321 982337 982339 982343 
+982351 982363 982381 982393 982403 982453 982489 982493 982559 982571 982573 982577 
+982589 982603 982613 982621 982633 982643 982687 982693 982697 982703 982741 982759 
+982769 982777 982783 982789 982801 982819 982829 982841 982843 982847 982867 982871 
+982903 982909 982931 982939 982967 982973 982981 983063 983069 983083 983113 983119 
+983123 983131 983141 983149 983153 983173 983179 983189 983197 983209 983233 983239 
+983243 983261 983267 983299 983317 983327 983329 983347 983363 983371 983377 983407 
+983429 983431 983441 983443 983447 983449 983461 983491 983513 983519 983527 983531 
+983533 983557 983579 983581 983597 983617 983659 983699 983701 983737 983771 983777 
+983783 983789 983791 983803 983809 983813 983819 983849 983861 983863 983881 983911 
+983923 983929 983951 983987 983993 984007 984017 984037 984047 984059 984083 984091 
+984119 984121 984127 984149 984167 984199 984211 984241 984253 984299 984301 984307 
+984323 984329 984337 984341 984349 984353 984359 984367 984383 984391 984397 984407 
+984413 984421 984427 984437 984457 984461 984481 984491 984497 984539 984541 984563 
+984583 984587 984593 984611 984617 984667 984689 984701 984703 984707 984733 984749 
+984757 984761 984817 984847 984853 984859 984877 984881 984911 984913 984917 984923 
+984931 984947 984959 985003 985007 985013 985027 985057 985063 985079 985097 985109 
+985121 985129 985151 985177 985181 985213 985219 985253 985277 985279 985291 985301 
+985307 985331 985339 985351 985379 985399 985403 985417 985433 985447 985451 985463 
+985471 985483 985487 985493 985499 985519 985529 985531 985547 985571 985597 985601 
+985613 985631 985639 985657 985667 985679 985703 985709 985723 985729 985741 985759 
+985781 985783 985799 985807 985819 985867 985871 985877 985903 985921 985937 985951 
+985969 985973 985979 985981 985991 985993 985997 986023 986047 986053 986071 986101 
+986113 986131 986137 986143 986147 986149 986177 986189 986191 986197 986207 986213 
+986239 986257 986267 986281 986287 986333 986339 986351 986369 986411 986417 986429 
+986437 986471 986477 986497 986507 986509 986519 986533 986543 986563 986567 986569 
+986581 986593 986597 986599 986617 986633 986641 986659 986693 986707 986717 986719 
+986729 986737 986749 986759 986767 986779 986801 986813 986819 986837 986849 986851 
+986857 986903 986927 986929 986933 986941 986959 986963 986981 986983 986989 987013 
+987023 987029 987043 987053 987061 987067 987079 987083 987089 987097 987101 987127 
+987143 987191 987193 987199 987209 987211 987227 987251 987293 987299 987313 987353 
+987361 987383 987391 987433 987457 987463 987473 987491 987509 987523 987533 987541 
+987559 987587 987593 987599 987607 987631 987659 987697 987713 987739 987793 987797 
+987803 987809 987821 987851 987869 987911 987913 987929 987941 987971 987979 987983 
+987991 987997 988007 988021 988033 988051 988061 988067 988069 988093 988109 988111 
+988129 988147 988157 988199 988213 988217 988219 988231 988237 988243 988271 988279 
+988297 988313 988319 988321 988343 988357 988367 988409 988417 988439 988453 988459 
+988483 988489 988501 988511 988541 988549 988571 988577 988579 988583 988591 988607 
+988643 988649 988651 988661 988681 988693 988711 988727 988733 988759 988763 988783 
+988789 988829 988837 988849 988859 988861 988877 988901 988909 988937 988951 988963 
+988979 989011 989029 989059 989071 989081 989099 989119 989123 989171 989173 989231 
+989239 989249 989251 989279 989293 989309 989321 989323 989327 989341 989347 989353 
+989377 989381 989411 989419 989423 989441 989467 989477 989479 989507 989533 989557 
+989561 989579 989581 989623 989629 989641 989647 989663 989671 989687 989719 989743 
+989749 989753 989761 989777 989783 989797 989803 989827 989831 989837 989839 989869 
+989873 989887 989909 989917 989921 989929 989939 989951 989959 989971 989977 989981 
+989999 990001 990013 990023 990037 990043 990053 990137 990151 990163 990169 990179 
+990181 990211 990239 990259 990277 990281 990287 990289 990293 990307 990313 990323 
+990329 990331 990349 990359 990361 990371 990377 990383 990389 990397 990463 990469 
+990487 990497 990503 990511 990523 990529 990547 990559 990589 990593 990599 990631 
+990637 990643 990673 990707 990719 990733 990761 990767 990797 990799 990809 990841 
+990851 990881 990887 990889 990893 990917 990923 990953 990961 990967 990973 990989 
+991009 991027 991031 991037 991043 991057 991063 991069 991073 991079 991091 991127 
+991129 991147 991171 991181 991187 991201 991217 991223 991229 991261 991273 991313 
+991327 991343 991357 991381 991387 991409 991427 991429 991447 991453 991483 991493 
+991499 991511 991531 991541 991547 991567 991579 991603 991607 991619 991621 991633 
+991643 991651 991663 991693 991703 991717 991723 991733 991741 991751 991777 991811 
+991817 991867 991871 991873 991883 991889 991901 991909 991927 991931 991943 991951 
+991957 991961 991973 991979 991981 991987 991999 992011 992021 992023 992051 992087 
+992111 992113 992129 992141 992153 992179 992183 992219 992231 992249 992263 992267 
+992269 992281 992309 992317 992357 992359 992363 992371 992393 992417 992429 992437 
+992441 992449 992461 992513 992521 992539 992549 992561 992591 992603 992609 992623 
+992633 992659 992689 992701 992707 992723 992737 992777 992801 992809 992819 992843 
+992857 992861 992863 992867 992891 992903 992917 992923 992941 992947 992963 992983 
+993001 993011 993037 993049 993053 993079 993103 993107 993121 993137 993169 993197 
+993199 993203 993211 993217 993233 993241 993247 993253 993269 993283 993287 993319 
+993323 993341 993367 993397 993401 993407 993431 993437 993451 993467 993479 993481 
+993493 993527 993541 993557 993589 993611 993617 993647 993679 993683 993689 993703 
+993763 993779 993781 993793 993821 993823 993827 993841 993851 993869 993887 993893 
+993907 993913 993919 993943 993961 993977 993983 993997 994013 994027 994039 994051 
+994067 994069 994073 994087 994093 994141 994163 994181 994183 994193 994199 994229 
+994237 994241 994247 994249 994271 994297 994303 994307 994309 994319 994321 994337 
+994339 994363 994369 994391 994393 994417 994447 994453 994457 994471 994489 994501 
+994549 994559 994561 994571 994579 994583 994603 994621 994657 994663 994667 994691 
+994699 994709 994711 994717 994723 994751 994769 994793 994811 994813 994817 994831 
+994837 994853 994867 994871 994879 994901 994907 994913 994927 994933 994949 994963 
+994991 994997 995009 995023 995051 995053 995081 995117 995119 995147 995167 995173 
+995219 995227 995237 995243 995273 995303 995327 995329 995339 995341 995347 995363 
+995369 995377 995381 995387 995399 995431 995443 995447 995461 995471 995513 995531 
+995539 995549 995551 995567 995573 995587 995591 995593 995611 995623 995641 995651 
+995663 995669 995677 995699 995713 995719 995737 995747 995783 995791 995801 995833 
+995881 995887 995903 995909 995927 995941 995957 995959 995983 995987 995989 996001 
+996011 996019 996049 996067 996103 996109 996119 996143 996157 996161 996167 996169 
+996173 996187 996197 996209 996211 996253 996257 996263 996271 996293 996301 996311 
+996323 996329 996361 996367 996403 996407 996409 996431 996461 996487 996511 996529 
+996539 996551 996563 996571 996599 996601 996617 996629 996631 996637 996647 996649 
+996689 996703 996739 996763 996781 996803 996811 996841 996847 996857 996859 996871 
+996881 996883 996887 996899 996953 996967 996973 996979 997001 997013 997019 997021 
+997037 997043 997057 997069 997081 997091 997097 997099 997103 997109 997111 997121 
+997123 997141 997147 997151 997153 997163 997201 997207 997219 997247 997259 997267 
+997273 997279 997307 997309 997319 997327 997333 997343 997357 997369 997379 997391 
+997427 997433 997439 997453 997463 997511 997541 997547 997553 997573 997583 997589 
+997597 997609 997627 997637 997649 997651 997663 997681 997693 997699 997727 997739 
+997741 997751 997769 997783 997793 997807 997811 997813 997877 997879 997889 997891 
+997897 997933 997949 997961 997963 997973 997991 998009 998017 998027 998029 998069 
+998071 998077 998083 998111 998117 998147 998161 998167 998197 998201 998213 998219 
+998237 998243 998273 998281 998287 998311 998329 998353 998377 998381 998399 998411 
+998419 998423 998429 998443 998471 998497 998513 998527 998537 998539 998551 998561 
+998617 998623 998629 998633 998651 998653 998681 998687 998689 998717 998737 998743 
+998749 998759 998779 998813 998819 998831 998839 998843 998857 998861 998897 998909 
+998917 998927 998941 998947 998951 998957 998969 998983 998989 999007 999023 999029 
+999043 999049 999067 999083 999091 999101 999133 999149 999169 999181 999199 999217 
+999221 999233 999239 999269 999287 999307 999329 999331 999359 999371 999377 999389 
+999431 999433 999437 999451 999491 999499 999521 999529 999541 999553 999563 999599 
+999611 999613 999623 999631 999653 999667 999671 999683 999721 999727 999749 999763 
+999769 999773 999809 999853 999863 999883 999907 999917 999931 999953 999959 999961 
+999979 999983 } ;
diff --git a/extra/math/quadratic/authors.txt b/extra/math/quadratic/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/math/quadratic/quadratic.factor b/extra/math/quadratic/quadratic.factor
new file mode 100644 (file)
index 0000000..979e205
--- /dev/null
@@ -0,0 +1,20 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math math.functions ;
+IN: quadratic
+
+: monic ( c b a -- c' b' ) tuck / >r / r> ;
+
+: discriminant ( c b -- b d ) tuck sq 4 / swap - sqrt ;
+
+: critical ( b d -- -b/2 d ) >r -2 / r> ;
+
+: +- ( x y -- x+y x-y ) [ + ] 2keep - ;
+
+: quadratic ( c b a -- alpha beta )
+    #! Solve a quadratic equation ax^2 + bx + c = 0
+    monic discriminant critical +- ;
+
+: qeval ( x c b a -- y )
+    #! Evaluate ax^2 + bx + c
+    >r pick * r> roll sq * + + ;
diff --git a/extra/math/quadratic/summary.txt b/extra/math/quadratic/summary.txt
new file mode 100644 (file)
index 0000000..dfdc794
--- /dev/null
@@ -0,0 +1 @@
+Quadratic equation solver
diff --git a/extra/math/quaternions/authors.txt b/extra/math/quaternions/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/math/quaternions/quaternions-tests.factor b/extra/math/quaternions/quaternions-tests.factor
new file mode 100644 (file)
index 0000000..42cb72a
--- /dev/null
@@ -0,0 +1,26 @@
+IN: temporary
+USING: tools.test math.quaternions kernel math.vectors
+math.constants ;
+
+[ 1 ] [ qi norm ] unit-test
+[ 1 ] [ qj norm ] unit-test
+[ 1 ] [ qk norm ] unit-test
+[ 1 ] [ q1 norm ] unit-test
+[ 0 ] [ q0 norm ] unit-test
+[ t ] [ qi qj q* qk = ] unit-test
+[ t ] [ qj qk q* qi = ] unit-test
+[ t ] [ qk qi q* qj = ] unit-test
+[ t ] [ qi qi q* q1 v+ q0 = ] unit-test
+[ t ] [ qj qj q* q1 v+ q0 = ] unit-test
+[ t ] [ qk qk q* q1 v+ q0 = ] unit-test
+[ t ] [ qi qj qk q* q* q1 v+ q0 = ] unit-test
+[ t ] [ i qj n*v qk = ] unit-test
+[ t ] [ qj i q*n qk v+ q0 = ] unit-test
+[ t ] [ qk qj q/ qi = ] unit-test
+[ t ] [ qi qk q/ qj = ] unit-test
+[ t ] [ qj qi q/ qk = ] unit-test
+[ t ] [ qi q>v v>q qi = ] unit-test
+[ t ] [ qj q>v v>q qj = ] unit-test
+[ t ] [ qk q>v v>q qk = ] unit-test
+[ t ] [ 1 c>q q1 = ] unit-test
+[ t ] [ i c>q qi = ] unit-test
diff --git a/extra/math/quaternions/quaternions.factor b/extra/math/quaternions/quaternions.factor
new file mode 100644 (file)
index 0000000..4c4d819
--- /dev/null
@@ -0,0 +1,78 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+
+! Everybody's favorite non-commutative skew field, the
+! quaternions!
+
+! Quaternions are represented as pairs of complex numbers,
+! using the identity: (a+bi)+(c+di)j = a+bi+cj+dk.
+USING: arrays kernel math math.vectors math.functions
+arrays sequences ;
+IN: math.quaternions
+
+<PRIVATE
+
+: ** conjugate * ; inline
+
+: 2q ( u v -- u' u'' v' v'' ) [ first2 ] 2apply ; inline
+
+: q*a ( u v -- a ) 2q swapd ** >r * r> - ; inline
+
+: q*b ( u v -- b ) 2q >r ** swap r> * + ; inline
+
+PRIVATE>
+
+: q* ( u v -- u*v )
+    #! Multiply quaternions.
+    [ q*a ] 2keep q*b 2array ;
+
+: qconjugate ( u -- u' )
+    #! Quaternion conjugate.
+    first2 neg >r conjugate r> 2array ;
+
+: qrecip ( u -- 1/u )
+    #! Quaternion inverse.
+    qconjugate dup norm-sq v/n ;
+
+: q/ ( u v -- u/v )
+    #! Divide quaternions.
+    qrecip q* ;
+
+: q*n ( q n -- q )
+    #! Note: you will get the wrong result if you try to
+    #! multiply a quaternion by a complex number on the right
+    #! using v*n. Use this word instead. Note that v*n with a
+    #! quaternion and a real is okay.
+    conjugate v*n ;
+
+: c>q ( c -- q )
+    #! Turn a complex number into a quaternion.
+    0 2array ;
+
+: v>q ( v -- q )
+    #! Turn a 3-vector into a quaternion with real part 0.
+    first3 rect> >r 0 swap rect> r> 2array ;
+
+: q>v ( q -- v )
+    #! Get the vector part of a quaternion, discarding the real
+    #! part.
+    first2 >r imaginary r> >rect 3array ;
+
+! Zero
+: q0 { 0 0 } ;
+
+! Units
+: q1 { 1 0 } ;
+: qi { C{ 0 1 } 0 } ;
+: qj { 0 1 } ;
+: qk { 0 C{ 0 1 } } ;
+
+! Euler angles -- see
+! http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/euleranglestoquaternions.html
+
+: (euler) ( theta unit -- q )
+    >r -0.5 * dup cos c>q swap sin r> n*v v- ;
+
+: euler ( phi theta psi -- q )
+    qk (euler) >r qj (euler) >r qi (euler) r> q* r> q* ;
+
diff --git a/extra/math/quaternions/summary.txt b/extra/math/quaternions/summary.txt
new file mode 100644 (file)
index 0000000..756750b
--- /dev/null
@@ -0,0 +1 @@
+Quaternion arithmetic and Euler angles
diff --git a/extra/math/ranges/authors.txt b/extra/math/ranges/authors.txt
new file mode 100644 (file)
index 0000000..f372b57
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+Doug Coleman
diff --git a/extra/math/ranges/ranges-tests.factor b/extra/math/ranges/ranges-tests.factor
new file mode 100644 (file)
index 0000000..f70f70a
--- /dev/null
@@ -0,0 +1,23 @@
+USING: math.ranges sequences tools.test ;
+IN: temporary
+
+[ { } ] [ 1 1 (a,b) >array ] unit-test
+[ { } ] [ 1 1 (a,b] >array ] unit-test
+[ { } ] [ 1 1 [a,b) >array ] unit-test
+[ { 1 } ] [ 1 1 [a,b] >array ] unit-test
+
+[ { }  ] [ 1 2 (a,b) >array ] unit-test
+[ { 2 } ] [ 1 2 (a,b] >array ] unit-test
+[ { 1 } ] [ 1 2 [a,b) >array ] unit-test
+[ { 1 2 } ] [ 1 2 [a,b] >array ] unit-test
+
+[ { }  ] [ 2 1 (a,b) >array ] unit-test
+[ { 1 } ] [ 2 1 (a,b] >array ] unit-test
+[ { 2 } ] [ 2 1 [a,b) >array ] unit-test
+[ { 2 1 } ] [ 2 1 [a,b] >array ] unit-test
+
+[ { 1 2 3 4 5 } ] [ 1 5 1 <range> >array ] unit-test
+[ { 5 4 3 2 1 } ] [ 5 1 -1 <range> >array ] unit-test
+
+[ { 0 1/3 2/3 1 } ] [ 0 1 1/3 <range> >array ] unit-test
+[ { 0 1/3 2/3 1 } ] [ 1 0 -1/3 <range> >array reverse ] unit-test
diff --git a/extra/math/ranges/ranges.factor b/extra/math/ranges/ranges.factor
new file mode 100644 (file)
index 0000000..b84773b
--- /dev/null
@@ -0,0 +1,41 @@
+USING: kernel layouts math namespaces sequences sequences.private ;
+IN: math.ranges
+
+: >integer ( n -- i )
+    dup most-negative-fixnum most-positive-fixnum between?
+    [ >fixnum ] [ >bignum ] if ;
+
+TUPLE: range from length step ;
+
+: <range> ( from to step -- range )
+    >r over - r>
+    [ / 1+ 0 max >integer ] keep
+    range construct-boa ;
+
+M: range length ( seq -- n )
+    range-length ;
+
+M: range nth-unsafe ( n range -- obj )
+    [ range-step * ] keep range-from + ;
+
+INSTANCE: range immutable-sequence
+
+: twiddle 2dup > -1 1 ? ; inline
+
+: (a, dup roll + -rot ; inline
+
+: ,b) dup neg rot + swap ; inline
+
+: [a,b] twiddle <range> ;
+
+: (a,b] twiddle (a, <range> ;
+
+: [a,b) twiddle ,b) <range> ;
+
+: (a,b) twiddle (a, ,b) <range> ;
+
+: [0,b] 0 swap [a,b] ;
+
+: [1,b] 1 swap [a,b] ;
+
+: [0,b) 0 swap (a,b] ;
diff --git a/extra/math/ranges/summary.txt b/extra/math/ranges/summary.txt
new file mode 100644 (file)
index 0000000..3e5e6b9
--- /dev/null
@@ -0,0 +1 @@
+Virtual sequence consisting of a range of numbers
diff --git a/extra/math/statistics/authors.txt b/extra/math/statistics/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/math/statistics/statistics-tests.factor b/extra/math/statistics/statistics-tests.factor
new file mode 100644 (file)
index 0000000..f1cc284
--- /dev/null
@@ -0,0 +1,23 @@
+USING: kernel math math.functions math.statistics tools.test ;
+IN: temporary
+
+[ 1 ] [ { 1 } mean ] unit-test
+[ 3/2 ] [ { 1 2 } mean ] unit-test
+[ 0 ] [ { 0 0 0 } geometric-mean ] unit-test
+[ t ] [ { 2 2 2 2 } geometric-mean 2.0 .0001 ~ ] unit-test
+[ 1 ] [ { 1 1 1 } geometric-mean ] unit-test
+[ 1/3 ] [ { 1 1 1 } harmonic-mean ] unit-test
+
+[ 0 ] [ { 1 } range ] unit-test
+[ 89 ] [ { 1 2 30 90 } range ] unit-test
+[ 2 ] [ { 1 2 3 } median ] unit-test
+[ 5/2 ] [ { 1 2 3 4 } median ] unit-test
+
+[ 1 ] [ { 1 2 3 } var ] unit-test
+[ 1 ] [ { 1 2 3 } std ] unit-test
+
+[ t ] [ { 23.2 33.4 22.5 66.3 44.5 } std 18.1906 - .0001 < ] unit-test
+
+[ 0 ] [ { 1 } var ] unit-test
+[ 0 ] [ { 1 } std ] unit-test
+
diff --git a/extra/math/statistics/statistics.factor b/extra/math/statistics/statistics.factor
new file mode 100644 (file)
index 0000000..93d985a
--- /dev/null
@@ -0,0 +1,65 @@
+USING: combinators.lib kernel math math.analysis
+math.functions math.vectors sequences sequences.lib sorting ;
+IN: math.statistics
+
+: mean ( seq -- n )
+    #! arithmetic mean, sum divided by length
+    [ sum ] keep length / ;
+
+: geometric-mean ( seq -- n )
+    #! geometric mean, nth root of product
+    [ product ] keep length swap nth-root ;
+
+: harmonic-mean ( seq -- n )
+    #! harmonic mean, reciprocal of sum of reciprocals.
+    #! positive reals only
+    0 [ recip + ] reduce recip ;
+
+: median ( seq -- n )
+    #! middle number if odd, avg of two middle numbers if even
+    natural-sort dup length dup even? [
+        1- 2 / swap [ nth ] 2keep >r 1+ r> nth + 2 /
+    ] [
+        2 / swap nth
+    ] if ;
+
+: range ( seq -- n )
+    #! max - min
+    minmax swap - ;
+
+: var ( seq -- x )
+    #! variance, normalize by N-1
+    dup length 1 <= [
+        drop 0
+    ] [
+        [ [ mean ] keep [ - sq ] curry* sigma ] keep
+        length 1- /
+    ] if ;
+
+: std ( seq -- x )
+    #! standard deviation, sqrt of variance
+    var sqrt ;
+
+: ((r)) ( mean(x) mean(y) {x} {y} -- (r) )
+    ! finds sigma((xi-mean(x))(yi-mean(y)) 
+    0 [ [ >r pick r> swap - ] 2apply * + ] 2reduce 2nip ;
+
+: (r) ( mean(x) mean(y) {x} {y} sx sy -- r )
+    * recip >r [ ((r)) ] keep length 1- / r> * ;
+
+: [r] ( {{x,y}...} -- mean(x) mean(y) {x} {y} sx sy )
+    first2 [ [ [ mean ] 2apply ] 2keep ] 2keep [ std ] 2apply ;
+
+: r ( {{x,y}...} -- r )
+    [r] (r) ;
+
+: r^2 ( {{x,y}...} -- r )
+    r sq ;
+
+: least-squares ( {{x,y}...} -- alpha beta )
+    [r] >r >r >r >r 2dup r> r> r> r>
+    ! stack is mean(x) mean(y) mean(x) mean(y) {x} {y} sx sy
+    [ (r) ] 2keep ! stack is mean(x) mean(y) r sx sy
+    swap / * ! stack is mean(x) mean(y) beta
+    [ swapd * - ] keep ;
+
diff --git a/extra/math/statistics/summary.txt b/extra/math/statistics/summary.txt
new file mode 100644 (file)
index 0000000..628c9ad
--- /dev/null
@@ -0,0 +1 @@
+Mean, median, standard deviation, and other statistical routines
diff --git a/extra/math/trig/trig.factor b/extra/math/trig/trig.factor
new file mode 100644 (file)
index 0000000..be9ec6a
--- /dev/null
@@ -0,0 +1,7 @@
+
+USING: math math.constants ;
+
+IN: math.trig
+
+: deg>rad pi * 180 / ; inline
+: rad>deg 180 * pi / ; inline
diff --git a/extra/maze/authors.txt b/extra/maze/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/maze/deploy.factor b/extra/maze/deploy.factor
new file mode 100644 (file)
index 0000000..a85c82d
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? f }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { strip-c-types? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? t }
+    { "bundle-name" "Maze.app" }
+}
diff --git a/extra/maze/maze.factor b/extra/maze/maze.factor
new file mode 100644 (file)
index 0000000..6af04dd
--- /dev/null
@@ -0,0 +1,67 @@
+! From http://www.ffconsultancy.com/ocaml/maze/index.html
+USING: sequences namespaces math math.vectors opengl opengl.gl
+arrays kernel random ui ui.gadgets ui.gadgets.canvas ui.render ;
+IN: maze
+
+: line-width 8 ;
+
+SYMBOL: visited
+
+: unvisited? ( cell -- ? ) first2 visited get ?nth ?nth ;
+
+: ?set-nth ( elt i seq -- )
+    2dup bounds-check? [ set-nth ] [ 3drop ] if ;
+
+: visit ( cell -- ) f swap first2 visited get ?nth ?set-nth ;
+
+: choices ( cell -- seq )
+    { { -1 0 } { 1 0 } { 0 -1 } { 0 1 } }
+    [ v+ ] curry* map
+    [ unvisited? ] subset ;
+
+: random-neighbour ( cell -- newcell ) choices random ;
+
+: vertex ( pair -- )
+    first2 [ 0.5 + line-width * ] 2apply glVertex2d ;
+
+: (draw-maze) ( cell -- )
+    dup vertex
+    glEnd
+    GL_POINTS [ dup vertex ] do-state
+    GL_LINE_STRIP glBegin
+    dup vertex
+    dup visit
+    dup random-neighbour dup [
+        (draw-maze) (draw-maze)
+    ] [
+        2drop
+        glEnd
+        GL_LINE_STRIP glBegin
+    ] if ;
+
+: draw-maze ( n -- )
+    line-width 2 - glLineWidth
+    line-width 2 - glPointSize
+    1.0 1.0 1.0 1.0 glColor4d
+    dup [ drop t <array> ] curry* map visited set
+    GL_LINE_STRIP glBegin
+    { 0 0 } dup vertex (draw-maze)
+    glEnd ;
+
+TUPLE: maze ;
+
+: <maze> ( -- gadget )
+    <canvas> { set-delegate } maze construct ;
+
+: n ( gadget -- n ) rect-dim first2 min line-width /i ;
+
+M: maze layout* delete-canvas-dlist ;
+
+M: maze draw-gadget* [ n draw-maze ] draw-canvas ;
+
+M: maze pref-dim* drop { 400 400 } ;
+
+: maze-window ( -- )
+    [ <maze> "Maze" open-window ] with-ui ;
+
+MAIN: maze-window
diff --git a/extra/maze/summary.txt b/extra/maze/summary.txt
new file mode 100644 (file)
index 0000000..50bbd45
--- /dev/null
@@ -0,0 +1 @@
+Maze generator demo
diff --git a/extra/maze/tags.txt b/extra/maze/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/memoize/authors.txt b/extra/memoize/authors.txt
new file mode 100644 (file)
index 0000000..a44f8d7
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+Daniel Ehrenberg
diff --git a/extra/memoize/memoize-docs.factor b/extra/memoize/memoize-docs.factor
new file mode 100644 (file)
index 0000000..39aca4c
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2007 Slava Pestov, Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: memoize help.syntax help.markup ;
+
+HELP: define-memoized
+{ $values { "word" "the word to be defined" } { "quot" "a quotation" } }
+{ $description "defines the given word at runtime as one which memoizes its output given a particular input" }
+{ $notes "A maximum of four input and four output arguments can be used" }
+{ $see-also POSTPONE: MEMO: } ;
+
+HELP: MEMO:
+{ $syntax "MEMO: word ( stack -- effect ) definition ;" }
+{ $description "defines the given word at parsetime as one which memoizes its output given a particular input. The stack effect is mandatory." }
+{ $notes "A maximum of four input and four output arguments can be used" }
+{ $see-also define-memoized } ;
diff --git a/extra/memoize/memoize-tests.factor b/extra/memoize/memoize-tests.factor
new file mode 100644 (file)
index 0000000..c4ab3dd
--- /dev/null
@@ -0,0 +1,10 @@
+! Copyright (C) 2007 Slava Pestov, Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: math kernel memoize tools.test parser ;
+
+MEMO: fib ( m -- n )
+    dup 1 <= [ drop 1 ] [ dup 1 - fib swap 2 - fib + ] if ;
+
+[ 89 ] [ 10 fib ] unit-test
+
+[ "USE: memoize MEMO: x ( a b c d e -- f g h i j ) >r >r >r >r 1+ r> r> r> r> ;" parse ] unit-test-fails
diff --git a/extra/memoize/memoize.factor b/extra/memoize/memoize.factor
new file mode 100644 (file)
index 0000000..75f8ae5
--- /dev/null
@@ -0,0 +1,48 @@
+! Copyright (C) 2007 Slava Pestov, Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel hashtables sequences arrays words namespaces
+parser math assocs effects definitions ;
+IN: memoize
+
+: packer ( n -- quot )
+    { [ f ] [ ] [ 2array ] [ 3array ] [ 4array ] } nth ;
+
+: unpacker ( n -- quot )
+    { [ drop ] [ ] [ first2 ] [ first3 ] [ first4 ] } nth ;
+
+: #in ( word -- n )
+    stack-effect effect-in length ;
+
+: #out ( word -- n )
+    stack-effect effect-out length ;
+
+: pack/unpack ( quot word -- newquot )
+    [ dup #in unpacker % swap % #out packer % ] [ ] make ;
+
+: make-memoizer ( quot word -- quot )
+    [
+        [ #in packer % ] keep
+        [ "memoize" word-prop , ] keep
+        [ pack/unpack , ] keep
+        \ cache ,
+        #out unpacker %
+    ] [ ] make ;
+
+: check-memoized ( word -- )
+    dup #in 4 > swap #out 4 > or [
+        "There must be no more than 4 input and 4 output arguments" throw
+    ] when ;
+
+: define-memoized ( word quot -- )
+    over check-memoized
+    2dup "memo-quot" set-word-prop
+    over H{ } clone "memoize" set-word-prop
+    over make-memoizer define-compound ;
+
+: MEMO:
+    CREATE dup reset-generic parse-definition define-memoized ; parsing
+
+PREDICATE: compound memoized "memoize" word-prop ;
+
+M: memoized definer drop \ MEMO: \ ; ;
+M: memoized definition "memo-quot" word-prop ;
diff --git a/extra/memoize/summary.txt b/extra/memoize/summary.txt
new file mode 100644 (file)
index 0000000..d96ba83
--- /dev/null
@@ -0,0 +1 @@
+Memoization
diff --git a/extra/memoize/tags.txt b/extra/memoize/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/models/authors.txt b/extra/models/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/models/models-docs.factor b/extra/models/models-docs.factor
new file mode 100644 (file)
index 0000000..aaa7ee3
--- /dev/null
@@ -0,0 +1,306 @@
+USING: help.syntax help.markup kernel math classes tuples ;
+IN: models
+
+HELP: model
+{ $class-description "A mutable cell holding a single value. When the value is changed, a sequence of connected objects are notified. Models have the following slots:"
+    { $list
+        { { $link model-value } " - the value of the model. Use " { $link set-model } " to change the value." }
+        { { $link model-connections } " - a sequence of objects implementing the " { $link model-changed } " generic word, to be notified when the model's value changes." }
+        { { $link model-dependencies } " - a sequence of models which should have this model added to their sequence of connections when activated." }
+        { { $link model-ref } " - a reference count tracking the number of models which depend on this one." }
+    }
+"Other classes may delegate to " { $link model } "."
+} ;
+
+HELP: <model>
+{ $values { "value" object } { "model" "a new " { $link model } } }
+{ $description "Creates a new model with an initial value." } ;
+
+HELP: add-dependency
+{ $values { "dep" model } { "model" model } }
+{ $description "Registers a dependency. When " { $snippet "model" } " is activated, it will be added to " { $snippet "dep" } "'s connections and notified when " { $snippet "dep" } " changes." }
+{ $notes "This word should not be called directly unless you are implementing your own model class." } ;
+
+{ add-dependency remove-dependency activate-model deactivate-model } related-words
+
+HELP: remove-dependency
+{ $values { "dep" model } { "model" model } }
+{ $description "Unregisters a dependency." }
+{ $notes "This word should not be called directly unless you are implementing your own model class." } ;
+
+HELP: model-activated
+{ $values { "model" model } }
+{ $contract "Called after a model has been activated." } ;
+
+{ model-activated activate-model deactivate-model } related-words
+
+HELP: activate-model
+{ $values { "model" model } }
+{ $description "Increments the reference count of the model. If it was previously zero, this model is added as a connection to all models registered as dependencies by " { $link add-dependency } "." }
+{ $warning "Calls to " { $link activate-model } " and " { $link deactivate-model } " should be balanced to keep the reference counting consistent, otherwise " { $link model-changed } " might be called at the wrong time or not at all." } ;
+
+HELP: deactivate-model
+{ $values { "model" model } }
+{ $description "Decrements the reference count of the model. If it reaches zero, this model is removed as a connection from all models registered as dependencies by " { $link add-dependency } "." }
+{ $warning "Calls to " { $link activate-model } " and " { $link deactivate-model } " should be balanced to keep the reference counting consistent, otherwise " { $link model-changed } " might be called at the wrong time or not at all." } ;
+
+HELP: model-changed
+{ $values { "observer" object } }
+{ $contract "Called to notify observers of a model that the model value has changed as a result of a call to " { $link set-model } ". Observers can be registered with " { $link add-connection } "." } ;
+
+{ add-connection remove-connection model-changed } related-words
+
+HELP: add-connection
+{ $values { "observer" object } { "model" model } }
+{ $contract "Registers an object interested in being notified of changes to the model's value. When the value is changed as a result of a call to " { $link set-model } ", the " { $link model-changed } " word is called on the observer." } ;
+
+HELP: remove-connection
+{ $values { "observer" object } { "model" model } }
+{ $contract "Unregisters an object no longer interested in being notified of changes to the model's value." } ;
+
+HELP: set-model
+{ $values { "value" object } { "model" model } }
+{ $description "Changes the value of a model and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." } ;
+
+{ set-model set-model-value change-model (change-model) } related-words
+
+HELP: set-model-value ( value model -- )
+{ $values { "value" object } { "model" model } }
+{ $description "Changes the value of a model without notifying any observers registered with " { $link add-connection } "." }
+{ $notes "There are very few reasons for user code to call this word. Instead, call " { $link set-model } ", which notifies observers." } ;
+
+HELP: change-model
+{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } }
+{ $description "Applies the quotation to the current value of the model to yield a new value, then changes the value of the model to the new value, and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." } ;
+
+HELP: (change-model)
+{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } }
+{ $description "Applies the quotation to the current value of the model to yield a new value, then changes the value of the model to the new value without notifying any observers registered with " { $link add-connection } "." }
+{ $notes "There are very few reasons for user code to call this word. Instead, call " { $link change-model } ", which notifies observers." } ;
+
+HELP: filter
+{ $class-description "Filter model values are computed by applying a quotation to the value of another model. Filters are automatically updated when the underlying model changes. Filters are constructed by " { $link <filter> } "." }
+{ $examples
+    "The following code displays a label showing the result of applying " { $link sq } " to the value 5:"
+    { $code
+        "USING: models gadgets-labels gadgets-panes ;"
+        "5 <model> [ sq ] <filter> [ number>string ] <filter>"
+        "<label-control> gadget."
+    }
+    "An exercise for the reader is to keep the original model around on the stack, and change its value to 6, observing that the label will immediately display 36."
+} ;
+
+HELP: <filter>
+{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( obj -- newobj )" } } { "filter" "a new " { $link filter } } }
+{ $description "Creates a new instance of " { $link filter } ". The value of the new filter model is computed by applying the quotation to the value." }
+{ $examples "See the example in the documentation for " { $link filter } "." } ;
+
+HELP: compose
+{ $class-description "Composed model values are computed by collecting the values from a sequence of underlying models into a new sequence. Composed models are automatically updated when underlying models change. Composed models are constructed by " { $link <compose> } "."
+$nl
+"A composed model whose children are all " { $link "models-range" } " conforms to the " { $link "range-model-protocol" } " and represents a point in n-dimensional space which is bounded by a rectangle." }
+{ $examples
+    "The following code displays a pair of sliders, and an updating label showing their current values:"
+    { $code
+        "USING: models ui.gadgets.labels ui.gadgets.sliders ui.gadgets.panes ;"
+        ": <funny-slider> <x-slider> 100 over set-slider-max ;"
+        "<funny-slider> <funny-slider> 2array"
+        "dup make-pile gadget."
+        "dup [ control-model ] map <compose> [ unparse ] <filter>"
+        "<label-control> gadget."
+    }
+} ;
+
+HELP: <compose>
+{ $values { "models" "a sequence of models" } { "compose" "a new " { $link compose } } }
+{ $description "Creates a new instance of " { $link compose } ". The value of the new compose model is obtained by mapping " { $link model-value } " over the given sequence of models." }
+{ $examples "See the example in the documentation for " { $link compose } "." } ;
+
+HELP: history
+{ $class-description "History models record a timeline of previous values on calls to " { $link add-history } ", and can travel back and forth on the timeline with " { $link go-back } " and " { $link go-forward } ". History models are constructed by " { $link <history> } "." } ;
+
+HELP: <history>
+{ $values { "value" object } { "history" "a new " { $link history } } }
+{ $description "Creates a new history model with an initial value." } ;
+
+{ <history> add-history go-back go-forward } related-words
+
+HELP: go-back
+{ $values { "history" history } }
+{ $description "Restores the previous value and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." } ;
+
+HELP: go-forward
+{ $values { "history" history } }
+{ $description "Restores the value set prior to the last call to " { $link go-back } " and calls " { $link model-changed } " on all observers registered with " { $link add-connection } "." } ;
+
+HELP: add-history
+{ $values { "history" history } }
+{ $description "Adds the current value to the history." } ;
+
+HELP: delay
+{ $class-description "Delay models have the same value as their underlying model, however the value only changes after a timer expires. If the underlying model's value changes again before the timer expires, the timer restarts. Delay models are constructed by " { $link <delay> } "." }
+{ $examples
+    "The following code displays a sliders and a label which is updated half a second after the slider stops changing:"
+    { $code
+        "USING: models gadgets-labels gadgets-sliders gadgets-panes ;"
+        ": <funny-slider>"
+        "    0 0 0 100 <range> <x-slider> 500 over set-slider-max ;"
+        "<funny-slider> dup gadget."
+        "control-model 500 <delay> [ number>string ] <filter>"
+        "<label-control> gadget."
+    }
+} ;
+
+HELP: <delay>
+{ $values { "model" model } { "timeout" "a positive integer" } { "delay" delay } }
+{ $description "Creates a new instance of " { $link delay } ". A timer of " { $snippet "timeout" } " milliseconds must elapse from the time the underlying model last changed to when the delay model value is changed and its connections are notified." }
+{ $examples "See the example in the documentation for " { $link delay } "." } ;
+
+HELP: range-value
+{ $values { "model" model } { "value" object } }
+{ $contract "Outputs the current value of a range model." } ;
+
+HELP: range-page-value
+{ $values { "model" model } { "value" object } }
+{ $contract "Outputs the page size of a range model." } ;
+
+HELP: range-min-value
+{ $values { "model" model } { "value" object } }
+{ $contract "Outputs the minimum value of a range model." } ;
+
+HELP: range-max-value
+{ $values { "model" model } { "value" object } }
+{ $contract "Outputs the maximum value of a range model." } ;
+
+HELP: range-max-value*
+{ $values { "model" model } { "value" object } }
+{ $contract "Outputs the slider position for a range model. Since the bottom of the slider cannot exceed the maximum value, this is equal to the maximum value minus the page size." } ;
+
+HELP: set-range-value
+{ $values { "value" object } { "model" model } }
+{ $description "Sets the current value of a range model." } 
+{ $side-effects "model" } ;
+
+HELP: set-range-page-value
+{ $values { "value" object } { "model" model } }
+{ $description "Sets the page size of a range model." } 
+{ $side-effects "model" } ;
+
+HELP: set-range-min-value
+{ $values { "value" object } { "model" model } }
+{ $description "Sets the minimum value of a range model." } 
+{ $side-effects "model" } ;
+
+HELP: set-range-max-value
+{ $values { "value" object } { "model" model } }
+{ $description "Sets the maximum value of a range model." }
+{ $side-effects "model" } ;
+
+HELP: range
+{ $class-description "Range models implement the " { $link "range-model-protocol" } " with real numbers as the minimum, current, maximum, and page size. Range models are created with " { $link <range> } "." }
+{ $notes { $link "ui.gadgets.sliders" } " use range models." } ;
+
+HELP: range-model
+{ $values { "range" range } { "model" model } }
+{ $description "Outputs a model holding a range model's current value." }
+{ $notes "This word is not part of the " { $link "range-model-protocol" } ", and can only be used on direct instances of " { $link range } "." } ;
+
+HELP: range-min
+{ $values { "range" range } { "model" model } }
+{ $description "Outputs a model holding a range model's minimum value." }
+{ $notes "This word is not part of the " { $link "range-model-protocol" } ", and can only be used on direct instances of " { $link range } "." } ;
+
+HELP: range-max
+{ $values { "range" range } { "model" model } }
+{ $description "Outputs a model holding a range model's maximum value." }
+{ $notes "This word is not part of the " { $link "range-model-protocol" } ", and can only be used on direct instances of " { $link range } "." } ;
+
+HELP: range-page
+{ $values { "range" range } { "model" model } }
+{ $description "Outputs a model holding a range model's page size." }
+{ $notes "This word is not part of the " { $link "range-model-protocol" } ", and can only be used on direct instances of " { $link range } "." } ;
+
+HELP: move-by
+{ $values { "amount" real } { "range" range } }
+{ $description "Adds a number to a range model's current value." }
+{ $side-effects "range" } ;
+
+HELP: move-by-page
+{ $values { "amount" real } { "range" range } }
+{ $description "Adds a multiple of the page size to a range model's current value." }
+{ $side-effects "range" } ;
+
+ARTICLE: "models" "Models"
+"The Factor UI provides basic support for dataflow programming via " { $emphasis "models" } " and " { $emphasis "controls" } ". A model is an observable value. Changing a model's value notifies other objects which depend on the model automatically, and models may depend on each other's values."
+$nl
+"Creating models:"
+{ $subsection <model> }
+"Adding and removing connections:"
+{ $subsection add-connection }
+{ $subsection remove-connection }
+"Generic word called on model connections when the model value changes:"
+{ $subsection model-changed }
+"When using models which are not associated with controls (or when unit testing controls), you must activate and deactivate models manually:"
+{ $subsection activate-model }
+{ $subsection deactivate-model }
+"Special types of models:"
+{ $subsection "models-filter" }
+{ $subsection "models-compose" }
+{ $subsection "models-history" }
+{ $subsection "models-delay" }
+{ $subsection "models-range" }
+{ $subsection "models-impl" } ;
+
+ARTICLE: "models-filter" "Filter models"
+"Filter model values are computed by applying a quotation to the value of another model."
+{ $subsection filter }
+{ $subsection <filter> } ;
+
+ARTICLE: "models-compose" "Composed models"
+"Composed model values are computed by collecting the values from a sequence of underlying models into a new sequence."
+{ $subsection compose }
+{ $subsection <compose> } ;
+
+ARTICLE: "models-history" "History models"
+"History models record previous values."
+{ $subsection history }
+{ $subsection <history> }
+"Recording history:"
+{ $subsection add-history }
+"Navigating the history:"
+{ $subsection go-back }
+{ $subsection go-forward } ;
+
+ARTICLE: "models-delay" "Delay models"
+"Delay models are used to implement delayed updating of gadgets in response to user input."
+{ $subsection delay }
+{ $subsection <delay> } ;
+
+ARTICLE: "models-range" "Range models"
+"Range models ensure their value is a real number within a fixed range."
+{ $subsection range }
+{ $subsection <range> }
+"Range models conform to a protocol for getting and setting the current value, as well as the endpoints of the range."
+{ $subsection "range-model-protocol" } ;
+
+ARTICLE: "range-model-protocol" "Range model protocol"
+"The range model protocol is implemented by the " { $link range } " and " { $link compose } " classes. User-defined models may implement it too."
+{ $subsection range-value          }
+{ $subsection range-page-value     } 
+{ $subsection range-min-value      } 
+{ $subsection range-max-value      } 
+{ $subsection range-max-value*     } 
+{ $subsection set-range-value      } 
+{ $subsection set-range-page-value } 
+{ $subsection set-range-min-value  } 
+{ $subsection set-range-max-value  } ;
+
+ARTICLE: "models-impl" "Implementing models"
+"New types of models can be defined, along the lines of " { $link filter } " and such."
+$nl
+"Models can execute hooks when activated:"
+{ $subsection model-activated }
+"Models can override requests to change their value, for example to perform validation:"
+{ $subsection set-model } ;
+
+ABOUT: "models"
diff --git a/extra/models/models-tests.factor b/extra/models/models-tests.factor
new file mode 100644 (file)
index 0000000..8e970d8
--- /dev/null
@@ -0,0 +1,108 @@
+IN: temporary
+USING: arrays generic kernel math models namespaces sequences
+tools.test ;
+
+TUPLE: model-tester hit? ;
+
+: <model-tester> model-tester construct-empty ;
+
+M: model-tester model-changed t swap set-model-tester-hit? ;
+
+[ T{ model-tester f t } ]
+[
+    T{ model-tester f f } 3 <model> 2dup add-connection
+    5 swap set-model
+] unit-test
+
+3 <model> "model-a" set
+4 <model> "model-b" set
+"model-a" get "model-b" get 2array <compose> "model-c" set
+
+"model-c" get activate-model
+[ { 3 4 } ] [ "model-c" get model-value  ] unit-test
+"model-c" get deactivate-model
+
+T{ model-tester f f } "tester" set
+
+[ T{ model-tester f t } { 6 4 } ]
+[
+    "tester" get "model-c" get add-connection
+    6 "model-a" get set-model
+    "tester" get
+    "model-c" get model-value
+] unit-test
+
+f <history> "history" set
+
+"history" get add-history
+
+[ t ] [ "history" get history-back empty? ] unit-test
+[ t ] [ "history" get history-forward empty? ] unit-test
+
+"history" get add-history
+3 "history" get set-model
+
+[ t ] [ "history" get history-back empty? ] unit-test
+[ t ] [ "history" get history-forward empty? ] unit-test
+
+"history" get add-history
+4 "history" get set-model
+
+[ f ] [ "history" get history-back empty? ] unit-test
+[ t ] [ "history" get history-forward empty? ] unit-test
+
+"history" get go-back
+
+[ 3 ] [ "history" get model-value ] unit-test
+
+[ t ] [ "history" get history-back empty? ] unit-test
+[ f ] [ "history" get history-forward empty? ] unit-test
+
+"history" get go-forward
+
+[ 4 ] [ "history" get model-value ] unit-test
+
+[ f ] [ "history" get history-back empty? ] unit-test
+[ t ] [ "history" get history-forward empty? ] unit-test
+
+! Test multiple filters
+3 <model> "x" set
+"x" get [ 2 * ] <filter> dup "z" set
+[ 1+ ] <filter> "y" set
+[ ] [ "y" get activate-model ] unit-test
+[ t ] [ "z" get "x" get model-connections memq? ] unit-test
+[ 7 ] [ "y" get model-value ] unit-test
+[ ] [ 4 "x" get set-model ] unit-test
+[ 9 ] [ "y" get model-value ] unit-test
+[ ] [ "y" get deactivate-model ] unit-test
+[ f ] [ "z" get "x" get model-connections memq? ] unit-test
+
+3 <model> "x" set
+"x" get [ sq ] <filter> "y" set
+
+4 "x" get set-model
+
+"y" get activate-model
+[ 16 ] [ "y" get model-value ] unit-test
+"y" get deactivate-model
+
+! Test compose
+[ ] [
+    1 <model> "a" set
+    2 <model> "b" set
+    "a" get "b" get 2array <compose> "c" set
+] unit-test
+
+[ ] [ "c" get activate-model ] unit-test
+
+[ { 1 2 } ] [ "c" get model-value ] unit-test
+
+[ ] [ 3 "b" get set-model ] unit-test
+
+[ { 1 3 } ] [ "c" get model-value ] unit-test
+
+[ ] [ { 4 5 } "c" get set-model ] unit-test
+
+[ { 4 5 } ] [ "c" get model-value ] unit-test
+
+[ ] [ "c" get deactivate-model ] unit-test
diff --git a/extra/models/models.factor b/extra/models/models.factor
new file mode 100644 (file)
index 0000000..04ae639
--- /dev/null
@@ -0,0 +1,234 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: generic kernel math sequences timers arrays ;
+IN: models
+
+TUPLE: model value connections dependencies ref ;
+
+: <model> ( value -- model )
+    V{ } clone V{ } clone 0 model construct-boa ;
+
+M: model equal? 2drop f ;
+
+M: model hashcode* drop model hashcode* ;
+
+: add-dependency ( dep model -- )
+    model-dependencies push ;
+
+: remove-dependency ( dep model -- )
+    model-dependencies delete ;
+
+DEFER: add-connection
+
+GENERIC: model-activated ( model -- )
+
+M: model model-activated drop ;
+
+: ref-model ( model -- n )
+    dup model-ref 1+ dup rot set-model-ref ;
+
+: unref-model ( model -- n )
+    dup model-ref 1- dup rot set-model-ref ;
+
+: activate-model ( model -- )
+    dup ref-model 1 = [
+        dup model-dependencies
+        [ dup activate-model dupd add-connection ] each
+        model-activated
+    ] [
+        drop
+    ] if ;
+
+DEFER: remove-connection
+
+: deactivate-model ( model -- )
+    dup unref-model zero? [
+        dup model-dependencies
+        [ dup deactivate-model remove-connection ] curry* each
+    ] [
+        drop
+    ] if ;
+
+GENERIC: model-changed ( observer -- )
+
+: add-connection ( observer model -- )
+    dup model-connections empty? [ dup activate-model ] when
+    model-connections push ;
+
+: remove-connection ( observer model -- )
+    [ model-connections delete ] keep
+    dup model-connections empty? [ dup deactivate-model ] when
+    drop ;
+
+GENERIC: set-model ( value model -- )
+
+M: model set-model
+    [ set-model-value ] keep
+    model-connections [ model-changed ] each ;
+
+: ((change-model)) ( model quot -- newvalue model )
+    over >r >r model-value r> call r> ; inline
+
+: change-model ( model quot -- )
+    ((change-model)) set-model ; inline
+
+: (change-model) ( model quot -- )
+    ((change-model)) set-model-value ; inline
+
+: construct-model ( value class -- instance )
+    >r <model> { set-delegate } r> construct ; inline
+
+TUPLE: filter model quot ;
+
+: <filter> ( model quot -- filter )
+    f filter construct-model
+    [ set-filter-quot ] keep
+    [ set-filter-model ] 2keep
+    [ add-dependency ] keep ;
+
+M: filter model-changed
+    dup filter-model model-value over filter-quot call
+    swap set-model ;
+
+M: filter model-activated model-changed ;
+
+TUPLE: compose ;
+
+: <compose> ( models -- compose )
+    f compose construct-model
+    swap clone over set-model-dependencies ;
+
+: composed-value >r model-dependencies r> map ; inline
+
+: set-composed-value >r model-dependencies r> 2each ; inline
+
+M: compose model-changed
+    dup [ model-value ] composed-value swap delegate set-model ;
+
+M: compose model-activated model-changed ;
+
+M: compose set-model [ set-model ] set-composed-value ;
+
+TUPLE: history back forward ;
+
+: reset-history ( history -- )
+    V{ } clone over set-history-back
+    V{ } clone swap set-history-forward ;
+
+: <history> ( value -- history )
+    history construct-model dup reset-history ;
+
+: (add-history)
+    swap model-value dup [ swap push ] [ 2drop ] if ;
+
+: go-back/forward ( history to from -- )
+    dup empty?
+    [ 3drop ]
+    [ >r dupd (add-history) r> pop swap set-model ] if ;
+
+: go-back ( history -- )
+    dup history-forward over history-back go-back/forward ;
+
+: go-forward ( history -- )
+    dup history-back over history-forward go-back/forward ;
+
+: add-history ( history -- )
+    dup history-forward delete-all
+    dup history-back (add-history) ;
+
+TUPLE: delay model timeout ;
+
+: update-delay-model ( delay -- )
+    dup delay-model model-value swap set-model ;
+
+: <delay> ( model timeout -- delay )
+    f delay construct-model
+    [ set-delay-timeout ] keep
+    [ set-delay-model ] 2keep
+    [ add-dependency ] keep
+    dup update-delay-model ;
+
+M: delay model-changed 0 over delay-timeout add-timer ;
+
+M: delay model-activated update-delay-model ;
+
+M: delay tick dup remove-timer update-delay-model ;
+
+GENERIC: range-value ( model -- value )
+GENERIC: range-page-value ( model -- value )
+GENERIC: range-min-value ( model -- value )
+GENERIC: range-max-value ( model -- value )
+GENERIC: range-max-value* ( model -- value )
+GENERIC: set-range-value ( value model -- )
+GENERIC: set-range-page-value ( value model -- )
+GENERIC: set-range-min-value ( value model -- )
+GENERIC: set-range-max-value ( value model -- )
+
+TUPLE: range ;
+
+: <range> ( value min max page -- range )
+    4array [ <model> ] map <compose>
+    { set-delegate } range construct ;
+
+: range-model ( range -- model ) model-dependencies first ;
+: range-page ( range -- model ) model-dependencies second ;
+: range-min ( range -- model ) model-dependencies third ;
+: range-max ( range -- model ) model-dependencies fourth ;
+
+: clamp-value ( value range -- newvalue )
+    [ range-min-value max ] keep
+    range-max-value* min ;
+
+M: range range-value
+    [ range-model model-value ] keep clamp-value ;
+
+M: range range-page-value range-page model-value ;
+
+M: range range-min-value range-min model-value ;
+
+M: range range-max-value range-max model-value ;
+
+M: range range-max-value*
+    dup range-max-value swap range-page-value [-] ;
+
+M: range set-range-value range-model set-model ;
+
+M: range set-range-page-value range-page set-model ;
+
+M: range set-range-min-value range-min set-model ;
+
+M: range set-range-max-value range-max set-model ;
+
+M: compose range-value
+    [ range-value ] composed-value ;
+
+M: compose range-page-value
+    [ range-page-value ] composed-value ;
+
+M: compose range-min-value
+    [ range-min-value ] composed-value ;
+
+M: compose range-max-value
+    [ range-max-value ] composed-value ;
+
+M: compose range-max-value*
+    [ range-max-value* ] composed-value ;
+
+M: compose set-range-value
+    [ clamp-value ] keep
+    [ set-range-value ] set-composed-value ;
+
+M: compose set-range-page-value
+    [ set-range-page-value ] set-composed-value ;
+
+M: compose set-range-min-value
+    [ set-range-min-value ] set-composed-value ;
+
+M: compose set-range-max-value
+    [ set-range-max-value ] set-composed-value ;
+
+: move-by ( amount range -- )
+    [ range-value + ] keep set-range-value ;
+
+: move-by-page ( amount range -- )
+    [ range-page-value * ] keep move-by ;
diff --git a/extra/models/summary.txt b/extra/models/summary.txt
new file mode 100644 (file)
index 0000000..f409da5
--- /dev/null
@@ -0,0 +1 @@
+Observable slots which can be composed in various ways
diff --git a/extra/models/tags.txt b/extra/models/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/mortar/authors.txt b/extra/mortar/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/mortar/mortar.factor b/extra/mortar/mortar.factor
new file mode 100644 (file)
index 0000000..e7ef0de
--- /dev/null
@@ -0,0 +1,187 @@
+
+USING: kernel io parser words namespaces quotations arrays assocs sequences
+       splitting math shuffle ;
+
+IN: mortar
+
+! class { name slots methods class-methods }
+
+: class-name ( class -- name ) dup symbol? [ get ] when first ;
+
+: class-slots ( class -- slots ) dup symbol? [ get ] when second ;
+
+: class-methods ( class -- methods ) dup symbol? [ get ] when third ;
+
+: class-class-methods ( class -- methods ) dup symbol? [ get ] when fourth ;
+
+: class? ( thing -- ? )
+dup array?
+[ dup length 4 = [ first symbol? ] [ drop f ] if ]
+[ drop f ]
+if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: add-method ( class name quot -- )
+rot get class-methods peek swapd set-at ;
+
+: add-class-method ( class name quot -- )
+rot get class-class-methods peek swapd set-at ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! object { class values }
+
+: object-class ( object -- class ) first ;
+
+: object-values ( object -- values ) second ;
+
+: object? ( thing -- ? )
+dup array?
+[ dup length 2 = [ first class? ] [ drop f ] if ]
+[ drop f ]
+if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: is? ( object class -- ? ) swap object-class class-name = ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USE: inference.transforms
+
+! : narray ( n -- array ) [ drop ] map reverse ;
+
+: [narray] ( n -- quot ) [ [ drop ] map reverse ] curry ;
+
+: narray ( n -- array ) [narray] call ;
+
+\ narray [ [narray] ] 1 define-transform
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: new ( class -- object )
+get dup >r class-slots length narray r> swap 2array ;
+
+: new-empty ( class -- object )
+get dup >r class-slots length f <array> r> swap 2array ;
+
+! : new* ( class -- object ) new-empty <- init ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: slot-value ( object slot -- value )
+over object-class class-slots index swap object-values nth ;
+
+: set-slot-value ( object slot value -- object )
+swap pick object-class class-slots index pick object-values set-nth ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : send-message ( object message -- )
+! over object-class class-methods assoc-stack call ;
+
+: send-message ( object message -- )
+2dup swap object-class class-methods assoc-stack dup
+[ nip call ]
+! [ drop nip "message not understood: " write print flush ]
+[ drop "message not understood: " write print drop ]
+if ;
+
+: <- scan parsed \ send-message parsed ; parsing
+
+! : send-message* ( message n -- )
+! 1+ npick object-class class-methods assoc-stack call ;
+
+: send-message* ( message n -- )
+1+ npick dupd object-class class-methods assoc-stack dup
+[ nip call ]
+[ drop "message not understood: " write print flush ]
+if ;
+
+: <--   scan parsed 2 parsed \ send-message* parsed ; parsing
+
+: <---  scan parsed 3 parsed \ send-message* parsed ; parsing
+
+: <---- scan parsed 4 parsed \ send-message* parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: send-message-to-class ( class message -- )
+over class-class-methods assoc-stack call ;
+
+: <<- scan parsed \ send-message-to-class parsed ; parsing
+
+: send-message-to-class* ( message n -- )
+1+ npick class-class-methods assoc-stack call ;
+
+: <<-- scan parsed 2 parsed \ send-message-to-class* parsed ; parsing
+
+: <<--- scan parsed 3 parsed \ send-message-to-class* parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: send-message-next ( object message -- )
+over object-class class-methods 1 head* assoc-stack call ;
+
+: <-~ scan parsed \ send-message-next parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: new* ( class -- object ) <<- create ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+IN: slot-accessors
+
+IN: mortar
+
+: generate-slot-getter ( name -- )
+"$" over append "slot-accessors" create swap [ slot-value ] curry
+define-compound ;
+
+: generate-slot-setter ( name -- )
+">>" over append "slot-accessors" create swap [ swap set-slot-value ] curry
+define-compound ;
+
+: generate-slot-accessors ( name -- )
+dup
+generate-slot-getter
+generate-slot-setter ;
+
+: accessors ( seq -- seq ) dup peek [ generate-slot-accessors ] each ; parsing
+
+! : slots:
+! ";" parse-tokens dup [ generate-slot-accessors ] each parsed ; parsing
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : <symbol> ( string -- symbol ) in get create dup define-symbol ;
+
+: empty-method-table ( -- array ) H{ } clone 1array ;
+
+! : define-simple-class ( name parent slots -- )
+! >r >r <symbol>
+! r> dup class-slots r> append
+! swap dup class-methods empty-method-table append
+! swap class-class-methods empty-method-table append
+! 4array dup first set-global ;
+
+: define-simple-class ( name parent slots -- )
+>r dup class-slots r> append
+swap dup class-methods empty-method-table append
+swap class-class-methods empty-method-table append
+4array dup first set-global ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: define-independent-class ( name slots -- )
+empty-method-table empty-method-table 4array dup first set-global ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: add-methods ( class seq -- ) 2 group [ first2 add-method ] curry* each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: !( ")" parse-tokens drop ; parsing
\ No newline at end of file
diff --git a/extra/mortar/tags.txt b/extra/mortar/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/msxml-to-csv/authors.txt b/extra/msxml-to-csv/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/msxml-to-csv/msxml-to-csv.factor b/extra/msxml-to-csv/msxml-to-csv.factor
new file mode 100644 (file)
index 0000000..dcd2819
--- /dev/null
@@ -0,0 +1,18 @@
+USING: io io.files sequences xml xml.utilities ;
+IN: msxml-to-csv
+
+: print-csv ( table -- ) [ "," join print ] each ;
+
+: (msxml>csv) ( xml -- table )
+    "Worksheet" tag-named
+    "Table" tag-named
+    "Row" tags-named [
+        "Cell" tags-named [
+            "Data" tag-named children>string
+        ] map
+    ] map ;
+
+: msxml>csv ( infile outfile -- )
+    <file-writer> [
+        file>xml (msxml>csv) print-csv
+    ] with-stream ;
diff --git a/extra/msxml-to-csv/summary.txt b/extra/msxml-to-csv/summary.txt
new file mode 100644 (file)
index 0000000..358f5e9
--- /dev/null
@@ -0,0 +1 @@
+Converting MSXML to comma separated values demo
diff --git a/extra/msxml-to-csv/tags.txt b/extra/msxml-to-csv/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/namespaces/lib/authors.txt b/extra/namespaces/lib/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/namespaces/lib/lib.factor b/extra/namespaces/lib/lib.factor
new file mode 100644 (file)
index 0000000..79a4855
--- /dev/null
@@ -0,0 +1,19 @@
+
+! USING: kernel quotations namespaces sequences hashtables.lib ;
+
+USING: kernel namespaces namespaces.private quotations sequences
+       hashtables.lib ;
+
+IN: namespaces.lib
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: save-namestack ( quot -- ) namestack >r call r> set-namestack ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make* ( seq -- seq ) [ dup quotation? [ call ] [ ] if ] map ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set* ( val var -- ) namestack* set-hash-stack ;
\ No newline at end of file
diff --git a/extra/namespaces/lib/summary.txt b/extra/namespaces/lib/summary.txt
new file mode 100644 (file)
index 0000000..ec8129b
--- /dev/null
@@ -0,0 +1 @@
+Non-core namespace words
diff --git a/extra/namespaces/lib/tags.txt b/extra/namespaces/lib/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/nehe/2/2.factor b/extra/nehe/2/2.factor
new file mode 100644 (file)
index 0000000..1084a33
--- /dev/null
@@ -0,0 +1,46 @@
+USING: arrays kernel math opengl opengl.gl opengl.glu ui
+ui.gadgets ui.render ;
+IN: nehe.2
+
+TUPLE: nehe2-gadget ;
+
+: width 256 ;
+: height 256 ;
+
+: <nehe2-gadget> (  -- gadget )
+  nehe2-gadget construct-gadget ;
+
+M: nehe2-gadget pref-dim* ( gadget -- dim )
+  drop width height 2array ;
+
+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 ;
+
+: run2 ( -- )
+  <nehe2-gadget> "NeHe Tutorial 2" open-window ;
diff --git a/extra/nehe/3/3.factor b/extra/nehe/3/3.factor
new file mode 100644 (file)
index 0000000..fff5838
--- /dev/null
@@ -0,0 +1,50 @@
+USING: arrays kernel math opengl opengl.gl opengl.glu ui
+ui.gadgets ui.render ;
+IN: nehe.3
+
+TUPLE: nehe3-gadget ;
+
+: width 256 ;
+: height 256 ;
+
+: <nehe3-gadget> (  -- gadget )
+  nehe3-gadget construct-gadget ;
+
+M: nehe3-gadget pref-dim* ( gadget -- dim )
+  drop width height 2array ;
+
+M: nehe3-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 [
+    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
+  3.0 0.0 0.0 glTranslatef
+  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 ;
+
+: run3 ( -- )
+  <nehe3-gadget> "NeHe Tutorial 3" open-window ;
diff --git a/extra/nehe/4/4.factor b/extra/nehe/4/4.factor
new file mode 100644 (file)
index 0000000..39bf984
--- /dev/null
@@ -0,0 +1,74 @@
+USING: arrays kernel math opengl opengl.gl opengl.glu ui
+ui.gadgets ui.render threads ;
+IN: nehe.4
+
+TUPLE: nehe4-gadget rtri rquad thread quit? ;
+
+: width 256 ;
+: height 256 ;
+: redraw-interval 10 ;
+
+: <nehe4-gadget> (  -- gadget )
+  nehe4-gadget construct-gadget
+  0.0 over set-nehe4-gadget-rtri
+  0.0 over set-nehe4-gadget-rquad ;
+
+M: nehe4-gadget pref-dim* ( gadget -- dim )
+  drop width height 2array ;
+
+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 nehe4-gadget-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
+
+  glLoadIdentity
+
+  1.5 0.0 -6.0 glTranslatef
+  dup nehe4-gadget-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 
+  dup nehe4-gadget-rtri 0.2 + over set-nehe4-gadget-rtri
+  dup nehe4-gadget-rquad 0.15 - swap set-nehe4-gadget-rquad ;
+  
+: nehe4-update-thread ( gadget -- )  
+  dup nehe4-gadget-quit? [
+    redraw-interval sleep 
+    dup relayout-1  
+    nehe4-update-thread 
+  ] unless ;
+
+M: nehe4-gadget graft* ( gadget -- )
+ [ f swap set-nehe4-gadget-quit? ] keep
+ [ nehe4-update-thread ] in-thread drop ;
+
+M: nehe4-gadget ungraft* ( gadget -- )
+ t swap set-nehe4-gadget-quit? ;
+
+: run4 ( -- )
+  <nehe4-gadget> "NeHe Tutorial 4" open-window ;
diff --git a/extra/nehe/5/5.factor b/extra/nehe/5/5.factor
new file mode 100644 (file)
index 0000000..a792f04
--- /dev/null
@@ -0,0 +1,125 @@
+USING: arrays kernel math opengl opengl.gl opengl.glu ui\r
+ui.gadgets ui.render threads ;\r
+IN: nehe.5\r
+\r
+TUPLE: nehe5-gadget rtri rquad thread quit? ;\r
+: width 256 ;\r
+: height 256 ;\r
+: redraw-interval 10 ;\r
+\r
+: <nehe5-gadget> (  -- gadget )\r
+  nehe5-gadget construct-gadget\r
+  0.0 over set-nehe5-gadget-rtri\r
+  0.0 over set-nehe5-gadget-rquad ;\r
+\r
+M: nehe5-gadget pref-dim* ( gadget -- dim )\r
+  drop width height 2array ;\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 nehe5-gadget-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 nehe5-gadget-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
+  dup nehe5-gadget-rtri 0.2 + over set-nehe5-gadget-rtri\r
+  dup nehe5-gadget-rquad 0.15 - swap set-nehe5-gadget-rquad ;\r
+\r
+: nehe5-update-thread ( gadget -- )  \r
+  dup nehe5-gadget-quit? [\r
+    redraw-interval sleep \r
+    dup relayout-1  \r
+    nehe5-update-thread \r
+  ] unless ;\r
+\r
+M: nehe5-gadget graft* ( gadget -- )\r
+ [ f swap set-nehe5-gadget-quit? ] keep\r
+ [ nehe5-update-thread ] in-thread drop ;\r
+\r
+M: nehe5-gadget ungraft* ( gadget -- )\r
+ t swap set-nehe5-gadget-quit? ;\r
+\r
+\r
+: run5 ( -- )\r
+  <nehe5-gadget> "NeHe Tutorial 5" open-window ;\r
diff --git a/extra/nehe/authors.txt b/extra/nehe/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/nehe/deploy.factor b/extra/nehe/deploy.factor
new file mode 100644 (file)
index 0000000..4a3c7ef
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? t }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { strip-c-types? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? t }
+    { "bundle-name" "NeHe Demos.app" }
+}
diff --git a/extra/nehe/nehe.factor b/extra/nehe/nehe.factor
new file mode 100644 (file)
index 0000000..51eb129
--- /dev/null
@@ -0,0 +1,15 @@
+USING: ui.gadgets.buttons ui.gadgets.packs ui.gadgets ui
+nehe.2 nehe.3 nehe.4 nehe.5 kernel ;
+IN: nehe
+
+: nehe-window
+    [
+        [
+            "Nehe 2" [ drop run2 ] <bevel-button> gadget,
+            "Nehe 3" [ drop run3 ] <bevel-button> gadget,
+            "Nehe 4" [ drop run4 ] <bevel-button> gadget,
+            "Nehe 5" [ drop run5 ] <bevel-button> gadget,
+        ] make-filled-pile "Nehe examples" open-window
+    ] with-ui ;
+
+MAIN: nehe-window
diff --git a/extra/nehe/summary.txt b/extra/nehe/summary.txt
new file mode 100644 (file)
index 0000000..7811f84
--- /dev/null
@@ -0,0 +1 @@
+NeHe OpenGL tutorials ported to Factor
diff --git a/extra/nehe/tags.txt b/extra/nehe/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/numbers-game/authors.txt b/extra/numbers-game/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/numbers-game/numbers-game.factor b/extra/numbers-game/numbers-game.factor
new file mode 100644 (file)
index 0000000..9336aa6
--- /dev/null
@@ -0,0 +1,27 @@
+USING: kernel math math.parser random io ;
+IN: numbers-game
+
+: read-number ( -- n ) readln string>number ;
+
+: guess-banner
+    "I'm thinking of a number between 0 and 100." print ;
+: guess-prompt "Enter your guess: " write ;
+: too-high "Too high" print ;
+: too-low "Too low" print ;
+: correct "Correct - you win!" print ;
+
+: inexact-guess ( actual guess -- )
+     < [ too-high ] [ too-low ] if ;
+
+: judge-guess ( actual guess -- ? )
+    2dup = [ 2drop correct f ] [ inexact-guess t ] if ;
+
+: number-to-guess ( -- n ) 100 random ;
+
+: numbers-game-loop ( actual -- )
+    dup guess-prompt read-number judge-guess
+    [ numbers-game-loop ] [ drop ] if ;
+
+: numbers-game number-to-guess numbers-game-loop ;
+
+MAIN: numbers-game
diff --git a/extra/numbers-game/summary.txt b/extra/numbers-game/summary.txt
new file mode 100644 (file)
index 0000000..9682b10
--- /dev/null
@@ -0,0 +1 @@
+Number guessing game demo
diff --git a/extra/numbers-game/tags.txt b/extra/numbers-game/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/odbc/authors.txt b/extra/odbc/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/odbc/odbc-docs.factor b/extra/odbc/odbc-docs.factor
new file mode 100644 (file)
index 0000000..b6915a0
--- /dev/null
@@ -0,0 +1,97 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.syntax help.markup odbc threads ;\r
+\r
+HELP: odbc-init \r
+{ $values { "env" "an ODBC environment handle" } } \r
+{ $description \r
+  "Initializes the ODBC driver manager and returns the " \r
+  "environment handle required by " { $link odbc-connect } "."\r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-connect \r
+{ $values { "env" "an ODBC environment handle" } { "dsn" "a string" } { "dbc" "an ODBC database connection handle" } } \r
+{ $description \r
+  "Connects to the database identified by the ODBC data source name (DSN). " \r
+  "The environment handle is usually obtained by a call to " { $link odbc-init } ". The result is the ODBC connection handle which can be used in other ODBC calls. When finished with the connection handle " { $link odbc-disconnect } " must be called on it."\r
+} \r
+{ $examples { $code "dbc get \"DSN=mydsn\" odbc-connect" } }\r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-disconnect \r
+{ $values { "dbc" "an ODBC database connection handle" } } \r
+{ $description \r
+  "Disconnects from the given database." \r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-prepare\r
+{ $values { "dbc" "an ODBC database connection handle" } { "string" "a string containing SQL" } { "statement" "an ODBC statement handle" } } \r
+{ $description \r
+  "Prepares (precompiles) the given SQL string, ready for execution with " { $link odbc-execute } ". When finished with the statement " { $link odbc-free-statement } " must be called on it." \r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-free-statement\r
+{ $values { "statement" "an ODBC statement handle" } } \r
+{ $description \r
+  "Closes the statement handle and frees up all resources associated with it." \r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-execute\r
+{ $values { "statement" "an ODBC statement handle" } } \r
+{ $description \r
+  "Executes the statement. Once this is done " { $link odbc-next-row } " can be called to retrieve rows." \r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-next-row\r
+{ $values { "statement" "an ODBC statement handle" } { "bool" "a boolean indicating success or failure" } } \r
+{ $description \r
+  "Retrieves the next available row from the database. If no next row is available then " { $link f } " is returned. Once the row is retrieved " { $link odbc-number-of-columns } ", " { $link odbc-describe-column } ", " { $link odbc-get-field } " and " { $link odbc-get-row-fields } " can be used to query the data retrieved." \r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-number-of-columns\r
+{ $values { "statement" "an ODBC statement handle" } { "number" "a number" } } \r
+{ $description \r
+    "Returns the number of columns of data retrieved."\r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-describe-column\r
+{ $values { "statement" "an ODBC statement handle" } { "n" "a column number starting from one" } { "column" "a column object" } } \r
+{ $description \r
+    "Retrieves column information for the given column number from the statement. The column number must be one or greater. The " { $link <column> } " object returned provides data type, name, etc."\r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-get-field\r
+{ $values { "statement" "an ODBC statement handle" } { "column" "a column number starting from one or a <column> object" } { "field" "a <field> object" } } \r
+{ $description \r
+    "Returns a field object which contains the data for the field in the given column in the current row. The column can be identified by a number or a <column> object. The datatype of the contents of the field depends on the type of the column itself. Note that this word can only be safely called once on each column in a given row with most ODBC drivers. Subsequent calls on the same row for the same column can fail."\r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-get-row-fields\r
+{ $values { "statement" "an ODBC statement handle" } { "seq" "a sequence" } } \r
+{ $description \r
+    "Returns a sequence of all field data for the current row. Note that this isnot the <field> objects, but the data for that field. This word can only be called once on a given row. Subsequent calls on the same row may fail on some ODBC drivers."\r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-get-all-rows\r
+{ $values { "statement" "an ODBC statement handle" } { "seq" "a sequence" } } \r
+{ $description \r
+    "Returns a sequence of all rows available from the statement. Effectively it is the contents of the entire query so may take some time and memory. Each element of the sequence is itself a sequence containing the data for that row. A " { $link yield } " is performed an various intervals so as to not lock up the Factor instance while it is running."\r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
+\r
+HELP: odbc-query\r
+{ $values { "string" "a string containing SQL" } { "dsn" "a DSN string" } { "result" "a sequence" } }  \r
+{ $description \r
+    "This word initializes odbc, connects to the database with the given DSN, executes the query string and returns the result as a sequence. It cleans up all resources it uses. It is an inefficient way of running multiple queries but is useful for the occasional query, testing at the REPL, or as an example of how to do it."\r
+} \r
+{ $see-also odbc-init odbc-connect odbc-disconnect odbc-prepare odbc-free-statement odbc-execute odbc-next-row odbc-number-of-columns odbc-describe-column odbc-get-field odbc-get-row-fields odbc-get-all-rows odbc-query } ;\r
diff --git a/extra/odbc/odbc.factor b/extra/odbc/odbc.factor
new file mode 100644 (file)
index 0000000..daa63a2
--- /dev/null
@@ -0,0 +1,270 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: kernel alien alien.syntax combinators alien.c-types\r
+       strings sequences namespaces words math threads ;\r
+IN: odbc\r
+\r
+"odbc" "odbc32.dll" "stdcall" add-library\r
+\r
+LIBRARY: odbc\r
+\r
+TYPEDEF: void* usb_dev_handle*\r
+TYPEDEF: short SQLRETURN\r
+TYPEDEF: short SQLSMALLINT\r
+TYPEDEF: short* SQLSMALLINT*\r
+TYPEDEF: ushort SQLUSMALLINT\r
+TYPEDEF: uint* SQLUINTEGER*\r
+TYPEDEF: int SQLINTEGER\r
+TYPEDEF: char SQLCHAR\r
+TYPEDEF: char* SQLCHAR*\r
+TYPEDEF: void* SQLHANDLE\r
+TYPEDEF: void* SQLHANDLE*\r
+TYPEDEF: void* SQLHENV\r
+TYPEDEF: void* SQLHDBC\r
+TYPEDEF: void* SQLHSTMT\r
+TYPEDEF: void* SQLHWND\r
+TYPEDEF: void* SQLPOINTER\r
+\r
+: SQL-HANDLE-ENV  ( -- number ) 1 ; inline\r
+: SQL-HANDLE-DBC  ( -- number ) 2 ; inline\r
+: SQL-HANDLE-STMT ( -- number ) 3 ; inline\r
+: SQL-HANDLE-DESC ( -- number ) 4 ; inline\r
+\r
+: SQL-NULL-HANDLE ( -- alien ) f ; inline\r
+\r
+: SQL-ATTR-ODBC-VERSION ( -- number ) 200 ; inline\r
+\r
+: SQL-OV-ODBC2 ( -- number ) 2 <alien> ; inline\r
+: SQL-OV-ODBC3 ( -- number ) 3 <alien> ; inline\r
+\r
+: SQL-SUCCESS ( -- number ) 0 ; inline\r
+: SQL-SUCCESS-WITH-INFO ( -- number ) 1 ; inline\r
+: SQL-NO-DATA-FOUND ( -- number ) 100 ; inline\r
+\r
+: SQL-DRIVER-NOPROMPT ( -- number ) 0 ; inline\r
+: SQL-DRIVER-PROMPT ( -- number ) 2 ; inline\r
+\r
+: SQL-C-DEFAULT ( -- number ) 99 ; inline\r
+\r
+SYMBOL: SQL-CHAR\r
+SYMBOL: SQL-VARCHAR\r
+SYMBOL: SQL-LONGVARCHAR\r
+SYMBOL: SQL-WCHAR\r
+SYMBOL: SQL-WCHARVAR\r
+SYMBOL: SQL-WLONGCHARVAR\r
+SYMBOL: SQL-DECIMAL\r
+SYMBOL: SQL-SMALLINT\r
+SYMBOL: SQL-NUMERIC\r
+SYMBOL: SQL-INTEGER\r
+SYMBOL: SQL-REAL\r
+SYMBOL: SQL-FLOAT\r
+SYMBOL: SQL-DOUBLE\r
+SYMBOL: SQL-BIT\r
+SYMBOL: SQL-TINYINT\r
+SYMBOL: SQL-BIGINT\r
+SYMBOL: SQL-BINARY\r
+SYMBOL: SQL-VARBINARY\r
+SYMBOL: SQL-LONGVARBINARY\r
+SYMBOL: SQL-TYPE-DATE\r
+SYMBOL: SQL-TYPE-TIME\r
+SYMBOL: SQL-TYPE-TIMESTAMP\r
+SYMBOL: SQL-TYPE-UTCDATETIME\r
+SYMBOL: SQL-TYPE-UTCTIME\r
+SYMBOL: SQL-INTERVAL-MONTH\r
+SYMBOL: SQL-INTERVAL-YEAR\r
+SYMBOL: SQL-INTERVAL-YEAR-TO-MONTH\r
+SYMBOL: SQL-INTERVAL-DAY\r
+SYMBOL: SQL-INTERVAL-HOUR\r
+SYMBOL: SQL-INTERVAL-MINUTE\r
+SYMBOL: SQL-INTERVAL-SECOND\r
+SYMBOL: SQL-INTERVAL-DAY-TO-HOUR\r
+SYMBOL: SQL-INTERVAL-DAY-TO-MINUTE\r
+SYMBOL: SQL-INTERVAL-DAY-TO-SECOND\r
+SYMBOL: SQL-INTERVAL-HOUR-TO-MINUTE\r
+SYMBOL: SQL-INTERVAL-HOUR-TO-SECOND\r
+SYMBOL: SQL-INTERVAL-MINUTE-TO-SECOND\r
+SYMBOL: SQL-GUID\r
+SYMBOL: SQL-TYPE-UNKNOWN\r
+\r
+: convert-sql-type ( number -- symbol )\r
+  {\r
+    { [ dup 1 = ] [ drop SQL-CHAR ] }\r
+    { [ dup 12 = ] [ drop SQL-VARCHAR ] }\r
+    { [ dup -1 = ] [ drop SQL-LONGVARCHAR ] }\r
+    { [ dup -8 = ] [ drop SQL-WCHAR ] }\r
+    { [ dup -9 = ] [ drop SQL-WCHARVAR ] }\r
+    { [ dup -10 = ] [ drop SQL-WLONGCHARVAR ] }\r
+    { [ dup 3 = ] [ drop SQL-DECIMAL ] }\r
+    { [ dup 5 = ] [ drop SQL-SMALLINT ] }\r
+    { [ dup 2 = ] [ drop SQL-NUMERIC ] }\r
+    { [ dup 4 = ] [ drop SQL-INTEGER ] }\r
+    { [ dup 7 = ] [ drop SQL-REAL ] }\r
+    { [ dup 6 = ] [ drop SQL-FLOAT ] }\r
+    { [ dup 8 = ] [ drop SQL-DOUBLE ] }\r
+    { [ dup -7 = ] [ drop SQL-BIT ] }\r
+    { [ dup -6 = ] [ drop SQL-TINYINT ] }\r
+    { [ dup -5 = ] [ drop SQL-BIGINT ] }\r
+    { [ dup -2 = ] [ drop SQL-BINARY ] }\r
+    { [ dup -3 = ] [ drop SQL-VARBINARY ] }   \r
+    { [ dup -4 = ] [ drop SQL-LONGVARBINARY ] }\r
+    { [ dup 91 = ] [ drop SQL-TYPE-DATE ] }\r
+    { [ dup 92 = ] [ drop SQL-TYPE-TIME ] }\r
+    { [ dup 93 = ] [ drop SQL-TYPE-TIMESTAMP ] }\r
+    { [ t ] [ drop SQL-TYPE-UNKNOWN ] }\r
+  } cond ;\r
+\r
+: succeeded? ( n -- bool )\r
+  #! Did the call succeed (SQL-SUCCESS or SQL-SUCCESS-WITH-INFO)\r
+  {\r
+    { [ dup SQL-SUCCESS = ] [ drop t ] }\r
+    { [ dup SQL-SUCCESS-WITH-INFO = ] [ drop t ] }\r
+    { [ t ] [ drop f ] }\r
+  } cond ;  \r
+\r
+FUNCTION: SQLRETURN SQLAllocHandle ( SQLSMALLINT handleType, SQLHANDLE inputHandle, SQLHANDLE* outputHandlePtr ) ;\r
+FUNCTION: SQLRETURN SQLSetEnvAttr ( SQLHENV environmentHandle, SQLINTEGER attribute, SQLPOINTER valuePtr, SQLINTEGER stringLength ) ;\r
+FUNCTION: SQLRETURN SQLDriverConnect ( SQLHDBC connectionHandle, SQLHWND windowHandle, SQLCHAR* inConnectionString, SQLSMALLINT stringLength, SQLCHAR* outConnectionString, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength2Ptr, SQLUSMALLINT driverCompletion ) ; \r
+FUNCTION: SQLRETURN SQLDisconnect ( SQLHDBC connectionHandle ) ;\r
+FUNCTION: SQLRETURN SQLPrepare ( SQLHSTMT statementHandle, SQLCHAR* statementText, SQLINTEGER length ) ;\r
+FUNCTION: SQLRETURN SQLExecute ( SQLHSTMT statementHandle ) ;\r
+FUNCTION: SQLRETURN SQLFreeHandle ( SQLSMALLINT handleType, SQLHANDLE handle ) ;\r
+FUNCTION: SQLRETURN SQLFetch ( SQLHSTMT statementHandle ) ;\r
+FUNCTION: SQLRETURN SQLNumResultCols ( SQLHSTMT statementHandle, SQLSMALLINT* columnCountPtr ) ;\r
+FUNCTION: SQLRETURN SQLDescribeCol ( SQLHSTMT statementHandle, SQLSMALLINT columnNumber, SQLCHAR* columnName, SQLSMALLINT bufferLength, SQLSMALLINT* nameLengthPtr, SQLSMALLINT* dataTypePtr, SQLUINTEGER* columnSizePtr, SQLSMALLINT* decimalDigitsPtr, SQLSMALLINT* nullablePtr ) ;\r
+FUNCTION: SQLRETURN SQLGetData ( SQLHSTMT statementHandle, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValuePtr, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_indPtr ) ;\r
+\r
+: alloc-handle ( type parent -- handle )\r
+  f <void*> [ SQLAllocHandle ] keep swap succeeded? [\r
+    *void*\r
+  ] [\r
+    drop f\r
+  ] if ;\r
+\r
+: alloc-env-handle ( -- handle )\r
+  SQL-HANDLE-ENV SQL-NULL-HANDLE alloc-handle ;\r
+\r
+: alloc-dbc-handle ( env -- handle )\r
+  SQL-HANDLE-DBC swap alloc-handle ;\r
+\r
+: alloc-stmt-handle ( dbc -- handle )\r
+  SQL-HANDLE-STMT swap alloc-handle ;\r
+\r
+: temp-string ( length -- byte-array length )\r
+  [ CHAR: \space  <string> string>char-alien ] keep ;\r
+\r
+: odbc-init ( -- env )\r
+  alloc-env-handle\r
+  [ \r
+    SQL-ATTR-ODBC-VERSION SQL-OV-ODBC3 0 SQLSetEnvAttr \r
+    succeeded? [ "odbc-init failed" throw ] unless\r
+  ] keep ;\r
+\r
+: odbc-connect ( env dsn -- dbc )\r
+   >r alloc-dbc-handle dup r> \r
+   f swap dup length 1024 temp-string 0 <short> SQL-DRIVER-NOPROMPT \r
+   SQLDriverConnect succeeded? [ "odbc-connect failed" throw ] unless ;\r
+\r
+: odbc-disconnect ( dbc -- )\r
+  SQLDisconnect succeeded? [ "odbc-disconnect failed" throw ] unless ;     \r
+\r
+: odbc-prepare ( dbc string -- statement )\r
+  >r alloc-stmt-handle dup r> dup length SQLPrepare succeeded? [ "odbc-prepare failed" throw ] unless ;\r
+\r
+: odbc-free-statement ( statement -- )\r
+  SQL-HANDLE-STMT swap SQLFreeHandle succeeded? [ "odbc-free-statement failed" throw ] unless ;\r
+\r
+: odbc-execute ( statement --  )\r
+  SQLExecute succeeded? [ "odbc-execute failed" throw ] unless ;\r
+\r
+: odbc-next-row ( statement -- bool )\r
+  SQLFetch succeeded? ;\r
+\r
+: odbc-number-of-columns ( statement -- number )\r
+  0 <short> [ SQLNumResultCols succeeded? ] keep swap [\r
+    *short\r
+  ] [\r
+    drop f\r
+  ] if ;\r
+\r
+TUPLE: column nullable digits size type name number ;\r
+\r
+C: <column> column\r
+\r
+: odbc-describe-column ( statement n -- column )\r
+  dup >r\r
+  1024 CHAR: \space <string> string>char-alien dup >r\r
+  1024 \r
+  0 <short>\r
+  0 <short> dup >r\r
+  0 <uint> dup >r\r
+  0 <short> dup >r\r
+  0 <short> dup >r\r
+  SQLDescribeCol succeeded? [\r
+    r> *short \r
+    r> *short \r
+    r> *uint \r
+    r> *short convert-sql-type \r
+    r> alien>char-string \r
+    r> <column> \r
+  ] [\r
+    r> drop r> drop r> drop r> drop r> drop r> drop\r
+    "odbc-describe-column failed" throw\r
+  ] if ;\r
+\r
+: dereference-type-pointer ( byte-array column -- object )\r
+  column-type {\r
+    { [ dup SQL-CHAR = ] [ drop alien>char-string ] }\r
+    { [ dup SQL-VARCHAR = ] [ drop alien>char-string ] }\r
+    { [ dup SQL-LONGVARCHAR = ] [ drop alien>char-string ] }\r
+    { [ dup SQL-WCHAR = ] [ drop alien>char-string ] }\r
+    { [ dup SQL-WCHARVAR = ] [ drop alien>char-string ] }\r
+    { [ dup SQL-WLONGCHARVAR = ] [ drop alien>char-string ] }\r
+    { [ dup SQL-SMALLINT = ] [ drop *short ] }\r
+    { [ dup SQL-INTEGER = ] [ drop *long ] }\r
+    { [ dup SQL-REAL = ] [ drop *float ] }\r
+    { [ dup SQL-FLOAT = ] [ drop *double ] }\r
+    { [ dup SQL-DOUBLE = ] [ drop *double ] }\r
+    { [ dup SQL-TINYINT = ] [ drop *char  ] }\r
+    { [ dup SQL-BIGINT = ] [ drop *longlong ] }\r
+    { [ t ] [ nip [ "Unknown SQL Type: " % word-name % ] "" make ] }    \r
+  } cond ;\r
+\r
+TUPLE: field value column ;\r
+\r
+C: <field> field\r
+\r
+: odbc-get-field ( statement column -- field )\r
+  dup column? [ dupd odbc-describe-column ] unless dup >r column-number\r
+  SQL-C-DEFAULT\r
+  8192 CHAR: \space <string> string>char-alien dup >r\r
+  8192 \r
+  f SQLGetData succeeded? [\r
+    r> r> [ dereference-type-pointer ] keep <field>\r
+  ] [\r
+    r> drop r> [ \r
+      "SQLGetData Failed for Column: " % \r
+      dup column-name % \r
+      " of type: " % dup column-type word-name %\r
+    ] "" make swap <field>\r
+  ] if ;\r
+\r
+: odbc-get-row-fields ( statement -- seq )\r
+  [\r
+    dup odbc-number-of-columns [\r
+      1+ odbc-get-field field-value ,\r
+    ] curry* each \r
+  ] { } make ;\r
+\r
+: (odbc-get-all-rows) ( statement -- )\r
+  dup odbc-next-row [ dup odbc-get-row-fields , yield (odbc-get-all-rows) ] [ drop ] if ; \r
+    \r
+: odbc-get-all-rows ( statement -- seq )\r
+  [ (odbc-get-all-rows) ] { } make ;\r
+  \r
+: odbc-query ( string dsn -- result )\r
+  odbc-init swap odbc-connect [\r
+    swap odbc-prepare\r
+    dup odbc-execute\r
+    dup odbc-get-all-rows\r
+    swap odbc-free-statement\r
+  ] keep odbc-disconnect ;
\ No newline at end of file
diff --git a/extra/odbc/summary.txt b/extra/odbc/summary.txt
new file mode 100644 (file)
index 0000000..36e5997
--- /dev/null
@@ -0,0 +1 @@
+ODBC (Open DataBase Connectivity) binding
diff --git a/extra/odbc/tags.txt b/extra/odbc/tags.txt
new file mode 100644 (file)
index 0000000..aa0d57e
--- /dev/null
@@ -0,0 +1 @@
+database
diff --git a/extra/ogg/authors.txt b/extra/ogg/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/ogg/ogg.factor b/extra/ogg/ogg.factor
new file mode 100644 (file)
index 0000000..9d66478
--- /dev/null
@@ -0,0 +1,133 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel system combinators alien alien.syntax ;
+IN: ogg
+
+: load-ogg-library ( -- )
+    "ogg" {
+        { [ win32? ]  [ "ogg.dll" ] }
+        { [ macosx? ] [ "libogg.0.dylib" ] }
+        { [ unix? ]   [ "libogg.so" ] }
+    } cond "cdecl" add-library ; parsing
+
+load-ogg-library
+
+LIBRARY: ogg
+
+C-STRUCT: oggpack_buffer
+    { "long" "endbyte" }
+    { "int" "endbit" }
+    { "uchar*" "buffer" }
+    { "uchar*" "ptr" }
+    { "long" "storage" } ;
+
+C-STRUCT: ogg_page
+    { "uchar*" "header" }
+    { "long" "header_len" }
+    { "uchar*" "body" }
+    { "long" "body_len" } ;
+
+C-STRUCT: ogg_stream_state
+    { "uchar*" "body_data" }
+    { "long" "body_storage" }
+    { "long" "body_fill" }
+    { "long" "body_returned" }
+    { "int*" "lacing_vals" } 
+    { "longlong*" "granule_vals" }
+    { "long" "lacing_storage" }
+    { "long" "lacing_fill" }
+    { "long" "lacing_packet" }
+    { "long" "lacing_returned" }
+    { { "uchar" 282 } "header" }
+    { "int" "header_fill" }
+    { "int" "e_o_s" }
+    { "int" "b_o_s" }
+    { "long" "serialno" }
+    { "long" "pageno" }
+    { "longlong" "packetno" }
+    { "longlong" "granulepos" } ;
+
+C-STRUCT: ogg_packet
+    { "uchar*" "packet" }
+    { "long" "bytes" }
+    { "long" "b_o_s" }
+    { "long" "e_o_s" }
+    { "longlong" "granulepos" }
+    { "longlong" "packetno" } ;
+
+C-STRUCT: ogg_sync_state
+    { "uchar*" "data" }
+    { "int" "storage" }
+    { "int" "fill" }  
+    { "int" "returned" }
+    { "int" "unsynced" }
+    { "int" "headerbytes" }
+    { "int" "bodybytes" } ;
+
+FUNCTION: void oggpack_writeinit ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpack_writetrunc ( oggpack_buffer* b, long bits ) ;
+FUNCTION: void  oggpack_writealign ( oggpack_buffer* b) ;
+FUNCTION: void  oggpack_writecopy ( oggpack_buffer* b, void* source, long bits ) ;
+FUNCTION: void  oggpack_reset ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpack_writeclear ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpack_readinit ( oggpack_buffer* b, uchar* buf, int bytes ) ;
+FUNCTION: void  oggpack_write ( oggpack_buffer* b, ulong value, int bits ) ;
+FUNCTION: long  oggpack_look ( oggpack_buffer* b, int bits ) ;
+FUNCTION: long  oggpack_look1 ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpack_adv ( oggpack_buffer* b, int bits ) ;
+FUNCTION: void  oggpack_adv1 ( oggpack_buffer* b ) ;
+FUNCTION: long  oggpack_read ( oggpack_buffer* b, int bits ) ;
+FUNCTION: long  oggpack_read1 ( oggpack_buffer* b ) ;
+FUNCTION: long  oggpack_bytes ( oggpack_buffer* b ) ;
+FUNCTION: long  oggpack_bits ( oggpack_buffer* b ) ;
+FUNCTION: uchar* oggpack_get_buffer ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpackB_writeinit ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpackB_writetrunc ( oggpack_buffer* b, long bits ) ;
+FUNCTION: void  oggpackB_writealign ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpackB_writecopy ( oggpack_buffer* b, void* source, long bits ) ;
+FUNCTION: void  oggpackB_reset ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpackB_writeclear ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpackB_readinit ( oggpack_buffer* b, uchar* buf, int bytes ) ;
+FUNCTION: void  oggpackB_write ( oggpack_buffer* b, ulong value, int bits ) ;
+FUNCTION: long  oggpackB_look ( oggpack_buffer* b, int bits ) ;
+FUNCTION: long  oggpackB_look1 ( oggpack_buffer* b ) ;
+FUNCTION: void  oggpackB_adv ( oggpack_buffer* b, int bits ) ;
+FUNCTION: void  oggpackB_adv1 ( oggpack_buffer* b ) ;
+FUNCTION: long  oggpackB_read ( oggpack_buffer* b, int bits ) ;
+FUNCTION: long  oggpackB_read1 ( oggpack_buffer* b ) ;
+FUNCTION: long  oggpackB_bytes ( oggpack_buffer* b ) ;
+FUNCTION: long  oggpackB_bits ( oggpack_buffer* b ) ;
+FUNCTION: uchar* oggpackB_get_buffer ( oggpack_buffer* b ) ;
+FUNCTION: int      ogg_stream_packetin ( ogg_stream_state* os, ogg_packet* op ) ;
+FUNCTION: int      ogg_stream_pageout ( ogg_stream_state* os, ogg_page* og ) ;
+FUNCTION: int      ogg_stream_flush ( ogg_stream_state* os, ogg_page* og ) ;
+FUNCTION: int      ogg_sync_init ( ogg_sync_state* oy ) ;
+FUNCTION: int      ogg_sync_clear ( ogg_sync_state* oy ) ;
+FUNCTION: int      ogg_sync_reset ( ogg_sync_state* oy ) ;
+FUNCTION: int  ogg_sync_destroy ( ogg_sync_state* oy ) ;
+
+FUNCTION: void* ogg_sync_buffer ( ogg_sync_state* oy, long size ) ;
+FUNCTION: int      ogg_sync_wrote ( ogg_sync_state* oy, long bytes ) ;
+FUNCTION: long     ogg_sync_pageseek ( ogg_sync_state* oy, ogg_page* og ) ;
+FUNCTION: int      ogg_sync_pageout ( ogg_sync_state* oy, ogg_page* og ) ;
+FUNCTION: int      ogg_stream_pagein ( ogg_stream_state* os, ogg_page* og ) ;
+FUNCTION: int      ogg_stream_packetout ( ogg_stream_state* os, ogg_packet* op ) ;
+FUNCTION: int      ogg_stream_packetpeek ( ogg_stream_state* os, ogg_packet* op ) ;
+FUNCTION: int      ogg_stream_init (ogg_stream_state* os, int serialno ) ;
+FUNCTION: int      ogg_stream_clear ( ogg_stream_state* os ) ;
+FUNCTION: int      ogg_stream_reset ( ogg_stream_state* os ) ;
+FUNCTION: int      ogg_stream_reset_serialno ( ogg_stream_state* os, int serialno ) ;
+FUNCTION: int      ogg_stream_destroy ( ogg_stream_state* os ) ;
+FUNCTION: int      ogg_stream_eos ( ogg_stream_state* os ) ;
+FUNCTION: void     ogg_page_checksum_set ( ogg_page* og ) ;
+FUNCTION: int      ogg_page_version ( ogg_page* og ) ;
+FUNCTION: int      ogg_page_continued ( ogg_page* og ) ;
+FUNCTION: int      ogg_page_bos ( ogg_page* og ) ;
+FUNCTION: int      ogg_page_eos ( ogg_page* og ) ;
+FUNCTION: longlong  ogg_page_granulepos ( ogg_page* og ) ;
+FUNCTION: int      ogg_page_serialno ( ogg_page* og ) ;
+FUNCTION: long     ogg_page_pageno ( ogg_page* og ) ;
+FUNCTION: int      ogg_page_packets ( ogg_page* og ) ;
+FUNCTION: void     ogg_packet_clear ( ogg_packet* op ) ;
+
diff --git a/extra/ogg/player/authors.txt b/extra/ogg/player/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/ogg/player/player.factor b/extra/ogg/player/player.factor
new file mode 100644 (file)
index 0000000..08731f7
--- /dev/null
@@ -0,0 +1,624 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+! TODO: \r
+!   based on number of channels in file.\r
+! - End of decoding is indicated by an exception when reading the stream.\r
+!   How to work around this? C player example uses feof but streams don't\r
+!   have that in Factor.\r
+! - Work out openal buffer method that plays nicely with streaming over\r
+!   slow connections.\r
+! - Have start/stop/seek methods on the player object.\r
+!\r
+USING: kernel alien ogg ogg.vorbis ogg.theora io byte-arrays\r
+       sequences libc shuffle alien.c-types system openal math\r
+       namespaces threads shuffle opengl arrays ui.gadgets.worlds\r
+       combinators math.parser ui.gadgets ui.render opengl.gl ui\r
+       continuations io.files hints combinators.lib ;\r
+\r
+IN: ogg.player\r
+\r
+: audio-buffer-size ( -- number ) 128 1024 *  ; inline\r
+\r
+TUPLE: player stream temp-state \r
+       op oy og \r
+       vo vi vd vb vc vorbis\r
+       to ti tc td yuv rgb theora video-ready? video-time video-granulepos\r
+       source buffers buffer-indexes start-time\r
+       playing? audio-full? audio-index audio-buffer audio-granulepos \r
+       gadget ;\r
+\r
+: init-vorbis ( player -- )\r
+    dup player-oy ogg_sync_init drop\r
+    dup player-vi vorbis_info_init \r
+    player-vc vorbis_comment_init ;\r
+\r
+: init-theora ( player -- )\r
+    dup player-ti theora_info_init \r
+    player-tc theora_comment_init ;\r
+\r
+: init-sound ( player -- )\r
+    init-openal check-error\r
+    1 gen-buffers check-error over set-player-buffers\r
+    2 "uint" <c-array> over set-player-buffer-indexes\r
+    1 gen-sources check-error first swap set-player-source ;\r
+\r
+: <player> ( stream -- player )\r
+    { set-player-stream } player construct\r
+    0 over set-player-vorbis \r
+    0 over set-player-theora \r
+    0 over set-player-video-time \r
+    0 over set-player-video-granulepos \r
+    f over set-player-video-ready?\r
+    f over set-player-audio-full?\r
+    0 over set-player-audio-index    \r
+    0 over set-player-start-time    \r
+    audio-buffer-size "short" <c-array> over set-player-audio-buffer\r
+    0 over set-player-audio-granulepos\r
+    f over set-player-playing?\r
+    "ogg_packet" malloc-object over set-player-op\r
+    "ogg_sync_state" malloc-object over set-player-oy \r
+    "ogg_page" malloc-object over set-player-og\r
+    "ogg_stream_state" malloc-object over set-player-vo\r
+    "vorbis_info" malloc-object over set-player-vi\r
+    "vorbis_dsp_state" malloc-object over set-player-vd\r
+    "vorbis_block" malloc-object over set-player-vb\r
+    "vorbis_comment" malloc-object over set-player-vc \r
+    "ogg_stream_state" malloc-object over set-player-to\r
+    "theora_info" malloc-object over set-player-ti\r
+    "theora_comment" malloc-object over set-player-tc\r
+    "theora_state" malloc-object over set-player-td \r
+    "yuv_buffer" <c-object> over set-player-yuv\r
+    "ogg_stream_state" <c-object> over set-player-temp-state\r
+    dup init-sound\r
+    dup init-vorbis \r
+    dup init-theora ;\r
+\r
+: num-channels ( player -- channels )\r
+    player-vi vorbis_info-channels ;\r
+    \r
+: al-channel-format ( player -- format )\r
+    num-channels 1 = [ AL_FORMAT_MONO16 ] [ AL_FORMAT_STEREO16 ] if ;\r
+\r
+: get-time ( player -- time )\r
+    dup player-start-time zero? [\r
+        millis over set-player-start-time\r
+    ] when \r
+    player-start-time millis swap - 1000.0 /f ;\r
+\r
+: clamp ( n -- n )\r
+    255 min 0 max ; inline\r
+\r
+: stride ( line yuv  -- uvy yy )\r
+    [ yuv_buffer-uv_stride >fixnum swap 2/ * ] 2keep\r
+    yuv_buffer-y_stride >fixnum * >fixnum ; inline\r
+\r
+: each-with4 ( obj obj obj obj seq quot -- )\r
+    4 each-withn ; inline\r
+\r
+: compute-y ( yuv uvy yy x -- y )\r
+    + >fixnum nip swap yuv_buffer-y uchar-nth 16 - ; inline\r
+\r
+: compute-v ( yuv uvy yy x -- v )\r
+    nip 2/ + >fixnum swap yuv_buffer-u uchar-nth 128 - ; inline\r
+\r
+: compute-u ( yuv uvy yy x -- v )\r
+    nip 2/ + >fixnum swap yuv_buffer-v uchar-nth 128 - ; inline\r
+\r
+: compute-yuv ( yuv uvy yy x -- y u v )\r
+    [ compute-y ] 4keep [ compute-u ] 4keep compute-v ; inline\r
+\r
+: compute-blue ( y u v -- b )\r
+    drop 516 * 128 + swap 298 * + -8 shift clamp ; inline\r
+\r
+: compute-green ( y u v -- g )\r
+    >r >r 298 * r> 100 * - r> 208 * - 128 + -8 shift clamp ;\r
+    inline\r
+\r
+: compute-red ( y u v -- g )\r
+    nip 409 * swap 298 * + 128 + -8 shift clamp ; inline\r
+\r
+: compute-rgb ( y u v -- b g r )\r
+    [ compute-blue ] 3keep [ compute-green ] 3keep compute-red ;\r
+    inline\r
+\r
+: store-rgb ( index rgb b g r -- index )\r
+    >r\r
+    >r pick 0 + >fixnum pick set-uchar-nth\r
+    r> pick 1 + >fixnum pick set-uchar-nth\r
+    r> pick 2 + >fixnum pick set-uchar-nth\r
+    drop ; inline\r
+\r
+: yuv>rgb-pixel ( index rgb yuv uvy yy x -- index )\r
+    compute-yuv compute-rgb store-rgb 3 + >fixnum ; inline\r
+\r
+: yuv>rgb-row ( index rgb yuv y -- index )\r
+    over stride\r
+    pick yuv_buffer-y_width >fixnum\r
+    [ yuv>rgb-pixel ] each-with4 ; inline\r
+\r
+: yuv>rgb ( rgb yuv  -- )\r
+    0 -rot\r
+    dup yuv_buffer-y_height >fixnum\r
+    [ yuv>rgb-row ] each-with2\r
+    drop ;\r
+\r
+HINTS: yuv>rgb byte-array byte-array ;\r
+\r
+: process-video ( player -- player )\r
+    dup player-gadget [\r
+        dup { player-td player-yuv } get-slots theora_decode_YUVout drop\r
+        dup player-rgb over player-yuv yuv>rgb\r
+        dup player-gadget find-world dup draw-world \r
+    ] when ;\r
+\r
+: num-audio-buffers-processed ( player -- player n )\r
+    dup player-source AL_BUFFERS_PROCESSED 0 <uint> \r
+    [ alGetSourcei check-error ] keep *uint ;\r
+    \r
+: append-new-audio-buffer ( player -- player )\r
+    dup player-buffers 1 gen-buffers append over set-player-buffers \r
+    [ dup >r player-buffers second r> al-channel-format ] keep\r
+    [ player-audio-buffer dup length  ] keep\r
+    [ player-vi vorbis_info-rate alBufferData check-error ]  keep \r
+    [ player-source 1 ] keep\r
+    [ player-buffers second <uint> alSourceQueueBuffers check-error ] keep ;\r
+\r
+: fill-processed-audio-buffer ( player n -- player )\r
+    #! n is the number of audio buffers processed \r
+    over >r >r dup player-source r> pick player-buffer-indexes\r
+    [ alSourceUnqueueBuffers check-error ] keep \r
+    *uint dup r> swap >r al-channel-format rot \r
+    [ player-audio-buffer dup length  ] keep\r
+    [ player-vi vorbis_info-rate alBufferData check-error ]  keep \r
+    [ player-source 1 ] keep\r
+    r> <uint> swap >r alSourceQueueBuffers check-error r> ;\r
+\r
+: append-audio ( player -- player bool )\r
+    num-audio-buffers-processed {\r
+        { [ over player-buffers length 1 = over zero? and ] [ drop append-new-audio-buffer t ] }\r
+        { [ over player-buffers length 2 = over zero? and ] [ 0 sleep drop f ] }\r
+        { [ t ] [ fill-processed-audio-buffer t ] }\r
+    } cond ;    \r
+\r
+: start-audio ( player -- player bool )\r
+    [ dup >r player-buffers first r> al-channel-format ] keep\r
+    [ player-audio-buffer dup length ] keep\r
+    [ player-vi vorbis_info-rate alBufferData check-error ]  keep \r
+    [ player-source 1 ] keep\r
+    [ player-buffers first <uint> alSourceQueueBuffers check-error ] keep\r
+    [ player-source alSourcePlay check-error ] keep\r
+    t over set-player-playing? t ;\r
+\r
+: process-audio ( player -- player bool )\r
+    dup player-playing? [ append-audio ] [ start-audio ] if ;\r
+\r
+: read-bytes-into ( dest size stream -- len )\r
+    #! Read the given number of bytes from a stream\r
+    #! and store them in the destination byte array.\r
+    stream-read >byte-array dup length [ memcpy ] keep  ;\r
+\r
+: check-not-negative ( int -- )\r
+    0 < [ "Word result was a negative number." throw ] when ;\r
+\r
+: buffer-size ( -- number ) \r
+    4096 ; inline\r
+\r
+: sync-buffer ( player -- buffer size player )\r
+    [ player-oy buffer-size ogg_sync_buffer buffer-size ] keep ;\r
\r
+: stream-into-buffer ( buffer size player -- len player )\r
+    [ player-stream read-bytes-into ] keep ;\r
+\r
+: confirm-buffer ( len player -- player eof? )\r
+  [ player-oy swap ogg_sync_wrote check-not-negative ] 2keep swap zero? ;\r
+\r
+: buffer-data ( player -- player eof? )\r
+    #! Take some compressed bitstream data and sync it for\r
+    #! page extraction.\r
+    sync-buffer stream-into-buffer confirm-buffer ;\r
+     \r
+: queue-page ( player -- player )\r
+    #! Push a page into the stream for packetization\r
+    [ { player-vo player-og } get-slots ogg_stream_pagein drop ] keep \r
+    [ { player-to player-og } get-slots ogg_stream_pagein drop ] keep ;\r
+\r
+: retrieve-page ( player -- player bool )\r
+    #! Sync the streams and get a page. Return true if a page was\r
+    #! successfully retrieved.\r
+    dup { player-oy player-og } get-slots ogg_sync_pageout 0 > ;   \r
+\r
+: standard-initial-header? ( player -- player bool )\r
+    dup player-og ogg_page_bos zero? not ;\r
+\r
+: ogg-stream-init ( player -- state player )\r
+    #! Init the encode/decode logical stream state\r
+    [ player-temp-state ] keep \r
+    [ player-og ogg_page_serialno ogg_stream_init check-not-negative ] 2keep ;\r
+\r
+: ogg-stream-pagein ( state player -- state player )\r
+    #! Add the incoming page to the stream state\r
+    [ player-og ogg_stream_pagein drop ] 2keep ;\r
+\r
+: ogg-stream-packetout ( state player -- state player )\r
+    [ player-op ogg_stream_packetout drop ] 2keep ;\r
+\r
+: decode-packet ( player -- state player )\r
+    ogg-stream-init ogg-stream-pagein ogg-stream-packetout ;\r
+\r
+: theora-header? ( player -- player bool )\r
+    #! Is the current page a theora header?\r
+    dup { player-ti player-tc player-op } get-slots theora_decode_header 0 >= ;\r
+\r
+: is-theora-packet? ( player -- player bool )\r
+    dup player-theora zero? [ theora-header? ] [ f ] if ;\r
+\r
+: copy-to-theora-state ( state player -- player )\r
+    #! Copy the state to the theora state structure in the player\r
+    [ player-to swap dup length memcpy ] keep ;\r
+\r
+: handle-initial-theora-header ( state player -- player )\r
+    copy-to-theora-state 1 over set-player-theora ;\r
+\r
+: vorbis-header? ( player -- player bool )\r
+    #! Is the current page a vorbis header?\r
+    dup { player-vi player-vc player-op } get-slots vorbis_synthesis_headerin 0 >= ;\r
+\r
+: is-vorbis-packet? ( player -- player bool )\r
+    dup player-vorbis zero? [ vorbis-header? ] [ f ] if ;\r
\r
+: copy-to-vorbis-state ( state player -- player )\r
+    #! Copy the state to the vorbis state structure in the player\r
+    [ player-vo swap dup length memcpy ] keep ;\r
\r
+: handle-initial-vorbis-header ( state player -- player )\r
+    copy-to-vorbis-state 1 over set-player-vorbis ;\r
+\r
+: handle-initial-unknown-header ( state player -- player )\r
+    swap ogg_stream_clear drop ;\r
+\r
+: process-initial-header ( player -- player bool )\r
+    #! Is this a standard initial header? If not, stop parsing\r
+    standard-initial-header? [\r
+        decode-packet {\r
+            { [ is-vorbis-packet? ] [ handle-initial-vorbis-header ] }\r
+            { [ is-theora-packet? ] [ handle-initial-theora-header ] }\r
+            { [ t ]                 [ handle-initial-unknown-header ] }\r
+        } cond t\r
+    ] [\r
+        f\r
+    ] if ;\r
+\r
+: parse-initial-headers ( player -- player )\r
+    #! Parse Vorbis headers, ignoring any other type stored\r
+    #! in the Ogg container.\r
+    retrieve-page [\r
+        process-initial-header [ \r
+            parse-initial-headers\r
+        ] [\r
+            #! Don't leak the page, get it into the appropriate stream\r
+            queue-page \r
+        ] if        \r
+    ] [ \r
+        buffer-data not [ parse-initial-headers ] when\r
+    ] if ;\r
+  \r
+: have-required-vorbis-headers? ( player -- player bool )\r
+    #! Return true if we need to decode vorbis due to there being\r
+    #! vorbis headers read from the stream but we don't have them all\r
+    #! yet.\r
+    dup player-vorbis 1 2 between? not ;\r
+\r
+: have-required-theora-headers? ( player -- player bool )\r
+    #! Return true if we need to decode theora due to there being\r
+    #! theora headers read from the stream but we don't have them all\r
+    #! yet.\r
+    dup player-theora 1 2 between? not ;\r
+\r
+: get-remaining-vorbis-header-packet ( player -- player bool )\r
+    dup { player-vo player-op } get-slots ogg_stream_packetout {\r
+        { [ dup 0 <   ] [ "Error parsing vorbis stream; corrupt stream?" throw ] }\r
+        { [ dup zero? ] [ drop f ] }\r
+        { [ t     ] [ drop t ] }\r
+    } cond ;\r
+\r
+: get-remaining-theora-header-packet ( player -- player bool )\r
+    dup { player-to player-op } get-slots ogg_stream_packetout {\r
+        { [ dup 0 <   ] [ "Error parsing theora stream; corrupt stream?" throw ] }\r
+        { [ dup zero? ] [ drop f ] }\r
+        { [ t     ] [ drop t ] }\r
+    } cond ;\r
+\r
+: decode-remaining-vorbis-header-packet ( player -- player )\r
+    dup { player-vi player-vc player-op } get-slots vorbis_synthesis_headerin zero? [\r
+        "Error parsing vorbis stream; corrupt stream?" throw\r
+    ] unless ;\r
+\r
+: decode-remaining-theora-header-packet ( player -- player )\r
+    dup { player-ti player-tc player-op } get-slots theora_decode_header zero? [\r
+        "Error parsing theora stream; corrupt stream?" throw\r
+    ] unless ;\r
+\r
+: increment-vorbis-header-count ( player -- player )\r
+    dup player-vorbis 1+ over set-player-vorbis ;\r
+\r
+: increment-theora-header-count ( player -- player )\r
+    dup player-theora 1+ over set-player-theora ;\r
+\r
+: parse-remaining-vorbis-headers ( player -- player )\r
+    have-required-vorbis-headers? not [\r
+        get-remaining-vorbis-header-packet [\r
+            decode-remaining-vorbis-header-packet\r
+            increment-vorbis-header-count\r
+            parse-remaining-vorbis-headers  \r
+        ] when \r
+    ] when ;\r
+\r
+: parse-remaining-theora-headers ( player -- player )\r
+    have-required-theora-headers? not [\r
+        get-remaining-theora-header-packet [\r
+            decode-remaining-theora-header-packet \r
+            increment-theora-header-count\r
+            parse-remaining-theora-headers  \r
+        ] when \r
+    ] when ;\r
+\r
+: get-more-header-data ( player -- player )\r
+    buffer-data drop ;\r
+\r
+: parse-remaining-headers ( player -- player )\r
+    have-required-vorbis-headers? not swap have-required-theora-headers? not swapd or [\r
+        parse-remaining-vorbis-headers \r
+        parse-remaining-theora-headers\r
+        retrieve-page [ queue-page ] [ get-more-header-data ] if\r
+        parse-remaining-headers\r
+    ] when ;\r
+   \r
+: tear-down-vorbis ( player -- player )\r
+    dup player-vi vorbis_info_clear\r
+    dup player-vc vorbis_comment_clear ;\r
+\r
+: tear-down-theora ( player -- player )\r
+    dup player-ti theora_info_clear\r
+    dup player-tc theora_comment_clear ;\r
+\r
+: init-vorbis-codec ( player -- player )\r
+    dup { player-vd player-vi } get-slots vorbis_synthesis_init drop\r
+    dup { player-vd player-vb } get-slots vorbis_block_init drop ;\r
+\r
+: init-theora-codec ( player -- player )\r
+    dup { player-td player-ti } get-slots theora_decode_init drop \r
+    dup player-ti theora_info-frame_width over player-ti theora_info-frame_height \r
+    4 * * <byte-array> over set-player-rgb ;\r
+\r
+\r
+: display-vorbis-details ( player -- player )\r
+    [\r
+        "Ogg logical stream " %\r
+        dup player-vo ogg_stream_state-serialno #\r
+        " is Vorbis " %\r
+        dup player-vi vorbis_info-channels #\r
+        " channel " %\r
+        dup player-vi vorbis_info-rate #\r
+        " Hz audio." %\r
+    ] "" make print ;\r
+\r
+: display-theora-details ( player -- player )\r
+    [\r
+        "Ogg logical stream " %\r
+        dup player-to ogg_stream_state-serialno #\r
+        " is Theora " %\r
+        dup player-ti theora_info-width #\r
+        "x" %\r
+        dup player-ti theora_info-height #\r
+        " " %\r
+        dup player-ti theora_info-fps_numerator \r
+        over player-ti theora_info-fps_denominator /f #\r
+        " fps video" %\r
+    ] "" make print ;\r
+\r
+: initialize-decoder ( player -- player )\r
+    dup player-vorbis zero? [ tear-down-vorbis ] [ init-vorbis-codec display-vorbis-details ] if \r
+    dup player-theora zero? [ tear-down-theora ] [ init-theora-codec display-theora-details ] if ;\r
+  \r
+: sync-pages ( player -- player )\r
+    retrieve-page [\r
+        queue-page sync-pages \r
+    ] when ;\r
+\r
+: audio-buffer-not-ready? ( player -- player bool )\r
+    dup player-vorbis zero? not over player-audio-full? not and ;\r
+  \r
+: pending-decoded-audio? ( player -- player pcm len bool )\r
+    f <void*> 2dup >r player-vd r> vorbis_synthesis_pcmout dup 0 > ;\r
+\r
+: buffer-space-available ( player -- available )\r
+    audio-buffer-size swap player-audio-index - ;\r
+    \r
+: samples-to-read ( player available len -- numread )\r
+    >r swap num-channels / r> min ;\r
+    \r
+: each-with3 ( obj obj obj seq quot -- ) 3 each-withn ; inline \r
+\r
+: add-to-buffer ( player val -- )\r
+    over player-audio-index pick player-audio-buffer set-short-nth \r
+    dup player-audio-index 1+ swap set-player-audio-index ;\r
+\r
+: get-audio-value ( pcm sample channel -- value )\r
+    rot *void* void*-nth float-nth ;\r
+\r
+: process-channels ( player pcm sample channel -- )\r
+    get-audio-value 32767.0 * >fixnum 32767 min -32768 max add-to-buffer ;\r
+\r
+: (process-sample) ( player pcm sample -- )\r
+    pick num-channels [ process-channels ] each-with3 ;\r
\r
+: process-samples ( player pcm numread -- )\r
+    [ (process-sample) ] each-with2 ;\r
+\r
+: decode-pending-audio ( player pcm result -- player )\r
+!     [ "ret = " % dup # ] "" make write\r
+    pick [ buffer-space-available swap ] keep -rot samples-to-read \r
+    pick over >r >r process-samples r> r> swap\r
+    ! numread player \r
+    dup player-audio-index audio-buffer-size = [\r
+        t over set-player-audio-full?\r
+    ] when\r
+    dup player-vd vorbis_dsp_state-granulepos dup 0 >= [\r
+        ! numtoread player granulepos\r
+        #! This is wrong: fix\r
+        pick - over set-player-audio-granulepos\r
+    ] [\r
+        ! numtoread player granulepos\r
+        pick + over set-player-audio-granulepos\r
+    ] if\r
+    [ player-vd swap vorbis_synthesis_read drop ] keep ;\r
+\r
+: no-pending-audio ( player -- player bool )\r
+    #! No pending audio. Is there a pending packet to decode.\r
+    dup { player-vo player-op } get-slots ogg_stream_packetout 0 > [\r
+        dup { player-vb player-op } get-slots vorbis_synthesis 0 = [\r
+            dup { player-vd player-vb } get-slots vorbis_synthesis_blockin drop\r
+        ] when\r
+        t \r
+    ] [\r
+        #! Need more data. Break out to suck in another page.\r
+        f \r
+    ] if ;\r
+\r
+: decode-audio ( player -- player )\r
+    audio-buffer-not-ready? [\r
+        #! If there's pending decoded audio, grab it\r
+        pending-decoded-audio? [\r
+            decode-pending-audio decode-audio\r
+        ] [\r
+            2drop no-pending-audio [ decode-audio ] when\r
+        ] if\r
+    ] when ;\r
+\r
+: video-buffer-not-ready? ( player -- player bool )\r
+    dup player-theora zero? not over player-video-ready? not and ;\r
+\r
+: decode-video ( player -- player )\r
+    video-buffer-not-ready? [\r
+        dup { player-to player-op } get-slots ogg_stream_packetout 0 > [\r
+            dup { player-td player-op } get-slots theora_decode_packetin drop\r
+            dup player-td theora_state-granulepos over set-player-video-granulepos\r
+            dup { player-td player-video-granulepos } get-slots theora_granule_time \r
+            over set-player-video-time\r
+            t over set-player-video-ready?\r
+            decode-video        \r
+        ] when\r
+    ] when ;\r
+    \r
+: decode ( player -- player )\r
+    get-more-header-data sync-pages\r
+    decode-audio\r
+    decode-video\r
+    dup player-audio-full? [\r
+        process-audio [\r
+            f over set-player-audio-full?\r
+            0 over set-player-audio-index\r
+        ] when\r
+    ] when \r
+    dup player-video-ready? [\r
+        dup player-video-time over get-time - dup 0.0 < [\r
+            -0.1 > [ process-video ] when\r
+            f over set-player-video-ready?\r
+        ] [\r
+            drop\r
+        ] if\r
+    ] when\r
+    decode ;\r
+\r
+: free-malloced-objects ( player -- player )\r
+    [ player-op free ] keep\r
+    [ player-oy free ] keep\r
+    [ player-og free ] keep\r
+    [ player-vo free ] keep\r
+    [ player-vi free ] keep\r
+    [ player-vd free ] keep\r
+    [ player-vb free ] keep\r
+    [ player-vc free ] keep  \r
+    [ player-to free ] keep\r
+    [ player-ti free ] keep\r
+    [ player-tc free ] keep\r
+    [ player-td free ] keep ;\r
+\r
+\r
+: unqueue-openal-buffers ( player -- player )\r
+    [\r
+\r
+        num-audio-buffers-processed over player-source rot player-buffer-indexes swapd\r
+        alSourceUnqueueBuffers check-error \r
+    ] keep ;\r
+\r
+: delete-openal-buffers ( player -- player )\r
+    [ \r
+        player-buffers [\r
+            1 swap <uint> alDeleteBuffers check-error\r
+        ] each \r
+    ] keep ;\r
+\r
+: delete-openal-source ( player -- player )\r
+    [ player-source 1 swap <uint> alDeleteSources check-error ] keep ;\r
+\r
+: cleanup ( player -- player )\r
+    free-malloced-objects \r
+    unqueue-openal-buffers\r
+    delete-openal-buffers \r
+    delete-openal-source ;\r
+\r
+: wait-for-sound ( player -- player )\r
+    #! Waits for the openal to finish playing remaining sounds\r
+    dup player-source AL_SOURCE_STATE 0 <int> [ alGetSourcei check-error ] keep\r
+    *int AL_PLAYING = [\r
+        100 sleep\r
+        wait-for-sound\r
+    ] when ;\r
+\r
+TUPLE: theora-gadget player ;\r
+\r
+: <theora-gadget> ( player -- gadget )\r
+  theora-gadget construct-gadget\r
+  [ set-theora-gadget-player ] keep ;\r
+\r
+M: theora-gadget pref-dim* \r
+    theora-gadget-player\r
+    player-ti dup theora_info-width swap theora_info-height 2array ;\r
+\r
+M: theora-gadget draw-gadget* ( gadget -- )\r
+    0 0 glRasterPos2i\r
+    1.0 -1.0 glPixelZoom\r
+    GL_UNPACK_ALIGNMENT 1 glPixelStorei\r
+    [ pref-dim* first2 GL_RGB GL_UNSIGNED_BYTE ] keep\r
+    theora-gadget-player player-rgb glDrawPixels ;\r
+\r
+: initialize-gui ( gadget -- )\r
+    "Theora Player" open-window ;\r
+\r
+: play-ogg ( player -- )\r
+    parse-initial-headers \r
+    parse-remaining-headers \r
+    initialize-decoder \r
+    dup player-gadget [ initialize-gui ] when* \r
+    [ decode ] [ drop ] recover\r
+!    decode\r
+    wait-for-sound\r
+    cleanup\r
+    drop ;\r
+\r
+: play-vorbis-stream ( stream -- )\r
+    <player> play-ogg ;\r
+\r
+: play-vorbis-file ( filename -- )\r
+    <file-reader> play-vorbis-stream ;\r
+\r
+: play-theora-stream ( stream -- )\r
+    <player> \r
+    dup <theora-gadget> over set-player-gadget         \r
+    play-ogg ;\r
+\r
+: play-theora-file ( filename -- )\r
+    <file-reader> play-theora-stream ;\r
+\r
diff --git a/extra/ogg/player/summary.txt b/extra/ogg/player/summary.txt
new file mode 100644 (file)
index 0000000..d2e32ef
--- /dev/null
@@ -0,0 +1 @@
+Ogg vorbis and theora media player
diff --git a/extra/ogg/player/tags.txt b/extra/ogg/player/tags.txt
new file mode 100644 (file)
index 0000000..1adb6f1
--- /dev/null
@@ -0,0 +1,2 @@
+audio
+video
diff --git a/extra/ogg/summary.txt b/extra/ogg/summary.txt
new file mode 100644 (file)
index 0000000..3d2b551
--- /dev/null
@@ -0,0 +1 @@
+Ogg media library binding
diff --git a/extra/ogg/tags.txt b/extra/ogg/tags.txt
new file mode 100644 (file)
index 0000000..be30e2c
--- /dev/null
@@ -0,0 +1,3 @@
+bindings
+audio
+video
diff --git a/extra/ogg/theora/authors.txt b/extra/ogg/theora/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/ogg/theora/summary.txt b/extra/ogg/theora/summary.txt
new file mode 100644 (file)
index 0000000..aa5ec1f
--- /dev/null
@@ -0,0 +1 @@
+Ogg Theora video library binding
diff --git a/extra/ogg/theora/tags.txt b/extra/ogg/theora/tags.txt
new file mode 100644 (file)
index 0000000..2b68b52
--- /dev/null
@@ -0,0 +1 @@
+video
diff --git a/extra/ogg/theora/theora.factor b/extra/ogg/theora/theora.factor
new file mode 100644 (file)
index 0000000..325fb91
--- /dev/null
@@ -0,0 +1,121 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel system combinators alien alien.syntax ;
+IN: ogg.theora
+
+: load-theora-library ( -- )
+    "theora" {
+        { [ win32? ]  [ "libtheora.dll" ] }
+        { [ macosx? ] [ "libtheora.0.dylib" ] }
+        { [ unix? ]   [ "libtheora.so" ] }
+    } cond "cdecl" add-library ; parsing
+
+load-theora-library
+
+LIBRARY: theora
+
+C-STRUCT: yuv_buffer
+    { "int" "y_width" }
+    { "int" "y_height" }
+    { "int" "y_stride" }
+    { "int" "uv_width" }
+    { "int" "uv_height" }
+    { "int" "uv_stride" }
+    { "void*" "y" }
+    { "void*" "u" }
+    { "void*" "v" } ;
+
+: OC_CS_UNSPECIFIED ( -- number ) 0 ; inline
+: OC_CS_ITU_REC_470M ( -- number ) 1 ; inline
+: OC_CS_ITU_REC_470BG ( -- number ) 2 ; inline
+: OC_CS_NSPACES ( -- number ) 3 ; inline
+
+TYPEDEF: int theora_colorspace 
+
+: OC_PF_420 ( -- number ) 0 ; inline
+: OC_PF_RSVD ( -- number ) 1 ; inline
+: OC_PF_422 ( -- number ) 2 ; inline
+: OC_PF_444 ( -- number ) 3 ; inline
+
+TYPEDEF: int theora_pixelformat
+
+C-STRUCT: theora_info
+    { "uint" "width" }
+    { "uint" "height" }
+    { "uint" "frame_width" }
+    { "uint" "frame_height" }
+    { "uint" "offset_x" }
+    { "uint" "offset_y" }
+    { "uint" "fps_numerator" }
+    { "uint" "fps_denominator" }
+    { "uint" "aspect_numerator" }
+    { "uint" "aspect_denominator" }
+    { "theora_colorspace" "colorspace" }
+    { "int" "target_bitrate" }
+    { "int" "quality" }
+    { "int" "quick_p" }
+    { "uchar" "version_major" }
+    { "uchar" "version_minor" } 
+    { "uchar" "version_subminor" }
+    { "void*" "codec_setup" }
+    { "int" "dropframes_p" }
+    { "int" "keyframe_auto_p" }
+    { "uint" "keyframe_frequency" }
+    { "uint" "keyframe_frequency_force" }
+    { "uint" "keyframe_data_target_bitrate" }
+    { "int" "keyframe_auto_threshold" }
+    { "uint" "keyframe_mindistance" }
+    { "int" "noise_sensitivity" }
+    { "int" "sharpness" }
+    { "theora_pixelformat" "pixelformat" } ;
+
+C-STRUCT: theora_state
+    { "theora_info*" "i" }
+    { "longlong" "granulepos" }
+    { "void*" "internal_encode" }
+    { "void*" "internal_decode" } ;
+
+C-STRUCT: theora_comment
+    { "char**" "user_comments" }
+    { "int*" "comment_lengths" }
+    { "int" "comments" }
+    { "char*" "vendor" } ;
+
+: OC_FAULT ( -- number ) -1 ; inline
+: OC_EINVAL ( -- number ) -10 ; inline
+: OC_DISABLED ( -- number ) -11 ; inline
+: OC_BADHEADER ( -- number ) -20 ; inline
+: OC_NOTFORMAT ( -- number ) -21 ; inline
+: OC_VERSION ( -- number ) -22 ; inline
+: OC_IMPL ( -- number ) -23 ; inline
+: OC_BADPACKET ( -- number ) -24 ; inline
+: OC_NEWPACKET ( -- number ) -25 ; inline
+: OC_DUPFRAME ( -- number ) 1 ; inline
+
+FUNCTION: char* theora_version_string ( ) ;
+FUNCTION: uint theora_version_number ( ) ;
+FUNCTION: int theora_encode_init ( theora_state* th, theora_info* ti ) ;
+FUNCTION: int theora_encode_YUVin ( theora_state* t, yuv_buffer* yuv ) ;
+FUNCTION: int theora_encode_packetout ( theora_state* t, int last_p, ogg_packet* op ) ;
+FUNCTION: int theora_encode_header ( theora_state* t, ogg_packet* op ) ;
+FUNCTION: int theora_encode_comment ( theora_comment* tc, ogg_packet* op ) ;
+FUNCTION: int theora_encode_tables ( theora_state* t, ogg_packet* op ) ;
+FUNCTION: int theora_decode_header ( theora_info* ci, theora_comment* cc, ogg_packet* op ) ;
+FUNCTION: int theora_decode_init ( theora_state* th, theora_info* c ) ;
+FUNCTION: int theora_decode_packetin ( theora_state* th, ogg_packet* op ) ;
+FUNCTION: int theora_decode_YUVout ( theora_state* th, yuv_buffer* yuv ) ;
+FUNCTION: int theora_packet_isheader ( ogg_packet* op ) ;
+FUNCTION: int theora_packet_iskeyframe ( ogg_packet* op ) ;
+FUNCTION: int theora_granule_shift ( theora_info* ti ) ;
+FUNCTION: longlong theora_granule_frame ( theora_state* th, longlong granulepos ) ;
+FUNCTION: double theora_granule_time ( theora_state* th, longlong granulepos ) ;
+FUNCTION: void theora_info_init ( theora_info* c ) ;
+FUNCTION: void theora_info_clear ( theora_info* c ) ;
+FUNCTION: void theora_clear ( theora_state* t ) ;
+FUNCTION: void theora_comment_init ( theora_comment* tc ) ;
+FUNCTION: void theora_comment_add ( theora_comment* tc, char* comment ) ;
+FUNCTION: void theora_comment_add_tag ( theora_comment* tc, char* tag, char* value ) ;
+FUNCTION: char* theora_comment_query ( theora_comment* tc, char* tag, int count ) ;
+FUNCTION: int   theora_comment_query_count ( theora_comment* tc, char* tag ) ;
+FUNCTION: void  theora_comment_clear ( theora_comment* tc ) ;
diff --git a/extra/ogg/vorbis/authors.txt b/extra/ogg/vorbis/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/ogg/vorbis/summary.txt b/extra/ogg/vorbis/summary.txt
new file mode 100644 (file)
index 0000000..1a8118f
--- /dev/null
@@ -0,0 +1 @@
+Ogg Vorbis audio library binding
diff --git a/extra/ogg/vorbis/tags.txt b/extra/ogg/vorbis/tags.txt
new file mode 100644 (file)
index 0000000..d5cc284
--- /dev/null
@@ -0,0 +1 @@
+audio
diff --git a/extra/ogg/vorbis/vorbis.factor b/extra/ogg/vorbis/vorbis.factor
new file mode 100644 (file)
index 0000000..e6e08ef
--- /dev/null
@@ -0,0 +1,142 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel system combinators alien alien.syntax ;
+IN: ogg.vorbis
+
+: load-vorbis-library ( -- )
+    "vorbis" {
+        { [ win32? ]  [ "vorbis.dll" ] }
+        { [ macosx? ] [ "libvorbis.0.dylib" ] }
+        { [ unix? ]   [ "libvorbis.so" ] }
+    } cond "cdecl" add-library ; parsing
+
+load-vorbis-library
+
+LIBRARY: vorbis
+
+C-STRUCT: vorbis_info 
+    { "int" "version" }
+    { "int" "channels" }
+    { "long" "rate" }
+    { "long" "bitrate_upper" }
+    { "long" "bitrate_nominal" }
+    { "long" "bitrate_lower" }
+    { "long" "bitrate_window" }
+    { "void*" "codec_setup"} 
+    ;
+
+C-STRUCT: vorbis_dsp_state
+    { "int" "analysisp" }
+    { "vorbis_info*" "vi" }
+    { "float**" "pcm" }
+    { "float**" "pcmret" }
+    { "int" "pcm_storage" }
+    { "int" "pcm_current" }
+    { "int" "pcm_returned" }
+    { "int" "preextrapolate" }
+    { "int" "eofflag" }
+    { "long" "lW" }
+    { "long" "W" }
+    { "long" "nW" }
+    { "long" "centerW" }
+    { "longlong" "granulepos" }
+    { "longlong" "sequence" }
+    { "longlong" "glue_bits" }
+    { "longlong" "time_bits" }
+    { "longlong" "floor_bits" }
+    { "longlong" "res_bits" }
+    { "void*" "backend_state" }
+    ;
+
+C-STRUCT: alloc_chain
+    { "void*" "ptr" }
+    { "void*" "next" }
+    ;
+
+C-STRUCT: vorbis_block
+    { "float**" "pcm" }
+    { "oggpack_buffer" "opb" }
+    { "long" "lW" }
+    { "long" "W" }
+    { "long" "nW" }
+    { "int" "pcmend" }
+    { "int" "mode" }
+    { "int" "eofflag" }
+    { "longlong" "granulepos" }
+    { "longlong" "sequence" }
+    { "vorbis_dsp_state*" "vd" }
+    { "void*" "localstore" }
+    { "long" "localtop" }
+    { "long" "localalloc" }
+    { "long" "totaluse" }
+    { "alloc_chain*" "reap" }
+    { "long" "glue_bits" }
+    { "long" "time_bits" }
+    { "long" "floor_bits" }
+    { "long" "res_bits" }
+    { "void*" "internal" }
+    ;
+
+C-STRUCT: vorbis_comment
+    { "char**" "usercomments" }
+    { "int*" "comment_lengths" }
+    { "int" "comments" }
+    { "char*" "vendor" }
+    ;
+
+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_clear ( vorbis_comment* vc ) ;
+FUNCTION: int      vorbis_block_init ( vorbis_dsp_state* v, vorbis_block* vb ) ;
+FUNCTION: int      vorbis_block_clear ( vorbis_block* vb ) ;
+FUNCTION: void     vorbis_dsp_clear ( vorbis_dsp_state* v ) ;
+FUNCTION: double   vorbis_granule_time ( vorbis_dsp_state* v, longlong granulepos ) ;
+FUNCTION: int      vorbis_analysis_init ( vorbis_dsp_state* v, vorbis_info* vi ) ;
+FUNCTION: int      vorbis_commentheader_out ( vorbis_comment* vc, ogg_packet* op ) ;
+FUNCTION: int      vorbis_analysis_headerout ( vorbis_dsp_state* v,
+                                         vorbis_comment* vc,
+                                         ogg_packet* op,
+                                         ogg_packet* op_comm,
+                                         ogg_packet* op_code ) ;
+FUNCTION: float**  vorbis_analysis_buffer ( vorbis_dsp_state* v, int vals ) ;
+FUNCTION: int      vorbis_analysis_wrote ( vorbis_dsp_state* v, int vals ) ;
+FUNCTION: int      vorbis_analysis_blockout ( vorbis_dsp_state* v, vorbis_block* vb ) ;
+FUNCTION: int      vorbis_analysis ( vorbis_block* vb, ogg_packet* op ) ;
+FUNCTION: int      vorbis_bitrate_addblock ( vorbis_block* vb ) ;
+FUNCTION: int      vorbis_bitrate_flushpacket ( vorbis_dsp_state* vd,
+                                          ogg_packet* op ) ;
+FUNCTION: int      vorbis_synthesis_headerin ( vorbis_info* vi, vorbis_comment* vc,
+                                         ogg_packet* op ) ;
+FUNCTION: int      vorbis_synthesis_init ( vorbis_dsp_state* v, vorbis_info* vi ) ;
+FUNCTION: int      vorbis_synthesis_restart ( vorbis_dsp_state* v ) ;
+FUNCTION: int      vorbis_synthesis ( vorbis_block* vb, ogg_packet* op ) ;
+FUNCTION: int      vorbis_synthesis_trackonly ( vorbis_block* vb, ogg_packet* op ) ;
+FUNCTION: int      vorbis_synthesis_blockin ( vorbis_dsp_state* v, vorbis_block* vb ) ;
+FUNCTION: int      vorbis_synthesis_pcmout ( vorbis_dsp_state* v, float*** pcm ) ;
+FUNCTION: int      vorbis_synthesis_lapout ( vorbis_dsp_state* v, float*** pcm ) ;
+FUNCTION: int      vorbis_synthesis_read ( vorbis_dsp_state* v, int samples ) ;
+FUNCTION: long     vorbis_packet_blocksize ( vorbis_info* vi, ogg_packet* op ) ;
+FUNCTION: int      vorbis_synthesis_halfrate ( vorbis_info* v, int flag ) ;
+FUNCTION: int      vorbis_synthesis_halfrate_p ( vorbis_info* v ) ;
+
+: OV_FALSE ( -- number ) -1 ; inline
+: OV_EOF ( -- number ) -2 ; inline
+: OV_HOLE ( -- number ) -3 ; inline
+: OV_EREAD ( -- number ) -128 ; inline
+: OV_EFAULT ( -- number ) -129 ; inline
+: OV_EIMPL ( -- number ) -130 ; inline
+: OV_EINVAL ( -- number ) -131 ; inline
+: OV_ENOTVORBIS ( -- number ) -132 ; inline
+: OV_EBADHEADER ( -- number ) -133 ; inline
+: OV_EVERSION ( -- number ) -134 ; inline
+: OV_ENOTAUDIO ( -- number ) -135 ; inline
+: OV_EBADPACKET ( -- number ) -136 ; inline
+: OV_EBADLINK ( -- number ) -137 ; inline
+: OV_ENOSEEK ( -- number ) -138 ; inline
diff --git a/extra/openal/authors.txt b/extra/openal/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/openal/example/example.factor b/extra/openal/example/example.factor
new file mode 100644 (file)
index 0000000..ebdb6da
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+IN: openal.example\r
+USING: openal kernel alien threads sequences ;\r
+\r
+: play-hello ( -- )\r
+  init-openal\r
+  1 gen-sources\r
+  first dup AL_BUFFER  alutCreateBufferHelloWorld set-source-param\r
+  source-play\r
+  1000 sleep ;\r
+  \r
+: (play-file) ( source -- )\r
+  100 sleep\r
+  dup source-playing? [ (play-file) ] [ drop ] if ;\r
+\r
+: play-file ( filename -- )\r
+  init-openal\r
+  create-buffer-from-file \r
+  1 gen-sources\r
+  first dup >r AL_BUFFER rot set-source-param r>\r
+  dup source-play\r
+  check-error\r
+  (play-file) ;\r
+\r
+: play-wav ( filename -- )\r
+  init-openal\r
+  create-buffer-from-wav \r
+  1 gen-sources\r
+  first dup >r AL_BUFFER rot set-source-param r>\r
+  dup source-play\r
+  check-error\r
+  (play-file) ;
\ No newline at end of file
diff --git a/extra/openal/macosx/macosx.factor b/extra/openal/macosx/macosx.factor
new file mode 100644 (file)
index 0000000..21c918e
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+IN: openal.macosx\r
+USING: openal alien.c-types kernel alien alien.syntax shuffle ;\r
+\r
+LIBRARY: alut\r
+\r
+FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ;\r
+\r
+M: macosx-openal-impl load-wav-file ( filename -- format data size frequency )\r
+  0 <int> f <void*> 0 <int> 0 <int>\r
+  [ alutLoadWAVFile ] 4keep\r
+  >r >r >r *int r> *void* r> *int r> *int ;\r
diff --git a/extra/openal/openal.factor b/extra/openal/openal.factor
new file mode 100644 (file)
index 0000000..1db0932
--- /dev/null
@@ -0,0 +1,308 @@
+! Copyright (C) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+IN: openal
+USING: kernel alien system combinators alien.syntax namespaces
+       alien.c-types sequences vocabs.loader shuffle combinators.lib ;
+
+: load-alut-library ( -- )
+    "alut" {
+        { [ win32? ]  [ "alut.dll" ] }
+        { [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
+        { [ unix?  ]  [ "libalut.so" ] }
+    } cond "cdecl" add-library ; parsing
+
+: load-openal-library ( -- )
+    "openal" {
+        { [ win32? ]  [ "OpenAL32.dll" ] }
+        { [ macosx? ] [ "/System/Library/Frameworks/OpenAL.framework/OpenAL" ] }
+        { [ unix?  ]  [ "libopenal.so" ] }
+    } cond "cdecl" add-library ; parsing
+
+load-alut-library
+load-openal-library
+
+LIBRARY: openal
+
+TYPEDEF: char ALboolean 
+TYPEDEF: char ALchar
+TYPEDEF: char ALbyte
+TYPEDEF: uchar ALubyte
+TYPEDEF: short ALshort
+TYPEDEF: ushort ALushort
+TYPEDEF: int ALint
+TYPEDEF: uint ALuint
+TYPEDEF: int ALsizei
+TYPEDEF: int ALenum
+TYPEDEF: float ALfloat
+TYPEDEF: double ALdouble
+
+: AL_INVALID ( -- number ) -1 ; inline
+: AL_NONE ( -- number ) 0 ; inline
+: AL_FALSE ( -- number ) 0 ; inline
+: AL_TRUE ( -- number ) 1 ; inline
+: AL_SOURCE_RELATIVE ( -- number ) HEX: 202 ; inline
+: AL_CONE_INNER_ANGLE ( -- nmber ) HEX: 1001 ; inline
+: AL_CONE_OUTER_ANGLE ( -- number ) HEX: 1002 ; inline
+: AL_PITCH ( -- number ) HEX: 1003 ; inline
+: AL_POSITION ( -- number ) HEX: 1004 ; inline
+: AL_DIRECTION ( -- number ) HEX: 1005 ; inline
+: AL_VELOCITY ( -- number ) HEX: 1006 ; inline
+: AL_LOOPING ( -- number ) HEX: 1007 ; inline
+: AL_BUFFER ( -- number ) HEX: 1009 ; inline
+: AL_GAIN ( -- number ) HEX: 100A ; inline
+: AL_MIN_GAIN ( -- number ) HEX: 100D ; inline
+: AL_MAX_GAIN ( -- number ) HEX: 100E ; inline
+: AL_ORIENTATION ( -- number ) HEX: 100F ; inline
+: AL_CHANNEL_MASK ( -- number ) HEX: 3000 ; inline
+: AL_SOURCE_STATE ( -- number ) HEX: 1010 ; inline
+: AL_INITIAL ( -- number ) HEX: 1011 ; inline
+: AL_PLAYING ( -- number ) HEX: 1012 ; inline
+: AL_PAUSED ( -- number ) HEX: 1013 ; inline
+: AL_STOPPED ( -- number ) HEX: 1014 ; inline
+: AL_BUFFERS_QUEUED ( -- number ) HEX: 1015 ; inline
+: AL_BUFFERS_PROCESSED ( -- number ) HEX: 1016 ; inline
+: AL_SEC_OFFSET ( -- number ) HEX: 1024 ; inline
+: AL_SAMPLE_OFFSET ( -- number ) HEX: 1025 ; inline
+: AL_BYTE_OFFSET ( -- number ) HEX: 1026 ; inline
+: AL_SOURCE_TYPE ( -- number ) HEX: 1027 ; inline
+: AL_STATIC ( -- number ) HEX: 1028 ; inline
+: AL_STREAMING ( -- number ) HEX: 1029 ; inline
+: AL_UNDETERMINED ( -- number ) HEX: 1030 ; inline
+: AL_FORMAT_MONO8 ( -- number ) HEX: 1100 ; inline
+: AL_FORMAT_MONO16 ( -- number ) HEX: 1101 ; inline
+: AL_FORMAT_STEREO8 ( -- number ) HEX: 1102 ; inline
+: AL_FORMAT_STEREO16 ( -- number ) HEX: 1103 ; inline
+: AL_REFERENCE_DISTANCE ( -- number ) HEX: 1020 ; inline
+: AL_ROLLOFF_FACTOR ( -- number ) HEX: 1021 ; inline
+: AL_CONE_OUTER_GAIN ( -- number ) HEX: 1022 ; inline
+: AL_MAX_DISTANCE ( -- number ) HEX: 1023 ; inline
+: AL_FREQUENCY ( -- number ) HEX: 2001 ; inline
+: AL_BITS ( -- number ) HEX: 2002 ; inline
+: AL_CHANNELS ( -- number ) HEX: 2003 ; inline
+: AL_SIZE ( -- number ) HEX: 2004 ; inline
+: AL_UNUSED ( -- number ) HEX: 2010 ; inline
+: AL_PENDING ( -- number ) HEX: 2011 ; inline
+: AL_PROCESSED ( -- number ) HEX: 2012 ; inline
+: AL_NO_ERROR ( -- number ) AL_FALSE ; inline
+: AL_INVALID_NAME ( -- number ) HEX: A001 ; inline
+: AL_ILLEGAL_ENUM ( -- number ) HEX: A002 ; inline
+: AL_INVALID_ENUM ( -- number ) HEX: A002 ; inline
+: AL_INVALID_VALUE ( -- number ) HEX: A003 ; inline
+: AL_ILLEGAL_COMMAND ( -- number ) HEX: A004 ; inline
+: AL_INVALID_OPERATION ( -- number ) HEX: A004 ; inline
+: AL_OUT_OF_MEMORY ( -- number ) HEX: A005 ; inline
+: AL_VENDOR ( -- number ) HEX: B001 ; inline
+: AL_VERSION ( -- number ) HEX: B002 ; inline
+: AL_RENDERER ( -- number ) HEX: B003 ; inline
+: AL_EXTENSIONS ( -- number ) HEX: B004 ; inline
+: AL_DOPPLER_FACTOR ( -- number ) HEX: C000 ; inline
+: AL_DOPPLER_VELOCITY ( -- number ) HEX: C001 ; inline
+: AL_SPEED_OF_SOUND ( -- number ) HEX: C003 ; inline
+: AL_DISTANCE_MODEL ( -- number ) HEX: D000 ; inline
+: AL_INVERSE_DISTANCE ( -- number ) HEX: D001 ; inline
+: AL_INVERSE_DISTANCE_CLAMPED ( -- number ) HEX: D002 ; inline
+: AL_LINEAR_DISTANCE ( -- number ) HEX: D003 ; inline
+: AL_LINEAR_DISTANCE_CLAMPED ( -- number ) HEX: D004 ; inline
+: AL_EXPONENT_DISTANCE ( -- number ) HEX: D005 ; inline
+: AL_EXPONENT_DISTANCE_CLAMPED ( -- number ) HEX: D006 ; inline
+
+FUNCTION: void alEnable ( ALenum capability ) ;
+FUNCTION: void alDisable ( ALenum capability ) ; 
+FUNCTION: ALboolean alIsEnabled ( ALenum capability ) ; 
+FUNCTION: ALchar* alGetString ( ALenum param ) ;
+FUNCTION: void alGetBooleanv ( ALenum param, ALboolean* data ) ;
+FUNCTION: void alGetIntegerv ( ALenum param, ALint* data ) ;
+FUNCTION: void alGetFloatv ( ALenum param, ALfloat* data ) ;
+FUNCTION: void alGetDoublev ( ALenum param, ALdouble* data ) ;
+FUNCTION: ALboolean alGetBoolean ( ALenum param ) ;
+FUNCTION: ALint alGetInteger ( ALenum param ) ;
+FUNCTION: ALfloat alGetFloat ( ALenum param ) ;
+FUNCTION: ALdouble alGetDouble ( ALenum param ) ;
+FUNCTION: ALenum alGetError (  ) ;
+FUNCTION: ALboolean alIsExtensionPresent ( ALchar* extname ) ;
+FUNCTION: void* alGetProcAddress ( ALchar* fname ) ;
+FUNCTION: ALenum alGetEnumValue ( ALchar* ename ) ;
+FUNCTION: void alListenerf ( ALenum param, ALfloat value ) ;
+FUNCTION: void alListener3f ( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ) ;
+FUNCTION: void alListenerfv ( ALenum param, ALfloat* values ) ; 
+FUNCTION: void alListeneri ( ALenum param, ALint value ) ;
+FUNCTION: void alListener3i ( ALenum param, ALint value1, ALint value2, ALint value3 ) ;
+FUNCTION: void alListeneriv ( ALenum param, ALint* values ) ;
+FUNCTION: void alGetListenerf ( ALenum param, ALfloat* value ) ;
+FUNCTION: void alGetListener3f ( ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3 ) ;
+FUNCTION: void alGetListenerfv ( ALenum param, ALfloat* values ) ;
+FUNCTION: void alGetListeneri ( ALenum param, ALint* value ) ;
+FUNCTION: void alGetListener3i ( ALenum param, ALint* value1, ALint* value2, ALint* value3 ) ;
+FUNCTION: void alGetListeneriv ( ALenum param, ALint* values ) ;
+FUNCTION: void alGenSources ( ALsizei n, ALuint* sources ) ; 
+FUNCTION: void alDeleteSources ( ALsizei n, ALuint* sources ) ;
+FUNCTION: ALboolean alIsSource ( ALuint sid ) ; 
+FUNCTION: void alSourcef ( ALuint sid, ALenum param, ALfloat value ) ; 
+FUNCTION: void alSource3f ( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ) ;
+FUNCTION: void alSourcefv ( ALuint sid, ALenum param, ALfloat* values ) ; 
+FUNCTION: void alSourcei ( ALuint sid, ALenum param, ALint value ) ; 
+FUNCTION: void alSource3i ( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ) ;
+FUNCTION: void alSourceiv ( ALuint sid, ALenum param, ALint* values ) ;
+FUNCTION: void alGetSourcef ( ALuint sid, ALenum param, ALfloat* value ) ;
+FUNCTION: void alGetSource3f ( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3) ;
+FUNCTION: void alGetSourcefv ( ALuint sid, ALenum param, ALfloat* values ) ;
+FUNCTION: void alGetSourcei ( ALuint sid,  ALenum param, ALint* value ) ;
+FUNCTION: void alGetSource3i ( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3) ;
+FUNCTION: void alGetSourceiv ( ALuint sid,  ALenum param, ALint* values ) ;
+FUNCTION: void alSourcePlayv ( ALsizei ns, ALuint* sids ) ;
+FUNCTION: void alSourceStopv ( ALsizei ns, ALuint* sids ) ;
+FUNCTION: void alSourceRewindv ( ALsizei ns, ALuint* sids ) ;
+FUNCTION: void alSourcePausev ( ALsizei ns, ALuint* sids ) ;
+FUNCTION: void alSourcePlay ( ALuint sid ) ;
+FUNCTION: void alSourceStop ( ALuint sid ) ;
+FUNCTION: void alSourceRewind ( ALuint sid ) ;
+FUNCTION: void alSourcePause ( ALuint sid ) ;
+FUNCTION: void alSourceQueueBuffers ( ALuint sid, ALsizei numEntries, ALuint* bids ) ;
+FUNCTION: void alSourceUnqueueBuffers ( ALuint sid, ALsizei numEntries, ALuint* bids ) ;
+FUNCTION: void alGenBuffers ( ALsizei n, ALuint* buffers ) ;
+FUNCTION: void alDeleteBuffers ( ALsizei n, ALuint* buffers ) ;
+FUNCTION: ALboolean alIsBuffer ( ALuint bid ) ;
+FUNCTION: void alBufferData ( ALuint bid, ALenum format, void* data, ALsizei size, ALsizei freq ) ;
+FUNCTION: void alBufferf ( ALuint bid, ALenum param, ALfloat value ) ;
+FUNCTION: void alBuffer3f ( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ) ;
+FUNCTION: void alBufferfv ( ALuint bid, ALenum param, ALfloat* values ) ;
+FUNCTION: void alBufferi ( ALuint bid, ALenum param, ALint value ) ;
+FUNCTION: void alBuffer3i ( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ) ;
+FUNCTION: void alBufferiv ( ALuint bid, ALenum param, ALint* values ) ;
+FUNCTION: void alGetBufferf ( ALuint bid, ALenum param, ALfloat* value ) ;
+FUNCTION: void alGetBuffer3f ( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3) ;
+FUNCTION: void alGetBufferfv ( ALuint bid, ALenum param, ALfloat* values ) ;
+FUNCTION: void alGetBufferi ( ALuint bid, ALenum param, ALint* value ) ;
+FUNCTION: void alGetBuffer3i ( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3) ;
+FUNCTION: void alGetBufferiv ( ALuint bid, ALenum param, ALint* values ) ;
+FUNCTION: void alDopplerFactor ( ALfloat value ) ;
+FUNCTION: void alDopplerVelocity ( ALfloat value ) ;
+FUNCTION: void alSpeedOfSound ( ALfloat value ) ;
+FUNCTION: void alDistanceModel ( ALenum distanceModel ) ;
+
+LIBRARY: alut
+
+: ALUT_API_MAJOR_VERSION ( -- number ) 1 ; inline
+: ALUT_API_MINOR_VERSION ( -- number ) 1 ; inline
+: ALUT_ERROR_NO_ERROR ( -- number ) 0 ; inline
+: ALUT_ERROR_OUT_OF_MEMORY ( -- number ) HEX: 200 ; inline
+: ALUT_ERROR_INVALID_ENUM ( -- number ) HEX: 201 ; inline
+: ALUT_ERROR_INVALID_VALUE ( -- number ) HEX: 202 ; inline
+: ALUT_ERROR_INVALID_OPERATION ( -- number ) HEX: 203 ; inline
+: ALUT_ERROR_NO_CURRENT_CONTEXT ( -- number ) HEX: 204 ; inline
+: ALUT_ERROR_AL_ERROR_ON_ENTRY ( -- number ) HEX: 205 ; inline
+: ALUT_ERROR_ALC_ERROR_ON_ENTRY ( -- number ) HEX: 206 ; inline
+: ALUT_ERROR_OPEN_DEVICE ( -- number ) HEX: 207 ; inline
+: ALUT_ERROR_CLOSE_DEVICE ( -- number ) HEX: 208 ; inline
+: ALUT_ERROR_CREATE_CONTEXT ( -- number ) HEX: 209 ; inline
+: ALUT_ERROR_MAKE_CONTEXT_CURRENT ( -- number ) HEX: 20A ; inline
+: ALUT_ERROR_DESTRY_CONTEXT ( -- number ) HEX: 20B ; inline
+: ALUT_ERROR_GEN_BUFFERS ( -- number ) HEX: 20C ; inline
+: ALUT_ERROR_BUFFER_DATA ( -- number ) HEX: 20D ; inline
+: ALUT_ERROR_IO_ERROR ( -- number ) HEX: 20E ; inline
+: ALUT_ERROR_UNSUPPORTED_FILE_TYPE ( -- number ) HEX: 20F ; inline
+: ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE ( -- number ) HEX: 210 ; inline
+: ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA ( -- number ) HEX: 211 ; inline
+: ALUT_WAVEFORM_SINE ( -- number ) HEX: 100 ; inline
+: ALUT_WAVEFORM_SQUARE ( -- number ) HEX: 101 ; inline
+: ALUT_WAVEFORM_SAWTOOTH ( -- number ) HEX: 102 ; inline
+: ALUT_WAVEFORM_WHITENOISE ( -- number ) HEX: 103 ; inline
+: ALUT_WAVEFORM_IMPULSE ( -- number ) HEX: 104 ; inline
+: ALUT_LOADER_BUFFER ( -- number ) HEX: 300 ; inline
+: ALUT_LOADER_MEMORY ( -- number ) HEX: 301 ; inline
+
+FUNCTION: ALboolean alutInit ( int* argcp, char** argv ) ;
+FUNCTION: ALboolean alutInitWithoutContext ( int* argcp, char** argv ) ;
+FUNCTION: ALboolean alutExit ( ) ;
+FUNCTION: ALenum alutGetError ( ) ;
+FUNCTION: char* alutGetErrorString ( ALenum error ) ;
+FUNCTION: ALuint alutCreateBufferFromFile ( char* 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* 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: ALint alutGetMajorVersion ( ) ;
+FUNCTION: ALint alutGetMinorVersion ( ) ;
+FUNCTION: ALboolean alutSleep ( ALfloat duration ) ;
+
+FUNCTION: void alutUnloadWAV ( ALenum format, void* data, ALsizei size, ALsizei frequency ) ;
+
+SYMBOL: init
+
+: init-openal ( -- )
+  init get-global expired? [
+    f f alutInit drop
+    1337 <alien> init set-global
+  ] when ;
+
+: exit-openal ( -- )
+  init get-global expired? [
+    alutExit drop
+    f init set-global
+  ] unless ;
+
+: <uint-array> "ALuint" <c-array> ;
+
+: gen-sources ( size -- seq )
+  dup <uint-array> 2dup alGenSources swap c-uint-array> ;
+
+: gen-buffers ( size -- seq )
+  dup <uint-array> 2dup alGenBuffers swap c-uint-array> ;
+
+: gen-buffer ( -- buffer ) 1 gen-buffers first ;
+
+: create-buffer-from-file ( filename -- buffer )
+  alutCreateBufferFromFile dup AL_NONE = [
+    "create-buffer-from-file failed" throw
+  ] when ;
+
+SYMBOL: openal-impl
+HOOK: load-wav-file openal-impl ( filename -- format data size frequency )
+TUPLE: macosx-openal-impl ;
+TUPLE: other-openal-impl ;
+
+macosx? [ 
+    "openal.macosx" require
+    macosx-openal-impl
+] [ 
+    "openal.other" require
+    other-openal-impl
+] if construct-empty openal-impl set-global
+
+: create-buffer-from-wav ( filename -- buffer )
+  gen-buffer dup rot load-wav-file
+  [ alBufferData ] 4keep alutUnloadWAV ;
+
+: set-source-param ( source param value -- )
+  alSourcei ;
+
+: get-source-param ( source param -- value )
+  0 <uint> dup >r alGetSourcei r> *uint ;
+
+: set-buffer-param ( source param value -- )
+  alBufferi ;
+
+: get-buffer-param ( source param -- value )
+  0 <uint> dup >r alGetBufferi r> *uint ;
+
+: source-play ( source -- )
+  alSourcePlay ;
+
+: source-stop ( source -- )
+  alSourceStop ;
+
+: check-error ( -- )
+  alGetError dup ALUT_ERROR_NO_ERROR = [
+    drop
+  ] [
+    alGetString throw
+  ] if ;
+
+: source-playing? ( source -- bool )
+  AL_SOURCE_STATE get-source-param AL_PLAYING = ;
+
diff --git a/extra/openal/other/other.factor b/extra/openal/other/other.factor
new file mode 100644 (file)
index 0000000..08b1242
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+!\r
+IN: openal.other\r
+USING: openal alien.c-types kernel alien alien.syntax shuffle combinators.lib ;\r
+\r
+LIBRARY: alut\r
+\r
+FUNCTION: void alutLoadWAVFile ( ALbyte* fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency, ALboolean* looping ) ;\r
+\r
+M: other-openal-impl load-wav-file ( filename -- format data size frequency )\r
+  0 <int> f <void*> 0 <int> 0 <int>\r
+  [ 0 <char> alutLoadWAVFile ] 4keep\r
+  >r >r >r *int r> *void* r> *int r> *int ;\r
diff --git a/extra/openal/summary.txt b/extra/openal/summary.txt
new file mode 100644 (file)
index 0000000..5df8b3a
--- /dev/null
@@ -0,0 +1 @@
+OpenAL 3D audio library binding
diff --git a/extra/openal/tags.txt b/extra/openal/tags.txt
new file mode 100644 (file)
index 0000000..a5b2257
--- /dev/null
@@ -0,0 +1,2 @@
+bindings
+audio
diff --git a/extra/opengl/authors.txt b/extra/opengl/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/opengl/camera/camera.factor b/extra/opengl/camera/camera.factor
new file mode 100644 (file)
index 0000000..030a5d0
--- /dev/null
@@ -0,0 +1,16 @@
+
+USING: kernel namespaces math.vectors opengl.lib pos ori turtle self ;
+
+IN: opengl.camera
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: camera-eye ( -- point ) pos> ;
+
+: camera-focus ( -- point ) [ 1 step-turtle pos> ] save-self ;
+
+: camera-up ( -- dirvec )
+[ 90 pitch-up pos> 1 step-turtle pos> swap v- ] save-self ;
+
+: do-look-at ( camera -- )
+[ >self camera-eye camera-focus camera-up glu-look-at ] with-scope ;
diff --git a/extra/opengl/gl/authors.txt b/extra/opengl/gl/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/opengl/gl/gl.factor b/extra/opengl/gl/gl.factor
new file mode 100644 (file)
index 0000000..40ead55
--- /dev/null
@@ -0,0 +1,1312 @@
+! Copyright (C) 2005 Alex Chapman.
+! See http://factorcode.org/license.txt for BSD license.
+
+! This file is based on the gl.h that comes with xorg-x11 6.8.2
+
+USING: alien alien.syntax kernel sequences words ;
+IN: opengl.gl
+
+TYPEDEF: uint    GLenum
+TYPEDEF: uchar   GLboolean
+TYPEDEF: uint    GLbitfield
+TYPEDEF: char    GLbyte
+TYPEDEF: short   GLshort
+TYPEDEF: int     GLint
+TYPEDEF: int     GLsizei
+TYPEDEF: uchar   GLubyte
+TYPEDEF: ushort  GLushort
+TYPEDEF: uint    GLuint
+TYPEDEF: float   GLfloat
+TYPEDEF: float   GLclampf
+TYPEDEF: double  GLdouble
+TYPEDEF: double  GLclampd
+TYPEDEF: void*   GLvoid*
+
+! Constants
+
+! Boolean values
+: GL_FALSE                          HEX: 0 ; inline
+: GL_TRUE                           HEX: 1 ; inline
+
+! Data types
+: GL_BYTE                           HEX: 1400 ; inline
+: GL_UNSIGNED_BYTE                  HEX: 1401 ; inline
+: GL_SHORT                          HEX: 1402 ; inline
+: GL_UNSIGNED_SHORT                 HEX: 1403 ; inline
+: GL_INT                            HEX: 1404 ; inline
+: GL_UNSIGNED_INT                   HEX: 1405 ; inline
+: GL_FLOAT                          HEX: 1406 ; inline
+: GL_2_BYTES                        HEX: 1407 ; inline
+: GL_3_BYTES                        HEX: 1408 ; inline
+: GL_4_BYTES                        HEX: 1409 ; inline
+: GL_DOUBLE                         HEX: 140A ; inline
+
+! Primitives
+: GL_POINTS                         HEX: 0000 ; inline
+: GL_LINES                          HEX: 0001 ; inline
+: GL_LINE_LOOP                      HEX: 0002 ; inline
+: GL_LINE_STRIP                     HEX: 0003 ; inline
+: GL_TRIANGLES                      HEX: 0004 ; inline
+: GL_TRIANGLE_STRIP                 HEX: 0005 ; inline
+: GL_TRIANGLE_FAN                   HEX: 0006 ; inline
+: GL_QUADS                          HEX: 0007 ; inline
+: GL_QUAD_STRIP                     HEX: 0008 ; inline
+: GL_POLYGON                        HEX: 0009 ; inline
+
+! Vertex arrays
+: GL_VERTEX_ARRAY                   HEX: 8074 ; inline
+: GL_NORMAL_ARRAY                   HEX: 8075 ; inline
+: GL_COLOR_ARRAY                    HEX: 8076 ; inline
+: GL_INDEX_ARRAY                    HEX: 8077 ; inline
+: GL_TEXTURE_COORD_ARRAY            HEX: 8078 ; inline
+: GL_EDGE_FLAG_ARRAY                HEX: 8079 ; inline
+: GL_VERTEX_ARRAY_SIZE              HEX: 807A ; inline
+: GL_VERTEX_ARRAY_TYPE              HEX: 807B ; inline
+: GL_VERTEX_ARRAY_STRIDE            HEX: 807C ; inline
+: GL_NORMAL_ARRAY_TYPE              HEX: 807E ; inline
+: GL_NORMAL_ARRAY_STRIDE            HEX: 807F ; inline
+: GL_COLOR_ARRAY_SIZE               HEX: 8081 ; inline
+: GL_COLOR_ARRAY_TYPE               HEX: 8082 ; inline
+: GL_COLOR_ARRAY_STRIDE             HEX: 8083 ; inline
+: GL_INDEX_ARRAY_TYPE               HEX: 8085 ; inline
+: GL_INDEX_ARRAY_STRIDE             HEX: 8086 ; inline
+: GL_TEXTURE_COORD_ARRAY_SIZE       HEX: 8088 ; inline
+: GL_TEXTURE_COORD_ARRAY_TYPE       HEX: 8089 ; inline
+: GL_TEXTURE_COORD_ARRAY_STRIDE     HEX: 808A ; inline
+: GL_EDGE_FLAG_ARRAY_STRIDE         HEX: 808C ; inline
+: GL_VERTEX_ARRAY_POINTER           HEX: 808E ; inline
+: GL_NORMAL_ARRAY_POINTER           HEX: 808F ; inline
+: GL_COLOR_ARRAY_POINTER            HEX: 8090 ; inline
+: GL_INDEX_ARRAY_POINTER            HEX: 8091 ; inline
+: GL_TEXTURE_COORD_ARRAY_POINTER    HEX: 8092 ; inline
+: GL_EDGE_FLAG_ARRAY_POINTER        HEX: 8093 ; inline
+: GL_V2F                            HEX: 2A20 ; inline
+: GL_V3F                            HEX: 2A21 ; inline
+: GL_C4UB_V2F                       HEX: 2A22 ; inline
+: GL_C4UB_V3F                       HEX: 2A23 ; inline
+: GL_C3F_V3F                        HEX: 2A24 ; inline
+: GL_N3F_V3F                        HEX: 2A25 ; inline
+: GL_C4F_N3F_V3F                    HEX: 2A26 ; inline
+: GL_T2F_V3F                        HEX: 2A27 ; inline
+: GL_T4F_V4F                        HEX: 2A28 ; inline
+: GL_T2F_C4UB_V3F                   HEX: 2A29 ; inline
+: GL_T2F_C3F_V3F                    HEX: 2A2A ; inline
+: GL_T2F_N3F_V3F                    HEX: 2A2B ; inline
+: GL_T2F_C4F_N3F_V3F                HEX: 2A2C ; inline
+: GL_T4F_C4F_N3F_V4F                HEX: 2A2D ; inline
+
+! Matrix mode
+: GL_MATRIX_MODE                    HEX: 0BA0 ; inline
+: GL_MODELVIEW                      HEX: 1700 ; inline
+: GL_PROJECTION                     HEX: 1701 ; inline
+: GL_TEXTURE                        HEX: 1702 ; inline
+
+! Points
+: GL_POINT_SMOOTH                   HEX: 0B10 ; inline
+: GL_POINT_SIZE                     HEX: 0B11 ; inline
+: GL_POINT_SIZE_GRANULARITY         HEX: 0B13 ; inline
+: GL_POINT_SIZE_RANGE               HEX: 0B12 ; inline
+
+! Lines
+: GL_LINE_SMOOTH                    HEX: 0B20 ; inline
+: GL_LINE_STIPPLE                   HEX: 0B24 ; inline
+: GL_LINE_STIPPLE_PATTERN           HEX: 0B25 ; inline
+: GL_LINE_STIPPLE_REPEAT            HEX: 0B26 ; inline
+: GL_LINE_WIDTH                     HEX: 0B21 ; inline
+: GL_LINE_WIDTH_GRANULARITY         HEX: 0B23 ; inline
+: GL_LINE_WIDTH_RANGE               HEX: 0B22 ; inline
+
+! Polygons
+: GL_POINT                          HEX: 1B00 ; inline
+: GL_LINE                           HEX: 1B01 ; inline
+: GL_FILL                           HEX: 1B02 ; inline
+: GL_CW                             HEX: 0900 ; inline
+: GL_CCW                            HEX: 0901 ; inline
+: GL_FRONT                          HEX: 0404 ; inline
+: GL_BACK                           HEX: 0405 ; inline
+: GL_POLYGON_MODE                   HEX: 0B40 ; inline
+: GL_POLYGON_SMOOTH                 HEX: 0B41 ; inline
+: GL_POLYGON_STIPPLE                HEX: 0B42 ; inline
+: GL_EDGE_FLAG                      HEX: 0B43 ; inline
+: GL_CULL_FACE                      HEX: 0B44 ; inline
+: GL_CULL_FACE_MODE                 HEX: 0B45 ; inline
+: GL_FRONT_FACE                     HEX: 0B46 ; inline
+: GL_POLYGON_OFFSET_FACTOR          HEX: 8038 ; inline
+: GL_POLYGON_OFFSET_UNITS           HEX: 2A00 ; inline
+: GL_POLYGON_OFFSET_POINT           HEX: 2A01 ; inline
+: GL_POLYGON_OFFSET_LINE            HEX: 2A02 ; inline
+: GL_POLYGON_OFFSET_FILL            HEX: 8037 ; inline
+
+! Display Lists
+: GL_COMPILE                        HEX: 1300 ; inline
+: GL_COMPILE_AND_EXECUTE            HEX: 1301 ; inline
+: GL_LIST_BASE                      HEX: 0B32 ; inline
+: GL_LIST_INDEX                     HEX: 0B33 ; inline
+: GL_LIST_MODE                      HEX: 0B30 ; inline
+
+! Depth buffer
+: GL_NEVER                          HEX: 0200 ; inline
+: GL_LESS                           HEX: 0201 ; inline
+: GL_EQUAL                          HEX: 0202 ; inline
+: GL_LEQUAL                         HEX: 0203 ; inline
+: GL_GREATER                        HEX: 0204 ; inline
+: GL_NOTEQUAL                       HEX: 0205 ; inline
+: GL_GEQUAL                         HEX: 0206 ; inline
+: GL_ALWAYS                         HEX: 0207 ; inline
+: GL_DEPTH_TEST                     HEX: 0B71 ; inline
+: GL_DEPTH_BITS                     HEX: 0D56 ; inline
+: GL_DEPTH_CLEAR_VALUE              HEX: 0B73 ; inline
+: GL_DEPTH_FUNC                     HEX: 0B74 ; inline
+: GL_DEPTH_RANGE                    HEX: 0B70 ; inline
+: GL_DEPTH_WRITEMASK                HEX: 0B72 ; inline
+: GL_DEPTH_COMPONENT                HEX: 1902 ; inline
+
+! Lighting
+: GL_LIGHTING                       HEX: 0B50 ; inline
+: GL_LIGHT0                         HEX: 4000 ; inline
+: GL_LIGHT1                         HEX: 4001 ; inline
+: GL_LIGHT2                         HEX: 4002 ; inline
+: GL_LIGHT3                         HEX: 4003 ; inline
+: GL_LIGHT4                         HEX: 4004 ; inline
+: GL_LIGHT5                         HEX: 4005 ; inline
+: GL_LIGHT6                         HEX: 4006 ; inline
+: GL_LIGHT7                         HEX: 4007 ; inline
+: GL_SPOT_EXPONENT                  HEX: 1205 ; inline
+: GL_SPOT_CUTOFF                    HEX: 1206 ; inline
+: GL_CONSTANT_ATTENUATION           HEX: 1207 ; inline
+: GL_LINEAR_ATTENUATION             HEX: 1208 ; inline
+: GL_QUADRATIC_ATTENUATION          HEX: 1209 ; inline
+: GL_AMBIENT                        HEX: 1200 ; inline
+: GL_DIFFUSE                        HEX: 1201 ; inline
+: GL_SPECULAR                       HEX: 1202 ; inline
+: GL_SHININESS                      HEX: 1601 ; inline
+: GL_EMISSION                       HEX: 1600 ; inline
+: GL_POSITION                       HEX: 1203 ; inline
+: GL_SPOT_DIRECTION                 HEX: 1204 ; inline
+: GL_AMBIENT_AND_DIFFUSE            HEX: 1602 ; inline
+: GL_COLOR_INDEXES                  HEX: 1603 ; inline
+: GL_LIGHT_MODEL_TWO_SIDE           HEX: 0B52 ; inline
+: GL_LIGHT_MODEL_LOCAL_VIEWER       HEX: 0B51 ; inline
+: GL_LIGHT_MODEL_AMBIENT            HEX: 0B53 ; inline
+: GL_FRONT_AND_BACK                 HEX: 0408 ; inline
+: GL_SHADE_MODEL                    HEX: 0B54 ; inline
+: GL_FLAT                           HEX: 1D00 ; inline
+: GL_SMOOTH                         HEX: 1D01 ; inline
+: GL_COLOR_MATERIAL                 HEX: 0B57 ; inline
+: GL_COLOR_MATERIAL_FACE            HEX: 0B55 ; inline
+: GL_COLOR_MATERIAL_PARAMETER       HEX: 0B56 ; inline
+: GL_NORMALIZE                      HEX: 0BA1 ; inline
+
+! User clipping planes
+: GL_CLIP_PLANE0                    HEX: 3000 ; inline
+: GL_CLIP_PLANE1                    HEX: 3001 ; inline
+: GL_CLIP_PLANE2                    HEX: 3002 ; inline
+: GL_CLIP_PLANE3                    HEX: 3003 ; inline
+: GL_CLIP_PLANE4                    HEX: 3004 ; inline
+: GL_CLIP_PLANE5                    HEX: 3005 ; inline
+
+! Accumulation buffer
+: GL_ACCUM_RED_BITS                 HEX: 0D58 ; inline
+: GL_ACCUM_GREEN_BITS               HEX: 0D59 ; inline
+: GL_ACCUM_BLUE_BITS                HEX: 0D5A ; inline
+: GL_ACCUM_ALPHA_BITS               HEX: 0D5B ; inline
+: GL_ACCUM_CLEAR_VALUE              HEX: 0B80 ; inline
+: GL_ACCUM                          HEX: 0100 ; inline
+: GL_ADD                            HEX: 0104 ; inline
+: GL_LOAD                           HEX: 0101 ; inline
+: GL_MULT                           HEX: 0103 ; inline
+: GL_RETURN                         HEX: 0102 ; inline
+
+! Alpha testing
+: GL_ALPHA_TEST                     HEX: 0BC0 ; inline
+: GL_ALPHA_TEST_REF                 HEX: 0BC2 ; inline
+: GL_ALPHA_TEST_FUNC                HEX: 0BC1 ; inline
+
+! Blending
+: GL_BLEND                          HEX: 0BE2 ; inline
+: GL_BLEND_SRC                      HEX: 0BE1 ; inline
+: GL_BLEND_DST                      HEX: 0BE0 ; inline
+: GL_ZERO                           HEX: 0 ;  inline
+: GL_ONE                            HEX: 1 ;  inline
+: GL_SRC_COLOR                      HEX: 0300 ; inline
+: GL_ONE_MINUS_SRC_COLOR            HEX: 0301 ; inline
+: GL_SRC_ALPHA                      HEX: 0302 ; inline
+: GL_ONE_MINUS_SRC_ALPHA            HEX: 0303 ; inline
+: GL_DST_ALPHA                      HEX: 0304 ; inline
+: GL_ONE_MINUS_DST_ALPHA            HEX: 0305 ; inline
+: GL_DST_COLOR                      HEX: 0306 ; inline
+: GL_ONE_MINUS_DST_COLOR            HEX: 0307 ; inline
+: GL_SRC_ALPHA_SATURATE             HEX: 0308 ; inline
+
+! Render Mode
+: GL_FEEDBACK                       HEX: 1C01 ; inline
+: GL_RENDER                         HEX: 1C00 ; inline
+: GL_SELECT                         HEX: 1C02 ; inline
+
+! Feedback
+: GL_2D                             HEX: 0600 ; inline
+: GL_3D                             HEX: 0601 ; inline
+: GL_3D_COLOR                       HEX: 0602 ; inline
+: GL_3D_COLOR_TEXTURE               HEX: 0603 ; inline
+: GL_4D_COLOR_TEXTURE               HEX: 0604 ; inline
+: GL_POINT_TOKEN                    HEX: 0701 ; inline
+: GL_LINE_TOKEN                     HEX: 0702 ; inline
+: GL_LINE_RESET_TOKEN               HEX: 0707 ; inline
+: GL_POLYGON_TOKEN                  HEX: 0703 ; inline
+: GL_BITMAP_TOKEN                   HEX: 0704 ; inline
+: GL_DRAW_PIXEL_TOKEN               HEX: 0705 ; inline
+: GL_COPY_PIXEL_TOKEN               HEX: 0706 ; inline
+: GL_PASS_THROUGH_TOKEN             HEX: 0700 ; inline
+: GL_FEEDBACK_BUFFER_POINTER        HEX: 0DF0 ; inline
+: GL_FEEDBACK_BUFFER_SIZE           HEX: 0DF1 ; inline
+: GL_FEEDBACK_BUFFER_TYPE           HEX: 0DF2 ; inline
+
+! Selection
+: GL_SELECTION_BUFFER_POINTER       HEX: 0DF3 ; inline
+: GL_SELECTION_BUFFER_SIZE          HEX: 0DF4 ; inline
+
+! Fog
+: GL_FOG                            HEX: 0B60 ; inline
+: GL_FOG_MODE                       HEX: 0B65 ; inline
+: GL_FOG_DENSITY                    HEX: 0B62 ; inline
+: GL_FOG_COLOR                      HEX: 0B66 ; inline
+: GL_FOG_INDEX                      HEX: 0B61 ; inline
+: GL_FOG_START                      HEX: 0B63 ; inline
+: GL_FOG_END                        HEX: 0B64 ; inline
+: GL_LINEAR                         HEX: 2601 ; inline
+: GL_EXP                            HEX: 0800 ; inline
+: GL_EXP2                           HEX: 0801 ; inline
+
+! Logic Ops
+: GL_LOGIC_OP                       HEX: 0BF1 ; inline
+: GL_INDEX_LOGIC_OP                 HEX: 0BF1 ; inline
+: GL_COLOR_LOGIC_OP                 HEX: 0BF2 ; inline
+: GL_LOGIC_OP_MODE                  HEX: 0BF0 ; inline
+: GL_CLEAR                          HEX: 1500 ; inline
+: GL_SET                            HEX: 150F ; inline
+: GL_COPY                           HEX: 1503 ; inline
+: GL_COPY_INVERTED                  HEX: 150C ; inline
+: GL_NOOP                           HEX: 1505 ; inline
+: GL_INVERT                         HEX: 150A ; inline
+: GL_AND                            HEX: 1501 ; inline
+: GL_NAND                           HEX: 150E ; inline
+: GL_OR                             HEX: 1507 ; inline
+: GL_NOR                            HEX: 1508 ; inline
+: GL_XOR                            HEX: 1506 ; inline
+: GL_EQUIV                          HEX: 1509 ; inline
+: GL_AND_REVERSE                    HEX: 1502 ; inline
+: GL_AND_INVERTED                   HEX: 1504 ; inline
+: GL_OR_REVERSE                     HEX: 150B ; inline
+: GL_OR_INVERTED                    HEX: 150D ; inline
+
+! Stencil
+: GL_STENCIL_TEST                   HEX: 0B90 ; inline
+: GL_STENCIL_WRITEMASK              HEX: 0B98 ; inline
+: GL_STENCIL_BITS                   HEX: 0D57 ; inline
+: GL_STENCIL_FUNC                   HEX: 0B92 ; inline
+: GL_STENCIL_VALUE_MASK             HEX: 0B93 ; inline
+: GL_STENCIL_REF                    HEX: 0B97 ; inline
+: GL_STENCIL_FAIL                   HEX: 0B94 ; inline
+: GL_STENCIL_PASS_DEPTH_PASS        HEX: 0B96 ; inline
+: GL_STENCIL_PASS_DEPTH_FAIL        HEX: 0B95 ; inline
+: GL_STENCIL_CLEAR_VALUE            HEX: 0B91 ; inline
+: GL_STENCIL_INDEX                  HEX: 1901 ; inline
+: GL_KEEP                           HEX: 1E00 ; inline
+: GL_REPLACE                        HEX: 1E01 ; inline
+: GL_INCR                           HEX: 1E02 ; inline
+: GL_DECR                           HEX: 1E03 ; inline
+
+! Buffers, Pixel Drawing/Reading
+: GL_NONE                           HEX:    0 ; inline
+: GL_LEFT                           HEX: 0406 ; inline
+: GL_RIGHT                          HEX: 0407 ; inline
+! defined elsewhere
+! GL_FRONT                          HEX: 0404
+! GL_BACK                           HEX: 0405
+! GL_FRONT_AND_BACK                 HEX: 0408
+: GL_FRONT_LEFT                     HEX: 0400 ; inline
+: GL_FRONT_RIGHT                    HEX: 0401 ; inline
+: GL_BACK_LEFT                      HEX: 0402 ; inline
+: GL_BACK_RIGHT                     HEX: 0403 ; inline
+: GL_AUX0                           HEX: 0409 ; inline
+: GL_AUX1                           HEX: 040A ; inline
+: GL_AUX2                           HEX: 040B ; inline
+: GL_AUX3                           HEX: 040C ; inline
+: GL_COLOR_INDEX                    HEX: 1900 ; inline
+: GL_RED                            HEX: 1903 ; inline
+: GL_GREEN                          HEX: 1904 ; inline
+: GL_BLUE                           HEX: 1905 ; inline
+: GL_ALPHA                          HEX: 1906 ; inline
+: GL_LUMINANCE                      HEX: 1909 ; inline
+: GL_LUMINANCE_ALPHA                HEX: 190A ; inline
+: GL_ALPHA_BITS                     HEX: 0D55 ; inline
+: GL_RED_BITS                       HEX: 0D52 ; inline
+: GL_GREEN_BITS                     HEX: 0D53 ; inline
+: GL_BLUE_BITS                      HEX: 0D54 ; inline
+: GL_INDEX_BITS                     HEX: 0D51 ; inline
+: GL_SUBPIXEL_BITS                  HEX: 0D50 ; inline
+: GL_AUX_BUFFERS                    HEX: 0C00 ; inline
+: GL_READ_BUFFER                    HEX: 0C02 ; inline
+: GL_DRAW_BUFFER                    HEX: 0C01 ; inline
+: GL_DOUBLEBUFFER                   HEX: 0C32 ; inline
+: GL_STEREO                         HEX: 0C33 ; inline
+: GL_BITMAP                         HEX: 1A00 ; inline
+: GL_COLOR                          HEX: 1800 ; inline
+: GL_DEPTH                          HEX: 1801 ; inline
+: GL_STENCIL                        HEX: 1802 ; inline
+: GL_DITHER                         HEX: 0BD0 ; inline
+: GL_RGB                            HEX: 1907 ; inline
+: GL_RGBA                           HEX: 1908 ; inline
+
+! Implementation limits
+: GL_MAX_LIST_NESTING               HEX: 0B31 ; inline
+: GL_MAX_ATTRIB_STACK_DEPTH         HEX: 0D35 ; inline
+: GL_MAX_MODELVIEW_STACK_DEPTH      HEX: 0D36 ; inline
+: GL_MAX_NAME_STACK_DEPTH           HEX: 0D37 ; inline
+: GL_MAX_PROJECTION_STACK_DEPTH     HEX: 0D38 ; inline
+: GL_MAX_TEXTURE_STACK_DEPTH        HEX: 0D39 ; inline
+: GL_MAX_EVAL_ORDER                 HEX: 0D30 ; inline
+: GL_MAX_LIGHTS                     HEX: 0D31 ; inline
+: GL_MAX_CLIP_PLANES                HEX: 0D32 ; inline
+: GL_MAX_TEXTURE_SIZE               HEX: 0D33 ; inline
+: GL_MAX_PIXEL_MAP_TABLE            HEX: 0D34 ; inline
+: GL_MAX_VIEWPORT_DIMS              HEX: 0D3A ; inline
+: GL_MAX_CLIENT_ATTRIB_STACK_DEPTH  HEX: 0D3B ; inline
+
+! Gets
+: GL_ATTRIB_STACK_DEPTH             HEX: 0BB0 ; inline
+: GL_CLIENT_ATTRIB_STACK_DEPTH      HEX: 0BB1 ; inline
+: GL_COLOR_CLEAR_VALUE              HEX: 0C22 ; inline
+: GL_COLOR_WRITEMASK                HEX: 0C23 ; inline
+: GL_CURRENT_INDEX                  HEX: 0B01 ; inline
+: GL_CURRENT_COLOR                  HEX: 0B00 ; inline
+: GL_CURRENT_NORMAL                 HEX: 0B02 ; inline
+: GL_CURRENT_RASTER_COLOR           HEX: 0B04 ; inline
+: GL_CURRENT_RASTER_DISTANCE        HEX: 0B09 ; inline
+: GL_CURRENT_RASTER_INDEX           HEX: 0B05 ; inline
+: GL_CURRENT_RASTER_POSITION        HEX: 0B07 ; inline
+: GL_CURRENT_RASTER_TEXTURE_COORDS  HEX: 0B06 ; inline
+: GL_CURRENT_RASTER_POSITION_VALID  HEX: 0B08 ; inline
+: GL_CURRENT_TEXTURE_COORDS         HEX: 0B03 ; inline
+: GL_INDEX_CLEAR_VALUE              HEX: 0C20 ; inline
+: GL_INDEX_MODE                     HEX: 0C30 ; inline
+: GL_INDEX_WRITEMASK                HEX: 0C21 ; inline
+: GL_MODELVIEW_MATRIX               HEX: 0BA6 ; inline
+: GL_MODELVIEW_STACK_DEPTH          HEX: 0BA3 ; inline
+: GL_NAME_STACK_DEPTH               HEX: 0D70 ; inline
+: GL_PROJECTION_MATRIX              HEX: 0BA7 ; inline
+: GL_PROJECTION_STACK_DEPTH         HEX: 0BA4 ; inline
+: GL_RENDER_MODE                    HEX: 0C40 ; inline
+: GL_RGBA_MODE                      HEX: 0C31 ; inline
+: GL_TEXTURE_MATRIX                 HEX: 0BA8 ; inline
+: GL_TEXTURE_STACK_DEPTH            HEX: 0BA5 ; inline
+: GL_VIEWPORT                       HEX: 0BA2 ; inline
+
+! Evaluators inline
+: GL_AUTO_NORMAL                    HEX: 0D80 ; inline
+: GL_MAP1_COLOR_4                   HEX: 0D90 ; inline
+: GL_MAP1_INDEX                     HEX: 0D91 ; inline
+: GL_MAP1_NORMAL                    HEX: 0D92 ; inline
+: GL_MAP1_TEXTURE_COORD_1           HEX: 0D93 ; inline
+: GL_MAP1_TEXTURE_COORD_2           HEX: 0D94 ; inline
+: GL_MAP1_TEXTURE_COORD_3           HEX: 0D95 ; inline
+: GL_MAP1_TEXTURE_COORD_4           HEX: 0D96 ; inline
+: GL_MAP1_VERTEX_3                  HEX: 0D97 ; inline
+: GL_MAP1_VERTEX_4                  HEX: 0D98 ; inline
+: GL_MAP2_COLOR_4                   HEX: 0DB0 ; inline
+: GL_MAP2_INDEX                     HEX: 0DB1 ; inline
+: GL_MAP2_NORMAL                    HEX: 0DB2 ; inline
+: GL_MAP2_TEXTURE_COORD_1           HEX: 0DB3 ; inline
+: GL_MAP2_TEXTURE_COORD_2           HEX: 0DB4 ; inline
+: GL_MAP2_TEXTURE_COORD_3           HEX: 0DB5 ; inline
+: GL_MAP2_TEXTURE_COORD_4           HEX: 0DB6 ; inline
+: GL_MAP2_VERTEX_3                  HEX: 0DB7 ; inline
+: GL_MAP2_VERTEX_4                  HEX: 0DB8 ; inline
+: GL_MAP1_GRID_DOMAIN               HEX: 0DD0 ; inline
+: GL_MAP1_GRID_SEGMENTS             HEX: 0DD1 ; inline
+: GL_MAP2_GRID_DOMAIN               HEX: 0DD2 ; inline
+: GL_MAP2_GRID_SEGMENTS             HEX: 0DD3 ; inline
+: GL_COEFF                          HEX: 0A00 ; inline
+: GL_DOMAIN                         HEX: 0A02 ; inline
+: GL_ORDER                          HEX: 0A01 ; inline
+
+! Hints inline
+: GL_FOG_HINT                       HEX: 0C54 ; inline
+: GL_LINE_SMOOTH_HINT               HEX: 0C52 ; inline
+: GL_PERSPECTIVE_CORRECTION_HINT    HEX: 0C50 ; inline
+: GL_POINT_SMOOTH_HINT              HEX: 0C51 ; inline
+: GL_POLYGON_SMOOTH_HINT            HEX: 0C53 ; inline
+: GL_DONT_CARE                      HEX: 1100 ; inline
+: GL_FASTEST                        HEX: 1101 ; inline
+: GL_NICEST                         HEX: 1102 ; inline
+
+! Scissor box inline
+: GL_SCISSOR_TEST                   HEX: 0C11 ; inline
+: GL_SCISSOR_BOX                    HEX: 0C10 ; inline
+
+! Pixel Mode / Transfer inline
+: GL_MAP_COLOR                      HEX: 0D10 ; inline
+: GL_MAP_STENCIL                    HEX: 0D11 ; inline
+: GL_INDEX_SHIFT                    HEX: 0D12 ; inline
+: GL_INDEX_OFFSET                   HEX: 0D13 ; inline
+: GL_RED_SCALE                      HEX: 0D14 ; inline
+: GL_RED_BIAS                       HEX: 0D15 ; inline
+: GL_GREEN_SCALE                    HEX: 0D18 ; inline
+: GL_GREEN_BIAS                     HEX: 0D19 ; inline
+: GL_BLUE_SCALE                     HEX: 0D1A ; inline
+: GL_BLUE_BIAS                      HEX: 0D1B ; inline
+: GL_ALPHA_SCALE                    HEX: 0D1C ; inline
+: GL_ALPHA_BIAS                     HEX: 0D1D ; inline
+: GL_DEPTH_SCALE                    HEX: 0D1E ; inline
+: GL_DEPTH_BIAS                     HEX: 0D1F ; inline
+: GL_PIXEL_MAP_S_TO_S_SIZE          HEX: 0CB1 ; inline
+: GL_PIXEL_MAP_I_TO_I_SIZE          HEX: 0CB0 ; inline
+: GL_PIXEL_MAP_I_TO_R_SIZE          HEX: 0CB2 ; inline
+: GL_PIXEL_MAP_I_TO_G_SIZE          HEX: 0CB3 ; inline
+: GL_PIXEL_MAP_I_TO_B_SIZE          HEX: 0CB4 ; inline
+: GL_PIXEL_MAP_I_TO_A_SIZE          HEX: 0CB5 ; inline
+: GL_PIXEL_MAP_R_TO_R_SIZE          HEX: 0CB6 ; inline
+: GL_PIXEL_MAP_G_TO_G_SIZE          HEX: 0CB7 ; inline
+: GL_PIXEL_MAP_B_TO_B_SIZE          HEX: 0CB8 ; inline
+: GL_PIXEL_MAP_A_TO_A_SIZE          HEX: 0CB9 ; inline
+: GL_PIXEL_MAP_S_TO_S               HEX: 0C71 ; inline
+: GL_PIXEL_MAP_I_TO_I               HEX: 0C70 ; inline
+: GL_PIXEL_MAP_I_TO_R               HEX: 0C72 ; inline
+: GL_PIXEL_MAP_I_TO_G               HEX: 0C73 ; inline
+: GL_PIXEL_MAP_I_TO_B               HEX: 0C74 ; inline
+: GL_PIXEL_MAP_I_TO_A               HEX: 0C75 ; inline
+: GL_PIXEL_MAP_R_TO_R               HEX: 0C76 ; inline
+: GL_PIXEL_MAP_G_TO_G               HEX: 0C77 ; inline
+: GL_PIXEL_MAP_B_TO_B               HEX: 0C78 ; inline
+: GL_PIXEL_MAP_A_TO_A               HEX: 0C79 ; inline
+: GL_PACK_ALIGNMENT                 HEX: 0D05 ; inline
+: GL_PACK_LSB_FIRST                 HEX: 0D01 ; inline
+: GL_PACK_ROW_LENGTH                HEX: 0D02 ; inline
+: GL_PACK_SKIP_PIXELS               HEX: 0D04 ; inline
+: GL_PACK_SKIP_ROWS                 HEX: 0D03 ; inline
+: GL_PACK_SWAP_BYTES                HEX: 0D00 ; inline
+: GL_UNPACK_ALIGNMENT               HEX: 0CF5 ; inline
+: GL_UNPACK_LSB_FIRST               HEX: 0CF1 ; inline
+: GL_UNPACK_ROW_LENGTH              HEX: 0CF2 ; inline
+: GL_UNPACK_SKIP_PIXELS             HEX: 0CF4 ; inline
+: GL_UNPACK_SKIP_ROWS               HEX: 0CF3 ; inline
+: GL_UNPACK_SWAP_BYTES              HEX: 0CF0 ; inline
+: GL_ZOOM_X                         HEX: 0D16 ; inline
+: GL_ZOOM_Y                         HEX: 0D17 ; inline
+
+! Texture mapping inline
+: GL_TEXTURE_ENV                    HEX: 2300 ; inline
+: GL_TEXTURE_ENV_MODE               HEX: 2200 ; inline
+: GL_TEXTURE_1D                     HEX: 0DE0 ; inline
+: GL_TEXTURE_2D                     HEX: 0DE1 ; inline
+: GL_TEXTURE_WRAP_S                 HEX: 2802 ; inline
+: GL_TEXTURE_WRAP_T                 HEX: 2803 ; inline
+: GL_TEXTURE_MAG_FILTER             HEX: 2800 ; inline
+: GL_TEXTURE_MIN_FILTER             HEX: 2801 ; inline
+: GL_TEXTURE_ENV_COLOR              HEX: 2201 ; inline
+: GL_TEXTURE_GEN_S                  HEX: 0C60 ; inline
+: GL_TEXTURE_GEN_T                  HEX: 0C61 ; inline
+: GL_TEXTURE_GEN_MODE               HEX: 2500 ; inline
+: GL_TEXTURE_BORDER_COLOR           HEX: 1004 ; inline
+: GL_TEXTURE_WIDTH                  HEX: 1000 ; inline
+: GL_TEXTURE_HEIGHT                 HEX: 1001 ; inline
+: GL_TEXTURE_BORDER                 HEX: 1005 ; inline
+: GL_TEXTURE_COMPONENTS             HEX: 1003 ; inline
+: GL_TEXTURE_RED_SIZE               HEX: 805C ; inline
+: GL_TEXTURE_GREEN_SIZE             HEX: 805D ; inline
+: GL_TEXTURE_BLUE_SIZE              HEX: 805E ; inline
+: GL_TEXTURE_ALPHA_SIZE             HEX: 805F ; inline
+: GL_TEXTURE_LUMINANCE_SIZE         HEX: 8060 ; inline
+: GL_TEXTURE_INTENSITY_SIZE         HEX: 8061 ; inline
+: GL_NEAREST_MIPMAP_NEAREST         HEX: 2700 ; inline
+: GL_NEAREST_MIPMAP_LINEAR          HEX: 2702 ; inline
+: GL_LINEAR_MIPMAP_NEAREST          HEX: 2701 ; inline
+: GL_LINEAR_MIPMAP_LINEAR           HEX: 2703 ; inline
+: GL_OBJECT_LINEAR                  HEX: 2401 ; inline
+: GL_OBJECT_PLANE                   HEX: 2501 ; inline
+: GL_EYE_LINEAR                     HEX: 2400 ; inline
+: GL_EYE_PLANE                      HEX: 2502 ; inline
+: GL_SPHERE_MAP                     HEX: 2402 ; inline
+: GL_DECAL                          HEX: 2101 ; inline
+: GL_MODULATE                       HEX: 2100 ; inline
+: GL_NEAREST                        HEX: 2600 ; inline
+: GL_REPEAT                         HEX: 2901 ; inline
+: GL_CLAMP                          HEX: 2900 ; inline
+: GL_S                              HEX: 2000 ; inline
+: GL_T                              HEX: 2001 ; inline
+: GL_R                              HEX: 2002 ; inline
+: GL_Q                              HEX: 2003 ; inline
+: GL_TEXTURE_GEN_R                  HEX: 0C62 ; inline
+: GL_TEXTURE_GEN_Q                  HEX: 0C63 ; inline
+
+! Utility inline
+: GL_VENDOR                         HEX: 1F00 ; inline
+: GL_RENDERER                       HEX: 1F01 ; inline
+: GL_VERSION                        HEX: 1F02 ; inline
+: GL_EXTENSIONS                     HEX: 1F03 ; inline
+
+! Errors inline
+: GL_NO_ERROR                       HEX:    0 ; inline
+: GL_INVALID_VALUE                  HEX: 0501 ; inline
+: GL_INVALID_ENUM                   HEX: 0500 ; inline
+: GL_INVALID_OPERATION              HEX: 0502 ; inline
+: GL_STACK_OVERFLOW                 HEX: 0503 ; inline
+: GL_STACK_UNDERFLOW                HEX: 0504 ; inline
+: GL_OUT_OF_MEMORY                  HEX: 0505 ; inline
+
+! glPush/PopAttrib bits
+: GL_CURRENT_BIT                    HEX: 00000001 ; inline
+: GL_POINT_BIT                      HEX: 00000002 ; inline
+: GL_LINE_BIT                       HEX: 00000004 ; inline
+: GL_POLYGON_BIT                    HEX: 00000008 ; inline
+: GL_POLYGON_STIPPLE_BIT            HEX: 00000010 ; inline
+: GL_PIXEL_MODE_BIT                 HEX: 00000020 ; inline
+: GL_LIGHTING_BIT                   HEX: 00000040 ; inline
+: GL_FOG_BIT                        HEX: 00000080 ; inline
+: GL_DEPTH_BUFFER_BIT               HEX: 00000100 ; inline
+: GL_ACCUM_BUFFER_BIT               HEX: 00000200 ; inline
+: GL_STENCIL_BUFFER_BIT             HEX: 00000400 ; inline
+: GL_VIEWPORT_BIT                   HEX: 00000800 ; inline
+: GL_TRANSFORM_BIT                  HEX: 00001000 ; inline
+: GL_ENABLE_BIT                     HEX: 00002000 ; inline
+: GL_COLOR_BUFFER_BIT               HEX: 00004000 ; inline
+: GL_HINT_BIT                       HEX: 00008000 ; inline
+: GL_EVAL_BIT                       HEX: 00010000 ; inline
+: GL_LIST_BIT                       HEX: 00020000 ; inline
+: GL_TEXTURE_BIT                    HEX: 00040000 ; inline
+: GL_SCISSOR_BIT                    HEX: 00080000 ; inline
+: GL_ALL_ATTRIB_BITS                HEX: 000FFFFF ; inline
+
+! OpenGL 1.1
+: GL_PROXY_TEXTURE_1D               HEX: 8063 ; inline
+: GL_PROXY_TEXTURE_2D               HEX: 8064 ; inline
+: GL_TEXTURE_PRIORITY               HEX: 8066 ; inline
+: GL_TEXTURE_RESIDENT               HEX: 8067 ; inline
+: GL_TEXTURE_BINDING_1D             HEX: 8068 ; inline
+: GL_TEXTURE_BINDING_2D             HEX: 8069 ; inline
+: GL_TEXTURE_INTERNAL_FORMAT        HEX: 1003 ; inline
+: GL_ALPHA4                         HEX: 803B ; inline
+: GL_ALPHA8                         HEX: 803C ; inline
+: GL_ALPHA12                        HEX: 803D ; inline
+: GL_ALPHA16                        HEX: 803E ; inline
+: GL_LUMINANCE4                     HEX: 803F ; inline
+: GL_LUMINANCE8                     HEX: 8040 ; inline
+: GL_LUMINANCE12                    HEX: 8041 ; inline
+: GL_LUMINANCE16                    HEX: 8042 ; inline
+: GL_LUMINANCE4_ALPHA4              HEX: 8043 ; inline
+: GL_LUMINANCE6_ALPHA2              HEX: 8044 ; inline
+: GL_LUMINANCE8_ALPHA8              HEX: 8045 ; inline
+: GL_LUMINANCE12_ALPHA4             HEX: 8046 ; inline
+: GL_LUMINANCE12_ALPHA12            HEX: 8047 ; inline
+: GL_LUMINANCE16_ALPHA16            HEX: 8048 ; inline
+: GL_INTENSITY                      HEX: 8049 ; inline
+: GL_INTENSITY4                     HEX: 804A ; inline
+: GL_INTENSITY8                     HEX: 804B ; inline
+: GL_INTENSITY12                    HEX: 804C ; inline
+: GL_INTENSITY16                    HEX: 804D ; inline
+: GL_R3_G3_B2                       HEX: 2A10 ; inline
+: GL_RGB4                           HEX: 804F ; inline
+: GL_RGB5                           HEX: 8050 ; inline
+: GL_RGB8                           HEX: 8051 ; inline
+: GL_RGB10                          HEX: 8052 ; inline
+: GL_RGB12                          HEX: 8053 ; inline
+: GL_RGB16                          HEX: 8054 ; inline
+: GL_RGBA2                          HEX: 8055 ; inline
+: GL_RGBA4                          HEX: 8056 ; inline
+: GL_RGB5_A1                        HEX: 8057 ; inline
+: GL_RGBA8                          HEX: 8058 ; inline
+: GL_RGB10_A2                       HEX: 8059 ; inline
+: GL_RGBA12                         HEX: 805A ; inline
+: GL_RGBA16                         HEX: 805B ; inline
+: GL_CLIENT_PIXEL_STORE_BIT         HEX: 00000001 ; inline
+: GL_CLIENT_VERTEX_ARRAY_BIT        HEX: 00000002 ; inline
+: GL_ALL_CLIENT_ATTRIB_BITS         HEX: FFFFFFFF ; inline
+: GL_CLIENT_ALL_ATTRIB_BITS         HEX: FFFFFFFF ; inline
+
+LIBRARY: gl
+
+! Miscellaneous
+
+FUNCTION: void glClearIndex ( GLfloat c ) ;
+FUNCTION: void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ;
+FUNCTION: void glClear ( GLbitfield mask ) ;
+FUNCTION: void glIndexMask ( GLuint mask ) ;
+FUNCTION: void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) ;
+FUNCTION: void glAlphaFunc ( GLenum func, GLclampf ref ) ;
+FUNCTION: void glBlendFunc ( GLenum sfactor, GLenum dfactor ) ;
+FUNCTION: void glLogicOp ( GLenum opcode ) ;
+FUNCTION: void glCullFace ( GLenum mode ) ;
+FUNCTION: void glFrontFace ( GLenum mode ) ;
+FUNCTION: void glPointSize ( GLfloat size ) ;
+FUNCTION: void glLineWidth ( GLfloat width ) ;
+FUNCTION: void glLineStipple ( GLint factor, GLushort pattern ) ;
+FUNCTION: void glPolygonMode ( GLenum face, GLenum mode ) ;
+FUNCTION: void glPolygonOffset ( GLfloat factor, GLfloat units ) ;
+FUNCTION: void glPolygonStipple ( GLubyte* mask ) ;
+FUNCTION: void glGetPolygonStipple ( GLubyte* mask ) ;
+FUNCTION: void glEdgeFlag ( GLboolean flag ) ;
+FUNCTION: void glEdgeFlagv ( GLboolean* flag ) ;
+FUNCTION: void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) ;
+FUNCTION: void glClipPlane ( GLenum plane, GLdouble* equation ) ;
+FUNCTION: void glGetClipPlane ( GLenum plane, GLdouble* equation ) ;
+FUNCTION: void glDrawBuffer ( GLenum mode ) ;
+FUNCTION: void glReadBuffer ( GLenum mode ) ;
+FUNCTION: void glEnable ( GLenum cap ) ;
+FUNCTION: void glDisable ( GLenum cap ) ;
+FUNCTION: GLboolean glIsEnabled ( GLenum cap ) ;
+FUNCTION: void glEnableClientState ( GLenum cap ) ;
+FUNCTION: void glDisableClientState ( GLenum cap ) ;
+FUNCTION: void glGetBooleanv ( GLenum pname, GLboolean* params ) ;
+FUNCTION: void glGetDoublev ( GLenum pname, GLdouble* params ) ;
+FUNCTION: void glGetFloatv ( GLenum pname, GLfloat* params ) ;
+FUNCTION: void glGetIntegerv ( GLenum pname, GLint* params ) ;
+
+FUNCTION: void glPushAttrib ( GLbitfield mask ) ;
+FUNCTION: void glPopAttrib ( ) ;
+
+FUNCTION: void glPushClientAttrib ( GLbitfield mask ) ;
+FUNCTION: void glPopClientAttrib ( ) ;
+
+FUNCTION: GLint glRenderMode ( GLenum mode ) ;
+FUNCTION: GLenum glGetError ( ) ;
+FUNCTION: char* glGetString ( GLenum name ) ;
+FUNCTION: void glFinish ( ) ;
+FUNCTION: void glFlush ( ) ;
+FUNCTION: void glHint ( GLenum target, GLenum mode ) ;
+
+FUNCTION: void glClearDepth ( GLclampd depth ) ;
+FUNCTION: void glDepthFunc ( GLenum func ) ;
+FUNCTION: void glDepthMask ( GLboolean flag ) ;
+FUNCTION: void glDepthRange ( GLclampd near_val, GLclampd far_val ) ;
+
+FUNCTION: void glClearAccum ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ;
+FUNCTION: void glAccum ( GLenum op, GLfloat value ) ;
+
+FUNCTION: void glMatrixMode ( GLenum mode ) ;
+FUNCTION: void glOrtho ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, 
+                         GLdouble near_val, GLdouble far_val ) ;
+FUNCTION: void glFrustum ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, 
+                           GLdouble near_val, GLdouble far_val ) ;
+FUNCTION: void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) ;
+FUNCTION: void glPushMatrix ( ) ;
+FUNCTION: void glPopMatrix ( ) ;
+FUNCTION: void glLoadIdentity ( ) ;
+FUNCTION: void glLoadMatrixd ( GLdouble* m ) ;
+FUNCTION: void glLoadMatrixf ( GLfloat* m ) ;
+FUNCTION: void glMultMatrixd ( GLdouble* m ) ;
+FUNCTION: void glMultMatrixf ( GLfloat* m ) ;
+FUNCTION: void glRotated ( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) ;
+FUNCTION: void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) ;
+FUNCTION: void glScaled ( GLdouble x, GLdouble y, GLdouble z ) ;
+FUNCTION: void glScalef ( GLfloat x, GLfloat y, GLfloat z ) ;
+FUNCTION: void glTranslated ( GLdouble x, GLdouble y, GLdouble z ) ;
+FUNCTION: void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) ;
+
+
+FUNCTION: GLboolean glIsList ( GLuint list ) ;
+FUNCTION: void glDeleteLists ( GLuint list, GLsizei range ) ;
+FUNCTION: GLuint glGenLists ( GLsizei range ) ;
+FUNCTION: void glNewList ( GLuint list, GLenum mode ) ;
+FUNCTION: void glEndList ( ) ;
+FUNCTION: void glCallList ( GLuint list ) ;
+FUNCTION: void glCallLists ( GLsizei n, GLenum type, GLvoid* lists ) ;
+FUNCTION: void glListBase ( GLuint base ) ;
+
+FUNCTION: void glBegin ( GLenum mode ) ;
+FUNCTION: void glEnd ( ) ;
+
+FUNCTION: void glVertex2d ( GLdouble x, GLdouble y ) ;
+FUNCTION: void glVertex2f ( GLfloat x, GLfloat y ) ;
+FUNCTION: void glVertex2i ( GLint x, GLint y ) ;
+FUNCTION: void glVertex2s ( GLshort x, GLshort y ) ;
+
+FUNCTION: void glVertex3d ( GLdouble x, GLdouble y, GLdouble z ) ;
+FUNCTION: void glVertex3f ( GLfloat x, GLfloat y, GLfloat z ) ;
+FUNCTION: void glVertex3i ( GLint x, GLint y, GLint z ) ;
+FUNCTION: void glVertex3s ( GLshort x, GLshort y, GLshort z ) ;
+
+FUNCTION: void glVertex4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ;
+FUNCTION: void glVertex4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ;
+FUNCTION: void glVertex4i ( GLint x, GLint y, GLint z, GLint w ) ;
+FUNCTION: void glVertex4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ;
+
+FUNCTION: void glVertex2dv ( GLdouble* v ) ;
+FUNCTION: void glVertex2fv ( GLfloat* v ) ;
+FUNCTION: void glVertex2iv ( GLint* v ) ;
+FUNCTION: void glVertex2sv ( GLshort* v ) ;
+
+FUNCTION: void glVertex3dv ( GLdouble* v ) ;
+FUNCTION: void glVertex3fv ( GLfloat* v ) ;
+FUNCTION: void glVertex3iv ( GLint* v ) ;
+FUNCTION: void glVertex3sv ( GLshort* v ) ;
+
+FUNCTION: void glVertex4dv ( GLdouble* v ) ;
+FUNCTION: void glVertex4fv ( GLfloat* v ) ;
+FUNCTION: void glVertex4iv ( GLint* v ) ;
+FUNCTION: void glVertex4sv ( GLshort* v ) ;
+
+FUNCTION: void glNormal3b ( GLbyte nx, GLbyte ny, GLbyte nz ) ;
+FUNCTION: void glNormal3d ( GLdouble nx, GLdouble ny, GLdouble nz ) ;
+FUNCTION: void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) ;
+FUNCTION: void glNormal3i ( GLint nx, GLint ny, GLint nz ) ;
+FUNCTION: void glNormal3s ( GLshort nx, GLshort ny, GLshort nz ) ;
+
+FUNCTION: void glNormal3bv ( GLbyte* v ) ;
+FUNCTION: void glNormal3dv ( GLdouble* v ) ;
+FUNCTION: void glNormal3fv ( GLfloat* v ) ;
+FUNCTION: void glNormal3iv ( GLint* v ) ;
+FUNCTION: void glNormal3sv ( GLshort* v ) ;
+
+FUNCTION: void glIndexd ( GLdouble c ) ;
+FUNCTION: void glIndexf ( GLfloat c ) ;
+FUNCTION: void glIndexi ( GLint c ) ;
+FUNCTION: void glIndexs ( GLshort c ) ;
+FUNCTION: void glIndexub ( GLubyte c ) ;
+
+FUNCTION: void glIndexdv ( GLdouble* c ) ;
+FUNCTION: void glIndexfv ( GLfloat* c ) ;
+FUNCTION: void glIndexiv ( GLint* c ) ;
+FUNCTION: void glIndexsv ( GLshort* c ) ;
+FUNCTION: void glIndexubv ( GLubyte* c ) ;
+
+FUNCTION: void glColor3b ( GLbyte red, GLbyte green, GLbyte blue ) ;
+FUNCTION: void glColor3d ( GLdouble red, GLdouble green, GLdouble blue ) ;
+FUNCTION: void glColor3f ( GLfloat red, GLfloat green, GLfloat blue ) ;
+FUNCTION: void glColor3i ( GLint red, GLint green, GLint blue ) ;
+FUNCTION: void glColor3s ( GLshort red, GLshort green, GLshort blue ) ;
+FUNCTION: void glColor3ub ( GLubyte red, GLubyte green, GLubyte blue ) ;
+FUNCTION: void glColor3ui ( GLuint red, GLuint green, GLuint blue ) ;
+FUNCTION: void glColor3us ( GLushort red, GLushort green, GLushort blue ) ;
+
+FUNCTION: void glColor4b ( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) ;
+FUNCTION: void glColor4d ( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) ;
+FUNCTION: void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ;
+FUNCTION: void glColor4i ( GLint red, GLint green, GLint blue, GLint alpha ) ;
+FUNCTION: void glColor4s ( GLshort red, GLshort green, GLshort blue, GLshort alpha ) ;
+FUNCTION: void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) ;
+FUNCTION: void glColor4ui ( GLuint red, GLuint green, GLuint blue, GLuint alpha ) ;
+FUNCTION: void glColor4us ( GLushort red, GLushort green, GLushort blue, GLushort alpha ) ;
+
+FUNCTION: void glColor3bv ( GLbyte* v ) ;
+FUNCTION: void glColor3dv ( GLdouble* v ) ;
+FUNCTION: void glColor3fv ( GLfloat* v ) ;
+FUNCTION: void glColor3iv ( GLint* v ) ;
+FUNCTION: void glColor3sv ( GLshort* v ) ;
+FUNCTION: void glColor3ubv ( GLubyte* v ) ;
+FUNCTION: void glColor3uiv ( GLuint* v ) ;
+FUNCTION: void glColor3usv ( GLushort* v ) ;
+
+FUNCTION: void glColor4bv ( GLbyte* v ) ;
+FUNCTION: void glColor4dv ( GLdouble* v ) ;
+FUNCTION: void glColor4fv ( GLfloat* v ) ;
+FUNCTION: void glColor4iv ( GLint* v ) ;
+FUNCTION: void glColor4sv ( GLshort* v ) ;
+FUNCTION: void glColor4ubv ( GLubyte* v ) ;
+FUNCTION: void glColor4uiv ( GLuint* v ) ;
+FUNCTION: void glColor4usv ( GLushort* v ) ;
+
+
+FUNCTION: void glTexCoord1d ( GLdouble s ) ;
+FUNCTION: void glTexCoord1f ( GLfloat s ) ;
+FUNCTION: void glTexCoord1i ( GLint s ) ;
+FUNCTION: void glTexCoord1s ( GLshort s ) ;
+
+FUNCTION: void glTexCoord2d ( GLdouble s, GLdouble t ) ;
+FUNCTION: void glTexCoord2f ( GLfloat s, GLfloat t ) ;
+FUNCTION: void glTexCoord2i ( GLint s, GLint t ) ;
+FUNCTION: void glTexCoord2s ( GLshort s, GLshort t ) ;
+
+FUNCTION: void glTexCoord3d ( GLdouble s, GLdouble t, GLdouble r ) ;
+FUNCTION: void glTexCoord3f ( GLfloat s, GLfloat t, GLfloat r ) ;
+FUNCTION: void glTexCoord3i ( GLint s, GLint t, GLint r ) ;
+FUNCTION: void glTexCoord3s ( GLshort s, GLshort t, GLshort r ) ;
+
+FUNCTION: void glTexCoord4d ( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) ;
+FUNCTION: void glTexCoord4f ( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) ;
+FUNCTION: void glTexCoord4i ( GLint s, GLint t, GLint r, GLint q ) ;
+FUNCTION: void glTexCoord4s ( GLshort s, GLshort t, GLshort r, GLshort q ) ;
+
+FUNCTION: void glTexCoord1dv ( GLdouble* v ) ;
+FUNCTION: void glTexCoord1fv ( GLfloat* v ) ;
+FUNCTION: void glTexCoord1iv ( GLint* v ) ;
+FUNCTION: void glTexCoord1sv ( GLshort* v ) ;
+
+FUNCTION: void glTexCoord2dv ( GLdouble* v ) ;
+FUNCTION: void glTexCoord2fv ( GLfloat* v ) ;
+FUNCTION: void glTexCoord2iv ( GLint* v ) ;
+FUNCTION: void glTexCoord2sv ( GLshort* v ) ;
+
+FUNCTION: void glTexCoord3dv ( GLdouble* v ) ;
+FUNCTION: void glTexCoord3fv ( GLfloat* v ) ;
+FUNCTION: void glTexCoord3iv ( GLint* v ) ;
+FUNCTION: void glTexCoord3sv ( GLshort* v ) ;
+
+FUNCTION: void glTexCoord4dv ( GLdouble* v ) ;
+FUNCTION: void glTexCoord4fv ( GLfloat* v ) ;
+FUNCTION: void glTexCoord4iv ( GLint* v ) ;
+FUNCTION: void glTexCoord4sv ( GLshort* v ) ;
+
+FUNCTION: void glRasterPos2d ( GLdouble x, GLdouble y ) ;
+FUNCTION: void glRasterPos2f ( GLfloat x, GLfloat y ) ;
+FUNCTION: void glRasterPos2i ( GLint x, GLint y ) ;
+FUNCTION: void glRasterPos2s ( GLshort x, GLshort y ) ;
+
+FUNCTION: void glRasterPos3d ( GLdouble x, GLdouble y, GLdouble z ) ;
+FUNCTION: void glRasterPos3f ( GLfloat x, GLfloat y, GLfloat z ) ;
+FUNCTION: void glRasterPos3i ( GLint x, GLint y, GLint z ) ;
+FUNCTION: void glRasterPos3s ( GLshort x, GLshort y, GLshort z ) ;
+
+FUNCTION: void glRasterPos4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ;
+FUNCTION: void glRasterPos4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ;
+FUNCTION: void glRasterPos4i ( GLint x, GLint y, GLint z, GLint w ) ;
+FUNCTION: void glRasterPos4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ;
+
+FUNCTION: void glRasterPos2dv ( GLdouble* v ) ;
+FUNCTION: void glRasterPos2fv ( GLfloat* v ) ;
+FUNCTION: void glRasterPos2iv ( GLint* v ) ;
+FUNCTION: void glRasterPos2sv ( GLshort* v ) ;
+
+FUNCTION: void glRasterPos3dv ( GLdouble* v ) ;
+FUNCTION: void glRasterPos3fv ( GLfloat* v ) ;
+FUNCTION: void glRasterPos3iv ( GLint* v ) ;
+FUNCTION: void glRasterPos3sv ( GLshort* v ) ;
+
+FUNCTION: void glRasterPos4dv ( GLdouble* v ) ;
+FUNCTION: void glRasterPos4fv ( GLfloat* v ) ;
+FUNCTION: void glRasterPos4iv ( GLint* v ) ;
+FUNCTION: void glRasterPos4sv ( GLshort* v ) ;
+
+
+FUNCTION: void glRectd ( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ) ;
+FUNCTION: void glRectf ( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) ;
+FUNCTION: void glRecti ( GLint x1, GLint y1, GLint x2, GLint y2 ) ;
+FUNCTION: void glRects ( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ) ;
+
+FUNCTION: void glRectdv ( GLdouble* v1, GLdouble* v2 ) ;
+FUNCTION: void glRectfv ( GLfloat* v1, GLfloat* v2 ) ;
+FUNCTION: void glRectiv ( GLint* v1, GLint* v2 ) ;
+FUNCTION: void glRectsv ( GLshort* v1, GLshort* v2 ) ;
+
+
+! Vertex Arrays (1.1)
+
+FUNCTION: void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLvoid* ptr ) ;
+FUNCTION: void glNormalPointer ( GLenum type, GLsizei stride, GLvoid* ptr ) ;
+FUNCTION: void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLvoid* ptr ) ;
+FUNCTION: void glIndexPointer ( GLenum type, GLsizei stride, GLvoid* ptr ) ;
+FUNCTION: void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLvoid* ptr ) ;
+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) which returns an alien
+FUNCTION: void glGetPointerv ( GLenum pname, GLvoid** params ) ;
+
+FUNCTION: void glArrayElement ( GLint i ) ;
+FUNCTION: void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) ;
+FUNCTION: void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLvoid* indices ) ;
+FUNCTION: void glInterleavedArrays ( GLenum format, GLsizei stride, GLvoid* pointer ) ;
+
+! Lighting
+
+FUNCTION: void glShadeModel ( GLenum mode ) ;
+
+FUNCTION: void glLightf ( GLenum light, GLenum pname, GLfloat param ) ;
+FUNCTION: void glLighti ( GLenum light, GLenum pname, GLint param ) ;
+FUNCTION: void glLightfv ( GLenum light, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glLightiv ( GLenum light, GLenum pname, GLint* params ) ;
+FUNCTION: void glGetLightfv ( GLenum light, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glGetLightiv ( GLenum light, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glLightModelf ( GLenum pname, GLfloat param ) ;
+FUNCTION: void glLightModeli ( GLenum pname, GLint param ) ;
+FUNCTION: void glLightModelfv ( GLenum pname, GLfloat* params ) ;
+FUNCTION: void glLightModeliv ( GLenum pname, GLint* params ) ;
+
+FUNCTION: void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) ;
+FUNCTION: void glMateriali ( GLenum face, GLenum pname, GLint param ) ;
+FUNCTION: void glMaterialfv ( GLenum face, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glMaterialiv ( GLenum face, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glGetMaterialiv ( GLenum face, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glColorMaterial ( GLenum face, GLenum mode ) ;
+
+
+! Raster functions
+
+FUNCTION: void glPixelZoom ( GLfloat xfactor, GLfloat yfactor ) ;
+
+FUNCTION: void glPixelStoref ( GLenum pname, GLfloat param ) ;
+FUNCTION: void glPixelStorei ( GLenum pname, GLint param ) ;
+
+FUNCTION: void glPixelTransferf ( GLenum pname, GLfloat param ) ;
+FUNCTION: void glPixelTransferi ( GLenum pname, GLint param ) ;
+
+FUNCTION: void glPixelMapfv ( GLenum map, GLsizei mapsize, GLfloat* values ) ;
+FUNCTION: void glPixelMapuiv ( GLenum map, GLsizei mapsize, GLuint* values ) ;
+FUNCTION: void glPixelMapusv ( GLenum map, GLsizei mapsize, GLushort* values ) ;
+
+FUNCTION: void glGetPixelMapfv ( GLenum map, GLfloat* values ) ;
+FUNCTION: void glGetPixelMapuiv ( GLenum map, GLuint* values ) ;
+FUNCTION: void glGetPixelMapusv ( GLenum map, GLushort* values ) ;
+
+FUNCTION: void glBitmap ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, 
+                          GLfloat xmove, GLfloat ymove, GLubyte* bitmap ) ;
+
+FUNCTION: void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, 
+                              GLenum format, GLenum type, GLvoid* pixels ) ;
+
+FUNCTION: void glDrawPixels ( GLsizei width, GLsizei height, GLenum format, 
+                              GLenum type, GLvoid* pixels ) ;
+FUNCTION: void glCopyPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) ;
+
+! Stenciling
+FUNCTION: void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) ;
+FUNCTION: void glStencilMask ( GLuint mask ) ;
+FUNCTION: void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) ;
+FUNCTION: void glClearStencil ( GLint s ) ;
+
+
+! Texture mapping
+
+FUNCTION: void glTexGend ( GLenum coord, GLenum pname, GLdouble param ) ;
+FUNCTION: void glTexGenf ( GLenum coord, GLenum pname, GLfloat param ) ;
+FUNCTION: void glTexGeni ( GLenum coord, GLenum pname, GLint param ) ;
+
+FUNCTION: void glTexGendv ( GLenum coord, GLenum pname, GLdouble* params ) ;
+FUNCTION: void glTexGenfv ( GLenum coord, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glTexGeniv ( GLenum coord, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glGetTexGendv ( GLenum coord, GLenum pname, GLdouble* params ) ;
+FUNCTION: void glGetTexGenfv ( GLenum coord, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glGetTexGeniv ( GLenum coord, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) ;
+FUNCTION: void glTexEnvi ( GLenum target, GLenum pname, GLint param ) ;
+FUNCTION: void glTexEnvfv ( GLenum target, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glTexEnviv ( GLenum target, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glGetTexEnvfv ( GLenum target, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glGetTexEnviv ( GLenum target, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) ;
+FUNCTION: void glTexParameteri ( GLenum target, GLenum pname, GLint param ) ;
+
+FUNCTION: void glTexParameterfv ( GLenum target, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glTexParameteriv ( GLenum target, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat* params ) ;
+FUNCTION: void glGetTexParameteriv ( GLenum target, GLenum pname, GLint* params ) ;
+
+FUNCTION: void glGetTexLevelParameterfv ( GLenum target, GLint level, 
+                                          GLenum pname, GLfloat* params ) ;
+FUNCTION: void glGetTexLevelParameteriv ( GLenum target, GLint level,
+                                          GLenum pname, GLint* params ) ;
+
+FUNCTION: void glTexImage1D ( GLenum target, GLint level, GLint internalFormat, GLsizei width,
+                              GLint border, GLenum format, GLenum type, GLvoid* pixels ) ;
+
+FUNCTION: void glTexImage2D ( GLenum target, GLint level, GLint internalFormat, 
+                              GLsizei width, GLsizei height, GLint border, 
+                             GLenum format, GLenum type, GLvoid* pixels ) ;
+
+FUNCTION: void glGetTexImage ( GLenum target, GLint level, GLenum format, 
+                               GLenum type, GLvoid* pixels ) ;
+
+
+! 1.1 functions
+
+FUNCTION: void glGenTextures ( GLsizei n, GLuint* textures ) ;
+
+FUNCTION: void glDeleteTextures ( GLsizei n, GLuint* textures ) ;
+
+FUNCTION: void glBindTexture ( GLenum target, GLuint texture ) ;
+
+FUNCTION: void glPrioritizeTextures ( GLsizei n, GLuint* textures, GLclampf* priorities ) ;
+
+FUNCTION: GLboolean glAreTexturesResident ( GLsizei n, GLuint* textures, GLboolean* residences ) ;
+
+FUNCTION: GLboolean glIsTexture ( GLuint texture ) ;
+
+FUNCTION: void glTexSubImage1D ( GLenum target, GLint level, GLint xoffset, GLsizei width,
+                                 GLenum format, GLenum type, GLvoid* pixels ) ;
+
+FUNCTION: void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset,
+                                 GLsizei width, GLsizei height, GLenum format, 
+                                GLenum type, GLvoid* pixels ) ;
+
+FUNCTION: void glCopyTexImage1D ( GLenum target, GLint level, GLenum internalformat, 
+                                  GLint x, GLint y, GLsizei width, GLint border ) ;
+
+FUNCTION: void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, 
+                                  GLint x, GLint y,
+                                 GLsizei width, GLsizei height, GLint border ) ;
+
+FUNCTION: void glCopyTexSubImage1D ( GLenum target, GLint level, GLint xoffset, 
+                                     GLint x, GLint y, GLsizei width ) ;
+
+FUNCTION: void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset,
+                                     GLint x, GLint y, GLsizei width, GLsizei height ) ;
+
+
+! Evaluators
+
+FUNCTION: void glMap1d ( GLenum target, GLdouble u1, GLdouble u2,
+                         GLint stride, GLint order, GLdouble* points ) ;
+FUNCTION: void glMap1f ( GLenum target, GLfloat u1, GLfloat u2,
+                         GLint stride, GLint order, GLfloat* points ) ;
+
+FUNCTION: void glMap2d ( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+                         GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+                        GLdouble* points ) ;
+FUNCTION: void glMap2f ( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+                         GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+                        GLfloat* points ) ;
+
+FUNCTION: void glGetMapdv ( GLenum target, GLenum query, GLdouble* v ) ;
+FUNCTION: void glGetMapfv ( GLenum target, GLenum query, GLfloat* v ) ;
+FUNCTION: void glGetMapiv ( GLenum target, GLenum query, GLint* v ) ;
+
+FUNCTION: void glEvalCoord1d ( GLdouble u ) ;
+FUNCTION: void glEvalCoord1f ( GLfloat u ) ;
+
+FUNCTION: void glEvalCoord1dv ( GLdouble* u ) ;
+FUNCTION: void glEvalCoord1fv ( GLfloat* u ) ;
+
+FUNCTION: void glEvalCoord2d ( GLdouble u, GLdouble v ) ;
+FUNCTION: void glEvalCoord2f ( GLfloat u, GLfloat v ) ;
+
+FUNCTION: void glEvalCoord2dv ( GLdouble* u ) ;
+FUNCTION: void glEvalCoord2fv ( GLfloat* u ) ;
+
+FUNCTION: void glMapGrid1d ( GLint un, GLdouble u1, GLdouble u2 ) ;
+FUNCTION: void glMapGrid1f ( GLint un, GLfloat u1, GLfloat u2 ) ;
+
+FUNCTION: void glMapGrid2d ( GLint un, GLdouble u1, GLdouble u2,
+                             GLint vn, GLdouble v1, GLdouble v2 ) ;
+FUNCTION: void glMapGrid2f ( GLint un, GLfloat u1, GLfloat u2,
+                             GLint vn, GLfloat v1, GLfloat v2 ) ;
+
+FUNCTION: void glEvalPoint1 ( GLint i ) ;
+FUNCTION: void glEvalPoint2 ( GLint i, GLint j ) ;
+
+FUNCTION: void glEvalMesh1 ( GLenum mode, GLint i1, GLint i2 ) ;
+FUNCTION: void glEvalMesh2 ( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) ;
+
+
+! Fog
+
+FUNCTION: void glFogf ( GLenum pname, GLfloat param ) ;
+FUNCTION: void glFogi ( GLenum pname, GLint param ) ;
+FUNCTION: void glFogfv ( GLenum pname, GLfloat* params ) ;
+FUNCTION: void glFogiv ( GLenum pname, GLint* params ) ;
+
+
+! Selection and Feedback
+
+FUNCTION: void glFeedbackBuffer ( GLsizei size, GLenum type, GLfloat* buffer ) ;
+
+FUNCTION: void glPassThrough ( GLfloat token ) ;
+FUNCTION: void glSelectBuffer ( GLsizei size, GLuint* buffer ) ;
+FUNCTION: void glInitNames ( ) ;
+FUNCTION: void glLoadName ( GLuint name ) ;
+FUNCTION: void glPushName ( GLuint name ) ;
+FUNCTION: void glPopName ( ) ;
+
+
+! OpenGL 1.2
+
+: GL_PACK_SKIP_IMAGES               HEX: 806B ; inline
+: GL_PACK_IMAGE_HEIGHT              HEX: 806C ; inline
+: GL_UNPACK_SKIP_IMAGES             HEX: 806D ; inline
+: GL_UNPACK_IMAGE_HEIGHT            HEX: 806E ; inline
+: GL_TEXTURE_3D                     HEX: 806F ; inline
+: GL_PROXY_TEXTURE_3D               HEX: 8070 ; inline
+: GL_TEXTURE_DEPTH                  HEX: 8071 ; inline
+: GL_TEXTURE_WRAP_R                 HEX: 8072 ; inline
+: GL_MAX_3D_TEXTURE_SIZE            HEX: 8073 ; inline
+: GL_BGR                            HEX: 80E0 ; inline
+: GL_BGRA                           HEX: 80E1 ; inline
+: GL_UNSIGNED_BYTE_3_3_2            HEX: 8032 ; inline
+: GL_UNSIGNED_BYTE_2_3_3_REV        HEX: 8362 ; inline
+: GL_UNSIGNED_SHORT_5_6_5           HEX: 8363 ; inline
+: GL_UNSIGNED_SHORT_5_6_5_REV       HEX: 8364 ; inline
+: GL_UNSIGNED_SHORT_4_4_4_4         HEX: 8033 ; inline
+: GL_UNSIGNED_SHORT_4_4_4_4_REV     HEX: 8365 ; inline
+: GL_UNSIGNED_SHORT_5_5_5_1         HEX: 8034 ; inline
+: GL_UNSIGNED_SHORT_1_5_5_5_REV     HEX: 8366 ; inline
+: GL_UNSIGNED_INT_8_8_8_8           HEX: 8035 ; inline
+: GL_UNSIGNED_INT_8_8_8_8_REV       HEX: 8367 ; inline
+: GL_UNSIGNED_INT_10_10_10_2        HEX: 8036 ; inline
+: GL_UNSIGNED_INT_2_10_10_10_REV    HEX: 8368 ; inline
+: GL_RESCALE_NORMAL                 HEX: 803A ; inline
+: GL_LIGHT_MODEL_COLOR_CONTROL      HEX: 81F8 ; inline
+: GL_SINGLE_COLOR                   HEX: 81F9 ; inline
+: GL_SEPARATE_SPECULAR_COLOR        HEX: 81FA ; inline
+: GL_CLAMP_TO_EDGE                  HEX: 812F ; inline
+: GL_TEXTURE_MIN_LOD                HEX: 813A ; inline
+: GL_TEXTURE_MAX_LOD                HEX: 813B ; inline
+: GL_TEXTURE_BASE_LEVEL             HEX: 813C ; inline
+: GL_TEXTURE_MAX_LEVEL              HEX: 813D ; inline
+: GL_MAX_ELEMENTS_VERTICES          HEX: 80E8 ; inline
+: GL_MAX_ELEMENTS_INDICES           HEX: 80E9 ; inline
+: GL_ALIASED_POINT_SIZE_RANGE       HEX: 846D ; inline
+: GL_ALIASED_LINE_WIDTH_RANGE       HEX: 846E ; inline
+
+
+! Not present on Windows
+! FUNCTION: void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid* indices ) ;
+
+! FUNCTION: void glTexImage3D ( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid* pixels ) ;
+
+! FUNCTION: void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* pixels ) ;
+
+! FUNCTION: void glCopyTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) ;
+
+! TODO: the rest. looks fiddly
+
+! OpenGL 1.3
+
+: GL_ACTIVE_TEXTURE                 HEX: 84E0 ; inline
+: GL_CLIENT_ACTIVE_TEXTURE          HEX: 84E1 ; inline
+: GL_MAX_TEXTURE_UNITS              HEX: 84E2 ; inline
+: GL_TEXTURE0                       HEX: 84C0 ; inline
+: GL_TEXTURE1                       HEX: 84C1 ; inline
+: GL_TEXTURE2                       HEX: 84C2 ; inline
+: GL_TEXTURE3                       HEX: 84C3 ; inline
+: GL_TEXTURE4                       HEX: 84C4 ; inline
+: GL_TEXTURE5                       HEX: 84C5 ; inline
+: GL_TEXTURE6                       HEX: 84C6 ; inline
+: GL_TEXTURE7                       HEX: 84C7 ; inline
+: GL_TEXTURE8                       HEX: 84C8 ; inline
+: GL_TEXTURE9                       HEX: 84C9 ; inline
+: GL_TEXTURE10                      HEX: 84CA ; inline
+: GL_TEXTURE11                      HEX: 84CB ; inline
+: GL_TEXTURE12                      HEX: 84CC ; inline
+: GL_TEXTURE13                      HEX: 84CD ; inline
+: GL_TEXTURE14                      HEX: 84CE ; inline
+: GL_TEXTURE15                      HEX: 84CF ; inline
+: GL_TEXTURE16                      HEX: 84D0 ; inline
+: GL_TEXTURE17                      HEX: 84D1 ; inline
+: GL_TEXTURE18                      HEX: 84D2 ; inline
+: GL_TEXTURE19                      HEX: 84D3 ; inline
+: GL_TEXTURE20                      HEX: 84D4 ; inline
+: GL_TEXTURE21                      HEX: 84D5 ; inline
+: GL_TEXTURE22                      HEX: 84D6 ; inline
+: GL_TEXTURE23                      HEX: 84D7 ; inline
+: GL_TEXTURE24                      HEX: 84D8 ; inline
+: GL_TEXTURE25                      HEX: 84D9 ; inline
+: GL_TEXTURE26                      HEX: 84DA ; inline
+: GL_TEXTURE27                      HEX: 84DB ; inline
+: GL_TEXTURE28                      HEX: 84DC ; inline
+: GL_TEXTURE29                      HEX: 84DD ; inline
+: GL_TEXTURE30                      HEX: 84DE ; inline
+: GL_TEXTURE31                      HEX: 84DF ; inline
+: GL_NORMAL_MAP                     HEX: 8511 ; inline
+: GL_REFLECTION_MAP                 HEX: 8512 ; inline
+: GL_TEXTURE_CUBE_MAP               HEX: 8513 ; inline
+: GL_TEXTURE_BINDING_CUBE_MAP       HEX: 8514 ; inline
+: GL_TEXTURE_CUBE_MAP_POSITIVE_X    HEX: 8515 ; inline
+: GL_TEXTURE_CUBE_MAP_NEGATIVE_X    HEX: 8516 ; inline
+: GL_TEXTURE_CUBE_MAP_POSITIVE_Y    HEX: 8517 ; inline
+: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    HEX: 8518 ; inline
+: GL_TEXTURE_CUBE_MAP_POSITIVE_Z    HEX: 8519 ; inline
+: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    HEX: 851A ; inline
+: GL_PROXY_TEXTURE_CUBE_MAP         HEX: 851B ; inline
+: GL_MAX_CUBE_MAP_TEXTURE_SIZE      HEX: 851C ; inline
+: GL_COMBINE                        HEX: 8570 ; inline
+: GL_COMBINE_RGB                    HEX: 8571 ; inline
+: GL_COMBINE_ALPHA                  HEX: 8572 ; inline
+: GL_RGB_SCALE                      HEX: 8573 ; inline
+: GL_ADD_SIGNED                     HEX: 8574 ; inline
+: GL_INTERPOLATE                    HEX: 8575 ; inline
+: GL_CONSTANT                       HEX: 8576 ; inline
+: GL_PRIMARY_COLOR                  HEX: 8577 ; inline
+: GL_PREVIOUS                       HEX: 8578 ; inline
+: GL_SOURCE0_RGB                    HEX: 8580 ; inline
+: GL_SOURCE1_RGB                    HEX: 8581 ; inline
+: GL_SOURCE2_RGB                    HEX: 8582 ; inline
+: GL_SOURCE0_ALPHA                  HEX: 8588 ; inline
+: GL_SOURCE1_ALPHA                  HEX: 8589 ; inline
+: GL_SOURCE2_ALPHA                  HEX: 858A ; inline
+: GL_OPERAND0_RGB                   HEX: 8590 ; inline
+: GL_OPERAND1_RGB                   HEX: 8591 ; inline
+: GL_OPERAND2_RGB                   HEX: 8592 ; inline
+: GL_OPERAND0_ALPHA                 HEX: 8598 ; inline
+: GL_OPERAND1_ALPHA                 HEX: 8599 ; inline
+: GL_OPERAND2_ALPHA                 HEX: 859A ; inline
+: GL_SUBTRACT                       HEX: 84E7 ; inline
+: GL_TRANSPOSE_MODELVIEW_MATRIX     HEX: 84E3 ; inline
+: GL_TRANSPOSE_PROJECTION_MATRIX    HEX: 84E4 ; inline
+: GL_TRANSPOSE_TEXTURE_MATRIX       HEX: 84E5 ; inline
+: GL_TRANSPOSE_COLOR_MATRIX         HEX: 84E6 ; inline
+: GL_COMPRESSED_ALPHA               HEX: 84E9 ; inline
+: GL_COMPRESSED_LUMINANCE           HEX: 84EA ; inline
+: GL_COMPRESSED_LUMINANCE_ALPHA     HEX: 84EB ; inline
+: GL_COMPRESSED_INTENSITY           HEX: 84EC ; inline
+: GL_COMPRESSED_RGB                 HEX: 84ED ; inline
+: GL_COMPRESSED_RGBA                HEX: 84EE ; inline
+: GL_TEXTURE_COMPRESSION_HINT       HEX: 84EF ; inline
+: GL_TEXTURE_COMPRESSED_IMAGE_SIZE  HEX: 86A0 ; inline
+: GL_TEXTURE_COMPRESSED             HEX: 86A1 ; inline
+: GL_NUM_COMPRESSED_TEXTURE_FORMATS HEX: 86A2 ; inline
+: GL_COMPRESSED_TEXTURE_FORMATS     HEX: 86A3 ; inline
+: GL_DOT3_RGB                       HEX: 86AE ; inline
+: GL_DOT3_RGBA                      HEX: 86AF ; inline
+: GL_CLAMP_TO_BORDER                HEX: 812D ; inline
+: GL_MULTISAMPLE                    HEX: 809D ; inline
+: GL_SAMPLE_ALPHA_TO_COVERAGE       HEX: 809E ; inline
+: GL_SAMPLE_ALPHA_TO_ONE            HEX: 809F ; inline
+: GL_SAMPLE_COVERAGE                HEX: 80A0 ; inline
+: GL_SAMPLE_BUFFERS                 HEX: 80A8 ; inline
+: GL_SAMPLES                        HEX: 80A9 ; inline
+: GL_SAMPLE_COVERAGE_VALUE          HEX: 80AA ; inline
+: GL_SAMPLE_COVERAGE_INVERT         HEX: 80AB ; inline
+: GL_MULTISAMPLE_BIT                HEX: 20000000 ; inline
+
+
+! OpenGL 1.4
+
+: GL_POINT_SIZE_MIN                 HEX: 8126 ; inline
+: GL_POINT_SIZE_MAX                 HEX: 8127 ; inline
+: GL_POINT_FADE_THRESHOLD_SIZE      HEX: 8128 ; inline
+: GL_POINT_DISTANCE_ATTENUATION     HEX: 8129 ; inline
+: GL_FOG_COORDINATE_SOURCE          HEX: 8450 ; inline
+: GL_FOG_COORDINATE                 HEX: 8451 ; inline
+: GL_FRAGMENT_DEPTH                 HEX: 8452 ; inline
+: GL_CURRENT_FOG_COORDINATE         HEX: 8453 ; inline
+: GL_FOG_COORDINATE_ARRAY_TYPE      HEX: 8454 ; inline
+: GL_FOG_COORDINATE_ARRAY_STRIDE    HEX: 8455 ; inline
+: GL_FOG_COORDINATE_ARRAY_POINTER   HEX: 8456 ; inline
+: GL_FOG_COORDINATE_ARRAY           HEX: 8457 ; inline
+: GL_COLOR_SUM                      HEX: 8458 ; inline
+: GL_CURRENT_SECONDARY_COLOR        HEX: 8459 ; inline
+: GL_SECONDARY_COLOR_ARRAY_SIZE     HEX: 845A ; inline
+: GL_SECONDARY_COLOR_ARRAY_TYPE     HEX: 845B ; inline
+: GL_SECONDARY_COLOR_ARRAY_STRIDE   HEX: 845C ; inline
+: GL_SECONDARY_COLOR_ARRAY_POINTER  HEX: 845D ; inline
+: GL_SECONDARY_COLOR_ARRAY          HEX: 845E ; inline
+: GL_INCR_WRAP                      HEX: 8507 ; inline
+: GL_DECR_WRAP                      HEX: 8508 ; inline
+: GL_MAX_TEXTURE_LOD_BIAS           HEX: 84FD ; inline
+: GL_TEXTURE_FILTER_CONTROL         HEX: 8500 ; inline
+: GL_TEXTURE_LOD_BIAS               HEX: 8501 ; inline
+: GL_GENERATE_MIPMAP                HEX: 8191 ; inline
+: GL_GENERATE_MIPMAP_HINT           HEX: 8192 ; inline
+: GL_BLEND_DST_RGB                  HEX: 80C8 ; inline
+: GL_BLEND_SRC_RGB                  HEX: 80C9 ; inline
+: GL_BLEND_DST_ALPHA                HEX: 80CA ; inline
+: GL_BLEND_SRC_ALPHA                HEX: 80CB ; inline
+: GL_MIRRORED_REPEAT                HEX: 8370 ; inline
+: GL_DEPTH_COMPONENT16              HEX: 81A5 ; inline
+: GL_DEPTH_COMPONENT24              HEX: 81A6 ; inline
+: GL_DEPTH_COMPONENT32              HEX: 81A7 ; inline
+: GL_TEXTURE_DEPTH_SIZE             HEX: 884A ; inline
+: GL_DEPTH_TEXTURE_MODE             HEX: 884B ; inline
+: GL_TEXTURE_COMPARE_MODE           HEX: 884C ; inline
+: GL_TEXTURE_COMPARE_FUNC           HEX: 884D ; inline
+: GL_COMPARE_R_TO_TEXTURE           HEX: 884E ; inline
diff --git a/extra/opengl/gl/summary.txt b/extra/opengl/gl/summary.txt
new file mode 100644 (file)
index 0000000..8bc8f00
--- /dev/null
@@ -0,0 +1 @@
+OpenGL binding - libGL
diff --git a/extra/opengl/gl/tags.txt b/extra/opengl/gl/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/opengl/glu/authors.txt b/extra/opengl/glu/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/opengl/glu/glu.factor b/extra/opengl/glu/glu.factor
new file mode 100644 (file)
index 0000000..da19ac5
--- /dev/null
@@ -0,0 +1,255 @@
+! Copyright (C) 2005 Alex Chapman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax kernel sequences words ;
+IN: opengl.glu
+
+! These are defined as structs in glu.h, but we only ever use pointers to them
+TYPEDEF: void* GLUnurbs*
+TYPEDEF: void* GLUquadric*
+TYPEDEF: void* GLUtesselator*
+TYPEDEF: void* GLubyte*
+TYPEDEF: void* GLUfuncptr
+
+! StringName
+: GLU_VERSION                        100800 ;
+: GLU_EXTENSIONS                     100801 ;
+
+! ErrorCode
+: GLU_INVALID_ENUM                   100900 ;
+: GLU_INVALID_VALUE                  100901 ;
+: GLU_OUT_OF_MEMORY                  100902 ;
+: GLU_INCOMPATIBLE_GL_VERSION        100903 ;
+: GLU_INVALID_OPERATION              100904 ;
+
+! NurbsDisplay
+: GLU_OUTLINE_POLYGON                100240 ;
+: GLU_OUTLINE_PATCH                  100241 ;
+
+! NurbsCallback
+: GLU_NURBS_ERROR                    100103 ;
+: GLU_ERROR                          100103 ;
+: GLU_NURBS_BEGIN                    100164 ;
+: GLU_NURBS_BEGIN_EXT                100164 ;
+: GLU_NURBS_VERTEX                   100165 ;
+: GLU_NURBS_VERTEX_EXT               100165 ;
+: GLU_NURBS_NORMAL                   100166 ;
+: GLU_NURBS_NORMAL_EXT               100166 ;
+: GLU_NURBS_COLOR                    100167 ;
+: GLU_NURBS_COLOR_EXT                100167 ;
+: GLU_NURBS_TEXTURE_COORD            100168 ;
+: GLU_NURBS_TEX_COORD_EXT            100168 ;
+: GLU_NURBS_END                      100169 ;
+: GLU_NURBS_END_EXT                  100169 ;
+: GLU_NURBS_BEGIN_DATA               100170 ;
+: GLU_NURBS_BEGIN_DATA_EXT           100170 ;
+: GLU_NURBS_VERTEX_DATA              100171 ;
+: GLU_NURBS_VERTEX_DATA_EXT          100171 ;
+: GLU_NURBS_NORMAL_DATA              100172 ;
+: GLU_NURBS_NORMAL_DATA_EXT          100172 ;
+: GLU_NURBS_COLOR_DATA               100173 ;
+: GLU_NURBS_COLOR_DATA_EXT           100173 ;
+: GLU_NURBS_TEXTURE_COORD_DATA       100174 ;
+: GLU_NURBS_TEX_COORD_DATA_EXT       100174 ;
+: GLU_NURBS_END_DATA                 100175 ;
+: GLU_NURBS_END_DATA_EXT             100175 ;
+
+! NurbsError
+: GLU_NURBS_ERROR1                   100251 ;
+: GLU_NURBS_ERROR2                   100252 ;
+: GLU_NURBS_ERROR3                   100253 ;
+: GLU_NURBS_ERROR4                   100254 ;
+: GLU_NURBS_ERROR5                   100255 ;
+: GLU_NURBS_ERROR6                   100256 ;
+: GLU_NURBS_ERROR7                   100257 ;
+: GLU_NURBS_ERROR8                   100258 ;
+: GLU_NURBS_ERROR9                   100259 ;
+: GLU_NURBS_ERROR10                  100260 ;
+: GLU_NURBS_ERROR11                  100261 ;
+: GLU_NURBS_ERROR12                  100262 ;
+: GLU_NURBS_ERROR13                  100263 ;
+: GLU_NURBS_ERROR14                  100264 ;
+: GLU_NURBS_ERROR15                  100265 ;
+: GLU_NURBS_ERROR16                  100266 ;
+: GLU_NURBS_ERROR17                  100267 ;
+: GLU_NURBS_ERROR18                  100268 ;
+: GLU_NURBS_ERROR19                  100269 ;
+: GLU_NURBS_ERROR20                  100270 ;
+: GLU_NURBS_ERROR21                  100271 ;
+: GLU_NURBS_ERROR22                  100272 ;
+: GLU_NURBS_ERROR23                  100273 ;
+: GLU_NURBS_ERROR24                  100274 ;
+: GLU_NURBS_ERROR25                  100275 ;
+: GLU_NURBS_ERROR26                  100276 ;
+: GLU_NURBS_ERROR27                  100277 ;
+: GLU_NURBS_ERROR28                  100278 ;
+: GLU_NURBS_ERROR29                  100279 ;
+: GLU_NURBS_ERROR30                  100280 ;
+: GLU_NURBS_ERROR31                  100281 ;
+: GLU_NURBS_ERROR32                  100282 ;
+: GLU_NURBS_ERROR33                  100283 ;
+: GLU_NURBS_ERROR34                  100284 ;
+: GLU_NURBS_ERROR35                  100285 ;
+: GLU_NURBS_ERROR36                  100286 ;
+: GLU_NURBS_ERROR37                  100287 ;
+
+! NurbsProperty
+: GLU_AUTO_LOAD_MATRIX               100200 ;
+: GLU_CULLING                        100201 ;
+: GLU_SAMPLING_TOLERANCE             100203 ;
+: GLU_DISPLAY_MODE                   100204 ;
+: GLU_PARAMETRIC_TOLERANCE           100202 ;
+: GLU_SAMPLING_METHOD                100205 ;
+: GLU_U_STEP                         100206 ;
+: GLU_V_STEP                         100207 ;
+: GLU_NURBS_MODE                     100160 ;
+: GLU_NURBS_MODE_EXT                 100160 ;
+: GLU_NURBS_TESSELLATOR              100161 ;
+: GLU_NURBS_TESSELLATOR_EXT          100161 ;
+: GLU_NURBS_RENDERER                 100162 ;
+: GLU_NURBS_RENDERER_EXT             100162 ;
+
+! NurbsSampling
+: GLU_OBJECT_PARAMETRIC_ERROR        100208 ;
+: GLU_OBJECT_PARAMETRIC_ERROR_EXT    100208 ;
+: GLU_OBJECT_PATH_LENGTH             100209 ;
+: GLU_OBJECT_PATH_LENGTH_EXT         100209 ;
+: GLU_PATH_LENGTH                    100215 ;
+: GLU_PARAMETRIC_ERROR               100216 ;
+: GLU_DOMAIN_DISTANCE                100217 ;
+
+! NurbsTrim
+: GLU_MAP1_TRIM_2                    100210 ;
+: GLU_MAP1_TRIM_3                    100211 ;
+
+! QuadricDrawStyle
+: GLU_POINT                          100010 ;
+: GLU_LINE                           100011 ;
+: GLU_FILL                           100012 ;
+: GLU_SILHOUETTE                     100013 ;
+
+! QuadricNormal
+: GLU_SMOOTH                         100000 ;
+: GLU_FLAT                           100001 ;
+: GLU_NONE                           100002 ;
+
+! QuadricOrientation
+: GLU_OUTSIDE                        100020 ;
+: GLU_INSIDE                         100021 ;
+
+! TessCallback
+: GLU_TESS_BEGIN                     100100 ;
+: GLU_BEGIN                          100100 ;
+: GLU_TESS_VERTEX                    100101 ;
+: GLU_VERTEX                         100101 ;
+: GLU_TESS_END                       100102 ;
+: GLU_END                            100102 ;
+: GLU_TESS_ERROR                     100103 ;
+: GLU_TESS_EDGE_FLAG                 100104 ;
+: GLU_EDGE_FLAG                      100104 ;
+: GLU_TESS_COMBINE                   100105 ;
+: GLU_TESS_BEGIN_DATA                100106 ;
+: GLU_TESS_VERTEX_DATA               100107 ;
+: GLU_TESS_END_DATA                  100108 ;
+: GLU_TESS_ERROR_DATA                100109 ;
+: GLU_TESS_EDGE_FLAG_DATA            100110 ;
+: GLU_TESS_COMBINE_DATA              100111 ;
+
+! TessContour
+: GLU_CW                             100120 ;
+: GLU_CCW                            100121 ;
+: GLU_INTERIOR                       100122 ;
+: GLU_EXTERIOR                       100123 ;
+: GLU_UNKNOWN                        100124 ;
+
+! TessProperty
+: GLU_TESS_WINDING_RULE              100140 ;
+: GLU_TESS_BOUNDARY_ONLY             100141 ;
+: GLU_TESS_TOLERANCE                 100142 ;
+
+! TessError
+: GLU_TESS_ERROR1                    100151 ;
+: GLU_TESS_ERROR2                    100152 ;
+: GLU_TESS_ERROR3                    100153 ;
+: GLU_TESS_ERROR4                    100154 ;
+: GLU_TESS_ERROR5                    100155 ;
+: GLU_TESS_ERROR6                    100156 ;
+: GLU_TESS_ERROR7                    100157 ;
+: GLU_TESS_ERROR8                    100158 ;
+: GLU_TESS_MISSING_BEGIN_POLYGON     100151 ;
+: GLU_TESS_MISSING_BEGIN_CONTOUR     100152 ;
+: GLU_TESS_MISSING_END_POLYGON       100153 ;
+: GLU_TESS_MISSING_END_CONTOUR       100154 ;
+: GLU_TESS_COORD_TOO_LARGE           100155 ;
+: GLU_TESS_NEED_COMBINE_CALLBACK     100156 ;
+
+! TessWinding
+: GLU_TESS_WINDING_ODD               100130 ;
+: GLU_TESS_WINDING_NONZERO           100131 ;
+: GLU_TESS_WINDING_POSITIVE          100132 ;
+: GLU_TESS_WINDING_NEGATIVE          100133 ;
+: GLU_TESS_WINDING_ABS_GEQ_TWO       100134 ;
+
+LIBRARY: glu
+
+FUNCTION: void gluBeginCurve ( GLUnurbs* nurb ) ;
+FUNCTION: void gluBeginPolygon ( GLUtesselator* tess ) ;
+FUNCTION: void gluBeginSurface ( GLUnurbs* nurb ) ;
+FUNCTION: void gluBeginTrim ( GLUnurbs* nurb ) ;
+
+FUNCTION: void gluCylinder ( GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks ) ;
+FUNCTION: void gluDeleteNurbsRenderer ( GLUnurbs* nurb ) ;
+FUNCTION: void gluDeleteQuadric ( GLUquadric* quad ) ;
+FUNCTION: void gluDeleteTess ( GLUtesselator* tess ) ;
+FUNCTION: void gluDisk ( GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops ) ;
+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: void gluGetNurbsProperty ( GLUnurbs* nurb, GLenum property, GLfloat* data ) ;
+FUNCTION: char* 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 ) ;
+FUNCTION: GLUnurbs* gluNewNurbsRenderer ( ) ;
+FUNCTION: GLUquadric* gluNewQuadric ( ) ;
+FUNCTION: GLUtesselator* gluNewTess ( ) ;
+FUNCTION: void gluNextContour ( GLUtesselator* tess, GLenum type ) ;
+FUNCTION: void gluNurbsCallback ( GLUnurbs* nurb, GLenum which, GLUfuncptr CallBackFunc ) ;
+! FUNCTION: void gluNurbsCallbackData ( GLUnurbs* nurb, GLvoid* userData ) ;
+! FUNCTION: void gluNurbsCallbackDataEXT ( GLUnurbs* nurb, GLvoid* userData ) ;
+FUNCTION: void gluNurbsCurve ( GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type ) ;
+FUNCTION: void gluNurbsProperty ( GLUnurbs* nurb, GLenum property, GLfloat value ) ;
+FUNCTION: void gluNurbsSurface ( GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type ) ;
+FUNCTION: void gluOrtho2D ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top ) ;
+FUNCTION: void gluPartialDisk ( GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep ) ;
+FUNCTION: void gluPerspective ( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar ) ;
+FUNCTION: void gluPickMatrix ( GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint* viewport ) ;
+FUNCTION: GLint gluProject ( GLdouble objX, GLdouble objY, GLdouble objZ, GLdouble* model, GLdouble* proj, GLint* view, GLdouble* winX, GLdouble* winY, GLdouble* winZ ) ;
+FUNCTION: void gluPwlCurve ( GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type ) ;
+FUNCTION: void gluQuadricCallback ( GLUquadric* quad, GLenum which, GLUfuncptr CallBackFunc ) ;
+FUNCTION: void gluQuadricDrawStyle ( GLUquadric* quad, GLenum draw ) ;
+FUNCTION: void gluQuadricNormals ( GLUquadric* quad, GLenum normal ) ;
+FUNCTION: void gluQuadricOrientation ( GLUquadric* quad, GLenum orientation ) ;
+FUNCTION: void gluQuadricTexture ( GLUquadric* quad, GLboolean texture ) ;
+FUNCTION: GLint gluScaleImage ( GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, void* dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut ) ;
+FUNCTION: void gluSphere ( GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks ) ;
+FUNCTION: void gluTessBeginContour ( GLUtesselator* tess ) ;
+FUNCTION: void gluTessBeginPolygon ( GLUtesselator* tess, GLvoid* data ) ;
+FUNCTION: void gluTessCallback ( GLUtesselator* tess, GLenum which, GLUfuncptr CallBackFunc ) ;
+FUNCTION: void gluTessEndContour ( GLUtesselator* tess ) ;
+FUNCTION: void gluTessEndPolygon ( GLUtesselator* tess ) ;
+FUNCTION: void gluTessNormal ( GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ ) ;
+FUNCTION: void gluTessProperty ( GLUtesselator* tess, GLenum which, GLdouble data ) ;
+FUNCTION: void gluTessVertex ( GLUtesselator* tess, GLdouble* location, GLvoid* data ) ;
+FUNCTION: GLint gluUnProject ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble* model, GLdouble* proj, GLint* view, GLdouble* objX, GLdouble* objY, GLdouble* objZ ) ;
+
+! Not present on Windows
+! FUNCTION: GLint gluBuild1DMipmapLevels ( GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, void* data ) ;
+! FUNCTION: GLint gluBuild1DMipmaps ( GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, void* data ) ;
+! FUNCTION: GLint gluBuild2DMipmapLevels ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, void* data ) ;
+! FUNCTION: GLint gluBuild2DMipmaps ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, void* data ) ;
+! FUNCTION: GLint gluBuild3DMipmapLevels ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, void* data ) ;
+! FUNCTION: GLint gluBuild3DMipmaps ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void* data ) ;
+! FUNCTION: GLboolean gluCheckExtension ( GLubyte* extName, GLubyte* extString ) ;
+! FUNCTION: GLint gluUnProject4 ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, GLdouble* model, GLdouble* proj, GLint* view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW ) ;
diff --git a/extra/opengl/glu/summary.txt b/extra/opengl/glu/summary.txt
new file mode 100644 (file)
index 0000000..a90f4a3
--- /dev/null
@@ -0,0 +1 @@
+OpenGL binding - libGLU
diff --git a/extra/opengl/glu/tags.txt b/extra/opengl/glu/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/opengl/lib/lib.factor b/extra/opengl/lib/lib.factor
new file mode 100644 (file)
index 0000000..4e52710
--- /dev/null
@@ -0,0 +1,19 @@
+USING: kernel alien.c-types sequences opengl.gl opengl.glu ;
+
+IN: opengl.lib
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: gl-color-4f ( 4seq -- ) first4 glColor4f ;
+
+: gl-clear-color ( 4seq -- ) first4 glClearColor ;
+
+: gl-vertex-3f ( array -- ) first3 glVertex3f ;
+
+: gl-normal-3f ( array -- ) first3 glNormal3f ;
+
+: gl-material-fv ( face pname params -- ) >c-float-array glMaterialfv ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: glu-look-at ( eye focus up -- ) >r >r first3 r> first3 r> first3 gluLookAt ;
\ No newline at end of file
diff --git a/extra/opengl/opengl-docs.factor b/extra/opengl/opengl-docs.factor
new file mode 100644 (file)
index 0000000..f9a491a
--- /dev/null
@@ -0,0 +1,117 @@
+USING: help.markup help.syntax io kernel math quotations
+opengl.gl ;
+IN: opengl
+
+HELP: gl-color
+{ $values { "color" "a color specifier" } }
+{ $description "Wrapper for " { $link glColor4d } " taking a color specifier." } ;
+
+HELP: gl-error
+{ $description "If the most recent OpenGL call resulted in an error, print the error to the " { $link stdio } " stream." } ;
+
+HELP: do-state
+{ $values { "what" integer } { "quot" quotation } }
+{ $description "Wraps a quotation in " { $link glBegin } "/" { $link glEnd } " calls." } ;
+
+HELP: do-enabled
+{ $values { "what" integer } { "quot" quotation } }
+{ $description "Wraps a quotation in " { $link glEnable } "/" { $link glDisable } " calls." } ;
+
+HELP: do-matrix
+{ $values { "mode" { $link GL_MODELVIEW } " or " { $link GL_PROJECTION } } { "quot" quotation } }
+{ $description "Saves and restores the matrix specified by " { $snippet "mode" } " before and after calling the quotation." } ;
+
+HELP: gl-vertex
+{ $values { "point" "a pair of integers" } }
+{ $description "Wrapper for " { $link glVertex2d } " taking a point object." } ;
+
+HELP: gl-line
+{ $values { "a" "a pair of integers" } { "b" "a pair of integers" } }
+{ $description "Draws a line between two points." } ;
+
+HELP: gl-fill-rect
+{ $values { "loc" "a pair of integers" } { "ext" "a pair of integers" } }
+{ $description "Draws a filled rectangle with top-left corner " { $snippet "loc" } " and bottom-right corner " { $snippet "ext" } "." } ;
+
+HELP: gl-rect
+{ $values { "loc" "a pair of integers" } { "ext" "a pair of integers" } }
+{ $description "Draws the outline of a rectangle with top-left corner " { $snippet "loc" } " and bottom-right corner " { $snippet "ext" } "." } ;
+
+HELP: gl-fill-poly
+{ $values { "points" "a sequence of pairs of integers" } }
+{ $description "Draws a filled polygon." } ;
+
+HELP: gl-poly
+{ $values { "points" "a sequence of pairs of integers" } }
+{ $description "Draws the outline of a polygon." } ;
+
+HELP: gl-gradient
+{ $values { "direction" "an orientation specifier" } { "colors" "a sequence of color specifiers" } { "dim" "a pair of integers" } }
+{ $description "Draws a rectangle with top-left corner " { $snippet "{ 0 0 }" } " and dimensions " { $snippet "dim" } ", filled with a smoothly shaded transition between the colors in " { $snippet "colors" } "." } ;
+
+HELP: gen-texture
+{ $values { "id" integer } }
+{ $description "Wrapper for " { $link glGenTextures } " to handle the common case of generating a single texture ID." } ;
+
+HELP: do-attribs
+{ $values { "bits" integer } { "quot" quotation } }
+{ $description "Wraps a quotation in " { $link glPushAttrib } "/" { $link glPopAttrib } " calls." } ;
+
+HELP: sprite
+{ $class-description "A sprite is an OpenGL texture together with a display list which renders a textured quad. Sprites are used to draw text in the UI. Sprites have the following slots:"
+    { $list
+        { { $link sprite-dlist } " - an OpenGL display list ID" }
+        { { $link sprite-texture } " - an OpenGL texture ID" }
+        { { $link sprite-loc } " - top-left corner of the sprite" }
+        { { $link sprite-dim } " - dimensions of the sprite" }
+        { { $link sprite-dim2 } " - dimensions of the sprite, rounded up to the nearest powers of two" }
+    }
+} ;
+
+HELP: gray-texture
+{ $values { "sprite" sprite } { "pixmap" "an alien or byte array" } { "id" "an OpenGL texture ID" } }
+{ $description "Creates a new OpenGL texture from a 1 byte per pixel image whose dimensions are equal to " { $link sprite-dim2 } "." } ;
+
+HELP: gen-dlist
+{ $values { "id" integer } }
+{ $description "Wrapper for " { $link glGenLists } " to handle the common case of generating a single display list ID." } ;
+
+HELP: make-dlist
+{ $values { "type" "one of " { $link GL_COMPILE } " or " { $link GL_COMPILE_AND_EXECUTE } } { "quot" quotation } { "id" "an OpenGL texture ID" } }
+{ $description "Compiles the results of calling the quotation into a new OpenGL display list." } ;
+
+HELP: gl-translate
+{ $values { "point" "a pair of integers" } }
+{ $description "Wrapper for " { $link glTranslated } " taking a point object." } ;
+
+HELP: free-sprites
+{ $values { "sprites" "a sequence of " { $link sprite } " instances" } }
+{ $description "Deallocates native resources associated toa  sequence of sprites." } ;
+
+HELP: with-translation
+{ $values { "loc" "a pair of integers" } { "quot" quotation } }
+{ $description "Calls the quotation with a translation by " { $snippet "loc" } " pixels applied to the current " { $link GL_MODELVIEW } " matrix, restoring the matrix when the quotation is done." } ;
+
+ARTICLE: "gl-utilities" "OpenGL utility words"
+"In addition to the full OpenGL API, the " { $vocab-link "opengl" } " vocabulary includes some utility words to give OpenGL a more Factor-like feel."
+$nl
+"Wrappers:"
+{ $subsection gl-color }
+{ $subsection gl-vertex }
+{ $subsection gl-translate }
+"Combinators:"
+{ $subsection do-state }
+{ $subsection do-enabled }
+{ $subsection do-attribs }
+{ $subsection do-matrix }
+{ $subsection with-translation }
+{ $subsection make-dlist }
+"Rendering geometric shapes:"
+{ $subsection gl-line }
+{ $subsection gl-fill-rect }
+{ $subsection gl-rect }
+{ $subsection gl-fill-poly }
+{ $subsection gl-poly }
+{ $subsection gl-gradient } ;
+
+ABOUT: "gl-utilities"
diff --git a/extra/opengl/opengl.factor b/extra/opengl/opengl.factor
new file mode 100644 (file)
index 0000000..0cb16cc
--- /dev/null
@@ -0,0 +1,152 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types io kernel math namespaces
+sequences math.vectors opengl.gl opengl.glu ;
+IN: opengl
+
+: coordinates [ first2 ] 2apply ;
+
+: fix-coordinates [ first2 [ >fixnum ] 2apply ] 2apply ;
+
+: gl-color ( color -- ) first4 glColor4d ; inline
+
+: gl-clear ( color -- )
+    first4 glClearColor GL_COLOR_BUFFER_BIT glClear ;
+
+: gl-error ( -- )
+    glGetError dup zero? [
+        "GL error: " write dup gluErrorString print flush
+    ] unless drop ;
+
+: do-state ( what quot -- )
+    swap glBegin call glEnd ; inline
+
+: do-enabled ( what quot -- )
+    over glEnable swap slip glDisable ; inline
+
+: do-matrix ( mode quot -- )
+    swap [ glMatrixMode glPushMatrix call ] keep
+    glMatrixMode glPopMatrix ; inline
+
+: gl-vertex ( point -- ) first2 glVertex2d ; inline
+
+: gl-line ( a b -- )
+    GL_LINES [ gl-vertex gl-vertex ] do-state ;
+
+: gl-fill-rect ( loc ext -- )
+    coordinates glRectd ;
+
+: gl-rect ( loc ext -- )
+    GL_FRONT_AND_BACK GL_LINE glPolygonMode
+    >r { 0.5 0.5 } v+ r> { 0.5 0.5 } v- gl-fill-rect
+    GL_FRONT_AND_BACK GL_FILL glPolygonMode ;
+
+: (gl-poly) [ [ gl-vertex ] each ] do-state ;
+
+: gl-fill-poly ( points -- )
+    dup length 2 > GL_POLYGON GL_LINES ? (gl-poly) ;
+
+: gl-poly ( points -- )
+    GL_LINE_LOOP (gl-poly) ;
+
+: prepare-gradient ( direction dim -- v1 v2 )
+    tuck v* [ v- ] keep ;
+
+: gl-gradient ( direction colors dim -- )
+    GL_QUAD_STRIP [
+        swap >r prepare-gradient r>
+        [ length dup 1- v/n ] keep [
+            >r >r 2dup r> r> gl-color v*n
+            dup gl-vertex v+ gl-vertex
+        ] 2each 2drop
+    ] do-state ;
+
+: gen-texture ( -- id )
+    1 0 <uint> [ glGenTextures ] keep *uint ;
+
+: do-attribs ( bits quot -- )
+    swap glPushAttrib call glPopAttrib ; inline
+
+TUPLE: sprite loc dim dim2 dlist texture ;
+
+: <sprite> ( loc dim dim2 -- sprite )
+    f f sprite construct-boa ;
+
+: sprite-size2 sprite-dim2 first2 ;
+
+: sprite-width sprite-dim first ;
+
+: gray-texture ( sprite pixmap -- id )
+    gen-texture [
+        GL_TEXTURE_BIT [
+            GL_TEXTURE_2D swap glBindTexture
+            >r >r GL_TEXTURE_2D 0 GL_RGBA r>
+            sprite-size2 0 GL_LUMINANCE_ALPHA
+            GL_UNSIGNED_BYTE r> glTexImage2D
+        ] do-attribs
+    ] keep ;
+
+: gen-dlist ( -- id ) 1 glGenLists ;
+
+: make-dlist ( type quot -- id )
+    gen-dlist [ rot glNewList call glEndList ] keep ; inline
+
+: init-texture ( -- )
+    GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_LINEAR glTexParameteri
+    GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_LINEAR glTexParameteri
+    GL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP glTexParameterf
+    GL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP glTexParameterf ;
+
+: gl-translate ( point -- ) first2 0.0 glTranslated ;
+
+: top-left drop 0 0 glTexCoord2i 0.0 0.0 glVertex2d ; inline
+
+: top-right 1 0 glTexCoord2i first 0.0 glVertex2d ; inline
+
+: bottom-left 0 1 glTexCoord2i second 0.0 swap glVertex2d ; inline
+
+: bottom-right 1 1 glTexCoord2i gl-vertex ; inline
+
+: four-sides ( dim -- )
+    dup top-left dup top-right dup bottom-right bottom-left ;
+
+: draw-sprite ( sprite -- )
+    dup sprite-loc gl-translate
+    GL_TEXTURE_2D over sprite-texture glBindTexture
+    init-texture
+    GL_QUADS [ dup sprite-dim2 four-sides ] do-state
+    dup sprite-dim { 1 0 } v*
+    swap sprite-loc v- gl-translate
+    GL_TEXTURE_2D 0 glBindTexture ;
+
+: make-sprite-dlist ( sprite -- id )
+    GL_MODELVIEW [
+        GL_COMPILE [ draw-sprite ] make-dlist
+    ] do-matrix ;
+
+: init-sprite ( texture sprite -- )
+    [ set-sprite-texture ] keep
+    [ make-sprite-dlist ] keep set-sprite-dlist ;
+
+: delete-dlist ( id -- ) 1 glDeleteLists ;
+
+: free-sprite ( sprite -- )
+    dup sprite-dlist delete-dlist
+    sprite-texture <uint> 1 swap glDeleteTextures ;
+
+: free-sprites ( sprites -- ) [ [ free-sprite ] when* ] each ;
+
+: with-translation ( loc quot -- )
+    GL_MODELVIEW [ >r gl-translate r> call ] do-matrix ; inline
+
+: gl-set-clip ( loc dim -- )
+    fix-coordinates glScissor ;
+
+: gl-viewport ( loc dim -- )
+    fix-coordinates glViewport ;
+
+: init-matrices ( -- )
+    GL_PROJECTION glMatrixMode
+    glLoadIdentity
+    GL_MODELVIEW glMatrixMode
+    glLoadIdentity ;
diff --git a/extra/opengl/summary.txt b/extra/opengl/summary.txt
new file mode 100644 (file)
index 0000000..be8d212
--- /dev/null
@@ -0,0 +1 @@
+OpenGL binding
diff --git a/extra/opengl/tags.txt b/extra/opengl/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/openssl/authors.txt b/extra/openssl/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/extra/openssl/libcrypto/libcrypto.factor b/extra/openssl/libcrypto/libcrypto.factor
new file mode 100644 (file)
index 0000000..52cb06f
--- /dev/null
@@ -0,0 +1,129 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Tested with OpenSSL 0.9.8a_0 on Mac OS X 10.4.9 PowerPC
+!
+! export LD_LIBRARY_PATH=/opt/local/lib
+
+USING: alien alien.syntax combinators kernel system ;
+
+IN: openssl.libcrypto
+
+"libcrypto" {
+    { [ win32? ] [ "libeay32.dll" "stdcall" ] }
+    { [ macosx? ] [ "libcrypto.dylib" "cdecl" ] }
+    { [ unix? ] [ "$LD_LIBRARY_PATH/libcrypto.so" "cdecl" ] }
+} cond add-library
+
+C-STRUCT: bio-method
+    { "int" "type" }
+    { "void*" "name" }
+    { "void*" "bwrite" }
+    { "void*" "bread" }
+    { "void*" "bputs" }
+    { "void*" "bgets" }
+    { "void*" "ctrl" }
+    { "void*" "create" }
+    { "void*" "destroy" }
+    { "void*" "callback-ctrl" } ;
+
+C-STRUCT: bio
+    { "void*" "method" }
+    { "void*" "callback" }
+    { "void*" "cb-arg" }
+    { "int" "init" }
+    { "int" "shutdown" }
+    { "int" "flags" }
+    { "int" "retry-reason" }
+    { "int" "num" }
+    { "void*" "ptr" }
+    { "void*" "next-bio" }
+    { "void*" "prev-bio" }
+    { "int" "references" } 
+    { "ulong" "num-read" }
+    { "ulong" "num-write" } 
+    { "void*" "crypto-ex-data-stack" }
+    { "int" "crypto-ex-data-dummy" } ;
+
+: BIO_NOCLOSE       HEX: 00 ; inline
+: BIO_CLOSE         HEX: 01 ; inline
+
+: RSA_3             HEX: 3 ; inline
+: RSA_F4               HEX: 10001 ; inline
+
+: BIO_C_SET_SSL     109 ; inline
+: BIO_C_GET_SSL     110 ; inline
+
+LIBRARY: libcrypto
+
+! ===============================================
+! bio.h
+! ===============================================
+
+FUNCTION: bio* BIO_new_file ( char* filename, char* mode ) ;
+
+FUNCTION: int BIO_printf ( bio* bio, char* format ) ;
+
+FUNCTION: long BIO_ctrl ( void* bio, int cmd, long larg, void* parg ) ;
+
+FUNCTION: void* BIO_new_socket ( int fd, int close-flag ) ;
+
+FUNCTION: void* BIO_new ( void* method ) ;
+
+FUNCTION: int BIO_set ( void* bio, void* method ) ;
+
+FUNCTION: int BIO_free ( void* bio ) ;
+
+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_write ( void* b, void* buf, int len ) ;
+
+FUNCTION: int BIO_puts ( void* bp, char* buf ) ;
+
+FUNCTION: ulong ERR_get_error (  ) ;
+
+FUNCTION: char* ERR_error_string ( ulong e, void* buf ) ;
+
+FUNCTION: void* BIO_f_buffer (  ) ;
+
+! ===============================================
+! evp.h
+! ===============================================
+
+! Initialize ciphers and digest tables
+FUNCTION: void OpenSSL_add_all_ciphers (  ) ;
+
+FUNCTION: void OpenSSL_add_all_digests (  ) ;
+
+! Clean them up before exiting
+FUNCTION: void EVP_cleanup (  ) ;
+
+FUNCTION: void* EVP_get_digestbyname ( char* name ) ;
+
+FUNCTION: void EVP_MD_CTX_init ( void* ctx ) ;
+
+FUNCTION: void* PEM_read_bio_DHparams ( void* bp, void* x, void* cb,
+                                        void* u ) ;
+
+! ===============================================
+! md5.h
+! ===============================================
+
+FUNCTION: uchar* MD5 ( uchar* d, ulong n, uchar* md ) ;
+
+! ===============================================
+! rsa.h
+! ===============================================
+
+FUNCTION: void* RSA_generate_key ( int num, ulong e, void* callback,
+                                   void* cb_arg ) ;
+
+FUNCTION: int RSA_check_key ( void* rsa ) ;
+
+FUNCTION: void RSA_free ( void* rsa ) ;
+
+FUNCTION: int RSA_print_fp ( void* fp, void* x, int offset ) ;
diff --git a/extra/openssl/libssl/libssl.factor b/extra/openssl/libssl/libssl.factor
new file mode 100644 (file)
index 0000000..29016f6
--- /dev/null
@@ -0,0 +1,174 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Tested with OpenSSL 0.9.8a_0 on Mac OS X 10.4.9 PowerPC
+!
+! export LD_LIBRARY_PATH=/opt/local/lib
+
+USING: alien alien.syntax combinators kernel system ;
+
+IN: openssl.libssl
+
+"libssl" {
+    { [ win32? ] [ "ssleay32.dll" "stdcall" ] }
+    { [ macosx? ] [ "libssl.dylib" "cdecl" ] }
+    { [ unix? ] [ "$LD_LIBRARY_PATH/libssl.so" "cdecl" ] }
+} cond add-library
+
+: X509_FILETYPE_PEM       1 ; inline
+: X509_FILETYPE_ASN1      2 ; inline
+: X509_FILETYPE_DEFAULT   3 ; inline
+
+: SSL_FILETYPE_ASN1  X509_FILETYPE_ASN1 ; inline
+: SSL_FILETYPE_PEM   X509_FILETYPE_PEM ; inline
+
+: SSL_CTRL_NEED_TMP_RSA      1 ; inline
+: SSL_CTRL_SET_TMP_RSA       2 ; inline
+: SSL_CTRL_SET_TMP_DH        3 ; inline
+: SSL_CTRL_SET_TMP_RSA_CB    4 ; inline
+: SSL_CTRL_SET_TMP_DH_CB     5 ; inline
+
+: SSL_ERROR_NONE             0 ; inline
+: SSL_ERROR_SSL              1 ; inline
+: SSL_ERROR_WANT_READ        2 ; inline
+: SSL_ERROR_WANT_WRITE       3 ; inline
+: SSL_ERROR_WANT_X509_LOOKUP 4 ; inline
+: SSL_ERROR_SYSCALL          5 ; inline ! consult errno for details
+: SSL_ERROR_ZERO_RETURN      6 ; inline
+: SSL_ERROR_WANT_CONNECT     7 ; inline
+: SSL_ERROR_WANT_ACCEPT      8 ; inline
+
+! Error messages table
+: error-messages ( -- hash )
+    H{
+        { 0  "SSL_ERROR_NONE" }
+        { 1  "SSL_ERROR_SSL" }
+        { 2  "SSL_ERROR_WANT_READ" }
+        { 3  "SSL_ERROR_WANT_WRITE" }
+        { 4  "SSL_ERROR_WANT_X509_LOOKUP" }
+        { 5  "SSL_ERROR_SYSCALL" }
+        { 6  "SSL_ERROR_ZERO_RETURN" }
+        { 7  "SSL_ERROR_WANT_CONNECT" }
+        { 8  "SSL_ERROR_WANT_ACCEPT" }
+    } ;
+
+TYPEDEF: void* ssl-method
+TYPEDEF: void* ssl-ctx
+TYPEDEF: void* ssl-pointer
+
+LIBRARY: libssl
+
+! ===============================================
+! ssl.h
+! ===============================================
+
+FUNCTION: char* SSL_get_version ( ssl-pointer ssl ) ;
+
+! Maps OpenSSL errors to strings
+FUNCTION: void SSL_load_error_strings (  ) ;
+
+! Must be called before any other action takes place
+FUNCTION: int SSL_library_init (  ) ;
+
+! Sets the default SSL version
+FUNCTION: ssl-method SSLv2_client_method (  ) ;
+
+FUNCTION: ssl-method SSLv23_client_method (  ) ;
+
+FUNCTION: ssl-method SSLv23_server_method (  ) ;
+
+FUNCTION: ssl-method SSLv23_method (  ) ; ! SSLv3 but can rollback to v2
+
+FUNCTION: ssl-method SSLv3_client_method (  ) ;
+
+FUNCTION: ssl-method SSLv3_server_method (  ) ;
+
+FUNCTION: ssl-method SSLv3_method (  ) ;
+
+FUNCTION: ssl-method TLSv1_client_method (  ) ;
+
+FUNCTION: ssl-method TLSv1_server_method (  ) ;
+
+FUNCTION: ssl-method TLSv1_method (  ) ;
+
+! Creates the context
+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
+FUNCTION: ssl-pointer SSL_new ( ssl-ctx ctx ) ;
+
+FUNCTION: int SSL_set_fd ( ssl-pointer ssl, int fd ) ;
+
+FUNCTION: void SSL_set_bio ( ssl-pointer ssl, void* rbio, void* wbio ) ;
+
+FUNCTION: int SSL_get_error ( ssl-pointer ssl, int ret ) ;
+
+FUNCTION: void SSL_set_connect_state ( ssl-pointer ssl ) ;
+
+FUNCTION: void SSL_set_accept_state ( ssl-pointer ssl ) ;
+
+FUNCTION: int SSL_connect ( ssl-pointer ssl ) ;
+
+FUNCTION: int SSL_accept ( ssl-pointer ssl ) ;
+
+FUNCTION: int SSL_write ( ssl-pointer ssl, void* buf, int num ) ;
+
+FUNCTION: int SSL_read ( ssl-pointer ssl, void* buf, int num ) ;
+
+FUNCTION: void SSL_shutdown ( ssl-pointer ssl ) ;
+
+FUNCTION: void SSL_free ( ssl-pointer ssl ) ;
+
+FUNCTION: void SSL_CTX_free ( ssl-ctx ctx ) ;
+
+FUNCTION: void RAND_seed ( void* buf, int num ) ;
+
+FUNCTION: int SSL_set_cipher_list ( ssl-pointer ssl, char* str ) ;
+
+FUNCTION: int SSL_use_RSAPrivateKey_file ( ssl-pointer ssl, char* str ) ;
+
+FUNCTION: int SSL_CTX_use_RSAPrivateKey_file ( ssl-ctx ctx, int type ) ;
+
+FUNCTION: int SSL_use_certificate_file ( ssl-pointer ssl,
+                                         char* str, int type ) ;
+
+FUNCTION: int SSL_CTX_load_verify_locations ( ssl-ctx ctx, char* CAfile,
+                                              char* CApath ) ;
+
+FUNCTION: void SSL_CTX_set_client_CA_list ( ssl-ctx ctx, ssl-pointer list ) ;
+
+FUNCTION: ssl-pointer SSL_load_client_CA_file ( char* file ) ;
+
+! Used to manipulate settings of the SSL_CTX and SSL objects.
+! This function should never be called directly
+FUNCTION: long SSL_CTX_ctrl ( ssl-ctx ctx, int cmd, long larg, void* parg ) ;
+
+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,
+                                            int type ) ;
+
+! Sets the maximum depth for the allowed ctx certificate chain verification 
+FUNCTION: void SSL_CTX_set_verify_depth ( ssl-ctx ctx, int depth ) ;
+
+! Sets DH parameters to be used to be dh.
+! The key is inherited by all ssl objects created from ctx
+FUNCTION: void SSL_CTX_set_tmp_dh_callback ( ssl-ctx ctx, void* dh ) ;
+
+FUNCTION: void SSL_CTX_set_tmp_rsa_callback ( ssl-ctx ctx, void* rsa ) ;
+
+FUNCTION: void* BIO_f_ssl (  ) ;
+
+! ===============================================
+! sha.h
+! ===============================================
+
+! For a high level interface to message digests
+! use the EVP digest routines in libcrypto.factor
+
+FUNCTION: uchar* SHA1 ( uchar* d, ulong n, uchar* md ) ;
diff --git a/extra/openssl/openssl-tests.factor b/extra/openssl/openssl-tests.factor
new file mode 100644 (file)
index 0000000..f4576dc
--- /dev/null
@@ -0,0 +1,144 @@
+USING: alien alien.c-types assocs bit-arrays hashtables io io.files
+io.sockets kernel mirrors openssl.libcrypto openssl.libssl
+namespaces math math.parser openssl prettyprint sequences tools.test unix ;
+
+! =========================================================
+! Some crypto functions (still to be turned into words)
+! =========================================================
+
+[
+    B{ 201 238 222 100 92 200 182 188 138 255 129 163 115 88 240 136 }
+]
+[ "Hello world from the openssl binding" >md5 ] unit-test
+
+[
+    B{ 63 113 237 255 181 5 152 241 136 181 43 95 160 105 44 87 49
+    82 115 0 }
+]
+[ "Hello world from the openssl binding" >sha1 ] unit-test
+
+! =========================================================
+! Initialize context
+! =========================================================
+
+init load-error-strings
+
+ssl-v23 new-ctx
+
+get-ctx "/extra/openssl/test/server.pem" resource-path use-cert-chain
+
+! TODO: debug 'Memory protection fault at address 6c'
+! get-ctx 1024 "char" malloc-array 1024 0 f password-cb set-default-passwd
+
+get-ctx "password" string>char-alien set-default-passwd-userdata
+
+! Enter PEM pass phrase: password
+get-ctx "/extra/openssl/test/server.pem" resource-path
+SSL_FILETYPE_PEM use-private-key
+
+get-ctx "/extra/openssl/test/root.pem" resource-path f
+verify-load-locations
+
+get-ctx 1 set-verify-depth
+
+! =========================================================
+! Load Diffie-Hellman parameters
+! =========================================================
+
+"/extra/openssl/test/dh1024.pem" resource-path "r" bio-new-file
+
+get-bio f f f read-pem-dh-params
+
+get-bio bio-free
+
+! TODO: debug SSL_CTX_set_tmp_dh 'No such symbol'
+! get-ctx get-dh set-tmp-dh-callback
+
+! Workaround (this function should never be called directly)
+get-ctx SSL_CTRL_SET_TMP_DH 0 get-dh set-ctx-ctrl
+
+! =========================================================
+! Generate ephemeral RSA key
+! =========================================================
+
+512 RSA_F4 f f generate-rsa-key
+
+! TODO: debug SSL_CTX_set_tmp_rsa 'No such symbol'
+! get-ctx get-rsa set-tmp-rsa-callback
+
+! Workaround (this function should never be called directly)
+get-ctx SSL_CTRL_SET_TMP_RSA 0 get-rsa set-ctx-ctrl
+
+get-rsa free-rsa
+
+! =========================================================
+! Listen and accept on socket
+! =========================================================
+
+! SYMBOL: sock
+! SYMBOL: fdset
+! SYMBOL: acset
+! SYMBOL: sbio
+! SYMBOL: ssl
+! 
+! : is-set ( seq -- newseq )
+!     <enum> >alist [ nip ] assoc-subset >hashtable keys ;
+! 
+! ! 1234 server-socket sock set
+! "127.0.0.1" 1234 <inet4> SOCK_STREAM server-fd sock set
+! 
+! FD_SETSIZE 8 * <bit-array> fdset set
+! 
+! FD_SETSIZE 8 * <bit-array> t 8 rot [ set-nth ] keep fdset set
+! 
+! fdset get is-set .
+
+! : loop ( -- )
+!     sock get f f accept
+!     dup -1 = [ drop ] [
+!         dup number>string print flush
+!         ! BIO_NOCLOSE bio-new-socket sbio set
+!         [ get-ctx new-ssl ssl set ] keep
+!         ssl get swap set-ssl-fd
+!         ! ssl get sbio get dup set-ssl-bio
+!         ! ssl get ssl-accept
+!         ! dup 0 <= [ 
+!         !     ssl get swap ssl-get-error 
+!         ! ] [ drop ] if
+!     ] if
+!     loop ;
+
+! { } acset set
+! 
+! : loop ( -- )
+!     ! FD_SETSIZE fdset get f f f select . flush
+!     FD_SETSIZE fdset get f f 10000 make-timeval select 
+!     0 <= [ acset get [ close ] each "timeout" print ] [
+!         fdset get is-set sock get swap member? [ 
+!              sock get f f accept dup . flush 
+!              acset get swap add acset set
+!     ] [ ] if
+!         loop
+!     ] if ;
+! 
+! loop
+! 
+! sock get close
+
+! =========================================================
+! Dump errors to file
+! =========================================================
+
+"/extra/openssl/test/errors.txt" resource-path "w" bio-new-file
+
+[ 6 ] [ get-bio "Hello\n" bio-print ] unit-test
+
+get-bio bio-free
+
+! =========================================================
+! Clean-up
+! =========================================================
+
+! sock get close
+
+get-ctx destroy-ctx
diff --git a/extra/openssl/openssl.factor b/extra/openssl/openssl.factor
new file mode 100644 (file)
index 0000000..3b5474e
--- /dev/null
@@ -0,0 +1,153 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Tested with OpenSSL 0.9.8a_0 on Mac OS X 10.4.9 PowerPC
+
+USING: alien alien.c-types assocs kernel libc namespaces
+openssl.libcrypto openssl.libssl sequences unix ;
+
+IN: openssl
+
+SYMBOL: bio
+SYMBOL: ssl-bio
+
+SYMBOL: ctx
+SYMBOL: dh
+SYMBOL: rsa
+
+! =========================================================
+! Callback routines
+! =========================================================
+
+: password-cb ( -- alien )
+    "int" { "char*" "int" "int" "void*" } "cdecl"
+    [ 3drop "password" string>char-alien 1023 memcpy
+    "password" length ] alien-callback ;
+
+! =========================================================
+! Error-handling routines
+! =========================================================
+
+: get-error ( -- num )
+    ERR_get_error ;
+
+: error-string ( num -- str )
+    f ERR_error_string ;
+
+: check-result ( result -- )
+    1 = [  ] [
+        get-error error-string throw
+    ] if ;
+
+: ssl-get-error ( ssl ret -- )
+    SSL_get_error error-messages at throw ;
+
+! Write errors to a file
+: bio-new-file ( path mode -- )
+    BIO_new_file bio set ;
+
+: bio-print ( bio str -- n )
+    BIO_printf ;
+
+: bio-free ( bio -- )
+    BIO_free check-result ;
+
+! =========================================================
+! Initialization routines
+! =========================================================
+
+: init ( -- )
+    SSL_library_init drop ; ! always returns 1
+
+: load-error-strings ( -- )
+    SSL_load_error_strings ;
+
+: ssl-v23 ( -- method )
+    SSLv23_method ;
+
+: new-ctx ( method -- )
+    SSL_CTX_new ctx set ;
+
+: use-cert-chain ( ctx file -- )
+    SSL_CTX_use_certificate_chain_file check-result ;
+
+: set-default-passwd ( ctx cb -- )
+    SSL_CTX_set_default_passwd_cb ;
+
+: set-default-passwd-userdata ( ctx passwd -- )
+    SSL_CTX_set_default_passwd_cb_userdata ;
+
+: use-private-key ( ctx file type -- )
+    SSL_CTX_use_PrivateKey_file check-result ;
+
+: verify-load-locations ( ctx file path -- )
+    SSL_CTX_load_verify_locations check-result ;
+
+: set-verify-depth ( ctx depth -- )
+    SSL_CTX_set_verify_depth ;
+
+: read-pem-dh-params ( bio x cb u -- )
+    PEM_read_bio_DHparams dh set ;
+
+: set-tmp-dh-callback ( ctx dh -- )
+    SSL_CTX_set_tmp_dh_callback ;
+
+: set-ctx-ctrl ( ctx cmd larg parg -- )
+    SSL_CTX_ctrl check-result ;
+
+: generate-rsa-key ( n e cb cbarg -- )
+    RSA_generate_key rsa set ;
+
+: set-tmp-rsa-callback ( ctx rsa -- )
+    SSL_CTX_set_tmp_rsa_callback ;
+
+: free-rsa ( rsa -- )
+    RSA_free ;
+
+: bio-new-socket ( fd flag -- sbio )
+    BIO_new_socket ;
+
+: new-ssl ( ctx -- ssl )
+    SSL_new ;
+
+: set-ssl-bio ( ssl bio bio -- )
+    SSL_set_bio ;
+
+: set-ssl-fd ( ssl fd -- )
+    SSL_set_fd check-result ;
+
+: ssl-accept ( ssl -- result )
+    SSL_accept ;
+
+! =========================================================
+! Clean-up and termination routines
+! =========================================================
+
+: destroy-ctx ( ctx -- )
+    SSL_CTX_free ;
+
+! =========================================================
+! Public routines
+! =========================================================
+
+: get-bio ( -- bio )
+    bio get ;
+
+: get-ssl-bio ( -- bio )
+    ssl-bio get ;
+
+: get-ctx ( -- ctx )
+    ctx get ;
+
+: get-dh ( -- dh )
+    dh get ;
+
+: get-rsa ( -- rsa )
+    rsa get ;
+
+: >md5 ( str -- byte-array )
+    dup length 16 "uchar" <c-array> [ MD5 ] keep nip ;
+
+: >sha1 ( str -- byte-array )
+    dup length 20 "uchar" <c-array> [ SHA1 ] keep nip ;
+
diff --git a/extra/openssl/tags.txt b/extra/openssl/tags.txt
new file mode 100644 (file)
index 0000000..59ccdd6
--- /dev/null
@@ -0,0 +1,2 @@
+network
+bindings
diff --git a/extra/openssl/test/dh1024.pem b/extra/openssl/test/dh1024.pem
new file mode 100644 (file)
index 0000000..aa68d98
--- /dev/null
@@ -0,0 +1,5 @@
+-----BEGIN DH PARAMETERS-----
+MIGHAoGBANmAnfkETuKHOCWaE+W+F3kM/e7z5A8hZb7OqwGMQrUOaBEAr4BWeZBn
+G/87hhwZgNP69/KUchm714qd/PpOspCaUJ20x6PcmKujpAgca/f19HGMBjRawQMk
+R9oaBwazuQT0l0rTTKmvpMEcrQQIcVWii3CZI56I56oqF8biGPD7AgEC
+-----END DH PARAMETERS-----
diff --git a/extra/openssl/test/errors.txt b/extra/openssl/test/errors.txt
new file mode 100644 (file)
index 0000000..e965047
--- /dev/null
@@ -0,0 +1 @@
+Hello
diff --git a/extra/openssl/test/root.pem b/extra/openssl/test/root.pem
new file mode 100644 (file)
index 0000000..db0c59f
--- /dev/null
@@ -0,0 +1,14 @@
+-----BEGIN CERTIFICATE-----
+MIICIjCCAYugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJVUzET
+MBEGA1UEChMKUlRGTSwgSW5jLjEZMBcGA1UECxMQV2lkZ2V0cyBEaXZpc2lvbjEY
+MBYGA1UEAxMPVGVzdCBDQTIwMDEwNTE3MB4XDTAxMDUxNzE2MDExNFoXDTA2MTIy
+NTE2MDExNFowVzELMAkGA1UEBhMCVVMxEzARBgNVBAoTClJURk0sIEluYy4xGTAX
+BgNVBAsTEFdpZGdldHMgRGl2aXNpb24xGDAWBgNVBAMTD1Rlc3QgQ0EyMDAxMDUx
+NzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAmkX40warmH0+lnwD9YjsJhRz
+ZX6qXadFry0y2trZ6gMs8Mv33IKPwOu8TE7V+3PESEtjI2wr8juV9OkbIPOm+td5
+M8+6vXyIW+JBo3ch99i0QMTf5/jTgsW+3IjV8yEdiGcZFp2NWKLRvZPq2VRbuF7R
+1pvgcaRuBJ0wGOohwnsCAwEAATANBgkqhkiG9w0BAQQFAAOBgQCUB8zMKIlX5io8
+TalbzH9Qke7BcvFAL+wp/5w1ToVsWkNrINSWKv6bl/jcqOD3aPhK7qhaeOU8ZWKL
+PoPPCnRl9Wo+1JtsOO3qIgJP79Bl9ooLGahixF2v/gea5qNISjQvwYllLSa//APP
+6kXHngO0RIRbiTBYHSkAzm6hDdsvVA==
+-----END CERTIFICATE-----
diff --git a/extra/openssl/test/server.pem b/extra/openssl/test/server.pem
new file mode 100644 (file)
index 0000000..87376db
--- /dev/null
@@ -0,0 +1,32 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,5772A2A7BE34B611
+
+1yJ+xAn4MudcIfXXy7ElYngJ9EohIh8yvcyVLmE4kVd0xeaL/Bqhvk25BjYCK5d9
+k1K8cjgnKEBjbC++0xtJxFSbUhwoKTLwn+sBoJDcFzMKkmJXXDbSTOaNr1sVwiAR
+SnB4lhUcHguYoV5zlRJn53ft7t1mjB6RwGH+d1Zx6t95OqM1lnKqwekwmotVAWHj
+ncu3N8qhmoPMppmzEv0fOo2/pK2WohcJykSeN5zBrZCUxoO0NBNEZkFUcVjR+KsA
+1ZeI1mU60szqg+AoU/XtFcow8RtG1QZKQbbXzyfbwaG+6LqkHaWYKHQEI1546yWK
+us1HJ734uUkZoyyyazG6PiGCYV2u/aY0i3qdmyDqTvmVIvve7E4glBrtDS9h7D40
+nPShIvOatoPzIK4Y0QSvrI3G1vTsIZT3IOZto4AWuOkLNfYS2ce7prOreF0KjhV0
+3tggw9pHdDmTjHTiIkXqheZxZ7TVu+pddZW+CuB62I8lCBGPW7os1f21e3eOD/oY
+YPCI44aJvgP+zUORuZBWqaSJ0AAIuVW9S83Yzkz/tlSFHViOebyd8Cug4TlxK1VI
+q6hbSafh4C8ma7YzlvqjMzqFifcIolcbx+1A6ot0UiayJTUra4d6Uc4Rbc9RIiG0
+jfDWC6aii9YkAgRl9WqSd31yASge/HDqVXFwR48qdlYQ57rcHviqxyrwRDnfw/lX
+Mf6LPiDKEco4MKej7SR2kK2c2AgxUzpGZeAY6ePyhxbdhA0eY21nDeFd/RbwSc5s
+eTiCCMr41OB4hfBFXKDKqsM3K7klhoz6D5WsgE6u3lDoTdz76xOSTg==
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICGDCCAYECAgEBMA0GCSqGSIb3DQEBBAUAMFcxCzAJBgNVBAYTAlVTMRMwEQYD
+VQQKEwpSVEZNLCBJbmMuMRkwFwYDVQQLExBXaWRnZXRzIERpdmlzaW9uMRgwFgYD
+VQQDEw9UZXN0IENBMjAwMTA1MTcwHhcNMDEwNTE3MTYxMDU5WhcNMDQwMzA2MTYx
+MDU5WjBRMQswCQYDVQQGEwJVUzETMBEGA1UEChMKUlRGTSwgSW5jLjEZMBcGA1UE
+CxMQV2lkZ2V0cyBEaXZpc2lvbjESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqG
+SIb3DQEBAQUAA4GNADCBiQKBgQCiWhMjNOPlPLNW4DJFBiL2fFEIkHuRor0pKw25
+J0ZYHW93lHQ4yxA6afQr99ayRjMY0D26pH41f0qjDgO4OXskBsaYOFzapSZtQMbT
+97OCZ7aHtK8z0ZGNW/cslu+1oOLomgRxJomIFgW1RyUUkQP1n0hemtUdCLOLlO7Q
+CPqZLQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAIumUwl1OoWuyN2xfoBHYAs+lRLY
+KmFLoI5+iMcGxWIsksmA+b0FLRAN43wmhPnums8eXgYbDCrKLv2xWcvKDP3mps7m
+AMivwtu/eFpYz6J8Mo1fsV4Ys08A/uPXkT23jyKo2hMu8mywkqXCXYF2e+7pEeBr
+dsbmkWK5NgoMl8eM
+-----END CERTIFICATE-----
diff --git a/extra/oracle/authors.txt b/extra/oracle/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/extra/oracle/liboci/liboci.factor b/extra/oracle/liboci/liboci.factor
new file mode 100644 (file)
index 0000000..e5313d5
--- /dev/null
@@ -0,0 +1,194 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Adapted from oci.h and ociap.h
+! Tested with Oracle version - 10.1.0.3 Instant Client
+!
+! DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient10_1"
+! export DYLD_LIBRARY_PATH
+
+USING: alien alien.syntax combinators kernel system ;
+
+IN: oracle.liboci
+
+"oci" {
+    { [ win32? ] [ "oci.dll" "stdcall" ] }
+    { [ macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] }
+    { [ unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] }
+} cond add-library
+
+! ===============================================
+! Attribute Types
+! ===============================================
+
+: OCI_ATTR_USERNAME 22  ; inline ! username attribute
+: OCI_ATTR_PASSWORD 23  ; inline ! password attribute
+
+! ===============================================
+! Various Modes
+! ===============================================
+
+: OCI_DEFAULT   HEX: 00 ; inline ! default value for parameters and attributes
+: OCI_THREADED  HEX: 01 ; inline ! appl. in threaded environment
+: OCI_OBJECT    HEX: 02 ; inline ! application in object environment
+
+! ===============================================
+! Execution Modes
+! ===============================================
+
+: OCI_DESCRIBE_ONLY   HEX: 10 ; inline ! only describe the statement
+
+! ===============================================
+! Credential Types
+! ===============================================
+
+: OCI_CRED_RDBMS      1 ; inline ! database username/password
+: OCI_CRED_EXT        2 ; inline ! externally provided credentials
+: OCI_CRED_PROXY      3 ; inline ! proxy authentication
+
+! ===============================================
+! Error Return Values
+! ===============================================
+
+: OCI_SUCCESS               0     ; inline ! maps to SQL_SUCCESS of SAG CLI
+: OCI_SUCCESS_WITH_INFO     1     ; inline ! maps to SQL_SUCCESS_WITH_INFO
+: OCI_RESERVED_FOR_INT_USE  200   ; inline ! reserved
+: OCI_NO_DATA               100   ; inline ! maps to SQL_NO_DATA
+: OCI_ERROR                 -1    ; inline ! maps to SQL_ERROR
+: OCI_INVALID_HANDLE        -2    ; inline ! maps to SQL_INVALID_HANDLE
+: OCI_NEED_DATA             99    ; inline ! maps to SQL_NEED_DATA
+: OCI_STILL_EXECUTING       -3123 ; inline ! OCI would block error
+
+! ===============================================
+! Parsing Syntax Types
+! ===============================================
+
+: OCI_V7_SYNTAX            2 ; inline ! V815 language - for backwards compatibility
+: OCI_V8_SYNTAX            3 ; inline ! V815 language - for backwards compatibility
+: OCI_NTV_SYNTAX           1 ; inline ! Use what so ever is the native lang of server
+
+! ===============================================
+! Scrollable Cursor Fetch Options
+! For non-scrollable cursor, the only valid
+! (and default) orientation is OCI_FETCH_NEXT
+! ===============================================
+
+: OCI_FETCH_CURRENT       HEX: 01 ; inline ! refetching current position
+: OCI_FETCH_NEXT          HEX: 02 ; inline ! next row
+: OCI_FETCH_FIRST         HEX: 04 ; inline ! first row of the result set
+: OCI_FETCH_LAST          HEX: 08 ; inline ! the last row of the result set
+: OCI_FETCH_PRIOR         HEX: 10 ; inline ! the previous row relative to current
+: OCI_FETCH_ABSOLUTE      HEX: 20 ; inline ! absolute offset from first
+: OCI_FETCH_RELATIVE      HEX: 40 ; inline ! offset relative to current
+: OCI_FETCH_RESERVED_1    HEX: 80 ; inline ! reserved
+
+! ===============================================
+! Handle Types
+! ===============================================
+
+: OCI_HTYPE_ENV            1  ; inline ! environment handle
+: OCI_HTYPE_ERROR          2  ; inline ! error handle
+: OCI_HTYPE_SVCCTX         3  ; inline ! service handle
+: OCI_HTYPE_STMT           4  ; inline ! statement handle
+: OCI_HTYPE_BIND           5  ; inline ! bind handle
+: OCI_HTYPE_DEFINE         6  ; inline ! define handle
+: OCI_HTYPE_DESCRIBE       7  ; inline ! describe handle
+: OCI_HTYPE_SERVER         8  ; inline ! server handle
+: OCI_HTYPE_SESSION        9  ; inline ! authentication handle
+
+! ===============================================
+! Attribute Types
+! ===============================================
+
+: OCI_ATTR_FNCODE                   1  ; inline ! the OCI function code
+: OCI_ATTR_OBJECT                   2  ; inline ! is the environment initialized in object mode
+: OCI_ATTR_NONBLOCKING_MODE         3  ; inline ! non blocking mode
+: OCI_ATTR_SQLCODE                  4  ; inline ! the SQL verb
+: OCI_ATTR_ENV                      5  ; inline ! the environment handle
+: OCI_ATTR_SERVER                   6  ; inline ! the server handle
+: OCI_ATTR_SESSION                  7  ; inline ! the user session handle
+: OCI_ATTR_TRANS                    8  ; inline ! the transaction handle
+: OCI_ATTR_ROW_COUNT                9  ; inline ! the rows processed so far
+: OCI_ATTR_SQLFNCODE                10 ; inline ! the SQL verb of the statement
+: OCI_ATTR_PREFETCH_ROWS            11 ; inline ! sets the number of rows to prefetch
+: OCI_ATTR_NESTED_PREFETCH_ROWS     12 ; inline ! the prefetch rows of nested table
+: OCI_ATTR_PREFETCH_MEMORY          13 ; inline ! memory limit for rows fetched
+: OCI_ATTR_NESTED_PREFETCH_MEMORY   14 ; inline ! memory limit for nested rows
+: OCI_ATTR_CHAR_COUNT               15 ; inline ! this specifies the bind and define size in characters
+
+! ===============================================
+! OCI integer types
+! ===============================================
+
+TYPEDEF: ushort ub2
+TYPEDEF: short sb2
+TYPEDEF: uint ub4
+TYPEDEF: int sb4
+TYPEDEF: ulong size_t
+
+! ===============================================
+! Input data types (ocidfn.h)
+! ===============================================
+
+: SQLT_CHR                  1    ; inline ! (ORANET TYPE) character string
+: SQLT_NUM                  2    ; inline ! (ORANET TYPE) oracle numeric
+: SQLT_INT                  3    ; inline ! (ORANET TYPE) integer
+: SQLT_FLT                  4    ; inline ! (ORANET TYPE) Floating point number
+: SQLT_STR                  5    ; inline ! zero terminated string
+: SQLT_ODT                  156  ; inline ! OCIDate type
+
+! ===============================================
+! Input datetimes and intervals (ocidfn.h)
+! ===============================================
+
+: SQLT_DATE                184   ; inline ! ANSI Date
+: SQLT_TIME                185   ; inline ! TIME
+: SQLT_TIME_TZ             186   ; inline ! TIME WITH TIME ZONE
+: SQLT_TIMESTAMP           187   ; inline ! TIMESTAMP
+: SQLT_TIMESTAMP_TZ        188   ; inline ! TIMESTAMP WITH TIME ZONE
+: SQLT_INTERVAL_YM         189   ; inline ! INTERVAL YEAR TO MONTH
+: SQLT_INTERVAL_DS         190   ; inline ! INTERVAL DAY TO SECOND
+: SQLT_TIMESTAMP_LTZ       232   ; inline ! TIMESTAMP WITH LOCAL TZ
+
+! ===============================================
+! Opaque pointer types
+! ===============================================
+
+TYPEDEF: void dvoid
+TYPEDEF: void oci_env
+TYPEDEF: void oci_server
+TYPEDEF: void oci_error
+TYPEDEF: void oci_svc_ctx
+TYPEDEF: void oci_session
+TYPEDEF: void oci_stmt
+
+LIBRARY: oci
+
+! ===============================================
+! ociap.h
+! ===============================================
+
+FUNCTION: int OCIInitialize ( ub4 mode, void* ctxp, void* malocfp, void* ralocfp, dvoid* mfreefp ) ;
+FUNCTION: int OCITerminate ( ub4 mode ) ;
+FUNCTION: int OCIEnvInit ( void* envhpp, ub4 mode, size_t xtramem_sz, dvoid* usrmempp ) ;
+FUNCTION: int OCIEnvCreate ( dvoid* envhpp, ub4 mode, void* ctxp, void* malocfp, void* ralocfp, void* mfreefp, size_t xtramemz, dvoid* usrmempp ) ;
+FUNCTION: int OCIHandleAlloc ( void* parenth, dvoid* hndlpp, ub4 type, size_t xtramem_sz, dvoid* usrmempp ) ;
+FUNCTION: int OCIServerAttach ( void* srvhp, void* errhp, char* dblink, sb4 dblink_len, ub4 mode ) ;
+FUNCTION: int OCIServerDetach ( void* srvhp, void* errhp, ub4 mode ) ;
+FUNCTION: int OCIHandleFree ( dvoid* p0, ub4 p1 ) ;
+FUNCTION: int OCILogon ( void* envhp, void* errhp, dvoid* svchpp, uchar* username, ub4 uname_len, uchar* passwd, ub4 password_len, uchar* dsn, ub4 dsn_len ) ;
+FUNCTION: int OCILogoff ( void* p0, void* p1 ) ;
+FUNCTION: void OCIErrorGet ( void* handlp, ub4 recordno, char* sqlstate, sb4* errcodep, uchar* bufp, ub4 bufsize, ub4 type ) ;
+FUNCTION: int OCIStmtPrepare ( void* stmtp, void* errhp, uchar* stmt, ub4 stmt_len, ub4 language, ub4 mode ) ;
+FUNCTION: int OCIStmtExecute ( void* svchp, void* stmtp1, void* errhp, ub4 iters, ub4 rowoff, void* snap_in, void* snap_out, ub4 mode ) ;
+FUNCTION: int OCIParamGet ( void* hndlp, ub4 htype, void* errhp, dvoid* parmdpp, ub4 pos ) ;
+FUNCTION: int OCIAttrGet ( void* trgthndlp, ub4 trghndltyp, void* attributep, ub4* sizep, ub4 attrtype, void* errhp ) ;
+FUNCTION: int OCIAttrSet ( dvoid* trgthndlp, ub4 trgthndltyp, dvoid* attributep, ub4 size, ub4 attrtype, oci_error* errhp ) ;
+FUNCTION: int OCIDefineByPos ( void* stmtp, dvoid* defnpp, void* errhp, ub4 position, void* valuep, sb4 value_sz, ub2 dty, sb2* indp, ub2* rlenp, ub2* rcodep, ub4 mode ) ;
+FUNCTION: int OCIStmtFetch ( void* stmthp, void* errhp, ub4 p2, ub2 p3, ub4 p4 ) ;
+FUNCTION: int OCITransStart ( void* svchp, void* errhp, ushort p2, ushort p3 ) ;
+FUNCTION: int OCITransCommit ( void* svchp, void* errhp, ushort p2 ) ;
+FUNCTION: int OCITransRollback ( void* svchp, void* errhp, ushort p2 ) ;
+FUNCTION: int OCISessionBegin ( oci_svc_ctx* svchp, oci_error* errhp,  oci_session* usrhp, ub4 credt, ub4 mode ) ;
+FUNCTION: int OCISessionEnd ( oci_svc_ctx* svchp, oci_error* errhp,  oci_session* usrhp, ub4 mode ) ;
+FUNCTION: int OCIServerVersion ( void* handlp, void* errhp, uchar* bufsz, int bufsz, short hndltype ) ;
diff --git a/extra/oracle/oracle-tests.factor b/extra/oracle/oracle-tests.factor
new file mode 100644 (file)
index 0000000..5756578
--- /dev/null
@@ -0,0 +1,57 @@
+USING: oracle oracle.liboci prettyprint tools.test ;
+
+"testuser" "testpassword" "//localhost/test1" log-on .
+
+allocate-statement-handle
+
+"CREATE TABLE TESTTABLE ( COL1 VARCHAR(40), COL2 NUMBER)" prepare-statement
+
+[ t ] [ execute-statement ] unit-test
+
+"INSERT INTO TESTTABLE (COL1, COL2) VALUES('hello', 50)" prepare-statement
+
+[ t ] [ execute-statement ] unit-test
+
+"INSERT INTO TESTTABLE (COL1, COL2) VALUES('hi', 60)" prepare-statement
+
+[ t ] [ execute-statement ] unit-test
+
+"INSERT INTO TESTTABLE (COL1, COL2) VALUES('bye', 70)" prepare-statement
+
+[ t ] [ execute-statement ] unit-test
+
+"COMMIT" prepare-statement
+
+[ t ] [ execute-statement ] unit-test
+
+"SELECT * FROM TESTTABLE" prepare-statement
+
+1 SQLT_STR define-by-position run-query
+
+[ V{ "hello" "hi" "bye" "50" "60" "70" } ] [
+2 SQLT_STR define-by-position run-query gather-results
+] unit-test
+
+clear-result
+
+"UPDATE TESTTABLE SET COL2 = 10 WHERE COL1='hi'" prepare-statement
+
+[ t ] [ execute-statement ] unit-test
+
+"COMMIT" prepare-statement
+
+[ t ] [ execute-statement ] unit-test
+
+"SELECT * FROM TESTTABLE WHERE COL1 = 'hi'" prepare-statement
+
+[ V{ "10" } ] [ 
+2 SQLT_STR define-by-position run-query gather-results
+] unit-test
+
+clear-result
+
+"DROP TABLE TESTTABLE" prepare-statement
+
+execute-statement
+
+free-statement-handle log-off clean-up terminate
diff --git a/extra/oracle/oracle.factor b/extra/oracle/oracle.factor
new file mode 100644 (file)
index 0000000..d725de5
--- /dev/null
@@ -0,0 +1,256 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Adapted from oci.h and ociap.h
+! Tested with Oracle version - 10.1.0.3 Instant Client
+
+USING: alien alien.c-types combinators kernel math namespaces oracle.liboci
+prettyprint sequences ;
+
+IN: oracle
+
+SYMBOL: env
+SYMBOL: err
+SYMBOL: srv
+SYMBOL: svc
+SYMBOL: ses
+SYMBOL: stm
+SYMBOL: buf
+SYMBOL: res
+
+SYMBOL: con
+
+TUPLE: connection username password db ;
+
+C: <connection> connection
+
+! =========================================================
+! Error-handling routines
+! =========================================================
+
+: get-oci-error ( object -- * )
+    1 f "uint*" <c-object> dup >r 512 "uchar" <c-array> dup >r
+    512 OCI_HTYPE_ERROR OCIErrorGet r> r> *uint drop
+    alien>char-string throw ;
+
+: check-result ( result -- )
+    {
+        { [ dup OCI_SUCCESS = ] [ drop ] }
+        { [ dup OCI_ERROR = ] [ err get get-oci-error ] }
+        { [ dup OCI_INVALID_HANDLE = ] [ "invalid handle" throw ] }
+        { [ t ] [ "operation failed" throw ] }
+    } cond ;
+
+: check-status ( status -- bool )
+    {
+        { [ dup OCI_SUCCESS = ] [ drop t ] }
+        { [ dup OCI_ERROR = ] [ err get get-oci-error ] }
+        { [ dup OCI_INVALID_HANDLE = ] [ "invalid handle" throw ] }
+        { [ dup OCI_NO_DATA = ] [ drop f ] }
+        { [ t ] [ "operation failed" throw ] }
+    } cond ;
+
+! =========================================================
+! Initialization and handle-allocation routines
+! =========================================================
+
+! Legacy initialization routine
+: oci-initialize ( -- )
+    OCI_DEFAULT f f f f OCIInitialize check-result ;
+
+! Legacy initialization routine
+: oci-env-init ( -- )
+    "void*" <c-object> dup OCI_DEFAULT 0 f OCIEnvInit
+    check-result *void* env set ;
+
+: create-environment ( -- )
+    "void*" <c-object> dup OCI_DEFAULT f f f f 0 f OCIEnvCreate 
+    check-result *void* env set ;
+
+: allocate-error-handle ( -- )
+    env get
+    "void*" <c-object> tuck OCI_HTYPE_ERROR 0 f OCIHandleAlloc 
+    check-result *void* err set ;
+
+: allocate-service-handle ( -- )
+    env get
+    "void*" <c-object> tuck OCI_HTYPE_SVCCTX 0 f OCIHandleAlloc 
+    check-result *void* svc set ;
+
+: allocate-session-handle ( -- )
+    env get
+    "void*" <c-object> tuck OCI_HTYPE_SESSION 0 f OCIHandleAlloc 
+    check-result *void* ses set ;
+
+: allocate-server-handle ( -- )
+    env get
+    "void*" <c-object> tuck OCI_HTYPE_SERVER 0 f OCIHandleAlloc 
+    check-result *void* srv set ;
+
+: init ( -- )
+    oci-initialize
+    oci-env-init
+    allocate-error-handle
+    allocate-service-handle
+    allocate-session-handle
+    allocate-server-handle ;
+
+! =========================================================
+! Single user session logon routine
+! =========================================================
+
+: oci-log-on ( -- )
+    env get err get svc get 
+    con get connection-username dup length swap malloc-char-string swap 
+    con get connection-password dup length swap malloc-char-string swap
+    con get connection-db dup length swap malloc-char-string swap
+    OCILogon check-result ;
+
+! =========================================================
+! Attach to server and attribute-setting routines
+! =========================================================
+
+: attach-to-server ( -- )
+    srv get err get con get connection-db dup length OCI_DEFAULT
+    OCIServerAttach check-result ;
+
+: set-service-attribute ( -- )
+    svc get OCI_HTYPE_SVCCTX srv get 0 OCI_ATTR_SERVER err get OCIAttrSet check-result ;
+
+: set-username-attribute ( -- )
+    ses get OCI_HTYPE_SESSION con get connection-username dup length swap malloc-char-string swap 
+    OCI_ATTR_USERNAME err get OCIAttrSet check-result ;
+
+: set-password-attribute ( -- )
+    ses get OCI_HTYPE_SESSION con get connection-password dup length swap malloc-char-string swap 
+    OCI_ATTR_PASSWORD err get OCIAttrSet check-result ;
+
+: set-attributes ( -- )
+    set-service-attribute
+    set-username-attribute
+    set-password-attribute ;
+
+! =========================================================
+! Session startup routines
+! =========================================================
+
+: begin-session ( -- )
+    svc get err get ses get OCI_CRED_RDBMS OCI_DEFAULT OCISessionBegin check-result ;
+
+: set-authentication-handle ( -- )
+    svc get OCI_HTYPE_SVCCTX ses get 0 OCI_ATTR_SESSION err get OCIAttrSet check-result ;
+
+! =========================================================
+! Statement preparation and execution routines
+! =========================================================
+
+: allocate-statement-handle ( -- )
+    env get
+    "void*" <c-object> tuck OCI_HTYPE_STMT 0 f OCIHandleAlloc 
+    check-result *void* stm set ;
+
+: prepare-statement ( statement -- )
+    >r stm get err get r> dup length swap malloc-char-string swap
+    OCI_NTV_SYNTAX OCI_DEFAULT OCIStmtPrepare check-result ;
+
+: calculate-size ( type -- size object )
+    {
+        { [ dup SQLT_INT = ] [ "int" heap-size ] }
+        { [ dup SQLT_FLT = ] [ "float" heap-size ] }
+        { [ dup SQLT_CHR = ] [ "char" heap-size ] }
+        { [ dup SQLT_NUM = ] [ "int" heap-size 10 * ] }
+        { [ dup SQLT_STR = ] [ 64 ] }
+        { [ dup SQLT_ODT = ] [ 256 ] }
+    } cond ;
+
+: define-by-position ( position type -- )
+    >r >r stm get f <void*> err get
+    r> r> calculate-size swap >r [ "char" malloc-array dup buf set ] keep 1+
+    r> f f f OCI_DEFAULT OCIDefineByPos check-result ;
+
+: execute-statement ( -- bool )
+    svc get stm get err get 1 0 f f OCI_DEFAULT OCIStmtExecute check-status ;
+
+: fetch-statement ( -- bool )
+    stm get err get 1 OCI_FETCH_NEXT OCI_DEFAULT OCIStmtFetch check-status ;
+
+: free-statement-handle ( -- )
+    stm get OCI_HTYPE_STMT OCIHandleFree check-result ;
+
+! =========================================================
+! Log off and detach from server routines
+! =========================================================
+
+: end-session ( -- )
+    svc get err get ses get OCI_DEFAULT OCISessionEnd check-result ;
+
+: detach-from-server ( -- )
+    srv get err get OCI_DEFAULT OCIServerDetach check-result ;
+
+: log-off ( -- )
+    end-session
+    detach-from-server ;
+
+! =========================================================
+! Clean-up and termination routines
+! =========================================================
+
+: free-service-handle ( -- )
+    svc get OCI_HTYPE_SVCCTX OCIHandleFree check-result ;
+
+: free-server-handle ( -- )
+    srv get OCI_HTYPE_SERVER OCIHandleFree check-result ;
+
+: free-error-handle ( -- )
+    err get OCI_HTYPE_ERROR OCIHandleFree check-result ;
+
+: free-environment-handle ( -- )
+    env get OCI_HTYPE_ENV OCIHandleFree check-result ;
+
+: clean-up ( -- )
+    free-service-handle
+    free-server-handle
+    free-error-handle
+    free-environment-handle ;
+
+: terminate ( -- )
+    OCI_DEFAULT OCITerminate check-result ;
+
+! =========================================================
+! Utility routines
+! =========================================================
+
+: server-version ( -- )
+    srv get err get 512 "uchar" malloc-array dup >r 512 OCI_HTYPE_SERVER
+    OCIServerVersion check-result r> alien>char-string . ;
+
+! =========================================================
+! Public routines
+! =========================================================
+
+: log-on ( username password db -- )
+    <connection> con set 
+    init attach-to-server set-attributes
+    begin-session set-authentication-handle 
+    V{ } clone res set ;
+
+: fetch-each ( object -- object )
+    fetch-statement [
+        buf get alien>char-string res get swap add res set
+        fetch-each
+    ] [ ] if ;
+
+: run-query ( object -- object )
+    execute-statement [
+        buf get alien>char-string res get swap add res set
+        fetch-each
+    ] [ ] if ;
+
+: gather-results ( -- seq )
+    res get ;
+
+: show-result ( -- )
+    res get [ . ] each ;
+
+: clear-result ( -- )
+    V{ } clone res set ;
diff --git a/extra/oracle/summary.txt b/extra/oracle/summary.txt
new file mode 100644 (file)
index 0000000..0596680
--- /dev/null
@@ -0,0 +1 @@
+Oracle database bindings
diff --git a/extra/oracle/tags.txt b/extra/oracle/tags.txt
new file mode 100644 (file)
index 0000000..aa0d57e
--- /dev/null
@@ -0,0 +1 @@
+database
diff --git a/extra/ori/authors.txt b/extra/ori/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/ori/ori.factor b/extra/ori/ori.factor
new file mode 100644 (file)
index 0000000..3ada07b
--- /dev/null
@@ -0,0 +1,85 @@
+
+USING: kernel namespaces
+       math math.constants math.functions math.matrices math.vectors
+       sequences splitting self ;
+
+IN: ori
+
+TUPLE: ori val ;
+
+C: <ori> ori
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Temporarily defined here until math-contrib gets moved to extra/
+
+: deg>rad pi * 180 / ; inline
+: rad>deg 180 * pi / ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: ori> ( -- val ) self> ori-val ;
+
+: >ori ( val -- ) self> set-ori-val ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make-matrix ( quot width -- matrix ) >r { } make r> group ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! These rotation matrices are from
+! `Computer Graphics: Principles and Practice'
+
+: Rz ( angle -- Rx ) deg>rad
+[ dup cos ,    dup sin neg ,   0 ,
+  dup sin ,    dup cos ,       0 ,
+  0 ,          0 ,             1 , ] 3 make-matrix nip ;
+
+: Ry ( angle -- Ry ) deg>rad
+[ dup cos ,    0 ,             dup sin ,
+  0 ,          1 ,             0 ,
+  dup sin neg ,        0 ,             dup cos , ] 3 make-matrix nip ;
+
+: Rx ( angle -- Rz ) deg>rad
+[ 1 ,          0 ,             0 ,
+  0 ,          dup cos ,       dup sin neg ,
+  0 ,          dup sin ,       dup cos , ] 3 make-matrix nip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: apply-rotation ( rotation -- ) ori> swap m. >ori ;
+
+: rotate-x ( angle -- ) Rx apply-rotation ;
+: rotate-y ( angle -- ) Ry apply-rotation ;
+: rotate-z ( angle -- ) Rz apply-rotation ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: pitch-up   ( angle -- ) neg rotate-x ;
+: pitch-down ( angle -- )     rotate-x ;
+
+: turn-left ( angle -- )      rotate-y ;
+: turn-right ( angle -- ) neg rotate-y ;
+
+: roll-left  ( angle -- ) neg rotate-z ;
+: roll-right ( angle -- )     rotate-z ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! roll-until-horizontal
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: V ( -- V ) { 0 1 0 } ;
+
+: X ( -- 3array ) ori> [ first  ] map ;
+: Y ( -- 3array ) ori> [ second ] map ;
+: Z ( -- 3array ) ori> [ third  ] map ;
+
+: set-X ( seq -- ) ori> [ set-first ] 2each ;
+: set-Y ( seq -- ) ori> [ set-second ] 2each ;
+: set-Z ( seq -- ) ori> [ set-third ] 2each ;
+
+: roll-until-horizontal ( -- )
+V Z cross normalize set-X
+Z X cross normalize set-Y ;
+
diff --git a/extra/pack/authors.txt b/extra/pack/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/pack/pack-tests.factor b/extra/pack/pack-tests.factor
new file mode 100644 (file)
index 0000000..b2fdc8a
--- /dev/null
@@ -0,0 +1,47 @@
+USING: io io.streams.string kernel namespaces pack strings tools.test ;
+
+[ B{ 1 0 2 0 0 3 0 0 0 4 0 0 0 0 0 0 0 5 } ] [
+    { 1 2 3 4 5 }
+    "cstiq" pack-be
+] unit-test
+
+[ { 1 2 3 4 5 } ] [
+    { 1 2 3 4 5 }
+    "cstiq" [ pack-be ] keep unpack-be
+] unit-test
+
+[ B{ 1 2 0 3 0 0 4 0 0 0 5 0 0 0 0 0 0 0 } ] [
+    [
+        { 1 2 3 4 5 } "cstiq" pack-le
+    ] with-scope
+] unit-test
+
+[ { 1 2 3 4 5 } ] [
+    { 1 2 3 4 5 }
+    "cstiq" [ pack-le ] keep unpack-le
+] unit-test
+
+[ { -1 -2 -3 -4 -5 } ] [
+    { -1 -2 -3 -4 -5 }
+    "cstiq" [ pack-le ] keep unpack-le
+] unit-test
+
+[ { -1 -2 -3 -4 -5 3.14 } ] [
+    { -1 -2 -3 -4 -5 3.14 }
+    "cstiqd" [ pack-be ] keep unpack-be
+] unit-test
+
+[ { -1 -2 -3 -4 -5 } ] [
+    { -1 -2 -3 -4 -5 }
+    "cstiq" [ pack-native ] keep unpack-native
+] unit-test
+
+[ 2 ] [
+    [ 2 "int" b, ] B{ } make
+    <string-reader> [ "int" read-native ] with-stream
+] unit-test
+
+[ "FRAM" ] [ "FRAM\0" [ read-c-string ] string-in ] unit-test
+[ f ] [ "" [ read-c-string ] string-in ] unit-test
+[ 5 ] [ "FRAM\0\u0005\0\0\0\0\0\0\0" [ read-c-string drop read-u64 ] string-in ] unit-test
+
diff --git a/extra/pack/pack.factor b/extra/pack/pack.factor
new file mode 100644 (file)
index 0000000..07b572f
--- /dev/null
@@ -0,0 +1,179 @@
+USING: alien alien.c-types arrays assocs byte-arrays inference
+inference.transforms io io.binary io.streams.string kernel
+math math.parser namespaces parser prettyprint
+quotations sequences strings threads vectors
+words macros ;
+IN: pack
+
+SYMBOL: big-endian
+
+: big-endian? ( -- ? )
+    1 <int> *char zero? ;
+
+: clear-bit ( m n -- o )
+    2^ bitnot bitand ;
+
+: >endian ( obj n -- str )
+    big-endian get [ >be ] [ >le ] if ; inline
+
+: endian> ( obj -- str )
+    big-endian get [ be> ] [ le> ] if ; inline
+
+GENERIC: b, ( n obj -- )
+M: integer b, ( m n -- ) >endian % ;
+
+! for doing native, platform-dependent sized values
+M: string b, ( n string -- ) heap-size b, ;
+: read-native ( string -- ) heap-size read endian> ;
+
+! Portable
+: s8, ( n -- ) 1 b, ;
+: u8, ( n -- ) 1 b, ;
+: s16, ( n -- ) 2 b, ;
+: u16, ( n -- ) 2 b, ;
+: s24, ( n -- ) 3 b, ;
+: u24, ( n -- ) 3 b, ;
+: s32, ( n -- ) 4 b, ;
+: u32, ( n -- ) 4 b, ;
+: s64, ( n -- ) 8 b, ;
+: u64, ( n -- ) 8 b, ;
+: s128, ( n -- ) 16 b, ;
+: u128, ( n -- ) 16 b, ;
+: float, ( n -- ) float>bits 4 b, ;
+: double, ( n -- ) double>bits 8 b, ;
+: c-string, ( str -- ) % 0 u8, ;
+
+: (>128-ber) ( n -- )
+    dup 0 > [
+        [ HEX: 7f bitand HEX: 80 bitor , ] keep -7 shift
+        (>128-ber)
+    ] [
+        drop
+    ] if ;
+
+: >128-ber ( n -- str )
+    [
+        [ HEX: 7f bitand , ] keep -7 shift
+        (>128-ber)
+    ] { } make reverse ;
+
+: >signed ( x n -- y )
+    2dup neg 1+ shift 1 = [ 2^ - ] [ drop ] if ;
+
+: read-signed ( n -- str )
+    dup read endian> swap 8 * >signed ;
+
+: read-unsigned ( n -- m ) read endian> ;
+
+: read-s8 ( -- n ) 1 read-signed ;
+: read-u8 ( -- n ) 1 read-unsigned ;
+: read-s16 ( -- n ) 2 read-signed ;
+: read-u16 ( -- n ) 2 read-unsigned ;
+: read-s24 ( -- n ) 3 read-signed ;
+: read-u24 ( -- n ) 3 read-unsigned ;
+: read-s32 ( -- n ) 4 read-signed ;
+: read-u32 ( -- n ) 4 read-unsigned ;
+: read-s64 ( -- n ) 8 read-signed ;
+: read-u64 ( -- n ) 8 read-signed ;
+: read-s128 ( -- n ) 16 read-signed ;
+: read-u128 ( -- n ) 16 read-unsigned ;
+
+: read-float ( -- n )
+    4 read endian> bits>float ;
+
+: read-double ( -- n )
+    8 read endian> bits>double ;
+
+: read-c-string ( -- str/f )
+    "\0" read-until [ drop f ] unless ;
+
+: read-c-string* ( n -- str/f )
+    read [ 0 = ] rtrim dup empty? [ drop f ] when ;
+
+: (read-128-ber) ( n -- n )
+    1 read first
+    [ >r 7 shift r> 7 clear-bit bitor ] keep
+    7 bit? [ (read-128-ber) ] when ;
+    
+: read-128-ber ( -- n )
+    0 (read-128-ber) ;
+
+: pack-table ( -- hash )
+    H{
+        { CHAR: c s8, }
+        { CHAR: C u8, }
+        { CHAR: s s16, }
+        { CHAR: S u16, }
+        { CHAR: t s24, }
+        { CHAR: T u24, }
+        { CHAR: i s32, }
+        { CHAR: I u32, }
+        { CHAR: q s64, }
+        { CHAR: Q u64, }
+        { CHAR: f float, }
+        { CHAR: F float, }
+        { CHAR: d double, }
+        { CHAR: D double, }
+    } ;
+
+: unpack-table ( -- hash )
+    H{
+        { CHAR: c read-s8 }
+        { CHAR: C read-u8 }
+        { CHAR: s read-s16 }
+        { CHAR: S read-u16 }
+        { CHAR: t read-s24 }
+        { CHAR: T read-u24 }
+        { CHAR: i read-s32 }
+        { CHAR: I read-u32 }
+        { CHAR: q read-s64 }
+        { CHAR: Q read-u64 }
+        { CHAR: f read-float }
+        { CHAR: F read-float }
+        { CHAR: d read-double }
+        { CHAR: D read-double }
+    } ;
+
+MACRO: (pack) ( seq str -- quot )
+    [
+        [
+            [
+                swap , pack-table at ,
+            ] 2each
+        ] [ ] make 1quotation %
+       [ B{ } make ] %
+    ] [ ] make ;
+
+: pack-native ( seq str -- seq )
+    [
+        big-endian? big-endian set (pack)
+    ] with-scope ;
+
+: pack-be ( seq str -- seq )
+    [ big-endian on (pack) ] with-scope ;
+
+: pack-le ( seq str -- seq )
+    [ big-endian off (pack) ] with-scope ;
+
+
+MACRO: (unpack) ( str -- quot )
+    [
+        \ <string-reader> ,
+        [
+            [ unpack-table at , \ , , ] each
+        ] [ ] make
+        1quotation [ { } make ] append
+        1quotation %
+        \ with-stream ,
+    ] [ ] make ;
+
+: unpack-native ( seq str -- seq )
+    [
+        big-endian? big-endian set (unpack)
+    ] with-scope ;
+
+: unpack-be ( seq str -- seq )
+    [ big-endian on (unpack) ] with-scope ;
+
+: unpack-le ( seq str -- seq )
+    [ big-endian off (unpack) ] with-scope ;
diff --git a/extra/parser-combinators/authors.txt b/extra/parser-combinators/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/parser-combinators/parser-combinators-docs.factor b/extra/parser-combinators/parser-combinators-docs.factor
new file mode 100644 (file)
index 0000000..b3d25e4
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax parser-combinators ;
+
+HELP: list-of
+{ $values 
+  { "items" "a parser object" } { "separator" "a parser object" } { "parser" "a parser object" } }
+{ $description 
+    "Return a parser for parsing the repetition of things that are "
+    "separated by a certain symbol. For example, comma separated lists. "
+    "'items' is a parser that can parse the individual elements. 'separator' "
+    "is a parser for the symbol that separatest them. The result tree of " 
+    "the resulting parser is an array of the parsed elements." }
+{ $example "USE: parser-combinators" "\"1,2,3,4\" 'integer' \",\" token list-of parse car parse-result-parsed ." "{ 1 2 3 4 }" }
+{ $see-also list-of } ;
+
diff --git a/extra/parser-combinators/parser-combinators-tests.factor b/extra/parser-combinators/parser-combinators-tests.factor
new file mode 100644 (file)
index 0000000..59ef383
--- /dev/null
@@ -0,0 +1,153 @@
+! Copyright (C) 2005 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel lazy-lists tools.test strings math
+sequences parser-combinators arrays math.parser ;
+IN: scratchpad
+
+! Testing <&>
+{ { T{ parse-result f { "a" "b" } T{ slice f 2 4 "abcd" } } }  } [
+  "abcd" "a" token "b" token <&> parse list>array
+] unit-test
+
+{ { T{ parse-result f { { "a" "b" } "c" } T{ slice f 3 4 "abcd" } } } } [
+  "abcd" "a" token "b" token <&> "c" token <&> parse list>array
+] unit-test
+
+{ { T{ parse-result f { "a" { "b" "c" } } T{ slice f 3 4 "abcd" }  } } } [
+  "abcd" "a" token "b" token "c" token <&> <&> parse list>array
+] unit-test
+
+{ { } } [
+  "decd" "a" token "b" token <&> parse list>array
+] unit-test
+
+{ { } } [
+  "dbcd" "a" token "b" token <&> parse list>array
+] unit-test
+
+{ { } } [
+  "adcd" "a" token "b" token <&> parse list>array
+] unit-test
+
+! Testing <|>
+{ { T{ parse-result f "a" T{ slice f 1 4 "abcd" } } } } [
+  "abcd" "a" token "b" token <|> parse list>array
+] unit-test
+
+{ { T{ parse-result f "b" T{ slice f 1 4 "bbcd" } } }  } [
+  "bbcd" "a" token "b" token <|> parse list>array
+] unit-test
+
+{ { } } [
+  "cbcd" "a" token "b" token <|> parse list>array
+] unit-test
+
+! Testing sp
+{ { } } [
+  "  abcd" "a" token parse list>array 
+] unit-test
+
+{ { T{ parse-result f "a" T{ slice f 3 6 "  abcd" } } }  } [
+  "  abcd" "a" token sp parse list>array 
+] unit-test
+
+! Testing just
+{ { T{ parse-result f "abcd" T{ slice f 4 4 "abcd" } } T{ parse-result f "abc" T{ slice f 3 4 "abcd" } } } } [
+  "abcd" "abcd" token "abc" token <|> parse list>array
+] unit-test
+
+{ { T{ parse-result f "abcd" T{ slice f 4 4 "abcd" } } } } [
+  "abcd" "abcd" token "abc" token <|> just parse list>array
+] unit-test 
+
+! Testing <@
+{ { T{ parse-result f 48 T{ slice f 1 5 "01234" } } } } [
+  "01234" [ digit? ] satisfy parse list>array 
+] unit-test
+
+{ { T{ parse-result f 0 T{ slice f 1 5 "01234" } } } } [
+  "01234" [ digit? ] satisfy [ digit> ] <@ parse list>array 
+] unit-test
+
+! Testing some
+{ { T{ parse-result f "begin" T{ slice f 5 6 "begin1" } } } } [
+  "begin1" "begin" token parse list>array
+] unit-test
+
+[
+  "begin1" "begin" token some parse 
+] unit-test-fails 
+
+{ "begin" } [
+  "begin" "begin" token some parse 
+] unit-test
+
+! <& parser and &> parser
+{ { T{ parse-result f { "a" "b" } T{ slice f 2 4 "abcd" } } } } [
+  "abcd" "a" token "b" token <&> parse list>array
+] unit-test
+
+{ { T{ parse-result f "a" T{ slice f 2 4 "abcd" } } } } [
+  "abcd" "a" token "b" token <& parse list>array
+] unit-test
+
+{ { T{ parse-result f "b" T{ slice f 2 4 "abcd" } } } } [
+  "abcd" "a" token "b" token &> parse list>array
+] unit-test
+
+! Testing <*> and <:&>
+{ { T{ parse-result f { "1" } T{ slice f 1 4 "1234" } } T{ parse-result f { } "1234" } } } [
+  "1234" "1" token <*> parse list>array
+] unit-test
+
+{ 
+  {
+    T{ parse-result f { "1" "1" "1" "1" } T{ slice f 4 7 "1111234" }  }
+    T{ parse-result f { "1" "1" "1" } T{ slice f 3 7 "1111234" } }
+    T{ parse-result f { "1" "1" } T{ slice f 2 7 "1111234" } }
+    T{ parse-result f { "1" } T{ slice f 1 7 "1111234" } }
+    T{ parse-result f { } "1111234" }
+  }
+
+} [
+  "1111234" "1" token <*> parse list>array
+] unit-test
+
+{ 
+  {
+    T{ parse-result f { "1111" } T{ slice f 4 7 "1111234" } }
+    T{ parse-result f { "111" } T{ slice f 3 7 "1111234" } }
+    T{ parse-result f { "11" } T{ slice f 2 7 "1111234" } }
+    T{ parse-result f { "1" } T{ slice f 1 7 "1111234" } }
+    T{ parse-result f { { } } "1111234" }
+  }
+} [
+  "1111234" "1" token <*> [ concat 1array ] <@ parse list>array
+] unit-test
+
+{ { T{ parse-result f { } "234" } } } [
+  "234" "1" token <*> parse list>array
+] unit-test
+
+! Testing <+>
+{ { T{ parse-result f { "1" } T{ slice f 1 4 "1234" } } } } [
+  "1234" "1" token <+> parse list>array
+] unit-test
+
+{ 
+  {
+    T{ parse-result f { "1" "1" "1" "1" } T{ slice f 4 7 "1111234" } }
+    T{ parse-result f { "1" "1" "1" }  T{ slice f 3 7 "1111234" } }
+    T{ parse-result f { "1" "1" }  T{ slice f 2 7 "1111234" } }
+    T{ parse-result f { "1" } T{ slice f 1 7 "1111234" } }
+  }
+} [
+  "1111234" "1" token <+> parse list>array
+] unit-test
+
+{ { } } [
+  "234" "1" token <+> parse list>array
+] unit-test
+
+
diff --git a/extra/parser-combinators/parser-combinators.factor b/extra/parser-combinators/parser-combinators.factor
new file mode 100644 (file)
index 0000000..97acf83
--- /dev/null
@@ -0,0 +1,254 @@
+! Copyright (C) 2004 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: lazy-lists promises kernel sequences strings math io
+arrays namespaces splitting ;
+IN: parser-combinators
+
+! Parser combinator protocol
+GENERIC: (parse) ( input parser -- list )
+
+M: promise (parse) ( input parser -- list )
+  force (parse) ;
+
+: parse ( input parser -- promise )
+  (parse) ;
+
+TUPLE: parse-result parsed unparsed ;
+
+C: <parse-result> parse-result
+
+TUPLE: token-parser string ;
+
+C: token token-parser ( string -- parser )
+
+M: token-parser (parse) ( input parser -- list )
+  token-parser-string swap over ?head-slice [
+    <parse-result> 1list    
+  ] [
+    2drop nil
+  ] if ;
+
+TUPLE: satisfy-parser quot ;
+
+C: satisfy satisfy-parser ( quot -- parser )
+
+M: satisfy-parser (parse) ( input parser -- list )
+  #! A parser that succeeds if the predicate,
+  #! when passed the first character in the input, returns
+  #! true.
+  over empty? [
+    2drop nil
+  ] [
+    satisfy-parser-quot >r unclip-slice dup r> call [
+      swap <parse-result> 1list
+    ] [
+      2drop nil
+    ] if 
+  ] if ;
+
+TUPLE: epsilon-parser ;
+
+C: epsilon epsilon-parser ( -- parser )
+
+M: epsilon-parser (parse) ( input parser -- list )
+  #! A parser that parses the empty string. It
+  #! does not consume any input and always returns
+  #! an empty list as the parse tree with the
+  #! unmodified input.
+  drop "" swap <parse-result> 1list ;
+
+TUPLE: succeed-parser result ;
+
+C: succeed succeed-parser ( result -- parser )
+
+M: succeed-parser (parse) ( input parser -- list )
+  #! A parser that always returns 'result' as a
+  #! successful parse with no input consumed.  
+  succeed-parser-result swap <parse-result> 1list ;
+
+TUPLE: fail-parser ;
+
+C: fail fail-parser ( -- parser )
+
+M: fail-parser (parse) ( input parser -- list )
+  #! A parser that always fails and returns
+  #! an empty list of successes.
+  2drop nil ;
+
+TUPLE: and-parser parsers ;
+
+: <&> ( parser1 parser2 -- parser )
+  over and-parser? [
+    >r and-parser-parsers r> add
+  ] [
+    2array 
+  ] if \ and-parser construct-boa ;
+
+: and-parser-parse ( list p1  -- list )
+  swap [
+    dup parse-result-unparsed rot parse
+    [
+      >r parse-result-parsed r>
+      [ parse-result-parsed 2array ] keep
+      parse-result-unparsed <parse-result>
+    ] lmap-with
+  ] lmap-with lconcat ;  
+  
+M: and-parser (parse) ( input parser -- list )
+  #! Parse 'input' by sequentially combining the
+  #! two parsers. First parser1 is applied to the
+  #! input then parser2 is applied to the rest of
+  #! the input strings from the first parser. 
+  and-parser-parsers unclip swapd parse [ [ and-parser-parse ] reduce ] 2curry promise ;
+
+TUPLE: or-parser p1 p2 ;
+
+C: <|> or-parser ( parser1 parser2 -- parser )
+
+M: or-parser (parse) ( input parser1 -- list )
+  #! Return the combined list resulting from the parses
+  #! of parser1 and parser2 being applied to the same
+  #! input. This implements the choice parsing operator.
+  [ or-parser-p1 ] keep or-parser-p2 >r dupd parse swap r> parse lappend ;
+
+: ltrim-slice ( string -- string )
+  #! Return a new string without any leading whitespace
+  #! from the original string.
+  dup empty? [
+    dup first blank? [ 1 tail-slice ltrim-slice ] when 
+  ] unless ;
+
+TUPLE: sp-parser p1 ;
+
+#! Return a parser that first skips all whitespace before
+#! calling the original parser.
+C: sp sp-parser ( p1 -- parser )
+
+M: sp-parser (parse) ( input parser -- list )
+  #! Skip all leading whitespace from the input then call
+  #! the parser on the remaining input.
+  >r ltrim-slice r> sp-parser-p1 parse ;
+
+TUPLE: just-parser p1 ;
+
+C: just just-parser ( p1 -- parser )
+
+M: just-parser (parse) ( input parser -- result )
+  #! Calls the given parser on the input removes
+  #! from the results anything where the remaining
+  #! input to be parsed is not empty. So ensures a 
+  #! fully parsed input string.
+  just-parser-p1 parse [ parse-result-unparsed empty? ] lsubset ;
+
+TUPLE: apply-parser p1 quot ;
+
+C: <@ apply-parser ( parser quot -- parser )
+
+M: apply-parser (parse) ( input parser -- result )
+  #! Calls the parser on the input. For each successfull
+  #! parse the quot is call with the parse result on the stack.
+  #! The result of that quotation then becomes the new parse result.
+  #! This allows modification of parse tree results (like
+  #! converting strings to integers, etc).
+  [ apply-parser-p1 ] keep apply-parser-quot 
+  -rot parse [ 
+    [ parse-result-parsed swap call ] keep
+    parse-result-unparsed <parse-result>
+  ] lmap-with ;
+
+TUPLE: some-parser p1 ;
+
+C: some some-parser ( p1 -- parser )
+
+M: some-parser (parse) ( input parser -- result )
+  #! Calls the parser on the input, guarantees
+  #! the parse is complete (the remaining input is empty),
+  #! picks the first solution and only returns the parse
+  #! tree since the remaining input is empty.
+  some-parser-p1 just parse car parse-result-parsed ;
+
+
+: <& ( parser1 parser2 -- parser )
+  #! Same as <&> except discard the results of the second parser.
+  <&> [ first ] <@ ;
+
+: &> ( parser1 parser2 -- parser )
+  #! Same as <&> except discard the results of the first parser.
+  <&> [ second ] <@ ;
+
+: <:&> ( parser1 parser2 -- result )
+  #! Same as <&> except flatten the result.
+  <&> [ dup second swap first [ % , ] { } make ] <@ ;
+
+: <&:> ( parser1 parser2 -- result )
+  #! Same as <&> except flatten the result.
+  <&> [ dup second swap first [ , % ] { } make ] <@ ;
+
+LAZY: <*> ( parser -- parser )
+  dup <*> <&:> { } succeed <|> ;
+
+: <+> ( parser -- parser )
+  #! Return a parser that accepts one or more occurences of the original
+  #! parser.
+  dup <*> <&:> ;
+
+LAZY: <?> ( parser -- parser )
+  #! Return a parser that optionally uses the parser
+  #! if that parser would be successfull.
+  [ 1array ] <@ f succeed <|> ;
+
+TUPLE: only-first-parser p1 ;
+LAZY: only-first ( parser -- parser )
+  \ only-first-parser construct-boa ;
+
+M: only-first-parser (parse) ( input parser -- list )
+  #! Transform a parser into a parser that only yields
+  #! the first possibility.
+  only-first-parser-p1 parse 1 swap ltake ;
+
+LAZY: <!*> ( parser -- parser )
+  #! Like <*> but only return one possible result
+  #! containing all matching parses. Does not return
+  #! partial matches. Useful for efficiency since that's
+  #! usually the effect you want and cuts down on backtracking
+  #! required.
+  <*> only-first ;
+
+LAZY: <!+> ( parser -- parser )
+  #! Like <+> but only return one possible result
+  #! containing all matching parses. Does not return
+  #! partial matches. Useful for efficiency since that's
+  #! usually the effect you want and cuts down on backtracking
+  #! required.
+  <+> only-first ;
+
+LAZY: <!?> ( parser -- parser )
+  #! Like <?> but only return one possible result
+  #! containing all matching parses. Does not return
+  #! partial matches. Useful for efficiency since that's
+  #! usually the effect you want and cuts down on backtracking
+  #! required.
+  <?> only-first ;
+
+LAZY: <(*)> ( parser -- parser ) 
+    #! Like <*> but take shortest match first. 
+    #! Implementation by Matthew Willis.
+    { } succeed swap dup <(*)> <&:> <|> ;
+
+LAZY: <(+)> ( parser -- parser )
+    #! Like <+> but take shortest match first. 
+    #! Implementation by Matthew Willis.
+    dup <(*)> <&:> ;
+
+LAZY: pack ( close body open -- parser )
+  #! Parse a construct enclosed by two symbols,
+  #! given a parser for the opening symbol, the
+  #! closing symbol, and the body.
+  <& &> ;
+
+LAZY: list-of ( items separator -- parser )
+  #! Given a parser for the separator and for the
+  #! items themselves, return a parser that parses
+  #! lists of those items. The parse tree is an 
+  #! array of the parsed items.
+  over &> <*> <&:> { } succeed <|> ; 
\ No newline at end of file
diff --git a/extra/parser-combinators/parser-combinators.html b/extra/parser-combinators/parser-combinators.html
new file mode 100644 (file)
index 0000000..33aeaba
--- /dev/null
@@ -0,0 +1,341 @@
+<html>
+  <head>
+    <title>Parser Combinators</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+      </head>
+  <body>
+    <h1>Parsers</h1>
+<p class="note">The parser combinator library described here is based
+  on a library written for the Clean pure functional programming language and
+  described in chapter 5 of the 'Clean Book' (<a
+  href="ftp://ftp.cs.kun.nl/pub/Clean/papers/cleanbook/II.05.ParserCombinators.pdf">PDF
+  available here</a>). Based on the description
+  in that chapter I developed a version for Factor, a concatenative
+  language.</p>  
+<p>A parser is a word or quotation that, when called, processes
+   an input string on the stack, performs some parsing operation on
+   it, and returns a result indicating the success of the parsing
+   operation.</p> 
+<p>The result returned by a parser is known as a 'list of
+successes'. It is a lazy list of standard Factor cons cells. Each cons
+cell is a result of a parse. The car of the cell is the remaining
+input left to be parsed and the cdr of the cell is the result of the
+parsing operation.</p>
+<p>A lazy list is used for the result as a parse operation can potentially
+return many successful results. For example, a parser that parses one
+or more digits will return more than one result for the input "123". A
+successful parse could be "1", "12" or "123".</p>
+<p>The list is lazy so if only one parse result is required the
+remaining results won't actually be processed if they are not
+requested. This improves efficiency.</p>
+<p>The cdr of the result pair can be any value that the parser wishes
+to return. It could be the successful portion of the input string
+parsed, an abstract syntax tree representing the parsed input, or even
+a quotation that should get called for later processing.</p>
+<p>A Parser Combinator is a word that takes one or more parsers and
+returns a parser that when called uses the original parsers in some
+manner.</p>
+<h1>Example Parsers</h1>
+<p>The following are some very simple parsers that demonstrate how
+general parsers work and the 'list of sucesses' that are returned as a
+result.</p>
+<pre class="code">
+  (1) : char-a ( inp -- result )
+        0 over string-nth CHAR: a = [
+          1 swap string-tail CHAR: a cons unit delay lunit
+        ] [
+          drop lnil
+        ] ifte ;
+  (2) "atest" char-a [ [ . ] leach ] when*
+      =&gt; [[ "test" 97 ]]
+  (3) "test"  char-a [ [ . ] leach ] when*
+      =&gt;
+</pre>
+<p>'char-a' is a parser that only accepts the character 'a' in the
+input string. When passed an input string with a string with a leading
+'a' then the 'list of successes' has 1 result value. The cdr of that
+result value is the character 'a' successfully parsed, and the car is
+the remaining input string. On failure of the parse an empty list is
+returned.</p> 
+<p>The parser combinator library provides a combinator, &lt;&amp;&gt;, that takes
+two parsers off the stack and returns a parser that calls the original
+two in sequence. An example of use would be calling 'char-a' twice,
+which would then result in an input string expected with two 'a'
+characters leading:</p>
+<pre class="code">
+  (1) "aatest" [ char-a ] [ char-a ] &lt;&amp;&gt; call
+      =&gt; < list of successes >
+  (2) [ . ] leach
+      =&gt; [[ "test" [[ 97 97 ]] ]]
+</pre>
+<h2>Tokens</h2>
+<p>Creating parsers for specfic characters and tokens can be a chore
+so there is a word that, given a string token on the stack, returns
+a parser that parses that particular token:</p>
+<pre class="code">
+  (1) "begin" token 
+      =&gt; < a parser that parses the token "begin" >
+  (2) dup "this should fail" swap call lnil? .
+      =&gt; t
+  (3) "begin a successfull parse" swap call 
+      =&gt; < lazy list >
+  (4) [ . ] leach
+      =&gt; [[ " a successfull parse" "begin" ]]
+</pre>
+<h2>Predicate matching</h2>
+<p>The word 'satisfy' takes a quotation from the top of the stack and
+returns a parser than when called will call the quotation with the
+first item in the input string on the stack. If the quotation returns
+true then the parse is successful, otherwise it fails:</p>
+<pre class="code">
+  (1) : digit-parser ( -- parser )
+        [ digit? ] satisfy ;
+  (2) "5" digit-parser call [ . ] leach
+      =&gt; [[ "" 53 ]]
+  (3) "a" digit-parser call lnil? .
+      =&gt; t
+</pre>
+<p>Note that 'digit-parser' returns a parser, it is not the parser
+itself. It is really a parser generating word like 'token'. Whereas
+our 'char-a' word defined originally was a parser itself.</p>
+<h2>Zero or more matches</h2>
+<p>Now that we can parse single digits it would be nice to easily
+parse a string of them. The '<*>' parser combinator word will do
+this. It accepts a parser on the top of the stack and produces a
+parser that parses zero or more of the constructs that the original
+parser parsed. The result of the '<*>' generated parser will be a list
+of the successful results returned by the original parser.</p>
+<pre class="code">
+  (1) digit-parser <*>
+      =&gt; < parser >
+  (2) "123" swap call
+      =&gt; < lazy list >
+  (3) [ . ] leach
+      =&gt; [ "" [ 49 50 51 ] ]
+           [ "3" [ 49 50 ] ]
+           [ "23" [ 49 ] ]
+           [ "123" ]
+</pre>
+<p>In this case there are multiple successful parses. This is because
+the occurrence of zero or more digits happens more than once. There is
+also the 'f' case where zero digits is parsed. If only the 'longest
+match' is required then the lcar of the lazy list can be used and the
+remaining parse results are never produced.</p>
+<h2>Manipulating parse trees</h2>
+<p>The result of the previous parse was the list of characters
+parsed. Sometimes you want this to be something else, like an abstract
+syntax tree, or some calculation. For the digit case we may want the
+actual integer number.</p>
+<p>For this we can use the '&lt;@' parser
+combinator. This combinator takes a parser and a quotation on the
+stack and returns a new parser. When the new parser is called it will
+call the original parser to produce the results, then it will call the
+quotation on each successfull result, and the result of that quotation
+will be the result of the parse:</p>
+<pre class="code">
+  (1) : digit-parser2 ( -- parser )
+        [ digit? ] satisfy [ digit> ] &lt;@ ;
+  (2) "5" digit-parser2 call [ . ] leach
+      =&gt; [[ "" 5 ]]
+</pre>
+<p>Notice that now the result is the actual integer '5' rather than
+character code '53'.</p>
+<pre class="code">
+  (1) : digit-list>number ( list -- number )
+         #! Converts a list of digits to a number
+         [ >digit ] map >string dup empty? [ 
+           drop 0 
+         ] [
+          str>number 
+         ]  ifte ;
+  (2) : natural-parser ( -- parser )
+        digit-parser2 <*> [ car digit-list>number unit  ] &lt;@  ;
+  (3) "123" natural-parser call
+      =&gt; < lazy list >
+  (4) [ . ] leach
+      =&gt; [ "" 123 ]
+           [ "3" 12 ]
+           [ "23" 1 ]
+           [ "123" 0 ]
+           [ [ 123 ] | "" ]
+</pre>
+<p>The number parsed is the actual integer number due to the operation
+of the '&lt;@' word. This allows parsers to not only parse the input
+string but perform operations and transformations on the syntax tree
+returned.</p>
+<p>A useful debugging method to work out what to use in the quotation
+passed to &lt;@ is to write an initial version of the parser that just
+displays the topmost item on the stack:</p>
+<pre class="code">
+  (1) : natural-parser-debug ( -- parser )
+        digit-parser2 <*> [ "debug: " write dup . ] &lt;@  ;
+  (3) "123" natural-parser-debug call lcar .
+      =&gt; debug: [ [ 1 2 3 ] ]
+           [ "" [ 1 2 3 ] ]
+</pre>
+<p>From the debug output we can see how to manipulate the result to
+get what we want. In this case it's the quotation in the previous example.</p>
+<h2>Sequential combinator</h2>
+<p>To create a full grammar we need a parser combinator that does
+sequential compositions. That is, given two parsers, the sequential
+combinator will first run the first parser, and then run the second on
+the remaining text to be parsed. As the first parser returns a lazy
+list, the second parser will be run on each item of the lazy list. Of
+course this is done lazily so it only ends up being done when those
+list items are requested. The sequential combinator word is &lt;&amp;&gt;.</p>
+<pre class="code">
+  ( 1 ) "number:" token 
+       =&gt; < parser that parses the text 'number:' >
+  ( 2 ) natural-parser
+       =&gt; < parser that parses natural numbers >
+  ( 3 ) &lt;&amp;&gt;
+       =&gt; < parser that parses 'number:' followed by a natural >
+  ( 4 ) "number:100" swap call
+       =&gt; < list of successes >
+  ( 5 ) [ . ] leach
+       =&gt; [ "" "number:" 100 ]
+            [ "0" "number:" 10 ]
+            [ "00" "number:" 1 ]
+            [ "100" "number:" 0 ]
+</pre>
+<p>In this  example we might prefer not to have the parse result
+contain the token, we want just the number. Two alternatives to &lt;&amp;&gt;
+provide the ability to select which result to use from the two
+parsers. These operators are &lt;&amp; and &amp;&gt;. The &lt; or &gt; points 
+in the direction of which parser to retain the results from. So our
+example above could be:</p>
+<pre class="code">
+  ( 1 ) "number:" token 
+       =&gt; < parser that parses the text 'number:' >
+  ( 2 ) natural-parser
+       =&gt; < parser that parses natural numbers >
+  ( 3 ) &amp;&gt;
+       =&gt; < parser that parses 'number:' followed by a natural >
+  ( 4 ) "number:100" swap call
+       =&gt; < list of successes >
+  ( 5 ) [ . ] leach
+       =&gt; [ "" 100 ]
+            [ "0" 10 ]
+            [ "00" 1 ]
+            [ "100" 0 ]
+</pre>
+<p>Notice how the parse result only contains the number due to &&gt;
+being used to retain the result of the second parser.</p>
+
+<h2>Choice combinator</h2>
+<p>As well as a sequential combinator we need an alternative
+combinator. The word for this is &lt;|&gt;. It takes two parsers from the
+stack and returns a parser that will first try the first parser. If it
+succeeds then the result for that is returned. If it fails then the
+second parser is tried and its result returned.</p>
+<pre class="code">
+  ( 1 ) "one" token
+        =&gt; < parser that parses the text 'one' >
+  ( 2 ) "two" token 
+        =&gt; < parser that parses the text 'two' >
+  ( 3 ) &lt;|&gt;
+        =&gt; < parser that parses 'one' or 'two' >
+  ( 4 ) "one" over call [ . ] leach
+        =&gt; [[ "" "one" ]]
+  ( 5 ) "two" swap call [ . ] leach
+        =&gt; [[ "" "two" ]]
+</pre>
+
+<h2>Option combinator</h2>
+<p>The option combinator, &lt;?&gt; allows adding optional elements to
+a parser. It takes one parser off the stack and if the parse succeeds
+add it to the result tree, otherwise it will ignore it and
+continue. The example below extends our natural-parser to parse
+integers with an optional leading minus sign.</p>
+<pre class="code">
+  ( 1 ) : integer-parser
+          "-" token &lt;?&gt; natural-parser &lt;&amp;&gt; ;
+  ( 2 ) "200" integer-parser call [ . ] leach 
+       =&gt; [ "" [ ] 200 ]
+            [ "0" [ ] 20 ]
+            [ "00" [ ] 2 ]
+            [ "200" [ ] 0 ]
+  ( 3 ) "-200" integer-parser call [ . ] leach
+       =&gt; [ "" [ "-" ] 200 ]
+            [ "0" [ "-" ] 20 ]
+            [ "00" [ "-" ] 2 ]
+            [ "200" [ "-" ] 0 ]
+            [ "-200" [ ] 0 ]
+  ( 4 ) : integer-parser2
+          integer-parser [ uncons swap [ car -1 * ] when ] &lt;@ ;
+  ( 5 ) "200" integer-parser2 call [ . ] leach 
+       =&gt; [ "" 200 ]
+            [ "0" 20 ]
+            [ "00" 2 ]
+            [ "200" 0 ]
+  ( 6 ) "-200" integer-parser2 call [ . ] leach
+       =&gt; [ "" -200 ]
+            [ "0" -20 ]
+            [ "00" -2 ]
+            [ "200" 0 ]
+            [ "-200" 0 ]
+
+</pre>
+
+<h2>Skipping Whitespace</h2>
+<p>A parser transformer exists, the word 'sp', that takes an existing
+parser and returns a new one that will first skip any whitespace
+before calling the original parser. This makes it easy to write
+grammers that avoid whitespace without having to explicitly code it
+into the grammar.</p>
+<pre class="code">
+  ( 1 ) "  123" natural-parser call [ . ] leach
+        =&gt; [ "  123" 0 ]
+  ( 2 ) "  123" natural-parser sp call [ . ] leach
+        =&gt; [ "" 123 ]
+             [ "3" 12 ]
+             [ "23" 1 ]
+             [ "123" 0 ]
+</pre>
+<h2>Eval grammar example</h2>
+<p>This example presents a simple grammar that will parse a number
+followed by an operator and another number. A factor expression that
+computes the entered value will be executed.</p>
+<pre class="code">
+  ( 1 ) natural-parser
+        =&gt; < a parser for natural numbers >
+  ( 2 ) "/" token "*" token "+" token "-" token &lt;|&gt; &lt;|&gt; &lt;|&gt;
+        =&gt; < a parser for the operator >
+  ( 3 ) sp [ "\\ " swap cat2 eval unit ] &lt;@
+        =&gt; < operator parser that skips whitespace and converts to a 
+             factor expression >
+  ( 4 ) natural-parser sp
+        =&gt; < a whitespace skipping natural parser >
+  ( 5 ) &lt;&amp;&gt; &lt;&amp;&gt; [ uncons uncons swap append append call ] &lt;@
+        =&gt; < a parser that parsers the expression, converts it to
+             factor, calls it and puts the result in the parse tree >
+  ( 6 ) "123 + 456" over call lcar .
+        =&gt; [[ "" 579 ]]
+  ( 7 ) "300-100" over call lcar .
+        =&gt; [[ "" 200 ]]
+  ( 8 ) "200/2" over call lcar .
+        =&gt; [[ "" 100 ]]
+</pre>
+<p>It looks complicated when expanded as above but the entire parser,
+factored a little, looks quite readable:</p>
+<pre class="code">
+  ( 1 ) : operator ( -- parser )
+          "/" token 
+          "*" token &lt;|&gt;
+          "+" token &lt;|&gt;
+          "-" token &lt;|&gt;
+          [ "\\ " swap cat2 eval unit ] &lt;@ ;
+  ( 2 ) : expression ( -- parser )
+          natural-parser 
+          operator sp &lt;&amp;&gt;  
+          natural-parser sp &lt;&amp;&gt; 
+          [ uncons swap uncons -rot append append reverse call ] &lt;@ ;
+  ( 3 ) "40+2" expression call lcar .
+        =&gt; [[ "" 42 ]]
+</pre>
+<p class="footer">
+News and updates to this software can be obtained from the authors
+weblog: <a href="http://radio.weblogs.com/0102385">Chris Double</a>.</p>
+<p id="copyright">Copyright (c) 2004, Chris Double. All Rights Reserved.</p>
+</body> </html>
diff --git a/extra/parser-combinators/replace/replace-docs.factor b/extra/parser-combinators/replace/replace-docs.factor
new file mode 100644 (file)
index 0000000..e0d75b3
--- /dev/null
@@ -0,0 +1,76 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.syntax help.markup parser-combinators
+parser-combinators.replace ;
+
+HELP: tree-write
+{ $values 
+  { "object" "an object" } }
+{ $description 
+    "Write the object to the standard output stream, unless "
+    "it is an array, in which case recurse through the array "
+    "writing each object to the stream." }
+{ $example "[ { 65 \"bc\" { 68 \"ef\" } } tree-write ] string-out ." "\"AbcDef\"" } ;
+
+HELP: search
+{ $values 
+  { "string" "a string" } 
+  { "parser" "a parser combinator based parser" } 
+  { "seq"    "a sequence" } 
+}
+{ $description 
+    "Returns a sequence containing the parse results of all substrings "
+    "from the input string that successfully parse using the "
+    "parser."
+}
+    
+{ $example "\"one 123 two 456\" 'integer' search ." "{ 123 456 }" }
+{ $example "\"one 123 \\\"hello\\\" two 456\" 'integer' 'string' <|> search ." "{ 123 \"hello\" 456 }" }
+{ $see-also search* replace replace* } ;
+
+HELP: search*
+{ $values 
+  { "string" "a string" } 
+  { "parsers" "a sequence of parser combinator based parsers" } 
+  { "seq"    "a sequence" } 
+}
+{ $description 
+    "Returns a sequence containing the parse results of all substrings "
+    "from the input string that successfully parse using any of the "
+    "parsers in the 'parsers' sequence."
+}
+    
+{ $example "\"one 123 \\\"hello\\\" two 456\" 'integer' 'string' 2array search* ." "{ 123 \"hello\" 456 }" }
+{ $see-also search replace replace* } ;
+
+HELP: replace
+{ $values 
+  { "string" "a string" } 
+  { "parser" "a parser combinator based parser" } 
+  { "result"    "a string" } 
+}
+{ $description 
+    "Returns a copy of the original string but with all substrings that "
+    "successfully parse with the given parser replaced with "
+    "the result of that parser."
+}   
+{ $example "\"one 123 two 456\" 'integer' [ 2 * number>string ] <@ replace ." "\"one 246 two 912\"" }
+{ $example "\"hello *world* from *factor*\" 'bold' [ \"<strong>\" swap \"</strong>\" 3append ] <@ replace ." "\"hello <strong>world</strong> from <strong>factor</strong>\"" }
+{ $example "\"hello *world* from _factor_\"\n 'bold' [ \"<strong>\" swap \"</strong>\" 3append ] <@\n 'italic' [ \"<emphasis>\" swap \"</emphasis>\" 3append ] <@ <|>\n replace ." "\"hello <strong>world</strong> from <emphasis>factor</emphasis>\"" }
+{ $see-also search search* replace* } ;
+
+HELP: replace*
+{ $values 
+  { "string" "a string" } 
+  { "parsers" "a sequence of parser combinator based parsers" } 
+  { "result"    "a string" } 
+}
+{ $description 
+    "Returns a copy of the original string but with all substrings that "
+    "successfully parse with the given parsers replaced with "
+    "the result of that parser. Each parser is done in sequence so that "
+    "the parse results of the first parser can be replaced by later parsers."
+}   
+{ $example "\"*hello _world_*\"\n 'bold' [ \"<strong>\" swap \"</strong>\" 3append ] <@\n 'italic' [ \"<emphasis>\" swap \"</emphasis>\" 3append ] <@ 2array\n replace* ." "\"<strong>hello <emphasis>world</emphasis></strong>\"" }
+{ $see-also search search* replace* } ;
+
diff --git a/extra/parser-combinators/replace/replace.factor b/extra/parser-combinators/replace/replace.factor
new file mode 100644 (file)
index 0000000..0d9b7f7
--- /dev/null
@@ -0,0 +1,37 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math io io.streams.string sequences strings
+lazy-lists combinators parser-combinators.simple ;
+IN: parser-combinators 
+
+: tree-write ( object -- )
+  { 
+    { [ dup number?   ] [ write1 ] }
+    { [ dup string?   ] [ write ] }
+    { [ dup sequence? ] [ [ tree-write ] each ] }
+    { [ t             ] [ write ] }
+  } cond ;
+
+: search ( string parser -- seq )
+  'any-char' [ drop f ] <@ <|> <*> parse dup nil? [
+    drop { }
+  ] [
+    car parse-result-parsed [ ] subset 
+  ] if ;
+
+: search* ( string parsers -- seq )
+  unclip [ <|> ] reduce 'any-char' [ drop f ] <@ <|> <*> parse dup nil? [
+    drop { }
+  ] [
+    car parse-result-parsed [ ] subset 
+  ] if ;
+
+: (replace) ( string parser -- seq )
+  'any-char' <|> <*> parse car parse-result-parsed ;
+
+: replace ( string parser -- result )
+ [  (replace) [ tree-write ] each ] string-out ;
+
+: replace* ( string parsers -- result )
+  swap [ replace ] reduce ;
+
diff --git a/extra/parser-combinators/simple/simple-docs.factor b/extra/parser-combinators/simple/simple-docs.factor
new file mode 100644 (file)
index 0000000..b85d3ab
--- /dev/null
@@ -0,0 +1,84 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.syntax help.markup parser-combinators
+parser-combinators.simple ;
+
+HELP: 'any-char'
+{ $values 
+  { "parser" "a parser object" } }
+{ $description 
+    "Return a parser that consumes a single value "
+    "from the input string. The value consumed is the "  
+    "result of the parse." }
+{ $examples
+{ $example "USING: lazy-lists parser-combinators ;" "\"foo\" 'any-char' parse car parse-result-parsed ." "102" } }
+{ $see-also 'any-char' 'digit' 'integer' 'string' 'bold' 'italic' comma-list } ;
+
+HELP: 'digit'
+{ $values 
+  { "parser" "a parser object" } }
+{ $description 
+    "Return a parser that consumes a single digit from "
+    "the input string. The numeric value of the digit "
+    " consumed is the result of the parse." }
+{ $examples
+{ $example "USING: lazy-lists parser-combinators ;" "\"123\" 'digit' parse car parse-result-parsed ." "1" } }
+{ $see-also 'any-char' 'digit' 'integer' 'string' 'bold' 'italic' comma-list } ;
+
+HELP: 'integer'
+{ $values 
+  { "parser" "a parser object" } }
+{ $description 
+    "Return a parser that consumes an integer from "
+    "the input string. The numeric value of the integer "
+    " consumed is the result of the parse." }
+{ $examples
+{ $example "USING: lazy-lists parser-combinators ;" "\"123\" 'integer' parse car parse-result-parsed ." "123" } }
+{ $see-also 'any-char' 'digit' 'integer' 'string' 'bold' 'italic' comma-list } ;
+
+HELP: 'string'
+{ $values 
+  { "parser" "a parser object" } }
+{ $description 
+    "Return a parser that consumes a string enclosed in "
+    "quotations from the input string. The string value "
+    " consumed is the result of the parse." }
+{ $examples
+{ $example "USING: lazy-lists parser-combinators ;" "\"\\\"foo\\\"\" 'string' parse car parse-result-parsed ." "\"foo\"" } }
+{ $see-also 'any-char' 'digit' 'integer' 'string' 'bold' 'italic' comma-list } ;
+
+HELP: 'bold'
+{ $values 
+  { "parser" "a parser object" } }
+{ $description 
+    "Return a parser that consumes a string enclosed in "
+    "the '*' character from the input string. This is "
+    "commonly used in markup languages to indicate bold "
+    "faced text." }
+{ $example "USE: parser-combinators" "\"*foo*\" 'bold' parse car parse-result-parsed ." "\"foo\"" }
+{ $example "USE: parser-combinators" "\"*foo*\" 'bold' [ \"<strong>\" swap \"</strong>\" 3append ] <@ parse car parse-result-parsed ." "\"<strong>foo</strong>\"" }
+{ $see-also 'any-char' 'digit' 'integer' 'string' 'bold' 'italic' comma-list } ;
+
+HELP: 'italic'
+{ $values 
+  { "parser" "a parser object" } }
+{ $description 
+    "Return a parser that consumes a string enclosed in "
+    "the '_' character from the input string. This is "
+    "commonly used in markup languages to indicate italic "
+    "faced text." }
+{ $examples
+{ $example "USING: lazy-lists parser-combinators ;" "\"_foo_\" 'italic' parse car parse-result-parsed ." "\"foo\"" }
+{ $example "USING: lazy-lists parser-combinators ;" "\"_foo_\" 'italic' [ \"<emphasis>\" swap \"</emphasis>\" 3append ] <@ parse car parse-result-parsed ." "\"<emphasis>foo</emphasis>\"" } }
+{ $see-also 'any-char' 'digit' 'integer' 'string' 'bold' 'italic' comma-list } ;
+
+HELP: comma-list
+{ $values 
+  { "element" "a parser object" } { "parser" "a parser object" } }
+{ $description 
+    "Return a parser that parses comma separated lists of elements. "
+    "'element' should be a parser that can parse the elements. The "
+    "result of the parser is a sequence of the parsed elements." }
+{ $examples
+{ $example "USING: lazy-lists parser-combinators ;" "\"1,2,3,4\" 'integer' comma-list parse car parse-result-parsed ." "{ 1 2 3 4 }" } }
+{ $see-also 'any-char' 'digit' 'integer' 'string' 'bold' 'italic' comma-list } ;
diff --git a/extra/parser-combinators/simple/simple.factor b/extra/parser-combinators/simple/simple.factor
new file mode 100644 (file)
index 0000000..eac1c40
--- /dev/null
@@ -0,0 +1,32 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel strings math sequences lazy-lists words
+math.parser promises ;
+IN: parser-combinators 
+
+LAZY: 'any-char' ( -- parser )
+  [ drop t ] satisfy ;
+
+: 'digit' ( -- parser )
+  [ digit? ] satisfy [ digit> ] <@ ;
+
+: 'integer' ( -- parser )
+  'digit' <!+> [ 0 [ swap 10 * + ] reduce ] <@ ;
+
+: 'string' ( -- parser )
+  [ CHAR: " = ] satisfy 
+  [ CHAR: " = not ] satisfy <*> &>
+  [ CHAR: " = ] satisfy <& [ >string ] <@  ;
+  
+: 'bold' ( -- parser )
+  "*" token 
+  [ CHAR: * = not  ] satisfy <*> [ >string ] <@ &> 
+  "*" token <& ;
+
+: 'italic' ( -- parser )
+  "_" token 
+  [ CHAR: _ = not ] satisfy <*> [ >string ] <@ &> 
+  "_" token <& ;
+
+: comma-list ( element -- parser )
+  "," token list-of ;
\ No newline at end of file
diff --git a/extra/parser-combinators/summary.txt b/extra/parser-combinators/summary.txt
new file mode 100644 (file)
index 0000000..2fba457
--- /dev/null
@@ -0,0 +1 @@
+Haskell-style lazy parser combinators
diff --git a/extra/partial-continuations/authors.txt b/extra/partial-continuations/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/partial-continuations/partial-continuations-docs.factor b/extra/partial-continuations/partial-continuations-docs.factor
new file mode 100644 (file)
index 0000000..93e68ea
--- /dev/null
@@ -0,0 +1,22 @@
+IN: partial-continuations
+USING: help.markup help.syntax kernel ;
+
+HELP: breset
+{ $values { "quot" "a quotation with stack effect " { $snippet "( r -- v )" } } }
+{ $description "Marks the boundary of the partial continuation. The quotation has stack effect " { $snippet "( r -- v )" } ", where " { $snippet "r" } " identifies the " { $link breset } " in scope and should be passed to  "{ $link bshift } " to mark the boundary of the continuation." }
+{ $notes "It is important to note that even if the quotation discards items on the stack, the stack will be restored to the way it was before it is called (which is true of continuation usage in general)." } ;
+
+HELP: bshift
+{ $values { "r" "the " { $link breset } " in scope" } { "quot" "a quotation with stack effect " { $snippet "( pcc -- v )" } } }
+{ $description "Calls the quotation with the partial continuation  on the stack. The quotation should have stack effect " { $snippet "( pcc -- v )" } ". The partial continuation can be called with " { $link call } " and has stack effect " { $snippet "( a -- b )" } "." }
+{ $notes "It is important to note that even if the quotation discards items on the stack, the stack will be restored to the way it was before it is called (which is true of continuation usage in general)." } ;
+
+ARTICLE: "partial-continuations" "Partial continuations"
+"Based on Scheme code for bshift and breset from"
+{ $url "http://groups.google.com/group/comp.lang.scheme/msg/9f0d61da01540816" } "."
+"See this blog entry for more details:"
+{ $url "http://www.bluishcoder.co.nz/2006/03/factor-partial-continuation-updates.html" }
+{ $subsection breset }
+{ $subsection bshift } ;
+
+ABOUT: "partial-continuations"
diff --git a/extra/partial-continuations/partial-continuations-tests.factor b/extra/partial-continuations/partial-continuations-tests.factor
new file mode 100644 (file)
index 0000000..56dc6bc
--- /dev/null
@@ -0,0 +1,16 @@
+USING: namespaces math partial-continuations tools.test
+kernel sequences ;
+IN: temporary
+
+SYMBOL: sum
+
+: range ( r from to -- n )
+    over - 1 + rot [ 
+        -rot [ over + pick call drop ] each 2drop f  
+    ] bshift 2nip ;
+
+[ 55 ] [
+    0 sum set 
+    [ 1 10 range sum get + sum set f ] breset drop
+    sum get
+] unit-test
diff --git a/extra/partial-continuations/partial-continuations.factor b/extra/partial-continuations/partial-continuations.factor
new file mode 100644 (file)
index 0000000..0dce7c2
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+IN: partial-continuations
+USING: kernel continuations arrays sequences quotations ;
+
+: breset ( quot -- )
+    [ 1array swap keep first continue-with ] callcc1 nip ;
+
+: (bshift) ( v r k -- )
+    >r dup first -rot r>
+    [
+        rot set-first
+        continue-with
+    ] callcc1
+    >r drop nip set-first r> ;
+
+: bshift ( r quot -- )
+    swap [ ! quot r k
+        over >r
+        [ (bshift) ] 2curry swap call
+        r> first continue-with
+    ] callcc1 2nip ;
diff --git a/extra/partial-continuations/summary.txt b/extra/partial-continuations/summary.txt
new file mode 100644 (file)
index 0000000..ba3a1a7
--- /dev/null
@@ -0,0 +1 @@
+Partial continuations - breset/bshift
diff --git a/extra/partial-continuations/tags.txt b/extra/partial-continuations/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/pdf/authors.txt b/extra/pdf/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/extra/pdf/libhpdf/libhpdf.factor b/extra/pdf/libhpdf/libhpdf.factor
new file mode 100644 (file)
index 0000000..85ccc70
--- /dev/null
@@ -0,0 +1,180 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Tested with libharu2 2.0.8 on Mac OS X 10.4.9 PowerPC
+!
+! export LD_LIBRARY_PATH=/opt/local/lib
+
+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" ] }
+} cond add-library
+
+! compression mode
+: HPDF_COMP_NONE      HEX: 00 ; inline ! No contents are compressed
+: HPDF_COMP_TEXT      HEX: 01 ; inline ! Compress contents stream of page
+: HPDF_COMP_IMAGE     HEX: 02 ; inline ! Compress streams of image objects
+: HPDF_COMP_METADATA  HEX: 04 ; inline ! Compress other data (fonts, cmaps...)
+: HPDF_COMP_ALL       HEX: 0F ; inline ! All stream data are compressed
+: 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
+;
+
+: error-code ( -- seq ) {
+     { HEX: 1001  "HPDF_ARRAY_COUNT_ERR\nInternal error. The consistency of the data was lost." }
+     { HEX: 1002  "HPDF_ARRAY_ITEM_NOT_FOUND\nInternal error. The consistency of the data was lost." }
+     { HEX: 1003  "HPDF_ARRAY_ITEM_UNEXPECTED_TYPE\nInternal error. The consistency of the data was lost." }
+     { HEX: 1004  "HPDF_BINARY_LENGTH_ERR\nThe length of the data exceeds HPDF_LIMIT_MAX_STRING_LEN." }
+     { HEX: 1005  "HPDF_CANNOT_GET_PALLET\nCannot get a pallet data from PNG image." }
+     { HEX: 1007  "HPDF_DICT_COUNT_ERR\nThe count of elements of a dictionary exceeds HPDF_LIMIT_MAX_DICT_ELEMENT" }
+     { HEX: 1008  "HPDF_DICT_ITEM_NOT_FOUND\nInternal error. The consistency of the data was lost." }
+     { HEX: 1009  "HPDF_DICT_ITEM_UNEXPECTED_TYPE\nInternal error. The consistency of the data was lost." }  
+     { HEX: 100A  "HPDF_DICT_STREAM_LENGTH_NOT_FOUND\nInternal error. The consistency of the data was lost." }  
+     { HEX: 100B  "HPDF_DOC_ENCRYPTDICT_NOT_FOUND\nHPDF_SetPermission() OR HPDF_SetEncryptMode() was called before a password is set." }
+     { HEX: 100C  "HPDF_DOC_INVALID_OBJECT\nInternal error. The consistency of the data was lost." }
+     { HEX: 100E  "HPDF_DUPLICATE_REGISTRATION\nTried to register a font that has been registered." }
+     { HEX: 100F  "HPDF_EXCEED_JWW_CODE_NUM_LIMIT\nCannot register a character to the japanese word wrap characters list." }
+     { HEX: 1011  "HPDF_ENCRYPT_INVALID_PASSWORD\nTried to set the owner password to NULL. owner password and user password is the same." }
+     { HEX: 1013  "HPDF_ERR_UNKNOWN_CLASS\nInternal error. The consistency of the data was lost." }
+     { HEX: 1014  "HPDF_EXCEED_GSTATE_LIMIT\nThe depth of the stack exceeded HPDF_LIMIT_MAX_GSTATE." }
+     { HEX: 1015  "HPDF_FAILED_TO_ALLOC_MEM\nMemory allocation failed." }
+     { HEX: 1016  "HPDF_FILE_IO_ERROR\nFile processing failed. (A detailed code is set.)" }
+     { HEX: 1017  "HPDF_FILE_OPEN_ERROR\nCannot open a file. (A detailed code is set.)" }
+     { HEX: 1019  "HPDF_FONT_EXISTS\nTried to load a font that has already been registered." }
+     { HEX: 101A  "HPDF_FONT_INVALID_WIDTHS_TABLE\nThe format of a font-file is invalid . Internal error. The consistency of the data was lost." }
+     { HEX: 101B  "HPDF_INVALID_AFM_HEADER\nCannot recognize a header of an afm file." }
+     { HEX: 101C  "HPDF_INVALID_ANNOTATION\nThe specified annotation handle is invalid." }
+     { HEX: 101E  "HPDF_INVALID_BIT_PER_COMPONENT\nBit-per-component of a image which was set as mask-image is invalid." }
+     { HEX: 101F  "HPDF_INVALID_CHAR_MATRICS_DATA\nCannot recognize char-matrics-data  of an afm file." }
+     { HEX: 1020  "HPDF_INVALID_COLOR_SPACE\n1. The color_space parameter of HPDF_LoadRawImage is invalid.\n2. Color-space of a image which was set as mask-image is invalid.\n3. The function which is invalid in the present color-space was invoked." }
+     { HEX: 1021  "HPDF_INVALID_COMPRESSION_MODE\nInvalid value was set when invoking HPDF_SetCommpressionMode()." }
+     { HEX: 1022  "HPDF_INVALID_DATE_TIME\nAn invalid date-time value was set." }
+     { HEX: 1023  "HPDF_INVALID_DESTINATION\nAn invalid destination handle was set." }
+     { HEX: 1025  "HPDF_INVALID_DOCUMENT\nAn invalid document handle is set." }
+     { HEX: 1026  "HPDF_INVALID_DOCUMENT_STATE\nThe function which is invalid in the present state was invoked." }
+     { HEX: 1027  "HPDF_INVALID_ENCODER\nAn invalid encoder handle was set." }
+     { HEX: 1028  "HPDF_INVALID_ENCODER_TYPE\nA combination between font and encoder is wrong." }
+     { HEX: 102B  "HPDF_INVALID_ENCODING_NAME\nAn Invalid encoding name is specified." }
+     { HEX: 102C  "HPDF_INVALID_ENCRYPT_KEY_LEN\nThe lengh of the key of encryption is invalid." }
+     { HEX: 102D  "HPDF_INVALID_FONTDEF_DATA\n1. An invalid font handle was set.\n2. Unsupported font format." }
+     { HEX: 102E  "HPDF_INVALID_FONTDEF_TYPE\nInternal error. The consistency of the data was lost." }
+     { HEX: 102F  "HPDF_INVALID_FONT_NAME\nA font which has the specified name is not found." }
+     { HEX: 1030  "HPDF_INVALID_IMAGE\nUnsupported image format." }
+     { HEX: 1031  "HPDF_INVALID_JPEG_DATA\nUnsupported image format." }
+     { HEX: 1032  "HPDF_INVALID_N_DATA\nCannot read a postscript-name from an afm file." }
+     { HEX: 1033  "HPDF_INVALID_OBJECT\n1. An invalid object is set.\n2. Internal error. The consistency of the data was lost." }
+     { HEX: 1034  "HPDF_INVALID_OBJ_ID\nInternal error. The consistency of the data was lost." }
+     { HEX: 1035  "HPDF_INVALID_OPERATION\nInvoked HPDF_Image_SetColorMask() against the image-object which was set a mask-image." }
+     { HEX: 1036  "HPDF_INVALID_OUTLINE\nAn invalid outline-handle was specified." }
+     { HEX: 1037  "HPDF_INVALID_PAGE\nAn invalid page-handle was specified." }
+     { HEX: 1038  "HPDF_INVALID_PAGES\nAn invalid pages-handle was specified. (internal error)" }
+     { HEX: 1039  "HPDF_INVALID_PARAMETER\nAn invalid value is set." }
+     { HEX: 103B  "HPDF_INVALID_PNG_IMAGE\nInvalid PNG image format." }
+     { HEX: 103C  "HPDF_INVALID_STREAM\nInternal error. The consistency of the data was lost." }
+     { HEX: 103D  "HPDF_MISSING_FILE_NAME_ENTRY\nInternal error. The \"_FILE_NAME\" entry for delayed loading is missing." }
+     { HEX: 103F  "HPDF_INVALID_TTC_FILE\nInvalid .TTC file format." }
+     { HEX: 1040  "HPDF_INVALID_TTC_INDEX\nThe index parameter was exceed the number of included fonts" }
+     { HEX: 1041  "HPDF_INVALID_WX_DATA\nCannot read a width-data from an afm file." }
+     { HEX: 1042  "HPDF_ITEM_NOT_FOUND\nInternal error. The consistency of the data was lost." }
+     { HEX: 1043  "HPDF_LIBPNG_ERROR\nAn error has returned from PNGLIB while loading an image." }
+     { HEX: 1044  "HPDF_NAME_INVALID_VALUE\nInternal error. The consistency of the data was lost." }
+     { HEX: 1045  "HPDF_NAME_OUT_OF_RANGE\nInternal error. The consistency of the data was lost." }
+     { HEX: 1049  "HPDF_PAGES_MISSING_KIDS_ENTRY\nInternal error. The consistency of the data was lost." }
+     { HEX: 104A  "HPDF_PAGE_CANNOT_FIND_OBJECT\nInternal error. The consistency of the data was lost." }
+     { HEX: 104B  "HPDF_PAGE_CANNOT_GET_ROOT_PAGES\nInternal error. The consistency of the data was lost." }
+     { HEX: 104C  "HPDF_PAGE_CANNOT_RESTORE_GSTATE\nThere are no graphics-states to be restored." }
+     { HEX: 104D  "HPDF_PAGE_CANNOT_SET_PARENT\nInternal error. The consistency of the data was lost." }
+     { HEX: 104E  "HPDF_PAGE_FONT_NOT_FOUND\nThe current font is not set." }
+     { HEX: 104F  "HPDF_PAGE_INVALID_FONT\nAn invalid font-handle was specified." }
+     { HEX: 1050  "HPDF_PAGE_INVALID_FONT_SIZE\nAn invalid font-size was set." }
+     { HEX: 1051  "HPDF_PAGE_INVALID_GMODE\nSee Graphics mode." }
+     { HEX: 1052  "HPDF_PAGE_INVALID_INDEX\nInternal error. The consistency of the data was lost." }
+     { HEX: 1053  "HPDF_PAGE_INVALID_ROTATE_VALUE\nThe specified value is not a multiple of 90." }
+     { HEX: 1054  "HPDF_PAGE_INVALID_SIZE\nAn invalid page-size was set." }
+     { HEX: 1055  "HPDF_PAGE_INVALID_XOBJECT\nAn invalid image-handle was set." }
+     { HEX: 1056  "HPDF_PAGE_OUT_OF_RANGE\nThe specified value is out of range." }
+     { HEX: 1057  "HPDF_REAL_OUT_OF_RANGE\nThe specified value is out of range." }
+     { HEX: 1058  "HPDF_STREAM_EOF\nUnexpected EOF marker was detected." }
+     { HEX: 1059  "HPDF_STREAM_READLN_CONTINUE\nInternal error. The consistency of the data was lost." }
+     { HEX: 105B  "HPDF_STRING_OUT_OF_RANGE\nThe length of the specified text is too long." }
+     { HEX: 105C  "HPDF_THIS_FUNC_WAS_SKIPPED\nThe execution of a function was skipped because of other errors." }
+     { HEX: 105D  "HPDF_TTF_CANNOT_EMBEDDING_FONT\nThis font cannot be embedded. (restricted by license.)" }
+     { HEX: 105E  "HPDF_TTF_INVALID_CMAP\nUnsupported ttf format. (cannot find unicode cmap.)" }
+     { HEX: 105F  "HPDF_TTF_INVALID_FOMAT\nUnsupported ttf format." }
+     { HEX: 1060  "HPDF_TTF_MISSING_TABLE\nUnsupported ttf format. (cannot find a necessary table.)" }
+     { HEX: 1061  "HPDF_UNSUPPORTED_FONT_TYPE\nInternal error. The consistency of the data was lost." }
+     { HEX: 1062  "HPDF_UNSUPPORTED_FUNC\n1. The library is not configured to use PNGLIB.\n2. Internal error. The consistency of the data was lost." }
+     { HEX: 1063  "HPDF_UNSUPPORTED_JPEG_FORMAT\nUnsupported Jpeg format." }
+     { HEX: 1064  "HPDF_UNSUPPORTED_TYPE1_FONT\nFailed to parse .PFB file." }
+     { HEX: 1065  "HPDF_XREF_COUNT_ERR\nInternal error. The consistency of the data was lost." }
+     { HEX: 1066  "HPDF_ZLIB_ERROR\nAn error has occurred while executing a function of Zlib." }
+     { HEX: 1067  "HPDF_INVALID_PAGE_INDEX\nAn error returned from Zlib." }
+     { HEX: 1068  "HPDF_INVALID_URI\nAn invalid URI was set." }
+     { HEX: 1069  "HPDF_PAGELAYOUT_OUT_OF_RANGE\nAn invalid page-layout was set." }
+     { HEX: 1070  "HPDF_PAGEMODE_OUT_OF_RANGE\nAn invalid page-mode was set." }
+     { HEX: 1071  "HPDF_PAGENUM_STYLE_OUT_OF_RANGE\nAn invalid page-num-style was set." }
+     { HEX: 1072  "HPDF_ANNOT_INVALID_ICON\nAn invalid icon was set." }
+     { HEX: 1073  "HPDF_ANNOT_INVALID_BORDER_STYLE\nAn invalid border-style was set." }
+     { HEX: 1074  "HPDF_PAGE_INVALID_DIRECTION\nAn invalid page-direction was set." }
+     { HEX: 1075  "HPDF_INVALID_FONT\nAn invalid font-handle was specified." }
+} ;
+
+LIBRARY: libhpdf
+
+! ===============================================
+! hpdf.h
+! ===============================================
+
+FUNCTION: void* HPDF_New ( void* user_error_fn, void* user_data ) ;
+
+FUNCTION: void* HPDF_Free ( void* pdf ) ;
+
+FUNCTION: ulong HPDF_SetCompressionMode ( void* pdf, uint mode ) ;
+
+FUNCTION: ulong HPDF_SetPageMode ( void* pdf, uint mode ) ;
+
+FUNCTION: void* HPDF_AddPage ( void* pdf ) ;
+
+FUNCTION: ulong HPDF_SaveToFile ( void* pdf, char* file_name ) ;
+
+FUNCTION: float HPDF_Page_GetHeight ( void* page ) ;
+
+FUNCTION: float HPDF_Page_GetWidth ( void* page ) ;
+
+FUNCTION: ulong HPDF_Page_SetLineWidth ( void* page, float line_width ) ;
+
+FUNCTION: ulong HPDF_Page_Rectangle ( void* page, float x, float y,
+                                      float width, float height ) ;
+
+FUNCTION: ulong HPDF_Page_Stroke ( void* page ) ;
+
+FUNCTION: void* HPDF_GetFont ( void* pdf, char* font_name,
+                               char* encoding_name ) ;
+
+FUNCTION: ulong HPDF_Page_SetFontAndSize ( void* page, void* font,
+                                           float size ) ;
+
+FUNCTION: float HPDF_Page_TextWidth ( void* page, char* text ) ;
+
+FUNCTION: ulong HPDF_Page_BeginText ( void* page ) ;
+
+FUNCTION: ulong HPDF_Page_TextOut ( void* page, float xpos, float ypos,
+                                    char* text ) ;
+
+FUNCTION: ulong HPDF_Page_EndText ( void*  page ) ;
+
+FUNCTION: ulong HPDF_Page_MoveTextPos ( void* page, float x, float y ) ;
+
+FUNCTION: ulong HPDF_Page_ShowText ( void* page, char* text ) ;
diff --git a/extra/pdf/pdf-tests.factor b/extra/pdf/pdf-tests.factor
new file mode 100644 (file)
index 0000000..dc42874
--- /dev/null
@@ -0,0 +1,97 @@
+USING: io.files kernel math namespaces pdf pdf.libhpdf prettyprint sequences ;
+
+SYMBOL: font
+
+SYMBOL: width
+SYMBOL: height
+SYMBOL: twidth
+
+: font-list ( -- seq ) {
+    "Courier"
+    "Courier-Bold"
+    "Courier-Oblique"
+    "Courier-BoldOblique"
+    "Helvetica"
+    "Helvetica-Bold"
+    "Helvetica-Oblique"
+    "Helvetica-BoldOblique"
+    "Times-Roman"
+    "Times-Bold"
+    "Times-Italic"
+    "Times-BoldItalic"
+    "Symbol"
+    "ZapfDingbats"
+} ;
+
+[
+    ! HPDF_COMP_ALL set-compression-mode
+
+    ! HPDF_PAGE_MODE_USE_OUTLINE set-page-mode
+
+    ! Add a new page object
+    add-page
+
+    get-page-height height set
+
+    get-page-width width set
+
+    ! Print the lines of the page
+    1 set-page-line-width
+
+    50 50 width get 100 - height get 110 - page-rectangle
+
+    page-stroke
+
+    ! Print the title of the page (with positioning center)
+    "Helvetica" f get-font font set
+
+    font get 24 set-page-font-and-size
+
+    "Font Demo" page-text-width twidth set
+
+    [
+        width get twidth get - 2 / height get 50 - "Font Demo" page-text-out
+
+    ] with-text
+
+    ! Print subtitle
+    [
+        font get 16 set-page-font-and-size
+
+        60 height get 80 - "<Standard Type1 font samples>" page-text-out
+
+    ] with-text
+
+    ! Print font list
+    [
+        60 height get 105 - page-move-text-pos
+
+        SYMBOL: fontname
+
+        font-list [
+
+            fontname set
+
+            fontname get f get-font font set
+
+            ! print a label of text
+            font get 9 set-page-font-and-size
+
+            fontname get page-show-text
+
+            0 -18 page-move-text-pos
+
+            ! print a sample text
+            font get 20 set-page-font-and-size
+
+            "abcdefgABCDEFG12345!#$%&+-@?" page-show-text
+
+            0 -20 page-move-text-pos
+
+        ] each
+
+    ] with-text
+
+    "extra/pdf/test/font_test.pdf" resource-path save-to-file
+
+] with-pdf
diff --git a/extra/pdf/pdf.factor b/extra/pdf/pdf.factor
new file mode 100644 (file)
index 0000000..98c94e5
--- /dev/null
@@ -0,0 +1,97 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Tested with libharu2 2.0.8 on Mac OS X 10.4.9 PowerPC
+
+USING: assocs continuations hashtables kernel math namespaces pdf.libhpdf ;
+
+IN: pdf
+
+SYMBOL: pdf
+SYMBOL: page
+
+! =========================================================
+! Error handling routines
+! =========================================================
+
+: check-status ( status -- )
+    dup zero? [ 
+        drop
+    ] [
+        error-code >hashtable at throw   
+    ] if ;
+
+! =========================================================
+! Document handling routines
+! =========================================================
+
+: new-pdf ( error-handler user-data -- )
+    HPDF_New pdf set ;
+
+: free-pdf ( -- )
+    pdf get HPDF_Free drop ;
+
+: with-pdf ( quot -- )
+    [ f f new-pdf [ free-pdf ] [ ] cleanup ] with-scope ; inline
+
+: set-compression-mode ( mode -- )
+    pdf get swap HPDF_SetCompressionMode check-status ;
+
+: set-page-mode ( mode -- )
+    pdf get swap HPDF_SetPageMode check-status ;
+
+: add-page ( -- )
+    pdf get HPDF_AddPage page set ;
+
+: save-to-file ( filename -- )
+    pdf get swap HPDF_SaveToFile check-status ;
+
+: get-font ( fontname encoding -- font )
+    pdf get -rot HPDF_GetFont ;
+
+! =========================================================
+! Page Handling routines
+! =========================================================
+
+: get-page-height ( -- height )
+    page get HPDF_Page_GetHeight ;
+
+: get-page-width ( -- width )
+    page get HPDF_Page_GetWidth ;
+
+: page-text-width ( text -- width )
+    page get swap HPDF_Page_TextWidth ;
+
+! =========================================================
+! Graphics routines
+! =========================================================
+
+: set-page-line-width ( linewidth -- )
+    page get swap HPDF_Page_SetLineWidth check-status ;
+
+: page-rectangle ( x y width height -- )
+    >r >r >r >r page get r> r> r> r> HPDF_Page_Rectangle check-status ;
+
+: page-stroke ( -- )
+    page get HPDF_Page_Stroke check-status ;
+
+: set-page-font-and-size ( font size -- )
+    page get -rot HPDF_Page_SetFontAndSize check-status ;
+
+: page-begin-text ( -- )
+    page get HPDF_Page_BeginText check-status ;
+
+: page-text-out ( xpos ypos text -- )
+    page get -roll HPDF_Page_TextOut check-status ;
+
+: page-end-text ( -- )
+    page get HPDF_Page_EndText check-status ;
+
+: with-text ( -- )
+    [ page-begin-text [ page-end-text ] [ ] cleanup ] with-scope ; inline
+
+: page-move-text-pos ( x y -- )
+    page get -rot HPDF_Page_MoveTextPos check-status ;
+
+: page-show-text ( text -- )
+    page get swap HPDF_Page_ShowText check-status ;
diff --git a/extra/pdf/readme.txt b/extra/pdf/readme.txt
new file mode 100644 (file)
index 0000000..fd52944
--- /dev/null
@@ -0,0 +1,9 @@
+To build libharu as a shared dylib on Mac OS X, modify the Makefile after calling ./configure --shared\r\rHere are the relevant sections and the lines to be changed:\r\r...\rCC=cc\rPREFIX=/usr/local\r\rLIBNAME=libhpdf.a\rSONAME=libhpdf.dylib\rSOVER1=.1\rSOVER2=.0.0\rLIBTARGET=libhpdf.dylib\rCFLAGS=-Iinclude -fPIC -fno-common -c\r...\r$(SONAME): $(OBJS)\r$(CC) -dynamiclib -o $(SONAME)$(SOVER1)$(SOVER2) $(OBJS) $(LDFLAGS) -Wl\rln -sf $(SONAME)$(SOVER1)$(SOVER2) $(SONAME)$(SOVER1)\rln -sf $(SONAME)$(SOVER1) $(SONAME)
+
+Now you can build and install:
+
+make clean
+make
+make install
+
+Test PDF files from pdf-tests.factor are generated in the test folder.
\ No newline at end of file
diff --git a/extra/pdf/test/font_test.pdf b/extra/pdf/test/font_test.pdf
new file mode 100644 (file)
index 0000000..4360cf3
--- /dev/null
@@ -0,0 +1,300 @@
+%PDF-1.3
+%·¾­ª
+1 0 obj
+<<
+/Type /Catalog
+/Pages 2 0 R
+>>
+endobj
+2 0 obj
+<<
+/Type /Pages
+/Kids [ 4 0 R ]
+/Count 1
+>>
+endobj
+3 0 obj
+<<
+/Producer (Haru\040Free\040PDF\040Library\0402.0.8)
+>>
+endobj
+4 0 obj
+<<
+/Type /Page
+/MediaBox [ 0 0 595 841 ]
+/Contents 5 0 R
+/Resources <<
+/ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
+/Font <<
+/F1 7 0 R
+/F2 8 0 R
+/F3 9 0 R
+/F4 10 0 R
+/F5 11 0 R
+/F6 12 0 R
+/F7 13 0 R
+/F8 14 0 R
+/F9 15 0 R
+/F10 16 0 R
+/F11 17 0 R
+/F12 18 0 R
+/F13 19 0 R
+/F14 20 0 R
+>>
+>>
+/Parent 2 0 R
+>>
+endobj
+5 0 obj
+<<
+/Length 6 0 R
+>>
+stream\r
+1 w
+50 50 495 731 re
+S
+/F1 24 Tf
+BT
+238.148 791 Td
+(Font\040Demo) Tj
+ET
+BT
+/F1 16 Tf
+60 761 Td
+(\074Standard\040Type1\040font\040samples\076) Tj
+ET
+BT
+60 736 Td
+/F2 9 Tf
+(Courier) Tj
+0 -18 Td
+/F2 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F3 9 Tf
+(Courier-Bold) Tj
+0 -18 Td
+/F3 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F4 9 Tf
+(Courier-Oblique) Tj
+0 -18 Td
+/F4 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F5 9 Tf
+(Courier-BoldOblique) Tj
+0 -18 Td
+/F5 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F1 9 Tf
+(Helvetica) Tj
+0 -18 Td
+/F1 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F6 9 Tf
+(Helvetica-Bold) Tj
+0 -18 Td
+/F6 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F7 9 Tf
+(Helvetica-Oblique) Tj
+0 -18 Td
+/F7 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F8 9 Tf
+(Helvetica-BoldOblique) Tj
+0 -18 Td
+/F8 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F9 9 Tf
+(Times-Roman) Tj
+0 -18 Td
+/F9 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F10 9 Tf
+(Times-Bold) Tj
+0 -18 Td
+/F10 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F11 9 Tf
+(Times-Italic) Tj
+0 -18 Td
+/F11 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F12 9 Tf
+(Times-BoldItalic) Tj
+0 -18 Td
+/F12 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F13 9 Tf
+(Symbol) Tj
+0 -18 Td
+/F13 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+/F14 9 Tf
+(ZapfDingbats) Tj
+0 -18 Td
+/F14 20 Tf
+(abcdefgABCDEFG12345!\043$\045&+-@?) Tj
+0 -20 Td
+ET
+
+endstream
+endobj
+6 0 obj
+1517
+endobj
+7 0 obj
+<<
+/Type /Font
+/BaseFont /Helvetica
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+8 0 obj
+<<
+/Type /Font
+/BaseFont /Courier
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+9 0 obj
+<<
+/Type /Font
+/BaseFont /Courier-Bold
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+10 0 obj
+<<
+/Type /Font
+/BaseFont /Courier-Oblique
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+11 0 obj
+<<
+/Type /Font
+/BaseFont /Courier-BoldOblique
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+12 0 obj
+<<
+/Type /Font
+/BaseFont /Helvetica-Bold
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+13 0 obj
+<<
+/Type /Font
+/BaseFont /Helvetica-Oblique
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+14 0 obj
+<<
+/Type /Font
+/BaseFont /Helvetica-BoldOblique
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+15 0 obj
+<<
+/Type /Font
+/BaseFont /Times-Roman
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+16 0 obj
+<<
+/Type /Font
+/BaseFont /Times-Bold
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+17 0 obj
+<<
+/Type /Font
+/BaseFont /Times-Italic
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+18 0 obj
+<<
+/Type /Font
+/BaseFont /Times-BoldItalic
+/Subtype /Type1
+/Encoding /StandardEncoding
+>>
+endobj
+19 0 obj
+<<
+/Type /Font
+/BaseFont /Symbol
+/Subtype /Type1
+>>
+endobj
+20 0 obj
+<<
+/Type /Font
+/BaseFont /ZapfDingbats
+/Subtype /Type1
+>>
+endobj
+xref
+0 21
+0000000000 65535 f\r
+0000000015 00000 n\r
+0000000064 00000 n\r
+0000000123 00000 n\r
+0000000196 00000 n\r
+0000000518 00000 n\r
+0000002089 00000 n\r
+0000002109 00000 n\r
+0000002207 00000 n\r
+0000002303 00000 n\r
+0000002404 00000 n\r
+0000002509 00000 n\r
+0000002618 00000 n\r
+0000002722 00000 n\r
+0000002829 00000 n\r
+0000002940 00000 n\r
+0000003041 00000 n\r
+0000003141 00000 n\r
+0000003243 00000 n\r
+0000003349 00000 n\r
+0000003417 00000 n\r
+trailer
+<<
+/Root 1 0 R
+/Info 3 0 R
+/Size 21
+>>
+startxref
+3491
+%%EOF
diff --git a/extra/porter-stemmer/authors.txt b/extra/porter-stemmer/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/porter-stemmer/porter-stemmer-docs.factor b/extra/porter-stemmer/porter-stemmer-docs.factor
new file mode 100644 (file)
index 0000000..e16190f
--- /dev/null
@@ -0,0 +1,74 @@
+IN: porter-stemmer
+USING: help.markup help.syntax ;
+
+HELP: step1a
+{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $description "Gets rid of plurals." }
+{ $examples
+    { $table
+        { "Input:" "Output:" }
+        { "caresses" "caress" }
+        { "ponies" "poni" }
+        { "ties" "ti" }
+        { "caress" "caress" }
+        { "cats" "cat" }
+    }
+} ;
+
+HELP: step1b
+{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $description "Gets rid of \"-ed\" and \"-ing\" suffixes." }
+{ $examples
+    { $table
+        { "Input:" "Output:" }
+        { "feed"  "feed" }
+        { "agreed"  "agree" }
+        { "disabled"  "disable" }
+        { "matting"  "mat" }
+        { "mating"  "mate" }
+        { "meeting"  "meet" }
+        { "milling"  "mill" }
+        { "messing"  "mess" }
+        { "meetings"  "meet" }
+    }
+} ;
+
+HELP: step1c
+{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $description "Turns a terminal y to i when there is another vowel in the stem." } ;
+
+HELP: step2
+{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $description "Maps double suffices to single ones. so -ization maps to -ize etc. note that the string before the suffix must give positive " { $link consonant-seq } "." } ;
+
+HELP: step3
+{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $description "Deals with -c-, -full, -ness, etc. Similar strategy to " { $link step2 } "." } ;
+
+HELP: step5
+{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $description "Removes a final -e and changes a final -ll to -l if " { $link consonant-seq } " is greater than 1," } ;
+
+HELP: stem
+{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $description "Applies the Porter stemming algorithm to the input string." } ;
+
+ARTICLE: "porter-stemmer" "Porter stemming algorithm"
+"The help system uses the Porter stemming algorithm to normalize words when building the full-text search index."
+$nl
+"The Factor implementation of the algorithm is based on the Common Lisp version, which was hand-translated from ANSI C by Steven M. Haflich. The original ANSI C was written by Martin Porter."
+$nl
+"A detailed description of the algorithm, along with implementations in various languages, can be at in " { $url "http://www.tartarus.org/~martin/PorterStemmer" } "."
+$nl
+"The main word of the algorithm takes an English word as input and outputs its stem:"
+{ $subsection stem }
+"The algorithm consists of a number of steps:"
+{ $subsection step1a }
+{ $subsection step1b }
+{ $subsection step1c }
+{ $subsection step2 }
+{ $subsection step3 }
+{ $subsection step4 }
+{ $subsection step5 } ;
+
+ABOUT: "porter-stemmer"
diff --git a/extra/porter-stemmer/porter-stemmer-tests.factor b/extra/porter-stemmer/porter-stemmer-tests.factor
new file mode 100644 (file)
index 0000000..20050cc
--- /dev/null
@@ -0,0 +1,66 @@
+IN: temporary
+USING: arrays io kernel porter-stemmer sequences tools.test
+io.files ;
+
+[ 0 ] [ "xa" consonant-seq ] unit-test
+[ 0 ] [ "xxaa" consonant-seq ] unit-test
+[ 1 ] [ "xaxa" consonant-seq ] unit-test
+[ 2 ] [ "xaxaxa" consonant-seq ] unit-test
+[ 3 ] [ "xaxaxaxa" consonant-seq ] unit-test
+[ 3 ] [ "zzzzxaxaxaxaeee" consonant-seq ] unit-test
+
+[ t ] [ 0 "fish" consonant? ] unit-test
+[ f ] [ 0 "and" consonant? ] unit-test
+[ t ] [ 0 "yes" consonant? ] unit-test
+[ f ] [ 1 "gym" consonant? ] unit-test
+
+[ t ] [ 5 "splitting" double-consonant? ] unit-test
+[ f ] [ 2 "feel" double-consonant? ] unit-test
+
+[ f ] [ "xxxz" stem-vowel? ] unit-test
+[ t ] [ "baobab" stem-vowel? ] unit-test
+
+[ t ] [ "hop" cvc? ] unit-test
+[ t ] [ "cav" cvc? ] unit-test
+[ t ] [ "lov" cvc? ] unit-test
+[ t ] [ "crim" cvc? ] unit-test
+[ f ] [ "show" cvc? ] unit-test
+[ f ] [ "box" cvc? ] unit-test
+[ f ] [ "tray" cvc? ] unit-test
+[ f ] [ "meet" cvc? ] unit-test
+
+[ "caress" ] [ "caresses" step1a step1b "" like ] unit-test
+[ "poni" ] [ "ponies" step1a step1b "" like ] unit-test
+[ "ti" ] [ "ties" step1a step1b "" like ] unit-test
+[ "caress" ] [ "caress" step1a step1b "" like ] unit-test
+[ "cat" ] [ "cats" step1a step1b "" like ] unit-test
+[ "feed" ] [ "feed" step1a step1b "" like ] unit-test
+[ "agree" ] [ "agreed" step1a step1b "" like ] unit-test
+[ "disable" ] [ "disabled" step1a step1b "" like ] unit-test
+[ "mat" ] [ "matting" step1a step1b "" like ] unit-test
+[ "mate" ] [ "mating" step1a step1b "" like ] unit-test
+[ "meet" ] [ "meeting" step1a step1b "" like ] unit-test
+[ "mill" ] [ "milling" step1a step1b "" like ] unit-test
+[ "mess" ] [ "messing" step1a step1b "" like ] unit-test
+[ "meet" ] [ "meetings" step1a step1b "" like ] unit-test
+
+[ "fishi" ] [ "fishy" step1c ] unit-test
+[ "by" ] [ "by" step1c ] unit-test
+
+[ "realizat" ] [ "realization" step4 ] unit-test
+[ "ion" ] [ "ion" step4 ] unit-test
+[ "able" ] [ "able" step4 ] unit-test
+
+[ "fear" ] [ "feare" step5 "" like ] unit-test
+[ "mate" ] [ "mate" step5 "" like ] unit-test
+[ "hell" ] [ "hell" step5 "" like ] unit-test
+[ "mate" ] [ "mate" step5 "" like ] unit-test
+
+: resource-lines resource-path <file-reader> lines ;
+
+[ { } ] [
+    "extra/porter-stemmer/test/voc.txt" resource-lines
+    [ stem ] map
+    "extra/porter-stemmer/test/output.txt" resource-lines
+    [ 2array ] 2map [ first2 = not ] subset
+] unit-test
diff --git a/extra/porter-stemmer/porter-stemmer.factor b/extra/porter-stemmer/porter-stemmer.factor
new file mode 100644 (file)
index 0000000..fec3163
--- /dev/null
@@ -0,0 +1,221 @@
+IN: porter-stemmer
+USING: kernel math parser sequences combinators splitting ;
+
+: consonant? ( i str -- ? )
+    2dup nth dup "aeiou" member? [
+        3drop f
+    ] [
+        CHAR: y = [
+            over zero?
+            [ 2drop t ] [ >r 1- r> consonant? not ] if
+        ] [
+            2drop t
+        ] if
+    ] if ;
+
+: skip-vowels ( i str -- i str )
+    2dup bounds-check? [
+        2dup consonant? [ >r 1+ r> skip-vowels ] unless
+    ] when ;
+
+: skip-consonants ( i str -- i str )
+    2dup bounds-check? [
+        2dup consonant? [ >r 1+ r> skip-consonants ] when
+    ] when ;
+
+: (consonant-seq) ( n i str -- n )
+    skip-vowels
+    2dup bounds-check? [
+        >r 1+ >r 1+ r> r> skip-consonants >r 1+ r>
+        (consonant-seq)
+    ] [
+        2drop
+    ] if ;
+
+: consonant-seq ( str -- n )
+    0 0 rot skip-consonants (consonant-seq) ;
+
+: stem-vowel? ( str -- ? )
+    [ length ] keep [ consonant? ] curry all? not ;
+
+: double-consonant? ( i str -- ? )
+    over 1 < [
+        2drop f
+    ] [
+        2dup nth >r over 1- over nth r> = [
+            consonant?
+        ] [
+            2drop f
+        ] if
+    ] if ;
+
+: consonant-end? ( n seq -- ? )
+    [ length swap - ] keep consonant? ;
+
+: last-is? ( str possibilities -- ? ) >r peek r> member? ;
+
+: cvc? ( str -- ? )
+    {
+        { [ dup length 3 < ] [ drop f ] }
+        { [ 1 over consonant-end? not ] [ drop f ] }
+        { [ 2 over consonant-end? ] [ drop f ] }
+        { [ 3 over consonant-end? not ] [ drop f ] }
+        { [ t ] [ "wxy" last-is? not ] }
+    } cond ;
+
+: r ( str oldsuffix newsuffix -- str )
+    pick consonant-seq 0 > [ nip ] [ drop ] if append ;
+
+: butlast ( seq -- seq ) 1 head-slice* ;
+
+: step1a ( str -- newstr )
+    dup peek CHAR: s = [
+        {
+            { [ "sses" ?tail ] [ "ss" append ] }
+            { [ "ies" ?tail ] [ "i" append ] }
+            { [ dup "ss" tail? ] [ ] }
+            { [ "s" ?tail ] [ ] }
+            { [ t ] [ ] }
+        } cond
+    ] when ;
+
+: -eed ( str -- str )
+    dup consonant-seq 0 > "ee" "eed" ? append ;
+
+: -ed ( str -- str ? )
+    dup stem-vowel? [ [ "ed" append ] unless ] keep ;
+
+: -ing ( str -- str ? )
+    dup stem-vowel? [ [ "ing" append ] unless ] keep ;
+
+: -ed/ing ( str -- str )
+    {
+        { [ "at" ?tail ] [ "ate" append ] }
+        { [ "bl" ?tail ] [ "ble" append ] }
+        { [ "iz" ?tail ] [ "ize" append ] }
+        {
+            [ dup length 1- over double-consonant? ]
+            [ dup "lsz" last-is? [ butlast ] unless ]
+        }
+        {
+            [ t ]
+            [
+                dup consonant-seq 1 = over cvc? and
+                [ "e" append ] when
+            ]
+        }
+    } cond ;
+
+: step1b ( str -- newstr )
+    {
+        { [ "eed" ?tail ] [ -eed ] }
+        {
+            [
+                {
+                    { [ "ed" ?tail ] [ -ed ] }
+                    { [ "ing" ?tail ] [ -ing ] }
+                    { [ t ] [ f ] }
+                } cond
+            ] [ -ed/ing ]
+        }
+        { [ t ] [ ] }
+    } cond ;
+
+: step1c ( str -- newstr )
+    dup butlast stem-vowel? [
+        "y" ?tail [ "i" append ] when
+    ] when ;
+
+: step2 ( str -- newstr )
+    {
+        { [ "ational" ?tail ] [ "ational" "ate"  r ] }
+        { [ "tional"  ?tail ] [ "tional"  "tion" r ] }
+        { [ "enci"    ?tail ] [ "enci"    "ence" r ] }
+        { [ "anci"    ?tail ] [ "anci"    "ance" r ] }
+        { [ "izer"    ?tail ] [ "izer"    "ize"  r ] }
+        { [ "bli"     ?tail ] [ "bli"     "ble"  r ] }
+        { [ "alli"    ?tail ] [ "alli"    "al"   r ] }
+        { [ "entli"   ?tail ] [ "entli"   "ent"  r ] }
+        { [ "eli"     ?tail ] [ "eli"     "e"    r ] }
+        { [ "ousli"   ?tail ] [ "ousli"   "ous"  r ] }
+        { [ "ization" ?tail ] [ "ization" "ize"  r ] }
+        { [ "ation"   ?tail ] [ "ation"   "ate"  r ] }
+        { [ "ator"    ?tail ] [ "ator"    "ate"  r ] }
+        { [ "alism"   ?tail ] [ "alism"   "al"   r ] }
+        { [ "iveness" ?tail ] [ "iveness" "ive"  r ] }
+        { [ "fulness" ?tail ] [ "fulness" "ful"  r ] }
+        { [ "ousness" ?tail ] [ "ousness" "ous"  r ] }
+        { [ "aliti"   ?tail ] [ "aliti"   "al"   r ] }
+        { [ "iviti"   ?tail ] [ "iviti"   "ive"  r ] }
+        { [ "biliti"  ?tail ] [ "biliti"  "ble"  r ] }
+        { [ "logi"    ?tail ] [ "logi"    "log"  r ] }
+        { [ t ] [ ] }
+    } cond ;
+
+: step3 ( str -- newstr )
+    {
+        { [ "icate" ?tail ] [ "icate" "ic" r ] }
+        { [ "ative" ?tail ] [ "ative" ""   r ] }
+        { [ "alize" ?tail ] [ "alize" "al" r ] }
+        { [ "iciti" ?tail ] [ "iciti" "ic" r ] }
+        { [ "ical"  ?tail ] [ "ical"  "ic" r ] }
+        { [ "ful"   ?tail ] [ "ful"   ""   r ] }
+        { [ "ness"  ?tail ] [ "ness"  ""   r ] }
+        { [ t ] [ ] }
+    } cond ;
+
+: -ion ( str -- newstr )
+    dup empty? [
+        drop "ion"
+    ] [
+        dup "st" last-is? [ "ion" append ] unless
+    ] if ;
+
+: step4 ( str -- newstr )
+    dup {
+        { [ "al"    ?tail ] [ ] }
+        { [ "ance"  ?tail ] [ ] }
+        { [ "ence"  ?tail ] [ ] }
+        { [ "er"    ?tail ] [ ] }
+        { [ "ic"    ?tail ] [ ] }
+        { [ "able"  ?tail ] [ ] }
+        { [ "ible"  ?tail ] [ ] }
+        { [ "ant"   ?tail ] [ ] }
+        { [ "ement" ?tail ] [ ] }
+        { [ "ment"  ?tail ] [ ] }
+        { [ "ent"   ?tail ] [ ] }
+        { [ "ion"   ?tail ] [ -ion ] }
+        { [ "ou"    ?tail ] [ ] }
+        { [ "ism"   ?tail ] [ ] }
+        { [ "ate"   ?tail ] [ ] }
+        { [ "iti"   ?tail ] [ ] }
+        { [ "ous"   ?tail ] [ ] }
+        { [ "ive"   ?tail ] [ ] }
+        { [ "ize"   ?tail ] [ ] }
+        { [ t ] [ ] }
+    } cond dup consonant-seq 1 > [ nip ] [ drop ] if ;
+
+: remove-e? ( str -- ? )
+    dup consonant-seq dup 1 >
+    [ 2drop t ]
+    [ 1 = [ butlast cvc? not ] [ drop f ] if ] if ;
+
+: remove-e ( str -- newstr )
+    dup peek CHAR: e = [
+        dup remove-e? [ butlast ] when
+    ] when ;
+
+: ll->l ( str -- newstr )
+    {
+        { [ dup peek CHAR: l = not ] [ ] }
+        { [ dup length 1- over double-consonant? not ] [ ] }
+        { [ dup consonant-seq 1 > ] [ butlast ] }
+        { [ t ] [ ] }
+    } cond ;
+
+: step5 ( str -- newstr ) remove-e ll->l ;
+
+: stem ( str -- newstr )
+    dup length 2 <= [
+        step1a step1b step1c step2 step3 step4 step5 "" like
+    ] unless ;
diff --git a/extra/porter-stemmer/summary.txt b/extra/porter-stemmer/summary.txt
new file mode 100644 (file)
index 0000000..dd7746b
--- /dev/null
@@ -0,0 +1 @@
+Porter stemming algorithm
diff --git a/extra/porter-stemmer/test/output.txt b/extra/porter-stemmer/test/output.txt
new file mode 100644 (file)
index 0000000..595cb67
--- /dev/null
@@ -0,0 +1,23531 @@
+a
+aaron
+abaissiez
+abandon
+abandon
+abas
+abash
+abat
+abat
+abat
+abat
+abat
+abbess
+abbei
+abbei
+abbomin
+abbot
+abbot
+abbrevi
+ab
+abel
+aberga
+abergavenni
+abet
+abet
+abhomin
+abhor
+abhorr
+abhor
+abhor
+abhor
+abhorson
+abid
+abid
+abil
+abil
+abject
+abjectli
+abject
+abjur
+abjur
+abl
+abler
+aboard
+abod
+abod
+abod
+abod
+abomin
+abomin
+abomin
+abort
+abort
+abound
+abound
+about
+abov
+abr
+abraham
+abram
+abreast
+abridg
+abridg
+abridg
+abridg
+abroach
+abroad
+abrog
+abrook
+abrupt
+abrupt
+abruptli
+absenc
+absent
+absei
+absolut
+absolut
+absolv
+absolv
+abstain
+abstemi
+abstin
+abstract
+absurd
+absyrtu
+abund
+abund
+abundantli
+abu
+abus
+abus
+abus
+abus
+abus
+abut
+abi
+abysm
+ac
+academ
+academ
+accent
+accent
+accept
+accept
+accept
+accept
+accept
+access
+accessari
+access
+accid
+accid
+accident
+accident
+accid
+accit
+accit
+accit
+acclam
+accommod
+accommod
+accommod
+accommod
+accommodo
+accompani
+accompani
+accompani
+accomplic
+accomplish
+accomplish
+accomplish
+accomplish
+accompt
+accord
+accord
+accord
+accordeth
+accord
+accordingli
+accord
+accost
+accost
+account
+account
+account
+account
+accoutr
+accoutr
+accoutr
+accru
+accumul
+accumul
+accumul
+accur
+accurs
+accurst
+accu
+accus
+accus
+accus
+accusativo
+accus
+accus
+accus
+accus
+accus
+accuseth
+accus
+accustom
+accustom
+ac
+acerb
+ach
+acheron
+ach
+achiev
+achiev
+achiev
+achiev
+achiev
+achiev
+achiev
+achiev
+achil
+ach
+achitophel
+acknowledg
+acknowledg
+acknowledg
+acknowledg
+acknown
+acold
+aconitum
+acordo
+acorn
+acquaint
+acquaint
+acquaint
+acquaint
+acquir
+acquir
+acquisit
+acquit
+acquitt
+acquitt
+acquit
+acr
+acr
+across
+act
+actaeon
+act
+act
+action
+action
+actium
+activ
+activ
+activ
+actor
+actor
+act
+actual
+actur
+acut
+acut
+ad
+adag
+adalla
+adam
+adam
+add
+ad
+adder
+adder
+addeth
+addict
+addict
+addict
+ad
+addit
+addit
+addl
+address
+address
+addrest
+add
+adher
+adher
+adieu
+adieu
+adjac
+adjoin
+adjoin
+adjourn
+adjudg
+adjudg
+adjunct
+administ
+administr
+admir
+admir
+admir
+admir
+admir
+admir
+admir
+admir
+admiringli
+admiss
+admit
+admit
+admitt
+admit
+admit
+admonish
+admonish
+admonish
+admonish
+admonit
+ado
+adoni
+adopt
+adopt
+adoptedli
+adopt
+adopti
+adopt
+ador
+ador
+ador
+ador
+ador
+ador
+adorest
+adoreth
+ador
+adorn
+adorn
+adorn
+adorn
+adorn
+adown
+adramadio
+adrian
+adriana
+adriano
+adriat
+adsum
+adul
+adulter
+adulter
+adulter
+adulteress
+adulteri
+adulter
+adulteri
+adultress
+advanc
+advanc
+advanc
+advanc
+advanc
+advanc
+advanc
+advantag
+advantag
+advantag
+advantag
+advantag
+advantag
+advent
+adventur
+adventur
+adventur
+adventur
+adventur
+adventur
+adversari
+adversari
+advers
+advers
+advers
+advers
+adverti
+advertis
+advertis
+advertis
+advertis
+advic
+advi
+advis
+advis
+advisedli
+advis
+advis
+advoc
+advoc
+aeacida
+aeacid
+aedil
+aedil
+aegeon
+aegion
+aegl
+aemelia
+aemilia
+aemiliu
+aenea
+aeolu
+aer
+aerial
+aeri
+aesculapiu
+aeson
+aesop
+aetna
+afar
+afear
+afeard
+affabl
+affabl
+affair
+affair
+affair
+affect
+affect
+affect
+affect
+affectedli
+affecteth
+affect
+affect
+affection
+affection
+affect
+affect
+affeer
+affianc
+affianc
+affianc
+affi
+affin
+affin
+affin
+affirm
+affirm
+affirm
+afflict
+afflict
+afflict
+afflict
+afflict
+afford
+affordeth
+afford
+affrai
+affright
+affright
+affright
+affront
+affront
+affi
+afield
+afir
+afloat
+afoot
+afor
+aforehand
+aforesaid
+afraid
+afresh
+afric
+africa
+african
+afront
+after
+afternoon
+afterward
+afterward
+ag
+again
+against
+agamemmon
+agamemnon
+agat
+agaz
+ag
+ag
+agenor
+agent
+agent
+ag
+aggrav
+aggrief
+agil
+agincourt
+agit
+aglet
+agniz
+ago
+agon
+agoni
+agre
+agre
+agre
+agreement
+agre
+agrippa
+aground
+agu
+aguecheek
+agu
+aguefac
+agu
+ah
+aha
+ahungri
+ai
+aialvolio
+aiaria
+aid
+aidanc
+aidant
+aid
+aid
+aidless
+aid
+ail
+aim
+aim
+aimest
+aim
+aim
+ainsi
+aio
+air
+air
+airless
+air
+airi
+ajax
+akil
+al
+alabast
+alack
+alacr
+alarbu
+alarm
+alarm
+alarum
+alarum
+ala
+alb
+alban
+alban
+albani
+albeit
+albion
+alchemist
+alchemi
+alcibiad
+alcid
+alder
+alderman
+aldermen
+al
+alecto
+alehous
+alehous
+alencon
+alengon
+aleppo
+al
+alewif
+alexand
+alexand
+alexandria
+alexandrian
+alexa
+alia
+alic
+alien
+aliena
+alight
+alight
+alight
+alii
+alik
+alisand
+aliv
+all
+alla
+allai
+allai
+allai
+allay
+allay
+allai
+alleg
+alleg
+alleg
+alleg
+allegi
+allegi
+allei
+allei
+allhallowma
+allianc
+allicholi
+alli
+alli
+allig
+allig
+allon
+allot
+allot
+allot
+allotteri
+allow
+allow
+allow
+allow
+allow
+allur
+allur
+allur
+allur
+allus
+alli
+allycholli
+almain
+almanac
+almanack
+almanac
+almighti
+almond
+almost
+alm
+almsman
+alo
+aloft
+alon
+along
+alonso
+aloof
+aloud
+alphabet
+alphabet
+alphonso
+alp
+alreadi
+also
+alt
+altar
+altar
+alter
+alter
+alter
+alter
+althaea
+although
+altitud
+altogeth
+alton
+alwai
+alwai
+am
+amaimon
+amain
+amak
+amamon
+amaz
+amaz
+amaz
+amazedli
+amazed
+amaz
+amaz
+amazeth
+amaz
+amazon
+amazonian
+amazon
+ambassador
+ambassador
+amber
+ambiguid
+ambigu
+ambigu
+ambit
+ambit
+ambiti
+ambiti
+ambl
+ambl
+ambl
+ambl
+ambo
+ambuscado
+ambush
+amen
+amend
+amend
+amend
+amend
+amerc
+america
+am
+amiabl
+amid
+amidst
+amien
+ami
+amiss
+amiti
+amiti
+amnipot
+among
+amongst
+amor
+amor
+amort
+amount
+amount
+amour
+amphimacu
+ampl
+ampler
+amplest
+amplifi
+amplifi
+ampli
+ampthil
+amurath
+amynta
+an
+anatomiz
+anatom
+anatomi
+ancestor
+ancestor
+ancestri
+anchis
+anchor
+anchorag
+anchor
+anchor
+anchor
+anchovi
+ancient
+ancientri
+ancient
+ancu
+and
+andiron
+andpholu
+andren
+andrew
+andromach
+andronici
+andronicu
+anew
+ang
+angel
+angelica
+angel
+angelo
+angel
+anger
+angerli
+anger
+ang
+angier
+angl
+anglai
+angl
+angler
+angleterr
+anglia
+angl
+anglish
+angrili
+angri
+anguish
+angu
+anim
+anim
+animi
+anjou
+ankl
+anna
+annal
+ann
+annex
+annex
+annexion
+annex
+annothan
+announc
+annoi
+annoy
+annoi
+annual
+anoint
+anoint
+anon
+anoth
+anselmo
+answer
+answer
+answer
+answerest
+answer
+answer
+ant
+ant
+antenor
+antenorid
+anteroom
+anthem
+anthem
+anthoni
+anthropophagi
+anthropophaginian
+antiat
+antic
+anticip
+anticip
+anticipatest
+anticip
+anticip
+antick
+anticli
+antic
+antidot
+antidot
+antigonu
+antiopa
+antipathi
+antipholu
+antipholus
+antipod
+antiquari
+antiqu
+antiqu
+antium
+antoniad
+antonio
+antoniu
+antoni
+antr
+anvil
+ani
+anybodi
+anyon
+anyth
+anywher
+ap
+apac
+apart
+apart
+apart
+ap
+apemantu
+apennin
+ap
+apiec
+apish
+apollinem
+apollo
+apollodoru
+apolog
+apoplex
+apoplexi
+apostl
+apostl
+apostropha
+apoth
+apothecari
+appal
+appal
+appal
+appal
+apparel
+apparel
+apparel
+appar
+appar
+apparit
+apparit
+appeach
+appeal
+appeal
+appear
+appear
+appear
+appeareth
+appear
+appear
+appea
+appeas
+appeas
+appel
+appel
+appele
+appel
+appelez
+appel
+appel
+appelon
+appendix
+apperil
+appertain
+appertain
+appertain
+appertain
+appertin
+appertin
+appetit
+appetit
+applaud
+applaud
+applaud
+applaus
+applaus
+appl
+appl
+appletart
+applianc
+applianc
+applic
+appli
+appli
+appli
+appli
+appoint
+appoint
+appoint
+appoint
+appoint
+apprehend
+apprehend
+apprehend
+apprehens
+apprehens
+apprehens
+apprendr
+apprenn
+apprenticehood
+appri
+approach
+approach
+approach
+approacheth
+approach
+approb
+approof
+appropri
+approv
+approv
+approv
+approv
+approv
+appurten
+appurten
+apricock
+april
+apron
+apron
+apt
+apter
+aptest
+aptli
+apt
+aqua
+aquilon
+aquitain
+arabia
+arabian
+arais
+arbitr
+arbitr
+arbitr
+arbitr
+arbor
+arbour
+arc
+arch
+archbishop
+archbishopr
+archdeacon
+arch
+archelau
+archer
+archer
+archeri
+archibald
+archidamu
+architect
+arcu
+ard
+arden
+ardent
+ardour
+ar
+argal
+argier
+argo
+argosi
+argosi
+argu
+argu
+argu
+argu
+argu
+argument
+argument
+argu
+ariachn
+ariadn
+ariel
+ari
+aright
+arinado
+arini
+arion
+aris
+aris
+ariseth
+aris
+aristod
+aristotl
+arithmet
+arithmetician
+ark
+arm
+arma
+armado
+armado
+armagnac
+arm
+arm
+armenia
+armi
+armigero
+arm
+armipot
+armor
+armour
+armour
+armour
+armour
+armouri
+arm
+armi
+arn
+aroint
+aros
+arous
+arous
+arragon
+arraign
+arraign
+arraign
+arraign
+arrant
+arra
+arrai
+arrearag
+arrest
+arrest
+arrest
+arriv
+arriv
+arriv
+arriv
+arriv
+arriv
+arriv
+arrog
+arrog
+arrog
+arrow
+arrow
+art
+artemidoru
+arteri
+arthur
+articl
+articl
+articul
+artific
+artifici
+artilleri
+artir
+artist
+artist
+artless
+artoi
+art
+artu
+arviragu
+as
+asaph
+ascaniu
+ascend
+ascend
+ascendeth
+ascend
+ascens
+ascent
+ascrib
+ascrib
+ash
+asham
+asham
+asher
+ash
+ashford
+ashor
+ashout
+ashi
+asia
+asid
+ask
+askanc
+ask
+asker
+asketh
+ask
+ask
+aslant
+asleep
+asmath
+asp
+aspect
+aspect
+aspen
+aspers
+aspic
+aspici
+aspic
+aspir
+aspir
+aspir
+aspir
+asquint
+ass
+assail
+assail
+assail
+assail
+assail
+assaileth
+assail
+assail
+assassin
+assault
+assault
+assault
+assai
+assai
+assai
+assembl
+assembl
+assembl
+assembl
+assembl
+assent
+ass
+assez
+assign
+assign
+assign
+assinico
+assist
+assist
+assist
+assist
+assist
+assist
+assist
+associ
+associ
+associ
+assuag
+assubjug
+assum
+assum
+assum
+assumpt
+assur
+assur
+assur
+assur
+assuredli
+assur
+assyrian
+astonish
+astonish
+astraea
+astrai
+astrea
+astronom
+astronom
+astronom
+astronomi
+asund
+at
+atalanta
+at
+at
+athenian
+athenian
+athen
+athol
+athversari
+athwart
+atla
+atomi
+atomi
+aton
+aton
+aton
+atropo
+attach
+attach
+attach
+attain
+attaind
+attain
+attaint
+attaint
+attaintur
+attempt
+attempt
+attempt
+attempt
+attempt
+attend
+attend
+attend
+attend
+attend
+attend
+attendeth
+attend
+attend
+attent
+attent
+attent
+attentiven
+attest
+attest
+attir
+attir
+attir
+attir
+attornei
+attornei
+attornei
+attorneyship
+attract
+attract
+attract
+attract
+attribut
+attribut
+attribut
+attribut
+attribut
+atwain
+au
+aubrei
+auburn
+aucun
+audaci
+audaci
+audac
+audibl
+audienc
+audi
+audit
+auditor
+auditor
+auditori
+audr
+audrei
+aufidiu
+aufidius
+auger
+aught
+augment
+augment
+augment
+augment
+augur
+augur
+augur
+augur
+augur
+auguri
+august
+augustu
+auld
+aumerl
+aunchient
+aunt
+aunt
+auricular
+aurora
+auspici
+aussi
+auster
+auster
+auster
+auster
+austria
+aut
+authent
+author
+author
+author
+author
+author
+author
+autolycu
+autr
+autumn
+auvergn
+avail
+avail
+avaric
+avarici
+avaunt
+av
+aveng
+aveng
+aveng
+aver
+avert
+av
+avez
+avi
+avoid
+avoid
+avoid
+avoid
+avoirdupoi
+avouch
+avouch
+avouch
+avouch
+avow
+aw
+await
+await
+awak
+awak
+awak
+awaken
+awaken
+awaken
+awak
+awak
+award
+award
+awasi
+awai
+aw
+aweari
+aweless
+aw
+awhil
+awkward
+awl
+awoo
+awork
+awri
+ax
+axl
+axletre
+ay
+ay
+ayez
+ayli
+azur
+azur
+b
+ba
+baa
+babbl
+babbl
+babbl
+babe
+babe
+babi
+baboon
+baboon
+babi
+babylon
+bacar
+bacchan
+bacchu
+bach
+bachelor
+bachelor
+back
+backbit
+backbitten
+back
+back
+backward
+backwardli
+backward
+bacon
+bacon
+bad
+bade
+badg
+badg
+badg
+badli
+bad
+bae
+baffl
+baffl
+baffl
+bag
+baggag
+bagot
+bagpip
+bag
+bail
+bailiff
+baillez
+baili
+baisant
+baise
+baiser
+bait
+bait
+bait
+bait
+bait
+bajazet
+bak
+bake
+bake
+baker
+baker
+bake
+bake
+bal
+balanc
+balanc
+balconi
+bald
+baldrick
+bale
+bale
+balk
+ball
+ballad
+ballad
+ballast
+ballast
+ballet
+ballow
+ball
+balm
+balm
+balmi
+balsam
+balsamum
+balth
+balthasar
+balthazar
+bame
+ban
+banburi
+band
+bandi
+band
+bandit
+banditti
+banditto
+band
+bandi
+bandi
+bane
+bane
+bang
+bangor
+banish
+banish
+banish
+banish
+banist
+bank
+bankrout
+bankrupt
+bankrupt
+bank
+banner
+banneret
+banner
+ban
+bann
+banquet
+banquet
+banquet
+banquet
+banquo
+ban
+baptism
+baptista
+baptiz
+bar
+barbarian
+barbarian
+barbar
+barbar
+barbari
+barbason
+barb
+barber
+barbermong
+bard
+bardolph
+bard
+bare
+bare
+barefac
+barefac
+barefoot
+barehead
+bare
+bare
+bar
+bargain
+bargain
+barg
+bargulu
+bare
+bark
+bark
+barkloughli
+bark
+barki
+barlei
+barm
+barn
+barnacl
+barnardin
+barn
+barn
+barnet
+barn
+baron
+baron
+baroni
+barr
+barraba
+barrel
+barrel
+barren
+barrenli
+barren
+barricado
+barricado
+barrow
+bar
+barson
+barter
+bartholomew
+ba
+basan
+base
+baseless
+base
+base
+baser
+base
+basest
+bash
+bash
+basilisco
+basilisk
+basilisk
+basimecu
+basin
+basingstok
+basin
+basi
+bask
+basket
+basket
+bass
+bassanio
+basset
+bassianu
+basta
+bastard
+bastard
+bastardli
+bastard
+bastardi
+bast
+bast
+bastinado
+bast
+bat
+batail
+batch
+bate
+bate
+bate
+bath
+bath
+bath
+bath
+bath
+bate
+batler
+bat
+batt
+battalia
+battalion
+batten
+batter
+batter
+batter
+batteri
+battl
+battl
+battlefield
+battlement
+battl
+batti
+baubl
+baubl
+baubl
+baulk
+bavin
+bawcock
+bawd
+bawdri
+bawd
+bawdi
+bawl
+bawl
+bai
+bai
+baynard
+bayonn
+bai
+be
+beach
+beach
+beachi
+beacon
+bead
+bead
+beadl
+beadl
+bead
+beadsmen
+beagl
+beagl
+beak
+beak
+beam
+beam
+beam
+bean
+bean
+bear
+beard
+beard
+beardless
+beard
+bearer
+bearer
+bearest
+beareth
+bear
+bear
+beast
+beastliest
+beastli
+beastli
+beast
+beat
+beat
+beaten
+beat
+beatric
+beat
+beau
+beaufort
+beaumond
+beaumont
+beauteou
+beauti
+beauti
+beautifi
+beauti
+beautifi
+beauti
+beaver
+beaver
+becam
+becaus
+bechanc
+bechanc
+bechanc
+beck
+beckon
+beckon
+beck
+becom
+becom
+becom
+becom
+becom
+becom
+bed
+bedabbl
+bedash
+bedaub
+bedazzl
+bedchamb
+bedcloth
+bed
+bedeck
+bedeck
+bedew
+bedfellow
+bedfellow
+bedford
+bedlam
+bedrench
+bedrid
+bed
+bedtim
+bedward
+bee
+beef
+beef
+beehiv
+been
+beer
+bee
+beest
+beetl
+beetl
+beev
+befal
+befallen
+befal
+befel
+befit
+befit
+befit
+befor
+befor
+beforehand
+befortun
+befriend
+befriend
+befriend
+beg
+began
+beget
+beget
+beget
+begg
+beggar
+beggar
+beggarli
+beggarman
+beggar
+beggari
+beg
+begin
+beginn
+begin
+begin
+begin
+begnawn
+begon
+begot
+begotten
+begrim
+beg
+beguil
+beguil
+beguil
+beguil
+beguil
+begun
+behalf
+behalf
+behav
+behav
+behavedst
+behavior
+behavior
+behaviour
+behaviour
+behead
+behead
+beheld
+behest
+behest
+behind
+behold
+behold
+behold
+beholdest
+behold
+behold
+behoof
+behoofful
+behoov
+behov
+behov
+behowl
+be
+bel
+belariu
+belch
+belch
+beldam
+beldam
+beldam
+bele
+belgia
+beli
+beli
+belief
+beliest
+believ
+believ
+believ
+believ
+believest
+believ
+belik
+bell
+bellario
+bell
+belli
+belli
+bellman
+bellona
+bellow
+bellow
+bellow
+bellow
+bell
+belli
+belly
+belman
+belmont
+belock
+belong
+belong
+belong
+belong
+belov
+belov
+belov
+below
+belt
+belzebub
+bemad
+bemet
+bemet
+bemoan
+bemoan
+bemock
+bemoil
+bemonst
+ben
+bench
+bencher
+bench
+bend
+bend
+bend
+bend
+bene
+beneath
+benedicit
+benedick
+benedict
+benedictu
+benefactor
+benefic
+benefici
+benefit
+benefit
+benefit
+benet
+benevol
+benevol
+beni
+benison
+bennet
+bent
+bentii
+bentivolii
+bent
+benumb
+benvolio
+bepaint
+beprai
+bequeath
+bequeath
+bequeath
+bequest
+ber
+berard
+berattl
+berai
+bere
+bereav
+bereav
+bereav
+bereft
+bergamo
+bergomask
+berhym
+berhym
+berkelei
+bermooth
+bernardo
+berod
+berown
+berri
+berri
+berrord
+berri
+bertram
+berwick
+bescreen
+beseech
+beseech
+beseech
+beseech
+beseek
+beseem
+beseemeth
+beseem
+beseem
+beset
+beshrew
+besid
+besid
+besieg
+besieg
+besieg
+beslubb
+besmear
+besmear
+besmirch
+besom
+besort
+besot
+bespak
+bespeak
+bespic
+bespok
+bespot
+bess
+bessi
+best
+bestain
+best
+bestial
+bestir
+bestirr
+bestow
+bestow
+bestow
+bestow
+bestraught
+bestrew
+bestrid
+bestrid
+bestrid
+bet
+betak
+beteem
+bethink
+bethought
+bethroth
+bethump
+betid
+betid
+betideth
+betim
+betim
+betoken
+betook
+betoss
+betrai
+betrai
+betrai
+betrai
+betrim
+betroth
+betroth
+betroth
+bett
+bet
+better
+better
+better
+better
+bet
+bettr
+between
+betwixt
+bevel
+beverag
+bevi
+bevi
+bewail
+bewail
+bewail
+bewail
+bewar
+bewast
+beweep
+bewept
+bewet
+bewhor
+bewitch
+bewitch
+bewitch
+bewrai
+beyond
+bezonian
+bezonian
+bianca
+bianco
+bia
+bibbl
+bicker
+bid
+bidden
+bid
+bid
+biddi
+bide
+bide
+bide
+bid
+bien
+bier
+bifold
+big
+bigami
+biggen
+bigger
+big
+bigot
+bilberri
+bilbo
+bilbo
+bilbow
+bill
+billet
+billet
+billiard
+bill
+billow
+billow
+bill
+bin
+bind
+bindeth
+bind
+bind
+biondello
+birch
+bird
+bird
+birdlim
+bird
+birnam
+birth
+birthdai
+birthdom
+birthplac
+birthright
+birthright
+birth
+bi
+biscuit
+bishop
+bishop
+bisson
+bit
+bitch
+bite
+biter
+bite
+bite
+bit
+bitt
+bitten
+bitter
+bitterest
+bitterli
+bitter
+blab
+blabb
+blab
+blab
+black
+blackamoor
+blackamoor
+blackberri
+blackberri
+blacker
+blackest
+blackfriar
+blackheath
+blackmer
+black
+black
+bladder
+bladder
+blade
+blade
+blade
+blain
+blam
+blame
+blame
+blame
+blameless
+blame
+blanc
+blanca
+blanch
+blank
+blanket
+blank
+blasphem
+blasphem
+blasphem
+blasphemi
+blast
+blast
+blast
+blastment
+blast
+blaz
+blaze
+blaze
+blaze
+blazon
+blazon
+blazon
+bleach
+bleach
+bleak
+blear
+blear
+bleat
+bleat
+bleat
+bled
+bleed
+bleedest
+bleedeth
+bleed
+bleed
+blemish
+blemish
+blench
+blench
+blend
+blend
+blent
+bless
+bless
+blessedli
+blessed
+bless
+blesseth
+bless
+bless
+blest
+blew
+blind
+blind
+blindfold
+blind
+blindli
+blind
+blind
+blink
+blink
+bliss
+blist
+blister
+blister
+blith
+blithild
+bloat
+block
+blockish
+block
+bloi
+blood
+blood
+bloodhound
+bloodi
+bloodier
+bloodiest
+bloodili
+bloodless
+blood
+bloodsh
+bloodshed
+bloodstain
+bloodi
+bloom
+bloom
+blossom
+blossom
+blossom
+blot
+blot
+blot
+blot
+blount
+blow
+blow
+blower
+blowest
+blow
+blown
+blow
+blows
+blubb
+blubber
+blubber
+blue
+bluecap
+bluest
+blunt
+blunt
+blunter
+bluntest
+blunt
+bluntli
+blunt
+blunt
+blur
+blurr
+blur
+blush
+blush
+blushest
+blush
+blust
+bluster
+bluster
+bluster
+bo
+boar
+board
+board
+board
+board
+boarish
+boar
+boast
+boast
+boast
+boast
+boast
+boat
+boat
+boatswain
+bob
+bobb
+boblibindo
+bobtail
+bocchu
+bode
+bode
+bodement
+bode
+bodg
+bodi
+bodi
+bodiless
+bodili
+bode
+bodkin
+bodi
+bodykin
+bog
+boggl
+boggler
+bog
+bohemia
+bohemian
+bohun
+boil
+boil
+boil
+boist
+boister
+boister
+boitier
+bold
+bolden
+bolder
+boldest
+boldli
+bold
+bold
+bolingbrok
+bolster
+bolt
+bolt
+bolter
+bolter
+bolt
+bolt
+bombard
+bombard
+bombast
+bon
+bona
+bond
+bondag
+bond
+bondmaid
+bondman
+bondmen
+bond
+bondslav
+bone
+boneless
+bone
+bonfir
+bonfir
+bonjour
+bonn
+bonnet
+bonnet
+bonni
+bono
+bonto
+bonvil
+bood
+book
+bookish
+book
+boon
+boor
+boorish
+boor
+boot
+boot
+booti
+bootless
+boot
+booti
+bor
+bora
+borachio
+bordeaux
+border
+border
+border
+border
+bore
+borea
+bore
+bore
+born
+born
+borough
+borough
+borrow
+borrow
+borrow
+borrow
+borrow
+bosko
+bosko
+boski
+bosom
+bosom
+boson
+boss
+bosworth
+botch
+botcher
+botch
+botchi
+both
+bot
+bottl
+bottl
+bottl
+bottom
+bottomless
+bottom
+bouciqualt
+boug
+bough
+bough
+bought
+bounc
+bounc
+bound
+bound
+bounden
+boundeth
+bound
+boundless
+bound
+bounteou
+bounteous
+bounti
+bounti
+bountifulli
+bounti
+bourbier
+bourbon
+bourchier
+bourdeaux
+bourn
+bout
+bout
+bove
+bow
+bowcas
+bow
+bowel
+bower
+bow
+bowl
+bowler
+bowl
+bowl
+bow
+bowsprit
+bowstr
+box
+box
+boi
+boyet
+boyish
+boi
+brabant
+brabantio
+brabbl
+brabbler
+brac
+brace
+bracelet
+bracelet
+brach
+braci
+brag
+bragg
+braggard
+braggard
+braggart
+braggart
+brag
+brag
+bragless
+brag
+braid
+braid
+brain
+brain
+brainford
+brainish
+brainless
+brain
+brainsick
+brainsickli
+brake
+brakenburi
+brake
+brambl
+bran
+branch
+branch
+branchless
+brand
+brand
+brandish
+brandon
+brand
+bra
+brass
+brassi
+brat
+brat
+brav
+brave
+brave
+brave
+braver
+braveri
+brave
+bravest
+brave
+brawl
+brawler
+brawl
+brawl
+brawn
+brawn
+brai
+brai
+braz
+brazen
+brazier
+breach
+breach
+bread
+breadth
+break
+breaker
+breakfast
+break
+break
+breast
+breast
+breast
+breastplat
+breast
+breath
+breath
+breath
+breather
+breather
+breath
+breathest
+breath
+breathless
+breath
+brecknock
+bred
+breech
+breech
+breech
+breed
+breeder
+breeder
+breed
+breed
+brees
+breez
+breff
+bretagn
+brethen
+bretheren
+brethren
+brevi
+breviti
+brew
+brewag
+brewer
+brewer
+brew
+brew
+briareu
+briar
+brib
+bribe
+briber
+bribe
+brick
+bricklay
+brick
+bridal
+bride
+bridegroom
+bridegroom
+bride
+bridg
+bridgenorth
+bridg
+bridget
+bridl
+bridl
+brief
+briefer
+briefest
+briefli
+brief
+brier
+brier
+brigandin
+bright
+brighten
+brightest
+brightli
+bright
+brim
+brim
+brim
+brimston
+brind
+brine
+bring
+bringer
+bringeth
+bring
+bring
+bring
+brinish
+brink
+brisk
+briski
+bristl
+bristl
+bristli
+bristol
+bristow
+britain
+britain
+britain
+british
+briton
+briton
+brittani
+brittl
+broach
+broach
+broad
+broader
+broadsid
+broca
+brock
+brogu
+broil
+broil
+broil
+broke
+broken
+brokenli
+broker
+broker
+broke
+broke
+brooch
+brooch
+brood
+brood
+brood
+brook
+brook
+broom
+broomstaff
+broth
+brothel
+brother
+brotherhood
+brotherhood
+brotherli
+brother
+broth
+brought
+brow
+brown
+browner
+brownist
+browni
+brow
+brows
+brows
+brui
+bruis
+bruis
+bruis
+bruis
+bruit
+bruit
+brundusium
+brunt
+brush
+brush
+brute
+brutish
+brutu
+bubbl
+bubbl
+bubbl
+bubukl
+buck
+bucket
+bucket
+buck
+buckingham
+buckl
+buckl
+buckler
+buckler
+bucklersburi
+buckl
+buckram
+buck
+bud
+bud
+bud
+budg
+budger
+budget
+bud
+buff
+buffet
+buffet
+buffet
+bug
+bugbear
+bugl
+bug
+build
+build
+buildeth
+build
+build
+build
+built
+bulk
+bulk
+bull
+bullcalf
+bullen
+bullen
+bullet
+bullet
+bullock
+bull
+bulli
+bulmer
+bulwark
+bulwark
+bum
+bumbast
+bump
+bumper
+bum
+bunch
+bunch
+bundl
+bung
+bunghol
+bungl
+bunt
+buoi
+bur
+burbolt
+burd
+burden
+burden
+burden
+burden
+burden
+burgh
+burgher
+burgher
+burglari
+burgomast
+burgonet
+burgundi
+burial
+buri
+burier
+buriest
+burli
+burn
+burn
+burnet
+burneth
+burn
+burnish
+burn
+burnt
+burr
+burrow
+bur
+burst
+burst
+burst
+burthen
+burthen
+burton
+buri
+buri
+bush
+bushel
+bush
+bushi
+busi
+busili
+busin
+busi
+busi
+buskin
+buski
+buss
+buss
+buss
+bustl
+bustl
+busi
+but
+butche
+butcher
+butcher
+butcheri
+butcherli
+butcher
+butcheri
+butler
+butt
+butter
+butter
+butterfli
+butterfli
+butterwoman
+butteri
+buttock
+buttock
+button
+buttonhol
+button
+buttress
+buttri
+butt
+buxom
+bui
+buyer
+bui
+bui
+buzz
+buzzard
+buzzard
+buzzer
+buzz
+by
+bye
+byzantium
+c
+ca
+cabbag
+cabilero
+cabin
+cabin
+cabl
+cabl
+cackl
+cacodemon
+caddi
+caddiss
+cade
+cadenc
+cadent
+cade
+cadmu
+caduceu
+cadwal
+cadwallad
+caeliu
+caelo
+caesar
+caesarion
+caesar
+cage
+cage
+cagion
+cain
+caith
+caitiff
+caitiff
+caiu
+cak
+cake
+cake
+calab
+calai
+calam
+calam
+calcha
+calcul
+calen
+calendar
+calendar
+calf
+caliban
+caliban
+calipoli
+caliti
+caliv
+call
+callat
+call
+callet
+call
+call
+calm
+calmest
+calmli
+calm
+calm
+calpurnia
+calumni
+calumni
+calumni
+calumni
+calv
+calv
+calv
+calveskin
+calydon
+cam
+cambio
+cambria
+cambric
+cambric
+cambridg
+cambys
+came
+camel
+camelot
+camel
+camest
+camillo
+camlet
+camomil
+camp
+campeiu
+camp
+camp
+can
+canakin
+canari
+canari
+cancel
+cancel
+cancel
+cancel
+cancel
+cancer
+candidatu
+candi
+candl
+candl
+candlestick
+candi
+canidiu
+cank
+canker
+cankerblossom
+canker
+cannib
+cannib
+cannon
+cannon
+cannon
+cannot
+canon
+canoniz
+canon
+canon
+canon
+canopi
+canopi
+canopi
+canst
+canstick
+canterburi
+cantl
+canton
+canu
+canva
+canvass
+canzonet
+cap
+capabl
+capabl
+capac
+capac
+caparison
+capdv
+cape
+capel
+capel
+caper
+caper
+capet
+caphi
+capilet
+capitain
+capit
+capit
+capitol
+capitul
+capocchia
+capon
+capon
+capp
+cappadocia
+capriccio
+caprici
+cap
+capt
+captain
+captain
+captainship
+captiou
+captiv
+captiv
+captiv
+captiv
+captiv
+captiv
+captum
+capuciu
+capulet
+capulet
+car
+carack
+carack
+carat
+carawai
+carbonado
+carbuncl
+carbuncl
+carbuncl
+carcanet
+carcas
+carcas
+carcass
+carcass
+card
+cardecu
+card
+carder
+cardin
+cardin
+cardin
+cardmak
+card
+carduu
+care
+care
+career
+career
+care
+carefulli
+careless
+carelessli
+careless
+care
+caret
+cargo
+carl
+carlisl
+carlot
+carman
+carmen
+carnal
+carnal
+carnarvonshir
+carnat
+carnat
+carol
+carou
+carous
+carous
+carous
+carous
+carp
+carpent
+carper
+carpet
+carpet
+carp
+carriag
+carriag
+carri
+carrier
+carrier
+carri
+carrion
+carrion
+carri
+carri
+car
+cart
+carter
+carthag
+cart
+carv
+carv
+carv
+carver
+carv
+carv
+ca
+casa
+casaer
+casca
+case
+casement
+casement
+case
+cash
+cashier
+case
+cask
+casket
+casket
+casket
+casqu
+casqu
+cassado
+cassandra
+cassibelan
+cassio
+cassiu
+cassock
+cast
+castalion
+castawai
+castawai
+cast
+caster
+castig
+castig
+castil
+castiliano
+cast
+castl
+castl
+cast
+casual
+casual
+casualti
+casualti
+cat
+cataian
+catalogu
+cataplasm
+cataract
+catarrh
+catastroph
+catch
+catcher
+catch
+catch
+cate
+catechis
+catech
+catech
+cater
+caterpillar
+cater
+caterwaul
+cate
+catesbi
+cathedr
+catlik
+catl
+catl
+cato
+cat
+cattl
+caucasu
+caudl
+cauf
+caught
+cauldron
+cau
+caus
+caus
+causeless
+causer
+caus
+causest
+causeth
+cautel
+cautel
+cautel
+cauter
+caution
+caution
+cavaleiro
+cavaleri
+cavali
+cave
+cavern
+cavern
+cave
+caveto
+caviari
+cavil
+cavil
+cawdor
+cawdron
+caw
+ce
+cea
+ceas
+ceas
+ceaseth
+cedar
+cedar
+cediu
+celebr
+celebr
+celebr
+celebr
+celer
+celesti
+celia
+cell
+cellar
+cellarag
+celsa
+cement
+censer
+censor
+censorinu
+censur
+censur
+censur
+censur
+censur
+censur
+centaur
+centaur
+centr
+cent
+centuri
+centurion
+centurion
+centuri
+cerberu
+cerecloth
+cerement
+ceremoni
+ceremoni
+ceremoni
+ceremoni
+ceremoni
+cere
+cern
+certain
+certain
+certainli
+certainti
+certainti
+cert
+certif
+certifi
+certifi
+certifi
+ce
+cesario
+cess
+cess
+cestern
+cetera
+cett
+chace
+chaf
+chafe
+chafe
+chafe
+chaff
+chaffless
+chafe
+chain
+chain
+chair
+chair
+chalic
+chalic
+chalic
+chalk
+chalk
+chalki
+challeng
+challeng
+challeng
+challeng
+challeng
+challeng
+cham
+chamber
+chamber
+chamberlain
+chamberlain
+chambermaid
+chambermaid
+chamber
+chameleon
+champ
+champagn
+champain
+champain
+champion
+champion
+chanc
+chanc
+chanc
+chancellor
+chanc
+chandler
+chang
+chang
+changeabl
+chang
+chang
+changel
+changel
+changer
+chang
+changest
+chang
+channel
+channel
+chanson
+chant
+chanticl
+chant
+chantri
+chantri
+chant
+chao
+chap
+chape
+chapel
+chapeless
+chapel
+chaplain
+chaplain
+chapless
+chaplet
+chapmen
+chap
+chapter
+charact
+charact
+characterless
+charact
+characteri
+charact
+charbon
+chare
+chare
+charg
+charg
+charg
+charg
+charg
+chargeth
+charg
+chariest
+chari
+chare
+chariot
+chariot
+charit
+charit
+chariti
+chariti
+charlemain
+charl
+charm
+charm
+charmer
+charmeth
+charmian
+charm
+charmingli
+charm
+charneco
+charnel
+charoloi
+charon
+charter
+charter
+chartreux
+chari
+charybdi
+cha
+chase
+chase
+chaser
+chaseth
+chase
+chast
+chast
+chasti
+chastis
+chastis
+chastis
+chastiti
+chat
+chatham
+chatillon
+chat
+chatt
+chattel
+chatter
+chatter
+chattl
+chaud
+chaunt
+chaw
+chawdron
+che
+cheap
+cheapen
+cheaper
+cheapest
+cheapli
+cheapsid
+cheat
+cheat
+cheater
+cheater
+cheat
+cheat
+check
+check
+checker
+check
+check
+cheek
+cheek
+cheer
+cheer
+cheerer
+cheer
+cheerfulli
+cheer
+cheerless
+cheerli
+cheer
+chees
+chequer
+cher
+cherish
+cherish
+cherish
+cherish
+cherish
+cherri
+cherri
+cherrypit
+chertsei
+cherub
+cherubim
+cherubin
+cherubin
+cheshu
+chess
+chest
+chester
+chestnut
+chestnut
+chest
+cheta
+chev
+cheval
+chevali
+chevali
+cheveril
+chew
+chew
+chewet
+chew
+chez
+chi
+chick
+chicken
+chicken
+chicurmurco
+chid
+chidden
+chide
+chider
+chide
+chide
+chief
+chiefest
+chiefli
+chien
+child
+child
+childer
+childhood
+childhood
+child
+childish
+childish
+childlik
+child
+children
+chill
+chill
+chime
+chime
+chimnei
+chimneypiec
+chimnei
+chimurcho
+chin
+china
+chine
+chine
+chink
+chink
+chin
+chipp
+chipper
+chip
+chiron
+chirp
+chirrah
+chirurgeonli
+chisel
+chitoph
+chivalr
+chivalri
+choic
+choic
+choicest
+choir
+choir
+chok
+choke
+choke
+choke
+choke
+choler
+choler
+choler
+chollor
+choos
+chooser
+choos
+chooseth
+choos
+chop
+chopin
+choplog
+chopp
+chop
+chop
+choppi
+chop
+chopt
+chor
+chorist
+choru
+chose
+chosen
+chough
+chough
+chrish
+christ
+christen
+christendom
+christendom
+christen
+christen
+christian
+christianlik
+christian
+christma
+christom
+christoph
+christophero
+chronicl
+chronicl
+chronicl
+chronicl
+chronicl
+chrysolit
+chuck
+chuck
+chud
+chuff
+church
+church
+churchman
+churchmen
+churchyard
+churchyard
+churl
+churlish
+churlishli
+churl
+churn
+chu
+cicatric
+cicatric
+cice
+cicero
+cicet
+ciel
+ciitzen
+cilicia
+cimber
+cimmerian
+cinabl
+cinctur
+cinder
+cine
+cinna
+cinqu
+cipher
+cipher
+circa
+circ
+circl
+circl
+circlet
+circl
+circuit
+circum
+circumcis
+circumfer
+circummur
+circumscrib
+circumscrib
+circumscript
+circumspect
+circumst
+circumstanc
+circumst
+circumstanti
+circumv
+circumvent
+cistern
+citadel
+cital
+cite
+cite
+cite
+citi
+cite
+citizen
+citizen
+cittern
+citi
+civet
+civil
+civil
+civilli
+clack
+clad
+claim
+claim
+claim
+clamb
+clamber
+clammer
+clamor
+clamor
+clamor
+clamour
+clamour
+clang
+clangor
+clap
+clapp
+clap
+clapper
+clap
+clap
+clare
+clarenc
+claret
+claribel
+clasp
+clasp
+clatter
+claud
+claudio
+claudiu
+claus
+claw
+claw
+claw
+claw
+clai
+clai
+clean
+cleanliest
+cleanli
+clean
+cleans
+cleans
+clear
+clearer
+clearest
+clearli
+clear
+clear
+cleav
+cleav
+clef
+cleft
+cleitu
+clemenc
+clement
+cleomen
+cleopatpa
+cleopatra
+clepeth
+clept
+clerestori
+clergi
+clergyman
+clergymen
+clerk
+clerkli
+clerk
+clew
+client
+client
+cliff
+clifford
+clifford
+cliff
+clifton
+climat
+climatur
+climb
+climb
+climber
+climbeth
+climb
+climb
+clime
+cling
+clink
+clink
+clinquant
+clip
+clipp
+clipper
+clippeth
+clip
+clipt
+clitu
+clo
+cloak
+cloakbag
+cloak
+clock
+clock
+clod
+cloddi
+clodpol
+clog
+clog
+clog
+cloister
+cloistress
+cloquenc
+clo
+close
+close
+close
+close
+closer
+close
+closest
+closet
+close
+closur
+cloten
+cloten
+cloth
+clothair
+clothariu
+cloth
+cloth
+clothier
+clothier
+cloth
+cloth
+clotpol
+clotpol
+cloud
+cloud
+cloudi
+cloud
+cloudi
+clout
+clout
+clout
+cloven
+clover
+clove
+clovest
+clowder
+clown
+clownish
+clown
+cloi
+cloi
+cloi
+cloyless
+cloyment
+cloi
+club
+club
+cluck
+clung
+clust
+cluster
+clutch
+clyster
+cneiu
+cnemi
+co
+coach
+coach
+coachmak
+coact
+coactiv
+coagul
+coal
+coal
+coars
+coars
+coast
+coast
+coast
+coat
+coat
+coat
+cobbl
+cobbl
+cobbler
+cobham
+cobloaf
+cobweb
+cobweb
+cock
+cockatric
+cockatric
+cockl
+cockl
+cocknei
+cockpit
+cock
+cocksur
+coctu
+cocytu
+cod
+cod
+codl
+codpiec
+codpiec
+cod
+coelestibu
+coesar
+coeur
+coffer
+coffer
+coffin
+coffin
+cog
+cog
+cogit
+cogit
+cognit
+cogniz
+cogscomb
+cohabit
+coher
+coher
+coher
+coher
+cohort
+coif
+coign
+coil
+coin
+coinag
+coiner
+coin
+coin
+col
+colbrand
+colcho
+cold
+colder
+coldest
+coldli
+cold
+coldspur
+colebrook
+colic
+collar
+collar
+collater
+colleagu
+collect
+collect
+collect
+colleg
+colleg
+colli
+collier
+collier
+collop
+collus
+colm
+colmekil
+coloquintida
+color
+color
+colossu
+colour
+colour
+colour
+colour
+colour
+colt
+colt
+colt
+columbin
+columbin
+colvil
+com
+comagen
+comart
+comb
+combat
+combat
+combat
+combat
+combat
+combin
+combin
+combin
+combin
+combin
+combless
+combust
+come
+comedian
+comedian
+comedi
+comeli
+come
+comer
+comer
+come
+comest
+comet
+cometh
+comet
+comfect
+comfit
+comfit
+comfort
+comfort
+comfort
+comfort
+comfort
+comfortless
+comfort
+comic
+comic
+come
+come
+cominiu
+comma
+command
+command
+command
+command
+command
+command
+command
+command
+command
+comm
+commenc
+commenc
+commenc
+commenc
+commenc
+commenc
+commend
+commend
+commend
+commend
+commend
+commend
+commend
+comment
+commentari
+comment
+comment
+commerc
+commingl
+commiser
+commiss
+commission
+commiss
+commit
+commit
+committ
+commit
+commit
+commix
+commix
+commixt
+commixtur
+commodi
+commod
+commod
+common
+commonalti
+common
+common
+commonli
+common
+commonw
+commonwealth
+commot
+commot
+commun
+communicat
+commun
+commun
+commun
+commun
+comonti
+compact
+compani
+companion
+companion
+companionship
+compani
+compar
+compar
+compar
+compar
+compar
+comparison
+comparison
+compartn
+compass
+compass
+compass
+compass
+compassion
+compeer
+compel
+compel
+compel
+compel
+compel
+compens
+compet
+compet
+compet
+competitor
+competitor
+compil
+compil
+compil
+complain
+complain
+complainest
+complain
+complain
+complain
+complaint
+complaint
+complement
+complement
+complet
+complexion
+complexion
+complexion
+complic
+compli
+compliment
+compliment
+compliment
+complot
+complot
+complot
+compli
+compo
+compos
+compos
+composit
+compost
+compostur
+composur
+compound
+compound
+compound
+comprehend
+comprehend
+comprehend
+compremis
+compri
+compris
+compromi
+compromis
+compt
+comptibl
+comptrol
+compulsatori
+compuls
+compuls
+compuncti
+comput
+comrad
+comrad
+comutu
+con
+concav
+concav
+conceal
+conceal
+conceal
+conceal
+conceal
+conceal
+conceit
+conceit
+conceitless
+conceit
+conceiv
+conceiv
+conceiv
+conceiv
+conceiv
+concept
+concept
+concepti
+concern
+concern
+concerneth
+concern
+concern
+concern
+conclav
+conclud
+conclud
+conclud
+conclud
+conclud
+conclus
+conclus
+concolinel
+concord
+concubin
+concupisc
+concupi
+concur
+concur
+concur
+condemn
+condemn
+condemn
+condemn
+condemn
+condescend
+condign
+condit
+condition
+condit
+condol
+condol
+condol
+conduc
+conduct
+conduct
+conduct
+conductor
+conduit
+conduit
+conect
+conei
+confect
+confectionari
+confect
+confederaci
+confeder
+confeder
+confer
+confer
+conferr
+confer
+confess
+confess
+confess
+confesseth
+confess
+confess
+confess
+confessor
+confid
+confid
+confid
+confin
+confin
+confin
+confineless
+confin
+confin
+confin
+confirm
+confirm
+confirm
+confirm
+confirm
+confirm
+confirm
+confirm
+confirm
+confisc
+confisc
+confisc
+confix
+conflict
+conflict
+conflict
+confluenc
+conflux
+conform
+conform
+confound
+confound
+confound
+confound
+confront
+confront
+confu
+confus
+confusedli
+confus
+confus
+confut
+confut
+congeal
+congeal
+congeal
+conge
+conger
+congest
+congi
+congratul
+congre
+congreet
+congreg
+congreg
+congreg
+congreg
+congruent
+congru
+coni
+conjectur
+conjectur
+conjectur
+conjoin
+conjoin
+conjoin
+conjointli
+conjunct
+conjunct
+conjunct
+conjur
+conjur
+conjur
+conjur
+conjur
+conjur
+conjur
+conjur
+conjur
+conjuro
+conn
+connect
+conniv
+conqu
+conquer
+conquer
+conquer
+conqueror
+conqueror
+conquer
+conquest
+conquest
+conqur
+conrad
+con
+consanguin
+consanguin
+conscienc
+conscienc
+conscienc
+conscion
+consecr
+consecr
+consecr
+consent
+consent
+consent
+consent
+consequ
+consequ
+consequ
+conserv
+conserv
+conserv
+consid
+consider
+consider
+consider
+consider
+consid
+consid
+consid
+consid
+consign
+consign
+consist
+consisteth
+consist
+consistori
+consist
+consol
+consol
+conson
+conson
+consort
+consort
+consortest
+conspectu
+conspir
+conspiraci
+conspir
+conspir
+conspir
+conspir
+conspir
+conspir
+conspir
+conspir
+constabl
+constabl
+constanc
+constanc
+constanc
+constant
+constantin
+constantinopl
+constantli
+constel
+constitut
+constrain
+constrain
+constraineth
+constrain
+constraint
+constr
+construct
+constru
+consul
+consul
+consulship
+consulship
+consult
+consult
+consult
+consum
+consum
+consum
+consum
+consum
+consumm
+consumm
+consumpt
+consumpt
+contagion
+contagi
+contain
+contain
+contain
+contamin
+contamin
+contemn
+contemn
+contemn
+contemn
+contempl
+contempl
+contempl
+contempt
+contempt
+contempt
+contemptu
+contemptu
+contend
+contend
+contend
+contendon
+content
+contenta
+content
+contenteth
+content
+contenti
+contentless
+contento
+content
+contest
+contest
+contin
+contin
+contin
+contin
+continu
+continu
+continu
+continu
+continuantli
+continu
+continu
+continu
+continu
+continu
+continu
+contract
+contract
+contract
+contract
+contradict
+contradict
+contradict
+contradict
+contrari
+contrarieti
+contrarieti
+contrari
+contrari
+contrari
+contr
+contribut
+contributor
+contrit
+contriv
+contriv
+contriv
+contriv
+contriv
+contriv
+control
+control
+control
+control
+control
+control
+controversi
+contumeli
+contumeli
+contum
+contus
+conveni
+conveni
+conveni
+conveni
+conveni
+convent
+conventicl
+convent
+conver
+convers
+convers
+convers
+convers
+convers
+convers
+convers
+convers
+convert
+convert
+convertest
+convert
+convertit
+convertit
+convert
+convei
+convey
+convey
+convey
+convei
+convict
+convict
+convinc
+convinc
+convinc
+conviv
+convoc
+convoi
+convuls
+coni
+cook
+cookeri
+cook
+cool
+cool
+cool
+cool
+coop
+coop
+cop
+copatain
+cope
+cophetua
+copi
+copi
+copiou
+copper
+copperspur
+coppic
+copul
+copul
+copi
+cor
+coragio
+coral
+coram
+corambu
+coranto
+coranto
+corbo
+cord
+cord
+cordelia
+cordial
+cordi
+cord
+core
+corin
+corinth
+corinthian
+coriolanu
+corioli
+cork
+corki
+cormor
+corn
+cornelia
+corneliu
+corner
+corner
+cornerston
+cornet
+cornish
+corn
+cornuto
+cornwal
+corollari
+coron
+coron
+coronet
+coronet
+corpor
+corpor
+corpor
+corps
+corpul
+correct
+correct
+correct
+correct
+correction
+correct
+correspond
+correspond
+correspond
+correspons
+corrig
+corriv
+corriv
+corrobor
+corros
+corrupt
+corrupt
+corrupt
+corrupt
+corrupt
+corrupt
+corrupt
+corrupt
+corruptli
+corrupt
+cors
+cors
+corslet
+cosmo
+cost
+costard
+costermong
+costlier
+costli
+cost
+cot
+cote
+cote
+cotsal
+cotsol
+cotswold
+cottag
+cottag
+cotu
+couch
+couch
+couch
+couch
+coud
+cough
+cough
+could
+couldst
+coulter
+council
+councillor
+council
+counsel
+counsel
+counsellor
+counsellor
+counselor
+counselor
+counsel
+count
+count
+countenanc
+counten
+counten
+counter
+counterchang
+countercheck
+counterfeit
+counterfeit
+counterfeit
+counterfeitli
+counterfeit
+countermand
+countermand
+countermin
+counterpart
+counterpoint
+counterpoi
+counterpois
+counter
+countervail
+countess
+countess
+counti
+count
+countless
+countri
+countrv
+countri
+countryman
+countrymen
+count
+counti
+couper
+coupl
+coupl
+couplement
+coupl
+couplet
+couplet
+cour
+courag
+courag
+courag
+courag
+courier
+courier
+couronn
+cour
+cours
+cours
+courser
+courser
+cours
+cours
+court
+court
+courteou
+courteous
+courtesan
+courtesi
+courtesi
+courtezan
+courtezan
+courtier
+courtier
+courtlik
+courtli
+courtnei
+court
+courtship
+cousin
+cousin
+couterfeit
+coutum
+coven
+coven
+covent
+coventri
+cover
+cover
+cover
+coverlet
+cover
+covert
+covertli
+covertur
+covet
+covet
+covet
+covet
+covet
+covet
+covet
+covet
+cow
+coward
+coward
+cowardic
+cowardli
+coward
+cowardship
+cowish
+cowl
+cowslip
+cowslip
+cox
+coxcomb
+coxcomb
+coi
+coystril
+coz
+cozen
+cozenag
+cozen
+cozen
+cozen
+cozen
+cozier
+crab
+crab
+crab
+crack
+crack
+cracker
+cracker
+crack
+crack
+cradl
+cradl
+cradl
+craft
+craft
+crafti
+craftier
+craftili
+craft
+craftsmen
+crafti
+cram
+cramm
+cramp
+cramp
+cram
+crank
+crank
+cranmer
+cranni
+cranni
+cranni
+crant
+crare
+crash
+crassu
+crav
+crave
+crave
+craven
+craven
+crave
+craveth
+crave
+crawl
+crawl
+crawl
+craz
+craze
+crazi
+creak
+cream
+creat
+creat
+creat
+creat
+creation
+creator
+creatur
+creatur
+credenc
+credent
+credibl
+credit
+creditor
+creditor
+credo
+credul
+credul
+creed
+creek
+creek
+creep
+creep
+creep
+crept
+crescent
+cresciv
+cresset
+cressid
+cressida
+cressid
+cressi
+crest
+crest
+crestfal
+crestless
+crest
+cretan
+crete
+crevic
+crew
+crew
+crib
+cribb
+crib
+cricket
+cricket
+cri
+criedst
+crier
+cri
+criest
+crieth
+crime
+crime
+crimeless
+crime
+crimin
+crimson
+cring
+crippl
+crisp
+crisp
+crispian
+crispianu
+crispin
+critic
+critic
+critic
+croak
+croak
+croak
+crocodil
+cromer
+cromwel
+crone
+crook
+crookback
+crook
+crook
+crop
+cropp
+crosbi
+cross
+cross
+cross
+crossest
+cross
+cross
+crossli
+cross
+crost
+crotchet
+crouch
+crouch
+crow
+crowd
+crowd
+crowd
+crowd
+crowflow
+crow
+crowkeep
+crown
+crown
+crowner
+crownet
+crownet
+crown
+crown
+crow
+crudi
+cruel
+cruell
+crueller
+cruelli
+cruel
+cruelti
+crum
+crumbl
+crumb
+crupper
+crusado
+crush
+crush
+crushest
+crush
+crust
+crust
+crusti
+crutch
+crutch
+cry
+cry
+crystal
+crystallin
+crystal
+cub
+cubbert
+cubiculo
+cubit
+cub
+cuckold
+cuckoldli
+cuckold
+cuckoo
+cucullu
+cudgel
+cudgel
+cudgel
+cudgel
+cudgel
+cue
+cue
+cuff
+cuff
+cuiqu
+cull
+cull
+cullion
+cullionli
+cullion
+culpabl
+culverin
+cum
+cumber
+cumberland
+cun
+cunningli
+cun
+cuor
+cup
+cupbear
+cupboard
+cupid
+cupid
+cuppel
+cup
+cur
+curan
+curat
+curb
+curb
+curb
+curb
+curd
+curdi
+curd
+cure
+cure
+cureless
+curer
+cure
+curfew
+cure
+curio
+curios
+curiou
+curious
+curl
+curl
+curl
+curl
+curranc
+currant
+current
+current
+currish
+curri
+cur
+curs
+curs
+curs
+cursi
+curs
+cursorari
+curst
+curster
+curstest
+curst
+cursi
+curtail
+curtain
+curtain
+curtal
+curti
+curtl
+curtsi
+curtsi
+curtsi
+curvet
+curvet
+cush
+cushion
+cushion
+custalorum
+custard
+custodi
+custom
+customari
+custom
+custom
+custom
+custom
+custur
+cut
+cutler
+cutpurs
+cutpurs
+cut
+cutter
+cut
+cuttl
+cxsar
+cyclop
+cydnu
+cygnet
+cygnet
+cym
+cymbal
+cymbelin
+cyme
+cynic
+cynthia
+cypress
+cypriot
+cypru
+cyru
+cytherea
+d
+dabbl
+dace
+dad
+daedalu
+daemon
+daff
+daf
+daffest
+daffodil
+dagger
+dagger
+dagonet
+daili
+daintier
+dainti
+daintiest
+daintili
+dainti
+daintri
+dainti
+daisi
+daisi
+daisi
+dale
+dallianc
+dalli
+dalli
+dalli
+dalli
+dalmatian
+dam
+damag
+damascu
+damask
+damask
+dame
+dame
+damm
+damn
+damnabl
+damnabl
+damnat
+damn
+damn
+damoisel
+damon
+damosella
+damp
+dam
+damsel
+damson
+dan
+danc
+danc
+dancer
+danc
+danc
+dandl
+dandi
+dane
+dang
+danger
+danger
+danger
+danger
+dangl
+daniel
+danish
+dank
+dankish
+dansker
+daphn
+dappl
+dappl
+dar
+dardan
+dardanian
+dardaniu
+dare
+dare
+dare
+dare
+darest
+dare
+dariu
+dark
+darken
+darken
+darken
+darker
+darkest
+darkl
+darkli
+dark
+darl
+darl
+darnel
+darraign
+dart
+dart
+darter
+dartford
+dart
+dart
+dash
+dash
+dash
+dastard
+dastard
+dat
+datchet
+date
+date
+dateless
+date
+daub
+daughter
+daughter
+daunt
+daunt
+dauntless
+dauphin
+daventri
+davi
+daw
+dawn
+dawn
+daw
+dai
+daylight
+dai
+dazzl
+dazzl
+dazzl
+de
+dead
+deadli
+deaf
+deaf
+deaf
+deaf
+deal
+dealer
+dealer
+dealest
+deal
+deal
+deal
+dealt
+dean
+deaneri
+dear
+dearer
+dearest
+dearli
+dear
+dear
+dearth
+dearth
+death
+deathb
+death
+death
+deathsman
+deathsmen
+debar
+debas
+debat
+debat
+debat
+debateth
+debat
+debauch
+debil
+debil
+debitor
+debonair
+deborah
+debosh
+debt
+debt
+debtor
+debtor
+debt
+debuti
+decai
+decai
+decay
+decai
+decai
+decea
+deceas
+deceas
+deceit
+deceit
+deceit
+deceiv
+deceiv
+deceiv
+deceiv
+deceiv
+deceiv
+deceiv
+deceivest
+deceiveth
+deceiv
+decemb
+decent
+decepti
+decern
+decid
+decid
+decim
+deciph
+deciph
+decis
+deciu
+deck
+deck
+deck
+deckt
+declar
+declar
+declens
+declens
+declin
+declin
+declin
+declin
+declin
+decoct
+decorum
+decrea
+decreas
+decreas
+decre
+decre
+decre
+decrepit
+dedic
+dedic
+dedic
+dedic
+deed
+deedless
+deed
+deem
+deem
+deep
+deeper
+deepest
+deepli
+deep
+deepvow
+deer
+deess
+defac
+defac
+defac
+defac
+defac
+defac
+defam
+default
+defeat
+defeat
+defeat
+defeatur
+defect
+defect
+defect
+defenc
+defenc
+defend
+defend
+defend
+defend
+defend
+defend
+defend
+defens
+defens
+defens
+defer
+deferr
+defianc
+defici
+defi
+defi
+defil
+defil
+defil
+defil
+defil
+defin
+defin
+definit
+definit
+definit
+deflow
+deflow
+deflow
+deform
+deform
+deform
+deform
+deftli
+defunct
+defunct
+defus
+defi
+defi
+degener
+degrad
+degre
+degre
+deifi
+deifi
+deign
+deign
+deiphobu
+deiti
+deiti
+deja
+deject
+deject
+delabreth
+delai
+delai
+delai
+delai
+delect
+deliber
+delic
+delic
+delici
+delici
+delight
+delight
+delight
+delight
+delinqu
+deliv
+deliv
+deliver
+deliv
+deliv
+deliv
+deliveri
+delpho
+delud
+delud
+delug
+delv
+delver
+delv
+demand
+demand
+demand
+demand
+demean
+demeanor
+demeanour
+demerit
+demesn
+demetriu
+demi
+demigod
+demis
+demoisel
+demon
+demonstr
+demonstr
+demonstr
+demonstr
+demonstr
+demonstr
+demur
+demur
+demur
+den
+denai
+deni
+denial
+denial
+deni
+denier
+deni
+deniest
+deni
+denmark
+denni
+denni
+denot
+denot
+denot
+denounc
+denounc
+denounc
+den
+denunci
+deni
+deni
+deo
+depart
+depart
+departest
+depart
+departur
+depech
+depend
+depend
+depend
+depend
+depend
+depend
+depend
+depend
+depend
+depend
+depend
+depend
+deplor
+deplor
+depopul
+depo
+depos
+depos
+depos
+depositari
+deprav
+deprav
+deprav
+deprav
+deprav
+depress
+depriv
+depriv
+depth
+depth
+deput
+deput
+deput
+deputi
+deput
+deputi
+deracin
+derbi
+derceta
+dere
+derid
+deris
+deriv
+deriv
+deriv
+deriv
+deriv
+deriv
+derog
+derog
+derog
+de
+desartless
+descant
+descend
+descend
+descend
+descend
+descens
+descent
+descent
+describ
+describ
+describ
+descri
+descript
+descript
+descri
+desdemon
+desdemona
+desert
+desert
+deserv
+deserv
+deserv
+deservedli
+deserv
+deserv
+deserv
+deservest
+deserv
+deserv
+design
+design
+design
+design
+desir
+desir
+desir
+desir
+desir
+desirest
+desir
+desir
+desist
+desk
+desol
+desol
+desp
+despair
+despair
+despair
+despatch
+desper
+desper
+desper
+despi
+despis
+despis
+despis
+despiseth
+despis
+despit
+despit
+despoil
+dest
+destin
+destin
+destini
+destini
+destitut
+destroi
+destroi
+destroy
+destroy
+destroi
+destroi
+destruct
+destruct
+det
+detain
+detain
+detect
+detect
+detect
+detect
+detector
+detect
+detent
+determin
+determin
+determin
+determin
+determin
+determin
+determin
+detest
+detest
+detest
+detest
+detest
+detract
+detract
+detract
+deucalion
+deuc
+deum
+deux
+devant
+devest
+devic
+devic
+devil
+devilish
+devil
+devi
+devis
+devis
+devis
+devis
+devoid
+devonshir
+devot
+devot
+devot
+devour
+devour
+devour
+devour
+devour
+devout
+devoutli
+dew
+dewberri
+dewdrop
+dewlap
+dewlapp
+dew
+dewi
+dexter
+dexteri
+dexter
+di
+diabl
+diablo
+diadem
+dial
+dialect
+dialogu
+dialogu
+dial
+diamet
+diamond
+diamond
+dian
+diana
+diaper
+dibbl
+dic
+dice
+dicer
+dich
+dick
+dicken
+dickon
+dicki
+dictat
+diction
+dictynna
+did
+diddl
+didest
+dido
+didst
+die
+di
+diedst
+di
+diest
+diet
+diet
+dieter
+dieu
+diff
+differ
+differ
+differ
+differ
+differ
+differ
+differ
+difficil
+difficult
+difficulti
+difficulti
+diffid
+diffid
+diffu
+diffus
+diffusest
+dig
+digest
+digest
+digest
+digest
+digg
+dig
+dighton
+dignifi
+dignifi
+dignifi
+digniti
+digniti
+digress
+digress
+digress
+dig
+digt
+dilat
+dilat
+dilat
+dilatori
+dild
+dildo
+dilemma
+dilemma
+dilig
+dilig
+diluculo
+dim
+dimens
+dimens
+diminish
+diminish
+diminut
+diminut
+diminut
+dimm
+dim
+dim
+dimpl
+dimpl
+dim
+din
+dine
+dine
+diner
+dine
+ding
+dine
+dinner
+dinner
+dinnertim
+dint
+diom
+diomed
+diomed
+dion
+dip
+dipp
+dip
+dip
+dir
+dire
+direct
+direct
+direct
+direct
+direct
+directitud
+direct
+directli
+direct
+dire
+dire
+direst
+dirg
+dirg
+dirt
+dirti
+di
+disabl
+disabl
+disabl
+disabl
+disadvantag
+disagre
+disallow
+disanim
+disannul
+disannul
+disappoint
+disarm
+disarm
+disarmeth
+disarm
+disast
+disast
+disastr
+disbench
+disbranch
+disburden
+disbur
+disburs
+disburs
+discandi
+discandi
+discard
+discard
+discas
+discas
+discern
+discern
+discern
+discern
+discern
+discharg
+discharg
+discharg
+discharg
+discipl
+discipl
+disciplin
+disciplin
+disciplin
+disciplin
+disclaim
+disclaim
+disclaim
+disclo
+disclos
+disclos
+disclos
+discolour
+discolour
+discolour
+discomfit
+discomfit
+discomfitur
+discomfort
+discomfort
+discommend
+disconsol
+discont
+discont
+discontentedli
+discont
+discont
+discontinu
+discontinu
+discord
+discord
+discord
+discours
+discours
+discours
+discours
+discours
+discourtesi
+discov
+discov
+discov
+discover
+discoveri
+discov
+discov
+discoveri
+discredit
+discredit
+discredit
+discreet
+discreetli
+discret
+discret
+discuss
+disdain
+disdain
+disdaineth
+disdain
+disdainfulli
+disdain
+disdain
+disdnguish
+disea
+diseas
+diseas
+diseas
+disedg
+disembark
+disfigur
+disfigur
+disfurnish
+disgorg
+disgrac
+disgrac
+disgrac
+disgrac
+disgrac
+disgrac
+disgraci
+disgui
+disguis
+disguis
+disguis
+disguis
+disguis
+dish
+dishabit
+dishclout
+dishearten
+dishearten
+dish
+dishonest
+dishonestli
+dishonesti
+dishonor
+dishonor
+dishonor
+dishonour
+dishonour
+dishonour
+dishonour
+disinherit
+disinherit
+disjoin
+disjoin
+disjoin
+disjoint
+disjunct
+dislik
+dislik
+disliken
+dislik
+dislimn
+disloc
+dislodg
+disloy
+disloyalti
+dismal
+dismantl
+dismantl
+dismask
+dismai
+dismai
+dismemb
+dismemb
+dism
+dismiss
+dismiss
+dismiss
+dismiss
+dismount
+dismount
+disnatur
+disobedi
+disobedi
+disobei
+disobei
+disorb
+disord
+disord
+disorderli
+disord
+disparag
+disparag
+disparag
+dispark
+dispatch
+dispens
+dispens
+dispens
+disper
+dispers
+dispers
+dispersedli
+dispers
+dispit
+displac
+displac
+displac
+displant
+displant
+displai
+displai
+displea
+displeas
+displeas
+displeas
+displeasur
+displeasur
+dispong
+disport
+disport
+dispo
+dispos
+dispos
+dispos
+dispos
+disposit
+disposit
+dispossess
+dispossess
+disprai
+disprais
+disprais
+dispraisingli
+disproperti
+disproport
+disproport
+disprov
+disprov
+disprov
+dispurs
+disput
+disput
+disput
+disput
+disput
+disput
+disput
+disquant
+disquiet
+disquietli
+disrelish
+disrob
+disseat
+dissembl
+dissembl
+dissembl
+dissembl
+dissembl
+dissembl
+dissens
+dissens
+dissenti
+dissev
+dissip
+dissolut
+dissolut
+dissolut
+dissolut
+dissolv
+dissolv
+dissolv
+dissolv
+dissuad
+dissuad
+distaff
+distaff
+distain
+distain
+distanc
+distant
+distast
+distast
+distast
+distemp
+distemp
+distemperatur
+distemperatur
+distemp
+distemp
+distil
+distil
+distil
+distil
+distil
+distil
+distinct
+distinct
+distinctli
+distingu
+distinguish
+distinguish
+distinguish
+distract
+distract
+distractedli
+distract
+distract
+distract
+distrain
+distraught
+distress
+distress
+distress
+distress
+distribut
+distribut
+distribut
+distrust
+distrust
+disturb
+disturb
+disturb
+disturb
+disunit
+disvalu
+disvouch
+dit
+ditch
+ditcher
+ditch
+dite
+ditti
+ditti
+diurnal
+div
+dive
+diver
+diver
+divers
+divers
+divert
+divert
+divert
+dive
+divest
+divid
+divid
+divid
+divid
+divid
+divideth
+divin
+divin
+divin
+divin
+divin
+divin
+divin
+divinest
+divin
+divin
+divis
+divis
+divorc
+divorc
+divorc
+divorc
+divorc
+divulg
+divulg
+divulg
+divulg
+dizi
+dizzi
+do
+doat
+dobbin
+dock
+dock
+doct
+doctor
+doctor
+doctrin
+document
+dodg
+doe
+doer
+doer
+doe
+doest
+doff
+dog
+dogberri
+dogfish
+dogg
+dog
+dog
+doigt
+do
+do
+doit
+doit
+dolabella
+dole
+dole
+doll
+dollar
+dollar
+dolor
+dolor
+dolour
+dolour
+dolphin
+dolt
+dolt
+domest
+domest
+domin
+domin
+domin
+domin
+domin
+domin
+domin
+dominion
+dominion
+domitiu
+dommelton
+don
+donalbain
+donat
+donc
+doncast
+done
+dong
+donn
+donn
+donner
+donnerai
+doom
+doomsdai
+door
+doorkeep
+door
+dorca
+doreu
+doricl
+dormous
+dorothi
+dorset
+dorsetshir
+dost
+dotag
+dotant
+dotard
+dotard
+dote
+dote
+doter
+dote
+doteth
+doth
+dote
+doubl
+doubl
+doubl
+doubler
+doublet
+doublet
+doubl
+doubli
+doubt
+doubt
+doubt
+doubtfulli
+doubt
+doubtless
+doubt
+doug
+dough
+doughti
+doughi
+dougla
+dout
+dout
+dout
+dove
+dovehous
+dover
+dove
+dow
+dowag
+dowdi
+dower
+dowerless
+dower
+dowla
+dowl
+down
+downfal
+downright
+down
+downstair
+downtrod
+downward
+downward
+downi
+dowri
+dowri
+dowsabel
+doxi
+doze
+dozen
+dozen
+dozi
+drab
+drab
+drab
+drachma
+drachma
+draff
+drag
+dragg
+drag
+drag
+dragon
+dragonish
+dragon
+drain
+drain
+drain
+drake
+dram
+dramati
+drank
+draught
+draught
+drave
+draw
+drawbridg
+drawer
+drawer
+draweth
+draw
+drawl
+drawn
+draw
+drayman
+draymen
+dread
+dread
+dread
+dreadfulli
+dread
+dread
+dream
+dreamer
+dreamer
+dream
+dream
+dreamt
+drearn
+dreari
+dreg
+dreg
+drench
+drench
+dress
+dress
+dresser
+dress
+dress
+drest
+drew
+dribbl
+dri
+drier
+dri
+drift
+drili
+drink
+drinketh
+drink
+drink
+drink
+driv
+drive
+drivel
+driven
+drive
+driveth
+drive
+drizzl
+drizzl
+drizzl
+droit
+drolleri
+dromio
+dromio
+drone
+drone
+droop
+droopeth
+droop
+droop
+drop
+dropheir
+droplet
+dropp
+dropper
+droppeth
+drop
+drop
+drop
+dropsi
+dropsi
+dropsi
+dropt
+dross
+drossi
+drought
+drove
+droven
+drovier
+drown
+drown
+drown
+drown
+drow
+drows
+drowsili
+drowsi
+drowsi
+drudg
+drudgeri
+drudg
+drug
+drugg
+drug
+drum
+drumbl
+drummer
+drum
+drum
+drunk
+drunkard
+drunkard
+drunken
+drunkenli
+drunken
+dry
+dryness
+dst
+du
+dub
+dubb
+ducat
+ducat
+ducdam
+duchess
+duchi
+duchi
+duck
+duck
+duck
+dudgeon
+due
+duellist
+duello
+duer
+due
+duff
+dug
+dug
+duke
+dukedom
+dukedom
+duke
+dulcet
+dulch
+dull
+dullard
+duller
+dullest
+dull
+dull
+dull
+dulli
+dul
+duli
+dumain
+dumb
+dumb
+dumbl
+dumb
+dump
+dump
+dun
+duncan
+dung
+dungeon
+dungeon
+dunghil
+dunghil
+dungi
+dunnest
+dunsinan
+dunsmor
+dunstabl
+dupp
+duranc
+dure
+durst
+duski
+dust
+dust
+dusti
+dutch
+dutchman
+duteou
+duti
+duti
+duti
+dwarf
+dwarfish
+dwell
+dweller
+dwell
+dwell
+dwelt
+dwindl
+dy
+dye
+dy
+dyer
+dy
+e
+each
+eager
+eagerli
+eager
+eagl
+eagl
+ean
+eanl
+ear
+ear
+earl
+earldom
+earlier
+earliest
+earli
+earl
+earli
+earn
+earn
+earnest
+earnestli
+earnest
+earn
+ear
+earth
+earthen
+earthlier
+earthli
+earthquak
+earthquak
+earthi
+ea
+eas
+eas
+eas
+eas
+easier
+easiest
+easiliest
+easili
+easi
+eas
+east
+eastcheap
+easter
+eastern
+eastward
+easi
+eat
+eaten
+eater
+eater
+eat
+eat
+eaux
+eav
+ebb
+eb
+ebb
+ebon
+eboni
+ebrew
+ecc
+echapp
+echo
+echo
+eclip
+eclips
+eclips
+ecoli
+ecoutez
+ecstaci
+ecstasi
+ecstasi
+ecu
+eden
+edg
+edgar
+edg
+edg
+edgeless
+edg
+edict
+edict
+edific
+edific
+edifi
+edifi
+edit
+edm
+edmund
+edmund
+edmundsburi
+educ
+educ
+educ
+edward
+eel
+eel
+effect
+effect
+effectless
+effect
+effectu
+effectu
+effemin
+effigi
+effu
+effus
+effus
+eftest
+egal
+egal
+eget
+egeu
+egg
+egg
+eggshel
+eglamour
+eglantin
+egma
+ego
+egregi
+egregi
+egress
+egypt
+egyptian
+egyptian
+eie
+eight
+eighteen
+eighth
+eightpenni
+eighti
+eisel
+either
+eject
+ek
+el
+elb
+elbow
+elbow
+eld
+elder
+elder
+eldest
+eleanor
+elect
+elect
+elect
+eleg
+elegi
+element
+element
+eleph
+eleph
+elev
+eleven
+eleventh
+elf
+elflock
+eliad
+elinor
+elizabeth
+ell
+ell
+ellen
+elm
+eloqu
+eloqu
+els
+elsewher
+elsinor
+eltham
+elv
+elvish
+eli
+elysium
+em
+embal
+embalm
+embalm
+embark
+embark
+embarqu
+embassad
+embassag
+embassi
+embassi
+embattail
+embattl
+embattl
+embai
+embellish
+ember
+emblaz
+emblem
+emblem
+embodi
+embold
+embolden
+emboss
+emboss
+embound
+embowel
+embowel
+embrac
+embrac
+embrac
+embrac
+embrac
+embrac
+embrac
+embrasur
+embroid
+embroideri
+emhrac
+emilia
+emin
+emin
+emin
+emmanuel
+emniti
+empal
+emper
+emperess
+emperi
+emperor
+emperi
+emphasi
+empir
+empir
+empiricut
+empleach
+emploi
+emploi
+employ
+employ
+employ
+empoison
+empress
+empti
+emptier
+empti
+empti
+empti
+empti
+emul
+emul
+emul
+emul
+emul
+en
+enact
+enact
+enact
+enactur
+enamel
+enamel
+enamour
+enamour
+enanmour
+encamp
+encamp
+encav
+enceladu
+enchaf
+enchaf
+enchant
+enchant
+enchant
+enchantingli
+enchant
+enchantress
+enchant
+encha
+encircl
+encircl
+enclo
+enclos
+enclos
+enclos
+encloseth
+enclos
+encloud
+encompass
+encompass
+encompasseth
+encompass
+encor
+encorpor
+encount
+encount
+encount
+encount
+encourag
+encourag
+encourag
+encrimson
+encroach
+encumb
+end
+endamag
+endamag
+endang
+endart
+endear
+endear
+endeavour
+endeavour
+end
+ender
+end
+end
+endit
+endless
+endow
+endow
+endow
+endow
+end
+endu
+endu
+endur
+endur
+endur
+endur
+endur
+endur
+endymion
+enea
+enemi
+enemi
+enerni
+enew
+enfeebl
+enfeebl
+enfeoff
+enfett
+enfold
+enforc
+enforc
+enforc
+enforcedli
+enforc
+enforc
+enforcest
+enfranch
+enfranchi
+enfranchis
+enfranchis
+enfranchis
+enfre
+enfreedom
+engag
+engag
+engag
+engag
+engag
+engaol
+engend
+engend
+engend
+engild
+engin
+engin
+engin
+engin
+engirt
+england
+english
+englishman
+englishmen
+englut
+englut
+engraf
+engraft
+engraft
+engrav
+engrav
+engross
+engross
+engrossest
+engross
+engross
+enguard
+enigma
+enigmat
+enjoin
+enjoin
+enjoi
+enjoi
+enjoy
+enjoi
+enjoi
+enkindl
+enkindl
+enlard
+enlarg
+enlarg
+enlarg
+enlarg
+enlargeth
+enlighten
+enlink
+enmesh
+enmiti
+enmiti
+ennobl
+ennobl
+enobarb
+enobarbu
+enon
+enorm
+enorm
+enough
+enow
+enpatron
+enpierc
+enquir
+enquir
+enquir
+enrag
+enrag
+enrag
+enrag
+enrank
+enrapt
+enrich
+enrich
+enrich
+enridg
+enr
+enrob
+enrob
+enrol
+enrol
+enroot
+enround
+enschedul
+ensconc
+ensconc
+enseam
+ensear
+enseign
+enseignez
+ensembl
+enshelt
+enshield
+enshrin
+ensign
+ensign
+enski
+ensman
+ensnar
+ensnar
+ensnareth
+ensteep
+ensu
+ensu
+ensu
+ensu
+ensu
+enswath
+ent
+entail
+entam
+entangl
+entangl
+entendr
+enter
+enter
+enter
+enterpris
+enterpris
+enter
+entertain
+entertain
+entertain
+entertain
+entertain
+entertain
+enthral
+enthral
+enthron
+enthron
+entic
+entic
+entic
+entir
+entir
+entitl
+entitl
+entitl
+entomb
+entomb
+entrail
+entranc
+entranc
+entrap
+entrapp
+entr
+entreat
+entreat
+entreati
+entreat
+entreat
+entreat
+entreati
+entrench
+entri
+entwist
+envelop
+envenom
+envenom
+envenom
+envi
+envi
+enviou
+envious
+environ
+environ
+envoi
+envi
+envi
+enwheel
+enwomb
+enwrap
+ephesian
+ephesian
+ephesu
+epicur
+epicurean
+epicur
+epicur
+epicuru
+epidamnum
+epidauru
+epigram
+epilepsi
+epilept
+epilogu
+epilogu
+epistl
+epistrophu
+epitaph
+epitaph
+epithet
+epitheton
+epithet
+epitom
+equal
+equal
+equal
+equal
+equal
+equal
+equal
+equinocti
+equinox
+equipag
+equiti
+equivoc
+equivoc
+equivoc
+equivoc
+equivoc
+er
+erbear
+erbear
+erbear
+erbeat
+erblow
+erboard
+erborn
+ercam
+ercast
+ercharg
+ercharg
+ercharg
+ercl
+ercom
+ercov
+ercrow
+erdo
+er
+erebu
+erect
+erect
+erect
+erect
+erect
+erewhil
+erflourish
+erflow
+erflow
+erflow
+erfraught
+erga
+ergal
+erglanc
+ergo
+ergon
+ergrow
+ergrown
+ergrowth
+erhang
+erhang
+erhasti
+erhear
+erheard
+eringo
+erjoi
+erleap
+erleap
+erleaven
+erlook
+erlook
+ermast
+ermengar
+ermount
+ern
+ernight
+ero
+erpaid
+erpart
+erpast
+erpai
+erpeer
+erperch
+erpictur
+erpingham
+erpost
+erpow
+erpress
+erpress
+err
+errand
+errand
+errant
+errat
+erraught
+erreach
+er
+errest
+er
+erron
+error
+error
+err
+errul
+errun
+erset
+ershad
+ershad
+ershin
+ershot
+ersiz
+erskip
+erslip
+erspread
+erst
+erstar
+erstep
+erstunk
+erswai
+erswai
+erswel
+erta
+ertak
+erteem
+erthrow
+erthrown
+erthrow
+ertook
+ertop
+ertop
+ertrip
+erturn
+erudit
+erupt
+erupt
+ervalu
+erwalk
+erwatch
+erween
+erween
+erweigh
+erweigh
+erwhelm
+erwhelm
+erworn
+es
+escalu
+escap
+escap
+escap
+escap
+eschew
+escot
+esil
+especi
+especi
+esper
+espial
+espi
+espi
+espou
+espous
+espi
+esquir
+esquir
+essai
+essai
+essenc
+essenti
+essenti
+ess
+essex
+est
+establish
+establish
+estat
+estat
+esteem
+esteem
+esteemeth
+esteem
+esteem
+estim
+estim
+estim
+estim
+estim
+estrang
+estridg
+estridg
+et
+etc
+etcetera
+et
+etern
+etern
+etern
+etern
+eterniz
+et
+ethiop
+ethiop
+ethiop
+ethiopian
+etna
+eton
+etr
+eunuch
+eunuch
+euphrat
+euphroniu
+euriphil
+europa
+europ
+ev
+evad
+evad
+evan
+evas
+evas
+ev
+even
+even
+evenli
+event
+event
+event
+ever
+everlast
+everlastingli
+evermor
+everi
+everyon
+everyth
+everywher
+evid
+evid
+evid
+evil
+evilli
+evil
+evit
+ew
+ewer
+ewer
+ew
+exact
+exact
+exactest
+exact
+exact
+exact
+exactli
+exact
+exalt
+exalt
+examin
+examin
+examin
+examin
+examin
+examin
+exampl
+exampl
+exampl
+exampl
+exasper
+exasper
+exce
+exceed
+exceedeth
+exceed
+exceedingli
+exce
+excel
+excel
+excel
+excel
+excel
+excel
+excel
+excel
+excel
+except
+except
+except
+except
+except
+exceptless
+excess
+excess
+exchang
+exchang
+exchang
+exchequ
+exchequ
+excit
+excit
+excit
+excit
+exclaim
+exclaim
+exclam
+exclam
+exclud
+excommun
+excommun
+excrement
+excrement
+excurs
+excurs
+excu
+excus
+excus
+excus
+excus
+excusez
+excus
+execr
+execr
+execut
+execut
+execut
+execut
+execution
+execution
+executor
+executor
+exempt
+exempt
+exequi
+exercis
+exercis
+exet
+exeunt
+exhal
+exhal
+exhal
+exhal
+exhal
+exhaust
+exhibit
+exhibit
+exhibit
+exhort
+exhort
+exig
+exil
+exil
+exil
+exion
+exist
+exist
+exit
+exit
+exorcis
+exorc
+exorcist
+expect
+expect
+expect
+expect
+expect
+expect
+expect
+expect
+expect
+expedi
+expedi
+expedi
+expedit
+expediti
+expel
+expel
+expel
+expel
+expend
+expens
+expens
+experienc
+experi
+experi
+experi
+experiment
+experi
+expert
+expert
+expiat
+expiat
+expir
+expir
+expir
+expir
+expir
+expir
+explic
+exploit
+exploit
+expo
+expos
+expos
+exposit
+expositor
+expostul
+expostul
+expostur
+exposur
+expound
+expound
+express
+express
+expresseth
+express
+express
+expressli
+expressur
+expul
+expuls
+exquisit
+exsuffl
+extant
+extempor
+extempor
+extempor
+extend
+extend
+extend
+extent
+extenu
+extenu
+extenu
+extenu
+exterior
+exteriorli
+exterior
+extermin
+extern
+extern
+extinct
+extinct
+extinctur
+extinguish
+extirp
+extirp
+extirp
+extol
+extol
+extol
+exton
+extort
+extort
+extort
+extort
+extra
+extract
+extract
+extract
+extraordinarili
+extraordinari
+extraught
+extravag
+extravag
+extrem
+extrem
+extrem
+extremest
+extrem
+extrem
+exuent
+exult
+exult
+ey
+eya
+eyas
+ey
+eyebal
+eyebal
+eyebrow
+eyebrow
+ei
+eyeless
+eyelid
+eyelid
+ey
+eyesight
+eyestr
+ei
+eyn
+eyri
+fa
+fabian
+fabl
+fabl
+fabric
+fabul
+fac
+face
+face
+facer
+face
+faciant
+facil
+facil
+facineri
+face
+facit
+fact
+faction
+factionari
+faction
+factiou
+factor
+factor
+faculti
+faculti
+fade
+fade
+fadeth
+fadg
+fade
+fade
+fadom
+fadom
+fagot
+fagot
+fail
+fail
+fail
+fain
+faint
+faint
+fainter
+faint
+faintli
+faint
+faint
+fair
+fairer
+fairest
+fairi
+fair
+fair
+fairli
+fair
+fair
+fairwel
+fairi
+fai
+fait
+fait
+faith
+faith
+faithful
+faithfulli
+faithless
+faith
+faitor
+fal
+falchion
+falcon
+falconbridg
+falcon
+falcon
+fall
+fallaci
+fallen
+falleth
+falliabl
+fallibl
+fall
+fallow
+fallow
+fall
+falli
+falor
+fals
+falsehood
+fals
+fals
+falser
+falsifi
+fals
+falstaff
+falstaff
+falter
+fam
+fame
+fame
+familiar
+familiar
+familiarli
+familiar
+famili
+famin
+famish
+famish
+famou
+famous
+famous
+fan
+fanat
+fanci
+fanci
+fane
+fane
+fang
+fangl
+fangless
+fang
+fann
+fan
+fan
+fantasi
+fantasi
+fantast
+fantast
+fantast
+fantastico
+fantasi
+fap
+far
+farborough
+farc
+fardel
+fardel
+fare
+fare
+farewel
+farewel
+farin
+fare
+farm
+farmer
+farmhous
+farm
+farr
+farrow
+farther
+farthest
+farth
+farthingal
+farthingal
+farth
+fartuou
+fa
+fashion
+fashion
+fashion
+fashion
+fast
+fast
+fasten
+fasten
+faster
+fastest
+fast
+fastli
+fastolf
+fast
+fat
+fatal
+fatal
+fate
+fate
+fate
+father
+father
+fatherless
+fatherli
+father
+fathom
+fathomless
+fathom
+fatig
+fat
+fat
+fat
+fatter
+fattest
+fat
+fatuu
+fauconbridg
+faulconbridg
+fault
+faulti
+faultless
+fault
+faulti
+fauss
+faust
+faustus
+faut
+favor
+favor
+favor
+favor
+favour
+favour
+favour
+favouredli
+favour
+favour
+favour
+favourit
+favourit
+favour
+favout
+fawn
+fawneth
+fawn
+fawn
+fai
+fe
+fealti
+fear
+fear
+fearest
+fear
+fearful
+fearfulli
+fear
+fear
+fearless
+fear
+feast
+feast
+feast
+feast
+feat
+feat
+feater
+feather
+feather
+feather
+featli
+feat
+featur
+featur
+featur
+featureless
+featur
+februari
+feck
+fed
+fedari
+federari
+fee
+feebl
+feebl
+feebl
+feebl
+feebli
+feed
+feeder
+feeder
+feedeth
+feed
+feed
+feel
+feeler
+feel
+feelingli
+feel
+fee
+feet
+fehement
+feign
+feign
+feign
+feil
+feith
+felicit
+felic
+fell
+fellest
+felli
+fellow
+fellowli
+fellow
+fellowship
+fellowship
+fell
+felon
+feloni
+feloni
+felt
+femal
+femal
+feminin
+fen
+fenc
+fenc
+fencer
+fenc
+fend
+fennel
+fenni
+fen
+fenton
+fer
+ferdinand
+fere
+fernse
+ferrara
+ferrer
+ferret
+ferri
+ferryman
+fertil
+fertil
+fervenc
+fervour
+feri
+fest
+fest
+fester
+festin
+festin
+festiv
+festiv
+fet
+fetch
+fetch
+fetch
+fetlock
+fetlock
+fett
+fetter
+fetter
+fetter
+fettl
+feu
+feud
+fever
+fever
+fever
+few
+fewer
+fewest
+few
+fickl
+fickl
+fico
+fiction
+fiddl
+fiddler
+fiddlestick
+fidel
+fidelicet
+fidel
+fidiu
+fie
+field
+field
+field
+fiend
+fiend
+fierc
+fierc
+fierc
+fieri
+fife
+fife
+fifteen
+fifteen
+fifteenth
+fifth
+fifti
+fiftyfold
+fig
+fight
+fighter
+fightest
+fighteth
+fight
+fight
+figo
+fig
+figur
+figur
+figur
+figur
+figur
+fike
+fil
+filbert
+filch
+filch
+filch
+file
+file
+file
+filial
+filiu
+fill
+fill
+fillet
+fill
+fillip
+fill
+filli
+film
+fil
+filth
+filth
+filthi
+fin
+final
+finch
+find
+finder
+findeth
+find
+find
+find
+fine
+fineless
+fine
+finem
+fine
+finer
+fine
+finest
+fing
+finger
+finger
+finger
+fingr
+fingr
+finic
+finish
+finish
+finish
+finless
+finn
+fin
+finsburi
+fir
+firago
+fire
+firebrand
+firebrand
+fire
+fire
+firework
+firework
+fire
+firk
+firm
+firmament
+firmli
+firm
+first
+firstl
+fish
+fisher
+fishermen
+fisher
+fish
+fishifi
+fishmong
+fishpond
+fisnomi
+fist
+fist
+fist
+fistula
+fit
+fitchew
+fit
+fitli
+fitment
+fit
+fit
+fit
+fitter
+fittest
+fitteth
+fit
+fitzwat
+five
+fivep
+five
+fix
+fix
+fix
+fixeth
+fix
+fixtur
+fl
+flag
+flag
+flagon
+flagon
+flag
+flail
+flake
+flaki
+flam
+flame
+flamen
+flamen
+flame
+flame
+flaminiu
+flander
+flannel
+flap
+flare
+flash
+flash
+flash
+flask
+flat
+flatli
+flat
+flat
+flatt
+flatter
+flatter
+flatter
+flatter
+flatterest
+flatteri
+flatter
+flatter
+flatteri
+flaunt
+flavio
+flaviu
+flaw
+flaw
+flax
+flaxen
+flai
+flai
+flea
+fleanc
+flea
+fleck
+fled
+fledg
+flee
+fleec
+fleec
+fleec
+fleer
+fleer
+fleer
+fleet
+fleeter
+fleet
+fleme
+flemish
+flesh
+flesh
+fleshli
+fleshment
+fleshmong
+flew
+flexibl
+flexur
+flibbertigibbet
+flicker
+flidg
+flier
+fli
+flieth
+flight
+flight
+flighti
+flinch
+fling
+flint
+flint
+flinti
+flirt
+float
+float
+float
+flock
+flock
+flood
+floodgat
+flood
+floor
+flora
+florenc
+florentin
+florentin
+florentiu
+florizel
+flote
+floulish
+flour
+flourish
+flourish
+flourisheth
+flourish
+flout
+flout
+flout
+flout
+flow
+flow
+flower
+floweret
+flower
+flow
+flown
+flow
+fluellen
+fluent
+flung
+flush
+flush
+fluster
+flute
+flute
+flutter
+flux
+fluxiv
+fly
+fly
+fo
+foal
+foal
+foam
+foam
+foam
+foam
+foami
+fob
+foc
+fodder
+foe
+foeman
+foemen
+foe
+fog
+foggi
+fog
+foh
+foi
+foil
+foil
+foil
+foin
+foin
+foin
+foi
+foison
+foison
+foist
+foix
+fold
+fold
+fold
+folio
+folk
+folk
+folli
+follow
+follow
+follow
+follow
+followest
+follow
+follow
+folli
+fond
+fonder
+fondli
+fond
+font
+fontibel
+food
+fool
+fooleri
+fooleri
+foolhardi
+fool
+foolish
+foolishli
+foolish
+fool
+foot
+footbal
+footboi
+footboi
+foot
+footfal
+foot
+footman
+footmen
+footpath
+footstep
+footstool
+fopp
+fop
+fopperi
+foppish
+fop
+for
+forag
+forag
+forbad
+forbear
+forbear
+forbear
+forbid
+forbidden
+forbiddenli
+forbid
+forbod
+forborn
+forc
+forc
+forc
+forc
+forceless
+forc
+forcibl
+forcibl
+forc
+ford
+fordid
+fordo
+fordo
+fordon
+fore
+forecast
+forefath
+forefath
+forefing
+forego
+foregon
+forehand
+forehead
+forehead
+forehors
+foreign
+foreign
+foreign
+foreknow
+foreknowledg
+foremost
+forenam
+forenoon
+forerun
+forerunn
+forerun
+forerun
+foresaid
+foresaw
+foresai
+forese
+forese
+forese
+foreshow
+foreskirt
+foresp
+forest
+forestal
+forestal
+forest
+forest
+forest
+foretel
+foretel
+foretel
+forethink
+forethought
+foretold
+forev
+foreward
+forewarn
+forewarn
+forewarn
+forfeit
+forfeit
+forfeit
+forfeit
+forfeit
+forfeitur
+forfeitur
+forfend
+forfend
+forg
+forgav
+forg
+forg
+forgeri
+forgeri
+forg
+forget
+forget
+forget
+forget
+forget
+forget
+forgiv
+forgiven
+forgiv
+forgo
+forgo
+forgon
+forgot
+forgotten
+fork
+fork
+fork
+forlorn
+form
+formal
+formal
+form
+former
+formerli
+formless
+form
+fornic
+fornic
+fornicatress
+forr
+forrest
+forsak
+forsaken
+forsaketh
+forslow
+forsook
+forsooth
+forspent
+forspok
+forswear
+forswear
+forswor
+forsworn
+fort
+fort
+forth
+forthcom
+forthlight
+forthright
+forthwith
+fortif
+fortif
+fortifi
+fortifi
+fortifi
+fortinbra
+fortitud
+fortnight
+fortress
+fortress
+fort
+fortun
+fortuna
+fortun
+fortun
+fortun
+fortun
+fortun
+fortward
+forti
+forum
+forward
+forward
+forward
+forward
+forweari
+fosset
+fost
+foster
+foster
+fought
+foughten
+foul
+fouler
+foulest
+foulli
+foul
+found
+foundat
+foundat
+found
+founder
+fount
+fountain
+fountain
+fount
+four
+fourscor
+fourteen
+fourth
+foutra
+fowl
+fowler
+fowl
+fowl
+fox
+fox
+foxship
+fract
+fraction
+fraction
+fragil
+fragment
+fragment
+fragrant
+frail
+frailer
+frailti
+frailti
+fram
+frame
+frame
+frame
+frampold
+fran
+francai
+franc
+franc
+franchis
+franchis
+franchis
+franchis
+francia
+franci
+francisca
+franciscan
+francisco
+frank
+franker
+frankfort
+franklin
+franklin
+frankli
+frank
+frantic
+franticli
+frateretto
+fratrum
+fraud
+fraud
+fraught
+fraughtag
+fraught
+frai
+frai
+freckl
+freckl
+freckl
+frederick
+free
+freed
+freedom
+freedom
+freeheart
+freelier
+freeli
+freeman
+freemen
+freeness
+freer
+free
+freeston
+freetown
+freez
+freez
+freez
+freez
+french
+frenchman
+frenchmen
+frenchwoman
+frenzi
+frequent
+frequent
+fresh
+fresher
+fresh
+freshest
+freshli
+fresh
+fret
+fret
+fret
+fret
+fretten
+fret
+friar
+friar
+fridai
+fridai
+friend
+friend
+friend
+friendless
+friendli
+friendli
+friend
+friendship
+friendship
+friez
+fright
+fright
+frighten
+fright
+fright
+fright
+fring
+fring
+fripperi
+frisk
+fritter
+frivol
+fro
+frock
+frog
+frogmor
+froissart
+frolic
+from
+front
+front
+frontier
+frontier
+front
+frontlet
+front
+frost
+frost
+frosti
+froth
+froward
+frown
+frown
+frowningli
+frown
+froze
+frozen
+fructifi
+frugal
+fruit
+fruiter
+fruit
+fruitfulli
+fruit
+fruition
+fruitless
+fruit
+frush
+frustrat
+frutifi
+fry
+fubb
+fuel
+fugit
+fulfil
+fulfil
+fulfil
+fulfil
+full
+fullam
+fuller
+fuller
+fullest
+full
+fulli
+ful
+fulsom
+fulvia
+fum
+fumbl
+fumbl
+fumblest
+fumbl
+fume
+fume
+fume
+fumit
+fumitori
+fun
+function
+function
+fundament
+funer
+funer
+fur
+furbish
+furi
+furiou
+furlong
+furnac
+furnac
+furnish
+furnish
+furnish
+furnitur
+furniv
+furor
+furr
+furrow
+furrow
+furrow
+furth
+further
+further
+further
+furthermor
+furthest
+furi
+furz
+furz
+fust
+fustian
+fustilarian
+fusti
+fut
+futur
+futur
+g
+gabbl
+gaberdin
+gabriel
+gad
+gad
+gad
+gadshil
+gag
+gage
+gage
+gagg
+gage
+gagn
+gain
+gain
+gainer
+gaingiv
+gain
+gainsaid
+gainsai
+gainsai
+gainsai
+gainst
+gait
+gait
+galath
+gale
+galen
+gale
+gall
+gallant
+gallantli
+gallantri
+gallant
+gall
+galleri
+gallei
+gallei
+gallia
+gallian
+galliard
+galliass
+gallimaufri
+gall
+gallon
+gallop
+gallop
+gallop
+gallow
+gallowai
+gallowglass
+gallow
+gallows
+gall
+gallu
+gam
+gambol
+gambold
+gambol
+gamboi
+game
+gamer
+game
+gamesom
+gamest
+game
+gammon
+gamut
+gan
+gangren
+ganymed
+gaol
+gaoler
+gaoler
+gaol
+gap
+gape
+gape
+gape
+gar
+garb
+garbag
+garboil
+garcon
+gard
+gard
+garden
+garden
+garden
+garden
+gardez
+gardin
+gardon
+gargantua
+gargrav
+garish
+garland
+garland
+garlic
+garment
+garment
+garmet
+garner
+garner
+garnish
+garnish
+garret
+garrison
+garrison
+gart
+garter
+garterd
+garter
+garter
+gasconi
+gash
+gash
+gaskin
+gasp
+gasp
+gast
+gast
+gat
+gate
+gate
+gate
+gath
+gather
+gather
+gather
+gather
+gatori
+gatori
+gaud
+gaudeo
+gaudi
+gaug
+gaul
+gaultre
+gaunt
+gauntlet
+gauntlet
+gav
+gave
+gavest
+gawd
+gawd
+gawsei
+gai
+gay
+gaz
+gaze
+gaze
+gazer
+gazer
+gaze
+gazeth
+gaze
+gear
+geck
+gees
+geffrei
+geld
+geld
+geld
+gelida
+gelidu
+gelt
+gem
+gemini
+gem
+gen
+gender
+gender
+gener
+gener
+gener
+gener
+gener
+gener
+generos
+gener
+genit
+genitivo
+geniu
+gennet
+genoa
+genoux
+gen
+gent
+gentilhomm
+gentil
+gentl
+gentlefolk
+gentleman
+gentlemanlik
+gentlemen
+gentl
+gentler
+gentl
+gentlest
+gentlewoman
+gentlewomen
+gentli
+gentri
+georg
+gerard
+germain
+germain
+german
+german
+german
+germani
+gertrud
+gest
+gest
+gestur
+gestur
+get
+getrud
+get
+getter
+get
+ghastli
+ghost
+ghost
+ghostli
+ghost
+gi
+giant
+giantess
+giantlik
+giant
+gib
+gibber
+gibbet
+gibbet
+gibe
+giber
+gibe
+gibe
+gibingli
+giddili
+giddi
+giddi
+gift
+gift
+gig
+giglet
+giglot
+gilbert
+gild
+gild
+gild
+gilliam
+gillian
+gill
+gillyvor
+gilt
+gimmal
+gimmer
+gin
+ging
+ginger
+gingerbread
+gingerli
+ginn
+gin
+gioucestershir
+gipe
+gipsi
+gipsi
+gird
+gird
+girdl
+girdl
+girdl
+girdl
+girl
+girl
+girt
+girth
+gi
+giv
+give
+given
+giver
+giver
+give
+givest
+giveth
+give
+give
+glad
+glad
+glad
+gladli
+glad
+glami
+glanc
+glanc
+glanc
+glanc
+glanc
+glander
+glansdal
+glare
+glare
+glass
+glass
+glassi
+glaz
+glaze
+gleam
+glean
+glean
+glean
+gleeful
+gleek
+gleek
+gleek
+glend
+glendow
+glib
+glide
+glide
+glide
+glideth
+glide
+glimmer
+glimmer
+glimmer
+glimps
+glimps
+glist
+glisten
+glister
+glister
+glister
+glitt
+glitter
+globe
+globe
+gloom
+gloomi
+glori
+glorifi
+glorifi
+gloriou
+glorious
+glori
+glose
+gloss
+gloss
+glou
+gloucest
+gloucest
+gloucestershir
+glove
+glover
+glove
+glow
+glow
+glow
+glowworm
+gloz
+gloze
+gloze
+glu
+glue
+glu
+glue
+glut
+glutt
+glut
+glutton
+glutton
+gluttoni
+gnarl
+gnarl
+gnat
+gnat
+gnaw
+gnaw
+gnawn
+gnaw
+go
+goad
+goad
+goad
+goal
+goat
+goatish
+goat
+gobbet
+gobbo
+goblet
+goblet
+goblin
+goblin
+god
+god
+godden
+goddess
+goddess
+goddild
+godfath
+godfath
+godhead
+godlik
+godli
+godli
+godmoth
+god
+godson
+goer
+goer
+goe
+goest
+goeth
+goff
+gog
+go
+gold
+golden
+goldenli
+goldsmith
+goldsmith
+golgotha
+golias
+goliath
+gon
+gondola
+gondoli
+gone
+goneril
+gong
+gonzago
+gonzalo
+good
+goodfellow
+goodlier
+goodliest
+goodli
+goodman
+good
+goodnight
+goodrig
+good
+goodwif
+goodwil
+goodwin
+goodwin
+goodyear
+goodyear
+goos
+gooseberri
+goosequil
+goot
+gor
+gorbelli
+gorboduc
+gordian
+gore
+gore
+gorg
+gorg
+gorgeou
+gorget
+gorg
+gorgon
+gormand
+gormand
+gori
+gosl
+gospel
+gospel
+goss
+gossam
+gossip
+gossip
+gossiplik
+gossip
+got
+goth
+goth
+gotten
+gourd
+gout
+gout
+gouti
+govern
+govern
+govern
+gover
+govern
+governor
+governor
+govern
+gower
+gown
+gown
+grac
+grace
+grace
+grace
+gracefulli
+graceless
+grace
+grace
+graciou
+gracious
+gradat
+graff
+graf
+graft
+graft
+grafter
+grain
+grain
+grain
+gramerci
+gramerci
+grammar
+grand
+grandam
+grandam
+grandchild
+grand
+grandeur
+grandfath
+grandjuror
+grandmoth
+grandpr
+grandsir
+grandsir
+grandsir
+grang
+grant
+grant
+grant
+grant
+grape
+grape
+grappl
+grappl
+grappl
+grasp
+grasp
+grasp
+grass
+grasshopp
+grassi
+grate
+grate
+grate
+grate
+gratiano
+gratifi
+gratii
+gratil
+grate
+grati
+gratitud
+gratul
+grav
+grave
+gravedigg
+gravel
+graveless
+gravel
+grave
+graven
+grave
+graver
+grave
+gravest
+graveston
+graviti
+graviti
+gravi
+grai
+graymalkin
+graz
+graze
+graze
+graze
+greas
+greas
+greasili
+greasi
+great
+greater
+greatest
+greatli
+great
+grecian
+grecian
+gree
+greec
+greed
+greedili
+greedi
+greedi
+gree
+greek
+greekish
+greek
+green
+greener
+greenli
+green
+greensleev
+greenwich
+greenwood
+greet
+greet
+greet
+greet
+greet
+greg
+gregori
+gremio
+grew
+grei
+greybeard
+greybeard
+greyhound
+greyhound
+grief
+grief
+griev
+grievanc
+grievanc
+griev
+griev
+griev
+grievest
+griev
+grievingli
+grievou
+grievous
+griffin
+griffith
+grim
+grime
+grimli
+grin
+grind
+grind
+grindston
+grin
+grip
+gripe
+gripe
+gripe
+grise
+grisli
+grissel
+grize
+grizzl
+grizzl
+groan
+groan
+groan
+groat
+groat
+groin
+groom
+groom
+grop
+grope
+gro
+gross
+grosser
+grossli
+gross
+ground
+ground
+groundl
+ground
+grove
+grovel
+grovel
+grove
+grow
+groweth
+grow
+grown
+grow
+growth
+grub
+grubb
+grub
+grudg
+grudg
+grudg
+grudg
+gruel
+grumbl
+grumblest
+grumbl
+grumbl
+grumio
+grund
+grunt
+gualtier
+guard
+guardag
+guardant
+guard
+guardian
+guardian
+guard
+guardsman
+gud
+gudgeon
+guerdon
+guerra
+guess
+guess
+guessingli
+guest
+guest
+guiana
+guichard
+guid
+guid
+guider
+guideriu
+guid
+guid
+guidon
+guienn
+guil
+guildenstern
+guilder
+guildford
+guildhal
+guil
+guil
+guil
+guilford
+guilt
+guiltian
+guiltier
+guiltili
+guilti
+guiltless
+guilt
+guilti
+guinea
+guinev
+guis
+gul
+gule
+gulf
+gulf
+gull
+gull
+gum
+gumm
+gum
+gun
+gunner
+gunpowd
+gun
+gurnet
+gurnei
+gust
+gust
+gusti
+gut
+gutter
+gui
+guyn
+guysor
+gypsi
+gyve
+gyve
+gyve
+h
+ha
+haberdash
+habili
+habili
+habit
+habit
+habit
+habit
+habitud
+hack
+hacket
+hacknei
+hack
+had
+hadst
+haec
+haer
+hag
+hagar
+haggard
+haggard
+haggish
+haggl
+hag
+hail
+hail
+hailston
+hailston
+hair
+hairless
+hair
+hairi
+hal
+halberd
+halberd
+halcyon
+hale
+hale
+hale
+half
+halfcan
+halfpenc
+halfpenni
+halfpennyworth
+halfwai
+halidom
+hall
+halloa
+hallo
+hallond
+halloo
+halloo
+hallow
+hallow
+hallowma
+hallown
+hal
+halt
+halter
+halter
+halt
+halt
+halv
+ham
+hame
+hamlet
+hammer
+hammer
+hammer
+hammer
+hamper
+hampton
+ham
+hamstr
+hand
+hand
+hand
+handicraft
+handicraftsmen
+hand
+handiwork
+handkerch
+handkerch
+handkerchief
+handl
+handl
+handl
+handless
+handlest
+handl
+handmaid
+handmaid
+hand
+handsaw
+handsom
+handsom
+handsom
+handwrit
+handi
+hang
+hang
+hanger
+hangeth
+hang
+hang
+hangman
+hangmen
+hang
+hannib
+hap
+hapless
+hapli
+happ
+happen
+happen
+happier
+happi
+happiest
+happili
+happi
+happi
+hap
+harbing
+harbing
+harbor
+harbour
+harbourag
+harbour
+harbour
+harcourt
+hard
+harder
+hardest
+hardiest
+hardiment
+hardi
+hardli
+hard
+hardock
+hardi
+hare
+harelip
+hare
+harfleur
+hark
+harlot
+harlotri
+harlot
+harm
+harm
+harm
+harm
+harmless
+harmoni
+harmoni
+harm
+har
+harp
+harper
+harpier
+harp
+harpi
+harri
+harrow
+harrow
+harri
+harsh
+harshli
+harsh
+hart
+hart
+harum
+harvest
+ha
+hast
+hast
+hast
+hasten
+hast
+hastili
+hast
+hast
+hasti
+hat
+hatch
+hatch
+hatchet
+hatch
+hatchment
+hate
+hate
+hate
+hater
+hater
+hate
+hateth
+hatfield
+hath
+hate
+hatr
+hat
+haud
+hauf
+haught
+haughti
+haughti
+haunch
+haunch
+haunt
+haunt
+haunt
+haunt
+hautboi
+hautboi
+have
+haven
+haven
+haver
+have
+have
+havior
+haviour
+havoc
+hawk
+hawk
+hawk
+hawthorn
+hawthorn
+hai
+hazard
+hazard
+hazard
+hazel
+hazelnut
+he
+head
+headborough
+head
+headier
+head
+headland
+headless
+headlong
+head
+headsman
+headstrong
+headi
+heal
+heal
+heal
+heal
+health
+health
+health
+healthsom
+healthi
+heap
+heap
+heap
+hear
+heard
+hearer
+hearer
+hearest
+heareth
+hear
+hear
+heark
+hearken
+hearken
+hear
+hearsai
+hears
+hears
+hearst
+heart
+heartach
+heartbreak
+heartbreak
+heart
+hearten
+hearth
+hearth
+heartili
+hearti
+heartless
+heartl
+heartli
+heart
+heartsick
+heartstr
+hearti
+heat
+heat
+heath
+heathen
+heathenish
+heat
+heat
+heauti
+heav
+heav
+heav
+heaven
+heavenli
+heaven
+heav
+heavier
+heaviest
+heavili
+heavi
+heav
+heav
+heavi
+hebona
+hebrew
+hecat
+hectic
+hector
+hector
+hecuba
+hedg
+hedg
+hedgehog
+hedgehog
+hedg
+heed
+heed
+heed
+heedful
+heedfulli
+heedless
+heel
+heel
+heft
+heft
+heifer
+heifer
+heigh
+height
+heighten
+heinou
+heinous
+heir
+heiress
+heirless
+heir
+held
+helen
+helena
+helenu
+helia
+helicon
+hell
+hellespont
+hellfir
+hellish
+helm
+helm
+helmet
+helmet
+helm
+help
+helper
+helper
+help
+help
+helpless
+help
+helter
+hem
+heme
+hemlock
+hemm
+hemp
+hempen
+hem
+hen
+henc
+henceforth
+henceforward
+henchman
+henri
+henricu
+henri
+hen
+hent
+henton
+her
+herald
+heraldri
+herald
+herb
+herbert
+herblet
+herb
+herculean
+hercul
+herd
+herd
+herdsman
+herdsmen
+here
+hereabout
+hereabout
+hereaft
+herebi
+hereditari
+hereford
+herefordshir
+herein
+hereof
+heresi
+heresi
+heret
+heret
+hereto
+hereupon
+heritag
+heriti
+herm
+hermia
+hermion
+hermit
+hermitag
+hermit
+hern
+hero
+herod
+herod
+hero
+heroic
+heroic
+her
+her
+her
+herself
+hesperid
+hesperu
+hest
+hest
+heur
+heureux
+hew
+hewgh
+hew
+hewn
+hew
+hei
+heydai
+hibocr
+hic
+hiccup
+hick
+hid
+hidden
+hide
+hideou
+hideous
+hideous
+hide
+hidest
+hide
+hie
+hi
+hiem
+hi
+hig
+high
+higher
+highest
+highli
+highmost
+high
+hight
+highwai
+highwai
+hild
+hild
+hill
+hillo
+hilloa
+hill
+hilt
+hilt
+hili
+him
+himself
+hinc
+hincklei
+hind
+hinder
+hinder
+hinder
+hindmost
+hind
+hing
+hing
+hing
+hint
+hip
+hipp
+hipparchu
+hippolyta
+hip
+hir
+hire
+hire
+hiren
+hirtiu
+hi
+hisperia
+hiss
+hiss
+hiss
+hist
+histor
+histori
+hit
+hither
+hitherto
+hitherward
+hitherward
+hit
+hit
+hive
+hive
+hizz
+ho
+hoa
+hoar
+hoard
+hoard
+hoard
+hoar
+hoars
+hoari
+hob
+hobbidid
+hobbi
+hobbyhors
+hobgoblin
+hobnail
+hoc
+hod
+hodg
+hog
+hog
+hogshead
+hogshead
+hoi
+hois
+hoist
+hoist
+hoist
+holborn
+hold
+holden
+holder
+holdeth
+holdfast
+hold
+hold
+hole
+hole
+holidam
+holidam
+holidai
+holidai
+holier
+holiest
+holili
+holi
+holla
+holland
+holland
+holland
+holloa
+holloa
+hollow
+hollowli
+hollow
+holli
+holmedon
+holofern
+holp
+holi
+homag
+homag
+home
+home
+home
+homespun
+homeward
+homeward
+homicid
+homicid
+homili
+hominem
+homm
+homo
+honest
+honest
+honestest
+honestli
+honesti
+honei
+honeycomb
+honei
+honeyless
+honeysuckl
+honeysuckl
+honi
+honneur
+honor
+honor
+honor
+honorato
+honorificabilitudinitatibu
+honor
+honour
+honour
+honour
+honour
+honourest
+honour
+honour
+honour
+hoo
+hood
+hood
+hoodman
+hood
+hoodwink
+hoof
+hoof
+hook
+hook
+hook
+hoop
+hoop
+hoot
+hoot
+hoot
+hoot
+hop
+hope
+hope
+hopeless
+hope
+hopest
+hope
+hopkin
+hopped
+hor
+horac
+horatio
+horizon
+horn
+hornbook
+horn
+horner
+horn
+hornpip
+horn
+horolog
+horribl
+horribl
+horrid
+horrid
+horridli
+horror
+horror
+hor
+hors
+horseback
+hors
+horsehair
+horseman
+horsemanship
+horsemen
+hors
+horsewai
+hors
+hortensio
+hortensiu
+horum
+hose
+hospit
+hospit
+hospit
+host
+hostag
+hostag
+hostess
+hostil
+hostil
+hostiliu
+host
+hot
+hotli
+hotspur
+hotter
+hottest
+hound
+hound
+hour
+hourli
+hour
+hou
+hous
+household
+household
+household
+household
+housekeep
+housekeep
+housekeep
+houseless
+hous
+housewif
+housewiferi
+housew
+hovel
+hover
+hover
+hover
+hover
+how
+howbeit
+how
+howeer
+howev
+howl
+howl
+howlet
+howl
+howl
+howso
+howsoev
+howsom
+hox
+hoi
+hoydai
+hubert
+huddl
+huddl
+hue
+hu
+hue
+hug
+huge
+huge
+huge
+hugg
+hugger
+hugh
+hug
+huju
+hulk
+hulk
+hull
+hull
+hullo
+hum
+human
+human
+human
+human
+humbl
+humbl
+humbl
+humbler
+humbl
+humblest
+humbl
+humbl
+hume
+humh
+humid
+humil
+hum
+humor
+humor
+humor
+humour
+humourist
+humour
+humphrei
+humphri
+hum
+hundr
+hundr
+hundredth
+hung
+hungarian
+hungari
+hunger
+hungerford
+hungerli
+hungri
+hunt
+hunt
+hunter
+hunter
+hunteth
+hunt
+huntington
+huntress
+hunt
+huntsman
+huntsmen
+hurdl
+hurl
+hurl
+hurl
+hurli
+hurlyburli
+hurricano
+hurricano
+hurri
+hurri
+hurri
+hurt
+hurt
+hurtl
+hurtless
+hurtl
+hurt
+husband
+husband
+husbandless
+husbandri
+husband
+hush
+hush
+husht
+husk
+huswif
+huswif
+hutch
+hybla
+hydra
+hyen
+hymen
+hymenaeu
+hymn
+hymn
+hyperbol
+hyperbol
+hyperion
+hypocrisi
+hypocrit
+hypocrit
+hyrcan
+hyrcania
+hyrcanian
+hyssop
+hysterica
+i
+iachimo
+iaculi
+iago
+iament
+ibat
+icaru
+ic
+iceland
+ici
+icicl
+icicl
+ici
+idea
+idea
+idem
+iden
+id
+idiot
+idiot
+idl
+idl
+idl
+idli
+idol
+idolatr
+idolatri
+ield
+if
+if
+igni
+ignobl
+ignobl
+ignomini
+ignomini
+ignomi
+ignor
+ignor
+ii
+iii
+iiii
+il
+ilbow
+ild
+ilion
+ilium
+ill
+illegitim
+illiter
+ill
+illo
+ill
+illum
+illumin
+illumin
+illumineth
+illus
+illus
+illustr
+illustr
+illustri
+illyria
+illyrian
+il
+im
+imag
+imageri
+imag
+imagin
+imaginari
+imagin
+imagin
+imagin
+imagin
+imagin
+imbar
+imbecil
+imbru
+imitari
+imit
+imit
+imit
+imit
+immacul
+imman
+immask
+immateri
+immediaci
+immedi
+immedi
+immin
+immin
+immoder
+immoder
+immodest
+immoment
+immort
+immortaliz
+immort
+immur
+immur
+immur
+imogen
+imp
+impaint
+impair
+impair
+impal
+impal
+impanel
+impart
+impart
+imparti
+impart
+impart
+impast
+impati
+impati
+impati
+impawn
+impeach
+impeach
+impeach
+impeach
+imped
+impedi
+impedi
+impenetr
+imper
+imperceiver
+imperfect
+imperfect
+imperfect
+imperfectli
+imperi
+imperi
+imperi
+impertin
+impertin
+impetico
+impetuos
+impetu
+impieti
+impieti
+impiou
+implac
+implement
+impli
+implor
+implor
+implor
+implor
+implor
+impon
+import
+import
+import
+import
+importantli
+import
+importeth
+import
+importless
+import
+importun
+importunaci
+importun
+importun
+importun
+importun
+impo
+impos
+impos
+imposit
+imposit
+imposs
+imposs
+imposs
+imposthum
+impostor
+impostor
+impot
+impot
+impound
+impregn
+impres
+impress
+impress
+impressest
+impress
+impressur
+imprimendum
+imprimi
+imprint
+imprint
+imprison
+imprison
+imprison
+imprison
+improb
+improp
+improv
+improvid
+impud
+impud
+impud
+impud
+impudiqu
+impugn
+impugn
+impur
+imput
+imput
+in
+inaccess
+inaid
+inaud
+inauspici
+incag
+incant
+incap
+incardin
+incarnadin
+incarn
+incarn
+incen
+incens
+incens
+incens
+incens
+incens
+incertain
+incertainti
+incertainti
+incess
+incessantli
+incest
+incestu
+inch
+incharit
+inch
+incid
+incid
+incis
+incit
+incit
+incivil
+incivil
+inclin
+inclin
+inclin
+inclin
+inclin
+inclin
+inclin
+inclip
+includ
+includ
+includ
+inclus
+incompar
+incomprehens
+inconsider
+inconst
+inconst
+incontin
+incontin
+incontin
+inconveni
+inconveni
+inconveni
+inconi
+incorpor
+incorp
+incorrect
+increa
+increas
+increas
+increaseth
+increas
+incred
+incredul
+incur
+incur
+incurr
+incur
+incurs
+ind
+ind
+indebt
+inde
+indent
+indent
+indentur
+indentur
+index
+index
+india
+indian
+indict
+indict
+indict
+indi
+indiffer
+indiffer
+indiffer
+indig
+indigest
+indigest
+indign
+indign
+indign
+indign
+indign
+indign
+indirect
+indirect
+indirect
+indirectli
+indiscreet
+indiscret
+indispo
+indisposit
+indissolubl
+indistinct
+indistinguish
+indistinguish
+indit
+individ
+indrench
+indu
+indubit
+induc
+induc
+induc
+induc
+induct
+induct
+indu
+indu
+indu
+indulg
+indulg
+indulg
+indur
+industri
+industri
+industri
+inequ
+inestim
+inevit
+inexecr
+inexor
+inexplic
+infal
+infal
+infamon
+infam
+infami
+infanc
+infant
+infant
+infect
+infect
+infect
+infect
+infect
+infecti
+infecti
+infect
+infer
+infer
+inferior
+inferior
+infern
+inferr
+inferreth
+infer
+infest
+infidel
+infidel
+infinit
+infinit
+infinit
+infirm
+infirm
+infirm
+infix
+infix
+inflam
+inflam
+inflam
+inflamm
+inflict
+inflict
+influenc
+influenc
+infold
+inform
+inform
+inform
+inform
+inform
+inform
+inform
+infortun
+infr
+infring
+infring
+infu
+infus
+infus
+infus
+infus
+ingen
+ingeni
+ingeni
+inglori
+ingot
+ingraf
+ingraft
+ingrat
+ingrat
+ingrat
+ingratitud
+ingratitud
+ingredi
+ingredi
+ingross
+inhabit
+inhabit
+inhabit
+inhabit
+inhabit
+inhears
+inhears
+inher
+inherit
+inherit
+inherit
+inherit
+inheritor
+inheritor
+inheritrix
+inherit
+inhibit
+inhibit
+inhoop
+inhuman
+iniqu
+iniqu
+initi
+injoint
+injunct
+injunct
+injur
+injur
+injur
+injuri
+injuri
+injuri
+injustic
+ink
+inkhorn
+inkl
+inkl
+inkl
+inki
+inlaid
+inland
+inlai
+inli
+inmost
+inn
+inner
+innkeep
+innoc
+innoc
+innoc
+innoc
+innov
+innov
+inn
+innumer
+inocul
+inordin
+inprimi
+inquir
+inquir
+inquiri
+inquisit
+inquisit
+inroad
+insan
+insani
+insati
+insconc
+inscrib
+inscript
+inscript
+inscrol
+inscrut
+insculp
+insculptur
+insens
+insepar
+insepar
+insert
+insert
+inset
+inshel
+inshipp
+insid
+insinew
+insinu
+insinuateth
+insinu
+insinu
+insist
+insist
+insistur
+insoci
+insol
+insol
+insomuch
+inspir
+inspir
+inspir
+inspir
+inspir
+instal
+instal
+instal
+instanc
+instanc
+instant
+instantli
+instat
+instead
+insteep
+instig
+instig
+instig
+instig
+instig
+instinct
+instinct
+institut
+institut
+instruct
+instruct
+instruct
+instruct
+instruct
+instrument
+instrument
+instrument
+insubstanti
+insuffici
+insuffici
+insult
+insult
+insult
+insult
+insult
+insupport
+insuppress
+insurrect
+insurrect
+int
+integ
+integrita
+integr
+intellect
+intellect
+intellectu
+intellig
+intelligenc
+intelligenc
+intellig
+intelligi
+intelligo
+intemper
+intemper
+intend
+intend
+intendeth
+intend
+intend
+intend
+inten
+intent
+intent
+intent
+intent
+inter
+intercept
+intercept
+intercept
+intercept
+intercept
+intercess
+intercessor
+interchain
+interchang
+interchang
+interchang
+interchang
+interchang
+interdict
+interest
+interim
+interim
+interior
+interject
+interjoin
+interlud
+intermingl
+intermiss
+intermiss
+intermit
+intermix
+intermix
+interpos
+interpos
+interpos
+interpret
+interpret
+interpret
+interpret
+interpret
+interpret
+interr
+inter
+interrogatori
+interrupt
+interrupt
+interrupt
+interruptest
+interrupt
+interrupt
+intertissu
+intervallum
+interview
+intest
+intestin
+intil
+intim
+intim
+intitl
+intitul
+into
+intoler
+intox
+intreasur
+intreat
+intrench
+intrench
+intric
+intrins
+intrins
+intrud
+intrud
+intrud
+intrus
+inund
+inur
+inurn
+invad
+invad
+invas
+invas
+invect
+invect
+inveigl
+invent
+invent
+invent
+invent
+inventor
+inventori
+inventori
+inventor
+inventori
+inver
+invert
+invest
+invest
+invest
+invest
+inveter
+invinc
+inviol
+invis
+invis
+invit
+invit
+invit
+invit
+invit
+inviti
+invoc
+invoc
+invok
+invok
+invulner
+inward
+inwardli
+inward
+inward
+ionia
+ionian
+ips
+ipswich
+ira
+ira
+ira
+ir
+ir
+ireland
+iri
+irish
+irishman
+irishmen
+irk
+irksom
+iron
+iron
+irreconcil
+irrecover
+irregular
+irregul
+irreligi
+irremov
+irrepar
+irresolut
+irrevoc
+is
+isabel
+isabella
+isbel
+isbel
+iscariot
+is
+ish
+isidor
+isi
+island
+island
+island
+island
+isl
+isl
+israel
+issu
+issu
+issu
+issueless
+issu
+issu
+ist
+ista
+it
+italian
+itali
+itch
+itch
+itch
+item
+item
+iter
+ithaca
+it
+itself
+itshal
+iv
+ivori
+ivi
+iwi
+ix
+j
+jacet
+jack
+jackanap
+jack
+jacksauc
+jackslav
+jacob
+jade
+jade
+jade
+jail
+jake
+jamani
+jame
+jami
+jane
+jangl
+jangl
+januari
+janu
+japhet
+jaquenetta
+jaqu
+jar
+jar
+jar
+jarteer
+jason
+jaunc
+jaunc
+jaundic
+jaundi
+jaw
+jawbon
+jaw
+jai
+jai
+jc
+je
+jealou
+jealousi
+jealousi
+jeer
+jeer
+jelli
+jenni
+jeopardi
+jephtha
+jephthah
+jerkin
+jerkin
+jerk
+jeronimi
+jerusalem
+jeshu
+jess
+jessica
+jest
+jest
+jester
+jester
+jest
+jest
+jesu
+jesu
+jet
+jet
+jew
+jewel
+jewel
+jewel
+jewess
+jewish
+jewri
+jew
+jezebel
+jig
+jig
+jill
+jill
+jingl
+joan
+job
+jockei
+jocund
+jog
+jog
+john
+john
+join
+joinder
+join
+joiner
+joineth
+join
+joint
+joint
+joint
+jointli
+jointress
+joint
+jointur
+jolliti
+jolli
+jolt
+jolthead
+jordan
+joseph
+joshua
+jot
+jour
+jourdain
+journal
+journei
+journei
+journeyman
+journeymen
+journei
+jove
+jovem
+jovial
+jowl
+jowl
+joi
+joi
+joy
+joyfulli
+joyless
+joyou
+joi
+juan
+jud
+juda
+judas
+jude
+judg
+judg
+judg
+judgement
+judg
+judgest
+judg
+judgment
+judgment
+judici
+jug
+juggl
+juggl
+juggler
+juggler
+juggl
+jug
+juic
+juic
+jul
+jule
+julia
+juliet
+julietta
+julio
+juliu
+juli
+jump
+jumpeth
+jump
+jump
+june
+june
+junior
+juniu
+junket
+juno
+jupit
+jure
+jurement
+jurisdict
+juror
+juror
+juri
+jurymen
+just
+justeiu
+justest
+justic
+justic
+justic
+justic
+justif
+justifi
+justifi
+justl
+justl
+justl
+justl
+justli
+just
+just
+jut
+jutti
+juven
+kam
+kate
+kate
+kate
+katharin
+katherina
+katherin
+kecksi
+keech
+keel
+keel
+keen
+keen
+keep
+keepdown
+keeper
+keeper
+keepest
+keep
+keep
+keiser
+ken
+kendal
+kennel
+kent
+kentish
+kentishman
+kentishmen
+kept
+kerchief
+kere
+kern
+kernal
+kernel
+kernel
+kern
+kersei
+kettl
+kettledrum
+kettledrum
+kei
+kei
+kibe
+kibe
+kick
+kick
+kickshaw
+kickshaws
+kicki
+kid
+kidnei
+kike
+kildar
+kill
+kill
+killer
+killeth
+kill
+killingworth
+kill
+kiln
+kimbolton
+kin
+kind
+kinder
+kindest
+kindl
+kindl
+kindless
+kindlier
+kindl
+kindli
+kind
+kind
+kindr
+kindr
+kind
+kine
+king
+kingdom
+kingdom
+kingli
+king
+kinr
+kin
+kinsman
+kinsmen
+kinswoman
+kirtl
+kirtl
+kiss
+kiss
+kiss
+kiss
+kitchen
+kitchen
+kite
+kite
+kitten
+kj
+kl
+klll
+knack
+knack
+knapp
+knav
+knave
+knaveri
+knaveri
+knave
+knavish
+knead
+knead
+knead
+knee
+kneel
+kneel
+kneel
+knee
+knell
+knew
+knewest
+knife
+knight
+knight
+knighthood
+knighthood
+knightli
+knight
+knit
+knit
+knitter
+knitteth
+knive
+knob
+knock
+knock
+knock
+knog
+knoll
+knot
+knot
+knot
+knotti
+know
+knower
+knowest
+know
+knowingli
+know
+knowledg
+known
+know
+l
+la
+laban
+label
+label
+labienu
+labio
+labor
+labor
+labor
+labour
+labour
+labour
+labour
+labour
+labour
+laboursom
+labra
+labyrinth
+lac
+lace
+lace
+lacedaemon
+lace
+laci
+lack
+lackbeard
+lack
+lackei
+lackei
+lackei
+lack
+lack
+lad
+ladder
+ladder
+lade
+laden
+ladi
+lade
+lad
+ladi
+ladybird
+ladyship
+ladyship
+laer
+laert
+lafeu
+lag
+lag
+laid
+lain
+laissez
+lake
+lake
+lakin
+lam
+lamb
+lambert
+lambkin
+lambkin
+lamb
+lame
+lame
+lame
+lament
+lament
+lament
+lament
+lament
+lament
+lament
+lament
+lament
+lame
+lame
+lamma
+lammastid
+lamound
+lamp
+lampass
+lamp
+lanc
+lancast
+lanc
+lanc
+lanceth
+lanch
+land
+land
+land
+landless
+landlord
+landmen
+land
+lane
+lane
+langag
+langlei
+langton
+languag
+languageless
+languag
+langu
+languish
+languish
+languish
+languish
+languish
+languish
+languor
+lank
+lantern
+lantern
+lanthorn
+lap
+lapi
+lapland
+lapp
+lap
+laps
+laps
+laps
+lapw
+laquai
+lard
+larder
+lard
+lard
+larg
+larg
+larg
+larger
+largess
+largest
+lark
+lark
+larron
+lartiu
+larum
+larum
+la
+lascivi
+lash
+lass
+lass
+last
+last
+last
+lastli
+last
+latch
+latch
+late
+late
+late
+later
+latest
+lath
+latin
+latten
+latter
+lattic
+laud
+laudabl
+laudi
+laugh
+laughabl
+laugh
+laugher
+laughest
+laugh
+laugh
+laughter
+launc
+launcelot
+launc
+launch
+laund
+laundress
+laundri
+laur
+laura
+laurel
+laurel
+laurenc
+lau
+lavach
+lave
+lave
+lavend
+lavina
+lavinia
+lavish
+lavishli
+lavolt
+lavolta
+law
+law
+lawfulli
+lawless
+lawlessli
+lawn
+lawn
+lawrenc
+law
+lawyer
+lawyer
+lai
+layer
+layest
+lai
+lai
+lazar
+lazar
+lazaru
+lazi
+lc
+ld
+ldst
+le
+lead
+leaden
+leader
+leader
+leadest
+lead
+lead
+leaf
+leagu
+leagu
+leagu
+leaguer
+leagu
+leah
+leak
+leaki
+lean
+leander
+leaner
+lean
+lean
+lean
+leap
+leap
+leap
+leap
+leapt
+lear
+learn
+learn
+learnedli
+learn
+learn
+learn
+learnt
+lea
+leas
+leas
+leash
+leas
+least
+leather
+leathern
+leav
+leav
+leaven
+leaven
+leaver
+leav
+leav
+leavi
+lecher
+lecher
+lecher
+lecheri
+lecon
+lectur
+lectur
+led
+leda
+leech
+leech
+leek
+leek
+leer
+leer
+lee
+lees
+leet
+leet
+left
+leg
+legaci
+legaci
+legat
+legatin
+lege
+leger
+lege
+legg
+legion
+legion
+legitim
+legitim
+leg
+leicest
+leicestershir
+leiger
+leiger
+leisur
+leisur
+leisur
+leman
+lemon
+lena
+lend
+lender
+lend
+lend
+lend
+length
+lengthen
+lengthen
+length
+leniti
+lennox
+lent
+lenten
+lentu
+leo
+leon
+leonardo
+leonati
+leonato
+leonatu
+leont
+leopard
+leopard
+leper
+leper
+lepidu
+leprosi
+lequel
+ler
+le
+less
+lessen
+lessen
+lesser
+lesson
+lesson
+lesson
+lest
+lestrak
+let
+lethargi
+lethargi
+lethargi
+leth
+let
+lett
+letter
+letter
+let
+lettuc
+leur
+leve
+level
+level
+level
+level
+leven
+lever
+leviathan
+leviathan
+levi
+levi
+leviti
+levi
+levi
+lewd
+lewdli
+lewd
+lewdster
+lewi
+liabl
+liar
+liar
+libbard
+libel
+libel
+liber
+liber
+libert
+liberti
+libertin
+libertin
+liberti
+librari
+libya
+licenc
+licen
+licens
+licenti
+licha
+licio
+lick
+lick
+licker
+lictor
+lid
+lid
+lie
+li
+lief
+liefest
+lieg
+liegeman
+liegemen
+lien
+li
+liest
+lieth
+lieu
+lieuten
+lieutenantri
+lieuten
+liev
+life
+lifeblood
+lifeless
+lifel
+lift
+lift
+lifter
+lifteth
+lift
+lift
+lig
+ligariu
+liggen
+light
+light
+lighten
+lighten
+lighter
+lightest
+lightli
+light
+lightn
+lightn
+light
+lik
+like
+like
+likeliest
+likelihood
+likelihood
+like
+like
+liker
+like
+likest
+likewis
+like
+like
+lili
+lili
+lim
+limand
+limb
+limbeck
+limbeck
+limber
+limbo
+limb
+lime
+lime
+limehous
+limekiln
+limit
+limit
+limit
+limit
+limn
+limp
+limp
+limp
+lin
+lincoln
+lincolnshir
+line
+lineal
+lineal
+lineament
+lineament
+line
+linen
+linen
+line
+ling
+lingar
+linger
+linger
+linger
+linguist
+line
+link
+link
+linsei
+linstock
+linta
+lion
+lionel
+lioness
+lion
+lip
+lipp
+lip
+lipsburi
+liquid
+liquor
+liquorish
+liquor
+lirra
+lisbon
+lisp
+lisp
+list
+listen
+listen
+list
+literatur
+lither
+litter
+littl
+littlest
+liv
+live
+live
+liveli
+livelihood
+livelong
+live
+liver
+liveri
+liver
+liveri
+live
+livest
+liveth
+livia
+live
+live
+lizard
+lizard
+ll
+lll
+llou
+lnd
+lo
+loa
+loach
+load
+loaden
+load
+load
+loaf
+loam
+loan
+loath
+loath
+loath
+loather
+loath
+loath
+loathli
+loath
+loathsom
+loathsom
+loathsomest
+loav
+lob
+lobbi
+lobbi
+local
+lochab
+lock
+lock
+lock
+lockram
+lock
+locust
+lode
+lodg
+lodg
+lodg
+lodger
+lodg
+lodg
+lodg
+lodovico
+lodowick
+lofti
+log
+logger
+loggerhead
+loggerhead
+logget
+logic
+log
+loin
+loiter
+loiter
+loiter
+loiter
+loll
+loll
+lombardi
+london
+london
+lone
+loneli
+lone
+long
+longavil
+longboat
+long
+longer
+longest
+longeth
+long
+long
+longli
+long
+longtail
+loo
+loof
+look
+look
+looker
+looker
+lookest
+look
+look
+loon
+loop
+loo
+loos
+loos
+loos
+loosen
+loos
+lop
+lopp
+loquitur
+lord
+lord
+lord
+lord
+lordli
+lordli
+lord
+lordship
+lordship
+lorenzo
+lorn
+lorrain
+lorship
+lo
+lose
+loser
+loser
+lose
+losest
+loseth
+lose
+loss
+loss
+lost
+lot
+lot
+lott
+lotteri
+loud
+louder
+loudli
+lour
+loureth
+lour
+lous
+lous
+lousi
+lout
+lout
+lout
+louvr
+lov
+love
+love
+lovedst
+lovel
+loveli
+loveli
+lovel
+love
+lover
+lover
+lover
+love
+lovest
+loveth
+love
+lovingli
+low
+low
+lower
+lowest
+low
+lowli
+lowli
+lown
+low
+loyal
+loyal
+loyalti
+loyalti
+lozel
+lt
+lubber
+lubberli
+luc
+luccico
+luce
+lucentio
+luce
+lucetta
+luciana
+lucianu
+lucif
+lucifi
+luciliu
+lucina
+lucio
+luciu
+luck
+luckier
+luckiest
+luckili
+luckless
+lucki
+lucr
+lucrec
+lucretia
+luculliu
+lucullu
+luci
+lud
+ludlow
+lug
+lugg
+luggag
+luke
+lukewarm
+lull
+lulla
+lullabi
+lull
+lumbert
+lump
+lumpish
+luna
+lunaci
+lunaci
+lunat
+lunat
+lune
+lung
+luperc
+lurch
+lure
+lurk
+lurketh
+lurk
+lurk
+lusciou
+lush
+lust
+lust
+luster
+lust
+lustier
+lustiest
+lustig
+lustihood
+lustili
+lustr
+lustrou
+lust
+lusti
+lute
+lute
+lutestr
+lutheran
+luxuri
+luxuri
+luxuri
+ly
+lycaonia
+lycurgus
+lydia
+lye
+lyen
+ly
+lym
+lymog
+lynn
+lysand
+m
+ma
+maan
+mab
+macbeth
+maccabaeu
+macdonwald
+macduff
+mace
+macedon
+mace
+machiavel
+machin
+machin
+machin
+mack
+macmorri
+macul
+macul
+mad
+madam
+madam
+madam
+madcap
+mad
+mad
+made
+madeira
+madli
+madman
+madmen
+mad
+madonna
+madrig
+mad
+maecena
+maggot
+maggot
+magic
+magic
+magician
+magistr
+magistr
+magnanim
+magnanim
+magni
+magnifi
+magnific
+magnific
+magnifico
+magnifico
+magnu
+mahomet
+mahu
+maid
+maiden
+maidenhead
+maidenhead
+maidenhood
+maidenhood
+maidenliest
+maidenli
+maiden
+maidhood
+maid
+mail
+mail
+mail
+maim
+maim
+maim
+main
+maincours
+main
+mainli
+mainmast
+main
+maintain
+maintain
+maintain
+mainten
+mai
+maison
+majesta
+majeste
+majest
+majest
+majest
+majesti
+majesti
+major
+major
+mak
+make
+makeless
+maker
+maker
+make
+makest
+maketh
+make
+make
+mal
+mala
+maladi
+maladi
+malapert
+malcolm
+malcont
+malcont
+male
+maledict
+malefact
+malefactor
+malefactor
+male
+malevol
+malevol
+malhecho
+malic
+malici
+malici
+malign
+malign
+malign
+malignantli
+malkin
+mall
+mallard
+mallet
+mallow
+malmsei
+malt
+maltworm
+malvolio
+mamilliu
+mammer
+mammet
+mammet
+mammock
+man
+manacl
+manacl
+manag
+manag
+manag
+manag
+manakin
+manchu
+mandat
+mandragora
+mandrak
+mandrak
+mane
+manent
+mane
+manet
+manfulli
+mangl
+mangl
+mangl
+mangl
+mangi
+manhood
+manhood
+manifest
+manifest
+manifest
+manifold
+manifoldli
+manka
+mankind
+manlik
+manli
+mann
+manna
+manner
+mannerli
+manner
+manningtre
+mannish
+manor
+manor
+man
+mansion
+mansionri
+mansion
+manslaught
+mantl
+mantl
+mantl
+mantua
+mantuan
+manual
+manur
+manur
+manu
+mani
+map
+mapp
+map
+mar
+marbl
+marbl
+marcad
+marcellu
+march
+march
+marcheth
+march
+marchio
+marchpan
+marcian
+marciu
+marcu
+mardian
+mare
+mare
+marg
+margarelon
+margaret
+marg
+margent
+margeri
+maria
+marian
+mariana
+mari
+marigold
+marin
+marin
+maritim
+marjoram
+mark
+mark
+market
+market
+marketplac
+market
+mark
+markman
+mark
+marl
+marl
+marmoset
+marquess
+marqui
+marr
+marriag
+marriag
+marri
+marri
+mar
+marrow
+marrowless
+marrow
+marri
+marri
+mar
+marseil
+marsh
+marshal
+marshalsea
+marshalship
+mart
+mart
+martem
+martext
+martial
+martin
+martino
+martiu
+martlema
+martlet
+mart
+martyr
+martyr
+marullu
+marv
+marvel
+marvel
+marvel
+marvel
+marvel
+mari
+ma
+masculin
+masham
+mask
+mask
+masker
+masker
+mask
+mask
+mason
+masonri
+mason
+masqu
+masquer
+masqu
+masqu
+mass
+massacr
+massacr
+mass
+massi
+mast
+mastcr
+master
+masterdom
+masterest
+masterless
+masterli
+masterpiec
+master
+mastership
+mastic
+mastiff
+mastiff
+mast
+match
+match
+matcheth
+match
+matchless
+mate
+mate
+mater
+materi
+mate
+mathemat
+matin
+matron
+matron
+matter
+matter
+matthew
+mattock
+mattress
+matur
+matur
+maud
+maudlin
+maugr
+maul
+maund
+mauri
+mauritania
+mauvai
+maw
+maw
+maxim
+mai
+maydai
+mayest
+mayor
+maypol
+mayst
+maz
+maze
+maze
+maze
+mazzard
+me
+meacock
+mead
+meadow
+meadow
+mead
+meagr
+meal
+meal
+meali
+mean
+meander
+meaner
+meanest
+meaneth
+mean
+mean
+meanli
+mean
+meant
+meantim
+meanwhil
+measl
+measur
+measur
+measur
+measur
+measureless
+measur
+measur
+meat
+meat
+mechan
+mechan
+mechan
+mechan
+mechant
+med
+medal
+meddl
+meddler
+meddl
+mede
+medea
+media
+mediat
+mediat
+medic
+medicin
+medicin
+medicin
+medit
+medit
+medit
+medit
+medit
+mediterranean
+mediterraneum
+medlar
+medlar
+meed
+meed
+meek
+meekli
+meek
+meet
+meeter
+meetest
+meet
+meet
+meetli
+meet
+meet
+meg
+mehercl
+meilleur
+meini
+meisen
+melancholi
+melancholi
+melford
+mell
+melliflu
+mellow
+mellow
+melodi
+melodi
+melt
+melt
+melteth
+melt
+melt
+melun
+member
+member
+memento
+memor
+memorandum
+memori
+memori
+memori
+memoriz
+memor
+memori
+memphi
+men
+menac
+menac
+menac
+menaphon
+mena
+mend
+mend
+mender
+mend
+mend
+menecr
+menelau
+meneniu
+mental
+menteith
+mention
+menti
+menton
+mephostophilu
+mer
+mercatant
+mercatio
+mercenari
+mercenari
+mercer
+merchandis
+merchand
+merchant
+merchant
+merci
+merci
+mercifulli
+merciless
+mercuri
+mercuri
+mercuri
+mercutio
+merci
+mere
+mere
+mere
+merest
+meridian
+merit
+merit
+meritori
+merit
+merlin
+mermaid
+mermaid
+merop
+merrier
+merriest
+merrili
+merriman
+merriment
+merriment
+merri
+merri
+mervail
+me
+mesh
+mesh
+mesopotamia
+mess
+messag
+messag
+messala
+messalin
+messeng
+messeng
+mess
+messina
+met
+metal
+metal
+metamorphi
+metamorphos
+metaphor
+metaphys
+metaphys
+mete
+metellu
+meteor
+meteor
+meteyard
+metheglin
+metheglin
+methink
+methink
+method
+method
+methought
+methought
+metr
+metr
+metropoli
+mett
+mettl
+mettl
+meu
+mew
+mew
+mewl
+mexico
+mi
+mice
+michael
+michaelma
+micher
+mich
+mickl
+microcosm
+mid
+mida
+middest
+middl
+middleham
+midnight
+midriff
+midst
+midsumm
+midwai
+midwif
+midwiv
+mienn
+might
+might
+mightier
+mightiest
+mightili
+mighti
+mightst
+mighti
+milan
+milch
+mild
+milder
+mildest
+mildew
+mildew
+mildli
+mild
+mile
+mile
+milford
+militarist
+militari
+milk
+milk
+milkmaid
+milk
+milksop
+milki
+mill
+mill
+miller
+millin
+million
+million
+million
+mill
+millston
+milo
+mimic
+minc
+minc
+minc
+minc
+mind
+mind
+mind
+mindless
+mind
+mine
+miner
+miner
+minerva
+mine
+mingl
+mingl
+mingl
+minikin
+minim
+minim
+minimo
+minimu
+mine
+minion
+minion
+minist
+minist
+minist
+ministr
+minnow
+minnow
+minola
+minor
+mino
+minotaur
+minstrel
+minstrel
+minstrelsi
+mint
+mint
+minut
+minut
+minut
+minx
+mio
+mir
+mirabl
+miracl
+miracl
+miracul
+miranda
+mire
+mirror
+mirror
+mirth
+mirth
+miri
+mi
+misadventur
+misadventur
+misanthropo
+misappli
+misbecam
+misbecom
+misbecom
+misbegot
+misbegotten
+misbeliev
+misbeliev
+misbhav
+miscal
+miscal
+miscarri
+miscarri
+miscarri
+miscarri
+mischanc
+mischanc
+mischief
+mischief
+mischiev
+misconceiv
+misconst
+misconst
+misconstruct
+misconstru
+misconstru
+miscreant
+miscreat
+misde
+misde
+misdemean
+misdemeanour
+misdoubt
+misdoubteth
+misdoubt
+misenum
+miser
+miser
+miser
+misericord
+miseri
+miser
+miseri
+misfortun
+misfortun
+misgiv
+misgiv
+misgiv
+misgovern
+misgovern
+misgraf
+misguid
+mishap
+mishap
+misheard
+misinterpret
+mislead
+mislead
+mislead
+mislead
+misl
+mislik
+misord
+misplac
+misplac
+misplac
+mispri
+mispris
+mispris
+mispriz
+misproud
+misquot
+misreport
+miss
+miss
+miss
+misshap
+misshapen
+missheath
+miss
+missingli
+mission
+missiv
+missiv
+misspok
+mist
+mista
+mistak
+mistak
+mistaken
+mistak
+mistaketh
+mistak
+mistak
+mistemp
+mistemp
+misterm
+mist
+misthink
+misthought
+mistleto
+mistook
+mistread
+mistress
+mistress
+mistresss
+mistriship
+mistrust
+mistrust
+mistrust
+mistrust
+mist
+misti
+misu
+misus
+misus
+misus
+mite
+mithrid
+mitig
+mitig
+mix
+mix
+mixtur
+mixtur
+mm
+mnd
+moan
+moan
+moat
+moat
+mobl
+mock
+mockabl
+mocker
+mockeri
+mocker
+mockeri
+mock
+mock
+mockvat
+mockwat
+model
+modena
+moder
+moder
+moder
+modern
+modest
+modesti
+modestli
+modesti
+modicum
+modo
+modul
+moe
+moi
+moieti
+moist
+moisten
+moistur
+moldwarp
+mole
+molehil
+mole
+molest
+molest
+mollif
+molli
+molten
+molto
+mome
+moment
+momentari
+mome
+mon
+monachum
+monarch
+monarchi
+monarch
+monarcho
+monarch
+monarchi
+monast
+monasteri
+monast
+mondai
+mond
+monei
+monei
+mong
+monger
+monger
+mong
+mongrel
+mongrel
+mongst
+monk
+monkei
+monkei
+monk
+monmouth
+monopoli
+mon
+monsieur
+monsieur
+monster
+monster
+monstrou
+monstrous
+monstrous
+monstruos
+montacut
+montag
+montagu
+montagu
+montano
+montant
+montez
+montferrat
+montgomeri
+month
+monthli
+month
+montjoi
+monument
+monument
+monument
+mood
+mood
+moodi
+moon
+moonbeam
+moonish
+moonlight
+moon
+moonshin
+moonshin
+moor
+moorfield
+moor
+moorship
+mop
+mope
+mope
+mop
+mopsa
+moral
+moral
+moral
+moral
+mordak
+more
+moreov
+more
+morgan
+mori
+morisco
+morn
+morn
+morn
+morocco
+morri
+morrow
+morrow
+morsel
+morsel
+mort
+mortal
+mortal
+mortal
+mortal
+mortar
+mortgag
+mortifi
+mortifi
+mortim
+mortim
+morti
+mortis
+morton
+mose
+moss
+mossgrown
+most
+mote
+moth
+mother
+mother
+moth
+motion
+motionless
+motion
+motiv
+motiv
+motlei
+mot
+mought
+mould
+mould
+mouldeth
+mould
+mouldi
+moult
+moulten
+mounch
+mounseur
+mounsieur
+mount
+mountain
+mountain
+mountain
+mountain
+mountain
+mountant
+mountanto
+mountebank
+mountebank
+mount
+mounteth
+mount
+mount
+mourn
+mourn
+mourner
+mourner
+mourn
+mournfulli
+mourn
+mourningli
+mourn
+mourn
+mou
+mous
+mousetrap
+mous
+mouth
+mouth
+mouth
+mov
+movabl
+move
+moveabl
+moveabl
+move
+mover
+mover
+move
+moveth
+move
+movingli
+movousu
+mow
+mowbrai
+mower
+mow
+mow
+moi
+moi
+moys
+mr
+much
+muck
+mud
+mud
+muddi
+muddi
+muffin
+muffl
+muffl
+muffl
+muffler
+muffl
+mugger
+mug
+mulberri
+mulberri
+mule
+mule
+mulet
+mulier
+mulier
+muliteu
+mull
+mulmutiu
+multipli
+multipli
+multipli
+multipot
+multitud
+multitud
+multitudin
+mum
+mumbl
+mumbl
+mummer
+mummi
+mun
+munch
+muniment
+munit
+murd
+murder
+murder
+murder
+murder
+murder
+murder
+murder
+mure
+murk
+murkiest
+murki
+murmur
+murmur
+murmur
+murrain
+murrai
+murrion
+murther
+murther
+murther
+murther
+murther
+murther
+mu
+muscadel
+muscovit
+muscovit
+muscovi
+muse
+muse
+mush
+mushroom
+music
+music
+musician
+musician
+music
+muse
+muse
+musk
+musket
+musket
+musko
+muss
+mussel
+mussel
+must
+mustachio
+mustard
+mustardse
+muster
+muster
+muster
+musti
+mutabl
+mutabl
+mutat
+mutat
+mute
+mute
+mutest
+mutin
+mutin
+mutin
+mutin
+mutini
+mutin
+mutini
+mutiu
+mutter
+mutter
+mutton
+mutton
+mutual
+mutual
+mutual
+muzzl
+muzzl
+muzzl
+mv
+mww
+my
+mynheer
+myrmidon
+myrmidon
+myrtl
+myself
+myst
+mysteri
+mysteri
+n
+nag
+nage
+nag
+naiad
+nail
+nail
+nak
+nake
+naked
+nal
+nam
+name
+name
+nameless
+name
+name
+namest
+name
+nan
+nanc
+nap
+nape
+nape
+napkin
+napkin
+napl
+napless
+nap
+nap
+narbon
+narcissu
+narin
+narrow
+narrowli
+naso
+nasti
+nathaniel
+natif
+nation
+nation
+nativ
+nativ
+natur
+natur
+natur
+natur
+natur
+natur
+natur
+natu
+naught
+naughtili
+naughti
+navarr
+nave
+navel
+navig
+navi
+nai
+nayward
+nayword
+nazarit
+ne
+neaf
+neamnoin
+neanmoin
+neapolitan
+neapolitan
+near
+nearer
+nearest
+nearli
+near
+neat
+neatli
+neb
+nebour
+nebuchadnezzar
+nec
+necessari
+necessarili
+necessari
+necess
+necess
+necess
+neck
+necklac
+neck
+nectar
+ned
+nedar
+need
+need
+needer
+need
+needful
+need
+needl
+needl
+needless
+needli
+need
+needi
+neer
+neez
+nefa
+negat
+neg
+neg
+neglect
+neglect
+neglect
+neglectingli
+neglect
+neglig
+neglig
+negoti
+negoti
+negro
+neigh
+neighbor
+neighbour
+neighbourhood
+neighbour
+neighbourli
+neighbour
+neigh
+neigh
+neither
+nell
+nemean
+nemesi
+neoptolemu
+nephew
+nephew
+neptun
+ner
+nereid
+nerissa
+nero
+nero
+ner
+nerv
+nerv
+nervii
+nervi
+nessu
+nest
+nestor
+nest
+net
+nether
+netherland
+net
+nettl
+nettl
+nettl
+neuter
+neutral
+nev
+never
+nevil
+nevil
+new
+newborn
+newer
+newest
+newgat
+newli
+new
+new
+newsmong
+newt
+newt
+next
+nibbl
+nicanor
+nice
+nice
+nice
+nicer
+niceti
+nichola
+nick
+nicknam
+nick
+niec
+niec
+niggard
+niggard
+niggardli
+nigh
+night
+nightcap
+nightcap
+night
+nightgown
+nightingal
+nightingal
+nightli
+nightmar
+night
+nightwork
+nihil
+nile
+nill
+nilu
+nimbl
+nimbl
+nimbler
+nimbl
+nine
+nineteen
+ning
+ningli
+ninni
+ninth
+ninu
+niob
+niob
+nip
+nipp
+nip
+nippl
+nip
+nit
+nly
+nnight
+nnight
+no
+noah
+nob
+nobil
+nobi
+nobl
+nobleman
+noblemen
+nobl
+nobler
+nobl
+nobless
+noblest
+nobli
+nobodi
+noce
+nod
+nod
+nod
+noddl
+noddl
+noddi
+nod
+noe
+noint
+noi
+nois
+noiseless
+noisemak
+nois
+noisom
+nole
+nomin
+nomin
+nomin
+nominativo
+non
+nonag
+nonc
+none
+nonino
+nonni
+nonpareil
+nonsuit
+noni
+nook
+nook
+noon
+noondai
+noontid
+nor
+norberi
+norfolk
+norman
+normandi
+norman
+north
+northampton
+northamptonshir
+northerli
+northern
+northgat
+northumberland
+northumberland
+northward
+norwai
+norwai
+norwegian
+norweyan
+no
+nose
+nosegai
+noseless
+nose
+noster
+nostra
+nostril
+nostril
+not
+notabl
+notabl
+notari
+notch
+note
+notebook
+note
+notedli
+note
+notest
+noteworthi
+noth
+noth
+notic
+notifi
+note
+notion
+notori
+notori
+notr
+notwithstand
+nought
+noun
+noun
+nourish
+nourish
+nourish
+nourish
+nourisheth
+nourish
+nourish
+nou
+novel
+novelti
+novelti
+noverb
+novi
+novic
+novic
+novum
+now
+nowher
+noyanc
+ns
+nt
+nubibu
+numa
+numb
+number
+number
+number
+numberless
+number
+numb
+nun
+nuncio
+nuncl
+nunneri
+nun
+nuntiu
+nuptial
+nur
+nurs
+nurs
+nurser
+nurseri
+nurs
+nurseth
+nursh
+nurs
+nurtur
+nurtur
+nut
+nuthook
+nutmeg
+nutmeg
+nutriment
+nut
+nutshel
+ny
+nym
+nymph
+nymph
+o
+oak
+oaken
+oak
+oar
+oar
+oatcak
+oaten
+oath
+oathabl
+oath
+oat
+ob
+obduraci
+obdur
+obedi
+obedi
+obeis
+oberon
+obei
+obei
+obei
+obei
+obidicut
+object
+object
+object
+object
+oblat
+oblat
+oblig
+oblig
+oblig
+obliqu
+oblivion
+oblivi
+obloqui
+obscen
+obscen
+obscur
+obscur
+obscur
+obscur
+obscur
+obscur
+obscur
+obsequi
+obsequi
+obsequi
+observ
+observ
+observ
+observ
+observ
+observ
+observ
+observ
+observ
+observ
+observ
+observ
+observingli
+obsqu
+obstacl
+obstacl
+obstinaci
+obstin
+obstin
+obstruct
+obstruct
+obstruct
+obtain
+obtain
+obtain
+occas
+occas
+occid
+occident
+occult
+occupat
+occup
+occup
+occupi
+occupi
+occupi
+occurr
+occurr
+occurr
+ocean
+ocean
+octavia
+octaviu
+ocular
+od
+odd
+oddest
+oddli
+odd
+od
+od
+odiou
+odorifer
+odor
+odour
+odour
+od
+oeillad
+oe
+oeuvr
+of
+ofephesu
+off
+offal
+offenc
+offenc
+offenc
+offend
+offend
+offendendo
+offend
+offend
+offendeth
+offend
+offendress
+offend
+offens
+offenseless
+offens
+offens
+offer
+offer
+offer
+offer
+offer
+offert
+offic
+offic
+offic
+offic
+offic
+offic
+offici
+offici
+offspr
+oft
+often
+often
+oftentim
+oh
+oil
+oil
+oili
+old
+oldcastl
+olden
+older
+oldest
+old
+oliv
+oliv
+oliv
+oliv
+olivia
+olympian
+olympu
+oman
+oman
+omen
+omin
+omiss
+omit
+omitt
+omit
+omit
+omn
+omn
+omnipot
+on
+onc
+on
+on
+oney
+ongl
+onion
+onion
+onli
+onset
+onward
+onward
+oo
+ooz
+ooz
+oozi
+op
+opal
+op
+open
+open
+open
+openli
+open
+open
+oper
+oper
+oper
+oper
+oper
+op
+oph
+ophelia
+opinion
+opinion
+opportun
+opportun
+opportun
+oppo
+oppos
+oppos
+opposeless
+oppos
+oppos
+oppos
+oppos
+opposit
+opposit
+opposit
+opposit
+oppress
+oppress
+oppress
+oppresseth
+oppress
+oppress
+oppressor
+opprest
+opprobri
+oppugn
+opul
+opul
+or
+oracl
+oracl
+orang
+orat
+orat
+orat
+oratori
+orb
+orb
+orb
+orchard
+orchard
+ord
+ordain
+ordain
+ordain
+order
+order
+order
+orderless
+orderli
+order
+ordin
+ordin
+ordinari
+ordinari
+ordnanc
+ord
+ordur
+or
+organ
+organ
+orgil
+orient
+orifex
+origin
+origin
+orison
+ork
+orlando
+orld
+orlean
+ornament
+ornament
+orod
+orphan
+orphan
+orpheu
+orsino
+ort
+orthographi
+ort
+oscorbidulcho
+osier
+osier
+osprei
+osr
+osric
+ossa
+ost
+ostent
+ostentar
+ostent
+ostent
+ostler
+ostler
+ostrich
+osw
+oswald
+othello
+other
+otherg
+other
+otherwher
+otherwhil
+otherwis
+otter
+ottoman
+ottomit
+oubli
+ouch
+ought
+oui
+ounc
+ounc
+ouph
+our
+our
+ourself
+ourselv
+ousel
+out
+outbid
+outbrav
+outbrav
+outbreak
+outcast
+outcri
+outcri
+outdar
+outdar
+outdar
+outdon
+outfac
+outfac
+outfac
+outfac
+outfli
+outfrown
+outgo
+outgo
+outgrown
+outjest
+outlaw
+outlawri
+outlaw
+outliv
+outliv
+outliv
+outliv
+outlook
+outlustr
+outpriz
+outrag
+outrag
+outrag
+outran
+outright
+outroar
+outrun
+outrun
+outrun
+outscold
+outscorn
+outsel
+outsel
+outsid
+outsid
+outspeak
+outsport
+outstar
+outstai
+outstood
+outstretch
+outstretch
+outstrik
+outstrip
+outstrip
+outswear
+outvenom
+outward
+outwardli
+outward
+outwear
+outweigh
+outwent
+outworn
+outworth
+oven
+over
+overaw
+overbear
+overblown
+overboard
+overbold
+overborn
+overbulk
+overbui
+overcam
+overcast
+overcharg
+overcharg
+overcom
+overcom
+overdon
+overearnest
+overfar
+overflow
+overflown
+overgl
+overgo
+overgon
+overgorg
+overgrown
+overhead
+overhear
+overheard
+overhold
+overjoi
+overkind
+overland
+overleath
+overl
+overlook
+overlook
+overlook
+overmast
+overmount
+overmuch
+overpass
+overp
+overp
+overplu
+overrul
+overrun
+overscutch
+overset
+overshad
+overshin
+overshin
+overshot
+oversight
+overspread
+overstain
+overswear
+overt
+overta
+overtak
+overtaketh
+overthrow
+overthrown
+overthrow
+overtook
+overtopp
+overtur
+overturn
+overwatch
+overween
+overween
+overweigh
+overwhelm
+overwhelm
+overworn
+ovid
+ovidiu
+ow
+ow
+ow
+owedst
+owen
+ow
+owest
+oweth
+ow
+owl
+owl
+own
+owner
+owner
+own
+own
+owi
+ox
+oxen
+oxford
+oxfordshir
+oxlip
+oy
+oyster
+p
+pabbl
+pabylon
+pac
+pace
+pace
+pace
+pacifi
+pacifi
+pace
+pack
+packet
+packet
+packhors
+pack
+pack
+pack
+packthread
+pacoru
+paction
+pad
+paddl
+paddl
+paddock
+padua
+pagan
+pagan
+page
+pageant
+pageant
+page
+pah
+paid
+pail
+pail
+pail
+pain
+pain
+pain
+painfulli
+pain
+paint
+paint
+painter
+paint
+paint
+paint
+pair
+pair
+pair
+pajock
+pal
+palabra
+palac
+palac
+palamed
+palat
+palat
+palatin
+palat
+pale
+pale
+pale
+paler
+pale
+palestin
+palfrei
+palfrei
+palisado
+pall
+pallabri
+palla
+pallet
+palm
+palmer
+palmer
+palm
+palmi
+palpabl
+palsi
+palsi
+palsi
+palt
+palter
+paltri
+pali
+pamp
+pamper
+pamphlet
+pan
+pancack
+pancak
+pancak
+pandar
+pandar
+pandaru
+pander
+panderli
+pander
+pandulph
+panel
+pang
+pang
+pang
+pannier
+pannonian
+pansa
+pansi
+pant
+pantaloon
+pant
+pantheon
+panther
+panthino
+pant
+pantingli
+pantler
+pantri
+pant
+pap
+papal
+paper
+paper
+paphlagonia
+papho
+papist
+pap
+par
+parabl
+paracelsu
+paradis
+paradox
+paradox
+paragon
+paragon
+parallel
+parallel
+paramour
+paramour
+parapet
+paraquito
+parasit
+parasit
+parca
+parcel
+parcel
+parcel
+parch
+parch
+parch
+parchment
+pard
+pardon
+pardona
+pardon
+pardon
+pardon
+pardonn
+pardonn
+pardonnez
+pardon
+pare
+pare
+parel
+parent
+parentag
+parent
+parfect
+pare
+pare
+pari
+parish
+parishion
+parisian
+paritor
+park
+park
+parl
+parler
+parl
+parlei
+parlez
+parliament
+parlor
+parlour
+parlou
+parmac
+parol
+parricid
+parricid
+parrot
+parrot
+parslei
+parson
+part
+partak
+partaken
+partak
+partak
+part
+parthia
+parthian
+parthian
+parti
+partial
+partial
+partial
+particip
+particip
+particl
+particular
+particular
+particular
+particularli
+particular
+parti
+part
+partisan
+partisan
+partit
+partizan
+partlet
+partli
+partner
+partner
+partridg
+part
+parti
+pa
+pash
+pash
+pash
+pass
+passabl
+passado
+passag
+passag
+passant
+pass
+passeng
+passeng
+pass
+passeth
+pass
+passio
+passion
+passion
+passion
+passion
+passiv
+passport
+passi
+past
+past
+pastern
+pasti
+pastim
+pastim
+pastor
+pastor
+pastor
+pastri
+pastur
+pastur
+pasti
+pat
+patai
+patch
+patcheri
+patch
+pate
+pate
+patent
+patent
+patern
+pate
+path
+pathet
+path
+pathwai
+pathwai
+patienc
+patient
+patient
+patient
+patin
+patrician
+patrician
+patrick
+patrimoni
+patroclu
+patron
+patronag
+patro
+patron
+patrum
+patter
+pattern
+pattern
+pattl
+pauca
+pauca
+paul
+paulina
+paunch
+paunch
+paus
+pauser
+paus
+pausingli
+pauvr
+pav
+pave
+pavement
+pavilion
+pavilion
+pavin
+paw
+pawn
+pawn
+paw
+pax
+pai
+payest
+pai
+payment
+payment
+pai
+paysan
+paysan
+pe
+peac
+peaceabl
+peaceabl
+peac
+peacemak
+peac
+peach
+peach
+peacock
+peacock
+peak
+peak
+peal
+peal
+pear
+peard
+pearl
+pearl
+pear
+pea
+peasant
+peasantri
+peasant
+peascod
+peas
+peaseblossom
+peat
+peaten
+peat
+pebbl
+pebbl
+pebbl
+peck
+peck
+peculiar
+pecu
+pedant
+pedant
+pedascul
+pede
+pedest
+pedigre
+pedlar
+pedlar
+pedro
+ped
+peel
+peep
+peep
+peep
+peep
+peer
+peereth
+peer
+peerless
+peer
+peesel
+peevish
+peevishli
+peflur
+peg
+pegasu
+peg
+peis
+peis
+peiz
+pelf
+pelican
+pelion
+pell
+pella
+pellet
+peloponnesu
+pelt
+pelt
+pembrok
+pen
+penalti
+penalti
+penanc
+penc
+pencil
+pencil
+pencil
+pendant
+pendent
+pendragon
+pendul
+penelop
+penetr
+penetr
+penetr
+penit
+penit
+penitenti
+penit
+penit
+penker
+penknif
+penn
+pen
+pen
+pennon
+penni
+pennyworth
+pennyworth
+pen
+pens
+pension
+pension
+pensiv
+pensiv
+pensiv
+pent
+pentecost
+penthesilea
+penthous
+penuri
+penuri
+peopl
+peopl
+peopl
+peopl
+pepin
+pepper
+peppercorn
+pepper
+per
+peradventur
+peradventur
+perceiv
+perceiv
+perceiv
+perceiv
+perceiveth
+perch
+perchanc
+perci
+percuss
+perci
+perdi
+perdita
+perdit
+perdonato
+perdu
+perdur
+perdur
+perdi
+pere
+peregrin
+peremptorili
+peremptori
+perfect
+perfect
+perfect
+perfectest
+perfect
+perfect
+perfectli
+perfect
+perfidi
+perfidi
+perforc
+perform
+perform
+perform
+perform
+perform
+perform
+perform
+perform
+perfum
+perfum
+perfum
+perfum
+perfum
+perg
+perhap
+periapt
+perigort
+perigouna
+peril
+peril
+peril
+period
+period
+perish
+perish
+perishest
+perisheth
+perish
+periwig
+perjur
+perjur
+perjur
+perjuri
+perjuri
+perk
+perk
+permafoi
+perman
+permiss
+permiss
+permit
+permit
+pernici
+pernici
+peror
+perpend
+perpendicular
+perpendicularli
+perpetu
+perpetu
+perpetu
+perplex
+perplex
+perplex
+per
+persecut
+persecut
+persecutor
+perseu
+persev
+persever
+persev
+persia
+persian
+persist
+persist
+persist
+persist
+persist
+person
+persona
+personag
+personag
+person
+person
+person
+person
+person
+person
+person
+perspect
+perspect
+perspect
+perspicu
+persuad
+persuad
+persuad
+persuad
+persuas
+persuas
+pert
+pertain
+pertain
+pertain
+pertaunt
+pertin
+pertli
+perturb
+perturb
+perturb
+perturb
+peru
+perus
+perus
+perus
+perus
+pervers
+pervers
+pervers
+pervert
+pervert
+peseech
+pest
+pester
+pestifer
+pestil
+pestil
+pet
+petar
+peter
+petit
+petit
+petitionari
+petition
+petition
+petit
+peto
+petrarch
+petruchio
+petter
+petticoat
+petticoat
+petti
+pettish
+pettito
+petti
+peu
+pew
+pewter
+pewter
+phaethon
+phaeton
+phantasim
+phantasim
+phantasma
+pharamond
+pharaoh
+pharsalia
+pheasant
+pheazar
+phebe
+phebe
+pheebu
+pheez
+phibbu
+philadelpho
+philario
+philarmonu
+philemon
+philip
+philippan
+philipp
+philippi
+phillida
+philo
+philomel
+philomela
+philosoph
+philosoph
+philosoph
+philosophi
+philostr
+philotu
+phlegmat
+phoeb
+phoebu
+phoenicia
+phoenician
+phoenix
+phorbu
+photinu
+phrase
+phraseless
+phrase
+phrygia
+phrygian
+phrynia
+physic
+physic
+physician
+physician
+physic
+pia
+pibbl
+pibl
+picardi
+pick
+pickax
+pickax
+pickbon
+pick
+picker
+pick
+pickl
+picklock
+pickpurs
+pick
+pickt
+pickthank
+pictur
+pictur
+pictur
+pictur
+pid
+pie
+piec
+piec
+piec
+piec
+pi
+pied
+pier
+pierc
+pierc
+pierc
+pierc
+pierceth
+pierc
+pierci
+pier
+pi
+pieti
+pig
+pigeon
+pigeon
+pight
+pigmi
+pigrogromitu
+pike
+pike
+pil
+pilat
+pilat
+pilcher
+pile
+pile
+pilf
+pilfer
+pilgrim
+pilgrimag
+pilgrim
+pill
+pillag
+pillag
+pillar
+pillar
+pillicock
+pillori
+pillow
+pillow
+pill
+pilot
+pilot
+pimpernel
+pin
+pinch
+pinch
+pinch
+pinch
+pindaru
+pine
+pine
+pine
+pinfold
+pine
+pinion
+pink
+pinn
+pinnac
+pin
+pins
+pint
+pintpot
+pion
+pioneer
+pioner
+pioner
+piou
+pip
+pipe
+piper
+piper
+pipe
+pipe
+pippin
+pippin
+pirat
+pirat
+pisa
+pisanio
+pish
+pismir
+piss
+piss
+pistol
+pistol
+pit
+pitch
+pitch
+pitcher
+pitcher
+pitchi
+piteou
+piteous
+pitfal
+pith
+pithless
+pithi
+piti
+piti
+piti
+piti
+pitifulli
+pitiless
+pit
+pittanc
+pitti
+pittikin
+piti
+piti
+piu
+plac
+place
+place
+placentio
+place
+placeth
+placid
+place
+plack
+placket
+placket
+plagu
+plagu
+plagu
+plagu
+plagu
+plagui
+plain
+plainer
+plainest
+plain
+plain
+plainli
+plain
+plain
+plainsong
+plaint
+plaintiff
+plaintiff
+plaint
+planch
+planet
+planetari
+planet
+plank
+plant
+plantag
+plantagenet
+plantagenet
+plantain
+plantat
+plant
+planteth
+plant
+plash
+plashi
+plast
+plaster
+plaster
+plat
+plate
+plate
+plate
+platform
+platform
+plat
+plat
+plausibl
+plausiv
+plautu
+plai
+plai
+player
+player
+playeth
+playfellow
+playfellow
+playhous
+plai
+plai
+plea
+pleach
+pleach
+plead
+plead
+pleader
+pleader
+plead
+plead
+plea
+pleasanc
+pleasant
+pleasantli
+pleas
+pleas
+pleaser
+pleaser
+pleas
+pleasest
+pleaseth
+pleas
+pleasur
+pleasur
+plebeian
+plebeii
+pleb
+pledg
+pledg
+plein
+plenitud
+plenteou
+plenteous
+plenti
+plenti
+plentifulli
+plenti
+pless
+pless
+pless
+pliant
+pli
+pli
+plight
+plight
+plighter
+plod
+plod
+plodder
+plod
+plod
+plood
+ploodi
+plot
+plot
+plot
+plotter
+plough
+plough
+ploughman
+ploughmen
+plow
+plow
+pluck
+pluck
+plucker
+pluck
+pluck
+plue
+plum
+plume
+plume
+plume
+plummet
+plump
+plumpi
+plum
+plung
+plung
+plung
+plural
+plurisi
+plu
+pluto
+plutu
+ply
+po
+pocket
+pocket
+pocket
+pocki
+podi
+poem
+poesi
+poet
+poetic
+poetri
+poet
+poictier
+poinard
+poin
+point
+pointblank
+point
+point
+point
+poi
+pois
+pois
+poison
+poison
+poison
+poison
+poison
+poison
+poke
+poke
+pol
+polack
+polack
+poland
+pold
+pole
+poleax
+polecat
+polecat
+polemon
+pole
+poli
+polici
+polici
+polish
+polish
+polit
+politician
+politician
+politicli
+polixen
+poll
+pollut
+pollut
+poloniu
+poltroon
+polus
+polydamu
+polydor
+polyxena
+pomand
+pomegran
+pomewat
+pomfret
+pomgarnet
+pommel
+pomp
+pompeiu
+pompei
+pompion
+pompou
+pomp
+pond
+ponder
+ponder
+pond
+poniard
+poniard
+pont
+pontic
+pontif
+ponton
+pooh
+pool
+pool
+poop
+poor
+poorer
+poorest
+poorli
+pop
+pope
+popedom
+popiliu
+popingai
+popish
+popp
+poppi
+pop
+popular
+popular
+popul
+porch
+porch
+pore
+pore
+pork
+porn
+porpentin
+porridg
+porring
+port
+portabl
+portag
+portal
+portanc
+portculli
+portend
+portend
+portent
+portent
+portent
+porter
+porter
+portia
+portion
+portli
+portotartarossa
+portrait
+portraitur
+port
+portug
+pose
+posi
+posi
+posit
+posit
+posit
+poss
+possess
+possess
+possess
+possesseth
+possess
+possess
+possess
+possessor
+posset
+posset
+possibl
+possibl
+possibl
+possibl
+possit
+post
+post
+post
+posterior
+posterior
+poster
+postern
+postern
+poster
+posthors
+posthors
+posthumu
+post
+postmast
+post
+postscript
+postur
+postur
+posi
+pot
+potabl
+potat
+potato
+potato
+potch
+potenc
+potent
+potent
+potenti
+potent
+potent
+pothecari
+pother
+potion
+potion
+potpan
+pot
+potter
+pot
+pottl
+pouch
+poulter
+poultic
+poultnei
+pouncet
+pound
+pound
+pour
+pourest
+pour
+pourquoi
+pour
+pout
+poverti
+pow
+powd
+powder
+power
+power
+powerfulli
+powerless
+power
+pox
+poi
+poysam
+prabbl
+practic
+practic
+practic
+practic
+practic
+practic
+practi
+practis
+practis
+practis
+practis
+practis
+practis
+praeclarissimu
+praemunir
+praetor
+praetor
+prag
+pragu
+prain
+prain
+prai
+prais
+prais
+prais
+praisest
+praiseworthi
+prais
+pranc
+prank
+prank
+prat
+prate
+prate
+prater
+prate
+prattl
+prattler
+prattl
+prave
+prawl
+prawn
+prai
+prayer
+prayer
+prai
+prai
+pre
+preach
+preach
+preacher
+preach
+preach
+preachment
+pread
+preambul
+preced
+preced
+preced
+precept
+precepti
+precept
+precinct
+preciou
+precious
+precipic
+precipit
+precipit
+precis
+precis
+precis
+precisian
+precor
+precurs
+precursor
+predeceas
+predecessor
+predecessor
+predestin
+predica
+predict
+predict
+predict
+predomin
+predomin
+predomin
+preech
+preemin
+prefac
+prefer
+prefer
+prefer
+preferr
+preferreth
+prefer
+prefer
+prefigur
+prefix
+prefix
+preform
+pregnanc
+pregnant
+pregnantli
+prejud
+prejudic
+prejudici
+prelat
+premedit
+premedit
+premis
+premis
+prenez
+prenomin
+prentic
+prentic
+preordin
+prepar
+prepar
+prepar
+prepar
+prepar
+preparedli
+prepar
+prepar
+prepost
+preposter
+preposter
+prerogatif
+prerog
+prerogativ
+presag
+presag
+presag
+presageth
+presag
+prescienc
+prescrib
+prescript
+prescript
+prescript
+prescript
+presenc
+presenc
+present
+present
+present
+present
+present
+presenteth
+present
+present
+present
+present
+preserv
+preserv
+preserv
+preserv
+preserv
+preserv
+preserv
+preserv
+presid
+press
+press
+presser
+press
+press
+pressur
+pressur
+prest
+prester
+presum
+presum
+presum
+presumpt
+presumptu
+presuppo
+pret
+pretenc
+pretenc
+pretend
+pretend
+pretend
+pretens
+pretext
+pretia
+prettier
+prettiest
+prettili
+pretti
+pretti
+prevail
+prevail
+prevaileth
+prevail
+prevail
+prevail
+prevent
+prevent
+prevent
+prevent
+prevent
+prei
+prey
+prei
+priam
+priami
+priamu
+pribbl
+price
+prick
+prick
+pricket
+prick
+prick
+pricksong
+pride
+pride
+pridg
+prie
+pri
+prief
+pri
+priest
+priesthood
+priest
+prig
+primal
+prime
+primer
+primero
+primest
+primit
+primo
+primogen
+primros
+primros
+primi
+princ
+princ
+princ
+princess
+princip
+princip
+princip
+principl
+principl
+princox
+pring
+print
+print
+print
+printless
+print
+prioress
+priori
+prioriti
+priori
+priscian
+prison
+prison
+prison
+prison
+prisonni
+prison
+pristin
+prith
+prithe
+privaci
+privat
+privat
+privat
+privilag
+privileg
+privileg
+privileg
+privileg
+privilegio
+privili
+priviti
+privi
+priz
+prize
+prize
+prizer
+prize
+prizest
+prize
+pro
+probabl
+probal
+probat
+proce
+proceed
+proceed
+proceed
+proceed
+proce
+process
+process
+proclaim
+proclaim
+proclaimeth
+proclaim
+proclam
+proclam
+proconsul
+procrastin
+procreant
+procreant
+procreat
+procru
+proculeiu
+procur
+procur
+procur
+procur
+procur
+procur
+prodig
+prodig
+prodig
+prodig
+prodigi
+prodigi
+prodigi
+prodigi
+proditor
+produc
+produc
+produc
+produc
+produc
+profac
+profan
+profan
+profan
+profan
+profan
+profan
+profan
+profan
+profess
+profess
+profess
+profess
+profess
+professor
+proffer
+proffer
+proffer
+proffer
+profici
+profit
+profit
+profit
+profit
+profit
+profitless
+profit
+profound
+profoundest
+profoundli
+progenitor
+progeni
+progn
+prognost
+prognost
+progress
+progress
+prohibit
+prohibit
+project
+project
+project
+prolixi
+prolix
+prologu
+prologu
+prolong
+prolong
+promethean
+prometheu
+promi
+promis
+promis
+promis
+promiseth
+promis
+promontori
+promot
+promot
+prompt
+prompt
+promptement
+prompter
+prompt
+prompt
+promptur
+promulg
+prone
+prononc
+prononcez
+pronoun
+pronounc
+pronounc
+pronounc
+pronounc
+pronoun
+proof
+proof
+prop
+propag
+propag
+propend
+propens
+proper
+proper
+properli
+properti
+properti
+properti
+propheci
+propheci
+prophesi
+prophesi
+prophesi
+prophesi
+prophet
+prophetess
+prophet
+prophet
+prophet
+propinqu
+propont
+proport
+proportion
+proport
+propo
+propos
+propos
+propos
+propos
+propos
+proposit
+proposit
+propound
+propp
+propr
+proprieti
+prop
+propugn
+prorogu
+prorogu
+proscript
+proscript
+prose
+prosecut
+prosecut
+proselyt
+proserpina
+prosp
+prospect
+prosper
+prosper
+prospero
+prosper
+prosper
+prosper
+prostitut
+prostrat
+protect
+protect
+protect
+protector
+protector
+protectorship
+protectress
+protect
+protest
+protest
+protest
+protest
+protest
+protest
+protest
+proteu
+protheu
+protract
+protract
+proud
+prouder
+proudest
+proudlier
+proudli
+proud
+prov
+provand
+prove
+prove
+provend
+proverb
+proverb
+prove
+proveth
+provid
+provid
+provid
+provid
+provid
+provid
+provid
+provinc
+provinc
+provinci
+prove
+provis
+proviso
+provoc
+provok
+provok
+provok
+provok
+provok
+provoketh
+provok
+provost
+prowess
+prudenc
+prudent
+prun
+prune
+prune
+prune
+pry
+pry
+psalm
+psalmist
+psalm
+psalteri
+ptolemi
+ptolemi
+public
+publican
+public
+publicli
+publicola
+publish
+publish
+publish
+publish
+publiu
+pucel
+puck
+pudder
+pud
+pud
+puddl
+puddl
+pudenc
+pueritia
+puff
+puf
+puff
+pug
+pui
+puissanc
+puissant
+puke
+puke
+pulcher
+pule
+pull
+puller
+pullet
+pull
+pull
+pulpit
+pulpit
+pulpit
+puls
+pulsidg
+pump
+pumpion
+pump
+pun
+punch
+punish
+punish
+punish
+punish
+punish
+punk
+punto
+puni
+pupil
+pupil
+puppet
+puppet
+puppi
+puppi
+pur
+purblind
+purcha
+purchas
+purchas
+purchas
+purchaseth
+purchas
+pure
+pure
+purer
+purest
+purg
+purgat
+purg
+purgatori
+purg
+purg
+purger
+purg
+purifi
+purifi
+puritan
+puriti
+purlieu
+purpl
+purpl
+purpl
+purport
+purpo
+purpos
+purpos
+purpos
+purpos
+purposeth
+purpos
+purr
+pur
+purs
+pursent
+purs
+pursu
+pursu
+pursu
+pursuer
+pursu
+pursuest
+pursueth
+pursu
+pursuit
+pursuiv
+pursuiv
+pursi
+puru
+purveyor
+push
+push
+pusillanim
+put
+putrefi
+putrifi
+put
+putter
+put
+puttock
+puzzel
+puzzl
+puzzl
+puzzl
+py
+pygmalion
+pygmi
+pygmi
+pyramid
+pyramid
+pyramid
+pyrami
+pyramis
+pyramu
+pyrenean
+pyrrhu
+pythagora
+qu
+quadrangl
+quae
+quaff
+quaf
+quagmir
+quail
+quail
+quail
+quaint
+quaintli
+quak
+quak
+quak
+qualif
+qualifi
+qualifi
+qualifi
+qualifi
+qualit
+qualiti
+qualiti
+qualm
+qualmish
+quam
+quand
+quando
+quantiti
+quantiti
+quar
+quarrel
+quarrel
+quarrel
+quarrel
+quarrel
+quarrel
+quarrelsom
+quarri
+quarri
+quart
+quarter
+quarter
+quarter
+quarter
+quart
+quasi
+quat
+quatch
+quai
+que
+quean
+quea
+queasi
+queasi
+queen
+queen
+quell
+queller
+quench
+quench
+quench
+quenchless
+quern
+quest
+questant
+question
+question
+question
+question
+questionless
+question
+questrist
+quest
+queubu
+qui
+quick
+quicken
+quicken
+quicker
+quicklier
+quickli
+quick
+quicksand
+quicksand
+quicksilverr
+quid
+quidditi
+quiddit
+quier
+quiet
+quieter
+quietli
+quiet
+quietu
+quill
+quillet
+quill
+quilt
+quinapalu
+quinc
+quinc
+quintain
+quintess
+quintu
+quip
+quip
+quir
+quir
+quirk
+quirk
+qui
+quit
+quit
+quit
+quittanc
+quit
+quit
+quiver
+quiver
+quiver
+quo
+quod
+quoif
+quoint
+quoit
+quoit
+quondam
+quoniam
+quot
+quot
+quot
+quoth
+quotidian
+r
+rabbit
+rabbl
+rabblement
+race
+rack
+racker
+racket
+racket
+rack
+rack
+radianc
+radiant
+radish
+rafe
+raft
+rag
+rage
+rage
+rageth
+ragg
+rag
+ragged
+rage
+ragozin
+rag
+rah
+rail
+rail
+railer
+railest
+raileth
+rail
+rail
+raiment
+rain
+rainbow
+raineth
+rain
+rainold
+rain
+raini
+rai
+rais
+rais
+rais
+rais
+raisin
+rak
+rake
+raker
+rake
+ral
+rald
+ralph
+ram
+rambur
+ramm
+rampallian
+rampant
+ramp
+rampir
+ramp
+ram
+ramsei
+ramston
+ran
+ranc
+rancor
+rancor
+rancour
+random
+rang
+rang
+rang
+ranger
+rang
+rang
+rank
+ranker
+rankest
+rank
+rankl
+rankli
+rank
+rank
+ransack
+ransack
+ransom
+ransom
+ransom
+ransomless
+ransom
+rant
+rant
+rap
+rape
+rape
+rapier
+rapier
+rapin
+rap
+rapt
+raptur
+raptur
+rar
+rare
+rare
+rare
+rarer
+rarest
+rariti
+rariti
+rascal
+rascalliest
+rascal
+rascal
+rase
+rash
+rasher
+rashli
+rash
+rat
+ratcatch
+ratcliff
+rate
+rate
+rate
+rate
+rather
+ratherest
+ratifi
+ratifi
+ratifi
+rate
+ration
+ratolorum
+rat
+ratsban
+rattl
+rattl
+rattl
+ratur
+raught
+rav
+rave
+ravel
+raven
+raven
+raven
+raven
+ravenspurgh
+rave
+ravin
+rave
+ravish
+ravish
+ravish
+ravish
+ravish
+raw
+rawer
+rawli
+raw
+rai
+rai
+rai
+raz
+raze
+raze
+raze
+razeth
+raze
+razor
+razor
+razor
+razur
+re
+reach
+reach
+reacheth
+reach
+read
+reader
+readiest
+readili
+readi
+read
+readin
+read
+readi
+real
+realli
+realm
+realm
+reap
+reaper
+reap
+reap
+rear
+rear
+rearward
+reason
+reason
+reason
+reason
+reason
+reasonless
+reason
+reav
+rebat
+rebato
+rebeck
+rebel
+rebel
+rebel
+rebellion
+rebelli
+rebel
+rebound
+rebuk
+rebuk
+rebuk
+rebuk
+rebuk
+rebu
+recal
+recant
+recant
+recant
+recant
+receipt
+receipt
+receiv
+receiv
+receiv
+receiv
+receiv
+receivest
+receiveth
+receiv
+receptacl
+rechat
+reciproc
+reciproc
+recit
+recit
+reciterai
+reck
+reck
+reckless
+reckon
+reckon
+reckon
+reckon
+reck
+reclaim
+reclaim
+reclus
+recogniz
+recogniz
+recoil
+recoil
+recollect
+recomfort
+recomfortur
+recommend
+recommend
+recommend
+recompen
+recompens
+reconcil
+reconcil
+reconcil
+reconcil
+reconcil
+reconcil
+reconcili
+record
+record
+record
+record
+record
+record
+recount
+recount
+recount
+recount
+recount
+recours
+recov
+recov
+recover
+recov
+recoveri
+recov
+recoveri
+recreant
+recreant
+recreat
+recreat
+rectifi
+rector
+rectorship
+recur
+recur
+red
+redbreast
+redder
+reddest
+rede
+redeem
+redeem
+redeem
+redeem
+redeem
+redeliv
+redempt
+redim
+red
+redoubl
+redoubt
+redound
+redress
+redress
+redress
+reduc
+reechi
+reed
+reed
+reek
+reek
+reek
+reeki
+reel
+reeleth
+reel
+reel
+refel
+refer
+refer
+referr
+refer
+refigur
+refin
+refin
+reflect
+reflect
+reflect
+reflex
+reform
+reform
+reform
+refractori
+refrain
+refresh
+refresh
+reft
+reft
+refug
+refu
+refus
+refus
+refus
+refusest
+refus
+reg
+regal
+regalia
+regan
+regard
+regard
+regard
+regardfulli
+regard
+regard
+regener
+regent
+regentship
+regia
+regiment
+regiment
+regina
+region
+region
+regist
+regist
+regist
+regreet
+regreet
+regress
+reguerdon
+regular
+rehear
+rehears
+rehears
+reign
+reign
+reignier
+reign
+reign
+rein
+reinforc
+reinforc
+reinforc
+rein
+reiter
+reject
+reject
+rejoic
+rejoic
+rejoic
+rejoiceth
+rejoic
+rejoicingli
+rejoindur
+rejourn
+rel
+relaps
+relat
+relat
+relat
+relat
+rel
+relea
+releas
+releas
+releas
+relent
+relent
+relent
+relianc
+relic
+relief
+reliev
+reliev
+reliev
+reliev
+reliev
+religion
+religion
+religi
+religi
+relinquish
+reliqu
+reliquit
+relish
+relum
+reli
+reli
+remain
+remaind
+remaind
+remain
+remaineth
+remain
+remain
+remark
+remark
+remedi
+remedi
+remedi
+remedi
+rememb
+rememb
+rememb
+rememb
+remembr
+remembranc
+remembr
+remercimen
+remiss
+remiss
+remiss
+remit
+remnant
+remnant
+remonstr
+remors
+remors
+remorseless
+remot
+remot
+remov
+remov
+remov
+removed
+remov
+remov
+remov
+remuner
+remuner
+renc
+rend
+render
+render
+render
+rendezv
+renegado
+reneg
+reneg
+renew
+renew
+renewest
+renounc
+renounc
+renounc
+renowm
+renown
+renown
+rent
+rent
+repaid
+repair
+repair
+repair
+repair
+repass
+repast
+repastur
+repai
+repai
+repai
+repeal
+repeal
+repeal
+repeat
+repeat
+repeat
+repeat
+repel
+repent
+repent
+repent
+repent
+repent
+repent
+repetit
+repetit
+repin
+repin
+repin
+replant
+replenish
+replenish
+replet
+replic
+repli
+repli
+repliest
+repli
+repli
+report
+report
+report
+reportest
+report
+reportingli
+report
+repos
+repos
+reposeth
+repos
+repossess
+reprehend
+reprehend
+reprehend
+repres
+repres
+repriev
+repriev
+repris
+reproach
+reproach
+reproach
+reproachfulli
+reprob
+reprob
+reproof
+reprov
+reprov
+reprov
+reprov
+reprov
+repugn
+repugn
+repugn
+repuls
+repuls
+repurcha
+repur
+reput
+reput
+reput
+reputeless
+reput
+reput
+request
+request
+request
+request
+requiem
+requir
+requir
+requir
+requir
+requireth
+requir
+requisit
+requisit
+requit
+requit
+requit
+requit
+requit
+rer
+rere
+rer
+rescu
+rescu
+rescu
+rescu
+rescu
+resembl
+resembl
+resembl
+resembl
+resembleth
+resembl
+reserv
+reserv
+reserv
+reserv
+reserv
+resid
+resid
+resid
+resid
+resid
+residu
+resign
+resign
+resist
+resist
+resist
+resist
+resist
+resolut
+resolut
+resolut
+resolut
+resolv
+resolv
+resolv
+resolvedli
+resolv
+resolveth
+resort
+resort
+resound
+resound
+respeak
+respect
+respect
+respect
+respect
+respect
+respect
+respic
+respit
+respit
+respons
+respos
+ress
+rest
+rest
+resteth
+rest
+rest
+restitut
+restless
+restor
+restor
+restor
+restor
+restor
+restor
+restor
+restrain
+restrain
+restrain
+restrain
+restraint
+rest
+resti
+resum
+resum
+resum
+resurrect
+retail
+retail
+retain
+retain
+retain
+retel
+retent
+retent
+retinu
+retir
+retir
+retir
+retir
+retir
+retir
+retold
+retort
+retort
+retourn
+retract
+retreat
+retrograd
+ret
+return
+return
+returnest
+returneth
+return
+return
+revania
+reveal
+reveal
+revel
+revel
+revel
+revel
+revel
+revel
+revelri
+revel
+reveng
+reveng
+reveng
+reveng
+reveng
+reveng
+reveng
+reveng
+reveng
+revengingli
+revenu
+revenu
+reverb
+reverber
+reverb
+reverenc
+rever
+reverend
+rever
+rever
+rever
+revers
+revers
+revert
+review
+reviewest
+revil
+revil
+revisit
+reviv
+reviv
+reviv
+reviv
+revok
+revok
+revok
+revolt
+revolt
+revolt
+revolt
+revolut
+revolut
+revolv
+revolv
+reward
+reward
+reward
+reward
+reward
+reword
+reword
+rex
+rei
+reynaldo
+rford
+rful
+rfull
+rhapsodi
+rheim
+rhenish
+rhesu
+rhetor
+rheum
+rheumat
+rheum
+rheumi
+rhinocero
+rhode
+rhodop
+rhubarb
+rhym
+rhyme
+rhymer
+rhyme
+rhyme
+rialto
+rib
+ribald
+riband
+riband
+ribaudr
+ribb
+rib
+ribbon
+ribbon
+rib
+rice
+rich
+richard
+richer
+rich
+richest
+richli
+richmond
+richmond
+rid
+riddanc
+ridden
+riddl
+riddl
+riddl
+ride
+rider
+rider
+ride
+ridest
+rideth
+ridg
+ridg
+ridicul
+ride
+rid
+rien
+ri
+rifl
+rift
+rift
+rig
+rigg
+riggish
+right
+righteou
+righteous
+right
+rightfulli
+rightli
+right
+rigol
+rigor
+rigor
+rigour
+ril
+rim
+rin
+rinaldo
+rind
+ring
+ring
+ringlead
+ringlet
+ring
+ringwood
+riot
+rioter
+riot
+riotou
+riot
+rip
+ripe
+ripe
+ripen
+ripen
+ripe
+ripen
+ripen
+riper
+ripest
+ripe
+ripp
+rip
+rise
+risen
+rise
+riseth
+rish
+rise
+rite
+rite
+rivag
+rival
+rival
+rival
+rival
+rive
+rive
+rivel
+river
+river
+rivet
+rivet
+rivet
+rivo
+rj
+rless
+road
+road
+roam
+roam
+roan
+roar
+roar
+roarer
+roar
+roar
+roast
+roast
+rob
+roba
+roba
+robb
+rob
+robber
+robber
+robberi
+rob
+robe
+robe
+robert
+robe
+robin
+rob
+robusti
+rochest
+rochford
+rock
+rock
+rocki
+rod
+rode
+roderigo
+rod
+roe
+roe
+roger
+rogero
+rogu
+rogueri
+rogu
+roguish
+roi
+roist
+roll
+roll
+roll
+roll
+rom
+romag
+roman
+romano
+romano
+roman
+rome
+romeo
+romish
+rondur
+ronyon
+rood
+roof
+roof
+rook
+rook
+rooki
+room
+room
+root
+root
+rootedli
+rooteth
+root
+root
+rope
+roperi
+rope
+rope
+ro
+rosalind
+rosalinda
+rosalind
+rosalin
+rosciu
+rose
+rose
+rosemari
+rosencrantz
+rose
+ross
+rosi
+rot
+rote
+rote
+rother
+rotherham
+rot
+rot
+rotten
+rotten
+rot
+rotund
+rouen
+rough
+rougher
+roughest
+roughli
+rough
+round
+round
+roundel
+rounder
+roundest
+round
+roundli
+round
+roundur
+rou
+rous
+rous
+rousillon
+rousli
+roussi
+rout
+rout
+rout
+rove
+rover
+row
+rowel
+rowland
+rowland
+roi
+royal
+royal
+royal
+royalti
+royalti
+roynish
+rs
+rt
+rub
+rubb
+rub
+rubbish
+rubi
+rubiou
+rub
+rubi
+rud
+rudand
+rudder
+ruddi
+ruddock
+ruddi
+rude
+rude
+rude
+ruder
+rudesbi
+rudest
+rudiment
+rue
+ru
+ruff
+ruffian
+ruffian
+ruffl
+ruffl
+ruff
+rug
+rugbi
+rugemount
+rug
+ruin
+ruinat
+ruin
+ruin
+ruinou
+ruin
+rul
+rule
+rule
+ruler
+ruler
+rule
+rule
+rumbl
+ruminai
+ruminat
+rumin
+rumin
+rumin
+rumin
+rumor
+rumour
+rumour
+rumour
+rump
+run
+runag
+runag
+runawai
+runawai
+rung
+runn
+runner
+runner
+run
+run
+ruptur
+ruptur
+rural
+rush
+rush
+rush
+rushl
+rushi
+russet
+russia
+russian
+russian
+rust
+rust
+rustic
+rustic
+rustic
+rustl
+rustl
+rust
+rusti
+rut
+ruth
+ruth
+ruthless
+rutland
+ruttish
+ry
+rye
+ryth
+s
+sa
+saba
+sabbath
+sabl
+sabl
+sack
+sackbut
+sackcloth
+sack
+sackerson
+sack
+sacrament
+sacr
+sacrif
+sacrific
+sacrific
+sacrific
+sacrifici
+sacrif
+sacrilegi
+sacr
+sad
+sadder
+saddest
+saddl
+saddler
+saddl
+sadli
+sad
+saf
+safe
+safeguard
+safe
+safer
+safest
+safeti
+safeti
+saffron
+sag
+sage
+sagittari
+said
+saidst
+sail
+sail
+sailmak
+sailor
+sailor
+sail
+sain
+saint
+saint
+saintlik
+saint
+saith
+sake
+sake
+sala
+salad
+salamand
+salari
+sale
+salerio
+salicam
+saliqu
+salisburi
+sall
+sallet
+sallet
+salli
+sallow
+salli
+salmon
+salmon
+salt
+salter
+saltier
+salt
+saltpetr
+salut
+salut
+salut
+salut
+salut
+saluteth
+salv
+salvat
+salv
+salv
+same
+samingo
+samp
+sampir
+sampl
+sampler
+sampson
+samson
+samson
+sancta
+sanctifi
+sanctifi
+sanctifi
+sanctimoni
+sanctimoni
+sanctimoni
+sanctiti
+sanctiti
+sanctuar
+sanctuari
+sand
+sandal
+sandbag
+sand
+sand
+sandi
+sandi
+sang
+sanguin
+sangui
+saniti
+san
+santrail
+sap
+sapient
+sapit
+sapless
+sapl
+sapphir
+sapphir
+saracen
+sarcenet
+sard
+sardian
+sardinia
+sardi
+sarum
+sat
+satan
+satchel
+sate
+sate
+satiat
+satieti
+satin
+satir
+satir
+sati
+satisfact
+satisfi
+satisfi
+satisfi
+satisfi
+saturdai
+saturdai
+saturn
+saturnin
+saturninu
+satyr
+satyr
+sauc
+sauc
+sauc
+saucer
+sauc
+saucili
+sauci
+sauci
+sauf
+saunder
+sav
+savag
+savag
+savag
+savageri
+savag
+save
+save
+save
+save
+saviour
+savori
+savour
+savour
+savour
+savouri
+savoi
+saw
+saw
+sawest
+sawn
+sawpit
+saw
+sawyer
+saxon
+saxoni
+saxton
+sai
+sayest
+sai
+sai
+sai
+sayst
+sblood
+sc
+scab
+scabbard
+scab
+scaffold
+scaffoldag
+scal
+scald
+scald
+scald
+scale
+scale
+scale
+scale
+scall
+scalp
+scalp
+scali
+scambl
+scambl
+scamel
+scan
+scandal
+scandaliz
+scandal
+scandi
+scann
+scant
+scant
+scanter
+scant
+scantl
+scant
+scap
+scape
+scape
+scape
+scapeth
+scar
+scarc
+scarc
+scarciti
+scare
+scarecrow
+scarecrow
+scarf
+scarf
+scarf
+scare
+scarlet
+scarr
+scarr
+scar
+scaru
+scath
+scath
+scath
+scatt
+scatter
+scatter
+scatter
+scatter
+scelera
+scelerisqu
+scene
+scene
+scent
+scent
+scept
+scepter
+sceptr
+sceptr
+sceptr
+schedul
+schedul
+scholar
+scholarli
+scholar
+school
+schoolboi
+schoolboi
+schoolfellow
+school
+schoolmast
+schoolmast
+school
+sciatica
+sciatica
+scienc
+scienc
+scimitar
+scion
+scion
+scissor
+scoff
+scoffer
+scof
+scoff
+scoggin
+scold
+scold
+scold
+sconc
+scone
+scope
+scope
+scorch
+scorch
+score
+score
+score
+score
+scorn
+scorn
+scorn
+scornfulli
+scorn
+scorn
+scorpion
+scorpion
+scot
+scotch
+scotch
+scotland
+scot
+scottish
+scoundrel
+scour
+scour
+scourg
+scourg
+scour
+scout
+scout
+scowl
+scrap
+scrape
+scrape
+scrap
+scratch
+scratch
+scratch
+scream
+scream
+screech
+screech
+screen
+screen
+screw
+screw
+scribbl
+scribbl
+scribe
+scribe
+scrimer
+scrip
+scrippag
+scriptur
+scriptur
+scriven
+scroll
+scroll
+scroop
+scrowl
+scroyl
+scrub
+scrupl
+scrupl
+scrupul
+scuffl
+scuffl
+scullion
+scull
+scum
+scurril
+scurril
+scurril
+scurvi
+scuse
+scut
+scutcheon
+scutcheon
+scylla
+scyth
+scyth
+scythia
+scythian
+sdeath
+se
+sea
+seacoal
+seafar
+seal
+seal
+seal
+seal
+seam
+seamen
+seami
+seaport
+sear
+searc
+search
+searcher
+search
+searcheth
+search
+sear
+sea
+seasick
+seasid
+season
+season
+season
+seat
+seat
+seat
+sebastian
+second
+secondarili
+secondari
+second
+second
+secreci
+secret
+secretari
+secretari
+secretli
+secret
+sect
+sectari
+sect
+secundo
+secur
+secur
+secur
+secur
+sedg
+sedg
+sedg
+sedgi
+sedit
+sediti
+seduc
+seduc
+seduc
+seduc
+seduc
+see
+seed
+seed
+seed
+seed
+seedsman
+seein
+see
+seek
+seek
+seek
+seel
+seel
+seeli
+seem
+seem
+seemer
+seemest
+seemeth
+seem
+seemingli
+seemli
+seem
+seen
+seer
+see
+sees
+seest
+seeth
+seeth
+seeth
+seet
+segreg
+seigneur
+seigneur
+seiz
+seiz
+seiz
+seiz
+seizeth
+seiz
+seizur
+seld
+seldom
+select
+seleucu
+self
+selfsam
+sell
+seller
+sell
+sell
+selv
+semblabl
+semblabl
+semblanc
+semblanc
+sembl
+semi
+semicircl
+semirami
+semper
+semproniu
+senat
+senat
+senat
+send
+sender
+sendeth
+send
+send
+seneca
+senior
+seniori
+seni
+sennet
+senoi
+sens
+senseless
+sens
+sensibl
+sensibl
+sensual
+sensual
+sent
+sentenc
+sentenc
+sentenc
+sententi
+sentinel
+sentinel
+separ
+separ
+separ
+separ
+separ
+septentrion
+sepulchr
+sepulchr
+sepulchr
+sequel
+sequenc
+sequent
+sequest
+sequest
+sequestr
+sere
+sereni
+serg
+sergeant
+seriou
+serious
+sermon
+sermon
+serpent
+serpentin
+serpent
+serpigo
+serv
+servant
+servant
+servant
+serv
+serv
+server
+serv
+serveth
+servic
+servic
+servic
+servil
+servil
+serviliu
+serv
+servingman
+servingmen
+serviteur
+servitor
+servitor
+servitud
+sessa
+session
+session
+sesto
+set
+setebo
+set
+setter
+set
+settl
+settl
+settlest
+settl
+sev
+seven
+sevenfold
+sevennight
+seventeen
+seventh
+seventi
+sever
+sever
+sever
+sever
+sever
+sever
+sever
+severest
+sever
+sever
+severn
+sever
+sew
+seward
+sewer
+sew
+sex
+sex
+sexton
+sextu
+seymour
+seyton
+sfoot
+sh
+shackl
+shackl
+shade
+shade
+shadow
+shadow
+shadow
+shadow
+shadowi
+shadi
+shafalu
+shaft
+shaft
+shag
+shak
+shake
+shake
+shaken
+shake
+shake
+shale
+shall
+shalleng
+shallow
+shallowest
+shallowli
+shallow
+shalt
+sham
+shambl
+shame
+shame
+shame
+shamefulli
+shameless
+shame
+shamest
+shame
+shank
+shank
+shap
+shape
+shape
+shapeless
+shapen
+shape
+shape
+shar
+shard
+shard
+shard
+share
+share
+sharer
+share
+share
+shark
+sharp
+sharpen
+sharpen
+sharpen
+sharper
+sharpest
+sharpli
+sharp
+sharp
+shatter
+shav
+shave
+shaven
+shaw
+she
+sheaf
+sheal
+shear
+shearer
+shear
+shearman
+shear
+sheath
+sheath
+sheath
+sheath
+sheath
+sheav
+sheav
+shed
+shed
+shed
+sheen
+sheep
+sheepcot
+sheepcot
+sheep
+sheepskin
+sheer
+sheet
+sheet
+sheet
+sheffield
+shelf
+shell
+shell
+shelt
+shelter
+shelter
+shelv
+shelv
+shelvi
+shent
+shepherd
+shepherd
+shepherdess
+shepherdess
+shepherd
+sher
+sheriff
+sherri
+she
+sheweth
+shield
+shield
+shield
+shift
+shift
+shift
+shift
+shill
+shill
+shin
+shine
+shine
+shineth
+shine
+shin
+shini
+ship
+shipboard
+shipman
+shipmast
+shipmen
+shipp
+ship
+ship
+ship
+shipt
+shipwreck
+shipwreck
+shipwright
+shipwright
+shire
+shirlei
+shirt
+shirt
+shive
+shiver
+shiver
+shiver
+shoal
+shoal
+shock
+shock
+shod
+shoe
+shoe
+shoemak
+shoe
+shog
+shone
+shook
+shoon
+shoot
+shooter
+shooti
+shoot
+shoot
+shop
+shop
+shore
+shore
+shorn
+short
+shortcak
+shorten
+shorten
+shorten
+shorter
+shortli
+short
+shot
+shotten
+shough
+should
+shoulder
+shoulder
+shoulder
+shouldst
+shout
+shout
+shout
+shout
+shov
+shove
+shovel
+shovel
+show
+show
+shower
+shower
+showest
+show
+shown
+show
+shred
+shrew
+shrewd
+shrewdli
+shrewd
+shrewish
+shrewishli
+shrewish
+shrew
+shrewsburi
+shriek
+shriek
+shriek
+shriev
+shrift
+shrill
+shriller
+shrill
+shrilli
+shrimp
+shrine
+shrink
+shrink
+shrink
+shriv
+shrive
+shriver
+shrive
+shrive
+shroud
+shroud
+shroud
+shroud
+shrove
+shrow
+shrow
+shrub
+shrub
+shrug
+shrug
+shrunk
+shudd
+shudder
+shuffl
+shuffl
+shuffl
+shuffl
+shun
+shunless
+shunn
+shun
+shun
+shun
+shut
+shut
+shuttl
+shy
+shylock
+si
+sibyl
+sibylla
+sibyl
+sicil
+sicilia
+sicilian
+siciliu
+sicil
+sicili
+siciniu
+sick
+sicken
+sicken
+sicker
+sickl
+sicklemen
+sickli
+sickli
+sickli
+sick
+sicl
+sicyon
+side
+side
+side
+sieg
+sieg
+sienna
+si
+siev
+sift
+sift
+sigeia
+sigh
+sigh
+sigh
+sigh
+sight
+sight
+sightless
+sightli
+sight
+sign
+signal
+signet
+signieur
+signific
+signific
+signifi
+signifi
+signifi
+signifi
+signior
+signiori
+signior
+signiori
+signor
+signori
+sign
+signum
+silenc
+silenc
+silenc
+silenc
+silent
+silent
+siliu
+silk
+silken
+silkman
+silk
+silliest
+silli
+sill
+silli
+silva
+silver
+silver
+silverli
+silvia
+silviu
+sima
+simil
+simil
+simoi
+simon
+simoni
+simp
+simpcox
+simpl
+simpl
+simpler
+simpl
+simplic
+simpli
+simular
+simul
+sin
+sinc
+sincer
+sincer
+sincer
+sinel
+sinew
+sinew
+sinew
+sinewi
+sin
+sinfulli
+sing
+sing
+sing
+singer
+sing
+singeth
+sing
+singl
+singl
+singl
+singli
+sing
+singular
+singularit
+singular
+singular
+singul
+sinist
+sink
+sink
+sink
+sinn
+sinner
+sinner
+sin
+sinon
+sin
+sip
+sip
+sir
+sire
+siren
+sirrah
+sir
+sist
+sister
+sisterhood
+sisterli
+sister
+sit
+sith
+sithenc
+sit
+sit
+situat
+situat
+situat
+siward
+six
+sixpenc
+sixpenc
+sixpenni
+sixteen
+sixth
+sixti
+siz
+size
+size
+sizzl
+skain
+skambl
+skein
+skelter
+ski
+skil
+skilfulli
+skill
+skilless
+skillet
+skill
+skill
+skim
+skimbl
+skin
+skinker
+skinni
+skin
+skip
+skipp
+skipper
+skip
+skirmish
+skirmish
+skirr
+skirt
+skirt
+skittish
+skulk
+skull
+skull
+sky
+skyei
+skyish
+slab
+slack
+slackli
+slack
+slain
+slake
+sland
+slander
+slander
+slander
+slander
+slander
+slander
+slander
+slash
+slaught
+slaughter
+slaughter
+slaughter
+slaughterman
+slaughtermen
+slaughter
+slaughter
+slave
+slaver
+slaveri
+slave
+slavish
+slai
+slayeth
+slai
+slai
+sleav
+sled
+sleek
+sleekli
+sleep
+sleeper
+sleeper
+sleepest
+sleep
+sleep
+sleepi
+sleev
+sleev
+sleid
+sleid
+sleight
+sleight
+slender
+slender
+slenderli
+slept
+slew
+slewest
+slice
+slid
+slide
+slide
+slide
+slight
+slight
+slightest
+slightli
+slight
+slight
+slili
+slime
+slimi
+sling
+slink
+slip
+slipp
+slipper
+slipper
+slipperi
+slip
+slish
+slit
+sliver
+slobb
+slomber
+slop
+slope
+slop
+sloth
+sloth
+slough
+slovenli
+slovenri
+slow
+slower
+slowli
+slow
+slubber
+slug
+sluggard
+sluggardiz
+sluggish
+sluic
+slumb
+slumber
+slumber
+slumberi
+slunk
+slut
+slut
+slutteri
+sluttish
+sluttish
+sly
+sly
+smack
+smack
+smack
+small
+smaller
+smallest
+small
+smalu
+smart
+smart
+smartli
+smatch
+smatter
+smear
+smell
+smell
+smell
+smelt
+smil
+smile
+smile
+smile
+smilest
+smilet
+smile
+smilingli
+smirch
+smirch
+smit
+smite
+smite
+smith
+smithfield
+smock
+smock
+smok
+smoke
+smoke
+smoke
+smoke
+smoki
+smooth
+smooth
+smooth
+smoothli
+smooth
+smooth
+smote
+smoth
+smother
+smother
+smother
+smug
+smulkin
+smutch
+snaffl
+snail
+snail
+snake
+snake
+snaki
+snap
+snapp
+snapper
+snar
+snare
+snare
+snarl
+snarleth
+snarl
+snatch
+snatcher
+snatch
+snatch
+sneak
+sneak
+sneap
+sneap
+sneck
+snip
+snipe
+snipt
+snore
+snore
+snore
+snort
+snout
+snow
+snowbal
+snow
+snowi
+snuff
+snuff
+snug
+so
+soak
+soak
+soak
+soar
+soar
+soar
+sob
+sob
+sober
+soberli
+sobrieti
+sob
+sociabl
+societi
+societi
+sock
+socrat
+sod
+sodden
+soe
+soever
+soft
+soften
+soften
+softer
+softest
+softli
+soft
+soil
+soil
+soilur
+soit
+sojourn
+sol
+sola
+solac
+solanio
+sold
+soldat
+solder
+soldest
+soldier
+soldier
+soldiership
+sole
+sole
+solem
+solemn
+solem
+solemn
+solemn
+solemniz
+solemn
+solemn
+solemnli
+sole
+solicit
+solicit
+solicit
+solicit
+solicit
+solicitor
+solicit
+solid
+solidar
+solid
+solinu
+solitari
+solomon
+solon
+solum
+solu
+solyman
+some
+somebodi
+someon
+somerset
+somervil
+someth
+sometim
+sometim
+somev
+somewhat
+somewher
+somewhith
+somm
+son
+sonanc
+song
+song
+sonnet
+sonnet
+sonnet
+son
+sont
+sonti
+soon
+sooner
+soonest
+sooth
+sooth
+soother
+sooth
+soothsai
+soothsay
+sooti
+sop
+sophist
+sophist
+sophi
+sop
+sorcer
+sorcer
+sorceress
+sorceri
+sorceri
+sore
+sorel
+sore
+sorer
+sore
+sorrier
+sorriest
+sorrow
+sorrow
+sorrowest
+sorrow
+sorrow
+sorrow
+sorri
+sort
+sortanc
+sort
+sort
+sort
+sossiu
+sot
+soto
+sot
+sottish
+soud
+sought
+soul
+sould
+soulless
+soul
+sound
+sound
+sounder
+soundest
+sound
+soundless
+soundli
+sound
+soundpost
+sound
+sour
+sourc
+sourc
+sourest
+sourli
+sour
+sou
+sous
+south
+southam
+southampton
+southerli
+southern
+southward
+southwark
+southwel
+souviendrai
+sov
+sovereign
+sovereignest
+sovereignli
+sovereignti
+sovereignvour
+sow
+sow
+sowl
+sowter
+space
+space
+spaciou
+spade
+spade
+spain
+spak
+spake
+spakest
+span
+spangl
+spangl
+spaniard
+spaniel
+spaniel
+spanish
+spann
+span
+spar
+spare
+spare
+spare
+sparingli
+spark
+sparkl
+sparkl
+sparkl
+spark
+sparrow
+sparrow
+sparta
+spartan
+spavin
+spavin
+spawn
+speak
+speaker
+speaker
+speakest
+speaketh
+speak
+speak
+spear
+speargrass
+spear
+special
+special
+special
+specialti
+specialti
+specifi
+specious
+spectacl
+spectacl
+spectacl
+spectat
+spectatorship
+specul
+specul
+specul
+sped
+speech
+speech
+speechless
+speed
+speed
+speedier
+speediest
+speedili
+speedi
+speed
+speed
+speedi
+speen
+spell
+spell
+spell
+spelt
+spencer
+spend
+spendest
+spend
+spend
+spendthrift
+spent
+sperato
+sperm
+spero
+sperr
+spher
+sphere
+sphere
+sphere
+spheric
+spheri
+sphinx
+spice
+spice
+spiceri
+spice
+spider
+spider
+spi
+spi
+spieth
+spightfulli
+spigot
+spill
+spill
+spill
+spilt
+spilth
+spin
+spinii
+spinner
+spinster
+spinster
+spire
+spirit
+spirit
+spiritless
+spirit
+spiritu
+spiritualti
+spirt
+spit
+spital
+spite
+spite
+spite
+spite
+spit
+spit
+spit
+splai
+spleen
+spleen
+spleen
+spleeni
+splendour
+splenit
+splinter
+splinter
+split
+split
+split
+split
+spoil
+spoil
+spok
+spoke
+spoken
+spoke
+spokesman
+spong
+spongi
+spoon
+spoon
+sport
+sport
+sport
+sportiv
+sport
+spot
+spotless
+spot
+spot
+spousal
+spous
+spout
+spout
+spout
+sprag
+sprang
+sprat
+sprawl
+sprai
+sprai
+spread
+spread
+spread
+spright
+spright
+sprightli
+sprig
+spring
+spring
+spring
+springeth
+springhalt
+spring
+spring
+springtim
+sprinkl
+sprinkl
+sprite
+sprite
+sprite
+sprite
+sprite
+sprout
+spruce
+sprung
+spun
+spur
+spurio
+spurn
+spurn
+spurr
+spurrer
+spur
+spur
+spy
+spy
+squabbl
+squadron
+squadron
+squand
+squar
+squar
+squarer
+squar
+squash
+squeak
+squeak
+squeal
+squeal
+squeez
+squeez
+squel
+squier
+squint
+squini
+squir
+squir
+squirrel
+st
+stab
+stabb
+stab
+stab
+stabl
+stabl
+stabl
+stablish
+stablish
+stab
+stack
+staff
+stafford
+stafford
+staffordshir
+stag
+stage
+stage
+stagger
+stagger
+stagger
+stag
+staid
+staider
+stain
+stain
+stain
+staineth
+stain
+stainless
+stain
+stair
+stair
+stake
+stake
+stale
+stale
+stalk
+stalk
+stalk
+stall
+stall
+stall
+stamford
+stammer
+stamp
+stamp
+stamp
+stanch
+stanchless
+stand
+standard
+standard
+stander
+stander
+standest
+standeth
+stand
+stand
+staniel
+stanlei
+stanz
+stanzo
+stanzo
+stapl
+stapl
+star
+stare
+stare
+stare
+stare
+stare
+stark
+starkli
+starlight
+starl
+starr
+starri
+star
+start
+start
+start
+startingli
+startl
+startl
+start
+starv
+starv
+starv
+starvelackei
+starvel
+starveth
+starv
+state
+stateli
+state
+state
+statesman
+statesmen
+statiliu
+station
+statist
+statist
+statu
+statu
+statur
+statur
+statut
+statut
+stave
+stave
+stai
+stai
+stayest
+stai
+stai
+stead
+stead
+steadfast
+steadier
+stead
+steal
+stealer
+stealer
+steal
+steal
+stealth
+stealthi
+steed
+steed
+steel
+steel
+steeli
+steep
+steep
+steepl
+steepl
+steep
+steepi
+steer
+steerag
+steer
+steer
+stell
+stem
+stem
+stench
+step
+stepdam
+stephano
+stephen
+stepmoth
+stepp
+step
+step
+steril
+steril
+sterl
+stern
+sternag
+sterner
+sternest
+stern
+steterat
+stew
+steward
+steward
+stewardship
+stew
+stew
+stick
+stick
+stickler
+stick
+stiff
+stiffen
+stiffli
+stifl
+stifl
+stifl
+stigmat
+stigmat
+stile
+still
+stiller
+stillest
+still
+stilli
+sting
+sting
+stingless
+sting
+stink
+stink
+stinkingli
+stink
+stint
+stint
+stint
+stir
+stirr
+stir
+stirrer
+stirrer
+stirreth
+stir
+stirrup
+stirrup
+stir
+stitcheri
+stitch
+stithi
+stithi
+stoccado
+stoccata
+stock
+stockfish
+stock
+stock
+stockish
+stock
+stog
+stog
+stoic
+stokesli
+stol
+stole
+stolen
+stolest
+stomach
+stomach
+stomach
+stomach
+ston
+stone
+stonecutt
+stone
+stonish
+stoni
+stood
+stool
+stool
+stoop
+stoop
+stoop
+stop
+stope
+stopp
+stop
+stop
+stop
+stor
+store
+storehous
+storehous
+store
+stori
+storm
+storm
+storm
+storm
+stormi
+stori
+stoup
+stoup
+stout
+stouter
+stoutli
+stout
+stover
+stow
+stowag
+stow
+strachi
+straggler
+straggl
+straight
+straightest
+straightwai
+strain
+strain
+strain
+strain
+strait
+strait
+straiter
+straitli
+strait
+strait
+strand
+strang
+strang
+strang
+stranger
+stranger
+strangest
+strangl
+strangl
+strangler
+strangl
+strangl
+strappado
+strap
+stratagem
+stratagem
+stratford
+strato
+straw
+strawberri
+strawberri
+straw
+strawi
+strai
+strai
+strai
+streak
+streak
+stream
+streamer
+stream
+stream
+strech
+street
+street
+strength
+strengthen
+strengthen
+strengthless
+strength
+stretch
+stretch
+stretch
+stretch
+strew
+strew
+strew
+strewment
+stricken
+strict
+stricter
+strictest
+strictli
+strictur
+stride
+stride
+stride
+strife
+strife
+strik
+strike
+striker
+strike
+strikest
+strike
+string
+stringless
+string
+strip
+stripe
+stripl
+stripl
+stripp
+strip
+striv
+strive
+strive
+strive
+strok
+stroke
+stroke
+strond
+strond
+strong
+stronger
+strongest
+strongli
+strook
+strosser
+strove
+strown
+stroi
+struck
+strucken
+struggl
+struggl
+struggl
+strumpet
+strumpet
+strumpet
+strung
+strut
+strut
+strut
+strut
+stubbl
+stubborn
+stubbornest
+stubbornli
+stubborn
+stuck
+stud
+student
+student
+studi
+studi
+studiou
+studious
+stud
+studi
+studi
+stuff
+stuf
+stuff
+stumbl
+stumbl
+stumblest
+stumbl
+stump
+stump
+stung
+stupefi
+stupid
+stupifi
+stuprum
+sturdi
+sty
+styga
+stygian
+styl
+style
+styx
+su
+sub
+subcontract
+subdu
+subdu
+subdu
+subduement
+subdu
+subdu
+subject
+subject
+subject
+subject
+submerg
+submiss
+submiss
+submit
+submit
+submit
+suborn
+suborn
+suborn
+subscrib
+subscrib
+subscrib
+subscrib
+subscript
+subsequ
+subsidi
+subsidi
+subsist
+subsist
+substanc
+substanc
+substanti
+substitut
+substitut
+substitut
+substitut
+subtil
+subtilli
+subtl
+subtleti
+subtleti
+subtli
+subtractor
+suburb
+subvers
+subvert
+succed
+succe
+succeed
+succeed
+succeed
+succe
+success
+successantli
+success
+success
+successfulli
+success
+success
+success
+successor
+successor
+succour
+succour
+such
+suck
+sucker
+sucker
+suck
+suckl
+suck
+sudden
+suddenli
+sue
+su
+suerli
+sue
+sueth
+suff
+suffer
+suffer
+suffer
+suffer
+suffer
+suffer
+suffic
+suffic
+suffic
+suffic
+sufficeth
+suffici
+suffici
+suffici
+suffic
+sufficit
+suffig
+suffoc
+suffoc
+suffoc
+suffolk
+suffrag
+suffrag
+sug
+sugar
+sugarsop
+suggest
+suggest
+suggest
+suggest
+suggest
+suggest
+sui
+suit
+suitabl
+suit
+suit
+suitor
+suitor
+suit
+suivez
+sullen
+sullen
+sulli
+sulli
+sulli
+sulph
+sulpher
+sulphur
+sulphur
+sultan
+sultri
+sum
+sumless
+summ
+summa
+summari
+summer
+summer
+summit
+summon
+summon
+summon
+sumpter
+sumptuou
+sumptuous
+sum
+sun
+sunbeam
+sunburn
+sunburnt
+sund
+sundai
+sundai
+sunder
+sunder
+sundri
+sung
+sunk
+sunken
+sunni
+sunris
+sun
+sunset
+sunshin
+sup
+super
+superfici
+superfici
+superflu
+superflu
+superflu
+superflux
+superior
+supern
+supernatur
+superprais
+superscript
+superscript
+superservic
+superstit
+superstiti
+superstiti
+supersubtl
+supervis
+supervisor
+supp
+supper
+supper
+suppertim
+sup
+supplant
+suppl
+suppler
+supplianc
+suppliant
+suppliant
+supplic
+supplic
+supplic
+suppli
+suppli
+suppli
+suppliest
+suppli
+supplyant
+suppli
+supplyment
+support
+support
+support
+support
+support
+support
+support
+supportor
+suppo
+suppos
+suppos
+suppos
+suppos
+supposest
+suppos
+supposit
+suppress
+suppress
+suppresseth
+supremaci
+suprem
+sup
+sur
+suranc
+surceas
+surd
+sure
+surecard
+sure
+surer
+surest
+sureti
+sureti
+surfeit
+surfeit
+surfeit
+surfeit
+surfeit
+surg
+surgeon
+surgeon
+surger
+surgeri
+surg
+surli
+surmi
+surmis
+surmis
+surmis
+surmount
+surmount
+surmount
+surnam
+surnam
+surnam
+surpasseth
+surpass
+surplic
+surplu
+surpri
+surpris
+surpris
+surrend
+surrei
+surrei
+survei
+surveyest
+survei
+surveyor
+surveyor
+survei
+surviv
+surviv
+survivor
+susan
+suspect
+suspect
+suspect
+suspect
+suspend
+suspens
+suspicion
+suspicion
+suspici
+suspir
+suspir
+sust
+sustain
+sustain
+sutler
+sutton
+suum
+swabber
+swaddl
+swag
+swagg
+swagger
+swagger
+swagger
+swagger
+swain
+swain
+swallow
+swallow
+swallow
+swallow
+swam
+swan
+swan
+sward
+sware
+swarm
+swarm
+swart
+swarth
+swarth
+swarthi
+swasher
+swash
+swath
+swath
+swathl
+swai
+swai
+swai
+swear
+swearer
+swearer
+swearest
+swear
+swear
+swear
+sweat
+sweaten
+sweat
+sweat
+sweati
+sweep
+sweeper
+sweep
+sweet
+sweeten
+sweeten
+sweeter
+sweetest
+sweetheart
+sweet
+sweetli
+sweetmeat
+sweet
+sweet
+swell
+swell
+swell
+swell
+swelter
+sweno
+swept
+swerv
+swerver
+swerv
+swift
+swifter
+swiftest
+swiftli
+swift
+swill
+swill
+swim
+swimmer
+swimmer
+swim
+swim
+swine
+swineherd
+swing
+swing
+swinish
+swinstead
+switch
+swit
+switzer
+swol
+swoll
+swoln
+swoon
+swoon
+swoon
+swoon
+swoop
+swoopstak
+swor
+sword
+sworder
+sword
+swore
+sworn
+swound
+swound
+swum
+swung
+sy
+sycamor
+sycorax
+sylla
+syllabl
+syllabl
+syllog
+symbol
+sympathis
+sympathiz
+sympath
+sympath
+sympathi
+synagogu
+synod
+synod
+syracus
+syracusian
+syracusian
+syria
+syrup
+t
+ta
+taber
+tabl
+tabl
+tabl
+tablet
+tabor
+tabor
+tabor
+tabourin
+taciturn
+tack
+tackl
+tackl
+tackl
+tackl
+tackl
+taddl
+tadpol
+taffeta
+taffeti
+tag
+tagrag
+tah
+tail
+tailor
+tailor
+tail
+taint
+taint
+taint
+taint
+taintur
+tak
+take
+taken
+taker
+take
+takest
+taketh
+take
+tal
+talbot
+talbotit
+talbot
+tale
+talent
+talent
+taleport
+tale
+talk
+talk
+talker
+talker
+talkest
+talk
+talk
+tall
+taller
+tallest
+talli
+tallow
+talli
+talon
+tam
+tambourin
+tame
+tame
+tame
+tame
+tamer
+tame
+tame
+tamora
+tamworth
+tan
+tang
+tangl
+tangl
+tank
+tanl
+tann
+tan
+tanner
+tanquam
+tanta
+tantaen
+tap
+tape
+taper
+taper
+tapestri
+tapestri
+taphous
+tapp
+tapster
+tapster
+tar
+tardi
+tardili
+tardi
+tardi
+tarentum
+targ
+targ
+target
+target
+tarpeian
+tarquin
+tarquin
+tarr
+tarr
+tarrianc
+tarri
+tarri
+tarri
+tarri
+tart
+tartar
+tartar
+tartli
+tart
+task
+tasker
+task
+task
+tassel
+tast
+tast
+tast
+tast
+tatt
+tatter
+tatter
+tatter
+tattl
+tattl
+tattl
+taught
+taunt
+taunt
+taunt
+tauntingli
+taunt
+tauru
+tavern
+tavern
+tavi
+tawdri
+tawni
+tax
+taxat
+taxat
+tax
+tax
+tc
+te
+teach
+teacher
+teacher
+teach
+teachest
+teacheth
+teach
+team
+tear
+tear
+tear
+tear
+tearsheet
+teat
+tediou
+tedious
+tedious
+teem
+teem
+teem
+teen
+teeth
+teipsum
+telamon
+telamoniu
+tell
+teller
+tell
+tell
+tellu
+temp
+temper
+temper
+temper
+temper
+temper
+temper
+tempest
+tempest
+tempestu
+templ
+templ
+tempor
+temporari
+temporiz
+tempor
+tempor
+temp
+tempt
+temptat
+temptat
+tempt
+tempter
+tempter
+tempteth
+tempt
+tempt
+ten
+tenabl
+tenant
+tenantiu
+tenantless
+tenant
+tench
+tend
+tendanc
+tend
+tender
+tender
+tenderli
+tender
+tender
+tend
+tend
+tenedo
+tenement
+tenement
+tenfold
+tenni
+tenour
+tenour
+ten
+tent
+tent
+tenth
+tenth
+tent
+tenur
+tenur
+tercel
+tereu
+term
+termag
+term
+termin
+termless
+term
+terra
+terrac
+terram
+terra
+terr
+terren
+terrestri
+terribl
+terribl
+territori
+territori
+terror
+terror
+tertian
+tertio
+test
+testament
+test
+tester
+testern
+testifi
+testimoni
+testimoni
+testimoni
+testi
+testril
+testi
+tetchi
+tether
+tetter
+tevil
+tewksburi
+text
+tgv
+th
+thae
+thame
+than
+thane
+thane
+thank
+thank
+thank
+thankfulli
+thank
+thank
+thank
+thankless
+thank
+thanksgiv
+thaso
+that
+thatch
+thaw
+thaw
+thaw
+the
+theatr
+theban
+thebe
+thee
+theft
+theft
+thein
+their
+their
+theis
+them
+theme
+theme
+themselv
+then
+thenc
+thenceforth
+theoric
+there
+thereabout
+thereabout
+thereaft
+thereat
+therebi
+therefor
+therein
+thereof
+thereon
+thereto
+thereunto
+thereupon
+therewith
+therewith
+thersit
+these
+theseu
+thessalian
+thessali
+theti
+thew
+thei
+thick
+thicken
+thicken
+thicker
+thickest
+thicket
+thickskin
+thief
+thieveri
+thiev
+thievish
+thigh
+thigh
+thimbl
+thimbl
+thin
+thine
+thing
+thing
+think
+thinkest
+think
+think
+think
+thinkst
+thinli
+third
+thirdli
+third
+thirst
+thirst
+thirst
+thirsti
+thirteen
+thirti
+thirtieth
+thirti
+thi
+thisbi
+thisn
+thistl
+thistl
+thither
+thitherward
+thoa
+thoma
+thorn
+thorn
+thorni
+thorough
+thoroughli
+those
+thou
+though
+thought
+thought
+thought
+thousand
+thousand
+thracian
+thraldom
+thrall
+thrall
+thrall
+thrash
+thrason
+thread
+threadbar
+threaden
+thread
+threat
+threaten
+threaten
+threaten
+threatest
+threat
+three
+threefold
+threepenc
+threepil
+three
+threescor
+thresher
+threshold
+threw
+thrice
+thrift
+thriftless
+thrift
+thrifti
+thrill
+thrill
+thrill
+thrive
+thrive
+thriver
+thrive
+thrive
+throat
+throat
+throb
+throb
+throca
+throe
+throe
+thromuldo
+thron
+throne
+throne
+throne
+throng
+throng
+throng
+throstl
+throttl
+through
+throughfar
+throughfar
+throughli
+throughout
+throw
+thrower
+throwest
+throw
+thrown
+throw
+thrum
+thrumm
+thrush
+thrust
+thrusteth
+thrust
+thrust
+thumb
+thumb
+thump
+thund
+thunder
+thunderbolt
+thunderbolt
+thunder
+thunder
+thunderston
+thunderstrok
+thurio
+thursdai
+thu
+thwack
+thwart
+thwart
+thwart
+thwart
+thy
+thyme
+thymu
+thyreu
+thyself
+ti
+tib
+tiber
+tiberio
+tibei
+tice
+tick
+tickl
+tickl
+tickl
+tickl
+tickl
+ticklish
+tiddl
+tide
+tide
+tide
+tidi
+tie
+ti
+ti
+tiff
+tiger
+tiger
+tight
+tightli
+tike
+til
+tile
+till
+tillag
+tilli
+tilt
+tilter
+tilth
+tilt
+tilt
+tiltyard
+tim
+timandra
+timber
+time
+timeless
+timeli
+time
+time
+timon
+timor
+timor
+timor
+tinct
+tinctur
+tinctur
+tinder
+tingl
+tinker
+tinker
+tinsel
+tini
+tip
+tipp
+tippl
+tip
+tipsi
+tipto
+tir
+tire
+tire
+tire
+tirest
+tire
+tirra
+tirrit
+ti
+tish
+tisick
+tissu
+titan
+titania
+tith
+tith
+tith
+titiniu
+titl
+titl
+titleless
+titl
+tittl
+tittl
+titular
+titu
+tn
+to
+toad
+toad
+toadstool
+toast
+toast
+toast
+toast
+toaz
+tobi
+tock
+tod
+todai
+todpol
+tod
+toe
+toe
+tofor
+toge
+toge
+togeth
+toil
+toil
+toil
+toil
+token
+token
+told
+toledo
+toler
+toll
+toll
+tom
+tomb
+tomb
+tomb
+tombless
+tomboi
+tomb
+tomorrow
+tomyri
+ton
+tong
+tongu
+tongu
+tongu
+tongueless
+tongu
+tonight
+too
+took
+tool
+tool
+tooth
+toothach
+toothpick
+toothpick
+top
+topa
+top
+topgal
+topless
+topmast
+topp
+top
+toppl
+toppl
+top
+topsail
+topsi
+torch
+torchbear
+torchbear
+torcher
+torch
+torchlight
+tore
+torment
+tormenta
+torment
+torment
+torment
+tormentor
+torment
+torn
+torrent
+tortiv
+tortois
+tortur
+tortur
+tortur
+tortur
+tortur
+tortur
+torturest
+tortur
+toryn
+toss
+toss
+tosseth
+toss
+tot
+total
+total
+tott
+totter
+totter
+tou
+touch
+touch
+touch
+toucheth
+touch
+touchston
+tough
+tougher
+tough
+tourain
+tournament
+tour
+tou
+tout
+touz
+tow
+toward
+towardli
+toward
+tower
+tower
+tower
+town
+town
+township
+townsman
+townsmen
+towton
+toi
+toi
+trace
+trace
+track
+tract
+tractabl
+trade
+trade
+trader
+trade
+tradesman
+tradesmen
+trade
+tradit
+tradit
+traduc
+traduc
+traduc
+traffic
+traffick
+traffic
+tragedian
+tragedian
+tragedi
+tragedi
+tragic
+tragic
+trail
+train
+train
+train
+train
+trait
+traitor
+traitorli
+traitor
+traitor
+traitor
+traitress
+traject
+trammel
+trampl
+trampl
+trampl
+tranc
+tranc
+tranio
+tranquil
+tranquil
+transcend
+transcend
+transfer
+transfigur
+transfix
+transform
+transform
+transform
+transform
+transgress
+transgress
+transgress
+transgress
+translat
+translat
+translat
+translat
+transmigr
+transmut
+transpar
+transport
+transport
+transport
+transport
+transport
+transpos
+transshap
+trap
+trapp
+trap
+trap
+trash
+travail
+travail
+travel
+travel
+travel
+travel
+travel
+travel
+travel
+travellest
+travel
+travel
+traver
+travers
+trai
+treacher
+treacher
+treacher
+treacheri
+tread
+tread
+tread
+treason
+treason
+treason
+treason
+treasur
+treasur
+treasur
+treasuri
+treasuri
+treat
+treati
+treatis
+treat
+treati
+trebl
+trebl
+trebl
+treboniu
+tree
+tree
+trembl
+trembl
+trembl
+tremblest
+trembl
+tremblingli
+tremor
+trempl
+trench
+trenchant
+trench
+trencher
+trencher
+trencherman
+trencher
+trench
+trench
+trent
+tre
+trespass
+trespass
+tressel
+tress
+trei
+trial
+trial
+trib
+tribe
+tribe
+tribul
+tribun
+tribun
+tribun
+tributari
+tributari
+tribut
+tribut
+trice
+trick
+trick
+trickl
+trick
+tricksi
+trident
+tri
+trier
+trifl
+trifl
+trifler
+trifl
+trifl
+trigon
+trill
+trim
+trimli
+trimm
+trim
+trim
+trim
+trinculo
+trinculo
+trinket
+trip
+tripartit
+tripe
+tripl
+triplex
+tripoli
+tripoli
+tripp
+trip
+trippingli
+trip
+trist
+triton
+triumph
+triumphant
+triumphantli
+triumpher
+triumpher
+triumph
+triumph
+triumvir
+triumvir
+triumvir
+triumviri
+trivial
+troat
+trod
+trodden
+troiant
+troien
+troilu
+troilus
+trojan
+trojan
+troll
+tromperi
+trompet
+troop
+troop
+troop
+trop
+trophi
+trophi
+tropic
+trot
+troth
+troth
+troth
+trot
+trot
+troubl
+troubl
+troubler
+troubl
+troublesom
+troublest
+troublou
+trough
+trout
+trout
+trovato
+trow
+trowel
+trowest
+troi
+troyan
+troyan
+truant
+truce
+truckl
+trudg
+true
+trueborn
+truepenni
+truer
+truest
+truie
+trull
+trull
+truli
+trump
+trumperi
+trumpet
+trumpet
+trumpet
+trumpet
+truncheon
+truncheon
+trundl
+trunk
+trunk
+trust
+trust
+truster
+truster
+trust
+trust
+trusti
+truth
+truth
+try
+ts
+tu
+tuae
+tub
+tubal
+tub
+tuck
+tucket
+tuesdai
+tuft
+tuft
+tug
+tugg
+tug
+tuition
+tullu
+tulli
+tumbl
+tumbl
+tumbler
+tumbl
+tumult
+tumultu
+tun
+tune
+tuneabl
+tune
+tuner
+tune
+tuni
+tun
+tup
+turban
+turban
+turbul
+turbul
+turd
+turf
+turfi
+turk
+turkei
+turkei
+turkish
+turk
+turlygod
+turmoil
+turmoil
+turn
+turnbul
+turncoat
+turncoat
+turn
+turneth
+turn
+turnip
+turn
+turph
+turpitud
+turquois
+turret
+turret
+turtl
+turtl
+turvi
+tuscan
+tush
+tut
+tutor
+tutor
+tutor
+tutto
+twain
+twang
+twangl
+twa
+twai
+tweak
+tween
+twelfth
+twelv
+twelvemonth
+twentieth
+twenti
+twere
+twice
+twig
+twiggen
+twig
+twilight
+twill
+twill
+twin
+twine
+twink
+twinkl
+twinkl
+twinkl
+twinn
+twin
+twire
+twist
+twist
+twit
+twit
+twit
+twixt
+two
+twofold
+twopenc
+twopenc
+two
+twould
+tyb
+tybalt
+tybalt
+tyburn
+ty
+tyke
+tymbria
+type
+type
+typhon
+tyrann
+tyrann
+tyrann
+tyrann
+tyranni
+tyrant
+tyrant
+tyrian
+tyrrel
+u
+ubiqu
+udder
+udg
+ud
+uglier
+ugliest
+ugli
+ulcer
+ulcer
+ulyss
+um
+umber
+umbra
+umbrag
+umfrevil
+umpir
+umpir
+un
+unabl
+unaccommod
+unaccompani
+unaccustom
+unach
+unacquaint
+unact
+unadvi
+unadvis
+unadvisedli
+unagre
+unanel
+unansw
+unappea
+unapprov
+unapt
+unapt
+unarm
+unarm
+unarm
+unassail
+unassail
+unattaint
+unattempt
+unattend
+unauspici
+unauthor
+unavoid
+unawar
+unback
+unbak
+unband
+unbar
+unbarb
+unbash
+unbat
+unbatt
+unbecom
+unbefit
+unbegot
+unbegotten
+unbeliev
+unbend
+unbent
+unbewail
+unbid
+unbidden
+unbind
+unbind
+unbit
+unbless
+unblest
+unbloodi
+unblown
+unbodi
+unbolt
+unbolt
+unbonnet
+unbookish
+unborn
+unbosom
+unbound
+unbound
+unbow
+unbow
+unbrac
+unbrac
+unbraid
+unbreath
+unbr
+unbreech
+unbridl
+unbrok
+unbrui
+unbruis
+unbuckl
+unbuckl
+unbuckl
+unbuild
+unburden
+unburden
+unburi
+unburnt
+unburthen
+unbutton
+unbutton
+uncap
+uncap
+uncas
+uncas
+uncaught
+uncertain
+uncertainti
+unchain
+unchang
+uncharg
+uncharg
+uncharit
+unchari
+unchast
+uncheck
+unchild
+uncivil
+unclaim
+unclasp
+uncl
+unclean
+uncleanli
+uncleanli
+unclean
+uncl
+unclew
+unclog
+uncoin
+uncolt
+uncomeli
+uncomfort
+uncompassion
+uncomprehens
+unconfin
+unconfirm
+unconfirm
+unconqu
+unconqu
+unconsid
+unconst
+unconstrain
+unconstrain
+uncontemn
+uncontrol
+uncorrect
+uncount
+uncoupl
+uncourt
+uncouth
+uncov
+uncov
+uncrop
+uncross
+uncrown
+unction
+unctuou
+uncuckold
+uncur
+uncurb
+uncurb
+uncurl
+uncurr
+uncurs
+undaunt
+undeaf
+undeck
+undeed
+under
+underbear
+underborn
+undercrest
+underfoot
+undergo
+undergo
+undergo
+undergon
+underground
+underhand
+underl
+undermin
+undermin
+underneath
+underpr
+underprop
+understand
+understandeth
+understand
+understand
+understand
+understood
+underta
+undertak
+undertak
+undertak
+undertak
+undertak
+undertak
+undertook
+undervalu
+undervalu
+underw
+underwrit
+underwrit
+undescri
+undeserv
+undeserv
+undeserv
+undeserv
+undetermin
+undid
+undint
+undiscern
+undiscov
+undishonour
+undispo
+undistinguish
+undistinguish
+undivid
+undivid
+undivulg
+undo
+undo
+undo
+undon
+undoubt
+undoubtedli
+undream
+undress
+undress
+undrown
+undut
+unduti
+un
+unear
+unearn
+unearthli
+uneasin
+uneasi
+uneath
+uneduc
+uneffectu
+unelect
+unequ
+uneven
+unexamin
+unexecut
+unexpect
+unexperienc
+unexperi
+unexpress
+unfair
+unfaith
+unfal
+unfam
+unfashion
+unfasten
+unfath
+unfath
+unf
+unfe
+unfeel
+unfeign
+unfeignedli
+unfellow
+unfelt
+unfenc
+unfili
+unfil
+unfinish
+unfirm
+unfit
+unfit
+unfix
+unfledg
+unfold
+unfold
+unfoldeth
+unfold
+unfold
+unfool
+unforc
+unforc
+unforfeit
+unfortifi
+unfortun
+unfought
+unfrequ
+unfriend
+unfurnish
+ungain
+ungal
+ungart
+ungart
+ungenitur
+ungentl
+ungentl
+ungent
+ungird
+ungodli
+ungor
+ungot
+ungotten
+ungovern
+ungraci
+ungrat
+ungrav
+ungrown
+unguard
+unguem
+unguid
+unhack
+unhair
+unhallow
+unhallow
+unhand
+unhandl
+unhandsom
+unhang
+unhappi
+unhappili
+unhappi
+unhappi
+unharden
+unharm
+unhatch
+unheard
+unheart
+unheed
+unheedfulli
+unheedi
+unhelp
+unhidden
+unholi
+unhop
+unhopefullest
+unhors
+unhospit
+unhou
+unhous
+unhurt
+unicorn
+unicorn
+unimprov
+uninhabit
+uninhabit
+unintellig
+union
+union
+unit
+unit
+uniti
+univers
+univers
+univers
+univers
+unjoint
+unjust
+unjustic
+unjustli
+unkennel
+unkept
+unkind
+unkindest
+unkindli
+unkind
+unk
+unkinglik
+unkiss
+unknit
+unknow
+unknown
+unlac
+unlaid
+unlaw
+unlawfulli
+unlearn
+unlearn
+unless
+unlesson
+unlett
+unlett
+unlick
+unlik
+unlik
+unlimit
+unlin
+unlink
+unload
+unload
+unload
+unload
+unlock
+unlock
+unlook
+unlook
+unloo
+unloos
+unlov
+unlov
+unluckili
+unlucki
+unmad
+unmak
+unmanli
+unmann
+unmann
+unmannerd
+unmannerli
+unmarri
+unmask
+unmask
+unmask
+unmask
+unmast
+unmatch
+unmatch
+unmatch
+unmeasur
+unmeet
+unmellow
+unmerci
+unmerit
+unmerit
+unmind
+unmindful
+unmingl
+unmitig
+unmitig
+unmix
+unmoan
+unmov
+unmov
+unmov
+unmuffl
+unmuffl
+unmus
+unmuzzl
+unmuzzl
+unnatur
+unnatur
+unnatur
+unnecessarili
+unnecessari
+unneighbourli
+unnerv
+unnobl
+unnot
+unnumb
+unnumb
+unow
+unpack
+unpaid
+unparagon
+unparallel
+unparti
+unpath
+unpav
+unpai
+unpeac
+unpeg
+unpeopl
+unpeopl
+unperfect
+unperfect
+unpick
+unpin
+unpink
+unpiti
+unpitifulli
+unplagu
+unplaus
+unplea
+unpleas
+unpleas
+unpolici
+unpolish
+unpolish
+unpollut
+unpossess
+unpossess
+unposs
+unpracti
+unpregn
+unpremedit
+unprepar
+unprepar
+unpress
+unprevail
+unprev
+unpriz
+unpriz
+unprofit
+unprofit
+unprop
+unproperli
+unproport
+unprovid
+unprovid
+unprovid
+unprovok
+unprun
+unprun
+unpublish
+unpurg
+unpurpo
+unqual
+unqueen
+unquest
+unquestion
+unquiet
+unquietli
+unquiet
+unrais
+unrak
+unread
+unreadi
+unreal
+unreason
+unreason
+unreclaim
+unreconcil
+unreconcili
+unrecount
+unrecur
+unregard
+unregist
+unrel
+unremov
+unremov
+unrepriev
+unresolv
+unrespect
+unrespect
+unrest
+unrestor
+unrestrain
+unreveng
+unreverend
+unrever
+unrev
+unreward
+unright
+unright
+unrip
+unripp
+unrival
+unrol
+unroof
+unroost
+unroot
+unrough
+unruli
+unsaf
+unsalut
+unsanctifi
+unsatisfi
+unsavouri
+unsai
+unscal
+unscann
+unscarr
+unschool
+unscorch
+unscour
+unscratch
+unseal
+unseam
+unsearch
+unseason
+unseason
+unseason
+unseason
+unsecond
+unsecret
+unseduc
+unse
+unseem
+unseemli
+unseen
+unseminar
+unsepar
+unservic
+unset
+unsettl
+unsettl
+unsev
+unsex
+unshak
+unshak
+unshaken
+unshap
+unshap
+unsheath
+unsheath
+unshorn
+unshout
+unshown
+unshrink
+unshrubb
+unshunn
+unshunn
+unsift
+unsightli
+unsinew
+unsist
+unskil
+unskilfulli
+unskil
+unslip
+unsmirch
+unsoil
+unsolicit
+unsort
+unsought
+unsound
+unsound
+unspeak
+unspeak
+unspeak
+unspher
+unspok
+unspoken
+unspot
+unsquar
+unstabl
+unstaid
+unstain
+unstain
+unstanch
+unstat
+unsteadfast
+unstoop
+unstring
+unstuff
+unsubstanti
+unsuit
+unsuit
+unsulli
+unsunn
+unsur
+unsur
+unsuspect
+unswai
+unsway
+unswai
+unswear
+unswept
+unsworn
+untaint
+untalk
+untangl
+untangl
+untast
+untaught
+untemp
+untend
+untent
+untent
+unthank
+unthank
+unthink
+unthought
+unthread
+unthrift
+unthrift
+unthrifti
+unti
+unti
+until
+untimb
+untim
+untir
+untir
+untir
+untitl
+unto
+untold
+untouch
+untoward
+untowardli
+untrad
+untrain
+untrain
+untread
+untreasur
+untri
+untrim
+untrod
+untrodden
+untroubl
+untru
+untruss
+untruth
+untruth
+untuck
+untun
+untun
+untun
+untutor
+untutor
+untwin
+unurg
+unu
+unus
+unusu
+unvalu
+unvanquish
+unvarnish
+unveil
+unveil
+unvener
+unvex
+unviol
+unvirtu
+unvisit
+unvulner
+unwar
+unwarili
+unwash
+unwatch
+unweari
+unw
+unwedg
+unweed
+unweigh
+unweigh
+unwelcom
+unwept
+unwhipp
+unwholesom
+unwieldi
+unwil
+unwillingli
+unwilling
+unwind
+unwip
+unwis
+unwis
+unwish
+unwish
+unwit
+unwittingli
+unwont
+unwoo
+unworthi
+unworthiest
+unworthili
+unworthi
+unworthi
+unwrung
+unyok
+unyok
+up
+upbraid
+upbraid
+upbraid
+upbraid
+uphoard
+uphold
+upholdeth
+uphold
+uphold
+uplift
+uplift
+upmost
+upon
+upper
+uprear
+uprear
+upright
+upright
+upright
+upris
+upris
+uproar
+uproar
+uprou
+upshoot
+upshot
+upsid
+upspr
+upstair
+upstart
+upturn
+upward
+upward
+urchin
+urchinfield
+urchin
+urg
+urg
+urg
+urgent
+urg
+urgest
+urg
+urin
+urin
+urin
+urn
+urn
+ur
+ursa
+urslei
+ursula
+urswick
+us
+usag
+usanc
+usanc
+us
+us
+us
+useless
+user
+us
+usest
+useth
+usher
+usher
+usher
+usher
+us
+usual
+usual
+usur
+usur
+usuri
+usur
+usurp
+usurp
+usurp
+usurp
+usurp
+usurp
+usurpingli
+usurp
+usuri
+ut
+utensil
+utensil
+util
+utmost
+utt
+utter
+utter
+utter
+uttereth
+utter
+utterli
+uttermost
+utter
+uy
+v
+va
+vacanc
+vacant
+vacat
+vade
+vagabond
+vagabond
+vagram
+vagrom
+vail
+vail
+vail
+vaillant
+vain
+vainer
+vainglori
+vainli
+vain
+vai
+valanc
+valanc
+vale
+valenc
+valentin
+valentinu
+valentio
+valeria
+valeriu
+vale
+valiant
+valiantli
+valiant
+valid
+vallant
+vallei
+vallei
+valli
+valor
+valor
+valor
+valour
+valu
+valuat
+valu
+valu
+valueless
+valu
+valu
+vane
+vanish
+vanish
+vanish
+vanishest
+vanish
+vaniti
+vaniti
+vanquish
+vanquish
+vanquish
+vanquishest
+vanquisheth
+vant
+vantag
+vantag
+vantbrac
+vapian
+vapor
+vapor
+vapour
+vapour
+vara
+variabl
+varianc
+variat
+variat
+vari
+variest
+varieti
+varld
+varlet
+varletri
+varlet
+varletto
+varnish
+varriu
+varro
+vari
+vari
+vassal
+vassalag
+vassal
+vast
+vastid
+vasti
+vat
+vater
+vaudemont
+vaughan
+vault
+vaultag
+vault
+vault
+vault
+vaulti
+vaumond
+vaunt
+vaunt
+vaunter
+vaunt
+vauntingli
+vaunt
+vauvado
+vaux
+vaward
+ve
+veal
+vede
+vehem
+vehem
+vehement
+vehor
+veil
+veil
+veil
+vein
+vein
+vell
+velur
+velutu
+velvet
+vendibl
+vener
+vener
+venetia
+venetian
+venetian
+venei
+veng
+vengeanc
+vengeanc
+veng
+veni
+venial
+venic
+venison
+venit
+venom
+venom
+venom
+vent
+ventag
+vent
+ventidiu
+ventricl
+vent
+ventur
+ventur
+ventur
+ventur
+ventur
+ventur
+venu
+venu
+venuto
+ver
+verb
+verba
+verbal
+verbatim
+verbos
+verdict
+verdun
+verdur
+vere
+verefor
+verg
+verg
+verger
+verg
+verier
+veriest
+verifi
+verifi
+verili
+verit
+verit
+veriti
+veriti
+vermilion
+vermin
+vernon
+verona
+veronesa
+versal
+vers
+vers
+vers
+vert
+veri
+vesper
+vessel
+vessel
+vestal
+vestment
+vestur
+vetch
+vetch
+veux
+vex
+vexat
+vexat
+vex
+vex
+vexest
+vexeth
+vex
+vi
+via
+vial
+vial
+viand
+viand
+vic
+vicar
+vice
+viceger
+vicentio
+viceroi
+viceroi
+vice
+vici
+viciou
+vicious
+vict
+victim
+victor
+victoress
+victori
+victori
+victor
+victori
+victual
+victual
+victual
+videlicet
+video
+vide
+videsn
+vidi
+vie
+vi
+vienna
+view
+viewest
+vieweth
+view
+viewless
+view
+vigil
+vigil
+vigil
+vigit
+vigour
+vii
+viii
+vile
+vile
+vile
+viler
+vilest
+vill
+villag
+villag
+villageri
+villag
+villain
+villaini
+villain
+villain
+villain
+villaini
+villani
+villan
+villani
+villiago
+villian
+villianda
+villian
+vinaigr
+vincentio
+vincer
+vindic
+vine
+vinegar
+vine
+vineyard
+vineyard
+vint
+vintner
+viol
+viola
+violat
+violat
+violat
+violat
+violat
+violenc
+violent
+violenta
+violenteth
+violent
+violet
+violet
+viper
+viper
+viper
+vir
+virgilia
+virgin
+virgin
+virginal
+virgin
+virginiu
+virgin
+virgo
+virtu
+virtu
+virtuou
+virtuous
+visag
+visag
+visag
+visard
+viscount
+visibl
+visibl
+vision
+vision
+visit
+visit
+visit
+visit
+visit
+visit
+visitor
+visitor
+visit
+visor
+vita
+vita
+vital
+vitement
+vitruvio
+vitx
+viva
+vivant
+vive
+vixen
+viz
+vizament
+vizard
+vizard
+vizard
+vizor
+vlout
+vocat
+vocativo
+vocatur
+voce
+voic
+voic
+voic
+void
+void
+void
+voke
+volabl
+volant
+volivorco
+vollei
+volquessen
+volsc
+volsc
+volscian
+volscian
+volt
+voltemand
+volubl
+volubl
+volum
+volum
+volumnia
+volumniu
+voluntari
+voluntari
+voluptu
+voluptu
+vomiss
+vomit
+vomit
+vor
+vore
+vortnight
+vot
+votari
+votarist
+votarist
+votari
+votr
+vouch
+voucher
+voucher
+vouch
+vouch
+vouchsaf
+vouchsaf
+vouchsaf
+vouchsaf
+vouchsaf
+voudrai
+vour
+vou
+voutsaf
+vow
+vow
+vowel
+vowel
+vow
+vow
+vox
+voyag
+voyag
+vraiment
+vulcan
+vulgar
+vulgarli
+vulgar
+vulgo
+vulner
+vultur
+vultur
+vurther
+w
+wad
+waddl
+wade
+wade
+wafer
+waft
+waftag
+waft
+waft
+wag
+wage
+wager
+wager
+wage
+wag
+waggish
+waggl
+waggon
+waggon
+wagon
+wagon
+wag
+wagtail
+wail
+wail
+wail
+wail
+wain
+wainrop
+wainscot
+waist
+wait
+wait
+waiter
+waiteth
+wait
+wait
+wak
+wake
+wake
+wakefield
+waken
+waken
+wake
+wakest
+wake
+wale
+walk
+walk
+walk
+walk
+wall
+wall
+wallet
+wallet
+wallon
+walloon
+wallow
+wall
+walnut
+walter
+wan
+wand
+wander
+wander
+wander
+wander
+wander
+wand
+wane
+wane
+wane
+wane
+wann
+want
+want
+wanteth
+want
+wanton
+wantonli
+wanton
+wanton
+want
+wappen
+war
+warbl
+warbl
+ward
+ward
+warden
+warder
+warder
+wardrob
+wardrop
+ward
+ware
+ware
+warili
+warkworth
+warlik
+warm
+warm
+warmer
+warm
+warm
+warmth
+warn
+warn
+warn
+warn
+warn
+warp
+warp
+warr
+warrant
+warrant
+warranteth
+warrantis
+warrant
+warrant
+warranti
+warren
+warren
+war
+warrior
+warrior
+war
+wart
+warwick
+warwickshir
+wari
+wa
+wash
+wash
+washer
+wash
+washford
+wash
+wasp
+waspish
+wasp
+wassail
+wassail
+wast
+wast
+wast
+wast
+waster
+wast
+wast
+wat
+watch
+watch
+watcher
+watch
+watch
+watch
+watch
+watchman
+watchmen
+watchword
+water
+waterdrop
+water
+waterfli
+waterford
+water
+waterish
+waterpot
+waterrug
+water
+waterton
+wateri
+wav
+wave
+wave
+waver
+waver
+waver
+wave
+wave
+waw
+wawl
+wax
+wax
+waxen
+wax
+wax
+wai
+waylaid
+waylai
+wai
+wayward
+wayward
+wayward
+we
+weak
+weaken
+weaken
+weaker
+weakest
+weakl
+weakli
+weak
+weal
+wealsmen
+wealth
+wealthiest
+wealthili
+wealthi
+wealtlli
+wean
+weapon
+weapon
+wear
+wearer
+wearer
+weari
+weari
+weariest
+wearili
+weari
+wear
+wearisom
+wear
+weari
+weasel
+weather
+weathercock
+weather
+weav
+weav
+weaver
+weaver
+weav
+weav
+web
+wed
+wed
+wed
+wedg
+wedg
+wedg
+wedlock
+wednesdai
+weed
+weed
+weeder
+weed
+weed
+weedi
+week
+week
+weekli
+week
+ween
+ween
+weep
+weeper
+weep
+weepingli
+weep
+weep
+weet
+weigh
+weigh
+weigh
+weigh
+weight
+weightier
+weightless
+weight
+weighti
+weird
+welcom
+welcom
+welcom
+welcom
+welcomest
+welfar
+welkin
+well
+well
+welsh
+welshman
+welshmen
+welshwomen
+wench
+wench
+wench
+wend
+went
+wept
+weradai
+were
+wert
+west
+western
+westminst
+westmoreland
+westward
+wet
+wether
+wet
+wezand
+whale
+whale
+wharf
+wharf
+what
+whate
+whatev
+whatso
+whatsoev
+whatsom
+whe
+wheat
+wheaten
+wheel
+wheel
+wheel
+wheer
+wheeson
+wheez
+whelk
+whelk
+whelm
+whelp
+whelp
+whelp
+when
+whena
+whenc
+whencesoev
+whene
+whenev
+whensoev
+where
+whereabout
+wherea
+whereat
+wherebi
+wherefor
+wherein
+whereinto
+whereof
+whereon
+whereout
+whereso
+whereso
+wheresoev
+wheresom
+whereto
+whereuntil
+whereunto
+whereupon
+wherev
+wherewith
+wherewith
+whet
+whether
+whetston
+whet
+whew
+whei
+which
+whiff
+whiffler
+while
+while
+whilst
+whin
+whine
+whine
+whinid
+whine
+whip
+whipp
+whipper
+whip
+whip
+whipster
+whipstock
+whipt
+whirl
+whirl
+whirligig
+whirl
+whirlpool
+whirl
+whirlwind
+whirlwind
+whisp
+whisper
+whisper
+whisper
+whisper
+whist
+whistl
+whistl
+whistl
+whit
+white
+whitehal
+white
+white
+whiter
+white
+whitest
+whither
+white
+whitmor
+whitster
+whitsun
+whittl
+whizz
+who
+whoa
+whoe
+whoever
+whole
+wholesom
+wholesom
+wholli
+whom
+whoobub
+whoop
+whoop
+whor
+whore
+whoremast
+whoremasterli
+whoremong
+whore
+whoreson
+whoreson
+whore
+whorish
+whose
+whoso
+whoso
+whosoev
+why
+wi
+wick
+wick
+wickedn
+wicked
+wicket
+wicki
+wid
+wide
+widen
+wider
+widow
+widow
+widow
+widowhood
+widow
+wield
+wife
+wight
+wight
+wild
+wildcat
+wilder
+wilder
+wildest
+wildfir
+wildli
+wild
+wild
+wile
+wil
+wilful
+wilfulli
+wilfuln
+wil
+will
+will
+willer
+willeth
+william
+william
+will
+willingli
+willing
+willoughbi
+willow
+will
+wilt
+wiltshir
+wimpl
+win
+winc
+winch
+winchest
+wincot
+wind
+wind
+windgal
+wind
+windlass
+windmil
+window
+window
+windpip
+wind
+windsor
+windi
+wine
+wing
+wing
+wingfield
+wingham
+wing
+wink
+wink
+wink
+winner
+winner
+win
+winnow
+winnow
+winnow
+win
+winter
+winterli
+winter
+wip
+wipe
+wipe
+wipe
+wipe
+wire
+wire
+wiri
+wisdom
+wisdom
+wise
+wiseli
+wise
+wiser
+wisest
+wish
+wish
+wisher
+wisher
+wish
+wishest
+wisheth
+wish
+wish
+wishtli
+wisp
+wist
+wit
+witb
+witch
+witchcraft
+witch
+witch
+with
+withal
+withdraw
+withdraw
+withdrawn
+withdrew
+wither
+wither
+wither
+wither
+withheld
+withhold
+withhold
+within
+withold
+without
+withstand
+withstand
+withstood
+witless
+wit
+wit
+witnesseth
+wit
+wit
+wit
+wittenberg
+wittiest
+wittili
+wit
+wittingli
+wittol
+wittolli
+witti
+wiv
+wive
+wive
+wive
+wive
+wizard
+wizard
+wo
+woe
+woeful
+woeful
+woefullest
+woe
+woful
+wolf
+wolfish
+wolsei
+wolv
+wolvish
+woman
+womanhood
+womanish
+womankind
+womanli
+womb
+womb
+wombi
+women
+won
+woncot
+wond
+wonder
+wonder
+wonder
+wonderfulli
+wonder
+wonder
+wondrou
+wondrous
+wont
+wont
+woo
+wood
+woodbin
+woodcock
+woodcock
+wooden
+woodland
+woodman
+woodmong
+wood
+woodstock
+woodvil
+woo
+wooer
+wooer
+wooe
+woof
+woo
+wooingli
+wool
+woollen
+woolli
+woolsack
+woolsei
+woolward
+woo
+wor
+worcest
+word
+word
+wore
+worin
+work
+worker
+work
+work
+workman
+workmanli
+workmanship
+workmen
+work
+worki
+world
+worldl
+worldli
+world
+worm
+worm
+wormwood
+wormi
+worn
+worri
+worri
+worri
+worri
+wors
+worser
+worship
+worship
+worshipfulli
+worshipp
+worshipp
+worshipp
+worshippest
+worship
+worst
+worst
+wort
+worth
+worthi
+worthier
+worthi
+worthiest
+worthili
+worthi
+worthless
+worth
+worthi
+wort
+wot
+wot
+wot
+wouid
+would
+wouldest
+wouldst
+wound
+wound
+wound
+wound
+woundless
+wound
+woun
+woven
+wow
+wrack
+wrack
+wrangl
+wrangler
+wrangler
+wrangl
+wrap
+wrapp
+wrap
+wrapt
+wrath
+wrath
+wrathfulli
+wrath
+wreak
+wreak
+wreak
+wreath
+wreath
+wreathen
+wreath
+wreck
+wreck
+wreck
+wren
+wrench
+wrench
+wren
+wrest
+wrest
+wrest
+wrestl
+wrestl
+wrestler
+wrestl
+wretch
+wretchcd
+wretch
+wretched
+wretch
+wring
+wringer
+wring
+wring
+wrinkl
+wrinkl
+wrinkl
+wrist
+wrist
+writ
+write
+writer
+writer
+write
+writhl
+write
+write
+writ
+written
+wrong
+wrong
+wronger
+wrong
+wrongfulli
+wrong
+wrongli
+wrong
+wronk
+wrote
+wroth
+wrought
+wrung
+wry
+wry
+wt
+wul
+wye
+x
+xanthipp
+xi
+xii
+xiii
+xiv
+xv
+y
+yard
+yard
+yare
+yare
+yarn
+yaughan
+yaw
+yawn
+yawn
+yclepe
+yclipe
+ye
+yea
+yead
+year
+yearli
+yearn
+yearn
+year
+yea
+yeast
+yedward
+yell
+yellow
+yellow
+yellow
+yellow
+yellow
+yell
+yelp
+yeoman
+yeomen
+yerk
+ye
+yesterdai
+yesterdai
+yesternight
+yesti
+yet
+yew
+yicld
+yield
+yield
+yielder
+yielder
+yield
+yield
+yok
+yoke
+yoke
+yokefellow
+yoke
+yoketh
+yon
+yond
+yonder
+yongrei
+yore
+yorick
+york
+yorkist
+york
+yorkshir
+you
+young
+younger
+youngest
+youngl
+youngl
+youngli
+younker
+your
+your
+yourself
+yourselv
+youth
+youth
+youth
+youtli
+zani
+zani
+zeal
+zealou
+zeal
+zed
+zenelophon
+zenith
+zephyr
+zir
+zo
+zodiac
+zodiac
+zone
+zound
+zwagger
diff --git a/extra/porter-stemmer/test/voc.txt b/extra/porter-stemmer/test/voc.txt
new file mode 100644 (file)
index 0000000..604ef40
--- /dev/null
@@ -0,0 +1,23531 @@
+a
+aaron
+abaissiez
+abandon
+abandoned
+abase
+abash
+abate
+abated
+abatement
+abatements
+abates
+abbess
+abbey
+abbeys
+abbominable
+abbot
+abbots
+abbreviated
+abed
+abel
+aberga
+abergavenny
+abet
+abetting
+abhominable
+abhor
+abhorr
+abhorred
+abhorring
+abhors
+abhorson
+abide
+abides
+abilities
+ability
+abject
+abjectly
+abjects
+abjur
+abjure
+able
+abler
+aboard
+abode
+aboded
+abodements
+aboding
+abominable
+abominably
+abominations
+abortive
+abortives
+abound
+abounding
+about
+above
+abr
+abraham
+abram
+abreast
+abridg
+abridge
+abridged
+abridgment
+abroach
+abroad
+abrogate
+abrook
+abrupt
+abruption
+abruptly
+absence
+absent
+absey
+absolute
+absolutely
+absolv
+absolver
+abstains
+abstemious
+abstinence
+abstract
+absurd
+absyrtus
+abundance
+abundant
+abundantly
+abus
+abuse
+abused
+abuser
+abuses
+abusing
+abutting
+aby
+abysm
+ac
+academe
+academes
+accent
+accents
+accept
+acceptable
+acceptance
+accepted
+accepts
+access
+accessary
+accessible
+accidence
+accident
+accidental
+accidentally
+accidents
+accite
+accited
+accites
+acclamations
+accommodate
+accommodated
+accommodation
+accommodations
+accommodo
+accompanied
+accompany
+accompanying
+accomplices
+accomplish
+accomplished
+accomplishing
+accomplishment
+accompt
+accord
+accordant
+accorded
+accordeth
+according
+accordingly
+accords
+accost
+accosted
+account
+accountant
+accounted
+accounts
+accoutred
+accoutrement
+accoutrements
+accrue
+accumulate
+accumulated
+accumulation
+accurs
+accursed
+accurst
+accus
+accusation
+accusations
+accusative
+accusativo
+accuse
+accused
+accuser
+accusers
+accuses
+accuseth
+accusing
+accustom
+accustomed
+ace
+acerb
+ache
+acheron
+aches
+achiev
+achieve
+achieved
+achievement
+achievements
+achiever
+achieves
+achieving
+achilles
+aching
+achitophel
+acknowledg
+acknowledge
+acknowledged
+acknowledgment
+acknown
+acold
+aconitum
+acordo
+acorn
+acquaint
+acquaintance
+acquainted
+acquaints
+acquir
+acquire
+acquisition
+acquit
+acquittance
+acquittances
+acquitted
+acre
+acres
+across
+act
+actaeon
+acted
+acting
+action
+actions
+actium
+active
+actively
+activity
+actor
+actors
+acts
+actual
+acture
+acute
+acutely
+ad
+adage
+adallas
+adam
+adamant
+add
+added
+adder
+adders
+addeth
+addict
+addicted
+addiction
+adding
+addition
+additions
+addle
+address
+addressing
+addrest
+adds
+adhere
+adheres
+adieu
+adieus
+adjacent
+adjoin
+adjoining
+adjourn
+adjudg
+adjudged
+adjunct
+administer
+administration
+admir
+admirable
+admiral
+admiration
+admire
+admired
+admirer
+admiring
+admiringly
+admission
+admit
+admits
+admittance
+admitted
+admitting
+admonish
+admonishing
+admonishment
+admonishments
+admonition
+ado
+adonis
+adopt
+adopted
+adoptedly
+adoption
+adoptious
+adopts
+ador
+adoration
+adorations
+adore
+adorer
+adores
+adorest
+adoreth
+adoring
+adorn
+adorned
+adornings
+adornment
+adorns
+adown
+adramadio
+adrian
+adriana
+adriano
+adriatic
+adsum
+adulation
+adulterate
+adulterates
+adulterers
+adulteress
+adulteries
+adulterous
+adultery
+adultress
+advanc
+advance
+advanced
+advancement
+advancements
+advances
+advancing
+advantage
+advantageable
+advantaged
+advantageous
+advantages
+advantaging
+advent
+adventur
+adventure
+adventures
+adventuring
+adventurous
+adventurously
+adversaries
+adversary
+adverse
+adversely
+adversities
+adversity
+advertis
+advertise
+advertised
+advertisement
+advertising
+advice
+advis
+advise
+advised
+advisedly
+advises
+advisings
+advocate
+advocation
+aeacida
+aeacides
+aedile
+aediles
+aegeon
+aegion
+aegles
+aemelia
+aemilia
+aemilius
+aeneas
+aeolus
+aer
+aerial
+aery
+aesculapius
+aeson
+aesop
+aetna
+afar
+afear
+afeard
+affability
+affable
+affair
+affaire
+affairs
+affect
+affectation
+affectations
+affected
+affectedly
+affecteth
+affecting
+affection
+affectionate
+affectionately
+affections
+affects
+affeer
+affianc
+affiance
+affianced
+affied
+affin
+affined
+affinity
+affirm
+affirmation
+affirmatives
+afflict
+afflicted
+affliction
+afflictions
+afflicts
+afford
+affordeth
+affords
+affray
+affright
+affrighted
+affrights
+affront
+affronted
+affy
+afield
+afire
+afloat
+afoot
+afore
+aforehand
+aforesaid
+afraid
+afresh
+afric
+africa
+african
+afront
+after
+afternoon
+afterward
+afterwards
+ag
+again
+against
+agamemmon
+agamemnon
+agate
+agaz
+age
+aged
+agenor
+agent
+agents
+ages
+aggravate
+aggrief
+agile
+agincourt
+agitation
+aglet
+agnize
+ago
+agone
+agony
+agree
+agreed
+agreeing
+agreement
+agrees
+agrippa
+aground
+ague
+aguecheek
+agued
+agueface
+agues
+ah
+aha
+ahungry
+ai
+aialvolio
+aiaria
+aid
+aidance
+aidant
+aided
+aiding
+aidless
+aids
+ail
+aim
+aimed
+aimest
+aiming
+aims
+ainsi
+aio
+air
+aired
+airless
+airs
+airy
+ajax
+akilling
+al
+alabaster
+alack
+alacrity
+alarbus
+alarm
+alarms
+alarum
+alarums
+alas
+alb
+alban
+albans
+albany
+albeit
+albion
+alchemist
+alchemy
+alcibiades
+alcides
+alder
+alderman
+aldermen
+ale
+alecto
+alehouse
+alehouses
+alencon
+alengon
+aleppo
+ales
+alewife
+alexander
+alexanders
+alexandria
+alexandrian
+alexas
+alias
+alice
+alien
+aliena
+alight
+alighted
+alights
+aliis
+alike
+alisander
+alive
+all
+alla
+allay
+allayed
+allaying
+allayment
+allayments
+allays
+allegation
+allegations
+allege
+alleged
+allegiance
+allegiant
+alley
+alleys
+allhallowmas
+alliance
+allicholy
+allied
+allies
+alligant
+alligator
+allons
+allot
+allots
+allotted
+allottery
+allow
+allowance
+allowed
+allowing
+allows
+allur
+allure
+allurement
+alluring
+allusion
+ally
+allycholly
+almain
+almanac
+almanack
+almanacs
+almighty
+almond
+almost
+alms
+almsman
+aloes
+aloft
+alone
+along
+alonso
+aloof
+aloud
+alphabet
+alphabetical
+alphonso
+alps
+already
+also
+alt
+altar
+altars
+alter
+alteration
+altered
+alters
+althaea
+although
+altitude
+altogether
+alton
+alway
+always
+am
+amaimon
+amain
+amaking
+amamon
+amaz
+amaze
+amazed
+amazedly
+amazedness
+amazement
+amazes
+amazeth
+amazing
+amazon
+amazonian
+amazons
+ambassador
+ambassadors
+amber
+ambiguides
+ambiguities
+ambiguous
+ambition
+ambitions
+ambitious
+ambitiously
+amble
+ambled
+ambles
+ambling
+ambo
+ambuscadoes
+ambush
+amen
+amend
+amended
+amendment
+amends
+amerce
+america
+ames
+amiable
+amid
+amidst
+amiens
+amis
+amiss
+amities
+amity
+amnipotent
+among
+amongst
+amorous
+amorously
+amort
+amount
+amounts
+amour
+amphimacus
+ample
+ampler
+amplest
+amplified
+amplify
+amply
+ampthill
+amurath
+amyntas
+an
+anatomiz
+anatomize
+anatomy
+ancestor
+ancestors
+ancestry
+anchises
+anchor
+anchorage
+anchored
+anchoring
+anchors
+anchovies
+ancient
+ancientry
+ancients
+ancus
+and
+andirons
+andpholus
+andren
+andrew
+andromache
+andronici
+andronicus
+anew
+ang
+angel
+angelica
+angelical
+angelo
+angels
+anger
+angerly
+angers
+anges
+angiers
+angl
+anglais
+angle
+angler
+angleterre
+angliae
+angling
+anglish
+angrily
+angry
+anguish
+angus
+animal
+animals
+animis
+anjou
+ankle
+anna
+annals
+anne
+annex
+annexed
+annexions
+annexment
+annothanize
+announces
+annoy
+annoyance
+annoying
+annual
+anoint
+anointed
+anon
+another
+anselmo
+answer
+answerable
+answered
+answerest
+answering
+answers
+ant
+ante
+antenor
+antenorides
+anteroom
+anthem
+anthems
+anthony
+anthropophagi
+anthropophaginian
+antiates
+antic
+anticipate
+anticipates
+anticipatest
+anticipating
+anticipation
+antick
+anticly
+antics
+antidote
+antidotes
+antigonus
+antiopa
+antipathy
+antipholus
+antipholuses
+antipodes
+antiquary
+antique
+antiquity
+antium
+antoniad
+antonio
+antonius
+antony
+antres
+anvil
+any
+anybody
+anyone
+anything
+anywhere
+ap
+apace
+apart
+apartment
+apartments
+ape
+apemantus
+apennines
+apes
+apiece
+apish
+apollinem
+apollo
+apollodorus
+apology
+apoplex
+apoplexy
+apostle
+apostles
+apostrophas
+apoth
+apothecary
+appal
+appall
+appalled
+appals
+apparel
+apparell
+apparelled
+apparent
+apparently
+apparition
+apparitions
+appeach
+appeal
+appeals
+appear
+appearance
+appeared
+appeareth
+appearing
+appears
+appeas
+appease
+appeased
+appelant
+appele
+appelee
+appeles
+appelez
+appellant
+appellants
+appelons
+appendix
+apperil
+appertain
+appertaining
+appertainings
+appertains
+appertinent
+appertinents
+appetite
+appetites
+applaud
+applauded
+applauding
+applause
+applauses
+apple
+apples
+appletart
+appliance
+appliances
+applications
+applied
+applies
+apply
+applying
+appoint
+appointed
+appointment
+appointments
+appoints
+apprehend
+apprehended
+apprehends
+apprehension
+apprehensions
+apprehensive
+apprendre
+apprenne
+apprenticehood
+appris
+approach
+approachers
+approaches
+approacheth
+approaching
+approbation
+approof
+appropriation
+approv
+approve
+approved
+approvers
+approves
+appurtenance
+appurtenances
+apricocks
+april
+apron
+aprons
+apt
+apter
+aptest
+aptly
+aptness
+aqua
+aquilon
+aquitaine
+arabia
+arabian
+araise
+arbitrate
+arbitrating
+arbitrator
+arbitrement
+arbors
+arbour
+arc
+arch
+archbishop
+archbishopric
+archdeacon
+arched
+archelaus
+archer
+archers
+archery
+archibald
+archidamus
+architect
+arcu
+arde
+arden
+ardent
+ardour
+are
+argal
+argier
+argo
+argosies
+argosy
+argu
+argue
+argued
+argues
+arguing
+argument
+arguments
+argus
+ariachne
+ariadne
+ariel
+aries
+aright
+arinado
+arinies
+arion
+arise
+arises
+ariseth
+arising
+aristode
+aristotle
+arithmetic
+arithmetician
+ark
+arm
+arma
+armado
+armadoes
+armagnac
+arme
+armed
+armenia
+armies
+armigero
+arming
+armipotent
+armor
+armour
+armourer
+armourers
+armours
+armoury
+arms
+army
+arn
+aroint
+arose
+arouse
+aroused
+arragon
+arraign
+arraigned
+arraigning
+arraignment
+arrant
+arras
+array
+arrearages
+arrest
+arrested
+arrests
+arriv
+arrival
+arrivance
+arrive
+arrived
+arrives
+arriving
+arrogance
+arrogancy
+arrogant
+arrow
+arrows
+art
+artemidorus
+arteries
+arthur
+article
+articles
+articulate
+artificer
+artificial
+artillery
+artire
+artist
+artists
+artless
+artois
+arts
+artus
+arviragus
+as
+asaph
+ascanius
+ascend
+ascended
+ascendeth
+ascends
+ascension
+ascent
+ascribe
+ascribes
+ash
+asham
+ashamed
+asher
+ashes
+ashford
+ashore
+ashouting
+ashy
+asia
+aside
+ask
+askance
+asked
+asker
+asketh
+asking
+asks
+aslant
+asleep
+asmath
+asp
+aspect
+aspects
+aspen
+aspersion
+aspic
+aspicious
+aspics
+aspir
+aspiration
+aspire
+aspiring
+asquint
+ass
+assail
+assailable
+assailant
+assailants
+assailed
+assaileth
+assailing
+assails
+assassination
+assault
+assaulted
+assaults
+assay
+assaying
+assays
+assemblance
+assemble
+assembled
+assemblies
+assembly
+assent
+asses
+assez
+assign
+assigned
+assigns
+assinico
+assist
+assistance
+assistances
+assistant
+assistants
+assisted
+assisting
+associate
+associated
+associates
+assuage
+assubjugate
+assum
+assume
+assumes
+assumption
+assur
+assurance
+assure
+assured
+assuredly
+assures
+assyrian
+astonish
+astonished
+astraea
+astray
+astrea
+astronomer
+astronomers
+astronomical
+astronomy
+asunder
+at
+atalanta
+ate
+ates
+athenian
+athenians
+athens
+athol
+athversary
+athwart
+atlas
+atomies
+atomy
+atone
+atonement
+atonements
+atropos
+attach
+attached
+attachment
+attain
+attainder
+attains
+attaint
+attainted
+attainture
+attempt
+attemptable
+attempted
+attempting
+attempts
+attend
+attendance
+attendant
+attendants
+attended
+attendents
+attendeth
+attending
+attends
+attent
+attention
+attentive
+attentivenes
+attest
+attested
+attir
+attire
+attired
+attires
+attorney
+attorneyed
+attorneys
+attorneyship
+attract
+attraction
+attractive
+attracts
+attribute
+attributed
+attributes
+attribution
+attributive
+atwain
+au
+aubrey
+auburn
+aucun
+audacious
+audaciously
+audacity
+audible
+audience
+audis
+audit
+auditor
+auditors
+auditory
+audre
+audrey
+aufidius
+aufidiuses
+auger
+aught
+augment
+augmentation
+augmented
+augmenting
+augurer
+augurers
+augures
+auguring
+augurs
+augury
+august
+augustus
+auld
+aumerle
+aunchient
+aunt
+aunts
+auricular
+aurora
+auspicious
+aussi
+austere
+austerely
+austereness
+austerity
+austria
+aut
+authentic
+author
+authorities
+authority
+authorized
+authorizing
+authors
+autolycus
+autre
+autumn
+auvergne
+avail
+avails
+avarice
+avaricious
+avaunt
+ave
+aveng
+avenge
+avenged
+averring
+avert
+aves
+avez
+avis
+avoid
+avoided
+avoiding
+avoids
+avoirdupois
+avouch
+avouched
+avouches
+avouchment
+avow
+aw
+await
+awaits
+awak
+awake
+awaked
+awaken
+awakened
+awakens
+awakes
+awaking
+award
+awards
+awasy
+away
+awe
+aweary
+aweless
+awful
+awhile
+awkward
+awl
+awooing
+awork
+awry
+axe
+axle
+axletree
+ay
+aye
+ayez
+ayli
+azur
+azure
+b
+ba
+baa
+babbl
+babble
+babbling
+babe
+babes
+babies
+baboon
+baboons
+baby
+babylon
+bacare
+bacchanals
+bacchus
+bach
+bachelor
+bachelors
+back
+backbite
+backbitten
+backing
+backs
+backward
+backwardly
+backwards
+bacon
+bacons
+bad
+bade
+badge
+badged
+badges
+badly
+badness
+baes
+baffl
+baffle
+baffled
+bag
+baggage
+bagot
+bagpipe
+bags
+bail
+bailiff
+baillez
+baily
+baisant
+baisees
+baiser
+bait
+baited
+baiting
+baitings
+baits
+bajazet
+bak
+bake
+baked
+baker
+bakers
+bakes
+baking
+bal
+balanc
+balance
+balcony
+bald
+baldrick
+bale
+baleful
+balk
+ball
+ballad
+ballads
+ballast
+ballasting
+ballet
+ballow
+balls
+balm
+balms
+balmy
+balsam
+balsamum
+balth
+balthasar
+balthazar
+bames
+ban
+banbury
+band
+bandied
+banding
+bandit
+banditti
+banditto
+bands
+bandy
+bandying
+bane
+banes
+bang
+bangor
+banish
+banished
+banishers
+banishment
+banister
+bank
+bankrout
+bankrupt
+bankrupts
+banks
+banner
+bannerets
+banners
+banning
+banns
+banquet
+banqueted
+banqueting
+banquets
+banquo
+bans
+baptism
+baptista
+baptiz
+bar
+barbarian
+barbarians
+barbarism
+barbarous
+barbary
+barbason
+barbed
+barber
+barbermonger
+bard
+bardolph
+bards
+bare
+bared
+barefac
+barefaced
+barefoot
+bareheaded
+barely
+bareness
+barful
+bargain
+bargains
+barge
+bargulus
+baring
+bark
+barking
+barkloughly
+barks
+barky
+barley
+barm
+barn
+barnacles
+barnardine
+barne
+barnes
+barnet
+barns
+baron
+barons
+barony
+barr
+barrabas
+barrel
+barrels
+barren
+barrenly
+barrenness
+barricado
+barricadoes
+barrow
+bars
+barson
+barter
+bartholomew
+bas
+basan
+base
+baseless
+basely
+baseness
+baser
+bases
+basest
+bashful
+bashfulness
+basilisco
+basilisk
+basilisks
+basimecu
+basin
+basingstoke
+basins
+basis
+bask
+basket
+baskets
+bass
+bassanio
+basset
+bassianus
+basta
+bastard
+bastardizing
+bastardly
+bastards
+bastardy
+basted
+bastes
+bastinado
+basting
+bat
+batailles
+batch
+bate
+bated
+bates
+bath
+bathe
+bathed
+bathing
+baths
+bating
+batler
+bats
+batt
+battalia
+battalions
+batten
+batter
+battering
+batters
+battery
+battle
+battled
+battlefield
+battlements
+battles
+batty
+bauble
+baubles
+baubling
+baulk
+bavin
+bawcock
+bawd
+bawdry
+bawds
+bawdy
+bawl
+bawling
+bay
+baying
+baynard
+bayonne
+bays
+be
+beach
+beached
+beachy
+beacon
+bead
+beaded
+beadle
+beadles
+beads
+beadsmen
+beagle
+beagles
+beak
+beaks
+beam
+beamed
+beams
+bean
+beans
+bear
+beard
+bearded
+beardless
+beards
+bearer
+bearers
+bearest
+beareth
+bearing
+bears
+beast
+beastliest
+beastliness
+beastly
+beasts
+beat
+beated
+beaten
+beating
+beatrice
+beats
+beau
+beaufort
+beaumond
+beaumont
+beauteous
+beautied
+beauties
+beautified
+beautiful
+beautify
+beauty
+beaver
+beavers
+became
+because
+bechanc
+bechance
+bechanced
+beck
+beckon
+beckons
+becks
+becom
+become
+becomed
+becomes
+becoming
+becomings
+bed
+bedabbled
+bedash
+bedaub
+bedazzled
+bedchamber
+bedclothes
+bedded
+bedeck
+bedecking
+bedew
+bedfellow
+bedfellows
+bedford
+bedlam
+bedrench
+bedrid
+beds
+bedtime
+bedward
+bee
+beef
+beefs
+beehives
+been
+beer
+bees
+beest
+beetle
+beetles
+beeves
+befall
+befallen
+befalls
+befell
+befits
+befitted
+befitting
+befor
+before
+beforehand
+befortune
+befriend
+befriended
+befriends
+beg
+began
+beget
+begets
+begetting
+begg
+beggar
+beggared
+beggarly
+beggarman
+beggars
+beggary
+begging
+begin
+beginners
+beginning
+beginnings
+begins
+begnawn
+begone
+begot
+begotten
+begrimed
+begs
+beguil
+beguile
+beguiled
+beguiles
+beguiling
+begun
+behalf
+behalfs
+behav
+behaved
+behavedst
+behavior
+behaviors
+behaviour
+behaviours
+behead
+beheaded
+beheld
+behest
+behests
+behind
+behold
+beholder
+beholders
+beholdest
+beholding
+beholds
+behoof
+behooffull
+behooves
+behove
+behoves
+behowls
+being
+bel
+belarius
+belch
+belching
+beldam
+beldame
+beldams
+belee
+belgia
+belie
+belied
+belief
+beliest
+believ
+believe
+believed
+believes
+believest
+believing
+belike
+bell
+bellario
+belle
+bellied
+bellies
+bellman
+bellona
+bellow
+bellowed
+bellowing
+bellows
+bells
+belly
+bellyful
+belman
+belmont
+belock
+belong
+belonging
+belongings
+belongs
+belov
+beloved
+beloving
+below
+belt
+belzebub
+bemadding
+bemet
+bemete
+bemoan
+bemoaned
+bemock
+bemoil
+bemonster
+ben
+bench
+bencher
+benches
+bend
+bended
+bending
+bends
+bene
+beneath
+benedicite
+benedick
+benediction
+benedictus
+benefactors
+benefice
+beneficial
+benefit
+benefited
+benefits
+benetted
+benevolence
+benevolences
+benied
+benison
+bennet
+bent
+bentii
+bentivolii
+bents
+benumbed
+benvolio
+bepaint
+bepray
+bequeath
+bequeathed
+bequeathing
+bequest
+ber
+berard
+berattle
+beray
+bere
+bereave
+bereaved
+bereaves
+bereft
+bergamo
+bergomask
+berhym
+berhyme
+berkeley
+bermoothes
+bernardo
+berod
+berowne
+berri
+berries
+berrord
+berry
+bertram
+berwick
+bescreen
+beseech
+beseeched
+beseechers
+beseeching
+beseek
+beseem
+beseemeth
+beseeming
+beseems
+beset
+beshrew
+beside
+besides
+besieg
+besiege
+besieged
+beslubber
+besmear
+besmeared
+besmirch
+besom
+besort
+besotted
+bespake
+bespeak
+bespice
+bespoke
+bespotted
+bess
+bessy
+best
+bestained
+bested
+bestial
+bestir
+bestirr
+bestow
+bestowed
+bestowing
+bestows
+bestraught
+bestrew
+bestrid
+bestride
+bestrides
+bet
+betake
+beteem
+bethink
+bethought
+bethrothed
+bethump
+betid
+betide
+betideth
+betime
+betimes
+betoken
+betook
+betossed
+betray
+betrayed
+betraying
+betrays
+betrims
+betroth
+betrothed
+betroths
+bett
+betted
+better
+bettered
+bettering
+betters
+betting
+bettre
+between
+betwixt
+bevel
+beverage
+bevis
+bevy
+bewail
+bewailed
+bewailing
+bewails
+beware
+bewasted
+beweep
+bewept
+bewet
+bewhored
+bewitch
+bewitched
+bewitchment
+bewray
+beyond
+bezonian
+bezonians
+bianca
+bianco
+bias
+bibble
+bickerings
+bid
+bidden
+bidding
+biddings
+biddy
+bide
+bides
+biding
+bids
+bien
+bier
+bifold
+big
+bigamy
+biggen
+bigger
+bigness
+bigot
+bilberry
+bilbo
+bilboes
+bilbow
+bill
+billeted
+billets
+billiards
+billing
+billow
+billows
+bills
+bin
+bind
+bindeth
+binding
+binds
+biondello
+birch
+bird
+birding
+birdlime
+birds
+birnam
+birth
+birthday
+birthdom
+birthplace
+birthright
+birthrights
+births
+bis
+biscuit
+bishop
+bishops
+bisson
+bit
+bitch
+bite
+biter
+bites
+biting
+bits
+bitt
+bitten
+bitter
+bitterest
+bitterly
+bitterness
+blab
+blabb
+blabbing
+blabs
+black
+blackamoor
+blackamoors
+blackberries
+blackberry
+blacker
+blackest
+blackfriars
+blackheath
+blackmere
+blackness
+blacks
+bladder
+bladders
+blade
+bladed
+blades
+blains
+blam
+blame
+blamed
+blameful
+blameless
+blames
+blanc
+blanca
+blanch
+blank
+blanket
+blanks
+blaspheme
+blaspheming
+blasphemous
+blasphemy
+blast
+blasted
+blasting
+blastments
+blasts
+blaz
+blaze
+blazes
+blazing
+blazon
+blazoned
+blazoning
+bleach
+bleaching
+bleak
+blear
+bleared
+bleat
+bleated
+bleats
+bled
+bleed
+bleedest
+bleedeth
+bleeding
+bleeds
+blemish
+blemishes
+blench
+blenches
+blend
+blended
+blent
+bless
+blessed
+blessedly
+blessedness
+blesses
+blesseth
+blessing
+blessings
+blest
+blew
+blind
+blinded
+blindfold
+blinding
+blindly
+blindness
+blinds
+blink
+blinking
+bliss
+blist
+blister
+blisters
+blithe
+blithild
+bloat
+block
+blockish
+blocks
+blois
+blood
+blooded
+bloodhound
+bloodied
+bloodier
+bloodiest
+bloodily
+bloodless
+bloods
+bloodshed
+bloodshedding
+bloodstained
+bloody
+bloom
+blooms
+blossom
+blossoming
+blossoms
+blot
+blots
+blotted
+blotting
+blount
+blow
+blowed
+blowers
+blowest
+blowing
+blown
+blows
+blowse
+blubb
+blubber
+blubbering
+blue
+bluecaps
+bluest
+blunt
+blunted
+blunter
+bluntest
+blunting
+bluntly
+bluntness
+blunts
+blur
+blurr
+blurs
+blush
+blushes
+blushest
+blushing
+blust
+bluster
+blusterer
+blusters
+bo
+boar
+board
+boarded
+boarding
+boards
+boarish
+boars
+boast
+boasted
+boastful
+boasting
+boasts
+boat
+boats
+boatswain
+bob
+bobb
+boblibindo
+bobtail
+bocchus
+bode
+boded
+bodements
+bodes
+bodg
+bodied
+bodies
+bodiless
+bodily
+boding
+bodkin
+body
+bodykins
+bog
+boggle
+boggler
+bogs
+bohemia
+bohemian
+bohun
+boil
+boiling
+boils
+boist
+boisterous
+boisterously
+boitier
+bold
+bolden
+bolder
+boldest
+boldly
+boldness
+bolds
+bolingbroke
+bolster
+bolt
+bolted
+bolter
+bolters
+bolting
+bolts
+bombard
+bombards
+bombast
+bon
+bona
+bond
+bondage
+bonded
+bondmaid
+bondman
+bondmen
+bonds
+bondslave
+bone
+boneless
+bones
+bonfire
+bonfires
+bonjour
+bonne
+bonnet
+bonneted
+bonny
+bonos
+bonto
+bonville
+bood
+book
+bookish
+books
+boon
+boor
+boorish
+boors
+boot
+booted
+booties
+bootless
+boots
+booty
+bor
+bora
+borachio
+bordeaux
+border
+bordered
+borderers
+borders
+bore
+boreas
+bores
+boring
+born
+borne
+borough
+boroughs
+borrow
+borrowed
+borrower
+borrowing
+borrows
+bosko
+boskos
+bosky
+bosom
+bosoms
+boson
+boss
+bosworth
+botch
+botcher
+botches
+botchy
+both
+bots
+bottle
+bottled
+bottles
+bottom
+bottomless
+bottoms
+bouciqualt
+bouge
+bough
+boughs
+bought
+bounce
+bouncing
+bound
+bounded
+bounden
+boundeth
+bounding
+boundless
+bounds
+bounteous
+bounteously
+bounties
+bountiful
+bountifully
+bounty
+bourbier
+bourbon
+bourchier
+bourdeaux
+bourn
+bout
+bouts
+bove
+bow
+bowcase
+bowed
+bowels
+bower
+bowing
+bowl
+bowler
+bowling
+bowls
+bows
+bowsprit
+bowstring
+box
+boxes
+boy
+boyet
+boyish
+boys
+brabant
+brabantio
+brabble
+brabbler
+brac
+brace
+bracelet
+bracelets
+brach
+bracy
+brag
+bragg
+braggardism
+braggards
+braggart
+braggarts
+bragged
+bragging
+bragless
+brags
+braid
+braided
+brain
+brained
+brainford
+brainish
+brainless
+brains
+brainsick
+brainsickly
+brake
+brakenbury
+brakes
+brambles
+bran
+branch
+branches
+branchless
+brand
+branded
+brandish
+brandon
+brands
+bras
+brass
+brassy
+brat
+brats
+brav
+brave
+braved
+bravely
+braver
+bravery
+braves
+bravest
+braving
+brawl
+brawler
+brawling
+brawls
+brawn
+brawns
+bray
+braying
+braz
+brazen
+brazier
+breach
+breaches
+bread
+breadth
+break
+breaker
+breakfast
+breaking
+breaks
+breast
+breasted
+breasting
+breastplate
+breasts
+breath
+breathe
+breathed
+breather
+breathers
+breathes
+breathest
+breathing
+breathless
+breaths
+brecknock
+bred
+breech
+breeches
+breeching
+breed
+breeder
+breeders
+breeding
+breeds
+breese
+breeze
+breff
+bretagne
+brethen
+bretheren
+brethren
+brevis
+brevity
+brew
+brewage
+brewer
+brewers
+brewing
+brews
+briareus
+briars
+brib
+bribe
+briber
+bribes
+brick
+bricklayer
+bricks
+bridal
+bride
+bridegroom
+bridegrooms
+brides
+bridge
+bridgenorth
+bridges
+bridget
+bridle
+bridled
+brief
+briefer
+briefest
+briefly
+briefness
+brier
+briers
+brigandine
+bright
+brighten
+brightest
+brightly
+brightness
+brim
+brimful
+brims
+brimstone
+brinded
+brine
+bring
+bringer
+bringeth
+bringing
+bringings
+brings
+brinish
+brink
+brisk
+brisky
+bristle
+bristled
+bristly
+bristol
+bristow
+britain
+britaine
+britaines
+british
+briton
+britons
+brittany
+brittle
+broach
+broached
+broad
+broader
+broadsides
+brocas
+brock
+brogues
+broil
+broiling
+broils
+broke
+broken
+brokenly
+broker
+brokers
+brokes
+broking
+brooch
+brooches
+brood
+brooded
+brooding
+brook
+brooks
+broom
+broomstaff
+broth
+brothel
+brother
+brotherhood
+brotherhoods
+brotherly
+brothers
+broths
+brought
+brow
+brown
+browner
+brownist
+browny
+brows
+browse
+browsing
+bruis
+bruise
+bruised
+bruises
+bruising
+bruit
+bruited
+brundusium
+brunt
+brush
+brushes
+brute
+brutish
+brutus
+bubble
+bubbles
+bubbling
+bubukles
+buck
+bucket
+buckets
+bucking
+buckingham
+buckle
+buckled
+buckler
+bucklers
+bucklersbury
+buckles
+buckram
+bucks
+bud
+budded
+budding
+budge
+budger
+budget
+buds
+buff
+buffet
+buffeting
+buffets
+bug
+bugbear
+bugle
+bugs
+build
+builded
+buildeth
+building
+buildings
+builds
+built
+bulk
+bulks
+bull
+bullcalf
+bullen
+bullens
+bullet
+bullets
+bullocks
+bulls
+bully
+bulmer
+bulwark
+bulwarks
+bum
+bumbast
+bump
+bumper
+bums
+bunch
+bunches
+bundle
+bung
+bunghole
+bungle
+bunting
+buoy
+bur
+burbolt
+burd
+burden
+burdened
+burdening
+burdenous
+burdens
+burgh
+burgher
+burghers
+burglary
+burgomasters
+burgonet
+burgundy
+burial
+buried
+burier
+buriest
+burly
+burn
+burned
+burnet
+burneth
+burning
+burnish
+burns
+burnt
+burr
+burrows
+burs
+burst
+bursting
+bursts
+burthen
+burthens
+burton
+bury
+burying
+bush
+bushels
+bushes
+bushy
+busied
+busily
+busines
+business
+businesses
+buskin
+busky
+buss
+busses
+bussing
+bustle
+bustling
+busy
+but
+butcheed
+butcher
+butchered
+butcheries
+butcherly
+butchers
+butchery
+butler
+butt
+butter
+buttered
+butterflies
+butterfly
+butterwoman
+buttery
+buttock
+buttocks
+button
+buttonhole
+buttons
+buttress
+buttry
+butts
+buxom
+buy
+buyer
+buying
+buys
+buzz
+buzzard
+buzzards
+buzzers
+buzzing
+by
+bye
+byzantium
+c
+ca
+cabbage
+cabileros
+cabin
+cabins
+cable
+cables
+cackling
+cacodemon
+caddis
+caddisses
+cade
+cadence
+cadent
+cades
+cadmus
+caduceus
+cadwal
+cadwallader
+caelius
+caelo
+caesar
+caesarion
+caesars
+cage
+caged
+cagion
+cain
+caithness
+caitiff
+caitiffs
+caius
+cak
+cake
+cakes
+calaber
+calais
+calamities
+calamity
+calchas
+calculate
+calen
+calendar
+calendars
+calf
+caliban
+calibans
+calipolis
+cality
+caliver
+call
+callat
+called
+callet
+calling
+calls
+calm
+calmest
+calmly
+calmness
+calms
+calpurnia
+calumniate
+calumniating
+calumnious
+calumny
+calve
+calved
+calves
+calveskins
+calydon
+cam
+cambio
+cambria
+cambric
+cambrics
+cambridge
+cambyses
+came
+camel
+camelot
+camels
+camest
+camillo
+camlet
+camomile
+camp
+campeius
+camping
+camps
+can
+canakin
+canaries
+canary
+cancel
+cancell
+cancelled
+cancelling
+cancels
+cancer
+candidatus
+candied
+candle
+candles
+candlesticks
+candy
+canidius
+cank
+canker
+cankerblossom
+cankers
+cannibally
+cannibals
+cannon
+cannoneer
+cannons
+cannot
+canon
+canoniz
+canonize
+canonized
+canons
+canopied
+canopies
+canopy
+canst
+canstick
+canterbury
+cantle
+cantons
+canus
+canvas
+canvass
+canzonet
+cap
+capability
+capable
+capacities
+capacity
+caparison
+capdv
+cape
+capel
+capels
+caper
+capers
+capet
+caphis
+capilet
+capitaine
+capital
+capite
+capitol
+capitulate
+capocchia
+capon
+capons
+capp
+cappadocia
+capriccio
+capricious
+caps
+capt
+captain
+captains
+captainship
+captious
+captivate
+captivated
+captivates
+captive
+captives
+captivity
+captum
+capucius
+capulet
+capulets
+car
+carack
+caracks
+carat
+caraways
+carbonado
+carbuncle
+carbuncled
+carbuncles
+carcanet
+carcase
+carcases
+carcass
+carcasses
+card
+cardecue
+carded
+carders
+cardinal
+cardinally
+cardinals
+cardmaker
+cards
+carduus
+care
+cared
+career
+careers
+careful
+carefully
+careless
+carelessly
+carelessness
+cares
+caret
+cargo
+carl
+carlisle
+carlot
+carman
+carmen
+carnal
+carnally
+carnarvonshire
+carnation
+carnations
+carol
+carous
+carouse
+caroused
+carouses
+carousing
+carp
+carpenter
+carper
+carpet
+carpets
+carping
+carriage
+carriages
+carried
+carrier
+carriers
+carries
+carrion
+carrions
+carry
+carrying
+cars
+cart
+carters
+carthage
+carts
+carv
+carve
+carved
+carver
+carves
+carving
+cas
+casa
+casaer
+casca
+case
+casement
+casements
+cases
+cash
+cashier
+casing
+cask
+casket
+casketed
+caskets
+casque
+casques
+cassado
+cassandra
+cassibelan
+cassio
+cassius
+cassocks
+cast
+castalion
+castaway
+castaways
+casted
+caster
+castigate
+castigation
+castile
+castiliano
+casting
+castle
+castles
+casts
+casual
+casually
+casualties
+casualty
+cat
+cataian
+catalogue
+cataplasm
+cataracts
+catarrhs
+catastrophe
+catch
+catcher
+catches
+catching
+cate
+catechising
+catechism
+catechize
+cater
+caterpillars
+caters
+caterwauling
+cates
+catesby
+cathedral
+catlike
+catling
+catlings
+cato
+cats
+cattle
+caucasus
+caudle
+cauf
+caught
+cauldron
+caus
+cause
+caused
+causeless
+causer
+causes
+causest
+causeth
+cautel
+cautelous
+cautels
+cauterizing
+caution
+cautions
+cavaleiro
+cavalery
+cavaliers
+cave
+cavern
+caverns
+caves
+caveto
+caviary
+cavil
+cavilling
+cawdor
+cawdron
+cawing
+ce
+ceas
+cease
+ceases
+ceaseth
+cedar
+cedars
+cedius
+celebrate
+celebrated
+celebrates
+celebration
+celerity
+celestial
+celia
+cell
+cellar
+cellarage
+celsa
+cement
+censer
+censor
+censorinus
+censur
+censure
+censured
+censurers
+censures
+censuring
+centaur
+centaurs
+centre
+cents
+centuries
+centurion
+centurions
+century
+cerberus
+cerecloth
+cerements
+ceremonial
+ceremonies
+ceremonious
+ceremoniously
+ceremony
+ceres
+cerns
+certain
+certainer
+certainly
+certainties
+certainty
+certes
+certificate
+certified
+certifies
+certify
+ces
+cesario
+cess
+cesse
+cestern
+cetera
+cette
+chaces
+chaf
+chafe
+chafed
+chafes
+chaff
+chaffless
+chafing
+chain
+chains
+chair
+chairs
+chalic
+chalice
+chalices
+chalk
+chalks
+chalky
+challeng
+challenge
+challenged
+challenger
+challengers
+challenges
+cham
+chamber
+chamberers
+chamberlain
+chamberlains
+chambermaid
+chambermaids
+chambers
+chameleon
+champ
+champagne
+champain
+champains
+champion
+champions
+chanc
+chance
+chanced
+chancellor
+chances
+chandler
+chang
+change
+changeable
+changed
+changeful
+changeling
+changelings
+changer
+changes
+changest
+changing
+channel
+channels
+chanson
+chant
+chanticleer
+chanting
+chantries
+chantry
+chants
+chaos
+chap
+chape
+chapel
+chapeless
+chapels
+chaplain
+chaplains
+chapless
+chaplet
+chapmen
+chaps
+chapter
+character
+charactered
+characterless
+characters
+charactery
+characts
+charbon
+chare
+chares
+charg
+charge
+charged
+chargeful
+charges
+chargeth
+charging
+chariest
+chariness
+charing
+chariot
+chariots
+charitable
+charitably
+charities
+charity
+charlemain
+charles
+charm
+charmed
+charmer
+charmeth
+charmian
+charming
+charmingly
+charms
+charneco
+charnel
+charolois
+charon
+charter
+charters
+chartreux
+chary
+charybdis
+chas
+chase
+chased
+chaser
+chaseth
+chasing
+chaste
+chastely
+chastis
+chastise
+chastised
+chastisement
+chastity
+chat
+chatham
+chatillon
+chats
+chatt
+chattels
+chatter
+chattering
+chattles
+chaud
+chaunted
+chaw
+chawdron
+che
+cheap
+cheapen
+cheaper
+cheapest
+cheaply
+cheapside
+cheat
+cheated
+cheater
+cheaters
+cheating
+cheats
+check
+checked
+checker
+checking
+checks
+cheek
+cheeks
+cheer
+cheered
+cheerer
+cheerful
+cheerfully
+cheering
+cheerless
+cheerly
+cheers
+cheese
+chequer
+cher
+cherish
+cherished
+cherisher
+cherishes
+cherishing
+cherries
+cherry
+cherrypit
+chertsey
+cherub
+cherubims
+cherubin
+cherubins
+cheshu
+chess
+chest
+chester
+chestnut
+chestnuts
+chests
+chetas
+chev
+cheval
+chevalier
+chevaliers
+cheveril
+chew
+chewed
+chewet
+chewing
+chez
+chi
+chick
+chicken
+chickens
+chicurmurco
+chid
+chidden
+chide
+chiders
+chides
+chiding
+chief
+chiefest
+chiefly
+chien
+child
+childed
+childeric
+childhood
+childhoods
+childing
+childish
+childishness
+childlike
+childness
+children
+chill
+chilling
+chime
+chimes
+chimney
+chimneypiece
+chimneys
+chimurcho
+chin
+china
+chine
+chines
+chink
+chinks
+chins
+chipp
+chipper
+chips
+chiron
+chirping
+chirrah
+chirurgeonly
+chisel
+chitopher
+chivalrous
+chivalry
+choice
+choicely
+choicest
+choir
+choirs
+chok
+choke
+choked
+chokes
+choking
+choler
+choleric
+cholers
+chollors
+choose
+chooser
+chooses
+chooseth
+choosing
+chop
+chopine
+choplogic
+chopp
+chopped
+chopping
+choppy
+chops
+chopt
+chor
+choristers
+chorus
+chose
+chosen
+chough
+choughs
+chrish
+christ
+christen
+christendom
+christendoms
+christening
+christenings
+christian
+christianlike
+christians
+christmas
+christom
+christopher
+christophero
+chronicle
+chronicled
+chronicler
+chroniclers
+chronicles
+chrysolite
+chuck
+chucks
+chud
+chuffs
+church
+churches
+churchman
+churchmen
+churchyard
+churchyards
+churl
+churlish
+churlishly
+churls
+churn
+chus
+cicatrice
+cicatrices
+cicely
+cicero
+ciceter
+ciel
+ciitzens
+cilicia
+cimber
+cimmerian
+cinable
+cincture
+cinders
+cine
+cinna
+cinque
+cipher
+ciphers
+circa
+circe
+circle
+circled
+circlets
+circling
+circuit
+circum
+circumcised
+circumference
+circummur
+circumscrib
+circumscribed
+circumscription
+circumspect
+circumstance
+circumstanced
+circumstances
+circumstantial
+circumvent
+circumvention
+cistern
+citadel
+cital
+cite
+cited
+cites
+cities
+citing
+citizen
+citizens
+cittern
+city
+civet
+civil
+civility
+civilly
+clack
+clad
+claim
+claiming
+claims
+clamb
+clamber
+clammer
+clamor
+clamorous
+clamors
+clamour
+clamours
+clang
+clangor
+clap
+clapp
+clapped
+clapper
+clapping
+claps
+clare
+clarence
+claret
+claribel
+clasp
+clasps
+clatter
+claud
+claudio
+claudius
+clause
+claw
+clawed
+clawing
+claws
+clay
+clays
+clean
+cleanliest
+cleanly
+cleans
+cleanse
+cleansing
+clear
+clearer
+clearest
+clearly
+clearness
+clears
+cleave
+cleaving
+clef
+cleft
+cleitus
+clemency
+clement
+cleomenes
+cleopatpa
+cleopatra
+clepeth
+clept
+clerestories
+clergy
+clergyman
+clergymen
+clerk
+clerkly
+clerks
+clew
+client
+clients
+cliff
+clifford
+cliffords
+cliffs
+clifton
+climate
+climature
+climb
+climbed
+climber
+climbeth
+climbing
+climbs
+clime
+cling
+clink
+clinking
+clinquant
+clip
+clipp
+clipper
+clippeth
+clipping
+clipt
+clitus
+clo
+cloak
+cloakbag
+cloaks
+clock
+clocks
+clod
+cloddy
+clodpole
+clog
+clogging
+clogs
+cloister
+cloistress
+cloquence
+clos
+close
+closed
+closely
+closeness
+closer
+closes
+closest
+closet
+closing
+closure
+cloten
+clotens
+cloth
+clothair
+clotharius
+clothe
+clothes
+clothier
+clothiers
+clothing
+cloths
+clotpoles
+clotpoll
+cloud
+clouded
+cloudiness
+clouds
+cloudy
+clout
+clouted
+clouts
+cloven
+clover
+cloves
+clovest
+clowder
+clown
+clownish
+clowns
+cloy
+cloyed
+cloying
+cloyless
+cloyment
+cloys
+club
+clubs
+cluck
+clung
+clust
+clusters
+clutch
+clyster
+cneius
+cnemies
+co
+coach
+coaches
+coachmakers
+coact
+coactive
+coagulate
+coal
+coals
+coarse
+coarsely
+coast
+coasting
+coasts
+coat
+coated
+coats
+cobble
+cobbled
+cobbler
+cobham
+cobloaf
+cobweb
+cobwebs
+cock
+cockatrice
+cockatrices
+cockle
+cockled
+cockney
+cockpit
+cocks
+cocksure
+coctus
+cocytus
+cod
+codding
+codling
+codpiece
+codpieces
+cods
+coelestibus
+coesar
+coeur
+coffer
+coffers
+coffin
+coffins
+cog
+cogging
+cogitation
+cogitations
+cognition
+cognizance
+cogscomb
+cohabitants
+coher
+cohere
+coherence
+coherent
+cohorts
+coif
+coign
+coil
+coin
+coinage
+coiner
+coining
+coins
+col
+colbrand
+colchos
+cold
+colder
+coldest
+coldly
+coldness
+coldspur
+colebrook
+colic
+collar
+collars
+collateral
+colleagued
+collect
+collected
+collection
+college
+colleges
+collied
+collier
+colliers
+collop
+collusion
+colme
+colmekill
+coloquintida
+color
+colors
+colossus
+colour
+colourable
+coloured
+colouring
+colours
+colt
+colted
+colts
+columbine
+columbines
+colville
+com
+comagene
+comart
+comb
+combat
+combatant
+combatants
+combated
+combating
+combin
+combinate
+combination
+combine
+combined
+combless
+combustion
+come
+comedian
+comedians
+comedy
+comeliness
+comely
+comer
+comers
+comes
+comest
+comet
+cometh
+comets
+comfect
+comfit
+comfits
+comfort
+comfortable
+comforted
+comforter
+comforting
+comfortless
+comforts
+comic
+comical
+coming
+comings
+cominius
+comma
+command
+commande
+commanded
+commander
+commanders
+commanding
+commandment
+commandments
+commands
+comme
+commenc
+commence
+commenced
+commencement
+commences
+commencing
+commend
+commendable
+commendation
+commendations
+commended
+commending
+commends
+comment
+commentaries
+commenting
+comments
+commerce
+commingled
+commiseration
+commission
+commissioners
+commissions
+commit
+commits
+committ
+committed
+committing
+commix
+commixed
+commixtion
+commixture
+commodious
+commodities
+commodity
+common
+commonalty
+commoner
+commoners
+commonly
+commons
+commonweal
+commonwealth
+commotion
+commotions
+commune
+communicat
+communicate
+communication
+communities
+community
+comonty
+compact
+companies
+companion
+companions
+companionship
+company
+compar
+comparative
+compare
+compared
+comparing
+comparison
+comparisons
+compartner
+compass
+compasses
+compassing
+compassion
+compassionate
+compeers
+compel
+compell
+compelled
+compelling
+compels
+compensation
+competence
+competency
+competent
+competitor
+competitors
+compil
+compile
+compiled
+complain
+complainer
+complainest
+complaining
+complainings
+complains
+complaint
+complaints
+complement
+complements
+complete
+complexion
+complexioned
+complexions
+complices
+complies
+compliment
+complimental
+compliments
+complot
+complots
+complotted
+comply
+compos
+compose
+composed
+composition
+compost
+composture
+composure
+compound
+compounded
+compounds
+comprehend
+comprehended
+comprehends
+compremises
+compris
+comprising
+compromis
+compromise
+compt
+comptible
+comptrollers
+compulsatory
+compulsion
+compulsive
+compunctious
+computation
+comrade
+comrades
+comutual
+con
+concave
+concavities
+conceal
+concealed
+concealing
+concealment
+concealments
+conceals
+conceit
+conceited
+conceitless
+conceits
+conceiv
+conceive
+conceived
+conceives
+conceiving
+conception
+conceptions
+conceptious
+concern
+concernancy
+concerneth
+concerning
+concernings
+concerns
+conclave
+conclud
+conclude
+concluded
+concludes
+concluding
+conclusion
+conclusions
+concolinel
+concord
+concubine
+concupiscible
+concupy
+concur
+concurring
+concurs
+condemn
+condemnation
+condemned
+condemning
+condemns
+condescend
+condign
+condition
+conditionally
+conditions
+condole
+condolement
+condoling
+conduce
+conduct
+conducted
+conducting
+conductor
+conduit
+conduits
+conected
+coney
+confection
+confectionary
+confections
+confederacy
+confederate
+confederates
+confer
+conference
+conferr
+conferring
+confess
+confessed
+confesses
+confesseth
+confessing
+confession
+confessions
+confessor
+confidence
+confident
+confidently
+confin
+confine
+confined
+confineless
+confiners
+confines
+confining
+confirm
+confirmation
+confirmations
+confirmed
+confirmer
+confirmers
+confirming
+confirmities
+confirms
+confiscate
+confiscated
+confiscation
+confixed
+conflict
+conflicting
+conflicts
+confluence
+conflux
+conform
+conformable
+confound
+confounded
+confounding
+confounds
+confront
+confronted
+confus
+confused
+confusedly
+confusion
+confusions
+confutation
+confutes
+congeal
+congealed
+congealment
+congee
+conger
+congest
+congied
+congratulate
+congreeing
+congreeted
+congregate
+congregated
+congregation
+congregations
+congruent
+congruing
+conies
+conjectural
+conjecture
+conjectures
+conjoin
+conjoined
+conjoins
+conjointly
+conjunct
+conjunction
+conjunctive
+conjur
+conjuration
+conjurations
+conjure
+conjured
+conjurer
+conjurers
+conjures
+conjuring
+conjuro
+conn
+connected
+connive
+conqu
+conquer
+conquered
+conquering
+conqueror
+conquerors
+conquers
+conquest
+conquests
+conquring
+conrade
+cons
+consanguineous
+consanguinity
+conscienc
+conscience
+consciences
+conscionable
+consecrate
+consecrated
+consecrations
+consent
+consented
+consenting
+consents
+consequence
+consequences
+consequently
+conserve
+conserved
+conserves
+consider
+considerance
+considerate
+consideration
+considerations
+considered
+considering
+considerings
+considers
+consign
+consigning
+consist
+consisteth
+consisting
+consistory
+consists
+consolate
+consolation
+consonancy
+consonant
+consort
+consorted
+consortest
+conspectuities
+conspir
+conspiracy
+conspirant
+conspirator
+conspirators
+conspire
+conspired
+conspirers
+conspires
+conspiring
+constable
+constables
+constance
+constancies
+constancy
+constant
+constantine
+constantinople
+constantly
+constellation
+constitution
+constrain
+constrained
+constraineth
+constrains
+constraint
+constring
+construction
+construe
+consul
+consuls
+consulship
+consulships
+consult
+consulting
+consults
+consum
+consume
+consumed
+consumes
+consuming
+consummate
+consummation
+consumption
+consumptions
+contagion
+contagious
+contain
+containing
+contains
+contaminate
+contaminated
+contemn
+contemned
+contemning
+contemns
+contemplate
+contemplation
+contemplative
+contempt
+contemptible
+contempts
+contemptuous
+contemptuously
+contend
+contended
+contending
+contendon
+content
+contenta
+contented
+contenteth
+contention
+contentious
+contentless
+contento
+contents
+contest
+contestation
+continence
+continency
+continent
+continents
+continu
+continual
+continually
+continuance
+continuantly
+continuate
+continue
+continued
+continuer
+continues
+continuing
+contract
+contracted
+contracting
+contraction
+contradict
+contradicted
+contradiction
+contradicts
+contraries
+contrarieties
+contrariety
+contrarious
+contrariously
+contrary
+contre
+contribution
+contributors
+contrite
+contriv
+contrive
+contrived
+contriver
+contrives
+contriving
+control
+controll
+controller
+controlling
+controlment
+controls
+controversy
+contumelious
+contumeliously
+contumely
+contusions
+convenience
+conveniences
+conveniency
+convenient
+conveniently
+convented
+conventicles
+convents
+convers
+conversant
+conversation
+conversations
+converse
+conversed
+converses
+conversing
+conversion
+convert
+converted
+convertest
+converting
+convertite
+convertites
+converts
+convey
+conveyance
+conveyances
+conveyers
+conveying
+convict
+convicted
+convince
+convinced
+convinces
+convive
+convocation
+convoy
+convulsions
+cony
+cook
+cookery
+cooks
+cool
+cooled
+cooling
+cools
+coop
+coops
+cop
+copatain
+cope
+cophetua
+copied
+copies
+copious
+copper
+copperspur
+coppice
+copulation
+copulatives
+copy
+cor
+coragio
+coral
+coram
+corambus
+coranto
+corantos
+corbo
+cord
+corded
+cordelia
+cordial
+cordis
+cords
+core
+corin
+corinth
+corinthian
+coriolanus
+corioli
+cork
+corky
+cormorant
+corn
+cornelia
+cornelius
+corner
+corners
+cornerstone
+cornets
+cornish
+corns
+cornuto
+cornwall
+corollary
+coronal
+coronation
+coronet
+coronets
+corporal
+corporals
+corporate
+corpse
+corpulent
+correct
+corrected
+correcting
+correction
+correctioner
+corrects
+correspondence
+correspondent
+corresponding
+corresponsive
+corrigible
+corrival
+corrivals
+corroborate
+corrosive
+corrupt
+corrupted
+corrupter
+corrupters
+corruptible
+corruptibly
+corrupting
+corruption
+corruptly
+corrupts
+corse
+corses
+corslet
+cosmo
+cost
+costard
+costermongers
+costlier
+costly
+costs
+cot
+cote
+coted
+cotsall
+cotsole
+cotswold
+cottage
+cottages
+cotus
+couch
+couched
+couching
+couchings
+coude
+cough
+coughing
+could
+couldst
+coulter
+council
+councillor
+councils
+counsel
+counsell
+counsellor
+counsellors
+counselor
+counselors
+counsels
+count
+counted
+countenanc
+countenance
+countenances
+counter
+counterchange
+countercheck
+counterfeit
+counterfeited
+counterfeiting
+counterfeitly
+counterfeits
+countermand
+countermands
+countermines
+counterpart
+counterpoints
+counterpois
+counterpoise
+counters
+countervail
+countess
+countesses
+counties
+counting
+countless
+countries
+countrv
+country
+countryman
+countrymen
+counts
+county
+couper
+couple
+coupled
+couplement
+couples
+couplet
+couplets
+cour
+courage
+courageous
+courageously
+courages
+courier
+couriers
+couronne
+cours
+course
+coursed
+courser
+coursers
+courses
+coursing
+court
+courted
+courteous
+courteously
+courtesan
+courtesies
+courtesy
+courtezan
+courtezans
+courtier
+courtiers
+courtlike
+courtly
+courtney
+courts
+courtship
+cousin
+cousins
+couterfeit
+coutume
+covenant
+covenants
+covent
+coventry
+cover
+covered
+covering
+coverlet
+covers
+covert
+covertly
+coverture
+covet
+coveted
+coveting
+covetings
+covetous
+covetously
+covetousness
+covets
+cow
+coward
+cowarded
+cowardice
+cowardly
+cowards
+cowardship
+cowish
+cowl
+cowslip
+cowslips
+cox
+coxcomb
+coxcombs
+coy
+coystrill
+coz
+cozen
+cozenage
+cozened
+cozener
+cozeners
+cozening
+coziers
+crab
+crabbed
+crabs
+crack
+cracked
+cracker
+crackers
+cracking
+cracks
+cradle
+cradled
+cradles
+craft
+crafted
+craftied
+craftier
+craftily
+crafts
+craftsmen
+crafty
+cram
+cramm
+cramp
+cramps
+crams
+cranking
+cranks
+cranmer
+crannied
+crannies
+cranny
+crants
+crare
+crash
+crassus
+crav
+crave
+craved
+craven
+cravens
+craves
+craveth
+craving
+crawl
+crawling
+crawls
+craz
+crazed
+crazy
+creaking
+cream
+create
+created
+creates
+creating
+creation
+creator
+creature
+creatures
+credence
+credent
+credible
+credit
+creditor
+creditors
+credo
+credulity
+credulous
+creed
+creek
+creeks
+creep
+creeping
+creeps
+crept
+crescent
+crescive
+cressets
+cressid
+cressida
+cressids
+cressy
+crest
+crested
+crestfall
+crestless
+crests
+cretan
+crete
+crevice
+crew
+crews
+crib
+cribb
+cribs
+cricket
+crickets
+cried
+criedst
+crier
+cries
+criest
+crieth
+crime
+crimeful
+crimeless
+crimes
+criminal
+crimson
+cringe
+cripple
+crisp
+crisped
+crispian
+crispianus
+crispin
+critic
+critical
+critics
+croak
+croaking
+croaks
+crocodile
+cromer
+cromwell
+crone
+crook
+crookback
+crooked
+crooking
+crop
+cropp
+crosby
+cross
+crossed
+crosses
+crossest
+crossing
+crossings
+crossly
+crossness
+crost
+crotchets
+crouch
+crouching
+crow
+crowd
+crowded
+crowding
+crowds
+crowflowers
+crowing
+crowkeeper
+crown
+crowned
+crowner
+crownet
+crownets
+crowning
+crowns
+crows
+crudy
+cruel
+cruell
+crueller
+cruelly
+cruels
+cruelty
+crum
+crumble
+crumbs
+crupper
+crusadoes
+crush
+crushed
+crushest
+crushing
+crust
+crusts
+crusty
+crutch
+crutches
+cry
+crying
+crystal
+crystalline
+crystals
+cub
+cubbert
+cubiculo
+cubit
+cubs
+cuckold
+cuckoldly
+cuckolds
+cuckoo
+cucullus
+cudgel
+cudgeled
+cudgell
+cudgelling
+cudgels
+cue
+cues
+cuff
+cuffs
+cuique
+cull
+culling
+cullion
+cullionly
+cullions
+culpable
+culverin
+cum
+cumber
+cumberland
+cunning
+cunningly
+cunnings
+cuore
+cup
+cupbearer
+cupboarding
+cupid
+cupids
+cuppele
+cups
+cur
+curan
+curate
+curb
+curbed
+curbing
+curbs
+curd
+curdied
+curds
+cure
+cured
+cureless
+curer
+cures
+curfew
+curing
+curio
+curiosity
+curious
+curiously
+curl
+curled
+curling
+curls
+currance
+currants
+current
+currents
+currish
+curry
+curs
+curse
+cursed
+curses
+cursies
+cursing
+cursorary
+curst
+curster
+curstest
+curstness
+cursy
+curtail
+curtain
+curtains
+curtal
+curtis
+curtle
+curtsied
+curtsies
+curtsy
+curvet
+curvets
+cushes
+cushion
+cushions
+custalorum
+custard
+custody
+custom
+customary
+customed
+customer
+customers
+customs
+custure
+cut
+cutler
+cutpurse
+cutpurses
+cuts
+cutter
+cutting
+cuttle
+cxsar
+cyclops
+cydnus
+cygnet
+cygnets
+cym
+cymbals
+cymbeline
+cyme
+cynic
+cynthia
+cypress
+cypriot
+cyprus
+cyrus
+cytherea
+d
+dabbled
+dace
+dad
+daedalus
+daemon
+daff
+daffed
+daffest
+daffodils
+dagger
+daggers
+dagonet
+daily
+daintier
+dainties
+daintiest
+daintily
+daintiness
+daintry
+dainty
+daisied
+daisies
+daisy
+dale
+dalliance
+dallied
+dallies
+dally
+dallying
+dalmatians
+dam
+damage
+damascus
+damask
+damasked
+dame
+dames
+damm
+damn
+damnable
+damnably
+damnation
+damned
+damns
+damoiselle
+damon
+damosella
+damp
+dams
+damsel
+damsons
+dan
+danc
+dance
+dancer
+dances
+dancing
+dandle
+dandy
+dane
+dang
+danger
+dangerous
+dangerously
+dangers
+dangling
+daniel
+danish
+dank
+dankish
+danskers
+daphne
+dappled
+dapples
+dar
+dardan
+dardanian
+dardanius
+dare
+dared
+dareful
+dares
+darest
+daring
+darius
+dark
+darken
+darkening
+darkens
+darker
+darkest
+darkling
+darkly
+darkness
+darling
+darlings
+darnel
+darraign
+dart
+darted
+darter
+dartford
+darting
+darts
+dash
+dashes
+dashing
+dastard
+dastards
+dat
+datchet
+date
+dated
+dateless
+dates
+daub
+daughter
+daughters
+daunt
+daunted
+dauntless
+dauphin
+daventry
+davy
+daw
+dawn
+dawning
+daws
+day
+daylight
+days
+dazzle
+dazzled
+dazzling
+de
+dead
+deadly
+deaf
+deafing
+deafness
+deafs
+deal
+dealer
+dealers
+dealest
+dealing
+dealings
+deals
+dealt
+dean
+deanery
+dear
+dearer
+dearest
+dearly
+dearness
+dears
+dearth
+dearths
+death
+deathbed
+deathful
+deaths
+deathsman
+deathsmen
+debarred
+debase
+debate
+debated
+debatement
+debateth
+debating
+debauch
+debile
+debility
+debitor
+debonair
+deborah
+debosh
+debt
+debted
+debtor
+debtors
+debts
+debuty
+decay
+decayed
+decayer
+decaying
+decays
+deceas
+decease
+deceased
+deceit
+deceitful
+deceits
+deceiv
+deceivable
+deceive
+deceived
+deceiver
+deceivers
+deceives
+deceivest
+deceiveth
+deceiving
+december
+decent
+deceptious
+decerns
+decide
+decides
+decimation
+decipher
+deciphers
+decision
+decius
+deck
+decking
+decks
+deckt
+declare
+declares
+declension
+declensions
+declin
+decline
+declined
+declines
+declining
+decoct
+decorum
+decreas
+decrease
+decreasing
+decree
+decreed
+decrees
+decrepit
+dedicate
+dedicated
+dedicates
+dedication
+deed
+deedless
+deeds
+deem
+deemed
+deep
+deeper
+deepest
+deeply
+deeps
+deepvow
+deer
+deesse
+defac
+deface
+defaced
+defacer
+defacers
+defacing
+defam
+default
+defeat
+defeated
+defeats
+defeatures
+defect
+defective
+defects
+defence
+defences
+defend
+defendant
+defended
+defender
+defenders
+defending
+defends
+defense
+defensible
+defensive
+defer
+deferr
+defiance
+deficient
+defied
+defies
+defil
+defile
+defiler
+defiles
+defiling
+define
+definement
+definite
+definitive
+definitively
+deflow
+deflower
+deflowered
+deform
+deformed
+deformities
+deformity
+deftly
+defunct
+defunction
+defuse
+defy
+defying
+degenerate
+degraded
+degree
+degrees
+deified
+deifying
+deign
+deigned
+deiphobus
+deities
+deity
+deja
+deject
+dejected
+delabreth
+delay
+delayed
+delaying
+delays
+delectable
+deliberate
+delicate
+delicates
+delicious
+deliciousness
+delight
+delighted
+delightful
+delights
+delinquents
+deliv
+deliver
+deliverance
+delivered
+delivering
+delivers
+delivery
+delphos
+deluded
+deluding
+deluge
+delve
+delver
+delves
+demand
+demanded
+demanding
+demands
+demean
+demeanor
+demeanour
+demerits
+demesnes
+demetrius
+demi
+demigod
+demise
+demoiselles
+demon
+demonstrable
+demonstrate
+demonstrated
+demonstrating
+demonstration
+demonstrative
+demure
+demurely
+demuring
+den
+denay
+deni
+denial
+denials
+denied
+denier
+denies
+deniest
+denis
+denmark
+dennis
+denny
+denote
+denoted
+denotement
+denounc
+denounce
+denouncing
+dens
+denunciation
+deny
+denying
+deo
+depart
+departed
+departest
+departing
+departure
+depeche
+depend
+dependant
+dependants
+depended
+dependence
+dependences
+dependency
+dependent
+dependents
+depender
+depending
+depends
+deplore
+deploring
+depopulate
+depos
+depose
+deposed
+deposing
+depositaries
+deprav
+depravation
+deprave
+depraved
+depraves
+depress
+depriv
+deprive
+depth
+depths
+deputation
+depute
+deputed
+deputies
+deputing
+deputy
+deracinate
+derby
+dercetas
+dere
+derides
+derision
+deriv
+derivation
+derivative
+derive
+derived
+derives
+derogate
+derogately
+derogation
+des
+desartless
+descant
+descend
+descended
+descending
+descends
+descension
+descent
+descents
+describe
+described
+describes
+descried
+description
+descriptions
+descry
+desdemon
+desdemona
+desert
+deserts
+deserv
+deserve
+deserved
+deservedly
+deserver
+deservers
+deserves
+deservest
+deserving
+deservings
+design
+designment
+designments
+designs
+desir
+desire
+desired
+desirers
+desires
+desirest
+desiring
+desirous
+desist
+desk
+desolate
+desolation
+desp
+despair
+despairing
+despairs
+despatch
+desperate
+desperately
+desperation
+despis
+despise
+despised
+despiser
+despiseth
+despising
+despite
+despiteful
+despoiled
+dest
+destin
+destined
+destinies
+destiny
+destitute
+destroy
+destroyed
+destroyer
+destroyers
+destroying
+destroys
+destruction
+destructions
+det
+detain
+detains
+detect
+detected
+detecting
+detection
+detector
+detects
+detention
+determin
+determinate
+determination
+determinations
+determine
+determined
+determines
+detest
+detestable
+detested
+detesting
+detests
+detract
+detraction
+detractions
+deucalion
+deuce
+deum
+deux
+devant
+devesting
+device
+devices
+devil
+devilish
+devils
+devis
+devise
+devised
+devises
+devising
+devoid
+devonshire
+devote
+devoted
+devotion
+devour
+devoured
+devourers
+devouring
+devours
+devout
+devoutly
+dew
+dewberries
+dewdrops
+dewlap
+dewlapp
+dews
+dewy
+dexter
+dexteriously
+dexterity
+di
+diable
+diablo
+diadem
+dial
+dialect
+dialogue
+dialogued
+dials
+diameter
+diamond
+diamonds
+dian
+diana
+diaper
+dibble
+dic
+dice
+dicers
+dich
+dick
+dickens
+dickon
+dicky
+dictator
+diction
+dictynna
+did
+diddle
+didest
+dido
+didst
+die
+died
+diedst
+dies
+diest
+diet
+dieted
+dieter
+dieu
+diff
+differ
+difference
+differences
+differency
+different
+differing
+differs
+difficile
+difficult
+difficulties
+difficulty
+diffidence
+diffidences
+diffus
+diffused
+diffusest
+dig
+digest
+digested
+digestion
+digestions
+digg
+digging
+dighton
+dignified
+dignifies
+dignify
+dignities
+dignity
+digress
+digressing
+digression
+digs
+digt
+dilate
+dilated
+dilations
+dilatory
+dild
+dildos
+dilemma
+dilemmas
+diligence
+diligent
+diluculo
+dim
+dimension
+dimensions
+diminish
+diminishing
+diminution
+diminutive
+diminutives
+dimm
+dimmed
+dimming
+dimpled
+dimples
+dims
+din
+dine
+dined
+diner
+dines
+ding
+dining
+dinner
+dinners
+dinnertime
+dint
+diomed
+diomede
+diomedes
+dion
+dip
+dipp
+dipping
+dips
+dir
+dire
+direct
+directed
+directing
+direction
+directions
+directitude
+directive
+directly
+directs
+direful
+direness
+direst
+dirge
+dirges
+dirt
+dirty
+dis
+disability
+disable
+disabled
+disabling
+disadvantage
+disagree
+disallow
+disanimates
+disannul
+disannuls
+disappointed
+disarm
+disarmed
+disarmeth
+disarms
+disaster
+disasters
+disastrous
+disbench
+disbranch
+disburdened
+disburs
+disburse
+disbursed
+discandy
+discandying
+discard
+discarded
+discase
+discased
+discern
+discerner
+discerning
+discernings
+discerns
+discharg
+discharge
+discharged
+discharging
+discipled
+disciples
+disciplin
+discipline
+disciplined
+disciplines
+disclaim
+disclaiming
+disclaims
+disclos
+disclose
+disclosed
+discloses
+discolour
+discoloured
+discolours
+discomfit
+discomfited
+discomfiture
+discomfort
+discomfortable
+discommend
+disconsolate
+discontent
+discontented
+discontentedly
+discontenting
+discontents
+discontinue
+discontinued
+discord
+discordant
+discords
+discourse
+discoursed
+discourser
+discourses
+discoursive
+discourtesy
+discov
+discover
+discovered
+discoverers
+discoveries
+discovering
+discovers
+discovery
+discredit
+discredited
+discredits
+discreet
+discreetly
+discretion
+discretions
+discuss
+disdain
+disdained
+disdaineth
+disdainful
+disdainfully
+disdaining
+disdains
+disdnguish
+diseas
+disease
+diseased
+diseases
+disedg
+disembark
+disfigure
+disfigured
+disfurnish
+disgorge
+disgrac
+disgrace
+disgraced
+disgraceful
+disgraces
+disgracing
+disgracious
+disguis
+disguise
+disguised
+disguiser
+disguises
+disguising
+dish
+dishabited
+dishclout
+dishearten
+disheartens
+dishes
+dishonest
+dishonestly
+dishonesty
+dishonor
+dishonorable
+dishonors
+dishonour
+dishonourable
+dishonoured
+dishonours
+disinherit
+disinherited
+disjoin
+disjoining
+disjoins
+disjoint
+disjunction
+dislik
+dislike
+disliken
+dislikes
+dislimns
+dislocate
+dislodg
+disloyal
+disloyalty
+dismal
+dismantle
+dismantled
+dismask
+dismay
+dismayed
+dismemb
+dismember
+dismes
+dismiss
+dismissed
+dismissing
+dismission
+dismount
+dismounted
+disnatur
+disobedience
+disobedient
+disobey
+disobeys
+disorb
+disorder
+disordered
+disorderly
+disorders
+disparage
+disparagement
+disparagements
+dispark
+dispatch
+dispensation
+dispense
+dispenses
+dispers
+disperse
+dispersed
+dispersedly
+dispersing
+dispiteous
+displac
+displace
+displaced
+displant
+displanting
+display
+displayed
+displeas
+displease
+displeased
+displeasing
+displeasure
+displeasures
+disponge
+disport
+disports
+dispos
+dispose
+disposed
+disposer
+disposing
+disposition
+dispositions
+dispossess
+dispossessing
+disprais
+dispraise
+dispraising
+dispraisingly
+dispropertied
+disproportion
+disproportioned
+disprov
+disprove
+disproved
+dispursed
+disputable
+disputation
+disputations
+dispute
+disputed
+disputes
+disputing
+disquantity
+disquiet
+disquietly
+disrelish
+disrobe
+disseat
+dissemble
+dissembled
+dissembler
+dissemblers
+dissembling
+dissembly
+dissension
+dissensions
+dissentious
+dissever
+dissipation
+dissolute
+dissolutely
+dissolution
+dissolutions
+dissolv
+dissolve
+dissolved
+dissolves
+dissuade
+dissuaded
+distaff
+distaffs
+distain
+distains
+distance
+distant
+distaste
+distasted
+distasteful
+distemp
+distemper
+distemperature
+distemperatures
+distempered
+distempering
+distil
+distill
+distillation
+distilled
+distills
+distilment
+distinct
+distinction
+distinctly
+distingue
+distinguish
+distinguishes
+distinguishment
+distract
+distracted
+distractedly
+distraction
+distractions
+distracts
+distrain
+distraught
+distress
+distressed
+distresses
+distressful
+distribute
+distributed
+distribution
+distrust
+distrustful
+disturb
+disturbed
+disturbers
+disturbing
+disunite
+disvalued
+disvouch
+dit
+ditch
+ditchers
+ditches
+dites
+ditties
+ditty
+diurnal
+div
+dive
+diver
+divers
+diversely
+diversity
+divert
+diverted
+diverts
+dives
+divest
+dividable
+dividant
+divide
+divided
+divides
+divideth
+divin
+divination
+divine
+divinely
+divineness
+diviner
+divines
+divinest
+divining
+divinity
+division
+divisions
+divorc
+divorce
+divorced
+divorcement
+divorcing
+divulg
+divulge
+divulged
+divulging
+dizy
+dizzy
+do
+doating
+dobbin
+dock
+docks
+doct
+doctor
+doctors
+doctrine
+document
+dodge
+doe
+doer
+doers
+does
+doest
+doff
+dog
+dogberry
+dogfish
+dogg
+dogged
+dogs
+doigts
+doing
+doings
+doit
+doits
+dolabella
+dole
+doleful
+doll
+dollar
+dollars
+dolor
+dolorous
+dolour
+dolours
+dolphin
+dolt
+dolts
+domestic
+domestics
+dominance
+dominations
+dominator
+domine
+domineer
+domineering
+dominical
+dominion
+dominions
+domitius
+dommelton
+don
+donalbain
+donation
+donc
+doncaster
+done
+dong
+donn
+donne
+donner
+donnerai
+doom
+doomsday
+door
+doorkeeper
+doors
+dorcas
+doreus
+doricles
+dormouse
+dorothy
+dorset
+dorsetshire
+dost
+dotage
+dotant
+dotard
+dotards
+dote
+doted
+doters
+dotes
+doteth
+doth
+doting
+double
+doubled
+doubleness
+doubler
+doublet
+doublets
+doubling
+doubly
+doubt
+doubted
+doubtful
+doubtfully
+doubting
+doubtless
+doubts
+doug
+dough
+doughty
+doughy
+douglas
+dout
+doute
+douts
+dove
+dovehouse
+dover
+doves
+dow
+dowager
+dowdy
+dower
+dowerless
+dowers
+dowlas
+dowle
+down
+downfall
+downright
+downs
+downstairs
+downtrod
+downward
+downwards
+downy
+dowries
+dowry
+dowsabel
+doxy
+dozed
+dozen
+dozens
+dozy
+drab
+drabbing
+drabs
+drachma
+drachmas
+draff
+drag
+dragg
+dragged
+dragging
+dragon
+dragonish
+dragons
+drain
+drained
+drains
+drake
+dram
+dramatis
+drank
+draught
+draughts
+drave
+draw
+drawbridge
+drawer
+drawers
+draweth
+drawing
+drawling
+drawn
+draws
+drayman
+draymen
+dread
+dreaded
+dreadful
+dreadfully
+dreading
+dreads
+dream
+dreamer
+dreamers
+dreaming
+dreams
+dreamt
+drearning
+dreary
+dreg
+dregs
+drench
+drenched
+dress
+dressed
+dresser
+dressing
+dressings
+drest
+drew
+dribbling
+dried
+drier
+dries
+drift
+drily
+drink
+drinketh
+drinking
+drinkings
+drinks
+driv
+drive
+drivelling
+driven
+drives
+driveth
+driving
+drizzle
+drizzled
+drizzles
+droit
+drollery
+dromio
+dromios
+drone
+drones
+droop
+droopeth
+drooping
+droops
+drop
+dropheir
+droplets
+dropp
+dropper
+droppeth
+dropping
+droppings
+drops
+dropsied
+dropsies
+dropsy
+dropt
+dross
+drossy
+drought
+drove
+droven
+drovier
+drown
+drowned
+drowning
+drowns
+drows
+drowse
+drowsily
+drowsiness
+drowsy
+drudge
+drudgery
+drudges
+drug
+drugg
+drugs
+drum
+drumble
+drummer
+drumming
+drums
+drunk
+drunkard
+drunkards
+drunken
+drunkenly
+drunkenness
+dry
+dryness
+dst
+du
+dub
+dubb
+ducat
+ducats
+ducdame
+duchess
+duchies
+duchy
+duck
+ducking
+ducks
+dudgeon
+due
+duellist
+duello
+duer
+dues
+duff
+dug
+dugs
+duke
+dukedom
+dukedoms
+dukes
+dulcet
+dulche
+dull
+dullard
+duller
+dullest
+dulling
+dullness
+dulls
+dully
+dulness
+duly
+dumain
+dumb
+dumbe
+dumbly
+dumbness
+dump
+dumps
+dun
+duncan
+dung
+dungeon
+dungeons
+dunghill
+dunghills
+dungy
+dunnest
+dunsinane
+dunsmore
+dunstable
+dupp
+durance
+during
+durst
+dusky
+dust
+dusted
+dusty
+dutch
+dutchman
+duteous
+duties
+dutiful
+duty
+dwarf
+dwarfish
+dwell
+dwellers
+dwelling
+dwells
+dwelt
+dwindle
+dy
+dye
+dyed
+dyer
+dying
+e
+each
+eager
+eagerly
+eagerness
+eagle
+eagles
+eaning
+eanlings
+ear
+earing
+earl
+earldom
+earlier
+earliest
+earliness
+earls
+early
+earn
+earned
+earnest
+earnestly
+earnestness
+earns
+ears
+earth
+earthen
+earthlier
+earthly
+earthquake
+earthquakes
+earthy
+eas
+ease
+eased
+easeful
+eases
+easier
+easiest
+easiliest
+easily
+easiness
+easing
+east
+eastcheap
+easter
+eastern
+eastward
+easy
+eat
+eaten
+eater
+eaters
+eating
+eats
+eaux
+eaves
+ebb
+ebbing
+ebbs
+ebon
+ebony
+ebrew
+ecce
+echapper
+echo
+echoes
+eclips
+eclipse
+eclipses
+ecolier
+ecoutez
+ecstacy
+ecstasies
+ecstasy
+ecus
+eden
+edg
+edgar
+edge
+edged
+edgeless
+edges
+edict
+edicts
+edifice
+edifices
+edified
+edifies
+edition
+edm
+edmund
+edmunds
+edmundsbury
+educate
+educated
+education
+edward
+eel
+eels
+effect
+effected
+effectless
+effects
+effectual
+effectually
+effeminate
+effigies
+effus
+effuse
+effusion
+eftest
+egal
+egally
+eget
+egeus
+egg
+eggs
+eggshell
+eglamour
+eglantine
+egma
+ego
+egregious
+egregiously
+egress
+egypt
+egyptian
+egyptians
+eie
+eight
+eighteen
+eighth
+eightpenny
+eighty
+eisel
+either
+eject
+eke
+el
+elbe
+elbow
+elbows
+eld
+elder
+elders
+eldest
+eleanor
+elect
+elected
+election
+elegancy
+elegies
+element
+elements
+elephant
+elephants
+elevated
+eleven
+eleventh
+elf
+elflocks
+eliads
+elinor
+elizabeth
+ell
+elle
+ellen
+elm
+eloquence
+eloquent
+else
+elsewhere
+elsinore
+eltham
+elves
+elvish
+ely
+elysium
+em
+emballing
+embalm
+embalms
+embark
+embarked
+embarquements
+embassade
+embassage
+embassies
+embassy
+embattailed
+embattl
+embattle
+embay
+embellished
+embers
+emblaze
+emblem
+emblems
+embodied
+embold
+emboldens
+emboss
+embossed
+embounded
+embowel
+embowell
+embrac
+embrace
+embraced
+embracement
+embracements
+embraces
+embracing
+embrasures
+embroider
+embroidery
+emhracing
+emilia
+eminence
+eminent
+eminently
+emmanuel
+emnity
+empale
+emperal
+emperess
+emperial
+emperor
+empery
+emphasis
+empire
+empirics
+empiricutic
+empleached
+employ
+employed
+employer
+employment
+employments
+empoison
+empress
+emptied
+emptier
+empties
+emptiness
+empty
+emptying
+emulate
+emulation
+emulations
+emulator
+emulous
+en
+enact
+enacted
+enacts
+enactures
+enamell
+enamelled
+enamour
+enamoured
+enanmour
+encamp
+encamped
+encave
+enceladus
+enchaf
+enchafed
+enchant
+enchanted
+enchanting
+enchantingly
+enchantment
+enchantress
+enchants
+enchas
+encircle
+encircled
+enclos
+enclose
+enclosed
+encloses
+encloseth
+enclosing
+enclouded
+encompass
+encompassed
+encompasseth
+encompassment
+encore
+encorporal
+encount
+encounter
+encountered
+encounters
+encourage
+encouraged
+encouragement
+encrimsoned
+encroaching
+encumb
+end
+endamage
+endamagement
+endanger
+endart
+endear
+endeared
+endeavour
+endeavours
+ended
+ender
+ending
+endings
+endite
+endless
+endow
+endowed
+endowments
+endows
+ends
+endu
+endue
+endur
+endurance
+endure
+endured
+endures
+enduring
+endymion
+eneas
+enemies
+enemy
+enernies
+enew
+enfeebled
+enfeebles
+enfeoff
+enfetter
+enfoldings
+enforc
+enforce
+enforced
+enforcedly
+enforcement
+enforces
+enforcest
+enfranched
+enfranchis
+enfranchise
+enfranchised
+enfranchisement
+enfreed
+enfreedoming
+engag
+engage
+engaged
+engagements
+engaging
+engaol
+engend
+engender
+engenders
+engilds
+engine
+engineer
+enginer
+engines
+engirt
+england
+english
+englishman
+englishmen
+engluts
+englutted
+engraffed
+engraft
+engrafted
+engrav
+engrave
+engross
+engrossed
+engrossest
+engrossing
+engrossments
+enguard
+enigma
+enigmatical
+enjoin
+enjoined
+enjoy
+enjoyed
+enjoyer
+enjoying
+enjoys
+enkindle
+enkindled
+enlard
+enlarg
+enlarge
+enlarged
+enlargement
+enlargeth
+enlighten
+enlink
+enmesh
+enmities
+enmity
+ennoble
+ennobled
+enobarb
+enobarbus
+enon
+enormity
+enormous
+enough
+enow
+enpatron
+enpierced
+enquir
+enquire
+enquired
+enrag
+enrage
+enraged
+enrages
+enrank
+enrapt
+enrich
+enriched
+enriches
+enridged
+enrings
+enrob
+enrobe
+enroll
+enrolled
+enrooted
+enrounded
+enschedul
+ensconce
+ensconcing
+enseamed
+ensear
+enseigne
+enseignez
+ensemble
+enshelter
+enshielded
+enshrines
+ensign
+ensigns
+enskied
+ensman
+ensnare
+ensnared
+ensnareth
+ensteep
+ensu
+ensue
+ensued
+ensues
+ensuing
+enswathed
+ent
+entail
+entame
+entangled
+entangles
+entendre
+enter
+entered
+entering
+enterprise
+enterprises
+enters
+entertain
+entertained
+entertainer
+entertaining
+entertainment
+entertainments
+enthrall
+enthralled
+enthron
+enthroned
+entice
+enticements
+enticing
+entire
+entirely
+entitle
+entitled
+entitling
+entomb
+entombed
+entrails
+entrance
+entrances
+entrap
+entrapp
+entre
+entreat
+entreated
+entreaties
+entreating
+entreatments
+entreats
+entreaty
+entrench
+entry
+entwist
+envelop
+envenom
+envenomed
+envenoms
+envied
+envies
+envious
+enviously
+environ
+environed
+envoy
+envy
+envying
+enwheel
+enwombed
+enwraps
+ephesian
+ephesians
+ephesus
+epicure
+epicurean
+epicures
+epicurism
+epicurus
+epidamnum
+epidaurus
+epigram
+epilepsy
+epileptic
+epilogue
+epilogues
+epistles
+epistrophus
+epitaph
+epitaphs
+epithet
+epitheton
+epithets
+epitome
+equal
+equalities
+equality
+equall
+equally
+equalness
+equals
+equinoctial
+equinox
+equipage
+equity
+equivocal
+equivocate
+equivocates
+equivocation
+equivocator
+er
+erbear
+erbearing
+erbears
+erbeat
+erblows
+erboard
+erborne
+ercame
+ercast
+ercharg
+ercharged
+ercharging
+ercles
+ercome
+ercover
+ercrows
+erdoing
+ere
+erebus
+erect
+erected
+erecting
+erection
+erects
+erewhile
+erflourish
+erflow
+erflowing
+erflows
+erfraught
+erga
+ergalled
+erglanced
+ergo
+ergone
+ergrow
+ergrown
+ergrowth
+erhang
+erhanging
+erhasty
+erhear
+erheard
+eringoes
+erjoy
+erleap
+erleaps
+erleavens
+erlook
+erlooking
+ermaster
+ermengare
+ermount
+ern
+ernight
+eros
+erpaid
+erparted
+erpast
+erpays
+erpeer
+erperch
+erpicturing
+erpingham
+erposting
+erpow
+erpress
+erpressed
+err
+errand
+errands
+errant
+errate
+erraught
+erreaches
+erred
+errest
+erring
+erroneous
+error
+errors
+errs
+errule
+errun
+erset
+ershade
+ershades
+ershine
+ershot
+ersized
+erskip
+erslips
+erspreads
+erst
+erstare
+erstep
+erstunk
+ersway
+ersways
+erswell
+erta
+ertake
+erteemed
+erthrow
+erthrown
+erthrows
+ertook
+ertop
+ertopping
+ertrip
+erturn
+erudition
+eruption
+eruptions
+ervalues
+erwalk
+erwatch
+erween
+erweens
+erweigh
+erweighs
+erwhelm
+erwhelmed
+erworn
+es
+escalus
+escap
+escape
+escaped
+escapes
+eschew
+escoted
+esill
+especial
+especially
+esperance
+espials
+espied
+espies
+espous
+espouse
+espy
+esquire
+esquires
+essay
+essays
+essence
+essential
+essentially
+esses
+essex
+est
+establish
+established
+estate
+estates
+esteem
+esteemed
+esteemeth
+esteeming
+esteems
+estimable
+estimate
+estimation
+estimations
+estime
+estranged
+estridge
+estridges
+et
+etc
+etceteras
+ete
+eternal
+eternally
+eterne
+eternity
+eterniz
+etes
+ethiop
+ethiope
+ethiopes
+ethiopian
+etna
+eton
+etre
+eunuch
+eunuchs
+euphrates
+euphronius
+euriphile
+europa
+europe
+ev
+evade
+evades
+evans
+evasion
+evasions
+eve
+even
+evening
+evenly
+event
+eventful
+events
+ever
+everlasting
+everlastingly
+evermore
+every
+everyone
+everything
+everywhere
+evidence
+evidences
+evident
+evil
+evilly
+evils
+evitate
+ewe
+ewer
+ewers
+ewes
+exact
+exacted
+exactest
+exacting
+exaction
+exactions
+exactly
+exacts
+exalt
+exalted
+examin
+examination
+examinations
+examine
+examined
+examines
+exampl
+example
+exampled
+examples
+exasperate
+exasperates
+exceed
+exceeded
+exceedeth
+exceeding
+exceedingly
+exceeds
+excel
+excelled
+excellence
+excellencies
+excellency
+excellent
+excellently
+excelling
+excels
+except
+excepted
+excepting
+exception
+exceptions
+exceptless
+excess
+excessive
+exchang
+exchange
+exchanged
+exchequer
+exchequers
+excite
+excited
+excitements
+excites
+exclaim
+exclaims
+exclamation
+exclamations
+excludes
+excommunicate
+excommunication
+excrement
+excrements
+excursion
+excursions
+excus
+excusable
+excuse
+excused
+excuses
+excusez
+excusing
+execrable
+execrations
+execute
+executed
+executing
+execution
+executioner
+executioners
+executor
+executors
+exempt
+exempted
+exequies
+exercise
+exercises
+exeter
+exeunt
+exhal
+exhalation
+exhalations
+exhale
+exhales
+exhaust
+exhibit
+exhibiters
+exhibition
+exhort
+exhortation
+exigent
+exil
+exile
+exiled
+exion
+exist
+exists
+exit
+exits
+exorciser
+exorcisms
+exorcist
+expect
+expectance
+expectancy
+expectation
+expectations
+expected
+expecters
+expecting
+expects
+expedience
+expedient
+expediently
+expedition
+expeditious
+expel
+expell
+expelling
+expels
+expend
+expense
+expenses
+experienc
+experience
+experiences
+experiment
+experimental
+experiments
+expert
+expertness
+expiate
+expiation
+expir
+expiration
+expire
+expired
+expires
+expiring
+explication
+exploit
+exploits
+expos
+expose
+exposing
+exposition
+expositor
+expostulate
+expostulation
+exposture
+exposure
+expound
+expounded
+express
+expressed
+expresseth
+expressing
+expressive
+expressly
+expressure
+expuls
+expulsion
+exquisite
+exsufflicate
+extant
+extemporal
+extemporally
+extempore
+extend
+extended
+extends
+extent
+extenuate
+extenuated
+extenuates
+extenuation
+exterior
+exteriorly
+exteriors
+extermin
+extern
+external
+extinct
+extincted
+extincture
+extinguish
+extirp
+extirpate
+extirped
+extol
+extoll
+extolment
+exton
+extort
+extorted
+extortion
+extortions
+extra
+extract
+extracted
+extracting
+extraordinarily
+extraordinary
+extraught
+extravagancy
+extravagant
+extreme
+extremely
+extremes
+extremest
+extremities
+extremity
+exuent
+exult
+exultation
+ey
+eyas
+eyases
+eye
+eyeball
+eyeballs
+eyebrow
+eyebrows
+eyed
+eyeless
+eyelid
+eyelids
+eyes
+eyesight
+eyestrings
+eying
+eyne
+eyrie
+fa
+fabian
+fable
+fables
+fabric
+fabulous
+fac
+face
+faced
+facere
+faces
+faciant
+facile
+facility
+facinerious
+facing
+facit
+fact
+faction
+factionary
+factions
+factious
+factor
+factors
+faculties
+faculty
+fade
+faded
+fadeth
+fadge
+fading
+fadings
+fadom
+fadoms
+fagot
+fagots
+fail
+failing
+fails
+fain
+faint
+fainted
+fainter
+fainting
+faintly
+faintness
+faints
+fair
+fairer
+fairest
+fairies
+fairing
+fairings
+fairly
+fairness
+fairs
+fairwell
+fairy
+fais
+fait
+faites
+faith
+faithful
+faithfull
+faithfully
+faithless
+faiths
+faitors
+fal
+falchion
+falcon
+falconbridge
+falconer
+falconers
+fall
+fallacy
+fallen
+falleth
+falliable
+fallible
+falling
+fallow
+fallows
+falls
+fally
+falorous
+false
+falsehood
+falsely
+falseness
+falser
+falsify
+falsing
+falstaff
+falstaffs
+falter
+fam
+fame
+famed
+familiar
+familiarity
+familiarly
+familiars
+family
+famine
+famish
+famished
+famous
+famoused
+famously
+fan
+fanatical
+fancies
+fancy
+fane
+fanes
+fang
+fangled
+fangless
+fangs
+fann
+fanning
+fans
+fantasied
+fantasies
+fantastic
+fantastical
+fantastically
+fantasticoes
+fantasy
+fap
+far
+farborough
+farced
+fardel
+fardels
+fare
+fares
+farewell
+farewells
+fariner
+faring
+farm
+farmer
+farmhouse
+farms
+farre
+farrow
+farther
+farthest
+farthing
+farthingale
+farthingales
+farthings
+fartuous
+fas
+fashion
+fashionable
+fashioning
+fashions
+fast
+fasted
+fasten
+fastened
+faster
+fastest
+fasting
+fastly
+fastolfe
+fasts
+fat
+fatal
+fatally
+fate
+fated
+fates
+father
+fathered
+fatherless
+fatherly
+fathers
+fathom
+fathomless
+fathoms
+fatigate
+fatness
+fats
+fatted
+fatter
+fattest
+fatting
+fatuus
+fauconbridge
+faulconbridge
+fault
+faultiness
+faultless
+faults
+faulty
+fausse
+fauste
+faustuses
+faut
+favor
+favorable
+favorably
+favors
+favour
+favourable
+favoured
+favouredly
+favourer
+favourers
+favouring
+favourite
+favourites
+favours
+favout
+fawn
+fawneth
+fawning
+fawns
+fay
+fe
+fealty
+fear
+feared
+fearest
+fearful
+fearfull
+fearfully
+fearfulness
+fearing
+fearless
+fears
+feast
+feasted
+feasting
+feasts
+feat
+feated
+feater
+feather
+feathered
+feathers
+featly
+feats
+featur
+feature
+featured
+featureless
+features
+february
+fecks
+fed
+fedary
+federary
+fee
+feeble
+feebled
+feebleness
+feebling
+feebly
+feed
+feeder
+feeders
+feedeth
+feeding
+feeds
+feel
+feeler
+feeling
+feelingly
+feels
+fees
+feet
+fehemently
+feign
+feigned
+feigning
+feil
+feith
+felicitate
+felicity
+fell
+fellest
+fellies
+fellow
+fellowly
+fellows
+fellowship
+fellowships
+fells
+felon
+felonious
+felony
+felt
+female
+females
+feminine
+fen
+fenc
+fence
+fencer
+fencing
+fends
+fennel
+fenny
+fens
+fenton
+fer
+ferdinand
+fere
+fernseed
+ferrara
+ferrers
+ferret
+ferry
+ferryman
+fertile
+fertility
+fervency
+fervour
+fery
+fest
+feste
+fester
+festinate
+festinately
+festival
+festivals
+fet
+fetch
+fetches
+fetching
+fetlock
+fetlocks
+fett
+fetter
+fettering
+fetters
+fettle
+feu
+feud
+fever
+feverous
+fevers
+few
+fewer
+fewest
+fewness
+fickle
+fickleness
+fico
+fiction
+fiddle
+fiddler
+fiddlestick
+fidele
+fidelicet
+fidelity
+fidius
+fie
+field
+fielded
+fields
+fiend
+fiends
+fierce
+fiercely
+fierceness
+fiery
+fife
+fifes
+fifteen
+fifteens
+fifteenth
+fifth
+fifty
+fiftyfold
+fig
+fight
+fighter
+fightest
+fighteth
+fighting
+fights
+figo
+figs
+figur
+figure
+figured
+figures
+figuring
+fike
+fil
+filberts
+filch
+filches
+filching
+file
+filed
+files
+filial
+filius
+fill
+filled
+fillet
+filling
+fillip
+fills
+filly
+film
+fils
+filth
+filths
+filthy
+fin
+finally
+finch
+find
+finder
+findeth
+finding
+findings
+finds
+fine
+fineless
+finely
+finem
+fineness
+finer
+fines
+finest
+fing
+finger
+fingering
+fingers
+fingre
+fingres
+finical
+finish
+finished
+finisher
+finless
+finn
+fins
+finsbury
+fir
+firago
+fire
+firebrand
+firebrands
+fired
+fires
+firework
+fireworks
+firing
+firk
+firm
+firmament
+firmly
+firmness
+first
+firstlings
+fish
+fisher
+fishermen
+fishers
+fishes
+fishified
+fishmonger
+fishpond
+fisnomy
+fist
+fisting
+fists
+fistula
+fit
+fitchew
+fitful
+fitly
+fitment
+fitness
+fits
+fitted
+fitter
+fittest
+fitteth
+fitting
+fitzwater
+five
+fivepence
+fives
+fix
+fixed
+fixes
+fixeth
+fixing
+fixture
+fl
+flag
+flagging
+flagon
+flagons
+flags
+flail
+flakes
+flaky
+flam
+flame
+flamen
+flamens
+flames
+flaming
+flaminius
+flanders
+flannel
+flap
+flaring
+flash
+flashes
+flashing
+flask
+flat
+flatly
+flatness
+flats
+flatt
+flatter
+flattered
+flatterer
+flatterers
+flatterest
+flatteries
+flattering
+flatters
+flattery
+flaunts
+flavio
+flavius
+flaw
+flaws
+flax
+flaxen
+flay
+flaying
+flea
+fleance
+fleas
+flecked
+fled
+fledge
+flee
+fleec
+fleece
+fleeces
+fleer
+fleering
+fleers
+fleet
+fleeter
+fleeting
+fleming
+flemish
+flesh
+fleshes
+fleshly
+fleshment
+fleshmonger
+flew
+flexible
+flexure
+flibbertigibbet
+flickering
+flidge
+fliers
+flies
+flieth
+flight
+flights
+flighty
+flinch
+fling
+flint
+flints
+flinty
+flirt
+float
+floated
+floating
+flock
+flocks
+flood
+floodgates
+floods
+floor
+flora
+florence
+florentine
+florentines
+florentius
+florizel
+flote
+floulish
+flour
+flourish
+flourishes
+flourisheth
+flourishing
+flout
+flouted
+flouting
+flouts
+flow
+flowed
+flower
+flowerets
+flowers
+flowing
+flown
+flows
+fluellen
+fluent
+flung
+flush
+flushing
+fluster
+flute
+flutes
+flutter
+flux
+fluxive
+fly
+flying
+fo
+foal
+foals
+foam
+foamed
+foaming
+foams
+foamy
+fob
+focative
+fodder
+foe
+foeman
+foemen
+foes
+fog
+foggy
+fogs
+foh
+foi
+foil
+foiled
+foils
+foin
+foining
+foins
+fois
+foison
+foisons
+foist
+foix
+fold
+folded
+folds
+folio
+folk
+folks
+follies
+follow
+followed
+follower
+followers
+followest
+following
+follows
+folly
+fond
+fonder
+fondly
+fondness
+font
+fontibell
+food
+fool
+fooleries
+foolery
+foolhardy
+fooling
+foolish
+foolishly
+foolishness
+fools
+foot
+football
+footboy
+footboys
+footed
+footfall
+footing
+footman
+footmen
+footpath
+footsteps
+footstool
+fopp
+fopped
+foppery
+foppish
+fops
+for
+forage
+foragers
+forbade
+forbear
+forbearance
+forbears
+forbid
+forbidden
+forbiddenly
+forbids
+forbod
+forborne
+forc
+force
+forced
+forceful
+forceless
+forces
+forcible
+forcibly
+forcing
+ford
+fordid
+fordo
+fordoes
+fordone
+fore
+forecast
+forefather
+forefathers
+forefinger
+forego
+foregone
+forehand
+forehead
+foreheads
+forehorse
+foreign
+foreigner
+foreigners
+foreknowing
+foreknowledge
+foremost
+forenamed
+forenoon
+forerun
+forerunner
+forerunning
+foreruns
+foresaid
+foresaw
+foresay
+foresee
+foreseeing
+foresees
+foreshow
+foreskirt
+forespent
+forest
+forestall
+forestalled
+forester
+foresters
+forests
+foretell
+foretelling
+foretells
+forethink
+forethought
+foretold
+forever
+foreward
+forewarn
+forewarned
+forewarning
+forfeit
+forfeited
+forfeiters
+forfeiting
+forfeits
+forfeiture
+forfeitures
+forfend
+forfended
+forg
+forgave
+forge
+forged
+forgeries
+forgery
+forges
+forget
+forgetful
+forgetfulness
+forgetive
+forgets
+forgetting
+forgive
+forgiven
+forgiveness
+forgo
+forgoing
+forgone
+forgot
+forgotten
+fork
+forked
+forks
+forlorn
+form
+formal
+formally
+formed
+former
+formerly
+formless
+forms
+fornication
+fornications
+fornicatress
+forres
+forrest
+forsake
+forsaken
+forsaketh
+forslow
+forsook
+forsooth
+forspent
+forspoke
+forswear
+forswearing
+forswore
+forsworn
+fort
+forted
+forth
+forthcoming
+forthlight
+forthright
+forthwith
+fortification
+fortifications
+fortified
+fortifies
+fortify
+fortinbras
+fortitude
+fortnight
+fortress
+fortresses
+forts
+fortun
+fortuna
+fortunate
+fortunately
+fortune
+fortuned
+fortunes
+fortward
+forty
+forum
+forward
+forwarding
+forwardness
+forwards
+forwearied
+fosset
+fost
+foster
+fostered
+fought
+foughten
+foul
+fouler
+foulest
+foully
+foulness
+found
+foundation
+foundations
+founded
+founder
+fount
+fountain
+fountains
+founts
+four
+fourscore
+fourteen
+fourth
+foutra
+fowl
+fowler
+fowling
+fowls
+fox
+foxes
+foxship
+fracted
+fraction
+fractions
+fragile
+fragment
+fragments
+fragrant
+frail
+frailer
+frailties
+frailty
+fram
+frame
+framed
+frames
+frampold
+fran
+francais
+france
+frances
+franchise
+franchised
+franchisement
+franchises
+franciae
+francis
+francisca
+franciscan
+francisco
+frank
+franker
+frankfort
+franklin
+franklins
+frankly
+frankness
+frantic
+franticly
+frateretto
+fratrum
+fraud
+fraudful
+fraught
+fraughtage
+fraughting
+fray
+frays
+freckl
+freckled
+freckles
+frederick
+free
+freed
+freedom
+freedoms
+freehearted
+freelier
+freely
+freeman
+freemen
+freeness
+freer
+frees
+freestone
+freetown
+freeze
+freezes
+freezing
+freezings
+french
+frenchman
+frenchmen
+frenchwoman
+frenzy
+frequent
+frequents
+fresh
+fresher
+freshes
+freshest
+freshly
+freshness
+fret
+fretful
+frets
+fretted
+fretten
+fretting
+friar
+friars
+friday
+fridays
+friend
+friended
+friending
+friendless
+friendliness
+friendly
+friends
+friendship
+friendships
+frieze
+fright
+frighted
+frightened
+frightful
+frighting
+frights
+fringe
+fringed
+frippery
+frisk
+fritters
+frivolous
+fro
+frock
+frog
+frogmore
+froissart
+frolic
+from
+front
+fronted
+frontier
+frontiers
+fronting
+frontlet
+fronts
+frost
+frosts
+frosty
+froth
+froward
+frown
+frowning
+frowningly
+frowns
+froze
+frozen
+fructify
+frugal
+fruit
+fruiterer
+fruitful
+fruitfully
+fruitfulness
+fruition
+fruitless
+fruits
+frush
+frustrate
+frutify
+fry
+fubb
+fuel
+fugitive
+fulfil
+fulfill
+fulfilling
+fulfils
+full
+fullam
+fuller
+fullers
+fullest
+fullness
+fully
+fulness
+fulsome
+fulvia
+fum
+fumble
+fumbles
+fumblest
+fumbling
+fume
+fumes
+fuming
+fumiter
+fumitory
+fun
+function
+functions
+fundamental
+funeral
+funerals
+fur
+furbish
+furies
+furious
+furlongs
+furnace
+furnaces
+furnish
+furnished
+furnishings
+furniture
+furnival
+furor
+furr
+furrow
+furrowed
+furrows
+furth
+further
+furtherance
+furtherer
+furthermore
+furthest
+fury
+furze
+furzes
+fust
+fustian
+fustilarian
+fusty
+fut
+future
+futurity
+g
+gabble
+gaberdine
+gabriel
+gad
+gadding
+gads
+gadshill
+gag
+gage
+gaged
+gagg
+gaging
+gagne
+gain
+gained
+gainer
+gaingiving
+gains
+gainsaid
+gainsay
+gainsaying
+gainsays
+gainst
+gait
+gaited
+galathe
+gale
+galen
+gales
+gall
+gallant
+gallantly
+gallantry
+gallants
+galled
+gallery
+galley
+galleys
+gallia
+gallian
+galliard
+galliasses
+gallimaufry
+galling
+gallons
+gallop
+galloping
+gallops
+gallow
+galloway
+gallowglasses
+gallows
+gallowses
+galls
+gallus
+gam
+gambol
+gambold
+gambols
+gamboys
+game
+gamers
+games
+gamesome
+gamester
+gaming
+gammon
+gamut
+gan
+gangren
+ganymede
+gaol
+gaoler
+gaolers
+gaols
+gap
+gape
+gapes
+gaping
+gar
+garb
+garbage
+garboils
+garcon
+gard
+garde
+garden
+gardener
+gardeners
+gardens
+gardez
+gardiner
+gardon
+gargantua
+gargrave
+garish
+garland
+garlands
+garlic
+garment
+garments
+garmet
+garner
+garners
+garnish
+garnished
+garret
+garrison
+garrisons
+gart
+garter
+garterd
+gartering
+garters
+gascony
+gash
+gashes
+gaskins
+gasp
+gasping
+gasted
+gastness
+gat
+gate
+gated
+gates
+gath
+gather
+gathered
+gathering
+gathers
+gatories
+gatory
+gaud
+gaudeo
+gaudy
+gauge
+gaul
+gaultree
+gaunt
+gauntlet
+gauntlets
+gav
+gave
+gavest
+gawded
+gawds
+gawsey
+gay
+gayness
+gaz
+gaze
+gazed
+gazer
+gazers
+gazes
+gazeth
+gazing
+gear
+geck
+geese
+geffrey
+geld
+gelded
+gelding
+gelida
+gelidus
+gelt
+gem
+geminy
+gems
+gen
+gender
+genders
+general
+generally
+generals
+generation
+generations
+generative
+generosity
+generous
+genitive
+genitivo
+genius
+gennets
+genoa
+genoux
+gens
+gent
+gentilhomme
+gentility
+gentle
+gentlefolks
+gentleman
+gentlemanlike
+gentlemen
+gentleness
+gentler
+gentles
+gentlest
+gentlewoman
+gentlewomen
+gently
+gentry
+george
+gerard
+germaines
+germains
+german
+germane
+germans
+germany
+gertrude
+gest
+gests
+gesture
+gestures
+get
+getrude
+gets
+getter
+getting
+ghastly
+ghost
+ghosted
+ghostly
+ghosts
+gi
+giant
+giantess
+giantlike
+giants
+gib
+gibber
+gibbet
+gibbets
+gibe
+giber
+gibes
+gibing
+gibingly
+giddily
+giddiness
+giddy
+gift
+gifts
+gig
+giglets
+giglot
+gilbert
+gild
+gilded
+gilding
+gilliams
+gillian
+gills
+gillyvors
+gilt
+gimmal
+gimmers
+gin
+ging
+ginger
+gingerbread
+gingerly
+ginn
+gins
+gioucestershire
+gipes
+gipsies
+gipsy
+gird
+girded
+girdle
+girdled
+girdles
+girdling
+girl
+girls
+girt
+girth
+gis
+giv
+give
+given
+giver
+givers
+gives
+givest
+giveth
+giving
+givings
+glad
+gladded
+gladding
+gladly
+gladness
+glamis
+glanc
+glance
+glanced
+glances
+glancing
+glanders
+glansdale
+glare
+glares
+glass
+glasses
+glassy
+glaz
+glazed
+gleams
+glean
+gleaned
+gleaning
+gleeful
+gleek
+gleeking
+gleeks
+glend
+glendower
+glib
+glide
+glided
+glides
+glideth
+gliding
+glimmer
+glimmering
+glimmers
+glimpse
+glimpses
+glist
+glistening
+glister
+glistering
+glisters
+glitt
+glittering
+globe
+globes
+glooming
+gloomy
+glories
+glorified
+glorify
+glorious
+gloriously
+glory
+glose
+gloss
+glosses
+glou
+glouceste
+gloucester
+gloucestershire
+glove
+glover
+gloves
+glow
+glowed
+glowing
+glowworm
+gloz
+gloze
+glozes
+glu
+glue
+glued
+glues
+glut
+glutt
+glutted
+glutton
+gluttoning
+gluttony
+gnarled
+gnarling
+gnat
+gnats
+gnaw
+gnawing
+gnawn
+gnaws
+go
+goad
+goaded
+goads
+goal
+goat
+goatish
+goats
+gobbets
+gobbo
+goblet
+goblets
+goblin
+goblins
+god
+godded
+godden
+goddess
+goddesses
+goddild
+godfather
+godfathers
+godhead
+godlike
+godliness
+godly
+godmother
+gods
+godson
+goer
+goers
+goes
+goest
+goeth
+goffe
+gogs
+going
+gold
+golden
+goldenly
+goldsmith
+goldsmiths
+golgotha
+goliases
+goliath
+gon
+gondola
+gondolier
+gone
+goneril
+gong
+gonzago
+gonzalo
+good
+goodfellow
+goodlier
+goodliest
+goodly
+goodman
+goodness
+goodnight
+goodrig
+goods
+goodwife
+goodwill
+goodwin
+goodwins
+goodyear
+goodyears
+goose
+gooseberry
+goosequills
+goot
+gor
+gorbellied
+gorboduc
+gordian
+gore
+gored
+gorg
+gorge
+gorgeous
+gorget
+gorging
+gorgon
+gormandize
+gormandizing
+gory
+gosling
+gospel
+gospels
+goss
+gossamer
+gossip
+gossiping
+gossiplike
+gossips
+got
+goth
+goths
+gotten
+gourd
+gout
+gouts
+gouty
+govern
+governance
+governed
+governess
+government
+governor
+governors
+governs
+gower
+gown
+gowns
+grac
+grace
+graced
+graceful
+gracefully
+graceless
+graces
+gracing
+gracious
+graciously
+gradation
+graff
+graffing
+graft
+grafted
+grafters
+grain
+grained
+grains
+gramercies
+gramercy
+grammar
+grand
+grandam
+grandame
+grandchild
+grande
+grandeur
+grandfather
+grandjurors
+grandmother
+grandpre
+grandsir
+grandsire
+grandsires
+grange
+grant
+granted
+granting
+grants
+grape
+grapes
+grapple
+grapples
+grappling
+grasp
+grasped
+grasps
+grass
+grasshoppers
+grassy
+grate
+grated
+grateful
+grates
+gratiano
+gratify
+gratii
+gratillity
+grating
+gratis
+gratitude
+gratulate
+grav
+grave
+gravediggers
+gravel
+graveless
+gravell
+gravely
+graven
+graveness
+graver
+graves
+gravest
+gravestone
+gravities
+gravity
+gravy
+gray
+graymalkin
+graz
+graze
+grazed
+grazing
+grease
+greases
+greasily
+greasy
+great
+greater
+greatest
+greatly
+greatness
+grecian
+grecians
+gree
+greece
+greed
+greedily
+greediness
+greedy
+greeing
+greek
+greekish
+greeks
+green
+greener
+greenly
+greens
+greensleeves
+greenwich
+greenwood
+greet
+greeted
+greeting
+greetings
+greets
+greg
+gregory
+gremio
+grew
+grey
+greybeard
+greybeards
+greyhound
+greyhounds
+grief
+griefs
+griev
+grievance
+grievances
+grieve
+grieved
+grieves
+grievest
+grieving
+grievingly
+grievous
+grievously
+griffin
+griffith
+grim
+grime
+grimly
+grin
+grind
+grinding
+grindstone
+grinning
+grip
+gripe
+gripes
+griping
+grise
+grisly
+grissel
+grize
+grizzle
+grizzled
+groan
+groaning
+groans
+groat
+groats
+groin
+groom
+grooms
+grop
+groping
+gros
+gross
+grosser
+grossly
+grossness
+ground
+grounded
+groundlings
+grounds
+grove
+grovel
+grovelling
+groves
+grow
+groweth
+growing
+grown
+grows
+growth
+grub
+grubb
+grubs
+grudge
+grudged
+grudges
+grudging
+gruel
+grumble
+grumblest
+grumbling
+grumblings
+grumio
+grund
+grunt
+gualtier
+guard
+guardage
+guardant
+guarded
+guardian
+guardians
+guards
+guardsman
+gud
+gudgeon
+guerdon
+guerra
+guess
+guesses
+guessingly
+guest
+guests
+guiana
+guichard
+guide
+guided
+guider
+guiderius
+guides
+guiding
+guidon
+guienne
+guil
+guildenstern
+guilders
+guildford
+guildhall
+guile
+guiled
+guileful
+guilfords
+guilt
+guiltian
+guiltier
+guiltily
+guiltiness
+guiltless
+guilts
+guilty
+guinea
+guinever
+guise
+gul
+gules
+gulf
+gulfs
+gull
+gulls
+gum
+gumm
+gums
+gun
+gunner
+gunpowder
+guns
+gurnet
+gurney
+gust
+gusts
+gusty
+guts
+gutter
+guy
+guynes
+guysors
+gypsy
+gyve
+gyved
+gyves
+h
+ha
+haberdasher
+habiliment
+habiliments
+habit
+habitation
+habited
+habits
+habitude
+hack
+hacket
+hackney
+hacks
+had
+hadst
+haec
+haeres
+hag
+hagar
+haggard
+haggards
+haggish
+haggled
+hags
+hail
+hailed
+hailstone
+hailstones
+hair
+hairless
+hairs
+hairy
+hal
+halberd
+halberds
+halcyon
+hale
+haled
+hales
+half
+halfcan
+halfpence
+halfpenny
+halfpennyworth
+halfway
+halidom
+hall
+halloa
+halloing
+hallond
+halloo
+hallooing
+hallow
+hallowed
+hallowmas
+hallown
+hals
+halt
+halter
+halters
+halting
+halts
+halves
+ham
+hames
+hamlet
+hammer
+hammered
+hammering
+hammers
+hamper
+hampton
+hams
+hamstring
+hand
+handed
+handful
+handicraft
+handicraftsmen
+handing
+handiwork
+handkercher
+handkerchers
+handkerchief
+handle
+handled
+handles
+handless
+handlest
+handling
+handmaid
+handmaids
+hands
+handsaw
+handsome
+handsomely
+handsomeness
+handwriting
+handy
+hang
+hanged
+hangers
+hangeth
+hanging
+hangings
+hangman
+hangmen
+hangs
+hannibal
+hap
+hapless
+haply
+happ
+happen
+happened
+happier
+happies
+happiest
+happily
+happiness
+happy
+haps
+harbinger
+harbingers
+harbor
+harbour
+harbourage
+harbouring
+harbours
+harcourt
+hard
+harder
+hardest
+hardiest
+hardiment
+hardiness
+hardly
+hardness
+hardocks
+hardy
+hare
+harelip
+hares
+harfleur
+hark
+harlot
+harlotry
+harlots
+harm
+harmed
+harmful
+harming
+harmless
+harmonious
+harmony
+harms
+harness
+harp
+harper
+harpier
+harping
+harpy
+harried
+harrow
+harrows
+harry
+harsh
+harshly
+harshness
+hart
+harts
+harum
+harvest
+has
+hast
+haste
+hasted
+hasten
+hastes
+hastily
+hasting
+hastings
+hasty
+hat
+hatch
+hatches
+hatchet
+hatching
+hatchment
+hate
+hated
+hateful
+hater
+haters
+hates
+hateth
+hatfield
+hath
+hating
+hatred
+hats
+haud
+hauf
+haught
+haughtiness
+haughty
+haunch
+haunches
+haunt
+haunted
+haunting
+haunts
+hautboy
+hautboys
+have
+haven
+havens
+haver
+having
+havings
+havior
+haviour
+havoc
+hawk
+hawking
+hawks
+hawthorn
+hawthorns
+hay
+hazard
+hazarded
+hazards
+hazel
+hazelnut
+he
+head
+headborough
+headed
+headier
+heading
+headland
+headless
+headlong
+heads
+headsman
+headstrong
+heady
+heal
+healed
+healing
+heals
+health
+healthful
+healths
+healthsome
+healthy
+heap
+heaping
+heaps
+hear
+heard
+hearer
+hearers
+hearest
+heareth
+hearing
+hearings
+heark
+hearken
+hearkens
+hears
+hearsay
+hearse
+hearsed
+hearst
+heart
+heartache
+heartbreak
+heartbreaking
+hearted
+hearten
+hearth
+hearths
+heartily
+heartiness
+heartless
+heartlings
+heartly
+hearts
+heartsick
+heartstrings
+hearty
+heat
+heated
+heath
+heathen
+heathenish
+heating
+heats
+heauties
+heav
+heave
+heaved
+heaven
+heavenly
+heavens
+heaves
+heavier
+heaviest
+heavily
+heaviness
+heaving
+heavings
+heavy
+hebona
+hebrew
+hecate
+hectic
+hector
+hectors
+hecuba
+hedg
+hedge
+hedgehog
+hedgehogs
+hedges
+heed
+heeded
+heedful
+heedfull
+heedfully
+heedless
+heel
+heels
+hefted
+hefts
+heifer
+heifers
+heigh
+height
+heighten
+heinous
+heinously
+heir
+heiress
+heirless
+heirs
+held
+helen
+helena
+helenus
+helias
+helicons
+hell
+hellespont
+hellfire
+hellish
+helm
+helmed
+helmet
+helmets
+helms
+help
+helper
+helpers
+helpful
+helping
+helpless
+helps
+helter
+hem
+heme
+hemlock
+hemm
+hemp
+hempen
+hems
+hen
+hence
+henceforth
+henceforward
+henchman
+henri
+henricus
+henry
+hens
+hent
+henton
+her
+herald
+heraldry
+heralds
+herb
+herbert
+herblets
+herbs
+herculean
+hercules
+herd
+herds
+herdsman
+herdsmen
+here
+hereabout
+hereabouts
+hereafter
+hereby
+hereditary
+hereford
+herefordshire
+herein
+hereof
+heresies
+heresy
+heretic
+heretics
+hereto
+hereupon
+heritage
+heritier
+hermes
+hermia
+hermione
+hermit
+hermitage
+hermits
+herne
+hero
+herod
+herods
+heroes
+heroic
+heroical
+herring
+herrings
+hers
+herself
+hesperides
+hesperus
+hest
+hests
+heure
+heureux
+hew
+hewgh
+hewing
+hewn
+hews
+hey
+heyday
+hibocrates
+hic
+hiccups
+hick
+hid
+hidden
+hide
+hideous
+hideously
+hideousness
+hides
+hidest
+hiding
+hie
+hied
+hiems
+hies
+hig
+high
+higher
+highest
+highly
+highmost
+highness
+hight
+highway
+highways
+hilding
+hildings
+hill
+hillo
+hilloa
+hills
+hilt
+hilts
+hily
+him
+himself
+hinc
+hinckley
+hind
+hinder
+hindered
+hinders
+hindmost
+hinds
+hing
+hinge
+hinges
+hint
+hip
+hipp
+hipparchus
+hippolyta
+hips
+hir
+hire
+hired
+hiren
+hirtius
+his
+hisperia
+hiss
+hisses
+hissing
+hist
+historical
+history
+hit
+hither
+hitherto
+hitherward
+hitherwards
+hits
+hitting
+hive
+hives
+hizzing
+ho
+hoa
+hoar
+hoard
+hoarded
+hoarding
+hoars
+hoarse
+hoary
+hob
+hobbididence
+hobby
+hobbyhorse
+hobgoblin
+hobnails
+hoc
+hod
+hodge
+hog
+hogs
+hogshead
+hogsheads
+hois
+hoise
+hoist
+hoisted
+hoists
+holborn
+hold
+holden
+holder
+holdeth
+holdfast
+holding
+holds
+hole
+holes
+holidam
+holidame
+holiday
+holidays
+holier
+holiest
+holily
+holiness
+holla
+holland
+hollander
+hollanders
+holloa
+holloaing
+hollow
+hollowly
+hollowness
+holly
+holmedon
+holofernes
+holp
+holy
+homage
+homager
+home
+homely
+homes
+homespuns
+homeward
+homewards
+homicide
+homicides
+homily
+hominem
+hommes
+homo
+honest
+honester
+honestest
+honestly
+honesty
+honey
+honeycomb
+honeying
+honeyless
+honeysuckle
+honeysuckles
+honi
+honneur
+honor
+honorable
+honorably
+honorato
+honorificabilitudinitatibus
+honors
+honour
+honourable
+honourably
+honoured
+honourest
+honourible
+honouring
+honours
+hoo
+hood
+hooded
+hoodman
+hoods
+hoodwink
+hoof
+hoofs
+hook
+hooking
+hooks
+hoop
+hoops
+hoot
+hooted
+hooting
+hoots
+hop
+hope
+hopeful
+hopeless
+hopes
+hopest
+hoping
+hopkins
+hoppedance
+hor
+horace
+horatio
+horizon
+horn
+hornbook
+horned
+horner
+horning
+hornpipes
+horns
+horologe
+horrible
+horribly
+horrid
+horrider
+horridly
+horror
+horrors
+hors
+horse
+horseback
+horsed
+horsehairs
+horseman
+horsemanship
+horsemen
+horses
+horseway
+horsing
+hortensio
+hortensius
+horum
+hose
+hospitable
+hospital
+hospitality
+host
+hostage
+hostages
+hostess
+hostile
+hostility
+hostilius
+hosts
+hot
+hotly
+hotspur
+hotter
+hottest
+hound
+hounds
+hour
+hourly
+hours
+hous
+house
+household
+householder
+householders
+households
+housekeeper
+housekeepers
+housekeeping
+houseless
+houses
+housewife
+housewifery
+housewives
+hovel
+hover
+hovered
+hovering
+hovers
+how
+howbeit
+howe
+howeer
+however
+howl
+howled
+howlet
+howling
+howls
+howsoe
+howsoever
+howsome
+hoxes
+hoy
+hoyday
+hubert
+huddled
+huddling
+hue
+hued
+hues
+hug
+huge
+hugely
+hugeness
+hugg
+hugger
+hugh
+hugs
+hujus
+hulk
+hulks
+hull
+hulling
+hullo
+hum
+human
+humane
+humanely
+humanity
+humble
+humbled
+humbleness
+humbler
+humbles
+humblest
+humbling
+humbly
+hume
+humh
+humidity
+humility
+humming
+humor
+humorous
+humors
+humour
+humourists
+humours
+humphrey
+humphry
+hums
+hundred
+hundreds
+hundredth
+hung
+hungarian
+hungary
+hunger
+hungerford
+hungerly
+hungry
+hunt
+hunted
+hunter
+hunters
+hunteth
+hunting
+huntington
+huntress
+hunts
+huntsman
+huntsmen
+hurdle
+hurl
+hurling
+hurls
+hurly
+hurlyburly
+hurricano
+hurricanoes
+hurried
+hurries
+hurry
+hurt
+hurting
+hurtled
+hurtless
+hurtling
+hurts
+husband
+husbanded
+husbandless
+husbandry
+husbands
+hush
+hushes
+husht
+husks
+huswife
+huswifes
+hutch
+hybla
+hydra
+hyen
+hymen
+hymenaeus
+hymn
+hymns
+hyperboles
+hyperbolical
+hyperion
+hypocrisy
+hypocrite
+hypocrites
+hyrcan
+hyrcania
+hyrcanian
+hyssop
+hysterica
+i
+iachimo
+iaculis
+iago
+iament
+ibat
+icarus
+ice
+iceland
+ici
+icicle
+icicles
+icy
+idea
+ideas
+idem
+iden
+ides
+idiot
+idiots
+idle
+idleness
+idles
+idly
+idol
+idolatrous
+idolatry
+ield
+if
+ifs
+ignis
+ignoble
+ignobly
+ignominious
+ignominy
+ignomy
+ignorance
+ignorant
+ii
+iii
+iiii
+il
+ilbow
+ild
+ilion
+ilium
+ill
+illegitimate
+illiterate
+illness
+illo
+ills
+illume
+illumin
+illuminate
+illumineth
+illusion
+illusions
+illustrate
+illustrated
+illustrious
+illyria
+illyrian
+ils
+im
+image
+imagery
+images
+imagin
+imaginary
+imagination
+imaginations
+imagine
+imagining
+imaginings
+imbar
+imbecility
+imbrue
+imitari
+imitate
+imitated
+imitation
+imitations
+immaculate
+immanity
+immask
+immaterial
+immediacy
+immediate
+immediately
+imminence
+imminent
+immoderate
+immoderately
+immodest
+immoment
+immortal
+immortaliz
+immortally
+immur
+immured
+immures
+imogen
+imp
+impaint
+impair
+impairing
+impale
+impaled
+impanelled
+impart
+imparted
+impartial
+impartment
+imparts
+impasted
+impatience
+impatient
+impatiently
+impawn
+impeach
+impeached
+impeachment
+impeachments
+impedes
+impediment
+impediments
+impenetrable
+imperator
+imperceiverant
+imperfect
+imperfection
+imperfections
+imperfectly
+imperial
+imperious
+imperiously
+impertinency
+impertinent
+impeticos
+impetuosity
+impetuous
+impieties
+impiety
+impious
+implacable
+implements
+implies
+implor
+implorators
+implore
+implored
+imploring
+impon
+import
+importance
+importancy
+important
+importantly
+imported
+importeth
+importing
+importless
+imports
+importun
+importunacy
+importunate
+importune
+importunes
+importunity
+impos
+impose
+imposed
+imposition
+impositions
+impossibilities
+impossibility
+impossible
+imposthume
+impostor
+impostors
+impotence
+impotent
+impounded
+impregnable
+imprese
+impress
+impressed
+impressest
+impression
+impressure
+imprimendum
+imprimis
+imprint
+imprinted
+imprison
+imprisoned
+imprisoning
+imprisonment
+improbable
+improper
+improve
+improvident
+impudence
+impudency
+impudent
+impudently
+impudique
+impugn
+impugns
+impure
+imputation
+impute
+in
+inaccessible
+inaidable
+inaudible
+inauspicious
+incaged
+incantations
+incapable
+incardinate
+incarnadine
+incarnate
+incarnation
+incens
+incense
+incensed
+incensement
+incenses
+incensing
+incertain
+incertainties
+incertainty
+incessant
+incessantly
+incest
+incestuous
+inch
+incharitable
+inches
+incidency
+incident
+incision
+incite
+incites
+incivil
+incivility
+inclin
+inclinable
+inclination
+incline
+inclined
+inclines
+inclining
+inclips
+include
+included
+includes
+inclusive
+incomparable
+incomprehensible
+inconsiderate
+inconstancy
+inconstant
+incontinency
+incontinent
+incontinently
+inconvenience
+inconveniences
+inconvenient
+incony
+incorporate
+incorps
+incorrect
+increas
+increase
+increases
+increaseth
+increasing
+incredible
+incredulous
+incur
+incurable
+incurr
+incurred
+incursions
+ind
+inde
+indebted
+indeed
+indent
+indented
+indenture
+indentures
+index
+indexes
+india
+indian
+indict
+indicted
+indictment
+indies
+indifferency
+indifferent
+indifferently
+indigent
+indigest
+indigested
+indign
+indignation
+indignations
+indigne
+indignities
+indignity
+indirect
+indirection
+indirections
+indirectly
+indiscreet
+indiscretion
+indispos
+indisposition
+indissoluble
+indistinct
+indistinguish
+indistinguishable
+indited
+individable
+indrench
+indu
+indubitate
+induc
+induce
+induced
+inducement
+induction
+inductions
+indue
+indued
+indues
+indulgence
+indulgences
+indulgent
+indurance
+industrious
+industriously
+industry
+inequality
+inestimable
+inevitable
+inexecrable
+inexorable
+inexplicable
+infallible
+infallibly
+infamonize
+infamous
+infamy
+infancy
+infant
+infants
+infect
+infected
+infecting
+infection
+infections
+infectious
+infectiously
+infects
+infer
+inference
+inferior
+inferiors
+infernal
+inferr
+inferreth
+inferring
+infest
+infidel
+infidels
+infinite
+infinitely
+infinitive
+infirm
+infirmities
+infirmity
+infixed
+infixing
+inflam
+inflame
+inflaming
+inflammation
+inflict
+infliction
+influence
+influences
+infold
+inform
+informal
+information
+informations
+informed
+informer
+informs
+infortunate
+infring
+infringe
+infringed
+infus
+infuse
+infused
+infusing
+infusion
+ingener
+ingenious
+ingeniously
+inglorious
+ingots
+ingraffed
+ingraft
+ingrate
+ingrated
+ingrateful
+ingratitude
+ingratitudes
+ingredient
+ingredients
+ingross
+inhabit
+inhabitable
+inhabitants
+inhabited
+inhabits
+inhearse
+inhearsed
+inherent
+inherit
+inheritance
+inherited
+inheriting
+inheritor
+inheritors
+inheritrix
+inherits
+inhibited
+inhibition
+inhoop
+inhuman
+iniquities
+iniquity
+initiate
+injointed
+injunction
+injunctions
+injur
+injure
+injurer
+injuries
+injurious
+injury
+injustice
+ink
+inkhorn
+inkle
+inkles
+inkling
+inky
+inlaid
+inland
+inlay
+inly
+inmost
+inn
+inner
+innkeeper
+innocence
+innocency
+innocent
+innocents
+innovation
+innovator
+inns
+innumerable
+inoculate
+inordinate
+inprimis
+inquir
+inquire
+inquiry
+inquisition
+inquisitive
+inroads
+insane
+insanie
+insatiate
+insconce
+inscrib
+inscription
+inscriptions
+inscroll
+inscrutable
+insculp
+insculpture
+insensible
+inseparable
+inseparate
+insert
+inserted
+inset
+inshell
+inshipp
+inside
+insinewed
+insinuate
+insinuateth
+insinuating
+insinuation
+insisted
+insisting
+insisture
+insociable
+insolence
+insolent
+insomuch
+inspir
+inspiration
+inspirations
+inspire
+inspired
+install
+installed
+instalment
+instance
+instances
+instant
+instantly
+instate
+instead
+insteeped
+instigate
+instigated
+instigation
+instigations
+instigator
+instinct
+instinctively
+institute
+institutions
+instruct
+instructed
+instruction
+instructions
+instructs
+instrument
+instrumental
+instruments
+insubstantial
+insufficience
+insufficiency
+insult
+insulted
+insulting
+insultment
+insults
+insupportable
+insuppressive
+insurrection
+insurrections
+int
+integer
+integritas
+integrity
+intellect
+intellects
+intellectual
+intelligence
+intelligencer
+intelligencing
+intelligent
+intelligis
+intelligo
+intemperance
+intemperate
+intend
+intended
+intendeth
+intending
+intendment
+intends
+intenible
+intent
+intention
+intentively
+intents
+inter
+intercept
+intercepted
+intercepter
+interception
+intercepts
+intercession
+intercessors
+interchained
+interchang
+interchange
+interchangeably
+interchangement
+interchanging
+interdiction
+interest
+interim
+interims
+interior
+interjections
+interjoin
+interlude
+intermingle
+intermission
+intermissive
+intermit
+intermix
+intermixed
+interpose
+interposer
+interposes
+interpret
+interpretation
+interpreted
+interpreter
+interpreters
+interprets
+interr
+interred
+interrogatories
+interrupt
+interrupted
+interrupter
+interruptest
+interruption
+interrupts
+intertissued
+intervallums
+interview
+intestate
+intestine
+intil
+intimate
+intimation
+intitled
+intituled
+into
+intolerable
+intoxicates
+intreasured
+intreat
+intrench
+intrenchant
+intricate
+intrinse
+intrinsicate
+intrude
+intruder
+intruding
+intrusion
+inundation
+inure
+inurn
+invade
+invades
+invasion
+invasive
+invectively
+invectives
+inveigled
+invent
+invented
+invention
+inventions
+inventor
+inventorially
+inventoried
+inventors
+inventory
+inverness
+invert
+invest
+invested
+investing
+investments
+inveterate
+invincible
+inviolable
+invised
+invisible
+invitation
+invite
+invited
+invites
+inviting
+invitis
+invocate
+invocation
+invoke
+invoked
+invulnerable
+inward
+inwardly
+inwardness
+inwards
+ionia
+ionian
+ipse
+ipswich
+ira
+irae
+iras
+ire
+ireful
+ireland
+iris
+irish
+irishman
+irishmen
+irks
+irksome
+iron
+irons
+irreconcil
+irrecoverable
+irregular
+irregulous
+irreligious
+irremovable
+irreparable
+irresolute
+irrevocable
+is
+isabel
+isabella
+isbel
+isbels
+iscariot
+ise
+ish
+isidore
+isis
+island
+islander
+islanders
+islands
+isle
+isles
+israel
+issu
+issue
+issued
+issueless
+issues
+issuing
+ist
+ista
+it
+italian
+italy
+itch
+itches
+itching
+item
+items
+iteration
+ithaca
+its
+itself
+itshall
+iv
+ivory
+ivy
+iwis
+ix
+j
+jacet
+jack
+jackanapes
+jacks
+jacksauce
+jackslave
+jacob
+jade
+jaded
+jades
+jail
+jakes
+jamany
+james
+jamy
+jane
+jangled
+jangling
+january
+janus
+japhet
+jaquenetta
+jaques
+jar
+jarring
+jars
+jarteer
+jasons
+jaunce
+jauncing
+jaundice
+jaundies
+jaw
+jawbone
+jaws
+jay
+jays
+jc
+je
+jealous
+jealousies
+jealousy
+jeer
+jeering
+jelly
+jenny
+jeopardy
+jephtha
+jephthah
+jerkin
+jerkins
+jerks
+jeronimy
+jerusalem
+jeshu
+jesses
+jessica
+jest
+jested
+jester
+jesters
+jesting
+jests
+jesu
+jesus
+jet
+jets
+jew
+jewel
+jeweller
+jewels
+jewess
+jewish
+jewry
+jews
+jezebel
+jig
+jigging
+jill
+jills
+jingling
+joan
+job
+jockey
+jocund
+jog
+jogging
+john
+johns
+join
+joinder
+joined
+joiner
+joineth
+joins
+joint
+jointed
+jointing
+jointly
+jointress
+joints
+jointure
+jollity
+jolly
+jolt
+joltheads
+jordan
+joseph
+joshua
+jot
+jour
+jourdain
+journal
+journey
+journeying
+journeyman
+journeymen
+journeys
+jove
+jovem
+jovial
+jowl
+jowls
+joy
+joyed
+joyful
+joyfully
+joyless
+joyous
+joys
+juan
+jud
+judas
+judases
+jude
+judg
+judge
+judged
+judgement
+judges
+judgest
+judging
+judgment
+judgments
+judicious
+jug
+juggle
+juggled
+juggler
+jugglers
+juggling
+jugs
+juice
+juiced
+jul
+jule
+julia
+juliet
+julietta
+julio
+julius
+july
+jump
+jumpeth
+jumping
+jumps
+june
+junes
+junior
+junius
+junkets
+juno
+jupiter
+jure
+jurement
+jurisdiction
+juror
+jurors
+jury
+jurymen
+just
+justeius
+justest
+justice
+justicer
+justicers
+justices
+justification
+justified
+justify
+justle
+justled
+justles
+justling
+justly
+justness
+justs
+jutting
+jutty
+juvenal
+kam
+kate
+kated
+kates
+katharine
+katherina
+katherine
+kecksies
+keech
+keel
+keels
+keen
+keenness
+keep
+keepdown
+keeper
+keepers
+keepest
+keeping
+keeps
+keiser
+ken
+kendal
+kennel
+kent
+kentish
+kentishman
+kentishmen
+kept
+kerchief
+kerely
+kern
+kernal
+kernel
+kernels
+kerns
+kersey
+kettle
+kettledrum
+kettledrums
+key
+keys
+kibe
+kibes
+kick
+kicked
+kickshaws
+kickshawses
+kicky
+kid
+kidney
+kikely
+kildare
+kill
+killed
+killer
+killeth
+killing
+killingworth
+kills
+kiln
+kimbolton
+kin
+kind
+kinder
+kindest
+kindle
+kindled
+kindless
+kindlier
+kindling
+kindly
+kindness
+kindnesses
+kindred
+kindreds
+kinds
+kine
+king
+kingdom
+kingdoms
+kingly
+kings
+kinred
+kins
+kinsman
+kinsmen
+kinswoman
+kirtle
+kirtles
+kiss
+kissed
+kisses
+kissing
+kitchen
+kitchens
+kite
+kites
+kitten
+kj
+kl
+klll
+knack
+knacks
+knapp
+knav
+knave
+knaveries
+knavery
+knaves
+knavish
+knead
+kneaded
+kneading
+knee
+kneel
+kneeling
+kneels
+knees
+knell
+knew
+knewest
+knife
+knight
+knighted
+knighthood
+knighthoods
+knightly
+knights
+knit
+knits
+knitters
+knitteth
+knives
+knobs
+knock
+knocking
+knocks
+knog
+knoll
+knot
+knots
+knotted
+knotty
+know
+knower
+knowest
+knowing
+knowingly
+knowings
+knowledge
+known
+knows
+l
+la
+laban
+label
+labell
+labienus
+labio
+labor
+laboring
+labors
+labour
+laboured
+labourer
+labourers
+labouring
+labours
+laboursome
+labras
+labyrinth
+lac
+lace
+laced
+lacedaemon
+laces
+lacies
+lack
+lackbeard
+lacked
+lackey
+lackeying
+lackeys
+lacking
+lacks
+lad
+ladder
+ladders
+lade
+laden
+ladies
+lading
+lads
+lady
+ladybird
+ladyship
+ladyships
+laer
+laertes
+lafeu
+lag
+lagging
+laid
+lain
+laissez
+lake
+lakes
+lakin
+lam
+lamb
+lambert
+lambkin
+lambkins
+lambs
+lame
+lamely
+lameness
+lament
+lamentable
+lamentably
+lamentation
+lamentations
+lamented
+lamenting
+lamentings
+laments
+lames
+laming
+lammas
+lammastide
+lamound
+lamp
+lampass
+lamps
+lanc
+lancaster
+lance
+lances
+lanceth
+lanch
+land
+landed
+landing
+landless
+landlord
+landmen
+lands
+lane
+lanes
+langage
+langley
+langton
+language
+languageless
+languages
+langues
+languish
+languished
+languishes
+languishing
+languishings
+languishment
+languor
+lank
+lantern
+lanterns
+lanthorn
+lap
+lapis
+lapland
+lapp
+laps
+lapse
+lapsed
+lapsing
+lapwing
+laquais
+larded
+larder
+larding
+lards
+large
+largely
+largeness
+larger
+largess
+largest
+lark
+larks
+larron
+lartius
+larum
+larums
+las
+lascivious
+lash
+lass
+lasses
+last
+lasted
+lasting
+lastly
+lasts
+latch
+latches
+late
+lated
+lately
+later
+latest
+lath
+latin
+latten
+latter
+lattice
+laud
+laudable
+laudis
+laugh
+laughable
+laughed
+laugher
+laughest
+laughing
+laughs
+laughter
+launce
+launcelot
+launces
+launch
+laund
+laundress
+laundry
+laur
+laura
+laurel
+laurels
+laurence
+laus
+lavache
+lave
+lavee
+lavender
+lavina
+lavinia
+lavish
+lavishly
+lavolt
+lavoltas
+law
+lawful
+lawfully
+lawless
+lawlessly
+lawn
+lawns
+lawrence
+laws
+lawyer
+lawyers
+lay
+layer
+layest
+laying
+lays
+lazar
+lazars
+lazarus
+lazy
+lc
+ld
+ldst
+le
+lead
+leaden
+leader
+leaders
+leadest
+leading
+leads
+leaf
+leagu
+league
+leagued
+leaguer
+leagues
+leah
+leak
+leaky
+lean
+leander
+leaner
+leaning
+leanness
+leans
+leap
+leaped
+leaping
+leaps
+leapt
+lear
+learn
+learned
+learnedly
+learning
+learnings
+learns
+learnt
+leas
+lease
+leases
+leash
+leasing
+least
+leather
+leathern
+leav
+leave
+leaven
+leavening
+leaver
+leaves
+leaving
+leavy
+lecher
+lecherous
+lechers
+lechery
+lecon
+lecture
+lectures
+led
+leda
+leech
+leeches
+leek
+leeks
+leer
+leers
+lees
+leese
+leet
+leets
+left
+leg
+legacies
+legacy
+legate
+legatine
+lege
+legerity
+leges
+legg
+legion
+legions
+legitimate
+legitimation
+legs
+leicester
+leicestershire
+leiger
+leigers
+leisure
+leisurely
+leisures
+leman
+lemon
+lena
+lend
+lender
+lending
+lendings
+lends
+length
+lengthen
+lengthens
+lengths
+lenity
+lennox
+lent
+lenten
+lentus
+leo
+leon
+leonardo
+leonati
+leonato
+leonatus
+leontes
+leopard
+leopards
+leper
+leperous
+lepidus
+leprosy
+lequel
+lers
+les
+less
+lessen
+lessens
+lesser
+lesson
+lessoned
+lessons
+lest
+lestrake
+let
+lethargied
+lethargies
+lethargy
+lethe
+lets
+lett
+letter
+letters
+letting
+lettuce
+leur
+leve
+level
+levell
+levelled
+levels
+leven
+levers
+leviathan
+leviathans
+levied
+levies
+levity
+levy
+levying
+lewd
+lewdly
+lewdness
+lewdsters
+lewis
+liable
+liar
+liars
+libbard
+libelling
+libels
+liberal
+liberality
+liberte
+liberties
+libertine
+libertines
+liberty
+library
+libya
+licence
+licens
+license
+licentious
+lichas
+licio
+lick
+licked
+licker
+lictors
+lid
+lids
+lie
+lied
+lief
+liefest
+liege
+liegeman
+liegemen
+lien
+lies
+liest
+lieth
+lieu
+lieutenant
+lieutenantry
+lieutenants
+lieve
+life
+lifeblood
+lifeless
+lifelings
+lift
+lifted
+lifter
+lifteth
+lifting
+lifts
+lig
+ligarius
+liggens
+light
+lighted
+lighten
+lightens
+lighter
+lightest
+lightly
+lightness
+lightning
+lightnings
+lights
+lik
+like
+liked
+likeliest
+likelihood
+likelihoods
+likely
+likeness
+liker
+likes
+likest
+likewise
+liking
+likings
+lilies
+lily
+lim
+limander
+limb
+limbeck
+limbecks
+limber
+limbo
+limbs
+lime
+limed
+limehouse
+limekilns
+limit
+limitation
+limited
+limits
+limn
+limp
+limping
+limps
+lin
+lincoln
+lincolnshire
+line
+lineal
+lineally
+lineament
+lineaments
+lined
+linen
+linens
+lines
+ling
+lingare
+linger
+lingered
+lingers
+linguist
+lining
+link
+links
+linsey
+linstock
+linta
+lion
+lionel
+lioness
+lions
+lip
+lipp
+lips
+lipsbury
+liquid
+liquor
+liquorish
+liquors
+lirra
+lisbon
+lisp
+lisping
+list
+listen
+listening
+lists
+literatured
+lither
+litter
+little
+littlest
+liv
+live
+lived
+livelier
+livelihood
+livelong
+lively
+liver
+liveries
+livers
+livery
+lives
+livest
+liveth
+livia
+living
+livings
+lizard
+lizards
+ll
+lll
+llous
+lnd
+lo
+loa
+loach
+load
+loaden
+loading
+loads
+loaf
+loam
+loan
+loath
+loathe
+loathed
+loather
+loathes
+loathing
+loathly
+loathness
+loathsome
+loathsomeness
+loathsomest
+loaves
+lob
+lobbies
+lobby
+local
+lochaber
+lock
+locked
+locking
+lockram
+locks
+locusts
+lode
+lodg
+lodge
+lodged
+lodgers
+lodges
+lodging
+lodgings
+lodovico
+lodowick
+lofty
+log
+logger
+loggerhead
+loggerheads
+loggets
+logic
+logs
+loins
+loiter
+loiterer
+loiterers
+loitering
+lolling
+lolls
+lombardy
+london
+londoners
+lone
+loneliness
+lonely
+long
+longaville
+longboat
+longed
+longer
+longest
+longeth
+longing
+longings
+longly
+longs
+longtail
+loo
+loof
+look
+looked
+looker
+lookers
+lookest
+looking
+looks
+loon
+loop
+loos
+loose
+loosed
+loosely
+loosen
+loosing
+lop
+lopp
+loquitur
+lord
+lorded
+lording
+lordings
+lordliness
+lordly
+lords
+lordship
+lordships
+lorenzo
+lorn
+lorraine
+lorship
+los
+lose
+loser
+losers
+loses
+losest
+loseth
+losing
+loss
+losses
+lost
+lot
+lots
+lott
+lottery
+loud
+louder
+loudly
+lour
+loureth
+louring
+louse
+louses
+lousy
+lout
+louted
+louts
+louvre
+lov
+love
+loved
+lovedst
+lovel
+lovelier
+loveliness
+lovell
+lovely
+lover
+lovered
+lovers
+loves
+lovest
+loveth
+loving
+lovingly
+low
+lowe
+lower
+lowest
+lowing
+lowliness
+lowly
+lown
+lowness
+loyal
+loyally
+loyalties
+loyalty
+lozel
+lt
+lubber
+lubberly
+luc
+luccicos
+luce
+lucentio
+luces
+lucetta
+luciana
+lucianus
+lucifer
+lucifier
+lucilius
+lucina
+lucio
+lucius
+luck
+luckier
+luckiest
+luckily
+luckless
+lucky
+lucre
+lucrece
+lucretia
+lucullius
+lucullus
+lucy
+lud
+ludlow
+lug
+lugg
+luggage
+luke
+lukewarm
+lull
+lulla
+lullaby
+lulls
+lumbert
+lump
+lumpish
+luna
+lunacies
+lunacy
+lunatic
+lunatics
+lunes
+lungs
+lupercal
+lurch
+lure
+lurk
+lurketh
+lurking
+lurks
+luscious
+lush
+lust
+lusted
+luster
+lustful
+lustier
+lustiest
+lustig
+lustihood
+lustily
+lustre
+lustrous
+lusts
+lusty
+lute
+lutes
+lutestring
+lutheran
+luxurious
+luxuriously
+luxury
+ly
+lycaonia
+lycurguses
+lydia
+lye
+lyen
+lying
+lym
+lymoges
+lynn
+lysander
+m
+ma
+maan
+mab
+macbeth
+maccabaeus
+macdonwald
+macduff
+mace
+macedon
+maces
+machiavel
+machination
+machinations
+machine
+mack
+macmorris
+maculate
+maculation
+mad
+madam
+madame
+madams
+madcap
+madded
+madding
+made
+madeira
+madly
+madman
+madmen
+madness
+madonna
+madrigals
+mads
+maecenas
+maggot
+maggots
+magic
+magical
+magician
+magistrate
+magistrates
+magnanimity
+magnanimous
+magni
+magnifi
+magnificence
+magnificent
+magnifico
+magnificoes
+magnus
+mahomet
+mahu
+maid
+maiden
+maidenhead
+maidenheads
+maidenhood
+maidenhoods
+maidenliest
+maidenly
+maidens
+maidhood
+maids
+mail
+mailed
+mails
+maim
+maimed
+maims
+main
+maincourse
+maine
+mainly
+mainmast
+mains
+maintain
+maintained
+maintains
+maintenance
+mais
+maison
+majestas
+majestee
+majestic
+majestical
+majestically
+majesties
+majesty
+major
+majority
+mak
+make
+makeless
+maker
+makers
+makes
+makest
+maketh
+making
+makings
+mal
+mala
+maladies
+malady
+malapert
+malcolm
+malcontent
+malcontents
+male
+maledictions
+malefactions
+malefactor
+malefactors
+males
+malevolence
+malevolent
+malhecho
+malice
+malicious
+maliciously
+malign
+malignancy
+malignant
+malignantly
+malkin
+mall
+mallard
+mallet
+mallows
+malmsey
+malt
+maltworms
+malvolio
+mamillius
+mammering
+mammet
+mammets
+mammock
+man
+manacle
+manacles
+manage
+managed
+manager
+managing
+manakin
+manchus
+mandate
+mandragora
+mandrake
+mandrakes
+mane
+manent
+manes
+manet
+manfully
+mangle
+mangled
+mangles
+mangling
+mangy
+manhood
+manhoods
+manifest
+manifested
+manifests
+manifold
+manifoldly
+manka
+mankind
+manlike
+manly
+mann
+manna
+manner
+mannerly
+manners
+manningtree
+mannish
+manor
+manors
+mans
+mansion
+mansionry
+mansions
+manslaughter
+mantle
+mantled
+mantles
+mantua
+mantuan
+manual
+manure
+manured
+manus
+many
+map
+mapp
+maps
+mar
+marble
+marbled
+marcade
+marcellus
+march
+marches
+marcheth
+marching
+marchioness
+marchpane
+marcians
+marcius
+marcus
+mardian
+mare
+mares
+marg
+margarelon
+margaret
+marge
+margent
+margery
+maria
+marian
+mariana
+maries
+marigold
+mariner
+mariners
+maritime
+marjoram
+mark
+marked
+market
+marketable
+marketplace
+markets
+marking
+markman
+marks
+marl
+marle
+marmoset
+marquess
+marquis
+marr
+marriage
+marriages
+married
+marries
+marring
+marrow
+marrowless
+marrows
+marry
+marrying
+mars
+marseilles
+marsh
+marshal
+marshalsea
+marshalship
+mart
+marted
+martem
+martext
+martial
+martin
+martino
+martius
+martlemas
+martlet
+marts
+martyr
+martyrs
+marullus
+marv
+marvel
+marvell
+marvellous
+marvellously
+marvels
+mary
+mas
+masculine
+masham
+mask
+masked
+masker
+maskers
+masking
+masks
+mason
+masonry
+masons
+masque
+masquers
+masques
+masquing
+mass
+massacre
+massacres
+masses
+massy
+mast
+mastcr
+master
+masterdom
+masterest
+masterless
+masterly
+masterpiece
+masters
+mastership
+mastic
+mastiff
+mastiffs
+masts
+match
+matches
+matcheth
+matching
+matchless
+mate
+mated
+mater
+material
+mates
+mathematics
+matin
+matron
+matrons
+matter
+matters
+matthew
+mattock
+mattress
+mature
+maturity
+maud
+maudlin
+maugre
+maul
+maund
+mauri
+mauritania
+mauvais
+maw
+maws
+maxim
+may
+mayday
+mayest
+mayor
+maypole
+mayst
+maz
+maze
+mazed
+mazes
+mazzard
+me
+meacock
+mead
+meadow
+meadows
+meads
+meagre
+meal
+meals
+mealy
+mean
+meanders
+meaner
+meanest
+meaneth
+meaning
+meanings
+meanly
+means
+meant
+meantime
+meanwhile
+measles
+measur
+measurable
+measure
+measured
+measureless
+measures
+measuring
+meat
+meats
+mechanic
+mechanical
+mechanicals
+mechanics
+mechante
+med
+medal
+meddle
+meddler
+meddling
+mede
+medea
+media
+mediation
+mediators
+medice
+medicinal
+medicine
+medicines
+meditate
+meditates
+meditating
+meditation
+meditations
+mediterranean
+mediterraneum
+medlar
+medlars
+meed
+meeds
+meek
+meekly
+meekness
+meet
+meeter
+meetest
+meeting
+meetings
+meetly
+meetness
+meets
+meg
+mehercle
+meilleur
+meiny
+meisen
+melancholies
+melancholy
+melford
+mell
+mellifluous
+mellow
+mellowing
+melodious
+melody
+melt
+melted
+melteth
+melting
+melts
+melun
+member
+members
+memento
+memorable
+memorandums
+memorial
+memorials
+memories
+memoriz
+memorize
+memory
+memphis
+men
+menac
+menace
+menaces
+menaphon
+menas
+mend
+mended
+mender
+mending
+mends
+menecrates
+menelaus
+menenius
+mental
+menteith
+mention
+mentis
+menton
+mephostophilus
+mer
+mercatante
+mercatio
+mercenaries
+mercenary
+mercer
+merchandise
+merchandized
+merchant
+merchants
+mercies
+merciful
+mercifully
+merciless
+mercurial
+mercuries
+mercury
+mercutio
+mercy
+mere
+mered
+merely
+merest
+meridian
+merit
+merited
+meritorious
+merits
+merlin
+mermaid
+mermaids
+merops
+merrier
+merriest
+merrily
+merriman
+merriment
+merriments
+merriness
+merry
+mervailous
+mes
+mesh
+meshes
+mesopotamia
+mess
+message
+messages
+messala
+messaline
+messenger
+messengers
+messes
+messina
+met
+metal
+metals
+metamorphis
+metamorphoses
+metaphor
+metaphysical
+metaphysics
+mete
+metellus
+meteor
+meteors
+meteyard
+metheglin
+metheglins
+methink
+methinks
+method
+methods
+methought
+methoughts
+metre
+metres
+metropolis
+mette
+mettle
+mettled
+meus
+mew
+mewed
+mewling
+mexico
+mi
+mice
+michael
+michaelmas
+micher
+miching
+mickle
+microcosm
+mid
+midas
+middest
+middle
+middleham
+midnight
+midriff
+midst
+midsummer
+midway
+midwife
+midwives
+mienne
+might
+mightful
+mightier
+mightiest
+mightily
+mightiness
+mightst
+mighty
+milan
+milch
+mild
+milder
+mildest
+mildew
+mildews
+mildly
+mildness
+mile
+miles
+milford
+militarist
+military
+milk
+milking
+milkmaid
+milks
+milksops
+milky
+mill
+mille
+miller
+milliner
+million
+millioned
+millions
+mills
+millstones
+milo
+mimic
+minc
+mince
+minces
+mincing
+mind
+minded
+minding
+mindless
+minds
+mine
+mineral
+minerals
+minerva
+mines
+mingle
+mingled
+mingling
+minikin
+minim
+minime
+minimo
+minimus
+mining
+minion
+minions
+minist
+minister
+ministers
+ministration
+minnow
+minnows
+minola
+minority
+minos
+minotaurs
+minstrel
+minstrels
+minstrelsy
+mint
+mints
+minute
+minutely
+minutes
+minx
+mio
+mir
+mirable
+miracle
+miracles
+miraculous
+miranda
+mire
+mirror
+mirrors
+mirth
+mirthful
+miry
+mis
+misadventur
+misadventure
+misanthropos
+misapplied
+misbecame
+misbecom
+misbecome
+misbegot
+misbegotten
+misbeliever
+misbelieving
+misbhav
+miscall
+miscalled
+miscarried
+miscarries
+miscarry
+miscarrying
+mischance
+mischances
+mischief
+mischiefs
+mischievous
+misconceived
+misconst
+misconster
+misconstruction
+misconstrued
+misconstrues
+miscreant
+miscreate
+misdeed
+misdeeds
+misdemean
+misdemeanours
+misdoubt
+misdoubteth
+misdoubts
+misenum
+miser
+miserable
+miserably
+misericorde
+miseries
+misers
+misery
+misfortune
+misfortunes
+misgive
+misgives
+misgiving
+misgoverned
+misgovernment
+misgraffed
+misguide
+mishap
+mishaps
+misheard
+misinterpret
+mislead
+misleader
+misleaders
+misleading
+misled
+mislike
+misord
+misplac
+misplaced
+misplaces
+mispris
+misprised
+misprision
+misprizing
+misproud
+misquote
+misreport
+miss
+missed
+misses
+misshap
+misshapen
+missheathed
+missing
+missingly
+missions
+missive
+missives
+misspoke
+mist
+mista
+mistak
+mistake
+mistaken
+mistakes
+mistaketh
+mistaking
+mistakings
+mistemp
+mistempered
+misterm
+mistful
+misthink
+misthought
+mistletoe
+mistook
+mistreadings
+mistress
+mistresses
+mistresss
+mistriship
+mistrust
+mistrusted
+mistrustful
+mistrusting
+mists
+misty
+misus
+misuse
+misused
+misuses
+mites
+mithridates
+mitigate
+mitigation
+mix
+mixed
+mixture
+mixtures
+mm
+mnd
+moan
+moans
+moat
+moated
+mobled
+mock
+mockable
+mocker
+mockeries
+mockers
+mockery
+mocking
+mocks
+mockvater
+mockwater
+model
+modena
+moderate
+moderately
+moderation
+modern
+modest
+modesties
+modestly
+modesty
+modicums
+modo
+module
+moe
+moi
+moiety
+moist
+moisten
+moisture
+moldwarp
+mole
+molehill
+moles
+molest
+molestation
+mollification
+mollis
+molten
+molto
+mome
+moment
+momentary
+moming
+mon
+monachum
+monarch
+monarchies
+monarchize
+monarcho
+monarchs
+monarchy
+monast
+monastery
+monastic
+monday
+monde
+money
+moneys
+mong
+monger
+mongers
+monging
+mongrel
+mongrels
+mongst
+monk
+monkey
+monkeys
+monks
+monmouth
+monopoly
+mons
+monsieur
+monsieurs
+monster
+monsters
+monstrous
+monstrously
+monstrousness
+monstruosity
+montacute
+montage
+montague
+montagues
+montano
+montant
+montez
+montferrat
+montgomery
+month
+monthly
+months
+montjoy
+monument
+monumental
+monuments
+mood
+moods
+moody
+moon
+moonbeams
+moonish
+moonlight
+moons
+moonshine
+moonshines
+moor
+moorfields
+moors
+moorship
+mop
+mope
+moping
+mopping
+mopsa
+moral
+moraler
+morality
+moralize
+mordake
+more
+moreover
+mores
+morgan
+mori
+morisco
+morn
+morning
+mornings
+morocco
+morris
+morrow
+morrows
+morsel
+morsels
+mort
+mortal
+mortality
+mortally
+mortals
+mortar
+mortgaged
+mortified
+mortifying
+mortimer
+mortimers
+mortis
+mortise
+morton
+mose
+moss
+mossgrown
+most
+mote
+moth
+mother
+mothers
+moths
+motion
+motionless
+motions
+motive
+motives
+motley
+mots
+mought
+mould
+moulded
+mouldeth
+moulds
+mouldy
+moult
+moulten
+mounch
+mounseur
+mounsieur
+mount
+mountain
+mountaineer
+mountaineers
+mountainous
+mountains
+mountant
+mountanto
+mountebank
+mountebanks
+mounted
+mounteth
+mounting
+mounts
+mourn
+mourned
+mourner
+mourners
+mournful
+mournfully
+mourning
+mourningly
+mournings
+mourns
+mous
+mouse
+mousetrap
+mousing
+mouth
+mouthed
+mouths
+mov
+movables
+move
+moveable
+moveables
+moved
+mover
+movers
+moves
+moveth
+moving
+movingly
+movousus
+mow
+mowbray
+mower
+mowing
+mows
+moy
+moys
+moyses
+mrs
+much
+muck
+mud
+mudded
+muddied
+muddy
+muffins
+muffl
+muffle
+muffled
+muffler
+muffling
+mugger
+mugs
+mulberries
+mulberry
+mule
+mules
+muleteers
+mulier
+mulieres
+muliteus
+mull
+mulmutius
+multiplied
+multiply
+multiplying
+multipotent
+multitude
+multitudes
+multitudinous
+mum
+mumble
+mumbling
+mummers
+mummy
+mun
+munch
+muniments
+munition
+murd
+murder
+murdered
+murderer
+murderers
+murdering
+murderous
+murders
+mure
+murk
+murkiest
+murky
+murmur
+murmurers
+murmuring
+murrain
+murray
+murrion
+murther
+murtherer
+murtherers
+murthering
+murtherous
+murthers
+mus
+muscadel
+muscovites
+muscovits
+muscovy
+muse
+muses
+mush
+mushrooms
+music
+musical
+musician
+musicians
+musics
+musing
+musings
+musk
+musket
+muskets
+muskos
+muss
+mussel
+mussels
+must
+mustachio
+mustard
+mustardseed
+muster
+mustering
+musters
+musty
+mutability
+mutable
+mutation
+mutations
+mute
+mutes
+mutest
+mutine
+mutineer
+mutineers
+mutines
+mutinies
+mutinous
+mutiny
+mutius
+mutter
+muttered
+mutton
+muttons
+mutual
+mutualities
+mutually
+muzzl
+muzzle
+muzzled
+mv
+mww
+my
+mynheers
+myrmidon
+myrmidons
+myrtle
+myself
+myst
+mysteries
+mystery
+n
+nag
+nage
+nags
+naiads
+nail
+nails
+nak
+naked
+nakedness
+nal
+nam
+name
+named
+nameless
+namely
+names
+namest
+naming
+nan
+nance
+nap
+nape
+napes
+napkin
+napkins
+naples
+napless
+napping
+naps
+narbon
+narcissus
+narines
+narrow
+narrowly
+naso
+nasty
+nathaniel
+natifs
+nation
+nations
+native
+nativity
+natur
+natural
+naturalize
+naturally
+nature
+natured
+natures
+natus
+naught
+naughtily
+naughty
+navarre
+nave
+navel
+navigation
+navy
+nay
+nayward
+nayword
+nazarite
+ne
+neaf
+neamnoins
+neanmoins
+neapolitan
+neapolitans
+near
+nearer
+nearest
+nearly
+nearness
+neat
+neatly
+neb
+nebour
+nebuchadnezzar
+nec
+necessaries
+necessarily
+necessary
+necessitied
+necessities
+necessity
+neck
+necklace
+necks
+nectar
+ned
+nedar
+need
+needed
+needer
+needful
+needfull
+needing
+needle
+needles
+needless
+needly
+needs
+needy
+neer
+neeze
+nefas
+negation
+negative
+negatives
+neglect
+neglected
+neglecting
+neglectingly
+neglection
+negligence
+negligent
+negotiate
+negotiations
+negro
+neigh
+neighbors
+neighbour
+neighbourhood
+neighbouring
+neighbourly
+neighbours
+neighing
+neighs
+neither
+nell
+nemean
+nemesis
+neoptolemus
+nephew
+nephews
+neptune
+ner
+nereides
+nerissa
+nero
+neroes
+ners
+nerve
+nerves
+nervii
+nervy
+nessus
+nest
+nestor
+nests
+net
+nether
+netherlands
+nets
+nettle
+nettled
+nettles
+neuter
+neutral
+nev
+never
+nevil
+nevils
+new
+newborn
+newer
+newest
+newgate
+newly
+newness
+news
+newsmongers
+newt
+newts
+next
+nibbling
+nicanor
+nice
+nicely
+niceness
+nicer
+nicety
+nicholas
+nick
+nickname
+nicks
+niece
+nieces
+niggard
+niggarding
+niggardly
+nigh
+night
+nightcap
+nightcaps
+nighted
+nightgown
+nightingale
+nightingales
+nightly
+nightmare
+nights
+nightwork
+nihil
+nile
+nill
+nilus
+nimble
+nimbleness
+nimbler
+nimbly
+nine
+nineteen
+ning
+ningly
+ninny
+ninth
+ninus
+niobe
+niobes
+nip
+nipp
+nipping
+nipple
+nips
+nit
+nly
+nnight
+nnights
+no
+noah
+nob
+nobility
+nobis
+noble
+nobleman
+noblemen
+nobleness
+nobler
+nobles
+noblesse
+noblest
+nobly
+nobody
+noces
+nod
+nodded
+nodding
+noddle
+noddles
+noddy
+nods
+noes
+nointed
+nois
+noise
+noiseless
+noisemaker
+noises
+noisome
+nole
+nominate
+nominated
+nomination
+nominativo
+non
+nonage
+nonce
+none
+nonino
+nonny
+nonpareil
+nonsuits
+nony
+nook
+nooks
+noon
+noonday
+noontide
+nor
+norbery
+norfolk
+norman
+normandy
+normans
+north
+northampton
+northamptonshire
+northerly
+northern
+northgate
+northumberland
+northumberlands
+northward
+norway
+norways
+norwegian
+norweyan
+nos
+nose
+nosegays
+noseless
+noses
+noster
+nostra
+nostril
+nostrils
+not
+notable
+notably
+notary
+notch
+note
+notebook
+noted
+notedly
+notes
+notest
+noteworthy
+nothing
+nothings
+notice
+notify
+noting
+notion
+notorious
+notoriously
+notre
+notwithstanding
+nought
+noun
+nouns
+nourish
+nourished
+nourisher
+nourishes
+nourisheth
+nourishing
+nourishment
+nous
+novel
+novelties
+novelty
+noverbs
+novi
+novice
+novices
+novum
+now
+nowhere
+noyance
+ns
+nt
+nubibus
+numa
+numb
+number
+numbered
+numbering
+numberless
+numbers
+numbness
+nun
+nuncio
+nuncle
+nunnery
+nuns
+nuntius
+nuptial
+nurs
+nurse
+nursed
+nurser
+nursery
+nurses
+nurseth
+nursh
+nursing
+nurtur
+nurture
+nut
+nuthook
+nutmeg
+nutmegs
+nutriment
+nuts
+nutshell
+ny
+nym
+nymph
+nymphs
+o
+oak
+oaken
+oaks
+oared
+oars
+oatcake
+oaten
+oath
+oathable
+oaths
+oats
+ob
+obduracy
+obdurate
+obedience
+obedient
+obeisance
+oberon
+obey
+obeyed
+obeying
+obeys
+obidicut
+object
+objected
+objections
+objects
+oblation
+oblations
+obligation
+obligations
+obliged
+oblique
+oblivion
+oblivious
+obloquy
+obscene
+obscenely
+obscur
+obscure
+obscured
+obscurely
+obscures
+obscuring
+obscurity
+obsequies
+obsequious
+obsequiously
+observ
+observance
+observances
+observancy
+observant
+observants
+observation
+observe
+observed
+observer
+observers
+observing
+observingly
+obsque
+obstacle
+obstacles
+obstinacy
+obstinate
+obstinately
+obstruct
+obstruction
+obstructions
+obtain
+obtained
+obtaining
+occasion
+occasions
+occident
+occidental
+occulted
+occupat
+occupation
+occupations
+occupied
+occupies
+occupy
+occurrence
+occurrences
+occurrents
+ocean
+oceans
+octavia
+octavius
+ocular
+od
+odd
+oddest
+oddly
+odds
+ode
+odes
+odious
+odoriferous
+odorous
+odour
+odours
+ods
+oeillades
+oes
+oeuvres
+of
+ofephesus
+off
+offal
+offence
+offenceful
+offences
+offend
+offended
+offendendo
+offender
+offenders
+offendeth
+offending
+offendress
+offends
+offense
+offenseless
+offenses
+offensive
+offer
+offered
+offering
+offerings
+offers
+offert
+offic
+office
+officed
+officer
+officers
+offices
+official
+officious
+offspring
+oft
+often
+oftener
+oftentimes
+oh
+oil
+oils
+oily
+old
+oldcastle
+olden
+older
+oldest
+oldness
+olive
+oliver
+olivers
+olives
+olivia
+olympian
+olympus
+oman
+omans
+omen
+ominous
+omission
+omit
+omittance
+omitted
+omitting
+omne
+omnes
+omnipotent
+on
+once
+one
+ones
+oneyers
+ongles
+onion
+onions
+only
+onset
+onward
+onwards
+oo
+ooze
+oozes
+oozy
+op
+opal
+ope
+open
+opener
+opening
+openly
+openness
+opens
+operant
+operate
+operation
+operations
+operative
+opes
+oph
+ophelia
+opinion
+opinions
+opportune
+opportunities
+opportunity
+oppos
+oppose
+opposed
+opposeless
+opposer
+opposers
+opposes
+opposing
+opposite
+opposites
+opposition
+oppositions
+oppress
+oppressed
+oppresses
+oppresseth
+oppressing
+oppression
+oppressor
+opprest
+opprobriously
+oppugnancy
+opulency
+opulent
+or
+oracle
+oracles
+orange
+oration
+orator
+orators
+oratory
+orb
+orbed
+orbs
+orchard
+orchards
+ord
+ordain
+ordained
+ordaining
+order
+ordered
+ordering
+orderless
+orderly
+orders
+ordinance
+ordinant
+ordinaries
+ordinary
+ordnance
+ords
+ordure
+ore
+organ
+organs
+orgillous
+orient
+orifex
+origin
+original
+orisons
+ork
+orlando
+orld
+orleans
+ornament
+ornaments
+orodes
+orphan
+orphans
+orpheus
+orsino
+ort
+orthography
+orts
+oscorbidulchos
+osier
+osiers
+osprey
+osr
+osric
+ossa
+ost
+ostent
+ostentare
+ostentation
+ostents
+ostler
+ostlers
+ostrich
+osw
+oswald
+othello
+other
+othergates
+others
+otherwhere
+otherwhiles
+otherwise
+otter
+ottoman
+ottomites
+oublie
+ouches
+ought
+oui
+ounce
+ounces
+ouphes
+our
+ours
+ourself
+ourselves
+ousel
+out
+outbids
+outbrave
+outbraves
+outbreak
+outcast
+outcries
+outcry
+outdar
+outdare
+outdares
+outdone
+outfac
+outface
+outfaced
+outfacing
+outfly
+outfrown
+outgo
+outgoes
+outgrown
+outjest
+outlaw
+outlawry
+outlaws
+outliv
+outlive
+outlives
+outliving
+outlook
+outlustres
+outpriz
+outrage
+outrageous
+outrages
+outran
+outright
+outroar
+outrun
+outrunning
+outruns
+outscold
+outscorn
+outsell
+outsells
+outside
+outsides
+outspeaks
+outsport
+outstare
+outstay
+outstood
+outstretch
+outstretched
+outstrike
+outstrip
+outstripped
+outswear
+outvenoms
+outward
+outwardly
+outwards
+outwear
+outweighs
+outwent
+outworn
+outworths
+oven
+over
+overawe
+overbear
+overblown
+overboard
+overbold
+overborne
+overbulk
+overbuys
+overcame
+overcast
+overcharg
+overcharged
+overcome
+overcomes
+overdone
+overearnest
+overfar
+overflow
+overflown
+overglance
+overgo
+overgone
+overgorg
+overgrown
+overhead
+overhear
+overheard
+overhold
+overjoyed
+overkind
+overland
+overleather
+overlive
+overlook
+overlooking
+overlooks
+overmaster
+overmounting
+overmuch
+overpass
+overpeer
+overpeering
+overplus
+overrul
+overrun
+overscutch
+overset
+overshades
+overshine
+overshines
+overshot
+oversights
+overspread
+overstain
+overswear
+overt
+overta
+overtake
+overtaketh
+overthrow
+overthrown
+overthrows
+overtook
+overtopp
+overture
+overturn
+overwatch
+overween
+overweening
+overweigh
+overwhelm
+overwhelming
+overworn
+ovid
+ovidius
+ow
+owe
+owed
+owedst
+owen
+owes
+owest
+oweth
+owing
+owl
+owls
+own
+owner
+owners
+owning
+owns
+owy
+ox
+oxen
+oxford
+oxfordshire
+oxlips
+oyes
+oyster
+p
+pabble
+pabylon
+pac
+pace
+paced
+paces
+pacified
+pacify
+pacing
+pack
+packet
+packets
+packhorses
+packing
+packings
+packs
+packthread
+pacorus
+paction
+pad
+paddle
+paddling
+paddock
+padua
+pagan
+pagans
+page
+pageant
+pageants
+pages
+pah
+paid
+pail
+pailfuls
+pails
+pain
+pained
+painful
+painfully
+pains
+paint
+painted
+painter
+painting
+paintings
+paints
+pair
+paired
+pairs
+pajock
+pal
+palabras
+palace
+palaces
+palamedes
+palate
+palates
+palatine
+palating
+pale
+paled
+paleness
+paler
+pales
+palestine
+palfrey
+palfreys
+palisadoes
+pall
+pallabris
+pallas
+pallets
+palm
+palmer
+palmers
+palms
+palmy
+palpable
+palsied
+palsies
+palsy
+palt
+palter
+paltry
+paly
+pamp
+pamper
+pamphlets
+pan
+pancackes
+pancake
+pancakes
+pandar
+pandars
+pandarus
+pander
+panderly
+panders
+pandulph
+panel
+pang
+panging
+pangs
+pannier
+pannonians
+pansa
+pansies
+pant
+pantaloon
+panted
+pantheon
+panther
+panthino
+panting
+pantingly
+pantler
+pantry
+pants
+pap
+papal
+paper
+papers
+paphlagonia
+paphos
+papist
+paps
+par
+parable
+paracelsus
+paradise
+paradox
+paradoxes
+paragon
+paragons
+parallel
+parallels
+paramour
+paramours
+parapets
+paraquito
+parasite
+parasites
+parca
+parcel
+parcell
+parcels
+parch
+parched
+parching
+parchment
+pard
+pardon
+pardona
+pardoned
+pardoner
+pardoning
+pardonne
+pardonner
+pardonnez
+pardons
+pare
+pared
+parel
+parent
+parentage
+parents
+parfect
+paring
+parings
+paris
+parish
+parishioners
+parisians
+paritors
+park
+parks
+parle
+parler
+parles
+parley
+parlez
+parliament
+parlors
+parlour
+parlous
+parmacity
+parolles
+parricide
+parricides
+parrot
+parrots
+parsley
+parson
+part
+partake
+partaken
+partaker
+partakers
+parted
+parthia
+parthian
+parthians
+parti
+partial
+partialize
+partially
+participate
+participation
+particle
+particular
+particularities
+particularize
+particularly
+particulars
+parties
+parting
+partisan
+partisans
+partition
+partizan
+partlet
+partly
+partner
+partners
+partridge
+parts
+party
+pas
+pash
+pashed
+pashful
+pass
+passable
+passado
+passage
+passages
+passant
+passed
+passenger
+passengers
+passes
+passeth
+passing
+passio
+passion
+passionate
+passioning
+passions
+passive
+passport
+passy
+past
+paste
+pasterns
+pasties
+pastime
+pastimes
+pastoral
+pastorals
+pastors
+pastry
+pasture
+pastures
+pasty
+pat
+patay
+patch
+patchery
+patches
+pate
+pated
+patent
+patents
+paternal
+pates
+path
+pathetical
+paths
+pathway
+pathways
+patience
+patient
+patiently
+patients
+patines
+patrician
+patricians
+patrick
+patrimony
+patroclus
+patron
+patronage
+patroness
+patrons
+patrum
+patter
+pattern
+patterns
+pattle
+pauca
+paucas
+paul
+paulina
+paunch
+paunches
+pause
+pauser
+pauses
+pausingly
+pauvres
+pav
+paved
+pavement
+pavilion
+pavilions
+pavin
+paw
+pawn
+pawns
+paws
+pax
+pay
+payest
+paying
+payment
+payments
+pays
+paysan
+paysans
+pe
+peace
+peaceable
+peaceably
+peaceful
+peacemakers
+peaces
+peach
+peaches
+peacock
+peacocks
+peak
+peaking
+peal
+peals
+pear
+peard
+pearl
+pearls
+pears
+peas
+peasant
+peasantry
+peasants
+peascod
+pease
+peaseblossom
+peat
+peaten
+peating
+pebble
+pebbled
+pebbles
+peck
+pecks
+peculiar
+pecus
+pedant
+pedantical
+pedascule
+pede
+pedestal
+pedigree
+pedlar
+pedlars
+pedro
+peds
+peel
+peep
+peeped
+peeping
+peeps
+peer
+peereth
+peering
+peerless
+peers
+peesel
+peevish
+peevishly
+peflur
+peg
+pegasus
+pegs
+peise
+peised
+peize
+pelf
+pelican
+pelion
+pell
+pella
+pelleted
+peloponnesus
+pelt
+pelting
+pembroke
+pen
+penalties
+penalty
+penance
+pence
+pencil
+pencill
+pencils
+pendant
+pendent
+pendragon
+pendulous
+penelope
+penetrable
+penetrate
+penetrative
+penitence
+penitent
+penitential
+penitently
+penitents
+penker
+penknife
+penn
+penned
+penning
+pennons
+penny
+pennyworth
+pennyworths
+pens
+pense
+pension
+pensioners
+pensive
+pensived
+pensively
+pent
+pentecost
+penthesilea
+penthouse
+penurious
+penury
+peopl
+people
+peopled
+peoples
+pepin
+pepper
+peppercorn
+peppered
+per
+peradventure
+peradventures
+perceiv
+perceive
+perceived
+perceives
+perceiveth
+perch
+perchance
+percies
+percussion
+percy
+perdie
+perdita
+perdition
+perdonato
+perdu
+perdurable
+perdurably
+perdy
+pere
+peregrinate
+peremptorily
+peremptory
+perfect
+perfected
+perfecter
+perfectest
+perfection
+perfections
+perfectly
+perfectness
+perfidious
+perfidiously
+perforce
+perform
+performance
+performances
+performed
+performer
+performers
+performing
+performs
+perfum
+perfume
+perfumed
+perfumer
+perfumes
+perge
+perhaps
+periapts
+perigort
+perigouna
+peril
+perilous
+perils
+period
+periods
+perish
+perished
+perishest
+perisheth
+perishing
+periwig
+perjur
+perjure
+perjured
+perjuries
+perjury
+perk
+perkes
+permafoy
+permanent
+permission
+permissive
+permit
+permitted
+pernicious
+perniciously
+peroration
+perpend
+perpendicular
+perpendicularly
+perpetual
+perpetually
+perpetuity
+perplex
+perplexed
+perplexity
+pers
+persecuted
+persecutions
+persecutor
+perseus
+persever
+perseverance
+persevers
+persia
+persian
+persist
+persisted
+persistency
+persistive
+persists
+person
+personae
+personage
+personages
+personal
+personally
+personate
+personated
+personates
+personating
+persons
+perspective
+perspectively
+perspectives
+perspicuous
+persuade
+persuaded
+persuades
+persuading
+persuasion
+persuasions
+pert
+pertain
+pertaining
+pertains
+pertaunt
+pertinent
+pertly
+perturb
+perturbation
+perturbations
+perturbed
+perus
+perusal
+peruse
+perused
+perusing
+perverse
+perversely
+perverseness
+pervert
+perverted
+peseech
+pest
+pester
+pestiferous
+pestilence
+pestilent
+pet
+petar
+peter
+petit
+petition
+petitionary
+petitioner
+petitioners
+petitions
+peto
+petrarch
+petruchio
+petter
+petticoat
+petticoats
+pettiness
+pettish
+pettitoes
+petty
+peu
+pew
+pewter
+pewterer
+phaethon
+phaeton
+phantasime
+phantasimes
+phantasma
+pharamond
+pharaoh
+pharsalia
+pheasant
+pheazar
+phebe
+phebes
+pheebus
+pheeze
+phibbus
+philadelphos
+philario
+philarmonus
+philemon
+philip
+philippan
+philippe
+philippi
+phillida
+philo
+philomel
+philomela
+philosopher
+philosophers
+philosophical
+philosophy
+philostrate
+philotus
+phlegmatic
+phoebe
+phoebus
+phoenicia
+phoenicians
+phoenix
+phorbus
+photinus
+phrase
+phraseless
+phrases
+phrygia
+phrygian
+phrynia
+physic
+physical
+physician
+physicians
+physics
+pia
+pibble
+pible
+picardy
+pick
+pickaxe
+pickaxes
+pickbone
+picked
+pickers
+picking
+pickle
+picklock
+pickpurse
+picks
+pickt
+pickthanks
+pictur
+picture
+pictured
+pictures
+pid
+pie
+piec
+piece
+pieces
+piecing
+pied
+piedness
+pier
+pierc
+pierce
+pierced
+pierces
+pierceth
+piercing
+piercy
+piers
+pies
+piety
+pig
+pigeon
+pigeons
+pight
+pigmy
+pigrogromitus
+pike
+pikes
+pil
+pilate
+pilates
+pilchers
+pile
+piles
+pilf
+pilfering
+pilgrim
+pilgrimage
+pilgrims
+pill
+pillage
+pillagers
+pillar
+pillars
+pillicock
+pillory
+pillow
+pillows
+pills
+pilot
+pilots
+pimpernell
+pin
+pinch
+pinched
+pinches
+pinching
+pindarus
+pine
+pined
+pines
+pinfold
+pining
+pinion
+pink
+pinn
+pinnace
+pins
+pinse
+pint
+pintpot
+pioned
+pioneers
+pioner
+pioners
+pious
+pip
+pipe
+piper
+pipers
+pipes
+piping
+pippin
+pippins
+pirate
+pirates
+pisa
+pisanio
+pish
+pismires
+piss
+pissing
+pistol
+pistols
+pit
+pitch
+pitched
+pitcher
+pitchers
+pitchy
+piteous
+piteously
+pitfall
+pith
+pithless
+pithy
+pitie
+pitied
+pities
+pitiful
+pitifully
+pitiless
+pits
+pittance
+pittie
+pittikins
+pity
+pitying
+pius
+plac
+place
+placed
+placentio
+places
+placeth
+placid
+placing
+plack
+placket
+plackets
+plagu
+plague
+plagued
+plagues
+plaguing
+plaguy
+plain
+plainer
+plainest
+plaining
+plainings
+plainly
+plainness
+plains
+plainsong
+plaintful
+plaintiff
+plaintiffs
+plaints
+planched
+planet
+planetary
+planets
+planks
+plant
+plantage
+plantagenet
+plantagenets
+plantain
+plantation
+planted
+planteth
+plants
+plash
+plashy
+plast
+plaster
+plasterer
+plat
+plate
+plated
+plates
+platform
+platforms
+plats
+platted
+plausible
+plausive
+plautus
+play
+played
+player
+players
+playeth
+playfellow
+playfellows
+playhouse
+playing
+plays
+plea
+pleach
+pleached
+plead
+pleaded
+pleader
+pleaders
+pleading
+pleads
+pleas
+pleasance
+pleasant
+pleasantly
+please
+pleased
+pleaser
+pleasers
+pleases
+pleasest
+pleaseth
+pleasing
+pleasure
+pleasures
+plebeians
+plebeii
+plebs
+pledge
+pledges
+pleines
+plenitude
+plenteous
+plenteously
+plenties
+plentiful
+plentifully
+plenty
+pless
+plessed
+plessing
+pliant
+plied
+plies
+plight
+plighted
+plighter
+plod
+plodded
+plodders
+plodding
+plods
+plood
+ploody
+plot
+plots
+plotted
+plotter
+plough
+ploughed
+ploughman
+ploughmen
+plow
+plows
+pluck
+plucked
+plucker
+plucking
+plucks
+plue
+plum
+plume
+plumed
+plumes
+plummet
+plump
+plumpy
+plums
+plung
+plunge
+plunged
+plural
+plurisy
+plus
+pluto
+plutus
+ply
+po
+pocket
+pocketing
+pockets
+pocky
+pody
+poem
+poesy
+poet
+poetical
+poetry
+poets
+poictiers
+poinards
+poins
+point
+pointblank
+pointed
+pointing
+points
+pois
+poise
+poising
+poison
+poisoned
+poisoner
+poisoning
+poisonous
+poisons
+poke
+poking
+pol
+polack
+polacks
+poland
+pold
+pole
+poleaxe
+polecat
+polecats
+polemon
+poles
+poli
+policies
+policy
+polish
+polished
+politic
+politician
+politicians
+politicly
+polixenes
+poll
+polluted
+pollution
+polonius
+poltroons
+polusion
+polydamus
+polydore
+polyxena
+pomander
+pomegranate
+pomewater
+pomfret
+pomgarnet
+pommel
+pomp
+pompeius
+pompey
+pompion
+pompous
+pomps
+pond
+ponder
+ponderous
+ponds
+poniard
+poniards
+pont
+pontic
+pontifical
+ponton
+pooh
+pool
+poole
+poop
+poor
+poorer
+poorest
+poorly
+pop
+pope
+popedom
+popilius
+popingay
+popish
+popp
+poppy
+pops
+popular
+popularity
+populous
+porch
+porches
+pore
+poring
+pork
+porn
+porpentine
+porridge
+porringer
+port
+portable
+portage
+portal
+portance
+portcullis
+portend
+portends
+portent
+portentous
+portents
+porter
+porters
+portia
+portion
+portly
+portotartarossa
+portrait
+portraiture
+ports
+portugal
+pose
+posied
+posies
+position
+positive
+positively
+posse
+possess
+possessed
+possesses
+possesseth
+possessing
+possession
+possessions
+possessor
+posset
+possets
+possibilities
+possibility
+possible
+possibly
+possitable
+post
+poste
+posted
+posterior
+posteriors
+posterity
+postern
+posterns
+posters
+posthorse
+posthorses
+posthumus
+posting
+postmaster
+posts
+postscript
+posture
+postures
+posy
+pot
+potable
+potations
+potato
+potatoes
+potch
+potency
+potent
+potentates
+potential
+potently
+potents
+pothecary
+pother
+potion
+potions
+potpan
+pots
+potter
+potting
+pottle
+pouch
+poulter
+poultice
+poultney
+pouncet
+pound
+pounds
+pour
+pourest
+pouring
+pourquoi
+pours
+pout
+poverty
+pow
+powd
+powder
+power
+powerful
+powerfully
+powerless
+powers
+pox
+poys
+poysam
+prabbles
+practic
+practice
+practiced
+practicer
+practices
+practicing
+practis
+practisants
+practise
+practiser
+practisers
+practises
+practising
+praeclarissimus
+praemunire
+praetor
+praetors
+pragging
+prague
+prain
+prains
+prais
+praise
+praised
+praises
+praisest
+praiseworthy
+praising
+prancing
+prank
+pranks
+prat
+prate
+prated
+prater
+prating
+prattle
+prattler
+prattling
+prave
+prawls
+prawns
+pray
+prayer
+prayers
+praying
+prays
+pre
+preach
+preached
+preachers
+preaches
+preaching
+preachment
+pread
+preambulate
+precedence
+precedent
+preceding
+precept
+preceptial
+precepts
+precinct
+precious
+preciously
+precipice
+precipitating
+precipitation
+precise
+precisely
+preciseness
+precisian
+precor
+precurse
+precursors
+predeceased
+predecessor
+predecessors
+predestinate
+predicament
+predict
+prediction
+predictions
+predominance
+predominant
+predominate
+preeches
+preeminence
+preface
+prefer
+preferment
+preferments
+preferr
+preferreth
+preferring
+prefers
+prefiguring
+prefix
+prefixed
+preformed
+pregnancy
+pregnant
+pregnantly
+prejudicates
+prejudice
+prejudicial
+prelate
+premeditated
+premeditation
+premised
+premises
+prenez
+prenominate
+prentice
+prentices
+preordinance
+prepar
+preparation
+preparations
+prepare
+prepared
+preparedly
+prepares
+preparing
+prepost
+preposterous
+preposterously
+prerogatifes
+prerogative
+prerogatived
+presage
+presagers
+presages
+presageth
+presaging
+prescience
+prescribe
+prescript
+prescription
+prescriptions
+prescripts
+presence
+presences
+present
+presentation
+presented
+presenter
+presenters
+presenteth
+presenting
+presently
+presentment
+presents
+preserv
+preservation
+preservative
+preserve
+preserved
+preserver
+preservers
+preserving
+president
+press
+pressed
+presser
+presses
+pressing
+pressure
+pressures
+prest
+prester
+presume
+presumes
+presuming
+presumption
+presumptuous
+presuppos
+pret
+pretence
+pretences
+pretend
+pretended
+pretending
+pretense
+pretext
+pretia
+prettier
+prettiest
+prettily
+prettiness
+pretty
+prevail
+prevailed
+prevaileth
+prevailing
+prevailment
+prevails
+prevent
+prevented
+prevention
+preventions
+prevents
+prey
+preyful
+preys
+priam
+priami
+priamus
+pribbles
+price
+prick
+pricked
+pricket
+pricking
+pricks
+pricksong
+pride
+prides
+pridge
+prie
+pried
+prief
+pries
+priest
+priesthood
+priests
+prig
+primal
+prime
+primer
+primero
+primest
+primitive
+primo
+primogenity
+primrose
+primroses
+primy
+prince
+princely
+princes
+princess
+principal
+principalities
+principality
+principle
+principles
+princox
+prings
+print
+printed
+printing
+printless
+prints
+prioress
+priories
+priority
+priory
+priscian
+prison
+prisoner
+prisoners
+prisonment
+prisonnier
+prisons
+pristine
+prithe
+prithee
+privacy
+private
+privately
+privates
+privilage
+privileg
+privilege
+privileged
+privileges
+privilegio
+privily
+privity
+privy
+priz
+prize
+prized
+prizer
+prizes
+prizest
+prizing
+pro
+probable
+probal
+probation
+proceed
+proceeded
+proceeders
+proceeding
+proceedings
+proceeds
+process
+procession
+proclaim
+proclaimed
+proclaimeth
+proclaims
+proclamation
+proclamations
+proconsul
+procrastinate
+procreant
+procreants
+procreation
+procrus
+proculeius
+procur
+procurator
+procure
+procured
+procures
+procuring
+prodigal
+prodigality
+prodigally
+prodigals
+prodigies
+prodigious
+prodigiously
+prodigy
+proditor
+produc
+produce
+produced
+produces
+producing
+proface
+profan
+profanation
+profane
+profaned
+profanely
+profaneness
+profaners
+profaning
+profess
+professed
+professes
+profession
+professions
+professors
+proffer
+proffered
+profferer
+proffers
+proficient
+profit
+profitable
+profitably
+profited
+profiting
+profitless
+profits
+profound
+profoundest
+profoundly
+progenitors
+progeny
+progne
+prognosticate
+prognostication
+progress
+progression
+prohibit
+prohibition
+project
+projection
+projects
+prolixious
+prolixity
+prologue
+prologues
+prolong
+prolongs
+promethean
+prometheus
+promis
+promise
+promised
+promises
+promiseth
+promising
+promontory
+promotion
+promotions
+prompt
+prompted
+promptement
+prompter
+prompting
+prompts
+prompture
+promulgate
+prone
+prononcer
+prononcez
+pronoun
+pronounc
+pronounce
+pronounced
+pronouncing
+pronouns
+proof
+proofs
+prop
+propagate
+propagation
+propend
+propension
+proper
+properer
+properly
+propertied
+properties
+property
+prophecies
+prophecy
+prophesied
+prophesier
+prophesy
+prophesying
+prophet
+prophetess
+prophetic
+prophetically
+prophets
+propinquity
+propontic
+proportion
+proportionable
+proportions
+propos
+propose
+proposed
+proposer
+proposes
+proposing
+proposition
+propositions
+propounded
+propp
+propre
+propriety
+props
+propugnation
+prorogue
+prorogued
+proscription
+proscriptions
+prose
+prosecute
+prosecution
+proselytes
+proserpina
+prosp
+prospect
+prosper
+prosperity
+prospero
+prosperous
+prosperously
+prospers
+prostitute
+prostrate
+protect
+protected
+protection
+protector
+protectors
+protectorship
+protectress
+protects
+protest
+protestation
+protestations
+protested
+protester
+protesting
+protests
+proteus
+protheus
+protract
+protractive
+proud
+prouder
+proudest
+proudlier
+proudly
+prouds
+prov
+provand
+prove
+proved
+provender
+proverb
+proverbs
+proves
+proveth
+provide
+provided
+providence
+provident
+providently
+provider
+provides
+province
+provinces
+provincial
+proving
+provision
+proviso
+provocation
+provok
+provoke
+provoked
+provoker
+provokes
+provoketh
+provoking
+provost
+prowess
+prudence
+prudent
+prun
+prune
+prunes
+pruning
+pry
+prying
+psalm
+psalmist
+psalms
+psalteries
+ptolemies
+ptolemy
+public
+publican
+publication
+publicly
+publicola
+publish
+published
+publisher
+publishing
+publius
+pucelle
+puck
+pudder
+pudding
+puddings
+puddle
+puddled
+pudency
+pueritia
+puff
+puffing
+puffs
+pugging
+puis
+puissance
+puissant
+puke
+puking
+pulcher
+puling
+pull
+puller
+pullet
+pulling
+pulls
+pulpit
+pulpiter
+pulpits
+pulse
+pulsidge
+pump
+pumpion
+pumps
+pun
+punched
+punish
+punished
+punishes
+punishment
+punishments
+punk
+punto
+puny
+pupil
+pupils
+puppet
+puppets
+puppies
+puppy
+pur
+purblind
+purchas
+purchase
+purchased
+purchases
+purchaseth
+purchasing
+pure
+purely
+purer
+purest
+purg
+purgation
+purgative
+purgatory
+purge
+purged
+purgers
+purging
+purifies
+purifying
+puritan
+purity
+purlieus
+purple
+purpled
+purples
+purport
+purpos
+purpose
+purposed
+purposely
+purposes
+purposeth
+purposing
+purr
+purs
+purse
+pursents
+purses
+pursu
+pursue
+pursued
+pursuers
+pursues
+pursuest
+pursueth
+pursuing
+pursuit
+pursuivant
+pursuivants
+pursy
+purus
+purveyor
+push
+pushes
+pusillanimity
+put
+putrefy
+putrified
+puts
+putter
+putting
+puttock
+puzzel
+puzzle
+puzzled
+puzzles
+py
+pygmalion
+pygmies
+pygmy
+pyramid
+pyramides
+pyramids
+pyramis
+pyramises
+pyramus
+pyrenean
+pyrrhus
+pythagoras
+qu
+quadrangle
+quae
+quaff
+quaffing
+quagmire
+quail
+quailing
+quails
+quaint
+quaintly
+quak
+quake
+quakes
+qualification
+qualified
+qualifies
+qualify
+qualifying
+qualite
+qualities
+quality
+qualm
+qualmish
+quam
+quand
+quando
+quantities
+quantity
+quare
+quarrel
+quarrell
+quarreller
+quarrelling
+quarrelous
+quarrels
+quarrelsome
+quarries
+quarry
+quart
+quarter
+quartered
+quartering
+quarters
+quarts
+quasi
+quat
+quatch
+quay
+que
+quean
+queas
+queasiness
+queasy
+queen
+queens
+quell
+queller
+quench
+quenched
+quenching
+quenchless
+quern
+quest
+questant
+question
+questionable
+questioned
+questioning
+questionless
+questions
+questrists
+quests
+queubus
+qui
+quick
+quicken
+quickens
+quicker
+quicklier
+quickly
+quickness
+quicksand
+quicksands
+quicksilverr
+quid
+quiddities
+quiddits
+quier
+quiet
+quieter
+quietly
+quietness
+quietus
+quill
+quillets
+quills
+quilt
+quinapalus
+quince
+quinces
+quintain
+quintessence
+quintus
+quip
+quips
+quire
+quiring
+quirk
+quirks
+quis
+quit
+quite
+quits
+quittance
+quitted
+quitting
+quiver
+quivering
+quivers
+quo
+quod
+quoifs
+quoint
+quoit
+quoits
+quondam
+quoniam
+quote
+quoted
+quotes
+quoth
+quotidian
+r
+rabbit
+rabble
+rabblement
+race
+rack
+rackers
+racket
+rackets
+racking
+racks
+radiance
+radiant
+radish
+rafe
+raft
+rag
+rage
+rages
+rageth
+ragg
+ragged
+raggedness
+raging
+ragozine
+rags
+rah
+rail
+railed
+railer
+railest
+raileth
+railing
+rails
+raiment
+rain
+rainbow
+raineth
+raining
+rainold
+rains
+rainy
+rais
+raise
+raised
+raises
+raising
+raisins
+rak
+rake
+rakers
+rakes
+ral
+rald
+ralph
+ram
+rambures
+ramm
+rampallian
+rampant
+ramping
+rampir
+ramps
+rams
+ramsey
+ramston
+ran
+rance
+rancorous
+rancors
+rancour
+random
+rang
+range
+ranged
+rangers
+ranges
+ranging
+rank
+ranker
+rankest
+ranking
+rankle
+rankly
+rankness
+ranks
+ransack
+ransacking
+ransom
+ransomed
+ransoming
+ransomless
+ransoms
+rant
+ranting
+rap
+rape
+rapes
+rapier
+rapiers
+rapine
+raps
+rapt
+rapture
+raptures
+rar
+rare
+rarely
+rareness
+rarer
+rarest
+rarities
+rarity
+rascal
+rascalliest
+rascally
+rascals
+rased
+rash
+rasher
+rashly
+rashness
+rat
+ratcatcher
+ratcliff
+rate
+rated
+rately
+rates
+rather
+ratherest
+ratified
+ratifiers
+ratify
+rating
+rational
+ratolorum
+rats
+ratsbane
+rattle
+rattles
+rattling
+rature
+raught
+rav
+rave
+ravel
+raven
+ravening
+ravenous
+ravens
+ravenspurgh
+raves
+ravin
+raving
+ravish
+ravished
+ravisher
+ravishing
+ravishments
+raw
+rawer
+rawly
+rawness
+ray
+rayed
+rays
+raz
+raze
+razed
+razes
+razeth
+razing
+razor
+razorable
+razors
+razure
+re
+reach
+reaches
+reacheth
+reaching
+read
+reader
+readiest
+readily
+readiness
+reading
+readins
+reads
+ready
+real
+really
+realm
+realms
+reap
+reapers
+reaping
+reaps
+rear
+rears
+rearward
+reason
+reasonable
+reasonably
+reasoned
+reasoning
+reasonless
+reasons
+reave
+rebate
+rebato
+rebeck
+rebel
+rebell
+rebelling
+rebellion
+rebellious
+rebels
+rebound
+rebuk
+rebuke
+rebukeable
+rebuked
+rebukes
+rebus
+recall
+recant
+recantation
+recanter
+recanting
+receipt
+receipts
+receiv
+receive
+received
+receiver
+receives
+receivest
+receiveth
+receiving
+receptacle
+rechate
+reciprocal
+reciprocally
+recite
+recited
+reciterai
+reck
+recking
+reckless
+reckon
+reckoned
+reckoning
+reckonings
+recks
+reclaim
+reclaims
+reclusive
+recognizance
+recognizances
+recoil
+recoiling
+recollected
+recomforted
+recomforture
+recommend
+recommended
+recommends
+recompens
+recompense
+reconcil
+reconcile
+reconciled
+reconcilement
+reconciler
+reconciles
+reconciliation
+record
+recordation
+recorded
+recorder
+recorders
+records
+recount
+recounted
+recounting
+recountments
+recounts
+recourse
+recov
+recover
+recoverable
+recovered
+recoveries
+recovers
+recovery
+recreant
+recreants
+recreate
+recreation
+rectify
+rector
+rectorship
+recure
+recured
+red
+redbreast
+redder
+reddest
+rede
+redeem
+redeemed
+redeemer
+redeeming
+redeems
+redeliver
+redemption
+redime
+redness
+redoubled
+redoubted
+redound
+redress
+redressed
+redresses
+reduce
+reechy
+reed
+reeds
+reek
+reeking
+reeks
+reeky
+reel
+reeleth
+reeling
+reels
+refell
+refer
+reference
+referr
+referred
+refigured
+refin
+refined
+reflect
+reflecting
+reflection
+reflex
+reform
+reformation
+reformed
+refractory
+refrain
+refresh
+refreshing
+reft
+refts
+refuge
+refus
+refusal
+refuse
+refused
+refusest
+refusing
+reg
+regal
+regalia
+regan
+regard
+regardance
+regarded
+regardfully
+regarding
+regards
+regenerate
+regent
+regentship
+regia
+regiment
+regiments
+regina
+region
+regions
+regist
+register
+registers
+regreet
+regreets
+regress
+reguerdon
+regular
+rehears
+rehearsal
+rehearse
+reign
+reigned
+reignier
+reigning
+reigns
+rein
+reinforc
+reinforce
+reinforcement
+reins
+reiterate
+reject
+rejected
+rejoic
+rejoice
+rejoices
+rejoiceth
+rejoicing
+rejoicingly
+rejoindure
+rejourn
+rel
+relapse
+relate
+relates
+relation
+relations
+relative
+releas
+release
+released
+releasing
+relent
+relenting
+relents
+reliances
+relics
+relief
+reliev
+relieve
+relieved
+relieves
+relieving
+religion
+religions
+religious
+religiously
+relinquish
+reliques
+reliquit
+relish
+relume
+rely
+relying
+remain
+remainder
+remainders
+remained
+remaineth
+remaining
+remains
+remark
+remarkable
+remediate
+remedied
+remedies
+remedy
+rememb
+remember
+remembered
+remembers
+remembrance
+remembrancer
+remembrances
+remercimens
+remiss
+remission
+remissness
+remit
+remnant
+remnants
+remonstrance
+remorse
+remorseful
+remorseless
+remote
+remotion
+remov
+remove
+removed
+removedness
+remover
+removes
+removing
+remunerate
+remuneration
+rence
+rend
+render
+rendered
+renders
+rendezvous
+renegado
+renege
+reneges
+renew
+renewed
+renewest
+renounce
+renouncement
+renouncing
+renowmed
+renown
+renowned
+rent
+rents
+repaid
+repair
+repaired
+repairing
+repairs
+repass
+repast
+repasture
+repay
+repaying
+repays
+repeal
+repealing
+repeals
+repeat
+repeated
+repeating
+repeats
+repel
+repent
+repentance
+repentant
+repented
+repenting
+repents
+repetition
+repetitions
+repin
+repine
+repining
+replant
+replenish
+replenished
+replete
+replication
+replied
+replies
+repliest
+reply
+replying
+report
+reported
+reporter
+reportest
+reporting
+reportingly
+reports
+reposal
+repose
+reposeth
+reposing
+repossess
+reprehend
+reprehended
+reprehending
+represent
+representing
+reprieve
+reprieves
+reprisal
+reproach
+reproaches
+reproachful
+reproachfully
+reprobate
+reprobation
+reproof
+reprov
+reprove
+reproveable
+reproves
+reproving
+repugn
+repugnancy
+repugnant
+repulse
+repulsed
+repurchas
+repured
+reputation
+repute
+reputed
+reputeless
+reputes
+reputing
+request
+requested
+requesting
+requests
+requiem
+requir
+require
+required
+requires
+requireth
+requiring
+requisite
+requisites
+requit
+requital
+requite
+requited
+requites
+rer
+rere
+rers
+rescu
+rescue
+rescued
+rescues
+rescuing
+resemblance
+resemble
+resembled
+resembles
+resembleth
+resembling
+reserv
+reservation
+reserve
+reserved
+reserves
+reside
+residence
+resident
+resides
+residing
+residue
+resign
+resignation
+resist
+resistance
+resisted
+resisting
+resists
+resolute
+resolutely
+resolutes
+resolution
+resolv
+resolve
+resolved
+resolvedly
+resolves
+resolveth
+resort
+resorted
+resounding
+resounds
+respeaking
+respect
+respected
+respecting
+respective
+respectively
+respects
+respice
+respite
+respites
+responsive
+respose
+ress
+rest
+rested
+resteth
+restful
+resting
+restitution
+restless
+restor
+restoration
+restorative
+restore
+restored
+restores
+restoring
+restrain
+restrained
+restraining
+restrains
+restraint
+rests
+resty
+resum
+resume
+resumes
+resurrections
+retail
+retails
+retain
+retainers
+retaining
+retell
+retention
+retentive
+retinue
+retir
+retire
+retired
+retirement
+retires
+retiring
+retold
+retort
+retorts
+retourne
+retract
+retreat
+retrograde
+rets
+return
+returned
+returnest
+returneth
+returning
+returns
+revania
+reveal
+reveals
+revel
+reveler
+revell
+reveller
+revellers
+revelling
+revelry
+revels
+reveng
+revenge
+revenged
+revengeful
+revengement
+revenger
+revengers
+revenges
+revenging
+revengingly
+revenue
+revenues
+reverb
+reverberate
+reverbs
+reverenc
+reverence
+reverend
+reverent
+reverently
+revers
+reverse
+reversion
+reverted
+review
+reviewest
+revil
+revile
+revisits
+reviv
+revive
+revives
+reviving
+revok
+revoke
+revokement
+revolt
+revolted
+revolting
+revolts
+revolution
+revolutions
+revolve
+revolving
+reward
+rewarded
+rewarder
+rewarding
+rewards
+reword
+reworded
+rex
+rey
+reynaldo
+rford
+rful
+rfull
+rhapsody
+rheims
+rhenish
+rhesus
+rhetoric
+rheum
+rheumatic
+rheums
+rheumy
+rhinoceros
+rhodes
+rhodope
+rhubarb
+rhym
+rhyme
+rhymers
+rhymes
+rhyming
+rialto
+rib
+ribald
+riband
+ribands
+ribaudred
+ribb
+ribbed
+ribbon
+ribbons
+ribs
+rice
+rich
+richard
+richer
+riches
+richest
+richly
+richmond
+richmonds
+rid
+riddance
+ridden
+riddle
+riddles
+riddling
+ride
+rider
+riders
+rides
+ridest
+rideth
+ridge
+ridges
+ridiculous
+riding
+rids
+rien
+ries
+rifle
+rift
+rifted
+rig
+rigg
+riggish
+right
+righteous
+righteously
+rightful
+rightfully
+rightly
+rights
+rigol
+rigorous
+rigorously
+rigour
+ril
+rim
+rin
+rinaldo
+rind
+ring
+ringing
+ringleader
+ringlets
+rings
+ringwood
+riot
+rioter
+rioting
+riotous
+riots
+rip
+ripe
+ripely
+ripen
+ripened
+ripeness
+ripening
+ripens
+riper
+ripest
+riping
+ripp
+ripping
+rise
+risen
+rises
+riseth
+rish
+rising
+rite
+rites
+rivage
+rival
+rivality
+rivall
+rivals
+rive
+rived
+rivelled
+river
+rivers
+rivet
+riveted
+rivets
+rivo
+rj
+rless
+road
+roads
+roam
+roaming
+roan
+roar
+roared
+roarers
+roaring
+roars
+roast
+roasted
+rob
+roba
+robas
+robb
+robbed
+robber
+robbers
+robbery
+robbing
+robe
+robed
+robert
+robes
+robin
+robs
+robustious
+rochester
+rochford
+rock
+rocks
+rocky
+rod
+rode
+roderigo
+rods
+roe
+roes
+roger
+rogero
+rogue
+roguery
+rogues
+roguish
+roi
+roisting
+roll
+rolled
+rolling
+rolls
+rom
+romage
+roman
+romano
+romanos
+romans
+rome
+romeo
+romish
+rondure
+ronyon
+rood
+roof
+roofs
+rook
+rooks
+rooky
+room
+rooms
+root
+rooted
+rootedly
+rooteth
+rooting
+roots
+rope
+ropery
+ropes
+roping
+ros
+rosalind
+rosalinda
+rosalinde
+rosaline
+roscius
+rose
+rosed
+rosemary
+rosencrantz
+roses
+ross
+rosy
+rot
+rote
+roted
+rother
+rotherham
+rots
+rotted
+rotten
+rottenness
+rotting
+rotundity
+rouen
+rough
+rougher
+roughest
+roughly
+roughness
+round
+rounded
+roundel
+rounder
+roundest
+rounding
+roundly
+rounds
+roundure
+rous
+rouse
+roused
+rousillon
+rously
+roussi
+rout
+routed
+routs
+rove
+rover
+row
+rowel
+rowland
+rowlands
+roy
+royal
+royalize
+royally
+royalties
+royalty
+roynish
+rs
+rt
+rub
+rubb
+rubbing
+rubbish
+rubies
+rubious
+rubs
+ruby
+rud
+rudand
+rudder
+ruddiness
+ruddock
+ruddy
+rude
+rudely
+rudeness
+ruder
+rudesby
+rudest
+rudiments
+rue
+rued
+ruff
+ruffian
+ruffians
+ruffle
+ruffling
+ruffs
+rug
+rugby
+rugemount
+rugged
+ruin
+ruinate
+ruined
+ruining
+ruinous
+ruins
+rul
+rule
+ruled
+ruler
+rulers
+rules
+ruling
+rumble
+ruminaies
+ruminat
+ruminate
+ruminated
+ruminates
+rumination
+rumor
+rumour
+rumourer
+rumours
+rump
+run
+runagate
+runagates
+runaway
+runaways
+rung
+runn
+runner
+runners
+running
+runs
+rupture
+ruptures
+rural
+rush
+rushes
+rushing
+rushling
+rushy
+russet
+russia
+russian
+russians
+rust
+rusted
+rustic
+rustically
+rustics
+rustle
+rustling
+rusts
+rusty
+rut
+ruth
+ruthful
+ruthless
+rutland
+ruttish
+ry
+rye
+rything
+s
+sa
+saba
+sabbath
+sable
+sables
+sack
+sackbuts
+sackcloth
+sacked
+sackerson
+sacks
+sacrament
+sacred
+sacrific
+sacrifice
+sacrificers
+sacrifices
+sacrificial
+sacrificing
+sacrilegious
+sacring
+sad
+sadder
+saddest
+saddle
+saddler
+saddles
+sadly
+sadness
+saf
+safe
+safeguard
+safely
+safer
+safest
+safeties
+safety
+saffron
+sag
+sage
+sagittary
+said
+saidst
+sail
+sailing
+sailmaker
+sailor
+sailors
+sails
+sain
+saint
+sainted
+saintlike
+saints
+saith
+sake
+sakes
+sala
+salad
+salamander
+salary
+sale
+salerio
+salicam
+salique
+salisbury
+sall
+sallet
+sallets
+sallies
+sallow
+sally
+salmon
+salmons
+salt
+salter
+saltiers
+saltness
+saltpetre
+salutation
+salutations
+salute
+saluted
+salutes
+saluteth
+salv
+salvation
+salve
+salving
+same
+samingo
+samp
+sampire
+sample
+sampler
+sampson
+samson
+samsons
+sancta
+sanctified
+sanctifies
+sanctify
+sanctimonies
+sanctimonious
+sanctimony
+sanctities
+sanctity
+sanctuarize
+sanctuary
+sand
+sandal
+sandbag
+sanded
+sands
+sandy
+sandys
+sang
+sanguine
+sanguis
+sanity
+sans
+santrailles
+sap
+sapient
+sapit
+sapless
+sapling
+sapphire
+sapphires
+saracens
+sarcenet
+sard
+sardians
+sardinia
+sardis
+sarum
+sat
+satan
+satchel
+sate
+sated
+satiate
+satiety
+satin
+satire
+satirical
+satis
+satisfaction
+satisfied
+satisfies
+satisfy
+satisfying
+saturday
+saturdays
+saturn
+saturnine
+saturninus
+satyr
+satyrs
+sauc
+sauce
+sauced
+saucers
+sauces
+saucily
+sauciness
+saucy
+sauf
+saunder
+sav
+savage
+savagely
+savageness
+savagery
+savages
+save
+saved
+saves
+saving
+saviour
+savory
+savour
+savouring
+savours
+savoury
+savoy
+saw
+sawed
+sawest
+sawn
+sawpit
+saws
+sawyer
+saxons
+saxony
+saxton
+say
+sayest
+saying
+sayings
+says
+sayst
+sblood
+sc
+scab
+scabbard
+scabs
+scaffold
+scaffoldage
+scal
+scald
+scalded
+scalding
+scale
+scaled
+scales
+scaling
+scall
+scalp
+scalps
+scaly
+scamble
+scambling
+scamels
+scan
+scandal
+scandaliz
+scandalous
+scandy
+scann
+scant
+scanted
+scanter
+scanting
+scantling
+scants
+scap
+scape
+scaped
+scapes
+scapeth
+scar
+scarce
+scarcely
+scarcity
+scare
+scarecrow
+scarecrows
+scarf
+scarfed
+scarfs
+scaring
+scarlet
+scarr
+scarre
+scars
+scarus
+scath
+scathe
+scathful
+scatt
+scatter
+scattered
+scattering
+scatters
+scelera
+scelerisque
+scene
+scenes
+scent
+scented
+scept
+scepter
+sceptre
+sceptred
+sceptres
+schedule
+schedules
+scholar
+scholarly
+scholars
+school
+schoolboy
+schoolboys
+schoolfellows
+schooling
+schoolmaster
+schoolmasters
+schools
+sciatica
+sciaticas
+science
+sciences
+scimitar
+scion
+scions
+scissors
+scoff
+scoffer
+scoffing
+scoffs
+scoggin
+scold
+scolding
+scolds
+sconce
+scone
+scope
+scopes
+scorch
+scorched
+score
+scored
+scores
+scoring
+scorn
+scorned
+scornful
+scornfully
+scorning
+scorns
+scorpion
+scorpions
+scot
+scotch
+scotches
+scotland
+scots
+scottish
+scoundrels
+scour
+scoured
+scourg
+scourge
+scouring
+scout
+scouts
+scowl
+scrap
+scrape
+scraping
+scraps
+scratch
+scratches
+scratching
+scream
+screams
+screech
+screeching
+screen
+screens
+screw
+screws
+scribbl
+scribbled
+scribe
+scribes
+scrimers
+scrip
+scrippage
+scripture
+scriptures
+scrivener
+scroll
+scrolls
+scroop
+scrowl
+scroyles
+scrubbed
+scruple
+scruples
+scrupulous
+scuffles
+scuffling
+scullion
+sculls
+scum
+scurril
+scurrility
+scurrilous
+scurvy
+scuse
+scut
+scutcheon
+scutcheons
+scylla
+scythe
+scythed
+scythia
+scythian
+sdeath
+se
+sea
+seacoal
+seafaring
+seal
+sealed
+sealing
+seals
+seam
+seamen
+seamy
+seaport
+sear
+searce
+search
+searchers
+searches
+searcheth
+searching
+seared
+seas
+seasick
+seaside
+season
+seasoned
+seasons
+seat
+seated
+seats
+sebastian
+second
+secondarily
+secondary
+seconded
+seconds
+secrecy
+secret
+secretaries
+secretary
+secretly
+secrets
+sect
+sectary
+sects
+secundo
+secure
+securely
+securing
+security
+sedg
+sedge
+sedges
+sedgy
+sedition
+seditious
+seduc
+seduce
+seduced
+seducer
+seducing
+see
+seed
+seeded
+seedness
+seeds
+seedsman
+seein
+seeing
+seek
+seeking
+seeks
+seel
+seeling
+seely
+seem
+seemed
+seemers
+seemest
+seemeth
+seeming
+seemingly
+seemly
+seems
+seen
+seer
+sees
+seese
+seest
+seethe
+seethes
+seething
+seeting
+segregation
+seigneur
+seigneurs
+seiz
+seize
+seized
+seizes
+seizeth
+seizing
+seizure
+seld
+seldom
+select
+seleucus
+self
+selfsame
+sell
+seller
+selling
+sells
+selves
+semblable
+semblably
+semblance
+semblances
+semblative
+semi
+semicircle
+semiramis
+semper
+sempronius
+senate
+senator
+senators
+send
+sender
+sendeth
+sending
+sends
+seneca
+senior
+seniory
+senis
+sennet
+senoys
+sense
+senseless
+senses
+sensible
+sensibly
+sensual
+sensuality
+sent
+sentenc
+sentence
+sentences
+sententious
+sentinel
+sentinels
+separable
+separate
+separated
+separates
+separation
+septentrion
+sepulchre
+sepulchres
+sepulchring
+sequel
+sequence
+sequent
+sequest
+sequester
+sequestration
+sere
+serenis
+serge
+sergeant
+serious
+seriously
+sermon
+sermons
+serpent
+serpentine
+serpents
+serpigo
+serv
+servant
+servanted
+servants
+serve
+served
+server
+serves
+serveth
+service
+serviceable
+services
+servile
+servility
+servilius
+serving
+servingman
+servingmen
+serviteur
+servitor
+servitors
+servitude
+sessa
+session
+sessions
+sestos
+set
+setebos
+sets
+setter
+setting
+settle
+settled
+settlest
+settling
+sev
+seven
+sevenfold
+sevennight
+seventeen
+seventh
+seventy
+sever
+several
+severally
+severals
+severe
+severed
+severely
+severest
+severing
+severity
+severn
+severs
+sew
+seward
+sewer
+sewing
+sex
+sexes
+sexton
+sextus
+seymour
+seyton
+sfoot
+sh
+shackle
+shackles
+shade
+shades
+shadow
+shadowed
+shadowing
+shadows
+shadowy
+shady
+shafalus
+shaft
+shafts
+shag
+shak
+shake
+shaked
+shaken
+shakes
+shaking
+shales
+shall
+shallenge
+shallow
+shallowest
+shallowly
+shallows
+shalt
+sham
+shambles
+shame
+shamed
+shameful
+shamefully
+shameless
+shames
+shamest
+shaming
+shank
+shanks
+shap
+shape
+shaped
+shapeless
+shapen
+shapes
+shaping
+shar
+shard
+sharded
+shards
+share
+shared
+sharers
+shares
+sharing
+shark
+sharp
+sharpen
+sharpened
+sharpens
+sharper
+sharpest
+sharply
+sharpness
+sharps
+shatter
+shav
+shave
+shaven
+shaw
+she
+sheaf
+sheal
+shear
+shearers
+shearing
+shearman
+shears
+sheath
+sheathe
+sheathed
+sheathes
+sheathing
+sheaved
+sheaves
+shed
+shedding
+sheds
+sheen
+sheep
+sheepcote
+sheepcotes
+sheeps
+sheepskins
+sheer
+sheet
+sheeted
+sheets
+sheffield
+shelf
+shell
+shells
+shelt
+shelter
+shelters
+shelves
+shelving
+shelvy
+shent
+shepherd
+shepherdes
+shepherdess
+shepherdesses
+shepherds
+sher
+sheriff
+sherris
+shes
+sheweth
+shield
+shielded
+shields
+shift
+shifted
+shifting
+shifts
+shilling
+shillings
+shin
+shine
+shines
+shineth
+shining
+shins
+shiny
+ship
+shipboard
+shipman
+shipmaster
+shipmen
+shipp
+shipped
+shipping
+ships
+shipt
+shipwreck
+shipwrecking
+shipwright
+shipwrights
+shire
+shirley
+shirt
+shirts
+shive
+shiver
+shivering
+shivers
+shoal
+shoals
+shock
+shocks
+shod
+shoe
+shoeing
+shoemaker
+shoes
+shog
+shone
+shook
+shoon
+shoot
+shooter
+shootie
+shooting
+shoots
+shop
+shops
+shore
+shores
+shorn
+short
+shortcake
+shorten
+shortened
+shortens
+shorter
+shortly
+shortness
+shot
+shotten
+shoughs
+should
+shoulder
+shouldering
+shoulders
+shouldst
+shout
+shouted
+shouting
+shouts
+shov
+shove
+shovel
+shovels
+show
+showed
+shower
+showers
+showest
+showing
+shown
+shows
+shreds
+shrew
+shrewd
+shrewdly
+shrewdness
+shrewish
+shrewishly
+shrewishness
+shrews
+shrewsbury
+shriek
+shrieking
+shrieks
+shrieve
+shrift
+shrill
+shriller
+shrills
+shrilly
+shrimp
+shrine
+shrink
+shrinking
+shrinks
+shriv
+shrive
+shriver
+shrives
+shriving
+shroud
+shrouded
+shrouding
+shrouds
+shrove
+shrow
+shrows
+shrub
+shrubs
+shrug
+shrugs
+shrunk
+shudd
+shudders
+shuffl
+shuffle
+shuffled
+shuffling
+shun
+shunless
+shunn
+shunned
+shunning
+shuns
+shut
+shuts
+shuttle
+shy
+shylock
+si
+sibyl
+sibylla
+sibyls
+sicil
+sicilia
+sicilian
+sicilius
+sicils
+sicily
+sicinius
+sick
+sicken
+sickens
+sicker
+sickle
+sicklemen
+sicklied
+sickliness
+sickly
+sickness
+sicles
+sicyon
+side
+sided
+sides
+siege
+sieges
+sienna
+sies
+sieve
+sift
+sifted
+sigeia
+sigh
+sighed
+sighing
+sighs
+sight
+sighted
+sightless
+sightly
+sights
+sign
+signal
+signet
+signieur
+significant
+significants
+signified
+signifies
+signify
+signifying
+signior
+signiories
+signiors
+signiory
+signor
+signories
+signs
+signum
+silenc
+silence
+silenced
+silencing
+silent
+silently
+silius
+silk
+silken
+silkman
+silks
+silliest
+silliness
+silling
+silly
+silva
+silver
+silvered
+silverly
+silvia
+silvius
+sima
+simile
+similes
+simois
+simon
+simony
+simp
+simpcox
+simple
+simpleness
+simpler
+simples
+simplicity
+simply
+simular
+simulation
+sin
+since
+sincere
+sincerely
+sincerity
+sinel
+sinew
+sinewed
+sinews
+sinewy
+sinful
+sinfully
+sing
+singe
+singeing
+singer
+singes
+singeth
+singing
+single
+singled
+singleness
+singly
+sings
+singular
+singulariter
+singularities
+singularity
+singuled
+sinister
+sink
+sinking
+sinks
+sinn
+sinner
+sinners
+sinning
+sinon
+sins
+sip
+sipping
+sir
+sire
+siren
+sirrah
+sirs
+sist
+sister
+sisterhood
+sisterly
+sisters
+sit
+sith
+sithence
+sits
+sitting
+situate
+situation
+situations
+siward
+six
+sixpence
+sixpences
+sixpenny
+sixteen
+sixth
+sixty
+siz
+size
+sizes
+sizzle
+skains
+skamble
+skein
+skelter
+skies
+skilful
+skilfully
+skill
+skilless
+skillet
+skillful
+skills
+skim
+skimble
+skin
+skinker
+skinny
+skins
+skip
+skipp
+skipper
+skipping
+skirmish
+skirmishes
+skirr
+skirted
+skirts
+skittish
+skulking
+skull
+skulls
+sky
+skyey
+skyish
+slab
+slack
+slackly
+slackness
+slain
+slake
+sland
+slander
+slandered
+slanderer
+slanderers
+slandering
+slanderous
+slanders
+slash
+slaught
+slaughter
+slaughtered
+slaughterer
+slaughterman
+slaughtermen
+slaughterous
+slaughters
+slave
+slaver
+slavery
+slaves
+slavish
+slay
+slayeth
+slaying
+slays
+sleave
+sledded
+sleek
+sleekly
+sleep
+sleeper
+sleepers
+sleepest
+sleeping
+sleeps
+sleepy
+sleeve
+sleeves
+sleid
+sleided
+sleight
+sleights
+slender
+slenderer
+slenderly
+slept
+slew
+slewest
+slice
+slid
+slide
+slides
+sliding
+slight
+slighted
+slightest
+slightly
+slightness
+slights
+slily
+slime
+slimy
+slings
+slink
+slip
+slipp
+slipper
+slippers
+slippery
+slips
+slish
+slit
+sliver
+slobb
+slomber
+slop
+slope
+slops
+sloth
+slothful
+slough
+slovenly
+slovenry
+slow
+slower
+slowly
+slowness
+slubber
+slug
+sluggard
+sluggardiz
+sluggish
+sluic
+slumb
+slumber
+slumbers
+slumbery
+slunk
+slut
+sluts
+sluttery
+sluttish
+sluttishness
+sly
+slys
+smack
+smacking
+smacks
+small
+smaller
+smallest
+smallness
+smalus
+smart
+smarting
+smartly
+smatch
+smatter
+smear
+smell
+smelling
+smells
+smelt
+smil
+smile
+smiled
+smiles
+smilest
+smilets
+smiling
+smilingly
+smirch
+smirched
+smit
+smite
+smites
+smith
+smithfield
+smock
+smocks
+smok
+smoke
+smoked
+smokes
+smoking
+smoky
+smooth
+smoothed
+smoothing
+smoothly
+smoothness
+smooths
+smote
+smoth
+smother
+smothered
+smothering
+smug
+smulkin
+smutch
+snaffle
+snail
+snails
+snake
+snakes
+snaky
+snap
+snapp
+snapper
+snar
+snare
+snares
+snarl
+snarleth
+snarling
+snatch
+snatchers
+snatches
+snatching
+sneak
+sneaking
+sneap
+sneaping
+sneck
+snip
+snipe
+snipt
+snore
+snores
+snoring
+snorting
+snout
+snow
+snowballs
+snowed
+snowy
+snuff
+snuffs
+snug
+so
+soak
+soaking
+soaks
+soar
+soaring
+soars
+sob
+sobbing
+sober
+soberly
+sobriety
+sobs
+sociable
+societies
+society
+socks
+socrates
+sod
+sodden
+soe
+soever
+soft
+soften
+softens
+softer
+softest
+softly
+softness
+soil
+soiled
+soilure
+soit
+sojourn
+sol
+sola
+solace
+solanio
+sold
+soldat
+solder
+soldest
+soldier
+soldiers
+soldiership
+sole
+solely
+solem
+solemn
+solemness
+solemnities
+solemnity
+solemniz
+solemnize
+solemnized
+solemnly
+soles
+solicit
+solicitation
+solicited
+soliciting
+solicitings
+solicitor
+solicits
+solid
+solidares
+solidity
+solinus
+solitary
+solomon
+solon
+solum
+solus
+solyman
+some
+somebody
+someone
+somerset
+somerville
+something
+sometime
+sometimes
+somever
+somewhat
+somewhere
+somewhither
+somme
+son
+sonance
+song
+songs
+sonnet
+sonneting
+sonnets
+sons
+sont
+sonties
+soon
+sooner
+soonest
+sooth
+soothe
+soothers
+soothing
+soothsay
+soothsayer
+sooty
+sop
+sophister
+sophisticated
+sophy
+sops
+sorcerer
+sorcerers
+sorceress
+sorceries
+sorcery
+sore
+sorel
+sorely
+sorer
+sores
+sorrier
+sorriest
+sorrow
+sorrowed
+sorrowest
+sorrowful
+sorrowing
+sorrows
+sorry
+sort
+sortance
+sorted
+sorting
+sorts
+sossius
+sot
+soto
+sots
+sottish
+soud
+sought
+soul
+sould
+soulless
+souls
+sound
+sounded
+sounder
+soundest
+sounding
+soundless
+soundly
+soundness
+soundpost
+sounds
+sour
+source
+sources
+sourest
+sourly
+sours
+sous
+souse
+south
+southam
+southampton
+southerly
+southern
+southward
+southwark
+southwell
+souviendrai
+sov
+sovereign
+sovereignest
+sovereignly
+sovereignty
+sovereignvours
+sow
+sowing
+sowl
+sowter
+space
+spaces
+spacious
+spade
+spades
+spain
+spak
+spake
+spakest
+span
+spangle
+spangled
+spaniard
+spaniel
+spaniels
+spanish
+spann
+spans
+spar
+spare
+spares
+sparing
+sparingly
+spark
+sparkle
+sparkles
+sparkling
+sparks
+sparrow
+sparrows
+sparta
+spartan
+spavin
+spavins
+spawn
+speak
+speaker
+speakers
+speakest
+speaketh
+speaking
+speaks
+spear
+speargrass
+spears
+special
+specialities
+specially
+specialties
+specialty
+specify
+speciously
+spectacle
+spectacled
+spectacles
+spectators
+spectatorship
+speculation
+speculations
+speculative
+sped
+speech
+speeches
+speechless
+speed
+speeded
+speedier
+speediest
+speedily
+speediness
+speeding
+speeds
+speedy
+speens
+spell
+spelling
+spells
+spelt
+spencer
+spend
+spendest
+spending
+spends
+spendthrift
+spent
+sperato
+sperm
+spero
+sperr
+spher
+sphere
+sphered
+spheres
+spherical
+sphery
+sphinx
+spice
+spiced
+spicery
+spices
+spider
+spiders
+spied
+spies
+spieth
+spightfully
+spigot
+spill
+spilling
+spills
+spilt
+spilth
+spin
+spinii
+spinners
+spinster
+spinsters
+spire
+spirit
+spirited
+spiritless
+spirits
+spiritual
+spiritualty
+spirt
+spit
+spital
+spite
+spited
+spiteful
+spites
+spits
+spitted
+spitting
+splay
+spleen
+spleenful
+spleens
+spleeny
+splendour
+splenitive
+splinter
+splinters
+split
+splits
+splitted
+splitting
+spoil
+spoils
+spok
+spoke
+spoken
+spokes
+spokesman
+sponge
+spongy
+spoon
+spoons
+sport
+sportful
+sporting
+sportive
+sports
+spot
+spotless
+spots
+spotted
+spousal
+spouse
+spout
+spouting
+spouts
+sprag
+sprang
+sprat
+sprawl
+spray
+sprays
+spread
+spreading
+spreads
+sprighted
+sprightful
+sprightly
+sprigs
+spring
+springe
+springes
+springeth
+springhalt
+springing
+springs
+springtime
+sprinkle
+sprinkles
+sprite
+sprited
+spritely
+sprites
+spriting
+sprout
+spruce
+sprung
+spun
+spur
+spurio
+spurn
+spurns
+spurr
+spurrer
+spurring
+spurs
+spy
+spying
+squabble
+squadron
+squadrons
+squand
+squar
+square
+squarer
+squares
+squash
+squeak
+squeaking
+squeal
+squealing
+squeezes
+squeezing
+squele
+squier
+squints
+squiny
+squire
+squires
+squirrel
+st
+stab
+stabb
+stabbed
+stabbing
+stable
+stableness
+stables
+stablish
+stablishment
+stabs
+stacks
+staff
+stafford
+staffords
+staffordshire
+stag
+stage
+stages
+stagger
+staggering
+staggers
+stags
+staid
+staider
+stain
+stained
+staines
+staineth
+staining
+stainless
+stains
+stair
+stairs
+stake
+stakes
+stale
+staled
+stalk
+stalking
+stalks
+stall
+stalling
+stalls
+stamford
+stammer
+stamp
+stamped
+stamps
+stanch
+stanchless
+stand
+standard
+standards
+stander
+standers
+standest
+standeth
+standing
+stands
+staniel
+stanley
+stanze
+stanzo
+stanzos
+staple
+staples
+star
+stare
+stared
+stares
+staring
+starings
+stark
+starkly
+starlight
+starling
+starr
+starry
+stars
+start
+started
+starting
+startingly
+startle
+startles
+starts
+starv
+starve
+starved
+starvelackey
+starveling
+starveth
+starving
+state
+statelier
+stately
+states
+statesman
+statesmen
+statilius
+station
+statist
+statists
+statue
+statues
+stature
+statures
+statute
+statutes
+stave
+staves
+stay
+stayed
+stayest
+staying
+stays
+stead
+steaded
+steadfast
+steadier
+steads
+steal
+stealer
+stealers
+stealing
+steals
+stealth
+stealthy
+steed
+steeds
+steel
+steeled
+steely
+steep
+steeped
+steeple
+steeples
+steeps
+steepy
+steer
+steerage
+steering
+steers
+stelled
+stem
+stemming
+stench
+step
+stepdame
+stephano
+stephen
+stepmothers
+stepp
+stepping
+steps
+sterile
+sterility
+sterling
+stern
+sternage
+sterner
+sternest
+sternness
+steterat
+stew
+steward
+stewards
+stewardship
+stewed
+stews
+stick
+sticking
+stickler
+sticks
+stiff
+stiffen
+stiffly
+stifle
+stifled
+stifles
+stigmatic
+stigmatical
+stile
+still
+stiller
+stillest
+stillness
+stilly
+sting
+stinging
+stingless
+stings
+stink
+stinking
+stinkingly
+stinks
+stint
+stinted
+stints
+stir
+stirr
+stirred
+stirrer
+stirrers
+stirreth
+stirring
+stirrup
+stirrups
+stirs
+stitchery
+stitches
+stithied
+stithy
+stoccadoes
+stoccata
+stock
+stockfish
+stocking
+stockings
+stockish
+stocks
+stog
+stogs
+stoics
+stokesly
+stol
+stole
+stolen
+stolest
+stomach
+stomachers
+stomaching
+stomachs
+ston
+stone
+stonecutter
+stones
+stonish
+stony
+stood
+stool
+stools
+stoop
+stooping
+stoops
+stop
+stope
+stopp
+stopped
+stopping
+stops
+stor
+store
+storehouse
+storehouses
+stores
+stories
+storm
+stormed
+storming
+storms
+stormy
+story
+stoup
+stoups
+stout
+stouter
+stoutly
+stoutness
+stover
+stow
+stowage
+stowed
+strachy
+stragglers
+straggling
+straight
+straightest
+straightway
+strain
+strained
+straining
+strains
+strait
+straited
+straiter
+straitly
+straitness
+straits
+strand
+strange
+strangely
+strangeness
+stranger
+strangers
+strangest
+strangle
+strangled
+strangler
+strangles
+strangling
+strappado
+straps
+stratagem
+stratagems
+stratford
+strato
+straw
+strawberries
+strawberry
+straws
+strawy
+stray
+straying
+strays
+streak
+streaks
+stream
+streamers
+streaming
+streams
+streching
+street
+streets
+strength
+strengthen
+strengthened
+strengthless
+strengths
+stretch
+stretched
+stretches
+stretching
+strew
+strewing
+strewings
+strewments
+stricken
+strict
+stricter
+strictest
+strictly
+stricture
+stride
+strides
+striding
+strife
+strifes
+strik
+strike
+strikers
+strikes
+strikest
+striking
+string
+stringless
+strings
+strip
+stripes
+stripling
+striplings
+stripp
+stripping
+striv
+strive
+strives
+striving
+strok
+stroke
+strokes
+strond
+stronds
+strong
+stronger
+strongest
+strongly
+strooke
+strossers
+strove
+strown
+stroy
+struck
+strucken
+struggle
+struggles
+struggling
+strumpet
+strumpeted
+strumpets
+strung
+strut
+struts
+strutted
+strutting
+stubble
+stubborn
+stubbornest
+stubbornly
+stubbornness
+stuck
+studded
+student
+students
+studied
+studies
+studious
+studiously
+studs
+study
+studying
+stuff
+stuffing
+stuffs
+stumble
+stumbled
+stumblest
+stumbling
+stump
+stumps
+stung
+stupefy
+stupid
+stupified
+stuprum
+sturdy
+sty
+styga
+stygian
+styl
+style
+styx
+su
+sub
+subcontracted
+subdu
+subdue
+subdued
+subduements
+subdues
+subduing
+subject
+subjected
+subjection
+subjects
+submerg
+submission
+submissive
+submit
+submits
+submitting
+suborn
+subornation
+suborned
+subscrib
+subscribe
+subscribed
+subscribes
+subscription
+subsequent
+subsidies
+subsidy
+subsist
+subsisting
+substance
+substances
+substantial
+substitute
+substituted
+substitutes
+substitution
+subtile
+subtilly
+subtle
+subtleties
+subtlety
+subtly
+subtractors
+suburbs
+subversion
+subverts
+succedant
+succeed
+succeeded
+succeeders
+succeeding
+succeeds
+success
+successantly
+successes
+successful
+successfully
+succession
+successive
+successively
+successor
+successors
+succour
+succours
+such
+suck
+sucker
+suckers
+sucking
+suckle
+sucks
+sudden
+suddenly
+sue
+sued
+suerly
+sues
+sueth
+suff
+suffer
+sufferance
+sufferances
+suffered
+suffering
+suffers
+suffic
+suffice
+sufficed
+suffices
+sufficeth
+sufficiency
+sufficient
+sufficiently
+sufficing
+sufficit
+suffigance
+suffocate
+suffocating
+suffocation
+suffolk
+suffrage
+suffrages
+sug
+sugar
+sugarsop
+suggest
+suggested
+suggesting
+suggestion
+suggestions
+suggests
+suis
+suit
+suitable
+suited
+suiting
+suitor
+suitors
+suits
+suivez
+sullen
+sullens
+sullied
+sullies
+sully
+sulph
+sulpherous
+sulphur
+sulphurous
+sultan
+sultry
+sum
+sumless
+summ
+summa
+summary
+summer
+summers
+summit
+summon
+summoners
+summons
+sumpter
+sumptuous
+sumptuously
+sums
+sun
+sunbeams
+sunburning
+sunburnt
+sund
+sunday
+sundays
+sunder
+sunders
+sundry
+sung
+sunk
+sunken
+sunny
+sunrising
+suns
+sunset
+sunshine
+sup
+super
+superficial
+superficially
+superfluity
+superfluous
+superfluously
+superflux
+superior
+supernal
+supernatural
+superpraise
+superscript
+superscription
+superserviceable
+superstition
+superstitious
+superstitiously
+supersubtle
+supervise
+supervisor
+supp
+supper
+suppers
+suppertime
+supping
+supplant
+supple
+suppler
+suppliance
+suppliant
+suppliants
+supplicant
+supplication
+supplications
+supplie
+supplied
+supplies
+suppliest
+supply
+supplyant
+supplying
+supplyment
+support
+supportable
+supportance
+supported
+supporter
+supporters
+supporting
+supportor
+suppos
+supposal
+suppose
+supposed
+supposes
+supposest
+supposing
+supposition
+suppress
+suppressed
+suppresseth
+supremacy
+supreme
+sups
+sur
+surance
+surcease
+surd
+sure
+surecard
+surely
+surer
+surest
+sureties
+surety
+surfeit
+surfeited
+surfeiter
+surfeiting
+surfeits
+surge
+surgeon
+surgeons
+surgere
+surgery
+surges
+surly
+surmis
+surmise
+surmised
+surmises
+surmount
+surmounted
+surmounts
+surnam
+surname
+surnamed
+surpasseth
+surpassing
+surplice
+surplus
+surpris
+surprise
+surprised
+surrender
+surrey
+surreys
+survey
+surveyest
+surveying
+surveyor
+surveyors
+surveys
+survive
+survives
+survivor
+susan
+suspect
+suspected
+suspecting
+suspects
+suspend
+suspense
+suspicion
+suspicions
+suspicious
+suspiration
+suspire
+sust
+sustain
+sustaining
+sutler
+sutton
+suum
+swabber
+swaddling
+swag
+swagg
+swagger
+swaggerer
+swaggerers
+swaggering
+swain
+swains
+swallow
+swallowed
+swallowing
+swallows
+swam
+swan
+swans
+sward
+sware
+swarm
+swarming
+swart
+swarth
+swarths
+swarthy
+swashers
+swashing
+swath
+swathing
+swathling
+sway
+swaying
+sways
+swear
+swearer
+swearers
+swearest
+swearing
+swearings
+swears
+sweat
+sweaten
+sweating
+sweats
+sweaty
+sweep
+sweepers
+sweeps
+sweet
+sweeten
+sweetens
+sweeter
+sweetest
+sweetheart
+sweeting
+sweetly
+sweetmeats
+sweetness
+sweets
+swell
+swelling
+swellings
+swells
+swelter
+sweno
+swept
+swerve
+swerver
+swerving
+swift
+swifter
+swiftest
+swiftly
+swiftness
+swill
+swills
+swim
+swimmer
+swimmers
+swimming
+swims
+swine
+swineherds
+swing
+swinge
+swinish
+swinstead
+switches
+swits
+switzers
+swol
+swoll
+swoln
+swoon
+swooned
+swooning
+swoons
+swoop
+swoopstake
+swor
+sword
+sworder
+swords
+swore
+sworn
+swounded
+swounds
+swum
+swung
+sy
+sycamore
+sycorax
+sylla
+syllable
+syllables
+syllogism
+symbols
+sympathise
+sympathiz
+sympathize
+sympathized
+sympathy
+synagogue
+synod
+synods
+syracuse
+syracusian
+syracusians
+syria
+syrups
+t
+ta
+taber
+table
+tabled
+tables
+tablet
+tabor
+taborer
+tabors
+tabourines
+taciturnity
+tack
+tackle
+tackled
+tackles
+tackling
+tacklings
+taddle
+tadpole
+taffeta
+taffety
+tag
+tagrag
+tah
+tail
+tailor
+tailors
+tails
+taint
+tainted
+tainting
+taints
+tainture
+tak
+take
+taken
+taker
+takes
+takest
+taketh
+taking
+tal
+talbot
+talbotites
+talbots
+tale
+talent
+talents
+taleporter
+tales
+talk
+talked
+talker
+talkers
+talkest
+talking
+talks
+tall
+taller
+tallest
+tallies
+tallow
+tally
+talons
+tam
+tambourines
+tame
+tamed
+tamely
+tameness
+tamer
+tames
+taming
+tamora
+tamworth
+tan
+tang
+tangle
+tangled
+tank
+tanlings
+tann
+tanned
+tanner
+tanquam
+tanta
+tantaene
+tap
+tape
+taper
+tapers
+tapestries
+tapestry
+taphouse
+tapp
+tapster
+tapsters
+tar
+tardied
+tardily
+tardiness
+tardy
+tarentum
+targe
+targes
+target
+targets
+tarpeian
+tarquin
+tarquins
+tarr
+tarre
+tarriance
+tarried
+tarries
+tarry
+tarrying
+tart
+tartar
+tartars
+tartly
+tartness
+task
+tasker
+tasking
+tasks
+tassel
+taste
+tasted
+tastes
+tasting
+tatt
+tatter
+tattered
+tatters
+tattle
+tattling
+tattlings
+taught
+taunt
+taunted
+taunting
+tauntingly
+taunts
+taurus
+tavern
+taverns
+tavy
+tawdry
+tawny
+tax
+taxation
+taxations
+taxes
+taxing
+tc
+te
+teach
+teacher
+teachers
+teaches
+teachest
+teacheth
+teaching
+team
+tear
+tearful
+tearing
+tears
+tearsheet
+teat
+tedious
+tediously
+tediousness
+teem
+teeming
+teems
+teen
+teeth
+teipsum
+telamon
+telamonius
+tell
+teller
+telling
+tells
+tellus
+temp
+temper
+temperality
+temperance
+temperate
+temperately
+tempers
+tempest
+tempests
+tempestuous
+temple
+temples
+temporal
+temporary
+temporiz
+temporize
+temporizer
+temps
+tempt
+temptation
+temptations
+tempted
+tempter
+tempters
+tempteth
+tempting
+tempts
+ten
+tenable
+tenant
+tenantius
+tenantless
+tenants
+tench
+tend
+tendance
+tended
+tender
+tendered
+tenderly
+tenderness
+tenders
+tending
+tends
+tenedos
+tenement
+tenements
+tenfold
+tennis
+tenour
+tenours
+tens
+tent
+tented
+tenth
+tenths
+tents
+tenure
+tenures
+tercel
+tereus
+term
+termagant
+termed
+terminations
+termless
+terms
+terra
+terrace
+terram
+terras
+terre
+terrene
+terrestrial
+terrible
+terribly
+territories
+territory
+terror
+terrors
+tertian
+tertio
+test
+testament
+tested
+tester
+testern
+testify
+testimonied
+testimonies
+testimony
+testiness
+testril
+testy
+tetchy
+tether
+tetter
+tevil
+tewksbury
+text
+tgv
+th
+thaes
+thames
+than
+thane
+thanes
+thank
+thanked
+thankful
+thankfully
+thankfulness
+thanking
+thankings
+thankless
+thanks
+thanksgiving
+thasos
+that
+thatch
+thaw
+thawing
+thaws
+the
+theatre
+theban
+thebes
+thee
+theft
+thefts
+thein
+their
+theirs
+theise
+them
+theme
+themes
+themselves
+then
+thence
+thenceforth
+theoric
+there
+thereabout
+thereabouts
+thereafter
+thereat
+thereby
+therefore
+therein
+thereof
+thereon
+thereto
+thereunto
+thereupon
+therewith
+therewithal
+thersites
+these
+theseus
+thessalian
+thessaly
+thetis
+thews
+they
+thick
+thicken
+thickens
+thicker
+thickest
+thicket
+thickskin
+thief
+thievery
+thieves
+thievish
+thigh
+thighs
+thimble
+thimbles
+thin
+thine
+thing
+things
+think
+thinkest
+thinking
+thinkings
+thinks
+thinkst
+thinly
+third
+thirdly
+thirds
+thirst
+thirsting
+thirsts
+thirsty
+thirteen
+thirties
+thirtieth
+thirty
+this
+thisby
+thisne
+thistle
+thistles
+thither
+thitherward
+thoas
+thomas
+thorn
+thorns
+thorny
+thorough
+thoroughly
+those
+thou
+though
+thought
+thoughtful
+thoughts
+thousand
+thousands
+thracian
+thraldom
+thrall
+thralled
+thralls
+thrash
+thrasonical
+thread
+threadbare
+threaden
+threading
+threat
+threaten
+threatening
+threatens
+threatest
+threats
+three
+threefold
+threepence
+threepile
+threes
+threescore
+thresher
+threshold
+threw
+thrice
+thrift
+thriftless
+thrifts
+thrifty
+thrill
+thrilling
+thrills
+thrive
+thrived
+thrivers
+thrives
+thriving
+throat
+throats
+throbbing
+throbs
+throca
+throe
+throes
+thromuldo
+thron
+throne
+throned
+thrones
+throng
+thronging
+throngs
+throstle
+throttle
+through
+throughfare
+throughfares
+throughly
+throughout
+throw
+thrower
+throwest
+throwing
+thrown
+throws
+thrum
+thrumm
+thrush
+thrust
+thrusteth
+thrusting
+thrusts
+thumb
+thumbs
+thump
+thund
+thunder
+thunderbolt
+thunderbolts
+thunderer
+thunders
+thunderstone
+thunderstroke
+thurio
+thursday
+thus
+thwack
+thwart
+thwarted
+thwarting
+thwartings
+thy
+thyme
+thymus
+thyreus
+thyself
+ti
+tib
+tiber
+tiberio
+tibey
+ticed
+tick
+tickl
+tickle
+tickled
+tickles
+tickling
+ticklish
+tiddle
+tide
+tides
+tidings
+tidy
+tie
+tied
+ties
+tiff
+tiger
+tigers
+tight
+tightly
+tike
+til
+tile
+till
+tillage
+tilly
+tilt
+tilter
+tilth
+tilting
+tilts
+tiltyard
+tim
+timandra
+timber
+time
+timeless
+timelier
+timely
+times
+timon
+timor
+timorous
+timorously
+tinct
+tincture
+tinctures
+tinder
+tingling
+tinker
+tinkers
+tinsel
+tiny
+tip
+tipp
+tippling
+tips
+tipsy
+tiptoe
+tir
+tire
+tired
+tires
+tirest
+tiring
+tirra
+tirrits
+tis
+tish
+tisick
+tissue
+titan
+titania
+tithe
+tithed
+tithing
+titinius
+title
+titled
+titleless
+titles
+tittle
+tittles
+titular
+titus
+tn
+to
+toad
+toads
+toadstool
+toast
+toasted
+toasting
+toasts
+toaze
+toby
+tock
+tod
+today
+todpole
+tods
+toe
+toes
+tofore
+toge
+toged
+together
+toil
+toiled
+toiling
+toils
+token
+tokens
+told
+toledo
+tolerable
+toll
+tolling
+tom
+tomb
+tombe
+tombed
+tombless
+tomboys
+tombs
+tomorrow
+tomyris
+ton
+tongs
+tongu
+tongue
+tongued
+tongueless
+tongues
+tonight
+too
+took
+tool
+tools
+tooth
+toothache
+toothpick
+toothpicker
+top
+topas
+topful
+topgallant
+topless
+topmast
+topp
+topping
+topple
+topples
+tops
+topsail
+topsy
+torch
+torchbearer
+torchbearers
+torcher
+torches
+torchlight
+tore
+torment
+tormenta
+tormente
+tormented
+tormenting
+tormentors
+torments
+torn
+torrent
+tortive
+tortoise
+tortur
+torture
+tortured
+torturer
+torturers
+tortures
+torturest
+torturing
+toryne
+toss
+tossed
+tosseth
+tossing
+tot
+total
+totally
+tott
+tottered
+totters
+tou
+touch
+touched
+touches
+toucheth
+touching
+touchstone
+tough
+tougher
+toughness
+touraine
+tournaments
+tours
+tous
+tout
+touze
+tow
+toward
+towardly
+towards
+tower
+towering
+towers
+town
+towns
+township
+townsman
+townsmen
+towton
+toy
+toys
+trace
+traces
+track
+tract
+tractable
+trade
+traded
+traders
+trades
+tradesman
+tradesmen
+trading
+tradition
+traditional
+traduc
+traduced
+traducement
+traffic
+traffickers
+traffics
+tragedian
+tragedians
+tragedies
+tragedy
+tragic
+tragical
+trail
+train
+trained
+training
+trains
+trait
+traitor
+traitorly
+traitorous
+traitorously
+traitors
+traitress
+traject
+trammel
+trample
+trampled
+trampling
+tranc
+trance
+tranio
+tranquil
+tranquillity
+transcendence
+transcends
+transferred
+transfigur
+transfix
+transform
+transformation
+transformations
+transformed
+transgress
+transgresses
+transgressing
+transgression
+translate
+translated
+translates
+translation
+transmigrates
+transmutation
+transparent
+transport
+transportance
+transported
+transporting
+transports
+transpose
+transshape
+trap
+trapp
+trappings
+traps
+trash
+travail
+travails
+travel
+traveler
+traveling
+travell
+travelled
+traveller
+travellers
+travellest
+travelling
+travels
+travers
+traverse
+tray
+treacherous
+treacherously
+treachers
+treachery
+tread
+treading
+treads
+treason
+treasonable
+treasonous
+treasons
+treasure
+treasurer
+treasures
+treasuries
+treasury
+treat
+treaties
+treatise
+treats
+treaty
+treble
+trebled
+trebles
+trebonius
+tree
+trees
+tremble
+trembled
+trembles
+tremblest
+trembling
+tremblingly
+tremor
+trempling
+trench
+trenchant
+trenched
+trencher
+trenchering
+trencherman
+trenchers
+trenches
+trenching
+trent
+tres
+trespass
+trespasses
+tressel
+tresses
+treys
+trial
+trials
+trib
+tribe
+tribes
+tribulation
+tribunal
+tribune
+tribunes
+tributaries
+tributary
+tribute
+tributes
+trice
+trick
+tricking
+trickling
+tricks
+tricksy
+trident
+tried
+trier
+trifle
+trifled
+trifler
+trifles
+trifling
+trigon
+trill
+trim
+trimly
+trimm
+trimmed
+trimming
+trims
+trinculo
+trinculos
+trinkets
+trip
+tripartite
+tripe
+triple
+triplex
+tripoli
+tripolis
+tripp
+tripping
+trippingly
+trips
+tristful
+triton
+triumph
+triumphant
+triumphantly
+triumpher
+triumphers
+triumphing
+triumphs
+triumvir
+triumvirate
+triumvirs
+triumviry
+trivial
+troat
+trod
+trodden
+troiant
+troien
+troilus
+troiluses
+trojan
+trojans
+troll
+tromperies
+trompet
+troop
+trooping
+troops
+trop
+trophies
+trophy
+tropically
+trot
+troth
+trothed
+troths
+trots
+trotting
+trouble
+troubled
+troubler
+troubles
+troublesome
+troublest
+troublous
+trough
+trout
+trouts
+trovato
+trow
+trowel
+trowest
+troy
+troyan
+troyans
+truant
+truce
+truckle
+trudge
+true
+trueborn
+truepenny
+truer
+truest
+truie
+trull
+trulls
+truly
+trump
+trumpery
+trumpet
+trumpeter
+trumpeters
+trumpets
+truncheon
+truncheoners
+trundle
+trunk
+trunks
+trust
+trusted
+truster
+trusters
+trusting
+trusts
+trusty
+truth
+truths
+try
+ts
+tu
+tuae
+tub
+tubal
+tubs
+tuck
+tucket
+tuesday
+tuft
+tufts
+tug
+tugg
+tugging
+tuition
+tullus
+tully
+tumble
+tumbled
+tumbler
+tumbling
+tumult
+tumultuous
+tun
+tune
+tuneable
+tuned
+tuners
+tunes
+tunis
+tuns
+tupping
+turban
+turbans
+turbulence
+turbulent
+turd
+turf
+turfy
+turk
+turkey
+turkeys
+turkish
+turks
+turlygod
+turmoil
+turmoiled
+turn
+turnbull
+turncoat
+turncoats
+turned
+turneth
+turning
+turnips
+turns
+turph
+turpitude
+turquoise
+turret
+turrets
+turtle
+turtles
+turvy
+tuscan
+tush
+tut
+tutor
+tutored
+tutors
+tutto
+twain
+twang
+twangling
+twas
+tway
+tweaks
+tween
+twelfth
+twelve
+twelvemonth
+twentieth
+twenty
+twere
+twice
+twig
+twiggen
+twigs
+twilight
+twill
+twilled
+twin
+twine
+twink
+twinkle
+twinkled
+twinkling
+twinn
+twins
+twire
+twist
+twisted
+twit
+twits
+twitting
+twixt
+two
+twofold
+twopence
+twopences
+twos
+twould
+tyb
+tybalt
+tybalts
+tyburn
+tying
+tyke
+tymbria
+type
+types
+typhon
+tyrannical
+tyrannically
+tyrannize
+tyrannous
+tyranny
+tyrant
+tyrants
+tyrian
+tyrrel
+u
+ubique
+udders
+udge
+uds
+uglier
+ugliest
+ugly
+ulcer
+ulcerous
+ulysses
+um
+umber
+umbra
+umbrage
+umfrevile
+umpire
+umpires
+un
+unable
+unaccommodated
+unaccompanied
+unaccustom
+unaching
+unacquainted
+unactive
+unadvis
+unadvised
+unadvisedly
+unagreeable
+unanel
+unanswer
+unappeas
+unapproved
+unapt
+unaptness
+unarm
+unarmed
+unarms
+unassail
+unassailable
+unattainted
+unattempted
+unattended
+unauspicious
+unauthorized
+unavoided
+unawares
+unback
+unbak
+unbanded
+unbar
+unbarb
+unbashful
+unbated
+unbatter
+unbecoming
+unbefitting
+unbegot
+unbegotten
+unbelieved
+unbend
+unbent
+unbewail
+unbid
+unbidden
+unbind
+unbinds
+unbitted
+unbless
+unblest
+unbloodied
+unblown
+unbodied
+unbolt
+unbolted
+unbonneted
+unbookish
+unborn
+unbosom
+unbound
+unbounded
+unbow
+unbowed
+unbrac
+unbraced
+unbraided
+unbreathed
+unbred
+unbreech
+unbridled
+unbroke
+unbruis
+unbruised
+unbuckle
+unbuckles
+unbuckling
+unbuild
+unburden
+unburdens
+unburied
+unburnt
+unburthen
+unbutton
+unbuttoning
+uncapable
+uncape
+uncase
+uncasing
+uncaught
+uncertain
+uncertainty
+unchain
+unchanging
+uncharge
+uncharged
+uncharitably
+unchary
+unchaste
+uncheck
+unchilded
+uncivil
+unclaim
+unclasp
+uncle
+unclean
+uncleanliness
+uncleanly
+uncleanness
+uncles
+unclew
+unclog
+uncoined
+uncolted
+uncomeliness
+uncomfortable
+uncompassionate
+uncomprehensive
+unconfinable
+unconfirm
+unconfirmed
+unconquer
+unconquered
+unconsidered
+unconstant
+unconstrain
+unconstrained
+uncontemn
+uncontroll
+uncorrected
+uncounted
+uncouple
+uncourteous
+uncouth
+uncover
+uncovered
+uncropped
+uncross
+uncrown
+unction
+unctuous
+uncuckolded
+uncurable
+uncurbable
+uncurbed
+uncurls
+uncurrent
+uncurse
+undaunted
+undeaf
+undeck
+undeeded
+under
+underbearing
+underborne
+undercrest
+underfoot
+undergo
+undergoes
+undergoing
+undergone
+underground
+underhand
+underlings
+undermine
+underminers
+underneath
+underprizing
+underprop
+understand
+understandeth
+understanding
+understandings
+understands
+understood
+underta
+undertake
+undertakeing
+undertaker
+undertakes
+undertaking
+undertakings
+undertook
+undervalu
+undervalued
+underwent
+underwrit
+underwrite
+undescried
+undeserved
+undeserver
+undeservers
+undeserving
+undetermin
+undid
+undinted
+undiscernible
+undiscover
+undishonoured
+undispos
+undistinguishable
+undistinguished
+undividable
+undivided
+undivulged
+undo
+undoes
+undoing
+undone
+undoubted
+undoubtedly
+undream
+undress
+undressed
+undrown
+unduteous
+undutiful
+une
+uneared
+unearned
+unearthly
+uneasines
+uneasy
+uneath
+uneducated
+uneffectual
+unelected
+unequal
+uneven
+unexamin
+unexecuted
+unexpected
+unexperienc
+unexperient
+unexpressive
+unfair
+unfaithful
+unfallible
+unfam
+unfashionable
+unfasten
+unfather
+unfathered
+unfed
+unfeed
+unfeeling
+unfeigned
+unfeignedly
+unfellowed
+unfelt
+unfenced
+unfilial
+unfill
+unfinish
+unfirm
+unfit
+unfitness
+unfix
+unfledg
+unfold
+unfolded
+unfoldeth
+unfolding
+unfolds
+unfool
+unforc
+unforced
+unforfeited
+unfortified
+unfortunate
+unfought
+unfrequented
+unfriended
+unfurnish
+ungain
+ungalled
+ungart
+ungarter
+ungenitur
+ungentle
+ungentleness
+ungently
+ungird
+ungodly
+ungor
+ungot
+ungotten
+ungovern
+ungracious
+ungrateful
+ungravely
+ungrown
+unguarded
+unguem
+unguided
+unhack
+unhair
+unhallow
+unhallowed
+unhand
+unhandled
+unhandsome
+unhang
+unhappied
+unhappily
+unhappiness
+unhappy
+unhardened
+unharm
+unhatch
+unheard
+unhearts
+unheedful
+unheedfully
+unheedy
+unhelpful
+unhidden
+unholy
+unhop
+unhopefullest
+unhorse
+unhospitable
+unhous
+unhoused
+unhurtful
+unicorn
+unicorns
+unimproved
+uninhabitable
+uninhabited
+unintelligent
+union
+unions
+unite
+united
+unity
+universal
+universe
+universities
+university
+unjointed
+unjust
+unjustice
+unjustly
+unkennel
+unkept
+unkind
+unkindest
+unkindly
+unkindness
+unking
+unkinglike
+unkiss
+unknit
+unknowing
+unknown
+unlace
+unlaid
+unlawful
+unlawfully
+unlearn
+unlearned
+unless
+unlesson
+unletter
+unlettered
+unlick
+unlike
+unlikely
+unlimited
+unlineal
+unlink
+unload
+unloaded
+unloading
+unloads
+unlock
+unlocks
+unlook
+unlooked
+unloos
+unloose
+unlov
+unloving
+unluckily
+unlucky
+unmade
+unmake
+unmanly
+unmann
+unmanner
+unmannerd
+unmannerly
+unmarried
+unmask
+unmasked
+unmasking
+unmasks
+unmast
+unmatch
+unmatchable
+unmatched
+unmeasurable
+unmeet
+unmellowed
+unmerciful
+unmeritable
+unmeriting
+unminded
+unmindfull
+unmingled
+unmitigable
+unmitigated
+unmix
+unmoan
+unmov
+unmoved
+unmoving
+unmuffles
+unmuffling
+unmusical
+unmuzzle
+unmuzzled
+unnatural
+unnaturally
+unnaturalness
+unnecessarily
+unnecessary
+unneighbourly
+unnerved
+unnoble
+unnoted
+unnumb
+unnumber
+unowed
+unpack
+unpaid
+unparagon
+unparallel
+unpartial
+unpath
+unpaved
+unpay
+unpeaceable
+unpeg
+unpeople
+unpeopled
+unperfect
+unperfectness
+unpick
+unpin
+unpink
+unpitied
+unpitifully
+unplagu
+unplausive
+unpleas
+unpleasant
+unpleasing
+unpolicied
+unpolish
+unpolished
+unpolluted
+unpossess
+unpossessing
+unpossible
+unpractis
+unpregnant
+unpremeditated
+unprepar
+unprepared
+unpress
+unprevailing
+unprevented
+unpriz
+unprizable
+unprofitable
+unprofited
+unproper
+unproperly
+unproportion
+unprovide
+unprovided
+unprovident
+unprovokes
+unprun
+unpruned
+unpublish
+unpurged
+unpurpos
+unqualitied
+unqueen
+unquestion
+unquestionable
+unquiet
+unquietly
+unquietness
+unraised
+unrak
+unread
+unready
+unreal
+unreasonable
+unreasonably
+unreclaimed
+unreconciled
+unreconciliable
+unrecounted
+unrecuring
+unregarded
+unregist
+unrelenting
+unremovable
+unremovably
+unreprievable
+unresolv
+unrespected
+unrespective
+unrest
+unrestor
+unrestrained
+unreveng
+unreverend
+unreverent
+unrevers
+unrewarded
+unrighteous
+unrightful
+unripe
+unripp
+unrivall
+unroll
+unroof
+unroosted
+unroot
+unrough
+unruly
+unsafe
+unsaluted
+unsanctified
+unsatisfied
+unsavoury
+unsay
+unscalable
+unscann
+unscarr
+unschool
+unscorch
+unscour
+unscratch
+unseal
+unseam
+unsearch
+unseason
+unseasonable
+unseasonably
+unseasoned
+unseconded
+unsecret
+unseduc
+unseeing
+unseeming
+unseemly
+unseen
+unseminar
+unseparable
+unserviceable
+unset
+unsettle
+unsettled
+unsever
+unsex
+unshak
+unshaked
+unshaken
+unshaped
+unshapes
+unsheath
+unsheathe
+unshorn
+unshout
+unshown
+unshrinking
+unshrubb
+unshunn
+unshunnable
+unsifted
+unsightly
+unsinew
+unsisting
+unskilful
+unskilfully
+unskillful
+unslipping
+unsmirched
+unsoil
+unsolicited
+unsorted
+unsought
+unsound
+unsounded
+unspeak
+unspeakable
+unspeaking
+unsphere
+unspoke
+unspoken
+unspotted
+unsquar
+unstable
+unstaid
+unstain
+unstained
+unstanched
+unstate
+unsteadfast
+unstooping
+unstringed
+unstuff
+unsubstantial
+unsuitable
+unsuiting
+unsullied
+unsunn
+unsur
+unsure
+unsuspected
+unsway
+unswayable
+unswayed
+unswear
+unswept
+unsworn
+untainted
+untalk
+untangle
+untangled
+untasted
+untaught
+untempering
+untender
+untent
+untented
+unthankful
+unthankfulness
+unthink
+unthought
+unthread
+unthrift
+unthrifts
+unthrifty
+untie
+untied
+until
+untimber
+untimely
+untir
+untirable
+untired
+untitled
+unto
+untold
+untouch
+untoward
+untowardly
+untraded
+untrain
+untrained
+untread
+untreasur
+untried
+untrimmed
+untrod
+untrodden
+untroubled
+untrue
+untrussing
+untruth
+untruths
+untucked
+untun
+untune
+untuneable
+untutor
+untutored
+untwine
+unurg
+unus
+unused
+unusual
+unvalued
+unvanquish
+unvarnish
+unveil
+unveiling
+unvenerable
+unvex
+unviolated
+unvirtuous
+unvisited
+unvulnerable
+unwares
+unwarily
+unwash
+unwatch
+unwearied
+unwed
+unwedgeable
+unweeded
+unweighed
+unweighing
+unwelcome
+unwept
+unwhipp
+unwholesome
+unwieldy
+unwilling
+unwillingly
+unwillingness
+unwind
+unwiped
+unwise
+unwisely
+unwish
+unwished
+unwitted
+unwittingly
+unwonted
+unwooed
+unworthier
+unworthiest
+unworthily
+unworthiness
+unworthy
+unwrung
+unyok
+unyoke
+up
+upbraid
+upbraided
+upbraidings
+upbraids
+uphoarded
+uphold
+upholdeth
+upholding
+upholds
+uplift
+uplifted
+upmost
+upon
+upper
+uprear
+upreared
+upright
+uprighteously
+uprightness
+uprise
+uprising
+uproar
+uproars
+uprous
+upshoot
+upshot
+upside
+upspring
+upstairs
+upstart
+upturned
+upward
+upwards
+urchin
+urchinfield
+urchins
+urg
+urge
+urged
+urgent
+urges
+urgest
+urging
+urinal
+urinals
+urine
+urn
+urns
+urs
+ursa
+ursley
+ursula
+urswick
+us
+usage
+usance
+usances
+use
+used
+useful
+useless
+user
+uses
+usest
+useth
+usher
+ushered
+ushering
+ushers
+using
+usual
+usually
+usurer
+usurers
+usuries
+usuring
+usurp
+usurpation
+usurped
+usurper
+usurpers
+usurping
+usurpingly
+usurps
+usury
+ut
+utensil
+utensils
+utility
+utmost
+utt
+utter
+utterance
+uttered
+uttereth
+uttering
+utterly
+uttermost
+utters
+uy
+v
+va
+vacancy
+vacant
+vacation
+vade
+vagabond
+vagabonds
+vagram
+vagrom
+vail
+vailed
+vailing
+vaillant
+vain
+vainer
+vainglory
+vainly
+vainness
+vais
+valanc
+valance
+vale
+valence
+valentine
+valentinus
+valentio
+valeria
+valerius
+vales
+valiant
+valiantly
+valiantness
+validity
+vallant
+valley
+valleys
+vally
+valor
+valorous
+valorously
+valour
+valu
+valuation
+value
+valued
+valueless
+values
+valuing
+vane
+vanish
+vanished
+vanishes
+vanishest
+vanishing
+vanities
+vanity
+vanquish
+vanquished
+vanquisher
+vanquishest
+vanquisheth
+vant
+vantage
+vantages
+vantbrace
+vapians
+vapor
+vaporous
+vapour
+vapours
+vara
+variable
+variance
+variation
+variations
+varied
+variest
+variety
+varld
+varlet
+varletry
+varlets
+varletto
+varnish
+varrius
+varro
+vary
+varying
+vassal
+vassalage
+vassals
+vast
+vastidity
+vasty
+vat
+vater
+vaudemont
+vaughan
+vault
+vaultages
+vaulted
+vaulting
+vaults
+vaulty
+vaumond
+vaunt
+vaunted
+vaunter
+vaunting
+vauntingly
+vaunts
+vauvado
+vaux
+vaward
+ve
+veal
+vede
+vehemence
+vehemency
+vehement
+vehor
+veil
+veiled
+veiling
+vein
+veins
+vell
+velure
+velutus
+velvet
+vendible
+venerable
+venereal
+venetia
+venetian
+venetians
+veneys
+venge
+vengeance
+vengeances
+vengeful
+veni
+venial
+venice
+venison
+venit
+venom
+venomous
+venomously
+vent
+ventages
+vented
+ventidius
+ventricle
+vents
+ventur
+venture
+ventured
+ventures
+venturing
+venturous
+venue
+venus
+venuto
+ver
+verb
+verba
+verbal
+verbatim
+verbosity
+verdict
+verdun
+verdure
+vere
+verefore
+verg
+verge
+vergers
+verges
+verier
+veriest
+verified
+verify
+verily
+veritable
+verite
+verities
+verity
+vermilion
+vermin
+vernon
+verona
+veronesa
+versal
+verse
+verses
+versing
+vert
+very
+vesper
+vessel
+vessels
+vestal
+vestments
+vesture
+vetch
+vetches
+veux
+vex
+vexation
+vexations
+vexed
+vexes
+vexest
+vexeth
+vexing
+vi
+via
+vial
+vials
+viand
+viands
+vic
+vicar
+vice
+vicegerent
+vicentio
+viceroy
+viceroys
+vices
+vici
+vicious
+viciousness
+vict
+victims
+victor
+victoress
+victories
+victorious
+victors
+victory
+victual
+victuall
+victuals
+videlicet
+video
+vides
+videsne
+vidi
+vie
+vied
+vienna
+view
+viewest
+vieweth
+viewing
+viewless
+views
+vigil
+vigilance
+vigilant
+vigitant
+vigour
+vii
+viii
+vile
+vilely
+vileness
+viler
+vilest
+vill
+village
+villager
+villagery
+villages
+villain
+villainies
+villainous
+villainously
+villains
+villainy
+villanies
+villanous
+villany
+villiago
+villian
+villianda
+villians
+vinaigre
+vincentio
+vincere
+vindicative
+vine
+vinegar
+vines
+vineyard
+vineyards
+vint
+vintner
+viol
+viola
+violate
+violated
+violates
+violation
+violator
+violence
+violent
+violenta
+violenteth
+violently
+violet
+violets
+viper
+viperous
+vipers
+vir
+virgilia
+virgin
+virginal
+virginalling
+virginity
+virginius
+virgins
+virgo
+virtue
+virtues
+virtuous
+virtuously
+visag
+visage
+visages
+visard
+viscount
+visible
+visibly
+vision
+visions
+visit
+visitation
+visitations
+visited
+visiting
+visitings
+visitor
+visitors
+visits
+visor
+vita
+vitae
+vital
+vitement
+vitruvio
+vitx
+viva
+vivant
+vive
+vixen
+viz
+vizaments
+vizard
+vizarded
+vizards
+vizor
+vlouting
+vocation
+vocativo
+vocatur
+voce
+voic
+voice
+voices
+void
+voided
+voiding
+voke
+volable
+volant
+volivorco
+volley
+volquessen
+volsce
+volsces
+volscian
+volscians
+volt
+voltemand
+volubility
+voluble
+volume
+volumes
+volumnia
+volumnius
+voluntaries
+voluntary
+voluptuously
+voluptuousness
+vomissement
+vomit
+vomits
+vor
+vore
+vortnight
+vot
+votaries
+votarist
+votarists
+votary
+votre
+vouch
+voucher
+vouchers
+vouches
+vouching
+vouchsaf
+vouchsafe
+vouchsafed
+vouchsafes
+vouchsafing
+voudrais
+vour
+vous
+voutsafe
+vow
+vowed
+vowel
+vowels
+vowing
+vows
+vox
+voyage
+voyages
+vraiment
+vulcan
+vulgar
+vulgarly
+vulgars
+vulgo
+vulnerable
+vulture
+vultures
+vurther
+w
+wad
+waddled
+wade
+waded
+wafer
+waft
+waftage
+wafting
+wafts
+wag
+wage
+wager
+wagers
+wages
+wagging
+waggish
+waggling
+waggon
+waggoner
+wagon
+wagoner
+wags
+wagtail
+wail
+wailful
+wailing
+wails
+wain
+wainropes
+wainscot
+waist
+wait
+waited
+waiter
+waiteth
+waiting
+waits
+wak
+wake
+waked
+wakefield
+waken
+wakened
+wakes
+wakest
+waking
+wales
+walk
+walked
+walking
+walks
+wall
+walled
+wallet
+wallets
+wallon
+walloon
+wallow
+walls
+walnut
+walter
+wan
+wand
+wander
+wanderer
+wanderers
+wandering
+wanders
+wands
+wane
+waned
+wanes
+waning
+wann
+want
+wanted
+wanteth
+wanting
+wanton
+wantonly
+wantonness
+wantons
+wants
+wappen
+war
+warble
+warbling
+ward
+warded
+warden
+warder
+warders
+wardrobe
+wardrop
+wards
+ware
+wares
+warily
+warkworth
+warlike
+warm
+warmed
+warmer
+warming
+warms
+warmth
+warn
+warned
+warning
+warnings
+warns
+warp
+warped
+warr
+warrant
+warranted
+warranteth
+warrantise
+warrantize
+warrants
+warranty
+warren
+warrener
+warring
+warrior
+warriors
+wars
+wart
+warwick
+warwickshire
+wary
+was
+wash
+washed
+washer
+washes
+washford
+washing
+wasp
+waspish
+wasps
+wassail
+wassails
+wast
+waste
+wasted
+wasteful
+wasters
+wastes
+wasting
+wat
+watch
+watched
+watchers
+watches
+watchful
+watching
+watchings
+watchman
+watchmen
+watchword
+water
+waterdrops
+watered
+waterfly
+waterford
+watering
+waterish
+waterpots
+waterrugs
+waters
+waterton
+watery
+wav
+wave
+waved
+waver
+waverer
+wavering
+waves
+waving
+waw
+wawl
+wax
+waxed
+waxen
+waxes
+waxing
+way
+waylaid
+waylay
+ways
+wayward
+waywarder
+waywardness
+we
+weak
+weaken
+weakens
+weaker
+weakest
+weakling
+weakly
+weakness
+weal
+wealsmen
+wealth
+wealthiest
+wealthily
+wealthy
+wealtlly
+wean
+weapon
+weapons
+wear
+wearer
+wearers
+wearied
+wearies
+weariest
+wearily
+weariness
+wearing
+wearisome
+wears
+weary
+weasel
+weather
+weathercock
+weathers
+weav
+weave
+weaver
+weavers
+weaves
+weaving
+web
+wed
+wedded
+wedding
+wedg
+wedged
+wedges
+wedlock
+wednesday
+weed
+weeded
+weeder
+weeding
+weeds
+weedy
+week
+weeke
+weekly
+weeks
+ween
+weening
+weep
+weeper
+weeping
+weepingly
+weepings
+weeps
+weet
+weigh
+weighed
+weighing
+weighs
+weight
+weightier
+weightless
+weights
+weighty
+weird
+welcom
+welcome
+welcomer
+welcomes
+welcomest
+welfare
+welkin
+well
+wells
+welsh
+welshman
+welshmen
+welshwomen
+wench
+wenches
+wenching
+wend
+went
+wept
+weraday
+were
+wert
+west
+western
+westminster
+westmoreland
+westward
+wet
+wether
+wetting
+wezand
+whale
+whales
+wharf
+wharfs
+what
+whate
+whatever
+whatsoe
+whatsoever
+whatsome
+whe
+wheat
+wheaten
+wheel
+wheeling
+wheels
+wheer
+wheeson
+wheezing
+whelk
+whelks
+whelm
+whelp
+whelped
+whelps
+when
+whenas
+whence
+whencesoever
+whene
+whenever
+whensoever
+where
+whereabout
+whereas
+whereat
+whereby
+wherefore
+wherein
+whereinto
+whereof
+whereon
+whereout
+whereso
+wheresoe
+wheresoever
+wheresome
+whereto
+whereuntil
+whereunto
+whereupon
+wherever
+wherewith
+wherewithal
+whet
+whether
+whetstone
+whetted
+whew
+whey
+which
+whiff
+whiffler
+while
+whiles
+whilst
+whin
+whine
+whined
+whinid
+whining
+whip
+whipp
+whippers
+whipping
+whips
+whipster
+whipstock
+whipt
+whirl
+whirled
+whirligig
+whirling
+whirlpool
+whirls
+whirlwind
+whirlwinds
+whisp
+whisper
+whispering
+whisperings
+whispers
+whist
+whistle
+whistles
+whistling
+whit
+white
+whitehall
+whitely
+whiteness
+whiter
+whites
+whitest
+whither
+whiting
+whitmore
+whitsters
+whitsun
+whittle
+whizzing
+who
+whoa
+whoe
+whoever
+whole
+wholesom
+wholesome
+wholly
+whom
+whoobub
+whoop
+whooping
+whor
+whore
+whoremaster
+whoremasterly
+whoremonger
+whores
+whoreson
+whoresons
+whoring
+whorish
+whose
+whoso
+whosoe
+whosoever
+why
+wi
+wick
+wicked
+wickednes
+wickedness
+wicket
+wicky
+wid
+wide
+widens
+wider
+widow
+widowed
+widower
+widowhood
+widows
+wield
+wife
+wight
+wights
+wild
+wildcats
+wilder
+wilderness
+wildest
+wildfire
+wildly
+wildness
+wilds
+wiles
+wilful
+wilfull
+wilfully
+wilfulnes
+wilfulness
+will
+willed
+willers
+willeth
+william
+williams
+willing
+willingly
+willingness
+willoughby
+willow
+wills
+wilt
+wiltshire
+wimpled
+win
+wince
+winch
+winchester
+wincot
+wind
+winded
+windgalls
+winding
+windlasses
+windmill
+window
+windows
+windpipe
+winds
+windsor
+windy
+wine
+wing
+winged
+wingfield
+wingham
+wings
+wink
+winking
+winks
+winner
+winners
+winning
+winnow
+winnowed
+winnows
+wins
+winter
+winterly
+winters
+wip
+wipe
+wiped
+wipes
+wiping
+wire
+wires
+wiry
+wisdom
+wisdoms
+wise
+wiselier
+wisely
+wiser
+wisest
+wish
+wished
+wisher
+wishers
+wishes
+wishest
+wisheth
+wishful
+wishing
+wishtly
+wisp
+wist
+wit
+witb
+witch
+witchcraft
+witches
+witching
+with
+withal
+withdraw
+withdrawing
+withdrawn
+withdrew
+wither
+withered
+withering
+withers
+withheld
+withhold
+withholds
+within
+withold
+without
+withstand
+withstanding
+withstood
+witless
+witness
+witnesses
+witnesseth
+witnessing
+wits
+witted
+wittenberg
+wittiest
+wittily
+witting
+wittingly
+wittol
+wittolly
+witty
+wiv
+wive
+wived
+wives
+wiving
+wizard
+wizards
+wo
+woe
+woeful
+woefull
+woefullest
+woes
+woful
+wolf
+wolfish
+wolsey
+wolves
+wolvish
+woman
+womanhood
+womanish
+womankind
+womanly
+womb
+wombs
+womby
+women
+won
+woncot
+wond
+wonder
+wondered
+wonderful
+wonderfully
+wondering
+wonders
+wondrous
+wondrously
+wont
+wonted
+woo
+wood
+woodbine
+woodcock
+woodcocks
+wooden
+woodland
+woodman
+woodmonger
+woods
+woodstock
+woodville
+wooed
+wooer
+wooers
+wooes
+woof
+wooing
+wooingly
+wool
+woollen
+woolly
+woolsack
+woolsey
+woolward
+woos
+wor
+worcester
+word
+words
+wore
+worins
+work
+workers
+working
+workings
+workman
+workmanly
+workmanship
+workmen
+works
+worky
+world
+worldlings
+worldly
+worlds
+worm
+worms
+wormwood
+wormy
+worn
+worried
+worries
+worry
+worrying
+worse
+worser
+worship
+worshipful
+worshipfully
+worshipp
+worshipper
+worshippers
+worshippest
+worships
+worst
+worsted
+wort
+worth
+worthied
+worthier
+worthies
+worthiest
+worthily
+worthiness
+worthless
+worths
+worthy
+worts
+wot
+wots
+wotting
+wouid
+would
+wouldest
+wouldst
+wound
+wounded
+wounding
+woundings
+woundless
+wounds
+wouns
+woven
+wow
+wrack
+wrackful
+wrangle
+wrangler
+wranglers
+wrangling
+wrap
+wrapp
+wraps
+wrapt
+wrath
+wrathful
+wrathfully
+wraths
+wreak
+wreakful
+wreaks
+wreath
+wreathed
+wreathen
+wreaths
+wreck
+wrecked
+wrecks
+wren
+wrench
+wrenching
+wrens
+wrest
+wrested
+wresting
+wrestle
+wrestled
+wrestler
+wrestling
+wretch
+wretchcd
+wretched
+wretchedness
+wretches
+wring
+wringer
+wringing
+wrings
+wrinkle
+wrinkled
+wrinkles
+wrist
+wrists
+writ
+write
+writer
+writers
+writes
+writhled
+writing
+writings
+writs
+written
+wrong
+wronged
+wronger
+wrongful
+wrongfully
+wronging
+wrongly
+wrongs
+wronk
+wrote
+wroth
+wrought
+wrung
+wry
+wrying
+wt
+wul
+wye
+x
+xanthippe
+xi
+xii
+xiii
+xiv
+xv
+y
+yard
+yards
+yare
+yarely
+yarn
+yaughan
+yaw
+yawn
+yawning
+ycleped
+ycliped
+ye
+yea
+yead
+year
+yearly
+yearn
+yearns
+years
+yeas
+yeast
+yedward
+yell
+yellow
+yellowed
+yellowing
+yellowness
+yellows
+yells
+yelping
+yeoman
+yeomen
+yerk
+yes
+yesterday
+yesterdays
+yesternight
+yesty
+yet
+yew
+yicld
+yield
+yielded
+yielder
+yielders
+yielding
+yields
+yok
+yoke
+yoked
+yokefellow
+yokes
+yoketh
+yon
+yond
+yonder
+yongrey
+yore
+yorick
+york
+yorkists
+yorks
+yorkshire
+you
+young
+younger
+youngest
+youngling
+younglings
+youngly
+younker
+your
+yours
+yourself
+yourselves
+youth
+youthful
+youths
+youtli
+zanies
+zany
+zeal
+zealous
+zeals
+zed
+zenelophon
+zenith
+zephyrs
+zir
+zo
+zodiac
+zodiacs
+zone
+zounds
+zwagger
diff --git a/extra/pos/authors.txt b/extra/pos/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/pos/pos.factor b/extra/pos/pos.factor
new file mode 100644 (file)
index 0000000..3071ebc
--- /dev/null
@@ -0,0 +1,21 @@
+
+USING: kernel math math.vectors sequences self ;
+
+IN: pos
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: pos val ;
+
+C: <pos> pos
+
+: pos> ( -- val ) self> pos-val ;
+
+: >pos ( val -- ) self> set-pos-val ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: distance ( pos pos -- n ) pos-val swap pos-val v- [ sq ] map sum sqrt ;
+
+: move-by ( point -- ) pos> v+ >pos ;
+
diff --git a/extra/postgresql/authors.txt b/extra/postgresql/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/postgresql/libpq/libpq.factor b/extra/postgresql/libpq/libpq.factor
new file mode 100644 (file)
index 0000000..a7f4261
--- /dev/null
@@ -0,0 +1,362 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+! adapted from libpq-fe.h version 7.4.7
+! tested on debian linux with postgresql 7.4.7
+! Updated to 8.1
+
+USING: alien alien.syntax combinators system ;
+IN: postgresql.libpq
+
+: load-postgresql-library ( -- )
+    "postgresql" {
+        { [ win32? ]  [ "libpq.dll" ] }
+        { [ macosx? ] [ "/opt/local/lib/postgresql81/libpq.dylib" ] }
+        { [ unix?  ]  [ "libpq.so" ] }
+    } cond "cdecl" add-library ; parsing
+
+load-postgresql-library
+
+! ConnSatusType
+: CONNECTION_OK                                        HEX: 0 ; inline
+: CONNECTION_BAD                                       HEX: 1 ; inline
+: CONNECTION_STARTED                           HEX: 2 ; inline
+: CONNECTION_MADE                                      HEX: 3 ; inline
+: CONNECTION_AWAITING_RESPONSE         HEX: 4 ; inline
+: CONNECTION_AUTH_OK                           HEX: 5 ; inline
+: CONNECTION_SETENV                                    HEX: 6 ; inline
+: CONNECTION_SSL_STARTUP                       HEX: 7 ; inline
+: CONNECTION_NEEDED                                    HEX: 8 ; inline
+
+! PostgresPollingStatusType
+: PGRES_POLLING_FAILED                                 HEX: 0 ; inline
+: PGRES_POLLING_READING                        HEX: 1 ; inline
+: PGRES_POLLING_WRITING                        HEX: 2 ; inline
+: PGRES_POLLING_OK                                     HEX: 3 ; inline
+: PGRES_POLLING_ACTIVE                                 HEX: 4 ; inline
+
+! ExecStatusType;
+: PGRES_EMPTY_QUERY                            HEX: 0 ; inline
+: PGRES_COMMAND_OK                                     HEX: 1 ; inline
+: PGRES_TUPLES_OK                                      HEX: 2 ; inline
+: PGRES_COPY_OUT                                       HEX: 3 ; inline
+: PGRES_COPY_IN                                                HEX: 4 ; inline
+: PGRES_BAD_RESPONSE                           HEX: 5 ; inline
+: PGRES_NONFATAL_ERROR                         HEX: 6 ; inline
+: PGRES_FATAL_ERROR                                    HEX: 7 ; inline
+
+! PGTransactionStatusType;
+: PQTRANS_IDLE                                         HEX: 0 ; inline
+: PQTRANS_ACTIVE                                       HEX: 1 ; inline
+: PQTRANS_INTRANS                                      HEX: 2 ; inline
+: PQTRANS_INERROR                                      HEX: 3 ; inline
+: PQTRANS_UNKNOWN                                      HEX: 4 ; inline
+
+! PGVerbosity;
+: PQERRORS_TERSE                                       HEX: 0 ; inline
+: PQERRORS_DEFAULT                                     HEX: 1 ; inline
+: PQERRORS_VERBOSE                                     HEX: 2 ; inline
+
+
+TYPEDEF: int size_t
+TYPEDEF: int ConnStatusType
+TYPEDEF: int ExecStatusType 
+TYPEDEF: int PostgresPollingStatusType
+TYPEDEF: int PGTransactionStatusType 
+TYPEDEF: int PGVerbosity 
+
+TYPEDEF: void* PGconn*
+TYPEDEF: void* PGresult*
+TYPEDEF: void* PGcancel*
+TYPEDEF: uint Oid
+TYPEDEF: uint* Oid*
+TYPEDEF: char pqbool
+TYPEDEF: void* PQconninfoOption*
+TYPEDEF: void* PGnotify*
+TYPEDEF: void* PQArgBlock*
+TYPEDEF: void* PQprintOpt*
+TYPEDEF: void* FILE*
+TYPEDEF: void* SSL*
+
+LIBRARY: postgresql
+
+
+! Exported functions of libpq
+! ===  in fe-connect.c ===
+
+! make a new client connection to the backend
+! Asynchronous (non-blocking)
+FUNCTION: PGconn* PQconnectStart ( char* 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 ) ;
+
+: PQsetdb ( M_PGHOST M_PGPORT M_PGOPT M_PGTTY M_DBNAME -- PGconn* )
+       f f PQsetdbLogin ;
+
+! close the current connection and free the PGconn data structure
+FUNCTION: void PQfinish ( PGconn* conn ) ;
+
+! get info about connection options known to PQconnectdb
+FUNCTION: PQconninfoOption* PQconndefaults ( ) ;
+
+! free the data structure returned by PQconndefaults()
+FUNCTION: void PQconninfoFree ( PQconninfoOption* connOptions ) ;
+
+! 
+! close the current connection and restablish a new one with the same
+! parameters
+!
+! Asynchronous (non-blocking)
+FUNCTION: int  PQresetStart ( PGconn* conn ) ;
+FUNCTION: PostgresPollingStatusType PQresetPoll ( PGconn* conn ) ;
+
+! Synchronous (blocking)
+FUNCTION: void PQreset ( PGconn* conn ) ;
+
+! request a cancel structure
+FUNCTION: PGcancel* PQgetCancel ( PGconn* conn ) ;
+
+! free a cancel structure
+FUNCTION: void PQfreeCancel ( PGcancel* cancel ) ;
+
+! issue a cancel request
+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: ConnStatusType PQstatus ( PGconn* conn ) ;
+FUNCTION: PGTransactionStatusType PQtransactionStatus ( PGconn* conn ) ;
+FUNCTION: char* PQparameterStatus ( PGconn* conn,
+                                 char* paramName ) ;
+FUNCTION: int  PQprotocolVersion ( PGconn* conn ) ;
+FUNCTION: int  PQServerVersion ( PGconn* conn ) ;
+FUNCTION: char* 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 ) ;
+
+! May not be compiled into libpq
+! Get the SSL structure associated with a connection
+FUNCTION: SSL* PQgetssl ( PGconn* conn ) ;
+
+! Tell libpq whether it needs to initialize OpenSSL
+FUNCTION: void PQinitSSL ( int do_init ) ;
+
+! Set verbosity for PQerrorMessage and PQresultErrorMessage
+FUNCTION: PGVerbosity PQsetErrorVerbosity ( PGconn* conn,
+       PGVerbosity verbosity ) ;
+
+! Enable/disable tracing
+FUNCTION: void PQtrace ( PGconn* conn, FILE* debug_port ) ;
+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);
+! ALIAS: void* PQnoticeReceiver
+! ALIAS: void* PQnoticeProcessor
+
+! Override default notice handling routines
+! FUNCTION: PQnoticeReceiver PQsetNoticeReceiver ( PGconn* conn,
+                                       ! PQnoticeReceiver proc,
+                                       ! void* arg ) ;
+! FUNCTION: PQnoticeProcessor PQsetNoticeProcessor ( PGconn* conn,
+                                       ! PQnoticeProcessor proc,
+                                       ! void* arg ) ;
+! END BROKEN
+
+! === in fe-exec.c ===
+
+! Simple synchronous query
+FUNCTION: PGresult* PQexec ( PGconn* conn, char* query ) ;
+FUNCTION: PGresult* PQexecParams ( PGconn* conn,
+                        char* command,
+                        int nParams,
+                        Oid* paramTypes,
+                        char** paramValues,
+                        int* paramLengths,
+                        int* paramFormats,
+                        int resultFormat ) ;
+FUNCTION: PGresult* PQprepare ( PGconn* conn, char* stmtName,
+        char* query, int nParams,
+        Oid* paramTypes ) ;
+FUNCTION: PGresult* PQexecPrepared ( PGconn* conn,
+                        char* stmtName,
+                        int nParams,
+                        char** paramValues,
+                        int* paramLengths,
+                        int* paramFormats,
+                        int resultFormat ) ;
+
+! Interface for multiple-result or asynchronous queries
+FUNCTION: int PQsendQuery ( PGconn* conn, char* query ) ;
+FUNCTION: int PQsendQueryParams ( PGconn* conn,
+                                 char* command,
+                                 int nParams,
+                                 Oid* paramTypes,
+                                 char** paramValues,
+                                 int* paramLengths,
+                                 int* paramFormats,
+                                 int resultFormat ) ;
+FUNCTION: PGresult* PQsendPrepare ( PGconn* conn, char* stmtName,
+            char* query, int nParams,
+            Oid* paramTypes ) ;
+FUNCTION: int PQsendQueryPrepared ( PGconn* conn,
+                                 char* stmtName,
+                                 int nParams,
+                                 char** paramValues,
+                                 int *paramLengths,
+                                 int *paramFormats,
+                                 int resultFormat ) ;
+FUNCTION: PGresult* PQgetResult ( PGconn* conn ) ;
+
+! Routines for managing an asynchronous query
+FUNCTION: int  PQisBusy ( PGconn* conn ) ;
+FUNCTION: int  PQconsumeInput ( PGconn* conn ) ;
+
+! LISTEN/NOTIFY support
+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 ) ;
+
+! 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  PQendcopy ( PGconn* conn ) ;
+
+! Set blocking/nonblocking connection to the backend
+FUNCTION: int  PQsetnonblocking ( PGconn* conn, int arg ) ;
+FUNCTION: int  PQisnonblocking ( PGconn* conn ) ;
+
+! Force the write buffer to be written (or at least try)
+FUNCTION: int  PQflush ( PGconn* conn ) ;
+
+! 
+! * "Fast path" interface --- not really recommended for application
+! * use
+!
+FUNCTION: PGresult* PQfn ( PGconn* conn,
+        int fnid,
+        int* result_buf,
+        int* result_len,
+        int result_is_int,
+        PQArgBlock* args,
+        int nargs ) ;
+
+! 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: 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: 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: Oid  PQoidValue ( PGresult* res ) ;
+FUNCTION: char* PQcmdTuples ( PGresult* res ) ;
+FUNCTION: char* 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 ) ;
+
+! Delete a PGresult
+FUNCTION: void PQclear ( PGresult* res ) ;
+
+! For freeing other alloc'd results, such as PGnotify structs
+FUNCTION: void PQfreemem ( void* ptr ) ;
+
+! Exists for backward compatibility.
+: PQfreeNotify PQfreemem ;
+
+!
+! Make an empty PGresult with given status (some apps find this
+! useful). If conn is not NULL and status indicates an error, the
+! conn's errorMessage is copied.
+!
+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,
+                                    int* error ) ;
+FUNCTION: uchar* PQescapeByteaConn ( PGconn* conn,
+                                    char* from, size_t length,
+                                    size_t* to_length ) ;
+FUNCTION: uchar* PQunescapeBytea ( uchar* 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,
+                         size_t* bytealen ) ;
+
+! === in fe-print.c ===
+
+FUNCTION: void PQprint ( FILE* fout, PGresult* res, PQprintOpt* ps ) ;
+
+! really old printing routines
+FUNCTION: void PQdisplayTuples ( PGresult* res,
+                               FILE* fp,               
+                               int fillAlign,
+                               char* fieldSep,
+                               int printHeader,
+                               int quiet ) ;
+
+FUNCTION: void PQprintTuples ( PGresult* res,
+                         FILE* fout,           
+                         int printAttName,
+                         int terseOutput,      
+                         int width ) ; 
+                                               
+! === in fe-lobj.c ===
+
+! 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_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 ) ;
+
+! === in fe-misc.c ===
+
+! Determine length of multibyte encoded char at *s
+FUNCTION: int  PQmblen ( uchar* s, int encoding ) ;
+
+! Determine display length of multibyte encoded char at *s
+FUNCTION: int  PQdsplen ( uchar* s, int encoding ) ;
+
+! Get encoding id from environment variable PGCLIENTENCODING
+FUNCTION: int  PQenv2encoding ( ) ;
+
diff --git a/extra/postgresql/postgresql-tests.factor b/extra/postgresql/postgresql-tests.factor
new file mode 100644 (file)
index 0000000..c725882
--- /dev/null
@@ -0,0 +1,42 @@
+! You will need to run  'createdb factor-test' to create the database.
+! Set username and password in  the 'connect' word.
+
+IN: postgresql-test
+USING: kernel postgresql alien continuations io prettyprint
+sequences namespaces ;
+
+
+: test-connection ( host port pgopts pgtty db user pass -- bool )
+    [ [ ] with-postgres ] catch "Error connecting!" "Connected!" ? print ;
+
+! just a basic demo
+
+"localhost" "" "" "" "test" "postgres" "" [
+    "drop table animal" do-command
+
+    "create table animal (id serial not null primary key, species varchar(256), name varchar(256), age integer)" do-command
+    "insert into animal (species, name, age) values ('lion', 'Mufasa', 5)"
+    do-command
+
+    "select * from animal where name = 'Mufasa'" [ ] do-query
+    "select * from animal where name = 'Mufasa'"
+    [
+        result>seq length 1 = [ "...there can only be one Mufasa..." throw ] unless
+    ] do-query
+
+    "insert into animal (species, name, age) values ('lion', 'Simba', 1)"
+    do-command
+
+    "select * from animal" 
+    [
+          "Animal table:" print
+          result>seq print-table
+    ] do-query
+
+    ! intentional errors
+    ! [ "select asdf from animal"
+    ! [ ] do-query ] catch [ "caught: " write print ] when*
+    ! "select asdf from animal" [ ] do-query 
+    ! "aofijweafew" do-command
+] with-postgres
+
diff --git a/extra/postgresql/postgresql.factor b/extra/postgresql/postgresql.factor
new file mode 100644 (file)
index 0000000..2e7dc4a
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+! adapted from libpq-fe.h version 7.4.7
+! tested on debian linux with postgresql 7.4.7
+
+USING: arrays alien alien.syntax continuations io
+kernel math namespaces postgresql.libpq prettyprint
+quotations sequences debugger ;
+IN: postgresql
+
+SYMBOL: db
+SYMBOL: query-res
+
+: connect-postgres ( host port pgopts pgtty db user pass -- conn )
+    PQsetdbLogin
+    dup PQstatus zero? [ "couldn't connect to database" throw ] unless ;
+
+: with-postgres ( host port pgopts pgtty db user pass quot -- )
+    [ >r connect-postgres db set r>
+    [ db get PQfinish ] [ ] cleanup ] with-scope ; inline
+
+: postgres-error ( ret -- ret )
+    dup zero? [ PQresultErrorMessage throw ] when ;
+
+: (do-query) ( PGconn query -- PGresult* )
+    ! For queries that do not return rows, PQexec() returns PGRES_COMMAND_OK
+    ! For queries that return rows, PQexec() returns PGRES_TUPLES_OK
+    PQexec
+    dup PQresultStatus PGRES_COMMAND_OK =
+    over PQresultStatus PGRES_TUPLES_OK =
+    or [
+        [ PQresultErrorMessage CHAR: \n swap remove ] keep PQclear throw
+    ] unless ;
+
+: (do-command) ( PGconn query -- PGresult* )
+    [ (do-query) ] catch
+    [
+        swap
+        "non-fatal error: " print
+        "\tQuery: " write "'" write write "'" print
+        "\t" write print
+    ] when* drop ;
+
+: do-command ( str -- )
+    1quotation \ (do-command) add db get swap call ;
+
+: prepare ( str quot word -- conn quot )
+    rot 1quotation swap append swap append db get swap ;
+
+: do-query ( str quot -- )
+    [ (do-query) query-res set ] prepare catch
+    [ rethrow ] [ query-res get PQclear ] if* ;
+
+: result>seq ( -- seq )
+    query-res get [ PQnfields ] keep PQntuples
+    [ swap [ query-res get -rot PQgetvalue ] curry* map ] curry* map ;
+
+: print-table ( seq -- )
+    [ [ write bl ] each "\n" write ] each ;
+
diff --git a/extra/promises/authors.txt b/extra/promises/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/promises/promises-docs.factor b/extra/promises/promises-docs.factor
new file mode 100644 (file)
index 0000000..f9477fe
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: help.markup help.syntax promises ;
+
+HELP: promise 
+{ $values { "quot" "a quotation with stack effect ( -- X )" } { "promise" "a promise object" } }
+{ $description "Creates a promise to return a value. When forced this quotation is called and the value returned. The value is memorised so that calling " { $link force } " again does not call the quotation again, instead the previous value is returned directly." } 
+{ $see-also force promise-with promise-with2 } ;
+
+HELP: promise-with
+{ $values { "value" "an object" } { "quot" "a quotation with stack effect ( value -- X )" } { "promise" "a promise object" } }
+{ $description "Creates a promise to return a value. When forced this quotation is called with the given value on the stack and the result returned. The value is memorised so that calling " { $link force } " again does not call the quotation again, instead the previous value is returned directly." } 
+{ $see-also force promise promise-with2 } ;
+
+HELP: promise-with2
+{ $values { "value1" "an object" } { "value2" "an object" } { "quot" "a quotation with stack effect ( value1 value2 -- X )" } { "promise" "a promise object" } }
+{ $description "Creates a promise to return a value. When forced this quotation is called with the given values on the stack and the result returned. The value is memorised so that calling " { $link force } " again does not call the quotation again, instead the previous value is returned directly." } 
+{ $see-also force promise promise-with2 } ;
+
+HELP: force
+{ $values { "promise" "a promise object" } { "value" "a factor object" } }
+{ $description "Calls the quotation associated with the promise if it has not been called before, and returns the value. If the promise has been forced previously, returns the value from the previous call." } 
+{ $see-also promise promise-with promise-with2 } ;
+
+HELP: LAZY:
+{ $syntax "LAZY: word definition... ;" } 
+{ $values { "word" "a new word to define" } { "definition" "a word definition" } }
+{ $description "Creates a lazy word in the current vocabulary. When executed the word will return a " { $link promise } " that when forced, executes the word definition. Any values on the stack that are required by the word definition are captured along with the promise." } 
+{ $examples
+  { $example "LAZY: my-add ( a b -- c ) + ;\n1 2 my-add force ." "3" }
+}
+{ $see-also force promise-with promise-with2 } ;
diff --git a/extra/promises/promises.factor b/extra/promises/promises.factor
new file mode 100644 (file)
index 0000000..ca26c93
--- /dev/null
@@ -0,0 +1,45 @@
+! Copyright (C) 2004 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Updated by Matthew Willis, July 2006
+! Updated by Chris Double, September 2006
+
+USING: arrays kernel sequences math vectors arrays namespaces
+quotations parser effects inference words ;
+IN: promises
+
+TUPLE: promise quot forced? value ;
+
+: promise ( quot -- promise )
+  f f \ promise construct-boa ;
+
+: promise-with ( value quot -- promise )
+  curry promise ;
+
+: promise-with2 ( value1 value2 quot -- promise )
+  2curry promise ;
+
+: force ( promise -- value )
+    #! Force the given promise leaving the value of calling the
+    #! promises quotation on the stack. Re-forcing the promise
+    #! will return the same value and not recall the quotation.
+    dup promise-forced? [
+        dup promise-quot call over set-promise-value
+        t over set-promise-forced?
+    ] unless
+    promise-value ;
+
+: stack-effect-in ( quot word -- n )
+  stack-effect [ ] [ infer ] ?if effect-in length ;
+
+: make-lazy-quot ( word quot -- quot )
+  [
+    dup ,
+    swap stack-effect-in \ curry <repetition> % 
+    \ promise ,
+  ] [ ] make ;
+
+: LAZY:
+  CREATE dup reset-generic
+  dup parse-definition
+  make-lazy-quot define-compound ; parsing
diff --git a/extra/promises/summary.txt b/extra/promises/summary.txt
new file mode 100644 (file)
index 0000000..d64fe20
--- /dev/null
@@ -0,0 +1 @@
+Lazy thunks
diff --git a/extra/promises/tags.txt b/extra/promises/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/qualified/authors.txt b/extra/qualified/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/qualified/qualified-docs.factor b/extra/qualified/qualified-docs.factor
new file mode 100644 (file)
index 0000000..6356b4d
--- /dev/null
@@ -0,0 +1,7 @@
+USING: qualified help.markup help.syntax ;
+
+HELP: QUALIFIED:
+{ $syntax "QUALIFIED: vocab" }
+{ $description "Similar to " { $link POSTPONE: USE: } " but loads vocabulary with prefix." }
+{ $examples { $code
+    "QUALIFIED: math\n1 2 math:+ ! ==> 3" } } ;
diff --git a/extra/qualified/qualified-tests.factor b/extra/qualified/qualified-tests.factor
new file mode 100644 (file)
index 0000000..d1bd569
--- /dev/null
@@ -0,0 +1,8 @@
+USING: tools.test qualified ;
+IN: foo
+: x 1 ;
+IN: bar
+: x 2 ;
+QUALIFIED: foo
+QUALIFIED: bar
+[ 1 2 2 ] [ foo:x bar:x x ] unit-test
diff --git a/extra/qualified/qualified.factor b/extra/qualified/qualified.factor
new file mode 100644 (file)
index 0000000..b4eb455
--- /dev/null
@@ -0,0 +1,13 @@
+USING: kernel sequences assocs parser vocabs namespaces
+vocabs.loader ;
+IN: qualified
+
+: define-qualified ( vocab-name -- )
+    dup require
+    dup vocab-words swap CHAR: : add
+    [ -rot >r append r> ] curry assoc-map
+    use get push ;
+
+
+: QUALIFIED:
+    scan define-qualified ; parsing
diff --git a/extra/qualified/summary.txt b/extra/qualified/summary.txt
new file mode 100644 (file)
index 0000000..94b44c6
--- /dev/null
@@ -0,0 +1 @@
+Qualified naming for vocabularies
diff --git a/extra/qualified/tags.txt b/extra/qualified/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/random-weighted/authors.txt b/extra/random-weighted/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/random-weighted/random-weighted.factor b/extra/random-weighted/random-weighted.factor
new file mode 100644 (file)
index 0000000..0ec366b
--- /dev/null
@@ -0,0 +1,16 @@
+
+USING: kernel quotations sequences math math.vectors random ;
+
+IN: random-weighted
+
+: probabilities ( weights -- probabilities )
+dup sum [ / ] curry map ;
+
+: layers ( probabilities -- layers )
+dup length 1+ [ head ] curry* map 1 tail [ sum ] map ;
+
+: random-weighted ( weights -- elt )
+probabilities layers [ 1000 * ] map 1000 random [ > ] curry find drop ;
+
+: random-weighted* ( seq -- elt )
+dup [ second ] map swap [ first ] map random-weighted swap nth ;
\ No newline at end of file
diff --git a/extra/random/authors.txt b/extra/random/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/random/random-docs.factor b/extra/random/random-docs.factor
new file mode 100644 (file)
index 0000000..811b864
--- /dev/null
@@ -0,0 +1,23 @@
+USING: help.markup help.syntax math ;
+IN: random
+
+ARTICLE: "random-numbers" "Generating random integers"
+"The " { $vocab-link "random" } " vocabulary implements the ``Mersenne Twister'' pseudo-random number generator algorithm."
+{ $subsection init-random }
+{ $subsection (random) }
+{ $subsection random } ;
+
+ABOUT: "random-numbers"
+
+HELP: init-random
+{ $values { "seed" integer } }
+{ $description "Initializes the random number generator with the given seed. This word is called on startup to initialize the random number generator with the current time." } ;
+
+HELP: (random)
+{ $values { "rand" "an integer between 0 and 2^32-1" } }
+{ $description "Generates a random 32-bit unsigned integer." } ;
+
+HELP: random
+{ $values { "seq" "a sequence" } { "elt" "a random element" } }
+{ $description "Outputs a random element of the sequence. If the sequence is empty, always outputs " { $link f } "." }
+{ $notes "Since integers are sequences, passing an integer " { $snippet "n" } " yields a random integer in the interval " { $snippet "[0,n)" } "." } ;
diff --git a/extra/random/random-tests.factor b/extra/random/random-tests.factor
new file mode 100644 (file)
index 0000000..7d506b8
--- /dev/null
@@ -0,0 +1,15 @@
+USING: kernel math random namespaces sequences tools.test ;
+IN: temporary
+
+: check-random ( max -- ? )
+    dup >r random 0 r> between? ;
+
+[ t ] [ 100 [ drop 674 check-random ] all? ] unit-test
+
+: make-100-randoms
+    [ 100 [ 100 random , ] times ] { } make ;
+
+[ f ] [ make-100-randoms make-100-randoms = ] unit-test
+
+[ 1333075495 ] [ 0 init-random 1000 [ drop (random) drop ] each (random) ] unit-test
+[ 1575309035 ] [ 0 init-random 10000 [ drop (random) drop ] each (random) ] unit-test
diff --git a/extra/random/random.factor b/extra/random/random.factor
new file mode 100644 (file)
index 0000000..93c25a6
--- /dev/null
@@ -0,0 +1,105 @@
+! Copyright (C) 2005, 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+! mersenne twister based on 
+! http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
+
+USING: arrays kernel math math.functions namespaces sequences
+system init alien.c-types ;
+IN: random
+
+<PRIVATE
+
+TUPLE: mersenne-twister seed seq i ;
+
+C: <mersenne-twister> mersenne-twister
+
+: mt-n 624 ; inline
+: mt-m 397 ; inline
+: mt-a HEX: 9908b0df ; inline
+: mt-hi HEX: 80000000 ; inline
+: mt-lo HEX: 7fffffff ; inline
+
+SYMBOL: mt
+
+: mt-seq ( -- seq )
+    mt get mersenne-twister-seq ; inline
+
+: mt-nth ( n -- nth )
+    mt-seq nth ; inline
+
+: mt-i ( -- i )
+    mt get mersenne-twister-i ; inline
+
+: mti-inc ( -- )
+    mt get [ mersenne-twister-i 1+ ] keep set-mersenne-twister-i ; inline
+
+: set-mt-ith ( y i-get i-set -- )
+    >r mt-nth >r
+    [ -1 shift ] keep odd? mt-a 0 ? r> bitxor bitxor r>
+    mt-seq set-nth ; inline
+
+: mt-y ( y1 y2 -- y )
+    mt-nth mt-lo bitand
+    >r mt-nth mt-hi bitand r> bitor ; inline
+
+: mod* ( x n -- y )
+    #! no floating point
+    2dup >= [ - ] [ drop ] if ; inline
+
+: (mt-generate) ( n -- y n n+(mt-m) )
+    dup [ 1+ 624 mod* mt-y ] keep [ mt-m + 624 mod* ] keep ;
+
+: mt-generate ( -- )
+    mt-n [ (mt-generate) set-mt-ith ] each
+    0 mt get set-mersenne-twister-i ;
+
+: init-mt-first ( seed -- seq )
+    >r mt-n 0 <array> r>
+    HEX: ffffffff bitand 0 pick set-nth ;
+
+: init-mt-formula ( seq i -- f(seq[i]) )
+    dup rot nth dup -30 shift bitxor
+    1812433253 * + HEX: ffffffff bitand 1+ ; inline
+
+: init-mt-rest ( seq -- )
+    mt-n 1 head* [
+        [ init-mt-formula ] 2keep 1+ swap set-nth
+    ] curry* each ;
+
+: mt-temper ( y -- yt )
+    dup -11 shift bitxor
+    dup 7 shift HEX: 9d2c5680 bitand bitxor
+    dup 15 shift HEX: efc60000 bitand bitxor
+    dup -18 shift bitxor ; inline
+
+PRIVATE>
+
+: init-random ( seed -- )
+    global [
+         dup init-mt-first
+         [ init-mt-rest ] keep
+         0 <mersenne-twister> mt set
+         mt-generate
+    ] bind ;
+
+: (random) ( -- rand )
+    global [
+        mt-i dup mt-n < [ drop mt-generate 0 ] unless
+        mt-nth mti-inc
+        mt-temper
+    ] bind ;
+
+: big-random ( n -- r )
+    [ drop (random) ] map >c-uint-array byte-array>bignum ;
+
+: random ( seq -- elt )
+    dup empty? [
+        drop f
+    ] [
+        [
+            length dup log2 31 + 32 /i big-random swap mod
+        ] keep nth
+    ] if ;
+
+[ millis init-random ] "random" add-init-hook
diff --git a/extra/random/summary.txt b/extra/random/summary.txt
new file mode 100644 (file)
index 0000000..dead30d
--- /dev/null
@@ -0,0 +1 @@
+Mersenne Twister random number generator
diff --git a/extra/rewrite-closures/authors.txt b/extra/rewrite-closures/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/rewrite-closures/rewrite-closures.factor b/extra/rewrite-closures/rewrite-closures.factor
new file mode 100644 (file)
index 0000000..ccd3989
--- /dev/null
@@ -0,0 +1,31 @@
+
+USING: kernel parser math quotations namespaces sequences namespaces.lib 
+       inference.transforms ;
+
+IN: rewrite-closures
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : set-parameters ( seq -- ) reverse [ set ] each ;
+
+: [set-parameters] ( seq -- quot ) [ [ set ] curry ] map concat ;
+
+: set-parameters ( seq -- ) [set-parameters] call ;
+
+\ set-parameters [ [set-parameters] ] 1 define-transform
+
+: parametric-quot ( parameters quot -- quot )
+[ [ swap ] set-parameters [ ] call ] make* ;
+
+: scoped-quot ( quot -- quot ) [ with-scope ] curry ;
+
+: closed-quot ( quot -- quot )
+[ namestack >r [ namestack ] set-namestack [ ] call r> set-namestack ] make* ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: lambda ( parameters quot -- ) parametric-quot scoped-quot closed-quot ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: C[ \ ] [ >quotation ] parse-literal \ closed-quot parsed ; parsing
\ No newline at end of file
diff --git a/extra/rewrite-closures/summary.txt b/extra/rewrite-closures/summary.txt
new file mode 100644 (file)
index 0000000..a5209bf
--- /dev/null
@@ -0,0 +1 @@
+Closures implemented via quotation rewriting
diff --git a/extra/rewrite-closures/tags.txt b/extra/rewrite-closures/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/roman/authors.txt b/extra/roman/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/roman/roman-docs.factor b/extra/roman/roman-docs.factor
new file mode 100644 (file)
index 0000000..a62e92c
--- /dev/null
@@ -0,0 +1,45 @@
+USING: help.markup help.syntax kernel math ;
+IN: roman
+
+HELP: >roman
+{ $values { "n" "an integer" } { "str" "a string" } }
+{ $description "Converts a number to its lower-case Roman Numeral equivalent." }
+{ $notes "The range for this word is 1-3999, inclusive." }
+{ $see-also >ROMAN roman> } ;
+
+HELP: >ROMAN
+{ $values { "n" "an integer" } { "str" "a string" } }
+{ $description "Converts a number to its upper-case Roman numeral equivalent." }
+{ $notes "The range for this word is 1-3999, inclusive." }
+{ $see-also >roman roman> } ;
+
+HELP: roman>
+{ $values { "str" "a string" } { "n" "an integer" } }
+{ $description "Converts a Roman numeral to an integer." }
+{ $notes "The range for this word is i-mmmcmxcix, inclusive." }
+{ $see-also >roman } ;
+
+HELP: roman+
+{ $values { "str1" "a string" } { "str2" "a string" } { "str3" "a string" } }
+{ $description "Adds two Roman numerals." }
+{ $see-also roman- } ;
+
+HELP: roman-
+{ $values { "str1" "a string" } { "str2" "a string" } { "str3" "a string" } }
+{ $description "Subtracts two Roman numerals." }
+{ $see-also roman+ } ;
+
+HELP: roman*
+{ $values { "str1" "a string" } { "str2" "a string" } { "str3" "a string" } }
+{ $description "Multiplies two Roman numerals." }
+{ $see-also roman/i roman/mod } ;
+
+HELP: roman/i
+{ $values { "str1" "a string" } { "str2" "a string" } { "str3" "a string" } }
+{ $description "Computes the integer division of two Roman numerals." }
+{ $see-also roman* roman/mod /i } ;
+
+HELP: roman/mod
+{ $values { "str1" "a string" } { "str2" "a string" } { "str3" "a string" } { "str4" "a string" } }
+{ $description "Computes the quotient and remainder of two Roman numerals." }
+{ $see-also roman* roman/i /mod } ;
diff --git a/extra/roman/roman-tests.factor b/extra/roman/roman-tests.factor
new file mode 100644 (file)
index 0000000..aac7d14
--- /dev/null
@@ -0,0 +1,42 @@
+USING: arrays kernel math roman roman.private sequences tools.test ;
+
+[ { { 1 } { -1 5 } { 2 4 } } ]
+[ { 1 -1 5 2 4 } [ < ] monotonic-split [ >array ] map ] unit-test
+[ { { 1 1 1 1 } { 2 2 } { 3 } { 4 } { 5 } { 6 6 6 } } ]
+[ { 1 1 1 1 2 2 3 4 5 6 6 6 } [ = ] monotonic-split [ >array ] map ] unit-test
+[ "i" ] [ 1 >roman ] unit-test
+[ "ii" ] [ 2 >roman ] unit-test
+[ "iii" ] [ 3 >roman ] unit-test
+[ "iv" ] [ 4 >roman ] unit-test
+[ "v" ] [ 5 >roman ] unit-test
+[ "vi" ] [ 6 >roman ] unit-test
+[ "vii" ] [ 7 >roman ] unit-test
+[ "viii" ] [ 8 >roman ] unit-test
+[ "ix" ] [ 9 >roman ] unit-test
+[ "x" ] [ 10 >roman ] unit-test
+[ "mdclxvi" ] [ 1666 >roman ] unit-test
+[ "mmmcdxliv" ] [ 3444 >roman ] unit-test
+[ "mmmcmxcix" ] [ 3999 >roman ] unit-test
+[ "MMMCMXCIX" ] [ 3999 >ROMAN ] unit-test
+[ 3999 ] [ 3999 >ROMAN roman> ] unit-test
+[ 1 ] [ 1 >roman roman> ] unit-test
+[ 2 ] [ 2 >roman roman> ] unit-test
+[ 3 ] [ 3 >roman roman> ] unit-test
+[ 4 ] [ 4 >roman roman> ] unit-test
+[ 5 ] [ 5 >roman roman> ] unit-test
+[ 6 ] [ 6 >roman roman> ] unit-test
+[ 7 ] [ 7 >roman roman> ] unit-test
+[ 8 ] [ 8 >roman roman> ] unit-test
+[ 9 ] [ 9 >roman roman> ] unit-test
+[ 10 ] [ 10 >roman roman> ] unit-test
+[ 1666 ] [ 1666 >roman roman> ] unit-test
+[ 3444 ] [ 3444 >roman roman> ] unit-test
+[ 3999 ] [ 3999 >roman roman> ] unit-test
+[ 0 >roman ] unit-test-fails
+[ 4000 >roman ] unit-test-fails
+[ "vi" ] [ "iii" "iii"  roman+ ] unit-test
+[ "viii" ] [ "x" "ii"  roman- ] unit-test
+[ "ix" ] [ "iii" "iii"  roman* ] unit-test
+[ "i" ] [ "iii" "ii" roman/i ] unit-test
+[ "i" "ii" ] [ "v" "iii"  roman/mod ] unit-test
+[ "iii" "iii"  roman- ] unit-test-fails
diff --git a/extra/roman/roman.factor b/extra/roman/roman.factor
new file mode 100644 (file)
index 0000000..482d52e
--- /dev/null
@@ -0,0 +1,90 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: arrays assocs kernel math math.vectors namespaces
+quotations sequences sequences.private strings ;
+IN: roman
+
+<PRIVATE
+
+: roman-digits ( -- seq )
+    { "m" "cm" "d" "cd" "c" "xc" "l" "xl" "x" "ix" "v" "iv" "i" } ;
+
+: roman-values ( -- seq )
+    { 1000 900 500 400 100 90 50 40 10 9 5 4 1 } ;
+
+TUPLE: roman-range-error n ;
+
+: roman-range-check ( n -- )
+    dup 1 3999 between? [
+        drop
+    ] [
+        roman-range-error construct-boa throw
+    ] if ;
+
+: ,, building get peek push ;
+: v, V{ } clone , ;
+: ,v building get dup peek empty? [ dup pop* ] when drop ;
+
+: monotonic-split ( seq quot -- newseq )
+    [
+        >r dup unclip add r>
+        v, [ pick ,, call [ v, ] unless ] curry 2each ,v
+    ] { } make ;
+
+: roman<= ( ch1 ch2 -- ? )
+    [ 1string roman-digits index ] 2apply >= ;
+
+: roman>n ( ch -- n )
+    1string roman-digits index roman-values nth ;
+
+: (>roman) ( n -- )
+    roman-values roman-digits [
+        >r /mod swap r> <repetition> concat %
+    ] 2each drop ;
+
+: (roman>) ( seq -- n )
+    dup [ roman>n ] map swap all-eq? [
+        sum
+    ] [
+        first2 swap -
+    ] if ;
+
+PRIVATE>
+
+: >roman ( n -- str )
+    dup roman-range-check [
+        (>roman)
+    ] "" make ;
+
+: >ROMAN ( n -- str ) >roman >upper ;
+
+: roman> ( str -- n )
+    >lower [ roman<= ] monotonic-split [
+        (roman>)
+    ] map sum ;
+
+<PRIVATE
+
+: 2roman> ( str1 str2 -- m n )
+    [ roman> ] 2apply ;
+
+: binary-roman-op ( str1 str2 quot -- str3 )
+    >r 2roman> r> call >roman ; inline
+
+PRIVATE>
+
+: roman+ ( str1 str2 -- str3 )
+    [ + ] binary-roman-op ;
+
+: roman- ( str1 str2 -- str3 )
+    [ - ] binary-roman-op ;
+
+: roman* ( str1 str2 -- str3 )
+    [ * ] binary-roman-op ;
+
+: roman/i ( str1 str2 -- str3 )
+    [ /i ] binary-roman-op ;
+
+: roman/mod ( str1 str2 -- str3 str4 )
+    [ /mod ] binary-roman-op >r >roman r> ;
diff --git a/extra/roman/summary.txt b/extra/roman/summary.txt
new file mode 100644 (file)
index 0000000..f6d018c
--- /dev/null
@@ -0,0 +1 @@
+Roman numerals library
diff --git a/extra/roman/tags.txt b/extra/roman/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/rot13/authors.txt b/extra/rot13/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/rot13/rot13.factor b/extra/rot13/rot13.factor
new file mode 100644 (file)
index 0000000..9849f4e
--- /dev/null
@@ -0,0 +1,24 @@
+! Copyright (C) 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math sequences strings io combinators ;
+IN: rot13
+
+: rotate ( ch base -- ch ) tuck - 13 + 26 mod + ;
+
+: rot-letter ( ch -- ch )
+    {
+        { [ dup letter? ] [ CHAR: a rotate ] }
+        { [ dup LETTER? ] [ CHAR: A rotate ] }
+        { [ t ] [ ] }
+    } cond ;
+
+: rot13 ( string -- string ) [ rot-letter ] map ;
+
+: rot13-demo ( -- )
+    "Please enter a string:" print flush
+    readln [
+        "Your string: " write dup print
+        "Rot13:       " write rot13 print
+    ] when* ;
+
+MAIN: rot13-demo
diff --git a/extra/rot13/summary.txt b/extra/rot13/summary.txt
new file mode 100644 (file)
index 0000000..84b0240
--- /dev/null
@@ -0,0 +1 @@
+Rot13 demo
diff --git a/extra/rot13/tags.txt b/extra/rot13/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/rss/atom.xml b/extra/rss/atom.xml
new file mode 100644 (file)
index 0000000..d019566
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+   <feed xmlns="http://www.w3.org/2005/Atom">
+     <title type="text">dive into mark</title>
+     <subtitle type="html">
+       A &lt;em&gt;lot&lt;/em&gt; of effort
+       went into making this effortless
+     </subtitle>
+     <updated>2005-07-31T12:29:29Z</updated>
+     <id>tag:example.org,2003:3</id>
+     <link rel="alternate" type="text/html"
+      hreflang="en" href="http://example.org/"/>
+     <link rel="self" type="application/atom+xml"
+      href="http://example.org/feed.atom"/>
+     <rights>Copyright (c) 2003, Mark Pilgrim</rights>
+     <generator uri="http://www.example.com/" version="1.0">
+       Example Toolkit
+     </generator>
+     <entry>
+       <title>Atom draft-07 snapshot</title>
+       <link rel="alternate" type="text/html"
+        href="http://example.org/2005/04/02/atom"/>
+       <link rel="enclosure" type="audio/mpeg" length="1337"
+        href="http://example.org/audio/ph34r_my_podcast.mp3"/>
+       <id>tag:example.org,2003:3.2397</id>
+       <updated>2005-07-31T12:29:29Z</updated>
+       <published>2003-12-13T08:29:29-04:00</published>
+       <author>
+         <name>Mark Pilgrim</name>
+         <uri>http://example.org/</uri>
+         <email>f8dy@example.com</email>
+       </author>
+       <contributor>
+         <name>Sam Ruby</name>
+       </contributor>
+       <contributor>
+         <name>Joe Gregorio</name>
+       </contributor>
+       <content type="xhtml" xml:lang="en"
+        xml:base="http://diveintomark.org/">
+         <div xmlns="http://www.w3.org/1999/xhtml">
+           <p><i>[Update: The Atom draft is finished.]</i></p>
+         </div>
+       </content>
+     </entry>
+   </feed>
diff --git a/extra/rss/reader/reader.factor b/extra/rss/reader/reader.factor
new file mode 100644 (file)
index 0000000..968f7fa
--- /dev/null
@@ -0,0 +1,133 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Create a test database like follows:
+!
+!   sqlite3 history.db
+!   > create table rss (url text, title text, link text, primary key (url));
+!   > create table entries (url text, link text, title text, description text, pubdate text, primary key(url, link));
+!   > [eof]
+!
+IN: rss.reader
+USING: kernel html namespaces sequences io quotations
+assocs sqlite.tuple-db sqlite io.files html.elements
+rss http.server.responders.continuation ;
+   
+TUPLE: reader-feed url title link ;
+
+C: <reader-feed> reader-feed
+
+TUPLE: reader-entry url link title description pubdate ;
+
+C: <reader-entry> reader-entry
+
+reader-feed default-mapping set-mapping
+reader-entry default-mapping set-mapping
+
+: init-db ( -- )
+  db get-global [ sqlite-close ] when*
+  "rss-reader.db" exists? [
+    "rss-reader.db" sqlite-open db set-global
+  ] [
+    "rss-reader.db" sqlite-open dup db set-global
+    dup reader-feed create-tuple-table
+    reader-entry create-tuple-table
+  ] if ;
+
+: add-feed ( url -- )
+  "" "" <reader-feed> db get swap insert-tuple ;
+
+: remove-feed ( url -- )
+  f f <reader-feed> db get swap find-tuples [ db get swap delete-tuple ] each ;
+
+: all-urls ( -- urls )
+  f f f <reader-feed> db get swap find-tuples [ reader-feed-url ] map ;
+
+: ask-for-url ( -- url )
+  [
+    <html>
+      <head> <title> "Enter a Feed URL" write </title> </head>
+      <body>
+        <form =action "post" =method form>
+          "URL: " write
+          <input "text" =type "url" =name "100" =size input/>
+          <input "submit" =type input/>
+        </form>
+      </body>
+    </html>
+  ] show "url" swap at ;
+
+: get-entries ( url -- entries )
+  f f f f <reader-entry> db get swap find-tuples ;
+  
+: display-entries ( url -- )
+  [
+    <html> 
+      <head> <title> "View entries for " write over write </title> </head>
+      <body>
+        swap get-entries [
+         <h2> dup reader-entry-title write </h2>
+         <p>
+           reader-entry-description write
+         </p>        
+        ] each        
+        <p> <a =href a> "Back" write </a> </p>
+      </body>
+    </html>
+  ] show 2drop ;
+
+: rss>reader-feed ( url rss -- reader-feed )
+  [ feed-title ] keep feed-link <reader-feed> ;   
+
+: rss-entry>reader-entry ( url entry -- reader-entry )
+  [ entry-link ] keep
+  [ entry-title ] keep
+  [ entry-description ] keep
+  entry-pub-date 
+  <reader-entry> ;
+
+: update-feed-database ( url -- )
+  dup remove-feed
+  dup news-get 
+  2dup rss>reader-feed db get swap save-tuple
+  feed-entries [
+    dupd rss-entry>reader-entry
+    dup >r reader-entry-link f f f <reader-entry> db get swap find-tuples [ db get swap delete-tuple ] each r>
+    db get swap save-tuple
+  ] curry* each ;
+
+: update-feeds ( seq -- )
+  [ update-feed-database ] each
+  [
+    <html>
+      <head> <title> "Feeds Updated" write </title> </head>
+      <body>
+        <p> "Feeds Updated." write </p>
+        <p> <a =href a> "Back" write </a> </p>
+      </body>
+    </html>          
+  ] show drop ;
+  
+: maintain-feeds ( -- )
+  [
+    <html>
+      <head> <title> "Maintain Feeds" write </title> </head>
+      <body>
+       <p>
+          <table "1" =border table>
+            all-urls [
+              <tr> 
+                <td> dup write </td>
+                <td> dup [ remove-feed ] curry "Remove" swap quot-href </td>
+                <td> [ display-entries ] curry "Database" swap quot-href </td>
+              </tr>
+            ] each
+          </table>
+        </p>
+        <p> "Add Feed" [ ask-for-url add-feed ] quot-href </p>
+        <p> "Update Feeds" [ all-urls update-feeds ] quot-href </p>
+      </body>
+    </html>
+  ] show-final ;
+
+"maintain-feeds" [ init-db maintain-feeds ] install-cont-responder
diff --git a/extra/rss/readme.txt b/extra/rss/readme.txt
new file mode 100644 (file)
index 0000000..2e64b0d
--- /dev/null
@@ -0,0 +1,32 @@
+This library is a simple RSS2 parser and RSS reader web
+application. To run the web application you'll need to make sure you
+have the sqlite library working. This can be tested with
+
+  "contrib/sqlite" require
+  "contrib/sqlite" test-module
+
+Remember that to use "sqlite" you need to have done the following
+somewhere:
+
+  USE: alien
+  "sqlite" "/usr/lib/libsqlite3.so" "cdecl" add-library
+
+Replacing "libsqlite3.so" with the path to the sqlite shared library
+or DLL. I put this in my ~/.factor-rc.
+
+The RSS reader web application creates a database file called
+'rss-reader.db' in the same directory as the Factor executable when
+first started. This database contains all the feed information.
+
+To load the web application use:
+
+  "contrib/rss" require
+
+Fire up the web server and navigate to the URL:
+
+  http://localhost:8888/responder/maintain-feeds
+
+Add any RSS2 compatible feed. Use 'Update Feeds' to retrieve them and
+update the sqlite database with the feed contains. Use 'Database' to
+view the entries from the database for that feed.
+
diff --git a/extra/rss/rss-tests.factor b/extra/rss/rss-tests.factor
new file mode 100644 (file)
index 0000000..643c2ec
--- /dev/null
@@ -0,0 +1,37 @@
+USING: rss io.files tools.test ;
+IN: temporary
+
+[ T{
+    feed
+    f
+    "Meerkat"
+    "http://meerkat.oreillynet.com"
+    V{
+        T{
+            entry
+            f
+            "XML: A Disruptive Technology"
+            "http://c.moreover.com/click/here.pl?r123"
+            "\n      XML is placing increasingly heavy loads on the existing technical\n      infrastructure of the Internet.\n    "
+            f
+        }
+    }
+} ] [ "extra/rss/rss1.xml" resource-path load-news-file ] unit-test
+[ T{
+    feed
+    f
+    "dive into mark"
+    "http://example.org/"
+    V{
+        T{
+            entry
+            f
+            "Atom draft-07 snapshot"
+            "http://example.org/2005/04/02/atom"
+            "\n         <div xmlns=\"http://www.w3.org/1999/xhtml\">\n           <p><i>[Update: The Atom draft is finished.]</i></p>\n         </div>\n       "
+
+            "2003-12-13T08:29:29-04:00"
+        }
+    }
+} ] [ "extra/rss/atom.xml" resource-path load-news-file ] unit-test
+[ " &amp; &amp; hi" ] [ " & &amp; hi" &>&amp; ] unit-test
diff --git a/extra/rss/rss.factor b/extra/rss/rss.factor
new file mode 100644 (file)
index 0000000..b0fdc65
--- /dev/null
@@ -0,0 +1,97 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+IN: rss
+! USING: kernel http-client xml xml-utils xml-data errors io strings
+!    sequences xml-writer parser-combinators lazy-lists entities ;
+USING: xml.utilities kernel promises parser-combinators assocs
+    parser-combinators.replace strings sequences xml.data xml.writer
+    io.streams.string combinators xml xml.entities io.files io
+    http.client ;
+
+: ?children>string ( tag/f -- string/f )
+    [ children>string ] [ f ] if* ;
+
+LAZY: '&amp;' ( -- parser )
+    "&" token
+    [ blank? ] satisfy &>
+    [ "&amp;" swap add ] <@ ;
+
+: &>&amp; ( string -- string )
+    '&amp;' replace ;
+
+TUPLE: feed title link entries ;
+
+C: <feed> feed
+
+TUPLE: entry title link description pub-date ;
+
+C: <entry> entry
+
+: rss1.0 ( xml -- feed )
+    [
+        "channel" tag-named
+        [ "title" tag-named children>string ] keep
+        "link" tag-named children>string
+    ] keep
+    "item" tags-named [
+        [ "title" tag-named children>string ] keep   
+        [ "link" tag-named children>string ] keep
+        [ "description" tag-named children>string ] keep
+        f "date" "http://purl.org/dc/elements/1.1/" <name>
+        tag-named ?children>string
+        <entry>
+    ] map <feed> ;
+
+: rss2.0 ( xml -- feed )
+    "channel" tag-named 
+    [ "title" tag-named children>string ] keep
+    [ "link" tag-named children>string ] keep
+    "item" tags-named [
+        [ "title" tag-named children>string ] keep
+        [ "link" tag-named ] keep
+        [ "guid" tag-named dupd ? children>string ] keep
+        [ "description" tag-named children>string ] keep
+        "pubDate" tag-named children>string <entry>
+    ] map <feed> ;
+
+: atom1.0 ( xml -- feed )
+    [ "title" tag-named children>string ] keep
+    [ "link" tag-named "href" swap at ] keep
+    "entry" tags-named [
+        [ "title" tag-named children>string ] keep
+        [ "link" tag-named "href" swap at ] keep
+        [
+            dup "content" tag-named
+            [ nip ] [ "summary" tag-named ] if*
+            dup tag-children [ tag? ] contains?
+            [ tag-children [ write-chunk ] string-out ]
+            [ children>string ] if
+        ] keep
+        dup "published" tag-named
+        [ nip ] [ "updated" tag-named ] if*
+        children>string <entry>
+    ] map <feed> ;
+
+: feed ( xml -- feed )
+    dup name-tag {
+        { "RDF" [ rss1.0 ] }
+        { "rss" [ rss2.0 ] }
+        { "feed" [ atom1.0 ] }
+    } case ;
+
+: read-feed ( string -- feed )
+    ! &>&amp; ! this will be uncommented when parser-combinators are fixed
+    [ string>xml ] with-html-entities feed ;
+
+: load-news-file ( filename -- feed )
+    #! Load an news syndication file and process it, returning
+    #! it as an feed tuple.
+    <file-reader> [ contents read-feed ] keep stream-close ;
+
+: news-get ( url -- feed )
+    #! Retrieve an news syndication file, return as a feed tuple.
+    http-get rot 200 = [
+        nip read-feed
+    ] [
+        2drop "Error retrieving newsfeed file" throw
+    ] if ;
diff --git a/extra/rss/rss1.xml b/extra/rss/rss1.xml
new file mode 100644 (file)
index 0000000..78a253b
--- /dev/null
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?> 
+
+<rdf:RDF 
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+  xmlns:co="http://purl.org/rss/1.0/modules/company/"
+  xmlns:ti="http://purl.org/rss/1.0/modules/textinput/"
+  xmlns="http://purl.org/rss/1.0/"
+> 
+
+  <channel rdf:about="http://meerkat.oreillynet.com/?_fl=rss1.0">
+    <title>Meerkat</title>
+    <link>http://meerkat.oreillynet.com</link>
+    <description>Meerkat: An Open Wire Service</description>
+    <dc:publisher>The O'Reilly Network</dc:publisher>
+    <dc:creator>Rael Dornfest (mailto:rael@oreilly.com)</dc:creator>
+    <dc:rights>Copyright &#169; 2000 O'Reilly &amp; Associates, Inc.</dc:rights>
+    <dc:date>2000-01-01T12:00+00:00</dc:date>
+    <sy:updatePeriod>hourly</sy:updatePeriod>
+    <sy:updateFrequency>2</sy:updateFrequency>
+    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
+
+    <image rdf:resource="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg" />
+
+    <items>
+      <rdf:Seq>
+        <rdf:li resource="http://c.moreover.com/click/here.pl?r123" />
+      </rdf:Seq>
+    </items>
+
+    <textinput rdf:resource="http://meerkat.oreillynet.com" />
+
+  </channel>
+
+  <image rdf:about="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg">
+    <title>Meerkat Powered!</title>
+    <url>http://meerkat.oreillynet.com/icons/meerkat-powered.jpg</url>
+    <link>http://meerkat.oreillynet.com</link>
+  </image>
+
+  <item rdf:about="http://c.moreover.com/click/here.pl?r123">
+    <title>XML: A Disruptive Technology</title> 
+    <link>http://c.moreover.com/click/here.pl?r123</link>
+    <dc:description>
+      XML is placing increasingly heavy loads on the existing technical
+      infrastructure of the Internet.
+    </dc:description>
+    <dc:publisher>The O'Reilly Network</dc:publisher>
+    <dc:creator>Simon St.Laurent (mailto:simonstl@simonstl.com)</dc:creator>
+    <dc:rights>Copyright &#169; 2000 O'Reilly &amp; Associates, Inc.</dc:rights>
+    <dc:subject>XML</dc:subject>
+    <co:name>XML.com</co:name>
+    <co:market>NASDAQ</co:market>
+    <co:symbol>XML</co:symbol>
+  </item> 
+
+  <textinput rdf:about="http://meerkat.oreillynet.com">
+    <title>Search Meerkat</title>
+    <description>Search Meerkat's RSS Database...</description>
+    <name>s</name>
+    <link>http://meerkat.oreillynet.com/</link>
+    <ti:function>search</ti:function>
+    <ti:inputType>regex</ti:inputType>
+  </textinput>
+
+</rdf:RDF>
diff --git a/extra/self/authors.txt b/extra/self/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/self/self.factor b/extra/self/self.factor
new file mode 100644 (file)
index 0000000..643f885
--- /dev/null
@@ -0,0 +1,12 @@
+
+USING: kernel namespaces vars ;
+
+IN: self
+
+VAR: self
+
+: with-self ( quot obj -- ) [ >self call ] with-scope ;
+
+: save-self ( quot -- ) self> >r self> clone >self call r> >self ;
+
+! : save-self ( quot -- ) [ self> clone >self call ] with-scope ;
\ No newline at end of file
diff --git a/extra/sequences/lib/authors.txt b/extra/sequences/lib/authors.txt
new file mode 100644 (file)
index 0000000..07c1c4a
--- /dev/null
@@ -0,0 +1,2 @@
+Eduardo Cavazos
+Doug Coleman
diff --git a/extra/sequences/lib/lib-tests.factor b/extra/sequences/lib/lib-tests.factor
new file mode 100644 (file)
index 0000000..a342391
--- /dev/null
@@ -0,0 +1,30 @@
+USING: kernel sequences.lib ;
+
+[ 4 ] [ { 1 2 } [ sq ] [ * ] map-reduce ] unit-test
+[ 36 ] [ { 2 3 } [ sq ] [ * ] map-reduce ] unit-test
+
+[ 10 ] [ { 1 2 3 4 } [ + ] reduce* ] unit-test
+[ 24 ] [ { 1 2 3 4 } [ * ] reduce* ] unit-test
+
+[ -4 ] [ 1 -4 [ abs ] higher ] unit-test
+[ 1 ] [ 1 -4 [ abs ] lower ] unit-test
+
+[ { 1 2 3 4 } ] [ { { 1 2 3 4 } { 1 2 3 } } longest ] unit-test
+[ { 1 2 3 4 } ] [ { { 1 2 3 } { 1 2 3 4 } } longest ] unit-test
+
+[ { 1 2 3 } ] [ { { 1 2 3 4 } { 1 2 3 } } shortest ] unit-test
+[ { 1 2 3 } ] [ { { 1 2 3 } { 1 2 3 4 } } shortest ] unit-test
+
+[ 3 ] [ 1 3 bigger ] unit-test
+[ 1 ] [ 1 3 smaller ] unit-test
+
+[ "abd" ] [ "abc" "abd" bigger ] unit-test
+[ "abc" ] [ "abc" "abd" smaller ] unit-test
+
+[ "abe" ] [ { "abc" "abd" "abe" } biggest ] unit-test
+[ "abc" ] [ { "abc" "abd" "abe" } smallest ] unit-test
+
+[ 1 3 ] [ { 1 2 3 } minmax ] unit-test
+[ -11 -9 ] [ { -11 -10 -9 } minmax ] unit-test
+[ -1/0. 1/0. ] [ { -1/0. 1/0. -11 -10 -9 } minmax ] unit-test
+
diff --git a/extra/sequences/lib/lib.factor b/extra/sequences/lib/lib.factor
new file mode 100644 (file)
index 0000000..147af87
--- /dev/null
@@ -0,0 +1,48 @@
+USING: combinators.lib kernel sequences math
+sequences.private shuffle ;
+
+IN: sequences.lib
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: map-reduce ( seq map-quot reduce-quot -- result )
+    >r [ unclip ] dip [ call ] keep r> compose reduce ; inline
+
+: reduce* ( seq quot -- result ) [ ] swap map-reduce ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: higher ( a b quot -- c ) [ compare 0 > ] curry most ; inline
+
+: lower  ( a b quot -- c ) [ compare 0 < ] curry most ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: longer  ( a b -- c ) [ length ] higher ;
+
+: shorter ( a b -- c ) [ length ] lower ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: longest ( seq -- item ) [ longer ] reduce* ;
+
+: shortest ( seq -- item ) [ shorter ] reduce* ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: bigger ( a b -- c ) [ ] higher ;
+
+: smaller ( a b -- c ) [ ] lower ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: biggest ( seq -- item ) [ bigger ] reduce* ;
+
+: smallest ( seq -- item ) [ smaller ] reduce* ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: minmax ( seq -- min max )
+    #! find the min and max of a seq in one pass
+    1/0. -1/0. rot [ tuck max >r min r> ] each ;
+
diff --git a/extra/sequences/lib/tags.txt b/extra/sequences/lib/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/sequences/next/authors.txt b/extra/sequences/next/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/sequences/next/next-tests.factor b/extra/sequences/next/next-tests.factor
new file mode 100644 (file)
index 0000000..be728b2
--- /dev/null
@@ -0,0 +1,5 @@
+USING: sequences.next tools.test arrays kernel math sequences ;
+
+[ { { 1 0 } { 2 1 } { f 2 } } ] [ 3 [ 2array ] map-next ] unit-test
+
+[ 8 ] [ 3 [ 1+ ] map 0 swap [ swap [ + + ] [ drop ] if* ] each-next ] unit-test
diff --git a/extra/sequences/next/next.factor b/extra/sequences/next/next.factor
new file mode 100644 (file)
index 0000000..5483cdf
--- /dev/null
@@ -0,0 +1,20 @@
+USING: kernel sequences sequences.private math ;
+IN: sequences.next
+
+<PRIVATE
+
+: (map-next) ( i seq quot -- )
+    ! this uses O(n) more bounds checks than is really necessary
+    >r [ >r 1+ r> ?nth ] 2keep nth-unsafe r> call ; inline
+
+PRIVATE>
+
+: each-next ( seq quot -- )
+    ! quot: next-elt elt --
+    iterate-seq [ (map-next) ] 2curry each-integer ; inline
+
+: map-next ( seq quot -- newseq )
+    ! quot: next-elt elt -- newelt
+    over dup length swap new >r
+    iterate-seq [ (map-next) ] 2curry
+    r> [ collect ] keep ; inline
diff --git a/extra/sequences/next/tags.txt b/extra/sequences/next/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/serialize/authors.txt b/extra/serialize/authors.txt
new file mode 100644 (file)
index 0000000..4fd6be9
--- /dev/null
@@ -0,0 +1,2 @@
+Chris Double
+Adam Langley
diff --git a/extra/serialize/serialize-docs.factor b/extra/serialize/serialize-docs.factor
new file mode 100644 (file)
index 0000000..fd257c9
--- /dev/null
@@ -0,0 +1,49 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.syntax help.markup ;
+IN: serialize
+
+HELP: (serialize) 
+{ $values { "obj" "object to serialize" } 
+}
+{ $description "Serializes the object to the current output stream. Object references within the structure being serialized are maintained. It must be called from within the scope of a " { $link with-serialized } " call." } 
+{ $examples 
+    { $example "USE: serialize" "[\n  [ { 1 2 } dup  (serialize) (serialize) ] with-serialized\n] string-out\n\n[\n  [ (deserialize) (deserialize) ] with-serialized\n] string-in eq? ." "t" }
+}
+{ $see-also deserialize (deserialize) serialize with-serialized } ;
+
+HELP: (deserialize) 
+{ $values { "obj" "deserialized object" } 
+}
+{ $description "Deserializes an object by reading from the current input stream. Object references within the structure that was originally serialized are maintained. It must be called from within the scope of a " { $link with-serialized } " call." } 
+{ $examples 
+    { $example "USE: serialize" "[\n  [ { 1 2 } dup  serialize serialize ] with-serialized\n] string-out\n\n[\n  [ deserialize deserialize ] with-serialized\n] string-in eq? ." "t" }
+}
+{ $see-also (serialize) deserialize serialize with-serialized } ;
+
+HELP: with-serialized
+{ $values { "quot" "a quotation" } 
+}
+{ $description "Creates a scope for serialization and deserialization operations. The quotation is called within this scope. The scope is used for maintaining the structure and object references of serialized objects." } 
+{ $examples 
+    { $example "USE: serialize" "[\n  [ { 1 2 } dup  (serialize) (serialize) ] with-serialized\n] string-out\n\n[\n  [ (deserialize) (deserialize) ] with-serialized\n] string-in eq? ." "t" }
+}
+{ $see-also (serialize) (deserialize) serialize deserialize } ;
+
+HELP: serialize
+{ $values { "obj" "object to serialize" } 
+}
+{ $description "Serializes the object to the current output stream. Object references within the structure being serialized are maintained." } 
+{ $examples 
+    { $example "USE: serialize" "[  { 1 2 } serialize ] ] string-out\n\n[ deserialize ] string-in ." "{ 1 2 }" }
+}
+{ $see-also deserialize (deserialize) (serialize) with-serialized } ;
+
+HELP: deserialize
+{ $values { "obj" "deserialized object" } 
+}
+{ $description "Deserializes an object by reading from the current input stream. Object references within the structure that was originally serialized are maintained." } 
+{ $examples 
+    { $example "USE: serialize" "[  { 1 2 } serialize ] ] string-out\n\n[ deserialize ] string-in ." "{ 1 2 }" }
+}
+{ $see-also (serialize) deserialize (deserialize) with-serialized } ;
diff --git a/extra/serialize/serialize-tests.factor b/extra/serialize/serialize-tests.factor
new file mode 100644 (file)
index 0000000..b312ce3
--- /dev/null
@@ -0,0 +1,60 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+! 
+USING: tools.test kernel serialize io io.streams.string math
+alien arrays byte-arrays sequences math prettyprint ;
+IN: temporary
+
+TUPLE: serialize-test a b ;
+
+C: <serialize-test> serialize-test
+
+: CURRY< \ > parse-until first2 curry parsed ; parsing
+
+: objects
+    {
+        f
+        t
+        0
+        -50
+        20
+        5.25
+        -5.25
+        C{ 1 2 }
+        1/2
+        "test"
+        { 1 2 "three" }
+        V{ 1 2 "three" }
+        SBUF" hello world"
+        \ dup
+        [ \ dup dup ]
+        T{ serialize-test f "a" 2 }
+        B{ 50 13 55 64 1 }
+        ?{ t f t f f t f }
+        F{ 1.0 3.0 4.0 1.0 2.35 0.33 }
+        CURRY< 1 [ 2 ] >
+        { { "a" "bc" } { "de" "fg" } }
+        H{ { "a" "bc" } { "de" "fg" } }
+    } ;
+
+: check-serialize-1 ( obj -- ? )
+    dup class .
+    dup [ serialize ] string-out
+    [ deserialize ] string-in = ;
+
+: check-serialize-2 ( obj -- ? )
+    dup number? over wrapper? or [
+        drop t ! we don't care if numbers aren't interned
+    ] [
+        dup class .
+        dup 2array
+        [ serialize ] string-out
+        [ deserialize ] string-in
+        first2 eq?
+    ] if ;
+
+[ t ] [ objects [ check-serialize-1 ] all? ] unit-test
+
+[ t ] [ objects [ check-serialize-2 ] all? ] unit-test
+
+[ t ] [ pi check-serialize-1 ] unit-test
diff --git a/extra/serialize/serialize.factor b/extra/serialize/serialize.factor
new file mode 100644 (file)
index 0000000..3700331
--- /dev/null
@@ -0,0 +1,273 @@
+! Copyright (C) 2006 Adam Langley and Chris Double.
+! Adam Langley was the original author of this work.
+!
+! Chris Double modified it to fix bugs and get it working
+! correctly under the latest versions of Factor.
+!
+! See http://factorcode.org/license.txt for BSD license.
+!
+IN: serialize
+USING: namespaces sequences kernel math io math.functions
+io.binary strings classes words sbufs tuples arrays
+vectors byte-arrays bit-arrays quotations hashtables
+assocs help.syntax help.markup float-arrays splitting ;
+
+! Variable holding a sequence of objects already serialized
+SYMBOL: serialized
+
+: add-object ( obj -- id )
+    #! Add an object to the sequence of already serialized
+    #! objects. Return the id of that object.
+    serialized get [ push ] keep length 1 - ;
+
+: object-id ( obj -- id )
+    #! Return the id of an already serialized object 
+    serialized get [ eq? ] curry* find [ drop f ] unless ;
+
+USE: prettyprint 
+
+! Serialize object
+GENERIC: (serialize) ( obj -- )
+
+: serialize-cell 8 >be write ;
+
+: deserialize-cell 8 read be> ;
+
+: serialize-shared ( obj quot -- )
+    >r dup object-id
+    [ "o" write serialize-cell drop ] r> if* ; inline
+
+M: f (serialize) ( obj -- )
+    drop "n" write ;
+
+: bytes-needed ( number -- int )
+    log2 8 + 8 /i ; inline
+
+M: integer (serialize) ( obj -- )
+    dup 0 = [
+        drop "z" write
+    ] [
+        dup 0 < [ neg "m" ] [ "p" ] if write 
+        dup bytes-needed dup serialize-cell
+        >be write 
+    ] if ;
+
+M: float (serialize) ( obj -- )
+    "F" write
+    double>bits serialize-cell ;
+
+M: complex (serialize) ( obj -- )
+    "c" write
+    dup real (serialize)
+    imaginary (serialize) ;
+
+M: ratio (serialize) ( obj -- )
+    "r" write
+    dup numerator (serialize)
+    denominator (serialize) ;
+
+M: string (serialize) ( obj -- )
+    [
+        "s" write
+        dup add-object serialize-cell
+        dup length serialize-cell
+        write 
+    ] serialize-shared ;
+
+M: sbuf (serialize) ( obj -- )
+    [
+        "S" write
+        dup add-object serialize-cell
+        dup length serialize-cell
+        >string write 
+    ] serialize-shared ;
+
+M: tuple (serialize) ( obj -- )
+    [
+        "T" write
+        dup add-object serialize-cell
+        tuple>array
+        dup length serialize-cell
+        [ (serialize) ] each
+    ] serialize-shared ;
+
+: serialize-seq ( seq code -- )
+    [
+        write
+        dup add-object serialize-cell
+        dup length serialize-cell
+        [ (serialize) ] each
+    ] curry serialize-shared ;
+
+M: array (serialize) ( obj -- )
+    "a" serialize-seq ;
+
+M: vector (serialize) ( obj -- )
+    "v" serialize-seq ;
+
+M: byte-array (serialize) ( obj -- )
+    "A" serialize-seq ;
+
+M: bit-array (serialize) ( obj -- )
+    "b" serialize-seq ;
+
+M: quotation (serialize) ( obj -- )
+    "q" serialize-seq ;
+
+M: curry (serialize) ( obj -- )
+    [
+        "C" write
+        dup add-object serialize-cell
+        dup curry-obj (serialize) curry-quot (serialize)
+    ] serialize-shared ;
+
+M: float-array (serialize) ( obj -- )
+    [
+        "f" write
+        dup add-object serialize-cell
+        dup length serialize-cell
+        [ double>bits 8 >be write ] each
+    ] serialize-shared ;
+
+M: hashtable (serialize) ( obj -- )
+    [
+        "h" write
+        dup add-object serialize-cell
+        >alist (serialize)
+    ] serialize-shared ;
+
+M: word (serialize) ( obj -- )
+    "w" write
+    dup word-name (serialize)
+    word-vocabulary (serialize) ;
+
+M: wrapper (serialize) ( obj -- )
+    "W" write
+    wrapped (serialize) ;
+
+DEFER: (deserialize) ( -- obj )
+
+: intern-object ( id obj -- obj )
+    dup rot serialized get set-nth ;
+
+: deserialize-false ( -- f )
+    f ;
+
+: deserialize-positive-integer ( -- number )
+    deserialize-cell read be> ;
+
+: deserialize-negative-integer ( -- number )
+    deserialize-positive-integer neg ;
+
+: deserialize-zero ( -- number )
+    0 ;
+
+: deserialize-float ( -- float )
+    deserialize-cell bits>double ;
+
+: deserialize-ratio ( -- ratio )
+    (deserialize) (deserialize) / ;
+
+: deserialize-complex ( -- complex )
+    (deserialize) (deserialize) rect> ;
+
+: deserialize-string ( -- string )
+    deserialize-cell deserialize-cell read intern-object ;
+
+: deserialize-sbuf ( -- sbuf )
+    deserialize-cell deserialize-cell read >sbuf intern-object ;
+
+: deserialize-word ( -- word )
+    (deserialize) dup (deserialize) lookup
+    [ ] [ "Unknown word" throw ] ?if ;
+
+: deserialize-wrapper ( -- wrapper )
+    (deserialize) <wrapper> ;
+
+: deserialize-seq ( seq -- array )
+    deserialize-cell deserialize-cell
+    [ drop (deserialize) ] roll map-as
+    intern-object ;
+
+: deserialize-array ( -- array )
+    { } deserialize-seq ;
+
+: deserialize-vector ( -- array )
+    V{ } deserialize-seq ;
+
+: deserialize-quotation ( -- array )
+    [ ] deserialize-seq ;
+
+: deserialize-byte-array ( -- byte-array )
+    B{ } deserialize-seq ;
+
+: deserialize-bit-array ( -- bit-array )
+    ?{ } deserialize-seq ;
+
+: deserialize-float-array ( -- float-array )
+    deserialize-cell deserialize-cell
+    8 * read 8 <groups> [ be> bits>double ] F{ } map-as
+    intern-object ;
+
+: deserialize-hashtable ( -- hashtable )
+    deserialize-cell (deserialize) >hashtable intern-object ;
+
+: deserialize-tuple ( -- array )
+    deserialize-cell
+    deserialize-cell [ drop (deserialize) ] map >tuple
+    intern-object ;
+
+: deserialize-curry ( -- curry )
+    deserialize-cell
+    (deserialize) (deserialize) curry
+    intern-object ;
+
+: deserialize-unknown ( -- object )
+    deserialize-cell serialized get nth ;
+
+: deserialize* ( -- object ? )
+    read1 [
+        H{
+            { CHAR: A deserialize-byte-array }
+            { CHAR: C deserialize-curry }
+            { CHAR: F deserialize-float }
+            { CHAR: S deserialize-sbuf }
+            { CHAR: T deserialize-tuple }
+            { CHAR: W deserialize-wrapper }
+            { CHAR: a deserialize-array }
+            { CHAR: b deserialize-bit-array }
+            { CHAR: c deserialize-complex }
+            { CHAR: f deserialize-float-array }
+            { CHAR: h deserialize-hashtable }
+            { CHAR: m deserialize-negative-integer }
+            { CHAR: n deserialize-false }
+            { CHAR: o deserialize-unknown }
+            { CHAR: p deserialize-positive-integer }
+            { CHAR: q deserialize-quotation }
+            { CHAR: r deserialize-ratio }
+            { CHAR: s deserialize-string }
+            { CHAR: v deserialize-vector }
+            { CHAR: w deserialize-word }
+            { CHAR: z deserialize-zero }
+        } at dup [ "Unknown typecode" throw ] unless execute t
+    ] [
+        f f
+    ] if* ;
+
+: (deserialize) ( -- obj )
+    deserialize* [ "End of stream" throw ] unless ;
+
+: with-serialized ( quot -- )
+    V{ } clone serialized rot with-variable ; inline
+
+: (deserialize-sequence)
+    deserialize* [ , (deserialize-sequence) ] [ drop ] if ;
+
+: deserialize-sequence ( -- seq )
+    [ (deserialize-sequence) ] { } make ;
+
+: deserialize ( -- obj )
+    [ (deserialize) ] with-serialized ;
+
+: serialize ( obj -- )
+    [ (serialize) ] with-serialized ;
\ No newline at end of file
diff --git a/extra/serialize/summary.txt b/extra/serialize/summary.txt
new file mode 100644 (file)
index 0000000..df5da49
--- /dev/null
@@ -0,0 +1 @@
+Binary serialization of arbitrary object graphs
diff --git a/extra/shuffle/authors.txt b/extra/shuffle/authors.txt
new file mode 100644 (file)
index 0000000..26093b4
--- /dev/null
@@ -0,0 +1,2 @@
+Chris Double
+Doug Coleman
diff --git a/extra/shuffle/shuffle-docs.factor b/extra/shuffle/shuffle-docs.factor
new file mode 100644 (file)
index 0000000..fdbbd44
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.syntax help.markup kernel sequences shuffle ;\r
+\r
+HELP: npick\r
+{ $values { "n" "a number" } }\r
+{ $description "A generalisation of " { $link dup } ", " \r
+{ $link over } " and " { $link pick } " that can work " \r
+"for any stack depth. The nth item down the stack will be copied and "\r
+"placed on the top of the stack."\r
+} \r
+{ $examples\r
+  { $example "USE: shuffle" "1 2 3 4 4 npick .s" "1\n2\n3\n4\n1" }\r
+}\r
+{ $see-also dup over pick } ;\r
+\r
+HELP: ndup\r
+{ $values { "n" "a number" } }\r
+{ $description "A generalisation of " { $link dup } ", " \r
+{ $link 2dup } " and " { $link 3dup } " that can work " \r
+"for any number of items. The n topmost items on the stack will be copied and "\r
+"placed on the top of the stack."\r
+} \r
+{ $examples\r
+  { $example "USE: shuffle" "1 2 3 4 4 ndup .s" "1\n2\n3\n4\n1\n2\n3\n4" }\r
+}\r
+{ $see-also dup 2dup 3dup } ;\r
+\r
+HELP: nnip\r
+{ $values { "n" "a number" } }\r
+{ $description "A generalisation of " { $link nip } " and " { $link 2nip } \r
+" that can work " \r
+"for any number of items."\r
+} \r
+{ $examples\r
+  { $example "USE: shuffle" "1 2 3 4 3 nnip .s" "4" }\r
+}\r
+{ $see-also nip 2nip } ;\r
+\r
+HELP: ndrop\r
+{ $values { "n" "a number" } }\r
+{ $description "A generalisation of " { $link drop } \r
+" that can work " \r
+"for any number of items."\r
+} \r
+{ $examples\r
+  { $example "USE: shuffle" "1 2 3 4 3 ndrop .s" "1" }\r
+}\r
+{ $see-also drop 2drop 3drop } ;\r
+\r
+HELP: nrot\r
+{ $values { "n" "a number" } }\r
+{ $description "A generalisation of " { $link rot } " that works for any "\r
+"number of items on the stack. " \r
+} \r
+{ $examples\r
+  { $example "USE: shuffle" "1 2 3 4 4 nrot .s" "2\n3\n4\n1" }\r
+}\r
+{ $see-also rot -nrot } ;\r
+\r
+HELP: -nrot\r
+{ $values { "n" "a number" } }\r
+{ $description "A generalisation of " { $link -rot } " that works for any "\r
+"number of items on the stack. " \r
+} \r
+{ $examples\r
+  { $example "USE: shuffle" "1 2 3 4 4 -nrot .s" "4\n1\n2\n3" }\r
+}\r
+{ $see-also rot nrot } ;\r
+\r
+ARTICLE: { "shuffle" "overview" } "Extra shuffle words"\r
+"A number of stack shuffling words for those rare times when you "\r
+"need to deal with tricky stack situations and can't refactor the "\r
+"code to work around it." \r
+{ $subsection ndup } \r
+{ $subsection npick } \r
+{ $subsection nrot } \r
+{ $subsection -nrot } \r
+{ $subsection nnip } \r
+{ $subsection ndrop }  ;\r
+\r
+IN: shuffle\r
+ABOUT: { "shuffle" "overview" }
\ No newline at end of file
diff --git a/extra/shuffle/shuffle-tests.factor b/extra/shuffle/shuffle-tests.factor
new file mode 100644 (file)
index 0000000..165914e
--- /dev/null
@@ -0,0 +1,25 @@
+USING: arrays shuffle kernel math tools.test compiler words ;
+
+[ 8 ] [ 5 6 7 8 3nip ] unit-test
+{ 1 2 3 4 1 } [ 1 2 3 4 4 npick ] unit-test
+{ 1 2 3 4 2 } [ 1 2 3 4 3 npick ] unit-test
+{ 1 2 3 4 3 } [ 1 2 3 4 2 npick ] unit-test
+{ 1 2 3 4 4 } [ 1 2 3 4 1 npick ] unit-test
+{ t } [ [ 1 1 ndup ] compile-quot compiled? ] unit-test
+{ 1 1 } [ 1 1 ndup ] unit-test
+{ 1 2 1 2 } [ 1 2 2 ndup ] unit-test
+{ 1 2 3 1 2 3 } [ 1 2 3 3 ndup ] unit-test
+{ 1 2 3 4 1 2 3 4 } [ 1 2 3 4 4 ndup ] unit-test
+{ t } [ [ 1 2 2 nrot ] compile-quot compiled? ] unit-test
+{ 2 1 } [ 1 2 2 nrot ] unit-test
+{ 2 3 1 } [ 1 2 3 3 nrot ] unit-test
+{ 2 3 4 1 } [ 1 2 3 4 4 nrot ] unit-test
+{ t } [ [ 1 2 2 -nrot ] compile-quot compiled? ] unit-test
+{ 2 1 } [ 1 2 2 -nrot ] unit-test
+{ 3 1 2 } [ 1 2 3 3 -nrot ] unit-test
+{ 4 1 2 3 } [ 1 2 3 4 4 -nrot ] unit-test
+{ t } [ [ 1 2 3 4 3 nnip ] compile-quot compiled? ] unit-test
+{ 4 } [ 1 2 3 4 3 nnip ] unit-test
+{ t } [ [ 1 2 3 4 4 ndrop ] compile-quot compiled? ] unit-test
+{ 0 } [ 0 1 2 3 4 4 ndrop ] unit-test
+[ 3 1 2 3 ] [ 1 2 3 tuckd ] unit-test
diff --git a/extra/shuffle/shuffle.factor b/extra/shuffle/shuffle.factor
new file mode 100644 (file)
index 0000000..b2523ed
--- /dev/null
@@ -0,0 +1,32 @@
+! Copyright (C) 2007 Chris Double, Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences namespaces math inference.transforms
+       combinators macros quotations math.ranges bake ;
+
+IN: shuffle
+
+MACRO: npick ( n -- ) 1- dup saver [ dup ] rot [ r> swap ] n*quot 3append ;
+
+MACRO: ndup ( n -- ) dup [ npick ] curry n*quot ;
+
+MACRO: nrot ( n -- ) 1- dup saver swap [ r> swap ] n*quot append ;
+
+MACRO: -nrot ( n -- ) 1- dup [ swap >r ] n*quot swap restorer append ;
+
+MACRO: ndrop ( n -- ) [ drop ] n*quot ;
+
+: nnip ( n -- ) swap >r ndrop r> ; inline
+
+MACRO: ntuck ( n -- ) 2 + [ dup , -nrot ] bake ;
+
+: 2swap ( x y z t -- z t x y ) rot >r rot r> ; inline
+
+: 2over ( a b c -- a b c a b ) pick pick ; inline
+
+: nipd ( a b c -- b c ) rot drop ; inline
+
+: 3nip ( a b c d -- d ) 3 nnip ; inline
+
+: 4dup ( a b c d -- a b c d a b c d ) 4 ndup ; inline
+
+: tuckd ( x y z -- z x y z ) 2 ntuck ; inline
diff --git a/extra/shuffle/summary.txt b/extra/shuffle/summary.txt
new file mode 100644 (file)
index 0000000..12c22b8
--- /dev/null
@@ -0,0 +1 @@
+Additional shuffle words
diff --git a/extra/shuffle/tags.txt b/extra/shuffle/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/shufflers/authors.txt b/extra/shufflers/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/shufflers/shufflers-docs.factor b/extra/shufflers/shufflers-docs.factor
new file mode 100644 (file)
index 0000000..efeb4dc
--- /dev/null
@@ -0,0 +1,12 @@
+USING: shufflers help.syntax help.markup ;
+
+HELP: SHUFFLE:
+{ $syntax "SHUFFLE: alphabet #" }
+{ $values { "alphabet" "an alphabet of unique letters" } { "#" "the maximum length" } }
+{ $description "Defines stack shufflers of the form abc-bcba where 'abc' describes the inputs and 'bcba' describes the outputs. Given a stack of 1 2 3, this returns 2 3 2 1. The stack shufflers defined are put in the current vocab with the suffix '.shuffle' appended." }
+{ $examples
+"SHUFFLE: abcd 6\n"
+": 4drop abcd- ;\n"
+": 2over abcd-abcdab ;\n"
+": 2swap abcd-cdab ;\n"
+": 3dup abc-abcabc ;\n" } ;
diff --git a/extra/shufflers/shufflers-tests.factor b/extra/shufflers/shufflers-tests.factor
new file mode 100644 (file)
index 0000000..d59e18d
--- /dev/null
@@ -0,0 +1,9 @@
+USING: shufflers tools.test ;
+
+[ { 1 1 0 0 1 0 } ] [ BIN: 010011 2 6 translate ] unit-test
+
+SHUFFLE: abcd 4
+[ ] [ 1 2 3 4 abcd- ] unit-test
+[ 1 2 1 2 ] [ 1 2 3 abc-abab ] unit-test
+[ 4 3 2 1 ] [ 1 2 3 4 abcd-dcba ] unit-test
+[ 1 1 1 1 ] [ 1 a-aaaa ] unit-test
diff --git a/extra/shufflers/shufflers.factor b/extra/shufflers/shufflers.factor
new file mode 100644 (file)
index 0000000..e0c5141
--- /dev/null
@@ -0,0 +1,47 @@
+USING: kernel sequences words math math.functions arrays 
+shuffle quotations parser math.parser strings namespaces 
+splitting effects ;
+IN: shufflers
+
+: shuffle>string ( names shuffle -- string )
+    swap [ [ nth ] curry map ] curry map
+    first2 "-" swap 3append >string ;
+
+: translate ( n alphabet out-len -- seq )
+    [ drop /mod ] curry* map nip  ;
+
+: (combinations) ( alphabet out-len -- seq[seq] )
+    [ ^ ] 2keep [ translate ] 2curry map ;
+
+: combinations ( n max-out -- seq[seq] )
+    ! This returns a seq of length O(n^m)
+    ! where and m is max-out
+    1+ [ (combinations) ] curry* map concat ;
+
+: make-shuffles ( max-out max-in -- shuffles )
+    [ 1+ dup rot combinations [ 2array ] curry* map ]
+    curry* map concat ;
+
+: shuffle>quot ( shuffle -- quot )
+    [
+        first2 2dup [ - ] curry* map
+        reverse [ , \ npick , \ >r , ] each
+        swap , \ ndrop , length [ \ r> , ] times
+    ] [ ] make ;
+
+: put-effect ( word -- )
+    dup word-name "-" split1
+    [ >array [ 1string ] map ] 2apply
+    <effect> "declared-effect" set-word-prop ;
+
+: in-shuffle ( -- ) in get ".shuffle" append set-in ;
+: out-shuffle ( -- ) in get ".shuffle" ?tail drop set-in ;
+
+: define-shuffles ( names max-out -- )
+    in-shuffle over length make-shuffles [
+        [ shuffle>string create-in ] keep
+        shuffle>quot dupd define-compound put-effect
+    ] curry* each out-shuffle ;
+
+: SHUFFLE:
+    scan scan string>number define-shuffles ; parsing
diff --git a/extra/shufflers/summary.txt b/extra/shufflers/summary.txt
new file mode 100644 (file)
index 0000000..37b87be
--- /dev/null
@@ -0,0 +1 @@
+Arbitrary stack shuffling operators of the form abc-cbab
diff --git a/extra/shufflers/tags.txt b/extra/shufflers/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/slides/authors.txt b/extra/slides/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/slides/slides.factor b/extra/slides/slides.factor
new file mode 100644 (file)
index 0000000..96ba21b
--- /dev/null
@@ -0,0 +1,92 @@
+USING: arrays hashtables help.markup help.stylesheet io
+io.styles kernel math models namespaces sequences ui ui.gadgets
+ui.gadgets.books ui.gadgets.controls ui.gadgets.panes
+ui.gestures ui.render ;
+IN: slides
+
+: stylesheet
+    H{
+        { default-style
+            H{
+                { font "sans-serif" }
+                { font-size 36 }
+                { wrap-margin 1000 }
+            }
+        }
+        { code-style
+            H{
+                { font "monospace" }
+                { font-size 36 }
+                { page-color { 0.4 0.4 0.4 0.3 } }
+            }
+        }
+        { snippet-style
+            H{
+                { font "monospace" }
+                { font-size 36 }
+                { foreground { 0.1 0.1 0.4 1 } }
+            }
+        }
+        { table-content-style
+            H{ { wrap-margin 800 } }
+        }
+        { list-style
+            H{ { table-gap { 10 20 } } }
+        }
+        { bullet "\u00b7" }
+    } ;
+
+: $title ( string -- )
+    [ H{ { font "sans-serif" } { font-size 48 } } format ] ($block) ;
+
+: $divider ( -- )
+    [
+        <gadget>
+        T{ gradient f { { 0.25 0.25 0.25 1.0 } { 1.0 1.0 1.0 0.0 } } }
+        over set-gadget-interior
+        { 800 10 } over set-gadget-dim
+        { 1 0 } over set-gadget-orientation
+        gadget.
+    ] ($block) ;
+
+: page-theme
+    T{ gradient f { { 0.8 0.8 1.0 1.0 } { 0.8 1.0 1.0 1.0 } } }
+    swap set-gadget-interior ;
+
+: <page> ( list -- gadget )
+    [
+        stylesheet clone [
+            [ print-element ] with-default-style
+        ] bind
+    ] make-pane
+    dup page-theme ;
+
+: $slide ( element -- )
+    unclip $title
+    $divider
+    $list ;
+
+TUPLE: slides ;
+
+: <slides> ( slides -- gadget )
+    [ <page> ] map 0 <model> <book>
+    slides construct-gadget
+    [ set-gadget-delegate ] keep ;
+
+: change-page ( book n -- )
+    over control-value + over gadget-children length rem
+    swap control-model set-model ;
+
+: next-page ( book -- ) 1 change-page ;
+
+: prev-page ( book -- ) -1 change-page ;
+
+\ slides H{
+    { T{ key-down f f "DOWN" } [ next-page ] }
+    { T{ key-down f f "UP" } [ prev-page ] }
+} set-gestures
+
+: slides-window ( slides -- )
+    [ <slides> "Slides" open-window ] with-ui ;
+
+MAIN: slides-window
diff --git a/extra/smtp/authors.txt b/extra/smtp/authors.txt
new file mode 100644 (file)
index 0000000..7c29e7c
--- /dev/null
@@ -0,0 +1 @@
+Elie Chaftari
diff --git a/extra/smtp/smtp-server.factor b/extra/smtp/smtp-server.factor
new file mode 100644 (file)
index 0000000..e980ee3
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+
+! Usage: 8889 start-server
+! $ telnet 127.0.0.1 8889
+! Trying 127.0.0.1...
+! Connected to localhost.
+! Escape character is '^]'.
+! 220 hello
+! EHLO
+! 220 and..?
+! MAIL FROM: <here@mail.com>
+! 220 OK
+! RCPT TO: <there@mail.com>
+! 220 OK
+! Hi
+! 500 ERROR
+! DATA
+! 354 Enter message, ending with "." on a line by itself
+! Hello I am still waiting for your call
+! Thanks
+! .
+! 220 OK
+! QUIT
+! bye
+! Connection closed by foreign host.
+
+USING: combinators kernel prettyprint io io.server sequences
+namespaces ;
+
+SYMBOL: data-mode
+
+: process ( -- )
+    readln {
+        { [ [ dup "HELO" head? ] keep "EHLO" head? or ] [ 
+            "220 and..?\r\n" write flush t
+          ] }
+        { [ dup "QUIT" = ] [ 
+            "bye\r\n" write flush f
+          ] }
+        { [ dup "MAIL FROM:" head? ] [ 
+            "220 OK\r\n" write flush t
+          ] }
+        { [ dup "RCPT TO:" head? ] [ 
+            "220 OK\r\n" write flush t
+          ] }
+        { [ dup "DATA" = ] [
+            data-mode on 
+            "354 Enter message, ending with \".\" on a line by itself\r\n"
+            write flush t
+          ] }
+        { [ dup "." = data-mode get and ] [
+            data-mode off
+            "220 OK\r\n" write flush t
+          ] }
+        { [ data-mode get ] [ t ] }
+        { [ t ] [ 
+            "500 ERROR\r\n" write flush t
+          ] }
+    } cond nip [ process ] when ;
+
+: start-server ( port -- )
+    "Starting SMTP server on port " write dup . flush
+    internet-server "smtp-server" [
+        60000 stdio get set-timeout
+        "220 hello\r\n" write flush
+        process
+    ] with-server ;
diff --git a/extra/smtp/smtp-tests.factor b/extra/smtp/smtp-tests.factor
new file mode 100644 (file)
index 0000000..8ab1fd0
--- /dev/null
@@ -0,0 +1,41 @@
+! Tested with Apache JAMES version 2.3.1 on localhost
+! cram-md5 authentication tested against Exim 4
+! Replace "localhost" with your smtp server
+! e.g. "your.smtp.server" initialize
+
+USING: smtp tools.test ;
+
+"localhost" initialize ! replace localhost with your smtp server
+
+! 8889 set-port ! default port = 25, change for testing purposes
+
+! 30000 set-read-timeout ! default = 60000
+! f set-esmtp ! when esmtp (extended smtp) is not supported
+
+start
+
+! "md5 password here" "login" cram-md5-auth
+
+"root@localhost" mailfrom ! your@mail.address
+
+"root@localhost" rcptto ! someone@example.com
+
+! { "From: Your Name <your@mail.address>" 
+!   "To: Destination Address <someone@example.com>"
+!   "Subject: test message"
+!   "Date: Thu, 17 May 2007 18:46:45 +0200"
+!   "Message-Id: <unique.message.id.string@example.com>"
+!   " "
+!   "This is a test message."
+! } send-message
+
+{ "From: Your Name <root@localhost>" 
+  "To: Destination Address <root@localhost>"
+  "Subject: test message"
+  "Date: Thu, 17 May 2007 18:46:45 +0200"
+  "Message-Id: <unique.message.id.string@example.com>"
+  " "
+  "This is a test message."
+} send-message
+
+quit
\ No newline at end of file
diff --git a/extra/smtp/smtp.factor b/extra/smtp/smtp.factor
new file mode 100644 (file)
index 0000000..9116d09
--- /dev/null
@@ -0,0 +1,138 @@
+! Copyright (C) 2007 Elie CHAFTARI
+! See http://factorcode.org/license.txt for BSD license.
+!
+! cram-md5 auth code contributed by Dirk Vleugels <dvl@2scale.net>
+
+USING: alien alien.c-types combinators crypto.common crypto.hmac base64
+kernel io io.sockets namespaces sequences splitting ;
+
+IN: smtp
+
+! =========================================================
+! smtp.factor implementation
+! =========================================================
+
+! Connection default values
+: default-port  25                      ; inline
+: read-timeout  60000                   ; inline
+: esmtp         t                       ; inline ! t = ehlo
+: domain        "localhost.localdomain" ; inline
+
+SYMBOL: sess
+SYMBOL: conn
+SYMBOL: challenge
+
+TUPLE: session address port timeout domain esmtp ;
+
+: <session> ( address -- session )
+    default-port read-timeout domain esmtp
+    session construct-boa ;
+
+! =========================================================
+! Initialization routines
+! =========================================================
+
+: initialize ( address -- )
+    <session> sess set ;
+
+: set-port ( port -- )
+    sess get set-session-port ;
+
+: set-read-timeout ( timeout -- )
+    sess get set-session-timeout ;
+
+: set-esmtp ( esmtp -- )
+    sess get set-session-esmtp ;
+
+: set-domain ( -- )
+    host-name sess get set-session-domain ;
+
+: do-start ( -- )
+    sess get [ session-address ] keep session-port <inet> <client>
+    dup conn set [ sess get session-timeout swap set-timeout ]
+    keep stream-readln print ;
+
+! =========================================================
+! Command routines
+! =========================================================
+
+: check-response ( response -- )
+    {
+        { [ dup "220" head? ] [ print ] }
+        { [ dup "235" swap subseq? ] [ print ] }
+        { [ dup "250" head? ] [ print ] }
+        { [ dup "221" head? ] [ print ] }
+        { [ dup "bye" head? ] [ print ] }
+        { [ dup "4" head? ] [ "server busy" throw ] }
+        { [ dup "334" head? ] [ " " split 1 swap nth base64> challenge set ] }
+        { [ dup "354" head? ] [ print ] }
+        { [ dup "50" head? ] [ print "syntax error" throw ] }
+        { [ dup "53" head? ] [ print "invalid authentication data" throw ] }
+        { [ dup "55" head? ] [ print "fatal error" throw ] }
+        { [ t ] [ "unknow error" throw ] }
+    } cond ;
+
+SYMBOL: multiline
+
+: multiline? ( response -- boolean )
+    CHAR: - swap index 3 = ;
+
+: process-multiline ( -- response )
+    conn get stream-readln dup
+    multiline get " " append head? [ 
+        print
+    ] [
+        check-response process-multiline
+    ] if ;
+
+: recv-response ( -- response )
+    conn get stream-readln
+    dup multiline? [
+        dup 3 head multiline set process-multiline
+    ] [ ] if ;
+
+: get-ok ( command -- )
+    >r conn get r> over stream-write stream-flush
+    recv-response check-response ;
+
+: helo ( -- )
+    "HELO " sess get session-domain append "\r\n" append get-ok ;
+
+: ehlo ( -- )
+    "EHLO " sess get session-domain append "\r\n" append get-ok ;
+
+: mailfrom ( fromaddr -- )
+    "MAIL FROM:<" swap append ">\r\n" append get-ok ;
+
+: rcptto ( to -- )
+    "RCPT TO:<" swap append ">\r\n" append get-ok ;
+
+: (cram-md5-auth) ( -- response )
+    swap challenge get 
+    string>md5-hmac hex-string 
+    " " swap append append 
+    >base64 ;
+
+: cram-md5-auth ( key login  -- )
+    "AUTH CRAM-MD5\r\n" get-ok 
+    (cram-md5-auth) "\r\n" append get-ok ;
+  
+: data ( -- )
+    "DATA\r\n" get-ok ;
+
+: start ( -- )
+    set-domain ! replaces localhost.localdomain with hostname
+    do-start
+    sess get session-esmtp [
+        ehlo
+    ] [
+        helo
+    ] if ;
+
+: send-message ( msg -- )
+    data
+    "\r\n" join conn get swap "\r\n" append over stream-write
+    stream-flush ".\r\n" get-ok ;
+
+: quit ( -- )
+    "QUIT\r\n" get-ok ;
diff --git a/extra/smtp/summary.txt b/extra/smtp/summary.txt
new file mode 100644 (file)
index 0000000..35f7ce1
--- /dev/null
@@ -0,0 +1 @@
+Sending mail via SMTP
diff --git a/extra/smtp/tags.txt b/extra/smtp/tags.txt
new file mode 100644 (file)
index 0000000..992ae12
--- /dev/null
@@ -0,0 +1 @@
+network
diff --git a/extra/space-invaders/authors.txt b/extra/space-invaders/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/space-invaders/resources/BaseHit.wav b/extra/space-invaders/resources/BaseHit.wav
new file mode 100644 (file)
index 0000000..ae8c9ad
Binary files /dev/null and b/extra/space-invaders/resources/BaseHit.wav differ
diff --git a/extra/space-invaders/resources/InvHit.Wav b/extra/space-invaders/resources/InvHit.Wav
new file mode 100644 (file)
index 0000000..e6682c5
Binary files /dev/null and b/extra/space-invaders/resources/InvHit.Wav differ
diff --git a/extra/space-invaders/resources/Shot.wav b/extra/space-invaders/resources/Shot.wav
new file mode 100644 (file)
index 0000000..0c1cd4e
Binary files /dev/null and b/extra/space-invaders/resources/Shot.wav differ
diff --git a/extra/space-invaders/resources/Ufo.wav b/extra/space-invaders/resources/Ufo.wav
new file mode 100644 (file)
index 0000000..a557b1b
Binary files /dev/null and b/extra/space-invaders/resources/Ufo.wav differ
diff --git a/extra/space-invaders/resources/UfoHit.wav b/extra/space-invaders/resources/UfoHit.wav
new file mode 100644 (file)
index 0000000..86ff6ff
Binary files /dev/null and b/extra/space-invaders/resources/UfoHit.wav differ
diff --git a/extra/space-invaders/resources/Walk1.wav b/extra/space-invaders/resources/Walk1.wav
new file mode 100644 (file)
index 0000000..e1d9f78
Binary files /dev/null and b/extra/space-invaders/resources/Walk1.wav differ
diff --git a/extra/space-invaders/resources/Walk2.wav b/extra/space-invaders/resources/Walk2.wav
new file mode 100644 (file)
index 0000000..dc237ec
Binary files /dev/null and b/extra/space-invaders/resources/Walk2.wav differ
diff --git a/extra/space-invaders/resources/Walk3.wav b/extra/space-invaders/resources/Walk3.wav
new file mode 100644 (file)
index 0000000..8034345
Binary files /dev/null and b/extra/space-invaders/resources/Walk3.wav differ
diff --git a/extra/space-invaders/resources/Walk4.wav b/extra/space-invaders/resources/Walk4.wav
new file mode 100644 (file)
index 0000000..d1beb6a
Binary files /dev/null and b/extra/space-invaders/resources/Walk4.wav differ
diff --git a/extra/space-invaders/space-invaders-docs.factor b/extra/space-invaders/space-invaders-docs.factor
new file mode 100644 (file)
index 0000000..e6f5b12
--- /dev/null
@@ -0,0 +1,40 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.syntax help.markup cpu.8080 ;\r
+IN: space-invaders \r
+\r
+HELP: run \r
+{ $description \r
+"Run the Space Invaders emulator in a new window." $nl\r
+{ $link rom-root } " must be set to the directory containing the "\r
+"location of the Space Invaders ROM files. See " \r
+{ $link { "space-invaders" "space-invaders" } } "  for details."\r
+} ;\r
+\r
+ARTICLE: { "space-invaders" "space-invaders" } "Space Invaders Emulator"\r
+"Provides an emulation of the original 8080 Arcade Game 'Space Invaders'." $nl\r
+"More information on the arcade game can be obtained from " { $url "http://www.mameworld.net/maws/romset/invaders" } "." $nl\r
+"To play the game you need the ROM files for the arcade game. They should "\r
+"be placed in a directory called 'invaders' in the location specified by "\r
+"the variable " { $link rom-root } ". The specific files needed are:"\r
+{ $list\r
+  "invaders/invaders.e"\r
+  "invaders/invaders.f"\r
+  "invaders/invaders.g"\r
+  "invaders/invaders.h"\r
+}\r
+"These are the same ROM files as used by MAME. To run the game use the " \r
+{ $link run } " word." $nl\r
+"Keys:" \r
+{ $table\r
+  { "Backspace" "Insert Coin" }\r
+  { "1" "1 Player" }\r
+  { "2" "2 Player" }\r
+  { "Left" "Move Left" }\r
+  { "Right" "Move Right" }\r
+  { "Up" "Fire" }\r
+}\r
+"If you save the Factor image while a game is running, when you restart "\r
+"the image the game continues where it left off." ;\r
+\r
+ABOUT: { "space-invaders" "space-invaders" } \r
diff --git a/extra/space-invaders/space-invaders.factor b/extra/space-invaders/space-invaders.factor
new file mode 100644 (file)
index 0000000..287e6ee
--- /dev/null
@@ -0,0 +1,372 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: cpu.8080 openal math alien.c-types sequences kernel
+       shuffle arrays io.files combinators kernel.private
+       ui.gestures ui.gadgets ui.render opengl.gl system 
+       threads concurrency match ui byte-arrays combinators.lib ;
+IN: space-invaders
+
+TUPLE: space-invaders port1 port2i port2o port3o port4lo port4hi port5o bitmap sounds looping? ;
+: game-width 224  ; inline
+: game-height 256 ; inline
+
+: make-opengl-bitmap ( -- array )
+  game-height game-width 3 * * <byte-array> ;
+
+: bitmap-index ( point -- index )
+  #! Point is a {x y}.
+  first2 game-width 3 * * swap 3 * + ;
+
+: set-bitmap-pixel ( color point array -- )
+  #! 'color' is a {r g b}. Point is {x y}.
+  [ bitmap-index ] dip ! color index array
+  [ [ first ] dipd set-uchar-nth ] 3keep
+  [ [ second ] dipd [ 1 + ] dip set-uchar-nth ] 3keep
+  [ third ] dipd [ 2 + ] dip set-uchar-nth ;
+
+: get-bitmap-pixel ( point array -- color )
+  #! Point is a {x y}. color is a {r g b} 
+  [ bitmap-index ] dip
+  [ uint-nth ] 2keep
+  [ [ 1 + ] dip uchar-nth ] 2keep
+  [ 2 + ] dip uchar-nth 3array ;
+  
+: SOUND-SHOT         ( -- number ) 0 ;
+: SOUND-UFO          ( -- number ) 1 ;
+: SOUND-BASE-HIT     ( -- number ) 2 ;
+: SOUND-INVADER-HIT  ( -- number ) 3 ;
+: SOUND-WALK1        ( -- number ) 4 ;
+: SOUND-WALK2        ( -- number ) 5 ;
+: SOUND-WALK3        ( -- number ) 6 ;
+: SOUND-WALK4        ( -- number ) 7 ;
+: SOUND-UFO-HIT      ( -- number ) 8 ;
+
+: init-sound ( index cpu filename  -- )
+  swapd >r space-invaders-sounds nth AL_BUFFER r> 
+  resource-path create-buffer-from-wav set-source-param ; 
+
+: init-sounds ( cpu -- )
+  init-openal
+  [ 9 gen-sources swap set-space-invaders-sounds ] keep
+  [ SOUND-SHOT        "extra/space-invaders/resources/Shot.wav" init-sound ] keep 
+  [ SOUND-UFO         "extra/space-invaders/resources/Ufo.wav" init-sound ] keep 
+  [ space-invaders-sounds SOUND-UFO swap nth AL_LOOPING AL_TRUE set-source-param ] keep
+  [ SOUND-BASE-HIT    "extra/space-invaders/resources/BaseHit.wav" init-sound ] keep 
+  [ SOUND-INVADER-HIT "extra/space-invaders/resources/InvHit.wav" init-sound ] keep 
+  [ SOUND-WALK1       "extra/space-invaders/resources/Walk1.wav" init-sound ] keep 
+  [ SOUND-WALK2       "extra/space-invaders/resources/Walk2.wav" init-sound ] keep 
+  [ SOUND-WALK3       "extra/space-invaders/resources/Walk3.wav" init-sound ] keep 
+  [ SOUND-WALK4       "extra/space-invaders/resources/Walk4.wav" init-sound ] keep 
+  [ SOUND-UFO-HIT    "extra/space-invaders/resources/UfoHit.wav" init-sound ] keep
+  f swap set-space-invaders-looping? ;
+
+: <space-invaders> ( -- cpu )
+  <cpu> space-invaders construct-delegate
+  make-opengl-bitmap over set-space-invaders-bitmap
+  [ init-sounds ] keep
+  [ reset ] keep ;
+
+: play-invaders-sound ( cpu sound -- )
+  swap space-invaders-sounds nth source-play ;
+
+: stop-invaders-sound ( cpu sound -- )
+  swap space-invaders-sounds nth source-stop ;
+
+: read-port1 ( cpu -- byte )
+  #! Port 1 maps the keys for space invaders
+  #! Bit 0 = coin slot
+  #! Bit 1 = two players button
+  #! Bit 2 = one player button
+  #! Bit 4 = player one fire
+  #! Bit 5 = player one left
+  #! Bit 6 = player one right
+  [ space-invaders-port1 dup HEX: FE bitand ] keep 
+ set-space-invaders-port1 ;
+
+: read-port2 ( cpu -- byte )
+  #! Port 2 maps player 2 controls and dip switches
+  #! Bit 0,1 = number of ships
+  #! Bit 2   = mode (1=easy, 0=hard)
+  #! Bit 4   = player two fire
+  #! Bit 5   = player two left
+  #! Bit 6   = player two right
+  #! Bit 7   = show or hide coin info
+  [ space-invaders-port2i HEX: 8F bitand ] keep 
+  space-invaders-port1 HEX: 70 bitand bitor ;
+
+: read-port3 ( cpu -- byte )
+  #! Used to compute a special formula
+  [ space-invaders-port4hi 8 shift ] keep 
+  [ space-invaders-port4lo bitor ] keep 
+  space-invaders-port2o shift -8 shift HEX: FF bitand ;
+
+M: space-invaders read-port ( port cpu -- byte )
+  #! Read a byte from the hardware port. 'port' should
+  #! be an 8-bit value.
+  swap {
+    { 1 [ read-port1 ] }
+    { 2 [ read-port2 ] }
+    { 3 [ read-port3 ] }
+    [ 2drop 0 ]
+  } case ;
+
+: write-port2 ( value cpu -- )
+  #! Setting this value affects the value read from port 3
+  set-space-invaders-port2o ;
+
+: bit-newly-set? ( old-value new-value bit -- bool )
+  tuck bit? >r bit? not r> and ;
+
+: port3-newly-set? ( new-value cpu bit -- bool )
+  >r space-invaders-port3o swap r> bit-newly-set? ;
+
+: port5-newly-set? ( new-value cpu bit -- bool )
+  >r space-invaders-port5o swap r> bit-newly-set? ;
+
+: write-port3 ( value cpu -- )
+  #! Connected to the sound hardware
+  #! Bit 0 = spaceship sound (looped)
+  #! Bit 1 = Shot 
+  #! Bit 2 = Your ship hit
+  #! Bit 3 = Invader hit
+  #! Bit 4 = Extended play sound
+  over 0 bit? over space-invaders-looping? not and [ 
+    dup SOUND-UFO play-invaders-sound 
+    t over set-space-invaders-looping?
+  ] when 
+  over 0 bit? not over space-invaders-looping? and [ 
+    dup SOUND-UFO stop-invaders-sound 
+    f over set-space-invaders-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
+  set-space-invaders-port3o ;
+
+: write-port4 ( value cpu -- )
+  #! Affects the value returned by reading port 3
+  [ space-invaders-port4hi ] keep 
+  [ set-space-invaders-port4lo ] keep 
+  set-space-invaders-port4hi ;
+
+: write-port5 ( value cpu -- )
+  #! Plays sounds
+  #! Bit 0 = invaders sound 1
+  #! Bit 1 = invaders sound 2
+  #! Bit 2 = invaders sound 3
+  #! Bit 3 = invaders sound 4
+  #! Bit 4 = spaceship hit 
+  #! Bit 5 = amplifier enabled/disabled
+  2dup 0 port5-newly-set? [ dup SOUND-WALK1 play-invaders-sound ] when
+  2dup 1 port5-newly-set? [ dup SOUND-WALK2 play-invaders-sound ] when
+  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
+  set-space-invaders-port5o ;
+
+M: space-invaders write-port ( value port cpu -- )
+  #! Write a byte to the hardware port, where 'port' is
+  #! an 8-bit value.  
+  swap {
+    { 2 [ write-port2 ] }
+    { 3 [ write-port3 ] }
+    { 4 [ write-port4 ] }
+    { 5 [ write-port5 ] }
+    [ 3drop ]
+  } case ;
+
+M: space-invaders reset ( cpu -- )
+  [ delegate reset ] keep
+  [ 0 swap set-space-invaders-port1 ] keep
+  [ 0 swap set-space-invaders-port2i ] keep
+  [ 0 swap set-space-invaders-port2o ] keep
+  [ 0 swap set-space-invaders-port3o ] keep
+  [ 0 swap set-space-invaders-port4lo ] keep
+  [ 0 swap set-space-invaders-port4hi ] keep
+  0 swap set-space-invaders-port5o ;
+
+: gui-step ( cpu -- )
+  [ read-instruction ] keep ! n cpu
+  over get-cycles over inc-cycles
+  [ swap instructions dispatch ] keep  
+  [ cpu-pc HEX: FFFF bitand ] keep 
+  set-cpu-pc ;
+
+: gui-frame/2 ( cpu -- )
+  [ gui-step ] keep
+  [ cpu-cycles ] keep
+  over 16667 < [ ! cycles cpu
+    nip gui-frame/2
+  ] [
+    [ >r 16667 - r> set-cpu-cycles ] keep
+    dup cpu-last-interrupt HEX: 10 = [
+      HEX: 08 over set-cpu-last-interrupt HEX: 08 swap interrupt
+    ] [
+      HEX: 10 over set-cpu-last-interrupt HEX: 10 swap interrupt
+    ] if     
+  ] if ;
+
+: gui-frame ( cpu -- )
+  dup gui-frame/2 gui-frame/2 ;
+
+: coin-down ( cpu -- )
+  [ space-invaders-port1 1 bitor ] keep set-space-invaders-port1 ;
+
+: coin-up ( cpu --  )
+  [ space-invaders-port1 255 1 - bitand ] keep set-space-invaders-port1 ;
+
+: player1-down ( cpu -- )
+  [ space-invaders-port1 4 bitor ] keep set-space-invaders-port1 ;
+
+: player1-up ( cpu -- )
+  [ space-invaders-port1 255 4 - bitand ] keep set-space-invaders-port1 ;
+
+: player2-down ( cpu -- )
+  [ space-invaders-port1 2 bitor ] keep set-space-invaders-port1 ;
+
+: player2-up ( cpu -- )
+  [ space-invaders-port1 255 2 - bitand ] keep set-space-invaders-port1 ;
+
+: fire-down ( cpu -- )
+  [ space-invaders-port1 HEX: 10 bitor ] keep set-space-invaders-port1 ;
+
+: fire-up ( cpu -- )
+  [ space-invaders-port1 255 HEX: 10 - bitand ] keep set-space-invaders-port1 ;
+
+: left-down ( cpu -- )
+  [ space-invaders-port1 HEX: 20 bitor ] keep set-space-invaders-port1 ;
+
+: left-up ( cpu -- )
+  [ space-invaders-port1 255 HEX: 20 - bitand ] keep set-space-invaders-port1 ;
+
+: right-down ( cpu -- )
+  [ space-invaders-port1 HEX: 40 bitor ] keep set-space-invaders-port1 ;
+
+: right-up ( cpu -- )
+  [ space-invaders-port1 255 HEX: 40 - bitand ] keep set-space-invaders-port1 ;
+
+
+TUPLE: invaders-gadget cpu quit? ;
+
+invaders-gadget H{
+    { T{ key-down f f "ESC" }    [ t swap set-invaders-gadget-quit? ] }
+    { T{ key-down f f "BACKSPACE" } [ invaders-gadget-cpu coin-down ] }
+    { T{ key-up   f f "BACKSPACE" } [ invaders-gadget-cpu coin-up ] }
+    { T{ key-down f f "1" }         [ invaders-gadget-cpu player1-down ] }
+    { T{ key-up   f f "1" }         [ invaders-gadget-cpu player1-up ] }
+    { T{ key-down f f "2" }         [ invaders-gadget-cpu player2-down ] }
+    { T{ key-up   f f "2" }         [ invaders-gadget-cpu player2-up ] }
+    { T{ key-down f f "UP" }        [ invaders-gadget-cpu fire-down ] }
+    { T{ key-up   f f "UP" }        [ invaders-gadget-cpu fire-up ] }
+    { T{ key-down f f "LEFT" }      [ invaders-gadget-cpu left-down ] }
+    { T{ key-up   f f "LEFT" }      [ invaders-gadget-cpu left-up ] }
+    { T{ key-down f f "RIGHT" }     [ invaders-gadget-cpu right-down ] }
+    { T{ key-up   f f "RIGHT" }     [ invaders-gadget-cpu right-up ] }
+  } set-gestures 
+
+: <invaders-gadget> ( cpu -- gadget ) 
+  invaders-gadget construct-gadget
+  [ set-invaders-gadget-cpu ] keep
+  f over set-invaders-gadget-quit? ;
+
+M: invaders-gadget pref-dim* drop { 224 256 0 } ;
+
+M: invaders-gadget draw-gadget* ( gadget -- )
+  0 0 glRasterPos2i
+  1.0 -1.0 glPixelZoom
+  >r 224 256 GL_RGB GL_UNSIGNED_BYTE r>
+  invaders-gadget-cpu space-invaders-bitmap glDrawPixels ;
+
+: black { 0 0 0 } ;
+: white { 255 255 255 } ;
+: green { 0 255 0 } ;
+: red   { 255 0 0 } ;
+
+: addr>xy ( addr -- point )
+  #! Convert video RAM address to base X Y value. point is a {x y}.
+  HEX: 2400 - ! n
+  dup HEX: 1f bitand 8 * 255 swap - ! n y
+  swap -5 shift swap 2array ;
+
+: plot-bitmap-pixel ( bitmap point color -- )
+  #! point is a {x y}. color is a {r g b}.
+  swap rot set-bitmap-pixel ;
+
+: within ( n a b -- bool )
+  #! n >= a and n <= b
+  rot tuck swap <= >r swap >= r> and ;
+
+: get-point-color ( point -- color )
+  #! Return the color to use for the given x/y position.
+  first2
+  {
+    { [ dup 184 238 within pick 0 223 within and ] [ 2drop green ] }
+    { [ dup 240 247 within pick 16 133 within and ] [ 2drop green ] }
+    { [ dup 247 215 - 247 184 - within pick 0 223 within and ] [ 2drop red ] }
+    { [ t ] [ 2drop white ] }
+  } cond ;
+
+: plot-bitmap-bits ( bitmap point byte bit -- )
+  #! point is a {x y}.
+  [ first2 ] dipd
+  dup swapd -1 * shift 1 bitand 0 =
+  [ - 2array ] dip
+  [ black ] [ dup get-point-color ] if
+  plot-bitmap-pixel ;
+
+: do-bitmap-update ( bitmap value addr -- )
+  addr>xy swap 
+  [ 0 plot-bitmap-bits ] 3keep
+  [ 1 plot-bitmap-bits ] 3keep
+  [ 2 plot-bitmap-bits ] 3keep
+  [ 3 plot-bitmap-bits ] 3keep
+  [ 4 plot-bitmap-bits ] 3keep
+  [ 5 plot-bitmap-bits ] 3keep
+  [ 6 plot-bitmap-bits ] 3keep
+  7 plot-bitmap-bits ;
+
+M: space-invaders update-video ( value addr cpu -- )  
+  over HEX: 2400 >= [
+    space-invaders-bitmap -rot do-bitmap-update
+  ] [
+    3drop
+  ] if ;
+
+: sync-frame ( millis -- millis )
+  #! Sleep until the time for the next frame arrives.
+  1000 60 / >fixnum + millis - dup 0 >
+  [ sleep ] [ drop yield ] if millis ;
+
+: invaders-process ( millis gadget -- )
+  #! Run a space invaders gadget inside a 
+  #! concurrent process. Messages can be sent to
+  #! signal key presses, etc.
+  dup invaders-gadget-quit? [
+    [ sync-frame ] dip
+    [ invaders-gadget-cpu gui-frame ] keep
+    [ relayout-1 ] keep
+    invaders-process 
+  ] unless ;
+
+M: invaders-gadget graft* ( gadget -- )
+ dup invaders-gadget-cpu init-sounds
+ [ f swap set-invaders-gadget-quit? ] keep
+ [ millis swap invaders-process ] spawn 2drop ;
+
+M: invaders-gadget ungraft* ( gadget -- )
+ t swap set-invaders-gadget-quit? ;
+
+: (run) ( title cpu rom-info -- )
+  over load-rom* <invaders-gadget> swap open-window ;
+
+: run ( -- )  
+  "Space Invaders" <space-invaders> {
+    { HEX: 0000 "invaders/invaders.h" }
+    { HEX: 0800 "invaders/invaders.g" }
+    { HEX: 1000 "invaders/invaders.f" }
+    { HEX: 1800 "invaders/invaders.e" }
+  } [ (run) ] with-ui ;
+
+MAIN: run
diff --git a/extra/space-invaders/summary.txt b/extra/space-invaders/summary.txt
new file mode 100644 (file)
index 0000000..f03d078
--- /dev/null
@@ -0,0 +1 @@
+Intel 8080-based Space Invaders arcade machine emulator
diff --git a/extra/space-invaders/tags.txt b/extra/space-invaders/tags.txt
new file mode 100644 (file)
index 0000000..4717ffd
--- /dev/null
@@ -0,0 +1,2 @@
+games
+applications
diff --git a/extra/splay-trees/authors.txt b/extra/splay-trees/authors.txt
new file mode 100644 (file)
index 0000000..09839c9
--- /dev/null
@@ -0,0 +1 @@
+Mackenzie Straight
diff --git a/extra/splay-trees/splay-trees-tests.factor b/extra/splay-trees/splay-trees-tests.factor
new file mode 100644 (file)
index 0000000..00ca1ae
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (c) 2005 Mackenzie Straight.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel tools.test splay-trees namespaces assocs
+sequences random ;
+IN: temporary
+
+: randomize-numeric-splay-tree ( splay-tree -- )
+    100 [ drop 100 random swap at drop ] curry* each ;
+
+: make-numeric-splay-tree ( n -- splay-tree )
+    dup <splay-tree> -rot [ pick set-at ] 2each ;
+
+[ t ] [
+    100 make-numeric-splay-tree dup randomize-numeric-splay-tree
+    [ [ drop , ] assoc-each ] { } make [ < ] monotonic?
+] unit-test
+
+[ 10 ] [ 10 make-numeric-splay-tree keys length ] unit-test
+[ 10 ] [ 10 make-numeric-splay-tree values length ] unit-test
+
+[ f ] [ <splay-tree> f 4 pick set-at 4 swap at ] unit-test
+
+! Ensure that f can be a value
+[ t ] [ <splay-tree> f 4 pick set-at 4 swap key? ] unit-test
+
+[
+{ { 1 "a" } { 2 "b" } { 3 "c" } { 4 "d" } { 5 "e" } { 6 "f" } }
+] [
+{
+    { 4 "d" } { 5 "e" } { 6 "f" }
+    { 1 "a" } { 2 "b" } { 3 "c" }
+} >splay-tree >alist
+] unit-test
diff --git a/extra/splay-trees/splay-trees.factor b/extra/splay-trees/splay-trees.factor
new file mode 100644 (file)
index 0000000..2e523f2
--- /dev/null
@@ -0,0 +1,178 @@
+! Copyright (c) 2005 Mackenzie Straight.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math combinators assocs parser ;
+IN: splay-trees
+
+TUPLE: splay-tree r count ;
+INSTANCE: splay-tree assoc
+
+: <splay-tree> ( -- splay-tree )
+    0 { set-splay-tree-count } splay-tree construct ;
+
+<PRIVATE
+
+TUPLE: splay-node v k l r ;
+
+C: <splay-node> splay-node 
+
+: rotate-right ( node -- node )
+    dup splay-node-l
+    [ splay-node-r swap set-splay-node-l ] 2keep
+    [ set-splay-node-r ] keep ;
+                                                        
+: rotate-left ( node -- node )
+    dup splay-node-r
+    [ splay-node-l swap set-splay-node-r ] 2keep
+    [ set-splay-node-l ] keep ;
+
+: link-right ( left right key node -- left right key node )
+    swap >r [ swap set-splay-node-l ] 2keep
+    nip dup splay-node-l r> swap ;
+
+: link-left ( left right key node -- left right key node )
+    swap >r rot [ set-splay-node-r ] 2keep
+    drop dup splay-node-r swapd r> swap ;
+
+: cmp ( key node -- obj node -1/0/1 )
+    2dup splay-node-k <=> ;
+
+: lcmp ( key node -- obj node -1/0/1 ) 
+    2dup splay-node-l splay-node-k <=> ;
+
+: rcmp ( key node -- obj node -1/0/1 ) 
+    2dup splay-node-r splay-node-k <=> ;
+
+DEFER: (splay)
+
+: splay-left ( left right key node -- left right key node )
+    dup splay-node-l [
+        lcmp 0 < [ rotate-right ] when
+        dup splay-node-l [ link-right (splay) ] when
+    ] when ;
+
+: splay-right ( left right key node -- left right key node )
+    dup splay-node-r [
+        rcmp 0 > [ rotate-left ] when
+        dup splay-node-r [ 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 ;
+
+: assemble ( head left right node -- root )
+    [ splay-node-r swap set-splay-node-l ] keep
+    [ splay-node-l swap set-splay-node-r ] keep
+    [ swap splay-node-l swap set-splay-node-r ] 2keep
+    [ swap splay-node-r swap set-splay-node-l ] keep ;
+
+: splay-at ( key node -- node )
+    >r >r T{ splay-node } clone dup dup r> r>
+    (splay) nip assemble ;
+
+: splay ( key tree -- )
+    [ splay-tree-r splay-at ] keep set-splay-tree-r ;
+
+: splay-split ( key tree -- node node )
+    2dup splay splay-tree-r cmp 0 < [
+        nip dup splay-node-l swap f over set-splay-node-l
+    ] [
+        nip dup splay-node-r swap f over set-splay-node-r swap
+    ] if ;
+
+: (get-splay) ( key tree -- node ? )
+    2dup splay splay-tree-r cmp 0 = [
+        nip t
+    ] [
+        2drop f f
+    ] if ;
+
+: get-largest ( node -- node )
+    dup [ dup splay-node-r [ nip get-largest ] when* ] when ;
+
+: splay-largest
+    dup [ dup get-largest splay-node-k swap splay-at ] when ;
+
+: splay-join ( n2 n1 -- node )
+    splay-largest [
+        [ set-splay-node-r ] keep
+    ] [
+        drop f
+    ] if* ;
+
+: (remove-splay) ( key tree -- )
+    tuck (get-splay) nip [
+        dup splay-tree-count 1- over set-splay-tree-count
+        dup splay-node-r swap splay-node-l splay-join
+        swap set-splay-tree-r
+    ] [ drop ] if* ;
+
+: (set-splay) ( value key tree -- )
+    2dup (get-splay) [ 2nip set-splay-node-v ] [
+       drop dup splay-tree-count 1+ over set-splay-tree-count
+       2dup splay-split rot
+       >r <splay-node> r> set-splay-tree-r
+    ] if ;
+
+: new-root ( value key tree -- )
+    [ 1 swap set-splay-tree-count ] keep
+    >r f f <splay-node> r> set-splay-tree-r ;
+
+: splay-call ( splay-node call -- )
+    >r [ splay-node-k ] keep splay-node-v r> call ; inline
+    
+: (splay-tree-traverse) ( splay-node quot -- key value ? )
+    {
+        { [ over not ] [ 2drop f f f ] }
+        { [ [
+              >r splay-node-l r> (splay-tree-traverse)
+            ] 2keep rot ]
+          [ 2drop t ] }
+        { [ >r 2nip r> [ splay-call ] 2keep rot ]
+          [ drop [ splay-node-k ] keep splay-node-v t ] }
+        { [ t ] [ >r splay-node-r r> (splay-tree-traverse) ] }
+    } cond ; inline
+
+PRIVATE>
+
+M: splay-tree assoc-find ( splay-tree quot -- key value ? )
+    #! quot: ( k v -- ? )
+    #! Not tail recursive so will fail on large splay trees.
+    >r splay-tree-r r> (splay-tree-traverse) ;
+
+M: splay-tree set-at ( value key tree -- )
+    dup splay-tree-r [ (set-splay) ] [ new-root ] if ;
+
+M: splay-tree at* ( key tree -- value ? )
+    dup splay-tree-r [
+        (get-splay) >r dup [ splay-node-v ] when r>
+    ] [
+        2drop f f
+    ] if ;
+
+M: splay-tree delete-at ( key tree -- )
+    dup splay-tree-r [ (remove-splay) ] [ 2drop ] if ;
+
+M: splay-tree new-assoc
+    2drop <splay-tree> ;
+
+: >splay-tree ( assoc -- splay-tree )
+    T{ splay-tree f f 0 } assoc-clone-like ;
+
+: S{
+    \ } [ >splay-tree ] parse-literal ; parsing
+
+M: splay-tree assoc-like
+    drop dup splay-tree? [ >splay-tree ] unless ;
+
+M: splay-tree clear-assoc
+    0 over set-splay-tree-count
+    f swap set-splay-tree-r ;
+
+M: splay-tree assoc-size
+    splay-tree-count ;
+
+USE: prettyprint.backend
+M: splay-tree pprint-delims drop \ S{ \ } ;
+M: splay-tree >pprint-sequence >alist ;
+M: splay-tree pprint-narrow? drop t ;
diff --git a/extra/splay-trees/summary.txt b/extra/splay-trees/summary.txt
new file mode 100644 (file)
index 0000000..e70c874
--- /dev/null
@@ -0,0 +1 @@
+Splay Trees
diff --git a/extra/splay-trees/tags.txt b/extra/splay-trees/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/sqlite/lib/lib.factor b/extra/sqlite/lib/lib.factor
new file mode 100644 (file)
index 0000000..d544b8f
--- /dev/null
@@ -0,0 +1,121 @@
+! Copyright (C) 2005 Chris Double, Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! An interface to the sqlite database. Tested against sqlite v3.1.3.
+! Remeber to pass the following to factor:
+!  -libraries:sqlite=libsqlite3.so
+!
+! Not all functions have been wrapped yet. Only those directly involving
+! executing SQL calls and obtaining results.
+!
+IN: sqlite.lib
+USING: alien compiler kernel math namespaces sequences strings alien.syntax
+    system combinators ;
+
+: load-sqlite-library ( -- )
+  "sqlite" {
+    { [ win32? ]  [ "sqlite3.dll" ] }
+    { [ macosx? ] [ "/usr/lib/libsqlite3.dylib" ] }
+    { [ unix? ]  [ "libsqlite3.so" ] }
+  } cond "cdecl" add-library ; parsing
+
+load-sqlite-library
+
+! Return values from sqlite functions
+: SQLITE_OK           0   ; inline ! Successful result
+: SQLITE_ERROR        1   ; inline ! SQL error or missing database
+: SQLITE_INTERNAL     2   ; inline ! An internal logic error in SQLite 
+: SQLITE_PERM         3   ; inline ! Access permission denied 
+: SQLITE_ABORT        4   ; inline ! Callback routine requested an abort 
+: SQLITE_BUSY         5   ; inline ! The database file is locked 
+: SQLITE_LOCKED       6   ; inline ! A table in the database is locked 
+: SQLITE_NOMEM        7   ; inline ! A malloc() failed 
+: SQLITE_READONLY     8   ; inline ! Attempt to write a readonly database 
+: SQLITE_INTERRUPT    9   ; inline ! Operation terminated by sqlite_interrupt() 
+: SQLITE_IOERR       10   ; inline ! Some kind of disk I/O error occurred 
+: SQLITE_CORRUPT     11   ; inline ! The database disk image is malformed 
+: SQLITE_NOTFOUND    12   ; inline ! (Internal Only) Table or record not found 
+: SQLITE_FULL        13   ; inline ! Insertion failed because database is full 
+: SQLITE_CANTOPEN    14   ; inline ! Unable to open the database file 
+: SQLITE_PROTOCOL    15   ; inline ! Database lock protocol error 
+: SQLITE_EMPTY       16   ; inline ! (Internal Only) Database table is empty 
+: SQLITE_SCHEMA      17   ; inline ! The database schema changed 
+: SQLITE_TOOBIG      18   ; inline ! Too much data for one row of a table 
+: SQLITE_CONSTRAINT  19   ; inline ! Abort due to contraint violation 
+: SQLITE_MISMATCH    20   ; inline ! Data type mismatch 
+: SQLITE_MISUSE      21   ; inline ! Library used incorrectly 
+: SQLITE_NOLFS       22   ; inline ! Uses OS features not supported on host 
+: SQLITE_AUTH        23   ; inline ! Authorization denied 
+: SQLITE_FORMAT      24   ; inline ! Auxiliary database format error
+: SQLITE_RANGE       25   ; inline ! 2nd parameter to sqlite3_bind out of range
+: SQLITE_NOTADB      26   ; inline ! File opened that is not a database file
+
+: sqlite-error-messages ( -- seq ) {
+    "Successful result"
+    "SQL error or missing database"
+    "An internal logic error in SQLite"
+    "Access permission denied"
+    "Callback routine requested an abort"
+    "The database file is locked"
+    "A table in the database is locked"
+    "A malloc() failed"
+    "Attempt to write a readonly database"
+    "Operation terminated by sqlite_interrupt()"
+    "Some kind of disk I/O error occurred"
+    "The database disk image is malformed"
+    "(Internal Only) Table or record not found"
+    "Insertion failed because database is full"
+    "Unable to open the database file"
+    "Database lock protocol error"
+    "(Internal Only) Database table is empty"
+    "The database schema changed"
+    "Too much data for one row of a table"
+    "Abort due to contraint violation"
+    "Data type mismatch"
+    "Library used incorrectly"
+    "Uses OS features not supported on host"
+    "Authorization denied"
+    "Auxiliary database format error"
+    "2nd parameter to sqlite3_bind out of range"
+    "File opened that is not a database file"
+} ;
+
+: SQLITE_ROW         100  ; inline ! sqlite_step() has another row ready 
+: SQLITE_DONE        101  ; inline ! sqlite_step() has finished executing 
+
+! Return values from the sqlite3_column_type function
+: SQLITE_INTEGER     1 ; inline
+: SQLITE_FLOAT       2 ; inline
+: SQLITE_TEXT        3 ; inline
+: SQLITE_BLOB        4 ; inline
+: SQLITE_NULL        5 ; inline
+
+! Values for the 'destructor' parameter of the 'bind' routines. 
+: SQLITE_STATIC      0  ; inline
+: SQLITE_TRANSIENT   -1 ; inline
+
+TYPEDEF: void sqlite3
+TYPEDEF: void sqlite3_stmt
+
+LIBRARY: sqlite
+FUNCTION: int sqlite3_open ( char* filename, void* ppDb ) ;
+FUNCTION: int sqlite3_close ( sqlite3* pDb ) ;
+FUNCTION: int sqlite3_prepare ( sqlite3* pDb, char* 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 ) ;
+FUNCTION: int sqlite3_last_insert_rowid ( sqlite3* pStmt ) ;
+FUNCTION: int sqlite3_bind_blob ( sqlite3_stmt* pStmt, int index, void* ptr, int len, int destructor ) ;
+FUNCTION: int sqlite3_bind_int ( sqlite3_stmt* pStmt, int index, int n ) ;
+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_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: int sqlite3_column_int ( sqlite3_stmt* pStmt, int col ) ;
+FUNCTION: int sqlite3_column_name ( sqlite3_stmt* pStmt, int col ) ;
+FUNCTION: char* sqlite3_column_text ( sqlite3_stmt* pStmt, int col ) ;
+FUNCTION: int sqlite3_column_type ( sqlite3_stmt* pStmt, int col ) ;
+
diff --git a/extra/sqlite/sqlite-docs.factor b/extra/sqlite/sqlite-docs.factor
new file mode 100644 (file)
index 0000000..416601d
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help sqlite help.syntax help.markup ;
+
+HELP: sqlite-open 
+{ $values { "filename" "path to sqlite database" } 
+          { "db" "the database object" } 
+}
+{ $description "Opens the sqlite3 database." } 
+{ $see-also sqlite-close sqlite-last-insert-rowid } ;
+
+HELP: sqlite-close
+{ $values { "db" "the database object" } 
+}
+{ $description "Closes the sqlite3 database." } 
+{ $see-also sqlite-open sqlite-last-insert-rowid } ;
+
+HELP: sqlite-last-insert-rowid
+{ $values { "db" "the database object" } 
+         { "rowid" "the row number of the last insert" }
+}
+{ $description "Returns the number of the row of the last statement inserted into the database." } 
+{ $see-also sqlite-open sqlite-close } ;
+
+HELP: sqlite-prepare
+{ $values { "db" "the database object" } 
+         { "sql" "the SQL statement as a string" }
+         { "statement" "the prepared SQL statement" }
+}
+{ $description "Internally compiles the SQL statement ready to be run by sqlite. The statement is executed and the results iterated over using " { $link sqlite-each } " and " { $link sqlite-map } ". The SQL statement can use named parameters which are later bound to values using " { $link sqlite-bind-text } " and " { $link sqlite-bind-text-by-name } "." } 
+{ $see-also sqlite-open sqlite-close } ;
+
+HELP: sqlite-bind-text
+{ $values { "statement" "a prepared SQL statement" }
+         { "index" "the index of the bound parameter in the SQL statement" } 
+         { "text" "the string value to bind to that column" }
+         
+}
+{ $description "Binds the text to a parameter in the SQL statement. The parameter to be bound is identified by the index given and the indexes start from one." }
+{ $examples { $code "\"people.db\" sqlite-open\n\"select * from people where name=?\" sqlite-prepare\n1 \"chris\" sqlite-bind-text" } }
+{ $see-also sqlite-bind-text-by-name } ;
+
+HELP: sqlite-bind-text-by-name
+{ $values { "statement" "a prepared SQL statement" }
+         { "name" "the name of the bound parameter in the SQL statement" } 
+         { "text" "the string value to bind to that column" }
+         
+}
+{ $description "Binds the text to a parameter in the SQL statement. The parameter to be bound is identified by the given name." }
+{ $examples { $code "\"people.db\" sqlite-open\n\"select * from people where name=:name\" sqlite-prepare\n\"name\" \"chris\" sqlite-bind-text" } }
+{ $see-also sqlite-bind-text } ;
+
+HELP: sqlite-finalize
+{ $values { "statement" "a prepared SQL statement" }  
+}
+{ $description "Clean up all resources related to a statement. Once called the statement cannot be used again. All statements must be finalized before closing the database." }
+{ $see-also sqlite-close sqlite-prepare } ;
+
+HELP: sqlite-reset
+{ $values { "statement" "a prepared SQL statement" }  
+}
+{ $description "Reset a statement so it can be called again, possibly with different bound parameters." }
+{ $see-also sqlite-bind-text sqlite-bind-text-by-name } ;
+
+HELP: column-count
+{ $values { "statement" "a prepared SQL statement" } { "int" "the number of columns" } }
+{ $description "Return the number of columns in each row of the result set of the given statement." }
+{ $see-also column-text sqlite-each sqlite-map } ;
+
+HELP: column-text
+{ $values { "statement" "a prepared SQL statement" } { "index" "column number indexed from zero" } { "string" "column value" }
+}
+{ $description "Return the value of the given column, indexed from zero, as a string." }
+{ $see-also column-count sqlite-each sqlite-map } ;
+
+HELP: sqlite-each
+{ $values { "statement" "a prepared SQL statement" } { "quot" "A quotation with stack effect ( statement -- )" }   
+}
+{ $description "Executes the SQL statement and for each returned row calls the qutotation passing the statement on the stack. The quotation can use " { $link column-text } " to get result values for that row." }
+{ $see-also column-count column-text sqlite-map } ;
+
+HELP: sqlite-map
+{ $values { "statement" "a prepared SQL statement" } { "quot" "A quotation with stack effect ( statement -- value )" } { "seq" "a new sequence" }   
+}
+{ $description "Executes the SQL statement and for each returned row calls the qutotation passing the statement on the stack. The quotation can use " { $link column-text } " to get result values for that row. The quotation should leave a value on the stack which gets collected and returned in the resulting sequence." }
+{ $see-also column-count column-text sqlite-each } ;
diff --git a/extra/sqlite/sqlite-tests.factor b/extra/sqlite/sqlite-tests.factor
new file mode 100644 (file)
index 0000000..5eecbec
--- /dev/null
@@ -0,0 +1,69 @@
+! Copyright (C) 2005 Chris Double.
+! 
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions are met:
+! 
+! 1. Redistributions of source code must retain the above copyright notice,
+!    this list of conditions and the following disclaimer.
+! 
+! 2. Redistributions in binary form must reproduce the above copyright notice,
+!    this list of conditions and the following disclaimer in the documentation
+!    and/or other materials provided with the distribution.
+! 
+! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+!
+! Test the sqlite interface
+!
+! Create a test database like follows:
+!
+!   sqlite3 test.db < test.txt
+!
+!  Then run this file.
+USE: sqlite
+USE: kernel
+USE: io
+USE: io.files
+USE: prettyprint
+
+: test.db "libs/sqlite/test.db" resource-path ;
+
+: show-people ( statement -- )
+  dup 0 column-text write " from " write 1 column-text . ;
+
+: run-test ( -- )
+  test.db sqlite-open
+  dup "select * from test" sqlite-prepare
+  dup [ show-people ] sqlite-each 
+  sqlite-finalize
+  sqlite-close ;
+
+: find-person ( name -- )
+  test.db sqlite-open  ! name db
+  dup "select * from test where name=?" sqlite-prepare ! name db stmt
+  [ rot 1 swap sqlite-bind-text ] keep ! db stmt
+  [ [ 1 column-text . ] sqlite-each ] keep
+  sqlite-finalize
+  sqlite-close ;  
+
+: find-all ( -- )
+  test.db sqlite-open  ! db
+  dup "select * from test" sqlite-prepare ! db stmt
+  [ [ [ 0 column-text ] keep 1 column-text curry ] sqlite-map ] keep
+  sqlite-finalize
+  swap sqlite-close ;  
+
+: run-test2 ( -- )
+  test.db sqlite-open
+  dup "select * from test" sqlite-prepare
+  dup [ show-people ] ;
+
+run-test
diff --git a/extra/sqlite/sqlite.factor b/extra/sqlite/sqlite.factor
new file mode 100644 (file)
index 0000000..d651ad9
--- /dev/null
@@ -0,0 +1,127 @@
+! Copyright (C) 2005 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! An interface to the sqlite database. Tested against sqlite v3.0.8.
+!
+! Not all functions have been wrapped yet. Only those directly involving
+! executing SQL calls and obtaining results.
+!
+IN: sqlite
+USING: alien compiler kernel namespaces sequences strings sqlite.lib
+    alien.c-types continuations ;
+
+TUPLE: sqlite-error n message ;
+SYMBOL: db
+
+! High level sqlite routines
+: sqlite-check-result ( result -- )
+  #! Check the result from a sqlite call is ok. If it is
+  #! return, otherwise throw an error.
+  dup SQLITE_OK = [
+    drop 
+  ] [
+    dup sqlite-error-messages nth
+    \ sqlite-error construct-boa throw
+  ] if ;
+
+: sqlite-open ( filename -- db )
+  #! Open the database referenced by the filename and return
+  #! a handle to that database. An error is thrown if the database
+  #! failed to open.
+  "void*" <c-object> [ sqlite3_open sqlite-check-result ] keep *void* ;
+
+: sqlite-close ( db -- )
+  #! Close the given database
+  sqlite3_close sqlite-check-result ;
+
+: sqlite-last-insert-rowid ( db -- rowid )
+  #! Return the rowid of the last insert
+  sqlite3_last_insert_rowid ;
+
+: sqlite-prepare ( db sql -- statement )
+  #! Prepare a SQL statement. Returns the statement which
+  #! can have values bound to parameters or simply executed.
+  #! TODO: Support multiple statements in the SQL string.
+  dup length "void*" <c-object> "void*" <c-object>
+  [ sqlite3_prepare sqlite-check-result ] 2keep
+  drop *void* ;
+
+: sqlite-bind-text ( statement index text -- )
+  #! Bind the text to the parameterized value in the statement.  
+  dup length SQLITE_TRANSIENT sqlite3_bind_text sqlite-check-result ;
+
+: sqlite-bind-parameter-index ( statement name -- index )
+  sqlite3_bind_parameter_index ;
+
+: sqlite-bind-text-by-name ( statement name text -- )
+  >r dupd sqlite-bind-parameter-index r> sqlite-bind-text ;
+
+: sqlite-finalize ( statement -- )
+  #! Clean up all resources related to a statement. Once called
+  #! the statement cannot be used. All statements must be finalized
+  #! before closing the database.
+  sqlite3_finalize sqlite-check-result ;
+
+: sqlite-reset ( statement -- )
+  #! Reset a statement so it can be called again, possibly with
+  #! different parameters.
+  sqlite3_reset sqlite-check-result ;
+
+: column-count ( statement -- int )
+  #! Given a prepared statement, return the number of
+  #! columns in each row of the result set of that statement.
+  sqlite3_column_count ;
+
+: column-text ( statement index -- string )
+  #! Return the value of the given column, indexed
+  #! from zero, as a string.
+  sqlite3_column_text ;
+
+: step-complete? ( step-result -- bool )
+  #! Return true if the result of a sqlite3_step is
+  #! such that the iteration has completed (ie. it is
+  #! SQLITE_DONE). Throw an error if an error occurs. 
+  dup SQLITE_ROW =  [
+    drop f
+  ] [
+    dup SQLITE_DONE = [
+      drop t 
+    ] [
+      sqlite-check-result t
+    ] if
+  ] if ;
+
+: sqlite-each ( statement quot -- )    
+  #! Execute the SQL statement, and call the quotation for
+  #! each row returned from executing the statement with the
+  #! statement on the top of the stack.
+  over sqlite3_step step-complete? [ 
+    2drop
+  ] [
+    [ call ] 2keep sqlite-each
+  ] if ; inline
+
+! For comparison, here is the linrec implementation of sqlite-each
+! [ drop sqlite3_step step-complete? ]
+! [ 2drop ]
+! [ 2dup 2slip ]
+! [ ] linrec ; 
+
+DEFER: (sqlite-map)
+
+: (sqlite-map) ( statement quot seq -- )    
+  pick sqlite3_step step-complete? [ 
+    2nip
+  ] [
+    >r 2dup call r> swap add (sqlite-map)
+  ] if ; 
+
+: sqlite-map ( statement quot -- seq )
+  { } (sqlite-map) ;
+
+: with-sqlite ( path quot -- )
+    [
+        >r sqlite-open db set r>
+        [ db get sqlite-close ] [ ] cleanup
+    ] with-scope ;
+
diff --git a/extra/sqlite/test.txt b/extra/sqlite/test.txt
new file mode 100644 (file)
index 0000000..5c7ae2b
--- /dev/null
@@ -0,0 +1,3 @@
+create table test (name varchar(30), address varchar(30));
+insert into test values('John', 'America');
+insert into test values('Jane', 'New Zealand');
diff --git a/extra/sqlite/tuple-db/tuple-db-docs.factor b/extra/sqlite/tuple-db/tuple-db-docs.factor
new file mode 100644 (file)
index 0000000..c960b5b
--- /dev/null
@@ -0,0 +1,128 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help sqlite sqlite.tuple-db help.syntax help.markup ;
+
+ARTICLE: { "sqlite" "tuple-db-loading" } "Loading"
+"The quickest way to get up and running with this library is to load it as a module:"
+{ $code "\"libs/sqlite\" require\nUSE: sqlite\nUSE: tuple-db\n" } 
+"Some simple tests can be run to check that everything is working ok:"
+{ $code "\"libs/sqlite\" test-module" } ;
+
+ARTICLE: { "sqlite" "tuple-db-usage" } "Basic Usage"
+"This library can be used for storing simple Factor tuples in a sqlite database. In its current form the tuples must not contain references to other tuples and should not have a delegate set."
+$nl
+"This document will use the following tuple for demonstration purposes:"
+{ $code "TUPLE: person name surname phone ;" }
+"The sqlite database to store tuples must be created, or an existing one opened. This is done using the " { $link sqlite-open } " word. If the database does not exist then it is created. The examples in this document store the database pointer in a variable called 'db':"
+{ $code "SYMBOL: db\n\"example.db\" sqlite-open db set-global" } ;
+
+ARTICLE: { "sqlite" "tuple-db-mappings" } "Tuple Mappings"
+"Each tuple has a 'mapping' tuple associated with it. The 'mapping' stores information about what table the tuple will be stored in, the datatypes of the tuple slots, etc. A mapping must be created before a tuple can be stored in a database. A default mapping is easily created using " { $link default-mapping } ". Given the tuple class, this will use reflection to get the slots of it, assume that all slots are of database type 'text', and store the tuple objects in a table with the same name as the tuple."
+$nl
+"The following shows how to create the default mapping for the 'person' tuple, and how to register that mapping so the 'tuple-db' system can know how to handle 'person' instances:"
+{ $code "person default-mapping set-mapping" } ;
+
+ARTICLE: { "sqlite" "tuple-db-create" } "Creating the table"
+"The table used to store tuple instances may need to be created. This can be done manually using the external sqlite program or via " { $link create-tuple-table } ":"
+{ $code "db get person create-tuple-table" }
+"The SQL used to create the table is produced internally by " { $link create-sql } ". This is a generic word dispatched on the mapping object, and could be specialised if needed. If you wish to see the SQL used to create the table, use the following code:"
+{ $code "person get-mapping create-sql .\n => \"create table person (name text,surname text,phone text);\"" } ;
+
+ARTICLE: { "sqlite" "tuple-db-insert" } "Inserting instances"
+"The " { $link insert-tuple } " word will store instances of a tuple into the database table defined by its mapping object:"
+{ $code "db get \"John\" \"Smith\" \"123-456-789\" <person> insert-tuple" }
+{ $link insert-tuple } " internally uses the " { $link insert-sql } " word to produce the SQL used to store the tuple. Like " { $link create-sql } ", it is a generic word specialized on the mapping object. You can call it directly to see what SQL is generated:"
+{ $code "person get-mapping insert-sql .\n => \"insert into person values(:name,:surname,:phone);\"" }
+"Notice that the SQL uses named parameters. These parameters are bound to the values stored in the tuple object when the SQL is compiled. This helps prevent SQL injection techniques."
+$nl
+"When " { $link insert-sql } " is run, it adds a delegate to the tuple being stored. The delegate is of type 'persistent' and holds the row id of the tuple in its 'key' slot. This way the exact record can be updated or retrieved later. The following demonstates this fact:"
+{ $code "\"Mandy\" \"Jones\" \"987-654-321\" <person> dup .\n  => T{ person f \"Mandy\" \"Jones\" \"987-654-321\" }\ndb get over insert-tuple .\n  => T{ person T{ persistent ... 2 } \"Mandy\" \"Jones\" \"987-654-321\" }" }
+"The '2' in the above example is the row id of the record inserted. We can go into the 'sqlite' command and view this record:"
+{ $code "  $ sqlite3 example.db\n    SQLite version 3.0.8\n    Enter \".help\" for instructions\n    sqlite> select ROWID,* from person;\n      1|John|Smith|123-456-789\n      2|Mandy|Jones|987-654-321\n    sqlite>" } ;
+
+ARTICLE: { "sqlite" "tuple-db-finding" } "Finding instances"
+"The " { $link find-tuples } " word is used to return tuples populated with data already existing in the database. As well as the database objcet, it takes a tuple that should be populated only with the fields that should be matched in the database. All fields you do not wish to match against should be set to 'f':"
+{ $code "db get f \"Smith\" f <person> find-tuples .\n => { T{ person # \"John\" \"Smith\" \"123-456-789\" } }\ndb get \"Mandy\" f f <person> find-tuples .\n => { T{ person # \"Mandy\" \"Jones\" \"987-654-321\" } }\ndb get \"Joe\" f f <person> find-tuples .\n => { }" }
+"Notice that if no matching tuples are found then an empty sequence is returned. The returned tuples also have their delegate set to 'persistent' with the correct row id set as the key. This can be used to later update the tuples with new information and store them in the database." ;
+
+ARTICLE: { "sqlite" "tuple-db-updating" } "Updating instances"
+"Given a tuple that has the 'persistent' delegate with the row id set as the key, you can update this specific record using " { $link update-tuple } ":"
+{ $code "db get f \"Smith\" f <person> find-tuples dup .\n => { T{ person # \"John\" \"Smith\" \"123-456-789\" } }\nfirst { \"999-999-999\" swap set-person-phone ] keep dup .\n => T{ person T{ persistent f # \"1\" } \"John\" \"Smith\" \"999-999-999\" ...\n db get swap update-tuple" }
+"Using the 'sqlite' command from the system shell you can see the record was updated:"
+{ $code "  $ sqlite3 example.db\n    SQLite version 3.0.8\n    Enter \".help\" for instructions\n    sqlite> select ROWID,* from person;\n      1|John|Smith|999-999-999\n      2|Mandy|Jones|987-654-321\n    sqlite>" } ;
+
+ARTICLE: { "sqlite" "tuple-db-inserting-or-updating" } "Inserting or Updating instances"
+"The " { $link save-tuple } " word can be used to insert a tuple if it has not already been stored in the database, or update it if it already exists. Whether to insert or update is decided by the existance of the 'persistent' delegate:"
+{ $code "\"Mary\" \"Smith\" \"111-111-111\" <person> dup .\n  => T{ person f \"Mary\" \"Smith\" \"111-111-111\" }\n! This will insert the tuple\ndb get over save-tuple dup .\n  => T{ person T{ persistent f # \"3\" } \"Mary\" \"Smith\" \"111-111-111\" ...\n[ \"222-222-222\" swap set-person-phone ] keep dup .\n  => T{ person T{ persistent f # \"3\" } \"Mary\"  \"Smith\" \"222-222-222\" ...\n! This will update the tuple\ndb get over save-tuple .\n  => T{ person T{ persistent f # \"3\" } \"Mary\"  \"Smith\" \"222-222-222\" ..." } ;
+
+ARTICLE: { "sqlite" "tuple-db-deleting" } "Deleting instances"
+"Given a tuple with the delegate set to 'persistent' (ie. One already stored in the database) you can delete it from the database with " { $link delete-tuple } ":"
+{ $code "db get f \"Smith\" f <person> find-tuples [ db get swap delete-tuple ] each" } ;
+
+ARTICLE: { "sqlite" "tuple-db-closing" } "Closing the database"
+"It's important to close the sqlite database when you've finished using it. The word for this is " { $link sqlite-close } ":"
+{ $code "db get sqlite-close" } ;
+
+ARTICLE: { "sqlite" "tuple-db" } "Tuple Database Library"
+"The version of sqlite required by this library is version 3 or greater. This library allows storing Factor tuples in a sqlite database. It provides words to create, read update and delete these entries as well as simple searching."
+$nl
+"The library is in a very early state and is likely to change quite a bit in the near future. Its most notable omission is it cannot currently handle relationships between tuples." 
+{ $subsection { "sqlite" "tuple-db-loading" } } 
+{ $subsection { "sqlite" "tuple-db-usage" } } 
+{ $subsection { "sqlite" "tuple-db-mappings" } } 
+{ $subsection { "sqlite" "tuple-db-create" } } 
+{ $subsection { "sqlite" "tuple-db-insert" } } 
+{ $subsection { "sqlite" "tuple-db-finding" } } 
+{ $subsection { "sqlite" "tuple-db-updating" } } 
+{ $subsection { "sqlite" "tuple-db-inserting-or-updating" } } 
+{ $subsection { "sqlite" "tuple-db-deleting" } } 
+{ $subsection { "sqlite" "tuple-db-closing" } } 
+;
+
+HELP: default-mapping 
+{ $values { "class" "symbol for the tuple class" } 
+          { "mapping" "a mapping object" } 
+}
+{ $description "Given a tuple class, create a default mappings object. This is used to associate field names in the tuple with SQL statement field names, etc." } 
+{ $see-also { "sqlite" "tuple-db" } set-mapping } ;
+
+HELP: set-mapping 
+{ $values { "mapping" "a mapping object" } 
+}
+{ $description "Store a database mapping so that the tuple-db system knows how to store instances of the tuple in the database." } 
+{ $see-also { "sqlite" "tuple-db" } default-mapping } ;
+
+HELP: create-tuple-table
+{ $values { "db" "a database object" } { "class" "symbol for the tuple class" }
+}
+{ $description "Create the database table to store intances of the given tuple." } 
+{ $see-also { "sqlite" "tuple-db" } default-mapping get-mapping } ;
+
+HELP: insert-tuple
+{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
+}
+{ $description "Insert the tuple instance into the database. It is assumed that this tuple does not currently exist in the database." } 
+{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
+
+HELP: find-tuples
+{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" } { "seq" "a sequence of tuples" } }
+{ $description "Return a sequence of all tuples in the database that match the tuple provided as a template. All fields in the tuple must match the entries in the database, except for those set to 'f'." } 
+{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
+
+HELP: update-tuple
+{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
+}
+{ $description "Update the database record for this tuple instance. The tuple must have previously been obtained from the database, or inserted into it. It must have a delegate of 'persistent' with the key field set (which is done by the find and insert operations)." } 
+{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
+
+HELP: save-tuple
+{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
+}
+{ $description "Insert or Update the tuple instance depending on whether it has a persistent delegate." } 
+{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
+
+HELP: delete-tuple
+{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
+}
+{ $description "Delete this tuple instance from the database. The tuple must have previously been obtained from the database, or inserted into it. It must have a delegate of 'persistent' with the key field set (which is done by the find and insert operations)." } 
+{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
diff --git a/extra/sqlite/tuple-db/tuple-db-tests.factor b/extra/sqlite/tuple-db/tuple-db-tests.factor
new file mode 100644 (file)
index 0000000..8ed2631
--- /dev/null
@@ -0,0 +1,39 @@
+! Copyright (C) 2005 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: temporary
+USING: io io.files kernel sequences namespaces
+hashtables sqlite sqlite.tuple-db math words tools.test ;
+
+TUPLE: testdata one two ;
+
+C: <testdata> testdata
+
+testdata default-mapping set-mapping
+
+"libs/sqlite/test.db" resource-path [
+
+    db get testdata create-tuple-table
+
+    [ "two" { } ] [
+    db get "one" "two" <testdata> insert-tuple
+    db get "one" f <testdata> find-tuples 
+    first [ testdata-two ] keep
+    db get swap delete-tuple    
+    db get "one" f <testdata> find-tuples 
+    ] unit-test
+
+    [ "junk" ] [
+    db get "one" "two" <testdata> insert-tuple
+    db get "one" f <testdata> find-tuples 
+    first  
+    "junk" over set-testdata-two
+    db get swap update-tuple
+    db get "one" f <testdata> find-tuples 
+    first [ testdata-two ] keep
+    db get swap delete-tuple      
+    ] unit-test
+
+    db get testdata drop-tuple-table
+] with-sqlite
+
diff --git a/extra/sqlite/tuple-db/tuple-db.factor b/extra/sqlite/tuple-db/tuple-db.factor
new file mode 100644 (file)
index 0000000..7f80268
--- /dev/null
@@ -0,0 +1,270 @@
+! Copyright (C) 2005 Chris Double.
+!
+! A tuple that is persistent has its delegate set as 'persistent'.
+! 'persistent' holds the numeric rowid for that tuple in its table.
+IN: sqlite.tuple-db
+USING: io kernel sequences namespaces slots classes slots.private
+assocs math words generic sqlite math.parser ;
+
+! Each slot in a tuple that is storable in the database has
+! an instance of a db-field object the gives the name of the 
+! database table and slot number in the tuple object of that field.
+TUPLE: db-field name bind-name slot type ;
+
+C: <db-field> db-field
+
+! The mapping tuple holds information on how the slots of
+! a tuple are mapped to the fields of a sqlite database. 
+TUPLE: mapping tuple table fields one-to-one one-to-many   ;
+
+C: <mapping> mapping
+
+: sanitize ( string -- string ) 
+    #! Convert a string so it can be used as a table or field name.
+    clone
+    H{ { CHAR: - CHAR: _ } { CHAR: ? CHAR: p } }
+    over substitute ;
+
+: tuple-fields ( class -- seq )
+  #! Given a tuple class return a list of the fields
+  #! within that tuple. Ignores the delegate field.
+  "slots" word-prop 1 tail [
+    [ slot-spec-name sanitize dup ":" swap append ] keep
+    slot-spec-offset
+    "text"
+    <db-field>
+  ] map ;
+
+: default-mapping ( class -- mapping )  
+  #! Given a tuple class, create a default mappings object. It assumes
+  #! there are no one-to-one or one-to-many relationships.
+  dup [ word-name sanitize ] keep tuple-fields f f <mapping> ;
+
+! The mappings variable holds a hashtable mapping the tuple symbol
+! to the mapping object, describing how that tuple is stored
+! in the database.
+SYMBOL: mappings
+
+: init-mappings ( -- )
+  H{ } mappings set-global ;
+
+: get-mappings ( -- hashtable )
+  mappings get-global ;
+
+: set-mapping ( mapping -- )
+  #! Store a database mapping so that the persistence system 
+  #! knows how to store instances of the relevant tuple in the database.
+  dup mapping-tuple get-mappings set-at ;
+
+: get-mapping ( class -- mapping )
+  #! Return the database mapping for the given tuple class.
+  get-mappings at ;
+
+! The 'persistent' tuple will be set to the delegate of any tuple
+! instance stored in the database. It contains the database key
+! of the row in the database table for the instance or 'f' if it has
+! not yet been stored in the database. It also contains the 'mapping'
+! object used to translate the fields of the tuple to the database fields.
+TUPLE: persistent mapping key ;
+: <persistent> ( tuple -- persistent )
+  persistent construct-empty
+  >r class get-mapping r> 
+  [ set-persistent-mapping ] keep ;
+
+: make-persistent ( tuple -- tuple )
+  #! Convert the tuple into something that can be stored
+  #! into a database by setting its delegate to 'persistent'.
+  [ <persistent> ] keep 
+  [ set-delegate ] keep ;
+
+
+: comma-fields ( mapping quot -- string )
+  #! Given a mapping, call quot on each field in
+  #! the mapping. The contents of quot should call ',' or '%'
+  #! to generate output. The output of each quot call
+  #! seperated by commas is returned as a string. 'quot' should be
+  #! stack effect ( field -- ).
+  >r mapping-fields r> [ "" make ] curry map "," join ; inline
+
+GENERIC: create-sql ( mapping -- string )
+M: mapping create-sql ( mapping -- string )
+  #! Return the SQL used to create a table for storing this type of tuple.
+  [
+    "create table " % dup mapping-table % 
+    " (" % 
+    [ dup db-field-name % " " % db-field-type % ] comma-fields %
+    ");" %
+  ] "" make ;
+
+GENERIC: drop-sql ( mapping -- string )
+M: mapping drop-sql ( mapping -- string )
+  #! Return the SQL used to drop the table for storing this type of tuple.
+  [
+    "drop table " % mapping-table % ";" %
+  ] "" make ;
+
+GENERIC: insert-sql ( mapping -- string )
+M: mapping insert-sql ( mapping -- string )
+  #! Return the SQL used to insert a tuple into a table
+  [
+    "insert into " % dup mapping-table %
+    " values(" %
+    [ db-field-bind-name % ] comma-fields %
+    ");" %
+  ] "" make ;
+
+GENERIC: delete-sql ( mapping -- string )
+M: mapping delete-sql ( mapping -- string )
+  #! Return the SQL used to delete a tuple from a table
+  [
+    "delete from " % mapping-table %
+    " where ROWID=:rowid;" % 
+  ] "" make ;
+
+GENERIC: update-sql ( mapping -- string )
+M: mapping update-sql ( mapping -- string )
+  #! Return the SQL used to update the tuple
+  [
+    "update " % dup mapping-table %
+    " set " %
+    [ dup db-field-name % "=" % db-field-bind-name % ] comma-fields %
+    " where ROWID=:rowid;" %
+  ] "" make ;
+
+GENERIC: select-sql ( tuple mapping -- select )
+M: mapping select-sql ( tuple mapping -- select )
+  #! Return the SQL used to select a series of tuples from the database. It
+  #! will select based on only the filled in fields of the tuple (ie. all non-f).
+  [
+    "select ROWID,* from " % dup mapping-table %
+    mapping-fields [ ! tuple field
+      swap over db-field-slot slot ! field value
+      [
+        [ dup db-field-name % "=" % db-field-bind-name % ] "" make        
+      ] [
+        drop f
+      ] if
+    ] curry* map [ ] subset dup length 0 > [
+      " where " % 
+      " and " join % 
+    ] [
+      drop
+    ] if
+    ";" %
+  ] "" make ;
+
+: execute-update-sql ( db string -- )
+  #! Execute the SQL, which should contain a database update
+  #! statement (update, insert, create, etc). Ignore the result.
+  sqlite-prepare dup [ drop ] sqlite-each sqlite-finalize ;
+
+: create-tuple-table ( db class -- )
+  #! Create the table for the tuple class.
+  get-mapping create-sql execute-update-sql ;
+
+: drop-tuple-table ( db class -- )
+  #! Create the table for the tuple class.
+  get-mapping drop-sql execute-update-sql ;
+
+: bind-for-insert ( statement tuple -- )
+  #! Bind the fields in the tuple to the fields in the 
+  #! prepared insert statement.
+  dup class get-mapping mapping-fields [ ! statement tuple field
+    [ db-field-slot slot ] keep ! statement value field
+    db-field-bind-name swap ! statement name value
+    >r dupd r> sqlite-bind-text-by-name     
+  ] curry* each drop ;  
+
+: bind-for-select ( statement tuple -- )
+  #! Bind the fields in the tuple to the fields in the 
+  #! prepared select statement.
+  dup class get-mapping mapping-fields [ ! statement tuple field
+    [ db-field-slot slot ] keep ! statement value field
+    over [
+      db-field-bind-name swap ! statement name value
+      >r dupd r> sqlite-bind-text-by-name     
+    ] [ 
+      2drop 
+    ] if
+  ] curry* each drop ;  
+
+: bind-for-update ( statement tuple -- )
+  #! Bind the fields in the tuple to the fields in the 
+  #! prepared update statement.
+  2dup bind-for-insert
+  >r ":rowid" r> persistent-key sqlite-bind-text-by-name ;
+
+: bind-for-delete ( statement tuple -- )
+  #! Bind the fields in the tuple to the fields in the 
+  #! prepared delete statement.
+  >r ":rowid" r> persistent-key sqlite-bind-text-by-name ;
+
+: (insert-tuple) ( db tuple -- )
+  #! Insert this tuple instance into the database. Note that
+  #! it inserts only this instance, and not any one-to-one or
+  #! one-to-many fields.
+  dup class get-mapping insert-sql ! db tuple sql
+  swapd sqlite-prepare swap ! statement tuple
+  dupd bind-for-insert ! statement
+  dup [ drop ] sqlite-each
+  sqlite-finalize ;
+  
+: insert-tuple ( db tuple -- )
+  #! Insert this tuple instance into the database and
+  #! update the rowid of the insert in the tuple.
+  [ (insert-tuple) ] 2keep
+  >r sqlite-last-insert-rowid number>string r> make-persistent set-persistent-key ;
+
+: update-tuple ( db tuple -- )
+  #! Update this tuple instance in the database. The tuple should have
+  #! a delegate of 'persistent' with the key field set.
+  dup class get-mapping update-sql ! db tuple sql
+  swapd sqlite-prepare swap ! statement tuple
+  dupd bind-for-update ! statement
+  dup [ drop ] sqlite-each
+  sqlite-finalize ;
+
+: save-tuple ( db tuple -- )
+  #! Insert or Update the tuple instance depending on whether it
+  #! has a persistent delegate.
+  dup delegate [ update-tuple ] [ insert-tuple ] if ;
+
+: delete-tuple ( db tuple -- )
+  #! Delete this tuple instance from the database. The tuple should have
+  #! a delegate of 'persistent' with the key field set.
+  dup class get-mapping delete-sql ! db tuple sql
+  swapd sqlite-prepare swap ! statement tuple
+  dupd bind-for-delete ! statement
+  dup [ drop ] sqlite-each
+  sqlite-finalize ;
+
+: restore-tuple ( statement tuple -- tuple )
+  #! Using 'tuple' as a template, clone it and 
+  #! return the clone with fields set to the values from the
+  #! database.
+  clone dup class get-mapping mapping-fields 1 swap 
+  [ ! statement tuple index field )
+    over 1+ >r ! statement tuple index field r: index+1
+    db-field-slot >r ! statement tuple index r: index+1 slot
+    pick swap column-text ! statement tuple value r: index+1 slot
+    over r> set-slot r> ! statement tuple index+1
+  ] each ! statement tuple index
+  drop make-persistent swap 0 column-text swap [ set-persistent-key ] keep ; 
+
+: find-tuples ( db tuple -- seq )
+  #! Return a sequence of all tuples in the database that
+  #! match the tuple provided as a template. All fields in the
+  #! tuple must match the entries in the database, except for 
+  #! those set to 'f'. 
+  dup class get-mapping dupd select-sql ! db tuple sql
+  swapd sqlite-prepare swap ! statement tuple
+  2dup bind-for-select ! statement tuple
+  [
+    over [ ! tuple statement
+      over restore-tuple ,
+    ] sqlite-each 
+  ] { } make nip ! statement tuple accum
+  swap sqlite-finalize ;
+  
+get-mappings [ init-mappings ] unless 
diff --git a/extra/state-machine/state-machine.factor b/extra/state-machine/state-machine.factor
new file mode 100644 (file)
index 0000000..671150b
--- /dev/null
@@ -0,0 +1,41 @@
+USING: kernel parser strings math namespaces sequences words io arrays 
+quotations debugger kernel.private ;
+IN: state-machine
+
+: STATES:
+    ! STATES: set-name state1 state2 ... ;
+    ";" parse-tokens
+    [ length ] keep
+    unclip add
+    [ create-in swap 1quotation define-compound ] 2each ; parsing
+
+TUPLE: state place data ;
+
+TUPLE: missing-state ;
+: missing-state \ missing-state construct-empty throw ;
+M: missing-state error.
+    drop "Missing state" print ;
+
+: make-machine ( states -- table quot )
+    ! quot is ( state string -- output-string )
+    [ missing-state ] <array> dup
+    [
+        [ >r dup dup state-data swap state-place r> ] %
+        [ swapd bounds-check dispatch ] curry ,
+        [ each pick set-state-place swap set-state-data ] %
+    ] [ ] make [ over make ] curry ;
+
+: define-machine ( word state-class -- )
+    execute make-machine
+    >r over r> define-compound
+    "state-table" set-word-prop ;
+
+: MACHINE:
+    ! MACHINE: utf8 unicode-states
+    CREATE scan-word define-machine ; parsing
+
+: S:
+    ! S: state state-machine definition... ;
+    ! definition MUST be ( data char -- newdata state )
+    scan-word execute scan-word "state-table" word-prop
+    parse-definition -rot set-nth ; parsing
diff --git a/extra/state-parser/authors.txt b/extra/state-parser/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/state-parser/state-parser-docs.factor b/extra/state-parser/state-parser-docs.factor
new file mode 100644 (file)
index 0000000..7ef2869
--- /dev/null
@@ -0,0 +1,72 @@
+USING: help.markup help.syntax ;
+IN: state-parser
+
+ABOUT: { "state-parser" "main" }
+
+ARTICLE: { "state-parser" "main" } "State-based parsing"
+    "This module defines a state-based parsing mechanism. It was originally created for libs/xml, but is also used in libs/csv and can be easily used in new libraries or applications."
+    { $subsection spot }
+    { $subsection skip-until }
+    { $subsection take-until }
+    { $subsection take-char }
+    { $subsection take-string }
+    { $subsection next }
+    { $subsection state-parse }
+    { $subsection get-char }
+    { $subsection rest }
+    { $subsection string-parse }
+    { $subsection expect }
+    { $subsection expect-string }
+    { $subsection parsing-error } ;
+
+HELP: get-char
+{ $values { "char" "the current character" } }
+{ $description "Accesses the current character of the stream that is being parsed" } ;
+
+HELP: rest
+{ $values { "string" "the rest of the parser input" } }
+{ $description "Exausts the stream of the parser input and returns a string representing the rest of the input" } ;
+
+HELP: string-parse
+{ $values { "input" "a string" } { "quot" "a quotation ( -- )" } }
+{ $description "Calls the given quotation using the given string as parser input" }
+{ $see-also state-parse } ;
+
+HELP: expect
+{ $values { "ch" "a number representing a character" } }
+{ $description "Asserts that the current character is the given ch, and moves to the next spot" }
+{ $see-also expect-string } ;
+
+HELP: expect-string
+{ $values { "string" "a string" } }
+{ $description "Asserts that the current parsing spot is followed by the given string, and skips the parser past that string" }
+{ $see-also expect } ;
+
+HELP: spot
+{ $var-description "This variable represents the location in the program. It is a tuple T{ spot f char column line next } where char is the current character, line is the line number, column is the column number, and line-str is the full contents of the line, as a string. The contents shouldn't be accessed directly but rather with the proxy words get-char set-char get-line etc." } ;
+
+HELP: skip-until
+{ $values { "quot" "a quotation ( -- ? )" } }
+{ $description "executes " { $link next } " until the quotation yields false. Usually, the quotation will call " { $link get-char } " in its test, but not always." }
+{ $see-also take-until } ;
+
+HELP: take-until
+{ $values { "quot" "a quotation ( -- ? )" } { "string" "a string" } }
+{ $description "like " { $link skip-until } " but records what it passes over and outputs the string." }
+{ $see-also skip-until take-char take-string } ;
+
+HELP: take-char
+{ $values { "ch" "a character" } { "string" "a string" } }
+{ $description "records the document from the current spot to the first instance of the given character. Outputs the content between those two points." }
+{ $see-also take-until take-string } ;
+
+HELP: take-string
+{ $values { "match" "a string to match" } { "string" "the portion of the XML document" } }
+{ $description "records the document from the current spot to the first instance of the given character. Outputs the content between those two points." }
+{ $notes "match may not contain a newline" } ;
+
+HELP: next
+{ $description "originally written as " { $code "spot inc" } ", code that would no longer run, this word moves the state of the XML parser to the next place in the source file, keeping track of appropriate debugging information." } ;
+
+HELP: parsing-error
+{ $class-description "class to which parsing errors delegate, containing information about which line and column the error occured on, and what the line was. Contains three slots, line, an integer, column, another integer, and line-str, a string" } ;
diff --git a/extra/state-parser/state-parser-tests.factor b/extra/state-parser/state-parser-tests.factor
new file mode 100644 (file)
index 0000000..ff8ac91
--- /dev/null
@@ -0,0 +1,8 @@
+USING: tools.test state-parser kernel io strings ;
+
+[ "hello" ] [ "hello" [ rest ] string-parse ] unit-test
+[ 2 4 ] [ "12\n123" [ rest drop get-line get-column ] string-parse ] unit-test
+[ "hi" " how are you?" ] [ "hi how are you?" [ [ get-char blank? ] take-until rest ] string-parse ] unit-test
+[ "foo" ";bar" ] [ "foo;bar" [ CHAR: ; take-char rest ] string-parse ] unit-test
+[ "foo " " bar" ] [ "foo and bar" [ "and" take-string rest ] string-parse ] unit-test
+[ "baz" ] [ " \n\t baz" [ pass-blank rest ] string-parse ] unit-test
diff --git a/extra/state-parser/state-parser.factor b/extra/state-parser/state-parser.factor
new file mode 100644 (file)
index 0000000..c0e6318
--- /dev/null
@@ -0,0 +1,140 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: io io.streams.string kernel math namespaces sequences\r
+strings circular prettyprint debugger ;\r
+IN: state-parser\r
+\r
+! * Basic underlying words\r
+! Code stored in stdio\r
+! Spot is composite so it won't be lost in sub-scopes\r
+TUPLE: spot char line column next ;\r
+\r
+C: <spot> spot\r
+\r
+: get-char ( -- char ) spot get spot-char ;\r
+: set-char ( char -- ) spot get set-spot-char ;\r
+: get-line ( -- line ) spot get spot-line ;\r
+: set-line ( line -- ) spot get set-spot-line ;\r
+: get-column ( -- column ) spot get spot-column ;\r
+: set-column ( column -- ) spot get set-spot-column ;\r
+: get-next ( -- char ) spot get spot-next ;\r
+: set-next ( char -- ) spot get set-spot-next ;\r
+\r
+! * Errors\r
+TUPLE: parsing-error line column ;\r
+: <parsing-error> ( -- parsing-error )\r
+    get-line get-column parsing-error construct-boa ;\r
+\r
+: construct-parsing-error ( ... slots class -- error )\r
+    construct <parsing-error> over set-delegate ; inline\r
+\r
+: parsing-error. ( parsing-error -- )\r
+    "Parsing error" print\r
+    "Line: " write dup parsing-error-line .\r
+    "Column: " write parsing-error-column . ;\r
+\r
+TUPLE: expected should-be was ;\r
+: <expected> ( should-be was -- error )\r
+    { set-expected-should-be set-expected-was }\r
+    expected construct-parsing-error ;\r
+M: expected error.\r
+    dup parsing-error.\r
+    "Token expected: " write dup expected-should-be print\r
+    "Token present: " write expected-was print ;\r
+\r
+TUPLE: unexpected-end ;\r
+: <unexpected-end> ( -- unexpected-end )\r
+    { } unexpected-end construct-parsing-error ;\r
+M: unexpected-end error.\r
+    parsing-error.\r
+    "File unexpectedly ended." print ;\r
+\r
+TUPLE: missing-close ;\r
+: <missing-close> ( -- missing-close )\r
+    { } missing-close construct-parsing-error ;\r
+M: missing-close error.\r
+    parsing-error.\r
+    "Missing closing token." print ;\r
+\r
+SYMBOL: prolog-data\r
+\r
+! * Basic utility words\r
+\r
+: record ( char -- )\r
+    CHAR: \n =\r
+    [ 0 get-line 1+ set-line ] [ get-column 1+ ] if\r
+    set-column ;\r
+\r
+: (next) ( -- char ) ! this normalizes \r\n and \r\r
+    get-next read1\r
+    2dup swap CHAR: \r = [\r
+        CHAR: \n =\r
+        [ nip read1 ] [ nip CHAR: \n swap ] if\r
+    ] [ drop ] if\r
+    set-next dup set-char ;\r
+\r
+: next ( -- )\r
+    #! Increment spot.\r
+    get-char [\r
+        <unexpected-end> throw\r
+    ] unless\r
+    (next) record ;\r
+\r
+: next* ( -- )\r
+    get-char [ (next) record ] when ;\r
+\r
+: skip-until ( quot -- )\r
+    #! quot: ( -- ? )\r
+    get-char [\r
+        [ call ] keep swap [ drop ] [\r
+            next skip-until\r
+        ] if\r
+    ] [ drop ] if ; inline\r
+\r
+: take-until ( quot -- string )\r
+    #! Take the substring of a string starting at spot\r
+    #! from code until the quotation given is true and\r
+    #! advance spot to after the substring.\r
+    [ [\r
+        dup slip swap dup [ get-char , ] unless\r
+    ] skip-until ] "" make nip ;\r
+\r
+: rest ( -- string )\r
+    [ f ] take-until ;\r
+\r
+: take-char ( ch -- string )\r
+    [ dup get-char = ] take-until nip ;\r
+\r
+: pass-blank ( -- )\r
+    #! Advance code past any whitespace, including newlines\r
+    [ get-char blank? not ] skip-until ;\r
+\r
+: string-matches? ( string circular -- ? )\r
+    get-char over push-circular\r
+    sequence= ;\r
+\r
+: take-string ( match -- string )\r
+    dup length <circular-string>\r
+    [ 2dup string-matches? ] take-until nip\r
+    dup length rot length 1- - head\r
+    get-char [ <missing-close> throw ] unless next ;\r
+\r
+: expect ( ch -- )\r
+    get-char 2dup = [ 2drop ] [\r
+        >r 1string r> 1string <expected> throw\r
+    ] if next ;\r
+\r
+: expect-string ( string -- )\r
+    dup [ drop get-char next ] map 2dup =\r
+    [ 2drop ] [ <expected> throw ] if ;\r
+\r
+: init-parser ( -- )\r
+    0 1 0 f <spot> spot set\r
+    read1 set-next next ;\r
+\r
+: state-parse ( stream quot -- )\r
+    ! with-stream implicitly creates a new scope which we use\r
+    swap [ init-parser call ] with-stream ; inline\r
+\r
+: string-parse ( input quot -- )\r
+    >r <string-reader> r> state-parse ; inline\r
diff --git a/extra/state-parser/summary.txt b/extra/state-parser/summary.txt
new file mode 100644 (file)
index 0000000..5d14290
--- /dev/null
@@ -0,0 +1 @@
+State-machined based text parsing framework
diff --git a/extra/store/authors.txt b/extra/store/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/store/blob/blob.factor b/extra/store/blob/blob.factor
new file mode 100644 (file)
index 0000000..a903471
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs kernel io io.files namespaces serialize ;
+IN: store.blob
+
+: (save-blob) serialize ;
+
+: save-blob ( obj path -- )
+    <file-appender> [ (save-blob) ] with-stream ;
+
+: (load-blob) ( path -- seq/f )
+    dup exists? [
+        <file-reader> [
+            [ deserialize-sequence ] with-serialized
+        ] with-stream
+    ] [
+        drop f
+    ] if ;
+
+: load-blob ( path -- seq/f )
+    resource-path (load-blob) ;
+
diff --git a/extra/store/store.factor b/extra/store/store.factor
new file mode 100644 (file)
index 0000000..7d3092a
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2006, 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs io io.files kernel namespaces serialize ;
+IN: store
+
+TUPLE: store path data ;
+
+C: <store> store
+
+: save-store ( store -- )
+    [ store-data ] keep store-path <file-writer> [
+        [
+            dup
+            [ drop [ get ] keep rot set-at ] curry* assoc-each
+        ] keep serialize
+    ] with-stream ;
+
+: load-store ( path -- store )
+    resource-path dup exists? [
+        dup <file-reader> [
+            deserialize
+        ] with-stream
+    ] [
+        H{ } clone
+    ] if <store> ;
+
+: store-variable ( default variable store -- )
+    store-data 2dup at* [
+        rot set-global 2drop
+    ] [
+        drop >r 2dup set-global r> set-at
+    ] if ;
+
diff --git a/extra/strings/lib/lib.factor b/extra/strings/lib/lib.factor
new file mode 100644 (file)
index 0000000..870e72b
--- /dev/null
@@ -0,0 +1,8 @@
+
+USING: math arrays sequences ;
+
+IN: strings.lib
+
+: char>digit ( c -- i ) 48 - ;
+
+: string>digits ( s -- seq ) [ char>digit ] { } map-as ;
diff --git a/extra/strings/lib/tags.txt b/extra/strings/lib/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/structs/structs.factor b/extra/structs/structs.factor
new file mode 100644 (file)
index 0000000..c0792ed
--- /dev/null
@@ -0,0 +1,13 @@
+USING: alien.c-types alien.syntax kernel math ;
+IN: structs
+
+C-STRUCT: timeval
+    { "long" "sec" }
+    { "long" "usec" } ;
+
+: make-timeval ( ms -- timeval )
+    1000 /mod 1000 *
+    "timeval" <c-object>
+    [ set-timeval-usec ] keep
+    [ set-timeval-sec ] keep ;
+
diff --git a/extra/structs/tags.txt b/extra/structs/tags.txt
new file mode 100644 (file)
index 0000000..86d6ad3
--- /dev/null
@@ -0,0 +1 @@
+Cross-platform C structs
diff --git a/extra/sudoku/authors.txt b/extra/sudoku/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/sudoku/sudoku.factor b/extra/sudoku/sudoku.factor
new file mode 100644 (file)
index 0000000..f19e536
--- /dev/null
@@ -0,0 +1,93 @@
+! Based on http://www.ffconsultancy.com/ocaml/sudoku/index.html
+USING: sequences namespaces kernel math math.parser io
+io.styles combinators ;
+IN: sudoku
+
+SYMBOL: solutions
+SYMBOL: board
+
+: pair+ swapd + >r + r> ;
+
+: row board get nth ;
+: board> row nth ;
+: >board row set-nth ;
+: f>board f -rot >board ;
+
+: row-contains? ( n y -- ? ) row member? ;
+: col-contains? ( n x -- ? ) board get swap <column> member? ;
+: cell-contains? ( n x y i -- ? ) 3 /mod pair+ board> = ;
+
+: box-contains? ( n x y -- ? )
+    [ 3 /i 3 * ] 2apply
+    9 [ >r 3dup r> cell-contains? ] contains?
+    >r 3drop r> ;
+
+DEFER: search
+
+: assume ( n x y -- )
+    [ >board ] 2keep [ >r 1+ r> search ] 2keep f>board ;
+
+: attempt ( n x y -- )
+    {
+        { [ 3dup nip row-contains? ] [ 3drop ] }
+        { [ 3dup drop col-contains? ] [ 3drop ] }
+        { [ 3dup box-contains? ] [ 3drop ] }
+        { [ t ] [ assume ] }
+    } cond ;
+
+: solve ( x y -- ) 9 [ 1+ pick pick attempt ] each 2drop ;
+
+: board. ( board -- )
+    standard-table-style [
+        [
+            [
+                [
+                    [
+                        [
+                            number>string write
+                        ] [
+                            "." write
+                        ] if*
+                    ] with-cell
+                ] each
+            ] with-row
+        ] each
+    ] tabular-output ;
+
+: solution. ( -- )
+    solutions inc "Solution:" print board get board. ;
+
+: search ( x y -- )
+    {
+        { [ over 9 = ] [ >r drop 0 r> 1+ search ] }
+        { [ over 0 = over 9 = and ] [ 2drop solution. ] }
+        { [ 2dup board> ] [ >r 1+ r> search ] }
+        { [ t ] [ solve ] }
+    } cond ;
+
+: sudoku ( board -- )
+    [
+        "Puzzle:" print dup board.
+
+        0 solutions set
+        [ clone ] map board set
+
+        0 0 search
+
+        solutions get number>string write " solutions." print
+    ] with-scope ;
+
+: sudoku-demo ( -- )
+    {
+        { f f 1 f f 5 3 f f }
+        { f 5 f 4 9 f f f f }
+        { f f f 1 f 2 f 6 4 }
+        { f f f f f f 7 5 f }
+        { 6 f f f f f f f 1 }
+        { f 3 5 f f f f f f }
+        { 4 6 f 9 f 3 f f f }
+        { f f f f 2 4 f 9 f }
+        { f f 3 6 f f 1 f f }
+    } sudoku ;
+
+MAIN: sudoku-demo
diff --git a/extra/sudoku/summary.txt b/extra/sudoku/summary.txt
new file mode 100644 (file)
index 0000000..a0ede22
--- /dev/null
@@ -0,0 +1 @@
+Sudoku solver demo
diff --git a/extra/sudoku/tags.txt b/extra/sudoku/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/tar/tar.factor b/extra/tar/tar.factor
new file mode 100644 (file)
index 0000000..9ee727a
--- /dev/null
@@ -0,0 +1,245 @@
+USING: combinators io io.files io.streams.duplex
+io.streams.string kernel math math.parser
+namespaces pack prettyprint sequences strings system ;
+USING: hexdump tools.interpreter ;
+IN: tar
+
+: zero-checksum 256 ;
+
+TUPLE: tar-header name mode uid gid size mtime checksum typeflag
+linkname magic version uname gname devmajor devminor prefix ;
+
+: <tar-header> ( -- obj ) tar-header construct-empty ;
+
+: tar-trim ( seq -- newseq )
+    [ "\0 " member? ] trim ;
+
+: read-tar-header ( -- obj )
+    <tar-header>
+    100 read-c-string* over set-tar-header-name
+    8 read-c-string* tar-trim oct> over set-tar-header-mode
+    8 read-c-string* tar-trim oct> over set-tar-header-uid
+    8 read-c-string* tar-trim oct> over set-tar-header-gid
+    12 read-c-string* tar-trim oct> over set-tar-header-size
+    12 read-c-string* tar-trim oct> over set-tar-header-mtime
+    8 read-c-string* tar-trim oct> over set-tar-header-checksum
+    read1 over set-tar-header-typeflag
+    100 read-c-string* over set-tar-header-linkname
+    6 read over set-tar-header-magic
+    2 read over set-tar-header-version
+    32 read-c-string* over set-tar-header-uname
+    32 read-c-string* over set-tar-header-gname
+    8 read tar-trim oct> over set-tar-header-devmajor
+    8 read tar-trim oct> over set-tar-header-devminor
+    155 read-c-string* over set-tar-header-prefix ;
+
+: header-checksum ( seq -- x )
+    148 swap cut-slice 8 tail-slice
+    [ 0 [ + ] reduce ] 2apply + 256 + ;
+
+TUPLE: checksum-error ;
+TUPLE: malformed-block-error ;
+
+SYMBOL: base-dir
+SYMBOL: out-stream
+SYMBOL: filename
+
+: (read-data-blocks) ( tar-header -- )
+    512 read [
+        over tar-header-size dup 512 <= [
+            head-slice 
+            >string write
+            drop
+        ] [
+            drop
+            >string write
+            dup tar-header-size 512 - over set-tar-header-size
+            (read-data-blocks)
+        ] if
+    ] [
+        drop
+    ] if* ;
+
+: read-data-blocks ( tar-header out -- )
+    >r stdio get r> <duplex-stream> [
+        (read-data-blocks)
+    ] with-stream* ;
+
+: parse-tar-header ( seq -- obj )
+    [ header-checksum ] keep over zero-checksum = [
+        2drop
+        \ tar-header construct-empty
+        0 over set-tar-header-size
+        0 over set-tar-header-checksum
+    ] [
+        [ read-tar-header ] string-in
+        [ tar-header-checksum = [
+                \ checksum-error construct-empty throw
+            ] unless
+        ] keep
+    ] if ;
+
+TUPLE: unknown-typeflag str ;
+: <unknown-typeflag> ( ch -- obj )
+    1string \ unknown-typeflag construct-boa ;
+
+TUPLE: unimplemented-typeflag header ;
+: <unimplemented-typeflag> ( header -- obj )
+    global [ "Unimplemented typeflag: " print dup . flush ] bind
+    tar-header-typeflag
+    1string \ unimplemented-typeflag construct-boa ;
+
+: tar-path+ ( path -- newpath )
+    base-dir get swap path+ ;
+
+! Normal file
+: typeflag-0
+  tar-header-name tar-path+ <file-writer>
+  [ read-data-blocks ] keep stream-close ;
+
+! Hard link
+: typeflag-1 ( header -- )
+   <unimplemented-typeflag> throw ;
+
+! Symlink
+: typeflag-2 ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! character special
+: typeflag-3 ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Block special
+: typeflag-4 ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Directory
+: typeflag-5 ( header -- )
+    tar-header-name tar-path+ make-directories ;
+
+! FIFO
+: typeflag-6 ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Contiguous file
+: typeflag-7 ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Global extended header
+: typeflag-8 ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Extended header
+: typeflag-9 ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Global POSIX header
+: typeflag-g ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Extended POSIX header
+: typeflag-x ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Solaris access control list
+: typeflag-A ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! GNU dumpdir
+: typeflag-D ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Solaris extended attribute file
+: typeflag-E ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Inode metadata
+: typeflag-I ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Long link name
+: typeflag-K ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Long file name
+: typeflag-L ( header -- )
+    <string-writer> [ read-data-blocks ] keep
+    >string [ CHAR: \0 = ] rtrim filename set
+    global [ "long filename: " write filename get . flush ] bind
+    filename get tar-path+ make-directories ;
+
+! Multi volume continuation entry
+: typeflag-M ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! GNU long file name
+: typeflag-N ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Sparse file
+: typeflag-S ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Volume header
+: typeflag-V ( header -- )
+    <unimplemented-typeflag> throw ;
+
+! Vendor extended header type
+: typeflag-X ( header -- )
+    <unimplemented-typeflag> throw ;
+
+: (parse-tar) ( -- )
+    512 read 
+    global [ dup hexdump. flush ] bind
+    [
+        parse-tar-header
+        ! global [ dup tar-header-name [ print flush ] when* ] bind 
+        dup tar-header-typeflag
+        {
+            { CHAR: \0 [ typeflag-0 ] }
+            { CHAR: 0 [ typeflag-0 ] }
+            { CHAR: 1 [ typeflag-1 ] }
+            { CHAR: 2 [ typeflag-2 ] }
+            { CHAR: 3 [ typeflag-3 ] }
+            { CHAR: 4 [ typeflag-4 ] }
+            { CHAR: 5 [ typeflag-5 ] }
+            { CHAR: 6 [ typeflag-6 ] }
+            { CHAR: 7 [ typeflag-7 ] }
+            { CHAR: g [ typeflag-g ] }
+            { CHAR: x [ typeflag-x ] }
+            { CHAR: A [ typeflag-A ] }
+            { CHAR: D [ typeflag-D ] }
+            { CHAR: E [ typeflag-E ] }
+            { CHAR: I [ typeflag-I ] }
+            { CHAR: K [ typeflag-K ] }
+            { CHAR: L [ typeflag-L ] }
+            { CHAR: M [ typeflag-M ] }
+            { CHAR: N [ typeflag-N ] }
+            { CHAR: S [ typeflag-S ] }
+            { CHAR: V [ typeflag-V ] }
+            { CHAR: X [ typeflag-X ] }
+            [ <unknown-typeflag> throw ]
+        } case
+        ! dup tar-header-size zero? [
+            ! out-stream get [ stream-close ] when
+            ! out-stream off
+            ! drop
+        ! ] [
+            ! dup tar-header-name
+            ! dup parent-dir base-dir swap path+
+            ! global [ dup [ . flush ] when* ] bind 
+            ! make-directories <file-writer>
+            ! out-stream set
+            ! read-tar-blocks
+        ! ] if
+        (parse-tar)
+    ] when* ;
+
+: parse-tar ( path -- obj )
+    <file-reader> [
+        "tar-test" resource-path base-dir set
+        global [ nl nl nl "Starting to parse .tar..." print flush ] bind
+        global [ "Expanding to: " write base-dir get . flush ] bind
+        (parse-tar)
+    ] with-stream ;
+
diff --git a/extra/tetris/README.txt b/extra/tetris/README.txt
new file mode 100644 (file)
index 0000000..bd34dc3
--- /dev/null
@@ -0,0 +1,16 @@
+This is a simple tetris game. To play, open factor (in GUI mode), and run:
+
+"tetris" run
+
+This should open a new window with a running tetris game. The commands are:
+
+left, right arrows: move the current piece left or right
+up arrow:           rotate the piece clockwise
+down arrow:         lower the piece one row
+space bar:          drop the piece
+p:                  pause/unpause
+n:                  start a new game
+
+TODO:
+- rotation of pieces when they're on the far right of the board
+- make blocks prettier
diff --git a/extra/tetris/authors.txt b/extra/tetris/authors.txt
new file mode 100644 (file)
index 0000000..e9c193b
--- /dev/null
@@ -0,0 +1 @@
+Alex Chapman
diff --git a/extra/tetris/board/board-tests.factor b/extra/tetris/board/board-tests.factor
new file mode 100644 (file)
index 0000000..3a870e6
--- /dev/null
@@ -0,0 +1,24 @@
+USING: kernel tetris.board tetris.piece tools.test arrays
+colors ;
+
+[ { { f f } { f f } { f f } } ] [ 2 3 make-rows ] unit-test
+[ { { f f } { f f } { f f } } ] [ 2 3 <board> board-rows ] unit-test
+[ 1 { f f } ] [ 2 3 <board> { 1 1 } board@block ] unit-test
+[ f ] [ 2 3 <board> { 1 1 } board-block ] unit-test
+[ 2 3 <board> { 2 3 } board-block ] unit-test-fails
+red 1array [ 2 3 <board> dup { 1 1 } red board-set-block { 1 1 } board-block ] unit-test
+[ t ] [ 2 3 <board> { 1 1 } block-free? ] unit-test
+[ f ] [ 2 3 <board> dup { 1 1 } red board-set-block { 1 1 } block-free? ] unit-test
+[ t ] [ 2 3 <board> dup { 1 1 } red board-set-block { 1 2 } block-free? ] unit-test
+[ t ] [ 2 3 <board> dup { 1 1 } red board-set-block { 0 1 } block-free? ] unit-test
+[ t ] [ 2 3 <board> { 0 0 } block-in-bounds? ] unit-test
+[ f ] [ 2 3 <board> { -1 0 } block-in-bounds? ] unit-test
+[ t ] [ 2 3 <board> { 1 2 } block-in-bounds? ] unit-test
+[ f ] [ 2 3 <board> { 2 2 } block-in-bounds? ] unit-test
+[ t ] [ 2 3 <board> { 1 1 } location-valid? ] unit-test
+[ f ] [ 2 3 <board> dup { 1 1 } red board-set-block { 1 1 } location-valid? ] unit-test
+[ t ] [ 10 10 <board> 10 <random-piece> piece-valid? ] unit-test
+[ f ] [ 2 3 <board> 10 <random-piece> { 1 2 } over set-piece-location piece-valid? ] unit-test
+[ { { f } { f } } ] [ 1 1 <board> dup add-row board-rows ] unit-test
+[ { { f } } ] [ 1 2 <board> dup { 0 1 } red board-set-block dup remove-full-rows board-rows ] unit-test
+[ { { f } { f } } ] [ 1 2 <board> dup { 0 1 } red board-set-block dup check-rows drop board-rows ] unit-test
diff --git a/extra/tetris/board/board.factor b/extra/tetris/board/board.factor
new file mode 100644 (file)
index 0000000..58ded0c
--- /dev/null
@@ -0,0 +1,56 @@
+! Copyright (C) 2006, 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences arrays tetris.piece math ;
+IN: tetris.board
+
+TUPLE: board width height rows ;
+
+: make-rows ( width height -- rows )
+    [ drop f <array> ] curry* map ;
+
+: <board> ( width height -- board )
+    2dup make-rows board construct-boa ;
+
+#! A block is simply an array of form { x y } where { 0 0 } is the top-left of
+#! the tetris board, and { 9 19 } is the bottom right on a 10x20 board.
+
+: board@block ( board block -- n row )
+    [ second swap board-rows nth ] keep first swap ;
+
+: board-set-block ( board block colour -- ) -rot board@block set-nth ;
+  
+: board-block ( board block -- colour ) board@block nth ;
+
+: block-free? ( board block -- ? ) board-block not ;
+
+: block-in-bounds? ( board block -- ? )
+    [ first swap board-width bounds-check? ] 2keep
+    second swap board-height bounds-check? and ;
+
+: location-valid? ( board block -- ? )
+    2dup block-in-bounds? [ block-free? ] [ 2drop f ] if ;
+
+: piece-valid? ( board piece -- ? )
+    piece-blocks [ location-valid? ] curry* all? ;
+
+: row-not-full? ( row -- ? ) f swap member? ;
+
+: add-row ( board -- )
+    dup board-rows over board-width f <array>
+    add* swap set-board-rows ;
+
+: top-up-rows ( board -- )
+    dup board-height over board-rows length = [
+        drop
+    ] [
+        dup add-row top-up-rows
+    ] if ;
+
+: remove-full-rows ( board -- )
+    dup board-rows [ row-not-full? ] subset swap set-board-rows ;
+
+: check-rows ( board -- n )
+    #! remove full rows, then add blank ones at the top, returning the number
+    #! of rows removed (and added)
+    dup remove-full-rows dup board-height over board-rows length - >r top-up-rows r> ;
+
diff --git a/extra/tetris/deploy.factor b/extra/tetris/deploy.factor
new file mode 100644 (file)
index 0000000..b73b99e
--- /dev/null
@@ -0,0 +1,13 @@
+USING: tools.deploy ;
+V{
+    { strip-word-props? t }
+    { strip-word-names? t }
+    { strip-dictionary? t }
+    { strip-debugger? t }
+    { strip-c-types? t }
+    { deploy-math? t }
+    { deploy-compiled? t }
+    { deploy-io? f }
+    { deploy-ui? t }
+    { "bundle-name" "Tetris.app" }
+}
diff --git a/extra/tetris/game/game-tests.factor b/extra/tetris/game/game-tests.factor
new file mode 100644 (file)
index 0000000..e5af548
--- /dev/null
@@ -0,0 +1,16 @@
+USING: kernel tetris.game tetris.board tetris.piece tools.test
+sequences ;
+
+[ t ] [ <default-tetris> dup tetris-current-piece swap tetris-next-piece and t f ? ] unit-test
+[ t ] [ <default-tetris> { 1 1 } can-move? ] unit-test
+[ t ] [ <default-tetris> { 1 1 } tetris-move ] unit-test
+[ 1 ] [ <default-tetris> dup { 1 1 } tetris-move drop tetris-current-piece piece-location second ] unit-test
+[ 1 ] [ <default-tetris> tetris-level ] unit-test
+[ 1 ] [ <default-tetris> 9 over set-tetris-rows tetris-level ] unit-test
+[ 2 ] [ <default-tetris> 10 over set-tetris-rows tetris-level ] unit-test
+[ 0 ] [ 3 0 rows-score ] unit-test
+[ 80 ] [ 1 1 rows-score ] unit-test
+[ 4800 ] [ 3 4 rows-score ] unit-test
+[ 1 ] [ <default-tetris> dup 3 score-rows dup 3 score-rows dup 3 score-rows tetris-level ] unit-test
+[ 2 ] [ <default-tetris> dup 4 score-rows dup 4 score-rows dup 2 score-rows tetris-level ] unit-test
+
diff --git a/extra/tetris/game/game.factor b/extra/tetris/game/game.factor
new file mode 100644 (file)
index 0000000..869a7c4
--- /dev/null
@@ -0,0 +1,113 @@
+! Copyright (C) 2006, 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences math tetris.board tetris.piece
+tetris.tetromino lazy-lists combinators system ;
+IN: tetris.game
+
+TUPLE: tetris pieces last-update update-interval rows score game-state paused? running? ;
+
+: default-width 10 ; inline
+: default-height 20 ; inline
+
+: <tetris> ( width height -- tetris )
+    <board> tetris construct-delegate
+    dup board-width <piece-llist> over set-tetris-pieces
+    0 over set-tetris-last-update
+    0 over set-tetris-rows
+    0 over set-tetris-score
+    f over set-tetris-paused?
+    t over set-tetris-running? ;
+
+: <default-tetris> ( -- tetris ) default-width default-height <tetris> ;
+
+: <new-tetris> ( old -- new )
+    [ board-width ] keep board-height <tetris> ;
+
+: tetris-board ( tetris -- board ) delegate ;
+
+: tetris-current-piece ( tetris -- piece ) tetris-pieces car ;
+
+: tetris-next-piece ( tetris -- piece ) tetris-pieces cdr car ;
+
+: toggle-pause ( tetris -- )
+    dup tetris-paused? not swap set-tetris-paused? ;
+
+: tetris-level ( tetris -- level )
+    tetris-rows 1+ 10 / ceiling ;
+
+: tetris-update-interval ( tetris -- interval )
+    tetris-level 1- 60 * 1000 swap - ;
+
+: add-block ( tetris block -- )
+    over tetris-current-piece tetromino-colour board-set-block ;
+
+: game-over? ( tetris -- ? )
+    dup tetris-next-piece piece-valid? not ;
+
+: new-current-piece ( tetris -- )
+    dup game-over? [
+        f swap set-tetris-running?
+    ] [
+        dup tetris-pieces cdr swap set-tetris-pieces
+    ] if ;
+
+: rows-score ( level n -- score )
+    {
+        { 0 [ 0 ] }
+        { 1 [ 40 ] }
+        { 2 [ 100 ] }
+        { 3 [ 300 ] }
+        { 4 [ 1200 ] }
+    } case swap 1+ * ;
+
+: add-score ( tetris score -- )
+    over tetris-score + swap set-tetris-score ;
+
+: score-rows ( tetris n -- )
+    2dup >r dup tetris-level r> rows-score add-score
+    over tetris-rows + swap set-tetris-rows ;
+
+: lock-piece ( tetris -- )
+    [ dup tetris-current-piece piece-blocks [ add-block ] curry* each ] keep
+    dup new-current-piece dup check-rows score-rows ;
+
+: can-rotate? ( tetris -- ? )
+    dup tetris-current-piece clone dup 1 rotate-piece piece-valid? ;
+
+: (rotate) ( inc tetris -- )
+    dup can-rotate? [ tetris-current-piece swap rotate-piece ] [ 2drop ] if ;
+
+: rotate-left ( tetris -- ) -1 swap (rotate) ;
+
+: rotate-right ( tetris -- ) 1 swap (rotate) ;
+
+: can-move? ( tetris move -- ? )
+    >r dup tetris-current-piece clone dup r> move-piece piece-valid? ;
+
+: tetris-move ( tetris move -- ? )
+    #! moves the piece if possible, returns whether the piece was moved
+    2dup can-move? [
+        >r tetris-current-piece r> move-piece t
+    ] [
+        2drop f
+    ] if ;
+
+: move-left ( tetris -- ) { -1 0 } tetris-move drop ;
+
+: move-right ( tetris -- ) { 1 0 } tetris-move drop ;
+
+: move-down ( tetris -- )
+    dup { 0 1 } tetris-move [ drop ] [ lock-piece ] if ;
+
+: move-drop ( tetris -- )
+    dup { 0 1 } tetris-move [ move-drop ] [ lock-piece ] if ;
+
+: update ( tetris -- )
+    millis over tetris-last-update -
+    over tetris-update-interval > [
+        dup move-down
+        millis swap set-tetris-last-update
+    ] [ drop ] if ;
+
+: maybe-update ( tetris -- )
+    dup tetris-paused? over tetris-running? not or [ drop ] [ update ] if ;
diff --git a/extra/tetris/gl/gl.factor b/extra/tetris/gl/gl.factor
new file mode 100644 (file)
index 0000000..e425c47
--- /dev/null
@@ -0,0 +1,47 @@
+! Copyright (C) 2006, 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences arrays math math.vectors namespaces
+opengl opengl.gl ui.render ui.gadgets tetris.game tetris.board
+tetris.piece tetris.tetromino ;
+IN: tetris.gl
+
+#! OpenGL rendering for tetris
+
+: draw-block ( block -- )
+    dup { 1 1 } v+ gl-fill-rect ;
+
+: draw-piece-blocks ( piece -- )
+    piece-blocks [ draw-block ] each ;
+
+: draw-piece ( piece -- )
+    dup tetromino-colour gl-color draw-piece-blocks ;
+
+: draw-next-piece ( piece -- )
+    dup tetromino-colour clone 0.2 3 pick set-nth gl-color draw-piece-blocks ;
+
+! TODO: move implementation specific stuff into tetris-board
+: (draw-row) ( x y row -- )
+    >r over r> nth dup
+    [ gl-color 2array draw-block ] [ 3drop ] if ;
+
+: draw-row ( y row -- )
+    dup length -rot [ (draw-row) ] 2curry each ;
+
+: draw-board ( board -- )
+    board-rows dup length swap
+    [ dupd nth draw-row ] curry each ;
+
+: scale-tetris ( width height tetris -- )
+    [ board-width swap ] keep board-height / -rot / swap 1 glScalef ;
+
+: (draw-tetris) ( width height tetris -- )
+    #! width and height are in pixels
+    GL_MODELVIEW [
+        [ scale-tetris ] keep
+        dup tetris-board draw-board
+        dup tetris-next-piece draw-next-piece
+        tetris-current-piece draw-piece
+    ] do-matrix ;
+
+: draw-tetris ( width height tetris -- )
+    origin get [ (draw-tetris) ] with-translation ;
diff --git a/extra/tetris/piece/piece-tests.factor b/extra/tetris/piece/piece-tests.factor
new file mode 100644 (file)
index 0000000..d4d19fe
--- /dev/null
@@ -0,0 +1,23 @@
+USING: kernel tetris.tetromino tetris.piece tools.test sequences arrays namespaces ;
+
+! Tests for tetris.tetromino and tetris.piece, since there's not much to test in tetris.tetromino
+
+! these two tests rely on the first rotation of the first tetromino being the
+! 'I' tetromino in its vertical orientation.
+[ 4 ] [ tetrominoes get first tetromino-states first blocks-width ] unit-test
+[ 1 ] [ tetrominoes get first tetromino-states first blocks-height ] unit-test
+
+[ { 0 0 } ] [ random-tetromino <piece> piece-location ] unit-test
+[ 0 ] [ 10 <random-piece> piece-rotation ] unit-test
+
+[ { { 0 0 } { 1 0 } { 2 0 } { 3 0 } } ]
+[ tetrominoes get first <piece> piece-blocks ] unit-test
+
+[ { { 0 0 } { 0 1 } { 0 2 } { 0 3 } } ]
+[ tetrominoes get first <piece> dup 1 rotate-piece piece-blocks ] unit-test
+
+[ { { 1 1 } { 2 1 } { 3 1 } { 4 1 } } ]
+[ tetrominoes get first <piece> dup { 1 1 } move-piece piece-blocks ] unit-test
+
+[ 3 ] [ tetrominoes get second <piece> piece-width ] unit-test
+[ 2 ] [ tetrominoes get second <piece> dup 1 rotate-piece piece-width ] unit-test
diff --git a/extra/tetris/piece/piece.factor b/extra/tetris/piece/piece.factor
new file mode 100644 (file)
index 0000000..981b509
--- /dev/null
@@ -0,0 +1,47 @@
+! Copyright (C) 2006, 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel arrays tetris.tetromino math math.vectors 
+sequences quotations lazy-lists ;
+IN: tetris.piece
+
+#! A piece adds state to the tetromino that is the piece's delegate. The
+#! rotation is an index into the tetromino's states array, and the position is
+#! added to the tetromino's blocks to give them their location on the tetris
+#! board. If the location is f then the piece is not yet on the board.
+TUPLE: piece rotation location ;
+
+: <piece> ( tetromino -- piece )
+    piece construct-delegate
+    0 over set-piece-rotation
+    { 0 0 } over set-piece-location ;
+
+: (piece-blocks) ( piece -- blocks )
+    #! rotates the tetromino
+    dup piece-rotation swap tetromino-states nth ;
+
+: piece-blocks ( piece -- blocks )
+    #! rotates and positions the tetromino
+    dup (piece-blocks) swap piece-location [ v+ ] curry map ;
+
+: piece-width ( piece -- width )
+    piece-blocks blocks-width ;
+
+: set-start-location ( piece board-width -- )
+    2 /i over piece-width 2 /i - 0 2array swap set-piece-location ;
+
+: <random-piece> ( board-width -- piece )
+    random-tetromino <piece> [ swap set-start-location ] keep ;
+
+: <piece-llist> ( board-width -- llist )
+    [ [ <random-piece> ] curry ] keep [ <piece-llist> ] curry lazy-cons ;
+
+: modulo ( n m -- n )
+  #! -2 7 mod => -2, -2 7 modulo =>  5
+  tuck mod over + swap mod ;
+
+: rotate-piece ( piece inc -- )
+    over piece-rotation + over tetromino-states length modulo swap set-piece-rotation ;
+
+: move-piece ( piece move -- )
+    over piece-location v+ swap set-piece-location ;
+
diff --git a/extra/tetris/summary.txt b/extra/tetris/summary.txt
new file mode 100644 (file)
index 0000000..9352d40
--- /dev/null
@@ -0,0 +1 @@
+Graphical Tetris game
diff --git a/extra/tetris/tags.txt b/extra/tetris/tags.txt
new file mode 100644 (file)
index 0000000..8ae5957
--- /dev/null
@@ -0,0 +1,2 @@
+applications
+games
diff --git a/extra/tetris/tetris.factor b/extra/tetris/tetris.factor
new file mode 100644 (file)
index 0000000..78f3f8f
--- /dev/null
@@ -0,0 +1,59 @@
+! Copyright (C) 2006, 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel ui.gadgets ui.gadgets.labels ui.gadgets.worlds
+ui.gadgets.status-bar ui.gestures ui.render ui tetris.game
+tetris.gl sequences arrays math math.parser namespaces timers ;
+IN: tetris
+
+TUPLE: tetris-gadget tetris ;
+
+: <tetris-gadget> ( tetris -- gadget )
+    tetris-gadget construct-gadget
+    [ set-tetris-gadget-tetris ] keep ;
+
+M: tetris-gadget pref-dim* drop { 200 400 } ;
+
+: update-status ( gadget -- )
+    dup tetris-gadget-tetris [
+        "Level: " % dup tetris-level #
+        " Score: " % tetris-score #
+    ] "" make swap show-status ;
+
+M: tetris-gadget draw-gadget* ( gadget -- )
+    [
+        dup rect-dim dup first swap second rot tetris-gadget-tetris draw-tetris
+    ] keep update-status ;
+
+: new-tetris ( gadget -- )
+    dup tetris-gadget-tetris <new-tetris> swap set-tetris-gadget-tetris ;
+
+tetris-gadget H{
+    { T{ key-down f f "UP" }     [ tetris-gadget-tetris rotate-right ] }
+    { T{ key-down f f "d" }      [ tetris-gadget-tetris rotate-left ] }
+    { T{ key-down f f "f" }      [ tetris-gadget-tetris rotate-right ] }
+    { T{ key-down f f "e" }      [ tetris-gadget-tetris rotate-left ] } ! dvorak d
+    { T{ key-down f f "u" }      [ tetris-gadget-tetris rotate-right ] } ! dvorak f
+    { T{ key-down f f "LEFT" }   [ tetris-gadget-tetris move-left ] }
+    { T{ key-down f f "RIGHT" }  [ tetris-gadget-tetris move-right ] }
+    { T{ key-down f f "DOWN" }   [ tetris-gadget-tetris move-down ] }
+    { T{ key-down f f " " }      [ tetris-gadget-tetris move-drop ] }
+    { T{ key-down f f "p" }      [ tetris-gadget-tetris toggle-pause ] }
+    { T{ key-down f f "n" }      [ new-tetris ] }
+} set-gestures
+
+M: tetris-gadget tick ( object -- )
+    dup tetris-gadget-tetris maybe-update relayout-1 ;
+
+M: tetris-gadget graft* ( gadget -- )
+    100 1 add-timer ;
+
+M: tetris-gadget ungraft* ( gadget -- )
+    remove-timer ;
+
+: tetris-window ( -- ) 
+    [
+        <default-tetris> <tetris-gadget>
+        "Tetris" open-status-window
+    ] with-ui ;
+
+MAIN: tetris-window
diff --git a/extra/tetris/tetromino/tetromino.factor b/extra/tetris/tetromino/tetromino.factor
new file mode 100644 (file)
index 0000000..957f808
--- /dev/null
@@ -0,0 +1,114 @@
+! Copyright (C) 2006, 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel arrays namespaces sequences math math.vectors
+colors random ;
+IN: tetris.tetromino
+
+TUPLE: tetromino states colour ;
+
+C: <tetromino> tetromino
+
+SYMBOL: tetrominoes
+
+{
+  [
+    { {
+        { 0 0 } { 1 0 } { 2 0 } { 3 0 }
+      } 
+      { { 0 0 }
+        { 0 1 }
+        { 0 2 }
+        { 0 3 }
+      }
+    } cyan
+  ] [
+    {
+      {         { 1 0 }
+        { 0 1 } { 1 1 } { 2 1 }
+      } {
+        { 0 0 }
+        { 0 1 } { 1 1 }
+        { 0 2 }
+      } {
+        { 0 0 } { 1 0 } { 2 0 }
+                { 1 1 }
+      } {
+                { 1 0 }
+        { 0 1 } { 1 1 }
+                { 1 2 }
+      }
+    } purple
+  ] [
+    { { { 0 0 } { 1 0 }
+        { 0 1 } { 1 1 } }
+    } yellow
+  ] [
+    {
+      { { 0 0 } { 1 0 } { 2 0 }
+        { 0 1 }
+      } {
+        { 0 0 } { 1 0 }
+                { 1 1 }
+                { 1 2 }
+      } {
+                        { 2 0 }
+        { 0 1 } { 1 1 } { 2 1 }
+      } {
+        { 0 0 }
+        { 0 1 }
+        { 0 2 } { 1 2 }
+      }
+    } orange
+  ] [
+    { 
+      { { 0 0 } { 1 0 } { 2 0 }
+                        { 2 1 }
+      } {
+                { 1 0 }
+                { 1 1 }
+        { 0 2 } { 1 2 }
+      } {
+        { 0 0 }
+        { 0 1 } { 1 1 } { 2 1 }
+      } {
+        { 0 0 } { 1 0 }
+        { 0 1 }
+        { 0 2 }
+      }
+    } blue
+  ] [
+    {
+      {          { 1 0 } { 2 0 }
+        { 0 1 } { 1 1 }
+      } {
+        { 0 0 }
+        { 0 1 } { 1 1 }
+                { 1 2 }
+      }
+    } green
+  ] [
+    {
+      {
+        { 0 0 } { 1 0 }
+                { 1 1 } { 2 1 }
+      } {
+                { 1 0 }
+        { 0 1 } { 1 1 }
+        { 0 2 }
+      }
+    } red
+  ]
+} [ call <tetromino> ] map tetrominoes set-global
+
+: random-tetromino ( -- tetromino )
+    tetrominoes get random ;
+
+: blocks-max ( blocks quot -- max )
+    map [ 1+ ] map supremum ; inline
+
+: blocks-width ( blocks -- width )
+    [ first ] blocks-max ;
+
+: blocks-height ( blocks -- height )
+    [ second ] blocks-max ;
+
diff --git a/extra/timers/authors.txt b/extra/timers/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/timers/summary.txt b/extra/timers/summary.txt
new file mode 100644 (file)
index 0000000..2b0c0b0
--- /dev/null
@@ -0,0 +1 @@
+Simple low-resolution timers
diff --git a/extra/timers/timers-docs.factor b/extra/timers/timers-docs.factor
new file mode 100644 (file)
index 0000000..05a5251
--- /dev/null
@@ -0,0 +1,36 @@
+USING: help.syntax help.markup classes kernel ;
+IN: timers
+
+HELP: init-timers
+{ $description "Initializes the timer code." }
+{ $notes "This word is automatically called when the UI is initialized, and it should only be called manually if timers are being used outside of the UI." } ;
+
+HELP: tick
+{ $values { "object" object } }
+{ $description "Called to notify an object registered with a timer that the timer has fired." } ;
+
+HELP: add-timer
+{ $values { "object" object } { "delay" "a positive integer" } { "initial" "a positive integer" } }
+{ $description "Registers a timer. Every " { $snippet "delay" } " milliseconds, " { $link tick } " will be called on the object. The initial delay from the time " { $link add-timer } " is called to when " { $link tick } " is first called is " { $snippet "initial" } " milliseconds." } ;
+
+HELP: remove-timer
+{ $values { "object" object } }
+{ $description "Unregisters a timer." } ;
+
+HELP: do-timers
+{ $description "Fires all registered timers which are due to fire." }
+{ $notes "This word is automatically called from the UI event loop, and it should only be called manually if timers are being used outside of the UI." } ;
+
+{ init-timers add-timer remove-timer tick do-timers } related-words
+
+ARTICLE: "timers" "Timers"
+"Timers can be added and removed:"
+{ $subsection add-timer }
+{ $subsection remove-timer }
+"Classes must implement a generic word so that their instances can handle timer ticks:"
+{ $subsection tick }
+"Timers can be used outside of the UI, however they must be initialized with an explicit call, and fired manually:"
+{ $subsection init-timers }
+{ $subsection do-timers } ;
+
+ABOUT: "timers"
diff --git a/extra/timers/timers.factor b/extra/timers/timers.factor
new file mode 100644 (file)
index 0000000..f685b12
--- /dev/null
@@ -0,0 +1,30 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs kernel math namespaces sequences system ;
+IN: timers
+
+TUPLE: timer object delay next ;
+
+: <timer> ( object delay initial -- timer )
+    millis + timer construct-boa ;
+
+GENERIC: tick ( object -- )
+
+: timers \ timers get-global ;
+
+: init-timers ( -- ) H{ } clone \ timers set-global ;
+
+: add-timer ( object delay initial -- )
+    pick >r <timer> r> timers set-at ;
+
+: remove-timer ( object -- ) timers delete-at ;
+
+: advance-timer ( ms timer -- )
+    [ timer-delay + ] keep set-timer-next ;
+
+: do-timer ( ms timer -- )
+    dup timer-next pick <=
+    [ [ advance-timer ] keep timer-object tick ] [ 2drop ] if ;
+
+: do-timers ( -- )
+    millis timers values [ do-timer ] curry* each ;
diff --git a/extra/tools/annotations/annotations-docs.factor b/extra/tools/annotations/annotations-docs.factor
new file mode 100644 (file)
index 0000000..e967284
--- /dev/null
@@ -0,0 +1,29 @@
+USING: help.markup help.syntax words parser ;
+IN: tools.annotations
+
+ARTICLE: "tools.annotations" "Word annotations"
+"The word annotation feature modifies word definitions to add debugging code. You can restore the old definition by calling " { $link reload } " on the word in question."
+{ $subsection watch }
+{ $subsection breakpoint }
+{ $subsection breakpoint-if }
+"All of the above words are implemented using a single combinator which applies a quotation to a word definition to yield a new definition:"
+{ $subsection annotate } ;
+
+ABOUT: "tools.annotations"
+
+HELP: annotate
+{ $values { "word" "a word" } { "quot" "a quotation with stack effect " { $snippet "( word def -- def )" } } }
+{ $description "Changes a word definition to the result of applying a quotation to the old definition." }
+{ $notes "This word is used to implement " { $link watch } "." } ;
+
+HELP: watch
+{ $values { "word" word } }
+{ $description "Annotates a word definition to print the data stack on entry and exit." } ;
+
+HELP: breakpoint
+{ $values { "word" word } }
+{ $description "Annotates a word definition to enter the single stepper when executed." } ;
+
+HELP: breakpoint-if
+{ $values { "quot" "a quotation with stack effect" { $snippet "( -- ? )" } } { "word" word } }
+{ $description "Annotates a word definition to enter the single stepper if the quotation yields true." } ;
diff --git a/extra/tools/annotations/annotations-tests.factor b/extra/tools/annotations/annotations-tests.factor
new file mode 100644 (file)
index 0000000..f1ffdd2
--- /dev/null
@@ -0,0 +1,7 @@
+USING: tools.test tools.annotations ;
+IN: temporary
+
+: foo ;
+\ foo watch
+
+[ ] [ foo ] unit-test
diff --git a/extra/tools/annotations/annotations.factor b/extra/tools/annotations/annotations.factor
new file mode 100644 (file)
index 0000000..dd8941f
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel words parser io inspector quotations sequences
+prettyprint tools.interpreter ;
+IN: tools.annotations
+
+: annotate ( word quot -- )
+    over >r >r word-def r> call r>
+    swap define-compound do-parse-hook ;
+    inline
+
+: entering ( str -- ) "! Entering: " write print .s flush ;
+
+: leaving ( str -- ) "! Leaving: " write print .s flush ;
+
+: (watch) ( str def -- def )
+    over [ entering ] curry
+    rot [ leaving ] curry
+    swapd 3append ;
+
+: watch ( word -- )
+    dup word-name swap [ (watch) ] annotate ;
+
+: breakpoint ( word -- )
+    [ \ break add* ] annotate ;
+
+: breakpoint-if ( quot word -- )
+    [ [ [ break ] when ] swap 3append ] annotate ;
diff --git a/extra/tools/annotations/authors.txt b/extra/tools/annotations/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/annotations/summary.txt b/extra/tools/annotations/summary.txt
new file mode 100644 (file)
index 0000000..9b4498f
--- /dev/null
@@ -0,0 +1 @@
+Support for breakpoints and watchpoints on words
diff --git a/extra/tools/annotations/tags.txt b/extra/tools/annotations/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/browser/browser-docs.factor b/extra/tools/browser/browser-docs.factor
new file mode 100644 (file)
index 0000000..61ad58f
--- /dev/null
@@ -0,0 +1,30 @@
+USING: help.markup help.syntax io strings ;
+IN: tools.browser
+
+ARTICLE: "tools.browser" "Vocabulary browser"
+"Getting and setting vocabulary meta-data:"
+{ $subsection vocab-summary }
+{ $subsection set-vocab-summary }
+{ $subsection vocab-tags }
+{ $subsection set-vocab-tags }
+{ $subsection add-vocab-tags } ;
+
+HELP: vocab-summary
+{ $values { "vocab" "a vocabulary specifier" } { "summary" "a string or " { $link f } } }
+{ $description "Outputs a one-line string description of the vocabulary's intended purpose from the " { $snippet "summary.txt" } " file in the vocabulary's directory. Outputs " { $link f } " if the file does not exist." } ;
+
+HELP: set-vocab-summary
+{ $values { "string" "a string or " { $link f } } { "vocab" "a vocabulary specifier" } }
+{ $description "Stores a one-line string description of the vocabulary to the " { $snippet "summary.txt" } " file in the vocabulary's directory." } ;
+
+HELP: vocab-tags
+{ $values { "vocab" "a vocabulary specifier" } { "tags" "a sequence of strings" } }
+{ $description "Outputs a list of short tags classifying the vocabulary from the " { $snippet "tags.txt" } " file in the vocabulary's directory. Outputs " { $link f } " if the file does not exist." } ;
+
+HELP: set-vocab-tags
+{ $values { "tags" "a sequence of strings" } { "vocab" "a vocabulary specifier" } }
+{ $description "Stores a list of short tags classifying the vocabulary to the " { $snippet "tags.txt" } " file in the vocabulary's directory." } ;
+
+HELP: all-vocabs
+{ $values { "assoc" "an association list mapping vocabulary roots to sequences of vocabulary specifiers" } }
+{ $description "Outputs an association list of all vocabularies which have been loaded or are available for loading." } ;
diff --git a/extra/tools/browser/browser-tests.factor b/extra/tools/browser/browser-tests.factor
new file mode 100644 (file)
index 0000000..4b3f1d5
--- /dev/null
@@ -0,0 +1,6 @@
+IN: temporary
+USING: tools.browser tools.test help.markup ;
+
+[ t ] [ "resource:core" "kernel" vocab-dir? ] unit-test
+
+[ ] [ { $describe-vocab "scratchpad" } print-content ] unit-test
diff --git a/extra/tools/browser/browser.factor b/extra/tools/browser/browser.factor
new file mode 100644 (file)
index 0000000..5342022
--- /dev/null
@@ -0,0 +1,345 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces splitting sequences io.files kernel assocs
+words vocabs vocabs.loader definitions parser continuations
+inspector debugger io io.styles io.streams.lines hashtables
+sorting prettyprint source-files arrays combinators strings
+system math.parser help.markup help.topics help.syntax
+help.stylesheet ;
+IN: tools.browser
+
+: vocab-summary-path ( vocab -- string )
+    vocab-dir "summary.txt" path+ ;
+
+: vocab-summary ( vocab -- summary )
+    dup dup vocab-summary-path vocab-file-contents
+    dup empty? [
+        drop vocab-name " vocabulary" append
+    ] [
+        nip first
+    ] if ;
+
+M: vocab summary
+    [
+        dup vocab-summary %
+        " (" %
+        vocab-words assoc-size #
+        " words)" %
+    ] "" make ;
+
+M: vocab-link summary vocab-summary ;
+
+: set-vocab-summary ( string vocab -- )
+    >r 1array r>
+    dup vocab-summary-path
+    set-vocab-file-contents ;
+
+: vocab-tags-path ( vocab -- string )
+    vocab-dir "tags.txt" path+ ;
+
+: vocab-tags ( vocab -- tags )
+    dup vocab-tags-path vocab-file-contents ;
+
+: set-vocab-tags ( tags vocab -- )
+    dup vocab-tags-path set-vocab-file-contents ;
+
+: add-vocab-tags ( tags vocab -- )
+    [ vocab-tags append prune ] keep set-vocab-tags ;
+
+: vocab-authors-path ( vocab -- string )
+    vocab-dir "authors.txt" path+ ;
+
+: vocab-authors ( vocab -- authors )
+    dup vocab-authors-path vocab-file-contents ;
+
+: set-vocab-authors ( authors vocab -- )
+    dup vocab-authors-path set-vocab-file-contents ;
+
+: vocab-dir? ( root name -- ? )
+    over [
+        vocab-source path+ ?resource-path exists?
+    ] [
+        2drop f
+    ] if ;
+
+: subdirs ( dir -- dirs )
+    directory [ second ] subset keys natural-sort ;
+
+: (all-child-vocabs) ( root name -- vocabs )
+    [ vocab-dir path+ ?resource-path subdirs ] keep
+    dup empty? [
+        drop
+    ] [
+        swap [ "." swap 3append ] curry* map
+    ] if ;
+
+: vocabs-in-dir ( root name -- )
+    dupd (all-child-vocabs) [
+        2dup vocab-dir? [ 2dup swap >vocab-link , ] when
+        vocabs-in-dir
+    ] curry* each ;
+
+: sane-vocab-roots "." vocab-roots get remove ;
+
+: all-vocabs ( -- assoc )
+    sane-vocab-roots [
+        dup [ "" vocabs-in-dir ] { } make
+    ] { } map>assoc ;
+
+: all-vocabs-seq ( -- seq )
+    all-vocabs values concat ;
+
+: dangerous? ( name -- ? )
+    #! Hack
+    {
+        { [ "cpu." ?head ] [ t ] }
+        { [ "io.unix" ?head ] [ t ] }
+        { [ "io.windows" ?head ] [ t ] }
+        { [ "ui.x11" ?head ] [ t ] }
+        { [ "ui.windows" ?head ] [ t ] }
+        { [ "ui.cocoa" ?head ] [ t ] }
+        { [ "cocoa" ?head ] [ t ] }
+        { [ "vocabs.loader.test" ?head ] [ t ] }
+        { [ "editors." ?head ] [ t ] }
+        { [ ".windows" ?tail ] [ t ] }
+        { [ ".unix" ?tail ] [ t ] }
+        { [ "unix." ?head ] [ t ] }
+        { [ ".linux" ?tail ] [ t ] }
+        { [ ".bsd" ?tail ] [ t ] }
+        { [ ".macosx" ?tail ] [ t ] }
+        { [ "windows." ?head ] [ t ] }
+        { [ "cocoa" ?head ] [ t ] }
+        { [ ".test" ?tail ] [ t ] }
+        { [ dup "tools.deploy.app" = ] [ t ] }
+        { [ t ] [ f ] }
+    } cond nip ;
+
+: load-everything ( -- )
+    all-vocabs-seq
+    [ vocab-name dangerous? not ] subset
+    [ [ require ] each ] no-parse-hook ;
+
+: unrooted-child-vocabs ( prefix -- seq )
+    dup empty? [ CHAR: . add ] unless
+    vocabs
+    [ vocab-root not ] subset
+    [
+        vocab-name swap ?head CHAR: . rot member? not and
+    ] curry* subset
+    [ vocab ] map ;
+
+: all-child-vocabs ( prefix -- assoc )
+    sane-vocab-roots [
+        dup pick dupd (all-child-vocabs)
+        [ swap >vocab-link ] curry* map
+    ] { } map>assoc
+    f rot unrooted-child-vocabs 2array add ;
+
+: load-children ( prefix -- )
+    all-child-vocabs values concat
+    [ [ require ] each ] no-parse-hook ;
+
+: vocab-status-string ( vocab -- string )
+    {
+        { [ dup not ] [ drop "" ] }
+        { [ dup vocab-main ] [ drop "[Runnable]" ] }
+        { [ t ] [ drop "[Loaded]" ] }
+    } cond ;
+
+: write-status ( vocab -- )
+    vocab vocab-status-string write ;
+
+: vocab. ( vocab -- )
+    [
+        dup [ write-status ] with-cell
+        dup [ ($link) ] with-cell
+        [ vocab-summary write ] with-cell
+    ] with-row ;
+
+: vocab-headings. ( -- )
+    [
+        [ "State" write ] with-cell
+        [ "Vocabulary" write ] with-cell
+        [ "Summary" write ] with-cell
+    ] with-row ;
+
+: root-heading. ( root -- )
+    [ "Children from " swap append ] [ "Children" ] if*
+    $heading ;
+
+: vocabs. ( assoc -- )
+    [
+        dup empty? [
+            2drop
+        ] [
+            swap root-heading.
+            standard-table-style [
+                vocab-headings. [ vocab. ] each
+            ] ($grid)
+        ] if
+    ] assoc-each ;
+
+: describe-summary ( vocab -- )
+    vocab-summary [
+        "Summary" $heading print-element
+    ] when* ;
+
+TUPLE: vocab-tag name ;
+
+C: <vocab-tag> vocab-tag
+
+: tags. ( seq -- ) [ <vocab-tag> ] map $links ;
+
+: describe-tags ( vocab -- )
+    vocab-tags f like [
+        "Tags" $heading tags.
+    ] when* ;
+
+TUPLE: vocab-author name ;
+
+C: <vocab-author> vocab-author
+
+: authors. ( seq -- ) [ <vocab-author> ] map $links ;
+
+: describe-authors ( vocab -- )
+    vocab-authors f like [
+        "Authors" $heading authors.
+    ] when* ;
+
+: describe-help ( vocab -- )
+    vocab-help [
+        "Documentation" $heading nl ($link)
+    ] when* ;
+
+: describe-children ( vocab -- )
+    vocab-name all-child-vocabs vocabs. ;
+
+: describe-files ( vocab -- )
+    vocab-files [ <pathname> ] map [
+        "Files" $heading
+        [
+            snippet-style get [
+                code-style get [
+                    stack.
+                ] with-nesting
+            ] with-style
+        ] ($block)
+    ] when* ;
+
+: describe-words ( vocab -- )
+    words dup empty? [
+        "Words" $heading
+        dup natural-sort $links
+    ] unless drop ;
+
+: map>set ( seq quot -- )
+    map concat prune natural-sort ; inline
+
+: vocab-xref ( vocab quot -- vocabs )
+    >r dup vocab-name swap words r> map
+    [ [ word? ] subset [ word-vocabulary ] map ] map>set
+    remove [ vocab ] map ; inline
+
+: vocab-uses ( vocab -- vocabs ) [ uses ] vocab-xref ;
+
+: vocab-usage ( vocab -- vocabs ) [ usage ] vocab-xref ;
+
+: describe-uses ( vocab -- )
+    vocab-uses dup empty? [
+        "Uses" $heading
+        dup $links
+    ] unless drop ;
+
+: describe-usage ( vocab -- )
+    vocab-usage dup empty? [
+        "Used by" $heading
+        dup $links
+    ] unless drop ;
+
+: $describe-vocab ( element -- )
+    first
+    dup describe-children
+    dup vocab-root over vocab-dir? [
+        dup describe-summary
+        dup describe-tags
+        dup describe-authors
+        dup describe-files
+    ] when
+    dup vocab [
+        dup describe-help
+        dup describe-words
+        dup describe-uses
+        dup describe-usage
+    ] when drop ;
+
+: keyed-vocabs ( str quot -- seq )
+    all-vocabs [
+        swap >r
+        [ >r 2dup r> swap call member? ] subset
+        r> swap
+    ] assoc-map 2nip ; inline
+
+: tagged ( tag -- assoc )
+    [ vocab-tags ] keyed-vocabs ;
+
+: authored ( author -- assoc )
+    [ vocab-authors ] keyed-vocabs ;
+
+: $tagged-vocabs ( element -- )
+    first tagged vocabs. ;
+
+: all-tags ( vocabs -- seq ) [ vocab-tags ] map>set ;
+
+: $authored-vocabs ( element -- )
+    first authored vocabs. ;
+
+: all-authors ( vocabs -- seq ) [ vocab-authors ] map>set ;
+
+: $tags,authors ( element -- )
+    drop
+    all-vocabs-seq
+    "Tags" $heading
+    dup all-tags tags.
+    "Authors" $heading
+    all-authors authors. ;
+
+ARTICLE: "vocab-index" "Vocabulary index"
+{ $tags,authors }
+{ $describe-vocab "" } ;
+
+M: vocab-spec article-title vocab-name " vocabulary" append ;
+
+M: vocab-spec article-name vocab-name ;
+
+M: vocab-spec article-content
+    vocab-name \ $describe-vocab swap 2array ;
+
+M: vocab-spec article-parent drop "vocab-index" ;
+
+M: vocab-tag >link ;
+
+M: vocab-tag article-title
+    vocab-tag-name "Vocabularies tagged ``" swap "''" 3append ;
+
+M: vocab-tag article-name vocab-tag-name ;
+
+M: vocab-tag article-content
+    \ $tagged-vocabs swap vocab-tag-name 2array ;
+
+M: vocab-tag article-parent drop "vocab-index" ;
+
+M: vocab-tag summary article-title ;
+
+M: vocab-author >link ;
+
+M: vocab-author article-title
+    vocab-author-name "Vocabularies by " swap append ;
+
+M: vocab-author article-name vocab-author-name ;
+
+M: vocab-author article-content
+    \ $authored-vocabs swap vocab-author-name 2array ;
+
+M: vocab-author article-parent drop "vocab-index" ;
+
+M: vocab-author summary article-title ;
diff --git a/extra/tools/browser/tags.txt b/extra/tools/browser/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/completion/authors.txt b/extra/tools/completion/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/completion/completion-docs.factor b/extra/tools/completion/completion-docs.factor
new file mode 100644 (file)
index 0000000..7683ef1
--- /dev/null
@@ -0,0 +1,53 @@
+USING: help.markup help.syntax strings generic vectors assocs
+math ;
+IN: tools.completion
+
+ARTICLE: "tools.completion" "Fuzzy completion"
+"Various developer tools make use of a general-purpose fuzzy completion algorithm."
+$nl
+"The main entry point:"
+{ $subsection completions }
+"The words used to implement the algorithm can be called as well, for finer control over fuzzy matching:"
+{ $subsection fuzzy }
+{ $subsection runs }
+{ $subsection score }
+{ $subsection complete }
+{ $subsection rank-completions } ;
+
+ABOUT: "tools.completion"
+
+HELP: fuzzy
+{ $values { "full" string } { "short" string } { "indices" vector } }
+{ $description "If " { $snippet "short" } " can be obtained from " { $snippet "full" } " by removing subsequences, then outputs the index of every character from " { $snippet "short" } " in " { $snippet "full" } ", otherwise outputs " { $link f } "." } ;
+
+HELP: runs
+{ $values { "seq" "a sequence of integers" } { "newseq" "a sequence of sequences of integers" } }
+{ $description "Groups subsequences of consecutive integers." }
+{ $examples
+    { $example "USE: tools.completion" "{ 1 2 3 5 6 9 10 } runs ." "V{ V{ 1 2 3 } V{ 5 6 } V{ 9 10 } }" }
+} ;
+
+HELP: score
+{ $values { "full" string } { "fuzzy" "a sequence of sequences of integers" } { "n" integer } }
+{ $description "Ranks " { $snippet "fuzzy" } " by how closely it approximates the sequence " { $snippet "{ { 0 ... n-1 } }" } " where " { $snippet "n" } " is the length of " { $snippet "full" } "." } ;
+
+HELP: rank-completions
+{ $values { "results" "an alist" } { "newresults" "an alist" } }
+{ $description "Sorts " { $snippet "results" } " by the first element of each pair, and discards the low 33% of the results." } ;
+
+HELP: complete
+{ $values { "full" string } { "short" string } { "score" "a rational number between 0 and 1" } }
+{ $description "Ranks how close " { $snippet "short" } " is to " { $snippet "full" } " by edit distance." } ;
+
+HELP: completion
+{ $values { "short" string } { "candidate" "a pair " { $snippet "{ obj full }" } } { "result" "a pair " { $snippet "{ score obj }" } } }
+{ $description "Outputs a pair of two elements:"
+    { $list
+        { "how close " { $snippet "short" } " is to " { $snippet "full" } " by edit distance" }
+        { "the original value of " { $snippet "obj" } }
+    }
+} ;
+
+HELP: completions
+{ $values { "short" string } { "candidates" "a sequence of pairs of the shape " { $snippet "{ obj full }" } } { "seq" "a sequence of pairs of the shape " { $snippet "{ score obj }" } } }
+{ $description "Calls " { $link completion } " to produce a sequence of " { $snippet "{ score obj }" } " pairs, then calls " { $link rank-completions } " to sort them and discard the low 33%." } ;
diff --git a/extra/tools/completion/completion.factor b/extra/tools/completion/completion.factor
new file mode 100644 (file)
index 0000000..caa2eb4
--- /dev/null
@@ -0,0 +1,76 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: tools.completion
+USING: kernel arrays sequences math namespaces strings io
+vectors words assocs combinators sorting ;
+
+: (fuzzy) ( accum ch i full -- accum i ? )
+    index* 
+    [
+        [ swap push ] 2keep 1+ t
+    ] [
+        drop f -1 f
+    ] if* ;
+
+: fuzzy ( full short -- indices )
+    dup length <vector> -rot 0 -rot
+    [ -rot [ (fuzzy) ] keep swap ] all? 3drop ;
+
+: (runs) ( runs n seq -- runs n )
+    [
+        [
+            2dup number=
+            [ drop ] [ nip V{ } clone pick push ] if
+            1+
+        ] keep pick peek push
+    ] each ;
+
+: runs ( seq -- newseq )
+    V{ V{ } } [ clone ] map over first rot (runs) drop ;
+
+: score-1 ( i full -- n )
+    {
+        { [ over zero? ] [ 2drop 10 ] }
+        { [ 2dup length 1- number= ] [ 2drop 4 ] }
+        { [ 2dup >r 1- r> nth Letter? not ] [ 2drop 10 ] }
+        { [ 2dup >r 1+ r> nth Letter? not ] [ 2drop 4 ] }
+        { [ t ] [ 2drop 1 ] }
+    } cond ;
+
+: score ( full fuzzy -- n )
+    dup [
+        [ [ length ] 2apply - 15 swap [-] 3 / ] 2keep
+        runs [
+            [ 0 [ pick score-1 max ] reduce nip ] keep
+            length * +
+        ] curry* each
+    ] [
+        2drop 0
+    ] if ;
+
+: rank-completions ( results -- newresults )
+    sort-keys <reversed>
+    [ 0 [ first max ] reduce 3 / ] keep
+    [ first < ] curry* subset
+    [ second ] map ;
+
+: complete ( full short -- score )
+    [ dupd fuzzy score ] 2keep
+    [ <reversed> ] 2apply
+    dupd fuzzy score max ;
+
+: completion ( short candidate -- result )
+    [ second swap complete ] keep first 2array ;
+
+: completions ( short candidates -- seq )
+    over empty? [
+        nip [ first ] map
+    ] [
+        >r >lower r> [ completion ] curry* map rank-completions
+    ] if ;
+
+: string-completions ( short strs -- seq )
+    [ dup ] { } map>assoc completions ;
+
+: limited-completions ( short candidates -- seq )
+    completions dup length 1000 > [ drop f ] when ;
diff --git a/extra/tools/completion/summary.txt b/extra/tools/completion/summary.txt
new file mode 100644 (file)
index 0000000..791a236
--- /dev/null
@@ -0,0 +1 @@
+Support for fuzzy search and completion of a string from a set of candidates
diff --git a/extra/tools/crossref/authors.txt b/extra/tools/crossref/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/crossref/crossref-docs.factor b/extra/tools/crossref/crossref-docs.factor
new file mode 100644 (file)
index 0000000..477ea01
--- /dev/null
@@ -0,0 +1,20 @@
+USING: help.markup help.syntax words definitions ;
+IN: tools.crossref
+
+ARTICLE: "tools.crossref" "Cross-referencing tools" 
+{ $subsection usage. }
+{ $subsection apropos }
+{ $see-also "definitions" "words" } ;
+
+ABOUT: "tools.crossref"
+
+HELP: usage.
+{ $values { "word" "a word" } }
+{ $description "Prints an list of all callers of a word. This may include the word itself, if it is recursive." }
+{ $examples { $code "\\ reverse usage." } } ;
+
+{ usage usage. } related-words
+
+HELP: apropos
+{ $values { "str" "a string" } }
+{ $description "Lists all words whose name contains a subsequence equal to " { $snippet "str" } ". Results are ranked using a simple distance algorithm." } ;
diff --git a/extra/tools/crossref/crossref-tests.factor b/extra/tools/crossref/crossref-tests.factor
new file mode 100644 (file)
index 0000000..657b5fc
--- /dev/null
@@ -0,0 +1,12 @@
+USING: math kernel sequences io.files tools.crossref tools.test
+parser namespaces source-files ;
+IN: temporary
+
+GENERIC: foo
+
+M: integer foo + ;
+
+"resource:extra/tools/test/foo.factor" run-file
+
+[ t ] [ { integer foo } \ + smart-usage member? ] unit-test
+[ t ] [ \ foo smart-usage [ pathname? ] contains? ] unit-test
diff --git a/extra/tools/crossref/crossref.factor b/extra/tools/crossref/crossref.factor
new file mode 100644 (file)
index 0000000..71f5fc9
--- /dev/null
@@ -0,0 +1,38 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions assocs io kernel
+math namespaces prettyprint sequences strings io.styles words
+generic tools.completion quotations parser inspector
+sorting hashtables vocabs ;
+IN: tools.crossref
+
+: synopsis-alist ( definitions -- alist )
+    [ dup synopsis swap ] { } map>assoc ;
+
+: definitions. ( alist -- )
+    [ write-object nl ] assoc-each ;
+
+: (method-usage) ( word generic -- methods )
+    tuck methods
+    [ second quot-uses key? ] curry* subset
+    0 <column>
+    swap [ 2array ] curry map ;
+
+: method-usage ( word seq -- methods )
+    [ generic? ] subset [ (method-usage) ] curry* map concat ;
+
+: compound-usage ( words -- seq )
+    [ generic? not ] subset ;
+
+: smart-usage ( word -- definitions )
+    \ f or
+    dup usage dup compound-usage -rot method-usage append ;
+
+: usage. ( word -- )
+    smart-usage synopsis-alist sort-keys definitions. ;
+
+: words-matching ( str -- seq )
+    all-words [ dup word-name ] { } map>assoc completions ;
+
+: apropos ( str -- )
+    words-matching synopsis-alist reverse definitions. ;
diff --git a/extra/tools/crossref/summary.txt b/extra/tools/crossref/summary.txt
new file mode 100644 (file)
index 0000000..46a3ccc
--- /dev/null
@@ -0,0 +1 @@
+Inspecting definition usages
diff --git a/extra/tools/crossref/tags.txt b/extra/tools/crossref/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/deploy/app/app.factor b/extra/tools/deploy/app/app.factor
new file mode 100644 (file)
index 0000000..df33581
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io io.files io.launcher kernel namespaces sequences
+system cocoa.plists cocoa.application tools.deploy assocs
+hashtables prettyprint ;
+IN: tools.deploy.app
+
+: mkdir ( path -- )
+    "mkdir -p \"" swap "\"" 3append run-process ;
+
+: touch ( path -- )
+    "touch \"" swap "\"" 3append run-process ;
+
+: rm ( path -- )
+    "rm -rf \"" swap "\"" 3append run-process ;
+
+: cp ( from to -- )
+    "Copying " write over write " to " write dup print
+    dup parent-dir mkdir
+    [ "cp -R \"" % swap % "\" \"" % % "\"" % ] "" make
+    run-process ;
+
+: copy-bundle-dir ( name dir -- )
+    vm parent-dir parent-dir over path+ -rot
+    >r "Contents" path+ r> path+ cp ;
+
+: copy-vm ( executable bundle-name -- vm )
+    "Contents/MacOS/" path+ swap path+ vm swap [ cp ] keep ;
+
+: copy-fonts ( name -- )
+    "fonts/" resource-path
+    swap "Contents/Resources/fonts/" path+ cp ;
+
+: print-app-plist ( executable bundle-name -- )
+    [
+        namespace {
+            { "CFBundleInfoDictionaryVersion" "6.0" }
+            { "CFBundlePackageType" "APPL" }
+        } update
+
+        file-name "CFBundleName" set
+
+        dup "CFBundleExecutable" set
+        "org.factor." swap append "CFBundleIdentifier" set
+    ] H{ } make-assoc print-plist ;
+
+: create-app-plist ( vocab bundle-name -- )
+    dup "Contents/Info.plist" path+ <file-writer>
+    [ print-app-plist ] with-stream ;
+
+: create-app-dir ( vocab bundle-name -- vm )
+    dup "Frameworks" copy-bundle-dir
+    dup "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
+    dup copy-fonts
+    2dup create-app-plist copy-vm ;
+
+: deploy.app-image ( vocab bundle-name -- str )
+    [ % "/Contents/Resources/" % % ".image" % ] "" make ;
+
+: deploy.app-config ( vocab -- assoc )
+    [ ".app" append "bundle-name" associate ] keep
+    deploy-config union ;
+
+: deploy.app ( vocab -- )
+    ".app deploy tool" assert.app
+    "." resource-path cd
+    dup deploy.app-config [
+        "bundle-name" get rm
+        [ "bundle-name" get create-app-dir ] keep
+        [ "bundle-name" get deploy.app-image ] keep
+        namespace
+    ] bind deploy* ;
diff --git a/extra/tools/deploy/app/summary.txt b/extra/tools/deploy/app/summary.txt
new file mode 100644 (file)
index 0000000..f4b162f
--- /dev/null
@@ -0,0 +1 @@
+Deploying minimal stand-alone Mac OS X application bundles
diff --git a/extra/tools/deploy/app/tags.txt b/extra/tools/deploy/app/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/deploy/authors.txt b/extra/tools/deploy/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/deploy/deploy-docs.factor b/extra/tools/deploy/deploy-docs.factor
new file mode 100644 (file)
index 0000000..1f25f68
--- /dev/null
@@ -0,0 +1,122 @@
+USING: help.markup help.syntax words alien.c-types assocs
+kernel ;
+IN: tools.deploy
+
+ARTICLE: "deploy-config" "Deployment configuration"
+"The deployment configuration is a key/value mapping stored in the " { $snippet "deploy.factor" } " file in the vocabulary's directory. If this file does not exist, the default deployment configuration is used:"
+{ $subsection default-config }
+"The deployment configuration can be read and written with a pair of words:"
+{ $subsection deploy-config }
+{ $subsection set-deploy-config }
+"A utility word is provided to load the configuration, change a flag, and store it back to disk:"
+{ $subsection set-deploy-flag } ;
+
+ARTICLE: "deploy-flags" "Deployment flags"
+"There are two types of flags. The first set controls the major subsystems which are to be included in the deployment image:"
+{ $subsection deploy-math?     }
+{ $subsection deploy-compiled? }
+{ $subsection deploy-io?       }
+{ $subsection deploy-ui?       }
+"The second set of flags controls the level of stripping to be performed on the deployment image; there is a trade-off between image size, and retaining functionality which is required by the application:"
+{ $subsection strip-globals?     }
+{ $subsection strip-word-props?  }
+{ $subsection strip-word-names?  }
+{ $subsection strip-dictionary?  }
+{ $subsection strip-debugger?    }
+{ $subsection strip-prettyprint? }
+{ $subsection strip-c-types?     } ;
+
+ARTICLE: "tools.deploy" "Stand-alone image deployment"
+"The stand-alone image deployment tool takes a vocabulary and generates an image, which when passed to the VM, runs the vocabulary's " { $link POSTPONE: MAIN: } " hook."
+$nl
+"For example, we can deploy the " { $vocab-link "hello-world" } " demo which comes with Factor:"
+{ $code "\"hello-world\" deploy" }
+"This generates an image file named " { $snippet "hello-world.image" } ". Now we can start this image from the operating system's command line (see " { $link "runtime-cli-args" } "):"
+{ $code "./factor -i=hello-world.image" "Hello world" }
+"In order to deploy an application as a stand-alone image, the application's vocabulary must first be given a " { $link POSTPONE: MAIN: } " hook. Then, a " { $emphasis "deployment configuration" } " must be created."
+{ $subsection "deploy-config" }
+{ $subsection "deploy-flags" }
+"Once the necessary deployment flags have been set, a deployment image can be generated:"
+{ $subsection deploy } ;
+
+ABOUT: "tools.deploy"
+
+HELP: strip-globals?
+{ $description "Deploy flag. If set, the deploy tool applies various heuristics to strip out un-needed variables from the global namespace."
+$nl
+"On by default. Disable this if the heuristics strip out required variables." } ;
+
+HELP: strip-word-props?
+{ $description "Deploy flag. If set, the deploy tool applies various heuristics to strip out un-needed word properties from words in the dictionary."
+$nl
+"On by default. Disable this if the heuristics strip out required word properties." } ;
+
+HELP: strip-word-names?
+{ $description "Deploy flag. If set, the deploy tool strips word names from words in the dictionary."
+$nl
+"On by default. Disable this if your program calls " { $link word-name } "." } ;
+
+HELP: strip-dictionary?
+{ $description "Deploy flag. If set, the deploy tool strips unused words."
+$nl
+"On by default. Disable this if your program calls " { $link lookup } " to look up words by name, or needs to parse code at run-time." } ;
+
+HELP: strip-debugger?
+{ $description "Deploy flag. If set, the deploy tool strips the verbose error reporting facility; any errors thrown by the program will start the low-level debugger in the VM."
+$nl
+"On by default. Disable this if you need to debug a problem which only occurs when your program is running deployed." } ;
+
+HELP: strip-prettyprint?
+{ $description "Deploy flag. If set, the deploy tool strips variables used by the prettyprinter."
+$nl
+"On by default. Disable this if your program uses the prettyprinter." } ;
+
+HELP: strip-c-types?
+{ $description "Deploy flag. If set, the deploy tool strips out the " { $link c-types } " table."
+$nl
+"On by default. Disable this if your program calls " { $link c-type } ", " { $link heap-size } ", " { $link <c-object> } ", " { $link <c-array> } ", " { $link malloc-object } ", or " { $link malloc-array } " with a C type name which is not a literal pushed directly at the call site. In this situation, the compiler is unable to fold away the C type lookup, and thus must use the global table at runtime." } ;
+
+HELP: deploy-math?
+{ $description "Deploy flag. If set, the deployed image will contain the full number tower."
+$nl
+"On by default. Most programs require the number tower, in particular, any program deployed with " { $link deploy-compiled? } " set." } ;
+
+HELP: deploy-compiled?
+{ $description "Deploy flag. If set, words in the deployed image will be compiled when possible."
+$nl
+"On by default. Most programs should be compiled, not only for performance but because features which depend on the C library interface only function after compilation." } ;
+
+HELP: deploy-ui?
+{ $description "Deploy flag. If set, the Factor UI will be included in the deployed image."
+$nl
+"Off by default. Programs wishing to use the UI must be deployed with this flag on." } ;
+
+HELP: deploy-io?
+{ $description "Deploy flag. If set, support for non-blocking I/O and networking will be included in the deployed image."
+$nl
+"Off by default. Programs wishing to use non-blocking I/O or networking must be deployed with this flag on." } ;
+
+HELP: default-config
+{ $values { "assoc" assoc } }
+{ $description "Outputs the default deployment configuration." } ;
+
+HELP: deploy-config
+{ $values { "vocab" "a vocabulary specifier" } { "assoc" assoc } }
+{ $description "Loads a vocabulary's deployment configuration from the " { $snippet "deploy.factor" } " file in the vocabulary's directory. If the file does not exist, the " { $link default-config } " is output." } ;
+
+HELP: set-deploy-config
+{ $values { "assoc" assoc } { "vocab" "a vocabulary specifier" } }
+{ $description "Stores a vocabulary's deployment configuration to the " { $snippet "deploy.factor" } " file in the vocabulary's directory." } ;
+
+HELP: set-deploy-flag
+{ $values { "value" object } { "key" object } { "vocab" "a vocabulary specifier" } }
+{ $description "Modifies an entry in a vocabulary's deployment configuration on disk." } ;
+
+HELP: deploy*
+{ $values { "vm" "a pathname string" } { "image" "a pathname string" } { "vocab" "a vocabulary specifier" } { "config" assoc } }
+{ $description "Deploys " { $snippet "vocab" } ", which must have a " { $link POSTPONE: MAIN: } " hook, using the specified VM and configuration. The deployed image is saved as " { $snippet "image" } "." }
+{ $notes "This is a low-level word and in most cases " { $link deploy } " should be called instead." } ;
+
+HELP: deploy
+{ $values { "vocab" "a vocabulary specifier" } }
+{ $description "Deploys " { $snippet "vocab" } ", saving the deployed image as " { $snippet { $emphasis "vocab" } ".image" } "." } ;
diff --git a/extra/tools/deploy/deploy.factor b/extra/tools/deploy/deploy.factor
new file mode 100644 (file)
index 0000000..dfa31ed
--- /dev/null
@@ -0,0 +1,287 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces continuations.private kernel.private init
+assocs kernel vocabs words sequences memory io system arrays
+continuations math definitions mirrors splitting parser classes
+inspector layouts vocabs.loader prettyprint.config prettyprint
+debugger io.streams.c io.streams.duplex io.files io.backend
+quotations io.launcher words.private ;
+IN: tools.deploy
+
+SYMBOL: strip-globals?
+SYMBOL: strip-word-props?
+SYMBOL: strip-word-names?
+SYMBOL: strip-dictionary?
+SYMBOL: strip-debugger?
+SYMBOL: strip-prettyprint?
+SYMBOL: strip-c-types?
+
+SYMBOL: deploy-math?
+SYMBOL: deploy-compiled?
+SYMBOL: deploy-io?
+SYMBOL: deploy-ui?
+
+SYMBOL: deploy-vm
+SYMBOL: deploy-image
+
+: default-config ( -- assoc )
+    V{
+        { strip-prettyprint? t }
+        { strip-globals?     t }
+        { strip-word-props?  t }
+        { strip-word-names?  t }
+        { strip-dictionary?  t }
+        { strip-debugger?    t }
+        { strip-c-types?     t }
+        { deploy-math?       t }
+        { deploy-compiled?   t }
+        { deploy-io?         f }
+        { deploy-ui?         f }
+        ! default value for deploy.app
+        { "stop-after-last-window?" t }
+    } clone ;
+
+: deploy-config-path ( vocab -- string )
+    vocab-dir "deploy.factor" path+ ;
+
+: deploy-config ( vocab -- assoc )
+    default-config swap
+    dup deploy-config-path vocab-file-contents
+    parse-fresh dup empty? [ drop ] [ first union ] if ;
+
+: set-deploy-config ( assoc vocab -- )
+    >r unparse-use string-lines r>
+    dup deploy-config-path set-vocab-file-contents ;
+
+: set-deploy-flag ( value key vocab -- )
+    [ deploy-config [ set-at ] keep ] keep set-deploy-config ;
+
+<PRIVATE
+
+: show ( msg -- )
+    #! Use primitives directly so that we can print stuff even
+    #! after most of the image has been stripped away
+    "\r\n" append stdout fwrite stdout fflush ;
+
+: strip-init-hooks ( -- )
+    "Stripping startup hooks" show
+    "command-line" init-hooks get delete-at ;
+
+: strip-debugger ( -- )
+    strip-debugger? get [
+        "Stripping debugger" show
+        "resource:extra/tools/deploy/strip-debugger.factor"
+        run-file
+    ] when ;
+
+: strip-cocoa ( -- )
+    "cocoa" vocab [
+        "Stripping unused Cocoa methods" show
+        "resource:extra/tools/deploy/strip-cocoa.factor"
+        run-file
+    ] when ;
+
+: strip-assoc ( retained-keys assoc -- newassoc )
+    swap [ nip member? ] curry assoc-subset ;
+
+: strip-word-names ( words -- )
+    "Stripping word names" show
+    [ f over set-word-name f swap set-word-vocabulary ] each ;
+
+: strip-word-defs ( words -- )
+    "Stripping unoptimized definitions from optimized words" show
+    [ compiled? ] subset [ f swap set-word-def ] each ;
+
+: strip-word-props ( retain-props words -- )
+    "Stripping word properties" show
+    [
+        [ word-props strip-assoc f assoc-like ] keep
+        set-word-props
+    ] curry* each ;
+
+: retained-props ( -- seq )
+    [
+        "class" ,
+        "metaclass" ,
+        "slot-names" ,
+        deploy-ui? get [
+            "gestures" ,
+            "commands" ,
+            { "+nullary+" "+listener+" "+description+" }
+            [ "ui.commands" lookup , ] each
+        ] when
+    ] { } make ;
+
+: strip-words ( props -- )
+    [ word? ] instances
+    strip-word-props? get [ tuck strip-word-props ] [ nip ] if
+    strip-word-names? get [ dup strip-word-names ] when
+    strip-word-defs ;
+
+USING: bit-arrays byte-arrays io.streams.nested ;
+
+: strip-classes ( -- )
+    "Stripping classes" show
+    io-backend get [
+        c-reader forget
+        c-writer forget
+    ] when
+    { style-stream mirror enum } [ forget ] each ;
+
+: strip-environment ( retain-globals -- )
+    "Stripping environment" show
+    strip-globals? get [
+        global strip-assoc 21 setenv
+    ] [ drop ] if ;
+
+: finish-deploy ( final-image -- )
+    "Finishing up" show
+    >r V{ } set-datastack r>
+    V{ } set-retainstack
+    V{ } set-callstack
+    V{ } set-namestack
+    V{ } set-catchstack
+    "Saving final image" show
+    [ save-image-and-exit ] call ;
+
+SYMBOL: deploy-vocab
+
+: set-boot-quot* ( word -- )
+    [
+        \ boot ,
+        init-hooks get values concat %
+        ,
+        "io.backend" init-hooks get at [ \ flush , ] when
+    ] [ ] make "Boot quotation: " write dup . flush
+    set-boot-quot ;
+
+: retained-globals ( -- seq )
+    [
+        builtins ,
+        io-backend ,
+
+        strip-dictionary? get [
+            {
+                builtins
+                dictionary
+                inspector-hook
+                lexer-factory
+                load-vocab-hook
+                num-tags
+                num-types
+                tag-bits
+                tag-mask
+                tag-numbers
+                typemap
+                vocab-roots
+            } %
+        ] unless
+
+        strip-prettyprint? get [
+            {
+                tab-size
+                margin
+            } %
+        ] unless
+
+        strip-c-types? get not deploy-ui? get or [
+            "c-types" "alien.c-types" lookup ,
+        ] when
+
+        deploy-ui? get [
+            "ui" child-vocabs
+            "cocoa" child-vocabs
+            deploy-vocab get child-vocabs 3append
+            global keys [ word? ] subset
+            swap [ >r word-vocabulary r> member? ] curry
+            subset %
+        ] when
+    ] { } make dup . ;
+
+: normalize-strip-flags
+    strip-prettyprint? get [
+        strip-word-names? off
+    ] unless
+    strip-dictionary? get [
+        strip-prettyprint? off
+        strip-word-names? off
+        strip-word-props? off
+    ] unless ;
+
+: strip ( -- )
+    normalize-strip-flags
+    strip-cocoa
+    strip-debugger
+    strip-init-hooks
+    deploy-vocab get vocab-main set-boot-quot*
+    retained-props >r
+    retained-globals strip-environment
+    r> strip-words ;
+
+: (deploy) ( final-image vocab config -- )
+    #! Does the actual work of a deployment in the slave
+    #! stage2 image
+    [
+        [
+            deploy-vocab set
+            parse-hook get >r
+            parse-hook off
+            deploy-vocab get require
+            r> call
+            strip
+            finish-deploy
+        ] [
+            print-error flush 1 exit
+        ] recover
+    ] bind ;
+
+: do-deploy ( -- )
+    "output-image" get
+    "deploy-vocab" get
+    "Deploying " write dup write "..." print
+    dup deploy-config dup .
+    (deploy) ;
+
+: (copy-lines) ( stream -- stream )
+    dup stream-readln [ print flush (copy-lines) ] when* ;
+
+: copy-lines ( stream -- )
+    [ (copy-lines) ] [ stream-close ] [ ] cleanup ;
+
+: stage2 ( vm flags -- )
+       [
+        "\"" % swap % "\" -i=boot." % cpu % ".image" %
+        [ " " % % ] each
+    ] "" make
+    dup print <process-stream> copy-lines ;
+
+: profile-string ( config -- string )
+    {
+        { deploy-math? "math" }
+        { deploy-compiled? "compiler" }
+        { deploy-ui? "ui" }
+        { deploy-io? "io" }
+    } swap [ nip at ] curry assoc-subset values " " join ;
+
+: deploy-command-line ( vm image vocab config -- vm flags )
+    [
+        "\"-include=" swap profile-string "\"" 3append ,
+
+        "-deploy-vocab=" swap append ,
+
+        "\"-output-image=" swap "\"" 3append ,
+
+        "-no-stack-traces" ,
+        
+        "-no-user-init" ,
+    ] { } make ;
+
+PRIVATE>
+
+: deploy* ( vm image vocab config -- )
+    deploy-command-line stage2 ;
+
+: deploy ( vocab -- )
+    vm over ".image" append rot dup deploy-config deploy* ;
+
+MAIN: do-deploy
diff --git a/extra/tools/deploy/strip-cocoa.factor b/extra/tools/deploy/strip-cocoa.factor
new file mode 100644 (file)
index 0000000..642999d
--- /dev/null
@@ -0,0 +1,30 @@
+USING: cocoa cocoa.messages cocoa.application cocoa.nibs
+assocs namespaces kernel words compiler sequences ui.cocoa ;
+
+"stop-after-last-window?" get
+global [
+    stop-after-last-window? set
+
+    [ "MiniFactor.nib" load-nib ] cocoa-init-hook set-global
+
+    ! Only keeps those methods that we actually call
+    sent-messages get super-sent-messages get union
+    objc-methods [ intersect ] change
+
+    sent-messages get
+    super-sent-messages get
+    [ keys [ objc-methods get at dup ] H{ } map>assoc ] 2apply
+    super-message-senders [ intersect ] change
+    message-senders [ intersect ] change
+
+    sent-messages off
+    super-sent-messages off
+
+    ! We need this for strip-stack-traces to work fully
+    { message-senders super-message-senders }
+    [
+        get values [
+            dup update-xt compile
+        ] each
+    ] each
+] bind
diff --git a/extra/tools/deploy/strip-debugger.factor b/extra/tools/deploy/strip-debugger.factor
new file mode 100644 (file)
index 0000000..a1aea33
--- /dev/null
@@ -0,0 +1,4 @@
+USING: kernel ;
+IN: debugger
+
+: error. die ;
diff --git a/extra/tools/deploy/summary.txt b/extra/tools/deploy/summary.txt
new file mode 100644 (file)
index 0000000..d12f56a
--- /dev/null
@@ -0,0 +1 @@
+Deploying minimal stand-alone images
diff --git a/extra/tools/deploy/tags.txt b/extra/tools/deploy/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/interpreter/authors.txt b/extra/tools/interpreter/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/interpreter/interpreter-docs.factor b/extra/tools/interpreter/interpreter-docs.factor
new file mode 100644 (file)
index 0000000..f102b2d
--- /dev/null
@@ -0,0 +1,207 @@
+USING: help.markup help.syntax kernel generic
+math hashtables quotations classes continuations ;
+IN: tools.interpreter
+
+ARTICLE: "meta-interp-state" "Interpreter state"
+"The current interpreter state is stored in a number of variables:"
+{ $subsection meta-interp }
+{ $subsection callframe }
+{ $subsection callframe-scan }
+"A set of utility words for inspecting and modifying interpreter state is provided:"
+{ $subsection meta-d }
+{ $subsection push-d }
+{ $subsection pop-d }
+{ $subsection peek-d }
+{ $subsection meta-r }
+{ $subsection push-r }
+{ $subsection pop-r }
+{ $subsection peek-r }
+{ $subsection meta-c }
+{ $subsection push-c }
+{ $subsection pop-c }
+{ $subsection peek-c }
+"Calling a quotation in the meta-circular interpreter:"
+{ $subsection meta-call } ;
+
+ARTICLE: "meta-interp-step" "Single-stepping words"
+"Breakpoints can be inserted in user code:"
+{ $subsection break }
+"Breakpoints invoke a hook:"
+{ $subsection break-hook }
+"Single stepping with the meta-circular interpreter:"
+{ $subsection step }
+{ $subsection step-in }
+{ $subsection step-out }
+{ $subsection step-all }
+{ $subsection abandon } ;
+
+ARTICLE: "meta-interp-travel" "Backwards time travel"
+"Backwards time travel is implemented by capturing the continuation after every step. Since this consumes additional memory, it must be explicitly enabled by storing an empty vector into a variable:"
+{ $subsection meta-history }
+"If this variable holds a vector, the interpreter state is automatically saved after every step. It can be saved at other points manually:"
+{ $subsection save-interp }
+"You can also restore any prior state:"
+{ $subsection restore-interp }
+"Or restore the most recently saved state:"
+{ $subsection step-back } ;
+
+ARTICLE: "meta-interp-impl" "Interpreter implementation"
+"Custom single stepping behavior can be implemented by calling the common factor shared by " { $link step } " and " { $link step-in } ":"
+{ $subsection next }
+"The meta-circular interpreter executes most words much like the Factor interpreter; primitives are executed atomically and compound words are descended into. These semantics can be customized by setting the " { $snippet "\"meta-word\"" } " word property to a quotation. This quotation is run in the host interpreter and can make use of the words in " { $link "meta-interp-state" } "."
+$nl
+"Additionally, the " { $snippet "\"no-meta-word\"" } " word property can be set to " { $link t } " to instruct the meta-circular interpreter to always execute the word atomically, even if " { $link step-in } " is called." ;
+
+ARTICLE: "meta-interpreter" "Meta-circular interpreter"
+"The meta-circular interpreter is used to implement the walker tool in the UI. If you are simply interested in single stepping through a piece of code, use the " { $link "ui-walker" } "."
+$nl
+"On the other hand, if you want to implement a similar tool yourself, then you can use the words described in this section."
+$nl
+"Meta-circular interpreter words are found in the " { $vocab-link "tools.interpreter" } " vocabulary."
+{ $subsection "meta-interp-state" }
+{ $subsection "meta-interp-step" }
+{ $subsection "meta-interp-travel" }
+{ $subsection "meta-interp-impl" } ;
+
+ABOUT: "meta-interpreter"
+
+HELP: meta-interp
+{ $var-description "Variable holding a " { $link continuation } " instance for the single-stepper." } ;
+
+HELP: meta-d
+{ $values { "seq" "a sequence" } }
+{ $description "Pushes the data stack from the single stepper." } ;
+
+HELP: push-d
+{ $values { "obj" object } }
+{ $description "Pushes an object on the single stepper's data stack." } ;
+
+HELP: pop-d
+{ $values { "obj" object } }
+{ $description "Pops an object from the single stepper's data stack." }
+{ $errors "Throws an error if the single stepper's data stack is empty." } ;
+
+HELP: peek-d
+{ $values { "obj" object } }
+{ $description "Outputs the object at the top of the single stepper's data stack." }
+{ $errors "Throws an error if the single stepper's data stack is empty." } ;
+
+HELP: meta-r
+{ $values { "seq" "a sequence" } }
+{ $description "Pushes the retain stack from the single stepper." } ;
+
+HELP: push-r
+{ $values { "obj" object } }
+{ $description "Pushes an object on the single stepper's retain stack." } ;
+
+HELP: pop-r
+{ $values { "obj" object } }
+{ $description "Pops an object from the single stepper's retain stack." }
+{ $errors "Throws an error if the single stepper's retain stack is empty." } ;
+
+HELP: peek-r
+{ $values { "obj" object } }
+{ $description "Outputs the object at the top of the single stepper's retain stack." }
+{ $errors "Throws an error if the single stepper's retain stack is empty." } ;
+
+HELP: meta-c
+{ $values { "seq" "a sequence" } }
+{ $description "Pushes the call stack from the single stepper." } ;
+
+HELP: push-c
+{ $values { "obj" object } }
+{ $description "Pushes an object on the single stepper's call stack." } ;
+
+HELP: pop-c
+{ $values { "obj" object } }
+{ $description "Pops an object from the single stepper's call stack." }
+{ $errors "Throws an error if the single stepper's call stack is empty." } ;
+
+HELP: peek-c
+{ $values { "obj" object } }
+{ $description "Outputs the object at the top of the single stepper's call stack." }
+{ $errors "Throws an error if the single stepper's call stack is empty." } ;
+
+HELP: break-hook
+{ $var-description "A quotation called by the " { $link break } " word. The default value invokes the " { $link "ui-walker" } "." } ;
+
+HELP: callframe
+{ $var-description "The quotation currently being stepped through by the single stepper." } ;
+
+HELP: callframe-scan
+{ $var-description "The index of the next object to be evaluated by the single stepper." } ;
+
+HELP: break
+{ $description "Suspends execution of the current thread and starts the single stepper by calling " { $link break-hook } "." } ;
+
+HELP: up
+{ $description "Returns from the current quotation in the single stepper." } ;
+
+HELP: done-cf?
+{ $values { "?" "a boolean" } }
+{ $description "Outputs whether the current quotation has finished evaluating in the single stepper." } ;
+
+HELP: done?
+{ $values { "?" "a boolean" } }
+{ $description "Outputs whether the current continuation has finished evaluating in the single stepper." }
+;
+
+HELP: reset-interpreter
+{ $description "Resets the single stepper, discarding any prior state." } ;
+
+HELP: save-callframe
+{ $description "Saves the currently evaluating quotation on the single stepper's call stack." } ;
+
+HELP: meta-call
+{ $values { "quot" quotation } }
+{ $description "Begins evaluating a quotation in the single stepper, performing tail call optimization if the prior quotation has finished evaluating." } ;
+
+HELP: step-to
+{ $values { "n" integer } }
+{ $description "Evaluates the single stepper's continuation until the " { $snippet "n" } "th index in the current quotation." } ;
+
+HELP: meta-history
+{ $var-description "A sequence of continuations, captured at every stage of single-stepping. Used by " { $link step-back } " to implement backwards time travel." } ;
+
+HELP: save-interp
+{ $description "Snapshots the single stepper state and saves it in " { $link meta-history } "." } ;
+
+HELP: restore-interp
+{ $values { "ns" hashtable } }
+{ $description "Restores the single stepper to a former state, which must have been saved by a call to " { $link save-interp } "." } ;
+
+HELP: next
+{ $values { "quot" quotation } }
+{ $description "Applies the quotation to the next object evaluated by the single stepper. If the single stepper's current quotation has finished evaluating, this will return to the caller quotation." }
+{ $notes "This word is used to implement " { $link step } " and " { $link step-in } "." } ;
+
+HELP: step
+{ $description "Evaluates the object in the single stepper using Factor evaluation semantics:"
+    { $list
+        { "If the object is a " { $link wrapper } ", then the wrapped object is pushed on the single stepper's data stack" }
+        { "If the object is a word, then the word is executed in the single stepper's continuation atomically" }
+        { "Otherwise, the object is pushed on the single stepper's data stack" }
+    }
+} ;
+
+HELP: step-in
+{ $description "Evaluates the object in the single stepper using Factor evaluation semantics:"
+    { $list
+        { "If the object is a " { $link wrapper } ", then the wrapped object is pushed on the single stepper's data stack" }
+        { "If the object is a compound word, then the single stepper enters the word definition" }
+        { "If the object is a primitive word or a word with special single stepper behavior, it is executed in the single stepper's continuation atomically" }
+        { "Otherwise, the object is pushed on the single stepper's data stack" }
+    }
+} ;
+
+HELP: step-out
+{ $description "Evaluates the remainder of the current quotation in the single stepper." } ;
+
+HELP: step-back
+{ $description "Steps back to the most recently saved snapshot of the single stepper continuation in " { $link meta-history } "." } ;
+
+HELP: step-all
+{ $description "Executes the remainder of the single stepper's continuation. This effectively ends single stepping unless the continuation invokes " { $link break } " at a later point in time." } ;
+
+HELP: abandon
+{ $description "Raises an error in the single stepper's continuation then executes the remainder of the continuation starting from the error handler." } ;
diff --git a/extra/tools/interpreter/interpreter-tests.factor b/extra/tools/interpreter/interpreter-tests.factor
new file mode 100644 (file)
index 0000000..5e83157
--- /dev/null
@@ -0,0 +1,157 @@
+USING: tools.interpreter io io.streams.string kernel math
+math.private namespaces prettyprint sequences tools.test
+continuations math.parser ;
+IN: temporary
+
+[ V{ [ "Hello world" print readln break + ] 1 5 } ]
+[ 3 [ "Hello world" print readln + ] 1 <breakpoint> ]
+unit-test
+
+: run ( -- ) done? [ step-in run ] unless ;
+
+: init-interpreter ( -- )
+    V{ } clone V{ } clone V{ } clone namestack catchstack
+    f <continuation> meta-interp set ;
+
+: test-interpreter
+    init-interpreter (meta-call) run meta-d ;
+
+[ V{ } ] [
+    [ ] test-interpreter
+] unit-test
+
+[ V{ 1 } ] [
+    [ 1 ] test-interpreter
+] unit-test
+
+[ V{ 1 2 3 } ] [
+    [ 1 2 3 ] test-interpreter
+] unit-test
+
+[ V{ "Yo" 2 } ] [
+    [ 2 >r "Yo" r> ] test-interpreter
+] unit-test
+
+[ V{ 2 } ] [
+    [ t [ 2 ] [ "hi" ] if ] test-interpreter
+] unit-test
+
+[ V{ "hi" } ] [
+    [ f [ 2 ] [ "hi" ] if ] test-interpreter
+] unit-test
+
+[ V{ 4 } ] [
+    [ 2 2 fixnum+ ] test-interpreter
+] unit-test
+
+: foo 2 2 fixnum+ ;
+
+[ V{ 8 } ] [
+    [ foo 4 fixnum+ ] test-interpreter
+] unit-test
+
+[ V{ C{ 1 1.5 } { } C{ 1 1.5 } { } } ] [
+    [ C{ 1 1.5 } { } 2dup ] test-interpreter
+] unit-test
+
+[ V{ t } ] [
+    [ 5 5 number= ] test-interpreter
+] unit-test
+
+[ V{ f } ] [
+    [ 5 6 number= ] test-interpreter
+] unit-test
+
+[ V{ f } ] [
+    [ "XYZ" "XYZ" mismatch ] test-interpreter
+] unit-test
+
+[ V{ t } ] [
+    [ "XYZ" "XYZ" sequence= ] test-interpreter
+] unit-test
+
+[ V{ t } ] [
+    [ "XYZ" "XYZ" = ] test-interpreter
+] unit-test
+
+[ V{ f } ] [
+    [ "XYZ" "XuZ" = ] test-interpreter
+] unit-test
+
+[ V{ 4 } ] [
+    [ 2 2 + ] test-interpreter
+] unit-test
+
+[ V{ } 2 ] [
+    2 "x" set [ [ 3 "x" set ] with-scope ] test-interpreter "x" get
+] unit-test
+
+[ V{ 3 } ] [
+    [ 3 "x" set "x" get ] test-interpreter
+] unit-test
+
+[ V{ "hi\n" } ] [
+    [ [ "hi" print ] string-out ] test-interpreter
+] unit-test
+
+[ V{ "4\n" } ] [
+    [ [ 2 2 + number>string print ] string-out ] test-interpreter
+] unit-test
+
+[ V{ 6 } ]
+[ [ [ 3 throw ] catch 2 * ] test-interpreter ] unit-test
+
+[ V{ 6 } ]
+[ [ [ 3 swap continue-with ] callcc1 2 * ] test-interpreter ] unit-test
+
+: meta-catch meta-interp get continuation-catch ;
+
+! Step back test
+[
+    init-interpreter
+    V{ } clone meta-history set
+
+    V{ f } clone
+    V{ } clone
+    V{ [ 1 2 3 ] 0 3 } clone
+    V{ } clone
+    V{ } clone
+    f <continuation>
+    meta-catch push
+
+    [ ] [ [ 2 2 + throw ] (meta-call) ] unit-test
+
+    [ ] [ step ] unit-test
+
+    [ ] [ step ] unit-test
+    
+    [ V{ 2 2 } ] [ meta-d ] unit-test
+
+    [ ] [ step ] unit-test
+    
+    [ V{ 4 } ] [ meta-d ] unit-test
+    [ 3 ] [ callframe-scan get ] unit-test
+    
+    [ ] [ step-back ] unit-test
+    [ 2 ] [ callframe-scan get ] unit-test
+    
+    [ V{ 2 2 } ] [ meta-d ] unit-test
+    
+    [ ] [ step ] unit-test
+    
+    [ [ 1 2 3 ] ] [ meta-catch peek continuation-call first ] unit-test
+
+    [ ] [ step ] unit-test
+    
+    [ [ 1 2 3 ] ] [ callframe get ] unit-test
+    [ ] [ step-back ] unit-test
+    
+    [ V{ 4 } ] [ meta-d ] unit-test
+    
+    [ [ 1 2 3 ] ] [ meta-catch peek continuation-call first ] unit-test
+
+    [ ] [ step ] unit-test
+    
+    [ [ 1 2 3 ] ] [ callframe get ] unit-test
+
+] with-scope
diff --git a/extra/tools/interpreter/interpreter.factor b/extra/tools/interpreter/interpreter.factor
new file mode 100644 (file)
index 0000000..4ac4958
--- /dev/null
@@ -0,0 +1,190 @@
+! Copyright (C) 2004, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs classes combinators combinators.private
+continuations continuations.private generic hashtables io kernel
+kernel.private math namespaces namespaces.private prettyprint
+quotations sequences splitting strings threads vectors words ;
+IN: tools.interpreter
+
+SYMBOL: meta-interp
+
+SYMBOL: callframe
+SYMBOL: callframe-scan
+
+! Meta-stacks;
+: meta-d ( -- seq )
+    meta-interp get continuation-data ;
+
+: set-meta-d ( seq -- )
+    meta-interp get set-continuation-data ;
+
+: unclip-last ( seq -- last seq' ) dup peek swap 1 head* ;
+
+: push-d ( obj -- ) meta-d swap add set-meta-d ;
+: pop-d  ( -- obj ) meta-d unclip-last set-meta-d ;
+: peek-d ( -- obj ) meta-d peek ;
+
+: meta-r ( -- seq )
+    meta-interp get continuation-retain ;
+
+: set-meta-r ( seq -- )
+    meta-interp get set-continuation-retain ;
+
+: push-r ( obj -- ) meta-r swap add set-meta-r ;
+: pop-r  ( -- obj ) meta-r unclip-last set-meta-r ;
+: peek-r ( -- obj ) meta-r peek ;
+
+: meta-c ( -- seq )
+    meta-interp get continuation-call callstack>array ;
+
+: set-meta-c ( seq -- )
+    array>callstack meta-interp get set-continuation-call ;
+
+: push-c ( obj -- ) meta-c swap append set-meta-c ;
+: pop-c  ( -- obj ) meta-c 2 swap cut* swap set-meta-c ;
+: peek-c ( -- obj ) meta-c 2 tail* ;
+
+! Hook
+SYMBOL: break-hook
+
+: (meta-call) ( quot -- )
+    callframe set 0 callframe-scan set ;
+
+! Callframe.
+
+: break ( -- )
+    continuation walker-hook
+    [ continue-with ] [ break-hook get call ] if* ;
+
+: remove-breaks \ break swap remove ;
+
+: up ( -- )
+    pop-c first2 cut [ remove-breaks ] 2apply
+    >r dup length callframe-scan set r> append
+    callframe set ;
+
+: done-cf? ( -- ? ) callframe-scan get callframe get length >= ;
+
+: done? ( -- ? ) done-cf? meta-c empty? and ;
+
+: reset-interpreter ( -- )
+    meta-interp off [ ] (meta-call) ;
+
+: <callframe> ( quot scan -- seq )
+    >r { } like r> 2array ;
+
+: (save-callframe) ( -- )
+    callframe get callframe-scan get <callframe> push-c ;
+
+: save-callframe ( -- )
+    done-cf? [ (save-callframe) ] unless ;
+
+GENERIC: meta-call ( quot -- )
+
+M: quotation meta-call save-callframe (meta-call) ;
+
+M: curry meta-call
+    dup curry-obj push-d curry-quot meta-call ;
+
+: meta-swap ( -- )
+    meta-d 2 cut* reverse append set-meta-d ;
+
+GENERIC: restore ( obj -- )
+
+M: continuation restore
+    clone meta-interp set
+    f push-d
+    meta-c empty? [ [ ] (meta-call) ] [ up ] if ;
+
+M: pair restore
+    first2 restore push-d meta-swap ;
+
+M: f restore
+    drop reset-interpreter ;
+
+: <breakpoint> ( break quot scan -- callframe )
+    >r cut [ break ] swap 3append r> <callframe> ;
+
+: step-to ( n -- )
+    callframe get callframe-scan get <breakpoint> push-c
+    [ set-walker-hook meta-interp get (continue) ] callcc1
+    restore ;
+
+! The interpreter loses object identity of the name and catch
+! stacks -- they are copied after each step -- so we execute
+! these atomically and don't allow stepping into these words
+{ >n >c c> rethrow continue continue-with continuation
+(continue) (continue-with) }
+[ t "no-meta-word" set-word-prop ] each
+
+\ call [ pop-d meta-call ] "meta-word" set-word-prop
+\ execute [ pop-d 1quotation meta-call ] "meta-word" set-word-prop
+\ if [ pop-d pop-d pop-d [ nip ] [ drop ] if meta-call ] "meta-word" set-word-prop
+\ dispatch [ pop-d pop-d swap nth meta-call ] "meta-word" set-word-prop
+\ (callcc1) [ ] "meta-word" set-word-prop
+
+! Time travel
+SYMBOL: meta-history
+
+: save-interp ( -- )
+    meta-history get [
+        [
+            callframe [ ] change
+            callframe-scan [ ] change
+            meta-interp [ clone ] change
+        ] H{ } make-assoc swap push
+    ] when* ;
+
+: restore-interp ( ns -- )
+    callframe over at callframe set
+    callframe-scan over at callframe-scan set
+    meta-interp swap at clone meta-interp set ;
+
+: advance ( -- ) callframe-scan inc ;
+
+: (next) callframe-scan get callframe get nth ;
+
+: next ( quot -- )
+    save-interp {
+        { [ done? ] [ drop [ ] (meta-call) ] }
+        { [ done-cf? ] [ drop up ] }
+        { [ >r (next) r> call ] [ ] }
+        { [ t ] [ callframe-scan get 1+ step-to ] }
+    } cond ; inline
+
+GENERIC: (step) ( obj -- ? )
+
+M: wrapper (step) advance wrapped push-d t ;
+
+M: object (step) advance push-d t ;
+
+M: word (step) drop f ;
+
+: step ( -- ) [ (step) ] next ;
+
+: (step-in) ( word -- ? )
+    dup "meta-word" word-prop [
+        advance call t
+    ] [
+        dup "no-meta-word" word-prop not over compound? and [
+            advance word-def meta-call t
+        ] [
+            drop f
+        ] if
+    ] ?if ;
+
+: step-in ( -- )
+    [ dup word? [ (step-in) ] [ (step) ] if ] next ;
+
+: step-out ( -- )
+    save-interp callframe get length step-to ;
+
+: step-back ( -- )
+    meta-history get dup empty?
+    [ drop ] [ pop restore-interp ] if ;
+
+: step-all ( -- )
+    save-callframe meta-interp get schedule-thread ;
+
+: abandon ( -- )
+    [ "Single-stepping abandoned" throw ] meta-call step-all ;
diff --git a/extra/tools/interpreter/summary.txt b/extra/tools/interpreter/summary.txt
new file mode 100644 (file)
index 0000000..242b9cb
--- /dev/null
@@ -0,0 +1 @@
+Meta-circular interpreter and single-stepper support
diff --git a/extra/tools/memory/authors.txt b/extra/tools/memory/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/memory/memory-docs.factor b/extra/tools/memory/memory-docs.factor
new file mode 100644 (file)
index 0000000..3d746bb
--- /dev/null
@@ -0,0 +1,25 @@
+USING: help.markup help.syntax memory ;
+IN: tools.memory
+
+ARTICLE: "tools.memory" "Object memory tools"
+"You can print object heap status information:"
+{ $subsection room. }
+{ $subsection heap-stats. }
+{ $subsection heap-stats }
+{ $see-also "memory" } ;
+
+ABOUT: "tools.memory"
+
+HELP: room.
+{ $description "Prints an overview of memory usage broken down by generation and zone." } ;
+
+{ data-room code-room room. } related-words
+
+HELP: heap-stats
+{ $values { "counts" "an assoc mapping class words to integers" } { "sizes" "an assoc mapping class words to integers" } }
+{ $description "Outputs a pair of assocs holding class instance counts and instance memory usage, respectively." } ;
+
+HELP: heap-stats.
+{ $description "For each class, prints the number of instances and total memory consumed by those instances." } ;
+
+{ heap-stats heap-stats. } related-words
diff --git a/extra/tools/memory/memory-tests.factor b/extra/tools/memory/memory-tests.factor
new file mode 100644 (file)
index 0000000..36bcc73
--- /dev/null
@@ -0,0 +1,4 @@
+USING: tools.test tools.memory ;
+IN: temporary
+
+[ ] [ heap-stats. ] unit-test
diff --git a/extra/tools/memory/memory.factor b/extra/tools/memory/memory.factor
new file mode 100644 (file)
index 0000000..2077ea4
--- /dev/null
@@ -0,0 +1,62 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences vectors arrays generic assocs io math
+namespaces parser prettyprint strings io.styles vectors words
+system sorting splitting math.parser classes memory ;
+IN: tools.memory
+
+: write-total/used/free ( free total str -- )
+    [
+        write-cell
+        dup number>string write-cell
+        over - number>string write-cell
+        number>string write-cell
+    ] with-row ;
+
+: write-total ( n str -- )
+    [
+        write-cell
+        number>string write-cell
+        [ ] with-cell
+        [ ] with-cell
+    ] with-row ;
+
+: write-headings ( seq -- )
+    [ [ write-cell ] each ] with-row ;
+
+: (data-room.) ( -- )
+    data-room 2 <groups> 0 [
+        "Generation " pick number>string append
+        >r first2 r> write-total/used/free 1+
+    ] reduce drop
+    "Cards" write-total ;
+
+: (code-room.) ( -- )
+    code-room "Code space" write-total/used/free ;
+
+: room. ( -- )
+    standard-table-style [
+        { "" "Total" "Used" "Free" } write-headings
+        (data-room.)
+        (code-room.)
+    ] tabular-output ;
+
+: heap-stat-step ( counts sizes obj -- )
+    [ dup size swap class rot at+ ] keep
+    1 swap class rot at+ ;
+
+: heap-stats ( -- counts sizes )
+    H{ } clone H{ } clone
+    [ >r 2dup r> heap-stat-step ] each-object ;
+
+: heap-stats. ( -- )
+    heap-stats dup keys natural-sort standard-table-style [
+        { "Class" "Bytes" "Instances" } write-headings
+        [
+            [
+                dup pprint-cell
+                dup pick at pprint-cell
+                pick at pprint-cell
+            ] with-row
+        ] each 2drop
+    ] tabular-output ;
diff --git a/extra/tools/memory/summary.txt b/extra/tools/memory/summary.txt
new file mode 100644 (file)
index 0000000..71a88d9
--- /dev/null
@@ -0,0 +1 @@
+Heap introspection tools
diff --git a/extra/tools/memory/tags.txt b/extra/tools/memory/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/profiler/authors.txt b/extra/tools/profiler/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/profiler/profiler-docs.factor b/extra/tools/profiler/profiler-docs.factor
new file mode 100644 (file)
index 0000000..0af8943
--- /dev/null
@@ -0,0 +1,76 @@
+USING: tools.profiler.private tools.time help.markup help.syntax
+quotations io strings words definitions generator ;
+IN: tools.profiler
+
+ARTICLE: "profiling" "Profiling code" 
+"A simple call counting profiler is included. Both compiled and interpreted code can be profiled. There are a number of limitations when profiling compiled code:"
+{ $list
+    { "Calls to " { $link POSTPONE: inline } " words are not counted" }
+    "Calls to primitives are not counted"
+}
+"The profiler must be enabled before use:"
+{ $subsection enable-profiler }
+"Since enabling the profiler reduces performance, it should be disabled after use:"
+{ $subsection disable-profiler }
+"While enabled, a combinator which counts all calls made by a quotation can be used:"
+{ $subsection profile }
+"After a quotation has been profiled, call counts can be presented in various ways:"
+{ $subsection profile. }
+{ $subsection vocab-profile. }
+{ $subsection usage-profile. }
+{ $subsection vocabs-profile. } ;
+
+ABOUT: "profiling"
+
+HELP: reset-counters
+{ $description "Reset the call count of all words in the dictionary." }
+{ $notes "This word is automatically called by the profiler when profiling begins." } ;
+
+HELP: counters
+{ $values { "words" "a sequence of words" } { "assoc" "an association list mapping words to integers" } }
+{ $description "Outputs an association list of word call counts." } ;
+
+HELP: counters.
+{ $values { "assoc" "an association list mapping words to integers" } }
+{ $description "Prints an association list of call counts to the " { $link stdio } " stream." } ;
+
+HELP: enable-profiler
+{ $description "Recompiles all words in the dictionary to include a stub which increments the call count during profiling. Once this is done, the " { $link profile } " combinator may be used." }
+{ $notes "Performance is affected when profiling is enabled, so profiling should only be enabled when necessary." } ;
+
+HELP: disable-profiler
+{ $description "Recompiles all words in the dictionary to exclude a stub which increments the call count during profiling. This should be done when you no longer wish to use the " { $link profile } " combinator." } ;
+
+HELP: check-profiler
+{ $description "Throws an error if the profiler has not yet been enabled by a call to " { $link enable-profiler } "." } ;
+
+HELP: profile
+{ $values { "quot" quotation } }
+{ $description "Calls the quotation while collecting word call counts, which can then be displayed using " { $link profile. } " or related words." }
+{ $errors "Throws an error if the profiler has not been enabled by a prior call to " { $link enable-profiler } "." } ;
+
+HELP: profile.
+{ $description "Prints a table of call counts from the most recent invocation of " { $link profile } "." } ;
+
+HELP: vocab-profile.
+{ $values { "vocab" string } }
+{ $description "Prints a table of call counts from the most recent invocation of " { $link profile } ", for words in the " { $snippet "vocab" } " vocabulary only." }
+{ $examples { $code "\"math\" vocab-profile." } } ;
+
+HELP: usage-profile.
+{ $values { "word" word } }
+{ $description "Prints a table of call counts from the most recent invocation of " { $link profile } ", for words which directly call " { $snippet "word" } " only." }
+{ $notes "This word obtains the list of static usages with the " { $link usage } " word, and is not aware of dynamic call history. Consider the following scenario. A word " { $snippet "X" } " can execute word " { $snippet "Y" } " in a conditional branch, and " { $snippet "X" } " is executed many times during the profiling run, but this particular branch executing " { $snippet "Y" } " is never taken. However, some other word does execute " { $snippet "Y" } " multiple times. Then " { $snippet "\\ Y usage-profile." } " will list a number of calls to " { $snippet "X" } ", even though " { $snippet "Y" } " was never executed " { $emphasis "from" } " " { $snippet "X" } "." }
+{ $examples { $code "\\ + usage-profile." } } ;
+
+HELP: vocabs-profile.
+{ $description "Print a table of cumilative call counts for each vocabulary. Vocabularies whose words were not called are supressed from the output." } ;
+
+HELP: profiling ( ? -- )
+{ $values { "?" "a boolean" } }
+{ $description "Internal primitive to switch on call counting. This word should not be used; instead see " { $link enable-profiler } ", " { $link profile } " and " { $link disable-profiler } "." } ;
+
+{ time profile } related-words
+
+HELP: profiler-prologues
+{ $var-description "If set, each word will be compiled with an extra prologue which checks if profiling is enabled, and if so, increments the word's call count. This variable is off by default. It should never be set directly; " { $link enable-profiler } " and " { $link disable-profiler } " should be used instead." } ;
diff --git a/extra/tools/profiler/profiler-tests.factor b/extra/tools/profiler/profiler-tests.factor
new file mode 100644 (file)
index 0000000..991f2af
--- /dev/null
@@ -0,0 +1,32 @@
+IN: temporary
+USING: tools.profiler tools.test kernel memory math threads
+alien tools.profiler.private ;
+
+enable-profiler
+
+[ ] [ [ 10 [ data-gc ] times ] profile ] unit-test
+
+[ ] [ [ 1000 sleep ] profile ] unit-test 
+
+[ ] [ profile. ] unit-test
+
+[ ] [ vocabs-profile. ] unit-test
+
+[ ] [ "kernel.private" vocab-profile. ] unit-test
+
+[ ] [ \ + usage-profile. ] unit-test
+
+: callback-test "void" { } "cdecl" [ ] alien-callback ;
+
+: indirect-test "void" { } "cdecl" alien-indirect ;
+
+: foobar ;
+
+[
+    [ ] [ callback-test indirect-test ] unit-test
+    foobar
+] profile
+
+[ 1 ] [ \ foobar profile-counter ] unit-test
+
+disable-profiler
diff --git a/extra/tools/profiler/profiler.factor b/extra/tools/profiler/profiler.factor
new file mode 100644 (file)
index 0000000..382b17b
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: words sequences math prettyprint kernel arrays
+io io.styles namespaces assocs kernel.private generator
+compiler strings combinators sorting math.parser
+math.vectors vocabs definitions tools.profiler.private ;
+IN: tools.profiler
+
+: reset-counters ( -- )
+    all-words [ 0 swap set-profile-counter ] each ;
+
+: counters ( words -- assoc )
+    [ dup profile-counter ] { } map>assoc ;
+
+GENERIC: (profile.) ( obj -- )
+
+TUPLE: usage-profile word ;
+
+C: <usage-profile> usage-profile
+
+M: word (profile.)
+    dup unparse swap <usage-profile> write-object ;
+
+TUPLE: vocab-profile vocab ;
+
+C: <vocab-profile> vocab-profile
+
+M: string (profile.)
+    dup <vocab-profile> write-object ;
+
+: counter. ( obj n -- )
+    [
+        >r [ (profile.) ] with-cell r>
+        [ number>string write ] with-cell
+    ] with-row ;
+
+: counters. ( assoc -- )
+    [ second 0 > ] subset sort-values
+    standard-table-style [
+        [ counter. ] assoc-each
+    ] tabular-output ;
+
+: enable-profiler ( -- )
+    t profiler-prologues set-global recompile-all
+    "Profiler enabled; use disable-profiler to disable" print ;
+
+: disable-profiler ( -- )
+    f profiler-prologues set-global recompile-all ;
+
+: check-profiler ( -- )
+    profiler-prologues get-global [
+        "Enable the profiler by calling enable-profiler first"
+        throw
+    ] unless ;
+
+: profile ( quot -- )
+    check-profiler
+    reset-counters
+    t profiling
+    call
+    f profiling ;
+
+: profile. ( -- )
+    "Call counts for all words:" print
+    all-words counters counters. ;
+
+: vocab-profile. ( vocab -- )
+    "Call counts for words in the " write
+    dup dup vocab write-object
+    " vocabulary:" print
+    words counters counters. ;
+
+: usage-profile. ( word -- )
+    "Call counts for words which call " write
+    dup pprint
+    ":" print
+    usage [ word? ] subset counters counters. ;
+
+: vocabs-profile. ( -- )
+    "Call counts for all vocabularies:" print
+    vocabs [
+        dup words [ profile-counter ] map sum
+    ] { } map>assoc counters. ;
diff --git a/extra/tools/profiler/summary.txt b/extra/tools/profiler/summary.txt
new file mode 100644 (file)
index 0000000..d4f9e20
--- /dev/null
@@ -0,0 +1 @@
+Call counting profiler
diff --git a/extra/tools/profiler/tags.txt b/extra/tools/profiler/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/summary.txt b/extra/tools/summary.txt
new file mode 100644 (file)
index 0000000..dc8ba05
--- /dev/null
@@ -0,0 +1 @@
+Developer tools
diff --git a/extra/tools/test/authors.txt b/extra/tools/test/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/test/foo.factor b/extra/tools/test/foo.factor
new file mode 100644 (file)
index 0000000..944a25c
--- /dev/null
@@ -0,0 +1,4 @@
+USE: temporary
+USE: kernel
+
+1 2 foo drop
diff --git a/extra/tools/test/summary.txt b/extra/tools/test/summary.txt
new file mode 100644 (file)
index 0000000..b6d1817
--- /dev/null
@@ -0,0 +1 @@
+Unit test framework
diff --git a/extra/tools/test/tags.txt b/extra/tools/test/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/test/test-docs.factor b/extra/tools/test/test-docs.factor
new file mode 100644 (file)
index 0000000..3fc5057
--- /dev/null
@@ -0,0 +1,25 @@
+USING: help.markup help.syntax kernel ;
+IN: tools.test
+
+ARTICLE: "tools.test" "Unit testing modules"
+"A unit test is a piece of code which starts with known input values, then compares the output of a word with an expected output, where the expected output is defined by the word's contract."
+$nl
+"For example, if you were developing a word for computing symbolic derivatives, your unit tests would apply the word to certain input functions, comparing the results against the correct values. While the passing of these tests would not guarantee the algorithm is correct, it would at least ensure that what used to work keeps working, in that as soon as something breaks due to a change in another part of your program, failing tests will let you know."
+$nl
+"Unit tests for a vocabulary are placed in test harness files ( "{ $link "vocabs.loader" } "). If the test harness needs to define words, they should be placed in the " { $snippet "temporary" } " vocabulary so that they can be forgotten after the tests have been run. Test harness files consist mostly of calls to the following two words:"
+{ $subsection unit-test }
+{ $subsection unit-test-fails }
+"The following words run test harness files; any test failures are collected and printed at the end:"
+{ $subsection test }
+{ $subsection test-all } ;
+
+ABOUT: "tools.test"
+
+HELP: unit-test
+{ $values { "output" "a sequence of expected stack elements" } { "input" "a quotation run with an empty stack" } }
+{ $description "Runs a quotation with an empty stack, comparing the resulting stack with " { $snippet "output" } ". Elements are compared using " { $link = } ". Throws an error if the expected stack does not match the resulting stack." } ;
+
+HELP: unit-test-fails
+{ $values { "quot" "a quotation run with an empty stack" } }
+{ $description "Runs a quotation with an empty stack, expecting it to throw an error. If the quotation throws an error, this word returns normally. If the quotation does not throw an error, this word " { $emphasis "does" } " raise an error." }
+{ $notes "This word is used to test boundary conditions and fail-fast behavior." } ;
diff --git a/extra/tools/test/test.factor b/extra/tools/test/test.factor
new file mode 100644 (file)
index 0000000..bc9dd0f
--- /dev/null
@@ -0,0 +1,79 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces arrays prettyprint sequences kernel
+vectors quotations words parser assocs combinators
+continuations debugger io io.files vocabs tools.time
+vocabs.loader source-files ;
+IN: tools.test
+
+SYMBOL: failures
+
+: <failure> ( error what -- triple )
+    error-continuation get 3array ;
+
+: failure ( error what -- ) <failure> failures get push ;
+
+SYMBOL: this-test
+
+: (unit-test) ( what quot -- )
+    swap dup . flush this-test set
+    [ time ] curry failures get [
+        [
+            this-test get <failure> failures get push
+        ] recover
+    ] [
+        call
+    ] if ;
+
+: unit-test ( output input -- )
+    [ 2array ] 2keep [
+        { } swap with-datastack swap >array assert=
+    ] 2curry (unit-test) ;
+
+TUPLE: expected-error ;
+
+: unit-test-fails ( quot -- )
+    [ f ] append [ [ drop t ] recover ] curry
+    [ t ] swap unit-test ;
+
+: run-test ( path -- failures )
+    "temporary" forget-vocab
+    [
+        V{ } clone [
+            failures [
+                [ run-file ] [ swap failure ] recover
+            ] with-variable
+        ] keep
+    ] keep forget-source ;
+
+: failure. ( triple -- )
+    dup second .
+    dup first print-error
+    "Traceback" swap third write-object ;
+
+: failures. ( path failures -- )
+    "Failing tests in " write swap <pathname> .
+    [ nl failure. nl ] each ;
+
+: run-tests ( seq -- )
+    [ dup run-test ] { } map>assoc
+    [ second empty? not ] subset
+    dup empty? [ drop ] [
+        nl
+        "==== FAILING TESTS:" print
+        [ nl failures. ] assoc-each
+    ] if ;
+
+: run-vocab-tests ( vocabs -- )
+    [ vocab-tests-path ] map
+    [ dup [ ?resource-path exists? ] when ] subset
+    run-tests ;
+
+: test ( prefix -- )
+    child-vocabs
+    [ vocab-source-loaded? ] subset
+    run-vocab-tests ;
+
+: test-all ( -- ) "" test ;
+
+: test-changes ( -- ) "" (refresh) run-vocab-tests ;
diff --git a/extra/tools/test/tools.factor b/extra/tools/test/tools.factor
new file mode 100644 (file)
index 0000000..7699d61
--- /dev/null
@@ -0,0 +1,5 @@
+IN: temporary
+USING: completion words sequences test ;
+
+[ ] [ "swp" apropos ] unit-test
+[ f ] [ "swp" words-matching empty? ] unit-test
diff --git a/extra/tools/time/authors.txt b/extra/tools/time/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/time/summary.txt b/extra/tools/time/summary.txt
new file mode 100644 (file)
index 0000000..3f5ba4a
--- /dev/null
@@ -0,0 +1 @@
+Timing code execution
diff --git a/extra/tools/time/tags.txt b/extra/tools/time/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/time/time-docs.factor b/extra/tools/time/time-docs.factor
new file mode 100644 (file)
index 0000000..36ab3c0
--- /dev/null
@@ -0,0 +1,33 @@
+USING: help.markup help.syntax memory system ;
+IN: tools.time
+
+ARTICLE: "timing" "Timing code"
+"You can time the execution of a quotation in the listener:"
+{ $subsection time }
+"A lower-level word puts timings on the stack, intead of printing:"
+{ $subsection benchmark }
+"You can also read the system clock and total garbage collection time directly:"
+{ $subsection millis } 
+{ $subsection gc-time }
+{ $see-also "profiling" } ;
+
+ABOUT: "timing"
+
+HELP: benchmark
+{ $values { "quot" "a quotation" } { "gctime" "an integer denoting milliseconds" } { "runtime" "an integer denoting milliseconds" } }
+{ $description "Runs a quotation, measuring the total wall clock time and the total time spent in the garbage collector." }
+{ $notes "A nicer word for interactive use is " { $link time } "." } ;
+
+HELP: time
+{ $values { "quot" "a quotation" } }
+{ $description "Runs a quotation and then prints the total run time and time spent in the garbage collector." }
+{ $examples
+    "This word can be used to compare performance of the non-optimizing and optimizing compilers."
+    $nl
+    "First, we time a quotation directly; quotations are compiled by the non-optimizing quotation compiler:"
+    { $unchecked-example "[ 1000000 0 [ + ] reduce drop ] time" "1116 ms run / 6 ms GC time" }
+    "Now we define a word and compile it with the optimizing word compiler. This results is faster execution:"
+    { $unchecked-example ": foo 1000000 0 [ + ] reduce ;" "\\ foo compile" "[ foo drop ] time" "202 ms run / 13 ms GC time" }
+} ;
+
+{ gc-time benchmark millis time } related-words
diff --git a/extra/tools/time/time.factor b/extra/tools/time/time.factor
new file mode 100644 (file)
index 0000000..4862cc2
--- /dev/null
@@ -0,0 +1,14 @@
+! Copyright (C) 2003, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math memory io namespaces system
+math.parser ;
+IN: tools.time
+
+: benchmark ( quot -- gctime runtime )
+    millis >r gc-time >r call gc-time r> - millis r> - ;
+    inline
+
+: time ( quot -- )
+    benchmark
+    [ # " ms run / " % # " ms GC time" % ] "" make print flush ;
+    inline
diff --git a/extra/tools/walker/authors.txt b/extra/tools/walker/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/tools/walker/summary.txt b/extra/tools/walker/summary.txt
new file mode 100644 (file)
index 0000000..4bc7689
--- /dev/null
@@ -0,0 +1 @@
+Single-stepper breakpoint hook
diff --git a/extra/tools/walker/tags.txt b/extra/tools/walker/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/tools/walker/walker.factor b/extra/tools/walker/walker.factor
new file mode 100644 (file)
index 0000000..aa0ea48
--- /dev/null
@@ -0,0 +1,6 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: tools.walker
+USING: kernel sequences tools.interpreter ;
+
+: walk ( quot -- ) [ break ] swap append call ;
diff --git a/extra/trees/authors.txt b/extra/trees/authors.txt
new file mode 100644 (file)
index 0000000..e9c193b
--- /dev/null
@@ -0,0 +1 @@
+Alex Chapman
diff --git a/extra/trees/avl-tree/avl-tree-tests.factor b/extra/trees/avl-tree/avl-tree-tests.factor
new file mode 100644 (file)
index 0000000..5116146
--- /dev/null
@@ -0,0 +1,137 @@
+USING: kernel test trees math sequences ;
+IN: temporary
+
+[ "key1" 0 "key2" 0 ] [ T{ avl-node T{ node f "key1" f f T{ avl-node T{ node f "key2" } 1 } } 2 } [ single-rotate ] go-left [ node-left dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test
+[ "key1" 0 "key2" 0 ] [ T{ avl-node T{ node f "key1" f f T{ avl-node T{ node f "key2" } 1 } } 2 } [ select-rotate ] go-left [ node-left dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test
+[ "key1" 0 "key2" 0 ] [ T{ avl-node T{ node f "key1" f T{ avl-node T{ node f "key2" } -1 } } -2 } [ single-rotate ] go-right [ node-right dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test
+[ "key1" 0 "key2" 0 ] [ T{ avl-node T{ node f "key1" f T{ avl-node T{ node f "key2" } -1 } } -2 } [ select-rotate ] go-right [ node-right dup node-key swap avl-node-balance ] keep dup node-key swap avl-node-balance ] unit-test
+[ "key1" -1 "key2" 0 "key3" 0 ]
+[ T{ avl-node T{ node f "key1" f f
+        T{ avl-node T{ node f "key2" f
+            T{ avl-node T{ node f "key3" } 1 } }
+        -1 } }
+    2 } [ double-rotate ] go-left
+    [ node-left dup node-key swap avl-node-balance ] keep
+    [ node-right dup node-key swap avl-node-balance ] keep
+    dup node-key swap avl-node-balance ] unit-test
+[ "key1" 0 "key2" 0 "key3" 0 ]
+[ T{ avl-node T{ node f "key1" f f
+        T{ avl-node T{ node f "key2" f
+            T{ avl-node T{ node f "key3" } 0 } }
+        -1 } }
+    2 } [ double-rotate ] go-left
+    [ node-left dup node-key swap avl-node-balance ] keep
+    [ node-right dup node-key swap avl-node-balance ] keep
+    dup node-key swap avl-node-balance ] unit-test
+[ "key1" 0 "key2" 1 "key3" 0 ]
+[ T{ avl-node T{ node f "key1" f f
+        T{ avl-node T{ node f "key2" f
+            T{ avl-node T{ node f "key3" } -1 } }
+        -1 } }
+    2 } [ double-rotate ] go-left
+    [ node-left dup node-key swap avl-node-balance ] keep
+    [ node-right dup node-key swap avl-node-balance ] keep
+    dup node-key swap avl-node-balance ] unit-test
+
+[ "key1" 1 "key2" 0 "key3" 0 ]
+[ T{ avl-node T{ node f "key1" f
+        T{ avl-node T{ node f "key2" f f
+            T{ avl-node T{ node f "key3" } -1 } }
+        1 } }
+    -2 } [ double-rotate ] go-right
+    [ node-right dup node-key swap avl-node-balance ] keep
+    [ node-left dup node-key swap avl-node-balance ] keep
+    dup node-key swap avl-node-balance ] unit-test
+[ "key1" 0 "key2" 0 "key3" 0 ]
+[ T{ avl-node T{ node f "key1" f
+        T{ avl-node T{ node f "key2" f f
+            T{ avl-node T{ node f "key3" } 0 } }
+        1 } }
+    -2 } [ double-rotate ] go-right
+    [ node-right dup node-key swap avl-node-balance ] keep
+    [ node-left dup node-key swap avl-node-balance ] keep
+    dup node-key swap avl-node-balance ] unit-test
+[ "key1" 0 "key2" -1 "key3" 0 ]
+[ T{ avl-node T{ node f "key1" f
+        T{ avl-node T{ node f "key2" f f
+            T{ avl-node T{ node f "key3" } 1 } }
+        1 } }
+    -2 } [ double-rotate ] go-right
+    [ node-right dup node-key swap avl-node-balance ] keep
+    [ node-left dup node-key swap avl-node-balance ] keep
+    dup node-key swap avl-node-balance ] unit-test
+
+! random testing uncovered this little bugger
+[ t t ] [ f "d" T{ avl-node
+              T{ node f "e" f
+                  T{ avl-node 
+                      T{ node f "b" f
+                          T{ avl-node T{ node f "a" } 0 }
+                          T{ avl-node T{ node f "c" f } 0 }
+                          0 }
+                      0 }
+                  T{ avl-node T{ node f "f" } 0 } }
+              -1 } node-set dup valid-avl-node? nip swap valid-node? ] unit-test
+
+[ "eight" ] [ <avl-tree> "seven" 7 pick tree-insert "eight" 8 pick tree-insert "nine" 9 pick tree-insert tree-root node-value ] unit-test
+[ "another eight" ] [ <avl-tree> "seven" 7 pick tree-set "eight" 8 pick tree-set "another eight" 8 pick tree-set 8 swap tree-get ] unit-test
+! [ <avl-tree> "seven" 7 pick tree-insert 
+[ t t ] [ <avl-tree> 3 increasing-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 9 increasing-tree dup valid-avl-tree? swap valid-tree? ] unit-test ! fails when tree growth isn't terminated after a rebalance
+[ t t ] [ <avl-tree> 10 increasing-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+
+[ t t ] [ <avl-tree> 3 decreasing-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 4 decreasing-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 5 decreasing-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 10 decreasing-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+
+[ t t ] [ <avl-tree> 5 random-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 19 random-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 30 random-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 82 random-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+[ t t ] [ <avl-tree> 100 random-tree dup valid-avl-tree? swap valid-tree? ] unit-test
+
+! borrowed from tests/bst.factor
+: test-tree ( -- tree )
+    <avl-tree>
+    "seven"          7 pick tree-insert
+    "nine"           9 pick tree-insert
+    "four"           4 pick tree-insert
+    "another four"   4 pick tree-insert
+    "replaced seven" 7 pick tree-set ;
+
+! test tree-insert, tree-set, tree-get, tree-get*, and tree-get-all
+[ "seven" ] [ <avl-tree> "seven" 7 pick tree-insert 7 swap tree-get ] unit-test
+[ "seven" t ] [ <avl-tree> "seven" 7 pick tree-insert 7 swap tree-get* ] unit-test
+[ f f ] [ <avl-tree> "seven" 7 pick tree-insert 8 swap tree-get* ] unit-test
+[ "seven" ] [ <avl-tree> "seven" 7 pick tree-set 7 swap tree-get ] unit-test
+[ "replacement" ] [ <avl-tree> "seven" 7 pick tree-insert "replacement" 7 pick tree-set 7 swap tree-get ] unit-test
+[ "nine" ] [ test-tree 9 swap tree-get ] unit-test
+[ t ] [ test-tree 4 swap tree-get-all { "another four" "four" } sequence= ] unit-test
+[ t ] [ test-tree 11 swap tree-get-all empty? ] unit-test
+[ t ] [ test-tree 7 swap tree-get-all { "replaced seven" } sequence= ] unit-test
+
+! test tree-delete
+[ f ] [ test-tree 9 over tree-delete 9 swap tree-get ] unit-test
+[ "replaced seven" ] [ test-tree 9 over tree-delete 7 swap tree-get ] unit-test
+[ f ] [ test-tree 4 over tree-delete-all 4 swap tree-get ] unit-test
+[ "nine" ] [ test-tree 7 over tree-delete 4 over tree-delete 9 swap tree-get ] unit-test
+[ "nine" ] [ test-tree 7 over tree-delete 4 over tree-delete-all 9 swap tree-get ] unit-test
+
+: test-random-deletions ( tree -- ? )
+    #! deletes one node at random from the tree, checking avl and tree
+    #! properties after each deletion, until the tree is empty
+    dup stump? [
+        drop t
+    ] [
+        dup tree-keys random over tree-delete dup valid-avl-tree? over valid-tree? and [
+            test-random-deletions
+        ] [
+            dup print-tree
+        ] if
+    ] if ;
+
+[ t ] [ <avl-tree> 5 random-tree test-random-deletions ] unit-test
+[ t ] [ <avl-tree> 30 random-tree test-random-deletions ] unit-test
+[ t ] [ <avl-tree> 100 random-tree test-random-deletions ] unit-test
+
diff --git a/extra/trees/avl-tree/avl-tree.factor b/extra/trees/avl-tree/avl-tree.factor
new file mode 100644 (file)
index 0000000..5392f9e
--- /dev/null
@@ -0,0 +1,174 @@
+! Copyright (C) 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel generic math namespaces io sequences ;
+IN: trees
+
+TUPLE: avl-tree ;
+
+C: avl-tree ( -- tree )
+    <tree> over set-delegate ;
+
+TUPLE: avl-node balance ;
+
+C: avl-node ( value key -- node )
+    >r <node> r> tuck set-delegate
+    0 over set-avl-node-balance ;
+
+M: avl-tree create-node ( value key tree -- node ) drop <avl-node> ;
+
+GENERIC: valid-avl-node? ( obj -- height valid? )
+
+M: f valid-avl-node? ( f -- height valid? ) drop 0 t ;
+
+: check-balance ( node left-height right-height -- node height valid? )
+    2dup max 1+ >r swap - over avl-node-balance = r> swap ;
+
+M: avl-node valid-avl-node? ( node -- height valid? )
+    #! check that this avl node has the right balance marked, and that it isn't unbalanced.
+    dup node-left valid-avl-node? >r over node-right valid-avl-node? >r
+    check-balance r> r> and and
+    rot avl-node-balance abs 2 < and ;
+
+: valid-avl-tree? ( tree -- valid? ) tree-root valid-avl-node? nip ;
+
+: change-balance ( node amount -- )
+    over avl-node-balance + swap set-avl-node-balance ;
+
+: rotate ( node -- node )
+    dup node+link dup node-link pick set-node+link tuck set-node-link ;    
+
+: single-rotate ( node -- node )
+    0 over set-avl-node-balance 0 over node+link set-avl-node-balance rotate ;
+
+: pick-balances ( a node -- balance balance )
+    avl-node-balance {
+        { [ dup zero? ] [ 2drop 0 0 ] }
+        { [ over = ] [ neg 0 ] }
+        { [ t ] [ 0 swap ] }
+    } cond ;
+
+: double-rotate ( node -- node )
+    [
+        node+link [
+            node-link current-side get neg over pick-balances rot 0 swap set-avl-node-balance
+        ] keep set-avl-node-balance
+    ] keep tuck set-avl-node-balance
+    dup node+link [ rotate ] with-other-side over set-node+link rotate ;
+
+: select-rotate ( node -- node )
+    dup node+link avl-node-balance current-side get = [ double-rotate ] [ single-rotate ] if ;
+
+: balance-insert ( node -- node taller? )
+    dup avl-node-balance {
+        { [ dup zero? ] [ drop f ] }
+        { [ dup abs 2 = ] [ sgn neg [ select-rotate ] with-side f ] }
+        { [ drop t ] [ t ] } ! balance is -1 or 1, tree is taller
+    } cond ;
+
+DEFER: avl-insert
+
+: avl-set ( value key node -- node taller? )
+    2dup node-key key= [
+        -rot pick set-node-key over set-node-value f
+    ] [ avl-insert ] if ;
+
+: avl-insert-or-set ( value key node -- node taller? )
+    "setting" get [ avl-set ] [ avl-insert ] if ;
+
+: (avl-insert) ( value key node -- node taller? )
+    [ avl-insert-or-set ] [ <avl-node> t ] if* ;
+
+: avl-insert ( value key node -- node taller? )
+    2dup node-key key< left right ? [
+        [ node-link (avl-insert) ] keep swap
+        >r tuck set-node-link r> [ dup current-side get change-balance balance-insert ] [ f ] if
+    ] with-side ;
+
+M: avl-node node-insert ( value key node -- node )
+    [ f "setting" set avl-insert-or-set ] with-scope drop ;
+
+M: avl-node node-set ( value key node -- node )
+    [ t "setting" set avl-insert-or-set ] with-scope drop ;
+
+: delete-select-rotate ( node -- node shorter? )
+    dup node+link avl-node-balance zero? [
+        current-side get neg over set-avl-node-balance
+        current-side get over node+link set-avl-node-balance rotate f
+    ] [
+        select-rotate t
+    ] if ;
+
+: rebalance-delete ( node -- node shorter? )
+    dup avl-node-balance {
+        { [ dup zero? ] [ drop t ] }
+        { [ dup abs 2 = ] [ sgn neg [ delete-select-rotate ] with-side ] }
+        { [ drop t ] [ f ] } ! balance is -1 or 1, tree is not shorter
+    } cond ;
+
+: balance-delete ( node -- node shorter? )
+    current-side get over avl-node-balance {
+        { [ dup zero? ] [ drop neg over set-avl-node-balance f ] }
+        { [ dupd = ] [ drop 0 over set-avl-node-balance t ] }
+        { [ t ] [ dupd neg change-balance rebalance-delete ] }
+    } cond ;
+
+: avl-replace-with-extremity ( to-replace node -- node shorter? )
+    dup node-link [
+        swapd avl-replace-with-extremity >r over set-node-link r> [ balance-delete ] [ f ] if
+    ] [
+        tuck copy-node-contents node+link t
+    ] if* ;
+
+: replace-with-a-child ( node -- node shorter? )
+    #! assumes that node is not a leaf, otherwise will recurse forever
+    dup node-link [
+        dupd [ avl-replace-with-extremity ] with-other-side >r over set-node-link r> [
+            balance-delete
+        ] [
+            f
+        ] if
+    ] [
+        [ replace-with-a-child ] with-other-side
+    ] if* ;
+
+: avl-delete-node ( node -- node shorter? )
+    #! delete this node, returning its replacement, and whether this subtree is
+    #! shorter as a result
+    dup leaf? [
+        drop f t
+    ] [
+        random-side [ replace-with-a-child ] with-side ! random not necessary, just for fun
+    ] if ;
+
+GENERIC: avl-delete ( key node -- node shorter? deleted? )
+
+M: f avl-delete ( key f -- f f f ) nip f f ;
+
+: (avl-delete) ( key node -- node shorter? deleted? )
+    tuck node-link avl-delete >r >r over set-node-link r> [ balance-delete r> ] [ f r> ] if ;
+
+M: avl-node avl-delete ( key node -- node shorter? deleted? )
+    2dup node-key key-side dup zero? [
+        drop nip avl-delete-node t
+    ] [
+        [
+            (avl-delete)
+        ] with-side
+    ] if ;
+
+M: avl-node node-delete ( key node -- node ) avl-delete 2drop ;
+
+M: avl-node node-delete-all ( key node -- node )
+    #! deletes until there are no more. not optimal.
+    dupd [ avl-delete nip ] with-scope [
+        node-delete-all
+    ] [
+        nip
+    ] if ;
+
+M: avl-node print-node ( depth node -- )
+    over 1+ over node-right print-node
+    over [ drop "   " write ] each
+    dup avl-node-balance number>string write " " write dup node-key number>string print
+    >r 1+ r> node-left print-node ;
+
diff --git a/extra/trees/bst/bst-tests.factor b/extra/trees/bst/bst-tests.factor
new file mode 100644 (file)
index 0000000..c691a18
--- /dev/null
@@ -0,0 +1,45 @@
+USING: trees test kernel sequences ;
+IN: temporary
+
+: test-tree ( -- tree )
+    <bst>
+    "seven"          7 pick tree-insert
+    "nine"           9 pick tree-insert
+    "four"           4 pick tree-insert
+    "another four"   4 pick tree-insert
+    "replaced seven" 7 pick tree-set ;
+
+! test tree-insert, tree-set, tree-get, tree-get*, and tree-get-all
+[ "seven" ] [ <bst> "seven" 7 pick tree-insert 7 swap tree-get ] unit-test
+[ "seven" t ] [ <bst> "seven" 7 pick tree-insert 7 swap tree-get* ] unit-test
+[ f f ] [ <bst> "seven" 7 pick tree-insert 8 swap tree-get* ] unit-test
+[ "seven" ] [ <bst> "seven" 7 pick tree-set 7 swap tree-get ] unit-test
+[ "replacement" ] [ <bst> "seven" 7 pick tree-insert "replacement" 7 pick tree-set 7 swap tree-get ] unit-test
+[ "four" ] [ test-tree 4 swap tree-get ] unit-test
+[ "nine" ] [ test-tree 9 swap tree-get ] unit-test
+[ t ] [ test-tree 4 swap tree-get-all { "another four" "four" } sequence= ] unit-test
+[ t ] [ test-tree 11 swap tree-get-all empty? ] unit-test
+[ t ] [ test-tree 7 swap tree-get-all { "replaced seven" } sequence= ] unit-test
+
+! test tree-delete
+[ f ] [ test-tree 9 over tree-delete 9 swap tree-get ] unit-test
+[ "replaced seven" ] [ test-tree 9 over tree-delete 7 swap tree-get ] unit-test
+[ "four" ] [ test-tree 9 over tree-delete 4 swap tree-get ] unit-test
+! TODO: sometimes this shows up as "another four" because of randomisation
+! [ "nine" "four" ] [ test-tree 7 over tree-delete 9 over tree-get 4 rot tree-get ] unit-test
+! [ "another four" ] [ test-tree 4 over tree-delete 4 swap tree-get ] unit-test
+[ f ] [ test-tree 4 over tree-delete-all 4 swap tree-get ] unit-test
+[ "nine" ] [ test-tree 7 over tree-delete 4 over tree-delete 9 swap tree-get ] unit-test
+[ "nine" ] [ test-tree 7 over tree-delete 4 over tree-delete-all 9 swap tree-get ] unit-test
+
+! test valid-node?
+[ t ] [ T{ node f 0 } valid-node? ] unit-test
+[ t ] [ T{ node f 0 f T{ node f -1 } } valid-node? ] unit-test
+[ t ] [ T{ node f 0 f f T{ node f 1 } } valid-node? ] unit-test
+[ t ] [ T{ node f 0 f T{ node f -1 } T{ node f 1 } } valid-node? ] unit-test
+[ f ] [ T{ node f 0 f T{ node f 1 } } valid-node? ] unit-test
+[ f ] [ T{ node f 0 f f T{ node f -1 } } valid-node? ] unit-test
+
+! random testing
+[ t ] [ <bst> 10 random-tree valid-tree? ] unit-test
+
diff --git a/extra/trees/bst/bst.factor b/extra/trees/bst/bst.factor
new file mode 100644 (file)
index 0000000..8abf501
--- /dev/null
@@ -0,0 +1,87 @@
+! Copyright (C) 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel generic math ;
+IN: trees
+
+TUPLE: bst ;
+
+C: bst ( -- tree ) <tree> over set-delegate ;
+
+TUPLE: bst-node ;
+
+C: bst-node ( value key -- node ) >r <node> r> tuck set-delegate ;
+
+M: bst create-node ( value key tree -- node ) drop <bst-node> ;
+
+M: bst-node node-insert ( value key node -- node )
+    2dup node-key key-side [
+        [ node-link [ node-insert ] [ <bst-node> ] if* ] keep tuck set-node-link 
+    ] with-side ;
+
+M: bst-node node-set ( value key node -- node )
+    2dup node-key key-side dup 0 = [
+        drop nip [ set-node-value ] keep
+    ] [
+        [ [ node-link [ node-set ] [ <bst-node> ] if* ] keep tuck set-node-link ] with-side
+    ] if ;
+
+DEFER: delete-node
+
+: (prune-extremity) ( parent node -- new-extremity )
+    dup node-link [
+        rot drop (prune-extremity)
+    ] [
+        tuck delete-node swap set-node-link
+    ] if* ;
+
+: prune-extremity ( node -- new-extremity )
+    #! remove and return the leftmost or rightmost child of this node.
+    #! assumes at least one child
+    dup node-link (prune-extremity) ;
+
+: replace-with-child ( node -- node )
+    dup dup node-link copy-node-contents dup node-link delete-node over set-node-link ;
+
+: replace-with-extremity ( node -- node )
+    dup node-link dup node+link [
+        ! predecessor/successor is not the immediate child
+        [ prune-extremity ] with-other-side dupd copy-node-contents
+    ] [
+        ! node-link is the predecessor/successor
+        drop replace-with-child
+    ] if ;
+
+: delete-node-with-two-children ( node -- node )
+    #! randomised to minimise tree unbalancing
+    random-side [ replace-with-extremity ] with-side ;
+
+: delete-node ( node -- node )
+    #! delete this node, returning its replacement
+    dup node-left [
+        dup node-right [
+            delete-node-with-two-children
+        ] [
+            node-left ! left but no right
+        ] if
+    ] [
+        dup node-right [
+            node-right ! right but not left
+        ] [
+            drop f ! no children
+        ] if
+    ] if ;
+
+M: bst-node node-delete ( key node -- node )
+    2dup node-key key-side dup zero? [
+        drop nip delete-node
+    ] [
+        [ tuck node-link node-delete over set-node-link ] with-side
+    ] if ;
+
+M: bst-node node-delete-all ( key node -- node )
+    2dup node-key key-side dup zero? [
+        drop delete-node node-delete-all
+    ] [
+        [ tuck node-link node-delete-all over set-node-link ] with-side
+    ] if ;
+
diff --git a/extra/trees/summary.txt b/extra/trees/summary.txt
new file mode 100644 (file)
index 0000000..cf7b64c
--- /dev/null
@@ -0,0 +1 @@
+Binary search and avl (balanced) trees
diff --git a/extra/trees/tags.txt b/extra/trees/tags.txt
new file mode 100644 (file)
index 0000000..f73c343
--- /dev/null
@@ -0,0 +1 @@
+collections trees
diff --git a/extra/trees/trees.factor b/extra/trees/trees.factor
new file mode 100644 (file)
index 0000000..cb7aa57
--- /dev/null
@@ -0,0 +1,193 @@
+! Copyright (C) 2007 Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel generic math sequences arrays io namespaces kernel-internals ;
+IN: trees
+
+TUPLE: tree root ;
+
+C: tree ( -- tree ) ;
+
+TUPLE: node key value left right ;
+
+C: node ( value key -- node )
+    [ set-node-key ] keep
+    [ set-node-value ] keep
+    f over 2dup set-node-left set-node-right ;
+
+SYMBOL: current-side
+
+: left -1 ; inline
+: right 1 ; inline
+
+: go-left? ( -- ? ) current-side get left = ;
+
+: node-link@ ( -- ? quot quot ) go-left? [ node-left ] [ node-right ] ; inline
+: set-node-link@ ( -- ? quot quot ) go-left? [ set-node-left ] [ set-node-right ] ; inline
+
+: node-link ( node -- child ) node-link@ if ;
+: set-node-link ( child node -- ) set-node-link@ if ;
+: node+link ( node -- child ) node-link@ swap if ;
+: set-node+link ( child node -- ) set-node-link@ swap if ;
+
+: with-side ( side quot -- ) H{ } clone >n swap current-side set call ndrop ; inline
+: with-other-side ( quot -- ) current-side get neg swap with-side ; inline
+: go-left ( quot -- ) left swap with-side ; inline
+: go-right ( quot -- ) right swap with-side ; inline
+
+GENERIC: create-node ( value key tree -- node )
+
+GENERIC: copy-node-contents ( new old -- )
+
+M: node copy-node-contents ( new old -- )
+    #! copy old's key and value into new (keeping children and parent)
+    dup node-key pick set-node-key node-value swap set-node-value ;
+
+M: tree create-node ( value key tree -- node ) drop <node> ;
+
+: key-side ( k1 k2 -- side )
+    #! side is -1 if k1 < k2, 0 if they are equal, or 1 if k1 > k2
+    <=> sgn ;
+
+: key< ( k1 k2 -- ? ) <=> 0 < ;
+: key> ( k1 k2 -- ? ) <=> 0 > ;
+: key= ( k1 k2 -- ? ) <=> zero? ;
+
+: random-side ( -- side ) left right 2array random ;
+
+: choose-branch ( key node -- key node-left/right )
+    2dup node-key key-side [ node-link ] with-side ;
+
+GENERIC: node-get ( key node -- value )
+
+: tree-get ( key tree -- value ) tree-root node-get ;
+
+M: node node-get ( key node -- value )
+    2dup node-key key= [
+        nip node-value
+    ] [
+        choose-branch node-get
+    ] if ;
+
+M: f node-get ( key f -- f ) nip ;
+
+GENERIC: node-get* ( key node -- value ? )
+
+: tree-get* ( key tree -- value ? ) tree-root node-get* ;
+
+M: node node-get* ( key node -- value ? )
+    2dup node-key key= [
+        nip node-value t
+    ] [
+        choose-branch node-get*
+    ] if ;
+
+M: f node-get* ( key f -- f f ) nip f ;
+
+GENERIC: node-get-all ( key node -- seq )
+
+: tree-get-all ( key tree -- seq ) tree-root node-get-all ;
+
+M: f node-get-all ( key f -- V{} ) 2drop V{ } clone ;
+
+M: node node-get-all ( key node -- seq )
+    2dup node-key key= [
+        ! duplicate keys are stored to the right because of choose-branch
+        2dup node-right node-get-all >r nip node-value r> tuck push
+    ] [
+        choose-branch node-get-all
+    ] if ;
+
+GENERIC: node-insert ( value key node -- node ) ! can add duplicates
+
+: tree-insert ( value key tree -- )
+    [ dup tree-root [ nip node-insert ] [ create-node ] if* ] keep set-tree-root ;
+
+GENERIC: node-set ( value key node -- node )
+    #! note that this only sets the first node with this key. if more than one
+    #! has been inserted then the others won't be modified. (should they be deleted?)
+
+: tree-set ( value key tree -- )
+    [ dup tree-root [ nip node-set ] [ create-node ] if* ] keep set-tree-root ;
+
+GENERIC: node-delete ( key node -- node )
+
+: tree-delete ( key tree -- )
+    [ tree-root node-delete ] keep set-tree-root ;
+
+GENERIC: node-delete-all ( key node -- node )
+
+M: f node-delete-all ( key f -- f ) nip ;
+
+: tree-delete-all ( key tree -- )
+    [ tree-root node-delete-all ] keep set-tree-root ;
+
+: node-map-link ( node quot -- node )
+    over node-link swap call over set-node-link ;
+
+: node-map ( node quot -- node )
+    over [
+        tuck [ node-map-link ] go-left over call swap [ node-map-link ] go-right
+    ] [
+        drop
+    ] if ;
+
+: tree-map ( tree quot -- )
+    #! apply quot to each element of the tree, in order
+    over tree-root swap node-map swap set-tree-root ;
+
+: node>node-seq ( node -- seq )
+    dup [
+        dup node-left node>node-seq over 1array rot node-right node>node-seq 3append
+    ] when ;
+
+: tree>node-seq ( tree -- seq )
+    tree-root node>node-seq ;
+
+: tree-keys ( tree -- keys )
+    tree>node-seq [ node-key ] map ;
+
+: tree-values ( tree -- values )
+    tree>node-seq [ node-value ] map ;
+
+: leaf? ( node -- ? )
+    dup node-left swap node-right or not ;
+
+GENERIC: valid-node? ( node -- ? )
+
+M: f valid-node? ( f -- t ) not ;
+
+M: node valid-node? ( node -- ? )
+    dup dup node-left [ node-key swap node-key key< ] when* >r
+    dup dup node-right [ node-key swap node-key key> ] when* r> and swap
+    dup node-left valid-node? swap node-right valid-node? and and ;
+
+: valid-tree? ( tree -- ? ) tree-root valid-node? ;
+
+DEFER: print-tree
+
+: random-tree ( tree size -- tree )
+    [ most-positive-fixnum random pick tree-set ] each ;
+
+: increasing-tree ( tree size -- tree )
+    [ dup pick tree-set ] each ;
+
+: decreasing-tree ( tree size -- tree )
+    reverse increasing-tree ;
+
+GENERIC: print-node ( depth node -- )
+
+M: f print-node ( depth f -- ) 2drop ;
+
+M: node print-node ( depth node -- )
+    ! not pretty, but ok for debugging
+    over 1+ over node-right print-node
+    over [ drop "   " write ] each dup node-key number>string print
+    >r 1+ r> node-left print-node ;
+
+: print-tree ( tree -- )
+    tree-root 1 swap print-node ;
+
+: stump? ( tree -- ? )
+    #! is this tree empty?
+    tree-root not ;
+
diff --git a/extra/tty-server/authors.txt b/extra/tty-server/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/tty-server/summary.txt b/extra/tty-server/summary.txt
new file mode 100644 (file)
index 0000000..e3f5c0c
--- /dev/null
@@ -0,0 +1 @@
+Connect to a Factor listener through telnet
diff --git a/extra/tty-server/tags.txt b/extra/tty-server/tags.txt
new file mode 100644 (file)
index 0000000..587fb22
--- /dev/null
@@ -0,0 +1,4 @@
+tools
+applications
+demos
+networking
diff --git a/extra/tty-server/tty-server.factor b/extra/tty-server/tty-server.factor
new file mode 100644 (file)
index 0000000..f71265e
--- /dev/null
@@ -0,0 +1,11 @@
+USING: listener io.server ;
+IN: tty-server
+
+: tty-server ( port -- )
+    local-server
+    "tty-server"
+    [ listener ] with-server ;
+
+: default-tty-server 9999 tty-server ;
+
+MAIN: default-tty-server
\ No newline at end of file
diff --git a/extra/tuple-arrays/authors.txt b/extra/tuple-arrays/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/tuple-arrays/summary.txt b/extra/tuple-arrays/summary.txt
new file mode 100644 (file)
index 0000000..ac05ae9
--- /dev/null
@@ -0,0 +1 @@
+Packed homogeneous tuple arrays
diff --git a/extra/tuple-arrays/tags.txt b/extra/tuple-arrays/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/extra/tuple-arrays/tuple-arrays-docs.factor b/extra/tuple-arrays/tuple-arrays-docs.factor
new file mode 100644 (file)
index 0000000..a90068e
--- /dev/null
@@ -0,0 +1,8 @@
+USING: help.syntax help.markup tuple-arrays splitting kernel ;
+
+HELP: tuple-array
+{ $description "The class of packed homogeneous tuple arrays. They are created with " { $link <tuple-array> } ". All elements are of the same tuple class. Mutations done to an element are not copied back to the packed array unless it is explicitly written back. Packed follows the sequence protocol and is implemented using the " { $link groups } " class." } ;
+
+HELP: <tuple-array>
+{ $values { "example" tuple } { "length" "a non-negative integer" } { "tuple-array" tuple-array } }
+{ $description "Creates an instance of the " { $link <tuple-array> } " class with the given length and containing the given tuple class. The tuple class is specified in the form of an example tuple. If the example tuple has a delegate, the tuple array will store a delegate for each element. Otherwise, the delegate will be assumed to be f." } ;
diff --git a/extra/tuple-arrays/tuple-arrays-tests.factor b/extra/tuple-arrays/tuple-arrays-tests.factor
new file mode 100644 (file)
index 0000000..dfe9002
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tuple-arrays sequences tools.test namespaces kernel math ;
+
+SYMBOL: mat
+TUPLE: foo bar ;
+C: <foo> foo
+[ 2 ] [ 2 T{ foo } <tuple-array> dup mat set length ] unit-test
+[ T{ foo } ] [ mat get first ] unit-test
+[ T{ foo f 1 } ] [ T{ foo 2 1 } 0 mat get [ set-nth ] keep first ] unit-test
+[ t ] [ { T{ foo f 1 } T{ foo f 2 } } >tuple-array dup mat set tuple-array? ] unit-test
+[ T{ foo f 3 } t ] 
+[ mat get [ foo-bar 2 + <foo> ] map [ first ] keep tuple-array? ] unit-test
+
+[ 2 ] [ 2 T{ foo t } <tuple-array> dup mat set length ] unit-test
+[ T{ foo } ] [ mat get first ] unit-test
+[ T{ foo 2 1 } ] [ T{ foo 2 1 } 0 mat get [ set-nth ] keep first ] unit-test
diff --git a/extra/tuple-arrays/tuple-arrays.factor b/extra/tuple-arrays/tuple-arrays.factor
new file mode 100644 (file)
index 0000000..7a1df7a
--- /dev/null
@@ -0,0 +1,41 @@
+! Copyright (C) 2007 Daniel Ehrenberg.
+! See http://factorcode.org/license.txt for BSD license.
+USING: splitting tuples classes math kernel sequences arrays ;
+IN: tuple-arrays
+
+TUPLE: tuple-array example ;
+
+: prepare-example ( tuple -- seq n )
+    dup class over delegate [ 1array ] [ f 2array ] if
+    swap tuple>array length over length - ;
+
+: <tuple-array> ( length example -- tuple-array )
+    prepare-example [ rot * { } new ] keep
+    <sliced-groups> tuple-array construct-delegate
+    [ set-tuple-array-example ] keep ;
+
+: reconstruct ( seq example -- tuple )
+    swap append >tuple ;
+
+M: tuple-array nth
+    [ delegate nth ] keep
+    tuple-array-example reconstruct ;
+
+: deconstruct ( tuple example -- seq )
+    >r tuple>array r> length tail-slice ;
+
+M: tuple-array set-nth ( elt n seq -- )
+    tuck >r >r tuple-array-example deconstruct r> r>
+    delegate set-nth ;
+
+M: tuple-array new tuple-array-example >tuple <tuple-array> ;
+
+: >tuple-array ( seq -- tuple-array/seq )
+    dup empty? [
+        0 over first <tuple-array> clone-like
+    ] unless ;
+
+M: tuple-array like 
+    drop dup tuple-array? [ >tuple-array ] unless ;
+
+INSTANCE: tuple-array sequence
diff --git a/extra/tuples/lib/authors.txt b/extra/tuples/lib/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/tuples/lib/lib-docs.factor b/extra/tuples/lib/lib-docs.factor
new file mode 100644 (file)
index 0000000..040ef35
--- /dev/null
@@ -0,0 +1,25 @@
+USING: help.syntax help.markup kernel prettyprint sequences ;
+IN: tuples.lib
+
+HELP: >tuple<
+{ $values { "class" "a tuple class" } }
+{ $description "Explodes the tuple so that tuple slots are on the stack in the order listed in the tuple." }
+{ $example
+    "TUPLE: foo a b c ;"
+    "1 2 3 \\ foo construct-boa \\ foo >tuple< .s"
+    "1\n2\n3"
+}
+{ $notes "Words using " { $snippet ">tuple<" } " may be compiled." }
+{ $see-also >tuple*< } ;
+
+HELP: >tuple*<
+{ $values { "class" "a tuple class" } }
+{ $description "Explodes the tuple so that tuple slots ending with '*' are on the stack in the order listed in the tuple." }
+{ $example
+    "TUPLE: foo a bb* ccc dddd* ;"
+    "1 2 3 4 \\ foo construct-boa \\ foo >tuple*< .s"
+    "2\n4"
+}
+{ $notes "Words using " { $snippet ">tuple*<" } " may be compiled." }
+{ $see-also >tuple< } ;
+
diff --git a/extra/tuples/lib/lib-tests.factor b/extra/tuples/lib/lib-tests.factor
new file mode 100644 (file)
index 0000000..88c09d8
--- /dev/null
@@ -0,0 +1,8 @@
+USING: kernel tools.test tuples.lib ;
+IN: temporary
+
+TUPLE: foo a b* c d* e f* ;
+
+[ 1 2 3 4 5 6 ] [ 1 2 3 4 5 6 \ foo construct-boa \ foo >tuple< ] unit-test
+[ 2 4 6 ] [ 1 2 3 4 5 6 \ foo construct-boa \ foo >tuple*< ] unit-test
+
diff --git a/extra/tuples/lib/lib.factor b/extra/tuples/lib/lib.factor
new file mode 100644 (file)
index 0000000..5075c1d
--- /dev/null
@@ -0,0 +1,17 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel macros sequences slots words ;
+IN: tuples.lib
+
+: reader-slots ( seq -- quot )
+    [ slot-spec-reader ] map [ get-slots ] curry ;
+
+MACRO: >tuple< ( class -- )
+    "slots" word-prop 1 tail-slice reader-slots ;
+
+MACRO: >tuple*< ( class -- )
+    "slots" word-prop
+    [ slot-spec-name "*" tail? ] subset
+    reader-slots ;
+
+
diff --git a/extra/turing/authors.txt b/extra/turing/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/turing/summary.txt b/extra/turing/summary.txt
new file mode 100644 (file)
index 0000000..3cc4ec0
--- /dev/null
@@ -0,0 +1 @@
+Turing machine simulator
diff --git a/extra/turing/tags.txt b/extra/turing/tags.txt
new file mode 100644 (file)
index 0000000..cb5fc20
--- /dev/null
@@ -0,0 +1 @@
+demos
diff --git a/extra/turing/turing.factor b/extra/turing/turing.factor
new file mode 100644 (file)
index 0000000..0dc90d8
--- /dev/null
@@ -0,0 +1,70 @@
+IN: turing
+USING: arrays assocs io kernel math namespaces
+prettyprint sequences strings vectors words ;
+
+! A turing machine simulator.
+
+TUPLE: state sym dir next ;
+
+! Mapping from symbol/state pairs into new-state tuples
+SYMBOL: states
+
+! Halting state
+SYMBOL: halt
+
+! This is a simple program that outputs 5 1's
+H{
+    { { 1 0 } T{ state f 1  1 2    } }
+    { { 2 0 } T{ state f 1  1 3    } }
+    { { 3 0 } T{ state f 1 -1 1    } }
+    { { 1 1 } T{ state f 1 -1 2    } }
+    { { 2 1 } T{ state f 1 -1 3    } }
+    { { 3 1 } T{ state f 1 -1 halt } }
+} states set
+
+! Current state
+SYMBOL: state
+
+! Initial state
+1 state set
+
+! Position of head on tape
+SYMBOL: position
+
+! Initial tape position
+5 position set
+
+! The tape, a mutable sequence of some kind
+SYMBOL: tape
+
+! Initial tape
+20 0 <array> >vector tape set
+
+: sym ( -- sym )
+    #! Symbol at head position.
+    position get tape get nth ;
+
+: set-sym ( sym -- )
+    #! Set symbol at head position.
+    position get tape get set-nth ;
+
+: next-state ( -- state )
+    #! Look up the next state/symbol/direction triplet.
+    state get sym 2array states get at ;
+
+: turing-step ( -- )
+    #! Do one step of the turing machine.
+    next-state
+    dup state-sym set-sym
+    dup state-dir position [ + ] change
+    state-next state set ;
+
+: c
+    #! Print current turing machine state.
+    state get .
+    tape get .
+    2 position get 2 * + CHAR: \s <string> write "^" print ;
+
+: n
+    #! Do one step and print new state.
+    turing-step c ;
diff --git a/extra/turtle/authors.txt b/extra/turtle/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/turtle/turtle.factor b/extra/turtle/turtle.factor
new file mode 100644 (file)
index 0000000..b9a9323
--- /dev/null
@@ -0,0 +1,47 @@
+
+USING: kernel math arrays math.vectors math.matrices generic.lib pos ori ;
+
+IN: turtle
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: turtle ;
+
+: <turtle> ( -- turtle )
+turtle construct-empty
+{ 0 0 0 } clone <pos>
+3 identity-matrix <ori>
+rot
+3array chain ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: reset-turtle ( -- ) { 0 0 0 } >pos 3 identity-matrix >ori ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: step-vector ( length -- array ) { 0 0 1 } n*v ;
+
+: step-turtle ( length -- ) step-vector ori> swap m.v pos> v+ >pos ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: strafe-up ( length -- )
+90 pitch-up
+step-turtle
+90 pitch-down ;
+
+: strafe-down ( length -- )
+90 pitch-down
+step-turtle
+90 pitch-up ;
+
+: strafe-left ( length -- )
+90 turn-left
+step-turtle
+90 turn-right ;
+
+: strafe-right ( length -- )
+90 turn-right
+step-turtle
+90 turn-left ;
diff --git a/extra/ui/authors.txt b/extra/ui/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/backend/authors.txt b/extra/ui/backend/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/backend/backend.factor b/extra/ui/backend/backend.factor
new file mode 100644 (file)
index 0000000..09ce182
--- /dev/null
@@ -0,0 +1,20 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel namespaces opengl opengl.gl ;
+IN: ui.backend
+
+SYMBOL: ui-backend
+
+HOOK: set-title ui-backend ( string world -- )
+
+HOOK: (open-world-window) ui-backend ( world -- )
+
+HOOK: raise-window ui-backend ( world -- )
+
+HOOK: select-gl-context ui-backend ( handle -- )
+
+HOOK: flush-gl-context ui-backend ( handle -- )
+
+: with-gl-context ( handle quot -- )
+    swap [ select-gl-context call ] keep
+    glFlush flush-gl-context gl-error ; inline
diff --git a/extra/ui/backend/summary.txt b/extra/ui/backend/summary.txt
new file mode 100644 (file)
index 0000000..5190a30
--- /dev/null
@@ -0,0 +1 @@
+UI backend hooks
diff --git a/extra/ui/clipboards/authors.txt b/extra/ui/clipboards/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/clipboards/clipboards-docs.factor b/extra/ui/clipboards/clipboards-docs.factor
new file mode 100644 (file)
index 0000000..1b8121c
--- /dev/null
@@ -0,0 +1,33 @@
+USING: ui.gadgets ui.gestures help.markup help.syntax strings ;
+IN: ui.clipboards
+
+HELP: clipboard
+{ $var-description "Global variable holding the system clipboard. By convention, text should only be copied to the clipboard via an explicit user action, for example by pressing " { $snippet "C+c" } "." }
+{ $class-description "A mutable container for a single string implementing the " { $link "clipboard-protocol" } "." } ;
+
+HELP: paste-clipboard
+{ $values { "gadget" gadget } { "clipboard" "an object" } }
+{ $contract "Arranges for the contents of the clipboard to be inserted into the gadget at some point in the near future via a call to " { $link user-input } ". The gadget must be grafted." } ;
+
+HELP: copy-clipboard
+{ $values { "string" string } { "gadget" gadget } { "clipboard" "an object" } }
+{ $contract "Arranges for the string to be copied to the clipboard on behalf of the gadget. The gadget must be grafted." } ;
+
+HELP: selection
+{ $var-description "Global variable holding the system selection. By convention, text should be copied to the selection as soon as it is selected by the user." } ;
+
+ARTICLE: "clipboard-protocol" "Clipboard protocol"
+"Custom gadgets that wish to interact with the clipboard must use the following two generic words to read and write clipboard contents:"
+{ $subsection paste-clipboard }
+{ $subsection copy-clipboard }
+"UI backends can either implement the above two words in the case of an asynchronous clipboard model (for example, X11). If direct access to the clipboard is provided (Windows, Mac OS X), the following two generic words may be implemented instead:"
+{ $subsection clipboard-contents }
+{ $subsection set-clipboard-contents }
+"However, gadgets should not call these words, since they will fail if only the asynchronous method of clipboard access is supported by the backend in use."
+$nl
+"Access to two clipboards is provided:"
+{ $subsection clipboard }
+{ $subsection selection }
+"These variables may contain clipboard protocol implementations which transfer data to and from the native system clipboard. However an UI backend may leave one or both of these variables in their default state, which is a trivial clipboard implementation internal to the Factor UI." ;
+
+ABOUT: "clipboard-protocol"
diff --git a/extra/ui/clipboards/clipboards.factor b/extra/ui/clipboards/clipboards.factor
new file mode 100644 (file)
index 0000000..fa6cc75
--- /dev/null
@@ -0,0 +1,31 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel ui.gadgets ui.gestures namespaces ;
+IN: ui.clipboards
+
+! Two text transfer buffers
+TUPLE: clipboard contents ;
+: <clipboard> "" clipboard construct-boa ;
+
+GENERIC: paste-clipboard ( gadget clipboard -- )
+
+M: object paste-clipboard
+    clipboard-contents dup [ swap user-input ] [ 2drop ] if ;
+
+GENERIC: copy-clipboard ( string gadget clipboard -- )
+
+M: object copy-clipboard nip set-clipboard-contents ;
+
+SYMBOL: clipboard
+SYMBOL: selection
+
+: gadget-copy ( gadget clipboard -- )
+    over gadget-selection? [
+        >r [ gadget-selection ] keep r> copy-clipboard
+    ] [
+        2drop
+    ] if ;
+
+: com-copy clipboard get gadget-copy ;
+
+: com-copy-selection selection get gadget-copy ;
diff --git a/extra/ui/clipboards/summary.txt b/extra/ui/clipboards/summary.txt
new file mode 100644 (file)
index 0000000..b48f06f
--- /dev/null
@@ -0,0 +1 @@
+Abstract clipboard support
diff --git a/extra/ui/cocoa/authors.txt b/extra/ui/cocoa/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/cocoa/cocoa.factor b/extra/ui/cocoa/cocoa.factor
new file mode 100644 (file)
index 0000000..c7a4b62
--- /dev/null
@@ -0,0 +1,96 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays cocoa cocoa.application command-line
+kernel memory namespaces cocoa.messages cocoa.runtime
+cocoa.subclassing cocoa.pasteboard cocoa.types cocoa.windows
+cocoa.classes cocoa.application sequences system ui ui.backend
+ui.clipboards ui.gadgets ui.gadgets.worlds ui.cocoa.views
+core-foundation ;
+IN: ui.cocoa
+
+TUPLE: cocoa-ui-backend ;
+
+SYMBOL: stop-after-last-window?
+
+: event-loop? ( -- ? )
+    stop-after-last-window? get-global
+    [ windows get-global empty? not ] [ t ] if ;
+
+: event-loop ( -- )
+    event-loop? [
+        [
+            [ NSApp do-events ui-step ] ui-try
+        ] with-autorelease-pool event-loop
+    ] when ;
+
+TUPLE: pasteboard handle ;
+
+C: <pasteboard> pasteboard
+
+M: pasteboard clipboard-contents
+    pasteboard-handle pasteboard-string ;
+
+M: pasteboard set-clipboard-contents
+    pasteboard-handle set-pasteboard-string ;
+
+: init-clipboard ( -- )
+    NSPasteboard -> generalPasteboard <pasteboard>
+    clipboard set-global
+    <clipboard> selection set-global ;
+
+: world>NSRect ( world -- NSRect )
+    dup world-loc first2 rot rect-dim first2 <NSRect> ;
+
+: gadget-window ( world -- )
+    [
+        dup <FactorView>
+        dup rot world>NSRect <ViewWindow>
+        dup install-window-delegate
+        over -> release
+        2array
+    ] keep set-world-handle ;
+
+M: cocoa-ui-backend set-title ( string world -- )
+    world-handle second swap <NSString> -> setTitle: ;
+
+: auto-position ( world -- )
+    dup world-loc { 0 0 } = [
+        world-handle second -> center
+    ] [
+        drop
+    ] if ;
+
+M: cocoa-ui-backend (open-world-window) ( world -- )
+    dup gadget-window
+    dup start-world
+    dup auto-position
+    world-handle second f -> makeKeyAndOrderFront: ;
+
+M: cocoa-ui-backend raise-window ( world -- )
+    world-handle [
+        second dup f -> orderFront: -> makeKeyWindow
+        NSApp 1 -> activateIgnoringOtherApps:
+    ] when* ;
+
+M: cocoa-ui-backend select-gl-context ( handle -- )
+    first -> openGLContext -> makeCurrentContext ;
+
+M: cocoa-ui-backend flush-gl-context ( handle -- )
+    first -> openGLContext -> flushBuffer ;
+
+SYMBOL: cocoa-init-hook
+
+M: cocoa-ui-backend ui
+    "UI" assert.app [
+        [
+            init-clipboard
+            cocoa-init-hook get [ call ] when*
+            start-ui
+            finish-launching
+            event-loop
+        ] ui-running
+    ] with-cocoa ;
+
+T{ cocoa-ui-backend } ui-backend set-global
+
+[ running.app? "ui" "listener" ? ] main-vocab-hook set-global
diff --git a/extra/ui/cocoa/summary.txt b/extra/ui/cocoa/summary.txt
new file mode 100644 (file)
index 0000000..dc5a8b5
--- /dev/null
@@ -0,0 +1 @@
+Cocoa UI backend
diff --git a/extra/ui/cocoa/tools/authors.txt b/extra/ui/cocoa/tools/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/cocoa/tools/summary.txt b/extra/ui/cocoa/tools/summary.txt
new file mode 100644 (file)
index 0000000..8441c02
--- /dev/null
@@ -0,0 +1 @@
+Cocoa integration for UI developer tools
diff --git a/extra/ui/cocoa/tools/tools.factor b/extra/ui/cocoa/tools/tools.factor
new file mode 100644 (file)
index 0000000..3ff34f6
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax cocoa cocoa.nibs cocoa.application
+cocoa.classes cocoa.dialogs cocoa.pasteboard cocoa.subclassing
+core-foundation help.topics kernel memory namespaces parser
+system ui ui.tools.browser ui.tools.listener ui.tools.workspace
+ui.cocoa ;
+IN: ui.cocoa.tools
+
+: finder-run-files ( alien -- )
+    CF>string-array listener-run-files
+    NSApp NSApplicationDelegateReplySuccess
+    -> replyToOpenOrPrint: ;
+
+: menu-run-files ( -- )
+    open-panel [ listener-run-files ] when* ;
+
+: menu-save-image ( -- )
+    image save-panel [ save-image ] when* ;
+
+! Handle Open events from the Finder
+CLASS: {
+    { +superclass+ "NSObject" }
+    { +name+ "FactorApplicationDelegate" }
+}
+
+{ "application:openFiles:" "void" { "id" "SEL" "id" "id" }
+    [ >r 3drop r> finder-run-files ]
+}
+
+{ "newFactorWorkspace:" "id" { "id" "SEL" "id" }
+    [ 3drop workspace-window f ]
+}
+
+{ "runFactorFile:" "id" { "id" "SEL" "id" }
+    [ 3drop menu-run-files f ]
+}
+
+{ "saveFactorImage:" "id" { "id" "SEL" "id" }
+    [ 3drop save f ]
+}
+
+{ "saveFactorImageAs:" "id" { "id" "SEL" "id" }
+    [ 3drop menu-save-image f ]
+}
+
+{ "showFactorHelp:" "id" { "id" "SEL" "id" }
+    [ 3drop "handbook" com-follow f ]
+} ;
+
+: install-app-delegate ( -- )
+    NSApp FactorApplicationDelegate install-delegate ;
+
+! Service support; evaluate Factor code from other apps
+: do-service ( pboard error quot -- )
+    pick >r >r
+    ?pasteboard-string dup [ r> call ] [ r> 2drop f ] if
+    dup [ r> set-pasteboard-string ] [ r> 2drop ] if ;
+
+CLASS: {
+    { +superclass+ "NSObject" }
+    { +name+ "FactorServiceProvider" }
+} {
+    "evalInListener:userData:error:"
+    "void"
+    { "id" "SEL" "id" "id" "void*" }
+    [ nip [ eval-listener f ] do-service 2drop ]
+} {
+    "evalToString:userData:error:"
+    "void"
+    { "id" "SEL" "id" "id" "void*" }
+    [ nip [ eval>string ] do-service 2drop ]
+} ;
+
+: register-services ( -- )
+    NSApp
+    FactorServiceProvider -> alloc -> init
+    -> setServicesProvider: ;
+
+FUNCTION: void NSUpdateDynamicServices ;
+
+[
+    install-app-delegate
+    "Factor.nib" load-nib
+    register-services
+] cocoa-init-hook set-global
diff --git a/extra/ui/cocoa/views/authors.txt b/extra/ui/cocoa/views/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/cocoa/views/summary.txt b/extra/ui/cocoa/views/summary.txt
new file mode 100644 (file)
index 0000000..afbfa2a
--- /dev/null
@@ -0,0 +1 @@
+Cocoa NSView implementation displaying Factor gadgets
diff --git a/extra/ui/cocoa/views/views.factor b/extra/ui/cocoa/views/views.factor
new file mode 100644 (file)
index 0000000..31d6c89
--- /dev/null
@@ -0,0 +1,353 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays assocs cocoa kernel math cocoa.messages
+cocoa.subclassing cocoa.classes cocoa.views cocoa.application
+cocoa.pasteboard cocoa.types cocoa.windows sequences ui
+ui.gadgets ui.gadgets.worlds ui.gestures core-foundation ;
+IN: ui.cocoa.views
+
+: send-mouse-moved ( view event -- )
+    over >r mouse-location r> window move-hand fire-motion ;
+
+: button ( event -- n )
+    #! Cocoa -> Factor UI button mapping
+    -> buttonNumber H{ { 0 1 } { 2 2 } { 1 3 } } at ;
+
+: modifiers
+    {
+        { S+ HEX: 20000 }
+        { C+ HEX: 40000 }
+        { A+ HEX: 80000 }
+        { M+ HEX: 100000 }
+    } ;
+
+: key-codes
+    H{
+        { 71 "CLEAR" }
+        { 36 "RET" }
+        { 76 "ENTER" }
+        { 53 "ESC" }
+        { 48 "TAB" }
+        { 51 "BACKSPACE" }
+        { 115 "HOME" }
+        { 117 "DELETE" }
+        { 119 "END" }
+        { 122 "F1" }
+        { 120 "F2" }
+        { 99 "F3" }
+        { 118 "F4" }
+        { 96 "F5" }
+        { 97 "F6" }
+        { 98 "F7" }
+        { 100 "F8" }
+        { 123 "LEFT" }
+        { 124 "RIGHT" }
+        { 125 "DOWN" }
+        { 126 "UP" }
+        { 116 "PAGE_UP" }
+        { 121 "PAGE_DOWN" }
+    } ;
+
+: key-code ( event -- string ? )
+    dup -> keyCode key-codes at
+    [ t ] [ -> charactersIgnoringModifiers CF>string f ] ?if ;
+
+: event-modifiers ( event -- modifiers )
+    -> modifierFlags modifiers modifier ;
+
+: key-event>gesture ( event -- modifiers keycode action? )
+    dup event-modifiers swap key-code ;
+
+: send-key-event ( view event quot -- ? )
+    >r key-event>gesture r> call swap window-focus
+    send-gesture ; inline
+
+: send-user-input ( view string -- )
+    CF>string swap window-focus user-input ;
+
+: interpret-key-event ( view event -- )
+    NSArray swap -> arrayWithObject: -> interpretKeyEvents: ;
+
+: send-key-down-event ( view event -- )
+    2dup [ <key-down> ] send-key-event
+    [ interpret-key-event ] [ 2drop ] if ;
+
+: send-key-up-event ( view event -- )
+    [ <key-up> ] send-key-event drop ;
+
+: mouse-event>gesture ( event -- modifiers button )
+    dup event-modifiers swap button ;
+
+: send-button-down$ ( view event -- )
+    [ mouse-event>gesture <button-down> ] 2keep
+    mouse-location rot window send-button-down ;
+
+: send-button-up$ ( view event -- )
+    [ mouse-event>gesture <button-up> ] 2keep
+    mouse-location rot window send-button-up ;
+
+: send-wheel$ ( view event -- )
+    over >r
+    dup -> deltaX sgn neg over -> deltaY sgn neg 2array -rot
+    mouse-location
+    r> window send-wheel ;
+
+: send-action$ ( view event gesture -- junk )
+    >r drop window r> send-action f ;
+
+: add-resize-observer ( observer object -- )
+    >r "updateFactorGadgetSize:"
+    "NSViewFrameDidChangeNotification" <NSString>
+    r> add-observer ;
+
+: string-or-nil? ( NSString -- ? )
+    [ CF>string NSStringPboardType = ] [ t ] if* ;
+
+: valid-service? ( gadget send-type return-type -- ? )
+    over string-or-nil? over string-or-nil? and [
+        drop [ gadget-selection? ] [ drop t ] if
+    ] [
+        3drop f
+    ] if ;
+
+: NSRect>rect ( NSRect world -- rect )
+    >r dup NSRect-x over NSRect-y r>
+    rect-dim second swap - 2array
+    over NSRect-w rot NSRect-h 2array
+    <rect> ;
+
+: rect>NSRect ( rect world -- NSRect )
+    over rect-loc first2 rot rect-dim second swap -
+    rot rect-dim first2 <NSRect> ;
+
+CLASS: {
+    { +superclass+ "NSOpenGLView" }
+    { +name+ "FactorView" }
+    { +protocols+ { "NSTextInput" } }
+}
+! Events
+{ "acceptsFirstMouse:" "bool" { "id" "SEL" "id" }
+    [ 3drop 1 ]
+}
+
+{ "mouseEntered:" "void" { "id" "SEL" "id" }
+    [ [ nip send-mouse-moved ] ui-try ]
+}
+
+{ "mouseExited:" "void" { "id" "SEL" "id" }
+    [ [ 3drop forget-rollover ] ui-try ]
+}
+
+{ "mouseMoved:" "void" { "id" "SEL" "id" }
+    [ [ nip send-mouse-moved ] ui-try ]
+}
+
+{ "mouseDragged:" "void" { "id" "SEL" "id" }
+    [ [ nip send-mouse-moved ] ui-try ]
+}
+
+{ "rightMouseDragged:" "void" { "id" "SEL" "id" }
+    [ [ nip send-mouse-moved ] ui-try ]
+}
+
+{ "otherMouseDragged:" "void" { "id" "SEL" "id" }
+    [ [ nip send-mouse-moved ] ui-try ]
+}
+
+{ "mouseDown:" "void" { "id" "SEL" "id" }
+    [ [ nip send-button-down$ ] ui-try ]
+}
+
+{ "mouseUp:" "void" { "id" "SEL" "id" }
+    [ [ nip send-button-up$ ] ui-try ]
+}
+
+{ "rightMouseDown:" "void" { "id" "SEL" "id" }
+    [ [ nip send-button-down$ ] ui-try ]
+}
+
+{ "rightMouseUp:" "void" { "id" "SEL" "id" }
+    [ [ nip send-button-up$ ] ui-try ]
+}
+
+{ "otherMouseDown:" "void" { "id" "SEL" "id" }
+    [ [ nip send-button-down$ ] ui-try ]
+}
+
+{ "otherMouseUp:" "void" { "id" "SEL" "id" }
+    [ [ nip send-button-up$ ] ui-try ]
+}
+
+{ "scrollWheel:" "void" { "id" "SEL" "id" }
+    [ [ nip send-wheel$ ] ui-try ]
+}
+
+{ "keyDown:" "void" { "id" "SEL" "id" }
+    [ [ nip send-key-down-event ] ui-try ]
+}
+
+{ "keyUp:" "void" { "id" "SEL" "id" }
+    [ [ nip send-key-up-event ] ui-try ]
+}
+
+{ "cut:" "id" { "id" "SEL" "id" }
+    [ [ nip T{ cut-action } send-action$ ] ui-try ]
+}
+
+{ "copy:" "id" { "id" "SEL" "id" }
+    [ [ nip T{ copy-action } send-action$ ] ui-try ]
+}
+
+{ "paste:" "id" { "id" "SEL" "id" }
+    [ [ nip T{ paste-action } send-action$ ] ui-try ]
+}
+
+{ "delete:" "id" { "id" "SEL" "id" }
+    [ [ nip T{ delete-action } send-action$ ] ui-try ]
+}
+
+{ "selectAll:" "id" { "id" "SEL" "id" }
+    [ [ nip T{ select-all-action } send-action$ ] ui-try ]
+}
+
+{ "acceptsFirstResponder" "bool" { "id" "SEL" }
+    [ 2drop 1 ]
+}
+
+! Services
+{ "validRequestorForSendType:returnType:" "id" { "id" "SEL" "id" "id" }
+    [
+        ! We return either self or nil
+        >r >r over window-focus r> r>
+        valid-service? [ drop ] [ 2drop f ] if
+    ]
+}
+
+{ "writeSelectionToPasteboard:types:" "bool" { "id" "SEL" "id" "id" }
+    [
+        CF>string-array NSStringPboardType swap member? [
+            >r drop window-focus gadget-selection dup [
+                r> set-pasteboard-string t
+            ] [
+                r> 2drop f
+            ] if
+        ] [
+            3drop f
+        ] if
+    ]
+}
+
+{ "readSelectionFromPasteboard:" "bool" { "id" "SEL" "id" }
+    [
+        pasteboard-string dup [
+            >r drop window-focus r> swap user-input t
+        ] [
+            3drop f
+        ] if
+    ]
+}
+
+! Text input
+{ "insertText:" "void" { "id" "SEL" "id" }
+    [ [ nip send-user-input ] ui-try ]
+}
+
+{ "hasMarkedText" "bool" { "id" "SEL" }
+    [ 2drop 0 ]
+}
+
+{ "markedRange" "NSRange" { "id" "SEL" }
+    [ 2drop 0 0 <NSRange> ]
+}
+
+{ "selectedRange" "NSRange" { "id" "SEL" }
+    [ 2drop 0 0 <NSRange> ]
+}
+
+{ "setMarkedText:selectedRange:" "void" { "id" "SEL" "id" "NSRange" }
+    [ 2drop 2drop ]
+}
+
+{ "unmarkText" "void" { "id" "SEL" }
+    [ 2drop ]
+}
+
+{ "validAttributesForMarkedText" "id" { "id" "SEL" }
+    [ 2drop NSArray -> array ]
+}
+
+{ "attributedSubstringFromRange:" "id" { "id" "SEL" "NSRange" }
+    [ 3drop f ]
+}
+
+{ "characterIndexForPoint:" "uint" { "id" "SEL" "NSPoint" }
+    [ 3drop 0 ]
+}
+
+{ "firstRectForCharacterRange:" "NSRect" { "id" "SEL" "NSRange" }
+    [ 3drop 0 0 0 0 <NSRect> ]
+}
+
+{ "conversationIdentifier" "long" { "id" "SEL" }
+    [ drop alien-address ]
+}
+
+! Initialization
+{ "updateFactorGadgetSize:" "void" { "id" "SEL" "id" }
+    [
+        [
+            2drop dup view-dim swap window set-gadget-dim
+            ui-step
+        ] ui-try
+    ]
+}
+
+{ "initWithFrame:pixelFormat:" "id" { "id" "SEL" "NSRect" "id" }
+    [
+        rot drop
+        SUPER-> initWithFrame:pixelFormat:
+        dup dup add-resize-observer
+    ]
+}
+
+{ "dealloc" "void" { "id" "SEL" }
+    [
+        drop
+        dup window stop-world
+        dup unregister-window
+        dup remove-observer
+        SUPER-> dealloc
+    ]
+} ;
+
+: <FactorView> ( world -- view )
+    FactorView over rect-dim <GLView> [ register-window ] keep ;
+
+CLASS: {
+    { +superclass+ "NSObject" }
+    { +name+ "FactorWindowDelegate" }
+}
+
+{ "windowDidMove:" "void" { "id" "SEL" "id" }
+    [
+        2nip -> object
+        dup window-content-rect NSRect-x-y 2array
+        swap -> contentView window set-world-loc
+    ]
+}
+
+{ "windowDidBecomeKey:" "void" { "id" "SEL" "id" }
+    [
+        2nip -> object -> contentView window focus-world
+    ]
+}
+
+{ "windowDidResignKey:" "void" { "id" "SEL" "id" }
+    [
+        forget-rollover
+        2nip -> object -> contentView window unfocus-world
+    ]
+} ;
+
+: install-window-delegate ( window -- )
+    FactorWindowDelegate install-delegate ;
diff --git a/extra/ui/commands/authors.txt b/extra/ui/commands/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/commands/commands-docs.factor b/extra/ui/commands/commands-docs.factor
new file mode 100644 (file)
index 0000000..af2df94
--- /dev/null
@@ -0,0 +1,129 @@
+USING: ui.gestures help.markup help.syntax strings kernel
+hashtables quotations words classes sequences namespaces
+arrays assocs ;
+IN: ui.commands
+
+: command-map-row
+    [
+        dup first gesture>string ,
+        second dup command-name ,
+        dup command-word \ $link swap 2array ,
+        command-description ,
+    ] [ ] make ;
+
+: command-map. ( command-map -- )
+    [ command-map-row ] map
+    { "Shortcut" "Command" "Word" "Notes" }
+    [ \ $strong swap ] { } map>assoc add*
+    $table ;
+
+: $command-map ( element -- )
+    first2
+    dup (command-name) " commands" append $heading
+    swap command-map
+    dup command-map-blurb print-element command-map. ;
+
+: $command ( element -- )
+    reverse first3 command-map value-at gesture>string $snippet ;
+
+HELP: +nullary+
+{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". If set to a true value, the command does not take any inputs, and the value passed to " { $link invoke-command } " will be ignored. Otherwise, it takes one input." } ;
+
+HELP: +listener+
+{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". If set to a true value, " { $link invoke-command } " will run the command in the listener. Otherwise it will run in the event loop." } ;
+
+HELP: +description+
+{ $description "A key which may be set in the hashtable passed to " { $link define-command } ". The value is a string displayed as part of the command's documentation by " { $link $command-map } "." } ;
+
+HELP: invoke-command
+{ $values { "target" object } { "command" "a command" } }
+{ $description "Invokes a command on the given target object." } ;
+
+{ invoke-command +nullary+ } related-words
+
+HELP: command-name
+{ $values { "command" "a command" } { "str" "a string" } }
+{ $description "Outputs a human-readable name for the command." }
+{ $examples
+    { $example
+        "USE: ui.commands"
+        ": com-my-command ;"
+        "\\ com-my-command command-name write"
+        "My command"
+    }
+} ;
+
+HELP: command-description
+{ $values { "command" "a command" } { "str/f" "a string or " { $link f } } }
+{ $description "Outputs the command's description." } ;
+
+{ command-description +description+ } related-words
+
+HELP: command-word
+{ $values { "command" "a command" } { "word" word } }
+{ $description "Outputs the word that will be executed by " { $link invoke-command } ". This is only used for documentation purposes." } ;
+
+HELP: command-map
+{ $values { "group" string } { "class" "a class word" } { "command-map" "a " { $link command-map } " or " { $link f } } }
+{ $description "Outputs a named command map defined on a class." }
+{ $class-description "A command map stores a group of related commands. Instances of this class delegate to arrays so behave like sequences; additionally the " { $link command-map-blurb } " slot stores a string description of the command group, or " { $link f } "."
+$nl
+"Command maps are created by calling " { $link <command-map> } " or " { $link define-command-map } "." } ;
+
+HELP: commands
+{ $values { "class" "a class word" } { "hash" hashtable } }
+{ $description "Outputs a hashtable mapping command map names to " { $link command-map } " instances." } ;
+
+HELP: define-command-map
+{ $values { "class" "a class word" } { "group" string } { "blurb" "a " { $link string } " or " { $link f } } { "pairs" "a sequence of gesture/word pairs" } }
+{ $description
+    "Defines a command map on the specified gadget class. The " { $snippet "specs" } " parameter is a sequence of pairs " { $snippet "{ gesture word }" } ". The words must be valid commands; see " { $link define-command } "."
+}
+{ $notes "Only one of " { $link define-command-map } " and " { $link set-gestures } " can be used on a given gadget class, since each word will overwrite the other word's definitions." } ;
+
+HELP: $command-map
+{ $values { "element" "a pair " { $snippet "{ class map }" } } }
+{ $description "Prints a command map, where the first element of the pair is a class word and the second is a command map name." } ;
+
+HELP: $command
+{ $values { "element" "a triple " { $snippet "{ class map command }" } } }
+{ $description "Prints the keyboard shortcut associated with " { $snippet "command" } " in the command map named " { $snippet "map" } " on the class " { $snippet "class" } "." } ;
+
+HELP: define-command
+{ $values { "word" word } { "hash" hashtable } } 
+{ $description "Defines a command. The hashtable can contain the following keys:"
+    { $list
+        { { $link +nullary+ } " - if set to a true value, the word must have stack effect " { $snippet "( -- )" } "; otherwise it must have stack effect " { $snippet "( target -- )" } }
+        { { $link +listener+ } " - if set to a true value, the command will run in the listener" }
+        { { $link +description+ } " - can be set to a string description of the command" }
+    }
+} ;
+
+HELP: command-string
+{ $values { "gesture" "a gesture" } { "command" "a command" } { "string" string } }
+{ $description "Outputs a string containing the command name followed by the gesture." }
+{ $examples
+    { $example
+        "USING: ui.commands ui.gestures ;"
+        ": com-my-command ;"
+        "T{ key-down f { C+ } \"s\" } \\ com-my-command command-string write"
+        "My command (C+s)"
+    }
+} ;
+
+ARTICLE: "ui-commands" "Commands"
+"Commands are an abstraction layered on top of gestures. Their main advantage is that they are identified by words and can be organized into " { $emphasis "command maps" } ". This allows easy construction of buttons and tool bars for invoking commands."
+{ $subsection define-command }
+"Command groups are defined on gadget classes:"
+{ $subsection define-command-map }
+"Commands can be introspected and invoked:"
+{ $subsection commands }
+{ $subsection command-map }
+{ $subsection invoke-command }
+"Gadgets for invoking commands are documented in " { $link "ui.gadgets.buttons" } "."
+$nl
+"When documenting gadgets, command documentation can be automatically generated:"
+{ $subsection $command-map }
+{ $subsection $command } ;
+
+ABOUT: "ui-commands"
diff --git a/extra/ui/commands/commands-tests.factor b/extra/ui/commands/commands-tests.factor
new file mode 100644 (file)
index 0000000..0e51eaf
--- /dev/null
@@ -0,0 +1,31 @@
+IN: temporary
+USING: ui.commands ui.gestures tools.test help.markup io
+io.streams.string ;
+
+[ "A+a" ] [ T{ key-down f { A+ } "a" } gesture>string ] unit-test
+[ "b" ] [ T{ key-down f f "b" } gesture>string ] unit-test
+[ "Press Button 2" ] [ T{ button-down f f 2 } gesture>string ] unit-test
+
+: com-test-1 ;
+
+\ com-test-1 H{ } define-command
+
+[ [ 3 com-test-1 ] ] [ 3 \ com-test-1 command-quot ] unit-test
+
+: com-test-2 ;
+
+\ com-test-2 H{ { +nullary+ t } } define-command
+
+[ [ com-test-2 ] ] [ 3 \ com-test-2 command-quot ] unit-test
+
+SYMBOL: testing
+
+testing "testing" "hey" {
+    { T{ key-down f { C+ } "x" } com-test-1 }
+} define-command-map
+
+[ "C+x" ] [
+    [
+        { $command testing "testing" com-test-1 } print-element
+    ] string-out
+] unit-test
diff --git a/extra/ui/commands/commands.factor b/extra/ui/commands/commands.factor
new file mode 100644 (file)
index 0000000..e0d991e
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions kernel sequences strings math assocs
+words generic namespaces assocs quotations splitting
+ui.gestures ;
+IN: ui.commands
+
+SYMBOL: +nullary+
+SYMBOL: +listener+
+SYMBOL: +description+
+
+PREDICATE: word listener-command +listener+ word-prop ;
+
+GENERIC: invoke-command ( target command -- )
+
+GENERIC: command-name ( command -- str )
+
+TUPLE: command-map blurb ;
+
+GENERIC: command-description ( command -- str/f )
+
+GENERIC: command-word ( command -- word )
+
+: <command-map> ( blurb commands -- command-map )
+    { } like
+    { set-command-map-blurb set-delegate }
+    \ command-map construct ;
+
+: commands ( class -- hash )
+    dup "commands" word-prop [ ] [
+        H{ } clone [ "commands" set-word-prop ] keep
+    ] ?if ;
+
+: command-map ( group class -- command-map )
+    commands at ;
+
+: command-gestures ( class -- hash )
+    commands values [
+        [
+            [ first ] subset
+            [ [ invoke-command ] curry swap set ] assoc-each
+        ] each
+    ] H{ } make-assoc ;
+
+: update-gestures ( class -- )
+    dup command-gestures "gestures" set-word-prop ;
+
+: define-command-map ( class group blurb pairs -- )
+    <command-map>
+    swap pick commands set-at
+    update-gestures ;
+
+: (command-name) ( string -- newstring )
+    "-" split " " join unclip ch>upper add* ;
+
+M: word command-name ( word -- str )
+    word-name
+    "com-" ?head drop
+    dup first Letter? [ 1 tail ] unless
+    (command-name) ;
+
+M: word command-description ( word -- str )
+    +description+ word-prop ;
+
+: default-flags ( -- assoc )
+    H{ { +nullary+ f } { +listener+ f } { +description+ f } } ;
+
+: define-command ( word hash -- )
+    default-flags swap union >r word-props r> update ;
+
+: command-quot ( target command -- quot )
+    dup 1quotation swap +nullary+ word-prop
+    [ nip ] [ curry ] if ;
+
+M: word invoke-command ( target command -- )
+    command-quot call ;
+
+M: word command-word ;
+
+M: f invoke-command ( target command -- ) 2drop ;
+
+: command-string ( gesture command -- string )
+    [
+        command-name %
+        gesture>string [ " (" % % ")" % ] when*
+    ] "" make ;
diff --git a/extra/ui/commands/summary.txt b/extra/ui/commands/summary.txt
new file mode 100644 (file)
index 0000000..b8e0a16
--- /dev/null
@@ -0,0 +1 @@
+UI command framework
diff --git a/extra/ui/freetype/authors.txt b/extra/ui/freetype/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/freetype/freetype-docs.factor b/extra/ui/freetype/freetype-docs.factor
new file mode 100644 (file)
index 0000000..3ba6c0f
--- /dev/null
@@ -0,0 +1,54 @@
+USING: help.syntax help.markup ui.freetype strings kernel
+alien opengl quotations ui.render io.styles ;
+
+HELP: freetype
+{ $values { "alien" alien } }
+{ $description "Outputs a native handle used by the FreeType library, initializing FreeType first if necessary." } ;
+
+HELP: open-fonts
+{ $var-description "Global variable. Hashtable mapping font descriptors to " { $link font } " instances." } ;
+
+{ font open-fonts open-font char-width string-width text-dim draw-string draw-text } related-words
+
+HELP: init-freetype
+{ $description "Initializes the FreeType library." }
+{ $notes "Do not call this word if you are using the UI." } ;
+
+USE: ui.freetype
+
+HELP: font
+{ $class-description "A font which has been loaded by FreeType. Font instances have the following slots:"
+    { $list
+        { { $link font-ascent } ", " { $link font-descent } ", " { $link font-height } " - metrics." }
+        { { $link font-handle } " - alien pointer to an " { $snippet "FT_Face" } "." }
+        { { $link font-widths } " - sequence of character widths. Use " { $link char-width } " and " { $link string-width } " to compute string widths instead of reading this sequence directly." }
+    }
+} ;
+
+HELP: close-freetype
+{ $description "Closes the FreeType library." }
+{ $notes "Do not call this word if you are using the UI." } ;
+
+HELP: open-face
+{ $values { "font" string } { "style" "one of " { $link plain } ", " { $link bold } ", " { $link italic } " or " { $link bold-italic } } { "face" "alien pointer to an " { $snippet "FT_Face" } } }
+{ $description "Loads a TrueType font with the requested logical font name and style." }
+{ $notes "This is a low-level word. Call " { $link open-font } " instead." } ;
+
+HELP: render-glyph
+{ $values  { "font" font } { "char" "a non-negative integer" } { "bitmap" alien } }
+{ $description "Renders a character and outputs a pointer to the bitmap." } ;
+
+HELP: <char-sprite>
+{ $values { "font" font } { "char" "a non-negative integer" } { "sprite" sprite } }
+{ $description "Renders a character to an OpenGL texture and records a display list which draws a quad with this texture. This word allocates native resources which must be freed by " { $link free-sprites } "." } ;
+
+HELP: (draw-string)
+{ $values { "open-font" font } { "sprites" "a vector of " { $link sprite } " instances" } { "string" string } { "loc" "a pair of integers" } }
+{ $description "Draws a line of text." }
+{ $notes "This is a low-level word, UI code should use " { $link draw-string } " or " { $link draw-text } " instead." }
+{ $side-effects "sprites" } ;
+
+HELP: run-char-widths
+{ $values { "open-font" font } { "string" string } { "widths" "a sequence of integers" } }
+{ $description "Outputs a sequence of x co-ordinates of the midpoint of each character in the string." }
+{ $notes "This word is used to convert x offsets to document locations, for example when the user moves the caret by clicking the mouse." } ;
diff --git a/extra/ui/freetype/freetype.factor b/extra/ui/freetype/freetype.factor
new file mode 100644 (file)
index 0000000..0adc2d5
--- /dev/null
@@ -0,0 +1,189 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types arrays io kernel libc math
+math.vectors namespaces opengl opengl.gl prettyprint assocs
+sequences io.files io.styles continuations freetype
+ui.gadgets.worlds ui.render ui.backend ;
+IN: ui.freetype
+
+TUPLE: freetype-renderer ;
+
+SYMBOL: open-fonts
+
+: freetype-error ( n -- )
+    zero? [ "FreeType error" throw ] unless ;
+
+DEFER: freetype
+
+: init-freetype ( -- )
+    global [
+        f <void*> dup FT_Init_FreeType freetype-error
+        *void* \ freetype set
+        H{ } clone open-fonts set
+    ] bind ;
+
+: freetype ( -- alien )
+    \ freetype get-global expired? [ init-freetype ] when
+    \ freetype get-global ;
+
+TUPLE: font ascent descent height handle widths ;
+
+M: font equal? 2drop f ;
+
+M: font hashcode* drop font hashcode* ;
+
+: close-font ( font -- ) font-handle FT_Done_Face ;
+
+: close-freetype ( -- )
+    global [
+        open-fonts [ values [ close-font ] each f ] change
+        freetype [ FT_Done_FreeType f ] change
+    ] bind ;
+
+M: freetype-renderer free-fonts ( world -- )
+    dup world-handle select-gl-context
+    world-fonts values [ second free-sprites ] each ;
+
+: ttf-name ( font style -- name )
+    2array H{
+        { { "monospace" plain        } "VeraMono" }
+        { { "monospace" bold         } "VeraMoBd" }
+        { { "monospace" bold-italic  } "VeraMoBI" }
+        { { "monospace" italic       } "VeraMoIt" }
+        { { "sans-serif" plain       } "Vera"     }
+        { { "sans-serif" bold        } "VeraBd"   }
+        { { "sans-serif" bold-italic } "VeraBI"   }
+        { { "sans-serif" italic      } "VeraIt"   }
+        { { "serif" plain            } "VeraSe"   }
+        { { "serif" bold             } "VeraSeBd" }
+        { { "serif" bold-italic      } "VeraBI"   }
+        { { "serif" italic           } "VeraIt"   }
+    } at ;
+
+: ttf-path ( name -- string )
+    "/fonts/" swap ".ttf" 3append resource-path ;
+
+: open-face ( font style -- face )
+    ttf-name ttf-path >r freetype r>
+    0 f <void*> [ FT_New_Face freetype-error ] keep *void* ;
+
+: dpi 72 ; inline
+
+: ft-floor -6 shift ; inline
+
+: ft-ceil 63 + -64 bitand -6 shift ; inline
+
+: font-units>pixels ( n font -- n )
+    face-size face-size-y-scale FT_MulFix ;
+
+: init-ascent ( font face -- )
+    dup face-y-max swap font-units>pixels swap set-font-ascent ;
+
+: init-descent ( font face -- )
+    dup face-y-min swap font-units>pixels swap set-font-descent ;
+
+: init-font ( font -- )
+    dup font-handle 2dup init-ascent dupd init-descent
+    dup font-ascent over font-descent - ft-ceil
+    swap set-font-height ;
+
+: <font> ( handle -- font )
+    V{ } clone
+    { set-font-handle set-font-widths } font construct
+    dup init-font ;
+
+: (open-font) ( font -- open-font )
+    first3 >r open-face dup 0 r> 6 shift
+    dpi dpi FT_Set_Char_Size freetype-error <font> ;
+
+M: freetype-renderer open-font ( font -- open-font )
+    freetype drop open-fonts get [ (open-font) ] cache ;
+
+: load-glyph ( font char -- glyph )
+    >r font-handle dup r> 0 FT_Load_Char
+    freetype-error face-glyph ;
+
+: char-width ( open-font char -- w )
+    over font-widths [
+        dupd load-glyph glyph-hori-advance ft-ceil
+    ] cache-nth nip ;
+
+M: freetype-renderer string-width ( open-font string -- w )
+    0 -rot [ char-width + ] curry* each ;
+
+M: freetype-renderer string-height ( open-font string -- h )
+    drop font-height ;
+
+: glyph-size ( glyph -- dim )
+    dup glyph-hori-advance ft-ceil
+    swap glyph-height ft-ceil 2array ;
+
+: render-glyph ( font char -- bitmap )
+    load-glyph dup
+    FT_RENDER_MODE_NORMAL FT_Render_Glyph freetype-error ;
+
+: copy-pixel ( bit tex -- bit tex )
+    255 f pick set-alien-unsigned-1 1+
+    f pick alien-unsigned-1
+    f pick set-alien-unsigned-1 >r 1+ r> 1+ ;
+
+: (copy-row) ( bit tex bitend texend -- bitend texend )
+    >r pick over >= [
+        2nip r>
+    ] [
+        >r copy-pixel r> r> (copy-row)
+    ] if ;
+
+: copy-row ( bit tex width width2 -- bitend texend width width2 )
+    [ pick + >r pick + r> (copy-row) ] 2keep ;
+
+: copy-bitmap ( glyph texture -- )
+    over glyph-bitmap-rows >r
+    over glyph-bitmap-width dup next-power-of-2 2 *
+    >r >r >r glyph-bitmap-buffer alien-address r> r> r> r> 
+    [ copy-row ] times 2drop 2drop ;
+
+: bitmap>texture ( glyph sprite -- id )
+    tuck sprite-size2 * 2 * [
+        alien-address [ copy-bitmap ] keep <alien> gray-texture
+    ] with-malloc ;
+
+: glyph-texture-loc ( glyph font -- loc )
+    over glyph-hori-bearing-x ft-floor -rot
+    font-ascent swap glyph-hori-bearing-y - ft-floor 2array ;
+
+: glyph-texture-size ( glyph -- dim )
+    dup glyph-bitmap-width next-power-of-2
+    swap glyph-bitmap-rows next-power-of-2 2array ;
+
+: <char-sprite> ( font char -- sprite )
+    over >r render-glyph dup r> glyph-texture-loc
+    over glyph-size pick glyph-texture-size <sprite>
+    [ bitmap>texture ] keep [ init-sprite ] keep ;
+
+: draw-char ( open-font char sprites -- )
+    [ dupd <char-sprite> ] cache-nth nip
+    sprite-dlist glCallList ;
+
+: (draw-string) ( open-font sprites string loc -- )
+    GL_TEXTURE_2D [
+        [
+            [ >r 2dup r> swap draw-char ] each 2drop
+        ] with-translation
+    ] do-enabled ;
+
+: font-sprites ( open-font world -- pair )
+    world-fonts [ open-font V{ } clone 2array ] cache ;
+
+M: freetype-renderer draw-string ( font string loc -- )
+    >r >r world get font-sprites first2 r> r> (draw-string) ;
+
+: run-char-widths ( open-font string -- widths )
+    [ char-width ] curry* { } map-as
+    dup 0 [ + ] accumulate nip swap 2 v/n v+ ;
+
+M: freetype-renderer x>offset ( x open-font string -- n )
+    dup >r run-char-widths [ <= ] curry* find drop
+    [ r> drop ] [ r> length ] if* ;
+
+T{ freetype-renderer } font-renderer set-global
diff --git a/extra/ui/freetype/summary.txt b/extra/ui/freetype/summary.txt
new file mode 100644 (file)
index 0000000..f7bfcac
--- /dev/null
@@ -0,0 +1 @@
+UI text rendering implementation based on FreeType
diff --git a/extra/ui/gadgets/authors.txt b/extra/ui/gadgets/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/books/authors.txt b/extra/ui/gadgets/books/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/books/books-docs.factor b/extra/ui/gadgets/books/books-docs.factor
new file mode 100644 (file)
index 0000000..f253f0f
--- /dev/null
@@ -0,0 +1,11 @@
+USING: ui.gadgets.books ui.gadgets.controls help.markup
+help.syntax ui.gadgets models ;
+
+HELP: book
+{ $class-description "A book is a " { $link control } " containing one or more children. The " { $link control-value } " is the index of exactly one child to be visible at any one time, the rest being hidden by having their " { $link gadget-visible? } " slots set to " { $link f } ". The sole visible child assumes the dimensions of the book gadget."
+$nl
+"Books are created by calling " { $link <book> } "." } ;
+
+HELP: <book>
+{ $values { "pages" "a sequence of gadgets" } { "model" model } { "book" book } }
+{ $description "Creates a " { $link book } { $link control } ", which contains the gadgets in " { $snippet "pages" } ". A book shows one child at a time, determined by the value of the model, which must be an integer " } ;
diff --git a/extra/ui/gadgets/books/books.factor b/extra/ui/gadgets/books/books.factor
new file mode 100644 (file)
index 0000000..65dc138
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences models ui.gadgets ui.gadgets.controls ;
+IN: ui.gadgets.books
+
+TUPLE: book ;
+
+: hide-all ( book -- ) gadget-children [ hide-gadget ] each ;
+
+: current-page ( book -- gadget )
+    [ control-value ] keep nth-gadget ;
+
+M: book model-changed ( book -- )
+    dup hide-all
+    dup current-page show-gadget
+    relayout ;
+
+: <book> ( pages model -- book )
+    <gadget> book construct-control
+    [ add-gadgets ] keep
+    [ model-changed ] keep ;
+
+M: book pref-dim* gadget-children pref-dims max-dim ;
+
+M: book layout*
+    dup rect-dim swap gadget-children
+    [ set-layout-dim ] curry* each ;
+
+M: book focusable-child* current-page ;
diff --git a/extra/ui/gadgets/books/summary.txt b/extra/ui/gadgets/books/summary.txt
new file mode 100644 (file)
index 0000000..c52acf3
--- /dev/null
@@ -0,0 +1 @@
+Book gadget displays one child at a time
diff --git a/extra/ui/gadgets/borders/authors.txt b/extra/ui/gadgets/borders/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/borders/borders-docs.factor b/extra/ui/gadgets/borders/borders-docs.factor
new file mode 100644 (file)
index 0000000..c0274e3
--- /dev/null
@@ -0,0 +1,16 @@
+USING: help.markup help.syntax ui.gadgets math ;
+IN: ui.gadgets.borders
+
+HELP: border
+{ $class-description "A border gadget contains a single child and centers it, with a fixed-width border. Borders are created by calling " { $link <border> } "." } ;
+
+HELP: <border>
+{ $values { "child" gadget } { "gap" integer } { "border" "a new " { $link border } } }
+{ $description "Creates a new border around the child with the specified horizontal and vertical gap." } ;
+
+ARTICLE: "ui.gadgets.borders" "Border gadgets"
+"Border gadgets add empty space around a child gadget."
+{ $subsection border }
+{ $subsection <border> } ;
+
+ABOUT: "ui.gadgets.borders"
diff --git a/extra/ui/gadgets/borders/borders.factor b/extra/ui/gadgets/borders/borders.factor
new file mode 100644 (file)
index 0000000..a0dc545
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.gadgets generic hashtables kernel math
+namespaces vectors sequences math.vectors ;
+IN: ui.gadgets.borders
+
+TUPLE: border size ;
+
+: <border> ( child gap -- border )
+    border construct-gadget
+    [ >r dup 2array r> set-border-size ] keep
+    [ add-gadget ] keep ;
+
+: layout-border-loc ( border -- )
+    dup rect-dim swap gadget-child
+    [ pref-dim v- 2 v/n [ >fixnum ] map ] keep set-rect-loc ;
+
+M: border pref-dim*
+    [ border-size 2 v*n ] keep
+    gadget-child pref-dim v+ ;
+
+M: border layout*
+    dup layout-border-loc gadget-child prefer ;
+
+M: border focusable-child*
+    gadget-child ;
diff --git a/extra/ui/gadgets/borders/summary.txt b/extra/ui/gadgets/borders/summary.txt
new file mode 100644 (file)
index 0000000..7fd21f3
--- /dev/null
@@ -0,0 +1 @@
+Border gadget adds padding around a child
diff --git a/extra/ui/gadgets/buttons/authors.txt b/extra/ui/gadgets/buttons/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/buttons/buttons-docs.factor b/extra/ui/gadgets/buttons/buttons-docs.factor
new file mode 100644 (file)
index 0000000..d791e7e
--- /dev/null
@@ -0,0 +1,84 @@
+USING: ui.gadgets.buttons help.markup help.syntax ui.gadgets
+ui.gadgets.labels ui.gadgets.menus ui.render kernel models
+classes ;
+
+HELP: button
+{ $class-description "A button is a " { $link gadget } " which responds to mouse clicks by invoking a quotation."
+$nl
+"A button's appearance can vary depending on the state of the mouse button if the " { $link gadget-interior } " or " { $link gadget-boundary } " slots are set to instances of " { $link button-paint } "."
+$nl
+"A button can be selected, which is distinct from being pressed. This state is held in the " { $link button-selected? } " slot, and is used by the " { $link <radio-box> } " word to construct a row of buttons for choosing among several alternatives." } ;
+
+HELP: >label
+{ $values { "obj" "a label specifier" } { "gadget" "a new " { $link gadget } } }
+{ $description "Convert the object into a gadget suitable for use as the label of a button. If " { $snippet "obj" } " is already a gadget, does nothing. Otherwise creates a " { $link label } " gadget if it is a string and an empty gadget if " { $snippet "obj" } " is " { $link f } "." } ;
+
+HELP: <button>
+{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } { "button" "a new " { $link button } } }
+{ $description "Creates a new " { $link button } " which calls the quotation when clicked. The given gadget becomes the button's delegate." } ;
+
+HELP: <roll-button>
+{ $values { "label" "a label specifier" } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } { "button" button } }
+{ $description "Creates a new " { $link button } " which is displayed with a solid border when it is under the mouse, informing the user that the gadget is clickable." } ;
+
+HELP: <bevel-button>
+{ $values { "label" "a label specifier" } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } { "button" button } }
+{ $description "Creates a new " { $link button } " with a shaded border which is always visible. The button appearance changes in response to mouse gestures using a " { $link button-paint } "." } ;
+
+HELP: <repeat-button>
+{ $values { "label" object } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } { "button" repeat-button } }
+{ $description "Creates a new " { $link button } " derived from a " { $link <bevel-button> } " which calls the quotation every 100 milliseconds as long as the mouse button is held down." } ;
+
+HELP: button-paint
+{ $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " gneeric words by delegating to an object in one of four slots which depend on the state of the button being drawn:"
+    { $list
+        { { $link button-paint-plain } " - the button is inactive" }
+        { { $link button-paint-rollover } " - the button is under the mouse" }
+        { { $link button-paint-pressed } " - the button is under the mouse and a mouse button is held down" }
+        { { $link button-paint-selected } " - the button is selected (see " { $link <radio-box> }  }
+    }
+"The " { $link <roll-button> } " and " { $link <bevel-button> } " words create " { $link button } " instances with specific " { $link button-paint } "." } ;
+
+HELP: <radio-control>
+{ $values { "model" model } { "value" object } { "label" "a label specifier" } { "gadget" gadget } }
+{ $description
+    "Creates a " { $link <bevel-button> } " which sets the model's value to " { $snippet "value" } " when pressed. After being pressed, the button becomes selected until the value of the model changes again."
+}
+{ $notes "Typically a row of radio controls should be built together using " { $link <radio-box> } "." } ;
+
+HELP: <radio-box>
+{ $values { "model" model } { "assoc" "an association list mapping labels to objects" } { "gadget" gadget } }
+{ $description "Creates a row of labelled " { $link <radio-control> } " gadgets which change the value of the model." } ;
+
+HELP: <command-button>
+{ $values { "target" object } { "gesture" "a gesture" } { "command" "a command" } { "button" "a new " { $link button } } }
+{ $description "Creates a " { $link <bevel-button> } " which invokes the command on " { $snippet "target" } " when clicked." } ;
+
+HELP: <toolbar>
+{ $values { "target" object } { "toolbar" gadget } }
+{ $description "Creates a row of " { $link <command-button> } " gadgets invoking commands on " { $snippet "target" } ". The commands are taken from the " { $snippet "\"toolbar\"" } " command group of each class in " { $snippet "classes" } "." } ;
+
+HELP: <commands-menu>
+{ $values { "hook" "a quotation with stack effect " { $snippet "( button -- )" } } { "target" object } { "commands" "a sequence of commands" } { "gadget" "a new " { $link gadget } } }
+{ $description "Creates a popup menu of commands which are to be invoked on " { $snippet "target" } ". The " { $snippet "hook" } " quotation is run before a command is invoked." } ;
+
+ARTICLE: "ui.gadgets.buttons" "Button gadgets"
+"Buttons respond to mouse clicks by invoking a quotation."
+{ $subsection button }
+"There are many ways to create a new button:"
+{ $subsection <button> }
+{ $subsection <roll-button> }
+{ $subsection <bevel-button> }
+{ $subsection <repeat-button> }
+"Gadgets for invoking commands:"
+{ $subsection <command-button> }
+{ $subsection <toolbar> }
+"A radio box is a row of buttons for choosing amongst several distinct possibilities:"
+{ $subsection <radio-box> }
+"Button appearance can be customized:"
+{ $subsection button-paint }
+"Button constructors take " { $emphasis "label specifiers" } " as input. A label specifier is either a string, an array of strings, a gadget or " { $link f } "."
+$nl
+"A generic word used to convert label specifiers to gadgets:"
+{ $subsection >label }
+{ $see-also <command-button> "ui-commands" } ;
diff --git a/extra/ui/gadgets/buttons/buttons-tests.factor b/extra/ui/gadgets/buttons/buttons-tests.factor
new file mode 100644 (file)
index 0000000..e093751
--- /dev/null
@@ -0,0 +1,19 @@
+IN: temporary
+USING: ui.commands ui.gadgets.buttons ui.gadgets.labels
+ui.gadgets tools.test namespaces sequences kernel ;
+
+TUPLE: foo-gadget ;
+
+: com-foo-a ;
+
+: com-foo-b ;
+
+\ foo-gadget "toolbar" f {
+    { f com-foo-a }
+    { f com-foo-b }
+} define-command-map
+
+T{ foo-gadget } <toolbar> "t" set
+
+[ 2 ] [ "t" get gadget-children length ] unit-test
+[ "Foo a" ] [ "t" get gadget-child gadget-child label-string ] unit-test
diff --git a/extra/ui/gadgets/buttons/buttons.factor b/extra/ui/gadgets/buttons/buttons.factor
new file mode 100644 (file)
index 0000000..18e812e
--- /dev/null
@@ -0,0 +1,126 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.commands ui.gadgets ui.gadgets.borders
+ui.gadgets.controls ui.gadgets.labels ui.gadgets.theme
+ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures
+ui.render kernel math models namespaces sequences strings
+quotations assocs combinators classes colors ;
+IN: ui.gadgets.buttons
+
+TUPLE: button pressed? selected? quot ;
+
+: buttons-down? ( -- ? )
+    hand-buttons get-global empty? not ;
+
+: button-rollover? ( button -- ? )
+    hand-gadget get-global child? ;
+
+: mouse-clicked? ( gadget -- ? )
+    hand-clicked get-global child? ;
+
+: button-update ( button -- )
+    dup mouse-clicked?
+    over button-rollover? and
+    buttons-down? and
+    over set-button-pressed?
+    relayout-1 ;
+
+: if-clicked ( button quot -- )
+    >r dup button-update dup button-rollover? r> [ drop ] if ;
+
+: button-clicked ( button -- )
+    dup button-quot if-clicked ;
+
+button H{
+    { T{ button-up } [ button-clicked ] }
+    { T{ button-down } [ button-update ] }
+    { T{ mouse-leave } [ button-update ] }
+    { T{ mouse-enter } [ button-update ] }
+} set-gestures
+
+GENERIC: >label ( obj -- gadget )
+M: string >label <label> ;
+M: array >label <label> ;
+M: object >label ;
+M: f >label drop <gadget> ;
+
+: <button> ( gadget quot -- button )
+    button construct-empty
+    [ set-button-quot ] keep
+    [ set-gadget-delegate ] keep ;
+
+TUPLE: button-paint plain rollover pressed selected ;
+
+C: <button-paint> button-paint
+
+: button-paint ( button paint -- button paint )
+    {
+        { [ over button-pressed? ] [ button-paint-pressed ] }
+        { [ over button-selected? ] [ button-paint-selected ] }
+        { [ over button-rollover? ] [ button-paint-rollover ] }
+        { [ t ] [ button-paint-plain ] }
+    } cond ;
+
+M: button-paint draw-interior
+    button-paint draw-interior ;
+
+M: button-paint draw-boundary
+    button-paint draw-boundary ;
+
+: roll-button-theme ( button -- )
+    f black <solid> dup f <button-paint>
+    swap set-gadget-boundary ;
+
+: <roll-button> ( label quot -- button )
+    >r >label r>
+    <button> dup roll-button-theme ;
+
+: bevel-button-theme ( gadget -- )
+    plain-gradient
+    rollover-gradient
+    pressed-gradient
+    selected-gradient
+    <button-paint> over set-gadget-interior
+    faint-boundary ;
+
+: <bevel-button> ( label quot -- button )
+    >r >label 5 <border> r>
+    <button> dup bevel-button-theme ;
+
+TUPLE: repeat-button ;
+
+repeat-button H{
+    { T{ drag } [ button-clicked ] }
+} set-gestures
+
+: <repeat-button> ( label quot -- button )
+    #! Button that calls the quotation every 100ms as long as
+    #! the mouse is held down.
+    repeat-button construct-empty
+    [ >r <bevel-button> r> set-gadget-delegate ] keep ;
+
+: <radio-control> ( model value label -- gadget )
+    over [ swap set-control-value ] curry <bevel-button>
+    swap [ swap >r = r> set-button-selected? ] curry <control> ;
+
+: <radio-box> ( model assoc -- gadget )
+    [
+        swap [ -rot <radio-control> gadget, ] curry assoc-each
+    ] make-shelf ;
+
+: command-button-quot ( target command -- quot )
+    [ invoke-command drop ] 2curry ;
+
+: <command-button> ( target gesture command -- button )
+    [ command-string ] keep
+    swapd
+    command-button-quot
+    <bevel-button> ;
+
+: <toolbar> ( target -- toolbar )
+    [
+        "toolbar" over class command-map swap
+        [ -rot <command-button> gadget, ] curry assoc-each
+    ] make-shelf ;
+
+: toolbar, ( -- ) g <toolbar> f track, ;
diff --git a/extra/ui/gadgets/buttons/summary.txt b/extra/ui/gadgets/buttons/summary.txt
new file mode 100644 (file)
index 0000000..2a98729
--- /dev/null
@@ -0,0 +1 @@
+Button gadgets invoke commands when clicked
diff --git a/extra/ui/gadgets/canvas/canvas.factor b/extra/ui/gadgets/canvas/canvas.factor
new file mode 100644 (file)
index 0000000..5a01311
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: ui.backend ui.gadgets ui.gadgets.theme ui.gadgets.worlds
+ui.render opengl opengl.gl kernel namespaces tuples colors ;
+IN: ui.gadgets.canvas
+
+TUPLE: canvas dlist ;
+
+: <canvas> ( -- canvas )
+    canvas construct-gadget
+    dup black solid-interior ;
+
+: find-gl-context ( gadget -- )
+    find-world world-handle select-gl-context ;
+
+: delete-canvas-dlist ( canvas -- )
+    dup find-gl-context
+    dup canvas-dlist [ delete-dlist ] when*
+    f swap set-canvas-dlist ;
+
+: make-canvas-dlist ( canvas quot -- dlist )
+    over >r GL_COMPILE swap make-dlist dup r>
+    set-canvas-dlist ;
+
+: cache-canvas-dlist ( canvas quot -- dlist )
+    over canvas-dlist dup
+    [ 2nip ] [ drop make-canvas-dlist ] if ; inline
+
+: draw-canvas ( canvas quot -- )
+    origin get [
+        cache-canvas-dlist glCallList
+    ] with-translation ; inline
+
+M: canvas ungraft* delete-canvas-dlist ;
diff --git a/extra/ui/gadgets/controls/authors.txt b/extra/ui/gadgets/controls/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/controls/controls-docs.factor b/extra/ui/gadgets/controls/controls-docs.factor
new file mode 100644 (file)
index 0000000..028d76c
--- /dev/null
@@ -0,0 +1,51 @@
+USING: ui.gadgets help.markup help.syntax models kernel classes
+tuples ;
+IN: ui.gadgets.controls
+
+HELP: control
+{ $class-description "A control is a " { $link gadget } " linked to a " { $link model } " stored in the " { $link control-model } " slot. Changes to the model are reflected in the appearance and behavior of the control, and the control may in turn change the value of the model in response to user input."
+$nl
+"Controls are created by calling " { $link <control> } " and " { $link construct-control } "."
+$nl
+"Objects may delegate to " { $link control } " instances, in which case the " { $link control-self } " slot must be set to the frontmost object in the delegation chain. This ensures that the correct object receives notification of model changes." } ;
+
+HELP: <control>
+{ $values { "model" model } { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( value control -- )" } } }
+{ $description "Creates a new control linked to the given model. The gadget parameter becomes the control's delegate. The quotation is called when the model value changes," }
+{ $examples
+    "The following example creates a gadget whose fill color is determined by the value of a model:"
+    { $code
+        "USING: ui.gadgets ui.gadgets.panes models ;"
+        ": set-fill-color >r <solid> r> set-gadget-interior ;"
+        "{ 1.0 0.0 0.5 1.0 } <model>"
+        "<gadget> [ set-fill-color ] <control>"
+        "{ 100 100 } over set-rect-dim"
+        "gadget."
+    }
+    "The " { $vocab-link "color-picker" } " module extends this example into an elaborate color choose."
+} ;
+
+{ <control> construct-control control-value set-control-value } related-words
+
+HELP: control-value
+{ $values { "control" control } { "value" object } }
+{ $description "Outputs the value of the control's model." } ;
+
+HELP: set-control-value
+{ $values { "value" object } { "control" control } }
+{ $description "Sets the value of the control's model." } ;
+
+ARTICLE: "ui-control-impl" "Implementing controls"
+"A control is a gadget which is linked to an underlying " { $link model } "."
+{ $subsection control }
+"There are two ways to implement a new control. First, an existing gadget can be wrapped in a control:"
+{ $subsection <control> }
+"Second, a new tuple class can be defined, whose instances delegate to controls:"
+{ $subsection construct-control }
+"Some utility words useful in control implementations:"
+{ $subsection control-model }
+{ $subsection control-value }
+{ $subsection set-control-value }
+{ $see-also "models" } ;
+
+ABOUT: "ui-control-impl"
diff --git a/extra/ui/gadgets/controls/controls.factor b/extra/ui/gadgets/controls/controls.factor
new file mode 100644 (file)
index 0000000..4123889
--- /dev/null
@@ -0,0 +1,37 @@
+! Copyright (C) 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel models ui.gadgets ;
+IN: ui.gadgets.controls
+
+TUPLE: control self model quot ;
+
+: (construct-control)
+    construct dup dup set-control-self ; inline
+
+: <control> ( model gadget quot -- gadget )
+    {
+        set-control-model set-gadget-delegate set-control-quot
+    } control (construct-control) ;
+
+: control-value ( control -- value )
+    control-model model-value ;
+
+: set-control-value ( value control -- )
+    control-model set-model ;
+
+M: control graft*
+    control-self dup dup control-model add-connection
+    model-changed ;
+
+M: control ungraft*
+    control-self dup control-model remove-connection ;
+
+M: control model-changed
+    control-self
+    [ control-value ] keep
+    [ dup control-quot call ] keep
+    relayout ;
+
+: construct-control ( model underlying class -- tuple )
+    >r [ 2drop ] <control> { set-gadget-delegate } r>
+    (construct-control) ; inline
diff --git a/extra/ui/gadgets/controls/summary.txt b/extra/ui/gadgets/controls/summary.txt
new file mode 100644 (file)
index 0000000..1c5383d
--- /dev/null
@@ -0,0 +1 @@
+Controls display a view of an underlying model
diff --git a/extra/ui/gadgets/editors/authors.txt b/extra/ui/gadgets/editors/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/editors/editors-docs.factor b/extra/ui/gadgets/editors/editors-docs.factor
new file mode 100644 (file)
index 0000000..bcd3822
--- /dev/null
@@ -0,0 +1,111 @@
+USING: documents help.markup help.syntax ui.gadgets
+ui.gadgets.scrollers ui.gadgets.controls
+models strings ui.commands ;
+IN: ui.gadgets.editors
+
+HELP: editor
+{ $class-description "An editor is a " { $link control } " for editing a multi-line passage of text stored in a " { $link document } " model. Editors are crated by calling " { $link <editor> } "."
+$nl
+"Editors have the following slots:"
+{ $list
+    { { $link editor-font } " - a font specifier." }
+    { { $link editor-color } " - text color specifier." }
+    { { $link editor-caret-color } " - caret color specifier." }
+    { { $link editor-selection-color } " - selection background color specifier." }
+    { { $link editor-caret } " - a model storing a line/column pair." }
+    { { $link editor-mark } " - a model storing a line/column pair. If there is no selection, the mark is equal to the caret, otherwise the mark is located at the opposite end of the selection from the caret." }
+    { { $link editor-focused? } " - a boolean." }
+} } ;
+
+HELP: loc-monitor
+{ $class-description "Instances of this class are used internally by " { $link editor } " controls to redraw the editor when the caret or mark is moved by calling " { $link set-model } " on " { $link editor-caret } " or " { $link editor-mark } "." } ;
+
+HELP: <editor>
+{ $values { "editor" "a new " { $link editor } } }
+{ $description "Creates a new " { $link editor } " with an empty document." } ;
+
+HELP: editor-caret ( editor -- caret )
+{ $values { "editor" editor } { "caret" model } }
+{ $description "Outputs a " { $link model } " holding the current caret location." } ;
+
+{ editor-caret editor-caret* editor-mark editor-mark* } related-words
+
+HELP: editor-caret*
+{ $values { "editor" editor } { "loc" "a pair of integers" } }
+{ $description "Outputs the current caret location as a line/column number pair." } ;
+
+HELP: editor-mark ( editor -- mark )
+{ $values { "editor" editor } { "mark" model } }
+{ $description "Outputs a " { $link model } " holding the current mark location." } ;
+
+HELP: editor-mark*
+{ $values { "editor" editor } { "loc" "a pair of integers" } }
+{ $description "Outputs the current mark location as a line/column number pair." } ;
+
+HELP: change-caret
+{ $values { "editor" editor } { "quot" "a quotation with stack effect " { $snippet "( loc -- newloc )" } } }
+{ $description "Applies a quotation to the current caret location and moves the caret to the location output by the quotation." } ;
+
+{ change-caret change-caret&mark mark>caret } related-words
+
+HELP: mark>caret
+{ $values { "editor" editor } }
+{ $description "Moves the mark to the caret location, effectively deselecting any selected text." } ;
+
+HELP: change-caret&mark
+{ $values { "editor" editor } { "quot" "a quotation with stack effect " { $snippet "( loc -- newloc )" } } }
+{ $description "Applies a quotation to the current caret location and moves the caret and the mark to the location output by the quotation." } ;
+
+HELP: point>loc
+{ $values { "point" "a pair of integers" } { "editor" editor } { "loc" "a pair of integers" } }
+{ $description "Converts a point to a line/column number pair." } ;
+
+HELP: scroll>caret
+{ $values { "editor" editor } }
+{ $description "Ensures that the caret becomes visible in a " { $link scroller } " containing the editor. Does nothing if no parent of " { $snippet "gadget" } " is a " { $link scroller } "." } ;
+
+HELP: remove-selection
+{ $values { "editor" editor } }
+{ $description "Removes currently selected text from the editor's " { $link document } "." } ;
+
+HELP: editor-string
+{ $values { "editor" editor } { "string" string } }
+{ $description "Outputs the contents of the editor's " { $link document } " as a string. Lines are separated by " { $snippet "\\n" } "." } ;
+
+HELP: set-editor-string
+{ $values { "string" string } { "editor" editor } }
+{ $description "Sets the contents of the editor's " { $link document } " to a string,  which may use either " { $snippet "\\n" } ", " { $snippet "\\r\\n" } " or " { $snippet "\\r" } " line separators." } ;
+
+ARTICLE: "gadgets-editors-selection" "The caret and mark"
+"If there is no selection, the caret and the mark are at the same location; otherwise the mark delimits the end-point of the selection opposite the caret."
+{ $subsection editor-caret }
+{ $subsection editor-caret* }
+{ $subsection editor-mark }
+{ $subsection editor-mark* }
+{ $subsection change-caret }
+{ $subsection change-caret&mark }
+{ $subsection mark>caret }
+"Getting the selected text:"
+{ $subsection gadget-selection? }
+{ $subsection gadget-selection }
+"Removing selected text:"
+{ $subsection remove-selection }
+"Scrolling to the caret location:"
+{ $subsection scroll>caret }
+"Use " { $link user-input* } " to change selected text." ;
+
+ARTICLE: "gadgets-editors" "Editor gadgets"
+"An editor edits a multi-line passage of text."
+{ $command-map editor "general" }
+{ $command-map editor "caret-motion" }
+{ $command-map editor "selection" }
+{ $heading "Editor words" }
+{ $subsection editor }
+{ $subsection <editor> }
+{ $subsection editor-string }
+{ $subsection set-editor-string }
+{ $subsection "gadgets-editors-selection" }
+{ $subsection "documents" }
+{ $subsection "document-locs-elts" } ;
+
+ABOUT: "gadgets-editors"
diff --git a/extra/ui/gadgets/editors/editors-tests.factor b/extra/ui/gadgets/editors/editors-tests.factor
new file mode 100644 (file)
index 0000000..7c60536
--- /dev/null
@@ -0,0 +1,29 @@
+USING: ui.gadgets.editors tools.test kernel io io.streams.plain
+io.streams.string definitions namespaces ui.gadgets
+ui.gadgets.grids prettyprint documents ;
+
+[ t ] [
+    <editor> "editor" set
+    "editor" get graft*
+    "editor" get <plain-writer> [ \ = see ] with-stream
+    "editor" get editor-string [ \ = see ] string-out =
+    "editor" get ungraft*
+] unit-test
+
+[ "foo bar" ] [
+    <editor> "editor" set
+    "editor" get graft*
+    "foo bar" "editor" get set-editor-string
+    "editor" get T{ one-line-elt } select-elt
+    "editor" get gadget-selection
+    "editor" get ungraft*
+] unit-test
+
+[ "baz quux" ] [
+    <editor> "editor" set
+    "editor" get graft*
+    "foo bar\nbaz quux" "editor" get set-editor-string
+    "editor" get T{ one-line-elt } select-elt
+    "editor" get gadget-selection
+    "editor" get ungraft*
+] unit-test
diff --git a/extra/ui/gadgets/editors/editors.factor b/extra/ui/gadgets/editors/editors.factor
new file mode 100644 (file)
index 0000000..abf26f3
--- /dev/null
@@ -0,0 +1,427 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays documents ui.clipboards ui.commands ui.gadgets
+ui.gadgets.borders ui.gadgets.buttons ui.gadgets.labels
+ui.gadgets.scrollers ui.gadgets.theme ui.gadgets.controls
+ui.render ui.gestures io kernel math models namespaces opengl
+opengl.gl sequences strings io.styles math.vectors sorting
+colors ;
+IN: ui.gadgets.editors
+
+TUPLE: editor
+font color caret-color selection-color
+caret mark
+focused? ;
+
+TUPLE: loc-monitor editor ;
+
+: <loc> ( editor -- loc )
+    loc-monitor construct-boa
+    { 0 0 } <model> [ add-connection ] keep ;
+
+: init-editor-locs ( editor -- )
+    dup <loc> over set-editor-caret
+    dup <loc> swap set-editor-mark ;
+
+: editor-theme ( editor -- )
+    black over set-editor-color
+    red over set-editor-caret-color
+    selection-color over set-editor-selection-color
+    monospace-font swap set-editor-font ;
+
+: <editor> ( -- editor )
+    <document> <gadget> editor construct-control
+    dup init-editor-locs
+    dup editor-theme ;
+
+: construct-editor ( class -- tuple )
+    >r <editor> { set-gadget-delegate } r>
+    (construct-control) ; inline
+
+TUPLE: source-editor ;
+
+: <source-editor> source-editor construct-editor ;
+
+: activate-editor-model ( editor model -- )
+    dup activate-model swap control-model add-loc ;
+
+: deactivate-editor-model ( editor model -- )
+    dup deactivate-model swap control-model remove-loc ;
+
+M: editor graft*
+    dup dup editor-caret activate-editor-model
+    dup dup editor-mark activate-editor-model
+    dup control-self swap control-model add-connection ;
+
+M: editor ungraft*
+    dup dup editor-caret deactivate-editor-model
+    dup dup editor-mark deactivate-editor-model
+    dup control-self swap control-model remove-connection ;
+
+M: editor model-changed
+    control-self dup control-model
+    over editor-caret [ over validate-loc ] (change-model)
+    over editor-mark [ over validate-loc ] (change-model)
+    drop relayout ;
+
+: editor-caret* ( editor -- loc ) editor-caret model-value ;
+
+: editor-mark* ( editor -- loc ) editor-mark model-value ;
+
+: change-caret ( editor quot -- )
+    over >r >r dup editor-caret* swap control-model r> call r>
+    [ control-model validate-loc ] keep
+    editor-caret set-model ; inline
+
+: mark>caret ( editor -- )
+    dup editor-caret* swap editor-mark set-model ;
+
+: change-caret&mark ( editor quot -- )
+    over >r change-caret r> mark>caret ; inline
+
+: editor-line ( n editor -- str ) control-value nth ;
+
+: editor-font* ( editor -- font ) editor-font open-font ;
+
+: line-height ( editor -- n )
+    editor-font* "" string-height ;
+
+: y>line ( y editor -- line# )
+    [ line-height / >fixnum ] keep control-model validate-line ;
+
+: point>loc ( point editor -- loc )
+    [
+        >r first2 r> tuck y>line dup ,
+        >r dup editor-font* r>
+        rot editor-line x>offset ,
+    ] { } make ;
+
+: click-loc ( editor model -- )
+    >r [ hand-rel ] keep point>loc r> set-model ;
+
+: focus-editor ( editor -- )
+    t over set-editor-focused? relayout-1 ;
+
+: unfocus-editor ( editor -- )
+    f over set-editor-focused? relayout-1 ;
+
+: (offset>x) ( font col# str -- x )
+    swap head-slice string-width ;
+
+: offset>x ( col# line# editor -- x )
+    [ editor-line ] keep editor-font* -rot (offset>x) ;
+
+: loc>x ( loc editor -- x ) >r first2 swap r> offset>x ;
+
+: line>y ( lines# editor -- y )
+    line-height * ;
+
+: caret-loc ( editor -- loc )
+    [ editor-caret* ] keep 2dup loc>x
+    rot first rot line>y 2array ;
+
+: caret-dim ( editor -- dim )
+    line-height 0 swap 2array ;
+
+: scroll>caret ( editor -- )
+    dup gadget-grafted? [
+        dup caret-loc over caret-dim { 1 0 } v+ <rect>
+        over scroll>rect
+    ] when drop ;
+
+M: loc-monitor model-changed
+    loc-monitor-editor control-self
+    dup relayout-1 scroll>caret ;
+
+: draw-caret ( -- )
+    editor get editor-focused? [
+        editor get
+        dup editor-caret-color gl-color
+        dup caret-loc origin get v+
+        swap caret-dim over v+
+        [ { 0.5 -0.5 } v+ ] 2apply gl-line
+    ] when ;
+
+: line-translation ( n -- loc )
+    editor get line-height * 0.0 swap 2array ;
+
+: translate-lines ( n -- )
+    line-translation gl-translate ;
+
+: draw-line ( editor str -- )
+    >r editor-font r> { 0 0 } draw-string ;
+
+: first-visible-line ( editor -- n )
+    clip get rect-loc second origin get second -
+    swap y>line ;
+
+: last-visible-line ( editor -- n )
+    clip get rect-extent nip second origin get second -
+    swap y>line 1+ ;
+
+: with-editor ( editor quot -- )
+    [
+        swap
+        dup first-visible-line \ first-visible-line set
+        dup last-visible-line \ last-visible-line set
+        dup control-model document set
+        editor set
+        call
+    ] with-scope ; inline
+
+: visible-lines ( editor -- seq )
+    \ first-visible-line get
+    \ last-visible-line get
+    rot control-value <slice> ;
+
+: with-editor-translation ( n quot -- )
+    >r line-translation origin get v+ r> with-translation ;
+    inline
+
+: draw-lines ( -- )
+    \ first-visible-line get [
+        editor get dup editor-color gl-color
+        dup visible-lines
+        [ draw-line 1 translate-lines ] curry* each
+    ] with-editor-translation ;
+
+: selection-start/end ( editor -- start end )
+    dup editor-mark* swap editor-caret* sort-pair ;
+
+: (draw-selection) ( x1 x2 -- )
+    2dup = [ 2 + ] when
+    0.0 swap editor get line-height glRectd ;
+
+: draw-selected-line ( start end n -- )
+    [ start/end-on-line ] keep tuck
+    >r >r editor get offset>x r> r>
+    editor get offset>x
+    (draw-selection) ;
+
+: draw-selection ( -- )
+    editor get editor-selection-color gl-color
+    editor get selection-start/end
+    over first [
+        2dup [
+            >r 2dup r> draw-selected-line
+            1 translate-lines
+        ] each-line 2drop
+    ] with-editor-translation ;
+
+M: editor draw-gadget*
+    [ draw-selection draw-lines draw-caret ] with-editor ;
+
+M: editor pref-dim*
+    dup editor-font* swap control-value text-dim ;
+
+M: editor gadget-selection?
+    selection-start/end = not ;
+
+M: editor gadget-selection
+    [ selection-start/end ] keep control-model doc-range ;
+
+: remove-selection ( editor -- )
+    [ selection-start/end ] keep control-model remove-doc-range ;
+
+M: editor user-input*
+    [ selection-start/end ] keep control-model set-doc-range t ;
+
+: editor-string ( editor -- string )
+    control-model doc-string ;
+
+: set-editor-string ( string editor -- )
+    control-model set-doc-string ;
+
+M: editor gadget-text* editor-string % ;
+
+: start-selection ( editor -- )
+    dup editor-caret click-loc ;
+
+: extend-selection ( editor -- )
+    dup request-focus start-selection ;
+
+: editor-cut ( editor clipboard -- )
+    dupd gadget-copy remove-selection ;
+
+: delete/backspace ( elt editor quot -- )
+    over gadget-selection? [
+        drop nip remove-selection
+    ] [
+        over >r >r dup editor-caret* swap control-model
+        r> call r> control-model remove-doc-range
+    ] if ; inline
+
+: editor-delete ( editor elt -- )
+    swap [ over >r rot next-elt r> swap ] delete/backspace ;
+
+: editor-backspace ( editor elt -- )
+    swap [ over >r rot prev-elt r> ] delete/backspace ;
+
+: editor-select-prev ( editor elt -- )
+    swap [ rot prev-elt ] change-caret ;
+
+: editor-prev ( editor elt -- )
+    dupd editor-select-prev mark>caret ;
+
+: editor-select-next ( editor elt -- )
+    swap [ rot next-elt ] change-caret ;
+
+: editor-next ( editor elt -- )
+    dupd editor-select-next mark>caret ;
+
+: editor-select ( from to editor -- )
+    tuck editor-caret set-model editor-mark set-model ;
+
+: select-elt ( editor elt -- )
+    over >r
+    >r dup editor-caret* swap control-model r> prev/next-elt
+    r> editor-select ;
+
+: start-of-document ( editor -- ) T{ doc-elt } editor-prev ;
+
+: end-of-document ( editor -- ) T{ doc-elt } editor-next ;
+
+: selected-word ( editor -- string )
+    dup gadget-selection? [
+        dup T{ one-word-elt } select-elt
+    ] unless gadget-selection ;
+
+: (position-caret) ( editor -- )
+    dup extend-selection
+    dup editor-mark click-loc ;
+
+: position-caret ( editor -- )
+    hand-click# get {
+        [ ]
+        [ dup (position-caret) ]
+        [ dup T{ one-word-elt } select-elt ]
+        [ dup T{ one-line-elt } select-elt ]
+    } ?nth call drop ;
+
+: insert-newline "\n" swap user-input ;
+
+: delete-next-character T{ char-elt } editor-delete ;
+
+: delete-previous-character T{ char-elt } editor-backspace ;
+
+: delete-previous-word T{ word-elt } editor-delete ;
+
+: delete-next-word T{ word-elt } editor-backspace ;
+
+: delete-to-start-of-line T{ one-line-elt } editor-delete ;
+
+: delete-to-end-of-line T{ one-line-elt } editor-backspace ;
+
+editor "general" f {
+    { T{ key-down f f "RET" } insert-newline }
+    { T{ key-down f { S+ } "RET" } insert-newline }
+    { T{ key-down f f "ENTER" } insert-newline }
+    { T{ key-down f f "DELETE" } delete-next-character }
+    { T{ key-down f { S+ } "DELETE" } delete-next-character }
+    { T{ key-down f f "BACKSPACE" } delete-previous-character }
+    { T{ key-down f { S+ } "BACKSPACE" } delete-previous-character }
+    { T{ key-down f { C+ } "DELETE" } delete-previous-word }
+    { T{ key-down f { C+ } "BACKSPACE" } delete-next-word }
+    { T{ key-down f { A+ } "DELETE" } delete-to-start-of-line }
+    { T{ key-down f { A+ } "BACKSPACE" } delete-to-end-of-line }
+} define-command-map
+
+: paste clipboard get paste-clipboard ;
+
+: paste-selection selection get paste-clipboard ;
+
+: cut clipboard get editor-cut ;
+
+editor "clipboard" f {
+    { T{ paste-action } paste }
+    { T{ button-up f f 2 } paste-selection }
+    { T{ copy-action } com-copy }
+    { T{ button-up } com-copy-selection }
+    { T{ cut-action } cut }
+} define-command-map
+
+: previous-character T{ char-elt } editor-prev ;
+
+: next-character T{ char-elt } editor-next ;
+
+: previous-line T{ line-elt } editor-prev ;
+
+: next-line T{ line-elt } editor-next ;
+
+: previous-word T{ word-elt } editor-prev ;
+
+: next-word T{ word-elt } editor-next ;
+
+: start-of-line T{ one-line-elt } editor-prev ;
+
+: end-of-line T{ one-line-elt } editor-next ;
+
+editor "caret-motion" f {
+    { T{ button-down } position-caret }
+    { T{ key-down f f "LEFT" } previous-character }
+    { T{ key-down f f "RIGHT" } next-character }
+    { T{ key-down f f "UP" } previous-line }
+    { T{ key-down f f "DOWN" } next-line }
+    { T{ key-down f { C+ } "LEFT" } previous-word }
+    { T{ key-down f { C+ } "RIGHT" } next-word }
+    { T{ key-down f f "HOME" } start-of-line }
+    { T{ key-down f f "END" } end-of-line }
+    { T{ key-down f { C+ } "HOME" } start-of-document }
+    { T{ key-down f { C+ } "END" } end-of-document }
+} define-command-map
+
+: select-all T{ doc-elt } select-elt ;
+
+: select-line T{ one-line-elt } select-elt ;
+
+: select-word T{ one-word-elt } select-elt ;
+
+: select-previous-character T{ char-elt } editor-select-prev ;
+
+: select-next-character T{ char-elt } editor-select-next ;
+
+: select-previous-line T{ line-elt } editor-select-prev ;
+
+: select-next-line T{ line-elt } editor-select-next ;
+
+: select-previous-word T{ word-elt } editor-select-prev ;
+
+: select-next-word T{ word-elt } editor-select-next ;
+
+: select-start-of-line T{ one-line-elt } editor-select-prev ;
+
+: select-end-of-line T{ one-line-elt } editor-select-next ;
+
+: select-start-of-document T{ doc-elt } editor-select-prev ;
+
+: select-end-of-document T{ doc-elt } editor-select-next ;
+
+editor "selection" f {
+    { T{ button-down f { S+ } } extend-selection }
+    { T{ drag } start-selection }
+    { T{ gain-focus } focus-editor }
+    { T{ lose-focus } unfocus-editor }
+    { T{ delete-action } remove-selection }
+    { T{ select-all-action } select-all }
+    { T{ key-down f { C+ } "l" } select-line }
+    { T{ key-down f { S+ } "LEFT" } select-previous-character }
+    { T{ key-down f { S+ } "RIGHT" } select-next-character }
+    { T{ key-down f { S+ } "UP" } select-previous-line }
+    { T{ key-down f { S+ } "DOWN" } select-next-line }
+    { T{ key-down f { S+ C+ } "LEFT" } select-previous-line }
+    { T{ key-down f { S+ C+ } "RIGHT" } select-next-line }
+    { T{ key-down f { S+ } "HOME" } select-start-of-line }
+    { T{ key-down f { S+ } "END" } select-end-of-line }
+    { T{ key-down f { S+ C+ } "HOME" } select-start-of-document }
+    { T{ key-down f { S+ C+ } "END" } select-end-of-document }
+} define-command-map
+
+! Editors support the stream output protocol
+M: editor stream-write1 >r 1string r> stream-write ;
+
+M: editor stream-write
+    control-self dup end-of-document user-input ;
+
+M: editor stream-close drop ;
+
+M: editor stream-flush drop ;
diff --git a/extra/ui/gadgets/editors/summary.txt b/extra/ui/gadgets/editors/summary.txt
new file mode 100644 (file)
index 0000000..e0842a1
--- /dev/null
@@ -0,0 +1 @@
+Editors edit a plain text document
diff --git a/extra/ui/gadgets/frames/authors.txt b/extra/ui/gadgets/frames/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/frames/frames-docs.factor b/extra/ui/gadgets/frames/frames-docs.factor
new file mode 100644 (file)
index 0000000..cdae5cb
--- /dev/null
@@ -0,0 +1,42 @@
+USING: help.syntax ui.gadgets kernel arrays quotations tuples
+ui.gadgets.grids ui.gadgets.frames ;
+IN: help.markup
+
+: $ui-frame-constant ( element -- )
+    drop
+    { $description "Symbolic constant for a common input to " { $link grid-add } " and " { $link frame, } "." } print-element ;
+
+HELP: @center $ui-frame-constant ;
+HELP: @left $ui-frame-constant ;
+HELP: @right $ui-frame-constant ;
+HELP: @top $ui-frame-constant ;
+HELP: @bottom $ui-frame-constant ;
+HELP: @top-left $ui-frame-constant ;
+HELP: @top-right $ui-frame-constant ;
+HELP: @bottom-left $ui-frame-constant ;
+HELP: @bottom-right $ui-frame-constant ;
+
+HELP: frame
+{ $class-description "A frame is a gadget which lays out its children in a 3x3 grid. If the frame is enlarged past its preferred size, the center gadget fills up available room."
+$nl
+"Frames are constructed by calling " { $link <frame> } " and since they delegate to " { $link grid } " instances, children can be managed with " { $link grid-add } " and " { $link grid-remove } "." } ;
+
+HELP: <frame>
+{ $values { "frame" frame } }
+{ $description "Creates a new " { $link frame } " for laying out gadgets in a 3x3 grid." } ;
+
+{ <frame> make-frame build-frame } related-words
+
+HELP: make-frame
+{ $values { "quot" quotation } { "frame" frame } }
+{ $description "Creates a new frame. The quotation can add children by calling the " { $link frame, } " word." } ;
+
+HELP: build-frame
+{ $values { "tuple" tuple } { "quot" quotation } }
+{ $description "Creates a new frame and sets " { $snippet "tuple" } "'s delegate to the new frame. The quotation can add children by calling the " { $link frame, } " word, and access the frame by calling " { $link g } " or " { $link g-> } "." } ;
+
+HELP: frame,
+{ $values { "gadget" gadget } { "i" "non-negative integer" } { "j" "non-negative integer" } }
+{ $description "Adds a child gadget at the specified location. This word can only be called inside the quotation passed to " { $link make-frame } " or " { $link build-frame } "." } ;
+
+{ grid frame } related-words
diff --git a/extra/ui/gadgets/frames/frames-tests.factor b/extra/ui/gadgets/frames/frames-tests.factor
new file mode 100644 (file)
index 0000000..80cf70b
--- /dev/null
@@ -0,0 +1,4 @@
+IN: temporary
+USING: ui.gadgets.frames ui.gadgets tools.test ;
+
+[ ] [ <frame> layout ] unit-test
diff --git a/extra/ui/gadgets/frames/frames.factor b/extra/ui/gadgets/frames/frames.factor
new file mode 100644 (file)
index 0000000..4487f4d
--- /dev/null
@@ -0,0 +1,46 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays generic kernel math namespaces sequences words
+splitting math.vectors ui.gadgets.grids ui.gadgets ;
+IN: ui.gadgets.frames
+
+! A frame arranges gadgets in a 3x3 grid, where the center
+! gadgets gets left-over space.
+TUPLE: frame ;
+
+: <frame-grid> 9 [ drop <gadget> ] map 3 group ;
+
+: @center 1 1 ;
+: @left 0 1 ;
+: @right 2 1 ;
+: @top 1 0 ;
+: @bottom 1 2 ;
+
+: @top-left 0 0 ;
+: @top-right 2 0 ;
+: @bottom-left 0 2 ;
+: @bottom-right 2 2 ;
+
+: <frame> ( -- frame )
+    frame construct-empty
+    <frame-grid> <grid> over set-gadget-delegate ;
+
+: (fill-center) ( vec n -- )
+    over first pick third v+ [v-] 1 rot set-nth ;
+
+: fill-center ( horiz vert dim -- )
+    tuck (fill-center) (fill-center) ;
+
+M: frame layout*
+    dup compute-grid
+    [ rot rect-dim fill-center ] 3keep
+    grid-layout ;
+
+: make-frame ( quot -- frame )
+    <frame> make-gadget ; inline
+
+: build-frame ( tuple quot -- tuple )
+    <frame> build-gadget ; inline
+
+: frame, ( gadget i j -- )
+    \ make-gadget get -rot grid-add ;
diff --git a/extra/ui/gadgets/frames/summary.txt b/extra/ui/gadgets/frames/summary.txt
new file mode 100644 (file)
index 0000000..65c7b67
--- /dev/null
@@ -0,0 +1 @@
+Frames position children around a center child which fills up any remaining space
diff --git a/extra/ui/gadgets/gadgets-docs.factor b/extra/ui/gadgets/gadgets-docs.factor
new file mode 100644 (file)
index 0000000..faac461
--- /dev/null
@@ -0,0 +1,261 @@
+USING: ui.gadgets help.markup help.syntax opengl kernel strings
+tuples classes quotations ;
+
+HELP: rect
+{ $class-description "A rectangle with the following slots:"
+    { $list
+        { { $link rect-loc } " - the top-left corner of the rectangle as an x/y pair" }
+        { { $link rect-dim } " - the dimensions of the rectangle as a width/height pair" }
+    }
+    "Rectangles are constructed by calling " { $link <rect> } " and " { $link <extent-rect> } "."
+} ;
+
+HELP: <rect> ( loc dim -- rect )
+{ $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } { "rect" "a new " { $link rect } } }
+{ $description "Creates a new rectangle with the specified top-left location and dimensions." } ;
+
+{ <zero-rect> <rect> <extent-rect> } related-words
+
+HELP: set-rect-dim ( dim rect -- )
+{ $values { "dim" "a pair of integers" } { "rect" rect } }
+{ $description "Modifies the dimensions of a rectangle. To resize a gadget, use " { $link set-gadget-dim } " or " { $link set-layout-dim } " instead." }
+{ $side-effects "rect" } ;
+
+HELP: rect-bounds
+{ $values { "rect" rect } { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
+{ $description "Outputs the location and dimensions of a rectangle." } ;
+
+{ rect-bounds rect-extent } related-words
+
+HELP: <extent-rect> ( loc ext -- rect )
+{ $values { "loc" "a pair of integers" } { "ext" "a pair of integers" } { "rect" "a new " { $link rect } } }
+{ $description "Creates a new rectangle with the specified top-left and bottom-right corner locations." } ;
+
+HELP: rect-extent
+{ $values { "rect" rect } { "loc" "a pair of integers" } { "ext" "a pair of integers" } }
+{ $description "Outputs the location of the top-left and bottom-right corners of a rectangle." } ;
+
+HELP: offset-rect
+{ $values { "rect" rect } { "loc" "a pair of integers" } { "newrect" "a new " { $link rect } } }
+{ $description "Creates a new rectangle with the same dimensions, and top-left corner translated by " { $snippet "loc" } "." } ;
+
+HELP: rect-intersect
+{ $values { "rect1" rect } { "rect2" rect } { "newrect" "a new " { $link rect } } }
+{ $description "Computes the intersection of two rectangles." } ;
+
+HELP: intersects?
+{ $values { "rect/point" "a " { $link rect } " or a pair of integers" } { "rect" rect } { "?" "a boolean" } }
+{ $description "Tests if two rectangles (or a point and a rectangle, respectively) have a non-empty intersection." } ;
+
+HELP: gadget-child
+{ $values { "gadget" gadget } { "child" gadget } }
+{ $description "Outputs the first child of the gadget. Typicallykernel.private this word is used with gadgets which are known to have an only child." } ;
+
+HELP: nth-gadget
+{ $values { "n" "a non-negative integer" } { "gadget" gadget } { "child" gadget } }
+{ $description "Outputs the " { $snippet "n" } "th child of the gadget." }
+{ $errors "Throws an error if " { $snippet "n" } " is negative or greater than or equal to the number of children." } ;
+
+HELP: <zero-rect>
+{ $values { "rect" "a new " { $link rect } } }
+{ $description "Creates a rectangle located at the origin with zero dimensions." } ;
+
+HELP: <gadget>
+{ $values { "gadget" "a new " { $link gadget } } }
+{ $description "Creates a new gadget." } ;
+
+{ <gadget> set-gadget-delegate } related-words
+
+HELP: relative-loc
+{ $values { "fromgadget" gadget } { "togadget" gadget } { "loc" "a pair of integers" } }
+{ $description
+    "Outputs the location of the top-left corner of " { $snippet "togadget" } " relative to the co-ordinate system of " { $snippet "fromgadget" } "."
+}
+{ $errors
+    "Throws an error if " { $snippet "togadget" } " is not contained in a child of " { $snippet "fromgadget" } "."
+} ;
+
+HELP: user-input*
+{ $values { "str" string } { "gadget" gadget } { "?" "a boolean" } }
+{ $contract "Handle free-form textual input while the gadget has keyboard focus." } ;
+
+HELP: children-on
+{ $values { "rect/point" "a " { $link rect } " or a pair of integers" } { "gadget" gadget } { "seq" "a sequence of gadgets" } }
+{ $contract "Outputs a sequence of gadgets which potentially intersect a rectangle or contain a point in the co-ordinate system of the gadget." }
+{ $notes "This does not have to be an accurate intersection test, and simply returning " { $link gadget-children } " is a valid implementation. However, an accurate intersection test reduces the amount of work done when drawing this gadget if it is partially clipped and not all children are visible." } ;
+
+HELP: pick-up
+{ $values { "point" "a pair of integers" } { "gadget" gadget } { "child/f" "a " { $link gadget } " or " { $link f } } }
+{ $description "Outputs the child at a point in the gadget's co-ordinate system. This word recursively descends the gadget hierarchy, and so outputs the deepest child." } ;
+
+HELP: max-dim
+{ $values { "dims" "a sequence of pairs of integers" } { "dim" "a pair of integers" } }
+{ $description "Outputs the smallest dimensions of a rectangle which can fit all the dimensions in the sequence." } ;
+
+{ pref-dims max-dim dim-sum } related-words
+
+HELP: each-child
+{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( child -- )" } } }
+{ $description "Applies the quotation to each child of the gadget." } ;
+
+HELP: set-gadget-delegate
+{ $values { "gadget" gadget } { "tuple" tuple } }
+{ $description "Sets the delegate of " { $snippet "tuple" } " to " { $snippet "gadget" } ". This is like " { $link set-delegate } ", except that to ensure correct behavior, the parent of each child of " { $snippet "gadget" } " is changed to " { $snippet "tuple" } "." }
+{ $notes "This word should be used instead of " { $link set-delegate } " when setting a tuple's delegate to a gadget." } ;
+
+HELP: gadget-selection?
+{ $values { "gadget" gadget } { "?" "a boolean" } }
+{ $contract "Outputs if the gadget has an active text selection; if so, the selected text can be obtained with a call to " { $link gadget-selection } "." } ;
+
+HELP: gadget-selection
+{ $values { "gadget" gadget } { "string/f" "a " { $link string } " or " { $link f } } }
+{ $contract "Outputs the gadget's text selection, or " { $link f } " if nothing is selected." } ;
+
+HELP: relayout
+{ $values { "gadget" gadget } }
+{ $description "Relayout and redraw a gadget before the next iteration of the event loop. Unlike " { $link relayout-1 } ", this relayouts all parents up to a gadget having " { $link gadget-root? } " set, so this word should be used when the gadget's dimensions have potentially changed." } ;
+
+HELP: relayout-1
+{ $values { "gadget" gadget } }
+{ $description "Relayout and redraw a gadget before the next iteration of the event loop. Unlike " { $link relayout } ", this does not propagate requests up to the parent, and so this word should only be used when the gadget's internal layout or appearance has changed, but the dimensions have not." } ;
+
+{ relayout relayout-1 } related-words
+
+HELP: set-layout-dim
+{ $values { "dim" "a pair of integers" } { "gadget" gadget } }
+{ $description "Resizes a gadget inside a " { $link layout* } " method." }
+{ $warning "Do not call this word outside of a " { $link layout* } " method, or otherwise the gadget will not be relayout automatically. Instead, use " { $link set-gadget-dim } "." } ;
+
+HELP: set-gadget-dim
+{ $values { "dim" "a pair of integers" } { "gadget" gadget } }
+{ $description "Resizes and relayouts a gadget before the next iteration of the event loop." }
+{ $warning "Do not call this word inside a " { $link layout* } " method, or otherwise unnecessary work will be done by the UI to ensure the gadget is relayout. Instead, use " { $link set-layout-dim } "." } ;
+
+HELP: pref-dim*
+{ $values { "gadget" gadget } { "dim" "a pair of integers" } }
+{ $contract "Outputs the preferred dimensions of the gadget, possibly computing them from the preferred dimensions of the gadget's children." }
+{ $notes "User code should not call this word directly, instead call " { $link pref-dim } "." } ;
+
+HELP: pref-dim
+{ $values { "gadget" gadget } { "dim" "a pair of integers" } }
+{ $description "Outputs the preferred dimensions of the gadget. The value is cached between calls, and invalidated when the gadget needs to be relayout." } ;
+
+HELP: pref-dims
+{ $values { "gadgets" "a sequence of gadgets" } { "seq" "a sequence of pairs of integers" } }
+{ $description "Collects the preferred dimensions of every gadget in the sequence into a new sequence." } ;
+
+HELP: layout*
+{ $values { "gadget" gadget } }
+{ $contract "Lays out the children of the gadget according to the gadget's policy. The dimensions of the gadget are already set by the parent by the time this word is called." }
+{ $notes "User code should not call this word directly, instead call " { $link relayout } " and " { $link relayout-1 } "." } ;
+
+HELP: prefer
+{ $values { "gadget" gadget } }
+{ $contract "Resizes the gadget to assume its preferred dimensions." } ;
+
+HELP: dim-sum
+{ $values { "seq" "a sequence of pairs of integers" } { "dim" "a pair of integers" } }
+{ $description "Sums a sequence of dimensions." } ;
+
+HELP: layout
+{ $values { "gadget" gadget } }
+{ $description "Lays out the children of the gadget if the gadget needs to be relayout, and otherwise does nothing." }
+{ $notes "User code should not call this word directly, instead call " { $link relayout } " and " { $link relayout-1 } "." } ;
+
+{ pref-dim pref-dim* layout layout* } related-words
+
+HELP: graft*
+{ $values { "gadget" gadget } }
+{ $contract "Called to notify the gadget it has become visible on the screen. This should set up timers and threads, and acquire any resources used by the gadget." } ;
+
+{ graft graft* ungraft ungraft* } related-words
+
+HELP: ungraft*
+{ $values { "gadget" gadget } }
+{ $contract "Called to notify the gadget it is no longer visible on the screen. This should stop timers and threads, and release any resources used by the gadget." } ;
+
+HELP: graft
+{ $values { "gadget" gadget } }
+{ $description "Calls " { $link graft* } " on the gadget and all children." }
+{ $notes "This word should never be called directly." } ;
+
+HELP: ungraft
+{ $values { "gadget" gadget } }
+{ $description "If the gadget is grafted, calls " { $link ungraft* } " on the gadget and all children." }
+{ $notes "This word should never be called directly." } ;
+
+HELP: unparent
+{ $values { "gadget" gadget } }
+{ $description "Removes the gadget from its parent. This will relayout the parent." }
+{ $notes "This may result in " { $link ungraft* } " being called on the gadget and its children, if the gadget's parent is visible on the screen." } ;
+
+HELP: clear-gadget
+{ $values { "gadget" gadget } }
+{ $description "Removes all children from the gadget. This will relayout the gadget." }
+{ $notes "This may result in " { $link ungraft* } " being called on the children, if the gadget is visible on the screen." }
+{ $side-effects "gadget" } ;
+
+HELP: add-gadget
+{ $values { "gadget" gadget } { "parent" gadget } }
+{ $description "Adds a child gadget to a parent. If the gadget is contained in another gadget, " { $link unparent } " is called on the gadget first. The parent will be relayout." }
+{ $notes "Adding a gadget to a parent may result in " { $link graft* } " being called on the children, if the parent is visible on the screen." }
+{ $side-effects "parent" } ;
+
+HELP: add-gadgets
+{ $values { "seq" "a sequence of gadgets" } { "parent" gadget } }
+{ $description "Adds a sequence of gadgets to a parent. The parent will be relayout." }
+{ $notes "This may result in " { $link graft* } " being called on the children, if the parent is visible on the screen." }
+{ $side-effects "parent" } ;
+
+HELP: parents
+{ $values { "gadget" gadget } { "seq" "a sequence of gadgets" } }
+{ $description "Outputs a sequence of all parents of the gadget, with the first element being the gadget itself." } ;
+
+HELP: each-parent
+{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( gadget -- ? )" } } { "?" "a boolean" } }
+{ $description "Applies the quotation to every parent of the gadget, starting from the gadget itself, stopping if the quotation yields " { $link f } ". Outputs " { $link t } " if the iteration completed, and outputs " { $link f } " if it was stopped prematurely." } ;
+
+HELP: find-parent
+{ $values { "gadget" gadget } { "quot" "a quotation with stack effect " { $snippet "( gadget -- ? )" } } { "parent" gadget } }
+{ $description "Outputs the first parent of the gadget, starting from the gadget itself, for which the quotation outputs a true value, or " { $link f } " if the quotation outputs " { $link f } " for every parent." } ;
+
+HELP: screen-loc
+{ $values { "gadget" gadget } { "loc" "a pair of integers" } }
+{ $description "Outputs the location of the gadget relative to the top-left corner of the world containing the gadget. This word does not output a useful value if the gadget is not grafted." } ;
+
+HELP: child?
+{ $values { "parent" gadget } { "child" gadget } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "child" } " is contained inside " { $snippet "parent" } "." } ;
+
+HELP: focusable-child*
+{ $values { "gadget" gadget } { "child/t" "a " { $link gadget } " or " { $link t } } }
+{ $description "Outputs the child of the gadget which would prefer to receive keyboard focus, or " { $link t } " if the gadget itself should receive focus." }
+{ $examples "For example, if your gadget consists of an editor together with an output area whose contents react to changes in editor contents, then the " { $link focusable-child* } " method for your gadget class should return the editor, so that when the gadget is displayed in a window or passed to " { $link request-focus } ", the editor receives keyboard focus automatically." } ;
+
+HELP: focusable-child
+{ $values { "gadget" gadget } { "child" gadget } }
+{ $description "Outputs the child of the gadget which would prefer to receive keyboard focus." } ;
+
+HELP: gadget,
+{ $values { "gadget" gadget } }
+{ $description "Adds a new child to the gadget being constructed. This word can only be used from a quotation passed to " { $link make-gadget } " or " { $link build-gadget } "." } ;
+
+HELP: make-gadget
+{ $values { "quot" quotation } { "gadget" gadget } }
+{ $description "Calls the quotation in a new scope with the gadget stored in the " { $link make-gadget } " variable." } ;
+
+HELP: build-gadget
+{ $values { "tuple" tuple } { "quot" quotation } { "gadget" gadget } }
+{ $description "Delegates the tuple to the gadget, and calls the quotation in a new scope with the tuple stored in the " { $link make-gadget } " and " { $link gadget } " variables." } ;
+
+HELP: with-gadget
+{ $values { "gadget" gadget } { "quot" quotation } } 
+{ $description "Calls the quotation in a new scope with the " { $link gadget } " and " { $link make-gadget } " variables set to " { $snippet "gadget" } ". The quotation can call " { $link g } " and " { $link g-> } " to access the gadget." } ;
+
+HELP: g
+{ $values { "gadget" gadget } }
+{ $description "Outputs the gadget being built. Can only be used inside a quotation passed to " { $link build-gadget } "." } ;
+
+HELP: g->
+{ $values { "x" object } { "gadget" gadget } }
+{ $description "Duplicates the top of the stack and outputs the gadget being built. Can only be used inside a quotation passed to " { $link build-gadget } "." } ;
diff --git a/extra/ui/gadgets/gadgets-tests.factor b/extra/ui/gadgets/gadgets-tests.factor
new file mode 100644 (file)
index 0000000..2a4527f
--- /dev/null
@@ -0,0 +1,110 @@
+IN: temporary
+USING: ui.gadgets ui.gadgets.packs ui.gadgets.worlds tools.test
+namespaces models kernel ;
+
+[ T{ rect f { 10 10 } { 20 20 } } ]
+[
+    T{ rect f { 10 10 } { 50 50 } }
+    T{ rect f { -10 -10 } { 40 40 } }
+    rect-intersect
+] unit-test
+
+[ T{ rect f { 200 200 } { 0 0 } } ]
+[
+    T{ rect f { 100 100 } { 50 50 } }
+    T{ rect f { 200 200 } { 40 40 } }
+    rect-intersect
+] unit-test
+
+[ f ] [
+    T{ rect f { 100 100 } { 50 50 } }
+    T{ rect f { 200 200 } { 40 40 } }
+    intersects?
+] unit-test
+
+[ t ] [
+    T{ rect f { 100 100 } { 50 50 } }
+    T{ rect f { 120 120 } { 40 40 } }
+    intersects?
+] unit-test
+
+[ f ] [
+    T{ rect f { 1000 100 } { 50 50 } }
+    T{ rect f { 120 120 } { 40 40 } }
+    intersects?
+] unit-test
+
+TUPLE: fooey ;
+
+C: <fooey> fooey
+
+[ ] [ <gadget> <fooey> set-gadget-delegate ] unit-test
+[ ] [ f <fooey> set-gadget-delegate ] unit-test
+
+[ { 300 300 } ]
+[
+    ! c contains b contains a
+    <gadget> "a" set
+    <gadget> "b" set
+    "a" get "b" get add-gadget
+    <gadget> "c" set
+    "b" get "c" get add-gadget
+    
+    ! position a and b
+    { 100 200 } "a" get set-rect-loc
+    { 200 100 } "b" get set-rect-loc
+    
+    ! give c a loc, it doesn't matter
+    { -1000 23 } "c" get set-rect-loc
+
+    ! what is the location of a inside c?
+    "a" get "c" get relative-loc
+] unit-test
+
+<gadget> "g1" set
+{ 10 10 } "g1" get set-rect-loc
+{ 30 30 } "g1" get set-rect-dim
+<gadget> "g2" set
+{ 20 20 } "g2" get set-rect-loc
+{ 50 500 } "g2" get set-rect-dim
+<gadget> "g3" set
+{ 100 200 } "g3" get set-rect-dim
+
+"g1" get "g2" get add-gadget
+"g2" get "g3" get add-gadget
+
+[ { 30 30 } ] [ "g1" get screen-loc ] unit-test
+[ { 30 30 } ] [ "g1" get screen-rect rect-loc ] unit-test
+[ { 30 30 } ] [ "g1" get screen-rect rect-dim ] unit-test
+[ { 20 20 } ] [ "g2" get screen-loc ] unit-test
+[ { 20 20 } ] [ "g2" get screen-rect rect-loc ] unit-test
+[ { 50 180 } ] [ "g2" get screen-rect rect-dim ] unit-test
+[ { 0 0 } ] [ "g3" get screen-loc ] unit-test
+[ { 0 0 } ] [ "g3" get screen-rect rect-loc ] unit-test
+[ { 100 200 } ] [ "g3" get screen-rect rect-dim ] unit-test
+
+<gadget> "g1" set
+{ 300 300 } "g1" get set-rect-dim
+<gadget> "g2" set
+"g2" get "g1" get add-gadget
+{ 20 20 } "g2" get set-rect-loc
+{ 20 20 } "g2" get set-rect-dim
+<gadget> "g3" set
+"g3" get "g1" get add-gadget
+{ 100 100 } "g3" get set-rect-loc
+{ 20 20 } "g3" get set-rect-dim
+
+[ t ] [ { 30 30 } "g2" get inside? ] unit-test
+
+[ t ] [ { 30 30 } "g1" get (pick-up) "g2" get eq? ] unit-test
+
+[ t ] [ { 30 30 } "g1" get pick-up "g2" get eq? ] unit-test
+
+[ t ] [ { 110 110 } "g1" get pick-up "g3" get eq? ] unit-test
+
+<gadget> "g4" set
+"g4" get "g2" get add-gadget
+{ 5 5 } "g4" get set-rect-loc
+{ 1 1 } "g4" get set-rect-dim
+
+[ t ] [ { 25 25 } "g1" get pick-up "g4" get eq? ] unit-test
diff --git a/extra/ui/gadgets/gadgets.factor b/extra/ui/gadgets/gadgets.factor
new file mode 100644 (file)
index 0000000..3d3dd42
--- /dev/null
@@ -0,0 +1,359 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays hashtables kernel models math namespaces sequences
+timers quotations math.vectors queues combinators sorting
+vectors ;
+IN: ui.gadgets
+
+TUPLE: rect loc dim ;
+
+C: <rect> rect
+
+M: array rect-loc ;
+
+M: array rect-dim drop { 0 0 } ;
+
+: rect-bounds ( rect -- loc dim ) dup rect-loc swap rect-dim ;
+
+: rect-extent ( rect -- loc ext ) rect-bounds over v+ ;
+
+: 2rect-extent ( rect rect -- loc1 loc2 ext1 ext2 )
+    [ rect-extent ] 2apply swapd ;
+
+: <extent-rect> ( loc ext -- rect ) over [v-] <rect> ;
+
+: offset-rect ( rect loc -- newrect )
+    over rect-loc v+ swap rect-dim <rect> ;
+
+: (rect-intersect) ( rect rect -- array array )
+    2rect-extent vmin >r vmax r> ;
+
+: rect-intersect ( rect1 rect2 -- newrect )
+    (rect-intersect) <extent-rect> ;
+
+: intersects? ( rect/point rect -- ? )
+    (rect-intersect) [v-] { 0 0 } = ;
+
+: (rect-union) ( rect rect -- array array )
+    2rect-extent vmax >r vmin r> ;
+
+: rect-union ( rect1 rect2 -- newrect )
+    (rect-union) <extent-rect> ;
+
+TUPLE: gadget
+pref-dim parent children orientation state focus
+visible? root? clipped? grafted?
+interior boundary ;
+
+M: gadget equal? 2drop f ;
+
+M: gadget hashcode* drop gadget hashcode* ;
+
+: gadget-child ( gadget -- child ) gadget-children first ;
+
+: nth-gadget ( n gadget -- child ) gadget-children nth ;
+
+: <zero-rect> ( -- rect ) { 0 0 } dup <rect> ;
+
+: <gadget> ( -- gadget )
+    <zero-rect> { 0 1 } t {
+        set-delegate
+        set-gadget-orientation
+        set-gadget-visible?
+    } gadget construct ;
+
+: construct-gadget ( class -- tuple )
+    >r <gadget> { set-delegate } r> construct ; inline
+
+: relative-loc ( fromgadget togadget -- loc )
+    2dup eq? [
+        2drop { 0 0 }
+    ] [
+        over rect-loc >r
+        >r gadget-parent r> relative-loc
+        r> v+
+    ] if ;
+
+GENERIC: user-input* ( str gadget -- ? )
+
+M: gadget user-input* 2drop t ;
+
+GENERIC: children-on ( rect/point gadget -- seq )
+
+M: gadget children-on nip gadget-children ;
+
+: (fast-children-on) ( dim axis gadgets -- i )
+    swapd [ rect-loc v- over v. ] binsearch nip ;
+
+: fast-children-on ( rect axis children -- from to )
+    3dup
+    >r >r dup rect-loc swap rect-dim v+
+    r> r> (fast-children-on) [ 1+ ] [ 0 ] if*
+    >r
+    >r >r rect-loc
+    r> r> (fast-children-on) 0 or
+    r> ;
+
+: inside? ( bounds gadget -- ? )
+    dup gadget-visible? [ intersects? ] [ 2drop f ] if ;
+
+: (pick-up) ( point gadget -- gadget )
+    dupd children-on [ inside? ] curry* find-last nip ;
+
+: pick-up ( point gadget -- child/f )
+    2dup (pick-up) dup
+    [ nip [ rect-loc v- ] keep pick-up ] [ rot 2drop ] if ;
+
+: max-dim ( dims -- dim ) { 0 0 } [ vmax ] reduce ;
+
+: dim-sum ( seq -- dim ) { 0 0 } [ v+ ] reduce ;
+
+: orient ( gadget seq1 seq2 -- seq )
+    >r >r gadget-orientation r> r> [ pick set-axis ] 2map nip ;
+
+: each-child ( gadget quot -- )
+    >r gadget-children r> each ; inline
+
+: set-gadget-delegate ( gadget tuple -- )
+    over [
+        dup pick [ set-gadget-parent ] curry* each-child
+    ] when set-delegate ;
+
+! Selection protocol
+GENERIC: gadget-selection? ( gadget -- ? )
+
+M: gadget gadget-selection? drop f ;
+
+GENERIC: gadget-selection ( gadget -- string/f )
+
+M: gadget gadget-selection drop f ;
+
+! Text protocol
+GENERIC: gadget-text* ( gadget -- )
+
+GENERIC: gadget-text-separator ( gadget -- str )
+
+M: gadget gadget-text-separator
+    gadget-orientation { 0 1 } = "\n" "" ? ;
+
+: gadget-seq-text ( seq gadget -- )
+    gadget-text-separator swap
+    [ dup % ] [ gadget-text* ] interleave drop ;
+
+M: gadget gadget-text*
+    dup gadget-children swap gadget-seq-text ;
+
+M: array gadget-text*
+    [ gadget-text* ] each ;
+
+: gadget-text ( gadget -- string ) [ gadget-text* ] "" make ;
+
+: invalidate ( gadget -- )
+    \ invalidate swap set-gadget-state ;
+
+: forget-pref-dim ( gadget -- ) f swap set-gadget-pref-dim ;
+
+: invalid ( -- queue ) \ invalid get-global ;
+
+: add-invalid ( gadget -- )
+    #! When unit testing gadgets without the UI running, the
+    #! invalid queue is not initialized and we simply ignore
+    #! invalidation requests.
+    invalid [ enque ] [ drop ] if* ;
+
+DEFER: relayout
+
+: invalidate* ( gadget -- )
+    \ invalidate* over set-gadget-state
+    dup forget-pref-dim
+    dup gadget-root?
+    [ add-invalid ] [ gadget-parent [ relayout ] when* ] if ;
+
+: relayout ( gadget -- )
+    dup gadget-state \ invalidate* eq?
+    [ drop ] [ invalidate* ] if ;
+
+: relayout-1 ( gadget -- )
+    dup gadget-state
+    [ drop ] [ dup invalidate add-invalid ] if ;
+
+: show-gadget t swap set-gadget-visible? ;
+
+: hide-gadget f swap set-gadget-visible? ;
+
+: (set-rect-dim) ( dim gadget quot -- )
+    >r 2dup rect-dim =
+    [ [ 2drop ] [ set-rect-dim ] if ] 2keep
+    [ drop ] r> if ; inline
+
+: set-layout-dim ( dim gadget -- )
+    [ invalidate ] (set-rect-dim) ;
+
+: set-gadget-dim ( dim gadget -- )
+    [ invalidate* ] (set-rect-dim) ;
+
+GENERIC: pref-dim* ( gadget -- dim )
+
+: ?set-gadget-pref-dim ( dim gadget -- )
+    dup gadget-state [ 2drop ] [ set-gadget-pref-dim ] if ;
+
+: pref-dim ( gadget -- dim )
+    dup gadget-pref-dim [ ] [
+        [ pref-dim* dup ] keep ?set-gadget-pref-dim
+    ] ?if ;
+
+: pref-dims ( gadgets -- seq ) [ pref-dim ] map ;
+
+M: gadget pref-dim* rect-dim ;
+
+GENERIC: layout* ( gadget -- )
+
+M: gadget layout* drop ;
+
+: prefer ( gadget -- ) dup pref-dim swap set-layout-dim ;
+
+: validate ( gadget -- ) f swap set-gadget-state ;
+
+: layout ( gadget -- )
+    dup gadget-state [
+        dup validate
+        dup layout*
+        dup [ layout ] each-child
+    ] when drop ;
+
+GENERIC: graft* ( gadget -- )
+
+M: gadget graft* drop ;
+
+: graft ( gadget -- )
+    t over set-gadget-grafted?
+    dup graft*
+    [ graft ] each-child ;
+
+GENERIC: ungraft* ( gadget -- )
+
+M: gadget ungraft* drop ;
+
+: ungraft ( gadget -- )
+    dup gadget-grafted? [
+        dup [ ungraft ] each-child
+        dup ungraft*
+        f over set-gadget-grafted?
+    ] when drop ;
+
+: (unparent) ( gadget -- )
+    dup ungraft
+    dup forget-pref-dim
+    f swap set-gadget-parent ;
+
+: unfocus-gadget ( child gadget -- )
+    tuck gadget-focus eq?
+    [ f swap set-gadget-focus ] [ drop ] if ;
+
+: unparent ( gadget -- )
+    [
+        dup gadget-parent dup [
+            over (unparent)
+            [ unfocus-gadget ] 2keep
+            [ gadget-children delete ] keep
+            relayout
+        ] [
+            2drop
+        ] if
+    ] when* ;
+
+: (clear-gadget) ( gadget -- )
+    dup [ (unparent) ] each-child
+    f over set-gadget-focus
+    f swap set-gadget-children ;
+
+: clear-gadget ( gadget -- )
+    dup (clear-gadget) relayout ;
+
+: ((add-gadget)) ( gadget box -- )
+    [ gadget-children ?push ] keep set-gadget-children ;
+
+: (add-gadget) ( gadget box -- )
+    over unparent
+    dup pick set-gadget-parent
+    [ ((add-gadget)) ] 2keep
+    gadget-grafted? [ graft ] [ drop ] if ;
+
+: add-gadget ( gadget parent -- )
+    [ (add-gadget) ] keep relayout ;
+
+: add-gadgets ( seq parent -- )
+    swap [ over (add-gadget) ] each relayout ;
+
+: (parents) ( gadget -- )
+    [ dup , gadget-parent (parents) ] when* ;
+
+: parents ( gadget -- seq )
+    [ (parents) ] { } make ;
+
+: each-parent ( gadget quot -- ? )
+    >r parents r> all? ; inline
+
+: find-parent ( gadget quot -- parent )
+    >r parents r> find nip ; inline
+
+: screen-loc ( gadget -- loc )
+    parents { 0 0 } [ rect-loc v+ ] reduce ;
+
+: (screen-rect) ( gadget -- loc ext )
+    dup gadget-parent [
+        >r rect-extent r> (screen-rect)
+        >r tuck v+ r> vmin >r v+ r>
+    ] [
+        rect-extent
+    ] if* ;
+
+: screen-rect ( gadget -- rect )
+    (screen-rect) <extent-rect> ;
+
+: child? ( parent child -- ? )
+    {
+        { [ 2dup eq? ] [ 2drop t ] }
+        { [ dup not ] [ 2drop f ] }
+        { [ t ] [ gadget-parent child? ] }
+    } cond ;
+
+GENERIC: focusable-child* ( gadget -- child/t )
+
+M: gadget focusable-child* drop t ;
+
+: focusable-child ( gadget -- child )
+    dup focusable-child*
+    dup t eq? [ drop ] [ nip focusable-child ] if ;
+
+GENERIC: request-focus-on ( child gadget -- )
+
+M: gadget request-focus-on gadget-parent request-focus-on ;
+
+M: f request-focus-on 2drop ;
+
+: request-focus ( gadget -- )
+    dup focusable-child swap request-focus-on ;
+
+: (focus-path) ( gadget -- )
+    [ dup , gadget-focus (focus-path) ] when* ;
+
+: focus-path ( world -- seq )
+    [ (focus-path) ] { } make ;
+
+: make-gadget ( quot gadget -- gadget )
+    [ \ make-gadget rot with-variable ] keep ; inline
+
+: gadget, ( gadget -- ) \ make-gadget get add-gadget ;
+
+: g ( -- gadget ) gadget get ;
+
+: g-> ( x -- x x gadget ) dup g ;
+
+: with-gadget ( gadget quot -- )
+    [
+        swap dup \ make-gadget set gadget set call
+    ] with-scope ; inline
+
+: build-gadget ( tuple quot gadget -- tuple )
+    pick set-gadget-delegate over >r with-gadget r> ; inline
diff --git a/extra/ui/gadgets/grid-lines/authors.txt b/extra/ui/gadgets/grid-lines/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/grid-lines/grid-lines-docs.factor b/extra/ui/gadgets/grid-lines/grid-lines-docs.factor
new file mode 100644 (file)
index 0000000..2318ce0
--- /dev/null
@@ -0,0 +1,5 @@
+USING: ui.gadgets help.markup help.syntax ui.gadgets.grid-lines
+ui.gadgets.grids ui.render ;
+
+HELP: grid-lines
+{ $class-description "A class implementing the " { $link draw-boundary } " generic word to draw lines between the cells of a " { $link grid } ". The color of the lines is a color specifier stored in the " { $link grid-lines-color } " slot." } ;
diff --git a/extra/ui/gadgets/grid-lines/grid-lines.factor b/extra/ui/gadgets/grid-lines/grid-lines.factor
new file mode 100644 (file)
index 0000000..f055ab0
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel math namespaces opengl opengl.gl sequences
+math.vectors ui.gadgets ui.gadgets.grids ui.render ;
+IN: ui.gadgets.grid-lines
+
+TUPLE: grid-lines color ;
+
+C: <grid-lines> grid-lines
+
+SYMBOL: grid-dim
+
+: half-gap grid get grid-gap [ 2/ ] map ; inline
+
+: grid-line-from/to ( orientation point -- from to )
+    half-gap v-
+    [ half-gap swap rot set-axis ] 2keep
+    grid-dim get swap rot set-axis ;
+
+: draw-grid-lines ( gaps orientation -- )
+    grid get rot grid-positions grid get rect-dim add [
+        grid-line-from/to gl-line
+    ] curry* each ;
+
+M: grid-lines draw-boundary
+    origin get [
+        -0.5 -0.5 0.0 glTranslated
+        grid-lines-color gl-color [
+            dup grid set
+            dup rect-dim half-gap v- grid-dim set
+            compute-grid
+            { 0 1 } draw-grid-lines
+            { 1 0 } draw-grid-lines
+        ] with-scope
+    ] with-translation ;
diff --git a/extra/ui/gadgets/grid-lines/summary.txt b/extra/ui/gadgets/grid-lines/summary.txt
new file mode 100644 (file)
index 0000000..a6607dd
--- /dev/null
@@ -0,0 +1 @@
+Grid lines visibly separate children of grids and frames
diff --git a/extra/ui/gadgets/grids/authors.txt b/extra/ui/gadgets/grids/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/grids/grids-docs.factor b/extra/ui/gadgets/grids/grids-docs.factor
new file mode 100644 (file)
index 0000000..a52c7af
--- /dev/null
@@ -0,0 +1,32 @@
+USING: ui.gadgets help.markup help.syntax arrays
+ui.gadgets.grids ;
+
+HELP: grid
+{ $class-description "A grid gadget lays out its children so that all gadgets in a column have equal width and all gadgets in a row have equal height."
+$nl
+"The " { $link grid-gap } " slot stores a pair of integers, the horizontal and vertical gap between children, respectively."
+$nl
+"The " { $link grid-fill? } " slot stores a boolean, indicating if grid cells should assume their preferred size, or if they should fill the dimensions of the cell. The default is " { $link t } "."
+$nl
+"Grids are created by calling " { $link <grid> } " and children are managed with " { $link grid-add } " and " { $link grid-remove } "."
+$nl
+"The " { $link add-gadget } ", " { $link unparent } " and " { $link clear-gadget } " words should not be used to manage child gadgets of grids." } ;
+
+HELP: <grid>
+{ $values { "children" "a sequence of sequences of gadgets" } { "grid" "a new " { $link grid } } }
+{ $description "Creates a new " { $link grid } " gadget with the given children." } ;
+
+HELP: grid-child
+{ $values { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } { "gadget" gadget } }
+{ $description "Outputs the child gadget at the " { $snippet "i" } "," { $snippet "j" } "th position of the grid." }
+{ $errors "Throws an error if the indices are out of bounds." } ;
+
+HELP: grid-add
+{ $values { "gadget" gadget } { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } }
+{ $description "Adds a child gadget at the specified location." }
+{ $side-effects "grid" } ;
+
+HELP: grid-remove
+{ $values { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } }
+{ $description "Removes a child gadget from the specified location." }
+{ $side-effects "grid" } ;
diff --git a/extra/ui/gadgets/grids/grids-tests.factor b/extra/ui/gadgets/grids/grids-tests.factor
new file mode 100644 (file)
index 0000000..6f08009
--- /dev/null
@@ -0,0 +1,47 @@
+USING: ui.gadgets ui.gadgets.grids tools.test kernel arrays
+namespaces ;
+IN: temporary
+
+[ { 0 0 } ] [ { } <grid> pref-dim ] unit-test
+
+: 100x100 <gadget> { 100 100 } over set-rect-dim ;
+
+[ { 100 100 } ] [
+    100x100
+    1array 1array <grid> pref-dim
+] unit-test
+
+[ { 100 100 } ] [
+    100x100
+    1array 1array <grid> pref-dim
+] unit-test
+
+[ { 200 100 } ] [
+    100x100
+    100x100
+    2array 1array <grid> pref-dim
+] unit-test
+
+[ { 100 200 } ] [
+    100x100
+    100x100
+    [ 1array ] 2apply 2array <grid> pref-dim
+] unit-test
+
+[ ] [
+    100x100
+    100x100
+    [ 1array ] 2apply 2array <grid> layout
+] unit-test
+
+[ { 230 120 } { 100 100 } { 100 100 } ] [
+    100x100 dup "a" set
+    100x100 dup "b" set
+    2array 1array <grid>
+    { 10 10 } over set-grid-gap
+    dup prefer
+    dup layout
+    rect-dim
+    "a" get rect-dim
+    "b" get rect-dim
+] unit-test
diff --git a/extra/ui/gadgets/grids/grids.factor b/extra/ui/gadgets/grids/grids.factor
new file mode 100644 (file)
index 0000000..4572bc1
--- /dev/null
@@ -0,0 +1,88 @@
+! Copyright (C) 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel math namespaces sequences words io
+io.streams.string math.vectors ui.gadgets ;
+IN: ui.gadgets.grids
+
+TUPLE: grid children gap fill? ;
+
+: set-grid-children* ( children grid -- )
+    [ set-grid-children ] 2keep >r concat r> add-gadgets ;
+
+: <grid> ( children -- grid )
+    grid construct-gadget
+    [ set-grid-children* ] keep
+    { 0 0 } over set-grid-gap
+    t over set-grid-fill? ;
+
+: grid-child ( grid i j -- gadget ) rot grid-children nth nth ;
+
+: grid-add ( gadget grid i j -- )
+    >r >r 2dup add-gadget r> r>
+    3dup grid-child unparent rot grid-children nth set-nth ;
+
+: grid-remove ( grid i j -- )
+    >r >r >r <gadget> r> r> r> grid-add ;
+
+: pref-dim-grid ( grid -- dims )
+    grid-children [ [ pref-dim ] map ] map ;
+
+: (compute-grid) [ max-dim ] map ;
+
+: compute-grid ( grid -- horiz vert )
+    pref-dim-grid dup flip (compute-grid) swap (compute-grid) ;
+
+: (pair-up) ( horiz vert -- dim )
+    >r first r> second 2array ;
+
+: pair-up ( horiz vert -- dims )
+    [ [ (pair-up) ] curry map ] curry* map ;
+
+: add-gaps ( gap seq -- newseq )
+    [ v+ ] curry* map ;
+
+: gap-sum ( gap seq -- newseq )
+    dupd add-gaps dim-sum v+ ;
+
+M: grid pref-dim*
+    dup grid-gap swap compute-grid >r over r>
+    gap-sum >r gap-sum r> (pair-up) ;
+
+: do-grid ( dims grid quot -- )
+    -rot grid-children
+    [ [ pick call ] 2each ] 2each
+    drop ; inline
+
+: grid-positions ( grid dims -- locs )
+    >r grid-gap dup r> add-gaps swap [ v+ ] accumulate nip ;
+
+: position-grid ( grid horiz vert -- )
+    pick >r
+    >r over r> grid-positions >r grid-positions r>
+    pair-up r> [ set-rect-loc ] do-grid ;
+
+: resize-grid ( grid horiz vert -- )
+    pick grid-fill? [
+        pair-up swap [ set-layout-dim ] do-grid
+    ] [
+        2drop grid-children [ [ prefer ] each ] each
+    ] if ;
+
+: grid-layout ( grid horiz vert -- )
+    [ position-grid ] 3keep resize-grid ;
+
+M: grid layout* dup compute-grid grid-layout ;
+
+M: grid children-on ( rect gadget -- seq )
+    dup gadget-children empty? [
+        2drop f
+    ] [
+        { 0 1 } swap grid-children
+        [ 0 <column> fast-children-on ] keep
+        <slice> concat
+    ] if ;
+
+M: grid gadget-text*
+    grid-children
+    [ [ gadget-text ] map ] map format-table
+    [ CHAR: \n , ] [ % ] interleave ;
diff --git a/extra/ui/gadgets/grids/summary.txt b/extra/ui/gadgets/grids/summary.txt
new file mode 100644 (file)
index 0000000..c040c5b
--- /dev/null
@@ -0,0 +1 @@
+Grids arrange children in a variable-size grid
diff --git a/extra/ui/gadgets/handler/handler.factor b/extra/ui/gadgets/handler/handler.factor
new file mode 100644 (file)
index 0000000..da33660
--- /dev/null
@@ -0,0 +1,11 @@
+
+USING: kernel assocs ui.gestures ;
+
+IN: ui.gadgets.handler
+
+TUPLE: handler table ;
+
+C: <handler> handler
+
+M: handler handle-gesture* ( gadget gesture delegate -- ? )
+handler-table at dup [ call f ] [ 2drop t ] if ;
\ No newline at end of file
diff --git a/extra/ui/gadgets/incremental/authors.txt b/extra/ui/gadgets/incremental/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/incremental/incremental-docs.factor b/extra/ui/gadgets/incremental/incremental-docs.factor
new file mode 100644 (file)
index 0000000..ecd417d
--- /dev/null
@@ -0,0 +1,27 @@
+USING: ui.gadgets help.markup help.syntax
+ui.gadgets.incremental ui.gadgets.packs ;
+
+HELP: incremental
+{ $class-description "An incremental layout gadget delegates to a " { $link pack } " and implements an optimization which the relayout operation after adding a child to be done in constant time."
+$nl
+"Incremental layout gadgets are created by calling " { $link <incremental> } "."
+$nl
+"Children are managed with the " { $link add-incremental } " and " { $link clear-incremental } " words."
+$nl
+"Not every " { $link pack } " can use incremental layout, since incremental layout does not support non-default values for " { $link pack-align } ", " { $link pack-fill } ", and " { $link pack-gap } "." } ;
+
+HELP: <incremental>
+{ $values { "pack" pack } { "incremental" "a new instance of " { $link incremental } } }
+{ $description "Creates a new incremental layout gadget delegating to " { $snippet "pack" } "." } ;
+
+{ <incremental> add-incremental clear-incremental } related-words
+
+HELP: add-incremental
+{ $values { "gadget" gadget } { "incremental" incremental } }
+{ $description "Adds the gadget to the incremental layout and performs relayout immediately in constant time." }
+{ $side-effects "incremental" } ;
+
+HELP: clear-incremental
+{ $values { "incremental" incremental } }
+{ $description "Removes all gadgets from the incremental layout and performs relayout immediately in constant time." }
+{ $side-effects "incremental" } ;
diff --git a/extra/ui/gadgets/incremental/incremental.factor b/extra/ui/gadgets/incremental/incremental.factor
new file mode 100644 (file)
index 0000000..0e15515
--- /dev/null
@@ -0,0 +1,55 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: io kernel math namespaces math.vectors ui.gadgets ;
+IN: ui.gadgets.incremental
+
+! Incremental layout allows adding lines to panes to be O(1).
+! Note that incremental packs are distinct from ordinary packs
+! defined in layouts.factor, since you don't want all packs to
+! be incremental. In particular, incremental packs do not
+! support non-default values for pack-align, pack-fill and
+! pack-gap.
+
+! The cursor is the current size of the incremental pack.
+! New gadgets are added at cursor-cursor*gadget-orientation.
+
+TUPLE: incremental cursor ;
+
+: <incremental> ( pack -- incremental )
+    incremental construct-empty
+    [ set-gadget-delegate ] keep
+    dup delegate pref-dim over set-incremental-cursor ;
+
+M: incremental pref-dim*
+    dup gadget-state [
+        dup delegate pref-dim over set-incremental-cursor
+    ] when incremental-cursor ;
+
+: next-cursor ( gadget incremental -- cursor )
+    [
+        swap rect-dim swap incremental-cursor
+        2dup v+ >r vmax r>
+    ] keep gadget-orientation set-axis ;
+
+: update-cursor ( gadget incremental -- )
+    [ next-cursor ] keep set-incremental-cursor ;
+
+: incremental-loc ( gadget incremental -- )
+    dup incremental-cursor swap gadget-orientation v*
+    swap set-rect-loc ;
+
+: prefer-incremental ( gadget -- )
+    dup forget-pref-dim dup pref-dim over set-rect-dim layout ;
+
+: add-incremental ( gadget incremental -- )
+    2dup (add-gadget)
+    over prefer-incremental
+    2dup incremental-loc
+    tuck update-cursor
+    dup prefer-incremental
+    gadget-parent [ invalidate* ] when* ;
+
+: clear-incremental ( incremental -- )
+    dup (clear-gadget) dup forget-pref-dim
+    { 0 0 } over set-incremental-cursor
+    gadget-parent [ relayout ] when* ;
diff --git a/extra/ui/gadgets/incremental/summary.txt b/extra/ui/gadgets/incremental/summary.txt
new file mode 100644 (file)
index 0000000..4d32dff
--- /dev/null
@@ -0,0 +1 @@
+Children can be added to incremental layouts in constant time
diff --git a/extra/ui/gadgets/labelled/authors.txt b/extra/ui/gadgets/labelled/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/labelled/labelled-docs.factor b/extra/ui/gadgets/labelled/labelled-docs.factor
new file mode 100644 (file)
index 0000000..843a605
--- /dev/null
@@ -0,0 +1,34 @@
+USING: ui.gadgets help.markup help.syntax strings models
+ui.gadgets.panes ui.gadgets.controls ;
+IN: ui.gadgets.labelled
+
+HELP: labelled-gadget
+{ $class-description "A labelled gadget can be created by calling " { $link <labelled-gadget> } "." } ;
+
+HELP: <labelled-gadget>
+{ $values { "gadget" gadget } { "title" string } { "newgadget" "a new " { $link <labelled-gadget> } } }
+{ $description "Creates a new " { $link labelled-gadget } " display " { $snippet "gadget" } " with " { $snippet "title" } " on top." } ;
+
+HELP: closable-gadget
+{ $class-description "A closable gadget displays a title bar with a close box on top of another gadget. Clicking the close box invokes a quotation. Closable gadgets are created by calling " { $link <closable-gadget> } "." } ;
+
+HELP: <closable-gadget>
+{ $values { "gadget" gadget } { "title" string } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } }
+{ $description "Creates a new " { $link closable-gadget } ". Clicking the close box calls " { $snippet "quot" } "." }
+{ $notes "The quotation can find the " { $link closable-gadget } " instance, or any other parent gadget by calling " { $link find-parent } " with the gadget it receives on the stack." } ;
+
+HELP: <labelled-pane>
+{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( value -- )" } } { "title" string } { "gadget" "a new " { $link gadget } } }
+{ $description "Creates a new " { $link control } " delegating to a " { $link pane } ", and wraps it in a " { $link labelled-gadget } ". When the value of the model changes, the value is pushed on the stack and the quotation is called using " { $link with-pane } "." } ;
+
+{ <labelled-pane> <pane-control> } related-words
+
+ARTICLE: "ui.gadgets.labelled" "Labelled gadgets"
+"It is possible to create a labelled border around a child gadget:"
+{ $subsection labelled-gadget }
+{ $subsection <labelled-gadget> }
+"Or a labelled border with a close box:"
+{ $subsection closable-gadget }
+{ $subsection <closable-gadget> } ;
+
+ABOUT: "ui.gadgets.labelled"
diff --git a/extra/ui/gadgets/labelled/labelled-tests.factor b/extra/ui/gadgets/labelled/labelled-tests.factor
new file mode 100644 (file)
index 0000000..87b2a45
--- /dev/null
@@ -0,0 +1,27 @@
+USING: ui.gadgets ui.gadgets.labels ui.gadgets.labelled
+ui.gadgets.packs ui.gadgets.frames ui.gadgets.grids namespaces
+kernel tools.test ui.gadgets.buttons sequences ;
+IN: temporary
+
+TUPLE: testing ;
+
+
+[ ] [
+    T{ testing } [ "Hey" <label> ] "Testing"
+    build-closable-gadget "g" set
+] unit-test
+
+[ t ] [ "g" get testing? ] unit-test
+
+[ t ] [ "g" get delegate closable-gadget? ] unit-test
+
+[ t ] [ "g" get closable-gadget-content label? ] unit-test
+
+[ ] [
+    <pile> "p" set
+    "g" get "p" get add-gadget
+    "g" get @top grid-child @left grid-child
+    dup button-quot call
+] unit-test
+
+[ f ] [ "g" get "p" get gadget-children memq? ] unit-test
diff --git a/extra/ui/gadgets/labelled/labelled.factor b/extra/ui/gadgets/labelled/labelled.factor
new file mode 100644 (file)
index 0000000..672d3d9
--- /dev/null
@@ -0,0 +1,63 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.gadgets.buttons ui.gadgets.borders
+ui.gadgets.labels ui.gadgets.panes ui.gadgets.scrollers
+ui.gadgets.tracks ui.gadgets.theme ui.gadgets.frames
+ui.gadgets.grids io kernel math models namespaces prettyprint
+sequences sequences words tuples ui.gadgets ui.render colors ;
+IN: ui.gadgets.labelled
+
+TUPLE: labelled-gadget content ;
+
+: <labelled-gadget> ( gadget title -- newgadget )
+    labelled-gadget construct-empty
+    [
+        <label> dup reverse-video-theme f track,
+        g-> set-labelled-gadget-content 1 track,
+    ] { 0 1 } build-track ;
+
+M: labelled-gadget focusable-child* labelled-gadget-content ;
+
+: <labelled-scroller> ( gadget title -- gadget )
+    >r <scroller> r> <labelled-gadget> ;
+
+: <labelled-pane> ( model quot title -- gadget )
+    >r <pane-control> t over set-pane-scrolls? r>
+    <labelled-scroller> ;
+
+: <close-box> ( quot -- button/f )
+    gray close-box <polygon-gadget> swap <bevel-button> ;
+
+: title-theme ( gadget -- )
+    { 1 0 } over set-gadget-orientation
+    T{ gradient f {
+        { 0.65 0.65 1.0 1.0 }
+        { 0.65 0.45 1.0 1.0 }
+    } } swap set-gadget-interior ;
+
+: <title-label> <label> dup title-theme ;
+
+: <title-bar> ( title quot -- gadget )
+    [
+        [ <close-box> @left frame, ] when*
+        <title-label> @center frame,
+    ] make-frame ;
+
+TUPLE: closable-gadget content ;
+
+: find-closable-gadget ( parent -- child )
+    [ [ closable-gadget? ] is? ] find-parent ;
+
+: <closable-gadget> ( gadget title quot -- gadget )
+    closable-gadget construct-empty
+    [
+        <title-bar> @top frame,
+        g-> set-closable-gadget-content @center frame,
+    ] build-frame ;
+
+M: closable-gadget focusable-child* closable-gadget-content ;
+
+: build-closable-gadget ( tuple quot title -- tuple )
+    pick >r >r with-gadget
+    r> [ find-closable-gadget unparent ] <closable-gadget> r>
+    [ set-gadget-delegate ] keep ; inline
diff --git a/extra/ui/gadgets/labelled/summary.txt b/extra/ui/gadgets/labelled/summary.txt
new file mode 100644 (file)
index 0000000..6f7ffe6
--- /dev/null
@@ -0,0 +1 @@
+Labelled gadgets display a border with a text label surrounding a child
diff --git a/extra/ui/gadgets/labels/authors.txt b/extra/ui/gadgets/labels/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/labels/labels-docs.factor b/extra/ui/gadgets/labels/labels-docs.factor
new file mode 100644 (file)
index 0000000..2672261
--- /dev/null
@@ -0,0 +1,35 @@
+USING: ui.gadgets.controls help.markup
+help.syntax strings ui.gadgets models ;
+IN: ui.gadgets.labels
+
+HELP: label
+{ $class-description "A label displays a piece of text, either a single line string or an array of line strings. Labels are created by calling " { $link <label> } "." } ;
+
+HELP: <label>
+{ $values { "string" string } { "label" "a new " { $link label } } }
+{ $description "Creates a new " { $link label } " gadget. The string is permitted to contain line breaks." } ;
+
+HELP: label-string
+{ $values { "label" label } { "string" string } }
+{ $description "Outputs the string currently displayed by the label." } ;
+
+HELP: set-label-string
+{ $values { "label" label } { "string" string } }
+{ $description "Sets the string currently displayed by the label. The string is permitted to contain line breaks. After calling this word, you must also call " { $link relayout } " on the label." } ;
+
+HELP: <label-control>
+{ $values { "model" model } { "gadget" "a new " { $link gadget } } }
+{ $description "Creates a " { $link control } " which displays the value of " { $snippet "model" } ", which is required to be a string. The label control is automatically updated when the model value changes." } ;
+
+{ label-string set-label-string } related-words
+{ <label> <label-control> } related-words
+
+ARTICLE: "ui.gadgets.labels" "Label gadgets"
+"A label displays a piece of text, either a single line string or an array of line strings."
+{ $subsection label }
+{ $subsection <label> }
+{ $subsection <label-control> }
+{ $subsection label-string }
+{ $subsection set-label-string } ;
+
+ABOUT: "ui.gadgets.labels"
diff --git a/extra/ui/gadgets/labels/labels.factor b/extra/ui/gadgets/labels/labels.factor
new file mode 100644 (file)
index 0000000..9dd2c21
--- /dev/null
@@ -0,0 +1,49 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays hashtables io kernel math namespaces
+opengl sequences io.streams.lines strings splitting
+ui.gadgets ui.gadgets.controls ui.gadgets.theme ui.render
+colors ;
+IN: ui.gadgets.labels
+
+! A label gadget draws a string.
+TUPLE: label text font color ;
+
+: label-string ( label -- string )
+    label-text dup string? [ "\n" join ] unless ; inline
+
+: set-label-string ( string label -- )
+    CHAR: \n pick memq? [
+        >r string-lines r> set-label-text
+    ] [
+        set-label-text
+    ] if ; inline
+
+: label-theme ( gadget -- )
+    black over set-label-color
+    sans-serif-font swap set-label-font ;
+
+: <label> ( string -- label )
+    label construct-gadget
+    [ set-label-string ] keep
+    dup label-theme ;
+
+M: label pref-dim*
+    dup label-font open-font swap label-text text-dim ;
+
+M: label draw-gadget*
+    dup label-color gl-color
+    dup label-font swap label-text origin get draw-text ;
+
+M: label gadget-text* label-string % ;
+
+: <label-control> ( model -- gadget )
+    "" <label> [ set-label-string ] <control> ;
+
+: text-theme ( gadget -- )
+    black over set-label-color
+    monospace-font swap set-label-font ;
+
+: reverse-video-theme ( label -- )
+    white over set-label-color
+    black solid-interior ;
diff --git a/extra/ui/gadgets/labels/summary.txt b/extra/ui/gadgets/labels/summary.txt
new file mode 100644 (file)
index 0000000..8e24439
--- /dev/null
@@ -0,0 +1 @@
+Label gadgets display one or more lines of text with a single font and color
diff --git a/extra/ui/gadgets/lib/lib.factor b/extra/ui/gadgets/lib/lib.factor
new file mode 100644 (file)
index 0000000..12385f0
--- /dev/null
@@ -0,0 +1,6 @@
+
+USING: ui.backend ui.gadgets.worlds ;
+
+IN: ui.gadgets.lib
+
+: find-gl-context ( gadget -- ) find-world world-handle select-gl-context ;
diff --git a/extra/ui/gadgets/lists/authors.txt b/extra/ui/gadgets/lists/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/lists/lists-docs.factor b/extra/ui/gadgets/lists/lists-docs.factor
new file mode 100644 (file)
index 0000000..a6591d5
--- /dev/null
@@ -0,0 +1,33 @@
+USING: ui.commands help.markup help.syntax
+ui.gadgets ui.gadgets.presentations ui.gadgets.controls
+ui.operations kernel models classes ;
+IN: ui.gadgets.lists
+
+HELP: +secondary+
+{ $description "A key which may be set in the hashtable passed to " { $link define-operation } ". If set to a true value, this operation becomes the default operation performed when " { $snippet "RET" } " is pressed in a " { $link list } " gadget where the current selection is a presentation matching the operation's predicate." } ;
+
+HELP: list
+{ $class-description
+    "A list " { $link control } " is backed by a " { $link model } " holding a sequence of objects, and displays as a list of " { $link presentation } " instances of these objects."
+    $nl
+    "Lists are created by calling " { $link <list> } "."
+    { $command-map list "keyboard-navigation" }
+} ;
+
+HELP: <list>
+{ $values { "hook" "a quotation with stack effect " { $snippet "( list -- )" } } { "presenter" "a quotation with stack effect " { $snippet "( object -- label )" } } { "model" model } { "gadget" list } }
+{ $description "Creates a new " { $link list } "."
+$nl
+"The model value must be a sequence. The list displays presentations of elements with labels obtained by applying the " { $snippet "presenter" } " quotation to each object. The " { $snippet "hook" } " quotation is called when a presentation is selected." } ;
+
+HELP: list-value
+{ $values { "list" list } { "object" object } }
+{ $description "Outputs the currently selected list value." } ;
+
+ARTICLE: "ui.gadgets.lists" "List gadgets"
+"A list displays a list of presentations."
+{ $subsection list }
+{ $subsection <list> }
+{ $subsection list-value } ;
+
+ABOUT: "ui.gadgets.lists"
diff --git a/extra/ui/gadgets/lists/lists-tests.factor b/extra/ui/gadgets/lists/lists-tests.factor
new file mode 100644 (file)
index 0000000..44a89a7
--- /dev/null
@@ -0,0 +1,5 @@
+IN: temporary
+USING: ui.gadgets.lists models prettyprint math tools.test
+kernel ;
+
+[ ] [ [ drop ] [ 3 + . ] f <model> <list> invoke-value-action ] unit-test
diff --git a/extra/ui/gadgets/lists/lists.factor b/extra/ui/gadgets/lists/lists.factor
new file mode 100644 (file)
index 0000000..8d1008a
--- /dev/null
@@ -0,0 +1,121 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: ui.commands ui.gestures ui.render ui.gadgets
+ui.gadgets.controls ui.gadgets.labels ui.gadgets.scrollers
+kernel sequences models opengl math namespaces
+ui.gadgets.presentations ui.gadgets.viewports ui.gadgets.packs
+math.vectors tuples ;
+IN: ui.gadgets.lists
+
+TUPLE: list index presenter color hook ;
+
+: list-theme ( list -- )
+    { 0.8 0.8 1.0 1.0 } swap set-list-color ;
+
+: <list> ( hook presenter model -- gadget )
+    <filled-pile> list construct-control
+    [ set-list-presenter ] keep
+    [ set-list-hook ] keep
+    0 over set-list-index
+    dup list-theme ;
+
+: calc-bounded-index ( n list -- m )
+    control-value length 1- min 0 max ;
+
+: bound-index ( list -- )
+    dup list-index over calc-bounded-index
+    swap set-list-index ;
+
+: list-presentation-hook ( list -- quot )
+    list-hook [ [ [ list? ] is? ] find-parent ] swap append ;
+
+: <list-presentation> ( hook elt presenter -- gadget )
+    keep <presentation>
+    [ set-presentation-hook ] keep
+    [ text-theme ] keep ;
+
+: <list-items> ( list -- seq )
+    dup list-presentation-hook
+    over list-presenter
+    rot control-value [
+        >r 2dup r> swap <list-presentation>
+    ] map 2nip ;
+
+M: list model-changed
+    dup clear-gadget
+    dup <list-items> over add-gadgets
+    bound-index ;
+
+: selected-rect ( list -- rect )
+    dup list-index swap gadget-children ?nth ;
+
+M: list draw-gadget*
+    origin get [
+        dup list-color gl-color
+        selected-rect [ rect-extent gl-fill-rect ] when*
+    ] with-translation ;
+
+M: list focusable-child* drop t ;
+
+: list-value ( list -- object )
+    dup list-index swap control-value ?nth ;
+
+: scroll>selected ( list -- )
+    #! We change the rectangle's width to zero to avoid
+    #! scrolling right.
+    [ selected-rect rect-bounds { 0 1 } v* <rect> ] keep
+    scroll>rect ;
+
+: list-empty? ( list -- ? ) control-value empty? ;
+
+: select-index ( n list -- )
+    dup list-empty? [
+        2drop
+    ] [
+        [ control-value length rem ] keep
+        [ set-list-index ] keep
+        [ relayout-1 ] keep
+        scroll>selected
+    ] if ;
+
+: select-previous ( list -- )
+    dup list-index 1- swap select-index ;
+
+: select-next ( list -- )
+    dup list-index 1+ swap select-index ;
+
+: invoke-value-action ( list -- )
+    dup list-empty? [
+        dup list-hook call
+    ] [
+        dup list-index swap nth-gadget invoke-secondary
+    ] if ;
+
+: select-gadget ( gadget list -- )
+    swap over gadget-children index
+    [ swap select-index ] [ drop ] if* ;
+
+: clamp-loc ( point max -- point )
+    vmin { 0 0 } vmax ;
+
+: select-at ( point list -- )
+    [ rect-dim clamp-loc ] keep
+    [ pick-up ] keep
+    select-gadget ;
+
+: list-page ( list vec -- )
+    >r dup selected-rect rect-bounds 2 v/n v+
+    over visible-dim r> v* v+ swap select-at ;
+
+: list-page-up ( list -- ) { 0 -1 } list-page ;
+
+: list-page-down ( list -- ) { 0 1 } list-page ;
+
+list "keyboard-navigation" "Lists can be navigated from the keyboard." {
+    { T{ button-down } request-focus }
+    { T{ key-down f f "UP" } select-previous }
+    { T{ key-down f f "DOWN" } select-next }
+    { T{ key-down f f "PAGE_UP" } list-page-up }
+    { T{ key-down f f "PAGE_DOWN" } list-page-down }
+    { T{ key-down f f "RET" } invoke-value-action }
+} define-command-map
diff --git a/extra/ui/gadgets/lists/summary.txt b/extra/ui/gadgets/lists/summary.txt
new file mode 100644 (file)
index 0000000..f0b84e7
--- /dev/null
@@ -0,0 +1 @@
+List gadgets display a keyboard-navigatable list of presentations
diff --git a/extra/ui/gadgets/menus/authors.txt b/extra/ui/gadgets/menus/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/menus/menus-docs.factor b/extra/ui/gadgets/menus/menus-docs.factor
new file mode 100644 (file)
index 0000000..a621acf
--- /dev/null
@@ -0,0 +1,6 @@
+USING: ui.gadgets help.markup help.syntax ui.gadgets.menus
+ui.gadgets.worlds ;
+
+HELP: show-menu
+{ $values { "gadget" gadget } { "owner" gadget } }
+{ $description "Displays a popup menu in the " { $link world } " containing " { $snippet "owner" } " at the current mouse location." } ;
diff --git a/extra/ui/gadgets/menus/menus.factor b/extra/ui/gadgets/menus/menus.factor
new file mode 100644 (file)
index 0000000..34051ea
--- /dev/null
@@ -0,0 +1,52 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.commands ui.gadgets ui.gadgets.buttons
+ui.gadgets.worlds ui.gestures generic hashtables kernel math
+models namespaces opengl sequences math.vectors
+ui.gadgets.theme ui.gadgets.packs ui.gadgets.borders colors ;
+IN: ui.gadgets.menus
+
+: menu-loc ( world menu -- loc )
+    >r rect-dim r> pref-dim [v-] hand-loc get-global vmin ;
+
+TUPLE: menu-glass ;
+
+: <menu-glass> ( menu world -- glass )
+    menu-glass construct-gadget
+    >r over menu-loc over set-rect-loc r>
+    [ add-gadget ] keep ;
+
+M: menu-glass layout* gadget-child prefer ;
+
+: hide-glass ( world -- )
+    dup world-glass [ unparent ] when*
+    f swap set-world-glass ;
+
+: show-glass ( gadget world -- )
+    over hand-clicked set-global
+    [ hide-glass ] keep
+    [ add-gadget ] 2keep
+    set-world-glass ;
+
+: show-menu ( gadget owner -- )
+    find-world [ <menu-glass> ] keep show-glass ;
+
+\ menu-glass H{
+    { T{ button-down } [ find-world [ hide-glass ] when* ] }
+    { T{ drag } [ update-clicked drop ] }
+} set-gestures
+
+: <menu-item> ( hook target command -- button )
+    dup command-name -rot command-button-quot
+    swapd
+    [ hand-clicked get find-world hide-glass ]
+    3append <roll-button> ;
+
+: menu-theme ( gadget -- )
+    dup light-gray solid-interior
+    faint-boundary ;
+
+: <commands-menu> ( hook target commands -- gadget )
+    [
+        [ >r 2dup r> <menu-item> gadget, ] each 2drop
+    ] make-filled-pile 5 <border> dup menu-theme ;
diff --git a/extra/ui/gadgets/menus/summary.txt b/extra/ui/gadgets/menus/summary.txt
new file mode 100644 (file)
index 0000000..0d50da8
--- /dev/null
@@ -0,0 +1 @@
+Menu gadgets pop up as a list of commands at the mouse location
diff --git a/extra/ui/gadgets/packs/authors.txt b/extra/ui/gadgets/packs/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/packs/packs-docs.factor b/extra/ui/gadgets/packs/packs-docs.factor
new file mode 100644 (file)
index 0000000..8162e8e
--- /dev/null
@@ -0,0 +1,60 @@
+USING: ui.gadgets ui.gadgets.packs help.markup help.syntax
+generic kernel tuples quotations ;
+
+HELP: pack
+{ $class-description "A gadget which lays out its children along a single axis stored in the " { $link gadget-orientation } " slot. Can be constructed with one of the following words:"
+{ $list
+    { $link <pack> }
+    { $link <pile> }
+    { $link <shelf> }
+    { $link make-pile }
+    { $link make-filled-pile }
+    { $link make-shelf }
+}
+"Packs have the following slots:"
+{ $list
+    { { $link pack-align } " a rational number between 0 and 1, the alignment of gadgets along the axis perpendicular to the pack's orientation" }
+    { { $link pack-fill } " a rational number between 0 and 1, where 0 gives each gadget its preferred size and 1 fills the dimension perpendicular to the pack's orientation" }
+    { { $link pack-gap } " a pair of integers, the horizontal and vertical gap between children" }
+}
+"Gadgets can delegate to packs and implement their own " { $link pref-dim* } " and " { $link layout* } " methods, reusing pack layout logic by calling " { $link pack-pref-dim } " and " { $link pack-layout } "." } ;
+
+HELP: pack-layout
+{ $values { "pack" "a new " { $link pack } } { "sizes" "a sequence of pairs of integers" } }
+{ $description "Lays out the pack's children along the " { $link gadget-orientation } " of the pack, with each gadget receiving its size from the corresponding index of the " { $snippet "sizes" } " sequence." }
+{ $notes
+    "This word is useful if you are writing your own layout gadget which delegates to a " { $link pack } ". This allows you to reuse layout logic while computing gadget sizes using a custom procedure."
+} ;
+
+HELP: <pack>
+{ $values { "orientation" "an orientation specifier" } { "pack" "a new " { $link pack } } }
+{ $description "Creates a new pack which lays out children along the given axis. Children are laid out vertically if the orientation is " { $snippet "{ 0 1 }" } " and horizontally if the orientation is " { $snippet "{ 1 0 }" } "." } ;
+
+{ <pack> <pile> <shelf> } related-words
+
+HELP: <pile>
+{ $values { "pack" "a new " { $link pack } } }
+{ $description "Creates a new " { $link pack } " which lays out its children vertically." } ;
+
+HELP: <shelf>
+{ $values { "pack" "a new " { $link pack } } }
+{ $description "Creates a new " { $link pack } " which lays out its children horizontally." } ;
+
+HELP: pack-pref-dim
+{ $values { "gadget" gadget } { "sizes" "a sequence of pairs of integers" } { "dim" "a pair of integers" } }
+{ $description "Computes the preferred size of a pack, with each gadget receiving its size from the corresponding index of the " { $snippet "sizes" } " sequence." }
+{ $notes
+    "This word is useful if you are writing your own layout gadget which delegates to a " { $link pack } ". This allows you to reuse layout logic while computing gadget sizes using a custom procedure."
+} ;
+
+HELP: make-pile
+{ $values { "quot" quotation } { "pack" "a new " { $link pack } } }
+{ $description "Creates a new " { $link pack } " which lays out a sequence of gadgets vertically. The quotation can add children by calling the " { $link gadget, } " word." } ;
+
+HELP: make-filled-pile
+{ $values { "quot" quotation } { "pack" "a new " { $link pack } } }
+{ $description "Creates a new " { $link pack } " which lays out a sequence of gadgets vertically, such that all gadgets have the same width. The quotation can add children by calling the " { $link gadget, } " word." } ;
+
+HELP: make-shelf
+{ $values { "quot" quotation } { "pack" "a new " { $link pack } } }
+{ $description "Creates a new " { $link pack } " which lays out a sequence of gadgets horizontally. The quotation can add children by calling the " { $link gadget, } " word." } ;
diff --git a/extra/ui/gadgets/packs/packs-tests.factor b/extra/ui/gadgets/packs/packs-tests.factor
new file mode 100644 (file)
index 0000000..ce6df74
--- /dev/null
@@ -0,0 +1,15 @@
+IN: temporary
+USING: ui.gadgets.packs ui.gadgets.labels ui.gadgets ui.render
+kernel namespaces tools.test math.parser sequences ;
+
+[ t ] [
+    { 0 0 } { 100 100 } <rect> clip set
+
+    [
+        100 [ number>string <label> gadget, ] each
+    ] make-pile
+
+    dup layout
+
+    visible-children [ label? ] all?
+] unit-test
diff --git a/extra/ui/gadgets/packs/packs.factor b/extra/ui/gadgets/packs/packs.factor
new file mode 100644 (file)
index 0000000..dd10449
--- /dev/null
@@ -0,0 +1,73 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: sequences ui.gadgets kernel math math.vectors
+namespaces ;
+IN: ui.gadgets.packs
+
+TUPLE: pack align fill gap ;
+
+: packed-dim-2 ( gadget sizes -- list )
+    [ over rect-dim over v- rot pack-fill v*n v+ ] curry* map ;
+
+: packed-dims ( gadget sizes -- seq )
+    2dup packed-dim-2 swap orient ;
+
+: gap-locs ( gap sizes -- seq )
+    { 0 0 } [ v+ over v+ ] accumulate 2nip ;
+
+: aligned-locs ( gadget sizes -- seq )
+    [ >r dup pack-align swap rect-dim r> v- n*v ] curry* map ;
+
+: packed-locs ( gadget sizes -- seq )
+    over pack-gap over gap-locs >r dupd aligned-locs r> orient ;
+
+: round-dims ( seq -- newseq )
+    { 0 0 } swap
+    [ swap v- dup [ ceiling >fixnum ] map [ swap v- ] keep ] map
+    nip ;
+
+: pack-layout ( pack sizes -- )
+    round-dims over gadget-children
+    >r dupd packed-dims r> 2dup [ set-layout-dim ] 2each
+    >r packed-locs r> [ set-rect-loc ] 2each ;
+
+: <pack> ( orientation -- pack )
+    0 0 { 0 0 } <gadget> {
+        set-gadget-orientation
+        set-pack-align
+        set-pack-fill
+        set-pack-gap
+        set-delegate
+    } pack construct ;
+
+: <pile> ( -- pack ) { 0 1 } <pack> ;
+
+: <filled-pile> ( -- pack ) <pile> 1 over set-pack-fill ;
+
+: <shelf> ( -- pack ) { 1 0 } <pack> ;
+
+: gap-dims ( gap sizes -- seeq )
+    [ dim-sum ] keep length 1 [-] rot n*v v+ ;
+
+: pack-pref-dim ( gadget sizes -- dim )
+    over pack-gap over gap-dims >r max-dim r>
+    rot gadget-orientation set-axis ;
+
+M: pack pref-dim*
+    dup gadget-children pref-dims pack-pref-dim ;
+
+M: pack layout*
+    dup gadget-children pref-dims pack-layout ;
+
+M: pack children-on ( rect gadget -- seq )
+    dup gadget-orientation swap gadget-children
+    [ fast-children-on ] keep <slice> ;
+
+: make-pile ( quot -- pack )
+    <pile> make-gadget ; inline
+
+: make-filled-pile ( quot -- pack )
+    <filled-pile> make-gadget ; inline
+
+: make-shelf ( quot -- pack )
+    <shelf> make-gadget ; inline
diff --git a/extra/ui/gadgets/packs/summary.txt b/extra/ui/gadgets/packs/summary.txt
new file mode 100644 (file)
index 0000000..966a7cb
--- /dev/null
@@ -0,0 +1 @@
+Pack gadgets arrange children horizontally or vertically
diff --git a/extra/ui/gadgets/panes/authors.txt b/extra/ui/gadgets/panes/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/panes/panes-docs.factor b/extra/ui/gadgets/panes/panes-docs.factor
new file mode 100644 (file)
index 0000000..5162159
--- /dev/null
@@ -0,0 +1,77 @@
+USING: ui.gadgets.controls ui.gadgets models
+help.markup help.syntax io kernel quotations ;
+IN: ui.gadgets.panes
+
+HELP: pane
+{ $class-description "A pane " { $link gadget } " displays formatted text which is written to a " { $link pane-stream } " targetting the pane. Panes are created by calling " { $link <pane> } ", " { $link <scrolling-pane> } " or " { $link <pane-control> } "." } ;
+
+HELP: <pane>
+{ $values { "pane" "a new " { $link pane } } }
+{ $description "Creates a new " { $link pane } " gadget." } ;
+
+HELP: write-gadget
+{ $values { "gadget" gadget } { "stream" "an output stream" } }
+{ $contract "Writes a gadget to the stream." }
+{ $notes "Not all streams support this operation." } ;
+
+{ write-gadget print-gadget gadget. } related-words
+
+HELP: print-gadget
+{ $values { "gadget" gadget } { "stream" "an output stream" } }
+{ $description "Writes a gadget to the stream, followed by a newline." }
+{ $notes "Not all streams support this operation." } ;
+
+HELP: gadget.
+{ $values { "gadget" gadget } }
+{ $description "Writes a gadget followed by a newline to the " { $link stdio } " stream." }
+{ $notes "Not all streams support this operation." } ;
+
+HELP: ?nl
+{ $values { "stream" pane-stream } }
+{ $description "Inserts a line break in the pane unless the current line is empty." } ;
+
+HELP: with-pane
+{ $values { "pane" pane } { "quot" quotation } }
+{ $description "Clears the pane and calls the quotation in a new scope where " { $link stdio } " is rebound to a " { $link pane-stream } " writing to the pane." } ;
+
+HELP: make-pane
+{ $values { "quot" quotation } { "gadget" "a new " { $link gadget } } }
+{ $description "Calls the quotation in a new scope where " { $link stdio } " is rebound to a " { $link pane-stream } " writing to a new pane. The output area of the new pane is output on the stack after the quotation returns. The pane itself is not output." } ;
+
+HELP: <scrolling-pane>
+{ $values { "pane" "a new " { $link pane } } }
+{ $description "Creates a new " { $link pane } " gadget which scrolls any scroll pane containing it to the bottom on output. behaving much like a terminal or logger." } ;
+
+HELP: <pane-control>
+{ $values { "model" model } { "quot" "a quotation with stack effect " { $snippet "( value -- )" } } { "pane" "a new " { $link pane } } }
+{ $description "Creates a new " { $link control } " delegating to a " { $link pane } ". When the value of the model changes, the value is pushed on the stack and the quotation is called using " { $link with-pane } "." } ;
+
+HELP: pane-stream
+{ $class-description "Pane streams implement the portion of the " { $link "stream-protocol" } " responsible for output of text, including full support for " { $link "styles" } ". Pane streams also support direct output of gadgets via " { $link write-gadget } " and " { $link print-gadget } ". Pane streams are created by calling " { $link <pane-stream> } "." } ;
+
+HELP: <pane-stream> ( pane -- stream )
+{ $values { "pane" pane } { "stream" "a new " { $link pane-stream } } }
+{ $description "Creates a new " { $link pane-stream } " for writing to " { $snippet "pane" } "." } ;
+
+{ with-pane make-pane } related-words
+
+ARTICLE: "ui.gadgets.panes" "Pane gadgets"
+"A pane displays formatted text."
+{ $subsection pane }
+{ $subsection <pane> }
+{ $subsection <scrolling-pane> }
+{ $subsection <pane-control> }
+"Panes are written to by creating a special output stream:"
+{ $subsection pane-stream }
+{ $subsection <pane-stream> }
+"In addition to the stream output words (" { $link "stream-protocol" } ", pane streams can have gadgets written to them:"
+{ $subsection write-gadget }
+{ $subsection print-gadget }
+{ $subsection gadget. }
+"The " { $link gadget. } " word is useful for interactive debugging of gadgets in the listener."
+$nl
+"There are a few combinators for working with panes:"
+{ $subsection with-pane }
+{ $subsection make-pane } ;
+
+ABOUT: "ui.gadgets.panes"
diff --git a/extra/ui/gadgets/panes/panes-tests.factor b/extra/ui/gadgets/panes/panes-tests.factor
new file mode 100644 (file)
index 0000000..f9663d8
--- /dev/null
@@ -0,0 +1,35 @@
+IN: temporary
+USING: alien ui.gadgets.panes ui.gadgets namespaces
+kernel sequences io io.streams.string tools.test prettyprint
+definitions help help.syntax help.markup splitting ;
+
+: #children "pane" get gadget-children length ;
+
+[ ] [ <pane> "pane" set ] unit-test
+
+[ ] [ #children "num-children" set ] unit-test
+
+[ ] [
+    "pane" get <pane-stream> [ 10000 [ . ] each ] with-stream*
+] unit-test
+
+[ t ] [ #children "num-children" get = ] unit-test
+
+: test-gadget-text
+    dup make-pane gadget-text
+    swap string-out "\n" ?tail drop "\n" ?tail drop = ;
+
+[ t ] [ [ "hello" write ] test-gadget-text ] unit-test
+[ t ] [ [ "hello" pprint ] test-gadget-text ] unit-test
+[ t ] [ [ [ 1 2 3 ] pprint ] test-gadget-text ] unit-test
+[ t ] [ [ \ = see ] test-gadget-text ] unit-test
+[ t ] [ [ \ = help ] test-gadget-text ] unit-test
+
+ARTICLE: "test-article" "This is a test article"
+"Hello world, how are you today."
+{ $table { "a" "b" } { "c" "d" } } ;
+
+[ t ] [ [ "test-article" help ] test-gadget-text ] unit-test
+
+<pane> [ \ = see ] with-pane
+<pane> [ \ = help ] with-pane
diff --git a/extra/ui/gadgets/panes/panes.factor b/extra/ui/gadgets/panes/panes.factor
new file mode 100644 (file)
index 0000000..ab11413
--- /dev/null
@@ -0,0 +1,420 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.gadgets ui.gadgets.borders ui.gadgets.buttons
+ui.gadgets.labels ui.gadgets.controls ui.gadgets.scrollers
+ui.gadgets.paragraphs ui.gadgets.incremental ui.gadgets.packs
+ui.gadgets.theme ui.clipboards ui.gestures ui.traverse ui.render
+hashtables io kernel namespaces sequences io.styles strings
+quotations math opengl combinators math.vectors
+io.streams.duplex sorting splitting io.streams.nested assocs
+ui.gadgets.presentations ui.gadgets.slots ui.gadgets.grids
+ui.gadgets.grid-lines tuples ;
+IN: ui.gadgets.panes
+
+TUPLE: pane output current prototype scrolls?
+selection-color caret mark selecting? ;
+
+: clear-selection ( pane -- )
+    f over set-pane-caret
+    f swap set-pane-mark ;
+
+: add-output 2dup set-pane-output add-gadget ;
+
+: add-current 2dup set-pane-current add-gadget ;
+
+: prepare-line ( pane -- )
+    dup clear-selection
+    dup pane-prototype clone swap add-current ;
+
+: pane-caret&mark ( pane -- caret mark )
+    dup pane-caret swap pane-mark ;
+
+: selected-children ( pane -- seq )
+    [ pane-caret&mark sort-pair ] keep gadget-subtree ;
+
+M: pane gadget-selection? pane-caret&mark and ;
+
+M: pane gadget-selection
+    selected-children gadget-text ;
+
+: pane-clear ( pane -- )
+    dup clear-selection
+    dup pane-output clear-incremental
+    pane-current clear-gadget ;
+
+: pane-theme ( editor -- )
+    selection-color swap set-pane-selection-color ;
+
+: <pane> ( -- pane )
+    pane construct-empty
+    <pile> over set-delegate
+    <shelf> over set-pane-prototype
+    <pile> <incremental> over add-output
+    dup prepare-line
+    dup pane-theme ;
+
+GENERIC: draw-selection ( loc obj -- )
+
+: if-fits ( rect quot -- )
+    >r clip get over intersects? r> [ drop ] if ; inline
+
+M: gadget draw-selection ( loc gadget -- )
+    swap offset-rect [ rect-extent gl-fill-rect ] if-fits ;
+
+M: node draw-selection ( loc node -- )
+    2dup node-value swap offset-rect [
+        drop 2dup
+        [ node-value rect-loc v+ ] keep
+        node-children [ draw-selection ] curry* each
+    ] if-fits 2drop ;
+
+M: pane draw-gadget*
+    dup gadget-selection? [
+        dup pane-selection-color gl-color
+        origin get over rect-loc v- swap selected-children
+        [ draw-selection ] curry* each
+    ] [
+        drop
+    ] if ;
+
+: scroll-pane ( pane -- )
+    dup pane-scrolls? [ scroll>bottom ] [ drop ] if ;
+
+TUPLE: pane-stream pane ;
+
+C: <pane-stream> pane-stream
+
+: smash-line ( current -- gadget )
+    dup gadget-children {
+        { [ dup empty? ] [ 2drop "" <label> ] }
+        { [ dup length 1 = ] [ nip first ] }
+        { [ t ] [ drop ] }
+    } cond ;
+
+: smash-pane ( pane -- gadget ) pane-output smash-line ;
+
+: pane-nl ( pane -- )
+    dup pane-current dup unparent smash-line
+    over pane-output add-incremental
+    prepare-line ;
+
+: pane-write ( pane seq -- )
+    [ dup pane-nl ]
+    [ over pane-current stream-write ]
+    interleave drop ;
+
+: pane-format ( style pane seq -- )
+    [ dup pane-nl ]
+    [ pick pick pane-current stream-format ]
+    interleave 2drop ;
+
+GENERIC: write-gadget ( gadget stream -- )
+
+M: pane-stream write-gadget
+    pane-stream-pane pane-current add-gadget ;
+
+M: duplex-stream write-gadget
+    duplex-stream-out write-gadget ;
+
+: print-gadget ( gadget stream -- )
+    tuck write-gadget stream-nl ;
+
+: gadget. ( gadget -- )
+    stdio get print-gadget ;
+
+: ?nl ( stream -- )
+    dup pane-stream-pane pane-current gadget-children empty?
+    [ dup stream-nl ] unless drop ;
+
+: with-pane ( pane quot -- )
+    over scroll>top
+    over pane-clear >r <pane-stream> r>
+    over >r with-stream* r> ?nl ; inline
+
+: make-pane ( quot -- gadget )
+    <pane> [ swap with-pane ] keep smash-pane ; inline
+
+: <scrolling-pane> ( -- pane )
+    <pane> t over set-pane-scrolls? ;
+
+: <pane-control> ( model quot -- pane )
+    [ with-pane ] curry <pane> swap <control> ;
+
+: do-pane-stream ( pane-stream quot -- )
+    >r pane-stream-pane r> keep scroll-pane ; inline
+
+M: pane-stream stream-nl
+    [ pane-nl ] do-pane-stream ;
+
+M: pane-stream stream-write1
+    [ pane-current stream-write1 ] do-pane-stream ;
+
+M: pane-stream stream-write
+    [ swap string-lines pane-write ] do-pane-stream ;
+
+M: pane-stream stream-format
+    [ rot string-lines pane-format ] do-pane-stream ;
+
+M: pane-stream stream-close drop ;
+
+M: pane-stream stream-flush drop ;
+
+M: pane-stream make-span-stream
+    <style-stream> <ignore-close-stream> ;
+
+! Character styles
+
+: apply-style ( style gadget key quot -- style gadget )
+    >r pick at r> when* ; inline
+
+: apply-foreground-style ( style gadget -- style gadget )
+    foreground [ over set-label-color ] apply-style ;
+
+: apply-background-style ( style gadget -- style gadget )
+    background [ dupd solid-interior ] apply-style ;
+
+: specified-font ( style -- font )
+    [ font swap at "monospace" or ] keep
+    [ font-style swap at plain or ] keep
+    font-size swap at 12 or 3array ;
+
+: apply-font-style ( style gadget -- style gadget )
+    over specified-font over set-label-font ;
+
+: apply-presentation-style ( style gadget -- style gadget )
+    presented [ <presentation> ] apply-style ;
+
+TUPLE: scroll-to-me done? ;
+
+: <scroll-to-me>
+    scroll-to-me construct-empty
+    [ set-gadget-delegate ] keep ;
+
+: scroll-on-graft? ( gadget -- ? )
+    parents
+    [ [ pane? ] is? ] subset
+    [ pane-scrolls? ] contains? not ;
+
+M: scroll-to-me graft*
+    dup scroll-to-me-done? [
+        t over set-scroll-to-me-done?
+        dup scroll-on-graft? [ dup scroll>gadget ] when
+    ] unless delegate graft* ;
+
+: apply-highlight-style ( style gadget -- style gadget )
+    highlight [ drop <scroll-to-me> ] apply-style ;
+
+: <styled-label> ( style text -- gadget )
+    <label>
+    apply-foreground-style
+    apply-background-style
+    apply-font-style
+    apply-presentation-style
+    apply-highlight-style
+    nip ;
+
+! Paragraph styles
+
+: apply-wrap-style ( style pane -- style pane )
+    wrap-margin [
+        2dup <paragraph> swap set-pane-prototype
+        <paragraph> over set-pane-current
+    ] apply-style ;
+
+: apply-border-color-style ( style gadget -- style gadget )
+    border-color [ dupd solid-boundary ] apply-style ;
+
+: apply-page-color-style ( style gadget -- style gadget )
+    page-color [ dupd solid-interior ] apply-style ;
+
+: apply-path-style ( style gadget -- style gadget )
+    presented-path [ <editable-slot> ] apply-style ;
+
+: apply-border-width-style ( style gadget -- style gadget )
+    border-width [ <border> ] apply-style ;
+
+: apply-printer-style ( style gadget -- style gadget )
+    presented-printer [
+        [ make-pane ] curry over set-editable-slot-printer
+    ] apply-style ;
+
+: style-pane ( style pane -- pane )
+    apply-border-width-style
+    apply-border-color-style
+    apply-page-color-style
+    apply-presentation-style
+    apply-path-style
+    apply-printer-style
+    nip ;
+
+TUPLE: nested-pane-stream style parent ;
+
+: <nested-pane-stream> ( style parent -- stream )
+    >r <pane> apply-wrap-style <pane-stream> r> {
+        set-nested-pane-stream-style
+        set-delegate
+        set-nested-pane-stream-parent
+    } nested-pane-stream construct ;
+
+: unnest-pane-stream ( stream -- child parent )
+    dup ?nl
+    dup nested-pane-stream-style
+    over pane-stream-pane smash-pane style-pane
+    swap nested-pane-stream-parent ;
+
+TUPLE: pane-block-stream ;
+
+M: pane-block-stream stream-close
+    unnest-pane-stream write-gadget ;
+
+M: pane-stream make-block-stream
+    <nested-pane-stream> pane-block-stream construct-delegate ;
+
+! Tables
+: apply-table-gap-style ( style grid -- style grid )
+    table-gap [ over set-grid-gap ] apply-style ;
+
+: apply-table-border-style ( style grid -- style grid )
+    table-border [ <grid-lines> over set-gadget-boundary ]
+    apply-style ;
+
+: styled-grid ( style grid -- grid )
+    <grid>
+    f over set-grid-fill?
+    apply-table-gap-style
+    apply-table-border-style
+    nip ;
+
+TUPLE: pane-cell-stream ;
+
+M: pane-cell-stream stream-close ?nl ;
+
+M: pane-stream make-cell-stream
+    <nested-pane-stream> pane-cell-stream construct-delegate ;
+
+M: pane-stream stream-write-table
+    >r
+    swap [ [ pane-stream-pane smash-pane ] map ] map
+    styled-grid
+    r> print-gadget ;
+
+! Stream utilities
+M: pack stream-close drop ;
+
+M: paragraph stream-close drop ;
+
+: gadget-write ( string gadget -- )
+    over empty? [
+        2drop
+    ] [
+        >r <label> dup text-theme r> add-gadget
+    ] if ;
+
+M: pack stream-write gadget-write ;
+
+: gadget-bl ( style stream -- )
+    >r " " <styled-label> <word-break-gadget> r> add-gadget ;
+
+M: paragraph stream-write
+    swap " " split
+    [ H{ } over gadget-bl ] [ over gadget-write ] interleave
+    drop ;
+
+: gadget-write1 ( char gadget -- )
+    >r 1string r> stream-write ;
+
+M: pack stream-write1 gadget-write1 ;
+
+M: paragraph stream-write1
+    over CHAR: \s =
+    [ H{ } swap gadget-bl drop ] [ gadget-write1 ] if ;
+
+: gadget-format ( string style stream -- )
+    pick empty?
+    [ 3drop ] [ >r swap <styled-label> r> add-gadget ] if ;
+
+M: pack stream-format
+    gadget-format ;
+
+M: paragraph stream-format
+    presented pick at [
+        gadget-format
+    ] [
+        rot " " split
+        [ 2dup gadget-bl ]
+        [ pick pick gadget-format ] interleave
+        2drop
+    ] if ;
+
+: caret>mark ( pane -- )
+    dup pane-caret over set-pane-mark relayout-1 ;
+
+GENERIC: sloppy-pick-up* ( loc gadget -- n )
+
+M: pack sloppy-pick-up*
+    dup gadget-orientation
+    swap gadget-children
+    (fast-children-on) ;
+
+M: gadget sloppy-pick-up*
+    gadget-children [ inside? ] curry* find-last drop ;
+
+M: f sloppy-pick-up*
+    2drop f ;
+
+: wet-and-sloppy ( loc gadget n -- newloc newgadget )
+    swap nth-gadget [ rect-loc v- ] keep ;
+
+: sloppy-pick-up ( loc gadget -- path )
+    2dup sloppy-pick-up* dup
+    [ [ wet-and-sloppy sloppy-pick-up ] keep add* ]
+    [ 3drop { } ]
+    if ;
+
+: move-caret ( pane -- )
+    dup hand-rel
+    over sloppy-pick-up
+    2dup gadget-at-path scroll>gadget
+    over set-pane-caret
+    relayout-1 ;
+
+: begin-selection ( pane -- )
+    dup move-caret f swap set-pane-mark ;
+
+: extend-selection ( pane -- )
+    hand-moved? [
+        dup pane-selecting? [
+            dup move-caret
+        ] [
+            dup hand-clicked get child? [
+                t over set-pane-selecting?
+                dup hand-clicked set-global
+                dup move-caret
+                dup caret>mark
+            ] when
+        ] if
+    ] when drop ;
+
+: end-selection ( pane -- )
+    f over set-pane-selecting?
+    hand-moved? [
+        dup com-copy-selection
+        request-focus
+    ] [
+        relayout-1
+    ] if ;
+
+: select-to-caret ( pane -- )
+    dup pane-mark [ dup caret>mark ] unless
+    dup move-caret
+    dup request-focus
+    com-copy-selection ;
+
+pane H{
+    { T{ button-down } [ begin-selection ] }
+    { T{ button-down f { S+ } 1 } [ select-to-caret ] }
+    { T{ button-up f { S+ } 1 } [ drop ] }
+    { T{ button-up } [ end-selection ] }
+    { T{ drag } [ extend-selection ] }
+    { T{ copy-action } [ com-copy ] }
+} set-gestures
diff --git a/extra/ui/gadgets/panes/summary.txt b/extra/ui/gadgets/panes/summary.txt
new file mode 100644 (file)
index 0000000..4775b7e
--- /dev/null
@@ -0,0 +1 @@
+Pane gadgets display formatted stream output
diff --git a/extra/ui/gadgets/paragraphs/authors.txt b/extra/ui/gadgets/paragraphs/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/paragraphs/paragraphs.factor b/extra/ui/gadgets/paragraphs/paragraphs.factor
new file mode 100644 (file)
index 0000000..c51aba1
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2005, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.gadgets ui.gadgets.labels ui.render kernel math
+namespaces sequences ;
+IN: ui.gadgets.paragraphs
+
+! A word break gadget
+TUPLE: word-break-gadget ;
+
+: <word-break-gadget> ( gadget -- gadget )
+    { set-delegate } word-break-gadget construct ;
+
+M: word-break-gadget draw-gadget* drop ;
+
+! A gadget that arranges its children in a word-wrap style.
+TUPLE: paragraph margin ;
+
+: <paragraph> ( margin -- gadget )
+    paragraph construct-gadget
+    { 1 0 } over set-gadget-orientation
+    [ set-paragraph-margin ] keep ;
+
+SYMBOL: x SYMBOL: max-x
+
+SYMBOL: y SYMBOL: max-y
+
+SYMBOL: line-height
+
+SYMBOL: margin
+
+: overrun? ( width -- ? ) x get + margin get > ;
+
+: zero-vars [ 0 swap set ] each ;
+
+: wrap-line ( -- )
+    line-height get y +@
+    { x line-height } zero-vars ;
+
+: wrap-pos ( -- pos ) x get y get 2array ; inline
+
+: advance-x ( x -- )
+    x +@
+    x get max-x [ max ] change ;
+
+: advance-y ( y -- )
+    dup line-height [ max ] change
+    y get + max-y [ max ] change ;
+
+: wrap-step ( quot child -- )
+    dup pref-dim [
+        over word-break-gadget? [
+            dup first overrun? [ wrap-line ] when
+        ] unless drop wrap-pos rot call
+    ] keep first2 advance-y advance-x ; inline
+
+: wrap-dim ( -- dim ) max-x get max-y get 2array ;
+
+: init-wrap ( paragraph -- )
+    paragraph-margin margin set
+    { x max-x y max-y line-height } zero-vars ;
+
+: do-wrap ( paragraph quot -- dim )
+    [
+        swap dup init-wrap
+        [ wrap-step ] curry* each-child wrap-dim
+    ] with-scope ; inline
+
+M: paragraph pref-dim*
+    [ 2drop ] do-wrap ;
+
+M: paragraph layout*
+    [ swap dup prefer set-rect-loc ] do-wrap drop ;
diff --git a/extra/ui/gadgets/paragraphs/summary.txt b/extra/ui/gadgets/paragraphs/summary.txt
new file mode 100644 (file)
index 0000000..f0fb8a8
--- /dev/null
@@ -0,0 +1 @@
+Paragraph gadgets lay out their children from left to right, wrapping at a fixed margin
diff --git a/extra/ui/gadgets/presentations/authors.txt b/extra/ui/gadgets/presentations/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/presentations/presentations-docs.factor b/extra/ui/gadgets/presentations/presentations-docs.factor
new file mode 100644 (file)
index 0000000..f24fa3a
--- /dev/null
@@ -0,0 +1,50 @@
+USING: help.markup help.syntax
+ui.gadgets.buttons ui.gadgets.menus models ui.operations
+inspector kernel ui.gadgets.worlds ui.gadgets ;
+IN: ui.gadgets.presentations
+
+HELP: presentation
+{ $class-description "A presentation is a " { $link button } " which represents an object. Left-clicking a presentation invokes the default " { $link operation } ", and right-clicking displays a menu of possible operations output by " { $link object-operations } "."
+$nl
+"Presentations are created by calling " { $link <presentation> } "."
+$nl
+"Presentations have two slots:"
+{ $list
+    { { $link presentation-object } " - the object being presented." }
+    { { $link presentation-hook } " - a quotation with stack effect " { $snippet "( presentation -- )" } ". The default value is " { $snippet "[ drop ]" } "." }
+} } ;
+
+HELP: invoke-presentation
+{ $values { "presentation" presentation } { "command" "a command" } }
+{ $description "Calls the " { $link presentation-hook } " and then invokes the command on the " { $link presentation-object } "." } ;
+
+{ invoke-presentation invoke-primary invoke-secondary } related-words
+
+HELP: invoke-primary
+{ $values { "presentation" presentation } } 
+{ $description "Invokes the " { $link primary-operation } " associated to the " { $link presentation-object } ". This word is executed when the presentation is clicked with the left mouse button." } ;
+
+HELP: invoke-secondary
+{ $values { "presentation" presentation } } 
+{ $description "Invokes the " { $link secondary-operation } " associated to the " { $link presentation-object } ". This word is executed when a list receives a " { $snippet "RET" } " key press." } ;
+
+HELP: <presentation>
+{ $values { "label" "a label" } { "object" object } { "button" "a new " { $link button } } }
+{ $description "Creates a new " { $link presentation } " derived from " { $link <roll-button> } "." }
+{ $see-also "presentations" } ;
+
+{ <button> <bevel-button> <command-button> <roll-button> <presentation> } related-words
+
+{ <commands-menu> <toolbar> operations-menu show-menu } related-words
+
+HELP: show-mouse-help
+{ $values { "presentation" presentation } }
+{ $description "Displays a " { $link summary } " of the " { $link presentation-object } "in the status bar of the " { $link world } " containing this presentation. This word is executed when the mouse enters the presentation." } ;
+
+ARTICLE: "ui.gadgets.presentations" "Presentation gadgets"
+"Outliner gadgets are usually not constructed directly, and instead are written to " { $link "ui.gadgets.panes" } " with formatted stream output words (" { $link "presentations" } ")."
+{ $subsection presentation }
+{ $subsection <presentation> }
+"Presentations remember the object they are presenting; operations can be performed on the presented object. See " { $link "ui-operations" } "." ;
+
+ABOUT: "ui.gadgets.presentations"
diff --git a/extra/ui/gadgets/presentations/presentations-tests.factor b/extra/ui/gadgets/presentations/presentations-tests.factor
new file mode 100644 (file)
index 0000000..930c81d
--- /dev/null
@@ -0,0 +1,14 @@
+IN: temporary
+USING: math ui.gadgets.presentations ui.gadgets tools.test
+prettyprint ui.gadgets.buttons io io.streams.string kernel
+tuples ;
+
+[ t ] [
+    "Hi" \ + <presentation> [ gadget? ] is?
+] unit-test
+
+[ "+" ] [
+    [
+        \ + f \ pprint <command-button> dup button-quot call
+    ] string-out
+] unit-test
diff --git a/extra/ui/gadgets/presentations/presentations.factor b/extra/ui/gadgets/presentations/presentations.factor
new file mode 100644 (file)
index 0000000..82ddeba
--- /dev/null
@@ -0,0 +1,55 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions ui.gadgets ui.gadgets.borders
+ui.gadgets.buttons ui.gadgets.labels ui.gadgets.menus
+ui.gadgets.worlds hashtables io kernel prettyprint sequences
+strings io.styles words help math models namespaces quotations
+ui.commands ui.operations ui.gestures ;
+IN: ui.gadgets.presentations
+
+TUPLE: presentation object hook ;
+
+: invoke-presentation ( presentation command -- )
+    over dup presentation-hook call
+    >r presentation-object r> invoke-command ;
+
+: invoke-primary ( presentation -- )
+    dup presentation-object primary-operation
+    invoke-presentation ;
+
+: invoke-secondary ( presentation -- )
+    dup presentation-object secondary-operation
+    invoke-presentation ;
+
+: show-mouse-help ( presentation -- )
+    dup presentation-object over show-summary button-update ;
+
+: <presentation> ( label object -- button )
+    presentation construct-empty
+    [ drop ] over set-presentation-hook
+    [ set-presentation-object ] keep
+    swap [ invoke-primary ] <roll-button>
+    over set-gadget-delegate ;
+
+M: presentation ungraft*
+    dup hand-gadget get-global child? [ dup hide-status ] when
+    delegate ungraft* ;
+
+: <operations-menu> ( presentation -- menu )
+    dup dup presentation-hook curry
+    swap presentation-object
+    dup object-operations <commands-menu> ;
+
+: operations-menu ( presentation -- )
+    dup <operations-menu> swap show-menu ;
+
+presentation H{
+    { T{ button-down f f 3 } [ operations-menu ] }
+    { T{ mouse-leave } [ dup hide-status button-update ] }
+    { T{ mouse-enter } [ show-mouse-help ] }
+    ! Responding to motion too allows nested presentations to
+    ! display status help properly, when the mouse leaves a
+    ! nested presentation and is still inside the parent, the
+    ! parent doesn't receive a mouse-enter
+    { T{ motion } [ show-mouse-help ] }
+} set-gestures
diff --git a/extra/ui/gadgets/presentations/summary.txt b/extra/ui/gadgets/presentations/summary.txt
new file mode 100644 (file)
index 0000000..47dc4f6
--- /dev/null
@@ -0,0 +1 @@
+Presentations display an interactive view of an object
diff --git a/extra/ui/gadgets/scrollers/authors.txt b/extra/ui/gadgets/scrollers/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/scrollers/scrollers-docs.factor b/extra/ui/gadgets/scrollers/scrollers-docs.factor
new file mode 100644 (file)
index 0000000..6a0608d
--- /dev/null
@@ -0,0 +1,59 @@
+USING: ui.gadgets help.markup help.syntax
+ui.gadgets.viewports ui.gadgets.sliders ;
+IN: ui.gadgets.scrollers
+
+HELP: scroller
+{ $class-description "A scroller consists of a " { $link viewport } " containing a child, together with horizontal and vertical " { $link slider } " gadgets which scroll the viewport's child. Scroller gadgets also support using a mouse scroll wheel."
+$nl
+"Scroller gadgets are created by calling " { $link <scroller> } "." } ;
+
+HELP: find-scroller
+{ $values { "gadget" gadget } { "scroller/f" "a " { $link scroller } " or " { $link f } } }
+{ $description "Finds the first parent of " { $snippet "gadget" } " which is a " { $link scroller } ". Outputs " { $link f } " if the gadget is not contained in a " { $link scroller } "." } ;
+
+HELP: scroller-value
+{ $values { "scroller" scroller } { "loc" "a pair of integers" } }
+{ $description "Outputs the offset of the top-left corner of the scroller's " { $link viewport } "'s child." } ;
+
+{ scroller-value scroll scroll>bottom scroll>top scroll>rect } related-words
+
+HELP: <scroller>
+{ $values { "gadget" gadget } { "scroller" "a new " { $link scroller } } }
+{ $description "Creates a new " { $link scroller } " for scrolling around " { $snippet "gadget" } "." } ;
+
+{ <viewport> <scroller> } related-words
+
+HELP: scroll
+{ $values { "scroller" scroller } { "value" "a pair of integers" } }
+{ $description "Sets the offset of the top-left corner of the scroller's " { $link viewport } "'s child." } ;
+
+HELP: relative-scroll-rect
+{ $values { "rect" rect } { "gadget" gadget } { "scroller" scroller } { "newrect" "a new " { $link rect } } }
+{ $description "Adjusts " { $snippet "rect" } " for the case where the gadget is not the immediate child of the scroller's viewport." } ;
+
+HELP: scroll>rect
+{ $values { "rect" rect } { "gadget" gadget } }
+{ $description "Ensures that a rectangular region relative to the top-left corner of " { $snippet "gadget" } " becomes visible in a " { $link scroller } " containing " { $snippet "gadget" } ". Does nothing if no parent of " { $snippet "gadget" } " is a " { $link scroller } "." } ;
+
+HELP: scroll>bottom
+{ $values { "gadget" gadget } }
+{ $description "Ensures that any " { $link scroller } " containing " { $snippet "gadget" } " is scrolled all the way down. Does nothing if no parent of " { $snippet "gadget" } " is a " { $link scroller } "." } ;
+
+HELP: scroll>top
+{ $values { "gadget" gadget } }
+{ $description "Ensures that any scroller containing " { $snippet "gadget" } " is scrolled all the way up. If no parent of " { $snippet "scroller" } " is a gadget, does nothing." } ;
+
+ARTICLE: "ui.gadgets.scrollers" "Scroller gadgets"
+"A scroller displays a gadget which is larger than the visible area."
+{ $subsection scroller }
+{ $subsection <scroller> }
+"Getting and setting the scroll position:"
+{ $subsection scroller-value }
+{ $subsection scroll }
+"Writing scrolling-aware gadgets:"
+{ $subsection scroll>bottom }
+{ $subsection scroll>top }
+{ $subsection scroll>rect }
+{ $subsection find-scroller } ;
+
+ABOUT: "ui.gadgets.scrollers"
diff --git a/extra/ui/gadgets/scrollers/scrollers-tests.factor b/extra/ui/gadgets/scrollers/scrollers-tests.factor
new file mode 100644 (file)
index 0000000..efdf03b
--- /dev/null
@@ -0,0 +1,76 @@
+IN: temporary
+USING: ui.gadgets ui.gadgets.scrollers ui.gadgets.controls
+namespaces tools.test kernel models ui.gadgets.viewports math
+math.vectors arrays sequences ;
+
+[ ] [
+    <gadget> "g" set
+    "g" get <scroller> "s" set
+] unit-test
+
+[ { 100 200 } ] [
+    { 100 200 } "g" get scroll>rect
+    "s" get scroller-follows rect-loc
+] unit-test
+
+[ ] [ "s" get scroll>bottom ] unit-test
+[ t ] [ "s" get scroller-follows ] unit-test
+
+[ ] [
+    <gadget> dup "g" set
+    10 1 0 100 <range> 20 1 0 100 <range> 2array <compose>
+    <viewport> "v" set 
+] unit-test
+
+[ { 10 20 } ] [ "v" get control-model range-value ] unit-test
+
+[ { 10 20 } ] [ "g" get rect-loc vneg { 3 3 } v+ ] unit-test
+
+[ ] [
+    <gadget> { 100 100 } over set-rect-dim
+    dup "g" set <scroller> "s" set
+] unit-test
+
+[ ] [ { 50 50 } "s" get set-rect-dim ] unit-test
+
+[ ] [ "s" get layout ] unit-test
+
+[ ] [ "s" get graft ] unit-test
+
+[ { 34 34 } ] [ "s" get scroller-viewport rect-dim ] unit-test
+
+[ { 106 106 } ] [ "s" get scroller-viewport viewport-dim ] unit-test
+
+[ ] [ { 0 0 } "s" get scroll ] unit-test
+
+[ { 0 0 } ] [ "s" get control-model range-min-value ] unit-test
+
+[ { 106 106 } ] [ "s" get control-model range-max-value ] unit-test
+
+[ ] [ { 10 20 } "s" get scroll ] unit-test
+
+[ { 10 20 } ] [ "s" get control-model range-value ] unit-test
+
+[ { 10 20 } ] [ "s" get scroller-viewport control-model range-value ] unit-test
+
+[ { 10 20 } ] [ "g" get rect-loc vneg { 3 3 } v+ ] unit-test
+
+[ ] [ "s" get ungraft ] unit-test
+
+<gadget> { 600 400 } over set-rect-dim "g1" set
+<gadget> { 600 10 } over set-rect-dim "g2" set
+"g2" get "g1" get add-gadget
+
+"g1" get <scroller>
+{ 300 300 } over set-rect-dim
+dup layout
+"s" set
+
+[ t ] [
+    10 [
+        drop
+        "g2" get scroll>gadget
+        "s" get layout
+        "s" get scroller-value
+    ] map [ { 3 0 } = ] all?
+] unit-test
diff --git a/extra/ui/gadgets/scrollers/scrollers.factor b/extra/ui/gadgets/scrollers/scrollers.factor
new file mode 100644 (file)
index 0000000..22866a8
--- /dev/null
@@ -0,0 +1,127 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.gadgets ui.gadgets.controls
+ui.gadgets.viewports ui.gadgets.frames ui.gadgets.grids
+ui.gadgets.theme ui.gadgets.sliders ui.gestures kernel math
+namespaces sequences models combinators math.vectors ;
+IN: ui.gadgets.scrollers
+
+TUPLE: scroller viewport x y follows ;
+
+: find-scroller ( gadget -- scroller/f )
+    [ scroller? ] find-parent ;
+
+: scroll-up-page scroller-y -1 swap slide-by-page ;
+
+: scroll-down-page scroller-y 1 swap slide-by-page ;
+
+: scroll-up-line scroller-y -1 swap slide-by-line ;
+
+: scroll-down-line scroller-y 1 swap slide-by-line ;
+
+: do-mouse-scroll ( scroller -- )
+    scroll-direction get-global first2
+    pick scroller-y slide-by-line
+    swap scroller-x slide-by-line ;
+
+scroller H{
+    { T{ mouse-scroll } [ do-mouse-scroll ] }
+} set-gestures
+
+: viewport, ( -- )
+    g control-model <viewport>
+    g-> set-scroller-viewport @center frame, ;
+
+: <scroller-model> ( -- model )
+    0 0 0 0 <range> 0 0 0 0 <range> 2array <compose> ;
+
+: x-model g control-model model-dependencies first ;
+
+: y-model g control-model model-dependencies second ;
+
+: <scroller> ( gadget -- scroller )
+    <scroller-model> <frame> scroller construct-control [
+        [
+            x-model <x-slider> g-> set-scroller-x @bottom frame,
+            y-model <y-slider> g-> set-scroller-y @right frame,
+            viewport,
+        ] with-gadget
+    ] keep t over set-gadget-root? dup faint-boundary ;
+
+: scroll ( value scroller -- )
+    [
+        dup scroller-viewport rect-dim { 0 0 }
+        rot scroller-viewport viewport-dim 4array flip
+    ] keep
+    2dup control-value = [ 2drop ] [ set-control-value ] if ;
+
+: rect-min ( rect1 rect2 -- rect )
+    >r [ rect-loc ] keep r> [ rect-dim ] 2apply vmin <rect> ;
+
+: (scroll>rect) ( rect scroller -- )
+    [
+        scroller-value vneg offset-rect
+        viewport-gap offset-rect
+    ] keep
+    [ scroller-viewport rect-min ] keep
+    [
+        scroller-viewport 2rect-extent
+        >r >r v- { 0 0 } vmin r> r> v- { 0 0 } vmax v+
+    ] keep dup scroller-value rot v+ swap scroll ;
+
+: relative-scroll-rect ( rect gadget scroller -- newrect )
+    scroller-viewport gadget-child 2dup swap child?
+    [ relative-loc offset-rect ] [ 3drop f ] if ;
+
+: scroll>rect ( rect gadget -- )
+    dup find-scroller dup [
+        [ relative-scroll-rect ] keep
+        [ set-scroller-follows ] keep
+        relayout
+    ] [
+        3drop
+    ] if ;
+
+: (scroll>gadget) ( rect scroller -- )
+    >r { 0 0 } over pref-dim <rect> swap r>
+    [ relative-scroll-rect ] keep
+    (scroll>rect) ;
+
+: scroll>gadget ( gadget -- )
+    dup find-scroller dup [
+        [ set-scroller-follows ] keep
+        relayout
+    ] [
+        2drop
+    ] if ;
+
+: (scroll>bottom) ( scroller -- )
+    dup scroller-viewport viewport-dim { 0 1 } v* swap scroll ;
+
+: scroll>bottom ( gadget -- )
+    find-scroller [
+        t over set-scroller-follows relayout-1
+    ] when* ;
+
+: scroll>top ( gadget -- )
+    <zero-rect> swap scroll>rect ;
+
+: update-scroller ( scroller follows -- )
+    {
+        { [ dup t eq? ] [ drop (scroll>bottom) ] }
+        { [ dup rect? ] [ swap (scroll>rect) ] }
+        { [ dup ] [ swap (scroll>gadget) ] }
+        { [ t ] [ drop dup scroller-value swap scroll ] }
+    } cond ;
+
+M: scroller layout*
+    dup delegate layout*
+    dup scroller-follows
+    [ update-scroller ] 2keep
+    swap set-scroller-follows ;
+
+M: scroller focusable-child*
+    scroller-viewport ;
+
+M: scroller model-changed
+    f swap set-scroller-follows ;
diff --git a/extra/ui/gadgets/scrollers/summary.txt b/extra/ui/gadgets/scrollers/summary.txt
new file mode 100644 (file)
index 0000000..71ec496
--- /dev/null
@@ -0,0 +1 @@
+Scrollers display a user-chosen portion of a child which may have arbitrary dimensions
diff --git a/extra/ui/gadgets/slate/slate.factor b/extra/ui/gadgets/slate/slate.factor
new file mode 100644 (file)
index 0000000..05e36c4
--- /dev/null
@@ -0,0 +1,20 @@
+
+USING: kernel namespaces opengl ui.render ui.gadgets ;
+
+IN: ui.gadgets.slate
+
+TUPLE: slate action dim graft ungraft ;
+
+: <slate> ( action -- slate )
+  slate construct-gadget
+  tuck set-slate-action
+  { 100 100 } over set-slate-dim ;
+
+M: slate pref-dim* ( slate -- dim ) slate-dim ;
+
+M: slate draw-gadget* ( slate -- )
+   origin get swap slate-action with-translation ;
+
+M: slate graft* ( slate -- ) slate-graft call ;
+
+M: slate ungraft* ( slate -- ) slate-ungraft call ;
\ No newline at end of file
diff --git a/extra/ui/gadgets/sliders/authors.txt b/extra/ui/gadgets/sliders/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/sliders/sliders-docs.factor b/extra/ui/gadgets/sliders/sliders-docs.factor
new file mode 100644 (file)
index 0000000..596b110
--- /dev/null
@@ -0,0 +1,62 @@
+USING: ui.gadgets.controls help.markup help.syntax ui.gadgets
+models ;
+IN: ui.gadgets.sliders
+
+HELP: elevator
+{ $class-description "An elevator is the part of a " { $link slider } " between the up/down arrow buttons, where a " { $link thumb } " may be moved up and down." } ;
+
+HELP: find-elevator
+{ $values { "gadget" gadget } { "elevator/f" "an " { $link elevator } " or " { $link f } } }
+{ $description "Finds the first parent of " { $snippet "gadget" } " which is an " { $link elevator } ". Outputs " { $link f } " if the gadget is not contained in an " { $link elevator } "." } ;
+
+HELP: slider
+{ $class-description "A slider is a " { $link control } " for graphically manipulating a " { $link "models-range" } "."
+$nl
+"Sliders are created by calling " { $link <x-slider> } " or " { $link <y-slider> } "." } ;
+
+HELP: find-slider
+{ $values { "gadget" gadget } { "slider/f" "a " { $link slider } " or " { $link f } } }
+{ $description "Finds the first parent of " { $snippet "gadget" } " which is a " { $link slider } ". Outputs " { $link f } " if the gadget is not contained in a " { $link slider } "." } ;
+
+HELP: thumb
+{ $class-description "A thumb is the gadget contained in a " { $link slider } "'s " { $link elevator } " which indicates the current scroll position and can be dragged up and down with the mouse." } ;
+
+HELP: slide-by
+{ $values { "amount" "an integer" } { "slider" slider } }
+{ $description "Adds the amount (which may be positive or negative) to the slider's current position." } ;
+
+HELP: slide-by-page
+{ $values { "amount" "an integer" } { "slider" slider } }
+{ $description "Adds the amount multiplied by " { $link slider-page } " to the slider's current position." } ;
+
+HELP: slide-by-line
+{ $values { "amount" "an integer" } { "slider" slider } }
+{ $description "Adds the amount multiplied by " { $link slider-line } " to the slider's current position." } ;
+
+HELP: <slider>
+{ $values { "range" range } { "orientation" "an orientation specifier" } { "slider" "a new " { $link slider } } }
+{ $description "Internal word for constructing sliders." }
+{ $notes "This does not build a complete slider, and user code should call " { $link <x-slider> } " or " { $link <y-slider> } " instead." } ;
+
+HELP: <x-slider>
+{ $values { "range" range } { "slider" slider } }
+{ $description "Creates a new horizontal " { $link slider } "." } ;
+
+HELP: <y-slider>
+{ $values { "range" range } { "slider" slider } }
+{ $description "Creates a new vertical " { $link slider } "." } ;
+
+{ <x-slider> <y-slider> } related-words
+
+ARTICLE: "ui.gadgets.sliders" "Slider gadgets"
+"A slider allows the user to graphically manipulate a value by moving a thumb back and forth."
+{ $subsection slider }
+{ $subsection <x-slider> }
+{ $subsection <y-slider> }
+"Changing slider values:"
+{ $subsection slide-by }
+{ $subsection slide-by-line }
+{ $subsection slide-by-page }
+"Since sliders are controls the value can be get and set by calling " { $link control-model } "." ;
+
+ABOUT: "ui.gadgets.sliders"
diff --git a/extra/ui/gadgets/sliders/sliders.factor b/extra/ui/gadgets/sliders/sliders.factor
new file mode 100644 (file)
index 0000000..5a245e7
--- /dev/null
@@ -0,0 +1,178 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui.gestures ui.gadgets ui.gadgets.buttons
+ui.gadgets.controls ui.gadgets.frames ui.gadgets.grids
+ui.gadgets.theme ui.render kernel math namespaces sequences
+vectors models math.vectors quotations colors ;
+IN: ui.gadgets.sliders
+
+TUPLE: elevator direction ;
+
+: find-elevator ( gadget -- elevator/f )
+    [ elevator? ] find-parent ;
+
+TUPLE: slider elevator thumb saved line ;
+
+: find-slider ( gadget -- slider/f )
+    [ slider? ] find-parent ;
+
+: elevator-length ( slider -- n )
+    dup slider-elevator rect-dim
+    swap gadget-orientation v. ;
+
+: min-thumb-dim 15 ;
+
+: slider-value control-model range-value >fixnum ;
+
+: slider-page control-model range-page-value ;
+
+: slider-max control-model range-max-value ;
+
+: slider-max* control-model range-max-value* ;
+
+: thumb-dim ( slider -- h )
+    dup slider-page over slider-max 1 max / 1 min
+    over elevator-length * min-thumb-dim max
+    over slider-elevator rect-dim
+    rot gadget-orientation v. min ;
+
+: slider-scale ( slider -- n )
+    #! A scaling factor such that if x is a slider co-ordinate,
+    #! x*n is the screen position of the thumb, and conversely
+    #! for x/n. The '1 max' calls avoid division by zero.
+    dup elevator-length over thumb-dim - 1 max
+    swap slider-max* 1 max / ;
+
+: slider>screen slider-scale * ;
+
+: screen>slider slider-scale / ;
+
+M: slider model-changed slider-elevator relayout-1 ;
+
+TUPLE: thumb ;
+
+: begin-drag ( thumb -- )
+    find-slider dup slider-value swap set-slider-saved ;
+
+: do-drag ( thumb -- )
+    find-slider drag-loc over gadget-orientation v.
+    over screen>slider swap [ slider-saved + ] keep
+    control-model set-range-value ;
+
+thumb H{
+    { T{ button-down } [ begin-drag ] }
+    { T{ button-up } [ drop ] }
+    { T{ drag } [ do-drag ] }
+} set-gestures
+
+: thumb-theme ( thumb -- )
+    plain-gradient over set-gadget-interior faint-boundary ;
+
+: <thumb> ( vector -- thumb )
+    thumb construct-gadget
+    t over set-gadget-root?
+    dup thumb-theme
+    [ set-gadget-orientation ] keep ;
+
+: slide-by ( amount slider -- )
+    control-model move-by ;
+
+: slide-by-page ( amount slider -- )
+    control-model move-by-page ;
+
+: compute-direction ( elevator -- -1/1 )
+    dup find-slider swap hand-click-rel
+    over gadget-orientation v.
+    over screen>slider
+    swap slider-value - sgn ;
+
+: elevator-hold ( elevator -- )
+    dup elevator-direction swap find-slider slide-by-page ;
+
+: elevator-click ( elevator -- )
+    dup compute-direction over set-elevator-direction
+    elevator-hold ;
+
+elevator H{
+    { T{ drag } [ elevator-hold ] }
+    { T{ button-down } [ elevator-click ] }
+} set-gestures
+
+: elevator-theme ( elevator -- )
+    lowered-gradient swap set-gadget-interior ;
+
+: <elevator> ( vector -- elevator )
+    elevator construct-gadget
+    [ set-gadget-orientation ] keep
+    dup elevator-theme ;
+
+: (layout-thumb) ( slider n -- n thumb )
+    over gadget-orientation n*v swap slider-thumb ;
+
+: thumb-loc ( slider -- loc )
+    dup slider-value swap slider>screen ;
+
+: layout-thumb-loc ( slider -- )
+    dup thumb-loc (layout-thumb)
+    >r [ floor ] map r> set-rect-loc ;
+
+: layout-thumb-dim ( slider -- )
+    dup dup thumb-dim (layout-thumb) >r
+    >r dup rect-dim r>
+    rot gadget-orientation set-axis [ ceiling ] map
+    r> set-layout-dim ;
+
+: layout-thumb ( slider -- )
+    dup layout-thumb-loc layout-thumb-dim ;
+
+M: elevator layout*
+    find-slider layout-thumb ;
+
+: slide-by-line ( amount slider -- )
+    [ slider-line * ] keep slide-by ;
+
+: <slide-button> ( vector polygon amount -- )
+    >r gray swap <polygon-gadget> r>
+    [ swap find-slider slide-by-line ] curry <repeat-button>
+    [ set-gadget-orientation ] keep ;
+
+: elevator, ( orientation -- )
+    dup <elevator> g-> set-slider-elevator
+    swap <thumb> g-> set-slider-thumb over add-gadget
+    @center frame, ;
+
+: <left-button> { 0 1 } arrow-left -1 <slide-button> ;
+: <right-button> { 0 1 } arrow-right 1 <slide-button> ;
+
+: build-x-slider ( slider -- slider )
+    [
+        <left-button> @left frame,
+        { 0 1 } elevator,
+        <right-button> @right frame,
+    ] with-gadget ;
+
+: <up-button> { 1 0 } arrow-up -1 <slide-button> ;
+: <down-button> { 1 0 } arrow-down 1 <slide-button> ;
+
+: build-y-slider ( slider -- slider )
+    [
+        <up-button> @top frame,
+        { 1 0 } elevator,
+        <down-button> @bottom frame,
+    ] with-gadget ;
+
+: <slider> ( range orientation -- slider )
+    swap <frame> slider construct-control
+    [ set-gadget-orientation ] keep
+    32 over set-slider-line ;
+
+: <x-slider> ( range -- slider )
+    { 1 0 } <slider> dup build-x-slider ;
+
+: <y-slider> ( range -- slider )
+    { 0 1 } <slider> dup build-y-slider ;
+
+M: slider pref-dim*
+    dup delegate pref-dim*
+    swap gadget-orientation [ 40 v*n ] keep
+    set-axis ;
diff --git a/extra/ui/gadgets/sliders/summary.txt b/extra/ui/gadgets/sliders/summary.txt
new file mode 100644 (file)
index 0000000..e7f136e
--- /dev/null
@@ -0,0 +1 @@
+Slider gadgets provide a graphical view of an integer-valued model
diff --git a/extra/ui/gadgets/slots/authors.txt b/extra/ui/gadgets/slots/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/slots/slots-tests.factor b/extra/ui/gadgets/slots/slots-tests.factor
new file mode 100644 (file)
index 0000000..5388794
--- /dev/null
@@ -0,0 +1,4 @@
+IN: temporary
+USING: assocs ui.gadgets.slots tools.test refs ;
+
+[ t ] [ { 1 2 3 } 2 <value-ref> <slot-editor> slot-editor? ] unit-test
diff --git a/extra/ui/gadgets/slots/slots.factor b/extra/ui/gadgets/slots/slots.factor
new file mode 100644 (file)
index 0000000..c0bb8a1
--- /dev/null
@@ -0,0 +1,125 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces ui.gadgets ui.gestures ui.commands kernel
+ui.gadgets.scrollers parser prettyprint ui.gadgets.buttons
+sequences arrays ui.gadgets.borders ui.gadgets.tracks
+ui.gadgets.editors ui.gadgets.controls io math
+definitions math.vectors assocs refs ;
+IN: ui.gadgets.slots
+
+TUPLE: update-object ;
+
+TUPLE: update-slot ;
+
+TUPLE: edit-slot ;
+
+TUPLE: slot-editor ref text ;
+
+: revert ( slot-editor -- )
+    dup slot-editor-ref get-ref unparse-use
+    swap slot-editor-text set-editor-string ;
+
+\ revert H{
+    { +description+ "Revert any uncomitted changes." }
+} define-command
+
+GENERIC: finish-editing ( slot-editor ref -- )
+
+M: key-ref finish-editing
+    drop T{ update-object } swap send-gesture drop ;
+
+M: value-ref finish-editing
+    drop T{ update-slot } swap send-gesture drop ;
+
+: slot-editor-value ( slot-editor -- object )
+    slot-editor-text control-value parse-fresh ;
+
+: commit ( slot-editor -- )
+    dup slot-editor-text control-value parse-fresh first
+    over slot-editor-ref set-ref
+    dup slot-editor-ref finish-editing ;
+
+\ commit H{
+    { +description+ "Parse the object being edited, and store the result back into the edited slot." }
+} define-command
+
+: com-eval ( slot-editor -- )
+    [ slot-editor-text editor-string eval ] keep
+    [ slot-editor-ref set-ref ] keep
+    dup slot-editor-ref finish-editing ;
+
+\ com-eval H{
+    { +listener+ t }
+    { +description+ "Parse code which evaluates to an object, and store the result back into the edited slot." }
+} define-command
+
+: delete ( slot-editor -- )
+    dup slot-editor-ref delete-ref
+    T{ update-object } swap send-gesture drop ;
+
+\ delete H{
+    { +description+ "Delete the slot and close the slot editor." }
+} define-command
+
+: close ( slot-editor -- )
+    T{ update-slot } swap send-gesture drop ;
+
+\ close H{
+    { +description+ "Close the slot editor without saving changes." }
+} define-command
+
+: <slot-editor> ( ref -- gadget )
+    slot-editor construct-empty
+    [ set-slot-editor-ref ] keep
+    [
+        toolbar,
+        <source-editor> g-> set-slot-editor-text
+        <scroller> 1 track,
+    ] { 0 1 } build-track
+    dup revert ;
+
+M: slot-editor pref-dim* delegate pref-dim* { 600 200 } vmin ;
+
+slot-editor "toolbar" f {
+    { T{ key-down f { C+ } "RET" } commit }
+    { T{ key-down f { S+ C+ } "RET" } com-eval }
+    { f revert }
+    { f delete }
+    { T{ key-down f f "ESC" } close }
+} define-command-map
+
+TUPLE: editable-slot printer ref ;
+
+: <edit-button> ( -- gadget )
+    "..."
+    [ T{ edit-slot } swap send-gesture drop ]
+    <roll-button> ;
+
+: display-slot ( gadget editable-slot -- )
+    dup clear-track
+    [ 1 track, <edit-button> f track, ] with-gadget ;
+
+: update-slot ( editable-slot -- )
+    [
+        dup editable-slot-ref get-ref
+        swap editable-slot-printer call
+    ] keep
+    [ display-slot ] keep
+    scroll>gadget ;
+
+: edit-slot ( editable-slot -- )
+    dup clear-track dup [
+        dup editable-slot-ref <slot-editor> 1 track,
+    ] with-gadget scroll>gadget ;
+
+\ editable-slot H{
+    { T{ update-slot } [ update-slot ] }
+    { T{ edit-slot } [ edit-slot ] }
+} set-gestures
+
+: <editable-slot> ( gadget ref -- editable-slot )
+    editable-slot construct-empty
+    { 1 0 } <track> over set-gadget-delegate
+    [ drop <gadget> ] over set-editable-slot-printer
+    [ set-editable-slot-ref ] keep
+    [ display-slot ] keep ;
diff --git a/extra/ui/gadgets/slots/summary.txt b/extra/ui/gadgets/slots/summary.txt
new file mode 100644 (file)
index 0000000..6468fe3
--- /dev/null
@@ -0,0 +1 @@
+Slot editor gadgets are used to implement the UI inspector
diff --git a/extra/ui/gadgets/status-bar/authors.txt b/extra/ui/gadgets/status-bar/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/status-bar/status-bar-docs.factor b/extra/ui/gadgets/status-bar/status-bar-docs.factor
new file mode 100644 (file)
index 0000000..40ee352
--- /dev/null
@@ -0,0 +1,9 @@
+USING: ui.gadgets.status-bar ui.gadgets.presentations
+help.markup help.syntax models ui.gadgets ui.gadgets.worlds ;
+
+HELP: <status-bar>
+{ $values { "model" model } { "gadget" "a new " { $link gadget } } }
+{ $description "Creates a new " { $link gadget } " displaying the model value, which must be a string or " { $link f } "." }
+{ $notes "If the " { $snippet "model" } " is " { $link world-status } ", this gadget will display " { $link presentation } " mouse over help." } ;
+
+{ <status-bar> show-mouse-help show-status show-summary hide-status } related-words
diff --git a/extra/ui/gadgets/status-bar/status-bar.factor b/extra/ui/gadgets/status-bar/status-bar.factor
new file mode 100644 (file)
index 0000000..c5508e1
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: models sequences ui.gadgets.labels ui.gadgets.theme
+ui.gadgets.tracks ui.gadgets.worlds ui.gadgets ui kernel ;
+IN: ui.gadgets.status-bar
+
+: <status-bar> ( model -- gadget )
+    100 <delay> [ "" like ] <filter> <label-control>
+    dup reverse-video-theme
+    t over set-gadget-root? ;
+
+: open-status-window ( gadget title -- )
+    >r [
+        1 track,
+        f <model> dup <status-bar> f track,
+    ] { 0 1 } make-track r> rot <world> open-world-window ;
diff --git a/extra/ui/gadgets/status-bar/summary.txt b/extra/ui/gadgets/status-bar/summary.txt
new file mode 100644 (file)
index 0000000..58417e9
--- /dev/null
@@ -0,0 +1 @@
+Status bar gadgets display mouse-over help for other gadgets
diff --git a/extra/ui/gadgets/summary.txt b/extra/ui/gadgets/summary.txt
new file mode 100644 (file)
index 0000000..8b734ab
--- /dev/null
@@ -0,0 +1 @@
+Gadget hierarchy and layout management
diff --git a/extra/ui/gadgets/theme/authors.txt b/extra/ui/gadgets/theme/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/theme/summary.txt b/extra/ui/gadgets/theme/summary.txt
new file mode 100644 (file)
index 0000000..327f0d2
--- /dev/null
@@ -0,0 +1 @@
+Common colors and gradients used by the UI
diff --git a/extra/ui/gadgets/theme/theme.factor b/extra/ui/gadgets/theme/theme.factor
new file mode 100644 (file)
index 0000000..77e9375
--- /dev/null
@@ -0,0 +1,57 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! Copyright (C) 2006, 2007 Alex Chapman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel sequences io.styles ui.gadgets ui.render
+colors ;
+IN: ui.gadgets.theme
+
+: solid-interior <solid> swap set-gadget-interior ;
+
+: solid-boundary <solid> swap set-gadget-boundary ;
+
+: faint-boundary gray solid-boundary ;
+
+: selection-color light-purple ;
+
+: plain-gradient
+    T{ gradient f {
+        { 0.94 0.94 0.94 1.0 }
+        { 0.83 0.83 0.83 1.0 }
+        { 0.83 0.83 0.83 1.0 }
+        { 0.62 0.62 0.62 1.0 }
+    } } ;
+
+: rollover-gradient
+    T{ gradient f {
+        { 1.0 1.0 1.0 1.0 }
+        { 0.9 0.9 0.9 1.0 }
+        { 0.9 0.9 0.9 1.0 }
+        { 0.75 0.75 0.75 1.0 }
+    } } ;
+
+: pressed-gradient
+    T{ gradient f {
+        { 0.75 0.75 0.75 1.0 }
+        { 0.9 0.9 0.9 1.0 }
+        { 0.9 0.9 0.9 1.0 }
+        { 1.0 1.0 1.0 1.0 }
+    } } ;
+
+: selected-gradient
+    T{ gradient f {
+        { 0.65 0.65 0.65 1.0 }
+        { 0.8 0.8 0.8 1.0 }
+        { 0.8 0.8 0.8 1.0 }
+        { 1.0 1.0 1.0 1.0 }
+    } } ;
+
+: lowered-gradient
+    T{ gradient f {
+        { 0.37 0.37 0.37 1.0 }
+        { 0.43 0.43 0.43 1.0 }
+        { 0.5 0.5 0.5 1.0 }
+    } } ;
+
+: sans-serif-font { "sans-serif" plain 12 } ;
+
+: monospace-font { "monospace" plain 12 } ;
diff --git a/extra/ui/gadgets/tracks/authors.txt b/extra/ui/gadgets/tracks/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/tracks/summary.txt b/extra/ui/gadgets/tracks/summary.txt
new file mode 100644 (file)
index 0000000..10ccd4d
--- /dev/null
@@ -0,0 +1 @@
+Track gadgets arrange children horizontally or vertically, giving each child a specified fraction of total available space
diff --git a/extra/ui/gadgets/tracks/tracks-docs.factor b/extra/ui/gadgets/tracks/tracks-docs.factor
new file mode 100644 (file)
index 0000000..8e07717
--- /dev/null
@@ -0,0 +1,27 @@
+USING: ui.gadgets.tracks ui.gadgets.packs help.markup
+help.syntax ui.gadgets arrays kernel quotations tuples ;
+
+HELP: track
+{ $class-description "A track is like a " { $link pack } " except each child is resized to a fixed multiple of the track's dimension in the direction of " { $link gadget-orientation } ". Tracks are created by calling " { $link <track> } "." } ;
+
+HELP: <track>
+{ $values { "orientation" "an orientation specifier" } { "track" "a new " { $link track } } }
+{ $description "Creates a new track which lays out children along the given axis. Children are laid out vertically if the orientation is " { $snippet "{ 0 1 }" } " and horizontally if the orientation is " { $snippet "{ 1 0 }" } "." } ; 
+
+{ <track> make-track build-track } related-words
+
+HELP: track-add
+{ $values { "gadget" gadget } { "track" track } { "constraint" "a number between 0 and 1, or " { $link f } } }
+{ $description "Adds a new child to a track. If the constraint is " { $link f } ", the child always occupies its preferred size. Otherwise, the constrant is a fraction of the total size which is allocated for the child." } ;
+
+HELP: track,
+{ $values { "gadget" gadget } { "constraint" "a number between 0 and 1, or " { $link f } } }
+{ $description "Adds a new child to a track. If the constraint is " { $link f } ", the child always occupies its preferred size. Otherwise, the constrant is a fraction of the total size which is allocated for the child. This word can only be called inside the quotation passed to " { $link make-track } " or " { $link build-track } "." } ;
+
+HELP: make-track
+{ $values { "quot" quotation } { "orientation" "an orientation specifier" } { "track" track } }
+{ $description "Creates a new track. The quotation can add children by calling the " { $link track, } " word." } ;
+
+HELP: build-track
+{ $values { "tuple" tuple } { "quot" quotation } { "orientation" "an orientation specifier" } }
+{ $description "Creates a new track and sets " { $snippet "tuple" } "'s delegate to the new track. The quotation can add children by calling the " { $link track, } " word, and access the track by calling " { $link g } " or " { $link g-> } "." } ;
diff --git a/extra/ui/gadgets/tracks/tracks-tests.factor b/extra/ui/gadgets/tracks/tracks-tests.factor
new file mode 100644 (file)
index 0000000..77c69bc
--- /dev/null
@@ -0,0 +1,15 @@
+USING: kernel ui.gadgets ui.gadgets.tracks tools.test ;
+IN: temporary
+
+[ { 100 100 } ] [
+    [
+        <gadget> { 100 100 } over set-rect-dim 1 track,
+    ] { 0 1 } make-track pref-dim
+] unit-test
+
+[ { 100 110 } ] [
+    [
+        <gadget> { 10 10 } over set-rect-dim f track,
+        <gadget> { 100 100 } over set-rect-dim 1 track,
+    ] { 0 1 } make-track pref-dim
+] unit-test
diff --git a/extra/ui/gadgets/tracks/tracks.factor b/extra/ui/gadgets/tracks/tracks.factor
new file mode 100644 (file)
index 0000000..d8caf54
--- /dev/null
@@ -0,0 +1,66 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: ui.gadgets ui.gadgets.packs io kernel math namespaces
+sequences words math.vectors ;
+IN: ui.gadgets.tracks
+
+TUPLE: track sizes ;
+
+: normalized-sizes ( track -- seq )
+    track-sizes
+    [ [ ] subset sum ] keep [ dup [ over / ] when ] map nip ;
+
+: <track> ( orientation -- track )
+    <pack> V{ } clone
+    { set-delegate set-track-sizes } track construct
+    1 over set-pack-fill ;
+
+: alloted-dim ( track -- dim )
+    dup gadget-children swap track-sizes { 0 0 }
+    [ [ drop { 0 0 } ] [ pref-dim ] if v+ ] 2reduce ;
+
+: available-dim ( track -- dim )
+    dup rect-dim swap alloted-dim v- ;
+
+: track-layout ( track -- sizes )
+    dup available-dim over gadget-children rot normalized-sizes
+    [ [ over n*v ] [ pref-dim ] ?if ] 2map nip ;
+
+M: track layout*
+    dup track-layout pack-layout ;
+
+: track-pref-dims-1 ( track -- dim )
+    gadget-children pref-dims max-dim ;
+
+: track-pref-dims-2 ( track -- dim )
+    dup gadget-children pref-dims swap normalized-sizes
+    [ [ v/n ] when* ] 2map max-dim [ >fixnum ] map ;
+
+M: track pref-dim*
+    dup track-pref-dims-1
+    over alloted-dim
+    pick track-pref-dims-2 v+
+    rot gadget-orientation set-axis ;
+
+: track-add ( gadget track constraint -- )
+    over track-sizes push add-gadget ;
+
+: track, ( gadget constraint -- )
+    \ make-gadget get swap track-add ;
+
+: make-track ( quot orientation -- track )
+    <track> make-gadget ; inline
+
+: build-track ( tuple quot orientation -- tuple )
+    <track> build-gadget ; inline
+
+: track-remove ( gadget track -- )
+    over [
+        [ gadget-children index ] 2keep
+        swap unparent track-sizes delete-nth
+    ] [
+        2drop
+    ] if ;
+
+: clear-track ( track -- )
+    V{ } clone over set-track-sizes clear-gadget ;
diff --git a/extra/ui/gadgets/viewports/authors.txt b/extra/ui/gadgets/viewports/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/viewports/summary.txt b/extra/ui/gadgets/viewports/summary.txt
new file mode 100644 (file)
index 0000000..9aa7d64
--- /dev/null
@@ -0,0 +1 @@
+Viewport gadgets display a portion of a child gadget and are used to implement scrollers
diff --git a/extra/ui/gadgets/viewports/viewports-docs.factor b/extra/ui/gadgets/viewports/viewports-docs.factor
new file mode 100644 (file)
index 0000000..0f6f566
--- /dev/null
@@ -0,0 +1,9 @@
+USING: ui.gadgets.viewports ui.gadgets.controls help.markup
+help.syntax ui.gadgets models ;
+
+HELP: viewport
+{ $class-description "A viewport is a " { $link control } " which positions a child gadget translated by the " { $link control-value } " vector. Viewports can be created directly by calling " { $link <viewport> } "." } ;
+
+HELP: <viewport>
+{ $values { "content" gadget } { "model" model } { "viewport" "a new " { $link viewport } } }
+{ $description "Creates a new " { $link viewport } " containing " { $snippet "content" } "." } ;
diff --git a/extra/ui/gadgets/viewports/viewports.factor b/extra/ui/gadgets/viewports/viewports.factor
new file mode 100644 (file)
index 0000000..6c783e4
--- /dev/null
@@ -0,0 +1,46 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: ui.gadgets.viewports
+USING: arrays ui.gadgets ui.gadgets.borders ui.gadgets.controls
+kernel math namespaces sequences models math.vectors ;
+
+: viewport-gap { 3 3 } ; inline
+
+TUPLE: viewport ;
+
+: find-viewport [ viewport? ] find-parent ;
+
+: viewport-dim ( viewport -- dim )
+    gadget-child pref-dim viewport-gap 2 v*n v+ ;
+
+: <viewport> ( content model -- viewport )
+    <gadget> viewport construct-control
+    t over set-gadget-clipped?
+    [ add-gadget ] keep
+    [ model-changed ] keep ;
+
+M: viewport layout*
+    dup rect-dim viewport-gap 2 v*n v-
+    over gadget-child pref-dim vmax
+    swap gadget-child set-layout-dim ;
+
+M: viewport focusable-child*
+    gadget-child ;
+
+M: viewport pref-dim* viewport-dim ;
+
+: scroller-value ( scroller -- loc )
+    control-model range-value [ >fixnum ] map ;
+
+M: viewport model-changed
+    dup relayout-1
+    dup scroller-value
+    vneg viewport-gap v+
+    swap gadget-child set-rect-loc ;
+
+: visible-dim ( gadget -- dim )
+    dup gadget-parent viewport? [
+        gadget-parent rect-dim viewport-gap 2 v*n v-
+    ] [
+        rect-dim
+    ] if ;
diff --git a/extra/ui/gadgets/worlds/authors.txt b/extra/ui/gadgets/worlds/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gadgets/worlds/summary.txt b/extra/ui/gadgets/worlds/summary.txt
new file mode 100644 (file)
index 0000000..ff0609b
--- /dev/null
@@ -0,0 +1 @@
+World gadgets are the top level of the gadget hierarchy and are displayed in native windows
diff --git a/extra/ui/gadgets/worlds/worlds-docs.factor b/extra/ui/gadgets/worlds/worlds-docs.factor
new file mode 100644 (file)
index 0000000..aedad9e
--- /dev/null
@@ -0,0 +1,60 @@
+USING: ui.gadgets.worlds ui.gadgets ui.render ui.gestures
+ui.backend help.markup help.syntax models ui.freetype opengl
+strings ui.gadgets.worlds ;
+
+HELP: origin
+{ $var-description "Within the dynamic extent of " { $link draw-world } ", holds the co-ordinate system origin for the gadget currently being drawn." } ;
+
+HELP: hand-world
+{ $var-description "Global variable. The " { $link world } " containing the gadget at the mouse location." } ;
+
+HELP: set-title
+{ $values { "string" string } { "world" world } }
+{ $description "Sets the title bar of the native window containing the world." }
+{ $notes "This word should not be called directly by user code. Instead, change the " { $link world-title } " model; see " { $link "models" } "." } ;
+
+HELP: raise-window
+{ $values { "world" world } }
+{ $description "Makes the native window containing the given world the front-most window." }
+{ $notes "To raise the window containing a specific gadget, use " { $link find-world } " to find the world containing the gadget first." } ;
+
+HELP: select-gl-context
+{ $values { "handle" "a backend-specific handle" } }
+{ $description "Selects an OpenGL context to be the implicit destination for subsequent GL rendering calls. This word is called automatically by the UI before drawing a " { $link world } "." } ;
+
+HELP: flush-gl-context
+{ $values { "handle" "a backend-specific handle" } }
+{ $description "Ensures all GL rendering calls made to an OpenGL context finish rendering to the screen. This word is called automatically by the UI after drawing a " { $link world } "." } ;
+
+HELP: focus-path
+{ $values { "world" world } { "seq" "a new sequence" } }
+{ $description "If the top-level window containing the world has focus, outputs a sequence of parents of the currently focused gadget, otherwise outputs " { $link f } "." }
+{ $notes "This word is used to avoid sending " { $link gain-focus } " gestures to a gadget which requests focus on an unfocused top-level window, so that, for instance, a text editing caret does not appear in this case." } ;
+
+HELP: world
+{ $class-description "A gadget which appears at the top of the gadget hieararchy, and in turn may be displayed in a native window. Worlds delegate to " { $link gadget } " instances and have the following slots:"
+    { $list
+        { { $link world-active? } " - if set to " { $link f } ", the world will not be drawn. This slot is set to " { $link f } " if an error is thrown while drawing the world; this prevents multiple debugger windows from being shown." }
+        { { $link world-glass } " - a glass pane in front of the primary gadget, used to implement behaviors such as popup menus which are hidden when the mouse is clicked outside the menu." }
+        { { $link world-title } " - a string to be displayed in the title bar of the native window containing the world." }
+        { { $link world-status } " - a " { $link model } " holding a string to be displayed in the world's status bar." }
+        { { $link world-focus } " - the current owner of the keyboard focus in the world." }
+        { { $link world-focused? } " - a boolean indicating if the native window containing the world has keyboard focus." }
+        { { $link world-fonts } " - a hashtable mapping " { $link font } " instances to vectors of " { $link sprite } " instances." }
+        { { $link world-handle } " - a backend-specific native handle representing the native window containing the world, or " { $link f } " if the world is not grafted." }
+        { { $link world-loc } " - the on-screen location of the native window containing the world. The co-ordinate system here is backend-specific." }
+    }
+} ;
+
+HELP: <world>
+{ $values { "gadget" gadget } { "title" string } { "status" model } { "world" "a new " { $link world } } }
+{ $description "Creates a new " { $link world } " delegating to the given gadget." } ;
+
+HELP: find-world
+{ $values { "gadget" gadget } { "world" "a " { $link world } " or " { $link f } } }
+{ $description "Finds the " { $link world } " containing the gadget, or outputs " { $link f } " if the gadget is not grafted." } ;
+
+HELP: draw-world
+{ $values { "rect" "a clipping rectangle" } { "world" world } }
+{ $description "Redraws a world." }
+{ $notes "This word should only be called by the UI backend. To force a gadget to redraw from user code, call " { $link relayout-1 } "." } ;
diff --git a/extra/ui/gadgets/worlds/worlds-tests.factor b/extra/ui/gadgets/worlds/worlds-tests.factor
new file mode 100644 (file)
index 0000000..949ad49
--- /dev/null
@@ -0,0 +1,68 @@
+IN: temporary
+USING: ui.gadgets ui.gadgets.packs ui.gadgets.worlds tools.test
+namespaces models kernel ;
+
+! Test focus behavior
+<gadget> "g1" set
+
+: <test-world> ( gadget -- world )
+    [ gadget, ] make-pile "Hi" f <world> ;
+
+[ ] [
+    "g1" get <test-world> "w" set
+] unit-test
+
+[ ] [ "g1" get request-focus ] unit-test
+
+[ t ] [ "w" get gadget-focus "g1" get eq? ] unit-test
+
+<gadget> "g1" set
+<gadget> "g2" set
+"g1" get "g2" get add-gadget
+
+[ ] [
+    "g2" get <test-world> "w" set
+] unit-test
+
+[ ] [ "g1" get request-focus ] unit-test
+
+[ t ] [ "w" get gadget-focus "g2" get eq? ] unit-test
+[ t ] [ "g2" get gadget-focus "g1" get eq? ] unit-test
+[ f ] [ "g1" get gadget-focus ] unit-test
+
+<gadget> "g1" set
+<gadget> "g2" set
+<gadget> "g3" set
+"g1" get "g3" get add-gadget
+"g2" get "g3" get add-gadget
+
+[ ] [
+    "g3" get <test-world> "w" set
+] unit-test
+
+[ ] [ "g1" get request-focus ] unit-test
+[ ] [ "g2" get unparent ] unit-test
+[ t ] [ "g3" get gadget-focus "g1" get eq? ] unit-test
+
+[ t ] [ <gadget> dup <test-world> focusable-child eq? ] unit-test
+
+TUPLE: focusing ;
+
+: <focusing>
+    focusing construct-gadget ;
+
+TUPLE: focus-test ;
+
+: <focus-test>
+    focus-test construct-gadget
+    <focusing> over add-gadget ;
+
+M: focus-test focusable-child* gadget-child ;
+
+<focus-test> "f" set
+
+[ ] [ "f" get <test-world> request-focus ] unit-test
+
+[ t ] [ "f" get gadget-focus "f" get gadget-child eq? ] unit-test
+
+[ t ] [ "f" get gadget-child focusing? ] unit-test
diff --git a/extra/ui/gadgets/worlds/worlds.factor b/extra/ui/gadgets/worlds/worlds.factor
new file mode 100644 (file)
index 0000000..324dd7d
--- /dev/null
@@ -0,0 +1,129 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs continuations kernel math models
+namespaces opengl sequences io combinators math.vectors
+ui.gadgets ui.gestures ui.render ui.backend inspector ;
+IN: ui.gadgets.worlds
+
+TUPLE: world
+active? focused?
+glass
+title status
+fonts handle
+loc ;
+
+: find-world [ world? ] find-parent ;
+
+M: f world-status ;
+
+: show-status ( string/f gadget -- )
+    find-world world-status [ set-model ] [ drop ] if* ;
+
+: show-summary ( object gadget -- )
+    >r [ summary ] [ "" ] if* r> show-status ;
+
+: hide-status ( gadget -- ) f swap show-status ;
+
+: (request-focus) ( child world ? -- )
+    pick gadget-parent pick eq? [
+        >r >r dup gadget-parent dup r> r>
+        [ (request-focus) ] keep
+    ] unless focus-child ;
+
+M: world request-focus-on ( child gadget -- )
+    2dup eq?
+    [ 2drop ] [ dup world-focused? (request-focus) ] if ;
+
+: <world> ( gadget title status -- world )
+    t H{ } clone { 0 0 } {
+        set-gadget-delegate
+        set-world-title
+        set-world-status
+        set-world-active?
+        set-world-fonts
+        set-world-loc
+    } world construct
+    t over set-gadget-root?
+    dup request-focus ;
+
+M: world equal? 2drop f ;
+
+M: world hashcode* drop world hashcode* ;
+
+M: world pref-dim*
+    delegate pref-dim* [ >fixnum ] map { 1024 768 } vmin ;
+
+M: world layout*
+    dup delegate layout*
+    dup world-glass [
+        >r dup rect-dim r> set-layout-dim
+    ] when* drop ;
+
+M: world focusable-child* gadget-child ;
+
+M: world children-on nip gadget-children ;
+
+: (draw-world) ( rect world -- )
+    dup world-handle [
+        [ init-gl ] keep draw-gadget
+    ] with-gl-context ;
+
+: draw-world? ( world -- ? )
+    #! We don't draw deactivated worlds, or those with 0 size.
+    #! On Windows, the latter case results in GL errors.
+    dup world-active?
+    over world-handle
+    rot rect-dim [ 0 > ] all? and and ;
+
+TUPLE: world-error world ;
+
+: <world-error> ( error world -- error )
+    { set-delegate set-world-error-world }
+    world-error construct ;
+
+SYMBOL: ui-error-hook
+
+: ui-error ( error -- ) ui-error-hook get call ;
+
+[ rethrow ] ui-error-hook set-global
+
+: draw-world ( rect world -- )
+    dup draw-world? [
+        dup world [
+            [
+                (draw-world)
+            ] [
+                over <world-error> ui-error
+                f swap set-world-active?
+                drop
+            ] recover
+        ] with-variable
+    ] [
+        2drop
+    ] if ;
+
+world H{
+    { T{ key-down f { C+ } "x" } [ T{ cut-action } send-action ] }
+    { T{ key-down f { C+ } "c" } [ T{ copy-action } send-action ] }
+    { T{ key-down f { C+ } "v" } [ T{ paste-action } send-action ] }
+    { T{ key-down f { C+ } "a" } [ T{ select-all-action } send-action ] }
+    { T{ button-down f { C+ } 1 } [ T{ button-down f f 3 } swap resend-button-down ] }
+    { T{ button-down f { A+ } 1 } [ T{ button-down f f 2 } swap resend-button-down ] }
+    { T{ button-up f { C+ } 1 } [ T{ button-up f f 3 } swap resend-button-up ] }
+    { T{ button-up f { A+ } 1 } [ T{ button-up f f 2 } swap resend-button-up ] }
+} set-gestures
+
+: start-world ( world -- )
+    dup graft
+    dup relayout
+    dup world-title over set-title
+    request-focus ;
+
+: close-global ( world global -- )
+    dup get-global find-world rot eq?
+    [ f swap set-global ] [ drop ] if ;
+
+: focus-gestures ( new old -- )
+    drop-prefix <reversed>
+    T{ lose-focus } swap each-gesture
+    T{ gain-focus } swap each-gesture ;
diff --git a/extra/ui/gestures/authors.txt b/extra/ui/gestures/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/gestures/gestures-docs.factor b/extra/ui/gestures/gestures-docs.factor
new file mode 100644 (file)
index 0000000..95f2e5b
--- /dev/null
@@ -0,0 +1,327 @@
+USING: ui.gadgets help.markup help.syntax hashtables
+strings kernel system ;
+IN: ui.gestures
+
+HELP: set-gestures
+{ $values { "class" "a class word" } { "hash" hashtable } }
+{ $description "Sets the gestures a gadget class responds to. The hashtable maps gestures to quotations with stack effect " { $snippet "( gadget -- )" } "." } ;
+
+HELP: handle-gesture*
+{ $values { "gadget" "the receiver of the gesture" } { "gesture" "a gesture" } { "delegate" "an object" } { "?" "a boolean" } }
+{ $contract "Handles a gesture sent to a gadget. As the delegation chain is traversed, this generic word is called with every delegate of the gadget at the top of the stack, however the front-most delegate remains fixed as the " { $snippet "gadget" } " parameter."
+$nl
+"Outputs " { $link f } " if the gesture was handled, and " { $link t } " if the gesture should be passed on to the gadget's delegate." }
+{ $notes "Methods should be defined on this word if you desire to handle an arbitrary set of gestures. To define handlers for a fixed set, it is easier to use " { $link set-gestures } "." } ;
+
+HELP: handle-gesture
+{ $values { "gesture" "a gesture" } { "gadget" gadget } { "?" "a boolean" } }
+{ $description "Calls " { $link handle-gesture* } " on every delegate of " { $snippet "gadget" } ". Outputs " { $link f } " if some delegate handled the gesture, else outputs " { $link t } "." } ;
+
+{ send-gesture handle-gesture handle-gesture* set-gestures } related-words
+
+HELP: send-gesture
+{ $values { "gesture" "a gesture" } { "gadget" gadget } { "?" "a boolean" } }
+{ $description "Calls " { $link send-gesture } " on every parent of " { $snippet "gadget" } ". Outputs " { $link f } " if some parent handled the gesture, else outputs " { $link t } "." } ;
+
+HELP: user-input
+{ $values { "str" string } { "gadget" gadget } }
+{ $description "Calls " { $link user-input* } " on every parent of the gadget." } ;
+
+HELP: motion
+{ $class-description "Mouse motion gesture." }
+{ $examples { $code "T{ motion }" } } ;
+
+HELP: drag
+{ $class-description "Mouse drag gesture. The " { $link drag-# } " slot is either set to a mouse button number, or " { $link f } " indicating no specific button is expected." } ;
+
+HELP: button-up
+{ $class-description "Mouse button up gesture. Instances have two slots:"
+    { $list
+        { { $link button-up-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
+        { { $link button-up-# } " - a mouse button number, or " { $link f } " indicating no specific button is expected" }
+    }
+}
+{ $examples { $code "T{ button-up f f 1 }" "T{ button-up }" } } ;
+
+HELP: button-down
+{ $class-description "Mouse button down gesture. Instances have two slots:"
+    { $list
+        { { $link button-down-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
+        { { $link button-down-# } " - a mouse button number, or " { $link f } " indicating no specific button is expected" }
+    }
+}
+{ $examples { $code "T{ button-down f f 1 }" "T{ button-down }" } } ;
+
+HELP: mouse-scroll
+{ $class-description "Scroll wheel motion gesture. When this gesture is sent, the " { $link scroll-direction } " global variable is set to a direction vector." }
+{ $examples { $code "T{ mouse-scroll }" } } ;
+
+HELP: mouse-enter
+{ $class-description "Gesture sent when the mouse enters the bounds of a gadget." }
+{ $examples { $code "T{ mouse-enter }" } } ;
+
+HELP: mouse-leave
+{ $class-description "Gesture sent when the mouse leaves the bounds of a gadget." }
+{ $examples { $code "T{ mouse-leave }" } } ;
+
+HELP: gain-focus
+{ $class-description "Gesture sent when a gadget gains keyboard focus." }
+{ $examples { $code "T{ gain-focus }" } } ;
+
+HELP: lose-focus
+{ $class-description "Gesture sent when a gadget loses keyboard focus." }
+{ $examples { $code "T{ lose-focus }" } } ;
+
+HELP: cut-action
+{ $class-description "Gesture sent when the " { $emphasis "cut" } " standard window system action is invoked." }
+{ $examples { $code "T{ cut-action }" } } ;
+
+HELP: copy-action
+{ $class-description "Gesture sent when the " { $emphasis "copy" } " standard window system action is invoked." }
+{ $examples { $code "T{ copy-action }" } } ;
+
+HELP: paste-action
+{ $class-description "Gesture sent when the " { $emphasis "paste" } " standard window system action is invoked." }
+{ $examples { $code "T{ paste-action }" } } ;
+
+HELP: delete-action
+{ $class-description "Gesture sent when the " { $emphasis "delete" } " standard window system action is invoked." }
+{ $examples { $code "T{ delete-action }" } } ;
+
+HELP: select-all-action
+{ $class-description "Gesture sent when the " { $emphasis "select all" } " standard window system action is invoked." }
+{ $examples { $code "T{ select-all-action }" } } ;
+
+HELP: generalize-gesture
+{ $values { "gesture" "a gesture" } { "newgesture" "a new gesture" } }
+{ $description "Turns a " { $link button-down } ", " { $link button-up } " or " { $link drag } " action naming a specific mouse button into one which can apply regardless of which mouse button was pressed." } ;
+
+HELP: C+
+{ $description "Control key modifier." } ;
+
+HELP: A+
+{ $description "Alt key modifier." } ;
+
+HELP: M+
+{ $description "Meta key modifier. This is the Command key on Mac OS X." } ;
+
+HELP: S+
+{ $description "Shift key modifier." } ;
+
+HELP: key-down
+{ $class-description "Key down gesture. Instances have two slots:"
+    { $list
+        { { $link key-down-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
+    { { $link key-down-sym } " - a string denoting the key pressed; see " { $link "keyboard-gestures" } }
+    }
+}
+{ $examples { $code "T{ key-down f { C+ } \"a\" }" "T{ key-down f f \"TAB\" }" } } ;
+
+HELP: key-up
+{ $class-description "Key up gesture. Instances have two slots:"
+    { $list
+        { { $link key-up-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
+    { { $link key-up-sym } " - a string denoting the key pressed; see " { $link "keyboard-gestures" } }
+    }
+}
+{ $examples { $code "T{ key-up f { C+ } \"a\" }" "T{ key-up f f \"TAB\" }" } } ;
+
+HELP: hand-gadget
+{ $var-description "Global variable. The gadget at the mouse location." } ;
+
+HELP: hand-loc
+{ $var-description "Global variable. The mouse location relative to the top-left corner of the " { $link hand-world } "." } ;
+
+{ hand-loc hand-rel } related-words
+
+HELP: hand-clicked
+{ $var-description "Global variable. The gadget at the location of the most recent click." } ;
+
+HELP: hand-click-loc
+{ $var-description "Global variable. The mouse location at the time of the most recent click relative to the top-left corner of the " { $link hand-world } "." } ;
+
+{ hand-clicked hand-click-loc } related-words
+
+HELP: hand-click#
+{ $var-description "Global variable. The number of times the mouse was clicked in short succession. This counter is reset when " { $link double-click-timeout } " expires." } ;
+
+HELP: hand-last-button
+{ $var-description "Global variable. The mouse button most recently pressed." } ;
+
+HELP: hand-last-time
+{ $var-description "Global variable. The timestamp of the most recent mouse button click. This timestamp has the same format as the output value of " { $link millis } "." } ;
+
+HELP: hand-buttons
+{ $var-description "Global variable. A vector of mouse buttons currently held down." } ;
+
+HELP: scroll-direction
+{ $var-description "Global variable. If the most recent gesture was a " { $link mouse-scroll } ", this holds a pair of integers indicating the direction of the scrolling as a two-dimensional vector." } ;
+
+HELP: double-click-timeout
+{ $var-description "Global variable. The maximum delay between two button presses which will still increment " { $link hand-click# } "." } ;
+
+HELP: button-gesture
+{ $values { "gesture" "a gesture" } }
+{ $description "Sends a gesture to the most recently clicked gadget, and if the gadget does not respond to the gesture, removes specific button number information from the gesture and sends it again." } ;
+
+HELP: fire-motion
+{ $description "Sends a " { $link motion } " or " { $link drag } " gesture to the gadget under the mouse, depending on whether a mouse button is being held down or not." } ;
+
+HELP: forget-rollover
+{ $description "Sends " { $link mouse-leave } " gestures to all gadgets containing the gadget under the mouse, and resets the " { $link hand-gadget } " variable." } ;
+
+HELP: request-focus
+{ $values { "gadget" gadget } }
+{ $description "Gives keyboard focus to the " { $link focusable-child } " of the gadget. This may result in " { $link lose-focus } " and " { $link gain-focus } " gestures being sent." } ;
+
+HELP: drag-loc
+{ $values { "loc" "a pair of integers" } }
+{ $description "Outputs the distance travelled by the mouse since the most recent press. Only meaningful inside a " { $link drag } " gesture handler." } ;
+
+HELP: hand-rel
+{ $values { "gadget" gadget } { "loc" "a pair of integers" } }
+{ $description "Outputs the location of the mouse relative to the top-left corner of the gadget. Only meaningful inside a " { $link button-down } ", " { $link button-up } ", " { $link motion } " or " { $link drag } " gesture handler, where the gadget is contained in the same world as the gadget receiving the gesture." } ;
+
+HELP: hand-click-rel
+{ $values { "gadget" gadget } { "loc" "a pair of integers" } }
+{ $description "Outputs the location of the last mouse relative to the top-left corner of the gadget. Only meaningful inside a " { $link button-down } ", " { $link button-up } ", " { $link motion } " or " { $link drag } " gesture handler, where the gadget is contained in the same world as the gadget receiving the gesture." } ;
+
+HELP: under-hand
+{ $values { "seq" "a new sequence" } }
+{ $description "Outputs a sequence where the first element is the " { $link hand-world } " and the last is the " { $link hand-gadget } ", with all parents in between." } ;
+
+HELP: gesture>string
+{ $values { "gesture" "a gesture" } { "string/f" "a " { $link string } " or " { $link f } } }
+{ $contract "Creates a human-readable string from a gesture object, returning " { $link f } " if the gesture does not have a human-readable form." }
+{ $examples
+    { $example "USE: ui.gestures" "T{ key-down f { C+ } \"x\" } gesture>string print" "C+x" }
+} ;
+
+ARTICLE: "ui-gestures" "UI gestures"
+"User actions such as keyboard input and mouse button clicks deliver " { $emphasis "gestures" } " to gadgets. If the direct receiver of the gesture does not handle it, the gesture is passed on to the receiver's parent, and this way it travels up the gadget hierarchy. Gestures which are not handled at some point are ignored."
+$nl
+"There are two ways to define gesture handling logic. The simplest way is to associate a fixed set of gestures with a class:"
+{ $subsection set-gestures }
+"Another way is to define a generic word on a class which handles all gestures sent to gadgets of that class:"
+{ $subsection handle-gesture* }
+"Sometimes a gesture needs to be presented to the user:"
+{ $subsection gesture>string }
+"Keyboard input:"
+{ $subsection "ui-focus" }
+{ $subsection "keyboard-gestures" }
+{ $subsection "action-gestures" }
+{ $subsection "ui-user-input" }
+"Mouse input:"
+{ $subsection "mouse-gestures" }
+"Abstractions built on top of gestures:"
+{ $subsection "ui-commands" }
+{ $subsection "ui-operations" } ;
+
+ARTICLE: "ui-focus" "Keyboard focus"
+"The gadget with keyboard focus is the current receiver of keyboard gestures and user input. Gadgets that wish to receive keyboard input should request focus when clicked:"
+{ $subsection request-focus }
+"The following example demonstrates defining a handler for a mouse click gesture which requests focus:"
+{ $code
+    "my-gadget H{"
+    "    { T{ button-down } [ request-focus ] }"
+    "} set-gestures"
+}
+"To nominate a single child as the default focusable child, implement a method on a generic word:"
+{ $subsection focusable-child* }
+"Gestures are sent to a gadget when it gains or loses focus; this can be used to change the gadget's appearance, for example by displaying a border:"
+{ $subsection gain-focus }
+{ $subsection lose-focus } ;
+
+ARTICLE: "keyboard-gestures" "Keyboard gestures"
+"There are two types of keyboard gestures:"
+{ $subsection key-down }
+{ $subsection key-up }
+"Each keyboard gesture has a set of modifiers and a key symbol. The set modifiers is denoted by an array which must either be " { $link f } ", or an order-preserving subsequence of the following:"
+{ $code "{ S+ C+ A+ M+ }" }
+{ $subsection S+ }
+{ $subsection C+ }
+{ $subsection A+ }
+{ $subsection M+ }
+"A key symbol is either a single-character string denoting literal input, or one of the following strings:"
+{ $list
+  { $snippet "CLEAR" }
+  { $snippet "RET" }
+  { $snippet "ENTER" }
+  { $snippet "ESC" }
+  { $snippet "TAB" }
+  { $snippet "BACKSPACE" }
+  { $snippet "HOME" }
+  { $snippet "DELETE" }
+  { $snippet "END" }
+  { $snippet "F1" }
+  { $snippet "F2" }
+  { $snippet "F3" }
+  { $snippet "F4" }
+  { $snippet "F5" }
+  { $snippet "F6" }
+  { $snippet "F7" }
+  { $snippet "F8" }
+  { $snippet "LEFT" }
+  { $snippet "RIGHT" }
+  { $snippet "DOWN" }
+  { $snippet "UP" }
+  { $snippet "PAGE_UP" }
+  { $snippet "PAGE_DOWN" }
+}
+"The " { $link S+ } " modifier is only ever used with the above action keys; alphanumeric input input with the shift key is delivered without the " { $link S+ } " modifier set, instead the input itself is upper case. For example, the gesture corresponding to " { $snippet "s" } " with the Control and Shift keys pressed is presented as "
+{ $code "T{ key-down f { C+ } \"S\" }" }
+"The " { $snippet "RET" } ", " { $snippet "TAB" } " and " { $snippet "SPACE" } " keys are never delivered in their literal form (" { $snippet "\"\\n\"" } ", " { $snippet "\"\\t\"" } " or "  { $snippet "\" \"" } ")." ;
+
+ARTICLE: "ui-user-input" "Free-form keyboard input"
+"Whereas keyboard gestures are intended to be used for keyboard shortcuts, certain gadgets such as text fields need to accept free-form keyboard input. This can be done by implementing a generic word:"
+{ $subsection user-input* } ;
+
+ARTICLE: "mouse-gestures" "Mouse gestures"
+"There are two types of mouse gestures indicating button clicks:"
+{ $subsection button-down }
+{ $subsection button-up }
+"When a mouse button is pressed or released, two gestures are sent. The first gesture indicates the specific button number, and if this gesture is not handled, the second has a button number set to " { $link f } ":"
+{ $code "T{ button-down f 1 }" "T{ button-down f f }" }
+"Because tuple literals fill unspecified slots with " { $link f } ", the last gesture can be written as " { $snippet "T{ button-down }" } "."
+$nl
+"Gestures to indicate mouse motion, depending on whenever a button is held down or not:"
+{ $subsection motion }
+{ $subsection drag }
+"Gestures to indicate that the mouse has crossed gadget boundaries:"
+{ $subsection mouse-enter }
+{ $subsection mouse-leave }
+"A number of global variables are set after a mouse gesture is sent. These variables can be read to obtain additional information about the gesture."
+{ $subsection hand-gadget }
+{ $subsection hand-world }
+{ $subsection hand-loc }
+{ $subsection hand-buttons }
+{ $subsection hand-clicked }
+{ $subsection hand-click-loc }
+{ $subsection hand-click# }
+"There are some utility words for working with click locations:"
+{ $subsection hand-rel }
+{ $subsection hand-click-rel }
+{ $subsection drag-loc }
+"Mouse scroll wheel gesture:"
+{ $subsection mouse-scroll }
+"Global variable set when a mouse scroll wheel gesture is sent:"
+{ $subsection scroll-direction } ;
+
+ARTICLE: "action-gestures" "Action gestures"
+"Action gestures exist to keep keyboard shortcuts for common clipboard operations consistent."
+{ $subsection cut-action }
+{ $subsection copy-action }
+{ $subsection paste-action }
+{ $subsection delete-action }
+{ $subsection select-all-action }
+"The following keyboard gestures, if not handled directly, send action gestures:"
+{ $table
+    { { $strong "Keyboard gesture" } { $strong "Action gesture" } }
+    { { $snippet "T{ key-down f { C+ } \"x\" }" } { $snippet "T{ cut-action }" } }
+    { { $snippet "T{ key-down f { C+ } \"c\" }" } { $snippet "T{ copy-action }" } }
+    { { $snippet "T{ key-down f { C+ } \"v\" }" } { $snippet "T{ paste-action }" } }
+    { { $snippet "T{ key-down f { C+ } \"a\" }" } { $snippet "T{ select-all }" } }
+}
+"Action gestures should be used in place of the above keyboard gestures if possible. For example, on Mac OS X, the standard " { $strong "Edit" } " menu items send action gestures." ;
+
+ABOUT: "ui-gestures"
diff --git a/extra/ui/gestures/gestures.factor b/extra/ui/gestures/gestures.factor
new file mode 100644 (file)
index 0000000..c7b4455
--- /dev/null
@@ -0,0 +1,262 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs kernel math models namespaces queues
+sequences words strings system hashtables math.parser
+math.vectors tuples classes ui.gadgets timers ;
+IN: ui.gestures
+
+: set-gestures ( class hash -- ) "gestures" set-word-prop ;
+
+GENERIC: handle-gesture* ( gadget gesture delegate -- ? )
+
+: default-gesture-handler ( gadget gesture delegate -- ? )
+    class "gestures" word-prop at dup
+    [ call f ] [ 2drop t ] if ;
+
+M: object handle-gesture* default-gesture-handler ;
+
+: handle-gesture ( gesture gadget -- ? )
+    tuck delegates [ >r 2dup r> handle-gesture* ] all? 2nip ;
+
+: send-gesture ( gesture gadget -- ? )
+    [ dupd handle-gesture ] each-parent nip ;
+
+: user-input ( str gadget -- )
+    over empty?
+    [ [ dupd user-input* ] each-parent ] unless
+    2drop ;
+
+! Gesture objects
+TUPLE: motion ;             C: <motion> motion
+TUPLE: drag # ;             C: <drag> drag
+TUPLE: button-up mods # ;   C: <button-up> button-up
+TUPLE: button-down mods # ; C: <button-down> button-down
+TUPLE: mouse-scroll ;       C: <mouse-scroll> mouse-scroll
+TUPLE: mouse-enter ;        C: <mouse-enter> mouse-enter
+TUPLE: mouse-leave ;        C: <mouse-leave> mouse-leave
+TUPLE: lose-focus ;         C: <lose-focus> lose-focus
+TUPLE: gain-focus ;         C: <gain-focus> gain-focus
+
+! Higher-level actions
+TUPLE: cut-action ;        C: <cut-action> cut-action
+TUPLE: copy-action ;       C: <copy-action> copy-action
+TUPLE: paste-action ;      C: <paste-action> paste-action
+TUPLE: delete-action ;     C: <delete-action> delete-action
+TUPLE: select-all-action ; C: <select-all-action> select-all-action
+
+: generalize-gesture ( gesture -- newgesture )
+    tuple>array 1 head* >tuple ;
+
+! Modifiers
+SYMBOL: C+
+SYMBOL: A+
+SYMBOL: M+
+SYMBOL: S+
+
+TUPLE: key-down mods sym ;
+
+: <key-gesture> ( mods sym action? class -- mods' sym' )
+    >r [ S+ rot remove swap ] unless r> construct-boa ; inline
+
+: <key-down> ( mods sym action? -- key-down )
+    key-down <key-gesture> ;
+
+TUPLE: key-up mods sym ;
+
+: <key-up> ( mods sym action? -- key-up )
+    key-up <key-gesture> ;
+
+! Hand state
+
+! Note that these are only really useful inside an event
+! handler, and that the locations hand-loc and hand-click-loc
+! are in the co-ordinate system of the world which contains
+! the gadget in question.
+SYMBOL: hand-gadget
+SYMBOL: hand-world
+SYMBOL: hand-loc
+{ 0 0 } hand-loc set-global
+
+SYMBOL: hand-clicked
+SYMBOL: hand-click-loc
+SYMBOL: hand-click#
+SYMBOL: hand-last-button
+SYMBOL: hand-last-time
+0 hand-last-button set-global
+0 hand-last-time set-global
+
+SYMBOL: hand-buttons
+V{ } clone hand-buttons set-global
+
+SYMBOL: scroll-direction
+{ 0 0 } scroll-direction set-global
+
+SYMBOL: double-click-timeout
+300 double-click-timeout set-global
+
+: hand-moved? ( -- ? )
+    hand-loc get hand-click-loc get = not ;
+
+: button-gesture ( gesture -- )
+    hand-clicked get-global 2dup send-gesture [
+        >r generalize-gesture r> send-gesture drop
+    ] [
+        2drop
+    ] if ;
+
+: drag-gesture ( -- )
+    hand-buttons get-global first <drag> button-gesture ;
+
+TUPLE: drag-timer ;
+
+M: drag-timer tick drop drag-gesture ;
+
+drag-timer construct-empty drag-timer set-global
+
+: start-drag-timer ( -- )
+    hand-buttons get-global empty? [
+        drag-timer get-global 100 100 add-timer
+    ] when ;
+
+: stop-drag-timer ( -- )
+    hand-buttons get-global empty? [
+        drag-timer get-global remove-timer
+    ] when ;
+
+: fire-motion ( -- )
+    hand-buttons get-global empty? [
+        T{ motion } hand-gadget get-global send-gesture drop
+    ] [
+        drag-gesture
+    ] if ;
+
+: each-gesture ( gesture seq -- )
+    [ handle-gesture drop ] curry* each ;
+
+: hand-gestures ( new old -- )
+    drop-prefix <reversed>
+    T{ mouse-leave } swap each-gesture
+    T{ mouse-enter } swap each-gesture ;
+
+: forget-rollover ( -- )
+    f hand-world set-global
+    hand-gadget get-global >r
+    f hand-gadget set-global
+    f r> parents hand-gestures ;
+
+: send-lose-focus ( gadget -- )
+    T{ lose-focus } swap handle-gesture drop ;
+
+: send-gain-focus ( gadget -- )
+    T{ gain-focus } swap handle-gesture drop ;
+
+: focus-child ( child gadget ? -- )
+    [
+        dup gadget-focus [
+            dup send-lose-focus
+            f swap t focus-child
+        ] when*
+        dupd set-gadget-focus [
+            send-gain-focus
+        ] when*
+    ] [
+        set-gadget-focus
+    ] if ;
+
+: modifier ( mod modifiers -- seq )
+    [ second swap bitand 0 > ] curry* subset
+    0 <column> prune dup empty? [ drop f ] [ >array ] if ;
+
+: drag-loc ( -- loc )
+    hand-loc get-global hand-click-loc get-global v- ;
+
+: hand-rel ( gadget -- loc )
+    hand-loc get-global swap screen-loc v- ;
+
+: hand-click-rel ( gadget -- loc )
+    hand-click-loc get-global swap screen-loc v- ;
+
+: multi-click? ( button -- ? )
+    millis hand-last-time get - double-click-timeout get <=
+    swap hand-last-button get = and ;
+
+: update-click# ( button -- )
+    global [
+        dup multi-click? [
+            hand-click# inc
+        ] [
+            1 hand-click# set
+        ] if
+        hand-last-button set
+        millis hand-last-time set
+    ] bind ;
+
+: update-clicked ( -- )
+    hand-gadget get-global hand-clicked set-global
+    hand-loc get-global hand-click-loc set-global ;
+
+: under-hand ( -- seq )
+    hand-gadget get-global parents <reversed> ;
+
+: move-hand ( loc world -- )
+    dup hand-world set-global
+    under-hand >r over hand-loc set-global
+    pick-up hand-gadget set-global
+    under-hand r> hand-gestures ;
+
+: send-button-down ( gesture loc world -- )
+    move-hand
+    start-drag-timer
+    dup button-down-#
+    dup update-click# hand-buttons get-global push
+    update-clicked
+    button-gesture ;
+
+: send-button-up ( gesture loc world -- )
+    move-hand
+    dup button-up-# hand-buttons get-global delete
+    stop-drag-timer
+    button-gesture ;
+
+: send-wheel ( direction loc world -- )
+    move-hand
+    scroll-direction set-global
+    T{ mouse-scroll } hand-gadget get-global send-gesture
+    drop ;
+
+: world-focus ( world -- gadget )
+    dup gadget-focus [ world-focus ] [ ] ?if ;
+
+: send-action ( world gesture -- )
+    swap world-focus send-gesture drop ;
+
+: resend-button-down ( gesture world -- )
+    hand-loc get-global swap send-button-down ;
+
+: resend-button-up  ( gesture world -- )
+    hand-loc get-global swap send-button-up ;
+
+GENERIC: gesture>string ( gesture -- string/f )
+
+: modifiers>string ( modifiers -- string )
+    [ word-name ] map concat >string ;
+
+M: key-down gesture>string
+    dup key-down-mods modifiers>string
+    swap key-down-sym append ;
+
+M: button-up gesture>string
+    [
+        dup button-up-mods modifiers>string %
+        "Click Button" %
+        button-up-# [ " " % # ] when*
+    ] "" make ;
+
+M: button-down gesture>string
+    [
+        dup button-down-mods modifiers>string %
+        "Press Button" %
+        button-down-# [ " " % # ] when*
+    ] "" make ;
+
+M: object gesture>string drop f ;
diff --git a/extra/ui/gestures/summary.txt b/extra/ui/gestures/summary.txt
new file mode 100644 (file)
index 0000000..62daae1
--- /dev/null
@@ -0,0 +1 @@
+Translating window system events to gestures, and delivering gestures to gadgets
diff --git a/extra/ui/operations/authors.txt b/extra/ui/operations/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/operations/operations-docs.factor b/extra/ui/operations/operations-docs.factor
new file mode 100644 (file)
index 0000000..5f7ed60
--- /dev/null
@@ -0,0 +1,86 @@
+USING: ui.commands help.markup help.syntax ui.gadgets words
+kernel hashtables strings classes quotations sequences
+ui.gestures ;
+IN: ui.operations
+
+: $operations ( element -- )
+    >quotation call
+    f f operations>commands
+    command-map. ;
+
+: $operation ( element -- )
+    first +keyboard+ word-prop gesture>string $snippet ;
+
+HELP: +keyboard+
+{ $description "A key which may be set in the hashtable passed to " { $link define-operation } ". The value is a gesture." } ;
+
+HELP: +primary+
+{ $description "A key which may be set in the hashtable passed to " { $link define-operation } ". If set to a true value, this operation becomes the default operation performed when a presentation matching the operation's predicate is clicked with the mouse." } ;
+
+HELP: operation
+{ $description "An abstraction for an operation which may be performed on a presentation."
+$nl
+"Operations have the following slots:"
+{ $list
+    { { $link operation-predicate } " - a quotation with stack effect " { $snippet "( obj -- ? )" } }
+    { { $link operation-command } " - a " { $link word } }
+    { { $link operation-translator } " - a quotation with stack effect " { $snippet "( obj -- newobj )" } ", or " { $link f } }
+    { { $link operation-hook } " - a quotation with stack effect " { $snippet "( obj -- newobj )" } ", or " { $link f } }
+    { { $link operation-listener? } " - a boolean" }
+} } ;
+
+HELP: operation-gesture
+{ $values { "operation" operation } { "gesture" "a gesture or " { $link f } } }
+{ $description "Outputs the keyboard gesture associated with the operation." } ;
+
+HELP: operations
+{ $var-description "Global variable holding a vector of " { $link operation } " instances. New operations can be added with " { $link define-operation } "." } ;
+
+HELP: object-operations
+{ $values { "obj" object } { "operations" "a sequence of " { $link operation } " instances" } }
+{ $description "Outputs a sequence of operations applicable to the given object, by testing each defined operation's " { $link operation-predicate } " quotation in turn." } ;
+
+HELP: primary-operation
+{ $values { "obj" object } { "operation" "an " { $link operation  } " or " { $link f } } }
+{ $description "Outputs the operation which should be invoked when a presentation of " { $snippet "obj" } " is clicked." } ;
+
+HELP: secondary-operation
+{ $values { "obj" object } { "operation" "an " { $link operation  } " or " { $link f } } }
+{ $description "Outputs the operation which should be invoked when a " { $snippet "RET" } " is pressed while a presentation of " { $snippet "obj" } " is selected in a list." } ;
+
+HELP: define-operation
+{ $values { "pred" "a quotation with stack effect " { $snippet "( obj -- ? )" } } { "command" word } { "flags" hashtable } }
+{ $description "Defines an operation on objects matching the predicate. The hashtable can contain the following keys:"
+    { $list
+        { { $link +listener+ } " - if set to a true value, the operation will run in the listener" }
+        { { $link +description+ } " - can be set to a string description of the operation" }
+        { { $link +primary+ } " - if set to a true value, the operation will be output by " { $link primary-operation } " when applied to an object satisfying the predicate" }
+        { { $link +secondary+ } " - if set to a true value, the operation will be output by " { $link secondary-operation } " when applied to an object satisfying the predicate" }
+        { { $link +keyboard+ } " - can be set to a keyboard gesture; the guesture will be used by " { $link define-operation-map } }
+    }
+} ;
+
+HELP: define-operation-map
+{ $values { "class" "a class word" } { "group" string } { "blurb" "a " { $link string } " or " { $link f } } { "object" object } { "hook" "a quotation with stack effect " { $snippet "( obj -- newobj )" } ", or " { $link f } } { "translator" "a quotation with stack effect " { $snippet "( obj -- newobj )" } ", or " { $link f } } }
+{ $description "Defines a command map named " { $snippet "group" } " on " { $snippet "class" } " consisting of operations applicable to " { $snippet "object" } ". The hook quotation is applied to the target gadget; the translator quotation is applied to the result of the hook. Finally the result of the translator is passed to the operation. A distinction is drawn between the hook and the translator because for listener operations, the hook runs in the event loop and the translator runs in the listener. This avoids polluting the listener output with large prettyprinted gadgets and long quotations." } ;
+
+HELP: $operations
+{ $values { "element" "a sequence" } }
+{ $description "Converts the element to a quotation and calls it; the resulting quotation must have stack effect " { $snippet "( -- obj )" } ". Prints a list of operations applicable to the object, together with keyboard shortcuts." } ;
+
+HELP: $operation
+{ $values { "element" "a sequence containing a single word" } }
+{ $description "Prints the keyboard shortcut associated with the word, which must have been previously defined as an operation by a call to " { $link define-operation } "." } ;
+
+ARTICLE: "ui-operations" "Operations"
+"Operations are commands performed on presentations."
+{ $subsection operation }
+{ $subsection define-operation }
+{ $subsection primary-operation }
+{ $subsection secondary-operation }
+{ $subsection define-operation-map }
+"When documenting gadgets, operation documentation can be automatically generated:"
+{ $subsection $operations }
+{ $subsection $operation } ;
+
+ABOUT: "ui-operations"
diff --git a/extra/ui/operations/operations-tests.factor b/extra/ui/operations/operations-tests.factor
new file mode 100644 (file)
index 0000000..fcb6af0
--- /dev/null
@@ -0,0 +1,28 @@
+IN: temporary
+USING: ui.operations ui.commands prettyprint kernel namespaces
+tools.test ui.gadgets ui.gadgets.editors parser io
+io.streams.string math help help.markup ;
+
+: my-pprint pprint ;
+
+[ drop t ] \ my-pprint [ ] [ ] f operation construct-boa "op" set
+
+[ [ 3 my-pprint ] ] [
+    3 "op" get operation-command command-quot
+] unit-test
+
+[ "3" ] [ [ 3 "op" get invoke-command ] string-out ] unit-test
+
+[ drop t ] \ my-pprint [ parse ] [ editor-string ] f operation construct-boa
+"op" set
+
+[ "[ 4 ]" ] [
+    [
+        "4" <editor> [ set-editor-string ] keep
+        "op" get invoke-command
+    ] string-out
+] unit-test
+
+[ ] [
+    [ { $operations \ + } print-element ] string-out drop
+] unit-test
diff --git a/extra/ui/operations/operations.factor b/extra/ui/operations/operations.factor
new file mode 100644 (file)
index 0000000..0cc69d0
--- /dev/null
@@ -0,0 +1,85 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays definitions kernel ui.commands ui.gestures
+sequences strings math words generic namespaces hashtables
+help.markup quotations assocs ;
+IN: ui.operations
+
+SYMBOL: +keyboard+
+SYMBOL: +primary+
+SYMBOL: +secondary+
+
+TUPLE: operation predicate command translator hook listener? ;
+
+: <operation> ( predicate command -- operation )
+    [ ] [ ] {
+        set-operation-predicate
+        set-operation-command
+        set-operation-translator
+        set-operation-hook
+    } operation construct ;
+
+PREDICATE: operation listener-operation
+    dup operation-command listener-command?
+    swap operation-listener? or ;
+
+M: operation command-name
+    operation-command command-name ;
+
+M: operation command-description
+    operation-command command-description ;
+
+M: operation command-word operation-command command-word ;
+
+: operation-gesture ( operation -- gesture )
+    operation-command +keyboard+ word-prop ;
+
+SYMBOL: operations
+
+: object-operations ( obj -- operations )
+    operations get [ operation-predicate call ] curry* subset ;
+
+: find-operation ( obj quot -- command )
+    >r object-operations r> find-last nip ; inline
+
+: primary-operation ( obj -- operation )
+    [ operation-command +primary+ word-prop ] find-operation ;
+
+: secondary-operation ( obj -- operation )
+    dup
+    [ operation-command +secondary+ word-prop ] find-operation
+    [ ] [ primary-operation ] ?if ;
+
+: default-flags ( -- assoc )
+    H{ { +keyboard+ f } { +primary+ f } { +secondary+ f } } ;
+
+: define-operation ( pred command flags -- )
+    default-flags swap union
+    dupd define-command <operation>
+    operations get push ;
+
+: modify-operation ( hook translator operation -- operation )
+    clone
+    tuck set-operation-translator
+    tuck set-operation-hook
+    t over set-operation-listener? ;
+
+: modify-operations ( operations hook translator -- operations )
+    rot [ >r 2dup r> modify-operation ] map 2nip ;
+
+: operations>commands ( object hook translator -- pairs )
+    >r >r object-operations r> r> modify-operations
+    [ [ operation-gesture ] keep ] { } map>assoc ;
+
+: define-operation-map ( class group blurb object hook translator -- )
+    operations>commands define-command-map ;
+
+: operation-quot ( target command -- quot )
+    [
+        swap literalize ,
+        dup operation-translator %
+        operation-command ,
+    ] [ ] make ;
+
+M: operation invoke-command ( target command -- )
+    [ operation-hook call ] keep operation-quot call ;
diff --git a/extra/ui/operations/summary.txt b/extra/ui/operations/summary.txt
new file mode 100644 (file)
index 0000000..69130c9
--- /dev/null
@@ -0,0 +1 @@
+Operations are commands which may be performed on a presentation's underlying object
diff --git a/extra/ui/render/authors.txt b/extra/ui/render/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/render/render-docs.factor b/extra/ui/render/render-docs.factor
new file mode 100644 (file)
index 0000000..b0479c7
--- /dev/null
@@ -0,0 +1,150 @@
+USING: ui.gadgets ui.gestures help.markup help.syntax
+kernel classes strings opengl.gl ;
+IN: ui.render
+
+HELP: gadget
+{ $class-description "An object which displays itself on the screen and acts on user input gestures. Gadgets have the following slots:"
+    { $list
+        { { $link gadget-pref-dim } " - a cached value for " { $link pref-dim } "; do not read or write this slot directly." }
+        { { $link gadget-parent } " - the gadget containing this one, or " { $link f } " if this gadget is not part of the visible gadget hierarchy." }
+        { { $link gadget-children } " - a vector of child gadgets. Do not modify this vector directly, instead use " { $link add-gadget } ", " { $link add-gadgets } ", " { $link unparent } " or " { $link clear-gadget } "." }
+        { { $link gadget-orientation } " - an orientation specifier. This slot is used by layout gadgets." }
+        { { $link gadget-state } " - stores the layout state of the gadget. Do not read or write this slot directly, instead call " { $link relayout } " and " { $link relayout-1 } " if the gadget needs to be re-laid out." }
+        { { $link gadget-visible? } " - a boolean indicating if the gadget should display and receive user input." }
+        { { $link gadget-root? } " - if set to " { $link t } ", layout changes in this gadget will not propagate to the gadget's parent." }
+        { { $link gadget-clipped? } " - a boolean indicating if clipping will be enabled when drawing this gadget's children." }
+        { { $link gadget-grafted? } " - if set to " { $link t } ", the gadget is parented in a native window." }
+        { { $link gadget-interior } " - an object whose class implements the " { $link draw-interior } " generic word." }
+        { { $link gadget-boundary } " - an object whose class implements the " { $link draw-boundary } " generic word." }
+    }
+"Gadgets delegate to " { $link rect } " instances holding their location and dimensions." }
+{ $notes
+"Other classes may delegate to " { $link gadget } " in order to re-implement generic words such as " { $link draw-gadget* } " and " { $link user-input* } ", or to define gestures with " { $link set-gestures } "." }
+{ $warning
+"When setting a tuple's delegate to be a gadget, " { $link set-gadget-delegate } " should be used instead of " { $link set-delegate } "." } ;
+
+HELP: clip
+{ $var-description "The current clipping rectangle." } ;
+
+HELP: draw-gadget*
+{ $values { "gadget" gadget } } 
+{ $contract "Draws the gadget by making OpenGL calls. The top-left corner of the gadget should be drawn at the location stored in the " { $link origin } " variable." }
+{ $notes "This word should not be called directly. To force a gadget to redraw, call " { $link relayout-1 } "." } ;
+
+HELP: draw-interior
+{ $values { "interior" object } { "gadget" gadget } } 
+{ $contract "Draws the interior of a gadget by making OpenGL calls. The " { $link gadget-interior } " slot may be set to objects implementing this generic word." } ;
+
+HELP: draw-boundary
+{ $values { "boundary" object } { "gadget" gadget } } 
+{ $contract "Draws the boundary of a gadget by making OpenGL calls. The " { $link gadget-boundary } " slot may be set to objects implementing this generic word." } ;
+
+HELP: solid
+{ $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " generic words to draw a solid outline or a solid fill, respectively. The " { $link solid-color } " slot stores a color specifier." } ;
+
+HELP: gradient
+{ $class-description "A class implementing the " { $link draw-interior } " generic word to draw a smoothly shaded transition between colors. The " { $link gradient-colors } " slot stores a sequence of color specifiers and the gradient is drawn in the direction given by the " { $link gadget-orientation } " slot of the gadget." } ;
+
+HELP: polygon
+{ $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " generic words to draw a solid outline or a solid filled polygon, respectively. Instances of " { $link polygon } " have two slots:"
+    { $list
+        { { $link polygon-color } " - a color specifier" }
+        { { $link polygon-points } " - a sequence of points" }
+    }
+} ;
+
+HELP: <polygon>
+{ $values { "color" "a color specifier" } { "points" "a sequence of points" } }
+{ $description "Creates a new instance of " { $link polygon } "." } ;
+
+HELP: <polygon-gadget>
+{ $values { "color" "a color specifier" } { "points" "a sequence of points" } { "gadget" "a new " { $link gadget } } }
+{ $description "Creates a gadget which is drawn as a solid filled polygon. The gadget's size is the minimum bounding box containing all the points of the polygon." } ;
+
+HELP: open-font
+{ $values { "font" "a font specifier" } { "open-font" object } }
+{ $description "Loads a font if it has not already been loaded, otherwise outputs the existing font." }
+{ $errors "Throws an error if the font does not exist." } ;
+
+HELP: string-width
+{ $values { "open-font" "a value output by " { $link open-font } } { "string" string } { "w" "a positive integer" } }
+{ $description "Outputs the width of a string." } ;
+
+HELP: text-dim
+{ $values { "open-font" "a value output by " { $link open-font } } { "text" "a string or an array of strings" } { "dim" "a pair of integers" } }
+{ $description "Outputs the dimensions of a piece of text, which is either a single-line string or an array of lines." } ;
+
+HELP: draw-string
+{ $values { "font" "a font specifier" } { "string" string } { "loc" "a pair of integers" } }
+{ $description "Draws a line of text." } ;
+
+HELP: draw-text
+{ $values { "font" "a font specifier" } { "text" "a string or an array of strings" } { "loc" "a pair of integers" } }
+{ $description "Draws text. Text is either a single-line string or an array of lines." } ;
+
+ARTICLE: "gadgets-polygons" "Polygon gadgets"
+"A polygon gadget renders a simple shaded polygon."
+{ $subsection <polygon-gadget> }
+"Some pre-made polygons:"
+{ $subsection arrow-up }
+{ $subsection arrow-right }
+{ $subsection arrow-down }
+{ $subsection arrow-left }
+{ $subsection close-box }
+"Polygon gadgets are rendered by the " { $link polygon } " pen protocol implementation." ;
+
+ARTICLE: "ui-paint" "Customizing gadget appearance"
+"The UI carries out the following steps when drawing a gadget:"
+{ $list
+    { "The " { $link draw-interior } " generic word is called on the value of the " { $link gadget-interior } " slot." }
+    { "The " { $link draw-gadget* } " generic word is called on the gadget." }
+    { "The gadget's visible children are drawn, determined by calling " { $link visible-children } " on the gadget." }
+    { "The " { $link draw-boundary } " generic word is called on the value of the " { $link gadget-boundary } " slot." }
+}
+"Now, each one of these steps will be covered in detail."
+{ $subsection "ui-pen-protocol" }
+{ $subsection "ui-paint-custom" } ;
+
+ARTICLE: "ui-pen-protocol" "UI pen protocol"
+"The " { $link gadget-interior } " and " { $link gadget-boundary } " slots of a gadget facilitate easy factoring and sharing of drawing logic. Objects stored in these slots must implement the pen protocol:"
+{ $subsection draw-interior }
+{ $subsection draw-boundary }
+"The default value of these slots is the " { $link f } " singleton, which implements the above protocol by doing nothing."
+$nl
+"Some other pre-defined implementations:"
+{ $subsection solid }
+{ $subsection gradient }
+{ $subsection polygon }
+"Custom implementations must follow the guidelines set forth in " { $link "ui-paint-custom" } "." ;
+
+ARTICLE: "text-rendering" "Rendering text"
+"Unlike OpenGL, Factor's FreeType binding only includes the bare essentials, and there is rarely any need to directly call words in the " { $vocab-link "freetype" } " vocabulary directly. Instead, the UI provides high-level wrappers."
+$nl
+"Font objects are never constructed directly, and instead are obtained by calling a word:"
+{ $subsection open-font }
+"Measuring text:"
+{ $subsection text-dim }
+{ $subsection text-height }
+{ $subsection text-width }
+"Rendering text:"
+{ $subsection draw-string }
+{ $subsection draw-text } ;
+
+ARTICLE: "ui-paint-custom" "Implementing custom drawing logic"
+"The UI uses OpenGL to render gadgets. Custom rendering logic can be plugged in with the " { $link "ui-pen-protocol" } ", or by implementing a generic word:"
+{ $subsection draw-gadget* }
+"Custom drawing code has access to the full OpenGL API in the " { $vocab-link "opengl" } " vocabulary."
+$nl
+"The UI uses a co-ordinate system where the y axis is oriented down. The OpenGL " { $link GL_MODELVIEW } " matrix is not saved or restored when rendering a gadget. Instead, the origin of the gadget relative to the OpenGL context is stored in a variable:"
+{ $subsection origin }
+"Custom drawing implementations can translate co-ordinates manually, or save and restore the " { $link GL_MODELVIEW } " matrix."
+$nl
+"OpenGL state must not be altered as a result of drawing a gadget, so any flags which were enabled should be disabled, and vice versa."
+$nl
+"Gadgets must not draw outside of their bounding box, however clipping is not enforced by default, for performance reasons. This can be changed by setting the " { $link gadget-clipped? } " slot to " { $link t } " in the gadget's constructor."
+$nl
+"Saving the " { $link GL_MODELVIEW } " matrix and enabling/disabling flags can be done in a clean way using the combinators documented in the following section."
+{ $subsection "gl-utilities" }
+{ $subsection "text-rendering" } ;
+
+ABOUT: "ui-paint-custom"
diff --git a/extra/ui/render/render.factor b/extra/ui/render/render.factor
new file mode 100644 (file)
index 0000000..7b872dc
--- /dev/null
@@ -0,0 +1,185 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays hashtables io kernel math namespaces opengl
+opengl.gl opengl.glu sequences strings io.styles vectors
+combinators math.vectors ui.gadgets colors ;
+IN: ui.render
+
+SYMBOL: clip
+
+SYMBOL: viewport-translation
+
+: flip-rect ( rect -- loc dim )
+    rect-bounds [
+        >r { 1 -1 } v* r> { 0 -1 } v* v+
+        viewport-translation get v+
+    ] keep ;
+
+: do-clip ( -- ) clip get flip-rect gl-set-clip ;
+
+: init-clip ( clip-rect rect -- )
+    GL_SCISSOR_TEST glEnable
+    [ rect-intersect ] keep
+    rect-dim dup { 0 1 } v* viewport-translation set
+    { 0 0 } over gl-viewport
+    0 swap first2 0 gluOrtho2D
+    clip set
+    do-clip ;
+
+: init-gl ( clip-rect rect -- )
+    GL_SMOOTH glShadeModel
+    GL_BLEND glEnable
+    GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
+    init-matrices
+    init-clip
+    ! white gl-clear is broken w.r.t window resizing
+    ! Linux/PPC Radeon 9200
+    white gl-color
+    clip get rect-extent gl-fill-rect ;
+
+GENERIC: draw-gadget* ( gadget -- )
+
+M: gadget draw-gadget* drop ;
+
+GENERIC: draw-interior ( gadget interior -- )
+
+GENERIC: draw-boundary ( gadget boundary -- )
+
+SYMBOL: origin
+
+{ 0 0 } origin set-global
+
+: visible-children ( gadget -- seq )
+    clip get origin get vneg offset-rect swap children-on ;
+
+: translate ( rect/point -- ) rect-loc origin [ v+ ] change ;
+
+DEFER: draw-gadget
+
+: (draw-gadget) ( gadget -- )
+    [
+        dup translate
+        dup dup gadget-interior draw-interior
+        dup draw-gadget*
+        dup visible-children [ draw-gadget ] each
+        dup gadget-boundary draw-boundary
+    ] with-scope ;
+
+: >absolute ( rect -- rect )
+    origin get offset-rect ;
+
+: change-clip ( gadget -- )
+    >absolute clip [ rect-intersect ] change ;
+
+: with-clipping ( gadget quot -- )
+    clip get >r
+    over change-clip do-clip call
+    r> clip set do-clip ; inline
+
+: draw-gadget ( gadget -- )
+    {
+        { [ dup gadget-visible? not ] [ drop ] }
+        { [ dup gadget-clipped? not ] [ (draw-gadget) ] }
+        { [ t ] [ [ (draw-gadget) ] with-clipping ] }
+    } cond ;
+
+! Pen paint properties
+M: f draw-interior 2drop ;
+M: f draw-boundary 2drop ;
+
+! Solid fill/border
+TUPLE: solid color ;
+
+C: <solid> solid
+
+! Solid pen
+: (solid)
+    solid-color gl-color rect-dim >r origin get dup r> v+ ;
+
+M: solid draw-interior (solid) gl-fill-rect ;
+
+M: solid draw-boundary (solid) gl-rect ;
+
+! Gradient pen
+TUPLE: gradient colors ;
+
+C: <gradient> gradient
+
+M: gradient draw-interior
+    origin get [
+        over gadget-orientation
+        swap gradient-colors
+        rot rect-dim
+        gl-gradient
+    ] with-translation ;
+
+! Polygon pen
+TUPLE: polygon color points ;
+
+C: <polygon> polygon
+
+: draw-polygon ( polygon quot -- )
+    origin get [
+        >r dup polygon-color gl-color polygon-points r> call
+    ] with-translation ; inline
+
+M: polygon draw-boundary
+    [ gl-poly ] draw-polygon drop ;
+
+M: polygon draw-interior
+    [ gl-fill-poly ] draw-polygon drop ;
+
+: arrow-up    { { 3 0 } { 6 6 } { 0 6 } } ;
+: arrow-right { { 0 0 } { 6 3 } { 0 6 } } ;
+: arrow-down  { { 0 0 } { 6 0 } { 3 6 } } ;
+: arrow-left  { { 0 3 } { 6 0 } { 6 6 } } ;
+: close-box   { { 0 0 } { 6 0 } { 6 6 } { 0 6 } } ;
+
+: <polygon-gadget> ( color points -- gadget )
+    dup max-dim
+    >r <polygon> <gadget> r> over set-rect-dim
+    [ set-gadget-interior ] keep ;
+
+SYMBOL: font-renderer
+
+HOOK: open-font font-renderer ( font -- open-font )
+
+HOOK: string-width font-renderer ( open-font string -- w )
+
+HOOK: string-height font-renderer ( open-font string -- h )
+
+HOOK: draw-string font-renderer ( font string loc -- )
+
+HOOK: x>offset font-renderer ( x open-font string -- n )
+
+HOOK: free-fonts font-renderer ( world -- )
+
+: text-height ( open-font text -- n )
+    dup string? [
+        string-height
+    ] [
+        [ string-height ] curry* map sum
+    ] if ;
+
+: text-width ( open-font text -- n )
+    dup string? [
+        string-width
+    ] [
+        0 -rot [ string-width max ] curry* each
+    ] if ;
+
+: text-dim ( open-font text -- dim )
+    [ text-width ] 2keep text-height 2array ;
+
+: draw-text ( font text loc -- )
+    over string? [
+        draw-string
+    ] [
+        [
+            [
+                2dup { 0 0 } draw-string
+                >r open-font r> string-height
+                0.0 swap 0.0 glTranslated
+            ] curry* each
+        ] with-translation
+    ] if ;
diff --git a/extra/ui/render/summary.txt b/extra/ui/render/summary.txt
new file mode 100644 (file)
index 0000000..701345f
--- /dev/null
@@ -0,0 +1 @@
+Support for rendering gadgets via OpenGL
diff --git a/extra/ui/summary.txt b/extra/ui/summary.txt
new file mode 100644 (file)
index 0000000..0e37d7b
--- /dev/null
@@ -0,0 +1 @@
+Factor's graphical user interface framework
diff --git a/extra/ui/tools/authors.txt b/extra/ui/tools/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/browser/authors.txt b/extra/ui/tools/browser/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/browser/browser.factor b/extra/ui/tools/browser/browser.factor
new file mode 100644 (file)
index 0000000..8071a96
--- /dev/null
@@ -0,0 +1,59 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: debugger ui.tools.workspace help help.topics kernel
+models ui.commands ui.gadgets ui.gadgets.panes
+ui.gadgets.scrollers ui.gadgets.tracks ui.gestures
+ui.gadgets.buttons ;
+IN: ui.tools.browser
+
+TUPLE: browser-gadget pane history ;
+
+: show-help ( link help -- )
+    dup browser-gadget-history add-history
+    >r >link r> browser-gadget-history set-model ;
+
+: <help-pane> ( browser-gadget -- gadget )
+    browser-gadget-history
+    [ [ dup help ] try drop ] <pane-control> ;
+
+: init-history ( browser-gadget -- )
+    "handbook" <history>
+    swap set-browser-gadget-history ;
+
+: <browser-gadget> ( -- gadget )
+    browser-gadget construct-empty
+    dup init-history [
+        toolbar,
+        g <help-pane> g-> set-browser-gadget-pane
+        <scroller> 1 track,
+    ] { 0 1 } build-track ;
+
+M: browser-gadget call-tool* show-help ;
+
+M: browser-gadget tool-scroller
+    browser-gadget-pane find-scroller ;
+
+: help-action ( browser-gadget -- link )
+    browser-gadget-history model-value >link ;
+
+: com-follow browser-gadget call-tool ;
+
+: com-back browser-gadget-history go-back ;
+
+: com-forward browser-gadget-history go-forward ;
+
+: com-documentation "handbook" swap show-help ;
+
+: com-vocabularies "vocab-index" swap show-help ;
+
+: browser-help "ui-browser" help-window ;
+
+\ browser-help H{ { +nullary+ t } } define-command
+
+browser-gadget "toolbar" f {
+    { T{ key-down f { A+ } "b" } com-back }
+    { T{ key-down f { A+ } "f" } com-forward }
+    { T{ key-down f { A+ } "h" } com-documentation }
+    { T{ key-down f { A+ } "v" } com-vocabularies }
+    { T{ key-down f f "F1" } browser-help }
+} define-command-map
diff --git a/extra/ui/tools/browser/summary.txt b/extra/ui/tools/browser/summary.txt
new file mode 100644 (file)
index 0000000..cfca213
--- /dev/null
@@ -0,0 +1 @@
+Graphical help browser
diff --git a/extra/ui/tools/browser/tags.txt b/extra/ui/tools/browser/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/debugger/authors.txt b/extra/ui/tools/debugger/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/debugger/debugger-docs.factor b/extra/ui/tools/debugger/debugger-docs.factor
new file mode 100644 (file)
index 0000000..ec2a615
--- /dev/null
@@ -0,0 +1,14 @@
+USING: ui.tools.debugger ui.gadgets help.markup help.syntax
+kernel quotations continuations debugger ui ;
+
+HELP: <debugger>
+{ $values { "error" "an error" } { "restarts" "a sequence of " { $link restart } " instances" } { "restart-hook" "a quotation with stack effect " { $snippet "( list -- )" } } { "gadget" "a new " { $link gadget } } }
+{ $description
+    "Creates a gadget displaying a description of the error, along with buttons to print the contents of the stacks in the listener, and a list of restarts."
+} ;
+
+{ <debugger> debugger-window ui-try } related-words
+
+HELP: debugger-window
+{ $values { "error" "an error" } }
+{ $description "Opens a window with a description of the error." } ;
diff --git a/extra/ui/tools/debugger/debugger.factor b/extra/ui/tools/debugger/debugger.factor
new file mode 100644 (file)
index 0000000..0e7addb
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ui ui.commands ui.gestures ui.gadgets
+ui.gadgets.worlds ui.gadgets.packs ui.gadgets.buttons
+ui.gadgets.labels ui.gadgets.panes ui.gadgets.presentations
+ui.gadgets.viewports ui.gadgets.lists ui.gadgets.tracks
+ui.gadgets.scrollers ui.gadgets.panes hashtables io kernel math
+models namespaces sequences sequences words continuations
+debugger prettyprint ui.tools.traceback help editors ;
+IN: ui.tools.debugger
+
+: <restart-list> ( restarts restart-hook -- gadget )
+    [ restart-name ] rot <model> <list> ;
+
+TUPLE: debugger restarts ;
+
+: <debugger-display> ( restart-list error -- gadget )
+    [
+        <pane> [ [ print-error ] with-pane ] keep gadget,
+        gadget,
+    ] make-filled-pile ;
+
+: <debugger> ( error restarts restart-hook -- gadget )
+    debugger construct-empty
+    [
+        toolbar,
+        <restart-list> g-> set-debugger-restarts
+        swap <debugger-display> <scroller> 1 track,
+    ] { 0 1 } build-track ;
+
+M: debugger focusable-child* debugger-restarts ;
+
+: debugger-window ( error -- )
+    #! No restarts for the debugger window
+    f [ drop ] <debugger> "Error" open-window ;
+
+[ debugger-window ] ui-error-hook set-global
+
+M: world-error error.
+    "An error occurred while drawing the world " write
+    dup world-error-world pprint-short "." print
+    "This world has been deactivated to prevent cascading errors." print
+    delegate error. ;
+
+debugger "gestures" f {
+    { T{ button-down } request-focus }
+} define-command-map
+
+: com-traceback error-continuation get traceback-window ;
+
+\ com-traceback H{ { +nullary+ t } } define-command
+
+\ :help H{ { +nullary+ t } { +listener+ t } } define-command
+
+\ :edit H{ { +nullary+ t } } define-command
+
+debugger "toolbar" f {
+    { T{ key-down f f "s" } com-traceback }
+    { T{ key-down f f "h" } :help }
+    { T{ key-down f f "e" } :edit }
+} define-command-map
diff --git a/extra/ui/tools/debugger/summary.txt b/extra/ui/tools/debugger/summary.txt
new file mode 100644 (file)
index 0000000..fb5b33e
--- /dev/null
@@ -0,0 +1 @@
+Graphical error display
diff --git a/extra/ui/tools/debugger/tags.txt b/extra/ui/tools/debugger/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/inspector/authors.txt b/extra/ui/tools/inspector/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/inspector/inspector.factor b/extra/ui/tools/inspector/inspector.factor
new file mode 100644 (file)
index 0000000..70a01c7
--- /dev/null
@@ -0,0 +1,47 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: ui.tools.workspace inspector kernel ui.commands
+ui.gadgets ui.gadgets.panes ui.gadgets.scrollers
+ui.gadgets.slots ui.gadgets.tracks ui.gestures
+ui.gadgets.buttons namespaces ;
+IN: ui.tools.inspector
+
+TUPLE: inspector-gadget object pane ;
+
+: refresh ( inspector -- )
+    dup inspector-gadget-object swap inspector-gadget-pane [
+        H{ { +editable+ t } { +number-rows+ t } } describe*
+    ] with-pane ;
+
+: <inspector-gadget> ( -- gadget )
+    inspector-gadget construct-empty
+    [
+        toolbar,
+        <pane> g-> set-inspector-gadget-pane <scroller> 1 track,
+    ] { 0 1 } build-track ;
+
+: inspect-object ( obj inspector -- )
+    [ set-inspector-gadget-object ] keep refresh ;
+
+\ &push H{ { +nullary+ t } { +listener+ t } } define-command
+
+\ &back H{ { +nullary+ t } { +listener+ t } } define-command
+
+: globals ( -- ) global inspect ;
+
+\ globals H{ { +nullary+ t } { +listener+ t } } define-command
+
+: inspector-help "ui-inspector" help-window ;
+
+\ inspector-help H{ { +nullary+ t } } define-command
+
+inspector-gadget "toolbar" f {
+    { T{ update-object } refresh }
+    { f &push }
+    { f &back }
+    { f globals }
+    { T{ key-down f f "F1" } inspector-help }
+} define-command-map
+
+M: inspector-gadget tool-scroller
+    inspector-gadget-pane find-scroller ;
diff --git a/extra/ui/tools/inspector/summary.txt b/extra/ui/tools/inspector/summary.txt
new file mode 100644 (file)
index 0000000..2c38d74
--- /dev/null
@@ -0,0 +1 @@
+Graphical object viewer and editor
diff --git a/extra/ui/tools/inspector/tags.txt b/extra/ui/tools/inspector/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/interactor/authors.txt b/extra/ui/tools/interactor/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/interactor/interactor-docs.factor b/extra/ui/tools/interactor/interactor-docs.factor
new file mode 100644 (file)
index 0000000..d2265e3
--- /dev/null
@@ -0,0 +1,9 @@
+USING: ui.tools.interactor ui.gadgets ui.gadgets.editors
+listener io help.syntax help.markup ;
+
+HELP: interactor
+{ $class-description "An interactor is an " { $link editor } " intended to be used as the input component of a " { $link "ui-listener" } "."
+$nl
+"Interactors are created by calling " { $link <interactor> } "."
+$nl
+"Interactors implement the " { $link stream-readln } ", " { $link stream-read } " and " { $link parse-interactive } " generic words." } ;
diff --git a/extra/ui/tools/interactor/interactor.factor b/extra/ui/tools/interactor/interactor.factor
new file mode 100644 (file)
index 0000000..d0791ac
--- /dev/null
@@ -0,0 +1,164 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs combinators continuations documents
+ui.tools.workspace hashtables io io.styles kernel math
+math.vectors models namespaces parser prettyprint quotations
+sequences strings threads listener tuples ui.commands
+ui.gadgets ui.gadgets.controls ui.gadgets.editors
+ui.gadgets.presentations ui.gadgets.worlds ui.gestures ;
+IN: ui.tools.interactor
+
+TUPLE: interactor
+history output
+continuation quot busy?
+vars
+help ;
+
+: interactor-use ( interactor -- seq )
+    use swap interactor-vars at ;
+
+: word-at-loc ( loc interactor -- word )
+    over [
+        [ control-model T{ one-word-elt } elt-string ] keep
+        interactor-use assoc-stack
+    ] [
+        2drop f
+    ] if ;
+
+TUPLE: caret-help model gadget ;
+
+: <caret-help> ( interactor -- caret-help )
+    [ editor-caret 100 <delay> ] keep caret-help construct-boa
+    dup dup caret-help-model add-connection ;
+
+M: caret-help model-changed
+    dup caret-help-gadget
+    swap caret-help-model model-value over word-at-loc
+    swap show-summary ;
+
+: init-caret-help ( interactor -- )
+    dup <caret-help> swap set-interactor-help ;
+
+: init-interactor-history ( interactor -- )
+    V{ } clone swap set-interactor-history ;
+
+: <interactor> ( output -- gadget )
+    <source-editor>
+    { set-interactor-output set-gadget-delegate }
+    interactor construct
+    dup dup set-control-self
+    dup init-interactor-history
+    dup init-caret-help ;
+
+M: interactor graft*
+    dup delegate graft*
+    dup interactor-help caret-help-model activate-model
+    f swap set-interactor-busy? ;
+
+M: interactor ungraft*
+    dup interactor-help caret-help-model deactivate-model
+    delegate ungraft* ;
+
+: write-input ( string input -- )
+    <input> presented associate
+    [ H{ { font-style bold } } format ] with-nesting ;
+
+: interactor-input. ( string interactor -- )
+    interactor-output [
+        dup string? [ dup write-input nl ] [ short. ] if
+    ] with-stream* ;
+
+: add-interactor-history ( str interactor -- )
+    over empty? [ 2drop ] [ interactor-history push-new ] if ;
+
+: interactor-continue ( obj interactor -- )
+    t over set-interactor-busy?
+    interactor-continuation schedule-thread-with ;
+
+: interactor-finish ( obj interactor -- )
+    [ editor-string ] keep
+    [ interactor-input. ] 2keep
+    [ add-interactor-history ] keep
+    dup control-model clear-doc
+    interactor-continue ;
+
+: interactor-eval ( interactor -- )
+    [
+        [ editor-string ] keep dup interactor-quot call
+    ] in-thread drop ;
+
+: interactor-eof ( interactor -- )
+    f swap interactor-continue ;
+
+: evaluate-input ( interactor -- )
+    dup interactor-busy? [ drop ] [ interactor-eval ] if ;
+
+: interactor-yield ( interactor quot -- obj )
+    over set-interactor-quot
+    f over set-interactor-busy?
+    [ set-interactor-continuation stop ] curry callcc1 ;
+
+M: interactor stream-readln
+    [ interactor-finish ] interactor-yield ;
+
+: interactor-call ( quot interactor -- )
+    2dup interactor-input. interactor-continue ;
+
+M: interactor stream-read
+    swap dup zero? [
+        2drop ""
+    ] [
+        >r stream-readln dup length r> min head
+    ] if ;
+
+M: interactor stream-read-partial
+    stream-read ;
+
+: save-vars ( interactor -- )
+    { use in stdio lexer-factory } [ dup get ] H{ } map>assoc
+    swap set-interactor-vars ;
+
+: restore-vars ( interactor -- )
+    namespace swap interactor-vars update ;
+
+: go-to-error ( interactor error -- )
+    dup parse-error-line 1- swap parse-error-col 2array
+    over [ control-model validate-loc ] keep
+    editor-caret set-model
+    mark>caret ;
+
+: handle-parse-error ( interactor error -- )
+    dup parse-error? [ 2dup go-to-error delegate ] when
+    swap find-workspace debugger-popup ;
+
+: try-parse ( str interactor -- quot/error/f )
+    [
+        [
+            [ restore-vars parse ] keep save-vars
+        ] [
+            >r f swap set-interactor-busy? drop r>
+            dup [ unexpected-eof? ] is? [ drop f ] when
+        ] recover
+    ] with-scope ;
+
+: handle-interactive ( str/f interactor -- )
+    tuck try-parse {
+        { [ dup quotation? ] [ swap interactor-finish ] }
+        { [ dup not ] [ drop "\n" swap user-input ] }
+        { [ t ] [ handle-parse-error ] }
+    } cond ;
+
+M: interactor parse-interactive
+    [ save-vars ] keep
+    [ [ handle-interactive ] interactor-yield ] keep
+    restore-vars ;
+
+M: interactor pref-dim*
+    0 over line-height 4 * 2array swap delegate pref-dim* vmax ;
+
+: clear-input control-model clear-doc ;
+
+interactor "interactor" f {
+    { T{ key-down f f "RET" } evaluate-input }
+    { T{ key-down f { C+ } "k" } clear-input }
+} define-command-map
diff --git a/extra/ui/tools/interactor/summary.txt b/extra/ui/tools/interactor/summary.txt
new file mode 100644 (file)
index 0000000..6929b20
--- /dev/null
@@ -0,0 +1 @@
+Interactors are used to input Factor code
diff --git a/extra/ui/tools/listener/authors.txt b/extra/ui/tools/listener/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/listener/listener-tests.factor b/extra/ui/tools/listener/listener-tests.factor
new file mode 100644 (file)
index 0000000..55c8851
--- /dev/null
@@ -0,0 +1,35 @@
+USING: continuations documents ui.tools.interactor
+ui.tools.listener hashtables kernel namespaces parser sequences
+timers tools.test ui.commands ui.gadgets.controls
+ui.gadgets.editors ui.gadgets.panes vocabs words ;
+IN: temporary
+
+timers [ init-timers ] unless
+
+[ f ] [ "word" source-editor command-map empty? ] unit-test
+
+<listener-gadget> "listener" set
+
+{ "kernel" } [ vocab-words ] map use associate
+"listener" get listener-gadget-input set-interactor-vars
+
+[ "dup" ] [ \ dup "listener" get word-completion-string ] unit-test
+
+[ "USE: words word-name" ]
+[ \ word-name "listener" get word-completion-string ] unit-test
+
+<pane> <interactor> "i" set
+H{ } "i" get set-interactor-vars
+
+[ t ] [ "i" get interactor? ] unit-test
+
+[ ] [ "SYMBOL:" "i" get set-editor-string ] unit-test
+
+[ ] [
+    "i" get [ "SYMBOL:" parse ] catch go-to-error
+] unit-test
+
+[ t ] [
+    "i" get control-model doc-end
+    "i" get editor-caret* =
+] unit-test
diff --git a/extra/ui/tools/listener/listener.factor b/extra/ui/tools/listener/listener.factor
new file mode 100644 (file)
index 0000000..7d7c7c1
--- /dev/null
@@ -0,0 +1,165 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: inspector ui.tools.interactor ui.tools.inspector
+ui.tools.workspace help.markup io io.streams.duplex io.styles
+kernel models namespaces parser quotations sequences ui.commands
+ui.gadgets ui.gadgets.editors ui.gadgets.labelled
+ui.gadgets.panes ui.gadgets.buttons ui.gadgets.scrollers
+ui.gadgets.tracks ui.gestures ui.operations vocabs words
+prettyprint listener debugger threads generator ;
+IN: ui.tools.listener
+
+TUPLE: listener-gadget input output stack ;
+
+: listener-output, ( -- )
+    <scrolling-pane> g-> set-listener-gadget-output
+    <scroller> "Output" <labelled-gadget> 1 track, ;
+
+: listener-stream ( listener -- stream )
+    dup listener-gadget-input
+    swap listener-gadget-output <pane-stream>
+    <duplex-stream> ;
+
+: <listener-input> ( listener -- gadget )
+    listener-gadget-output <pane-stream> <interactor> ;
+
+: listener-input, ( -- )
+    g <listener-input> g-> set-listener-gadget-input
+    <scroller> "Input" <labelled-gadget> f track, ;
+
+: welcome. ( -- )
+   "If this is your first time with the Factor UI," print
+   "please read " write
+   "ui-tools" ($link) " and " write
+   "ui-listener" ($link) "." print nl
+   "If you are completely new to Factor, start with the " print
+   "cookbook" ($link) "." print nl ;
+
+M: listener-gadget focusable-child*
+    listener-gadget-input ;
+
+M: listener-gadget call-tool* ( input listener -- )
+    >r input-string r> listener-gadget-input set-editor-string ;
+
+M: listener-gadget tool-scroller
+    listener-gadget-output find-scroller ;
+
+: workspace-busy? ( workspace -- ? )
+    workspace-listener listener-gadget-input interactor-busy? ;
+
+: get-listener ( -- listener )
+    [ workspace-busy? not ] get-workspace* workspace-listener ;
+
+: listener-input ( string -- )
+    get-listener listener-gadget-input set-editor-string ;
+
+: (call-listener) ( quot listener -- )
+    listener-gadget-input interactor-call ;
+
+: call-listener ( quot -- )
+    get-listener (call-listener) ;
+
+M: listener-command invoke-command ( target command -- )
+    command-quot call-listener ;
+
+M: listener-operation invoke-command ( target command -- )
+    [ operation-hook call ] keep operation-quot call-listener ;
+
+: eval-listener ( string -- )
+    get-listener
+    listener-gadget-input [ set-editor-string ] keep
+    evaluate-input ;
+
+: listener-run-files ( seq -- )
+    dup empty? [
+        drop
+    ] [
+        [ [ [ run-file ] each ] no-parse-hook ] curry
+        call-listener
+    ] if ;
+
+: com-EOF ( listener -- )
+    listener-gadget-input interactor-eof ;
+
+: clear-output ( listener -- )
+    [ listener-gadget-output [ pane-clear ] curry ] keep
+    (call-listener) ;
+
+: clear-stack ( listener -- )
+    [ clear ] swap (call-listener) ;
+
+: word-completion-string ( word listener -- string )
+    >r dup word-name swap word-vocabulary dup vocab-words r>
+    listener-gadget-input interactor-use memq?
+    [ drop ] [ [ "USE: " % % " " % % ] "" make ] if ;
+
+: insert-word ( word -- )
+    get-listener [ word-completion-string ] keep
+    listener-gadget-input user-input ;
+
+: quot-action ( interactor -- quot )
+    dup editor-string swap
+    2dup add-interactor-history
+    select-all ;
+
+TUPLE: stack-display ;
+
+: <stack-display> ( -- gadget )
+    stack-display construct-empty
+    g workspace-listener swap [
+        dup <toolbar> f track,
+        listener-gadget-stack [ stack. ]
+        "Data stack" <labelled-pane> 1 track,
+    ] { 0 1 } build-track ;
+
+M: stack-display tool-scroller
+    find-workspace workspace-listener tool-scroller ;
+
+: ui-listener-hook ( listener -- )
+    >r datastack r> listener-gadget-stack set-model ;
+
+: ui-error-hook ( error listener -- )
+    find-workspace debugger-popup ;
+
+: ui-inspector-hook ( obj listener -- )
+    find-workspace inspector-gadget
+    swap show-tool inspect-object ;
+
+: listener-thread ( listener -- )
+    dup listener-stream [
+        dup [ ui-listener-hook ] curry listener-hook set
+        dup [ ui-error-hook ] curry error-hook set
+        [ ui-inspector-hook ] curry inspector-hook set
+        [ yield ] compiler-hook set
+        welcome.
+        listener
+    ] with-stream* ;
+
+: restart-listener ( listener -- )
+    [ >r clear r> init-namespaces listener-thread ] in-thread
+    drop ;
+
+: init-listener ( listener -- )
+    f <model> swap set-listener-gadget-stack ;
+
+: <listener-gadget> ( -- gadget )
+    listener-gadget construct-empty
+    dup init-listener
+    [ listener-output, listener-input, ] { 0 1 } build-track
+    dup restart-listener ;
+
+: listener-help "ui-listener" help-window ;
+
+\ listener-help H{ { +nullary+ t } } define-command
+
+listener-gadget "toolbar" f {
+    { f restart-listener }
+    { T{ key-down f f "CLEAR" } clear-output }
+    { T{ key-down f { C+ } "CLEAR" } clear-stack }
+    { T{ key-down f { C+ } "d" } com-EOF }
+    { T{ key-down f f "F1" } listener-help }
+} define-command-map
+
+M: listener-gadget handle-gesture* ( gadget gesture delegate -- ? )
+    3dup drop swap find-workspace workspace-page handle-gesture
+    [ default-gesture-handler ] [ 3drop f ] if ;
diff --git a/extra/ui/tools/listener/summary.txt b/extra/ui/tools/listener/summary.txt
new file mode 100644 (file)
index 0000000..1d89862
--- /dev/null
@@ -0,0 +1 @@
+Graphical code evaluator
diff --git a/extra/ui/tools/listener/tags.txt b/extra/ui/tools/listener/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/operations/authors.txt b/extra/ui/tools/operations/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/operations/operations.factor b/extra/ui/tools/operations/operations.factor
new file mode 100644 (file)
index 0000000..780879f
--- /dev/null
@@ -0,0 +1,207 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: continuations definitions ui.tools.browser
+ui.tools.interactor ui.tools.listener ui.tools.profiler
+ui.tools.search ui.tools.traceback ui.tools.workspace generic
+help.topics inference inspector io.files io.styles kernel
+namespaces parser prettyprint quotations tools.annotations
+editors tools.profiler tools.test tools.time tools.walker
+ui.commands ui.gadgets.editors ui.gestures ui.operations vocabs
+vocabs.loader words sequences tools.browser classes ;
+IN: ui.tools.operations
+
+V{ } clone operations set-global
+
+! Objects
+[ drop t ] \ inspect H{
+    { +primary+ t }
+    { +listener+ t }
+} define-operation
+
+: com-prettyprint . ;
+
+[ drop t ] \ com-prettyprint H{
+    { +listener+ t }
+} define-operation
+
+: com-push ;
+
+[ drop t ] \ com-push H{
+    { +listener+ t }
+} define-operation
+
+: com-unparse unparse listener-input ;
+
+[ drop t ] \ com-unparse H{ } define-operation
+
+! Input
+
+: com-input input-string listener-input ;
+
+[ input? ] \ com-input H{
+    { +primary+ t }
+    { +secondary+ t }
+} define-operation
+
+! Restart
+[ restart? ] \ restart H{
+    { +primary+ t }
+    { +secondary+ t }
+    { +listener+ t }
+} define-operation
+
+! Continuation
+[ continuation? ] \ traceback-window H{
+    { +primary+ t }
+    { +secondary+ t }
+} define-operation
+
+! Pathnames
+: edit-file edit ;
+
+[ pathname? ] \ edit-file H{
+    { +keyboard+ T{ key-down f { C+ } "E" } }
+    { +primary+ t }
+    { +secondary+ t }
+} define-operation
+
+UNION: definition word method-spec link ;
+
+UNION: editable-definition definition vocab vocab-link ;
+
+[ editable-definition? ] \ edit H{
+    { +keyboard+ T{ key-down f { C+ } "E" } }
+} define-operation
+
+UNION: reloadable-definition definition pathname ;
+
+[ reloadable-definition? ] \ reload H{
+    { +keyboard+ T{ key-down f { C+ } "R" } }
+    { +listener+ t }
+} define-operation
+
+[ dup reloadable-definition? swap vocab-spec? or ] \ forget
+H{ } define-operation
+
+! Words
+[ word? ] \ insert-word H{
+    { +secondary+ t }
+} define-operation
+
+[
+    class
+    { link word vocab vocab-link vocab-tag vocab-author }
+    memq?
+] \ com-follow H{
+    { +keyboard+ T{ key-down f { C+ } "H" } }
+    { +primary+ t }
+} define-operation
+
+: com-usage ( word -- )
+    get-workspace swap show-word-usage ;
+
+[ word? ] \ com-usage H{
+    { +keyboard+ T{ key-down f { C+ } "U" } }
+} define-operation
+
+[ word? ] \ fix H{
+    { +keyboard+ T{ key-down f { C+ } "F" } }
+    { +listener+ t }
+} define-operation
+
+[ word? ] \ watch H{ } define-operation
+
+[ word? ] \ breakpoint H{ } define-operation
+
+GENERIC: com-stack-effect ( obj -- )
+
+M: quotation com-stack-effect infer. ;
+
+M: word com-stack-effect word-def com-stack-effect ;
+
+[ compound? ] \ com-stack-effect H{
+    { +listener+ t }
+} define-operation
+
+! Vocabularies
+: com-vocab-words get-workspace swap show-vocab-words ;
+
+[ vocab? ] \ com-vocab-words H{
+    { +secondary+ t }
+    { +keyboard+ T{ key-down f { C+ } "B" } }
+} define-operation
+
+: com-enter-in vocab-name set-in ;
+
+[ vocab? ] \ com-enter-in H{
+    { +keyboard+ T{ key-down f { C+ } "I" } }
+    { +listener+ t }
+} define-operation
+
+: com-use-vocab vocab-name use+ ;
+
+[ vocab-spec? ] \ com-use-vocab H{
+    { +secondary+ t }
+    { +listener+ t }
+} define-operation
+
+[ vocab-spec? ] \ run H{
+    { +keyboard+ T{ key-down f { C+ } "R" } }
+    { +listener+ t }
+} define-operation
+
+[ vocab? ] \ test H{
+    { +keyboard+ T{ key-down f { C+ } "T" } }
+    { +listener+ t }
+} define-operation
+
+! Quotations
+[ quotation? ] \ com-stack-effect H{
+    { +keyboard+ T{ key-down f { C+ } "i" } }
+    { +listener+ t }
+} define-operation
+
+[ quotation? ] \ walk H{
+    { +keyboard+ T{ key-down f { C+ } "w" } }
+    { +listener+ t }
+} define-operation
+
+[ quotation? ] \ time H{
+    { +keyboard+ T{ key-down f { C+ } "t" } }
+    { +listener+ t }
+} define-operation
+
+: com-show-profile profiler-gadget call-tool ;
+
+: com-profile ( quot -- ) profile f com-show-profile ;
+
+[ quotation? ] \ com-profile H{
+    { +keyboard+ T{ key-down f { C+ } "r" } }
+    { +listener+ t }
+} define-operation
+
+! Profiler presentations
+[ usage-profile? ] \ com-show-profile H{
+    { +primary+ t }
+} define-operation
+
+[ vocab-profile? ] \ com-show-profile H{
+    { +primary+ t }
+} define-operation
+
+! Operations -> commands
+source-editor
+"word"
+"These commands operate on the Factor word named by the token at the caret position."
+\ selected-word
+[ selected-word ]
+[ search ] 
+define-operation-map
+
+interactor
+"quotation"
+"These commands operate on the entire contents of the input area."
+[ ]
+[ quot-action ]
+[ parse ]
+define-operation-map
diff --git a/extra/ui/tools/operations/summary.txt b/extra/ui/tools/operations/summary.txt
new file mode 100644 (file)
index 0000000..c5ec0ed
--- /dev/null
@@ -0,0 +1 @@
+Standard presentation operations
diff --git a/extra/ui/tools/profiler/authors.txt b/extra/ui/tools/profiler/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/profiler/profiler.factor b/extra/ui/tools/profiler/profiler.factor
new file mode 100644 (file)
index 0000000..0fbe6a7
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: ui.tools.workspace kernel quotations tools.profiler
+ui.commands ui.gadgets ui.gadgets.panes ui.gadgets.scrollers
+ui.gadgets.tracks ui.gestures ui.gadgets.buttons ;
+IN: ui.tools.profiler
+
+TUPLE: profiler-gadget pane ;
+
+: <profiler-gadget> ( -- gadget )
+    profiler-gadget construct-empty
+    [
+        toolbar,
+        <pane> g-> set-profiler-gadget-pane
+        <scroller> 1 track,
+    ] { 0 1 } build-track ;
+
+: with-profiler-pane ( gadget quot -- )
+    >r profiler-gadget-pane r> with-pane ;
+
+: com-full-profile ( gadget -- )
+    [ profile. ] with-profiler-pane ;
+
+: com-vocabs-profile ( gadget -- )
+    [ vocabs-profile. ] with-profiler-pane ;
+
+\ enable-profiler H{
+    { +nullary+ t }
+    { +listener+ t }
+} define-command
+
+\ disable-profiler H{
+    { +nullary+ t }
+    { +listener+ t }
+} define-command
+
+: profiler-help "ui-profiler" help-window ;
+
+\ profiler-help H{ { +nullary+ t } } define-command
+
+profiler-gadget "toolbar" f {
+    { f enable-profiler }
+    { f disable-profiler }
+    { f com-full-profile }
+    { f com-vocabs-profile }
+    { T{ key-down f f "F1" } profiler-help }
+} define-command-map
+
+GENERIC: profiler-presentation ( obj -- quot )
+
+M: usage-profile profiler-presentation
+    usage-profile-word [ usage-profile. ] curry ;
+
+M: vocab-profile profiler-presentation
+    vocab-profile-vocab [ vocab-profile. ] curry ;
+
+M: f profiler-presentation
+    drop [ vocabs-profile. ] ;
+
+M: profiler-gadget call-tool* ( obj gadget -- )
+    swap profiler-presentation with-profiler-pane ;
diff --git a/extra/ui/tools/profiler/summary.txt b/extra/ui/tools/profiler/summary.txt
new file mode 100644 (file)
index 0000000..d358666
--- /dev/null
@@ -0,0 +1 @@
+Graphical call profiler
diff --git a/extra/ui/tools/profiler/tags.txt b/extra/ui/tools/profiler/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/search/authors.txt b/extra/ui/tools/search/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/search/search-tests.factor b/extra/ui/tools/search/search-tests.factor
new file mode 100644 (file)
index 0000000..a1c66a3
--- /dev/null
@@ -0,0 +1,54 @@
+USING: assocs ui.tools.search help.topics io.files io.styles
+kernel namespaces sequences source-files threads timers
+tools.test ui.gadgets ui.gadgets.controls ui.gestures vocabs
+vocabs.loader words ;
+IN: temporary
+
+timers get [ init-timers ] unless
+
+[ f ] [
+    "no such word with this name exists, certainly"
+    f f <definition-search>
+    T{ key-down f { C+ } "x" } swap search-gesture
+] unit-test
+
+: test-live-search ( gadget quot -- ? )
+    >r dup graft 300 sleep do-timers
+    dup live-search-list control-value
+    dup empty? [ "Empty" throw ] when
+    r> all?
+    >r ungraft r> ;
+
+[ t ] [
+    "swp" all-words f <definition-search>
+    [ word? ] test-live-search
+] unit-test
+
+[ t ] [
+    "" all-words t <definition-search>
+    dup graft
+    { "set-word-prop" } over live-search-field set-control-value
+    300 sleep
+    do-timers
+    search-value \ set-word-prop eq?
+] unit-test
+
+[ t ] [
+    "quot" <help-search>
+    [ link? ] test-live-search
+] unit-test
+
+[ t ] [
+    "factor" source-files get keys <source-file-search>
+    [ pathname? ] test-live-search
+] unit-test
+
+[ t ] [
+    "kern" <vocab-search>
+    [ vocab-spec? ] test-live-search
+] unit-test
+
+[ t ] [
+    "a" { "a" "b" "aa" } <history-search>
+    [ input? ] test-live-search
+] unit-test
diff --git a/extra/ui/tools/search/search.factor b/extra/ui/tools/search/search.factor
new file mode 100644 (file)
index 0000000..ef9eb7c
--- /dev/null
@@ -0,0 +1,158 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs ui.tools.interactor ui.tools.listener
+ui.tools.workspace help help.topics io.files io.styles kernel
+models namespaces prettyprint quotations sequences sorting
+source-files strings tools.completion tools.crossref tuples
+ui.commands ui.gadgets ui.gadgets.controls ui.gadgets.editors
+ui.gadgets.lists ui.gadgets.scrollers ui.gadgets.tracks
+ui.gestures ui.operations vocabs words vocabs.loader
+tools.browser ;
+IN: ui.tools.search
+
+TUPLE: live-search field list ;
+
+: search-value ( live-search -- value )
+    live-search-list list-value ;
+
+: search-gesture ( gesture live-search -- operation/f )
+    search-value object-operations
+    [ operation-gesture = ] curry* find nip ;
+
+M: live-search handle-gesture* ( gadget gesture delegate -- ? )
+    drop over search-gesture dup [
+        over find-workspace hide-popup
+        >r search-value r> invoke-command f
+    ] [
+        2drop t
+    ] if ;
+
+: find-live-search [ [ live-search? ] is? ] find-parent ;
+
+: find-search-list find-live-search live-search-list ;
+
+TUPLE: search-field ;
+
+: <search-field> ( -- gadget ) search-field construct-editor ;
+
+search-field H{
+    { T{ key-down f f "UP" } [ find-search-list select-previous ] }
+    { T{ key-down f f "DOWN" } [ find-search-list select-next ] }
+       { T{ key-down f f "PAGE_UP" } [ find-search-list list-page-up ] }
+       { T{ key-down f f "PAGE_DOWN" } [ find-search-list list-page-down ] }
+    { T{ key-down f f "RET" } [ find-search-list invoke-value-action ] }
+} set-gestures
+
+: <search-model> ( producer -- model )
+    >r g live-search-field control-model 200 <delay>
+    [ "\n" join ] r> append <filter> ;
+
+: <search-list> ( seq limited? presenter -- gadget )
+    >r
+    [ limited-completions ] [ completions ] ? curry
+    <search-model>
+    >r [ find-workspace hide-popup ] r> r>
+    swap <list> ;
+
+: <live-search> ( string seq limited? presenter -- gadget )
+    live-search construct-empty
+    [
+        <search-field> g-> set-live-search-field f track,
+        <search-list> g-> set-live-search-list
+        <scroller> 1 track,
+    ] { 0 1 } build-track
+    [ live-search-field set-editor-string ] keep
+    [ live-search-field end-of-document ] keep ;
+
+M: live-search focusable-child* live-search-field ;
+
+M: live-search pref-dim* drop { 400 200 } ;
+
+: current-word ( workspace -- string )
+    workspace-listener listener-gadget-input selected-word ;
+
+: definition-candidates ( words -- candidates )
+    [ dup synopsis >lower ] { } map>assoc sort-values ;
+
+: <definition-search> ( string words limited? -- gadget )
+    >r definition-candidates r> [ synopsis ] <live-search> ;
+
+: word-candidates ( words -- candidates )
+    [ dup word-name >lower ] { } map>assoc ;
+
+: <word-search> ( string words limited? -- gadget )
+    >r word-candidates r> [ synopsis ] <live-search> ;
+
+: com-words ( workspace -- )
+    dup current-word all-words t <word-search>
+    "Word search" show-titled-popup ;
+
+: show-vocab-words ( workspace vocab -- )
+    "" over words natural-sort f <word-search>
+    "Words in " rot vocab-name append show-titled-popup ;
+
+: show-word-usage ( workspace word -- )
+    "" over smart-usage f <definition-search>
+    "Words and methods using " rot word-name append
+    show-titled-popup ;
+
+: help-candidates ( seq -- candidates )
+    [ dup >link swap article-title >lower ] { } map>assoc
+    sort-values ;
+
+: <help-search> ( string -- gadget )
+    all-articles help-candidates
+    f [ article-title ] <live-search> ;
+
+: com-search ( workspace -- )
+    "" <help-search> "Help search" show-titled-popup ;
+
+: source-file-candidates ( seq -- candidates )
+    [ dup <pathname> swap >lower ] { } map>assoc ;
+
+: <source-file-search> ( string files -- gadget )
+    source-file-candidates
+    f [ pathname-string ] <live-search> ;
+
+: all-source-files ( -- seq )
+    source-files get keys natural-sort ;
+
+: com-sources ( workspace -- )
+    "" all-source-files <source-file-search>
+    "Source file search" show-titled-popup ;
+
+: show-vocab-files ( workspace vocab -- )
+    "" over vocab-files <source-file-search>
+    "Source files in " rot vocab-name append show-titled-popup ;
+
+: vocab-candidates ( -- candidates )
+    all-vocabs-seq [ dup vocab-name >lower ] { } map>assoc ;
+
+: <vocab-search> ( string -- gadget )
+    vocab-candidates f [ vocab-name ] <live-search> ;
+
+: com-vocabs ( workspace -- )
+    dup current-word <vocab-search>
+    "Vocabulary search" show-titled-popup ;
+
+: history-candidates ( seq -- candidates )
+    [ dup <input> swap >lower ] { } map>assoc ;
+
+: <history-search> ( string seq -- gadget )
+    history-candidates
+    f [ input-string ] <live-search> ;
+
+: listener-history ( listener -- seq )
+    listener-gadget-input interactor-history <reversed> ;
+
+: com-history ( workspace -- )
+    "" over workspace-listener listener-history <history-search>
+    "History search" show-titled-popup ;
+
+workspace "toolbar" f {
+    { T{ key-down f { C+ } "p" } com-history }
+    { T{ key-down f f "TAB" } com-words }
+    { T{ key-down f { C+ } "u" } com-vocabs }
+    { T{ key-down f { C+ } "e" } com-sources }
+    { T{ key-down f { C+ } "h" } com-search }
+} define-command-map
diff --git a/extra/ui/tools/search/summary.txt b/extra/ui/tools/search/summary.txt
new file mode 100644 (file)
index 0000000..af5dcef
--- /dev/null
@@ -0,0 +1 @@
+Support for graphical completion popups
diff --git a/extra/ui/tools/summary.txt b/extra/ui/tools/summary.txt
new file mode 100644 (file)
index 0000000..fff5c2f
--- /dev/null
@@ -0,0 +1 @@
+Graphical developer tools
diff --git a/extra/ui/tools/tags.txt b/extra/ui/tools/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/tools-docs.factor b/extra/ui/tools/tools-docs.factor
new file mode 100644 (file)
index 0000000..b4df493
--- /dev/null
@@ -0,0 +1,142 @@
+USING: editors help.markup help.syntax inspector io listener
+parser prettyprint tools.profiler tools.walker ui.commands
+ui.gadgets.editors ui.gadgets.panes ui.gadgets.presentations
+ui.gadgets.slots ui.operations ui.tools.browser
+ui.tools.interactor ui.tools.listener ui.tools.operations
+ui.tools.profiler ui.tools.walker ui.tools.workspace vocabs ;
+IN: ui.tools
+
+ARTICLE: "ui-presentations" "Presentations in the UI"
+"A " { $emphasis "presentation" } " is a graphical view of an object which is directly linked to the object in some way. The help article links you see in the documentation browser are presentations; and if you " { $link see } " a word in the UI listener, all words in the definition will themselves be presentations."
+$nl
+"When you move the mouse over a presentation, it is highlighted with a rectangular border and a short summary of the object being presented is shown in the status bar (the summary is produced using the " { $link summary } " word)."
+$nl
+"Clicking a presentation with the left mouse button invokes a default operation, which usually views the object in some way. For example, clicking a presentation of a word jumps to the word definition in the " { $link "ui-browser" } "."
+$nl
+"Clicking and holding the right mouse button on a presentation displays a popup menu listing available operations."
+$nl
+"Presentation gadgets can be constructed directly using the " { $link <presentation> } " word, and they can also be written to " { $link pane } " gadgets using the " { $link write-object } " word." ;
+
+ARTICLE: "ui-listener" "UI listener"
+"The graphical listener is based around the terminal listener (" { $link "listener" } ") and adds the following features:"
+{ $list
+    "Input history"
+    { "Completion (see " { $link "ui-completion" } ")" }
+    { "Clickable presentations (see " { $link "ui-presentations" } ")" }
+}
+{ $command-map listener-gadget "toolbar" }
+{ $command-map interactor "interactor" }
+{ $command-map source-editor "word" }
+{ $command-map interactor "quotation" }
+{ $heading "Editing commands" }
+"The text editing commands are standard; see " { $link "gadgets-editors" } "."
+{ $heading "Implementation" }
+"Listeners are instances of " { $link listener-gadget } ". The listener consists of an output area (instance of " { $link pane } "), and an input area (instance of " { $link interactor } "), and a stack display kept up to date using a " { $link listener-hook } "." ;
+
+ARTICLE: "ui-inspector" "UI inspector"
+"The graphical inspector builds on the terminal inspector (see " { $link "inspector" } ") and provides in-place editing of slot values."
+$nl
+"To display an object in the UI inspector, use the " { $link inspect } " word from the UI listener, or right-click a presentation and choose " { $strong "Inspect" } " from the menu that appears."
+$nl
+"When the UI inspector is running, all of the terminal inspector words are available, such as " { $link &at } " and " { $link &put } ". Changing slot values using terminal inspector words automatically updates the UI inspector display."
+$nl
+"Slots can also be edited graphically. Clicking the ellipsis to the left of the slot's textual representation displays a slot editor gadget. A text representation of the object can be edited in the slot editor. The parser is used to turn the text representation back into an object. Keep in mind that some structure is lost in the conversion; see " { $link "prettyprint-limitations" } "."
+$nl
+"The slot editor's text editing commands are standard; see " { $link "gadgets-editors" } "."
+$nl
+"The slot editor has a toolbar containing various commands."
+{ $command-map slot-editor "toolbar" }
+"The following commands are also available."
+{ $command-map source-editor "word" } ;
+
+ARTICLE: "ui-browser" "UI browser"
+"The browser is used to display Factor code, documentation, and vocabularies."
+{ $command-map browser-gadget "toolbar" }
+"Browsers are instances of " { $link browser-gadget } "." ;
+
+ARTICLE: "ui-walker" "UI walker"
+"The walker single-steps through quotations. To use the walker, enter a piece of code in the listener's input area and press " { $operation walk } "."
+$nl
+"The walker can travel backwards through time, and restore stacks. This does not undo side effects and therefore can only be used reliably on referentially transparent code."
+{ $command-map walker-gadget "toolbar" }
+{ $command-map walker-gadget "other" }
+"Walkers are instances of " { $link walker-gadget } "." ;
+
+ARTICLE: "ui-profiler" "UI profiler" 
+"The graphical profiler is based on the terminal profiler (see " { $link "profiling" } ") and adds more convenient browsing of profiler results."
+$nl
+"The profiler must be enabled before use. Once the profiler has been enabled, enter a piece of code in the listener input area and press " { $operation com-profile } "."
+$nl
+"Vocabulary and word presentations in the profiler pane can be clicked on to show profiler results pertaining to the object in question. Clicking a vocabulary in the profiler yields the same output as the " { $link vocab-profile. } " word, and clicking a word yields the same output as the " { $link usage-profile. } " word. Consult " { $link "profiling" } " for details."
+{ $command-map profiler-gadget "toolbar" } ;
+
+ARTICLE: "ui-cocoa" "Functionality specific to Mac OS X"
+"On Mac OS X, the Factor UI offers additional features which integrate with this operating system."
+$nl
+"First, a standard Mac-style menu bar is provided, which offers the bare minimum of what you would expect from a Mac OS X application."
+$nl
+"Dropping a source file onto the Factor icon in the dock runs the source file in the listener."
+$nl
+"If you install " { $strong "Factor.app" } " in your " { $strong "Applications" } " folder, then other applications will be able to call Factor via the System Services feature. For example, you can select some text in " { $strong "TextEdit.app" } ", then invoke the " { $strong "TextEdit->Services->Factor->Evaluate Selection" } " menu item, which will replace the selected text with the result of evaluating it in Factor."
+
+;
+
+ARTICLE: "ui-tool-tutorial" "UI tool tutorial"
+"The following is an example of a typical session with the UI which should give you a taste of its power:"
+{ $list
+    { "You decide to refactor some code, and move a few words from a source file you have already loaded, into a new source file." }
+    { "You press " { $operation edit } " in the listener, which displays a gadget where you can type part of a loaded file's name, and then press " { $snippet "RET" } " when the correct completion is highlighted. This opens the file in your editor." } 
+    { "You refactor your words, move them to a new source file, and load the new file using " { $link run-file } "." }
+    { "Interactively testing the new code reveals a problem with one particular code snippet, so you enter it in the listener's input area, and press " { $operation walk } " to invoke the single stepper." }
+    { "Single stepping through the code makes the problem obvious, so you right-click on a presentation of the broken word in the stepper, and choose " { $strong "Edit" } " from the menu." }
+    { "After fixing the problem in the source editor, you right click on the word in the stepper and invoke " { $strong "Reload" } " from the menu." }
+} ;
+
+ARTICLE: "ui-completion-words" "Word completion popup"
+"Clicking a word in the word completion popup displays the word definition in the " { $link "ui-browser" } ". Pressing " { $snippet "RET" } " with a word selected inserts the word name in the listener, along with a " { $link POSTPONE: USE: } " declaration (if necessary)."
+{ $operations \ $operations } ;
+
+ARTICLE: "ui-completion-vocabs" "Vocabulary completion popup"
+"Clicking a vocabulary in the vocabulary completion popup displays a list of words in the vocabulary in another " { $link "ui-completion-words" } ". Pressing " { $snippet "RET" } " adds the vocabulary to the current search path, just as if you invoked " { $link POSTPONE: USE: } "."
+{ $operations "kernel" vocab } ;
+
+ARTICLE: "ui-completion-sources" "Source file completion popup"
+"The source file completion popup lists all source files which have been previously loaded by " { $link run-file } ". Clicking a source file  or pressing " { $snippet "RET" } " opens the source file in your editor with " { $link edit } "."
+{ $operations P" " } ;
+
+ARTICLE: "ui-completion" "UI completion popups"
+"Completion popups allow fast access to aspects of the environment. Completion popups can be invoked by clicking the row of buttons along the bottom of the workspace, or via keyboard commands:"
+{ $command-map workspace "toolbar" }
+"A completion popup instantly updates the list of completions as keys are typed. The list of completions can be navigated from the keyboard with the " { $snippet "UP" } " and " { $snippet "DOWN" } " arrow keys. Every completion has a " { $emphasis "primary action" } " and " { $emphasis "secondary action" } ". The primary action is invoked when clicking a completion, and the secondary action is invoked on the currently-selected completion when pressing " { $snippet "RET" } "."
+$nl
+"The primary and secondary actions, along with additional keyboard shortcuts, are documented for some completion popups in the below sections."
+{ $subsection "ui-completion-words" }
+{ $subsection "ui-completion-vocabs" }
+{ $subsection "ui-completion-sources" } ;
+
+ARTICLE: "ui-workspace-keys" "UI keyboard shortcuts"
+{ $command-map workspace "tool-switching" }
+{ $command-map workspace "scrolling" }
+{ $command-map workspace "workflow" }
+{ $heading "Implementation" }
+"Workspaces are instances of " { $link workspace-window } "." ;
+
+ARTICLE: "ui-tools" "UI development tools"
+"The Factor development environment can seem rather different from what you are used to, because it is very simple and powerful.."
+$nl
+"To take full advantage of the UI, you should be using a supported text editor. See " { $link "editor" } "."
+{ $subsection "ui-tool-tutorial" }
+{ $subsection "ui-workspace-keys" }
+{ $subsection "ui-presentations" }
+{ $subsection "ui-completion" }
+{ $heading "Tools" }
+"All development tools are integrated into a single-window " { $emphasis "workspace" } "."
+{ $subsection "ui-listener" }
+{ $subsection "ui-browser" }
+{ $subsection "ui-inspector" }
+{ $subsection "ui-walker" }
+{ $subsection "ui-profiler" }
+"Platform-specific features:"
+{ $subsection "ui-cocoa" } ;
+
+ABOUT: "ui-tools"
diff --git a/extra/ui/tools/tools-tests.factor b/extra/ui/tools/tools-tests.factor
new file mode 100644 (file)
index 0000000..48927a0
--- /dev/null
@@ -0,0 +1,54 @@
+USING: ui.tools ui.tools.interactor ui.tools.listener
+ui.tools.search ui.tools.workspace kernel models namespaces
+sequences timers tools.test ui.gadgets ui.gadgets.buttons
+ui.gadgets.controls ui.gadgets.labelled ui.gadgets.presentations
+ui.gadgets.scrollers vocabs ;
+IN: temporary
+
+[
+    [ f ] [
+        0 <model> <gadget> [ 2drop ] <control> gadget set
+        <workspace-tabs> gadget-children empty?
+    ] unit-test 
+] with-scope
+
+timers get [ init-timers ] unless
+
+[ ] [ <workspace> "w" set ] unit-test
+[ ] [ "w" get com-scroll-up ] unit-test
+[ ] [ "w" get com-scroll-down ] unit-test
+[ t ] [
+    "w" get workspace-book gadget-children
+    [ tool-scroller ] map [ ] subset [ scroller? ] all?
+] unit-test
+[ ] [ "w" get hide-popup ] unit-test
+[ ] [ <gadget> "w" get show-popup ] unit-test
+[ ] [ "w" get hide-popup ] unit-test
+
+[ ] [
+    <gadget> "w" get show-popup
+    <gadget> "w" get show-popup
+    "w" get hide-popup
+] unit-test
+
+[ ] [
+    <workspace> "w" set
+    "w" get graft
+    "w" get "kernel" vocab show-vocab-words
+] unit-test
+
+"w" get workspace-popup closable-gadget-content
+live-search-list gadget-child "p" set
+
+[ t ] [ "p" get presentation? ] unit-test
+
+"p" get <operations-menu> gadget-child gadget-child "c" set
+
+[ t ] [ "c" get button? ] unit-test
+
+[ ] [
+    "w" get workspace-listener listener-gadget-input
+    3 handle-parse-error
+] unit-test
+
+[ ] [ "w" get ungraft ] unit-test
diff --git a/extra/ui/tools/tools.factor b/extra/ui/tools/tools.factor
new file mode 100644 (file)
index 0000000..135bd07
--- /dev/null
@@ -0,0 +1,98 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs debugger ui.tools.workspace
+ui.tools.operations ui.tools.browser ui.tools.inspector
+ui.tools.listener ui.tools.profiler ui.tools.walker
+ui.tools.operations inspector io kernel math models namespaces
+prettyprint quotations sequences ui ui.commands ui.gadgets
+ui.gadgets.books ui.gadgets.buttons ui.gadgets.controls
+ui.gadgets.labelled ui.gadgets.scrollers ui.gadgets.tracks
+ui.gadgets.worlds ui.gadgets.presentations ui.gestures words
+vocabs.loader tools.test ui.gadgets.buttons
+ui.gadgets.status-bar ;
+IN: ui.tools
+
+: workspace-tabs ( -- seq )
+    {
+        <stack-display>
+        <browser-gadget>
+        <inspector-gadget>
+        <walker-gadget>
+        <profiler-gadget>
+    } ;
+
+: <workspace-tabs> ( -- tabs )
+    g control-model
+    "tool-switching" workspace command-map
+    [ command-string ] { } assoc>map
+    [ length ] keep 2array flip
+    <radio-box> ;
+
+: <workspace-book> ( -- gadget )
+    workspace-tabs [ execute ] map g control-model <book> ;
+
+: <workspace> ( -- workspace )
+    0 <model> { 0 1 } <track> workspace construct-control [
+        [
+            <listener-gadget> g set-workspace-listener
+            <workspace-book> g set-workspace-book
+            <workspace-tabs> f track,
+            g workspace-book 1/5 track,
+            g workspace-listener 4/5 track,
+            toolbar,
+        ] with-gadget
+    ] keep ;
+
+: resize-workspace ( workspace -- )
+    dup track-sizes over control-value zero? [
+        1/5 1 pick set-nth
+        4/5 2 rot set-nth
+    ] [
+        2/3 1 pick set-nth
+        1/3 2 rot set-nth
+    ] if relayout ;
+
+M: workspace model-changed
+    dup workspace-listener listener-gadget-output scroll>bottom
+    dup resize-workspace
+    request-focus ;
+
+[ workspace-window ] ui-hook set-global
+
+: com-listener stack-display select-tool ;
+
+: com-browser browser-gadget select-tool ;
+
+: com-inspector inspector-gadget select-tool ;
+
+: com-walker walker-gadget select-tool ;
+
+: com-profiler profiler-gadget select-tool ;
+
+workspace "tool-switching" f {
+    { T{ key-down f f "F2" } com-listener }
+    { T{ key-down f f "F3" } com-browser }
+    { T{ key-down f f "F4" } com-inspector }
+    { T{ key-down f f "F5" } com-walker }
+    { T{ key-down f f "F6" } com-profiler }
+} define-command-map
+
+\ workspace-window
+H{ { +nullary+ t } } define-command
+
+\ refresh-all
+H{ { +nullary+ t } { +listener+ t } } define-command
+
+\ test-changes
+H{ { +nullary+ t } { +listener+ t } } define-command
+
+workspace "workflow" f {
+    { T{ key-down f { C+ } "n" } workspace-window }
+    { T{ key-down f f "ESC" } hide-popup }
+    { T{ key-down f f "F8" } refresh-all }
+    { T{ key-down f { A+ } "F8" } test-changes }
+} define-command-map
+
+[
+    <workspace> "Factor workspace" open-status-window
+] workspace-window-hook set-global
diff --git a/extra/ui/tools/traceback/authors.txt b/extra/ui/tools/traceback/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/traceback/summary.txt b/extra/ui/tools/traceback/summary.txt
new file mode 100644 (file)
index 0000000..2ba495a
--- /dev/null
@@ -0,0 +1 @@
+Traceback gadgets display a continuation in human-readable form
diff --git a/extra/ui/tools/traceback/traceback.factor b/extra/ui/tools/traceback/traceback.factor
new file mode 100644 (file)
index 0000000..e129cc6
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: continuations kernel models namespaces prettyprint ui
+ui.commands ui.gadgets ui.gadgets.controls ui.gadgets.labelled
+ui.gadgets.tracks ui.gestures ;
+IN: ui.tools.traceback
+
+: <callstack-display> ( model -- )
+    [ [ continuation-call callstack. ] when* ]
+    "Call stack" <labelled-pane> ;
+
+: <datastack-display> ( model -- )
+    [ [ continuation-data stack. ] when* ]
+    "Data stack" <labelled-pane> ;
+
+: <retainstack-display> ( model -- )
+    [ [ continuation-retain stack. ] when* ]
+    "Retain stack" <labelled-pane> ;
+
+TUPLE: traceback-gadget ;
+
+M: traceback-gadget pref-dim* drop { 300 400 } ;
+
+: <traceback-gadget> ( model -- gadget )
+    { 0 1 } <track> traceback-gadget construct-control [
+        [
+            [
+                g control-model <datastack-display> 1/2 track,
+                g control-model <retainstack-display> 1/2 track,
+            ] { 1 0 } make-track 1/2 track,
+            g control-model <callstack-display> 1/2 track,
+        ] with-gadget
+    ] keep ;
+
+: traceback-window ( continuation -- )
+    <model> <traceback-gadget> "Traceback" open-window ;
diff --git a/extra/ui/tools/walker/authors.txt b/extra/ui/tools/walker/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/walker/summary.txt b/extra/ui/tools/walker/summary.txt
new file mode 100644 (file)
index 0000000..d75927e
--- /dev/null
@@ -0,0 +1 @@
+Graphical code single stepper
diff --git a/extra/ui/tools/walker/tags.txt b/extra/ui/tools/walker/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/walker/walker-tests.factor b/extra/ui/tools/walker/walker-tests.factor
new file mode 100644 (file)
index 0000000..7cbb758
--- /dev/null
@@ -0,0 +1,54 @@
+USING: arrays continuations ui.tools.listener ui.tools.walker
+ui.tools.workspace inspector kernel namespaces sequences threads
+listener tools.test ui ui.gadgets ui.gadgets.worlds
+ui.gadgets.packs vectors ui.tools ;
+IN: temporary
+
+[ ] [ <walker-gadget> "walker" set ] unit-test
+
+! Make sure the toolbar buttons don't throw if we're
+! not actually walking.
+
+[ ] [ "walker" get com-step ] unit-test
+[ ] [ "walker" get com-into ] unit-test
+[ ] [ "walker" get com-out ] unit-test
+[ ] [ "walker" get com-back ] unit-test
+[ ] [ "walker" get com-inspect ] unit-test
+[ ] [ "walker" get reset-walker ] unit-test
+[ ] [ "walker" get com-continue ] unit-test
+[ ] [ "walker" get com-abandon ] unit-test
+
+: <test-world> ( gadget -- world )
+    [ gadget, ] make-pile "Hi" f <world> ;
+
+[
+    f <workspace>
+    [ <test-world> 2array 1vector windows set ] keep
+
+    "ok" off
+
+    [
+        workspace-listener
+        listener-gadget-input
+        "ok" on
+        parse-interactive
+        "c" get continue-with
+    ] in-thread drop
+
+    [ t ] [ "ok" get ] unit-test
+
+    [ ] [ <walker-gadget> "w" set ] unit-test
+    continuation "c" set
+    
+    [ ] [ "c" get "w" get call-tool* ] unit-test
+
+    [ ] [
+        [ "c" set f ] callcc1
+        [ "q" set ] [ "w" get com-inspect stop ] if*
+    ] unit-test
+    
+    [ t ] [
+        "q" get dup first continuation?
+        swap second \ inspect eq? and
+    ] unit-test
+] with-scope
diff --git a/extra/ui/tools/walker/walker.factor b/extra/ui/tools/walker/walker.factor
new file mode 100644 (file)
index 0000000..efd54f0
--- /dev/null
@@ -0,0 +1,99 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs ui.tools.listener ui.tools.traceback
+ui.tools.workspace inspector kernel models namespaces
+prettyprint quotations sequences threads tools.interpreter
+ui.commands ui.gadgets ui.gadgets.labelled ui.gadgets.tracks
+ui.gestures ui.gadgets.buttons ui.gadgets.panes
+prettyprint.config prettyprint.backend ;
+IN: ui.tools.walker
+
+: quotation. ( callframe -- )
+    [
+        dup second hilite-index set
+        dup first hilite-quotation set
+        2 nesting-limit set
+        first pprint-elements
+    ] with-pprint ;
+
+: <quotation-display> ( model -- gadget )
+    [ quotation. ] <pane-control>
+    "Current quotation" <labelled-scroller> ;
+
+TUPLE: walker-gadget model quot ns ;
+
+: update-stacks ( walker -- )
+    meta-interp get
+    over walker-gadget-model set-model
+    callframe get callframe-scan get 2array
+    swap walker-gadget-quot set-model ;
+
+: with-walker ( gadget quot -- )
+    swap dup walker-gadget-ns
+    [ slip update-stacks ] bind ; inline
+
+: walker-active? ( walker -- ? )
+    meta-interp swap walker-gadget-ns key? ;
+
+: walker-command ( gadget quot -- )
+    over walker-active? [ with-walker ] [ 2drop ] if ; inline
+
+: com-step [ step ] walker-command ;
+: com-into [ step-in ] walker-command ;
+: com-out [ step-out ] walker-command ;
+: com-back [ step-back ] walker-command ;
+
+: init-walker-models ( walker -- )
+    f <model> over set-walker-gadget-quot
+    f <model> over set-walker-gadget-model
+    H{ } clone swap set-walker-gadget-ns ;
+
+: reset-walker ( walker -- )
+    dup walker-gadget-ns clear-assoc
+    [ V{ } clone meta-history set ] with-walker ;
+
+: <walker-gadget> ( -- gadget )
+    walker-gadget construct-empty
+    dup init-walker-models [
+        toolbar,
+        g walker-gadget-quot <quotation-display> 1/4 track,
+        g walker-gadget-model <traceback-gadget> 3/4 track,
+    ] { 0 1 } build-track
+    dup reset-walker ;
+
+M: walker-gadget call-tool* ( continuation walker -- )
+    [ restore ] with-walker ;
+
+: com-inspect ( walker -- )
+    dup walker-active? [
+        meta-interp swap walker-gadget-ns at
+        [ inspect ] curry call-listener
+    ] [
+        drop
+    ] if ;
+
+: com-continue ( walker -- )
+    dup [ step-all ] walker-command reset-walker ;
+
+: com-abandon ( walker -- )
+    dup [ abandon ] walker-command reset-walker ;
+
+: walker-help "ui-walker" help-window ;
+
+\ walker-help H{ { +nullary+ t } } define-command
+
+walker-gadget "toolbar" f {
+    { T{ key-down f { A+ } "s" } com-step }
+    { T{ key-down f { A+ } "i" } com-into }
+    { T{ key-down f { A+ } "o" } com-out }
+    { T{ key-down f { A+ } "b" } com-back }
+    { T{ key-down f { A+ } "c" } com-continue }
+    { T{ key-down f f "F1" } walker-help }
+} define-command-map
+
+walker-gadget "other" f {
+    { T{ key-down f { A+ } "a" } com-abandon }
+    { T{ key-down f { A+ } "n" } com-inspect }
+} define-command-map
+
+[ walker-gadget call-tool stop ] break-hook set-global
diff --git a/extra/ui/tools/workspace/authors.txt b/extra/ui/tools/workspace/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/tools/workspace/summary.txt b/extra/ui/tools/workspace/summary.txt
new file mode 100644 (file)
index 0000000..f7e3245
--- /dev/null
@@ -0,0 +1 @@
+Graphical development environment
diff --git a/extra/ui/tools/workspace/tags.txt b/extra/ui/tools/workspace/tags.txt
new file mode 100644 (file)
index 0000000..ef1aab0
--- /dev/null
@@ -0,0 +1 @@
+tools
diff --git a/extra/ui/tools/workspace/workspace.factor b/extra/ui/tools/workspace/workspace.factor
new file mode 100644 (file)
index 0000000..0e68b6a
--- /dev/null
@@ -0,0 +1,95 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: classes continuations help help.topics kernel models
+sequences ui ui.backend ui.tools.debugger ui.gadgets
+ui.gadgets.books ui.gadgets.buttons ui.gadgets.controls
+ui.gadgets.labelled ui.gadgets.panes ui.gadgets.scrollers
+ui.gadgets.tracks ui.gadgets.worlds ui.gadgets.presentations
+ui.gadgets.status-bar ui.commands ui.gestures assocs arrays
+namespaces ;
+IN: ui.tools.workspace
+
+TUPLE: workspace book listener popup ;
+
+: find-workspace [ workspace? ] find-parent ;
+
+SYMBOL: workspace-window-hook
+
+: workspace-window ( -- workspace )
+    workspace-window-hook get call ;
+
+GENERIC: call-tool* ( arg tool -- )
+
+GENERIC: tool-scroller ( tool -- scroller )
+
+M: gadget tool-scroller drop f ;
+
+: find-tool ( class workspace -- index tool )
+    workspace-book gadget-children [ class eq? ] curry* find ;
+
+: show-tool ( class workspace -- tool )
+    [ find-tool swap ] keep workspace-book control-model
+    set-model ;
+
+: select-tool ( workspace class -- ) swap show-tool drop ;
+
+: get-workspace* ( quot -- workspace )
+    [ dup workspace? [ over call ] [ drop f ] if ] find-window
+    [ nip dup raise-window gadget-child ]
+    [ workspace-window get-workspace* ] if* ; inline
+
+: get-workspace ( -- workspace ) [ drop t ] get-workspace* ;
+
+: call-tool ( arg class -- )
+    get-workspace show-tool call-tool* ;
+
+: get-tool ( class -- gadget )
+    get-workspace find-tool nip ;
+
+: help-window ( topic -- )
+    [ <pane> [ [ help ] with-pane ] keep <scroller> ] keep
+    article-title open-window ;
+
+: hide-popup ( workspace -- )
+    dup workspace-popup over track-remove
+    f over set-workspace-popup
+    request-focus ;
+
+: show-popup ( gadget workspace -- )
+    dup hide-popup
+    2dup set-workspace-popup
+    dupd f track-add
+    request-focus ;
+
+: show-titled-popup ( workspace gadget title -- )
+    [ find-workspace hide-popup ] <closable-gadget>
+    swap show-popup ;
+
+: debugger-popup ( error workspace -- )
+    swap dup compute-restarts
+    [ find-workspace hide-popup ] <debugger>
+    "Error" show-titled-popup ;
+
+M: workspace pref-dim* drop { 600 750 } ;
+
+M: workspace focusable-child*
+    dup workspace-popup [ ] [ workspace-listener ] ?if ;
+
+: workspace-page ( workspace -- gadget )
+    workspace-book current-page ;
+
+M: workspace tool-scroller ( workspace -- scroller )
+    workspace-page tool-scroller ;
+
+: com-scroll-up ( workspace -- )
+    tool-scroller [ scroll-up-page ] when* ;
+
+: com-scroll-down ( workspace -- )
+    tool-scroller [ scroll-down-page ] when* ;
+
+workspace "scrolling"
+"The current tool's scroll pane can be scrolled from the keyboard."
+{
+    { T{ key-down f { C+ } "PAGE_UP" } com-scroll-up }
+    { T{ key-down f { C+ } "PAGE_DOWN" } com-scroll-down }
+} define-command-map
diff --git a/extra/ui/traverse/authors.txt b/extra/ui/traverse/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/ui/traverse/summary.txt b/extra/ui/traverse/summary.txt
new file mode 100644 (file)
index 0000000..f6a3a86
--- /dev/null
@@ -0,0 +1 @@
+Gadget tree traversal
diff --git a/extra/ui/traverse/traverse-tests.factor b/extra/ui/traverse/traverse-tests.factor
new file mode 100644 (file)
index 0000000..96eaed6
--- /dev/null
@@ -0,0 +1,65 @@
+IN: temporary
+USING: ui.gadgets ui.gadgets.labels namespaces sequences kernel
+math arrays tools.test io ui.gadgets.panes ui.traverse
+definitions ;
+
+M: array gadget-children ;
+
+GENERIC: (flatten-tree) ( node -- )
+
+M: node (flatten-tree)
+    node-children [ (flatten-tree) ] each ;
+
+M: object (flatten-tree) , ;
+
+: flatten-tree ( seq -- newseq )
+    [ [ (flatten-tree) ] each ] { } make ;
+
+: gadgets-in-range ( frompath topath gadget -- seq )
+    gadget-subtree flatten-tree ;
+
+[ { "a" "b" "c" "d" } ] [
+    { 0 } { } { "a" "b" "c" "d" } gadgets-in-range
+] unit-test
+
+[ { "a" "b" } ] [
+    { } { 1 } { "a" "b" "c" "d" } gadgets-in-range
+] unit-test
+
+[ { "a" } ] [
+    { 0 } { 0 } { "a" "b" "c" "d" } gadgets-in-range
+] unit-test
+
+[ { "a" "b" "c" } ] [
+    { 0 } { 2 } { "a" "b" "c" "d" } gadgets-in-range
+] unit-test
+
+[ { "a" "b" "c" "d" } ] [
+    { 0 } { 3 } { "a" "b" "c" "d" } gadgets-in-range
+] unit-test
+
+[ { "a" "b" "c" "d" } ] [
+    { 0 0 } { 0 3 } { { "a" "b" "c" "d" } } gadgets-in-range
+] unit-test
+
+[ { "b" "c" "d" "e" } ] [
+    { 0 1 } { 1 } { { "a" "b" "c" "d" } "e" } gadgets-in-range
+] unit-test
+
+[ { "b" "c" "d" "e" "f" } ] [
+    { 0 1 } { 1 1 } { { "a" "b" "c" "d" } { "e" "f" "g" } } gadgets-in-range
+] unit-test
+
+[ { "b" "c" "d" { "e" "f" "g" } "h" "i" } ] [
+    { 0 1 } { 2 1 } { { "a" "b" "c" "d" } { "e" "f" "g" } { "h" "i" } } gadgets-in-range
+] unit-test
+
+[ { "b" "c" "d" { "e" "f" "g" } "h" } ] [
+    { 0 1 } { 2 0 0 } { { "a" "b" "c" "d" } { "e" "f" "g" } { { "h" "i" } "j" } } gadgets-in-range
+] unit-test
+
+[ { "b" "c" "d" { "e" "f" "g" } "h" "i" } ] [
+    { 0 1 } { 2 0 1 } { { "a" "b" "c" "d" } { "e" "f" "g" } { { "h" "i" } "j" } } gadgets-in-range
+] unit-test
+
+{ array gadget-children } forget
diff --git a/extra/ui/traverse/traverse.factor b/extra/ui/traverse/traverse.factor
new file mode 100644 (file)
index 0000000..72f1404
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces sequences kernel math arrays io ui.gadgets
+generic combinators ;
+IN: ui.traverse
+
+TUPLE: node value children ;
+
+: traverse-step ( path gadget -- path' gadget' )
+    >r unclip r> gadget-children ?nth ;
+
+: make-node ( quot -- ) { } make node construct-boa , ; inline
+
+: traverse-to-path ( topath gadget -- )
+    dup not [
+        2drop
+    ] [
+        over empty? [
+            nip ,
+        ] [
+            [
+                2dup gadget-children swap first head-slice %
+                tuck traverse-step traverse-to-path
+            ] make-node
+        ] if
+    ] if ;
+
+: traverse-from-path ( frompath gadget -- )
+    dup not [
+        2drop
+    ] [
+        over empty? [
+            nip ,
+        ] [
+            [
+                2dup traverse-step traverse-from-path
+                tuck gadget-children swap first 1+ tail-slice %
+            ] make-node
+        ] if
+    ] if ;
+
+: traverse-pre ( frompath gadget -- )
+    traverse-step traverse-from-path ;
+
+: (traverse-middle) ( frompath topath gadget -- )
+    >r >r first 1+ r> first r> gadget-children <slice> % ;
+
+: traverse-post ( topath gadget -- )
+    traverse-step traverse-to-path ;
+
+: traverse-middle ( frompath topath gadget -- )
+    [
+        3dup nip traverse-pre
+        3dup (traverse-middle)
+        2dup traverse-post
+        2nip
+    ] make-node ;
+
+DEFER: (gadget-subtree)
+
+: traverse-child ( frompath topath gadget -- )
+    dup -roll [
+        >r >r 1 tail-slice r> r> traverse-step (gadget-subtree)
+    ] make-node ;
+
+: (gadget-subtree) ( frompath topath gadget -- )
+    {
+        { [ dup not ] [ 3drop ] }
+        { [ pick empty? pick empty? and ] [ 2nip , ] }
+        { [ pick empty? ] [ rot drop traverse-to-path ] }
+        { [ over empty? ] [ nip traverse-from-path ] }
+        { [ pick first pick first = ] [ traverse-child ] }
+        { [ t ] [ traverse-middle ] }
+    } cond ;
+
+: gadget-subtree ( frompath topath gadget -- seq )
+    [ (gadget-subtree) ] { } make ;
+
+M: node gadget-text*
+    dup node-children swap node-value gadget-seq-text ;
+
+: gadget-text-range ( frompath topath gadget -- str )
+    gadget-subtree gadget-text ;
+
+: gadget-at-path ( parent path -- gadget )
+    [ swap nth-gadget ] each ;
diff --git a/extra/ui/ui-docs.factor b/extra/ui/ui-docs.factor
new file mode 100644 (file)
index 0000000..e9e3a05
--- /dev/null
@@ -0,0 +1,378 @@
+USING: ui.gadgets.worlds ui.gadgets ui.backend help.markup
+help.syntax strings quotations debugger io.styles namespaces
+ui.gadgets.tracks ui.gadgets.packs ui.gadgets.grids
+ui.gadgets.frames ui.gadgets.books ui.gadgets.panes
+ui.gadgets.incremental ;
+IN: ui
+
+HELP: windows
+{ $var-description "Global variable holding an association list mapping native window handles to " { $link world } " instances." } ;
+
+{ windows open-window find-window } related-words
+
+HELP: open-window
+{ $values { "gadget" gadget } { "title" string } }
+{ $description "Opens a native window with the specified title." } ;
+
+HELP: find-window
+{ $values { "quot" "a quotation with stack effect " { $snippet "( world -- ? )" } } { "world" "a " { $link world } " or " { $link f } } }
+{ $description "Finds a native window whose world satisfies the quotation, outputting " { $link f } " if no such world could be found. The front-most native window is checked first." } ;
+
+HELP: start-world
+{ $values { "world" world } }
+{ $description "Starts a world." }
+{ $notes "This word should be called by the UI backend after " { $link register-window } ", but before making the world's containing window visible on the screen." } ;
+
+HELP: register-window
+{ $values { "world" world } { "handle" "a baackend-specific handle" } }
+{ $description "Adds a window to the global " { $link windows } " variable." }
+{ $notes "This word should only be called by the UI backend.  User code can open new windows with " { $link open-window } "." } ;
+
+HELP: unregister-window
+{ $values { "handle" "a baackend-specific handle" } }
+{ $description "Removes a window from the global " { $link windows } " variable." }
+{ $notes "This word should only be called only by the UI backend, and not user code." } ;
+
+HELP: ui
+{ $description "Starts the Factor UI." } ;
+
+HELP: start-ui
+{ $description "Called by the UI backend to initialize the platform-independent parts of UI. This word should be called after the backend is ready to start displaying new windows, and before the event loop starts." } ;
+
+HELP: (open-world-window)
+{ $values { "world" world } }
+{ $description "Opens a native window containing the given world. This grafts the world by calling " { $link graft } ". Each world can only be displayed in one top-level window at a time." }
+{ $notes "This word should not be called directly by user code. Instead, use " { $link open-window } "." } ;
+
+HELP: ui-try
+{ $values { "quot" quotation } }
+{ $description "Calls the quotation. If it throws an error, opens a window with the error and restores the data stack." }
+{ $notes "This is essentially a graphical variant of " { $link try } "." } ;
+
+HELP: stop-world
+{ $values { "world" world } }
+{ $description "Stops a world." }
+{ $notes "This word should only be called by the UI backend, and not user code." } ;
+
+ARTICLE: "ui-glossary" "UI glossary"
+{ $table
+    { "color specifier"
+        { "an array of four elements, all numbers between 0 and 1:"
+            { $list
+                "red"
+                "green"
+                "blue"
+                "alpha - 0 is completely transparent, 1 is completely opaque"
+            }
+        }
+    }
+    { "dimension" "a pair of integers denoting pixel size on screen" }
+    { "font specifier"
+        { "an array of three elements:"
+            { $list
+                { "font family - one of " { $snippet "serif" } ", " { $snippet "sans-serif" } " or " { $snippet "monospace" } }
+                { "font style - one of " { $link plain } ", " { $link bold } ", " { $link italic } " or " { $link bold-italic } }
+                "font size in points"
+            }
+        }
+    }
+    { "gadget" { "a graphical element which responds to user input. Gadgets are tuples which (directly or indirectly) delegate to " { $link gadget } " instances." } }
+    { "label specifier" { "a string, " { $link f } " or a gadget. See " { $link "ui.gadgets.buttons" } } }
+    { "orientation specifier" { "one of " { $snippet "{ 0 1 }" } " or " { $snippet "{ 1 0 }" } ", with the former denoting vertical orientation and the latter denoting horizontal. Using a vector instead of symbolic constants allows these values to be directly useful in co-ordinate calculations" } }
+    { "point" "a pair of integers denoting a pixel location on screen" }
+} ;
+
+ARTICLE: "building-ui" "Building user interfaces"
+"A gadget is a graphical element which responds to user input. Gadgets are implemented as tuples which (directly or indirectly) delegate to instances of " { $link gadget } ", which in turn delegates to " { $link rect } "."
+{ $subsection gadget }
+"Gadgets are arranged in a hierarchy, and all visible gadgets except for instances of " { $link world } " are contained in a parent gadget, stored in the " { $link gadget-parent } " slot."
+{ $subsection "ui-geometry" }
+{ $subsection "ui-layouts" }
+{ $subsection "gadgets" }
+{ $subsection "models" }
+{ $subsection "ui-windows" } ;
+
+ARTICLE: "gadgets" "Pre-made UI gadgets"
+{ $subsection "ui.gadgets.labels" }
+{ $subsection "gadgets-polygons" }
+{ $subsection "ui.gadgets.borders" }
+{ $subsection "ui.gadgets.labelled" }
+{ $subsection "ui.gadgets.buttons" }
+{ $subsection "ui.gadgets.sliders" }
+{ $subsection "ui.gadgets.scrollers" }
+{ $subsection "gadgets-editors" }
+{ $subsection "ui.gadgets.panes" }
+{ $subsection "ui.gadgets.presentations" }
+{ $subsection "ui.gadgets.lists" } ;
+
+ARTICLE: "ui-geometry" "Gadget geometry"
+"Instances of " { $link gadget } " (and thus all gadgets) delegate to rectangles which specify the gadget's bounding box:"
+{ $subsection rect }
+"Rectangles can be taken apart:"
+{ $subsection rect-loc }
+{ $subsection rect-dim }
+{ $subsection rect-bounds }
+{ $subsection rect-extent }
+"New rectangles can be created:"
+{ $subsection <zero-rect> }
+{ $subsection <rect> }
+{ $subsection <extent-rect> }
+"More utility words for working with rectangles:"
+{ $subsection offset-rect }
+{ $subsection rect-intersect }
+{ $subsection intersects? }
+"A gadget's bounding box is always relative to its parent:"
+{ $subsection gadget-parent }
+"Word for converting from a child gadget's co-ordinate system to a parent's:"
+{ $subsection relative-loc }
+{ $subsection screen-loc }
+"Hit testing:"
+{ $subsection pick-up }
+{ $subsection children-on } ;
+
+ARTICLE: "ui-windows" "Top-level windows"
+"Opening a top-level window:"
+{ $subsection open-window }
+"Finding top-level windows:"
+{ $subsection find-window }
+"Top-level windows are stored in a global variable:"
+{ $subsection windows }
+"When a gadget is displayed in a top-level window, or added to a parent which is already showing in a top-level window, a generic word is called allowing the gadget to perform initialization tasks:"
+{ $subsection graft* }
+"When the gadget is removed from a parent shown in a top-level window, or when the top-level window is closed, a corresponding generic word is called to clean up:"
+{ $subsection ungraft* }
+"The root of the gadget hierarchy in a window is a special gadget which is rarely operated on directly, but it is helpful to know it exists:"
+{ $subsection world } ;
+
+ARTICLE: "ui-backend" "Developing UI backends"
+"None of the words documented in this section should be called directly by user code. They are only of interest when developing new UI backends."
+{ $subsection "ui-backend-init" }
+{ $subsection "ui-backend-windows" }
+"UI backends may implement the " { $link "clipboard-protocol" } "." ;
+
+ARTICLE: "ui-backend-init" "UI initialization and the event loop"
+"An UI backend is required to define a word to start the UI:"
+{ $subsection ui }
+"This word should contain backend initialization, together with some boilerplate:"
+{ $code
+    "IN: shells"
+    ""
+    ": ui"
+    "    ... backend-specific initialization ..."
+    "    start-ui"
+    "    ... more backend-specific initialization ..."
+    "    ... start event loop here ... ;"
+}
+"The above word must call the following:"
+{ $subsection start-ui }
+"The " { $link ui } " word must not return until the event loop has stopped and the UI has been shut down."
+$nl
+"The event loop must not block. Instead, it should poll for pending events, then call " { $link ui-step } ", which performs pending layout, runs timers and sleeps for 10 milliseconds, or until a Factor thread wakes up." ;
+
+ARTICLE: "ui-backend-windows" "UI backend window management"
+"The high-level " { $link open-window } " word eventually calls a low-level word which you must implement:"
+{ $subsection open-world-window }
+"This word should create a native window, store some kind of handle in the " { $link world-handle } " slot, then call two words:"
+{ $subsection register-window }
+{ $subsection start-world }
+"The following words must also be implemented:"
+{ $subsection set-title }
+{ $subsection raise-window }
+"When a world needs to be redrawn, the UI will call a word automatically:"
+{ $subsection draw-world }
+"This word can also be called directly if the UI backend is notified by the window system that window contents have been invalidated. Before and after drawing, two words are called, which the UI backend must implement:"
+{ $subsection select-gl-context }
+{ $subsection flush-gl-context }
+"If the user clicks the window's close box, you must call the following two words in sequence:"
+{ $subsection stop-world }
+{ $subsection unregister-window } ;
+
+ARTICLE: "ui-layouts" "Gadget hierarchy and layouts"
+"A layout gadget is a gadget whose sole purpose is to contain other gadgets. Layout gadgets position and resize children according to a certain policy, taking the preferred size of the children into account. Gadget hierarchies are constructed by building up nested layouts."
+{ $subsection "ui-layout-basics" }
+{ $subsection "ui-layout-combinators" }
+"Common layout gadgets:"
+{ $subsection "ui-pack-layout" }
+{ $subsection "ui-track-layout" }
+{ $subsection "ui-grid-layout" }
+{ $subsection "ui-frame-layout" }
+{ $subsection "ui-book-layout" }
+"Advanced topics:"
+{ $subsection "ui-null-layout" }
+{ $subsection "ui-incremental-layout" }
+{ $subsection "ui-layout-impl" }
+{ $see-also "ui.gadgets.borders" } ;
+
+ARTICLE: "ui-layout-basics" "Layout basics"
+"Gadgets are arranged in a hierarchy, and all visible gadgets except for instances of " { $link world } " are contained in a parent gadget."
+$nl
+"Managing the gadget hierarchy:"
+{ $subsection add-gadget }
+{ $subsection unparent }
+{ $subsection add-gadgets }
+{ $subsection clear-gadget }
+"Working with gadget children:"
+{ $subsection gadget-children }
+{ $subsection gadget-child }
+{ $subsection nth-gadget }
+{ $subsection each-child }
+{ $subsection child? }
+"Working with gadget parents:"
+{ $subsection parents }
+{ $subsection each-parent }
+{ $subsection find-parent }
+"Adding children, removing children and performing certain other operations initiates relayout requests automatically. In other cases, relayout may have to be triggered explicitly. There is no harm from doing this several times in a row as consecutive relayout requests are coalesced."
+{ $subsection relayout }
+{ $subsection relayout-1 }
+"Gadgets implement a generic word to inform their parents of their preferred size:"
+{ $subsection pref-dim* }
+"To get a gadget's preferred size, do not call the above word, instead use " { $link pref-dim  } ",  which caches the result." ;
+
+ARTICLE: "ui-layout-combinators" "Creating layouts using combinators"
+"The " { $link make } " combinator provides a convenient way of constructing sequences by keeping the intermediate sequence off the stack until construction is done. The " { $link , } " and " { $link % } " words operate on this implicit sequence, reducing stack noise."
+$nl
+"Similar tools exist for constructing complex gadget hierarchies. Different words are used for different types of gadgets; see " { $link "ui-pack-layout" } ", " { $link "ui-track-layout" } " and " { $link "ui-frame-layout" } " for specifics. This section documents their common factors."
+$nl
+"Gadget construction combinators whose names are prefixed with " { $snippet "make-" } " construct new gadgets and push them on the stack. The primitive combinator used to define all combinators of this form:"
+{ $subsection make-gadget }
+"Words such as " { $link gadget, } " and " { $link track, } " access the gadget through the " { $link make-gadget } " variable."
+$nl
+"Combinators whose names are prefixed with " { $snippet "build-" } " take a tuple as input, and construct a new gadget which the tuple will delegate to. The primitive combinator used to define all combinators of this form:"
+{ $subsection build-gadget }
+"In this case, the new gadget is stored in both the " { $link make-gadget } " and " { $link gadget } " variables."
+$nl
+"A combinator which stores a gadget in the " { $link gadget } " variable; it is used by " { $link build-gadget } ":"
+{ $subsection with-gadget }
+"The following words access the " { $link gadget } " variable; they can be used from " { $link with-gadget } " and " { $link build-gadget } " to store child gadgets in tuple slots:"
+{ $subsection g }
+{ $subsection g-> } ;
+
+ARTICLE: "ui-pack-layout" "Pack layouts"
+"Pack gadgets layout their children along a single axis."
+{ $subsection pack }
+"Creating empty packs:"
+{ $subsection <pack> }
+{ $subsection <pile> }
+{ $subsection <shelf> }
+"Creating packs using a combinator:"
+{ $subsection make-pile }
+{ $subsection make-filled-pile }
+{ $subsection make-shelf }
+{ $subsection gadget, }
+"For more control, custom layouts can reuse portions of pack layout logic:"
+{ $subsection pack-pref-dim }
+{ $subsection pack-layout } ;
+
+ARTICLE: "ui-track-layout" "Track layouts"
+"Track gadgets are like " { $link "ui-pack-layout" } " except each child is resized to a fixed multiple of the track's dimension."
+{ $subsection track }
+"Creating empty tracks:"
+{ $subsection <track> }
+"Adding children:"
+{ $subsection track-add }
+"Creating new tracks using a combinator:"
+{ $subsection make-track }
+{ $subsection build-track }
+{ $subsection track, }
+"New gadgets can be defined which delegate to tracks for layout:"
+{ $subsection build-track } ;
+
+ARTICLE: "ui-grid-layout" "Grid layouts"
+"Grid gadgets layout their children in a rectangular grid."
+{ $subsection grid }
+"Creating grids from a fixed set of gadgets:"
+{ $subsection <grid> }
+"Managing chidren:"
+{ $subsection grid-add }
+{ $subsection grid-remove }
+{ $subsection grid-child } ;
+
+ARTICLE: "ui-frame-layout" "Frame layouts"
+"Frames resemble " { $link "ui-grid-layout" } " except the size of grid is fixed at 3x3, and the center gadget fills up any available space. Because frames delegate to grids, grid layout words can be used to add and remove children."
+{ $subsection frame }
+"Creating empty frames:"
+{ $subsection <frame> }
+"Creating new frames using a combinator:"
+{ $subsection make-frame }
+{ $subsection build-frame }
+{ $subsection frame, }
+"New gadgets can be defined which delegate to frames for layout:"
+{ $subsection build-frame }
+"A set of mnemonic words for the positions on a frame's 3x3 grid; these words push values which may be passed to " { $link grid-add } " or " { $link frame, } ":"
+{ $subsection @center }
+{ $subsection @left }
+{ $subsection @right }
+{ $subsection @top }
+{ $subsection @bottom }
+{ $subsection @top-left }
+{ $subsection @top-right }
+{ $subsection @bottom-left }
+{ $subsection @bottom-right } ;
+
+ARTICLE: "ui-book-layout" "Book layouts"
+"Books can contain any number of children, and display one child at a time."
+{ $subsection book }
+{ $subsection <book> } ;
+
+ARTICLE: "ui-null-layout" "Manual layouts"
+"When automatic layout is not appropriate, gadgets can be added to a parent with no layout policy, and then positioned and sized manually:"
+{ $subsection set-rect-loc }
+{ $subsection set-gadget-dim } ;
+
+ARTICLE: "ui-incremental-layout" "Incremental layouts"
+"Incremental layout gadgets are like " { $link "ui-pack-layout" } " except the relayout operation after adding a new child can be done in constant time."
+$nl
+"With all layouts, relayout requests from consecutive additions and removals are of children are coalesced and result in only one relayout operation being performed, however the run time of the relayout operation itself depends on the number of children."
+$nl
+"Incremental layout is used by " { $link pane } " gadgets to ensure that new lines of output does not take longer to display when the pane already has previous output."
+$nl
+"Incremental layouts are not a general replacement for " { $link "ui-pack-layout" } " and there are some limitations to be aware of."
+{ $subsection incremental }
+{ $subsection <incremental> }
+"Children are added and removed with a special set of words which perform necessary relayout immediately:"
+{ $subsection add-incremental }
+{ $subsection clear-incremental }
+"Calling " { $link unparent } " to remove a child of an incremental layout is permitted, however the relayout following the removal will not be performed in constant time, because all gadgets following the removed gadget need to be moved." ;
+
+ARTICLE: "ui-layout-impl" "Implementing layout gadgets"
+"The relayout process proceeds top-down, with parents laying out their children, which in turn lay out their children. Custom layout policy is implemented by defining a method on a generic word:"
+{ $subsection layout* }
+"When a " { $link layout* } " method is called, the size and location of the gadget has already been determined by its parent, and the method's job is to lay out the gadget's children. Children can be positioned and resized with a pair of words:"
+{ $subsection set-rect-loc }
+{ $subsection set-layout-dim }
+"Some assorted utility words which are useful for implementing layout logic:"
+{ $subsection pref-dim }
+{ $subsection pref-dims }
+{ $subsection prefer }
+{ $subsection max-dim }
+{ $subsection dim-sum }
+{ $warning
+    "When implementing the " { $link layout* } " generic word for a gadget which intends to delegate to another layout, the " { $link children-on } " word might have to be re-implemented as well."
+    $nl
+    "For example, suppose you want a " { $link grid } " layout which also displays a popup gadget on top. The implementation of " { $link children-on } " for the " { $link grid } " class determines which children of the grid are visible at one time, and this will never include your popup, so it will not be rendered, nor will it respond to gestures. The solution is to re-implement " { $link children-on } " on your class."
+} ;
+
+ARTICLE: "new-gadgets" "Implementing new gadgets"
+"One of the goals of the Factor UI is to minimize the need to implement new types of gadgets by offering a highly reusable, orthogonal set of building blocks. However, in some cases implementing a new type of gadget is necessary, for example when writing a graphical visualization."
+$nl
+"Bare gadgets can be constructed directly, which is useful if all you need is a custom appearance with no further behavior (see " { $link "ui-pen-protocol" } "):"
+{ $subsection <gadget> }
+"You can construct a new tuple which delegates to a bare gadget:"
+{ $subsection construct-gadget }
+"You can also delegate a tuple to an existing gadget:"
+{ $subsection set-gadget-delegate }
+"Further topics:"
+{ $subsection "ui-gestures" }
+{ $subsection "ui-paint" }
+{ $subsection "ui-control-impl" }
+{ $subsection "clipboard-protocol" }
+{ $subsection "timers" }
+{ $see-also "ui-layout-impl" } ;
+
+ARTICLE: "ui" "UI framework"
+{ $subsection "ui-glossary" }
+{ $subsection "building-ui" }
+{ $subsection "new-gadgets" }
+{ $subsection "ui-backend" } ;
+
+ABOUT: "ui"
diff --git a/extra/ui/ui.factor b/extra/ui/ui.factor
new file mode 100644 (file)
index 0000000..e93496c
--- /dev/null
@@ -0,0 +1,140 @@
+! Copyright (C) 2006, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays assocs io kernel math models namespaces
+prettyprint queues sequences threads sequences words timers
+debugger ui.gadgets ui.gadgets.worlds ui.gadgets.tracks
+ui.gestures ui.backend ui.render continuations init ;
+IN: ui
+
+! Assoc mapping aliens to gadgets
+SYMBOL: windows
+
+: window ( handle -- world ) windows get-global at ;
+
+: window-focus ( handle -- gadget ) window world-focus ;
+
+: register-window ( world handle -- )
+    #! Add the new window just below the topmost window. Why?
+    #! So that if the new window doesn't actually receive focus
+    #! (eg, we're using focus follows mouse and the mouse is not
+    #! in the new window when it appears) Factor doesn't get
+    #! confused and send workspace operations to the new window,
+    #! etc.
+    swap 2array windows get-global push
+    windows get-global dup length 1 >
+    [ [ length 1- dup 1- ] keep exchange ] [ drop ] if ;
+
+: unregister-window ( handle -- )
+    windows global [ [ first = not ] curry* subset ] change-at ;
+
+: raised-window ( world -- )
+    windows get-global [ second eq? ] curry* find drop
+    windows get-global [ length 1- ] keep exchange ;
+
+: focus-world ( world -- )
+    t over set-world-focused?
+    dup raised-window
+    focus-path f focus-gestures ;
+
+: unfocus-world ( world -- )
+    f over set-world-focused?
+    focus-path f swap focus-gestures ;
+
+: reset-world ( world -- )
+    dup world-fonts clear-assoc
+    dup unfocus-world
+    f swap set-world-handle ;
+
+: stop-world ( world -- )
+    dup ungraft
+    dup hand-clicked close-global
+    dup hand-gadget close-global
+    dup free-fonts
+    reset-world ;
+
+: open-world-window ( world -- )
+    dup pref-dim over set-gadget-dim
+    dup (open-world-window)
+    dup draw-world ;
+
+: open-window ( gadget title -- )
+    >r [ 1 track, ] { 0 1 } make-track r>
+    f <world> open-world-window ;
+
+: find-window ( quot -- world )
+    windows get 1 <column>
+    [ gadget-child swap call ] curry* find-last nip ; inline
+
+: restore-windows ( -- )
+    windows get [ 1 <column> >array ] keep delete-all
+    [ dup reset-world (open-world-window) ] each
+    forget-rollover ;
+
+: restore-windows? ( -- ? )
+    windows get [ empty? not ] [ f ] if* ;
+
+: update-hand ( world -- )
+    dup hand-world get-global eq?
+    [ hand-loc get-global swap move-hand ] [ drop ] if ;
+
+: post-layout ( hash gadget -- )
+    dup find-world dup [
+        rot [
+            >r screen-rect r> [ rect-union ] when*
+        ] change-at
+    ] [
+        3drop
+    ] if ;
+
+: layout-queued ( -- hash )
+    H{ } clone invalid [
+        dup layout dupd post-layout
+    ] queue-each ;
+
+SYMBOL: ui-hook
+
+: init-ui ( -- )
+    <queue> \ invalid set-global
+    V{ } clone windows set-global ;
+
+: start-ui ( -- )
+    init-timers
+    restore-windows? [
+        restore-windows
+    ] [
+        init-ui ui-hook get call
+    ] if ;
+
+: redraw-worlds ( hash -- )
+    [
+        swap dup update-hand
+        dup world-handle [ draw-world ] [ 2drop ] if
+    ] assoc-each ;
+
+: ui-step ( -- )
+    [
+        do-timers layout-queued redraw-worlds 10 sleep
+    ] assert-depth ;
+
+: ui-running ( quot -- )
+    t \ ui-running set-global
+    [ f \ ui-running set-global ] [ ] cleanup ; inline
+
+: ui-running? ( -- ? )
+    \ ui-running get-global ;
+
+[ f \ ui-running set-global ] "ui" add-init-hook
+
+HOOK: ui ui-backend ( -- )
+
+MAIN: ui
+
+: with-ui ( quot -- )
+    ui-running? [
+        call
+    ] [
+        f windows set-global
+        ui-hook [ ui ] with-variable
+    ] if ;
+
+: ui-try ( quot -- ) [ ui-error ] recover ;
diff --git a/extra/ui/windows/windows.factor b/extra/ui/windows/windows.factor
new file mode 100644 (file)
index 0000000..50367f6
--- /dev/null
@@ -0,0 +1,464 @@
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types arrays assocs ui ui.gadgets
+ui.backend ui.clipboards ui.gadgets.worlds ui.gestures io kernel
+math math.vectors namespaces prettyprint sequences strings
+vectors words windows.kernel32 windows.gdi32 windows.user32
+windows.opengl32 windows.messages windows.types windows.nt
+windows threads timers libc combinators continuations
+command-line shuffle opengl ui.render ;
+IN: ui.windows
+
+TUPLE: windows-ui-backend ;
+
+: crlf>lf CHAR: \r swap remove ;
+: lf>crlf [ [ dup CHAR: \n = [ CHAR: \r , ] when , ] each ] "" make ;
+
+: (enum-clipboard) ( n -- n )
+    EnumClipboardFormats win32-error dup 0 > [ dup , (enum-clipboard) ] when ;
+
+: enum-clipboard ( -- seq )
+    [ 0 (enum-clipboard) ] { } make nip ;
+
+: with-clipboard ( quot -- )
+    f OpenClipboard win32-error=0/f
+    call
+    CloseClipboard win32-error=0/f ; inline
+    
+
+: paste ( -- str )
+    [
+        CF_UNICODETEXT IsClipboardFormatAvailable 0 = [
+            ! nothing to paste
+            ""
+        ] [
+            CF_UNICODETEXT GetClipboardData dup win32-error=0/f
+            dup GlobalLock dup win32-error=0/f
+            GlobalUnlock win32-error=0/f
+            alien>u16-string
+        ] if
+    ] with-clipboard
+    crlf>lf ;
+
+: copy ( str -- )
+    lf>crlf [
+        string>u16-alien
+        f OpenClipboard win32-error=0/f
+        EmptyClipboard win32-error=0/f
+        GMEM_MOVEABLE over length 1+ GlobalAlloc
+            dup win32-error=0/f
+    
+        dup GlobalLock dup win32-error=0/f
+        rot dup length memcpy
+        dup GlobalUnlock win32-error=0/f
+        CF_UNICODETEXT swap SetClipboardData win32-error=0/f
+    ] with-clipboard ;
+
+TUPLE: pasteboard ;
+C: <pasteboard> pasteboard
+
+M: pasteboard clipboard-contents drop paste ;
+M: pasteboard set-clipboard-contents drop copy ;
+
+: init-clipboard ( -- )
+    <pasteboard> clipboard set-global
+    <clipboard> selection set-global ;
+
+! world-handle is a <win>
+TUPLE: win hWnd hDC hRC swap-hint? world title ;
+C: <win> win
+
+SYMBOL: msg-obj
+SYMBOL: class-name-ptr
+SYMBOL: mouse-captured
+
+: style ( -- n ) WS_OVERLAPPEDWINDOW ; inline
+: ex-style ( -- n ) WS_EX_APPWINDOW WS_EX_WINDOWEDGE bitor ; inline
+
+: adjust-RECT ( RECT -- )
+    style 0 ex-style AdjustWindowRectEx win32-error=0/f ;
+
+: make-RECT ( width height -- RECT )
+    "RECT" <c-object> [ set-RECT-bottom ] keep [ set-RECT-right ] keep ;
+
+: make-adjusted-RECT ( width height -- RECT )
+    make-RECT dup adjust-RECT ;
+
+: get-RECT-dimensions ( RECT -- width height )
+    [ RECT-right ] keep [ RECT-left - ] keep
+    [ RECT-bottom ] keep RECT-top - ;
+
+: get-RECT-top-left ( RECT -- x y )
+    [ RECT-left ] keep RECT-top ;
+
+: handle-wm-paint ( hWnd uMsg wParam lParam -- )
+    #! wParam and lParam are unused
+    #! only paint if width/height both > 0
+    3drop window dup draw-world ;
+
+: handle-wm-size ( hWnd uMsg wParam lParam -- )
+    [ lo-word ] keep hi-word make-RECT get-RECT-dimensions 2array
+    2nip
+    dup { 0 0 } = [ 2drop ] [ swap window set-gadget-dim ui-step ] if ;
+
+: wm-keydown-codes ( -- key )
+    H{
+        { 8 "BACKSPACE" }
+        { 9 "TAB" }
+        { 13 "RET" }
+        { 27 "ESC" }
+        { 33 "PAGE_UP" }
+        { 34 "PAGE_DOWN" }
+        { 35 "END" }
+        { 36 "HOME" }
+        { 37 "LEFT" }
+        { 38 "UP" }
+        { 39 "RIGHT" }
+        { 40 "DOWN" }
+        { 45 "INSERT" }
+        { 46 "DELETE" }
+        { 112 "F1" }
+        { 113 "F2" }
+        { 114 "F3" }
+        { 115 "F4" }
+        { 116 "F5" }
+        { 117 "F6" }
+        { 118 "F7" }
+        { 119 "F8" }
+        { 120 "F9" }
+        { 121 "F10" }
+        { 122 "F11" }
+        { 123 "F12" }
+    } ;
+
+: key-state-down?
+    GetKeyState 1 16 shift bitand 0 > ;
+
+: left-shift? ( -- ? ) VK_LSHIFT key-state-down? ;
+: left-ctrl? ( -- ? ) VK_LCONTROL key-state-down? ;
+: left-alt? ( -- ? ) VK_LMENU key-state-down? ;
+: right-shift? ( -- ? ) VK_RSHIFT key-state-down? ;
+: right-ctrl? ( -- ? ) VK_RCONTROL key-state-down? ;
+: right-alt? ( -- ? ) VK_RMENU key-state-down? ;
+: shift? ( -- ? ) left-shift? right-shift? or ;
+: ctrl? ( -- ? ) left-ctrl? right-ctrl? or ;
+: alt? ( -- ? ) left-alt? right-alt? or ;
+: caps-lock? ( -- ? ) VK_CAPITAL GetKeyState zero? not ;
+: switch-case ( seq -- seq ) dup first CHAR: a >= [ >upper ] [ >lower ] if ;
+: switch-case? ( -- ? ) shift? caps-lock? xor not ;
+
+: key-modifiers ( -- seq )
+    [
+        shift? [ S+ , ] when
+        ctrl? [ C+ , ] when
+        alt? [ A+ , ] when
+    ] { } make [ empty? not ] keep f ? ;
+
+: exclude-keys-wm-keydown
+    H{
+        { 16 "SHIFT" }
+        { 17 "CTRL" }
+        { 18 "ALT" }
+        { 20 "CAPS-LOCK" }
+    } ;
+
+: exclude-keys-wm-char
+    ! Values are ignored
+    H{
+        { 8 "BACKSPACE" }
+        { 9 "TAB" }
+        { 13 "RET" }
+        { 27 "ESC" }
+    } ;
+
+: exclude-key-wm-keydown? ( n -- bool )
+    exclude-keys-wm-keydown key? ;
+
+: exclude-key-wm-char? ( n -- bool )
+    exclude-keys-wm-char key? ;
+
+: keystroke>gesture ( n -- mods sym ? )
+    dup wm-keydown-codes at* [
+        nip >r key-modifiers r> t
+    ] [
+        drop 1string >r key-modifiers r>
+        C+ pick member? >r A+ pick member? r> or [
+            shift? [ >lower ] unless f
+        ] [
+            switch-case? [ switch-case ] when t
+        ] if
+    ] if ;
+
+SYMBOL: lParam
+SYMBOL: wParam
+SYMBOL: uMsg
+SYMBOL: hWnd
+
+: handle-wm-keydown ( hWnd uMsg wParam lParam -- )
+    lParam set wParam set uMsg set hWnd set
+    wParam get exclude-key-wm-keydown? [
+        wParam get keystroke>gesture <key-down>
+        hWnd get window-focus send-gesture drop 
+    ] unless ;
+
+: handle-wm-char ( hWnd uMsg wParam lParam -- )
+    lParam set wParam set uMsg set hWnd set
+    wParam get exclude-key-wm-char? ctrl? alt? xor or [
+        wParam get 1string
+        hWnd get window-focus user-input
+    ] unless ;
+
+: handle-wm-keyup ( hWnd uMsg wParam lParam -- )
+    lParam set wParam set uMsg set hWnd set
+    wParam get keystroke>gesture <key-up>
+    hWnd get window-focus send-gesture
+    drop ;
+
+: cleanup-window ( handle -- )
+    dup win-title [ free ] when*
+    dup win-hRC wglDeleteContext win32-error=0/f
+    dup win-hWnd swap win-hDC ReleaseDC win32-error=0/f ;
+
+: handle-wm-close ( hWnd uMsg wParam lParam -- )
+    3drop
+    window [ world-handle ] keep
+    stop-world
+    dup win-hWnd unregister-window
+    dup cleanup-window
+    win-hWnd DestroyWindow win32-error=0/f ;
+
+: handle-wm-set-focus ( hWnd uMsg wParam lParam -- )
+    3drop window [ focus-world ] when* ;
+
+: handle-wm-kill-focus ( hWnd uMsg wParam lParam -- )
+    3drop window [ unfocus-world ] when* ;
+
+: >lo-hi ( WORD -- array ) [ lo-word ] keep hi-word 2array ;
+: mouse-wheel ( lParam -- array ) >lo-hi [ sgn neg ] map ;
+
+: mouse-absolute>relative ( lparam handle -- array )
+    >r >lo-hi r>
+    0 0 make-RECT [ GetWindowRect win32-error=0/f ] keep
+    get-RECT-top-left 2array v- ;
+
+: mouse-event>gesture ( uMsg -- button )
+    key-modifiers swap
+    {
+        { [ dup WM_LBUTTONDOWN = ] [ drop 1 <button-down> ] }
+        { [ dup WM_LBUTTONUP = ] [ drop 1 <button-up> ] }
+        { [ dup WM_MBUTTONDOWN = ] [ drop 2 <button-down> ] }
+        { [ dup WM_MBUTTONUP = ] [ drop 2 <button-up> ] }
+        { [ dup WM_RBUTTONDOWN = ] [ drop 3 <button-down> ] }
+        { [ dup WM_RBUTTONUP = ] [ drop 3 <button-up> ] }
+        { [ t ] [ "bad button" throw ] }
+    } cond ;
+
+: mouse-buttons ( -- seq ) WM_LBUTTONDOWN WM_RBUTTONDOWN 2array ;
+
+: capture-mouse? ( umsg -- ? )
+    mouse-buttons member? ;
+
+: prepare-mouse ( hWnd uMsg wParam lParam -- button coordinate world )
+    nip >r mouse-event>gesture r> >lo-hi rot window ;
+
+: mouse-captured? ( -- ? )
+    mouse-captured get ;
+
+: set-capture ( hwnd -- )
+    mouse-captured get [
+        drop
+    ] [
+        [ SetCapture drop ] keep mouse-captured set
+    ] if ;
+
+: release-capture ( -- )
+    ReleaseCapture win32-error=0/f
+    mouse-captured off ;
+
+: handle-wm-buttondown ( hWnd uMsg wParam lParam -- )
+    >r over capture-mouse? [ pick set-capture ] when r>
+    prepare-mouse send-button-down ;
+
+: handle-wm-buttonup ( hWnd uMsg wParam lParam -- )
+    mouse-captured? [ release-capture ] when
+    prepare-mouse send-button-up ;
+
+: handle-wm-mousemove ( hWnd uMsg wParam lParam -- )
+    2nip
+    over "TRACKMOUSEEVENT" <c-object> [ set-TRACKMOUSEEVENT-hwndTrack ] keep
+    "TRACKMOUSEEVENT" heap-size over set-TRACKMOUSEEVENT-cbSize
+    TME_LEAVE over set-TRACKMOUSEEVENT-dwFlags
+    0 over set-TRACKMOUSEEVENT-dwHoverTime
+    TrackMouseEvent drop
+    >lo-hi swap window move-hand fire-motion ;
+
+: handle-wm-mousewheel ( hWnd uMsg wParam lParam -- )
+    >r nip r>
+    pick mouse-absolute>relative >r mouse-wheel r> rot window send-wheel ;
+
+: handle-wm-cancelmode ( hWnd uMsg wParam lParam -- )
+    #! message sent if windows needs application to stop dragging
+    3drop drop release-capture ;
+
+: handle-wm-mouseleave ( hWnd uMsg wParam lParam -- )
+    #! message sent if mouse leaves main application 
+    3drop drop forget-rollover ;
+
+! return 0 if you handle the message, else just let DefWindowProc return its val
+: ui-wndproc ( -- object )
+    "uint" { "void*" "uint" "long" "long" } "stdcall" [
+        [
+        pick
+        ! "Message: " write dup get-windows-message-name write
+            ! " " write dup unparse print flush
+            {
+                { [ dup WM_CLOSE = ]    [ drop handle-wm-close 0 ] }
+                { [ dup WM_PAINT = ]
+                      [ drop 4dup handle-wm-paint DefWindowProc ] }
+                { [ dup WM_SIZE = ]      [ drop handle-wm-size 0 ] }
+
+                ! Keyboard events
+                { [ dup WM_KEYDOWN = over WM_SYSKEYDOWN = or ]
+                    [ drop 4dup handle-wm-keydown DefWindowProc ] }
+                { [ dup WM_CHAR = over WM_SYSCHAR = or ]
+                    [ drop 4dup handle-wm-char DefWindowProc ] }
+                { [ dup WM_KEYUP = over WM_SYSKEYUP = or ]
+                    [ drop 4dup handle-wm-keyup DefWindowProc ] }
+
+                { [ dup WM_SETFOCUS = ] [ drop handle-wm-set-focus 0 ] }
+                { [ dup WM_KILLFOCUS = ] [ drop handle-wm-kill-focus 0 ] }
+
+                ! Mouse events
+                { [ dup WM_LBUTTONDOWN = ] [ drop handle-wm-buttondown 0 ] }
+                { [ dup WM_MBUTTONDOWN = ] [ drop handle-wm-buttondown 0 ] }
+                { [ dup WM_RBUTTONDOWN = ] [ drop handle-wm-buttondown 0 ] }
+                { [ dup WM_LBUTTONUP = ] [ drop handle-wm-buttonup 0 ] }
+                { [ dup WM_MBUTTONUP = ] [ drop handle-wm-buttonup 0 ] }
+                { [ dup WM_RBUTTONUP = ] [ drop handle-wm-buttonup 0 ] }
+                { [ dup WM_MOUSEMOVE = ] [ drop handle-wm-mousemove 0 ] }
+                { [ dup WM_MOUSEWHEEL = ] [ drop handle-wm-mousewheel 0 ] }
+                { [ dup WM_CANCELMODE = ] [ drop handle-wm-cancelmode 0 ] }
+                { [ dup WM_MOUSELEAVE = ] [ drop handle-wm-mouseleave 0 ] }
+
+                { [ t ] [ drop DefWindowProc ] }
+            } cond
+        ] ui-try
+        ! "finished handling message" print .s flush
+     ] alien-callback ;
+
+: do-events ( -- )
+    msg-obj get f 0 0 PM_REMOVE PeekMessage 
+    zero? not [
+        msg-obj get MSG-message WM_QUIT = [
+            msg-obj get [ TranslateMessage drop ] keep DispatchMessage drop
+        ] unless
+    ] when ;
+
+: event-loop ( -- )
+    windows get empty? [
+        [ do-events ui-step ] ui-try event-loop
+    ] unless ;
+
+: register-wndclassex ( -- class )
+    "WNDCLASSEX" <c-object>
+    f GetModuleHandle
+    class-name-ptr get-global
+    pick GetClassInfoEx zero? [
+        "WNDCLASSEX" heap-size over set-WNDCLASSEX-cbSize
+        CS_HREDRAW CS_VREDRAW bitor CS_OWNDC bitor over set-WNDCLASSEX-style
+        ui-wndproc over set-WNDCLASSEX-lpfnWndProc
+        0 over set-WNDCLASSEX-cbClsExtra
+        0 over set-WNDCLASSEX-cbWndExtra
+        f GetModuleHandle over set-WNDCLASSEX-hInstance
+        f GetModuleHandle "fraptor" string>u16-alien LoadIcon
+        over set-WNDCLASSEX-hIcon
+        f IDC_ARROW LoadCursor over set-WNDCLASSEX-hCursor
+
+        class-name-ptr get-global over set-WNDCLASSEX-lpszClassName
+        RegisterClassEx dup win32-error=0/f
+    ] when ;
+
+: create-window ( width height -- hwnd )
+    make-adjusted-RECT
+    >r class-name-ptr get-global f r>
+    >r >r >r ex-style r> r>
+        WS_CLIPSIBLINGS WS_CLIPCHILDREN bitor style bitor
+        0 0 r>
+    get-RECT-dimensions
+    f f f GetModuleHandle f CreateWindowEx dup win32-error=0/f ;
+
+: show-window ( hWnd -- )
+    dup SW_SHOW ShowWindow drop ! always succeeds
+    dup SetForegroundWindow drop
+    SetFocus drop ;
+
+: init-win32-ui
+    "MSG" <c-object> msg-obj set
+    "Factor-window" malloc-u16-string class-name-ptr set-global
+    register-wndclassex
+    GetDoubleClickTime double-click-timeout set-global ;
+
+: cleanup-win32-ui ( -- )
+    class-name-ptr get-global f UnregisterClass drop
+    class-name-ptr get-global [ free ] when*
+    f class-name-ptr set-global ;
+
+: setup-pixel-format ( hdc -- )
+    16 make-pfd [ ChoosePixelFormat dup win32-error=0/f ] 2keep
+    swapd SetPixelFormat win32-error=0/f ;
+
+: get-dc ( hWnd -- hDC ) GetDC dup win32-error=0/f ;
+
+: get-rc ( hDC -- hRC )
+    dup wglCreateContext dup win32-error=0/f
+    [ wglMakeCurrent win32-error=0/f ] keep ;
+
+: setup-gl ( hwnd -- hDC hRC swap-hint? )
+    get-dc
+    dup setup-pixel-format
+    dup get-rc
+    swap-hint-supported? ;
+
+M: windows-ui-backend (open-world-window) ( world -- )
+    [ rect-dim first2 create-window dup setup-gl ] keep
+    [ f <win> ] keep
+    [ swap win-hWnd register-window ] 2keep
+    [ set-world-handle ] 2keep 
+    start-world win-hWnd show-window ;
+
+M: windows-ui-backend select-gl-context ( handle -- )
+    [ win-hDC ] keep win-hRC wglMakeCurrent win32-error=0/f ;
+
+M: windows-ui-backend flush-gl-context ( handle -- )
+    dup win-swap-hint? [
+        clip get flip-rect fix-coordinates
+        glAddSwapHintRectWIN
+    ] when
+    win-hDC SwapBuffers win32-error=0/f ;
+
+! Move window to front
+M: windows-ui-backend raise-window ( world -- )
+    world-handle [
+        win-hWnd SetFocus drop release-capture
+    ] when* ;
+
+M: windows-ui-backend set-title ( string world -- )
+    world-handle [ nip win-hWnd WM_SETTEXT 0 ] 2keep
+    dup win-title [ free ] when*
+    >r malloc-u16-string r>
+    dupd set-win-title alien-address
+    SendMessage drop ;
+
+M: windows-ui-backend ui
+    [
+        [
+            init-clipboard
+            init-win32-ui
+            start-ui
+            event-loop
+        ] [ cleanup-win32-ui ] cleanup
+    ] ui-running ;
+
+T{ windows-ui-backend } ui-backend set-global
+
+[ "ui" ] main-vocab-hook set-global
diff --git a/extra/ui/x11/x11.factor b/extra/ui/x11/x11.factor
new file mode 100644 (file)
index 0000000..87ed6d2
--- /dev/null
@@ -0,0 +1,295 @@
+! Copyright (C) 2005, 2007 Eduardo Cavazos and Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays ui ui.gadgets ui.gestures ui.backend
+ui.clipboards ui.gadgets.worlds assocs kernel math namespaces
+opengl sequences strings x11.xlib x11.events x11.xim x11.glx
+x11.clipboard x11.constants x11.windows io.utf8 combinators
+debugger system command-line ui.render math.vectors tuples
+opengl.gl ;
+IN: ui.x11
+
+TUPLE: x11-ui-backend ;
+
+: XA_NET_WM_NAME "_NET_WM_NAME" x-atom ;
+
+TUPLE: x11-handle window glx xic copy-sub-buffer? ;
+
+C: <x11-handle> x11-handle
+
+M: world expose-event nip relayout ;
+
+M: world configure-event
+    over configured-loc over set-world-loc
+    swap configured-dim over set-gadget-dim
+    ! In case dimensions didn't change
+    relayout-1 ;
+
+: modifiers
+    {
+        { S+ HEX: 1 }
+        { C+ HEX: 4 }
+        { A+ HEX: 8 }
+    } ;
+    
+: key-codes
+    H{
+        { HEX: FF08 "BACKSPACE" }
+        { HEX: FF09 "TAB"       }
+        { HEX: FF0D "RET"       }
+        { HEX: FF8D "ENTER"     }
+        { HEX: FF1B "ESC"       }
+        { HEX: FFFF "DELETE"    }
+        { HEX: FF50 "HOME"      }
+        { HEX: FF51 "LEFT"      }
+        { HEX: FF52 "UP"        }
+        { HEX: FF53 "RIGHT"     }
+        { HEX: FF54 "DOWN"      }
+        { HEX: FF55 "PAGE_UP"   }
+        { HEX: FF56 "PAGE_DOWN" }
+        { HEX: FF57 "END"       }
+        { HEX: FF58 "BEGIN"     }
+        { HEX: FFBE "F1"        }
+        { HEX: FFBF "F2"        }
+        { HEX: FFC0 "F3"        }
+        { HEX: FFC1 "F4"        }
+        { HEX: FFC2 "F5"        }
+        { HEX: FFC3 "F6"        }
+        { HEX: FFC4 "F7"        }
+        { HEX: FFC5 "F8"        }
+        { HEX: FFC6 "F9"        }
+    } ;
+
+: key-code ( keysym -- keycode action? )
+    dup key-codes at [ t ] [ 1string f ] ?if ;
+
+: event-modifiers ( event -- seq )
+    XKeyEvent-state modifiers modifier ;
+
+: key-down-event>gesture ( event world -- string gesture )
+    dupd
+    world-handle x11-handle-xic lookup-string
+    >r swap event-modifiers r> key-code <key-down> ;
+
+M: world key-down-event
+    [ key-down-event>gesture ] keep world-focus
+    [ send-gesture ] keep swap [ user-input ] [ 2drop ] if ;
+
+: key-up-event>gesture ( event -- gesture )
+    dup event-modifiers swap 0 XLookupKeysym key-code <key-up> ;
+
+M: world key-up-event
+    >r key-up-event>gesture r> world-focus send-gesture drop ;
+
+: mouse-event>gesture ( event -- modifiers button loc )
+    dup event-modifiers over XButtonEvent-button
+    rot mouse-event-loc ;
+
+M: world button-down-event
+    >r mouse-event>gesture >r <button-down> r> r>
+    send-button-down ;
+
+M: world button-up-event
+    >r mouse-event>gesture >r <button-up> r> r>
+    send-button-up ;
+
+: mouse-event>scroll-direction ( event -- pair )
+    #! Reminder for myself: 4 is up, 5 is down
+    XButtonEvent-button 5 = 1 -1 ? 0 swap 2array ;
+
+M: world wheel-event
+    >r dup mouse-event>scroll-direction swap mouse-event-loc r>
+    send-wheel ;
+
+M: world enter-event motion-event ;
+
+M: world leave-event 2drop forget-rollover ;
+
+M: world motion-event
+    >r dup XMotionEvent-x swap XMotionEvent-y 2array r>
+    move-hand fire-motion ;
+
+M: world focus-in-event
+    nip
+    dup world-handle x11-handle-xic XSetICFocus focus-world ;
+
+M: world focus-out-event
+    nip
+    dup world-handle x11-handle-xic XUnsetICFocus unfocus-world ;
+
+M: world selection-notify-event
+    [ world-handle x11-handle-window selection-from-event ] keep
+    world-focus user-input ;
+
+: supported-type? ( atom -- ? )
+    { "UTF8_STRING" "STRING" "TEXT" }
+    [ x-atom = ] curry* contains? ;
+
+: clipboard-for-atom ( atom -- clipboard )
+    {
+        { [ dup XA_PRIMARY = ] [ drop selection get ] }
+        { [ dup XA_CLIPBOARD = ] [ drop clipboard get ] }
+        { [ t ] [ drop <clipboard> ] }
+    } cond ;
+
+: encode-clipboard ( string type -- bytes )
+    XSelectionRequestEvent-target XA_UTF8_STRING =
+    [ encode-utf8 ] [ string>char-alien ] if ;
+
+: set-selection-prop ( evt -- )
+    dpy get swap
+    [ XSelectionRequestEvent-requestor ] keep
+    [ XSelectionRequestEvent-property ] keep
+    [ XSelectionRequestEvent-target ] keep
+    >r 8 PropModeReplace r>
+    [
+        XSelectionRequestEvent-selection
+        clipboard-for-atom x-clipboard-contents
+    ] keep encode-clipboard dup length XChangeProperty drop ;
+
+M: world selection-request-event
+    drop dup XSelectionRequestEvent-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 ] }
+        { [ t ] [ drop send-notify-failure ] }
+    } cond ;
+
+: close-window ( handle -- )
+    dup x11-handle-xic XDestroyIC
+    dup x11-handle-glx destroy-glx
+    x11-handle-window dup unregister-window
+    destroy-window ;
+
+M: world client-event
+    swap close-box? [
+        dup world-handle >r stop-world r> close-window
+    ] [
+        drop
+    ] if ;
+
+: gadget-window ( world -- )
+    dup world-loc over rect-dim glx-window
+    over "Factor" create-xic
+    copy-sub-buffer-supported? <x11-handle>
+    2dup x11-handle-window register-window
+    swap set-world-handle ;
+
+: wait-event ( -- event )
+    QueuedAfterFlush events-queued 0 > [
+        next-event dup
+        None XFilterEvent zero? [ drop wait-event ] unless
+    ] [
+        ui-step wait-event
+    ] if ;
+
+: do-events ( -- )
+    wait-event dup XAnyEvent-window window dup
+    [ [ 2dup handle-event ] assert-depth ] when 2drop ;
+
+: event-loop ( -- )
+    windows get empty? [
+        [ do-events ] ui-try event-loop
+    ] unless ;
+
+: x-clipboard@ ( gadget clipboard -- prop win )
+    x-clipboard-atom swap
+    find-world world-handle x11-handle-window ;
+
+M: x-clipboard copy-clipboard
+    [ x-clipboard@ own-selection ] keep
+    set-x-clipboard-contents ;
+
+M: x-clipboard paste-clipboard
+    >r find-world world-handle x11-handle-window
+    r> x-clipboard-atom convert-selection ;
+
+: init-clipboard ( -- )
+    XA_PRIMARY <x-clipboard> selection set-global
+    XA_CLIPBOARD <x-clipboard> clipboard set-global ;
+
+: set-title-old ( dpy window string -- )
+    dup [ 127 <= ] all? [ XStoreName drop ] [ 3drop ] if ;
+
+: set-title-new ( dpy window string -- )
+    >r
+    XA_NET_WM_NAME XA_UTF8_STRING 8 PropModeReplace
+    r> encode-utf8 dup length XChangeProperty drop ;
+
+M: x11-ui-backend set-title ( string world -- )
+    world-handle x11-handle-window swap dpy get -rot
+    3dup set-title-old set-title-new ;
+
+M: x11-ui-backend (open-world-window) ( world -- )
+    dup gadget-window
+    dup start-world
+    world-handle x11-handle-window dup set-closable map-window ;
+
+M: x11-ui-backend raise-window ( world -- )
+    world-handle [
+        dpy get swap x11-handle-window XRaiseWindow drop
+    ] when* ;
+
+M: x11-ui-backend select-gl-context ( handle -- )
+    dpy get swap
+    dup x11-handle-window swap x11-handle-glx glXMakeCurrent
+    [ "Failed to set current GLX context" throw ] unless ;
+
+: swap-buffers-mesa ( handle -- )
+    dpy get swap x11-handle-window
+    clip get flip-rect fix-coordinates
+    glXCopySubBufferMESA ;
+
+: swap-buffers-full ( handle -- )
+    dpy get swap x11-handle-window glXSwapBuffers ;
+
+: gl-raster-pos ( loc -- )
+    first2 [ >fixnum ] 2apply glRasterPos2i ;
+
+: gl-copy-pixels ( loc dim buffer -- )
+    >r fix-coordinates r> glCopyPixels ;
+
+: swap-buffers-slow ( -- )
+    GL_BACK glReadBuffer
+    GL_FRONT glDrawBuffer
+    GL_SCISSOR_TEST glDisable
+    GL_ONE GL_ZERO glBlendFunc
+    clip get rect-bounds { 0 1 } v* v+ gl-raster-pos
+    clip get flip-rect GL_COLOR gl-copy-pixels
+    GL_BACK glDrawBuffer
+    glFlush ;
+
+: swap-buffer-strategy
+    "swap-buffer-strategy" get "slow" or ;
+
+: can-swap-full? ( -- ? )
+    clip get world get delegates [ rect? ] find nip = ;
+
+: swap-buffers ( handle strategy -- )
+    {
+        { "mesa" [ swap-buffers-mesa ] }
+        { "full" [ swap-buffers-full ] }
+        { "slow" [
+            can-swap-full?
+            [ swap-buffers-full ]
+            [ drop swap-buffers-slow ] if
+        ] }
+    } case ;
+
+M: x11-ui-backend flush-gl-context ( handle -- )
+    swap-buffer-strategy swap-buffers ;
+
+M: x11-ui-backend ui ( -- )
+    [
+        f [
+            [
+                init-clipboard
+                start-ui
+                event-loop
+            ] with-xim
+        ] with-x
+    ] ui-running ;
+
+T{ x11-ui-backend } ui-backend set-global
+
+[ "DISPLAY" os-env "ui" "listener" ? ]
+main-vocab-hook set-global
diff --git a/extra/unicode/PropList.txt b/extra/unicode/PropList.txt
new file mode 100644 (file)
index 0000000..8c6b662
--- /dev/null
@@ -0,0 +1,20 @@
+# ================================================
+# Note: This is only a portion of the original PropList.txt
+
+09BE          ; Other_Grapheme_Extend # Mc       BENGALI VOWEL SIGN AA
+09D7          ; Other_Grapheme_Extend # Mc       BENGALI AU LENGTH MARK
+0B3E          ; Other_Grapheme_Extend # Mc       ORIYA VOWEL SIGN AA
+0B57          ; Other_Grapheme_Extend # Mc       ORIYA AU LENGTH MARK
+0BBE          ; Other_Grapheme_Extend # Mc       TAMIL VOWEL SIGN AA
+0BD7          ; Other_Grapheme_Extend # Mc       TAMIL AU LENGTH MARK
+0CC2          ; Other_Grapheme_Extend # Mc       KANNADA VOWEL SIGN UU
+0CD5..0CD6    ; Other_Grapheme_Extend # Mc   [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK
+0D3E          ; Other_Grapheme_Extend # Mc       MALAYALAM VOWEL SIGN AA
+0D57          ; Other_Grapheme_Extend # Mc       MALAYALAM AU LENGTH MARK
+0DCF          ; Other_Grapheme_Extend # Mc       SINHALA VOWEL SIGN AELA-PILLA
+0DDF          ; Other_Grapheme_Extend # Mc       SINHALA VOWEL SIGN GAYANUKITTA
+200C..200D    ; Other_Grapheme_Extend # Cf   [2] ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER
+1D165         ; Other_Grapheme_Extend # Mc       MUSICAL SYMBOL COMBINING STEM
+1D16E..1D172  ; Other_Grapheme_Extend # Mc   [5] MUSICAL SYMBOL COMBINING FLAG-1..MUSICAL SYMBOL COMBINING FLAG-5
+
+# Total code points: 21
diff --git a/extra/unicode/SpecialCasing.txt b/extra/unicode/SpecialCasing.txt
new file mode 100644 (file)
index 0000000..4bfe148
--- /dev/null
@@ -0,0 +1,264 @@
+# SpecialCasing-5.0.0.txt
+# Date: 2006-03-03, 08:23:36 GMT [MD]
+#
+# Unicode Character Database
+# Copyright (c) 1991-2006 Unicode, Inc.
+# For terms of use, see http://www.unicode.org/terms_of_use.html
+# For documentation, see UCD.html
+#
+# Special Casing Properties
+#
+# This file is a supplement to the UnicodeData file.
+# It contains additional information about the casing of Unicode characters.
+# (For compatibility, the UnicodeData.txt file only contains case mappings for
+# characters where they are 1-1, and does not have locale-specific mappings.)
+# For more information, see the discussion of Case Mappings in the Unicode Standard.
+#
+# All code points not listed in this file that do not have a simple case mappings
+# in UnicodeData.txt map to themselves.
+# ================================================================================
+# Format
+# ================================================================================
+# The entries in this file are in the following machine-readable format:
+#
+# <code>; <lower> ; <title> ; <upper> ; (<condition_list> ;)? # <comment>
+#
+# <code>, <lower>, <title>, and <upper> provide character values in hex. If there is more
+# than one character, they are separated by spaces. Other than as used to separate 
+# elements, spaces are to be ignored.
+#
+# The <condition_list> is optional. Where present, it consists of one or more locale IDs
+# or contexts, separated by spaces. In these conditions:
+# - A condition list overrides the normal behavior if all of the listed conditions are true.
+# - The context is always the context of the characters in the original string,
+#   NOT in the resulting string.
+# - Case distinctions in the condition list are not significant.
+# - Conditions preceded by "Not_" represent the negation of the condition.
+#
+# A locale ID is defined by taking any language tag as defined by
+# RFC 3066 (or its successor), and replacing '-' by '_'.
+#
+# A context for a character C is defined by Section 3.13 Default Case 
+# Operations, of The Unicode Standard, Version 5.0.
+# (This is identical to the context defined by Unicode 4.1.0,
+#  as specified in http://www.unicode.org/versions/Unicode4.1.0/)
+#
+# Parsers of this file must be prepared to deal with future additions to this format:
+#  * Additional contexts
+#  * Additional fields
+# ================================================================================
+
+# ================================================================================
+# Unconditional mappings
+# ================================================================================
+
+# The German es-zed is special--the normal mapping is to SS.
+# Note: the titlecase should never occur in practice. It is equal to titlecase(uppercase(<es-zed>))
+
+00DF; 00DF; 0053 0073; 0053 0053; # LATIN SMALL LETTER SHARP S
+
+# Preserve canonical equivalence for I with dot. Turkic is handled below.
+
+0130; 0069 0307; 0130; 0130; # LATIN CAPITAL LETTER I WITH DOT ABOVE
+
+# Ligatures
+
+FB00; FB00; 0046 0066; 0046 0046; # LATIN SMALL LIGATURE FF
+FB01; FB01; 0046 0069; 0046 0049; # LATIN SMALL LIGATURE FI
+FB02; FB02; 0046 006C; 0046 004C; # LATIN SMALL LIGATURE FL
+FB03; FB03; 0046 0066 0069; 0046 0046 0049; # LATIN SMALL LIGATURE FFI
+FB04; FB04; 0046 0066 006C; 0046 0046 004C; # LATIN SMALL LIGATURE FFL
+FB05; FB05; 0053 0074; 0053 0054; # LATIN SMALL LIGATURE LONG S T
+FB06; FB06; 0053 0074; 0053 0054; # LATIN SMALL LIGATURE ST
+
+0587; 0587; 0535 0582; 0535 0552; # ARMENIAN SMALL LIGATURE ECH YIWN
+FB13; FB13; 0544 0576; 0544 0546; # ARMENIAN SMALL LIGATURE MEN NOW
+FB14; FB14; 0544 0565; 0544 0535; # ARMENIAN SMALL LIGATURE MEN ECH
+FB15; FB15; 0544 056B; 0544 053B; # ARMENIAN SMALL LIGATURE MEN INI
+FB16; FB16; 054E 0576; 054E 0546; # ARMENIAN SMALL LIGATURE VEW NOW
+FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
+
+# No corresponding uppercase precomposed character
+
+0149; 0149; 02BC 004E; 02BC 004E; # LATIN SMALL LETTER N PRECEDED BY APOSTROPHE
+0390; 0390; 0399 0308 0301; 0399 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+03B0; 03B0; 03A5 0308 0301; 03A5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+01F0; 01F0; 004A 030C; 004A 030C; # LATIN SMALL LETTER J WITH CARON
+1E96; 1E96; 0048 0331; 0048 0331; # LATIN SMALL LETTER H WITH LINE BELOW
+1E97; 1E97; 0054 0308; 0054 0308; # LATIN SMALL LETTER T WITH DIAERESIS
+1E98; 1E98; 0057 030A; 0057 030A; # LATIN SMALL LETTER W WITH RING ABOVE
+1E99; 1E99; 0059 030A; 0059 030A; # LATIN SMALL LETTER Y WITH RING ABOVE
+1E9A; 1E9A; 0041 02BE; 0041 02BE; # LATIN SMALL LETTER A WITH RIGHT HALF RING
+1F50; 1F50; 03A5 0313; 03A5 0313; # GREEK SMALL LETTER UPSILON WITH PSILI
+1F52; 1F52; 03A5 0313 0300; 03A5 0313 0300; # GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA
+1F54; 1F54; 03A5 0313 0301; 03A5 0313 0301; # GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA
+1F56; 1F56; 03A5 0313 0342; 03A5 0313 0342; # GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI
+1FB6; 1FB6; 0391 0342; 0391 0342; # GREEK SMALL LETTER ALPHA WITH PERISPOMENI
+1FC6; 1FC6; 0397 0342; 0397 0342; # GREEK SMALL LETTER ETA WITH PERISPOMENI
+1FD2; 1FD2; 0399 0308 0300; 0399 0308 0300; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA
+1FD3; 1FD3; 0399 0308 0301; 0399 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA
+1FD6; 1FD6; 0399 0342; 0399 0342; # GREEK SMALL LETTER IOTA WITH PERISPOMENI
+1FD7; 1FD7; 0399 0308 0342; 0399 0308 0342; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI
+1FE2; 1FE2; 03A5 0308 0300; 03A5 0308 0300; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA
+1FE3; 1FE3; 03A5 0308 0301; 03A5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA
+1FE4; 1FE4; 03A1 0313; 03A1 0313; # GREEK SMALL LETTER RHO WITH PSILI
+1FE6; 1FE6; 03A5 0342; 03A5 0342; # GREEK SMALL LETTER UPSILON WITH PERISPOMENI
+1FE7; 1FE7; 03A5 0308 0342; 03A5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI
+1FF6; 1FF6; 03A9 0342; 03A9 0342; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI
+
+# IMPORTANT-when capitalizing iota-subscript (0345)
+#  It MUST be in normalized form--moved to the end of any sequence of combining marks.
+#  This is because logically it represents a following base character!
+#  E.g. <iota_subscript> (<Mn> | <Mc> | <Me>)+ => (<Mn> | <Mc> | <Me>)+ <iota_subscript>
+# It should never be the first character in a word, so in titlecasing it can be left as is.
+
+# The following cases are already in the UnicodeData file, so are only commented here.
+
+# 0345; 0345; 0345; 0399; # COMBINING GREEK YPOGEGRAMMENI
+
+# All letters with YPOGEGRAMMENI (iota-subscript) or PROSGEGRAMMENI (iota adscript)
+# have special uppercases.
+# Note: characters with PROSGEGRAMMENI are actually titlecase, not uppercase!
+
+1F80; 1F80; 1F88; 1F08 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI
+1F81; 1F81; 1F89; 1F09 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI
+1F82; 1F82; 1F8A; 1F0A 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI
+1F83; 1F83; 1F8B; 1F0B 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI
+1F84; 1F84; 1F8C; 1F0C 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI
+1F85; 1F85; 1F8D; 1F0D 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI
+1F86; 1F86; 1F8E; 1F0E 0399; # GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI
+1F87; 1F87; 1F8F; 1F0F 0399; # GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI
+1F88; 1F80; 1F88; 1F08 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI
+1F89; 1F81; 1F89; 1F09 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI
+1F8A; 1F82; 1F8A; 1F0A 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI
+1F8B; 1F83; 1F8B; 1F0B 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI
+1F8C; 1F84; 1F8C; 1F0C 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI
+1F8D; 1F85; 1F8D; 1F0D 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI
+1F8E; 1F86; 1F8E; 1F0E 0399; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
+1F8F; 1F87; 1F8F; 1F0F 0399; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
+1F90; 1F90; 1F98; 1F28 0399; # GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI
+1F91; 1F91; 1F99; 1F29 0399; # GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI
+1F92; 1F92; 1F9A; 1F2A 0399; # GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI
+1F93; 1F93; 1F9B; 1F2B 0399; # GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI
+1F94; 1F94; 1F9C; 1F2C 0399; # GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI
+1F95; 1F95; 1F9D; 1F2D 0399; # GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI
+1F96; 1F96; 1F9E; 1F2E 0399; # GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI
+1F97; 1F97; 1F9F; 1F2F 0399; # GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI
+1F98; 1F90; 1F98; 1F28 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI
+1F99; 1F91; 1F99; 1F29 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI
+1F9A; 1F92; 1F9A; 1F2A 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI
+1F9B; 1F93; 1F9B; 1F2B 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI
+1F9C; 1F94; 1F9C; 1F2C 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI
+1F9D; 1F95; 1F9D; 1F2D 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI
+1F9E; 1F96; 1F9E; 1F2E 0399; # GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
+1F9F; 1F97; 1F9F; 1F2F 0399; # GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
+1FA0; 1FA0; 1FA8; 1F68 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI
+1FA1; 1FA1; 1FA9; 1F69 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI
+1FA2; 1FA2; 1FAA; 1F6A 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI
+1FA3; 1FA3; 1FAB; 1F6B 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI
+1FA4; 1FA4; 1FAC; 1F6C 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI
+1FA5; 1FA5; 1FAD; 1F6D 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI
+1FA6; 1FA6; 1FAE; 1F6E 0399; # GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI
+1FA7; 1FA7; 1FAF; 1F6F 0399; # GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI
+1FA8; 1FA0; 1FA8; 1F68 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI
+1FA9; 1FA1; 1FA9; 1F69 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI
+1FAA; 1FA2; 1FAA; 1F6A 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI
+1FAB; 1FA3; 1FAB; 1F6B 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI
+1FAC; 1FA4; 1FAC; 1F6C 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI
+1FAD; 1FA5; 1FAD; 1F6D 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI
+1FAE; 1FA6; 1FAE; 1F6E 0399; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI
+1FAF; 1FA7; 1FAF; 1F6F 0399; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI
+1FB3; 1FB3; 1FBC; 0391 0399; # GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI
+1FBC; 1FB3; 1FBC; 0391 0399; # GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI
+1FC3; 1FC3; 1FCC; 0397 0399; # GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI
+1FCC; 1FC3; 1FCC; 0397 0399; # GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI
+1FF3; 1FF3; 1FFC; 03A9 0399; # GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI
+1FFC; 1FF3; 1FFC; 03A9 0399; # GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI
+
+# Some characters with YPOGEGRAMMENI also have no corresponding titlecases
+
+1FB2; 1FB2; 1FBA 0345; 1FBA 0399; # GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI
+1FB4; 1FB4; 0386 0345; 0386 0399; # GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI
+1FC2; 1FC2; 1FCA 0345; 1FCA 0399; # GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI
+1FC4; 1FC4; 0389 0345; 0389 0399; # GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI
+1FF2; 1FF2; 1FFA 0345; 1FFA 0399; # GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI
+1FF4; 1FF4; 038F 0345; 038F 0399; # GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI
+
+1FB7; 1FB7; 0391 0342 0345; 0391 0342 0399; # GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI
+1FC7; 1FC7; 0397 0342 0345; 0397 0342 0399; # GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI
+1FF7; 1FF7; 03A9 0342 0345; 03A9 0342 0399; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI
+
+# ================================================================================
+# Conditional mappings
+# ================================================================================
+
+# Special case for final form of sigma
+
+03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA
+
+# Note: the following cases for non-final are already in the UnicodeData file.
+
+# 03A3; 03C3; 03A3; 03A3; # GREEK CAPITAL LETTER SIGMA
+# 03C3; 03C3; 03A3; 03A3; # GREEK SMALL LETTER SIGMA
+# 03C2; 03C2; 03A3; 03A3; # GREEK SMALL LETTER FINAL SIGMA
+
+# Note: the following cases are not included, since they would case-fold in lowercasing
+
+# 03C3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK SMALL LETTER SIGMA
+# 03C2; 03C3; 03A3; 03A3; Not_Final_Sigma; # GREEK SMALL LETTER FINAL SIGMA
+
+# ================================================================================
+# Locale-sensitive mappings
+# ================================================================================
+
+# Lithuanian
+
+# Lithuanian retains the dot in a lowercase i when followed by accents.
+
+# Remove DOT ABOVE after "i" with upper or titlecase
+
+0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE
+
+# Introduce an explicit dot above when lowercasing capital I's and J's
+# whenever there are more accents above.
+# (of the accents used in Lithuanian: grave, acute, tilde above, and ogonek)
+
+0049; 0069 0307; 0049; 0049; lt More_Above; # LATIN CAPITAL LETTER I
+004A; 006A 0307; 004A; 004A; lt More_Above; # LATIN CAPITAL LETTER J
+012E; 012F 0307; 012E; 012E; lt More_Above; # LATIN CAPITAL LETTER I WITH OGONEK
+00CC; 0069 0307 0300; 00CC; 00CC; lt; # LATIN CAPITAL LETTER I WITH GRAVE
+00CD; 0069 0307 0301; 00CD; 00CD; lt; # LATIN CAPITAL LETTER I WITH ACUTE
+0128; 0069 0307 0303; 0128; 0128; lt; # LATIN CAPITAL LETTER I WITH TILDE
+
+# ================================================================================
+
+# Turkish and Azeri
+
+# I and i-dotless; I-dot and i are case pairs in Turkish and Azeri
+# The following rules handle those cases.
+
+0130; 0069; 0130; 0130; tr; # LATIN CAPITAL LETTER I WITH DOT ABOVE
+0130; 0069; 0130; 0130; az; # LATIN CAPITAL LETTER I WITH DOT ABOVE
+
+# When lowercasing, remove dot_above in the sequence I + dot_above, which will turn into i.
+# This matches the behavior of the canonically equivalent I-dot_above
+
+0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE
+0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE
+
+# When lowercasing, unless an I is before a dot_above, it turns into a dotless i.
+
+0049; 0131; 0049; 0049; tr Not_Before_Dot; # LATIN CAPITAL LETTER I
+0049; 0131; 0049; 0049; az Not_Before_Dot; # LATIN CAPITAL LETTER I
+
+# When uppercasing, i turns into a dotted capital I
+
+0069; 0069; 0130; 0130; tr; # LATIN SMALL LETTER I
+0069; 0069; 0130; 0130; az; # LATIN SMALL LETTER I
+
+# Note: the following case is already in the UnicodeData file.
+
+# 0131; 0131; 0049; 0049; tr; # LATIN SMALL LETTER DOTLESS I
+
+# EOF
+
diff --git a/extra/unicode/UnicodeData.txt b/extra/unicode/UnicodeData.txt
new file mode 100644 (file)
index 0000000..299f0e5
--- /dev/null
@@ -0,0 +1,17720 @@
+0000;<control>;Cc;0;BN;;;;;N;NULL;;;;
+0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;;
+0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;;
+0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;;
+0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;;
+0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;;
+0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;;
+0007;<control>;Cc;0;BN;;;;;N;BELL;;;;
+0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;;
+0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATION;;;;
+000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;;
+000B;<control>;Cc;0;S;;;;;N;LINE TABULATION;;;;
+000C;<control>;Cc;0;WS;;;;;N;FORM FEED (FF);;;;
+000D;<control>;Cc;0;B;;;;;N;CARRIAGE RETURN (CR);;;;
+000E;<control>;Cc;0;BN;;;;;N;SHIFT OUT;;;;
+000F;<control>;Cc;0;BN;;;;;N;SHIFT IN;;;;
+0010;<control>;Cc;0;BN;;;;;N;DATA LINK ESCAPE;;;;
+0011;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL ONE;;;;
+0012;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL TWO;;;;
+0013;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL THREE;;;;
+0014;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL FOUR;;;;
+0015;<control>;Cc;0;BN;;;;;N;NEGATIVE ACKNOWLEDGE;;;;
+0016;<control>;Cc;0;BN;;;;;N;SYNCHRONOUS IDLE;;;;
+0017;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION BLOCK;;;;
+0018;<control>;Cc;0;BN;;;;;N;CANCEL;;;;
+0019;<control>;Cc;0;BN;;;;;N;END OF MEDIUM;;;;
+001A;<control>;Cc;0;BN;;;;;N;SUBSTITUTE;;;;
+001B;<control>;Cc;0;BN;;;;;N;ESCAPE;;;;
+001C;<control>;Cc;0;B;;;;;N;INFORMATION SEPARATOR FOUR;;;;
+001D;<control>;Cc;0;B;;;;;N;INFORMATION SEPARATOR THREE;;;;
+001E;<control>;Cc;0;B;;;;;N;INFORMATION SEPARATOR TWO;;;;
+001F;<control>;Cc;0;S;;;;;N;INFORMATION SEPARATOR ONE;;;;
+0020;SPACE;Zs;0;WS;;;;;N;;;;;
+0021;EXCLAMATION MARK;Po;0;ON;;;;;N;;;;;
+0022;QUOTATION MARK;Po;0;ON;;;;;N;;;;;
+0023;NUMBER SIGN;Po;0;ET;;;;;N;;;;;
+0024;DOLLAR SIGN;Sc;0;ET;;;;;N;;;;;
+0025;PERCENT SIGN;Po;0;ET;;;;;N;;;;;
+0026;AMPERSAND;Po;0;ON;;;;;N;;;;;
+0027;APOSTROPHE;Po;0;ON;;;;;N;APOSTROPHE-QUOTE;;;;
+0028;LEFT PARENTHESIS;Ps;0;ON;;;;;Y;OPENING PARENTHESIS;;;;
+0029;RIGHT PARENTHESIS;Pe;0;ON;;;;;Y;CLOSING PARENTHESIS;;;;
+002A;ASTERISK;Po;0;ON;;;;;N;;;;;
+002B;PLUS SIGN;Sm;0;ES;;;;;N;;;;;
+002C;COMMA;Po;0;CS;;;;;N;;;;;
+002D;HYPHEN-MINUS;Pd;0;ES;;;;;N;;;;;
+002E;FULL STOP;Po;0;CS;;;;;N;PERIOD;;;;
+002F;SOLIDUS;Po;0;CS;;;;;N;SLASH;;;;
+0030;DIGIT ZERO;Nd;0;EN;;0;0;0;N;;;;;
+0031;DIGIT ONE;Nd;0;EN;;1;1;1;N;;;;;
+0032;DIGIT TWO;Nd;0;EN;;2;2;2;N;;;;;
+0033;DIGIT THREE;Nd;0;EN;;3;3;3;N;;;;;
+0034;DIGIT FOUR;Nd;0;EN;;4;4;4;N;;;;;
+0035;DIGIT FIVE;Nd;0;EN;;5;5;5;N;;;;;
+0036;DIGIT SIX;Nd;0;EN;;6;6;6;N;;;;;
+0037;DIGIT SEVEN;Nd;0;EN;;7;7;7;N;;;;;
+0038;DIGIT EIGHT;Nd;0;EN;;8;8;8;N;;;;;
+0039;DIGIT NINE;Nd;0;EN;;9;9;9;N;;;;;
+003A;COLON;Po;0;CS;;;;;N;;;;;
+003B;SEMICOLON;Po;0;ON;;;;;N;;;;;
+003C;LESS-THAN SIGN;Sm;0;ON;;;;;Y;;;;;
+003D;EQUALS SIGN;Sm;0;ON;;;;;N;;;;;
+003E;GREATER-THAN SIGN;Sm;0;ON;;;;;Y;;;;;
+003F;QUESTION MARK;Po;0;ON;;;;;N;;;;;
+0040;COMMERCIAL AT;Po;0;ON;;;;;N;;;;;
+0041;LATIN CAPITAL LETTER A;Lu;0;L;;;;;N;;;;0061;
+0042;LATIN CAPITAL LETTER B;Lu;0;L;;;;;N;;;;0062;
+0043;LATIN CAPITAL LETTER C;Lu;0;L;;;;;N;;;;0063;
+0044;LATIN CAPITAL LETTER D;Lu;0;L;;;;;N;;;;0064;
+0045;LATIN CAPITAL LETTER E;Lu;0;L;;;;;N;;;;0065;
+0046;LATIN CAPITAL LETTER F;Lu;0;L;;;;;N;;;;0066;
+0047;LATIN CAPITAL LETTER G;Lu;0;L;;;;;N;;;;0067;
+0048;LATIN CAPITAL LETTER H;Lu;0;L;;;;;N;;;;0068;
+0049;LATIN CAPITAL LETTER I;Lu;0;L;;;;;N;;;;0069;
+004A;LATIN CAPITAL LETTER J;Lu;0;L;;;;;N;;;;006A;
+004B;LATIN CAPITAL LETTER K;Lu;0;L;;;;;N;;;;006B;
+004C;LATIN CAPITAL LETTER L;Lu;0;L;;;;;N;;;;006C;
+004D;LATIN CAPITAL LETTER M;Lu;0;L;;;;;N;;;;006D;
+004E;LATIN CAPITAL LETTER N;Lu;0;L;;;;;N;;;;006E;
+004F;LATIN CAPITAL LETTER O;Lu;0;L;;;;;N;;;;006F;
+0050;LATIN CAPITAL LETTER P;Lu;0;L;;;;;N;;;;0070;
+0051;LATIN CAPITAL LETTER Q;Lu;0;L;;;;;N;;;;0071;
+0052;LATIN CAPITAL LETTER R;Lu;0;L;;;;;N;;;;0072;
+0053;LATIN CAPITAL LETTER S;Lu;0;L;;;;;N;;;;0073;
+0054;LATIN CAPITAL LETTER T;Lu;0;L;;;;;N;;;;0074;
+0055;LATIN CAPITAL LETTER U;Lu;0;L;;;;;N;;;;0075;
+0056;LATIN CAPITAL LETTER V;Lu;0;L;;;;;N;;;;0076;
+0057;LATIN CAPITAL LETTER W;Lu;0;L;;;;;N;;;;0077;
+0058;LATIN CAPITAL LETTER X;Lu;0;L;;;;;N;;;;0078;
+0059;LATIN CAPITAL LETTER Y;Lu;0;L;;;;;N;;;;0079;
+005A;LATIN CAPITAL LETTER Z;Lu;0;L;;;;;N;;;;007A;
+005B;LEFT SQUARE BRACKET;Ps;0;ON;;;;;Y;OPENING SQUARE BRACKET;;;;
+005C;REVERSE SOLIDUS;Po;0;ON;;;;;N;BACKSLASH;;;;
+005D;RIGHT SQUARE BRACKET;Pe;0;ON;;;;;Y;CLOSING SQUARE BRACKET;;;;
+005E;CIRCUMFLEX ACCENT;Sk;0;ON;;;;;N;SPACING CIRCUMFLEX;;;;
+005F;LOW LINE;Pc;0;ON;;;;;N;SPACING UNDERSCORE;;;;
+0060;GRAVE ACCENT;Sk;0;ON;;;;;N;SPACING GRAVE;;;;
+0061;LATIN SMALL LETTER A;Ll;0;L;;;;;N;;;0041;;0041
+0062;LATIN SMALL LETTER B;Ll;0;L;;;;;N;;;0042;;0042
+0063;LATIN SMALL LETTER C;Ll;0;L;;;;;N;;;0043;;0043
+0064;LATIN SMALL LETTER D;Ll;0;L;;;;;N;;;0044;;0044
+0065;LATIN SMALL LETTER E;Ll;0;L;;;;;N;;;0045;;0045
+0066;LATIN SMALL LETTER F;Ll;0;L;;;;;N;;;0046;;0046
+0067;LATIN SMALL LETTER G;Ll;0;L;;;;;N;;;0047;;0047
+0068;LATIN SMALL LETTER H;Ll;0;L;;;;;N;;;0048;;0048
+0069;LATIN SMALL LETTER I;Ll;0;L;;;;;N;;;0049;;0049
+006A;LATIN SMALL LETTER J;Ll;0;L;;;;;N;;;004A;;004A
+006B;LATIN SMALL LETTER K;Ll;0;L;;;;;N;;;004B;;004B
+006C;LATIN SMALL LETTER L;Ll;0;L;;;;;N;;;004C;;004C
+006D;LATIN SMALL LETTER M;Ll;0;L;;;;;N;;;004D;;004D
+006E;LATIN SMALL LETTER N;Ll;0;L;;;;;N;;;004E;;004E
+006F;LATIN SMALL LETTER O;Ll;0;L;;;;;N;;;004F;;004F
+0070;LATIN SMALL LETTER P;Ll;0;L;;;;;N;;;0050;;0050
+0071;LATIN SMALL LETTER Q;Ll;0;L;;;;;N;;;0051;;0051
+0072;LATIN SMALL LETTER R;Ll;0;L;;;;;N;;;0052;;0052
+0073;LATIN SMALL LETTER S;Ll;0;L;;;;;N;;;0053;;0053
+0074;LATIN SMALL LETTER T;Ll;0;L;;;;;N;;;0054;;0054
+0075;LATIN SMALL LETTER U;Ll;0;L;;;;;N;;;0055;;0055
+0076;LATIN SMALL LETTER V;Ll;0;L;;;;;N;;;0056;;0056
+0077;LATIN SMALL LETTER W;Ll;0;L;;;;;N;;;0057;;0057
+0078;LATIN SMALL LETTER X;Ll;0;L;;;;;N;;;0058;;0058
+0079;LATIN SMALL LETTER Y;Ll;0;L;;;;;N;;;0059;;0059
+007A;LATIN SMALL LETTER Z;Ll;0;L;;;;;N;;;005A;;005A
+007B;LEFT CURLY BRACKET;Ps;0;ON;;;;;Y;OPENING CURLY BRACKET;;;;
+007C;VERTICAL LINE;Sm;0;ON;;;;;N;VERTICAL BAR;;;;
+007D;RIGHT CURLY BRACKET;Pe;0;ON;;;;;Y;CLOSING CURLY BRACKET;;;;
+007E;TILDE;Sm;0;ON;;;;;N;;;;;
+007F;<control>;Cc;0;BN;;;;;N;DELETE;;;;
+0080;<control>;Cc;0;BN;;;;;N;;;;;
+0081;<control>;Cc;0;BN;;;;;N;;;;;
+0082;<control>;Cc;0;BN;;;;;N;BREAK PERMITTED HERE;;;;
+0083;<control>;Cc;0;BN;;;;;N;NO BREAK HERE;;;;
+0084;<control>;Cc;0;BN;;;;;N;;;;;
+0085;<control>;Cc;0;B;;;;;N;NEXT LINE (NEL);;;;
+0086;<control>;Cc;0;BN;;;;;N;START OF SELECTED AREA;;;;
+0087;<control>;Cc;0;BN;;;;;N;END OF SELECTED AREA;;;;
+0088;<control>;Cc;0;BN;;;;;N;CHARACTER TABULATION SET;;;;
+0089;<control>;Cc;0;BN;;;;;N;CHARACTER TABULATION WITH JUSTIFICATION;;;;
+008A;<control>;Cc;0;BN;;;;;N;LINE TABULATION SET;;;;
+008B;<control>;Cc;0;BN;;;;;N;PARTIAL LINE FORWARD;;;;
+008C;<control>;Cc;0;BN;;;;;N;PARTIAL LINE BACKWARD;;;;
+008D;<control>;Cc;0;BN;;;;;N;REVERSE LINE FEED;;;;
+008E;<control>;Cc;0;BN;;;;;N;SINGLE SHIFT TWO;;;;
+008F;<control>;Cc;0;BN;;;;;N;SINGLE SHIFT THREE;;;;
+0090;<control>;Cc;0;BN;;;;;N;DEVICE CONTROL STRING;;;;
+0091;<control>;Cc;0;BN;;;;;N;PRIVATE USE ONE;;;;
+0092;<control>;Cc;0;BN;;;;;N;PRIVATE USE TWO;;;;
+0093;<control>;Cc;0;BN;;;;;N;SET TRANSMIT STATE;;;;
+0094;<control>;Cc;0;BN;;;;;N;CANCEL CHARACTER;;;;
+0095;<control>;Cc;0;BN;;;;;N;MESSAGE WAITING;;;;
+0096;<control>;Cc;0;BN;;;;;N;START OF GUARDED AREA;;;;
+0097;<control>;Cc;0;BN;;;;;N;END OF GUARDED AREA;;;;
+0098;<control>;Cc;0;BN;;;;;N;START OF STRING;;;;
+0099;<control>;Cc;0;BN;;;;;N;;;;;
+009A;<control>;Cc;0;BN;;;;;N;SINGLE CHARACTER INTRODUCER;;;;
+009B;<control>;Cc;0;BN;;;;;N;CONTROL SEQUENCE INTRODUCER;;;;
+009C;<control>;Cc;0;BN;;;;;N;STRING TERMINATOR;;;;
+009D;<control>;Cc;0;BN;;;;;N;OPERATING SYSTEM COMMAND;;;;
+009E;<control>;Cc;0;BN;;;;;N;PRIVACY MESSAGE;;;;
+009F;<control>;Cc;0;BN;;;;;N;APPLICATION PROGRAM COMMAND;;;;
+00A0;NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020;;;;N;NON-BREAKING SPACE;;;;
+00A1;INVERTED EXCLAMATION MARK;Po;0;ON;;;;;N;;;;;
+00A2;CENT SIGN;Sc;0;ET;;;;;N;;;;;
+00A3;POUND SIGN;Sc;0;ET;;;;;N;;;;;
+00A4;CURRENCY SIGN;Sc;0;ET;;;;;N;;;;;
+00A5;YEN SIGN;Sc;0;ET;;;;;N;;;;;
+00A6;BROKEN BAR;So;0;ON;;;;;N;BROKEN VERTICAL BAR;;;;
+00A7;SECTION SIGN;So;0;ON;;;;;N;;;;;
+00A8;DIAERESIS;Sk;0;ON;<compat> 0020 0308;;;;N;SPACING DIAERESIS;;;;
+00A9;COPYRIGHT SIGN;So;0;ON;;;;;N;;;;;
+00AA;FEMININE ORDINAL INDICATOR;Ll;0;L;<super> 0061;;;;N;;;;;
+00AB;LEFT-POINTING DOUBLE ANGLE QUOTATION MARK;Pi;0;ON;;;;;Y;LEFT POINTING GUILLEMET;*;;;
+00AC;NOT SIGN;Sm;0;ON;;;;;N;;;;;
+00AD;SOFT HYPHEN;Cf;0;BN;;;;;N;;;;;
+00AE;REGISTERED SIGN;So;0;ON;;;;;N;REGISTERED TRADE MARK SIGN;;;;
+00AF;MACRON;Sk;0;ON;<compat> 0020 0304;;;;N;SPACING MACRON;;;;
+00B0;DEGREE SIGN;So;0;ET;;;;;N;;;;;
+00B1;PLUS-MINUS SIGN;Sm;0;ET;;;;;N;PLUS-OR-MINUS SIGN;;;;
+00B2;SUPERSCRIPT TWO;No;0;EN;<super> 0032;;2;2;N;SUPERSCRIPT DIGIT TWO;;;;
+00B3;SUPERSCRIPT THREE;No;0;EN;<super> 0033;;3;3;N;SUPERSCRIPT DIGIT THREE;;;;
+00B4;ACUTE ACCENT;Sk;0;ON;<compat> 0020 0301;;;;N;SPACING ACUTE;;;;
+00B5;MICRO SIGN;Ll;0;L;<compat> 03BC;;;;N;;;039C;;039C
+00B6;PILCROW SIGN;So;0;ON;;;;;N;PARAGRAPH SIGN;;;;
+00B7;MIDDLE DOT;Po;0;ON;;;;;N;;;;;
+00B8;CEDILLA;Sk;0;ON;<compat> 0020 0327;;;;N;SPACING CEDILLA;;;;
+00B9;SUPERSCRIPT ONE;No;0;EN;<super> 0031;;1;1;N;SUPERSCRIPT DIGIT ONE;;;;
+00BA;MASCULINE ORDINAL INDICATOR;Ll;0;L;<super> 006F;;;;N;;;;;
+00BB;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING GUILLEMET;*;;;
+00BC;VULGAR FRACTION ONE QUARTER;No;0;ON;<fraction> 0031 2044 0034;;;1/4;N;FRACTION ONE QUARTER;;;;
+00BD;VULGAR FRACTION ONE HALF;No;0;ON;<fraction> 0031 2044 0032;;;1/2;N;FRACTION ONE HALF;;;;
+00BE;VULGAR FRACTION THREE QUARTERS;No;0;ON;<fraction> 0033 2044 0034;;;3/4;N;FRACTION THREE QUARTERS;;;;
+00BF;INVERTED QUESTION MARK;Po;0;ON;;;;;N;;;;;
+00C0;LATIN CAPITAL LETTER A WITH GRAVE;Lu;0;L;0041 0300;;;;N;LATIN CAPITAL LETTER A GRAVE;;;00E0;
+00C1;LATIN CAPITAL LETTER A WITH ACUTE;Lu;0;L;0041 0301;;;;N;LATIN CAPITAL LETTER A ACUTE;;;00E1;
+00C2;LATIN CAPITAL LETTER A WITH CIRCUMFLEX;Lu;0;L;0041 0302;;;;N;LATIN CAPITAL LETTER A CIRCUMFLEX;;;00E2;
+00C3;LATIN CAPITAL LETTER A WITH TILDE;Lu;0;L;0041 0303;;;;N;LATIN CAPITAL LETTER A TILDE;;;00E3;
+00C4;LATIN CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0041 0308;;;;N;LATIN CAPITAL LETTER A DIAERESIS;;;00E4;
+00C5;LATIN CAPITAL LETTER A WITH RING ABOVE;Lu;0;L;0041 030A;;;;N;LATIN CAPITAL LETTER A RING;;;00E5;
+00C6;LATIN CAPITAL LETTER AE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER A E;ash *;;00E6;
+00C7;LATIN CAPITAL LETTER C WITH CEDILLA;Lu;0;L;0043 0327;;;;N;LATIN CAPITAL LETTER C CEDILLA;;;00E7;
+00C8;LATIN CAPITAL LETTER E WITH GRAVE;Lu;0;L;0045 0300;;;;N;LATIN CAPITAL LETTER E GRAVE;;;00E8;
+00C9;LATIN CAPITAL LETTER E WITH ACUTE;Lu;0;L;0045 0301;;;;N;LATIN CAPITAL LETTER E ACUTE;;;00E9;
+00CA;LATIN CAPITAL LETTER E WITH CIRCUMFLEX;Lu;0;L;0045 0302;;;;N;LATIN CAPITAL LETTER E CIRCUMFLEX;;;00EA;
+00CB;LATIN CAPITAL LETTER E WITH DIAERESIS;Lu;0;L;0045 0308;;;;N;LATIN CAPITAL LETTER E DIAERESIS;;;00EB;
+00CC;LATIN CAPITAL LETTER I WITH GRAVE;Lu;0;L;0049 0300;;;;N;LATIN CAPITAL LETTER I GRAVE;;;00EC;
+00CD;LATIN CAPITAL LETTER I WITH ACUTE;Lu;0;L;0049 0301;;;;N;LATIN CAPITAL LETTER I ACUTE;;;00ED;
+00CE;LATIN CAPITAL LETTER I WITH CIRCUMFLEX;Lu;0;L;0049 0302;;;;N;LATIN CAPITAL LETTER I CIRCUMFLEX;;;00EE;
+00CF;LATIN CAPITAL LETTER I WITH DIAERESIS;Lu;0;L;0049 0308;;;;N;LATIN CAPITAL LETTER I DIAERESIS;;;00EF;
+00D0;LATIN CAPITAL LETTER ETH;Lu;0;L;;;;;N;;Icelandic;;00F0;
+00D1;LATIN CAPITAL LETTER N WITH TILDE;Lu;0;L;004E 0303;;;;N;LATIN CAPITAL LETTER N TILDE;;;00F1;
+00D2;LATIN CAPITAL LETTER O WITH GRAVE;Lu;0;L;004F 0300;;;;N;LATIN CAPITAL LETTER O GRAVE;;;00F2;
+00D3;LATIN CAPITAL LETTER O WITH ACUTE;Lu;0;L;004F 0301;;;;N;LATIN CAPITAL LETTER O ACUTE;;;00F3;
+00D4;LATIN CAPITAL LETTER O WITH CIRCUMFLEX;Lu;0;L;004F 0302;;;;N;LATIN CAPITAL LETTER O CIRCUMFLEX;;;00F4;
+00D5;LATIN CAPITAL LETTER O WITH TILDE;Lu;0;L;004F 0303;;;;N;LATIN CAPITAL LETTER O TILDE;;;00F5;
+00D6;LATIN CAPITAL LETTER O WITH DIAERESIS;Lu;0;L;004F 0308;;;;N;LATIN CAPITAL LETTER O DIAERESIS;;;00F6;
+00D7;MULTIPLICATION SIGN;Sm;0;ON;;;;;N;;;;;
+00D8;LATIN CAPITAL LETTER O WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER O SLASH;;;00F8;
+00D9;LATIN CAPITAL LETTER U WITH GRAVE;Lu;0;L;0055 0300;;;;N;LATIN CAPITAL LETTER U GRAVE;;;00F9;
+00DA;LATIN CAPITAL LETTER U WITH ACUTE;Lu;0;L;0055 0301;;;;N;LATIN CAPITAL LETTER U ACUTE;;;00FA;
+00DB;LATIN CAPITAL LETTER U WITH CIRCUMFLEX;Lu;0;L;0055 0302;;;;N;LATIN CAPITAL LETTER U CIRCUMFLEX;;;00FB;
+00DC;LATIN CAPITAL LETTER U WITH DIAERESIS;Lu;0;L;0055 0308;;;;N;LATIN CAPITAL LETTER U DIAERESIS;;;00FC;
+00DD;LATIN CAPITAL LETTER Y WITH ACUTE;Lu;0;L;0059 0301;;;;N;LATIN CAPITAL LETTER Y ACUTE;;;00FD;
+00DE;LATIN CAPITAL LETTER THORN;Lu;0;L;;;;;N;;Icelandic;;00FE;
+00DF;LATIN SMALL LETTER SHARP S;Ll;0;L;;;;;N;;German;;;
+00E0;LATIN SMALL LETTER A WITH GRAVE;Ll;0;L;0061 0300;;;;N;LATIN SMALL LETTER A GRAVE;;00C0;;00C0
+00E1;LATIN SMALL LETTER A WITH ACUTE;Ll;0;L;0061 0301;;;;N;LATIN SMALL LETTER A ACUTE;;00C1;;00C1
+00E2;LATIN SMALL LETTER A WITH CIRCUMFLEX;Ll;0;L;0061 0302;;;;N;LATIN SMALL LETTER A CIRCUMFLEX;;00C2;;00C2
+00E3;LATIN SMALL LETTER A WITH TILDE;Ll;0;L;0061 0303;;;;N;LATIN SMALL LETTER A TILDE;;00C3;;00C3
+00E4;LATIN SMALL LETTER A WITH DIAERESIS;Ll;0;L;0061 0308;;;;N;LATIN SMALL LETTER A DIAERESIS;;00C4;;00C4
+00E5;LATIN SMALL LETTER A WITH RING ABOVE;Ll;0;L;0061 030A;;;;N;LATIN SMALL LETTER A RING;;00C5;;00C5
+00E6;LATIN SMALL LETTER AE;Ll;0;L;;;;;N;LATIN SMALL LETTER A E;ash *;00C6;;00C6
+00E7;LATIN SMALL LETTER C WITH CEDILLA;Ll;0;L;0063 0327;;;;N;LATIN SMALL LETTER C CEDILLA;;00C7;;00C7
+00E8;LATIN SMALL LETTER E WITH GRAVE;Ll;0;L;0065 0300;;;;N;LATIN SMALL LETTER E GRAVE;;00C8;;00C8
+00E9;LATIN SMALL LETTER E WITH ACUTE;Ll;0;L;0065 0301;;;;N;LATIN SMALL LETTER E ACUTE;;00C9;;00C9
+00EA;LATIN SMALL LETTER E WITH CIRCUMFLEX;Ll;0;L;0065 0302;;;;N;LATIN SMALL LETTER E CIRCUMFLEX;;00CA;;00CA
+00EB;LATIN SMALL LETTER E WITH DIAERESIS;Ll;0;L;0065 0308;;;;N;LATIN SMALL LETTER E DIAERESIS;;00CB;;00CB
+00EC;LATIN SMALL LETTER I WITH GRAVE;Ll;0;L;0069 0300;;;;N;LATIN SMALL LETTER I GRAVE;;00CC;;00CC
+00ED;LATIN SMALL LETTER I WITH ACUTE;Ll;0;L;0069 0301;;;;N;LATIN SMALL LETTER I ACUTE;;00CD;;00CD
+00EE;LATIN SMALL LETTER I WITH CIRCUMFLEX;Ll;0;L;0069 0302;;;;N;LATIN SMALL LETTER I CIRCUMFLEX;;00CE;;00CE
+00EF;LATIN SMALL LETTER I WITH DIAERESIS;Ll;0;L;0069 0308;;;;N;LATIN SMALL LETTER I DIAERESIS;;00CF;;00CF
+00F0;LATIN SMALL LETTER ETH;Ll;0;L;;;;;N;;Icelandic;00D0;;00D0
+00F1;LATIN SMALL LETTER N WITH TILDE;Ll;0;L;006E 0303;;;;N;LATIN SMALL LETTER N TILDE;;00D1;;00D1
+00F2;LATIN SMALL LETTER O WITH GRAVE;Ll;0;L;006F 0300;;;;N;LATIN SMALL LETTER O GRAVE;;00D2;;00D2
+00F3;LATIN SMALL LETTER O WITH ACUTE;Ll;0;L;006F 0301;;;;N;LATIN SMALL LETTER O ACUTE;;00D3;;00D3
+00F4;LATIN SMALL LETTER O WITH CIRCUMFLEX;Ll;0;L;006F 0302;;;;N;LATIN SMALL LETTER O CIRCUMFLEX;;00D4;;00D4
+00F5;LATIN SMALL LETTER O WITH TILDE;Ll;0;L;006F 0303;;;;N;LATIN SMALL LETTER O TILDE;;00D5;;00D5
+00F6;LATIN SMALL LETTER O WITH DIAERESIS;Ll;0;L;006F 0308;;;;N;LATIN SMALL LETTER O DIAERESIS;;00D6;;00D6
+00F7;DIVISION SIGN;Sm;0;ON;;;;;N;;;;;
+00F8;LATIN SMALL LETTER O WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER O SLASH;;00D8;;00D8
+00F9;LATIN SMALL LETTER U WITH GRAVE;Ll;0;L;0075 0300;;;;N;LATIN SMALL LETTER U GRAVE;;00D9;;00D9
+00FA;LATIN SMALL LETTER U WITH ACUTE;Ll;0;L;0075 0301;;;;N;LATIN SMALL LETTER U ACUTE;;00DA;;00DA
+00FB;LATIN SMALL LETTER U WITH CIRCUMFLEX;Ll;0;L;0075 0302;;;;N;LATIN SMALL LETTER U CIRCUMFLEX;;00DB;;00DB
+00FC;LATIN SMALL LETTER U WITH DIAERESIS;Ll;0;L;0075 0308;;;;N;LATIN SMALL LETTER U DIAERESIS;;00DC;;00DC
+00FD;LATIN SMALL LETTER Y WITH ACUTE;Ll;0;L;0079 0301;;;;N;LATIN SMALL LETTER Y ACUTE;;00DD;;00DD
+00FE;LATIN SMALL LETTER THORN;Ll;0;L;;;;;N;;Icelandic;00DE;;00DE
+00FF;LATIN SMALL LETTER Y WITH DIAERESIS;Ll;0;L;0079 0308;;;;N;LATIN SMALL LETTER Y DIAERESIS;;0178;;0178
+0100;LATIN CAPITAL LETTER A WITH MACRON;Lu;0;L;0041 0304;;;;N;LATIN CAPITAL LETTER A MACRON;;;0101;
+0101;LATIN SMALL LETTER A WITH MACRON;Ll;0;L;0061 0304;;;;N;LATIN SMALL LETTER A MACRON;;0100;;0100
+0102;LATIN CAPITAL LETTER A WITH BREVE;Lu;0;L;0041 0306;;;;N;LATIN CAPITAL LETTER A BREVE;;;0103;
+0103;LATIN SMALL LETTER A WITH BREVE;Ll;0;L;0061 0306;;;;N;LATIN SMALL LETTER A BREVE;;0102;;0102
+0104;LATIN CAPITAL LETTER A WITH OGONEK;Lu;0;L;0041 0328;;;;N;LATIN CAPITAL LETTER A OGONEK;;;0105;
+0105;LATIN SMALL LETTER A WITH OGONEK;Ll;0;L;0061 0328;;;;N;LATIN SMALL LETTER A OGONEK;;0104;;0104
+0106;LATIN CAPITAL LETTER C WITH ACUTE;Lu;0;L;0043 0301;;;;N;LATIN CAPITAL LETTER C ACUTE;;;0107;
+0107;LATIN SMALL LETTER C WITH ACUTE;Ll;0;L;0063 0301;;;;N;LATIN SMALL LETTER C ACUTE;;0106;;0106
+0108;LATIN CAPITAL LETTER C WITH CIRCUMFLEX;Lu;0;L;0043 0302;;;;N;LATIN CAPITAL LETTER C CIRCUMFLEX;;;0109;
+0109;LATIN SMALL LETTER C WITH CIRCUMFLEX;Ll;0;L;0063 0302;;;;N;LATIN SMALL LETTER C CIRCUMFLEX;;0108;;0108
+010A;LATIN CAPITAL LETTER C WITH DOT ABOVE;Lu;0;L;0043 0307;;;;N;LATIN CAPITAL LETTER C DOT;;;010B;
+010B;LATIN SMALL LETTER C WITH DOT ABOVE;Ll;0;L;0063 0307;;;;N;LATIN SMALL LETTER C DOT;;010A;;010A
+010C;LATIN CAPITAL LETTER C WITH CARON;Lu;0;L;0043 030C;;;;N;LATIN CAPITAL LETTER C HACEK;;;010D;
+010D;LATIN SMALL LETTER C WITH CARON;Ll;0;L;0063 030C;;;;N;LATIN SMALL LETTER C HACEK;;010C;;010C
+010E;LATIN CAPITAL LETTER D WITH CARON;Lu;0;L;0044 030C;;;;N;LATIN CAPITAL LETTER D HACEK;;;010F;
+010F;LATIN SMALL LETTER D WITH CARON;Ll;0;L;0064 030C;;;;N;LATIN SMALL LETTER D HACEK;;010E;;010E
+0110;LATIN CAPITAL LETTER D WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER D BAR;;;0111;
+0111;LATIN SMALL LETTER D WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER D BAR;;0110;;0110
+0112;LATIN CAPITAL LETTER E WITH MACRON;Lu;0;L;0045 0304;;;;N;LATIN CAPITAL LETTER E MACRON;;;0113;
+0113;LATIN SMALL LETTER E WITH MACRON;Ll;0;L;0065 0304;;;;N;LATIN SMALL LETTER E MACRON;;0112;;0112
+0114;LATIN CAPITAL LETTER E WITH BREVE;Lu;0;L;0045 0306;;;;N;LATIN CAPITAL LETTER E BREVE;;;0115;
+0115;LATIN SMALL LETTER E WITH BREVE;Ll;0;L;0065 0306;;;;N;LATIN SMALL LETTER E BREVE;;0114;;0114
+0116;LATIN CAPITAL LETTER E WITH DOT ABOVE;Lu;0;L;0045 0307;;;;N;LATIN CAPITAL LETTER E DOT;;;0117;
+0117;LATIN SMALL LETTER E WITH DOT ABOVE;Ll;0;L;0065 0307;;;;N;LATIN SMALL LETTER E DOT;;0116;;0116
+0118;LATIN CAPITAL LETTER E WITH OGONEK;Lu;0;L;0045 0328;;;;N;LATIN CAPITAL LETTER E OGONEK;;;0119;
+0119;LATIN SMALL LETTER E WITH OGONEK;Ll;0;L;0065 0328;;;;N;LATIN SMALL LETTER E OGONEK;;0118;;0118
+011A;LATIN CAPITAL LETTER E WITH CARON;Lu;0;L;0045 030C;;;;N;LATIN CAPITAL LETTER E HACEK;;;011B;
+011B;LATIN SMALL LETTER E WITH CARON;Ll;0;L;0065 030C;;;;N;LATIN SMALL LETTER E HACEK;;011A;;011A
+011C;LATIN CAPITAL LETTER G WITH CIRCUMFLEX;Lu;0;L;0047 0302;;;;N;LATIN CAPITAL LETTER G CIRCUMFLEX;;;011D;
+011D;LATIN SMALL LETTER G WITH CIRCUMFLEX;Ll;0;L;0067 0302;;;;N;LATIN SMALL LETTER G CIRCUMFLEX;;011C;;011C
+011E;LATIN CAPITAL LETTER G WITH BREVE;Lu;0;L;0047 0306;;;;N;LATIN CAPITAL LETTER G BREVE;;;011F;
+011F;LATIN SMALL LETTER G WITH BREVE;Ll;0;L;0067 0306;;;;N;LATIN SMALL LETTER G BREVE;;011E;;011E
+0120;LATIN CAPITAL LETTER G WITH DOT ABOVE;Lu;0;L;0047 0307;;;;N;LATIN CAPITAL LETTER G DOT;;;0121;
+0121;LATIN SMALL LETTER G WITH DOT ABOVE;Ll;0;L;0067 0307;;;;N;LATIN SMALL LETTER G DOT;;0120;;0120
+0122;LATIN CAPITAL LETTER G WITH CEDILLA;Lu;0;L;0047 0327;;;;N;LATIN CAPITAL LETTER G CEDILLA;;;0123;
+0123;LATIN SMALL LETTER G WITH CEDILLA;Ll;0;L;0067 0327;;;;N;LATIN SMALL LETTER G CEDILLA;;0122;;0122
+0124;LATIN CAPITAL LETTER H WITH CIRCUMFLEX;Lu;0;L;0048 0302;;;;N;LATIN CAPITAL LETTER H CIRCUMFLEX;;;0125;
+0125;LATIN SMALL LETTER H WITH CIRCUMFLEX;Ll;0;L;0068 0302;;;;N;LATIN SMALL LETTER H CIRCUMFLEX;;0124;;0124
+0126;LATIN CAPITAL LETTER H WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER H BAR;;;0127;
+0127;LATIN SMALL LETTER H WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER H BAR;;0126;;0126
+0128;LATIN CAPITAL LETTER I WITH TILDE;Lu;0;L;0049 0303;;;;N;LATIN CAPITAL LETTER I TILDE;;;0129;
+0129;LATIN SMALL LETTER I WITH TILDE;Ll;0;L;0069 0303;;;;N;LATIN SMALL LETTER I TILDE;;0128;;0128
+012A;LATIN CAPITAL LETTER I WITH MACRON;Lu;0;L;0049 0304;;;;N;LATIN CAPITAL LETTER I MACRON;;;012B;
+012B;LATIN SMALL LETTER I WITH MACRON;Ll;0;L;0069 0304;;;;N;LATIN SMALL LETTER I MACRON;;012A;;012A
+012C;LATIN CAPITAL LETTER I WITH BREVE;Lu;0;L;0049 0306;;;;N;LATIN CAPITAL LETTER I BREVE;;;012D;
+012D;LATIN SMALL LETTER I WITH BREVE;Ll;0;L;0069 0306;;;;N;LATIN SMALL LETTER I BREVE;;012C;;012C
+012E;LATIN CAPITAL LETTER I WITH OGONEK;Lu;0;L;0049 0328;;;;N;LATIN CAPITAL LETTER I OGONEK;;;012F;
+012F;LATIN SMALL LETTER I WITH OGONEK;Ll;0;L;0069 0328;;;;N;LATIN SMALL LETTER I OGONEK;;012E;;012E
+0130;LATIN CAPITAL LETTER I WITH DOT ABOVE;Lu;0;L;0049 0307;;;;N;LATIN CAPITAL LETTER I DOT;;;0069;
+0131;LATIN SMALL LETTER DOTLESS I;Ll;0;L;;;;;N;;;0049;;0049
+0132;LATIN CAPITAL LIGATURE IJ;Lu;0;L;<compat> 0049 004A;;;;N;LATIN CAPITAL LETTER I J;;;0133;
+0133;LATIN SMALL LIGATURE IJ;Ll;0;L;<compat> 0069 006A;;;;N;LATIN SMALL LETTER I J;;0132;;0132
+0134;LATIN CAPITAL LETTER J WITH CIRCUMFLEX;Lu;0;L;004A 0302;;;;N;LATIN CAPITAL LETTER J CIRCUMFLEX;;;0135;
+0135;LATIN SMALL LETTER J WITH CIRCUMFLEX;Ll;0;L;006A 0302;;;;N;LATIN SMALL LETTER J CIRCUMFLEX;;0134;;0134
+0136;LATIN CAPITAL LETTER K WITH CEDILLA;Lu;0;L;004B 0327;;;;N;LATIN CAPITAL LETTER K CEDILLA;;;0137;
+0137;LATIN SMALL LETTER K WITH CEDILLA;Ll;0;L;006B 0327;;;;N;LATIN SMALL LETTER K CEDILLA;;0136;;0136
+0138;LATIN SMALL LETTER KRA;Ll;0;L;;;;;N;;Greenlandic;;;
+0139;LATIN CAPITAL LETTER L WITH ACUTE;Lu;0;L;004C 0301;;;;N;LATIN CAPITAL LETTER L ACUTE;;;013A;
+013A;LATIN SMALL LETTER L WITH ACUTE;Ll;0;L;006C 0301;;;;N;LATIN SMALL LETTER L ACUTE;;0139;;0139
+013B;LATIN CAPITAL LETTER L WITH CEDILLA;Lu;0;L;004C 0327;;;;N;LATIN CAPITAL LETTER L CEDILLA;;;013C;
+013C;LATIN SMALL LETTER L WITH CEDILLA;Ll;0;L;006C 0327;;;;N;LATIN SMALL LETTER L CEDILLA;;013B;;013B
+013D;LATIN CAPITAL LETTER L WITH CARON;Lu;0;L;004C 030C;;;;N;LATIN CAPITAL LETTER L HACEK;;;013E;
+013E;LATIN SMALL LETTER L WITH CARON;Ll;0;L;006C 030C;;;;N;LATIN SMALL LETTER L HACEK;;013D;;013D
+013F;LATIN CAPITAL LETTER L WITH MIDDLE DOT;Lu;0;L;<compat> 004C 00B7;;;;N;;;;0140;
+0140;LATIN SMALL LETTER L WITH MIDDLE DOT;Ll;0;L;<compat> 006C 00B7;;;;N;;;013F;;013F
+0141;LATIN CAPITAL LETTER L WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER L SLASH;;;0142;
+0142;LATIN SMALL LETTER L WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER L SLASH;;0141;;0141
+0143;LATIN CAPITAL LETTER N WITH ACUTE;Lu;0;L;004E 0301;;;;N;LATIN CAPITAL LETTER N ACUTE;;;0144;
+0144;LATIN SMALL LETTER N WITH ACUTE;Ll;0;L;006E 0301;;;;N;LATIN SMALL LETTER N ACUTE;;0143;;0143
+0145;LATIN CAPITAL LETTER N WITH CEDILLA;Lu;0;L;004E 0327;;;;N;LATIN CAPITAL LETTER N CEDILLA;;;0146;
+0146;LATIN SMALL LETTER N WITH CEDILLA;Ll;0;L;006E 0327;;;;N;LATIN SMALL LETTER N CEDILLA;;0145;;0145
+0147;LATIN CAPITAL LETTER N WITH CARON;Lu;0;L;004E 030C;;;;N;LATIN CAPITAL LETTER N HACEK;;;0148;
+0148;LATIN SMALL LETTER N WITH CARON;Ll;0;L;006E 030C;;;;N;LATIN SMALL LETTER N HACEK;;0147;;0147
+0149;LATIN SMALL LETTER N PRECEDED BY APOSTROPHE;Ll;0;L;<compat> 02BC 006E;;;;N;LATIN SMALL LETTER APOSTROPHE N;;;;
+014A;LATIN CAPITAL LETTER ENG;Lu;0;L;;;;;N;;Sami;;014B;
+014B;LATIN SMALL LETTER ENG;Ll;0;L;;;;;N;;Sami;014A;;014A
+014C;LATIN CAPITAL LETTER O WITH MACRON;Lu;0;L;004F 0304;;;;N;LATIN CAPITAL LETTER O MACRON;;;014D;
+014D;LATIN SMALL LETTER O WITH MACRON;Ll;0;L;006F 0304;;;;N;LATIN SMALL LETTER O MACRON;;014C;;014C
+014E;LATIN CAPITAL LETTER O WITH BREVE;Lu;0;L;004F 0306;;;;N;LATIN CAPITAL LETTER O BREVE;;;014F;
+014F;LATIN SMALL LETTER O WITH BREVE;Ll;0;L;006F 0306;;;;N;LATIN SMALL LETTER O BREVE;;014E;;014E
+0150;LATIN CAPITAL LETTER O WITH DOUBLE ACUTE;Lu;0;L;004F 030B;;;;N;LATIN CAPITAL LETTER O DOUBLE ACUTE;;;0151;
+0151;LATIN SMALL LETTER O WITH DOUBLE ACUTE;Ll;0;L;006F 030B;;;;N;LATIN SMALL LETTER O DOUBLE ACUTE;;0150;;0150
+0152;LATIN CAPITAL LIGATURE OE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER O E;;;0153;
+0153;LATIN SMALL LIGATURE OE;Ll;0;L;;;;;N;LATIN SMALL LETTER O E;;0152;;0152
+0154;LATIN CAPITAL LETTER R WITH ACUTE;Lu;0;L;0052 0301;;;;N;LATIN CAPITAL LETTER R ACUTE;;;0155;
+0155;LATIN SMALL LETTER R WITH ACUTE;Ll;0;L;0072 0301;;;;N;LATIN SMALL LETTER R ACUTE;;0154;;0154
+0156;LATIN CAPITAL LETTER R WITH CEDILLA;Lu;0;L;0052 0327;;;;N;LATIN CAPITAL LETTER R CEDILLA;;;0157;
+0157;LATIN SMALL LETTER R WITH CEDILLA;Ll;0;L;0072 0327;;;;N;LATIN SMALL LETTER R CEDILLA;;0156;;0156
+0158;LATIN CAPITAL LETTER R WITH CARON;Lu;0;L;0052 030C;;;;N;LATIN CAPITAL LETTER R HACEK;;;0159;
+0159;LATIN SMALL LETTER R WITH CARON;Ll;0;L;0072 030C;;;;N;LATIN SMALL LETTER R HACEK;;0158;;0158
+015A;LATIN CAPITAL LETTER S WITH ACUTE;Lu;0;L;0053 0301;;;;N;LATIN CAPITAL LETTER S ACUTE;;;015B;
+015B;LATIN SMALL LETTER S WITH ACUTE;Ll;0;L;0073 0301;;;;N;LATIN SMALL LETTER S ACUTE;;015A;;015A
+015C;LATIN CAPITAL LETTER S WITH CIRCUMFLEX;Lu;0;L;0053 0302;;;;N;LATIN CAPITAL LETTER S CIRCUMFLEX;;;015D;
+015D;LATIN SMALL LETTER S WITH CIRCUMFLEX;Ll;0;L;0073 0302;;;;N;LATIN SMALL LETTER S CIRCUMFLEX;;015C;;015C
+015E;LATIN CAPITAL LETTER S WITH CEDILLA;Lu;0;L;0053 0327;;;;N;LATIN CAPITAL LETTER S CEDILLA;*;;015F;
+015F;LATIN SMALL LETTER S WITH CEDILLA;Ll;0;L;0073 0327;;;;N;LATIN SMALL LETTER S CEDILLA;*;015E;;015E
+0160;LATIN CAPITAL LETTER S WITH CARON;Lu;0;L;0053 030C;;;;N;LATIN CAPITAL LETTER S HACEK;;;0161;
+0161;LATIN SMALL LETTER S WITH CARON;Ll;0;L;0073 030C;;;;N;LATIN SMALL LETTER S HACEK;;0160;;0160
+0162;LATIN CAPITAL LETTER T WITH CEDILLA;Lu;0;L;0054 0327;;;;N;LATIN CAPITAL LETTER T CEDILLA;*;;0163;
+0163;LATIN SMALL LETTER T WITH CEDILLA;Ll;0;L;0074 0327;;;;N;LATIN SMALL LETTER T CEDILLA;*;0162;;0162
+0164;LATIN CAPITAL LETTER T WITH CARON;Lu;0;L;0054 030C;;;;N;LATIN CAPITAL LETTER T HACEK;;;0165;
+0165;LATIN SMALL LETTER T WITH CARON;Ll;0;L;0074 030C;;;;N;LATIN SMALL LETTER T HACEK;;0164;;0164
+0166;LATIN CAPITAL LETTER T WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER T BAR;;;0167;
+0167;LATIN SMALL LETTER T WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER T BAR;;0166;;0166
+0168;LATIN CAPITAL LETTER U WITH TILDE;Lu;0;L;0055 0303;;;;N;LATIN CAPITAL LETTER U TILDE;;;0169;
+0169;LATIN SMALL LETTER U WITH TILDE;Ll;0;L;0075 0303;;;;N;LATIN SMALL LETTER U TILDE;;0168;;0168
+016A;LATIN CAPITAL LETTER U WITH MACRON;Lu;0;L;0055 0304;;;;N;LATIN CAPITAL LETTER U MACRON;;;016B;
+016B;LATIN SMALL LETTER U WITH MACRON;Ll;0;L;0075 0304;;;;N;LATIN SMALL LETTER U MACRON;;016A;;016A
+016C;LATIN CAPITAL LETTER U WITH BREVE;Lu;0;L;0055 0306;;;;N;LATIN CAPITAL LETTER U BREVE;;;016D;
+016D;LATIN SMALL LETTER U WITH BREVE;Ll;0;L;0075 0306;;;;N;LATIN SMALL LETTER U BREVE;;016C;;016C
+016E;LATIN CAPITAL LETTER U WITH RING ABOVE;Lu;0;L;0055 030A;;;;N;LATIN CAPITAL LETTER U RING;;;016F;
+016F;LATIN SMALL LETTER U WITH RING ABOVE;Ll;0;L;0075 030A;;;;N;LATIN SMALL LETTER U RING;;016E;;016E
+0170;LATIN CAPITAL LETTER U WITH DOUBLE ACUTE;Lu;0;L;0055 030B;;;;N;LATIN CAPITAL LETTER U DOUBLE ACUTE;;;0171;
+0171;LATIN SMALL LETTER U WITH DOUBLE ACUTE;Ll;0;L;0075 030B;;;;N;LATIN SMALL LETTER U DOUBLE ACUTE;;0170;;0170
+0172;LATIN CAPITAL LETTER U WITH OGONEK;Lu;0;L;0055 0328;;;;N;LATIN CAPITAL LETTER U OGONEK;;;0173;
+0173;LATIN SMALL LETTER U WITH OGONEK;Ll;0;L;0075 0328;;;;N;LATIN SMALL LETTER U OGONEK;;0172;;0172
+0174;LATIN CAPITAL LETTER W WITH CIRCUMFLEX;Lu;0;L;0057 0302;;;;N;LATIN CAPITAL LETTER W CIRCUMFLEX;;;0175;
+0175;LATIN SMALL LETTER W WITH CIRCUMFLEX;Ll;0;L;0077 0302;;;;N;LATIN SMALL LETTER W CIRCUMFLEX;;0174;;0174
+0176;LATIN CAPITAL LETTER Y WITH CIRCUMFLEX;Lu;0;L;0059 0302;;;;N;LATIN CAPITAL LETTER Y CIRCUMFLEX;;;0177;
+0177;LATIN SMALL LETTER Y WITH CIRCUMFLEX;Ll;0;L;0079 0302;;;;N;LATIN SMALL LETTER Y CIRCUMFLEX;;0176;;0176
+0178;LATIN CAPITAL LETTER Y WITH DIAERESIS;Lu;0;L;0059 0308;;;;N;LATIN CAPITAL LETTER Y DIAERESIS;;;00FF;
+0179;LATIN CAPITAL LETTER Z WITH ACUTE;Lu;0;L;005A 0301;;;;N;LATIN CAPITAL LETTER Z ACUTE;;;017A;
+017A;LATIN SMALL LETTER Z WITH ACUTE;Ll;0;L;007A 0301;;;;N;LATIN SMALL LETTER Z ACUTE;;0179;;0179
+017B;LATIN CAPITAL LETTER Z WITH DOT ABOVE;Lu;0;L;005A 0307;;;;N;LATIN CAPITAL LETTER Z DOT;;;017C;
+017C;LATIN SMALL LETTER Z WITH DOT ABOVE;Ll;0;L;007A 0307;;;;N;LATIN SMALL LETTER Z DOT;;017B;;017B
+017D;LATIN CAPITAL LETTER Z WITH CARON;Lu;0;L;005A 030C;;;;N;LATIN CAPITAL LETTER Z HACEK;;;017E;
+017E;LATIN SMALL LETTER Z WITH CARON;Ll;0;L;007A 030C;;;;N;LATIN SMALL LETTER Z HACEK;;017D;;017D
+017F;LATIN SMALL LETTER LONG S;Ll;0;L;<compat> 0073;;;;N;;;0053;;0053
+0180;LATIN SMALL LETTER B WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER B BAR;;0243;;0243
+0181;LATIN CAPITAL LETTER B WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER B HOOK;;;0253;
+0182;LATIN CAPITAL LETTER B WITH TOPBAR;Lu;0;L;;;;;N;LATIN CAPITAL LETTER B TOPBAR;;;0183;
+0183;LATIN SMALL LETTER B WITH TOPBAR;Ll;0;L;;;;;N;LATIN SMALL LETTER B TOPBAR;;0182;;0182
+0184;LATIN CAPITAL LETTER TONE SIX;Lu;0;L;;;;;N;;;;0185;
+0185;LATIN SMALL LETTER TONE SIX;Ll;0;L;;;;;N;;;0184;;0184
+0186;LATIN CAPITAL LETTER OPEN O;Lu;0;L;;;;;N;;;;0254;
+0187;LATIN CAPITAL LETTER C WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER C HOOK;;;0188;
+0188;LATIN SMALL LETTER C WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER C HOOK;;0187;;0187
+0189;LATIN CAPITAL LETTER AFRICAN D;Lu;0;L;;;;;N;;*;;0256;
+018A;LATIN CAPITAL LETTER D WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER D HOOK;;;0257;
+018B;LATIN CAPITAL LETTER D WITH TOPBAR;Lu;0;L;;;;;N;LATIN CAPITAL LETTER D TOPBAR;;;018C;
+018C;LATIN SMALL LETTER D WITH TOPBAR;Ll;0;L;;;;;N;LATIN SMALL LETTER D TOPBAR;;018B;;018B
+018D;LATIN SMALL LETTER TURNED DELTA;Ll;0;L;;;;;N;;;;;
+018E;LATIN CAPITAL LETTER REVERSED E;Lu;0;L;;;;;N;LATIN CAPITAL LETTER TURNED E;;;01DD;
+018F;LATIN CAPITAL LETTER SCHWA;Lu;0;L;;;;;N;;;;0259;
+0190;LATIN CAPITAL LETTER OPEN E;Lu;0;L;;;;;N;LATIN CAPITAL LETTER EPSILON;;;025B;
+0191;LATIN CAPITAL LETTER F WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER F HOOK;;;0192;
+0192;LATIN SMALL LETTER F WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER SCRIPT F;;0191;;0191
+0193;LATIN CAPITAL LETTER G WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER G HOOK;;;0260;
+0194;LATIN CAPITAL LETTER GAMMA;Lu;0;L;;;;;N;;;;0263;
+0195;LATIN SMALL LETTER HV;Ll;0;L;;;;;N;LATIN SMALL LETTER H V;hwair;01F6;;01F6
+0196;LATIN CAPITAL LETTER IOTA;Lu;0;L;;;;;N;;;;0269;
+0197;LATIN CAPITAL LETTER I WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER BARRED I;;;0268;
+0198;LATIN CAPITAL LETTER K WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER K HOOK;;;0199;
+0199;LATIN SMALL LETTER K WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER K HOOK;;0198;;0198
+019A;LATIN SMALL LETTER L WITH BAR;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED L;;023D;;023D
+019B;LATIN SMALL LETTER LAMBDA WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED LAMBDA;;;;
+019C;LATIN CAPITAL LETTER TURNED M;Lu;0;L;;;;;N;;;;026F;
+019D;LATIN CAPITAL LETTER N WITH LEFT HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER N HOOK;;;0272;
+019E;LATIN SMALL LETTER N WITH LONG RIGHT LEG;Ll;0;L;;;;;N;;;0220;;0220
+019F;LATIN CAPITAL LETTER O WITH MIDDLE TILDE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER BARRED O;*;;0275;
+01A0;LATIN CAPITAL LETTER O WITH HORN;Lu;0;L;004F 031B;;;;N;LATIN CAPITAL LETTER O HORN;;;01A1;
+01A1;LATIN SMALL LETTER O WITH HORN;Ll;0;L;006F 031B;;;;N;LATIN SMALL LETTER O HORN;;01A0;;01A0
+01A2;LATIN CAPITAL LETTER OI;Lu;0;L;;;;;N;LATIN CAPITAL LETTER O I;gha;;01A3;
+01A3;LATIN SMALL LETTER OI;Ll;0;L;;;;;N;LATIN SMALL LETTER O I;gha;01A2;;01A2
+01A4;LATIN CAPITAL LETTER P WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER P HOOK;;;01A5;
+01A5;LATIN SMALL LETTER P WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER P HOOK;;01A4;;01A4
+01A6;LATIN LETTER YR;Lu;0;L;;;;;N;LATIN LETTER Y R;*;;0280;
+01A7;LATIN CAPITAL LETTER TONE TWO;Lu;0;L;;;;;N;;;;01A8;
+01A8;LATIN SMALL LETTER TONE TWO;Ll;0;L;;;;;N;;;01A7;;01A7
+01A9;LATIN CAPITAL LETTER ESH;Lu;0;L;;;;;N;;;;0283;
+01AA;LATIN LETTER REVERSED ESH LOOP;Ll;0;L;;;;;N;;;;;
+01AB;LATIN SMALL LETTER T WITH PALATAL HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER T PALATAL HOOK;;;;
+01AC;LATIN CAPITAL LETTER T WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER T HOOK;;;01AD;
+01AD;LATIN SMALL LETTER T WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER T HOOK;;01AC;;01AC
+01AE;LATIN CAPITAL LETTER T WITH RETROFLEX HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER T RETROFLEX HOOK;;;0288;
+01AF;LATIN CAPITAL LETTER U WITH HORN;Lu;0;L;0055 031B;;;;N;LATIN CAPITAL LETTER U HORN;;;01B0;
+01B0;LATIN SMALL LETTER U WITH HORN;Ll;0;L;0075 031B;;;;N;LATIN SMALL LETTER U HORN;;01AF;;01AF
+01B1;LATIN CAPITAL LETTER UPSILON;Lu;0;L;;;;;N;;;;028A;
+01B2;LATIN CAPITAL LETTER V WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER SCRIPT V;;;028B;
+01B3;LATIN CAPITAL LETTER Y WITH HOOK;Lu;0;L;;;;;N;LATIN CAPITAL LETTER Y HOOK;;;01B4;
+01B4;LATIN SMALL LETTER Y WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER Y HOOK;;01B3;;01B3
+01B5;LATIN CAPITAL LETTER Z WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER Z BAR;;;01B6;
+01B6;LATIN SMALL LETTER Z WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER Z BAR;;01B5;;01B5
+01B7;LATIN CAPITAL LETTER EZH;Lu;0;L;;;;;N;LATIN CAPITAL LETTER YOGH;;;0292;
+01B8;LATIN CAPITAL LETTER EZH REVERSED;Lu;0;L;;;;;N;LATIN CAPITAL LETTER REVERSED YOGH;;;01B9;
+01B9;LATIN SMALL LETTER EZH REVERSED;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED YOGH;;01B8;;01B8
+01BA;LATIN SMALL LETTER EZH WITH TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER YOGH WITH TAIL;;;;
+01BB;LATIN LETTER TWO WITH STROKE;Lo;0;L;;;;;N;LATIN LETTER TWO BAR;;;;
+01BC;LATIN CAPITAL LETTER TONE FIVE;Lu;0;L;;;;;N;;;;01BD;
+01BD;LATIN SMALL LETTER TONE FIVE;Ll;0;L;;;;;N;;;01BC;;01BC
+01BE;LATIN LETTER INVERTED GLOTTAL STOP WITH STROKE;Ll;0;L;;;;;N;LATIN LETTER INVERTED GLOTTAL STOP BAR;;;;
+01BF;LATIN LETTER WYNN;Ll;0;L;;;;;N;;;01F7;;01F7
+01C0;LATIN LETTER DENTAL CLICK;Lo;0;L;;;;;N;LATIN LETTER PIPE;;;;
+01C1;LATIN LETTER LATERAL CLICK;Lo;0;L;;;;;N;LATIN LETTER DOUBLE PIPE;;;;
+01C2;LATIN LETTER ALVEOLAR CLICK;Lo;0;L;;;;;N;LATIN LETTER PIPE DOUBLE BAR;;;;
+01C3;LATIN LETTER RETROFLEX CLICK;Lo;0;L;;;;;N;LATIN LETTER EXCLAMATION MARK;;;;
+01C4;LATIN CAPITAL LETTER DZ WITH CARON;Lu;0;L;<compat> 0044 017D;;;;N;LATIN CAPITAL LETTER D Z HACEK;;;01C6;01C5
+01C5;LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON;Lt;0;L;<compat> 0044 017E;;;;N;LATIN LETTER CAPITAL D SMALL Z HACEK;;01C4;01C6;01C5
+01C6;LATIN SMALL LETTER DZ WITH CARON;Ll;0;L;<compat> 0064 017E;;;;N;LATIN SMALL LETTER D Z HACEK;;01C4;;01C5
+01C7;LATIN CAPITAL LETTER LJ;Lu;0;L;<compat> 004C 004A;;;;N;LATIN CAPITAL LETTER L J;;;01C9;01C8
+01C8;LATIN CAPITAL LETTER L WITH SMALL LETTER J;Lt;0;L;<compat> 004C 006A;;;;N;LATIN LETTER CAPITAL L SMALL J;;01C7;01C9;01C8
+01C9;LATIN SMALL LETTER LJ;Ll;0;L;<compat> 006C 006A;;;;N;LATIN SMALL LETTER L J;;01C7;;01C8
+01CA;LATIN CAPITAL LETTER NJ;Lu;0;L;<compat> 004E 004A;;;;N;LATIN CAPITAL LETTER N J;;;01CC;01CB
+01CB;LATIN CAPITAL LETTER N WITH SMALL LETTER J;Lt;0;L;<compat> 004E 006A;;;;N;LATIN LETTER CAPITAL N SMALL J;;01CA;01CC;01CB
+01CC;LATIN SMALL LETTER NJ;Ll;0;L;<compat> 006E 006A;;;;N;LATIN SMALL LETTER N J;;01CA;;01CB
+01CD;LATIN CAPITAL LETTER A WITH CARON;Lu;0;L;0041 030C;;;;N;LATIN CAPITAL LETTER A HACEK;;;01CE;
+01CE;LATIN SMALL LETTER A WITH CARON;Ll;0;L;0061 030C;;;;N;LATIN SMALL LETTER A HACEK;;01CD;;01CD
+01CF;LATIN CAPITAL LETTER I WITH CARON;Lu;0;L;0049 030C;;;;N;LATIN CAPITAL LETTER I HACEK;;;01D0;
+01D0;LATIN SMALL LETTER I WITH CARON;Ll;0;L;0069 030C;;;;N;LATIN SMALL LETTER I HACEK;;01CF;;01CF
+01D1;LATIN CAPITAL LETTER O WITH CARON;Lu;0;L;004F 030C;;;;N;LATIN CAPITAL LETTER O HACEK;;;01D2;
+01D2;LATIN SMALL LETTER O WITH CARON;Ll;0;L;006F 030C;;;;N;LATIN SMALL LETTER O HACEK;;01D1;;01D1
+01D3;LATIN CAPITAL LETTER U WITH CARON;Lu;0;L;0055 030C;;;;N;LATIN CAPITAL LETTER U HACEK;;;01D4;
+01D4;LATIN SMALL LETTER U WITH CARON;Ll;0;L;0075 030C;;;;N;LATIN SMALL LETTER U HACEK;;01D3;;01D3
+01D5;LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON;Lu;0;L;00DC 0304;;;;N;LATIN CAPITAL LETTER U DIAERESIS MACRON;;;01D6;
+01D6;LATIN SMALL LETTER U WITH DIAERESIS AND MACRON;Ll;0;L;00FC 0304;;;;N;LATIN SMALL LETTER U DIAERESIS MACRON;;01D5;;01D5
+01D7;LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE;Lu;0;L;00DC 0301;;;;N;LATIN CAPITAL LETTER U DIAERESIS ACUTE;;;01D8;
+01D8;LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE;Ll;0;L;00FC 0301;;;;N;LATIN SMALL LETTER U DIAERESIS ACUTE;;01D7;;01D7
+01D9;LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON;Lu;0;L;00DC 030C;;;;N;LATIN CAPITAL LETTER U DIAERESIS HACEK;;;01DA;
+01DA;LATIN SMALL LETTER U WITH DIAERESIS AND CARON;Ll;0;L;00FC 030C;;;;N;LATIN SMALL LETTER U DIAERESIS HACEK;;01D9;;01D9
+01DB;LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE;Lu;0;L;00DC 0300;;;;N;LATIN CAPITAL LETTER U DIAERESIS GRAVE;;;01DC;
+01DC;LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE;Ll;0;L;00FC 0300;;;;N;LATIN SMALL LETTER U DIAERESIS GRAVE;;01DB;;01DB
+01DD;LATIN SMALL LETTER TURNED E;Ll;0;L;;;;;N;;;018E;;018E
+01DE;LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON;Lu;0;L;00C4 0304;;;;N;LATIN CAPITAL LETTER A DIAERESIS MACRON;;;01DF;
+01DF;LATIN SMALL LETTER A WITH DIAERESIS AND MACRON;Ll;0;L;00E4 0304;;;;N;LATIN SMALL LETTER A DIAERESIS MACRON;;01DE;;01DE
+01E0;LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON;Lu;0;L;0226 0304;;;;N;LATIN CAPITAL LETTER A DOT MACRON;;;01E1;
+01E1;LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON;Ll;0;L;0227 0304;;;;N;LATIN SMALL LETTER A DOT MACRON;;01E0;;01E0
+01E2;LATIN CAPITAL LETTER AE WITH MACRON;Lu;0;L;00C6 0304;;;;N;LATIN CAPITAL LETTER A E MACRON;ash *;;01E3;
+01E3;LATIN SMALL LETTER AE WITH MACRON;Ll;0;L;00E6 0304;;;;N;LATIN SMALL LETTER A E MACRON;ash *;01E2;;01E2
+01E4;LATIN CAPITAL LETTER G WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER G BAR;;;01E5;
+01E5;LATIN SMALL LETTER G WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER G BAR;;01E4;;01E4
+01E6;LATIN CAPITAL LETTER G WITH CARON;Lu;0;L;0047 030C;;;;N;LATIN CAPITAL LETTER G HACEK;;;01E7;
+01E7;LATIN SMALL LETTER G WITH CARON;Ll;0;L;0067 030C;;;;N;LATIN SMALL LETTER G HACEK;;01E6;;01E6
+01E8;LATIN CAPITAL LETTER K WITH CARON;Lu;0;L;004B 030C;;;;N;LATIN CAPITAL LETTER K HACEK;;;01E9;
+01E9;LATIN SMALL LETTER K WITH CARON;Ll;0;L;006B 030C;;;;N;LATIN SMALL LETTER K HACEK;;01E8;;01E8
+01EA;LATIN CAPITAL LETTER O WITH OGONEK;Lu;0;L;004F 0328;;;;N;LATIN CAPITAL LETTER O OGONEK;;;01EB;
+01EB;LATIN SMALL LETTER O WITH OGONEK;Ll;0;L;006F 0328;;;;N;LATIN SMALL LETTER O OGONEK;;01EA;;01EA
+01EC;LATIN CAPITAL LETTER O WITH OGONEK AND MACRON;Lu;0;L;01EA 0304;;;;N;LATIN CAPITAL LETTER O OGONEK MACRON;;;01ED;
+01ED;LATIN SMALL LETTER O WITH OGONEK AND MACRON;Ll;0;L;01EB 0304;;;;N;LATIN SMALL LETTER O OGONEK MACRON;;01EC;;01EC
+01EE;LATIN CAPITAL LETTER EZH WITH CARON;Lu;0;L;01B7 030C;;;;N;LATIN CAPITAL LETTER YOGH HACEK;;;01EF;
+01EF;LATIN SMALL LETTER EZH WITH CARON;Ll;0;L;0292 030C;;;;N;LATIN SMALL LETTER YOGH HACEK;;01EE;;01EE
+01F0;LATIN SMALL LETTER J WITH CARON;Ll;0;L;006A 030C;;;;N;LATIN SMALL LETTER J HACEK;;;;
+01F1;LATIN CAPITAL LETTER DZ;Lu;0;L;<compat> 0044 005A;;;;N;;;;01F3;01F2
+01F2;LATIN CAPITAL LETTER D WITH SMALL LETTER Z;Lt;0;L;<compat> 0044 007A;;;;N;;;01F1;01F3;01F2
+01F3;LATIN SMALL LETTER DZ;Ll;0;L;<compat> 0064 007A;;;;N;;;01F1;;01F2
+01F4;LATIN CAPITAL LETTER G WITH ACUTE;Lu;0;L;0047 0301;;;;N;;;;01F5;
+01F5;LATIN SMALL LETTER G WITH ACUTE;Ll;0;L;0067 0301;;;;N;;;01F4;;01F4
+01F6;LATIN CAPITAL LETTER HWAIR;Lu;0;L;;;;;N;;;;0195;
+01F7;LATIN CAPITAL LETTER WYNN;Lu;0;L;;;;;N;;;;01BF;
+01F8;LATIN CAPITAL LETTER N WITH GRAVE;Lu;0;L;004E 0300;;;;N;;;;01F9;
+01F9;LATIN SMALL LETTER N WITH GRAVE;Ll;0;L;006E 0300;;;;N;;;01F8;;01F8
+01FA;LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE;Lu;0;L;00C5 0301;;;;N;;;;01FB;
+01FB;LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE;Ll;0;L;00E5 0301;;;;N;;;01FA;;01FA
+01FC;LATIN CAPITAL LETTER AE WITH ACUTE;Lu;0;L;00C6 0301;;;;N;;ash *;;01FD;
+01FD;LATIN SMALL LETTER AE WITH ACUTE;Ll;0;L;00E6 0301;;;;N;;ash *;01FC;;01FC
+01FE;LATIN CAPITAL LETTER O WITH STROKE AND ACUTE;Lu;0;L;00D8 0301;;;;N;;;;01FF;
+01FF;LATIN SMALL LETTER O WITH STROKE AND ACUTE;Ll;0;L;00F8 0301;;;;N;;;01FE;;01FE
+0200;LATIN CAPITAL LETTER A WITH DOUBLE GRAVE;Lu;0;L;0041 030F;;;;N;;;;0201;
+0201;LATIN SMALL LETTER A WITH DOUBLE GRAVE;Ll;0;L;0061 030F;;;;N;;;0200;;0200
+0202;LATIN CAPITAL LETTER A WITH INVERTED BREVE;Lu;0;L;0041 0311;;;;N;;;;0203;
+0203;LATIN SMALL LETTER A WITH INVERTED BREVE;Ll;0;L;0061 0311;;;;N;;;0202;;0202
+0204;LATIN CAPITAL LETTER E WITH DOUBLE GRAVE;Lu;0;L;0045 030F;;;;N;;;;0205;
+0205;LATIN SMALL LETTER E WITH DOUBLE GRAVE;Ll;0;L;0065 030F;;;;N;;;0204;;0204
+0206;LATIN CAPITAL LETTER E WITH INVERTED BREVE;Lu;0;L;0045 0311;;;;N;;;;0207;
+0207;LATIN SMALL LETTER E WITH INVERTED BREVE;Ll;0;L;0065 0311;;;;N;;;0206;;0206
+0208;LATIN CAPITAL LETTER I WITH DOUBLE GRAVE;Lu;0;L;0049 030F;;;;N;;;;0209;
+0209;LATIN SMALL LETTER I WITH DOUBLE GRAVE;Ll;0;L;0069 030F;;;;N;;;0208;;0208
+020A;LATIN CAPITAL LETTER I WITH INVERTED BREVE;Lu;0;L;0049 0311;;;;N;;;;020B;
+020B;LATIN SMALL LETTER I WITH INVERTED BREVE;Ll;0;L;0069 0311;;;;N;;;020A;;020A
+020C;LATIN CAPITAL LETTER O WITH DOUBLE GRAVE;Lu;0;L;004F 030F;;;;N;;;;020D;
+020D;LATIN SMALL LETTER O WITH DOUBLE GRAVE;Ll;0;L;006F 030F;;;;N;;;020C;;020C
+020E;LATIN CAPITAL LETTER O WITH INVERTED BREVE;Lu;0;L;004F 0311;;;;N;;;;020F;
+020F;LATIN SMALL LETTER O WITH INVERTED BREVE;Ll;0;L;006F 0311;;;;N;;;020E;;020E
+0210;LATIN CAPITAL LETTER R WITH DOUBLE GRAVE;Lu;0;L;0052 030F;;;;N;;;;0211;
+0211;LATIN SMALL LETTER R WITH DOUBLE GRAVE;Ll;0;L;0072 030F;;;;N;;;0210;;0210
+0212;LATIN CAPITAL LETTER R WITH INVERTED BREVE;Lu;0;L;0052 0311;;;;N;;;;0213;
+0213;LATIN SMALL LETTER R WITH INVERTED BREVE;Ll;0;L;0072 0311;;;;N;;;0212;;0212
+0214;LATIN CAPITAL LETTER U WITH DOUBLE GRAVE;Lu;0;L;0055 030F;;;;N;;;;0215;
+0215;LATIN SMALL LETTER U WITH DOUBLE GRAVE;Ll;0;L;0075 030F;;;;N;;;0214;;0214
+0216;LATIN CAPITAL LETTER U WITH INVERTED BREVE;Lu;0;L;0055 0311;;;;N;;;;0217;
+0217;LATIN SMALL LETTER U WITH INVERTED BREVE;Ll;0;L;0075 0311;;;;N;;;0216;;0216
+0218;LATIN CAPITAL LETTER S WITH COMMA BELOW;Lu;0;L;0053 0326;;;;N;;*;;0219;
+0219;LATIN SMALL LETTER S WITH COMMA BELOW;Ll;0;L;0073 0326;;;;N;;*;0218;;0218
+021A;LATIN CAPITAL LETTER T WITH COMMA BELOW;Lu;0;L;0054 0326;;;;N;;*;;021B;
+021B;LATIN SMALL LETTER T WITH COMMA BELOW;Ll;0;L;0074 0326;;;;N;;*;021A;;021A
+021C;LATIN CAPITAL LETTER YOGH;Lu;0;L;;;;;N;;;;021D;
+021D;LATIN SMALL LETTER YOGH;Ll;0;L;;;;;N;;;021C;;021C
+021E;LATIN CAPITAL LETTER H WITH CARON;Lu;0;L;0048 030C;;;;N;;;;021F;
+021F;LATIN SMALL LETTER H WITH CARON;Ll;0;L;0068 030C;;;;N;;;021E;;021E
+0220;LATIN CAPITAL LETTER N WITH LONG RIGHT LEG;Lu;0;L;;;;;N;;;;019E;
+0221;LATIN SMALL LETTER D WITH CURL;Ll;0;L;;;;;N;;;;;
+0222;LATIN CAPITAL LETTER OU;Lu;0;L;;;;;N;;;;0223;
+0223;LATIN SMALL LETTER OU;Ll;0;L;;;;;N;;;0222;;0222
+0224;LATIN CAPITAL LETTER Z WITH HOOK;Lu;0;L;;;;;N;;;;0225;
+0225;LATIN SMALL LETTER Z WITH HOOK;Ll;0;L;;;;;N;;;0224;;0224
+0226;LATIN CAPITAL LETTER A WITH DOT ABOVE;Lu;0;L;0041 0307;;;;N;;;;0227;
+0227;LATIN SMALL LETTER A WITH DOT ABOVE;Ll;0;L;0061 0307;;;;N;;;0226;;0226
+0228;LATIN CAPITAL LETTER E WITH CEDILLA;Lu;0;L;0045 0327;;;;N;;;;0229;
+0229;LATIN SMALL LETTER E WITH CEDILLA;Ll;0;L;0065 0327;;;;N;;;0228;;0228
+022A;LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON;Lu;0;L;00D6 0304;;;;N;;;;022B;
+022B;LATIN SMALL LETTER O WITH DIAERESIS AND MACRON;Ll;0;L;00F6 0304;;;;N;;;022A;;022A
+022C;LATIN CAPITAL LETTER O WITH TILDE AND MACRON;Lu;0;L;00D5 0304;;;;N;;;;022D;
+022D;LATIN SMALL LETTER O WITH TILDE AND MACRON;Ll;0;L;00F5 0304;;;;N;;;022C;;022C
+022E;LATIN CAPITAL LETTER O WITH DOT ABOVE;Lu;0;L;004F 0307;;;;N;;;;022F;
+022F;LATIN SMALL LETTER O WITH DOT ABOVE;Ll;0;L;006F 0307;;;;N;;;022E;;022E
+0230;LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON;Lu;0;L;022E 0304;;;;N;;;;0231;
+0231;LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON;Ll;0;L;022F 0304;;;;N;;;0230;;0230
+0232;LATIN CAPITAL LETTER Y WITH MACRON;Lu;0;L;0059 0304;;;;N;;;;0233;
+0233;LATIN SMALL LETTER Y WITH MACRON;Ll;0;L;0079 0304;;;;N;;;0232;;0232
+0234;LATIN SMALL LETTER L WITH CURL;Ll;0;L;;;;;N;;;;;
+0235;LATIN SMALL LETTER N WITH CURL;Ll;0;L;;;;;N;;;;;
+0236;LATIN SMALL LETTER T WITH CURL;Ll;0;L;;;;;N;;;;;
+0237;LATIN SMALL LETTER DOTLESS J;Ll;0;L;;;;;N;;;;;
+0238;LATIN SMALL LETTER DB DIGRAPH;Ll;0;L;;;;;N;;;;;
+0239;LATIN SMALL LETTER QP DIGRAPH;Ll;0;L;;;;;N;;;;;
+023A;LATIN CAPITAL LETTER A WITH STROKE;Lu;0;L;;;;;N;;;;2C65;
+023B;LATIN CAPITAL LETTER C WITH STROKE;Lu;0;L;;;;;N;;;;023C;
+023C;LATIN SMALL LETTER C WITH STROKE;Ll;0;L;;;;;N;;;023B;;023B
+023D;LATIN CAPITAL LETTER L WITH BAR;Lu;0;L;;;;;N;;;;019A;
+023E;LATIN CAPITAL LETTER T WITH DIAGONAL STROKE;Lu;0;L;;;;;N;;;;2C66;
+023F;LATIN SMALL LETTER S WITH SWASH TAIL;Ll;0;L;;;;;N;;;;;
+0240;LATIN SMALL LETTER Z WITH SWASH TAIL;Ll;0;L;;;;;N;;;;;
+0241;LATIN CAPITAL LETTER GLOTTAL STOP;Lu;0;L;;;;;N;;;;0242;
+0242;LATIN SMALL LETTER GLOTTAL STOP;Ll;0;L;;;;;N;;;0241;;0241
+0243;LATIN CAPITAL LETTER B WITH STROKE;Lu;0;L;;;;;N;;;;0180;
+0244;LATIN CAPITAL LETTER U BAR;Lu;0;L;;;;;N;;;;0289;
+0245;LATIN CAPITAL LETTER TURNED V;Lu;0;L;;;;;N;;;;028C;
+0246;LATIN CAPITAL LETTER E WITH STROKE;Lu;0;L;;;;;N;;;;0247;
+0247;LATIN SMALL LETTER E WITH STROKE;Ll;0;L;;;;;N;;;0246;;0246
+0248;LATIN CAPITAL LETTER J WITH STROKE;Lu;0;L;;;;;N;;;;0249;
+0249;LATIN SMALL LETTER J WITH STROKE;Ll;0;L;;;;;N;;;0248;;0248
+024A;LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL;Lu;0;L;;;;;N;;;;024B;
+024B;LATIN SMALL LETTER Q WITH HOOK TAIL;Ll;0;L;;;;;N;;;024A;;024A
+024C;LATIN CAPITAL LETTER R WITH STROKE;Lu;0;L;;;;;N;;;;024D;
+024D;LATIN SMALL LETTER R WITH STROKE;Ll;0;L;;;;;N;;;024C;;024C
+024E;LATIN CAPITAL LETTER Y WITH STROKE;Lu;0;L;;;;;N;;;;024F;
+024F;LATIN SMALL LETTER Y WITH STROKE;Ll;0;L;;;;;N;;;024E;;024E
+0250;LATIN SMALL LETTER TURNED A;Ll;0;L;;;;;N;;;;;
+0251;LATIN SMALL LETTER ALPHA;Ll;0;L;;;;;N;LATIN SMALL LETTER SCRIPT A;;;;
+0252;LATIN SMALL LETTER TURNED ALPHA;Ll;0;L;;;;;N;LATIN SMALL LETTER TURNED SCRIPT A;;;;
+0253;LATIN SMALL LETTER B WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER B HOOK;;0181;;0181
+0254;LATIN SMALL LETTER OPEN O;Ll;0;L;;;;;N;;;0186;;0186
+0255;LATIN SMALL LETTER C WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER C CURL;;;;
+0256;LATIN SMALL LETTER D WITH TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER D RETROFLEX HOOK;;0189;;0189
+0257;LATIN SMALL LETTER D WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER D HOOK;;018A;;018A
+0258;LATIN SMALL LETTER REVERSED E;Ll;0;L;;;;;N;;;;;
+0259;LATIN SMALL LETTER SCHWA;Ll;0;L;;;;;N;;;018F;;018F
+025A;LATIN SMALL LETTER SCHWA WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER SCHWA HOOK;;;;
+025B;LATIN SMALL LETTER OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER EPSILON;;0190;;0190
+025C;LATIN SMALL LETTER REVERSED OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED EPSILON;;;;
+025D;LATIN SMALL LETTER REVERSED OPEN E WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED EPSILON HOOK;;;;
+025E;LATIN SMALL LETTER CLOSED REVERSED OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER CLOSED REVERSED EPSILON;;;;
+025F;LATIN SMALL LETTER DOTLESS J WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER DOTLESS J BAR;;;;
+0260;LATIN SMALL LETTER G WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER G HOOK;;0193;;0193
+0261;LATIN SMALL LETTER SCRIPT G;Ll;0;L;;;;;N;;;;;
+0262;LATIN LETTER SMALL CAPITAL G;Ll;0;L;;;;;N;;;;;
+0263;LATIN SMALL LETTER GAMMA;Ll;0;L;;;;;N;;;0194;;0194
+0264;LATIN SMALL LETTER RAMS HORN;Ll;0;L;;;;;N;LATIN SMALL LETTER BABY GAMMA;;;;
+0265;LATIN SMALL LETTER TURNED H;Ll;0;L;;;;;N;;;;;
+0266;LATIN SMALL LETTER H WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER H HOOK;;;;
+0267;LATIN SMALL LETTER HENG WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER HENG HOOK;;;;
+0268;LATIN SMALL LETTER I WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED I;;0197;;0197
+0269;LATIN SMALL LETTER IOTA;Ll;0;L;;;;;N;;;0196;;0196
+026A;LATIN LETTER SMALL CAPITAL I;Ll;0;L;;;;;N;;;;;
+026B;LATIN SMALL LETTER L WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;2C62;;2C62
+026C;LATIN SMALL LETTER L WITH BELT;Ll;0;L;;;;;N;LATIN SMALL LETTER L BELT;;;;
+026D;LATIN SMALL LETTER L WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER L RETROFLEX HOOK;;;;
+026E;LATIN SMALL LETTER LEZH;Ll;0;L;;;;;N;LATIN SMALL LETTER L YOGH;;;;
+026F;LATIN SMALL LETTER TURNED M;Ll;0;L;;;;;N;;;019C;;019C
+0270;LATIN SMALL LETTER TURNED M WITH LONG LEG;Ll;0;L;;;;;N;;;;;
+0271;LATIN SMALL LETTER M WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER M HOOK;;;;
+0272;LATIN SMALL LETTER N WITH LEFT HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER N HOOK;;019D;;019D
+0273;LATIN SMALL LETTER N WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER N RETROFLEX HOOK;;;;
+0274;LATIN LETTER SMALL CAPITAL N;Ll;0;L;;;;;N;;;;;
+0275;LATIN SMALL LETTER BARRED O;Ll;0;L;;;;;N;;;019F;;019F
+0276;LATIN LETTER SMALL CAPITAL OE;Ll;0;L;;;;;N;LATIN LETTER SMALL CAPITAL O E;;;;
+0277;LATIN SMALL LETTER CLOSED OMEGA;Ll;0;L;;;;;N;;;;;
+0278;LATIN SMALL LETTER PHI;Ll;0;L;;;;;N;;;;;
+0279;LATIN SMALL LETTER TURNED R;Ll;0;L;;;;;N;;;;;
+027A;LATIN SMALL LETTER TURNED R WITH LONG LEG;Ll;0;L;;;;;N;;;;;
+027B;LATIN SMALL LETTER TURNED R WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER TURNED R HOOK;;;;
+027C;LATIN SMALL LETTER R WITH LONG LEG;Ll;0;L;;;;;N;;;;;
+027D;LATIN SMALL LETTER R WITH TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER R HOOK;;2C64;;2C64
+027E;LATIN SMALL LETTER R WITH FISHHOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER FISHHOOK R;;;;
+027F;LATIN SMALL LETTER REVERSED R WITH FISHHOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER REVERSED FISHHOOK R;;;;
+0280;LATIN LETTER SMALL CAPITAL R;Ll;0;L;;;;;N;;*;01A6;;01A6
+0281;LATIN LETTER SMALL CAPITAL INVERTED R;Ll;0;L;;;;;N;;;;;
+0282;LATIN SMALL LETTER S WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER S HOOK;;;;
+0283;LATIN SMALL LETTER ESH;Ll;0;L;;;;;N;;;01A9;;01A9
+0284;LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER DOTLESS J BAR HOOK;;;;
+0285;LATIN SMALL LETTER SQUAT REVERSED ESH;Ll;0;L;;;;;N;;;;;
+0286;LATIN SMALL LETTER ESH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER ESH CURL;;;;
+0287;LATIN SMALL LETTER TURNED T;Ll;0;L;;;;;N;;;;;
+0288;LATIN SMALL LETTER T WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER T RETROFLEX HOOK;;01AE;;01AE
+0289;LATIN SMALL LETTER U BAR;Ll;0;L;;;;;N;;;0244;;0244
+028A;LATIN SMALL LETTER UPSILON;Ll;0;L;;;;;N;;;01B1;;01B1
+028B;LATIN SMALL LETTER V WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER SCRIPT V;;01B2;;01B2
+028C;LATIN SMALL LETTER TURNED V;Ll;0;L;;;;;N;;;0245;;0245
+028D;LATIN SMALL LETTER TURNED W;Ll;0;L;;;;;N;;;;;
+028E;LATIN SMALL LETTER TURNED Y;Ll;0;L;;;;;N;;;;;
+028F;LATIN LETTER SMALL CAPITAL Y;Ll;0;L;;;;;N;;;;;
+0290;LATIN SMALL LETTER Z WITH RETROFLEX HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER Z RETROFLEX HOOK;;;;
+0291;LATIN SMALL LETTER Z WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER Z CURL;;;;
+0292;LATIN SMALL LETTER EZH;Ll;0;L;;;;;N;LATIN SMALL LETTER YOGH;;01B7;;01B7
+0293;LATIN SMALL LETTER EZH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER YOGH CURL;;;;
+0294;LATIN LETTER GLOTTAL STOP;Lo;0;L;;;;;N;;;;;
+0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Ll;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;;
+0296;LATIN LETTER INVERTED GLOTTAL STOP;Ll;0;L;;;;;N;;;;;
+0297;LATIN LETTER STRETCHED C;Ll;0;L;;;;;N;;;;;
+0298;LATIN LETTER BILABIAL CLICK;Ll;0;L;;;;;N;LATIN LETTER BULLSEYE;;;;
+0299;LATIN LETTER SMALL CAPITAL B;Ll;0;L;;;;;N;;;;;
+029A;LATIN SMALL LETTER CLOSED OPEN E;Ll;0;L;;;;;N;LATIN SMALL LETTER CLOSED EPSILON;;;;
+029B;LATIN LETTER SMALL CAPITAL G WITH HOOK;Ll;0;L;;;;;N;LATIN LETTER SMALL CAPITAL G HOOK;;;;
+029C;LATIN LETTER SMALL CAPITAL H;Ll;0;L;;;;;N;;;;;
+029D;LATIN SMALL LETTER J WITH CROSSED-TAIL;Ll;0;L;;;;;N;LATIN SMALL LETTER CROSSED-TAIL J;;;;
+029E;LATIN SMALL LETTER TURNED K;Ll;0;L;;;;;N;;;;;
+029F;LATIN LETTER SMALL CAPITAL L;Ll;0;L;;;;;N;;;;;
+02A0;LATIN SMALL LETTER Q WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER Q HOOK;;;;
+02A1;LATIN LETTER GLOTTAL STOP WITH STROKE;Ll;0;L;;;;;N;LATIN LETTER GLOTTAL STOP BAR;;;;
+02A2;LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE;Ll;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP BAR;;;;
+02A3;LATIN SMALL LETTER DZ DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER D Z;;;;
+02A4;LATIN SMALL LETTER DEZH DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER D YOGH;;;;
+02A5;LATIN SMALL LETTER DZ DIGRAPH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER D Z CURL;;;;
+02A6;LATIN SMALL LETTER TS DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER T S;;;;
+02A7;LATIN SMALL LETTER TESH DIGRAPH;Ll;0;L;;;;;N;LATIN SMALL LETTER T ESH;;;;
+02A8;LATIN SMALL LETTER TC DIGRAPH WITH CURL;Ll;0;L;;;;;N;LATIN SMALL LETTER T C CURL;;;;
+02A9;LATIN SMALL LETTER FENG DIGRAPH;Ll;0;L;;;;;N;;;;;
+02AA;LATIN SMALL LETTER LS DIGRAPH;Ll;0;L;;;;;N;;;;;
+02AB;LATIN SMALL LETTER LZ DIGRAPH;Ll;0;L;;;;;N;;;;;
+02AC;LATIN LETTER BILABIAL PERCUSSIVE;Ll;0;L;;;;;N;;;;;
+02AD;LATIN LETTER BIDENTAL PERCUSSIVE;Ll;0;L;;;;;N;;;;;
+02AE;LATIN SMALL LETTER TURNED H WITH FISHHOOK;Ll;0;L;;;;;N;;;;;
+02AF;LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL;Ll;0;L;;;;;N;;;;;
+02B0;MODIFIER LETTER SMALL H;Lm;0;L;<super> 0068;;;;N;;;;;
+02B1;MODIFIER LETTER SMALL H WITH HOOK;Lm;0;L;<super> 0266;;;;N;MODIFIER LETTER SMALL H HOOK;;;;
+02B2;MODIFIER LETTER SMALL J;Lm;0;L;<super> 006A;;;;N;;;;;
+02B3;MODIFIER LETTER SMALL R;Lm;0;L;<super> 0072;;;;N;;;;;
+02B4;MODIFIER LETTER SMALL TURNED R;Lm;0;L;<super> 0279;;;;N;;;;;
+02B5;MODIFIER LETTER SMALL TURNED R WITH HOOK;Lm;0;L;<super> 027B;;;;N;MODIFIER LETTER SMALL TURNED R HOOK;;;;
+02B6;MODIFIER LETTER SMALL CAPITAL INVERTED R;Lm;0;L;<super> 0281;;;;N;;;;;
+02B7;MODIFIER LETTER SMALL W;Lm;0;L;<super> 0077;;;;N;;;;;
+02B8;MODIFIER LETTER SMALL Y;Lm;0;L;<super> 0079;;;;N;;;;;
+02B9;MODIFIER LETTER PRIME;Lm;0;ON;;;;;N;;;;;
+02BA;MODIFIER LETTER DOUBLE PRIME;Lm;0;ON;;;;;N;;;;;
+02BB;MODIFIER LETTER TURNED COMMA;Lm;0;L;;;;;N;;;;;
+02BC;MODIFIER LETTER APOSTROPHE;Lm;0;L;;;;;N;;;;;
+02BD;MODIFIER LETTER REVERSED COMMA;Lm;0;L;;;;;N;;;;;
+02BE;MODIFIER LETTER RIGHT HALF RING;Lm;0;L;;;;;N;;;;;
+02BF;MODIFIER LETTER LEFT HALF RING;Lm;0;L;;;;;N;;;;;
+02C0;MODIFIER LETTER GLOTTAL STOP;Lm;0;L;;;;;N;;;;;
+02C1;MODIFIER LETTER REVERSED GLOTTAL STOP;Lm;0;L;;;;;N;;;;;
+02C2;MODIFIER LETTER LEFT ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02C3;MODIFIER LETTER RIGHT ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02C4;MODIFIER LETTER UP ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02C5;MODIFIER LETTER DOWN ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02C6;MODIFIER LETTER CIRCUMFLEX ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER CIRCUMFLEX;;;;
+02C7;CARON;Lm;0;ON;;;;;N;MODIFIER LETTER HACEK;Mandarin Chinese third tone;;;
+02C8;MODIFIER LETTER VERTICAL LINE;Lm;0;ON;;;;;N;;;;;
+02C9;MODIFIER LETTER MACRON;Lm;0;ON;;;;;N;;Mandarin Chinese first tone;;;
+02CA;MODIFIER LETTER ACUTE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER ACUTE;Mandarin Chinese second tone;;;
+02CB;MODIFIER LETTER GRAVE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER GRAVE;Mandarin Chinese fourth tone;;;
+02CC;MODIFIER LETTER LOW VERTICAL LINE;Lm;0;ON;;;;;N;;;;;
+02CD;MODIFIER LETTER LOW MACRON;Lm;0;ON;;;;;N;;;;;
+02CE;MODIFIER LETTER LOW GRAVE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER LOW GRAVE;;;;
+02CF;MODIFIER LETTER LOW ACUTE ACCENT;Lm;0;ON;;;;;N;MODIFIER LETTER LOW ACUTE;;;;
+02D0;MODIFIER LETTER TRIANGULAR COLON;Lm;0;L;;;;;N;;;;;
+02D1;MODIFIER LETTER HALF TRIANGULAR COLON;Lm;0;L;;;;;N;;;;;
+02D2;MODIFIER LETTER CENTRED RIGHT HALF RING;Sk;0;ON;;;;;N;MODIFIER LETTER CENTERED RIGHT HALF RING;;;;
+02D3;MODIFIER LETTER CENTRED LEFT HALF RING;Sk;0;ON;;;;;N;MODIFIER LETTER CENTERED LEFT HALF RING;;;;
+02D4;MODIFIER LETTER UP TACK;Sk;0;ON;;;;;N;;;;;
+02D5;MODIFIER LETTER DOWN TACK;Sk;0;ON;;;;;N;;;;;
+02D6;MODIFIER LETTER PLUS SIGN;Sk;0;ON;;;;;N;;;;;
+02D7;MODIFIER LETTER MINUS SIGN;Sk;0;ON;;;;;N;;;;;
+02D8;BREVE;Sk;0;ON;<compat> 0020 0306;;;;N;SPACING BREVE;;;;
+02D9;DOT ABOVE;Sk;0;ON;<compat> 0020 0307;;;;N;SPACING DOT ABOVE;Mandarin Chinese light tone;;;
+02DA;RING ABOVE;Sk;0;ON;<compat> 0020 030A;;;;N;SPACING RING ABOVE;;;;
+02DB;OGONEK;Sk;0;ON;<compat> 0020 0328;;;;N;SPACING OGONEK;;;;
+02DC;SMALL TILDE;Sk;0;ON;<compat> 0020 0303;;;;N;SPACING TILDE;;;;
+02DD;DOUBLE ACUTE ACCENT;Sk;0;ON;<compat> 0020 030B;;;;N;SPACING DOUBLE ACUTE;;;;
+02DE;MODIFIER LETTER RHOTIC HOOK;Sk;0;ON;;;;;N;;;;;
+02DF;MODIFIER LETTER CROSS ACCENT;Sk;0;ON;;;;;N;;;;;
+02E0;MODIFIER LETTER SMALL GAMMA;Lm;0;L;<super> 0263;;;;N;;;;;
+02E1;MODIFIER LETTER SMALL L;Lm;0;L;<super> 006C;;;;N;;;;;
+02E2;MODIFIER LETTER SMALL S;Lm;0;L;<super> 0073;;;;N;;;;;
+02E3;MODIFIER LETTER SMALL X;Lm;0;L;<super> 0078;;;;N;;;;;
+02E4;MODIFIER LETTER SMALL REVERSED GLOTTAL STOP;Lm;0;L;<super> 0295;;;;N;;;;;
+02E5;MODIFIER LETTER EXTRA-HIGH TONE BAR;Sk;0;ON;;;;;N;;;;;
+02E6;MODIFIER LETTER HIGH TONE BAR;Sk;0;ON;;;;;N;;;;;
+02E7;MODIFIER LETTER MID TONE BAR;Sk;0;ON;;;;;N;;;;;
+02E8;MODIFIER LETTER LOW TONE BAR;Sk;0;ON;;;;;N;;;;;
+02E9;MODIFIER LETTER EXTRA-LOW TONE BAR;Sk;0;ON;;;;;N;;;;;
+02EA;MODIFIER LETTER YIN DEPARTING TONE MARK;Sk;0;ON;;;;;N;;;;;
+02EB;MODIFIER LETTER YANG DEPARTING TONE MARK;Sk;0;ON;;;;;N;;;;;
+02EC;MODIFIER LETTER VOICING;Sk;0;ON;;;;;N;;;;;
+02ED;MODIFIER LETTER UNASPIRATED;Sk;0;ON;;;;;N;;;;;
+02EE;MODIFIER LETTER DOUBLE APOSTROPHE;Lm;0;L;;;;;N;;;;;
+02EF;MODIFIER LETTER LOW DOWN ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02F0;MODIFIER LETTER LOW UP ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02F1;MODIFIER LETTER LOW LEFT ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02F2;MODIFIER LETTER LOW RIGHT ARROWHEAD;Sk;0;ON;;;;;N;;;;;
+02F3;MODIFIER LETTER LOW RING;Sk;0;ON;;;;;N;;;;;
+02F4;MODIFIER LETTER MIDDLE GRAVE ACCENT;Sk;0;ON;;;;;N;;;;;
+02F5;MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT;Sk;0;ON;;;;;N;;;;;
+02F6;MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT;Sk;0;ON;;;;;N;;;;;
+02F7;MODIFIER LETTER LOW TILDE;Sk;0;ON;;;;;N;;;;;
+02F8;MODIFIER LETTER RAISED COLON;Sk;0;ON;;;;;N;;;;;
+02F9;MODIFIER LETTER BEGIN HIGH TONE;Sk;0;ON;;;;;N;;;;;
+02FA;MODIFIER LETTER END HIGH TONE;Sk;0;ON;;;;;N;;;;;
+02FB;MODIFIER LETTER BEGIN LOW TONE;Sk;0;ON;;;;;N;;;;;
+02FC;MODIFIER LETTER END LOW TONE;Sk;0;ON;;;;;N;;;;;
+02FD;MODIFIER LETTER SHELF;Sk;0;ON;;;;;N;;;;;
+02FE;MODIFIER LETTER OPEN SHELF;Sk;0;ON;;;;;N;;;;;
+02FF;MODIFIER LETTER LOW LEFT ARROW;Sk;0;ON;;;;;N;;;;;
+0300;COMBINING GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING GRAVE;Varia;;;
+0301;COMBINING ACUTE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING ACUTE;Oxia, Tonos;;;
+0302;COMBINING CIRCUMFLEX ACCENT;Mn;230;NSM;;;;;N;NON-SPACING CIRCUMFLEX;;;;
+0303;COMBINING TILDE;Mn;230;NSM;;;;;N;NON-SPACING TILDE;;;;
+0304;COMBINING MACRON;Mn;230;NSM;;;;;N;NON-SPACING MACRON;;;;
+0305;COMBINING OVERLINE;Mn;230;NSM;;;;;N;NON-SPACING OVERSCORE;;;;
+0306;COMBINING BREVE;Mn;230;NSM;;;;;N;NON-SPACING BREVE;Vrachy;;;
+0307;COMBINING DOT ABOVE;Mn;230;NSM;;;;;N;NON-SPACING DOT ABOVE;;;;
+0308;COMBINING DIAERESIS;Mn;230;NSM;;;;;N;NON-SPACING DIAERESIS;Dialytika;;;
+0309;COMBINING HOOK ABOVE;Mn;230;NSM;;;;;N;NON-SPACING HOOK ABOVE;;;;
+030A;COMBINING RING ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RING ABOVE;;;;
+030B;COMBINING DOUBLE ACUTE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE ACUTE;;;;
+030C;COMBINING CARON;Mn;230;NSM;;;;;N;NON-SPACING HACEK;;;;
+030D;COMBINING VERTICAL LINE ABOVE;Mn;230;NSM;;;;;N;NON-SPACING VERTICAL LINE ABOVE;;;;
+030E;COMBINING DOUBLE VERTICAL LINE ABOVE;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE VERTICAL LINE ABOVE;;;;
+030F;COMBINING DOUBLE GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE GRAVE;;;;
+0310;COMBINING CANDRABINDU;Mn;230;NSM;;;;;N;NON-SPACING CANDRABINDU;;;;
+0311;COMBINING INVERTED BREVE;Mn;230;NSM;;;;;N;NON-SPACING INVERTED BREVE;;;;
+0312;COMBINING TURNED COMMA ABOVE;Mn;230;NSM;;;;;N;NON-SPACING TURNED COMMA ABOVE;;;;
+0313;COMBINING COMMA ABOVE;Mn;230;NSM;;;;;N;NON-SPACING COMMA ABOVE;Psili;;;
+0314;COMBINING REVERSED COMMA ABOVE;Mn;230;NSM;;;;;N;NON-SPACING REVERSED COMMA ABOVE;Dasia;;;
+0315;COMBINING COMMA ABOVE RIGHT;Mn;232;NSM;;;;;N;NON-SPACING COMMA ABOVE RIGHT;;;;
+0316;COMBINING GRAVE ACCENT BELOW;Mn;220;NSM;;;;;N;NON-SPACING GRAVE BELOW;;;;
+0317;COMBINING ACUTE ACCENT BELOW;Mn;220;NSM;;;;;N;NON-SPACING ACUTE BELOW;;;;
+0318;COMBINING LEFT TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING LEFT TACK BELOW;;;;
+0319;COMBINING RIGHT TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING RIGHT TACK BELOW;;;;
+031A;COMBINING LEFT ANGLE ABOVE;Mn;232;NSM;;;;;N;NON-SPACING LEFT ANGLE ABOVE;;;;
+031B;COMBINING HORN;Mn;216;NSM;;;;;N;NON-SPACING HORN;;;;
+031C;COMBINING LEFT HALF RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING LEFT HALF RING BELOW;;;;
+031D;COMBINING UP TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING UP TACK BELOW;;;;
+031E;COMBINING DOWN TACK BELOW;Mn;220;NSM;;;;;N;NON-SPACING DOWN TACK BELOW;;;;
+031F;COMBINING PLUS SIGN BELOW;Mn;220;NSM;;;;;N;NON-SPACING PLUS SIGN BELOW;;;;
+0320;COMBINING MINUS SIGN BELOW;Mn;220;NSM;;;;;N;NON-SPACING MINUS SIGN BELOW;;;;
+0321;COMBINING PALATALIZED HOOK BELOW;Mn;202;NSM;;;;;N;NON-SPACING PALATALIZED HOOK BELOW;;;;
+0322;COMBINING RETROFLEX HOOK BELOW;Mn;202;NSM;;;;;N;NON-SPACING RETROFLEX HOOK BELOW;;;;
+0323;COMBINING DOT BELOW;Mn;220;NSM;;;;;N;NON-SPACING DOT BELOW;;;;
+0324;COMBINING DIAERESIS BELOW;Mn;220;NSM;;;;;N;NON-SPACING DOUBLE DOT BELOW;;;;
+0325;COMBINING RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RING BELOW;;;;
+0326;COMBINING COMMA BELOW;Mn;220;NSM;;;;;N;NON-SPACING COMMA BELOW;;;;
+0327;COMBINING CEDILLA;Mn;202;NSM;;;;;N;NON-SPACING CEDILLA;;;;
+0328;COMBINING OGONEK;Mn;202;NSM;;;;;N;NON-SPACING OGONEK;;;;
+0329;COMBINING VERTICAL LINE BELOW;Mn;220;NSM;;;;;N;NON-SPACING VERTICAL LINE BELOW;;;;
+032A;COMBINING BRIDGE BELOW;Mn;220;NSM;;;;;N;NON-SPACING BRIDGE BELOW;;;;
+032B;COMBINING INVERTED DOUBLE ARCH BELOW;Mn;220;NSM;;;;;N;NON-SPACING INVERTED DOUBLE ARCH BELOW;;;;
+032C;COMBINING CARON BELOW;Mn;220;NSM;;;;;N;NON-SPACING HACEK BELOW;;;;
+032D;COMBINING CIRCUMFLEX ACCENT BELOW;Mn;220;NSM;;;;;N;NON-SPACING CIRCUMFLEX BELOW;;;;
+032E;COMBINING BREVE BELOW;Mn;220;NSM;;;;;N;NON-SPACING BREVE BELOW;;;;
+032F;COMBINING INVERTED BREVE BELOW;Mn;220;NSM;;;;;N;NON-SPACING INVERTED BREVE BELOW;;;;
+0330;COMBINING TILDE BELOW;Mn;220;NSM;;;;;N;NON-SPACING TILDE BELOW;;;;
+0331;COMBINING MACRON BELOW;Mn;220;NSM;;;;;N;NON-SPACING MACRON BELOW;;;;
+0332;COMBINING LOW LINE;Mn;220;NSM;;;;;N;NON-SPACING UNDERSCORE;;;;
+0333;COMBINING DOUBLE LOW LINE;Mn;220;NSM;;;;;N;NON-SPACING DOUBLE UNDERSCORE;;;;
+0334;COMBINING TILDE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING TILDE OVERLAY;;;;
+0335;COMBINING SHORT STROKE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING SHORT BAR OVERLAY;;;;
+0336;COMBINING LONG STROKE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG BAR OVERLAY;;;;
+0337;COMBINING SHORT SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING SHORT SLASH OVERLAY;;;;
+0338;COMBINING LONG SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG SLASH OVERLAY;;;;
+0339;COMBINING RIGHT HALF RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RIGHT HALF RING BELOW;;;;
+033A;COMBINING INVERTED BRIDGE BELOW;Mn;220;NSM;;;;;N;NON-SPACING INVERTED BRIDGE BELOW;;;;
+033B;COMBINING SQUARE BELOW;Mn;220;NSM;;;;;N;NON-SPACING SQUARE BELOW;;;;
+033C;COMBINING SEAGULL BELOW;Mn;220;NSM;;;;;N;NON-SPACING SEAGULL BELOW;;;;
+033D;COMBINING X ABOVE;Mn;230;NSM;;;;;N;NON-SPACING X ABOVE;;;;
+033E;COMBINING VERTICAL TILDE;Mn;230;NSM;;;;;N;NON-SPACING VERTICAL TILDE;;;;
+033F;COMBINING DOUBLE OVERLINE;Mn;230;NSM;;;;;N;NON-SPACING DOUBLE OVERSCORE;;;;
+0340;COMBINING GRAVE TONE MARK;Mn;230;NSM;0300;;;;N;NON-SPACING GRAVE TONE MARK;Vietnamese;;;
+0341;COMBINING ACUTE TONE MARK;Mn;230;NSM;0301;;;;N;NON-SPACING ACUTE TONE MARK;Vietnamese;;;
+0342;COMBINING GREEK PERISPOMENI;Mn;230;NSM;;;;;N;;;;;
+0343;COMBINING GREEK KORONIS;Mn;230;NSM;0313;;;;N;;;;;
+0344;COMBINING GREEK DIALYTIKA TONOS;Mn;230;NSM;0308 0301;;;;N;GREEK NON-SPACING DIAERESIS TONOS;;;;
+0345;COMBINING GREEK YPOGEGRAMMENI;Mn;240;NSM;;;;;N;GREEK NON-SPACING IOTA BELOW;;0399;;0399
+0346;COMBINING BRIDGE ABOVE;Mn;230;NSM;;;;;N;;;;;
+0347;COMBINING EQUALS SIGN BELOW;Mn;220;NSM;;;;;N;;;;;
+0348;COMBINING DOUBLE VERTICAL LINE BELOW;Mn;220;NSM;;;;;N;;;;;
+0349;COMBINING LEFT ANGLE BELOW;Mn;220;NSM;;;;;N;;;;;
+034A;COMBINING NOT TILDE ABOVE;Mn;230;NSM;;;;;N;;;;;
+034B;COMBINING HOMOTHETIC ABOVE;Mn;230;NSM;;;;;N;;;;;
+034C;COMBINING ALMOST EQUAL TO ABOVE;Mn;230;NSM;;;;;N;;;;;
+034D;COMBINING LEFT RIGHT ARROW BELOW;Mn;220;NSM;;;;;N;;;;;
+034E;COMBINING UPWARDS ARROW BELOW;Mn;220;NSM;;;;;N;;;;;
+034F;COMBINING GRAPHEME JOINER;Mn;0;NSM;;;;;N;;;;;
+0350;COMBINING RIGHT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;;
+0351;COMBINING LEFT HALF RING ABOVE;Mn;230;NSM;;;;;N;;;;;
+0352;COMBINING FERMATA;Mn;230;NSM;;;;;N;;;;;
+0353;COMBINING X BELOW;Mn;220;NSM;;;;;N;;;;;
+0354;COMBINING LEFT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;;
+0355;COMBINING RIGHT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;;
+0356;COMBINING RIGHT ARROWHEAD AND UP ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;;
+0357;COMBINING RIGHT HALF RING ABOVE;Mn;230;NSM;;;;;N;;;;;
+0358;COMBINING DOT ABOVE RIGHT;Mn;232;NSM;;;;;N;;;;;
+0359;COMBINING ASTERISK BELOW;Mn;220;NSM;;;;;N;;;;;
+035A;COMBINING DOUBLE RING BELOW;Mn;220;NSM;;;;;N;;;;;
+035B;COMBINING ZIGZAG ABOVE;Mn;230;NSM;;;;;N;;;;;
+035C;COMBINING DOUBLE BREVE BELOW;Mn;233;NSM;;;;;N;;;;;
+035D;COMBINING DOUBLE BREVE;Mn;234;NSM;;;;;N;;;;;
+035E;COMBINING DOUBLE MACRON;Mn;234;NSM;;;;;N;;;;;
+035F;COMBINING DOUBLE MACRON BELOW;Mn;233;NSM;;;;;N;;;;;
+0360;COMBINING DOUBLE TILDE;Mn;234;NSM;;;;;N;;;;;
+0361;COMBINING DOUBLE INVERTED BREVE;Mn;234;NSM;;;;;N;;;;;
+0362;COMBINING DOUBLE RIGHTWARDS ARROW BELOW;Mn;233;NSM;;;;;N;;;;;
+0363;COMBINING LATIN SMALL LETTER A;Mn;230;NSM;;;;;N;;;;;
+0364;COMBINING LATIN SMALL LETTER E;Mn;230;NSM;;;;;N;;;;;
+0365;COMBINING LATIN SMALL LETTER I;Mn;230;NSM;;;;;N;;;;;
+0366;COMBINING LATIN SMALL LETTER O;Mn;230;NSM;;;;;N;;;;;
+0367;COMBINING LATIN SMALL LETTER U;Mn;230;NSM;;;;;N;;;;;
+0368;COMBINING LATIN SMALL LETTER C;Mn;230;NSM;;;;;N;;;;;
+0369;COMBINING LATIN SMALL LETTER D;Mn;230;NSM;;;;;N;;;;;
+036A;COMBINING LATIN SMALL LETTER H;Mn;230;NSM;;;;;N;;;;;
+036B;COMBINING LATIN SMALL LETTER M;Mn;230;NSM;;;;;N;;;;;
+036C;COMBINING LATIN SMALL LETTER R;Mn;230;NSM;;;;;N;;;;;
+036D;COMBINING LATIN SMALL LETTER T;Mn;230;NSM;;;;;N;;;;;
+036E;COMBINING LATIN SMALL LETTER V;Mn;230;NSM;;;;;N;;;;;
+036F;COMBINING LATIN SMALL LETTER X;Mn;230;NSM;;;;;N;;;;;
+0374;GREEK NUMERAL SIGN;Sk;0;ON;02B9;;;;N;GREEK UPPER NUMERAL SIGN;Dexia keraia;;;
+0375;GREEK LOWER NUMERAL SIGN;Sk;0;ON;;;;;N;;Aristeri keraia;;;
+037A;GREEK YPOGEGRAMMENI;Lm;0;L;<compat> 0020 0345;;;;N;GREEK SPACING IOTA BELOW;;;;
+037B;GREEK SMALL REVERSED LUNATE SIGMA SYMBOL;Ll;0;L;;;;;N;;;03FD;;03FD
+037C;GREEK SMALL DOTTED LUNATE SIGMA SYMBOL;Ll;0;L;;;;;N;;;03FE;;03FE
+037D;GREEK SMALL REVERSED DOTTED LUNATE SIGMA SYMBOL;Ll;0;L;;;;;N;;;03FF;;03FF
+037E;GREEK QUESTION MARK;Po;0;ON;003B;;;;N;;Erotimatiko;;;
+0384;GREEK TONOS;Sk;0;ON;<compat> 0020 0301;;;;N;GREEK SPACING TONOS;;;;
+0385;GREEK DIALYTIKA TONOS;Sk;0;ON;00A8 0301;;;;N;GREEK SPACING DIAERESIS TONOS;;;;
+0386;GREEK CAPITAL LETTER ALPHA WITH TONOS;Lu;0;L;0391 0301;;;;N;GREEK CAPITAL LETTER ALPHA TONOS;;;03AC;
+0387;GREEK ANO TELEIA;Po;0;ON;00B7;;;;N;;;;;
+0388;GREEK CAPITAL LETTER EPSILON WITH TONOS;Lu;0;L;0395 0301;;;;N;GREEK CAPITAL LETTER EPSILON TONOS;;;03AD;
+0389;GREEK CAPITAL LETTER ETA WITH TONOS;Lu;0;L;0397 0301;;;;N;GREEK CAPITAL LETTER ETA TONOS;;;03AE;
+038A;GREEK CAPITAL LETTER IOTA WITH TONOS;Lu;0;L;0399 0301;;;;N;GREEK CAPITAL LETTER IOTA TONOS;;;03AF;
+038C;GREEK CAPITAL LETTER OMICRON WITH TONOS;Lu;0;L;039F 0301;;;;N;GREEK CAPITAL LETTER OMICRON TONOS;;;03CC;
+038E;GREEK CAPITAL LETTER UPSILON WITH TONOS;Lu;0;L;03A5 0301;;;;N;GREEK CAPITAL LETTER UPSILON TONOS;;;03CD;
+038F;GREEK CAPITAL LETTER OMEGA WITH TONOS;Lu;0;L;03A9 0301;;;;N;GREEK CAPITAL LETTER OMEGA TONOS;;;03CE;
+0390;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS;Ll;0;L;03CA 0301;;;;N;GREEK SMALL LETTER IOTA DIAERESIS TONOS;;;;
+0391;GREEK CAPITAL LETTER ALPHA;Lu;0;L;;;;;N;;;;03B1;
+0392;GREEK CAPITAL LETTER BETA;Lu;0;L;;;;;N;;;;03B2;
+0393;GREEK CAPITAL LETTER GAMMA;Lu;0;L;;;;;N;;;;03B3;
+0394;GREEK CAPITAL LETTER DELTA;Lu;0;L;;;;;N;;;;03B4;
+0395;GREEK CAPITAL LETTER EPSILON;Lu;0;L;;;;;N;;;;03B5;
+0396;GREEK CAPITAL LETTER ZETA;Lu;0;L;;;;;N;;;;03B6;
+0397;GREEK CAPITAL LETTER ETA;Lu;0;L;;;;;N;;;;03B7;
+0398;GREEK CAPITAL LETTER THETA;Lu;0;L;;;;;N;;;;03B8;
+0399;GREEK CAPITAL LETTER IOTA;Lu;0;L;;;;;N;;;;03B9;
+039A;GREEK CAPITAL LETTER KAPPA;Lu;0;L;;;;;N;;;;03BA;
+039B;GREEK CAPITAL LETTER LAMDA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER LAMBDA;;;03BB;
+039C;GREEK CAPITAL LETTER MU;Lu;0;L;;;;;N;;;;03BC;
+039D;GREEK CAPITAL LETTER NU;Lu;0;L;;;;;N;;;;03BD;
+039E;GREEK CAPITAL LETTER XI;Lu;0;L;;;;;N;;;;03BE;
+039F;GREEK CAPITAL LETTER OMICRON;Lu;0;L;;;;;N;;;;03BF;
+03A0;GREEK CAPITAL LETTER PI;Lu;0;L;;;;;N;;;;03C0;
+03A1;GREEK CAPITAL LETTER RHO;Lu;0;L;;;;;N;;;;03C1;
+03A3;GREEK CAPITAL LETTER SIGMA;Lu;0;L;;;;;N;;;;03C3;
+03A4;GREEK CAPITAL LETTER TAU;Lu;0;L;;;;;N;;;;03C4;
+03A5;GREEK CAPITAL LETTER UPSILON;Lu;0;L;;;;;N;;;;03C5;
+03A6;GREEK CAPITAL LETTER PHI;Lu;0;L;;;;;N;;;;03C6;
+03A7;GREEK CAPITAL LETTER CHI;Lu;0;L;;;;;N;;;;03C7;
+03A8;GREEK CAPITAL LETTER PSI;Lu;0;L;;;;;N;;;;03C8;
+03A9;GREEK CAPITAL LETTER OMEGA;Lu;0;L;;;;;N;;;;03C9;
+03AA;GREEK CAPITAL LETTER IOTA WITH DIALYTIKA;Lu;0;L;0399 0308;;;;N;GREEK CAPITAL LETTER IOTA DIAERESIS;;;03CA;
+03AB;GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA;Lu;0;L;03A5 0308;;;;N;GREEK CAPITAL LETTER UPSILON DIAERESIS;;;03CB;
+03AC;GREEK SMALL LETTER ALPHA WITH TONOS;Ll;0;L;03B1 0301;;;;N;GREEK SMALL LETTER ALPHA TONOS;;0386;;0386
+03AD;GREEK SMALL LETTER EPSILON WITH TONOS;Ll;0;L;03B5 0301;;;;N;GREEK SMALL LETTER EPSILON TONOS;;0388;;0388
+03AE;GREEK SMALL LETTER ETA WITH TONOS;Ll;0;L;03B7 0301;;;;N;GREEK SMALL LETTER ETA TONOS;;0389;;0389
+03AF;GREEK SMALL LETTER IOTA WITH TONOS;Ll;0;L;03B9 0301;;;;N;GREEK SMALL LETTER IOTA TONOS;;038A;;038A
+03B0;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS;Ll;0;L;03CB 0301;;;;N;GREEK SMALL LETTER UPSILON DIAERESIS TONOS;;;;
+03B1;GREEK SMALL LETTER ALPHA;Ll;0;L;;;;;N;;;0391;;0391
+03B2;GREEK SMALL LETTER BETA;Ll;0;L;;;;;N;;;0392;;0392
+03B3;GREEK SMALL LETTER GAMMA;Ll;0;L;;;;;N;;;0393;;0393
+03B4;GREEK SMALL LETTER DELTA;Ll;0;L;;;;;N;;;0394;;0394
+03B5;GREEK SMALL LETTER EPSILON;Ll;0;L;;;;;N;;;0395;;0395
+03B6;GREEK SMALL LETTER ZETA;Ll;0;L;;;;;N;;;0396;;0396
+03B7;GREEK SMALL LETTER ETA;Ll;0;L;;;;;N;;;0397;;0397
+03B8;GREEK SMALL LETTER THETA;Ll;0;L;;;;;N;;;0398;;0398
+03B9;GREEK SMALL LETTER IOTA;Ll;0;L;;;;;N;;;0399;;0399
+03BA;GREEK SMALL LETTER KAPPA;Ll;0;L;;;;;N;;;039A;;039A
+03BB;GREEK SMALL LETTER LAMDA;Ll;0;L;;;;;N;GREEK SMALL LETTER LAMBDA;;039B;;039B
+03BC;GREEK SMALL LETTER MU;Ll;0;L;;;;;N;;;039C;;039C
+03BD;GREEK SMALL LETTER NU;Ll;0;L;;;;;N;;;039D;;039D
+03BE;GREEK SMALL LETTER XI;Ll;0;L;;;;;N;;;039E;;039E
+03BF;GREEK SMALL LETTER OMICRON;Ll;0;L;;;;;N;;;039F;;039F
+03C0;GREEK SMALL LETTER PI;Ll;0;L;;;;;N;;;03A0;;03A0
+03C1;GREEK SMALL LETTER RHO;Ll;0;L;;;;;N;;;03A1;;03A1
+03C2;GREEK SMALL LETTER FINAL SIGMA;Ll;0;L;;;;;N;;;03A3;;03A3
+03C3;GREEK SMALL LETTER SIGMA;Ll;0;L;;;;;N;;;03A3;;03A3
+03C4;GREEK SMALL LETTER TAU;Ll;0;L;;;;;N;;;03A4;;03A4
+03C5;GREEK SMALL LETTER UPSILON;Ll;0;L;;;;;N;;;03A5;;03A5
+03C6;GREEK SMALL LETTER PHI;Ll;0;L;;;;;N;;;03A6;;03A6
+03C7;GREEK SMALL LETTER CHI;Ll;0;L;;;;;N;;;03A7;;03A7
+03C8;GREEK SMALL LETTER PSI;Ll;0;L;;;;;N;;;03A8;;03A8
+03C9;GREEK SMALL LETTER OMEGA;Ll;0;L;;;;;N;;;03A9;;03A9
+03CA;GREEK SMALL LETTER IOTA WITH DIALYTIKA;Ll;0;L;03B9 0308;;;;N;GREEK SMALL LETTER IOTA DIAERESIS;;03AA;;03AA
+03CB;GREEK SMALL LETTER UPSILON WITH DIALYTIKA;Ll;0;L;03C5 0308;;;;N;GREEK SMALL LETTER UPSILON DIAERESIS;;03AB;;03AB
+03CC;GREEK SMALL LETTER OMICRON WITH TONOS;Ll;0;L;03BF 0301;;;;N;GREEK SMALL LETTER OMICRON TONOS;;038C;;038C
+03CD;GREEK SMALL LETTER UPSILON WITH TONOS;Ll;0;L;03C5 0301;;;;N;GREEK SMALL LETTER UPSILON TONOS;;038E;;038E
+03CE;GREEK SMALL LETTER OMEGA WITH TONOS;Ll;0;L;03C9 0301;;;;N;GREEK SMALL LETTER OMEGA TONOS;;038F;;038F
+03D0;GREEK BETA SYMBOL;Ll;0;L;<compat> 03B2;;;;N;GREEK SMALL LETTER CURLED BETA;;0392;;0392
+03D1;GREEK THETA SYMBOL;Ll;0;L;<compat> 03B8;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398
+03D2;GREEK UPSILON WITH HOOK SYMBOL;Lu;0;L;<compat> 03A5;;;;N;GREEK CAPITAL LETTER UPSILON HOOK;;;;
+03D3;GREEK UPSILON WITH ACUTE AND HOOK SYMBOL;Lu;0;L;03D2 0301;;;;N;GREEK CAPITAL LETTER UPSILON HOOK TONOS;;;;
+03D4;GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL;Lu;0;L;03D2 0308;;;;N;GREEK CAPITAL LETTER UPSILON HOOK DIAERESIS;;;;
+03D5;GREEK PHI SYMBOL;Ll;0;L;<compat> 03C6;;;;N;GREEK SMALL LETTER SCRIPT PHI;;03A6;;03A6
+03D6;GREEK PI SYMBOL;Ll;0;L;<compat> 03C0;;;;N;GREEK SMALL LETTER OMEGA PI;;03A0;;03A0
+03D7;GREEK KAI SYMBOL;Ll;0;L;;;;;N;;;;;
+03D8;GREEK LETTER ARCHAIC KOPPA;Lu;0;L;;;;;N;;*;;03D9;
+03D9;GREEK SMALL LETTER ARCHAIC KOPPA;Ll;0;L;;;;;N;;*;03D8;;03D8
+03DA;GREEK LETTER STIGMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER STIGMA;;;03DB;
+03DB;GREEK SMALL LETTER STIGMA;Ll;0;L;;;;;N;;;03DA;;03DA
+03DC;GREEK LETTER DIGAMMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER DIGAMMA;;;03DD;
+03DD;GREEK SMALL LETTER DIGAMMA;Ll;0;L;;;;;N;;;03DC;;03DC
+03DE;GREEK LETTER KOPPA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER KOPPA;;;03DF;
+03DF;GREEK SMALL LETTER KOPPA;Ll;0;L;;;;;N;;;03DE;;03DE
+03E0;GREEK LETTER SAMPI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER SAMPI;;;03E1;
+03E1;GREEK SMALL LETTER SAMPI;Ll;0;L;;;;;N;;;03E0;;03E0
+03E2;COPTIC CAPITAL LETTER SHEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER SHEI;;;03E3;
+03E3;COPTIC SMALL LETTER SHEI;Ll;0;L;;;;;N;GREEK SMALL LETTER SHEI;;03E2;;03E2
+03E4;COPTIC CAPITAL LETTER FEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER FEI;;;03E5;
+03E5;COPTIC SMALL LETTER FEI;Ll;0;L;;;;;N;GREEK SMALL LETTER FEI;;03E4;;03E4
+03E6;COPTIC CAPITAL LETTER KHEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER KHEI;;;03E7;
+03E7;COPTIC SMALL LETTER KHEI;Ll;0;L;;;;;N;GREEK SMALL LETTER KHEI;;03E6;;03E6
+03E8;COPTIC CAPITAL LETTER HORI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER HORI;;;03E9;
+03E9;COPTIC SMALL LETTER HORI;Ll;0;L;;;;;N;GREEK SMALL LETTER HORI;;03E8;;03E8
+03EA;COPTIC CAPITAL LETTER GANGIA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER GANGIA;;;03EB;
+03EB;COPTIC SMALL LETTER GANGIA;Ll;0;L;;;;;N;GREEK SMALL LETTER GANGIA;;03EA;;03EA
+03EC;COPTIC CAPITAL LETTER SHIMA;Lu;0;L;;;;;N;GREEK CAPITAL LETTER SHIMA;;;03ED;
+03ED;COPTIC SMALL LETTER SHIMA;Ll;0;L;;;;;N;GREEK SMALL LETTER SHIMA;;03EC;;03EC
+03EE;COPTIC CAPITAL LETTER DEI;Lu;0;L;;;;;N;GREEK CAPITAL LETTER DEI;;;03EF;
+03EF;COPTIC SMALL LETTER DEI;Ll;0;L;;;;;N;GREEK SMALL LETTER DEI;;03EE;;03EE
+03F0;GREEK KAPPA SYMBOL;Ll;0;L;<compat> 03BA;;;;N;GREEK SMALL LETTER SCRIPT KAPPA;;039A;;039A
+03F1;GREEK RHO SYMBOL;Ll;0;L;<compat> 03C1;;;;N;GREEK SMALL LETTER TAILED RHO;;03A1;;03A1
+03F2;GREEK LUNATE SIGMA SYMBOL;Ll;0;L;<compat> 03C2;;;;N;GREEK SMALL LETTER LUNATE SIGMA;;03F9;;03F9
+03F3;GREEK LETTER YOT;Ll;0;L;;;;;N;;;;;
+03F4;GREEK CAPITAL THETA SYMBOL;Lu;0;L;<compat> 0398;;;;N;;;;03B8;
+03F5;GREEK LUNATE EPSILON SYMBOL;Ll;0;L;<compat> 03B5;;;;N;;;0395;;0395
+03F6;GREEK REVERSED LUNATE EPSILON SYMBOL;Sm;0;ON;;;;;N;;;;;
+03F7;GREEK CAPITAL LETTER SHO;Lu;0;L;;;;;N;;;;03F8;
+03F8;GREEK SMALL LETTER SHO;Ll;0;L;;;;;N;;;03F7;;03F7
+03F9;GREEK CAPITAL LUNATE SIGMA SYMBOL;Lu;0;L;<compat> 03A3;;;;N;;;;03F2;
+03FA;GREEK CAPITAL LETTER SAN;Lu;0;L;;;;;N;;;;03FB;
+03FB;GREEK SMALL LETTER SAN;Ll;0;L;;;;;N;;;03FA;;03FA
+03FC;GREEK RHO WITH STROKE SYMBOL;Ll;0;L;;;;;N;;;;;
+03FD;GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL;Lu;0;L;;;;;N;;;;037B;
+03FE;GREEK CAPITAL DOTTED LUNATE SIGMA SYMBOL;Lu;0;L;;;;;N;;;;037C;
+03FF;GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL;Lu;0;L;;;;;N;;;;037D;
+0400;CYRILLIC CAPITAL LETTER IE WITH GRAVE;Lu;0;L;0415 0300;;;;N;;;;0450;
+0401;CYRILLIC CAPITAL LETTER IO;Lu;0;L;0415 0308;;;;N;;;;0451;
+0402;CYRILLIC CAPITAL LETTER DJE;Lu;0;L;;;;;N;;Serbocroatian;;0452;
+0403;CYRILLIC CAPITAL LETTER GJE;Lu;0;L;0413 0301;;;;N;;;;0453;
+0404;CYRILLIC CAPITAL LETTER UKRAINIAN IE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER E;;;0454;
+0405;CYRILLIC CAPITAL LETTER DZE;Lu;0;L;;;;;N;;;;0455;
+0406;CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER I;;;0456;
+0407;CYRILLIC CAPITAL LETTER YI;Lu;0;L;0406 0308;;;;N;;Ukrainian;;0457;
+0408;CYRILLIC CAPITAL LETTER JE;Lu;0;L;;;;;N;;;;0458;
+0409;CYRILLIC CAPITAL LETTER LJE;Lu;0;L;;;;;N;;;;0459;
+040A;CYRILLIC CAPITAL LETTER NJE;Lu;0;L;;;;;N;;;;045A;
+040B;CYRILLIC CAPITAL LETTER TSHE;Lu;0;L;;;;;N;;Serbocroatian;;045B;
+040C;CYRILLIC CAPITAL LETTER KJE;Lu;0;L;041A 0301;;;;N;;;;045C;
+040D;CYRILLIC CAPITAL LETTER I WITH GRAVE;Lu;0;L;0418 0300;;;;N;;;;045D;
+040E;CYRILLIC CAPITAL LETTER SHORT U;Lu;0;L;0423 0306;;;;N;;Byelorussian;;045E;
+040F;CYRILLIC CAPITAL LETTER DZHE;Lu;0;L;;;;;N;;;;045F;
+0410;CYRILLIC CAPITAL LETTER A;Lu;0;L;;;;;N;;;;0430;
+0411;CYRILLIC CAPITAL LETTER BE;Lu;0;L;;;;;N;;;;0431;
+0412;CYRILLIC CAPITAL LETTER VE;Lu;0;L;;;;;N;;;;0432;
+0413;CYRILLIC CAPITAL LETTER GHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE;;;0433;
+0414;CYRILLIC CAPITAL LETTER DE;Lu;0;L;;;;;N;;;;0434;
+0415;CYRILLIC CAPITAL LETTER IE;Lu;0;L;;;;;N;;;;0435;
+0416;CYRILLIC CAPITAL LETTER ZHE;Lu;0;L;;;;;N;;;;0436;
+0417;CYRILLIC CAPITAL LETTER ZE;Lu;0;L;;;;;N;;;;0437;
+0418;CYRILLIC CAPITAL LETTER I;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER II;;;0438;
+0419;CYRILLIC CAPITAL LETTER SHORT I;Lu;0;L;0418 0306;;;;N;CYRILLIC CAPITAL LETTER SHORT II;;;0439;
+041A;CYRILLIC CAPITAL LETTER KA;Lu;0;L;;;;;N;;;;043A;
+041B;CYRILLIC CAPITAL LETTER EL;Lu;0;L;;;;;N;;;;043B;
+041C;CYRILLIC CAPITAL LETTER EM;Lu;0;L;;;;;N;;;;043C;
+041D;CYRILLIC CAPITAL LETTER EN;Lu;0;L;;;;;N;;;;043D;
+041E;CYRILLIC CAPITAL LETTER O;Lu;0;L;;;;;N;;;;043E;
+041F;CYRILLIC CAPITAL LETTER PE;Lu;0;L;;;;;N;;;;043F;
+0420;CYRILLIC CAPITAL LETTER ER;Lu;0;L;;;;;N;;;;0440;
+0421;CYRILLIC CAPITAL LETTER ES;Lu;0;L;;;;;N;;;;0441;
+0422;CYRILLIC CAPITAL LETTER TE;Lu;0;L;;;;;N;;;;0442;
+0423;CYRILLIC CAPITAL LETTER U;Lu;0;L;;;;;N;;;;0443;
+0424;CYRILLIC CAPITAL LETTER EF;Lu;0;L;;;;;N;;;;0444;
+0425;CYRILLIC CAPITAL LETTER HA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KHA;;;0445;
+0426;CYRILLIC CAPITAL LETTER TSE;Lu;0;L;;;;;N;;;;0446;
+0427;CYRILLIC CAPITAL LETTER CHE;Lu;0;L;;;;;N;;;;0447;
+0428;CYRILLIC CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;0448;
+0429;CYRILLIC CAPITAL LETTER SHCHA;Lu;0;L;;;;;N;;;;0449;
+042A;CYRILLIC CAPITAL LETTER HARD SIGN;Lu;0;L;;;;;N;;;;044A;
+042B;CYRILLIC CAPITAL LETTER YERU;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER YERI;;;044B;
+042C;CYRILLIC CAPITAL LETTER SOFT SIGN;Lu;0;L;;;;;N;;;;044C;
+042D;CYRILLIC CAPITAL LETTER E;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER REVERSED E;;;044D;
+042E;CYRILLIC CAPITAL LETTER YU;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IU;;;044E;
+042F;CYRILLIC CAPITAL LETTER YA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IA;;;044F;
+0430;CYRILLIC SMALL LETTER A;Ll;0;L;;;;;N;;;0410;;0410
+0431;CYRILLIC SMALL LETTER BE;Ll;0;L;;;;;N;;;0411;;0411
+0432;CYRILLIC SMALL LETTER VE;Ll;0;L;;;;;N;;;0412;;0412
+0433;CYRILLIC SMALL LETTER GHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE;;0413;;0413
+0434;CYRILLIC SMALL LETTER DE;Ll;0;L;;;;;N;;;0414;;0414
+0435;CYRILLIC SMALL LETTER IE;Ll;0;L;;;;;N;;;0415;;0415
+0436;CYRILLIC SMALL LETTER ZHE;Ll;0;L;;;;;N;;;0416;;0416
+0437;CYRILLIC SMALL LETTER ZE;Ll;0;L;;;;;N;;;0417;;0417
+0438;CYRILLIC SMALL LETTER I;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER II;;0418;;0418
+0439;CYRILLIC SMALL LETTER SHORT I;Ll;0;L;0438 0306;;;;N;CYRILLIC SMALL LETTER SHORT II;;0419;;0419
+043A;CYRILLIC SMALL LETTER KA;Ll;0;L;;;;;N;;;041A;;041A
+043B;CYRILLIC SMALL LETTER EL;Ll;0;L;;;;;N;;;041B;;041B
+043C;CYRILLIC SMALL LETTER EM;Ll;0;L;;;;;N;;;041C;;041C
+043D;CYRILLIC SMALL LETTER EN;Ll;0;L;;;;;N;;;041D;;041D
+043E;CYRILLIC SMALL LETTER O;Ll;0;L;;;;;N;;;041E;;041E
+043F;CYRILLIC SMALL LETTER PE;Ll;0;L;;;;;N;;;041F;;041F
+0440;CYRILLIC SMALL LETTER ER;Ll;0;L;;;;;N;;;0420;;0420
+0441;CYRILLIC SMALL LETTER ES;Ll;0;L;;;;;N;;;0421;;0421
+0442;CYRILLIC SMALL LETTER TE;Ll;0;L;;;;;N;;;0422;;0422
+0443;CYRILLIC SMALL LETTER U;Ll;0;L;;;;;N;;;0423;;0423
+0444;CYRILLIC SMALL LETTER EF;Ll;0;L;;;;;N;;;0424;;0424
+0445;CYRILLIC SMALL LETTER HA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KHA;;0425;;0425
+0446;CYRILLIC SMALL LETTER TSE;Ll;0;L;;;;;N;;;0426;;0426
+0447;CYRILLIC SMALL LETTER CHE;Ll;0;L;;;;;N;;;0427;;0427
+0448;CYRILLIC SMALL LETTER SHA;Ll;0;L;;;;;N;;;0428;;0428
+0449;CYRILLIC SMALL LETTER SHCHA;Ll;0;L;;;;;N;;;0429;;0429
+044A;CYRILLIC SMALL LETTER HARD SIGN;Ll;0;L;;;;;N;;;042A;;042A
+044B;CYRILLIC SMALL LETTER YERU;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER YERI;;042B;;042B
+044C;CYRILLIC SMALL LETTER SOFT SIGN;Ll;0;L;;;;;N;;;042C;;042C
+044D;CYRILLIC SMALL LETTER E;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER REVERSED E;;042D;;042D
+044E;CYRILLIC SMALL LETTER YU;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IU;;042E;;042E
+044F;CYRILLIC SMALL LETTER YA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IA;;042F;;042F
+0450;CYRILLIC SMALL LETTER IE WITH GRAVE;Ll;0;L;0435 0300;;;;N;;;0400;;0400
+0451;CYRILLIC SMALL LETTER IO;Ll;0;L;0435 0308;;;;N;;;0401;;0401
+0452;CYRILLIC SMALL LETTER DJE;Ll;0;L;;;;;N;;Serbocroatian;0402;;0402
+0453;CYRILLIC SMALL LETTER GJE;Ll;0;L;0433 0301;;;;N;;;0403;;0403
+0454;CYRILLIC SMALL LETTER UKRAINIAN IE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER E;;0404;;0404
+0455;CYRILLIC SMALL LETTER DZE;Ll;0;L;;;;;N;;;0405;;0405
+0456;CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER I;;0406;;0406
+0457;CYRILLIC SMALL LETTER YI;Ll;0;L;0456 0308;;;;N;;Ukrainian;0407;;0407
+0458;CYRILLIC SMALL LETTER JE;Ll;0;L;;;;;N;;;0408;;0408
+0459;CYRILLIC SMALL LETTER LJE;Ll;0;L;;;;;N;;;0409;;0409
+045A;CYRILLIC SMALL LETTER NJE;Ll;0;L;;;;;N;;;040A;;040A
+045B;CYRILLIC SMALL LETTER TSHE;Ll;0;L;;;;;N;;Serbocroatian;040B;;040B
+045C;CYRILLIC SMALL LETTER KJE;Ll;0;L;043A 0301;;;;N;;;040C;;040C
+045D;CYRILLIC SMALL LETTER I WITH GRAVE;Ll;0;L;0438 0300;;;;N;;;040D;;040D
+045E;CYRILLIC SMALL LETTER SHORT U;Ll;0;L;0443 0306;;;;N;;Byelorussian;040E;;040E
+045F;CYRILLIC SMALL LETTER DZHE;Ll;0;L;;;;;N;;;040F;;040F
+0460;CYRILLIC CAPITAL LETTER OMEGA;Lu;0;L;;;;;N;;;;0461;
+0461;CYRILLIC SMALL LETTER OMEGA;Ll;0;L;;;;;N;;;0460;;0460
+0462;CYRILLIC CAPITAL LETTER YAT;Lu;0;L;;;;;N;;;;0463;
+0463;CYRILLIC SMALL LETTER YAT;Ll;0;L;;;;;N;;;0462;;0462
+0464;CYRILLIC CAPITAL LETTER IOTIFIED E;Lu;0;L;;;;;N;;;;0465;
+0465;CYRILLIC SMALL LETTER IOTIFIED E;Ll;0;L;;;;;N;;;0464;;0464
+0466;CYRILLIC CAPITAL LETTER LITTLE YUS;Lu;0;L;;;;;N;;;;0467;
+0467;CYRILLIC SMALL LETTER LITTLE YUS;Ll;0;L;;;;;N;;;0466;;0466
+0468;CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS;Lu;0;L;;;;;N;;;;0469;
+0469;CYRILLIC SMALL LETTER IOTIFIED LITTLE YUS;Ll;0;L;;;;;N;;;0468;;0468
+046A;CYRILLIC CAPITAL LETTER BIG YUS;Lu;0;L;;;;;N;;;;046B;
+046B;CYRILLIC SMALL LETTER BIG YUS;Ll;0;L;;;;;N;;;046A;;046A
+046C;CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS;Lu;0;L;;;;;N;;;;046D;
+046D;CYRILLIC SMALL LETTER IOTIFIED BIG YUS;Ll;0;L;;;;;N;;;046C;;046C
+046E;CYRILLIC CAPITAL LETTER KSI;Lu;0;L;;;;;N;;;;046F;
+046F;CYRILLIC SMALL LETTER KSI;Ll;0;L;;;;;N;;;046E;;046E
+0470;CYRILLIC CAPITAL LETTER PSI;Lu;0;L;;;;;N;;;;0471;
+0471;CYRILLIC SMALL LETTER PSI;Ll;0;L;;;;;N;;;0470;;0470
+0472;CYRILLIC CAPITAL LETTER FITA;Lu;0;L;;;;;N;;;;0473;
+0473;CYRILLIC SMALL LETTER FITA;Ll;0;L;;;;;N;;;0472;;0472
+0474;CYRILLIC CAPITAL LETTER IZHITSA;Lu;0;L;;;;;N;;;;0475;
+0475;CYRILLIC SMALL LETTER IZHITSA;Ll;0;L;;;;;N;;;0474;;0474
+0476;CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT;Lu;0;L;0474 030F;;;;N;CYRILLIC CAPITAL LETTER IZHITSA DOUBLE GRAVE;;;0477;
+0477;CYRILLIC SMALL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT;Ll;0;L;0475 030F;;;;N;CYRILLIC SMALL LETTER IZHITSA DOUBLE GRAVE;;0476;;0476
+0478;CYRILLIC CAPITAL LETTER UK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER UK DIGRAPH;;;0479;
+0479;CYRILLIC SMALL LETTER UK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER UK DIGRAPH;;0478;;0478
+047A;CYRILLIC CAPITAL LETTER ROUND OMEGA;Lu;0;L;;;;;N;;;;047B;
+047B;CYRILLIC SMALL LETTER ROUND OMEGA;Ll;0;L;;;;;N;;;047A;;047A
+047C;CYRILLIC CAPITAL LETTER OMEGA WITH TITLO;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER OMEGA TITLO;;;047D;
+047D;CYRILLIC SMALL LETTER OMEGA WITH TITLO;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER OMEGA TITLO;;047C;;047C
+047E;CYRILLIC CAPITAL LETTER OT;Lu;0;L;;;;;N;;;;047F;
+047F;CYRILLIC SMALL LETTER OT;Ll;0;L;;;;;N;;;047E;;047E
+0480;CYRILLIC CAPITAL LETTER KOPPA;Lu;0;L;;;;;N;;;;0481;
+0481;CYRILLIC SMALL LETTER KOPPA;Ll;0;L;;;;;N;;;0480;;0480
+0482;CYRILLIC THOUSANDS SIGN;So;0;L;;;;;N;;;;;
+0483;COMBINING CYRILLIC TITLO;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING TITLO;;;;
+0484;COMBINING CYRILLIC PALATALIZATION;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING PALATALIZATION;;;;
+0485;COMBINING CYRILLIC DASIA PNEUMATA;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING DASIA PNEUMATA;;;;
+0486;COMBINING CYRILLIC PSILI PNEUMATA;Mn;230;NSM;;;;;N;CYRILLIC NON-SPACING PSILI PNEUMATA;;;;
+0488;COMBINING CYRILLIC HUNDRED THOUSANDS SIGN;Me;0;NSM;;;;;N;;;;;
+0489;COMBINING CYRILLIC MILLIONS SIGN;Me;0;NSM;;;;;N;;;;;
+048A;CYRILLIC CAPITAL LETTER SHORT I WITH TAIL;Lu;0;L;;;;;N;;;;048B;
+048B;CYRILLIC SMALL LETTER SHORT I WITH TAIL;Ll;0;L;;;;;N;;;048A;;048A
+048C;CYRILLIC CAPITAL LETTER SEMISOFT SIGN;Lu;0;L;;;;;N;;;;048D;
+048D;CYRILLIC SMALL LETTER SEMISOFT SIGN;Ll;0;L;;;;;N;;;048C;;048C
+048E;CYRILLIC CAPITAL LETTER ER WITH TICK;Lu;0;L;;;;;N;;;;048F;
+048F;CYRILLIC SMALL LETTER ER WITH TICK;Ll;0;L;;;;;N;;;048E;;048E
+0490;CYRILLIC CAPITAL LETTER GHE WITH UPTURN;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE WITH UPTURN;;;0491;
+0491;CYRILLIC SMALL LETTER GHE WITH UPTURN;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE WITH UPTURN;;0490;;0490
+0492;CYRILLIC CAPITAL LETTER GHE WITH STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE BAR;;;0493;
+0493;CYRILLIC SMALL LETTER GHE WITH STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE BAR;;0492;;0492
+0494;CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER GE HOOK;;;0495;
+0495;CYRILLIC SMALL LETTER GHE WITH MIDDLE HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER GE HOOK;;0494;;0494
+0496;CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER ZHE WITH RIGHT DESCENDER;;;0497;
+0497;CYRILLIC SMALL LETTER ZHE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER ZHE WITH RIGHT DESCENDER;;0496;;0496
+0498;CYRILLIC CAPITAL LETTER ZE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER ZE CEDILLA;;;0499;
+0499;CYRILLIC SMALL LETTER ZE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER ZE CEDILLA;;0498;;0498
+049A;CYRILLIC CAPITAL LETTER KA WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA WITH RIGHT DESCENDER;;;049B;
+049B;CYRILLIC SMALL LETTER KA WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA WITH RIGHT DESCENDER;;049A;;049A
+049C;CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA VERTICAL BAR;;;049D;
+049D;CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA VERTICAL BAR;;049C;;049C
+049E;CYRILLIC CAPITAL LETTER KA WITH STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA BAR;;;049F;
+049F;CYRILLIC SMALL LETTER KA WITH STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA BAR;;049E;;049E
+04A0;CYRILLIC CAPITAL LETTER BASHKIR KA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER REVERSED GE KA;;;04A1;
+04A1;CYRILLIC SMALL LETTER BASHKIR KA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER REVERSED GE KA;;04A0;;04A0
+04A2;CYRILLIC CAPITAL LETTER EN WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER EN WITH RIGHT DESCENDER;;;04A3;
+04A3;CYRILLIC SMALL LETTER EN WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER EN WITH RIGHT DESCENDER;;04A2;;04A2
+04A4;CYRILLIC CAPITAL LIGATURE EN GHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER EN GE;;;04A5;
+04A5;CYRILLIC SMALL LIGATURE EN GHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER EN GE;;04A4;;04A4
+04A6;CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER PE HOOK;Abkhasian;;04A7;
+04A7;CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER PE HOOK;Abkhasian;04A6;;04A6
+04A8;CYRILLIC CAPITAL LETTER ABKHASIAN HA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER O HOOK;;;04A9;
+04A9;CYRILLIC SMALL LETTER ABKHASIAN HA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER O HOOK;;04A8;;04A8
+04AA;CYRILLIC CAPITAL LETTER ES WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER ES CEDILLA;;;04AB;
+04AB;CYRILLIC SMALL LETTER ES WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER ES CEDILLA;;04AA;;04AA
+04AC;CYRILLIC CAPITAL LETTER TE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER TE WITH RIGHT DESCENDER;;;04AD;
+04AD;CYRILLIC SMALL LETTER TE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER TE WITH RIGHT DESCENDER;;04AC;;04AC
+04AE;CYRILLIC CAPITAL LETTER STRAIGHT U;Lu;0;L;;;;;N;;;;04AF;
+04AF;CYRILLIC SMALL LETTER STRAIGHT U;Ll;0;L;;;;;N;;;04AE;;04AE
+04B0;CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER STRAIGHT U BAR;;;04B1;
+04B1;CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER STRAIGHT U BAR;;04B0;;04B0
+04B2;CYRILLIC CAPITAL LETTER HA WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KHA WITH RIGHT DESCENDER;;;04B3;
+04B3;CYRILLIC SMALL LETTER HA WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KHA WITH RIGHT DESCENDER;;04B2;;04B2
+04B4;CYRILLIC CAPITAL LIGATURE TE TSE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER TE TSE;Abkhasian;;04B5;
+04B5;CYRILLIC SMALL LIGATURE TE TSE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER TE TSE;Abkhasian;04B4;;04B4
+04B6;CYRILLIC CAPITAL LETTER CHE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER CHE WITH RIGHT DESCENDER;;;04B7;
+04B7;CYRILLIC SMALL LETTER CHE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER CHE WITH RIGHT DESCENDER;;04B6;;04B6
+04B8;CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER CHE VERTICAL BAR;;;04B9;
+04B9;CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER CHE VERTICAL BAR;;04B8;;04B8
+04BA;CYRILLIC CAPITAL LETTER SHHA;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER H;;;04BB;
+04BB;CYRILLIC SMALL LETTER SHHA;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER H;;04BA;;04BA
+04BC;CYRILLIC CAPITAL LETTER ABKHASIAN CHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IE HOOK;;;04BD;
+04BD;CYRILLIC SMALL LETTER ABKHASIAN CHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IE HOOK;;04BC;;04BC
+04BE;CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER IE HOOK OGONEK;;;04BF;
+04BF;CYRILLIC SMALL LETTER ABKHASIAN CHE WITH DESCENDER;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER IE HOOK OGONEK;;04BE;;04BE
+04C0;CYRILLIC LETTER PALOCHKA;Lu;0;L;;;;;N;CYRILLIC LETTER I;;;04CF;
+04C1;CYRILLIC CAPITAL LETTER ZHE WITH BREVE;Lu;0;L;0416 0306;;;;N;CYRILLIC CAPITAL LETTER SHORT ZHE;;;04C2;
+04C2;CYRILLIC SMALL LETTER ZHE WITH BREVE;Ll;0;L;0436 0306;;;;N;CYRILLIC SMALL LETTER SHORT ZHE;;04C1;;04C1
+04C3;CYRILLIC CAPITAL LETTER KA WITH HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER KA HOOK;;;04C4;
+04C4;CYRILLIC SMALL LETTER KA WITH HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER KA HOOK;;04C3;;04C3
+04C5;CYRILLIC CAPITAL LETTER EL WITH TAIL;Lu;0;L;;;;;N;;;;04C6;
+04C6;CYRILLIC SMALL LETTER EL WITH TAIL;Ll;0;L;;;;;N;;;04C5;;04C5
+04C7;CYRILLIC CAPITAL LETTER EN WITH HOOK;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER EN HOOK;;;04C8;
+04C8;CYRILLIC SMALL LETTER EN WITH HOOK;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER EN HOOK;;04C7;;04C7
+04C9;CYRILLIC CAPITAL LETTER EN WITH TAIL;Lu;0;L;;;;;N;;;;04CA;
+04CA;CYRILLIC SMALL LETTER EN WITH TAIL;Ll;0;L;;;;;N;;;04C9;;04C9
+04CB;CYRILLIC CAPITAL LETTER KHAKASSIAN CHE;Lu;0;L;;;;;N;CYRILLIC CAPITAL LETTER CHE WITH LEFT DESCENDER;;;04CC;
+04CC;CYRILLIC SMALL LETTER KHAKASSIAN CHE;Ll;0;L;;;;;N;CYRILLIC SMALL LETTER CHE WITH LEFT DESCENDER;;04CB;;04CB
+04CD;CYRILLIC CAPITAL LETTER EM WITH TAIL;Lu;0;L;;;;;N;;;;04CE;
+04CE;CYRILLIC SMALL LETTER EM WITH TAIL;Ll;0;L;;;;;N;;;04CD;;04CD
+04CF;CYRILLIC SMALL LETTER PALOCHKA;Ll;0;L;;;;;N;;;04C0;;04C0
+04D0;CYRILLIC CAPITAL LETTER A WITH BREVE;Lu;0;L;0410 0306;;;;N;;;;04D1;
+04D1;CYRILLIC SMALL LETTER A WITH BREVE;Ll;0;L;0430 0306;;;;N;;;04D0;;04D0
+04D2;CYRILLIC CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0410 0308;;;;N;;;;04D3;
+04D3;CYRILLIC SMALL LETTER A WITH DIAERESIS;Ll;0;L;0430 0308;;;;N;;;04D2;;04D2
+04D4;CYRILLIC CAPITAL LIGATURE A IE;Lu;0;L;;;;;N;;;;04D5;
+04D5;CYRILLIC SMALL LIGATURE A IE;Ll;0;L;;;;;N;;;04D4;;04D4
+04D6;CYRILLIC CAPITAL LETTER IE WITH BREVE;Lu;0;L;0415 0306;;;;N;;;;04D7;
+04D7;CYRILLIC SMALL LETTER IE WITH BREVE;Ll;0;L;0435 0306;;;;N;;;04D6;;04D6
+04D8;CYRILLIC CAPITAL LETTER SCHWA;Lu;0;L;;;;;N;;;;04D9;
+04D9;CYRILLIC SMALL LETTER SCHWA;Ll;0;L;;;;;N;;;04D8;;04D8
+04DA;CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS;Lu;0;L;04D8 0308;;;;N;;;;04DB;
+04DB;CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS;Ll;0;L;04D9 0308;;;;N;;;04DA;;04DA
+04DC;CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS;Lu;0;L;0416 0308;;;;N;;;;04DD;
+04DD;CYRILLIC SMALL LETTER ZHE WITH DIAERESIS;Ll;0;L;0436 0308;;;;N;;;04DC;;04DC
+04DE;CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS;Lu;0;L;0417 0308;;;;N;;;;04DF;
+04DF;CYRILLIC SMALL LETTER ZE WITH DIAERESIS;Ll;0;L;0437 0308;;;;N;;;04DE;;04DE
+04E0;CYRILLIC CAPITAL LETTER ABKHASIAN DZE;Lu;0;L;;;;;N;;;;04E1;
+04E1;CYRILLIC SMALL LETTER ABKHASIAN DZE;Ll;0;L;;;;;N;;;04E0;;04E0
+04E2;CYRILLIC CAPITAL LETTER I WITH MACRON;Lu;0;L;0418 0304;;;;N;;;;04E3;
+04E3;CYRILLIC SMALL LETTER I WITH MACRON;Ll;0;L;0438 0304;;;;N;;;04E2;;04E2
+04E4;CYRILLIC CAPITAL LETTER I WITH DIAERESIS;Lu;0;L;0418 0308;;;;N;;;;04E5;
+04E5;CYRILLIC SMALL LETTER I WITH DIAERESIS;Ll;0;L;0438 0308;;;;N;;;04E4;;04E4
+04E6;CYRILLIC CAPITAL LETTER O WITH DIAERESIS;Lu;0;L;041E 0308;;;;N;;;;04E7;
+04E7;CYRILLIC SMALL LETTER O WITH DIAERESIS;Ll;0;L;043E 0308;;;;N;;;04E6;;04E6
+04E8;CYRILLIC CAPITAL LETTER BARRED O;Lu;0;L;;;;;N;;;;04E9;
+04E9;CYRILLIC SMALL LETTER BARRED O;Ll;0;L;;;;;N;;;04E8;;04E8
+04EA;CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS;Lu;0;L;04E8 0308;;;;N;;;;04EB;
+04EB;CYRILLIC SMALL LETTER BARRED O WITH DIAERESIS;Ll;0;L;04E9 0308;;;;N;;;04EA;;04EA
+04EC;CYRILLIC CAPITAL LETTER E WITH DIAERESIS;Lu;0;L;042D 0308;;;;N;;;;04ED;
+04ED;CYRILLIC SMALL LETTER E WITH DIAERESIS;Ll;0;L;044D 0308;;;;N;;;04EC;;04EC
+04EE;CYRILLIC CAPITAL LETTER U WITH MACRON;Lu;0;L;0423 0304;;;;N;;;;04EF;
+04EF;CYRILLIC SMALL LETTER U WITH MACRON;Ll;0;L;0443 0304;;;;N;;;04EE;;04EE
+04F0;CYRILLIC CAPITAL LETTER U WITH DIAERESIS;Lu;0;L;0423 0308;;;;N;;;;04F1;
+04F1;CYRILLIC SMALL LETTER U WITH DIAERESIS;Ll;0;L;0443 0308;;;;N;;;04F0;;04F0
+04F2;CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE;Lu;0;L;0423 030B;;;;N;;;;04F3;
+04F3;CYRILLIC SMALL LETTER U WITH DOUBLE ACUTE;Ll;0;L;0443 030B;;;;N;;;04F2;;04F2
+04F4;CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS;Lu;0;L;0427 0308;;;;N;;;;04F5;
+04F5;CYRILLIC SMALL LETTER CHE WITH DIAERESIS;Ll;0;L;0447 0308;;;;N;;;04F4;;04F4
+04F6;CYRILLIC CAPITAL LETTER GHE WITH DESCENDER;Lu;0;L;;;;;N;;;;04F7;
+04F7;CYRILLIC SMALL LETTER GHE WITH DESCENDER;Ll;0;L;;;;;N;;;04F6;;04F6
+04F8;CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS;Lu;0;L;042B 0308;;;;N;;;;04F9;
+04F9;CYRILLIC SMALL LETTER YERU WITH DIAERESIS;Ll;0;L;044B 0308;;;;N;;;04F8;;04F8
+04FA;CYRILLIC CAPITAL LETTER GHE WITH STROKE AND HOOK;Lu;0;L;;;;;N;;;;04FB;
+04FB;CYRILLIC SMALL LETTER GHE WITH STROKE AND HOOK;Ll;0;L;;;;;N;;;04FA;;04FA
+04FC;CYRILLIC CAPITAL LETTER HA WITH HOOK;Lu;0;L;;;;;N;;;;04FD;
+04FD;CYRILLIC SMALL LETTER HA WITH HOOK;Ll;0;L;;;;;N;;;04FC;;04FC
+04FE;CYRILLIC CAPITAL LETTER HA WITH STROKE;Lu;0;L;;;;;N;;;;04FF;
+04FF;CYRILLIC SMALL LETTER HA WITH STROKE;Ll;0;L;;;;;N;;;04FE;;04FE
+0500;CYRILLIC CAPITAL LETTER KOMI DE;Lu;0;L;;;;;N;;;;0501;
+0501;CYRILLIC SMALL LETTER KOMI DE;Ll;0;L;;;;;N;;;0500;;0500
+0502;CYRILLIC CAPITAL LETTER KOMI DJE;Lu;0;L;;;;;N;;;;0503;
+0503;CYRILLIC SMALL LETTER KOMI DJE;Ll;0;L;;;;;N;;;0502;;0502
+0504;CYRILLIC CAPITAL LETTER KOMI ZJE;Lu;0;L;;;;;N;;;;0505;
+0505;CYRILLIC SMALL LETTER KOMI ZJE;Ll;0;L;;;;;N;;;0504;;0504
+0506;CYRILLIC CAPITAL LETTER KOMI DZJE;Lu;0;L;;;;;N;;;;0507;
+0507;CYRILLIC SMALL LETTER KOMI DZJE;Ll;0;L;;;;;N;;;0506;;0506
+0508;CYRILLIC CAPITAL LETTER KOMI LJE;Lu;0;L;;;;;N;;;;0509;
+0509;CYRILLIC SMALL LETTER KOMI LJE;Ll;0;L;;;;;N;;;0508;;0508
+050A;CYRILLIC CAPITAL LETTER KOMI NJE;Lu;0;L;;;;;N;;;;050B;
+050B;CYRILLIC SMALL LETTER KOMI NJE;Ll;0;L;;;;;N;;;050A;;050A
+050C;CYRILLIC CAPITAL LETTER KOMI SJE;Lu;0;L;;;;;N;;;;050D;
+050D;CYRILLIC SMALL LETTER KOMI SJE;Ll;0;L;;;;;N;;;050C;;050C
+050E;CYRILLIC CAPITAL LETTER KOMI TJE;Lu;0;L;;;;;N;;;;050F;
+050F;CYRILLIC SMALL LETTER KOMI TJE;Ll;0;L;;;;;N;;;050E;;050E
+0510;CYRILLIC CAPITAL LETTER REVERSED ZE;Lu;0;L;;;;;N;;;;0511;
+0511;CYRILLIC SMALL LETTER REVERSED ZE;Ll;0;L;;;;;N;;;0510;;0510
+0512;CYRILLIC CAPITAL LETTER EL WITH HOOK;Lu;0;L;;;;;N;;;;0513;
+0513;CYRILLIC SMALL LETTER EL WITH HOOK;Ll;0;L;;;;;N;;;0512;;0512
+0531;ARMENIAN CAPITAL LETTER AYB;Lu;0;L;;;;;N;;;;0561;
+0532;ARMENIAN CAPITAL LETTER BEN;Lu;0;L;;;;;N;;;;0562;
+0533;ARMENIAN CAPITAL LETTER GIM;Lu;0;L;;;;;N;;;;0563;
+0534;ARMENIAN CAPITAL LETTER DA;Lu;0;L;;;;;N;;;;0564;
+0535;ARMENIAN CAPITAL LETTER ECH;Lu;0;L;;;;;N;;;;0565;
+0536;ARMENIAN CAPITAL LETTER ZA;Lu;0;L;;;;;N;;;;0566;
+0537;ARMENIAN CAPITAL LETTER EH;Lu;0;L;;;;;N;;;;0567;
+0538;ARMENIAN CAPITAL LETTER ET;Lu;0;L;;;;;N;;;;0568;
+0539;ARMENIAN CAPITAL LETTER TO;Lu;0;L;;;;;N;;;;0569;
+053A;ARMENIAN CAPITAL LETTER ZHE;Lu;0;L;;;;;N;;;;056A;
+053B;ARMENIAN CAPITAL LETTER INI;Lu;0;L;;;;;N;;;;056B;
+053C;ARMENIAN CAPITAL LETTER LIWN;Lu;0;L;;;;;N;;;;056C;
+053D;ARMENIAN CAPITAL LETTER XEH;Lu;0;L;;;;;N;;;;056D;
+053E;ARMENIAN CAPITAL LETTER CA;Lu;0;L;;;;;N;;;;056E;
+053F;ARMENIAN CAPITAL LETTER KEN;Lu;0;L;;;;;N;;;;056F;
+0540;ARMENIAN CAPITAL LETTER HO;Lu;0;L;;;;;N;;;;0570;
+0541;ARMENIAN CAPITAL LETTER JA;Lu;0;L;;;;;N;;;;0571;
+0542;ARMENIAN CAPITAL LETTER GHAD;Lu;0;L;;;;;N;ARMENIAN CAPITAL LETTER LAD;;;0572;
+0543;ARMENIAN CAPITAL LETTER CHEH;Lu;0;L;;;;;N;;;;0573;
+0544;ARMENIAN CAPITAL LETTER MEN;Lu;0;L;;;;;N;;;;0574;
+0545;ARMENIAN CAPITAL LETTER YI;Lu;0;L;;;;;N;;;;0575;
+0546;ARMENIAN CAPITAL LETTER NOW;Lu;0;L;;;;;N;;;;0576;
+0547;ARMENIAN CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;0577;
+0548;ARMENIAN CAPITAL LETTER VO;Lu;0;L;;;;;N;;;;0578;
+0549;ARMENIAN CAPITAL LETTER CHA;Lu;0;L;;;;;N;;;;0579;
+054A;ARMENIAN CAPITAL LETTER PEH;Lu;0;L;;;;;N;;;;057A;
+054B;ARMENIAN CAPITAL LETTER JHEH;Lu;0;L;;;;;N;;;;057B;
+054C;ARMENIAN CAPITAL LETTER RA;Lu;0;L;;;;;N;;;;057C;
+054D;ARMENIAN CAPITAL LETTER SEH;Lu;0;L;;;;;N;;;;057D;
+054E;ARMENIAN CAPITAL LETTER VEW;Lu;0;L;;;;;N;;;;057E;
+054F;ARMENIAN CAPITAL LETTER TIWN;Lu;0;L;;;;;N;;;;057F;
+0550;ARMENIAN CAPITAL LETTER REH;Lu;0;L;;;;;N;;;;0580;
+0551;ARMENIAN CAPITAL LETTER CO;Lu;0;L;;;;;N;;;;0581;
+0552;ARMENIAN CAPITAL LETTER YIWN;Lu;0;L;;;;;N;;;;0582;
+0553;ARMENIAN CAPITAL LETTER PIWR;Lu;0;L;;;;;N;;;;0583;
+0554;ARMENIAN CAPITAL LETTER KEH;Lu;0;L;;;;;N;;;;0584;
+0555;ARMENIAN CAPITAL LETTER OH;Lu;0;L;;;;;N;;;;0585;
+0556;ARMENIAN CAPITAL LETTER FEH;Lu;0;L;;;;;N;;;;0586;
+0559;ARMENIAN MODIFIER LETTER LEFT HALF RING;Lm;0;L;;;;;N;;;;;
+055A;ARMENIAN APOSTROPHE;Po;0;L;;;;;N;ARMENIAN MODIFIER LETTER RIGHT HALF RING;;;;
+055B;ARMENIAN EMPHASIS MARK;Po;0;L;;;;;N;;;;;
+055C;ARMENIAN EXCLAMATION MARK;Po;0;L;;;;;N;;;;;
+055D;ARMENIAN COMMA;Po;0;L;;;;;N;;;;;
+055E;ARMENIAN QUESTION MARK;Po;0;L;;;;;N;;;;;
+055F;ARMENIAN ABBREVIATION MARK;Po;0;L;;;;;N;;;;;
+0561;ARMENIAN SMALL LETTER AYB;Ll;0;L;;;;;N;;;0531;;0531
+0562;ARMENIAN SMALL LETTER BEN;Ll;0;L;;;;;N;;;0532;;0532
+0563;ARMENIAN SMALL LETTER GIM;Ll;0;L;;;;;N;;;0533;;0533
+0564;ARMENIAN SMALL LETTER DA;Ll;0;L;;;;;N;;;0534;;0534
+0565;ARMENIAN SMALL LETTER ECH;Ll;0;L;;;;;N;;;0535;;0535
+0566;ARMENIAN SMALL LETTER ZA;Ll;0;L;;;;;N;;;0536;;0536
+0567;ARMENIAN SMALL LETTER EH;Ll;0;L;;;;;N;;;0537;;0537
+0568;ARMENIAN SMALL LETTER ET;Ll;0;L;;;;;N;;;0538;;0538
+0569;ARMENIAN SMALL LETTER TO;Ll;0;L;;;;;N;;;0539;;0539
+056A;ARMENIAN SMALL LETTER ZHE;Ll;0;L;;;;;N;;;053A;;053A
+056B;ARMENIAN SMALL LETTER INI;Ll;0;L;;;;;N;;;053B;;053B
+056C;ARMENIAN SMALL LETTER LIWN;Ll;0;L;;;;;N;;;053C;;053C
+056D;ARMENIAN SMALL LETTER XEH;Ll;0;L;;;;;N;;;053D;;053D
+056E;ARMENIAN SMALL LETTER CA;Ll;0;L;;;;;N;;;053E;;053E
+056F;ARMENIAN SMALL LETTER KEN;Ll;0;L;;;;;N;;;053F;;053F
+0570;ARMENIAN SMALL LETTER HO;Ll;0;L;;;;;N;;;0540;;0540
+0571;ARMENIAN SMALL LETTER JA;Ll;0;L;;;;;N;;;0541;;0541
+0572;ARMENIAN SMALL LETTER GHAD;Ll;0;L;;;;;N;ARMENIAN SMALL LETTER LAD;;0542;;0542
+0573;ARMENIAN SMALL LETTER CHEH;Ll;0;L;;;;;N;;;0543;;0543
+0574;ARMENIAN SMALL LETTER MEN;Ll;0;L;;;;;N;;;0544;;0544
+0575;ARMENIAN SMALL LETTER YI;Ll;0;L;;;;;N;;;0545;;0545
+0576;ARMENIAN SMALL LETTER NOW;Ll;0;L;;;;;N;;;0546;;0546
+0577;ARMENIAN SMALL LETTER SHA;Ll;0;L;;;;;N;;;0547;;0547
+0578;ARMENIAN SMALL LETTER VO;Ll;0;L;;;;;N;;;0548;;0548
+0579;ARMENIAN SMALL LETTER CHA;Ll;0;L;;;;;N;;;0549;;0549
+057A;ARMENIAN SMALL LETTER PEH;Ll;0;L;;;;;N;;;054A;;054A
+057B;ARMENIAN SMALL LETTER JHEH;Ll;0;L;;;;;N;;;054B;;054B
+057C;ARMENIAN SMALL LETTER RA;Ll;0;L;;;;;N;;;054C;;054C
+057D;ARMENIAN SMALL LETTER SEH;Ll;0;L;;;;;N;;;054D;;054D
+057E;ARMENIAN SMALL LETTER VEW;Ll;0;L;;;;;N;;;054E;;054E
+057F;ARMENIAN SMALL LETTER TIWN;Ll;0;L;;;;;N;;;054F;;054F
+0580;ARMENIAN SMALL LETTER REH;Ll;0;L;;;;;N;;;0550;;0550
+0581;ARMENIAN SMALL LETTER CO;Ll;0;L;;;;;N;;;0551;;0551
+0582;ARMENIAN SMALL LETTER YIWN;Ll;0;L;;;;;N;;;0552;;0552
+0583;ARMENIAN SMALL LETTER PIWR;Ll;0;L;;;;;N;;;0553;;0553
+0584;ARMENIAN SMALL LETTER KEH;Ll;0;L;;;;;N;;;0554;;0554
+0585;ARMENIAN SMALL LETTER OH;Ll;0;L;;;;;N;;;0555;;0555
+0586;ARMENIAN SMALL LETTER FEH;Ll;0;L;;;;;N;;;0556;;0556
+0587;ARMENIAN SMALL LIGATURE ECH YIWN;Ll;0;L;<compat> 0565 0582;;;;N;;;;;
+0589;ARMENIAN FULL STOP;Po;0;L;;;;;N;ARMENIAN PERIOD;;;;
+058A;ARMENIAN HYPHEN;Pd;0;ON;;;;;N;;;;;
+0591;HEBREW ACCENT ETNAHTA;Mn;220;NSM;;;;;N;;;;;
+0592;HEBREW ACCENT SEGOL;Mn;230;NSM;;;;;N;;;;;
+0593;HEBREW ACCENT SHALSHELET;Mn;230;NSM;;;;;N;;;;;
+0594;HEBREW ACCENT ZAQEF QATAN;Mn;230;NSM;;;;;N;;;;;
+0595;HEBREW ACCENT ZAQEF GADOL;Mn;230;NSM;;;;;N;;;;;
+0596;HEBREW ACCENT TIPEHA;Mn;220;NSM;;;;;N;;*;;;
+0597;HEBREW ACCENT REVIA;Mn;230;NSM;;;;;N;;;;;
+0598;HEBREW ACCENT ZARQA;Mn;230;NSM;;;;;N;;*;;;
+0599;HEBREW ACCENT PASHTA;Mn;230;NSM;;;;;N;;;;;
+059A;HEBREW ACCENT YETIV;Mn;222;NSM;;;;;N;;;;;
+059B;HEBREW ACCENT TEVIR;Mn;220;NSM;;;;;N;;;;;
+059C;HEBREW ACCENT GERESH;Mn;230;NSM;;;;;N;;;;;
+059D;HEBREW ACCENT GERESH MUQDAM;Mn;230;NSM;;;;;N;;;;;
+059E;HEBREW ACCENT GERSHAYIM;Mn;230;NSM;;;;;N;;;;;
+059F;HEBREW ACCENT QARNEY PARA;Mn;230;NSM;;;;;N;;;;;
+05A0;HEBREW ACCENT TELISHA GEDOLA;Mn;230;NSM;;;;;N;;;;;
+05A1;HEBREW ACCENT PAZER;Mn;230;NSM;;;;;N;;;;;
+05A2;HEBREW ACCENT ATNAH HAFUKH;Mn;220;NSM;;;;;N;;;;;
+05A3;HEBREW ACCENT MUNAH;Mn;220;NSM;;;;;N;;;;;
+05A4;HEBREW ACCENT MAHAPAKH;Mn;220;NSM;;;;;N;;;;;
+05A5;HEBREW ACCENT MERKHA;Mn;220;NSM;;;;;N;;*;;;
+05A6;HEBREW ACCENT MERKHA KEFULA;Mn;220;NSM;;;;;N;;;;;
+05A7;HEBREW ACCENT DARGA;Mn;220;NSM;;;;;N;;;;;
+05A8;HEBREW ACCENT QADMA;Mn;230;NSM;;;;;N;;*;;;
+05A9;HEBREW ACCENT TELISHA QETANA;Mn;230;NSM;;;;;N;;;;;
+05AA;HEBREW ACCENT YERAH BEN YOMO;Mn;220;NSM;;;;;N;;*;;;
+05AB;HEBREW ACCENT OLE;Mn;230;NSM;;;;;N;;;;;
+05AC;HEBREW ACCENT ILUY;Mn;230;NSM;;;;;N;;;;;
+05AD;HEBREW ACCENT DEHI;Mn;222;NSM;;;;;N;;;;;
+05AE;HEBREW ACCENT ZINOR;Mn;228;NSM;;;;;N;;;;;
+05AF;HEBREW MARK MASORA CIRCLE;Mn;230;NSM;;;;;N;;;;;
+05B0;HEBREW POINT SHEVA;Mn;10;NSM;;;;;N;;;;;
+05B1;HEBREW POINT HATAF SEGOL;Mn;11;NSM;;;;;N;;;;;
+05B2;HEBREW POINT HATAF PATAH;Mn;12;NSM;;;;;N;;;;;
+05B3;HEBREW POINT HATAF QAMATS;Mn;13;NSM;;;;;N;;;;;
+05B4;HEBREW POINT HIRIQ;Mn;14;NSM;;;;;N;;;;;
+05B5;HEBREW POINT TSERE;Mn;15;NSM;;;;;N;;;;;
+05B6;HEBREW POINT SEGOL;Mn;16;NSM;;;;;N;;;;;
+05B7;HEBREW POINT PATAH;Mn;17;NSM;;;;;N;;;;;
+05B8;HEBREW POINT QAMATS;Mn;18;NSM;;;;;N;;;;;
+05B9;HEBREW POINT HOLAM;Mn;19;NSM;;;;;N;;;;;
+05BA;HEBREW POINT HOLAM HASER FOR VAV;Mn;19;NSM;;;;;N;;;;;
+05BB;HEBREW POINT QUBUTS;Mn;20;NSM;;;;;N;;;;;
+05BC;HEBREW POINT DAGESH OR MAPIQ;Mn;21;NSM;;;;;N;HEBREW POINT DAGESH;or shuruq;;;
+05BD;HEBREW POINT METEG;Mn;22;NSM;;;;;N;;*;;;
+05BE;HEBREW PUNCTUATION MAQAF;Po;0;R;;;;;N;;;;;
+05BF;HEBREW POINT RAFE;Mn;23;NSM;;;;;N;;;;;
+05C0;HEBREW PUNCTUATION PASEQ;Po;0;R;;;;;N;HEBREW POINT PASEQ;*;;;
+05C1;HEBREW POINT SHIN DOT;Mn;24;NSM;;;;;N;;;;;
+05C2;HEBREW POINT SIN DOT;Mn;25;NSM;;;;;N;;;;;
+05C3;HEBREW PUNCTUATION SOF PASUQ;Po;0;R;;;;;N;;*;;;
+05C4;HEBREW MARK UPPER DOT;Mn;230;NSM;;;;;N;;;;;
+05C5;HEBREW MARK LOWER DOT;Mn;220;NSM;;;;;N;;;;;
+05C6;HEBREW PUNCTUATION NUN HAFUKHA;Po;0;R;;;;;N;;;;;
+05C7;HEBREW POINT QAMATS QATAN;Mn;18;NSM;;;;;N;;;;;
+05D0;HEBREW LETTER ALEF;Lo;0;R;;;;;N;;;;;
+05D1;HEBREW LETTER BET;Lo;0;R;;;;;N;;;;;
+05D2;HEBREW LETTER GIMEL;Lo;0;R;;;;;N;;;;;
+05D3;HEBREW LETTER DALET;Lo;0;R;;;;;N;;;;;
+05D4;HEBREW LETTER HE;Lo;0;R;;;;;N;;;;;
+05D5;HEBREW LETTER VAV;Lo;0;R;;;;;N;;;;;
+05D6;HEBREW LETTER ZAYIN;Lo;0;R;;;;;N;;;;;
+05D7;HEBREW LETTER HET;Lo;0;R;;;;;N;;;;;
+05D8;HEBREW LETTER TET;Lo;0;R;;;;;N;;;;;
+05D9;HEBREW LETTER YOD;Lo;0;R;;;;;N;;;;;
+05DA;HEBREW LETTER FINAL KAF;Lo;0;R;;;;;N;;;;;
+05DB;HEBREW LETTER KAF;Lo;0;R;;;;;N;;;;;
+05DC;HEBREW LETTER LAMED;Lo;0;R;;;;;N;;;;;
+05DD;HEBREW LETTER FINAL MEM;Lo;0;R;;;;;N;;;;;
+05DE;HEBREW LETTER MEM;Lo;0;R;;;;;N;;;;;
+05DF;HEBREW LETTER FINAL NUN;Lo;0;R;;;;;N;;;;;
+05E0;HEBREW LETTER NUN;Lo;0;R;;;;;N;;;;;
+05E1;HEBREW LETTER SAMEKH;Lo;0;R;;;;;N;;;;;
+05E2;HEBREW LETTER AYIN;Lo;0;R;;;;;N;;;;;
+05E3;HEBREW LETTER FINAL PE;Lo;0;R;;;;;N;;;;;
+05E4;HEBREW LETTER PE;Lo;0;R;;;;;N;;;;;
+05E5;HEBREW LETTER FINAL TSADI;Lo;0;R;;;;;N;;;;;
+05E6;HEBREW LETTER TSADI;Lo;0;R;;;;;N;;;;;
+05E7;HEBREW LETTER QOF;Lo;0;R;;;;;N;;;;;
+05E8;HEBREW LETTER RESH;Lo;0;R;;;;;N;;;;;
+05E9;HEBREW LETTER SHIN;Lo;0;R;;;;;N;;;;;
+05EA;HEBREW LETTER TAV;Lo;0;R;;;;;N;;;;;
+05F0;HEBREW LIGATURE YIDDISH DOUBLE VAV;Lo;0;R;;;;;N;HEBREW LETTER DOUBLE VAV;;;;
+05F1;HEBREW LIGATURE YIDDISH VAV YOD;Lo;0;R;;;;;N;HEBREW LETTER VAV YOD;;;;
+05F2;HEBREW LIGATURE YIDDISH DOUBLE YOD;Lo;0;R;;;;;N;HEBREW LETTER DOUBLE YOD;;;;
+05F3;HEBREW PUNCTUATION GERESH;Po;0;R;;;;;N;;;;;
+05F4;HEBREW PUNCTUATION GERSHAYIM;Po;0;R;;;;;N;;;;;
+0600;ARABIC NUMBER SIGN;Cf;0;AL;;;;;N;;;;;
+0601;ARABIC SIGN SANAH;Cf;0;AL;;;;;N;;;;;
+0602;ARABIC FOOTNOTE MARKER;Cf;0;AL;;;;;N;;;;;
+0603;ARABIC SIGN SAFHA;Cf;0;AL;;;;;N;;;;;
+060B;AFGHANI SIGN;Sc;0;AL;;;;;N;;;;;
+060C;ARABIC COMMA;Po;0;CS;;;;;N;;;;;
+060D;ARABIC DATE SEPARATOR;Po;0;AL;;;;;N;;;;;
+060E;ARABIC POETIC VERSE SIGN;So;0;ON;;;;;N;;;;;
+060F;ARABIC SIGN MISRA;So;0;ON;;;;;N;;;;;
+0610;ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM;Mn;230;NSM;;;;;N;;;;;
+0611;ARABIC SIGN ALAYHE ASSALLAM;Mn;230;NSM;;;;;N;;;;;
+0612;ARABIC SIGN RAHMATULLAH ALAYHE;Mn;230;NSM;;;;;N;;;;;
+0613;ARABIC SIGN RADI ALLAHOU ANHU;Mn;230;NSM;;;;;N;;;;;
+0614;ARABIC SIGN TAKHALLUS;Mn;230;NSM;;;;;N;;;;;
+0615;ARABIC SMALL HIGH TAH;Mn;230;NSM;;;;;N;;;;;
+061B;ARABIC SEMICOLON;Po;0;AL;;;;;N;;;;;
+061E;ARABIC TRIPLE DOT PUNCTUATION MARK;Po;0;AL;;;;;N;;;;;
+061F;ARABIC QUESTION MARK;Po;0;AL;;;;;N;;;;;
+0621;ARABIC LETTER HAMZA;Lo;0;AL;;;;;N;ARABIC LETTER HAMZAH;;;;
+0622;ARABIC LETTER ALEF WITH MADDA ABOVE;Lo;0;AL;0627 0653;;;;N;ARABIC LETTER MADDAH ON ALEF;;;;
+0623;ARABIC LETTER ALEF WITH HAMZA ABOVE;Lo;0;AL;0627 0654;;;;N;ARABIC LETTER HAMZAH ON ALEF;;;;
+0624;ARABIC LETTER WAW WITH HAMZA ABOVE;Lo;0;AL;0648 0654;;;;N;ARABIC LETTER HAMZAH ON WAW;;;;
+0625;ARABIC LETTER ALEF WITH HAMZA BELOW;Lo;0;AL;0627 0655;;;;N;ARABIC LETTER HAMZAH UNDER ALEF;;;;
+0626;ARABIC LETTER YEH WITH HAMZA ABOVE;Lo;0;AL;064A 0654;;;;N;ARABIC LETTER HAMZAH ON YA;;;;
+0627;ARABIC LETTER ALEF;Lo;0;AL;;;;;N;;;;;
+0628;ARABIC LETTER BEH;Lo;0;AL;;;;;N;ARABIC LETTER BAA;;;;
+0629;ARABIC LETTER TEH MARBUTA;Lo;0;AL;;;;;N;ARABIC LETTER TAA MARBUTAH;;;;
+062A;ARABIC LETTER TEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA;;;;
+062B;ARABIC LETTER THEH;Lo;0;AL;;;;;N;ARABIC LETTER THAA;;;;
+062C;ARABIC LETTER JEEM;Lo;0;AL;;;;;N;;;;;
+062D;ARABIC LETTER HAH;Lo;0;AL;;;;;N;ARABIC LETTER HAA;;;;
+062E;ARABIC LETTER KHAH;Lo;0;AL;;;;;N;ARABIC LETTER KHAA;;;;
+062F;ARABIC LETTER DAL;Lo;0;AL;;;;;N;;;;;
+0630;ARABIC LETTER THAL;Lo;0;AL;;;;;N;;;;;
+0631;ARABIC LETTER REH;Lo;0;AL;;;;;N;ARABIC LETTER RA;;;;
+0632;ARABIC LETTER ZAIN;Lo;0;AL;;;;;N;;;;;
+0633;ARABIC LETTER SEEN;Lo;0;AL;;;;;N;;;;;
+0634;ARABIC LETTER SHEEN;Lo;0;AL;;;;;N;;;;;
+0635;ARABIC LETTER SAD;Lo;0;AL;;;;;N;;;;;
+0636;ARABIC LETTER DAD;Lo;0;AL;;;;;N;;;;;
+0637;ARABIC LETTER TAH;Lo;0;AL;;;;;N;;;;;
+0638;ARABIC LETTER ZAH;Lo;0;AL;;;;;N;ARABIC LETTER DHAH;;;;
+0639;ARABIC LETTER AIN;Lo;0;AL;;;;;N;;;;;
+063A;ARABIC LETTER GHAIN;Lo;0;AL;;;;;N;;;;;
+0640;ARABIC TATWEEL;Lm;0;AL;;;;;N;;;;;
+0641;ARABIC LETTER FEH;Lo;0;AL;;;;;N;ARABIC LETTER FA;;;;
+0642;ARABIC LETTER QAF;Lo;0;AL;;;;;N;;;;;
+0643;ARABIC LETTER KAF;Lo;0;AL;;;;;N;ARABIC LETTER CAF;;;;
+0644;ARABIC LETTER LAM;Lo;0;AL;;;;;N;;;;;
+0645;ARABIC LETTER MEEM;Lo;0;AL;;;;;N;;;;;
+0646;ARABIC LETTER NOON;Lo;0;AL;;;;;N;;;;;
+0647;ARABIC LETTER HEH;Lo;0;AL;;;;;N;ARABIC LETTER HA;;;;
+0648;ARABIC LETTER WAW;Lo;0;AL;;;;;N;;;;;
+0649;ARABIC LETTER ALEF MAKSURA;Lo;0;AL;;;;;N;ARABIC LETTER ALEF MAQSURAH;;;;
+064A;ARABIC LETTER YEH;Lo;0;AL;;;;;N;ARABIC LETTER YA;;;;
+064B;ARABIC FATHATAN;Mn;27;NSM;;;;;N;;;;;
+064C;ARABIC DAMMATAN;Mn;28;NSM;;;;;N;;;;;
+064D;ARABIC KASRATAN;Mn;29;NSM;;;;;N;;;;;
+064E;ARABIC FATHA;Mn;30;NSM;;;;;N;ARABIC FATHAH;;;;
+064F;ARABIC DAMMA;Mn;31;NSM;;;;;N;ARABIC DAMMAH;;;;
+0650;ARABIC KASRA;Mn;32;NSM;;;;;N;ARABIC KASRAH;;;;
+0651;ARABIC SHADDA;Mn;33;NSM;;;;;N;ARABIC SHADDAH;;;;
+0652;ARABIC SUKUN;Mn;34;NSM;;;;;N;;;;;
+0653;ARABIC MADDAH ABOVE;Mn;230;NSM;;;;;N;;;;;
+0654;ARABIC HAMZA ABOVE;Mn;230;NSM;;;;;N;;;;;
+0655;ARABIC HAMZA BELOW;Mn;220;NSM;;;;;N;;;;;
+0656;ARABIC SUBSCRIPT ALEF;Mn;220;NSM;;;;;N;;;;;
+0657;ARABIC INVERTED DAMMA;Mn;230;NSM;;;;;N;;;;;
+0658;ARABIC MARK NOON GHUNNA;Mn;230;NSM;;;;;N;;;;;
+0659;ARABIC ZWARAKAY;Mn;230;NSM;;;;;N;;;;;
+065A;ARABIC VOWEL SIGN SMALL V ABOVE;Mn;230;NSM;;;;;N;;;;;
+065B;ARABIC VOWEL SIGN INVERTED SMALL V ABOVE;Mn;230;NSM;;;;;N;;;;;
+065C;ARABIC VOWEL SIGN DOT BELOW;Mn;220;NSM;;;;;N;;;;;
+065D;ARABIC REVERSED DAMMA;Mn;230;NSM;;;;;N;;;;;
+065E;ARABIC FATHA WITH TWO DOTS;Mn;230;NSM;;;;;N;;;;;
+0660;ARABIC-INDIC DIGIT ZERO;Nd;0;AN;;0;0;0;N;;;;;
+0661;ARABIC-INDIC DIGIT ONE;Nd;0;AN;;1;1;1;N;;;;;
+0662;ARABIC-INDIC DIGIT TWO;Nd;0;AN;;2;2;2;N;;;;;
+0663;ARABIC-INDIC DIGIT THREE;Nd;0;AN;;3;3;3;N;;;;;
+0664;ARABIC-INDIC DIGIT FOUR;Nd;0;AN;;4;4;4;N;;;;;
+0665;ARABIC-INDIC DIGIT FIVE;Nd;0;AN;;5;5;5;N;;;;;
+0666;ARABIC-INDIC DIGIT SIX;Nd;0;AN;;6;6;6;N;;;;;
+0667;ARABIC-INDIC DIGIT SEVEN;Nd;0;AN;;7;7;7;N;;;;;
+0668;ARABIC-INDIC DIGIT EIGHT;Nd;0;AN;;8;8;8;N;;;;;
+0669;ARABIC-INDIC DIGIT NINE;Nd;0;AN;;9;9;9;N;;;;;
+066A;ARABIC PERCENT SIGN;Po;0;ET;;;;;N;;;;;
+066B;ARABIC DECIMAL SEPARATOR;Po;0;AN;;;;;N;;;;;
+066C;ARABIC THOUSANDS SEPARATOR;Po;0;AN;;;;;N;;;;;
+066D;ARABIC FIVE POINTED STAR;Po;0;AL;;;;;N;;;;;
+066E;ARABIC LETTER DOTLESS BEH;Lo;0;AL;;;;;N;;;;;
+066F;ARABIC LETTER DOTLESS QAF;Lo;0;AL;;;;;N;;;;;
+0670;ARABIC LETTER SUPERSCRIPT ALEF;Mn;35;NSM;;;;;N;ARABIC ALEF ABOVE;;;;
+0671;ARABIC LETTER ALEF WASLA;Lo;0;AL;;;;;N;ARABIC LETTER HAMZAT WASL ON ALEF;;;;
+0672;ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER WAVY HAMZAH ON ALEF;;;;
+0673;ARABIC LETTER ALEF WITH WAVY HAMZA BELOW;Lo;0;AL;;;;;N;ARABIC LETTER WAVY HAMZAH UNDER ALEF;;;;
+0674;ARABIC LETTER HIGH HAMZA;Lo;0;AL;;;;;N;ARABIC LETTER HIGH HAMZAH;;;;
+0675;ARABIC LETTER HIGH HAMZA ALEF;Lo;0;AL;<compat> 0627 0674;;;;N;ARABIC LETTER HIGH HAMZAH ALEF;;;;
+0676;ARABIC LETTER HIGH HAMZA WAW;Lo;0;AL;<compat> 0648 0674;;;;N;ARABIC LETTER HIGH HAMZAH WAW;;;;
+0677;ARABIC LETTER U WITH HAMZA ABOVE;Lo;0;AL;<compat> 06C7 0674;;;;N;ARABIC LETTER HIGH HAMZAH WAW WITH DAMMAH;;;;
+0678;ARABIC LETTER HIGH HAMZA YEH;Lo;0;AL;<compat> 064A 0674;;;;N;ARABIC LETTER HIGH HAMZAH YA;;;;
+0679;ARABIC LETTER TTEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH SMALL TAH;;;;
+067A;ARABIC LETTER TTEHEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH TWO DOTS VERTICAL ABOVE;;;;
+067B;ARABIC LETTER BEEH;Lo;0;AL;;;;;N;ARABIC LETTER BAA WITH TWO DOTS VERTICAL BELOW;;;;
+067C;ARABIC LETTER TEH WITH RING;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH RING;;;;
+067D;ARABIC LETTER TEH WITH THREE DOTS ABOVE DOWNWARDS;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH THREE DOTS ABOVE DOWNWARD;;;;
+067E;ARABIC LETTER PEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH THREE DOTS BELOW;;;;
+067F;ARABIC LETTER TEHEH;Lo;0;AL;;;;;N;ARABIC LETTER TAA WITH FOUR DOTS ABOVE;;;;
+0680;ARABIC LETTER BEHEH;Lo;0;AL;;;;;N;ARABIC LETTER BAA WITH FOUR DOTS BELOW;;;;
+0681;ARABIC LETTER HAH WITH HAMZA ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER HAMZAH ON HAA;;;;
+0682;ARABIC LETTER HAH WITH TWO DOTS VERTICAL ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH TWO DOTS VERTICAL ABOVE;;;;
+0683;ARABIC LETTER NYEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE TWO DOTS;;;;
+0684;ARABIC LETTER DYEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE TWO DOTS VERTICAL;;;;
+0685;ARABIC LETTER HAH WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH THREE DOTS ABOVE;;;;
+0686;ARABIC LETTER TCHEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE THREE DOTS DOWNWARD;;;;
+0687;ARABIC LETTER TCHEHEH;Lo;0;AL;;;;;N;ARABIC LETTER HAA WITH MIDDLE FOUR DOTS;;;;
+0688;ARABIC LETTER DDAL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH SMALL TAH;;;;
+0689;ARABIC LETTER DAL WITH RING;Lo;0;AL;;;;;N;;;;;
+068A;ARABIC LETTER DAL WITH DOT BELOW;Lo;0;AL;;;;;N;;;;;
+068B;ARABIC LETTER DAL WITH DOT BELOW AND SMALL TAH;Lo;0;AL;;;;;N;;;;;
+068C;ARABIC LETTER DAHAL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH TWO DOTS ABOVE;;;;
+068D;ARABIC LETTER DDAHAL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH TWO DOTS BELOW;;;;
+068E;ARABIC LETTER DUL;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH THREE DOTS ABOVE;;;;
+068F;ARABIC LETTER DAL WITH THREE DOTS ABOVE DOWNWARDS;Lo;0;AL;;;;;N;ARABIC LETTER DAL WITH THREE DOTS ABOVE DOWNWARD;;;;
+0690;ARABIC LETTER DAL WITH FOUR DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+0691;ARABIC LETTER RREH;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH SMALL TAH;;;;
+0692;ARABIC LETTER REH WITH SMALL V;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH SMALL V;;;;
+0693;ARABIC LETTER REH WITH RING;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH RING;;;;
+0694;ARABIC LETTER REH WITH DOT BELOW;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH DOT BELOW;;;;
+0695;ARABIC LETTER REH WITH SMALL V BELOW;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH SMALL V BELOW;;;;
+0696;ARABIC LETTER REH WITH DOT BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH DOT BELOW AND DOT ABOVE;;;;
+0697;ARABIC LETTER REH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH TWO DOTS ABOVE;;;;
+0698;ARABIC LETTER JEH;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH THREE DOTS ABOVE;;;;
+0699;ARABIC LETTER REH WITH FOUR DOTS ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER RA WITH FOUR DOTS ABOVE;;;;
+069A;ARABIC LETTER SEEN WITH DOT BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+069B;ARABIC LETTER SEEN WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;;
+069C;ARABIC LETTER SEEN WITH THREE DOTS BELOW AND THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+069D;ARABIC LETTER SAD WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;;
+069E;ARABIC LETTER SAD WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+069F;ARABIC LETTER TAH WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+06A0;ARABIC LETTER AIN WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+06A1;ARABIC LETTER DOTLESS FEH;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS FA;;;;
+06A2;ARABIC LETTER FEH WITH DOT MOVED BELOW;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH DOT MOVED BELOW;;;;
+06A3;ARABIC LETTER FEH WITH DOT BELOW;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH DOT BELOW;;;;
+06A4;ARABIC LETTER VEH;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH THREE DOTS ABOVE;;;;
+06A5;ARABIC LETTER FEH WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH THREE DOTS BELOW;;;;
+06A6;ARABIC LETTER PEHEH;Lo;0;AL;;;;;N;ARABIC LETTER FA WITH FOUR DOTS ABOVE;;;;
+06A7;ARABIC LETTER QAF WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+06A8;ARABIC LETTER QAF WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+06A9;ARABIC LETTER KEHEH;Lo;0;AL;;;;;N;ARABIC LETTER OPEN CAF;;;;
+06AA;ARABIC LETTER SWASH KAF;Lo;0;AL;;;;;N;ARABIC LETTER SWASH CAF;;;;
+06AB;ARABIC LETTER KAF WITH RING;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH RING;;;;
+06AC;ARABIC LETTER KAF WITH DOT ABOVE;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH DOT ABOVE;;;;
+06AD;ARABIC LETTER NG;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH THREE DOTS ABOVE;;;;
+06AE;ARABIC LETTER KAF WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;ARABIC LETTER CAF WITH THREE DOTS BELOW;;;;
+06AF;ARABIC LETTER GAF;Lo;0;AL;;;;;N;;*;;;
+06B0;ARABIC LETTER GAF WITH RING;Lo;0;AL;;;;;N;;;;;
+06B1;ARABIC LETTER NGOEH;Lo;0;AL;;;;;N;ARABIC LETTER GAF WITH TWO DOTS ABOVE;;;;
+06B2;ARABIC LETTER GAF WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;;
+06B3;ARABIC LETTER GUEH;Lo;0;AL;;;;;N;ARABIC LETTER GAF WITH TWO DOTS VERTICAL BELOW;;;;
+06B4;ARABIC LETTER GAF WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+06B5;ARABIC LETTER LAM WITH SMALL V;Lo;0;AL;;;;;N;;;;;
+06B6;ARABIC LETTER LAM WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+06B7;ARABIC LETTER LAM WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+06B8;ARABIC LETTER LAM WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;;;;;
+06B9;ARABIC LETTER NOON WITH DOT BELOW;Lo;0;AL;;;;;N;;;;;
+06BA;ARABIC LETTER NOON GHUNNA;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS NOON;;;;
+06BB;ARABIC LETTER RNOON;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS NOON WITH SMALL TAH;;;;
+06BC;ARABIC LETTER NOON WITH RING;Lo;0;AL;;;;;N;;;;;
+06BD;ARABIC LETTER NOON WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+06BE;ARABIC LETTER HEH DOACHASHMEE;Lo;0;AL;;;;;N;ARABIC LETTER KNOTTED HA;;;;
+06BF;ARABIC LETTER TCHEH WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+06C0;ARABIC LETTER HEH WITH YEH ABOVE;Lo;0;AL;06D5 0654;;;;N;ARABIC LETTER HAMZAH ON HA;;;;
+06C1;ARABIC LETTER HEH GOAL;Lo;0;AL;;;;;N;ARABIC LETTER HA GOAL;;;;
+06C2;ARABIC LETTER HEH GOAL WITH HAMZA ABOVE;Lo;0;AL;06C1 0654;;;;N;ARABIC LETTER HAMZAH ON HA GOAL;;;;
+06C3;ARABIC LETTER TEH MARBUTA GOAL;Lo;0;AL;;;;;N;ARABIC LETTER TAA MARBUTAH GOAL;;;;
+06C4;ARABIC LETTER WAW WITH RING;Lo;0;AL;;;;;N;;;;;
+06C5;ARABIC LETTER KIRGHIZ OE;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH BAR;;;;
+06C6;ARABIC LETTER OE;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH SMALL V;;;;
+06C7;ARABIC LETTER U;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH DAMMAH;;;;
+06C8;ARABIC LETTER YU;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH ALEF ABOVE;;;;
+06C9;ARABIC LETTER KIRGHIZ YU;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH INVERTED SMALL V;;;;
+06CA;ARABIC LETTER WAW WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+06CB;ARABIC LETTER VE;Lo;0;AL;;;;;N;ARABIC LETTER WAW WITH THREE DOTS ABOVE;;;;
+06CC;ARABIC LETTER FARSI YEH;Lo;0;AL;;;;;N;ARABIC LETTER DOTLESS YA;;;;
+06CD;ARABIC LETTER YEH WITH TAIL;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH TAIL;;;;
+06CE;ARABIC LETTER YEH WITH SMALL V;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH SMALL V;;;;
+06CF;ARABIC LETTER WAW WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+06D0;ARABIC LETTER E;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH TWO DOTS VERTICAL BELOW;*;;;
+06D1;ARABIC LETTER YEH WITH THREE DOTS BELOW;Lo;0;AL;;;;;N;ARABIC LETTER YA WITH THREE DOTS BELOW;;;;
+06D2;ARABIC LETTER YEH BARREE;Lo;0;AL;;;;;N;ARABIC LETTER YA BARREE;;;;
+06D3;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE;Lo;0;AL;06D2 0654;;;;N;ARABIC LETTER HAMZAH ON YA BARREE;;;;
+06D4;ARABIC FULL STOP;Po;0;AL;;;;;N;ARABIC PERIOD;;;;
+06D5;ARABIC LETTER AE;Lo;0;AL;;;;;N;;;;;
+06D6;ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA;Mn;230;NSM;;;;;N;;;;;
+06D7;ARABIC SMALL HIGH LIGATURE QAF WITH LAM WITH ALEF MAKSURA;Mn;230;NSM;;;;;N;;;;;
+06D8;ARABIC SMALL HIGH MEEM INITIAL FORM;Mn;230;NSM;;;;;N;;;;;
+06D9;ARABIC SMALL HIGH LAM ALEF;Mn;230;NSM;;;;;N;;;;;
+06DA;ARABIC SMALL HIGH JEEM;Mn;230;NSM;;;;;N;;;;;
+06DB;ARABIC SMALL HIGH THREE DOTS;Mn;230;NSM;;;;;N;;;;;
+06DC;ARABIC SMALL HIGH SEEN;Mn;230;NSM;;;;;N;;;;;
+06DD;ARABIC END OF AYAH;Cf;0;AL;;;;;N;;;;;
+06DE;ARABIC START OF RUB EL HIZB;Me;0;NSM;;;;;N;;;;;
+06DF;ARABIC SMALL HIGH ROUNDED ZERO;Mn;230;NSM;;;;;N;;;;;
+06E0;ARABIC SMALL HIGH UPRIGHT RECTANGULAR ZERO;Mn;230;NSM;;;;;N;;;;;
+06E1;ARABIC SMALL HIGH DOTLESS HEAD OF KHAH;Mn;230;NSM;;;;;N;;;;;
+06E2;ARABIC SMALL HIGH MEEM ISOLATED FORM;Mn;230;NSM;;;;;N;;;;;
+06E3;ARABIC SMALL LOW SEEN;Mn;220;NSM;;;;;N;;;;;
+06E4;ARABIC SMALL HIGH MADDA;Mn;230;NSM;;;;;N;;;;;
+06E5;ARABIC SMALL WAW;Lm;0;AL;;;;;N;;;;;
+06E6;ARABIC SMALL YEH;Lm;0;AL;;;;;N;;;;;
+06E7;ARABIC SMALL HIGH YEH;Mn;230;NSM;;;;;N;;;;;
+06E8;ARABIC SMALL HIGH NOON;Mn;230;NSM;;;;;N;;;;;
+06E9;ARABIC PLACE OF SAJDAH;So;0;ON;;;;;N;;;;;
+06EA;ARABIC EMPTY CENTRE LOW STOP;Mn;220;NSM;;;;;N;;;;;
+06EB;ARABIC EMPTY CENTRE HIGH STOP;Mn;230;NSM;;;;;N;;;;;
+06EC;ARABIC ROUNDED HIGH STOP WITH FILLED CENTRE;Mn;230;NSM;;;;;N;;;;;
+06ED;ARABIC SMALL LOW MEEM;Mn;220;NSM;;;;;N;;;;;
+06EE;ARABIC LETTER DAL WITH INVERTED V;Lo;0;AL;;;;;N;;;;;
+06EF;ARABIC LETTER REH WITH INVERTED V;Lo;0;AL;;;;;N;;;;;
+06F0;EXTENDED ARABIC-INDIC DIGIT ZERO;Nd;0;EN;;0;0;0;N;EASTERN ARABIC-INDIC DIGIT ZERO;;;;
+06F1;EXTENDED ARABIC-INDIC DIGIT ONE;Nd;0;EN;;1;1;1;N;EASTERN ARABIC-INDIC DIGIT ONE;;;;
+06F2;EXTENDED ARABIC-INDIC DIGIT TWO;Nd;0;EN;;2;2;2;N;EASTERN ARABIC-INDIC DIGIT TWO;;;;
+06F3;EXTENDED ARABIC-INDIC DIGIT THREE;Nd;0;EN;;3;3;3;N;EASTERN ARABIC-INDIC DIGIT THREE;;;;
+06F4;EXTENDED ARABIC-INDIC DIGIT FOUR;Nd;0;EN;;4;4;4;N;EASTERN ARABIC-INDIC DIGIT FOUR;;;;
+06F5;EXTENDED ARABIC-INDIC DIGIT FIVE;Nd;0;EN;;5;5;5;N;EASTERN ARABIC-INDIC DIGIT FIVE;;;;
+06F6;EXTENDED ARABIC-INDIC DIGIT SIX;Nd;0;EN;;6;6;6;N;EASTERN ARABIC-INDIC DIGIT SIX;;;;
+06F7;EXTENDED ARABIC-INDIC DIGIT SEVEN;Nd;0;EN;;7;7;7;N;EASTERN ARABIC-INDIC DIGIT SEVEN;;;;
+06F8;EXTENDED ARABIC-INDIC DIGIT EIGHT;Nd;0;EN;;8;8;8;N;EASTERN ARABIC-INDIC DIGIT EIGHT;;;;
+06F9;EXTENDED ARABIC-INDIC DIGIT NINE;Nd;0;EN;;9;9;9;N;EASTERN ARABIC-INDIC DIGIT NINE;;;;
+06FA;ARABIC LETTER SHEEN WITH DOT BELOW;Lo;0;AL;;;;;N;;;;;
+06FB;ARABIC LETTER DAD WITH DOT BELOW;Lo;0;AL;;;;;N;;;;;
+06FC;ARABIC LETTER GHAIN WITH DOT BELOW;Lo;0;AL;;;;;N;;;;;
+06FD;ARABIC SIGN SINDHI AMPERSAND;So;0;AL;;;;;N;;;;;
+06FE;ARABIC SIGN SINDHI POSTPOSITION MEN;So;0;AL;;;;;N;;;;;
+06FF;ARABIC LETTER HEH WITH INVERTED V;Lo;0;AL;;;;;N;;;;;
+0700;SYRIAC END OF PARAGRAPH;Po;0;AL;;;;;N;;;;;
+0701;SYRIAC SUPRALINEAR FULL STOP;Po;0;AL;;;;;N;;;;;
+0702;SYRIAC SUBLINEAR FULL STOP;Po;0;AL;;;;;N;;;;;
+0703;SYRIAC SUPRALINEAR COLON;Po;0;AL;;;;;N;;;;;
+0704;SYRIAC SUBLINEAR COLON;Po;0;AL;;;;;N;;;;;
+0705;SYRIAC HORIZONTAL COLON;Po;0;AL;;;;;N;;;;;
+0706;SYRIAC COLON SKEWED LEFT;Po;0;AL;;;;;N;;;;;
+0707;SYRIAC COLON SKEWED RIGHT;Po;0;AL;;;;;N;;;;;
+0708;SYRIAC SUPRALINEAR COLON SKEWED LEFT;Po;0;AL;;;;;N;;;;;
+0709;SYRIAC SUBLINEAR COLON SKEWED RIGHT;Po;0;AL;;;;;N;;;;;
+070A;SYRIAC CONTRACTION;Po;0;AL;;;;;N;;;;;
+070B;SYRIAC HARKLEAN OBELUS;Po;0;AL;;;;;N;;;;;
+070C;SYRIAC HARKLEAN METOBELUS;Po;0;AL;;;;;N;;;;;
+070D;SYRIAC HARKLEAN ASTERISCUS;Po;0;AL;;;;;N;;;;;
+070F;SYRIAC ABBREVIATION MARK;Cf;0;BN;;;;;N;;;;;
+0710;SYRIAC LETTER ALAPH;Lo;0;AL;;;;;N;;;;;
+0711;SYRIAC LETTER SUPERSCRIPT ALAPH;Mn;36;NSM;;;;;N;;;;;
+0712;SYRIAC LETTER BETH;Lo;0;AL;;;;;N;;;;;
+0713;SYRIAC LETTER GAMAL;Lo;0;AL;;;;;N;;;;;
+0714;SYRIAC LETTER GAMAL GARSHUNI;Lo;0;AL;;;;;N;;;;;
+0715;SYRIAC LETTER DALATH;Lo;0;AL;;;;;N;;;;;
+0716;SYRIAC LETTER DOTLESS DALATH RISH;Lo;0;AL;;;;;N;;;;;
+0717;SYRIAC LETTER HE;Lo;0;AL;;;;;N;;;;;
+0718;SYRIAC LETTER WAW;Lo;0;AL;;;;;N;;;;;
+0719;SYRIAC LETTER ZAIN;Lo;0;AL;;;;;N;;;;;
+071A;SYRIAC LETTER HETH;Lo;0;AL;;;;;N;;;;;
+071B;SYRIAC LETTER TETH;Lo;0;AL;;;;;N;;;;;
+071C;SYRIAC LETTER TETH GARSHUNI;Lo;0;AL;;;;;N;;;;;
+071D;SYRIAC LETTER YUDH;Lo;0;AL;;;;;N;;;;;
+071E;SYRIAC LETTER YUDH HE;Lo;0;AL;;;;;N;;;;;
+071F;SYRIAC LETTER KAPH;Lo;0;AL;;;;;N;;;;;
+0720;SYRIAC LETTER LAMADH;Lo;0;AL;;;;;N;;;;;
+0721;SYRIAC LETTER MIM;Lo;0;AL;;;;;N;;;;;
+0722;SYRIAC LETTER NUN;Lo;0;AL;;;;;N;;;;;
+0723;SYRIAC LETTER SEMKATH;Lo;0;AL;;;;;N;;;;;
+0724;SYRIAC LETTER FINAL SEMKATH;Lo;0;AL;;;;;N;;;;;
+0725;SYRIAC LETTER E;Lo;0;AL;;;;;N;;;;;
+0726;SYRIAC LETTER PE;Lo;0;AL;;;;;N;;;;;
+0727;SYRIAC LETTER REVERSED PE;Lo;0;AL;;;;;N;;;;;
+0728;SYRIAC LETTER SADHE;Lo;0;AL;;;;;N;;;;;
+0729;SYRIAC LETTER QAPH;Lo;0;AL;;;;;N;;;;;
+072A;SYRIAC LETTER RISH;Lo;0;AL;;;;;N;;;;;
+072B;SYRIAC LETTER SHIN;Lo;0;AL;;;;;N;;;;;
+072C;SYRIAC LETTER TAW;Lo;0;AL;;;;;N;;;;;
+072D;SYRIAC LETTER PERSIAN BHETH;Lo;0;AL;;;;;N;;;;;
+072E;SYRIAC LETTER PERSIAN GHAMAL;Lo;0;AL;;;;;N;;;;;
+072F;SYRIAC LETTER PERSIAN DHALATH;Lo;0;AL;;;;;N;;;;;
+0730;SYRIAC PTHAHA ABOVE;Mn;230;NSM;;;;;N;;;;;
+0731;SYRIAC PTHAHA BELOW;Mn;220;NSM;;;;;N;;;;;
+0732;SYRIAC PTHAHA DOTTED;Mn;230;NSM;;;;;N;;;;;
+0733;SYRIAC ZQAPHA ABOVE;Mn;230;NSM;;;;;N;;;;;
+0734;SYRIAC ZQAPHA BELOW;Mn;220;NSM;;;;;N;;;;;
+0735;SYRIAC ZQAPHA DOTTED;Mn;230;NSM;;;;;N;;;;;
+0736;SYRIAC RBASA ABOVE;Mn;230;NSM;;;;;N;;;;;
+0737;SYRIAC RBASA BELOW;Mn;220;NSM;;;;;N;;;;;
+0738;SYRIAC DOTTED ZLAMA HORIZONTAL;Mn;220;NSM;;;;;N;;;;;
+0739;SYRIAC DOTTED ZLAMA ANGULAR;Mn;220;NSM;;;;;N;;;;;
+073A;SYRIAC HBASA ABOVE;Mn;230;NSM;;;;;N;;;;;
+073B;SYRIAC HBASA BELOW;Mn;220;NSM;;;;;N;;;;;
+073C;SYRIAC HBASA-ESASA DOTTED;Mn;220;NSM;;;;;N;;;;;
+073D;SYRIAC ESASA ABOVE;Mn;230;NSM;;;;;N;;;;;
+073E;SYRIAC ESASA BELOW;Mn;220;NSM;;;;;N;;;;;
+073F;SYRIAC RWAHA;Mn;230;NSM;;;;;N;;;;;
+0740;SYRIAC FEMININE DOT;Mn;230;NSM;;;;;N;;;;;
+0741;SYRIAC QUSHSHAYA;Mn;230;NSM;;;;;N;;;;;
+0742;SYRIAC RUKKAKHA;Mn;220;NSM;;;;;N;;;;;
+0743;SYRIAC TWO VERTICAL DOTS ABOVE;Mn;230;NSM;;;;;N;;;;;
+0744;SYRIAC TWO VERTICAL DOTS BELOW;Mn;220;NSM;;;;;N;;;;;
+0745;SYRIAC THREE DOTS ABOVE;Mn;230;NSM;;;;;N;;;;;
+0746;SYRIAC THREE DOTS BELOW;Mn;220;NSM;;;;;N;;;;;
+0747;SYRIAC OBLIQUE LINE ABOVE;Mn;230;NSM;;;;;N;;;;;
+0748;SYRIAC OBLIQUE LINE BELOW;Mn;220;NSM;;;;;N;;;;;
+0749;SYRIAC MUSIC;Mn;230;NSM;;;;;N;;;;;
+074A;SYRIAC BARREKH;Mn;230;NSM;;;;;N;;;;;
+074D;SYRIAC LETTER SOGDIAN ZHAIN;Lo;0;AL;;;;;N;;;;;
+074E;SYRIAC LETTER SOGDIAN KHAPH;Lo;0;AL;;;;;N;;;;;
+074F;SYRIAC LETTER SOGDIAN FE;Lo;0;AL;;;;;N;;;;;
+0750;ARABIC LETTER BEH WITH THREE DOTS HORIZONTALLY BELOW;Lo;0;AL;;;;;N;;;;;
+0751;ARABIC LETTER BEH WITH DOT BELOW AND THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+0752;ARABIC LETTER BEH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;;
+0753;ARABIC LETTER BEH WITH THREE DOTS POINTING UPWARDS BELOW AND TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+0754;ARABIC LETTER BEH WITH TWO DOTS BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+0755;ARABIC LETTER BEH WITH INVERTED SMALL V BELOW;Lo;0;AL;;;;;N;;;;;
+0756;ARABIC LETTER BEH WITH SMALL V;Lo;0;AL;;;;;N;;;;;
+0757;ARABIC LETTER HAH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+0758;ARABIC LETTER HAH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;;
+0759;ARABIC LETTER DAL WITH TWO DOTS VERTICALLY BELOW AND SMALL TAH;Lo;0;AL;;;;;N;;;;;
+075A;ARABIC LETTER DAL WITH INVERTED SMALL V BELOW;Lo;0;AL;;;;;N;;;;;
+075B;ARABIC LETTER REH WITH STROKE;Lo;0;AL;;;;;N;;;;;
+075C;ARABIC LETTER SEEN WITH FOUR DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+075D;ARABIC LETTER AIN WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+075E;ARABIC LETTER AIN WITH THREE DOTS POINTING DOWNWARDS ABOVE;Lo;0;AL;;;;;N;;;;;
+075F;ARABIC LETTER AIN WITH TWO DOTS VERTICALLY ABOVE;Lo;0;AL;;;;;N;;;;;
+0760;ARABIC LETTER FEH WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;;
+0761;ARABIC LETTER FEH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;;
+0762;ARABIC LETTER KEHEH WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+0763;ARABIC LETTER KEHEH WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+0764;ARABIC LETTER KEHEH WITH THREE DOTS POINTING UPWARDS BELOW;Lo;0;AL;;;;;N;;;;;
+0765;ARABIC LETTER MEEM WITH DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+0766;ARABIC LETTER MEEM WITH DOT BELOW;Lo;0;AL;;;;;N;;;;;
+0767;ARABIC LETTER NOON WITH TWO DOTS BELOW;Lo;0;AL;;;;;N;;;;;
+0768;ARABIC LETTER NOON WITH SMALL TAH;Lo;0;AL;;;;;N;;;;;
+0769;ARABIC LETTER NOON WITH SMALL V;Lo;0;AL;;;;;N;;;;;
+076A;ARABIC LETTER LAM WITH BAR;Lo;0;AL;;;;;N;;;;;
+076B;ARABIC LETTER REH WITH TWO DOTS VERTICALLY ABOVE;Lo;0;AL;;;;;N;;;;;
+076C;ARABIC LETTER REH WITH HAMZA ABOVE;Lo;0;AL;;;;;N;;;;;
+076D;ARABIC LETTER SEEN WITH TWO DOTS VERTICALLY ABOVE;Lo;0;AL;;;;;N;;;;;
+0780;THAANA LETTER HAA;Lo;0;AL;;;;;N;;;;;
+0781;THAANA LETTER SHAVIYANI;Lo;0;AL;;;;;N;;;;;
+0782;THAANA LETTER NOONU;Lo;0;AL;;;;;N;;;;;
+0783;THAANA LETTER RAA;Lo;0;AL;;;;;N;;;;;
+0784;THAANA LETTER BAA;Lo;0;AL;;;;;N;;;;;
+0785;THAANA LETTER LHAVIYANI;Lo;0;AL;;;;;N;;;;;
+0786;THAANA LETTER KAAFU;Lo;0;AL;;;;;N;;;;;
+0787;THAANA LETTER ALIFU;Lo;0;AL;;;;;N;;;;;
+0788;THAANA LETTER VAAVU;Lo;0;AL;;;;;N;;;;;
+0789;THAANA LETTER MEEMU;Lo;0;AL;;;;;N;;;;;
+078A;THAANA LETTER FAAFU;Lo;0;AL;;;;;N;;;;;
+078B;THAANA LETTER DHAALU;Lo;0;AL;;;;;N;;;;;
+078C;THAANA LETTER THAA;Lo;0;AL;;;;;N;;;;;
+078D;THAANA LETTER LAAMU;Lo;0;AL;;;;;N;;;;;
+078E;THAANA LETTER GAAFU;Lo;0;AL;;;;;N;;;;;
+078F;THAANA LETTER GNAVIYANI;Lo;0;AL;;;;;N;;;;;
+0790;THAANA LETTER SEENU;Lo;0;AL;;;;;N;;;;;
+0791;THAANA LETTER DAVIYANI;Lo;0;AL;;;;;N;;;;;
+0792;THAANA LETTER ZAVIYANI;Lo;0;AL;;;;;N;;;;;
+0793;THAANA LETTER TAVIYANI;Lo;0;AL;;;;;N;;;;;
+0794;THAANA LETTER YAA;Lo;0;AL;;;;;N;;;;;
+0795;THAANA LETTER PAVIYANI;Lo;0;AL;;;;;N;;;;;
+0796;THAANA LETTER JAVIYANI;Lo;0;AL;;;;;N;;;;;
+0797;THAANA LETTER CHAVIYANI;Lo;0;AL;;;;;N;;;;;
+0798;THAANA LETTER TTAA;Lo;0;AL;;;;;N;;;;;
+0799;THAANA LETTER HHAA;Lo;0;AL;;;;;N;;;;;
+079A;THAANA LETTER KHAA;Lo;0;AL;;;;;N;;;;;
+079B;THAANA LETTER THAALU;Lo;0;AL;;;;;N;;;;;
+079C;THAANA LETTER ZAA;Lo;0;AL;;;;;N;;;;;
+079D;THAANA LETTER SHEENU;Lo;0;AL;;;;;N;;;;;
+079E;THAANA LETTER SAADHU;Lo;0;AL;;;;;N;;;;;
+079F;THAANA LETTER DAADHU;Lo;0;AL;;;;;N;;;;;
+07A0;THAANA LETTER TO;Lo;0;AL;;;;;N;;;;;
+07A1;THAANA LETTER ZO;Lo;0;AL;;;;;N;;;;;
+07A2;THAANA LETTER AINU;Lo;0;AL;;;;;N;;;;;
+07A3;THAANA LETTER GHAINU;Lo;0;AL;;;;;N;;;;;
+07A4;THAANA LETTER QAAFU;Lo;0;AL;;;;;N;;;;;
+07A5;THAANA LETTER WAAVU;Lo;0;AL;;;;;N;;;;;
+07A6;THAANA ABAFILI;Mn;0;NSM;;;;;N;;;;;
+07A7;THAANA AABAAFILI;Mn;0;NSM;;;;;N;;;;;
+07A8;THAANA IBIFILI;Mn;0;NSM;;;;;N;;;;;
+07A9;THAANA EEBEEFILI;Mn;0;NSM;;;;;N;;;;;
+07AA;THAANA UBUFILI;Mn;0;NSM;;;;;N;;;;;
+07AB;THAANA OOBOOFILI;Mn;0;NSM;;;;;N;;;;;
+07AC;THAANA EBEFILI;Mn;0;NSM;;;;;N;;;;;
+07AD;THAANA EYBEYFILI;Mn;0;NSM;;;;;N;;;;;
+07AE;THAANA OBOFILI;Mn;0;NSM;;;;;N;;;;;
+07AF;THAANA OABOAFILI;Mn;0;NSM;;;;;N;;;;;
+07B0;THAANA SUKUN;Mn;0;NSM;;;;;N;;;;;
+07B1;THAANA LETTER NAA;Lo;0;AL;;;;;N;;;;;
+07C0;NKO DIGIT ZERO;Nd;0;R;;0;0;0;N;;;;;
+07C1;NKO DIGIT ONE;Nd;0;R;;1;1;1;N;;;;;
+07C2;NKO DIGIT TWO;Nd;0;R;;2;2;2;N;;;;;
+07C3;NKO DIGIT THREE;Nd;0;R;;3;3;3;N;;;;;
+07C4;NKO DIGIT FOUR;Nd;0;R;;4;4;4;N;;;;;
+07C5;NKO DIGIT FIVE;Nd;0;R;;5;5;5;N;;;;;
+07C6;NKO DIGIT SIX;Nd;0;R;;6;6;6;N;;;;;
+07C7;NKO DIGIT SEVEN;Nd;0;R;;7;7;7;N;;;;;
+07C8;NKO DIGIT EIGHT;Nd;0;R;;8;8;8;N;;;;;
+07C9;NKO DIGIT NINE;Nd;0;R;;9;9;9;N;;;;;
+07CA;NKO LETTER A;Lo;0;R;;;;;N;;;;;
+07CB;NKO LETTER EE;Lo;0;R;;;;;N;;;;;
+07CC;NKO LETTER I;Lo;0;R;;;;;N;;;;;
+07CD;NKO LETTER E;Lo;0;R;;;;;N;;;;;
+07CE;NKO LETTER U;Lo;0;R;;;;;N;;;;;
+07CF;NKO LETTER OO;Lo;0;R;;;;;N;;;;;
+07D0;NKO LETTER O;Lo;0;R;;;;;N;;;;;
+07D1;NKO LETTER DAGBASINNA;Lo;0;R;;;;;N;;;;;
+07D2;NKO LETTER N;Lo;0;R;;;;;N;;;;;
+07D3;NKO LETTER BA;Lo;0;R;;;;;N;;;;;
+07D4;NKO LETTER PA;Lo;0;R;;;;;N;;;;;
+07D5;NKO LETTER TA;Lo;0;R;;;;;N;;;;;
+07D6;NKO LETTER JA;Lo;0;R;;;;;N;;;;;
+07D7;NKO LETTER CHA;Lo;0;R;;;;;N;;;;;
+07D8;NKO LETTER DA;Lo;0;R;;;;;N;;;;;
+07D9;NKO LETTER RA;Lo;0;R;;;;;N;;;;;
+07DA;NKO LETTER RRA;Lo;0;R;;;;;N;;;;;
+07DB;NKO LETTER SA;Lo;0;R;;;;;N;;;;;
+07DC;NKO LETTER GBA;Lo;0;R;;;;;N;;;;;
+07DD;NKO LETTER FA;Lo;0;R;;;;;N;;;;;
+07DE;NKO LETTER KA;Lo;0;R;;;;;N;;;;;
+07DF;NKO LETTER LA;Lo;0;R;;;;;N;;;;;
+07E0;NKO LETTER NA WOLOSO;Lo;0;R;;;;;N;;;;;
+07E1;NKO LETTER MA;Lo;0;R;;;;;N;;;;;
+07E2;NKO LETTER NYA;Lo;0;R;;;;;N;;;;;
+07E3;NKO LETTER NA;Lo;0;R;;;;;N;;;;;
+07E4;NKO LETTER HA;Lo;0;R;;;;;N;;;;;
+07E5;NKO LETTER WA;Lo;0;R;;;;;N;;;;;
+07E6;NKO LETTER YA;Lo;0;R;;;;;N;;;;;
+07E7;NKO LETTER NYA WOLOSO;Lo;0;R;;;;;N;;;;;
+07E8;NKO LETTER JONA JA;Lo;0;R;;;;;N;;;;;
+07E9;NKO LETTER JONA CHA;Lo;0;R;;;;;N;;;;;
+07EA;NKO LETTER JONA RA;Lo;0;R;;;;;N;;;;;
+07EB;NKO COMBINING SHORT HIGH TONE;Mn;230;NSM;;;;;N;;;;;
+07EC;NKO COMBINING SHORT LOW TONE;Mn;230;NSM;;;;;N;;;;;
+07ED;NKO COMBINING SHORT RISING TONE;Mn;230;NSM;;;;;N;;;;;
+07EE;NKO COMBINING LONG DESCENDING TONE;Mn;230;NSM;;;;;N;;;;;
+07EF;NKO COMBINING LONG HIGH TONE;Mn;230;NSM;;;;;N;;;;;
+07F0;NKO COMBINING LONG LOW TONE;Mn;230;NSM;;;;;N;;;;;
+07F1;NKO COMBINING LONG RISING TONE;Mn;230;NSM;;;;;N;;;;;
+07F2;NKO COMBINING NASALIZATION MARK;Mn;220;NSM;;;;;N;;;;;
+07F3;NKO COMBINING DOUBLE DOT ABOVE;Mn;230;NSM;;;;;N;;;;;
+07F4;NKO HIGH TONE APOSTROPHE;Lm;0;R;;;;;N;;;;;
+07F5;NKO LOW TONE APOSTROPHE;Lm;0;R;;;;;N;;;;;
+07F6;NKO SYMBOL OO DENNEN;So;0;ON;;;;;N;;;;;
+07F7;NKO SYMBOL GBAKURUNEN;Po;0;ON;;;;;N;;;;;
+07F8;NKO COMMA;Po;0;ON;;;;;N;;;;;
+07F9;NKO EXCLAMATION MARK;Po;0;ON;;;;;N;;;;;
+07FA;NKO LAJANYALAN;Lm;0;R;;;;;N;;;;;
+0901;DEVANAGARI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
+0902;DEVANAGARI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+0903;DEVANAGARI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0904;DEVANAGARI LETTER SHORT A;Lo;0;L;;;;;N;;;;;
+0905;DEVANAGARI LETTER A;Lo;0;L;;;;;N;;;;;
+0906;DEVANAGARI LETTER AA;Lo;0;L;;;;;N;;;;;
+0907;DEVANAGARI LETTER I;Lo;0;L;;;;;N;;;;;
+0908;DEVANAGARI LETTER II;Lo;0;L;;;;;N;;;;;
+0909;DEVANAGARI LETTER U;Lo;0;L;;;;;N;;;;;
+090A;DEVANAGARI LETTER UU;Lo;0;L;;;;;N;;;;;
+090B;DEVANAGARI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+090C;DEVANAGARI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+090D;DEVANAGARI LETTER CANDRA E;Lo;0;L;;;;;N;;;;;
+090E;DEVANAGARI LETTER SHORT E;Lo;0;L;;;;;N;;;;;
+090F;DEVANAGARI LETTER E;Lo;0;L;;;;;N;;;;;
+0910;DEVANAGARI LETTER AI;Lo;0;L;;;;;N;;;;;
+0911;DEVANAGARI LETTER CANDRA O;Lo;0;L;;;;;N;;;;;
+0912;DEVANAGARI LETTER SHORT O;Lo;0;L;;;;;N;;;;;
+0913;DEVANAGARI LETTER O;Lo;0;L;;;;;N;;;;;
+0914;DEVANAGARI LETTER AU;Lo;0;L;;;;;N;;;;;
+0915;DEVANAGARI LETTER KA;Lo;0;L;;;;;N;;;;;
+0916;DEVANAGARI LETTER KHA;Lo;0;L;;;;;N;;;;;
+0917;DEVANAGARI LETTER GA;Lo;0;L;;;;;N;;;;;
+0918;DEVANAGARI LETTER GHA;Lo;0;L;;;;;N;;;;;
+0919;DEVANAGARI LETTER NGA;Lo;0;L;;;;;N;;;;;
+091A;DEVANAGARI LETTER CA;Lo;0;L;;;;;N;;;;;
+091B;DEVANAGARI LETTER CHA;Lo;0;L;;;;;N;;;;;
+091C;DEVANAGARI LETTER JA;Lo;0;L;;;;;N;;;;;
+091D;DEVANAGARI LETTER JHA;Lo;0;L;;;;;N;;;;;
+091E;DEVANAGARI LETTER NYA;Lo;0;L;;;;;N;;;;;
+091F;DEVANAGARI LETTER TTA;Lo;0;L;;;;;N;;;;;
+0920;DEVANAGARI LETTER TTHA;Lo;0;L;;;;;N;;;;;
+0921;DEVANAGARI LETTER DDA;Lo;0;L;;;;;N;;;;;
+0922;DEVANAGARI LETTER DDHA;Lo;0;L;;;;;N;;;;;
+0923;DEVANAGARI LETTER NNA;Lo;0;L;;;;;N;;;;;
+0924;DEVANAGARI LETTER TA;Lo;0;L;;;;;N;;;;;
+0925;DEVANAGARI LETTER THA;Lo;0;L;;;;;N;;;;;
+0926;DEVANAGARI LETTER DA;Lo;0;L;;;;;N;;;;;
+0927;DEVANAGARI LETTER DHA;Lo;0;L;;;;;N;;;;;
+0928;DEVANAGARI LETTER NA;Lo;0;L;;;;;N;;;;;
+0929;DEVANAGARI LETTER NNNA;Lo;0;L;0928 093C;;;;N;;;;;
+092A;DEVANAGARI LETTER PA;Lo;0;L;;;;;N;;;;;
+092B;DEVANAGARI LETTER PHA;Lo;0;L;;;;;N;;;;;
+092C;DEVANAGARI LETTER BA;Lo;0;L;;;;;N;;;;;
+092D;DEVANAGARI LETTER BHA;Lo;0;L;;;;;N;;;;;
+092E;DEVANAGARI LETTER MA;Lo;0;L;;;;;N;;;;;
+092F;DEVANAGARI LETTER YA;Lo;0;L;;;;;N;;;;;
+0930;DEVANAGARI LETTER RA;Lo;0;L;;;;;N;;;;;
+0931;DEVANAGARI LETTER RRA;Lo;0;L;0930 093C;;;;N;;;;;
+0932;DEVANAGARI LETTER LA;Lo;0;L;;;;;N;;;;;
+0933;DEVANAGARI LETTER LLA;Lo;0;L;;;;;N;;;;;
+0934;DEVANAGARI LETTER LLLA;Lo;0;L;0933 093C;;;;N;;;;;
+0935;DEVANAGARI LETTER VA;Lo;0;L;;;;;N;;;;;
+0936;DEVANAGARI LETTER SHA;Lo;0;L;;;;;N;;;;;
+0937;DEVANAGARI LETTER SSA;Lo;0;L;;;;;N;;;;;
+0938;DEVANAGARI LETTER SA;Lo;0;L;;;;;N;;;;;
+0939;DEVANAGARI LETTER HA;Lo;0;L;;;;;N;;;;;
+093C;DEVANAGARI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+093D;DEVANAGARI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
+093E;DEVANAGARI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+093F;DEVANAGARI VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+0940;DEVANAGARI VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+0941;DEVANAGARI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+0942;DEVANAGARI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+0943;DEVANAGARI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+0944;DEVANAGARI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;;
+0945;DEVANAGARI VOWEL SIGN CANDRA E;Mn;0;NSM;;;;;N;;;;;
+0946;DEVANAGARI VOWEL SIGN SHORT E;Mn;0;NSM;;;;;N;;;;;
+0947;DEVANAGARI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+0948;DEVANAGARI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+0949;DEVANAGARI VOWEL SIGN CANDRA O;Mc;0;L;;;;;N;;;;;
+094A;DEVANAGARI VOWEL SIGN SHORT O;Mc;0;L;;;;;N;;;;;
+094B;DEVANAGARI VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
+094C;DEVANAGARI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+094D;DEVANAGARI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0950;DEVANAGARI OM;Lo;0;L;;;;;N;;;;;
+0951;DEVANAGARI STRESS SIGN UDATTA;Mn;230;NSM;;;;;N;;;;;
+0952;DEVANAGARI STRESS SIGN ANUDATTA;Mn;220;NSM;;;;;N;;;;;
+0953;DEVANAGARI GRAVE ACCENT;Mn;230;NSM;;;;;N;;;;;
+0954;DEVANAGARI ACUTE ACCENT;Mn;230;NSM;;;;;N;;;;;
+0958;DEVANAGARI LETTER QA;Lo;0;L;0915 093C;;;;N;;;;;
+0959;DEVANAGARI LETTER KHHA;Lo;0;L;0916 093C;;;;N;;;;;
+095A;DEVANAGARI LETTER GHHA;Lo;0;L;0917 093C;;;;N;;;;;
+095B;DEVANAGARI LETTER ZA;Lo;0;L;091C 093C;;;;N;;;;;
+095C;DEVANAGARI LETTER DDDHA;Lo;0;L;0921 093C;;;;N;;;;;
+095D;DEVANAGARI LETTER RHA;Lo;0;L;0922 093C;;;;N;;;;;
+095E;DEVANAGARI LETTER FA;Lo;0;L;092B 093C;;;;N;;;;;
+095F;DEVANAGARI LETTER YYA;Lo;0;L;092F 093C;;;;N;;;;;
+0960;DEVANAGARI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+0961;DEVANAGARI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+0962;DEVANAGARI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;;
+0963;DEVANAGARI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;;
+0964;DEVANAGARI DANDA;Po;0;L;;;;;N;;;;;
+0965;DEVANAGARI DOUBLE DANDA;Po;0;L;;;;;N;;;;;
+0966;DEVANAGARI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0967;DEVANAGARI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0968;DEVANAGARI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0969;DEVANAGARI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+096A;DEVANAGARI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+096B;DEVANAGARI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+096C;DEVANAGARI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+096D;DEVANAGARI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+096E;DEVANAGARI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+096F;DEVANAGARI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0970;DEVANAGARI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;;
+097B;DEVANAGARI LETTER GGA;Lo;0;L;;;;;N;;;;;
+097C;DEVANAGARI LETTER JJA;Lo;0;L;;;;;N;;;;;
+097D;DEVANAGARI LETTER GLOTTAL STOP;Lo;0;L;;;;;N;;;;;
+097E;DEVANAGARI LETTER DDDA;Lo;0;L;;;;;N;;;;;
+097F;DEVANAGARI LETTER BBA;Lo;0;L;;;;;N;;;;;
+0981;BENGALI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
+0982;BENGALI SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
+0983;BENGALI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0985;BENGALI LETTER A;Lo;0;L;;;;;N;;;;;
+0986;BENGALI LETTER AA;Lo;0;L;;;;;N;;;;;
+0987;BENGALI LETTER I;Lo;0;L;;;;;N;;;;;
+0988;BENGALI LETTER II;Lo;0;L;;;;;N;;;;;
+0989;BENGALI LETTER U;Lo;0;L;;;;;N;;;;;
+098A;BENGALI LETTER UU;Lo;0;L;;;;;N;;;;;
+098B;BENGALI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+098C;BENGALI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+098F;BENGALI LETTER E;Lo;0;L;;;;;N;;;;;
+0990;BENGALI LETTER AI;Lo;0;L;;;;;N;;;;;
+0993;BENGALI LETTER O;Lo;0;L;;;;;N;;;;;
+0994;BENGALI LETTER AU;Lo;0;L;;;;;N;;;;;
+0995;BENGALI LETTER KA;Lo;0;L;;;;;N;;;;;
+0996;BENGALI LETTER KHA;Lo;0;L;;;;;N;;;;;
+0997;BENGALI LETTER GA;Lo;0;L;;;;;N;;;;;
+0998;BENGALI LETTER GHA;Lo;0;L;;;;;N;;;;;
+0999;BENGALI LETTER NGA;Lo;0;L;;;;;N;;;;;
+099A;BENGALI LETTER CA;Lo;0;L;;;;;N;;;;;
+099B;BENGALI LETTER CHA;Lo;0;L;;;;;N;;;;;
+099C;BENGALI LETTER JA;Lo;0;L;;;;;N;;;;;
+099D;BENGALI LETTER JHA;Lo;0;L;;;;;N;;;;;
+099E;BENGALI LETTER NYA;Lo;0;L;;;;;N;;;;;
+099F;BENGALI LETTER TTA;Lo;0;L;;;;;N;;;;;
+09A0;BENGALI LETTER TTHA;Lo;0;L;;;;;N;;;;;
+09A1;BENGALI LETTER DDA;Lo;0;L;;;;;N;;;;;
+09A2;BENGALI LETTER DDHA;Lo;0;L;;;;;N;;;;;
+09A3;BENGALI LETTER NNA;Lo;0;L;;;;;N;;;;;
+09A4;BENGALI LETTER TA;Lo;0;L;;;;;N;;;;;
+09A5;BENGALI LETTER THA;Lo;0;L;;;;;N;;;;;
+09A6;BENGALI LETTER DA;Lo;0;L;;;;;N;;;;;
+09A7;BENGALI LETTER DHA;Lo;0;L;;;;;N;;;;;
+09A8;BENGALI LETTER NA;Lo;0;L;;;;;N;;;;;
+09AA;BENGALI LETTER PA;Lo;0;L;;;;;N;;;;;
+09AB;BENGALI LETTER PHA;Lo;0;L;;;;;N;;;;;
+09AC;BENGALI LETTER BA;Lo;0;L;;;;;N;;;;;
+09AD;BENGALI LETTER BHA;Lo;0;L;;;;;N;;;;;
+09AE;BENGALI LETTER MA;Lo;0;L;;;;;N;;;;;
+09AF;BENGALI LETTER YA;Lo;0;L;;;;;N;;;;;
+09B0;BENGALI LETTER RA;Lo;0;L;;;;;N;;;;;
+09B2;BENGALI LETTER LA;Lo;0;L;;;;;N;;;;;
+09B6;BENGALI LETTER SHA;Lo;0;L;;;;;N;;;;;
+09B7;BENGALI LETTER SSA;Lo;0;L;;;;;N;;;;;
+09B8;BENGALI LETTER SA;Lo;0;L;;;;;N;;;;;
+09B9;BENGALI LETTER HA;Lo;0;L;;;;;N;;;;;
+09BC;BENGALI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+09BD;BENGALI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
+09BE;BENGALI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+09BF;BENGALI VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+09C0;BENGALI VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+09C1;BENGALI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+09C2;BENGALI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+09C3;BENGALI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+09C4;BENGALI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;;
+09C7;BENGALI VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+09C8;BENGALI VOWEL SIGN AI;Mc;0;L;;;;;N;;;;;
+09CB;BENGALI VOWEL SIGN O;Mc;0;L;09C7 09BE;;;;N;;;;;
+09CC;BENGALI VOWEL SIGN AU;Mc;0;L;09C7 09D7;;;;N;;;;;
+09CD;BENGALI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+09CE;BENGALI LETTER KHANDA TA;Lo;0;L;;;;;N;;;;;
+09D7;BENGALI AU LENGTH MARK;Mc;0;L;;;;;N;;;;;
+09DC;BENGALI LETTER RRA;Lo;0;L;09A1 09BC;;;;N;;;;;
+09DD;BENGALI LETTER RHA;Lo;0;L;09A2 09BC;;;;N;;;;;
+09DF;BENGALI LETTER YYA;Lo;0;L;09AF 09BC;;;;N;;;;;
+09E0;BENGALI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+09E1;BENGALI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+09E2;BENGALI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;;
+09E3;BENGALI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;;
+09E6;BENGALI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+09E7;BENGALI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+09E8;BENGALI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+09E9;BENGALI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+09EA;BENGALI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+09EB;BENGALI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+09EC;BENGALI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+09ED;BENGALI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+09EE;BENGALI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+09EF;BENGALI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+09F0;BENGALI LETTER RA WITH MIDDLE DIAGONAL;Lo;0;L;;;;;N;;Assamese;;;
+09F1;BENGALI LETTER RA WITH LOWER DIAGONAL;Lo;0;L;;;;;N;BENGALI LETTER VA WITH LOWER DIAGONAL;Assamese;;;
+09F2;BENGALI RUPEE MARK;Sc;0;ET;;;;;N;;;;;
+09F3;BENGALI RUPEE SIGN;Sc;0;ET;;;;;N;;;;;
+09F4;BENGALI CURRENCY NUMERATOR ONE;No;0;L;;;;1;N;;;;;
+09F5;BENGALI CURRENCY NUMERATOR TWO;No;0;L;;;;2;N;;;;;
+09F6;BENGALI CURRENCY NUMERATOR THREE;No;0;L;;;;3;N;;;;;
+09F7;BENGALI CURRENCY NUMERATOR FOUR;No;0;L;;;;4;N;;;;;
+09F8;BENGALI CURRENCY NUMERATOR ONE LESS THAN THE DENOMINATOR;No;0;L;;;;;N;;;;;
+09F9;BENGALI CURRENCY DENOMINATOR SIXTEEN;No;0;L;;;;16;N;;;;;
+09FA;BENGALI ISSHAR;So;0;L;;;;;N;;;;;
+0A01;GURMUKHI SIGN ADAK BINDI;Mn;0;NSM;;;;;N;;;;;
+0A02;GURMUKHI SIGN BINDI;Mn;0;NSM;;;;;N;;;;;
+0A03;GURMUKHI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0A05;GURMUKHI LETTER A;Lo;0;L;;;;;N;;;;;
+0A06;GURMUKHI LETTER AA;Lo;0;L;;;;;N;;;;;
+0A07;GURMUKHI LETTER I;Lo;0;L;;;;;N;;;;;
+0A08;GURMUKHI LETTER II;Lo;0;L;;;;;N;;;;;
+0A09;GURMUKHI LETTER U;Lo;0;L;;;;;N;;;;;
+0A0A;GURMUKHI LETTER UU;Lo;0;L;;;;;N;;;;;
+0A0F;GURMUKHI LETTER EE;Lo;0;L;;;;;N;;;;;
+0A10;GURMUKHI LETTER AI;Lo;0;L;;;;;N;;;;;
+0A13;GURMUKHI LETTER OO;Lo;0;L;;;;;N;;;;;
+0A14;GURMUKHI LETTER AU;Lo;0;L;;;;;N;;;;;
+0A15;GURMUKHI LETTER KA;Lo;0;L;;;;;N;;;;;
+0A16;GURMUKHI LETTER KHA;Lo;0;L;;;;;N;;;;;
+0A17;GURMUKHI LETTER GA;Lo;0;L;;;;;N;;;;;
+0A18;GURMUKHI LETTER GHA;Lo;0;L;;;;;N;;;;;
+0A19;GURMUKHI LETTER NGA;Lo;0;L;;;;;N;;;;;
+0A1A;GURMUKHI LETTER CA;Lo;0;L;;;;;N;;;;;
+0A1B;GURMUKHI LETTER CHA;Lo;0;L;;;;;N;;;;;
+0A1C;GURMUKHI LETTER JA;Lo;0;L;;;;;N;;;;;
+0A1D;GURMUKHI LETTER JHA;Lo;0;L;;;;;N;;;;;
+0A1E;GURMUKHI LETTER NYA;Lo;0;L;;;;;N;;;;;
+0A1F;GURMUKHI LETTER TTA;Lo;0;L;;;;;N;;;;;
+0A20;GURMUKHI LETTER TTHA;Lo;0;L;;;;;N;;;;;
+0A21;GURMUKHI LETTER DDA;Lo;0;L;;;;;N;;;;;
+0A22;GURMUKHI LETTER DDHA;Lo;0;L;;;;;N;;;;;
+0A23;GURMUKHI LETTER NNA;Lo;0;L;;;;;N;;;;;
+0A24;GURMUKHI LETTER TA;Lo;0;L;;;;;N;;;;;
+0A25;GURMUKHI LETTER THA;Lo;0;L;;;;;N;;;;;
+0A26;GURMUKHI LETTER DA;Lo;0;L;;;;;N;;;;;
+0A27;GURMUKHI LETTER DHA;Lo;0;L;;;;;N;;;;;
+0A28;GURMUKHI LETTER NA;Lo;0;L;;;;;N;;;;;
+0A2A;GURMUKHI LETTER PA;Lo;0;L;;;;;N;;;;;
+0A2B;GURMUKHI LETTER PHA;Lo;0;L;;;;;N;;;;;
+0A2C;GURMUKHI LETTER BA;Lo;0;L;;;;;N;;;;;
+0A2D;GURMUKHI LETTER BHA;Lo;0;L;;;;;N;;;;;
+0A2E;GURMUKHI LETTER MA;Lo;0;L;;;;;N;;;;;
+0A2F;GURMUKHI LETTER YA;Lo;0;L;;;;;N;;;;;
+0A30;GURMUKHI LETTER RA;Lo;0;L;;;;;N;;;;;
+0A32;GURMUKHI LETTER LA;Lo;0;L;;;;;N;;;;;
+0A33;GURMUKHI LETTER LLA;Lo;0;L;0A32 0A3C;;;;N;;;;;
+0A35;GURMUKHI LETTER VA;Lo;0;L;;;;;N;;;;;
+0A36;GURMUKHI LETTER SHA;Lo;0;L;0A38 0A3C;;;;N;;;;;
+0A38;GURMUKHI LETTER SA;Lo;0;L;;;;;N;;;;;
+0A39;GURMUKHI LETTER HA;Lo;0;L;;;;;N;;;;;
+0A3C;GURMUKHI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+0A3E;GURMUKHI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+0A3F;GURMUKHI VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+0A40;GURMUKHI VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+0A41;GURMUKHI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+0A42;GURMUKHI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+0A47;GURMUKHI VOWEL SIGN EE;Mn;0;NSM;;;;;N;;;;;
+0A48;GURMUKHI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+0A4B;GURMUKHI VOWEL SIGN OO;Mn;0;NSM;;;;;N;;;;;
+0A4C;GURMUKHI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;;
+0A4D;GURMUKHI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0A59;GURMUKHI LETTER KHHA;Lo;0;L;0A16 0A3C;;;;N;;;;;
+0A5A;GURMUKHI LETTER GHHA;Lo;0;L;0A17 0A3C;;;;N;;;;;
+0A5B;GURMUKHI LETTER ZA;Lo;0;L;0A1C 0A3C;;;;N;;;;;
+0A5C;GURMUKHI LETTER RRA;Lo;0;L;;;;;N;;;;;
+0A5E;GURMUKHI LETTER FA;Lo;0;L;0A2B 0A3C;;;;N;;;;;
+0A66;GURMUKHI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0A67;GURMUKHI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0A68;GURMUKHI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0A69;GURMUKHI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0A6A;GURMUKHI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0A6B;GURMUKHI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0A6C;GURMUKHI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0A6D;GURMUKHI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0A6E;GURMUKHI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0A6F;GURMUKHI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0A70;GURMUKHI TIPPI;Mn;0;NSM;;;;;N;;;;;
+0A71;GURMUKHI ADDAK;Mn;0;NSM;;;;;N;;;;;
+0A72;GURMUKHI IRI;Lo;0;L;;;;;N;;;;;
+0A73;GURMUKHI URA;Lo;0;L;;;;;N;;;;;
+0A74;GURMUKHI EK ONKAR;Lo;0;L;;;;;N;;;;;
+0A81;GUJARATI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
+0A82;GUJARATI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+0A83;GUJARATI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0A85;GUJARATI LETTER A;Lo;0;L;;;;;N;;;;;
+0A86;GUJARATI LETTER AA;Lo;0;L;;;;;N;;;;;
+0A87;GUJARATI LETTER I;Lo;0;L;;;;;N;;;;;
+0A88;GUJARATI LETTER II;Lo;0;L;;;;;N;;;;;
+0A89;GUJARATI LETTER U;Lo;0;L;;;;;N;;;;;
+0A8A;GUJARATI LETTER UU;Lo;0;L;;;;;N;;;;;
+0A8B;GUJARATI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+0A8C;GUJARATI LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+0A8D;GUJARATI VOWEL CANDRA E;Lo;0;L;;;;;N;;;;;
+0A8F;GUJARATI LETTER E;Lo;0;L;;;;;N;;;;;
+0A90;GUJARATI LETTER AI;Lo;0;L;;;;;N;;;;;
+0A91;GUJARATI VOWEL CANDRA O;Lo;0;L;;;;;N;;;;;
+0A93;GUJARATI LETTER O;Lo;0;L;;;;;N;;;;;
+0A94;GUJARATI LETTER AU;Lo;0;L;;;;;N;;;;;
+0A95;GUJARATI LETTER KA;Lo;0;L;;;;;N;;;;;
+0A96;GUJARATI LETTER KHA;Lo;0;L;;;;;N;;;;;
+0A97;GUJARATI LETTER GA;Lo;0;L;;;;;N;;;;;
+0A98;GUJARATI LETTER GHA;Lo;0;L;;;;;N;;;;;
+0A99;GUJARATI LETTER NGA;Lo;0;L;;;;;N;;;;;
+0A9A;GUJARATI LETTER CA;Lo;0;L;;;;;N;;;;;
+0A9B;GUJARATI LETTER CHA;Lo;0;L;;;;;N;;;;;
+0A9C;GUJARATI LETTER JA;Lo;0;L;;;;;N;;;;;
+0A9D;GUJARATI LETTER JHA;Lo;0;L;;;;;N;;;;;
+0A9E;GUJARATI LETTER NYA;Lo;0;L;;;;;N;;;;;
+0A9F;GUJARATI LETTER TTA;Lo;0;L;;;;;N;;;;;
+0AA0;GUJARATI LETTER TTHA;Lo;0;L;;;;;N;;;;;
+0AA1;GUJARATI LETTER DDA;Lo;0;L;;;;;N;;;;;
+0AA2;GUJARATI LETTER DDHA;Lo;0;L;;;;;N;;;;;
+0AA3;GUJARATI LETTER NNA;Lo;0;L;;;;;N;;;;;
+0AA4;GUJARATI LETTER TA;Lo;0;L;;;;;N;;;;;
+0AA5;GUJARATI LETTER THA;Lo;0;L;;;;;N;;;;;
+0AA6;GUJARATI LETTER DA;Lo;0;L;;;;;N;;;;;
+0AA7;GUJARATI LETTER DHA;Lo;0;L;;;;;N;;;;;
+0AA8;GUJARATI LETTER NA;Lo;0;L;;;;;N;;;;;
+0AAA;GUJARATI LETTER PA;Lo;0;L;;;;;N;;;;;
+0AAB;GUJARATI LETTER PHA;Lo;0;L;;;;;N;;;;;
+0AAC;GUJARATI LETTER BA;Lo;0;L;;;;;N;;;;;
+0AAD;GUJARATI LETTER BHA;Lo;0;L;;;;;N;;;;;
+0AAE;GUJARATI LETTER MA;Lo;0;L;;;;;N;;;;;
+0AAF;GUJARATI LETTER YA;Lo;0;L;;;;;N;;;;;
+0AB0;GUJARATI LETTER RA;Lo;0;L;;;;;N;;;;;
+0AB2;GUJARATI LETTER LA;Lo;0;L;;;;;N;;;;;
+0AB3;GUJARATI LETTER LLA;Lo;0;L;;;;;N;;;;;
+0AB5;GUJARATI LETTER VA;Lo;0;L;;;;;N;;;;;
+0AB6;GUJARATI LETTER SHA;Lo;0;L;;;;;N;;;;;
+0AB7;GUJARATI LETTER SSA;Lo;0;L;;;;;N;;;;;
+0AB8;GUJARATI LETTER SA;Lo;0;L;;;;;N;;;;;
+0AB9;GUJARATI LETTER HA;Lo;0;L;;;;;N;;;;;
+0ABC;GUJARATI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+0ABD;GUJARATI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
+0ABE;GUJARATI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+0ABF;GUJARATI VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+0AC0;GUJARATI VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+0AC1;GUJARATI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+0AC2;GUJARATI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+0AC3;GUJARATI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+0AC4;GUJARATI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;;
+0AC5;GUJARATI VOWEL SIGN CANDRA E;Mn;0;NSM;;;;;N;;;;;
+0AC7;GUJARATI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+0AC8;GUJARATI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+0AC9;GUJARATI VOWEL SIGN CANDRA O;Mc;0;L;;;;;N;;;;;
+0ACB;GUJARATI VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
+0ACC;GUJARATI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+0ACD;GUJARATI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0AD0;GUJARATI OM;Lo;0;L;;;;;N;;;;;
+0AE0;GUJARATI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+0AE1;GUJARATI LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+0AE2;GUJARATI VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;;
+0AE3;GUJARATI VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;;
+0AE6;GUJARATI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0AE7;GUJARATI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0AE8;GUJARATI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0AE9;GUJARATI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0AEA;GUJARATI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0AEB;GUJARATI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0AEC;GUJARATI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0AED;GUJARATI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0AEE;GUJARATI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0AEF;GUJARATI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0AF1;GUJARATI RUPEE SIGN;Sc;0;ET;;;;;N;;;;;
+0B01;ORIYA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
+0B02;ORIYA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
+0B03;ORIYA SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0B05;ORIYA LETTER A;Lo;0;L;;;;;N;;;;;
+0B06;ORIYA LETTER AA;Lo;0;L;;;;;N;;;;;
+0B07;ORIYA LETTER I;Lo;0;L;;;;;N;;;;;
+0B08;ORIYA LETTER II;Lo;0;L;;;;;N;;;;;
+0B09;ORIYA LETTER U;Lo;0;L;;;;;N;;;;;
+0B0A;ORIYA LETTER UU;Lo;0;L;;;;;N;;;;;
+0B0B;ORIYA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+0B0C;ORIYA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+0B0F;ORIYA LETTER E;Lo;0;L;;;;;N;;;;;
+0B10;ORIYA LETTER AI;Lo;0;L;;;;;N;;;;;
+0B13;ORIYA LETTER O;Lo;0;L;;;;;N;;;;;
+0B14;ORIYA LETTER AU;Lo;0;L;;;;;N;;;;;
+0B15;ORIYA LETTER KA;Lo;0;L;;;;;N;;;;;
+0B16;ORIYA LETTER KHA;Lo;0;L;;;;;N;;;;;
+0B17;ORIYA LETTER GA;Lo;0;L;;;;;N;;;;;
+0B18;ORIYA LETTER GHA;Lo;0;L;;;;;N;;;;;
+0B19;ORIYA LETTER NGA;Lo;0;L;;;;;N;;;;;
+0B1A;ORIYA LETTER CA;Lo;0;L;;;;;N;;;;;
+0B1B;ORIYA LETTER CHA;Lo;0;L;;;;;N;;;;;
+0B1C;ORIYA LETTER JA;Lo;0;L;;;;;N;;;;;
+0B1D;ORIYA LETTER JHA;Lo;0;L;;;;;N;;;;;
+0B1E;ORIYA LETTER NYA;Lo;0;L;;;;;N;;;;;
+0B1F;ORIYA LETTER TTA;Lo;0;L;;;;;N;;;;;
+0B20;ORIYA LETTER TTHA;Lo;0;L;;;;;N;;;;;
+0B21;ORIYA LETTER DDA;Lo;0;L;;;;;N;;;;;
+0B22;ORIYA LETTER DDHA;Lo;0;L;;;;;N;;;;;
+0B23;ORIYA LETTER NNA;Lo;0;L;;;;;N;;;;;
+0B24;ORIYA LETTER TA;Lo;0;L;;;;;N;;;;;
+0B25;ORIYA LETTER THA;Lo;0;L;;;;;N;;;;;
+0B26;ORIYA LETTER DA;Lo;0;L;;;;;N;;;;;
+0B27;ORIYA LETTER DHA;Lo;0;L;;;;;N;;;;;
+0B28;ORIYA LETTER NA;Lo;0;L;;;;;N;;;;;
+0B2A;ORIYA LETTER PA;Lo;0;L;;;;;N;;;;;
+0B2B;ORIYA LETTER PHA;Lo;0;L;;;;;N;;;;;
+0B2C;ORIYA LETTER BA;Lo;0;L;;;;;N;;;;;
+0B2D;ORIYA LETTER BHA;Lo;0;L;;;;;N;;;;;
+0B2E;ORIYA LETTER MA;Lo;0;L;;;;;N;;;;;
+0B2F;ORIYA LETTER YA;Lo;0;L;;;;;N;;;;;
+0B30;ORIYA LETTER RA;Lo;0;L;;;;;N;;;;;
+0B32;ORIYA LETTER LA;Lo;0;L;;;;;N;;;;;
+0B33;ORIYA LETTER LLA;Lo;0;L;;;;;N;;;;;
+0B35;ORIYA LETTER VA;Lo;0;L;;;;;N;;;;;
+0B36;ORIYA LETTER SHA;Lo;0;L;;;;;N;;;;;
+0B37;ORIYA LETTER SSA;Lo;0;L;;;;;N;;;;;
+0B38;ORIYA LETTER SA;Lo;0;L;;;;;N;;;;;
+0B39;ORIYA LETTER HA;Lo;0;L;;;;;N;;;;;
+0B3C;ORIYA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+0B3D;ORIYA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
+0B3E;ORIYA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+0B3F;ORIYA VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+0B40;ORIYA VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+0B41;ORIYA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+0B42;ORIYA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+0B43;ORIYA VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+0B47;ORIYA VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+0B48;ORIYA VOWEL SIGN AI;Mc;0;L;0B47 0B56;;;;N;;;;;
+0B4B;ORIYA VOWEL SIGN O;Mc;0;L;0B47 0B3E;;;;N;;;;;
+0B4C;ORIYA VOWEL SIGN AU;Mc;0;L;0B47 0B57;;;;N;;;;;
+0B4D;ORIYA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0B56;ORIYA AI LENGTH MARK;Mn;0;NSM;;;;;N;;;;;
+0B57;ORIYA AU LENGTH MARK;Mc;0;L;;;;;N;;;;;
+0B5C;ORIYA LETTER RRA;Lo;0;L;0B21 0B3C;;;;N;;;;;
+0B5D;ORIYA LETTER RHA;Lo;0;L;0B22 0B3C;;;;N;;;;;
+0B5F;ORIYA LETTER YYA;Lo;0;L;;;;;N;;;;;
+0B60;ORIYA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+0B61;ORIYA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+0B66;ORIYA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0B67;ORIYA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0B68;ORIYA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0B69;ORIYA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0B6A;ORIYA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0B6B;ORIYA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0B6C;ORIYA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0B6D;ORIYA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0B6E;ORIYA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0B6F;ORIYA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0B70;ORIYA ISSHAR;So;0;L;;;;;N;;;;;
+0B71;ORIYA LETTER WA;Lo;0;L;;;;;N;;;;;
+0B82;TAMIL SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+0B83;TAMIL SIGN VISARGA;Lo;0;L;;;;;N;;;;;
+0B85;TAMIL LETTER A;Lo;0;L;;;;;N;;;;;
+0B86;TAMIL LETTER AA;Lo;0;L;;;;;N;;;;;
+0B87;TAMIL LETTER I;Lo;0;L;;;;;N;;;;;
+0B88;TAMIL LETTER II;Lo;0;L;;;;;N;;;;;
+0B89;TAMIL LETTER U;Lo;0;L;;;;;N;;;;;
+0B8A;TAMIL LETTER UU;Lo;0;L;;;;;N;;;;;
+0B8E;TAMIL LETTER E;Lo;0;L;;;;;N;;;;;
+0B8F;TAMIL LETTER EE;Lo;0;L;;;;;N;;;;;
+0B90;TAMIL LETTER AI;Lo;0;L;;;;;N;;;;;
+0B92;TAMIL LETTER O;Lo;0;L;;;;;N;;;;;
+0B93;TAMIL LETTER OO;Lo;0;L;;;;;N;;;;;
+0B94;TAMIL LETTER AU;Lo;0;L;0B92 0BD7;;;;N;;;;;
+0B95;TAMIL LETTER KA;Lo;0;L;;;;;N;;;;;
+0B99;TAMIL LETTER NGA;Lo;0;L;;;;;N;;;;;
+0B9A;TAMIL LETTER CA;Lo;0;L;;;;;N;;;;;
+0B9C;TAMIL LETTER JA;Lo;0;L;;;;;N;;;;;
+0B9E;TAMIL LETTER NYA;Lo;0;L;;;;;N;;;;;
+0B9F;TAMIL LETTER TTA;Lo;0;L;;;;;N;;;;;
+0BA3;TAMIL LETTER NNA;Lo;0;L;;;;;N;;;;;
+0BA4;TAMIL LETTER TA;Lo;0;L;;;;;N;;;;;
+0BA8;TAMIL LETTER NA;Lo;0;L;;;;;N;;;;;
+0BA9;TAMIL LETTER NNNA;Lo;0;L;;;;;N;;;;;
+0BAA;TAMIL LETTER PA;Lo;0;L;;;;;N;;;;;
+0BAE;TAMIL LETTER MA;Lo;0;L;;;;;N;;;;;
+0BAF;TAMIL LETTER YA;Lo;0;L;;;;;N;;;;;
+0BB0;TAMIL LETTER RA;Lo;0;L;;;;;N;;;;;
+0BB1;TAMIL LETTER RRA;Lo;0;L;;;;;N;;;;;
+0BB2;TAMIL LETTER LA;Lo;0;L;;;;;N;;;;;
+0BB3;TAMIL LETTER LLA;Lo;0;L;;;;;N;;;;;
+0BB4;TAMIL LETTER LLLA;Lo;0;L;;;;;N;;;;;
+0BB5;TAMIL LETTER VA;Lo;0;L;;;;;N;;;;;
+0BB6;TAMIL LETTER SHA;Lo;0;L;;;;;N;;;;;
+0BB7;TAMIL LETTER SSA;Lo;0;L;;;;;N;;;;;
+0BB8;TAMIL LETTER SA;Lo;0;L;;;;;N;;;;;
+0BB9;TAMIL LETTER HA;Lo;0;L;;;;;N;;;;;
+0BBE;TAMIL VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+0BBF;TAMIL VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+0BC0;TAMIL VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
+0BC1;TAMIL VOWEL SIGN U;Mc;0;L;;;;;N;;;;;
+0BC2;TAMIL VOWEL SIGN UU;Mc;0;L;;;;;N;;;;;
+0BC6;TAMIL VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+0BC7;TAMIL VOWEL SIGN EE;Mc;0;L;;;;;N;;;;;
+0BC8;TAMIL VOWEL SIGN AI;Mc;0;L;;;;;N;;;;;
+0BCA;TAMIL VOWEL SIGN O;Mc;0;L;0BC6 0BBE;;;;N;;;;;
+0BCB;TAMIL VOWEL SIGN OO;Mc;0;L;0BC7 0BBE;;;;N;;;;;
+0BCC;TAMIL VOWEL SIGN AU;Mc;0;L;0BC6 0BD7;;;;N;;;;;
+0BCD;TAMIL SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0BD7;TAMIL AU LENGTH MARK;Mc;0;L;;;;;N;;;;;
+0BE6;TAMIL DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0BE7;TAMIL DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0BE8;TAMIL DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0BE9;TAMIL DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0BEA;TAMIL DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0BEB;TAMIL DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0BEC;TAMIL DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0BED;TAMIL DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0BEE;TAMIL DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0BEF;TAMIL DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0BF0;TAMIL NUMBER TEN;No;0;L;;;;10;N;;;;;
+0BF1;TAMIL NUMBER ONE HUNDRED;No;0;L;;;;100;N;;;;;
+0BF2;TAMIL NUMBER ONE THOUSAND;No;0;L;;;;1000;N;;;;;
+0BF3;TAMIL DAY SIGN;So;0;ON;;;;;N;;Naal;;;
+0BF4;TAMIL MONTH SIGN;So;0;ON;;;;;N;;Maatham;;;
+0BF5;TAMIL YEAR SIGN;So;0;ON;;;;;N;;Varudam;;;
+0BF6;TAMIL DEBIT SIGN;So;0;ON;;;;;N;;Patru;;;
+0BF7;TAMIL CREDIT SIGN;So;0;ON;;;;;N;;Varavu;;;
+0BF8;TAMIL AS ABOVE SIGN;So;0;ON;;;;;N;;Merpadi;;;
+0BF9;TAMIL RUPEE SIGN;Sc;0;ET;;;;;N;;Rupai;;;
+0BFA;TAMIL NUMBER SIGN;So;0;ON;;;;;N;;Enn;;;
+0C01;TELUGU SIGN CANDRABINDU;Mc;0;L;;;;;N;;;;;
+0C02;TELUGU SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
+0C03;TELUGU SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0C05;TELUGU LETTER A;Lo;0;L;;;;;N;;;;;
+0C06;TELUGU LETTER AA;Lo;0;L;;;;;N;;;;;
+0C07;TELUGU LETTER I;Lo;0;L;;;;;N;;;;;
+0C08;TELUGU LETTER II;Lo;0;L;;;;;N;;;;;
+0C09;TELUGU LETTER U;Lo;0;L;;;;;N;;;;;
+0C0A;TELUGU LETTER UU;Lo;0;L;;;;;N;;;;;
+0C0B;TELUGU LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+0C0C;TELUGU LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+0C0E;TELUGU LETTER E;Lo;0;L;;;;;N;;;;;
+0C0F;TELUGU LETTER EE;Lo;0;L;;;;;N;;;;;
+0C10;TELUGU LETTER AI;Lo;0;L;;;;;N;;;;;
+0C12;TELUGU LETTER O;Lo;0;L;;;;;N;;;;;
+0C13;TELUGU LETTER OO;Lo;0;L;;;;;N;;;;;
+0C14;TELUGU LETTER AU;Lo;0;L;;;;;N;;;;;
+0C15;TELUGU LETTER KA;Lo;0;L;;;;;N;;;;;
+0C16;TELUGU LETTER KHA;Lo;0;L;;;;;N;;;;;
+0C17;TELUGU LETTER GA;Lo;0;L;;;;;N;;;;;
+0C18;TELUGU LETTER GHA;Lo;0;L;;;;;N;;;;;
+0C19;TELUGU LETTER NGA;Lo;0;L;;;;;N;;;;;
+0C1A;TELUGU LETTER CA;Lo;0;L;;;;;N;;;;;
+0C1B;TELUGU LETTER CHA;Lo;0;L;;;;;N;;;;;
+0C1C;TELUGU LETTER JA;Lo;0;L;;;;;N;;;;;
+0C1D;TELUGU LETTER JHA;Lo;0;L;;;;;N;;;;;
+0C1E;TELUGU LETTER NYA;Lo;0;L;;;;;N;;;;;
+0C1F;TELUGU LETTER TTA;Lo;0;L;;;;;N;;;;;
+0C20;TELUGU LETTER TTHA;Lo;0;L;;;;;N;;;;;
+0C21;TELUGU LETTER DDA;Lo;0;L;;;;;N;;;;;
+0C22;TELUGU LETTER DDHA;Lo;0;L;;;;;N;;;;;
+0C23;TELUGU LETTER NNA;Lo;0;L;;;;;N;;;;;
+0C24;TELUGU LETTER TA;Lo;0;L;;;;;N;;;;;
+0C25;TELUGU LETTER THA;Lo;0;L;;;;;N;;;;;
+0C26;TELUGU LETTER DA;Lo;0;L;;;;;N;;;;;
+0C27;TELUGU LETTER DHA;Lo;0;L;;;;;N;;;;;
+0C28;TELUGU LETTER NA;Lo;0;L;;;;;N;;;;;
+0C2A;TELUGU LETTER PA;Lo;0;L;;;;;N;;;;;
+0C2B;TELUGU LETTER PHA;Lo;0;L;;;;;N;;;;;
+0C2C;TELUGU LETTER BA;Lo;0;L;;;;;N;;;;;
+0C2D;TELUGU LETTER BHA;Lo;0;L;;;;;N;;;;;
+0C2E;TELUGU LETTER MA;Lo;0;L;;;;;N;;;;;
+0C2F;TELUGU LETTER YA;Lo;0;L;;;;;N;;;;;
+0C30;TELUGU LETTER RA;Lo;0;L;;;;;N;;;;;
+0C31;TELUGU LETTER RRA;Lo;0;L;;;;;N;;;;;
+0C32;TELUGU LETTER LA;Lo;0;L;;;;;N;;;;;
+0C33;TELUGU LETTER LLA;Lo;0;L;;;;;N;;;;;
+0C35;TELUGU LETTER VA;Lo;0;L;;;;;N;;;;;
+0C36;TELUGU LETTER SHA;Lo;0;L;;;;;N;;;;;
+0C37;TELUGU LETTER SSA;Lo;0;L;;;;;N;;;;;
+0C38;TELUGU LETTER SA;Lo;0;L;;;;;N;;;;;
+0C39;TELUGU LETTER HA;Lo;0;L;;;;;N;;;;;
+0C3E;TELUGU VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;;
+0C3F;TELUGU VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+0C40;TELUGU VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
+0C41;TELUGU VOWEL SIGN U;Mc;0;L;;;;;N;;;;;
+0C42;TELUGU VOWEL SIGN UU;Mc;0;L;;;;;N;;;;;
+0C43;TELUGU VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;;
+0C44;TELUGU VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;;
+0C46;TELUGU VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+0C47;TELUGU VOWEL SIGN EE;Mn;0;NSM;;;;;N;;;;;
+0C48;TELUGU VOWEL SIGN AI;Mn;0;NSM;0C46 0C56;;;;N;;;;;
+0C4A;TELUGU VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;;
+0C4B;TELUGU VOWEL SIGN OO;Mn;0;NSM;;;;;N;;;;;
+0C4C;TELUGU VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;;
+0C4D;TELUGU SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0C55;TELUGU LENGTH MARK;Mn;84;NSM;;;;;N;;;;;
+0C56;TELUGU AI LENGTH MARK;Mn;91;NSM;;;;;N;;;;;
+0C60;TELUGU LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+0C61;TELUGU LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+0C66;TELUGU DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0C67;TELUGU DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0C68;TELUGU DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0C69;TELUGU DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0C6A;TELUGU DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0C6B;TELUGU DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0C6C;TELUGU DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0C6D;TELUGU DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0C6E;TELUGU DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0C6F;TELUGU DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0C82;KANNADA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
+0C83;KANNADA SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0C85;KANNADA LETTER A;Lo;0;L;;;;;N;;;;;
+0C86;KANNADA LETTER AA;Lo;0;L;;;;;N;;;;;
+0C87;KANNADA LETTER I;Lo;0;L;;;;;N;;;;;
+0C88;KANNADA LETTER II;Lo;0;L;;;;;N;;;;;
+0C89;KANNADA LETTER U;Lo;0;L;;;;;N;;;;;
+0C8A;KANNADA LETTER UU;Lo;0;L;;;;;N;;;;;
+0C8B;KANNADA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+0C8C;KANNADA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+0C8E;KANNADA LETTER E;Lo;0;L;;;;;N;;;;;
+0C8F;KANNADA LETTER EE;Lo;0;L;;;;;N;;;;;
+0C90;KANNADA LETTER AI;Lo;0;L;;;;;N;;;;;
+0C92;KANNADA LETTER O;Lo;0;L;;;;;N;;;;;
+0C93;KANNADA LETTER OO;Lo;0;L;;;;;N;;;;;
+0C94;KANNADA LETTER AU;Lo;0;L;;;;;N;;;;;
+0C95;KANNADA LETTER KA;Lo;0;L;;;;;N;;;;;
+0C96;KANNADA LETTER KHA;Lo;0;L;;;;;N;;;;;
+0C97;KANNADA LETTER GA;Lo;0;L;;;;;N;;;;;
+0C98;KANNADA LETTER GHA;Lo;0;L;;;;;N;;;;;
+0C99;KANNADA LETTER NGA;Lo;0;L;;;;;N;;;;;
+0C9A;KANNADA LETTER CA;Lo;0;L;;;;;N;;;;;
+0C9B;KANNADA LETTER CHA;Lo;0;L;;;;;N;;;;;
+0C9C;KANNADA LETTER JA;Lo;0;L;;;;;N;;;;;
+0C9D;KANNADA LETTER JHA;Lo;0;L;;;;;N;;;;;
+0C9E;KANNADA LETTER NYA;Lo;0;L;;;;;N;;;;;
+0C9F;KANNADA LETTER TTA;Lo;0;L;;;;;N;;;;;
+0CA0;KANNADA LETTER TTHA;Lo;0;L;;;;;N;;;;;
+0CA1;KANNADA LETTER DDA;Lo;0;L;;;;;N;;;;;
+0CA2;KANNADA LETTER DDHA;Lo;0;L;;;;;N;;;;;
+0CA3;KANNADA LETTER NNA;Lo;0;L;;;;;N;;;;;
+0CA4;KANNADA LETTER TA;Lo;0;L;;;;;N;;;;;
+0CA5;KANNADA LETTER THA;Lo;0;L;;;;;N;;;;;
+0CA6;KANNADA LETTER DA;Lo;0;L;;;;;N;;;;;
+0CA7;KANNADA LETTER DHA;Lo;0;L;;;;;N;;;;;
+0CA8;KANNADA LETTER NA;Lo;0;L;;;;;N;;;;;
+0CAA;KANNADA LETTER PA;Lo;0;L;;;;;N;;;;;
+0CAB;KANNADA LETTER PHA;Lo;0;L;;;;;N;;;;;
+0CAC;KANNADA LETTER BA;Lo;0;L;;;;;N;;;;;
+0CAD;KANNADA LETTER BHA;Lo;0;L;;;;;N;;;;;
+0CAE;KANNADA LETTER MA;Lo;0;L;;;;;N;;;;;
+0CAF;KANNADA LETTER YA;Lo;0;L;;;;;N;;;;;
+0CB0;KANNADA LETTER RA;Lo;0;L;;;;;N;;;;;
+0CB1;KANNADA LETTER RRA;Lo;0;L;;;;;N;;;;;
+0CB2;KANNADA LETTER LA;Lo;0;L;;;;;N;;;;;
+0CB3;KANNADA LETTER LLA;Lo;0;L;;;;;N;;;;;
+0CB5;KANNADA LETTER VA;Lo;0;L;;;;;N;;;;;
+0CB6;KANNADA LETTER SHA;Lo;0;L;;;;;N;;;;;
+0CB7;KANNADA LETTER SSA;Lo;0;L;;;;;N;;;;;
+0CB8;KANNADA LETTER SA;Lo;0;L;;;;;N;;;;;
+0CB9;KANNADA LETTER HA;Lo;0;L;;;;;N;;;;;
+0CBC;KANNADA SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+0CBD;KANNADA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
+0CBE;KANNADA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+0CBF;KANNADA VOWEL SIGN I;Mn;0;L;;;;;N;;;;;
+0CC0;KANNADA VOWEL SIGN II;Mc;0;L;0CBF 0CD5;;;;N;;;;;
+0CC1;KANNADA VOWEL SIGN U;Mc;0;L;;;;;N;;;;;
+0CC2;KANNADA VOWEL SIGN UU;Mc;0;L;;;;;N;;;;;
+0CC3;KANNADA VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;;
+0CC4;KANNADA VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;;
+0CC6;KANNADA VOWEL SIGN E;Mn;0;L;;;;;N;;;;;
+0CC7;KANNADA VOWEL SIGN EE;Mc;0;L;0CC6 0CD5;;;;N;;;;;
+0CC8;KANNADA VOWEL SIGN AI;Mc;0;L;0CC6 0CD6;;;;N;;;;;
+0CCA;KANNADA VOWEL SIGN O;Mc;0;L;0CC6 0CC2;;;;N;;;;;
+0CCB;KANNADA VOWEL SIGN OO;Mc;0;L;0CCA 0CD5;;;;N;;;;;
+0CCC;KANNADA VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;;
+0CCD;KANNADA SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0CD5;KANNADA LENGTH MARK;Mc;0;L;;;;;N;;;;;
+0CD6;KANNADA AI LENGTH MARK;Mc;0;L;;;;;N;;;;;
+0CDE;KANNADA LETTER FA;Lo;0;L;;;;;N;;;;;
+0CE0;KANNADA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+0CE1;KANNADA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+0CE2;KANNADA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;;
+0CE3;KANNADA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;;
+0CE6;KANNADA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0CE7;KANNADA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0CE8;KANNADA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0CE9;KANNADA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0CEA;KANNADA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0CEB;KANNADA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0CEC;KANNADA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0CED;KANNADA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0CEE;KANNADA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0CEF;KANNADA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0CF1;KANNADA SIGN JIHVAMULIYA;So;0;ON;;;;;N;;;;;
+0CF2;KANNADA SIGN UPADHMANIYA;So;0;ON;;;;;N;;;;;
+0D02;MALAYALAM SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
+0D03;MALAYALAM SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+0D05;MALAYALAM LETTER A;Lo;0;L;;;;;N;;;;;
+0D06;MALAYALAM LETTER AA;Lo;0;L;;;;;N;;;;;
+0D07;MALAYALAM LETTER I;Lo;0;L;;;;;N;;;;;
+0D08;MALAYALAM LETTER II;Lo;0;L;;;;;N;;;;;
+0D09;MALAYALAM LETTER U;Lo;0;L;;;;;N;;;;;
+0D0A;MALAYALAM LETTER UU;Lo;0;L;;;;;N;;;;;
+0D0B;MALAYALAM LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+0D0C;MALAYALAM LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+0D0E;MALAYALAM LETTER E;Lo;0;L;;;;;N;;;;;
+0D0F;MALAYALAM LETTER EE;Lo;0;L;;;;;N;;;;;
+0D10;MALAYALAM LETTER AI;Lo;0;L;;;;;N;;;;;
+0D12;MALAYALAM LETTER O;Lo;0;L;;;;;N;;;;;
+0D13;MALAYALAM LETTER OO;Lo;0;L;;;;;N;;;;;
+0D14;MALAYALAM LETTER AU;Lo;0;L;;;;;N;;;;;
+0D15;MALAYALAM LETTER KA;Lo;0;L;;;;;N;;;;;
+0D16;MALAYALAM LETTER KHA;Lo;0;L;;;;;N;;;;;
+0D17;MALAYALAM LETTER GA;Lo;0;L;;;;;N;;;;;
+0D18;MALAYALAM LETTER GHA;Lo;0;L;;;;;N;;;;;
+0D19;MALAYALAM LETTER NGA;Lo;0;L;;;;;N;;;;;
+0D1A;MALAYALAM LETTER CA;Lo;0;L;;;;;N;;;;;
+0D1B;MALAYALAM LETTER CHA;Lo;0;L;;;;;N;;;;;
+0D1C;MALAYALAM LETTER JA;Lo;0;L;;;;;N;;;;;
+0D1D;MALAYALAM LETTER JHA;Lo;0;L;;;;;N;;;;;
+0D1E;MALAYALAM LETTER NYA;Lo;0;L;;;;;N;;;;;
+0D1F;MALAYALAM LETTER TTA;Lo;0;L;;;;;N;;;;;
+0D20;MALAYALAM LETTER TTHA;Lo;0;L;;;;;N;;;;;
+0D21;MALAYALAM LETTER DDA;Lo;0;L;;;;;N;;;;;
+0D22;MALAYALAM LETTER DDHA;Lo;0;L;;;;;N;;;;;
+0D23;MALAYALAM LETTER NNA;Lo;0;L;;;;;N;;;;;
+0D24;MALAYALAM LETTER TA;Lo;0;L;;;;;N;;;;;
+0D25;MALAYALAM LETTER THA;Lo;0;L;;;;;N;;;;;
+0D26;MALAYALAM LETTER DA;Lo;0;L;;;;;N;;;;;
+0D27;MALAYALAM LETTER DHA;Lo;0;L;;;;;N;;;;;
+0D28;MALAYALAM LETTER NA;Lo;0;L;;;;;N;;;;;
+0D2A;MALAYALAM LETTER PA;Lo;0;L;;;;;N;;;;;
+0D2B;MALAYALAM LETTER PHA;Lo;0;L;;;;;N;;;;;
+0D2C;MALAYALAM LETTER BA;Lo;0;L;;;;;N;;;;;
+0D2D;MALAYALAM LETTER BHA;Lo;0;L;;;;;N;;;;;
+0D2E;MALAYALAM LETTER MA;Lo;0;L;;;;;N;;;;;
+0D2F;MALAYALAM LETTER YA;Lo;0;L;;;;;N;;;;;
+0D30;MALAYALAM LETTER RA;Lo;0;L;;;;;N;;;;;
+0D31;MALAYALAM LETTER RRA;Lo;0;L;;;;;N;;;;;
+0D32;MALAYALAM LETTER LA;Lo;0;L;;;;;N;;;;;
+0D33;MALAYALAM LETTER LLA;Lo;0;L;;;;;N;;;;;
+0D34;MALAYALAM LETTER LLLA;Lo;0;L;;;;;N;;;;;
+0D35;MALAYALAM LETTER VA;Lo;0;L;;;;;N;;;;;
+0D36;MALAYALAM LETTER SHA;Lo;0;L;;;;;N;;;;;
+0D37;MALAYALAM LETTER SSA;Lo;0;L;;;;;N;;;;;
+0D38;MALAYALAM LETTER SA;Lo;0;L;;;;;N;;;;;
+0D39;MALAYALAM LETTER HA;Lo;0;L;;;;;N;;;;;
+0D3E;MALAYALAM VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+0D3F;MALAYALAM VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+0D40;MALAYALAM VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+0D41;MALAYALAM VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+0D42;MALAYALAM VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+0D43;MALAYALAM VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+0D46;MALAYALAM VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+0D47;MALAYALAM VOWEL SIGN EE;Mc;0;L;;;;;N;;;;;
+0D48;MALAYALAM VOWEL SIGN AI;Mc;0;L;;;;;N;;;;;
+0D4A;MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
+0D4B;MALAYALAM VOWEL SIGN OO;Mc;0;L;0D47 0D3E;;;;N;;;;;
+0D4C;MALAYALAM VOWEL SIGN AU;Mc;0;L;0D46 0D57;;;;N;;;;;
+0D4D;MALAYALAM SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+0D57;MALAYALAM AU LENGTH MARK;Mc;0;L;;;;;N;;;;;
+0D60;MALAYALAM LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+0D61;MALAYALAM LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+0D66;MALAYALAM DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0D67;MALAYALAM DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0D68;MALAYALAM DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0D69;MALAYALAM DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0D6A;MALAYALAM DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0D6B;MALAYALAM DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0D6C;MALAYALAM DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0D6D;MALAYALAM DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0D6E;MALAYALAM DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0D6F;MALAYALAM DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0D82;SINHALA SIGN ANUSVARAYA;Mc;0;L;;;;;N;;;;;
+0D83;SINHALA SIGN VISARGAYA;Mc;0;L;;;;;N;;;;;
+0D85;SINHALA LETTER AYANNA;Lo;0;L;;;;;N;;;;;
+0D86;SINHALA LETTER AAYANNA;Lo;0;L;;;;;N;;;;;
+0D87;SINHALA LETTER AEYANNA;Lo;0;L;;;;;N;;;;;
+0D88;SINHALA LETTER AEEYANNA;Lo;0;L;;;;;N;;;;;
+0D89;SINHALA LETTER IYANNA;Lo;0;L;;;;;N;;;;;
+0D8A;SINHALA LETTER IIYANNA;Lo;0;L;;;;;N;;;;;
+0D8B;SINHALA LETTER UYANNA;Lo;0;L;;;;;N;;;;;
+0D8C;SINHALA LETTER UUYANNA;Lo;0;L;;;;;N;;;;;
+0D8D;SINHALA LETTER IRUYANNA;Lo;0;L;;;;;N;;;;;
+0D8E;SINHALA LETTER IRUUYANNA;Lo;0;L;;;;;N;;;;;
+0D8F;SINHALA LETTER ILUYANNA;Lo;0;L;;;;;N;;;;;
+0D90;SINHALA LETTER ILUUYANNA;Lo;0;L;;;;;N;;;;;
+0D91;SINHALA LETTER EYANNA;Lo;0;L;;;;;N;;;;;
+0D92;SINHALA LETTER EEYANNA;Lo;0;L;;;;;N;;;;;
+0D93;SINHALA LETTER AIYANNA;Lo;0;L;;;;;N;;;;;
+0D94;SINHALA LETTER OYANNA;Lo;0;L;;;;;N;;;;;
+0D95;SINHALA LETTER OOYANNA;Lo;0;L;;;;;N;;;;;
+0D96;SINHALA LETTER AUYANNA;Lo;0;L;;;;;N;;;;;
+0D9A;SINHALA LETTER ALPAPRAANA KAYANNA;Lo;0;L;;;;;N;;;;;
+0D9B;SINHALA LETTER MAHAAPRAANA KAYANNA;Lo;0;L;;;;;N;;;;;
+0D9C;SINHALA LETTER ALPAPRAANA GAYANNA;Lo;0;L;;;;;N;;;;;
+0D9D;SINHALA LETTER MAHAAPRAANA GAYANNA;Lo;0;L;;;;;N;;;;;
+0D9E;SINHALA LETTER KANTAJA NAASIKYAYA;Lo;0;L;;;;;N;;;;;
+0D9F;SINHALA LETTER SANYAKA GAYANNA;Lo;0;L;;;;;N;;;;;
+0DA0;SINHALA LETTER ALPAPRAANA CAYANNA;Lo;0;L;;;;;N;;;;;
+0DA1;SINHALA LETTER MAHAAPRAANA CAYANNA;Lo;0;L;;;;;N;;;;;
+0DA2;SINHALA LETTER ALPAPRAANA JAYANNA;Lo;0;L;;;;;N;;;;;
+0DA3;SINHALA LETTER MAHAAPRAANA JAYANNA;Lo;0;L;;;;;N;;;;;
+0DA4;SINHALA LETTER TAALUJA NAASIKYAYA;Lo;0;L;;;;;N;;;;;
+0DA5;SINHALA LETTER TAALUJA SANYOOGA NAAKSIKYAYA;Lo;0;L;;;;;N;;;;;
+0DA6;SINHALA LETTER SANYAKA JAYANNA;Lo;0;L;;;;;N;;;;;
+0DA7;SINHALA LETTER ALPAPRAANA TTAYANNA;Lo;0;L;;;;;N;;;;;
+0DA8;SINHALA LETTER MAHAAPRAANA TTAYANNA;Lo;0;L;;;;;N;;;;;
+0DA9;SINHALA LETTER ALPAPRAANA DDAYANNA;Lo;0;L;;;;;N;;;;;
+0DAA;SINHALA LETTER MAHAAPRAANA DDAYANNA;Lo;0;L;;;;;N;;;;;
+0DAB;SINHALA LETTER MUURDHAJA NAYANNA;Lo;0;L;;;;;N;;;;;
+0DAC;SINHALA LETTER SANYAKA DDAYANNA;Lo;0;L;;;;;N;;;;;
+0DAD;SINHALA LETTER ALPAPRAANA TAYANNA;Lo;0;L;;;;;N;;;;;
+0DAE;SINHALA LETTER MAHAAPRAANA TAYANNA;Lo;0;L;;;;;N;;;;;
+0DAF;SINHALA LETTER ALPAPRAANA DAYANNA;Lo;0;L;;;;;N;;;;;
+0DB0;SINHALA LETTER MAHAAPRAANA DAYANNA;Lo;0;L;;;;;N;;;;;
+0DB1;SINHALA LETTER DANTAJA NAYANNA;Lo;0;L;;;;;N;;;;;
+0DB3;SINHALA LETTER SANYAKA DAYANNA;Lo;0;L;;;;;N;;;;;
+0DB4;SINHALA LETTER ALPAPRAANA PAYANNA;Lo;0;L;;;;;N;;;;;
+0DB5;SINHALA LETTER MAHAAPRAANA PAYANNA;Lo;0;L;;;;;N;;;;;
+0DB6;SINHALA LETTER ALPAPRAANA BAYANNA;Lo;0;L;;;;;N;;;;;
+0DB7;SINHALA LETTER MAHAAPRAANA BAYANNA;Lo;0;L;;;;;N;;;;;
+0DB8;SINHALA LETTER MAYANNA;Lo;0;L;;;;;N;;;;;
+0DB9;SINHALA LETTER AMBA BAYANNA;Lo;0;L;;;;;N;;;;;
+0DBA;SINHALA LETTER YAYANNA;Lo;0;L;;;;;N;;;;;
+0DBB;SINHALA LETTER RAYANNA;Lo;0;L;;;;;N;;;;;
+0DBD;SINHALA LETTER DANTAJA LAYANNA;Lo;0;L;;;;;N;;;;;
+0DC0;SINHALA LETTER VAYANNA;Lo;0;L;;;;;N;;;;;
+0DC1;SINHALA LETTER TAALUJA SAYANNA;Lo;0;L;;;;;N;;;;;
+0DC2;SINHALA LETTER MUURDHAJA SAYANNA;Lo;0;L;;;;;N;;;;;
+0DC3;SINHALA LETTER DANTAJA SAYANNA;Lo;0;L;;;;;N;;;;;
+0DC4;SINHALA LETTER HAYANNA;Lo;0;L;;;;;N;;;;;
+0DC5;SINHALA LETTER MUURDHAJA LAYANNA;Lo;0;L;;;;;N;;;;;
+0DC6;SINHALA LETTER FAYANNA;Lo;0;L;;;;;N;;;;;
+0DCA;SINHALA SIGN AL-LAKUNA;Mn;9;NSM;;;;;N;;;;;
+0DCF;SINHALA VOWEL SIGN AELA-PILLA;Mc;0;L;;;;;N;;;;;
+0DD0;SINHALA VOWEL SIGN KETTI AEDA-PILLA;Mc;0;L;;;;;N;;;;;
+0DD1;SINHALA VOWEL SIGN DIGA AEDA-PILLA;Mc;0;L;;;;;N;;;;;
+0DD2;SINHALA VOWEL SIGN KETTI IS-PILLA;Mn;0;NSM;;;;;N;;;;;
+0DD3;SINHALA VOWEL SIGN DIGA IS-PILLA;Mn;0;NSM;;;;;N;;;;;
+0DD4;SINHALA VOWEL SIGN KETTI PAA-PILLA;Mn;0;NSM;;;;;N;;;;;
+0DD6;SINHALA VOWEL SIGN DIGA PAA-PILLA;Mn;0;NSM;;;;;N;;;;;
+0DD8;SINHALA VOWEL SIGN GAETTA-PILLA;Mc;0;L;;;;;N;;;;;
+0DD9;SINHALA VOWEL SIGN KOMBUVA;Mc;0;L;;;;;N;;;;;
+0DDA;SINHALA VOWEL SIGN DIGA KOMBUVA;Mc;0;L;0DD9 0DCA;;;;N;;;;;
+0DDB;SINHALA VOWEL SIGN KOMBU DEKA;Mc;0;L;;;;;N;;;;;
+0DDC;SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA;Mc;0;L;0DD9 0DCF;;;;N;;;;;
+0DDD;SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA;Mc;0;L;0DDC 0DCA;;;;N;;;;;
+0DDE;SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA;Mc;0;L;0DD9 0DDF;;;;N;;;;;
+0DDF;SINHALA VOWEL SIGN GAYANUKITTA;Mc;0;L;;;;;N;;;;;
+0DF2;SINHALA VOWEL SIGN DIGA GAETTA-PILLA;Mc;0;L;;;;;N;;;;;
+0DF3;SINHALA VOWEL SIGN DIGA GAYANUKITTA;Mc;0;L;;;;;N;;;;;
+0DF4;SINHALA PUNCTUATION KUNDDALIYA;Po;0;L;;;;;N;;;;;
+0E01;THAI CHARACTER KO KAI;Lo;0;L;;;;;N;THAI LETTER KO KAI;;;;
+0E02;THAI CHARACTER KHO KHAI;Lo;0;L;;;;;N;THAI LETTER KHO KHAI;;;;
+0E03;THAI CHARACTER KHO KHUAT;Lo;0;L;;;;;N;THAI LETTER KHO KHUAT;;;;
+0E04;THAI CHARACTER KHO KHWAI;Lo;0;L;;;;;N;THAI LETTER KHO KHWAI;;;;
+0E05;THAI CHARACTER KHO KHON;Lo;0;L;;;;;N;THAI LETTER KHO KHON;;;;
+0E06;THAI CHARACTER KHO RAKHANG;Lo;0;L;;;;;N;THAI LETTER KHO RAKHANG;;;;
+0E07;THAI CHARACTER NGO NGU;Lo;0;L;;;;;N;THAI LETTER NGO NGU;;;;
+0E08;THAI CHARACTER CHO CHAN;Lo;0;L;;;;;N;THAI LETTER CHO CHAN;;;;
+0E09;THAI CHARACTER CHO CHING;Lo;0;L;;;;;N;THAI LETTER CHO CHING;;;;
+0E0A;THAI CHARACTER CHO CHANG;Lo;0;L;;;;;N;THAI LETTER CHO CHANG;;;;
+0E0B;THAI CHARACTER SO SO;Lo;0;L;;;;;N;THAI LETTER SO SO;;;;
+0E0C;THAI CHARACTER CHO CHOE;Lo;0;L;;;;;N;THAI LETTER CHO CHOE;;;;
+0E0D;THAI CHARACTER YO YING;Lo;0;L;;;;;N;THAI LETTER YO YING;;;;
+0E0E;THAI CHARACTER DO CHADA;Lo;0;L;;;;;N;THAI LETTER DO CHADA;;;;
+0E0F;THAI CHARACTER TO PATAK;Lo;0;L;;;;;N;THAI LETTER TO PATAK;;;;
+0E10;THAI CHARACTER THO THAN;Lo;0;L;;;;;N;THAI LETTER THO THAN;;;;
+0E11;THAI CHARACTER THO NANGMONTHO;Lo;0;L;;;;;N;THAI LETTER THO NANGMONTHO;;;;
+0E12;THAI CHARACTER THO PHUTHAO;Lo;0;L;;;;;N;THAI LETTER THO PHUTHAO;;;;
+0E13;THAI CHARACTER NO NEN;Lo;0;L;;;;;N;THAI LETTER NO NEN;;;;
+0E14;THAI CHARACTER DO DEK;Lo;0;L;;;;;N;THAI LETTER DO DEK;;;;
+0E15;THAI CHARACTER TO TAO;Lo;0;L;;;;;N;THAI LETTER TO TAO;;;;
+0E16;THAI CHARACTER THO THUNG;Lo;0;L;;;;;N;THAI LETTER THO THUNG;;;;
+0E17;THAI CHARACTER THO THAHAN;Lo;0;L;;;;;N;THAI LETTER THO THAHAN;;;;
+0E18;THAI CHARACTER THO THONG;Lo;0;L;;;;;N;THAI LETTER THO THONG;;;;
+0E19;THAI CHARACTER NO NU;Lo;0;L;;;;;N;THAI LETTER NO NU;;;;
+0E1A;THAI CHARACTER BO BAIMAI;Lo;0;L;;;;;N;THAI LETTER BO BAIMAI;;;;
+0E1B;THAI CHARACTER PO PLA;Lo;0;L;;;;;N;THAI LETTER PO PLA;;;;
+0E1C;THAI CHARACTER PHO PHUNG;Lo;0;L;;;;;N;THAI LETTER PHO PHUNG;;;;
+0E1D;THAI CHARACTER FO FA;Lo;0;L;;;;;N;THAI LETTER FO FA;;;;
+0E1E;THAI CHARACTER PHO PHAN;Lo;0;L;;;;;N;THAI LETTER PHO PHAN;;;;
+0E1F;THAI CHARACTER FO FAN;Lo;0;L;;;;;N;THAI LETTER FO FAN;;;;
+0E20;THAI CHARACTER PHO SAMPHAO;Lo;0;L;;;;;N;THAI LETTER PHO SAMPHAO;;;;
+0E21;THAI CHARACTER MO MA;Lo;0;L;;;;;N;THAI LETTER MO MA;;;;
+0E22;THAI CHARACTER YO YAK;Lo;0;L;;;;;N;THAI LETTER YO YAK;;;;
+0E23;THAI CHARACTER RO RUA;Lo;0;L;;;;;N;THAI LETTER RO RUA;;;;
+0E24;THAI CHARACTER RU;Lo;0;L;;;;;N;THAI LETTER RU;;;;
+0E25;THAI CHARACTER LO LING;Lo;0;L;;;;;N;THAI LETTER LO LING;;;;
+0E26;THAI CHARACTER LU;Lo;0;L;;;;;N;THAI LETTER LU;;;;
+0E27;THAI CHARACTER WO WAEN;Lo;0;L;;;;;N;THAI LETTER WO WAEN;;;;
+0E28;THAI CHARACTER SO SALA;Lo;0;L;;;;;N;THAI LETTER SO SALA;;;;
+0E29;THAI CHARACTER SO RUSI;Lo;0;L;;;;;N;THAI LETTER SO RUSI;;;;
+0E2A;THAI CHARACTER SO SUA;Lo;0;L;;;;;N;THAI LETTER SO SUA;;;;
+0E2B;THAI CHARACTER HO HIP;Lo;0;L;;;;;N;THAI LETTER HO HIP;;;;
+0E2C;THAI CHARACTER LO CHULA;Lo;0;L;;;;;N;THAI LETTER LO CHULA;;;;
+0E2D;THAI CHARACTER O ANG;Lo;0;L;;;;;N;THAI LETTER O ANG;;;;
+0E2E;THAI CHARACTER HO NOKHUK;Lo;0;L;;;;;N;THAI LETTER HO NOK HUK;;;;
+0E2F;THAI CHARACTER PAIYANNOI;Lo;0;L;;;;;N;THAI PAI YAN NOI;paiyan noi;;;
+0E30;THAI CHARACTER SARA A;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA A;;;;
+0E31;THAI CHARACTER MAI HAN-AKAT;Mn;0;NSM;;;;;N;THAI VOWEL SIGN MAI HAN-AKAT;;;;
+0E32;THAI CHARACTER SARA AA;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA AA;;;;
+0E33;THAI CHARACTER SARA AM;Lo;0;L;<compat> 0E4D 0E32;;;;N;THAI VOWEL SIGN SARA AM;;;;
+0E34;THAI CHARACTER SARA I;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA I;;;;
+0E35;THAI CHARACTER SARA II;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA II;;;;
+0E36;THAI CHARACTER SARA UE;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA UE;;;;
+0E37;THAI CHARACTER SARA UEE;Mn;0;NSM;;;;;N;THAI VOWEL SIGN SARA UEE;sara uue;;;
+0E38;THAI CHARACTER SARA U;Mn;103;NSM;;;;;N;THAI VOWEL SIGN SARA U;;;;
+0E39;THAI CHARACTER SARA UU;Mn;103;NSM;;;;;N;THAI VOWEL SIGN SARA UU;;;;
+0E3A;THAI CHARACTER PHINTHU;Mn;9;NSM;;;;;N;THAI VOWEL SIGN PHINTHU;;;;
+0E3F;THAI CURRENCY SYMBOL BAHT;Sc;0;ET;;;;;N;THAI BAHT SIGN;;;;
+0E40;THAI CHARACTER SARA E;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA E;;;;
+0E41;THAI CHARACTER SARA AE;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA AE;;;;
+0E42;THAI CHARACTER SARA O;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA O;;;;
+0E43;THAI CHARACTER SARA AI MAIMUAN;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA MAI MUAN;sara ai mai muan;;;
+0E44;THAI CHARACTER SARA AI MAIMALAI;Lo;0;L;;;;;N;THAI VOWEL SIGN SARA MAI MALAI;sara ai mai malai;;;
+0E45;THAI CHARACTER LAKKHANGYAO;Lo;0;L;;;;;N;THAI LAK KHANG YAO;lakkhang yao;;;
+0E46;THAI CHARACTER MAIYAMOK;Lm;0;L;;;;;N;THAI MAI YAMOK;mai yamok;;;
+0E47;THAI CHARACTER MAITAIKHU;Mn;0;NSM;;;;;N;THAI VOWEL SIGN MAI TAI KHU;mai taikhu;;;
+0E48;THAI CHARACTER MAI EK;Mn;107;NSM;;;;;N;THAI TONE MAI EK;;;;
+0E49;THAI CHARACTER MAI THO;Mn;107;NSM;;;;;N;THAI TONE MAI THO;;;;
+0E4A;THAI CHARACTER MAI TRI;Mn;107;NSM;;;;;N;THAI TONE MAI TRI;;;;
+0E4B;THAI CHARACTER MAI CHATTAWA;Mn;107;NSM;;;;;N;THAI TONE MAI CHATTAWA;;;;
+0E4C;THAI CHARACTER THANTHAKHAT;Mn;0;NSM;;;;;N;THAI THANTHAKHAT;;;;
+0E4D;THAI CHARACTER NIKHAHIT;Mn;0;NSM;;;;;N;THAI NIKKHAHIT;nikkhahit;;;
+0E4E;THAI CHARACTER YAMAKKAN;Mn;0;NSM;;;;;N;THAI YAMAKKAN;;;;
+0E4F;THAI CHARACTER FONGMAN;Po;0;L;;;;;N;THAI FONGMAN;;;;
+0E50;THAI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0E51;THAI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0E52;THAI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0E53;THAI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0E54;THAI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0E55;THAI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0E56;THAI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0E57;THAI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0E58;THAI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0E59;THAI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0E5A;THAI CHARACTER ANGKHANKHU;Po;0;L;;;;;N;THAI ANGKHANKHU;;;;
+0E5B;THAI CHARACTER KHOMUT;Po;0;L;;;;;N;THAI KHOMUT;;;;
+0E81;LAO LETTER KO;Lo;0;L;;;;;N;;;;;
+0E82;LAO LETTER KHO SUNG;Lo;0;L;;;;;N;;;;;
+0E84;LAO LETTER KHO TAM;Lo;0;L;;;;;N;;;;;
+0E87;LAO LETTER NGO;Lo;0;L;;;;;N;;;;;
+0E88;LAO LETTER CO;Lo;0;L;;;;;N;;;;;
+0E8A;LAO LETTER SO TAM;Lo;0;L;;;;;N;;;;;
+0E8D;LAO LETTER NYO;Lo;0;L;;;;;N;;;;;
+0E94;LAO LETTER DO;Lo;0;L;;;;;N;;;;;
+0E95;LAO LETTER TO;Lo;0;L;;;;;N;;;;;
+0E96;LAO LETTER THO SUNG;Lo;0;L;;;;;N;;;;;
+0E97;LAO LETTER THO TAM;Lo;0;L;;;;;N;;;;;
+0E99;LAO LETTER NO;Lo;0;L;;;;;N;;;;;
+0E9A;LAO LETTER BO;Lo;0;L;;;;;N;;;;;
+0E9B;LAO LETTER PO;Lo;0;L;;;;;N;;;;;
+0E9C;LAO LETTER PHO SUNG;Lo;0;L;;;;;N;;;;;
+0E9D;LAO LETTER FO TAM;Lo;0;L;;;;;N;;;;;
+0E9E;LAO LETTER PHO TAM;Lo;0;L;;;;;N;;;;;
+0E9F;LAO LETTER FO SUNG;Lo;0;L;;;;;N;;;;;
+0EA1;LAO LETTER MO;Lo;0;L;;;;;N;;;;;
+0EA2;LAO LETTER YO;Lo;0;L;;;;;N;;;;;
+0EA3;LAO LETTER LO LING;Lo;0;L;;;;;N;;;;;
+0EA5;LAO LETTER LO LOOT;Lo;0;L;;;;;N;;;;;
+0EA7;LAO LETTER WO;Lo;0;L;;;;;N;;;;;
+0EAA;LAO LETTER SO SUNG;Lo;0;L;;;;;N;;;;;
+0EAB;LAO LETTER HO SUNG;Lo;0;L;;;;;N;;;;;
+0EAD;LAO LETTER O;Lo;0;L;;;;;N;;;;;
+0EAE;LAO LETTER HO TAM;Lo;0;L;;;;;N;;;;;
+0EAF;LAO ELLIPSIS;Lo;0;L;;;;;N;;;;;
+0EB0;LAO VOWEL SIGN A;Lo;0;L;;;;;N;;;;;
+0EB1;LAO VOWEL SIGN MAI KAN;Mn;0;NSM;;;;;N;;;;;
+0EB2;LAO VOWEL SIGN AA;Lo;0;L;;;;;N;;;;;
+0EB3;LAO VOWEL SIGN AM;Lo;0;L;<compat> 0ECD 0EB2;;;;N;;;;;
+0EB4;LAO VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+0EB5;LAO VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
+0EB6;LAO VOWEL SIGN Y;Mn;0;NSM;;;;;N;;;;;
+0EB7;LAO VOWEL SIGN YY;Mn;0;NSM;;;;;N;;;;;
+0EB8;LAO VOWEL SIGN U;Mn;118;NSM;;;;;N;;;;;
+0EB9;LAO VOWEL SIGN UU;Mn;118;NSM;;;;;N;;;;;
+0EBB;LAO VOWEL SIGN MAI KON;Mn;0;NSM;;;;;N;;;;;
+0EBC;LAO SEMIVOWEL SIGN LO;Mn;0;NSM;;;;;N;;;;;
+0EBD;LAO SEMIVOWEL SIGN NYO;Lo;0;L;;;;;N;;;;;
+0EC0;LAO VOWEL SIGN E;Lo;0;L;;;;;N;;;;;
+0EC1;LAO VOWEL SIGN EI;Lo;0;L;;;;;N;;;;;
+0EC2;LAO VOWEL SIGN O;Lo;0;L;;;;;N;;;;;
+0EC3;LAO VOWEL SIGN AY;Lo;0;L;;;;;N;;;;;
+0EC4;LAO VOWEL SIGN AI;Lo;0;L;;;;;N;;;;;
+0EC6;LAO KO LA;Lm;0;L;;;;;N;;;;;
+0EC8;LAO TONE MAI EK;Mn;122;NSM;;;;;N;;;;;
+0EC9;LAO TONE MAI THO;Mn;122;NSM;;;;;N;;;;;
+0ECA;LAO TONE MAI TI;Mn;122;NSM;;;;;N;;;;;
+0ECB;LAO TONE MAI CATAWA;Mn;122;NSM;;;;;N;;;;;
+0ECC;LAO CANCELLATION MARK;Mn;0;NSM;;;;;N;;;;;
+0ECD;LAO NIGGAHITA;Mn;0;NSM;;;;;N;;;;;
+0ED0;LAO DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0ED1;LAO DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0ED2;LAO DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0ED3;LAO DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0ED4;LAO DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0ED5;LAO DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0ED6;LAO DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0ED7;LAO DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0ED8;LAO DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0ED9;LAO DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0EDC;LAO HO NO;Lo;0;L;<compat> 0EAB 0E99;;;;N;;;;;
+0EDD;LAO HO MO;Lo;0;L;<compat> 0EAB 0EA1;;;;N;;;;;
+0F00;TIBETAN SYLLABLE OM;Lo;0;L;;;;;N;;;;;
+0F01;TIBETAN MARK GTER YIG MGO TRUNCATED A;So;0;L;;;;;N;;ter yik go a thung;;;
+0F02;TIBETAN MARK GTER YIG MGO -UM RNAM BCAD MA;So;0;L;;;;;N;;ter yik go wum nam chey ma;;;
+0F03;TIBETAN MARK GTER YIG MGO -UM GTER TSHEG MA;So;0;L;;;;;N;;ter yik go wum ter tsek ma;;;
+0F04;TIBETAN MARK INITIAL YIG MGO MDUN MA;Po;0;L;;;;;N;TIBETAN SINGLE ORNAMENT;yik go dun ma;;;
+0F05;TIBETAN MARK CLOSING YIG MGO SGAB MA;Po;0;L;;;;;N;;yik go kab ma;;;
+0F06;TIBETAN MARK CARET YIG MGO PHUR SHAD MA;Po;0;L;;;;;N;;yik go pur shey ma;;;
+0F07;TIBETAN MARK YIG MGO TSHEG SHAD MA;Po;0;L;;;;;N;;yik go tsek shey ma;;;
+0F08;TIBETAN MARK SBRUL SHAD;Po;0;L;;;;;N;TIBETAN RGYANSHAD;drul shey;;;
+0F09;TIBETAN MARK BSKUR YIG MGO;Po;0;L;;;;;N;;kur yik go;;;
+0F0A;TIBETAN MARK BKA- SHOG YIG MGO;Po;0;L;;;;;N;;ka sho yik go;;;
+0F0B;TIBETAN MARK INTERSYLLABIC TSHEG;Po;0;L;;;;;N;TIBETAN TSEG;tsek;;;
+0F0C;TIBETAN MARK DELIMITER TSHEG BSTAR;Po;0;L;<noBreak> 0F0B;;;;N;;tsek tar;;;
+0F0D;TIBETAN MARK SHAD;Po;0;L;;;;;N;TIBETAN SHAD;shey;;;
+0F0E;TIBETAN MARK NYIS SHAD;Po;0;L;;;;;N;TIBETAN DOUBLE SHAD;nyi shey;;;
+0F0F;TIBETAN MARK TSHEG SHAD;Po;0;L;;;;;N;;tsek shey;;;
+0F10;TIBETAN MARK NYIS TSHEG SHAD;Po;0;L;;;;;N;;nyi tsek shey;;;
+0F11;TIBETAN MARK RIN CHEN SPUNGS SHAD;Po;0;L;;;;;N;TIBETAN RINCHANPHUNGSHAD;rinchen pung shey;;;
+0F12;TIBETAN MARK RGYA GRAM SHAD;Po;0;L;;;;;N;;gya tram shey;;;
+0F13;TIBETAN MARK CARET -DZUD RTAGS ME LONG CAN;So;0;L;;;;;N;;dzu ta me long chen;;;
+0F14;TIBETAN MARK GTER TSHEG;So;0;L;;;;;N;TIBETAN COMMA;ter tsek;;;
+0F15;TIBETAN LOGOTYPE SIGN CHAD RTAGS;So;0;L;;;;;N;;che ta;;;
+0F16;TIBETAN LOGOTYPE SIGN LHAG RTAGS;So;0;L;;;;;N;;hlak ta;;;
+0F17;TIBETAN ASTROLOGICAL SIGN SGRA GCAN -CHAR RTAGS;So;0;L;;;;;N;;trachen char ta;;;
+0F18;TIBETAN ASTROLOGICAL SIGN -KHYUD PA;Mn;220;NSM;;;;;N;;kyu pa;;;
+0F19;TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS;Mn;220;NSM;;;;;N;;dong tsu;;;
+0F1A;TIBETAN SIGN RDEL DKAR GCIG;So;0;L;;;;;N;;deka chig;;;
+0F1B;TIBETAN SIGN RDEL DKAR GNYIS;So;0;L;;;;;N;;deka nyi;;;
+0F1C;TIBETAN SIGN RDEL DKAR GSUM;So;0;L;;;;;N;;deka sum;;;
+0F1D;TIBETAN SIGN RDEL NAG GCIG;So;0;L;;;;;N;;dena chig;;;
+0F1E;TIBETAN SIGN RDEL NAG GNYIS;So;0;L;;;;;N;;dena nyi;;;
+0F1F;TIBETAN SIGN RDEL DKAR RDEL NAG;So;0;L;;;;;N;;deka dena;;;
+0F20;TIBETAN DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+0F21;TIBETAN DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+0F22;TIBETAN DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+0F23;TIBETAN DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+0F24;TIBETAN DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+0F25;TIBETAN DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+0F26;TIBETAN DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+0F27;TIBETAN DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+0F28;TIBETAN DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+0F29;TIBETAN DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0F2A;TIBETAN DIGIT HALF ONE;No;0;L;;;;1/2;N;;;;;
+0F2B;TIBETAN DIGIT HALF TWO;No;0;L;;;;3/2;N;;;;;
+0F2C;TIBETAN DIGIT HALF THREE;No;0;L;;;;5/2;N;;;;;
+0F2D;TIBETAN DIGIT HALF FOUR;No;0;L;;;;7/2;N;;;;;
+0F2E;TIBETAN DIGIT HALF FIVE;No;0;L;;;;9/2;N;;;;;
+0F2F;TIBETAN DIGIT HALF SIX;No;0;L;;;;11/2;N;;;;;
+0F30;TIBETAN DIGIT HALF SEVEN;No;0;L;;;;13/2;N;;;;;
+0F31;TIBETAN DIGIT HALF EIGHT;No;0;L;;;;15/2;N;;;;;
+0F32;TIBETAN DIGIT HALF NINE;No;0;L;;;;17/2;N;;;;;
+0F33;TIBETAN DIGIT HALF ZERO;No;0;L;;;;-1/2;N;;;;;
+0F34;TIBETAN MARK BSDUS RTAGS;So;0;L;;;;;N;;du ta;;;
+0F35;TIBETAN MARK NGAS BZUNG NYI ZLA;Mn;220;NSM;;;;;N;TIBETAN HONORIFIC UNDER RING;nge zung nyi da;;;
+0F36;TIBETAN MARK CARET -DZUD RTAGS BZHI MIG CAN;So;0;L;;;;;N;;dzu ta shi mig chen;;;
+0F37;TIBETAN MARK NGAS BZUNG SGOR RTAGS;Mn;220;NSM;;;;;N;TIBETAN UNDER RING;nge zung gor ta;;;
+0F38;TIBETAN MARK CHE MGO;So;0;L;;;;;N;;che go;;;
+0F39;TIBETAN MARK TSA -PHRU;Mn;216;NSM;;;;;N;TIBETAN LENITION MARK;tsa tru;;;
+0F3A;TIBETAN MARK GUG RTAGS GYON;Ps;0;ON;;;;;Y;;gug ta yun;;;
+0F3B;TIBETAN MARK GUG RTAGS GYAS;Pe;0;ON;;;;;Y;;gug ta ye;;;
+0F3C;TIBETAN MARK ANG KHANG GYON;Ps;0;ON;;;;;Y;TIBETAN LEFT BRACE;ang kang yun;;;
+0F3D;TIBETAN MARK ANG KHANG GYAS;Pe;0;ON;;;;;Y;TIBETAN RIGHT BRACE;ang kang ye;;;
+0F3E;TIBETAN SIGN YAR TSHES;Mc;0;L;;;;;N;;yar tse;;;
+0F3F;TIBETAN SIGN MAR TSHES;Mc;0;L;;;;;N;;mar tse;;;
+0F40;TIBETAN LETTER KA;Lo;0;L;;;;;N;;;;;
+0F41;TIBETAN LETTER KHA;Lo;0;L;;;;;N;;;;;
+0F42;TIBETAN LETTER GA;Lo;0;L;;;;;N;;;;;
+0F43;TIBETAN LETTER GHA;Lo;0;L;0F42 0FB7;;;;N;;;;;
+0F44;TIBETAN LETTER NGA;Lo;0;L;;;;;N;;;;;
+0F45;TIBETAN LETTER CA;Lo;0;L;;;;;N;;;;;
+0F46;TIBETAN LETTER CHA;Lo;0;L;;;;;N;;;;;
+0F47;TIBETAN LETTER JA;Lo;0;L;;;;;N;;;;;
+0F49;TIBETAN LETTER NYA;Lo;0;L;;;;;N;;;;;
+0F4A;TIBETAN LETTER TTA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED TA;;;;
+0F4B;TIBETAN LETTER TTHA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED THA;;;;
+0F4C;TIBETAN LETTER DDA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED DA;;;;
+0F4D;TIBETAN LETTER DDHA;Lo;0;L;0F4C 0FB7;;;;N;;;;;
+0F4E;TIBETAN LETTER NNA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED NA;;;;
+0F4F;TIBETAN LETTER TA;Lo;0;L;;;;;N;;;;;
+0F50;TIBETAN LETTER THA;Lo;0;L;;;;;N;;;;;
+0F51;TIBETAN LETTER DA;Lo;0;L;;;;;N;;;;;
+0F52;TIBETAN LETTER DHA;Lo;0;L;0F51 0FB7;;;;N;;;;;
+0F53;TIBETAN LETTER NA;Lo;0;L;;;;;N;;;;;
+0F54;TIBETAN LETTER PA;Lo;0;L;;;;;N;;;;;
+0F55;TIBETAN LETTER PHA;Lo;0;L;;;;;N;;;;;
+0F56;TIBETAN LETTER BA;Lo;0;L;;;;;N;;;;;
+0F57;TIBETAN LETTER BHA;Lo;0;L;0F56 0FB7;;;;N;;;;;
+0F58;TIBETAN LETTER MA;Lo;0;L;;;;;N;;;;;
+0F59;TIBETAN LETTER TSA;Lo;0;L;;;;;N;;;;;
+0F5A;TIBETAN LETTER TSHA;Lo;0;L;;;;;N;;;;;
+0F5B;TIBETAN LETTER DZA;Lo;0;L;;;;;N;;;;;
+0F5C;TIBETAN LETTER DZHA;Lo;0;L;0F5B 0FB7;;;;N;;;;;
+0F5D;TIBETAN LETTER WA;Lo;0;L;;;;;N;;;;;
+0F5E;TIBETAN LETTER ZHA;Lo;0;L;;;;;N;;;;;
+0F5F;TIBETAN LETTER ZA;Lo;0;L;;;;;N;;;;;
+0F60;TIBETAN LETTER -A;Lo;0;L;;;;;N;TIBETAN LETTER AA;;;;
+0F61;TIBETAN LETTER YA;Lo;0;L;;;;;N;;;;;
+0F62;TIBETAN LETTER RA;Lo;0;L;;;;;N;;*;;;
+0F63;TIBETAN LETTER LA;Lo;0;L;;;;;N;;;;;
+0F64;TIBETAN LETTER SHA;Lo;0;L;;;;;N;;;;;
+0F65;TIBETAN LETTER SSA;Lo;0;L;;;;;N;TIBETAN LETTER REVERSED SHA;;;;
+0F66;TIBETAN LETTER SA;Lo;0;L;;;;;N;;;;;
+0F67;TIBETAN LETTER HA;Lo;0;L;;;;;N;;;;;
+0F68;TIBETAN LETTER A;Lo;0;L;;;;;N;;;;;
+0F69;TIBETAN LETTER KSSA;Lo;0;L;0F40 0FB5;;;;N;;;;;
+0F6A;TIBETAN LETTER FIXED-FORM RA;Lo;0;L;;;;;N;;*;;;
+0F71;TIBETAN VOWEL SIGN AA;Mn;129;NSM;;;;;N;;;;;
+0F72;TIBETAN VOWEL SIGN I;Mn;130;NSM;;;;;N;;;;;
+0F73;TIBETAN VOWEL SIGN II;Mn;0;NSM;0F71 0F72;;;;N;;;;;
+0F74;TIBETAN VOWEL SIGN U;Mn;132;NSM;;;;;N;;;;;
+0F75;TIBETAN VOWEL SIGN UU;Mn;0;NSM;0F71 0F74;;;;N;;;;;
+0F76;TIBETAN VOWEL SIGN VOCALIC R;Mn;0;NSM;0FB2 0F80;;;;N;;;;;
+0F77;TIBETAN VOWEL SIGN VOCALIC RR;Mn;0;NSM;<compat> 0FB2 0F81;;;;N;;;;;
+0F78;TIBETAN VOWEL SIGN VOCALIC L;Mn;0;NSM;0FB3 0F80;;;;N;;;;;
+0F79;TIBETAN VOWEL SIGN VOCALIC LL;Mn;0;NSM;<compat> 0FB3 0F81;;;;N;;;;;
+0F7A;TIBETAN VOWEL SIGN E;Mn;130;NSM;;;;;N;;;;;
+0F7B;TIBETAN VOWEL SIGN EE;Mn;130;NSM;;;;;N;TIBETAN VOWEL SIGN AI;;;;
+0F7C;TIBETAN VOWEL SIGN O;Mn;130;NSM;;;;;N;;;;;
+0F7D;TIBETAN VOWEL SIGN OO;Mn;130;NSM;;;;;N;TIBETAN VOWEL SIGN AU;;;;
+0F7E;TIBETAN SIGN RJES SU NGA RO;Mn;0;NSM;;;;;N;TIBETAN ANUSVARA;je su nga ro;;;
+0F7F;TIBETAN SIGN RNAM BCAD;Mc;0;L;;;;;N;TIBETAN VISARGA;nam chey;;;
+0F80;TIBETAN VOWEL SIGN REVERSED I;Mn;130;NSM;;;;;N;TIBETAN VOWEL SIGN SHORT I;;;;
+0F81;TIBETAN VOWEL SIGN REVERSED II;Mn;0;NSM;0F71 0F80;;;;N;;;;;
+0F82;TIBETAN SIGN NYI ZLA NAA DA;Mn;230;NSM;;;;;N;TIBETAN CANDRABINDU WITH ORNAMENT;nyi da na da;;;
+0F83;TIBETAN SIGN SNA LDAN;Mn;230;NSM;;;;;N;TIBETAN CANDRABINDU;nan de;;;
+0F84;TIBETAN MARK HALANTA;Mn;9;NSM;;;;;N;TIBETAN VIRAMA;;;;
+0F85;TIBETAN MARK PALUTA;Po;0;L;;;;;N;TIBETAN CHUCHENYIGE;;;;
+0F86;TIBETAN SIGN LCI RTAGS;Mn;230;NSM;;;;;N;;ji ta;;;
+0F87;TIBETAN SIGN YANG RTAGS;Mn;230;NSM;;;;;N;;yang ta;;;
+0F88;TIBETAN SIGN LCE TSA CAN;Lo;0;L;;;;;N;;che tsa chen;;;
+0F89;TIBETAN SIGN MCHU CAN;Lo;0;L;;;;;N;;chu chen;;;
+0F8A;TIBETAN SIGN GRU CAN RGYINGS;Lo;0;L;;;;;N;;tru chen ging;;;
+0F8B;TIBETAN SIGN GRU MED RGYINGS;Lo;0;L;;;;;N;;tru me ging;;;
+0F90;TIBETAN SUBJOINED LETTER KA;Mn;0;NSM;;;;;N;;;;;
+0F91;TIBETAN SUBJOINED LETTER KHA;Mn;0;NSM;;;;;N;;;;;
+0F92;TIBETAN SUBJOINED LETTER GA;Mn;0;NSM;;;;;N;;;;;
+0F93;TIBETAN SUBJOINED LETTER GHA;Mn;0;NSM;0F92 0FB7;;;;N;;;;;
+0F94;TIBETAN SUBJOINED LETTER NGA;Mn;0;NSM;;;;;N;;;;;
+0F95;TIBETAN SUBJOINED LETTER CA;Mn;0;NSM;;;;;N;;;;;
+0F96;TIBETAN SUBJOINED LETTER CHA;Mn;0;NSM;;;;;N;;;;;
+0F97;TIBETAN SUBJOINED LETTER JA;Mn;0;NSM;;;;;N;;;;;
+0F99;TIBETAN SUBJOINED LETTER NYA;Mn;0;NSM;;;;;N;;;;;
+0F9A;TIBETAN SUBJOINED LETTER TTA;Mn;0;NSM;;;;;N;;;;;
+0F9B;TIBETAN SUBJOINED LETTER TTHA;Mn;0;NSM;;;;;N;;;;;
+0F9C;TIBETAN SUBJOINED LETTER DDA;Mn;0;NSM;;;;;N;;;;;
+0F9D;TIBETAN SUBJOINED LETTER DDHA;Mn;0;NSM;0F9C 0FB7;;;;N;;;;;
+0F9E;TIBETAN SUBJOINED LETTER NNA;Mn;0;NSM;;;;;N;;;;;
+0F9F;TIBETAN SUBJOINED LETTER TA;Mn;0;NSM;;;;;N;;;;;
+0FA0;TIBETAN SUBJOINED LETTER THA;Mn;0;NSM;;;;;N;;;;;
+0FA1;TIBETAN SUBJOINED LETTER DA;Mn;0;NSM;;;;;N;;;;;
+0FA2;TIBETAN SUBJOINED LETTER DHA;Mn;0;NSM;0FA1 0FB7;;;;N;;;;;
+0FA3;TIBETAN SUBJOINED LETTER NA;Mn;0;NSM;;;;;N;;;;;
+0FA4;TIBETAN SUBJOINED LETTER PA;Mn;0;NSM;;;;;N;;;;;
+0FA5;TIBETAN SUBJOINED LETTER PHA;Mn;0;NSM;;;;;N;;;;;
+0FA6;TIBETAN SUBJOINED LETTER BA;Mn;0;NSM;;;;;N;;;;;
+0FA7;TIBETAN SUBJOINED LETTER BHA;Mn;0;NSM;0FA6 0FB7;;;;N;;;;;
+0FA8;TIBETAN SUBJOINED LETTER MA;Mn;0;NSM;;;;;N;;;;;
+0FA9;TIBETAN SUBJOINED LETTER TSA;Mn;0;NSM;;;;;N;;;;;
+0FAA;TIBETAN SUBJOINED LETTER TSHA;Mn;0;NSM;;;;;N;;;;;
+0FAB;TIBETAN SUBJOINED LETTER DZA;Mn;0;NSM;;;;;N;;;;;
+0FAC;TIBETAN SUBJOINED LETTER DZHA;Mn;0;NSM;0FAB 0FB7;;;;N;;;;;
+0FAD;TIBETAN SUBJOINED LETTER WA;Mn;0;NSM;;;;;N;;*;;;
+0FAE;TIBETAN SUBJOINED LETTER ZHA;Mn;0;NSM;;;;;N;;;;;
+0FAF;TIBETAN SUBJOINED LETTER ZA;Mn;0;NSM;;;;;N;;;;;
+0FB0;TIBETAN SUBJOINED LETTER -A;Mn;0;NSM;;;;;N;;;;;
+0FB1;TIBETAN SUBJOINED LETTER YA;Mn;0;NSM;;;;;N;;*;;;
+0FB2;TIBETAN SUBJOINED LETTER RA;Mn;0;NSM;;;;;N;;*;;;
+0FB3;TIBETAN SUBJOINED LETTER LA;Mn;0;NSM;;;;;N;;;;;
+0FB4;TIBETAN SUBJOINED LETTER SHA;Mn;0;NSM;;;;;N;;;;;
+0FB5;TIBETAN SUBJOINED LETTER SSA;Mn;0;NSM;;;;;N;;;;;
+0FB6;TIBETAN SUBJOINED LETTER SA;Mn;0;NSM;;;;;N;;;;;
+0FB7;TIBETAN SUBJOINED LETTER HA;Mn;0;NSM;;;;;N;;;;;
+0FB8;TIBETAN SUBJOINED LETTER A;Mn;0;NSM;;;;;N;;;;;
+0FB9;TIBETAN SUBJOINED LETTER KSSA;Mn;0;NSM;0F90 0FB5;;;;N;;;;;
+0FBA;TIBETAN SUBJOINED LETTER FIXED-FORM WA;Mn;0;NSM;;;;;N;;*;;;
+0FBB;TIBETAN SUBJOINED LETTER FIXED-FORM YA;Mn;0;NSM;;;;;N;;*;;;
+0FBC;TIBETAN SUBJOINED LETTER FIXED-FORM RA;Mn;0;NSM;;;;;N;;*;;;
+0FBE;TIBETAN KU RU KHA;So;0;L;;;;;N;;kuruka;;;
+0FBF;TIBETAN KU RU KHA BZHI MIG CAN;So;0;L;;;;;N;;kuruka shi mik chen;;;
+0FC0;TIBETAN CANTILLATION SIGN HEAVY BEAT;So;0;L;;;;;N;;;;;
+0FC1;TIBETAN CANTILLATION SIGN LIGHT BEAT;So;0;L;;;;;N;;;;;
+0FC2;TIBETAN CANTILLATION SIGN CANG TE-U;So;0;L;;;;;N;;chang tyu;;;
+0FC3;TIBETAN CANTILLATION SIGN SBUB -CHAL;So;0;L;;;;;N;;bub chey;;;
+0FC4;TIBETAN SYMBOL DRIL BU;So;0;L;;;;;N;;drilbu;;;
+0FC5;TIBETAN SYMBOL RDO RJE;So;0;L;;;;;N;;dorje;;;
+0FC6;TIBETAN SYMBOL PADMA GDAN;Mn;220;NSM;;;;;N;;pema den;;;
+0FC7;TIBETAN SYMBOL RDO RJE RGYA GRAM;So;0;L;;;;;N;;dorje gya dram;;;
+0FC8;TIBETAN SYMBOL PHUR PA;So;0;L;;;;;N;;phurba;;;
+0FC9;TIBETAN SYMBOL NOR BU;So;0;L;;;;;N;;norbu;;;
+0FCA;TIBETAN SYMBOL NOR BU NYIS -KHYIL;So;0;L;;;;;N;;norbu nyi khyi;;;
+0FCB;TIBETAN SYMBOL NOR BU GSUM -KHYIL;So;0;L;;;;;N;;norbu sum khyi;;;
+0FCC;TIBETAN SYMBOL NOR BU BZHI -KHYIL;So;0;L;;;;;N;;norbu shi khyi;;;
+0FCF;TIBETAN SIGN RDEL NAG GSUM;So;0;L;;;;;N;;dena sum;;;
+0FD0;TIBETAN MARK BSKA- SHOG GI MGO RGYAN;Po;0;L;;;;;N;;ka shog gi go gyen;;;
+0FD1;TIBETAN MARK MNYAM YIG GI MGO RGYAN;Po;0;L;;;;;N;;nyam yig gi go gyen;;;
+1000;MYANMAR LETTER KA;Lo;0;L;;;;;N;;;;;
+1001;MYANMAR LETTER KHA;Lo;0;L;;;;;N;;;;;
+1002;MYANMAR LETTER GA;Lo;0;L;;;;;N;;;;;
+1003;MYANMAR LETTER GHA;Lo;0;L;;;;;N;;;;;
+1004;MYANMAR LETTER NGA;Lo;0;L;;;;;N;;;;;
+1005;MYANMAR LETTER CA;Lo;0;L;;;;;N;;;;;
+1006;MYANMAR LETTER CHA;Lo;0;L;;;;;N;;;;;
+1007;MYANMAR LETTER JA;Lo;0;L;;;;;N;;;;;
+1008;MYANMAR LETTER JHA;Lo;0;L;;;;;N;;;;;
+1009;MYANMAR LETTER NYA;Lo;0;L;;;;;N;;;;;
+100A;MYANMAR LETTER NNYA;Lo;0;L;;;;;N;;;;;
+100B;MYANMAR LETTER TTA;Lo;0;L;;;;;N;;;;;
+100C;MYANMAR LETTER TTHA;Lo;0;L;;;;;N;;;;;
+100D;MYANMAR LETTER DDA;Lo;0;L;;;;;N;;;;;
+100E;MYANMAR LETTER DDHA;Lo;0;L;;;;;N;;;;;
+100F;MYANMAR LETTER NNA;Lo;0;L;;;;;N;;;;;
+1010;MYANMAR LETTER TA;Lo;0;L;;;;;N;;;;;
+1011;MYANMAR LETTER THA;Lo;0;L;;;;;N;;;;;
+1012;MYANMAR LETTER DA;Lo;0;L;;;;;N;;;;;
+1013;MYANMAR LETTER DHA;Lo;0;L;;;;;N;;;;;
+1014;MYANMAR LETTER NA;Lo;0;L;;;;;N;;;;;
+1015;MYANMAR LETTER PA;Lo;0;L;;;;;N;;;;;
+1016;MYANMAR LETTER PHA;Lo;0;L;;;;;N;;;;;
+1017;MYANMAR LETTER BA;Lo;0;L;;;;;N;;;;;
+1018;MYANMAR LETTER BHA;Lo;0;L;;;;;N;;;;;
+1019;MYANMAR LETTER MA;Lo;0;L;;;;;N;;;;;
+101A;MYANMAR LETTER YA;Lo;0;L;;;;;N;;;;;
+101B;MYANMAR LETTER RA;Lo;0;L;;;;;N;;;;;
+101C;MYANMAR LETTER LA;Lo;0;L;;;;;N;;;;;
+101D;MYANMAR LETTER WA;Lo;0;L;;;;;N;;;;;
+101E;MYANMAR LETTER SA;Lo;0;L;;;;;N;;;;;
+101F;MYANMAR LETTER HA;Lo;0;L;;;;;N;;;;;
+1020;MYANMAR LETTER LLA;Lo;0;L;;;;;N;;;;;
+1021;MYANMAR LETTER A;Lo;0;L;;;;;N;;;;;
+1023;MYANMAR LETTER I;Lo;0;L;;;;;N;;;;;
+1024;MYANMAR LETTER II;Lo;0;L;;;;;N;;;;;
+1025;MYANMAR LETTER U;Lo;0;L;;;;;N;;;;;
+1026;MYANMAR LETTER UU;Lo;0;L;1025 102E;;;;N;;;;;
+1027;MYANMAR LETTER E;Lo;0;L;;;;;N;;;;;
+1029;MYANMAR LETTER O;Lo;0;L;;;;;N;;;;;
+102A;MYANMAR LETTER AU;Lo;0;L;;;;;N;;;;;
+102C;MYANMAR VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+102D;MYANMAR VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+102E;MYANMAR VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
+102F;MYANMAR VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1030;MYANMAR VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+1031;MYANMAR VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+1032;MYANMAR VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+1036;MYANMAR SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+1037;MYANMAR SIGN DOT BELOW;Mn;7;NSM;;;;;N;;;;;
+1038;MYANMAR SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+1039;MYANMAR SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+1040;MYANMAR DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+1041;MYANMAR DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+1042;MYANMAR DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+1043;MYANMAR DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+1044;MYANMAR DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+1045;MYANMAR DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+1046;MYANMAR DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+1047;MYANMAR DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+1048;MYANMAR DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+1049;MYANMAR DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+104A;MYANMAR SIGN LITTLE SECTION;Po;0;L;;;;;N;;;;;
+104B;MYANMAR SIGN SECTION;Po;0;L;;;;;N;;;;;
+104C;MYANMAR SYMBOL LOCATIVE;Po;0;L;;;;;N;;;;;
+104D;MYANMAR SYMBOL COMPLETED;Po;0;L;;;;;N;;;;;
+104E;MYANMAR SYMBOL AFOREMENTIONED;Po;0;L;;;;;N;;;;;
+104F;MYANMAR SYMBOL GENITIVE;Po;0;L;;;;;N;;;;;
+1050;MYANMAR LETTER SHA;Lo;0;L;;;;;N;;;;;
+1051;MYANMAR LETTER SSA;Lo;0;L;;;;;N;;;;;
+1052;MYANMAR LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+1053;MYANMAR LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+1054;MYANMAR LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+1055;MYANMAR LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+1056;MYANMAR VOWEL SIGN VOCALIC R;Mc;0;L;;;;;N;;;;;
+1057;MYANMAR VOWEL SIGN VOCALIC RR;Mc;0;L;;;;;N;;;;;
+1058;MYANMAR VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;;
+1059;MYANMAR VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;;
+10A0;GEORGIAN CAPITAL LETTER AN;Lu;0;L;;;;;N;;Khutsuri;;2D00;
+10A1;GEORGIAN CAPITAL LETTER BAN;Lu;0;L;;;;;N;;Khutsuri;;2D01;
+10A2;GEORGIAN CAPITAL LETTER GAN;Lu;0;L;;;;;N;;Khutsuri;;2D02;
+10A3;GEORGIAN CAPITAL LETTER DON;Lu;0;L;;;;;N;;Khutsuri;;2D03;
+10A4;GEORGIAN CAPITAL LETTER EN;Lu;0;L;;;;;N;;Khutsuri;;2D04;
+10A5;GEORGIAN CAPITAL LETTER VIN;Lu;0;L;;;;;N;;Khutsuri;;2D05;
+10A6;GEORGIAN CAPITAL LETTER ZEN;Lu;0;L;;;;;N;;Khutsuri;;2D06;
+10A7;GEORGIAN CAPITAL LETTER TAN;Lu;0;L;;;;;N;;Khutsuri;;2D07;
+10A8;GEORGIAN CAPITAL LETTER IN;Lu;0;L;;;;;N;;Khutsuri;;2D08;
+10A9;GEORGIAN CAPITAL LETTER KAN;Lu;0;L;;;;;N;;Khutsuri;;2D09;
+10AA;GEORGIAN CAPITAL LETTER LAS;Lu;0;L;;;;;N;;Khutsuri;;2D0A;
+10AB;GEORGIAN CAPITAL LETTER MAN;Lu;0;L;;;;;N;;Khutsuri;;2D0B;
+10AC;GEORGIAN CAPITAL LETTER NAR;Lu;0;L;;;;;N;;Khutsuri;;2D0C;
+10AD;GEORGIAN CAPITAL LETTER ON;Lu;0;L;;;;;N;;Khutsuri;;2D0D;
+10AE;GEORGIAN CAPITAL LETTER PAR;Lu;0;L;;;;;N;;Khutsuri;;2D0E;
+10AF;GEORGIAN CAPITAL LETTER ZHAR;Lu;0;L;;;;;N;;Khutsuri;;2D0F;
+10B0;GEORGIAN CAPITAL LETTER RAE;Lu;0;L;;;;;N;;Khutsuri;;2D10;
+10B1;GEORGIAN CAPITAL LETTER SAN;Lu;0;L;;;;;N;;Khutsuri;;2D11;
+10B2;GEORGIAN CAPITAL LETTER TAR;Lu;0;L;;;;;N;;Khutsuri;;2D12;
+10B3;GEORGIAN CAPITAL LETTER UN;Lu;0;L;;;;;N;;Khutsuri;;2D13;
+10B4;GEORGIAN CAPITAL LETTER PHAR;Lu;0;L;;;;;N;;Khutsuri;;2D14;
+10B5;GEORGIAN CAPITAL LETTER KHAR;Lu;0;L;;;;;N;;Khutsuri;;2D15;
+10B6;GEORGIAN CAPITAL LETTER GHAN;Lu;0;L;;;;;N;;Khutsuri;;2D16;
+10B7;GEORGIAN CAPITAL LETTER QAR;Lu;0;L;;;;;N;;Khutsuri;;2D17;
+10B8;GEORGIAN CAPITAL LETTER SHIN;Lu;0;L;;;;;N;;Khutsuri;;2D18;
+10B9;GEORGIAN CAPITAL LETTER CHIN;Lu;0;L;;;;;N;;Khutsuri;;2D19;
+10BA;GEORGIAN CAPITAL LETTER CAN;Lu;0;L;;;;;N;;Khutsuri;;2D1A;
+10BB;GEORGIAN CAPITAL LETTER JIL;Lu;0;L;;;;;N;;Khutsuri;;2D1B;
+10BC;GEORGIAN CAPITAL LETTER CIL;Lu;0;L;;;;;N;;Khutsuri;;2D1C;
+10BD;GEORGIAN CAPITAL LETTER CHAR;Lu;0;L;;;;;N;;Khutsuri;;2D1D;
+10BE;GEORGIAN CAPITAL LETTER XAN;Lu;0;L;;;;;N;;Khutsuri;;2D1E;
+10BF;GEORGIAN CAPITAL LETTER JHAN;Lu;0;L;;;;;N;;Khutsuri;;2D1F;
+10C0;GEORGIAN CAPITAL LETTER HAE;Lu;0;L;;;;;N;;Khutsuri;;2D20;
+10C1;GEORGIAN CAPITAL LETTER HE;Lu;0;L;;;;;N;;Khutsuri;;2D21;
+10C2;GEORGIAN CAPITAL LETTER HIE;Lu;0;L;;;;;N;;Khutsuri;;2D22;
+10C3;GEORGIAN CAPITAL LETTER WE;Lu;0;L;;;;;N;;Khutsuri;;2D23;
+10C4;GEORGIAN CAPITAL LETTER HAR;Lu;0;L;;;;;N;;Khutsuri;;2D24;
+10C5;GEORGIAN CAPITAL LETTER HOE;Lu;0;L;;;;;N;;Khutsuri;;2D25;
+10D0;GEORGIAN LETTER AN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER AN;;;;
+10D1;GEORGIAN LETTER BAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER BAN;;;;
+10D2;GEORGIAN LETTER GAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER GAN;;;;
+10D3;GEORGIAN LETTER DON;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER DON;;;;
+10D4;GEORGIAN LETTER EN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER EN;;;;
+10D5;GEORGIAN LETTER VIN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER VIN;;;;
+10D6;GEORGIAN LETTER ZEN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER ZEN;;;;
+10D7;GEORGIAN LETTER TAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER TAN;;;;
+10D8;GEORGIAN LETTER IN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER IN;;;;
+10D9;GEORGIAN LETTER KAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER KAN;;;;
+10DA;GEORGIAN LETTER LAS;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER LAS;;;;
+10DB;GEORGIAN LETTER MAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER MAN;;;;
+10DC;GEORGIAN LETTER NAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER NAR;;;;
+10DD;GEORGIAN LETTER ON;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER ON;;;;
+10DE;GEORGIAN LETTER PAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER PAR;;;;
+10DF;GEORGIAN LETTER ZHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER ZHAR;;;;
+10E0;GEORGIAN LETTER RAE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER RAE;;;;
+10E1;GEORGIAN LETTER SAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER SAN;;;;
+10E2;GEORGIAN LETTER TAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER TAR;;;;
+10E3;GEORGIAN LETTER UN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER UN;;;;
+10E4;GEORGIAN LETTER PHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER PHAR;;;;
+10E5;GEORGIAN LETTER KHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER KHAR;;;;
+10E6;GEORGIAN LETTER GHAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER GHAN;;;;
+10E7;GEORGIAN LETTER QAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER QAR;;;;
+10E8;GEORGIAN LETTER SHIN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER SHIN;;;;
+10E9;GEORGIAN LETTER CHIN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CHIN;;;;
+10EA;GEORGIAN LETTER CAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CAN;;;;
+10EB;GEORGIAN LETTER JIL;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER JIL;;;;
+10EC;GEORGIAN LETTER CIL;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CIL;;;;
+10ED;GEORGIAN LETTER CHAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER CHAR;;;;
+10EE;GEORGIAN LETTER XAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER XAN;;;;
+10EF;GEORGIAN LETTER JHAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER JHAN;;;;
+10F0;GEORGIAN LETTER HAE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HAE;;;;
+10F1;GEORGIAN LETTER HE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HE;;;;
+10F2;GEORGIAN LETTER HIE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HIE;;;;
+10F3;GEORGIAN LETTER WE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER WE;;;;
+10F4;GEORGIAN LETTER HAR;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HAR;;;;
+10F5;GEORGIAN LETTER HOE;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER HOE;;;;
+10F6;GEORGIAN LETTER FI;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER FI;;;;
+10F7;GEORGIAN LETTER YN;Lo;0;L;;;;;N;;;;;
+10F8;GEORGIAN LETTER ELIFI;Lo;0;L;;;;;N;;;;;
+10F9;GEORGIAN LETTER TURNED GAN;Lo;0;L;;;;;N;;;;;
+10FA;GEORGIAN LETTER AIN;Lo;0;L;;;;;N;;;;;
+10FB;GEORGIAN PARAGRAPH SEPARATOR;Po;0;L;;;;;N;;;;;
+10FC;MODIFIER LETTER GEORGIAN NAR;Lm;0;L;<super> 10DC;;;;N;;;;;
+1100;HANGUL CHOSEONG KIYEOK;Lo;0;L;;;;;N;;g *;;;
+1101;HANGUL CHOSEONG SSANGKIYEOK;Lo;0;L;;;;;N;;gg *;;;
+1102;HANGUL CHOSEONG NIEUN;Lo;0;L;;;;;N;;n *;;;
+1103;HANGUL CHOSEONG TIKEUT;Lo;0;L;;;;;N;;d *;;;
+1104;HANGUL CHOSEONG SSANGTIKEUT;Lo;0;L;;;;;N;;dd *;;;
+1105;HANGUL CHOSEONG RIEUL;Lo;0;L;;;;;N;;r *;;;
+1106;HANGUL CHOSEONG MIEUM;Lo;0;L;;;;;N;;m *;;;
+1107;HANGUL CHOSEONG PIEUP;Lo;0;L;;;;;N;;b *;;;
+1108;HANGUL CHOSEONG SSANGPIEUP;Lo;0;L;;;;;N;;bb *;;;
+1109;HANGUL CHOSEONG SIOS;Lo;0;L;;;;;N;;s *;;;
+110A;HANGUL CHOSEONG SSANGSIOS;Lo;0;L;;;;;N;;ss *;;;
+110B;HANGUL CHOSEONG IEUNG;Lo;0;L;;;;;N;;;;;
+110C;HANGUL CHOSEONG CIEUC;Lo;0;L;;;;;N;;j *;;;
+110D;HANGUL CHOSEONG SSANGCIEUC;Lo;0;L;;;;;N;;jj *;;;
+110E;HANGUL CHOSEONG CHIEUCH;Lo;0;L;;;;;N;;c *;;;
+110F;HANGUL CHOSEONG KHIEUKH;Lo;0;L;;;;;N;;k *;;;
+1110;HANGUL CHOSEONG THIEUTH;Lo;0;L;;;;;N;;t *;;;
+1111;HANGUL CHOSEONG PHIEUPH;Lo;0;L;;;;;N;;p *;;;
+1112;HANGUL CHOSEONG HIEUH;Lo;0;L;;;;;N;;h *;;;
+1113;HANGUL CHOSEONG NIEUN-KIYEOK;Lo;0;L;;;;;N;;;;;
+1114;HANGUL CHOSEONG SSANGNIEUN;Lo;0;L;;;;;N;;;;;
+1115;HANGUL CHOSEONG NIEUN-TIKEUT;Lo;0;L;;;;;N;;;;;
+1116;HANGUL CHOSEONG NIEUN-PIEUP;Lo;0;L;;;;;N;;;;;
+1117;HANGUL CHOSEONG TIKEUT-KIYEOK;Lo;0;L;;;;;N;;;;;
+1118;HANGUL CHOSEONG RIEUL-NIEUN;Lo;0;L;;;;;N;;;;;
+1119;HANGUL CHOSEONG SSANGRIEUL;Lo;0;L;;;;;N;;;;;
+111A;HANGUL CHOSEONG RIEUL-HIEUH;Lo;0;L;;;;;N;;;;;
+111B;HANGUL CHOSEONG KAPYEOUNRIEUL;Lo;0;L;;;;;N;;;;;
+111C;HANGUL CHOSEONG MIEUM-PIEUP;Lo;0;L;;;;;N;;;;;
+111D;HANGUL CHOSEONG KAPYEOUNMIEUM;Lo;0;L;;;;;N;;;;;
+111E;HANGUL CHOSEONG PIEUP-KIYEOK;Lo;0;L;;;;;N;;;;;
+111F;HANGUL CHOSEONG PIEUP-NIEUN;Lo;0;L;;;;;N;;;;;
+1120;HANGUL CHOSEONG PIEUP-TIKEUT;Lo;0;L;;;;;N;;;;;
+1121;HANGUL CHOSEONG PIEUP-SIOS;Lo;0;L;;;;;N;;;;;
+1122;HANGUL CHOSEONG PIEUP-SIOS-KIYEOK;Lo;0;L;;;;;N;;;;;
+1123;HANGUL CHOSEONG PIEUP-SIOS-TIKEUT;Lo;0;L;;;;;N;;;;;
+1124;HANGUL CHOSEONG PIEUP-SIOS-PIEUP;Lo;0;L;;;;;N;;;;;
+1125;HANGUL CHOSEONG PIEUP-SSANGSIOS;Lo;0;L;;;;;N;;;;;
+1126;HANGUL CHOSEONG PIEUP-SIOS-CIEUC;Lo;0;L;;;;;N;;;;;
+1127;HANGUL CHOSEONG PIEUP-CIEUC;Lo;0;L;;;;;N;;;;;
+1128;HANGUL CHOSEONG PIEUP-CHIEUCH;Lo;0;L;;;;;N;;;;;
+1129;HANGUL CHOSEONG PIEUP-THIEUTH;Lo;0;L;;;;;N;;;;;
+112A;HANGUL CHOSEONG PIEUP-PHIEUPH;Lo;0;L;;;;;N;;;;;
+112B;HANGUL CHOSEONG KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;;
+112C;HANGUL CHOSEONG KAPYEOUNSSANGPIEUP;Lo;0;L;;;;;N;;;;;
+112D;HANGUL CHOSEONG SIOS-KIYEOK;Lo;0;L;;;;;N;;;;;
+112E;HANGUL CHOSEONG SIOS-NIEUN;Lo;0;L;;;;;N;;;;;
+112F;HANGUL CHOSEONG SIOS-TIKEUT;Lo;0;L;;;;;N;;;;;
+1130;HANGUL CHOSEONG SIOS-RIEUL;Lo;0;L;;;;;N;;;;;
+1131;HANGUL CHOSEONG SIOS-MIEUM;Lo;0;L;;;;;N;;;;;
+1132;HANGUL CHOSEONG SIOS-PIEUP;Lo;0;L;;;;;N;;;;;
+1133;HANGUL CHOSEONG SIOS-PIEUP-KIYEOK;Lo;0;L;;;;;N;;;;;
+1134;HANGUL CHOSEONG SIOS-SSANGSIOS;Lo;0;L;;;;;N;;;;;
+1135;HANGUL CHOSEONG SIOS-IEUNG;Lo;0;L;;;;;N;;;;;
+1136;HANGUL CHOSEONG SIOS-CIEUC;Lo;0;L;;;;;N;;;;;
+1137;HANGUL CHOSEONG SIOS-CHIEUCH;Lo;0;L;;;;;N;;;;;
+1138;HANGUL CHOSEONG SIOS-KHIEUKH;Lo;0;L;;;;;N;;;;;
+1139;HANGUL CHOSEONG SIOS-THIEUTH;Lo;0;L;;;;;N;;;;;
+113A;HANGUL CHOSEONG SIOS-PHIEUPH;Lo;0;L;;;;;N;;;;;
+113B;HANGUL CHOSEONG SIOS-HIEUH;Lo;0;L;;;;;N;;;;;
+113C;HANGUL CHOSEONG CHITUEUMSIOS;Lo;0;L;;;;;N;;;;;
+113D;HANGUL CHOSEONG CHITUEUMSSANGSIOS;Lo;0;L;;;;;N;;;;;
+113E;HANGUL CHOSEONG CEONGCHIEUMSIOS;Lo;0;L;;;;;N;;;;;
+113F;HANGUL CHOSEONG CEONGCHIEUMSSANGSIOS;Lo;0;L;;;;;N;;;;;
+1140;HANGUL CHOSEONG PANSIOS;Lo;0;L;;;;;N;;;;;
+1141;HANGUL CHOSEONG IEUNG-KIYEOK;Lo;0;L;;;;;N;;;;;
+1142;HANGUL CHOSEONG IEUNG-TIKEUT;Lo;0;L;;;;;N;;;;;
+1143;HANGUL CHOSEONG IEUNG-MIEUM;Lo;0;L;;;;;N;;;;;
+1144;HANGUL CHOSEONG IEUNG-PIEUP;Lo;0;L;;;;;N;;;;;
+1145;HANGUL CHOSEONG IEUNG-SIOS;Lo;0;L;;;;;N;;;;;
+1146;HANGUL CHOSEONG IEUNG-PANSIOS;Lo;0;L;;;;;N;;;;;
+1147;HANGUL CHOSEONG SSANGIEUNG;Lo;0;L;;;;;N;;;;;
+1148;HANGUL CHOSEONG IEUNG-CIEUC;Lo;0;L;;;;;N;;;;;
+1149;HANGUL CHOSEONG IEUNG-CHIEUCH;Lo;0;L;;;;;N;;;;;
+114A;HANGUL CHOSEONG IEUNG-THIEUTH;Lo;0;L;;;;;N;;;;;
+114B;HANGUL CHOSEONG IEUNG-PHIEUPH;Lo;0;L;;;;;N;;;;;
+114C;HANGUL CHOSEONG YESIEUNG;Lo;0;L;;;;;N;;;;;
+114D;HANGUL CHOSEONG CIEUC-IEUNG;Lo;0;L;;;;;N;;;;;
+114E;HANGUL CHOSEONG CHITUEUMCIEUC;Lo;0;L;;;;;N;;;;;
+114F;HANGUL CHOSEONG CHITUEUMSSANGCIEUC;Lo;0;L;;;;;N;;;;;
+1150;HANGUL CHOSEONG CEONGCHIEUMCIEUC;Lo;0;L;;;;;N;;;;;
+1151;HANGUL CHOSEONG CEONGCHIEUMSSANGCIEUC;Lo;0;L;;;;;N;;;;;
+1152;HANGUL CHOSEONG CHIEUCH-KHIEUKH;Lo;0;L;;;;;N;;;;;
+1153;HANGUL CHOSEONG CHIEUCH-HIEUH;Lo;0;L;;;;;N;;;;;
+1154;HANGUL CHOSEONG CHITUEUMCHIEUCH;Lo;0;L;;;;;N;;;;;
+1155;HANGUL CHOSEONG CEONGCHIEUMCHIEUCH;Lo;0;L;;;;;N;;;;;
+1156;HANGUL CHOSEONG PHIEUPH-PIEUP;Lo;0;L;;;;;N;;;;;
+1157;HANGUL CHOSEONG KAPYEOUNPHIEUPH;Lo;0;L;;;;;N;;;;;
+1158;HANGUL CHOSEONG SSANGHIEUH;Lo;0;L;;;;;N;;;;;
+1159;HANGUL CHOSEONG YEORINHIEUH;Lo;0;L;;;;;N;;;;;
+115F;HANGUL CHOSEONG FILLER;Lo;0;L;;;;;N;;;;;
+1160;HANGUL JUNGSEONG FILLER;Lo;0;L;;;;;N;;;;;
+1161;HANGUL JUNGSEONG A;Lo;0;L;;;;;N;;;;;
+1162;HANGUL JUNGSEONG AE;Lo;0;L;;;;;N;;;;;
+1163;HANGUL JUNGSEONG YA;Lo;0;L;;;;;N;;;;;
+1164;HANGUL JUNGSEONG YAE;Lo;0;L;;;;;N;;;;;
+1165;HANGUL JUNGSEONG EO;Lo;0;L;;;;;N;;;;;
+1166;HANGUL JUNGSEONG E;Lo;0;L;;;;;N;;;;;
+1167;HANGUL JUNGSEONG YEO;Lo;0;L;;;;;N;;;;;
+1168;HANGUL JUNGSEONG YE;Lo;0;L;;;;;N;;;;;
+1169;HANGUL JUNGSEONG O;Lo;0;L;;;;;N;;;;;
+116A;HANGUL JUNGSEONG WA;Lo;0;L;;;;;N;;;;;
+116B;HANGUL JUNGSEONG WAE;Lo;0;L;;;;;N;;;;;
+116C;HANGUL JUNGSEONG OE;Lo;0;L;;;;;N;;;;;
+116D;HANGUL JUNGSEONG YO;Lo;0;L;;;;;N;;;;;
+116E;HANGUL JUNGSEONG U;Lo;0;L;;;;;N;;;;;
+116F;HANGUL JUNGSEONG WEO;Lo;0;L;;;;;N;;;;;
+1170;HANGUL JUNGSEONG WE;Lo;0;L;;;;;N;;;;;
+1171;HANGUL JUNGSEONG WI;Lo;0;L;;;;;N;;;;;
+1172;HANGUL JUNGSEONG YU;Lo;0;L;;;;;N;;;;;
+1173;HANGUL JUNGSEONG EU;Lo;0;L;;;;;N;;;;;
+1174;HANGUL JUNGSEONG YI;Lo;0;L;;;;;N;;;;;
+1175;HANGUL JUNGSEONG I;Lo;0;L;;;;;N;;;;;
+1176;HANGUL JUNGSEONG A-O;Lo;0;L;;;;;N;;;;;
+1177;HANGUL JUNGSEONG A-U;Lo;0;L;;;;;N;;;;;
+1178;HANGUL JUNGSEONG YA-O;Lo;0;L;;;;;N;;;;;
+1179;HANGUL JUNGSEONG YA-YO;Lo;0;L;;;;;N;;;;;
+117A;HANGUL JUNGSEONG EO-O;Lo;0;L;;;;;N;;;;;
+117B;HANGUL JUNGSEONG EO-U;Lo;0;L;;;;;N;;;;;
+117C;HANGUL JUNGSEONG EO-EU;Lo;0;L;;;;;N;;;;;
+117D;HANGUL JUNGSEONG YEO-O;Lo;0;L;;;;;N;;;;;
+117E;HANGUL JUNGSEONG YEO-U;Lo;0;L;;;;;N;;;;;
+117F;HANGUL JUNGSEONG O-EO;Lo;0;L;;;;;N;;;;;
+1180;HANGUL JUNGSEONG O-E;Lo;0;L;;;;;N;;;;;
+1181;HANGUL JUNGSEONG O-YE;Lo;0;L;;;;;N;;;;;
+1182;HANGUL JUNGSEONG O-O;Lo;0;L;;;;;N;;;;;
+1183;HANGUL JUNGSEONG O-U;Lo;0;L;;;;;N;;;;;
+1184;HANGUL JUNGSEONG YO-YA;Lo;0;L;;;;;N;;;;;
+1185;HANGUL JUNGSEONG YO-YAE;Lo;0;L;;;;;N;;;;;
+1186;HANGUL JUNGSEONG YO-YEO;Lo;0;L;;;;;N;;;;;
+1187;HANGUL JUNGSEONG YO-O;Lo;0;L;;;;;N;;;;;
+1188;HANGUL JUNGSEONG YO-I;Lo;0;L;;;;;N;;;;;
+1189;HANGUL JUNGSEONG U-A;Lo;0;L;;;;;N;;;;;
+118A;HANGUL JUNGSEONG U-AE;Lo;0;L;;;;;N;;;;;
+118B;HANGUL JUNGSEONG U-EO-EU;Lo;0;L;;;;;N;;;;;
+118C;HANGUL JUNGSEONG U-YE;Lo;0;L;;;;;N;;;;;
+118D;HANGUL JUNGSEONG U-U;Lo;0;L;;;;;N;;;;;
+118E;HANGUL JUNGSEONG YU-A;Lo;0;L;;;;;N;;;;;
+118F;HANGUL JUNGSEONG YU-EO;Lo;0;L;;;;;N;;;;;
+1190;HANGUL JUNGSEONG YU-E;Lo;0;L;;;;;N;;;;;
+1191;HANGUL JUNGSEONG YU-YEO;Lo;0;L;;;;;N;;;;;
+1192;HANGUL JUNGSEONG YU-YE;Lo;0;L;;;;;N;;;;;
+1193;HANGUL JUNGSEONG YU-U;Lo;0;L;;;;;N;;;;;
+1194;HANGUL JUNGSEONG YU-I;Lo;0;L;;;;;N;;;;;
+1195;HANGUL JUNGSEONG EU-U;Lo;0;L;;;;;N;;;;;
+1196;HANGUL JUNGSEONG EU-EU;Lo;0;L;;;;;N;;;;;
+1197;HANGUL JUNGSEONG YI-U;Lo;0;L;;;;;N;;;;;
+1198;HANGUL JUNGSEONG I-A;Lo;0;L;;;;;N;;;;;
+1199;HANGUL JUNGSEONG I-YA;Lo;0;L;;;;;N;;;;;
+119A;HANGUL JUNGSEONG I-O;Lo;0;L;;;;;N;;;;;
+119B;HANGUL JUNGSEONG I-U;Lo;0;L;;;;;N;;;;;
+119C;HANGUL JUNGSEONG I-EU;Lo;0;L;;;;;N;;;;;
+119D;HANGUL JUNGSEONG I-ARAEA;Lo;0;L;;;;;N;;;;;
+119E;HANGUL JUNGSEONG ARAEA;Lo;0;L;;;;;N;;;;;
+119F;HANGUL JUNGSEONG ARAEA-EO;Lo;0;L;;;;;N;;;;;
+11A0;HANGUL JUNGSEONG ARAEA-U;Lo;0;L;;;;;N;;;;;
+11A1;HANGUL JUNGSEONG ARAEA-I;Lo;0;L;;;;;N;;;;;
+11A2;HANGUL JUNGSEONG SSANGARAEA;Lo;0;L;;;;;N;;;;;
+11A8;HANGUL JONGSEONG KIYEOK;Lo;0;L;;;;;N;;g *;;;
+11A9;HANGUL JONGSEONG SSANGKIYEOK;Lo;0;L;;;;;N;;gg *;;;
+11AA;HANGUL JONGSEONG KIYEOK-SIOS;Lo;0;L;;;;;N;;gs *;;;
+11AB;HANGUL JONGSEONG NIEUN;Lo;0;L;;;;;N;;n *;;;
+11AC;HANGUL JONGSEONG NIEUN-CIEUC;Lo;0;L;;;;;N;;nj *;;;
+11AD;HANGUL JONGSEONG NIEUN-HIEUH;Lo;0;L;;;;;N;;nh *;;;
+11AE;HANGUL JONGSEONG TIKEUT;Lo;0;L;;;;;N;;d *;;;
+11AF;HANGUL JONGSEONG RIEUL;Lo;0;L;;;;;N;;l *;;;
+11B0;HANGUL JONGSEONG RIEUL-KIYEOK;Lo;0;L;;;;;N;;lg *;;;
+11B1;HANGUL JONGSEONG RIEUL-MIEUM;Lo;0;L;;;;;N;;lm *;;;
+11B2;HANGUL JONGSEONG RIEUL-PIEUP;Lo;0;L;;;;;N;;lb *;;;
+11B3;HANGUL JONGSEONG RIEUL-SIOS;Lo;0;L;;;;;N;;ls *;;;
+11B4;HANGUL JONGSEONG RIEUL-THIEUTH;Lo;0;L;;;;;N;;lt *;;;
+11B5;HANGUL JONGSEONG RIEUL-PHIEUPH;Lo;0;L;;;;;N;;lp *;;;
+11B6;HANGUL JONGSEONG RIEUL-HIEUH;Lo;0;L;;;;;N;;lh *;;;
+11B7;HANGUL JONGSEONG MIEUM;Lo;0;L;;;;;N;;m *;;;
+11B8;HANGUL JONGSEONG PIEUP;Lo;0;L;;;;;N;;b *;;;
+11B9;HANGUL JONGSEONG PIEUP-SIOS;Lo;0;L;;;;;N;;bs *;;;
+11BA;HANGUL JONGSEONG SIOS;Lo;0;L;;;;;N;;s *;;;
+11BB;HANGUL JONGSEONG SSANGSIOS;Lo;0;L;;;;;N;;ss *;;;
+11BC;HANGUL JONGSEONG IEUNG;Lo;0;L;;;;;N;;ng *;;;
+11BD;HANGUL JONGSEONG CIEUC;Lo;0;L;;;;;N;;j *;;;
+11BE;HANGUL JONGSEONG CHIEUCH;Lo;0;L;;;;;N;;c *;;;
+11BF;HANGUL JONGSEONG KHIEUKH;Lo;0;L;;;;;N;;k *;;;
+11C0;HANGUL JONGSEONG THIEUTH;Lo;0;L;;;;;N;;t *;;;
+11C1;HANGUL JONGSEONG PHIEUPH;Lo;0;L;;;;;N;;p *;;;
+11C2;HANGUL JONGSEONG HIEUH;Lo;0;L;;;;;N;;h *;;;
+11C3;HANGUL JONGSEONG KIYEOK-RIEUL;Lo;0;L;;;;;N;;;;;
+11C4;HANGUL JONGSEONG KIYEOK-SIOS-KIYEOK;Lo;0;L;;;;;N;;;;;
+11C5;HANGUL JONGSEONG NIEUN-KIYEOK;Lo;0;L;;;;;N;;;;;
+11C6;HANGUL JONGSEONG NIEUN-TIKEUT;Lo;0;L;;;;;N;;;;;
+11C7;HANGUL JONGSEONG NIEUN-SIOS;Lo;0;L;;;;;N;;;;;
+11C8;HANGUL JONGSEONG NIEUN-PANSIOS;Lo;0;L;;;;;N;;;;;
+11C9;HANGUL JONGSEONG NIEUN-THIEUTH;Lo;0;L;;;;;N;;;;;
+11CA;HANGUL JONGSEONG TIKEUT-KIYEOK;Lo;0;L;;;;;N;;;;;
+11CB;HANGUL JONGSEONG TIKEUT-RIEUL;Lo;0;L;;;;;N;;;;;
+11CC;HANGUL JONGSEONG RIEUL-KIYEOK-SIOS;Lo;0;L;;;;;N;;;;;
+11CD;HANGUL JONGSEONG RIEUL-NIEUN;Lo;0;L;;;;;N;;;;;
+11CE;HANGUL JONGSEONG RIEUL-TIKEUT;Lo;0;L;;;;;N;;;;;
+11CF;HANGUL JONGSEONG RIEUL-TIKEUT-HIEUH;Lo;0;L;;;;;N;;;;;
+11D0;HANGUL JONGSEONG SSANGRIEUL;Lo;0;L;;;;;N;;;;;
+11D1;HANGUL JONGSEONG RIEUL-MIEUM-KIYEOK;Lo;0;L;;;;;N;;;;;
+11D2;HANGUL JONGSEONG RIEUL-MIEUM-SIOS;Lo;0;L;;;;;N;;;;;
+11D3;HANGUL JONGSEONG RIEUL-PIEUP-SIOS;Lo;0;L;;;;;N;;;;;
+11D4;HANGUL JONGSEONG RIEUL-PIEUP-HIEUH;Lo;0;L;;;;;N;;;;;
+11D5;HANGUL JONGSEONG RIEUL-KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;;
+11D6;HANGUL JONGSEONG RIEUL-SSANGSIOS;Lo;0;L;;;;;N;;;;;
+11D7;HANGUL JONGSEONG RIEUL-PANSIOS;Lo;0;L;;;;;N;;;;;
+11D8;HANGUL JONGSEONG RIEUL-KHIEUKH;Lo;0;L;;;;;N;;;;;
+11D9;HANGUL JONGSEONG RIEUL-YEORINHIEUH;Lo;0;L;;;;;N;;;;;
+11DA;HANGUL JONGSEONG MIEUM-KIYEOK;Lo;0;L;;;;;N;;;;;
+11DB;HANGUL JONGSEONG MIEUM-RIEUL;Lo;0;L;;;;;N;;;;;
+11DC;HANGUL JONGSEONG MIEUM-PIEUP;Lo;0;L;;;;;N;;;;;
+11DD;HANGUL JONGSEONG MIEUM-SIOS;Lo;0;L;;;;;N;;;;;
+11DE;HANGUL JONGSEONG MIEUM-SSANGSIOS;Lo;0;L;;;;;N;;;;;
+11DF;HANGUL JONGSEONG MIEUM-PANSIOS;Lo;0;L;;;;;N;;;;;
+11E0;HANGUL JONGSEONG MIEUM-CHIEUCH;Lo;0;L;;;;;N;;;;;
+11E1;HANGUL JONGSEONG MIEUM-HIEUH;Lo;0;L;;;;;N;;;;;
+11E2;HANGUL JONGSEONG KAPYEOUNMIEUM;Lo;0;L;;;;;N;;;;;
+11E3;HANGUL JONGSEONG PIEUP-RIEUL;Lo;0;L;;;;;N;;;;;
+11E4;HANGUL JONGSEONG PIEUP-PHIEUPH;Lo;0;L;;;;;N;;;;;
+11E5;HANGUL JONGSEONG PIEUP-HIEUH;Lo;0;L;;;;;N;;;;;
+11E6;HANGUL JONGSEONG KAPYEOUNPIEUP;Lo;0;L;;;;;N;;;;;
+11E7;HANGUL JONGSEONG SIOS-KIYEOK;Lo;0;L;;;;;N;;;;;
+11E8;HANGUL JONGSEONG SIOS-TIKEUT;Lo;0;L;;;;;N;;;;;
+11E9;HANGUL JONGSEONG SIOS-RIEUL;Lo;0;L;;;;;N;;;;;
+11EA;HANGUL JONGSEONG SIOS-PIEUP;Lo;0;L;;;;;N;;;;;
+11EB;HANGUL JONGSEONG PANSIOS;Lo;0;L;;;;;N;;;;;
+11EC;HANGUL JONGSEONG IEUNG-KIYEOK;Lo;0;L;;;;;N;;;;;
+11ED;HANGUL JONGSEONG IEUNG-SSANGKIYEOK;Lo;0;L;;;;;N;;;;;
+11EE;HANGUL JONGSEONG SSANGIEUNG;Lo;0;L;;;;;N;;;;;
+11EF;HANGUL JONGSEONG IEUNG-KHIEUKH;Lo;0;L;;;;;N;;;;;
+11F0;HANGUL JONGSEONG YESIEUNG;Lo;0;L;;;;;N;;;;;
+11F1;HANGUL JONGSEONG YESIEUNG-SIOS;Lo;0;L;;;;;N;;;;;
+11F2;HANGUL JONGSEONG YESIEUNG-PANSIOS;Lo;0;L;;;;;N;;;;;
+11F3;HANGUL JONGSEONG PHIEUPH-PIEUP;Lo;0;L;;;;;N;;;;;
+11F4;HANGUL JONGSEONG KAPYEOUNPHIEUPH;Lo;0;L;;;;;N;;;;;
+11F5;HANGUL JONGSEONG HIEUH-NIEUN;Lo;0;L;;;;;N;;;;;
+11F6;HANGUL JONGSEONG HIEUH-RIEUL;Lo;0;L;;;;;N;;;;;
+11F7;HANGUL JONGSEONG HIEUH-MIEUM;Lo;0;L;;;;;N;;;;;
+11F8;HANGUL JONGSEONG HIEUH-PIEUP;Lo;0;L;;;;;N;;;;;
+11F9;HANGUL JONGSEONG YEORINHIEUH;Lo;0;L;;;;;N;;;;;
+1200;ETHIOPIC SYLLABLE HA;Lo;0;L;;;;;N;;;;;
+1201;ETHIOPIC SYLLABLE HU;Lo;0;L;;;;;N;;;;;
+1202;ETHIOPIC SYLLABLE HI;Lo;0;L;;;;;N;;;;;
+1203;ETHIOPIC SYLLABLE HAA;Lo;0;L;;;;;N;;;;;
+1204;ETHIOPIC SYLLABLE HEE;Lo;0;L;;;;;N;;;;;
+1205;ETHIOPIC SYLLABLE HE;Lo;0;L;;;;;N;;;;;
+1206;ETHIOPIC SYLLABLE HO;Lo;0;L;;;;;N;;;;;
+1207;ETHIOPIC SYLLABLE HOA;Lo;0;L;;;;;N;;;;;
+1208;ETHIOPIC SYLLABLE LA;Lo;0;L;;;;;N;;;;;
+1209;ETHIOPIC SYLLABLE LU;Lo;0;L;;;;;N;;;;;
+120A;ETHIOPIC SYLLABLE LI;Lo;0;L;;;;;N;;;;;
+120B;ETHIOPIC SYLLABLE LAA;Lo;0;L;;;;;N;;;;;
+120C;ETHIOPIC SYLLABLE LEE;Lo;0;L;;;;;N;;;;;
+120D;ETHIOPIC SYLLABLE LE;Lo;0;L;;;;;N;;;;;
+120E;ETHIOPIC SYLLABLE LO;Lo;0;L;;;;;N;;;;;
+120F;ETHIOPIC SYLLABLE LWA;Lo;0;L;;;;;N;;;;;
+1210;ETHIOPIC SYLLABLE HHA;Lo;0;L;;;;;N;;;;;
+1211;ETHIOPIC SYLLABLE HHU;Lo;0;L;;;;;N;;;;;
+1212;ETHIOPIC SYLLABLE HHI;Lo;0;L;;;;;N;;;;;
+1213;ETHIOPIC SYLLABLE HHAA;Lo;0;L;;;;;N;;;;;
+1214;ETHIOPIC SYLLABLE HHEE;Lo;0;L;;;;;N;;;;;
+1215;ETHIOPIC SYLLABLE HHE;Lo;0;L;;;;;N;;;;;
+1216;ETHIOPIC SYLLABLE HHO;Lo;0;L;;;;;N;;;;;
+1217;ETHIOPIC SYLLABLE HHWA;Lo;0;L;;;;;N;;;;;
+1218;ETHIOPIC SYLLABLE MA;Lo;0;L;;;;;N;;;;;
+1219;ETHIOPIC SYLLABLE MU;Lo;0;L;;;;;N;;;;;
+121A;ETHIOPIC SYLLABLE MI;Lo;0;L;;;;;N;;;;;
+121B;ETHIOPIC SYLLABLE MAA;Lo;0;L;;;;;N;;;;;
+121C;ETHIOPIC SYLLABLE MEE;Lo;0;L;;;;;N;;;;;
+121D;ETHIOPIC SYLLABLE ME;Lo;0;L;;;;;N;;;;;
+121E;ETHIOPIC SYLLABLE MO;Lo;0;L;;;;;N;;;;;
+121F;ETHIOPIC SYLLABLE MWA;Lo;0;L;;;;;N;;;;;
+1220;ETHIOPIC SYLLABLE SZA;Lo;0;L;;;;;N;;;;;
+1221;ETHIOPIC SYLLABLE SZU;Lo;0;L;;;;;N;;;;;
+1222;ETHIOPIC SYLLABLE SZI;Lo;0;L;;;;;N;;;;;
+1223;ETHIOPIC SYLLABLE SZAA;Lo;0;L;;;;;N;;;;;
+1224;ETHIOPIC SYLLABLE SZEE;Lo;0;L;;;;;N;;;;;
+1225;ETHIOPIC SYLLABLE SZE;Lo;0;L;;;;;N;;;;;
+1226;ETHIOPIC SYLLABLE SZO;Lo;0;L;;;;;N;;;;;
+1227;ETHIOPIC SYLLABLE SZWA;Lo;0;L;;;;;N;;;;;
+1228;ETHIOPIC SYLLABLE RA;Lo;0;L;;;;;N;;;;;
+1229;ETHIOPIC SYLLABLE RU;Lo;0;L;;;;;N;;;;;
+122A;ETHIOPIC SYLLABLE RI;Lo;0;L;;;;;N;;;;;
+122B;ETHIOPIC SYLLABLE RAA;Lo;0;L;;;;;N;;;;;
+122C;ETHIOPIC SYLLABLE REE;Lo;0;L;;;;;N;;;;;
+122D;ETHIOPIC SYLLABLE RE;Lo;0;L;;;;;N;;;;;
+122E;ETHIOPIC SYLLABLE RO;Lo;0;L;;;;;N;;;;;
+122F;ETHIOPIC SYLLABLE RWA;Lo;0;L;;;;;N;;;;;
+1230;ETHIOPIC SYLLABLE SA;Lo;0;L;;;;;N;;;;;
+1231;ETHIOPIC SYLLABLE SU;Lo;0;L;;;;;N;;;;;
+1232;ETHIOPIC SYLLABLE SI;Lo;0;L;;;;;N;;;;;
+1233;ETHIOPIC SYLLABLE SAA;Lo;0;L;;;;;N;;;;;
+1234;ETHIOPIC SYLLABLE SEE;Lo;0;L;;;;;N;;;;;
+1235;ETHIOPIC SYLLABLE SE;Lo;0;L;;;;;N;;;;;
+1236;ETHIOPIC SYLLABLE SO;Lo;0;L;;;;;N;;;;;
+1237;ETHIOPIC SYLLABLE SWA;Lo;0;L;;;;;N;;;;;
+1238;ETHIOPIC SYLLABLE SHA;Lo;0;L;;;;;N;;;;;
+1239;ETHIOPIC SYLLABLE SHU;Lo;0;L;;;;;N;;;;;
+123A;ETHIOPIC SYLLABLE SHI;Lo;0;L;;;;;N;;;;;
+123B;ETHIOPIC SYLLABLE SHAA;Lo;0;L;;;;;N;;;;;
+123C;ETHIOPIC SYLLABLE SHEE;Lo;0;L;;;;;N;;;;;
+123D;ETHIOPIC SYLLABLE SHE;Lo;0;L;;;;;N;;;;;
+123E;ETHIOPIC SYLLABLE SHO;Lo;0;L;;;;;N;;;;;
+123F;ETHIOPIC SYLLABLE SHWA;Lo;0;L;;;;;N;;;;;
+1240;ETHIOPIC SYLLABLE QA;Lo;0;L;;;;;N;;;;;
+1241;ETHIOPIC SYLLABLE QU;Lo;0;L;;;;;N;;;;;
+1242;ETHIOPIC SYLLABLE QI;Lo;0;L;;;;;N;;;;;
+1243;ETHIOPIC SYLLABLE QAA;Lo;0;L;;;;;N;;;;;
+1244;ETHIOPIC SYLLABLE QEE;Lo;0;L;;;;;N;;;;;
+1245;ETHIOPIC SYLLABLE QE;Lo;0;L;;;;;N;;;;;
+1246;ETHIOPIC SYLLABLE QO;Lo;0;L;;;;;N;;;;;
+1247;ETHIOPIC SYLLABLE QOA;Lo;0;L;;;;;N;;;;;
+1248;ETHIOPIC SYLLABLE QWA;Lo;0;L;;;;;N;;;;;
+124A;ETHIOPIC SYLLABLE QWI;Lo;0;L;;;;;N;;;;;
+124B;ETHIOPIC SYLLABLE QWAA;Lo;0;L;;;;;N;;;;;
+124C;ETHIOPIC SYLLABLE QWEE;Lo;0;L;;;;;N;;;;;
+124D;ETHIOPIC SYLLABLE QWE;Lo;0;L;;;;;N;;;;;
+1250;ETHIOPIC SYLLABLE QHA;Lo;0;L;;;;;N;;;;;
+1251;ETHIOPIC SYLLABLE QHU;Lo;0;L;;;;;N;;;;;
+1252;ETHIOPIC SYLLABLE QHI;Lo;0;L;;;;;N;;;;;
+1253;ETHIOPIC SYLLABLE QHAA;Lo;0;L;;;;;N;;;;;
+1254;ETHIOPIC SYLLABLE QHEE;Lo;0;L;;;;;N;;;;;
+1255;ETHIOPIC SYLLABLE QHE;Lo;0;L;;;;;N;;;;;
+1256;ETHIOPIC SYLLABLE QHO;Lo;0;L;;;;;N;;;;;
+1258;ETHIOPIC SYLLABLE QHWA;Lo;0;L;;;;;N;;;;;
+125A;ETHIOPIC SYLLABLE QHWI;Lo;0;L;;;;;N;;;;;
+125B;ETHIOPIC SYLLABLE QHWAA;Lo;0;L;;;;;N;;;;;
+125C;ETHIOPIC SYLLABLE QHWEE;Lo;0;L;;;;;N;;;;;
+125D;ETHIOPIC SYLLABLE QHWE;Lo;0;L;;;;;N;;;;;
+1260;ETHIOPIC SYLLABLE BA;Lo;0;L;;;;;N;;;;;
+1261;ETHIOPIC SYLLABLE BU;Lo;0;L;;;;;N;;;;;
+1262;ETHIOPIC SYLLABLE BI;Lo;0;L;;;;;N;;;;;
+1263;ETHIOPIC SYLLABLE BAA;Lo;0;L;;;;;N;;;;;
+1264;ETHIOPIC SYLLABLE BEE;Lo;0;L;;;;;N;;;;;
+1265;ETHIOPIC SYLLABLE BE;Lo;0;L;;;;;N;;;;;
+1266;ETHIOPIC SYLLABLE BO;Lo;0;L;;;;;N;;;;;
+1267;ETHIOPIC SYLLABLE BWA;Lo;0;L;;;;;N;;;;;
+1268;ETHIOPIC SYLLABLE VA;Lo;0;L;;;;;N;;;;;
+1269;ETHIOPIC SYLLABLE VU;Lo;0;L;;;;;N;;;;;
+126A;ETHIOPIC SYLLABLE VI;Lo;0;L;;;;;N;;;;;
+126B;ETHIOPIC SYLLABLE VAA;Lo;0;L;;;;;N;;;;;
+126C;ETHIOPIC SYLLABLE VEE;Lo;0;L;;;;;N;;;;;
+126D;ETHIOPIC SYLLABLE VE;Lo;0;L;;;;;N;;;;;
+126E;ETHIOPIC SYLLABLE VO;Lo;0;L;;;;;N;;;;;
+126F;ETHIOPIC SYLLABLE VWA;Lo;0;L;;;;;N;;;;;
+1270;ETHIOPIC SYLLABLE TA;Lo;0;L;;;;;N;;;;;
+1271;ETHIOPIC SYLLABLE TU;Lo;0;L;;;;;N;;;;;
+1272;ETHIOPIC SYLLABLE TI;Lo;0;L;;;;;N;;;;;
+1273;ETHIOPIC SYLLABLE TAA;Lo;0;L;;;;;N;;;;;
+1274;ETHIOPIC SYLLABLE TEE;Lo;0;L;;;;;N;;;;;
+1275;ETHIOPIC SYLLABLE TE;Lo;0;L;;;;;N;;;;;
+1276;ETHIOPIC SYLLABLE TO;Lo;0;L;;;;;N;;;;;
+1277;ETHIOPIC SYLLABLE TWA;Lo;0;L;;;;;N;;;;;
+1278;ETHIOPIC SYLLABLE CA;Lo;0;L;;;;;N;;;;;
+1279;ETHIOPIC SYLLABLE CU;Lo;0;L;;;;;N;;;;;
+127A;ETHIOPIC SYLLABLE CI;Lo;0;L;;;;;N;;;;;
+127B;ETHIOPIC SYLLABLE CAA;Lo;0;L;;;;;N;;;;;
+127C;ETHIOPIC SYLLABLE CEE;Lo;0;L;;;;;N;;;;;
+127D;ETHIOPIC SYLLABLE CE;Lo;0;L;;;;;N;;;;;
+127E;ETHIOPIC SYLLABLE CO;Lo;0;L;;;;;N;;;;;
+127F;ETHIOPIC SYLLABLE CWA;Lo;0;L;;;;;N;;;;;
+1280;ETHIOPIC SYLLABLE XA;Lo;0;L;;;;;N;;;;;
+1281;ETHIOPIC SYLLABLE XU;Lo;0;L;;;;;N;;;;;
+1282;ETHIOPIC SYLLABLE XI;Lo;0;L;;;;;N;;;;;
+1283;ETHIOPIC SYLLABLE XAA;Lo;0;L;;;;;N;;;;;
+1284;ETHIOPIC SYLLABLE XEE;Lo;0;L;;;;;N;;;;;
+1285;ETHIOPIC SYLLABLE XE;Lo;0;L;;;;;N;;;;;
+1286;ETHIOPIC SYLLABLE XO;Lo;0;L;;;;;N;;;;;
+1287;ETHIOPIC SYLLABLE XOA;Lo;0;L;;;;;N;;;;;
+1288;ETHIOPIC SYLLABLE XWA;Lo;0;L;;;;;N;;;;;
+128A;ETHIOPIC SYLLABLE XWI;Lo;0;L;;;;;N;;;;;
+128B;ETHIOPIC SYLLABLE XWAA;Lo;0;L;;;;;N;;;;;
+128C;ETHIOPIC SYLLABLE XWEE;Lo;0;L;;;;;N;;;;;
+128D;ETHIOPIC SYLLABLE XWE;Lo;0;L;;;;;N;;;;;
+1290;ETHIOPIC SYLLABLE NA;Lo;0;L;;;;;N;;;;;
+1291;ETHIOPIC SYLLABLE NU;Lo;0;L;;;;;N;;;;;
+1292;ETHIOPIC SYLLABLE NI;Lo;0;L;;;;;N;;;;;
+1293;ETHIOPIC SYLLABLE NAA;Lo;0;L;;;;;N;;;;;
+1294;ETHIOPIC SYLLABLE NEE;Lo;0;L;;;;;N;;;;;
+1295;ETHIOPIC SYLLABLE NE;Lo;0;L;;;;;N;;;;;
+1296;ETHIOPIC SYLLABLE NO;Lo;0;L;;;;;N;;;;;
+1297;ETHIOPIC SYLLABLE NWA;Lo;0;L;;;;;N;;;;;
+1298;ETHIOPIC SYLLABLE NYA;Lo;0;L;;;;;N;;;;;
+1299;ETHIOPIC SYLLABLE NYU;Lo;0;L;;;;;N;;;;;
+129A;ETHIOPIC SYLLABLE NYI;Lo;0;L;;;;;N;;;;;
+129B;ETHIOPIC SYLLABLE NYAA;Lo;0;L;;;;;N;;;;;
+129C;ETHIOPIC SYLLABLE NYEE;Lo;0;L;;;;;N;;;;;
+129D;ETHIOPIC SYLLABLE NYE;Lo;0;L;;;;;N;;;;;
+129E;ETHIOPIC SYLLABLE NYO;Lo;0;L;;;;;N;;;;;
+129F;ETHIOPIC SYLLABLE NYWA;Lo;0;L;;;;;N;;;;;
+12A0;ETHIOPIC SYLLABLE GLOTTAL A;Lo;0;L;;;;;N;;;;;
+12A1;ETHIOPIC SYLLABLE GLOTTAL U;Lo;0;L;;;;;N;;;;;
+12A2;ETHIOPIC SYLLABLE GLOTTAL I;Lo;0;L;;;;;N;;;;;
+12A3;ETHIOPIC SYLLABLE GLOTTAL AA;Lo;0;L;;;;;N;;;;;
+12A4;ETHIOPIC SYLLABLE GLOTTAL EE;Lo;0;L;;;;;N;;;;;
+12A5;ETHIOPIC SYLLABLE GLOTTAL E;Lo;0;L;;;;;N;;;;;
+12A6;ETHIOPIC SYLLABLE GLOTTAL O;Lo;0;L;;;;;N;;;;;
+12A7;ETHIOPIC SYLLABLE GLOTTAL WA;Lo;0;L;;;;;N;;;;;
+12A8;ETHIOPIC SYLLABLE KA;Lo;0;L;;;;;N;;;;;
+12A9;ETHIOPIC SYLLABLE KU;Lo;0;L;;;;;N;;;;;
+12AA;ETHIOPIC SYLLABLE KI;Lo;0;L;;;;;N;;;;;
+12AB;ETHIOPIC SYLLABLE KAA;Lo;0;L;;;;;N;;;;;
+12AC;ETHIOPIC SYLLABLE KEE;Lo;0;L;;;;;N;;;;;
+12AD;ETHIOPIC SYLLABLE KE;Lo;0;L;;;;;N;;;;;
+12AE;ETHIOPIC SYLLABLE KO;Lo;0;L;;;;;N;;;;;
+12AF;ETHIOPIC SYLLABLE KOA;Lo;0;L;;;;;N;;;;;
+12B0;ETHIOPIC SYLLABLE KWA;Lo;0;L;;;;;N;;;;;
+12B2;ETHIOPIC SYLLABLE KWI;Lo;0;L;;;;;N;;;;;
+12B3;ETHIOPIC SYLLABLE KWAA;Lo;0;L;;;;;N;;;;;
+12B4;ETHIOPIC SYLLABLE KWEE;Lo;0;L;;;;;N;;;;;
+12B5;ETHIOPIC SYLLABLE KWE;Lo;0;L;;;;;N;;;;;
+12B8;ETHIOPIC SYLLABLE KXA;Lo;0;L;;;;;N;;;;;
+12B9;ETHIOPIC SYLLABLE KXU;Lo;0;L;;;;;N;;;;;
+12BA;ETHIOPIC SYLLABLE KXI;Lo;0;L;;;;;N;;;;;
+12BB;ETHIOPIC SYLLABLE KXAA;Lo;0;L;;;;;N;;;;;
+12BC;ETHIOPIC SYLLABLE KXEE;Lo;0;L;;;;;N;;;;;
+12BD;ETHIOPIC SYLLABLE KXE;Lo;0;L;;;;;N;;;;;
+12BE;ETHIOPIC SYLLABLE KXO;Lo;0;L;;;;;N;;;;;
+12C0;ETHIOPIC SYLLABLE KXWA;Lo;0;L;;;;;N;;;;;
+12C2;ETHIOPIC SYLLABLE KXWI;Lo;0;L;;;;;N;;;;;
+12C3;ETHIOPIC SYLLABLE KXWAA;Lo;0;L;;;;;N;;;;;
+12C4;ETHIOPIC SYLLABLE KXWEE;Lo;0;L;;;;;N;;;;;
+12C5;ETHIOPIC SYLLABLE KXWE;Lo;0;L;;;;;N;;;;;
+12C8;ETHIOPIC SYLLABLE WA;Lo;0;L;;;;;N;;;;;
+12C9;ETHIOPIC SYLLABLE WU;Lo;0;L;;;;;N;;;;;
+12CA;ETHIOPIC SYLLABLE WI;Lo;0;L;;;;;N;;;;;
+12CB;ETHIOPIC SYLLABLE WAA;Lo;0;L;;;;;N;;;;;
+12CC;ETHIOPIC SYLLABLE WEE;Lo;0;L;;;;;N;;;;;
+12CD;ETHIOPIC SYLLABLE WE;Lo;0;L;;;;;N;;;;;
+12CE;ETHIOPIC SYLLABLE WO;Lo;0;L;;;;;N;;;;;
+12CF;ETHIOPIC SYLLABLE WOA;Lo;0;L;;;;;N;;;;;
+12D0;ETHIOPIC SYLLABLE PHARYNGEAL A;Lo;0;L;;;;;N;;;;;
+12D1;ETHIOPIC SYLLABLE PHARYNGEAL U;Lo;0;L;;;;;N;;;;;
+12D2;ETHIOPIC SYLLABLE PHARYNGEAL I;Lo;0;L;;;;;N;;;;;
+12D3;ETHIOPIC SYLLABLE PHARYNGEAL AA;Lo;0;L;;;;;N;;;;;
+12D4;ETHIOPIC SYLLABLE PHARYNGEAL EE;Lo;0;L;;;;;N;;;;;
+12D5;ETHIOPIC SYLLABLE PHARYNGEAL E;Lo;0;L;;;;;N;;;;;
+12D6;ETHIOPIC SYLLABLE PHARYNGEAL O;Lo;0;L;;;;;N;;;;;
+12D8;ETHIOPIC SYLLABLE ZA;Lo;0;L;;;;;N;;;;;
+12D9;ETHIOPIC SYLLABLE ZU;Lo;0;L;;;;;N;;;;;
+12DA;ETHIOPIC SYLLABLE ZI;Lo;0;L;;;;;N;;;;;
+12DB;ETHIOPIC SYLLABLE ZAA;Lo;0;L;;;;;N;;;;;
+12DC;ETHIOPIC SYLLABLE ZEE;Lo;0;L;;;;;N;;;;;
+12DD;ETHIOPIC SYLLABLE ZE;Lo;0;L;;;;;N;;;;;
+12DE;ETHIOPIC SYLLABLE ZO;Lo;0;L;;;;;N;;;;;
+12DF;ETHIOPIC SYLLABLE ZWA;Lo;0;L;;;;;N;;;;;
+12E0;ETHIOPIC SYLLABLE ZHA;Lo;0;L;;;;;N;;;;;
+12E1;ETHIOPIC SYLLABLE ZHU;Lo;0;L;;;;;N;;;;;
+12E2;ETHIOPIC SYLLABLE ZHI;Lo;0;L;;;;;N;;;;;
+12E3;ETHIOPIC SYLLABLE ZHAA;Lo;0;L;;;;;N;;;;;
+12E4;ETHIOPIC SYLLABLE ZHEE;Lo;0;L;;;;;N;;;;;
+12E5;ETHIOPIC SYLLABLE ZHE;Lo;0;L;;;;;N;;;;;
+12E6;ETHIOPIC SYLLABLE ZHO;Lo;0;L;;;;;N;;;;;
+12E7;ETHIOPIC SYLLABLE ZHWA;Lo;0;L;;;;;N;;;;;
+12E8;ETHIOPIC SYLLABLE YA;Lo;0;L;;;;;N;;;;;
+12E9;ETHIOPIC SYLLABLE YU;Lo;0;L;;;;;N;;;;;
+12EA;ETHIOPIC SYLLABLE YI;Lo;0;L;;;;;N;;;;;
+12EB;ETHIOPIC SYLLABLE YAA;Lo;0;L;;;;;N;;;;;
+12EC;ETHIOPIC SYLLABLE YEE;Lo;0;L;;;;;N;;;;;
+12ED;ETHIOPIC SYLLABLE YE;Lo;0;L;;;;;N;;;;;
+12EE;ETHIOPIC SYLLABLE YO;Lo;0;L;;;;;N;;;;;
+12EF;ETHIOPIC SYLLABLE YOA;Lo;0;L;;;;;N;;;;;
+12F0;ETHIOPIC SYLLABLE DA;Lo;0;L;;;;;N;;;;;
+12F1;ETHIOPIC SYLLABLE DU;Lo;0;L;;;;;N;;;;;
+12F2;ETHIOPIC SYLLABLE DI;Lo;0;L;;;;;N;;;;;
+12F3;ETHIOPIC SYLLABLE DAA;Lo;0;L;;;;;N;;;;;
+12F4;ETHIOPIC SYLLABLE DEE;Lo;0;L;;;;;N;;;;;
+12F5;ETHIOPIC SYLLABLE DE;Lo;0;L;;;;;N;;;;;
+12F6;ETHIOPIC SYLLABLE DO;Lo;0;L;;;;;N;;;;;
+12F7;ETHIOPIC SYLLABLE DWA;Lo;0;L;;;;;N;;;;;
+12F8;ETHIOPIC SYLLABLE DDA;Lo;0;L;;;;;N;;;;;
+12F9;ETHIOPIC SYLLABLE DDU;Lo;0;L;;;;;N;;;;;
+12FA;ETHIOPIC SYLLABLE DDI;Lo;0;L;;;;;N;;;;;
+12FB;ETHIOPIC SYLLABLE DDAA;Lo;0;L;;;;;N;;;;;
+12FC;ETHIOPIC SYLLABLE DDEE;Lo;0;L;;;;;N;;;;;
+12FD;ETHIOPIC SYLLABLE DDE;Lo;0;L;;;;;N;;;;;
+12FE;ETHIOPIC SYLLABLE DDO;Lo;0;L;;;;;N;;;;;
+12FF;ETHIOPIC SYLLABLE DDWA;Lo;0;L;;;;;N;;;;;
+1300;ETHIOPIC SYLLABLE JA;Lo;0;L;;;;;N;;;;;
+1301;ETHIOPIC SYLLABLE JU;Lo;0;L;;;;;N;;;;;
+1302;ETHIOPIC SYLLABLE JI;Lo;0;L;;;;;N;;;;;
+1303;ETHIOPIC SYLLABLE JAA;Lo;0;L;;;;;N;;;;;
+1304;ETHIOPIC SYLLABLE JEE;Lo;0;L;;;;;N;;;;;
+1305;ETHIOPIC SYLLABLE JE;Lo;0;L;;;;;N;;;;;
+1306;ETHIOPIC SYLLABLE JO;Lo;0;L;;;;;N;;;;;
+1307;ETHIOPIC SYLLABLE JWA;Lo;0;L;;;;;N;;;;;
+1308;ETHIOPIC SYLLABLE GA;Lo;0;L;;;;;N;;;;;
+1309;ETHIOPIC SYLLABLE GU;Lo;0;L;;;;;N;;;;;
+130A;ETHIOPIC SYLLABLE GI;Lo;0;L;;;;;N;;;;;
+130B;ETHIOPIC SYLLABLE GAA;Lo;0;L;;;;;N;;;;;
+130C;ETHIOPIC SYLLABLE GEE;Lo;0;L;;;;;N;;;;;
+130D;ETHIOPIC SYLLABLE GE;Lo;0;L;;;;;N;;;;;
+130E;ETHIOPIC SYLLABLE GO;Lo;0;L;;;;;N;;;;;
+130F;ETHIOPIC SYLLABLE GOA;Lo;0;L;;;;;N;;;;;
+1310;ETHIOPIC SYLLABLE GWA;Lo;0;L;;;;;N;;;;;
+1312;ETHIOPIC SYLLABLE GWI;Lo;0;L;;;;;N;;;;;
+1313;ETHIOPIC SYLLABLE GWAA;Lo;0;L;;;;;N;;;;;
+1314;ETHIOPIC SYLLABLE GWEE;Lo;0;L;;;;;N;;;;;
+1315;ETHIOPIC SYLLABLE GWE;Lo;0;L;;;;;N;;;;;
+1318;ETHIOPIC SYLLABLE GGA;Lo;0;L;;;;;N;;;;;
+1319;ETHIOPIC SYLLABLE GGU;Lo;0;L;;;;;N;;;;;
+131A;ETHIOPIC SYLLABLE GGI;Lo;0;L;;;;;N;;;;;
+131B;ETHIOPIC SYLLABLE GGAA;Lo;0;L;;;;;N;;;;;
+131C;ETHIOPIC SYLLABLE GGEE;Lo;0;L;;;;;N;;;;;
+131D;ETHIOPIC SYLLABLE GGE;Lo;0;L;;;;;N;;;;;
+131E;ETHIOPIC SYLLABLE GGO;Lo;0;L;;;;;N;;;;;
+131F;ETHIOPIC SYLLABLE GGWAA;Lo;0;L;;;;;N;;;;;
+1320;ETHIOPIC SYLLABLE THA;Lo;0;L;;;;;N;;;;;
+1321;ETHIOPIC SYLLABLE THU;Lo;0;L;;;;;N;;;;;
+1322;ETHIOPIC SYLLABLE THI;Lo;0;L;;;;;N;;;;;
+1323;ETHIOPIC SYLLABLE THAA;Lo;0;L;;;;;N;;;;;
+1324;ETHIOPIC SYLLABLE THEE;Lo;0;L;;;;;N;;;;;
+1325;ETHIOPIC SYLLABLE THE;Lo;0;L;;;;;N;;;;;
+1326;ETHIOPIC SYLLABLE THO;Lo;0;L;;;;;N;;;;;
+1327;ETHIOPIC SYLLABLE THWA;Lo;0;L;;;;;N;;;;;
+1328;ETHIOPIC SYLLABLE CHA;Lo;0;L;;;;;N;;;;;
+1329;ETHIOPIC SYLLABLE CHU;Lo;0;L;;;;;N;;;;;
+132A;ETHIOPIC SYLLABLE CHI;Lo;0;L;;;;;N;;;;;
+132B;ETHIOPIC SYLLABLE CHAA;Lo;0;L;;;;;N;;;;;
+132C;ETHIOPIC SYLLABLE CHEE;Lo;0;L;;;;;N;;;;;
+132D;ETHIOPIC SYLLABLE CHE;Lo;0;L;;;;;N;;;;;
+132E;ETHIOPIC SYLLABLE CHO;Lo;0;L;;;;;N;;;;;
+132F;ETHIOPIC SYLLABLE CHWA;Lo;0;L;;;;;N;;;;;
+1330;ETHIOPIC SYLLABLE PHA;Lo;0;L;;;;;N;;;;;
+1331;ETHIOPIC SYLLABLE PHU;Lo;0;L;;;;;N;;;;;
+1332;ETHIOPIC SYLLABLE PHI;Lo;0;L;;;;;N;;;;;
+1333;ETHIOPIC SYLLABLE PHAA;Lo;0;L;;;;;N;;;;;
+1334;ETHIOPIC SYLLABLE PHEE;Lo;0;L;;;;;N;;;;;
+1335;ETHIOPIC SYLLABLE PHE;Lo;0;L;;;;;N;;;;;
+1336;ETHIOPIC SYLLABLE PHO;Lo;0;L;;;;;N;;;;;
+1337;ETHIOPIC SYLLABLE PHWA;Lo;0;L;;;;;N;;;;;
+1338;ETHIOPIC SYLLABLE TSA;Lo;0;L;;;;;N;;;;;
+1339;ETHIOPIC SYLLABLE TSU;Lo;0;L;;;;;N;;;;;
+133A;ETHIOPIC SYLLABLE TSI;Lo;0;L;;;;;N;;;;;
+133B;ETHIOPIC SYLLABLE TSAA;Lo;0;L;;;;;N;;;;;
+133C;ETHIOPIC SYLLABLE TSEE;Lo;0;L;;;;;N;;;;;
+133D;ETHIOPIC SYLLABLE TSE;Lo;0;L;;;;;N;;;;;
+133E;ETHIOPIC SYLLABLE TSO;Lo;0;L;;;;;N;;;;;
+133F;ETHIOPIC SYLLABLE TSWA;Lo;0;L;;;;;N;;;;;
+1340;ETHIOPIC SYLLABLE TZA;Lo;0;L;;;;;N;;;;;
+1341;ETHIOPIC SYLLABLE TZU;Lo;0;L;;;;;N;;;;;
+1342;ETHIOPIC SYLLABLE TZI;Lo;0;L;;;;;N;;;;;
+1343;ETHIOPIC SYLLABLE TZAA;Lo;0;L;;;;;N;;;;;
+1344;ETHIOPIC SYLLABLE TZEE;Lo;0;L;;;;;N;;;;;
+1345;ETHIOPIC SYLLABLE TZE;Lo;0;L;;;;;N;;;;;
+1346;ETHIOPIC SYLLABLE TZO;Lo;0;L;;;;;N;;;;;
+1347;ETHIOPIC SYLLABLE TZOA;Lo;0;L;;;;;N;;;;;
+1348;ETHIOPIC SYLLABLE FA;Lo;0;L;;;;;N;;;;;
+1349;ETHIOPIC SYLLABLE FU;Lo;0;L;;;;;N;;;;;
+134A;ETHIOPIC SYLLABLE FI;Lo;0;L;;;;;N;;;;;
+134B;ETHIOPIC SYLLABLE FAA;Lo;0;L;;;;;N;;;;;
+134C;ETHIOPIC SYLLABLE FEE;Lo;0;L;;;;;N;;;;;
+134D;ETHIOPIC SYLLABLE FE;Lo;0;L;;;;;N;;;;;
+134E;ETHIOPIC SYLLABLE FO;Lo;0;L;;;;;N;;;;;
+134F;ETHIOPIC SYLLABLE FWA;Lo;0;L;;;;;N;;;;;
+1350;ETHIOPIC SYLLABLE PA;Lo;0;L;;;;;N;;;;;
+1351;ETHIOPIC SYLLABLE PU;Lo;0;L;;;;;N;;;;;
+1352;ETHIOPIC SYLLABLE PI;Lo;0;L;;;;;N;;;;;
+1353;ETHIOPIC SYLLABLE PAA;Lo;0;L;;;;;N;;;;;
+1354;ETHIOPIC SYLLABLE PEE;Lo;0;L;;;;;N;;;;;
+1355;ETHIOPIC SYLLABLE PE;Lo;0;L;;;;;N;;;;;
+1356;ETHIOPIC SYLLABLE PO;Lo;0;L;;;;;N;;;;;
+1357;ETHIOPIC SYLLABLE PWA;Lo;0;L;;;;;N;;;;;
+1358;ETHIOPIC SYLLABLE RYA;Lo;0;L;;;;;N;;;;;
+1359;ETHIOPIC SYLLABLE MYA;Lo;0;L;;;;;N;;;;;
+135A;ETHIOPIC SYLLABLE FYA;Lo;0;L;;;;;N;;;;;
+135F;ETHIOPIC COMBINING GEMINATION MARK;Mn;230;NSM;;;;;N;;;;;
+1360;ETHIOPIC SECTION MARK;So;0;L;;;;;N;;;;;
+1361;ETHIOPIC WORDSPACE;Po;0;L;;;;;N;;;;;
+1362;ETHIOPIC FULL STOP;Po;0;L;;;;;N;;;;;
+1363;ETHIOPIC COMMA;Po;0;L;;;;;N;;;;;
+1364;ETHIOPIC SEMICOLON;Po;0;L;;;;;N;;;;;
+1365;ETHIOPIC COLON;Po;0;L;;;;;N;;;;;
+1366;ETHIOPIC PREFACE COLON;Po;0;L;;;;;N;;;;;
+1367;ETHIOPIC QUESTION MARK;Po;0;L;;;;;N;;;;;
+1368;ETHIOPIC PARAGRAPH SEPARATOR;Po;0;L;;;;;N;;;;;
+1369;ETHIOPIC DIGIT ONE;No;0;L;;;1;1;N;;;;;
+136A;ETHIOPIC DIGIT TWO;No;0;L;;;2;2;N;;;;;
+136B;ETHIOPIC DIGIT THREE;No;0;L;;;3;3;N;;;;;
+136C;ETHIOPIC DIGIT FOUR;No;0;L;;;4;4;N;;;;;
+136D;ETHIOPIC DIGIT FIVE;No;0;L;;;5;5;N;;;;;
+136E;ETHIOPIC DIGIT SIX;No;0;L;;;6;6;N;;;;;
+136F;ETHIOPIC DIGIT SEVEN;No;0;L;;;7;7;N;;;;;
+1370;ETHIOPIC DIGIT EIGHT;No;0;L;;;8;8;N;;;;;
+1371;ETHIOPIC DIGIT NINE;No;0;L;;;9;9;N;;;;;
+1372;ETHIOPIC NUMBER TEN;No;0;L;;;;10;N;;;;;
+1373;ETHIOPIC NUMBER TWENTY;No;0;L;;;;20;N;;;;;
+1374;ETHIOPIC NUMBER THIRTY;No;0;L;;;;30;N;;;;;
+1375;ETHIOPIC NUMBER FORTY;No;0;L;;;;40;N;;;;;
+1376;ETHIOPIC NUMBER FIFTY;No;0;L;;;;50;N;;;;;
+1377;ETHIOPIC NUMBER SIXTY;No;0;L;;;;60;N;;;;;
+1378;ETHIOPIC NUMBER SEVENTY;No;0;L;;;;70;N;;;;;
+1379;ETHIOPIC NUMBER EIGHTY;No;0;L;;;;80;N;;;;;
+137A;ETHIOPIC NUMBER NINETY;No;0;L;;;;90;N;;;;;
+137B;ETHIOPIC NUMBER HUNDRED;No;0;L;;;;100;N;;;;;
+137C;ETHIOPIC NUMBER TEN THOUSAND;No;0;L;;;;10000;N;;;;;
+1380;ETHIOPIC SYLLABLE SEBATBEIT MWA;Lo;0;L;;;;;N;;;;;
+1381;ETHIOPIC SYLLABLE MWI;Lo;0;L;;;;;N;;;;;
+1382;ETHIOPIC SYLLABLE MWEE;Lo;0;L;;;;;N;;;;;
+1383;ETHIOPIC SYLLABLE MWE;Lo;0;L;;;;;N;;;;;
+1384;ETHIOPIC SYLLABLE SEBATBEIT BWA;Lo;0;L;;;;;N;;;;;
+1385;ETHIOPIC SYLLABLE BWI;Lo;0;L;;;;;N;;;;;
+1386;ETHIOPIC SYLLABLE BWEE;Lo;0;L;;;;;N;;;;;
+1387;ETHIOPIC SYLLABLE BWE;Lo;0;L;;;;;N;;;;;
+1388;ETHIOPIC SYLLABLE SEBATBEIT FWA;Lo;0;L;;;;;N;;;;;
+1389;ETHIOPIC SYLLABLE FWI;Lo;0;L;;;;;N;;;;;
+138A;ETHIOPIC SYLLABLE FWEE;Lo;0;L;;;;;N;;;;;
+138B;ETHIOPIC SYLLABLE FWE;Lo;0;L;;;;;N;;;;;
+138C;ETHIOPIC SYLLABLE SEBATBEIT PWA;Lo;0;L;;;;;N;;;;;
+138D;ETHIOPIC SYLLABLE PWI;Lo;0;L;;;;;N;;;;;
+138E;ETHIOPIC SYLLABLE PWEE;Lo;0;L;;;;;N;;;;;
+138F;ETHIOPIC SYLLABLE PWE;Lo;0;L;;;;;N;;;;;
+1390;ETHIOPIC TONAL MARK YIZET;So;0;ON;;;;;N;;;;;
+1391;ETHIOPIC TONAL MARK DERET;So;0;ON;;;;;N;;;;;
+1392;ETHIOPIC TONAL MARK RIKRIK;So;0;ON;;;;;N;;;;;
+1393;ETHIOPIC TONAL MARK SHORT RIKRIK;So;0;ON;;;;;N;;;;;
+1394;ETHIOPIC TONAL MARK DIFAT;So;0;ON;;;;;N;;;;;
+1395;ETHIOPIC TONAL MARK KENAT;So;0;ON;;;;;N;;;;;
+1396;ETHIOPIC TONAL MARK CHIRET;So;0;ON;;;;;N;;;;;
+1397;ETHIOPIC TONAL MARK HIDET;So;0;ON;;;;;N;;;;;
+1398;ETHIOPIC TONAL MARK DERET-HIDET;So;0;ON;;;;;N;;;;;
+1399;ETHIOPIC TONAL MARK KURT;So;0;ON;;;;;N;;;;;
+13A0;CHEROKEE LETTER A;Lo;0;L;;;;;N;;;;;
+13A1;CHEROKEE LETTER E;Lo;0;L;;;;;N;;;;;
+13A2;CHEROKEE LETTER I;Lo;0;L;;;;;N;;;;;
+13A3;CHEROKEE LETTER O;Lo;0;L;;;;;N;;;;;
+13A4;CHEROKEE LETTER U;Lo;0;L;;;;;N;;;;;
+13A5;CHEROKEE LETTER V;Lo;0;L;;;;;N;;;;;
+13A6;CHEROKEE LETTER GA;Lo;0;L;;;;;N;;;;;
+13A7;CHEROKEE LETTER KA;Lo;0;L;;;;;N;;;;;
+13A8;CHEROKEE LETTER GE;Lo;0;L;;;;;N;;;;;
+13A9;CHEROKEE LETTER GI;Lo;0;L;;;;;N;;;;;
+13AA;CHEROKEE LETTER GO;Lo;0;L;;;;;N;;;;;
+13AB;CHEROKEE LETTER GU;Lo;0;L;;;;;N;;;;;
+13AC;CHEROKEE LETTER GV;Lo;0;L;;;;;N;;;;;
+13AD;CHEROKEE LETTER HA;Lo;0;L;;;;;N;;;;;
+13AE;CHEROKEE LETTER HE;Lo;0;L;;;;;N;;;;;
+13AF;CHEROKEE LETTER HI;Lo;0;L;;;;;N;;;;;
+13B0;CHEROKEE LETTER HO;Lo;0;L;;;;;N;;;;;
+13B1;CHEROKEE LETTER HU;Lo;0;L;;;;;N;;;;;
+13B2;CHEROKEE LETTER HV;Lo;0;L;;;;;N;;;;;
+13B3;CHEROKEE LETTER LA;Lo;0;L;;;;;N;;;;;
+13B4;CHEROKEE LETTER LE;Lo;0;L;;;;;N;;;;;
+13B5;CHEROKEE LETTER LI;Lo;0;L;;;;;N;;;;;
+13B6;CHEROKEE LETTER LO;Lo;0;L;;;;;N;;;;;
+13B7;CHEROKEE LETTER LU;Lo;0;L;;;;;N;;;;;
+13B8;CHEROKEE LETTER LV;Lo;0;L;;;;;N;;;;;
+13B9;CHEROKEE LETTER MA;Lo;0;L;;;;;N;;;;;
+13BA;CHEROKEE LETTER ME;Lo;0;L;;;;;N;;;;;
+13BB;CHEROKEE LETTER MI;Lo;0;L;;;;;N;;;;;
+13BC;CHEROKEE LETTER MO;Lo;0;L;;;;;N;;;;;
+13BD;CHEROKEE LETTER MU;Lo;0;L;;;;;N;;;;;
+13BE;CHEROKEE LETTER NA;Lo;0;L;;;;;N;;;;;
+13BF;CHEROKEE LETTER HNA;Lo;0;L;;;;;N;;;;;
+13C0;CHEROKEE LETTER NAH;Lo;0;L;;;;;N;;;;;
+13C1;CHEROKEE LETTER NE;Lo;0;L;;;;;N;;;;;
+13C2;CHEROKEE LETTER NI;Lo;0;L;;;;;N;;;;;
+13C3;CHEROKEE LETTER NO;Lo;0;L;;;;;N;;;;;
+13C4;CHEROKEE LETTER NU;Lo;0;L;;;;;N;;;;;
+13C5;CHEROKEE LETTER NV;Lo;0;L;;;;;N;;;;;
+13C6;CHEROKEE LETTER QUA;Lo;0;L;;;;;N;;;;;
+13C7;CHEROKEE LETTER QUE;Lo;0;L;;;;;N;;;;;
+13C8;CHEROKEE LETTER QUI;Lo;0;L;;;;;N;;;;;
+13C9;CHEROKEE LETTER QUO;Lo;0;L;;;;;N;;;;;
+13CA;CHEROKEE LETTER QUU;Lo;0;L;;;;;N;;;;;
+13CB;CHEROKEE LETTER QUV;Lo;0;L;;;;;N;;;;;
+13CC;CHEROKEE LETTER SA;Lo;0;L;;;;;N;;;;;
+13CD;CHEROKEE LETTER S;Lo;0;L;;;;;N;;;;;
+13CE;CHEROKEE LETTER SE;Lo;0;L;;;;;N;;;;;
+13CF;CHEROKEE LETTER SI;Lo;0;L;;;;;N;;;;;
+13D0;CHEROKEE LETTER SO;Lo;0;L;;;;;N;;;;;
+13D1;CHEROKEE LETTER SU;Lo;0;L;;;;;N;;;;;
+13D2;CHEROKEE LETTER SV;Lo;0;L;;;;;N;;;;;
+13D3;CHEROKEE LETTER DA;Lo;0;L;;;;;N;;;;;
+13D4;CHEROKEE LETTER TA;Lo;0;L;;;;;N;;;;;
+13D5;CHEROKEE LETTER DE;Lo;0;L;;;;;N;;;;;
+13D6;CHEROKEE LETTER TE;Lo;0;L;;;;;N;;;;;
+13D7;CHEROKEE LETTER DI;Lo;0;L;;;;;N;;;;;
+13D8;CHEROKEE LETTER TI;Lo;0;L;;;;;N;;;;;
+13D9;CHEROKEE LETTER DO;Lo;0;L;;;;;N;;;;;
+13DA;CHEROKEE LETTER DU;Lo;0;L;;;;;N;;;;;
+13DB;CHEROKEE LETTER DV;Lo;0;L;;;;;N;;;;;
+13DC;CHEROKEE LETTER DLA;Lo;0;L;;;;;N;;;;;
+13DD;CHEROKEE LETTER TLA;Lo;0;L;;;;;N;;;;;
+13DE;CHEROKEE LETTER TLE;Lo;0;L;;;;;N;;;;;
+13DF;CHEROKEE LETTER TLI;Lo;0;L;;;;;N;;;;;
+13E0;CHEROKEE LETTER TLO;Lo;0;L;;;;;N;;;;;
+13E1;CHEROKEE LETTER TLU;Lo;0;L;;;;;N;;;;;
+13E2;CHEROKEE LETTER TLV;Lo;0;L;;;;;N;;;;;
+13E3;CHEROKEE LETTER TSA;Lo;0;L;;;;;N;;;;;
+13E4;CHEROKEE LETTER TSE;Lo;0;L;;;;;N;;;;;
+13E5;CHEROKEE LETTER TSI;Lo;0;L;;;;;N;;;;;
+13E6;CHEROKEE LETTER TSO;Lo;0;L;;;;;N;;;;;
+13E7;CHEROKEE LETTER TSU;Lo;0;L;;;;;N;;;;;
+13E8;CHEROKEE LETTER TSV;Lo;0;L;;;;;N;;;;;
+13E9;CHEROKEE LETTER WA;Lo;0;L;;;;;N;;;;;
+13EA;CHEROKEE LETTER WE;Lo;0;L;;;;;N;;;;;
+13EB;CHEROKEE LETTER WI;Lo;0;L;;;;;N;;;;;
+13EC;CHEROKEE LETTER WO;Lo;0;L;;;;;N;;;;;
+13ED;CHEROKEE LETTER WU;Lo;0;L;;;;;N;;;;;
+13EE;CHEROKEE LETTER WV;Lo;0;L;;;;;N;;;;;
+13EF;CHEROKEE LETTER YA;Lo;0;L;;;;;N;;;;;
+13F0;CHEROKEE LETTER YE;Lo;0;L;;;;;N;;;;;
+13F1;CHEROKEE LETTER YI;Lo;0;L;;;;;N;;;;;
+13F2;CHEROKEE LETTER YO;Lo;0;L;;;;;N;;;;;
+13F3;CHEROKEE LETTER YU;Lo;0;L;;;;;N;;;;;
+13F4;CHEROKEE LETTER YV;Lo;0;L;;;;;N;;;;;
+1401;CANADIAN SYLLABICS E;Lo;0;L;;;;;N;;;;;
+1402;CANADIAN SYLLABICS AAI;Lo;0;L;;;;;N;;;;;
+1403;CANADIAN SYLLABICS I;Lo;0;L;;;;;N;;;;;
+1404;CANADIAN SYLLABICS II;Lo;0;L;;;;;N;;;;;
+1405;CANADIAN SYLLABICS O;Lo;0;L;;;;;N;;;;;
+1406;CANADIAN SYLLABICS OO;Lo;0;L;;;;;N;;;;;
+1407;CANADIAN SYLLABICS Y-CREE OO;Lo;0;L;;;;;N;;;;;
+1408;CANADIAN SYLLABICS CARRIER EE;Lo;0;L;;;;;N;;;;;
+1409;CANADIAN SYLLABICS CARRIER I;Lo;0;L;;;;;N;;;;;
+140A;CANADIAN SYLLABICS A;Lo;0;L;;;;;N;;;;;
+140B;CANADIAN SYLLABICS AA;Lo;0;L;;;;;N;;;;;
+140C;CANADIAN SYLLABICS WE;Lo;0;L;;;;;N;;;;;
+140D;CANADIAN SYLLABICS WEST-CREE WE;Lo;0;L;;;;;N;;;;;
+140E;CANADIAN SYLLABICS WI;Lo;0;L;;;;;N;;;;;
+140F;CANADIAN SYLLABICS WEST-CREE WI;Lo;0;L;;;;;N;;;;;
+1410;CANADIAN SYLLABICS WII;Lo;0;L;;;;;N;;;;;
+1411;CANADIAN SYLLABICS WEST-CREE WII;Lo;0;L;;;;;N;;;;;
+1412;CANADIAN SYLLABICS WO;Lo;0;L;;;;;N;;;;;
+1413;CANADIAN SYLLABICS WEST-CREE WO;Lo;0;L;;;;;N;;;;;
+1414;CANADIAN SYLLABICS WOO;Lo;0;L;;;;;N;;;;;
+1415;CANADIAN SYLLABICS WEST-CREE WOO;Lo;0;L;;;;;N;;;;;
+1416;CANADIAN SYLLABICS NASKAPI WOO;Lo;0;L;;;;;N;;;;;
+1417;CANADIAN SYLLABICS WA;Lo;0;L;;;;;N;;;;;
+1418;CANADIAN SYLLABICS WEST-CREE WA;Lo;0;L;;;;;N;;;;;
+1419;CANADIAN SYLLABICS WAA;Lo;0;L;;;;;N;;;;;
+141A;CANADIAN SYLLABICS WEST-CREE WAA;Lo;0;L;;;;;N;;;;;
+141B;CANADIAN SYLLABICS NASKAPI WAA;Lo;0;L;;;;;N;;;;;
+141C;CANADIAN SYLLABICS AI;Lo;0;L;;;;;N;;;;;
+141D;CANADIAN SYLLABICS Y-CREE W;Lo;0;L;;;;;N;;;;;
+141E;CANADIAN SYLLABICS GLOTTAL STOP;Lo;0;L;;;;;N;;;;;
+141F;CANADIAN SYLLABICS FINAL ACUTE;Lo;0;L;;;;;N;;;;;
+1420;CANADIAN SYLLABICS FINAL GRAVE;Lo;0;L;;;;;N;;;;;
+1421;CANADIAN SYLLABICS FINAL BOTTOM HALF RING;Lo;0;L;;;;;N;;;;;
+1422;CANADIAN SYLLABICS FINAL TOP HALF RING;Lo;0;L;;;;;N;;;;;
+1423;CANADIAN SYLLABICS FINAL RIGHT HALF RING;Lo;0;L;;;;;N;;;;;
+1424;CANADIAN SYLLABICS FINAL RING;Lo;0;L;;;;;N;;;;;
+1425;CANADIAN SYLLABICS FINAL DOUBLE ACUTE;Lo;0;L;;;;;N;;;;;
+1426;CANADIAN SYLLABICS FINAL DOUBLE SHORT VERTICAL STROKES;Lo;0;L;;;;;N;;;;;
+1427;CANADIAN SYLLABICS FINAL MIDDLE DOT;Lo;0;L;;;;;N;;;;;
+1428;CANADIAN SYLLABICS FINAL SHORT HORIZONTAL STROKE;Lo;0;L;;;;;N;;;;;
+1429;CANADIAN SYLLABICS FINAL PLUS;Lo;0;L;;;;;N;;;;;
+142A;CANADIAN SYLLABICS FINAL DOWN TACK;Lo;0;L;;;;;N;;;;;
+142B;CANADIAN SYLLABICS EN;Lo;0;L;;;;;N;;;;;
+142C;CANADIAN SYLLABICS IN;Lo;0;L;;;;;N;;;;;
+142D;CANADIAN SYLLABICS ON;Lo;0;L;;;;;N;;;;;
+142E;CANADIAN SYLLABICS AN;Lo;0;L;;;;;N;;;;;
+142F;CANADIAN SYLLABICS PE;Lo;0;L;;;;;N;;;;;
+1430;CANADIAN SYLLABICS PAAI;Lo;0;L;;;;;N;;;;;
+1431;CANADIAN SYLLABICS PI;Lo;0;L;;;;;N;;;;;
+1432;CANADIAN SYLLABICS PII;Lo;0;L;;;;;N;;;;;
+1433;CANADIAN SYLLABICS PO;Lo;0;L;;;;;N;;;;;
+1434;CANADIAN SYLLABICS POO;Lo;0;L;;;;;N;;;;;
+1435;CANADIAN SYLLABICS Y-CREE POO;Lo;0;L;;;;;N;;;;;
+1436;CANADIAN SYLLABICS CARRIER HEE;Lo;0;L;;;;;N;;;;;
+1437;CANADIAN SYLLABICS CARRIER HI;Lo;0;L;;;;;N;;;;;
+1438;CANADIAN SYLLABICS PA;Lo;0;L;;;;;N;;;;;
+1439;CANADIAN SYLLABICS PAA;Lo;0;L;;;;;N;;;;;
+143A;CANADIAN SYLLABICS PWE;Lo;0;L;;;;;N;;;;;
+143B;CANADIAN SYLLABICS WEST-CREE PWE;Lo;0;L;;;;;N;;;;;
+143C;CANADIAN SYLLABICS PWI;Lo;0;L;;;;;N;;;;;
+143D;CANADIAN SYLLABICS WEST-CREE PWI;Lo;0;L;;;;;N;;;;;
+143E;CANADIAN SYLLABICS PWII;Lo;0;L;;;;;N;;;;;
+143F;CANADIAN SYLLABICS WEST-CREE PWII;Lo;0;L;;;;;N;;;;;
+1440;CANADIAN SYLLABICS PWO;Lo;0;L;;;;;N;;;;;
+1441;CANADIAN SYLLABICS WEST-CREE PWO;Lo;0;L;;;;;N;;;;;
+1442;CANADIAN SYLLABICS PWOO;Lo;0;L;;;;;N;;;;;
+1443;CANADIAN SYLLABICS WEST-CREE PWOO;Lo;0;L;;;;;N;;;;;
+1444;CANADIAN SYLLABICS PWA;Lo;0;L;;;;;N;;;;;
+1445;CANADIAN SYLLABICS WEST-CREE PWA;Lo;0;L;;;;;N;;;;;
+1446;CANADIAN SYLLABICS PWAA;Lo;0;L;;;;;N;;;;;
+1447;CANADIAN SYLLABICS WEST-CREE PWAA;Lo;0;L;;;;;N;;;;;
+1448;CANADIAN SYLLABICS Y-CREE PWAA;Lo;0;L;;;;;N;;;;;
+1449;CANADIAN SYLLABICS P;Lo;0;L;;;;;N;;;;;
+144A;CANADIAN SYLLABICS WEST-CREE P;Lo;0;L;;;;;N;;;;;
+144B;CANADIAN SYLLABICS CARRIER H;Lo;0;L;;;;;N;;;;;
+144C;CANADIAN SYLLABICS TE;Lo;0;L;;;;;N;;;;;
+144D;CANADIAN SYLLABICS TAAI;Lo;0;L;;;;;N;;;;;
+144E;CANADIAN SYLLABICS TI;Lo;0;L;;;;;N;;;;;
+144F;CANADIAN SYLLABICS TII;Lo;0;L;;;;;N;;;;;
+1450;CANADIAN SYLLABICS TO;Lo;0;L;;;;;N;;;;;
+1451;CANADIAN SYLLABICS TOO;Lo;0;L;;;;;N;;;;;
+1452;CANADIAN SYLLABICS Y-CREE TOO;Lo;0;L;;;;;N;;;;;
+1453;CANADIAN SYLLABICS CARRIER DEE;Lo;0;L;;;;;N;;;;;
+1454;CANADIAN SYLLABICS CARRIER DI;Lo;0;L;;;;;N;;;;;
+1455;CANADIAN SYLLABICS TA;Lo;0;L;;;;;N;;;;;
+1456;CANADIAN SYLLABICS TAA;Lo;0;L;;;;;N;;;;;
+1457;CANADIAN SYLLABICS TWE;Lo;0;L;;;;;N;;;;;
+1458;CANADIAN SYLLABICS WEST-CREE TWE;Lo;0;L;;;;;N;;;;;
+1459;CANADIAN SYLLABICS TWI;Lo;0;L;;;;;N;;;;;
+145A;CANADIAN SYLLABICS WEST-CREE TWI;Lo;0;L;;;;;N;;;;;
+145B;CANADIAN SYLLABICS TWII;Lo;0;L;;;;;N;;;;;
+145C;CANADIAN SYLLABICS WEST-CREE TWII;Lo;0;L;;;;;N;;;;;
+145D;CANADIAN SYLLABICS TWO;Lo;0;L;;;;;N;;;;;
+145E;CANADIAN SYLLABICS WEST-CREE TWO;Lo;0;L;;;;;N;;;;;
+145F;CANADIAN SYLLABICS TWOO;Lo;0;L;;;;;N;;;;;
+1460;CANADIAN SYLLABICS WEST-CREE TWOO;Lo;0;L;;;;;N;;;;;
+1461;CANADIAN SYLLABICS TWA;Lo;0;L;;;;;N;;;;;
+1462;CANADIAN SYLLABICS WEST-CREE TWA;Lo;0;L;;;;;N;;;;;
+1463;CANADIAN SYLLABICS TWAA;Lo;0;L;;;;;N;;;;;
+1464;CANADIAN SYLLABICS WEST-CREE TWAA;Lo;0;L;;;;;N;;;;;
+1465;CANADIAN SYLLABICS NASKAPI TWAA;Lo;0;L;;;;;N;;;;;
+1466;CANADIAN SYLLABICS T;Lo;0;L;;;;;N;;;;;
+1467;CANADIAN SYLLABICS TTE;Lo;0;L;;;;;N;;;;;
+1468;CANADIAN SYLLABICS TTI;Lo;0;L;;;;;N;;;;;
+1469;CANADIAN SYLLABICS TTO;Lo;0;L;;;;;N;;;;;
+146A;CANADIAN SYLLABICS TTA;Lo;0;L;;;;;N;;;;;
+146B;CANADIAN SYLLABICS KE;Lo;0;L;;;;;N;;;;;
+146C;CANADIAN SYLLABICS KAAI;Lo;0;L;;;;;N;;;;;
+146D;CANADIAN SYLLABICS KI;Lo;0;L;;;;;N;;;;;
+146E;CANADIAN SYLLABICS KII;Lo;0;L;;;;;N;;;;;
+146F;CANADIAN SYLLABICS KO;Lo;0;L;;;;;N;;;;;
+1470;CANADIAN SYLLABICS KOO;Lo;0;L;;;;;N;;;;;
+1471;CANADIAN SYLLABICS Y-CREE KOO;Lo;0;L;;;;;N;;;;;
+1472;CANADIAN SYLLABICS KA;Lo;0;L;;;;;N;;;;;
+1473;CANADIAN SYLLABICS KAA;Lo;0;L;;;;;N;;;;;
+1474;CANADIAN SYLLABICS KWE;Lo;0;L;;;;;N;;;;;
+1475;CANADIAN SYLLABICS WEST-CREE KWE;Lo;0;L;;;;;N;;;;;
+1476;CANADIAN SYLLABICS KWI;Lo;0;L;;;;;N;;;;;
+1477;CANADIAN SYLLABICS WEST-CREE KWI;Lo;0;L;;;;;N;;;;;
+1478;CANADIAN SYLLABICS KWII;Lo;0;L;;;;;N;;;;;
+1479;CANADIAN SYLLABICS WEST-CREE KWII;Lo;0;L;;;;;N;;;;;
+147A;CANADIAN SYLLABICS KWO;Lo;0;L;;;;;N;;;;;
+147B;CANADIAN SYLLABICS WEST-CREE KWO;Lo;0;L;;;;;N;;;;;
+147C;CANADIAN SYLLABICS KWOO;Lo;0;L;;;;;N;;;;;
+147D;CANADIAN SYLLABICS WEST-CREE KWOO;Lo;0;L;;;;;N;;;;;
+147E;CANADIAN SYLLABICS KWA;Lo;0;L;;;;;N;;;;;
+147F;CANADIAN SYLLABICS WEST-CREE KWA;Lo;0;L;;;;;N;;;;;
+1480;CANADIAN SYLLABICS KWAA;Lo;0;L;;;;;N;;;;;
+1481;CANADIAN SYLLABICS WEST-CREE KWAA;Lo;0;L;;;;;N;;;;;
+1482;CANADIAN SYLLABICS NASKAPI KWAA;Lo;0;L;;;;;N;;;;;
+1483;CANADIAN SYLLABICS K;Lo;0;L;;;;;N;;;;;
+1484;CANADIAN SYLLABICS KW;Lo;0;L;;;;;N;;;;;
+1485;CANADIAN SYLLABICS SOUTH-SLAVEY KEH;Lo;0;L;;;;;N;;;;;
+1486;CANADIAN SYLLABICS SOUTH-SLAVEY KIH;Lo;0;L;;;;;N;;;;;
+1487;CANADIAN SYLLABICS SOUTH-SLAVEY KOH;Lo;0;L;;;;;N;;;;;
+1488;CANADIAN SYLLABICS SOUTH-SLAVEY KAH;Lo;0;L;;;;;N;;;;;
+1489;CANADIAN SYLLABICS CE;Lo;0;L;;;;;N;;;;;
+148A;CANADIAN SYLLABICS CAAI;Lo;0;L;;;;;N;;;;;
+148B;CANADIAN SYLLABICS CI;Lo;0;L;;;;;N;;;;;
+148C;CANADIAN SYLLABICS CII;Lo;0;L;;;;;N;;;;;
+148D;CANADIAN SYLLABICS CO;Lo;0;L;;;;;N;;;;;
+148E;CANADIAN SYLLABICS COO;Lo;0;L;;;;;N;;;;;
+148F;CANADIAN SYLLABICS Y-CREE COO;Lo;0;L;;;;;N;;;;;
+1490;CANADIAN SYLLABICS CA;Lo;0;L;;;;;N;;;;;
+1491;CANADIAN SYLLABICS CAA;Lo;0;L;;;;;N;;;;;
+1492;CANADIAN SYLLABICS CWE;Lo;0;L;;;;;N;;;;;
+1493;CANADIAN SYLLABICS WEST-CREE CWE;Lo;0;L;;;;;N;;;;;
+1494;CANADIAN SYLLABICS CWI;Lo;0;L;;;;;N;;;;;
+1495;CANADIAN SYLLABICS WEST-CREE CWI;Lo;0;L;;;;;N;;;;;
+1496;CANADIAN SYLLABICS CWII;Lo;0;L;;;;;N;;;;;
+1497;CANADIAN SYLLABICS WEST-CREE CWII;Lo;0;L;;;;;N;;;;;
+1498;CANADIAN SYLLABICS CWO;Lo;0;L;;;;;N;;;;;
+1499;CANADIAN SYLLABICS WEST-CREE CWO;Lo;0;L;;;;;N;;;;;
+149A;CANADIAN SYLLABICS CWOO;Lo;0;L;;;;;N;;;;;
+149B;CANADIAN SYLLABICS WEST-CREE CWOO;Lo;0;L;;;;;N;;;;;
+149C;CANADIAN SYLLABICS CWA;Lo;0;L;;;;;N;;;;;
+149D;CANADIAN SYLLABICS WEST-CREE CWA;Lo;0;L;;;;;N;;;;;
+149E;CANADIAN SYLLABICS CWAA;Lo;0;L;;;;;N;;;;;
+149F;CANADIAN SYLLABICS WEST-CREE CWAA;Lo;0;L;;;;;N;;;;;
+14A0;CANADIAN SYLLABICS NASKAPI CWAA;Lo;0;L;;;;;N;;;;;
+14A1;CANADIAN SYLLABICS C;Lo;0;L;;;;;N;;;;;
+14A2;CANADIAN SYLLABICS SAYISI TH;Lo;0;L;;;;;N;;;;;
+14A3;CANADIAN SYLLABICS ME;Lo;0;L;;;;;N;;;;;
+14A4;CANADIAN SYLLABICS MAAI;Lo;0;L;;;;;N;;;;;
+14A5;CANADIAN SYLLABICS MI;Lo;0;L;;;;;N;;;;;
+14A6;CANADIAN SYLLABICS MII;Lo;0;L;;;;;N;;;;;
+14A7;CANADIAN SYLLABICS MO;Lo;0;L;;;;;N;;;;;
+14A8;CANADIAN SYLLABICS MOO;Lo;0;L;;;;;N;;;;;
+14A9;CANADIAN SYLLABICS Y-CREE MOO;Lo;0;L;;;;;N;;;;;
+14AA;CANADIAN SYLLABICS MA;Lo;0;L;;;;;N;;;;;
+14AB;CANADIAN SYLLABICS MAA;Lo;0;L;;;;;N;;;;;
+14AC;CANADIAN SYLLABICS MWE;Lo;0;L;;;;;N;;;;;
+14AD;CANADIAN SYLLABICS WEST-CREE MWE;Lo;0;L;;;;;N;;;;;
+14AE;CANADIAN SYLLABICS MWI;Lo;0;L;;;;;N;;;;;
+14AF;CANADIAN SYLLABICS WEST-CREE MWI;Lo;0;L;;;;;N;;;;;
+14B0;CANADIAN SYLLABICS MWII;Lo;0;L;;;;;N;;;;;
+14B1;CANADIAN SYLLABICS WEST-CREE MWII;Lo;0;L;;;;;N;;;;;
+14B2;CANADIAN SYLLABICS MWO;Lo;0;L;;;;;N;;;;;
+14B3;CANADIAN SYLLABICS WEST-CREE MWO;Lo;0;L;;;;;N;;;;;
+14B4;CANADIAN SYLLABICS MWOO;Lo;0;L;;;;;N;;;;;
+14B5;CANADIAN SYLLABICS WEST-CREE MWOO;Lo;0;L;;;;;N;;;;;
+14B6;CANADIAN SYLLABICS MWA;Lo;0;L;;;;;N;;;;;
+14B7;CANADIAN SYLLABICS WEST-CREE MWA;Lo;0;L;;;;;N;;;;;
+14B8;CANADIAN SYLLABICS MWAA;Lo;0;L;;;;;N;;;;;
+14B9;CANADIAN SYLLABICS WEST-CREE MWAA;Lo;0;L;;;;;N;;;;;
+14BA;CANADIAN SYLLABICS NASKAPI MWAA;Lo;0;L;;;;;N;;;;;
+14BB;CANADIAN SYLLABICS M;Lo;0;L;;;;;N;;;;;
+14BC;CANADIAN SYLLABICS WEST-CREE M;Lo;0;L;;;;;N;;;;;
+14BD;CANADIAN SYLLABICS MH;Lo;0;L;;;;;N;;;;;
+14BE;CANADIAN SYLLABICS ATHAPASCAN M;Lo;0;L;;;;;N;;;;;
+14BF;CANADIAN SYLLABICS SAYISI M;Lo;0;L;;;;;N;;;;;
+14C0;CANADIAN SYLLABICS NE;Lo;0;L;;;;;N;;;;;
+14C1;CANADIAN SYLLABICS NAAI;Lo;0;L;;;;;N;;;;;
+14C2;CANADIAN SYLLABICS NI;Lo;0;L;;;;;N;;;;;
+14C3;CANADIAN SYLLABICS NII;Lo;0;L;;;;;N;;;;;
+14C4;CANADIAN SYLLABICS NO;Lo;0;L;;;;;N;;;;;
+14C5;CANADIAN SYLLABICS NOO;Lo;0;L;;;;;N;;;;;
+14C6;CANADIAN SYLLABICS Y-CREE NOO;Lo;0;L;;;;;N;;;;;
+14C7;CANADIAN SYLLABICS NA;Lo;0;L;;;;;N;;;;;
+14C8;CANADIAN SYLLABICS NAA;Lo;0;L;;;;;N;;;;;
+14C9;CANADIAN SYLLABICS NWE;Lo;0;L;;;;;N;;;;;
+14CA;CANADIAN SYLLABICS WEST-CREE NWE;Lo;0;L;;;;;N;;;;;
+14CB;CANADIAN SYLLABICS NWA;Lo;0;L;;;;;N;;;;;
+14CC;CANADIAN SYLLABICS WEST-CREE NWA;Lo;0;L;;;;;N;;;;;
+14CD;CANADIAN SYLLABICS NWAA;Lo;0;L;;;;;N;;;;;
+14CE;CANADIAN SYLLABICS WEST-CREE NWAA;Lo;0;L;;;;;N;;;;;
+14CF;CANADIAN SYLLABICS NASKAPI NWAA;Lo;0;L;;;;;N;;;;;
+14D0;CANADIAN SYLLABICS N;Lo;0;L;;;;;N;;;;;
+14D1;CANADIAN SYLLABICS CARRIER NG;Lo;0;L;;;;;N;;;;;
+14D2;CANADIAN SYLLABICS NH;Lo;0;L;;;;;N;;;;;
+14D3;CANADIAN SYLLABICS LE;Lo;0;L;;;;;N;;;;;
+14D4;CANADIAN SYLLABICS LAAI;Lo;0;L;;;;;N;;;;;
+14D5;CANADIAN SYLLABICS LI;Lo;0;L;;;;;N;;;;;
+14D6;CANADIAN SYLLABICS LII;Lo;0;L;;;;;N;;;;;
+14D7;CANADIAN SYLLABICS LO;Lo;0;L;;;;;N;;;;;
+14D8;CANADIAN SYLLABICS LOO;Lo;0;L;;;;;N;;;;;
+14D9;CANADIAN SYLLABICS Y-CREE LOO;Lo;0;L;;;;;N;;;;;
+14DA;CANADIAN SYLLABICS LA;Lo;0;L;;;;;N;;;;;
+14DB;CANADIAN SYLLABICS LAA;Lo;0;L;;;;;N;;;;;
+14DC;CANADIAN SYLLABICS LWE;Lo;0;L;;;;;N;;;;;
+14DD;CANADIAN SYLLABICS WEST-CREE LWE;Lo;0;L;;;;;N;;;;;
+14DE;CANADIAN SYLLABICS LWI;Lo;0;L;;;;;N;;;;;
+14DF;CANADIAN SYLLABICS WEST-CREE LWI;Lo;0;L;;;;;N;;;;;
+14E0;CANADIAN SYLLABICS LWII;Lo;0;L;;;;;N;;;;;
+14E1;CANADIAN SYLLABICS WEST-CREE LWII;Lo;0;L;;;;;N;;;;;
+14E2;CANADIAN SYLLABICS LWO;Lo;0;L;;;;;N;;;;;
+14E3;CANADIAN SYLLABICS WEST-CREE LWO;Lo;0;L;;;;;N;;;;;
+14E4;CANADIAN SYLLABICS LWOO;Lo;0;L;;;;;N;;;;;
+14E5;CANADIAN SYLLABICS WEST-CREE LWOO;Lo;0;L;;;;;N;;;;;
+14E6;CANADIAN SYLLABICS LWA;Lo;0;L;;;;;N;;;;;
+14E7;CANADIAN SYLLABICS WEST-CREE LWA;Lo;0;L;;;;;N;;;;;
+14E8;CANADIAN SYLLABICS LWAA;Lo;0;L;;;;;N;;;;;
+14E9;CANADIAN SYLLABICS WEST-CREE LWAA;Lo;0;L;;;;;N;;;;;
+14EA;CANADIAN SYLLABICS L;Lo;0;L;;;;;N;;;;;
+14EB;CANADIAN SYLLABICS WEST-CREE L;Lo;0;L;;;;;N;;;;;
+14EC;CANADIAN SYLLABICS MEDIAL L;Lo;0;L;;;;;N;;;;;
+14ED;CANADIAN SYLLABICS SE;Lo;0;L;;;;;N;;;;;
+14EE;CANADIAN SYLLABICS SAAI;Lo;0;L;;;;;N;;;;;
+14EF;CANADIAN SYLLABICS SI;Lo;0;L;;;;;N;;;;;
+14F0;CANADIAN SYLLABICS SII;Lo;0;L;;;;;N;;;;;
+14F1;CANADIAN SYLLABICS SO;Lo;0;L;;;;;N;;;;;
+14F2;CANADIAN SYLLABICS SOO;Lo;0;L;;;;;N;;;;;
+14F3;CANADIAN SYLLABICS Y-CREE SOO;Lo;0;L;;;;;N;;;;;
+14F4;CANADIAN SYLLABICS SA;Lo;0;L;;;;;N;;;;;
+14F5;CANADIAN SYLLABICS SAA;Lo;0;L;;;;;N;;;;;
+14F6;CANADIAN SYLLABICS SWE;Lo;0;L;;;;;N;;;;;
+14F7;CANADIAN SYLLABICS WEST-CREE SWE;Lo;0;L;;;;;N;;;;;
+14F8;CANADIAN SYLLABICS SWI;Lo;0;L;;;;;N;;;;;
+14F9;CANADIAN SYLLABICS WEST-CREE SWI;Lo;0;L;;;;;N;;;;;
+14FA;CANADIAN SYLLABICS SWII;Lo;0;L;;;;;N;;;;;
+14FB;CANADIAN SYLLABICS WEST-CREE SWII;Lo;0;L;;;;;N;;;;;
+14FC;CANADIAN SYLLABICS SWO;Lo;0;L;;;;;N;;;;;
+14FD;CANADIAN SYLLABICS WEST-CREE SWO;Lo;0;L;;;;;N;;;;;
+14FE;CANADIAN SYLLABICS SWOO;Lo;0;L;;;;;N;;;;;
+14FF;CANADIAN SYLLABICS WEST-CREE SWOO;Lo;0;L;;;;;N;;;;;
+1500;CANADIAN SYLLABICS SWA;Lo;0;L;;;;;N;;;;;
+1501;CANADIAN SYLLABICS WEST-CREE SWA;Lo;0;L;;;;;N;;;;;
+1502;CANADIAN SYLLABICS SWAA;Lo;0;L;;;;;N;;;;;
+1503;CANADIAN SYLLABICS WEST-CREE SWAA;Lo;0;L;;;;;N;;;;;
+1504;CANADIAN SYLLABICS NASKAPI SWAA;Lo;0;L;;;;;N;;;;;
+1505;CANADIAN SYLLABICS S;Lo;0;L;;;;;N;;;;;
+1506;CANADIAN SYLLABICS ATHAPASCAN S;Lo;0;L;;;;;N;;;;;
+1507;CANADIAN SYLLABICS SW;Lo;0;L;;;;;N;;;;;
+1508;CANADIAN SYLLABICS BLACKFOOT S;Lo;0;L;;;;;N;;;;;
+1509;CANADIAN SYLLABICS MOOSE-CREE SK;Lo;0;L;;;;;N;;;;;
+150A;CANADIAN SYLLABICS NASKAPI SKW;Lo;0;L;;;;;N;;;;;
+150B;CANADIAN SYLLABICS NASKAPI S-W;Lo;0;L;;;;;N;;;;;
+150C;CANADIAN SYLLABICS NASKAPI SPWA;Lo;0;L;;;;;N;;;;;
+150D;CANADIAN SYLLABICS NASKAPI STWA;Lo;0;L;;;;;N;;;;;
+150E;CANADIAN SYLLABICS NASKAPI SKWA;Lo;0;L;;;;;N;;;;;
+150F;CANADIAN SYLLABICS NASKAPI SCWA;Lo;0;L;;;;;N;;;;;
+1510;CANADIAN SYLLABICS SHE;Lo;0;L;;;;;N;;;;;
+1511;CANADIAN SYLLABICS SHI;Lo;0;L;;;;;N;;;;;
+1512;CANADIAN SYLLABICS SHII;Lo;0;L;;;;;N;;;;;
+1513;CANADIAN SYLLABICS SHO;Lo;0;L;;;;;N;;;;;
+1514;CANADIAN SYLLABICS SHOO;Lo;0;L;;;;;N;;;;;
+1515;CANADIAN SYLLABICS SHA;Lo;0;L;;;;;N;;;;;
+1516;CANADIAN SYLLABICS SHAA;Lo;0;L;;;;;N;;;;;
+1517;CANADIAN SYLLABICS SHWE;Lo;0;L;;;;;N;;;;;
+1518;CANADIAN SYLLABICS WEST-CREE SHWE;Lo;0;L;;;;;N;;;;;
+1519;CANADIAN SYLLABICS SHWI;Lo;0;L;;;;;N;;;;;
+151A;CANADIAN SYLLABICS WEST-CREE SHWI;Lo;0;L;;;;;N;;;;;
+151B;CANADIAN SYLLABICS SHWII;Lo;0;L;;;;;N;;;;;
+151C;CANADIAN SYLLABICS WEST-CREE SHWII;Lo;0;L;;;;;N;;;;;
+151D;CANADIAN SYLLABICS SHWO;Lo;0;L;;;;;N;;;;;
+151E;CANADIAN SYLLABICS WEST-CREE SHWO;Lo;0;L;;;;;N;;;;;
+151F;CANADIAN SYLLABICS SHWOO;Lo;0;L;;;;;N;;;;;
+1520;CANADIAN SYLLABICS WEST-CREE SHWOO;Lo;0;L;;;;;N;;;;;
+1521;CANADIAN SYLLABICS SHWA;Lo;0;L;;;;;N;;;;;
+1522;CANADIAN SYLLABICS WEST-CREE SHWA;Lo;0;L;;;;;N;;;;;
+1523;CANADIAN SYLLABICS SHWAA;Lo;0;L;;;;;N;;;;;
+1524;CANADIAN SYLLABICS WEST-CREE SHWAA;Lo;0;L;;;;;N;;;;;
+1525;CANADIAN SYLLABICS SH;Lo;0;L;;;;;N;;;;;
+1526;CANADIAN SYLLABICS YE;Lo;0;L;;;;;N;;;;;
+1527;CANADIAN SYLLABICS YAAI;Lo;0;L;;;;;N;;;;;
+1528;CANADIAN SYLLABICS YI;Lo;0;L;;;;;N;;;;;
+1529;CANADIAN SYLLABICS YII;Lo;0;L;;;;;N;;;;;
+152A;CANADIAN SYLLABICS YO;Lo;0;L;;;;;N;;;;;
+152B;CANADIAN SYLLABICS YOO;Lo;0;L;;;;;N;;;;;
+152C;CANADIAN SYLLABICS Y-CREE YOO;Lo;0;L;;;;;N;;;;;
+152D;CANADIAN SYLLABICS YA;Lo;0;L;;;;;N;;;;;
+152E;CANADIAN SYLLABICS YAA;Lo;0;L;;;;;N;;;;;
+152F;CANADIAN SYLLABICS YWE;Lo;0;L;;;;;N;;;;;
+1530;CANADIAN SYLLABICS WEST-CREE YWE;Lo;0;L;;;;;N;;;;;
+1531;CANADIAN SYLLABICS YWI;Lo;0;L;;;;;N;;;;;
+1532;CANADIAN SYLLABICS WEST-CREE YWI;Lo;0;L;;;;;N;;;;;
+1533;CANADIAN SYLLABICS YWII;Lo;0;L;;;;;N;;;;;
+1534;CANADIAN SYLLABICS WEST-CREE YWII;Lo;0;L;;;;;N;;;;;
+1535;CANADIAN SYLLABICS YWO;Lo;0;L;;;;;N;;;;;
+1536;CANADIAN SYLLABICS WEST-CREE YWO;Lo;0;L;;;;;N;;;;;
+1537;CANADIAN SYLLABICS YWOO;Lo;0;L;;;;;N;;;;;
+1538;CANADIAN SYLLABICS WEST-CREE YWOO;Lo;0;L;;;;;N;;;;;
+1539;CANADIAN SYLLABICS YWA;Lo;0;L;;;;;N;;;;;
+153A;CANADIAN SYLLABICS WEST-CREE YWA;Lo;0;L;;;;;N;;;;;
+153B;CANADIAN SYLLABICS YWAA;Lo;0;L;;;;;N;;;;;
+153C;CANADIAN SYLLABICS WEST-CREE YWAA;Lo;0;L;;;;;N;;;;;
+153D;CANADIAN SYLLABICS NASKAPI YWAA;Lo;0;L;;;;;N;;;;;
+153E;CANADIAN SYLLABICS Y;Lo;0;L;;;;;N;;;;;
+153F;CANADIAN SYLLABICS BIBLE-CREE Y;Lo;0;L;;;;;N;;;;;
+1540;CANADIAN SYLLABICS WEST-CREE Y;Lo;0;L;;;;;N;;;;;
+1541;CANADIAN SYLLABICS SAYISI YI;Lo;0;L;;;;;N;;;;;
+1542;CANADIAN SYLLABICS RE;Lo;0;L;;;;;N;;;;;
+1543;CANADIAN SYLLABICS R-CREE RE;Lo;0;L;;;;;N;;;;;
+1544;CANADIAN SYLLABICS WEST-CREE LE;Lo;0;L;;;;;N;;;;;
+1545;CANADIAN SYLLABICS RAAI;Lo;0;L;;;;;N;;;;;
+1546;CANADIAN SYLLABICS RI;Lo;0;L;;;;;N;;;;;
+1547;CANADIAN SYLLABICS RII;Lo;0;L;;;;;N;;;;;
+1548;CANADIAN SYLLABICS RO;Lo;0;L;;;;;N;;;;;
+1549;CANADIAN SYLLABICS ROO;Lo;0;L;;;;;N;;;;;
+154A;CANADIAN SYLLABICS WEST-CREE LO;Lo;0;L;;;;;N;;;;;
+154B;CANADIAN SYLLABICS RA;Lo;0;L;;;;;N;;;;;
+154C;CANADIAN SYLLABICS RAA;Lo;0;L;;;;;N;;;;;
+154D;CANADIAN SYLLABICS WEST-CREE LA;Lo;0;L;;;;;N;;;;;
+154E;CANADIAN SYLLABICS RWAA;Lo;0;L;;;;;N;;;;;
+154F;CANADIAN SYLLABICS WEST-CREE RWAA;Lo;0;L;;;;;N;;;;;
+1550;CANADIAN SYLLABICS R;Lo;0;L;;;;;N;;;;;
+1551;CANADIAN SYLLABICS WEST-CREE R;Lo;0;L;;;;;N;;;;;
+1552;CANADIAN SYLLABICS MEDIAL R;Lo;0;L;;;;;N;;;;;
+1553;CANADIAN SYLLABICS FE;Lo;0;L;;;;;N;;;;;
+1554;CANADIAN SYLLABICS FAAI;Lo;0;L;;;;;N;;;;;
+1555;CANADIAN SYLLABICS FI;Lo;0;L;;;;;N;;;;;
+1556;CANADIAN SYLLABICS FII;Lo;0;L;;;;;N;;;;;
+1557;CANADIAN SYLLABICS FO;Lo;0;L;;;;;N;;;;;
+1558;CANADIAN SYLLABICS FOO;Lo;0;L;;;;;N;;;;;
+1559;CANADIAN SYLLABICS FA;Lo;0;L;;;;;N;;;;;
+155A;CANADIAN SYLLABICS FAA;Lo;0;L;;;;;N;;;;;
+155B;CANADIAN SYLLABICS FWAA;Lo;0;L;;;;;N;;;;;
+155C;CANADIAN SYLLABICS WEST-CREE FWAA;Lo;0;L;;;;;N;;;;;
+155D;CANADIAN SYLLABICS F;Lo;0;L;;;;;N;;;;;
+155E;CANADIAN SYLLABICS THE;Lo;0;L;;;;;N;;;;;
+155F;CANADIAN SYLLABICS N-CREE THE;Lo;0;L;;;;;N;;;;;
+1560;CANADIAN SYLLABICS THI;Lo;0;L;;;;;N;;;;;
+1561;CANADIAN SYLLABICS N-CREE THI;Lo;0;L;;;;;N;;;;;
+1562;CANADIAN SYLLABICS THII;Lo;0;L;;;;;N;;;;;
+1563;CANADIAN SYLLABICS N-CREE THII;Lo;0;L;;;;;N;;;;;
+1564;CANADIAN SYLLABICS THO;Lo;0;L;;;;;N;;;;;
+1565;CANADIAN SYLLABICS THOO;Lo;0;L;;;;;N;;;;;
+1566;CANADIAN SYLLABICS THA;Lo;0;L;;;;;N;;;;;
+1567;CANADIAN SYLLABICS THAA;Lo;0;L;;;;;N;;;;;
+1568;CANADIAN SYLLABICS THWAA;Lo;0;L;;;;;N;;;;;
+1569;CANADIAN SYLLABICS WEST-CREE THWAA;Lo;0;L;;;;;N;;;;;
+156A;CANADIAN SYLLABICS TH;Lo;0;L;;;;;N;;;;;
+156B;CANADIAN SYLLABICS TTHE;Lo;0;L;;;;;N;;;;;
+156C;CANADIAN SYLLABICS TTHI;Lo;0;L;;;;;N;;;;;
+156D;CANADIAN SYLLABICS TTHO;Lo;0;L;;;;;N;;;;;
+156E;CANADIAN SYLLABICS TTHA;Lo;0;L;;;;;N;;;;;
+156F;CANADIAN SYLLABICS TTH;Lo;0;L;;;;;N;;;;;
+1570;CANADIAN SYLLABICS TYE;Lo;0;L;;;;;N;;;;;
+1571;CANADIAN SYLLABICS TYI;Lo;0;L;;;;;N;;;;;
+1572;CANADIAN SYLLABICS TYO;Lo;0;L;;;;;N;;;;;
+1573;CANADIAN SYLLABICS TYA;Lo;0;L;;;;;N;;;;;
+1574;CANADIAN SYLLABICS NUNAVIK HE;Lo;0;L;;;;;N;;;;;
+1575;CANADIAN SYLLABICS NUNAVIK HI;Lo;0;L;;;;;N;;;;;
+1576;CANADIAN SYLLABICS NUNAVIK HII;Lo;0;L;;;;;N;;;;;
+1577;CANADIAN SYLLABICS NUNAVIK HO;Lo;0;L;;;;;N;;;;;
+1578;CANADIAN SYLLABICS NUNAVIK HOO;Lo;0;L;;;;;N;;;;;
+1579;CANADIAN SYLLABICS NUNAVIK HA;Lo;0;L;;;;;N;;;;;
+157A;CANADIAN SYLLABICS NUNAVIK HAA;Lo;0;L;;;;;N;;;;;
+157B;CANADIAN SYLLABICS NUNAVIK H;Lo;0;L;;;;;N;;;;;
+157C;CANADIAN SYLLABICS NUNAVUT H;Lo;0;L;;;;;N;;;;;
+157D;CANADIAN SYLLABICS HK;Lo;0;L;;;;;N;;;;;
+157E;CANADIAN SYLLABICS QAAI;Lo;0;L;;;;;N;;;;;
+157F;CANADIAN SYLLABICS QI;Lo;0;L;;;;;N;;;;;
+1580;CANADIAN SYLLABICS QII;Lo;0;L;;;;;N;;;;;
+1581;CANADIAN SYLLABICS QO;Lo;0;L;;;;;N;;;;;
+1582;CANADIAN SYLLABICS QOO;Lo;0;L;;;;;N;;;;;
+1583;CANADIAN SYLLABICS QA;Lo;0;L;;;;;N;;;;;
+1584;CANADIAN SYLLABICS QAA;Lo;0;L;;;;;N;;;;;
+1585;CANADIAN SYLLABICS Q;Lo;0;L;;;;;N;;;;;
+1586;CANADIAN SYLLABICS TLHE;Lo;0;L;;;;;N;;;;;
+1587;CANADIAN SYLLABICS TLHI;Lo;0;L;;;;;N;;;;;
+1588;CANADIAN SYLLABICS TLHO;Lo;0;L;;;;;N;;;;;
+1589;CANADIAN SYLLABICS TLHA;Lo;0;L;;;;;N;;;;;
+158A;CANADIAN SYLLABICS WEST-CREE RE;Lo;0;L;;;;;N;;;;;
+158B;CANADIAN SYLLABICS WEST-CREE RI;Lo;0;L;;;;;N;;;;;
+158C;CANADIAN SYLLABICS WEST-CREE RO;Lo;0;L;;;;;N;;;;;
+158D;CANADIAN SYLLABICS WEST-CREE RA;Lo;0;L;;;;;N;;;;;
+158E;CANADIAN SYLLABICS NGAAI;Lo;0;L;;;;;N;;;;;
+158F;CANADIAN SYLLABICS NGI;Lo;0;L;;;;;N;;;;;
+1590;CANADIAN SYLLABICS NGII;Lo;0;L;;;;;N;;;;;
+1591;CANADIAN SYLLABICS NGO;Lo;0;L;;;;;N;;;;;
+1592;CANADIAN SYLLABICS NGOO;Lo;0;L;;;;;N;;;;;
+1593;CANADIAN SYLLABICS NGA;Lo;0;L;;;;;N;;;;;
+1594;CANADIAN SYLLABICS NGAA;Lo;0;L;;;;;N;;;;;
+1595;CANADIAN SYLLABICS NG;Lo;0;L;;;;;N;;;;;
+1596;CANADIAN SYLLABICS NNG;Lo;0;L;;;;;N;;;;;
+1597;CANADIAN SYLLABICS SAYISI SHE;Lo;0;L;;;;;N;;;;;
+1598;CANADIAN SYLLABICS SAYISI SHI;Lo;0;L;;;;;N;;;;;
+1599;CANADIAN SYLLABICS SAYISI SHO;Lo;0;L;;;;;N;;;;;
+159A;CANADIAN SYLLABICS SAYISI SHA;Lo;0;L;;;;;N;;;;;
+159B;CANADIAN SYLLABICS WOODS-CREE THE;Lo;0;L;;;;;N;;;;;
+159C;CANADIAN SYLLABICS WOODS-CREE THI;Lo;0;L;;;;;N;;;;;
+159D;CANADIAN SYLLABICS WOODS-CREE THO;Lo;0;L;;;;;N;;;;;
+159E;CANADIAN SYLLABICS WOODS-CREE THA;Lo;0;L;;;;;N;;;;;
+159F;CANADIAN SYLLABICS WOODS-CREE TH;Lo;0;L;;;;;N;;;;;
+15A0;CANADIAN SYLLABICS LHI;Lo;0;L;;;;;N;;;;;
+15A1;CANADIAN SYLLABICS LHII;Lo;0;L;;;;;N;;;;;
+15A2;CANADIAN SYLLABICS LHO;Lo;0;L;;;;;N;;;;;
+15A3;CANADIAN SYLLABICS LHOO;Lo;0;L;;;;;N;;;;;
+15A4;CANADIAN SYLLABICS LHA;Lo;0;L;;;;;N;;;;;
+15A5;CANADIAN SYLLABICS LHAA;Lo;0;L;;;;;N;;;;;
+15A6;CANADIAN SYLLABICS LH;Lo;0;L;;;;;N;;;;;
+15A7;CANADIAN SYLLABICS TH-CREE THE;Lo;0;L;;;;;N;;;;;
+15A8;CANADIAN SYLLABICS TH-CREE THI;Lo;0;L;;;;;N;;;;;
+15A9;CANADIAN SYLLABICS TH-CREE THII;Lo;0;L;;;;;N;;;;;
+15AA;CANADIAN SYLLABICS TH-CREE THO;Lo;0;L;;;;;N;;;;;
+15AB;CANADIAN SYLLABICS TH-CREE THOO;Lo;0;L;;;;;N;;;;;
+15AC;CANADIAN SYLLABICS TH-CREE THA;Lo;0;L;;;;;N;;;;;
+15AD;CANADIAN SYLLABICS TH-CREE THAA;Lo;0;L;;;;;N;;;;;
+15AE;CANADIAN SYLLABICS TH-CREE TH;Lo;0;L;;;;;N;;;;;
+15AF;CANADIAN SYLLABICS AIVILIK B;Lo;0;L;;;;;N;;;;;
+15B0;CANADIAN SYLLABICS BLACKFOOT E;Lo;0;L;;;;;N;;;;;
+15B1;CANADIAN SYLLABICS BLACKFOOT I;Lo;0;L;;;;;N;;;;;
+15B2;CANADIAN SYLLABICS BLACKFOOT O;Lo;0;L;;;;;N;;;;;
+15B3;CANADIAN SYLLABICS BLACKFOOT A;Lo;0;L;;;;;N;;;;;
+15B4;CANADIAN SYLLABICS BLACKFOOT WE;Lo;0;L;;;;;N;;;;;
+15B5;CANADIAN SYLLABICS BLACKFOOT WI;Lo;0;L;;;;;N;;;;;
+15B6;CANADIAN SYLLABICS BLACKFOOT WO;Lo;0;L;;;;;N;;;;;
+15B7;CANADIAN SYLLABICS BLACKFOOT WA;Lo;0;L;;;;;N;;;;;
+15B8;CANADIAN SYLLABICS BLACKFOOT NE;Lo;0;L;;;;;N;;;;;
+15B9;CANADIAN SYLLABICS BLACKFOOT NI;Lo;0;L;;;;;N;;;;;
+15BA;CANADIAN SYLLABICS BLACKFOOT NO;Lo;0;L;;;;;N;;;;;
+15BB;CANADIAN SYLLABICS BLACKFOOT NA;Lo;0;L;;;;;N;;;;;
+15BC;CANADIAN SYLLABICS BLACKFOOT KE;Lo;0;L;;;;;N;;;;;
+15BD;CANADIAN SYLLABICS BLACKFOOT KI;Lo;0;L;;;;;N;;;;;
+15BE;CANADIAN SYLLABICS BLACKFOOT KO;Lo;0;L;;;;;N;;;;;
+15BF;CANADIAN SYLLABICS BLACKFOOT KA;Lo;0;L;;;;;N;;;;;
+15C0;CANADIAN SYLLABICS SAYISI HE;Lo;0;L;;;;;N;;;;;
+15C1;CANADIAN SYLLABICS SAYISI HI;Lo;0;L;;;;;N;;;;;
+15C2;CANADIAN SYLLABICS SAYISI HO;Lo;0;L;;;;;N;;;;;
+15C3;CANADIAN SYLLABICS SAYISI HA;Lo;0;L;;;;;N;;;;;
+15C4;CANADIAN SYLLABICS CARRIER GHU;Lo;0;L;;;;;N;;;;;
+15C5;CANADIAN SYLLABICS CARRIER GHO;Lo;0;L;;;;;N;;;;;
+15C6;CANADIAN SYLLABICS CARRIER GHE;Lo;0;L;;;;;N;;;;;
+15C7;CANADIAN SYLLABICS CARRIER GHEE;Lo;0;L;;;;;N;;;;;
+15C8;CANADIAN SYLLABICS CARRIER GHI;Lo;0;L;;;;;N;;;;;
+15C9;CANADIAN SYLLABICS CARRIER GHA;Lo;0;L;;;;;N;;;;;
+15CA;CANADIAN SYLLABICS CARRIER RU;Lo;0;L;;;;;N;;;;;
+15CB;CANADIAN SYLLABICS CARRIER RO;Lo;0;L;;;;;N;;;;;
+15CC;CANADIAN SYLLABICS CARRIER RE;Lo;0;L;;;;;N;;;;;
+15CD;CANADIAN SYLLABICS CARRIER REE;Lo;0;L;;;;;N;;;;;
+15CE;CANADIAN SYLLABICS CARRIER RI;Lo;0;L;;;;;N;;;;;
+15CF;CANADIAN SYLLABICS CARRIER RA;Lo;0;L;;;;;N;;;;;
+15D0;CANADIAN SYLLABICS CARRIER WU;Lo;0;L;;;;;N;;;;;
+15D1;CANADIAN SYLLABICS CARRIER WO;Lo;0;L;;;;;N;;;;;
+15D2;CANADIAN SYLLABICS CARRIER WE;Lo;0;L;;;;;N;;;;;
+15D3;CANADIAN SYLLABICS CARRIER WEE;Lo;0;L;;;;;N;;;;;
+15D4;CANADIAN SYLLABICS CARRIER WI;Lo;0;L;;;;;N;;;;;
+15D5;CANADIAN SYLLABICS CARRIER WA;Lo;0;L;;;;;N;;;;;
+15D6;CANADIAN SYLLABICS CARRIER HWU;Lo;0;L;;;;;N;;;;;
+15D7;CANADIAN SYLLABICS CARRIER HWO;Lo;0;L;;;;;N;;;;;
+15D8;CANADIAN SYLLABICS CARRIER HWE;Lo;0;L;;;;;N;;;;;
+15D9;CANADIAN SYLLABICS CARRIER HWEE;Lo;0;L;;;;;N;;;;;
+15DA;CANADIAN SYLLABICS CARRIER HWI;Lo;0;L;;;;;N;;;;;
+15DB;CANADIAN SYLLABICS CARRIER HWA;Lo;0;L;;;;;N;;;;;
+15DC;CANADIAN SYLLABICS CARRIER THU;Lo;0;L;;;;;N;;;;;
+15DD;CANADIAN SYLLABICS CARRIER THO;Lo;0;L;;;;;N;;;;;
+15DE;CANADIAN SYLLABICS CARRIER THE;Lo;0;L;;;;;N;;;;;
+15DF;CANADIAN SYLLABICS CARRIER THEE;Lo;0;L;;;;;N;;;;;
+15E0;CANADIAN SYLLABICS CARRIER THI;Lo;0;L;;;;;N;;;;;
+15E1;CANADIAN SYLLABICS CARRIER THA;Lo;0;L;;;;;N;;;;;
+15E2;CANADIAN SYLLABICS CARRIER TTU;Lo;0;L;;;;;N;;;;;
+15E3;CANADIAN SYLLABICS CARRIER TTO;Lo;0;L;;;;;N;;;;;
+15E4;CANADIAN SYLLABICS CARRIER TTE;Lo;0;L;;;;;N;;;;;
+15E5;CANADIAN SYLLABICS CARRIER TTEE;Lo;0;L;;;;;N;;;;;
+15E6;CANADIAN SYLLABICS CARRIER TTI;Lo;0;L;;;;;N;;;;;
+15E7;CANADIAN SYLLABICS CARRIER TTA;Lo;0;L;;;;;N;;;;;
+15E8;CANADIAN SYLLABICS CARRIER PU;Lo;0;L;;;;;N;;;;;
+15E9;CANADIAN SYLLABICS CARRIER PO;Lo;0;L;;;;;N;;;;;
+15EA;CANADIAN SYLLABICS CARRIER PE;Lo;0;L;;;;;N;;;;;
+15EB;CANADIAN SYLLABICS CARRIER PEE;Lo;0;L;;;;;N;;;;;
+15EC;CANADIAN SYLLABICS CARRIER PI;Lo;0;L;;;;;N;;;;;
+15ED;CANADIAN SYLLABICS CARRIER PA;Lo;0;L;;;;;N;;;;;
+15EE;CANADIAN SYLLABICS CARRIER P;Lo;0;L;;;;;N;;;;;
+15EF;CANADIAN SYLLABICS CARRIER GU;Lo;0;L;;;;;N;;;;;
+15F0;CANADIAN SYLLABICS CARRIER GO;Lo;0;L;;;;;N;;;;;
+15F1;CANADIAN SYLLABICS CARRIER GE;Lo;0;L;;;;;N;;;;;
+15F2;CANADIAN SYLLABICS CARRIER GEE;Lo;0;L;;;;;N;;;;;
+15F3;CANADIAN SYLLABICS CARRIER GI;Lo;0;L;;;;;N;;;;;
+15F4;CANADIAN SYLLABICS CARRIER GA;Lo;0;L;;;;;N;;;;;
+15F5;CANADIAN SYLLABICS CARRIER KHU;Lo;0;L;;;;;N;;;;;
+15F6;CANADIAN SYLLABICS CARRIER KHO;Lo;0;L;;;;;N;;;;;
+15F7;CANADIAN SYLLABICS CARRIER KHE;Lo;0;L;;;;;N;;;;;
+15F8;CANADIAN SYLLABICS CARRIER KHEE;Lo;0;L;;;;;N;;;;;
+15F9;CANADIAN SYLLABICS CARRIER KHI;Lo;0;L;;;;;N;;;;;
+15FA;CANADIAN SYLLABICS CARRIER KHA;Lo;0;L;;;;;N;;;;;
+15FB;CANADIAN SYLLABICS CARRIER KKU;Lo;0;L;;;;;N;;;;;
+15FC;CANADIAN SYLLABICS CARRIER KKO;Lo;0;L;;;;;N;;;;;
+15FD;CANADIAN SYLLABICS CARRIER KKE;Lo;0;L;;;;;N;;;;;
+15FE;CANADIAN SYLLABICS CARRIER KKEE;Lo;0;L;;;;;N;;;;;
+15FF;CANADIAN SYLLABICS CARRIER KKI;Lo;0;L;;;;;N;;;;;
+1600;CANADIAN SYLLABICS CARRIER KKA;Lo;0;L;;;;;N;;;;;
+1601;CANADIAN SYLLABICS CARRIER KK;Lo;0;L;;;;;N;;;;;
+1602;CANADIAN SYLLABICS CARRIER NU;Lo;0;L;;;;;N;;;;;
+1603;CANADIAN SYLLABICS CARRIER NO;Lo;0;L;;;;;N;;;;;
+1604;CANADIAN SYLLABICS CARRIER NE;Lo;0;L;;;;;N;;;;;
+1605;CANADIAN SYLLABICS CARRIER NEE;Lo;0;L;;;;;N;;;;;
+1606;CANADIAN SYLLABICS CARRIER NI;Lo;0;L;;;;;N;;;;;
+1607;CANADIAN SYLLABICS CARRIER NA;Lo;0;L;;;;;N;;;;;
+1608;CANADIAN SYLLABICS CARRIER MU;Lo;0;L;;;;;N;;;;;
+1609;CANADIAN SYLLABICS CARRIER MO;Lo;0;L;;;;;N;;;;;
+160A;CANADIAN SYLLABICS CARRIER ME;Lo;0;L;;;;;N;;;;;
+160B;CANADIAN SYLLABICS CARRIER MEE;Lo;0;L;;;;;N;;;;;
+160C;CANADIAN SYLLABICS CARRIER MI;Lo;0;L;;;;;N;;;;;
+160D;CANADIAN SYLLABICS CARRIER MA;Lo;0;L;;;;;N;;;;;
+160E;CANADIAN SYLLABICS CARRIER YU;Lo;0;L;;;;;N;;;;;
+160F;CANADIAN SYLLABICS CARRIER YO;Lo;0;L;;;;;N;;;;;
+1610;CANADIAN SYLLABICS CARRIER YE;Lo;0;L;;;;;N;;;;;
+1611;CANADIAN SYLLABICS CARRIER YEE;Lo;0;L;;;;;N;;;;;
+1612;CANADIAN SYLLABICS CARRIER YI;Lo;0;L;;;;;N;;;;;
+1613;CANADIAN SYLLABICS CARRIER YA;Lo;0;L;;;;;N;;;;;
+1614;CANADIAN SYLLABICS CARRIER JU;Lo;0;L;;;;;N;;;;;
+1615;CANADIAN SYLLABICS SAYISI JU;Lo;0;L;;;;;N;;;;;
+1616;CANADIAN SYLLABICS CARRIER JO;Lo;0;L;;;;;N;;;;;
+1617;CANADIAN SYLLABICS CARRIER JE;Lo;0;L;;;;;N;;;;;
+1618;CANADIAN SYLLABICS CARRIER JEE;Lo;0;L;;;;;N;;;;;
+1619;CANADIAN SYLLABICS CARRIER JI;Lo;0;L;;;;;N;;;;;
+161A;CANADIAN SYLLABICS SAYISI JI;Lo;0;L;;;;;N;;;;;
+161B;CANADIAN SYLLABICS CARRIER JA;Lo;0;L;;;;;N;;;;;
+161C;CANADIAN SYLLABICS CARRIER JJU;Lo;0;L;;;;;N;;;;;
+161D;CANADIAN SYLLABICS CARRIER JJO;Lo;0;L;;;;;N;;;;;
+161E;CANADIAN SYLLABICS CARRIER JJE;Lo;0;L;;;;;N;;;;;
+161F;CANADIAN SYLLABICS CARRIER JJEE;Lo;0;L;;;;;N;;;;;
+1620;CANADIAN SYLLABICS CARRIER JJI;Lo;0;L;;;;;N;;;;;
+1621;CANADIAN SYLLABICS CARRIER JJA;Lo;0;L;;;;;N;;;;;
+1622;CANADIAN SYLLABICS CARRIER LU;Lo;0;L;;;;;N;;;;;
+1623;CANADIAN SYLLABICS CARRIER LO;Lo;0;L;;;;;N;;;;;
+1624;CANADIAN SYLLABICS CARRIER LE;Lo;0;L;;;;;N;;;;;
+1625;CANADIAN SYLLABICS CARRIER LEE;Lo;0;L;;;;;N;;;;;
+1626;CANADIAN SYLLABICS CARRIER LI;Lo;0;L;;;;;N;;;;;
+1627;CANADIAN SYLLABICS CARRIER LA;Lo;0;L;;;;;N;;;;;
+1628;CANADIAN SYLLABICS CARRIER DLU;Lo;0;L;;;;;N;;;;;
+1629;CANADIAN SYLLABICS CARRIER DLO;Lo;0;L;;;;;N;;;;;
+162A;CANADIAN SYLLABICS CARRIER DLE;Lo;0;L;;;;;N;;;;;
+162B;CANADIAN SYLLABICS CARRIER DLEE;Lo;0;L;;;;;N;;;;;
+162C;CANADIAN SYLLABICS CARRIER DLI;Lo;0;L;;;;;N;;;;;
+162D;CANADIAN SYLLABICS CARRIER DLA;Lo;0;L;;;;;N;;;;;
+162E;CANADIAN SYLLABICS CARRIER LHU;Lo;0;L;;;;;N;;;;;
+162F;CANADIAN SYLLABICS CARRIER LHO;Lo;0;L;;;;;N;;;;;
+1630;CANADIAN SYLLABICS CARRIER LHE;Lo;0;L;;;;;N;;;;;
+1631;CANADIAN SYLLABICS CARRIER LHEE;Lo;0;L;;;;;N;;;;;
+1632;CANADIAN SYLLABICS CARRIER LHI;Lo;0;L;;;;;N;;;;;
+1633;CANADIAN SYLLABICS CARRIER LHA;Lo;0;L;;;;;N;;;;;
+1634;CANADIAN SYLLABICS CARRIER TLHU;Lo;0;L;;;;;N;;;;;
+1635;CANADIAN SYLLABICS CARRIER TLHO;Lo;0;L;;;;;N;;;;;
+1636;CANADIAN SYLLABICS CARRIER TLHE;Lo;0;L;;;;;N;;;;;
+1637;CANADIAN SYLLABICS CARRIER TLHEE;Lo;0;L;;;;;N;;;;;
+1638;CANADIAN SYLLABICS CARRIER TLHI;Lo;0;L;;;;;N;;;;;
+1639;CANADIAN SYLLABICS CARRIER TLHA;Lo;0;L;;;;;N;;;;;
+163A;CANADIAN SYLLABICS CARRIER TLU;Lo;0;L;;;;;N;;;;;
+163B;CANADIAN SYLLABICS CARRIER TLO;Lo;0;L;;;;;N;;;;;
+163C;CANADIAN SYLLABICS CARRIER TLE;Lo;0;L;;;;;N;;;;;
+163D;CANADIAN SYLLABICS CARRIER TLEE;Lo;0;L;;;;;N;;;;;
+163E;CANADIAN SYLLABICS CARRIER TLI;Lo;0;L;;;;;N;;;;;
+163F;CANADIAN SYLLABICS CARRIER TLA;Lo;0;L;;;;;N;;;;;
+1640;CANADIAN SYLLABICS CARRIER ZU;Lo;0;L;;;;;N;;;;;
+1641;CANADIAN SYLLABICS CARRIER ZO;Lo;0;L;;;;;N;;;;;
+1642;CANADIAN SYLLABICS CARRIER ZE;Lo;0;L;;;;;N;;;;;
+1643;CANADIAN SYLLABICS CARRIER ZEE;Lo;0;L;;;;;N;;;;;
+1644;CANADIAN SYLLABICS CARRIER ZI;Lo;0;L;;;;;N;;;;;
+1645;CANADIAN SYLLABICS CARRIER ZA;Lo;0;L;;;;;N;;;;;
+1646;CANADIAN SYLLABICS CARRIER Z;Lo;0;L;;;;;N;;;;;
+1647;CANADIAN SYLLABICS CARRIER INITIAL Z;Lo;0;L;;;;;N;;;;;
+1648;CANADIAN SYLLABICS CARRIER DZU;Lo;0;L;;;;;N;;;;;
+1649;CANADIAN SYLLABICS CARRIER DZO;Lo;0;L;;;;;N;;;;;
+164A;CANADIAN SYLLABICS CARRIER DZE;Lo;0;L;;;;;N;;;;;
+164B;CANADIAN SYLLABICS CARRIER DZEE;Lo;0;L;;;;;N;;;;;
+164C;CANADIAN SYLLABICS CARRIER DZI;Lo;0;L;;;;;N;;;;;
+164D;CANADIAN SYLLABICS CARRIER DZA;Lo;0;L;;;;;N;;;;;
+164E;CANADIAN SYLLABICS CARRIER SU;Lo;0;L;;;;;N;;;;;
+164F;CANADIAN SYLLABICS CARRIER SO;Lo;0;L;;;;;N;;;;;
+1650;CANADIAN SYLLABICS CARRIER SE;Lo;0;L;;;;;N;;;;;
+1651;CANADIAN SYLLABICS CARRIER SEE;Lo;0;L;;;;;N;;;;;
+1652;CANADIAN SYLLABICS CARRIER SI;Lo;0;L;;;;;N;;;;;
+1653;CANADIAN SYLLABICS CARRIER SA;Lo;0;L;;;;;N;;;;;
+1654;CANADIAN SYLLABICS CARRIER SHU;Lo;0;L;;;;;N;;;;;
+1655;CANADIAN SYLLABICS CARRIER SHO;Lo;0;L;;;;;N;;;;;
+1656;CANADIAN SYLLABICS CARRIER SHE;Lo;0;L;;;;;N;;;;;
+1657;CANADIAN SYLLABICS CARRIER SHEE;Lo;0;L;;;;;N;;;;;
+1658;CANADIAN SYLLABICS CARRIER SHI;Lo;0;L;;;;;N;;;;;
+1659;CANADIAN SYLLABICS CARRIER SHA;Lo;0;L;;;;;N;;;;;
+165A;CANADIAN SYLLABICS CARRIER SH;Lo;0;L;;;;;N;;;;;
+165B;CANADIAN SYLLABICS CARRIER TSU;Lo;0;L;;;;;N;;;;;
+165C;CANADIAN SYLLABICS CARRIER TSO;Lo;0;L;;;;;N;;;;;
+165D;CANADIAN SYLLABICS CARRIER TSE;Lo;0;L;;;;;N;;;;;
+165E;CANADIAN SYLLABICS CARRIER TSEE;Lo;0;L;;;;;N;;;;;
+165F;CANADIAN SYLLABICS CARRIER TSI;Lo;0;L;;;;;N;;;;;
+1660;CANADIAN SYLLABICS CARRIER TSA;Lo;0;L;;;;;N;;;;;
+1661;CANADIAN SYLLABICS CARRIER CHU;Lo;0;L;;;;;N;;;;;
+1662;CANADIAN SYLLABICS CARRIER CHO;Lo;0;L;;;;;N;;;;;
+1663;CANADIAN SYLLABICS CARRIER CHE;Lo;0;L;;;;;N;;;;;
+1664;CANADIAN SYLLABICS CARRIER CHEE;Lo;0;L;;;;;N;;;;;
+1665;CANADIAN SYLLABICS CARRIER CHI;Lo;0;L;;;;;N;;;;;
+1666;CANADIAN SYLLABICS CARRIER CHA;Lo;0;L;;;;;N;;;;;
+1667;CANADIAN SYLLABICS CARRIER TTSU;Lo;0;L;;;;;N;;;;;
+1668;CANADIAN SYLLABICS CARRIER TTSO;Lo;0;L;;;;;N;;;;;
+1669;CANADIAN SYLLABICS CARRIER TTSE;Lo;0;L;;;;;N;;;;;
+166A;CANADIAN SYLLABICS CARRIER TTSEE;Lo;0;L;;;;;N;;;;;
+166B;CANADIAN SYLLABICS CARRIER TTSI;Lo;0;L;;;;;N;;;;;
+166C;CANADIAN SYLLABICS CARRIER TTSA;Lo;0;L;;;;;N;;;;;
+166D;CANADIAN SYLLABICS CHI SIGN;Po;0;L;;;;;N;;;;;
+166E;CANADIAN SYLLABICS FULL STOP;Po;0;L;;;;;N;;;;;
+166F;CANADIAN SYLLABICS QAI;Lo;0;L;;;;;N;;;;;
+1670;CANADIAN SYLLABICS NGAI;Lo;0;L;;;;;N;;;;;
+1671;CANADIAN SYLLABICS NNGI;Lo;0;L;;;;;N;;;;;
+1672;CANADIAN SYLLABICS NNGII;Lo;0;L;;;;;N;;;;;
+1673;CANADIAN SYLLABICS NNGO;Lo;0;L;;;;;N;;;;;
+1674;CANADIAN SYLLABICS NNGOO;Lo;0;L;;;;;N;;;;;
+1675;CANADIAN SYLLABICS NNGA;Lo;0;L;;;;;N;;;;;
+1676;CANADIAN SYLLABICS NNGAA;Lo;0;L;;;;;N;;;;;
+1680;OGHAM SPACE MARK;Zs;0;WS;;;;;N;;;;;
+1681;OGHAM LETTER BEITH;Lo;0;L;;;;;N;;;;;
+1682;OGHAM LETTER LUIS;Lo;0;L;;;;;N;;;;;
+1683;OGHAM LETTER FEARN;Lo;0;L;;;;;N;;;;;
+1684;OGHAM LETTER SAIL;Lo;0;L;;;;;N;;;;;
+1685;OGHAM LETTER NION;Lo;0;L;;;;;N;;;;;
+1686;OGHAM LETTER UATH;Lo;0;L;;;;;N;;;;;
+1687;OGHAM LETTER DAIR;Lo;0;L;;;;;N;;;;;
+1688;OGHAM LETTER TINNE;Lo;0;L;;;;;N;;;;;
+1689;OGHAM LETTER COLL;Lo;0;L;;;;;N;;;;;
+168A;OGHAM LETTER CEIRT;Lo;0;L;;;;;N;;;;;
+168B;OGHAM LETTER MUIN;Lo;0;L;;;;;N;;;;;
+168C;OGHAM LETTER GORT;Lo;0;L;;;;;N;;;;;
+168D;OGHAM LETTER NGEADAL;Lo;0;L;;;;;N;;;;;
+168E;OGHAM LETTER STRAIF;Lo;0;L;;;;;N;;;;;
+168F;OGHAM LETTER RUIS;Lo;0;L;;;;;N;;;;;
+1690;OGHAM LETTER AILM;Lo;0;L;;;;;N;;;;;
+1691;OGHAM LETTER ONN;Lo;0;L;;;;;N;;;;;
+1692;OGHAM LETTER UR;Lo;0;L;;;;;N;;;;;
+1693;OGHAM LETTER EADHADH;Lo;0;L;;;;;N;;;;;
+1694;OGHAM LETTER IODHADH;Lo;0;L;;;;;N;;;;;
+1695;OGHAM LETTER EABHADH;Lo;0;L;;;;;N;;;;;
+1696;OGHAM LETTER OR;Lo;0;L;;;;;N;;;;;
+1697;OGHAM LETTER UILLEANN;Lo;0;L;;;;;N;;;;;
+1698;OGHAM LETTER IFIN;Lo;0;L;;;;;N;;;;;
+1699;OGHAM LETTER EAMHANCHOLL;Lo;0;L;;;;;N;;;;;
+169A;OGHAM LETTER PEITH;Lo;0;L;;;;;N;;;;;
+169B;OGHAM FEATHER MARK;Ps;0;ON;;;;;Y;;;;;
+169C;OGHAM REVERSED FEATHER MARK;Pe;0;ON;;;;;Y;;;;;
+16A0;RUNIC LETTER FEHU FEOH FE F;Lo;0;L;;;;;N;;;;;
+16A1;RUNIC LETTER V;Lo;0;L;;;;;N;;;;;
+16A2;RUNIC LETTER URUZ UR U;Lo;0;L;;;;;N;;;;;
+16A3;RUNIC LETTER YR;Lo;0;L;;;;;N;;;;;
+16A4;RUNIC LETTER Y;Lo;0;L;;;;;N;;;;;
+16A5;RUNIC LETTER W;Lo;0;L;;;;;N;;;;;
+16A6;RUNIC LETTER THURISAZ THURS THORN;Lo;0;L;;;;;N;;;;;
+16A7;RUNIC LETTER ETH;Lo;0;L;;;;;N;;;;;
+16A8;RUNIC LETTER ANSUZ A;Lo;0;L;;;;;N;;;;;
+16A9;RUNIC LETTER OS O;Lo;0;L;;;;;N;;;;;
+16AA;RUNIC LETTER AC A;Lo;0;L;;;;;N;;;;;
+16AB;RUNIC LETTER AESC;Lo;0;L;;;;;N;;;;;
+16AC;RUNIC LETTER LONG-BRANCH-OSS O;Lo;0;L;;;;;N;;;;;
+16AD;RUNIC LETTER SHORT-TWIG-OSS O;Lo;0;L;;;;;N;;;;;
+16AE;RUNIC LETTER O;Lo;0;L;;;;;N;;;;;
+16AF;RUNIC LETTER OE;Lo;0;L;;;;;N;;;;;
+16B0;RUNIC LETTER ON;Lo;0;L;;;;;N;;;;;
+16B1;RUNIC LETTER RAIDO RAD REID R;Lo;0;L;;;;;N;;;;;
+16B2;RUNIC LETTER KAUNA;Lo;0;L;;;;;N;;;;;
+16B3;RUNIC LETTER CEN;Lo;0;L;;;;;N;;;;;
+16B4;RUNIC LETTER KAUN K;Lo;0;L;;;;;N;;;;;
+16B5;RUNIC LETTER G;Lo;0;L;;;;;N;;;;;
+16B6;RUNIC LETTER ENG;Lo;0;L;;;;;N;;;;;
+16B7;RUNIC LETTER GEBO GYFU G;Lo;0;L;;;;;N;;;;;
+16B8;RUNIC LETTER GAR;Lo;0;L;;;;;N;;;;;
+16B9;RUNIC LETTER WUNJO WYNN W;Lo;0;L;;;;;N;;;;;
+16BA;RUNIC LETTER HAGLAZ H;Lo;0;L;;;;;N;;;;;
+16BB;RUNIC LETTER HAEGL H;Lo;0;L;;;;;N;;;;;
+16BC;RUNIC LETTER LONG-BRANCH-HAGALL H;Lo;0;L;;;;;N;;;;;
+16BD;RUNIC LETTER SHORT-TWIG-HAGALL H;Lo;0;L;;;;;N;;;;;
+16BE;RUNIC LETTER NAUDIZ NYD NAUD N;Lo;0;L;;;;;N;;;;;
+16BF;RUNIC LETTER SHORT-TWIG-NAUD N;Lo;0;L;;;;;N;;;;;
+16C0;RUNIC LETTER DOTTED-N;Lo;0;L;;;;;N;;;;;
+16C1;RUNIC LETTER ISAZ IS ISS I;Lo;0;L;;;;;N;;;;;
+16C2;RUNIC LETTER E;Lo;0;L;;;;;N;;;;;
+16C3;RUNIC LETTER JERAN J;Lo;0;L;;;;;N;;;;;
+16C4;RUNIC LETTER GER;Lo;0;L;;;;;N;;;;;
+16C5;RUNIC LETTER LONG-BRANCH-AR AE;Lo;0;L;;;;;N;;;;;
+16C6;RUNIC LETTER SHORT-TWIG-AR A;Lo;0;L;;;;;N;;;;;
+16C7;RUNIC LETTER IWAZ EOH;Lo;0;L;;;;;N;;;;;
+16C8;RUNIC LETTER PERTHO PEORTH P;Lo;0;L;;;;;N;;;;;
+16C9;RUNIC LETTER ALGIZ EOLHX;Lo;0;L;;;;;N;;;;;
+16CA;RUNIC LETTER SOWILO S;Lo;0;L;;;;;N;;;;;
+16CB;RUNIC LETTER SIGEL LONG-BRANCH-SOL S;Lo;0;L;;;;;N;;;;;
+16CC;RUNIC LETTER SHORT-TWIG-SOL S;Lo;0;L;;;;;N;;;;;
+16CD;RUNIC LETTER C;Lo;0;L;;;;;N;;;;;
+16CE;RUNIC LETTER Z;Lo;0;L;;;;;N;;;;;
+16CF;RUNIC LETTER TIWAZ TIR TYR T;Lo;0;L;;;;;N;;;;;
+16D0;RUNIC LETTER SHORT-TWIG-TYR T;Lo;0;L;;;;;N;;;;;
+16D1;RUNIC LETTER D;Lo;0;L;;;;;N;;;;;
+16D2;RUNIC LETTER BERKANAN BEORC BJARKAN B;Lo;0;L;;;;;N;;;;;
+16D3;RUNIC LETTER SHORT-TWIG-BJARKAN B;Lo;0;L;;;;;N;;;;;
+16D4;RUNIC LETTER DOTTED-P;Lo;0;L;;;;;N;;;;;
+16D5;RUNIC LETTER OPEN-P;Lo;0;L;;;;;N;;;;;
+16D6;RUNIC LETTER EHWAZ EH E;Lo;0;L;;;;;N;;;;;
+16D7;RUNIC LETTER MANNAZ MAN M;Lo;0;L;;;;;N;;;;;
+16D8;RUNIC LETTER LONG-BRANCH-MADR M;Lo;0;L;;;;;N;;;;;
+16D9;RUNIC LETTER SHORT-TWIG-MADR M;Lo;0;L;;;;;N;;;;;
+16DA;RUNIC LETTER LAUKAZ LAGU LOGR L;Lo;0;L;;;;;N;;;;;
+16DB;RUNIC LETTER DOTTED-L;Lo;0;L;;;;;N;;;;;
+16DC;RUNIC LETTER INGWAZ;Lo;0;L;;;;;N;;;;;
+16DD;RUNIC LETTER ING;Lo;0;L;;;;;N;;;;;
+16DE;RUNIC LETTER DAGAZ DAEG D;Lo;0;L;;;;;N;;;;;
+16DF;RUNIC LETTER OTHALAN ETHEL O;Lo;0;L;;;;;N;;;;;
+16E0;RUNIC LETTER EAR;Lo;0;L;;;;;N;;;;;
+16E1;RUNIC LETTER IOR;Lo;0;L;;;;;N;;;;;
+16E2;RUNIC LETTER CWEORTH;Lo;0;L;;;;;N;;;;;
+16E3;RUNIC LETTER CALC;Lo;0;L;;;;;N;;;;;
+16E4;RUNIC LETTER CEALC;Lo;0;L;;;;;N;;;;;
+16E5;RUNIC LETTER STAN;Lo;0;L;;;;;N;;;;;
+16E6;RUNIC LETTER LONG-BRANCH-YR;Lo;0;L;;;;;N;;;;;
+16E7;RUNIC LETTER SHORT-TWIG-YR;Lo;0;L;;;;;N;;;;;
+16E8;RUNIC LETTER ICELANDIC-YR;Lo;0;L;;;;;N;;;;;
+16E9;RUNIC LETTER Q;Lo;0;L;;;;;N;;;;;
+16EA;RUNIC LETTER X;Lo;0;L;;;;;N;;;;;
+16EB;RUNIC SINGLE PUNCTUATION;Po;0;L;;;;;N;;;;;
+16EC;RUNIC MULTIPLE PUNCTUATION;Po;0;L;;;;;N;;;;;
+16ED;RUNIC CROSS PUNCTUATION;Po;0;L;;;;;N;;;;;
+16EE;RUNIC ARLAUG SYMBOL;Nl;0;L;;;;17;N;;golden number 17;;;
+16EF;RUNIC TVIMADUR SYMBOL;Nl;0;L;;;;18;N;;golden number 18;;;
+16F0;RUNIC BELGTHOR SYMBOL;Nl;0;L;;;;19;N;;golden number 19;;;
+1700;TAGALOG LETTER A;Lo;0;L;;;;;N;;;;;
+1701;TAGALOG LETTER I;Lo;0;L;;;;;N;;;;;
+1702;TAGALOG LETTER U;Lo;0;L;;;;;N;;;;;
+1703;TAGALOG LETTER KA;Lo;0;L;;;;;N;;;;;
+1704;TAGALOG LETTER GA;Lo;0;L;;;;;N;;;;;
+1705;TAGALOG LETTER NGA;Lo;0;L;;;;;N;;;;;
+1706;TAGALOG LETTER TA;Lo;0;L;;;;;N;;;;;
+1707;TAGALOG LETTER DA;Lo;0;L;;;;;N;;;;;
+1708;TAGALOG LETTER NA;Lo;0;L;;;;;N;;;;;
+1709;TAGALOG LETTER PA;Lo;0;L;;;;;N;;;;;
+170A;TAGALOG LETTER BA;Lo;0;L;;;;;N;;;;;
+170B;TAGALOG LETTER MA;Lo;0;L;;;;;N;;;;;
+170C;TAGALOG LETTER YA;Lo;0;L;;;;;N;;;;;
+170E;TAGALOG LETTER LA;Lo;0;L;;;;;N;;;;;
+170F;TAGALOG LETTER WA;Lo;0;L;;;;;N;;;;;
+1710;TAGALOG LETTER SA;Lo;0;L;;;;;N;;;;;
+1711;TAGALOG LETTER HA;Lo;0;L;;;;;N;;;;;
+1712;TAGALOG VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+1713;TAGALOG VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1714;TAGALOG SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+1720;HANUNOO LETTER A;Lo;0;L;;;;;N;;;;;
+1721;HANUNOO LETTER I;Lo;0;L;;;;;N;;;;;
+1722;HANUNOO LETTER U;Lo;0;L;;;;;N;;;;;
+1723;HANUNOO LETTER KA;Lo;0;L;;;;;N;;;;;
+1724;HANUNOO LETTER GA;Lo;0;L;;;;;N;;;;;
+1725;HANUNOO LETTER NGA;Lo;0;L;;;;;N;;;;;
+1726;HANUNOO LETTER TA;Lo;0;L;;;;;N;;;;;
+1727;HANUNOO LETTER DA;Lo;0;L;;;;;N;;;;;
+1728;HANUNOO LETTER NA;Lo;0;L;;;;;N;;;;;
+1729;HANUNOO LETTER PA;Lo;0;L;;;;;N;;;;;
+172A;HANUNOO LETTER BA;Lo;0;L;;;;;N;;;;;
+172B;HANUNOO LETTER MA;Lo;0;L;;;;;N;;;;;
+172C;HANUNOO LETTER YA;Lo;0;L;;;;;N;;;;;
+172D;HANUNOO LETTER RA;Lo;0;L;;;;;N;;;;;
+172E;HANUNOO LETTER LA;Lo;0;L;;;;;N;;;;;
+172F;HANUNOO LETTER WA;Lo;0;L;;;;;N;;;;;
+1730;HANUNOO LETTER SA;Lo;0;L;;;;;N;;;;;
+1731;HANUNOO LETTER HA;Lo;0;L;;;;;N;;;;;
+1732;HANUNOO VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+1733;HANUNOO VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1734;HANUNOO SIGN PAMUDPOD;Mn;9;NSM;;;;;N;;;;;
+1735;PHILIPPINE SINGLE PUNCTUATION;Po;0;L;;;;;N;;;;;
+1736;PHILIPPINE DOUBLE PUNCTUATION;Po;0;L;;;;;N;;;;;
+1740;BUHID LETTER A;Lo;0;L;;;;;N;;;;;
+1741;BUHID LETTER I;Lo;0;L;;;;;N;;;;;
+1742;BUHID LETTER U;Lo;0;L;;;;;N;;;;;
+1743;BUHID LETTER KA;Lo;0;L;;;;;N;;;;;
+1744;BUHID LETTER GA;Lo;0;L;;;;;N;;;;;
+1745;BUHID LETTER NGA;Lo;0;L;;;;;N;;;;;
+1746;BUHID LETTER TA;Lo;0;L;;;;;N;;;;;
+1747;BUHID LETTER DA;Lo;0;L;;;;;N;;;;;
+1748;BUHID LETTER NA;Lo;0;L;;;;;N;;;;;
+1749;BUHID LETTER PA;Lo;0;L;;;;;N;;;;;
+174A;BUHID LETTER BA;Lo;0;L;;;;;N;;;;;
+174B;BUHID LETTER MA;Lo;0;L;;;;;N;;;;;
+174C;BUHID LETTER YA;Lo;0;L;;;;;N;;;;;
+174D;BUHID LETTER RA;Lo;0;L;;;;;N;;;;;
+174E;BUHID LETTER LA;Lo;0;L;;;;;N;;;;;
+174F;BUHID LETTER WA;Lo;0;L;;;;;N;;;;;
+1750;BUHID LETTER SA;Lo;0;L;;;;;N;;;;;
+1751;BUHID LETTER HA;Lo;0;L;;;;;N;;;;;
+1752;BUHID VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+1753;BUHID VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1760;TAGBANWA LETTER A;Lo;0;L;;;;;N;;;;;
+1761;TAGBANWA LETTER I;Lo;0;L;;;;;N;;;;;
+1762;TAGBANWA LETTER U;Lo;0;L;;;;;N;;;;;
+1763;TAGBANWA LETTER KA;Lo;0;L;;;;;N;;;;;
+1764;TAGBANWA LETTER GA;Lo;0;L;;;;;N;;;;;
+1765;TAGBANWA LETTER NGA;Lo;0;L;;;;;N;;;;;
+1766;TAGBANWA LETTER TA;Lo;0;L;;;;;N;;;;;
+1767;TAGBANWA LETTER DA;Lo;0;L;;;;;N;;;;;
+1768;TAGBANWA LETTER NA;Lo;0;L;;;;;N;;;;;
+1769;TAGBANWA LETTER PA;Lo;0;L;;;;;N;;;;;
+176A;TAGBANWA LETTER BA;Lo;0;L;;;;;N;;;;;
+176B;TAGBANWA LETTER MA;Lo;0;L;;;;;N;;;;;
+176C;TAGBANWA LETTER YA;Lo;0;L;;;;;N;;;;;
+176E;TAGBANWA LETTER LA;Lo;0;L;;;;;N;;;;;
+176F;TAGBANWA LETTER WA;Lo;0;L;;;;;N;;;;;
+1770;TAGBANWA LETTER SA;Lo;0;L;;;;;N;;;;;
+1772;TAGBANWA VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+1773;TAGBANWA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1780;KHMER LETTER KA;Lo;0;L;;;;;N;;;;;
+1781;KHMER LETTER KHA;Lo;0;L;;;;;N;;;;;
+1782;KHMER LETTER KO;Lo;0;L;;;;;N;;;;;
+1783;KHMER LETTER KHO;Lo;0;L;;;;;N;;;;;
+1784;KHMER LETTER NGO;Lo;0;L;;;;;N;;;;;
+1785;KHMER LETTER CA;Lo;0;L;;;;;N;;;;;
+1786;KHMER LETTER CHA;Lo;0;L;;;;;N;;;;;
+1787;KHMER LETTER CO;Lo;0;L;;;;;N;;;;;
+1788;KHMER LETTER CHO;Lo;0;L;;;;;N;;;;;
+1789;KHMER LETTER NYO;Lo;0;L;;;;;N;;;;;
+178A;KHMER LETTER DA;Lo;0;L;;;;;N;;;;;
+178B;KHMER LETTER TTHA;Lo;0;L;;;;;N;;;;;
+178C;KHMER LETTER DO;Lo;0;L;;;;;N;;;;;
+178D;KHMER LETTER TTHO;Lo;0;L;;;;;N;;;;;
+178E;KHMER LETTER NNO;Lo;0;L;;;;;N;;;;;
+178F;KHMER LETTER TA;Lo;0;L;;;;;N;;;;;
+1790;KHMER LETTER THA;Lo;0;L;;;;;N;;;;;
+1791;KHMER LETTER TO;Lo;0;L;;;;;N;;;;;
+1792;KHMER LETTER THO;Lo;0;L;;;;;N;;;;;
+1793;KHMER LETTER NO;Lo;0;L;;;;;N;;;;;
+1794;KHMER LETTER BA;Lo;0;L;;;;;N;;;;;
+1795;KHMER LETTER PHA;Lo;0;L;;;;;N;;;;;
+1796;KHMER LETTER PO;Lo;0;L;;;;;N;;;;;
+1797;KHMER LETTER PHO;Lo;0;L;;;;;N;;;;;
+1798;KHMER LETTER MO;Lo;0;L;;;;;N;;;;;
+1799;KHMER LETTER YO;Lo;0;L;;;;;N;;;;;
+179A;KHMER LETTER RO;Lo;0;L;;;;;N;;;;;
+179B;KHMER LETTER LO;Lo;0;L;;;;;N;;;;;
+179C;KHMER LETTER VO;Lo;0;L;;;;;N;;;;;
+179D;KHMER LETTER SHA;Lo;0;L;;;;;N;;;;;
+179E;KHMER LETTER SSO;Lo;0;L;;;;;N;;;;;
+179F;KHMER LETTER SA;Lo;0;L;;;;;N;;;;;
+17A0;KHMER LETTER HA;Lo;0;L;;;;;N;;;;;
+17A1;KHMER LETTER LA;Lo;0;L;;;;;N;;;;;
+17A2;KHMER LETTER QA;Lo;0;L;;;;;N;;;;;
+17A3;KHMER INDEPENDENT VOWEL QAQ;Lo;0;L;;;;;N;;*;;;
+17A4;KHMER INDEPENDENT VOWEL QAA;Lo;0;L;;;;;N;;*;;;
+17A5;KHMER INDEPENDENT VOWEL QI;Lo;0;L;;;;;N;;;;;
+17A6;KHMER INDEPENDENT VOWEL QII;Lo;0;L;;;;;N;;;;;
+17A7;KHMER INDEPENDENT VOWEL QU;Lo;0;L;;;;;N;;;;;
+17A8;KHMER INDEPENDENT VOWEL QUK;Lo;0;L;;;;;N;;;;;
+17A9;KHMER INDEPENDENT VOWEL QUU;Lo;0;L;;;;;N;;;;;
+17AA;KHMER INDEPENDENT VOWEL QUUV;Lo;0;L;;;;;N;;;;;
+17AB;KHMER INDEPENDENT VOWEL RY;Lo;0;L;;;;;N;;;;;
+17AC;KHMER INDEPENDENT VOWEL RYY;Lo;0;L;;;;;N;;;;;
+17AD;KHMER INDEPENDENT VOWEL LY;Lo;0;L;;;;;N;;;;;
+17AE;KHMER INDEPENDENT VOWEL LYY;Lo;0;L;;;;;N;;;;;
+17AF;KHMER INDEPENDENT VOWEL QE;Lo;0;L;;;;;N;;;;;
+17B0;KHMER INDEPENDENT VOWEL QAI;Lo;0;L;;;;;N;;;;;
+17B1;KHMER INDEPENDENT VOWEL QOO TYPE ONE;Lo;0;L;;;;;N;;;;;
+17B2;KHMER INDEPENDENT VOWEL QOO TYPE TWO;Lo;0;L;;;;;N;;;;;
+17B3;KHMER INDEPENDENT VOWEL QAU;Lo;0;L;;;;;N;;;;;
+17B4;KHMER VOWEL INHERENT AQ;Cf;0;L;;;;;N;;*;;;
+17B5;KHMER VOWEL INHERENT AA;Cf;0;L;;;;;N;;*;;;
+17B6;KHMER VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+17B7;KHMER VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+17B8;KHMER VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
+17B9;KHMER VOWEL SIGN Y;Mn;0;NSM;;;;;N;;;;;
+17BA;KHMER VOWEL SIGN YY;Mn;0;NSM;;;;;N;;;;;
+17BB;KHMER VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+17BC;KHMER VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+17BD;KHMER VOWEL SIGN UA;Mn;0;NSM;;;;;N;;;;;
+17BE;KHMER VOWEL SIGN OE;Mc;0;L;;;;;N;;;;;
+17BF;KHMER VOWEL SIGN YA;Mc;0;L;;;;;N;;;;;
+17C0;KHMER VOWEL SIGN IE;Mc;0;L;;;;;N;;;;;
+17C1;KHMER VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+17C2;KHMER VOWEL SIGN AE;Mc;0;L;;;;;N;;;;;
+17C3;KHMER VOWEL SIGN AI;Mc;0;L;;;;;N;;;;;
+17C4;KHMER VOWEL SIGN OO;Mc;0;L;;;;;N;;;;;
+17C5;KHMER VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+17C6;KHMER SIGN NIKAHIT;Mn;0;NSM;;;;;N;;;;;
+17C7;KHMER SIGN REAHMUK;Mc;0;L;;;;;N;;;;;
+17C8;KHMER SIGN YUUKALEAPINTU;Mc;0;L;;;;;N;;;;;
+17C9;KHMER SIGN MUUSIKATOAN;Mn;0;NSM;;;;;N;;;;;
+17CA;KHMER SIGN TRIISAP;Mn;0;NSM;;;;;N;;;;;
+17CB;KHMER SIGN BANTOC;Mn;0;NSM;;;;;N;;;;;
+17CC;KHMER SIGN ROBAT;Mn;0;NSM;;;;;N;;;;;
+17CD;KHMER SIGN TOANDAKHIAT;Mn;0;NSM;;;;;N;;;;;
+17CE;KHMER SIGN KAKABAT;Mn;0;NSM;;;;;N;;;;;
+17CF;KHMER SIGN AHSDA;Mn;0;NSM;;;;;N;;;;;
+17D0;KHMER SIGN SAMYOK SANNYA;Mn;0;NSM;;;;;N;;;;;
+17D1;KHMER SIGN VIRIAM;Mn;0;NSM;;;;;N;;;;;
+17D2;KHMER SIGN COENG;Mn;9;NSM;;;;;N;;;;;
+17D3;KHMER SIGN BATHAMASAT;Mn;0;NSM;;;;;N;;*;;;
+17D4;KHMER SIGN KHAN;Po;0;L;;;;;N;;;;;
+17D5;KHMER SIGN BARIYOOSAN;Po;0;L;;;;;N;;;;;
+17D6;KHMER SIGN CAMNUC PII KUUH;Po;0;L;;;;;N;;;;;
+17D7;KHMER SIGN LEK TOO;Lm;0;L;;;;;N;;;;;
+17D8;KHMER SIGN BEYYAL;Po;0;L;;;;;N;;*;;;
+17D9;KHMER SIGN PHNAEK MUAN;Po;0;L;;;;;N;;;;;
+17DA;KHMER SIGN KOOMUUT;Po;0;L;;;;;N;;;;;
+17DB;KHMER CURRENCY SYMBOL RIEL;Sc;0;ET;;;;;N;;;;;
+17DC;KHMER SIGN AVAKRAHASANYA;Lo;0;L;;;;;N;;;;;
+17DD;KHMER SIGN ATTHACAN;Mn;230;NSM;;;;;N;;;;;
+17E0;KHMER DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+17E1;KHMER DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+17E2;KHMER DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+17E3;KHMER DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+17E4;KHMER DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+17E5;KHMER DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+17E6;KHMER DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+17E7;KHMER DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+17E8;KHMER DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+17E9;KHMER DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+17F0;KHMER SYMBOL LEK ATTAK SON;No;0;ON;;;;0;N;;;;;
+17F1;KHMER SYMBOL LEK ATTAK MUOY;No;0;ON;;;;1;N;;;;;
+17F2;KHMER SYMBOL LEK ATTAK PII;No;0;ON;;;;2;N;;;;;
+17F3;KHMER SYMBOL LEK ATTAK BEI;No;0;ON;;;;3;N;;;;;
+17F4;KHMER SYMBOL LEK ATTAK BUON;No;0;ON;;;;4;N;;;;;
+17F5;KHMER SYMBOL LEK ATTAK PRAM;No;0;ON;;;;5;N;;;;;
+17F6;KHMER SYMBOL LEK ATTAK PRAM-MUOY;No;0;ON;;;;6;N;;;;;
+17F7;KHMER SYMBOL LEK ATTAK PRAM-PII;No;0;ON;;;;7;N;;;;;
+17F8;KHMER SYMBOL LEK ATTAK PRAM-BEI;No;0;ON;;;;8;N;;;;;
+17F9;KHMER SYMBOL LEK ATTAK PRAM-BUON;No;0;ON;;;;9;N;;;;;
+1800;MONGOLIAN BIRGA;Po;0;ON;;;;;N;;;;;
+1801;MONGOLIAN ELLIPSIS;Po;0;ON;;;;;N;;;;;
+1802;MONGOLIAN COMMA;Po;0;ON;;;;;N;;;;;
+1803;MONGOLIAN FULL STOP;Po;0;ON;;;;;N;;;;;
+1804;MONGOLIAN COLON;Po;0;ON;;;;;N;;;;;
+1805;MONGOLIAN FOUR DOTS;Po;0;ON;;;;;N;;;;;
+1806;MONGOLIAN TODO SOFT HYPHEN;Pd;0;ON;;;;;N;;;;;
+1807;MONGOLIAN SIBE SYLLABLE BOUNDARY MARKER;Po;0;ON;;;;;N;;;;;
+1808;MONGOLIAN MANCHU COMMA;Po;0;ON;;;;;N;;;;;
+1809;MONGOLIAN MANCHU FULL STOP;Po;0;ON;;;;;N;;;;;
+180A;MONGOLIAN NIRUGU;Po;0;ON;;;;;N;;;;;
+180B;MONGOLIAN FREE VARIATION SELECTOR ONE;Mn;0;NSM;;;;;N;;;;;
+180C;MONGOLIAN FREE VARIATION SELECTOR TWO;Mn;0;NSM;;;;;N;;;;;
+180D;MONGOLIAN FREE VARIATION SELECTOR THREE;Mn;0;NSM;;;;;N;;;;;
+180E;MONGOLIAN VOWEL SEPARATOR;Zs;0;WS;;;;;N;;;;;
+1810;MONGOLIAN DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+1811;MONGOLIAN DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+1812;MONGOLIAN DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+1813;MONGOLIAN DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+1814;MONGOLIAN DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+1815;MONGOLIAN DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+1816;MONGOLIAN DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+1817;MONGOLIAN DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+1818;MONGOLIAN DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+1819;MONGOLIAN DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+1820;MONGOLIAN LETTER A;Lo;0;L;;;;;N;;;;;
+1821;MONGOLIAN LETTER E;Lo;0;L;;;;;N;;;;;
+1822;MONGOLIAN LETTER I;Lo;0;L;;;;;N;;;;;
+1823;MONGOLIAN LETTER O;Lo;0;L;;;;;N;;;;;
+1824;MONGOLIAN LETTER U;Lo;0;L;;;;;N;;;;;
+1825;MONGOLIAN LETTER OE;Lo;0;L;;;;;N;;;;;
+1826;MONGOLIAN LETTER UE;Lo;0;L;;;;;N;;;;;
+1827;MONGOLIAN LETTER EE;Lo;0;L;;;;;N;;;;;
+1828;MONGOLIAN LETTER NA;Lo;0;L;;;;;N;;;;;
+1829;MONGOLIAN LETTER ANG;Lo;0;L;;;;;N;;;;;
+182A;MONGOLIAN LETTER BA;Lo;0;L;;;;;N;;;;;
+182B;MONGOLIAN LETTER PA;Lo;0;L;;;;;N;;;;;
+182C;MONGOLIAN LETTER QA;Lo;0;L;;;;;N;;;;;
+182D;MONGOLIAN LETTER GA;Lo;0;L;;;;;N;;;;;
+182E;MONGOLIAN LETTER MA;Lo;0;L;;;;;N;;;;;
+182F;MONGOLIAN LETTER LA;Lo;0;L;;;;;N;;;;;
+1830;MONGOLIAN LETTER SA;Lo;0;L;;;;;N;;;;;
+1831;MONGOLIAN LETTER SHA;Lo;0;L;;;;;N;;;;;
+1832;MONGOLIAN LETTER TA;Lo;0;L;;;;;N;;;;;
+1833;MONGOLIAN LETTER DA;Lo;0;L;;;;;N;;;;;
+1834;MONGOLIAN LETTER CHA;Lo;0;L;;;;;N;;;;;
+1835;MONGOLIAN LETTER JA;Lo;0;L;;;;;N;;;;;
+1836;MONGOLIAN LETTER YA;Lo;0;L;;;;;N;;;;;
+1837;MONGOLIAN LETTER RA;Lo;0;L;;;;;N;;;;;
+1838;MONGOLIAN LETTER WA;Lo;0;L;;;;;N;;;;;
+1839;MONGOLIAN LETTER FA;Lo;0;L;;;;;N;;;;;
+183A;MONGOLIAN LETTER KA;Lo;0;L;;;;;N;;;;;
+183B;MONGOLIAN LETTER KHA;Lo;0;L;;;;;N;;;;;
+183C;MONGOLIAN LETTER TSA;Lo;0;L;;;;;N;;;;;
+183D;MONGOLIAN LETTER ZA;Lo;0;L;;;;;N;;;;;
+183E;MONGOLIAN LETTER HAA;Lo;0;L;;;;;N;;;;;
+183F;MONGOLIAN LETTER ZRA;Lo;0;L;;;;;N;;;;;
+1840;MONGOLIAN LETTER LHA;Lo;0;L;;;;;N;;;;;
+1841;MONGOLIAN LETTER ZHI;Lo;0;L;;;;;N;;;;;
+1842;MONGOLIAN LETTER CHI;Lo;0;L;;;;;N;;;;;
+1843;MONGOLIAN LETTER TODO LONG VOWEL SIGN;Lm;0;L;;;;;N;;;;;
+1844;MONGOLIAN LETTER TODO E;Lo;0;L;;;;;N;;;;;
+1845;MONGOLIAN LETTER TODO I;Lo;0;L;;;;;N;;;;;
+1846;MONGOLIAN LETTER TODO O;Lo;0;L;;;;;N;;;;;
+1847;MONGOLIAN LETTER TODO U;Lo;0;L;;;;;N;;;;;
+1848;MONGOLIAN LETTER TODO OE;Lo;0;L;;;;;N;;;;;
+1849;MONGOLIAN LETTER TODO UE;Lo;0;L;;;;;N;;;;;
+184A;MONGOLIAN LETTER TODO ANG;Lo;0;L;;;;;N;;;;;
+184B;MONGOLIAN LETTER TODO BA;Lo;0;L;;;;;N;;;;;
+184C;MONGOLIAN LETTER TODO PA;Lo;0;L;;;;;N;;;;;
+184D;MONGOLIAN LETTER TODO QA;Lo;0;L;;;;;N;;;;;
+184E;MONGOLIAN LETTER TODO GA;Lo;0;L;;;;;N;;;;;
+184F;MONGOLIAN LETTER TODO MA;Lo;0;L;;;;;N;;;;;
+1850;MONGOLIAN LETTER TODO TA;Lo;0;L;;;;;N;;;;;
+1851;MONGOLIAN LETTER TODO DA;Lo;0;L;;;;;N;;;;;
+1852;MONGOLIAN LETTER TODO CHA;Lo;0;L;;;;;N;;;;;
+1853;MONGOLIAN LETTER TODO JA;Lo;0;L;;;;;N;;;;;
+1854;MONGOLIAN LETTER TODO TSA;Lo;0;L;;;;;N;;;;;
+1855;MONGOLIAN LETTER TODO YA;Lo;0;L;;;;;N;;;;;
+1856;MONGOLIAN LETTER TODO WA;Lo;0;L;;;;;N;;;;;
+1857;MONGOLIAN LETTER TODO KA;Lo;0;L;;;;;N;;;;;
+1858;MONGOLIAN LETTER TODO GAA;Lo;0;L;;;;;N;;;;;
+1859;MONGOLIAN LETTER TODO HAA;Lo;0;L;;;;;N;;;;;
+185A;MONGOLIAN LETTER TODO JIA;Lo;0;L;;;;;N;;;;;
+185B;MONGOLIAN LETTER TODO NIA;Lo;0;L;;;;;N;;;;;
+185C;MONGOLIAN LETTER TODO DZA;Lo;0;L;;;;;N;;;;;
+185D;MONGOLIAN LETTER SIBE E;Lo;0;L;;;;;N;;;;;
+185E;MONGOLIAN LETTER SIBE I;Lo;0;L;;;;;N;;;;;
+185F;MONGOLIAN LETTER SIBE IY;Lo;0;L;;;;;N;;;;;
+1860;MONGOLIAN LETTER SIBE UE;Lo;0;L;;;;;N;;;;;
+1861;MONGOLIAN LETTER SIBE U;Lo;0;L;;;;;N;;;;;
+1862;MONGOLIAN LETTER SIBE ANG;Lo;0;L;;;;;N;;;;;
+1863;MONGOLIAN LETTER SIBE KA;Lo;0;L;;;;;N;;;;;
+1864;MONGOLIAN LETTER SIBE GA;Lo;0;L;;;;;N;;;;;
+1865;MONGOLIAN LETTER SIBE HA;Lo;0;L;;;;;N;;;;;
+1866;MONGOLIAN LETTER SIBE PA;Lo;0;L;;;;;N;;;;;
+1867;MONGOLIAN LETTER SIBE SHA;Lo;0;L;;;;;N;;;;;
+1868;MONGOLIAN LETTER SIBE TA;Lo;0;L;;;;;N;;;;;
+1869;MONGOLIAN LETTER SIBE DA;Lo;0;L;;;;;N;;;;;
+186A;MONGOLIAN LETTER SIBE JA;Lo;0;L;;;;;N;;;;;
+186B;MONGOLIAN LETTER SIBE FA;Lo;0;L;;;;;N;;;;;
+186C;MONGOLIAN LETTER SIBE GAA;Lo;0;L;;;;;N;;;;;
+186D;MONGOLIAN LETTER SIBE HAA;Lo;0;L;;;;;N;;;;;
+186E;MONGOLIAN LETTER SIBE TSA;Lo;0;L;;;;;N;;;;;
+186F;MONGOLIAN LETTER SIBE ZA;Lo;0;L;;;;;N;;;;;
+1870;MONGOLIAN LETTER SIBE RAA;Lo;0;L;;;;;N;;;;;
+1871;MONGOLIAN LETTER SIBE CHA;Lo;0;L;;;;;N;;;;;
+1872;MONGOLIAN LETTER SIBE ZHA;Lo;0;L;;;;;N;;;;;
+1873;MONGOLIAN LETTER MANCHU I;Lo;0;L;;;;;N;;;;;
+1874;MONGOLIAN LETTER MANCHU KA;Lo;0;L;;;;;N;;;;;
+1875;MONGOLIAN LETTER MANCHU RA;Lo;0;L;;;;;N;;;;;
+1876;MONGOLIAN LETTER MANCHU FA;Lo;0;L;;;;;N;;;;;
+1877;MONGOLIAN LETTER MANCHU ZHA;Lo;0;L;;;;;N;;;;;
+1880;MONGOLIAN LETTER ALI GALI ANUSVARA ONE;Lo;0;L;;;;;N;;;;;
+1881;MONGOLIAN LETTER ALI GALI VISARGA ONE;Lo;0;L;;;;;N;;;;;
+1882;MONGOLIAN LETTER ALI GALI DAMARU;Lo;0;L;;;;;N;;;;;
+1883;MONGOLIAN LETTER ALI GALI UBADAMA;Lo;0;L;;;;;N;;;;;
+1884;MONGOLIAN LETTER ALI GALI INVERTED UBADAMA;Lo;0;L;;;;;N;;;;;
+1885;MONGOLIAN LETTER ALI GALI BALUDA;Lo;0;L;;;;;N;;;;;
+1886;MONGOLIAN LETTER ALI GALI THREE BALUDA;Lo;0;L;;;;;N;;;;;
+1887;MONGOLIAN LETTER ALI GALI A;Lo;0;L;;;;;N;;;;;
+1888;MONGOLIAN LETTER ALI GALI I;Lo;0;L;;;;;N;;;;;
+1889;MONGOLIAN LETTER ALI GALI KA;Lo;0;L;;;;;N;;;;;
+188A;MONGOLIAN LETTER ALI GALI NGA;Lo;0;L;;;;;N;;;;;
+188B;MONGOLIAN LETTER ALI GALI CA;Lo;0;L;;;;;N;;;;;
+188C;MONGOLIAN LETTER ALI GALI TTA;Lo;0;L;;;;;N;;;;;
+188D;MONGOLIAN LETTER ALI GALI TTHA;Lo;0;L;;;;;N;;;;;
+188E;MONGOLIAN LETTER ALI GALI DDA;Lo;0;L;;;;;N;;;;;
+188F;MONGOLIAN LETTER ALI GALI NNA;Lo;0;L;;;;;N;;;;;
+1890;MONGOLIAN LETTER ALI GALI TA;Lo;0;L;;;;;N;;;;;
+1891;MONGOLIAN LETTER ALI GALI DA;Lo;0;L;;;;;N;;;;;
+1892;MONGOLIAN LETTER ALI GALI PA;Lo;0;L;;;;;N;;;;;
+1893;MONGOLIAN LETTER ALI GALI PHA;Lo;0;L;;;;;N;;;;;
+1894;MONGOLIAN LETTER ALI GALI SSA;Lo;0;L;;;;;N;;;;;
+1895;MONGOLIAN LETTER ALI GALI ZHA;Lo;0;L;;;;;N;;;;;
+1896;MONGOLIAN LETTER ALI GALI ZA;Lo;0;L;;;;;N;;;;;
+1897;MONGOLIAN LETTER ALI GALI AH;Lo;0;L;;;;;N;;;;;
+1898;MONGOLIAN LETTER TODO ALI GALI TA;Lo;0;L;;;;;N;;;;;
+1899;MONGOLIAN LETTER TODO ALI GALI ZHA;Lo;0;L;;;;;N;;;;;
+189A;MONGOLIAN LETTER MANCHU ALI GALI GHA;Lo;0;L;;;;;N;;;;;
+189B;MONGOLIAN LETTER MANCHU ALI GALI NGA;Lo;0;L;;;;;N;;;;;
+189C;MONGOLIAN LETTER MANCHU ALI GALI CA;Lo;0;L;;;;;N;;;;;
+189D;MONGOLIAN LETTER MANCHU ALI GALI JHA;Lo;0;L;;;;;N;;;;;
+189E;MONGOLIAN LETTER MANCHU ALI GALI TTA;Lo;0;L;;;;;N;;;;;
+189F;MONGOLIAN LETTER MANCHU ALI GALI DDHA;Lo;0;L;;;;;N;;;;;
+18A0;MONGOLIAN LETTER MANCHU ALI GALI TA;Lo;0;L;;;;;N;;;;;
+18A1;MONGOLIAN LETTER MANCHU ALI GALI DHA;Lo;0;L;;;;;N;;;;;
+18A2;MONGOLIAN LETTER MANCHU ALI GALI SSA;Lo;0;L;;;;;N;;;;;
+18A3;MONGOLIAN LETTER MANCHU ALI GALI CYA;Lo;0;L;;;;;N;;;;;
+18A4;MONGOLIAN LETTER MANCHU ALI GALI ZHA;Lo;0;L;;;;;N;;;;;
+18A5;MONGOLIAN LETTER MANCHU ALI GALI ZA;Lo;0;L;;;;;N;;;;;
+18A6;MONGOLIAN LETTER ALI GALI HALF U;Lo;0;L;;;;;N;;;;;
+18A7;MONGOLIAN LETTER ALI GALI HALF YA;Lo;0;L;;;;;N;;;;;
+18A8;MONGOLIAN LETTER MANCHU ALI GALI BHA;Lo;0;L;;;;;N;;;;;
+18A9;MONGOLIAN LETTER ALI GALI DAGALGA;Mn;228;NSM;;;;;N;;;;;
+1900;LIMBU VOWEL-CARRIER LETTER;Lo;0;L;;;;;N;;;;;
+1901;LIMBU LETTER KA;Lo;0;L;;;;;N;;;;;
+1902;LIMBU LETTER KHA;Lo;0;L;;;;;N;;;;;
+1903;LIMBU LETTER GA;Lo;0;L;;;;;N;;;;;
+1904;LIMBU LETTER GHA;Lo;0;L;;;;;N;;;;;
+1905;LIMBU LETTER NGA;Lo;0;L;;;;;N;;;;;
+1906;LIMBU LETTER CA;Lo;0;L;;;;;N;;;;;
+1907;LIMBU LETTER CHA;Lo;0;L;;;;;N;;;;;
+1908;LIMBU LETTER JA;Lo;0;L;;;;;N;;;;;
+1909;LIMBU LETTER JHA;Lo;0;L;;;;;N;;;;;
+190A;LIMBU LETTER YAN;Lo;0;L;;;;;N;;;;;
+190B;LIMBU LETTER TA;Lo;0;L;;;;;N;;;;;
+190C;LIMBU LETTER THA;Lo;0;L;;;;;N;;;;;
+190D;LIMBU LETTER DA;Lo;0;L;;;;;N;;;;;
+190E;LIMBU LETTER DHA;Lo;0;L;;;;;N;;;;;
+190F;LIMBU LETTER NA;Lo;0;L;;;;;N;;;;;
+1910;LIMBU LETTER PA;Lo;0;L;;;;;N;;;;;
+1911;LIMBU LETTER PHA;Lo;0;L;;;;;N;;;;;
+1912;LIMBU LETTER BA;Lo;0;L;;;;;N;;;;;
+1913;LIMBU LETTER BHA;Lo;0;L;;;;;N;;;;;
+1914;LIMBU LETTER MA;Lo;0;L;;;;;N;;;;;
+1915;LIMBU LETTER YA;Lo;0;L;;;;;N;;;;;
+1916;LIMBU LETTER RA;Lo;0;L;;;;;N;;;;;
+1917;LIMBU LETTER LA;Lo;0;L;;;;;N;;;;;
+1918;LIMBU LETTER WA;Lo;0;L;;;;;N;;;;;
+1919;LIMBU LETTER SHA;Lo;0;L;;;;;N;;;;;
+191A;LIMBU LETTER SSA;Lo;0;L;;;;;N;;;;;
+191B;LIMBU LETTER SA;Lo;0;L;;;;;N;;;;;
+191C;LIMBU LETTER HA;Lo;0;L;;;;;N;;;;;
+1920;LIMBU VOWEL SIGN A;Mn;0;NSM;;;;;N;;;;;
+1921;LIMBU VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+1922;LIMBU VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1923;LIMBU VOWEL SIGN EE;Mc;0;L;;;;;N;;;;;
+1924;LIMBU VOWEL SIGN AI;Mc;0;L;;;;;N;;;;;
+1925;LIMBU VOWEL SIGN OO;Mc;0;L;;;;;N;;;;;
+1926;LIMBU VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+1927;LIMBU VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+1928;LIMBU VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;;
+1929;LIMBU SUBJOINED LETTER YA;Mc;0;NSM;;;;;N;;;;;
+192A;LIMBU SUBJOINED LETTER RA;Mc;0;NSM;;;;;N;;;;;
+192B;LIMBU SUBJOINED LETTER WA;Mc;0;NSM;;;;;N;;;;;
+1930;LIMBU SMALL LETTER KA;Mc;0;L;;;;;N;;;;;
+1931;LIMBU SMALL LETTER NGA;Mc;0;L;;;;;N;;;;;
+1932;LIMBU SMALL LETTER ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+1933;LIMBU SMALL LETTER TA;Mc;0;L;;;;;N;;;;;
+1934;LIMBU SMALL LETTER NA;Mc;0;L;;;;;N;;;;;
+1935;LIMBU SMALL LETTER PA;Mc;0;L;;;;;N;;;;;
+1936;LIMBU SMALL LETTER MA;Mc;0;L;;;;;N;;;;;
+1937;LIMBU SMALL LETTER RA;Mc;0;L;;;;;N;;;;;
+1938;LIMBU SMALL LETTER LA;Mc;0;L;;;;;N;;;;;
+1939;LIMBU SIGN MUKPHRENG;Mn;222;NSM;;;;;N;;;;;
+193A;LIMBU SIGN KEMPHRENG;Mn;230;NSM;;;;;N;;;;;
+193B;LIMBU SIGN SA-I;Mn;220;NSM;;;;;N;;;;;
+1940;LIMBU SIGN LOO;So;0;ON;;;;;N;;;;;
+1944;LIMBU EXCLAMATION MARK;Po;0;ON;;;;;N;;;;;
+1945;LIMBU QUESTION MARK;Po;0;ON;;;;;N;;;;;
+1946;LIMBU DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+1947;LIMBU DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+1948;LIMBU DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+1949;LIMBU DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+194A;LIMBU DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+194B;LIMBU DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+194C;LIMBU DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+194D;LIMBU DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+194E;LIMBU DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+194F;LIMBU DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+1950;TAI LE LETTER KA;Lo;0;L;;;;;N;;;;;
+1951;TAI LE LETTER XA;Lo;0;L;;;;;N;;;;;
+1952;TAI LE LETTER NGA;Lo;0;L;;;;;N;;;;;
+1953;TAI LE LETTER TSA;Lo;0;L;;;;;N;;;;;
+1954;TAI LE LETTER SA;Lo;0;L;;;;;N;;;;;
+1955;TAI LE LETTER YA;Lo;0;L;;;;;N;;;;;
+1956;TAI LE LETTER TA;Lo;0;L;;;;;N;;;;;
+1957;TAI LE LETTER THA;Lo;0;L;;;;;N;;;;;
+1958;TAI LE LETTER LA;Lo;0;L;;;;;N;;;;;
+1959;TAI LE LETTER PA;Lo;0;L;;;;;N;;;;;
+195A;TAI LE LETTER PHA;Lo;0;L;;;;;N;;;;;
+195B;TAI LE LETTER MA;Lo;0;L;;;;;N;;;;;
+195C;TAI LE LETTER FA;Lo;0;L;;;;;N;;;;;
+195D;TAI LE LETTER VA;Lo;0;L;;;;;N;;;;;
+195E;TAI LE LETTER HA;Lo;0;L;;;;;N;;;;;
+195F;TAI LE LETTER QA;Lo;0;L;;;;;N;;;;;
+1960;TAI LE LETTER KHA;Lo;0;L;;;;;N;;;;;
+1961;TAI LE LETTER TSHA;Lo;0;L;;;;;N;;;;;
+1962;TAI LE LETTER NA;Lo;0;L;;;;;N;;;;;
+1963;TAI LE LETTER A;Lo;0;L;;;;;N;;;;;
+1964;TAI LE LETTER I;Lo;0;L;;;;;N;;;;;
+1965;TAI LE LETTER EE;Lo;0;L;;;;;N;;;;;
+1966;TAI LE LETTER EH;Lo;0;L;;;;;N;;;;;
+1967;TAI LE LETTER U;Lo;0;L;;;;;N;;;;;
+1968;TAI LE LETTER OO;Lo;0;L;;;;;N;;;;;
+1969;TAI LE LETTER O;Lo;0;L;;;;;N;;;;;
+196A;TAI LE LETTER UE;Lo;0;L;;;;;N;;;;;
+196B;TAI LE LETTER E;Lo;0;L;;;;;N;;;;;
+196C;TAI LE LETTER AUE;Lo;0;L;;;;;N;;;;;
+196D;TAI LE LETTER AI;Lo;0;L;;;;;N;;;;;
+1970;TAI LE LETTER TONE-2;Lo;0;L;;;;;N;;;;;
+1971;TAI LE LETTER TONE-3;Lo;0;L;;;;;N;;;;;
+1972;TAI LE LETTER TONE-4;Lo;0;L;;;;;N;;;;;
+1973;TAI LE LETTER TONE-5;Lo;0;L;;;;;N;;;;;
+1974;TAI LE LETTER TONE-6;Lo;0;L;;;;;N;;;;;
+1980;NEW TAI LUE LETTER HIGH QA;Lo;0;L;;;;;N;;;;;
+1981;NEW TAI LUE LETTER LOW QA;Lo;0;L;;;;;N;;;;;
+1982;NEW TAI LUE LETTER HIGH KA;Lo;0;L;;;;;N;;;;;
+1983;NEW TAI LUE LETTER HIGH XA;Lo;0;L;;;;;N;;;;;
+1984;NEW TAI LUE LETTER HIGH NGA;Lo;0;L;;;;;N;;;;;
+1985;NEW TAI LUE LETTER LOW KA;Lo;0;L;;;;;N;;;;;
+1986;NEW TAI LUE LETTER LOW XA;Lo;0;L;;;;;N;;;;;
+1987;NEW TAI LUE LETTER LOW NGA;Lo;0;L;;;;;N;;;;;
+1988;NEW TAI LUE LETTER HIGH TSA;Lo;0;L;;;;;N;;;;;
+1989;NEW TAI LUE LETTER HIGH SA;Lo;0;L;;;;;N;;;;;
+198A;NEW TAI LUE LETTER HIGH YA;Lo;0;L;;;;;N;;;;;
+198B;NEW TAI LUE LETTER LOW TSA;Lo;0;L;;;;;N;;;;;
+198C;NEW TAI LUE LETTER LOW SA;Lo;0;L;;;;;N;;;;;
+198D;NEW TAI LUE LETTER LOW YA;Lo;0;L;;;;;N;;;;;
+198E;NEW TAI LUE LETTER HIGH TA;Lo;0;L;;;;;N;;;;;
+198F;NEW TAI LUE LETTER HIGH THA;Lo;0;L;;;;;N;;;;;
+1990;NEW TAI LUE LETTER HIGH NA;Lo;0;L;;;;;N;;;;;
+1991;NEW TAI LUE LETTER LOW TA;Lo;0;L;;;;;N;;;;;
+1992;NEW TAI LUE LETTER LOW THA;Lo;0;L;;;;;N;;;;;
+1993;NEW TAI LUE LETTER LOW NA;Lo;0;L;;;;;N;;;;;
+1994;NEW TAI LUE LETTER HIGH PA;Lo;0;L;;;;;N;;;;;
+1995;NEW TAI LUE LETTER HIGH PHA;Lo;0;L;;;;;N;;;;;
+1996;NEW TAI LUE LETTER HIGH MA;Lo;0;L;;;;;N;;;;;
+1997;NEW TAI LUE LETTER LOW PA;Lo;0;L;;;;;N;;;;;
+1998;NEW TAI LUE LETTER LOW PHA;Lo;0;L;;;;;N;;;;;
+1999;NEW TAI LUE LETTER LOW MA;Lo;0;L;;;;;N;;;;;
+199A;NEW TAI LUE LETTER HIGH FA;Lo;0;L;;;;;N;;;;;
+199B;NEW TAI LUE LETTER HIGH VA;Lo;0;L;;;;;N;;;;;
+199C;NEW TAI LUE LETTER HIGH LA;Lo;0;L;;;;;N;;;;;
+199D;NEW TAI LUE LETTER LOW FA;Lo;0;L;;;;;N;;;;;
+199E;NEW TAI LUE LETTER LOW VA;Lo;0;L;;;;;N;;;;;
+199F;NEW TAI LUE LETTER LOW LA;Lo;0;L;;;;;N;;;;;
+19A0;NEW TAI LUE LETTER HIGH HA;Lo;0;L;;;;;N;;;;;
+19A1;NEW TAI LUE LETTER HIGH DA;Lo;0;L;;;;;N;;;;;
+19A2;NEW TAI LUE LETTER HIGH BA;Lo;0;L;;;;;N;;;;;
+19A3;NEW TAI LUE LETTER LOW HA;Lo;0;L;;;;;N;;;;;
+19A4;NEW TAI LUE LETTER LOW DA;Lo;0;L;;;;;N;;;;;
+19A5;NEW TAI LUE LETTER LOW BA;Lo;0;L;;;;;N;;;;;
+19A6;NEW TAI LUE LETTER HIGH KVA;Lo;0;L;;;;;N;;;;;
+19A7;NEW TAI LUE LETTER HIGH XVA;Lo;0;L;;;;;N;;;;;
+19A8;NEW TAI LUE LETTER LOW KVA;Lo;0;L;;;;;N;;;;;
+19A9;NEW TAI LUE LETTER LOW XVA;Lo;0;L;;;;;N;;;;;
+19B0;NEW TAI LUE VOWEL SIGN VOWEL SHORTENER;Mc;0;L;;;;;N;;;;;
+19B1;NEW TAI LUE VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+19B2;NEW TAI LUE VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+19B3;NEW TAI LUE VOWEL SIGN U;Mc;0;L;;;;;N;;;;;
+19B4;NEW TAI LUE VOWEL SIGN UU;Mc;0;L;;;;;N;;;;;
+19B5;NEW TAI LUE VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+19B6;NEW TAI LUE VOWEL SIGN AE;Mc;0;L;;;;;N;;;;;
+19B7;NEW TAI LUE VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
+19B8;NEW TAI LUE VOWEL SIGN OA;Mc;0;L;;;;;N;;;;;
+19B9;NEW TAI LUE VOWEL SIGN UE;Mc;0;L;;;;;N;;;;;
+19BA;NEW TAI LUE VOWEL SIGN AY;Mc;0;L;;;;;N;;;;;
+19BB;NEW TAI LUE VOWEL SIGN AAY;Mc;0;L;;;;;N;;;;;
+19BC;NEW TAI LUE VOWEL SIGN UY;Mc;0;L;;;;;N;;;;;
+19BD;NEW TAI LUE VOWEL SIGN OY;Mc;0;L;;;;;N;;;;;
+19BE;NEW TAI LUE VOWEL SIGN OAY;Mc;0;L;;;;;N;;;;;
+19BF;NEW TAI LUE VOWEL SIGN UEY;Mc;0;L;;;;;N;;;;;
+19C0;NEW TAI LUE VOWEL SIGN IY;Mc;0;L;;;;;N;;;;;
+19C1;NEW TAI LUE LETTER FINAL V;Lo;0;L;;;;;N;;;;;
+19C2;NEW TAI LUE LETTER FINAL NG;Lo;0;L;;;;;N;;;;;
+19C3;NEW TAI LUE LETTER FINAL N;Lo;0;L;;;;;N;;;;;
+19C4;NEW TAI LUE LETTER FINAL M;Lo;0;L;;;;;N;;;;;
+19C5;NEW TAI LUE LETTER FINAL K;Lo;0;L;;;;;N;;;;;
+19C6;NEW TAI LUE LETTER FINAL D;Lo;0;L;;;;;N;;;;;
+19C7;NEW TAI LUE LETTER FINAL B;Lo;0;L;;;;;N;;;;;
+19C8;NEW TAI LUE TONE MARK-1;Mc;0;L;;;;;N;;;;;
+19C9;NEW TAI LUE TONE MARK-2;Mc;0;L;;;;;N;;;;;
+19D0;NEW TAI LUE DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+19D1;NEW TAI LUE DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+19D2;NEW TAI LUE DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+19D3;NEW TAI LUE DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+19D4;NEW TAI LUE DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+19D5;NEW TAI LUE DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+19D6;NEW TAI LUE DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+19D7;NEW TAI LUE DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+19D8;NEW TAI LUE DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+19D9;NEW TAI LUE DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+19DE;NEW TAI LUE SIGN LAE;Po;0;ON;;;;;N;;;;;
+19DF;NEW TAI LUE SIGN LAEV;Po;0;ON;;;;;N;;;;;
+19E0;KHMER SYMBOL PATHAMASAT;So;0;ON;;;;;N;;;;;
+19E1;KHMER SYMBOL MUOY KOET;So;0;ON;;;;;N;;;;;
+19E2;KHMER SYMBOL PII KOET;So;0;ON;;;;;N;;;;;
+19E3;KHMER SYMBOL BEI KOET;So;0;ON;;;;;N;;;;;
+19E4;KHMER SYMBOL BUON KOET;So;0;ON;;;;;N;;;;;
+19E5;KHMER SYMBOL PRAM KOET;So;0;ON;;;;;N;;;;;
+19E6;KHMER SYMBOL PRAM-MUOY KOET;So;0;ON;;;;;N;;;;;
+19E7;KHMER SYMBOL PRAM-PII KOET;So;0;ON;;;;;N;;;;;
+19E8;KHMER SYMBOL PRAM-BEI KOET;So;0;ON;;;;;N;;;;;
+19E9;KHMER SYMBOL PRAM-BUON KOET;So;0;ON;;;;;N;;;;;
+19EA;KHMER SYMBOL DAP KOET;So;0;ON;;;;;N;;;;;
+19EB;KHMER SYMBOL DAP-MUOY KOET;So;0;ON;;;;;N;;;;;
+19EC;KHMER SYMBOL DAP-PII KOET;So;0;ON;;;;;N;;;;;
+19ED;KHMER SYMBOL DAP-BEI KOET;So;0;ON;;;;;N;;;;;
+19EE;KHMER SYMBOL DAP-BUON KOET;So;0;ON;;;;;N;;;;;
+19EF;KHMER SYMBOL DAP-PRAM KOET;So;0;ON;;;;;N;;;;;
+19F0;KHMER SYMBOL TUTEYASAT;So;0;ON;;;;;N;;;;;
+19F1;KHMER SYMBOL MUOY ROC;So;0;ON;;;;;N;;;;;
+19F2;KHMER SYMBOL PII ROC;So;0;ON;;;;;N;;;;;
+19F3;KHMER SYMBOL BEI ROC;So;0;ON;;;;;N;;;;;
+19F4;KHMER SYMBOL BUON ROC;So;0;ON;;;;;N;;;;;
+19F5;KHMER SYMBOL PRAM ROC;So;0;ON;;;;;N;;;;;
+19F6;KHMER SYMBOL PRAM-MUOY ROC;So;0;ON;;;;;N;;;;;
+19F7;KHMER SYMBOL PRAM-PII ROC;So;0;ON;;;;;N;;;;;
+19F8;KHMER SYMBOL PRAM-BEI ROC;So;0;ON;;;;;N;;;;;
+19F9;KHMER SYMBOL PRAM-BUON ROC;So;0;ON;;;;;N;;;;;
+19FA;KHMER SYMBOL DAP ROC;So;0;ON;;;;;N;;;;;
+19FB;KHMER SYMBOL DAP-MUOY ROC;So;0;ON;;;;;N;;;;;
+19FC;KHMER SYMBOL DAP-PII ROC;So;0;ON;;;;;N;;;;;
+19FD;KHMER SYMBOL DAP-BEI ROC;So;0;ON;;;;;N;;;;;
+19FE;KHMER SYMBOL DAP-BUON ROC;So;0;ON;;;;;N;;;;;
+19FF;KHMER SYMBOL DAP-PRAM ROC;So;0;ON;;;;;N;;;;;
+1A00;BUGINESE LETTER KA;Lo;0;L;;;;;N;;;;;
+1A01;BUGINESE LETTER GA;Lo;0;L;;;;;N;;;;;
+1A02;BUGINESE LETTER NGA;Lo;0;L;;;;;N;;;;;
+1A03;BUGINESE LETTER NGKA;Lo;0;L;;;;;N;;;;;
+1A04;BUGINESE LETTER PA;Lo;0;L;;;;;N;;;;;
+1A05;BUGINESE LETTER BA;Lo;0;L;;;;;N;;;;;
+1A06;BUGINESE LETTER MA;Lo;0;L;;;;;N;;;;;
+1A07;BUGINESE LETTER MPA;Lo;0;L;;;;;N;;;;;
+1A08;BUGINESE LETTER TA;Lo;0;L;;;;;N;;;;;
+1A09;BUGINESE LETTER DA;Lo;0;L;;;;;N;;;;;
+1A0A;BUGINESE LETTER NA;Lo;0;L;;;;;N;;;;;
+1A0B;BUGINESE LETTER NRA;Lo;0;L;;;;;N;;;;;
+1A0C;BUGINESE LETTER CA;Lo;0;L;;;;;N;;;;;
+1A0D;BUGINESE LETTER JA;Lo;0;L;;;;;N;;;;;
+1A0E;BUGINESE LETTER NYA;Lo;0;L;;;;;N;;;;;
+1A0F;BUGINESE LETTER NYCA;Lo;0;L;;;;;N;;;;;
+1A10;BUGINESE LETTER YA;Lo;0;L;;;;;N;;;;;
+1A11;BUGINESE LETTER RA;Lo;0;L;;;;;N;;;;;
+1A12;BUGINESE LETTER LA;Lo;0;L;;;;;N;;;;;
+1A13;BUGINESE LETTER VA;Lo;0;L;;;;;N;;;;;
+1A14;BUGINESE LETTER SA;Lo;0;L;;;;;N;;;;;
+1A15;BUGINESE LETTER A;Lo;0;L;;;;;N;;;;;
+1A16;BUGINESE LETTER HA;Lo;0;L;;;;;N;;;;;
+1A17;BUGINESE VOWEL SIGN I;Mn;230;NSM;;;;;N;;;;;
+1A18;BUGINESE VOWEL SIGN U;Mn;220;NSM;;;;;N;;;;;
+1A19;BUGINESE VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+1A1A;BUGINESE VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
+1A1B;BUGINESE VOWEL SIGN AE;Mc;0;L;;;;;N;;;;;
+1A1E;BUGINESE PALLAWA;Po;0;L;;;;;N;;;;;
+1A1F;BUGINESE END OF SECTION;Po;0;L;;;;;N;;;;;
+1B00;BALINESE SIGN ULU RICEM;Mn;0;NSM;;;;;N;;ardhacandra;;;
+1B01;BALINESE SIGN ULU CANDRA;Mn;0;NSM;;;;;N;;candrabindu;;;
+1B02;BALINESE SIGN CECEK;Mn;0;NSM;;;;;N;;anusvara;;;
+1B03;BALINESE SIGN SURANG;Mn;0;NSM;;;;;N;;repha;;;
+1B04;BALINESE SIGN BISAH;Mc;0;L;;;;;N;;visarga;;;
+1B05;BALINESE LETTER AKARA;Lo;0;L;;;;;N;;a;;;
+1B06;BALINESE LETTER AKARA TEDUNG;Lo;0;L;1B05 1B35;;;;N;;aa;;;
+1B07;BALINESE LETTER IKARA;Lo;0;L;;;;;N;;i;;;
+1B08;BALINESE LETTER IKARA TEDUNG;Lo;0;L;1B07 1B35;;;;N;;ii;;;
+1B09;BALINESE LETTER UKARA;Lo;0;L;;;;;N;;u;;;
+1B0A;BALINESE LETTER UKARA TEDUNG;Lo;0;L;1B09 1B35;;;;N;;uu;;;
+1B0B;BALINESE LETTER RA REPA;Lo;0;L;;;;;N;;vocalic r;;;
+1B0C;BALINESE LETTER RA REPA TEDUNG;Lo;0;L;1B0B 1B35;;;;N;;vocalic rr;;;
+1B0D;BALINESE LETTER LA LENGA;Lo;0;L;;;;;N;;vocalic l;;;
+1B0E;BALINESE LETTER LA LENGA TEDUNG;Lo;0;L;1B0D 1B35;;;;N;;vocalic ll;;;
+1B0F;BALINESE LETTER EKARA;Lo;0;L;;;;;N;;e;;;
+1B10;BALINESE LETTER AIKARA;Lo;0;L;;;;;N;;ai;;;
+1B11;BALINESE LETTER OKARA;Lo;0;L;;;;;N;;o;;;
+1B12;BALINESE LETTER OKARA TEDUNG;Lo;0;L;1B11 1B35;;;;N;;au;;;
+1B13;BALINESE LETTER KA;Lo;0;L;;;;;N;;;;;
+1B14;BALINESE LETTER KA MAHAPRANA;Lo;0;L;;;;;N;;kha;;;
+1B15;BALINESE LETTER GA;Lo;0;L;;;;;N;;;;;
+1B16;BALINESE LETTER GA GORA;Lo;0;L;;;;;N;;gha;;;
+1B17;BALINESE LETTER NGA;Lo;0;L;;;;;N;;;;;
+1B18;BALINESE LETTER CA;Lo;0;L;;;;;N;;;;;
+1B19;BALINESE LETTER CA LACA;Lo;0;L;;;;;N;;cha;;;
+1B1A;BALINESE LETTER JA;Lo;0;L;;;;;N;;;;;
+1B1B;BALINESE LETTER JA JERA;Lo;0;L;;;;;N;;jha;;;
+1B1C;BALINESE LETTER NYA;Lo;0;L;;;;;N;;;;;
+1B1D;BALINESE LETTER TA LATIK;Lo;0;L;;;;;N;;tta;;;
+1B1E;BALINESE LETTER TA MURDA MAHAPRANA;Lo;0;L;;;;;N;;ttha;;;
+1B1F;BALINESE LETTER DA MURDA ALPAPRANA;Lo;0;L;;;;;N;;dda;;;
+1B20;BALINESE LETTER DA MURDA MAHAPRANA;Lo;0;L;;;;;N;;ddha;;;
+1B21;BALINESE LETTER NA RAMBAT;Lo;0;L;;;;;N;;nna;;;
+1B22;BALINESE LETTER TA;Lo;0;L;;;;;N;;;;;
+1B23;BALINESE LETTER TA TAWA;Lo;0;L;;;;;N;;tha;;;
+1B24;BALINESE LETTER DA;Lo;0;L;;;;;N;;;;;
+1B25;BALINESE LETTER DA MADU;Lo;0;L;;;;;N;;dha;;;
+1B26;BALINESE LETTER NA;Lo;0;L;;;;;N;;;;;
+1B27;BALINESE LETTER PA;Lo;0;L;;;;;N;;;;;
+1B28;BALINESE LETTER PA KAPAL;Lo;0;L;;;;;N;;pha;;;
+1B29;BALINESE LETTER BA;Lo;0;L;;;;;N;;;;;
+1B2A;BALINESE LETTER BA KEMBANG;Lo;0;L;;;;;N;;bha;;;
+1B2B;BALINESE LETTER MA;Lo;0;L;;;;;N;;;;;
+1B2C;BALINESE LETTER YA;Lo;0;L;;;;;N;;;;;
+1B2D;BALINESE LETTER RA;Lo;0;L;;;;;N;;;;;
+1B2E;BALINESE LETTER LA;Lo;0;L;;;;;N;;;;;
+1B2F;BALINESE LETTER WA;Lo;0;L;;;;;N;;;;;
+1B30;BALINESE LETTER SA SAGA;Lo;0;L;;;;;N;;sha;;;
+1B31;BALINESE LETTER SA SAPA;Lo;0;L;;;;;N;;ssa;;;
+1B32;BALINESE LETTER SA;Lo;0;L;;;;;N;;;;;
+1B33;BALINESE LETTER HA;Lo;0;L;;;;;N;;;;;
+1B34;BALINESE SIGN REREKAN;Mn;7;NSM;;;;;N;;nukta;;;
+1B35;BALINESE VOWEL SIGN TEDUNG;Mc;0;L;;;;;N;;aa;;;
+1B36;BALINESE VOWEL SIGN ULU;Mn;0;NSM;;;;;N;;i;;;
+1B37;BALINESE VOWEL SIGN ULU SARI;Mn;0;NSM;;;;;N;;ii;;;
+1B38;BALINESE VOWEL SIGN SUKU;Mn;0;NSM;;;;;N;;u;;;
+1B39;BALINESE VOWEL SIGN SUKU ILUT;Mn;0;NSM;;;;;N;;uu;;;
+1B3A;BALINESE VOWEL SIGN RA REPA;Mn;0;NSM;;;;;N;;vocalic r;;;
+1B3B;BALINESE VOWEL SIGN RA REPA TEDUNG;Mc;0;L;1B3A 1B35;;;;N;;vocalic rr;;;
+1B3C;BALINESE VOWEL SIGN LA LENGA;Mn;0;NSM;;;;;N;;vocalic l;;;
+1B3D;BALINESE VOWEL SIGN LA LENGA TEDUNG;Mc;0;L;1B3C 1B35;;;;N;;vocalic ll;;;
+1B3E;BALINESE VOWEL SIGN TALING;Mc;0;L;;;;;N;;e;;;
+1B3F;BALINESE VOWEL SIGN TALING REPA;Mc;0;L;;;;;N;;ai;;;
+1B40;BALINESE VOWEL SIGN TALING TEDUNG;Mc;0;L;1B3E 1B35;;;;N;;o;;;
+1B41;BALINESE VOWEL SIGN TALING REPA TEDUNG;Mc;0;L;1B3F 1B35;;;;N;;au;;;
+1B42;BALINESE VOWEL SIGN PEPET;Mn;0;NSM;;;;;N;;ae;;;
+1B43;BALINESE VOWEL SIGN PEPET TEDUNG;Mc;0;L;1B42 1B35;;;;N;;oe;;;
+1B44;BALINESE ADEG ADEG;Mc;9;L;;;;;N;;virama;;;
+1B45;BALINESE LETTER KAF SASAK;Lo;0;L;;;;;N;;;;;
+1B46;BALINESE LETTER KHOT SASAK;Lo;0;L;;;;;N;;;;;
+1B47;BALINESE LETTER TZIR SASAK;Lo;0;L;;;;;N;;;;;
+1B48;BALINESE LETTER EF SASAK;Lo;0;L;;;;;N;;;;;
+1B49;BALINESE LETTER VE SASAK;Lo;0;L;;;;;N;;;;;
+1B4A;BALINESE LETTER ZAL SASAK;Lo;0;L;;;;;N;;;;;
+1B4B;BALINESE LETTER ASYURA SASAK;Lo;0;L;;;;;N;;;;;
+1B50;BALINESE DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+1B51;BALINESE DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+1B52;BALINESE DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+1B53;BALINESE DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+1B54;BALINESE DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+1B55;BALINESE DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+1B56;BALINESE DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+1B57;BALINESE DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+1B58;BALINESE DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+1B59;BALINESE DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+1B5A;BALINESE PANTI;Po;0;L;;;;;N;;section;;;
+1B5B;BALINESE PAMADA;Po;0;L;;;;;N;;honorific section;;;
+1B5C;BALINESE WINDU;Po;0;L;;;;;N;;punctuation ring;;;
+1B5D;BALINESE CARIK PAMUNGKAH;Po;0;L;;;;;N;;colon;;;
+1B5E;BALINESE CARIK SIKI;Po;0;L;;;;;N;;danda;;;
+1B5F;BALINESE CARIK PAREREN;Po;0;L;;;;;N;;double danda;;;
+1B60;BALINESE PAMENENG;Po;0;L;;;;;N;;line-breaking hyphen;;;
+1B61;BALINESE MUSICAL SYMBOL DONG;So;0;L;;;;;N;;;;;
+1B62;BALINESE MUSICAL SYMBOL DENG;So;0;L;;;;;N;;;;;
+1B63;BALINESE MUSICAL SYMBOL DUNG;So;0;L;;;;;N;;;;;
+1B64;BALINESE MUSICAL SYMBOL DANG;So;0;L;;;;;N;;;;;
+1B65;BALINESE MUSICAL SYMBOL DANG SURANG;So;0;L;;;;;N;;;;;
+1B66;BALINESE MUSICAL SYMBOL DING;So;0;L;;;;;N;;;;;
+1B67;BALINESE MUSICAL SYMBOL DAENG;So;0;L;;;;;N;;;;;
+1B68;BALINESE MUSICAL SYMBOL DEUNG;So;0;L;;;;;N;;;;;
+1B69;BALINESE MUSICAL SYMBOL DAING;So;0;L;;;;;N;;;;;
+1B6A;BALINESE MUSICAL SYMBOL DANG GEDE;So;0;L;;;;;N;;;;;
+1B6B;BALINESE MUSICAL SYMBOL COMBINING TEGEH;Mn;230;NSM;;;;;N;;;;;
+1B6C;BALINESE MUSICAL SYMBOL COMBINING ENDEP;Mn;220;NSM;;;;;N;;;;;
+1B6D;BALINESE MUSICAL SYMBOL COMBINING KEMPUL;Mn;230;NSM;;;;;N;;;;;
+1B6E;BALINESE MUSICAL SYMBOL COMBINING KEMPLI;Mn;230;NSM;;;;;N;;;;;
+1B6F;BALINESE MUSICAL SYMBOL COMBINING JEGOGAN;Mn;230;NSM;;;;;N;;;;;
+1B70;BALINESE MUSICAL SYMBOL COMBINING KEMPUL WITH JEGOGAN;Mn;230;NSM;;;;;N;;;;;
+1B71;BALINESE MUSICAL SYMBOL COMBINING KEMPLI WITH JEGOGAN;Mn;230;NSM;;;;;N;;;;;
+1B72;BALINESE MUSICAL SYMBOL COMBINING BENDE;Mn;230;NSM;;;;;N;;;;;
+1B73;BALINESE MUSICAL SYMBOL COMBINING GONG;Mn;230;NSM;;;;;N;;;;;
+1B74;BALINESE MUSICAL SYMBOL RIGHT-HAND OPEN DUG;So;0;L;;;;;N;;;;;
+1B75;BALINESE MUSICAL SYMBOL RIGHT-HAND OPEN DAG;So;0;L;;;;;N;;;;;
+1B76;BALINESE MUSICAL SYMBOL RIGHT-HAND CLOSED TUK;So;0;L;;;;;N;;;;;
+1B77;BALINESE MUSICAL SYMBOL RIGHT-HAND CLOSED TAK;So;0;L;;;;;N;;;;;
+1B78;BALINESE MUSICAL SYMBOL LEFT-HAND OPEN PANG;So;0;L;;;;;N;;;;;
+1B79;BALINESE MUSICAL SYMBOL LEFT-HAND OPEN PUNG;So;0;L;;;;;N;;;;;
+1B7A;BALINESE MUSICAL SYMBOL LEFT-HAND CLOSED PLAK;So;0;L;;;;;N;;;;;
+1B7B;BALINESE MUSICAL SYMBOL LEFT-HAND CLOSED PLUK;So;0;L;;;;;N;;;;;
+1B7C;BALINESE MUSICAL SYMBOL LEFT-HAND OPEN PING;So;0;L;;;;;N;;;;;
+1D00;LATIN LETTER SMALL CAPITAL A;Ll;0;L;;;;;N;;;;;
+1D01;LATIN LETTER SMALL CAPITAL AE;Ll;0;L;;;;;N;;;;;
+1D02;LATIN SMALL LETTER TURNED AE;Ll;0;L;;;;;N;;;;;
+1D03;LATIN LETTER SMALL CAPITAL BARRED B;Ll;0;L;;;;;N;;;;;
+1D04;LATIN LETTER SMALL CAPITAL C;Ll;0;L;;;;;N;;;;;
+1D05;LATIN LETTER SMALL CAPITAL D;Ll;0;L;;;;;N;;;;;
+1D06;LATIN LETTER SMALL CAPITAL ETH;Ll;0;L;;;;;N;;;;;
+1D07;LATIN LETTER SMALL CAPITAL E;Ll;0;L;;;;;N;;;;;
+1D08;LATIN SMALL LETTER TURNED OPEN E;Ll;0;L;;;;;N;;;;;
+1D09;LATIN SMALL LETTER TURNED I;Ll;0;L;;;;;N;;;;;
+1D0A;LATIN LETTER SMALL CAPITAL J;Ll;0;L;;;;;N;;;;;
+1D0B;LATIN LETTER SMALL CAPITAL K;Ll;0;L;;;;;N;;;;;
+1D0C;LATIN LETTER SMALL CAPITAL L WITH STROKE;Ll;0;L;;;;;N;;;;;
+1D0D;LATIN LETTER SMALL CAPITAL M;Ll;0;L;;;;;N;;;;;
+1D0E;LATIN LETTER SMALL CAPITAL REVERSED N;Ll;0;L;;;;;N;;;;;
+1D0F;LATIN LETTER SMALL CAPITAL O;Ll;0;L;;;;;N;;;;;
+1D10;LATIN LETTER SMALL CAPITAL OPEN O;Ll;0;L;;;;;N;;;;;
+1D11;LATIN SMALL LETTER SIDEWAYS O;Ll;0;L;;;;;N;;;;;
+1D12;LATIN SMALL LETTER SIDEWAYS OPEN O;Ll;0;L;;;;;N;;;;;
+1D13;LATIN SMALL LETTER SIDEWAYS O WITH STROKE;Ll;0;L;;;;;N;;;;;
+1D14;LATIN SMALL LETTER TURNED OE;Ll;0;L;;;;;N;;;;;
+1D15;LATIN LETTER SMALL CAPITAL OU;Ll;0;L;;;;;N;;;;;
+1D16;LATIN SMALL LETTER TOP HALF O;Ll;0;L;;;;;N;;;;;
+1D17;LATIN SMALL LETTER BOTTOM HALF O;Ll;0;L;;;;;N;;;;;
+1D18;LATIN LETTER SMALL CAPITAL P;Ll;0;L;;;;;N;;;;;
+1D19;LATIN LETTER SMALL CAPITAL REVERSED R;Ll;0;L;;;;;N;;;;;
+1D1A;LATIN LETTER SMALL CAPITAL TURNED R;Ll;0;L;;;;;N;;;;;
+1D1B;LATIN LETTER SMALL CAPITAL T;Ll;0;L;;;;;N;;;;;
+1D1C;LATIN LETTER SMALL CAPITAL U;Ll;0;L;;;;;N;;;;;
+1D1D;LATIN SMALL LETTER SIDEWAYS U;Ll;0;L;;;;;N;;;;;
+1D1E;LATIN SMALL LETTER SIDEWAYS DIAERESIZED U;Ll;0;L;;;;;N;;;;;
+1D1F;LATIN SMALL LETTER SIDEWAYS TURNED M;Ll;0;L;;;;;N;;;;;
+1D20;LATIN LETTER SMALL CAPITAL V;Ll;0;L;;;;;N;;;;;
+1D21;LATIN LETTER SMALL CAPITAL W;Ll;0;L;;;;;N;;;;;
+1D22;LATIN LETTER SMALL CAPITAL Z;Ll;0;L;;;;;N;;;;;
+1D23;LATIN LETTER SMALL CAPITAL EZH;Ll;0;L;;;;;N;;;;;
+1D24;LATIN LETTER VOICED LARYNGEAL SPIRANT;Ll;0;L;;;;;N;;;;;
+1D25;LATIN LETTER AIN;Ll;0;L;;;;;N;;;;;
+1D26;GREEK LETTER SMALL CAPITAL GAMMA;Ll;0;L;;;;;N;;;;;
+1D27;GREEK LETTER SMALL CAPITAL LAMDA;Ll;0;L;;;;;N;;;;;
+1D28;GREEK LETTER SMALL CAPITAL PI;Ll;0;L;;;;;N;;;;;
+1D29;GREEK LETTER SMALL CAPITAL RHO;Ll;0;L;;;;;N;;;;;
+1D2A;GREEK LETTER SMALL CAPITAL PSI;Ll;0;L;;;;;N;;;;;
+1D2B;CYRILLIC LETTER SMALL CAPITAL EL;Ll;0;L;;;;;N;;;;;
+1D2C;MODIFIER LETTER CAPITAL A;Lm;0;L;<super> 0041;;;;N;;;;;
+1D2D;MODIFIER LETTER CAPITAL AE;Lm;0;L;<super> 00C6;;;;N;;;;;
+1D2E;MODIFIER LETTER CAPITAL B;Lm;0;L;<super> 0042;;;;N;;;;;
+1D2F;MODIFIER LETTER CAPITAL BARRED B;Lm;0;L;;;;;N;;;;;
+1D30;MODIFIER LETTER CAPITAL D;Lm;0;L;<super> 0044;;;;N;;;;;
+1D31;MODIFIER LETTER CAPITAL E;Lm;0;L;<super> 0045;;;;N;;;;;
+1D32;MODIFIER LETTER CAPITAL REVERSED E;Lm;0;L;<super> 018E;;;;N;;;;;
+1D33;MODIFIER LETTER CAPITAL G;Lm;0;L;<super> 0047;;;;N;;;;;
+1D34;MODIFIER LETTER CAPITAL H;Lm;0;L;<super> 0048;;;;N;;;;;
+1D35;MODIFIER LETTER CAPITAL I;Lm;0;L;<super> 0049;;;;N;;;;;
+1D36;MODIFIER LETTER CAPITAL J;Lm;0;L;<super> 004A;;;;N;;;;;
+1D37;MODIFIER LETTER CAPITAL K;Lm;0;L;<super> 004B;;;;N;;;;;
+1D38;MODIFIER LETTER CAPITAL L;Lm;0;L;<super> 004C;;;;N;;;;;
+1D39;MODIFIER LETTER CAPITAL M;Lm;0;L;<super> 004D;;;;N;;;;;
+1D3A;MODIFIER LETTER CAPITAL N;Lm;0;L;<super> 004E;;;;N;;;;;
+1D3B;MODIFIER LETTER CAPITAL REVERSED N;Lm;0;L;;;;;N;;;;;
+1D3C;MODIFIER LETTER CAPITAL O;Lm;0;L;<super> 004F;;;;N;;;;;
+1D3D;MODIFIER LETTER CAPITAL OU;Lm;0;L;<super> 0222;;;;N;;;;;
+1D3E;MODIFIER LETTER CAPITAL P;Lm;0;L;<super> 0050;;;;N;;;;;
+1D3F;MODIFIER LETTER CAPITAL R;Lm;0;L;<super> 0052;;;;N;;;;;
+1D40;MODIFIER LETTER CAPITAL T;Lm;0;L;<super> 0054;;;;N;;;;;
+1D41;MODIFIER LETTER CAPITAL U;Lm;0;L;<super> 0055;;;;N;;;;;
+1D42;MODIFIER LETTER CAPITAL W;Lm;0;L;<super> 0057;;;;N;;;;;
+1D43;MODIFIER LETTER SMALL A;Lm;0;L;<super> 0061;;;;N;;;;;
+1D44;MODIFIER LETTER SMALL TURNED A;Lm;0;L;<super> 0250;;;;N;;;;;
+1D45;MODIFIER LETTER SMALL ALPHA;Lm;0;L;<super> 0251;;;;N;;;;;
+1D46;MODIFIER LETTER SMALL TURNED AE;Lm;0;L;<super> 1D02;;;;N;;;;;
+1D47;MODIFIER LETTER SMALL B;Lm;0;L;<super> 0062;;;;N;;;;;
+1D48;MODIFIER LETTER SMALL D;Lm;0;L;<super> 0064;;;;N;;;;;
+1D49;MODIFIER LETTER SMALL E;Lm;0;L;<super> 0065;;;;N;;;;;
+1D4A;MODIFIER LETTER SMALL SCHWA;Lm;0;L;<super> 0259;;;;N;;;;;
+1D4B;MODIFIER LETTER SMALL OPEN E;Lm;0;L;<super> 025B;;;;N;;;;;
+1D4C;MODIFIER LETTER SMALL TURNED OPEN E;Lm;0;L;<super> 025C;;;;N;;;;;
+1D4D;MODIFIER LETTER SMALL G;Lm;0;L;<super> 0067;;;;N;;;;;
+1D4E;MODIFIER LETTER SMALL TURNED I;Lm;0;L;;;;;N;;;;;
+1D4F;MODIFIER LETTER SMALL K;Lm;0;L;<super> 006B;;;;N;;;;;
+1D50;MODIFIER LETTER SMALL M;Lm;0;L;<super> 006D;;;;N;;;;;
+1D51;MODIFIER LETTER SMALL ENG;Lm;0;L;<super> 014B;;;;N;;;;;
+1D52;MODIFIER LETTER SMALL O;Lm;0;L;<super> 006F;;;;N;;;;;
+1D53;MODIFIER LETTER SMALL OPEN O;Lm;0;L;<super> 0254;;;;N;;;;;
+1D54;MODIFIER LETTER SMALL TOP HALF O;Lm;0;L;<super> 1D16;;;;N;;;;;
+1D55;MODIFIER LETTER SMALL BOTTOM HALF O;Lm;0;L;<super> 1D17;;;;N;;;;;
+1D56;MODIFIER LETTER SMALL P;Lm;0;L;<super> 0070;;;;N;;;;;
+1D57;MODIFIER LETTER SMALL T;Lm;0;L;<super> 0074;;;;N;;;;;
+1D58;MODIFIER LETTER SMALL U;Lm;0;L;<super> 0075;;;;N;;;;;
+1D59;MODIFIER LETTER SMALL SIDEWAYS U;Lm;0;L;<super> 1D1D;;;;N;;;;;
+1D5A;MODIFIER LETTER SMALL TURNED M;Lm;0;L;<super> 026F;;;;N;;;;;
+1D5B;MODIFIER LETTER SMALL V;Lm;0;L;<super> 0076;;;;N;;;;;
+1D5C;MODIFIER LETTER SMALL AIN;Lm;0;L;<super> 1D25;;;;N;;;;;
+1D5D;MODIFIER LETTER SMALL BETA;Lm;0;L;<super> 03B2;;;;N;;;;;
+1D5E;MODIFIER LETTER SMALL GREEK GAMMA;Lm;0;L;<super> 03B3;;;;N;;;;;
+1D5F;MODIFIER LETTER SMALL DELTA;Lm;0;L;<super> 03B4;;;;N;;;;;
+1D60;MODIFIER LETTER SMALL GREEK PHI;Lm;0;L;<super> 03C6;;;;N;;;;;
+1D61;MODIFIER LETTER SMALL CHI;Lm;0;L;<super> 03C7;;;;N;;;;;
+1D62;LATIN SUBSCRIPT SMALL LETTER I;Ll;0;L;<sub> 0069;;;;N;;;;;
+1D63;LATIN SUBSCRIPT SMALL LETTER R;Ll;0;L;<sub> 0072;;;;N;;;;;
+1D64;LATIN SUBSCRIPT SMALL LETTER U;Ll;0;L;<sub> 0075;;;;N;;;;;
+1D65;LATIN SUBSCRIPT SMALL LETTER V;Ll;0;L;<sub> 0076;;;;N;;;;;
+1D66;GREEK SUBSCRIPT SMALL LETTER BETA;Ll;0;L;<sub> 03B2;;;;N;;;;;
+1D67;GREEK SUBSCRIPT SMALL LETTER GAMMA;Ll;0;L;<sub> 03B3;;;;N;;;;;
+1D68;GREEK SUBSCRIPT SMALL LETTER RHO;Ll;0;L;<sub> 03C1;;;;N;;;;;
+1D69;GREEK SUBSCRIPT SMALL LETTER PHI;Ll;0;L;<sub> 03C6;;;;N;;;;;
+1D6A;GREEK SUBSCRIPT SMALL LETTER CHI;Ll;0;L;<sub> 03C7;;;;N;;;;;
+1D6B;LATIN SMALL LETTER UE;Ll;0;L;;;;;N;;;;;
+1D6C;LATIN SMALL LETTER B WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D6D;LATIN SMALL LETTER D WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D6E;LATIN SMALL LETTER F WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D6F;LATIN SMALL LETTER M WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D70;LATIN SMALL LETTER N WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D71;LATIN SMALL LETTER P WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D72;LATIN SMALL LETTER R WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D73;LATIN SMALL LETTER R WITH FISHHOOK AND MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D74;LATIN SMALL LETTER S WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D75;LATIN SMALL LETTER T WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D76;LATIN SMALL LETTER Z WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
+1D77;LATIN SMALL LETTER TURNED G;Ll;0;L;;;;;N;;;;;
+1D78;MODIFIER LETTER CYRILLIC EN;Lm;0;L;<super> 043D;;;;N;;;;;
+1D79;LATIN SMALL LETTER INSULAR G;Ll;0;L;;;;;N;;;;;
+1D7A;LATIN SMALL LETTER TH WITH STRIKETHROUGH;Ll;0;L;;;;;N;;;;;
+1D7B;LATIN SMALL CAPITAL LETTER I WITH STROKE;Ll;0;L;;;;;N;;;;;
+1D7C;LATIN SMALL LETTER IOTA WITH STROKE;Ll;0;L;;;;;N;;;;;
+1D7D;LATIN SMALL LETTER P WITH STROKE;Ll;0;L;;;;;N;;;2C63;;2C63
+1D7E;LATIN SMALL CAPITAL LETTER U WITH STROKE;Ll;0;L;;;;;N;;;;;
+1D7F;LATIN SMALL LETTER UPSILON WITH STROKE;Ll;0;L;;;;;N;;;;;
+1D80;LATIN SMALL LETTER B WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D81;LATIN SMALL LETTER D WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D82;LATIN SMALL LETTER F WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D83;LATIN SMALL LETTER G WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D84;LATIN SMALL LETTER K WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D85;LATIN SMALL LETTER L WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D86;LATIN SMALL LETTER M WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D87;LATIN SMALL LETTER N WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D88;LATIN SMALL LETTER P WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D89;LATIN SMALL LETTER R WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D8A;LATIN SMALL LETTER S WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D8B;LATIN SMALL LETTER ESH WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D8C;LATIN SMALL LETTER V WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D8D;LATIN SMALL LETTER X WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D8E;LATIN SMALL LETTER Z WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D8F;LATIN SMALL LETTER A WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D90;LATIN SMALL LETTER ALPHA WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D91;LATIN SMALL LETTER D WITH HOOK AND TAIL;Ll;0;L;;;;;N;;;;;
+1D92;LATIN SMALL LETTER E WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D93;LATIN SMALL LETTER OPEN E WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D94;LATIN SMALL LETTER REVERSED OPEN E WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D95;LATIN SMALL LETTER SCHWA WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D96;LATIN SMALL LETTER I WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D97;LATIN SMALL LETTER OPEN O WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D98;LATIN SMALL LETTER ESH WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D99;LATIN SMALL LETTER U WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D9A;LATIN SMALL LETTER EZH WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+1D9B;MODIFIER LETTER SMALL TURNED ALPHA;Lm;0;L;<super> 0252;;;;N;;;;;
+1D9C;MODIFIER LETTER SMALL C;Lm;0;L;<super> 0063;;;;N;;;;;
+1D9D;MODIFIER LETTER SMALL C WITH CURL;Lm;0;L;<super> 0255;;;;N;;;;;
+1D9E;MODIFIER LETTER SMALL ETH;Lm;0;L;<super> 00F0;;;;N;;;;;
+1D9F;MODIFIER LETTER SMALL REVERSED OPEN E;Lm;0;L;<super> 025C;;;;N;;;;;
+1DA0;MODIFIER LETTER SMALL F;Lm;0;L;<super> 0066;;;;N;;;;;
+1DA1;MODIFIER LETTER SMALL DOTLESS J WITH STROKE;Lm;0;L;<super> 025F;;;;N;;;;;
+1DA2;MODIFIER LETTER SMALL SCRIPT G;Lm;0;L;<super> 0261;;;;N;;;;;
+1DA3;MODIFIER LETTER SMALL TURNED H;Lm;0;L;<super> 0265;;;;N;;;;;
+1DA4;MODIFIER LETTER SMALL I WITH STROKE;Lm;0;L;<super> 0268;;;;N;;;;;
+1DA5;MODIFIER LETTER SMALL IOTA;Lm;0;L;<super> 0269;;;;N;;;;;
+1DA6;MODIFIER LETTER SMALL CAPITAL I;Lm;0;L;<super> 026A;;;;N;;;;;
+1DA7;MODIFIER LETTER SMALL CAPITAL I WITH STROKE;Lm;0;L;<super> 1D7B;;;;N;;;;;
+1DA8;MODIFIER LETTER SMALL J WITH CROSSED-TAIL;Lm;0;L;<super> 029D;;;;N;;;;;
+1DA9;MODIFIER LETTER SMALL L WITH RETROFLEX HOOK;Lm;0;L;<super> 026D;;;;N;;;;;
+1DAA;MODIFIER LETTER SMALL L WITH PALATAL HOOK;Lm;0;L;<super> 1D85;;;;N;;;;;
+1DAB;MODIFIER LETTER SMALL CAPITAL L;Lm;0;L;<super> 029F;;;;N;;;;;
+1DAC;MODIFIER LETTER SMALL M WITH HOOK;Lm;0;L;<super> 0271;;;;N;;;;;
+1DAD;MODIFIER LETTER SMALL TURNED M WITH LONG LEG;Lm;0;L;<super> 0270;;;;N;;;;;
+1DAE;MODIFIER LETTER SMALL N WITH LEFT HOOK;Lm;0;L;<super> 0272;;;;N;;;;;
+1DAF;MODIFIER LETTER SMALL N WITH RETROFLEX HOOK;Lm;0;L;<super> 0273;;;;N;;;;;
+1DB0;MODIFIER LETTER SMALL CAPITAL N;Lm;0;L;<super> 0274;;;;N;;;;;
+1DB1;MODIFIER LETTER SMALL BARRED O;Lm;0;L;<super> 0275;;;;N;;;;;
+1DB2;MODIFIER LETTER SMALL PHI;Lm;0;L;<super> 0278;;;;N;;;;;
+1DB3;MODIFIER LETTER SMALL S WITH HOOK;Lm;0;L;<super> 0282;;;;N;;;;;
+1DB4;MODIFIER LETTER SMALL ESH;Lm;0;L;<super> 0283;;;;N;;;;;
+1DB5;MODIFIER LETTER SMALL T WITH PALATAL HOOK;Lm;0;L;<super> 01AB;;;;N;;;;;
+1DB6;MODIFIER LETTER SMALL U BAR;Lm;0;L;<super> 0289;;;;N;;;;;
+1DB7;MODIFIER LETTER SMALL UPSILON;Lm;0;L;<super> 028A;;;;N;;;;;
+1DB8;MODIFIER LETTER SMALL CAPITAL U;Lm;0;L;<super> 1D1C;;;;N;;;;;
+1DB9;MODIFIER LETTER SMALL V WITH HOOK;Lm;0;L;<super> 028B;;;;N;;;;;
+1DBA;MODIFIER LETTER SMALL TURNED V;Lm;0;L;<super> 028C;;;;N;;;;;
+1DBB;MODIFIER LETTER SMALL Z;Lm;0;L;<super> 007A;;;;N;;;;;
+1DBC;MODIFIER LETTER SMALL Z WITH RETROFLEX HOOK;Lm;0;L;<super> 0290;;;;N;;;;;
+1DBD;MODIFIER LETTER SMALL Z WITH CURL;Lm;0;L;<super> 0291;;;;N;;;;;
+1DBE;MODIFIER LETTER SMALL EZH;Lm;0;L;<super> 0292;;;;N;;;;;
+1DBF;MODIFIER LETTER SMALL THETA;Lm;0;L;<super> 03B8;;;;N;;;;;
+1DC0;COMBINING DOTTED GRAVE ACCENT;Mn;230;NSM;;;;;N;;;;;
+1DC1;COMBINING DOTTED ACUTE ACCENT;Mn;230;NSM;;;;;N;;;;;
+1DC2;COMBINING SNAKE BELOW;Mn;220;NSM;;;;;N;;;;;
+1DC3;COMBINING SUSPENSION MARK;Mn;230;NSM;;;;;N;;;;;
+1DC4;COMBINING MACRON-ACUTE;Mn;230;NSM;;;;;N;;;;;
+1DC5;COMBINING GRAVE-MACRON;Mn;230;NSM;;;;;N;;;;;
+1DC6;COMBINING MACRON-GRAVE;Mn;230;NSM;;;;;N;;;;;
+1DC7;COMBINING ACUTE-MACRON;Mn;230;NSM;;;;;N;;;;;
+1DC8;COMBINING GRAVE-ACUTE-GRAVE;Mn;230;NSM;;;;;N;;;;;
+1DC9;COMBINING ACUTE-GRAVE-ACUTE;Mn;230;NSM;;;;;N;;;;;
+1DCA;COMBINING LATIN SMALL LETTER R BELOW;Mn;220;NSM;;;;;N;;;;;
+1DFE;COMBINING LEFT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;;
+1DFF;COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;;
+1E00;LATIN CAPITAL LETTER A WITH RING BELOW;Lu;0;L;0041 0325;;;;N;;;;1E01;
+1E01;LATIN SMALL LETTER A WITH RING BELOW;Ll;0;L;0061 0325;;;;N;;;1E00;;1E00
+1E02;LATIN CAPITAL LETTER B WITH DOT ABOVE;Lu;0;L;0042 0307;;;;N;;;;1E03;
+1E03;LATIN SMALL LETTER B WITH DOT ABOVE;Ll;0;L;0062 0307;;;;N;;;1E02;;1E02
+1E04;LATIN CAPITAL LETTER B WITH DOT BELOW;Lu;0;L;0042 0323;;;;N;;;;1E05;
+1E05;LATIN SMALL LETTER B WITH DOT BELOW;Ll;0;L;0062 0323;;;;N;;;1E04;;1E04
+1E06;LATIN CAPITAL LETTER B WITH LINE BELOW;Lu;0;L;0042 0331;;;;N;;;;1E07;
+1E07;LATIN SMALL LETTER B WITH LINE BELOW;Ll;0;L;0062 0331;;;;N;;;1E06;;1E06
+1E08;LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE;Lu;0;L;00C7 0301;;;;N;;;;1E09;
+1E09;LATIN SMALL LETTER C WITH CEDILLA AND ACUTE;Ll;0;L;00E7 0301;;;;N;;;1E08;;1E08
+1E0A;LATIN CAPITAL LETTER D WITH DOT ABOVE;Lu;0;L;0044 0307;;;;N;;;;1E0B;
+1E0B;LATIN SMALL LETTER D WITH DOT ABOVE;Ll;0;L;0064 0307;;;;N;;;1E0A;;1E0A
+1E0C;LATIN CAPITAL LETTER D WITH DOT BELOW;Lu;0;L;0044 0323;;;;N;;;;1E0D;
+1E0D;LATIN SMALL LETTER D WITH DOT BELOW;Ll;0;L;0064 0323;;;;N;;;1E0C;;1E0C
+1E0E;LATIN CAPITAL LETTER D WITH LINE BELOW;Lu;0;L;0044 0331;;;;N;;;;1E0F;
+1E0F;LATIN SMALL LETTER D WITH LINE BELOW;Ll;0;L;0064 0331;;;;N;;;1E0E;;1E0E
+1E10;LATIN CAPITAL LETTER D WITH CEDILLA;Lu;0;L;0044 0327;;;;N;;;;1E11;
+1E11;LATIN SMALL LETTER D WITH CEDILLA;Ll;0;L;0064 0327;;;;N;;;1E10;;1E10
+1E12;LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW;Lu;0;L;0044 032D;;;;N;;;;1E13;
+1E13;LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW;Ll;0;L;0064 032D;;;;N;;;1E12;;1E12
+1E14;LATIN CAPITAL LETTER E WITH MACRON AND GRAVE;Lu;0;L;0112 0300;;;;N;;;;1E15;
+1E15;LATIN SMALL LETTER E WITH MACRON AND GRAVE;Ll;0;L;0113 0300;;;;N;;;1E14;;1E14
+1E16;LATIN CAPITAL LETTER E WITH MACRON AND ACUTE;Lu;0;L;0112 0301;;;;N;;;;1E17;
+1E17;LATIN SMALL LETTER E WITH MACRON AND ACUTE;Ll;0;L;0113 0301;;;;N;;;1E16;;1E16
+1E18;LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW;Lu;0;L;0045 032D;;;;N;;;;1E19;
+1E19;LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW;Ll;0;L;0065 032D;;;;N;;;1E18;;1E18
+1E1A;LATIN CAPITAL LETTER E WITH TILDE BELOW;Lu;0;L;0045 0330;;;;N;;;;1E1B;
+1E1B;LATIN SMALL LETTER E WITH TILDE BELOW;Ll;0;L;0065 0330;;;;N;;;1E1A;;1E1A
+1E1C;LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE;Lu;0;L;0228 0306;;;;N;;;;1E1D;
+1E1D;LATIN SMALL LETTER E WITH CEDILLA AND BREVE;Ll;0;L;0229 0306;;;;N;;;1E1C;;1E1C
+1E1E;LATIN CAPITAL LETTER F WITH DOT ABOVE;Lu;0;L;0046 0307;;;;N;;;;1E1F;
+1E1F;LATIN SMALL LETTER F WITH DOT ABOVE;Ll;0;L;0066 0307;;;;N;;;1E1E;;1E1E
+1E20;LATIN CAPITAL LETTER G WITH MACRON;Lu;0;L;0047 0304;;;;N;;;;1E21;
+1E21;LATIN SMALL LETTER G WITH MACRON;Ll;0;L;0067 0304;;;;N;;;1E20;;1E20
+1E22;LATIN CAPITAL LETTER H WITH DOT ABOVE;Lu;0;L;0048 0307;;;;N;;;;1E23;
+1E23;LATIN SMALL LETTER H WITH DOT ABOVE;Ll;0;L;0068 0307;;;;N;;;1E22;;1E22
+1E24;LATIN CAPITAL LETTER H WITH DOT BELOW;Lu;0;L;0048 0323;;;;N;;;;1E25;
+1E25;LATIN SMALL LETTER H WITH DOT BELOW;Ll;0;L;0068 0323;;;;N;;;1E24;;1E24
+1E26;LATIN CAPITAL LETTER H WITH DIAERESIS;Lu;0;L;0048 0308;;;;N;;;;1E27;
+1E27;LATIN SMALL LETTER H WITH DIAERESIS;Ll;0;L;0068 0308;;;;N;;;1E26;;1E26
+1E28;LATIN CAPITAL LETTER H WITH CEDILLA;Lu;0;L;0048 0327;;;;N;;;;1E29;
+1E29;LATIN SMALL LETTER H WITH CEDILLA;Ll;0;L;0068 0327;;;;N;;;1E28;;1E28
+1E2A;LATIN CAPITAL LETTER H WITH BREVE BELOW;Lu;0;L;0048 032E;;;;N;;;;1E2B;
+1E2B;LATIN SMALL LETTER H WITH BREVE BELOW;Ll;0;L;0068 032E;;;;N;;;1E2A;;1E2A
+1E2C;LATIN CAPITAL LETTER I WITH TILDE BELOW;Lu;0;L;0049 0330;;;;N;;;;1E2D;
+1E2D;LATIN SMALL LETTER I WITH TILDE BELOW;Ll;0;L;0069 0330;;;;N;;;1E2C;;1E2C
+1E2E;LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE;Lu;0;L;00CF 0301;;;;N;;;;1E2F;
+1E2F;LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE;Ll;0;L;00EF 0301;;;;N;;;1E2E;;1E2E
+1E30;LATIN CAPITAL LETTER K WITH ACUTE;Lu;0;L;004B 0301;;;;N;;;;1E31;
+1E31;LATIN SMALL LETTER K WITH ACUTE;Ll;0;L;006B 0301;;;;N;;;1E30;;1E30
+1E32;LATIN CAPITAL LETTER K WITH DOT BELOW;Lu;0;L;004B 0323;;;;N;;;;1E33;
+1E33;LATIN SMALL LETTER K WITH DOT BELOW;Ll;0;L;006B 0323;;;;N;;;1E32;;1E32
+1E34;LATIN CAPITAL LETTER K WITH LINE BELOW;Lu;0;L;004B 0331;;;;N;;;;1E35;
+1E35;LATIN SMALL LETTER K WITH LINE BELOW;Ll;0;L;006B 0331;;;;N;;;1E34;;1E34
+1E36;LATIN CAPITAL LETTER L WITH DOT BELOW;Lu;0;L;004C 0323;;;;N;;;;1E37;
+1E37;LATIN SMALL LETTER L WITH DOT BELOW;Ll;0;L;006C 0323;;;;N;;;1E36;;1E36
+1E38;LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON;Lu;0;L;1E36 0304;;;;N;;;;1E39;
+1E39;LATIN SMALL LETTER L WITH DOT BELOW AND MACRON;Ll;0;L;1E37 0304;;;;N;;;1E38;;1E38
+1E3A;LATIN CAPITAL LETTER L WITH LINE BELOW;Lu;0;L;004C 0331;;;;N;;;;1E3B;
+1E3B;LATIN SMALL LETTER L WITH LINE BELOW;Ll;0;L;006C 0331;;;;N;;;1E3A;;1E3A
+1E3C;LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW;Lu;0;L;004C 032D;;;;N;;;;1E3D;
+1E3D;LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW;Ll;0;L;006C 032D;;;;N;;;1E3C;;1E3C
+1E3E;LATIN CAPITAL LETTER M WITH ACUTE;Lu;0;L;004D 0301;;;;N;;;;1E3F;
+1E3F;LATIN SMALL LETTER M WITH ACUTE;Ll;0;L;006D 0301;;;;N;;;1E3E;;1E3E
+1E40;LATIN CAPITAL LETTER M WITH DOT ABOVE;Lu;0;L;004D 0307;;;;N;;;;1E41;
+1E41;LATIN SMALL LETTER M WITH DOT ABOVE;Ll;0;L;006D 0307;;;;N;;;1E40;;1E40
+1E42;LATIN CAPITAL LETTER M WITH DOT BELOW;Lu;0;L;004D 0323;;;;N;;;;1E43;
+1E43;LATIN SMALL LETTER M WITH DOT BELOW;Ll;0;L;006D 0323;;;;N;;;1E42;;1E42
+1E44;LATIN CAPITAL LETTER N WITH DOT ABOVE;Lu;0;L;004E 0307;;;;N;;;;1E45;
+1E45;LATIN SMALL LETTER N WITH DOT ABOVE;Ll;0;L;006E 0307;;;;N;;;1E44;;1E44
+1E46;LATIN CAPITAL LETTER N WITH DOT BELOW;Lu;0;L;004E 0323;;;;N;;;;1E47;
+1E47;LATIN SMALL LETTER N WITH DOT BELOW;Ll;0;L;006E 0323;;;;N;;;1E46;;1E46
+1E48;LATIN CAPITAL LETTER N WITH LINE BELOW;Lu;0;L;004E 0331;;;;N;;;;1E49;
+1E49;LATIN SMALL LETTER N WITH LINE BELOW;Ll;0;L;006E 0331;;;;N;;;1E48;;1E48
+1E4A;LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW;Lu;0;L;004E 032D;;;;N;;;;1E4B;
+1E4B;LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW;Ll;0;L;006E 032D;;;;N;;;1E4A;;1E4A
+1E4C;LATIN CAPITAL LETTER O WITH TILDE AND ACUTE;Lu;0;L;00D5 0301;;;;N;;;;1E4D;
+1E4D;LATIN SMALL LETTER O WITH TILDE AND ACUTE;Ll;0;L;00F5 0301;;;;N;;;1E4C;;1E4C
+1E4E;LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS;Lu;0;L;00D5 0308;;;;N;;;;1E4F;
+1E4F;LATIN SMALL LETTER O WITH TILDE AND DIAERESIS;Ll;0;L;00F5 0308;;;;N;;;1E4E;;1E4E
+1E50;LATIN CAPITAL LETTER O WITH MACRON AND GRAVE;Lu;0;L;014C 0300;;;;N;;;;1E51;
+1E51;LATIN SMALL LETTER O WITH MACRON AND GRAVE;Ll;0;L;014D 0300;;;;N;;;1E50;;1E50
+1E52;LATIN CAPITAL LETTER O WITH MACRON AND ACUTE;Lu;0;L;014C 0301;;;;N;;;;1E53;
+1E53;LATIN SMALL LETTER O WITH MACRON AND ACUTE;Ll;0;L;014D 0301;;;;N;;;1E52;;1E52
+1E54;LATIN CAPITAL LETTER P WITH ACUTE;Lu;0;L;0050 0301;;;;N;;;;1E55;
+1E55;LATIN SMALL LETTER P WITH ACUTE;Ll;0;L;0070 0301;;;;N;;;1E54;;1E54
+1E56;LATIN CAPITAL LETTER P WITH DOT ABOVE;Lu;0;L;0050 0307;;;;N;;;;1E57;
+1E57;LATIN SMALL LETTER P WITH DOT ABOVE;Ll;0;L;0070 0307;;;;N;;;1E56;;1E56
+1E58;LATIN CAPITAL LETTER R WITH DOT ABOVE;Lu;0;L;0052 0307;;;;N;;;;1E59;
+1E59;LATIN SMALL LETTER R WITH DOT ABOVE;Ll;0;L;0072 0307;;;;N;;;1E58;;1E58
+1E5A;LATIN CAPITAL LETTER R WITH DOT BELOW;Lu;0;L;0052 0323;;;;N;;;;1E5B;
+1E5B;LATIN SMALL LETTER R WITH DOT BELOW;Ll;0;L;0072 0323;;;;N;;;1E5A;;1E5A
+1E5C;LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON;Lu;0;L;1E5A 0304;;;;N;;;;1E5D;
+1E5D;LATIN SMALL LETTER R WITH DOT BELOW AND MACRON;Ll;0;L;1E5B 0304;;;;N;;;1E5C;;1E5C
+1E5E;LATIN CAPITAL LETTER R WITH LINE BELOW;Lu;0;L;0052 0331;;;;N;;;;1E5F;
+1E5F;LATIN SMALL LETTER R WITH LINE BELOW;Ll;0;L;0072 0331;;;;N;;;1E5E;;1E5E
+1E60;LATIN CAPITAL LETTER S WITH DOT ABOVE;Lu;0;L;0053 0307;;;;N;;;;1E61;
+1E61;LATIN SMALL LETTER S WITH DOT ABOVE;Ll;0;L;0073 0307;;;;N;;;1E60;;1E60
+1E62;LATIN CAPITAL LETTER S WITH DOT BELOW;Lu;0;L;0053 0323;;;;N;;;;1E63;
+1E63;LATIN SMALL LETTER S WITH DOT BELOW;Ll;0;L;0073 0323;;;;N;;;1E62;;1E62
+1E64;LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE;Lu;0;L;015A 0307;;;;N;;;;1E65;
+1E65;LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE;Ll;0;L;015B 0307;;;;N;;;1E64;;1E64
+1E66;LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE;Lu;0;L;0160 0307;;;;N;;;;1E67;
+1E67;LATIN SMALL LETTER S WITH CARON AND DOT ABOVE;Ll;0;L;0161 0307;;;;N;;;1E66;;1E66
+1E68;LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE;Lu;0;L;1E62 0307;;;;N;;;;1E69;
+1E69;LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE;Ll;0;L;1E63 0307;;;;N;;;1E68;;1E68
+1E6A;LATIN CAPITAL LETTER T WITH DOT ABOVE;Lu;0;L;0054 0307;;;;N;;;;1E6B;
+1E6B;LATIN SMALL LETTER T WITH DOT ABOVE;Ll;0;L;0074 0307;;;;N;;;1E6A;;1E6A
+1E6C;LATIN CAPITAL LETTER T WITH DOT BELOW;Lu;0;L;0054 0323;;;;N;;;;1E6D;
+1E6D;LATIN SMALL LETTER T WITH DOT BELOW;Ll;0;L;0074 0323;;;;N;;;1E6C;;1E6C
+1E6E;LATIN CAPITAL LETTER T WITH LINE BELOW;Lu;0;L;0054 0331;;;;N;;;;1E6F;
+1E6F;LATIN SMALL LETTER T WITH LINE BELOW;Ll;0;L;0074 0331;;;;N;;;1E6E;;1E6E
+1E70;LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW;Lu;0;L;0054 032D;;;;N;;;;1E71;
+1E71;LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW;Ll;0;L;0074 032D;;;;N;;;1E70;;1E70
+1E72;LATIN CAPITAL LETTER U WITH DIAERESIS BELOW;Lu;0;L;0055 0324;;;;N;;;;1E73;
+1E73;LATIN SMALL LETTER U WITH DIAERESIS BELOW;Ll;0;L;0075 0324;;;;N;;;1E72;;1E72
+1E74;LATIN CAPITAL LETTER U WITH TILDE BELOW;Lu;0;L;0055 0330;;;;N;;;;1E75;
+1E75;LATIN SMALL LETTER U WITH TILDE BELOW;Ll;0;L;0075 0330;;;;N;;;1E74;;1E74
+1E76;LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW;Lu;0;L;0055 032D;;;;N;;;;1E77;
+1E77;LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW;Ll;0;L;0075 032D;;;;N;;;1E76;;1E76
+1E78;LATIN CAPITAL LETTER U WITH TILDE AND ACUTE;Lu;0;L;0168 0301;;;;N;;;;1E79;
+1E79;LATIN SMALL LETTER U WITH TILDE AND ACUTE;Ll;0;L;0169 0301;;;;N;;;1E78;;1E78
+1E7A;LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS;Lu;0;L;016A 0308;;;;N;;;;1E7B;
+1E7B;LATIN SMALL LETTER U WITH MACRON AND DIAERESIS;Ll;0;L;016B 0308;;;;N;;;1E7A;;1E7A
+1E7C;LATIN CAPITAL LETTER V WITH TILDE;Lu;0;L;0056 0303;;;;N;;;;1E7D;
+1E7D;LATIN SMALL LETTER V WITH TILDE;Ll;0;L;0076 0303;;;;N;;;1E7C;;1E7C
+1E7E;LATIN CAPITAL LETTER V WITH DOT BELOW;Lu;0;L;0056 0323;;;;N;;;;1E7F;
+1E7F;LATIN SMALL LETTER V WITH DOT BELOW;Ll;0;L;0076 0323;;;;N;;;1E7E;;1E7E
+1E80;LATIN CAPITAL LETTER W WITH GRAVE;Lu;0;L;0057 0300;;;;N;;;;1E81;
+1E81;LATIN SMALL LETTER W WITH GRAVE;Ll;0;L;0077 0300;;;;N;;;1E80;;1E80
+1E82;LATIN CAPITAL LETTER W WITH ACUTE;Lu;0;L;0057 0301;;;;N;;;;1E83;
+1E83;LATIN SMALL LETTER W WITH ACUTE;Ll;0;L;0077 0301;;;;N;;;1E82;;1E82
+1E84;LATIN CAPITAL LETTER W WITH DIAERESIS;Lu;0;L;0057 0308;;;;N;;;;1E85;
+1E85;LATIN SMALL LETTER W WITH DIAERESIS;Ll;0;L;0077 0308;;;;N;;;1E84;;1E84
+1E86;LATIN CAPITAL LETTER W WITH DOT ABOVE;Lu;0;L;0057 0307;;;;N;;;;1E87;
+1E87;LATIN SMALL LETTER W WITH DOT ABOVE;Ll;0;L;0077 0307;;;;N;;;1E86;;1E86
+1E88;LATIN CAPITAL LETTER W WITH DOT BELOW;Lu;0;L;0057 0323;;;;N;;;;1E89;
+1E89;LATIN SMALL LETTER W WITH DOT BELOW;Ll;0;L;0077 0323;;;;N;;;1E88;;1E88
+1E8A;LATIN CAPITAL LETTER X WITH DOT ABOVE;Lu;0;L;0058 0307;;;;N;;;;1E8B;
+1E8B;LATIN SMALL LETTER X WITH DOT ABOVE;Ll;0;L;0078 0307;;;;N;;;1E8A;;1E8A
+1E8C;LATIN CAPITAL LETTER X WITH DIAERESIS;Lu;0;L;0058 0308;;;;N;;;;1E8D;
+1E8D;LATIN SMALL LETTER X WITH DIAERESIS;Ll;0;L;0078 0308;;;;N;;;1E8C;;1E8C
+1E8E;LATIN CAPITAL LETTER Y WITH DOT ABOVE;Lu;0;L;0059 0307;;;;N;;;;1E8F;
+1E8F;LATIN SMALL LETTER Y WITH DOT ABOVE;Ll;0;L;0079 0307;;;;N;;;1E8E;;1E8E
+1E90;LATIN CAPITAL LETTER Z WITH CIRCUMFLEX;Lu;0;L;005A 0302;;;;N;;;;1E91;
+1E91;LATIN SMALL LETTER Z WITH CIRCUMFLEX;Ll;0;L;007A 0302;;;;N;;;1E90;;1E90
+1E92;LATIN CAPITAL LETTER Z WITH DOT BELOW;Lu;0;L;005A 0323;;;;N;;;;1E93;
+1E93;LATIN SMALL LETTER Z WITH DOT BELOW;Ll;0;L;007A 0323;;;;N;;;1E92;;1E92
+1E94;LATIN CAPITAL LETTER Z WITH LINE BELOW;Lu;0;L;005A 0331;;;;N;;;;1E95;
+1E95;LATIN SMALL LETTER Z WITH LINE BELOW;Ll;0;L;007A 0331;;;;N;;;1E94;;1E94
+1E96;LATIN SMALL LETTER H WITH LINE BELOW;Ll;0;L;0068 0331;;;;N;;;;;
+1E97;LATIN SMALL LETTER T WITH DIAERESIS;Ll;0;L;0074 0308;;;;N;;;;;
+1E98;LATIN SMALL LETTER W WITH RING ABOVE;Ll;0;L;0077 030A;;;;N;;;;;
+1E99;LATIN SMALL LETTER Y WITH RING ABOVE;Ll;0;L;0079 030A;;;;N;;;;;
+1E9A;LATIN SMALL LETTER A WITH RIGHT HALF RING;Ll;0;L;<compat> 0061 02BE;;;;N;;;;;
+1E9B;LATIN SMALL LETTER LONG S WITH DOT ABOVE;Ll;0;L;017F 0307;;;;N;;;1E60;;1E60
+1EA0;LATIN CAPITAL LETTER A WITH DOT BELOW;Lu;0;L;0041 0323;;;;N;;;;1EA1;
+1EA1;LATIN SMALL LETTER A WITH DOT BELOW;Ll;0;L;0061 0323;;;;N;;;1EA0;;1EA0
+1EA2;LATIN CAPITAL LETTER A WITH HOOK ABOVE;Lu;0;L;0041 0309;;;;N;;;;1EA3;
+1EA3;LATIN SMALL LETTER A WITH HOOK ABOVE;Ll;0;L;0061 0309;;;;N;;;1EA2;;1EA2
+1EA4;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE;Lu;0;L;00C2 0301;;;;N;;;;1EA5;
+1EA5;LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE;Ll;0;L;00E2 0301;;;;N;;;1EA4;;1EA4
+1EA6;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE;Lu;0;L;00C2 0300;;;;N;;;;1EA7;
+1EA7;LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE;Ll;0;L;00E2 0300;;;;N;;;1EA6;;1EA6
+1EA8;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE;Lu;0;L;00C2 0309;;;;N;;;;1EA9;
+1EA9;LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE;Ll;0;L;00E2 0309;;;;N;;;1EA8;;1EA8
+1EAA;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE;Lu;0;L;00C2 0303;;;;N;;;;1EAB;
+1EAB;LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE;Ll;0;L;00E2 0303;;;;N;;;1EAA;;1EAA
+1EAC;LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW;Lu;0;L;1EA0 0302;;;;N;;;;1EAD;
+1EAD;LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW;Ll;0;L;1EA1 0302;;;;N;;;1EAC;;1EAC
+1EAE;LATIN CAPITAL LETTER A WITH BREVE AND ACUTE;Lu;0;L;0102 0301;;;;N;;;;1EAF;
+1EAF;LATIN SMALL LETTER A WITH BREVE AND ACUTE;Ll;0;L;0103 0301;;;;N;;;1EAE;;1EAE
+1EB0;LATIN CAPITAL LETTER A WITH BREVE AND GRAVE;Lu;0;L;0102 0300;;;;N;;;;1EB1;
+1EB1;LATIN SMALL LETTER A WITH BREVE AND GRAVE;Ll;0;L;0103 0300;;;;N;;;1EB0;;1EB0
+1EB2;LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE;Lu;0;L;0102 0309;;;;N;;;;1EB3;
+1EB3;LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE;Ll;0;L;0103 0309;;;;N;;;1EB2;;1EB2
+1EB4;LATIN CAPITAL LETTER A WITH BREVE AND TILDE;Lu;0;L;0102 0303;;;;N;;;;1EB5;
+1EB5;LATIN SMALL LETTER A WITH BREVE AND TILDE;Ll;0;L;0103 0303;;;;N;;;1EB4;;1EB4
+1EB6;LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW;Lu;0;L;1EA0 0306;;;;N;;;;1EB7;
+1EB7;LATIN SMALL LETTER A WITH BREVE AND DOT BELOW;Ll;0;L;1EA1 0306;;;;N;;;1EB6;;1EB6
+1EB8;LATIN CAPITAL LETTER E WITH DOT BELOW;Lu;0;L;0045 0323;;;;N;;;;1EB9;
+1EB9;LATIN SMALL LETTER E WITH DOT BELOW;Ll;0;L;0065 0323;;;;N;;;1EB8;;1EB8
+1EBA;LATIN CAPITAL LETTER E WITH HOOK ABOVE;Lu;0;L;0045 0309;;;;N;;;;1EBB;
+1EBB;LATIN SMALL LETTER E WITH HOOK ABOVE;Ll;0;L;0065 0309;;;;N;;;1EBA;;1EBA
+1EBC;LATIN CAPITAL LETTER E WITH TILDE;Lu;0;L;0045 0303;;;;N;;;;1EBD;
+1EBD;LATIN SMALL LETTER E WITH TILDE;Ll;0;L;0065 0303;;;;N;;;1EBC;;1EBC
+1EBE;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE;Lu;0;L;00CA 0301;;;;N;;;;1EBF;
+1EBF;LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE;Ll;0;L;00EA 0301;;;;N;;;1EBE;;1EBE
+1EC0;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE;Lu;0;L;00CA 0300;;;;N;;;;1EC1;
+1EC1;LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE;Ll;0;L;00EA 0300;;;;N;;;1EC0;;1EC0
+1EC2;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE;Lu;0;L;00CA 0309;;;;N;;;;1EC3;
+1EC3;LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE;Ll;0;L;00EA 0309;;;;N;;;1EC2;;1EC2
+1EC4;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE;Lu;0;L;00CA 0303;;;;N;;;;1EC5;
+1EC5;LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE;Ll;0;L;00EA 0303;;;;N;;;1EC4;;1EC4
+1EC6;LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW;Lu;0;L;1EB8 0302;;;;N;;;;1EC7;
+1EC7;LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW;Ll;0;L;1EB9 0302;;;;N;;;1EC6;;1EC6
+1EC8;LATIN CAPITAL LETTER I WITH HOOK ABOVE;Lu;0;L;0049 0309;;;;N;;;;1EC9;
+1EC9;LATIN SMALL LETTER I WITH HOOK ABOVE;Ll;0;L;0069 0309;;;;N;;;1EC8;;1EC8
+1ECA;LATIN CAPITAL LETTER I WITH DOT BELOW;Lu;0;L;0049 0323;;;;N;;;;1ECB;
+1ECB;LATIN SMALL LETTER I WITH DOT BELOW;Ll;0;L;0069 0323;;;;N;;;1ECA;;1ECA
+1ECC;LATIN CAPITAL LETTER O WITH DOT BELOW;Lu;0;L;004F 0323;;;;N;;;;1ECD;
+1ECD;LATIN SMALL LETTER O WITH DOT BELOW;Ll;0;L;006F 0323;;;;N;;;1ECC;;1ECC
+1ECE;LATIN CAPITAL LETTER O WITH HOOK ABOVE;Lu;0;L;004F 0309;;;;N;;;;1ECF;
+1ECF;LATIN SMALL LETTER O WITH HOOK ABOVE;Ll;0;L;006F 0309;;;;N;;;1ECE;;1ECE
+1ED0;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE;Lu;0;L;00D4 0301;;;;N;;;;1ED1;
+1ED1;LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE;Ll;0;L;00F4 0301;;;;N;;;1ED0;;1ED0
+1ED2;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE;Lu;0;L;00D4 0300;;;;N;;;;1ED3;
+1ED3;LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE;Ll;0;L;00F4 0300;;;;N;;;1ED2;;1ED2
+1ED4;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE;Lu;0;L;00D4 0309;;;;N;;;;1ED5;
+1ED5;LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE;Ll;0;L;00F4 0309;;;;N;;;1ED4;;1ED4
+1ED6;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE;Lu;0;L;00D4 0303;;;;N;;;;1ED7;
+1ED7;LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE;Ll;0;L;00F4 0303;;;;N;;;1ED6;;1ED6
+1ED8;LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW;Lu;0;L;1ECC 0302;;;;N;;;;1ED9;
+1ED9;LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW;Ll;0;L;1ECD 0302;;;;N;;;1ED8;;1ED8
+1EDA;LATIN CAPITAL LETTER O WITH HORN AND ACUTE;Lu;0;L;01A0 0301;;;;N;;;;1EDB;
+1EDB;LATIN SMALL LETTER O WITH HORN AND ACUTE;Ll;0;L;01A1 0301;;;;N;;;1EDA;;1EDA
+1EDC;LATIN CAPITAL LETTER O WITH HORN AND GRAVE;Lu;0;L;01A0 0300;;;;N;;;;1EDD;
+1EDD;LATIN SMALL LETTER O WITH HORN AND GRAVE;Ll;0;L;01A1 0300;;;;N;;;1EDC;;1EDC
+1EDE;LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE;Lu;0;L;01A0 0309;;;;N;;;;1EDF;
+1EDF;LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE;Ll;0;L;01A1 0309;;;;N;;;1EDE;;1EDE
+1EE0;LATIN CAPITAL LETTER O WITH HORN AND TILDE;Lu;0;L;01A0 0303;;;;N;;;;1EE1;
+1EE1;LATIN SMALL LETTER O WITH HORN AND TILDE;Ll;0;L;01A1 0303;;;;N;;;1EE0;;1EE0
+1EE2;LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW;Lu;0;L;01A0 0323;;;;N;;;;1EE3;
+1EE3;LATIN SMALL LETTER O WITH HORN AND DOT BELOW;Ll;0;L;01A1 0323;;;;N;;;1EE2;;1EE2
+1EE4;LATIN CAPITAL LETTER U WITH DOT BELOW;Lu;0;L;0055 0323;;;;N;;;;1EE5;
+1EE5;LATIN SMALL LETTER U WITH DOT BELOW;Ll;0;L;0075 0323;;;;N;;;1EE4;;1EE4
+1EE6;LATIN CAPITAL LETTER U WITH HOOK ABOVE;Lu;0;L;0055 0309;;;;N;;;;1EE7;
+1EE7;LATIN SMALL LETTER U WITH HOOK ABOVE;Ll;0;L;0075 0309;;;;N;;;1EE6;;1EE6
+1EE8;LATIN CAPITAL LETTER U WITH HORN AND ACUTE;Lu;0;L;01AF 0301;;;;N;;;;1EE9;
+1EE9;LATIN SMALL LETTER U WITH HORN AND ACUTE;Ll;0;L;01B0 0301;;;;N;;;1EE8;;1EE8
+1EEA;LATIN CAPITAL LETTER U WITH HORN AND GRAVE;Lu;0;L;01AF 0300;;;;N;;;;1EEB;
+1EEB;LATIN SMALL LETTER U WITH HORN AND GRAVE;Ll;0;L;01B0 0300;;;;N;;;1EEA;;1EEA
+1EEC;LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE;Lu;0;L;01AF 0309;;;;N;;;;1EED;
+1EED;LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE;Ll;0;L;01B0 0309;;;;N;;;1EEC;;1EEC
+1EEE;LATIN CAPITAL LETTER U WITH HORN AND TILDE;Lu;0;L;01AF 0303;;;;N;;;;1EEF;
+1EEF;LATIN SMALL LETTER U WITH HORN AND TILDE;Ll;0;L;01B0 0303;;;;N;;;1EEE;;1EEE
+1EF0;LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW;Lu;0;L;01AF 0323;;;;N;;;;1EF1;
+1EF1;LATIN SMALL LETTER U WITH HORN AND DOT BELOW;Ll;0;L;01B0 0323;;;;N;;;1EF0;;1EF0
+1EF2;LATIN CAPITAL LETTER Y WITH GRAVE;Lu;0;L;0059 0300;;;;N;;;;1EF3;
+1EF3;LATIN SMALL LETTER Y WITH GRAVE;Ll;0;L;0079 0300;;;;N;;;1EF2;;1EF2
+1EF4;LATIN CAPITAL LETTER Y WITH DOT BELOW;Lu;0;L;0059 0323;;;;N;;;;1EF5;
+1EF5;LATIN SMALL LETTER Y WITH DOT BELOW;Ll;0;L;0079 0323;;;;N;;;1EF4;;1EF4
+1EF6;LATIN CAPITAL LETTER Y WITH HOOK ABOVE;Lu;0;L;0059 0309;;;;N;;;;1EF7;
+1EF7;LATIN SMALL LETTER Y WITH HOOK ABOVE;Ll;0;L;0079 0309;;;;N;;;1EF6;;1EF6
+1EF8;LATIN CAPITAL LETTER Y WITH TILDE;Lu;0;L;0059 0303;;;;N;;;;1EF9;
+1EF9;LATIN SMALL LETTER Y WITH TILDE;Ll;0;L;0079 0303;;;;N;;;1EF8;;1EF8
+1F00;GREEK SMALL LETTER ALPHA WITH PSILI;Ll;0;L;03B1 0313;;;;N;;;1F08;;1F08
+1F01;GREEK SMALL LETTER ALPHA WITH DASIA;Ll;0;L;03B1 0314;;;;N;;;1F09;;1F09
+1F02;GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA;Ll;0;L;1F00 0300;;;;N;;;1F0A;;1F0A
+1F03;GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA;Ll;0;L;1F01 0300;;;;N;;;1F0B;;1F0B
+1F04;GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA;Ll;0;L;1F00 0301;;;;N;;;1F0C;;1F0C
+1F05;GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA;Ll;0;L;1F01 0301;;;;N;;;1F0D;;1F0D
+1F06;GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI;Ll;0;L;1F00 0342;;;;N;;;1F0E;;1F0E
+1F07;GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI;Ll;0;L;1F01 0342;;;;N;;;1F0F;;1F0F
+1F08;GREEK CAPITAL LETTER ALPHA WITH PSILI;Lu;0;L;0391 0313;;;;N;;;;1F00;
+1F09;GREEK CAPITAL LETTER ALPHA WITH DASIA;Lu;0;L;0391 0314;;;;N;;;;1F01;
+1F0A;GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA;Lu;0;L;1F08 0300;;;;N;;;;1F02;
+1F0B;GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA;Lu;0;L;1F09 0300;;;;N;;;;1F03;
+1F0C;GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA;Lu;0;L;1F08 0301;;;;N;;;;1F04;
+1F0D;GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA;Lu;0;L;1F09 0301;;;;N;;;;1F05;
+1F0E;GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI;Lu;0;L;1F08 0342;;;;N;;;;1F06;
+1F0F;GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI;Lu;0;L;1F09 0342;;;;N;;;;1F07;
+1F10;GREEK SMALL LETTER EPSILON WITH PSILI;Ll;0;L;03B5 0313;;;;N;;;1F18;;1F18
+1F11;GREEK SMALL LETTER EPSILON WITH DASIA;Ll;0;L;03B5 0314;;;;N;;;1F19;;1F19
+1F12;GREEK SMALL LETTER EPSILON WITH PSILI AND VARIA;Ll;0;L;1F10 0300;;;;N;;;1F1A;;1F1A
+1F13;GREEK SMALL LETTER EPSILON WITH DASIA AND VARIA;Ll;0;L;1F11 0300;;;;N;;;1F1B;;1F1B
+1F14;GREEK SMALL LETTER EPSILON WITH PSILI AND OXIA;Ll;0;L;1F10 0301;;;;N;;;1F1C;;1F1C
+1F15;GREEK SMALL LETTER EPSILON WITH DASIA AND OXIA;Ll;0;L;1F11 0301;;;;N;;;1F1D;;1F1D
+1F18;GREEK CAPITAL LETTER EPSILON WITH PSILI;Lu;0;L;0395 0313;;;;N;;;;1F10;
+1F19;GREEK CAPITAL LETTER EPSILON WITH DASIA;Lu;0;L;0395 0314;;;;N;;;;1F11;
+1F1A;GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA;Lu;0;L;1F18 0300;;;;N;;;;1F12;
+1F1B;GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA;Lu;0;L;1F19 0300;;;;N;;;;1F13;
+1F1C;GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA;Lu;0;L;1F18 0301;;;;N;;;;1F14;
+1F1D;GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA;Lu;0;L;1F19 0301;;;;N;;;;1F15;
+1F20;GREEK SMALL LETTER ETA WITH PSILI;Ll;0;L;03B7 0313;;;;N;;;1F28;;1F28
+1F21;GREEK SMALL LETTER ETA WITH DASIA;Ll;0;L;03B7 0314;;;;N;;;1F29;;1F29
+1F22;GREEK SMALL LETTER ETA WITH PSILI AND VARIA;Ll;0;L;1F20 0300;;;;N;;;1F2A;;1F2A
+1F23;GREEK SMALL LETTER ETA WITH DASIA AND VARIA;Ll;0;L;1F21 0300;;;;N;;;1F2B;;1F2B
+1F24;GREEK SMALL LETTER ETA WITH PSILI AND OXIA;Ll;0;L;1F20 0301;;;;N;;;1F2C;;1F2C
+1F25;GREEK SMALL LETTER ETA WITH DASIA AND OXIA;Ll;0;L;1F21 0301;;;;N;;;1F2D;;1F2D
+1F26;GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI;Ll;0;L;1F20 0342;;;;N;;;1F2E;;1F2E
+1F27;GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI;Ll;0;L;1F21 0342;;;;N;;;1F2F;;1F2F
+1F28;GREEK CAPITAL LETTER ETA WITH PSILI;Lu;0;L;0397 0313;;;;N;;;;1F20;
+1F29;GREEK CAPITAL LETTER ETA WITH DASIA;Lu;0;L;0397 0314;;;;N;;;;1F21;
+1F2A;GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA;Lu;0;L;1F28 0300;;;;N;;;;1F22;
+1F2B;GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA;Lu;0;L;1F29 0300;;;;N;;;;1F23;
+1F2C;GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA;Lu;0;L;1F28 0301;;;;N;;;;1F24;
+1F2D;GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA;Lu;0;L;1F29 0301;;;;N;;;;1F25;
+1F2E;GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI;Lu;0;L;1F28 0342;;;;N;;;;1F26;
+1F2F;GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI;Lu;0;L;1F29 0342;;;;N;;;;1F27;
+1F30;GREEK SMALL LETTER IOTA WITH PSILI;Ll;0;L;03B9 0313;;;;N;;;1F38;;1F38
+1F31;GREEK SMALL LETTER IOTA WITH DASIA;Ll;0;L;03B9 0314;;;;N;;;1F39;;1F39
+1F32;GREEK SMALL LETTER IOTA WITH PSILI AND VARIA;Ll;0;L;1F30 0300;;;;N;;;1F3A;;1F3A
+1F33;GREEK SMALL LETTER IOTA WITH DASIA AND VARIA;Ll;0;L;1F31 0300;;;;N;;;1F3B;;1F3B
+1F34;GREEK SMALL LETTER IOTA WITH PSILI AND OXIA;Ll;0;L;1F30 0301;;;;N;;;1F3C;;1F3C
+1F35;GREEK SMALL LETTER IOTA WITH DASIA AND OXIA;Ll;0;L;1F31 0301;;;;N;;;1F3D;;1F3D
+1F36;GREEK SMALL LETTER IOTA WITH PSILI AND PERISPOMENI;Ll;0;L;1F30 0342;;;;N;;;1F3E;;1F3E
+1F37;GREEK SMALL LETTER IOTA WITH DASIA AND PERISPOMENI;Ll;0;L;1F31 0342;;;;N;;;1F3F;;1F3F
+1F38;GREEK CAPITAL LETTER IOTA WITH PSILI;Lu;0;L;0399 0313;;;;N;;;;1F30;
+1F39;GREEK CAPITAL LETTER IOTA WITH DASIA;Lu;0;L;0399 0314;;;;N;;;;1F31;
+1F3A;GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA;Lu;0;L;1F38 0300;;;;N;;;;1F32;
+1F3B;GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA;Lu;0;L;1F39 0300;;;;N;;;;1F33;
+1F3C;GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA;Lu;0;L;1F38 0301;;;;N;;;;1F34;
+1F3D;GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA;Lu;0;L;1F39 0301;;;;N;;;;1F35;
+1F3E;GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI;Lu;0;L;1F38 0342;;;;N;;;;1F36;
+1F3F;GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI;Lu;0;L;1F39 0342;;;;N;;;;1F37;
+1F40;GREEK SMALL LETTER OMICRON WITH PSILI;Ll;0;L;03BF 0313;;;;N;;;1F48;;1F48
+1F41;GREEK SMALL LETTER OMICRON WITH DASIA;Ll;0;L;03BF 0314;;;;N;;;1F49;;1F49
+1F42;GREEK SMALL LETTER OMICRON WITH PSILI AND VARIA;Ll;0;L;1F40 0300;;;;N;;;1F4A;;1F4A
+1F43;GREEK SMALL LETTER OMICRON WITH DASIA AND VARIA;Ll;0;L;1F41 0300;;;;N;;;1F4B;;1F4B
+1F44;GREEK SMALL LETTER OMICRON WITH PSILI AND OXIA;Ll;0;L;1F40 0301;;;;N;;;1F4C;;1F4C
+1F45;GREEK SMALL LETTER OMICRON WITH DASIA AND OXIA;Ll;0;L;1F41 0301;;;;N;;;1F4D;;1F4D
+1F48;GREEK CAPITAL LETTER OMICRON WITH PSILI;Lu;0;L;039F 0313;;;;N;;;;1F40;
+1F49;GREEK CAPITAL LETTER OMICRON WITH DASIA;Lu;0;L;039F 0314;;;;N;;;;1F41;
+1F4A;GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA;Lu;0;L;1F48 0300;;;;N;;;;1F42;
+1F4B;GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA;Lu;0;L;1F49 0300;;;;N;;;;1F43;
+1F4C;GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA;Lu;0;L;1F48 0301;;;;N;;;;1F44;
+1F4D;GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA;Lu;0;L;1F49 0301;;;;N;;;;1F45;
+1F50;GREEK SMALL LETTER UPSILON WITH PSILI;Ll;0;L;03C5 0313;;;;N;;;;;
+1F51;GREEK SMALL LETTER UPSILON WITH DASIA;Ll;0;L;03C5 0314;;;;N;;;1F59;;1F59
+1F52;GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA;Ll;0;L;1F50 0300;;;;N;;;;;
+1F53;GREEK SMALL LETTER UPSILON WITH DASIA AND VARIA;Ll;0;L;1F51 0300;;;;N;;;1F5B;;1F5B
+1F54;GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA;Ll;0;L;1F50 0301;;;;N;;;;;
+1F55;GREEK SMALL LETTER UPSILON WITH DASIA AND OXIA;Ll;0;L;1F51 0301;;;;N;;;1F5D;;1F5D
+1F56;GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI;Ll;0;L;1F50 0342;;;;N;;;;;
+1F57;GREEK SMALL LETTER UPSILON WITH DASIA AND PERISPOMENI;Ll;0;L;1F51 0342;;;;N;;;1F5F;;1F5F
+1F59;GREEK CAPITAL LETTER UPSILON WITH DASIA;Lu;0;L;03A5 0314;;;;N;;;;1F51;
+1F5B;GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA;Lu;0;L;1F59 0300;;;;N;;;;1F53;
+1F5D;GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA;Lu;0;L;1F59 0301;;;;N;;;;1F55;
+1F5F;GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI;Lu;0;L;1F59 0342;;;;N;;;;1F57;
+1F60;GREEK SMALL LETTER OMEGA WITH PSILI;Ll;0;L;03C9 0313;;;;N;;;1F68;;1F68
+1F61;GREEK SMALL LETTER OMEGA WITH DASIA;Ll;0;L;03C9 0314;;;;N;;;1F69;;1F69
+1F62;GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA;Ll;0;L;1F60 0300;;;;N;;;1F6A;;1F6A
+1F63;GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA;Ll;0;L;1F61 0300;;;;N;;;1F6B;;1F6B
+1F64;GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA;Ll;0;L;1F60 0301;;;;N;;;1F6C;;1F6C
+1F65;GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA;Ll;0;L;1F61 0301;;;;N;;;1F6D;;1F6D
+1F66;GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI;Ll;0;L;1F60 0342;;;;N;;;1F6E;;1F6E
+1F67;GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI;Ll;0;L;1F61 0342;;;;N;;;1F6F;;1F6F
+1F68;GREEK CAPITAL LETTER OMEGA WITH PSILI;Lu;0;L;03A9 0313;;;;N;;;;1F60;
+1F69;GREEK CAPITAL LETTER OMEGA WITH DASIA;Lu;0;L;03A9 0314;;;;N;;;;1F61;
+1F6A;GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA;Lu;0;L;1F68 0300;;;;N;;;;1F62;
+1F6B;GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA;Lu;0;L;1F69 0300;;;;N;;;;1F63;
+1F6C;GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA;Lu;0;L;1F68 0301;;;;N;;;;1F64;
+1F6D;GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA;Lu;0;L;1F69 0301;;;;N;;;;1F65;
+1F6E;GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI;Lu;0;L;1F68 0342;;;;N;;;;1F66;
+1F6F;GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI;Lu;0;L;1F69 0342;;;;N;;;;1F67;
+1F70;GREEK SMALL LETTER ALPHA WITH VARIA;Ll;0;L;03B1 0300;;;;N;;;1FBA;;1FBA
+1F71;GREEK SMALL LETTER ALPHA WITH OXIA;Ll;0;L;03AC;;;;N;;;1FBB;;1FBB
+1F72;GREEK SMALL LETTER EPSILON WITH VARIA;Ll;0;L;03B5 0300;;;;N;;;1FC8;;1FC8
+1F73;GREEK SMALL LETTER EPSILON WITH OXIA;Ll;0;L;03AD;;;;N;;;1FC9;;1FC9
+1F74;GREEK SMALL LETTER ETA WITH VARIA;Ll;0;L;03B7 0300;;;;N;;;1FCA;;1FCA
+1F75;GREEK SMALL LETTER ETA WITH OXIA;Ll;0;L;03AE;;;;N;;;1FCB;;1FCB
+1F76;GREEK SMALL LETTER IOTA WITH VARIA;Ll;0;L;03B9 0300;;;;N;;;1FDA;;1FDA
+1F77;GREEK SMALL LETTER IOTA WITH OXIA;Ll;0;L;03AF;;;;N;;;1FDB;;1FDB
+1F78;GREEK SMALL LETTER OMICRON WITH VARIA;Ll;0;L;03BF 0300;;;;N;;;1FF8;;1FF8
+1F79;GREEK SMALL LETTER OMICRON WITH OXIA;Ll;0;L;03CC;;;;N;;;1FF9;;1FF9
+1F7A;GREEK SMALL LETTER UPSILON WITH VARIA;Ll;0;L;03C5 0300;;;;N;;;1FEA;;1FEA
+1F7B;GREEK SMALL LETTER UPSILON WITH OXIA;Ll;0;L;03CD;;;;N;;;1FEB;;1FEB
+1F7C;GREEK SMALL LETTER OMEGA WITH VARIA;Ll;0;L;03C9 0300;;;;N;;;1FFA;;1FFA
+1F7D;GREEK SMALL LETTER OMEGA WITH OXIA;Ll;0;L;03CE;;;;N;;;1FFB;;1FFB
+1F80;GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI;Ll;0;L;1F00 0345;;;;N;;;1F88;;1F88
+1F81;GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI;Ll;0;L;1F01 0345;;;;N;;;1F89;;1F89
+1F82;GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F02 0345;;;;N;;;1F8A;;1F8A
+1F83;GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F03 0345;;;;N;;;1F8B;;1F8B
+1F84;GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F04 0345;;;;N;;;1F8C;;1F8C
+1F85;GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F05 0345;;;;N;;;1F8D;;1F8D
+1F86;GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F06 0345;;;;N;;;1F8E;;1F8E
+1F87;GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F07 0345;;;;N;;;1F8F;;1F8F
+1F88;GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI;Lt;0;L;1F08 0345;;;;N;;;;1F80;
+1F89;GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI;Lt;0;L;1F09 0345;;;;N;;;;1F81;
+1F8A;GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F0A 0345;;;;N;;;;1F82;
+1F8B;GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F0B 0345;;;;N;;;;1F83;
+1F8C;GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F0C 0345;;;;N;;;;1F84;
+1F8D;GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F0D 0345;;;;N;;;;1F85;
+1F8E;GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F0E 0345;;;;N;;;;1F86;
+1F8F;GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F0F 0345;;;;N;;;;1F87;
+1F90;GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI;Ll;0;L;1F20 0345;;;;N;;;1F98;;1F98
+1F91;GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI;Ll;0;L;1F21 0345;;;;N;;;1F99;;1F99
+1F92;GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F22 0345;;;;N;;;1F9A;;1F9A
+1F93;GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F23 0345;;;;N;;;1F9B;;1F9B
+1F94;GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F24 0345;;;;N;;;1F9C;;1F9C
+1F95;GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F25 0345;;;;N;;;1F9D;;1F9D
+1F96;GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F26 0345;;;;N;;;1F9E;;1F9E
+1F97;GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F27 0345;;;;N;;;1F9F;;1F9F
+1F98;GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI;Lt;0;L;1F28 0345;;;;N;;;;1F90;
+1F99;GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI;Lt;0;L;1F29 0345;;;;N;;;;1F91;
+1F9A;GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F2A 0345;;;;N;;;;1F92;
+1F9B;GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F2B 0345;;;;N;;;;1F93;
+1F9C;GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F2C 0345;;;;N;;;;1F94;
+1F9D;GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F2D 0345;;;;N;;;;1F95;
+1F9E;GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F2E 0345;;;;N;;;;1F96;
+1F9F;GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F2F 0345;;;;N;;;;1F97;
+1FA0;GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI;Ll;0;L;1F60 0345;;;;N;;;1FA8;;1FA8
+1FA1;GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI;Ll;0;L;1F61 0345;;;;N;;;1FA9;;1FA9
+1FA2;GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F62 0345;;;;N;;;1FAA;;1FAA
+1FA3;GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI;Ll;0;L;1F63 0345;;;;N;;;1FAB;;1FAB
+1FA4;GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F64 0345;;;;N;;;1FAC;;1FAC
+1FA5;GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI;Ll;0;L;1F65 0345;;;;N;;;1FAD;;1FAD
+1FA6;GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F66 0345;;;;N;;;1FAE;;1FAE
+1FA7;GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1F67 0345;;;;N;;;1FAF;;1FAF
+1FA8;GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI;Lt;0;L;1F68 0345;;;;N;;;;1FA0;
+1FA9;GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI;Lt;0;L;1F69 0345;;;;N;;;;1FA1;
+1FAA;GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F6A 0345;;;;N;;;;1FA2;
+1FAB;GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI;Lt;0;L;1F6B 0345;;;;N;;;;1FA3;
+1FAC;GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F6C 0345;;;;N;;;;1FA4;
+1FAD;GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI;Lt;0;L;1F6D 0345;;;;N;;;;1FA5;
+1FAE;GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F6E 0345;;;;N;;;;1FA6;
+1FAF;GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI;Lt;0;L;1F6F 0345;;;;N;;;;1FA7;
+1FB0;GREEK SMALL LETTER ALPHA WITH VRACHY;Ll;0;L;03B1 0306;;;;N;;;1FB8;;1FB8
+1FB1;GREEK SMALL LETTER ALPHA WITH MACRON;Ll;0;L;03B1 0304;;;;N;;;1FB9;;1FB9
+1FB2;GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI;Ll;0;L;1F70 0345;;;;N;;;;;
+1FB3;GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI;Ll;0;L;03B1 0345;;;;N;;;1FBC;;1FBC
+1FB4;GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI;Ll;0;L;03AC 0345;;;;N;;;;;
+1FB6;GREEK SMALL LETTER ALPHA WITH PERISPOMENI;Ll;0;L;03B1 0342;;;;N;;;;;
+1FB7;GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1FB6 0345;;;;N;;;;;
+1FB8;GREEK CAPITAL LETTER ALPHA WITH VRACHY;Lu;0;L;0391 0306;;;;N;;;;1FB0;
+1FB9;GREEK CAPITAL LETTER ALPHA WITH MACRON;Lu;0;L;0391 0304;;;;N;;;;1FB1;
+1FBA;GREEK CAPITAL LETTER ALPHA WITH VARIA;Lu;0;L;0391 0300;;;;N;;;;1F70;
+1FBB;GREEK CAPITAL LETTER ALPHA WITH OXIA;Lu;0;L;0386;;;;N;;;;1F71;
+1FBC;GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI;Lt;0;L;0391 0345;;;;N;;;;1FB3;
+1FBD;GREEK KORONIS;Sk;0;ON;<compat> 0020 0313;;;;N;;;;;
+1FBE;GREEK PROSGEGRAMMENI;Ll;0;L;03B9;;;;N;;;0399;;0399
+1FBF;GREEK PSILI;Sk;0;ON;<compat> 0020 0313;;;;N;;;;;
+1FC0;GREEK PERISPOMENI;Sk;0;ON;<compat> 0020 0342;;;;N;;;;;
+1FC1;GREEK DIALYTIKA AND PERISPOMENI;Sk;0;ON;00A8 0342;;;;N;;;;;
+1FC2;GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI;Ll;0;L;1F74 0345;;;;N;;;;;
+1FC3;GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI;Ll;0;L;03B7 0345;;;;N;;;1FCC;;1FCC
+1FC4;GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI;Ll;0;L;03AE 0345;;;;N;;;;;
+1FC6;GREEK SMALL LETTER ETA WITH PERISPOMENI;Ll;0;L;03B7 0342;;;;N;;;;;
+1FC7;GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1FC6 0345;;;;N;;;;;
+1FC8;GREEK CAPITAL LETTER EPSILON WITH VARIA;Lu;0;L;0395 0300;;;;N;;;;1F72;
+1FC9;GREEK CAPITAL LETTER EPSILON WITH OXIA;Lu;0;L;0388;;;;N;;;;1F73;
+1FCA;GREEK CAPITAL LETTER ETA WITH VARIA;Lu;0;L;0397 0300;;;;N;;;;1F74;
+1FCB;GREEK CAPITAL LETTER ETA WITH OXIA;Lu;0;L;0389;;;;N;;;;1F75;
+1FCC;GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI;Lt;0;L;0397 0345;;;;N;;;;1FC3;
+1FCD;GREEK PSILI AND VARIA;Sk;0;ON;1FBF 0300;;;;N;;;;;
+1FCE;GREEK PSILI AND OXIA;Sk;0;ON;1FBF 0301;;;;N;;;;;
+1FCF;GREEK PSILI AND PERISPOMENI;Sk;0;ON;1FBF 0342;;;;N;;;;;
+1FD0;GREEK SMALL LETTER IOTA WITH VRACHY;Ll;0;L;03B9 0306;;;;N;;;1FD8;;1FD8
+1FD1;GREEK SMALL LETTER IOTA WITH MACRON;Ll;0;L;03B9 0304;;;;N;;;1FD9;;1FD9
+1FD2;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA;Ll;0;L;03CA 0300;;;;N;;;;;
+1FD3;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA;Ll;0;L;0390;;;;N;;;;;
+1FD6;GREEK SMALL LETTER IOTA WITH PERISPOMENI;Ll;0;L;03B9 0342;;;;N;;;;;
+1FD7;GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI;Ll;0;L;03CA 0342;;;;N;;;;;
+1FD8;GREEK CAPITAL LETTER IOTA WITH VRACHY;Lu;0;L;0399 0306;;;;N;;;;1FD0;
+1FD9;GREEK CAPITAL LETTER IOTA WITH MACRON;Lu;0;L;0399 0304;;;;N;;;;1FD1;
+1FDA;GREEK CAPITAL LETTER IOTA WITH VARIA;Lu;0;L;0399 0300;;;;N;;;;1F76;
+1FDB;GREEK CAPITAL LETTER IOTA WITH OXIA;Lu;0;L;038A;;;;N;;;;1F77;
+1FDD;GREEK DASIA AND VARIA;Sk;0;ON;1FFE 0300;;;;N;;;;;
+1FDE;GREEK DASIA AND OXIA;Sk;0;ON;1FFE 0301;;;;N;;;;;
+1FDF;GREEK DASIA AND PERISPOMENI;Sk;0;ON;1FFE 0342;;;;N;;;;;
+1FE0;GREEK SMALL LETTER UPSILON WITH VRACHY;Ll;0;L;03C5 0306;;;;N;;;1FE8;;1FE8
+1FE1;GREEK SMALL LETTER UPSILON WITH MACRON;Ll;0;L;03C5 0304;;;;N;;;1FE9;;1FE9
+1FE2;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA;Ll;0;L;03CB 0300;;;;N;;;;;
+1FE3;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA;Ll;0;L;03B0;;;;N;;;;;
+1FE4;GREEK SMALL LETTER RHO WITH PSILI;Ll;0;L;03C1 0313;;;;N;;;;;
+1FE5;GREEK SMALL LETTER RHO WITH DASIA;Ll;0;L;03C1 0314;;;;N;;;1FEC;;1FEC
+1FE6;GREEK SMALL LETTER UPSILON WITH PERISPOMENI;Ll;0;L;03C5 0342;;;;N;;;;;
+1FE7;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI;Ll;0;L;03CB 0342;;;;N;;;;;
+1FE8;GREEK CAPITAL LETTER UPSILON WITH VRACHY;Lu;0;L;03A5 0306;;;;N;;;;1FE0;
+1FE9;GREEK CAPITAL LETTER UPSILON WITH MACRON;Lu;0;L;03A5 0304;;;;N;;;;1FE1;
+1FEA;GREEK CAPITAL LETTER UPSILON WITH VARIA;Lu;0;L;03A5 0300;;;;N;;;;1F7A;
+1FEB;GREEK CAPITAL LETTER UPSILON WITH OXIA;Lu;0;L;038E;;;;N;;;;1F7B;
+1FEC;GREEK CAPITAL LETTER RHO WITH DASIA;Lu;0;L;03A1 0314;;;;N;;;;1FE5;
+1FED;GREEK DIALYTIKA AND VARIA;Sk;0;ON;00A8 0300;;;;N;;;;;
+1FEE;GREEK DIALYTIKA AND OXIA;Sk;0;ON;0385;;;;N;;;;;
+1FEF;GREEK VARIA;Sk;0;ON;0060;;;;N;;;;;
+1FF2;GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI;Ll;0;L;1F7C 0345;;;;N;;;;;
+1FF3;GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI;Ll;0;L;03C9 0345;;;;N;;;1FFC;;1FFC
+1FF4;GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI;Ll;0;L;03CE 0345;;;;N;;;;;
+1FF6;GREEK SMALL LETTER OMEGA WITH PERISPOMENI;Ll;0;L;03C9 0342;;;;N;;;;;
+1FF7;GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI;Ll;0;L;1FF6 0345;;;;N;;;;;
+1FF8;GREEK CAPITAL LETTER OMICRON WITH VARIA;Lu;0;L;039F 0300;;;;N;;;;1F78;
+1FF9;GREEK CAPITAL LETTER OMICRON WITH OXIA;Lu;0;L;038C;;;;N;;;;1F79;
+1FFA;GREEK CAPITAL LETTER OMEGA WITH VARIA;Lu;0;L;03A9 0300;;;;N;;;;1F7C;
+1FFB;GREEK CAPITAL LETTER OMEGA WITH OXIA;Lu;0;L;038F;;;;N;;;;1F7D;
+1FFC;GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI;Lt;0;L;03A9 0345;;;;N;;;;1FF3;
+1FFD;GREEK OXIA;Sk;0;ON;00B4;;;;N;;;;;
+1FFE;GREEK DASIA;Sk;0;ON;<compat> 0020 0314;;;;N;;;;;
+2000;EN QUAD;Zs;0;WS;2002;;;;N;;;;;
+2001;EM QUAD;Zs;0;WS;2003;;;;N;;;;;
+2002;EN SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+2003;EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+2004;THREE-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+2005;FOUR-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+2006;SIX-PER-EM SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+2007;FIGURE SPACE;Zs;0;WS;<noBreak> 0020;;;;N;;;;;
+2008;PUNCTUATION SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+2009;THIN SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+200A;HAIR SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+200B;ZERO WIDTH SPACE;Cf;0;BN;;;;;N;;;;;
+200C;ZERO WIDTH NON-JOINER;Cf;0;BN;;;;;N;;;;;
+200D;ZERO WIDTH JOINER;Cf;0;BN;;;;;N;;;;;
+200E;LEFT-TO-RIGHT MARK;Cf;0;L;;;;;N;;;;;
+200F;RIGHT-TO-LEFT MARK;Cf;0;R;;;;;N;;;;;
+2010;HYPHEN;Pd;0;ON;;;;;N;;;;;
+2011;NON-BREAKING HYPHEN;Pd;0;ON;<noBreak> 2010;;;;N;;;;;
+2012;FIGURE DASH;Pd;0;ON;;;;;N;;;;;
+2013;EN DASH;Pd;0;ON;;;;;N;;;;;
+2014;EM DASH;Pd;0;ON;;;;;N;;;;;
+2015;HORIZONTAL BAR;Pd;0;ON;;;;;N;QUOTATION DASH;;;;
+2016;DOUBLE VERTICAL LINE;Po;0;ON;;;;;N;DOUBLE VERTICAL BAR;;;;
+2017;DOUBLE LOW LINE;Po;0;ON;<compat> 0020 0333;;;;N;SPACING DOUBLE UNDERSCORE;;;;
+2018;LEFT SINGLE QUOTATION MARK;Pi;0;ON;;;;;Y;SINGLE TURNED COMMA QUOTATION MARK;;;;
+2019;RIGHT SINGLE QUOTATION MARK;Pf;0;ON;;;;;Y;SINGLE COMMA QUOTATION MARK;;;;
+201A;SINGLE LOW-9 QUOTATION MARK;Ps;0;ON;;;;;Y;LOW SINGLE COMMA QUOTATION MARK;;;;
+201B;SINGLE HIGH-REVERSED-9 QUOTATION MARK;Pi;0;ON;;;;;Y;SINGLE REVERSED COMMA QUOTATION MARK;;;;
+201C;LEFT DOUBLE QUOTATION MARK;Pi;0;ON;;;;;Y;DOUBLE TURNED COMMA QUOTATION MARK;;;;
+201D;RIGHT DOUBLE QUOTATION MARK;Pf;0;ON;;;;;Y;DOUBLE COMMA QUOTATION MARK;;;;
+201E;DOUBLE LOW-9 QUOTATION MARK;Ps;0;ON;;;;;Y;LOW DOUBLE COMMA QUOTATION MARK;;;;
+201F;DOUBLE HIGH-REVERSED-9 QUOTATION MARK;Pi;0;ON;;;;;Y;DOUBLE REVERSED COMMA QUOTATION MARK;;;;
+2020;DAGGER;Po;0;ON;;;;;N;;;;;
+2021;DOUBLE DAGGER;Po;0;ON;;;;;N;;;;;
+2022;BULLET;Po;0;ON;;;;;N;;;;;
+2023;TRIANGULAR BULLET;Po;0;ON;;;;;N;;;;;
+2024;ONE DOT LEADER;Po;0;ON;<compat> 002E;;;;N;;;;;
+2025;TWO DOT LEADER;Po;0;ON;<compat> 002E 002E;;;;N;;;;;
+2026;HORIZONTAL ELLIPSIS;Po;0;ON;<compat> 002E 002E 002E;;;;N;;;;;
+2027;HYPHENATION POINT;Po;0;ON;;;;;N;;;;;
+2028;LINE SEPARATOR;Zl;0;WS;;;;;N;;;;;
+2029;PARAGRAPH SEPARATOR;Zp;0;B;;;;;N;;;;;
+202A;LEFT-TO-RIGHT EMBEDDING;Cf;0;LRE;;;;;N;;;;;
+202B;RIGHT-TO-LEFT EMBEDDING;Cf;0;RLE;;;;;N;;;;;
+202C;POP DIRECTIONAL FORMATTING;Cf;0;PDF;;;;;N;;;;;
+202D;LEFT-TO-RIGHT OVERRIDE;Cf;0;LRO;;;;;N;;;;;
+202E;RIGHT-TO-LEFT OVERRIDE;Cf;0;RLO;;;;;N;;;;;
+202F;NARROW NO-BREAK SPACE;Zs;0;CS;<noBreak> 0020;;;;N;;;;;
+2030;PER MILLE SIGN;Po;0;ET;;;;;N;;;;;
+2031;PER TEN THOUSAND SIGN;Po;0;ET;;;;;N;;;;;
+2032;PRIME;Po;0;ET;;;;;N;;;;;
+2033;DOUBLE PRIME;Po;0;ET;<compat> 2032 2032;;;;N;;;;;
+2034;TRIPLE PRIME;Po;0;ET;<compat> 2032 2032 2032;;;;N;;;;;
+2035;REVERSED PRIME;Po;0;ON;;;;;N;;;;;
+2036;REVERSED DOUBLE PRIME;Po;0;ON;<compat> 2035 2035;;;;N;;;;;
+2037;REVERSED TRIPLE PRIME;Po;0;ON;<compat> 2035 2035 2035;;;;N;;;;;
+2038;CARET;Po;0;ON;;;;;N;;;;;
+2039;SINGLE LEFT-POINTING ANGLE QUOTATION MARK;Pi;0;ON;;;;;Y;LEFT POINTING SINGLE GUILLEMET;;;;
+203A;SINGLE RIGHT-POINTING ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING SINGLE GUILLEMET;;;;
+203B;REFERENCE MARK;Po;0;ON;;;;;N;;;;;
+203C;DOUBLE EXCLAMATION MARK;Po;0;ON;<compat> 0021 0021;;;;N;;;;;
+203D;INTERROBANG;Po;0;ON;;;;;N;;;;;
+203E;OVERLINE;Po;0;ON;<compat> 0020 0305;;;;N;SPACING OVERSCORE;;;;
+203F;UNDERTIE;Pc;0;ON;;;;;N;;Enotikon;;;
+2040;CHARACTER TIE;Pc;0;ON;;;;;N;;;;;
+2041;CARET INSERTION POINT;Po;0;ON;;;;;N;;;;;
+2042;ASTERISM;Po;0;ON;;;;;N;;;;;
+2043;HYPHEN BULLET;Po;0;ON;;;;;N;;;;;
+2044;FRACTION SLASH;Sm;0;CS;;;;;N;;;;;
+2045;LEFT SQUARE BRACKET WITH QUILL;Ps;0;ON;;;;;Y;;;;;
+2046;RIGHT SQUARE BRACKET WITH QUILL;Pe;0;ON;;;;;Y;;;;;
+2047;DOUBLE QUESTION MARK;Po;0;ON;<compat> 003F 003F;;;;N;;;;;
+2048;QUESTION EXCLAMATION MARK;Po;0;ON;<compat> 003F 0021;;;;N;;;;;
+2049;EXCLAMATION QUESTION MARK;Po;0;ON;<compat> 0021 003F;;;;N;;;;;
+204A;TIRONIAN SIGN ET;Po;0;ON;;;;;N;;;;;
+204B;REVERSED PILCROW SIGN;Po;0;ON;;;;;N;;;;;
+204C;BLACK LEFTWARDS BULLET;Po;0;ON;;;;;N;;;;;
+204D;BLACK RIGHTWARDS BULLET;Po;0;ON;;;;;N;;;;;
+204E;LOW ASTERISK;Po;0;ON;;;;;N;;;;;
+204F;REVERSED SEMICOLON;Po;0;ON;;;;;N;;;;;
+2050;CLOSE UP;Po;0;ON;;;;;N;;;;;
+2051;TWO ASTERISKS ALIGNED VERTICALLY;Po;0;ON;;;;;N;;;;;
+2052;COMMERCIAL MINUS SIGN;Sm;0;ON;;;;;N;;;;;
+2053;SWUNG DASH;Po;0;ON;;;;;N;;;;;
+2054;INVERTED UNDERTIE;Pc;0;ON;;;;;N;;;;;
+2055;FLOWER PUNCTUATION MARK;Po;0;ON;;;;;N;;;;;
+2056;THREE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;;
+2057;QUADRUPLE PRIME;Po;0;ON;<compat> 2032 2032 2032 2032;;;;N;;;;;
+2058;FOUR DOT PUNCTUATION;Po;0;ON;;;;;N;;;;;
+2059;FIVE DOT PUNCTUATION;Po;0;ON;;;;;N;;;;;
+205A;TWO DOT PUNCTUATION;Po;0;ON;;;;;N;;;;;
+205B;FOUR DOT MARK;Po;0;ON;;;;;N;;;;;
+205C;DOTTED CROSS;Po;0;ON;;;;;N;;;;;
+205D;TRICOLON;Po;0;ON;;;;;N;;;;;
+205E;VERTICAL FOUR DOTS;Po;0;ON;;;;;N;;;;;
+205F;MEDIUM MATHEMATICAL SPACE;Zs;0;WS;<compat> 0020;;;;N;;;;;
+2060;WORD JOINER;Cf;0;BN;;;;;N;;;;;
+2061;FUNCTION APPLICATION;Cf;0;BN;;;;;N;;;;;
+2062;INVISIBLE TIMES;Cf;0;BN;;;;;N;;;;;
+2063;INVISIBLE SEPARATOR;Cf;0;BN;;;;;N;;;;;
+206A;INHIBIT SYMMETRIC SWAPPING;Cf;0;BN;;;;;N;;;;;
+206B;ACTIVATE SYMMETRIC SWAPPING;Cf;0;BN;;;;;N;;;;;
+206C;INHIBIT ARABIC FORM SHAPING;Cf;0;BN;;;;;N;;;;;
+206D;ACTIVATE ARABIC FORM SHAPING;Cf;0;BN;;;;;N;;;;;
+206E;NATIONAL DIGIT SHAPES;Cf;0;BN;;;;;N;;;;;
+206F;NOMINAL DIGIT SHAPES;Cf;0;BN;;;;;N;;;;;
+2070;SUPERSCRIPT ZERO;No;0;EN;<super> 0030;;0;0;N;SUPERSCRIPT DIGIT ZERO;;;;
+2071;SUPERSCRIPT LATIN SMALL LETTER I;Ll;0;L;<super> 0069;;;;N;;;;;
+2074;SUPERSCRIPT FOUR;No;0;EN;<super> 0034;;4;4;N;SUPERSCRIPT DIGIT FOUR;;;;
+2075;SUPERSCRIPT FIVE;No;0;EN;<super> 0035;;5;5;N;SUPERSCRIPT DIGIT FIVE;;;;
+2076;SUPERSCRIPT SIX;No;0;EN;<super> 0036;;6;6;N;SUPERSCRIPT DIGIT SIX;;;;
+2077;SUPERSCRIPT SEVEN;No;0;EN;<super> 0037;;7;7;N;SUPERSCRIPT DIGIT SEVEN;;;;
+2078;SUPERSCRIPT EIGHT;No;0;EN;<super> 0038;;8;8;N;SUPERSCRIPT DIGIT EIGHT;;;;
+2079;SUPERSCRIPT NINE;No;0;EN;<super> 0039;;9;9;N;SUPERSCRIPT DIGIT NINE;;;;
+207A;SUPERSCRIPT PLUS SIGN;Sm;0;ES;<super> 002B;;;;N;;;;;
+207B;SUPERSCRIPT MINUS;Sm;0;ES;<super> 2212;;;;N;SUPERSCRIPT HYPHEN-MINUS;;;;
+207C;SUPERSCRIPT EQUALS SIGN;Sm;0;ON;<super> 003D;;;;N;;;;;
+207D;SUPERSCRIPT LEFT PARENTHESIS;Ps;0;ON;<super> 0028;;;;Y;SUPERSCRIPT OPENING PARENTHESIS;;;;
+207E;SUPERSCRIPT RIGHT PARENTHESIS;Pe;0;ON;<super> 0029;;;;Y;SUPERSCRIPT CLOSING PARENTHESIS;;;;
+207F;SUPERSCRIPT LATIN SMALL LETTER N;Ll;0;L;<super> 006E;;;;N;;;;;
+2080;SUBSCRIPT ZERO;No;0;EN;<sub> 0030;;0;0;N;SUBSCRIPT DIGIT ZERO;;;;
+2081;SUBSCRIPT ONE;No;0;EN;<sub> 0031;;1;1;N;SUBSCRIPT DIGIT ONE;;;;
+2082;SUBSCRIPT TWO;No;0;EN;<sub> 0032;;2;2;N;SUBSCRIPT DIGIT TWO;;;;
+2083;SUBSCRIPT THREE;No;0;EN;<sub> 0033;;3;3;N;SUBSCRIPT DIGIT THREE;;;;
+2084;SUBSCRIPT FOUR;No;0;EN;<sub> 0034;;4;4;N;SUBSCRIPT DIGIT FOUR;;;;
+2085;SUBSCRIPT FIVE;No;0;EN;<sub> 0035;;5;5;N;SUBSCRIPT DIGIT FIVE;;;;
+2086;SUBSCRIPT SIX;No;0;EN;<sub> 0036;;6;6;N;SUBSCRIPT DIGIT SIX;;;;
+2087;SUBSCRIPT SEVEN;No;0;EN;<sub> 0037;;7;7;N;SUBSCRIPT DIGIT SEVEN;;;;
+2088;SUBSCRIPT EIGHT;No;0;EN;<sub> 0038;;8;8;N;SUBSCRIPT DIGIT EIGHT;;;;
+2089;SUBSCRIPT NINE;No;0;EN;<sub> 0039;;9;9;N;SUBSCRIPT DIGIT NINE;;;;
+208A;SUBSCRIPT PLUS SIGN;Sm;0;ES;<sub> 002B;;;;N;;;;;
+208B;SUBSCRIPT MINUS;Sm;0;ES;<sub> 2212;;;;N;SUBSCRIPT HYPHEN-MINUS;;;;
+208C;SUBSCRIPT EQUALS SIGN;Sm;0;ON;<sub> 003D;;;;N;;;;;
+208D;SUBSCRIPT LEFT PARENTHESIS;Ps;0;ON;<sub> 0028;;;;Y;SUBSCRIPT OPENING PARENTHESIS;;;;
+208E;SUBSCRIPT RIGHT PARENTHESIS;Pe;0;ON;<sub> 0029;;;;Y;SUBSCRIPT CLOSING PARENTHESIS;;;;
+2090;LATIN SUBSCRIPT SMALL LETTER A;Lm;0;L;<sub> 0061;;;;N;;;;;
+2091;LATIN SUBSCRIPT SMALL LETTER E;Lm;0;L;<sub> 0065;;;;N;;;;;
+2092;LATIN SUBSCRIPT SMALL LETTER O;Lm;0;L;<sub> 006F;;;;N;;;;;
+2093;LATIN SUBSCRIPT SMALL LETTER X;Lm;0;L;<sub> 0078;;;;N;;;;;
+2094;LATIN SUBSCRIPT SMALL LETTER SCHWA;Lm;0;L;<sub> 0259;;;;N;;;;;
+20A0;EURO-CURRENCY SIGN;Sc;0;ET;;;;;N;;;;;
+20A1;COLON SIGN;Sc;0;ET;;;;;N;;;;;
+20A2;CRUZEIRO SIGN;Sc;0;ET;;;;;N;;;;;
+20A3;FRENCH FRANC SIGN;Sc;0;ET;;;;;N;;;;;
+20A4;LIRA SIGN;Sc;0;ET;;;;;N;;;;;
+20A5;MILL SIGN;Sc;0;ET;;;;;N;;;;;
+20A6;NAIRA SIGN;Sc;0;ET;;;;;N;;;;;
+20A7;PESETA SIGN;Sc;0;ET;;;;;N;;;;;
+20A8;RUPEE SIGN;Sc;0;ET;<compat> 0052 0073;;;;N;;;;;
+20A9;WON SIGN;Sc;0;ET;;;;;N;;;;;
+20AA;NEW SHEQEL SIGN;Sc;0;ET;;;;;N;;;;;
+20AB;DONG SIGN;Sc;0;ET;;;;;N;;;;;
+20AC;EURO SIGN;Sc;0;ET;;;;;N;;;;;
+20AD;KIP SIGN;Sc;0;ET;;;;;N;;;;;
+20AE;TUGRIK SIGN;Sc;0;ET;;;;;N;;;;;
+20AF;DRACHMA SIGN;Sc;0;ET;;;;;N;;;;;
+20B0;GERMAN PENNY SIGN;Sc;0;ET;;;;;N;;;;;
+20B1;PESO SIGN;Sc;0;ET;;;;;N;;;;;
+20B2;GUARANI SIGN;Sc;0;ET;;;;;N;;;;;
+20B3;AUSTRAL SIGN;Sc;0;ET;;;;;N;;;;;
+20B4;HRYVNIA SIGN;Sc;0;ET;;;;;N;;;;;
+20B5;CEDI SIGN;Sc;0;ET;;;;;N;;;;;
+20D0;COMBINING LEFT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT HARPOON ABOVE;;;;
+20D1;COMBINING RIGHT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RIGHT HARPOON ABOVE;;;;
+20D2;COMBINING LONG VERTICAL LINE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG VERTICAL BAR OVERLAY;;;;
+20D3;COMBINING SHORT VERTICAL LINE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING SHORT VERTICAL BAR OVERLAY;;;;
+20D4;COMBINING ANTICLOCKWISE ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING ANTICLOCKWISE ARROW ABOVE;;;;
+20D5;COMBINING CLOCKWISE ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING CLOCKWISE ARROW ABOVE;;;;
+20D6;COMBINING LEFT ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT ARROW ABOVE;;;;
+20D7;COMBINING RIGHT ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RIGHT ARROW ABOVE;;;;
+20D8;COMBINING RING OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING RING OVERLAY;;;;
+20D9;COMBINING CLOCKWISE RING OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING CLOCKWISE RING OVERLAY;;;;
+20DA;COMBINING ANTICLOCKWISE RING OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING ANTICLOCKWISE RING OVERLAY;;;;
+20DB;COMBINING THREE DOTS ABOVE;Mn;230;NSM;;;;;N;NON-SPACING THREE DOTS ABOVE;;;;
+20DC;COMBINING FOUR DOTS ABOVE;Mn;230;NSM;;;;;N;NON-SPACING FOUR DOTS ABOVE;;;;
+20DD;COMBINING ENCLOSING CIRCLE;Me;0;NSM;;;;;N;ENCLOSING CIRCLE;;;;
+20DE;COMBINING ENCLOSING SQUARE;Me;0;NSM;;;;;N;ENCLOSING SQUARE;;;;
+20DF;COMBINING ENCLOSING DIAMOND;Me;0;NSM;;;;;N;ENCLOSING DIAMOND;;;;
+20E0;COMBINING ENCLOSING CIRCLE BACKSLASH;Me;0;NSM;;;;;N;ENCLOSING CIRCLE SLASH;;;;
+20E1;COMBINING LEFT RIGHT ARROW ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT RIGHT ARROW ABOVE;;;;
+20E2;COMBINING ENCLOSING SCREEN;Me;0;NSM;;;;;N;;;;;
+20E3;COMBINING ENCLOSING KEYCAP;Me;0;NSM;;;;;N;;;;;
+20E4;COMBINING ENCLOSING UPWARD POINTING TRIANGLE;Me;0;NSM;;;;;N;;;;;
+20E5;COMBINING REVERSE SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;;;;;
+20E6;COMBINING DOUBLE VERTICAL STROKE OVERLAY;Mn;1;NSM;;;;;N;;;;;
+20E7;COMBINING ANNUITY SYMBOL;Mn;230;NSM;;;;;N;;;;;
+20E8;COMBINING TRIPLE UNDERDOT;Mn;220;NSM;;;;;N;;;;;
+20E9;COMBINING WIDE BRIDGE ABOVE;Mn;230;NSM;;;;;N;;;;;
+20EA;COMBINING LEFTWARDS ARROW OVERLAY;Mn;1;NSM;;;;;N;;;;;
+20EB;COMBINING LONG DOUBLE SOLIDUS OVERLAY;Mn;1;NSM;;;;;N;;;;;
+20EC;COMBINING RIGHTWARDS HARPOON WITH BARB DOWNWARDS;Mn;220;NSM;;;;;N;;;;;
+20ED;COMBINING LEFTWARDS HARPOON WITH BARB DOWNWARDS;Mn;220;NSM;;;;;N;;;;;
+20EE;COMBINING LEFT ARROW BELOW;Mn;220;NSM;;;;;N;;;;;
+20EF;COMBINING RIGHT ARROW BELOW;Mn;220;NSM;;;;;N;;;;;
+2100;ACCOUNT OF;So;0;ON;<compat> 0061 002F 0063;;;;N;;;;;
+2101;ADDRESSED TO THE SUBJECT;So;0;ON;<compat> 0061 002F 0073;;;;N;;;;;
+2102;DOUBLE-STRUCK CAPITAL C;Lu;0;L;<font> 0043;;;;N;DOUBLE-STRUCK C;;;;
+2103;DEGREE CELSIUS;So;0;ON;<compat> 00B0 0043;;;;N;DEGREES CENTIGRADE;;;;
+2104;CENTRE LINE SYMBOL;So;0;ON;;;;;N;C L SYMBOL;;;;
+2105;CARE OF;So;0;ON;<compat> 0063 002F 006F;;;;N;;;;;
+2106;CADA UNA;So;0;ON;<compat> 0063 002F 0075;;;;N;;;;;
+2107;EULER CONSTANT;Lu;0;L;<compat> 0190;;;;N;EULERS;;;;
+2108;SCRUPLE;So;0;ON;;;;;N;;;;;
+2109;DEGREE FAHRENHEIT;So;0;ON;<compat> 00B0 0046;;;;N;DEGREES FAHRENHEIT;;;;
+210A;SCRIPT SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+210B;SCRIPT CAPITAL H;Lu;0;L;<font> 0048;;;;N;SCRIPT H;;;;
+210C;BLACK-LETTER CAPITAL H;Lu;0;L;<font> 0048;;;;N;BLACK-LETTER H;;;;
+210D;DOUBLE-STRUCK CAPITAL H;Lu;0;L;<font> 0048;;;;N;DOUBLE-STRUCK H;;;;
+210E;PLANCK CONSTANT;Ll;0;L;<font> 0068;;;;N;;;;;
+210F;PLANCK CONSTANT OVER TWO PI;Ll;0;L;<font> 0127;;;;N;PLANCK CONSTANT OVER 2 PI;;;;
+2110;SCRIPT CAPITAL I;Lu;0;L;<font> 0049;;;;N;SCRIPT I;;;;
+2111;BLACK-LETTER CAPITAL I;Lu;0;L;<font> 0049;;;;N;BLACK-LETTER I;;;;
+2112;SCRIPT CAPITAL L;Lu;0;L;<font> 004C;;;;N;SCRIPT L;;;;
+2113;SCRIPT SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+2114;L B BAR SYMBOL;So;0;ON;;;;;N;;;;;
+2115;DOUBLE-STRUCK CAPITAL N;Lu;0;L;<font> 004E;;;;N;DOUBLE-STRUCK N;;;;
+2116;NUMERO SIGN;So;0;ON;<compat> 004E 006F;;;;N;NUMERO;;;;
+2117;SOUND RECORDING COPYRIGHT;So;0;ON;;;;;N;;;;;
+2118;SCRIPT CAPITAL P;So;0;ON;;;;;N;SCRIPT P;;;;
+2119;DOUBLE-STRUCK CAPITAL P;Lu;0;L;<font> 0050;;;;N;DOUBLE-STRUCK P;;;;
+211A;DOUBLE-STRUCK CAPITAL Q;Lu;0;L;<font> 0051;;;;N;DOUBLE-STRUCK Q;;;;
+211B;SCRIPT CAPITAL R;Lu;0;L;<font> 0052;;;;N;SCRIPT R;;;;
+211C;BLACK-LETTER CAPITAL R;Lu;0;L;<font> 0052;;;;N;BLACK-LETTER R;;;;
+211D;DOUBLE-STRUCK CAPITAL R;Lu;0;L;<font> 0052;;;;N;DOUBLE-STRUCK R;;;;
+211E;PRESCRIPTION TAKE;So;0;ON;;;;;N;;;;;
+211F;RESPONSE;So;0;ON;;;;;N;;;;;
+2120;SERVICE MARK;So;0;ON;<super> 0053 004D;;;;N;;;;;
+2121;TELEPHONE SIGN;So;0;ON;<compat> 0054 0045 004C;;;;N;T E L SYMBOL;;;;
+2122;TRADE MARK SIGN;So;0;ON;<super> 0054 004D;;;;N;TRADEMARK;;;;
+2123;VERSICLE;So;0;ON;;;;;N;;;;;
+2124;DOUBLE-STRUCK CAPITAL Z;Lu;0;L;<font> 005A;;;;N;DOUBLE-STRUCK Z;;;;
+2125;OUNCE SIGN;So;0;ON;;;;;N;OUNCE;;;;
+2126;OHM SIGN;Lu;0;L;03A9;;;;N;OHM;;;03C9;
+2127;INVERTED OHM SIGN;So;0;ON;;;;;N;MHO;;;;
+2128;BLACK-LETTER CAPITAL Z;Lu;0;L;<font> 005A;;;;N;BLACK-LETTER Z;;;;
+2129;TURNED GREEK SMALL LETTER IOTA;So;0;ON;;;;;N;;;;;
+212A;KELVIN SIGN;Lu;0;L;004B;;;;N;DEGREES KELVIN;;;006B;
+212B;ANGSTROM SIGN;Lu;0;L;00C5;;;;N;ANGSTROM UNIT;;;00E5;
+212C;SCRIPT CAPITAL B;Lu;0;L;<font> 0042;;;;N;SCRIPT B;;;;
+212D;BLACK-LETTER CAPITAL C;Lu;0;L;<font> 0043;;;;N;BLACK-LETTER C;;;;
+212E;ESTIMATED SYMBOL;So;0;ET;;;;;N;;;;;
+212F;SCRIPT SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+2130;SCRIPT CAPITAL E;Lu;0;L;<font> 0045;;;;N;SCRIPT E;;;;
+2131;SCRIPT CAPITAL F;Lu;0;L;<font> 0046;;;;N;SCRIPT F;;;;
+2132;TURNED CAPITAL F;Lu;0;L;;;;;N;TURNED F;;;214E;
+2133;SCRIPT CAPITAL M;Lu;0;L;<font> 004D;;;;N;SCRIPT M;;;;
+2134;SCRIPT SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+2135;ALEF SYMBOL;Lo;0;L;<compat> 05D0;;;;N;FIRST TRANSFINITE CARDINAL;;;;
+2136;BET SYMBOL;Lo;0;L;<compat> 05D1;;;;N;SECOND TRANSFINITE CARDINAL;;;;
+2137;GIMEL SYMBOL;Lo;0;L;<compat> 05D2;;;;N;THIRD TRANSFINITE CARDINAL;;;;
+2138;DALET SYMBOL;Lo;0;L;<compat> 05D3;;;;N;FOURTH TRANSFINITE CARDINAL;;;;
+2139;INFORMATION SOURCE;Ll;0;L;<font> 0069;;;;N;;;;;
+213A;ROTATED CAPITAL Q;So;0;ON;;;;;N;;;;;
+213B;FACSIMILE SIGN;So;0;ON;<compat> 0046 0041 0058;;;;N;;;;;
+213C;DOUBLE-STRUCK SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;;
+213D;DOUBLE-STRUCK SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;;
+213E;DOUBLE-STRUCK CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;;
+213F;DOUBLE-STRUCK CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;;
+2140;DOUBLE-STRUCK N-ARY SUMMATION;Sm;0;ON;<font> 2211;;;;Y;;;;;
+2141;TURNED SANS-SERIF CAPITAL G;Sm;0;ON;;;;;N;;;;;
+2142;TURNED SANS-SERIF CAPITAL L;Sm;0;ON;;;;;N;;;;;
+2143;REVERSED SANS-SERIF CAPITAL L;Sm;0;ON;;;;;N;;;;;
+2144;TURNED SANS-SERIF CAPITAL Y;Sm;0;ON;;;;;N;;;;;
+2145;DOUBLE-STRUCK ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+2146;DOUBLE-STRUCK ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+2147;DOUBLE-STRUCK ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+2148;DOUBLE-STRUCK ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+2149;DOUBLE-STRUCK ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+214A;PROPERTY LINE;So;0;ON;;;;;N;;;;;
+214B;TURNED AMPERSAND;Sm;0;ON;;;;;N;;;;;
+214C;PER SIGN;So;0;ON;;;;;N;;;;;
+214D;AKTIESELSKAB;So;0;ON;;;;;N;;;;;
+214E;TURNED SMALL F;Ll;0;L;;;;;N;;;2132;;2132
+2153;VULGAR FRACTION ONE THIRD;No;0;ON;<fraction> 0031 2044 0033;;;1/3;N;FRACTION ONE THIRD;;;;
+2154;VULGAR FRACTION TWO THIRDS;No;0;ON;<fraction> 0032 2044 0033;;;2/3;N;FRACTION TWO THIRDS;;;;
+2155;VULGAR FRACTION ONE FIFTH;No;0;ON;<fraction> 0031 2044 0035;;;1/5;N;FRACTION ONE FIFTH;;;;
+2156;VULGAR FRACTION TWO FIFTHS;No;0;ON;<fraction> 0032 2044 0035;;;2/5;N;FRACTION TWO FIFTHS;;;;
+2157;VULGAR FRACTION THREE FIFTHS;No;0;ON;<fraction> 0033 2044 0035;;;3/5;N;FRACTION THREE FIFTHS;;;;
+2158;VULGAR FRACTION FOUR FIFTHS;No;0;ON;<fraction> 0034 2044 0035;;;4/5;N;FRACTION FOUR FIFTHS;;;;
+2159;VULGAR FRACTION ONE SIXTH;No;0;ON;<fraction> 0031 2044 0036;;;1/6;N;FRACTION ONE SIXTH;;;;
+215A;VULGAR FRACTION FIVE SIXTHS;No;0;ON;<fraction> 0035 2044 0036;;;5/6;N;FRACTION FIVE SIXTHS;;;;
+215B;VULGAR FRACTION ONE EIGHTH;No;0;ON;<fraction> 0031 2044 0038;;;1/8;N;FRACTION ONE EIGHTH;;;;
+215C;VULGAR FRACTION THREE EIGHTHS;No;0;ON;<fraction> 0033 2044 0038;;;3/8;N;FRACTION THREE EIGHTHS;;;;
+215D;VULGAR FRACTION FIVE EIGHTHS;No;0;ON;<fraction> 0035 2044 0038;;;5/8;N;FRACTION FIVE EIGHTHS;;;;
+215E;VULGAR FRACTION SEVEN EIGHTHS;No;0;ON;<fraction> 0037 2044 0038;;;7/8;N;FRACTION SEVEN EIGHTHS;;;;
+215F;FRACTION NUMERATOR ONE;No;0;ON;<fraction> 0031 2044;;;1;N;;;;;
+2160;ROMAN NUMERAL ONE;Nl;0;L;<compat> 0049;;;1;N;;;;2170;
+2161;ROMAN NUMERAL TWO;Nl;0;L;<compat> 0049 0049;;;2;N;;;;2171;
+2162;ROMAN NUMERAL THREE;Nl;0;L;<compat> 0049 0049 0049;;;3;N;;;;2172;
+2163;ROMAN NUMERAL FOUR;Nl;0;L;<compat> 0049 0056;;;4;N;;;;2173;
+2164;ROMAN NUMERAL FIVE;Nl;0;L;<compat> 0056;;;5;N;;;;2174;
+2165;ROMAN NUMERAL SIX;Nl;0;L;<compat> 0056 0049;;;6;N;;;;2175;
+2166;ROMAN NUMERAL SEVEN;Nl;0;L;<compat> 0056 0049 0049;;;7;N;;;;2176;
+2167;ROMAN NUMERAL EIGHT;Nl;0;L;<compat> 0056 0049 0049 0049;;;8;N;;;;2177;
+2168;ROMAN NUMERAL NINE;Nl;0;L;<compat> 0049 0058;;;9;N;;;;2178;
+2169;ROMAN NUMERAL TEN;Nl;0;L;<compat> 0058;;;10;N;;;;2179;
+216A;ROMAN NUMERAL ELEVEN;Nl;0;L;<compat> 0058 0049;;;11;N;;;;217A;
+216B;ROMAN NUMERAL TWELVE;Nl;0;L;<compat> 0058 0049 0049;;;12;N;;;;217B;
+216C;ROMAN NUMERAL FIFTY;Nl;0;L;<compat> 004C;;;50;N;;;;217C;
+216D;ROMAN NUMERAL ONE HUNDRED;Nl;0;L;<compat> 0043;;;100;N;;;;217D;
+216E;ROMAN NUMERAL FIVE HUNDRED;Nl;0;L;<compat> 0044;;;500;N;;;;217E;
+216F;ROMAN NUMERAL ONE THOUSAND;Nl;0;L;<compat> 004D;;;1000;N;;;;217F;
+2170;SMALL ROMAN NUMERAL ONE;Nl;0;L;<compat> 0069;;;1;N;;;2160;;2160
+2171;SMALL ROMAN NUMERAL TWO;Nl;0;L;<compat> 0069 0069;;;2;N;;;2161;;2161
+2172;SMALL ROMAN NUMERAL THREE;Nl;0;L;<compat> 0069 0069 0069;;;3;N;;;2162;;2162
+2173;SMALL ROMAN NUMERAL FOUR;Nl;0;L;<compat> 0069 0076;;;4;N;;;2163;;2163
+2174;SMALL ROMAN NUMERAL FIVE;Nl;0;L;<compat> 0076;;;5;N;;;2164;;2164
+2175;SMALL ROMAN NUMERAL SIX;Nl;0;L;<compat> 0076 0069;;;6;N;;;2165;;2165
+2176;SMALL ROMAN NUMERAL SEVEN;Nl;0;L;<compat> 0076 0069 0069;;;7;N;;;2166;;2166
+2177;SMALL ROMAN NUMERAL EIGHT;Nl;0;L;<compat> 0076 0069 0069 0069;;;8;N;;;2167;;2167
+2178;SMALL ROMAN NUMERAL NINE;Nl;0;L;<compat> 0069 0078;;;9;N;;;2168;;2168
+2179;SMALL ROMAN NUMERAL TEN;Nl;0;L;<compat> 0078;;;10;N;;;2169;;2169
+217A;SMALL ROMAN NUMERAL ELEVEN;Nl;0;L;<compat> 0078 0069;;;11;N;;;216A;;216A
+217B;SMALL ROMAN NUMERAL TWELVE;Nl;0;L;<compat> 0078 0069 0069;;;12;N;;;216B;;216B
+217C;SMALL ROMAN NUMERAL FIFTY;Nl;0;L;<compat> 006C;;;50;N;;;216C;;216C
+217D;SMALL ROMAN NUMERAL ONE HUNDRED;Nl;0;L;<compat> 0063;;;100;N;;;216D;;216D
+217E;SMALL ROMAN NUMERAL FIVE HUNDRED;Nl;0;L;<compat> 0064;;;500;N;;;216E;;216E
+217F;SMALL ROMAN NUMERAL ONE THOUSAND;Nl;0;L;<compat> 006D;;;1000;N;;;216F;;216F
+2180;ROMAN NUMERAL ONE THOUSAND C D;Nl;0;L;;;;1000;N;;;;;
+2181;ROMAN NUMERAL FIVE THOUSAND;Nl;0;L;;;;5000;N;;;;;
+2182;ROMAN NUMERAL TEN THOUSAND;Nl;0;L;;;;10000;N;;;;;
+2183;ROMAN NUMERAL REVERSED ONE HUNDRED;Lu;0;L;;;;;N;;;;2184;
+2184;LATIN SMALL LETTER REVERSED C;Ll;0;L;;;;;N;;;2183;;2183
+2190;LEFTWARDS ARROW;Sm;0;ON;;;;;N;LEFT ARROW;;;;
+2191;UPWARDS ARROW;Sm;0;ON;;;;;N;UP ARROW;;;;
+2192;RIGHTWARDS ARROW;Sm;0;ON;;;;;N;RIGHT ARROW;;;;
+2193;DOWNWARDS ARROW;Sm;0;ON;;;;;N;DOWN ARROW;;;;
+2194;LEFT RIGHT ARROW;Sm;0;ON;;;;;N;;;;;
+2195;UP DOWN ARROW;So;0;ON;;;;;N;;;;;
+2196;NORTH WEST ARROW;So;0;ON;;;;;N;UPPER LEFT ARROW;;;;
+2197;NORTH EAST ARROW;So;0;ON;;;;;N;UPPER RIGHT ARROW;;;;
+2198;SOUTH EAST ARROW;So;0;ON;;;;;N;LOWER RIGHT ARROW;;;;
+2199;SOUTH WEST ARROW;So;0;ON;;;;;N;LOWER LEFT ARROW;;;;
+219A;LEFTWARDS ARROW WITH STROKE;Sm;0;ON;2190 0338;;;;N;LEFT ARROW WITH STROKE;;;;
+219B;RIGHTWARDS ARROW WITH STROKE;Sm;0;ON;2192 0338;;;;N;RIGHT ARROW WITH STROKE;;;;
+219C;LEFTWARDS WAVE ARROW;So;0;ON;;;;;N;LEFT WAVE ARROW;;;;
+219D;RIGHTWARDS WAVE ARROW;So;0;ON;;;;;N;RIGHT WAVE ARROW;;;;
+219E;LEFTWARDS TWO HEADED ARROW;So;0;ON;;;;;N;LEFT TWO HEADED ARROW;;;;
+219F;UPWARDS TWO HEADED ARROW;So;0;ON;;;;;N;UP TWO HEADED ARROW;;;;
+21A0;RIGHTWARDS TWO HEADED ARROW;Sm;0;ON;;;;;N;RIGHT TWO HEADED ARROW;;;;
+21A1;DOWNWARDS TWO HEADED ARROW;So;0;ON;;;;;N;DOWN TWO HEADED ARROW;;;;
+21A2;LEFTWARDS ARROW WITH TAIL;So;0;ON;;;;;N;LEFT ARROW WITH TAIL;;;;
+21A3;RIGHTWARDS ARROW WITH TAIL;Sm;0;ON;;;;;N;RIGHT ARROW WITH TAIL;;;;
+21A4;LEFTWARDS ARROW FROM BAR;So;0;ON;;;;;N;LEFT ARROW FROM BAR;;;;
+21A5;UPWARDS ARROW FROM BAR;So;0;ON;;;;;N;UP ARROW FROM BAR;;;;
+21A6;RIGHTWARDS ARROW FROM BAR;Sm;0;ON;;;;;N;RIGHT ARROW FROM BAR;;;;
+21A7;DOWNWARDS ARROW FROM BAR;So;0;ON;;;;;N;DOWN ARROW FROM BAR;;;;
+21A8;UP DOWN ARROW WITH BASE;So;0;ON;;;;;N;;;;;
+21A9;LEFTWARDS ARROW WITH HOOK;So;0;ON;;;;;N;LEFT ARROW WITH HOOK;;;;
+21AA;RIGHTWARDS ARROW WITH HOOK;So;0;ON;;;;;N;RIGHT ARROW WITH HOOK;;;;
+21AB;LEFTWARDS ARROW WITH LOOP;So;0;ON;;;;;N;LEFT ARROW WITH LOOP;;;;
+21AC;RIGHTWARDS ARROW WITH LOOP;So;0;ON;;;;;N;RIGHT ARROW WITH LOOP;;;;
+21AD;LEFT RIGHT WAVE ARROW;So;0;ON;;;;;N;;;;;
+21AE;LEFT RIGHT ARROW WITH STROKE;Sm;0;ON;2194 0338;;;;N;;;;;
+21AF;DOWNWARDS ZIGZAG ARROW;So;0;ON;;;;;N;DOWN ZIGZAG ARROW;;;;
+21B0;UPWARDS ARROW WITH TIP LEFTWARDS;So;0;ON;;;;;N;UP ARROW WITH TIP LEFT;;;;
+21B1;UPWARDS ARROW WITH TIP RIGHTWARDS;So;0;ON;;;;;N;UP ARROW WITH TIP RIGHT;;;;
+21B2;DOWNWARDS ARROW WITH TIP LEFTWARDS;So;0;ON;;;;;N;DOWN ARROW WITH TIP LEFT;;;;
+21B3;DOWNWARDS ARROW WITH TIP RIGHTWARDS;So;0;ON;;;;;N;DOWN ARROW WITH TIP RIGHT;;;;
+21B4;RIGHTWARDS ARROW WITH CORNER DOWNWARDS;So;0;ON;;;;;N;RIGHT ARROW WITH CORNER DOWN;;;;
+21B5;DOWNWARDS ARROW WITH CORNER LEFTWARDS;So;0;ON;;;;;N;DOWN ARROW WITH CORNER LEFT;;;;
+21B6;ANTICLOCKWISE TOP SEMICIRCLE ARROW;So;0;ON;;;;;N;;;;;
+21B7;CLOCKWISE TOP SEMICIRCLE ARROW;So;0;ON;;;;;N;;;;;
+21B8;NORTH WEST ARROW TO LONG BAR;So;0;ON;;;;;N;UPPER LEFT ARROW TO LONG BAR;;;;
+21B9;LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR;So;0;ON;;;;;N;LEFT ARROW TO BAR OVER RIGHT ARROW TO BAR;;;;
+21BA;ANTICLOCKWISE OPEN CIRCLE ARROW;So;0;ON;;;;;N;;;;;
+21BB;CLOCKWISE OPEN CIRCLE ARROW;So;0;ON;;;;;N;;;;;
+21BC;LEFTWARDS HARPOON WITH BARB UPWARDS;So;0;ON;;;;;N;LEFT HARPOON WITH BARB UP;;;;
+21BD;LEFTWARDS HARPOON WITH BARB DOWNWARDS;So;0;ON;;;;;N;LEFT HARPOON WITH BARB DOWN;;;;
+21BE;UPWARDS HARPOON WITH BARB RIGHTWARDS;So;0;ON;;;;;N;UP HARPOON WITH BARB RIGHT;;;;
+21BF;UPWARDS HARPOON WITH BARB LEFTWARDS;So;0;ON;;;;;N;UP HARPOON WITH BARB LEFT;;;;
+21C0;RIGHTWARDS HARPOON WITH BARB UPWARDS;So;0;ON;;;;;N;RIGHT HARPOON WITH BARB UP;;;;
+21C1;RIGHTWARDS HARPOON WITH BARB DOWNWARDS;So;0;ON;;;;;N;RIGHT HARPOON WITH BARB DOWN;;;;
+21C2;DOWNWARDS HARPOON WITH BARB RIGHTWARDS;So;0;ON;;;;;N;DOWN HARPOON WITH BARB RIGHT;;;;
+21C3;DOWNWARDS HARPOON WITH BARB LEFTWARDS;So;0;ON;;;;;N;DOWN HARPOON WITH BARB LEFT;;;;
+21C4;RIGHTWARDS ARROW OVER LEFTWARDS ARROW;So;0;ON;;;;;N;RIGHT ARROW OVER LEFT ARROW;;;;
+21C5;UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW;So;0;ON;;;;;N;UP ARROW LEFT OF DOWN ARROW;;;;
+21C6;LEFTWARDS ARROW OVER RIGHTWARDS ARROW;So;0;ON;;;;;N;LEFT ARROW OVER RIGHT ARROW;;;;
+21C7;LEFTWARDS PAIRED ARROWS;So;0;ON;;;;;N;LEFT PAIRED ARROWS;;;;
+21C8;UPWARDS PAIRED ARROWS;So;0;ON;;;;;N;UP PAIRED ARROWS;;;;
+21C9;RIGHTWARDS PAIRED ARROWS;So;0;ON;;;;;N;RIGHT PAIRED ARROWS;;;;
+21CA;DOWNWARDS PAIRED ARROWS;So;0;ON;;;;;N;DOWN PAIRED ARROWS;;;;
+21CB;LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON;So;0;ON;;;;;N;LEFT HARPOON OVER RIGHT HARPOON;;;;
+21CC;RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON;So;0;ON;;;;;N;RIGHT HARPOON OVER LEFT HARPOON;;;;
+21CD;LEFTWARDS DOUBLE ARROW WITH STROKE;So;0;ON;21D0 0338;;;;N;LEFT DOUBLE ARROW WITH STROKE;;;;
+21CE;LEFT RIGHT DOUBLE ARROW WITH STROKE;Sm;0;ON;21D4 0338;;;;N;;;;;
+21CF;RIGHTWARDS DOUBLE ARROW WITH STROKE;Sm;0;ON;21D2 0338;;;;N;RIGHT DOUBLE ARROW WITH STROKE;;;;
+21D0;LEFTWARDS DOUBLE ARROW;So;0;ON;;;;;N;LEFT DOUBLE ARROW;;;;
+21D1;UPWARDS DOUBLE ARROW;So;0;ON;;;;;N;UP DOUBLE ARROW;;;;
+21D2;RIGHTWARDS DOUBLE ARROW;Sm;0;ON;;;;;N;RIGHT DOUBLE ARROW;;;;
+21D3;DOWNWARDS DOUBLE ARROW;So;0;ON;;;;;N;DOWN DOUBLE ARROW;;;;
+21D4;LEFT RIGHT DOUBLE ARROW;Sm;0;ON;;;;;N;;;;;
+21D5;UP DOWN DOUBLE ARROW;So;0;ON;;;;;N;;;;;
+21D6;NORTH WEST DOUBLE ARROW;So;0;ON;;;;;N;UPPER LEFT DOUBLE ARROW;;;;
+21D7;NORTH EAST DOUBLE ARROW;So;0;ON;;;;;N;UPPER RIGHT DOUBLE ARROW;;;;
+21D8;SOUTH EAST DOUBLE ARROW;So;0;ON;;;;;N;LOWER RIGHT DOUBLE ARROW;;;;
+21D9;SOUTH WEST DOUBLE ARROW;So;0;ON;;;;;N;LOWER LEFT DOUBLE ARROW;;;;
+21DA;LEFTWARDS TRIPLE ARROW;So;0;ON;;;;;N;LEFT TRIPLE ARROW;;;;
+21DB;RIGHTWARDS TRIPLE ARROW;So;0;ON;;;;;N;RIGHT TRIPLE ARROW;;;;
+21DC;LEFTWARDS SQUIGGLE ARROW;So;0;ON;;;;;N;LEFT SQUIGGLE ARROW;;;;
+21DD;RIGHTWARDS SQUIGGLE ARROW;So;0;ON;;;;;N;RIGHT SQUIGGLE ARROW;;;;
+21DE;UPWARDS ARROW WITH DOUBLE STROKE;So;0;ON;;;;;N;UP ARROW WITH DOUBLE STROKE;;;;
+21DF;DOWNWARDS ARROW WITH DOUBLE STROKE;So;0;ON;;;;;N;DOWN ARROW WITH DOUBLE STROKE;;;;
+21E0;LEFTWARDS DASHED ARROW;So;0;ON;;;;;N;LEFT DASHED ARROW;;;;
+21E1;UPWARDS DASHED ARROW;So;0;ON;;;;;N;UP DASHED ARROW;;;;
+21E2;RIGHTWARDS DASHED ARROW;So;0;ON;;;;;N;RIGHT DASHED ARROW;;;;
+21E3;DOWNWARDS DASHED ARROW;So;0;ON;;;;;N;DOWN DASHED ARROW;;;;
+21E4;LEFTWARDS ARROW TO BAR;So;0;ON;;;;;N;LEFT ARROW TO BAR;;;;
+21E5;RIGHTWARDS ARROW TO BAR;So;0;ON;;;;;N;RIGHT ARROW TO BAR;;;;
+21E6;LEFTWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE LEFT ARROW;;;;
+21E7;UPWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE UP ARROW;;;;
+21E8;RIGHTWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE RIGHT ARROW;;;;
+21E9;DOWNWARDS WHITE ARROW;So;0;ON;;;;;N;WHITE DOWN ARROW;;;;
+21EA;UPWARDS WHITE ARROW FROM BAR;So;0;ON;;;;;N;WHITE UP ARROW FROM BAR;;;;
+21EB;UPWARDS WHITE ARROW ON PEDESTAL;So;0;ON;;;;;N;;;;;
+21EC;UPWARDS WHITE ARROW ON PEDESTAL WITH HORIZONTAL BAR;So;0;ON;;;;;N;;;;;
+21ED;UPWARDS WHITE ARROW ON PEDESTAL WITH VERTICAL BAR;So;0;ON;;;;;N;;;;;
+21EE;UPWARDS WHITE DOUBLE ARROW;So;0;ON;;;;;N;;;;;
+21EF;UPWARDS WHITE DOUBLE ARROW ON PEDESTAL;So;0;ON;;;;;N;;;;;
+21F0;RIGHTWARDS WHITE ARROW FROM WALL;So;0;ON;;;;;N;;;;;
+21F1;NORTH WEST ARROW TO CORNER;So;0;ON;;;;;N;;;;;
+21F2;SOUTH EAST ARROW TO CORNER;So;0;ON;;;;;N;;;;;
+21F3;UP DOWN WHITE ARROW;So;0;ON;;;;;N;;;;;
+21F4;RIGHT ARROW WITH SMALL CIRCLE;Sm;0;ON;;;;;N;;;;;
+21F5;DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+21F6;THREE RIGHTWARDS ARROWS;Sm;0;ON;;;;;N;;;;;
+21F7;LEFTWARDS ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+21F8;RIGHTWARDS ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+21F9;LEFT RIGHT ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+21FA;LEFTWARDS ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+21FB;RIGHTWARDS ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+21FC;LEFT RIGHT ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+21FD;LEFTWARDS OPEN-HEADED ARROW;Sm;0;ON;;;;;N;;;;;
+21FE;RIGHTWARDS OPEN-HEADED ARROW;Sm;0;ON;;;;;N;;;;;
+21FF;LEFT RIGHT OPEN-HEADED ARROW;Sm;0;ON;;;;;N;;;;;
+2200;FOR ALL;Sm;0;ON;;;;;N;;;;;
+2201;COMPLEMENT;Sm;0;ON;;;;;Y;;;;;
+2202;PARTIAL DIFFERENTIAL;Sm;0;ON;;;;;Y;;;;;
+2203;THERE EXISTS;Sm;0;ON;;;;;Y;;;;;
+2204;THERE DOES NOT EXIST;Sm;0;ON;2203 0338;;;;Y;;;;;
+2205;EMPTY SET;Sm;0;ON;;;;;N;;;;;
+2206;INCREMENT;Sm;0;ON;;;;;N;;;;;
+2207;NABLA;Sm;0;ON;;;;;N;;;;;
+2208;ELEMENT OF;Sm;0;ON;;;;;Y;;;;;
+2209;NOT AN ELEMENT OF;Sm;0;ON;2208 0338;;;;Y;;;;;
+220A;SMALL ELEMENT OF;Sm;0;ON;;;;;Y;;;;;
+220B;CONTAINS AS MEMBER;Sm;0;ON;;;;;Y;;;;;
+220C;DOES NOT CONTAIN AS MEMBER;Sm;0;ON;220B 0338;;;;Y;;;;;
+220D;SMALL CONTAINS AS MEMBER;Sm;0;ON;;;;;Y;;;;;
+220E;END OF PROOF;Sm;0;ON;;;;;N;;;;;
+220F;N-ARY PRODUCT;Sm;0;ON;;;;;N;;;;;
+2210;N-ARY COPRODUCT;Sm;0;ON;;;;;N;;;;;
+2211;N-ARY SUMMATION;Sm;0;ON;;;;;Y;;;;;
+2212;MINUS SIGN;Sm;0;ES;;;;;N;;;;;
+2213;MINUS-OR-PLUS SIGN;Sm;0;ET;;;;;N;;;;;
+2214;DOT PLUS;Sm;0;ON;;;;;N;;;;;
+2215;DIVISION SLASH;Sm;0;ON;;;;;Y;;;;;
+2216;SET MINUS;Sm;0;ON;;;;;Y;;;;;
+2217;ASTERISK OPERATOR;Sm;0;ON;;;;;N;;;;;
+2218;RING OPERATOR;Sm;0;ON;;;;;N;;;;;
+2219;BULLET OPERATOR;Sm;0;ON;;;;;N;;;;;
+221A;SQUARE ROOT;Sm;0;ON;;;;;Y;;;;;
+221B;CUBE ROOT;Sm;0;ON;;;;;Y;;;;;
+221C;FOURTH ROOT;Sm;0;ON;;;;;Y;;;;;
+221D;PROPORTIONAL TO;Sm;0;ON;;;;;Y;;;;;
+221E;INFINITY;Sm;0;ON;;;;;N;;;;;
+221F;RIGHT ANGLE;Sm;0;ON;;;;;Y;;;;;
+2220;ANGLE;Sm;0;ON;;;;;Y;;;;;
+2221;MEASURED ANGLE;Sm;0;ON;;;;;Y;;;;;
+2222;SPHERICAL ANGLE;Sm;0;ON;;;;;Y;;;;;
+2223;DIVIDES;Sm;0;ON;;;;;N;;;;;
+2224;DOES NOT DIVIDE;Sm;0;ON;2223 0338;;;;Y;;;;;
+2225;PARALLEL TO;Sm;0;ON;;;;;N;;;;;
+2226;NOT PARALLEL TO;Sm;0;ON;2225 0338;;;;Y;;;;;
+2227;LOGICAL AND;Sm;0;ON;;;;;N;;;;;
+2228;LOGICAL OR;Sm;0;ON;;;;;N;;;;;
+2229;INTERSECTION;Sm;0;ON;;;;;N;;;;;
+222A;UNION;Sm;0;ON;;;;;N;;;;;
+222B;INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+222C;DOUBLE INTEGRAL;Sm;0;ON;<compat> 222B 222B;;;;Y;;;;;
+222D;TRIPLE INTEGRAL;Sm;0;ON;<compat> 222B 222B 222B;;;;Y;;;;;
+222E;CONTOUR INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+222F;SURFACE INTEGRAL;Sm;0;ON;<compat> 222E 222E;;;;Y;;;;;
+2230;VOLUME INTEGRAL;Sm;0;ON;<compat> 222E 222E 222E;;;;Y;;;;;
+2231;CLOCKWISE INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+2232;CLOCKWISE CONTOUR INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+2233;ANTICLOCKWISE CONTOUR INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+2234;THEREFORE;Sm;0;ON;;;;;N;;;;;
+2235;BECAUSE;Sm;0;ON;;;;;N;;;;;
+2236;RATIO;Sm;0;ON;;;;;N;;;;;
+2237;PROPORTION;Sm;0;ON;;;;;N;;;;;
+2238;DOT MINUS;Sm;0;ON;;;;;N;;;;;
+2239;EXCESS;Sm;0;ON;;;;;Y;;;;;
+223A;GEOMETRIC PROPORTION;Sm;0;ON;;;;;N;;;;;
+223B;HOMOTHETIC;Sm;0;ON;;;;;Y;;;;;
+223C;TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;;
+223D;REVERSED TILDE;Sm;0;ON;;;;;Y;;lazy S;;;
+223E;INVERTED LAZY S;Sm;0;ON;;;;;Y;;;;;
+223F;SINE WAVE;Sm;0;ON;;;;;Y;;;;;
+2240;WREATH PRODUCT;Sm;0;ON;;;;;Y;;;;;
+2241;NOT TILDE;Sm;0;ON;223C 0338;;;;Y;;;;;
+2242;MINUS TILDE;Sm;0;ON;;;;;Y;;;;;
+2243;ASYMPTOTICALLY EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2244;NOT ASYMPTOTICALLY EQUAL TO;Sm;0;ON;2243 0338;;;;Y;;;;;
+2245;APPROXIMATELY EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2246;APPROXIMATELY BUT NOT ACTUALLY EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2247;NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO;Sm;0;ON;2245 0338;;;;Y;;;;;
+2248;ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2249;NOT ALMOST EQUAL TO;Sm;0;ON;2248 0338;;;;Y;;;;;
+224A;ALMOST EQUAL OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+224B;TRIPLE TILDE;Sm;0;ON;;;;;Y;;;;;
+224C;ALL EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+224D;EQUIVALENT TO;Sm;0;ON;;;;;N;;;;;
+224E;GEOMETRICALLY EQUIVALENT TO;Sm;0;ON;;;;;N;;;;;
+224F;DIFFERENCE BETWEEN;Sm;0;ON;;;;;N;;;;;
+2250;APPROACHES THE LIMIT;Sm;0;ON;;;;;N;;;;;
+2251;GEOMETRICALLY EQUAL TO;Sm;0;ON;;;;;N;;;;;
+2252;APPROXIMATELY EQUAL TO OR THE IMAGE OF;Sm;0;ON;;;;;Y;;;;;
+2253;IMAGE OF OR APPROXIMATELY EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2254;COLON EQUALS;Sm;0;ON;;;;;Y;COLON EQUAL;;;;
+2255;EQUALS COLON;Sm;0;ON;;;;;Y;EQUAL COLON;;;;
+2256;RING IN EQUAL TO;Sm;0;ON;;;;;N;;;;;
+2257;RING EQUAL TO;Sm;0;ON;;;;;N;;;;;
+2258;CORRESPONDS TO;Sm;0;ON;;;;;N;;;;;
+2259;ESTIMATES;Sm;0;ON;;;;;N;;;;;
+225A;EQUIANGULAR TO;Sm;0;ON;;;;;N;;;;;
+225B;STAR EQUALS;Sm;0;ON;;;;;N;;;;;
+225C;DELTA EQUAL TO;Sm;0;ON;;;;;N;;;;;
+225D;EQUAL TO BY DEFINITION;Sm;0;ON;;;;;N;;;;;
+225E;MEASURED BY;Sm;0;ON;;;;;N;;;;;
+225F;QUESTIONED EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2260;NOT EQUAL TO;Sm;0;ON;003D 0338;;;;Y;;;;;
+2261;IDENTICAL TO;Sm;0;ON;;;;;N;;;;;
+2262;NOT IDENTICAL TO;Sm;0;ON;2261 0338;;;;Y;;;;;
+2263;STRICTLY EQUIVALENT TO;Sm;0;ON;;;;;N;;;;;
+2264;LESS-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;LESS THAN OR EQUAL TO;;;;
+2265;GREATER-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;GREATER THAN OR EQUAL TO;;;;
+2266;LESS-THAN OVER EQUAL TO;Sm;0;ON;;;;;Y;LESS THAN OVER EQUAL TO;;;;
+2267;GREATER-THAN OVER EQUAL TO;Sm;0;ON;;;;;Y;GREATER THAN OVER EQUAL TO;;;;
+2268;LESS-THAN BUT NOT EQUAL TO;Sm;0;ON;;;;;Y;LESS THAN BUT NOT EQUAL TO;;;;
+2269;GREATER-THAN BUT NOT EQUAL TO;Sm;0;ON;;;;;Y;GREATER THAN BUT NOT EQUAL TO;;;;
+226A;MUCH LESS-THAN;Sm;0;ON;;;;;Y;MUCH LESS THAN;;;;
+226B;MUCH GREATER-THAN;Sm;0;ON;;;;;Y;MUCH GREATER THAN;;;;
+226C;BETWEEN;Sm;0;ON;;;;;N;;;;;
+226D;NOT EQUIVALENT TO;Sm;0;ON;224D 0338;;;;N;;;;;
+226E;NOT LESS-THAN;Sm;0;ON;003C 0338;;;;Y;NOT LESS THAN;;;;
+226F;NOT GREATER-THAN;Sm;0;ON;003E 0338;;;;Y;NOT GREATER THAN;;;;
+2270;NEITHER LESS-THAN NOR EQUAL TO;Sm;0;ON;2264 0338;;;;Y;NEITHER LESS THAN NOR EQUAL TO;;;;
+2271;NEITHER GREATER-THAN NOR EQUAL TO;Sm;0;ON;2265 0338;;;;Y;NEITHER GREATER THAN NOR EQUAL TO;;;;
+2272;LESS-THAN OR EQUIVALENT TO;Sm;0;ON;;;;;Y;LESS THAN OR EQUIVALENT TO;;;;
+2273;GREATER-THAN OR EQUIVALENT TO;Sm;0;ON;;;;;Y;GREATER THAN OR EQUIVALENT TO;;;;
+2274;NEITHER LESS-THAN NOR EQUIVALENT TO;Sm;0;ON;2272 0338;;;;Y;NEITHER LESS THAN NOR EQUIVALENT TO;;;;
+2275;NEITHER GREATER-THAN NOR EQUIVALENT TO;Sm;0;ON;2273 0338;;;;Y;NEITHER GREATER THAN NOR EQUIVALENT TO;;;;
+2276;LESS-THAN OR GREATER-THAN;Sm;0;ON;;;;;Y;LESS THAN OR GREATER THAN;;;;
+2277;GREATER-THAN OR LESS-THAN;Sm;0;ON;;;;;Y;GREATER THAN OR LESS THAN;;;;
+2278;NEITHER LESS-THAN NOR GREATER-THAN;Sm;0;ON;2276 0338;;;;Y;NEITHER LESS THAN NOR GREATER THAN;;;;
+2279;NEITHER GREATER-THAN NOR LESS-THAN;Sm;0;ON;2277 0338;;;;Y;NEITHER GREATER THAN NOR LESS THAN;;;;
+227A;PRECEDES;Sm;0;ON;;;;;Y;;;;;
+227B;SUCCEEDS;Sm;0;ON;;;;;Y;;;;;
+227C;PRECEDES OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+227D;SUCCEEDS OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+227E;PRECEDES OR EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;;
+227F;SUCCEEDS OR EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;;
+2280;DOES NOT PRECEDE;Sm;0;ON;227A 0338;;;;Y;;;;;
+2281;DOES NOT SUCCEED;Sm;0;ON;227B 0338;;;;Y;;;;;
+2282;SUBSET OF;Sm;0;ON;;;;;Y;;;;;
+2283;SUPERSET OF;Sm;0;ON;;;;;Y;;;;;
+2284;NOT A SUBSET OF;Sm;0;ON;2282 0338;;;;Y;;;;;
+2285;NOT A SUPERSET OF;Sm;0;ON;2283 0338;;;;Y;;;;;
+2286;SUBSET OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2287;SUPERSET OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2288;NEITHER A SUBSET OF NOR EQUAL TO;Sm;0;ON;2286 0338;;;;Y;;;;;
+2289;NEITHER A SUPERSET OF NOR EQUAL TO;Sm;0;ON;2287 0338;;;;Y;;;;;
+228A;SUBSET OF WITH NOT EQUAL TO;Sm;0;ON;;;;;Y;SUBSET OF OR NOT EQUAL TO;;;;
+228B;SUPERSET OF WITH NOT EQUAL TO;Sm;0;ON;;;;;Y;SUPERSET OF OR NOT EQUAL TO;;;;
+228C;MULTISET;Sm;0;ON;;;;;Y;;;;;
+228D;MULTISET MULTIPLICATION;Sm;0;ON;;;;;N;;;;;
+228E;MULTISET UNION;Sm;0;ON;;;;;N;;;;;
+228F;SQUARE IMAGE OF;Sm;0;ON;;;;;Y;;;;;
+2290;SQUARE ORIGINAL OF;Sm;0;ON;;;;;Y;;;;;
+2291;SQUARE IMAGE OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2292;SQUARE ORIGINAL OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2293;SQUARE CAP;Sm;0;ON;;;;;N;;;;;
+2294;SQUARE CUP;Sm;0;ON;;;;;N;;;;;
+2295;CIRCLED PLUS;Sm;0;ON;;;;;N;;;;;
+2296;CIRCLED MINUS;Sm;0;ON;;;;;N;;;;;
+2297;CIRCLED TIMES;Sm;0;ON;;;;;N;;;;;
+2298;CIRCLED DIVISION SLASH;Sm;0;ON;;;;;Y;;;;;
+2299;CIRCLED DOT OPERATOR;Sm;0;ON;;;;;N;;;;;
+229A;CIRCLED RING OPERATOR;Sm;0;ON;;;;;N;;;;;
+229B;CIRCLED ASTERISK OPERATOR;Sm;0;ON;;;;;N;;;;;
+229C;CIRCLED EQUALS;Sm;0;ON;;;;;N;;;;;
+229D;CIRCLED DASH;Sm;0;ON;;;;;N;;;;;
+229E;SQUARED PLUS;Sm;0;ON;;;;;N;;;;;
+229F;SQUARED MINUS;Sm;0;ON;;;;;N;;;;;
+22A0;SQUARED TIMES;Sm;0;ON;;;;;N;;;;;
+22A1;SQUARED DOT OPERATOR;Sm;0;ON;;;;;N;;;;;
+22A2;RIGHT TACK;Sm;0;ON;;;;;Y;;;;;
+22A3;LEFT TACK;Sm;0;ON;;;;;Y;;;;;
+22A4;DOWN TACK;Sm;0;ON;;;;;N;;;;;
+22A5;UP TACK;Sm;0;ON;;;;;N;;;;;
+22A6;ASSERTION;Sm;0;ON;;;;;Y;;;;;
+22A7;MODELS;Sm;0;ON;;;;;Y;;;;;
+22A8;TRUE;Sm;0;ON;;;;;Y;;;;;
+22A9;FORCES;Sm;0;ON;;;;;Y;;;;;
+22AA;TRIPLE VERTICAL BAR RIGHT TURNSTILE;Sm;0;ON;;;;;Y;;;;;
+22AB;DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE;Sm;0;ON;;;;;Y;;;;;
+22AC;DOES NOT PROVE;Sm;0;ON;22A2 0338;;;;Y;;;;;
+22AD;NOT TRUE;Sm;0;ON;22A8 0338;;;;Y;;;;;
+22AE;DOES NOT FORCE;Sm;0;ON;22A9 0338;;;;Y;;;;;
+22AF;NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE;Sm;0;ON;22AB 0338;;;;Y;;;;;
+22B0;PRECEDES UNDER RELATION;Sm;0;ON;;;;;Y;;;;;
+22B1;SUCCEEDS UNDER RELATION;Sm;0;ON;;;;;Y;;;;;
+22B2;NORMAL SUBGROUP OF;Sm;0;ON;;;;;Y;;;;;
+22B3;CONTAINS AS NORMAL SUBGROUP;Sm;0;ON;;;;;Y;;;;;
+22B4;NORMAL SUBGROUP OF OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+22B5;CONTAINS AS NORMAL SUBGROUP OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+22B6;ORIGINAL OF;Sm;0;ON;;;;;Y;;;;;
+22B7;IMAGE OF;Sm;0;ON;;;;;Y;;;;;
+22B8;MULTIMAP;Sm;0;ON;;;;;Y;;;;;
+22B9;HERMITIAN CONJUGATE MATRIX;Sm;0;ON;;;;;N;;;;;
+22BA;INTERCALATE;Sm;0;ON;;;;;N;;;;;
+22BB;XOR;Sm;0;ON;;;;;N;;;;;
+22BC;NAND;Sm;0;ON;;;;;N;;;;;
+22BD;NOR;Sm;0;ON;;;;;N;;;;;
+22BE;RIGHT ANGLE WITH ARC;Sm;0;ON;;;;;Y;;;;;
+22BF;RIGHT TRIANGLE;Sm;0;ON;;;;;Y;;;;;
+22C0;N-ARY LOGICAL AND;Sm;0;ON;;;;;N;;;;;
+22C1;N-ARY LOGICAL OR;Sm;0;ON;;;;;N;;;;;
+22C2;N-ARY INTERSECTION;Sm;0;ON;;;;;N;;;;;
+22C3;N-ARY UNION;Sm;0;ON;;;;;N;;;;;
+22C4;DIAMOND OPERATOR;Sm;0;ON;;;;;N;;;;;
+22C5;DOT OPERATOR;Sm;0;ON;;;;;N;;;;;
+22C6;STAR OPERATOR;Sm;0;ON;;;;;N;;;;;
+22C7;DIVISION TIMES;Sm;0;ON;;;;;N;;;;;
+22C8;BOWTIE;Sm;0;ON;;;;;N;;;;;
+22C9;LEFT NORMAL FACTOR SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;;
+22CA;RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;;
+22CB;LEFT SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;;
+22CC;RIGHT SEMIDIRECT PRODUCT;Sm;0;ON;;;;;Y;;;;;
+22CD;REVERSED TILDE EQUALS;Sm;0;ON;;;;;Y;;;;;
+22CE;CURLY LOGICAL OR;Sm;0;ON;;;;;N;;;;;
+22CF;CURLY LOGICAL AND;Sm;0;ON;;;;;N;;;;;
+22D0;DOUBLE SUBSET;Sm;0;ON;;;;;Y;;;;;
+22D1;DOUBLE SUPERSET;Sm;0;ON;;;;;Y;;;;;
+22D2;DOUBLE INTERSECTION;Sm;0;ON;;;;;N;;;;;
+22D3;DOUBLE UNION;Sm;0;ON;;;;;N;;;;;
+22D4;PITCHFORK;Sm;0;ON;;;;;N;;;;;
+22D5;EQUAL AND PARALLEL TO;Sm;0;ON;;;;;N;;;;;
+22D6;LESS-THAN WITH DOT;Sm;0;ON;;;;;Y;LESS THAN WITH DOT;;;;
+22D7;GREATER-THAN WITH DOT;Sm;0;ON;;;;;Y;GREATER THAN WITH DOT;;;;
+22D8;VERY MUCH LESS-THAN;Sm;0;ON;;;;;Y;VERY MUCH LESS THAN;;;;
+22D9;VERY MUCH GREATER-THAN;Sm;0;ON;;;;;Y;VERY MUCH GREATER THAN;;;;
+22DA;LESS-THAN EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;LESS THAN EQUAL TO OR GREATER THAN;;;;
+22DB;GREATER-THAN EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;GREATER THAN EQUAL TO OR LESS THAN;;;;
+22DC;EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;EQUAL TO OR LESS THAN;;;;
+22DD;EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;EQUAL TO OR GREATER THAN;;;;
+22DE;EQUAL TO OR PRECEDES;Sm;0;ON;;;;;Y;;;;;
+22DF;EQUAL TO OR SUCCEEDS;Sm;0;ON;;;;;Y;;;;;
+22E0;DOES NOT PRECEDE OR EQUAL;Sm;0;ON;227C 0338;;;;Y;;;;;
+22E1;DOES NOT SUCCEED OR EQUAL;Sm;0;ON;227D 0338;;;;Y;;;;;
+22E2;NOT SQUARE IMAGE OF OR EQUAL TO;Sm;0;ON;2291 0338;;;;Y;;;;;
+22E3;NOT SQUARE ORIGINAL OF OR EQUAL TO;Sm;0;ON;2292 0338;;;;Y;;;;;
+22E4;SQUARE IMAGE OF OR NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+22E5;SQUARE ORIGINAL OF OR NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+22E6;LESS-THAN BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;LESS THAN BUT NOT EQUIVALENT TO;;;;
+22E7;GREATER-THAN BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;GREATER THAN BUT NOT EQUIVALENT TO;;;;
+22E8;PRECEDES BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;;
+22E9;SUCCEEDS BUT NOT EQUIVALENT TO;Sm;0;ON;;;;;Y;;;;;
+22EA;NOT NORMAL SUBGROUP OF;Sm;0;ON;22B2 0338;;;;Y;;;;;
+22EB;DOES NOT CONTAIN AS NORMAL SUBGROUP;Sm;0;ON;22B3 0338;;;;Y;;;;;
+22EC;NOT NORMAL SUBGROUP OF OR EQUAL TO;Sm;0;ON;22B4 0338;;;;Y;;;;;
+22ED;DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL;Sm;0;ON;22B5 0338;;;;Y;;;;;
+22EE;VERTICAL ELLIPSIS;Sm;0;ON;;;;;N;;;;;
+22EF;MIDLINE HORIZONTAL ELLIPSIS;Sm;0;ON;;;;;N;;;;;
+22F0;UP RIGHT DIAGONAL ELLIPSIS;Sm;0;ON;;;;;Y;;;;;
+22F1;DOWN RIGHT DIAGONAL ELLIPSIS;Sm;0;ON;;;;;Y;;;;;
+22F2;ELEMENT OF WITH LONG HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;;
+22F3;ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;;
+22F4;SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;;
+22F5;ELEMENT OF WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;;
+22F6;ELEMENT OF WITH OVERBAR;Sm;0;ON;;;;;Y;;;;;
+22F7;SMALL ELEMENT OF WITH OVERBAR;Sm;0;ON;;;;;Y;;;;;
+22F8;ELEMENT OF WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;;
+22F9;ELEMENT OF WITH TWO HORIZONTAL STROKES;Sm;0;ON;;;;;Y;;;;;
+22FA;CONTAINS WITH LONG HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;;
+22FB;CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;;
+22FC;SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;;
+22FD;CONTAINS WITH OVERBAR;Sm;0;ON;;;;;Y;;;;;
+22FE;SMALL CONTAINS WITH OVERBAR;Sm;0;ON;;;;;Y;;;;;
+22FF;Z NOTATION BAG MEMBERSHIP;Sm;0;ON;;;;;Y;;;;;
+2300;DIAMETER SIGN;So;0;ON;;;;;N;;;;;
+2301;ELECTRIC ARROW;So;0;ON;;;;;N;;;;;
+2302;HOUSE;So;0;ON;;;;;N;;;;;
+2303;UP ARROWHEAD;So;0;ON;;;;;N;;;;;
+2304;DOWN ARROWHEAD;So;0;ON;;;;;N;;;;;
+2305;PROJECTIVE;So;0;ON;;;;;N;;;;;
+2306;PERSPECTIVE;So;0;ON;;;;;N;;;;;
+2307;WAVY LINE;So;0;ON;;;;;N;;;;;
+2308;LEFT CEILING;Sm;0;ON;;;;;Y;;;;;
+2309;RIGHT CEILING;Sm;0;ON;;;;;Y;;;;;
+230A;LEFT FLOOR;Sm;0;ON;;;;;Y;;;;;
+230B;RIGHT FLOOR;Sm;0;ON;;;;;Y;;;;;
+230C;BOTTOM RIGHT CROP;So;0;ON;;;;;N;;;;;
+230D;BOTTOM LEFT CROP;So;0;ON;;;;;N;;;;;
+230E;TOP RIGHT CROP;So;0;ON;;;;;N;;;;;
+230F;TOP LEFT CROP;So;0;ON;;;;;N;;;;;
+2310;REVERSED NOT SIGN;So;0;ON;;;;;N;;;;;
+2311;SQUARE LOZENGE;So;0;ON;;;;;N;;;;;
+2312;ARC;So;0;ON;;;;;N;;;;;
+2313;SEGMENT;So;0;ON;;;;;N;;;;;
+2314;SECTOR;So;0;ON;;;;;N;;;;;
+2315;TELEPHONE RECORDER;So;0;ON;;;;;N;;;;;
+2316;POSITION INDICATOR;So;0;ON;;;;;N;;;;;
+2317;VIEWDATA SQUARE;So;0;ON;;;;;N;;;;;
+2318;PLACE OF INTEREST SIGN;So;0;ON;;;;;N;COMMAND KEY;;;;
+2319;TURNED NOT SIGN;So;0;ON;;;;;N;;;;;
+231A;WATCH;So;0;ON;;;;;N;;;;;
+231B;HOURGLASS;So;0;ON;;;;;N;;;;;
+231C;TOP LEFT CORNER;So;0;ON;;;;;N;;;;;
+231D;TOP RIGHT CORNER;So;0;ON;;;;;N;;;;;
+231E;BOTTOM LEFT CORNER;So;0;ON;;;;;N;;;;;
+231F;BOTTOM RIGHT CORNER;So;0;ON;;;;;N;;;;;
+2320;TOP HALF INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+2321;BOTTOM HALF INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+2322;FROWN;So;0;ON;;;;;N;;;;;
+2323;SMILE;So;0;ON;;;;;N;;;;;
+2324;UP ARROWHEAD BETWEEN TWO HORIZONTAL BARS;So;0;ON;;;;;N;ENTER KEY;;;;
+2325;OPTION KEY;So;0;ON;;;;;N;;;;;
+2326;ERASE TO THE RIGHT;So;0;ON;;;;;N;DELETE TO THE RIGHT KEY;;;;
+2327;X IN A RECTANGLE BOX;So;0;ON;;;;;N;CLEAR KEY;;;;
+2328;KEYBOARD;So;0;ON;;;;;N;;;;;
+2329;LEFT-POINTING ANGLE BRACKET;Ps;0;ON;3008;;;;Y;BRA;;;;
+232A;RIGHT-POINTING ANGLE BRACKET;Pe;0;ON;3009;;;;Y;KET;;;;
+232B;ERASE TO THE LEFT;So;0;ON;;;;;N;DELETE TO THE LEFT KEY;;;;
+232C;BENZENE RING;So;0;ON;;;;;N;;;;;
+232D;CYLINDRICITY;So;0;ON;;;;;N;;;;;
+232E;ALL AROUND-PROFILE;So;0;ON;;;;;N;;;;;
+232F;SYMMETRY;So;0;ON;;;;;N;;;;;
+2330;TOTAL RUNOUT;So;0;ON;;;;;N;;;;;
+2331;DIMENSION ORIGIN;So;0;ON;;;;;N;;;;;
+2332;CONICAL TAPER;So;0;ON;;;;;N;;;;;
+2333;SLOPE;So;0;ON;;;;;N;;;;;
+2334;COUNTERBORE;So;0;ON;;;;;N;;;;;
+2335;COUNTERSINK;So;0;ON;;;;;N;;;;;
+2336;APL FUNCTIONAL SYMBOL I-BEAM;So;0;L;;;;;N;;;;;
+2337;APL FUNCTIONAL SYMBOL SQUISH QUAD;So;0;L;;;;;N;;;;;
+2338;APL FUNCTIONAL SYMBOL QUAD EQUAL;So;0;L;;;;;N;;;;;
+2339;APL FUNCTIONAL SYMBOL QUAD DIVIDE;So;0;L;;;;;N;;;;;
+233A;APL FUNCTIONAL SYMBOL QUAD DIAMOND;So;0;L;;;;;N;;;;;
+233B;APL FUNCTIONAL SYMBOL QUAD JOT;So;0;L;;;;;N;;;;;
+233C;APL FUNCTIONAL SYMBOL QUAD CIRCLE;So;0;L;;;;;N;;;;;
+233D;APL FUNCTIONAL SYMBOL CIRCLE STILE;So;0;L;;;;;N;;;;;
+233E;APL FUNCTIONAL SYMBOL CIRCLE JOT;So;0;L;;;;;N;;;;;
+233F;APL FUNCTIONAL SYMBOL SLASH BAR;So;0;L;;;;;N;;;;;
+2340;APL FUNCTIONAL SYMBOL BACKSLASH BAR;So;0;L;;;;;N;;;;;
+2341;APL FUNCTIONAL SYMBOL QUAD SLASH;So;0;L;;;;;N;;;;;
+2342;APL FUNCTIONAL SYMBOL QUAD BACKSLASH;So;0;L;;;;;N;;;;;
+2343;APL FUNCTIONAL SYMBOL QUAD LESS-THAN;So;0;L;;;;;N;;;;;
+2344;APL FUNCTIONAL SYMBOL QUAD GREATER-THAN;So;0;L;;;;;N;;;;;
+2345;APL FUNCTIONAL SYMBOL LEFTWARDS VANE;So;0;L;;;;;N;;;;;
+2346;APL FUNCTIONAL SYMBOL RIGHTWARDS VANE;So;0;L;;;;;N;;;;;
+2347;APL FUNCTIONAL SYMBOL QUAD LEFTWARDS ARROW;So;0;L;;;;;N;;;;;
+2348;APL FUNCTIONAL SYMBOL QUAD RIGHTWARDS ARROW;So;0;L;;;;;N;;;;;
+2349;APL FUNCTIONAL SYMBOL CIRCLE BACKSLASH;So;0;L;;;;;N;;;;;
+234A;APL FUNCTIONAL SYMBOL DOWN TACK UNDERBAR;So;0;L;;;;;N;;*;;;
+234B;APL FUNCTIONAL SYMBOL DELTA STILE;So;0;L;;;;;N;;;;;
+234C;APL FUNCTIONAL SYMBOL QUAD DOWN CARET;So;0;L;;;;;N;;;;;
+234D;APL FUNCTIONAL SYMBOL QUAD DELTA;So;0;L;;;;;N;;;;;
+234E;APL FUNCTIONAL SYMBOL DOWN TACK JOT;So;0;L;;;;;N;;*;;;
+234F;APL FUNCTIONAL SYMBOL UPWARDS VANE;So;0;L;;;;;N;;;;;
+2350;APL FUNCTIONAL SYMBOL QUAD UPWARDS ARROW;So;0;L;;;;;N;;;;;
+2351;APL FUNCTIONAL SYMBOL UP TACK OVERBAR;So;0;L;;;;;N;;*;;;
+2352;APL FUNCTIONAL SYMBOL DEL STILE;So;0;L;;;;;N;;;;;
+2353;APL FUNCTIONAL SYMBOL QUAD UP CARET;So;0;L;;;;;N;;;;;
+2354;APL FUNCTIONAL SYMBOL QUAD DEL;So;0;L;;;;;N;;;;;
+2355;APL FUNCTIONAL SYMBOL UP TACK JOT;So;0;L;;;;;N;;*;;;
+2356;APL FUNCTIONAL SYMBOL DOWNWARDS VANE;So;0;L;;;;;N;;;;;
+2357;APL FUNCTIONAL SYMBOL QUAD DOWNWARDS ARROW;So;0;L;;;;;N;;;;;
+2358;APL FUNCTIONAL SYMBOL QUOTE UNDERBAR;So;0;L;;;;;N;;;;;
+2359;APL FUNCTIONAL SYMBOL DELTA UNDERBAR;So;0;L;;;;;N;;;;;
+235A;APL FUNCTIONAL SYMBOL DIAMOND UNDERBAR;So;0;L;;;;;N;;;;;
+235B;APL FUNCTIONAL SYMBOL JOT UNDERBAR;So;0;L;;;;;N;;;;;
+235C;APL FUNCTIONAL SYMBOL CIRCLE UNDERBAR;So;0;L;;;;;N;;;;;
+235D;APL FUNCTIONAL SYMBOL UP SHOE JOT;So;0;L;;;;;N;;;;;
+235E;APL FUNCTIONAL SYMBOL QUOTE QUAD;So;0;L;;;;;N;;;;;
+235F;APL FUNCTIONAL SYMBOL CIRCLE STAR;So;0;L;;;;;N;;;;;
+2360;APL FUNCTIONAL SYMBOL QUAD COLON;So;0;L;;;;;N;;;;;
+2361;APL FUNCTIONAL SYMBOL UP TACK DIAERESIS;So;0;L;;;;;N;;*;;;
+2362;APL FUNCTIONAL SYMBOL DEL DIAERESIS;So;0;L;;;;;N;;;;;
+2363;APL FUNCTIONAL SYMBOL STAR DIAERESIS;So;0;L;;;;;N;;;;;
+2364;APL FUNCTIONAL SYMBOL JOT DIAERESIS;So;0;L;;;;;N;;;;;
+2365;APL FUNCTIONAL SYMBOL CIRCLE DIAERESIS;So;0;L;;;;;N;;;;;
+2366;APL FUNCTIONAL SYMBOL DOWN SHOE STILE;So;0;L;;;;;N;;;;;
+2367;APL FUNCTIONAL SYMBOL LEFT SHOE STILE;So;0;L;;;;;N;;;;;
+2368;APL FUNCTIONAL SYMBOL TILDE DIAERESIS;So;0;L;;;;;N;;;;;
+2369;APL FUNCTIONAL SYMBOL GREATER-THAN DIAERESIS;So;0;L;;;;;N;;;;;
+236A;APL FUNCTIONAL SYMBOL COMMA BAR;So;0;L;;;;;N;;;;;
+236B;APL FUNCTIONAL SYMBOL DEL TILDE;So;0;L;;;;;N;;;;;
+236C;APL FUNCTIONAL SYMBOL ZILDE;So;0;L;;;;;N;;;;;
+236D;APL FUNCTIONAL SYMBOL STILE TILDE;So;0;L;;;;;N;;;;;
+236E;APL FUNCTIONAL SYMBOL SEMICOLON UNDERBAR;So;0;L;;;;;N;;;;;
+236F;APL FUNCTIONAL SYMBOL QUAD NOT EQUAL;So;0;L;;;;;N;;;;;
+2370;APL FUNCTIONAL SYMBOL QUAD QUESTION;So;0;L;;;;;N;;;;;
+2371;APL FUNCTIONAL SYMBOL DOWN CARET TILDE;So;0;L;;;;;N;;;;;
+2372;APL FUNCTIONAL SYMBOL UP CARET TILDE;So;0;L;;;;;N;;;;;
+2373;APL FUNCTIONAL SYMBOL IOTA;So;0;L;;;;;N;;;;;
+2374;APL FUNCTIONAL SYMBOL RHO;So;0;L;;;;;N;;;;;
+2375;APL FUNCTIONAL SYMBOL OMEGA;So;0;L;;;;;N;;;;;
+2376;APL FUNCTIONAL SYMBOL ALPHA UNDERBAR;So;0;L;;;;;N;;;;;
+2377;APL FUNCTIONAL SYMBOL EPSILON UNDERBAR;So;0;L;;;;;N;;;;;
+2378;APL FUNCTIONAL SYMBOL IOTA UNDERBAR;So;0;L;;;;;N;;;;;
+2379;APL FUNCTIONAL SYMBOL OMEGA UNDERBAR;So;0;L;;;;;N;;;;;
+237A;APL FUNCTIONAL SYMBOL ALPHA;So;0;L;;;;;N;;;;;
+237B;NOT CHECK MARK;So;0;ON;;;;;N;;;;;
+237C;RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW;Sm;0;ON;;;;;N;;;;;
+237D;SHOULDERED OPEN BOX;So;0;ON;;;;;N;;;;;
+237E;BELL SYMBOL;So;0;ON;;;;;N;;;;;
+237F;VERTICAL LINE WITH MIDDLE DOT;So;0;ON;;;;;N;;;;;
+2380;INSERTION SYMBOL;So;0;ON;;;;;N;;;;;
+2381;CONTINUOUS UNDERLINE SYMBOL;So;0;ON;;;;;N;;;;;
+2382;DISCONTINUOUS UNDERLINE SYMBOL;So;0;ON;;;;;N;;;;;
+2383;EMPHASIS SYMBOL;So;0;ON;;;;;N;;;;;
+2384;COMPOSITION SYMBOL;So;0;ON;;;;;N;;;;;
+2385;WHITE SQUARE WITH CENTRE VERTICAL LINE;So;0;ON;;;;;N;;;;;
+2386;ENTER SYMBOL;So;0;ON;;;;;N;;;;;
+2387;ALTERNATIVE KEY SYMBOL;So;0;ON;;;;;N;;;;;
+2388;HELM SYMBOL;So;0;ON;;;;;N;;;;;
+2389;CIRCLED HORIZONTAL BAR WITH NOTCH;So;0;ON;;;;;N;;pause;;;
+238A;CIRCLED TRIANGLE DOWN;So;0;ON;;;;;N;;break;;;
+238B;BROKEN CIRCLE WITH NORTHWEST ARROW;So;0;ON;;;;;N;;escape;;;
+238C;UNDO SYMBOL;So;0;ON;;;;;N;;;;;
+238D;MONOSTABLE SYMBOL;So;0;ON;;;;;N;;;;;
+238E;HYSTERESIS SYMBOL;So;0;ON;;;;;N;;;;;
+238F;OPEN-CIRCUIT-OUTPUT H-TYPE SYMBOL;So;0;ON;;;;;N;;;;;
+2390;OPEN-CIRCUIT-OUTPUT L-TYPE SYMBOL;So;0;ON;;;;;N;;;;;
+2391;PASSIVE-PULL-DOWN-OUTPUT SYMBOL;So;0;ON;;;;;N;;;;;
+2392;PASSIVE-PULL-UP-OUTPUT SYMBOL;So;0;ON;;;;;N;;;;;
+2393;DIRECT CURRENT SYMBOL FORM TWO;So;0;ON;;;;;N;;;;;
+2394;SOFTWARE-FUNCTION SYMBOL;So;0;ON;;;;;N;;;;;
+2395;APL FUNCTIONAL SYMBOL QUAD;So;0;L;;;;;N;;;;;
+2396;DECIMAL SEPARATOR KEY SYMBOL;So;0;ON;;;;;N;;;;;
+2397;PREVIOUS PAGE;So;0;ON;;;;;N;;;;;
+2398;NEXT PAGE;So;0;ON;;;;;N;;;;;
+2399;PRINT SCREEN SYMBOL;So;0;ON;;;;;N;;;;;
+239A;CLEAR SCREEN SYMBOL;So;0;ON;;;;;N;;;;;
+239B;LEFT PARENTHESIS UPPER HOOK;Sm;0;ON;;;;;N;;;;;
+239C;LEFT PARENTHESIS EXTENSION;Sm;0;ON;;;;;N;;;;;
+239D;LEFT PARENTHESIS LOWER HOOK;Sm;0;ON;;;;;N;;;;;
+239E;RIGHT PARENTHESIS UPPER HOOK;Sm;0;ON;;;;;N;;;;;
+239F;RIGHT PARENTHESIS EXTENSION;Sm;0;ON;;;;;N;;;;;
+23A0;RIGHT PARENTHESIS LOWER HOOK;Sm;0;ON;;;;;N;;;;;
+23A1;LEFT SQUARE BRACKET UPPER CORNER;Sm;0;ON;;;;;N;;;;;
+23A2;LEFT SQUARE BRACKET EXTENSION;Sm;0;ON;;;;;N;;;;;
+23A3;LEFT SQUARE BRACKET LOWER CORNER;Sm;0;ON;;;;;N;;;;;
+23A4;RIGHT SQUARE BRACKET UPPER CORNER;Sm;0;ON;;;;;N;;;;;
+23A5;RIGHT SQUARE BRACKET EXTENSION;Sm;0;ON;;;;;N;;;;;
+23A6;RIGHT SQUARE BRACKET LOWER CORNER;Sm;0;ON;;;;;N;;;;;
+23A7;LEFT CURLY BRACKET UPPER HOOK;Sm;0;ON;;;;;N;;;;;
+23A8;LEFT CURLY BRACKET MIDDLE PIECE;Sm;0;ON;;;;;N;;;;;
+23A9;LEFT CURLY BRACKET LOWER HOOK;Sm;0;ON;;;;;N;;;;;
+23AA;CURLY BRACKET EXTENSION;Sm;0;ON;;;;;N;;;;;
+23AB;RIGHT CURLY BRACKET UPPER HOOK;Sm;0;ON;;;;;N;;;;;
+23AC;RIGHT CURLY BRACKET MIDDLE PIECE;Sm;0;ON;;;;;N;;;;;
+23AD;RIGHT CURLY BRACKET LOWER HOOK;Sm;0;ON;;;;;N;;;;;
+23AE;INTEGRAL EXTENSION;Sm;0;ON;;;;;N;;;;;
+23AF;HORIZONTAL LINE EXTENSION;Sm;0;ON;;;;;N;;;;;
+23B0;UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION;Sm;0;ON;;;;;N;;;;;
+23B1;UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION;Sm;0;ON;;;;;N;;;;;
+23B2;SUMMATION TOP;Sm;0;ON;;;;;N;;;;;
+23B3;SUMMATION BOTTOM;Sm;0;ON;;;;;N;;;;;
+23B4;TOP SQUARE BRACKET;So;0;ON;;;;;N;;;;;
+23B5;BOTTOM SQUARE BRACKET;So;0;ON;;;;;N;;;;;
+23B6;BOTTOM SQUARE BRACKET OVER TOP SQUARE BRACKET;So;0;ON;;;;;N;;;;;
+23B7;RADICAL SYMBOL BOTTOM;So;0;ON;;;;;N;;;;;
+23B8;LEFT VERTICAL BOX LINE;So;0;ON;;;;;N;;;;;
+23B9;RIGHT VERTICAL BOX LINE;So;0;ON;;;;;N;;;;;
+23BA;HORIZONTAL SCAN LINE-1;So;0;ON;;;;;N;;;;;
+23BB;HORIZONTAL SCAN LINE-3;So;0;ON;;;;;N;;;;;
+23BC;HORIZONTAL SCAN LINE-7;So;0;ON;;;;;N;;;;;
+23BD;HORIZONTAL SCAN LINE-9;So;0;ON;;;;;N;;;;;
+23BE;DENTISTRY SYMBOL LIGHT VERTICAL AND TOP RIGHT;So;0;ON;;;;;N;;;;;
+23BF;DENTISTRY SYMBOL LIGHT VERTICAL AND BOTTOM RIGHT;So;0;ON;;;;;N;;;;;
+23C0;DENTISTRY SYMBOL LIGHT VERTICAL WITH CIRCLE;So;0;ON;;;;;N;;;;;
+23C1;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH CIRCLE;So;0;ON;;;;;N;;;;;
+23C2;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH CIRCLE;So;0;ON;;;;;N;;;;;
+23C3;DENTISTRY SYMBOL LIGHT VERTICAL WITH TRIANGLE;So;0;ON;;;;;N;;;;;
+23C4;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH TRIANGLE;So;0;ON;;;;;N;;;;;
+23C5;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH TRIANGLE;So;0;ON;;;;;N;;;;;
+23C6;DENTISTRY SYMBOL LIGHT VERTICAL AND WAVE;So;0;ON;;;;;N;;;;;
+23C7;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH WAVE;So;0;ON;;;;;N;;;;;
+23C8;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH WAVE;So;0;ON;;;;;N;;;;;
+23C9;DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL;So;0;ON;;;;;N;;;;;
+23CA;DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL;So;0;ON;;;;;N;;;;;
+23CB;DENTISTRY SYMBOL LIGHT VERTICAL AND TOP LEFT;So;0;ON;;;;;N;;;;;
+23CC;DENTISTRY SYMBOL LIGHT VERTICAL AND BOTTOM LEFT;So;0;ON;;;;;N;;;;;
+23CD;SQUARE FOOT;So;0;ON;;;;;N;;;;;
+23CE;RETURN SYMBOL;So;0;ON;;;;;N;;;;;
+23CF;EJECT SYMBOL;So;0;ON;;;;;N;;;;;
+23D0;VERTICAL LINE EXTENSION;So;0;ON;;;;;N;;;;;
+23D1;METRICAL BREVE;So;0;ON;;;;;N;;;;;
+23D2;METRICAL LONG OVER SHORT;So;0;ON;;;;;N;;;;;
+23D3;METRICAL SHORT OVER LONG;So;0;ON;;;;;N;;;;;
+23D4;METRICAL LONG OVER TWO SHORTS;So;0;ON;;;;;N;;;;;
+23D5;METRICAL TWO SHORTS OVER LONG;So;0;ON;;;;;N;;;;;
+23D6;METRICAL TWO SHORTS JOINED;So;0;ON;;;;;N;;;;;
+23D7;METRICAL TRISEME;So;0;ON;;;;;N;;;;;
+23D8;METRICAL TETRASEME;So;0;ON;;;;;N;;;;;
+23D9;METRICAL PENTASEME;So;0;ON;;;;;N;;;;;
+23DA;EARTH GROUND;So;0;ON;;;;;N;;;;;
+23DB;FUSE;So;0;ON;;;;;N;;;;;
+23DC;TOP PARENTHESIS;Sm;0;ON;;;;;N;;mathematical use;;;
+23DD;BOTTOM PARENTHESIS;Sm;0;ON;;;;;N;;mathematical use;;;
+23DE;TOP CURLY BRACKET;Sm;0;ON;;;;;N;;mathematical use;;;
+23DF;BOTTOM CURLY BRACKET;Sm;0;ON;;;;;N;;mathematical use;;;
+23E0;TOP TORTOISE SHELL BRACKET;Sm;0;ON;;;;;N;;mathematical use;;;
+23E1;BOTTOM TORTOISE SHELL BRACKET;Sm;0;ON;;;;;N;;mathematical use;;;
+23E2;WHITE TRAPEZIUM;So;0;ON;;;;;N;;;;;
+23E3;BENZENE RING WITH CIRCLE;So;0;ON;;;;;N;;;;;
+23E4;STRAIGHTNESS;So;0;ON;;;;;N;;;;;
+23E5;FLATNESS;So;0;ON;;;;;N;;;;;
+23E6;AC CURRENT;So;0;ON;;;;;N;;;;;
+23E7;ELECTRICAL INTERSECTION;So;0;ON;;;;;N;;;;;
+2400;SYMBOL FOR NULL;So;0;ON;;;;;N;GRAPHIC FOR NULL;;;;
+2401;SYMBOL FOR START OF HEADING;So;0;ON;;;;;N;GRAPHIC FOR START OF HEADING;;;;
+2402;SYMBOL FOR START OF TEXT;So;0;ON;;;;;N;GRAPHIC FOR START OF TEXT;;;;
+2403;SYMBOL FOR END OF TEXT;So;0;ON;;;;;N;GRAPHIC FOR END OF TEXT;;;;
+2404;SYMBOL FOR END OF TRANSMISSION;So;0;ON;;;;;N;GRAPHIC FOR END OF TRANSMISSION;;;;
+2405;SYMBOL FOR ENQUIRY;So;0;ON;;;;;N;GRAPHIC FOR ENQUIRY;;;;
+2406;SYMBOL FOR ACKNOWLEDGE;So;0;ON;;;;;N;GRAPHIC FOR ACKNOWLEDGE;;;;
+2407;SYMBOL FOR BELL;So;0;ON;;;;;N;GRAPHIC FOR BELL;;;;
+2408;SYMBOL FOR BACKSPACE;So;0;ON;;;;;N;GRAPHIC FOR BACKSPACE;;;;
+2409;SYMBOL FOR HORIZONTAL TABULATION;So;0;ON;;;;;N;GRAPHIC FOR HORIZONTAL TABULATION;;;;
+240A;SYMBOL FOR LINE FEED;So;0;ON;;;;;N;GRAPHIC FOR LINE FEED;;;;
+240B;SYMBOL FOR VERTICAL TABULATION;So;0;ON;;;;;N;GRAPHIC FOR VERTICAL TABULATION;;;;
+240C;SYMBOL FOR FORM FEED;So;0;ON;;;;;N;GRAPHIC FOR FORM FEED;;;;
+240D;SYMBOL FOR CARRIAGE RETURN;So;0;ON;;;;;N;GRAPHIC FOR CARRIAGE RETURN;;;;
+240E;SYMBOL FOR SHIFT OUT;So;0;ON;;;;;N;GRAPHIC FOR SHIFT OUT;;;;
+240F;SYMBOL FOR SHIFT IN;So;0;ON;;;;;N;GRAPHIC FOR SHIFT IN;;;;
+2410;SYMBOL FOR DATA LINK ESCAPE;So;0;ON;;;;;N;GRAPHIC FOR DATA LINK ESCAPE;;;;
+2411;SYMBOL FOR DEVICE CONTROL ONE;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL ONE;;;;
+2412;SYMBOL FOR DEVICE CONTROL TWO;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL TWO;;;;
+2413;SYMBOL FOR DEVICE CONTROL THREE;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL THREE;;;;
+2414;SYMBOL FOR DEVICE CONTROL FOUR;So;0;ON;;;;;N;GRAPHIC FOR DEVICE CONTROL FOUR;;;;
+2415;SYMBOL FOR NEGATIVE ACKNOWLEDGE;So;0;ON;;;;;N;GRAPHIC FOR NEGATIVE ACKNOWLEDGE;;;;
+2416;SYMBOL FOR SYNCHRONOUS IDLE;So;0;ON;;;;;N;GRAPHIC FOR SYNCHRONOUS IDLE;;;;
+2417;SYMBOL FOR END OF TRANSMISSION BLOCK;So;0;ON;;;;;N;GRAPHIC FOR END OF TRANSMISSION BLOCK;;;;
+2418;SYMBOL FOR CANCEL;So;0;ON;;;;;N;GRAPHIC FOR CANCEL;;;;
+2419;SYMBOL FOR END OF MEDIUM;So;0;ON;;;;;N;GRAPHIC FOR END OF MEDIUM;;;;
+241A;SYMBOL FOR SUBSTITUTE;So;0;ON;;;;;N;GRAPHIC FOR SUBSTITUTE;;;;
+241B;SYMBOL FOR ESCAPE;So;0;ON;;;;;N;GRAPHIC FOR ESCAPE;;;;
+241C;SYMBOL FOR FILE SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR FILE SEPARATOR;;;;
+241D;SYMBOL FOR GROUP SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR GROUP SEPARATOR;;;;
+241E;SYMBOL FOR RECORD SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR RECORD SEPARATOR;;;;
+241F;SYMBOL FOR UNIT SEPARATOR;So;0;ON;;;;;N;GRAPHIC FOR UNIT SEPARATOR;;;;
+2420;SYMBOL FOR SPACE;So;0;ON;;;;;N;GRAPHIC FOR SPACE;;;;
+2421;SYMBOL FOR DELETE;So;0;ON;;;;;N;GRAPHIC FOR DELETE;;;;
+2422;BLANK SYMBOL;So;0;ON;;;;;N;BLANK;;;;
+2423;OPEN BOX;So;0;ON;;;;;N;;;;;
+2424;SYMBOL FOR NEWLINE;So;0;ON;;;;;N;GRAPHIC FOR NEWLINE;;;;
+2425;SYMBOL FOR DELETE FORM TWO;So;0;ON;;;;;N;;;;;
+2426;SYMBOL FOR SUBSTITUTE FORM TWO;So;0;ON;;;;;N;;;;;
+2440;OCR HOOK;So;0;ON;;;;;N;;;;;
+2441;OCR CHAIR;So;0;ON;;;;;N;;;;;
+2442;OCR FORK;So;0;ON;;;;;N;;;;;
+2443;OCR INVERTED FORK;So;0;ON;;;;;N;;;;;
+2444;OCR BELT BUCKLE;So;0;ON;;;;;N;;;;;
+2445;OCR BOW TIE;So;0;ON;;;;;N;;;;;
+2446;OCR BRANCH BANK IDENTIFICATION;So;0;ON;;;;;N;;;;;
+2447;OCR AMOUNT OF CHECK;So;0;ON;;;;;N;;;;;
+2448;OCR DASH;So;0;ON;;;;;N;;;;;
+2449;OCR CUSTOMER ACCOUNT NUMBER;So;0;ON;;;;;N;;;;;
+244A;OCR DOUBLE BACKSLASH;So;0;ON;;;;;N;;;;;
+2460;CIRCLED DIGIT ONE;No;0;ON;<circle> 0031;;1;1;N;;;;;
+2461;CIRCLED DIGIT TWO;No;0;ON;<circle> 0032;;2;2;N;;;;;
+2462;CIRCLED DIGIT THREE;No;0;ON;<circle> 0033;;3;3;N;;;;;
+2463;CIRCLED DIGIT FOUR;No;0;ON;<circle> 0034;;4;4;N;;;;;
+2464;CIRCLED DIGIT FIVE;No;0;ON;<circle> 0035;;5;5;N;;;;;
+2465;CIRCLED DIGIT SIX;No;0;ON;<circle> 0036;;6;6;N;;;;;
+2466;CIRCLED DIGIT SEVEN;No;0;ON;<circle> 0037;;7;7;N;;;;;
+2467;CIRCLED DIGIT EIGHT;No;0;ON;<circle> 0038;;8;8;N;;;;;
+2468;CIRCLED DIGIT NINE;No;0;ON;<circle> 0039;;9;9;N;;;;;
+2469;CIRCLED NUMBER TEN;No;0;ON;<circle> 0031 0030;;;10;N;;;;;
+246A;CIRCLED NUMBER ELEVEN;No;0;ON;<circle> 0031 0031;;;11;N;;;;;
+246B;CIRCLED NUMBER TWELVE;No;0;ON;<circle> 0031 0032;;;12;N;;;;;
+246C;CIRCLED NUMBER THIRTEEN;No;0;ON;<circle> 0031 0033;;;13;N;;;;;
+246D;CIRCLED NUMBER FOURTEEN;No;0;ON;<circle> 0031 0034;;;14;N;;;;;
+246E;CIRCLED NUMBER FIFTEEN;No;0;ON;<circle> 0031 0035;;;15;N;;;;;
+246F;CIRCLED NUMBER SIXTEEN;No;0;ON;<circle> 0031 0036;;;16;N;;;;;
+2470;CIRCLED NUMBER SEVENTEEN;No;0;ON;<circle> 0031 0037;;;17;N;;;;;
+2471;CIRCLED NUMBER EIGHTEEN;No;0;ON;<circle> 0031 0038;;;18;N;;;;;
+2472;CIRCLED NUMBER NINETEEN;No;0;ON;<circle> 0031 0039;;;19;N;;;;;
+2473;CIRCLED NUMBER TWENTY;No;0;ON;<circle> 0032 0030;;;20;N;;;;;
+2474;PARENTHESIZED DIGIT ONE;No;0;ON;<compat> 0028 0031 0029;;1;1;N;;;;;
+2475;PARENTHESIZED DIGIT TWO;No;0;ON;<compat> 0028 0032 0029;;2;2;N;;;;;
+2476;PARENTHESIZED DIGIT THREE;No;0;ON;<compat> 0028 0033 0029;;3;3;N;;;;;
+2477;PARENTHESIZED DIGIT FOUR;No;0;ON;<compat> 0028 0034 0029;;4;4;N;;;;;
+2478;PARENTHESIZED DIGIT FIVE;No;0;ON;<compat> 0028 0035 0029;;5;5;N;;;;;
+2479;PARENTHESIZED DIGIT SIX;No;0;ON;<compat> 0028 0036 0029;;6;6;N;;;;;
+247A;PARENTHESIZED DIGIT SEVEN;No;0;ON;<compat> 0028 0037 0029;;7;7;N;;;;;
+247B;PARENTHESIZED DIGIT EIGHT;No;0;ON;<compat> 0028 0038 0029;;8;8;N;;;;;
+247C;PARENTHESIZED DIGIT NINE;No;0;ON;<compat> 0028 0039 0029;;9;9;N;;;;;
+247D;PARENTHESIZED NUMBER TEN;No;0;ON;<compat> 0028 0031 0030 0029;;;10;N;;;;;
+247E;PARENTHESIZED NUMBER ELEVEN;No;0;ON;<compat> 0028 0031 0031 0029;;;11;N;;;;;
+247F;PARENTHESIZED NUMBER TWELVE;No;0;ON;<compat> 0028 0031 0032 0029;;;12;N;;;;;
+2480;PARENTHESIZED NUMBER THIRTEEN;No;0;ON;<compat> 0028 0031 0033 0029;;;13;N;;;;;
+2481;PARENTHESIZED NUMBER FOURTEEN;No;0;ON;<compat> 0028 0031 0034 0029;;;14;N;;;;;
+2482;PARENTHESIZED NUMBER FIFTEEN;No;0;ON;<compat> 0028 0031 0035 0029;;;15;N;;;;;
+2483;PARENTHESIZED NUMBER SIXTEEN;No;0;ON;<compat> 0028 0031 0036 0029;;;16;N;;;;;
+2484;PARENTHESIZED NUMBER SEVENTEEN;No;0;ON;<compat> 0028 0031 0037 0029;;;17;N;;;;;
+2485;PARENTHESIZED NUMBER EIGHTEEN;No;0;ON;<compat> 0028 0031 0038 0029;;;18;N;;;;;
+2486;PARENTHESIZED NUMBER NINETEEN;No;0;ON;<compat> 0028 0031 0039 0029;;;19;N;;;;;
+2487;PARENTHESIZED NUMBER TWENTY;No;0;ON;<compat> 0028 0032 0030 0029;;;20;N;;;;;
+2488;DIGIT ONE FULL STOP;No;0;EN;<compat> 0031 002E;;1;1;N;DIGIT ONE PERIOD;;;;
+2489;DIGIT TWO FULL STOP;No;0;EN;<compat> 0032 002E;;2;2;N;DIGIT TWO PERIOD;;;;
+248A;DIGIT THREE FULL STOP;No;0;EN;<compat> 0033 002E;;3;3;N;DIGIT THREE PERIOD;;;;
+248B;DIGIT FOUR FULL STOP;No;0;EN;<compat> 0034 002E;;4;4;N;DIGIT FOUR PERIOD;;;;
+248C;DIGIT FIVE FULL STOP;No;0;EN;<compat> 0035 002E;;5;5;N;DIGIT FIVE PERIOD;;;;
+248D;DIGIT SIX FULL STOP;No;0;EN;<compat> 0036 002E;;6;6;N;DIGIT SIX PERIOD;;;;
+248E;DIGIT SEVEN FULL STOP;No;0;EN;<compat> 0037 002E;;7;7;N;DIGIT SEVEN PERIOD;;;;
+248F;DIGIT EIGHT FULL STOP;No;0;EN;<compat> 0038 002E;;8;8;N;DIGIT EIGHT PERIOD;;;;
+2490;DIGIT NINE FULL STOP;No;0;EN;<compat> 0039 002E;;9;9;N;DIGIT NINE PERIOD;;;;
+2491;NUMBER TEN FULL STOP;No;0;EN;<compat> 0031 0030 002E;;;10;N;NUMBER TEN PERIOD;;;;
+2492;NUMBER ELEVEN FULL STOP;No;0;EN;<compat> 0031 0031 002E;;;11;N;NUMBER ELEVEN PERIOD;;;;
+2493;NUMBER TWELVE FULL STOP;No;0;EN;<compat> 0031 0032 002E;;;12;N;NUMBER TWELVE PERIOD;;;;
+2494;NUMBER THIRTEEN FULL STOP;No;0;EN;<compat> 0031 0033 002E;;;13;N;NUMBER THIRTEEN PERIOD;;;;
+2495;NUMBER FOURTEEN FULL STOP;No;0;EN;<compat> 0031 0034 002E;;;14;N;NUMBER FOURTEEN PERIOD;;;;
+2496;NUMBER FIFTEEN FULL STOP;No;0;EN;<compat> 0031 0035 002E;;;15;N;NUMBER FIFTEEN PERIOD;;;;
+2497;NUMBER SIXTEEN FULL STOP;No;0;EN;<compat> 0031 0036 002E;;;16;N;NUMBER SIXTEEN PERIOD;;;;
+2498;NUMBER SEVENTEEN FULL STOP;No;0;EN;<compat> 0031 0037 002E;;;17;N;NUMBER SEVENTEEN PERIOD;;;;
+2499;NUMBER EIGHTEEN FULL STOP;No;0;EN;<compat> 0031 0038 002E;;;18;N;NUMBER EIGHTEEN PERIOD;;;;
+249A;NUMBER NINETEEN FULL STOP;No;0;EN;<compat> 0031 0039 002E;;;19;N;NUMBER NINETEEN PERIOD;;;;
+249B;NUMBER TWENTY FULL STOP;No;0;EN;<compat> 0032 0030 002E;;;20;N;NUMBER TWENTY PERIOD;;;;
+249C;PARENTHESIZED LATIN SMALL LETTER A;So;0;L;<compat> 0028 0061 0029;;;;N;;;;;
+249D;PARENTHESIZED LATIN SMALL LETTER B;So;0;L;<compat> 0028 0062 0029;;;;N;;;;;
+249E;PARENTHESIZED LATIN SMALL LETTER C;So;0;L;<compat> 0028 0063 0029;;;;N;;;;;
+249F;PARENTHESIZED LATIN SMALL LETTER D;So;0;L;<compat> 0028 0064 0029;;;;N;;;;;
+24A0;PARENTHESIZED LATIN SMALL LETTER E;So;0;L;<compat> 0028 0065 0029;;;;N;;;;;
+24A1;PARENTHESIZED LATIN SMALL LETTER F;So;0;L;<compat> 0028 0066 0029;;;;N;;;;;
+24A2;PARENTHESIZED LATIN SMALL LETTER G;So;0;L;<compat> 0028 0067 0029;;;;N;;;;;
+24A3;PARENTHESIZED LATIN SMALL LETTER H;So;0;L;<compat> 0028 0068 0029;;;;N;;;;;
+24A4;PARENTHESIZED LATIN SMALL LETTER I;So;0;L;<compat> 0028 0069 0029;;;;N;;;;;
+24A5;PARENTHESIZED LATIN SMALL LETTER J;So;0;L;<compat> 0028 006A 0029;;;;N;;;;;
+24A6;PARENTHESIZED LATIN SMALL LETTER K;So;0;L;<compat> 0028 006B 0029;;;;N;;;;;
+24A7;PARENTHESIZED LATIN SMALL LETTER L;So;0;L;<compat> 0028 006C 0029;;;;N;;;;;
+24A8;PARENTHESIZED LATIN SMALL LETTER M;So;0;L;<compat> 0028 006D 0029;;;;N;;;;;
+24A9;PARENTHESIZED LATIN SMALL LETTER N;So;0;L;<compat> 0028 006E 0029;;;;N;;;;;
+24AA;PARENTHESIZED LATIN SMALL LETTER O;So;0;L;<compat> 0028 006F 0029;;;;N;;;;;
+24AB;PARENTHESIZED LATIN SMALL LETTER P;So;0;L;<compat> 0028 0070 0029;;;;N;;;;;
+24AC;PARENTHESIZED LATIN SMALL LETTER Q;So;0;L;<compat> 0028 0071 0029;;;;N;;;;;
+24AD;PARENTHESIZED LATIN SMALL LETTER R;So;0;L;<compat> 0028 0072 0029;;;;N;;;;;
+24AE;PARENTHESIZED LATIN SMALL LETTER S;So;0;L;<compat> 0028 0073 0029;;;;N;;;;;
+24AF;PARENTHESIZED LATIN SMALL LETTER T;So;0;L;<compat> 0028 0074 0029;;;;N;;;;;
+24B0;PARENTHESIZED LATIN SMALL LETTER U;So;0;L;<compat> 0028 0075 0029;;;;N;;;;;
+24B1;PARENTHESIZED LATIN SMALL LETTER V;So;0;L;<compat> 0028 0076 0029;;;;N;;;;;
+24B2;PARENTHESIZED LATIN SMALL LETTER W;So;0;L;<compat> 0028 0077 0029;;;;N;;;;;
+24B3;PARENTHESIZED LATIN SMALL LETTER X;So;0;L;<compat> 0028 0078 0029;;;;N;;;;;
+24B4;PARENTHESIZED LATIN SMALL LETTER Y;So;0;L;<compat> 0028 0079 0029;;;;N;;;;;
+24B5;PARENTHESIZED LATIN SMALL LETTER Z;So;0;L;<compat> 0028 007A 0029;;;;N;;;;;
+24B6;CIRCLED LATIN CAPITAL LETTER A;So;0;L;<circle> 0041;;;;N;;;;24D0;
+24B7;CIRCLED LATIN CAPITAL LETTER B;So;0;L;<circle> 0042;;;;N;;;;24D1;
+24B8;CIRCLED LATIN CAPITAL LETTER C;So;0;L;<circle> 0043;;;;N;;;;24D2;
+24B9;CIRCLED LATIN CAPITAL LETTER D;So;0;L;<circle> 0044;;;;N;;;;24D3;
+24BA;CIRCLED LATIN CAPITAL LETTER E;So;0;L;<circle> 0045;;;;N;;;;24D4;
+24BB;CIRCLED LATIN CAPITAL LETTER F;So;0;L;<circle> 0046;;;;N;;;;24D5;
+24BC;CIRCLED LATIN CAPITAL LETTER G;So;0;L;<circle> 0047;;;;N;;;;24D6;
+24BD;CIRCLED LATIN CAPITAL LETTER H;So;0;L;<circle> 0048;;;;N;;;;24D7;
+24BE;CIRCLED LATIN CAPITAL LETTER I;So;0;L;<circle> 0049;;;;N;;;;24D8;
+24BF;CIRCLED LATIN CAPITAL LETTER J;So;0;L;<circle> 004A;;;;N;;;;24D9;
+24C0;CIRCLED LATIN CAPITAL LETTER K;So;0;L;<circle> 004B;;;;N;;;;24DA;
+24C1;CIRCLED LATIN CAPITAL LETTER L;So;0;L;<circle> 004C;;;;N;;;;24DB;
+24C2;CIRCLED LATIN CAPITAL LETTER M;So;0;L;<circle> 004D;;;;N;;;;24DC;
+24C3;CIRCLED LATIN CAPITAL LETTER N;So;0;L;<circle> 004E;;;;N;;;;24DD;
+24C4;CIRCLED LATIN CAPITAL LETTER O;So;0;L;<circle> 004F;;;;N;;;;24DE;
+24C5;CIRCLED LATIN CAPITAL LETTER P;So;0;L;<circle> 0050;;;;N;;;;24DF;
+24C6;CIRCLED LATIN CAPITAL LETTER Q;So;0;L;<circle> 0051;;;;N;;;;24E0;
+24C7;CIRCLED LATIN CAPITAL LETTER R;So;0;L;<circle> 0052;;;;N;;;;24E1;
+24C8;CIRCLED LATIN CAPITAL LETTER S;So;0;L;<circle> 0053;;;;N;;;;24E2;
+24C9;CIRCLED LATIN CAPITAL LETTER T;So;0;L;<circle> 0054;;;;N;;;;24E3;
+24CA;CIRCLED LATIN CAPITAL LETTER U;So;0;L;<circle> 0055;;;;N;;;;24E4;
+24CB;CIRCLED LATIN CAPITAL LETTER V;So;0;L;<circle> 0056;;;;N;;;;24E5;
+24CC;CIRCLED LATIN CAPITAL LETTER W;So;0;L;<circle> 0057;;;;N;;;;24E6;
+24CD;CIRCLED LATIN CAPITAL LETTER X;So;0;L;<circle> 0058;;;;N;;;;24E7;
+24CE;CIRCLED LATIN CAPITAL LETTER Y;So;0;L;<circle> 0059;;;;N;;;;24E8;
+24CF;CIRCLED LATIN CAPITAL LETTER Z;So;0;L;<circle> 005A;;;;N;;;;24E9;
+24D0;CIRCLED LATIN SMALL LETTER A;So;0;L;<circle> 0061;;;;N;;;24B6;;24B6
+24D1;CIRCLED LATIN SMALL LETTER B;So;0;L;<circle> 0062;;;;N;;;24B7;;24B7
+24D2;CIRCLED LATIN SMALL LETTER C;So;0;L;<circle> 0063;;;;N;;;24B8;;24B8
+24D3;CIRCLED LATIN SMALL LETTER D;So;0;L;<circle> 0064;;;;N;;;24B9;;24B9
+24D4;CIRCLED LATIN SMALL LETTER E;So;0;L;<circle> 0065;;;;N;;;24BA;;24BA
+24D5;CIRCLED LATIN SMALL LETTER F;So;0;L;<circle> 0066;;;;N;;;24BB;;24BB
+24D6;CIRCLED LATIN SMALL LETTER G;So;0;L;<circle> 0067;;;;N;;;24BC;;24BC
+24D7;CIRCLED LATIN SMALL LETTER H;So;0;L;<circle> 0068;;;;N;;;24BD;;24BD
+24D8;CIRCLED LATIN SMALL LETTER I;So;0;L;<circle> 0069;;;;N;;;24BE;;24BE
+24D9;CIRCLED LATIN SMALL LETTER J;So;0;L;<circle> 006A;;;;N;;;24BF;;24BF
+24DA;CIRCLED LATIN SMALL LETTER K;So;0;L;<circle> 006B;;;;N;;;24C0;;24C0
+24DB;CIRCLED LATIN SMALL LETTER L;So;0;L;<circle> 006C;;;;N;;;24C1;;24C1
+24DC;CIRCLED LATIN SMALL LETTER M;So;0;L;<circle> 006D;;;;N;;;24C2;;24C2
+24DD;CIRCLED LATIN SMALL LETTER N;So;0;L;<circle> 006E;;;;N;;;24C3;;24C3
+24DE;CIRCLED LATIN SMALL LETTER O;So;0;L;<circle> 006F;;;;N;;;24C4;;24C4
+24DF;CIRCLED LATIN SMALL LETTER P;So;0;L;<circle> 0070;;;;N;;;24C5;;24C5
+24E0;CIRCLED LATIN SMALL LETTER Q;So;0;L;<circle> 0071;;;;N;;;24C6;;24C6
+24E1;CIRCLED LATIN SMALL LETTER R;So;0;L;<circle> 0072;;;;N;;;24C7;;24C7
+24E2;CIRCLED LATIN SMALL LETTER S;So;0;L;<circle> 0073;;;;N;;;24C8;;24C8
+24E3;CIRCLED LATIN SMALL LETTER T;So;0;L;<circle> 0074;;;;N;;;24C9;;24C9
+24E4;CIRCLED LATIN SMALL LETTER U;So;0;L;<circle> 0075;;;;N;;;24CA;;24CA
+24E5;CIRCLED LATIN SMALL LETTER V;So;0;L;<circle> 0076;;;;N;;;24CB;;24CB
+24E6;CIRCLED LATIN SMALL LETTER W;So;0;L;<circle> 0077;;;;N;;;24CC;;24CC
+24E7;CIRCLED LATIN SMALL LETTER X;So;0;L;<circle> 0078;;;;N;;;24CD;;24CD
+24E8;CIRCLED LATIN SMALL LETTER Y;So;0;L;<circle> 0079;;;;N;;;24CE;;24CE
+24E9;CIRCLED LATIN SMALL LETTER Z;So;0;L;<circle> 007A;;;;N;;;24CF;;24CF
+24EA;CIRCLED DIGIT ZERO;No;0;ON;<circle> 0030;;0;0;N;;;;;
+24EB;NEGATIVE CIRCLED NUMBER ELEVEN;No;0;ON;;;;11;N;;;;;
+24EC;NEGATIVE CIRCLED NUMBER TWELVE;No;0;ON;;;;12;N;;;;;
+24ED;NEGATIVE CIRCLED NUMBER THIRTEEN;No;0;ON;;;;13;N;;;;;
+24EE;NEGATIVE CIRCLED NUMBER FOURTEEN;No;0;ON;;;;14;N;;;;;
+24EF;NEGATIVE CIRCLED NUMBER FIFTEEN;No;0;ON;;;;15;N;;;;;
+24F0;NEGATIVE CIRCLED NUMBER SIXTEEN;No;0;ON;;;;16;N;;;;;
+24F1;NEGATIVE CIRCLED NUMBER SEVENTEEN;No;0;ON;;;;17;N;;;;;
+24F2;NEGATIVE CIRCLED NUMBER EIGHTEEN;No;0;ON;;;;18;N;;;;;
+24F3;NEGATIVE CIRCLED NUMBER NINETEEN;No;0;ON;;;;19;N;;;;;
+24F4;NEGATIVE CIRCLED NUMBER TWENTY;No;0;ON;;;;20;N;;;;;
+24F5;DOUBLE CIRCLED DIGIT ONE;No;0;ON;;;1;1;N;;;;;
+24F6;DOUBLE CIRCLED DIGIT TWO;No;0;ON;;;2;2;N;;;;;
+24F7;DOUBLE CIRCLED DIGIT THREE;No;0;ON;;;3;3;N;;;;;
+24F8;DOUBLE CIRCLED DIGIT FOUR;No;0;ON;;;4;4;N;;;;;
+24F9;DOUBLE CIRCLED DIGIT FIVE;No;0;ON;;;5;5;N;;;;;
+24FA;DOUBLE CIRCLED DIGIT SIX;No;0;ON;;;6;6;N;;;;;
+24FB;DOUBLE CIRCLED DIGIT SEVEN;No;0;ON;;;7;7;N;;;;;
+24FC;DOUBLE CIRCLED DIGIT EIGHT;No;0;ON;;;8;8;N;;;;;
+24FD;DOUBLE CIRCLED DIGIT NINE;No;0;ON;;;9;9;N;;;;;
+24FE;DOUBLE CIRCLED NUMBER TEN;No;0;ON;;;;10;N;;;;;
+24FF;NEGATIVE CIRCLED DIGIT ZERO;No;0;ON;;;0;0;N;;;;;
+2500;BOX DRAWINGS LIGHT HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT HORIZONTAL;;;;
+2501;BOX DRAWINGS HEAVY HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY HORIZONTAL;;;;
+2502;BOX DRAWINGS LIGHT VERTICAL;So;0;ON;;;;;N;FORMS LIGHT VERTICAL;;;;
+2503;BOX DRAWINGS HEAVY VERTICAL;So;0;ON;;;;;N;FORMS HEAVY VERTICAL;;;;
+2504;BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT TRIPLE DASH HORIZONTAL;;;;
+2505;BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY TRIPLE DASH HORIZONTAL;;;;
+2506;BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS LIGHT TRIPLE DASH VERTICAL;;;;
+2507;BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS HEAVY TRIPLE DASH VERTICAL;;;;
+2508;BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT QUADRUPLE DASH HORIZONTAL;;;;
+2509;BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY QUADRUPLE DASH HORIZONTAL;;;;
+250A;BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS LIGHT QUADRUPLE DASH VERTICAL;;;;
+250B;BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL;So;0;ON;;;;;N;FORMS HEAVY QUADRUPLE DASH VERTICAL;;;;
+250C;BOX DRAWINGS LIGHT DOWN AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT DOWN AND RIGHT;;;;
+250D;BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND RIGHT HEAVY;;;;
+250E;BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND RIGHT LIGHT;;;;
+250F;BOX DRAWINGS HEAVY DOWN AND RIGHT;So;0;ON;;;;;N;FORMS HEAVY DOWN AND RIGHT;;;;
+2510;BOX DRAWINGS LIGHT DOWN AND LEFT;So;0;ON;;;;;N;FORMS LIGHT DOWN AND LEFT;;;;
+2511;BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND LEFT HEAVY;;;;
+2512;BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND LEFT LIGHT;;;;
+2513;BOX DRAWINGS HEAVY DOWN AND LEFT;So;0;ON;;;;;N;FORMS HEAVY DOWN AND LEFT;;;;
+2514;BOX DRAWINGS LIGHT UP AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT UP AND RIGHT;;;;
+2515;BOX DRAWINGS UP LIGHT AND RIGHT HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND RIGHT HEAVY;;;;
+2516;BOX DRAWINGS UP HEAVY AND RIGHT LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND RIGHT LIGHT;;;;
+2517;BOX DRAWINGS HEAVY UP AND RIGHT;So;0;ON;;;;;N;FORMS HEAVY UP AND RIGHT;;;;
+2518;BOX DRAWINGS LIGHT UP AND LEFT;So;0;ON;;;;;N;FORMS LIGHT UP AND LEFT;;;;
+2519;BOX DRAWINGS UP LIGHT AND LEFT HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND LEFT HEAVY;;;;
+251A;BOX DRAWINGS UP HEAVY AND LEFT LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND LEFT LIGHT;;;;
+251B;BOX DRAWINGS HEAVY UP AND LEFT;So;0;ON;;;;;N;FORMS HEAVY UP AND LEFT;;;;
+251C;BOX DRAWINGS LIGHT VERTICAL AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT VERTICAL AND RIGHT;;;;
+251D;BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY;So;0;ON;;;;;N;FORMS VERTICAL LIGHT AND RIGHT HEAVY;;;;
+251E;BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND RIGHT DOWN LIGHT;;;;
+251F;BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND RIGHT UP LIGHT;;;;
+2520;BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT;So;0;ON;;;;;N;FORMS VERTICAL HEAVY AND RIGHT LIGHT;;;;
+2521;BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND RIGHT UP HEAVY;;;;
+2522;BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND RIGHT DOWN HEAVY;;;;
+2523;BOX DRAWINGS HEAVY VERTICAL AND RIGHT;So;0;ON;;;;;N;FORMS HEAVY VERTICAL AND RIGHT;;;;
+2524;BOX DRAWINGS LIGHT VERTICAL AND LEFT;So;0;ON;;;;;N;FORMS LIGHT VERTICAL AND LEFT;;;;
+2525;BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY;So;0;ON;;;;;N;FORMS VERTICAL LIGHT AND LEFT HEAVY;;;;
+2526;BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND LEFT DOWN LIGHT;;;;
+2527;BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND LEFT UP LIGHT;;;;
+2528;BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT;So;0;ON;;;;;N;FORMS VERTICAL HEAVY AND LEFT LIGHT;;;;
+2529;BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND LEFT UP HEAVY;;;;
+252A;BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND LEFT DOWN HEAVY;;;;
+252B;BOX DRAWINGS HEAVY VERTICAL AND LEFT;So;0;ON;;;;;N;FORMS HEAVY VERTICAL AND LEFT;;;;
+252C;BOX DRAWINGS LIGHT DOWN AND HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT DOWN AND HORIZONTAL;;;;
+252D;BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT;So;0;ON;;;;;N;FORMS LEFT HEAVY AND RIGHT DOWN LIGHT;;;;
+252E;BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT;So;0;ON;;;;;N;FORMS RIGHT HEAVY AND LEFT DOWN LIGHT;;;;
+252F;BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND HORIZONTAL HEAVY;;;;
+2530;BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND HORIZONTAL LIGHT;;;;
+2531;BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY;So;0;ON;;;;;N;FORMS RIGHT LIGHT AND LEFT DOWN HEAVY;;;;
+2532;BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY;So;0;ON;;;;;N;FORMS LEFT LIGHT AND RIGHT DOWN HEAVY;;;;
+2533;BOX DRAWINGS HEAVY DOWN AND HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY DOWN AND HORIZONTAL;;;;
+2534;BOX DRAWINGS LIGHT UP AND HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT UP AND HORIZONTAL;;;;
+2535;BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT;So;0;ON;;;;;N;FORMS LEFT HEAVY AND RIGHT UP LIGHT;;;;
+2536;BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT;So;0;ON;;;;;N;FORMS RIGHT HEAVY AND LEFT UP LIGHT;;;;
+2537;BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND HORIZONTAL HEAVY;;;;
+2538;BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND HORIZONTAL LIGHT;;;;
+2539;BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY;So;0;ON;;;;;N;FORMS RIGHT LIGHT AND LEFT UP HEAVY;;;;
+253A;BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY;So;0;ON;;;;;N;FORMS LEFT LIGHT AND RIGHT UP HEAVY;;;;
+253B;BOX DRAWINGS HEAVY UP AND HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY UP AND HORIZONTAL;;;;
+253C;BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT VERTICAL AND HORIZONTAL;;;;
+253D;BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT;So;0;ON;;;;;N;FORMS LEFT HEAVY AND RIGHT VERTICAL LIGHT;;;;
+253E;BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT;So;0;ON;;;;;N;FORMS RIGHT HEAVY AND LEFT VERTICAL LIGHT;;;;
+253F;BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS VERTICAL LIGHT AND HORIZONTAL HEAVY;;;;
+2540;BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS UP HEAVY AND DOWN HORIZONTAL LIGHT;;;;
+2541;BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS DOWN HEAVY AND UP HORIZONTAL LIGHT;;;;
+2542;BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT;So;0;ON;;;;;N;FORMS VERTICAL HEAVY AND HORIZONTAL LIGHT;;;;
+2543;BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT;So;0;ON;;;;;N;FORMS LEFT UP HEAVY AND RIGHT DOWN LIGHT;;;;
+2544;BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT;So;0;ON;;;;;N;FORMS RIGHT UP HEAVY AND LEFT DOWN LIGHT;;;;
+2545;BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT;So;0;ON;;;;;N;FORMS LEFT DOWN HEAVY AND RIGHT UP LIGHT;;;;
+2546;BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT;So;0;ON;;;;;N;FORMS RIGHT DOWN HEAVY AND LEFT UP LIGHT;;;;
+2547;BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS DOWN LIGHT AND UP HORIZONTAL HEAVY;;;;
+2548;BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY;So;0;ON;;;;;N;FORMS UP LIGHT AND DOWN HORIZONTAL HEAVY;;;;
+2549;BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY;So;0;ON;;;;;N;FORMS RIGHT LIGHT AND LEFT VERTICAL HEAVY;;;;
+254A;BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY;So;0;ON;;;;;N;FORMS LEFT LIGHT AND RIGHT VERTICAL HEAVY;;;;
+254B;BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY VERTICAL AND HORIZONTAL;;;;
+254C;BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS LIGHT DOUBLE DASH HORIZONTAL;;;;
+254D;BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL;So;0;ON;;;;;N;FORMS HEAVY DOUBLE DASH HORIZONTAL;;;;
+254E;BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL;So;0;ON;;;;;N;FORMS LIGHT DOUBLE DASH VERTICAL;;;;
+254F;BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL;So;0;ON;;;;;N;FORMS HEAVY DOUBLE DASH VERTICAL;;;;
+2550;BOX DRAWINGS DOUBLE HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE HORIZONTAL;;;;
+2551;BOX DRAWINGS DOUBLE VERTICAL;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL;;;;
+2552;BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE;So;0;ON;;;;;N;FORMS DOWN SINGLE AND RIGHT DOUBLE;;;;
+2553;BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE;So;0;ON;;;;;N;FORMS DOWN DOUBLE AND RIGHT SINGLE;;;;
+2554;BOX DRAWINGS DOUBLE DOWN AND RIGHT;So;0;ON;;;;;N;FORMS DOUBLE DOWN AND RIGHT;;;;
+2555;BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE;So;0;ON;;;;;N;FORMS DOWN SINGLE AND LEFT DOUBLE;;;;
+2556;BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE;So;0;ON;;;;;N;FORMS DOWN DOUBLE AND LEFT SINGLE;;;;
+2557;BOX DRAWINGS DOUBLE DOWN AND LEFT;So;0;ON;;;;;N;FORMS DOUBLE DOWN AND LEFT;;;;
+2558;BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE;So;0;ON;;;;;N;FORMS UP SINGLE AND RIGHT DOUBLE;;;;
+2559;BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE;So;0;ON;;;;;N;FORMS UP DOUBLE AND RIGHT SINGLE;;;;
+255A;BOX DRAWINGS DOUBLE UP AND RIGHT;So;0;ON;;;;;N;FORMS DOUBLE UP AND RIGHT;;;;
+255B;BOX DRAWINGS UP SINGLE AND LEFT DOUBLE;So;0;ON;;;;;N;FORMS UP SINGLE AND LEFT DOUBLE;;;;
+255C;BOX DRAWINGS UP DOUBLE AND LEFT SINGLE;So;0;ON;;;;;N;FORMS UP DOUBLE AND LEFT SINGLE;;;;
+255D;BOX DRAWINGS DOUBLE UP AND LEFT;So;0;ON;;;;;N;FORMS DOUBLE UP AND LEFT;;;;
+255E;BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE;So;0;ON;;;;;N;FORMS VERTICAL SINGLE AND RIGHT DOUBLE;;;;
+255F;BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE;So;0;ON;;;;;N;FORMS VERTICAL DOUBLE AND RIGHT SINGLE;;;;
+2560;BOX DRAWINGS DOUBLE VERTICAL AND RIGHT;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL AND RIGHT;;;;
+2561;BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE;So;0;ON;;;;;N;FORMS VERTICAL SINGLE AND LEFT DOUBLE;;;;
+2562;BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE;So;0;ON;;;;;N;FORMS VERTICAL DOUBLE AND LEFT SINGLE;;;;
+2563;BOX DRAWINGS DOUBLE VERTICAL AND LEFT;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL AND LEFT;;;;
+2564;BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE;So;0;ON;;;;;N;FORMS DOWN SINGLE AND HORIZONTAL DOUBLE;;;;
+2565;BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE;So;0;ON;;;;;N;FORMS DOWN DOUBLE AND HORIZONTAL SINGLE;;;;
+2566;BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE DOWN AND HORIZONTAL;;;;
+2567;BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE;So;0;ON;;;;;N;FORMS UP SINGLE AND HORIZONTAL DOUBLE;;;;
+2568;BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE;So;0;ON;;;;;N;FORMS UP DOUBLE AND HORIZONTAL SINGLE;;;;
+2569;BOX DRAWINGS DOUBLE UP AND HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE UP AND HORIZONTAL;;;;
+256A;BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE;So;0;ON;;;;;N;FORMS VERTICAL SINGLE AND HORIZONTAL DOUBLE;;;;
+256B;BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE;So;0;ON;;;;;N;FORMS VERTICAL DOUBLE AND HORIZONTAL SINGLE;;;;
+256C;BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL;So;0;ON;;;;;N;FORMS DOUBLE VERTICAL AND HORIZONTAL;;;;
+256D;BOX DRAWINGS LIGHT ARC DOWN AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT ARC DOWN AND RIGHT;;;;
+256E;BOX DRAWINGS LIGHT ARC DOWN AND LEFT;So;0;ON;;;;;N;FORMS LIGHT ARC DOWN AND LEFT;;;;
+256F;BOX DRAWINGS LIGHT ARC UP AND LEFT;So;0;ON;;;;;N;FORMS LIGHT ARC UP AND LEFT;;;;
+2570;BOX DRAWINGS LIGHT ARC UP AND RIGHT;So;0;ON;;;;;N;FORMS LIGHT ARC UP AND RIGHT;;;;
+2571;BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT;So;0;ON;;;;;N;FORMS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT;;;;
+2572;BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT;So;0;ON;;;;;N;FORMS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT;;;;
+2573;BOX DRAWINGS LIGHT DIAGONAL CROSS;So;0;ON;;;;;N;FORMS LIGHT DIAGONAL CROSS;;;;
+2574;BOX DRAWINGS LIGHT LEFT;So;0;ON;;;;;N;FORMS LIGHT LEFT;;;;
+2575;BOX DRAWINGS LIGHT UP;So;0;ON;;;;;N;FORMS LIGHT UP;;;;
+2576;BOX DRAWINGS LIGHT RIGHT;So;0;ON;;;;;N;FORMS LIGHT RIGHT;;;;
+2577;BOX DRAWINGS LIGHT DOWN;So;0;ON;;;;;N;FORMS LIGHT DOWN;;;;
+2578;BOX DRAWINGS HEAVY LEFT;So;0;ON;;;;;N;FORMS HEAVY LEFT;;;;
+2579;BOX DRAWINGS HEAVY UP;So;0;ON;;;;;N;FORMS HEAVY UP;;;;
+257A;BOX DRAWINGS HEAVY RIGHT;So;0;ON;;;;;N;FORMS HEAVY RIGHT;;;;
+257B;BOX DRAWINGS HEAVY DOWN;So;0;ON;;;;;N;FORMS HEAVY DOWN;;;;
+257C;BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT;So;0;ON;;;;;N;FORMS LIGHT LEFT AND HEAVY RIGHT;;;;
+257D;BOX DRAWINGS LIGHT UP AND HEAVY DOWN;So;0;ON;;;;;N;FORMS LIGHT UP AND HEAVY DOWN;;;;
+257E;BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT;So;0;ON;;;;;N;FORMS HEAVY LEFT AND LIGHT RIGHT;;;;
+257F;BOX DRAWINGS HEAVY UP AND LIGHT DOWN;So;0;ON;;;;;N;FORMS HEAVY UP AND LIGHT DOWN;;;;
+2580;UPPER HALF BLOCK;So;0;ON;;;;;N;;;;;
+2581;LOWER ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;;
+2582;LOWER ONE QUARTER BLOCK;So;0;ON;;;;;N;;;;;
+2583;LOWER THREE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;;
+2584;LOWER HALF BLOCK;So;0;ON;;;;;N;;;;;
+2585;LOWER FIVE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;;
+2586;LOWER THREE QUARTERS BLOCK;So;0;ON;;;;;N;LOWER THREE QUARTER BLOCK;;;;
+2587;LOWER SEVEN EIGHTHS BLOCK;So;0;ON;;;;;N;;;;;
+2588;FULL BLOCK;So;0;ON;;;;;N;;;;;
+2589;LEFT SEVEN EIGHTHS BLOCK;So;0;ON;;;;;N;;;;;
+258A;LEFT THREE QUARTERS BLOCK;So;0;ON;;;;;N;LEFT THREE QUARTER BLOCK;;;;
+258B;LEFT FIVE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;;
+258C;LEFT HALF BLOCK;So;0;ON;;;;;N;;;;;
+258D;LEFT THREE EIGHTHS BLOCK;So;0;ON;;;;;N;;;;;
+258E;LEFT ONE QUARTER BLOCK;So;0;ON;;;;;N;;;;;
+258F;LEFT ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;;
+2590;RIGHT HALF BLOCK;So;0;ON;;;;;N;;;;;
+2591;LIGHT SHADE;So;0;ON;;;;;N;;;;;
+2592;MEDIUM SHADE;So;0;ON;;;;;N;;;;;
+2593;DARK SHADE;So;0;ON;;;;;N;;;;;
+2594;UPPER ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;;
+2595;RIGHT ONE EIGHTH BLOCK;So;0;ON;;;;;N;;;;;
+2596;QUADRANT LOWER LEFT;So;0;ON;;;;;N;;;;;
+2597;QUADRANT LOWER RIGHT;So;0;ON;;;;;N;;;;;
+2598;QUADRANT UPPER LEFT;So;0;ON;;;;;N;;;;;
+2599;QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT;So;0;ON;;;;;N;;;;;
+259A;QUADRANT UPPER LEFT AND LOWER RIGHT;So;0;ON;;;;;N;;;;;
+259B;QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT;So;0;ON;;;;;N;;;;;
+259C;QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT;So;0;ON;;;;;N;;;;;
+259D;QUADRANT UPPER RIGHT;So;0;ON;;;;;N;;;;;
+259E;QUADRANT UPPER RIGHT AND LOWER LEFT;So;0;ON;;;;;N;;;;;
+259F;QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT;So;0;ON;;;;;N;;;;;
+25A0;BLACK SQUARE;So;0;ON;;;;;N;;;;;
+25A1;WHITE SQUARE;So;0;ON;;;;;N;;;;;
+25A2;WHITE SQUARE WITH ROUNDED CORNERS;So;0;ON;;;;;N;;;;;
+25A3;WHITE SQUARE CONTAINING BLACK SMALL SQUARE;So;0;ON;;;;;N;;;;;
+25A4;SQUARE WITH HORIZONTAL FILL;So;0;ON;;;;;N;;;;;
+25A5;SQUARE WITH VERTICAL FILL;So;0;ON;;;;;N;;;;;
+25A6;SQUARE WITH ORTHOGONAL CROSSHATCH FILL;So;0;ON;;;;;N;;;;;
+25A7;SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL;So;0;ON;;;;;N;;;;;
+25A8;SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL;So;0;ON;;;;;N;;;;;
+25A9;SQUARE WITH DIAGONAL CROSSHATCH FILL;So;0;ON;;;;;N;;;;;
+25AA;BLACK SMALL SQUARE;So;0;ON;;;;;N;;;;;
+25AB;WHITE SMALL SQUARE;So;0;ON;;;;;N;;;;;
+25AC;BLACK RECTANGLE;So;0;ON;;;;;N;;;;;
+25AD;WHITE RECTANGLE;So;0;ON;;;;;N;;;;;
+25AE;BLACK VERTICAL RECTANGLE;So;0;ON;;;;;N;;;;;
+25AF;WHITE VERTICAL RECTANGLE;So;0;ON;;;;;N;;;;;
+25B0;BLACK PARALLELOGRAM;So;0;ON;;;;;N;;;;;
+25B1;WHITE PARALLELOGRAM;So;0;ON;;;;;N;;;;;
+25B2;BLACK UP-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK UP POINTING TRIANGLE;;;;
+25B3;WHITE UP-POINTING TRIANGLE;So;0;ON;;;;;N;WHITE UP POINTING TRIANGLE;;;;
+25B4;BLACK UP-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK UP POINTING SMALL TRIANGLE;;;;
+25B5;WHITE UP-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE UP POINTING SMALL TRIANGLE;;;;
+25B6;BLACK RIGHT-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK RIGHT POINTING TRIANGLE;;;;
+25B7;WHITE RIGHT-POINTING TRIANGLE;Sm;0;ON;;;;;N;WHITE RIGHT POINTING TRIANGLE;;;;
+25B8;BLACK RIGHT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK RIGHT POINTING SMALL TRIANGLE;;;;
+25B9;WHITE RIGHT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE RIGHT POINTING SMALL TRIANGLE;;;;
+25BA;BLACK RIGHT-POINTING POINTER;So;0;ON;;;;;N;BLACK RIGHT POINTING POINTER;;;;
+25BB;WHITE RIGHT-POINTING POINTER;So;0;ON;;;;;N;WHITE RIGHT POINTING POINTER;;;;
+25BC;BLACK DOWN-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK DOWN POINTING TRIANGLE;;;;
+25BD;WHITE DOWN-POINTING TRIANGLE;So;0;ON;;;;;N;WHITE DOWN POINTING TRIANGLE;;;;
+25BE;BLACK DOWN-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK DOWN POINTING SMALL TRIANGLE;;;;
+25BF;WHITE DOWN-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE DOWN POINTING SMALL TRIANGLE;;;;
+25C0;BLACK LEFT-POINTING TRIANGLE;So;0;ON;;;;;N;BLACK LEFT POINTING TRIANGLE;;;;
+25C1;WHITE LEFT-POINTING TRIANGLE;Sm;0;ON;;;;;N;WHITE LEFT POINTING TRIANGLE;;;;
+25C2;BLACK LEFT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;BLACK LEFT POINTING SMALL TRIANGLE;;;;
+25C3;WHITE LEFT-POINTING SMALL TRIANGLE;So;0;ON;;;;;N;WHITE LEFT POINTING SMALL TRIANGLE;;;;
+25C4;BLACK LEFT-POINTING POINTER;So;0;ON;;;;;N;BLACK LEFT POINTING POINTER;;;;
+25C5;WHITE LEFT-POINTING POINTER;So;0;ON;;;;;N;WHITE LEFT POINTING POINTER;;;;
+25C6;BLACK DIAMOND;So;0;ON;;;;;N;;;;;
+25C7;WHITE DIAMOND;So;0;ON;;;;;N;;;;;
+25C8;WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND;So;0;ON;;;;;N;;;;;
+25C9;FISHEYE;So;0;ON;;;;;N;;;;;
+25CA;LOZENGE;So;0;ON;;;;;N;;;;;
+25CB;WHITE CIRCLE;So;0;ON;;;;;N;;;;;
+25CC;DOTTED CIRCLE;So;0;ON;;;;;N;;;;;
+25CD;CIRCLE WITH VERTICAL FILL;So;0;ON;;;;;N;;;;;
+25CE;BULLSEYE;So;0;ON;;;;;N;;;;;
+25CF;BLACK CIRCLE;So;0;ON;;;;;N;;;;;
+25D0;CIRCLE WITH LEFT HALF BLACK;So;0;ON;;;;;N;;;;;
+25D1;CIRCLE WITH RIGHT HALF BLACK;So;0;ON;;;;;N;;;;;
+25D2;CIRCLE WITH LOWER HALF BLACK;So;0;ON;;;;;N;;;;;
+25D3;CIRCLE WITH UPPER HALF BLACK;So;0;ON;;;;;N;;;;;
+25D4;CIRCLE WITH UPPER RIGHT QUADRANT BLACK;So;0;ON;;;;;N;;;;;
+25D5;CIRCLE WITH ALL BUT UPPER LEFT QUADRANT BLACK;So;0;ON;;;;;N;;;;;
+25D6;LEFT HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;;
+25D7;RIGHT HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;;
+25D8;INVERSE BULLET;So;0;ON;;;;;N;;;;;
+25D9;INVERSE WHITE CIRCLE;So;0;ON;;;;;N;;;;;
+25DA;UPPER HALF INVERSE WHITE CIRCLE;So;0;ON;;;;;N;;;;;
+25DB;LOWER HALF INVERSE WHITE CIRCLE;So;0;ON;;;;;N;;;;;
+25DC;UPPER LEFT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;;
+25DD;UPPER RIGHT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;;
+25DE;LOWER RIGHT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;;
+25DF;LOWER LEFT QUADRANT CIRCULAR ARC;So;0;ON;;;;;N;;;;;
+25E0;UPPER HALF CIRCLE;So;0;ON;;;;;N;;;;;
+25E1;LOWER HALF CIRCLE;So;0;ON;;;;;N;;;;;
+25E2;BLACK LOWER RIGHT TRIANGLE;So;0;ON;;;;;N;;;;;
+25E3;BLACK LOWER LEFT TRIANGLE;So;0;ON;;;;;N;;;;;
+25E4;BLACK UPPER LEFT TRIANGLE;So;0;ON;;;;;N;;;;;
+25E5;BLACK UPPER RIGHT TRIANGLE;So;0;ON;;;;;N;;;;;
+25E6;WHITE BULLET;So;0;ON;;;;;N;;;;;
+25E7;SQUARE WITH LEFT HALF BLACK;So;0;ON;;;;;N;;;;;
+25E8;SQUARE WITH RIGHT HALF BLACK;So;0;ON;;;;;N;;;;;
+25E9;SQUARE WITH UPPER LEFT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;;
+25EA;SQUARE WITH LOWER RIGHT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;;
+25EB;WHITE SQUARE WITH VERTICAL BISECTING LINE;So;0;ON;;;;;N;;;;;
+25EC;WHITE UP-POINTING TRIANGLE WITH DOT;So;0;ON;;;;;N;WHITE UP POINTING TRIANGLE WITH DOT;;;;
+25ED;UP-POINTING TRIANGLE WITH LEFT HALF BLACK;So;0;ON;;;;;N;UP POINTING TRIANGLE WITH LEFT HALF BLACK;;;;
+25EE;UP-POINTING TRIANGLE WITH RIGHT HALF BLACK;So;0;ON;;;;;N;UP POINTING TRIANGLE WITH RIGHT HALF BLACK;;;;
+25EF;LARGE CIRCLE;So;0;ON;;;;;N;;;;;
+25F0;WHITE SQUARE WITH UPPER LEFT QUADRANT;So;0;ON;;;;;N;;;;;
+25F1;WHITE SQUARE WITH LOWER LEFT QUADRANT;So;0;ON;;;;;N;;;;;
+25F2;WHITE SQUARE WITH LOWER RIGHT QUADRANT;So;0;ON;;;;;N;;;;;
+25F3;WHITE SQUARE WITH UPPER RIGHT QUADRANT;So;0;ON;;;;;N;;;;;
+25F4;WHITE CIRCLE WITH UPPER LEFT QUADRANT;So;0;ON;;;;;N;;;;;
+25F5;WHITE CIRCLE WITH LOWER LEFT QUADRANT;So;0;ON;;;;;N;;;;;
+25F6;WHITE CIRCLE WITH LOWER RIGHT QUADRANT;So;0;ON;;;;;N;;;;;
+25F7;WHITE CIRCLE WITH UPPER RIGHT QUADRANT;So;0;ON;;;;;N;;;;;
+25F8;UPPER LEFT TRIANGLE;Sm;0;ON;;;;;N;;;;;
+25F9;UPPER RIGHT TRIANGLE;Sm;0;ON;;;;;N;;;;;
+25FA;LOWER LEFT TRIANGLE;Sm;0;ON;;;;;N;;;;;
+25FB;WHITE MEDIUM SQUARE;Sm;0;ON;;;;;N;;;;;
+25FC;BLACK MEDIUM SQUARE;Sm;0;ON;;;;;N;;;;;
+25FD;WHITE MEDIUM SMALL SQUARE;Sm;0;ON;;;;;N;;;;;
+25FE;BLACK MEDIUM SMALL SQUARE;Sm;0;ON;;;;;N;;;;;
+25FF;LOWER RIGHT TRIANGLE;Sm;0;ON;;;;;N;;;;;
+2600;BLACK SUN WITH RAYS;So;0;ON;;;;;N;;;;;
+2601;CLOUD;So;0;ON;;;;;N;;;;;
+2602;UMBRELLA;So;0;ON;;;;;N;;;;;
+2603;SNOWMAN;So;0;ON;;;;;N;;;;;
+2604;COMET;So;0;ON;;;;;N;;;;;
+2605;BLACK STAR;So;0;ON;;;;;N;;;;;
+2606;WHITE STAR;So;0;ON;;;;;N;;;;;
+2607;LIGHTNING;So;0;ON;;;;;N;;;;;
+2608;THUNDERSTORM;So;0;ON;;;;;N;;;;;
+2609;SUN;So;0;ON;;;;;N;;;;;
+260A;ASCENDING NODE;So;0;ON;;;;;N;;;;;
+260B;DESCENDING NODE;So;0;ON;;;;;N;;;;;
+260C;CONJUNCTION;So;0;ON;;;;;N;;;;;
+260D;OPPOSITION;So;0;ON;;;;;N;;;;;
+260E;BLACK TELEPHONE;So;0;ON;;;;;N;;;;;
+260F;WHITE TELEPHONE;So;0;ON;;;;;N;;;;;
+2610;BALLOT BOX;So;0;ON;;;;;N;;;;;
+2611;BALLOT BOX WITH CHECK;So;0;ON;;;;;N;;;;;
+2612;BALLOT BOX WITH X;So;0;ON;;;;;N;;;;;
+2613;SALTIRE;So;0;ON;;;;;N;;;;;
+2614;UMBRELLA WITH RAIN DROPS;So;0;ON;;;;;N;;;;;
+2615;HOT BEVERAGE;So;0;ON;;;;;N;;;;;
+2616;WHITE SHOGI PIECE;So;0;ON;;;;;N;;;;;
+2617;BLACK SHOGI PIECE;So;0;ON;;;;;N;;;;;
+2618;SHAMROCK;So;0;ON;;;;;N;;;;;
+2619;REVERSED ROTATED FLORAL HEART BULLET;So;0;ON;;;;;N;;;;;
+261A;BLACK LEFT POINTING INDEX;So;0;ON;;;;;N;;;;;
+261B;BLACK RIGHT POINTING INDEX;So;0;ON;;;;;N;;;;;
+261C;WHITE LEFT POINTING INDEX;So;0;ON;;;;;N;;;;;
+261D;WHITE UP POINTING INDEX;So;0;ON;;;;;N;;;;;
+261E;WHITE RIGHT POINTING INDEX;So;0;ON;;;;;N;;;;;
+261F;WHITE DOWN POINTING INDEX;So;0;ON;;;;;N;;;;;
+2620;SKULL AND CROSSBONES;So;0;ON;;;;;N;;;;;
+2621;CAUTION SIGN;So;0;ON;;;;;N;;;;;
+2622;RADIOACTIVE SIGN;So;0;ON;;;;;N;;;;;
+2623;BIOHAZARD SIGN;So;0;ON;;;;;N;;;;;
+2624;CADUCEUS;So;0;ON;;;;;N;;;;;
+2625;ANKH;So;0;ON;;;;;N;;;;;
+2626;ORTHODOX CROSS;So;0;ON;;;;;N;;;;;
+2627;CHI RHO;So;0;ON;;;;;N;;;;;
+2628;CROSS OF LORRAINE;So;0;ON;;;;;N;;;;;
+2629;CROSS OF JERUSALEM;So;0;ON;;;;;N;;;;;
+262A;STAR AND CRESCENT;So;0;ON;;;;;N;;;;;
+262B;FARSI SYMBOL;So;0;ON;;;;;N;SYMBOL OF IRAN;;;;
+262C;ADI SHAKTI;So;0;ON;;;;;N;;;;;
+262D;HAMMER AND SICKLE;So;0;ON;;;;;N;;;;;
+262E;PEACE SYMBOL;So;0;ON;;;;;N;;;;;
+262F;YIN YANG;So;0;ON;;;;;N;;;;;
+2630;TRIGRAM FOR HEAVEN;So;0;ON;;;;;N;;;;;
+2631;TRIGRAM FOR LAKE;So;0;ON;;;;;N;;;;;
+2632;TRIGRAM FOR FIRE;So;0;ON;;;;;N;;;;;
+2633;TRIGRAM FOR THUNDER;So;0;ON;;;;;N;;;;;
+2634;TRIGRAM FOR WIND;So;0;ON;;;;;N;;;;;
+2635;TRIGRAM FOR WATER;So;0;ON;;;;;N;;;;;
+2636;TRIGRAM FOR MOUNTAIN;So;0;ON;;;;;N;;;;;
+2637;TRIGRAM FOR EARTH;So;0;ON;;;;;N;;;;;
+2638;WHEEL OF DHARMA;So;0;ON;;;;;N;;;;;
+2639;WHITE FROWNING FACE;So;0;ON;;;;;N;;;;;
+263A;WHITE SMILING FACE;So;0;ON;;;;;N;;;;;
+263B;BLACK SMILING FACE;So;0;ON;;;;;N;;;;;
+263C;WHITE SUN WITH RAYS;So;0;ON;;;;;N;;;;;
+263D;FIRST QUARTER MOON;So;0;ON;;;;;N;;;;;
+263E;LAST QUARTER MOON;So;0;ON;;;;;N;;;;;
+263F;MERCURY;So;0;ON;;;;;N;;;;;
+2640;FEMALE SIGN;So;0;ON;;;;;N;;;;;
+2641;EARTH;So;0;ON;;;;;N;;;;;
+2642;MALE SIGN;So;0;ON;;;;;N;;;;;
+2643;JUPITER;So;0;ON;;;;;N;;;;;
+2644;SATURN;So;0;ON;;;;;N;;;;;
+2645;URANUS;So;0;ON;;;;;N;;;;;
+2646;NEPTUNE;So;0;ON;;;;;N;;;;;
+2647;PLUTO;So;0;ON;;;;;N;;;;;
+2648;ARIES;So;0;ON;;;;;N;;;;;
+2649;TAURUS;So;0;ON;;;;;N;;;;;
+264A;GEMINI;So;0;ON;;;;;N;;;;;
+264B;CANCER;So;0;ON;;;;;N;;;;;
+264C;LEO;So;0;ON;;;;;N;;;;;
+264D;VIRGO;So;0;ON;;;;;N;;;;;
+264E;LIBRA;So;0;ON;;;;;N;;;;;
+264F;SCORPIUS;So;0;ON;;;;;N;;;;;
+2650;SAGITTARIUS;So;0;ON;;;;;N;;;;;
+2651;CAPRICORN;So;0;ON;;;;;N;;;;;
+2652;AQUARIUS;So;0;ON;;;;;N;;;;;
+2653;PISCES;So;0;ON;;;;;N;;;;;
+2654;WHITE CHESS KING;So;0;ON;;;;;N;;;;;
+2655;WHITE CHESS QUEEN;So;0;ON;;;;;N;;;;;
+2656;WHITE CHESS ROOK;So;0;ON;;;;;N;;;;;
+2657;WHITE CHESS BISHOP;So;0;ON;;;;;N;;;;;
+2658;WHITE CHESS KNIGHT;So;0;ON;;;;;N;;;;;
+2659;WHITE CHESS PAWN;So;0;ON;;;;;N;;;;;
+265A;BLACK CHESS KING;So;0;ON;;;;;N;;;;;
+265B;BLACK CHESS QUEEN;So;0;ON;;;;;N;;;;;
+265C;BLACK CHESS ROOK;So;0;ON;;;;;N;;;;;
+265D;BLACK CHESS BISHOP;So;0;ON;;;;;N;;;;;
+265E;BLACK CHESS KNIGHT;So;0;ON;;;;;N;;;;;
+265F;BLACK CHESS PAWN;So;0;ON;;;;;N;;;;;
+2660;BLACK SPADE SUIT;So;0;ON;;;;;N;;;;;
+2661;WHITE HEART SUIT;So;0;ON;;;;;N;;;;;
+2662;WHITE DIAMOND SUIT;So;0;ON;;;;;N;;;;;
+2663;BLACK CLUB SUIT;So;0;ON;;;;;N;;;;;
+2664;WHITE SPADE SUIT;So;0;ON;;;;;N;;;;;
+2665;BLACK HEART SUIT;So;0;ON;;;;;N;;;;;
+2666;BLACK DIAMOND SUIT;So;0;ON;;;;;N;;;;;
+2667;WHITE CLUB SUIT;So;0;ON;;;;;N;;;;;
+2668;HOT SPRINGS;So;0;ON;;;;;N;;;;;
+2669;QUARTER NOTE;So;0;ON;;;;;N;;;;;
+266A;EIGHTH NOTE;So;0;ON;;;;;N;;;;;
+266B;BEAMED EIGHTH NOTES;So;0;ON;;;;;N;BARRED EIGHTH NOTES;;;;
+266C;BEAMED SIXTEENTH NOTES;So;0;ON;;;;;N;BARRED SIXTEENTH NOTES;;;;
+266D;MUSIC FLAT SIGN;So;0;ON;;;;;N;FLAT;;;;
+266E;MUSIC NATURAL SIGN;So;0;ON;;;;;N;NATURAL;;;;
+266F;MUSIC SHARP SIGN;Sm;0;ON;;;;;N;SHARP;;;;
+2670;WEST SYRIAC CROSS;So;0;ON;;;;;N;;;;;
+2671;EAST SYRIAC CROSS;So;0;ON;;;;;N;;;;;
+2672;UNIVERSAL RECYCLING SYMBOL;So;0;ON;;;;;N;;;;;
+2673;RECYCLING SYMBOL FOR TYPE-1 PLASTICS;So;0;ON;;;;;N;;pete;;;
+2674;RECYCLING SYMBOL FOR TYPE-2 PLASTICS;So;0;ON;;;;;N;;hdpe;;;
+2675;RECYCLING SYMBOL FOR TYPE-3 PLASTICS;So;0;ON;;;;;N;;pvc;;;
+2676;RECYCLING SYMBOL FOR TYPE-4 PLASTICS;So;0;ON;;;;;N;;ldpe;;;
+2677;RECYCLING SYMBOL FOR TYPE-5 PLASTICS;So;0;ON;;;;;N;;pp;;;
+2678;RECYCLING SYMBOL FOR TYPE-6 PLASTICS;So;0;ON;;;;;N;;ps;;;
+2679;RECYCLING SYMBOL FOR TYPE-7 PLASTICS;So;0;ON;;;;;N;;other;;;
+267A;RECYCLING SYMBOL FOR GENERIC MATERIALS;So;0;ON;;;;;N;;;;;
+267B;BLACK UNIVERSAL RECYCLING SYMBOL;So;0;ON;;;;;N;;;;;
+267C;RECYCLED PAPER SYMBOL;So;0;ON;;;;;N;;;;;
+267D;PARTIALLY-RECYCLED PAPER SYMBOL;So;0;ON;;;;;N;;;;;
+267E;PERMANENT PAPER SIGN;So;0;ON;;;;;N;;;;;
+267F;WHEELCHAIR SYMBOL;So;0;ON;;;;;N;;;;;
+2680;DIE FACE-1;So;0;ON;;;;;N;;;;;
+2681;DIE FACE-2;So;0;ON;;;;;N;;;;;
+2682;DIE FACE-3;So;0;ON;;;;;N;;;;;
+2683;DIE FACE-4;So;0;ON;;;;;N;;;;;
+2684;DIE FACE-5;So;0;ON;;;;;N;;;;;
+2685;DIE FACE-6;So;0;ON;;;;;N;;;;;
+2686;WHITE CIRCLE WITH DOT RIGHT;So;0;ON;;;;;N;;;;;
+2687;WHITE CIRCLE WITH TWO DOTS;So;0;ON;;;;;N;;;;;
+2688;BLACK CIRCLE WITH WHITE DOT RIGHT;So;0;ON;;;;;N;;;;;
+2689;BLACK CIRCLE WITH TWO WHITE DOTS;So;0;ON;;;;;N;;;;;
+268A;MONOGRAM FOR YANG;So;0;ON;;;;;N;;;;;
+268B;MONOGRAM FOR YIN;So;0;ON;;;;;N;;;;;
+268C;DIGRAM FOR GREATER YANG;So;0;ON;;;;;N;;;;;
+268D;DIGRAM FOR LESSER YIN;So;0;ON;;;;;N;;;;;
+268E;DIGRAM FOR LESSER YANG;So;0;ON;;;;;N;;;;;
+268F;DIGRAM FOR GREATER YIN;So;0;ON;;;;;N;;;;;
+2690;WHITE FLAG;So;0;ON;;;;;N;;;;;
+2691;BLACK FLAG;So;0;ON;;;;;N;;;;;
+2692;HAMMER AND PICK;So;0;ON;;;;;N;;;;;
+2693;ANCHOR;So;0;ON;;;;;N;;;;;
+2694;CROSSED SWORDS;So;0;ON;;;;;N;;;;;
+2695;STAFF OF AESCULAPIUS;So;0;ON;;;;;N;;;;;
+2696;SCALES;So;0;ON;;;;;N;;;;;
+2697;ALEMBIC;So;0;ON;;;;;N;;;;;
+2698;FLOWER;So;0;ON;;;;;N;;;;;
+2699;GEAR;So;0;ON;;;;;N;;;;;
+269A;STAFF OF HERMES;So;0;ON;;;;;N;;;;;
+269B;ATOM SYMBOL;So;0;ON;;;;;N;;;;;
+269C;FLEUR-DE-LIS;So;0;ON;;;;;N;;;;;
+26A0;WARNING SIGN;So;0;ON;;;;;N;;;;;
+26A1;HIGH VOLTAGE SIGN;So;0;ON;;;;;N;;;;;
+26A2;DOUBLED FEMALE SIGN;So;0;ON;;;;;N;;;;;
+26A3;DOUBLED MALE SIGN;So;0;ON;;;;;N;;;;;
+26A4;INTERLOCKED FEMALE AND MALE SIGN;So;0;ON;;;;;N;;;;;
+26A5;MALE AND FEMALE SIGN;So;0;ON;;;;;N;;;;;
+26A6;MALE WITH STROKE SIGN;So;0;ON;;;;;N;;;;;
+26A7;MALE WITH STROKE AND MALE AND FEMALE SIGN;So;0;ON;;;;;N;;;;;
+26A8;VERTICAL MALE WITH STROKE SIGN;So;0;ON;;;;;N;;;;;
+26A9;HORIZONTAL MALE WITH STROKE SIGN;So;0;ON;;;;;N;;;;;
+26AA;MEDIUM WHITE CIRCLE;So;0;ON;;;;;N;;;;;
+26AB;MEDIUM BLACK CIRCLE;So;0;ON;;;;;N;;;;;
+26AC;MEDIUM SMALL WHITE CIRCLE;So;0;L;;;;;N;;;;;
+26AD;MARRIAGE SYMBOL;So;0;ON;;;;;N;;;;;
+26AE;DIVORCE SYMBOL;So;0;ON;;;;;N;;;;;
+26AF;UNMARRIED PARTNERSHIP SYMBOL;So;0;ON;;;;;N;;;;;
+26B0;COFFIN;So;0;ON;;;;;N;;;;;
+26B1;FUNERAL URN;So;0;ON;;;;;N;;;;;
+26B2;NEUTER;So;0;ON;;;;;N;;;;;
+2701;UPPER BLADE SCISSORS;So;0;ON;;;;;N;;;;;
+2702;BLACK SCISSORS;So;0;ON;;;;;N;;;;;
+2703;LOWER BLADE SCISSORS;So;0;ON;;;;;N;;;;;
+2704;WHITE SCISSORS;So;0;ON;;;;;N;;;;;
+2706;TELEPHONE LOCATION SIGN;So;0;ON;;;;;N;;;;;
+2707;TAPE DRIVE;So;0;ON;;;;;N;;;;;
+2708;AIRPLANE;So;0;ON;;;;;N;;;;;
+2709;ENVELOPE;So;0;ON;;;;;N;;;;;
+270C;VICTORY HAND;So;0;ON;;;;;N;;;;;
+270D;WRITING HAND;So;0;ON;;;;;N;;;;;
+270E;LOWER RIGHT PENCIL;So;0;ON;;;;;N;;;;;
+270F;PENCIL;So;0;ON;;;;;N;;;;;
+2710;UPPER RIGHT PENCIL;So;0;ON;;;;;N;;;;;
+2711;WHITE NIB;So;0;ON;;;;;N;;;;;
+2712;BLACK NIB;So;0;ON;;;;;N;;;;;
+2713;CHECK MARK;So;0;ON;;;;;N;;;;;
+2714;HEAVY CHECK MARK;So;0;ON;;;;;N;;;;;
+2715;MULTIPLICATION X;So;0;ON;;;;;N;;;;;
+2716;HEAVY MULTIPLICATION X;So;0;ON;;;;;N;;;;;
+2717;BALLOT X;So;0;ON;;;;;N;;;;;
+2718;HEAVY BALLOT X;So;0;ON;;;;;N;;;;;
+2719;OUTLINED GREEK CROSS;So;0;ON;;;;;N;;;;;
+271A;HEAVY GREEK CROSS;So;0;ON;;;;;N;;;;;
+271B;OPEN CENTRE CROSS;So;0;ON;;;;;N;OPEN CENTER CROSS;;;;
+271C;HEAVY OPEN CENTRE CROSS;So;0;ON;;;;;N;HEAVY OPEN CENTER CROSS;;;;
+271D;LATIN CROSS;So;0;ON;;;;;N;;;;;
+271E;SHADOWED WHITE LATIN CROSS;So;0;ON;;;;;N;;;;;
+271F;OUTLINED LATIN CROSS;So;0;ON;;;;;N;;;;;
+2720;MALTESE CROSS;So;0;ON;;;;;N;;;;;
+2721;STAR OF DAVID;So;0;ON;;;;;N;;;;;
+2722;FOUR TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+2723;FOUR BALLOON-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+2724;HEAVY FOUR BALLOON-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+2725;FOUR CLUB-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+2726;BLACK FOUR POINTED STAR;So;0;ON;;;;;N;;;;;
+2727;WHITE FOUR POINTED STAR;So;0;ON;;;;;N;;;;;
+2729;STRESS OUTLINED WHITE STAR;So;0;ON;;;;;N;;;;;
+272A;CIRCLED WHITE STAR;So;0;ON;;;;;N;;;;;
+272B;OPEN CENTRE BLACK STAR;So;0;ON;;;;;N;OPEN CENTER BLACK STAR;;;;
+272C;BLACK CENTRE WHITE STAR;So;0;ON;;;;;N;BLACK CENTER WHITE STAR;;;;
+272D;OUTLINED BLACK STAR;So;0;ON;;;;;N;;;;;
+272E;HEAVY OUTLINED BLACK STAR;So;0;ON;;;;;N;;;;;
+272F;PINWHEEL STAR;So;0;ON;;;;;N;;;;;
+2730;SHADOWED WHITE STAR;So;0;ON;;;;;N;;;;;
+2731;HEAVY ASTERISK;So;0;ON;;;;;N;;;;;
+2732;OPEN CENTRE ASTERISK;So;0;ON;;;;;N;OPEN CENTER ASTERISK;;;;
+2733;EIGHT SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+2734;EIGHT POINTED BLACK STAR;So;0;ON;;;;;N;;;;;
+2735;EIGHT POINTED PINWHEEL STAR;So;0;ON;;;;;N;;;;;
+2736;SIX POINTED BLACK STAR;So;0;ON;;;;;N;;;;;
+2737;EIGHT POINTED RECTILINEAR BLACK STAR;So;0;ON;;;;;N;;;;;
+2738;HEAVY EIGHT POINTED RECTILINEAR BLACK STAR;So;0;ON;;;;;N;;;;;
+2739;TWELVE POINTED BLACK STAR;So;0;ON;;;;;N;;;;;
+273A;SIXTEEN POINTED ASTERISK;So;0;ON;;;;;N;;;;;
+273B;TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+273C;OPEN CENTRE TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;OPEN CENTER TEARDROP-SPOKED ASTERISK;;;;
+273D;HEAVY TEARDROP-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+273E;SIX PETALLED BLACK AND WHITE FLORETTE;So;0;ON;;;;;N;;;;;
+273F;BLACK FLORETTE;So;0;ON;;;;;N;;;;;
+2740;WHITE FLORETTE;So;0;ON;;;;;N;;;;;
+2741;EIGHT PETALLED OUTLINED BLACK FLORETTE;So;0;ON;;;;;N;;;;;
+2742;CIRCLED OPEN CENTRE EIGHT POINTED STAR;So;0;ON;;;;;N;CIRCLED OPEN CENTER EIGHT POINTED STAR;;;;
+2743;HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK;So;0;ON;;;;;N;;;;;
+2744;SNOWFLAKE;So;0;ON;;;;;N;;;;;
+2745;TIGHT TRIFOLIATE SNOWFLAKE;So;0;ON;;;;;N;;;;;
+2746;HEAVY CHEVRON SNOWFLAKE;So;0;ON;;;;;N;;;;;
+2747;SPARKLE;So;0;ON;;;;;N;;;;;
+2748;HEAVY SPARKLE;So;0;ON;;;;;N;;;;;
+2749;BALLOON-SPOKED ASTERISK;So;0;ON;;;;;N;;;;;
+274A;EIGHT TEARDROP-SPOKED PROPELLER ASTERISK;So;0;ON;;;;;N;;;;;
+274B;HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK;So;0;ON;;;;;N;;;;;
+274D;SHADOWED WHITE CIRCLE;So;0;ON;;;;;N;;;;;
+274F;LOWER RIGHT DROP-SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
+2750;UPPER RIGHT DROP-SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
+2751;LOWER RIGHT SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
+2752;UPPER RIGHT SHADOWED WHITE SQUARE;So;0;ON;;;;;N;;;;;
+2756;BLACK DIAMOND MINUS WHITE X;So;0;ON;;;;;N;;;;;
+2758;LIGHT VERTICAL BAR;So;0;ON;;;;;N;;;;;
+2759;MEDIUM VERTICAL BAR;So;0;ON;;;;;N;;;;;
+275A;HEAVY VERTICAL BAR;So;0;ON;;;;;N;;;;;
+275B;HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+275C;HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+275D;HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+275E;HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+2761;CURVED STEM PARAGRAPH SIGN ORNAMENT;So;0;ON;;;;;N;;;;;
+2762;HEAVY EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+2763;HEAVY HEART EXCLAMATION MARK ORNAMENT;So;0;ON;;;;;N;;;;;
+2764;HEAVY BLACK HEART;So;0;ON;;;;;N;;;;;
+2765;ROTATED HEAVY BLACK HEART BULLET;So;0;ON;;;;;N;;;;;
+2766;FLORAL HEART;So;0;ON;;;;;N;;;;;
+2767;ROTATED FLORAL HEART BULLET;So;0;ON;;;;;N;;;;;
+2768;MEDIUM LEFT PARENTHESIS ORNAMENT;Ps;0;ON;;;;;Y;;;;;
+2769;MEDIUM RIGHT PARENTHESIS ORNAMENT;Pe;0;ON;;;;;Y;;;;;
+276A;MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT;Ps;0;ON;;;;;Y;;;;;
+276B;MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT;Pe;0;ON;;;;;Y;;;;;
+276C;MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;;
+276D;MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;;
+276E;HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT;Ps;0;ON;;;;;Y;;;;;
+276F;HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT;Pe;0;ON;;;;;Y;;;;;
+2770;HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;;
+2771;HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;;
+2772;LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;;
+2773;LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;;
+2774;MEDIUM LEFT CURLY BRACKET ORNAMENT;Ps;0;ON;;;;;Y;;;;;
+2775;MEDIUM RIGHT CURLY BRACKET ORNAMENT;Pe;0;ON;;;;;Y;;;;;
+2776;DINGBAT NEGATIVE CIRCLED DIGIT ONE;No;0;ON;;;1;1;N;INVERSE CIRCLED DIGIT ONE;;;;
+2777;DINGBAT NEGATIVE CIRCLED DIGIT TWO;No;0;ON;;;2;2;N;INVERSE CIRCLED DIGIT TWO;;;;
+2778;DINGBAT NEGATIVE CIRCLED DIGIT THREE;No;0;ON;;;3;3;N;INVERSE CIRCLED DIGIT THREE;;;;
+2779;DINGBAT NEGATIVE CIRCLED DIGIT FOUR;No;0;ON;;;4;4;N;INVERSE CIRCLED DIGIT FOUR;;;;
+277A;DINGBAT NEGATIVE CIRCLED DIGIT FIVE;No;0;ON;;;5;5;N;INVERSE CIRCLED DIGIT FIVE;;;;
+277B;DINGBAT NEGATIVE CIRCLED DIGIT SIX;No;0;ON;;;6;6;N;INVERSE CIRCLED DIGIT SIX;;;;
+277C;DINGBAT NEGATIVE CIRCLED DIGIT SEVEN;No;0;ON;;;7;7;N;INVERSE CIRCLED DIGIT SEVEN;;;;
+277D;DINGBAT NEGATIVE CIRCLED DIGIT EIGHT;No;0;ON;;;8;8;N;INVERSE CIRCLED DIGIT EIGHT;;;;
+277E;DINGBAT NEGATIVE CIRCLED DIGIT NINE;No;0;ON;;;9;9;N;INVERSE CIRCLED DIGIT NINE;;;;
+277F;DINGBAT NEGATIVE CIRCLED NUMBER TEN;No;0;ON;;;;10;N;INVERSE CIRCLED NUMBER TEN;;;;
+2780;DINGBAT CIRCLED SANS-SERIF DIGIT ONE;No;0;ON;;;1;1;N;CIRCLED SANS-SERIF DIGIT ONE;;;;
+2781;DINGBAT CIRCLED SANS-SERIF DIGIT TWO;No;0;ON;;;2;2;N;CIRCLED SANS-SERIF DIGIT TWO;;;;
+2782;DINGBAT CIRCLED SANS-SERIF DIGIT THREE;No;0;ON;;;3;3;N;CIRCLED SANS-SERIF DIGIT THREE;;;;
+2783;DINGBAT CIRCLED SANS-SERIF DIGIT FOUR;No;0;ON;;;4;4;N;CIRCLED SANS-SERIF DIGIT FOUR;;;;
+2784;DINGBAT CIRCLED SANS-SERIF DIGIT FIVE;No;0;ON;;;5;5;N;CIRCLED SANS-SERIF DIGIT FIVE;;;;
+2785;DINGBAT CIRCLED SANS-SERIF DIGIT SIX;No;0;ON;;;6;6;N;CIRCLED SANS-SERIF DIGIT SIX;;;;
+2786;DINGBAT CIRCLED SANS-SERIF DIGIT SEVEN;No;0;ON;;;7;7;N;CIRCLED SANS-SERIF DIGIT SEVEN;;;;
+2787;DINGBAT CIRCLED SANS-SERIF DIGIT EIGHT;No;0;ON;;;8;8;N;CIRCLED SANS-SERIF DIGIT EIGHT;;;;
+2788;DINGBAT CIRCLED SANS-SERIF DIGIT NINE;No;0;ON;;;9;9;N;CIRCLED SANS-SERIF DIGIT NINE;;;;
+2789;DINGBAT CIRCLED SANS-SERIF NUMBER TEN;No;0;ON;;;;10;N;CIRCLED SANS-SERIF NUMBER TEN;;;;
+278A;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE;No;0;ON;;;1;1;N;INVERSE CIRCLED SANS-SERIF DIGIT ONE;;;;
+278B;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT TWO;No;0;ON;;;2;2;N;INVERSE CIRCLED SANS-SERIF DIGIT TWO;;;;
+278C;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT THREE;No;0;ON;;;3;3;N;INVERSE CIRCLED SANS-SERIF DIGIT THREE;;;;
+278D;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FOUR;No;0;ON;;;4;4;N;INVERSE CIRCLED SANS-SERIF DIGIT FOUR;;;;
+278E;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FIVE;No;0;ON;;;5;5;N;INVERSE CIRCLED SANS-SERIF DIGIT FIVE;;;;
+278F;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SIX;No;0;ON;;;6;6;N;INVERSE CIRCLED SANS-SERIF DIGIT SIX;;;;
+2790;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SEVEN;No;0;ON;;;7;7;N;INVERSE CIRCLED SANS-SERIF DIGIT SEVEN;;;;
+2791;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT EIGHT;No;0;ON;;;8;8;N;INVERSE CIRCLED SANS-SERIF DIGIT EIGHT;;;;
+2792;DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE;No;0;ON;;;9;9;N;INVERSE CIRCLED SANS-SERIF DIGIT NINE;;;;
+2793;DINGBAT NEGATIVE CIRCLED SANS-SERIF NUMBER TEN;No;0;ON;;;;10;N;INVERSE CIRCLED SANS-SERIF NUMBER TEN;;;;
+2794;HEAVY WIDE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY WIDE-HEADED RIGHT ARROW;;;;
+2798;HEAVY SOUTH EAST ARROW;So;0;ON;;;;;N;HEAVY LOWER RIGHT ARROW;;;;
+2799;HEAVY RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY RIGHT ARROW;;;;
+279A;HEAVY NORTH EAST ARROW;So;0;ON;;;;;N;HEAVY UPPER RIGHT ARROW;;;;
+279B;DRAFTING POINT RIGHTWARDS ARROW;So;0;ON;;;;;N;DRAFTING POINT RIGHT ARROW;;;;
+279C;HEAVY ROUND-TIPPED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY ROUND-TIPPED RIGHT ARROW;;;;
+279D;TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;TRIANGLE-HEADED RIGHT ARROW;;;;
+279E;HEAVY TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY TRIANGLE-HEADED RIGHT ARROW;;;;
+279F;DASHED TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;DASHED TRIANGLE-HEADED RIGHT ARROW;;;;
+27A0;HEAVY DASHED TRIANGLE-HEADED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY DASHED TRIANGLE-HEADED RIGHT ARROW;;;;
+27A1;BLACK RIGHTWARDS ARROW;So;0;ON;;;;;N;BLACK RIGHT ARROW;;;;
+27A2;THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD;So;0;ON;;;;;N;THREE-D TOP-LIGHTED RIGHT ARROWHEAD;;;;
+27A3;THREE-D BOTTOM-LIGHTED RIGHTWARDS ARROWHEAD;So;0;ON;;;;;N;THREE-D BOTTOM-LIGHTED RIGHT ARROWHEAD;;;;
+27A4;BLACK RIGHTWARDS ARROWHEAD;So;0;ON;;;;;N;BLACK RIGHT ARROWHEAD;;;;
+27A5;HEAVY BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY BLACK CURVED DOWN AND RIGHT ARROW;;;;
+27A6;HEAVY BLACK CURVED UPWARDS AND RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY BLACK CURVED UP AND RIGHT ARROW;;;;
+27A7;SQUAT BLACK RIGHTWARDS ARROW;So;0;ON;;;;;N;SQUAT BLACK RIGHT ARROW;;;;
+27A8;HEAVY CONCAVE-POINTED BLACK RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY CONCAVE-POINTED BLACK RIGHT ARROW;;;;
+27A9;RIGHT-SHADED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;RIGHT-SHADED WHITE RIGHT ARROW;;;;
+27AA;LEFT-SHADED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;LEFT-SHADED WHITE RIGHT ARROW;;;;
+27AB;BACK-TILTED SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;BACK-TILTED SHADOWED WHITE RIGHT ARROW;;;;
+27AC;FRONT-TILTED SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;FRONT-TILTED SHADOWED WHITE RIGHT ARROW;;;;
+27AD;HEAVY LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY LOWER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
+27AE;HEAVY UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY UPPER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
+27AF;NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
+27B1;NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHT ARROW;;;;
+27B2;CIRCLED HEAVY WHITE RIGHTWARDS ARROW;So;0;ON;;;;;N;CIRCLED HEAVY WHITE RIGHT ARROW;;;;
+27B3;WHITE-FEATHERED RIGHTWARDS ARROW;So;0;ON;;;;;N;WHITE-FEATHERED RIGHT ARROW;;;;
+27B4;BLACK-FEATHERED SOUTH EAST ARROW;So;0;ON;;;;;N;BLACK-FEATHERED LOWER RIGHT ARROW;;;;
+27B5;BLACK-FEATHERED RIGHTWARDS ARROW;So;0;ON;;;;;N;BLACK-FEATHERED RIGHT ARROW;;;;
+27B6;BLACK-FEATHERED NORTH EAST ARROW;So;0;ON;;;;;N;BLACK-FEATHERED UPPER RIGHT ARROW;;;;
+27B7;HEAVY BLACK-FEATHERED SOUTH EAST ARROW;So;0;ON;;;;;N;HEAVY BLACK-FEATHERED LOWER RIGHT ARROW;;;;
+27B8;HEAVY BLACK-FEATHERED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY BLACK-FEATHERED RIGHT ARROW;;;;
+27B9;HEAVY BLACK-FEATHERED NORTH EAST ARROW;So;0;ON;;;;;N;HEAVY BLACK-FEATHERED UPPER RIGHT ARROW;;;;
+27BA;TEARDROP-BARBED RIGHTWARDS ARROW;So;0;ON;;;;;N;TEARDROP-BARBED RIGHT ARROW;;;;
+27BB;HEAVY TEARDROP-SHANKED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY TEARDROP-SHANKED RIGHT ARROW;;;;
+27BC;WEDGE-TAILED RIGHTWARDS ARROW;So;0;ON;;;;;N;WEDGE-TAILED RIGHT ARROW;;;;
+27BD;HEAVY WEDGE-TAILED RIGHTWARDS ARROW;So;0;ON;;;;;N;HEAVY WEDGE-TAILED RIGHT ARROW;;;;
+27BE;OPEN-OUTLINED RIGHTWARDS ARROW;So;0;ON;;;;;N;OPEN-OUTLINED RIGHT ARROW;;;;
+27C0;THREE DIMENSIONAL ANGLE;Sm;0;ON;;;;;Y;;;;;
+27C1;WHITE TRIANGLE CONTAINING SMALL WHITE TRIANGLE;Sm;0;ON;;;;;N;;;;;
+27C2;PERPENDICULAR;Sm;0;ON;;;;;N;;;;;
+27C3;OPEN SUBSET;Sm;0;ON;;;;;Y;;;;;
+27C4;OPEN SUPERSET;Sm;0;ON;;;;;Y;;;;;
+27C5;LEFT S-SHAPED BAG DELIMITER;Ps;0;ON;;;;;Y;;;;;
+27C6;RIGHT S-SHAPED BAG DELIMITER;Pe;0;ON;;;;;Y;;;;;
+27C7;OR WITH DOT INSIDE;Sm;0;ON;;;;;N;;;;;
+27C8;REVERSE SOLIDUS PRECEDING SUBSET;Sm;0;ON;;;;;N;;;;;
+27C9;SUPERSET PRECEDING SOLIDUS;Sm;0;ON;;;;;N;;;;;
+27CA;VERTICAL BAR WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;;
+27D0;WHITE DIAMOND WITH CENTRED DOT;Sm;0;ON;;;;;N;;;;;
+27D1;AND WITH DOT;Sm;0;ON;;;;;N;;;;;
+27D2;ELEMENT OF OPENING UPWARDS;Sm;0;ON;;;;;N;;;;;
+27D3;LOWER RIGHT CORNER WITH DOT;Sm;0;ON;;;;;Y;;;;;
+27D4;UPPER LEFT CORNER WITH DOT;Sm;0;ON;;;;;Y;;;;;
+27D5;LEFT OUTER JOIN;Sm;0;ON;;;;;Y;;;;;
+27D6;RIGHT OUTER JOIN;Sm;0;ON;;;;;Y;;;;;
+27D7;FULL OUTER JOIN;Sm;0;ON;;;;;N;;;;;
+27D8;LARGE UP TACK;Sm;0;ON;;;;;N;;;;;
+27D9;LARGE DOWN TACK;Sm;0;ON;;;;;N;;;;;
+27DA;LEFT AND RIGHT DOUBLE TURNSTILE;Sm;0;ON;;;;;N;;;;;
+27DB;LEFT AND RIGHT TACK;Sm;0;ON;;;;;N;;;;;
+27DC;LEFT MULTIMAP;Sm;0;ON;;;;;Y;;;;;
+27DD;LONG RIGHT TACK;Sm;0;ON;;;;;Y;;;;;
+27DE;LONG LEFT TACK;Sm;0;ON;;;;;Y;;;;;
+27DF;UP TACK WITH CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;;
+27E0;LOZENGE DIVIDED BY HORIZONTAL RULE;Sm;0;ON;;;;;N;;;;;
+27E1;WHITE CONCAVE-SIDED DIAMOND;Sm;0;ON;;;;;N;;;;;
+27E2;WHITE CONCAVE-SIDED DIAMOND WITH LEFTWARDS TICK;Sm;0;ON;;;;;Y;;;;;
+27E3;WHITE CONCAVE-SIDED DIAMOND WITH RIGHTWARDS TICK;Sm;0;ON;;;;;Y;;;;;
+27E4;WHITE SQUARE WITH LEFTWARDS TICK;Sm;0;ON;;;;;Y;;;;;
+27E5;WHITE SQUARE WITH RIGHTWARDS TICK;Sm;0;ON;;;;;Y;;;;;
+27E6;MATHEMATICAL LEFT WHITE SQUARE BRACKET;Ps;0;ON;;;;;Y;;;;;
+27E7;MATHEMATICAL RIGHT WHITE SQUARE BRACKET;Pe;0;ON;;;;;Y;;;;;
+27E8;MATHEMATICAL LEFT ANGLE BRACKET;Ps;0;ON;;;;;Y;;;;;
+27E9;MATHEMATICAL RIGHT ANGLE BRACKET;Pe;0;ON;;;;;Y;;;;;
+27EA;MATHEMATICAL LEFT DOUBLE ANGLE BRACKET;Ps;0;ON;;;;;Y;;;;;
+27EB;MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET;Pe;0;ON;;;;;Y;;;;;
+27F0;UPWARDS QUADRUPLE ARROW;Sm;0;ON;;;;;N;;;;;
+27F1;DOWNWARDS QUADRUPLE ARROW;Sm;0;ON;;;;;N;;;;;
+27F2;ANTICLOCKWISE GAPPED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;;
+27F3;CLOCKWISE GAPPED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;;
+27F4;RIGHT ARROW WITH CIRCLED PLUS;Sm;0;ON;;;;;N;;;;;
+27F5;LONG LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+27F6;LONG RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+27F7;LONG LEFT RIGHT ARROW;Sm;0;ON;;;;;N;;;;;
+27F8;LONG LEFTWARDS DOUBLE ARROW;Sm;0;ON;;;;;N;;;;;
+27F9;LONG RIGHTWARDS DOUBLE ARROW;Sm;0;ON;;;;;N;;;;;
+27FA;LONG LEFT RIGHT DOUBLE ARROW;Sm;0;ON;;;;;N;;;;;
+27FB;LONG LEFTWARDS ARROW FROM BAR;Sm;0;ON;;;;;N;;;;;
+27FC;LONG RIGHTWARDS ARROW FROM BAR;Sm;0;ON;;;;;N;;;;;
+27FD;LONG LEFTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;;
+27FE;LONG RIGHTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;;
+27FF;LONG RIGHTWARDS SQUIGGLE ARROW;Sm;0;ON;;;;;N;;;;;
+2800;BRAILLE PATTERN BLANK;So;0;L;;;;;N;;;;;
+2801;BRAILLE PATTERN DOTS-1;So;0;L;;;;;N;;;;;
+2802;BRAILLE PATTERN DOTS-2;So;0;L;;;;;N;;;;;
+2803;BRAILLE PATTERN DOTS-12;So;0;L;;;;;N;;;;;
+2804;BRAILLE PATTERN DOTS-3;So;0;L;;;;;N;;;;;
+2805;BRAILLE PATTERN DOTS-13;So;0;L;;;;;N;;;;;
+2806;BRAILLE PATTERN DOTS-23;So;0;L;;;;;N;;;;;
+2807;BRAILLE PATTERN DOTS-123;So;0;L;;;;;N;;;;;
+2808;BRAILLE PATTERN DOTS-4;So;0;L;;;;;N;;;;;
+2809;BRAILLE PATTERN DOTS-14;So;0;L;;;;;N;;;;;
+280A;BRAILLE PATTERN DOTS-24;So;0;L;;;;;N;;;;;
+280B;BRAILLE PATTERN DOTS-124;So;0;L;;;;;N;;;;;
+280C;BRAILLE PATTERN DOTS-34;So;0;L;;;;;N;;;;;
+280D;BRAILLE PATTERN DOTS-134;So;0;L;;;;;N;;;;;
+280E;BRAILLE PATTERN DOTS-234;So;0;L;;;;;N;;;;;
+280F;BRAILLE PATTERN DOTS-1234;So;0;L;;;;;N;;;;;
+2810;BRAILLE PATTERN DOTS-5;So;0;L;;;;;N;;;;;
+2811;BRAILLE PATTERN DOTS-15;So;0;L;;;;;N;;;;;
+2812;BRAILLE PATTERN DOTS-25;So;0;L;;;;;N;;;;;
+2813;BRAILLE PATTERN DOTS-125;So;0;L;;;;;N;;;;;
+2814;BRAILLE PATTERN DOTS-35;So;0;L;;;;;N;;;;;
+2815;BRAILLE PATTERN DOTS-135;So;0;L;;;;;N;;;;;
+2816;BRAILLE PATTERN DOTS-235;So;0;L;;;;;N;;;;;
+2817;BRAILLE PATTERN DOTS-1235;So;0;L;;;;;N;;;;;
+2818;BRAILLE PATTERN DOTS-45;So;0;L;;;;;N;;;;;
+2819;BRAILLE PATTERN DOTS-145;So;0;L;;;;;N;;;;;
+281A;BRAILLE PATTERN DOTS-245;So;0;L;;;;;N;;;;;
+281B;BRAILLE PATTERN DOTS-1245;So;0;L;;;;;N;;;;;
+281C;BRAILLE PATTERN DOTS-345;So;0;L;;;;;N;;;;;
+281D;BRAILLE PATTERN DOTS-1345;So;0;L;;;;;N;;;;;
+281E;BRAILLE PATTERN DOTS-2345;So;0;L;;;;;N;;;;;
+281F;BRAILLE PATTERN DOTS-12345;So;0;L;;;;;N;;;;;
+2820;BRAILLE PATTERN DOTS-6;So;0;L;;;;;N;;;;;
+2821;BRAILLE PATTERN DOTS-16;So;0;L;;;;;N;;;;;
+2822;BRAILLE PATTERN DOTS-26;So;0;L;;;;;N;;;;;
+2823;BRAILLE PATTERN DOTS-126;So;0;L;;;;;N;;;;;
+2824;BRAILLE PATTERN DOTS-36;So;0;L;;;;;N;;;;;
+2825;BRAILLE PATTERN DOTS-136;So;0;L;;;;;N;;;;;
+2826;BRAILLE PATTERN DOTS-236;So;0;L;;;;;N;;;;;
+2827;BRAILLE PATTERN DOTS-1236;So;0;L;;;;;N;;;;;
+2828;BRAILLE PATTERN DOTS-46;So;0;L;;;;;N;;;;;
+2829;BRAILLE PATTERN DOTS-146;So;0;L;;;;;N;;;;;
+282A;BRAILLE PATTERN DOTS-246;So;0;L;;;;;N;;;;;
+282B;BRAILLE PATTERN DOTS-1246;So;0;L;;;;;N;;;;;
+282C;BRAILLE PATTERN DOTS-346;So;0;L;;;;;N;;;;;
+282D;BRAILLE PATTERN DOTS-1346;So;0;L;;;;;N;;;;;
+282E;BRAILLE PATTERN DOTS-2346;So;0;L;;;;;N;;;;;
+282F;BRAILLE PATTERN DOTS-12346;So;0;L;;;;;N;;;;;
+2830;BRAILLE PATTERN DOTS-56;So;0;L;;;;;N;;;;;
+2831;BRAILLE PATTERN DOTS-156;So;0;L;;;;;N;;;;;
+2832;BRAILLE PATTERN DOTS-256;So;0;L;;;;;N;;;;;
+2833;BRAILLE PATTERN DOTS-1256;So;0;L;;;;;N;;;;;
+2834;BRAILLE PATTERN DOTS-356;So;0;L;;;;;N;;;;;
+2835;BRAILLE PATTERN DOTS-1356;So;0;L;;;;;N;;;;;
+2836;BRAILLE PATTERN DOTS-2356;So;0;L;;;;;N;;;;;
+2837;BRAILLE PATTERN DOTS-12356;So;0;L;;;;;N;;;;;
+2838;BRAILLE PATTERN DOTS-456;So;0;L;;;;;N;;;;;
+2839;BRAILLE PATTERN DOTS-1456;So;0;L;;;;;N;;;;;
+283A;BRAILLE PATTERN DOTS-2456;So;0;L;;;;;N;;;;;
+283B;BRAILLE PATTERN DOTS-12456;So;0;L;;;;;N;;;;;
+283C;BRAILLE PATTERN DOTS-3456;So;0;L;;;;;N;;;;;
+283D;BRAILLE PATTERN DOTS-13456;So;0;L;;;;;N;;;;;
+283E;BRAILLE PATTERN DOTS-23456;So;0;L;;;;;N;;;;;
+283F;BRAILLE PATTERN DOTS-123456;So;0;L;;;;;N;;;;;
+2840;BRAILLE PATTERN DOTS-7;So;0;L;;;;;N;;;;;
+2841;BRAILLE PATTERN DOTS-17;So;0;L;;;;;N;;;;;
+2842;BRAILLE PATTERN DOTS-27;So;0;L;;;;;N;;;;;
+2843;BRAILLE PATTERN DOTS-127;So;0;L;;;;;N;;;;;
+2844;BRAILLE PATTERN DOTS-37;So;0;L;;;;;N;;;;;
+2845;BRAILLE PATTERN DOTS-137;So;0;L;;;;;N;;;;;
+2846;BRAILLE PATTERN DOTS-237;So;0;L;;;;;N;;;;;
+2847;BRAILLE PATTERN DOTS-1237;So;0;L;;;;;N;;;;;
+2848;BRAILLE PATTERN DOTS-47;So;0;L;;;;;N;;;;;
+2849;BRAILLE PATTERN DOTS-147;So;0;L;;;;;N;;;;;
+284A;BRAILLE PATTERN DOTS-247;So;0;L;;;;;N;;;;;
+284B;BRAILLE PATTERN DOTS-1247;So;0;L;;;;;N;;;;;
+284C;BRAILLE PATTERN DOTS-347;So;0;L;;;;;N;;;;;
+284D;BRAILLE PATTERN DOTS-1347;So;0;L;;;;;N;;;;;
+284E;BRAILLE PATTERN DOTS-2347;So;0;L;;;;;N;;;;;
+284F;BRAILLE PATTERN DOTS-12347;So;0;L;;;;;N;;;;;
+2850;BRAILLE PATTERN DOTS-57;So;0;L;;;;;N;;;;;
+2851;BRAILLE PATTERN DOTS-157;So;0;L;;;;;N;;;;;
+2852;BRAILLE PATTERN DOTS-257;So;0;L;;;;;N;;;;;
+2853;BRAILLE PATTERN DOTS-1257;So;0;L;;;;;N;;;;;
+2854;BRAILLE PATTERN DOTS-357;So;0;L;;;;;N;;;;;
+2855;BRAILLE PATTERN DOTS-1357;So;0;L;;;;;N;;;;;
+2856;BRAILLE PATTERN DOTS-2357;So;0;L;;;;;N;;;;;
+2857;BRAILLE PATTERN DOTS-12357;So;0;L;;;;;N;;;;;
+2858;BRAILLE PATTERN DOTS-457;So;0;L;;;;;N;;;;;
+2859;BRAILLE PATTERN DOTS-1457;So;0;L;;;;;N;;;;;
+285A;BRAILLE PATTERN DOTS-2457;So;0;L;;;;;N;;;;;
+285B;BRAILLE PATTERN DOTS-12457;So;0;L;;;;;N;;;;;
+285C;BRAILLE PATTERN DOTS-3457;So;0;L;;;;;N;;;;;
+285D;BRAILLE PATTERN DOTS-13457;So;0;L;;;;;N;;;;;
+285E;BRAILLE PATTERN DOTS-23457;So;0;L;;;;;N;;;;;
+285F;BRAILLE PATTERN DOTS-123457;So;0;L;;;;;N;;;;;
+2860;BRAILLE PATTERN DOTS-67;So;0;L;;;;;N;;;;;
+2861;BRAILLE PATTERN DOTS-167;So;0;L;;;;;N;;;;;
+2862;BRAILLE PATTERN DOTS-267;So;0;L;;;;;N;;;;;
+2863;BRAILLE PATTERN DOTS-1267;So;0;L;;;;;N;;;;;
+2864;BRAILLE PATTERN DOTS-367;So;0;L;;;;;N;;;;;
+2865;BRAILLE PATTERN DOTS-1367;So;0;L;;;;;N;;;;;
+2866;BRAILLE PATTERN DOTS-2367;So;0;L;;;;;N;;;;;
+2867;BRAILLE PATTERN DOTS-12367;So;0;L;;;;;N;;;;;
+2868;BRAILLE PATTERN DOTS-467;So;0;L;;;;;N;;;;;
+2869;BRAILLE PATTERN DOTS-1467;So;0;L;;;;;N;;;;;
+286A;BRAILLE PATTERN DOTS-2467;So;0;L;;;;;N;;;;;
+286B;BRAILLE PATTERN DOTS-12467;So;0;L;;;;;N;;;;;
+286C;BRAILLE PATTERN DOTS-3467;So;0;L;;;;;N;;;;;
+286D;BRAILLE PATTERN DOTS-13467;So;0;L;;;;;N;;;;;
+286E;BRAILLE PATTERN DOTS-23467;So;0;L;;;;;N;;;;;
+286F;BRAILLE PATTERN DOTS-123467;So;0;L;;;;;N;;;;;
+2870;BRAILLE PATTERN DOTS-567;So;0;L;;;;;N;;;;;
+2871;BRAILLE PATTERN DOTS-1567;So;0;L;;;;;N;;;;;
+2872;BRAILLE PATTERN DOTS-2567;So;0;L;;;;;N;;;;;
+2873;BRAILLE PATTERN DOTS-12567;So;0;L;;;;;N;;;;;
+2874;BRAILLE PATTERN DOTS-3567;So;0;L;;;;;N;;;;;
+2875;BRAILLE PATTERN DOTS-13567;So;0;L;;;;;N;;;;;
+2876;BRAILLE PATTERN DOTS-23567;So;0;L;;;;;N;;;;;
+2877;BRAILLE PATTERN DOTS-123567;So;0;L;;;;;N;;;;;
+2878;BRAILLE PATTERN DOTS-4567;So;0;L;;;;;N;;;;;
+2879;BRAILLE PATTERN DOTS-14567;So;0;L;;;;;N;;;;;
+287A;BRAILLE PATTERN DOTS-24567;So;0;L;;;;;N;;;;;
+287B;BRAILLE PATTERN DOTS-124567;So;0;L;;;;;N;;;;;
+287C;BRAILLE PATTERN DOTS-34567;So;0;L;;;;;N;;;;;
+287D;BRAILLE PATTERN DOTS-134567;So;0;L;;;;;N;;;;;
+287E;BRAILLE PATTERN DOTS-234567;So;0;L;;;;;N;;;;;
+287F;BRAILLE PATTERN DOTS-1234567;So;0;L;;;;;N;;;;;
+2880;BRAILLE PATTERN DOTS-8;So;0;L;;;;;N;;;;;
+2881;BRAILLE PATTERN DOTS-18;So;0;L;;;;;N;;;;;
+2882;BRAILLE PATTERN DOTS-28;So;0;L;;;;;N;;;;;
+2883;BRAILLE PATTERN DOTS-128;So;0;L;;;;;N;;;;;
+2884;BRAILLE PATTERN DOTS-38;So;0;L;;;;;N;;;;;
+2885;BRAILLE PATTERN DOTS-138;So;0;L;;;;;N;;;;;
+2886;BRAILLE PATTERN DOTS-238;So;0;L;;;;;N;;;;;
+2887;BRAILLE PATTERN DOTS-1238;So;0;L;;;;;N;;;;;
+2888;BRAILLE PATTERN DOTS-48;So;0;L;;;;;N;;;;;
+2889;BRAILLE PATTERN DOTS-148;So;0;L;;;;;N;;;;;
+288A;BRAILLE PATTERN DOTS-248;So;0;L;;;;;N;;;;;
+288B;BRAILLE PATTERN DOTS-1248;So;0;L;;;;;N;;;;;
+288C;BRAILLE PATTERN DOTS-348;So;0;L;;;;;N;;;;;
+288D;BRAILLE PATTERN DOTS-1348;So;0;L;;;;;N;;;;;
+288E;BRAILLE PATTERN DOTS-2348;So;0;L;;;;;N;;;;;
+288F;BRAILLE PATTERN DOTS-12348;So;0;L;;;;;N;;;;;
+2890;BRAILLE PATTERN DOTS-58;So;0;L;;;;;N;;;;;
+2891;BRAILLE PATTERN DOTS-158;So;0;L;;;;;N;;;;;
+2892;BRAILLE PATTERN DOTS-258;So;0;L;;;;;N;;;;;
+2893;BRAILLE PATTERN DOTS-1258;So;0;L;;;;;N;;;;;
+2894;BRAILLE PATTERN DOTS-358;So;0;L;;;;;N;;;;;
+2895;BRAILLE PATTERN DOTS-1358;So;0;L;;;;;N;;;;;
+2896;BRAILLE PATTERN DOTS-2358;So;0;L;;;;;N;;;;;
+2897;BRAILLE PATTERN DOTS-12358;So;0;L;;;;;N;;;;;
+2898;BRAILLE PATTERN DOTS-458;So;0;L;;;;;N;;;;;
+2899;BRAILLE PATTERN DOTS-1458;So;0;L;;;;;N;;;;;
+289A;BRAILLE PATTERN DOTS-2458;So;0;L;;;;;N;;;;;
+289B;BRAILLE PATTERN DOTS-12458;So;0;L;;;;;N;;;;;
+289C;BRAILLE PATTERN DOTS-3458;So;0;L;;;;;N;;;;;
+289D;BRAILLE PATTERN DOTS-13458;So;0;L;;;;;N;;;;;
+289E;BRAILLE PATTERN DOTS-23458;So;0;L;;;;;N;;;;;
+289F;BRAILLE PATTERN DOTS-123458;So;0;L;;;;;N;;;;;
+28A0;BRAILLE PATTERN DOTS-68;So;0;L;;;;;N;;;;;
+28A1;BRAILLE PATTERN DOTS-168;So;0;L;;;;;N;;;;;
+28A2;BRAILLE PATTERN DOTS-268;So;0;L;;;;;N;;;;;
+28A3;BRAILLE PATTERN DOTS-1268;So;0;L;;;;;N;;;;;
+28A4;BRAILLE PATTERN DOTS-368;So;0;L;;;;;N;;;;;
+28A5;BRAILLE PATTERN DOTS-1368;So;0;L;;;;;N;;;;;
+28A6;BRAILLE PATTERN DOTS-2368;So;0;L;;;;;N;;;;;
+28A7;BRAILLE PATTERN DOTS-12368;So;0;L;;;;;N;;;;;
+28A8;BRAILLE PATTERN DOTS-468;So;0;L;;;;;N;;;;;
+28A9;BRAILLE PATTERN DOTS-1468;So;0;L;;;;;N;;;;;
+28AA;BRAILLE PATTERN DOTS-2468;So;0;L;;;;;N;;;;;
+28AB;BRAILLE PATTERN DOTS-12468;So;0;L;;;;;N;;;;;
+28AC;BRAILLE PATTERN DOTS-3468;So;0;L;;;;;N;;;;;
+28AD;BRAILLE PATTERN DOTS-13468;So;0;L;;;;;N;;;;;
+28AE;BRAILLE PATTERN DOTS-23468;So;0;L;;;;;N;;;;;
+28AF;BRAILLE PATTERN DOTS-123468;So;0;L;;;;;N;;;;;
+28B0;BRAILLE PATTERN DOTS-568;So;0;L;;;;;N;;;;;
+28B1;BRAILLE PATTERN DOTS-1568;So;0;L;;;;;N;;;;;
+28B2;BRAILLE PATTERN DOTS-2568;So;0;L;;;;;N;;;;;
+28B3;BRAILLE PATTERN DOTS-12568;So;0;L;;;;;N;;;;;
+28B4;BRAILLE PATTERN DOTS-3568;So;0;L;;;;;N;;;;;
+28B5;BRAILLE PATTERN DOTS-13568;So;0;L;;;;;N;;;;;
+28B6;BRAILLE PATTERN DOTS-23568;So;0;L;;;;;N;;;;;
+28B7;BRAILLE PATTERN DOTS-123568;So;0;L;;;;;N;;;;;
+28B8;BRAILLE PATTERN DOTS-4568;So;0;L;;;;;N;;;;;
+28B9;BRAILLE PATTERN DOTS-14568;So;0;L;;;;;N;;;;;
+28BA;BRAILLE PATTERN DOTS-24568;So;0;L;;;;;N;;;;;
+28BB;BRAILLE PATTERN DOTS-124568;So;0;L;;;;;N;;;;;
+28BC;BRAILLE PATTERN DOTS-34568;So;0;L;;;;;N;;;;;
+28BD;BRAILLE PATTERN DOTS-134568;So;0;L;;;;;N;;;;;
+28BE;BRAILLE PATTERN DOTS-234568;So;0;L;;;;;N;;;;;
+28BF;BRAILLE PATTERN DOTS-1234568;So;0;L;;;;;N;;;;;
+28C0;BRAILLE PATTERN DOTS-78;So;0;L;;;;;N;;;;;
+28C1;BRAILLE PATTERN DOTS-178;So;0;L;;;;;N;;;;;
+28C2;BRAILLE PATTERN DOTS-278;So;0;L;;;;;N;;;;;
+28C3;BRAILLE PATTERN DOTS-1278;So;0;L;;;;;N;;;;;
+28C4;BRAILLE PATTERN DOTS-378;So;0;L;;;;;N;;;;;
+28C5;BRAILLE PATTERN DOTS-1378;So;0;L;;;;;N;;;;;
+28C6;BRAILLE PATTERN DOTS-2378;So;0;L;;;;;N;;;;;
+28C7;BRAILLE PATTERN DOTS-12378;So;0;L;;;;;N;;;;;
+28C8;BRAILLE PATTERN DOTS-478;So;0;L;;;;;N;;;;;
+28C9;BRAILLE PATTERN DOTS-1478;So;0;L;;;;;N;;;;;
+28CA;BRAILLE PATTERN DOTS-2478;So;0;L;;;;;N;;;;;
+28CB;BRAILLE PATTERN DOTS-12478;So;0;L;;;;;N;;;;;
+28CC;BRAILLE PATTERN DOTS-3478;So;0;L;;;;;N;;;;;
+28CD;BRAILLE PATTERN DOTS-13478;So;0;L;;;;;N;;;;;
+28CE;BRAILLE PATTERN DOTS-23478;So;0;L;;;;;N;;;;;
+28CF;BRAILLE PATTERN DOTS-123478;So;0;L;;;;;N;;;;;
+28D0;BRAILLE PATTERN DOTS-578;So;0;L;;;;;N;;;;;
+28D1;BRAILLE PATTERN DOTS-1578;So;0;L;;;;;N;;;;;
+28D2;BRAILLE PATTERN DOTS-2578;So;0;L;;;;;N;;;;;
+28D3;BRAILLE PATTERN DOTS-12578;So;0;L;;;;;N;;;;;
+28D4;BRAILLE PATTERN DOTS-3578;So;0;L;;;;;N;;;;;
+28D5;BRAILLE PATTERN DOTS-13578;So;0;L;;;;;N;;;;;
+28D6;BRAILLE PATTERN DOTS-23578;So;0;L;;;;;N;;;;;
+28D7;BRAILLE PATTERN DOTS-123578;So;0;L;;;;;N;;;;;
+28D8;BRAILLE PATTERN DOTS-4578;So;0;L;;;;;N;;;;;
+28D9;BRAILLE PATTERN DOTS-14578;So;0;L;;;;;N;;;;;
+28DA;BRAILLE PATTERN DOTS-24578;So;0;L;;;;;N;;;;;
+28DB;BRAILLE PATTERN DOTS-124578;So;0;L;;;;;N;;;;;
+28DC;BRAILLE PATTERN DOTS-34578;So;0;L;;;;;N;;;;;
+28DD;BRAILLE PATTERN DOTS-134578;So;0;L;;;;;N;;;;;
+28DE;BRAILLE PATTERN DOTS-234578;So;0;L;;;;;N;;;;;
+28DF;BRAILLE PATTERN DOTS-1234578;So;0;L;;;;;N;;;;;
+28E0;BRAILLE PATTERN DOTS-678;So;0;L;;;;;N;;;;;
+28E1;BRAILLE PATTERN DOTS-1678;So;0;L;;;;;N;;;;;
+28E2;BRAILLE PATTERN DOTS-2678;So;0;L;;;;;N;;;;;
+28E3;BRAILLE PATTERN DOTS-12678;So;0;L;;;;;N;;;;;
+28E4;BRAILLE PATTERN DOTS-3678;So;0;L;;;;;N;;;;;
+28E5;BRAILLE PATTERN DOTS-13678;So;0;L;;;;;N;;;;;
+28E6;BRAILLE PATTERN DOTS-23678;So;0;L;;;;;N;;;;;
+28E7;BRAILLE PATTERN DOTS-123678;So;0;L;;;;;N;;;;;
+28E8;BRAILLE PATTERN DOTS-4678;So;0;L;;;;;N;;;;;
+28E9;BRAILLE PATTERN DOTS-14678;So;0;L;;;;;N;;;;;
+28EA;BRAILLE PATTERN DOTS-24678;So;0;L;;;;;N;;;;;
+28EB;BRAILLE PATTERN DOTS-124678;So;0;L;;;;;N;;;;;
+28EC;BRAILLE PATTERN DOTS-34678;So;0;L;;;;;N;;;;;
+28ED;BRAILLE PATTERN DOTS-134678;So;0;L;;;;;N;;;;;
+28EE;BRAILLE PATTERN DOTS-234678;So;0;L;;;;;N;;;;;
+28EF;BRAILLE PATTERN DOTS-1234678;So;0;L;;;;;N;;;;;
+28F0;BRAILLE PATTERN DOTS-5678;So;0;L;;;;;N;;;;;
+28F1;BRAILLE PATTERN DOTS-15678;So;0;L;;;;;N;;;;;
+28F2;BRAILLE PATTERN DOTS-25678;So;0;L;;;;;N;;;;;
+28F3;BRAILLE PATTERN DOTS-125678;So;0;L;;;;;N;;;;;
+28F4;BRAILLE PATTERN DOTS-35678;So;0;L;;;;;N;;;;;
+28F5;BRAILLE PATTERN DOTS-135678;So;0;L;;;;;N;;;;;
+28F6;BRAILLE PATTERN DOTS-235678;So;0;L;;;;;N;;;;;
+28F7;BRAILLE PATTERN DOTS-1235678;So;0;L;;;;;N;;;;;
+28F8;BRAILLE PATTERN DOTS-45678;So;0;L;;;;;N;;;;;
+28F9;BRAILLE PATTERN DOTS-145678;So;0;L;;;;;N;;;;;
+28FA;BRAILLE PATTERN DOTS-245678;So;0;L;;;;;N;;;;;
+28FB;BRAILLE PATTERN DOTS-1245678;So;0;L;;;;;N;;;;;
+28FC;BRAILLE PATTERN DOTS-345678;So;0;L;;;;;N;;;;;
+28FD;BRAILLE PATTERN DOTS-1345678;So;0;L;;;;;N;;;;;
+28FE;BRAILLE PATTERN DOTS-2345678;So;0;L;;;;;N;;;;;
+28FF;BRAILLE PATTERN DOTS-12345678;So;0;L;;;;;N;;;;;
+2900;RIGHTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2901;RIGHTWARDS TWO-HEADED ARROW WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2902;LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2903;RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2904;LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2905;RIGHTWARDS TWO-HEADED ARROW FROM BAR;Sm;0;ON;;;;;N;;;;;
+2906;LEFTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;;
+2907;RIGHTWARDS DOUBLE ARROW FROM BAR;Sm;0;ON;;;;;N;;;;;
+2908;DOWNWARDS ARROW WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;;
+2909;UPWARDS ARROW WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;;
+290A;UPWARDS TRIPLE ARROW;Sm;0;ON;;;;;N;;;;;
+290B;DOWNWARDS TRIPLE ARROW;Sm;0;ON;;;;;N;;;;;
+290C;LEFTWARDS DOUBLE DASH ARROW;Sm;0;ON;;;;;N;;;;;
+290D;RIGHTWARDS DOUBLE DASH ARROW;Sm;0;ON;;;;;N;;;;;
+290E;LEFTWARDS TRIPLE DASH ARROW;Sm;0;ON;;;;;N;;;;;
+290F;RIGHTWARDS TRIPLE DASH ARROW;Sm;0;ON;;;;;N;;;;;
+2910;RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW;Sm;0;ON;;;;;N;;;;;
+2911;RIGHTWARDS ARROW WITH DOTTED STEM;Sm;0;ON;;;;;N;;;;;
+2912;UPWARDS ARROW TO BAR;Sm;0;ON;;;;;N;;;;;
+2913;DOWNWARDS ARROW TO BAR;Sm;0;ON;;;;;N;;;;;
+2914;RIGHTWARDS ARROW WITH TAIL WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2915;RIGHTWARDS ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2916;RIGHTWARDS TWO-HEADED ARROW WITH TAIL;Sm;0;ON;;;;;N;;;;;
+2917;RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2918;RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2919;LEFTWARDS ARROW-TAIL;Sm;0;ON;;;;;N;;;;;
+291A;RIGHTWARDS ARROW-TAIL;Sm;0;ON;;;;;N;;;;;
+291B;LEFTWARDS DOUBLE ARROW-TAIL;Sm;0;ON;;;;;N;;;;;
+291C;RIGHTWARDS DOUBLE ARROW-TAIL;Sm;0;ON;;;;;N;;;;;
+291D;LEFTWARDS ARROW TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;;
+291E;RIGHTWARDS ARROW TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;;
+291F;LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;;
+2920;RIGHTWARDS ARROW FROM BAR TO BLACK DIAMOND;Sm;0;ON;;;;;N;;;;;
+2921;NORTH WEST AND SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+2922;NORTH EAST AND SOUTH WEST ARROW;Sm;0;ON;;;;;N;;;;;
+2923;NORTH WEST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;;
+2924;NORTH EAST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;;
+2925;SOUTH EAST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;;
+2926;SOUTH WEST ARROW WITH HOOK;Sm;0;ON;;;;;N;;;;;
+2927;NORTH WEST ARROW AND NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+2928;NORTH EAST ARROW AND SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+2929;SOUTH EAST ARROW AND SOUTH WEST ARROW;Sm;0;ON;;;;;N;;;;;
+292A;SOUTH WEST ARROW AND NORTH WEST ARROW;Sm;0;ON;;;;;N;;;;;
+292B;RISING DIAGONAL CROSSING FALLING DIAGONAL;Sm;0;ON;;;;;N;;;;;
+292C;FALLING DIAGONAL CROSSING RISING DIAGONAL;Sm;0;ON;;;;;N;;;;;
+292D;SOUTH EAST ARROW CROSSING NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+292E;NORTH EAST ARROW CROSSING SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+292F;FALLING DIAGONAL CROSSING NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+2930;RISING DIAGONAL CROSSING SOUTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+2931;NORTH EAST ARROW CROSSING NORTH WEST ARROW;Sm;0;ON;;;;;N;;;;;
+2932;NORTH WEST ARROW CROSSING NORTH EAST ARROW;Sm;0;ON;;;;;N;;;;;
+2933;WAVE ARROW POINTING DIRECTLY RIGHT;Sm;0;ON;;;;;N;;;;;
+2934;ARROW POINTING RIGHTWARDS THEN CURVING UPWARDS;Sm;0;ON;;;;;N;;;;;
+2935;ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS;Sm;0;ON;;;;;N;;;;;
+2936;ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS;Sm;0;ON;;;;;N;;;;;
+2937;ARROW POINTING DOWNWARDS THEN CURVING RIGHTWARDS;Sm;0;ON;;;;;N;;;;;
+2938;RIGHT-SIDE ARC CLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;;
+2939;LEFT-SIDE ARC ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;;
+293A;TOP ARC ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;;
+293B;BOTTOM ARC ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;;
+293C;TOP ARC CLOCKWISE ARROW WITH MINUS;Sm;0;ON;;;;;N;;;;;
+293D;TOP ARC ANTICLOCKWISE ARROW WITH PLUS;Sm;0;ON;;;;;N;;;;;
+293E;LOWER RIGHT SEMICIRCULAR CLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;;
+293F;LOWER LEFT SEMICIRCULAR ANTICLOCKWISE ARROW;Sm;0;ON;;;;;N;;;;;
+2940;ANTICLOCKWISE CLOSED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;;
+2941;CLOCKWISE CLOSED CIRCLE ARROW;Sm;0;ON;;;;;N;;;;;
+2942;RIGHTWARDS ARROW ABOVE SHORT LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+2943;LEFTWARDS ARROW ABOVE SHORT RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+2944;SHORT RIGHTWARDS ARROW ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+2945;RIGHTWARDS ARROW WITH PLUS BELOW;Sm;0;ON;;;;;N;;;;;
+2946;LEFTWARDS ARROW WITH PLUS BELOW;Sm;0;ON;;;;;N;;;;;
+2947;RIGHTWARDS ARROW THROUGH X;Sm;0;ON;;;;;N;;;;;
+2948;LEFT RIGHT ARROW THROUGH SMALL CIRCLE;Sm;0;ON;;;;;N;;;;;
+2949;UPWARDS TWO-HEADED ARROW FROM SMALL CIRCLE;Sm;0;ON;;;;;N;;;;;
+294A;LEFT BARB UP RIGHT BARB DOWN HARPOON;Sm;0;ON;;;;;N;;;;;
+294B;LEFT BARB DOWN RIGHT BARB UP HARPOON;Sm;0;ON;;;;;N;;;;;
+294C;UP BARB RIGHT DOWN BARB LEFT HARPOON;Sm;0;ON;;;;;N;;;;;
+294D;UP BARB LEFT DOWN BARB RIGHT HARPOON;Sm;0;ON;;;;;N;;;;;
+294E;LEFT BARB UP RIGHT BARB UP HARPOON;Sm;0;ON;;;;;N;;;;;
+294F;UP BARB RIGHT DOWN BARB RIGHT HARPOON;Sm;0;ON;;;;;N;;;;;
+2950;LEFT BARB DOWN RIGHT BARB DOWN HARPOON;Sm;0;ON;;;;;N;;;;;
+2951;UP BARB LEFT DOWN BARB LEFT HARPOON;Sm;0;ON;;;;;N;;;;;
+2952;LEFTWARDS HARPOON WITH BARB UP TO BAR;Sm;0;ON;;;;;N;;;;;
+2953;RIGHTWARDS HARPOON WITH BARB UP TO BAR;Sm;0;ON;;;;;N;;;;;
+2954;UPWARDS HARPOON WITH BARB RIGHT TO BAR;Sm;0;ON;;;;;N;;;;;
+2955;DOWNWARDS HARPOON WITH BARB RIGHT TO BAR;Sm;0;ON;;;;;N;;;;;
+2956;LEFTWARDS HARPOON WITH BARB DOWN TO BAR;Sm;0;ON;;;;;N;;;;;
+2957;RIGHTWARDS HARPOON WITH BARB DOWN TO BAR;Sm;0;ON;;;;;N;;;;;
+2958;UPWARDS HARPOON WITH BARB LEFT TO BAR;Sm;0;ON;;;;;N;;;;;
+2959;DOWNWARDS HARPOON WITH BARB LEFT TO BAR;Sm;0;ON;;;;;N;;;;;
+295A;LEFTWARDS HARPOON WITH BARB UP FROM BAR;Sm;0;ON;;;;;N;;;;;
+295B;RIGHTWARDS HARPOON WITH BARB UP FROM BAR;Sm;0;ON;;;;;N;;;;;
+295C;UPWARDS HARPOON WITH BARB RIGHT FROM BAR;Sm;0;ON;;;;;N;;;;;
+295D;DOWNWARDS HARPOON WITH BARB RIGHT FROM BAR;Sm;0;ON;;;;;N;;;;;
+295E;LEFTWARDS HARPOON WITH BARB DOWN FROM BAR;Sm;0;ON;;;;;N;;;;;
+295F;RIGHTWARDS HARPOON WITH BARB DOWN FROM BAR;Sm;0;ON;;;;;N;;;;;
+2960;UPWARDS HARPOON WITH BARB LEFT FROM BAR;Sm;0;ON;;;;;N;;;;;
+2961;DOWNWARDS HARPOON WITH BARB LEFT FROM BAR;Sm;0;ON;;;;;N;;;;;
+2962;LEFTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;;
+2963;UPWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;;
+2964;RIGHTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;;
+2965;DOWNWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;;
+2966;LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP;Sm;0;ON;;;;;N;;;;;
+2967;LEFTWARDS HARPOON WITH BARB DOWN ABOVE RIGHTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;;
+2968;RIGHTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB UP;Sm;0;ON;;;;;N;;;;;
+2969;RIGHTWARDS HARPOON WITH BARB DOWN ABOVE LEFTWARDS HARPOON WITH BARB DOWN;Sm;0;ON;;;;;N;;;;;
+296A;LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH;Sm;0;ON;;;;;N;;;;;
+296B;LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH;Sm;0;ON;;;;;N;;;;;
+296C;RIGHTWARDS HARPOON WITH BARB UP ABOVE LONG DASH;Sm;0;ON;;;;;N;;;;;
+296D;RIGHTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH;Sm;0;ON;;;;;N;;;;;
+296E;UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;;
+296F;DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT;Sm;0;ON;;;;;N;;;;;
+2970;RIGHT DOUBLE ARROW WITH ROUNDED HEAD;Sm;0;ON;;;;;N;;;;;
+2971;EQUALS SIGN ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+2972;TILDE OPERATOR ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+2973;LEFTWARDS ARROW ABOVE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;;
+2974;RIGHTWARDS ARROW ABOVE TILDE OPERATOR;Sm;0;ON;;;;;N;;;;;
+2975;RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;N;;;;;
+2976;LESS-THAN ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+2977;LEFTWARDS ARROW THROUGH LESS-THAN;Sm;0;ON;;;;;N;;;;;
+2978;GREATER-THAN ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+2979;SUBSET ABOVE RIGHTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+297A;LEFTWARDS ARROW THROUGH SUBSET;Sm;0;ON;;;;;N;;;;;
+297B;SUPERSET ABOVE LEFTWARDS ARROW;Sm;0;ON;;;;;N;;;;;
+297C;LEFT FISH TAIL;Sm;0;ON;;;;;N;;;;;
+297D;RIGHT FISH TAIL;Sm;0;ON;;;;;N;;;;;
+297E;UP FISH TAIL;Sm;0;ON;;;;;N;;;;;
+297F;DOWN FISH TAIL;Sm;0;ON;;;;;N;;;;;
+2980;TRIPLE VERTICAL BAR DELIMITER;Sm;0;ON;;;;;N;;;;;
+2981;Z NOTATION SPOT;Sm;0;ON;;;;;N;;;;;
+2982;Z NOTATION TYPE COLON;Sm;0;ON;;;;;N;;;;;
+2983;LEFT WHITE CURLY BRACKET;Ps;0;ON;;;;;Y;;;;;
+2984;RIGHT WHITE CURLY BRACKET;Pe;0;ON;;;;;Y;;;;;
+2985;LEFT WHITE PARENTHESIS;Ps;0;ON;;;;;Y;;;;;
+2986;RIGHT WHITE PARENTHESIS;Pe;0;ON;;;;;Y;;;;;
+2987;Z NOTATION LEFT IMAGE BRACKET;Ps;0;ON;;;;;Y;;;;;
+2988;Z NOTATION RIGHT IMAGE BRACKET;Pe;0;ON;;;;;Y;;;;;
+2989;Z NOTATION LEFT BINDING BRACKET;Ps;0;ON;;;;;Y;;;;;
+298A;Z NOTATION RIGHT BINDING BRACKET;Pe;0;ON;;;;;Y;;;;;
+298B;LEFT SQUARE BRACKET WITH UNDERBAR;Ps;0;ON;;;;;Y;;;;;
+298C;RIGHT SQUARE BRACKET WITH UNDERBAR;Pe;0;ON;;;;;Y;;;;;
+298D;LEFT SQUARE BRACKET WITH TICK IN TOP CORNER;Ps;0;ON;;;;;Y;;;;;
+298E;RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER;Pe;0;ON;;;;;Y;;;;;
+298F;LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER;Ps;0;ON;;;;;Y;;;;;
+2990;RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER;Pe;0;ON;;;;;Y;;;;;
+2991;LEFT ANGLE BRACKET WITH DOT;Ps;0;ON;;;;;Y;;;;;
+2992;RIGHT ANGLE BRACKET WITH DOT;Pe;0;ON;;;;;Y;;;;;
+2993;LEFT ARC LESS-THAN BRACKET;Ps;0;ON;;;;;Y;;;;;
+2994;RIGHT ARC GREATER-THAN BRACKET;Pe;0;ON;;;;;Y;;;;;
+2995;DOUBLE LEFT ARC GREATER-THAN BRACKET;Ps;0;ON;;;;;Y;;;;;
+2996;DOUBLE RIGHT ARC LESS-THAN BRACKET;Pe;0;ON;;;;;Y;;;;;
+2997;LEFT BLACK TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;;;;;
+2998;RIGHT BLACK TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;;;;;
+2999;DOTTED FENCE;Sm;0;ON;;;;;N;;;;;
+299A;VERTICAL ZIGZAG LINE;Sm;0;ON;;;;;N;;;;;
+299B;MEASURED ANGLE OPENING LEFT;Sm;0;ON;;;;;Y;;;;;
+299C;RIGHT ANGLE VARIANT WITH SQUARE;Sm;0;ON;;;;;Y;;;;;
+299D;MEASURED RIGHT ANGLE WITH DOT;Sm;0;ON;;;;;Y;;;;;
+299E;ANGLE WITH S INSIDE;Sm;0;ON;;;;;Y;;;;;
+299F;ACUTE ANGLE;Sm;0;ON;;;;;Y;;;;;
+29A0;SPHERICAL ANGLE OPENING LEFT;Sm;0;ON;;;;;Y;;;;;
+29A1;SPHERICAL ANGLE OPENING UP;Sm;0;ON;;;;;Y;;;;;
+29A2;TURNED ANGLE;Sm;0;ON;;;;;Y;;;;;
+29A3;REVERSED ANGLE;Sm;0;ON;;;;;Y;;;;;
+29A4;ANGLE WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;;
+29A5;REVERSED ANGLE WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;;
+29A6;OBLIQUE ANGLE OPENING UP;Sm;0;ON;;;;;Y;;;;;
+29A7;OBLIQUE ANGLE OPENING DOWN;Sm;0;ON;;;;;Y;;;;;
+29A8;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT;Sm;0;ON;;;;;Y;;;;;
+29A9;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT;Sm;0;ON;;;;;Y;;;;;
+29AA;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT;Sm;0;ON;;;;;Y;;;;;
+29AB;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT;Sm;0;ON;;;;;Y;;;;;
+29AC;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP;Sm;0;ON;;;;;Y;;;;;
+29AD;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP;Sm;0;ON;;;;;Y;;;;;
+29AE;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN;Sm;0;ON;;;;;Y;;;;;
+29AF;MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN;Sm;0;ON;;;;;Y;;;;;
+29B0;REVERSED EMPTY SET;Sm;0;ON;;;;;N;;;;;
+29B1;EMPTY SET WITH OVERBAR;Sm;0;ON;;;;;N;;;;;
+29B2;EMPTY SET WITH SMALL CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;;
+29B3;EMPTY SET WITH RIGHT ARROW ABOVE;Sm;0;ON;;;;;N;;;;;
+29B4;EMPTY SET WITH LEFT ARROW ABOVE;Sm;0;ON;;;;;N;;;;;
+29B5;CIRCLE WITH HORIZONTAL BAR;Sm;0;ON;;;;;N;;;;;
+29B6;CIRCLED VERTICAL BAR;Sm;0;ON;;;;;N;;;;;
+29B7;CIRCLED PARALLEL;Sm;0;ON;;;;;N;;;;;
+29B8;CIRCLED REVERSE SOLIDUS;Sm;0;ON;;;;;Y;;;;;
+29B9;CIRCLED PERPENDICULAR;Sm;0;ON;;;;;N;;;;;
+29BA;CIRCLE DIVIDED BY HORIZONTAL BAR AND TOP HALF DIVIDED BY VERTICAL BAR;Sm;0;ON;;;;;N;;;;;
+29BB;CIRCLE WITH SUPERIMPOSED X;Sm;0;ON;;;;;N;;;;;
+29BC;CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN;Sm;0;ON;;;;;N;;;;;
+29BD;UP ARROW THROUGH CIRCLE;Sm;0;ON;;;;;N;;;;;
+29BE;CIRCLED WHITE BULLET;Sm;0;ON;;;;;N;;;;;
+29BF;CIRCLED BULLET;Sm;0;ON;;;;;N;;;;;
+29C0;CIRCLED LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+29C1;CIRCLED GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+29C2;CIRCLE WITH SMALL CIRCLE TO THE RIGHT;Sm;0;ON;;;;;Y;;;;;
+29C3;CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT;Sm;0;ON;;;;;Y;;;;;
+29C4;SQUARED RISING DIAGONAL SLASH;Sm;0;ON;;;;;Y;;;;;
+29C5;SQUARED FALLING DIAGONAL SLASH;Sm;0;ON;;;;;Y;;;;;
+29C6;SQUARED ASTERISK;Sm;0;ON;;;;;N;;;;;
+29C7;SQUARED SMALL CIRCLE;Sm;0;ON;;;;;N;;;;;
+29C8;SQUARED SQUARE;Sm;0;ON;;;;;N;;;;;
+29C9;TWO JOINED SQUARES;Sm;0;ON;;;;;Y;;;;;
+29CA;TRIANGLE WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;;
+29CB;TRIANGLE WITH UNDERBAR;Sm;0;ON;;;;;N;;;;;
+29CC;S IN TRIANGLE;Sm;0;ON;;;;;N;;;;;
+29CD;TRIANGLE WITH SERIFS AT BOTTOM;Sm;0;ON;;;;;N;;;;;
+29CE;RIGHT TRIANGLE ABOVE LEFT TRIANGLE;Sm;0;ON;;;;;Y;;;;;
+29CF;LEFT TRIANGLE BESIDE VERTICAL BAR;Sm;0;ON;;;;;Y;;;;;
+29D0;VERTICAL BAR BESIDE RIGHT TRIANGLE;Sm;0;ON;;;;;Y;;;;;
+29D1;BOWTIE WITH LEFT HALF BLACK;Sm;0;ON;;;;;Y;;;;;
+29D2;BOWTIE WITH RIGHT HALF BLACK;Sm;0;ON;;;;;Y;;;;;
+29D3;BLACK BOWTIE;Sm;0;ON;;;;;N;;;;;
+29D4;TIMES WITH LEFT HALF BLACK;Sm;0;ON;;;;;Y;;;;;
+29D5;TIMES WITH RIGHT HALF BLACK;Sm;0;ON;;;;;Y;;;;;
+29D6;WHITE HOURGLASS;Sm;0;ON;;;;;N;;;;;
+29D7;BLACK HOURGLASS;Sm;0;ON;;;;;N;;;;;
+29D8;LEFT WIGGLY FENCE;Ps;0;ON;;;;;Y;;;;;
+29D9;RIGHT WIGGLY FENCE;Pe;0;ON;;;;;Y;;;;;
+29DA;LEFT DOUBLE WIGGLY FENCE;Ps;0;ON;;;;;Y;;;;;
+29DB;RIGHT DOUBLE WIGGLY FENCE;Pe;0;ON;;;;;Y;;;;;
+29DC;INCOMPLETE INFINITY;Sm;0;ON;;;;;Y;;;;;
+29DD;TIE OVER INFINITY;Sm;0;ON;;;;;N;;;;;
+29DE;INFINITY NEGATED WITH VERTICAL BAR;Sm;0;ON;;;;;N;;;;;
+29DF;DOUBLE-ENDED MULTIMAP;Sm;0;ON;;;;;N;;;;;
+29E0;SQUARE WITH CONTOURED OUTLINE;Sm;0;ON;;;;;N;;;;;
+29E1;INCREASES AS;Sm;0;ON;;;;;Y;;;;;
+29E2;SHUFFLE PRODUCT;Sm;0;ON;;;;;N;;;;;
+29E3;EQUALS SIGN AND SLANTED PARALLEL;Sm;0;ON;;;;;Y;;;;;
+29E4;EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE;Sm;0;ON;;;;;Y;;;;;
+29E5;IDENTICAL TO AND SLANTED PARALLEL;Sm;0;ON;;;;;Y;;;;;
+29E6;GLEICH STARK;Sm;0;ON;;;;;N;;;;;
+29E7;THERMODYNAMIC;Sm;0;ON;;;;;N;;;;;
+29E8;DOWN-POINTING TRIANGLE WITH LEFT HALF BLACK;Sm;0;ON;;;;;Y;;;;;
+29E9;DOWN-POINTING TRIANGLE WITH RIGHT HALF BLACK;Sm;0;ON;;;;;Y;;;;;
+29EA;BLACK DIAMOND WITH DOWN ARROW;Sm;0;ON;;;;;N;;;;;
+29EB;BLACK LOZENGE;Sm;0;ON;;;;;N;;;;;
+29EC;WHITE CIRCLE WITH DOWN ARROW;Sm;0;ON;;;;;N;;;;;
+29ED;BLACK CIRCLE WITH DOWN ARROW;Sm;0;ON;;;;;N;;;;;
+29EE;ERROR-BARRED WHITE SQUARE;Sm;0;ON;;;;;N;;;;;
+29EF;ERROR-BARRED BLACK SQUARE;Sm;0;ON;;;;;N;;;;;
+29F0;ERROR-BARRED WHITE DIAMOND;Sm;0;ON;;;;;N;;;;;
+29F1;ERROR-BARRED BLACK DIAMOND;Sm;0;ON;;;;;N;;;;;
+29F2;ERROR-BARRED WHITE CIRCLE;Sm;0;ON;;;;;N;;;;;
+29F3;ERROR-BARRED BLACK CIRCLE;Sm;0;ON;;;;;N;;;;;
+29F4;RULE-DELAYED;Sm;0;ON;;;;;Y;;;;;
+29F5;REVERSE SOLIDUS OPERATOR;Sm;0;ON;;;;;Y;;;;;
+29F6;SOLIDUS WITH OVERBAR;Sm;0;ON;;;;;Y;;;;;
+29F7;REVERSE SOLIDUS WITH HORIZONTAL STROKE;Sm;0;ON;;;;;Y;;;;;
+29F8;BIG SOLIDUS;Sm;0;ON;;;;;Y;;;;;
+29F9;BIG REVERSE SOLIDUS;Sm;0;ON;;;;;Y;;;;;
+29FA;DOUBLE PLUS;Sm;0;ON;;;;;N;;;;;
+29FB;TRIPLE PLUS;Sm;0;ON;;;;;N;;;;;
+29FC;LEFT-POINTING CURVED ANGLE BRACKET;Ps;0;ON;;;;;Y;;;;;
+29FD;RIGHT-POINTING CURVED ANGLE BRACKET;Pe;0;ON;;;;;Y;;;;;
+29FE;TINY;Sm;0;ON;;;;;N;;;;;
+29FF;MINY;Sm;0;ON;;;;;N;;;;;
+2A00;N-ARY CIRCLED DOT OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A01;N-ARY CIRCLED PLUS OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A02;N-ARY CIRCLED TIMES OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A03;N-ARY UNION OPERATOR WITH DOT;Sm;0;ON;;;;;N;;;;;
+2A04;N-ARY UNION OPERATOR WITH PLUS;Sm;0;ON;;;;;N;;;;;
+2A05;N-ARY SQUARE INTERSECTION OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A06;N-ARY SQUARE UNION OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A07;TWO LOGICAL AND OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A08;TWO LOGICAL OR OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A09;N-ARY TIMES OPERATOR;Sm;0;ON;;;;;N;;;;;
+2A0A;MODULO TWO SUM;Sm;0;ON;;;;;Y;;;;;
+2A0B;SUMMATION WITH INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+2A0C;QUADRUPLE INTEGRAL OPERATOR;Sm;0;ON;<compat> 222B 222B 222B 222B;;;;Y;;;;;
+2A0D;FINITE PART INTEGRAL;Sm;0;ON;;;;;Y;;;;;
+2A0E;INTEGRAL WITH DOUBLE STROKE;Sm;0;ON;;;;;Y;;;;;
+2A0F;INTEGRAL AVERAGE WITH SLASH;Sm;0;ON;;;;;Y;;;;;
+2A10;CIRCULATION FUNCTION;Sm;0;ON;;;;;Y;;;;;
+2A11;ANTICLOCKWISE INTEGRATION;Sm;0;ON;;;;;Y;;;;;
+2A12;LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE;Sm;0;ON;;;;;Y;;;;;
+2A13;LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE;Sm;0;ON;;;;;Y;;;;;
+2A14;LINE INTEGRATION NOT INCLUDING THE POLE;Sm;0;ON;;;;;Y;;;;;
+2A15;INTEGRAL AROUND A POINT OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2A16;QUATERNION INTEGRAL OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2A17;INTEGRAL WITH LEFTWARDS ARROW WITH HOOK;Sm;0;ON;;;;;Y;;;;;
+2A18;INTEGRAL WITH TIMES SIGN;Sm;0;ON;;;;;Y;;;;;
+2A19;INTEGRAL WITH INTERSECTION;Sm;0;ON;;;;;Y;;;;;
+2A1A;INTEGRAL WITH UNION;Sm;0;ON;;;;;Y;;;;;
+2A1B;INTEGRAL WITH OVERBAR;Sm;0;ON;;;;;Y;;;;;
+2A1C;INTEGRAL WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;;
+2A1D;JOIN;Sm;0;ON;;;;;N;;;;;
+2A1E;LARGE LEFT TRIANGLE OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2A1F;Z NOTATION SCHEMA COMPOSITION;Sm;0;ON;;;;;Y;;;;;
+2A20;Z NOTATION SCHEMA PIPING;Sm;0;ON;;;;;Y;;;;;
+2A21;Z NOTATION SCHEMA PROJECTION;Sm;0;ON;;;;;Y;;;;;
+2A22;PLUS SIGN WITH SMALL CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;;
+2A23;PLUS SIGN WITH CIRCUMFLEX ACCENT ABOVE;Sm;0;ON;;;;;N;;;;;
+2A24;PLUS SIGN WITH TILDE ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A25;PLUS SIGN WITH DOT BELOW;Sm;0;ON;;;;;N;;;;;
+2A26;PLUS SIGN WITH TILDE BELOW;Sm;0;ON;;;;;Y;;;;;
+2A27;PLUS SIGN WITH SUBSCRIPT TWO;Sm;0;ON;;;;;N;;;;;
+2A28;PLUS SIGN WITH BLACK TRIANGLE;Sm;0;ON;;;;;N;;;;;
+2A29;MINUS SIGN WITH COMMA ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A2A;MINUS SIGN WITH DOT BELOW;Sm;0;ON;;;;;N;;;;;
+2A2B;MINUS SIGN WITH FALLING DOTS;Sm;0;ON;;;;;Y;;;;;
+2A2C;MINUS SIGN WITH RISING DOTS;Sm;0;ON;;;;;Y;;;;;
+2A2D;PLUS SIGN IN LEFT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;;
+2A2E;PLUS SIGN IN RIGHT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;;
+2A2F;VECTOR OR CROSS PRODUCT;Sm;0;ON;;;;;N;;;;;
+2A30;MULTIPLICATION SIGN WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;;
+2A31;MULTIPLICATION SIGN WITH UNDERBAR;Sm;0;ON;;;;;N;;;;;
+2A32;SEMIDIRECT PRODUCT WITH BOTTOM CLOSED;Sm;0;ON;;;;;N;;;;;
+2A33;SMASH PRODUCT;Sm;0;ON;;;;;N;;;;;
+2A34;MULTIPLICATION SIGN IN LEFT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;;
+2A35;MULTIPLICATION SIGN IN RIGHT HALF CIRCLE;Sm;0;ON;;;;;Y;;;;;
+2A36;CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT;Sm;0;ON;;;;;N;;;;;
+2A37;MULTIPLICATION SIGN IN DOUBLE CIRCLE;Sm;0;ON;;;;;N;;;;;
+2A38;CIRCLED DIVISION SIGN;Sm;0;ON;;;;;N;;;;;
+2A39;PLUS SIGN IN TRIANGLE;Sm;0;ON;;;;;N;;;;;
+2A3A;MINUS SIGN IN TRIANGLE;Sm;0;ON;;;;;N;;;;;
+2A3B;MULTIPLICATION SIGN IN TRIANGLE;Sm;0;ON;;;;;N;;;;;
+2A3C;INTERIOR PRODUCT;Sm;0;ON;;;;;Y;;;;;
+2A3D;RIGHTHAND INTERIOR PRODUCT;Sm;0;ON;;;;;Y;;;;;
+2A3E;Z NOTATION RELATIONAL COMPOSITION;Sm;0;ON;;;;;Y;;;;;
+2A3F;AMALGAMATION OR COPRODUCT;Sm;0;ON;;;;;N;;;;;
+2A40;INTERSECTION WITH DOT;Sm;0;ON;;;;;N;;;;;
+2A41;UNION WITH MINUS SIGN;Sm;0;ON;;;;;N;;;;;
+2A42;UNION WITH OVERBAR;Sm;0;ON;;;;;N;;;;;
+2A43;INTERSECTION WITH OVERBAR;Sm;0;ON;;;;;N;;;;;
+2A44;INTERSECTION WITH LOGICAL AND;Sm;0;ON;;;;;N;;;;;
+2A45;UNION WITH LOGICAL OR;Sm;0;ON;;;;;N;;;;;
+2A46;UNION ABOVE INTERSECTION;Sm;0;ON;;;;;N;;;;;
+2A47;INTERSECTION ABOVE UNION;Sm;0;ON;;;;;N;;;;;
+2A48;UNION ABOVE BAR ABOVE INTERSECTION;Sm;0;ON;;;;;N;;;;;
+2A49;INTERSECTION ABOVE BAR ABOVE UNION;Sm;0;ON;;;;;N;;;;;
+2A4A;UNION BESIDE AND JOINED WITH UNION;Sm;0;ON;;;;;N;;;;;
+2A4B;INTERSECTION BESIDE AND JOINED WITH INTERSECTION;Sm;0;ON;;;;;N;;;;;
+2A4C;CLOSED UNION WITH SERIFS;Sm;0;ON;;;;;N;;;;;
+2A4D;CLOSED INTERSECTION WITH SERIFS;Sm;0;ON;;;;;N;;;;;
+2A4E;DOUBLE SQUARE INTERSECTION;Sm;0;ON;;;;;N;;;;;
+2A4F;DOUBLE SQUARE UNION;Sm;0;ON;;;;;N;;;;;
+2A50;CLOSED UNION WITH SERIFS AND SMASH PRODUCT;Sm;0;ON;;;;;N;;;;;
+2A51;LOGICAL AND WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;;
+2A52;LOGICAL OR WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;;
+2A53;DOUBLE LOGICAL AND;Sm;0;ON;;;;;N;;;;;
+2A54;DOUBLE LOGICAL OR;Sm;0;ON;;;;;N;;;;;
+2A55;TWO INTERSECTING LOGICAL AND;Sm;0;ON;;;;;N;;;;;
+2A56;TWO INTERSECTING LOGICAL OR;Sm;0;ON;;;;;N;;;;;
+2A57;SLOPING LARGE OR;Sm;0;ON;;;;;Y;;;;;
+2A58;SLOPING LARGE AND;Sm;0;ON;;;;;Y;;;;;
+2A59;LOGICAL OR OVERLAPPING LOGICAL AND;Sm;0;ON;;;;;N;;;;;
+2A5A;LOGICAL AND WITH MIDDLE STEM;Sm;0;ON;;;;;N;;;;;
+2A5B;LOGICAL OR WITH MIDDLE STEM;Sm;0;ON;;;;;N;;;;;
+2A5C;LOGICAL AND WITH HORIZONTAL DASH;Sm;0;ON;;;;;N;;;;;
+2A5D;LOGICAL OR WITH HORIZONTAL DASH;Sm;0;ON;;;;;N;;;;;
+2A5E;LOGICAL AND WITH DOUBLE OVERBAR;Sm;0;ON;;;;;N;;;;;
+2A5F;LOGICAL AND WITH UNDERBAR;Sm;0;ON;;;;;N;;;;;
+2A60;LOGICAL AND WITH DOUBLE UNDERBAR;Sm;0;ON;;;;;N;;;;;
+2A61;SMALL VEE WITH UNDERBAR;Sm;0;ON;;;;;N;;;;;
+2A62;LOGICAL OR WITH DOUBLE OVERBAR;Sm;0;ON;;;;;N;;;;;
+2A63;LOGICAL OR WITH DOUBLE UNDERBAR;Sm;0;ON;;;;;N;;;;;
+2A64;Z NOTATION DOMAIN ANTIRESTRICTION;Sm;0;ON;;;;;Y;;;;;
+2A65;Z NOTATION RANGE ANTIRESTRICTION;Sm;0;ON;;;;;Y;;;;;
+2A66;EQUALS SIGN WITH DOT BELOW;Sm;0;ON;;;;;N;;;;;
+2A67;IDENTICAL WITH DOT ABOVE;Sm;0;ON;;;;;N;;;;;
+2A68;TRIPLE HORIZONTAL BAR WITH DOUBLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2A69;TRIPLE HORIZONTAL BAR WITH TRIPLE VERTICAL STROKE;Sm;0;ON;;;;;N;;;;;
+2A6A;TILDE OPERATOR WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A6B;TILDE OPERATOR WITH RISING DOTS;Sm;0;ON;;;;;Y;;;;;
+2A6C;SIMILAR MINUS SIMILAR;Sm;0;ON;;;;;Y;;;;;
+2A6D;CONGRUENT WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A6E;EQUALS WITH ASTERISK;Sm;0;ON;;;;;N;;;;;
+2A6F;ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT;Sm;0;ON;;;;;Y;;;;;
+2A70;APPROXIMATELY EQUAL OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2A71;EQUALS SIGN ABOVE PLUS SIGN;Sm;0;ON;;;;;N;;;;;
+2A72;PLUS SIGN ABOVE EQUALS SIGN;Sm;0;ON;;;;;N;;;;;
+2A73;EQUALS SIGN ABOVE TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2A74;DOUBLE COLON EQUAL;Sm;0;ON;<compat> 003A 003A 003D;;;;Y;;;;;
+2A75;TWO CONSECUTIVE EQUALS SIGNS;Sm;0;ON;<compat> 003D 003D;;;;N;;;;;
+2A76;THREE CONSECUTIVE EQUALS SIGNS;Sm;0;ON;<compat> 003D 003D 003D;;;;N;;;;;
+2A77;EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW;Sm;0;ON;;;;;N;;;;;
+2A78;EQUIVALENT WITH FOUR DOTS ABOVE;Sm;0;ON;;;;;N;;;;;
+2A79;LESS-THAN WITH CIRCLE INSIDE;Sm;0;ON;;;;;Y;;;;;
+2A7A;GREATER-THAN WITH CIRCLE INSIDE;Sm;0;ON;;;;;Y;;;;;
+2A7B;LESS-THAN WITH QUESTION MARK ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A7C;GREATER-THAN WITH QUESTION MARK ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A7D;LESS-THAN OR SLANTED EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2A7E;GREATER-THAN OR SLANTED EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2A7F;LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;;
+2A80;GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;;
+2A81;LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A82;GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;;
+2A83;LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT;Sm;0;ON;;;;;Y;;;;;
+2A84;GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT;Sm;0;ON;;;;;Y;;;;;
+2A85;LESS-THAN OR APPROXIMATE;Sm;0;ON;;;;;Y;;;;;
+2A86;GREATER-THAN OR APPROXIMATE;Sm;0;ON;;;;;Y;;;;;
+2A87;LESS-THAN AND SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2A88;GREATER-THAN AND SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2A89;LESS-THAN AND NOT APPROXIMATE;Sm;0;ON;;;;;Y;;;;;
+2A8A;GREATER-THAN AND NOT APPROXIMATE;Sm;0;ON;;;;;Y;;;;;
+2A8B;LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2A8C;GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2A8D;LESS-THAN ABOVE SIMILAR OR EQUAL;Sm;0;ON;;;;;Y;;;;;
+2A8E;GREATER-THAN ABOVE SIMILAR OR EQUAL;Sm;0;ON;;;;;Y;;;;;
+2A8F;LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2A90;GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2A91;LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL;Sm;0;ON;;;;;Y;;;;;
+2A92;GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL;Sm;0;ON;;;;;Y;;;;;
+2A93;LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;;
+2A94;GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;;
+2A95;SLANTED EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2A96;SLANTED EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2A97;SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;;
+2A98;SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE;Sm;0;ON;;;;;Y;;;;;
+2A99;DOUBLE-LINE EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2A9A;DOUBLE-LINE EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2A9B;DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2A9C;DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2A9D;SIMILAR OR LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2A9E;SIMILAR OR GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2A9F;SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AA0;SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AA1;DOUBLE NESTED LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2AA2;DOUBLE NESTED GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2AA3;DOUBLE NESTED LESS-THAN WITH UNDERBAR;Sm;0;ON;;;;;Y;;;;;
+2AA4;GREATER-THAN OVERLAPPING LESS-THAN;Sm;0;ON;;;;;N;;;;;
+2AA5;GREATER-THAN BESIDE LESS-THAN;Sm;0;ON;;;;;N;;;;;
+2AA6;LESS-THAN CLOSED BY CURVE;Sm;0;ON;;;;;Y;;;;;
+2AA7;GREATER-THAN CLOSED BY CURVE;Sm;0;ON;;;;;Y;;;;;
+2AA8;LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;;
+2AA9;GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL;Sm;0;ON;;;;;Y;;;;;
+2AAA;SMALLER THAN;Sm;0;ON;;;;;Y;;;;;
+2AAB;LARGER THAN;Sm;0;ON;;;;;Y;;;;;
+2AAC;SMALLER THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AAD;LARGER THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AAE;EQUALS SIGN WITH BUMPY ABOVE;Sm;0;ON;;;;;N;;;;;
+2AAF;PRECEDES ABOVE SINGLE-LINE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AB0;SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AB1;PRECEDES ABOVE SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AB2;SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AB3;PRECEDES ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AB4;SUCCEEDS ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AB5;PRECEDES ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AB6;SUCCEEDS ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AB7;PRECEDES ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AB8;SUCCEEDS ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AB9;PRECEDES ABOVE NOT ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2ABA;SUCCEEDS ABOVE NOT ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2ABB;DOUBLE PRECEDES;Sm;0;ON;;;;;Y;;;;;
+2ABC;DOUBLE SUCCEEDS;Sm;0;ON;;;;;Y;;;;;
+2ABD;SUBSET WITH DOT;Sm;0;ON;;;;;Y;;;;;
+2ABE;SUPERSET WITH DOT;Sm;0;ON;;;;;Y;;;;;
+2ABF;SUBSET WITH PLUS SIGN BELOW;Sm;0;ON;;;;;Y;;;;;
+2AC0;SUPERSET WITH PLUS SIGN BELOW;Sm;0;ON;;;;;Y;;;;;
+2AC1;SUBSET WITH MULTIPLICATION SIGN BELOW;Sm;0;ON;;;;;Y;;;;;
+2AC2;SUPERSET WITH MULTIPLICATION SIGN BELOW;Sm;0;ON;;;;;Y;;;;;
+2AC3;SUBSET OF OR EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;;
+2AC4;SUPERSET OF OR EQUAL TO WITH DOT ABOVE;Sm;0;ON;;;;;Y;;;;;
+2AC5;SUBSET OF ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AC6;SUPERSET OF ABOVE EQUALS SIGN;Sm;0;ON;;;;;Y;;;;;
+2AC7;SUBSET OF ABOVE TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2AC8;SUPERSET OF ABOVE TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2AC9;SUBSET OF ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2ACA;SUPERSET OF ABOVE ALMOST EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2ACB;SUBSET OF ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2ACC;SUPERSET OF ABOVE NOT EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2ACD;SQUARE LEFT OPEN BOX OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2ACE;SQUARE RIGHT OPEN BOX OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2ACF;CLOSED SUBSET;Sm;0;ON;;;;;Y;;;;;
+2AD0;CLOSED SUPERSET;Sm;0;ON;;;;;Y;;;;;
+2AD1;CLOSED SUBSET OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AD2;CLOSED SUPERSET OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AD3;SUBSET ABOVE SUPERSET;Sm;0;ON;;;;;Y;;;;;
+2AD4;SUPERSET ABOVE SUBSET;Sm;0;ON;;;;;Y;;;;;
+2AD5;SUBSET ABOVE SUBSET;Sm;0;ON;;;;;Y;;;;;
+2AD6;SUPERSET ABOVE SUPERSET;Sm;0;ON;;;;;Y;;;;;
+2AD7;SUPERSET BESIDE SUBSET;Sm;0;ON;;;;;N;;;;;
+2AD8;SUPERSET BESIDE AND JOINED BY DASH WITH SUBSET;Sm;0;ON;;;;;N;;;;;
+2AD9;ELEMENT OF OPENING DOWNWARDS;Sm;0;ON;;;;;N;;;;;
+2ADA;PITCHFORK WITH TEE TOP;Sm;0;ON;;;;;N;;;;;
+2ADB;TRANSVERSAL INTERSECTION;Sm;0;ON;;;;;N;;;;;
+2ADC;FORKING;Sm;0;ON;2ADD 0338;;;;Y;;not independent;;;
+2ADD;NONFORKING;Sm;0;ON;;;;;N;;independent;;;
+2ADE;SHORT LEFT TACK;Sm;0;ON;;;;;Y;;;;;
+2ADF;SHORT DOWN TACK;Sm;0;ON;;;;;N;;;;;
+2AE0;SHORT UP TACK;Sm;0;ON;;;;;N;;;;;
+2AE1;PERPENDICULAR WITH S;Sm;0;ON;;;;;N;;;;;
+2AE2;VERTICAL BAR TRIPLE RIGHT TURNSTILE;Sm;0;ON;;;;;Y;;;;;
+2AE3;DOUBLE VERTICAL BAR LEFT TURNSTILE;Sm;0;ON;;;;;Y;;;;;
+2AE4;VERTICAL BAR DOUBLE LEFT TURNSTILE;Sm;0;ON;;;;;Y;;;;;
+2AE5;DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE;Sm;0;ON;;;;;Y;;;;;
+2AE6;LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL;Sm;0;ON;;;;;Y;;;;;
+2AE7;SHORT DOWN TACK WITH OVERBAR;Sm;0;ON;;;;;N;;;;;
+2AE8;SHORT UP TACK WITH UNDERBAR;Sm;0;ON;;;;;N;;;;;
+2AE9;SHORT UP TACK ABOVE SHORT DOWN TACK;Sm;0;ON;;;;;N;;;;;
+2AEA;DOUBLE DOWN TACK;Sm;0;ON;;;;;N;;;;;
+2AEB;DOUBLE UP TACK;Sm;0;ON;;;;;N;;;;;
+2AEC;DOUBLE STROKE NOT SIGN;Sm;0;ON;;;;;Y;;;;;
+2AED;REVERSED DOUBLE STROKE NOT SIGN;Sm;0;ON;;;;;Y;;;;;
+2AEE;DOES NOT DIVIDE WITH REVERSED NEGATION SLASH;Sm;0;ON;;;;;Y;;;;;
+2AEF;VERTICAL LINE WITH CIRCLE ABOVE;Sm;0;ON;;;;;N;;;;;
+2AF0;VERTICAL LINE WITH CIRCLE BELOW;Sm;0;ON;;;;;N;;;;;
+2AF1;DOWN TACK WITH CIRCLE BELOW;Sm;0;ON;;;;;N;;;;;
+2AF2;PARALLEL WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;;
+2AF3;PARALLEL WITH TILDE OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2AF4;TRIPLE VERTICAL BAR BINARY RELATION;Sm;0;ON;;;;;N;;;;;
+2AF5;TRIPLE VERTICAL BAR WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;;
+2AF6;TRIPLE COLON OPERATOR;Sm;0;ON;;;;;N;;;;;
+2AF7;TRIPLE NESTED LESS-THAN;Sm;0;ON;;;;;Y;;;;;
+2AF8;TRIPLE NESTED GREATER-THAN;Sm;0;ON;;;;;Y;;;;;
+2AF9;DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AFA;DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO;Sm;0;ON;;;;;Y;;;;;
+2AFB;TRIPLE SOLIDUS BINARY RELATION;Sm;0;ON;;;;;Y;;;;;
+2AFC;LARGE TRIPLE VERTICAL BAR OPERATOR;Sm;0;ON;;;;;N;;;;;
+2AFD;DOUBLE SOLIDUS OPERATOR;Sm;0;ON;;;;;Y;;;;;
+2AFE;WHITE VERTICAL BAR;Sm;0;ON;;;;;N;;;;;
+2AFF;N-ARY WHITE VERTICAL BAR;Sm;0;ON;;;;;N;;;;;
+2B00;NORTH EAST WHITE ARROW;So;0;ON;;;;;N;;;;;
+2B01;NORTH WEST WHITE ARROW;So;0;ON;;;;;N;;;;;
+2B02;SOUTH EAST WHITE ARROW;So;0;ON;;;;;N;;;;;
+2B03;SOUTH WEST WHITE ARROW;So;0;ON;;;;;N;;;;;
+2B04;LEFT RIGHT WHITE ARROW;So;0;ON;;;;;N;;;;;
+2B05;LEFTWARDS BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B06;UPWARDS BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B07;DOWNWARDS BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B08;NORTH EAST BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B09;NORTH WEST BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B0A;SOUTH EAST BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B0B;SOUTH WEST BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B0C;LEFT RIGHT BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B0D;UP DOWN BLACK ARROW;So;0;ON;;;;;N;;;;;
+2B0E;RIGHTWARDS ARROW WITH TIP DOWNWARDS;So;0;ON;;;;;N;;;;;
+2B0F;RIGHTWARDS ARROW WITH TIP UPWARDS;So;0;ON;;;;;N;;;;;
+2B10;LEFTWARDS ARROW WITH TIP DOWNWARDS;So;0;ON;;;;;N;;;;;
+2B11;LEFTWARDS ARROW WITH TIP UPWARDS;So;0;ON;;;;;N;;;;;
+2B12;SQUARE WITH TOP HALF BLACK;So;0;ON;;;;;N;;;;;
+2B13;SQUARE WITH BOTTOM HALF BLACK;So;0;ON;;;;;N;;;;;
+2B14;SQUARE WITH UPPER RIGHT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;;
+2B15;SQUARE WITH LOWER LEFT DIAGONAL HALF BLACK;So;0;ON;;;;;N;;;;;
+2B16;DIAMOND WITH LEFT HALF BLACK;So;0;ON;;;;;N;;;;;
+2B17;DIAMOND WITH RIGHT HALF BLACK;So;0;ON;;;;;N;;;;;
+2B18;DIAMOND WITH TOP HALF BLACK;So;0;ON;;;;;N;;;;;
+2B19;DIAMOND WITH BOTTOM HALF BLACK;So;0;ON;;;;;N;;;;;
+2B1A;DOTTED SQUARE;So;0;ON;;;;;N;;;;;
+2B20;WHITE PENTAGON;So;0;ON;;;;;N;;;;;
+2B21;WHITE HEXAGON;So;0;ON;;;;;N;;;;;
+2B22;BLACK HEXAGON;So;0;ON;;;;;N;;;;;
+2B23;HORIZONTAL BLACK HEXAGON;So;0;ON;;;;;N;;;;;
+2C00;GLAGOLITIC CAPITAL LETTER AZU;Lu;0;L;;;;;N;;;;2C30;
+2C01;GLAGOLITIC CAPITAL LETTER BUKY;Lu;0;L;;;;;N;;;;2C31;
+2C02;GLAGOLITIC CAPITAL LETTER VEDE;Lu;0;L;;;;;N;;;;2C32;
+2C03;GLAGOLITIC CAPITAL LETTER GLAGOLI;Lu;0;L;;;;;N;;;;2C33;
+2C04;GLAGOLITIC CAPITAL LETTER DOBRO;Lu;0;L;;;;;N;;;;2C34;
+2C05;GLAGOLITIC CAPITAL LETTER YESTU;Lu;0;L;;;;;N;;;;2C35;
+2C06;GLAGOLITIC CAPITAL LETTER ZHIVETE;Lu;0;L;;;;;N;;;;2C36;
+2C07;GLAGOLITIC CAPITAL LETTER DZELO;Lu;0;L;;;;;N;;;;2C37;
+2C08;GLAGOLITIC CAPITAL LETTER ZEMLJA;Lu;0;L;;;;;N;;;;2C38;
+2C09;GLAGOLITIC CAPITAL LETTER IZHE;Lu;0;L;;;;;N;;;;2C39;
+2C0A;GLAGOLITIC CAPITAL LETTER INITIAL IZHE;Lu;0;L;;;;;N;;;;2C3A;
+2C0B;GLAGOLITIC CAPITAL LETTER I;Lu;0;L;;;;;N;;;;2C3B;
+2C0C;GLAGOLITIC CAPITAL LETTER DJERVI;Lu;0;L;;;;;N;;;;2C3C;
+2C0D;GLAGOLITIC CAPITAL LETTER KAKO;Lu;0;L;;;;;N;;;;2C3D;
+2C0E;GLAGOLITIC CAPITAL LETTER LJUDIJE;Lu;0;L;;;;;N;;;;2C3E;
+2C0F;GLAGOLITIC CAPITAL LETTER MYSLITE;Lu;0;L;;;;;N;;;;2C3F;
+2C10;GLAGOLITIC CAPITAL LETTER NASHI;Lu;0;L;;;;;N;;;;2C40;
+2C11;GLAGOLITIC CAPITAL LETTER ONU;Lu;0;L;;;;;N;;;;2C41;
+2C12;GLAGOLITIC CAPITAL LETTER POKOJI;Lu;0;L;;;;;N;;;;2C42;
+2C13;GLAGOLITIC CAPITAL LETTER RITSI;Lu;0;L;;;;;N;;;;2C43;
+2C14;GLAGOLITIC CAPITAL LETTER SLOVO;Lu;0;L;;;;;N;;;;2C44;
+2C15;GLAGOLITIC CAPITAL LETTER TVRIDO;Lu;0;L;;;;;N;;;;2C45;
+2C16;GLAGOLITIC CAPITAL LETTER UKU;Lu;0;L;;;;;N;;;;2C46;
+2C17;GLAGOLITIC CAPITAL LETTER FRITU;Lu;0;L;;;;;N;;;;2C47;
+2C18;GLAGOLITIC CAPITAL LETTER HERU;Lu;0;L;;;;;N;;;;2C48;
+2C19;GLAGOLITIC CAPITAL LETTER OTU;Lu;0;L;;;;;N;;;;2C49;
+2C1A;GLAGOLITIC CAPITAL LETTER PE;Lu;0;L;;;;;N;;;;2C4A;
+2C1B;GLAGOLITIC CAPITAL LETTER SHTA;Lu;0;L;;;;;N;;;;2C4B;
+2C1C;GLAGOLITIC CAPITAL LETTER TSI;Lu;0;L;;;;;N;;;;2C4C;
+2C1D;GLAGOLITIC CAPITAL LETTER CHRIVI;Lu;0;L;;;;;N;;;;2C4D;
+2C1E;GLAGOLITIC CAPITAL LETTER SHA;Lu;0;L;;;;;N;;;;2C4E;
+2C1F;GLAGOLITIC CAPITAL LETTER YERU;Lu;0;L;;;;;N;;;;2C4F;
+2C20;GLAGOLITIC CAPITAL LETTER YERI;Lu;0;L;;;;;N;;;;2C50;
+2C21;GLAGOLITIC CAPITAL LETTER YATI;Lu;0;L;;;;;N;;;;2C51;
+2C22;GLAGOLITIC CAPITAL LETTER SPIDERY HA;Lu;0;L;;;;;N;;;;2C52;
+2C23;GLAGOLITIC CAPITAL LETTER YU;Lu;0;L;;;;;N;;;;2C53;
+2C24;GLAGOLITIC CAPITAL LETTER SMALL YUS;Lu;0;L;;;;;N;;;;2C54;
+2C25;GLAGOLITIC CAPITAL LETTER SMALL YUS WITH TAIL;Lu;0;L;;;;;N;;;;2C55;
+2C26;GLAGOLITIC CAPITAL LETTER YO;Lu;0;L;;;;;N;;;;2C56;
+2C27;GLAGOLITIC CAPITAL LETTER IOTATED SMALL YUS;Lu;0;L;;;;;N;;;;2C57;
+2C28;GLAGOLITIC CAPITAL LETTER BIG YUS;Lu;0;L;;;;;N;;;;2C58;
+2C29;GLAGOLITIC CAPITAL LETTER IOTATED BIG YUS;Lu;0;L;;;;;N;;;;2C59;
+2C2A;GLAGOLITIC CAPITAL LETTER FITA;Lu;0;L;;;;;N;;;;2C5A;
+2C2B;GLAGOLITIC CAPITAL LETTER IZHITSA;Lu;0;L;;;;;N;;;;2C5B;
+2C2C;GLAGOLITIC CAPITAL LETTER SHTAPIC;Lu;0;L;;;;;N;;;;2C5C;
+2C2D;GLAGOLITIC CAPITAL LETTER TROKUTASTI A;Lu;0;L;;;;;N;;;;2C5D;
+2C2E;GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE;Lu;0;L;;;;;N;;;;2C5E;
+2C30;GLAGOLITIC SMALL LETTER AZU;Ll;0;L;;;;;N;;;2C00;;2C00
+2C31;GLAGOLITIC SMALL LETTER BUKY;Ll;0;L;;;;;N;;;2C01;;2C01
+2C32;GLAGOLITIC SMALL LETTER VEDE;Ll;0;L;;;;;N;;;2C02;;2C02
+2C33;GLAGOLITIC SMALL LETTER GLAGOLI;Ll;0;L;;;;;N;;;2C03;;2C03
+2C34;GLAGOLITIC SMALL LETTER DOBRO;Ll;0;L;;;;;N;;;2C04;;2C04
+2C35;GLAGOLITIC SMALL LETTER YESTU;Ll;0;L;;;;;N;;;2C05;;2C05
+2C36;GLAGOLITIC SMALL LETTER ZHIVETE;Ll;0;L;;;;;N;;;2C06;;2C06
+2C37;GLAGOLITIC SMALL LETTER DZELO;Ll;0;L;;;;;N;;;2C07;;2C07
+2C38;GLAGOLITIC SMALL LETTER ZEMLJA;Ll;0;L;;;;;N;;;2C08;;2C08
+2C39;GLAGOLITIC SMALL LETTER IZHE;Ll;0;L;;;;;N;;;2C09;;2C09
+2C3A;GLAGOLITIC SMALL LETTER INITIAL IZHE;Ll;0;L;;;;;N;;;2C0A;;2C0A
+2C3B;GLAGOLITIC SMALL LETTER I;Ll;0;L;;;;;N;;;2C0B;;2C0B
+2C3C;GLAGOLITIC SMALL LETTER DJERVI;Ll;0;L;;;;;N;;;2C0C;;2C0C
+2C3D;GLAGOLITIC SMALL LETTER KAKO;Ll;0;L;;;;;N;;;2C0D;;2C0D
+2C3E;GLAGOLITIC SMALL LETTER LJUDIJE;Ll;0;L;;;;;N;;;2C0E;;2C0E
+2C3F;GLAGOLITIC SMALL LETTER MYSLITE;Ll;0;L;;;;;N;;;2C0F;;2C0F
+2C40;GLAGOLITIC SMALL LETTER NASHI;Ll;0;L;;;;;N;;;2C10;;2C10
+2C41;GLAGOLITIC SMALL LETTER ONU;Ll;0;L;;;;;N;;;2C11;;2C11
+2C42;GLAGOLITIC SMALL LETTER POKOJI;Ll;0;L;;;;;N;;;2C12;;2C12
+2C43;GLAGOLITIC SMALL LETTER RITSI;Ll;0;L;;;;;N;;;2C13;;2C13
+2C44;GLAGOLITIC SMALL LETTER SLOVO;Ll;0;L;;;;;N;;;2C14;;2C14
+2C45;GLAGOLITIC SMALL LETTER TVRIDO;Ll;0;L;;;;;N;;;2C15;;2C15
+2C46;GLAGOLITIC SMALL LETTER UKU;Ll;0;L;;;;;N;;;2C16;;2C16
+2C47;GLAGOLITIC SMALL LETTER FRITU;Ll;0;L;;;;;N;;;2C17;;2C17
+2C48;GLAGOLITIC SMALL LETTER HERU;Ll;0;L;;;;;N;;;2C18;;2C18
+2C49;GLAGOLITIC SMALL LETTER OTU;Ll;0;L;;;;;N;;;2C19;;2C19
+2C4A;GLAGOLITIC SMALL LETTER PE;Ll;0;L;;;;;N;;;2C1A;;2C1A
+2C4B;GLAGOLITIC SMALL LETTER SHTA;Ll;0;L;;;;;N;;;2C1B;;2C1B
+2C4C;GLAGOLITIC SMALL LETTER TSI;Ll;0;L;;;;;N;;;2C1C;;2C1C
+2C4D;GLAGOLITIC SMALL LETTER CHRIVI;Ll;0;L;;;;;N;;;2C1D;;2C1D
+2C4E;GLAGOLITIC SMALL LETTER SHA;Ll;0;L;;;;;N;;;2C1E;;2C1E
+2C4F;GLAGOLITIC SMALL LETTER YERU;Ll;0;L;;;;;N;;;2C1F;;2C1F
+2C50;GLAGOLITIC SMALL LETTER YERI;Ll;0;L;;;;;N;;;2C20;;2C20
+2C51;GLAGOLITIC SMALL LETTER YATI;Ll;0;L;;;;;N;;;2C21;;2C21
+2C52;GLAGOLITIC SMALL LETTER SPIDERY HA;Ll;0;L;;;;;N;;;2C22;;2C22
+2C53;GLAGOLITIC SMALL LETTER YU;Ll;0;L;;;;;N;;;2C23;;2C23
+2C54;GLAGOLITIC SMALL LETTER SMALL YUS;Ll;0;L;;;;;N;;;2C24;;2C24
+2C55;GLAGOLITIC SMALL LETTER SMALL YUS WITH TAIL;Ll;0;L;;;;;N;;;2C25;;2C25
+2C56;GLAGOLITIC SMALL LETTER YO;Ll;0;L;;;;;N;;;2C26;;2C26
+2C57;GLAGOLITIC SMALL LETTER IOTATED SMALL YUS;Ll;0;L;;;;;N;;;2C27;;2C27
+2C58;GLAGOLITIC SMALL LETTER BIG YUS;Ll;0;L;;;;;N;;;2C28;;2C28
+2C59;GLAGOLITIC SMALL LETTER IOTATED BIG YUS;Ll;0;L;;;;;N;;;2C29;;2C29
+2C5A;GLAGOLITIC SMALL LETTER FITA;Ll;0;L;;;;;N;;;2C2A;;2C2A
+2C5B;GLAGOLITIC SMALL LETTER IZHITSA;Ll;0;L;;;;;N;;;2C2B;;2C2B
+2C5C;GLAGOLITIC SMALL LETTER SHTAPIC;Ll;0;L;;;;;N;;;2C2C;;2C2C
+2C5D;GLAGOLITIC SMALL LETTER TROKUTASTI A;Ll;0;L;;;;;N;;;2C2D;;2C2D
+2C5E;GLAGOLITIC SMALL LETTER LATINATE MYSLITE;Ll;0;L;;;;;N;;;2C2E;;2C2E
+2C60;LATIN CAPITAL LETTER L WITH DOUBLE BAR;Lu;0;L;;;;;N;;;;2C61;
+2C61;LATIN SMALL LETTER L WITH DOUBLE BAR;Ll;0;L;;;;;N;;;2C60;;2C60
+2C62;LATIN CAPITAL LETTER L WITH MIDDLE TILDE;Lu;0;L;;;;;N;;;;026B;
+2C63;LATIN CAPITAL LETTER P WITH STROKE;Lu;0;L;;;;;N;;;;1D7D;
+2C64;LATIN CAPITAL LETTER R WITH TAIL;Lu;0;L;;;;;N;;;;027D;
+2C65;LATIN SMALL LETTER A WITH STROKE;Ll;0;L;;;;;N;;;023A;;023A
+2C66;LATIN SMALL LETTER T WITH DIAGONAL STROKE;Ll;0;L;;;;;N;;;023E;;023E
+2C67;LATIN CAPITAL LETTER H WITH DESCENDER;Lu;0;L;;;;;N;;;;2C68;
+2C68;LATIN SMALL LETTER H WITH DESCENDER;Ll;0;L;;;;;N;;;2C67;;2C67
+2C69;LATIN CAPITAL LETTER K WITH DESCENDER;Lu;0;L;;;;;N;;;;2C6A;
+2C6A;LATIN SMALL LETTER K WITH DESCENDER;Ll;0;L;;;;;N;;;2C69;;2C69
+2C6B;LATIN CAPITAL LETTER Z WITH DESCENDER;Lu;0;L;;;;;N;;;;2C6C;
+2C6C;LATIN SMALL LETTER Z WITH DESCENDER;Ll;0;L;;;;;N;;;2C6B;;2C6B
+2C74;LATIN SMALL LETTER V WITH CURL;Ll;0;L;;;;;N;;;;;
+2C75;LATIN CAPITAL LETTER HALF H;Lu;0;L;;;;;N;;;;2C76;
+2C76;LATIN SMALL LETTER HALF H;Ll;0;L;;;;;N;;;2C75;;2C75
+2C77;LATIN SMALL LETTER TAILLESS PHI;Ll;0;L;;;;;N;;;;;
+2C80;COPTIC CAPITAL LETTER ALFA;Lu;0;L;;;;;N;;;;2C81;
+2C81;COPTIC SMALL LETTER ALFA;Ll;0;L;;;;;N;;;2C80;;2C80
+2C82;COPTIC CAPITAL LETTER VIDA;Lu;0;L;;;;;N;;;;2C83;
+2C83;COPTIC SMALL LETTER VIDA;Ll;0;L;;;;;N;;;2C82;;2C82
+2C84;COPTIC CAPITAL LETTER GAMMA;Lu;0;L;;;;;N;;;;2C85;
+2C85;COPTIC SMALL LETTER GAMMA;Ll;0;L;;;;;N;;;2C84;;2C84
+2C86;COPTIC CAPITAL LETTER DALDA;Lu;0;L;;;;;N;;;;2C87;
+2C87;COPTIC SMALL LETTER DALDA;Ll;0;L;;;;;N;;;2C86;;2C86
+2C88;COPTIC CAPITAL LETTER EIE;Lu;0;L;;;;;N;;;;2C89;
+2C89;COPTIC SMALL LETTER EIE;Ll;0;L;;;;;N;;;2C88;;2C88
+2C8A;COPTIC CAPITAL LETTER SOU;Lu;0;L;;;;;N;;;;2C8B;
+2C8B;COPTIC SMALL LETTER SOU;Ll;0;L;;;;;N;;;2C8A;;2C8A
+2C8C;COPTIC CAPITAL LETTER ZATA;Lu;0;L;;;;;N;;;;2C8D;
+2C8D;COPTIC SMALL LETTER ZATA;Ll;0;L;;;;;N;;;2C8C;;2C8C
+2C8E;COPTIC CAPITAL LETTER HATE;Lu;0;L;;;;;N;;;;2C8F;
+2C8F;COPTIC SMALL LETTER HATE;Ll;0;L;;;;;N;;;2C8E;;2C8E
+2C90;COPTIC CAPITAL LETTER THETHE;Lu;0;L;;;;;N;;;;2C91;
+2C91;COPTIC SMALL LETTER THETHE;Ll;0;L;;;;;N;;;2C90;;2C90
+2C92;COPTIC CAPITAL LETTER IAUDA;Lu;0;L;;;;;N;;;;2C93;
+2C93;COPTIC SMALL LETTER IAUDA;Ll;0;L;;;;;N;;;2C92;;2C92
+2C94;COPTIC CAPITAL LETTER KAPA;Lu;0;L;;;;;N;;;;2C95;
+2C95;COPTIC SMALL LETTER KAPA;Ll;0;L;;;;;N;;;2C94;;2C94
+2C96;COPTIC CAPITAL LETTER LAULA;Lu;0;L;;;;;N;;;;2C97;
+2C97;COPTIC SMALL LETTER LAULA;Ll;0;L;;;;;N;;;2C96;;2C96
+2C98;COPTIC CAPITAL LETTER MI;Lu;0;L;;;;;N;;;;2C99;
+2C99;COPTIC SMALL LETTER MI;Ll;0;L;;;;;N;;;2C98;;2C98
+2C9A;COPTIC CAPITAL LETTER NI;Lu;0;L;;;;;N;;;;2C9B;
+2C9B;COPTIC SMALL LETTER NI;Ll;0;L;;;;;N;;;2C9A;;2C9A
+2C9C;COPTIC CAPITAL LETTER KSI;Lu;0;L;;;;;N;;;;2C9D;
+2C9D;COPTIC SMALL LETTER KSI;Ll;0;L;;;;;N;;;2C9C;;2C9C
+2C9E;COPTIC CAPITAL LETTER O;Lu;0;L;;;;;N;;;;2C9F;
+2C9F;COPTIC SMALL LETTER O;Ll;0;L;;;;;N;;;2C9E;;2C9E
+2CA0;COPTIC CAPITAL LETTER PI;Lu;0;L;;;;;N;;;;2CA1;
+2CA1;COPTIC SMALL LETTER PI;Ll;0;L;;;;;N;;;2CA0;;2CA0
+2CA2;COPTIC CAPITAL LETTER RO;Lu;0;L;;;;;N;;;;2CA3;
+2CA3;COPTIC SMALL LETTER RO;Ll;0;L;;;;;N;;;2CA2;;2CA2
+2CA4;COPTIC CAPITAL LETTER SIMA;Lu;0;L;;;;;N;;;;2CA5;
+2CA5;COPTIC SMALL LETTER SIMA;Ll;0;L;;;;;N;;;2CA4;;2CA4
+2CA6;COPTIC CAPITAL LETTER TAU;Lu;0;L;;;;;N;;;;2CA7;
+2CA7;COPTIC SMALL LETTER TAU;Ll;0;L;;;;;N;;;2CA6;;2CA6
+2CA8;COPTIC CAPITAL LETTER UA;Lu;0;L;;;;;N;;;;2CA9;
+2CA9;COPTIC SMALL LETTER UA;Ll;0;L;;;;;N;;;2CA8;;2CA8
+2CAA;COPTIC CAPITAL LETTER FI;Lu;0;L;;;;;N;;;;2CAB;
+2CAB;COPTIC SMALL LETTER FI;Ll;0;L;;;;;N;;;2CAA;;2CAA
+2CAC;COPTIC CAPITAL LETTER KHI;Lu;0;L;;;;;N;;;;2CAD;
+2CAD;COPTIC SMALL LETTER KHI;Ll;0;L;;;;;N;;;2CAC;;2CAC
+2CAE;COPTIC CAPITAL LETTER PSI;Lu;0;L;;;;;N;;;;2CAF;
+2CAF;COPTIC SMALL LETTER PSI;Ll;0;L;;;;;N;;;2CAE;;2CAE
+2CB0;COPTIC CAPITAL LETTER OOU;Lu;0;L;;;;;N;;;;2CB1;
+2CB1;COPTIC SMALL LETTER OOU;Ll;0;L;;;;;N;;;2CB0;;2CB0
+2CB2;COPTIC CAPITAL LETTER DIALECT-P ALEF;Lu;0;L;;;;;N;;;;2CB3;
+2CB3;COPTIC SMALL LETTER DIALECT-P ALEF;Ll;0;L;;;;;N;;;2CB2;;2CB2
+2CB4;COPTIC CAPITAL LETTER OLD COPTIC AIN;Lu;0;L;;;;;N;;;;2CB5;
+2CB5;COPTIC SMALL LETTER OLD COPTIC AIN;Ll;0;L;;;;;N;;;2CB4;;2CB4
+2CB6;COPTIC CAPITAL LETTER CRYPTOGRAMMIC EIE;Lu;0;L;;;;;N;;;;2CB7;
+2CB7;COPTIC SMALL LETTER CRYPTOGRAMMIC EIE;Ll;0;L;;;;;N;;;2CB6;;2CB6
+2CB8;COPTIC CAPITAL LETTER DIALECT-P KAPA;Lu;0;L;;;;;N;;;;2CB9;
+2CB9;COPTIC SMALL LETTER DIALECT-P KAPA;Ll;0;L;;;;;N;;;2CB8;;2CB8
+2CBA;COPTIC CAPITAL LETTER DIALECT-P NI;Lu;0;L;;;;;N;;;;2CBB;
+2CBB;COPTIC SMALL LETTER DIALECT-P NI;Ll;0;L;;;;;N;;;2CBA;;2CBA
+2CBC;COPTIC CAPITAL LETTER CRYPTOGRAMMIC NI;Lu;0;L;;;;;N;;;;2CBD;
+2CBD;COPTIC SMALL LETTER CRYPTOGRAMMIC NI;Ll;0;L;;;;;N;;;2CBC;;2CBC
+2CBE;COPTIC CAPITAL LETTER OLD COPTIC OOU;Lu;0;L;;;;;N;;;;2CBF;
+2CBF;COPTIC SMALL LETTER OLD COPTIC OOU;Ll;0;L;;;;;N;;;2CBE;;2CBE
+2CC0;COPTIC CAPITAL LETTER SAMPI;Lu;0;L;;;;;N;;;;2CC1;
+2CC1;COPTIC SMALL LETTER SAMPI;Ll;0;L;;;;;N;;;2CC0;;2CC0
+2CC2;COPTIC CAPITAL LETTER CROSSED SHEI;Lu;0;L;;;;;N;;;;2CC3;
+2CC3;COPTIC SMALL LETTER CROSSED SHEI;Ll;0;L;;;;;N;;;2CC2;;2CC2
+2CC4;COPTIC CAPITAL LETTER OLD COPTIC SHEI;Lu;0;L;;;;;N;;;;2CC5;
+2CC5;COPTIC SMALL LETTER OLD COPTIC SHEI;Ll;0;L;;;;;N;;;2CC4;;2CC4
+2CC6;COPTIC CAPITAL LETTER OLD COPTIC ESH;Lu;0;L;;;;;N;;;;2CC7;
+2CC7;COPTIC SMALL LETTER OLD COPTIC ESH;Ll;0;L;;;;;N;;;2CC6;;2CC6
+2CC8;COPTIC CAPITAL LETTER AKHMIMIC KHEI;Lu;0;L;;;;;N;;;;2CC9;
+2CC9;COPTIC SMALL LETTER AKHMIMIC KHEI;Ll;0;L;;;;;N;;;2CC8;;2CC8
+2CCA;COPTIC CAPITAL LETTER DIALECT-P HORI;Lu;0;L;;;;;N;;;;2CCB;
+2CCB;COPTIC SMALL LETTER DIALECT-P HORI;Ll;0;L;;;;;N;;;2CCA;;2CCA
+2CCC;COPTIC CAPITAL LETTER OLD COPTIC HORI;Lu;0;L;;;;;N;;;;2CCD;
+2CCD;COPTIC SMALL LETTER OLD COPTIC HORI;Ll;0;L;;;;;N;;;2CCC;;2CCC
+2CCE;COPTIC CAPITAL LETTER OLD COPTIC HA;Lu;0;L;;;;;N;;;;2CCF;
+2CCF;COPTIC SMALL LETTER OLD COPTIC HA;Ll;0;L;;;;;N;;;2CCE;;2CCE
+2CD0;COPTIC CAPITAL LETTER L-SHAPED HA;Lu;0;L;;;;;N;;;;2CD1;
+2CD1;COPTIC SMALL LETTER L-SHAPED HA;Ll;0;L;;;;;N;;;2CD0;;2CD0
+2CD2;COPTIC CAPITAL LETTER OLD COPTIC HEI;Lu;0;L;;;;;N;;;;2CD3;
+2CD3;COPTIC SMALL LETTER OLD COPTIC HEI;Ll;0;L;;;;;N;;;2CD2;;2CD2
+2CD4;COPTIC CAPITAL LETTER OLD COPTIC HAT;Lu;0;L;;;;;N;;;;2CD5;
+2CD5;COPTIC SMALL LETTER OLD COPTIC HAT;Ll;0;L;;;;;N;;;2CD4;;2CD4
+2CD6;COPTIC CAPITAL LETTER OLD COPTIC GANGIA;Lu;0;L;;;;;N;;;;2CD7;
+2CD7;COPTIC SMALL LETTER OLD COPTIC GANGIA;Ll;0;L;;;;;N;;;2CD6;;2CD6
+2CD8;COPTIC CAPITAL LETTER OLD COPTIC DJA;Lu;0;L;;;;;N;;;;2CD9;
+2CD9;COPTIC SMALL LETTER OLD COPTIC DJA;Ll;0;L;;;;;N;;;2CD8;;2CD8
+2CDA;COPTIC CAPITAL LETTER OLD COPTIC SHIMA;Lu;0;L;;;;;N;;;;2CDB;
+2CDB;COPTIC SMALL LETTER OLD COPTIC SHIMA;Ll;0;L;;;;;N;;;2CDA;;2CDA
+2CDC;COPTIC CAPITAL LETTER OLD NUBIAN SHIMA;Lu;0;L;;;;;N;;;;2CDD;
+2CDD;COPTIC SMALL LETTER OLD NUBIAN SHIMA;Ll;0;L;;;;;N;;;2CDC;;2CDC
+2CDE;COPTIC CAPITAL LETTER OLD NUBIAN NGI;Lu;0;L;;;;;N;;;;2CDF;
+2CDF;COPTIC SMALL LETTER OLD NUBIAN NGI;Ll;0;L;;;;;N;;;2CDE;;2CDE
+2CE0;COPTIC CAPITAL LETTER OLD NUBIAN NYI;Lu;0;L;;;;;N;;;;2CE1;
+2CE1;COPTIC SMALL LETTER OLD NUBIAN NYI;Ll;0;L;;;;;N;;;2CE0;;2CE0
+2CE2;COPTIC CAPITAL LETTER OLD NUBIAN WAU;Lu;0;L;;;;;N;;;;2CE3;
+2CE3;COPTIC SMALL LETTER OLD NUBIAN WAU;Ll;0;L;;;;;N;;;2CE2;;2CE2
+2CE4;COPTIC SYMBOL KAI;Ll;0;L;;;;;N;;;;;
+2CE5;COPTIC SYMBOL MI RO;So;0;ON;;;;;N;;;;;
+2CE6;COPTIC SYMBOL PI RO;So;0;ON;;;;;N;;;;;
+2CE7;COPTIC SYMBOL STAUROS;So;0;ON;;;;;N;;;;;
+2CE8;COPTIC SYMBOL TAU RO;So;0;ON;;;;;N;;;;;
+2CE9;COPTIC SYMBOL KHI RO;So;0;ON;;;;;N;;;;;
+2CEA;COPTIC SYMBOL SHIMA SIMA;So;0;ON;;;;;N;;;;;
+2CF9;COPTIC OLD NUBIAN FULL STOP;Po;0;ON;;;;;N;;;;;
+2CFA;COPTIC OLD NUBIAN DIRECT QUESTION MARK;Po;0;ON;;;;;N;;;;;
+2CFB;COPTIC OLD NUBIAN INDIRECT QUESTION MARK;Po;0;ON;;;;;N;;;;;
+2CFC;COPTIC OLD NUBIAN VERSE DIVIDER;Po;0;ON;;;;;N;;;;;
+2CFD;COPTIC FRACTION ONE HALF;No;0;ON;;;;1/2;N;;;;;
+2CFE;COPTIC FULL STOP;Po;0;ON;;;;;N;;;;;
+2CFF;COPTIC MORPHOLOGICAL DIVIDER;Po;0;ON;;;;;N;;;;;
+2D00;GEORGIAN SMALL LETTER AN;Ll;0;L;;;;;N;;Khutsuri;10A0;;10A0
+2D01;GEORGIAN SMALL LETTER BAN;Ll;0;L;;;;;N;;Khutsuri;10A1;;10A1
+2D02;GEORGIAN SMALL LETTER GAN;Ll;0;L;;;;;N;;Khutsuri;10A2;;10A2
+2D03;GEORGIAN SMALL LETTER DON;Ll;0;L;;;;;N;;Khutsuri;10A3;;10A3
+2D04;GEORGIAN SMALL LETTER EN;Ll;0;L;;;;;N;;Khutsuri;10A4;;10A4
+2D05;GEORGIAN SMALL LETTER VIN;Ll;0;L;;;;;N;;Khutsuri;10A5;;10A5
+2D06;GEORGIAN SMALL LETTER ZEN;Ll;0;L;;;;;N;;Khutsuri;10A6;;10A6
+2D07;GEORGIAN SMALL LETTER TAN;Ll;0;L;;;;;N;;Khutsuri;10A7;;10A7
+2D08;GEORGIAN SMALL LETTER IN;Ll;0;L;;;;;N;;Khutsuri;10A8;;10A8
+2D09;GEORGIAN SMALL LETTER KAN;Ll;0;L;;;;;N;;Khutsuri;10A9;;10A9
+2D0A;GEORGIAN SMALL LETTER LAS;Ll;0;L;;;;;N;;Khutsuri;10AA;;10AA
+2D0B;GEORGIAN SMALL LETTER MAN;Ll;0;L;;;;;N;;Khutsuri;10AB;;10AB
+2D0C;GEORGIAN SMALL LETTER NAR;Ll;0;L;;;;;N;;Khutsuri;10AC;;10AC
+2D0D;GEORGIAN SMALL LETTER ON;Ll;0;L;;;;;N;;Khutsuri;10AD;;10AD
+2D0E;GEORGIAN SMALL LETTER PAR;Ll;0;L;;;;;N;;Khutsuri;10AE;;10AE
+2D0F;GEORGIAN SMALL LETTER ZHAR;Ll;0;L;;;;;N;;Khutsuri;10AF;;10AF
+2D10;GEORGIAN SMALL LETTER RAE;Ll;0;L;;;;;N;;Khutsuri;10B0;;10B0
+2D11;GEORGIAN SMALL LETTER SAN;Ll;0;L;;;;;N;;Khutsuri;10B1;;10B1
+2D12;GEORGIAN SMALL LETTER TAR;Ll;0;L;;;;;N;;Khutsuri;10B2;;10B2
+2D13;GEORGIAN SMALL LETTER UN;Ll;0;L;;;;;N;;Khutsuri;10B3;;10B3
+2D14;GEORGIAN SMALL LETTER PHAR;Ll;0;L;;;;;N;;Khutsuri;10B4;;10B4
+2D15;GEORGIAN SMALL LETTER KHAR;Ll;0;L;;;;;N;;Khutsuri;10B5;;10B5
+2D16;GEORGIAN SMALL LETTER GHAN;Ll;0;L;;;;;N;;Khutsuri;10B6;;10B6
+2D17;GEORGIAN SMALL LETTER QAR;Ll;0;L;;;;;N;;Khutsuri;10B7;;10B7
+2D18;GEORGIAN SMALL LETTER SHIN;Ll;0;L;;;;;N;;Khutsuri;10B8;;10B8
+2D19;GEORGIAN SMALL LETTER CHIN;Ll;0;L;;;;;N;;Khutsuri;10B9;;10B9
+2D1A;GEORGIAN SMALL LETTER CAN;Ll;0;L;;;;;N;;Khutsuri;10BA;;10BA
+2D1B;GEORGIAN SMALL LETTER JIL;Ll;0;L;;;;;N;;Khutsuri;10BB;;10BB
+2D1C;GEORGIAN SMALL LETTER CIL;Ll;0;L;;;;;N;;Khutsuri;10BC;;10BC
+2D1D;GEORGIAN SMALL LETTER CHAR;Ll;0;L;;;;;N;;Khutsuri;10BD;;10BD
+2D1E;GEORGIAN SMALL LETTER XAN;Ll;0;L;;;;;N;;Khutsuri;10BE;;10BE
+2D1F;GEORGIAN SMALL LETTER JHAN;Ll;0;L;;;;;N;;Khutsuri;10BF;;10BF
+2D20;GEORGIAN SMALL LETTER HAE;Ll;0;L;;;;;N;;Khutsuri;10C0;;10C0
+2D21;GEORGIAN SMALL LETTER HE;Ll;0;L;;;;;N;;Khutsuri;10C1;;10C1
+2D22;GEORGIAN SMALL LETTER HIE;Ll;0;L;;;;;N;;Khutsuri;10C2;;10C2
+2D23;GEORGIAN SMALL LETTER WE;Ll;0;L;;;;;N;;Khutsuri;10C3;;10C3
+2D24;GEORGIAN SMALL LETTER HAR;Ll;0;L;;;;;N;;Khutsuri;10C4;;10C4
+2D25;GEORGIAN SMALL LETTER HOE;Ll;0;L;;;;;N;;Khutsuri;10C5;;10C5
+2D30;TIFINAGH LETTER YA;Lo;0;L;;;;;N;;;;;
+2D31;TIFINAGH LETTER YAB;Lo;0;L;;;;;N;;;;;
+2D32;TIFINAGH LETTER YABH;Lo;0;L;;;;;N;;;;;
+2D33;TIFINAGH LETTER YAG;Lo;0;L;;;;;N;;;;;
+2D34;TIFINAGH LETTER YAGHH;Lo;0;L;;;;;N;;;;;
+2D35;TIFINAGH LETTER BERBER ACADEMY YAJ;Lo;0;L;;;;;N;;;;;
+2D36;TIFINAGH LETTER YAJ;Lo;0;L;;;;;N;;;;;
+2D37;TIFINAGH LETTER YAD;Lo;0;L;;;;;N;;;;;
+2D38;TIFINAGH LETTER YADH;Lo;0;L;;;;;N;;;;;
+2D39;TIFINAGH LETTER YADD;Lo;0;L;;;;;N;;;;;
+2D3A;TIFINAGH LETTER YADDH;Lo;0;L;;;;;N;;;;;
+2D3B;TIFINAGH LETTER YEY;Lo;0;L;;;;;N;;;;;
+2D3C;TIFINAGH LETTER YAF;Lo;0;L;;;;;N;;;;;
+2D3D;TIFINAGH LETTER YAK;Lo;0;L;;;;;N;;;;;
+2D3E;TIFINAGH LETTER TUAREG YAK;Lo;0;L;;;;;N;;;;;
+2D3F;TIFINAGH LETTER YAKHH;Lo;0;L;;;;;N;;;;;
+2D40;TIFINAGH LETTER YAH;Lo;0;L;;;;;N;;Tuareg yab;;;
+2D41;TIFINAGH LETTER BERBER ACADEMY YAH;Lo;0;L;;;;;N;;;;;
+2D42;TIFINAGH LETTER TUAREG YAH;Lo;0;L;;;;;N;;;;;
+2D43;TIFINAGH LETTER YAHH;Lo;0;L;;;;;N;;;;;
+2D44;TIFINAGH LETTER YAA;Lo;0;L;;;;;N;;;;;
+2D45;TIFINAGH LETTER YAKH;Lo;0;L;;;;;N;;;;;
+2D46;TIFINAGH LETTER TUAREG YAKH;Lo;0;L;;;;;N;;;;;
+2D47;TIFINAGH LETTER YAQ;Lo;0;L;;;;;N;;;;;
+2D48;TIFINAGH LETTER TUAREG YAQ;Lo;0;L;;;;;N;;;;;
+2D49;TIFINAGH LETTER YI;Lo;0;L;;;;;N;;;;;
+2D4A;TIFINAGH LETTER YAZH;Lo;0;L;;;;;N;;;;;
+2D4B;TIFINAGH LETTER AHAGGAR YAZH;Lo;0;L;;;;;N;;;;;
+2D4C;TIFINAGH LETTER TUAREG YAZH;Lo;0;L;;;;;N;;;;;
+2D4D;TIFINAGH LETTER YAL;Lo;0;L;;;;;N;;;;;
+2D4E;TIFINAGH LETTER YAM;Lo;0;L;;;;;N;;;;;
+2D4F;TIFINAGH LETTER YAN;Lo;0;L;;;;;N;;;;;
+2D50;TIFINAGH LETTER TUAREG YAGN;Lo;0;L;;;;;N;;;;;
+2D51;TIFINAGH LETTER TUAREG YANG;Lo;0;L;;;;;N;;;;;
+2D52;TIFINAGH LETTER YAP;Lo;0;L;;;;;N;;;;;
+2D53;TIFINAGH LETTER YU;Lo;0;L;;;;;N;;Tuareg yaw;;;
+2D54;TIFINAGH LETTER YAR;Lo;0;L;;;;;N;;;;;
+2D55;TIFINAGH LETTER YARR;Lo;0;L;;;;;N;;;;;
+2D56;TIFINAGH LETTER YAGH;Lo;0;L;;;;;N;;;;;
+2D57;TIFINAGH LETTER TUAREG YAGH;Lo;0;L;;;;;N;;;;;
+2D58;TIFINAGH LETTER AYER YAGH;Lo;0;L;;;;;N;;Adrar yaj;;;
+2D59;TIFINAGH LETTER YAS;Lo;0;L;;;;;N;;;;;
+2D5A;TIFINAGH LETTER YASS;Lo;0;L;;;;;N;;;;;
+2D5B;TIFINAGH LETTER YASH;Lo;0;L;;;;;N;;;;;
+2D5C;TIFINAGH LETTER YAT;Lo;0;L;;;;;N;;;;;
+2D5D;TIFINAGH LETTER YATH;Lo;0;L;;;;;N;;;;;
+2D5E;TIFINAGH LETTER YACH;Lo;0;L;;;;;N;;;;;
+2D5F;TIFINAGH LETTER YATT;Lo;0;L;;;;;N;;;;;
+2D60;TIFINAGH LETTER YAV;Lo;0;L;;;;;N;;;;;
+2D61;TIFINAGH LETTER YAW;Lo;0;L;;;;;N;;;;;
+2D62;TIFINAGH LETTER YAY;Lo;0;L;;;;;N;;;;;
+2D63;TIFINAGH LETTER YAZ;Lo;0;L;;;;;N;;;;;
+2D64;TIFINAGH LETTER TAWELLEMET YAZ;Lo;0;L;;;;;N;;harpoon yaz;;;
+2D65;TIFINAGH LETTER YAZZ;Lo;0;L;;;;;N;;;;;
+2D6F;TIFINAGH MODIFIER LETTER LABIALIZATION MARK;Lm;0;L;<super> 2D61;;;;N;;tamatart;;;
+2D80;ETHIOPIC SYLLABLE LOA;Lo;0;L;;;;;N;;;;;
+2D81;ETHIOPIC SYLLABLE MOA;Lo;0;L;;;;;N;;;;;
+2D82;ETHIOPIC SYLLABLE ROA;Lo;0;L;;;;;N;;;;;
+2D83;ETHIOPIC SYLLABLE SOA;Lo;0;L;;;;;N;;;;;
+2D84;ETHIOPIC SYLLABLE SHOA;Lo;0;L;;;;;N;;;;;
+2D85;ETHIOPIC SYLLABLE BOA;Lo;0;L;;;;;N;;;;;
+2D86;ETHIOPIC SYLLABLE TOA;Lo;0;L;;;;;N;;;;;
+2D87;ETHIOPIC SYLLABLE COA;Lo;0;L;;;;;N;;;;;
+2D88;ETHIOPIC SYLLABLE NOA;Lo;0;L;;;;;N;;;;;
+2D89;ETHIOPIC SYLLABLE NYOA;Lo;0;L;;;;;N;;;;;
+2D8A;ETHIOPIC SYLLABLE GLOTTAL OA;Lo;0;L;;;;;N;;;;;
+2D8B;ETHIOPIC SYLLABLE ZOA;Lo;0;L;;;;;N;;;;;
+2D8C;ETHIOPIC SYLLABLE DOA;Lo;0;L;;;;;N;;;;;
+2D8D;ETHIOPIC SYLLABLE DDOA;Lo;0;L;;;;;N;;;;;
+2D8E;ETHIOPIC SYLLABLE JOA;Lo;0;L;;;;;N;;;;;
+2D8F;ETHIOPIC SYLLABLE THOA;Lo;0;L;;;;;N;;;;;
+2D90;ETHIOPIC SYLLABLE CHOA;Lo;0;L;;;;;N;;;;;
+2D91;ETHIOPIC SYLLABLE PHOA;Lo;0;L;;;;;N;;;;;
+2D92;ETHIOPIC SYLLABLE POA;Lo;0;L;;;;;N;;;;;
+2D93;ETHIOPIC SYLLABLE GGWA;Lo;0;L;;;;;N;;;;;
+2D94;ETHIOPIC SYLLABLE GGWI;Lo;0;L;;;;;N;;;;;
+2D95;ETHIOPIC SYLLABLE GGWEE;Lo;0;L;;;;;N;;;;;
+2D96;ETHIOPIC SYLLABLE GGWE;Lo;0;L;;;;;N;;;;;
+2DA0;ETHIOPIC SYLLABLE SSA;Lo;0;L;;;;;N;;;;;
+2DA1;ETHIOPIC SYLLABLE SSU;Lo;0;L;;;;;N;;;;;
+2DA2;ETHIOPIC SYLLABLE SSI;Lo;0;L;;;;;N;;;;;
+2DA3;ETHIOPIC SYLLABLE SSAA;Lo;0;L;;;;;N;;;;;
+2DA4;ETHIOPIC SYLLABLE SSEE;Lo;0;L;;;;;N;;;;;
+2DA5;ETHIOPIC SYLLABLE SSE;Lo;0;L;;;;;N;;;;;
+2DA6;ETHIOPIC SYLLABLE SSO;Lo;0;L;;;;;N;;;;;
+2DA8;ETHIOPIC SYLLABLE CCA;Lo;0;L;;;;;N;;;;;
+2DA9;ETHIOPIC SYLLABLE CCU;Lo;0;L;;;;;N;;;;;
+2DAA;ETHIOPIC SYLLABLE CCI;Lo;0;L;;;;;N;;;;;
+2DAB;ETHIOPIC SYLLABLE CCAA;Lo;0;L;;;;;N;;;;;
+2DAC;ETHIOPIC SYLLABLE CCEE;Lo;0;L;;;;;N;;;;;
+2DAD;ETHIOPIC SYLLABLE CCE;Lo;0;L;;;;;N;;;;;
+2DAE;ETHIOPIC SYLLABLE CCO;Lo;0;L;;;;;N;;;;;
+2DB0;ETHIOPIC SYLLABLE ZZA;Lo;0;L;;;;;N;;;;;
+2DB1;ETHIOPIC SYLLABLE ZZU;Lo;0;L;;;;;N;;;;;
+2DB2;ETHIOPIC SYLLABLE ZZI;Lo;0;L;;;;;N;;;;;
+2DB3;ETHIOPIC SYLLABLE ZZAA;Lo;0;L;;;;;N;;;;;
+2DB4;ETHIOPIC SYLLABLE ZZEE;Lo;0;L;;;;;N;;;;;
+2DB5;ETHIOPIC SYLLABLE ZZE;Lo;0;L;;;;;N;;;;;
+2DB6;ETHIOPIC SYLLABLE ZZO;Lo;0;L;;;;;N;;;;;
+2DB8;ETHIOPIC SYLLABLE CCHA;Lo;0;L;;;;;N;;;;;
+2DB9;ETHIOPIC SYLLABLE CCHU;Lo;0;L;;;;;N;;;;;
+2DBA;ETHIOPIC SYLLABLE CCHI;Lo;0;L;;;;;N;;;;;
+2DBB;ETHIOPIC SYLLABLE CCHAA;Lo;0;L;;;;;N;;;;;
+2DBC;ETHIOPIC SYLLABLE CCHEE;Lo;0;L;;;;;N;;;;;
+2DBD;ETHIOPIC SYLLABLE CCHE;Lo;0;L;;;;;N;;;;;
+2DBE;ETHIOPIC SYLLABLE CCHO;Lo;0;L;;;;;N;;;;;
+2DC0;ETHIOPIC SYLLABLE QYA;Lo;0;L;;;;;N;;;;;
+2DC1;ETHIOPIC SYLLABLE QYU;Lo;0;L;;;;;N;;;;;
+2DC2;ETHIOPIC SYLLABLE QYI;Lo;0;L;;;;;N;;;;;
+2DC3;ETHIOPIC SYLLABLE QYAA;Lo;0;L;;;;;N;;;;;
+2DC4;ETHIOPIC SYLLABLE QYEE;Lo;0;L;;;;;N;;;;;
+2DC5;ETHIOPIC SYLLABLE QYE;Lo;0;L;;;;;N;;;;;
+2DC6;ETHIOPIC SYLLABLE QYO;Lo;0;L;;;;;N;;;;;
+2DC8;ETHIOPIC SYLLABLE KYA;Lo;0;L;;;;;N;;;;;
+2DC9;ETHIOPIC SYLLABLE KYU;Lo;0;L;;;;;N;;;;;
+2DCA;ETHIOPIC SYLLABLE KYI;Lo;0;L;;;;;N;;;;;
+2DCB;ETHIOPIC SYLLABLE KYAA;Lo;0;L;;;;;N;;;;;
+2DCC;ETHIOPIC SYLLABLE KYEE;Lo;0;L;;;;;N;;;;;
+2DCD;ETHIOPIC SYLLABLE KYE;Lo;0;L;;;;;N;;;;;
+2DCE;ETHIOPIC SYLLABLE KYO;Lo;0;L;;;;;N;;;;;
+2DD0;ETHIOPIC SYLLABLE XYA;Lo;0;L;;;;;N;;;;;
+2DD1;ETHIOPIC SYLLABLE XYU;Lo;0;L;;;;;N;;;;;
+2DD2;ETHIOPIC SYLLABLE XYI;Lo;0;L;;;;;N;;;;;
+2DD3;ETHIOPIC SYLLABLE XYAA;Lo;0;L;;;;;N;;;;;
+2DD4;ETHIOPIC SYLLABLE XYEE;Lo;0;L;;;;;N;;;;;
+2DD5;ETHIOPIC SYLLABLE XYE;Lo;0;L;;;;;N;;;;;
+2DD6;ETHIOPIC SYLLABLE XYO;Lo;0;L;;;;;N;;;;;
+2DD8;ETHIOPIC SYLLABLE GYA;Lo;0;L;;;;;N;;;;;
+2DD9;ETHIOPIC SYLLABLE GYU;Lo;0;L;;;;;N;;;;;
+2DDA;ETHIOPIC SYLLABLE GYI;Lo;0;L;;;;;N;;;;;
+2DDB;ETHIOPIC SYLLABLE GYAA;Lo;0;L;;;;;N;;;;;
+2DDC;ETHIOPIC SYLLABLE GYEE;Lo;0;L;;;;;N;;;;;
+2DDD;ETHIOPIC SYLLABLE GYE;Lo;0;L;;;;;N;;;;;
+2DDE;ETHIOPIC SYLLABLE GYO;Lo;0;L;;;;;N;;;;;
+2E00;RIGHT ANGLE SUBSTITUTION MARKER;Po;0;ON;;;;;N;;;;;
+2E01;RIGHT ANGLE DOTTED SUBSTITUTION MARKER;Po;0;ON;;;;;N;;;;;
+2E02;LEFT SUBSTITUTION BRACKET;Pi;0;ON;;;;;Y;;;;;
+2E03;RIGHT SUBSTITUTION BRACKET;Pf;0;ON;;;;;Y;;;;;
+2E04;LEFT DOTTED SUBSTITUTION BRACKET;Pi;0;ON;;;;;Y;;;;;
+2E05;RIGHT DOTTED SUBSTITUTION BRACKET;Pf;0;ON;;;;;Y;;;;;
+2E06;RAISED INTERPOLATION MARKER;Po;0;ON;;;;;N;;;;;
+2E07;RAISED DOTTED INTERPOLATION MARKER;Po;0;ON;;;;;N;;;;;
+2E08;DOTTED TRANSPOSITION MARKER;Po;0;ON;;;;;N;;;;;
+2E09;LEFT TRANSPOSITION BRACKET;Pi;0;ON;;;;;Y;;;;;
+2E0A;RIGHT TRANSPOSITION BRACKET;Pf;0;ON;;;;;Y;;;;;
+2E0B;RAISED SQUARE;Po;0;ON;;;;;N;;;;;
+2E0C;LEFT RAISED OMISSION BRACKET;Pi;0;ON;;;;;Y;;;;;
+2E0D;RIGHT RAISED OMISSION BRACKET;Pf;0;ON;;;;;Y;;;;;
+2E0E;EDITORIAL CORONIS;Po;0;ON;;;;;N;;;;;
+2E0F;PARAGRAPHOS;Po;0;ON;;;;;N;;;;;
+2E10;FORKED PARAGRAPHOS;Po;0;ON;;;;;N;;;;;
+2E11;REVERSED FORKED PARAGRAPHOS;Po;0;ON;;;;;N;;;;;
+2E12;HYPODIASTOLE;Po;0;ON;;;;;N;;;;;
+2E13;DOTTED OBELOS;Po;0;ON;;;;;N;;;;;
+2E14;DOWNWARDS ANCORA;Po;0;ON;;;;;N;;;;;
+2E15;UPWARDS ANCORA;Po;0;ON;;;;;N;;;;;
+2E16;DOTTED RIGHT-POINTING ANGLE;Po;0;ON;;;;;N;;;;;
+2E17;DOUBLE OBLIQUE HYPHEN;Pd;0;ON;;;;;N;;;;;
+2E1C;LEFT LOW PARAPHRASE BRACKET;Pi;0;ON;;;;;Y;;;;;
+2E1D;RIGHT LOW PARAPHRASE BRACKET;Pf;0;ON;;;;;Y;;;;;
+2E80;CJK RADICAL REPEAT;So;0;ON;;;;;N;;;;;
+2E81;CJK RADICAL CLIFF;So;0;ON;;;;;N;;;;;
+2E82;CJK RADICAL SECOND ONE;So;0;ON;;;;;N;;;;;
+2E83;CJK RADICAL SECOND TWO;So;0;ON;;;;;N;;;;;
+2E84;CJK RADICAL SECOND THREE;So;0;ON;;;;;N;;;;;
+2E85;CJK RADICAL PERSON;So;0;ON;;;;;N;;;;;
+2E86;CJK RADICAL BOX;So;0;ON;;;;;N;;;;;
+2E87;CJK RADICAL TABLE;So;0;ON;;;;;N;;;;;
+2E88;CJK RADICAL KNIFE ONE;So;0;ON;;;;;N;;;;;
+2E89;CJK RADICAL KNIFE TWO;So;0;ON;;;;;N;;;;;
+2E8A;CJK RADICAL DIVINATION;So;0;ON;;;;;N;;;;;
+2E8B;CJK RADICAL SEAL;So;0;ON;;;;;N;;;;;
+2E8C;CJK RADICAL SMALL ONE;So;0;ON;;;;;N;;;;;
+2E8D;CJK RADICAL SMALL TWO;So;0;ON;;;;;N;;;;;
+2E8E;CJK RADICAL LAME ONE;So;0;ON;;;;;N;;;;;
+2E8F;CJK RADICAL LAME TWO;So;0;ON;;;;;N;;;;;
+2E90;CJK RADICAL LAME THREE;So;0;ON;;;;;N;;;;;
+2E91;CJK RADICAL LAME FOUR;So;0;ON;;;;;N;;;;;
+2E92;CJK RADICAL SNAKE;So;0;ON;;;;;N;;;;;
+2E93;CJK RADICAL THREAD;So;0;ON;;;;;N;;;;;
+2E94;CJK RADICAL SNOUT ONE;So;0;ON;;;;;N;;;;;
+2E95;CJK RADICAL SNOUT TWO;So;0;ON;;;;;N;;;;;
+2E96;CJK RADICAL HEART ONE;So;0;ON;;;;;N;;;;;
+2E97;CJK RADICAL HEART TWO;So;0;ON;;;;;N;;;;;
+2E98;CJK RADICAL HAND;So;0;ON;;;;;N;;;;;
+2E99;CJK RADICAL RAP;So;0;ON;;;;;N;;;;;
+2E9B;CJK RADICAL CHOKE;So;0;ON;;;;;N;;;;;
+2E9C;CJK RADICAL SUN;So;0;ON;;;;;N;;;;;
+2E9D;CJK RADICAL MOON;So;0;ON;;;;;N;;;;;
+2E9E;CJK RADICAL DEATH;So;0;ON;;;;;N;;;;;
+2E9F;CJK RADICAL MOTHER;So;0;ON;<compat> 6BCD;;;;N;;;;;
+2EA0;CJK RADICAL CIVILIAN;So;0;ON;;;;;N;;;;;
+2EA1;CJK RADICAL WATER ONE;So;0;ON;;;;;N;;;;;
+2EA2;CJK RADICAL WATER TWO;So;0;ON;;;;;N;;;;;
+2EA3;CJK RADICAL FIRE;So;0;ON;;;;;N;;;;;
+2EA4;CJK RADICAL PAW ONE;So;0;ON;;;;;N;;;;;
+2EA5;CJK RADICAL PAW TWO;So;0;ON;;;;;N;;;;;
+2EA6;CJK RADICAL SIMPLIFIED HALF TREE TRUNK;So;0;ON;;;;;N;;;;;
+2EA7;CJK RADICAL COW;So;0;ON;;;;;N;;;;;
+2EA8;CJK RADICAL DOG;So;0;ON;;;;;N;;;;;
+2EA9;CJK RADICAL JADE;So;0;ON;;;;;N;;;;;
+2EAA;CJK RADICAL BOLT OF CLOTH;So;0;ON;;;;;N;;;;;
+2EAB;CJK RADICAL EYE;So;0;ON;;;;;N;;;;;
+2EAC;CJK RADICAL SPIRIT ONE;So;0;ON;;;;;N;;;;;
+2EAD;CJK RADICAL SPIRIT TWO;So;0;ON;;;;;N;;;;;
+2EAE;CJK RADICAL BAMBOO;So;0;ON;;;;;N;;;;;
+2EAF;CJK RADICAL SILK;So;0;ON;;;;;N;;;;;
+2EB0;CJK RADICAL C-SIMPLIFIED SILK;So;0;ON;;;;;N;;;;;
+2EB1;CJK RADICAL NET ONE;So;0;ON;;;;;N;;;;;
+2EB2;CJK RADICAL NET TWO;So;0;ON;;;;;N;;;;;
+2EB3;CJK RADICAL NET THREE;So;0;ON;;;;;N;;;;;
+2EB4;CJK RADICAL NET FOUR;So;0;ON;;;;;N;;;;;
+2EB5;CJK RADICAL MESH;So;0;ON;;;;;N;;;;;
+2EB6;CJK RADICAL SHEEP;So;0;ON;;;;;N;;;;;
+2EB7;CJK RADICAL RAM;So;0;ON;;;;;N;;;;;
+2EB8;CJK RADICAL EWE;So;0;ON;;;;;N;;;;;
+2EB9;CJK RADICAL OLD;So;0;ON;;;;;N;;;;;
+2EBA;CJK RADICAL BRUSH ONE;So;0;ON;;;;;N;;;;;
+2EBB;CJK RADICAL BRUSH TWO;So;0;ON;;;;;N;;;;;
+2EBC;CJK RADICAL MEAT;So;0;ON;;;;;N;;;;;
+2EBD;CJK RADICAL MORTAR;So;0;ON;;;;;N;;;;;
+2EBE;CJK RADICAL GRASS ONE;So;0;ON;;;;;N;;;;;
+2EBF;CJK RADICAL GRASS TWO;So;0;ON;;;;;N;;;;;
+2EC0;CJK RADICAL GRASS THREE;So;0;ON;;;;;N;;;;;
+2EC1;CJK RADICAL TIGER;So;0;ON;;;;;N;;;;;
+2EC2;CJK RADICAL CLOTHES;So;0;ON;;;;;N;;;;;
+2EC3;CJK RADICAL WEST ONE;So;0;ON;;;;;N;;;;;
+2EC4;CJK RADICAL WEST TWO;So;0;ON;;;;;N;;;;;
+2EC5;CJK RADICAL C-SIMPLIFIED SEE;So;0;ON;;;;;N;;;;;
+2EC6;CJK RADICAL SIMPLIFIED HORN;So;0;ON;;;;;N;;;;;
+2EC7;CJK RADICAL HORN;So;0;ON;;;;;N;;;;;
+2EC8;CJK RADICAL C-SIMPLIFIED SPEECH;So;0;ON;;;;;N;;;;;
+2EC9;CJK RADICAL C-SIMPLIFIED SHELL;So;0;ON;;;;;N;;;;;
+2ECA;CJK RADICAL FOOT;So;0;ON;;;;;N;;;;;
+2ECB;CJK RADICAL C-SIMPLIFIED CART;So;0;ON;;;;;N;;;;;
+2ECC;CJK RADICAL SIMPLIFIED WALK;So;0;ON;;;;;N;;;;;
+2ECD;CJK RADICAL WALK ONE;So;0;ON;;;;;N;;;;;
+2ECE;CJK RADICAL WALK TWO;So;0;ON;;;;;N;;;;;
+2ECF;CJK RADICAL CITY;So;0;ON;;;;;N;;;;;
+2ED0;CJK RADICAL C-SIMPLIFIED GOLD;So;0;ON;;;;;N;;;;;
+2ED1;CJK RADICAL LONG ONE;So;0;ON;;;;;N;;;;;
+2ED2;CJK RADICAL LONG TWO;So;0;ON;;;;;N;;;;;
+2ED3;CJK RADICAL C-SIMPLIFIED LONG;So;0;ON;;;;;N;;;;;
+2ED4;CJK RADICAL C-SIMPLIFIED GATE;So;0;ON;;;;;N;;;;;
+2ED5;CJK RADICAL MOUND ONE;So;0;ON;;;;;N;;;;;
+2ED6;CJK RADICAL MOUND TWO;So;0;ON;;;;;N;;;;;
+2ED7;CJK RADICAL RAIN;So;0;ON;;;;;N;;;;;
+2ED8;CJK RADICAL BLUE;So;0;ON;;;;;N;;;;;
+2ED9;CJK RADICAL C-SIMPLIFIED TANNED LEATHER;So;0;ON;;;;;N;;;;;
+2EDA;CJK RADICAL C-SIMPLIFIED LEAF;So;0;ON;;;;;N;;;;;
+2EDB;CJK RADICAL C-SIMPLIFIED WIND;So;0;ON;;;;;N;;;;;
+2EDC;CJK RADICAL C-SIMPLIFIED FLY;So;0;ON;;;;;N;;;;;
+2EDD;CJK RADICAL EAT ONE;So;0;ON;;;;;N;;;;;
+2EDE;CJK RADICAL EAT TWO;So;0;ON;;;;;N;;;;;
+2EDF;CJK RADICAL EAT THREE;So;0;ON;;;;;N;;;;;
+2EE0;CJK RADICAL C-SIMPLIFIED EAT;So;0;ON;;;;;N;;;;;
+2EE1;CJK RADICAL HEAD;So;0;ON;;;;;N;;;;;
+2EE2;CJK RADICAL C-SIMPLIFIED HORSE;So;0;ON;;;;;N;;;;;
+2EE3;CJK RADICAL BONE;So;0;ON;;;;;N;;;;;
+2EE4;CJK RADICAL GHOST;So;0;ON;;;;;N;;;;;
+2EE5;CJK RADICAL C-SIMPLIFIED FISH;So;0;ON;;;;;N;;;;;
+2EE6;CJK RADICAL C-SIMPLIFIED BIRD;So;0;ON;;;;;N;;;;;
+2EE7;CJK RADICAL C-SIMPLIFIED SALT;So;0;ON;;;;;N;;;;;
+2EE8;CJK RADICAL SIMPLIFIED WHEAT;So;0;ON;;;;;N;;;;;
+2EE9;CJK RADICAL SIMPLIFIED YELLOW;So;0;ON;;;;;N;;;;;
+2EEA;CJK RADICAL C-SIMPLIFIED FROG;So;0;ON;;;;;N;;;;;
+2EEB;CJK RADICAL J-SIMPLIFIED EVEN;So;0;ON;;;;;N;;;;;
+2EEC;CJK RADICAL C-SIMPLIFIED EVEN;So;0;ON;;;;;N;;;;;
+2EED;CJK RADICAL J-SIMPLIFIED TOOTH;So;0;ON;;;;;N;;;;;
+2EEE;CJK RADICAL C-SIMPLIFIED TOOTH;So;0;ON;;;;;N;;;;;
+2EEF;CJK RADICAL J-SIMPLIFIED DRAGON;So;0;ON;;;;;N;;;;;
+2EF0;CJK RADICAL C-SIMPLIFIED DRAGON;So;0;ON;;;;;N;;;;;
+2EF1;CJK RADICAL TURTLE;So;0;ON;;;;;N;;;;;
+2EF2;CJK RADICAL J-SIMPLIFIED TURTLE;So;0;ON;;;;;N;;;;;
+2EF3;CJK RADICAL C-SIMPLIFIED TURTLE;So;0;ON;<compat> 9F9F;;;;N;;;;;
+2F00;KANGXI RADICAL ONE;So;0;ON;<compat> 4E00;;;;N;;;;;
+2F01;KANGXI RADICAL LINE;So;0;ON;<compat> 4E28;;;;N;;;;;
+2F02;KANGXI RADICAL DOT;So;0;ON;<compat> 4E36;;;;N;;;;;
+2F03;KANGXI RADICAL SLASH;So;0;ON;<compat> 4E3F;;;;N;;;;;
+2F04;KANGXI RADICAL SECOND;So;0;ON;<compat> 4E59;;;;N;;;;;
+2F05;KANGXI RADICAL HOOK;So;0;ON;<compat> 4E85;;;;N;;;;;
+2F06;KANGXI RADICAL TWO;So;0;ON;<compat> 4E8C;;;;N;;;;;
+2F07;KANGXI RADICAL LID;So;0;ON;<compat> 4EA0;;;;N;;;;;
+2F08;KANGXI RADICAL MAN;So;0;ON;<compat> 4EBA;;;;N;;;;;
+2F09;KANGXI RADICAL LEGS;So;0;ON;<compat> 513F;;;;N;;;;;
+2F0A;KANGXI RADICAL ENTER;So;0;ON;<compat> 5165;;;;N;;;;;
+2F0B;KANGXI RADICAL EIGHT;So;0;ON;<compat> 516B;;;;N;;;;;
+2F0C;KANGXI RADICAL DOWN BOX;So;0;ON;<compat> 5182;;;;N;;;;;
+2F0D;KANGXI RADICAL COVER;So;0;ON;<compat> 5196;;;;N;;;;;
+2F0E;KANGXI RADICAL ICE;So;0;ON;<compat> 51AB;;;;N;;;;;
+2F0F;KANGXI RADICAL TABLE;So;0;ON;<compat> 51E0;;;;N;;;;;
+2F10;KANGXI RADICAL OPEN BOX;So;0;ON;<compat> 51F5;;;;N;;;;;
+2F11;KANGXI RADICAL KNIFE;So;0;ON;<compat> 5200;;;;N;;;;;
+2F12;KANGXI RADICAL POWER;So;0;ON;<compat> 529B;;;;N;;;;;
+2F13;KANGXI RADICAL WRAP;So;0;ON;<compat> 52F9;;;;N;;;;;
+2F14;KANGXI RADICAL SPOON;So;0;ON;<compat> 5315;;;;N;;;;;
+2F15;KANGXI RADICAL RIGHT OPEN BOX;So;0;ON;<compat> 531A;;;;N;;;;;
+2F16;KANGXI RADICAL HIDING ENCLOSURE;So;0;ON;<compat> 5338;;;;N;;;;;
+2F17;KANGXI RADICAL TEN;So;0;ON;<compat> 5341;;;;N;;;;;
+2F18;KANGXI RADICAL DIVINATION;So;0;ON;<compat> 535C;;;;N;;;;;
+2F19;KANGXI RADICAL SEAL;So;0;ON;<compat> 5369;;;;N;;;;;
+2F1A;KANGXI RADICAL CLIFF;So;0;ON;<compat> 5382;;;;N;;;;;
+2F1B;KANGXI RADICAL PRIVATE;So;0;ON;<compat> 53B6;;;;N;;;;;
+2F1C;KANGXI RADICAL AGAIN;So;0;ON;<compat> 53C8;;;;N;;;;;
+2F1D;KANGXI RADICAL MOUTH;So;0;ON;<compat> 53E3;;;;N;;;;;
+2F1E;KANGXI RADICAL ENCLOSURE;So;0;ON;<compat> 56D7;;;;N;;;;;
+2F1F;KANGXI RADICAL EARTH;So;0;ON;<compat> 571F;;;;N;;;;;
+2F20;KANGXI RADICAL SCHOLAR;So;0;ON;<compat> 58EB;;;;N;;;;;
+2F21;KANGXI RADICAL GO;So;0;ON;<compat> 5902;;;;N;;;;;
+2F22;KANGXI RADICAL GO SLOWLY;So;0;ON;<compat> 590A;;;;N;;;;;
+2F23;KANGXI RADICAL EVENING;So;0;ON;<compat> 5915;;;;N;;;;;
+2F24;KANGXI RADICAL BIG;So;0;ON;<compat> 5927;;;;N;;;;;
+2F25;KANGXI RADICAL WOMAN;So;0;ON;<compat> 5973;;;;N;;;;;
+2F26;KANGXI RADICAL CHILD;So;0;ON;<compat> 5B50;;;;N;;;;;
+2F27;KANGXI RADICAL ROOF;So;0;ON;<compat> 5B80;;;;N;;;;;
+2F28;KANGXI RADICAL INCH;So;0;ON;<compat> 5BF8;;;;N;;;;;
+2F29;KANGXI RADICAL SMALL;So;0;ON;<compat> 5C0F;;;;N;;;;;
+2F2A;KANGXI RADICAL LAME;So;0;ON;<compat> 5C22;;;;N;;;;;
+2F2B;KANGXI RADICAL CORPSE;So;0;ON;<compat> 5C38;;;;N;;;;;
+2F2C;KANGXI RADICAL SPROUT;So;0;ON;<compat> 5C6E;;;;N;;;;;
+2F2D;KANGXI RADICAL MOUNTAIN;So;0;ON;<compat> 5C71;;;;N;;;;;
+2F2E;KANGXI RADICAL RIVER;So;0;ON;<compat> 5DDB;;;;N;;;;;
+2F2F;KANGXI RADICAL WORK;So;0;ON;<compat> 5DE5;;;;N;;;;;
+2F30;KANGXI RADICAL ONESELF;So;0;ON;<compat> 5DF1;;;;N;;;;;
+2F31;KANGXI RADICAL TURBAN;So;0;ON;<compat> 5DFE;;;;N;;;;;
+2F32;KANGXI RADICAL DRY;So;0;ON;<compat> 5E72;;;;N;;;;;
+2F33;KANGXI RADICAL SHORT THREAD;So;0;ON;<compat> 5E7A;;;;N;;;;;
+2F34;KANGXI RADICAL DOTTED CLIFF;So;0;ON;<compat> 5E7F;;;;N;;;;;
+2F35;KANGXI RADICAL LONG STRIDE;So;0;ON;<compat> 5EF4;;;;N;;;;;
+2F36;KANGXI RADICAL TWO HANDS;So;0;ON;<compat> 5EFE;;;;N;;;;;
+2F37;KANGXI RADICAL SHOOT;So;0;ON;<compat> 5F0B;;;;N;;;;;
+2F38;KANGXI RADICAL BOW;So;0;ON;<compat> 5F13;;;;N;;;;;
+2F39;KANGXI RADICAL SNOUT;So;0;ON;<compat> 5F50;;;;N;;;;;
+2F3A;KANGXI RADICAL BRISTLE;So;0;ON;<compat> 5F61;;;;N;;;;;
+2F3B;KANGXI RADICAL STEP;So;0;ON;<compat> 5F73;;;;N;;;;;
+2F3C;KANGXI RADICAL HEART;So;0;ON;<compat> 5FC3;;;;N;;;;;
+2F3D;KANGXI RADICAL HALBERD;So;0;ON;<compat> 6208;;;;N;;;;;
+2F3E;KANGXI RADICAL DOOR;So;0;ON;<compat> 6236;;;;N;;;;;
+2F3F;KANGXI RADICAL HAND;So;0;ON;<compat> 624B;;;;N;;;;;
+2F40;KANGXI RADICAL BRANCH;So;0;ON;<compat> 652F;;;;N;;;;;
+2F41;KANGXI RADICAL RAP;So;0;ON;<compat> 6534;;;;N;;;;;
+2F42;KANGXI RADICAL SCRIPT;So;0;ON;<compat> 6587;;;;N;;;;;
+2F43;KANGXI RADICAL DIPPER;So;0;ON;<compat> 6597;;;;N;;;;;
+2F44;KANGXI RADICAL AXE;So;0;ON;<compat> 65A4;;;;N;;;;;
+2F45;KANGXI RADICAL SQUARE;So;0;ON;<compat> 65B9;;;;N;;;;;
+2F46;KANGXI RADICAL NOT;So;0;ON;<compat> 65E0;;;;N;;;;;
+2F47;KANGXI RADICAL SUN;So;0;ON;<compat> 65E5;;;;N;;;;;
+2F48;KANGXI RADICAL SAY;So;0;ON;<compat> 66F0;;;;N;;;;;
+2F49;KANGXI RADICAL MOON;So;0;ON;<compat> 6708;;;;N;;;;;
+2F4A;KANGXI RADICAL TREE;So;0;ON;<compat> 6728;;;;N;;;;;
+2F4B;KANGXI RADICAL LACK;So;0;ON;<compat> 6B20;;;;N;;;;;
+2F4C;KANGXI RADICAL STOP;So;0;ON;<compat> 6B62;;;;N;;;;;
+2F4D;KANGXI RADICAL DEATH;So;0;ON;<compat> 6B79;;;;N;;;;;
+2F4E;KANGXI RADICAL WEAPON;So;0;ON;<compat> 6BB3;;;;N;;;;;
+2F4F;KANGXI RADICAL DO NOT;So;0;ON;<compat> 6BCB;;;;N;;;;;
+2F50;KANGXI RADICAL COMPARE;So;0;ON;<compat> 6BD4;;;;N;;;;;
+2F51;KANGXI RADICAL FUR;So;0;ON;<compat> 6BDB;;;;N;;;;;
+2F52;KANGXI RADICAL CLAN;So;0;ON;<compat> 6C0F;;;;N;;;;;
+2F53;KANGXI RADICAL STEAM;So;0;ON;<compat> 6C14;;;;N;;;;;
+2F54;KANGXI RADICAL WATER;So;0;ON;<compat> 6C34;;;;N;;;;;
+2F55;KANGXI RADICAL FIRE;So;0;ON;<compat> 706B;;;;N;;;;;
+2F56;KANGXI RADICAL CLAW;So;0;ON;<compat> 722A;;;;N;;;;;
+2F57;KANGXI RADICAL FATHER;So;0;ON;<compat> 7236;;;;N;;;;;
+2F58;KANGXI RADICAL DOUBLE X;So;0;ON;<compat> 723B;;;;N;;;;;
+2F59;KANGXI RADICAL HALF TREE TRUNK;So;0;ON;<compat> 723F;;;;N;;;;;
+2F5A;KANGXI RADICAL SLICE;So;0;ON;<compat> 7247;;;;N;;;;;
+2F5B;KANGXI RADICAL FANG;So;0;ON;<compat> 7259;;;;N;;;;;
+2F5C;KANGXI RADICAL COW;So;0;ON;<compat> 725B;;;;N;;;;;
+2F5D;KANGXI RADICAL DOG;So;0;ON;<compat> 72AC;;;;N;;;;;
+2F5E;KANGXI RADICAL PROFOUND;So;0;ON;<compat> 7384;;;;N;;;;;
+2F5F;KANGXI RADICAL JADE;So;0;ON;<compat> 7389;;;;N;;;;;
+2F60;KANGXI RADICAL MELON;So;0;ON;<compat> 74DC;;;;N;;;;;
+2F61;KANGXI RADICAL TILE;So;0;ON;<compat> 74E6;;;;N;;;;;
+2F62;KANGXI RADICAL SWEET;So;0;ON;<compat> 7518;;;;N;;;;;
+2F63;KANGXI RADICAL LIFE;So;0;ON;<compat> 751F;;;;N;;;;;
+2F64;KANGXI RADICAL USE;So;0;ON;<compat> 7528;;;;N;;;;;
+2F65;KANGXI RADICAL FIELD;So;0;ON;<compat> 7530;;;;N;;;;;
+2F66;KANGXI RADICAL BOLT OF CLOTH;So;0;ON;<compat> 758B;;;;N;;;;;
+2F67;KANGXI RADICAL SICKNESS;So;0;ON;<compat> 7592;;;;N;;;;;
+2F68;KANGXI RADICAL DOTTED TENT;So;0;ON;<compat> 7676;;;;N;;;;;
+2F69;KANGXI RADICAL WHITE;So;0;ON;<compat> 767D;;;;N;;;;;
+2F6A;KANGXI RADICAL SKIN;So;0;ON;<compat> 76AE;;;;N;;;;;
+2F6B;KANGXI RADICAL DISH;So;0;ON;<compat> 76BF;;;;N;;;;;
+2F6C;KANGXI RADICAL EYE;So;0;ON;<compat> 76EE;;;;N;;;;;
+2F6D;KANGXI RADICAL SPEAR;So;0;ON;<compat> 77DB;;;;N;;;;;
+2F6E;KANGXI RADICAL ARROW;So;0;ON;<compat> 77E2;;;;N;;;;;
+2F6F;KANGXI RADICAL STONE;So;0;ON;<compat> 77F3;;;;N;;;;;
+2F70;KANGXI RADICAL SPIRIT;So;0;ON;<compat> 793A;;;;N;;;;;
+2F71;KANGXI RADICAL TRACK;So;0;ON;<compat> 79B8;;;;N;;;;;
+2F72;KANGXI RADICAL GRAIN;So;0;ON;<compat> 79BE;;;;N;;;;;
+2F73;KANGXI RADICAL CAVE;So;0;ON;<compat> 7A74;;;;N;;;;;
+2F74;KANGXI RADICAL STAND;So;0;ON;<compat> 7ACB;;;;N;;;;;
+2F75;KANGXI RADICAL BAMBOO;So;0;ON;<compat> 7AF9;;;;N;;;;;
+2F76;KANGXI RADICAL RICE;So;0;ON;<compat> 7C73;;;;N;;;;;
+2F77;KANGXI RADICAL SILK;So;0;ON;<compat> 7CF8;;;;N;;;;;
+2F78;KANGXI RADICAL JAR;So;0;ON;<compat> 7F36;;;;N;;;;;
+2F79;KANGXI RADICAL NET;So;0;ON;<compat> 7F51;;;;N;;;;;
+2F7A;KANGXI RADICAL SHEEP;So;0;ON;<compat> 7F8A;;;;N;;;;;
+2F7B;KANGXI RADICAL FEATHER;So;0;ON;<compat> 7FBD;;;;N;;;;;
+2F7C;KANGXI RADICAL OLD;So;0;ON;<compat> 8001;;;;N;;;;;
+2F7D;KANGXI RADICAL AND;So;0;ON;<compat> 800C;;;;N;;;;;
+2F7E;KANGXI RADICAL PLOW;So;0;ON;<compat> 8012;;;;N;;;;;
+2F7F;KANGXI RADICAL EAR;So;0;ON;<compat> 8033;;;;N;;;;;
+2F80;KANGXI RADICAL BRUSH;So;0;ON;<compat> 807F;;;;N;;;;;
+2F81;KANGXI RADICAL MEAT;So;0;ON;<compat> 8089;;;;N;;;;;
+2F82;KANGXI RADICAL MINISTER;So;0;ON;<compat> 81E3;;;;N;;;;;
+2F83;KANGXI RADICAL SELF;So;0;ON;<compat> 81EA;;;;N;;;;;
+2F84;KANGXI RADICAL ARRIVE;So;0;ON;<compat> 81F3;;;;N;;;;;
+2F85;KANGXI RADICAL MORTAR;So;0;ON;<compat> 81FC;;;;N;;;;;
+2F86;KANGXI RADICAL TONGUE;So;0;ON;<compat> 820C;;;;N;;;;;
+2F87;KANGXI RADICAL OPPOSE;So;0;ON;<compat> 821B;;;;N;;;;;
+2F88;KANGXI RADICAL BOAT;So;0;ON;<compat> 821F;;;;N;;;;;
+2F89;KANGXI RADICAL STOPPING;So;0;ON;<compat> 826E;;;;N;;;;;
+2F8A;KANGXI RADICAL COLOR;So;0;ON;<compat> 8272;;;;N;;;;;
+2F8B;KANGXI RADICAL GRASS;So;0;ON;<compat> 8278;;;;N;;;;;
+2F8C;KANGXI RADICAL TIGER;So;0;ON;<compat> 864D;;;;N;;;;;
+2F8D;KANGXI RADICAL INSECT;So;0;ON;<compat> 866B;;;;N;;;;;
+2F8E;KANGXI RADICAL BLOOD;So;0;ON;<compat> 8840;;;;N;;;;;
+2F8F;KANGXI RADICAL WALK ENCLOSURE;So;0;ON;<compat> 884C;;;;N;;;;;
+2F90;KANGXI RADICAL CLOTHES;So;0;ON;<compat> 8863;;;;N;;;;;
+2F91;KANGXI RADICAL WEST;So;0;ON;<compat> 897E;;;;N;;;;;
+2F92;KANGXI RADICAL SEE;So;0;ON;<compat> 898B;;;;N;;;;;
+2F93;KANGXI RADICAL HORN;So;0;ON;<compat> 89D2;;;;N;;;;;
+2F94;KANGXI RADICAL SPEECH;So;0;ON;<compat> 8A00;;;;N;;;;;
+2F95;KANGXI RADICAL VALLEY;So;0;ON;<compat> 8C37;;;;N;;;;;
+2F96;KANGXI RADICAL BEAN;So;0;ON;<compat> 8C46;;;;N;;;;;
+2F97;KANGXI RADICAL PIG;So;0;ON;<compat> 8C55;;;;N;;;;;
+2F98;KANGXI RADICAL BADGER;So;0;ON;<compat> 8C78;;;;N;;;;;
+2F99;KANGXI RADICAL SHELL;So;0;ON;<compat> 8C9D;;;;N;;;;;
+2F9A;KANGXI RADICAL RED;So;0;ON;<compat> 8D64;;;;N;;;;;
+2F9B;KANGXI RADICAL RUN;So;0;ON;<compat> 8D70;;;;N;;;;;
+2F9C;KANGXI RADICAL FOOT;So;0;ON;<compat> 8DB3;;;;N;;;;;
+2F9D;KANGXI RADICAL BODY;So;0;ON;<compat> 8EAB;;;;N;;;;;
+2F9E;KANGXI RADICAL CART;So;0;ON;<compat> 8ECA;;;;N;;;;;
+2F9F;KANGXI RADICAL BITTER;So;0;ON;<compat> 8F9B;;;;N;;;;;
+2FA0;KANGXI RADICAL MORNING;So;0;ON;<compat> 8FB0;;;;N;;;;;
+2FA1;KANGXI RADICAL WALK;So;0;ON;<compat> 8FB5;;;;N;;;;;
+2FA2;KANGXI RADICAL CITY;So;0;ON;<compat> 9091;;;;N;;;;;
+2FA3;KANGXI RADICAL WINE;So;0;ON;<compat> 9149;;;;N;;;;;
+2FA4;KANGXI RADICAL DISTINGUISH;So;0;ON;<compat> 91C6;;;;N;;;;;
+2FA5;KANGXI RADICAL VILLAGE;So;0;ON;<compat> 91CC;;;;N;;;;;
+2FA6;KANGXI RADICAL GOLD;So;0;ON;<compat> 91D1;;;;N;;;;;
+2FA7;KANGXI RADICAL LONG;So;0;ON;<compat> 9577;;;;N;;;;;
+2FA8;KANGXI RADICAL GATE;So;0;ON;<compat> 9580;;;;N;;;;;
+2FA9;KANGXI RADICAL MOUND;So;0;ON;<compat> 961C;;;;N;;;;;
+2FAA;KANGXI RADICAL SLAVE;So;0;ON;<compat> 96B6;;;;N;;;;;
+2FAB;KANGXI RADICAL SHORT TAILED BIRD;So;0;ON;<compat> 96B9;;;;N;;;;;
+2FAC;KANGXI RADICAL RAIN;So;0;ON;<compat> 96E8;;;;N;;;;;
+2FAD;KANGXI RADICAL BLUE;So;0;ON;<compat> 9751;;;;N;;;;;
+2FAE;KANGXI RADICAL WRONG;So;0;ON;<compat> 975E;;;;N;;;;;
+2FAF;KANGXI RADICAL FACE;So;0;ON;<compat> 9762;;;;N;;;;;
+2FB0;KANGXI RADICAL LEATHER;So;0;ON;<compat> 9769;;;;N;;;;;
+2FB1;KANGXI RADICAL TANNED LEATHER;So;0;ON;<compat> 97CB;;;;N;;;;;
+2FB2;KANGXI RADICAL LEEK;So;0;ON;<compat> 97ED;;;;N;;;;;
+2FB3;KANGXI RADICAL SOUND;So;0;ON;<compat> 97F3;;;;N;;;;;
+2FB4;KANGXI RADICAL LEAF;So;0;ON;<compat> 9801;;;;N;;;;;
+2FB5;KANGXI RADICAL WIND;So;0;ON;<compat> 98A8;;;;N;;;;;
+2FB6;KANGXI RADICAL FLY;So;0;ON;<compat> 98DB;;;;N;;;;;
+2FB7;KANGXI RADICAL EAT;So;0;ON;<compat> 98DF;;;;N;;;;;
+2FB8;KANGXI RADICAL HEAD;So;0;ON;<compat> 9996;;;;N;;;;;
+2FB9;KANGXI RADICAL FRAGRANT;So;0;ON;<compat> 9999;;;;N;;;;;
+2FBA;KANGXI RADICAL HORSE;So;0;ON;<compat> 99AC;;;;N;;;;;
+2FBB;KANGXI RADICAL BONE;So;0;ON;<compat> 9AA8;;;;N;;;;;
+2FBC;KANGXI RADICAL TALL;So;0;ON;<compat> 9AD8;;;;N;;;;;
+2FBD;KANGXI RADICAL HAIR;So;0;ON;<compat> 9ADF;;;;N;;;;;
+2FBE;KANGXI RADICAL FIGHT;So;0;ON;<compat> 9B25;;;;N;;;;;
+2FBF;KANGXI RADICAL SACRIFICIAL WINE;So;0;ON;<compat> 9B2F;;;;N;;;;;
+2FC0;KANGXI RADICAL CAULDRON;So;0;ON;<compat> 9B32;;;;N;;;;;
+2FC1;KANGXI RADICAL GHOST;So;0;ON;<compat> 9B3C;;;;N;;;;;
+2FC2;KANGXI RADICAL FISH;So;0;ON;<compat> 9B5A;;;;N;;;;;
+2FC3;KANGXI RADICAL BIRD;So;0;ON;<compat> 9CE5;;;;N;;;;;
+2FC4;KANGXI RADICAL SALT;So;0;ON;<compat> 9E75;;;;N;;;;;
+2FC5;KANGXI RADICAL DEER;So;0;ON;<compat> 9E7F;;;;N;;;;;
+2FC6;KANGXI RADICAL WHEAT;So;0;ON;<compat> 9EA5;;;;N;;;;;
+2FC7;KANGXI RADICAL HEMP;So;0;ON;<compat> 9EBB;;;;N;;;;;
+2FC8;KANGXI RADICAL YELLOW;So;0;ON;<compat> 9EC3;;;;N;;;;;
+2FC9;KANGXI RADICAL MILLET;So;0;ON;<compat> 9ECD;;;;N;;;;;
+2FCA;KANGXI RADICAL BLACK;So;0;ON;<compat> 9ED1;;;;N;;;;;
+2FCB;KANGXI RADICAL EMBROIDERY;So;0;ON;<compat> 9EF9;;;;N;;;;;
+2FCC;KANGXI RADICAL FROG;So;0;ON;<compat> 9EFD;;;;N;;;;;
+2FCD;KANGXI RADICAL TRIPOD;So;0;ON;<compat> 9F0E;;;;N;;;;;
+2FCE;KANGXI RADICAL DRUM;So;0;ON;<compat> 9F13;;;;N;;;;;
+2FCF;KANGXI RADICAL RAT;So;0;ON;<compat> 9F20;;;;N;;;;;
+2FD0;KANGXI RADICAL NOSE;So;0;ON;<compat> 9F3B;;;;N;;;;;
+2FD1;KANGXI RADICAL EVEN;So;0;ON;<compat> 9F4A;;;;N;;;;;
+2FD2;KANGXI RADICAL TOOTH;So;0;ON;<compat> 9F52;;;;N;;;;;
+2FD3;KANGXI RADICAL DRAGON;So;0;ON;<compat> 9F8D;;;;N;;;;;
+2FD4;KANGXI RADICAL TURTLE;So;0;ON;<compat> 9F9C;;;;N;;;;;
+2FD5;KANGXI RADICAL FLUTE;So;0;ON;<compat> 9FA0;;;;N;;;;;
+2FF0;IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT;So;0;ON;;;;;N;;;;;
+2FF1;IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO BELOW;So;0;ON;;;;;N;;;;;
+2FF2;IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO MIDDLE AND RIGHT;So;0;ON;;;;;N;;;;;
+2FF3;IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO MIDDLE AND BELOW;So;0;ON;;;;;N;;;;;
+2FF4;IDEOGRAPHIC DESCRIPTION CHARACTER FULL SURROUND;So;0;ON;;;;;N;;;;;
+2FF5;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE;So;0;ON;;;;;N;;;;;
+2FF6;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM BELOW;So;0;ON;;;;;N;;;;;
+2FF7;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LEFT;So;0;ON;;;;;N;;;;;
+2FF8;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER LEFT;So;0;ON;;;;;N;;;;;
+2FF9;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER RIGHT;So;0;ON;;;;;N;;;;;
+2FFA;IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LOWER LEFT;So;0;ON;;;;;N;;;;;
+2FFB;IDEOGRAPHIC DESCRIPTION CHARACTER OVERLAID;So;0;ON;;;;;N;;;;;
+3000;IDEOGRAPHIC SPACE;Zs;0;WS;<wide> 0020;;;;N;;;;;
+3001;IDEOGRAPHIC COMMA;Po;0;ON;;;;;N;;;;;
+3002;IDEOGRAPHIC FULL STOP;Po;0;ON;;;;;N;IDEOGRAPHIC PERIOD;;;;
+3003;DITTO MARK;Po;0;ON;;;;;N;;;;;
+3004;JAPANESE INDUSTRIAL STANDARD SYMBOL;So;0;ON;;;;;N;;;;;
+3005;IDEOGRAPHIC ITERATION MARK;Lm;0;L;;;;;N;;;;;
+3006;IDEOGRAPHIC CLOSING MARK;Lo;0;L;;;;;N;;;;;
+3007;IDEOGRAPHIC NUMBER ZERO;Nl;0;L;;;;0;N;;;;;
+3008;LEFT ANGLE BRACKET;Ps;0;ON;;;;;Y;OPENING ANGLE BRACKET;;;;
+3009;RIGHT ANGLE BRACKET;Pe;0;ON;;;;;Y;CLOSING ANGLE BRACKET;;;;
+300A;LEFT DOUBLE ANGLE BRACKET;Ps;0;ON;;;;;Y;OPENING DOUBLE ANGLE BRACKET;;;;
+300B;RIGHT DOUBLE ANGLE BRACKET;Pe;0;ON;;;;;Y;CLOSING DOUBLE ANGLE BRACKET;;;;
+300C;LEFT CORNER BRACKET;Ps;0;ON;;;;;Y;OPENING CORNER BRACKET;;;;
+300D;RIGHT CORNER BRACKET;Pe;0;ON;;;;;Y;CLOSING CORNER BRACKET;;;;
+300E;LEFT WHITE CORNER BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE CORNER BRACKET;;;;
+300F;RIGHT WHITE CORNER BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE CORNER BRACKET;;;;
+3010;LEFT BLACK LENTICULAR BRACKET;Ps;0;ON;;;;;Y;OPENING BLACK LENTICULAR BRACKET;;;;
+3011;RIGHT BLACK LENTICULAR BRACKET;Pe;0;ON;;;;;Y;CLOSING BLACK LENTICULAR BRACKET;;;;
+3012;POSTAL MARK;So;0;ON;;;;;N;;;;;
+3013;GETA MARK;So;0;ON;;;;;N;;;;;
+3014;LEFT TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;OPENING TORTOISE SHELL BRACKET;;;;
+3015;RIGHT TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;CLOSING TORTOISE SHELL BRACKET;;;;
+3016;LEFT WHITE LENTICULAR BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE LENTICULAR BRACKET;;;;
+3017;RIGHT WHITE LENTICULAR BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE LENTICULAR BRACKET;;;;
+3018;LEFT WHITE TORTOISE SHELL BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE TORTOISE SHELL BRACKET;;;;
+3019;RIGHT WHITE TORTOISE SHELL BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE TORTOISE SHELL BRACKET;;;;
+301A;LEFT WHITE SQUARE BRACKET;Ps;0;ON;;;;;Y;OPENING WHITE SQUARE BRACKET;;;;
+301B;RIGHT WHITE SQUARE BRACKET;Pe;0;ON;;;;;Y;CLOSING WHITE SQUARE BRACKET;;;;
+301C;WAVE DASH;Pd;0;ON;;;;;N;;;;;
+301D;REVERSED DOUBLE PRIME QUOTATION MARK;Ps;0;ON;;;;;Y;;;;;
+301E;DOUBLE PRIME QUOTATION MARK;Pe;0;ON;;;;;Y;;;;;
+301F;LOW DOUBLE PRIME QUOTATION MARK;Pe;0;ON;;;;;Y;;;;;
+3020;POSTAL MARK FACE;So;0;ON;;;;;N;;;;;
+3021;HANGZHOU NUMERAL ONE;Nl;0;L;;;;1;N;;;;;
+3022;HANGZHOU NUMERAL TWO;Nl;0;L;;;;2;N;;;;;
+3023;HANGZHOU NUMERAL THREE;Nl;0;L;;;;3;N;;;;;
+3024;HANGZHOU NUMERAL FOUR;Nl;0;L;;;;4;N;;;;;
+3025;HANGZHOU NUMERAL FIVE;Nl;0;L;;;;5;N;;;;;
+3026;HANGZHOU NUMERAL SIX;Nl;0;L;;;;6;N;;;;;
+3027;HANGZHOU NUMERAL SEVEN;Nl;0;L;;;;7;N;;;;;
+3028;HANGZHOU NUMERAL EIGHT;Nl;0;L;;;;8;N;;;;;
+3029;HANGZHOU NUMERAL NINE;Nl;0;L;;;;9;N;;;;;
+302A;IDEOGRAPHIC LEVEL TONE MARK;Mn;218;NSM;;;;;N;;;;;
+302B;IDEOGRAPHIC RISING TONE MARK;Mn;228;NSM;;;;;N;;;;;
+302C;IDEOGRAPHIC DEPARTING TONE MARK;Mn;232;NSM;;;;;N;;;;;
+302D;IDEOGRAPHIC ENTERING TONE MARK;Mn;222;NSM;;;;;N;;;;;
+302E;HANGUL SINGLE DOT TONE MARK;Mn;224;NSM;;;;;N;;;;;
+302F;HANGUL DOUBLE DOT TONE MARK;Mn;224;NSM;;;;;N;;;;;
+3030;WAVY DASH;Pd;0;ON;;;;;N;;;;;
+3031;VERTICAL KANA REPEAT MARK;Lm;0;L;;;;;N;;;;;
+3032;VERTICAL KANA REPEAT WITH VOICED SOUND MARK;Lm;0;L;;;;;N;;;;;
+3033;VERTICAL KANA REPEAT MARK UPPER HALF;Lm;0;L;;;;;N;;;;;
+3034;VERTICAL KANA REPEAT WITH VOICED SOUND MARK UPPER HALF;Lm;0;L;;;;;N;;;;;
+3035;VERTICAL KANA REPEAT MARK LOWER HALF;Lm;0;L;;;;;N;;;;;
+3036;CIRCLED POSTAL MARK;So;0;ON;<compat> 3012;;;;N;;;;;
+3037;IDEOGRAPHIC TELEGRAPH LINE FEED SEPARATOR SYMBOL;So;0;ON;;;;;N;;;;;
+3038;HANGZHOU NUMERAL TEN;Nl;0;L;<compat> 5341;;;10;N;;;;;
+3039;HANGZHOU NUMERAL TWENTY;Nl;0;L;<compat> 5344;;;20;N;;;;;
+303A;HANGZHOU NUMERAL THIRTY;Nl;0;L;<compat> 5345;;;30;N;;;;;
+303B;VERTICAL IDEOGRAPHIC ITERATION MARK;Lm;0;L;;;;;N;;;;;
+303C;MASU MARK;Lo;0;L;;;;;N;;;;;
+303D;PART ALTERNATION MARK;Po;0;ON;;;;;N;;;;;
+303E;IDEOGRAPHIC VARIATION INDICATOR;So;0;ON;;;;;N;;;;;
+303F;IDEOGRAPHIC HALF FILL SPACE;So;0;ON;;;;;N;;;;;
+3041;HIRAGANA LETTER SMALL A;Lo;0;L;;;;;N;;;;;
+3042;HIRAGANA LETTER A;Lo;0;L;;;;;N;;;;;
+3043;HIRAGANA LETTER SMALL I;Lo;0;L;;;;;N;;;;;
+3044;HIRAGANA LETTER I;Lo;0;L;;;;;N;;;;;
+3045;HIRAGANA LETTER SMALL U;Lo;0;L;;;;;N;;;;;
+3046;HIRAGANA LETTER U;Lo;0;L;;;;;N;;;;;
+3047;HIRAGANA LETTER SMALL E;Lo;0;L;;;;;N;;;;;
+3048;HIRAGANA LETTER E;Lo;0;L;;;;;N;;;;;
+3049;HIRAGANA LETTER SMALL O;Lo;0;L;;;;;N;;;;;
+304A;HIRAGANA LETTER O;Lo;0;L;;;;;N;;;;;
+304B;HIRAGANA LETTER KA;Lo;0;L;;;;;N;;;;;
+304C;HIRAGANA LETTER GA;Lo;0;L;304B 3099;;;;N;;;;;
+304D;HIRAGANA LETTER KI;Lo;0;L;;;;;N;;;;;
+304E;HIRAGANA LETTER GI;Lo;0;L;304D 3099;;;;N;;;;;
+304F;HIRAGANA LETTER KU;Lo;0;L;;;;;N;;;;;
+3050;HIRAGANA LETTER GU;Lo;0;L;304F 3099;;;;N;;;;;
+3051;HIRAGANA LETTER KE;Lo;0;L;;;;;N;;;;;
+3052;HIRAGANA LETTER GE;Lo;0;L;3051 3099;;;;N;;;;;
+3053;HIRAGANA LETTER KO;Lo;0;L;;;;;N;;;;;
+3054;HIRAGANA LETTER GO;Lo;0;L;3053 3099;;;;N;;;;;
+3055;HIRAGANA LETTER SA;Lo;0;L;;;;;N;;;;;
+3056;HIRAGANA LETTER ZA;Lo;0;L;3055 3099;;;;N;;;;;
+3057;HIRAGANA LETTER SI;Lo;0;L;;;;;N;;;;;
+3058;HIRAGANA LETTER ZI;Lo;0;L;3057 3099;;;;N;;;;;
+3059;HIRAGANA LETTER SU;Lo;0;L;;;;;N;;;;;
+305A;HIRAGANA LETTER ZU;Lo;0;L;3059 3099;;;;N;;;;;
+305B;HIRAGANA LETTER SE;Lo;0;L;;;;;N;;;;;
+305C;HIRAGANA LETTER ZE;Lo;0;L;305B 3099;;;;N;;;;;
+305D;HIRAGANA LETTER SO;Lo;0;L;;;;;N;;;;;
+305E;HIRAGANA LETTER ZO;Lo;0;L;305D 3099;;;;N;;;;;
+305F;HIRAGANA LETTER TA;Lo;0;L;;;;;N;;;;;
+3060;HIRAGANA LETTER DA;Lo;0;L;305F 3099;;;;N;;;;;
+3061;HIRAGANA LETTER TI;Lo;0;L;;;;;N;;;;;
+3062;HIRAGANA LETTER DI;Lo;0;L;3061 3099;;;;N;;;;;
+3063;HIRAGANA LETTER SMALL TU;Lo;0;L;;;;;N;;;;;
+3064;HIRAGANA LETTER TU;Lo;0;L;;;;;N;;;;;
+3065;HIRAGANA LETTER DU;Lo;0;L;3064 3099;;;;N;;;;;
+3066;HIRAGANA LETTER TE;Lo;0;L;;;;;N;;;;;
+3067;HIRAGANA LETTER DE;Lo;0;L;3066 3099;;;;N;;;;;
+3068;HIRAGANA LETTER TO;Lo;0;L;;;;;N;;;;;
+3069;HIRAGANA LETTER DO;Lo;0;L;3068 3099;;;;N;;;;;
+306A;HIRAGANA LETTER NA;Lo;0;L;;;;;N;;;;;
+306B;HIRAGANA LETTER NI;Lo;0;L;;;;;N;;;;;
+306C;HIRAGANA LETTER NU;Lo;0;L;;;;;N;;;;;
+306D;HIRAGANA LETTER NE;Lo;0;L;;;;;N;;;;;
+306E;HIRAGANA LETTER NO;Lo;0;L;;;;;N;;;;;
+306F;HIRAGANA LETTER HA;Lo;0;L;;;;;N;;;;;
+3070;HIRAGANA LETTER BA;Lo;0;L;306F 3099;;;;N;;;;;
+3071;HIRAGANA LETTER PA;Lo;0;L;306F 309A;;;;N;;;;;
+3072;HIRAGANA LETTER HI;Lo;0;L;;;;;N;;;;;
+3073;HIRAGANA LETTER BI;Lo;0;L;3072 3099;;;;N;;;;;
+3074;HIRAGANA LETTER PI;Lo;0;L;3072 309A;;;;N;;;;;
+3075;HIRAGANA LETTER HU;Lo;0;L;;;;;N;;;;;
+3076;HIRAGANA LETTER BU;Lo;0;L;3075 3099;;;;N;;;;;
+3077;HIRAGANA LETTER PU;Lo;0;L;3075 309A;;;;N;;;;;
+3078;HIRAGANA LETTER HE;Lo;0;L;;;;;N;;;;;
+3079;HIRAGANA LETTER BE;Lo;0;L;3078 3099;;;;N;;;;;
+307A;HIRAGANA LETTER PE;Lo;0;L;3078 309A;;;;N;;;;;
+307B;HIRAGANA LETTER HO;Lo;0;L;;;;;N;;;;;
+307C;HIRAGANA LETTER BO;Lo;0;L;307B 3099;;;;N;;;;;
+307D;HIRAGANA LETTER PO;Lo;0;L;307B 309A;;;;N;;;;;
+307E;HIRAGANA LETTER MA;Lo;0;L;;;;;N;;;;;
+307F;HIRAGANA LETTER MI;Lo;0;L;;;;;N;;;;;
+3080;HIRAGANA LETTER MU;Lo;0;L;;;;;N;;;;;
+3081;HIRAGANA LETTER ME;Lo;0;L;;;;;N;;;;;
+3082;HIRAGANA LETTER MO;Lo;0;L;;;;;N;;;;;
+3083;HIRAGANA LETTER SMALL YA;Lo;0;L;;;;;N;;;;;
+3084;HIRAGANA LETTER YA;Lo;0;L;;;;;N;;;;;
+3085;HIRAGANA LETTER SMALL YU;Lo;0;L;;;;;N;;;;;
+3086;HIRAGANA LETTER YU;Lo;0;L;;;;;N;;;;;
+3087;HIRAGANA LETTER SMALL YO;Lo;0;L;;;;;N;;;;;
+3088;HIRAGANA LETTER YO;Lo;0;L;;;;;N;;;;;
+3089;HIRAGANA LETTER RA;Lo;0;L;;;;;N;;;;;
+308A;HIRAGANA LETTER RI;Lo;0;L;;;;;N;;;;;
+308B;HIRAGANA LETTER RU;Lo;0;L;;;;;N;;;;;
+308C;HIRAGANA LETTER RE;Lo;0;L;;;;;N;;;;;
+308D;HIRAGANA LETTER RO;Lo;0;L;;;;;N;;;;;
+308E;HIRAGANA LETTER SMALL WA;Lo;0;L;;;;;N;;;;;
+308F;HIRAGANA LETTER WA;Lo;0;L;;;;;N;;;;;
+3090;HIRAGANA LETTER WI;Lo;0;L;;;;;N;;;;;
+3091;HIRAGANA LETTER WE;Lo;0;L;;;;;N;;;;;
+3092;HIRAGANA LETTER WO;Lo;0;L;;;;;N;;;;;
+3093;HIRAGANA LETTER N;Lo;0;L;;;;;N;;;;;
+3094;HIRAGANA LETTER VU;Lo;0;L;3046 3099;;;;N;;;;;
+3095;HIRAGANA LETTER SMALL KA;Lo;0;L;;;;;N;;;;;
+3096;HIRAGANA LETTER SMALL KE;Lo;0;L;;;;;N;;;;;
+3099;COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK;Mn;8;NSM;;;;;N;NON-SPACING KATAKANA-HIRAGANA VOICED SOUND MARK;;;;
+309A;COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK;Mn;8;NSM;;;;;N;NON-SPACING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK;;;;
+309B;KATAKANA-HIRAGANA VOICED SOUND MARK;Sk;0;ON;<compat> 0020 3099;;;;N;;;;;
+309C;KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK;Sk;0;ON;<compat> 0020 309A;;;;N;;;;;
+309D;HIRAGANA ITERATION MARK;Lm;0;L;;;;;N;;;;;
+309E;HIRAGANA VOICED ITERATION MARK;Lm;0;L;309D 3099;;;;N;;;;;
+309F;HIRAGANA DIGRAPH YORI;Lo;0;L;<vertical> 3088 308A;;;;N;;;;;
+30A0;KATAKANA-HIRAGANA DOUBLE HYPHEN;Pd;0;ON;;;;;N;;;;;
+30A1;KATAKANA LETTER SMALL A;Lo;0;L;;;;;N;;;;;
+30A2;KATAKANA LETTER A;Lo;0;L;;;;;N;;;;;
+30A3;KATAKANA LETTER SMALL I;Lo;0;L;;;;;N;;;;;
+30A4;KATAKANA LETTER I;Lo;0;L;;;;;N;;;;;
+30A5;KATAKANA LETTER SMALL U;Lo;0;L;;;;;N;;;;;
+30A6;KATAKANA LETTER U;Lo;0;L;;;;;N;;;;;
+30A7;KATAKANA LETTER SMALL E;Lo;0;L;;;;;N;;;;;
+30A8;KATAKANA LETTER E;Lo;0;L;;;;;N;;;;;
+30A9;KATAKANA LETTER SMALL O;Lo;0;L;;;;;N;;;;;
+30AA;KATAKANA LETTER O;Lo;0;L;;;;;N;;;;;
+30AB;KATAKANA LETTER KA;Lo;0;L;;;;;N;;;;;
+30AC;KATAKANA LETTER GA;Lo;0;L;30AB 3099;;;;N;;;;;
+30AD;KATAKANA LETTER KI;Lo;0;L;;;;;N;;;;;
+30AE;KATAKANA LETTER GI;Lo;0;L;30AD 3099;;;;N;;;;;
+30AF;KATAKANA LETTER KU;Lo;0;L;;;;;N;;;;;
+30B0;KATAKANA LETTER GU;Lo;0;L;30AF 3099;;;;N;;;;;
+30B1;KATAKANA LETTER KE;Lo;0;L;;;;;N;;;;;
+30B2;KATAKANA LETTER GE;Lo;0;L;30B1 3099;;;;N;;;;;
+30B3;KATAKANA LETTER KO;Lo;0;L;;;;;N;;;;;
+30B4;KATAKANA LETTER GO;Lo;0;L;30B3 3099;;;;N;;;;;
+30B5;KATAKANA LETTER SA;Lo;0;L;;;;;N;;;;;
+30B6;KATAKANA LETTER ZA;Lo;0;L;30B5 3099;;;;N;;;;;
+30B7;KATAKANA LETTER SI;Lo;0;L;;;;;N;;;;;
+30B8;KATAKANA LETTER ZI;Lo;0;L;30B7 3099;;;;N;;;;;
+30B9;KATAKANA LETTER SU;Lo;0;L;;;;;N;;;;;
+30BA;KATAKANA LETTER ZU;Lo;0;L;30B9 3099;;;;N;;;;;
+30BB;KATAKANA LETTER SE;Lo;0;L;;;;;N;;;;;
+30BC;KATAKANA LETTER ZE;Lo;0;L;30BB 3099;;;;N;;;;;
+30BD;KATAKANA LETTER SO;Lo;0;L;;;;;N;;;;;
+30BE;KATAKANA LETTER ZO;Lo;0;L;30BD 3099;;;;N;;;;;
+30BF;KATAKANA LETTER TA;Lo;0;L;;;;;N;;;;;
+30C0;KATAKANA LETTER DA;Lo;0;L;30BF 3099;;;;N;;;;;
+30C1;KATAKANA LETTER TI;Lo;0;L;;;;;N;;;;;
+30C2;KATAKANA LETTER DI;Lo;0;L;30C1 3099;;;;N;;;;;
+30C3;KATAKANA LETTER SMALL TU;Lo;0;L;;;;;N;;;;;
+30C4;KATAKANA LETTER TU;Lo;0;L;;;;;N;;;;;
+30C5;KATAKANA LETTER DU;Lo;0;L;30C4 3099;;;;N;;;;;
+30C6;KATAKANA LETTER TE;Lo;0;L;;;;;N;;;;;
+30C7;KATAKANA LETTER DE;Lo;0;L;30C6 3099;;;;N;;;;;
+30C8;KATAKANA LETTER TO;Lo;0;L;;;;;N;;;;;
+30C9;KATAKANA LETTER DO;Lo;0;L;30C8 3099;;;;N;;;;;
+30CA;KATAKANA LETTER NA;Lo;0;L;;;;;N;;;;;
+30CB;KATAKANA LETTER NI;Lo;0;L;;;;;N;;;;;
+30CC;KATAKANA LETTER NU;Lo;0;L;;;;;N;;;;;
+30CD;KATAKANA LETTER NE;Lo;0;L;;;;;N;;;;;
+30CE;KATAKANA LETTER NO;Lo;0;L;;;;;N;;;;;
+30CF;KATAKANA LETTER HA;Lo;0;L;;;;;N;;;;;
+30D0;KATAKANA LETTER BA;Lo;0;L;30CF 3099;;;;N;;;;;
+30D1;KATAKANA LETTER PA;Lo;0;L;30CF 309A;;;;N;;;;;
+30D2;KATAKANA LETTER HI;Lo;0;L;;;;;N;;;;;
+30D3;KATAKANA LETTER BI;Lo;0;L;30D2 3099;;;;N;;;;;
+30D4;KATAKANA LETTER PI;Lo;0;L;30D2 309A;;;;N;;;;;
+30D5;KATAKANA LETTER HU;Lo;0;L;;;;;N;;;;;
+30D6;KATAKANA LETTER BU;Lo;0;L;30D5 3099;;;;N;;;;;
+30D7;KATAKANA LETTER PU;Lo;0;L;30D5 309A;;;;N;;;;;
+30D8;KATAKANA LETTER HE;Lo;0;L;;;;;N;;;;;
+30D9;KATAKANA LETTER BE;Lo;0;L;30D8 3099;;;;N;;;;;
+30DA;KATAKANA LETTER PE;Lo;0;L;30D8 309A;;;;N;;;;;
+30DB;KATAKANA LETTER HO;Lo;0;L;;;;;N;;;;;
+30DC;KATAKANA LETTER BO;Lo;0;L;30DB 3099;;;;N;;;;;
+30DD;KATAKANA LETTER PO;Lo;0;L;30DB 309A;;;;N;;;;;
+30DE;KATAKANA LETTER MA;Lo;0;L;;;;;N;;;;;
+30DF;KATAKANA LETTER MI;Lo;0;L;;;;;N;;;;;
+30E0;KATAKANA LETTER MU;Lo;0;L;;;;;N;;;;;
+30E1;KATAKANA LETTER ME;Lo;0;L;;;;;N;;;;;
+30E2;KATAKANA LETTER MO;Lo;0;L;;;;;N;;;;;
+30E3;KATAKANA LETTER SMALL YA;Lo;0;L;;;;;N;;;;;
+30E4;KATAKANA LETTER YA;Lo;0;L;;;;;N;;;;;
+30E5;KATAKANA LETTER SMALL YU;Lo;0;L;;;;;N;;;;;
+30E6;KATAKANA LETTER YU;Lo;0;L;;;;;N;;;;;
+30E7;KATAKANA LETTER SMALL YO;Lo;0;L;;;;;N;;;;;
+30E8;KATAKANA LETTER YO;Lo;0;L;;;;;N;;;;;
+30E9;KATAKANA LETTER RA;Lo;0;L;;;;;N;;;;;
+30EA;KATAKANA LETTER RI;Lo;0;L;;;;;N;;;;;
+30EB;KATAKANA LETTER RU;Lo;0;L;;;;;N;;;;;
+30EC;KATAKANA LETTER RE;Lo;0;L;;;;;N;;;;;
+30ED;KATAKANA LETTER RO;Lo;0;L;;;;;N;;;;;
+30EE;KATAKANA LETTER SMALL WA;Lo;0;L;;;;;N;;;;;
+30EF;KATAKANA LETTER WA;Lo;0;L;;;;;N;;;;;
+30F0;KATAKANA LETTER WI;Lo;0;L;;;;;N;;;;;
+30F1;KATAKANA LETTER WE;Lo;0;L;;;;;N;;;;;
+30F2;KATAKANA LETTER WO;Lo;0;L;;;;;N;;;;;
+30F3;KATAKANA LETTER N;Lo;0;L;;;;;N;;;;;
+30F4;KATAKANA LETTER VU;Lo;0;L;30A6 3099;;;;N;;;;;
+30F5;KATAKANA LETTER SMALL KA;Lo;0;L;;;;;N;;;;;
+30F6;KATAKANA LETTER SMALL KE;Lo;0;L;;;;;N;;;;;
+30F7;KATAKANA LETTER VA;Lo;0;L;30EF 3099;;;;N;;;;;
+30F8;KATAKANA LETTER VI;Lo;0;L;30F0 3099;;;;N;;;;;
+30F9;KATAKANA LETTER VE;Lo;0;L;30F1 3099;;;;N;;;;;
+30FA;KATAKANA LETTER VO;Lo;0;L;30F2 3099;;;;N;;;;;
+30FB;KATAKANA MIDDLE DOT;Po;0;ON;;;;;N;;;;;
+30FC;KATAKANA-HIRAGANA PROLONGED SOUND MARK;Lm;0;L;;;;;N;;;;;
+30FD;KATAKANA ITERATION MARK;Lm;0;L;;;;;N;;;;;
+30FE;KATAKANA VOICED ITERATION MARK;Lm;0;L;30FD 3099;;;;N;;;;;
+30FF;KATAKANA DIGRAPH KOTO;Lo;0;L;<vertical> 30B3 30C8;;;;N;;;;;
+3105;BOPOMOFO LETTER B;Lo;0;L;;;;;N;;;;;
+3106;BOPOMOFO LETTER P;Lo;0;L;;;;;N;;;;;
+3107;BOPOMOFO LETTER M;Lo;0;L;;;;;N;;;;;
+3108;BOPOMOFO LETTER F;Lo;0;L;;;;;N;;;;;
+3109;BOPOMOFO LETTER D;Lo;0;L;;;;;N;;;;;
+310A;BOPOMOFO LETTER T;Lo;0;L;;;;;N;;;;;
+310B;BOPOMOFO LETTER N;Lo;0;L;;;;;N;;;;;
+310C;BOPOMOFO LETTER L;Lo;0;L;;;;;N;;;;;
+310D;BOPOMOFO LETTER G;Lo;0;L;;;;;N;;;;;
+310E;BOPOMOFO LETTER K;Lo;0;L;;;;;N;;;;;
+310F;BOPOMOFO LETTER H;Lo;0;L;;;;;N;;;;;
+3110;BOPOMOFO LETTER J;Lo;0;L;;;;;N;;;;;
+3111;BOPOMOFO LETTER Q;Lo;0;L;;;;;N;;;;;
+3112;BOPOMOFO LETTER X;Lo;0;L;;;;;N;;;;;
+3113;BOPOMOFO LETTER ZH;Lo;0;L;;;;;N;;;;;
+3114;BOPOMOFO LETTER CH;Lo;0;L;;;;;N;;;;;
+3115;BOPOMOFO LETTER SH;Lo;0;L;;;;;N;;;;;
+3116;BOPOMOFO LETTER R;Lo;0;L;;;;;N;;;;;
+3117;BOPOMOFO LETTER Z;Lo;0;L;;;;;N;;;;;
+3118;BOPOMOFO LETTER C;Lo;0;L;;;;;N;;;;;
+3119;BOPOMOFO LETTER S;Lo;0;L;;;;;N;;;;;
+311A;BOPOMOFO LETTER A;Lo;0;L;;;;;N;;;;;
+311B;BOPOMOFO LETTER O;Lo;0;L;;;;;N;;;;;
+311C;BOPOMOFO LETTER E;Lo;0;L;;;;;N;;;;;
+311D;BOPOMOFO LETTER EH;Lo;0;L;;;;;N;;;;;
+311E;BOPOMOFO LETTER AI;Lo;0;L;;;;;N;;;;;
+311F;BOPOMOFO LETTER EI;Lo;0;L;;;;;N;;;;;
+3120;BOPOMOFO LETTER AU;Lo;0;L;;;;;N;;;;;
+3121;BOPOMOFO LETTER OU;Lo;0;L;;;;;N;;;;;
+3122;BOPOMOFO LETTER AN;Lo;0;L;;;;;N;;;;;
+3123;BOPOMOFO LETTER EN;Lo;0;L;;;;;N;;;;;
+3124;BOPOMOFO LETTER ANG;Lo;0;L;;;;;N;;;;;
+3125;BOPOMOFO LETTER ENG;Lo;0;L;;;;;N;;;;;
+3126;BOPOMOFO LETTER ER;Lo;0;L;;;;;N;;;;;
+3127;BOPOMOFO LETTER I;Lo;0;L;;;;;N;;;;;
+3128;BOPOMOFO LETTER U;Lo;0;L;;;;;N;;;;;
+3129;BOPOMOFO LETTER IU;Lo;0;L;;;;;N;;;;;
+312A;BOPOMOFO LETTER V;Lo;0;L;;;;;N;;;;;
+312B;BOPOMOFO LETTER NG;Lo;0;L;;;;;N;;;;;
+312C;BOPOMOFO LETTER GN;Lo;0;L;;;;;N;;;;;
+3131;HANGUL LETTER KIYEOK;Lo;0;L;<compat> 1100;;;;N;HANGUL LETTER GIYEOG;;;;
+3132;HANGUL LETTER SSANGKIYEOK;Lo;0;L;<compat> 1101;;;;N;HANGUL LETTER SSANG GIYEOG;;;;
+3133;HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<compat> 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;;
+3134;HANGUL LETTER NIEUN;Lo;0;L;<compat> 1102;;;;N;;;;;
+3135;HANGUL LETTER NIEUN-CIEUC;Lo;0;L;<compat> 11AC;;;;N;HANGUL LETTER NIEUN JIEUJ;;;;
+3136;HANGUL LETTER NIEUN-HIEUH;Lo;0;L;<compat> 11AD;;;;N;HANGUL LETTER NIEUN HIEUH;;;;
+3137;HANGUL LETTER TIKEUT;Lo;0;L;<compat> 1103;;;;N;HANGUL LETTER DIGEUD;;;;
+3138;HANGUL LETTER SSANGTIKEUT;Lo;0;L;<compat> 1104;;;;N;HANGUL LETTER SSANG DIGEUD;;;;
+3139;HANGUL LETTER RIEUL;Lo;0;L;<compat> 1105;;;;N;HANGUL LETTER LIEUL;;;;
+313A;HANGUL LETTER RIEUL-KIYEOK;Lo;0;L;<compat> 11B0;;;;N;HANGUL LETTER LIEUL GIYEOG;;;;
+313B;HANGUL LETTER RIEUL-MIEUM;Lo;0;L;<compat> 11B1;;;;N;HANGUL LETTER LIEUL MIEUM;;;;
+313C;HANGUL LETTER RIEUL-PIEUP;Lo;0;L;<compat> 11B2;;;;N;HANGUL LETTER LIEUL BIEUB;;;;
+313D;HANGUL LETTER RIEUL-SIOS;Lo;0;L;<compat> 11B3;;;;N;HANGUL LETTER LIEUL SIOS;;;;
+313E;HANGUL LETTER RIEUL-THIEUTH;Lo;0;L;<compat> 11B4;;;;N;HANGUL LETTER LIEUL TIEUT;;;;
+313F;HANGUL LETTER RIEUL-PHIEUPH;Lo;0;L;<compat> 11B5;;;;N;HANGUL LETTER LIEUL PIEUP;;;;
+3140;HANGUL LETTER RIEUL-HIEUH;Lo;0;L;<compat> 111A;;;;N;HANGUL LETTER LIEUL HIEUH;;;;
+3141;HANGUL LETTER MIEUM;Lo;0;L;<compat> 1106;;;;N;;;;;
+3142;HANGUL LETTER PIEUP;Lo;0;L;<compat> 1107;;;;N;HANGUL LETTER BIEUB;;;;
+3143;HANGUL LETTER SSANGPIEUP;Lo;0;L;<compat> 1108;;;;N;HANGUL LETTER SSANG BIEUB;;;;
+3144;HANGUL LETTER PIEUP-SIOS;Lo;0;L;<compat> 1121;;;;N;HANGUL LETTER BIEUB SIOS;;;;
+3145;HANGUL LETTER SIOS;Lo;0;L;<compat> 1109;;;;N;;;;;
+3146;HANGUL LETTER SSANGSIOS;Lo;0;L;<compat> 110A;;;;N;HANGUL LETTER SSANG SIOS;;;;
+3147;HANGUL LETTER IEUNG;Lo;0;L;<compat> 110B;;;;N;;;;;
+3148;HANGUL LETTER CIEUC;Lo;0;L;<compat> 110C;;;;N;HANGUL LETTER JIEUJ;;;;
+3149;HANGUL LETTER SSANGCIEUC;Lo;0;L;<compat> 110D;;;;N;HANGUL LETTER SSANG JIEUJ;;;;
+314A;HANGUL LETTER CHIEUCH;Lo;0;L;<compat> 110E;;;;N;HANGUL LETTER CIEUC;;;;
+314B;HANGUL LETTER KHIEUKH;Lo;0;L;<compat> 110F;;;;N;HANGUL LETTER KIYEOK;;;;
+314C;HANGUL LETTER THIEUTH;Lo;0;L;<compat> 1110;;;;N;HANGUL LETTER TIEUT;;;;
+314D;HANGUL LETTER PHIEUPH;Lo;0;L;<compat> 1111;;;;N;HANGUL LETTER PIEUP;;;;
+314E;HANGUL LETTER HIEUH;Lo;0;L;<compat> 1112;;;;N;;;;;
+314F;HANGUL LETTER A;Lo;0;L;<compat> 1161;;;;N;;;;;
+3150;HANGUL LETTER AE;Lo;0;L;<compat> 1162;;;;N;;;;;
+3151;HANGUL LETTER YA;Lo;0;L;<compat> 1163;;;;N;;;;;
+3152;HANGUL LETTER YAE;Lo;0;L;<compat> 1164;;;;N;;;;;
+3153;HANGUL LETTER EO;Lo;0;L;<compat> 1165;;;;N;;;;;
+3154;HANGUL LETTER E;Lo;0;L;<compat> 1166;;;;N;;;;;
+3155;HANGUL LETTER YEO;Lo;0;L;<compat> 1167;;;;N;;;;;
+3156;HANGUL LETTER YE;Lo;0;L;<compat> 1168;;;;N;;;;;
+3157;HANGUL LETTER O;Lo;0;L;<compat> 1169;;;;N;;;;;
+3158;HANGUL LETTER WA;Lo;0;L;<compat> 116A;;;;N;;;;;
+3159;HANGUL LETTER WAE;Lo;0;L;<compat> 116B;;;;N;;;;;
+315A;HANGUL LETTER OE;Lo;0;L;<compat> 116C;;;;N;;;;;
+315B;HANGUL LETTER YO;Lo;0;L;<compat> 116D;;;;N;;;;;
+315C;HANGUL LETTER U;Lo;0;L;<compat> 116E;;;;N;;;;;
+315D;HANGUL LETTER WEO;Lo;0;L;<compat> 116F;;;;N;;;;;
+315E;HANGUL LETTER WE;Lo;0;L;<compat> 1170;;;;N;;;;;
+315F;HANGUL LETTER WI;Lo;0;L;<compat> 1171;;;;N;;;;;
+3160;HANGUL LETTER YU;Lo;0;L;<compat> 1172;;;;N;;;;;
+3161;HANGUL LETTER EU;Lo;0;L;<compat> 1173;;;;N;;;;;
+3162;HANGUL LETTER YI;Lo;0;L;<compat> 1174;;;;N;;;;;
+3163;HANGUL LETTER I;Lo;0;L;<compat> 1175;;;;N;;;;;
+3164;HANGUL FILLER;Lo;0;L;<compat> 1160;;;;N;HANGUL CAE OM;;;;
+3165;HANGUL LETTER SSANGNIEUN;Lo;0;L;<compat> 1114;;;;N;HANGUL LETTER SSANG NIEUN;;;;
+3166;HANGUL LETTER NIEUN-TIKEUT;Lo;0;L;<compat> 1115;;;;N;HANGUL LETTER NIEUN DIGEUD;;;;
+3167;HANGUL LETTER NIEUN-SIOS;Lo;0;L;<compat> 11C7;;;;N;HANGUL LETTER NIEUN SIOS;;;;
+3168;HANGUL LETTER NIEUN-PANSIOS;Lo;0;L;<compat> 11C8;;;;N;HANGUL LETTER NIEUN BAN CHI EUM;;;;
+3169;HANGUL LETTER RIEUL-KIYEOK-SIOS;Lo;0;L;<compat> 11CC;;;;N;HANGUL LETTER LIEUL GIYEOG SIOS;;;;
+316A;HANGUL LETTER RIEUL-TIKEUT;Lo;0;L;<compat> 11CE;;;;N;HANGUL LETTER LIEUL DIGEUD;;;;
+316B;HANGUL LETTER RIEUL-PIEUP-SIOS;Lo;0;L;<compat> 11D3;;;;N;HANGUL LETTER LIEUL BIEUB SIOS;;;;
+316C;HANGUL LETTER RIEUL-PANSIOS;Lo;0;L;<compat> 11D7;;;;N;HANGUL LETTER LIEUL BAN CHI EUM;;;;
+316D;HANGUL LETTER RIEUL-YEORINHIEUH;Lo;0;L;<compat> 11D9;;;;N;HANGUL LETTER LIEUL YEOLIN HIEUH;;;;
+316E;HANGUL LETTER MIEUM-PIEUP;Lo;0;L;<compat> 111C;;;;N;HANGUL LETTER MIEUM BIEUB;;;;
+316F;HANGUL LETTER MIEUM-SIOS;Lo;0;L;<compat> 11DD;;;;N;HANGUL LETTER MIEUM SIOS;;;;
+3170;HANGUL LETTER MIEUM-PANSIOS;Lo;0;L;<compat> 11DF;;;;N;HANGUL LETTER BIEUB BAN CHI EUM;;;;
+3171;HANGUL LETTER KAPYEOUNMIEUM;Lo;0;L;<compat> 111D;;;;N;HANGUL LETTER MIEUM SUN GYEONG EUM;;;;
+3172;HANGUL LETTER PIEUP-KIYEOK;Lo;0;L;<compat> 111E;;;;N;HANGUL LETTER BIEUB GIYEOG;;;;
+3173;HANGUL LETTER PIEUP-TIKEUT;Lo;0;L;<compat> 1120;;;;N;HANGUL LETTER BIEUB DIGEUD;;;;
+3174;HANGUL LETTER PIEUP-SIOS-KIYEOK;Lo;0;L;<compat> 1122;;;;N;HANGUL LETTER BIEUB SIOS GIYEOG;;;;
+3175;HANGUL LETTER PIEUP-SIOS-TIKEUT;Lo;0;L;<compat> 1123;;;;N;HANGUL LETTER BIEUB SIOS DIGEUD;;;;
+3176;HANGUL LETTER PIEUP-CIEUC;Lo;0;L;<compat> 1127;;;;N;HANGUL LETTER BIEUB JIEUJ;;;;
+3177;HANGUL LETTER PIEUP-THIEUTH;Lo;0;L;<compat> 1129;;;;N;HANGUL LETTER BIEUB TIEUT;;;;
+3178;HANGUL LETTER KAPYEOUNPIEUP;Lo;0;L;<compat> 112B;;;;N;HANGUL LETTER BIEUB SUN GYEONG EUM;;;;
+3179;HANGUL LETTER KAPYEOUNSSANGPIEUP;Lo;0;L;<compat> 112C;;;;N;HANGUL LETTER SSANG BIEUB SUN GYEONG EUM;;;;
+317A;HANGUL LETTER SIOS-KIYEOK;Lo;0;L;<compat> 112D;;;;N;HANGUL LETTER SIOS GIYEOG;;;;
+317B;HANGUL LETTER SIOS-NIEUN;Lo;0;L;<compat> 112E;;;;N;HANGUL LETTER SIOS NIEUN;;;;
+317C;HANGUL LETTER SIOS-TIKEUT;Lo;0;L;<compat> 112F;;;;N;HANGUL LETTER SIOS DIGEUD;;;;
+317D;HANGUL LETTER SIOS-PIEUP;Lo;0;L;<compat> 1132;;;;N;HANGUL LETTER SIOS BIEUB;;;;
+317E;HANGUL LETTER SIOS-CIEUC;Lo;0;L;<compat> 1136;;;;N;HANGUL LETTER SIOS JIEUJ;;;;
+317F;HANGUL LETTER PANSIOS;Lo;0;L;<compat> 1140;;;;N;HANGUL LETTER BAN CHI EUM;;;;
+3180;HANGUL LETTER SSANGIEUNG;Lo;0;L;<compat> 1147;;;;N;HANGUL LETTER SSANG IEUNG;;;;
+3181;HANGUL LETTER YESIEUNG;Lo;0;L;<compat> 114C;;;;N;HANGUL LETTER NGIEUNG;;;;
+3182;HANGUL LETTER YESIEUNG-SIOS;Lo;0;L;<compat> 11F1;;;;N;HANGUL LETTER NGIEUNG SIOS;;;;
+3183;HANGUL LETTER YESIEUNG-PANSIOS;Lo;0;L;<compat> 11F2;;;;N;HANGUL LETTER NGIEUNG BAN CHI EUM;;;;
+3184;HANGUL LETTER KAPYEOUNPHIEUPH;Lo;0;L;<compat> 1157;;;;N;HANGUL LETTER PIEUP SUN GYEONG EUM;;;;
+3185;HANGUL LETTER SSANGHIEUH;Lo;0;L;<compat> 1158;;;;N;HANGUL LETTER SSANG HIEUH;;;;
+3186;HANGUL LETTER YEORINHIEUH;Lo;0;L;<compat> 1159;;;;N;HANGUL LETTER YEOLIN HIEUH;;;;
+3187;HANGUL LETTER YO-YA;Lo;0;L;<compat> 1184;;;;N;HANGUL LETTER YOYA;;;;
+3188;HANGUL LETTER YO-YAE;Lo;0;L;<compat> 1185;;;;N;HANGUL LETTER YOYAE;;;;
+3189;HANGUL LETTER YO-I;Lo;0;L;<compat> 1188;;;;N;HANGUL LETTER YOI;;;;
+318A;HANGUL LETTER YU-YEO;Lo;0;L;<compat> 1191;;;;N;HANGUL LETTER YUYEO;;;;
+318B;HANGUL LETTER YU-YE;Lo;0;L;<compat> 1192;;;;N;HANGUL LETTER YUYE;;;;
+318C;HANGUL LETTER YU-I;Lo;0;L;<compat> 1194;;;;N;HANGUL LETTER YUI;;;;
+318D;HANGUL LETTER ARAEA;Lo;0;L;<compat> 119E;;;;N;HANGUL LETTER ALAE A;;;;
+318E;HANGUL LETTER ARAEAE;Lo;0;L;<compat> 11A1;;;;N;HANGUL LETTER ALAE AE;;;;
+3190;IDEOGRAPHIC ANNOTATION LINKING MARK;So;0;L;;;;;N;KANBUN TATETEN;Kanbun Tateten;;;
+3191;IDEOGRAPHIC ANNOTATION REVERSE MARK;So;0;L;;;;;N;KAERITEN RE;Kaeriten;;;
+3192;IDEOGRAPHIC ANNOTATION ONE MARK;No;0;L;<super> 4E00;;;1;N;KAERITEN ITI;Kaeriten;;;
+3193;IDEOGRAPHIC ANNOTATION TWO MARK;No;0;L;<super> 4E8C;;;2;N;KAERITEN NI;Kaeriten;;;
+3194;IDEOGRAPHIC ANNOTATION THREE MARK;No;0;L;<super> 4E09;;;3;N;KAERITEN SAN;Kaeriten;;;
+3195;IDEOGRAPHIC ANNOTATION FOUR MARK;No;0;L;<super> 56DB;;;4;N;KAERITEN SI;Kaeriten;;;
+3196;IDEOGRAPHIC ANNOTATION TOP MARK;So;0;L;<super> 4E0A;;;;N;KAERITEN ZYOU;Kaeriten;;;
+3197;IDEOGRAPHIC ANNOTATION MIDDLE MARK;So;0;L;<super> 4E2D;;;;N;KAERITEN TYUU;Kaeriten;;;
+3198;IDEOGRAPHIC ANNOTATION BOTTOM MARK;So;0;L;<super> 4E0B;;;;N;KAERITEN GE;Kaeriten;;;
+3199;IDEOGRAPHIC ANNOTATION FIRST MARK;So;0;L;<super> 7532;;;;N;KAERITEN KOU;Kaeriten;;;
+319A;IDEOGRAPHIC ANNOTATION SECOND MARK;So;0;L;<super> 4E59;;;;N;KAERITEN OTU;Kaeriten;;;
+319B;IDEOGRAPHIC ANNOTATION THIRD MARK;So;0;L;<super> 4E19;;;;N;KAERITEN HEI;Kaeriten;;;
+319C;IDEOGRAPHIC ANNOTATION FOURTH MARK;So;0;L;<super> 4E01;;;;N;KAERITEN TEI;Kaeriten;;;
+319D;IDEOGRAPHIC ANNOTATION HEAVEN MARK;So;0;L;<super> 5929;;;;N;KAERITEN TEN;Kaeriten;;;
+319E;IDEOGRAPHIC ANNOTATION EARTH MARK;So;0;L;<super> 5730;;;;N;KAERITEN TI;Kaeriten;;;
+319F;IDEOGRAPHIC ANNOTATION MAN MARK;So;0;L;<super> 4EBA;;;;N;KAERITEN ZIN;Kaeriten;;;
+31A0;BOPOMOFO LETTER BU;Lo;0;L;;;;;N;;;;;
+31A1;BOPOMOFO LETTER ZI;Lo;0;L;;;;;N;;;;;
+31A2;BOPOMOFO LETTER JI;Lo;0;L;;;;;N;;;;;
+31A3;BOPOMOFO LETTER GU;Lo;0;L;;;;;N;;;;;
+31A4;BOPOMOFO LETTER EE;Lo;0;L;;;;;N;;;;;
+31A5;BOPOMOFO LETTER ENN;Lo;0;L;;;;;N;;;;;
+31A6;BOPOMOFO LETTER OO;Lo;0;L;;;;;N;;;;;
+31A7;BOPOMOFO LETTER ONN;Lo;0;L;;;;;N;;;;;
+31A8;BOPOMOFO LETTER IR;Lo;0;L;;;;;N;;;;;
+31A9;BOPOMOFO LETTER ANN;Lo;0;L;;;;;N;;;;;
+31AA;BOPOMOFO LETTER INN;Lo;0;L;;;;;N;;;;;
+31AB;BOPOMOFO LETTER UNN;Lo;0;L;;;;;N;;;;;
+31AC;BOPOMOFO LETTER IM;Lo;0;L;;;;;N;;;;;
+31AD;BOPOMOFO LETTER NGG;Lo;0;L;;;;;N;;;;;
+31AE;BOPOMOFO LETTER AINN;Lo;0;L;;;;;N;;;;;
+31AF;BOPOMOFO LETTER AUNN;Lo;0;L;;;;;N;;;;;
+31B0;BOPOMOFO LETTER AM;Lo;0;L;;;;;N;;;;;
+31B1;BOPOMOFO LETTER OM;Lo;0;L;;;;;N;;;;;
+31B2;BOPOMOFO LETTER ONG;Lo;0;L;;;;;N;;;;;
+31B3;BOPOMOFO LETTER INNN;Lo;0;L;;;;;N;;;;;
+31B4;BOPOMOFO FINAL LETTER P;Lo;0;L;;;;;N;;;;;
+31B5;BOPOMOFO FINAL LETTER T;Lo;0;L;;;;;N;;;;;
+31B6;BOPOMOFO FINAL LETTER K;Lo;0;L;;;;;N;;;;;
+31B7;BOPOMOFO FINAL LETTER H;Lo;0;L;;;;;N;;;;;
+31C0;CJK STROKE T;So;0;ON;;;;;N;;;;;
+31C1;CJK STROKE WG;So;0;ON;;;;;N;;;;;
+31C2;CJK STROKE XG;So;0;ON;;;;;N;;;;;
+31C3;CJK STROKE BXG;So;0;ON;;;;;N;;;;;
+31C4;CJK STROKE SW;So;0;ON;;;;;N;;;;;
+31C5;CJK STROKE HZZ;So;0;ON;;;;;N;;;;;
+31C6;CJK STROKE HZG;So;0;ON;;;;;N;;;;;
+31C7;CJK STROKE HP;So;0;ON;;;;;N;;;;;
+31C8;CJK STROKE HZWG;So;0;ON;;;;;N;;;;;
+31C9;CJK STROKE SZWG;So;0;ON;;;;;N;;;;;
+31CA;CJK STROKE HZT;So;0;ON;;;;;N;;;;;
+31CB;CJK STROKE HZZP;So;0;ON;;;;;N;;;;;
+31CC;CJK STROKE HPWG;So;0;ON;;;;;N;;;;;
+31CD;CJK STROKE HZW;So;0;ON;;;;;N;;;;;
+31CE;CJK STROKE HZZZ;So;0;ON;;;;;N;;;;;
+31CF;CJK STROKE N;So;0;ON;;;;;N;;;;;
+31F0;KATAKANA LETTER SMALL KU;Lo;0;L;;;;;N;;;;;
+31F1;KATAKANA LETTER SMALL SI;Lo;0;L;;;;;N;;;;;
+31F2;KATAKANA LETTER SMALL SU;Lo;0;L;;;;;N;;;;;
+31F3;KATAKANA LETTER SMALL TO;Lo;0;L;;;;;N;;;;;
+31F4;KATAKANA LETTER SMALL NU;Lo;0;L;;;;;N;;;;;
+31F5;KATAKANA LETTER SMALL HA;Lo;0;L;;;;;N;;;;;
+31F6;KATAKANA LETTER SMALL HI;Lo;0;L;;;;;N;;;;;
+31F7;KATAKANA LETTER SMALL HU;Lo;0;L;;;;;N;;;;;
+31F8;KATAKANA LETTER SMALL HE;Lo;0;L;;;;;N;;;;;
+31F9;KATAKANA LETTER SMALL HO;Lo;0;L;;;;;N;;;;;
+31FA;KATAKANA LETTER SMALL MU;Lo;0;L;;;;;N;;;;;
+31FB;KATAKANA LETTER SMALL RA;Lo;0;L;;;;;N;;;;;
+31FC;KATAKANA LETTER SMALL RI;Lo;0;L;;;;;N;;;;;
+31FD;KATAKANA LETTER SMALL RU;Lo;0;L;;;;;N;;;;;
+31FE;KATAKANA LETTER SMALL RE;Lo;0;L;;;;;N;;;;;
+31FF;KATAKANA LETTER SMALL RO;Lo;0;L;;;;;N;;;;;
+3200;PARENTHESIZED HANGUL KIYEOK;So;0;L;<compat> 0028 1100 0029;;;;N;PARENTHESIZED HANGUL GIYEOG;;;;
+3201;PARENTHESIZED HANGUL NIEUN;So;0;L;<compat> 0028 1102 0029;;;;N;;;;;
+3202;PARENTHESIZED HANGUL TIKEUT;So;0;L;<compat> 0028 1103 0029;;;;N;PARENTHESIZED HANGUL DIGEUD;;;;
+3203;PARENTHESIZED HANGUL RIEUL;So;0;L;<compat> 0028 1105 0029;;;;N;PARENTHESIZED HANGUL LIEUL;;;;
+3204;PARENTHESIZED HANGUL MIEUM;So;0;L;<compat> 0028 1106 0029;;;;N;;;;;
+3205;PARENTHESIZED HANGUL PIEUP;So;0;L;<compat> 0028 1107 0029;;;;N;PARENTHESIZED HANGUL BIEUB;;;;
+3206;PARENTHESIZED HANGUL SIOS;So;0;L;<compat> 0028 1109 0029;;;;N;;;;;
+3207;PARENTHESIZED HANGUL IEUNG;So;0;L;<compat> 0028 110B 0029;;;;N;;;;;
+3208;PARENTHESIZED HANGUL CIEUC;So;0;L;<compat> 0028 110C 0029;;;;N;PARENTHESIZED HANGUL JIEUJ;;;;
+3209;PARENTHESIZED HANGUL CHIEUCH;So;0;L;<compat> 0028 110E 0029;;;;N;PARENTHESIZED HANGUL CIEUC;;;;
+320A;PARENTHESIZED HANGUL KHIEUKH;So;0;L;<compat> 0028 110F 0029;;;;N;PARENTHESIZED HANGUL KIYEOK;;;;
+320B;PARENTHESIZED HANGUL THIEUTH;So;0;L;<compat> 0028 1110 0029;;;;N;PARENTHESIZED HANGUL TIEUT;;;;
+320C;PARENTHESIZED HANGUL PHIEUPH;So;0;L;<compat> 0028 1111 0029;;;;N;PARENTHESIZED HANGUL PIEUP;;;;
+320D;PARENTHESIZED HANGUL HIEUH;So;0;L;<compat> 0028 1112 0029;;;;N;;;;;
+320E;PARENTHESIZED HANGUL KIYEOK A;So;0;L;<compat> 0028 1100 1161 0029;;;;N;PARENTHESIZED HANGUL GA;;;;
+320F;PARENTHESIZED HANGUL NIEUN A;So;0;L;<compat> 0028 1102 1161 0029;;;;N;PARENTHESIZED HANGUL NA;;;;
+3210;PARENTHESIZED HANGUL TIKEUT A;So;0;L;<compat> 0028 1103 1161 0029;;;;N;PARENTHESIZED HANGUL DA;;;;
+3211;PARENTHESIZED HANGUL RIEUL A;So;0;L;<compat> 0028 1105 1161 0029;;;;N;PARENTHESIZED HANGUL LA;;;;
+3212;PARENTHESIZED HANGUL MIEUM A;So;0;L;<compat> 0028 1106 1161 0029;;;;N;PARENTHESIZED HANGUL MA;;;;
+3213;PARENTHESIZED HANGUL PIEUP A;So;0;L;<compat> 0028 1107 1161 0029;;;;N;PARENTHESIZED HANGUL BA;;;;
+3214;PARENTHESIZED HANGUL SIOS A;So;0;L;<compat> 0028 1109 1161 0029;;;;N;PARENTHESIZED HANGUL SA;;;;
+3215;PARENTHESIZED HANGUL IEUNG A;So;0;L;<compat> 0028 110B 1161 0029;;;;N;PARENTHESIZED HANGUL A;;;;
+3216;PARENTHESIZED HANGUL CIEUC A;So;0;L;<compat> 0028 110C 1161 0029;;;;N;PARENTHESIZED HANGUL JA;;;;
+3217;PARENTHESIZED HANGUL CHIEUCH A;So;0;L;<compat> 0028 110E 1161 0029;;;;N;PARENTHESIZED HANGUL CA;;;;
+3218;PARENTHESIZED HANGUL KHIEUKH A;So;0;L;<compat> 0028 110F 1161 0029;;;;N;PARENTHESIZED HANGUL KA;;;;
+3219;PARENTHESIZED HANGUL THIEUTH A;So;0;L;<compat> 0028 1110 1161 0029;;;;N;PARENTHESIZED HANGUL TA;;;;
+321A;PARENTHESIZED HANGUL PHIEUPH A;So;0;L;<compat> 0028 1111 1161 0029;;;;N;PARENTHESIZED HANGUL PA;;;;
+321B;PARENTHESIZED HANGUL HIEUH A;So;0;L;<compat> 0028 1112 1161 0029;;;;N;PARENTHESIZED HANGUL HA;;;;
+321C;PARENTHESIZED HANGUL CIEUC U;So;0;L;<compat> 0028 110C 116E 0029;;;;N;PARENTHESIZED HANGUL JU;;;;
+321D;PARENTHESIZED KOREAN CHARACTER OJEON;So;0;ON;<compat> 0028 110B 1169 110C 1165 11AB 0029;;;;N;;;;;
+321E;PARENTHESIZED KOREAN CHARACTER O HU;So;0;ON;<compat> 0028 110B 1169 1112 116E 0029;;;;N;;;;;
+3220;PARENTHESIZED IDEOGRAPH ONE;No;0;L;<compat> 0028 4E00 0029;;;1;N;;;;;
+3221;PARENTHESIZED IDEOGRAPH TWO;No;0;L;<compat> 0028 4E8C 0029;;;2;N;;;;;
+3222;PARENTHESIZED IDEOGRAPH THREE;No;0;L;<compat> 0028 4E09 0029;;;3;N;;;;;
+3223;PARENTHESIZED IDEOGRAPH FOUR;No;0;L;<compat> 0028 56DB 0029;;;4;N;;;;;
+3224;PARENTHESIZED IDEOGRAPH FIVE;No;0;L;<compat> 0028 4E94 0029;;;5;N;;;;;
+3225;PARENTHESIZED IDEOGRAPH SIX;No;0;L;<compat> 0028 516D 0029;;;6;N;;;;;
+3226;PARENTHESIZED IDEOGRAPH SEVEN;No;0;L;<compat> 0028 4E03 0029;;;7;N;;;;;
+3227;PARENTHESIZED IDEOGRAPH EIGHT;No;0;L;<compat> 0028 516B 0029;;;8;N;;;;;
+3228;PARENTHESIZED IDEOGRAPH NINE;No;0;L;<compat> 0028 4E5D 0029;;;9;N;;;;;
+3229;PARENTHESIZED IDEOGRAPH TEN;No;0;L;<compat> 0028 5341 0029;;;10;N;;;;;
+322A;PARENTHESIZED IDEOGRAPH MOON;So;0;L;<compat> 0028 6708 0029;;;;N;;;;;
+322B;PARENTHESIZED IDEOGRAPH FIRE;So;0;L;<compat> 0028 706B 0029;;;;N;;;;;
+322C;PARENTHESIZED IDEOGRAPH WATER;So;0;L;<compat> 0028 6C34 0029;;;;N;;;;;
+322D;PARENTHESIZED IDEOGRAPH WOOD;So;0;L;<compat> 0028 6728 0029;;;;N;;;;;
+322E;PARENTHESIZED IDEOGRAPH METAL;So;0;L;<compat> 0028 91D1 0029;;;;N;;;;;
+322F;PARENTHESIZED IDEOGRAPH EARTH;So;0;L;<compat> 0028 571F 0029;;;;N;;;;;
+3230;PARENTHESIZED IDEOGRAPH SUN;So;0;L;<compat> 0028 65E5 0029;;;;N;;;;;
+3231;PARENTHESIZED IDEOGRAPH STOCK;So;0;L;<compat> 0028 682A 0029;;;;N;;;;;
+3232;PARENTHESIZED IDEOGRAPH HAVE;So;0;L;<compat> 0028 6709 0029;;;;N;;;;;
+3233;PARENTHESIZED IDEOGRAPH SOCIETY;So;0;L;<compat> 0028 793E 0029;;;;N;;;;;
+3234;PARENTHESIZED IDEOGRAPH NAME;So;0;L;<compat> 0028 540D 0029;;;;N;;;;;
+3235;PARENTHESIZED IDEOGRAPH SPECIAL;So;0;L;<compat> 0028 7279 0029;;;;N;;;;;
+3236;PARENTHESIZED IDEOGRAPH FINANCIAL;So;0;L;<compat> 0028 8CA1 0029;;;;N;;;;;
+3237;PARENTHESIZED IDEOGRAPH CONGRATULATION;So;0;L;<compat> 0028 795D 0029;;;;N;;;;;
+3238;PARENTHESIZED IDEOGRAPH LABOR;So;0;L;<compat> 0028 52B4 0029;;;;N;;;;;
+3239;PARENTHESIZED IDEOGRAPH REPRESENT;So;0;L;<compat> 0028 4EE3 0029;;;;N;;;;;
+323A;PARENTHESIZED IDEOGRAPH CALL;So;0;L;<compat> 0028 547C 0029;;;;N;;;;;
+323B;PARENTHESIZED IDEOGRAPH STUDY;So;0;L;<compat> 0028 5B66 0029;;;;N;;;;;
+323C;PARENTHESIZED IDEOGRAPH SUPERVISE;So;0;L;<compat> 0028 76E3 0029;;;;N;;;;;
+323D;PARENTHESIZED IDEOGRAPH ENTERPRISE;So;0;L;<compat> 0028 4F01 0029;;;;N;;;;;
+323E;PARENTHESIZED IDEOGRAPH RESOURCE;So;0;L;<compat> 0028 8CC7 0029;;;;N;;;;;
+323F;PARENTHESIZED IDEOGRAPH ALLIANCE;So;0;L;<compat> 0028 5354 0029;;;;N;;;;;
+3240;PARENTHESIZED IDEOGRAPH FESTIVAL;So;0;L;<compat> 0028 796D 0029;;;;N;;;;;
+3241;PARENTHESIZED IDEOGRAPH REST;So;0;L;<compat> 0028 4F11 0029;;;;N;;;;;
+3242;PARENTHESIZED IDEOGRAPH SELF;So;0;L;<compat> 0028 81EA 0029;;;;N;;;;;
+3243;PARENTHESIZED IDEOGRAPH REACH;So;0;L;<compat> 0028 81F3 0029;;;;N;;;;;
+3250;PARTNERSHIP SIGN;So;0;ON;<square> 0050 0054 0045;;;;N;;;;;
+3251;CIRCLED NUMBER TWENTY ONE;No;0;ON;<circle> 0032 0031;;;21;N;;;;;
+3252;CIRCLED NUMBER TWENTY TWO;No;0;ON;<circle> 0032 0032;;;22;N;;;;;
+3253;CIRCLED NUMBER TWENTY THREE;No;0;ON;<circle> 0032 0033;;;23;N;;;;;
+3254;CIRCLED NUMBER TWENTY FOUR;No;0;ON;<circle> 0032 0034;;;24;N;;;;;
+3255;CIRCLED NUMBER TWENTY FIVE;No;0;ON;<circle> 0032 0035;;;25;N;;;;;
+3256;CIRCLED NUMBER TWENTY SIX;No;0;ON;<circle> 0032 0036;;;26;N;;;;;
+3257;CIRCLED NUMBER TWENTY SEVEN;No;0;ON;<circle> 0032 0037;;;27;N;;;;;
+3258;CIRCLED NUMBER TWENTY EIGHT;No;0;ON;<circle> 0032 0038;;;28;N;;;;;
+3259;CIRCLED NUMBER TWENTY NINE;No;0;ON;<circle> 0032 0039;;;29;N;;;;;
+325A;CIRCLED NUMBER THIRTY;No;0;ON;<circle> 0033 0030;;;30;N;;;;;
+325B;CIRCLED NUMBER THIRTY ONE;No;0;ON;<circle> 0033 0031;;;31;N;;;;;
+325C;CIRCLED NUMBER THIRTY TWO;No;0;ON;<circle> 0033 0032;;;32;N;;;;;
+325D;CIRCLED NUMBER THIRTY THREE;No;0;ON;<circle> 0033 0033;;;33;N;;;;;
+325E;CIRCLED NUMBER THIRTY FOUR;No;0;ON;<circle> 0033 0034;;;34;N;;;;;
+325F;CIRCLED NUMBER THIRTY FIVE;No;0;ON;<circle> 0033 0035;;;35;N;;;;;
+3260;CIRCLED HANGUL KIYEOK;So;0;L;<circle> 1100;;;;N;CIRCLED HANGUL GIYEOG;;;;
+3261;CIRCLED HANGUL NIEUN;So;0;L;<circle> 1102;;;;N;;;;;
+3262;CIRCLED HANGUL TIKEUT;So;0;L;<circle> 1103;;;;N;CIRCLED HANGUL DIGEUD;;;;
+3263;CIRCLED HANGUL RIEUL;So;0;L;<circle> 1105;;;;N;CIRCLED HANGUL LIEUL;;;;
+3264;CIRCLED HANGUL MIEUM;So;0;L;<circle> 1106;;;;N;;;;;
+3265;CIRCLED HANGUL PIEUP;So;0;L;<circle> 1107;;;;N;CIRCLED HANGUL BIEUB;;;;
+3266;CIRCLED HANGUL SIOS;So;0;L;<circle> 1109;;;;N;;;;;
+3267;CIRCLED HANGUL IEUNG;So;0;L;<circle> 110B;;;;N;;;;;
+3268;CIRCLED HANGUL CIEUC;So;0;L;<circle> 110C;;;;N;CIRCLED HANGUL JIEUJ;;;;
+3269;CIRCLED HANGUL CHIEUCH;So;0;L;<circle> 110E;;;;N;CIRCLED HANGUL CIEUC;;;;
+326A;CIRCLED HANGUL KHIEUKH;So;0;L;<circle> 110F;;;;N;CIRCLED HANGUL KIYEOK;;;;
+326B;CIRCLED HANGUL THIEUTH;So;0;L;<circle> 1110;;;;N;CIRCLED HANGUL TIEUT;;;;
+326C;CIRCLED HANGUL PHIEUPH;So;0;L;<circle> 1111;;;;N;CIRCLED HANGUL PIEUP;;;;
+326D;CIRCLED HANGUL HIEUH;So;0;L;<circle> 1112;;;;N;;;;;
+326E;CIRCLED HANGUL KIYEOK A;So;0;L;<circle> 1100 1161;;;;N;CIRCLED HANGUL GA;;;;
+326F;CIRCLED HANGUL NIEUN A;So;0;L;<circle> 1102 1161;;;;N;CIRCLED HANGUL NA;;;;
+3270;CIRCLED HANGUL TIKEUT A;So;0;L;<circle> 1103 1161;;;;N;CIRCLED HANGUL DA;;;;
+3271;CIRCLED HANGUL RIEUL A;So;0;L;<circle> 1105 1161;;;;N;CIRCLED HANGUL LA;;;;
+3272;CIRCLED HANGUL MIEUM A;So;0;L;<circle> 1106 1161;;;;N;CIRCLED HANGUL MA;;;;
+3273;CIRCLED HANGUL PIEUP A;So;0;L;<circle> 1107 1161;;;;N;CIRCLED HANGUL BA;;;;
+3274;CIRCLED HANGUL SIOS A;So;0;L;<circle> 1109 1161;;;;N;CIRCLED HANGUL SA;;;;
+3275;CIRCLED HANGUL IEUNG A;So;0;L;<circle> 110B 1161;;;;N;CIRCLED HANGUL A;;;;
+3276;CIRCLED HANGUL CIEUC A;So;0;L;<circle> 110C 1161;;;;N;CIRCLED HANGUL JA;;;;
+3277;CIRCLED HANGUL CHIEUCH A;So;0;L;<circle> 110E 1161;;;;N;CIRCLED HANGUL CA;;;;
+3278;CIRCLED HANGUL KHIEUKH A;So;0;L;<circle> 110F 1161;;;;N;CIRCLED HANGUL KA;;;;
+3279;CIRCLED HANGUL THIEUTH A;So;0;L;<circle> 1110 1161;;;;N;CIRCLED HANGUL TA;;;;
+327A;CIRCLED HANGUL PHIEUPH A;So;0;L;<circle> 1111 1161;;;;N;CIRCLED HANGUL PA;;;;
+327B;CIRCLED HANGUL HIEUH A;So;0;L;<circle> 1112 1161;;;;N;CIRCLED HANGUL HA;;;;
+327C;CIRCLED KOREAN CHARACTER CHAMKO;So;0;ON;<circle> 110E 1161 11B7 1100 1169;;;;N;;;;;
+327D;CIRCLED KOREAN CHARACTER JUEUI;So;0;ON;<circle> 110C 116E 110B 1174;;;;N;;;;;
+327E;CIRCLED HANGUL IEUNG U;So;0;ON;<circle> 110B 116E;;;;N;;;;;
+327F;KOREAN STANDARD SYMBOL;So;0;L;;;;;N;;;;;
+3280;CIRCLED IDEOGRAPH ONE;No;0;L;<circle> 4E00;;;1;N;;;;;
+3281;CIRCLED IDEOGRAPH TWO;No;0;L;<circle> 4E8C;;;2;N;;;;;
+3282;CIRCLED IDEOGRAPH THREE;No;0;L;<circle> 4E09;;;3;N;;;;;
+3283;CIRCLED IDEOGRAPH FOUR;No;0;L;<circle> 56DB;;;4;N;;;;;
+3284;CIRCLED IDEOGRAPH FIVE;No;0;L;<circle> 4E94;;;5;N;;;;;
+3285;CIRCLED IDEOGRAPH SIX;No;0;L;<circle> 516D;;;6;N;;;;;
+3286;CIRCLED IDEOGRAPH SEVEN;No;0;L;<circle> 4E03;;;7;N;;;;;
+3287;CIRCLED IDEOGRAPH EIGHT;No;0;L;<circle> 516B;;;8;N;;;;;
+3288;CIRCLED IDEOGRAPH NINE;No;0;L;<circle> 4E5D;;;9;N;;;;;
+3289;CIRCLED IDEOGRAPH TEN;No;0;L;<circle> 5341;;;10;N;;;;;
+328A;CIRCLED IDEOGRAPH MOON;So;0;L;<circle> 6708;;;;N;;;;;
+328B;CIRCLED IDEOGRAPH FIRE;So;0;L;<circle> 706B;;;;N;;;;;
+328C;CIRCLED IDEOGRAPH WATER;So;0;L;<circle> 6C34;;;;N;;;;;
+328D;CIRCLED IDEOGRAPH WOOD;So;0;L;<circle> 6728;;;;N;;;;;
+328E;CIRCLED IDEOGRAPH METAL;So;0;L;<circle> 91D1;;;;N;;;;;
+328F;CIRCLED IDEOGRAPH EARTH;So;0;L;<circle> 571F;;;;N;;;;;
+3290;CIRCLED IDEOGRAPH SUN;So;0;L;<circle> 65E5;;;;N;;;;;
+3291;CIRCLED IDEOGRAPH STOCK;So;0;L;<circle> 682A;;;;N;;;;;
+3292;CIRCLED IDEOGRAPH HAVE;So;0;L;<circle> 6709;;;;N;;;;;
+3293;CIRCLED IDEOGRAPH SOCIETY;So;0;L;<circle> 793E;;;;N;;;;;
+3294;CIRCLED IDEOGRAPH NAME;So;0;L;<circle> 540D;;;;N;;;;;
+3295;CIRCLED IDEOGRAPH SPECIAL;So;0;L;<circle> 7279;;;;N;;;;;
+3296;CIRCLED IDEOGRAPH FINANCIAL;So;0;L;<circle> 8CA1;;;;N;;;;;
+3297;CIRCLED IDEOGRAPH CONGRATULATION;So;0;L;<circle> 795D;;;;N;;;;;
+3298;CIRCLED IDEOGRAPH LABOR;So;0;L;<circle> 52B4;;;;N;;;;;
+3299;CIRCLED IDEOGRAPH SECRET;So;0;L;<circle> 79D8;;;;N;;;;;
+329A;CIRCLED IDEOGRAPH MALE;So;0;L;<circle> 7537;;;;N;;;;;
+329B;CIRCLED IDEOGRAPH FEMALE;So;0;L;<circle> 5973;;;;N;;;;;
+329C;CIRCLED IDEOGRAPH SUITABLE;So;0;L;<circle> 9069;;;;N;;;;;
+329D;CIRCLED IDEOGRAPH EXCELLENT;So;0;L;<circle> 512A;;;;N;;;;;
+329E;CIRCLED IDEOGRAPH PRINT;So;0;L;<circle> 5370;;;;N;;;;;
+329F;CIRCLED IDEOGRAPH ATTENTION;So;0;L;<circle> 6CE8;;;;N;;;;;
+32A0;CIRCLED IDEOGRAPH ITEM;So;0;L;<circle> 9805;;;;N;;;;;
+32A1;CIRCLED IDEOGRAPH REST;So;0;L;<circle> 4F11;;;;N;;;;;
+32A2;CIRCLED IDEOGRAPH COPY;So;0;L;<circle> 5199;;;;N;;;;;
+32A3;CIRCLED IDEOGRAPH CORRECT;So;0;L;<circle> 6B63;;;;N;;;;;
+32A4;CIRCLED IDEOGRAPH HIGH;So;0;L;<circle> 4E0A;;;;N;;;;;
+32A5;CIRCLED IDEOGRAPH CENTRE;So;0;L;<circle> 4E2D;;;;N;CIRCLED IDEOGRAPH CENTER;;;;
+32A6;CIRCLED IDEOGRAPH LOW;So;0;L;<circle> 4E0B;;;;N;;;;;
+32A7;CIRCLED IDEOGRAPH LEFT;So;0;L;<circle> 5DE6;;;;N;;;;;
+32A8;CIRCLED IDEOGRAPH RIGHT;So;0;L;<circle> 53F3;;;;N;;;;;
+32A9;CIRCLED IDEOGRAPH MEDICINE;So;0;L;<circle> 533B;;;;N;;;;;
+32AA;CIRCLED IDEOGRAPH RELIGION;So;0;L;<circle> 5B97;;;;N;;;;;
+32AB;CIRCLED IDEOGRAPH STUDY;So;0;L;<circle> 5B66;;;;N;;;;;
+32AC;CIRCLED IDEOGRAPH SUPERVISE;So;0;L;<circle> 76E3;;;;N;;;;;
+32AD;CIRCLED IDEOGRAPH ENTERPRISE;So;0;L;<circle> 4F01;;;;N;;;;;
+32AE;CIRCLED IDEOGRAPH RESOURCE;So;0;L;<circle> 8CC7;;;;N;;;;;
+32AF;CIRCLED IDEOGRAPH ALLIANCE;So;0;L;<circle> 5354;;;;N;;;;;
+32B0;CIRCLED IDEOGRAPH NIGHT;So;0;L;<circle> 591C;;;;N;;;;;
+32B1;CIRCLED NUMBER THIRTY SIX;No;0;ON;<circle> 0033 0036;;;36;N;;;;;
+32B2;CIRCLED NUMBER THIRTY SEVEN;No;0;ON;<circle> 0033 0037;;;37;N;;;;;
+32B3;CIRCLED NUMBER THIRTY EIGHT;No;0;ON;<circle> 0033 0038;;;38;N;;;;;
+32B4;CIRCLED NUMBER THIRTY NINE;No;0;ON;<circle> 0033 0039;;;39;N;;;;;
+32B5;CIRCLED NUMBER FORTY;No;0;ON;<circle> 0034 0030;;;40;N;;;;;
+32B6;CIRCLED NUMBER FORTY ONE;No;0;ON;<circle> 0034 0031;;;41;N;;;;;
+32B7;CIRCLED NUMBER FORTY TWO;No;0;ON;<circle> 0034 0032;;;42;N;;;;;
+32B8;CIRCLED NUMBER FORTY THREE;No;0;ON;<circle> 0034 0033;;;43;N;;;;;
+32B9;CIRCLED NUMBER FORTY FOUR;No;0;ON;<circle> 0034 0034;;;44;N;;;;;
+32BA;CIRCLED NUMBER FORTY FIVE;No;0;ON;<circle> 0034 0035;;;45;N;;;;;
+32BB;CIRCLED NUMBER FORTY SIX;No;0;ON;<circle> 0034 0036;;;46;N;;;;;
+32BC;CIRCLED NUMBER FORTY SEVEN;No;0;ON;<circle> 0034 0037;;;47;N;;;;;
+32BD;CIRCLED NUMBER FORTY EIGHT;No;0;ON;<circle> 0034 0038;;;48;N;;;;;
+32BE;CIRCLED NUMBER FORTY NINE;No;0;ON;<circle> 0034 0039;;;49;N;;;;;
+32BF;CIRCLED NUMBER FIFTY;No;0;ON;<circle> 0035 0030;;;50;N;;;;;
+32C0;IDEOGRAPHIC TELEGRAPH SYMBOL FOR JANUARY;So;0;L;<compat> 0031 6708;;;;N;;;;;
+32C1;IDEOGRAPHIC TELEGRAPH SYMBOL FOR FEBRUARY;So;0;L;<compat> 0032 6708;;;;N;;;;;
+32C2;IDEOGRAPHIC TELEGRAPH SYMBOL FOR MARCH;So;0;L;<compat> 0033 6708;;;;N;;;;;
+32C3;IDEOGRAPHIC TELEGRAPH SYMBOL FOR APRIL;So;0;L;<compat> 0034 6708;;;;N;;;;;
+32C4;IDEOGRAPHIC TELEGRAPH SYMBOL FOR MAY;So;0;L;<compat> 0035 6708;;;;N;;;;;
+32C5;IDEOGRAPHIC TELEGRAPH SYMBOL FOR JUNE;So;0;L;<compat> 0036 6708;;;;N;;;;;
+32C6;IDEOGRAPHIC TELEGRAPH SYMBOL FOR JULY;So;0;L;<compat> 0037 6708;;;;N;;;;;
+32C7;IDEOGRAPHIC TELEGRAPH SYMBOL FOR AUGUST;So;0;L;<compat> 0038 6708;;;;N;;;;;
+32C8;IDEOGRAPHIC TELEGRAPH SYMBOL FOR SEPTEMBER;So;0;L;<compat> 0039 6708;;;;N;;;;;
+32C9;IDEOGRAPHIC TELEGRAPH SYMBOL FOR OCTOBER;So;0;L;<compat> 0031 0030 6708;;;;N;;;;;
+32CA;IDEOGRAPHIC TELEGRAPH SYMBOL FOR NOVEMBER;So;0;L;<compat> 0031 0031 6708;;;;N;;;;;
+32CB;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DECEMBER;So;0;L;<compat> 0031 0032 6708;;;;N;;;;;
+32CC;SQUARE HG;So;0;ON;<square> 0048 0067;;;;N;;;;;
+32CD;SQUARE ERG;So;0;ON;<square> 0065 0072 0067;;;;N;;;;;
+32CE;SQUARE EV;So;0;ON;<square> 0065 0056;;;;N;;;;;
+32CF;LIMITED LIABILITY SIGN;So;0;ON;<square> 004C 0054 0044;;;;N;;;;;
+32D0;CIRCLED KATAKANA A;So;0;L;<circle> 30A2;;;;N;;;;;
+32D1;CIRCLED KATAKANA I;So;0;L;<circle> 30A4;;;;N;;;;;
+32D2;CIRCLED KATAKANA U;So;0;L;<circle> 30A6;;;;N;;;;;
+32D3;CIRCLED KATAKANA E;So;0;L;<circle> 30A8;;;;N;;;;;
+32D4;CIRCLED KATAKANA O;So;0;L;<circle> 30AA;;;;N;;;;;
+32D5;CIRCLED KATAKANA KA;So;0;L;<circle> 30AB;;;;N;;;;;
+32D6;CIRCLED KATAKANA KI;So;0;L;<circle> 30AD;;;;N;;;;;
+32D7;CIRCLED KATAKANA KU;So;0;L;<circle> 30AF;;;;N;;;;;
+32D8;CIRCLED KATAKANA KE;So;0;L;<circle> 30B1;;;;N;;;;;
+32D9;CIRCLED KATAKANA KO;So;0;L;<circle> 30B3;;;;N;;;;;
+32DA;CIRCLED KATAKANA SA;So;0;L;<circle> 30B5;;;;N;;;;;
+32DB;CIRCLED KATAKANA SI;So;0;L;<circle> 30B7;;;;N;;;;;
+32DC;CIRCLED KATAKANA SU;So;0;L;<circle> 30B9;;;;N;;;;;
+32DD;CIRCLED KATAKANA SE;So;0;L;<circle> 30BB;;;;N;;;;;
+32DE;CIRCLED KATAKANA SO;So;0;L;<circle> 30BD;;;;N;;;;;
+32DF;CIRCLED KATAKANA TA;So;0;L;<circle> 30BF;;;;N;;;;;
+32E0;CIRCLED KATAKANA TI;So;0;L;<circle> 30C1;;;;N;;;;;
+32E1;CIRCLED KATAKANA TU;So;0;L;<circle> 30C4;;;;N;;;;;
+32E2;CIRCLED KATAKANA TE;So;0;L;<circle> 30C6;;;;N;;;;;
+32E3;CIRCLED KATAKANA TO;So;0;L;<circle> 30C8;;;;N;;;;;
+32E4;CIRCLED KATAKANA NA;So;0;L;<circle> 30CA;;;;N;;;;;
+32E5;CIRCLED KATAKANA NI;So;0;L;<circle> 30CB;;;;N;;;;;
+32E6;CIRCLED KATAKANA NU;So;0;L;<circle> 30CC;;;;N;;;;;
+32E7;CIRCLED KATAKANA NE;So;0;L;<circle> 30CD;;;;N;;;;;
+32E8;CIRCLED KATAKANA NO;So;0;L;<circle> 30CE;;;;N;;;;;
+32E9;CIRCLED KATAKANA HA;So;0;L;<circle> 30CF;;;;N;;;;;
+32EA;CIRCLED KATAKANA HI;So;0;L;<circle> 30D2;;;;N;;;;;
+32EB;CIRCLED KATAKANA HU;So;0;L;<circle> 30D5;;;;N;;;;;
+32EC;CIRCLED KATAKANA HE;So;0;L;<circle> 30D8;;;;N;;;;;
+32ED;CIRCLED KATAKANA HO;So;0;L;<circle> 30DB;;;;N;;;;;
+32EE;CIRCLED KATAKANA MA;So;0;L;<circle> 30DE;;;;N;;;;;
+32EF;CIRCLED KATAKANA MI;So;0;L;<circle> 30DF;;;;N;;;;;
+32F0;CIRCLED KATAKANA MU;So;0;L;<circle> 30E0;;;;N;;;;;
+32F1;CIRCLED KATAKANA ME;So;0;L;<circle> 30E1;;;;N;;;;;
+32F2;CIRCLED KATAKANA MO;So;0;L;<circle> 30E2;;;;N;;;;;
+32F3;CIRCLED KATAKANA YA;So;0;L;<circle> 30E4;;;;N;;;;;
+32F4;CIRCLED KATAKANA YU;So;0;L;<circle> 30E6;;;;N;;;;;
+32F5;CIRCLED KATAKANA YO;So;0;L;<circle> 30E8;;;;N;;;;;
+32F6;CIRCLED KATAKANA RA;So;0;L;<circle> 30E9;;;;N;;;;;
+32F7;CIRCLED KATAKANA RI;So;0;L;<circle> 30EA;;;;N;;;;;
+32F8;CIRCLED KATAKANA RU;So;0;L;<circle> 30EB;;;;N;;;;;
+32F9;CIRCLED KATAKANA RE;So;0;L;<circle> 30EC;;;;N;;;;;
+32FA;CIRCLED KATAKANA RO;So;0;L;<circle> 30ED;;;;N;;;;;
+32FB;CIRCLED KATAKANA WA;So;0;L;<circle> 30EF;;;;N;;;;;
+32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;;
+32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;;
+32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;;
+3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;;
+3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;;
+3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;;
+3303;SQUARE AARU;So;0;L;<square> 30A2 30FC 30EB;;;;N;SQUARED AARU;;;;
+3304;SQUARE ININGU;So;0;L;<square> 30A4 30CB 30F3 30B0;;;;N;SQUARED ININGU;;;;
+3305;SQUARE INTI;So;0;L;<square> 30A4 30F3 30C1;;;;N;SQUARED INTI;;;;
+3306;SQUARE UON;So;0;L;<square> 30A6 30A9 30F3;;;;N;SQUARED UON;;;;
+3307;SQUARE ESUKUUDO;So;0;L;<square> 30A8 30B9 30AF 30FC 30C9;;;;N;SQUARED ESUKUUDO;;;;
+3308;SQUARE EEKAA;So;0;L;<square> 30A8 30FC 30AB 30FC;;;;N;SQUARED EEKAA;;;;
+3309;SQUARE ONSU;So;0;L;<square> 30AA 30F3 30B9;;;;N;SQUARED ONSU;;;;
+330A;SQUARE OOMU;So;0;L;<square> 30AA 30FC 30E0;;;;N;SQUARED OOMU;;;;
+330B;SQUARE KAIRI;So;0;L;<square> 30AB 30A4 30EA;;;;N;SQUARED KAIRI;;;;
+330C;SQUARE KARATTO;So;0;L;<square> 30AB 30E9 30C3 30C8;;;;N;SQUARED KARATTO;;;;
+330D;SQUARE KARORII;So;0;L;<square> 30AB 30ED 30EA 30FC;;;;N;SQUARED KARORII;;;;
+330E;SQUARE GARON;So;0;L;<square> 30AC 30ED 30F3;;;;N;SQUARED GARON;;;;
+330F;SQUARE GANMA;So;0;L;<square> 30AC 30F3 30DE;;;;N;SQUARED GANMA;;;;
+3310;SQUARE GIGA;So;0;L;<square> 30AE 30AC;;;;N;SQUARED GIGA;;;;
+3311;SQUARE GINII;So;0;L;<square> 30AE 30CB 30FC;;;;N;SQUARED GINII;;;;
+3312;SQUARE KYURII;So;0;L;<square> 30AD 30E5 30EA 30FC;;;;N;SQUARED KYURII;;;;
+3313;SQUARE GIRUDAA;So;0;L;<square> 30AE 30EB 30C0 30FC;;;;N;SQUARED GIRUDAA;;;;
+3314;SQUARE KIRO;So;0;L;<square> 30AD 30ED;;;;N;SQUARED KIRO;;;;
+3315;SQUARE KIROGURAMU;So;0;L;<square> 30AD 30ED 30B0 30E9 30E0;;;;N;SQUARED KIROGURAMU;;;;
+3316;SQUARE KIROMEETORU;So;0;L;<square> 30AD 30ED 30E1 30FC 30C8 30EB;;;;N;SQUARED KIROMEETORU;;;;
+3317;SQUARE KIROWATTO;So;0;L;<square> 30AD 30ED 30EF 30C3 30C8;;;;N;SQUARED KIROWATTO;;;;
+3318;SQUARE GURAMU;So;0;L;<square> 30B0 30E9 30E0;;;;N;SQUARED GURAMU;;;;
+3319;SQUARE GURAMUTON;So;0;L;<square> 30B0 30E9 30E0 30C8 30F3;;;;N;SQUARED GURAMUTON;;;;
+331A;SQUARE KURUZEIRO;So;0;L;<square> 30AF 30EB 30BC 30A4 30ED;;;;N;SQUARED KURUZEIRO;;;;
+331B;SQUARE KUROONE;So;0;L;<square> 30AF 30ED 30FC 30CD;;;;N;SQUARED KUROONE;;;;
+331C;SQUARE KEESU;So;0;L;<square> 30B1 30FC 30B9;;;;N;SQUARED KEESU;;;;
+331D;SQUARE KORUNA;So;0;L;<square> 30B3 30EB 30CA;;;;N;SQUARED KORUNA;;;;
+331E;SQUARE KOOPO;So;0;L;<square> 30B3 30FC 30DD;;;;N;SQUARED KOOPO;;;;
+331F;SQUARE SAIKURU;So;0;L;<square> 30B5 30A4 30AF 30EB;;;;N;SQUARED SAIKURU;;;;
+3320;SQUARE SANTIIMU;So;0;L;<square> 30B5 30F3 30C1 30FC 30E0;;;;N;SQUARED SANTIIMU;;;;
+3321;SQUARE SIRINGU;So;0;L;<square> 30B7 30EA 30F3 30B0;;;;N;SQUARED SIRINGU;;;;
+3322;SQUARE SENTI;So;0;L;<square> 30BB 30F3 30C1;;;;N;SQUARED SENTI;;;;
+3323;SQUARE SENTO;So;0;L;<square> 30BB 30F3 30C8;;;;N;SQUARED SENTO;;;;
+3324;SQUARE DAASU;So;0;L;<square> 30C0 30FC 30B9;;;;N;SQUARED DAASU;;;;
+3325;SQUARE DESI;So;0;L;<square> 30C7 30B7;;;;N;SQUARED DESI;;;;
+3326;SQUARE DORU;So;0;L;<square> 30C9 30EB;;;;N;SQUARED DORU;;;;
+3327;SQUARE TON;So;0;L;<square> 30C8 30F3;;;;N;SQUARED TON;;;;
+3328;SQUARE NANO;So;0;L;<square> 30CA 30CE;;;;N;SQUARED NANO;;;;
+3329;SQUARE NOTTO;So;0;L;<square> 30CE 30C3 30C8;;;;N;SQUARED NOTTO;;;;
+332A;SQUARE HAITU;So;0;L;<square> 30CF 30A4 30C4;;;;N;SQUARED HAITU;;;;
+332B;SQUARE PAASENTO;So;0;L;<square> 30D1 30FC 30BB 30F3 30C8;;;;N;SQUARED PAASENTO;;;;
+332C;SQUARE PAATU;So;0;L;<square> 30D1 30FC 30C4;;;;N;SQUARED PAATU;;;;
+332D;SQUARE BAARERU;So;0;L;<square> 30D0 30FC 30EC 30EB;;;;N;SQUARED BAARERU;;;;
+332E;SQUARE PIASUTORU;So;0;L;<square> 30D4 30A2 30B9 30C8 30EB;;;;N;SQUARED PIASUTORU;;;;
+332F;SQUARE PIKURU;So;0;L;<square> 30D4 30AF 30EB;;;;N;SQUARED PIKURU;;;;
+3330;SQUARE PIKO;So;0;L;<square> 30D4 30B3;;;;N;SQUARED PIKO;;;;
+3331;SQUARE BIRU;So;0;L;<square> 30D3 30EB;;;;N;SQUARED BIRU;;;;
+3332;SQUARE HUARADDO;So;0;L;<square> 30D5 30A1 30E9 30C3 30C9;;;;N;SQUARED HUARADDO;;;;
+3333;SQUARE HUIITO;So;0;L;<square> 30D5 30A3 30FC 30C8;;;;N;SQUARED HUIITO;;;;
+3334;SQUARE BUSSYERU;So;0;L;<square> 30D6 30C3 30B7 30A7 30EB;;;;N;SQUARED BUSSYERU;;;;
+3335;SQUARE HURAN;So;0;L;<square> 30D5 30E9 30F3;;;;N;SQUARED HURAN;;;;
+3336;SQUARE HEKUTAARU;So;0;L;<square> 30D8 30AF 30BF 30FC 30EB;;;;N;SQUARED HEKUTAARU;;;;
+3337;SQUARE PESO;So;0;L;<square> 30DA 30BD;;;;N;SQUARED PESO;;;;
+3338;SQUARE PENIHI;So;0;L;<square> 30DA 30CB 30D2;;;;N;SQUARED PENIHI;;;;
+3339;SQUARE HERUTU;So;0;L;<square> 30D8 30EB 30C4;;;;N;SQUARED HERUTU;;;;
+333A;SQUARE PENSU;So;0;L;<square> 30DA 30F3 30B9;;;;N;SQUARED PENSU;;;;
+333B;SQUARE PEEZI;So;0;L;<square> 30DA 30FC 30B8;;;;N;SQUARED PEEZI;;;;
+333C;SQUARE BEETA;So;0;L;<square> 30D9 30FC 30BF;;;;N;SQUARED BEETA;;;;
+333D;SQUARE POINTO;So;0;L;<square> 30DD 30A4 30F3 30C8;;;;N;SQUARED POINTO;;;;
+333E;SQUARE BORUTO;So;0;L;<square> 30DC 30EB 30C8;;;;N;SQUARED BORUTO;;;;
+333F;SQUARE HON;So;0;L;<square> 30DB 30F3;;;;N;SQUARED HON;;;;
+3340;SQUARE PONDO;So;0;L;<square> 30DD 30F3 30C9;;;;N;SQUARED PONDO;;;;
+3341;SQUARE HOORU;So;0;L;<square> 30DB 30FC 30EB;;;;N;SQUARED HOORU;;;;
+3342;SQUARE HOON;So;0;L;<square> 30DB 30FC 30F3;;;;N;SQUARED HOON;;;;
+3343;SQUARE MAIKURO;So;0;L;<square> 30DE 30A4 30AF 30ED;;;;N;SQUARED MAIKURO;;;;
+3344;SQUARE MAIRU;So;0;L;<square> 30DE 30A4 30EB;;;;N;SQUARED MAIRU;;;;
+3345;SQUARE MAHHA;So;0;L;<square> 30DE 30C3 30CF;;;;N;SQUARED MAHHA;;;;
+3346;SQUARE MARUKU;So;0;L;<square> 30DE 30EB 30AF;;;;N;SQUARED MARUKU;;;;
+3347;SQUARE MANSYON;So;0;L;<square> 30DE 30F3 30B7 30E7 30F3;;;;N;SQUARED MANSYON;;;;
+3348;SQUARE MIKURON;So;0;L;<square> 30DF 30AF 30ED 30F3;;;;N;SQUARED MIKURON;;;;
+3349;SQUARE MIRI;So;0;L;<square> 30DF 30EA;;;;N;SQUARED MIRI;;;;
+334A;SQUARE MIRIBAARU;So;0;L;<square> 30DF 30EA 30D0 30FC 30EB;;;;N;SQUARED MIRIBAARU;;;;
+334B;SQUARE MEGA;So;0;L;<square> 30E1 30AC;;;;N;SQUARED MEGA;;;;
+334C;SQUARE MEGATON;So;0;L;<square> 30E1 30AC 30C8 30F3;;;;N;SQUARED MEGATON;;;;
+334D;SQUARE MEETORU;So;0;L;<square> 30E1 30FC 30C8 30EB;;;;N;SQUARED MEETORU;;;;
+334E;SQUARE YAADO;So;0;L;<square> 30E4 30FC 30C9;;;;N;SQUARED YAADO;;;;
+334F;SQUARE YAARU;So;0;L;<square> 30E4 30FC 30EB;;;;N;SQUARED YAARU;;;;
+3350;SQUARE YUAN;So;0;L;<square> 30E6 30A2 30F3;;;;N;SQUARED YUAN;;;;
+3351;SQUARE RITTORU;So;0;L;<square> 30EA 30C3 30C8 30EB;;;;N;SQUARED RITTORU;;;;
+3352;SQUARE RIRA;So;0;L;<square> 30EA 30E9;;;;N;SQUARED RIRA;;;;
+3353;SQUARE RUPII;So;0;L;<square> 30EB 30D4 30FC;;;;N;SQUARED RUPII;;;;
+3354;SQUARE RUUBURU;So;0;L;<square> 30EB 30FC 30D6 30EB;;;;N;SQUARED RUUBURU;;;;
+3355;SQUARE REMU;So;0;L;<square> 30EC 30E0;;;;N;SQUARED REMU;;;;
+3356;SQUARE RENTOGEN;So;0;L;<square> 30EC 30F3 30C8 30B2 30F3;;;;N;SQUARED RENTOGEN;;;;
+3357;SQUARE WATTO;So;0;L;<square> 30EF 30C3 30C8;;;;N;SQUARED WATTO;;;;
+3358;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ZERO;So;0;L;<compat> 0030 70B9;;;;N;;;;;
+3359;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ONE;So;0;L;<compat> 0031 70B9;;;;N;;;;;
+335A;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWO;So;0;L;<compat> 0032 70B9;;;;N;;;;;
+335B;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR THREE;So;0;L;<compat> 0033 70B9;;;;N;;;;;
+335C;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FOUR;So;0;L;<compat> 0034 70B9;;;;N;;;;;
+335D;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FIVE;So;0;L;<compat> 0035 70B9;;;;N;;;;;
+335E;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SIX;So;0;L;<compat> 0036 70B9;;;;N;;;;;
+335F;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SEVEN;So;0;L;<compat> 0037 70B9;;;;N;;;;;
+3360;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR EIGHT;So;0;L;<compat> 0038 70B9;;;;N;;;;;
+3361;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR NINE;So;0;L;<compat> 0039 70B9;;;;N;;;;;
+3362;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TEN;So;0;L;<compat> 0031 0030 70B9;;;;N;;;;;
+3363;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ELEVEN;So;0;L;<compat> 0031 0031 70B9;;;;N;;;;;
+3364;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWELVE;So;0;L;<compat> 0031 0032 70B9;;;;N;;;;;
+3365;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR THIRTEEN;So;0;L;<compat> 0031 0033 70B9;;;;N;;;;;
+3366;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FOURTEEN;So;0;L;<compat> 0031 0034 70B9;;;;N;;;;;
+3367;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FIFTEEN;So;0;L;<compat> 0031 0035 70B9;;;;N;;;;;
+3368;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SIXTEEN;So;0;L;<compat> 0031 0036 70B9;;;;N;;;;;
+3369;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SEVENTEEN;So;0;L;<compat> 0031 0037 70B9;;;;N;;;;;
+336A;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR EIGHTEEN;So;0;L;<compat> 0031 0038 70B9;;;;N;;;;;
+336B;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR NINETEEN;So;0;L;<compat> 0031 0039 70B9;;;;N;;;;;
+336C;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY;So;0;L;<compat> 0032 0030 70B9;;;;N;;;;;
+336D;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-ONE;So;0;L;<compat> 0032 0031 70B9;;;;N;;;;;
+336E;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-TWO;So;0;L;<compat> 0032 0032 70B9;;;;N;;;;;
+336F;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-THREE;So;0;L;<compat> 0032 0033 70B9;;;;N;;;;;
+3370;IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-FOUR;So;0;L;<compat> 0032 0034 70B9;;;;N;;;;;
+3371;SQUARE HPA;So;0;L;<square> 0068 0050 0061;;;;N;;;;;
+3372;SQUARE DA;So;0;L;<square> 0064 0061;;;;N;;;;;
+3373;SQUARE AU;So;0;L;<square> 0041 0055;;;;N;;;;;
+3374;SQUARE BAR;So;0;L;<square> 0062 0061 0072;;;;N;;;;;
+3375;SQUARE OV;So;0;L;<square> 006F 0056;;;;N;;;;;
+3376;SQUARE PC;So;0;L;<square> 0070 0063;;;;N;;;;;
+3377;SQUARE DM;So;0;ON;<square> 0064 006D;;;;N;;;;;
+3378;SQUARE DM SQUARED;So;0;ON;<square> 0064 006D 00B2;;;;N;;;;;
+3379;SQUARE DM CUBED;So;0;ON;<square> 0064 006D 00B3;;;;N;;;;;
+337A;SQUARE IU;So;0;ON;<square> 0049 0055;;;;N;;;;;
+337B;SQUARE ERA NAME HEISEI;So;0;L;<square> 5E73 6210;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME HEISEI;;;;
+337C;SQUARE ERA NAME SYOUWA;So;0;L;<square> 662D 548C;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME SYOUWA;;;;
+337D;SQUARE ERA NAME TAISYOU;So;0;L;<square> 5927 6B63;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME TAISYOU;;;;
+337E;SQUARE ERA NAME MEIZI;So;0;L;<square> 660E 6CBB;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME MEIZI;;;;
+337F;SQUARE CORPORATION;So;0;L;<square> 682A 5F0F 4F1A 793E;;;;N;SQUARED FOUR IDEOGRAPHS CORPORATION;;;;
+3380;SQUARE PA AMPS;So;0;L;<square> 0070 0041;;;;N;SQUARED PA AMPS;;;;
+3381;SQUARE NA;So;0;L;<square> 006E 0041;;;;N;SQUARED NA;;;;
+3382;SQUARE MU A;So;0;L;<square> 03BC 0041;;;;N;SQUARED MU A;;;;
+3383;SQUARE MA;So;0;L;<square> 006D 0041;;;;N;SQUARED MA;;;;
+3384;SQUARE KA;So;0;L;<square> 006B 0041;;;;N;SQUARED KA;;;;
+3385;SQUARE KB;So;0;L;<square> 004B 0042;;;;N;SQUARED KB;;;;
+3386;SQUARE MB;So;0;L;<square> 004D 0042;;;;N;SQUARED MB;;;;
+3387;SQUARE GB;So;0;L;<square> 0047 0042;;;;N;SQUARED GB;;;;
+3388;SQUARE CAL;So;0;L;<square> 0063 0061 006C;;;;N;SQUARED CAL;;;;
+3389;SQUARE KCAL;So;0;L;<square> 006B 0063 0061 006C;;;;N;SQUARED KCAL;;;;
+338A;SQUARE PF;So;0;L;<square> 0070 0046;;;;N;SQUARED PF;;;;
+338B;SQUARE NF;So;0;L;<square> 006E 0046;;;;N;SQUARED NF;;;;
+338C;SQUARE MU F;So;0;L;<square> 03BC 0046;;;;N;SQUARED MU F;;;;
+338D;SQUARE MU G;So;0;L;<square> 03BC 0067;;;;N;SQUARED MU G;;;;
+338E;SQUARE MG;So;0;L;<square> 006D 0067;;;;N;SQUARED MG;;;;
+338F;SQUARE KG;So;0;L;<square> 006B 0067;;;;N;SQUARED KG;;;;
+3390;SQUARE HZ;So;0;L;<square> 0048 007A;;;;N;SQUARED HZ;;;;
+3391;SQUARE KHZ;So;0;L;<square> 006B 0048 007A;;;;N;SQUARED KHZ;;;;
+3392;SQUARE MHZ;So;0;L;<square> 004D 0048 007A;;;;N;SQUARED MHZ;;;;
+3393;SQUARE GHZ;So;0;L;<square> 0047 0048 007A;;;;N;SQUARED GHZ;;;;
+3394;SQUARE THZ;So;0;L;<square> 0054 0048 007A;;;;N;SQUARED THZ;;;;
+3395;SQUARE MU L;So;0;L;<square> 03BC 2113;;;;N;SQUARED MU L;;;;
+3396;SQUARE ML;So;0;L;<square> 006D 2113;;;;N;SQUARED ML;;;;
+3397;SQUARE DL;So;0;L;<square> 0064 2113;;;;N;SQUARED DL;;;;
+3398;SQUARE KL;So;0;L;<square> 006B 2113;;;;N;SQUARED KL;;;;
+3399;SQUARE FM;So;0;L;<square> 0066 006D;;;;N;SQUARED FM;;;;
+339A;SQUARE NM;So;0;L;<square> 006E 006D;;;;N;SQUARED NM;;;;
+339B;SQUARE MU M;So;0;L;<square> 03BC 006D;;;;N;SQUARED MU M;;;;
+339C;SQUARE MM;So;0;L;<square> 006D 006D;;;;N;SQUARED MM;;;;
+339D;SQUARE CM;So;0;L;<square> 0063 006D;;;;N;SQUARED CM;;;;
+339E;SQUARE KM;So;0;L;<square> 006B 006D;;;;N;SQUARED KM;;;;
+339F;SQUARE MM SQUARED;So;0;L;<square> 006D 006D 00B2;;;;N;SQUARED MM SQUARED;;;;
+33A0;SQUARE CM SQUARED;So;0;L;<square> 0063 006D 00B2;;;;N;SQUARED CM SQUARED;;;;
+33A1;SQUARE M SQUARED;So;0;L;<square> 006D 00B2;;;;N;SQUARED M SQUARED;;;;
+33A2;SQUARE KM SQUARED;So;0;L;<square> 006B 006D 00B2;;;;N;SQUARED KM SQUARED;;;;
+33A3;SQUARE MM CUBED;So;0;L;<square> 006D 006D 00B3;;;;N;SQUARED MM CUBED;;;;
+33A4;SQUARE CM CUBED;So;0;L;<square> 0063 006D 00B3;;;;N;SQUARED CM CUBED;;;;
+33A5;SQUARE M CUBED;So;0;L;<square> 006D 00B3;;;;N;SQUARED M CUBED;;;;
+33A6;SQUARE KM CUBED;So;0;L;<square> 006B 006D 00B3;;;;N;SQUARED KM CUBED;;;;
+33A7;SQUARE M OVER S;So;0;L;<square> 006D 2215 0073;;;;N;SQUARED M OVER S;;;;
+33A8;SQUARE M OVER S SQUARED;So;0;L;<square> 006D 2215 0073 00B2;;;;N;SQUARED M OVER S SQUARED;;;;
+33A9;SQUARE PA;So;0;L;<square> 0050 0061;;;;N;SQUARED PA;;;;
+33AA;SQUARE KPA;So;0;L;<square> 006B 0050 0061;;;;N;SQUARED KPA;;;;
+33AB;SQUARE MPA;So;0;L;<square> 004D 0050 0061;;;;N;SQUARED MPA;;;;
+33AC;SQUARE GPA;So;0;L;<square> 0047 0050 0061;;;;N;SQUARED GPA;;;;
+33AD;SQUARE RAD;So;0;L;<square> 0072 0061 0064;;;;N;SQUARED RAD;;;;
+33AE;SQUARE RAD OVER S;So;0;L;<square> 0072 0061 0064 2215 0073;;;;N;SQUARED RAD OVER S;;;;
+33AF;SQUARE RAD OVER S SQUARED;So;0;L;<square> 0072 0061 0064 2215 0073 00B2;;;;N;SQUARED RAD OVER S SQUARED;;;;
+33B0;SQUARE PS;So;0;L;<square> 0070 0073;;;;N;SQUARED PS;;;;
+33B1;SQUARE NS;So;0;L;<square> 006E 0073;;;;N;SQUARED NS;;;;
+33B2;SQUARE MU S;So;0;L;<square> 03BC 0073;;;;N;SQUARED MU S;;;;
+33B3;SQUARE MS;So;0;L;<square> 006D 0073;;;;N;SQUARED MS;;;;
+33B4;SQUARE PV;So;0;L;<square> 0070 0056;;;;N;SQUARED PV;;;;
+33B5;SQUARE NV;So;0;L;<square> 006E 0056;;;;N;SQUARED NV;;;;
+33B6;SQUARE MU V;So;0;L;<square> 03BC 0056;;;;N;SQUARED MU V;;;;
+33B7;SQUARE MV;So;0;L;<square> 006D 0056;;;;N;SQUARED MV;;;;
+33B8;SQUARE KV;So;0;L;<square> 006B 0056;;;;N;SQUARED KV;;;;
+33B9;SQUARE MV MEGA;So;0;L;<square> 004D 0056;;;;N;SQUARED MV MEGA;;;;
+33BA;SQUARE PW;So;0;L;<square> 0070 0057;;;;N;SQUARED PW;;;;
+33BB;SQUARE NW;So;0;L;<square> 006E 0057;;;;N;SQUARED NW;;;;
+33BC;SQUARE MU W;So;0;L;<square> 03BC 0057;;;;N;SQUARED MU W;;;;
+33BD;SQUARE MW;So;0;L;<square> 006D 0057;;;;N;SQUARED MW;;;;
+33BE;SQUARE KW;So;0;L;<square> 006B 0057;;;;N;SQUARED KW;;;;
+33BF;SQUARE MW MEGA;So;0;L;<square> 004D 0057;;;;N;SQUARED MW MEGA;;;;
+33C0;SQUARE K OHM;So;0;L;<square> 006B 03A9;;;;N;SQUARED K OHM;;;;
+33C1;SQUARE M OHM;So;0;L;<square> 004D 03A9;;;;N;SQUARED M OHM;;;;
+33C2;SQUARE AM;So;0;L;<square> 0061 002E 006D 002E;;;;N;SQUARED AM;;;;
+33C3;SQUARE BQ;So;0;L;<square> 0042 0071;;;;N;SQUARED BQ;;;;
+33C4;SQUARE CC;So;0;L;<square> 0063 0063;;;;N;SQUARED CC;;;;
+33C5;SQUARE CD;So;0;L;<square> 0063 0064;;;;N;SQUARED CD;;;;
+33C6;SQUARE C OVER KG;So;0;L;<square> 0043 2215 006B 0067;;;;N;SQUARED C OVER KG;;;;
+33C7;SQUARE CO;So;0;L;<square> 0043 006F 002E;;;;N;SQUARED CO;;;;
+33C8;SQUARE DB;So;0;L;<square> 0064 0042;;;;N;SQUARED DB;;;;
+33C9;SQUARE GY;So;0;L;<square> 0047 0079;;;;N;SQUARED GY;;;;
+33CA;SQUARE HA;So;0;L;<square> 0068 0061;;;;N;SQUARED HA;;;;
+33CB;SQUARE HP;So;0;L;<square> 0048 0050;;;;N;SQUARED HP;;;;
+33CC;SQUARE IN;So;0;L;<square> 0069 006E;;;;N;SQUARED IN;;;;
+33CD;SQUARE KK;So;0;L;<square> 004B 004B;;;;N;SQUARED KK;;;;
+33CE;SQUARE KM CAPITAL;So;0;L;<square> 004B 004D;;;;N;SQUARED KM CAPITAL;;;;
+33CF;SQUARE KT;So;0;L;<square> 006B 0074;;;;N;SQUARED KT;;;;
+33D0;SQUARE LM;So;0;L;<square> 006C 006D;;;;N;SQUARED LM;;;;
+33D1;SQUARE LN;So;0;L;<square> 006C 006E;;;;N;SQUARED LN;;;;
+33D2;SQUARE LOG;So;0;L;<square> 006C 006F 0067;;;;N;SQUARED LOG;;;;
+33D3;SQUARE LX;So;0;L;<square> 006C 0078;;;;N;SQUARED LX;;;;
+33D4;SQUARE MB SMALL;So;0;L;<square> 006D 0062;;;;N;SQUARED MB SMALL;;;;
+33D5;SQUARE MIL;So;0;L;<square> 006D 0069 006C;;;;N;SQUARED MIL;;;;
+33D6;SQUARE MOL;So;0;L;<square> 006D 006F 006C;;;;N;SQUARED MOL;;;;
+33D7;SQUARE PH;So;0;L;<square> 0050 0048;;;;N;SQUARED PH;;;;
+33D8;SQUARE PM;So;0;L;<square> 0070 002E 006D 002E;;;;N;SQUARED PM;;;;
+33D9;SQUARE PPM;So;0;L;<square> 0050 0050 004D;;;;N;SQUARED PPM;;;;
+33DA;SQUARE PR;So;0;L;<square> 0050 0052;;;;N;SQUARED PR;;;;
+33DB;SQUARE SR;So;0;L;<square> 0073 0072;;;;N;SQUARED SR;;;;
+33DC;SQUARE SV;So;0;L;<square> 0053 0076;;;;N;SQUARED SV;;;;
+33DD;SQUARE WB;So;0;L;<square> 0057 0062;;;;N;SQUARED WB;;;;
+33DE;SQUARE V OVER M;So;0;ON;<square> 0056 2215 006D;;;;N;;;;;
+33DF;SQUARE A OVER M;So;0;ON;<square> 0041 2215 006D;;;;N;;;;;
+33E0;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY ONE;So;0;L;<compat> 0031 65E5;;;;N;;;;;
+33E1;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWO;So;0;L;<compat> 0032 65E5;;;;N;;;;;
+33E2;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THREE;So;0;L;<compat> 0033 65E5;;;;N;;;;;
+33E3;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FOUR;So;0;L;<compat> 0034 65E5;;;;N;;;;;
+33E4;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FIVE;So;0;L;<compat> 0035 65E5;;;;N;;;;;
+33E5;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SIX;So;0;L;<compat> 0036 65E5;;;;N;;;;;
+33E6;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SEVEN;So;0;L;<compat> 0037 65E5;;;;N;;;;;
+33E7;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY EIGHT;So;0;L;<compat> 0038 65E5;;;;N;;;;;
+33E8;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY NINE;So;0;L;<compat> 0039 65E5;;;;N;;;;;
+33E9;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TEN;So;0;L;<compat> 0031 0030 65E5;;;;N;;;;;
+33EA;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY ELEVEN;So;0;L;<compat> 0031 0031 65E5;;;;N;;;;;
+33EB;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWELVE;So;0;L;<compat> 0031 0032 65E5;;;;N;;;;;
+33EC;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTEEN;So;0;L;<compat> 0031 0033 65E5;;;;N;;;;;
+33ED;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FOURTEEN;So;0;L;<compat> 0031 0034 65E5;;;;N;;;;;
+33EE;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FIFTEEN;So;0;L;<compat> 0031 0035 65E5;;;;N;;;;;
+33EF;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SIXTEEN;So;0;L;<compat> 0031 0036 65E5;;;;N;;;;;
+33F0;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SEVENTEEN;So;0;L;<compat> 0031 0037 65E5;;;;N;;;;;
+33F1;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY EIGHTEEN;So;0;L;<compat> 0031 0038 65E5;;;;N;;;;;
+33F2;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY NINETEEN;So;0;L;<compat> 0031 0039 65E5;;;;N;;;;;
+33F3;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY;So;0;L;<compat> 0032 0030 65E5;;;;N;;;;;
+33F4;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-ONE;So;0;L;<compat> 0032 0031 65E5;;;;N;;;;;
+33F5;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-TWO;So;0;L;<compat> 0032 0032 65E5;;;;N;;;;;
+33F6;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-THREE;So;0;L;<compat> 0032 0033 65E5;;;;N;;;;;
+33F7;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-FOUR;So;0;L;<compat> 0032 0034 65E5;;;;N;;;;;
+33F8;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-FIVE;So;0;L;<compat> 0032 0035 65E5;;;;N;;;;;
+33F9;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-SIX;So;0;L;<compat> 0032 0036 65E5;;;;N;;;;;
+33FA;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-SEVEN;So;0;L;<compat> 0032 0037 65E5;;;;N;;;;;
+33FB;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-EIGHT;So;0;L;<compat> 0032 0038 65E5;;;;N;;;;;
+33FC;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-NINE;So;0;L;<compat> 0032 0039 65E5;;;;N;;;;;
+33FD;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTY;So;0;L;<compat> 0033 0030 65E5;;;;N;;;;;
+33FE;IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTY-ONE;So;0;L;<compat> 0033 0031 65E5;;;;N;;;;;
+33FF;SQUARE GAL;So;0;ON;<square> 0067 0061 006C;;;;N;;;;;
+3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
+4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
+4DC0;HEXAGRAM FOR THE CREATIVE HEAVEN;So;0;ON;;;;;N;;;;;
+4DC1;HEXAGRAM FOR THE RECEPTIVE EARTH;So;0;ON;;;;;N;;;;;
+4DC2;HEXAGRAM FOR DIFFICULTY AT THE BEGINNING;So;0;ON;;;;;N;;;;;
+4DC3;HEXAGRAM FOR YOUTHFUL FOLLY;So;0;ON;;;;;N;;;;;
+4DC4;HEXAGRAM FOR WAITING;So;0;ON;;;;;N;;;;;
+4DC5;HEXAGRAM FOR CONFLICT;So;0;ON;;;;;N;;;;;
+4DC6;HEXAGRAM FOR THE ARMY;So;0;ON;;;;;N;;;;;
+4DC7;HEXAGRAM FOR HOLDING TOGETHER;So;0;ON;;;;;N;;;;;
+4DC8;HEXAGRAM FOR SMALL TAMING;So;0;ON;;;;;N;;;;;
+4DC9;HEXAGRAM FOR TREADING;So;0;ON;;;;;N;;;;;
+4DCA;HEXAGRAM FOR PEACE;So;0;ON;;;;;N;;;;;
+4DCB;HEXAGRAM FOR STANDSTILL;So;0;ON;;;;;N;;;;;
+4DCC;HEXAGRAM FOR FELLOWSHIP;So;0;ON;;;;;N;;;;;
+4DCD;HEXAGRAM FOR GREAT POSSESSION;So;0;ON;;;;;N;;;;;
+4DCE;HEXAGRAM FOR MODESTY;So;0;ON;;;;;N;;;;;
+4DCF;HEXAGRAM FOR ENTHUSIASM;So;0;ON;;;;;N;;;;;
+4DD0;HEXAGRAM FOR FOLLOWING;So;0;ON;;;;;N;;;;;
+4DD1;HEXAGRAM FOR WORK ON THE DECAYED;So;0;ON;;;;;N;;;;;
+4DD2;HEXAGRAM FOR APPROACH;So;0;ON;;;;;N;;;;;
+4DD3;HEXAGRAM FOR CONTEMPLATION;So;0;ON;;;;;N;;;;;
+4DD4;HEXAGRAM FOR BITING THROUGH;So;0;ON;;;;;N;;;;;
+4DD5;HEXAGRAM FOR GRACE;So;0;ON;;;;;N;;;;;
+4DD6;HEXAGRAM FOR SPLITTING APART;So;0;ON;;;;;N;;;;;
+4DD7;HEXAGRAM FOR RETURN;So;0;ON;;;;;N;;;;;
+4DD8;HEXAGRAM FOR INNOCENCE;So;0;ON;;;;;N;;;;;
+4DD9;HEXAGRAM FOR GREAT TAMING;So;0;ON;;;;;N;;;;;
+4DDA;HEXAGRAM FOR MOUTH CORNERS;So;0;ON;;;;;N;;;;;
+4DDB;HEXAGRAM FOR GREAT PREPONDERANCE;So;0;ON;;;;;N;;;;;
+4DDC;HEXAGRAM FOR THE ABYSMAL WATER;So;0;ON;;;;;N;;;;;
+4DDD;HEXAGRAM FOR THE CLINGING FIRE;So;0;ON;;;;;N;;;;;
+4DDE;HEXAGRAM FOR INFLUENCE;So;0;ON;;;;;N;;;;;
+4DDF;HEXAGRAM FOR DURATION;So;0;ON;;;;;N;;;;;
+4DE0;HEXAGRAM FOR RETREAT;So;0;ON;;;;;N;;;;;
+4DE1;HEXAGRAM FOR GREAT POWER;So;0;ON;;;;;N;;;;;
+4DE2;HEXAGRAM FOR PROGRESS;So;0;ON;;;;;N;;;;;
+4DE3;HEXAGRAM FOR DARKENING OF THE LIGHT;So;0;ON;;;;;N;;;;;
+4DE4;HEXAGRAM FOR THE FAMILY;So;0;ON;;;;;N;;;;;
+4DE5;HEXAGRAM FOR OPPOSITION;So;0;ON;;;;;N;;;;;
+4DE6;HEXAGRAM FOR OBSTRUCTION;So;0;ON;;;;;N;;;;;
+4DE7;HEXAGRAM FOR DELIVERANCE;So;0;ON;;;;;N;;;;;
+4DE8;HEXAGRAM FOR DECREASE;So;0;ON;;;;;N;;;;;
+4DE9;HEXAGRAM FOR INCREASE;So;0;ON;;;;;N;;;;;
+4DEA;HEXAGRAM FOR BREAKTHROUGH;So;0;ON;;;;;N;;;;;
+4DEB;HEXAGRAM FOR COMING TO MEET;So;0;ON;;;;;N;;;;;
+4DEC;HEXAGRAM FOR GATHERING TOGETHER;So;0;ON;;;;;N;;;;;
+4DED;HEXAGRAM FOR PUSHING UPWARD;So;0;ON;;;;;N;;;;;
+4DEE;HEXAGRAM FOR OPPRESSION;So;0;ON;;;;;N;;;;;
+4DEF;HEXAGRAM FOR THE WELL;So;0;ON;;;;;N;;;;;
+4DF0;HEXAGRAM FOR REVOLUTION;So;0;ON;;;;;N;;;;;
+4DF1;HEXAGRAM FOR THE CAULDRON;So;0;ON;;;;;N;;;;;
+4DF2;HEXAGRAM FOR THE AROUSING THUNDER;So;0;ON;;;;;N;;;;;
+4DF3;HEXAGRAM FOR THE KEEPING STILL MOUNTAIN;So;0;ON;;;;;N;;;;;
+4DF4;HEXAGRAM FOR DEVELOPMENT;So;0;ON;;;;;N;;;;;
+4DF5;HEXAGRAM FOR THE MARRYING MAIDEN;So;0;ON;;;;;N;;;;;
+4DF6;HEXAGRAM FOR ABUNDANCE;So;0;ON;;;;;N;;;;;
+4DF7;HEXAGRAM FOR THE WANDERER;So;0;ON;;;;;N;;;;;
+4DF8;HEXAGRAM FOR THE GENTLE WIND;So;0;ON;;;;;N;;;;;
+4DF9;HEXAGRAM FOR THE JOYOUS LAKE;So;0;ON;;;;;N;;;;;
+4DFA;HEXAGRAM FOR DISPERSION;So;0;ON;;;;;N;;;;;
+4DFB;HEXAGRAM FOR LIMITATION;So;0;ON;;;;;N;;;;;
+4DFC;HEXAGRAM FOR INNER TRUTH;So;0;ON;;;;;N;;;;;
+4DFD;HEXAGRAM FOR SMALL PREPONDERANCE;So;0;ON;;;;;N;;;;;
+4DFE;HEXAGRAM FOR AFTER COMPLETION;So;0;ON;;;;;N;;;;;
+4DFF;HEXAGRAM FOR BEFORE COMPLETION;So;0;ON;;;;;N;;;;;
+4E00;<CJK Ideograph, First>;Lo;0;L;;;;;N;;;;;
+9FBB;<CJK Ideograph, Last>;Lo;0;L;;;;;N;;;;;
+A000;YI SYLLABLE IT;Lo;0;L;;;;;N;;;;;
+A001;YI SYLLABLE IX;Lo;0;L;;;;;N;;;;;
+A002;YI SYLLABLE I;Lo;0;L;;;;;N;;;;;
+A003;YI SYLLABLE IP;Lo;0;L;;;;;N;;;;;
+A004;YI SYLLABLE IET;Lo;0;L;;;;;N;;;;;
+A005;YI SYLLABLE IEX;Lo;0;L;;;;;N;;;;;
+A006;YI SYLLABLE IE;Lo;0;L;;;;;N;;;;;
+A007;YI SYLLABLE IEP;Lo;0;L;;;;;N;;;;;
+A008;YI SYLLABLE AT;Lo;0;L;;;;;N;;;;;
+A009;YI SYLLABLE AX;Lo;0;L;;;;;N;;;;;
+A00A;YI SYLLABLE A;Lo;0;L;;;;;N;;;;;
+A00B;YI SYLLABLE AP;Lo;0;L;;;;;N;;;;;
+A00C;YI SYLLABLE UOX;Lo;0;L;;;;;N;;;;;
+A00D;YI SYLLABLE UO;Lo;0;L;;;;;N;;;;;
+A00E;YI SYLLABLE UOP;Lo;0;L;;;;;N;;;;;
+A00F;YI SYLLABLE OT;Lo;0;L;;;;;N;;;;;
+A010;YI SYLLABLE OX;Lo;0;L;;;;;N;;;;;
+A011;YI SYLLABLE O;Lo;0;L;;;;;N;;;;;
+A012;YI SYLLABLE OP;Lo;0;L;;;;;N;;;;;
+A013;YI SYLLABLE EX;Lo;0;L;;;;;N;;;;;
+A014;YI SYLLABLE E;Lo;0;L;;;;;N;;;;;
+A015;YI SYLLABLE WU;Lm;0;L;;;;;N;;;;;
+A016;YI SYLLABLE BIT;Lo;0;L;;;;;N;;;;;
+A017;YI SYLLABLE BIX;Lo;0;L;;;;;N;;;;;
+A018;YI SYLLABLE BI;Lo;0;L;;;;;N;;;;;
+A019;YI SYLLABLE BIP;Lo;0;L;;;;;N;;;;;
+A01A;YI SYLLABLE BIET;Lo;0;L;;;;;N;;;;;
+A01B;YI SYLLABLE BIEX;Lo;0;L;;;;;N;;;;;
+A01C;YI SYLLABLE BIE;Lo;0;L;;;;;N;;;;;
+A01D;YI SYLLABLE BIEP;Lo;0;L;;;;;N;;;;;
+A01E;YI SYLLABLE BAT;Lo;0;L;;;;;N;;;;;
+A01F;YI SYLLABLE BAX;Lo;0;L;;;;;N;;;;;
+A020;YI SYLLABLE BA;Lo;0;L;;;;;N;;;;;
+A021;YI SYLLABLE BAP;Lo;0;L;;;;;N;;;;;
+A022;YI SYLLABLE BUOX;Lo;0;L;;;;;N;;;;;
+A023;YI SYLLABLE BUO;Lo;0;L;;;;;N;;;;;
+A024;YI SYLLABLE BUOP;Lo;0;L;;;;;N;;;;;
+A025;YI SYLLABLE BOT;Lo;0;L;;;;;N;;;;;
+A026;YI SYLLABLE BOX;Lo;0;L;;;;;N;;;;;
+A027;YI SYLLABLE BO;Lo;0;L;;;;;N;;;;;
+A028;YI SYLLABLE BOP;Lo;0;L;;;;;N;;;;;
+A029;YI SYLLABLE BEX;Lo;0;L;;;;;N;;;;;
+A02A;YI SYLLABLE BE;Lo;0;L;;;;;N;;;;;
+A02B;YI SYLLABLE BEP;Lo;0;L;;;;;N;;;;;
+A02C;YI SYLLABLE BUT;Lo;0;L;;;;;N;;;;;
+A02D;YI SYLLABLE BUX;Lo;0;L;;;;;N;;;;;
+A02E;YI SYLLABLE BU;Lo;0;L;;;;;N;;;;;
+A02F;YI SYLLABLE BUP;Lo;0;L;;;;;N;;;;;
+A030;YI SYLLABLE BURX;Lo;0;L;;;;;N;;;;;
+A031;YI SYLLABLE BUR;Lo;0;L;;;;;N;;;;;
+A032;YI SYLLABLE BYT;Lo;0;L;;;;;N;;;;;
+A033;YI SYLLABLE BYX;Lo;0;L;;;;;N;;;;;
+A034;YI SYLLABLE BY;Lo;0;L;;;;;N;;;;;
+A035;YI SYLLABLE BYP;Lo;0;L;;;;;N;;;;;
+A036;YI SYLLABLE BYRX;Lo;0;L;;;;;N;;;;;
+A037;YI SYLLABLE BYR;Lo;0;L;;;;;N;;;;;
+A038;YI SYLLABLE PIT;Lo;0;L;;;;;N;;;;;
+A039;YI SYLLABLE PIX;Lo;0;L;;;;;N;;;;;
+A03A;YI SYLLABLE PI;Lo;0;L;;;;;N;;;;;
+A03B;YI SYLLABLE PIP;Lo;0;L;;;;;N;;;;;
+A03C;YI SYLLABLE PIEX;Lo;0;L;;;;;N;;;;;
+A03D;YI SYLLABLE PIE;Lo;0;L;;;;;N;;;;;
+A03E;YI SYLLABLE PIEP;Lo;0;L;;;;;N;;;;;
+A03F;YI SYLLABLE PAT;Lo;0;L;;;;;N;;;;;
+A040;YI SYLLABLE PAX;Lo;0;L;;;;;N;;;;;
+A041;YI SYLLABLE PA;Lo;0;L;;;;;N;;;;;
+A042;YI SYLLABLE PAP;Lo;0;L;;;;;N;;;;;
+A043;YI SYLLABLE PUOX;Lo;0;L;;;;;N;;;;;
+A044;YI SYLLABLE PUO;Lo;0;L;;;;;N;;;;;
+A045;YI SYLLABLE PUOP;Lo;0;L;;;;;N;;;;;
+A046;YI SYLLABLE POT;Lo;0;L;;;;;N;;;;;
+A047;YI SYLLABLE POX;Lo;0;L;;;;;N;;;;;
+A048;YI SYLLABLE PO;Lo;0;L;;;;;N;;;;;
+A049;YI SYLLABLE POP;Lo;0;L;;;;;N;;;;;
+A04A;YI SYLLABLE PUT;Lo;0;L;;;;;N;;;;;
+A04B;YI SYLLABLE PUX;Lo;0;L;;;;;N;;;;;
+A04C;YI SYLLABLE PU;Lo;0;L;;;;;N;;;;;
+A04D;YI SYLLABLE PUP;Lo;0;L;;;;;N;;;;;
+A04E;YI SYLLABLE PURX;Lo;0;L;;;;;N;;;;;
+A04F;YI SYLLABLE PUR;Lo;0;L;;;;;N;;;;;
+A050;YI SYLLABLE PYT;Lo;0;L;;;;;N;;;;;
+A051;YI SYLLABLE PYX;Lo;0;L;;;;;N;;;;;
+A052;YI SYLLABLE PY;Lo;0;L;;;;;N;;;;;
+A053;YI SYLLABLE PYP;Lo;0;L;;;;;N;;;;;
+A054;YI SYLLABLE PYRX;Lo;0;L;;;;;N;;;;;
+A055;YI SYLLABLE PYR;Lo;0;L;;;;;N;;;;;
+A056;YI SYLLABLE BBIT;Lo;0;L;;;;;N;;;;;
+A057;YI SYLLABLE BBIX;Lo;0;L;;;;;N;;;;;
+A058;YI SYLLABLE BBI;Lo;0;L;;;;;N;;;;;
+A059;YI SYLLABLE BBIP;Lo;0;L;;;;;N;;;;;
+A05A;YI SYLLABLE BBIET;Lo;0;L;;;;;N;;;;;
+A05B;YI SYLLABLE BBIEX;Lo;0;L;;;;;N;;;;;
+A05C;YI SYLLABLE BBIE;Lo;0;L;;;;;N;;;;;
+A05D;YI SYLLABLE BBIEP;Lo;0;L;;;;;N;;;;;
+A05E;YI SYLLABLE BBAT;Lo;0;L;;;;;N;;;;;
+A05F;YI SYLLABLE BBAX;Lo;0;L;;;;;N;;;;;
+A060;YI SYLLABLE BBA;Lo;0;L;;;;;N;;;;;
+A061;YI SYLLABLE BBAP;Lo;0;L;;;;;N;;;;;
+A062;YI SYLLABLE BBUOX;Lo;0;L;;;;;N;;;;;
+A063;YI SYLLABLE BBUO;Lo;0;L;;;;;N;;;;;
+A064;YI SYLLABLE BBUOP;Lo;0;L;;;;;N;;;;;
+A065;YI SYLLABLE BBOT;Lo;0;L;;;;;N;;;;;
+A066;YI SYLLABLE BBOX;Lo;0;L;;;;;N;;;;;
+A067;YI SYLLABLE BBO;Lo;0;L;;;;;N;;;;;
+A068;YI SYLLABLE BBOP;Lo;0;L;;;;;N;;;;;
+A069;YI SYLLABLE BBEX;Lo;0;L;;;;;N;;;;;
+A06A;YI SYLLABLE BBE;Lo;0;L;;;;;N;;;;;
+A06B;YI SYLLABLE BBEP;Lo;0;L;;;;;N;;;;;
+A06C;YI SYLLABLE BBUT;Lo;0;L;;;;;N;;;;;
+A06D;YI SYLLABLE BBUX;Lo;0;L;;;;;N;;;;;
+A06E;YI SYLLABLE BBU;Lo;0;L;;;;;N;;;;;
+A06F;YI SYLLABLE BBUP;Lo;0;L;;;;;N;;;;;
+A070;YI SYLLABLE BBURX;Lo;0;L;;;;;N;;;;;
+A071;YI SYLLABLE BBUR;Lo;0;L;;;;;N;;;;;
+A072;YI SYLLABLE BBYT;Lo;0;L;;;;;N;;;;;
+A073;YI SYLLABLE BBYX;Lo;0;L;;;;;N;;;;;
+A074;YI SYLLABLE BBY;Lo;0;L;;;;;N;;;;;
+A075;YI SYLLABLE BBYP;Lo;0;L;;;;;N;;;;;
+A076;YI SYLLABLE NBIT;Lo;0;L;;;;;N;;;;;
+A077;YI SYLLABLE NBIX;Lo;0;L;;;;;N;;;;;
+A078;YI SYLLABLE NBI;Lo;0;L;;;;;N;;;;;
+A079;YI SYLLABLE NBIP;Lo;0;L;;;;;N;;;;;
+A07A;YI SYLLABLE NBIEX;Lo;0;L;;;;;N;;;;;
+A07B;YI SYLLABLE NBIE;Lo;0;L;;;;;N;;;;;
+A07C;YI SYLLABLE NBIEP;Lo;0;L;;;;;N;;;;;
+A07D;YI SYLLABLE NBAT;Lo;0;L;;;;;N;;;;;
+A07E;YI SYLLABLE NBAX;Lo;0;L;;;;;N;;;;;
+A07F;YI SYLLABLE NBA;Lo;0;L;;;;;N;;;;;
+A080;YI SYLLABLE NBAP;Lo;0;L;;;;;N;;;;;
+A081;YI SYLLABLE NBOT;Lo;0;L;;;;;N;;;;;
+A082;YI SYLLABLE NBOX;Lo;0;L;;;;;N;;;;;
+A083;YI SYLLABLE NBO;Lo;0;L;;;;;N;;;;;
+A084;YI SYLLABLE NBOP;Lo;0;L;;;;;N;;;;;
+A085;YI SYLLABLE NBUT;Lo;0;L;;;;;N;;;;;
+A086;YI SYLLABLE NBUX;Lo;0;L;;;;;N;;;;;
+A087;YI SYLLABLE NBU;Lo;0;L;;;;;N;;;;;
+A088;YI SYLLABLE NBUP;Lo;0;L;;;;;N;;;;;
+A089;YI SYLLABLE NBURX;Lo;0;L;;;;;N;;;;;
+A08A;YI SYLLABLE NBUR;Lo;0;L;;;;;N;;;;;
+A08B;YI SYLLABLE NBYT;Lo;0;L;;;;;N;;;;;
+A08C;YI SYLLABLE NBYX;Lo;0;L;;;;;N;;;;;
+A08D;YI SYLLABLE NBY;Lo;0;L;;;;;N;;;;;
+A08E;YI SYLLABLE NBYP;Lo;0;L;;;;;N;;;;;
+A08F;YI SYLLABLE NBYRX;Lo;0;L;;;;;N;;;;;
+A090;YI SYLLABLE NBYR;Lo;0;L;;;;;N;;;;;
+A091;YI SYLLABLE HMIT;Lo;0;L;;;;;N;;;;;
+A092;YI SYLLABLE HMIX;Lo;0;L;;;;;N;;;;;
+A093;YI SYLLABLE HMI;Lo;0;L;;;;;N;;;;;
+A094;YI SYLLABLE HMIP;Lo;0;L;;;;;N;;;;;
+A095;YI SYLLABLE HMIEX;Lo;0;L;;;;;N;;;;;
+A096;YI SYLLABLE HMIE;Lo;0;L;;;;;N;;;;;
+A097;YI SYLLABLE HMIEP;Lo;0;L;;;;;N;;;;;
+A098;YI SYLLABLE HMAT;Lo;0;L;;;;;N;;;;;
+A099;YI SYLLABLE HMAX;Lo;0;L;;;;;N;;;;;
+A09A;YI SYLLABLE HMA;Lo;0;L;;;;;N;;;;;
+A09B;YI SYLLABLE HMAP;Lo;0;L;;;;;N;;;;;
+A09C;YI SYLLABLE HMUOX;Lo;0;L;;;;;N;;;;;
+A09D;YI SYLLABLE HMUO;Lo;0;L;;;;;N;;;;;
+A09E;YI SYLLABLE HMUOP;Lo;0;L;;;;;N;;;;;
+A09F;YI SYLLABLE HMOT;Lo;0;L;;;;;N;;;;;
+A0A0;YI SYLLABLE HMOX;Lo;0;L;;;;;N;;;;;
+A0A1;YI SYLLABLE HMO;Lo;0;L;;;;;N;;;;;
+A0A2;YI SYLLABLE HMOP;Lo;0;L;;;;;N;;;;;
+A0A3;YI SYLLABLE HMUT;Lo;0;L;;;;;N;;;;;
+A0A4;YI SYLLABLE HMUX;Lo;0;L;;;;;N;;;;;
+A0A5;YI SYLLABLE HMU;Lo;0;L;;;;;N;;;;;
+A0A6;YI SYLLABLE HMUP;Lo;0;L;;;;;N;;;;;
+A0A7;YI SYLLABLE HMURX;Lo;0;L;;;;;N;;;;;
+A0A8;YI SYLLABLE HMUR;Lo;0;L;;;;;N;;;;;
+A0A9;YI SYLLABLE HMYX;Lo;0;L;;;;;N;;;;;
+A0AA;YI SYLLABLE HMY;Lo;0;L;;;;;N;;;;;
+A0AB;YI SYLLABLE HMYP;Lo;0;L;;;;;N;;;;;
+A0AC;YI SYLLABLE HMYRX;Lo;0;L;;;;;N;;;;;
+A0AD;YI SYLLABLE HMYR;Lo;0;L;;;;;N;;;;;
+A0AE;YI SYLLABLE MIT;Lo;0;L;;;;;N;;;;;
+A0AF;YI SYLLABLE MIX;Lo;0;L;;;;;N;;;;;
+A0B0;YI SYLLABLE MI;Lo;0;L;;;;;N;;;;;
+A0B1;YI SYLLABLE MIP;Lo;0;L;;;;;N;;;;;
+A0B2;YI SYLLABLE MIEX;Lo;0;L;;;;;N;;;;;
+A0B3;YI SYLLABLE MIE;Lo;0;L;;;;;N;;;;;
+A0B4;YI SYLLABLE MIEP;Lo;0;L;;;;;N;;;;;
+A0B5;YI SYLLABLE MAT;Lo;0;L;;;;;N;;;;;
+A0B6;YI SYLLABLE MAX;Lo;0;L;;;;;N;;;;;
+A0B7;YI SYLLABLE MA;Lo;0;L;;;;;N;;;;;
+A0B8;YI SYLLABLE MAP;Lo;0;L;;;;;N;;;;;
+A0B9;YI SYLLABLE MUOT;Lo;0;L;;;;;N;;;;;
+A0BA;YI SYLLABLE MUOX;Lo;0;L;;;;;N;;;;;
+A0BB;YI SYLLABLE MUO;Lo;0;L;;;;;N;;;;;
+A0BC;YI SYLLABLE MUOP;Lo;0;L;;;;;N;;;;;
+A0BD;YI SYLLABLE MOT;Lo;0;L;;;;;N;;;;;
+A0BE;YI SYLLABLE MOX;Lo;0;L;;;;;N;;;;;
+A0BF;YI SYLLABLE MO;Lo;0;L;;;;;N;;;;;
+A0C0;YI SYLLABLE MOP;Lo;0;L;;;;;N;;;;;
+A0C1;YI SYLLABLE MEX;Lo;0;L;;;;;N;;;;;
+A0C2;YI SYLLABLE ME;Lo;0;L;;;;;N;;;;;
+A0C3;YI SYLLABLE MUT;Lo;0;L;;;;;N;;;;;
+A0C4;YI SYLLABLE MUX;Lo;0;L;;;;;N;;;;;
+A0C5;YI SYLLABLE MU;Lo;0;L;;;;;N;;;;;
+A0C6;YI SYLLABLE MUP;Lo;0;L;;;;;N;;;;;
+A0C7;YI SYLLABLE MURX;Lo;0;L;;;;;N;;;;;
+A0C8;YI SYLLABLE MUR;Lo;0;L;;;;;N;;;;;
+A0C9;YI SYLLABLE MYT;Lo;0;L;;;;;N;;;;;
+A0CA;YI SYLLABLE MYX;Lo;0;L;;;;;N;;;;;
+A0CB;YI SYLLABLE MY;Lo;0;L;;;;;N;;;;;
+A0CC;YI SYLLABLE MYP;Lo;0;L;;;;;N;;;;;
+A0CD;YI SYLLABLE FIT;Lo;0;L;;;;;N;;;;;
+A0CE;YI SYLLABLE FIX;Lo;0;L;;;;;N;;;;;
+A0CF;YI SYLLABLE FI;Lo;0;L;;;;;N;;;;;
+A0D0;YI SYLLABLE FIP;Lo;0;L;;;;;N;;;;;
+A0D1;YI SYLLABLE FAT;Lo;0;L;;;;;N;;;;;
+A0D2;YI SYLLABLE FAX;Lo;0;L;;;;;N;;;;;
+A0D3;YI SYLLABLE FA;Lo;0;L;;;;;N;;;;;
+A0D4;YI SYLLABLE FAP;Lo;0;L;;;;;N;;;;;
+A0D5;YI SYLLABLE FOX;Lo;0;L;;;;;N;;;;;
+A0D6;YI SYLLABLE FO;Lo;0;L;;;;;N;;;;;
+A0D7;YI SYLLABLE FOP;Lo;0;L;;;;;N;;;;;
+A0D8;YI SYLLABLE FUT;Lo;0;L;;;;;N;;;;;
+A0D9;YI SYLLABLE FUX;Lo;0;L;;;;;N;;;;;
+A0DA;YI SYLLABLE FU;Lo;0;L;;;;;N;;;;;
+A0DB;YI SYLLABLE FUP;Lo;0;L;;;;;N;;;;;
+A0DC;YI SYLLABLE FURX;Lo;0;L;;;;;N;;;;;
+A0DD;YI SYLLABLE FUR;Lo;0;L;;;;;N;;;;;
+A0DE;YI SYLLABLE FYT;Lo;0;L;;;;;N;;;;;
+A0DF;YI SYLLABLE FYX;Lo;0;L;;;;;N;;;;;
+A0E0;YI SYLLABLE FY;Lo;0;L;;;;;N;;;;;
+A0E1;YI SYLLABLE FYP;Lo;0;L;;;;;N;;;;;
+A0E2;YI SYLLABLE VIT;Lo;0;L;;;;;N;;;;;
+A0E3;YI SYLLABLE VIX;Lo;0;L;;;;;N;;;;;
+A0E4;YI SYLLABLE VI;Lo;0;L;;;;;N;;;;;
+A0E5;YI SYLLABLE VIP;Lo;0;L;;;;;N;;;;;
+A0E6;YI SYLLABLE VIET;Lo;0;L;;;;;N;;;;;
+A0E7;YI SYLLABLE VIEX;Lo;0;L;;;;;N;;;;;
+A0E8;YI SYLLABLE VIE;Lo;0;L;;;;;N;;;;;
+A0E9;YI SYLLABLE VIEP;Lo;0;L;;;;;N;;;;;
+A0EA;YI SYLLABLE VAT;Lo;0;L;;;;;N;;;;;
+A0EB;YI SYLLABLE VAX;Lo;0;L;;;;;N;;;;;
+A0EC;YI SYLLABLE VA;Lo;0;L;;;;;N;;;;;
+A0ED;YI SYLLABLE VAP;Lo;0;L;;;;;N;;;;;
+A0EE;YI SYLLABLE VOT;Lo;0;L;;;;;N;;;;;
+A0EF;YI SYLLABLE VOX;Lo;0;L;;;;;N;;;;;
+A0F0;YI SYLLABLE VO;Lo;0;L;;;;;N;;;;;
+A0F1;YI SYLLABLE VOP;Lo;0;L;;;;;N;;;;;
+A0F2;YI SYLLABLE VEX;Lo;0;L;;;;;N;;;;;
+A0F3;YI SYLLABLE VEP;Lo;0;L;;;;;N;;;;;
+A0F4;YI SYLLABLE VUT;Lo;0;L;;;;;N;;;;;
+A0F5;YI SYLLABLE VUX;Lo;0;L;;;;;N;;;;;
+A0F6;YI SYLLABLE VU;Lo;0;L;;;;;N;;;;;
+A0F7;YI SYLLABLE VUP;Lo;0;L;;;;;N;;;;;
+A0F8;YI SYLLABLE VURX;Lo;0;L;;;;;N;;;;;
+A0F9;YI SYLLABLE VUR;Lo;0;L;;;;;N;;;;;
+A0FA;YI SYLLABLE VYT;Lo;0;L;;;;;N;;;;;
+A0FB;YI SYLLABLE VYX;Lo;0;L;;;;;N;;;;;
+A0FC;YI SYLLABLE VY;Lo;0;L;;;;;N;;;;;
+A0FD;YI SYLLABLE VYP;Lo;0;L;;;;;N;;;;;
+A0FE;YI SYLLABLE VYRX;Lo;0;L;;;;;N;;;;;
+A0FF;YI SYLLABLE VYR;Lo;0;L;;;;;N;;;;;
+A100;YI SYLLABLE DIT;Lo;0;L;;;;;N;;;;;
+A101;YI SYLLABLE DIX;Lo;0;L;;;;;N;;;;;
+A102;YI SYLLABLE DI;Lo;0;L;;;;;N;;;;;
+A103;YI SYLLABLE DIP;Lo;0;L;;;;;N;;;;;
+A104;YI SYLLABLE DIEX;Lo;0;L;;;;;N;;;;;
+A105;YI SYLLABLE DIE;Lo;0;L;;;;;N;;;;;
+A106;YI SYLLABLE DIEP;Lo;0;L;;;;;N;;;;;
+A107;YI SYLLABLE DAT;Lo;0;L;;;;;N;;;;;
+A108;YI SYLLABLE DAX;Lo;0;L;;;;;N;;;;;
+A109;YI SYLLABLE DA;Lo;0;L;;;;;N;;;;;
+A10A;YI SYLLABLE DAP;Lo;0;L;;;;;N;;;;;
+A10B;YI SYLLABLE DUOX;Lo;0;L;;;;;N;;;;;
+A10C;YI SYLLABLE DUO;Lo;0;L;;;;;N;;;;;
+A10D;YI SYLLABLE DOT;Lo;0;L;;;;;N;;;;;
+A10E;YI SYLLABLE DOX;Lo;0;L;;;;;N;;;;;
+A10F;YI SYLLABLE DO;Lo;0;L;;;;;N;;;;;
+A110;YI SYLLABLE DOP;Lo;0;L;;;;;N;;;;;
+A111;YI SYLLABLE DEX;Lo;0;L;;;;;N;;;;;
+A112;YI SYLLABLE DE;Lo;0;L;;;;;N;;;;;
+A113;YI SYLLABLE DEP;Lo;0;L;;;;;N;;;;;
+A114;YI SYLLABLE DUT;Lo;0;L;;;;;N;;;;;
+A115;YI SYLLABLE DUX;Lo;0;L;;;;;N;;;;;
+A116;YI SYLLABLE DU;Lo;0;L;;;;;N;;;;;
+A117;YI SYLLABLE DUP;Lo;0;L;;;;;N;;;;;
+A118;YI SYLLABLE DURX;Lo;0;L;;;;;N;;;;;
+A119;YI SYLLABLE DUR;Lo;0;L;;;;;N;;;;;
+A11A;YI SYLLABLE TIT;Lo;0;L;;;;;N;;;;;
+A11B;YI SYLLABLE TIX;Lo;0;L;;;;;N;;;;;
+A11C;YI SYLLABLE TI;Lo;0;L;;;;;N;;;;;
+A11D;YI SYLLABLE TIP;Lo;0;L;;;;;N;;;;;
+A11E;YI SYLLABLE TIEX;Lo;0;L;;;;;N;;;;;
+A11F;YI SYLLABLE TIE;Lo;0;L;;;;;N;;;;;
+A120;YI SYLLABLE TIEP;Lo;0;L;;;;;N;;;;;
+A121;YI SYLLABLE TAT;Lo;0;L;;;;;N;;;;;
+A122;YI SYLLABLE TAX;Lo;0;L;;;;;N;;;;;
+A123;YI SYLLABLE TA;Lo;0;L;;;;;N;;;;;
+A124;YI SYLLABLE TAP;Lo;0;L;;;;;N;;;;;
+A125;YI SYLLABLE TUOT;Lo;0;L;;;;;N;;;;;
+A126;YI SYLLABLE TUOX;Lo;0;L;;;;;N;;;;;
+A127;YI SYLLABLE TUO;Lo;0;L;;;;;N;;;;;
+A128;YI SYLLABLE TUOP;Lo;0;L;;;;;N;;;;;
+A129;YI SYLLABLE TOT;Lo;0;L;;;;;N;;;;;
+A12A;YI SYLLABLE TOX;Lo;0;L;;;;;N;;;;;
+A12B;YI SYLLABLE TO;Lo;0;L;;;;;N;;;;;
+A12C;YI SYLLABLE TOP;Lo;0;L;;;;;N;;;;;
+A12D;YI SYLLABLE TEX;Lo;0;L;;;;;N;;;;;
+A12E;YI SYLLABLE TE;Lo;0;L;;;;;N;;;;;
+A12F;YI SYLLABLE TEP;Lo;0;L;;;;;N;;;;;
+A130;YI SYLLABLE TUT;Lo;0;L;;;;;N;;;;;
+A131;YI SYLLABLE TUX;Lo;0;L;;;;;N;;;;;
+A132;YI SYLLABLE TU;Lo;0;L;;;;;N;;;;;
+A133;YI SYLLABLE TUP;Lo;0;L;;;;;N;;;;;
+A134;YI SYLLABLE TURX;Lo;0;L;;;;;N;;;;;
+A135;YI SYLLABLE TUR;Lo;0;L;;;;;N;;;;;
+A136;YI SYLLABLE DDIT;Lo;0;L;;;;;N;;;;;
+A137;YI SYLLABLE DDIX;Lo;0;L;;;;;N;;;;;
+A138;YI SYLLABLE DDI;Lo;0;L;;;;;N;;;;;
+A139;YI SYLLABLE DDIP;Lo;0;L;;;;;N;;;;;
+A13A;YI SYLLABLE DDIEX;Lo;0;L;;;;;N;;;;;
+A13B;YI SYLLABLE DDIE;Lo;0;L;;;;;N;;;;;
+A13C;YI SYLLABLE DDIEP;Lo;0;L;;;;;N;;;;;
+A13D;YI SYLLABLE DDAT;Lo;0;L;;;;;N;;;;;
+A13E;YI SYLLABLE DDAX;Lo;0;L;;;;;N;;;;;
+A13F;YI SYLLABLE DDA;Lo;0;L;;;;;N;;;;;
+A140;YI SYLLABLE DDAP;Lo;0;L;;;;;N;;;;;
+A141;YI SYLLABLE DDUOX;Lo;0;L;;;;;N;;;;;
+A142;YI SYLLABLE DDUO;Lo;0;L;;;;;N;;;;;
+A143;YI SYLLABLE DDUOP;Lo;0;L;;;;;N;;;;;
+A144;YI SYLLABLE DDOT;Lo;0;L;;;;;N;;;;;
+A145;YI SYLLABLE DDOX;Lo;0;L;;;;;N;;;;;
+A146;YI SYLLABLE DDO;Lo;0;L;;;;;N;;;;;
+A147;YI SYLLABLE DDOP;Lo;0;L;;;;;N;;;;;
+A148;YI SYLLABLE DDEX;Lo;0;L;;;;;N;;;;;
+A149;YI SYLLABLE DDE;Lo;0;L;;;;;N;;;;;
+A14A;YI SYLLABLE DDEP;Lo;0;L;;;;;N;;;;;
+A14B;YI SYLLABLE DDUT;Lo;0;L;;;;;N;;;;;
+A14C;YI SYLLABLE DDUX;Lo;0;L;;;;;N;;;;;
+A14D;YI SYLLABLE DDU;Lo;0;L;;;;;N;;;;;
+A14E;YI SYLLABLE DDUP;Lo;0;L;;;;;N;;;;;
+A14F;YI SYLLABLE DDURX;Lo;0;L;;;;;N;;;;;
+A150;YI SYLLABLE DDUR;Lo;0;L;;;;;N;;;;;
+A151;YI SYLLABLE NDIT;Lo;0;L;;;;;N;;;;;
+A152;YI SYLLABLE NDIX;Lo;0;L;;;;;N;;;;;
+A153;YI SYLLABLE NDI;Lo;0;L;;;;;N;;;;;
+A154;YI SYLLABLE NDIP;Lo;0;L;;;;;N;;;;;
+A155;YI SYLLABLE NDIEX;Lo;0;L;;;;;N;;;;;
+A156;YI SYLLABLE NDIE;Lo;0;L;;;;;N;;;;;
+A157;YI SYLLABLE NDAT;Lo;0;L;;;;;N;;;;;
+A158;YI SYLLABLE NDAX;Lo;0;L;;;;;N;;;;;
+A159;YI SYLLABLE NDA;Lo;0;L;;;;;N;;;;;
+A15A;YI SYLLABLE NDAP;Lo;0;L;;;;;N;;;;;
+A15B;YI SYLLABLE NDOT;Lo;0;L;;;;;N;;;;;
+A15C;YI SYLLABLE NDOX;Lo;0;L;;;;;N;;;;;
+A15D;YI SYLLABLE NDO;Lo;0;L;;;;;N;;;;;
+A15E;YI SYLLABLE NDOP;Lo;0;L;;;;;N;;;;;
+A15F;YI SYLLABLE NDEX;Lo;0;L;;;;;N;;;;;
+A160;YI SYLLABLE NDE;Lo;0;L;;;;;N;;;;;
+A161;YI SYLLABLE NDEP;Lo;0;L;;;;;N;;;;;
+A162;YI SYLLABLE NDUT;Lo;0;L;;;;;N;;;;;
+A163;YI SYLLABLE NDUX;Lo;0;L;;;;;N;;;;;
+A164;YI SYLLABLE NDU;Lo;0;L;;;;;N;;;;;
+A165;YI SYLLABLE NDUP;Lo;0;L;;;;;N;;;;;
+A166;YI SYLLABLE NDURX;Lo;0;L;;;;;N;;;;;
+A167;YI SYLLABLE NDUR;Lo;0;L;;;;;N;;;;;
+A168;YI SYLLABLE HNIT;Lo;0;L;;;;;N;;;;;
+A169;YI SYLLABLE HNIX;Lo;0;L;;;;;N;;;;;
+A16A;YI SYLLABLE HNI;Lo;0;L;;;;;N;;;;;
+A16B;YI SYLLABLE HNIP;Lo;0;L;;;;;N;;;;;
+A16C;YI SYLLABLE HNIET;Lo;0;L;;;;;N;;;;;
+A16D;YI SYLLABLE HNIEX;Lo;0;L;;;;;N;;;;;
+A16E;YI SYLLABLE HNIE;Lo;0;L;;;;;N;;;;;
+A16F;YI SYLLABLE HNIEP;Lo;0;L;;;;;N;;;;;
+A170;YI SYLLABLE HNAT;Lo;0;L;;;;;N;;;;;
+A171;YI SYLLABLE HNAX;Lo;0;L;;;;;N;;;;;
+A172;YI SYLLABLE HNA;Lo;0;L;;;;;N;;;;;
+A173;YI SYLLABLE HNAP;Lo;0;L;;;;;N;;;;;
+A174;YI SYLLABLE HNUOX;Lo;0;L;;;;;N;;;;;
+A175;YI SYLLABLE HNUO;Lo;0;L;;;;;N;;;;;
+A176;YI SYLLABLE HNOT;Lo;0;L;;;;;N;;;;;
+A177;YI SYLLABLE HNOX;Lo;0;L;;;;;N;;;;;
+A178;YI SYLLABLE HNOP;Lo;0;L;;;;;N;;;;;
+A179;YI SYLLABLE HNEX;Lo;0;L;;;;;N;;;;;
+A17A;YI SYLLABLE HNE;Lo;0;L;;;;;N;;;;;
+A17B;YI SYLLABLE HNEP;Lo;0;L;;;;;N;;;;;
+A17C;YI SYLLABLE HNUT;Lo;0;L;;;;;N;;;;;
+A17D;YI SYLLABLE NIT;Lo;0;L;;;;;N;;;;;
+A17E;YI SYLLABLE NIX;Lo;0;L;;;;;N;;;;;
+A17F;YI SYLLABLE NI;Lo;0;L;;;;;N;;;;;
+A180;YI SYLLABLE NIP;Lo;0;L;;;;;N;;;;;
+A181;YI SYLLABLE NIEX;Lo;0;L;;;;;N;;;;;
+A182;YI SYLLABLE NIE;Lo;0;L;;;;;N;;;;;
+A183;YI SYLLABLE NIEP;Lo;0;L;;;;;N;;;;;
+A184;YI SYLLABLE NAX;Lo;0;L;;;;;N;;;;;
+A185;YI SYLLABLE NA;Lo;0;L;;;;;N;;;;;
+A186;YI SYLLABLE NAP;Lo;0;L;;;;;N;;;;;
+A187;YI SYLLABLE NUOX;Lo;0;L;;;;;N;;;;;
+A188;YI SYLLABLE NUO;Lo;0;L;;;;;N;;;;;
+A189;YI SYLLABLE NUOP;Lo;0;L;;;;;N;;;;;
+A18A;YI SYLLABLE NOT;Lo;0;L;;;;;N;;;;;
+A18B;YI SYLLABLE NOX;Lo;0;L;;;;;N;;;;;
+A18C;YI SYLLABLE NO;Lo;0;L;;;;;N;;;;;
+A18D;YI SYLLABLE NOP;Lo;0;L;;;;;N;;;;;
+A18E;YI SYLLABLE NEX;Lo;0;L;;;;;N;;;;;
+A18F;YI SYLLABLE NE;Lo;0;L;;;;;N;;;;;
+A190;YI SYLLABLE NEP;Lo;0;L;;;;;N;;;;;
+A191;YI SYLLABLE NUT;Lo;0;L;;;;;N;;;;;
+A192;YI SYLLABLE NUX;Lo;0;L;;;;;N;;;;;
+A193;YI SYLLABLE NU;Lo;0;L;;;;;N;;;;;
+A194;YI SYLLABLE NUP;Lo;0;L;;;;;N;;;;;
+A195;YI SYLLABLE NURX;Lo;0;L;;;;;N;;;;;
+A196;YI SYLLABLE NUR;Lo;0;L;;;;;N;;;;;
+A197;YI SYLLABLE HLIT;Lo;0;L;;;;;N;;;;;
+A198;YI SYLLABLE HLIX;Lo;0;L;;;;;N;;;;;
+A199;YI SYLLABLE HLI;Lo;0;L;;;;;N;;;;;
+A19A;YI SYLLABLE HLIP;Lo;0;L;;;;;N;;;;;
+A19B;YI SYLLABLE HLIEX;Lo;0;L;;;;;N;;;;;
+A19C;YI SYLLABLE HLIE;Lo;0;L;;;;;N;;;;;
+A19D;YI SYLLABLE HLIEP;Lo;0;L;;;;;N;;;;;
+A19E;YI SYLLABLE HLAT;Lo;0;L;;;;;N;;;;;
+A19F;YI SYLLABLE HLAX;Lo;0;L;;;;;N;;;;;
+A1A0;YI SYLLABLE HLA;Lo;0;L;;;;;N;;;;;
+A1A1;YI SYLLABLE HLAP;Lo;0;L;;;;;N;;;;;
+A1A2;YI SYLLABLE HLUOX;Lo;0;L;;;;;N;;;;;
+A1A3;YI SYLLABLE HLUO;Lo;0;L;;;;;N;;;;;
+A1A4;YI SYLLABLE HLUOP;Lo;0;L;;;;;N;;;;;
+A1A5;YI SYLLABLE HLOX;Lo;0;L;;;;;N;;;;;
+A1A6;YI SYLLABLE HLO;Lo;0;L;;;;;N;;;;;
+A1A7;YI SYLLABLE HLOP;Lo;0;L;;;;;N;;;;;
+A1A8;YI SYLLABLE HLEX;Lo;0;L;;;;;N;;;;;
+A1A9;YI SYLLABLE HLE;Lo;0;L;;;;;N;;;;;
+A1AA;YI SYLLABLE HLEP;Lo;0;L;;;;;N;;;;;
+A1AB;YI SYLLABLE HLUT;Lo;0;L;;;;;N;;;;;
+A1AC;YI SYLLABLE HLUX;Lo;0;L;;;;;N;;;;;
+A1AD;YI SYLLABLE HLU;Lo;0;L;;;;;N;;;;;
+A1AE;YI SYLLABLE HLUP;Lo;0;L;;;;;N;;;;;
+A1AF;YI SYLLABLE HLURX;Lo;0;L;;;;;N;;;;;
+A1B0;YI SYLLABLE HLUR;Lo;0;L;;;;;N;;;;;
+A1B1;YI SYLLABLE HLYT;Lo;0;L;;;;;N;;;;;
+A1B2;YI SYLLABLE HLYX;Lo;0;L;;;;;N;;;;;
+A1B3;YI SYLLABLE HLY;Lo;0;L;;;;;N;;;;;
+A1B4;YI SYLLABLE HLYP;Lo;0;L;;;;;N;;;;;
+A1B5;YI SYLLABLE HLYRX;Lo;0;L;;;;;N;;;;;
+A1B6;YI SYLLABLE HLYR;Lo;0;L;;;;;N;;;;;
+A1B7;YI SYLLABLE LIT;Lo;0;L;;;;;N;;;;;
+A1B8;YI SYLLABLE LIX;Lo;0;L;;;;;N;;;;;
+A1B9;YI SYLLABLE LI;Lo;0;L;;;;;N;;;;;
+A1BA;YI SYLLABLE LIP;Lo;0;L;;;;;N;;;;;
+A1BB;YI SYLLABLE LIET;Lo;0;L;;;;;N;;;;;
+A1BC;YI SYLLABLE LIEX;Lo;0;L;;;;;N;;;;;
+A1BD;YI SYLLABLE LIE;Lo;0;L;;;;;N;;;;;
+A1BE;YI SYLLABLE LIEP;Lo;0;L;;;;;N;;;;;
+A1BF;YI SYLLABLE LAT;Lo;0;L;;;;;N;;;;;
+A1C0;YI SYLLABLE LAX;Lo;0;L;;;;;N;;;;;
+A1C1;YI SYLLABLE LA;Lo;0;L;;;;;N;;;;;
+A1C2;YI SYLLABLE LAP;Lo;0;L;;;;;N;;;;;
+A1C3;YI SYLLABLE LUOT;Lo;0;L;;;;;N;;;;;
+A1C4;YI SYLLABLE LUOX;Lo;0;L;;;;;N;;;;;
+A1C5;YI SYLLABLE LUO;Lo;0;L;;;;;N;;;;;
+A1C6;YI SYLLABLE LUOP;Lo;0;L;;;;;N;;;;;
+A1C7;YI SYLLABLE LOT;Lo;0;L;;;;;N;;;;;
+A1C8;YI SYLLABLE LOX;Lo;0;L;;;;;N;;;;;
+A1C9;YI SYLLABLE LO;Lo;0;L;;;;;N;;;;;
+A1CA;YI SYLLABLE LOP;Lo;0;L;;;;;N;;;;;
+A1CB;YI SYLLABLE LEX;Lo;0;L;;;;;N;;;;;
+A1CC;YI SYLLABLE LE;Lo;0;L;;;;;N;;;;;
+A1CD;YI SYLLABLE LEP;Lo;0;L;;;;;N;;;;;
+A1CE;YI SYLLABLE LUT;Lo;0;L;;;;;N;;;;;
+A1CF;YI SYLLABLE LUX;Lo;0;L;;;;;N;;;;;
+A1D0;YI SYLLABLE LU;Lo;0;L;;;;;N;;;;;
+A1D1;YI SYLLABLE LUP;Lo;0;L;;;;;N;;;;;
+A1D2;YI SYLLABLE LURX;Lo;0;L;;;;;N;;;;;
+A1D3;YI SYLLABLE LUR;Lo;0;L;;;;;N;;;;;
+A1D4;YI SYLLABLE LYT;Lo;0;L;;;;;N;;;;;
+A1D5;YI SYLLABLE LYX;Lo;0;L;;;;;N;;;;;
+A1D6;YI SYLLABLE LY;Lo;0;L;;;;;N;;;;;
+A1D7;YI SYLLABLE LYP;Lo;0;L;;;;;N;;;;;
+A1D8;YI SYLLABLE LYRX;Lo;0;L;;;;;N;;;;;
+A1D9;YI SYLLABLE LYR;Lo;0;L;;;;;N;;;;;
+A1DA;YI SYLLABLE GIT;Lo;0;L;;;;;N;;;;;
+A1DB;YI SYLLABLE GIX;Lo;0;L;;;;;N;;;;;
+A1DC;YI SYLLABLE GI;Lo;0;L;;;;;N;;;;;
+A1DD;YI SYLLABLE GIP;Lo;0;L;;;;;N;;;;;
+A1DE;YI SYLLABLE GIET;Lo;0;L;;;;;N;;;;;
+A1DF;YI SYLLABLE GIEX;Lo;0;L;;;;;N;;;;;
+A1E0;YI SYLLABLE GIE;Lo;0;L;;;;;N;;;;;
+A1E1;YI SYLLABLE GIEP;Lo;0;L;;;;;N;;;;;
+A1E2;YI SYLLABLE GAT;Lo;0;L;;;;;N;;;;;
+A1E3;YI SYLLABLE GAX;Lo;0;L;;;;;N;;;;;
+A1E4;YI SYLLABLE GA;Lo;0;L;;;;;N;;;;;
+A1E5;YI SYLLABLE GAP;Lo;0;L;;;;;N;;;;;
+A1E6;YI SYLLABLE GUOT;Lo;0;L;;;;;N;;;;;
+A1E7;YI SYLLABLE GUOX;Lo;0;L;;;;;N;;;;;
+A1E8;YI SYLLABLE GUO;Lo;0;L;;;;;N;;;;;
+A1E9;YI SYLLABLE GUOP;Lo;0;L;;;;;N;;;;;
+A1EA;YI SYLLABLE GOT;Lo;0;L;;;;;N;;;;;
+A1EB;YI SYLLABLE GOX;Lo;0;L;;;;;N;;;;;
+A1EC;YI SYLLABLE GO;Lo;0;L;;;;;N;;;;;
+A1ED;YI SYLLABLE GOP;Lo;0;L;;;;;N;;;;;
+A1EE;YI SYLLABLE GET;Lo;0;L;;;;;N;;;;;
+A1EF;YI SYLLABLE GEX;Lo;0;L;;;;;N;;;;;
+A1F0;YI SYLLABLE GE;Lo;0;L;;;;;N;;;;;
+A1F1;YI SYLLABLE GEP;Lo;0;L;;;;;N;;;;;
+A1F2;YI SYLLABLE GUT;Lo;0;L;;;;;N;;;;;
+A1F3;YI SYLLABLE GUX;Lo;0;L;;;;;N;;;;;
+A1F4;YI SYLLABLE GU;Lo;0;L;;;;;N;;;;;
+A1F5;YI SYLLABLE GUP;Lo;0;L;;;;;N;;;;;
+A1F6;YI SYLLABLE GURX;Lo;0;L;;;;;N;;;;;
+A1F7;YI SYLLABLE GUR;Lo;0;L;;;;;N;;;;;
+A1F8;YI SYLLABLE KIT;Lo;0;L;;;;;N;;;;;
+A1F9;YI SYLLABLE KIX;Lo;0;L;;;;;N;;;;;
+A1FA;YI SYLLABLE KI;Lo;0;L;;;;;N;;;;;
+A1FB;YI SYLLABLE KIP;Lo;0;L;;;;;N;;;;;
+A1FC;YI SYLLABLE KIEX;Lo;0;L;;;;;N;;;;;
+A1FD;YI SYLLABLE KIE;Lo;0;L;;;;;N;;;;;
+A1FE;YI SYLLABLE KIEP;Lo;0;L;;;;;N;;;;;
+A1FF;YI SYLLABLE KAT;Lo;0;L;;;;;N;;;;;
+A200;YI SYLLABLE KAX;Lo;0;L;;;;;N;;;;;
+A201;YI SYLLABLE KA;Lo;0;L;;;;;N;;;;;
+A202;YI SYLLABLE KAP;Lo;0;L;;;;;N;;;;;
+A203;YI SYLLABLE KUOX;Lo;0;L;;;;;N;;;;;
+A204;YI SYLLABLE KUO;Lo;0;L;;;;;N;;;;;
+A205;YI SYLLABLE KUOP;Lo;0;L;;;;;N;;;;;
+A206;YI SYLLABLE KOT;Lo;0;L;;;;;N;;;;;
+A207;YI SYLLABLE KOX;Lo;0;L;;;;;N;;;;;
+A208;YI SYLLABLE KO;Lo;0;L;;;;;N;;;;;
+A209;YI SYLLABLE KOP;Lo;0;L;;;;;N;;;;;
+A20A;YI SYLLABLE KET;Lo;0;L;;;;;N;;;;;
+A20B;YI SYLLABLE KEX;Lo;0;L;;;;;N;;;;;
+A20C;YI SYLLABLE KE;Lo;0;L;;;;;N;;;;;
+A20D;YI SYLLABLE KEP;Lo;0;L;;;;;N;;;;;
+A20E;YI SYLLABLE KUT;Lo;0;L;;;;;N;;;;;
+A20F;YI SYLLABLE KUX;Lo;0;L;;;;;N;;;;;
+A210;YI SYLLABLE KU;Lo;0;L;;;;;N;;;;;
+A211;YI SYLLABLE KUP;Lo;0;L;;;;;N;;;;;
+A212;YI SYLLABLE KURX;Lo;0;L;;;;;N;;;;;
+A213;YI SYLLABLE KUR;Lo;0;L;;;;;N;;;;;
+A214;YI SYLLABLE GGIT;Lo;0;L;;;;;N;;;;;
+A215;YI SYLLABLE GGIX;Lo;0;L;;;;;N;;;;;
+A216;YI SYLLABLE GGI;Lo;0;L;;;;;N;;;;;
+A217;YI SYLLABLE GGIEX;Lo;0;L;;;;;N;;;;;
+A218;YI SYLLABLE GGIE;Lo;0;L;;;;;N;;;;;
+A219;YI SYLLABLE GGIEP;Lo;0;L;;;;;N;;;;;
+A21A;YI SYLLABLE GGAT;Lo;0;L;;;;;N;;;;;
+A21B;YI SYLLABLE GGAX;Lo;0;L;;;;;N;;;;;
+A21C;YI SYLLABLE GGA;Lo;0;L;;;;;N;;;;;
+A21D;YI SYLLABLE GGAP;Lo;0;L;;;;;N;;;;;
+A21E;YI SYLLABLE GGUOT;Lo;0;L;;;;;N;;;;;
+A21F;YI SYLLABLE GGUOX;Lo;0;L;;;;;N;;;;;
+A220;YI SYLLABLE GGUO;Lo;0;L;;;;;N;;;;;
+A221;YI SYLLABLE GGUOP;Lo;0;L;;;;;N;;;;;
+A222;YI SYLLABLE GGOT;Lo;0;L;;;;;N;;;;;
+A223;YI SYLLABLE GGOX;Lo;0;L;;;;;N;;;;;
+A224;YI SYLLABLE GGO;Lo;0;L;;;;;N;;;;;
+A225;YI SYLLABLE GGOP;Lo;0;L;;;;;N;;;;;
+A226;YI SYLLABLE GGET;Lo;0;L;;;;;N;;;;;
+A227;YI SYLLABLE GGEX;Lo;0;L;;;;;N;;;;;
+A228;YI SYLLABLE GGE;Lo;0;L;;;;;N;;;;;
+A229;YI SYLLABLE GGEP;Lo;0;L;;;;;N;;;;;
+A22A;YI SYLLABLE GGUT;Lo;0;L;;;;;N;;;;;
+A22B;YI SYLLABLE GGUX;Lo;0;L;;;;;N;;;;;
+A22C;YI SYLLABLE GGU;Lo;0;L;;;;;N;;;;;
+A22D;YI SYLLABLE GGUP;Lo;0;L;;;;;N;;;;;
+A22E;YI SYLLABLE GGURX;Lo;0;L;;;;;N;;;;;
+A22F;YI SYLLABLE GGUR;Lo;0;L;;;;;N;;;;;
+A230;YI SYLLABLE MGIEX;Lo;0;L;;;;;N;;;;;
+A231;YI SYLLABLE MGIE;Lo;0;L;;;;;N;;;;;
+A232;YI SYLLABLE MGAT;Lo;0;L;;;;;N;;;;;
+A233;YI SYLLABLE MGAX;Lo;0;L;;;;;N;;;;;
+A234;YI SYLLABLE MGA;Lo;0;L;;;;;N;;;;;
+A235;YI SYLLABLE MGAP;Lo;0;L;;;;;N;;;;;
+A236;YI SYLLABLE MGUOX;Lo;0;L;;;;;N;;;;;
+A237;YI SYLLABLE MGUO;Lo;0;L;;;;;N;;;;;
+A238;YI SYLLABLE MGUOP;Lo;0;L;;;;;N;;;;;
+A239;YI SYLLABLE MGOT;Lo;0;L;;;;;N;;;;;
+A23A;YI SYLLABLE MGOX;Lo;0;L;;;;;N;;;;;
+A23B;YI SYLLABLE MGO;Lo;0;L;;;;;N;;;;;
+A23C;YI SYLLABLE MGOP;Lo;0;L;;;;;N;;;;;
+A23D;YI SYLLABLE MGEX;Lo;0;L;;;;;N;;;;;
+A23E;YI SYLLABLE MGE;Lo;0;L;;;;;N;;;;;
+A23F;YI SYLLABLE MGEP;Lo;0;L;;;;;N;;;;;
+A240;YI SYLLABLE MGUT;Lo;0;L;;;;;N;;;;;
+A241;YI SYLLABLE MGUX;Lo;0;L;;;;;N;;;;;
+A242;YI SYLLABLE MGU;Lo;0;L;;;;;N;;;;;
+A243;YI SYLLABLE MGUP;Lo;0;L;;;;;N;;;;;
+A244;YI SYLLABLE MGURX;Lo;0;L;;;;;N;;;;;
+A245;YI SYLLABLE MGUR;Lo;0;L;;;;;N;;;;;
+A246;YI SYLLABLE HXIT;Lo;0;L;;;;;N;;;;;
+A247;YI SYLLABLE HXIX;Lo;0;L;;;;;N;;;;;
+A248;YI SYLLABLE HXI;Lo;0;L;;;;;N;;;;;
+A249;YI SYLLABLE HXIP;Lo;0;L;;;;;N;;;;;
+A24A;YI SYLLABLE HXIET;Lo;0;L;;;;;N;;;;;
+A24B;YI SYLLABLE HXIEX;Lo;0;L;;;;;N;;;;;
+A24C;YI SYLLABLE HXIE;Lo;0;L;;;;;N;;;;;
+A24D;YI SYLLABLE HXIEP;Lo;0;L;;;;;N;;;;;
+A24E;YI SYLLABLE HXAT;Lo;0;L;;;;;N;;;;;
+A24F;YI SYLLABLE HXAX;Lo;0;L;;;;;N;;;;;
+A250;YI SYLLABLE HXA;Lo;0;L;;;;;N;;;;;
+A251;YI SYLLABLE HXAP;Lo;0;L;;;;;N;;;;;
+A252;YI SYLLABLE HXUOT;Lo;0;L;;;;;N;;;;;
+A253;YI SYLLABLE HXUOX;Lo;0;L;;;;;N;;;;;
+A254;YI SYLLABLE HXUO;Lo;0;L;;;;;N;;;;;
+A255;YI SYLLABLE HXUOP;Lo;0;L;;;;;N;;;;;
+A256;YI SYLLABLE HXOT;Lo;0;L;;;;;N;;;;;
+A257;YI SYLLABLE HXOX;Lo;0;L;;;;;N;;;;;
+A258;YI SYLLABLE HXO;Lo;0;L;;;;;N;;;;;
+A259;YI SYLLABLE HXOP;Lo;0;L;;;;;N;;;;;
+A25A;YI SYLLABLE HXEX;Lo;0;L;;;;;N;;;;;
+A25B;YI SYLLABLE HXE;Lo;0;L;;;;;N;;;;;
+A25C;YI SYLLABLE HXEP;Lo;0;L;;;;;N;;;;;
+A25D;YI SYLLABLE NGIEX;Lo;0;L;;;;;N;;;;;
+A25E;YI SYLLABLE NGIE;Lo;0;L;;;;;N;;;;;
+A25F;YI SYLLABLE NGIEP;Lo;0;L;;;;;N;;;;;
+A260;YI SYLLABLE NGAT;Lo;0;L;;;;;N;;;;;
+A261;YI SYLLABLE NGAX;Lo;0;L;;;;;N;;;;;
+A262;YI SYLLABLE NGA;Lo;0;L;;;;;N;;;;;
+A263;YI SYLLABLE NGAP;Lo;0;L;;;;;N;;;;;
+A264;YI SYLLABLE NGUOT;Lo;0;L;;;;;N;;;;;
+A265;YI SYLLABLE NGUOX;Lo;0;L;;;;;N;;;;;
+A266;YI SYLLABLE NGUO;Lo;0;L;;;;;N;;;;;
+A267;YI SYLLABLE NGOT;Lo;0;L;;;;;N;;;;;
+A268;YI SYLLABLE NGOX;Lo;0;L;;;;;N;;;;;
+A269;YI SYLLABLE NGO;Lo;0;L;;;;;N;;;;;
+A26A;YI SYLLABLE NGOP;Lo;0;L;;;;;N;;;;;
+A26B;YI SYLLABLE NGEX;Lo;0;L;;;;;N;;;;;
+A26C;YI SYLLABLE NGE;Lo;0;L;;;;;N;;;;;
+A26D;YI SYLLABLE NGEP;Lo;0;L;;;;;N;;;;;
+A26E;YI SYLLABLE HIT;Lo;0;L;;;;;N;;;;;
+A26F;YI SYLLABLE HIEX;Lo;0;L;;;;;N;;;;;
+A270;YI SYLLABLE HIE;Lo;0;L;;;;;N;;;;;
+A271;YI SYLLABLE HAT;Lo;0;L;;;;;N;;;;;
+A272;YI SYLLABLE HAX;Lo;0;L;;;;;N;;;;;
+A273;YI SYLLABLE HA;Lo;0;L;;;;;N;;;;;
+A274;YI SYLLABLE HAP;Lo;0;L;;;;;N;;;;;
+A275;YI SYLLABLE HUOT;Lo;0;L;;;;;N;;;;;
+A276;YI SYLLABLE HUOX;Lo;0;L;;;;;N;;;;;
+A277;YI SYLLABLE HUO;Lo;0;L;;;;;N;;;;;
+A278;YI SYLLABLE HUOP;Lo;0;L;;;;;N;;;;;
+A279;YI SYLLABLE HOT;Lo;0;L;;;;;N;;;;;
+A27A;YI SYLLABLE HOX;Lo;0;L;;;;;N;;;;;
+A27B;YI SYLLABLE HO;Lo;0;L;;;;;N;;;;;
+A27C;YI SYLLABLE HOP;Lo;0;L;;;;;N;;;;;
+A27D;YI SYLLABLE HEX;Lo;0;L;;;;;N;;;;;
+A27E;YI SYLLABLE HE;Lo;0;L;;;;;N;;;;;
+A27F;YI SYLLABLE HEP;Lo;0;L;;;;;N;;;;;
+A280;YI SYLLABLE WAT;Lo;0;L;;;;;N;;;;;
+A281;YI SYLLABLE WAX;Lo;0;L;;;;;N;;;;;
+A282;YI SYLLABLE WA;Lo;0;L;;;;;N;;;;;
+A283;YI SYLLABLE WAP;Lo;0;L;;;;;N;;;;;
+A284;YI SYLLABLE WUOX;Lo;0;L;;;;;N;;;;;
+A285;YI SYLLABLE WUO;Lo;0;L;;;;;N;;;;;
+A286;YI SYLLABLE WUOP;Lo;0;L;;;;;N;;;;;
+A287;YI SYLLABLE WOX;Lo;0;L;;;;;N;;;;;
+A288;YI SYLLABLE WO;Lo;0;L;;;;;N;;;;;
+A289;YI SYLLABLE WOP;Lo;0;L;;;;;N;;;;;
+A28A;YI SYLLABLE WEX;Lo;0;L;;;;;N;;;;;
+A28B;YI SYLLABLE WE;Lo;0;L;;;;;N;;;;;
+A28C;YI SYLLABLE WEP;Lo;0;L;;;;;N;;;;;
+A28D;YI SYLLABLE ZIT;Lo;0;L;;;;;N;;;;;
+A28E;YI SYLLABLE ZIX;Lo;0;L;;;;;N;;;;;
+A28F;YI SYLLABLE ZI;Lo;0;L;;;;;N;;;;;
+A290;YI SYLLABLE ZIP;Lo;0;L;;;;;N;;;;;
+A291;YI SYLLABLE ZIEX;Lo;0;L;;;;;N;;;;;
+A292;YI SYLLABLE ZIE;Lo;0;L;;;;;N;;;;;
+A293;YI SYLLABLE ZIEP;Lo;0;L;;;;;N;;;;;
+A294;YI SYLLABLE ZAT;Lo;0;L;;;;;N;;;;;
+A295;YI SYLLABLE ZAX;Lo;0;L;;;;;N;;;;;
+A296;YI SYLLABLE ZA;Lo;0;L;;;;;N;;;;;
+A297;YI SYLLABLE ZAP;Lo;0;L;;;;;N;;;;;
+A298;YI SYLLABLE ZUOX;Lo;0;L;;;;;N;;;;;
+A299;YI SYLLABLE ZUO;Lo;0;L;;;;;N;;;;;
+A29A;YI SYLLABLE ZUOP;Lo;0;L;;;;;N;;;;;
+A29B;YI SYLLABLE ZOT;Lo;0;L;;;;;N;;;;;
+A29C;YI SYLLABLE ZOX;Lo;0;L;;;;;N;;;;;
+A29D;YI SYLLABLE ZO;Lo;0;L;;;;;N;;;;;
+A29E;YI SYLLABLE ZOP;Lo;0;L;;;;;N;;;;;
+A29F;YI SYLLABLE ZEX;Lo;0;L;;;;;N;;;;;
+A2A0;YI SYLLABLE ZE;Lo;0;L;;;;;N;;;;;
+A2A1;YI SYLLABLE ZEP;Lo;0;L;;;;;N;;;;;
+A2A2;YI SYLLABLE ZUT;Lo;0;L;;;;;N;;;;;
+A2A3;YI SYLLABLE ZUX;Lo;0;L;;;;;N;;;;;
+A2A4;YI SYLLABLE ZU;Lo;0;L;;;;;N;;;;;
+A2A5;YI SYLLABLE ZUP;Lo;0;L;;;;;N;;;;;
+A2A6;YI SYLLABLE ZURX;Lo;0;L;;;;;N;;;;;
+A2A7;YI SYLLABLE ZUR;Lo;0;L;;;;;N;;;;;
+A2A8;YI SYLLABLE ZYT;Lo;0;L;;;;;N;;;;;
+A2A9;YI SYLLABLE ZYX;Lo;0;L;;;;;N;;;;;
+A2AA;YI SYLLABLE ZY;Lo;0;L;;;;;N;;;;;
+A2AB;YI SYLLABLE ZYP;Lo;0;L;;;;;N;;;;;
+A2AC;YI SYLLABLE ZYRX;Lo;0;L;;;;;N;;;;;
+A2AD;YI SYLLABLE ZYR;Lo;0;L;;;;;N;;;;;
+A2AE;YI SYLLABLE CIT;Lo;0;L;;;;;N;;;;;
+A2AF;YI SYLLABLE CIX;Lo;0;L;;;;;N;;;;;
+A2B0;YI SYLLABLE CI;Lo;0;L;;;;;N;;;;;
+A2B1;YI SYLLABLE CIP;Lo;0;L;;;;;N;;;;;
+A2B2;YI SYLLABLE CIET;Lo;0;L;;;;;N;;;;;
+A2B3;YI SYLLABLE CIEX;Lo;0;L;;;;;N;;;;;
+A2B4;YI SYLLABLE CIE;Lo;0;L;;;;;N;;;;;
+A2B5;YI SYLLABLE CIEP;Lo;0;L;;;;;N;;;;;
+A2B6;YI SYLLABLE CAT;Lo;0;L;;;;;N;;;;;
+A2B7;YI SYLLABLE CAX;Lo;0;L;;;;;N;;;;;
+A2B8;YI SYLLABLE CA;Lo;0;L;;;;;N;;;;;
+A2B9;YI SYLLABLE CAP;Lo;0;L;;;;;N;;;;;
+A2BA;YI SYLLABLE CUOX;Lo;0;L;;;;;N;;;;;
+A2BB;YI SYLLABLE CUO;Lo;0;L;;;;;N;;;;;
+A2BC;YI SYLLABLE CUOP;Lo;0;L;;;;;N;;;;;
+A2BD;YI SYLLABLE COT;Lo;0;L;;;;;N;;;;;
+A2BE;YI SYLLABLE COX;Lo;0;L;;;;;N;;;;;
+A2BF;YI SYLLABLE CO;Lo;0;L;;;;;N;;;;;
+A2C0;YI SYLLABLE COP;Lo;0;L;;;;;N;;;;;
+A2C1;YI SYLLABLE CEX;Lo;0;L;;;;;N;;;;;
+A2C2;YI SYLLABLE CE;Lo;0;L;;;;;N;;;;;
+A2C3;YI SYLLABLE CEP;Lo;0;L;;;;;N;;;;;
+A2C4;YI SYLLABLE CUT;Lo;0;L;;;;;N;;;;;
+A2C5;YI SYLLABLE CUX;Lo;0;L;;;;;N;;;;;
+A2C6;YI SYLLABLE CU;Lo;0;L;;;;;N;;;;;
+A2C7;YI SYLLABLE CUP;Lo;0;L;;;;;N;;;;;
+A2C8;YI SYLLABLE CURX;Lo;0;L;;;;;N;;;;;
+A2C9;YI SYLLABLE CUR;Lo;0;L;;;;;N;;;;;
+A2CA;YI SYLLABLE CYT;Lo;0;L;;;;;N;;;;;
+A2CB;YI SYLLABLE CYX;Lo;0;L;;;;;N;;;;;
+A2CC;YI SYLLABLE CY;Lo;0;L;;;;;N;;;;;
+A2CD;YI SYLLABLE CYP;Lo;0;L;;;;;N;;;;;
+A2CE;YI SYLLABLE CYRX;Lo;0;L;;;;;N;;;;;
+A2CF;YI SYLLABLE CYR;Lo;0;L;;;;;N;;;;;
+A2D0;YI SYLLABLE ZZIT;Lo;0;L;;;;;N;;;;;
+A2D1;YI SYLLABLE ZZIX;Lo;0;L;;;;;N;;;;;
+A2D2;YI SYLLABLE ZZI;Lo;0;L;;;;;N;;;;;
+A2D3;YI SYLLABLE ZZIP;Lo;0;L;;;;;N;;;;;
+A2D4;YI SYLLABLE ZZIET;Lo;0;L;;;;;N;;;;;
+A2D5;YI SYLLABLE ZZIEX;Lo;0;L;;;;;N;;;;;
+A2D6;YI SYLLABLE ZZIE;Lo;0;L;;;;;N;;;;;
+A2D7;YI SYLLABLE ZZIEP;Lo;0;L;;;;;N;;;;;
+A2D8;YI SYLLABLE ZZAT;Lo;0;L;;;;;N;;;;;
+A2D9;YI SYLLABLE ZZAX;Lo;0;L;;;;;N;;;;;
+A2DA;YI SYLLABLE ZZA;Lo;0;L;;;;;N;;;;;
+A2DB;YI SYLLABLE ZZAP;Lo;0;L;;;;;N;;;;;
+A2DC;YI SYLLABLE ZZOX;Lo;0;L;;;;;N;;;;;
+A2DD;YI SYLLABLE ZZO;Lo;0;L;;;;;N;;;;;
+A2DE;YI SYLLABLE ZZOP;Lo;0;L;;;;;N;;;;;
+A2DF;YI SYLLABLE ZZEX;Lo;0;L;;;;;N;;;;;
+A2E0;YI SYLLABLE ZZE;Lo;0;L;;;;;N;;;;;
+A2E1;YI SYLLABLE ZZEP;Lo;0;L;;;;;N;;;;;
+A2E2;YI SYLLABLE ZZUX;Lo;0;L;;;;;N;;;;;
+A2E3;YI SYLLABLE ZZU;Lo;0;L;;;;;N;;;;;
+A2E4;YI SYLLABLE ZZUP;Lo;0;L;;;;;N;;;;;
+A2E5;YI SYLLABLE ZZURX;Lo;0;L;;;;;N;;;;;
+A2E6;YI SYLLABLE ZZUR;Lo;0;L;;;;;N;;;;;
+A2E7;YI SYLLABLE ZZYT;Lo;0;L;;;;;N;;;;;
+A2E8;YI SYLLABLE ZZYX;Lo;0;L;;;;;N;;;;;
+A2E9;YI SYLLABLE ZZY;Lo;0;L;;;;;N;;;;;
+A2EA;YI SYLLABLE ZZYP;Lo;0;L;;;;;N;;;;;
+A2EB;YI SYLLABLE ZZYRX;Lo;0;L;;;;;N;;;;;
+A2EC;YI SYLLABLE ZZYR;Lo;0;L;;;;;N;;;;;
+A2ED;YI SYLLABLE NZIT;Lo;0;L;;;;;N;;;;;
+A2EE;YI SYLLABLE NZIX;Lo;0;L;;;;;N;;;;;
+A2EF;YI SYLLABLE NZI;Lo;0;L;;;;;N;;;;;
+A2F0;YI SYLLABLE NZIP;Lo;0;L;;;;;N;;;;;
+A2F1;YI SYLLABLE NZIEX;Lo;0;L;;;;;N;;;;;
+A2F2;YI SYLLABLE NZIE;Lo;0;L;;;;;N;;;;;
+A2F3;YI SYLLABLE NZIEP;Lo;0;L;;;;;N;;;;;
+A2F4;YI SYLLABLE NZAT;Lo;0;L;;;;;N;;;;;
+A2F5;YI SYLLABLE NZAX;Lo;0;L;;;;;N;;;;;
+A2F6;YI SYLLABLE NZA;Lo;0;L;;;;;N;;;;;
+A2F7;YI SYLLABLE NZAP;Lo;0;L;;;;;N;;;;;
+A2F8;YI SYLLABLE NZUOX;Lo;0;L;;;;;N;;;;;
+A2F9;YI SYLLABLE NZUO;Lo;0;L;;;;;N;;;;;
+A2FA;YI SYLLABLE NZOX;Lo;0;L;;;;;N;;;;;
+A2FB;YI SYLLABLE NZOP;Lo;0;L;;;;;N;;;;;
+A2FC;YI SYLLABLE NZEX;Lo;0;L;;;;;N;;;;;
+A2FD;YI SYLLABLE NZE;Lo;0;L;;;;;N;;;;;
+A2FE;YI SYLLABLE NZUX;Lo;0;L;;;;;N;;;;;
+A2FF;YI SYLLABLE NZU;Lo;0;L;;;;;N;;;;;
+A300;YI SYLLABLE NZUP;Lo;0;L;;;;;N;;;;;
+A301;YI SYLLABLE NZURX;Lo;0;L;;;;;N;;;;;
+A302;YI SYLLABLE NZUR;Lo;0;L;;;;;N;;;;;
+A303;YI SYLLABLE NZYT;Lo;0;L;;;;;N;;;;;
+A304;YI SYLLABLE NZYX;Lo;0;L;;;;;N;;;;;
+A305;YI SYLLABLE NZY;Lo;0;L;;;;;N;;;;;
+A306;YI SYLLABLE NZYP;Lo;0;L;;;;;N;;;;;
+A307;YI SYLLABLE NZYRX;Lo;0;L;;;;;N;;;;;
+A308;YI SYLLABLE NZYR;Lo;0;L;;;;;N;;;;;
+A309;YI SYLLABLE SIT;Lo;0;L;;;;;N;;;;;
+A30A;YI SYLLABLE SIX;Lo;0;L;;;;;N;;;;;
+A30B;YI SYLLABLE SI;Lo;0;L;;;;;N;;;;;
+A30C;YI SYLLABLE SIP;Lo;0;L;;;;;N;;;;;
+A30D;YI SYLLABLE SIEX;Lo;0;L;;;;;N;;;;;
+A30E;YI SYLLABLE SIE;Lo;0;L;;;;;N;;;;;
+A30F;YI SYLLABLE SIEP;Lo;0;L;;;;;N;;;;;
+A310;YI SYLLABLE SAT;Lo;0;L;;;;;N;;;;;
+A311;YI SYLLABLE SAX;Lo;0;L;;;;;N;;;;;
+A312;YI SYLLABLE SA;Lo;0;L;;;;;N;;;;;
+A313;YI SYLLABLE SAP;Lo;0;L;;;;;N;;;;;
+A314;YI SYLLABLE SUOX;Lo;0;L;;;;;N;;;;;
+A315;YI SYLLABLE SUO;Lo;0;L;;;;;N;;;;;
+A316;YI SYLLABLE SUOP;Lo;0;L;;;;;N;;;;;
+A317;YI SYLLABLE SOT;Lo;0;L;;;;;N;;;;;
+A318;YI SYLLABLE SOX;Lo;0;L;;;;;N;;;;;
+A319;YI SYLLABLE SO;Lo;0;L;;;;;N;;;;;
+A31A;YI SYLLABLE SOP;Lo;0;L;;;;;N;;;;;
+A31B;YI SYLLABLE SEX;Lo;0;L;;;;;N;;;;;
+A31C;YI SYLLABLE SE;Lo;0;L;;;;;N;;;;;
+A31D;YI SYLLABLE SEP;Lo;0;L;;;;;N;;;;;
+A31E;YI SYLLABLE SUT;Lo;0;L;;;;;N;;;;;
+A31F;YI SYLLABLE SUX;Lo;0;L;;;;;N;;;;;
+A320;YI SYLLABLE SU;Lo;0;L;;;;;N;;;;;
+A321;YI SYLLABLE SUP;Lo;0;L;;;;;N;;;;;
+A322;YI SYLLABLE SURX;Lo;0;L;;;;;N;;;;;
+A323;YI SYLLABLE SUR;Lo;0;L;;;;;N;;;;;
+A324;YI SYLLABLE SYT;Lo;0;L;;;;;N;;;;;
+A325;YI SYLLABLE SYX;Lo;0;L;;;;;N;;;;;
+A326;YI SYLLABLE SY;Lo;0;L;;;;;N;;;;;
+A327;YI SYLLABLE SYP;Lo;0;L;;;;;N;;;;;
+A328;YI SYLLABLE SYRX;Lo;0;L;;;;;N;;;;;
+A329;YI SYLLABLE SYR;Lo;0;L;;;;;N;;;;;
+A32A;YI SYLLABLE SSIT;Lo;0;L;;;;;N;;;;;
+A32B;YI SYLLABLE SSIX;Lo;0;L;;;;;N;;;;;
+A32C;YI SYLLABLE SSI;Lo;0;L;;;;;N;;;;;
+A32D;YI SYLLABLE SSIP;Lo;0;L;;;;;N;;;;;
+A32E;YI SYLLABLE SSIEX;Lo;0;L;;;;;N;;;;;
+A32F;YI SYLLABLE SSIE;Lo;0;L;;;;;N;;;;;
+A330;YI SYLLABLE SSIEP;Lo;0;L;;;;;N;;;;;
+A331;YI SYLLABLE SSAT;Lo;0;L;;;;;N;;;;;
+A332;YI SYLLABLE SSAX;Lo;0;L;;;;;N;;;;;
+A333;YI SYLLABLE SSA;Lo;0;L;;;;;N;;;;;
+A334;YI SYLLABLE SSAP;Lo;0;L;;;;;N;;;;;
+A335;YI SYLLABLE SSOT;Lo;0;L;;;;;N;;;;;
+A336;YI SYLLABLE SSOX;Lo;0;L;;;;;N;;;;;
+A337;YI SYLLABLE SSO;Lo;0;L;;;;;N;;;;;
+A338;YI SYLLABLE SSOP;Lo;0;L;;;;;N;;;;;
+A339;YI SYLLABLE SSEX;Lo;0;L;;;;;N;;;;;
+A33A;YI SYLLABLE SSE;Lo;0;L;;;;;N;;;;;
+A33B;YI SYLLABLE SSEP;Lo;0;L;;;;;N;;;;;
+A33C;YI SYLLABLE SSUT;Lo;0;L;;;;;N;;;;;
+A33D;YI SYLLABLE SSUX;Lo;0;L;;;;;N;;;;;
+A33E;YI SYLLABLE SSU;Lo;0;L;;;;;N;;;;;
+A33F;YI SYLLABLE SSUP;Lo;0;L;;;;;N;;;;;
+A340;YI SYLLABLE SSYT;Lo;0;L;;;;;N;;;;;
+A341;YI SYLLABLE SSYX;Lo;0;L;;;;;N;;;;;
+A342;YI SYLLABLE SSY;Lo;0;L;;;;;N;;;;;
+A343;YI SYLLABLE SSYP;Lo;0;L;;;;;N;;;;;
+A344;YI SYLLABLE SSYRX;Lo;0;L;;;;;N;;;;;
+A345;YI SYLLABLE SSYR;Lo;0;L;;;;;N;;;;;
+A346;YI SYLLABLE ZHAT;Lo;0;L;;;;;N;;;;;
+A347;YI SYLLABLE ZHAX;Lo;0;L;;;;;N;;;;;
+A348;YI SYLLABLE ZHA;Lo;0;L;;;;;N;;;;;
+A349;YI SYLLABLE ZHAP;Lo;0;L;;;;;N;;;;;
+A34A;YI SYLLABLE ZHUOX;Lo;0;L;;;;;N;;;;;
+A34B;YI SYLLABLE ZHUO;Lo;0;L;;;;;N;;;;;
+A34C;YI SYLLABLE ZHUOP;Lo;0;L;;;;;N;;;;;
+A34D;YI SYLLABLE ZHOT;Lo;0;L;;;;;N;;;;;
+A34E;YI SYLLABLE ZHOX;Lo;0;L;;;;;N;;;;;
+A34F;YI SYLLABLE ZHO;Lo;0;L;;;;;N;;;;;
+A350;YI SYLLABLE ZHOP;Lo;0;L;;;;;N;;;;;
+A351;YI SYLLABLE ZHET;Lo;0;L;;;;;N;;;;;
+A352;YI SYLLABLE ZHEX;Lo;0;L;;;;;N;;;;;
+A353;YI SYLLABLE ZHE;Lo;0;L;;;;;N;;;;;
+A354;YI SYLLABLE ZHEP;Lo;0;L;;;;;N;;;;;
+A355;YI SYLLABLE ZHUT;Lo;0;L;;;;;N;;;;;
+A356;YI SYLLABLE ZHUX;Lo;0;L;;;;;N;;;;;
+A357;YI SYLLABLE ZHU;Lo;0;L;;;;;N;;;;;
+A358;YI SYLLABLE ZHUP;Lo;0;L;;;;;N;;;;;
+A359;YI SYLLABLE ZHURX;Lo;0;L;;;;;N;;;;;
+A35A;YI SYLLABLE ZHUR;Lo;0;L;;;;;N;;;;;
+A35B;YI SYLLABLE ZHYT;Lo;0;L;;;;;N;;;;;
+A35C;YI SYLLABLE ZHYX;Lo;0;L;;;;;N;;;;;
+A35D;YI SYLLABLE ZHY;Lo;0;L;;;;;N;;;;;
+A35E;YI SYLLABLE ZHYP;Lo;0;L;;;;;N;;;;;
+A35F;YI SYLLABLE ZHYRX;Lo;0;L;;;;;N;;;;;
+A360;YI SYLLABLE ZHYR;Lo;0;L;;;;;N;;;;;
+A361;YI SYLLABLE CHAT;Lo;0;L;;;;;N;;;;;
+A362;YI SYLLABLE CHAX;Lo;0;L;;;;;N;;;;;
+A363;YI SYLLABLE CHA;Lo;0;L;;;;;N;;;;;
+A364;YI SYLLABLE CHAP;Lo;0;L;;;;;N;;;;;
+A365;YI SYLLABLE CHUOT;Lo;0;L;;;;;N;;;;;
+A366;YI SYLLABLE CHUOX;Lo;0;L;;;;;N;;;;;
+A367;YI SYLLABLE CHUO;Lo;0;L;;;;;N;;;;;
+A368;YI SYLLABLE CHUOP;Lo;0;L;;;;;N;;;;;
+A369;YI SYLLABLE CHOT;Lo;0;L;;;;;N;;;;;
+A36A;YI SYLLABLE CHOX;Lo;0;L;;;;;N;;;;;
+A36B;YI SYLLABLE CHO;Lo;0;L;;;;;N;;;;;
+A36C;YI SYLLABLE CHOP;Lo;0;L;;;;;N;;;;;
+A36D;YI SYLLABLE CHET;Lo;0;L;;;;;N;;;;;
+A36E;YI SYLLABLE CHEX;Lo;0;L;;;;;N;;;;;
+A36F;YI SYLLABLE CHE;Lo;0;L;;;;;N;;;;;
+A370;YI SYLLABLE CHEP;Lo;0;L;;;;;N;;;;;
+A371;YI SYLLABLE CHUX;Lo;0;L;;;;;N;;;;;
+A372;YI SYLLABLE CHU;Lo;0;L;;;;;N;;;;;
+A373;YI SYLLABLE CHUP;Lo;0;L;;;;;N;;;;;
+A374;YI SYLLABLE CHURX;Lo;0;L;;;;;N;;;;;
+A375;YI SYLLABLE CHUR;Lo;0;L;;;;;N;;;;;
+A376;YI SYLLABLE CHYT;Lo;0;L;;;;;N;;;;;
+A377;YI SYLLABLE CHYX;Lo;0;L;;;;;N;;;;;
+A378;YI SYLLABLE CHY;Lo;0;L;;;;;N;;;;;
+A379;YI SYLLABLE CHYP;Lo;0;L;;;;;N;;;;;
+A37A;YI SYLLABLE CHYRX;Lo;0;L;;;;;N;;;;;
+A37B;YI SYLLABLE CHYR;Lo;0;L;;;;;N;;;;;
+A37C;YI SYLLABLE RRAX;Lo;0;L;;;;;N;;;;;
+A37D;YI SYLLABLE RRA;Lo;0;L;;;;;N;;;;;
+A37E;YI SYLLABLE RRUOX;Lo;0;L;;;;;N;;;;;
+A37F;YI SYLLABLE RRUO;Lo;0;L;;;;;N;;;;;
+A380;YI SYLLABLE RROT;Lo;0;L;;;;;N;;;;;
+A381;YI SYLLABLE RROX;Lo;0;L;;;;;N;;;;;
+A382;YI SYLLABLE RRO;Lo;0;L;;;;;N;;;;;
+A383;YI SYLLABLE RROP;Lo;0;L;;;;;N;;;;;
+A384;YI SYLLABLE RRET;Lo;0;L;;;;;N;;;;;
+A385;YI SYLLABLE RREX;Lo;0;L;;;;;N;;;;;
+A386;YI SYLLABLE RRE;Lo;0;L;;;;;N;;;;;
+A387;YI SYLLABLE RREP;Lo;0;L;;;;;N;;;;;
+A388;YI SYLLABLE RRUT;Lo;0;L;;;;;N;;;;;
+A389;YI SYLLABLE RRUX;Lo;0;L;;;;;N;;;;;
+A38A;YI SYLLABLE RRU;Lo;0;L;;;;;N;;;;;
+A38B;YI SYLLABLE RRUP;Lo;0;L;;;;;N;;;;;
+A38C;YI SYLLABLE RRURX;Lo;0;L;;;;;N;;;;;
+A38D;YI SYLLABLE RRUR;Lo;0;L;;;;;N;;;;;
+A38E;YI SYLLABLE RRYT;Lo;0;L;;;;;N;;;;;
+A38F;YI SYLLABLE RRYX;Lo;0;L;;;;;N;;;;;
+A390;YI SYLLABLE RRY;Lo;0;L;;;;;N;;;;;
+A391;YI SYLLABLE RRYP;Lo;0;L;;;;;N;;;;;
+A392;YI SYLLABLE RRYRX;Lo;0;L;;;;;N;;;;;
+A393;YI SYLLABLE RRYR;Lo;0;L;;;;;N;;;;;
+A394;YI SYLLABLE NRAT;Lo;0;L;;;;;N;;;;;
+A395;YI SYLLABLE NRAX;Lo;0;L;;;;;N;;;;;
+A396;YI SYLLABLE NRA;Lo;0;L;;;;;N;;;;;
+A397;YI SYLLABLE NRAP;Lo;0;L;;;;;N;;;;;
+A398;YI SYLLABLE NROX;Lo;0;L;;;;;N;;;;;
+A399;YI SYLLABLE NRO;Lo;0;L;;;;;N;;;;;
+A39A;YI SYLLABLE NROP;Lo;0;L;;;;;N;;;;;
+A39B;YI SYLLABLE NRET;Lo;0;L;;;;;N;;;;;
+A39C;YI SYLLABLE NREX;Lo;0;L;;;;;N;;;;;
+A39D;YI SYLLABLE NRE;Lo;0;L;;;;;N;;;;;
+A39E;YI SYLLABLE NREP;Lo;0;L;;;;;N;;;;;
+A39F;YI SYLLABLE NRUT;Lo;0;L;;;;;N;;;;;
+A3A0;YI SYLLABLE NRUX;Lo;0;L;;;;;N;;;;;
+A3A1;YI SYLLABLE NRU;Lo;0;L;;;;;N;;;;;
+A3A2;YI SYLLABLE NRUP;Lo;0;L;;;;;N;;;;;
+A3A3;YI SYLLABLE NRURX;Lo;0;L;;;;;N;;;;;
+A3A4;YI SYLLABLE NRUR;Lo;0;L;;;;;N;;;;;
+A3A5;YI SYLLABLE NRYT;Lo;0;L;;;;;N;;;;;
+A3A6;YI SYLLABLE NRYX;Lo;0;L;;;;;N;;;;;
+A3A7;YI SYLLABLE NRY;Lo;0;L;;;;;N;;;;;
+A3A8;YI SYLLABLE NRYP;Lo;0;L;;;;;N;;;;;
+A3A9;YI SYLLABLE NRYRX;Lo;0;L;;;;;N;;;;;
+A3AA;YI SYLLABLE NRYR;Lo;0;L;;;;;N;;;;;
+A3AB;YI SYLLABLE SHAT;Lo;0;L;;;;;N;;;;;
+A3AC;YI SYLLABLE SHAX;Lo;0;L;;;;;N;;;;;
+A3AD;YI SYLLABLE SHA;Lo;0;L;;;;;N;;;;;
+A3AE;YI SYLLABLE SHAP;Lo;0;L;;;;;N;;;;;
+A3AF;YI SYLLABLE SHUOX;Lo;0;L;;;;;N;;;;;
+A3B0;YI SYLLABLE SHUO;Lo;0;L;;;;;N;;;;;
+A3B1;YI SYLLABLE SHUOP;Lo;0;L;;;;;N;;;;;
+A3B2;YI SYLLABLE SHOT;Lo;0;L;;;;;N;;;;;
+A3B3;YI SYLLABLE SHOX;Lo;0;L;;;;;N;;;;;
+A3B4;YI SYLLABLE SHO;Lo;0;L;;;;;N;;;;;
+A3B5;YI SYLLABLE SHOP;Lo;0;L;;;;;N;;;;;
+A3B6;YI SYLLABLE SHET;Lo;0;L;;;;;N;;;;;
+A3B7;YI SYLLABLE SHEX;Lo;0;L;;;;;N;;;;;
+A3B8;YI SYLLABLE SHE;Lo;0;L;;;;;N;;;;;
+A3B9;YI SYLLABLE SHEP;Lo;0;L;;;;;N;;;;;
+A3BA;YI SYLLABLE SHUT;Lo;0;L;;;;;N;;;;;
+A3BB;YI SYLLABLE SHUX;Lo;0;L;;;;;N;;;;;
+A3BC;YI SYLLABLE SHU;Lo;0;L;;;;;N;;;;;
+A3BD;YI SYLLABLE SHUP;Lo;0;L;;;;;N;;;;;
+A3BE;YI SYLLABLE SHURX;Lo;0;L;;;;;N;;;;;
+A3BF;YI SYLLABLE SHUR;Lo;0;L;;;;;N;;;;;
+A3C0;YI SYLLABLE SHYT;Lo;0;L;;;;;N;;;;;
+A3C1;YI SYLLABLE SHYX;Lo;0;L;;;;;N;;;;;
+A3C2;YI SYLLABLE SHY;Lo;0;L;;;;;N;;;;;
+A3C3;YI SYLLABLE SHYP;Lo;0;L;;;;;N;;;;;
+A3C4;YI SYLLABLE SHYRX;Lo;0;L;;;;;N;;;;;
+A3C5;YI SYLLABLE SHYR;Lo;0;L;;;;;N;;;;;
+A3C6;YI SYLLABLE RAT;Lo;0;L;;;;;N;;;;;
+A3C7;YI SYLLABLE RAX;Lo;0;L;;;;;N;;;;;
+A3C8;YI SYLLABLE RA;Lo;0;L;;;;;N;;;;;
+A3C9;YI SYLLABLE RAP;Lo;0;L;;;;;N;;;;;
+A3CA;YI SYLLABLE RUOX;Lo;0;L;;;;;N;;;;;
+A3CB;YI SYLLABLE RUO;Lo;0;L;;;;;N;;;;;
+A3CC;YI SYLLABLE RUOP;Lo;0;L;;;;;N;;;;;
+A3CD;YI SYLLABLE ROT;Lo;0;L;;;;;N;;;;;
+A3CE;YI SYLLABLE ROX;Lo;0;L;;;;;N;;;;;
+A3CF;YI SYLLABLE RO;Lo;0;L;;;;;N;;;;;
+A3D0;YI SYLLABLE ROP;Lo;0;L;;;;;N;;;;;
+A3D1;YI SYLLABLE REX;Lo;0;L;;;;;N;;;;;
+A3D2;YI SYLLABLE RE;Lo;0;L;;;;;N;;;;;
+A3D3;YI SYLLABLE REP;Lo;0;L;;;;;N;;;;;
+A3D4;YI SYLLABLE RUT;Lo;0;L;;;;;N;;;;;
+A3D5;YI SYLLABLE RUX;Lo;0;L;;;;;N;;;;;
+A3D6;YI SYLLABLE RU;Lo;0;L;;;;;N;;;;;
+A3D7;YI SYLLABLE RUP;Lo;0;L;;;;;N;;;;;
+A3D8;YI SYLLABLE RURX;Lo;0;L;;;;;N;;;;;
+A3D9;YI SYLLABLE RUR;Lo;0;L;;;;;N;;;;;
+A3DA;YI SYLLABLE RYT;Lo;0;L;;;;;N;;;;;
+A3DB;YI SYLLABLE RYX;Lo;0;L;;;;;N;;;;;
+A3DC;YI SYLLABLE RY;Lo;0;L;;;;;N;;;;;
+A3DD;YI SYLLABLE RYP;Lo;0;L;;;;;N;;;;;
+A3DE;YI SYLLABLE RYRX;Lo;0;L;;;;;N;;;;;
+A3DF;YI SYLLABLE RYR;Lo;0;L;;;;;N;;;;;
+A3E0;YI SYLLABLE JIT;Lo;0;L;;;;;N;;;;;
+A3E1;YI SYLLABLE JIX;Lo;0;L;;;;;N;;;;;
+A3E2;YI SYLLABLE JI;Lo;0;L;;;;;N;;;;;
+A3E3;YI SYLLABLE JIP;Lo;0;L;;;;;N;;;;;
+A3E4;YI SYLLABLE JIET;Lo;0;L;;;;;N;;;;;
+A3E5;YI SYLLABLE JIEX;Lo;0;L;;;;;N;;;;;
+A3E6;YI SYLLABLE JIE;Lo;0;L;;;;;N;;;;;
+A3E7;YI SYLLABLE JIEP;Lo;0;L;;;;;N;;;;;
+A3E8;YI SYLLABLE JUOT;Lo;0;L;;;;;N;;;;;
+A3E9;YI SYLLABLE JUOX;Lo;0;L;;;;;N;;;;;
+A3EA;YI SYLLABLE JUO;Lo;0;L;;;;;N;;;;;
+A3EB;YI SYLLABLE JUOP;Lo;0;L;;;;;N;;;;;
+A3EC;YI SYLLABLE JOT;Lo;0;L;;;;;N;;;;;
+A3ED;YI SYLLABLE JOX;Lo;0;L;;;;;N;;;;;
+A3EE;YI SYLLABLE JO;Lo;0;L;;;;;N;;;;;
+A3EF;YI SYLLABLE JOP;Lo;0;L;;;;;N;;;;;
+A3F0;YI SYLLABLE JUT;Lo;0;L;;;;;N;;;;;
+A3F1;YI SYLLABLE JUX;Lo;0;L;;;;;N;;;;;
+A3F2;YI SYLLABLE JU;Lo;0;L;;;;;N;;;;;
+A3F3;YI SYLLABLE JUP;Lo;0;L;;;;;N;;;;;
+A3F4;YI SYLLABLE JURX;Lo;0;L;;;;;N;;;;;
+A3F5;YI SYLLABLE JUR;Lo;0;L;;;;;N;;;;;
+A3F6;YI SYLLABLE JYT;Lo;0;L;;;;;N;;;;;
+A3F7;YI SYLLABLE JYX;Lo;0;L;;;;;N;;;;;
+A3F8;YI SYLLABLE JY;Lo;0;L;;;;;N;;;;;
+A3F9;YI SYLLABLE JYP;Lo;0;L;;;;;N;;;;;
+A3FA;YI SYLLABLE JYRX;Lo;0;L;;;;;N;;;;;
+A3FB;YI SYLLABLE JYR;Lo;0;L;;;;;N;;;;;
+A3FC;YI SYLLABLE QIT;Lo;0;L;;;;;N;;;;;
+A3FD;YI SYLLABLE QIX;Lo;0;L;;;;;N;;;;;
+A3FE;YI SYLLABLE QI;Lo;0;L;;;;;N;;;;;
+A3FF;YI SYLLABLE QIP;Lo;0;L;;;;;N;;;;;
+A400;YI SYLLABLE QIET;Lo;0;L;;;;;N;;;;;
+A401;YI SYLLABLE QIEX;Lo;0;L;;;;;N;;;;;
+A402;YI SYLLABLE QIE;Lo;0;L;;;;;N;;;;;
+A403;YI SYLLABLE QIEP;Lo;0;L;;;;;N;;;;;
+A404;YI SYLLABLE QUOT;Lo;0;L;;;;;N;;;;;
+A405;YI SYLLABLE QUOX;Lo;0;L;;;;;N;;;;;
+A406;YI SYLLABLE QUO;Lo;0;L;;;;;N;;;;;
+A407;YI SYLLABLE QUOP;Lo;0;L;;;;;N;;;;;
+A408;YI SYLLABLE QOT;Lo;0;L;;;;;N;;;;;
+A409;YI SYLLABLE QOX;Lo;0;L;;;;;N;;;;;
+A40A;YI SYLLABLE QO;Lo;0;L;;;;;N;;;;;
+A40B;YI SYLLABLE QOP;Lo;0;L;;;;;N;;;;;
+A40C;YI SYLLABLE QUT;Lo;0;L;;;;;N;;;;;
+A40D;YI SYLLABLE QUX;Lo;0;L;;;;;N;;;;;
+A40E;YI SYLLABLE QU;Lo;0;L;;;;;N;;;;;
+A40F;YI SYLLABLE QUP;Lo;0;L;;;;;N;;;;;
+A410;YI SYLLABLE QURX;Lo;0;L;;;;;N;;;;;
+A411;YI SYLLABLE QUR;Lo;0;L;;;;;N;;;;;
+A412;YI SYLLABLE QYT;Lo;0;L;;;;;N;;;;;
+A413;YI SYLLABLE QYX;Lo;0;L;;;;;N;;;;;
+A414;YI SYLLABLE QY;Lo;0;L;;;;;N;;;;;
+A415;YI SYLLABLE QYP;Lo;0;L;;;;;N;;;;;
+A416;YI SYLLABLE QYRX;Lo;0;L;;;;;N;;;;;
+A417;YI SYLLABLE QYR;Lo;0;L;;;;;N;;;;;
+A418;YI SYLLABLE JJIT;Lo;0;L;;;;;N;;;;;
+A419;YI SYLLABLE JJIX;Lo;0;L;;;;;N;;;;;
+A41A;YI SYLLABLE JJI;Lo;0;L;;;;;N;;;;;
+A41B;YI SYLLABLE JJIP;Lo;0;L;;;;;N;;;;;
+A41C;YI SYLLABLE JJIET;Lo;0;L;;;;;N;;;;;
+A41D;YI SYLLABLE JJIEX;Lo;0;L;;;;;N;;;;;
+A41E;YI SYLLABLE JJIE;Lo;0;L;;;;;N;;;;;
+A41F;YI SYLLABLE JJIEP;Lo;0;L;;;;;N;;;;;
+A420;YI SYLLABLE JJUOX;Lo;0;L;;;;;N;;;;;
+A421;YI SYLLABLE JJUO;Lo;0;L;;;;;N;;;;;
+A422;YI SYLLABLE JJUOP;Lo;0;L;;;;;N;;;;;
+A423;YI SYLLABLE JJOT;Lo;0;L;;;;;N;;;;;
+A424;YI SYLLABLE JJOX;Lo;0;L;;;;;N;;;;;
+A425;YI SYLLABLE JJO;Lo;0;L;;;;;N;;;;;
+A426;YI SYLLABLE JJOP;Lo;0;L;;;;;N;;;;;
+A427;YI SYLLABLE JJUT;Lo;0;L;;;;;N;;;;;
+A428;YI SYLLABLE JJUX;Lo;0;L;;;;;N;;;;;
+A429;YI SYLLABLE JJU;Lo;0;L;;;;;N;;;;;
+A42A;YI SYLLABLE JJUP;Lo;0;L;;;;;N;;;;;
+A42B;YI SYLLABLE JJURX;Lo;0;L;;;;;N;;;;;
+A42C;YI SYLLABLE JJUR;Lo;0;L;;;;;N;;;;;
+A42D;YI SYLLABLE JJYT;Lo;0;L;;;;;N;;;;;
+A42E;YI SYLLABLE JJYX;Lo;0;L;;;;;N;;;;;
+A42F;YI SYLLABLE JJY;Lo;0;L;;;;;N;;;;;
+A430;YI SYLLABLE JJYP;Lo;0;L;;;;;N;;;;;
+A431;YI SYLLABLE NJIT;Lo;0;L;;;;;N;;;;;
+A432;YI SYLLABLE NJIX;Lo;0;L;;;;;N;;;;;
+A433;YI SYLLABLE NJI;Lo;0;L;;;;;N;;;;;
+A434;YI SYLLABLE NJIP;Lo;0;L;;;;;N;;;;;
+A435;YI SYLLABLE NJIET;Lo;0;L;;;;;N;;;;;
+A436;YI SYLLABLE NJIEX;Lo;0;L;;;;;N;;;;;
+A437;YI SYLLABLE NJIE;Lo;0;L;;;;;N;;;;;
+A438;YI SYLLABLE NJIEP;Lo;0;L;;;;;N;;;;;
+A439;YI SYLLABLE NJUOX;Lo;0;L;;;;;N;;;;;
+A43A;YI SYLLABLE NJUO;Lo;0;L;;;;;N;;;;;
+A43B;YI SYLLABLE NJOT;Lo;0;L;;;;;N;;;;;
+A43C;YI SYLLABLE NJOX;Lo;0;L;;;;;N;;;;;
+A43D;YI SYLLABLE NJO;Lo;0;L;;;;;N;;;;;
+A43E;YI SYLLABLE NJOP;Lo;0;L;;;;;N;;;;;
+A43F;YI SYLLABLE NJUX;Lo;0;L;;;;;N;;;;;
+A440;YI SYLLABLE NJU;Lo;0;L;;;;;N;;;;;
+A441;YI SYLLABLE NJUP;Lo;0;L;;;;;N;;;;;
+A442;YI SYLLABLE NJURX;Lo;0;L;;;;;N;;;;;
+A443;YI SYLLABLE NJUR;Lo;0;L;;;;;N;;;;;
+A444;YI SYLLABLE NJYT;Lo;0;L;;;;;N;;;;;
+A445;YI SYLLABLE NJYX;Lo;0;L;;;;;N;;;;;
+A446;YI SYLLABLE NJY;Lo;0;L;;;;;N;;;;;
+A447;YI SYLLABLE NJYP;Lo;0;L;;;;;N;;;;;
+A448;YI SYLLABLE NJYRX;Lo;0;L;;;;;N;;;;;
+A449;YI SYLLABLE NJYR;Lo;0;L;;;;;N;;;;;
+A44A;YI SYLLABLE NYIT;Lo;0;L;;;;;N;;;;;
+A44B;YI SYLLABLE NYIX;Lo;0;L;;;;;N;;;;;
+A44C;YI SYLLABLE NYI;Lo;0;L;;;;;N;;;;;
+A44D;YI SYLLABLE NYIP;Lo;0;L;;;;;N;;;;;
+A44E;YI SYLLABLE NYIET;Lo;0;L;;;;;N;;;;;
+A44F;YI SYLLABLE NYIEX;Lo;0;L;;;;;N;;;;;
+A450;YI SYLLABLE NYIE;Lo;0;L;;;;;N;;;;;
+A451;YI SYLLABLE NYIEP;Lo;0;L;;;;;N;;;;;
+A452;YI SYLLABLE NYUOX;Lo;0;L;;;;;N;;;;;
+A453;YI SYLLABLE NYUO;Lo;0;L;;;;;N;;;;;
+A454;YI SYLLABLE NYUOP;Lo;0;L;;;;;N;;;;;
+A455;YI SYLLABLE NYOT;Lo;0;L;;;;;N;;;;;
+A456;YI SYLLABLE NYOX;Lo;0;L;;;;;N;;;;;
+A457;YI SYLLABLE NYO;Lo;0;L;;;;;N;;;;;
+A458;YI SYLLABLE NYOP;Lo;0;L;;;;;N;;;;;
+A459;YI SYLLABLE NYUT;Lo;0;L;;;;;N;;;;;
+A45A;YI SYLLABLE NYUX;Lo;0;L;;;;;N;;;;;
+A45B;YI SYLLABLE NYU;Lo;0;L;;;;;N;;;;;
+A45C;YI SYLLABLE NYUP;Lo;0;L;;;;;N;;;;;
+A45D;YI SYLLABLE XIT;Lo;0;L;;;;;N;;;;;
+A45E;YI SYLLABLE XIX;Lo;0;L;;;;;N;;;;;
+A45F;YI SYLLABLE XI;Lo;0;L;;;;;N;;;;;
+A460;YI SYLLABLE XIP;Lo;0;L;;;;;N;;;;;
+A461;YI SYLLABLE XIET;Lo;0;L;;;;;N;;;;;
+A462;YI SYLLABLE XIEX;Lo;0;L;;;;;N;;;;;
+A463;YI SYLLABLE XIE;Lo;0;L;;;;;N;;;;;
+A464;YI SYLLABLE XIEP;Lo;0;L;;;;;N;;;;;
+A465;YI SYLLABLE XUOX;Lo;0;L;;;;;N;;;;;
+A466;YI SYLLABLE XUO;Lo;0;L;;;;;N;;;;;
+A467;YI SYLLABLE XOT;Lo;0;L;;;;;N;;;;;
+A468;YI SYLLABLE XOX;Lo;0;L;;;;;N;;;;;
+A469;YI SYLLABLE XO;Lo;0;L;;;;;N;;;;;
+A46A;YI SYLLABLE XOP;Lo;0;L;;;;;N;;;;;
+A46B;YI SYLLABLE XYT;Lo;0;L;;;;;N;;;;;
+A46C;YI SYLLABLE XYX;Lo;0;L;;;;;N;;;;;
+A46D;YI SYLLABLE XY;Lo;0;L;;;;;N;;;;;
+A46E;YI SYLLABLE XYP;Lo;0;L;;;;;N;;;;;
+A46F;YI SYLLABLE XYRX;Lo;0;L;;;;;N;;;;;
+A470;YI SYLLABLE XYR;Lo;0;L;;;;;N;;;;;
+A471;YI SYLLABLE YIT;Lo;0;L;;;;;N;;;;;
+A472;YI SYLLABLE YIX;Lo;0;L;;;;;N;;;;;
+A473;YI SYLLABLE YI;Lo;0;L;;;;;N;;;;;
+A474;YI SYLLABLE YIP;Lo;0;L;;;;;N;;;;;
+A475;YI SYLLABLE YIET;Lo;0;L;;;;;N;;;;;
+A476;YI SYLLABLE YIEX;Lo;0;L;;;;;N;;;;;
+A477;YI SYLLABLE YIE;Lo;0;L;;;;;N;;;;;
+A478;YI SYLLABLE YIEP;Lo;0;L;;;;;N;;;;;
+A479;YI SYLLABLE YUOT;Lo;0;L;;;;;N;;;;;
+A47A;YI SYLLABLE YUOX;Lo;0;L;;;;;N;;;;;
+A47B;YI SYLLABLE YUO;Lo;0;L;;;;;N;;;;;
+A47C;YI SYLLABLE YUOP;Lo;0;L;;;;;N;;;;;
+A47D;YI SYLLABLE YOT;Lo;0;L;;;;;N;;;;;
+A47E;YI SYLLABLE YOX;Lo;0;L;;;;;N;;;;;
+A47F;YI SYLLABLE YO;Lo;0;L;;;;;N;;;;;
+A480;YI SYLLABLE YOP;Lo;0;L;;;;;N;;;;;
+A481;YI SYLLABLE YUT;Lo;0;L;;;;;N;;;;;
+A482;YI SYLLABLE YUX;Lo;0;L;;;;;N;;;;;
+A483;YI SYLLABLE YU;Lo;0;L;;;;;N;;;;;
+A484;YI SYLLABLE YUP;Lo;0;L;;;;;N;;;;;
+A485;YI SYLLABLE YURX;Lo;0;L;;;;;N;;;;;
+A486;YI SYLLABLE YUR;Lo;0;L;;;;;N;;;;;
+A487;YI SYLLABLE YYT;Lo;0;L;;;;;N;;;;;
+A488;YI SYLLABLE YYX;Lo;0;L;;;;;N;;;;;
+A489;YI SYLLABLE YY;Lo;0;L;;;;;N;;;;;
+A48A;YI SYLLABLE YYP;Lo;0;L;;;;;N;;;;;
+A48B;YI SYLLABLE YYRX;Lo;0;L;;;;;N;;;;;
+A48C;YI SYLLABLE YYR;Lo;0;L;;;;;N;;;;;
+A490;YI RADICAL QOT;So;0;ON;;;;;N;;;;;
+A491;YI RADICAL LI;So;0;ON;;;;;N;;;;;
+A492;YI RADICAL KIT;So;0;ON;;;;;N;;;;;
+A493;YI RADICAL NYIP;So;0;ON;;;;;N;;;;;
+A494;YI RADICAL CYP;So;0;ON;;;;;N;;;;;
+A495;YI RADICAL SSI;So;0;ON;;;;;N;;;;;
+A496;YI RADICAL GGOP;So;0;ON;;;;;N;;;;;
+A497;YI RADICAL GEP;So;0;ON;;;;;N;;;;;
+A498;YI RADICAL MI;So;0;ON;;;;;N;;;;;
+A499;YI RADICAL HXIT;So;0;ON;;;;;N;;;;;
+A49A;YI RADICAL LYR;So;0;ON;;;;;N;;;;;
+A49B;YI RADICAL BBUT;So;0;ON;;;;;N;;;;;
+A49C;YI RADICAL MOP;So;0;ON;;;;;N;;;;;
+A49D;YI RADICAL YO;So;0;ON;;;;;N;;;;;
+A49E;YI RADICAL PUT;So;0;ON;;;;;N;;;;;
+A49F;YI RADICAL HXUO;So;0;ON;;;;;N;;;;;
+A4A0;YI RADICAL TAT;So;0;ON;;;;;N;;;;;
+A4A1;YI RADICAL GA;So;0;ON;;;;;N;;;;;
+A4A2;YI RADICAL ZUP;So;0;ON;;;;;N;;;;;
+A4A3;YI RADICAL CYT;So;0;ON;;;;;N;;;;;
+A4A4;YI RADICAL DDUR;So;0;ON;;;;;N;;;;;
+A4A5;YI RADICAL BUR;So;0;ON;;;;;N;;;;;
+A4A6;YI RADICAL GGUO;So;0;ON;;;;;N;;;;;
+A4A7;YI RADICAL NYOP;So;0;ON;;;;;N;;;;;
+A4A8;YI RADICAL TU;So;0;ON;;;;;N;;;;;
+A4A9;YI RADICAL OP;So;0;ON;;;;;N;;;;;
+A4AA;YI RADICAL JJUT;So;0;ON;;;;;N;;;;;
+A4AB;YI RADICAL ZOT;So;0;ON;;;;;N;;;;;
+A4AC;YI RADICAL PYT;So;0;ON;;;;;N;;;;;
+A4AD;YI RADICAL HMO;So;0;ON;;;;;N;;;;;
+A4AE;YI RADICAL YIT;So;0;ON;;;;;N;;;;;
+A4AF;YI RADICAL VUR;So;0;ON;;;;;N;;;;;
+A4B0;YI RADICAL SHY;So;0;ON;;;;;N;;;;;
+A4B1;YI RADICAL VEP;So;0;ON;;;;;N;;;;;
+A4B2;YI RADICAL ZA;So;0;ON;;;;;N;;;;;
+A4B3;YI RADICAL JO;So;0;ON;;;;;N;;;;;
+A4B4;YI RADICAL NZUP;So;0;ON;;;;;N;;;;;
+A4B5;YI RADICAL JJY;So;0;ON;;;;;N;;;;;
+A4B6;YI RADICAL GOT;So;0;ON;;;;;N;;;;;
+A4B7;YI RADICAL JJIE;So;0;ON;;;;;N;;;;;
+A4B8;YI RADICAL WO;So;0;ON;;;;;N;;;;;
+A4B9;YI RADICAL DU;So;0;ON;;;;;N;;;;;
+A4BA;YI RADICAL SHUR;So;0;ON;;;;;N;;;;;
+A4BB;YI RADICAL LIE;So;0;ON;;;;;N;;;;;
+A4BC;YI RADICAL CY;So;0;ON;;;;;N;;;;;
+A4BD;YI RADICAL CUOP;So;0;ON;;;;;N;;;;;
+A4BE;YI RADICAL CIP;So;0;ON;;;;;N;;;;;
+A4BF;YI RADICAL HXOP;So;0;ON;;;;;N;;;;;
+A4C0;YI RADICAL SHAT;So;0;ON;;;;;N;;;;;
+A4C1;YI RADICAL ZUR;So;0;ON;;;;;N;;;;;
+A4C2;YI RADICAL SHOP;So;0;ON;;;;;N;;;;;
+A4C3;YI RADICAL CHE;So;0;ON;;;;;N;;;;;
+A4C4;YI RADICAL ZZIET;So;0;ON;;;;;N;;;;;
+A4C5;YI RADICAL NBIE;So;0;ON;;;;;N;;;;;
+A4C6;YI RADICAL KE;So;0;ON;;;;;N;;;;;
+A700;MODIFIER LETTER CHINESE TONE YIN PING;Sk;0;ON;;;;;N;;;;;
+A701;MODIFIER LETTER CHINESE TONE YANG PING;Sk;0;ON;;;;;N;;;;;
+A702;MODIFIER LETTER CHINESE TONE YIN SHANG;Sk;0;ON;;;;;N;;;;;
+A703;MODIFIER LETTER CHINESE TONE YANG SHANG;Sk;0;ON;;;;;N;;;;;
+A704;MODIFIER LETTER CHINESE TONE YIN QU;Sk;0;ON;;;;;N;;;;;
+A705;MODIFIER LETTER CHINESE TONE YANG QU;Sk;0;ON;;;;;N;;;;;
+A706;MODIFIER LETTER CHINESE TONE YIN RU;Sk;0;ON;;;;;N;;;;;
+A707;MODIFIER LETTER CHINESE TONE YANG RU;Sk;0;ON;;;;;N;;;;;
+A708;MODIFIER LETTER EXTRA-HIGH DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;;
+A709;MODIFIER LETTER HIGH DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;;
+A70A;MODIFIER LETTER MID DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;;
+A70B;MODIFIER LETTER LOW DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;;
+A70C;MODIFIER LETTER EXTRA-LOW DOTTED TONE BAR;Sk;0;ON;;;;;N;;;;;
+A70D;MODIFIER LETTER EXTRA-HIGH DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A70E;MODIFIER LETTER HIGH DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A70F;MODIFIER LETTER MID DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A710;MODIFIER LETTER LOW DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A711;MODIFIER LETTER EXTRA-LOW DOTTED LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A712;MODIFIER LETTER EXTRA-HIGH LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A713;MODIFIER LETTER HIGH LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A714;MODIFIER LETTER MID LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A715;MODIFIER LETTER LOW LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A716;MODIFIER LETTER EXTRA-LOW LEFT-STEM TONE BAR;Sk;0;ON;;;;;N;;;;;
+A717;MODIFIER LETTER DOT VERTICAL BAR;Lm;0;ON;;;;;N;;;;;
+A718;MODIFIER LETTER DOT SLASH;Lm;0;ON;;;;;N;;;;;
+A719;MODIFIER LETTER DOT HORIZONTAL BAR;Lm;0;ON;;;;;N;;;;;
+A71A;MODIFIER LETTER LOWER RIGHT CORNER ANGLE;Lm;0;ON;;;;;N;;;;;
+A720;MODIFIER LETTER STRESS AND HIGH TONE;Sk;0;ON;;;;;N;;;;;
+A721;MODIFIER LETTER STRESS AND LOW TONE;Sk;0;ON;;;;;N;;;;;
+A800;SYLOTI NAGRI LETTER A;Lo;0;L;;;;;N;;;;;
+A801;SYLOTI NAGRI LETTER I;Lo;0;L;;;;;N;;;;;
+A802;SYLOTI NAGRI SIGN DVISVARA;Mc;0;NSM;;;;;N;;;;;
+A803;SYLOTI NAGRI LETTER U;Lo;0;L;;;;;N;;;;;
+A804;SYLOTI NAGRI LETTER E;Lo;0;L;;;;;N;;;;;
+A805;SYLOTI NAGRI LETTER O;Lo;0;L;;;;;N;;;;;
+A806;SYLOTI NAGRI SIGN HASANTA;Mn;9;NSM;;;;;N;;;;;
+A807;SYLOTI NAGRI LETTER KO;Lo;0;L;;;;;N;;;;;
+A808;SYLOTI NAGRI LETTER KHO;Lo;0;L;;;;;N;;;;;
+A809;SYLOTI NAGRI LETTER GO;Lo;0;L;;;;;N;;;;;
+A80A;SYLOTI NAGRI LETTER GHO;Lo;0;L;;;;;N;;;;;
+A80B;SYLOTI NAGRI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+A80C;SYLOTI NAGRI LETTER CO;Lo;0;L;;;;;N;;;;;
+A80D;SYLOTI NAGRI LETTER CHO;Lo;0;L;;;;;N;;;;;
+A80E;SYLOTI NAGRI LETTER JO;Lo;0;L;;;;;N;;;;;
+A80F;SYLOTI NAGRI LETTER JHO;Lo;0;L;;;;;N;;;;;
+A810;SYLOTI NAGRI LETTER TTO;Lo;0;L;;;;;N;;;;;
+A811;SYLOTI NAGRI LETTER TTHO;Lo;0;L;;;;;N;;;;;
+A812;SYLOTI NAGRI LETTER DDO;Lo;0;L;;;;;N;;;;;
+A813;SYLOTI NAGRI LETTER DDHO;Lo;0;L;;;;;N;;;;;
+A814;SYLOTI NAGRI LETTER TO;Lo;0;L;;;;;N;;;;;
+A815;SYLOTI NAGRI LETTER THO;Lo;0;L;;;;;N;;;;;
+A816;SYLOTI NAGRI LETTER DO;Lo;0;L;;;;;N;;;;;
+A817;SYLOTI NAGRI LETTER DHO;Lo;0;L;;;;;N;;;;;
+A818;SYLOTI NAGRI LETTER NO;Lo;0;L;;;;;N;;;;;
+A819;SYLOTI NAGRI LETTER PO;Lo;0;L;;;;;N;;;;;
+A81A;SYLOTI NAGRI LETTER PHO;Lo;0;L;;;;;N;;;;;
+A81B;SYLOTI NAGRI LETTER BO;Lo;0;L;;;;;N;;;;;
+A81C;SYLOTI NAGRI LETTER BHO;Lo;0;L;;;;;N;;;;;
+A81D;SYLOTI NAGRI LETTER MO;Lo;0;L;;;;;N;;;;;
+A81E;SYLOTI NAGRI LETTER RO;Lo;0;L;;;;;N;;;;;
+A81F;SYLOTI NAGRI LETTER LO;Lo;0;L;;;;;N;;;;;
+A820;SYLOTI NAGRI LETTER RRO;Lo;0;L;;;;;N;;;;;
+A821;SYLOTI NAGRI LETTER SO;Lo;0;L;;;;;N;;;;;
+A822;SYLOTI NAGRI LETTER HO;Lo;0;L;;;;;N;;;;;
+A823;SYLOTI NAGRI VOWEL SIGN A;Mc;0;L;;;;;N;;;;;
+A824;SYLOTI NAGRI VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+A825;SYLOTI NAGRI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+A826;SYLOTI NAGRI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+A827;SYLOTI NAGRI VOWEL SIGN OO;Mc;0;L;;;;;N;;;;;
+A828;SYLOTI NAGRI POETRY MARK-1;So;0;ON;;;;;N;;;;;
+A829;SYLOTI NAGRI POETRY MARK-2;So;0;ON;;;;;N;;;;;
+A82A;SYLOTI NAGRI POETRY MARK-3;So;0;ON;;;;;N;;;;;
+A82B;SYLOTI NAGRI POETRY MARK-4;So;0;ON;;;;;N;;;;;
+A840;PHAGS-PA LETTER KA;Lo;0;L;;;;;N;;;;;
+A841;PHAGS-PA LETTER KHA;Lo;0;L;;;;;N;;;;;
+A842;PHAGS-PA LETTER GA;Lo;0;L;;;;;N;;;;;
+A843;PHAGS-PA LETTER NGA;Lo;0;L;;;;;N;;;;;
+A844;PHAGS-PA LETTER CA;Lo;0;L;;;;;N;;;;;
+A845;PHAGS-PA LETTER CHA;Lo;0;L;;;;;N;;;;;
+A846;PHAGS-PA LETTER JA;Lo;0;L;;;;;N;;;;;
+A847;PHAGS-PA LETTER NYA;Lo;0;L;;;;;N;;;;;
+A848;PHAGS-PA LETTER TA;Lo;0;L;;;;;N;;;;;
+A849;PHAGS-PA LETTER THA;Lo;0;L;;;;;N;;;;;
+A84A;PHAGS-PA LETTER DA;Lo;0;L;;;;;N;;;;;
+A84B;PHAGS-PA LETTER NA;Lo;0;L;;;;;N;;;;;
+A84C;PHAGS-PA LETTER PA;Lo;0;L;;;;;N;;;;;
+A84D;PHAGS-PA LETTER PHA;Lo;0;L;;;;;N;;;;;
+A84E;PHAGS-PA LETTER BA;Lo;0;L;;;;;N;;;;;
+A84F;PHAGS-PA LETTER MA;Lo;0;L;;;;;N;;;;;
+A850;PHAGS-PA LETTER TSA;Lo;0;L;;;;;N;;;;;
+A851;PHAGS-PA LETTER TSHA;Lo;0;L;;;;;N;;;;;
+A852;PHAGS-PA LETTER DZA;Lo;0;L;;;;;N;;;;;
+A853;PHAGS-PA LETTER WA;Lo;0;L;;;;;N;;;;;
+A854;PHAGS-PA LETTER ZHA;Lo;0;L;;;;;N;;;;;
+A855;PHAGS-PA LETTER ZA;Lo;0;L;;;;;N;;;;;
+A856;PHAGS-PA LETTER SMALL A;Lo;0;L;;;;;N;;;;;
+A857;PHAGS-PA LETTER YA;Lo;0;L;;;;;N;;;;;
+A858;PHAGS-PA LETTER RA;Lo;0;L;;;;;N;;;;;
+A859;PHAGS-PA LETTER LA;Lo;0;L;;;;;N;;;;;
+A85A;PHAGS-PA LETTER SHA;Lo;0;L;;;;;N;;;;;
+A85B;PHAGS-PA LETTER SA;Lo;0;L;;;;;N;;;;;
+A85C;PHAGS-PA LETTER HA;Lo;0;L;;;;;N;;;;;
+A85D;PHAGS-PA LETTER A;Lo;0;L;;;;;N;;;;;
+A85E;PHAGS-PA LETTER I;Lo;0;L;;;;;N;;;;;
+A85F;PHAGS-PA LETTER U;Lo;0;L;;;;;N;;;;;
+A860;PHAGS-PA LETTER E;Lo;0;L;;;;;N;;;;;
+A861;PHAGS-PA LETTER O;Lo;0;L;;;;;N;;;;;
+A862;PHAGS-PA LETTER QA;Lo;0;L;;;;;N;;;;;
+A863;PHAGS-PA LETTER XA;Lo;0;L;;;;;N;;;;;
+A864;PHAGS-PA LETTER FA;Lo;0;L;;;;;N;;;;;
+A865;PHAGS-PA LETTER GGA;Lo;0;L;;;;;N;;;;;
+A866;PHAGS-PA LETTER EE;Lo;0;L;;;;;N;;;;;
+A867;PHAGS-PA SUBJOINED LETTER WA;Lo;0;L;;;;;N;;;;;
+A868;PHAGS-PA SUBJOINED LETTER YA;Lo;0;L;;;;;N;;;;;
+A869;PHAGS-PA LETTER TTA;Lo;0;L;;;;;N;;;;;
+A86A;PHAGS-PA LETTER TTHA;Lo;0;L;;;;;N;;;;;
+A86B;PHAGS-PA LETTER DDA;Lo;0;L;;;;;N;;;;;
+A86C;PHAGS-PA LETTER NNA;Lo;0;L;;;;;N;;;;;
+A86D;PHAGS-PA LETTER ALTERNATE YA;Lo;0;L;;;;;N;;;;;
+A86E;PHAGS-PA LETTER VOICELESS SHA;Lo;0;L;;;;;N;;;;;
+A86F;PHAGS-PA LETTER VOICED HA;Lo;0;L;;;;;N;;;;;
+A870;PHAGS-PA LETTER ASPIRATED FA;Lo;0;L;;;;;N;;;;;
+A871;PHAGS-PA SUBJOINED LETTER RA;Lo;0;L;;;;;N;;;;;
+A872;PHAGS-PA SUPERFIXED LETTER RA;Lo;0;L;;;;;N;;;;;
+A873;PHAGS-PA LETTER CANDRABINDU;Lo;0;L;;;;;N;;;;;
+A874;PHAGS-PA SINGLE HEAD MARK;Po;0;ON;;;;;N;;;;;
+A875;PHAGS-PA DOUBLE HEAD MARK;Po;0;ON;;;;;N;;;;;
+A876;PHAGS-PA MARK SHAD;Po;0;ON;;;;;N;;;;;
+A877;PHAGS-PA MARK DOUBLE SHAD;Po;0;ON;;;;;N;;;;;
+AC00;<Hangul Syllable, First>;Lo;0;L;;;;;N;;;;;
+D7A3;<Hangul Syllable, Last>;Lo;0;L;;;;;N;;;;;
+D800;<Non Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;;
+DB7F;<Non Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;;
+DB80;<Private Use High Surrogate, First>;Cs;0;L;;;;;N;;;;;
+DBFF;<Private Use High Surrogate, Last>;Cs;0;L;;;;;N;;;;;
+DC00;<Low Surrogate, First>;Cs;0;L;;;;;N;;;;;
+DFFF;<Low Surrogate, Last>;Cs;0;L;;;;;N;;;;;
+E000;<Private Use, First>;Co;0;L;;;;;N;;;;;
+F8FF;<Private Use, Last>;Co;0;L;;;;;N;;;;;
+F900;CJK COMPATIBILITY IDEOGRAPH-F900;Lo;0;L;8C48;;;;N;;;;;
+F901;CJK COMPATIBILITY IDEOGRAPH-F901;Lo;0;L;66F4;;;;N;;;;;
+F902;CJK COMPATIBILITY IDEOGRAPH-F902;Lo;0;L;8ECA;;;;N;;;;;
+F903;CJK COMPATIBILITY IDEOGRAPH-F903;Lo;0;L;8CC8;;;;N;;;;;
+F904;CJK COMPATIBILITY IDEOGRAPH-F904;Lo;0;L;6ED1;;;;N;;;;;
+F905;CJK COMPATIBILITY IDEOGRAPH-F905;Lo;0;L;4E32;;;;N;;;;;
+F906;CJK COMPATIBILITY IDEOGRAPH-F906;Lo;0;L;53E5;;;;N;;;;;
+F907;CJK COMPATIBILITY IDEOGRAPH-F907;Lo;0;L;9F9C;;;;N;;;;;
+F908;CJK COMPATIBILITY IDEOGRAPH-F908;Lo;0;L;9F9C;;;;N;;;;;
+F909;CJK COMPATIBILITY IDEOGRAPH-F909;Lo;0;L;5951;;;;N;;;;;
+F90A;CJK COMPATIBILITY IDEOGRAPH-F90A;Lo;0;L;91D1;;;;N;;;;;
+F90B;CJK COMPATIBILITY IDEOGRAPH-F90B;Lo;0;L;5587;;;;N;;;;;
+F90C;CJK COMPATIBILITY IDEOGRAPH-F90C;Lo;0;L;5948;;;;N;;;;;
+F90D;CJK COMPATIBILITY IDEOGRAPH-F90D;Lo;0;L;61F6;;;;N;;;;;
+F90E;CJK COMPATIBILITY IDEOGRAPH-F90E;Lo;0;L;7669;;;;N;;;;;
+F90F;CJK COMPATIBILITY IDEOGRAPH-F90F;Lo;0;L;7F85;;;;N;;;;;
+F910;CJK COMPATIBILITY IDEOGRAPH-F910;Lo;0;L;863F;;;;N;;;;;
+F911;CJK COMPATIBILITY IDEOGRAPH-F911;Lo;0;L;87BA;;;;N;;;;;
+F912;CJK COMPATIBILITY IDEOGRAPH-F912;Lo;0;L;88F8;;;;N;;;;;
+F913;CJK COMPATIBILITY IDEOGRAPH-F913;Lo;0;L;908F;;;;N;;;;;
+F914;CJK COMPATIBILITY IDEOGRAPH-F914;Lo;0;L;6A02;;;;N;;;;;
+F915;CJK COMPATIBILITY IDEOGRAPH-F915;Lo;0;L;6D1B;;;;N;;;;;
+F916;CJK COMPATIBILITY IDEOGRAPH-F916;Lo;0;L;70D9;;;;N;;;;;
+F917;CJK COMPATIBILITY IDEOGRAPH-F917;Lo;0;L;73DE;;;;N;;;;;
+F918;CJK COMPATIBILITY IDEOGRAPH-F918;Lo;0;L;843D;;;;N;;;;;
+F919;CJK COMPATIBILITY IDEOGRAPH-F919;Lo;0;L;916A;;;;N;;;;;
+F91A;CJK COMPATIBILITY IDEOGRAPH-F91A;Lo;0;L;99F1;;;;N;;;;;
+F91B;CJK COMPATIBILITY IDEOGRAPH-F91B;Lo;0;L;4E82;;;;N;;;;;
+F91C;CJK COMPATIBILITY IDEOGRAPH-F91C;Lo;0;L;5375;;;;N;;;;;
+F91D;CJK COMPATIBILITY IDEOGRAPH-F91D;Lo;0;L;6B04;;;;N;;;;;
+F91E;CJK COMPATIBILITY IDEOGRAPH-F91E;Lo;0;L;721B;;;;N;;;;;
+F91F;CJK COMPATIBILITY IDEOGRAPH-F91F;Lo;0;L;862D;;;;N;;;;;
+F920;CJK COMPATIBILITY IDEOGRAPH-F920;Lo;0;L;9E1E;;;;N;;;;;
+F921;CJK COMPATIBILITY IDEOGRAPH-F921;Lo;0;L;5D50;;;;N;;;;;
+F922;CJK COMPATIBILITY IDEOGRAPH-F922;Lo;0;L;6FEB;;;;N;;;;;
+F923;CJK COMPATIBILITY IDEOGRAPH-F923;Lo;0;L;85CD;;;;N;;;;;
+F924;CJK COMPATIBILITY IDEOGRAPH-F924;Lo;0;L;8964;;;;N;;;;;
+F925;CJK COMPATIBILITY IDEOGRAPH-F925;Lo;0;L;62C9;;;;N;;;;;
+F926;CJK COMPATIBILITY IDEOGRAPH-F926;Lo;0;L;81D8;;;;N;;;;;
+F927;CJK COMPATIBILITY IDEOGRAPH-F927;Lo;0;L;881F;;;;N;;;;;
+F928;CJK COMPATIBILITY IDEOGRAPH-F928;Lo;0;L;5ECA;;;;N;;;;;
+F929;CJK COMPATIBILITY IDEOGRAPH-F929;Lo;0;L;6717;;;;N;;;;;
+F92A;CJK COMPATIBILITY IDEOGRAPH-F92A;Lo;0;L;6D6A;;;;N;;;;;
+F92B;CJK COMPATIBILITY IDEOGRAPH-F92B;Lo;0;L;72FC;;;;N;;;;;
+F92C;CJK COMPATIBILITY IDEOGRAPH-F92C;Lo;0;L;90CE;;;;N;;;;;
+F92D;CJK COMPATIBILITY IDEOGRAPH-F92D;Lo;0;L;4F86;;;;N;;;;;
+F92E;CJK COMPATIBILITY IDEOGRAPH-F92E;Lo;0;L;51B7;;;;N;;;;;
+F92F;CJK COMPATIBILITY IDEOGRAPH-F92F;Lo;0;L;52DE;;;;N;;;;;
+F930;CJK COMPATIBILITY IDEOGRAPH-F930;Lo;0;L;64C4;;;;N;;;;;
+F931;CJK COMPATIBILITY IDEOGRAPH-F931;Lo;0;L;6AD3;;;;N;;;;;
+F932;CJK COMPATIBILITY IDEOGRAPH-F932;Lo;0;L;7210;;;;N;;;;;
+F933;CJK COMPATIBILITY IDEOGRAPH-F933;Lo;0;L;76E7;;;;N;;;;;
+F934;CJK COMPATIBILITY IDEOGRAPH-F934;Lo;0;L;8001;;;;N;;;;;
+F935;CJK COMPATIBILITY IDEOGRAPH-F935;Lo;0;L;8606;;;;N;;;;;
+F936;CJK COMPATIBILITY IDEOGRAPH-F936;Lo;0;L;865C;;;;N;;;;;
+F937;CJK COMPATIBILITY IDEOGRAPH-F937;Lo;0;L;8DEF;;;;N;;;;;
+F938;CJK COMPATIBILITY IDEOGRAPH-F938;Lo;0;L;9732;;;;N;;;;;
+F939;CJK COMPATIBILITY IDEOGRAPH-F939;Lo;0;L;9B6F;;;;N;;;;;
+F93A;CJK COMPATIBILITY IDEOGRAPH-F93A;Lo;0;L;9DFA;;;;N;;;;;
+F93B;CJK COMPATIBILITY IDEOGRAPH-F93B;Lo;0;L;788C;;;;N;;;;;
+F93C;CJK COMPATIBILITY IDEOGRAPH-F93C;Lo;0;L;797F;;;;N;;;;;
+F93D;CJK COMPATIBILITY IDEOGRAPH-F93D;Lo;0;L;7DA0;;;;N;;;;;
+F93E;CJK COMPATIBILITY IDEOGRAPH-F93E;Lo;0;L;83C9;;;;N;;;;;
+F93F;CJK COMPATIBILITY IDEOGRAPH-F93F;Lo;0;L;9304;;;;N;;;;;
+F940;CJK COMPATIBILITY IDEOGRAPH-F940;Lo;0;L;9E7F;;;;N;;;;;
+F941;CJK COMPATIBILITY IDEOGRAPH-F941;Lo;0;L;8AD6;;;;N;;;;;
+F942;CJK COMPATIBILITY IDEOGRAPH-F942;Lo;0;L;58DF;;;;N;;;;;
+F943;CJK COMPATIBILITY IDEOGRAPH-F943;Lo;0;L;5F04;;;;N;;;;;
+F944;CJK COMPATIBILITY IDEOGRAPH-F944;Lo;0;L;7C60;;;;N;;;;;
+F945;CJK COMPATIBILITY IDEOGRAPH-F945;Lo;0;L;807E;;;;N;;;;;
+F946;CJK COMPATIBILITY IDEOGRAPH-F946;Lo;0;L;7262;;;;N;;;;;
+F947;CJK COMPATIBILITY IDEOGRAPH-F947;Lo;0;L;78CA;;;;N;;;;;
+F948;CJK COMPATIBILITY IDEOGRAPH-F948;Lo;0;L;8CC2;;;;N;;;;;
+F949;CJK COMPATIBILITY IDEOGRAPH-F949;Lo;0;L;96F7;;;;N;;;;;
+F94A;CJK COMPATIBILITY IDEOGRAPH-F94A;Lo;0;L;58D8;;;;N;;;;;
+F94B;CJK COMPATIBILITY IDEOGRAPH-F94B;Lo;0;L;5C62;;;;N;;;;;
+F94C;CJK COMPATIBILITY IDEOGRAPH-F94C;Lo;0;L;6A13;;;;N;;;;;
+F94D;CJK COMPATIBILITY IDEOGRAPH-F94D;Lo;0;L;6DDA;;;;N;;;;;
+F94E;CJK COMPATIBILITY IDEOGRAPH-F94E;Lo;0;L;6F0F;;;;N;;;;;
+F94F;CJK COMPATIBILITY IDEOGRAPH-F94F;Lo;0;L;7D2F;;;;N;;;;;
+F950;CJK COMPATIBILITY IDEOGRAPH-F950;Lo;0;L;7E37;;;;N;;;;;
+F951;CJK COMPATIBILITY IDEOGRAPH-F951;Lo;0;L;964B;;;;N;;;;;
+F952;CJK COMPATIBILITY IDEOGRAPH-F952;Lo;0;L;52D2;;;;N;;;;;
+F953;CJK COMPATIBILITY IDEOGRAPH-F953;Lo;0;L;808B;;;;N;;;;;
+F954;CJK COMPATIBILITY IDEOGRAPH-F954;Lo;0;L;51DC;;;;N;;;;;
+F955;CJK COMPATIBILITY IDEOGRAPH-F955;Lo;0;L;51CC;;;;N;;;;;
+F956;CJK COMPATIBILITY IDEOGRAPH-F956;Lo;0;L;7A1C;;;;N;;;;;
+F957;CJK COMPATIBILITY IDEOGRAPH-F957;Lo;0;L;7DBE;;;;N;;;;;
+F958;CJK COMPATIBILITY IDEOGRAPH-F958;Lo;0;L;83F1;;;;N;;;;;
+F959;CJK COMPATIBILITY IDEOGRAPH-F959;Lo;0;L;9675;;;;N;;;;;
+F95A;CJK COMPATIBILITY IDEOGRAPH-F95A;Lo;0;L;8B80;;;;N;;;;;
+F95B;CJK COMPATIBILITY IDEOGRAPH-F95B;Lo;0;L;62CF;;;;N;;;;;
+F95C;CJK COMPATIBILITY IDEOGRAPH-F95C;Lo;0;L;6A02;;;;N;;;;;
+F95D;CJK COMPATIBILITY IDEOGRAPH-F95D;Lo;0;L;8AFE;;;;N;;;;;
+F95E;CJK COMPATIBILITY IDEOGRAPH-F95E;Lo;0;L;4E39;;;;N;;;;;
+F95F;CJK COMPATIBILITY IDEOGRAPH-F95F;Lo;0;L;5BE7;;;;N;;;;;
+F960;CJK COMPATIBILITY IDEOGRAPH-F960;Lo;0;L;6012;;;;N;;;;;
+F961;CJK COMPATIBILITY IDEOGRAPH-F961;Lo;0;L;7387;;;;N;;;;;
+F962;CJK COMPATIBILITY IDEOGRAPH-F962;Lo;0;L;7570;;;;N;;;;;
+F963;CJK COMPATIBILITY IDEOGRAPH-F963;Lo;0;L;5317;;;;N;;;;;
+F964;CJK COMPATIBILITY IDEOGRAPH-F964;Lo;0;L;78FB;;;;N;;;;;
+F965;CJK COMPATIBILITY IDEOGRAPH-F965;Lo;0;L;4FBF;;;;N;;;;;
+F966;CJK COMPATIBILITY IDEOGRAPH-F966;Lo;0;L;5FA9;;;;N;;;;;
+F967;CJK COMPATIBILITY IDEOGRAPH-F967;Lo;0;L;4E0D;;;;N;;;;;
+F968;CJK COMPATIBILITY IDEOGRAPH-F968;Lo;0;L;6CCC;;;;N;;;;;
+F969;CJK COMPATIBILITY IDEOGRAPH-F969;Lo;0;L;6578;;;;N;;;;;
+F96A;CJK COMPATIBILITY IDEOGRAPH-F96A;Lo;0;L;7D22;;;;N;;;;;
+F96B;CJK COMPATIBILITY IDEOGRAPH-F96B;Lo;0;L;53C3;;;;N;;;;;
+F96C;CJK COMPATIBILITY IDEOGRAPH-F96C;Lo;0;L;585E;;;;N;;;;;
+F96D;CJK COMPATIBILITY IDEOGRAPH-F96D;Lo;0;L;7701;;;;N;;;;;
+F96E;CJK COMPATIBILITY IDEOGRAPH-F96E;Lo;0;L;8449;;;;N;;;;;
+F96F;CJK COMPATIBILITY IDEOGRAPH-F96F;Lo;0;L;8AAA;;;;N;;;;;
+F970;CJK COMPATIBILITY IDEOGRAPH-F970;Lo;0;L;6BBA;;;;N;;;;;
+F971;CJK COMPATIBILITY IDEOGRAPH-F971;Lo;0;L;8FB0;;;;N;;;;;
+F972;CJK COMPATIBILITY IDEOGRAPH-F972;Lo;0;L;6C88;;;;N;;;;;
+F973;CJK COMPATIBILITY IDEOGRAPH-F973;Lo;0;L;62FE;;;;N;;;;;
+F974;CJK COMPATIBILITY IDEOGRAPH-F974;Lo;0;L;82E5;;;;N;;;;;
+F975;CJK COMPATIBILITY IDEOGRAPH-F975;Lo;0;L;63A0;;;;N;;;;;
+F976;CJK COMPATIBILITY IDEOGRAPH-F976;Lo;0;L;7565;;;;N;;;;;
+F977;CJK COMPATIBILITY IDEOGRAPH-F977;Lo;0;L;4EAE;;;;N;;;;;
+F978;CJK COMPATIBILITY IDEOGRAPH-F978;Lo;0;L;5169;;;;N;;;;;
+F979;CJK COMPATIBILITY IDEOGRAPH-F979;Lo;0;L;51C9;;;;N;;;;;
+F97A;CJK COMPATIBILITY IDEOGRAPH-F97A;Lo;0;L;6881;;;;N;;;;;
+F97B;CJK COMPATIBILITY IDEOGRAPH-F97B;Lo;0;L;7CE7;;;;N;;;;;
+F97C;CJK COMPATIBILITY IDEOGRAPH-F97C;Lo;0;L;826F;;;;N;;;;;
+F97D;CJK COMPATIBILITY IDEOGRAPH-F97D;Lo;0;L;8AD2;;;;N;;;;;
+F97E;CJK COMPATIBILITY IDEOGRAPH-F97E;Lo;0;L;91CF;;;;N;;;;;
+F97F;CJK COMPATIBILITY IDEOGRAPH-F97F;Lo;0;L;52F5;;;;N;;;;;
+F980;CJK COMPATIBILITY IDEOGRAPH-F980;Lo;0;L;5442;;;;N;;;;;
+F981;CJK COMPATIBILITY IDEOGRAPH-F981;Lo;0;L;5973;;;;N;;;;;
+F982;CJK COMPATIBILITY IDEOGRAPH-F982;Lo;0;L;5EEC;;;;N;;;;;
+F983;CJK COMPATIBILITY IDEOGRAPH-F983;Lo;0;L;65C5;;;;N;;;;;
+F984;CJK COMPATIBILITY IDEOGRAPH-F984;Lo;0;L;6FFE;;;;N;;;;;
+F985;CJK COMPATIBILITY IDEOGRAPH-F985;Lo;0;L;792A;;;;N;;;;;
+F986;CJK COMPATIBILITY IDEOGRAPH-F986;Lo;0;L;95AD;;;;N;;;;;
+F987;CJK COMPATIBILITY IDEOGRAPH-F987;Lo;0;L;9A6A;;;;N;;;;;
+F988;CJK COMPATIBILITY IDEOGRAPH-F988;Lo;0;L;9E97;;;;N;;;;;
+F989;CJK COMPATIBILITY IDEOGRAPH-F989;Lo;0;L;9ECE;;;;N;;;;;
+F98A;CJK COMPATIBILITY IDEOGRAPH-F98A;Lo;0;L;529B;;;;N;;;;;
+F98B;CJK COMPATIBILITY IDEOGRAPH-F98B;Lo;0;L;66C6;;;;N;;;;;
+F98C;CJK COMPATIBILITY IDEOGRAPH-F98C;Lo;0;L;6B77;;;;N;;;;;
+F98D;CJK COMPATIBILITY IDEOGRAPH-F98D;Lo;0;L;8F62;;;;N;;;;;
+F98E;CJK COMPATIBILITY IDEOGRAPH-F98E;Lo;0;L;5E74;;;;N;;;;;
+F98F;CJK COMPATIBILITY IDEOGRAPH-F98F;Lo;0;L;6190;;;;N;;;;;
+F990;CJK COMPATIBILITY IDEOGRAPH-F990;Lo;0;L;6200;;;;N;;;;;
+F991;CJK COMPATIBILITY IDEOGRAPH-F991;Lo;0;L;649A;;;;N;;;;;
+F992;CJK COMPATIBILITY IDEOGRAPH-F992;Lo;0;L;6F23;;;;N;;;;;
+F993;CJK COMPATIBILITY IDEOGRAPH-F993;Lo;0;L;7149;;;;N;;;;;
+F994;CJK COMPATIBILITY IDEOGRAPH-F994;Lo;0;L;7489;;;;N;;;;;
+F995;CJK COMPATIBILITY IDEOGRAPH-F995;Lo;0;L;79CA;;;;N;;;;;
+F996;CJK COMPATIBILITY IDEOGRAPH-F996;Lo;0;L;7DF4;;;;N;;;;;
+F997;CJK COMPATIBILITY IDEOGRAPH-F997;Lo;0;L;806F;;;;N;;;;;
+F998;CJK COMPATIBILITY IDEOGRAPH-F998;Lo;0;L;8F26;;;;N;;;;;
+F999;CJK COMPATIBILITY IDEOGRAPH-F999;Lo;0;L;84EE;;;;N;;;;;
+F99A;CJK COMPATIBILITY IDEOGRAPH-F99A;Lo;0;L;9023;;;;N;;;;;
+F99B;CJK COMPATIBILITY IDEOGRAPH-F99B;Lo;0;L;934A;;;;N;;;;;
+F99C;CJK COMPATIBILITY IDEOGRAPH-F99C;Lo;0;L;5217;;;;N;;;;;
+F99D;CJK COMPATIBILITY IDEOGRAPH-F99D;Lo;0;L;52A3;;;;N;;;;;
+F99E;CJK COMPATIBILITY IDEOGRAPH-F99E;Lo;0;L;54BD;;;;N;;;;;
+F99F;CJK COMPATIBILITY IDEOGRAPH-F99F;Lo;0;L;70C8;;;;N;;;;;
+F9A0;CJK COMPATIBILITY IDEOGRAPH-F9A0;Lo;0;L;88C2;;;;N;;;;;
+F9A1;CJK COMPATIBILITY IDEOGRAPH-F9A1;Lo;0;L;8AAA;;;;N;;;;;
+F9A2;CJK COMPATIBILITY IDEOGRAPH-F9A2;Lo;0;L;5EC9;;;;N;;;;;
+F9A3;CJK COMPATIBILITY IDEOGRAPH-F9A3;Lo;0;L;5FF5;;;;N;;;;;
+F9A4;CJK COMPATIBILITY IDEOGRAPH-F9A4;Lo;0;L;637B;;;;N;;;;;
+F9A5;CJK COMPATIBILITY IDEOGRAPH-F9A5;Lo;0;L;6BAE;;;;N;;;;;
+F9A6;CJK COMPATIBILITY IDEOGRAPH-F9A6;Lo;0;L;7C3E;;;;N;;;;;
+F9A7;CJK COMPATIBILITY IDEOGRAPH-F9A7;Lo;0;L;7375;;;;N;;;;;
+F9A8;CJK COMPATIBILITY IDEOGRAPH-F9A8;Lo;0;L;4EE4;;;;N;;;;;
+F9A9;CJK COMPATIBILITY IDEOGRAPH-F9A9;Lo;0;L;56F9;;;;N;;;;;
+F9AA;CJK COMPATIBILITY IDEOGRAPH-F9AA;Lo;0;L;5BE7;;;;N;;;;;
+F9AB;CJK COMPATIBILITY IDEOGRAPH-F9AB;Lo;0;L;5DBA;;;;N;;;;;
+F9AC;CJK COMPATIBILITY IDEOGRAPH-F9AC;Lo;0;L;601C;;;;N;;;;;
+F9AD;CJK COMPATIBILITY IDEOGRAPH-F9AD;Lo;0;L;73B2;;;;N;;;;;
+F9AE;CJK COMPATIBILITY IDEOGRAPH-F9AE;Lo;0;L;7469;;;;N;;;;;
+F9AF;CJK COMPATIBILITY IDEOGRAPH-F9AF;Lo;0;L;7F9A;;;;N;;;;;
+F9B0;CJK COMPATIBILITY IDEOGRAPH-F9B0;Lo;0;L;8046;;;;N;;;;;
+F9B1;CJK COMPATIBILITY IDEOGRAPH-F9B1;Lo;0;L;9234;;;;N;;;;;
+F9B2;CJK COMPATIBILITY IDEOGRAPH-F9B2;Lo;0;L;96F6;;;;N;;;;;
+F9B3;CJK COMPATIBILITY IDEOGRAPH-F9B3;Lo;0;L;9748;;;;N;;;;;
+F9B4;CJK COMPATIBILITY IDEOGRAPH-F9B4;Lo;0;L;9818;;;;N;;;;;
+F9B5;CJK COMPATIBILITY IDEOGRAPH-F9B5;Lo;0;L;4F8B;;;;N;;;;;
+F9B6;CJK COMPATIBILITY IDEOGRAPH-F9B6;Lo;0;L;79AE;;;;N;;;;;
+F9B7;CJK COMPATIBILITY IDEOGRAPH-F9B7;Lo;0;L;91B4;;;;N;;;;;
+F9B8;CJK COMPATIBILITY IDEOGRAPH-F9B8;Lo;0;L;96B8;;;;N;;;;;
+F9B9;CJK COMPATIBILITY IDEOGRAPH-F9B9;Lo;0;L;60E1;;;;N;;;;;
+F9BA;CJK COMPATIBILITY IDEOGRAPH-F9BA;Lo;0;L;4E86;;;;N;;;;;
+F9BB;CJK COMPATIBILITY IDEOGRAPH-F9BB;Lo;0;L;50DA;;;;N;;;;;
+F9BC;CJK COMPATIBILITY IDEOGRAPH-F9BC;Lo;0;L;5BEE;;;;N;;;;;
+F9BD;CJK COMPATIBILITY IDEOGRAPH-F9BD;Lo;0;L;5C3F;;;;N;;;;;
+F9BE;CJK COMPATIBILITY IDEOGRAPH-F9BE;Lo;0;L;6599;;;;N;;;;;
+F9BF;CJK COMPATIBILITY IDEOGRAPH-F9BF;Lo;0;L;6A02;;;;N;;;;;
+F9C0;CJK COMPATIBILITY IDEOGRAPH-F9C0;Lo;0;L;71CE;;;;N;;;;;
+F9C1;CJK COMPATIBILITY IDEOGRAPH-F9C1;Lo;0;L;7642;;;;N;;;;;
+F9C2;CJK COMPATIBILITY IDEOGRAPH-F9C2;Lo;0;L;84FC;;;;N;;;;;
+F9C3;CJK COMPATIBILITY IDEOGRAPH-F9C3;Lo;0;L;907C;;;;N;;;;;
+F9C4;CJK COMPATIBILITY IDEOGRAPH-F9C4;Lo;0;L;9F8D;;;;N;;;;;
+F9C5;CJK COMPATIBILITY IDEOGRAPH-F9C5;Lo;0;L;6688;;;;N;;;;;
+F9C6;CJK COMPATIBILITY IDEOGRAPH-F9C6;Lo;0;L;962E;;;;N;;;;;
+F9C7;CJK COMPATIBILITY IDEOGRAPH-F9C7;Lo;0;L;5289;;;;N;;;;;
+F9C8;CJK COMPATIBILITY IDEOGRAPH-F9C8;Lo;0;L;677B;;;;N;;;;;
+F9C9;CJK COMPATIBILITY IDEOGRAPH-F9C9;Lo;0;L;67F3;;;;N;;;;;
+F9CA;CJK COMPATIBILITY IDEOGRAPH-F9CA;Lo;0;L;6D41;;;;N;;;;;
+F9CB;CJK COMPATIBILITY IDEOGRAPH-F9CB;Lo;0;L;6E9C;;;;N;;;;;
+F9CC;CJK COMPATIBILITY IDEOGRAPH-F9CC;Lo;0;L;7409;;;;N;;;;;
+F9CD;CJK COMPATIBILITY IDEOGRAPH-F9CD;Lo;0;L;7559;;;;N;;;;;
+F9CE;CJK COMPATIBILITY IDEOGRAPH-F9CE;Lo;0;L;786B;;;;N;;;;;
+F9CF;CJK COMPATIBILITY IDEOGRAPH-F9CF;Lo;0;L;7D10;;;;N;;;;;
+F9D0;CJK COMPATIBILITY IDEOGRAPH-F9D0;Lo;0;L;985E;;;;N;;;;;
+F9D1;CJK COMPATIBILITY IDEOGRAPH-F9D1;Lo;0;L;516D;;;;N;;;;;
+F9D2;CJK COMPATIBILITY IDEOGRAPH-F9D2;Lo;0;L;622E;;;;N;;;;;
+F9D3;CJK COMPATIBILITY IDEOGRAPH-F9D3;Lo;0;L;9678;;;;N;;;;;
+F9D4;CJK COMPATIBILITY IDEOGRAPH-F9D4;Lo;0;L;502B;;;;N;;;;;
+F9D5;CJK COMPATIBILITY IDEOGRAPH-F9D5;Lo;0;L;5D19;;;;N;;;;;
+F9D6;CJK COMPATIBILITY IDEOGRAPH-F9D6;Lo;0;L;6DEA;;;;N;;;;;
+F9D7;CJK COMPATIBILITY IDEOGRAPH-F9D7;Lo;0;L;8F2A;;;;N;;;;;
+F9D8;CJK COMPATIBILITY IDEOGRAPH-F9D8;Lo;0;L;5F8B;;;;N;;;;;
+F9D9;CJK COMPATIBILITY IDEOGRAPH-F9D9;Lo;0;L;6144;;;;N;;;;;
+F9DA;CJK COMPATIBILITY IDEOGRAPH-F9DA;Lo;0;L;6817;;;;N;;;;;
+F9DB;CJK COMPATIBILITY IDEOGRAPH-F9DB;Lo;0;L;7387;;;;N;;;;;
+F9DC;CJK COMPATIBILITY IDEOGRAPH-F9DC;Lo;0;L;9686;;;;N;;;;;
+F9DD;CJK COMPATIBILITY IDEOGRAPH-F9DD;Lo;0;L;5229;;;;N;;;;;
+F9DE;CJK COMPATIBILITY IDEOGRAPH-F9DE;Lo;0;L;540F;;;;N;;;;;
+F9DF;CJK COMPATIBILITY IDEOGRAPH-F9DF;Lo;0;L;5C65;;;;N;;;;;
+F9E0;CJK COMPATIBILITY IDEOGRAPH-F9E0;Lo;0;L;6613;;;;N;;;;;
+F9E1;CJK COMPATIBILITY IDEOGRAPH-F9E1;Lo;0;L;674E;;;;N;;;;;
+F9E2;CJK COMPATIBILITY IDEOGRAPH-F9E2;Lo;0;L;68A8;;;;N;;;;;
+F9E3;CJK COMPATIBILITY IDEOGRAPH-F9E3;Lo;0;L;6CE5;;;;N;;;;;
+F9E4;CJK COMPATIBILITY IDEOGRAPH-F9E4;Lo;0;L;7406;;;;N;;;;;
+F9E5;CJK COMPATIBILITY IDEOGRAPH-F9E5;Lo;0;L;75E2;;;;N;;;;;
+F9E6;CJK COMPATIBILITY IDEOGRAPH-F9E6;Lo;0;L;7F79;;;;N;;;;;
+F9E7;CJK COMPATIBILITY IDEOGRAPH-F9E7;Lo;0;L;88CF;;;;N;;;;;
+F9E8;CJK COMPATIBILITY IDEOGRAPH-F9E8;Lo;0;L;88E1;;;;N;;;;;
+F9E9;CJK COMPATIBILITY IDEOGRAPH-F9E9;Lo;0;L;91CC;;;;N;;;;;
+F9EA;CJK COMPATIBILITY IDEOGRAPH-F9EA;Lo;0;L;96E2;;;;N;;;;;
+F9EB;CJK COMPATIBILITY IDEOGRAPH-F9EB;Lo;0;L;533F;;;;N;;;;;
+F9EC;CJK COMPATIBILITY IDEOGRAPH-F9EC;Lo;0;L;6EBA;;;;N;;;;;
+F9ED;CJK COMPATIBILITY IDEOGRAPH-F9ED;Lo;0;L;541D;;;;N;;;;;
+F9EE;CJK COMPATIBILITY IDEOGRAPH-F9EE;Lo;0;L;71D0;;;;N;;;;;
+F9EF;CJK COMPATIBILITY IDEOGRAPH-F9EF;Lo;0;L;7498;;;;N;;;;;
+F9F0;CJK COMPATIBILITY IDEOGRAPH-F9F0;Lo;0;L;85FA;;;;N;;;;;
+F9F1;CJK COMPATIBILITY IDEOGRAPH-F9F1;Lo;0;L;96A3;;;;N;;;;;
+F9F2;CJK COMPATIBILITY IDEOGRAPH-F9F2;Lo;0;L;9C57;;;;N;;;;;
+F9F3;CJK COMPATIBILITY IDEOGRAPH-F9F3;Lo;0;L;9E9F;;;;N;;;;;
+F9F4;CJK COMPATIBILITY IDEOGRAPH-F9F4;Lo;0;L;6797;;;;N;;;;;
+F9F5;CJK COMPATIBILITY IDEOGRAPH-F9F5;Lo;0;L;6DCB;;;;N;;;;;
+F9F6;CJK COMPATIBILITY IDEOGRAPH-F9F6;Lo;0;L;81E8;;;;N;;;;;
+F9F7;CJK COMPATIBILITY IDEOGRAPH-F9F7;Lo;0;L;7ACB;;;;N;;;;;
+F9F8;CJK COMPATIBILITY IDEOGRAPH-F9F8;Lo;0;L;7B20;;;;N;;;;;
+F9F9;CJK COMPATIBILITY IDEOGRAPH-F9F9;Lo;0;L;7C92;;;;N;;;;;
+F9FA;CJK COMPATIBILITY IDEOGRAPH-F9FA;Lo;0;L;72C0;;;;N;;;;;
+F9FB;CJK COMPATIBILITY IDEOGRAPH-F9FB;Lo;0;L;7099;;;;N;;;;;
+F9FC;CJK COMPATIBILITY IDEOGRAPH-F9FC;Lo;0;L;8B58;;;;N;;;;;
+F9FD;CJK COMPATIBILITY IDEOGRAPH-F9FD;Lo;0;L;4EC0;;;;N;;;;;
+F9FE;CJK COMPATIBILITY IDEOGRAPH-F9FE;Lo;0;L;8336;;;;N;;;;;
+F9FF;CJK COMPATIBILITY IDEOGRAPH-F9FF;Lo;0;L;523A;;;;N;;;;;
+FA00;CJK COMPATIBILITY IDEOGRAPH-FA00;Lo;0;L;5207;;;;N;;;;;
+FA01;CJK COMPATIBILITY IDEOGRAPH-FA01;Lo;0;L;5EA6;;;;N;;;;;
+FA02;CJK COMPATIBILITY IDEOGRAPH-FA02;Lo;0;L;62D3;;;;N;;;;;
+FA03;CJK COMPATIBILITY IDEOGRAPH-FA03;Lo;0;L;7CD6;;;;N;;;;;
+FA04;CJK COMPATIBILITY IDEOGRAPH-FA04;Lo;0;L;5B85;;;;N;;;;;
+FA05;CJK COMPATIBILITY IDEOGRAPH-FA05;Lo;0;L;6D1E;;;;N;;;;;
+FA06;CJK COMPATIBILITY IDEOGRAPH-FA06;Lo;0;L;66B4;;;;N;;;;;
+FA07;CJK COMPATIBILITY IDEOGRAPH-FA07;Lo;0;L;8F3B;;;;N;;;;;
+FA08;CJK COMPATIBILITY IDEOGRAPH-FA08;Lo;0;L;884C;;;;N;;;;;
+FA09;CJK COMPATIBILITY IDEOGRAPH-FA09;Lo;0;L;964D;;;;N;;;;;
+FA0A;CJK COMPATIBILITY IDEOGRAPH-FA0A;Lo;0;L;898B;;;;N;;;;;
+FA0B;CJK COMPATIBILITY IDEOGRAPH-FA0B;Lo;0;L;5ED3;;;;N;;;;;
+FA0C;CJK COMPATIBILITY IDEOGRAPH-FA0C;Lo;0;L;5140;;;;N;;;;;
+FA0D;CJK COMPATIBILITY IDEOGRAPH-FA0D;Lo;0;L;55C0;;;;N;;;;;
+FA0E;CJK COMPATIBILITY IDEOGRAPH-FA0E;Lo;0;L;;;;;N;;;;;
+FA0F;CJK COMPATIBILITY IDEOGRAPH-FA0F;Lo;0;L;;;;;N;;;;;
+FA10;CJK COMPATIBILITY IDEOGRAPH-FA10;Lo;0;L;585A;;;;N;;;;;
+FA11;CJK COMPATIBILITY IDEOGRAPH-FA11;Lo;0;L;;;;;N;;;;;
+FA12;CJK COMPATIBILITY IDEOGRAPH-FA12;Lo;0;L;6674;;;;N;;;;;
+FA13;CJK COMPATIBILITY IDEOGRAPH-FA13;Lo;0;L;;;;;N;;;;;
+FA14;CJK COMPATIBILITY IDEOGRAPH-FA14;Lo;0;L;;;;;N;;;;;
+FA15;CJK COMPATIBILITY IDEOGRAPH-FA15;Lo;0;L;51DE;;;;N;;;;;
+FA16;CJK COMPATIBILITY IDEOGRAPH-FA16;Lo;0;L;732A;;;;N;;;;;
+FA17;CJK COMPATIBILITY IDEOGRAPH-FA17;Lo;0;L;76CA;;;;N;;;;;
+FA18;CJK COMPATIBILITY IDEOGRAPH-FA18;Lo;0;L;793C;;;;N;;;;;
+FA19;CJK COMPATIBILITY IDEOGRAPH-FA19;Lo;0;L;795E;;;;N;;;;;
+FA1A;CJK COMPATIBILITY IDEOGRAPH-FA1A;Lo;0;L;7965;;;;N;;;;;
+FA1B;CJK COMPATIBILITY IDEOGRAPH-FA1B;Lo;0;L;798F;;;;N;;;;;
+FA1C;CJK COMPATIBILITY IDEOGRAPH-FA1C;Lo;0;L;9756;;;;N;;;;;
+FA1D;CJK COMPATIBILITY IDEOGRAPH-FA1D;Lo;0;L;7CBE;;;;N;;;;;
+FA1E;CJK COMPATIBILITY IDEOGRAPH-FA1E;Lo;0;L;7FBD;;;;N;;;;;
+FA1F;CJK COMPATIBILITY IDEOGRAPH-FA1F;Lo;0;L;;;;;N;;*;;;
+FA20;CJK COMPATIBILITY IDEOGRAPH-FA20;Lo;0;L;8612;;;;N;;;;;
+FA21;CJK COMPATIBILITY IDEOGRAPH-FA21;Lo;0;L;;;;;N;;;;;
+FA22;CJK COMPATIBILITY IDEOGRAPH-FA22;Lo;0;L;8AF8;;;;N;;;;;
+FA23;CJK COMPATIBILITY IDEOGRAPH-FA23;Lo;0;L;;;;;N;;*;;;
+FA24;CJK COMPATIBILITY IDEOGRAPH-FA24;Lo;0;L;;;;;N;;;;;
+FA25;CJK COMPATIBILITY IDEOGRAPH-FA25;Lo;0;L;9038;;;;N;;;;;
+FA26;CJK COMPATIBILITY IDEOGRAPH-FA26;Lo;0;L;90FD;;;;N;;;;;
+FA27;CJK COMPATIBILITY IDEOGRAPH-FA27;Lo;0;L;;;;;N;;;;;
+FA28;CJK COMPATIBILITY IDEOGRAPH-FA28;Lo;0;L;;;;;N;;;;;
+FA29;CJK COMPATIBILITY IDEOGRAPH-FA29;Lo;0;L;;;;;N;;;;;
+FA2A;CJK COMPATIBILITY IDEOGRAPH-FA2A;Lo;0;L;98EF;;;;N;;;;;
+FA2B;CJK COMPATIBILITY IDEOGRAPH-FA2B;Lo;0;L;98FC;;;;N;;;;;
+FA2C;CJK COMPATIBILITY IDEOGRAPH-FA2C;Lo;0;L;9928;;;;N;;;;;
+FA2D;CJK COMPATIBILITY IDEOGRAPH-FA2D;Lo;0;L;9DB4;;;;N;;;;;
+FA30;CJK COMPATIBILITY IDEOGRAPH-FA30;Lo;0;L;4FAE;;;;N;;;;;
+FA31;CJK COMPATIBILITY IDEOGRAPH-FA31;Lo;0;L;50E7;;;;N;;;;;
+FA32;CJK COMPATIBILITY IDEOGRAPH-FA32;Lo;0;L;514D;;;;N;;;;;
+FA33;CJK COMPATIBILITY IDEOGRAPH-FA33;Lo;0;L;52C9;;;;N;;;;;
+FA34;CJK COMPATIBILITY IDEOGRAPH-FA34;Lo;0;L;52E4;;;;N;;;;;
+FA35;CJK COMPATIBILITY IDEOGRAPH-FA35;Lo;0;L;5351;;;;N;;;;;
+FA36;CJK COMPATIBILITY IDEOGRAPH-FA36;Lo;0;L;559D;;;;N;;;;;
+FA37;CJK COMPATIBILITY IDEOGRAPH-FA37;Lo;0;L;5606;;;;N;;;;;
+FA38;CJK COMPATIBILITY IDEOGRAPH-FA38;Lo;0;L;5668;;;;N;;;;;
+FA39;CJK COMPATIBILITY IDEOGRAPH-FA39;Lo;0;L;5840;;;;N;;;;;
+FA3A;CJK COMPATIBILITY IDEOGRAPH-FA3A;Lo;0;L;58A8;;;;N;;;;;
+FA3B;CJK COMPATIBILITY IDEOGRAPH-FA3B;Lo;0;L;5C64;;;;N;;;;;
+FA3C;CJK COMPATIBILITY IDEOGRAPH-FA3C;Lo;0;L;5C6E;;;;N;;;;;
+FA3D;CJK COMPATIBILITY IDEOGRAPH-FA3D;Lo;0;L;6094;;;;N;;;;;
+FA3E;CJK COMPATIBILITY IDEOGRAPH-FA3E;Lo;0;L;6168;;;;N;;;;;
+FA3F;CJK COMPATIBILITY IDEOGRAPH-FA3F;Lo;0;L;618E;;;;N;;;;;
+FA40;CJK COMPATIBILITY IDEOGRAPH-FA40;Lo;0;L;61F2;;;;N;;;;;
+FA41;CJK COMPATIBILITY IDEOGRAPH-FA41;Lo;0;L;654F;;;;N;;;;;
+FA42;CJK COMPATIBILITY IDEOGRAPH-FA42;Lo;0;L;65E2;;;;N;;;;;
+FA43;CJK COMPATIBILITY IDEOGRAPH-FA43;Lo;0;L;6691;;;;N;;;;;
+FA44;CJK COMPATIBILITY IDEOGRAPH-FA44;Lo;0;L;6885;;;;N;;;;;
+FA45;CJK COMPATIBILITY IDEOGRAPH-FA45;Lo;0;L;6D77;;;;N;;;;;
+FA46;CJK COMPATIBILITY IDEOGRAPH-FA46;Lo;0;L;6E1A;;;;N;;;;;
+FA47;CJK COMPATIBILITY IDEOGRAPH-FA47;Lo;0;L;6F22;;;;N;;;;;
+FA48;CJK COMPATIBILITY IDEOGRAPH-FA48;Lo;0;L;716E;;;;N;;;;;
+FA49;CJK COMPATIBILITY IDEOGRAPH-FA49;Lo;0;L;722B;;;;N;;;;;
+FA4A;CJK COMPATIBILITY IDEOGRAPH-FA4A;Lo;0;L;7422;;;;N;;;;;
+FA4B;CJK COMPATIBILITY IDEOGRAPH-FA4B;Lo;0;L;7891;;;;N;;;;;
+FA4C;CJK COMPATIBILITY IDEOGRAPH-FA4C;Lo;0;L;793E;;;;N;;;;;
+FA4D;CJK COMPATIBILITY IDEOGRAPH-FA4D;Lo;0;L;7949;;;;N;;;;;
+FA4E;CJK COMPATIBILITY IDEOGRAPH-FA4E;Lo;0;L;7948;;;;N;;;;;
+FA4F;CJK COMPATIBILITY IDEOGRAPH-FA4F;Lo;0;L;7950;;;;N;;;;;
+FA50;CJK COMPATIBILITY IDEOGRAPH-FA50;Lo;0;L;7956;;;;N;;;;;
+FA51;CJK COMPATIBILITY IDEOGRAPH-FA51;Lo;0;L;795D;;;;N;;;;;
+FA52;CJK COMPATIBILITY IDEOGRAPH-FA52;Lo;0;L;798D;;;;N;;;;;
+FA53;CJK COMPATIBILITY IDEOGRAPH-FA53;Lo;0;L;798E;;;;N;;;;;
+FA54;CJK COMPATIBILITY IDEOGRAPH-FA54;Lo;0;L;7A40;;;;N;;;;;
+FA55;CJK COMPATIBILITY IDEOGRAPH-FA55;Lo;0;L;7A81;;;;N;;;;;
+FA56;CJK COMPATIBILITY IDEOGRAPH-FA56;Lo;0;L;7BC0;;;;N;;;;;
+FA57;CJK COMPATIBILITY IDEOGRAPH-FA57;Lo;0;L;7DF4;;;;N;;;;;
+FA58;CJK COMPATIBILITY IDEOGRAPH-FA58;Lo;0;L;7E09;;;;N;;;;;
+FA59;CJK COMPATIBILITY IDEOGRAPH-FA59;Lo;0;L;7E41;;;;N;;;;;
+FA5A;CJK COMPATIBILITY IDEOGRAPH-FA5A;Lo;0;L;7F72;;;;N;;;;;
+FA5B;CJK COMPATIBILITY IDEOGRAPH-FA5B;Lo;0;L;8005;;;;N;;;;;
+FA5C;CJK COMPATIBILITY IDEOGRAPH-FA5C;Lo;0;L;81ED;;;;N;;;;;
+FA5D;CJK COMPATIBILITY IDEOGRAPH-FA5D;Lo;0;L;8279;;;;N;;;;;
+FA5E;CJK COMPATIBILITY IDEOGRAPH-FA5E;Lo;0;L;8279;;;;N;;;;;
+FA5F;CJK COMPATIBILITY IDEOGRAPH-FA5F;Lo;0;L;8457;;;;N;;;;;
+FA60;CJK COMPATIBILITY IDEOGRAPH-FA60;Lo;0;L;8910;;;;N;;;;;
+FA61;CJK COMPATIBILITY IDEOGRAPH-FA61;Lo;0;L;8996;;;;N;;;;;
+FA62;CJK COMPATIBILITY IDEOGRAPH-FA62;Lo;0;L;8B01;;;;N;;;;;
+FA63;CJK COMPATIBILITY IDEOGRAPH-FA63;Lo;0;L;8B39;;;;N;;;;;
+FA64;CJK COMPATIBILITY IDEOGRAPH-FA64;Lo;0;L;8CD3;;;;N;;;;;
+FA65;CJK COMPATIBILITY IDEOGRAPH-FA65;Lo;0;L;8D08;;;;N;;;;;
+FA66;CJK COMPATIBILITY IDEOGRAPH-FA66;Lo;0;L;8FB6;;;;N;;;;;
+FA67;CJK COMPATIBILITY IDEOGRAPH-FA67;Lo;0;L;9038;;;;N;;;;;
+FA68;CJK COMPATIBILITY IDEOGRAPH-FA68;Lo;0;L;96E3;;;;N;;;;;
+FA69;CJK COMPATIBILITY IDEOGRAPH-FA69;Lo;0;L;97FF;;;;N;;;;;
+FA6A;CJK COMPATIBILITY IDEOGRAPH-FA6A;Lo;0;L;983B;;;;N;;;;;
+FA70;CJK COMPATIBILITY IDEOGRAPH-FA70;Lo;0;L;4E26;;;;N;;;;;
+FA71;CJK COMPATIBILITY IDEOGRAPH-FA71;Lo;0;L;51B5;;;;N;;;;;
+FA72;CJK COMPATIBILITY IDEOGRAPH-FA72;Lo;0;L;5168;;;;N;;;;;
+FA73;CJK COMPATIBILITY IDEOGRAPH-FA73;Lo;0;L;4F80;;;;N;;;;;
+FA74;CJK COMPATIBILITY IDEOGRAPH-FA74;Lo;0;L;5145;;;;N;;;;;
+FA75;CJK COMPATIBILITY IDEOGRAPH-FA75;Lo;0;L;5180;;;;N;;;;;
+FA76;CJK COMPATIBILITY IDEOGRAPH-FA76;Lo;0;L;52C7;;;;N;;;;;
+FA77;CJK COMPATIBILITY IDEOGRAPH-FA77;Lo;0;L;52FA;;;;N;;;;;
+FA78;CJK COMPATIBILITY IDEOGRAPH-FA78;Lo;0;L;559D;;;;N;;;;;
+FA79;CJK COMPATIBILITY IDEOGRAPH-FA79;Lo;0;L;5555;;;;N;;;;;
+FA7A;CJK COMPATIBILITY IDEOGRAPH-FA7A;Lo;0;L;5599;;;;N;;;;;
+FA7B;CJK COMPATIBILITY IDEOGRAPH-FA7B;Lo;0;L;55E2;;;;N;;;;;
+FA7C;CJK COMPATIBILITY IDEOGRAPH-FA7C;Lo;0;L;585A;;;;N;;;;;
+FA7D;CJK COMPATIBILITY IDEOGRAPH-FA7D;Lo;0;L;58B3;;;;N;;;;;
+FA7E;CJK COMPATIBILITY IDEOGRAPH-FA7E;Lo;0;L;5944;;;;N;;;;;
+FA7F;CJK COMPATIBILITY IDEOGRAPH-FA7F;Lo;0;L;5954;;;;N;;;;;
+FA80;CJK COMPATIBILITY IDEOGRAPH-FA80;Lo;0;L;5A62;;;;N;;;;;
+FA81;CJK COMPATIBILITY IDEOGRAPH-FA81;Lo;0;L;5B28;;;;N;;;;;
+FA82;CJK COMPATIBILITY IDEOGRAPH-FA82;Lo;0;L;5ED2;;;;N;;;;;
+FA83;CJK COMPATIBILITY IDEOGRAPH-FA83;Lo;0;L;5ED9;;;;N;;;;;
+FA84;CJK COMPATIBILITY IDEOGRAPH-FA84;Lo;0;L;5F69;;;;N;;;;;
+FA85;CJK COMPATIBILITY IDEOGRAPH-FA85;Lo;0;L;5FAD;;;;N;;;;;
+FA86;CJK COMPATIBILITY IDEOGRAPH-FA86;Lo;0;L;60D8;;;;N;;;;;
+FA87;CJK COMPATIBILITY IDEOGRAPH-FA87;Lo;0;L;614E;;;;N;;;;;
+FA88;CJK COMPATIBILITY IDEOGRAPH-FA88;Lo;0;L;6108;;;;N;;;;;
+FA89;CJK COMPATIBILITY IDEOGRAPH-FA89;Lo;0;L;618E;;;;N;;;;;
+FA8A;CJK COMPATIBILITY IDEOGRAPH-FA8A;Lo;0;L;6160;;;;N;;;;;
+FA8B;CJK COMPATIBILITY IDEOGRAPH-FA8B;Lo;0;L;61F2;;;;N;;;;;
+FA8C;CJK COMPATIBILITY IDEOGRAPH-FA8C;Lo;0;L;6234;;;;N;;;;;
+FA8D;CJK COMPATIBILITY IDEOGRAPH-FA8D;Lo;0;L;63C4;;;;N;;;;;
+FA8E;CJK COMPATIBILITY IDEOGRAPH-FA8E;Lo;0;L;641C;;;;N;;;;;
+FA8F;CJK COMPATIBILITY IDEOGRAPH-FA8F;Lo;0;L;6452;;;;N;;;;;
+FA90;CJK COMPATIBILITY IDEOGRAPH-FA90;Lo;0;L;6556;;;;N;;;;;
+FA91;CJK COMPATIBILITY IDEOGRAPH-FA91;Lo;0;L;6674;;;;N;;;;;
+FA92;CJK COMPATIBILITY IDEOGRAPH-FA92;Lo;0;L;6717;;;;N;;;;;
+FA93;CJK COMPATIBILITY IDEOGRAPH-FA93;Lo;0;L;671B;;;;N;;;;;
+FA94;CJK COMPATIBILITY IDEOGRAPH-FA94;Lo;0;L;6756;;;;N;;;;;
+FA95;CJK COMPATIBILITY IDEOGRAPH-FA95;Lo;0;L;6B79;;;;N;;;;;
+FA96;CJK COMPATIBILITY IDEOGRAPH-FA96;Lo;0;L;6BBA;;;;N;;;;;
+FA97;CJK COMPATIBILITY IDEOGRAPH-FA97;Lo;0;L;6D41;;;;N;;;;;
+FA98;CJK COMPATIBILITY IDEOGRAPH-FA98;Lo;0;L;6EDB;;;;N;;;;;
+FA99;CJK COMPATIBILITY IDEOGRAPH-FA99;Lo;0;L;6ECB;;;;N;;;;;
+FA9A;CJK COMPATIBILITY IDEOGRAPH-FA9A;Lo;0;L;6F22;;;;N;;;;;
+FA9B;CJK COMPATIBILITY IDEOGRAPH-FA9B;Lo;0;L;701E;;;;N;;;;;
+FA9C;CJK COMPATIBILITY IDEOGRAPH-FA9C;Lo;0;L;716E;;;;N;;;;;
+FA9D;CJK COMPATIBILITY IDEOGRAPH-FA9D;Lo;0;L;77A7;;;;N;;;;;
+FA9E;CJK COMPATIBILITY IDEOGRAPH-FA9E;Lo;0;L;7235;;;;N;;;;;
+FA9F;CJK COMPATIBILITY IDEOGRAPH-FA9F;Lo;0;L;72AF;;;;N;;;;;
+FAA0;CJK COMPATIBILITY IDEOGRAPH-FAA0;Lo;0;L;732A;;;;N;;;;;
+FAA1;CJK COMPATIBILITY IDEOGRAPH-FAA1;Lo;0;L;7471;;;;N;;;;;
+FAA2;CJK COMPATIBILITY IDEOGRAPH-FAA2;Lo;0;L;7506;;;;N;;;;;
+FAA3;CJK COMPATIBILITY IDEOGRAPH-FAA3;Lo;0;L;753B;;;;N;;;;;
+FAA4;CJK COMPATIBILITY IDEOGRAPH-FAA4;Lo;0;L;761D;;;;N;;;;;
+FAA5;CJK COMPATIBILITY IDEOGRAPH-FAA5;Lo;0;L;761F;;;;N;;;;;
+FAA6;CJK COMPATIBILITY IDEOGRAPH-FAA6;Lo;0;L;76CA;;;;N;;;;;
+FAA7;CJK COMPATIBILITY IDEOGRAPH-FAA7;Lo;0;L;76DB;;;;N;;;;;
+FAA8;CJK COMPATIBILITY IDEOGRAPH-FAA8;Lo;0;L;76F4;;;;N;;;;;
+FAA9;CJK COMPATIBILITY IDEOGRAPH-FAA9;Lo;0;L;774A;;;;N;;;;;
+FAAA;CJK COMPATIBILITY IDEOGRAPH-FAAA;Lo;0;L;7740;;;;N;;;;;
+FAAB;CJK COMPATIBILITY IDEOGRAPH-FAAB;Lo;0;L;78CC;;;;N;;;;;
+FAAC;CJK COMPATIBILITY IDEOGRAPH-FAAC;Lo;0;L;7AB1;;;;N;;;;;
+FAAD;CJK COMPATIBILITY IDEOGRAPH-FAAD;Lo;0;L;7BC0;;;;N;;;;;
+FAAE;CJK COMPATIBILITY IDEOGRAPH-FAAE;Lo;0;L;7C7B;;;;N;;;;;
+FAAF;CJK COMPATIBILITY IDEOGRAPH-FAAF;Lo;0;L;7D5B;;;;N;;;;;
+FAB0;CJK COMPATIBILITY IDEOGRAPH-FAB0;Lo;0;L;7DF4;;;;N;;;;;
+FAB1;CJK COMPATIBILITY IDEOGRAPH-FAB1;Lo;0;L;7F3E;;;;N;;;;;
+FAB2;CJK COMPATIBILITY IDEOGRAPH-FAB2;Lo;0;L;8005;;;;N;;;;;
+FAB3;CJK COMPATIBILITY IDEOGRAPH-FAB3;Lo;0;L;8352;;;;N;;;;;
+FAB4;CJK COMPATIBILITY IDEOGRAPH-FAB4;Lo;0;L;83EF;;;;N;;;;;
+FAB5;CJK COMPATIBILITY IDEOGRAPH-FAB5;Lo;0;L;8779;;;;N;;;;;
+FAB6;CJK COMPATIBILITY IDEOGRAPH-FAB6;Lo;0;L;8941;;;;N;;;;;
+FAB7;CJK COMPATIBILITY IDEOGRAPH-FAB7;Lo;0;L;8986;;;;N;;;;;
+FAB8;CJK COMPATIBILITY IDEOGRAPH-FAB8;Lo;0;L;8996;;;;N;;;;;
+FAB9;CJK COMPATIBILITY IDEOGRAPH-FAB9;Lo;0;L;8ABF;;;;N;;;;;
+FABA;CJK COMPATIBILITY IDEOGRAPH-FABA;Lo;0;L;8AF8;;;;N;;;;;
+FABB;CJK COMPATIBILITY IDEOGRAPH-FABB;Lo;0;L;8ACB;;;;N;;;;;
+FABC;CJK COMPATIBILITY IDEOGRAPH-FABC;Lo;0;L;8B01;;;;N;;;;;
+FABD;CJK COMPATIBILITY IDEOGRAPH-FABD;Lo;0;L;8AFE;;;;N;;;;;
+FABE;CJK COMPATIBILITY IDEOGRAPH-FABE;Lo;0;L;8AED;;;;N;;;;;
+FABF;CJK COMPATIBILITY IDEOGRAPH-FABF;Lo;0;L;8B39;;;;N;;;;;
+FAC0;CJK COMPATIBILITY IDEOGRAPH-FAC0;Lo;0;L;8B8A;;;;N;;;;;
+FAC1;CJK COMPATIBILITY IDEOGRAPH-FAC1;Lo;0;L;8D08;;;;N;;;;;
+FAC2;CJK COMPATIBILITY IDEOGRAPH-FAC2;Lo;0;L;8F38;;;;N;;;;;
+FAC3;CJK COMPATIBILITY IDEOGRAPH-FAC3;Lo;0;L;9072;;;;N;;;;;
+FAC4;CJK COMPATIBILITY IDEOGRAPH-FAC4;Lo;0;L;9199;;;;N;;;;;
+FAC5;CJK COMPATIBILITY IDEOGRAPH-FAC5;Lo;0;L;9276;;;;N;;;;;
+FAC6;CJK COMPATIBILITY IDEOGRAPH-FAC6;Lo;0;L;967C;;;;N;;;;;
+FAC7;CJK COMPATIBILITY IDEOGRAPH-FAC7;Lo;0;L;96E3;;;;N;;;;;
+FAC8;CJK COMPATIBILITY IDEOGRAPH-FAC8;Lo;0;L;9756;;;;N;;;;;
+FAC9;CJK COMPATIBILITY IDEOGRAPH-FAC9;Lo;0;L;97DB;;;;N;;;;;
+FACA;CJK COMPATIBILITY IDEOGRAPH-FACA;Lo;0;L;97FF;;;;N;;;;;
+FACB;CJK COMPATIBILITY IDEOGRAPH-FACB;Lo;0;L;980B;;;;N;;;;;
+FACC;CJK COMPATIBILITY IDEOGRAPH-FACC;Lo;0;L;983B;;;;N;;;;;
+FACD;CJK COMPATIBILITY IDEOGRAPH-FACD;Lo;0;L;9B12;;;;N;;;;;
+FACE;CJK COMPATIBILITY IDEOGRAPH-FACE;Lo;0;L;9F9C;;;;N;;;;;
+FACF;CJK COMPATIBILITY IDEOGRAPH-FACF;Lo;0;L;2284A;;;;N;;;;;
+FAD0;CJK COMPATIBILITY IDEOGRAPH-FAD0;Lo;0;L;22844;;;;N;;;;;
+FAD1;CJK COMPATIBILITY IDEOGRAPH-FAD1;Lo;0;L;233D5;;;;N;;;;;
+FAD2;CJK COMPATIBILITY IDEOGRAPH-FAD2;Lo;0;L;3B9D;;;;N;;;;;
+FAD3;CJK COMPATIBILITY IDEOGRAPH-FAD3;Lo;0;L;4018;;;;N;;;;;
+FAD4;CJK COMPATIBILITY IDEOGRAPH-FAD4;Lo;0;L;4039;;;;N;;;;;
+FAD5;CJK COMPATIBILITY IDEOGRAPH-FAD5;Lo;0;L;25249;;;;N;;;;;
+FAD6;CJK COMPATIBILITY IDEOGRAPH-FAD6;Lo;0;L;25CD0;;;;N;;;;;
+FAD7;CJK COMPATIBILITY IDEOGRAPH-FAD7;Lo;0;L;27ED3;;;;N;;;;;
+FAD8;CJK COMPATIBILITY IDEOGRAPH-FAD8;Lo;0;L;9F43;;;;N;;;;;
+FAD9;CJK COMPATIBILITY IDEOGRAPH-FAD9;Lo;0;L;9F8E;;;;N;;;;;
+FB00;LATIN SMALL LIGATURE FF;Ll;0;L;<compat> 0066 0066;;;;N;;;;;
+FB01;LATIN SMALL LIGATURE FI;Ll;0;L;<compat> 0066 0069;;;;N;;;;;
+FB02;LATIN SMALL LIGATURE FL;Ll;0;L;<compat> 0066 006C;;;;N;;;;;
+FB03;LATIN SMALL LIGATURE FFI;Ll;0;L;<compat> 0066 0066 0069;;;;N;;;;;
+FB04;LATIN SMALL LIGATURE FFL;Ll;0;L;<compat> 0066 0066 006C;;;;N;;;;;
+FB05;LATIN SMALL LIGATURE LONG S T;Ll;0;L;<compat> 017F 0074;;;;N;;;;;
+FB06;LATIN SMALL LIGATURE ST;Ll;0;L;<compat> 0073 0074;;;;N;;;;;
+FB13;ARMENIAN SMALL LIGATURE MEN NOW;Ll;0;L;<compat> 0574 0576;;;;N;;;;;
+FB14;ARMENIAN SMALL LIGATURE MEN ECH;Ll;0;L;<compat> 0574 0565;;;;N;;;;;
+FB15;ARMENIAN SMALL LIGATURE MEN INI;Ll;0;L;<compat> 0574 056B;;;;N;;;;;
+FB16;ARMENIAN SMALL LIGATURE VEW NOW;Ll;0;L;<compat> 057E 0576;;;;N;;;;;
+FB17;ARMENIAN SMALL LIGATURE MEN XEH;Ll;0;L;<compat> 0574 056D;;;;N;;;;;
+FB1D;HEBREW LETTER YOD WITH HIRIQ;Lo;0;R;05D9 05B4;;;;N;;;;;
+FB1E;HEBREW POINT JUDEO-SPANISH VARIKA;Mn;26;NSM;;;;;N;HEBREW POINT VARIKA;;;;
+FB1F;HEBREW LIGATURE YIDDISH YOD YOD PATAH;Lo;0;R;05F2 05B7;;;;N;;;;;
+FB20;HEBREW LETTER ALTERNATIVE AYIN;Lo;0;R;<font> 05E2;;;;N;;;;;
+FB21;HEBREW LETTER WIDE ALEF;Lo;0;R;<font> 05D0;;;;N;;;;;
+FB22;HEBREW LETTER WIDE DALET;Lo;0;R;<font> 05D3;;;;N;;;;;
+FB23;HEBREW LETTER WIDE HE;Lo;0;R;<font> 05D4;;;;N;;;;;
+FB24;HEBREW LETTER WIDE KAF;Lo;0;R;<font> 05DB;;;;N;;;;;
+FB25;HEBREW LETTER WIDE LAMED;Lo;0;R;<font> 05DC;;;;N;;;;;
+FB26;HEBREW LETTER WIDE FINAL MEM;Lo;0;R;<font> 05DD;;;;N;;;;;
+FB27;HEBREW LETTER WIDE RESH;Lo;0;R;<font> 05E8;;;;N;;;;;
+FB28;HEBREW LETTER WIDE TAV;Lo;0;R;<font> 05EA;;;;N;;;;;
+FB29;HEBREW LETTER ALTERNATIVE PLUS SIGN;Sm;0;ES;<font> 002B;;;;N;;;;;
+FB2A;HEBREW LETTER SHIN WITH SHIN DOT;Lo;0;R;05E9 05C1;;;;N;;;;;
+FB2B;HEBREW LETTER SHIN WITH SIN DOT;Lo;0;R;05E9 05C2;;;;N;;;;;
+FB2C;HEBREW LETTER SHIN WITH DAGESH AND SHIN DOT;Lo;0;R;FB49 05C1;;;;N;;;;;
+FB2D;HEBREW LETTER SHIN WITH DAGESH AND SIN DOT;Lo;0;R;FB49 05C2;;;;N;;;;;
+FB2E;HEBREW LETTER ALEF WITH PATAH;Lo;0;R;05D0 05B7;;;;N;;;;;
+FB2F;HEBREW LETTER ALEF WITH QAMATS;Lo;0;R;05D0 05B8;;;;N;;;;;
+FB30;HEBREW LETTER ALEF WITH MAPIQ;Lo;0;R;05D0 05BC;;;;N;;;;;
+FB31;HEBREW LETTER BET WITH DAGESH;Lo;0;R;05D1 05BC;;;;N;;;;;
+FB32;HEBREW LETTER GIMEL WITH DAGESH;Lo;0;R;05D2 05BC;;;;N;;;;;
+FB33;HEBREW LETTER DALET WITH DAGESH;Lo;0;R;05D3 05BC;;;;N;;;;;
+FB34;HEBREW LETTER HE WITH MAPIQ;Lo;0;R;05D4 05BC;;;;N;;;;;
+FB35;HEBREW LETTER VAV WITH DAGESH;Lo;0;R;05D5 05BC;;;;N;;;;;
+FB36;HEBREW LETTER ZAYIN WITH DAGESH;Lo;0;R;05D6 05BC;;;;N;;;;;
+FB38;HEBREW LETTER TET WITH DAGESH;Lo;0;R;05D8 05BC;;;;N;;;;;
+FB39;HEBREW LETTER YOD WITH DAGESH;Lo;0;R;05D9 05BC;;;;N;;;;;
+FB3A;HEBREW LETTER FINAL KAF WITH DAGESH;Lo;0;R;05DA 05BC;;;;N;;;;;
+FB3B;HEBREW LETTER KAF WITH DAGESH;Lo;0;R;05DB 05BC;;;;N;;;;;
+FB3C;HEBREW LETTER LAMED WITH DAGESH;Lo;0;R;05DC 05BC;;;;N;;;;;
+FB3E;HEBREW LETTER MEM WITH DAGESH;Lo;0;R;05DE 05BC;;;;N;;;;;
+FB40;HEBREW LETTER NUN WITH DAGESH;Lo;0;R;05E0 05BC;;;;N;;;;;
+FB41;HEBREW LETTER SAMEKH WITH DAGESH;Lo;0;R;05E1 05BC;;;;N;;;;;
+FB43;HEBREW LETTER FINAL PE WITH DAGESH;Lo;0;R;05E3 05BC;;;;N;;;;;
+FB44;HEBREW LETTER PE WITH DAGESH;Lo;0;R;05E4 05BC;;;;N;;;;;
+FB46;HEBREW LETTER TSADI WITH DAGESH;Lo;0;R;05E6 05BC;;;;N;;;;;
+FB47;HEBREW LETTER QOF WITH DAGESH;Lo;0;R;05E7 05BC;;;;N;;;;;
+FB48;HEBREW LETTER RESH WITH DAGESH;Lo;0;R;05E8 05BC;;;;N;;;;;
+FB49;HEBREW LETTER SHIN WITH DAGESH;Lo;0;R;05E9 05BC;;;;N;;;;;
+FB4A;HEBREW LETTER TAV WITH DAGESH;Lo;0;R;05EA 05BC;;;;N;;;;;
+FB4B;HEBREW LETTER VAV WITH HOLAM;Lo;0;R;05D5 05B9;;;;N;;;;;
+FB4C;HEBREW LETTER BET WITH RAFE;Lo;0;R;05D1 05BF;;;;N;;;;;
+FB4D;HEBREW LETTER KAF WITH RAFE;Lo;0;R;05DB 05BF;;;;N;;;;;
+FB4E;HEBREW LETTER PE WITH RAFE;Lo;0;R;05E4 05BF;;;;N;;;;;
+FB4F;HEBREW LIGATURE ALEF LAMED;Lo;0;R;<compat> 05D0 05DC;;;;N;;;;;
+FB50;ARABIC LETTER ALEF WASLA ISOLATED FORM;Lo;0;AL;<isolated> 0671;;;;N;;;;;
+FB51;ARABIC LETTER ALEF WASLA FINAL FORM;Lo;0;AL;<final> 0671;;;;N;;;;;
+FB52;ARABIC LETTER BEEH ISOLATED FORM;Lo;0;AL;<isolated> 067B;;;;N;;;;;
+FB53;ARABIC LETTER BEEH FINAL FORM;Lo;0;AL;<final> 067B;;;;N;;;;;
+FB54;ARABIC LETTER BEEH INITIAL FORM;Lo;0;AL;<initial> 067B;;;;N;;;;;
+FB55;ARABIC LETTER BEEH MEDIAL FORM;Lo;0;AL;<medial> 067B;;;;N;;;;;
+FB56;ARABIC LETTER PEH ISOLATED FORM;Lo;0;AL;<isolated> 067E;;;;N;;;;;
+FB57;ARABIC LETTER PEH FINAL FORM;Lo;0;AL;<final> 067E;;;;N;;;;;
+FB58;ARABIC LETTER PEH INITIAL FORM;Lo;0;AL;<initial> 067E;;;;N;;;;;
+FB59;ARABIC LETTER PEH MEDIAL FORM;Lo;0;AL;<medial> 067E;;;;N;;;;;
+FB5A;ARABIC LETTER BEHEH ISOLATED FORM;Lo;0;AL;<isolated> 0680;;;;N;;;;;
+FB5B;ARABIC LETTER BEHEH FINAL FORM;Lo;0;AL;<final> 0680;;;;N;;;;;
+FB5C;ARABIC LETTER BEHEH INITIAL FORM;Lo;0;AL;<initial> 0680;;;;N;;;;;
+FB5D;ARABIC LETTER BEHEH MEDIAL FORM;Lo;0;AL;<medial> 0680;;;;N;;;;;
+FB5E;ARABIC LETTER TTEHEH ISOLATED FORM;Lo;0;AL;<isolated> 067A;;;;N;;;;;
+FB5F;ARABIC LETTER TTEHEH FINAL FORM;Lo;0;AL;<final> 067A;;;;N;;;;;
+FB60;ARABIC LETTER TTEHEH INITIAL FORM;Lo;0;AL;<initial> 067A;;;;N;;;;;
+FB61;ARABIC LETTER TTEHEH MEDIAL FORM;Lo;0;AL;<medial> 067A;;;;N;;;;;
+FB62;ARABIC LETTER TEHEH ISOLATED FORM;Lo;0;AL;<isolated> 067F;;;;N;;;;;
+FB63;ARABIC LETTER TEHEH FINAL FORM;Lo;0;AL;<final> 067F;;;;N;;;;;
+FB64;ARABIC LETTER TEHEH INITIAL FORM;Lo;0;AL;<initial> 067F;;;;N;;;;;
+FB65;ARABIC LETTER TEHEH MEDIAL FORM;Lo;0;AL;<medial> 067F;;;;N;;;;;
+FB66;ARABIC LETTER TTEH ISOLATED FORM;Lo;0;AL;<isolated> 0679;;;;N;;;;;
+FB67;ARABIC LETTER TTEH FINAL FORM;Lo;0;AL;<final> 0679;;;;N;;;;;
+FB68;ARABIC LETTER TTEH INITIAL FORM;Lo;0;AL;<initial> 0679;;;;N;;;;;
+FB69;ARABIC LETTER TTEH MEDIAL FORM;Lo;0;AL;<medial> 0679;;;;N;;;;;
+FB6A;ARABIC LETTER VEH ISOLATED FORM;Lo;0;AL;<isolated> 06A4;;;;N;;;;;
+FB6B;ARABIC LETTER VEH FINAL FORM;Lo;0;AL;<final> 06A4;;;;N;;;;;
+FB6C;ARABIC LETTER VEH INITIAL FORM;Lo;0;AL;<initial> 06A4;;;;N;;;;;
+FB6D;ARABIC LETTER VEH MEDIAL FORM;Lo;0;AL;<medial> 06A4;;;;N;;;;;
+FB6E;ARABIC LETTER PEHEH ISOLATED FORM;Lo;0;AL;<isolated> 06A6;;;;N;;;;;
+FB6F;ARABIC LETTER PEHEH FINAL FORM;Lo;0;AL;<final> 06A6;;;;N;;;;;
+FB70;ARABIC LETTER PEHEH INITIAL FORM;Lo;0;AL;<initial> 06A6;;;;N;;;;;
+FB71;ARABIC LETTER PEHEH MEDIAL FORM;Lo;0;AL;<medial> 06A6;;;;N;;;;;
+FB72;ARABIC LETTER DYEH ISOLATED FORM;Lo;0;AL;<isolated> 0684;;;;N;;;;;
+FB73;ARABIC LETTER DYEH FINAL FORM;Lo;0;AL;<final> 0684;;;;N;;;;;
+FB74;ARABIC LETTER DYEH INITIAL FORM;Lo;0;AL;<initial> 0684;;;;N;;;;;
+FB75;ARABIC LETTER DYEH MEDIAL FORM;Lo;0;AL;<medial> 0684;;;;N;;;;;
+FB76;ARABIC LETTER NYEH ISOLATED FORM;Lo;0;AL;<isolated> 0683;;;;N;;;;;
+FB77;ARABIC LETTER NYEH FINAL FORM;Lo;0;AL;<final> 0683;;;;N;;;;;
+FB78;ARABIC LETTER NYEH INITIAL FORM;Lo;0;AL;<initial> 0683;;;;N;;;;;
+FB79;ARABIC LETTER NYEH MEDIAL FORM;Lo;0;AL;<medial> 0683;;;;N;;;;;
+FB7A;ARABIC LETTER TCHEH ISOLATED FORM;Lo;0;AL;<isolated> 0686;;;;N;;;;;
+FB7B;ARABIC LETTER TCHEH FINAL FORM;Lo;0;AL;<final> 0686;;;;N;;;;;
+FB7C;ARABIC LETTER TCHEH INITIAL FORM;Lo;0;AL;<initial> 0686;;;;N;;;;;
+FB7D;ARABIC LETTER TCHEH MEDIAL FORM;Lo;0;AL;<medial> 0686;;;;N;;;;;
+FB7E;ARABIC LETTER TCHEHEH ISOLATED FORM;Lo;0;AL;<isolated> 0687;;;;N;;;;;
+FB7F;ARABIC LETTER TCHEHEH FINAL FORM;Lo;0;AL;<final> 0687;;;;N;;;;;
+FB80;ARABIC LETTER TCHEHEH INITIAL FORM;Lo;0;AL;<initial> 0687;;;;N;;;;;
+FB81;ARABIC LETTER TCHEHEH MEDIAL FORM;Lo;0;AL;<medial> 0687;;;;N;;;;;
+FB82;ARABIC LETTER DDAHAL ISOLATED FORM;Lo;0;AL;<isolated> 068D;;;;N;;;;;
+FB83;ARABIC LETTER DDAHAL FINAL FORM;Lo;0;AL;<final> 068D;;;;N;;;;;
+FB84;ARABIC LETTER DAHAL ISOLATED FORM;Lo;0;AL;<isolated> 068C;;;;N;;;;;
+FB85;ARABIC LETTER DAHAL FINAL FORM;Lo;0;AL;<final> 068C;;;;N;;;;;
+FB86;ARABIC LETTER DUL ISOLATED FORM;Lo;0;AL;<isolated> 068E;;;;N;;;;;
+FB87;ARABIC LETTER DUL FINAL FORM;Lo;0;AL;<final> 068E;;;;N;;;;;
+FB88;ARABIC LETTER DDAL ISOLATED FORM;Lo;0;AL;<isolated> 0688;;;;N;;;;;
+FB89;ARABIC LETTER DDAL FINAL FORM;Lo;0;AL;<final> 0688;;;;N;;;;;
+FB8A;ARABIC LETTER JEH ISOLATED FORM;Lo;0;AL;<isolated> 0698;;;;N;;;;;
+FB8B;ARABIC LETTER JEH FINAL FORM;Lo;0;AL;<final> 0698;;;;N;;;;;
+FB8C;ARABIC LETTER RREH ISOLATED FORM;Lo;0;AL;<isolated> 0691;;;;N;;;;;
+FB8D;ARABIC LETTER RREH FINAL FORM;Lo;0;AL;<final> 0691;;;;N;;;;;
+FB8E;ARABIC LETTER KEHEH ISOLATED FORM;Lo;0;AL;<isolated> 06A9;;;;N;;;;;
+FB8F;ARABIC LETTER KEHEH FINAL FORM;Lo;0;AL;<final> 06A9;;;;N;;;;;
+FB90;ARABIC LETTER KEHEH INITIAL FORM;Lo;0;AL;<initial> 06A9;;;;N;;;;;
+FB91;ARABIC LETTER KEHEH MEDIAL FORM;Lo;0;AL;<medial> 06A9;;;;N;;;;;
+FB92;ARABIC LETTER GAF ISOLATED FORM;Lo;0;AL;<isolated> 06AF;;;;N;;;;;
+FB93;ARABIC LETTER GAF FINAL FORM;Lo;0;AL;<final> 06AF;;;;N;;;;;
+FB94;ARABIC LETTER GAF INITIAL FORM;Lo;0;AL;<initial> 06AF;;;;N;;;;;
+FB95;ARABIC LETTER GAF MEDIAL FORM;Lo;0;AL;<medial> 06AF;;;;N;;;;;
+FB96;ARABIC LETTER GUEH ISOLATED FORM;Lo;0;AL;<isolated> 06B3;;;;N;;;;;
+FB97;ARABIC LETTER GUEH FINAL FORM;Lo;0;AL;<final> 06B3;;;;N;;;;;
+FB98;ARABIC LETTER GUEH INITIAL FORM;Lo;0;AL;<initial> 06B3;;;;N;;;;;
+FB99;ARABIC LETTER GUEH MEDIAL FORM;Lo;0;AL;<medial> 06B3;;;;N;;;;;
+FB9A;ARABIC LETTER NGOEH ISOLATED FORM;Lo;0;AL;<isolated> 06B1;;;;N;;;;;
+FB9B;ARABIC LETTER NGOEH FINAL FORM;Lo;0;AL;<final> 06B1;;;;N;;;;;
+FB9C;ARABIC LETTER NGOEH INITIAL FORM;Lo;0;AL;<initial> 06B1;;;;N;;;;;
+FB9D;ARABIC LETTER NGOEH MEDIAL FORM;Lo;0;AL;<medial> 06B1;;;;N;;;;;
+FB9E;ARABIC LETTER NOON GHUNNA ISOLATED FORM;Lo;0;AL;<isolated> 06BA;;;;N;;;;;
+FB9F;ARABIC LETTER NOON GHUNNA FINAL FORM;Lo;0;AL;<final> 06BA;;;;N;;;;;
+FBA0;ARABIC LETTER RNOON ISOLATED FORM;Lo;0;AL;<isolated> 06BB;;;;N;;;;;
+FBA1;ARABIC LETTER RNOON FINAL FORM;Lo;0;AL;<final> 06BB;;;;N;;;;;
+FBA2;ARABIC LETTER RNOON INITIAL FORM;Lo;0;AL;<initial> 06BB;;;;N;;;;;
+FBA3;ARABIC LETTER RNOON MEDIAL FORM;Lo;0;AL;<medial> 06BB;;;;N;;;;;
+FBA4;ARABIC LETTER HEH WITH YEH ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 06C0;;;;N;;;;;
+FBA5;ARABIC LETTER HEH WITH YEH ABOVE FINAL FORM;Lo;0;AL;<final> 06C0;;;;N;;;;;
+FBA6;ARABIC LETTER HEH GOAL ISOLATED FORM;Lo;0;AL;<isolated> 06C1;;;;N;;;;;
+FBA7;ARABIC LETTER HEH GOAL FINAL FORM;Lo;0;AL;<final> 06C1;;;;N;;;;;
+FBA8;ARABIC LETTER HEH GOAL INITIAL FORM;Lo;0;AL;<initial> 06C1;;;;N;;;;;
+FBA9;ARABIC LETTER HEH GOAL MEDIAL FORM;Lo;0;AL;<medial> 06C1;;;;N;;;;;
+FBAA;ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM;Lo;0;AL;<isolated> 06BE;;;;N;;;;;
+FBAB;ARABIC LETTER HEH DOACHASHMEE FINAL FORM;Lo;0;AL;<final> 06BE;;;;N;;;;;
+FBAC;ARABIC LETTER HEH DOACHASHMEE INITIAL FORM;Lo;0;AL;<initial> 06BE;;;;N;;;;;
+FBAD;ARABIC LETTER HEH DOACHASHMEE MEDIAL FORM;Lo;0;AL;<medial> 06BE;;;;N;;;;;
+FBAE;ARABIC LETTER YEH BARREE ISOLATED FORM;Lo;0;AL;<isolated> 06D2;;;;N;;;;;
+FBAF;ARABIC LETTER YEH BARREE FINAL FORM;Lo;0;AL;<final> 06D2;;;;N;;;;;
+FBB0;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 06D3;;;;N;;;;;
+FBB1;ARABIC LETTER YEH BARREE WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 06D3;;;;N;;;;;
+FBD3;ARABIC LETTER NG ISOLATED FORM;Lo;0;AL;<isolated> 06AD;;;;N;;;;;
+FBD4;ARABIC LETTER NG FINAL FORM;Lo;0;AL;<final> 06AD;;;;N;;;;;
+FBD5;ARABIC LETTER NG INITIAL FORM;Lo;0;AL;<initial> 06AD;;;;N;;;;;
+FBD6;ARABIC LETTER NG MEDIAL FORM;Lo;0;AL;<medial> 06AD;;;;N;;;;;
+FBD7;ARABIC LETTER U ISOLATED FORM;Lo;0;AL;<isolated> 06C7;;;;N;;;;;
+FBD8;ARABIC LETTER U FINAL FORM;Lo;0;AL;<final> 06C7;;;;N;;;;;
+FBD9;ARABIC LETTER OE ISOLATED FORM;Lo;0;AL;<isolated> 06C6;;;;N;;;;;
+FBDA;ARABIC LETTER OE FINAL FORM;Lo;0;AL;<final> 06C6;;;;N;;;;;
+FBDB;ARABIC LETTER YU ISOLATED FORM;Lo;0;AL;<isolated> 06C8;;;;N;;;;;
+FBDC;ARABIC LETTER YU FINAL FORM;Lo;0;AL;<final> 06C8;;;;N;;;;;
+FBDD;ARABIC LETTER U WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0677;;;;N;;;;;
+FBDE;ARABIC LETTER VE ISOLATED FORM;Lo;0;AL;<isolated> 06CB;;;;N;;;;;
+FBDF;ARABIC LETTER VE FINAL FORM;Lo;0;AL;<final> 06CB;;;;N;;;;;
+FBE0;ARABIC LETTER KIRGHIZ OE ISOLATED FORM;Lo;0;AL;<isolated> 06C5;;;;N;;;;;
+FBE1;ARABIC LETTER KIRGHIZ OE FINAL FORM;Lo;0;AL;<final> 06C5;;;;N;;;;;
+FBE2;ARABIC LETTER KIRGHIZ YU ISOLATED FORM;Lo;0;AL;<isolated> 06C9;;;;N;;;;;
+FBE3;ARABIC LETTER KIRGHIZ YU FINAL FORM;Lo;0;AL;<final> 06C9;;;;N;;;;;
+FBE4;ARABIC LETTER E ISOLATED FORM;Lo;0;AL;<isolated> 06D0;;;;N;;;;;
+FBE5;ARABIC LETTER E FINAL FORM;Lo;0;AL;<final> 06D0;;;;N;;;;;
+FBE6;ARABIC LETTER E INITIAL FORM;Lo;0;AL;<initial> 06D0;;;;N;;;;;
+FBE7;ARABIC LETTER E MEDIAL FORM;Lo;0;AL;<medial> 06D0;;;;N;;;;;
+FBE8;ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA INITIAL FORM;Lo;0;AL;<initial> 0649;;;;N;;;;;
+FBE9;ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA MEDIAL FORM;Lo;0;AL;<medial> 0649;;;;N;;;;;
+FBEA;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0626 0627;;;;N;;;;;
+FBEB;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF FINAL FORM;Lo;0;AL;<final> 0626 0627;;;;N;;;;;
+FBEC;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH AE ISOLATED FORM;Lo;0;AL;<isolated> 0626 06D5;;;;N;;;;;
+FBED;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH AE FINAL FORM;Lo;0;AL;<final> 0626 06D5;;;;N;;;;;
+FBEE;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH WAW ISOLATED FORM;Lo;0;AL;<isolated> 0626 0648;;;;N;;;;;
+FBEF;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH WAW FINAL FORM;Lo;0;AL;<final> 0626 0648;;;;N;;;;;
+FBF0;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH U ISOLATED FORM;Lo;0;AL;<isolated> 0626 06C7;;;;N;;;;;
+FBF1;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH U FINAL FORM;Lo;0;AL;<final> 0626 06C7;;;;N;;;;;
+FBF2;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH OE ISOLATED FORM;Lo;0;AL;<isolated> 0626 06C6;;;;N;;;;;
+FBF3;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH OE FINAL FORM;Lo;0;AL;<final> 0626 06C6;;;;N;;;;;
+FBF4;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YU ISOLATED FORM;Lo;0;AL;<isolated> 0626 06C8;;;;N;;;;;
+FBF5;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YU FINAL FORM;Lo;0;AL;<final> 0626 06C8;;;;N;;;;;
+FBF6;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E ISOLATED FORM;Lo;0;AL;<isolated> 0626 06D0;;;;N;;;;;
+FBF7;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E FINAL FORM;Lo;0;AL;<final> 0626 06D0;;;;N;;;;;
+FBF8;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E INITIAL FORM;Lo;0;AL;<initial> 0626 06D0;;;;N;;;;;
+FBF9;ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0626 0649;;;;N;;;;;
+FBFA;ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0626 0649;;;;N;;;;;
+FBFB;ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA INITIAL FORM;Lo;0;AL;<initial> 0626 0649;;;;N;;;;;
+FBFC;ARABIC LETTER FARSI YEH ISOLATED FORM;Lo;0;AL;<isolated> 06CC;;;;N;;;;;
+FBFD;ARABIC LETTER FARSI YEH FINAL FORM;Lo;0;AL;<final> 06CC;;;;N;;;;;
+FBFE;ARABIC LETTER FARSI YEH INITIAL FORM;Lo;0;AL;<initial> 06CC;;;;N;;;;;
+FBFF;ARABIC LETTER FARSI YEH MEDIAL FORM;Lo;0;AL;<medial> 06CC;;;;N;;;;;
+FC00;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0626 062C;;;;N;;;;;
+FC01;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0626 062D;;;;N;;;;;
+FC02;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0626 0645;;;;N;;;;;
+FC03;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0626 0649;;;;N;;;;;
+FC04;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0626 064A;;;;N;;;;;
+FC05;ARABIC LIGATURE BEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0628 062C;;;;N;;;;;
+FC06;ARABIC LIGATURE BEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0628 062D;;;;N;;;;;
+FC07;ARABIC LIGATURE BEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0628 062E;;;;N;;;;;
+FC08;ARABIC LIGATURE BEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0628 0645;;;;N;;;;;
+FC09;ARABIC LIGATURE BEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0628 0649;;;;N;;;;;
+FC0A;ARABIC LIGATURE BEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0628 064A;;;;N;;;;;
+FC0B;ARABIC LIGATURE TEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062A 062C;;;;N;;;;;
+FC0C;ARABIC LIGATURE TEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 062A 062D;;;;N;;;;;
+FC0D;ARABIC LIGATURE TEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 062A 062E;;;;N;;;;;
+FC0E;ARABIC LIGATURE TEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062A 0645;;;;N;;;;;
+FC0F;ARABIC LIGATURE TEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062A 0649;;;;N;;;;;
+FC10;ARABIC LIGATURE TEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062A 064A;;;;N;;;;;
+FC11;ARABIC LIGATURE THEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062B 062C;;;;N;;;;;
+FC12;ARABIC LIGATURE THEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062B 0645;;;;N;;;;;
+FC13;ARABIC LIGATURE THEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062B 0649;;;;N;;;;;
+FC14;ARABIC LIGATURE THEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062B 064A;;;;N;;;;;
+FC15;ARABIC LIGATURE JEEM WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 062C 062D;;;;N;;;;;
+FC16;ARABIC LIGATURE JEEM WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062C 0645;;;;N;;;;;
+FC17;ARABIC LIGATURE HAH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062D 062C;;;;N;;;;;
+FC18;ARABIC LIGATURE HAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062D 0645;;;;N;;;;;
+FC19;ARABIC LIGATURE KHAH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062E 062C;;;;N;;;;;
+FC1A;ARABIC LIGATURE KHAH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 062E 062D;;;;N;;;;;
+FC1B;ARABIC LIGATURE KHAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 062E 0645;;;;N;;;;;
+FC1C;ARABIC LIGATURE SEEN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0633 062C;;;;N;;;;;
+FC1D;ARABIC LIGATURE SEEN WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0633 062D;;;;N;;;;;
+FC1E;ARABIC LIGATURE SEEN WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0633 062E;;;;N;;;;;
+FC1F;ARABIC LIGATURE SEEN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0633 0645;;;;N;;;;;
+FC20;ARABIC LIGATURE SAD WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0635 062D;;;;N;;;;;
+FC21;ARABIC LIGATURE SAD WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0635 0645;;;;N;;;;;
+FC22;ARABIC LIGATURE DAD WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0636 062C;;;;N;;;;;
+FC23;ARABIC LIGATURE DAD WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0636 062D;;;;N;;;;;
+FC24;ARABIC LIGATURE DAD WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0636 062E;;;;N;;;;;
+FC25;ARABIC LIGATURE DAD WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0636 0645;;;;N;;;;;
+FC26;ARABIC LIGATURE TAH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0637 062D;;;;N;;;;;
+FC27;ARABIC LIGATURE TAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0637 0645;;;;N;;;;;
+FC28;ARABIC LIGATURE ZAH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0638 0645;;;;N;;;;;
+FC29;ARABIC LIGATURE AIN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0639 062C;;;;N;;;;;
+FC2A;ARABIC LIGATURE AIN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0639 0645;;;;N;;;;;
+FC2B;ARABIC LIGATURE GHAIN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 063A 062C;;;;N;;;;;
+FC2C;ARABIC LIGATURE GHAIN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 063A 0645;;;;N;;;;;
+FC2D;ARABIC LIGATURE FEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0641 062C;;;;N;;;;;
+FC2E;ARABIC LIGATURE FEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0641 062D;;;;N;;;;;
+FC2F;ARABIC LIGATURE FEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0641 062E;;;;N;;;;;
+FC30;ARABIC LIGATURE FEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0641 0645;;;;N;;;;;
+FC31;ARABIC LIGATURE FEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0641 0649;;;;N;;;;;
+FC32;ARABIC LIGATURE FEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0641 064A;;;;N;;;;;
+FC33;ARABIC LIGATURE QAF WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0642 062D;;;;N;;;;;
+FC34;ARABIC LIGATURE QAF WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0642 0645;;;;N;;;;;
+FC35;ARABIC LIGATURE QAF WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0642 0649;;;;N;;;;;
+FC36;ARABIC LIGATURE QAF WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0642 064A;;;;N;;;;;
+FC37;ARABIC LIGATURE KAF WITH ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0643 0627;;;;N;;;;;
+FC38;ARABIC LIGATURE KAF WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0643 062C;;;;N;;;;;
+FC39;ARABIC LIGATURE KAF WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0643 062D;;;;N;;;;;
+FC3A;ARABIC LIGATURE KAF WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0643 062E;;;;N;;;;;
+FC3B;ARABIC LIGATURE KAF WITH LAM ISOLATED FORM;Lo;0;AL;<isolated> 0643 0644;;;;N;;;;;
+FC3C;ARABIC LIGATURE KAF WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0643 0645;;;;N;;;;;
+FC3D;ARABIC LIGATURE KAF WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0643 0649;;;;N;;;;;
+FC3E;ARABIC LIGATURE KAF WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0643 064A;;;;N;;;;;
+FC3F;ARABIC LIGATURE LAM WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0644 062C;;;;N;;;;;
+FC40;ARABIC LIGATURE LAM WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0644 062D;;;;N;;;;;
+FC41;ARABIC LIGATURE LAM WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0644 062E;;;;N;;;;;
+FC42;ARABIC LIGATURE LAM WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0644 0645;;;;N;;;;;
+FC43;ARABIC LIGATURE LAM WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0644 0649;;;;N;;;;;
+FC44;ARABIC LIGATURE LAM WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0644 064A;;;;N;;;;;
+FC45;ARABIC LIGATURE MEEM WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0645 062C;;;;N;;;;;
+FC46;ARABIC LIGATURE MEEM WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0645 062D;;;;N;;;;;
+FC47;ARABIC LIGATURE MEEM WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0645 062E;;;;N;;;;;
+FC48;ARABIC LIGATURE MEEM WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0645 0645;;;;N;;;;;
+FC49;ARABIC LIGATURE MEEM WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0645 0649;;;;N;;;;;
+FC4A;ARABIC LIGATURE MEEM WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0645 064A;;;;N;;;;;
+FC4B;ARABIC LIGATURE NOON WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0646 062C;;;;N;;;;;
+FC4C;ARABIC LIGATURE NOON WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0646 062D;;;;N;;;;;
+FC4D;ARABIC LIGATURE NOON WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0646 062E;;;;N;;;;;
+FC4E;ARABIC LIGATURE NOON WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0646 0645;;;;N;;;;;
+FC4F;ARABIC LIGATURE NOON WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0646 0649;;;;N;;;;;
+FC50;ARABIC LIGATURE NOON WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0646 064A;;;;N;;;;;
+FC51;ARABIC LIGATURE HEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0647 062C;;;;N;;;;;
+FC52;ARABIC LIGATURE HEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0647 0645;;;;N;;;;;
+FC53;ARABIC LIGATURE HEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0647 0649;;;;N;;;;;
+FC54;ARABIC LIGATURE HEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0647 064A;;;;N;;;;;
+FC55;ARABIC LIGATURE YEH WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 064A 062C;;;;N;;;;;
+FC56;ARABIC LIGATURE YEH WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 064A 062D;;;;N;;;;;
+FC57;ARABIC LIGATURE YEH WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 064A 062E;;;;N;;;;;
+FC58;ARABIC LIGATURE YEH WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 064A 0645;;;;N;;;;;
+FC59;ARABIC LIGATURE YEH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 064A 0649;;;;N;;;;;
+FC5A;ARABIC LIGATURE YEH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 064A 064A;;;;N;;;;;
+FC5B;ARABIC LIGATURE THAL WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0630 0670;;;;N;;;;;
+FC5C;ARABIC LIGATURE REH WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0631 0670;;;;N;;;;;
+FC5D;ARABIC LIGATURE ALEF MAKSURA WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0649 0670;;;;N;;;;;
+FC5E;ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064C 0651;;;;N;;;;;
+FC5F;ARABIC LIGATURE SHADDA WITH KASRATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064D 0651;;;;N;;;;;
+FC60;ARABIC LIGATURE SHADDA WITH FATHA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064E 0651;;;;N;;;;;
+FC61;ARABIC LIGATURE SHADDA WITH DAMMA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064F 0651;;;;N;;;;;
+FC62;ARABIC LIGATURE SHADDA WITH KASRA ISOLATED FORM;Lo;0;AL;<isolated> 0020 0650 0651;;;;N;;;;;
+FC63;ARABIC LIGATURE SHADDA WITH SUPERSCRIPT ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0020 0651 0670;;;;N;;;;;
+FC64;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH REH FINAL FORM;Lo;0;AL;<final> 0626 0631;;;;N;;;;;
+FC65;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ZAIN FINAL FORM;Lo;0;AL;<final> 0626 0632;;;;N;;;;;
+FC66;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM FINAL FORM;Lo;0;AL;<final> 0626 0645;;;;N;;;;;
+FC67;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH NOON FINAL FORM;Lo;0;AL;<final> 0626 0646;;;;N;;;;;
+FC68;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0626 0649;;;;N;;;;;
+FC69;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YEH FINAL FORM;Lo;0;AL;<final> 0626 064A;;;;N;;;;;
+FC6A;ARABIC LIGATURE BEH WITH REH FINAL FORM;Lo;0;AL;<final> 0628 0631;;;;N;;;;;
+FC6B;ARABIC LIGATURE BEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 0628 0632;;;;N;;;;;
+FC6C;ARABIC LIGATURE BEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0628 0645;;;;N;;;;;
+FC6D;ARABIC LIGATURE BEH WITH NOON FINAL FORM;Lo;0;AL;<final> 0628 0646;;;;N;;;;;
+FC6E;ARABIC LIGATURE BEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0628 0649;;;;N;;;;;
+FC6F;ARABIC LIGATURE BEH WITH YEH FINAL FORM;Lo;0;AL;<final> 0628 064A;;;;N;;;;;
+FC70;ARABIC LIGATURE TEH WITH REH FINAL FORM;Lo;0;AL;<final> 062A 0631;;;;N;;;;;
+FC71;ARABIC LIGATURE TEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 062A 0632;;;;N;;;;;
+FC72;ARABIC LIGATURE TEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 062A 0645;;;;N;;;;;
+FC73;ARABIC LIGATURE TEH WITH NOON FINAL FORM;Lo;0;AL;<final> 062A 0646;;;;N;;;;;
+FC74;ARABIC LIGATURE TEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 0649;;;;N;;;;;
+FC75;ARABIC LIGATURE TEH WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 064A;;;;N;;;;;
+FC76;ARABIC LIGATURE THEH WITH REH FINAL FORM;Lo;0;AL;<final> 062B 0631;;;;N;;;;;
+FC77;ARABIC LIGATURE THEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 062B 0632;;;;N;;;;;
+FC78;ARABIC LIGATURE THEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 062B 0645;;;;N;;;;;
+FC79;ARABIC LIGATURE THEH WITH NOON FINAL FORM;Lo;0;AL;<final> 062B 0646;;;;N;;;;;
+FC7A;ARABIC LIGATURE THEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062B 0649;;;;N;;;;;
+FC7B;ARABIC LIGATURE THEH WITH YEH FINAL FORM;Lo;0;AL;<final> 062B 064A;;;;N;;;;;
+FC7C;ARABIC LIGATURE FEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0641 0649;;;;N;;;;;
+FC7D;ARABIC LIGATURE FEH WITH YEH FINAL FORM;Lo;0;AL;<final> 0641 064A;;;;N;;;;;
+FC7E;ARABIC LIGATURE QAF WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0642 0649;;;;N;;;;;
+FC7F;ARABIC LIGATURE QAF WITH YEH FINAL FORM;Lo;0;AL;<final> 0642 064A;;;;N;;;;;
+FC80;ARABIC LIGATURE KAF WITH ALEF FINAL FORM;Lo;0;AL;<final> 0643 0627;;;;N;;;;;
+FC81;ARABIC LIGATURE KAF WITH LAM FINAL FORM;Lo;0;AL;<final> 0643 0644;;;;N;;;;;
+FC82;ARABIC LIGATURE KAF WITH MEEM FINAL FORM;Lo;0;AL;<final> 0643 0645;;;;N;;;;;
+FC83;ARABIC LIGATURE KAF WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0643 0649;;;;N;;;;;
+FC84;ARABIC LIGATURE KAF WITH YEH FINAL FORM;Lo;0;AL;<final> 0643 064A;;;;N;;;;;
+FC85;ARABIC LIGATURE LAM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 0645;;;;N;;;;;
+FC86;ARABIC LIGATURE LAM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0644 0649;;;;N;;;;;
+FC87;ARABIC LIGATURE LAM WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 064A;;;;N;;;;;
+FC88;ARABIC LIGATURE MEEM WITH ALEF FINAL FORM;Lo;0;AL;<final> 0645 0627;;;;N;;;;;
+FC89;ARABIC LIGATURE MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0645 0645;;;;N;;;;;
+FC8A;ARABIC LIGATURE NOON WITH REH FINAL FORM;Lo;0;AL;<final> 0646 0631;;;;N;;;;;
+FC8B;ARABIC LIGATURE NOON WITH ZAIN FINAL FORM;Lo;0;AL;<final> 0646 0632;;;;N;;;;;
+FC8C;ARABIC LIGATURE NOON WITH MEEM FINAL FORM;Lo;0;AL;<final> 0646 0645;;;;N;;;;;
+FC8D;ARABIC LIGATURE NOON WITH NOON FINAL FORM;Lo;0;AL;<final> 0646 0646;;;;N;;;;;
+FC8E;ARABIC LIGATURE NOON WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 0649;;;;N;;;;;
+FC8F;ARABIC LIGATURE NOON WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 064A;;;;N;;;;;
+FC90;ARABIC LIGATURE ALEF MAKSURA WITH SUPERSCRIPT ALEF FINAL FORM;Lo;0;AL;<final> 0649 0670;;;;N;;;;;
+FC91;ARABIC LIGATURE YEH WITH REH FINAL FORM;Lo;0;AL;<final> 064A 0631;;;;N;;;;;
+FC92;ARABIC LIGATURE YEH WITH ZAIN FINAL FORM;Lo;0;AL;<final> 064A 0632;;;;N;;;;;
+FC93;ARABIC LIGATURE YEH WITH MEEM FINAL FORM;Lo;0;AL;<final> 064A 0645;;;;N;;;;;
+FC94;ARABIC LIGATURE YEH WITH NOON FINAL FORM;Lo;0;AL;<final> 064A 0646;;;;N;;;;;
+FC95;ARABIC LIGATURE YEH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 064A 0649;;;;N;;;;;
+FC96;ARABIC LIGATURE YEH WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 064A;;;;N;;;;;
+FC97;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0626 062C;;;;N;;;;;
+FC98;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0626 062D;;;;N;;;;;
+FC99;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0626 062E;;;;N;;;;;
+FC9A;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0626 0645;;;;N;;;;;
+FC9B;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0626 0647;;;;N;;;;;
+FC9C;ARABIC LIGATURE BEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0628 062C;;;;N;;;;;
+FC9D;ARABIC LIGATURE BEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0628 062D;;;;N;;;;;
+FC9E;ARABIC LIGATURE BEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0628 062E;;;;N;;;;;
+FC9F;ARABIC LIGATURE BEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0628 0645;;;;N;;;;;
+FCA0;ARABIC LIGATURE BEH WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0628 0647;;;;N;;;;;
+FCA1;ARABIC LIGATURE TEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062C;;;;N;;;;;
+FCA2;ARABIC LIGATURE TEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062A 062D;;;;N;;;;;
+FCA3;ARABIC LIGATURE TEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 062A 062E;;;;N;;;;;
+FCA4;ARABIC LIGATURE TEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 0645;;;;N;;;;;
+FCA5;ARABIC LIGATURE TEH WITH HEH INITIAL FORM;Lo;0;AL;<initial> 062A 0647;;;;N;;;;;
+FCA6;ARABIC LIGATURE THEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062B 0645;;;;N;;;;;
+FCA7;ARABIC LIGATURE JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062C 062D;;;;N;;;;;
+FCA8;ARABIC LIGATURE JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062C 0645;;;;N;;;;;
+FCA9;ARABIC LIGATURE HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062D 062C;;;;N;;;;;
+FCAA;ARABIC LIGATURE HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062D 0645;;;;N;;;;;
+FCAB;ARABIC LIGATURE KHAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062E 062C;;;;N;;;;;
+FCAC;ARABIC LIGATURE KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062E 0645;;;;N;;;;;
+FCAD;ARABIC LIGATURE SEEN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0633 062C;;;;N;;;;;
+FCAE;ARABIC LIGATURE SEEN WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0633 062D;;;;N;;;;;
+FCAF;ARABIC LIGATURE SEEN WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0633 062E;;;;N;;;;;
+FCB0;ARABIC LIGATURE SEEN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0633 0645;;;;N;;;;;
+FCB1;ARABIC LIGATURE SAD WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0635 062D;;;;N;;;;;
+FCB2;ARABIC LIGATURE SAD WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0635 062E;;;;N;;;;;
+FCB3;ARABIC LIGATURE SAD WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0635 0645;;;;N;;;;;
+FCB4;ARABIC LIGATURE DAD WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0636 062C;;;;N;;;;;
+FCB5;ARABIC LIGATURE DAD WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0636 062D;;;;N;;;;;
+FCB6;ARABIC LIGATURE DAD WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0636 062E;;;;N;;;;;
+FCB7;ARABIC LIGATURE DAD WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0636 0645;;;;N;;;;;
+FCB8;ARABIC LIGATURE TAH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0637 062D;;;;N;;;;;
+FCB9;ARABIC LIGATURE ZAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0638 0645;;;;N;;;;;
+FCBA;ARABIC LIGATURE AIN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0639 062C;;;;N;;;;;
+FCBB;ARABIC LIGATURE AIN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0639 0645;;;;N;;;;;
+FCBC;ARABIC LIGATURE GHAIN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 063A 062C;;;;N;;;;;
+FCBD;ARABIC LIGATURE GHAIN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 063A 0645;;;;N;;;;;
+FCBE;ARABIC LIGATURE FEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0641 062C;;;;N;;;;;
+FCBF;ARABIC LIGATURE FEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0641 062D;;;;N;;;;;
+FCC0;ARABIC LIGATURE FEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0641 062E;;;;N;;;;;
+FCC1;ARABIC LIGATURE FEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0641 0645;;;;N;;;;;
+FCC2;ARABIC LIGATURE QAF WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0642 062D;;;;N;;;;;
+FCC3;ARABIC LIGATURE QAF WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0642 0645;;;;N;;;;;
+FCC4;ARABIC LIGATURE KAF WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0643 062C;;;;N;;;;;
+FCC5;ARABIC LIGATURE KAF WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0643 062D;;;;N;;;;;
+FCC6;ARABIC LIGATURE KAF WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0643 062E;;;;N;;;;;
+FCC7;ARABIC LIGATURE KAF WITH LAM INITIAL FORM;Lo;0;AL;<initial> 0643 0644;;;;N;;;;;
+FCC8;ARABIC LIGATURE KAF WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0643 0645;;;;N;;;;;
+FCC9;ARABIC LIGATURE LAM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062C;;;;N;;;;;
+FCCA;ARABIC LIGATURE LAM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0644 062D;;;;N;;;;;
+FCCB;ARABIC LIGATURE LAM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0644 062E;;;;N;;;;;
+FCCC;ARABIC LIGATURE LAM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 0645;;;;N;;;;;
+FCCD;ARABIC LIGATURE LAM WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0644 0647;;;;N;;;;;
+FCCE;ARABIC LIGATURE MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062C;;;;N;;;;;
+FCCF;ARABIC LIGATURE MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0645 062D;;;;N;;;;;
+FCD0;ARABIC LIGATURE MEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0645 062E;;;;N;;;;;
+FCD1;ARABIC LIGATURE MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 0645;;;;N;;;;;
+FCD2;ARABIC LIGATURE NOON WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0646 062C;;;;N;;;;;
+FCD3;ARABIC LIGATURE NOON WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0646 062D;;;;N;;;;;
+FCD4;ARABIC LIGATURE NOON WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0646 062E;;;;N;;;;;
+FCD5;ARABIC LIGATURE NOON WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0646 0645;;;;N;;;;;
+FCD6;ARABIC LIGATURE NOON WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0646 0647;;;;N;;;;;
+FCD7;ARABIC LIGATURE HEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0647 062C;;;;N;;;;;
+FCD8;ARABIC LIGATURE HEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0647 0645;;;;N;;;;;
+FCD9;ARABIC LIGATURE HEH WITH SUPERSCRIPT ALEF INITIAL FORM;Lo;0;AL;<initial> 0647 0670;;;;N;;;;;
+FCDA;ARABIC LIGATURE YEH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 064A 062C;;;;N;;;;;
+FCDB;ARABIC LIGATURE YEH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 064A 062D;;;;N;;;;;
+FCDC;ARABIC LIGATURE YEH WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 064A 062E;;;;N;;;;;
+FCDD;ARABIC LIGATURE YEH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 064A 0645;;;;N;;;;;
+FCDE;ARABIC LIGATURE YEH WITH HEH INITIAL FORM;Lo;0;AL;<initial> 064A 0647;;;;N;;;;;
+FCDF;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0626 0645;;;;N;;;;;
+FCE0;ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0626 0647;;;;N;;;;;
+FCE1;ARABIC LIGATURE BEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0628 0645;;;;N;;;;;
+FCE2;ARABIC LIGATURE BEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0628 0647;;;;N;;;;;
+FCE3;ARABIC LIGATURE TEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 062A 0645;;;;N;;;;;
+FCE4;ARABIC LIGATURE TEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 062A 0647;;;;N;;;;;
+FCE5;ARABIC LIGATURE THEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 062B 0645;;;;N;;;;;
+FCE6;ARABIC LIGATURE THEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 062B 0647;;;;N;;;;;
+FCE7;ARABIC LIGATURE SEEN WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0633 0645;;;;N;;;;;
+FCE8;ARABIC LIGATURE SEEN WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0633 0647;;;;N;;;;;
+FCE9;ARABIC LIGATURE SHEEN WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0634 0645;;;;N;;;;;
+FCEA;ARABIC LIGATURE SHEEN WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0634 0647;;;;N;;;;;
+FCEB;ARABIC LIGATURE KAF WITH LAM MEDIAL FORM;Lo;0;AL;<medial> 0643 0644;;;;N;;;;;
+FCEC;ARABIC LIGATURE KAF WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0643 0645;;;;N;;;;;
+FCED;ARABIC LIGATURE LAM WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0644 0645;;;;N;;;;;
+FCEE;ARABIC LIGATURE NOON WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0646 0645;;;;N;;;;;
+FCEF;ARABIC LIGATURE NOON WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 0646 0647;;;;N;;;;;
+FCF0;ARABIC LIGATURE YEH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 064A 0645;;;;N;;;;;
+FCF1;ARABIC LIGATURE YEH WITH HEH MEDIAL FORM;Lo;0;AL;<medial> 064A 0647;;;;N;;;;;
+FCF2;ARABIC LIGATURE SHADDA WITH FATHA MEDIAL FORM;Lo;0;AL;<medial> 0640 064E 0651;;;;N;;;;;
+FCF3;ARABIC LIGATURE SHADDA WITH DAMMA MEDIAL FORM;Lo;0;AL;<medial> 0640 064F 0651;;;;N;;;;;
+FCF4;ARABIC LIGATURE SHADDA WITH KASRA MEDIAL FORM;Lo;0;AL;<medial> 0640 0650 0651;;;;N;;;;;
+FCF5;ARABIC LIGATURE TAH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0637 0649;;;;N;;;;;
+FCF6;ARABIC LIGATURE TAH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0637 064A;;;;N;;;;;
+FCF7;ARABIC LIGATURE AIN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0639 0649;;;;N;;;;;
+FCF8;ARABIC LIGATURE AIN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0639 064A;;;;N;;;;;
+FCF9;ARABIC LIGATURE GHAIN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 063A 0649;;;;N;;;;;
+FCFA;ARABIC LIGATURE GHAIN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 063A 064A;;;;N;;;;;
+FCFB;ARABIC LIGATURE SEEN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0633 0649;;;;N;;;;;
+FCFC;ARABIC LIGATURE SEEN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0633 064A;;;;N;;;;;
+FCFD;ARABIC LIGATURE SHEEN WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0634 0649;;;;N;;;;;
+FCFE;ARABIC LIGATURE SHEEN WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0634 064A;;;;N;;;;;
+FCFF;ARABIC LIGATURE HAH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062D 0649;;;;N;;;;;
+FD00;ARABIC LIGATURE HAH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062D 064A;;;;N;;;;;
+FD01;ARABIC LIGATURE JEEM WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062C 0649;;;;N;;;;;
+FD02;ARABIC LIGATURE JEEM WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062C 064A;;;;N;;;;;
+FD03;ARABIC LIGATURE KHAH WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 062E 0649;;;;N;;;;;
+FD04;ARABIC LIGATURE KHAH WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 062E 064A;;;;N;;;;;
+FD05;ARABIC LIGATURE SAD WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0635 0649;;;;N;;;;;
+FD06;ARABIC LIGATURE SAD WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0635 064A;;;;N;;;;;
+FD07;ARABIC LIGATURE DAD WITH ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0636 0649;;;;N;;;;;
+FD08;ARABIC LIGATURE DAD WITH YEH ISOLATED FORM;Lo;0;AL;<isolated> 0636 064A;;;;N;;;;;
+FD09;ARABIC LIGATURE SHEEN WITH JEEM ISOLATED FORM;Lo;0;AL;<isolated> 0634 062C;;;;N;;;;;
+FD0A;ARABIC LIGATURE SHEEN WITH HAH ISOLATED FORM;Lo;0;AL;<isolated> 0634 062D;;;;N;;;;;
+FD0B;ARABIC LIGATURE SHEEN WITH KHAH ISOLATED FORM;Lo;0;AL;<isolated> 0634 062E;;;;N;;;;;
+FD0C;ARABIC LIGATURE SHEEN WITH MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0634 0645;;;;N;;;;;
+FD0D;ARABIC LIGATURE SHEEN WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0634 0631;;;;N;;;;;
+FD0E;ARABIC LIGATURE SEEN WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0633 0631;;;;N;;;;;
+FD0F;ARABIC LIGATURE SAD WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0635 0631;;;;N;;;;;
+FD10;ARABIC LIGATURE DAD WITH REH ISOLATED FORM;Lo;0;AL;<isolated> 0636 0631;;;;N;;;;;
+FD11;ARABIC LIGATURE TAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0637 0649;;;;N;;;;;
+FD12;ARABIC LIGATURE TAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0637 064A;;;;N;;;;;
+FD13;ARABIC LIGATURE AIN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0639 0649;;;;N;;;;;
+FD14;ARABIC LIGATURE AIN WITH YEH FINAL FORM;Lo;0;AL;<final> 0639 064A;;;;N;;;;;
+FD15;ARABIC LIGATURE GHAIN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 063A 0649;;;;N;;;;;
+FD16;ARABIC LIGATURE GHAIN WITH YEH FINAL FORM;Lo;0;AL;<final> 063A 064A;;;;N;;;;;
+FD17;ARABIC LIGATURE SEEN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0633 0649;;;;N;;;;;
+FD18;ARABIC LIGATURE SEEN WITH YEH FINAL FORM;Lo;0;AL;<final> 0633 064A;;;;N;;;;;
+FD19;ARABIC LIGATURE SHEEN WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0634 0649;;;;N;;;;;
+FD1A;ARABIC LIGATURE SHEEN WITH YEH FINAL FORM;Lo;0;AL;<final> 0634 064A;;;;N;;;;;
+FD1B;ARABIC LIGATURE HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062D 0649;;;;N;;;;;
+FD1C;ARABIC LIGATURE HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062D 064A;;;;N;;;;;
+FD1D;ARABIC LIGATURE JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062C 0649;;;;N;;;;;
+FD1E;ARABIC LIGATURE JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062C 064A;;;;N;;;;;
+FD1F;ARABIC LIGATURE KHAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062E 0649;;;;N;;;;;
+FD20;ARABIC LIGATURE KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062E 064A;;;;N;;;;;
+FD21;ARABIC LIGATURE SAD WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0635 0649;;;;N;;;;;
+FD22;ARABIC LIGATURE SAD WITH YEH FINAL FORM;Lo;0;AL;<final> 0635 064A;;;;N;;;;;
+FD23;ARABIC LIGATURE DAD WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0636 0649;;;;N;;;;;
+FD24;ARABIC LIGATURE DAD WITH YEH FINAL FORM;Lo;0;AL;<final> 0636 064A;;;;N;;;;;
+FD25;ARABIC LIGATURE SHEEN WITH JEEM FINAL FORM;Lo;0;AL;<final> 0634 062C;;;;N;;;;;
+FD26;ARABIC LIGATURE SHEEN WITH HAH FINAL FORM;Lo;0;AL;<final> 0634 062D;;;;N;;;;;
+FD27;ARABIC LIGATURE SHEEN WITH KHAH FINAL FORM;Lo;0;AL;<final> 0634 062E;;;;N;;;;;
+FD28;ARABIC LIGATURE SHEEN WITH MEEM FINAL FORM;Lo;0;AL;<final> 0634 0645;;;;N;;;;;
+FD29;ARABIC LIGATURE SHEEN WITH REH FINAL FORM;Lo;0;AL;<final> 0634 0631;;;;N;;;;;
+FD2A;ARABIC LIGATURE SEEN WITH REH FINAL FORM;Lo;0;AL;<final> 0633 0631;;;;N;;;;;
+FD2B;ARABIC LIGATURE SAD WITH REH FINAL FORM;Lo;0;AL;<final> 0635 0631;;;;N;;;;;
+FD2C;ARABIC LIGATURE DAD WITH REH FINAL FORM;Lo;0;AL;<final> 0636 0631;;;;N;;;;;
+FD2D;ARABIC LIGATURE SHEEN WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0634 062C;;;;N;;;;;
+FD2E;ARABIC LIGATURE SHEEN WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0634 062D;;;;N;;;;;
+FD2F;ARABIC LIGATURE SHEEN WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0634 062E;;;;N;;;;;
+FD30;ARABIC LIGATURE SHEEN WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0634 0645;;;;N;;;;;
+FD31;ARABIC LIGATURE SEEN WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0633 0647;;;;N;;;;;
+FD32;ARABIC LIGATURE SHEEN WITH HEH INITIAL FORM;Lo;0;AL;<initial> 0634 0647;;;;N;;;;;
+FD33;ARABIC LIGATURE TAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0637 0645;;;;N;;;;;
+FD34;ARABIC LIGATURE SEEN WITH JEEM MEDIAL FORM;Lo;0;AL;<medial> 0633 062C;;;;N;;;;;
+FD35;ARABIC LIGATURE SEEN WITH HAH MEDIAL FORM;Lo;0;AL;<medial> 0633 062D;;;;N;;;;;
+FD36;ARABIC LIGATURE SEEN WITH KHAH MEDIAL FORM;Lo;0;AL;<medial> 0633 062E;;;;N;;;;;
+FD37;ARABIC LIGATURE SHEEN WITH JEEM MEDIAL FORM;Lo;0;AL;<medial> 0634 062C;;;;N;;;;;
+FD38;ARABIC LIGATURE SHEEN WITH HAH MEDIAL FORM;Lo;0;AL;<medial> 0634 062D;;;;N;;;;;
+FD39;ARABIC LIGATURE SHEEN WITH KHAH MEDIAL FORM;Lo;0;AL;<medial> 0634 062E;;;;N;;;;;
+FD3A;ARABIC LIGATURE TAH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0637 0645;;;;N;;;;;
+FD3B;ARABIC LIGATURE ZAH WITH MEEM MEDIAL FORM;Lo;0;AL;<medial> 0638 0645;;;;N;;;;;
+FD3C;ARABIC LIGATURE ALEF WITH FATHATAN FINAL FORM;Lo;0;AL;<final> 0627 064B;;;;N;;;;;
+FD3D;ARABIC LIGATURE ALEF WITH FATHATAN ISOLATED FORM;Lo;0;AL;<isolated> 0627 064B;;;;N;;;;;
+FD3E;ORNATE LEFT PARENTHESIS;Ps;0;ON;;;;;N;;;;;
+FD3F;ORNATE RIGHT PARENTHESIS;Pe;0;ON;;;;;N;;;;;
+FD50;ARABIC LIGATURE TEH WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062C 0645;;;;N;;;;;
+FD51;ARABIC LIGATURE TEH WITH HAH WITH JEEM FINAL FORM;Lo;0;AL;<final> 062A 062D 062C;;;;N;;;;;
+FD52;ARABIC LIGATURE TEH WITH HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062D 062C;;;;N;;;;;
+FD53;ARABIC LIGATURE TEH WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062D 0645;;;;N;;;;;
+FD54;ARABIC LIGATURE TEH WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 062A 062E 0645;;;;N;;;;;
+FD55;ARABIC LIGATURE TEH WITH MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 062A 0645 062C;;;;N;;;;;
+FD56;ARABIC LIGATURE TEH WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062A 0645 062D;;;;N;;;;;
+FD57;ARABIC LIGATURE TEH WITH MEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 062A 0645 062E;;;;N;;;;;
+FD58;ARABIC LIGATURE JEEM WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 062C 0645 062D;;;;N;;;;;
+FD59;ARABIC LIGATURE JEEM WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 062C 0645 062D;;;;N;;;;;
+FD5A;ARABIC LIGATURE HAH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062D 0645 064A;;;;N;;;;;
+FD5B;ARABIC LIGATURE HAH WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062D 0645 0649;;;;N;;;;;
+FD5C;ARABIC LIGATURE SEEN WITH HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0633 062D 062C;;;;N;;;;;
+FD5D;ARABIC LIGATURE SEEN WITH JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0633 062C 062D;;;;N;;;;;
+FD5E;ARABIC LIGATURE SEEN WITH JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0633 062C 0649;;;;N;;;;;
+FD5F;ARABIC LIGATURE SEEN WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0633 0645 062D;;;;N;;;;;
+FD60;ARABIC LIGATURE SEEN WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0633 0645 062D;;;;N;;;;;
+FD61;ARABIC LIGATURE SEEN WITH MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0633 0645 062C;;;;N;;;;;
+FD62;ARABIC LIGATURE SEEN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0633 0645 0645;;;;N;;;;;
+FD63;ARABIC LIGATURE SEEN WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0633 0645 0645;;;;N;;;;;
+FD64;ARABIC LIGATURE SAD WITH HAH WITH HAH FINAL FORM;Lo;0;AL;<final> 0635 062D 062D;;;;N;;;;;
+FD65;ARABIC LIGATURE SAD WITH HAH WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0635 062D 062D;;;;N;;;;;
+FD66;ARABIC LIGATURE SAD WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0635 0645 0645;;;;N;;;;;
+FD67;ARABIC LIGATURE SHEEN WITH HAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0634 062D 0645;;;;N;;;;;
+FD68;ARABIC LIGATURE SHEEN WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0634 062D 0645;;;;N;;;;;
+FD69;ARABIC LIGATURE SHEEN WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0634 062C 064A;;;;N;;;;;
+FD6A;ARABIC LIGATURE SHEEN WITH MEEM WITH KHAH FINAL FORM;Lo;0;AL;<final> 0634 0645 062E;;;;N;;;;;
+FD6B;ARABIC LIGATURE SHEEN WITH MEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0634 0645 062E;;;;N;;;;;
+FD6C;ARABIC LIGATURE SHEEN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0634 0645 0645;;;;N;;;;;
+FD6D;ARABIC LIGATURE SHEEN WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0634 0645 0645;;;;N;;;;;
+FD6E;ARABIC LIGATURE DAD WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0636 062D 0649;;;;N;;;;;
+FD6F;ARABIC LIGATURE DAD WITH KHAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0636 062E 0645;;;;N;;;;;
+FD70;ARABIC LIGATURE DAD WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0636 062E 0645;;;;N;;;;;
+FD71;ARABIC LIGATURE TAH WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0637 0645 062D;;;;N;;;;;
+FD72;ARABIC LIGATURE TAH WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0637 0645 062D;;;;N;;;;;
+FD73;ARABIC LIGATURE TAH WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0637 0645 0645;;;;N;;;;;
+FD74;ARABIC LIGATURE TAH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0637 0645 064A;;;;N;;;;;
+FD75;ARABIC LIGATURE AIN WITH JEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0639 062C 0645;;;;N;;;;;
+FD76;ARABIC LIGATURE AIN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0639 0645 0645;;;;N;;;;;
+FD77;ARABIC LIGATURE AIN WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0639 0645 0645;;;;N;;;;;
+FD78;ARABIC LIGATURE AIN WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0639 0645 0649;;;;N;;;;;
+FD79;ARABIC LIGATURE GHAIN WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 063A 0645 0645;;;;N;;;;;
+FD7A;ARABIC LIGATURE GHAIN WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 063A 0645 064A;;;;N;;;;;
+FD7B;ARABIC LIGATURE GHAIN WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 063A 0645 0649;;;;N;;;;;
+FD7C;ARABIC LIGATURE FEH WITH KHAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0641 062E 0645;;;;N;;;;;
+FD7D;ARABIC LIGATURE FEH WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0641 062E 0645;;;;N;;;;;
+FD7E;ARABIC LIGATURE QAF WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0642 0645 062D;;;;N;;;;;
+FD7F;ARABIC LIGATURE QAF WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0642 0645 0645;;;;N;;;;;
+FD80;ARABIC LIGATURE LAM WITH HAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 062D 0645;;;;N;;;;;
+FD81;ARABIC LIGATURE LAM WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 062D 064A;;;;N;;;;;
+FD82;ARABIC LIGATURE LAM WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0644 062D 0649;;;;N;;;;;
+FD83;ARABIC LIGATURE LAM WITH JEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062C 062C;;;;N;;;;;
+FD84;ARABIC LIGATURE LAM WITH JEEM WITH JEEM FINAL FORM;Lo;0;AL;<final> 0644 062C 062C;;;;N;;;;;
+FD85;ARABIC LIGATURE LAM WITH KHAH WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 062E 0645;;;;N;;;;;
+FD86;ARABIC LIGATURE LAM WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062E 0645;;;;N;;;;;
+FD87;ARABIC LIGATURE LAM WITH MEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0644 0645 062D;;;;N;;;;;
+FD88;ARABIC LIGATURE LAM WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0644 0645 062D;;;;N;;;;;
+FD89;ARABIC LIGATURE MEEM WITH HAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062D 062C;;;;N;;;;;
+FD8A;ARABIC LIGATURE MEEM WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062D 0645;;;;N;;;;;
+FD8B;ARABIC LIGATURE MEEM WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 062D 064A;;;;N;;;;;
+FD8C;ARABIC LIGATURE MEEM WITH JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0645 062C 062D;;;;N;;;;;
+FD8D;ARABIC LIGATURE MEEM WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062C 0645;;;;N;;;;;
+FD8E;ARABIC LIGATURE MEEM WITH KHAH WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062E 062C;;;;N;;;;;
+FD8F;ARABIC LIGATURE MEEM WITH KHAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0645 062E 0645;;;;N;;;;;
+FD92;ARABIC LIGATURE MEEM WITH JEEM WITH KHAH INITIAL FORM;Lo;0;AL;<initial> 0645 062C 062E;;;;N;;;;;
+FD93;ARABIC LIGATURE HEH WITH MEEM WITH JEEM INITIAL FORM;Lo;0;AL;<initial> 0647 0645 062C;;;;N;;;;;
+FD94;ARABIC LIGATURE HEH WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0647 0645 0645;;;;N;;;;;
+FD95;ARABIC LIGATURE NOON WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0646 062D 0645;;;;N;;;;;
+FD96;ARABIC LIGATURE NOON WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 062D 0649;;;;N;;;;;
+FD97;ARABIC LIGATURE NOON WITH JEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0646 062C 0645;;;;N;;;;;
+FD98;ARABIC LIGATURE NOON WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0646 062C 0645;;;;N;;;;;
+FD99;ARABIC LIGATURE NOON WITH JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 062C 0649;;;;N;;;;;
+FD9A;ARABIC LIGATURE NOON WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 0645 064A;;;;N;;;;;
+FD9B;ARABIC LIGATURE NOON WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0646 0645 0649;;;;N;;;;;
+FD9C;ARABIC LIGATURE YEH WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 064A 0645 0645;;;;N;;;;;
+FD9D;ARABIC LIGATURE YEH WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 064A 0645 0645;;;;N;;;;;
+FD9E;ARABIC LIGATURE BEH WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0628 062E 064A;;;;N;;;;;
+FD9F;ARABIC LIGATURE TEH WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 062C 064A;;;;N;;;;;
+FDA0;ARABIC LIGATURE TEH WITH JEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 062C 0649;;;;N;;;;;
+FDA1;ARABIC LIGATURE TEH WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 062E 064A;;;;N;;;;;
+FDA2;ARABIC LIGATURE TEH WITH KHAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 062E 0649;;;;N;;;;;
+FDA3;ARABIC LIGATURE TEH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062A 0645 064A;;;;N;;;;;
+FDA4;ARABIC LIGATURE TEH WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062A 0645 0649;;;;N;;;;;
+FDA5;ARABIC LIGATURE JEEM WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062C 0645 064A;;;;N;;;;;
+FDA6;ARABIC LIGATURE JEEM WITH HAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062C 062D 0649;;;;N;;;;;
+FDA7;ARABIC LIGATURE JEEM WITH MEEM WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 062C 0645 0649;;;;N;;;;;
+FDA8;ARABIC LIGATURE SEEN WITH KHAH WITH ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0633 062E 0649;;;;N;;;;;
+FDA9;ARABIC LIGATURE SAD WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0635 062D 064A;;;;N;;;;;
+FDAA;ARABIC LIGATURE SHEEN WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0634 062D 064A;;;;N;;;;;
+FDAB;ARABIC LIGATURE DAD WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0636 062D 064A;;;;N;;;;;
+FDAC;ARABIC LIGATURE LAM WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 062C 064A;;;;N;;;;;
+FDAD;ARABIC LIGATURE LAM WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0644 0645 064A;;;;N;;;;;
+FDAE;ARABIC LIGATURE YEH WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 062D 064A;;;;N;;;;;
+FDAF;ARABIC LIGATURE YEH WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 062C 064A;;;;N;;;;;
+FDB0;ARABIC LIGATURE YEH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 064A 0645 064A;;;;N;;;;;
+FDB1;ARABIC LIGATURE MEEM WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 0645 064A;;;;N;;;;;
+FDB2;ARABIC LIGATURE QAF WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0642 0645 064A;;;;N;;;;;
+FDB3;ARABIC LIGATURE NOON WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 062D 064A;;;;N;;;;;
+FDB4;ARABIC LIGATURE QAF WITH MEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0642 0645 062D;;;;N;;;;;
+FDB5;ARABIC LIGATURE LAM WITH HAH WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062D 0645;;;;N;;;;;
+FDB6;ARABIC LIGATURE AIN WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0639 0645 064A;;;;N;;;;;
+FDB7;ARABIC LIGATURE KAF WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0643 0645 064A;;;;N;;;;;
+FDB8;ARABIC LIGATURE NOON WITH JEEM WITH HAH INITIAL FORM;Lo;0;AL;<initial> 0646 062C 062D;;;;N;;;;;
+FDB9;ARABIC LIGATURE MEEM WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 062E 064A;;;;N;;;;;
+FDBA;ARABIC LIGATURE LAM WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0644 062C 0645;;;;N;;;;;
+FDBB;ARABIC LIGATURE KAF WITH MEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0643 0645 0645;;;;N;;;;;
+FDBC;ARABIC LIGATURE LAM WITH JEEM WITH MEEM FINAL FORM;Lo;0;AL;<final> 0644 062C 0645;;;;N;;;;;
+FDBD;ARABIC LIGATURE NOON WITH JEEM WITH HAH FINAL FORM;Lo;0;AL;<final> 0646 062C 062D;;;;N;;;;;
+FDBE;ARABIC LIGATURE JEEM WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 062C 062D 064A;;;;N;;;;;
+FDBF;ARABIC LIGATURE HAH WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 062D 062C 064A;;;;N;;;;;
+FDC0;ARABIC LIGATURE MEEM WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0645 062C 064A;;;;N;;;;;
+FDC1;ARABIC LIGATURE FEH WITH MEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0641 0645 064A;;;;N;;;;;
+FDC2;ARABIC LIGATURE BEH WITH HAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0628 062D 064A;;;;N;;;;;
+FDC3;ARABIC LIGATURE KAF WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0643 0645 0645;;;;N;;;;;
+FDC4;ARABIC LIGATURE AIN WITH JEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0639 062C 0645;;;;N;;;;;
+FDC5;ARABIC LIGATURE SAD WITH MEEM WITH MEEM INITIAL FORM;Lo;0;AL;<initial> 0635 0645 0645;;;;N;;;;;
+FDC6;ARABIC LIGATURE SEEN WITH KHAH WITH YEH FINAL FORM;Lo;0;AL;<final> 0633 062E 064A;;;;N;;;;;
+FDC7;ARABIC LIGATURE NOON WITH JEEM WITH YEH FINAL FORM;Lo;0;AL;<final> 0646 062C 064A;;;;N;;;;;
+FDF0;ARABIC LIGATURE SALLA USED AS KORANIC STOP SIGN ISOLATED FORM;Lo;0;AL;<isolated> 0635 0644 06D2;;;;N;;;;;
+FDF1;ARABIC LIGATURE QALA USED AS KORANIC STOP SIGN ISOLATED FORM;Lo;0;AL;<isolated> 0642 0644 06D2;;;;N;;;;;
+FDF2;ARABIC LIGATURE ALLAH ISOLATED FORM;Lo;0;AL;<isolated> 0627 0644 0644 0647;;;;N;;;;;
+FDF3;ARABIC LIGATURE AKBAR ISOLATED FORM;Lo;0;AL;<isolated> 0627 0643 0628 0631;;;;N;;;;;
+FDF4;ARABIC LIGATURE MOHAMMAD ISOLATED FORM;Lo;0;AL;<isolated> 0645 062D 0645 062F;;;;N;;;;;
+FDF5;ARABIC LIGATURE SALAM ISOLATED FORM;Lo;0;AL;<isolated> 0635 0644 0639 0645;;;;N;;;;;
+FDF6;ARABIC LIGATURE RASOUL ISOLATED FORM;Lo;0;AL;<isolated> 0631 0633 0648 0644;;;;N;;;;;
+FDF7;ARABIC LIGATURE ALAYHE ISOLATED FORM;Lo;0;AL;<isolated> 0639 0644 064A 0647;;;;N;;;;;
+FDF8;ARABIC LIGATURE WASALLAM ISOLATED FORM;Lo;0;AL;<isolated> 0648 0633 0644 0645;;;;N;;;;;
+FDF9;ARABIC LIGATURE SALLA ISOLATED FORM;Lo;0;AL;<isolated> 0635 0644 0649;;;;N;;;;;
+FDFA;ARABIC LIGATURE SALLALLAHOU ALAYHE WASALLAM;Lo;0;AL;<isolated> 0635 0644 0649 0020 0627 0644 0644 0647 0020 0639 0644 064A 0647 0020 0648 0633 0644 0645;;;;N;ARABIC LETTER SALLALLAHOU ALAYHE WASALLAM;;;;
+FDFB;ARABIC LIGATURE JALLAJALALOUHOU;Lo;0;AL;<isolated> 062C 0644 0020 062C 0644 0627 0644 0647;;;;N;ARABIC LETTER JALLAJALALOUHOU;;;;
+FDFC;RIAL SIGN;Sc;0;AL;<isolated> 0631 06CC 0627 0644;;;;N;;;;;
+FDFD;ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM;So;0;ON;;;;;N;;;;;
+FE00;VARIATION SELECTOR-1;Mn;0;NSM;;;;;N;;;;;
+FE01;VARIATION SELECTOR-2;Mn;0;NSM;;;;;N;;;;;
+FE02;VARIATION SELECTOR-3;Mn;0;NSM;;;;;N;;;;;
+FE03;VARIATION SELECTOR-4;Mn;0;NSM;;;;;N;;;;;
+FE04;VARIATION SELECTOR-5;Mn;0;NSM;;;;;N;;;;;
+FE05;VARIATION SELECTOR-6;Mn;0;NSM;;;;;N;;;;;
+FE06;VARIATION SELECTOR-7;Mn;0;NSM;;;;;N;;;;;
+FE07;VARIATION SELECTOR-8;Mn;0;NSM;;;;;N;;;;;
+FE08;VARIATION SELECTOR-9;Mn;0;NSM;;;;;N;;;;;
+FE09;VARIATION SELECTOR-10;Mn;0;NSM;;;;;N;;;;;
+FE0A;VARIATION SELECTOR-11;Mn;0;NSM;;;;;N;;;;;
+FE0B;VARIATION SELECTOR-12;Mn;0;NSM;;;;;N;;;;;
+FE0C;VARIATION SELECTOR-13;Mn;0;NSM;;;;;N;;;;;
+FE0D;VARIATION SELECTOR-14;Mn;0;NSM;;;;;N;;;;;
+FE0E;VARIATION SELECTOR-15;Mn;0;NSM;;;;;N;;;;;
+FE0F;VARIATION SELECTOR-16;Mn;0;NSM;;;;;N;;;;;
+FE10;PRESENTATION FORM FOR VERTICAL COMMA;Po;0;ON;<vertical> 002C;;;;N;;;;;
+FE11;PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA;Po;0;ON;<vertical> 3001;;;;N;;;;;
+FE12;PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC FULL STOP;Po;0;ON;<vertical> 3002;;;;N;;;;;
+FE13;PRESENTATION FORM FOR VERTICAL COLON;Po;0;ON;<vertical> 003A;;;;N;;;;;
+FE14;PRESENTATION FORM FOR VERTICAL SEMICOLON;Po;0;ON;<vertical> 003B;;;;N;;;;;
+FE15;PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK;Po;0;ON;<vertical> 0021;;;;N;;;;;
+FE16;PRESENTATION FORM FOR VERTICAL QUESTION MARK;Po;0;ON;<vertical> 003F;;;;N;;;;;
+FE17;PRESENTATION FORM FOR VERTICAL LEFT WHITE LENTICULAR BRACKET;Ps;0;ON;<vertical> 3016;;;;N;;;;;
+FE18;PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRAKCET;Pe;0;ON;<vertical> 3017;;;;N;;;;;
+FE19;PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS;Po;0;ON;<vertical> 2026;;;;N;;;;;
+FE20;COMBINING LIGATURE LEFT HALF;Mn;230;NSM;;;;;N;;;;;
+FE21;COMBINING LIGATURE RIGHT HALF;Mn;230;NSM;;;;;N;;;;;
+FE22;COMBINING DOUBLE TILDE LEFT HALF;Mn;230;NSM;;;;;N;;;;;
+FE23;COMBINING DOUBLE TILDE RIGHT HALF;Mn;230;NSM;;;;;N;;;;;
+FE30;PRESENTATION FORM FOR VERTICAL TWO DOT LEADER;Po;0;ON;<vertical> 2025;;;;N;GLYPH FOR VERTICAL TWO DOT LEADER;;;;
+FE31;PRESENTATION FORM FOR VERTICAL EM DASH;Pd;0;ON;<vertical> 2014;;;;N;GLYPH FOR VERTICAL EM DASH;;;;
+FE32;PRESENTATION FORM FOR VERTICAL EN DASH;Pd;0;ON;<vertical> 2013;;;;N;GLYPH FOR VERTICAL EN DASH;;;;
+FE33;PRESENTATION FORM FOR VERTICAL LOW LINE;Pc;0;ON;<vertical> 005F;;;;N;GLYPH FOR VERTICAL SPACING UNDERSCORE;;;;
+FE34;PRESENTATION FORM FOR VERTICAL WAVY LOW LINE;Pc;0;ON;<vertical> 005F;;;;N;GLYPH FOR VERTICAL SPACING WAVY UNDERSCORE;;;;
+FE35;PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS;Ps;0;ON;<vertical> 0028;;;;N;GLYPH FOR VERTICAL OPENING PARENTHESIS;;;;
+FE36;PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS;Pe;0;ON;<vertical> 0029;;;;N;GLYPH FOR VERTICAL CLOSING PARENTHESIS;;;;
+FE37;PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET;Ps;0;ON;<vertical> 007B;;;;N;GLYPH FOR VERTICAL OPENING CURLY BRACKET;;;;
+FE38;PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET;Pe;0;ON;<vertical> 007D;;;;N;GLYPH FOR VERTICAL CLOSING CURLY BRACKET;;;;
+FE39;PRESENTATION FORM FOR VERTICAL LEFT TORTOISE SHELL BRACKET;Ps;0;ON;<vertical> 3014;;;;N;GLYPH FOR VERTICAL OPENING TORTOISE SHELL BRACKET;;;;
+FE3A;PRESENTATION FORM FOR VERTICAL RIGHT TORTOISE SHELL BRACKET;Pe;0;ON;<vertical> 3015;;;;N;GLYPH FOR VERTICAL CLOSING TORTOISE SHELL BRACKET;;;;
+FE3B;PRESENTATION FORM FOR VERTICAL LEFT BLACK LENTICULAR BRACKET;Ps;0;ON;<vertical> 3010;;;;N;GLYPH FOR VERTICAL OPENING BLACK LENTICULAR BRACKET;;;;
+FE3C;PRESENTATION FORM FOR VERTICAL RIGHT BLACK LENTICULAR BRACKET;Pe;0;ON;<vertical> 3011;;;;N;GLYPH FOR VERTICAL CLOSING BLACK LENTICULAR BRACKET;;;;
+FE3D;PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET;Ps;0;ON;<vertical> 300A;;;;N;GLYPH FOR VERTICAL OPENING DOUBLE ANGLE BRACKET;;;;
+FE3E;PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET;Pe;0;ON;<vertical> 300B;;;;N;GLYPH FOR VERTICAL CLOSING DOUBLE ANGLE BRACKET;;;;
+FE3F;PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET;Ps;0;ON;<vertical> 3008;;;;N;GLYPH FOR VERTICAL OPENING ANGLE BRACKET;;;;
+FE40;PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET;Pe;0;ON;<vertical> 3009;;;;N;GLYPH FOR VERTICAL CLOSING ANGLE BRACKET;;;;
+FE41;PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET;Ps;0;ON;<vertical> 300C;;;;N;GLYPH FOR VERTICAL OPENING CORNER BRACKET;;;;
+FE42;PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET;Pe;0;ON;<vertical> 300D;;;;N;GLYPH FOR VERTICAL CLOSING CORNER BRACKET;;;;
+FE43;PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET;Ps;0;ON;<vertical> 300E;;;;N;GLYPH FOR VERTICAL OPENING WHITE CORNER BRACKET;;;;
+FE44;PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET;Pe;0;ON;<vertical> 300F;;;;N;GLYPH FOR VERTICAL CLOSING WHITE CORNER BRACKET;;;;
+FE45;SESAME DOT;Po;0;ON;;;;;N;;;;;
+FE46;WHITE SESAME DOT;Po;0;ON;;;;;N;;;;;
+FE47;PRESENTATION FORM FOR VERTICAL LEFT SQUARE BRACKET;Ps;0;ON;<vertical> 005B;;;;N;;;;;
+FE48;PRESENTATION FORM FOR VERTICAL RIGHT SQUARE BRACKET;Pe;0;ON;<vertical> 005D;;;;N;;;;;
+FE49;DASHED OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING DASHED OVERSCORE;;;;
+FE4A;CENTRELINE OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING CENTERLINE OVERSCORE;;;;
+FE4B;WAVY OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING WAVY OVERSCORE;;;;
+FE4C;DOUBLE WAVY OVERLINE;Po;0;ON;<compat> 203E;;;;N;SPACING DOUBLE WAVY OVERSCORE;;;;
+FE4D;DASHED LOW LINE;Pc;0;ON;<compat> 005F;;;;N;SPACING DASHED UNDERSCORE;;;;
+FE4E;CENTRELINE LOW LINE;Pc;0;ON;<compat> 005F;;;;N;SPACING CENTERLINE UNDERSCORE;;;;
+FE4F;WAVY LOW LINE;Pc;0;ON;<compat> 005F;;;;N;SPACING WAVY UNDERSCORE;;;;
+FE50;SMALL COMMA;Po;0;CS;<small> 002C;;;;N;;;;;
+FE51;SMALL IDEOGRAPHIC COMMA;Po;0;ON;<small> 3001;;;;N;;;;;
+FE52;SMALL FULL STOP;Po;0;CS;<small> 002E;;;;N;SMALL PERIOD;;;;
+FE54;SMALL SEMICOLON;Po;0;ON;<small> 003B;;;;N;;;;;
+FE55;SMALL COLON;Po;0;CS;<small> 003A;;;;N;;;;;
+FE56;SMALL QUESTION MARK;Po;0;ON;<small> 003F;;;;N;;;;;
+FE57;SMALL EXCLAMATION MARK;Po;0;ON;<small> 0021;;;;N;;;;;
+FE58;SMALL EM DASH;Pd;0;ON;<small> 2014;;;;N;;;;;
+FE59;SMALL LEFT PARENTHESIS;Ps;0;ON;<small> 0028;;;;Y;SMALL OPENING PARENTHESIS;;;;
+FE5A;SMALL RIGHT PARENTHESIS;Pe;0;ON;<small> 0029;;;;Y;SMALL CLOSING PARENTHESIS;;;;
+FE5B;SMALL LEFT CURLY BRACKET;Ps;0;ON;<small> 007B;;;;Y;SMALL OPENING CURLY BRACKET;;;;
+FE5C;SMALL RIGHT CURLY BRACKET;Pe;0;ON;<small> 007D;;;;Y;SMALL CLOSING CURLY BRACKET;;;;
+FE5D;SMALL LEFT TORTOISE SHELL BRACKET;Ps;0;ON;<small> 3014;;;;Y;SMALL OPENING TORTOISE SHELL BRACKET;;;;
+FE5E;SMALL RIGHT TORTOISE SHELL BRACKET;Pe;0;ON;<small> 3015;;;;Y;SMALL CLOSING TORTOISE SHELL BRACKET;;;;
+FE5F;SMALL NUMBER SIGN;Po;0;ET;<small> 0023;;;;N;;;;;
+FE60;SMALL AMPERSAND;Po;0;ON;<small> 0026;;;;N;;;;;
+FE61;SMALL ASTERISK;Po;0;ON;<small> 002A;;;;N;;;;;
+FE62;SMALL PLUS SIGN;Sm;0;ES;<small> 002B;;;;N;;;;;
+FE63;SMALL HYPHEN-MINUS;Pd;0;ES;<small> 002D;;;;N;;;;;
+FE64;SMALL LESS-THAN SIGN;Sm;0;ON;<small> 003C;;;;Y;;;;;
+FE65;SMALL GREATER-THAN SIGN;Sm;0;ON;<small> 003E;;;;Y;;;;;
+FE66;SMALL EQUALS SIGN;Sm;0;ON;<small> 003D;;;;N;;;;;
+FE68;SMALL REVERSE SOLIDUS;Po;0;ON;<small> 005C;;;;N;SMALL BACKSLASH;;;;
+FE69;SMALL DOLLAR SIGN;Sc;0;ET;<small> 0024;;;;N;;;;;
+FE6A;SMALL PERCENT SIGN;Po;0;ET;<small> 0025;;;;N;;;;;
+FE6B;SMALL COMMERCIAL AT;Po;0;ON;<small> 0040;;;;N;;;;;
+FE70;ARABIC FATHATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064B;;;;N;ARABIC SPACING FATHATAN;;;;
+FE71;ARABIC TATWEEL WITH FATHATAN ABOVE;Lo;0;AL;<medial> 0640 064B;;;;N;ARABIC FATHATAN ON TATWEEL;;;;
+FE72;ARABIC DAMMATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064C;;;;N;ARABIC SPACING DAMMATAN;;;;
+FE73;ARABIC TAIL FRAGMENT;Lo;0;AL;;;;;N;;;;;
+FE74;ARABIC KASRATAN ISOLATED FORM;Lo;0;AL;<isolated> 0020 064D;;;;N;ARABIC SPACING KASRATAN;;;;
+FE76;ARABIC FATHA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064E;;;;N;ARABIC SPACING FATHAH;;;;
+FE77;ARABIC FATHA MEDIAL FORM;Lo;0;AL;<medial> 0640 064E;;;;N;ARABIC FATHAH ON TATWEEL;;;;
+FE78;ARABIC DAMMA ISOLATED FORM;Lo;0;AL;<isolated> 0020 064F;;;;N;ARABIC SPACING DAMMAH;;;;
+FE79;ARABIC DAMMA MEDIAL FORM;Lo;0;AL;<medial> 0640 064F;;;;N;ARABIC DAMMAH ON TATWEEL;;;;
+FE7A;ARABIC KASRA ISOLATED FORM;Lo;0;AL;<isolated> 0020 0650;;;;N;ARABIC SPACING KASRAH;;;;
+FE7B;ARABIC KASRA MEDIAL FORM;Lo;0;AL;<medial> 0640 0650;;;;N;ARABIC KASRAH ON TATWEEL;;;;
+FE7C;ARABIC SHADDA ISOLATED FORM;Lo;0;AL;<isolated> 0020 0651;;;;N;ARABIC SPACING SHADDAH;;;;
+FE7D;ARABIC SHADDA MEDIAL FORM;Lo;0;AL;<medial> 0640 0651;;;;N;ARABIC SHADDAH ON TATWEEL;;;;
+FE7E;ARABIC SUKUN ISOLATED FORM;Lo;0;AL;<isolated> 0020 0652;;;;N;ARABIC SPACING SUKUN;;;;
+FE7F;ARABIC SUKUN MEDIAL FORM;Lo;0;AL;<medial> 0640 0652;;;;N;ARABIC SUKUN ON TATWEEL;;;;
+FE80;ARABIC LETTER HAMZA ISOLATED FORM;Lo;0;AL;<isolated> 0621;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH;;;;
+FE81;ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0622;;;;N;GLYPH FOR ISOLATE ARABIC MADDAH ON ALEF;;;;
+FE82;ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM;Lo;0;AL;<final> 0622;;;;N;GLYPH FOR FINAL ARABIC MADDAH ON ALEF;;;;
+FE83;ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0623;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON ALEF;;;;
+FE84;ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0623;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON ALEF;;;;
+FE85;ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0624;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON WAW;;;;
+FE86;ARABIC LETTER WAW WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0624;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON WAW;;;;
+FE87;ARABIC LETTER ALEF WITH HAMZA BELOW ISOLATED FORM;Lo;0;AL;<isolated> 0625;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH UNDER ALEF;;;;
+FE88;ARABIC LETTER ALEF WITH HAMZA BELOW FINAL FORM;Lo;0;AL;<final> 0625;;;;N;GLYPH FOR FINAL ARABIC HAMZAH UNDER ALEF;;;;
+FE89;ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0626;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON YA;;;;
+FE8A;ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0626;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON YA;;;;
+FE8B;ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM;Lo;0;AL;<initial> 0626;;;;N;GLYPH FOR INITIAL ARABIC HAMZAH ON YA;;;;
+FE8C;ARABIC LETTER YEH WITH HAMZA ABOVE MEDIAL FORM;Lo;0;AL;<medial> 0626;;;;N;GLYPH FOR MEDIAL ARABIC HAMZAH ON YA;;;;
+FE8D;ARABIC LETTER ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0627;;;;N;GLYPH FOR ISOLATE ARABIC ALEF;;;;
+FE8E;ARABIC LETTER ALEF FINAL FORM;Lo;0;AL;<final> 0627;;;;N;GLYPH FOR FINAL ARABIC ALEF;;;;
+FE8F;ARABIC LETTER BEH ISOLATED FORM;Lo;0;AL;<isolated> 0628;;;;N;GLYPH FOR ISOLATE ARABIC BAA;;;;
+FE90;ARABIC LETTER BEH FINAL FORM;Lo;0;AL;<final> 0628;;;;N;GLYPH FOR FINAL ARABIC BAA;;;;
+FE91;ARABIC LETTER BEH INITIAL FORM;Lo;0;AL;<initial> 0628;;;;N;GLYPH FOR INITIAL ARABIC BAA;;;;
+FE92;ARABIC LETTER BEH MEDIAL FORM;Lo;0;AL;<medial> 0628;;;;N;GLYPH FOR MEDIAL ARABIC BAA;;;;
+FE93;ARABIC LETTER TEH MARBUTA ISOLATED FORM;Lo;0;AL;<isolated> 0629;;;;N;GLYPH FOR ISOLATE ARABIC TAA MARBUTAH;;;;
+FE94;ARABIC LETTER TEH MARBUTA FINAL FORM;Lo;0;AL;<final> 0629;;;;N;GLYPH FOR FINAL ARABIC TAA MARBUTAH;;;;
+FE95;ARABIC LETTER TEH ISOLATED FORM;Lo;0;AL;<isolated> 062A;;;;N;GLYPH FOR ISOLATE ARABIC TAA;;;;
+FE96;ARABIC LETTER TEH FINAL FORM;Lo;0;AL;<final> 062A;;;;N;GLYPH FOR FINAL ARABIC TAA;;;;
+FE97;ARABIC LETTER TEH INITIAL FORM;Lo;0;AL;<initial> 062A;;;;N;GLYPH FOR INITIAL ARABIC TAA;;;;
+FE98;ARABIC LETTER TEH MEDIAL FORM;Lo;0;AL;<medial> 062A;;;;N;GLYPH FOR MEDIAL ARABIC TAA;;;;
+FE99;ARABIC LETTER THEH ISOLATED FORM;Lo;0;AL;<isolated> 062B;;;;N;GLYPH FOR ISOLATE ARABIC THAA;;;;
+FE9A;ARABIC LETTER THEH FINAL FORM;Lo;0;AL;<final> 062B;;;;N;GLYPH FOR FINAL ARABIC THAA;;;;
+FE9B;ARABIC LETTER THEH INITIAL FORM;Lo;0;AL;<initial> 062B;;;;N;GLYPH FOR INITIAL ARABIC THAA;;;;
+FE9C;ARABIC LETTER THEH MEDIAL FORM;Lo;0;AL;<medial> 062B;;;;N;GLYPH FOR MEDIAL ARABIC THAA;;;;
+FE9D;ARABIC LETTER JEEM ISOLATED FORM;Lo;0;AL;<isolated> 062C;;;;N;GLYPH FOR ISOLATE ARABIC JEEM;;;;
+FE9E;ARABIC LETTER JEEM FINAL FORM;Lo;0;AL;<final> 062C;;;;N;GLYPH FOR FINAL ARABIC JEEM;;;;
+FE9F;ARABIC LETTER JEEM INITIAL FORM;Lo;0;AL;<initial> 062C;;;;N;GLYPH FOR INITIAL ARABIC JEEM;;;;
+FEA0;ARABIC LETTER JEEM MEDIAL FORM;Lo;0;AL;<medial> 062C;;;;N;GLYPH FOR MEDIAL ARABIC JEEM;;;;
+FEA1;ARABIC LETTER HAH ISOLATED FORM;Lo;0;AL;<isolated> 062D;;;;N;GLYPH FOR ISOLATE ARABIC HAA;;;;
+FEA2;ARABIC LETTER HAH FINAL FORM;Lo;0;AL;<final> 062D;;;;N;GLYPH FOR FINAL ARABIC HAA;;;;
+FEA3;ARABIC LETTER HAH INITIAL FORM;Lo;0;AL;<initial> 062D;;;;N;GLYPH FOR INITIAL ARABIC HAA;;;;
+FEA4;ARABIC LETTER HAH MEDIAL FORM;Lo;0;AL;<medial> 062D;;;;N;GLYPH FOR MEDIAL ARABIC HAA;;;;
+FEA5;ARABIC LETTER KHAH ISOLATED FORM;Lo;0;AL;<isolated> 062E;;;;N;GLYPH FOR ISOLATE ARABIC KHAA;;;;
+FEA6;ARABIC LETTER KHAH FINAL FORM;Lo;0;AL;<final> 062E;;;;N;GLYPH FOR FINAL ARABIC KHAA;;;;
+FEA7;ARABIC LETTER KHAH INITIAL FORM;Lo;0;AL;<initial> 062E;;;;N;GLYPH FOR INITIAL ARABIC KHAA;;;;
+FEA8;ARABIC LETTER KHAH MEDIAL FORM;Lo;0;AL;<medial> 062E;;;;N;GLYPH FOR MEDIAL ARABIC KHAA;;;;
+FEA9;ARABIC LETTER DAL ISOLATED FORM;Lo;0;AL;<isolated> 062F;;;;N;GLYPH FOR ISOLATE ARABIC DAL;;;;
+FEAA;ARABIC LETTER DAL FINAL FORM;Lo;0;AL;<final> 062F;;;;N;GLYPH FOR FINAL ARABIC DAL;;;;
+FEAB;ARABIC LETTER THAL ISOLATED FORM;Lo;0;AL;<isolated> 0630;;;;N;GLYPH FOR ISOLATE ARABIC THAL;;;;
+FEAC;ARABIC LETTER THAL FINAL FORM;Lo;0;AL;<final> 0630;;;;N;GLYPH FOR FINAL ARABIC THAL;;;;
+FEAD;ARABIC LETTER REH ISOLATED FORM;Lo;0;AL;<isolated> 0631;;;;N;GLYPH FOR ISOLATE ARABIC RA;;;;
+FEAE;ARABIC LETTER REH FINAL FORM;Lo;0;AL;<final> 0631;;;;N;GLYPH FOR FINAL ARABIC RA;;;;
+FEAF;ARABIC LETTER ZAIN ISOLATED FORM;Lo;0;AL;<isolated> 0632;;;;N;GLYPH FOR ISOLATE ARABIC ZAIN;;;;
+FEB0;ARABIC LETTER ZAIN FINAL FORM;Lo;0;AL;<final> 0632;;;;N;GLYPH FOR FINAL ARABIC ZAIN;;;;
+FEB1;ARABIC LETTER SEEN ISOLATED FORM;Lo;0;AL;<isolated> 0633;;;;N;GLYPH FOR ISOLATE ARABIC SEEN;;;;
+FEB2;ARABIC LETTER SEEN FINAL FORM;Lo;0;AL;<final> 0633;;;;N;GLYPH FOR FINAL ARABIC SEEN;;;;
+FEB3;ARABIC LETTER SEEN INITIAL FORM;Lo;0;AL;<initial> 0633;;;;N;GLYPH FOR INITIAL ARABIC SEEN;;;;
+FEB4;ARABIC LETTER SEEN MEDIAL FORM;Lo;0;AL;<medial> 0633;;;;N;GLYPH FOR MEDIAL ARABIC SEEN;;;;
+FEB5;ARABIC LETTER SHEEN ISOLATED FORM;Lo;0;AL;<isolated> 0634;;;;N;GLYPH FOR ISOLATE ARABIC SHEEN;;;;
+FEB6;ARABIC LETTER SHEEN FINAL FORM;Lo;0;AL;<final> 0634;;;;N;GLYPH FOR FINAL ARABIC SHEEN;;;;
+FEB7;ARABIC LETTER SHEEN INITIAL FORM;Lo;0;AL;<initial> 0634;;;;N;GLYPH FOR INITIAL ARABIC SHEEN;;;;
+FEB8;ARABIC LETTER SHEEN MEDIAL FORM;Lo;0;AL;<medial> 0634;;;;N;GLYPH FOR MEDIAL ARABIC SHEEN;;;;
+FEB9;ARABIC LETTER SAD ISOLATED FORM;Lo;0;AL;<isolated> 0635;;;;N;GLYPH FOR ISOLATE ARABIC SAD;;;;
+FEBA;ARABIC LETTER SAD FINAL FORM;Lo;0;AL;<final> 0635;;;;N;GLYPH FOR FINAL ARABIC SAD;;;;
+FEBB;ARABIC LETTER SAD INITIAL FORM;Lo;0;AL;<initial> 0635;;;;N;GLYPH FOR INITIAL ARABIC SAD;;;;
+FEBC;ARABIC LETTER SAD MEDIAL FORM;Lo;0;AL;<medial> 0635;;;;N;GLYPH FOR MEDIAL ARABIC SAD;;;;
+FEBD;ARABIC LETTER DAD ISOLATED FORM;Lo;0;AL;<isolated> 0636;;;;N;GLYPH FOR ISOLATE ARABIC DAD;;;;
+FEBE;ARABIC LETTER DAD FINAL FORM;Lo;0;AL;<final> 0636;;;;N;GLYPH FOR FINAL ARABIC DAD;;;;
+FEBF;ARABIC LETTER DAD INITIAL FORM;Lo;0;AL;<initial> 0636;;;;N;GLYPH FOR INITIAL ARABIC DAD;;;;
+FEC0;ARABIC LETTER DAD MEDIAL FORM;Lo;0;AL;<medial> 0636;;;;N;GLYPH FOR MEDIAL ARABIC DAD;;;;
+FEC1;ARABIC LETTER TAH ISOLATED FORM;Lo;0;AL;<isolated> 0637;;;;N;GLYPH FOR ISOLATE ARABIC TAH;;;;
+FEC2;ARABIC LETTER TAH FINAL FORM;Lo;0;AL;<final> 0637;;;;N;GLYPH FOR FINAL ARABIC TAH;;;;
+FEC3;ARABIC LETTER TAH INITIAL FORM;Lo;0;AL;<initial> 0637;;;;N;GLYPH FOR INITIAL ARABIC TAH;;;;
+FEC4;ARABIC LETTER TAH MEDIAL FORM;Lo;0;AL;<medial> 0637;;;;N;GLYPH FOR MEDIAL ARABIC TAH;;;;
+FEC5;ARABIC LETTER ZAH ISOLATED FORM;Lo;0;AL;<isolated> 0638;;;;N;GLYPH FOR ISOLATE ARABIC DHAH;;;;
+FEC6;ARABIC LETTER ZAH FINAL FORM;Lo;0;AL;<final> 0638;;;;N;GLYPH FOR FINAL ARABIC DHAH;;;;
+FEC7;ARABIC LETTER ZAH INITIAL FORM;Lo;0;AL;<initial> 0638;;;;N;GLYPH FOR INITIAL ARABIC DHAH;;;;
+FEC8;ARABIC LETTER ZAH MEDIAL FORM;Lo;0;AL;<medial> 0638;;;;N;GLYPH FOR MEDIAL ARABIC DHAH;;;;
+FEC9;ARABIC LETTER AIN ISOLATED FORM;Lo;0;AL;<isolated> 0639;;;;N;GLYPH FOR ISOLATE ARABIC AIN;;;;
+FECA;ARABIC LETTER AIN FINAL FORM;Lo;0;AL;<final> 0639;;;;N;GLYPH FOR FINAL ARABIC AIN;;;;
+FECB;ARABIC LETTER AIN INITIAL FORM;Lo;0;AL;<initial> 0639;;;;N;GLYPH FOR INITIAL ARABIC AIN;;;;
+FECC;ARABIC LETTER AIN MEDIAL FORM;Lo;0;AL;<medial> 0639;;;;N;GLYPH FOR MEDIAL ARABIC AIN;;;;
+FECD;ARABIC LETTER GHAIN ISOLATED FORM;Lo;0;AL;<isolated> 063A;;;;N;GLYPH FOR ISOLATE ARABIC GHAIN;;;;
+FECE;ARABIC LETTER GHAIN FINAL FORM;Lo;0;AL;<final> 063A;;;;N;GLYPH FOR FINAL ARABIC GHAIN;;;;
+FECF;ARABIC LETTER GHAIN INITIAL FORM;Lo;0;AL;<initial> 063A;;;;N;GLYPH FOR INITIAL ARABIC GHAIN;;;;
+FED0;ARABIC LETTER GHAIN MEDIAL FORM;Lo;0;AL;<medial> 063A;;;;N;GLYPH FOR MEDIAL ARABIC GHAIN;;;;
+FED1;ARABIC LETTER FEH ISOLATED FORM;Lo;0;AL;<isolated> 0641;;;;N;GLYPH FOR ISOLATE ARABIC FA;;;;
+FED2;ARABIC LETTER FEH FINAL FORM;Lo;0;AL;<final> 0641;;;;N;GLYPH FOR FINAL ARABIC FA;;;;
+FED3;ARABIC LETTER FEH INITIAL FORM;Lo;0;AL;<initial> 0641;;;;N;GLYPH FOR INITIAL ARABIC FA;;;;
+FED4;ARABIC LETTER FEH MEDIAL FORM;Lo;0;AL;<medial> 0641;;;;N;GLYPH FOR MEDIAL ARABIC FA;;;;
+FED5;ARABIC LETTER QAF ISOLATED FORM;Lo;0;AL;<isolated> 0642;;;;N;GLYPH FOR ISOLATE ARABIC QAF;;;;
+FED6;ARABIC LETTER QAF FINAL FORM;Lo;0;AL;<final> 0642;;;;N;GLYPH FOR FINAL ARABIC QAF;;;;
+FED7;ARABIC LETTER QAF INITIAL FORM;Lo;0;AL;<initial> 0642;;;;N;GLYPH FOR INITIAL ARABIC QAF;;;;
+FED8;ARABIC LETTER QAF MEDIAL FORM;Lo;0;AL;<medial> 0642;;;;N;GLYPH FOR MEDIAL ARABIC QAF;;;;
+FED9;ARABIC LETTER KAF ISOLATED FORM;Lo;0;AL;<isolated> 0643;;;;N;GLYPH FOR ISOLATE ARABIC CAF;;;;
+FEDA;ARABIC LETTER KAF FINAL FORM;Lo;0;AL;<final> 0643;;;;N;GLYPH FOR FINAL ARABIC CAF;;;;
+FEDB;ARABIC LETTER KAF INITIAL FORM;Lo;0;AL;<initial> 0643;;;;N;GLYPH FOR INITIAL ARABIC CAF;;;;
+FEDC;ARABIC LETTER KAF MEDIAL FORM;Lo;0;AL;<medial> 0643;;;;N;GLYPH FOR MEDIAL ARABIC CAF;;;;
+FEDD;ARABIC LETTER LAM ISOLATED FORM;Lo;0;AL;<isolated> 0644;;;;N;GLYPH FOR ISOLATE ARABIC LAM;;;;
+FEDE;ARABIC LETTER LAM FINAL FORM;Lo;0;AL;<final> 0644;;;;N;GLYPH FOR FINAL ARABIC LAM;;;;
+FEDF;ARABIC LETTER LAM INITIAL FORM;Lo;0;AL;<initial> 0644;;;;N;GLYPH FOR INITIAL ARABIC LAM;;;;
+FEE0;ARABIC LETTER LAM MEDIAL FORM;Lo;0;AL;<medial> 0644;;;;N;GLYPH FOR MEDIAL ARABIC LAM;;;;
+FEE1;ARABIC LETTER MEEM ISOLATED FORM;Lo;0;AL;<isolated> 0645;;;;N;GLYPH FOR ISOLATE ARABIC MEEM;;;;
+FEE2;ARABIC LETTER MEEM FINAL FORM;Lo;0;AL;<final> 0645;;;;N;GLYPH FOR FINAL ARABIC MEEM;;;;
+FEE3;ARABIC LETTER MEEM INITIAL FORM;Lo;0;AL;<initial> 0645;;;;N;GLYPH FOR INITIAL ARABIC MEEM;;;;
+FEE4;ARABIC LETTER MEEM MEDIAL FORM;Lo;0;AL;<medial> 0645;;;;N;GLYPH FOR MEDIAL ARABIC MEEM;;;;
+FEE5;ARABIC LETTER NOON ISOLATED FORM;Lo;0;AL;<isolated> 0646;;;;N;GLYPH FOR ISOLATE ARABIC NOON;;;;
+FEE6;ARABIC LETTER NOON FINAL FORM;Lo;0;AL;<final> 0646;;;;N;GLYPH FOR FINAL ARABIC NOON;;;;
+FEE7;ARABIC LETTER NOON INITIAL FORM;Lo;0;AL;<initial> 0646;;;;N;GLYPH FOR INITIAL ARABIC NOON;;;;
+FEE8;ARABIC LETTER NOON MEDIAL FORM;Lo;0;AL;<medial> 0646;;;;N;GLYPH FOR MEDIAL ARABIC NOON;;;;
+FEE9;ARABIC LETTER HEH ISOLATED FORM;Lo;0;AL;<isolated> 0647;;;;N;GLYPH FOR ISOLATE ARABIC HA;;;;
+FEEA;ARABIC LETTER HEH FINAL FORM;Lo;0;AL;<final> 0647;;;;N;GLYPH FOR FINAL ARABIC HA;;;;
+FEEB;ARABIC LETTER HEH INITIAL FORM;Lo;0;AL;<initial> 0647;;;;N;GLYPH FOR INITIAL ARABIC HA;;;;
+FEEC;ARABIC LETTER HEH MEDIAL FORM;Lo;0;AL;<medial> 0647;;;;N;GLYPH FOR MEDIAL ARABIC HA;;;;
+FEED;ARABIC LETTER WAW ISOLATED FORM;Lo;0;AL;<isolated> 0648;;;;N;GLYPH FOR ISOLATE ARABIC WAW;;;;
+FEEE;ARABIC LETTER WAW FINAL FORM;Lo;0;AL;<final> 0648;;;;N;GLYPH FOR FINAL ARABIC WAW;;;;
+FEEF;ARABIC LETTER ALEF MAKSURA ISOLATED FORM;Lo;0;AL;<isolated> 0649;;;;N;GLYPH FOR ISOLATE ARABIC ALEF MAQSURAH;;;;
+FEF0;ARABIC LETTER ALEF MAKSURA FINAL FORM;Lo;0;AL;<final> 0649;;;;N;GLYPH FOR FINAL ARABIC ALEF MAQSURAH;;;;
+FEF1;ARABIC LETTER YEH ISOLATED FORM;Lo;0;AL;<isolated> 064A;;;;N;GLYPH FOR ISOLATE ARABIC YA;;;;
+FEF2;ARABIC LETTER YEH FINAL FORM;Lo;0;AL;<final> 064A;;;;N;GLYPH FOR FINAL ARABIC YA;;;;
+FEF3;ARABIC LETTER YEH INITIAL FORM;Lo;0;AL;<initial> 064A;;;;N;GLYPH FOR INITIAL ARABIC YA;;;;
+FEF4;ARABIC LETTER YEH MEDIAL FORM;Lo;0;AL;<medial> 064A;;;;N;GLYPH FOR MEDIAL ARABIC YA;;;;
+FEF5;ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0644 0622;;;;N;GLYPH FOR ISOLATE ARABIC MADDAH ON LIGATURE LAM ALEF;;;;
+FEF6;ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM;Lo;0;AL;<final> 0644 0622;;;;N;GLYPH FOR FINAL ARABIC MADDAH ON LIGATURE LAM ALEF;;;;
+FEF7;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM;Lo;0;AL;<isolated> 0644 0623;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH ON LIGATURE LAM ALEF;;;;
+FEF8;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM;Lo;0;AL;<final> 0644 0623;;;;N;GLYPH FOR FINAL ARABIC HAMZAH ON LIGATURE LAM ALEF;;;;
+FEF9;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW ISOLATED FORM;Lo;0;AL;<isolated> 0644 0625;;;;N;GLYPH FOR ISOLATE ARABIC HAMZAH UNDER LIGATURE LAM ALEF;;;;
+FEFA;ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW FINAL FORM;Lo;0;AL;<final> 0644 0625;;;;N;GLYPH FOR FINAL ARABIC HAMZAH UNDER LIGATURE LAM ALEF;;;;
+FEFB;ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM;Lo;0;AL;<isolated> 0644 0627;;;;N;GLYPH FOR ISOLATE ARABIC LIGATURE LAM ALEF;;;;
+FEFC;ARABIC LIGATURE LAM WITH ALEF FINAL FORM;Lo;0;AL;<final> 0644 0627;;;;N;GLYPH FOR FINAL ARABIC LIGATURE LAM ALEF;;;;
+FEFF;ZERO WIDTH NO-BREAK SPACE;Cf;0;BN;;;;;N;BYTE ORDER MARK;;;;
+FF01;FULLWIDTH EXCLAMATION MARK;Po;0;ON;<wide> 0021;;;;N;;;;;
+FF02;FULLWIDTH QUOTATION MARK;Po;0;ON;<wide> 0022;;;;N;;;;;
+FF03;FULLWIDTH NUMBER SIGN;Po;0;ET;<wide> 0023;;;;N;;;;;
+FF04;FULLWIDTH DOLLAR SIGN;Sc;0;ET;<wide> 0024;;;;N;;;;;
+FF05;FULLWIDTH PERCENT SIGN;Po;0;ET;<wide> 0025;;;;N;;;;;
+FF06;FULLWIDTH AMPERSAND;Po;0;ON;<wide> 0026;;;;N;;;;;
+FF07;FULLWIDTH APOSTROPHE;Po;0;ON;<wide> 0027;;;;N;;;;;
+FF08;FULLWIDTH LEFT PARENTHESIS;Ps;0;ON;<wide> 0028;;;;Y;FULLWIDTH OPENING PARENTHESIS;;;;
+FF09;FULLWIDTH RIGHT PARENTHESIS;Pe;0;ON;<wide> 0029;;;;Y;FULLWIDTH CLOSING PARENTHESIS;;;;
+FF0A;FULLWIDTH ASTERISK;Po;0;ON;<wide> 002A;;;;N;;;;;
+FF0B;FULLWIDTH PLUS SIGN;Sm;0;ES;<wide> 002B;;;;N;;;;;
+FF0C;FULLWIDTH COMMA;Po;0;CS;<wide> 002C;;;;N;;;;;
+FF0D;FULLWIDTH HYPHEN-MINUS;Pd;0;ES;<wide> 002D;;;;N;;;;;
+FF0E;FULLWIDTH FULL STOP;Po;0;CS;<wide> 002E;;;;N;FULLWIDTH PERIOD;;;;
+FF0F;FULLWIDTH SOLIDUS;Po;0;CS;<wide> 002F;;;;N;FULLWIDTH SLASH;;;;
+FF10;FULLWIDTH DIGIT ZERO;Nd;0;EN;<wide> 0030;0;0;0;N;;;;;
+FF11;FULLWIDTH DIGIT ONE;Nd;0;EN;<wide> 0031;1;1;1;N;;;;;
+FF12;FULLWIDTH DIGIT TWO;Nd;0;EN;<wide> 0032;2;2;2;N;;;;;
+FF13;FULLWIDTH DIGIT THREE;Nd;0;EN;<wide> 0033;3;3;3;N;;;;;
+FF14;FULLWIDTH DIGIT FOUR;Nd;0;EN;<wide> 0034;4;4;4;N;;;;;
+FF15;FULLWIDTH DIGIT FIVE;Nd;0;EN;<wide> 0035;5;5;5;N;;;;;
+FF16;FULLWIDTH DIGIT SIX;Nd;0;EN;<wide> 0036;6;6;6;N;;;;;
+FF17;FULLWIDTH DIGIT SEVEN;Nd;0;EN;<wide> 0037;7;7;7;N;;;;;
+FF18;FULLWIDTH DIGIT EIGHT;Nd;0;EN;<wide> 0038;8;8;8;N;;;;;
+FF19;FULLWIDTH DIGIT NINE;Nd;0;EN;<wide> 0039;9;9;9;N;;;;;
+FF1A;FULLWIDTH COLON;Po;0;CS;<wide> 003A;;;;N;;;;;
+FF1B;FULLWIDTH SEMICOLON;Po;0;ON;<wide> 003B;;;;N;;;;;
+FF1C;FULLWIDTH LESS-THAN SIGN;Sm;0;ON;<wide> 003C;;;;Y;;;;;
+FF1D;FULLWIDTH EQUALS SIGN;Sm;0;ON;<wide> 003D;;;;N;;;;;
+FF1E;FULLWIDTH GREATER-THAN SIGN;Sm;0;ON;<wide> 003E;;;;Y;;;;;
+FF1F;FULLWIDTH QUESTION MARK;Po;0;ON;<wide> 003F;;;;N;;;;;
+FF20;FULLWIDTH COMMERCIAL AT;Po;0;ON;<wide> 0040;;;;N;;;;;
+FF21;FULLWIDTH LATIN CAPITAL LETTER A;Lu;0;L;<wide> 0041;;;;N;;;;FF41;
+FF22;FULLWIDTH LATIN CAPITAL LETTER B;Lu;0;L;<wide> 0042;;;;N;;;;FF42;
+FF23;FULLWIDTH LATIN CAPITAL LETTER C;Lu;0;L;<wide> 0043;;;;N;;;;FF43;
+FF24;FULLWIDTH LATIN CAPITAL LETTER D;Lu;0;L;<wide> 0044;;;;N;;;;FF44;
+FF25;FULLWIDTH LATIN CAPITAL LETTER E;Lu;0;L;<wide> 0045;;;;N;;;;FF45;
+FF26;FULLWIDTH LATIN CAPITAL LETTER F;Lu;0;L;<wide> 0046;;;;N;;;;FF46;
+FF27;FULLWIDTH LATIN CAPITAL LETTER G;Lu;0;L;<wide> 0047;;;;N;;;;FF47;
+FF28;FULLWIDTH LATIN CAPITAL LETTER H;Lu;0;L;<wide> 0048;;;;N;;;;FF48;
+FF29;FULLWIDTH LATIN CAPITAL LETTER I;Lu;0;L;<wide> 0049;;;;N;;;;FF49;
+FF2A;FULLWIDTH LATIN CAPITAL LETTER J;Lu;0;L;<wide> 004A;;;;N;;;;FF4A;
+FF2B;FULLWIDTH LATIN CAPITAL LETTER K;Lu;0;L;<wide> 004B;;;;N;;;;FF4B;
+FF2C;FULLWIDTH LATIN CAPITAL LETTER L;Lu;0;L;<wide> 004C;;;;N;;;;FF4C;
+FF2D;FULLWIDTH LATIN CAPITAL LETTER M;Lu;0;L;<wide> 004D;;;;N;;;;FF4D;
+FF2E;FULLWIDTH LATIN CAPITAL LETTER N;Lu;0;L;<wide> 004E;;;;N;;;;FF4E;
+FF2F;FULLWIDTH LATIN CAPITAL LETTER O;Lu;0;L;<wide> 004F;;;;N;;;;FF4F;
+FF30;FULLWIDTH LATIN CAPITAL LETTER P;Lu;0;L;<wide> 0050;;;;N;;;;FF50;
+FF31;FULLWIDTH LATIN CAPITAL LETTER Q;Lu;0;L;<wide> 0051;;;;N;;;;FF51;
+FF32;FULLWIDTH LATIN CAPITAL LETTER R;Lu;0;L;<wide> 0052;;;;N;;;;FF52;
+FF33;FULLWIDTH LATIN CAPITAL LETTER S;Lu;0;L;<wide> 0053;;;;N;;;;FF53;
+FF34;FULLWIDTH LATIN CAPITAL LETTER T;Lu;0;L;<wide> 0054;;;;N;;;;FF54;
+FF35;FULLWIDTH LATIN CAPITAL LETTER U;Lu;0;L;<wide> 0055;;;;N;;;;FF55;
+FF36;FULLWIDTH LATIN CAPITAL LETTER V;Lu;0;L;<wide> 0056;;;;N;;;;FF56;
+FF37;FULLWIDTH LATIN CAPITAL LETTER W;Lu;0;L;<wide> 0057;;;;N;;;;FF57;
+FF38;FULLWIDTH LATIN CAPITAL LETTER X;Lu;0;L;<wide> 0058;;;;N;;;;FF58;
+FF39;FULLWIDTH LATIN CAPITAL LETTER Y;Lu;0;L;<wide> 0059;;;;N;;;;FF59;
+FF3A;FULLWIDTH LATIN CAPITAL LETTER Z;Lu;0;L;<wide> 005A;;;;N;;;;FF5A;
+FF3B;FULLWIDTH LEFT SQUARE BRACKET;Ps;0;ON;<wide> 005B;;;;Y;FULLWIDTH OPENING SQUARE BRACKET;;;;
+FF3C;FULLWIDTH REVERSE SOLIDUS;Po;0;ON;<wide> 005C;;;;N;FULLWIDTH BACKSLASH;;;;
+FF3D;FULLWIDTH RIGHT SQUARE BRACKET;Pe;0;ON;<wide> 005D;;;;Y;FULLWIDTH CLOSING SQUARE BRACKET;;;;
+FF3E;FULLWIDTH CIRCUMFLEX ACCENT;Sk;0;ON;<wide> 005E;;;;N;FULLWIDTH SPACING CIRCUMFLEX;;;;
+FF3F;FULLWIDTH LOW LINE;Pc;0;ON;<wide> 005F;;;;N;FULLWIDTH SPACING UNDERSCORE;;;;
+FF40;FULLWIDTH GRAVE ACCENT;Sk;0;ON;<wide> 0060;;;;N;FULLWIDTH SPACING GRAVE;;;;
+FF41;FULLWIDTH LATIN SMALL LETTER A;Ll;0;L;<wide> 0061;;;;N;;;FF21;;FF21
+FF42;FULLWIDTH LATIN SMALL LETTER B;Ll;0;L;<wide> 0062;;;;N;;;FF22;;FF22
+FF43;FULLWIDTH LATIN SMALL LETTER C;Ll;0;L;<wide> 0063;;;;N;;;FF23;;FF23
+FF44;FULLWIDTH LATIN SMALL LETTER D;Ll;0;L;<wide> 0064;;;;N;;;FF24;;FF24
+FF45;FULLWIDTH LATIN SMALL LETTER E;Ll;0;L;<wide> 0065;;;;N;;;FF25;;FF25
+FF46;FULLWIDTH LATIN SMALL LETTER F;Ll;0;L;<wide> 0066;;;;N;;;FF26;;FF26
+FF47;FULLWIDTH LATIN SMALL LETTER G;Ll;0;L;<wide> 0067;;;;N;;;FF27;;FF27
+FF48;FULLWIDTH LATIN SMALL LETTER H;Ll;0;L;<wide> 0068;;;;N;;;FF28;;FF28
+FF49;FULLWIDTH LATIN SMALL LETTER I;Ll;0;L;<wide> 0069;;;;N;;;FF29;;FF29
+FF4A;FULLWIDTH LATIN SMALL LETTER J;Ll;0;L;<wide> 006A;;;;N;;;FF2A;;FF2A
+FF4B;FULLWIDTH LATIN SMALL LETTER K;Ll;0;L;<wide> 006B;;;;N;;;FF2B;;FF2B
+FF4C;FULLWIDTH LATIN SMALL LETTER L;Ll;0;L;<wide> 006C;;;;N;;;FF2C;;FF2C
+FF4D;FULLWIDTH LATIN SMALL LETTER M;Ll;0;L;<wide> 006D;;;;N;;;FF2D;;FF2D
+FF4E;FULLWIDTH LATIN SMALL LETTER N;Ll;0;L;<wide> 006E;;;;N;;;FF2E;;FF2E
+FF4F;FULLWIDTH LATIN SMALL LETTER O;Ll;0;L;<wide> 006F;;;;N;;;FF2F;;FF2F
+FF50;FULLWIDTH LATIN SMALL LETTER P;Ll;0;L;<wide> 0070;;;;N;;;FF30;;FF30
+FF51;FULLWIDTH LATIN SMALL LETTER Q;Ll;0;L;<wide> 0071;;;;N;;;FF31;;FF31
+FF52;FULLWIDTH LATIN SMALL LETTER R;Ll;0;L;<wide> 0072;;;;N;;;FF32;;FF32
+FF53;FULLWIDTH LATIN SMALL LETTER S;Ll;0;L;<wide> 0073;;;;N;;;FF33;;FF33
+FF54;FULLWIDTH LATIN SMALL LETTER T;Ll;0;L;<wide> 0074;;;;N;;;FF34;;FF34
+FF55;FULLWIDTH LATIN SMALL LETTER U;Ll;0;L;<wide> 0075;;;;N;;;FF35;;FF35
+FF56;FULLWIDTH LATIN SMALL LETTER V;Ll;0;L;<wide> 0076;;;;N;;;FF36;;FF36
+FF57;FULLWIDTH LATIN SMALL LETTER W;Ll;0;L;<wide> 0077;;;;N;;;FF37;;FF37
+FF58;FULLWIDTH LATIN SMALL LETTER X;Ll;0;L;<wide> 0078;;;;N;;;FF38;;FF38
+FF59;FULLWIDTH LATIN SMALL LETTER Y;Ll;0;L;<wide> 0079;;;;N;;;FF39;;FF39
+FF5A;FULLWIDTH LATIN SMALL LETTER Z;Ll;0;L;<wide> 007A;;;;N;;;FF3A;;FF3A
+FF5B;FULLWIDTH LEFT CURLY BRACKET;Ps;0;ON;<wide> 007B;;;;Y;FULLWIDTH OPENING CURLY BRACKET;;;;
+FF5C;FULLWIDTH VERTICAL LINE;Sm;0;ON;<wide> 007C;;;;N;FULLWIDTH VERTICAL BAR;;;;
+FF5D;FULLWIDTH RIGHT CURLY BRACKET;Pe;0;ON;<wide> 007D;;;;Y;FULLWIDTH CLOSING CURLY BRACKET;;;;
+FF5E;FULLWIDTH TILDE;Sm;0;ON;<wide> 007E;;;;N;FULLWIDTH SPACING TILDE;;;;
+FF5F;FULLWIDTH LEFT WHITE PARENTHESIS;Ps;0;ON;<wide> 2985;;;;Y;;*;;;
+FF60;FULLWIDTH RIGHT WHITE PARENTHESIS;Pe;0;ON;<wide> 2986;;;;Y;;*;;;
+FF61;HALFWIDTH IDEOGRAPHIC FULL STOP;Po;0;ON;<narrow> 3002;;;;N;HALFWIDTH IDEOGRAPHIC PERIOD;;;;
+FF62;HALFWIDTH LEFT CORNER BRACKET;Ps;0;ON;<narrow> 300C;;;;Y;HALFWIDTH OPENING CORNER BRACKET;;;;
+FF63;HALFWIDTH RIGHT CORNER BRACKET;Pe;0;ON;<narrow> 300D;;;;Y;HALFWIDTH CLOSING CORNER BRACKET;;;;
+FF64;HALFWIDTH IDEOGRAPHIC COMMA;Po;0;ON;<narrow> 3001;;;;N;;;;;
+FF65;HALFWIDTH KATAKANA MIDDLE DOT;Po;0;ON;<narrow> 30FB;;;;N;;;;;
+FF66;HALFWIDTH KATAKANA LETTER WO;Lo;0;L;<narrow> 30F2;;;;N;;;;;
+FF67;HALFWIDTH KATAKANA LETTER SMALL A;Lo;0;L;<narrow> 30A1;;;;N;;;;;
+FF68;HALFWIDTH KATAKANA LETTER SMALL I;Lo;0;L;<narrow> 30A3;;;;N;;;;;
+FF69;HALFWIDTH KATAKANA LETTER SMALL U;Lo;0;L;<narrow> 30A5;;;;N;;;;;
+FF6A;HALFWIDTH KATAKANA LETTER SMALL E;Lo;0;L;<narrow> 30A7;;;;N;;;;;
+FF6B;HALFWIDTH KATAKANA LETTER SMALL O;Lo;0;L;<narrow> 30A9;;;;N;;;;;
+FF6C;HALFWIDTH KATAKANA LETTER SMALL YA;Lo;0;L;<narrow> 30E3;;;;N;;;;;
+FF6D;HALFWIDTH KATAKANA LETTER SMALL YU;Lo;0;L;<narrow> 30E5;;;;N;;;;;
+FF6E;HALFWIDTH KATAKANA LETTER SMALL YO;Lo;0;L;<narrow> 30E7;;;;N;;;;;
+FF6F;HALFWIDTH KATAKANA LETTER SMALL TU;Lo;0;L;<narrow> 30C3;;;;N;;;;;
+FF70;HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK;Lm;0;L;<narrow> 30FC;;;;N;;;;;
+FF71;HALFWIDTH KATAKANA LETTER A;Lo;0;L;<narrow> 30A2;;;;N;;;;;
+FF72;HALFWIDTH KATAKANA LETTER I;Lo;0;L;<narrow> 30A4;;;;N;;;;;
+FF73;HALFWIDTH KATAKANA LETTER U;Lo;0;L;<narrow> 30A6;;;;N;;;;;
+FF74;HALFWIDTH KATAKANA LETTER E;Lo;0;L;<narrow> 30A8;;;;N;;;;;
+FF75;HALFWIDTH KATAKANA LETTER O;Lo;0;L;<narrow> 30AA;;;;N;;;;;
+FF76;HALFWIDTH KATAKANA LETTER KA;Lo;0;L;<narrow> 30AB;;;;N;;;;;
+FF77;HALFWIDTH KATAKANA LETTER KI;Lo;0;L;<narrow> 30AD;;;;N;;;;;
+FF78;HALFWIDTH KATAKANA LETTER KU;Lo;0;L;<narrow> 30AF;;;;N;;;;;
+FF79;HALFWIDTH KATAKANA LETTER KE;Lo;0;L;<narrow> 30B1;;;;N;;;;;
+FF7A;HALFWIDTH KATAKANA LETTER KO;Lo;0;L;<narrow> 30B3;;;;N;;;;;
+FF7B;HALFWIDTH KATAKANA LETTER SA;Lo;0;L;<narrow> 30B5;;;;N;;;;;
+FF7C;HALFWIDTH KATAKANA LETTER SI;Lo;0;L;<narrow> 30B7;;;;N;;;;;
+FF7D;HALFWIDTH KATAKANA LETTER SU;Lo;0;L;<narrow> 30B9;;;;N;;;;;
+FF7E;HALFWIDTH KATAKANA LETTER SE;Lo;0;L;<narrow> 30BB;;;;N;;;;;
+FF7F;HALFWIDTH KATAKANA LETTER SO;Lo;0;L;<narrow> 30BD;;;;N;;;;;
+FF80;HALFWIDTH KATAKANA LETTER TA;Lo;0;L;<narrow> 30BF;;;;N;;;;;
+FF81;HALFWIDTH KATAKANA LETTER TI;Lo;0;L;<narrow> 30C1;;;;N;;;;;
+FF82;HALFWIDTH KATAKANA LETTER TU;Lo;0;L;<narrow> 30C4;;;;N;;;;;
+FF83;HALFWIDTH KATAKANA LETTER TE;Lo;0;L;<narrow> 30C6;;;;N;;;;;
+FF84;HALFWIDTH KATAKANA LETTER TO;Lo;0;L;<narrow> 30C8;;;;N;;;;;
+FF85;HALFWIDTH KATAKANA LETTER NA;Lo;0;L;<narrow> 30CA;;;;N;;;;;
+FF86;HALFWIDTH KATAKANA LETTER NI;Lo;0;L;<narrow> 30CB;;;;N;;;;;
+FF87;HALFWIDTH KATAKANA LETTER NU;Lo;0;L;<narrow> 30CC;;;;N;;;;;
+FF88;HALFWIDTH KATAKANA LETTER NE;Lo;0;L;<narrow> 30CD;;;;N;;;;;
+FF89;HALFWIDTH KATAKANA LETTER NO;Lo;0;L;<narrow> 30CE;;;;N;;;;;
+FF8A;HALFWIDTH KATAKANA LETTER HA;Lo;0;L;<narrow> 30CF;;;;N;;;;;
+FF8B;HALFWIDTH KATAKANA LETTER HI;Lo;0;L;<narrow> 30D2;;;;N;;;;;
+FF8C;HALFWIDTH KATAKANA LETTER HU;Lo;0;L;<narrow> 30D5;;;;N;;;;;
+FF8D;HALFWIDTH KATAKANA LETTER HE;Lo;0;L;<narrow> 30D8;;;;N;;;;;
+FF8E;HALFWIDTH KATAKANA LETTER HO;Lo;0;L;<narrow> 30DB;;;;N;;;;;
+FF8F;HALFWIDTH KATAKANA LETTER MA;Lo;0;L;<narrow> 30DE;;;;N;;;;;
+FF90;HALFWIDTH KATAKANA LETTER MI;Lo;0;L;<narrow> 30DF;;;;N;;;;;
+FF91;HALFWIDTH KATAKANA LETTER MU;Lo;0;L;<narrow> 30E0;;;;N;;;;;
+FF92;HALFWIDTH KATAKANA LETTER ME;Lo;0;L;<narrow> 30E1;;;;N;;;;;
+FF93;HALFWIDTH KATAKANA LETTER MO;Lo;0;L;<narrow> 30E2;;;;N;;;;;
+FF94;HALFWIDTH KATAKANA LETTER YA;Lo;0;L;<narrow> 30E4;;;;N;;;;;
+FF95;HALFWIDTH KATAKANA LETTER YU;Lo;0;L;<narrow> 30E6;;;;N;;;;;
+FF96;HALFWIDTH KATAKANA LETTER YO;Lo;0;L;<narrow> 30E8;;;;N;;;;;
+FF97;HALFWIDTH KATAKANA LETTER RA;Lo;0;L;<narrow> 30E9;;;;N;;;;;
+FF98;HALFWIDTH KATAKANA LETTER RI;Lo;0;L;<narrow> 30EA;;;;N;;;;;
+FF99;HALFWIDTH KATAKANA LETTER RU;Lo;0;L;<narrow> 30EB;;;;N;;;;;
+FF9A;HALFWIDTH KATAKANA LETTER RE;Lo;0;L;<narrow> 30EC;;;;N;;;;;
+FF9B;HALFWIDTH KATAKANA LETTER RO;Lo;0;L;<narrow> 30ED;;;;N;;;;;
+FF9C;HALFWIDTH KATAKANA LETTER WA;Lo;0;L;<narrow> 30EF;;;;N;;;;;
+FF9D;HALFWIDTH KATAKANA LETTER N;Lo;0;L;<narrow> 30F3;;;;N;;;;;
+FF9E;HALFWIDTH KATAKANA VOICED SOUND MARK;Lm;0;L;<narrow> 3099;;;;N;;halfwidth katakana-hiragana voiced sound mark;;;
+FF9F;HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK;Lm;0;L;<narrow> 309A;;;;N;;halfwidth katakana-hiragana semi-voiced sound mark;;;
+FFA0;HALFWIDTH HANGUL FILLER;Lo;0;L;<narrow> 3164;;;;N;HALFWIDTH HANGUL CAE OM;;;;
+FFA1;HALFWIDTH HANGUL LETTER KIYEOK;Lo;0;L;<narrow> 3131;;;;N;HALFWIDTH HANGUL LETTER GIYEOG;;;;
+FFA2;HALFWIDTH HANGUL LETTER SSANGKIYEOK;Lo;0;L;<narrow> 3132;;;;N;HALFWIDTH HANGUL LETTER SSANG GIYEOG;;;;
+FFA3;HALFWIDTH HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<narrow> 3133;;;;N;HALFWIDTH HANGUL LETTER GIYEOG SIOS;;;;
+FFA4;HALFWIDTH HANGUL LETTER NIEUN;Lo;0;L;<narrow> 3134;;;;N;;;;;
+FFA5;HALFWIDTH HANGUL LETTER NIEUN-CIEUC;Lo;0;L;<narrow> 3135;;;;N;HALFWIDTH HANGUL LETTER NIEUN JIEUJ;;;;
+FFA6;HALFWIDTH HANGUL LETTER NIEUN-HIEUH;Lo;0;L;<narrow> 3136;;;;N;HALFWIDTH HANGUL LETTER NIEUN HIEUH;;;;
+FFA7;HALFWIDTH HANGUL LETTER TIKEUT;Lo;0;L;<narrow> 3137;;;;N;HALFWIDTH HANGUL LETTER DIGEUD;;;;
+FFA8;HALFWIDTH HANGUL LETTER SSANGTIKEUT;Lo;0;L;<narrow> 3138;;;;N;HALFWIDTH HANGUL LETTER SSANG DIGEUD;;;;
+FFA9;HALFWIDTH HANGUL LETTER RIEUL;Lo;0;L;<narrow> 3139;;;;N;HALFWIDTH HANGUL LETTER LIEUL;;;;
+FFAA;HALFWIDTH HANGUL LETTER RIEUL-KIYEOK;Lo;0;L;<narrow> 313A;;;;N;HALFWIDTH HANGUL LETTER LIEUL GIYEOG;;;;
+FFAB;HALFWIDTH HANGUL LETTER RIEUL-MIEUM;Lo;0;L;<narrow> 313B;;;;N;HALFWIDTH HANGUL LETTER LIEUL MIEUM;;;;
+FFAC;HALFWIDTH HANGUL LETTER RIEUL-PIEUP;Lo;0;L;<narrow> 313C;;;;N;HALFWIDTH HANGUL LETTER LIEUL BIEUB;;;;
+FFAD;HALFWIDTH HANGUL LETTER RIEUL-SIOS;Lo;0;L;<narrow> 313D;;;;N;HALFWIDTH HANGUL LETTER LIEUL SIOS;;;;
+FFAE;HALFWIDTH HANGUL LETTER RIEUL-THIEUTH;Lo;0;L;<narrow> 313E;;;;N;HALFWIDTH HANGUL LETTER LIEUL TIEUT;;;;
+FFAF;HALFWIDTH HANGUL LETTER RIEUL-PHIEUPH;Lo;0;L;<narrow> 313F;;;;N;HALFWIDTH HANGUL LETTER LIEUL PIEUP;;;;
+FFB0;HALFWIDTH HANGUL LETTER RIEUL-HIEUH;Lo;0;L;<narrow> 3140;;;;N;HALFWIDTH HANGUL LETTER LIEUL HIEUH;;;;
+FFB1;HALFWIDTH HANGUL LETTER MIEUM;Lo;0;L;<narrow> 3141;;;;N;;;;;
+FFB2;HALFWIDTH HANGUL LETTER PIEUP;Lo;0;L;<narrow> 3142;;;;N;HALFWIDTH HANGUL LETTER BIEUB;;;;
+FFB3;HALFWIDTH HANGUL LETTER SSANGPIEUP;Lo;0;L;<narrow> 3143;;;;N;HALFWIDTH HANGUL LETTER SSANG BIEUB;;;;
+FFB4;HALFWIDTH HANGUL LETTER PIEUP-SIOS;Lo;0;L;<narrow> 3144;;;;N;HALFWIDTH HANGUL LETTER BIEUB SIOS;;;;
+FFB5;HALFWIDTH HANGUL LETTER SIOS;Lo;0;L;<narrow> 3145;;;;N;;;;;
+FFB6;HALFWIDTH HANGUL LETTER SSANGSIOS;Lo;0;L;<narrow> 3146;;;;N;HALFWIDTH HANGUL LETTER SSANG SIOS;;;;
+FFB7;HALFWIDTH HANGUL LETTER IEUNG;Lo;0;L;<narrow> 3147;;;;N;;;;;
+FFB8;HALFWIDTH HANGUL LETTER CIEUC;Lo;0;L;<narrow> 3148;;;;N;HALFWIDTH HANGUL LETTER JIEUJ;;;;
+FFB9;HALFWIDTH HANGUL LETTER SSANGCIEUC;Lo;0;L;<narrow> 3149;;;;N;HALFWIDTH HANGUL LETTER SSANG JIEUJ;;;;
+FFBA;HALFWIDTH HANGUL LETTER CHIEUCH;Lo;0;L;<narrow> 314A;;;;N;HALFWIDTH HANGUL LETTER CIEUC;;;;
+FFBB;HALFWIDTH HANGUL LETTER KHIEUKH;Lo;0;L;<narrow> 314B;;;;N;HALFWIDTH HANGUL LETTER KIYEOK;;;;
+FFBC;HALFWIDTH HANGUL LETTER THIEUTH;Lo;0;L;<narrow> 314C;;;;N;HALFWIDTH HANGUL LETTER TIEUT;;;;
+FFBD;HALFWIDTH HANGUL LETTER PHIEUPH;Lo;0;L;<narrow> 314D;;;;N;HALFWIDTH HANGUL LETTER PIEUP;;;;
+FFBE;HALFWIDTH HANGUL LETTER HIEUH;Lo;0;L;<narrow> 314E;;;;N;;;;;
+FFC2;HALFWIDTH HANGUL LETTER A;Lo;0;L;<narrow> 314F;;;;N;;;;;
+FFC3;HALFWIDTH HANGUL LETTER AE;Lo;0;L;<narrow> 3150;;;;N;;;;;
+FFC4;HALFWIDTH HANGUL LETTER YA;Lo;0;L;<narrow> 3151;;;;N;;;;;
+FFC5;HALFWIDTH HANGUL LETTER YAE;Lo;0;L;<narrow> 3152;;;;N;;;;;
+FFC6;HALFWIDTH HANGUL LETTER EO;Lo;0;L;<narrow> 3153;;;;N;;;;;
+FFC7;HALFWIDTH HANGUL LETTER E;Lo;0;L;<narrow> 3154;;;;N;;;;;
+FFCA;HALFWIDTH HANGUL LETTER YEO;Lo;0;L;<narrow> 3155;;;;N;;;;;
+FFCB;HALFWIDTH HANGUL LETTER YE;Lo;0;L;<narrow> 3156;;;;N;;;;;
+FFCC;HALFWIDTH HANGUL LETTER O;Lo;0;L;<narrow> 3157;;;;N;;;;;
+FFCD;HALFWIDTH HANGUL LETTER WA;Lo;0;L;<narrow> 3158;;;;N;;;;;
+FFCE;HALFWIDTH HANGUL LETTER WAE;Lo;0;L;<narrow> 3159;;;;N;;;;;
+FFCF;HALFWIDTH HANGUL LETTER OE;Lo;0;L;<narrow> 315A;;;;N;;;;;
+FFD2;HALFWIDTH HANGUL LETTER YO;Lo;0;L;<narrow> 315B;;;;N;;;;;
+FFD3;HALFWIDTH HANGUL LETTER U;Lo;0;L;<narrow> 315C;;;;N;;;;;
+FFD4;HALFWIDTH HANGUL LETTER WEO;Lo;0;L;<narrow> 315D;;;;N;;;;;
+FFD5;HALFWIDTH HANGUL LETTER WE;Lo;0;L;<narrow> 315E;;;;N;;;;;
+FFD6;HALFWIDTH HANGUL LETTER WI;Lo;0;L;<narrow> 315F;;;;N;;;;;
+FFD7;HALFWIDTH HANGUL LETTER YU;Lo;0;L;<narrow> 3160;;;;N;;;;;
+FFDA;HALFWIDTH HANGUL LETTER EU;Lo;0;L;<narrow> 3161;;;;N;;;;;
+FFDB;HALFWIDTH HANGUL LETTER YI;Lo;0;L;<narrow> 3162;;;;N;;;;;
+FFDC;HALFWIDTH HANGUL LETTER I;Lo;0;L;<narrow> 3163;;;;N;;;;;
+FFE0;FULLWIDTH CENT SIGN;Sc;0;ET;<wide> 00A2;;;;N;;;;;
+FFE1;FULLWIDTH POUND SIGN;Sc;0;ET;<wide> 00A3;;;;N;;;;;
+FFE2;FULLWIDTH NOT SIGN;Sm;0;ON;<wide> 00AC;;;;N;;;;;
+FFE3;FULLWIDTH MACRON;Sk;0;ON;<wide> 00AF;;;;N;FULLWIDTH SPACING MACRON;*;;;
+FFE4;FULLWIDTH BROKEN BAR;So;0;ON;<wide> 00A6;;;;N;FULLWIDTH BROKEN VERTICAL BAR;;;;
+FFE5;FULLWIDTH YEN SIGN;Sc;0;ET;<wide> 00A5;;;;N;;;;;
+FFE6;FULLWIDTH WON SIGN;Sc;0;ET;<wide> 20A9;;;;N;;;;;
+FFE8;HALFWIDTH FORMS LIGHT VERTICAL;So;0;ON;<narrow> 2502;;;;N;;;;;
+FFE9;HALFWIDTH LEFTWARDS ARROW;Sm;0;ON;<narrow> 2190;;;;N;;;;;
+FFEA;HALFWIDTH UPWARDS ARROW;Sm;0;ON;<narrow> 2191;;;;N;;;;;
+FFEB;HALFWIDTH RIGHTWARDS ARROW;Sm;0;ON;<narrow> 2192;;;;N;;;;;
+FFEC;HALFWIDTH DOWNWARDS ARROW;Sm;0;ON;<narrow> 2193;;;;N;;;;;
+FFED;HALFWIDTH BLACK SQUARE;So;0;ON;<narrow> 25A0;;;;N;;;;;
+FFEE;HALFWIDTH WHITE CIRCLE;So;0;ON;<narrow> 25CB;;;;N;;;;;
+FFF9;INTERLINEAR ANNOTATION ANCHOR;Cf;0;ON;;;;;N;;;;;
+FFFA;INTERLINEAR ANNOTATION SEPARATOR;Cf;0;ON;;;;;N;;;;;
+FFFB;INTERLINEAR ANNOTATION TERMINATOR;Cf;0;ON;;;;;N;;;;;
+FFFC;OBJECT REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
+FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
+10000;LINEAR B SYLLABLE B008 A;Lo;0;L;;;;;N;;;;;
+10001;LINEAR B SYLLABLE B038 E;Lo;0;L;;;;;N;;;;;
+10002;LINEAR B SYLLABLE B028 I;Lo;0;L;;;;;N;;;;;
+10003;LINEAR B SYLLABLE B061 O;Lo;0;L;;;;;N;;;;;
+10004;LINEAR B SYLLABLE B010 U;Lo;0;L;;;;;N;;;;;
+10005;LINEAR B SYLLABLE B001 DA;Lo;0;L;;;;;N;;;;;
+10006;LINEAR B SYLLABLE B045 DE;Lo;0;L;;;;;N;;;;;
+10007;LINEAR B SYLLABLE B007 DI;Lo;0;L;;;;;N;;;;;
+10008;LINEAR B SYLLABLE B014 DO;Lo;0;L;;;;;N;;;;;
+10009;LINEAR B SYLLABLE B051 DU;Lo;0;L;;;;;N;;;;;
+1000A;LINEAR B SYLLABLE B057 JA;Lo;0;L;;;;;N;;;;;
+1000B;LINEAR B SYLLABLE B046 JE;Lo;0;L;;;;;N;;;;;
+1000D;LINEAR B SYLLABLE B036 JO;Lo;0;L;;;;;N;;;;;
+1000E;LINEAR B SYLLABLE B065 JU;Lo;0;L;;;;;N;;;;;
+1000F;LINEAR B SYLLABLE B077 KA;Lo;0;L;;;;;N;;;;;
+10010;LINEAR B SYLLABLE B044 KE;Lo;0;L;;;;;N;;;;;
+10011;LINEAR B SYLLABLE B067 KI;Lo;0;L;;;;;N;;;;;
+10012;LINEAR B SYLLABLE B070 KO;Lo;0;L;;;;;N;;;;;
+10013;LINEAR B SYLLABLE B081 KU;Lo;0;L;;;;;N;;;;;
+10014;LINEAR B SYLLABLE B080 MA;Lo;0;L;;;;;N;;;;;
+10015;LINEAR B SYLLABLE B013 ME;Lo;0;L;;;;;N;;;;;
+10016;LINEAR B SYLLABLE B073 MI;Lo;0;L;;;;;N;;;;;
+10017;LINEAR B SYLLABLE B015 MO;Lo;0;L;;;;;N;;;;;
+10018;LINEAR B SYLLABLE B023 MU;Lo;0;L;;;;;N;;;;;
+10019;LINEAR B SYLLABLE B006 NA;Lo;0;L;;;;;N;;;;;
+1001A;LINEAR B SYLLABLE B024 NE;Lo;0;L;;;;;N;;;;;
+1001B;LINEAR B SYLLABLE B030 NI;Lo;0;L;;;;;N;;;;;
+1001C;LINEAR B SYLLABLE B052 NO;Lo;0;L;;;;;N;;;;;
+1001D;LINEAR B SYLLABLE B055 NU;Lo;0;L;;;;;N;;;;;
+1001E;LINEAR B SYLLABLE B003 PA;Lo;0;L;;;;;N;;;;;
+1001F;LINEAR B SYLLABLE B072 PE;Lo;0;L;;;;;N;;;;;
+10020;LINEAR B SYLLABLE B039 PI;Lo;0;L;;;;;N;;;;;
+10021;LINEAR B SYLLABLE B011 PO;Lo;0;L;;;;;N;;;;;
+10022;LINEAR B SYLLABLE B050 PU;Lo;0;L;;;;;N;;;;;
+10023;LINEAR B SYLLABLE B016 QA;Lo;0;L;;;;;N;;;;;
+10024;LINEAR B SYLLABLE B078 QE;Lo;0;L;;;;;N;;;;;
+10025;LINEAR B SYLLABLE B021 QI;Lo;0;L;;;;;N;;;;;
+10026;LINEAR B SYLLABLE B032 QO;Lo;0;L;;;;;N;;;;;
+10028;LINEAR B SYLLABLE B060 RA;Lo;0;L;;;;;N;;;;;
+10029;LINEAR B SYLLABLE B027 RE;Lo;0;L;;;;;N;;;;;
+1002A;LINEAR B SYLLABLE B053 RI;Lo;0;L;;;;;N;;;;;
+1002B;LINEAR B SYLLABLE B002 RO;Lo;0;L;;;;;N;;;;;
+1002C;LINEAR B SYLLABLE B026 RU;Lo;0;L;;;;;N;;;;;
+1002D;LINEAR B SYLLABLE B031 SA;Lo;0;L;;;;;N;;;;;
+1002E;LINEAR B SYLLABLE B009 SE;Lo;0;L;;;;;N;;;;;
+1002F;LINEAR B SYLLABLE B041 SI;Lo;0;L;;;;;N;;;;;
+10030;LINEAR B SYLLABLE B012 SO;Lo;0;L;;;;;N;;;;;
+10031;LINEAR B SYLLABLE B058 SU;Lo;0;L;;;;;N;;;;;
+10032;LINEAR B SYLLABLE B059 TA;Lo;0;L;;;;;N;;;;;
+10033;LINEAR B SYLLABLE B004 TE;Lo;0;L;;;;;N;;;;;
+10034;LINEAR B SYLLABLE B037 TI;Lo;0;L;;;;;N;;;;;
+10035;LINEAR B SYLLABLE B005 TO;Lo;0;L;;;;;N;;;;;
+10036;LINEAR B SYLLABLE B069 TU;Lo;0;L;;;;;N;;;;;
+10037;LINEAR B SYLLABLE B054 WA;Lo;0;L;;;;;N;;;;;
+10038;LINEAR B SYLLABLE B075 WE;Lo;0;L;;;;;N;;;;;
+10039;LINEAR B SYLLABLE B040 WI;Lo;0;L;;;;;N;;;;;
+1003A;LINEAR B SYLLABLE B042 WO;Lo;0;L;;;;;N;;;;;
+1003C;LINEAR B SYLLABLE B017 ZA;Lo;0;L;;;;;N;;;;;
+1003D;LINEAR B SYLLABLE B074 ZE;Lo;0;L;;;;;N;;;;;
+1003F;LINEAR B SYLLABLE B020 ZO;Lo;0;L;;;;;N;;;;;
+10040;LINEAR B SYLLABLE B025 A2;Lo;0;L;;;;;N;;;;;
+10041;LINEAR B SYLLABLE B043 A3;Lo;0;L;;;;;N;;;;;
+10042;LINEAR B SYLLABLE B085 AU;Lo;0;L;;;;;N;;;;;
+10043;LINEAR B SYLLABLE B071 DWE;Lo;0;L;;;;;N;;;;;
+10044;LINEAR B SYLLABLE B090 DWO;Lo;0;L;;;;;N;;;;;
+10045;LINEAR B SYLLABLE B048 NWA;Lo;0;L;;;;;N;;;;;
+10046;LINEAR B SYLLABLE B029 PU2;Lo;0;L;;;;;N;;;;;
+10047;LINEAR B SYLLABLE B062 PTE;Lo;0;L;;;;;N;;;;;
+10048;LINEAR B SYLLABLE B076 RA2;Lo;0;L;;;;;N;;;;;
+10049;LINEAR B SYLLABLE B033 RA3;Lo;0;L;;;;;N;;;;;
+1004A;LINEAR B SYLLABLE B068 RO2;Lo;0;L;;;;;N;;;;;
+1004B;LINEAR B SYLLABLE B066 TA2;Lo;0;L;;;;;N;;;;;
+1004C;LINEAR B SYLLABLE B087 TWE;Lo;0;L;;;;;N;;;;;
+1004D;LINEAR B SYLLABLE B091 TWO;Lo;0;L;;;;;N;;;;;
+10050;LINEAR B SYMBOL B018;Lo;0;L;;;;;N;;;;;
+10051;LINEAR B SYMBOL B019;Lo;0;L;;;;;N;;;;;
+10052;LINEAR B SYMBOL B022;Lo;0;L;;;;;N;;;;;
+10053;LINEAR B SYMBOL B034;Lo;0;L;;;;;N;;;;;
+10054;LINEAR B SYMBOL B047;Lo;0;L;;;;;N;;;;;
+10055;LINEAR B SYMBOL B049;Lo;0;L;;;;;N;;;;;
+10056;LINEAR B SYMBOL B056;Lo;0;L;;;;;N;;;;;
+10057;LINEAR B SYMBOL B063;Lo;0;L;;;;;N;;;;;
+10058;LINEAR B SYMBOL B064;Lo;0;L;;;;;N;;;;;
+10059;LINEAR B SYMBOL B079;Lo;0;L;;;;;N;;;;;
+1005A;LINEAR B SYMBOL B082;Lo;0;L;;;;;N;;;;;
+1005B;LINEAR B SYMBOL B083;Lo;0;L;;;;;N;;;;;
+1005C;LINEAR B SYMBOL B086;Lo;0;L;;;;;N;;;;;
+1005D;LINEAR B SYMBOL B089;Lo;0;L;;;;;N;;;;;
+10080;LINEAR B IDEOGRAM B100 MAN;Lo;0;L;;;;;N;;;;;
+10081;LINEAR B IDEOGRAM B102 WOMAN;Lo;0;L;;;;;N;;;;;
+10082;LINEAR B IDEOGRAM B104 DEER;Lo;0;L;;;;;N;;;;;
+10083;LINEAR B IDEOGRAM B105 EQUID;Lo;0;L;;;;;N;;;;;
+10084;LINEAR B IDEOGRAM B105F MARE;Lo;0;L;;;;;N;;;;;
+10085;LINEAR B IDEOGRAM B105M STALLION;Lo;0;L;;;;;N;;;;;
+10086;LINEAR B IDEOGRAM B106F EWE;Lo;0;L;;;;;N;;;;;
+10087;LINEAR B IDEOGRAM B106M RAM;Lo;0;L;;;;;N;;;;;
+10088;LINEAR B IDEOGRAM B107F SHE-GOAT;Lo;0;L;;;;;N;;;;;
+10089;LINEAR B IDEOGRAM B107M HE-GOAT;Lo;0;L;;;;;N;;;;;
+1008A;LINEAR B IDEOGRAM B108F SOW;Lo;0;L;;;;;N;;;;;
+1008B;LINEAR B IDEOGRAM B108M BOAR;Lo;0;L;;;;;N;;;;;
+1008C;LINEAR B IDEOGRAM B109F COW;Lo;0;L;;;;;N;;;;;
+1008D;LINEAR B IDEOGRAM B109M BULL;Lo;0;L;;;;;N;;;;;
+1008E;LINEAR B IDEOGRAM B120 WHEAT;Lo;0;L;;;;;N;;;;;
+1008F;LINEAR B IDEOGRAM B121 BARLEY;Lo;0;L;;;;;N;;;;;
+10090;LINEAR B IDEOGRAM B122 OLIVE;Lo;0;L;;;;;N;;;;;
+10091;LINEAR B IDEOGRAM B123 SPICE;Lo;0;L;;;;;N;;;;;
+10092;LINEAR B IDEOGRAM B125 CYPERUS;Lo;0;L;;;;;N;;;;;
+10093;LINEAR B MONOGRAM B127 KAPO;Lo;0;L;;;;;N;;;;;
+10094;LINEAR B MONOGRAM B128 KANAKO;Lo;0;L;;;;;N;;;;;
+10095;LINEAR B IDEOGRAM B130 OIL;Lo;0;L;;;;;N;;;;;
+10096;LINEAR B IDEOGRAM B131 WINE;Lo;0;L;;;;;N;;;;;
+10097;LINEAR B IDEOGRAM B132;Lo;0;L;;;;;N;;;;;
+10098;LINEAR B MONOGRAM B133 AREPA;Lo;0;L;;;;;N;;;;;
+10099;LINEAR B MONOGRAM B135 MERI;Lo;0;L;;;;;N;;;;;
+1009A;LINEAR B IDEOGRAM B140 BRONZE;Lo;0;L;;;;;N;;;;;
+1009B;LINEAR B IDEOGRAM B141 GOLD;Lo;0;L;;;;;N;;;;;
+1009C;LINEAR B IDEOGRAM B142;Lo;0;L;;;;;N;;;;;
+1009D;LINEAR B IDEOGRAM B145 WOOL;Lo;0;L;;;;;N;;;;;
+1009E;LINEAR B IDEOGRAM B146;Lo;0;L;;;;;N;;;;;
+1009F;LINEAR B IDEOGRAM B150;Lo;0;L;;;;;N;;;;;
+100A0;LINEAR B IDEOGRAM B151 HORN;Lo;0;L;;;;;N;;;;;
+100A1;LINEAR B IDEOGRAM B152;Lo;0;L;;;;;N;;;;;
+100A2;LINEAR B IDEOGRAM B153;Lo;0;L;;;;;N;;;;;
+100A3;LINEAR B IDEOGRAM B154;Lo;0;L;;;;;N;;;;;
+100A4;LINEAR B MONOGRAM B156 TURO2;Lo;0;L;;;;;N;;;;;
+100A5;LINEAR B IDEOGRAM B157;Lo;0;L;;;;;N;;;;;
+100A6;LINEAR B IDEOGRAM B158;Lo;0;L;;;;;N;;;;;
+100A7;LINEAR B IDEOGRAM B159 CLOTH;Lo;0;L;;;;;N;;;;;
+100A8;LINEAR B IDEOGRAM B160;Lo;0;L;;;;;N;;;;;
+100A9;LINEAR B IDEOGRAM B161;Lo;0;L;;;;;N;;;;;
+100AA;LINEAR B IDEOGRAM B162 GARMENT;Lo;0;L;;;;;N;;;;;
+100AB;LINEAR B IDEOGRAM B163 ARMOUR;Lo;0;L;;;;;N;;;;;
+100AC;LINEAR B IDEOGRAM B164;Lo;0;L;;;;;N;;;;;
+100AD;LINEAR B IDEOGRAM B165;Lo;0;L;;;;;N;;;;;
+100AE;LINEAR B IDEOGRAM B166;Lo;0;L;;;;;N;;;;;
+100AF;LINEAR B IDEOGRAM B167;Lo;0;L;;;;;N;;;;;
+100B0;LINEAR B IDEOGRAM B168;Lo;0;L;;;;;N;;;;;
+100B1;LINEAR B IDEOGRAM B169;Lo;0;L;;;;;N;;;;;
+100B2;LINEAR B IDEOGRAM B170;Lo;0;L;;;;;N;;;;;
+100B3;LINEAR B IDEOGRAM B171;Lo;0;L;;;;;N;;;;;
+100B4;LINEAR B IDEOGRAM B172;Lo;0;L;;;;;N;;;;;
+100B5;LINEAR B IDEOGRAM B173 MONTH;Lo;0;L;;;;;N;;;;;
+100B6;LINEAR B IDEOGRAM B174;Lo;0;L;;;;;N;;;;;
+100B7;LINEAR B IDEOGRAM B176 TREE;Lo;0;L;;;;;N;;;;;
+100B8;LINEAR B IDEOGRAM B177;Lo;0;L;;;;;N;;;;;
+100B9;LINEAR B IDEOGRAM B178;Lo;0;L;;;;;N;;;;;
+100BA;LINEAR B IDEOGRAM B179;Lo;0;L;;;;;N;;;;;
+100BB;LINEAR B IDEOGRAM B180;Lo;0;L;;;;;N;;;;;
+100BC;LINEAR B IDEOGRAM B181;Lo;0;L;;;;;N;;;;;
+100BD;LINEAR B IDEOGRAM B182;Lo;0;L;;;;;N;;;;;
+100BE;LINEAR B IDEOGRAM B183;Lo;0;L;;;;;N;;;;;
+100BF;LINEAR B IDEOGRAM B184;Lo;0;L;;;;;N;;;;;
+100C0;LINEAR B IDEOGRAM B185;Lo;0;L;;;;;N;;;;;
+100C1;LINEAR B IDEOGRAM B189;Lo;0;L;;;;;N;;;;;
+100C2;LINEAR B IDEOGRAM B190;Lo;0;L;;;;;N;;;;;
+100C3;LINEAR B IDEOGRAM B191 HELMET;Lo;0;L;;;;;N;;;;;
+100C4;LINEAR B IDEOGRAM B220 FOOTSTOOL;Lo;0;L;;;;;N;;;;;
+100C5;LINEAR B IDEOGRAM B225 BATHTUB;Lo;0;L;;;;;N;;;;;
+100C6;LINEAR B IDEOGRAM B230 SPEAR;Lo;0;L;;;;;N;;;;;
+100C7;LINEAR B IDEOGRAM B231 ARROW;Lo;0;L;;;;;N;;;;;
+100C8;LINEAR B IDEOGRAM B232;Lo;0;L;;;;;N;;;;;
+100C9;LINEAR B IDEOGRAM B233 SWORD;Lo;0;L;;;;;N;;pug;;;
+100CA;LINEAR B IDEOGRAM B234;Lo;0;L;;;;;N;;;;;
+100CB;LINEAR B IDEOGRAM B236;Lo;0;L;;;;;N;;gup;;;
+100CC;LINEAR B IDEOGRAM B240 WHEELED CHARIOT;Lo;0;L;;;;;N;;;;;
+100CD;LINEAR B IDEOGRAM B241 CHARIOT;Lo;0;L;;;;;N;;;;;
+100CE;LINEAR B IDEOGRAM B242 CHARIOT FRAME;Lo;0;L;;;;;N;;;;;
+100CF;LINEAR B IDEOGRAM B243 WHEEL;Lo;0;L;;;;;N;;;;;
+100D0;LINEAR B IDEOGRAM B245;Lo;0;L;;;;;N;;;;;
+100D1;LINEAR B IDEOGRAM B246;Lo;0;L;;;;;N;;;;;
+100D2;LINEAR B MONOGRAM B247 DIPTE;Lo;0;L;;;;;N;;;;;
+100D3;LINEAR B IDEOGRAM B248;Lo;0;L;;;;;N;;;;;
+100D4;LINEAR B IDEOGRAM B249;Lo;0;L;;;;;N;;;;;
+100D5;LINEAR B IDEOGRAM B251;Lo;0;L;;;;;N;;;;;
+100D6;LINEAR B IDEOGRAM B252;Lo;0;L;;;;;N;;;;;
+100D7;LINEAR B IDEOGRAM B253;Lo;0;L;;;;;N;;;;;
+100D8;LINEAR B IDEOGRAM B254 DART;Lo;0;L;;;;;N;;;;;
+100D9;LINEAR B IDEOGRAM B255;Lo;0;L;;;;;N;;;;;
+100DA;LINEAR B IDEOGRAM B256;Lo;0;L;;;;;N;;;;;
+100DB;LINEAR B IDEOGRAM B257;Lo;0;L;;;;;N;;;;;
+100DC;LINEAR B IDEOGRAM B258;Lo;0;L;;;;;N;;;;;
+100DD;LINEAR B IDEOGRAM B259;Lo;0;L;;;;;N;;;;;
+100DE;LINEAR B IDEOGRAM VESSEL B155;Lo;0;L;;;;;N;;;;;
+100DF;LINEAR B IDEOGRAM VESSEL B200;Lo;0;L;;;;;N;;;;;
+100E0;LINEAR B IDEOGRAM VESSEL B201;Lo;0;L;;;;;N;;;;;
+100E1;LINEAR B IDEOGRAM VESSEL B202;Lo;0;L;;;;;N;;;;;
+100E2;LINEAR B IDEOGRAM VESSEL B203;Lo;0;L;;;;;N;;;;;
+100E3;LINEAR B IDEOGRAM VESSEL B204;Lo;0;L;;;;;N;;;;;
+100E4;LINEAR B IDEOGRAM VESSEL B205;Lo;0;L;;;;;N;;;;;
+100E5;LINEAR B IDEOGRAM VESSEL B206;Lo;0;L;;;;;N;;;;;
+100E6;LINEAR B IDEOGRAM VESSEL B207;Lo;0;L;;;;;N;;;;;
+100E7;LINEAR B IDEOGRAM VESSEL B208;Lo;0;L;;;;;N;;;;;
+100E8;LINEAR B IDEOGRAM VESSEL B209;Lo;0;L;;;;;N;;;;;
+100E9;LINEAR B IDEOGRAM VESSEL B210;Lo;0;L;;;;;N;;;;;
+100EA;LINEAR B IDEOGRAM VESSEL B211;Lo;0;L;;;;;N;;;;;
+100EB;LINEAR B IDEOGRAM VESSEL B212;Lo;0;L;;;;;N;;;;;
+100EC;LINEAR B IDEOGRAM VESSEL B213;Lo;0;L;;;;;N;;;;;
+100ED;LINEAR B IDEOGRAM VESSEL B214;Lo;0;L;;;;;N;;;;;
+100EE;LINEAR B IDEOGRAM VESSEL B215;Lo;0;L;;;;;N;;;;;
+100EF;LINEAR B IDEOGRAM VESSEL B216;Lo;0;L;;;;;N;;;;;
+100F0;LINEAR B IDEOGRAM VESSEL B217;Lo;0;L;;;;;N;;;;;
+100F1;LINEAR B IDEOGRAM VESSEL B218;Lo;0;L;;;;;N;;;;;
+100F2;LINEAR B IDEOGRAM VESSEL B219;Lo;0;L;;;;;N;;;;;
+100F3;LINEAR B IDEOGRAM VESSEL B221;Lo;0;L;;;;;N;;;;;
+100F4;LINEAR B IDEOGRAM VESSEL B222;Lo;0;L;;;;;N;;;;;
+100F5;LINEAR B IDEOGRAM VESSEL B226;Lo;0;L;;;;;N;;;;;
+100F6;LINEAR B IDEOGRAM VESSEL B227;Lo;0;L;;;;;N;;;;;
+100F7;LINEAR B IDEOGRAM VESSEL B228;Lo;0;L;;;;;N;;;;;
+100F8;LINEAR B IDEOGRAM VESSEL B229;Lo;0;L;;;;;N;;;;;
+100F9;LINEAR B IDEOGRAM VESSEL B250;Lo;0;L;;;;;N;;;;;
+100FA;LINEAR B IDEOGRAM VESSEL B305;Lo;0;L;;;;;N;;;;;
+10100;AEGEAN WORD SEPARATOR LINE;Po;0;L;;;;;N;;;;;
+10101;AEGEAN WORD SEPARATOR DOT;Po;0;ON;;;;;N;;;;;
+10102;AEGEAN CHECK MARK;So;0;L;;;;;N;;;;;
+10107;AEGEAN NUMBER ONE;No;0;L;;;;1;N;;;;;
+10108;AEGEAN NUMBER TWO;No;0;L;;;;2;N;;;;;
+10109;AEGEAN NUMBER THREE;No;0;L;;;;3;N;;;;;
+1010A;AEGEAN NUMBER FOUR;No;0;L;;;;4;N;;;;;
+1010B;AEGEAN NUMBER FIVE;No;0;L;;;;5;N;;;;;
+1010C;AEGEAN NUMBER SIX;No;0;L;;;;6;N;;;;;
+1010D;AEGEAN NUMBER SEVEN;No;0;L;;;;7;N;;;;;
+1010E;AEGEAN NUMBER EIGHT;No;0;L;;;;8;N;;;;;
+1010F;AEGEAN NUMBER NINE;No;0;L;;;;9;N;;;;;
+10110;AEGEAN NUMBER TEN;No;0;L;;;;10;N;;;;;
+10111;AEGEAN NUMBER TWENTY;No;0;L;;;;20;N;;;;;
+10112;AEGEAN NUMBER THIRTY;No;0;L;;;;30;N;;;;;
+10113;AEGEAN NUMBER FORTY;No;0;L;;;;40;N;;;;;
+10114;AEGEAN NUMBER FIFTY;No;0;L;;;;50;N;;;;;
+10115;AEGEAN NUMBER SIXTY;No;0;L;;;;60;N;;;;;
+10116;AEGEAN NUMBER SEVENTY;No;0;L;;;;70;N;;;;;
+10117;AEGEAN NUMBER EIGHTY;No;0;L;;;;80;N;;;;;
+10118;AEGEAN NUMBER NINETY;No;0;L;;;;90;N;;;;;
+10119;AEGEAN NUMBER ONE HUNDRED;No;0;L;;;;100;N;;;;;
+1011A;AEGEAN NUMBER TWO HUNDRED;No;0;L;;;;200;N;;;;;
+1011B;AEGEAN NUMBER THREE HUNDRED;No;0;L;;;;300;N;;;;;
+1011C;AEGEAN NUMBER FOUR HUNDRED;No;0;L;;;;400;N;;;;;
+1011D;AEGEAN NUMBER FIVE HUNDRED;No;0;L;;;;500;N;;;;;
+1011E;AEGEAN NUMBER SIX HUNDRED;No;0;L;;;;600;N;;;;;
+1011F;AEGEAN NUMBER SEVEN HUNDRED;No;0;L;;;;700;N;;;;;
+10120;AEGEAN NUMBER EIGHT HUNDRED;No;0;L;;;;800;N;;;;;
+10121;AEGEAN NUMBER NINE HUNDRED;No;0;L;;;;900;N;;;;;
+10122;AEGEAN NUMBER ONE THOUSAND;No;0;L;;;;1000;N;;;;;
+10123;AEGEAN NUMBER TWO THOUSAND;No;0;L;;;;2000;N;;;;;
+10124;AEGEAN NUMBER THREE THOUSAND;No;0;L;;;;3000;N;;;;;
+10125;AEGEAN NUMBER FOUR THOUSAND;No;0;L;;;;4000;N;;;;;
+10126;AEGEAN NUMBER FIVE THOUSAND;No;0;L;;;;5000;N;;;;;
+10127;AEGEAN NUMBER SIX THOUSAND;No;0;L;;;;6000;N;;;;;
+10128;AEGEAN NUMBER SEVEN THOUSAND;No;0;L;;;;7000;N;;;;;
+10129;AEGEAN NUMBER EIGHT THOUSAND;No;0;L;;;;8000;N;;;;;
+1012A;AEGEAN NUMBER NINE THOUSAND;No;0;L;;;;9000;N;;;;;
+1012B;AEGEAN NUMBER TEN THOUSAND;No;0;L;;;;10000;N;;;;;
+1012C;AEGEAN NUMBER TWENTY THOUSAND;No;0;L;;;;20000;N;;;;;
+1012D;AEGEAN NUMBER THIRTY THOUSAND;No;0;L;;;;30000;N;;;;;
+1012E;AEGEAN NUMBER FORTY THOUSAND;No;0;L;;;;40000;N;;;;;
+1012F;AEGEAN NUMBER FIFTY THOUSAND;No;0;L;;;;50000;N;;;;;
+10130;AEGEAN NUMBER SIXTY THOUSAND;No;0;L;;;;60000;N;;;;;
+10131;AEGEAN NUMBER SEVENTY THOUSAND;No;0;L;;;;70000;N;;;;;
+10132;AEGEAN NUMBER EIGHTY THOUSAND;No;0;L;;;;80000;N;;;;;
+10133;AEGEAN NUMBER NINETY THOUSAND;No;0;L;;;;90000;N;;;;;
+10137;AEGEAN WEIGHT BASE UNIT;So;0;L;;;;;N;;;;;
+10138;AEGEAN WEIGHT FIRST SUBUNIT;So;0;L;;;;;N;;;;;
+10139;AEGEAN WEIGHT SECOND SUBUNIT;So;0;L;;;;;N;;;;;
+1013A;AEGEAN WEIGHT THIRD SUBUNIT;So;0;L;;;;;N;;;;;
+1013B;AEGEAN WEIGHT FOURTH SUBUNIT;So;0;L;;;;;N;;;;;
+1013C;AEGEAN DRY MEASURE FIRST SUBUNIT;So;0;L;;;;;N;;;;;
+1013D;AEGEAN LIQUID MEASURE FIRST SUBUNIT;So;0;L;;;;;N;;;;;
+1013E;AEGEAN MEASURE SECOND SUBUNIT;So;0;L;;;;;N;;;;;
+1013F;AEGEAN MEASURE THIRD SUBUNIT;So;0;L;;;;;N;;;;;
+10140;GREEK ACROPHONIC ATTIC ONE QUARTER;Nl;0;ON;;;;1/4;N;;;;;
+10141;GREEK ACROPHONIC ATTIC ONE HALF;Nl;0;ON;;;;1/2;N;;;;;
+10142;GREEK ACROPHONIC ATTIC ONE DRACHMA;Nl;0;ON;;;;1;N;;;;;
+10143;GREEK ACROPHONIC ATTIC FIVE;Nl;0;ON;;;;5;N;;;;;
+10144;GREEK ACROPHONIC ATTIC FIFTY;Nl;0;ON;;;;50;N;;;;;
+10145;GREEK ACROPHONIC ATTIC FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;;
+10146;GREEK ACROPHONIC ATTIC FIVE THOUSAND;Nl;0;ON;;;;5000;N;;;;;
+10147;GREEK ACROPHONIC ATTIC FIFTY THOUSAND;Nl;0;ON;;;;50000;N;;;;;
+10148;GREEK ACROPHONIC ATTIC FIVE TALENTS;Nl;0;ON;;;;5;N;;;;;
+10149;GREEK ACROPHONIC ATTIC TEN TALENTS;Nl;0;ON;;;;10;N;;;;;
+1014A;GREEK ACROPHONIC ATTIC FIFTY TALENTS;Nl;0;ON;;;;50;N;;;;;
+1014B;GREEK ACROPHONIC ATTIC ONE HUNDRED TALENTS;Nl;0;ON;;;;100;N;;;;;
+1014C;GREEK ACROPHONIC ATTIC FIVE HUNDRED TALENTS;Nl;0;ON;;;;500;N;;;;;
+1014D;GREEK ACROPHONIC ATTIC ONE THOUSAND TALENTS;Nl;0;ON;;;;1000;N;;;;;
+1014E;GREEK ACROPHONIC ATTIC FIVE THOUSAND TALENTS;Nl;0;ON;;;;5000;N;;;;;
+1014F;GREEK ACROPHONIC ATTIC FIVE STATERS;Nl;0;ON;;;;5;N;;;;;
+10150;GREEK ACROPHONIC ATTIC TEN STATERS;Nl;0;ON;;;;10;N;;;;;
+10151;GREEK ACROPHONIC ATTIC FIFTY STATERS;Nl;0;ON;;;;50;N;;;;;
+10152;GREEK ACROPHONIC ATTIC ONE HUNDRED STATERS;Nl;0;ON;;;;100;N;;;;;
+10153;GREEK ACROPHONIC ATTIC FIVE HUNDRED STATERS;Nl;0;ON;;;;500;N;;;;;
+10154;GREEK ACROPHONIC ATTIC ONE THOUSAND STATERS;Nl;0;ON;;;;1000;N;;;;;
+10155;GREEK ACROPHONIC ATTIC TEN THOUSAND STATERS;Nl;0;ON;;;;10000;N;;;;;
+10156;GREEK ACROPHONIC ATTIC FIFTY THOUSAND STATERS;Nl;0;ON;;;;50000;N;;;;;
+10157;GREEK ACROPHONIC ATTIC TEN MNAS;Nl;0;ON;;;;10;N;;;;;
+10158;GREEK ACROPHONIC HERAEUM ONE PLETHRON;Nl;0;ON;;;;1;N;;;;;
+10159;GREEK ACROPHONIC THESPIAN ONE;Nl;0;ON;;;;1;N;;;;;
+1015A;GREEK ACROPHONIC HERMIONIAN ONE;Nl;0;ON;;;;1;N;;;;;
+1015B;GREEK ACROPHONIC EPIDAUREAN TWO;Nl;0;ON;;;;2;N;;;;;
+1015C;GREEK ACROPHONIC THESPIAN TWO;Nl;0;ON;;;;2;N;;;;;
+1015D;GREEK ACROPHONIC CYRENAIC TWO DRACHMAS;Nl;0;ON;;;;2;N;;;;;
+1015E;GREEK ACROPHONIC EPIDAUREAN TWO DRACHMAS;Nl;0;ON;;;;2;N;;;;;
+1015F;GREEK ACROPHONIC TROEZENIAN FIVE;Nl;0;ON;;;;5;N;;;;;
+10160;GREEK ACROPHONIC TROEZENIAN TEN;Nl;0;ON;;;;10;N;;;;;
+10161;GREEK ACROPHONIC TROEZENIAN TEN ALTERNATE FORM;Nl;0;ON;;;;10;N;;;;;
+10162;GREEK ACROPHONIC HERMIONIAN TEN;Nl;0;ON;;;;10;N;;;;;
+10163;GREEK ACROPHONIC MESSENIAN TEN;Nl;0;ON;;;;10;N;;;;;
+10164;GREEK ACROPHONIC THESPIAN TEN;Nl;0;ON;;;;10;N;;;;;
+10165;GREEK ACROPHONIC THESPIAN THIRTY;Nl;0;ON;;;;30;N;;;;;
+10166;GREEK ACROPHONIC TROEZENIAN FIFTY;Nl;0;ON;;;;50;N;;;;;
+10167;GREEK ACROPHONIC TROEZENIAN FIFTY ALTERNATE FORM;Nl;0;ON;;;;50;N;;;;;
+10168;GREEK ACROPHONIC HERMIONIAN FIFTY;Nl;0;ON;;;;50;N;;;;;
+10169;GREEK ACROPHONIC THESPIAN FIFTY;Nl;0;ON;;;;50;N;;;;;
+1016A;GREEK ACROPHONIC THESPIAN ONE HUNDRED;Nl;0;ON;;;;100;N;;;;;
+1016B;GREEK ACROPHONIC THESPIAN THREE HUNDRED;Nl;0;ON;;;;300;N;;;;;
+1016C;GREEK ACROPHONIC EPIDAUREAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;;
+1016D;GREEK ACROPHONIC TROEZENIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;;
+1016E;GREEK ACROPHONIC THESPIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;;
+1016F;GREEK ACROPHONIC CARYSTIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;;
+10170;GREEK ACROPHONIC NAXIAN FIVE HUNDRED;Nl;0;ON;;;;500;N;;;;;
+10171;GREEK ACROPHONIC THESPIAN ONE THOUSAND;Nl;0;ON;;;;1000;N;;;;;
+10172;GREEK ACROPHONIC THESPIAN FIVE THOUSAND;Nl;0;ON;;;;5000;N;;;;;
+10173;GREEK ACROPHONIC DELPHIC FIVE MNAS;Nl;0;ON;;;;5;N;;;;;
+10174;GREEK ACROPHONIC STRATIAN FIFTY MNAS;Nl;0;ON;;;;50;N;;;;;
+10175;GREEK ONE HALF SIGN;No;0;ON;;;;1/2;N;;;;;
+10176;GREEK ONE HALF SIGN ALTERNATE FORM;No;0;ON;;;;1/2;N;;;;;
+10177;GREEK TWO THIRDS SIGN;No;0;ON;;;;2/3;N;;;;;
+10178;GREEK THREE QUARTERS SIGN;No;0;ON;;;;3/4;N;;;;;
+10179;GREEK YEAR SIGN;So;0;ON;;;;;N;;;;;
+1017A;GREEK TALENT SIGN;So;0;ON;;;;;N;;;;;
+1017B;GREEK DRACHMA SIGN;So;0;ON;;;;;N;;;;;
+1017C;GREEK OBOL SIGN;So;0;ON;;;;;N;;;;;
+1017D;GREEK TWO OBOLS SIGN;So;0;ON;;;;;N;;;;;
+1017E;GREEK THREE OBOLS SIGN;So;0;ON;;;;;N;;;;;
+1017F;GREEK FOUR OBOLS SIGN;So;0;ON;;;;;N;;;;;
+10180;GREEK FIVE OBOLS SIGN;So;0;ON;;;;;N;;;;;
+10181;GREEK METRETES SIGN;So;0;ON;;;;;N;;;;;
+10182;GREEK KYATHOS BASE SIGN;So;0;ON;;;;;N;;;;;
+10183;GREEK LITRA SIGN;So;0;ON;;;;;N;;;;;
+10184;GREEK OUNKIA SIGN;So;0;ON;;;;;N;;;;;
+10185;GREEK XESTES SIGN;So;0;ON;;;;;N;;;;;
+10186;GREEK ARTABE SIGN;So;0;ON;;;;;N;;;;;
+10187;GREEK AROURA SIGN;So;0;ON;;;;;N;;;;;
+10188;GREEK GRAMMA SIGN;So;0;ON;;;;;N;;;;;
+10189;GREEK TRYBLION BASE SIGN;So;0;ON;;;;;N;;;;;
+1018A;GREEK ZERO SIGN;No;0;ON;;;;0;N;;;;;
+10300;OLD ITALIC LETTER A;Lo;0;L;;;;;N;;;;;
+10301;OLD ITALIC LETTER BE;Lo;0;L;;;;;N;;;;;
+10302;OLD ITALIC LETTER KE;Lo;0;L;;;;;N;;;;;
+10303;OLD ITALIC LETTER DE;Lo;0;L;;;;;N;;;;;
+10304;OLD ITALIC LETTER E;Lo;0;L;;;;;N;;;;;
+10305;OLD ITALIC LETTER VE;Lo;0;L;;;;;N;;;;;
+10306;OLD ITALIC LETTER ZE;Lo;0;L;;;;;N;;;;;
+10307;OLD ITALIC LETTER HE;Lo;0;L;;;;;N;;;;;
+10308;OLD ITALIC LETTER THE;Lo;0;L;;;;;N;;;;;
+10309;OLD ITALIC LETTER I;Lo;0;L;;;;;N;;;;;
+1030A;OLD ITALIC LETTER KA;Lo;0;L;;;;;N;;;;;
+1030B;OLD ITALIC LETTER EL;Lo;0;L;;;;;N;;;;;
+1030C;OLD ITALIC LETTER EM;Lo;0;L;;;;;N;;;;;
+1030D;OLD ITALIC LETTER EN;Lo;0;L;;;;;N;;;;;
+1030E;OLD ITALIC LETTER ESH;Lo;0;L;;;;;N;;;;;
+1030F;OLD ITALIC LETTER O;Lo;0;L;;;;;N;;Faliscan;;;
+10310;OLD ITALIC LETTER PE;Lo;0;L;;;;;N;;;;;
+10311;OLD ITALIC LETTER SHE;Lo;0;L;;;;;N;;;;;
+10312;OLD ITALIC LETTER KU;Lo;0;L;;;;;N;;;;;
+10313;OLD ITALIC LETTER ER;Lo;0;L;;;;;N;;;;;
+10314;OLD ITALIC LETTER ES;Lo;0;L;;;;;N;;;;;
+10315;OLD ITALIC LETTER TE;Lo;0;L;;;;;N;;;;;
+10316;OLD ITALIC LETTER U;Lo;0;L;;;;;N;;;;;
+10317;OLD ITALIC LETTER EKS;Lo;0;L;;;;;N;;Faliscan;;;
+10318;OLD ITALIC LETTER PHE;Lo;0;L;;;;;N;;;;;
+10319;OLD ITALIC LETTER KHE;Lo;0;L;;;;;N;;;;;
+1031A;OLD ITALIC LETTER EF;Lo;0;L;;;;;N;;;;;
+1031B;OLD ITALIC LETTER ERS;Lo;0;L;;;;;N;;Umbrian;;;
+1031C;OLD ITALIC LETTER CHE;Lo;0;L;;;;;N;;Umbrian;;;
+1031D;OLD ITALIC LETTER II;Lo;0;L;;;;;N;;Oscan;;;
+1031E;OLD ITALIC LETTER UU;Lo;0;L;;;;;N;;Oscan;;;
+10320;OLD ITALIC NUMERAL ONE;No;0;L;;;;1;N;;;;;
+10321;OLD ITALIC NUMERAL FIVE;No;0;L;;;;5;N;;;;;
+10322;OLD ITALIC NUMERAL TEN;No;0;L;;;;10;N;;;;;
+10323;OLD ITALIC NUMERAL FIFTY;No;0;L;;;;50;N;;;;;
+10330;GOTHIC LETTER AHSA;Lo;0;L;;;;;N;;;;;
+10331;GOTHIC LETTER BAIRKAN;Lo;0;L;;;;;N;;;;;
+10332;GOTHIC LETTER GIBA;Lo;0;L;;;;;N;;;;;
+10333;GOTHIC LETTER DAGS;Lo;0;L;;;;;N;;;;;
+10334;GOTHIC LETTER AIHVUS;Lo;0;L;;;;;N;;;;;
+10335;GOTHIC LETTER QAIRTHRA;Lo;0;L;;;;;N;;;;;
+10336;GOTHIC LETTER IUJA;Lo;0;L;;;;;N;;;;;
+10337;GOTHIC LETTER HAGL;Lo;0;L;;;;;N;;;;;
+10338;GOTHIC LETTER THIUTH;Lo;0;L;;;;;N;;;;;
+10339;GOTHIC LETTER EIS;Lo;0;L;;;;;N;;;;;
+1033A;GOTHIC LETTER KUSMA;Lo;0;L;;;;;N;;;;;
+1033B;GOTHIC LETTER LAGUS;Lo;0;L;;;;;N;;;;;
+1033C;GOTHIC LETTER MANNA;Lo;0;L;;;;;N;;;;;
+1033D;GOTHIC LETTER NAUTHS;Lo;0;L;;;;;N;;;;;
+1033E;GOTHIC LETTER JER;Lo;0;L;;;;;N;;;;;
+1033F;GOTHIC LETTER URUS;Lo;0;L;;;;;N;;;;;
+10340;GOTHIC LETTER PAIRTHRA;Lo;0;L;;;;;N;;;;;
+10341;GOTHIC LETTER NINETY;Nl;0;L;;;;90;N;;;;;
+10342;GOTHIC LETTER RAIDA;Lo;0;L;;;;;N;;;;;
+10343;GOTHIC LETTER SAUIL;Lo;0;L;;;;;N;;;;;
+10344;GOTHIC LETTER TEIWS;Lo;0;L;;;;;N;;;;;
+10345;GOTHIC LETTER WINJA;Lo;0;L;;;;;N;;;;;
+10346;GOTHIC LETTER FAIHU;Lo;0;L;;;;;N;;;;;
+10347;GOTHIC LETTER IGGWS;Lo;0;L;;;;;N;;;;;
+10348;GOTHIC LETTER HWAIR;Lo;0;L;;;;;N;;;;;
+10349;GOTHIC LETTER OTHAL;Lo;0;L;;;;;N;;;;;
+1034A;GOTHIC LETTER NINE HUNDRED;Nl;0;L;;;;900;N;;;;;
+10380;UGARITIC LETTER ALPA;Lo;0;L;;;;;N;;;;;
+10381;UGARITIC LETTER BETA;Lo;0;L;;;;;N;;;;;
+10382;UGARITIC LETTER GAMLA;Lo;0;L;;;;;N;;;;;
+10383;UGARITIC LETTER KHA;Lo;0;L;;;;;N;;;;;
+10384;UGARITIC LETTER DELTA;Lo;0;L;;;;;N;;;;;
+10385;UGARITIC LETTER HO;Lo;0;L;;;;;N;;;;;
+10386;UGARITIC LETTER WO;Lo;0;L;;;;;N;;;;;
+10387;UGARITIC LETTER ZETA;Lo;0;L;;;;;N;;;;;
+10388;UGARITIC LETTER HOTA;Lo;0;L;;;;;N;;;;;
+10389;UGARITIC LETTER TET;Lo;0;L;;;;;N;;;;;
+1038A;UGARITIC LETTER YOD;Lo;0;L;;;;;N;;;;;
+1038B;UGARITIC LETTER KAF;Lo;0;L;;;;;N;;;;;
+1038C;UGARITIC LETTER SHIN;Lo;0;L;;;;;N;;;;;
+1038D;UGARITIC LETTER LAMDA;Lo;0;L;;;;;N;;;;;
+1038E;UGARITIC LETTER MEM;Lo;0;L;;;;;N;;;;;
+1038F;UGARITIC LETTER DHAL;Lo;0;L;;;;;N;;;;;
+10390;UGARITIC LETTER NUN;Lo;0;L;;;;;N;;;;;
+10391;UGARITIC LETTER ZU;Lo;0;L;;;;;N;;;;;
+10392;UGARITIC LETTER SAMKA;Lo;0;L;;;;;N;;;;;
+10393;UGARITIC LETTER AIN;Lo;0;L;;;;;N;;;;;
+10394;UGARITIC LETTER PU;Lo;0;L;;;;;N;;;;;
+10395;UGARITIC LETTER SADE;Lo;0;L;;;;;N;;;;;
+10396;UGARITIC LETTER QOPA;Lo;0;L;;;;;N;;;;;
+10397;UGARITIC LETTER RASHA;Lo;0;L;;;;;N;;;;;
+10398;UGARITIC LETTER THANNA;Lo;0;L;;;;;N;;;;;
+10399;UGARITIC LETTER GHAIN;Lo;0;L;;;;;N;;;;;
+1039A;UGARITIC LETTER TO;Lo;0;L;;;;;N;;;;;
+1039B;UGARITIC LETTER I;Lo;0;L;;;;;N;;;;;
+1039C;UGARITIC LETTER U;Lo;0;L;;;;;N;;;;;
+1039D;UGARITIC LETTER SSU;Lo;0;L;;;;;N;;;;;
+1039F;UGARITIC WORD DIVIDER;Po;0;L;;;;;N;;;;;
+103A0;OLD PERSIAN SIGN A;Lo;0;L;;;;;N;;;;;
+103A1;OLD PERSIAN SIGN I;Lo;0;L;;;;;N;;;;;
+103A2;OLD PERSIAN SIGN U;Lo;0;L;;;;;N;;;;;
+103A3;OLD PERSIAN SIGN KA;Lo;0;L;;;;;N;;;;;
+103A4;OLD PERSIAN SIGN KU;Lo;0;L;;;;;N;;;;;
+103A5;OLD PERSIAN SIGN GA;Lo;0;L;;;;;N;;;;;
+103A6;OLD PERSIAN SIGN GU;Lo;0;L;;;;;N;;;;;
+103A7;OLD PERSIAN SIGN XA;Lo;0;L;;;;;N;;;;;
+103A8;OLD PERSIAN SIGN CA;Lo;0;L;;;;;N;;;;;
+103A9;OLD PERSIAN SIGN JA;Lo;0;L;;;;;N;;;;;
+103AA;OLD PERSIAN SIGN JI;Lo;0;L;;;;;N;;;;;
+103AB;OLD PERSIAN SIGN TA;Lo;0;L;;;;;N;;;;;
+103AC;OLD PERSIAN SIGN TU;Lo;0;L;;;;;N;;;;;
+103AD;OLD PERSIAN SIGN DA;Lo;0;L;;;;;N;;;;;
+103AE;OLD PERSIAN SIGN DI;Lo;0;L;;;;;N;;;;;
+103AF;OLD PERSIAN SIGN DU;Lo;0;L;;;;;N;;;;;
+103B0;OLD PERSIAN SIGN THA;Lo;0;L;;;;;N;;;;;
+103B1;OLD PERSIAN SIGN PA;Lo;0;L;;;;;N;;;;;
+103B2;OLD PERSIAN SIGN BA;Lo;0;L;;;;;N;;;;;
+103B3;OLD PERSIAN SIGN FA;Lo;0;L;;;;;N;;;;;
+103B4;OLD PERSIAN SIGN NA;Lo;0;L;;;;;N;;;;;
+103B5;OLD PERSIAN SIGN NU;Lo;0;L;;;;;N;;;;;
+103B6;OLD PERSIAN SIGN MA;Lo;0;L;;;;;N;;;;;
+103B7;OLD PERSIAN SIGN MI;Lo;0;L;;;;;N;;;;;
+103B8;OLD PERSIAN SIGN MU;Lo;0;L;;;;;N;;;;;
+103B9;OLD PERSIAN SIGN YA;Lo;0;L;;;;;N;;;;;
+103BA;OLD PERSIAN SIGN VA;Lo;0;L;;;;;N;;;;;
+103BB;OLD PERSIAN SIGN VI;Lo;0;L;;;;;N;;;;;
+103BC;OLD PERSIAN SIGN RA;Lo;0;L;;;;;N;;;;;
+103BD;OLD PERSIAN SIGN RU;Lo;0;L;;;;;N;;;;;
+103BE;OLD PERSIAN SIGN LA;Lo;0;L;;;;;N;;;;;
+103BF;OLD PERSIAN SIGN SA;Lo;0;L;;;;;N;;;;;
+103C0;OLD PERSIAN SIGN ZA;Lo;0;L;;;;;N;;;;;
+103C1;OLD PERSIAN SIGN SHA;Lo;0;L;;;;;N;;;;;
+103C2;OLD PERSIAN SIGN SSA;Lo;0;L;;;;;N;;;;;
+103C3;OLD PERSIAN SIGN HA;Lo;0;L;;;;;N;;;;;
+103C8;OLD PERSIAN SIGN AURAMAZDAA;Lo;0;L;;;;;N;;;;;
+103C9;OLD PERSIAN SIGN AURAMAZDAA-2;Lo;0;L;;;;;N;;;;;
+103CA;OLD PERSIAN SIGN AURAMAZDAAHA;Lo;0;L;;;;;N;;;;;
+103CB;OLD PERSIAN SIGN XSHAAYATHIYA;Lo;0;L;;;;;N;;;;;
+103CC;OLD PERSIAN SIGN DAHYAAUSH;Lo;0;L;;;;;N;;;;;
+103CD;OLD PERSIAN SIGN DAHYAAUSH-2;Lo;0;L;;;;;N;;;;;
+103CE;OLD PERSIAN SIGN BAGA;Lo;0;L;;;;;N;;;;;
+103CF;OLD PERSIAN SIGN BUUMISH;Lo;0;L;;;;;N;;;;;
+103D0;OLD PERSIAN WORD DIVIDER;Po;0;L;;;;;N;;;;;
+103D1;OLD PERSIAN NUMBER ONE;Nl;0;L;;;;1;N;;;;;
+103D2;OLD PERSIAN NUMBER TWO;Nl;0;L;;;;2;N;;;;;
+103D3;OLD PERSIAN NUMBER TEN;Nl;0;L;;;;10;N;;;;;
+103D4;OLD PERSIAN NUMBER TWENTY;Nl;0;L;;;;20;N;;;;;
+103D5;OLD PERSIAN NUMBER HUNDRED;Nl;0;L;;;;100;N;;;;;
+10400;DESERET CAPITAL LETTER LONG I;Lu;0;L;;;;;N;;;;10428;
+10401;DESERET CAPITAL LETTER LONG E;Lu;0;L;;;;;N;;;;10429;
+10402;DESERET CAPITAL LETTER LONG A;Lu;0;L;;;;;N;;;;1042A;
+10403;DESERET CAPITAL LETTER LONG AH;Lu;0;L;;;;;N;;;;1042B;
+10404;DESERET CAPITAL LETTER LONG O;Lu;0;L;;;;;N;;;;1042C;
+10405;DESERET CAPITAL LETTER LONG OO;Lu;0;L;;;;;N;;;;1042D;
+10406;DESERET CAPITAL LETTER SHORT I;Lu;0;L;;;;;N;;;;1042E;
+10407;DESERET CAPITAL LETTER SHORT E;Lu;0;L;;;;;N;;;;1042F;
+10408;DESERET CAPITAL LETTER SHORT A;Lu;0;L;;;;;N;;;;10430;
+10409;DESERET CAPITAL LETTER SHORT AH;Lu;0;L;;;;;N;;;;10431;
+1040A;DESERET CAPITAL LETTER SHORT O;Lu;0;L;;;;;N;;;;10432;
+1040B;DESERET CAPITAL LETTER SHORT OO;Lu;0;L;;;;;N;;;;10433;
+1040C;DESERET CAPITAL LETTER AY;Lu;0;L;;;;;N;;;;10434;
+1040D;DESERET CAPITAL LETTER OW;Lu;0;L;;;;;N;;;;10435;
+1040E;DESERET CAPITAL LETTER WU;Lu;0;L;;;;;N;;;;10436;
+1040F;DESERET CAPITAL LETTER YEE;Lu;0;L;;;;;N;;;;10437;
+10410;DESERET CAPITAL LETTER H;Lu;0;L;;;;;N;;;;10438;
+10411;DESERET CAPITAL LETTER PEE;Lu;0;L;;;;;N;;;;10439;
+10412;DESERET CAPITAL LETTER BEE;Lu;0;L;;;;;N;;;;1043A;
+10413;DESERET CAPITAL LETTER TEE;Lu;0;L;;;;;N;;;;1043B;
+10414;DESERET CAPITAL LETTER DEE;Lu;0;L;;;;;N;;;;1043C;
+10415;DESERET CAPITAL LETTER CHEE;Lu;0;L;;;;;N;;;;1043D;
+10416;DESERET CAPITAL LETTER JEE;Lu;0;L;;;;;N;;;;1043E;
+10417;DESERET CAPITAL LETTER KAY;Lu;0;L;;;;;N;;;;1043F;
+10418;DESERET CAPITAL LETTER GAY;Lu;0;L;;;;;N;;;;10440;
+10419;DESERET CAPITAL LETTER EF;Lu;0;L;;;;;N;;;;10441;
+1041A;DESERET CAPITAL LETTER VEE;Lu;0;L;;;;;N;;;;10442;
+1041B;DESERET CAPITAL LETTER ETH;Lu;0;L;;;;;N;;;;10443;
+1041C;DESERET CAPITAL LETTER THEE;Lu;0;L;;;;;N;;;;10444;
+1041D;DESERET CAPITAL LETTER ES;Lu;0;L;;;;;N;;;;10445;
+1041E;DESERET CAPITAL LETTER ZEE;Lu;0;L;;;;;N;;;;10446;
+1041F;DESERET CAPITAL LETTER ESH;Lu;0;L;;;;;N;;;;10447;
+10420;DESERET CAPITAL LETTER ZHEE;Lu;0;L;;;;;N;;;;10448;
+10421;DESERET CAPITAL LETTER ER;Lu;0;L;;;;;N;;;;10449;
+10422;DESERET CAPITAL LETTER EL;Lu;0;L;;;;;N;;;;1044A;
+10423;DESERET CAPITAL LETTER EM;Lu;0;L;;;;;N;;;;1044B;
+10424;DESERET CAPITAL LETTER EN;Lu;0;L;;;;;N;;;;1044C;
+10425;DESERET CAPITAL LETTER ENG;Lu;0;L;;;;;N;;;;1044D;
+10426;DESERET CAPITAL LETTER OI;Lu;0;L;;;;;N;;;;1044E;
+10427;DESERET CAPITAL LETTER EW;Lu;0;L;;;;;N;;;;1044F;
+10428;DESERET SMALL LETTER LONG I;Ll;0;L;;;;;N;;;10400;;10400
+10429;DESERET SMALL LETTER LONG E;Ll;0;L;;;;;N;;;10401;;10401
+1042A;DESERET SMALL LETTER LONG A;Ll;0;L;;;;;N;;;10402;;10402
+1042B;DESERET SMALL LETTER LONG AH;Ll;0;L;;;;;N;;;10403;;10403
+1042C;DESERET SMALL LETTER LONG O;Ll;0;L;;;;;N;;;10404;;10404
+1042D;DESERET SMALL LETTER LONG OO;Ll;0;L;;;;;N;;;10405;;10405
+1042E;DESERET SMALL LETTER SHORT I;Ll;0;L;;;;;N;;;10406;;10406
+1042F;DESERET SMALL LETTER SHORT E;Ll;0;L;;;;;N;;;10407;;10407
+10430;DESERET SMALL LETTER SHORT A;Ll;0;L;;;;;N;;;10408;;10408
+10431;DESERET SMALL LETTER SHORT AH;Ll;0;L;;;;;N;;;10409;;10409
+10432;DESERET SMALL LETTER SHORT O;Ll;0;L;;;;;N;;;1040A;;1040A
+10433;DESERET SMALL LETTER SHORT OO;Ll;0;L;;;;;N;;;1040B;;1040B
+10434;DESERET SMALL LETTER AY;Ll;0;L;;;;;N;;;1040C;;1040C
+10435;DESERET SMALL LETTER OW;Ll;0;L;;;;;N;;;1040D;;1040D
+10436;DESERET SMALL LETTER WU;Ll;0;L;;;;;N;;;1040E;;1040E
+10437;DESERET SMALL LETTER YEE;Ll;0;L;;;;;N;;;1040F;;1040F
+10438;DESERET SMALL LETTER H;Ll;0;L;;;;;N;;;10410;;10410
+10439;DESERET SMALL LETTER PEE;Ll;0;L;;;;;N;;;10411;;10411
+1043A;DESERET SMALL LETTER BEE;Ll;0;L;;;;;N;;;10412;;10412
+1043B;DESERET SMALL LETTER TEE;Ll;0;L;;;;;N;;;10413;;10413
+1043C;DESERET SMALL LETTER DEE;Ll;0;L;;;;;N;;;10414;;10414
+1043D;DESERET SMALL LETTER CHEE;Ll;0;L;;;;;N;;;10415;;10415
+1043E;DESERET SMALL LETTER JEE;Ll;0;L;;;;;N;;;10416;;10416
+1043F;DESERET SMALL LETTER KAY;Ll;0;L;;;;;N;;;10417;;10417
+10440;DESERET SMALL LETTER GAY;Ll;0;L;;;;;N;;;10418;;10418
+10441;DESERET SMALL LETTER EF;Ll;0;L;;;;;N;;;10419;;10419
+10442;DESERET SMALL LETTER VEE;Ll;0;L;;;;;N;;;1041A;;1041A
+10443;DESERET SMALL LETTER ETH;Ll;0;L;;;;;N;;;1041B;;1041B
+10444;DESERET SMALL LETTER THEE;Ll;0;L;;;;;N;;;1041C;;1041C
+10445;DESERET SMALL LETTER ES;Ll;0;L;;;;;N;;;1041D;;1041D
+10446;DESERET SMALL LETTER ZEE;Ll;0;L;;;;;N;;;1041E;;1041E
+10447;DESERET SMALL LETTER ESH;Ll;0;L;;;;;N;;;1041F;;1041F
+10448;DESERET SMALL LETTER ZHEE;Ll;0;L;;;;;N;;;10420;;10420
+10449;DESERET SMALL LETTER ER;Ll;0;L;;;;;N;;;10421;;10421
+1044A;DESERET SMALL LETTER EL;Ll;0;L;;;;;N;;;10422;;10422
+1044B;DESERET SMALL LETTER EM;Ll;0;L;;;;;N;;;10423;;10423
+1044C;DESERET SMALL LETTER EN;Ll;0;L;;;;;N;;;10424;;10424
+1044D;DESERET SMALL LETTER ENG;Ll;0;L;;;;;N;;;10425;;10425
+1044E;DESERET SMALL LETTER OI;Ll;0;L;;;;;N;;;10426;;10426
+1044F;DESERET SMALL LETTER EW;Ll;0;L;;;;;N;;;10427;;10427
+10450;SHAVIAN LETTER PEEP;Lo;0;L;;;;;N;;;;;
+10451;SHAVIAN LETTER TOT;Lo;0;L;;;;;N;;;;;
+10452;SHAVIAN LETTER KICK;Lo;0;L;;;;;N;;;;;
+10453;SHAVIAN LETTER FEE;Lo;0;L;;;;;N;;;;;
+10454;SHAVIAN LETTER THIGH;Lo;0;L;;;;;N;;;;;
+10455;SHAVIAN LETTER SO;Lo;0;L;;;;;N;;;;;
+10456;SHAVIAN LETTER SURE;Lo;0;L;;;;;N;;;;;
+10457;SHAVIAN LETTER CHURCH;Lo;0;L;;;;;N;;;;;
+10458;SHAVIAN LETTER YEA;Lo;0;L;;;;;N;;;;;
+10459;SHAVIAN LETTER HUNG;Lo;0;L;;;;;N;;;;;
+1045A;SHAVIAN LETTER BIB;Lo;0;L;;;;;N;;;;;
+1045B;SHAVIAN LETTER DEAD;Lo;0;L;;;;;N;;;;;
+1045C;SHAVIAN LETTER GAG;Lo;0;L;;;;;N;;;;;
+1045D;SHAVIAN LETTER VOW;Lo;0;L;;;;;N;;;;;
+1045E;SHAVIAN LETTER THEY;Lo;0;L;;;;;N;;;;;
+1045F;SHAVIAN LETTER ZOO;Lo;0;L;;;;;N;;;;;
+10460;SHAVIAN LETTER MEASURE;Lo;0;L;;;;;N;;;;;
+10461;SHAVIAN LETTER JUDGE;Lo;0;L;;;;;N;;;;;
+10462;SHAVIAN LETTER WOE;Lo;0;L;;;;;N;;;;;
+10463;SHAVIAN LETTER HA-HA;Lo;0;L;;;;;N;;;;;
+10464;SHAVIAN LETTER LOLL;Lo;0;L;;;;;N;;;;;
+10465;SHAVIAN LETTER MIME;Lo;0;L;;;;;N;;;;;
+10466;SHAVIAN LETTER IF;Lo;0;L;;;;;N;;;;;
+10467;SHAVIAN LETTER EGG;Lo;0;L;;;;;N;;;;;
+10468;SHAVIAN LETTER ASH;Lo;0;L;;;;;N;;;;;
+10469;SHAVIAN LETTER ADO;Lo;0;L;;;;;N;;;;;
+1046A;SHAVIAN LETTER ON;Lo;0;L;;;;;N;;;;;
+1046B;SHAVIAN LETTER WOOL;Lo;0;L;;;;;N;;;;;
+1046C;SHAVIAN LETTER OUT;Lo;0;L;;;;;N;;;;;
+1046D;SHAVIAN LETTER AH;Lo;0;L;;;;;N;;;;;
+1046E;SHAVIAN LETTER ROAR;Lo;0;L;;;;;N;;;;;
+1046F;SHAVIAN LETTER NUN;Lo;0;L;;;;;N;;;;;
+10470;SHAVIAN LETTER EAT;Lo;0;L;;;;;N;;;;;
+10471;SHAVIAN LETTER AGE;Lo;0;L;;;;;N;;;;;
+10472;SHAVIAN LETTER ICE;Lo;0;L;;;;;N;;;;;
+10473;SHAVIAN LETTER UP;Lo;0;L;;;;;N;;;;;
+10474;SHAVIAN LETTER OAK;Lo;0;L;;;;;N;;;;;
+10475;SHAVIAN LETTER OOZE;Lo;0;L;;;;;N;;;;;
+10476;SHAVIAN LETTER OIL;Lo;0;L;;;;;N;;;;;
+10477;SHAVIAN LETTER AWE;Lo;0;L;;;;;N;;;;;
+10478;SHAVIAN LETTER ARE;Lo;0;L;;;;;N;;;;;
+10479;SHAVIAN LETTER OR;Lo;0;L;;;;;N;;;;;
+1047A;SHAVIAN LETTER AIR;Lo;0;L;;;;;N;;;;;
+1047B;SHAVIAN LETTER ERR;Lo;0;L;;;;;N;;;;;
+1047C;SHAVIAN LETTER ARRAY;Lo;0;L;;;;;N;;;;;
+1047D;SHAVIAN LETTER EAR;Lo;0;L;;;;;N;;;;;
+1047E;SHAVIAN LETTER IAN;Lo;0;L;;;;;N;;;;;
+1047F;SHAVIAN LETTER YEW;Lo;0;L;;;;;N;;;;;
+10480;OSMANYA LETTER ALEF;Lo;0;L;;;;;N;;;;;
+10481;OSMANYA LETTER BA;Lo;0;L;;;;;N;;;;;
+10482;OSMANYA LETTER TA;Lo;0;L;;;;;N;;;;;
+10483;OSMANYA LETTER JA;Lo;0;L;;;;;N;;;;;
+10484;OSMANYA LETTER XA;Lo;0;L;;;;;N;;;;;
+10485;OSMANYA LETTER KHA;Lo;0;L;;;;;N;;;;;
+10486;OSMANYA LETTER DEEL;Lo;0;L;;;;;N;;;;;
+10487;OSMANYA LETTER RA;Lo;0;L;;;;;N;;;;;
+10488;OSMANYA LETTER SA;Lo;0;L;;;;;N;;;;;
+10489;OSMANYA LETTER SHIIN;Lo;0;L;;;;;N;;;;;
+1048A;OSMANYA LETTER DHA;Lo;0;L;;;;;N;;;;;
+1048B;OSMANYA LETTER CAYN;Lo;0;L;;;;;N;;;;;
+1048C;OSMANYA LETTER GA;Lo;0;L;;;;;N;;;;;
+1048D;OSMANYA LETTER FA;Lo;0;L;;;;;N;;;;;
+1048E;OSMANYA LETTER QAAF;Lo;0;L;;;;;N;;;;;
+1048F;OSMANYA LETTER KAAF;Lo;0;L;;;;;N;;;;;
+10490;OSMANYA LETTER LAAN;Lo;0;L;;;;;N;;;;;
+10491;OSMANYA LETTER MIIN;Lo;0;L;;;;;N;;;;;
+10492;OSMANYA LETTER NUUN;Lo;0;L;;;;;N;;;;;
+10493;OSMANYA LETTER WAW;Lo;0;L;;;;;N;;;;;
+10494;OSMANYA LETTER HA;Lo;0;L;;;;;N;;;;;
+10495;OSMANYA LETTER YA;Lo;0;L;;;;;N;;;;;
+10496;OSMANYA LETTER A;Lo;0;L;;;;;N;;;;;
+10497;OSMANYA LETTER E;Lo;0;L;;;;;N;;;;;
+10498;OSMANYA LETTER I;Lo;0;L;;;;;N;;;;;
+10499;OSMANYA LETTER O;Lo;0;L;;;;;N;;;;;
+1049A;OSMANYA LETTER U;Lo;0;L;;;;;N;;;;;
+1049B;OSMANYA LETTER AA;Lo;0;L;;;;;N;;;;;
+1049C;OSMANYA LETTER EE;Lo;0;L;;;;;N;;;;;
+1049D;OSMANYA LETTER OO;Lo;0;L;;;;;N;;;;;
+104A0;OSMANYA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+104A1;OSMANYA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+104A2;OSMANYA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+104A3;OSMANYA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+104A4;OSMANYA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+104A5;OSMANYA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+104A6;OSMANYA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+104A7;OSMANYA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+104A8;OSMANYA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+104A9;OSMANYA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+10800;CYPRIOT SYLLABLE A;Lo;0;R;;;;;N;;;;;
+10801;CYPRIOT SYLLABLE E;Lo;0;R;;;;;N;;;;;
+10802;CYPRIOT SYLLABLE I;Lo;0;R;;;;;N;;;;;
+10803;CYPRIOT SYLLABLE O;Lo;0;R;;;;;N;;;;;
+10804;CYPRIOT SYLLABLE U;Lo;0;R;;;;;N;;;;;
+10805;CYPRIOT SYLLABLE JA;Lo;0;R;;;;;N;;;;;
+10808;CYPRIOT SYLLABLE JO;Lo;0;R;;;;;N;;;;;
+1080A;CYPRIOT SYLLABLE KA;Lo;0;R;;;;;N;;;;;
+1080B;CYPRIOT SYLLABLE KE;Lo;0;R;;;;;N;;;;;
+1080C;CYPRIOT SYLLABLE KI;Lo;0;R;;;;;N;;;;;
+1080D;CYPRIOT SYLLABLE KO;Lo;0;R;;;;;N;;;;;
+1080E;CYPRIOT SYLLABLE KU;Lo;0;R;;;;;N;;;;;
+1080F;CYPRIOT SYLLABLE LA;Lo;0;R;;;;;N;;;;;
+10810;CYPRIOT SYLLABLE LE;Lo;0;R;;;;;N;;;;;
+10811;CYPRIOT SYLLABLE LI;Lo;0;R;;;;;N;;;;;
+10812;CYPRIOT SYLLABLE LO;Lo;0;R;;;;;N;;;;;
+10813;CYPRIOT SYLLABLE LU;Lo;0;R;;;;;N;;;;;
+10814;CYPRIOT SYLLABLE MA;Lo;0;R;;;;;N;;;;;
+10815;CYPRIOT SYLLABLE ME;Lo;0;R;;;;;N;;;;;
+10816;CYPRIOT SYLLABLE MI;Lo;0;R;;;;;N;;;;;
+10817;CYPRIOT SYLLABLE MO;Lo;0;R;;;;;N;;;;;
+10818;CYPRIOT SYLLABLE MU;Lo;0;R;;;;;N;;;;;
+10819;CYPRIOT SYLLABLE NA;Lo;0;R;;;;;N;;;;;
+1081A;CYPRIOT SYLLABLE NE;Lo;0;R;;;;;N;;;;;
+1081B;CYPRIOT SYLLABLE NI;Lo;0;R;;;;;N;;;;;
+1081C;CYPRIOT SYLLABLE NO;Lo;0;R;;;;;N;;;;;
+1081D;CYPRIOT SYLLABLE NU;Lo;0;R;;;;;N;;;;;
+1081E;CYPRIOT SYLLABLE PA;Lo;0;R;;;;;N;;;;;
+1081F;CYPRIOT SYLLABLE PE;Lo;0;R;;;;;N;;;;;
+10820;CYPRIOT SYLLABLE PI;Lo;0;R;;;;;N;;;;;
+10821;CYPRIOT SYLLABLE PO;Lo;0;R;;;;;N;;;;;
+10822;CYPRIOT SYLLABLE PU;Lo;0;R;;;;;N;;;;;
+10823;CYPRIOT SYLLABLE RA;Lo;0;R;;;;;N;;;;;
+10824;CYPRIOT SYLLABLE RE;Lo;0;R;;;;;N;;;;;
+10825;CYPRIOT SYLLABLE RI;Lo;0;R;;;;;N;;;;;
+10826;CYPRIOT SYLLABLE RO;Lo;0;R;;;;;N;;;;;
+10827;CYPRIOT SYLLABLE RU;Lo;0;R;;;;;N;;;;;
+10828;CYPRIOT SYLLABLE SA;Lo;0;R;;;;;N;;;;;
+10829;CYPRIOT SYLLABLE SE;Lo;0;R;;;;;N;;;;;
+1082A;CYPRIOT SYLLABLE SI;Lo;0;R;;;;;N;;;;;
+1082B;CYPRIOT SYLLABLE SO;Lo;0;R;;;;;N;;;;;
+1082C;CYPRIOT SYLLABLE SU;Lo;0;R;;;;;N;;;;;
+1082D;CYPRIOT SYLLABLE TA;Lo;0;R;;;;;N;;;;;
+1082E;CYPRIOT SYLLABLE TE;Lo;0;R;;;;;N;;;;;
+1082F;CYPRIOT SYLLABLE TI;Lo;0;R;;;;;N;;;;;
+10830;CYPRIOT SYLLABLE TO;Lo;0;R;;;;;N;;;;;
+10831;CYPRIOT SYLLABLE TU;Lo;0;R;;;;;N;;;;;
+10832;CYPRIOT SYLLABLE WA;Lo;0;R;;;;;N;;;;;
+10833;CYPRIOT SYLLABLE WE;Lo;0;R;;;;;N;;;;;
+10834;CYPRIOT SYLLABLE WI;Lo;0;R;;;;;N;;;;;
+10835;CYPRIOT SYLLABLE WO;Lo;0;R;;;;;N;;;;;
+10837;CYPRIOT SYLLABLE XA;Lo;0;R;;;;;N;;;;;
+10838;CYPRIOT SYLLABLE XE;Lo;0;R;;;;;N;;;;;
+1083C;CYPRIOT SYLLABLE ZA;Lo;0;R;;;;;N;;;;;
+1083F;CYPRIOT SYLLABLE ZO;Lo;0;R;;;;;N;;;;;
+10900;PHOENICIAN LETTER ALF;Lo;0;R;;;;;N;;;;;
+10901;PHOENICIAN LETTER BET;Lo;0;R;;;;;N;;;;;
+10902;PHOENICIAN LETTER GAML;Lo;0;R;;;;;N;;;;;
+10903;PHOENICIAN LETTER DELT;Lo;0;R;;;;;N;;;;;
+10904;PHOENICIAN LETTER HE;Lo;0;R;;;;;N;;;;;
+10905;PHOENICIAN LETTER WAU;Lo;0;R;;;;;N;;;;;
+10906;PHOENICIAN LETTER ZAI;Lo;0;R;;;;;N;;;;;
+10907;PHOENICIAN LETTER HET;Lo;0;R;;;;;N;;;;;
+10908;PHOENICIAN LETTER TET;Lo;0;R;;;;;N;;;;;
+10909;PHOENICIAN LETTER YOD;Lo;0;R;;;;;N;;;;;
+1090A;PHOENICIAN LETTER KAF;Lo;0;R;;;;;N;;;;;
+1090B;PHOENICIAN LETTER LAMD;Lo;0;R;;;;;N;;;;;
+1090C;PHOENICIAN LETTER MEM;Lo;0;R;;;;;N;;;;;
+1090D;PHOENICIAN LETTER NUN;Lo;0;R;;;;;N;;;;;
+1090E;PHOENICIAN LETTER SEMK;Lo;0;R;;;;;N;;;;;
+1090F;PHOENICIAN LETTER AIN;Lo;0;R;;;;;N;;;;;
+10910;PHOENICIAN LETTER PE;Lo;0;R;;;;;N;;;;;
+10911;PHOENICIAN LETTER SADE;Lo;0;R;;;;;N;;;;;
+10912;PHOENICIAN LETTER QOF;Lo;0;R;;;;;N;;;;;
+10913;PHOENICIAN LETTER ROSH;Lo;0;R;;;;;N;;;;;
+10914;PHOENICIAN LETTER SHIN;Lo;0;R;;;;;N;;;;;
+10915;PHOENICIAN LETTER TAU;Lo;0;R;;;;;N;;;;;
+10916;PHOENICIAN NUMBER ONE;No;0;R;;;;1;N;;;;;
+10917;PHOENICIAN NUMBER TEN;No;0;R;;;;10;N;;;;;
+10918;PHOENICIAN NUMBER TWENTY;No;0;R;;;;20;N;;;;;
+10919;PHOENICIAN NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;;
+1091F;PHOENICIAN WORD SEPARATOR;Po;0;ON;;;;;N;;;;;
+10A00;KHAROSHTHI LETTER A;Lo;0;R;;;;;N;;;;;
+10A01;KHAROSHTHI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+10A02;KHAROSHTHI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+10A03;KHAROSHTHI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+10A05;KHAROSHTHI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+10A06;KHAROSHTHI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;;
+10A0C;KHAROSHTHI VOWEL LENGTH MARK;Mn;0;NSM;;;;;N;;;;;
+10A0D;KHAROSHTHI SIGN DOUBLE RING BELOW;Mn;220;NSM;;;;;N;;;;;
+10A0E;KHAROSHTHI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+10A0F;KHAROSHTHI SIGN VISARGA;Mn;230;NSM;;;;;N;;;;;
+10A10;KHAROSHTHI LETTER KA;Lo;0;R;;;;;N;;;;;
+10A11;KHAROSHTHI LETTER KHA;Lo;0;R;;;;;N;;;;;
+10A12;KHAROSHTHI LETTER GA;Lo;0;R;;;;;N;;;;;
+10A13;KHAROSHTHI LETTER GHA;Lo;0;R;;;;;N;;;;;
+10A15;KHAROSHTHI LETTER CA;Lo;0;R;;;;;N;;;;;
+10A16;KHAROSHTHI LETTER CHA;Lo;0;R;;;;;N;;;;;
+10A17;KHAROSHTHI LETTER JA;Lo;0;R;;;;;N;;;;;
+10A19;KHAROSHTHI LETTER NYA;Lo;0;R;;;;;N;;;;;
+10A1A;KHAROSHTHI LETTER TTA;Lo;0;R;;;;;N;;;;;
+10A1B;KHAROSHTHI LETTER TTHA;Lo;0;R;;;;;N;;;;;
+10A1C;KHAROSHTHI LETTER DDA;Lo;0;R;;;;;N;;;;;
+10A1D;KHAROSHTHI LETTER DDHA;Lo;0;R;;;;;N;;;;;
+10A1E;KHAROSHTHI LETTER NNA;Lo;0;R;;;;;N;;;;;
+10A1F;KHAROSHTHI LETTER TA;Lo;0;R;;;;;N;;;;;
+10A20;KHAROSHTHI LETTER THA;Lo;0;R;;;;;N;;;;;
+10A21;KHAROSHTHI LETTER DA;Lo;0;R;;;;;N;;;;;
+10A22;KHAROSHTHI LETTER DHA;Lo;0;R;;;;;N;;;;;
+10A23;KHAROSHTHI LETTER NA;Lo;0;R;;;;;N;;;;;
+10A24;KHAROSHTHI LETTER PA;Lo;0;R;;;;;N;;;;;
+10A25;KHAROSHTHI LETTER PHA;Lo;0;R;;;;;N;;;;;
+10A26;KHAROSHTHI LETTER BA;Lo;0;R;;;;;N;;;;;
+10A27;KHAROSHTHI LETTER BHA;Lo;0;R;;;;;N;;;;;
+10A28;KHAROSHTHI LETTER MA;Lo;0;R;;;;;N;;;;;
+10A29;KHAROSHTHI LETTER YA;Lo;0;R;;;;;N;;;;;
+10A2A;KHAROSHTHI LETTER RA;Lo;0;R;;;;;N;;;;;
+10A2B;KHAROSHTHI LETTER LA;Lo;0;R;;;;;N;;;;;
+10A2C;KHAROSHTHI LETTER VA;Lo;0;R;;;;;N;;;;;
+10A2D;KHAROSHTHI LETTER SHA;Lo;0;R;;;;;N;;;;;
+10A2E;KHAROSHTHI LETTER SSA;Lo;0;R;;;;;N;;;;;
+10A2F;KHAROSHTHI LETTER SA;Lo;0;R;;;;;N;;;;;
+10A30;KHAROSHTHI LETTER ZA;Lo;0;R;;;;;N;;;;;
+10A31;KHAROSHTHI LETTER HA;Lo;0;R;;;;;N;;;;;
+10A32;KHAROSHTHI LETTER KKA;Lo;0;R;;;;;N;;;;;
+10A33;KHAROSHTHI LETTER TTTHA;Lo;0;R;;;;;N;;;;;
+10A38;KHAROSHTHI SIGN BAR ABOVE;Mn;230;NSM;;;;;N;;;;;
+10A39;KHAROSHTHI SIGN CAUDA;Mn;1;NSM;;;;;N;;;;;
+10A3A;KHAROSHTHI SIGN DOT BELOW;Mn;220;NSM;;;;;N;;;;;
+10A3F;KHAROSHTHI VIRAMA;Mn;9;NSM;;;;;N;;;;;
+10A40;KHAROSHTHI DIGIT ONE;No;0;R;;;1;1;N;;;;;
+10A41;KHAROSHTHI DIGIT TWO;No;0;R;;;2;2;N;;;;;
+10A42;KHAROSHTHI DIGIT THREE;No;0;R;;;3;3;N;;;;;
+10A43;KHAROSHTHI DIGIT FOUR;No;0;R;;;4;4;N;;;;;
+10A44;KHAROSHTHI NUMBER TEN;No;0;R;;;;10;N;;;;;
+10A45;KHAROSHTHI NUMBER TWENTY;No;0;R;;;;20;N;;;;;
+10A46;KHAROSHTHI NUMBER ONE HUNDRED;No;0;R;;;;100;N;;;;;
+10A47;KHAROSHTHI NUMBER ONE THOUSAND;No;0;R;;;;1000;N;;;;;
+10A50;KHAROSHTHI PUNCTUATION DOT;Po;0;R;;;;;N;;;;;
+10A51;KHAROSHTHI PUNCTUATION SMALL CIRCLE;Po;0;R;;;;;N;;;;;
+10A52;KHAROSHTHI PUNCTUATION CIRCLE;Po;0;R;;;;;N;;;;;
+10A53;KHAROSHTHI PUNCTUATION CRESCENT BAR;Po;0;R;;;;;N;;;;;
+10A54;KHAROSHTHI PUNCTUATION MANGALAM;Po;0;R;;;;;N;;;;;
+10A55;KHAROSHTHI PUNCTUATION LOTUS;Po;0;R;;;;;N;;;;;
+10A56;KHAROSHTHI PUNCTUATION DANDA;Po;0;R;;;;;N;;;;;
+10A57;KHAROSHTHI PUNCTUATION DOUBLE DANDA;Po;0;R;;;;;N;;;;;
+10A58;KHAROSHTHI PUNCTUATION LINES;Po;0;R;;;;;N;;;;;
+12000;CUNEIFORM SIGN A;Lo;0;L;;;;;N;;;;;
+12001;CUNEIFORM SIGN A TIMES A;Lo;0;L;;;;;N;;;;;
+12002;CUNEIFORM SIGN A TIMES BAD;Lo;0;L;;;;;N;;;;;
+12003;CUNEIFORM SIGN A TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+12004;CUNEIFORM SIGN A TIMES HA;Lo;0;L;;;;;N;;;;;
+12005;CUNEIFORM SIGN A TIMES IGI;Lo;0;L;;;;;N;;;;;
+12006;CUNEIFORM SIGN A TIMES LAGAR GUNU;Lo;0;L;;;;;N;;;;;
+12007;CUNEIFORM SIGN A TIMES MUSH;Lo;0;L;;;;;N;;;;;
+12008;CUNEIFORM SIGN A TIMES SAG;Lo;0;L;;;;;N;;;;;
+12009;CUNEIFORM SIGN A2;Lo;0;L;;;;;N;;;;;
+1200A;CUNEIFORM SIGN AB;Lo;0;L;;;;;N;;;;;
+1200B;CUNEIFORM SIGN AB TIMES ASH2;Lo;0;L;;;;;N;;;;;
+1200C;CUNEIFORM SIGN AB TIMES DUN3 GUNU;Lo;0;L;;;;;N;;;;;
+1200D;CUNEIFORM SIGN AB TIMES GAL;Lo;0;L;;;;;N;;;;;
+1200E;CUNEIFORM SIGN AB TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+1200F;CUNEIFORM SIGN AB TIMES HA;Lo;0;L;;;;;N;;;;;
+12010;CUNEIFORM SIGN AB TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+12011;CUNEIFORM SIGN AB TIMES IMIN;Lo;0;L;;;;;N;;;;;
+12012;CUNEIFORM SIGN AB TIMES LAGAB;Lo;0;L;;;;;N;;;;;
+12013;CUNEIFORM SIGN AB TIMES SHESH;Lo;0;L;;;;;N;;;;;
+12014;CUNEIFORM SIGN AB TIMES U PLUS U PLUS U;Lo;0;L;;;;;N;;;;;
+12015;CUNEIFORM SIGN AB GUNU;Lo;0;L;;;;;N;;;;;
+12016;CUNEIFORM SIGN AB2;Lo;0;L;;;;;N;;;;;
+12017;CUNEIFORM SIGN AB2 TIMES BALAG;Lo;0;L;;;;;N;;;;;
+12018;CUNEIFORM SIGN AB2 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+12019;CUNEIFORM SIGN AB2 TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;;
+1201A;CUNEIFORM SIGN AB2 TIMES SHA3;Lo;0;L;;;;;N;;;;;
+1201B;CUNEIFORM SIGN AB2 TIMES TAK4;Lo;0;L;;;;;N;;;;;
+1201C;CUNEIFORM SIGN AD;Lo;0;L;;;;;N;;;;;
+1201D;CUNEIFORM SIGN AK;Lo;0;L;;;;;N;;;;;
+1201E;CUNEIFORM SIGN AK TIMES ERIN2;Lo;0;L;;;;;N;;;;;
+1201F;CUNEIFORM SIGN AK TIMES SHITA PLUS GISH;Lo;0;L;;;;;N;;;;;
+12020;CUNEIFORM SIGN AL;Lo;0;L;;;;;N;;;;;
+12021;CUNEIFORM SIGN AL TIMES AL;Lo;0;L;;;;;N;;;;;
+12022;CUNEIFORM SIGN AL TIMES DIM2;Lo;0;L;;;;;N;;;;;
+12023;CUNEIFORM SIGN AL TIMES GISH;Lo;0;L;;;;;N;;;;;
+12024;CUNEIFORM SIGN AL TIMES HA;Lo;0;L;;;;;N;;;;;
+12025;CUNEIFORM SIGN AL TIMES KAD3;Lo;0;L;;;;;N;;;;;
+12026;CUNEIFORM SIGN AL TIMES KI;Lo;0;L;;;;;N;;;;;
+12027;CUNEIFORM SIGN AL TIMES SHE;Lo;0;L;;;;;N;;;;;
+12028;CUNEIFORM SIGN AL TIMES USH;Lo;0;L;;;;;N;;;;;
+12029;CUNEIFORM SIGN ALAN;Lo;0;L;;;;;N;;;;;
+1202A;CUNEIFORM SIGN ALEPH;Lo;0;L;;;;;N;;;;;
+1202B;CUNEIFORM SIGN AMAR;Lo;0;L;;;;;N;;;;;
+1202C;CUNEIFORM SIGN AMAR TIMES SHE;Lo;0;L;;;;;N;;;;;
+1202D;CUNEIFORM SIGN AN;Lo;0;L;;;;;N;;;;;
+1202E;CUNEIFORM SIGN AN OVER AN;Lo;0;L;;;;;N;;;;;
+1202F;CUNEIFORM SIGN AN THREE TIMES;Lo;0;L;;;;;N;;;;;
+12030;CUNEIFORM SIGN AN PLUS NAGA OPPOSING AN PLUS NAGA;Lo;0;L;;;;;N;;;;;
+12031;CUNEIFORM SIGN AN PLUS NAGA SQUARED;Lo;0;L;;;;;N;;;;;
+12032;CUNEIFORM SIGN ANSHE;Lo;0;L;;;;;N;;;;;
+12033;CUNEIFORM SIGN APIN;Lo;0;L;;;;;N;;;;;
+12034;CUNEIFORM SIGN ARAD;Lo;0;L;;;;;N;;;;;
+12035;CUNEIFORM SIGN ARAD TIMES KUR;Lo;0;L;;;;;N;;;;;
+12036;CUNEIFORM SIGN ARKAB;Lo;0;L;;;;;N;;;;;
+12037;CUNEIFORM SIGN ASAL2;Lo;0;L;;;;;N;;;;;
+12038;CUNEIFORM SIGN ASH;Lo;0;L;;;;;N;;;;;
+12039;CUNEIFORM SIGN ASH ZIDA TENU;Lo;0;L;;;;;N;;;;;
+1203A;CUNEIFORM SIGN ASH KABA TENU;Lo;0;L;;;;;N;;;;;
+1203B;CUNEIFORM SIGN ASH OVER ASH TUG2 OVER TUG2 TUG2 OVER TUG2 PAP;Lo;0;L;;;;;N;;;;;
+1203C;CUNEIFORM SIGN ASH OVER ASH OVER ASH;Lo;0;L;;;;;N;;;;;
+1203D;CUNEIFORM SIGN ASH OVER ASH OVER ASH CROSSING ASH OVER ASH OVER ASH;Lo;0;L;;;;;N;;;;;
+1203E;CUNEIFORM SIGN ASH2;Lo;0;L;;;;;N;;;;;
+1203F;CUNEIFORM SIGN ASHGAB;Lo;0;L;;;;;N;;;;;
+12040;CUNEIFORM SIGN BA;Lo;0;L;;;;;N;;;;;
+12041;CUNEIFORM SIGN BAD;Lo;0;L;;;;;N;;;;;
+12042;CUNEIFORM SIGN BAG3;Lo;0;L;;;;;N;;;;;
+12043;CUNEIFORM SIGN BAHAR2;Lo;0;L;;;;;N;;;;;
+12044;CUNEIFORM SIGN BAL;Lo;0;L;;;;;N;;;;;
+12045;CUNEIFORM SIGN BAL OVER BAL;Lo;0;L;;;;;N;;;;;
+12046;CUNEIFORM SIGN BALAG;Lo;0;L;;;;;N;;;;;
+12047;CUNEIFORM SIGN BAR;Lo;0;L;;;;;N;;;;;
+12048;CUNEIFORM SIGN BARA2;Lo;0;L;;;;;N;;;;;
+12049;CUNEIFORM SIGN BI;Lo;0;L;;;;;N;;;;;
+1204A;CUNEIFORM SIGN BI TIMES A;Lo;0;L;;;;;N;;;;;
+1204B;CUNEIFORM SIGN BI TIMES GAR;Lo;0;L;;;;;N;;;;;
+1204C;CUNEIFORM SIGN BI TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+1204D;CUNEIFORM SIGN BU;Lo;0;L;;;;;N;;;;;
+1204E;CUNEIFORM SIGN BU OVER BU AB;Lo;0;L;;;;;N;;;;;
+1204F;CUNEIFORM SIGN BU OVER BU UN;Lo;0;L;;;;;N;;;;;
+12050;CUNEIFORM SIGN BU CROSSING BU;Lo;0;L;;;;;N;;;;;
+12051;CUNEIFORM SIGN BULUG;Lo;0;L;;;;;N;;;;;
+12052;CUNEIFORM SIGN BULUG OVER BULUG;Lo;0;L;;;;;N;;;;;
+12053;CUNEIFORM SIGN BUR;Lo;0;L;;;;;N;;;;;
+12054;CUNEIFORM SIGN BUR2;Lo;0;L;;;;;N;;;;;
+12055;CUNEIFORM SIGN DA;Lo;0;L;;;;;N;;;;;
+12056;CUNEIFORM SIGN DAG;Lo;0;L;;;;;N;;;;;
+12057;CUNEIFORM SIGN DAG KISIM5 TIMES A PLUS MASH;Lo;0;L;;;;;N;;;;;
+12058;CUNEIFORM SIGN DAG KISIM5 TIMES AMAR;Lo;0;L;;;;;N;;;;;
+12059;CUNEIFORM SIGN DAG KISIM5 TIMES BALAG;Lo;0;L;;;;;N;;;;;
+1205A;CUNEIFORM SIGN DAG KISIM5 TIMES BI;Lo;0;L;;;;;N;;;;;
+1205B;CUNEIFORM SIGN DAG KISIM5 TIMES GA;Lo;0;L;;;;;N;;;;;
+1205C;CUNEIFORM SIGN DAG KISIM5 TIMES GA PLUS MASH;Lo;0;L;;;;;N;;;;;
+1205D;CUNEIFORM SIGN DAG KISIM5 TIMES GI;Lo;0;L;;;;;N;;;;;
+1205E;CUNEIFORM SIGN DAG KISIM5 TIMES GIR2;Lo;0;L;;;;;N;;;;;
+1205F;CUNEIFORM SIGN DAG KISIM5 TIMES GUD;Lo;0;L;;;;;N;;;;;
+12060;CUNEIFORM SIGN DAG KISIM5 TIMES HA;Lo;0;L;;;;;N;;;;;
+12061;CUNEIFORM SIGN DAG KISIM5 TIMES IR;Lo;0;L;;;;;N;;;;;
+12062;CUNEIFORM SIGN DAG KISIM5 TIMES IR PLUS LU;Lo;0;L;;;;;N;;;;;
+12063;CUNEIFORM SIGN DAG KISIM5 TIMES KAK;Lo;0;L;;;;;N;;;;;
+12064;CUNEIFORM SIGN DAG KISIM5 TIMES LA;Lo;0;L;;;;;N;;;;;
+12065;CUNEIFORM SIGN DAG KISIM5 TIMES LU;Lo;0;L;;;;;N;;;;;
+12066;CUNEIFORM SIGN DAG KISIM5 TIMES LU PLUS MASH2;Lo;0;L;;;;;N;;;;;
+12067;CUNEIFORM SIGN DAG KISIM5 TIMES LUM;Lo;0;L;;;;;N;;;;;
+12068;CUNEIFORM SIGN DAG KISIM5 TIMES NE;Lo;0;L;;;;;N;;;;;
+12069;CUNEIFORM SIGN DAG KISIM5 TIMES PAP PLUS PAP;Lo;0;L;;;;;N;;;;;
+1206A;CUNEIFORM SIGN DAG KISIM5 TIMES SI;Lo;0;L;;;;;N;;;;;
+1206B;CUNEIFORM SIGN DAG KISIM5 TIMES TAK4;Lo;0;L;;;;;N;;;;;
+1206C;CUNEIFORM SIGN DAG KISIM5 TIMES U2 PLUS GIR2;Lo;0;L;;;;;N;;;;;
+1206D;CUNEIFORM SIGN DAG KISIM5 TIMES USH;Lo;0;L;;;;;N;;;;;
+1206E;CUNEIFORM SIGN DAM;Lo;0;L;;;;;N;;;;;
+1206F;CUNEIFORM SIGN DAR;Lo;0;L;;;;;N;;;;;
+12070;CUNEIFORM SIGN DARA3;Lo;0;L;;;;;N;;;;;
+12071;CUNEIFORM SIGN DARA4;Lo;0;L;;;;;N;;;;;
+12072;CUNEIFORM SIGN DI;Lo;0;L;;;;;N;;;;;
+12073;CUNEIFORM SIGN DIB;Lo;0;L;;;;;N;;;;;
+12074;CUNEIFORM SIGN DIM;Lo;0;L;;;;;N;;;;;
+12075;CUNEIFORM SIGN DIM TIMES SHE;Lo;0;L;;;;;N;;;;;
+12076;CUNEIFORM SIGN DIM2;Lo;0;L;;;;;N;;;;;
+12077;CUNEIFORM SIGN DIN;Lo;0;L;;;;;N;;;;;
+12078;CUNEIFORM SIGN DIN KASKAL U GUNU DISH;Lo;0;L;;;;;N;;;;;
+12079;CUNEIFORM SIGN DISH;Lo;0;L;;;;;N;;;;;
+1207A;CUNEIFORM SIGN DU;Lo;0;L;;;;;N;;;;;
+1207B;CUNEIFORM SIGN DU OVER DU;Lo;0;L;;;;;N;;;;;
+1207C;CUNEIFORM SIGN DU GUNU;Lo;0;L;;;;;N;;;;;
+1207D;CUNEIFORM SIGN DU SHESHIG;Lo;0;L;;;;;N;;;;;
+1207E;CUNEIFORM SIGN DUB;Lo;0;L;;;;;N;;;;;
+1207F;CUNEIFORM SIGN DUB TIMES ESH2;Lo;0;L;;;;;N;;;;;
+12080;CUNEIFORM SIGN DUB2;Lo;0;L;;;;;N;;;;;
+12081;CUNEIFORM SIGN DUG;Lo;0;L;;;;;N;;;;;
+12082;CUNEIFORM SIGN DUGUD;Lo;0;L;;;;;N;;;;;
+12083;CUNEIFORM SIGN DUH;Lo;0;L;;;;;N;;;;;
+12084;CUNEIFORM SIGN DUN;Lo;0;L;;;;;N;;;;;
+12085;CUNEIFORM SIGN DUN3;Lo;0;L;;;;;N;;;;;
+12086;CUNEIFORM SIGN DUN3 GUNU;Lo;0;L;;;;;N;;;;;
+12087;CUNEIFORM SIGN DUN3 GUNU GUNU;Lo;0;L;;;;;N;;;;;
+12088;CUNEIFORM SIGN DUN4;Lo;0;L;;;;;N;;;;;
+12089;CUNEIFORM SIGN DUR2;Lo;0;L;;;;;N;;;;;
+1208A;CUNEIFORM SIGN E;Lo;0;L;;;;;N;;;;;
+1208B;CUNEIFORM SIGN E TIMES PAP;Lo;0;L;;;;;N;;;;;
+1208C;CUNEIFORM SIGN E OVER E NUN OVER NUN;Lo;0;L;;;;;N;;;;;
+1208D;CUNEIFORM SIGN E2;Lo;0;L;;;;;N;;;;;
+1208E;CUNEIFORM SIGN E2 TIMES A PLUS HA PLUS DA;Lo;0;L;;;;;N;;;;;
+1208F;CUNEIFORM SIGN E2 TIMES GAR;Lo;0;L;;;;;N;;;;;
+12090;CUNEIFORM SIGN E2 TIMES MI;Lo;0;L;;;;;N;;;;;
+12091;CUNEIFORM SIGN E2 TIMES SAL;Lo;0;L;;;;;N;;;;;
+12092;CUNEIFORM SIGN E2 TIMES SHE;Lo;0;L;;;;;N;;;;;
+12093;CUNEIFORM SIGN E2 TIMES U;Lo;0;L;;;;;N;;;;;
+12094;CUNEIFORM SIGN EDIN;Lo;0;L;;;;;N;;;;;
+12095;CUNEIFORM SIGN EGIR;Lo;0;L;;;;;N;;;;;
+12096;CUNEIFORM SIGN EL;Lo;0;L;;;;;N;;;;;
+12097;CUNEIFORM SIGN EN;Lo;0;L;;;;;N;;;;;
+12098;CUNEIFORM SIGN EN TIMES GAN2;Lo;0;L;;;;;N;;;;;
+12099;CUNEIFORM SIGN EN TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+1209A;CUNEIFORM SIGN EN TIMES ME;Lo;0;L;;;;;N;;;;;
+1209B;CUNEIFORM SIGN EN CROSSING EN;Lo;0;L;;;;;N;;;;;
+1209C;CUNEIFORM SIGN EN OPPOSING EN;Lo;0;L;;;;;N;;;;;
+1209D;CUNEIFORM SIGN EN SQUARED;Lo;0;L;;;;;N;;;;;
+1209E;CUNEIFORM SIGN EREN;Lo;0;L;;;;;N;;;;;
+1209F;CUNEIFORM SIGN ERIN2;Lo;0;L;;;;;N;;;;;
+120A0;CUNEIFORM SIGN ESH2;Lo;0;L;;;;;N;;;;;
+120A1;CUNEIFORM SIGN EZEN;Lo;0;L;;;;;N;;;;;
+120A2;CUNEIFORM SIGN EZEN TIMES A;Lo;0;L;;;;;N;;;;;
+120A3;CUNEIFORM SIGN EZEN TIMES A PLUS LAL;Lo;0;L;;;;;N;;;;;
+120A4;CUNEIFORM SIGN EZEN TIMES A PLUS LAL TIMES LAL;Lo;0;L;;;;;N;;;;;
+120A5;CUNEIFORM SIGN EZEN TIMES AN;Lo;0;L;;;;;N;;;;;
+120A6;CUNEIFORM SIGN EZEN TIMES BAD;Lo;0;L;;;;;N;;;;;
+120A7;CUNEIFORM SIGN EZEN TIMES DUN3 GUNU;Lo;0;L;;;;;N;;;;;
+120A8;CUNEIFORM SIGN EZEN TIMES DUN3 GUNU GUNU;Lo;0;L;;;;;N;;;;;
+120A9;CUNEIFORM SIGN EZEN TIMES HA;Lo;0;L;;;;;N;;;;;
+120AA;CUNEIFORM SIGN EZEN TIMES HA GUNU;Lo;0;L;;;;;N;;;;;
+120AB;CUNEIFORM SIGN EZEN TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+120AC;CUNEIFORM SIGN EZEN TIMES KASKAL;Lo;0;L;;;;;N;;;;;
+120AD;CUNEIFORM SIGN EZEN TIMES KASKAL SQUARED;Lo;0;L;;;;;N;;;;;
+120AE;CUNEIFORM SIGN EZEN TIMES KU3;Lo;0;L;;;;;N;;;;;
+120AF;CUNEIFORM SIGN EZEN TIMES LA;Lo;0;L;;;;;N;;;;;
+120B0;CUNEIFORM SIGN EZEN TIMES LAL TIMES LAL;Lo;0;L;;;;;N;;;;;
+120B1;CUNEIFORM SIGN EZEN TIMES LI;Lo;0;L;;;;;N;;;;;
+120B2;CUNEIFORM SIGN EZEN TIMES LU;Lo;0;L;;;;;N;;;;;
+120B3;CUNEIFORM SIGN EZEN TIMES U2;Lo;0;L;;;;;N;;;;;
+120B4;CUNEIFORM SIGN EZEN TIMES UD;Lo;0;L;;;;;N;;;;;
+120B5;CUNEIFORM SIGN GA;Lo;0;L;;;;;N;;;;;
+120B6;CUNEIFORM SIGN GA GUNU;Lo;0;L;;;;;N;;;;;
+120B7;CUNEIFORM SIGN GA2;Lo;0;L;;;;;N;;;;;
+120B8;CUNEIFORM SIGN GA2 TIMES A PLUS DA PLUS HA;Lo;0;L;;;;;N;;;;;
+120B9;CUNEIFORM SIGN GA2 TIMES A PLUS HA;Lo;0;L;;;;;N;;;;;
+120BA;CUNEIFORM SIGN GA2 TIMES A PLUS IGI;Lo;0;L;;;;;N;;;;;
+120BB;CUNEIFORM SIGN GA2 TIMES AB2 TENU PLUS TAB;Lo;0;L;;;;;N;;;;;
+120BC;CUNEIFORM SIGN GA2 TIMES AN;Lo;0;L;;;;;N;;;;;
+120BD;CUNEIFORM SIGN GA2 TIMES ASH;Lo;0;L;;;;;N;;;;;
+120BE;CUNEIFORM SIGN GA2 TIMES ASH2 PLUS GAL;Lo;0;L;;;;;N;;;;;
+120BF;CUNEIFORM SIGN GA2 TIMES BAD;Lo;0;L;;;;;N;;;;;
+120C0;CUNEIFORM SIGN GA2 TIMES BAR PLUS RA;Lo;0;L;;;;;N;;;;;
+120C1;CUNEIFORM SIGN GA2 TIMES BUR;Lo;0;L;;;;;N;;;;;
+120C2;CUNEIFORM SIGN GA2 TIMES BUR PLUS RA;Lo;0;L;;;;;N;;;;;
+120C3;CUNEIFORM SIGN GA2 TIMES DA;Lo;0;L;;;;;N;;;;;
+120C4;CUNEIFORM SIGN GA2 TIMES DI;Lo;0;L;;;;;N;;;;;
+120C5;CUNEIFORM SIGN GA2 TIMES DIM TIMES SHE;Lo;0;L;;;;;N;;;;;
+120C6;CUNEIFORM SIGN GA2 TIMES DUB;Lo;0;L;;;;;N;;;;;
+120C7;CUNEIFORM SIGN GA2 TIMES EL;Lo;0;L;;;;;N;;;;;
+120C8;CUNEIFORM SIGN GA2 TIMES EL PLUS LA;Lo;0;L;;;;;N;;;;;
+120C9;CUNEIFORM SIGN GA2 TIMES EN;Lo;0;L;;;;;N;;;;;
+120CA;CUNEIFORM SIGN GA2 TIMES EN TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+120CB;CUNEIFORM SIGN GA2 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+120CC;CUNEIFORM SIGN GA2 TIMES GAR;Lo;0;L;;;;;N;;;;;
+120CD;CUNEIFORM SIGN GA2 TIMES GI;Lo;0;L;;;;;N;;;;;
+120CE;CUNEIFORM SIGN GA2 TIMES GI4;Lo;0;L;;;;;N;;;;;
+120CF;CUNEIFORM SIGN GA2 TIMES GI4 PLUS A;Lo;0;L;;;;;N;;;;;
+120D0;CUNEIFORM SIGN GA2 TIMES GIR2 PLUS SU;Lo;0;L;;;;;N;;;;;
+120D1;CUNEIFORM SIGN GA2 TIMES HA PLUS LU PLUS ESH2;Lo;0;L;;;;;N;;;;;
+120D2;CUNEIFORM SIGN GA2 TIMES HAL;Lo;0;L;;;;;N;;;;;
+120D3;CUNEIFORM SIGN GA2 TIMES HAL PLUS LA;Lo;0;L;;;;;N;;;;;
+120D4;CUNEIFORM SIGN GA2 TIMES HI PLUS LI;Lo;0;L;;;;;N;;;;;
+120D5;CUNEIFORM SIGN GA2 TIMES HUB2;Lo;0;L;;;;;N;;;;;
+120D6;CUNEIFORM SIGN GA2 TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+120D7;CUNEIFORM SIGN GA2 TIMES ISH PLUS HU PLUS ASH;Lo;0;L;;;;;N;;;;;
+120D8;CUNEIFORM SIGN GA2 TIMES KAK;Lo;0;L;;;;;N;;;;;
+120D9;CUNEIFORM SIGN GA2 TIMES KASKAL;Lo;0;L;;;;;N;;;;;
+120DA;CUNEIFORM SIGN GA2 TIMES KID;Lo;0;L;;;;;N;;;;;
+120DB;CUNEIFORM SIGN GA2 TIMES KID PLUS LAL;Lo;0;L;;;;;N;;;;;
+120DC;CUNEIFORM SIGN GA2 TIMES KU3 PLUS AN;Lo;0;L;;;;;N;;;;;
+120DD;CUNEIFORM SIGN GA2 TIMES LA;Lo;0;L;;;;;N;;;;;
+120DE;CUNEIFORM SIGN GA2 TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;;
+120DF;CUNEIFORM SIGN GA2 TIMES MI;Lo;0;L;;;;;N;;;;;
+120E0;CUNEIFORM SIGN GA2 TIMES NUN;Lo;0;L;;;;;N;;;;;
+120E1;CUNEIFORM SIGN GA2 TIMES NUN OVER NUN;Lo;0;L;;;;;N;;;;;
+120E2;CUNEIFORM SIGN GA2 TIMES PA;Lo;0;L;;;;;N;;;;;
+120E3;CUNEIFORM SIGN GA2 TIMES SAL;Lo;0;L;;;;;N;;;;;
+120E4;CUNEIFORM SIGN GA2 TIMES SAR;Lo;0;L;;;;;N;;;;;
+120E5;CUNEIFORM SIGN GA2 TIMES SHE;Lo;0;L;;;;;N;;;;;
+120E6;CUNEIFORM SIGN GA2 TIMES SHE PLUS TUR;Lo;0;L;;;;;N;;;;;
+120E7;CUNEIFORM SIGN GA2 TIMES SHID;Lo;0;L;;;;;N;;;;;
+120E8;CUNEIFORM SIGN GA2 TIMES SUM;Lo;0;L;;;;;N;;;;;
+120E9;CUNEIFORM SIGN GA2 TIMES TAK4;Lo;0;L;;;;;N;;;;;
+120EA;CUNEIFORM SIGN GA2 TIMES U;Lo;0;L;;;;;N;;;;;
+120EB;CUNEIFORM SIGN GA2 TIMES UD;Lo;0;L;;;;;N;;;;;
+120EC;CUNEIFORM SIGN GA2 TIMES UD PLUS DU;Lo;0;L;;;;;N;;;;;
+120ED;CUNEIFORM SIGN GA2 OVER GA2;Lo;0;L;;;;;N;;;;;
+120EE;CUNEIFORM SIGN GABA;Lo;0;L;;;;;N;;;;;
+120EF;CUNEIFORM SIGN GABA CROSSING GABA;Lo;0;L;;;;;N;;;;;
+120F0;CUNEIFORM SIGN GAD;Lo;0;L;;;;;N;;;;;
+120F1;CUNEIFORM SIGN GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;;
+120F2;CUNEIFORM SIGN GAL;Lo;0;L;;;;;N;;;;;
+120F3;CUNEIFORM SIGN GAL GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;;
+120F4;CUNEIFORM SIGN GALAM;Lo;0;L;;;;;N;;;;;
+120F5;CUNEIFORM SIGN GAM;Lo;0;L;;;;;N;;;;;
+120F6;CUNEIFORM SIGN GAN;Lo;0;L;;;;;N;;;;;
+120F7;CUNEIFORM SIGN GAN2;Lo;0;L;;;;;N;;;;;
+120F8;CUNEIFORM SIGN GAN2 TENU;Lo;0;L;;;;;N;;;;;
+120F9;CUNEIFORM SIGN GAN2 OVER GAN2;Lo;0;L;;;;;N;;;;;
+120FA;CUNEIFORM SIGN GAN2 CROSSING GAN2;Lo;0;L;;;;;N;;;;;
+120FB;CUNEIFORM SIGN GAR;Lo;0;L;;;;;N;;;;;
+120FC;CUNEIFORM SIGN GAR3;Lo;0;L;;;;;N;;;;;
+120FD;CUNEIFORM SIGN GASHAN;Lo;0;L;;;;;N;;;;;
+120FE;CUNEIFORM SIGN GESHTIN;Lo;0;L;;;;;N;;;;;
+120FF;CUNEIFORM SIGN GESHTIN TIMES KUR;Lo;0;L;;;;;N;;;;;
+12100;CUNEIFORM SIGN GI;Lo;0;L;;;;;N;;;;;
+12101;CUNEIFORM SIGN GI TIMES E;Lo;0;L;;;;;N;;;;;
+12102;CUNEIFORM SIGN GI TIMES U;Lo;0;L;;;;;N;;;;;
+12103;CUNEIFORM SIGN GI CROSSING GI;Lo;0;L;;;;;N;;;;;
+12104;CUNEIFORM SIGN GI4;Lo;0;L;;;;;N;;;;;
+12105;CUNEIFORM SIGN GI4 OVER GI4;Lo;0;L;;;;;N;;;;;
+12106;CUNEIFORM SIGN GI4 CROSSING GI4;Lo;0;L;;;;;N;;;;;
+12107;CUNEIFORM SIGN GIDIM;Lo;0;L;;;;;N;;;;;
+12108;CUNEIFORM SIGN GIR2;Lo;0;L;;;;;N;;;;;
+12109;CUNEIFORM SIGN GIR2 GUNU;Lo;0;L;;;;;N;;;;;
+1210A;CUNEIFORM SIGN GIR3;Lo;0;L;;;;;N;;;;;
+1210B;CUNEIFORM SIGN GIR3 TIMES A PLUS IGI;Lo;0;L;;;;;N;;;;;
+1210C;CUNEIFORM SIGN GIR3 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+1210D;CUNEIFORM SIGN GIR3 TIMES IGI;Lo;0;L;;;;;N;;;;;
+1210E;CUNEIFORM SIGN GIR3 TIMES LU PLUS IGI;Lo;0;L;;;;;N;;;;;
+1210F;CUNEIFORM SIGN GIR3 TIMES PA;Lo;0;L;;;;;N;;;;;
+12110;CUNEIFORM SIGN GISAL;Lo;0;L;;;;;N;;;;;
+12111;CUNEIFORM SIGN GISH;Lo;0;L;;;;;N;;;;;
+12112;CUNEIFORM SIGN GISH CROSSING GISH;Lo;0;L;;;;;N;;;;;
+12113;CUNEIFORM SIGN GISH TIMES BAD;Lo;0;L;;;;;N;;;;;
+12114;CUNEIFORM SIGN GISH TIMES TAK4;Lo;0;L;;;;;N;;;;;
+12115;CUNEIFORM SIGN GISH TENU;Lo;0;L;;;;;N;;;;;
+12116;CUNEIFORM SIGN GU;Lo;0;L;;;;;N;;;;;
+12117;CUNEIFORM SIGN GU CROSSING GU;Lo;0;L;;;;;N;;;;;
+12118;CUNEIFORM SIGN GU2;Lo;0;L;;;;;N;;;;;
+12119;CUNEIFORM SIGN GU2 TIMES KAK;Lo;0;L;;;;;N;;;;;
+1211A;CUNEIFORM SIGN GU2 TIMES KAK TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+1211B;CUNEIFORM SIGN GU2 TIMES NUN;Lo;0;L;;;;;N;;;;;
+1211C;CUNEIFORM SIGN GU2 TIMES SAL PLUS TUG2;Lo;0;L;;;;;N;;;;;
+1211D;CUNEIFORM SIGN GU2 GUNU;Lo;0;L;;;;;N;;;;;
+1211E;CUNEIFORM SIGN GUD;Lo;0;L;;;;;N;;;;;
+1211F;CUNEIFORM SIGN GUD TIMES A PLUS KUR;Lo;0;L;;;;;N;;;;;
+12120;CUNEIFORM SIGN GUD TIMES KUR;Lo;0;L;;;;;N;;;;;
+12121;CUNEIFORM SIGN GUD OVER GUD LUGAL;Lo;0;L;;;;;N;;;;;
+12122;CUNEIFORM SIGN GUL;Lo;0;L;;;;;N;;;;;
+12123;CUNEIFORM SIGN GUM;Lo;0;L;;;;;N;;;;;
+12124;CUNEIFORM SIGN GUM TIMES SHE;Lo;0;L;;;;;N;;;;;
+12125;CUNEIFORM SIGN GUR;Lo;0;L;;;;;N;;;;;
+12126;CUNEIFORM SIGN GUR7;Lo;0;L;;;;;N;;;;;
+12127;CUNEIFORM SIGN GURUN;Lo;0;L;;;;;N;;;;;
+12128;CUNEIFORM SIGN GURUSH;Lo;0;L;;;;;N;;;;;
+12129;CUNEIFORM SIGN HA;Lo;0;L;;;;;N;;;;;
+1212A;CUNEIFORM SIGN HA TENU;Lo;0;L;;;;;N;;;;;
+1212B;CUNEIFORM SIGN HA GUNU;Lo;0;L;;;;;N;;;;;
+1212C;CUNEIFORM SIGN HAL;Lo;0;L;;;;;N;;;;;
+1212D;CUNEIFORM SIGN HI;Lo;0;L;;;;;N;;;;;
+1212E;CUNEIFORM SIGN HI TIMES ASH;Lo;0;L;;;;;N;;;;;
+1212F;CUNEIFORM SIGN HI TIMES ASH2;Lo;0;L;;;;;N;;;;;
+12130;CUNEIFORM SIGN HI TIMES BAD;Lo;0;L;;;;;N;;;;;
+12131;CUNEIFORM SIGN HI TIMES DISH;Lo;0;L;;;;;N;;;;;
+12132;CUNEIFORM SIGN HI TIMES GAD;Lo;0;L;;;;;N;;;;;
+12133;CUNEIFORM SIGN HI TIMES KIN;Lo;0;L;;;;;N;;;;;
+12134;CUNEIFORM SIGN HI TIMES NUN;Lo;0;L;;;;;N;;;;;
+12135;CUNEIFORM SIGN HI TIMES SHE;Lo;0;L;;;;;N;;;;;
+12136;CUNEIFORM SIGN HI TIMES U;Lo;0;L;;;;;N;;;;;
+12137;CUNEIFORM SIGN HU;Lo;0;L;;;;;N;;;;;
+12138;CUNEIFORM SIGN HUB2;Lo;0;L;;;;;N;;;;;
+12139;CUNEIFORM SIGN HUB2 TIMES AN;Lo;0;L;;;;;N;;;;;
+1213A;CUNEIFORM SIGN HUB2 TIMES HAL;Lo;0;L;;;;;N;;;;;
+1213B;CUNEIFORM SIGN HUB2 TIMES KASKAL;Lo;0;L;;;;;N;;;;;
+1213C;CUNEIFORM SIGN HUB2 TIMES LISH;Lo;0;L;;;;;N;;;;;
+1213D;CUNEIFORM SIGN HUB2 TIMES UD;Lo;0;L;;;;;N;;;;;
+1213E;CUNEIFORM SIGN HUL2;Lo;0;L;;;;;N;;;;;
+1213F;CUNEIFORM SIGN I;Lo;0;L;;;;;N;;;;;
+12140;CUNEIFORM SIGN I A;Lo;0;L;;;;;N;;;;;
+12141;CUNEIFORM SIGN IB;Lo;0;L;;;;;N;;;;;
+12142;CUNEIFORM SIGN IDIM;Lo;0;L;;;;;N;;;;;
+12143;CUNEIFORM SIGN IDIM OVER IDIM BUR;Lo;0;L;;;;;N;;;;;
+12144;CUNEIFORM SIGN IDIM OVER IDIM SQUARED;Lo;0;L;;;;;N;;;;;
+12145;CUNEIFORM SIGN IG;Lo;0;L;;;;;N;;;;;
+12146;CUNEIFORM SIGN IGI;Lo;0;L;;;;;N;;;;;
+12147;CUNEIFORM SIGN IGI DIB;Lo;0;L;;;;;N;;;;;
+12148;CUNEIFORM SIGN IGI RI;Lo;0;L;;;;;N;;;;;
+12149;CUNEIFORM SIGN IGI OVER IGI SHIR OVER SHIR UD OVER UD;Lo;0;L;;;;;N;;;;;
+1214A;CUNEIFORM SIGN IGI GUNU;Lo;0;L;;;;;N;;;;;
+1214B;CUNEIFORM SIGN IL;Lo;0;L;;;;;N;;;;;
+1214C;CUNEIFORM SIGN IL TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+1214D;CUNEIFORM SIGN IL2;Lo;0;L;;;;;N;;;;;
+1214E;CUNEIFORM SIGN IM;Lo;0;L;;;;;N;;;;;
+1214F;CUNEIFORM SIGN IM TIMES TAK4;Lo;0;L;;;;;N;;;;;
+12150;CUNEIFORM SIGN IM CROSSING IM;Lo;0;L;;;;;N;;;;;
+12151;CUNEIFORM SIGN IM OPPOSING IM;Lo;0;L;;;;;N;;;;;
+12152;CUNEIFORM SIGN IM SQUARED;Lo;0;L;;;;;N;;;;;
+12153;CUNEIFORM SIGN IMIN;Lo;0;L;;;;;N;;;;;
+12154;CUNEIFORM SIGN IN;Lo;0;L;;;;;N;;;;;
+12155;CUNEIFORM SIGN IR;Lo;0;L;;;;;N;;;;;
+12156;CUNEIFORM SIGN ISH;Lo;0;L;;;;;N;;;;;
+12157;CUNEIFORM SIGN KA;Lo;0;L;;;;;N;;;;;
+12158;CUNEIFORM SIGN KA TIMES A;Lo;0;L;;;;;N;;;;;
+12159;CUNEIFORM SIGN KA TIMES AD;Lo;0;L;;;;;N;;;;;
+1215A;CUNEIFORM SIGN KA TIMES AD PLUS KU3;Lo;0;L;;;;;N;;;;;
+1215B;CUNEIFORM SIGN KA TIMES ASH2;Lo;0;L;;;;;N;;;;;
+1215C;CUNEIFORM SIGN KA TIMES BAD;Lo;0;L;;;;;N;;;;;
+1215D;CUNEIFORM SIGN KA TIMES BALAG;Lo;0;L;;;;;N;;;;;
+1215E;CUNEIFORM SIGN KA TIMES BAR;Lo;0;L;;;;;N;;;;;
+1215F;CUNEIFORM SIGN KA TIMES BI;Lo;0;L;;;;;N;;;;;
+12160;CUNEIFORM SIGN KA TIMES ERIN2;Lo;0;L;;;;;N;;;;;
+12161;CUNEIFORM SIGN KA TIMES ESH2;Lo;0;L;;;;;N;;;;;
+12162;CUNEIFORM SIGN KA TIMES GA;Lo;0;L;;;;;N;;;;;
+12163;CUNEIFORM SIGN KA TIMES GAL;Lo;0;L;;;;;N;;;;;
+12164;CUNEIFORM SIGN KA TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+12165;CUNEIFORM SIGN KA TIMES GAR;Lo;0;L;;;;;N;;;;;
+12166;CUNEIFORM SIGN KA TIMES GAR PLUS SHA3 PLUS A;Lo;0;L;;;;;N;;;;;
+12167;CUNEIFORM SIGN KA TIMES GI;Lo;0;L;;;;;N;;;;;
+12168;CUNEIFORM SIGN KA TIMES GIR2;Lo;0;L;;;;;N;;;;;
+12169;CUNEIFORM SIGN KA TIMES GISH PLUS SAR;Lo;0;L;;;;;N;;;;;
+1216A;CUNEIFORM SIGN KA TIMES GISH CROSSING GISH;Lo;0;L;;;;;N;;;;;
+1216B;CUNEIFORM SIGN KA TIMES GU;Lo;0;L;;;;;N;;;;;
+1216C;CUNEIFORM SIGN KA TIMES GUR7;Lo;0;L;;;;;N;;;;;
+1216D;CUNEIFORM SIGN KA TIMES IGI;Lo;0;L;;;;;N;;;;;
+1216E;CUNEIFORM SIGN KA TIMES IM;Lo;0;L;;;;;N;;;;;
+1216F;CUNEIFORM SIGN KA TIMES KAK;Lo;0;L;;;;;N;;;;;
+12170;CUNEIFORM SIGN KA TIMES KI;Lo;0;L;;;;;N;;;;;
+12171;CUNEIFORM SIGN KA TIMES KID;Lo;0;L;;;;;N;;;;;
+12172;CUNEIFORM SIGN KA TIMES LI;Lo;0;L;;;;;N;;;;;
+12173;CUNEIFORM SIGN KA TIMES LU;Lo;0;L;;;;;N;;;;;
+12174;CUNEIFORM SIGN KA TIMES ME;Lo;0;L;;;;;N;;;;;
+12175;CUNEIFORM SIGN KA TIMES ME PLUS DU;Lo;0;L;;;;;N;;;;;
+12176;CUNEIFORM SIGN KA TIMES ME PLUS GI;Lo;0;L;;;;;N;;;;;
+12177;CUNEIFORM SIGN KA TIMES ME PLUS TE;Lo;0;L;;;;;N;;;;;
+12178;CUNEIFORM SIGN KA TIMES MI;Lo;0;L;;;;;N;;;;;
+12179;CUNEIFORM SIGN KA TIMES MI PLUS NUNUZ;Lo;0;L;;;;;N;;;;;
+1217A;CUNEIFORM SIGN KA TIMES NE;Lo;0;L;;;;;N;;;;;
+1217B;CUNEIFORM SIGN KA TIMES NUN;Lo;0;L;;;;;N;;;;;
+1217C;CUNEIFORM SIGN KA TIMES PI;Lo;0;L;;;;;N;;;;;
+1217D;CUNEIFORM SIGN KA TIMES RU;Lo;0;L;;;;;N;;;;;
+1217E;CUNEIFORM SIGN KA TIMES SA;Lo;0;L;;;;;N;;;;;
+1217F;CUNEIFORM SIGN KA TIMES SAR;Lo;0;L;;;;;N;;;;;
+12180;CUNEIFORM SIGN KA TIMES SHA;Lo;0;L;;;;;N;;;;;
+12181;CUNEIFORM SIGN KA TIMES SHE;Lo;0;L;;;;;N;;;;;
+12182;CUNEIFORM SIGN KA TIMES SHID;Lo;0;L;;;;;N;;;;;
+12183;CUNEIFORM SIGN KA TIMES SHU;Lo;0;L;;;;;N;;;;;
+12184;CUNEIFORM SIGN KA TIMES SIG;Lo;0;L;;;;;N;;;;;
+12185;CUNEIFORM SIGN KA TIMES SUHUR;Lo;0;L;;;;;N;;;;;
+12186;CUNEIFORM SIGN KA TIMES TAR;Lo;0;L;;;;;N;;;;;
+12187;CUNEIFORM SIGN KA TIMES U;Lo;0;L;;;;;N;;;;;
+12188;CUNEIFORM SIGN KA TIMES U2;Lo;0;L;;;;;N;;;;;
+12189;CUNEIFORM SIGN KA TIMES UD;Lo;0;L;;;;;N;;;;;
+1218A;CUNEIFORM SIGN KA TIMES UMUM TIMES PA;Lo;0;L;;;;;N;;;;;
+1218B;CUNEIFORM SIGN KA TIMES USH;Lo;0;L;;;;;N;;;;;
+1218C;CUNEIFORM SIGN KA TIMES ZI;Lo;0;L;;;;;N;;;;;
+1218D;CUNEIFORM SIGN KA2;Lo;0;L;;;;;N;;;;;
+1218E;CUNEIFORM SIGN KA2 CROSSING KA2;Lo;0;L;;;;;N;;;;;
+1218F;CUNEIFORM SIGN KAB;Lo;0;L;;;;;N;;;;;
+12190;CUNEIFORM SIGN KAD2;Lo;0;L;;;;;N;;;;;
+12191;CUNEIFORM SIGN KAD3;Lo;0;L;;;;;N;;;;;
+12192;CUNEIFORM SIGN KAD4;Lo;0;L;;;;;N;;;;;
+12193;CUNEIFORM SIGN KAD5;Lo;0;L;;;;;N;;;;;
+12194;CUNEIFORM SIGN KAD5 OVER KAD5;Lo;0;L;;;;;N;;;;;
+12195;CUNEIFORM SIGN KAK;Lo;0;L;;;;;N;;;;;
+12196;CUNEIFORM SIGN KAK TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+12197;CUNEIFORM SIGN KAL;Lo;0;L;;;;;N;;;;;
+12198;CUNEIFORM SIGN KAL TIMES BAD;Lo;0;L;;;;;N;;;;;
+12199;CUNEIFORM SIGN KAL CROSSING KAL;Lo;0;L;;;;;N;;;;;
+1219A;CUNEIFORM SIGN KAM2;Lo;0;L;;;;;N;;;;;
+1219B;CUNEIFORM SIGN KAM4;Lo;0;L;;;;;N;;;;;
+1219C;CUNEIFORM SIGN KASKAL;Lo;0;L;;;;;N;;;;;
+1219D;CUNEIFORM SIGN KASKAL LAGAB TIMES U OVER LAGAB TIMES U;Lo;0;L;;;;;N;;;;;
+1219E;CUNEIFORM SIGN KASKAL OVER KASKAL LAGAB TIMES U OVER LAGAB TIMES U;Lo;0;L;;;;;N;;;;;
+1219F;CUNEIFORM SIGN KESH2;Lo;0;L;;;;;N;;;;;
+121A0;CUNEIFORM SIGN KI;Lo;0;L;;;;;N;;;;;
+121A1;CUNEIFORM SIGN KI TIMES BAD;Lo;0;L;;;;;N;;;;;
+121A2;CUNEIFORM SIGN KI TIMES U;Lo;0;L;;;;;N;;;;;
+121A3;CUNEIFORM SIGN KI TIMES UD;Lo;0;L;;;;;N;;;;;
+121A4;CUNEIFORM SIGN KID;Lo;0;L;;;;;N;;;;;
+121A5;CUNEIFORM SIGN KIN;Lo;0;L;;;;;N;;;;;
+121A6;CUNEIFORM SIGN KISAL;Lo;0;L;;;;;N;;;;;
+121A7;CUNEIFORM SIGN KISH;Lo;0;L;;;;;N;;;;;
+121A8;CUNEIFORM SIGN KISIM5;Lo;0;L;;;;;N;;;;;
+121A9;CUNEIFORM SIGN KISIM5 OVER KISIM5;Lo;0;L;;;;;N;;;;;
+121AA;CUNEIFORM SIGN KU;Lo;0;L;;;;;N;;;;;
+121AB;CUNEIFORM SIGN KU OVER HI TIMES ASH2 KU OVER HI TIMES ASH2;Lo;0;L;;;;;N;;;;;
+121AC;CUNEIFORM SIGN KU3;Lo;0;L;;;;;N;;;;;
+121AD;CUNEIFORM SIGN KU4;Lo;0;L;;;;;N;;;;;
+121AE;CUNEIFORM SIGN KU4 VARIANT FORM;Lo;0;L;;;;;N;;;;;
+121AF;CUNEIFORM SIGN KU7;Lo;0;L;;;;;N;;;;;
+121B0;CUNEIFORM SIGN KUL;Lo;0;L;;;;;N;;;;;
+121B1;CUNEIFORM SIGN KUL GUNU;Lo;0;L;;;;;N;;;;;
+121B2;CUNEIFORM SIGN KUN;Lo;0;L;;;;;N;;;;;
+121B3;CUNEIFORM SIGN KUR;Lo;0;L;;;;;N;;;;;
+121B4;CUNEIFORM SIGN KUR OPPOSING KUR;Lo;0;L;;;;;N;;;;;
+121B5;CUNEIFORM SIGN KUSHU2;Lo;0;L;;;;;N;;;;;
+121B6;CUNEIFORM SIGN KWU318;Lo;0;L;;;;;N;;;;;
+121B7;CUNEIFORM SIGN LA;Lo;0;L;;;;;N;;;;;
+121B8;CUNEIFORM SIGN LAGAB;Lo;0;L;;;;;N;;;;;
+121B9;CUNEIFORM SIGN LAGAB TIMES A;Lo;0;L;;;;;N;;;;;
+121BA;CUNEIFORM SIGN LAGAB TIMES A PLUS DA PLUS HA;Lo;0;L;;;;;N;;;;;
+121BB;CUNEIFORM SIGN LAGAB TIMES A PLUS GAR;Lo;0;L;;;;;N;;;;;
+121BC;CUNEIFORM SIGN LAGAB TIMES A PLUS LAL;Lo;0;L;;;;;N;;;;;
+121BD;CUNEIFORM SIGN LAGAB TIMES AL;Lo;0;L;;;;;N;;;;;
+121BE;CUNEIFORM SIGN LAGAB TIMES AN;Lo;0;L;;;;;N;;;;;
+121BF;CUNEIFORM SIGN LAGAB TIMES ASH ZIDA TENU;Lo;0;L;;;;;N;;;;;
+121C0;CUNEIFORM SIGN LAGAB TIMES BAD;Lo;0;L;;;;;N;;;;;
+121C1;CUNEIFORM SIGN LAGAB TIMES BI;Lo;0;L;;;;;N;;;;;
+121C2;CUNEIFORM SIGN LAGAB TIMES DAR;Lo;0;L;;;;;N;;;;;
+121C3;CUNEIFORM SIGN LAGAB TIMES EN;Lo;0;L;;;;;N;;;;;
+121C4;CUNEIFORM SIGN LAGAB TIMES GA;Lo;0;L;;;;;N;;;;;
+121C5;CUNEIFORM SIGN LAGAB TIMES GAR;Lo;0;L;;;;;N;;;;;
+121C6;CUNEIFORM SIGN LAGAB TIMES GUD;Lo;0;L;;;;;N;;;;;
+121C7;CUNEIFORM SIGN LAGAB TIMES GUD PLUS GUD;Lo;0;L;;;;;N;;;;;
+121C8;CUNEIFORM SIGN LAGAB TIMES HA;Lo;0;L;;;;;N;;;;;
+121C9;CUNEIFORM SIGN LAGAB TIMES HAL;Lo;0;L;;;;;N;;;;;
+121CA;CUNEIFORM SIGN LAGAB TIMES HI TIMES NUN;Lo;0;L;;;;;N;;;;;
+121CB;CUNEIFORM SIGN LAGAB TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+121CC;CUNEIFORM SIGN LAGAB TIMES IM;Lo;0;L;;;;;N;;;;;
+121CD;CUNEIFORM SIGN LAGAB TIMES IM PLUS HA;Lo;0;L;;;;;N;;;;;
+121CE;CUNEIFORM SIGN LAGAB TIMES IM PLUS LU;Lo;0;L;;;;;N;;;;;
+121CF;CUNEIFORM SIGN LAGAB TIMES KI;Lo;0;L;;;;;N;;;;;
+121D0;CUNEIFORM SIGN LAGAB TIMES KIN;Lo;0;L;;;;;N;;;;;
+121D1;CUNEIFORM SIGN LAGAB TIMES KU3;Lo;0;L;;;;;N;;;;;
+121D2;CUNEIFORM SIGN LAGAB TIMES KUL;Lo;0;L;;;;;N;;;;;
+121D3;CUNEIFORM SIGN LAGAB TIMES KUL PLUS HI PLUS A;Lo;0;L;;;;;N;;;;;
+121D4;CUNEIFORM SIGN LAGAB TIMES LAGAB;Lo;0;L;;;;;N;;;;;
+121D5;CUNEIFORM SIGN LAGAB TIMES LISH;Lo;0;L;;;;;N;;;;;
+121D6;CUNEIFORM SIGN LAGAB TIMES LU;Lo;0;L;;;;;N;;;;;
+121D7;CUNEIFORM SIGN LAGAB TIMES LUL;Lo;0;L;;;;;N;;;;;
+121D8;CUNEIFORM SIGN LAGAB TIMES ME;Lo;0;L;;;;;N;;;;;
+121D9;CUNEIFORM SIGN LAGAB TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;;
+121DA;CUNEIFORM SIGN LAGAB TIMES MUSH;Lo;0;L;;;;;N;;;;;
+121DB;CUNEIFORM SIGN LAGAB TIMES NE;Lo;0;L;;;;;N;;;;;
+121DC;CUNEIFORM SIGN LAGAB TIMES SHE PLUS SUM;Lo;0;L;;;;;N;;;;;
+121DD;CUNEIFORM SIGN LAGAB TIMES SHITA PLUS GISH PLUS ERIN2;Lo;0;L;;;;;N;;;;;
+121DE;CUNEIFORM SIGN LAGAB TIMES SHITA PLUS GISH TENU;Lo;0;L;;;;;N;;;;;
+121DF;CUNEIFORM SIGN LAGAB TIMES SHU2;Lo;0;L;;;;;N;;;;;
+121E0;CUNEIFORM SIGN LAGAB TIMES SHU2 PLUS SHU2;Lo;0;L;;;;;N;;;;;
+121E1;CUNEIFORM SIGN LAGAB TIMES SUM;Lo;0;L;;;;;N;;;;;
+121E2;CUNEIFORM SIGN LAGAB TIMES TAG;Lo;0;L;;;;;N;;;;;
+121E3;CUNEIFORM SIGN LAGAB TIMES TAK4;Lo;0;L;;;;;N;;;;;
+121E4;CUNEIFORM SIGN LAGAB TIMES TE PLUS A PLUS SU PLUS NA;Lo;0;L;;;;;N;;;;;
+121E5;CUNEIFORM SIGN LAGAB TIMES U;Lo;0;L;;;;;N;;;;;
+121E6;CUNEIFORM SIGN LAGAB TIMES U PLUS A;Lo;0;L;;;;;N;;;;;
+121E7;CUNEIFORM SIGN LAGAB TIMES U PLUS U PLUS U;Lo;0;L;;;;;N;;;;;
+121E8;CUNEIFORM SIGN LAGAB TIMES U2 PLUS ASH;Lo;0;L;;;;;N;;;;;
+121E9;CUNEIFORM SIGN LAGAB TIMES UD;Lo;0;L;;;;;N;;;;;
+121EA;CUNEIFORM SIGN LAGAB TIMES USH;Lo;0;L;;;;;N;;;;;
+121EB;CUNEIFORM SIGN LAGAB SQUARED;Lo;0;L;;;;;N;;;;;
+121EC;CUNEIFORM SIGN LAGAR;Lo;0;L;;;;;N;;;;;
+121ED;CUNEIFORM SIGN LAGAR TIMES SHE;Lo;0;L;;;;;N;;;;;
+121EE;CUNEIFORM SIGN LAGAR TIMES SHE PLUS SUM;Lo;0;L;;;;;N;;;;;
+121EF;CUNEIFORM SIGN LAGAR GUNU;Lo;0;L;;;;;N;;;;;
+121F0;CUNEIFORM SIGN LAGAR GUNU OVER LAGAR GUNU SHE;Lo;0;L;;;;;N;;;;;
+121F1;CUNEIFORM SIGN LAHSHU;Lo;0;L;;;;;N;;;;;
+121F2;CUNEIFORM SIGN LAL;Lo;0;L;;;;;N;;;;;
+121F3;CUNEIFORM SIGN LAL TIMES LAL;Lo;0;L;;;;;N;;;;;
+121F4;CUNEIFORM SIGN LAM;Lo;0;L;;;;;N;;;;;
+121F5;CUNEIFORM SIGN LAM TIMES KUR;Lo;0;L;;;;;N;;;;;
+121F6;CUNEIFORM SIGN LAM TIMES KUR PLUS RU;Lo;0;L;;;;;N;;;;;
+121F7;CUNEIFORM SIGN LI;Lo;0;L;;;;;N;;;;;
+121F8;CUNEIFORM SIGN LIL;Lo;0;L;;;;;N;;;;;
+121F9;CUNEIFORM SIGN LIMMU2;Lo;0;L;;;;;N;;;;;
+121FA;CUNEIFORM SIGN LISH;Lo;0;L;;;;;N;;;;;
+121FB;CUNEIFORM SIGN LU;Lo;0;L;;;;;N;;;;;
+121FC;CUNEIFORM SIGN LU TIMES BAD;Lo;0;L;;;;;N;;;;;
+121FD;CUNEIFORM SIGN LU2;Lo;0;L;;;;;N;;;;;
+121FE;CUNEIFORM SIGN LU2 TIMES AL;Lo;0;L;;;;;N;;;;;
+121FF;CUNEIFORM SIGN LU2 TIMES BAD;Lo;0;L;;;;;N;;;;;
+12200;CUNEIFORM SIGN LU2 TIMES ESH2;Lo;0;L;;;;;N;;;;;
+12201;CUNEIFORM SIGN LU2 TIMES ESH2 TENU;Lo;0;L;;;;;N;;;;;
+12202;CUNEIFORM SIGN LU2 TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+12203;CUNEIFORM SIGN LU2 TIMES HI TIMES BAD;Lo;0;L;;;;;N;;;;;
+12204;CUNEIFORM SIGN LU2 TIMES IM;Lo;0;L;;;;;N;;;;;
+12205;CUNEIFORM SIGN LU2 TIMES KAD2;Lo;0;L;;;;;N;;;;;
+12206;CUNEIFORM SIGN LU2 TIMES KAD3;Lo;0;L;;;;;N;;;;;
+12207;CUNEIFORM SIGN LU2 TIMES KAD3 PLUS ASH;Lo;0;L;;;;;N;;;;;
+12208;CUNEIFORM SIGN LU2 TIMES KI;Lo;0;L;;;;;N;;;;;
+12209;CUNEIFORM SIGN LU2 TIMES LA PLUS ASH;Lo;0;L;;;;;N;;;;;
+1220A;CUNEIFORM SIGN LU2 TIMES LAGAB;Lo;0;L;;;;;N;;;;;
+1220B;CUNEIFORM SIGN LU2 TIMES ME PLUS EN;Lo;0;L;;;;;N;;;;;
+1220C;CUNEIFORM SIGN LU2 TIMES NE;Lo;0;L;;;;;N;;;;;
+1220D;CUNEIFORM SIGN LU2 TIMES NU;Lo;0;L;;;;;N;;;;;
+1220E;CUNEIFORM SIGN LU2 TIMES SI PLUS ASH;Lo;0;L;;;;;N;;;;;
+1220F;CUNEIFORM SIGN LU2 TIMES SIK2 PLUS BU;Lo;0;L;;;;;N;;;;;
+12210;CUNEIFORM SIGN LU2 TIMES TUG2;Lo;0;L;;;;;N;;;;;
+12211;CUNEIFORM SIGN LU2 TENU;Lo;0;L;;;;;N;;;;;
+12212;CUNEIFORM SIGN LU2 CROSSING LU2;Lo;0;L;;;;;N;;;;;
+12213;CUNEIFORM SIGN LU2 OPPOSING LU2;Lo;0;L;;;;;N;;;;;
+12214;CUNEIFORM SIGN LU2 SQUARED;Lo;0;L;;;;;N;;;;;
+12215;CUNEIFORM SIGN LU2 SHESHIG;Lo;0;L;;;;;N;;;;;
+12216;CUNEIFORM SIGN LU3;Lo;0;L;;;;;N;;;;;
+12217;CUNEIFORM SIGN LUGAL;Lo;0;L;;;;;N;;;;;
+12218;CUNEIFORM SIGN LUGAL OVER LUGAL;Lo;0;L;;;;;N;;;;;
+12219;CUNEIFORM SIGN LUGAL OPPOSING LUGAL;Lo;0;L;;;;;N;;;;;
+1221A;CUNEIFORM SIGN LUGAL SHESHIG;Lo;0;L;;;;;N;;;;;
+1221B;CUNEIFORM SIGN LUH;Lo;0;L;;;;;N;;;;;
+1221C;CUNEIFORM SIGN LUL;Lo;0;L;;;;;N;;;;;
+1221D;CUNEIFORM SIGN LUM;Lo;0;L;;;;;N;;;;;
+1221E;CUNEIFORM SIGN LUM OVER LUM;Lo;0;L;;;;;N;;;;;
+1221F;CUNEIFORM SIGN LUM OVER LUM GAR OVER GAR;Lo;0;L;;;;;N;;;;;
+12220;CUNEIFORM SIGN MA;Lo;0;L;;;;;N;;;;;
+12221;CUNEIFORM SIGN MA TIMES TAK4;Lo;0;L;;;;;N;;;;;
+12222;CUNEIFORM SIGN MA GUNU;Lo;0;L;;;;;N;;;;;
+12223;CUNEIFORM SIGN MA2;Lo;0;L;;;;;N;;;;;
+12224;CUNEIFORM SIGN MAH;Lo;0;L;;;;;N;;;;;
+12225;CUNEIFORM SIGN MAR;Lo;0;L;;;;;N;;;;;
+12226;CUNEIFORM SIGN MASH;Lo;0;L;;;;;N;;;;;
+12227;CUNEIFORM SIGN MASH2;Lo;0;L;;;;;N;;;;;
+12228;CUNEIFORM SIGN ME;Lo;0;L;;;;;N;;;;;
+12229;CUNEIFORM SIGN MES;Lo;0;L;;;;;N;;;;;
+1222A;CUNEIFORM SIGN MI;Lo;0;L;;;;;N;;;;;
+1222B;CUNEIFORM SIGN MIN;Lo;0;L;;;;;N;;;;;
+1222C;CUNEIFORM SIGN MU;Lo;0;L;;;;;N;;;;;
+1222D;CUNEIFORM SIGN MU OVER MU;Lo;0;L;;;;;N;;;;;
+1222E;CUNEIFORM SIGN MUG;Lo;0;L;;;;;N;;;;;
+1222F;CUNEIFORM SIGN MUG GUNU;Lo;0;L;;;;;N;;;;;
+12230;CUNEIFORM SIGN MUNSUB;Lo;0;L;;;;;N;;;;;
+12231;CUNEIFORM SIGN MURGU2;Lo;0;L;;;;;N;;;;;
+12232;CUNEIFORM SIGN MUSH;Lo;0;L;;;;;N;;;;;
+12233;CUNEIFORM SIGN MUSH TIMES A;Lo;0;L;;;;;N;;;;;
+12234;CUNEIFORM SIGN MUSH TIMES KUR;Lo;0;L;;;;;N;;;;;
+12235;CUNEIFORM SIGN MUSH TIMES ZA;Lo;0;L;;;;;N;;;;;
+12236;CUNEIFORM SIGN MUSH OVER MUSH;Lo;0;L;;;;;N;;;;;
+12237;CUNEIFORM SIGN MUSH OVER MUSH TIMES A PLUS NA;Lo;0;L;;;;;N;;;;;
+12238;CUNEIFORM SIGN MUSH CROSSING MUSH;Lo;0;L;;;;;N;;;;;
+12239;CUNEIFORM SIGN MUSH3;Lo;0;L;;;;;N;;;;;
+1223A;CUNEIFORM SIGN MUSH3 TIMES A;Lo;0;L;;;;;N;;;;;
+1223B;CUNEIFORM SIGN MUSH3 TIMES A PLUS DI;Lo;0;L;;;;;N;;;;;
+1223C;CUNEIFORM SIGN MUSH3 TIMES DI;Lo;0;L;;;;;N;;;;;
+1223D;CUNEIFORM SIGN MUSH3 GUNU;Lo;0;L;;;;;N;;;;;
+1223E;CUNEIFORM SIGN NA;Lo;0;L;;;;;N;;;;;
+1223F;CUNEIFORM SIGN NA2;Lo;0;L;;;;;N;;;;;
+12240;CUNEIFORM SIGN NAGA;Lo;0;L;;;;;N;;;;;
+12241;CUNEIFORM SIGN NAGA INVERTED;Lo;0;L;;;;;N;;;;;
+12242;CUNEIFORM SIGN NAGA TIMES SHU TENU;Lo;0;L;;;;;N;;;;;
+12243;CUNEIFORM SIGN NAGA OPPOSING NAGA;Lo;0;L;;;;;N;;;;;
+12244;CUNEIFORM SIGN NAGAR;Lo;0;L;;;;;N;;;;;
+12245;CUNEIFORM SIGN NAM NUTILLU;Lo;0;L;;;;;N;;;;;
+12246;CUNEIFORM SIGN NAM;Lo;0;L;;;;;N;;;;;
+12247;CUNEIFORM SIGN NAM2;Lo;0;L;;;;;N;;;;;
+12248;CUNEIFORM SIGN NE;Lo;0;L;;;;;N;;;;;
+12249;CUNEIFORM SIGN NE TIMES A;Lo;0;L;;;;;N;;;;;
+1224A;CUNEIFORM SIGN NE TIMES UD;Lo;0;L;;;;;N;;;;;
+1224B;CUNEIFORM SIGN NE SHESHIG;Lo;0;L;;;;;N;;;;;
+1224C;CUNEIFORM SIGN NI;Lo;0;L;;;;;N;;;;;
+1224D;CUNEIFORM SIGN NI TIMES E;Lo;0;L;;;;;N;;;;;
+1224E;CUNEIFORM SIGN NI2;Lo;0;L;;;;;N;;;;;
+1224F;CUNEIFORM SIGN NIM;Lo;0;L;;;;;N;;;;;
+12250;CUNEIFORM SIGN NIM TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+12251;CUNEIFORM SIGN NIM TIMES GAR PLUS GAN2 TENU;Lo;0;L;;;;;N;;;;;
+12252;CUNEIFORM SIGN NINDA2;Lo;0;L;;;;;N;;;;;
+12253;CUNEIFORM SIGN NINDA2 TIMES AN;Lo;0;L;;;;;N;;;;;
+12254;CUNEIFORM SIGN NINDA2 TIMES ASH;Lo;0;L;;;;;N;;;;;
+12255;CUNEIFORM SIGN NINDA2 TIMES ASH PLUS ASH;Lo;0;L;;;;;N;;;;;
+12256;CUNEIFORM SIGN NINDA2 TIMES GUD;Lo;0;L;;;;;N;;;;;
+12257;CUNEIFORM SIGN NINDA2 TIMES ME PLUS GAN2 TENU;Lo;0;L;;;;;N;;;;;
+12258;CUNEIFORM SIGN NINDA2 TIMES NE;Lo;0;L;;;;;N;;;;;
+12259;CUNEIFORM SIGN NINDA2 TIMES NUN;Lo;0;L;;;;;N;;;;;
+1225A;CUNEIFORM SIGN NINDA2 TIMES SHE;Lo;0;L;;;;;N;;;;;
+1225B;CUNEIFORM SIGN NINDA2 TIMES SHE PLUS A AN;Lo;0;L;;;;;N;;;;;
+1225C;CUNEIFORM SIGN NINDA2 TIMES SHE PLUS ASH;Lo;0;L;;;;;N;;;;;
+1225D;CUNEIFORM SIGN NINDA2 TIMES SHE PLUS ASH PLUS ASH;Lo;0;L;;;;;N;;;;;
+1225E;CUNEIFORM SIGN NINDA2 TIMES U2 PLUS ASH;Lo;0;L;;;;;N;;;;;
+1225F;CUNEIFORM SIGN NINDA2 TIMES USH;Lo;0;L;;;;;N;;;;;
+12260;CUNEIFORM SIGN NISAG;Lo;0;L;;;;;N;;;;;
+12261;CUNEIFORM SIGN NU;Lo;0;L;;;;;N;;;;;
+12262;CUNEIFORM SIGN NU11;Lo;0;L;;;;;N;;;;;
+12263;CUNEIFORM SIGN NUN;Lo;0;L;;;;;N;;;;;
+12264;CUNEIFORM SIGN NUN LAGAR TIMES GAR;Lo;0;L;;;;;N;;;;;
+12265;CUNEIFORM SIGN NUN LAGAR TIMES MASH;Lo;0;L;;;;;N;;;;;
+12266;CUNEIFORM SIGN NUN LAGAR TIMES SAL;Lo;0;L;;;;;N;;;;;
+12267;CUNEIFORM SIGN NUN LAGAR TIMES SAL OVER NUN LAGAR TIMES SAL;Lo;0;L;;;;;N;;;;;
+12268;CUNEIFORM SIGN NUN LAGAR TIMES USH;Lo;0;L;;;;;N;;;;;
+12269;CUNEIFORM SIGN NUN TENU;Lo;0;L;;;;;N;;;;;
+1226A;CUNEIFORM SIGN NUN OVER NUN;Lo;0;L;;;;;N;;;;;
+1226B;CUNEIFORM SIGN NUN CROSSING NUN;Lo;0;L;;;;;N;;;;;
+1226C;CUNEIFORM SIGN NUN CROSSING NUN LAGAR OVER LAGAR;Lo;0;L;;;;;N;;;;;
+1226D;CUNEIFORM SIGN NUNUZ;Lo;0;L;;;;;N;;;;;
+1226E;CUNEIFORM SIGN NUNUZ AB2 TIMES ASHGAB;Lo;0;L;;;;;N;;;;;
+1226F;CUNEIFORM SIGN NUNUZ AB2 TIMES BI;Lo;0;L;;;;;N;;;;;
+12270;CUNEIFORM SIGN NUNUZ AB2 TIMES DUG;Lo;0;L;;;;;N;;;;;
+12271;CUNEIFORM SIGN NUNUZ AB2 TIMES GUD;Lo;0;L;;;;;N;;;;;
+12272;CUNEIFORM SIGN NUNUZ AB2 TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+12273;CUNEIFORM SIGN NUNUZ AB2 TIMES KAD3;Lo;0;L;;;;;N;;;;;
+12274;CUNEIFORM SIGN NUNUZ AB2 TIMES LA;Lo;0;L;;;;;N;;;;;
+12275;CUNEIFORM SIGN NUNUZ AB2 TIMES NE;Lo;0;L;;;;;N;;;;;
+12276;CUNEIFORM SIGN NUNUZ AB2 TIMES SILA3;Lo;0;L;;;;;N;;;;;
+12277;CUNEIFORM SIGN NUNUZ AB2 TIMES U2;Lo;0;L;;;;;N;;;;;
+12278;CUNEIFORM SIGN NUNUZ KISIM5 TIMES BI;Lo;0;L;;;;;N;;;;;
+12279;CUNEIFORM SIGN NUNUZ KISIM5 TIMES BI U;Lo;0;L;;;;;N;;;;;
+1227A;CUNEIFORM SIGN PA;Lo;0;L;;;;;N;;;;;
+1227B;CUNEIFORM SIGN PAD;Lo;0;L;;;;;N;;;;;
+1227C;CUNEIFORM SIGN PAN;Lo;0;L;;;;;N;;;;;
+1227D;CUNEIFORM SIGN PAP;Lo;0;L;;;;;N;;;;;
+1227E;CUNEIFORM SIGN PESH2;Lo;0;L;;;;;N;;;;;
+1227F;CUNEIFORM SIGN PI;Lo;0;L;;;;;N;;;;;
+12280;CUNEIFORM SIGN PI TIMES A;Lo;0;L;;;;;N;;;;;
+12281;CUNEIFORM SIGN PI TIMES AB;Lo;0;L;;;;;N;;;;;
+12282;CUNEIFORM SIGN PI TIMES BI;Lo;0;L;;;;;N;;;;;
+12283;CUNEIFORM SIGN PI TIMES BU;Lo;0;L;;;;;N;;;;;
+12284;CUNEIFORM SIGN PI TIMES E;Lo;0;L;;;;;N;;;;;
+12285;CUNEIFORM SIGN PI TIMES I;Lo;0;L;;;;;N;;;;;
+12286;CUNEIFORM SIGN PI TIMES IB;Lo;0;L;;;;;N;;;;;
+12287;CUNEIFORM SIGN PI TIMES U;Lo;0;L;;;;;N;;;;;
+12288;CUNEIFORM SIGN PI TIMES U2;Lo;0;L;;;;;N;;;;;
+12289;CUNEIFORM SIGN PI CROSSING PI;Lo;0;L;;;;;N;;;;;
+1228A;CUNEIFORM SIGN PIRIG;Lo;0;L;;;;;N;;;;;
+1228B;CUNEIFORM SIGN PIRIG TIMES KAL;Lo;0;L;;;;;N;;;;;
+1228C;CUNEIFORM SIGN PIRIG TIMES UD;Lo;0;L;;;;;N;;;;;
+1228D;CUNEIFORM SIGN PIRIG TIMES ZA;Lo;0;L;;;;;N;;;;;
+1228E;CUNEIFORM SIGN PIRIG OPPOSING PIRIG;Lo;0;L;;;;;N;;;;;
+1228F;CUNEIFORM SIGN RA;Lo;0;L;;;;;N;;;;;
+12290;CUNEIFORM SIGN RAB;Lo;0;L;;;;;N;;;;;
+12291;CUNEIFORM SIGN RI;Lo;0;L;;;;;N;;;;;
+12292;CUNEIFORM SIGN RU;Lo;0;L;;;;;N;;;;;
+12293;CUNEIFORM SIGN SA;Lo;0;L;;;;;N;;;;;
+12294;CUNEIFORM SIGN SAG NUTILLU;Lo;0;L;;;;;N;;;;;
+12295;CUNEIFORM SIGN SAG;Lo;0;L;;;;;N;;;;;
+12296;CUNEIFORM SIGN SAG TIMES A;Lo;0;L;;;;;N;;;;;
+12297;CUNEIFORM SIGN SAG TIMES DU;Lo;0;L;;;;;N;;;;;
+12298;CUNEIFORM SIGN SAG TIMES DUB;Lo;0;L;;;;;N;;;;;
+12299;CUNEIFORM SIGN SAG TIMES HA;Lo;0;L;;;;;N;;;;;
+1229A;CUNEIFORM SIGN SAG TIMES KAK;Lo;0;L;;;;;N;;;;;
+1229B;CUNEIFORM SIGN SAG TIMES KUR;Lo;0;L;;;;;N;;;;;
+1229C;CUNEIFORM SIGN SAG TIMES LUM;Lo;0;L;;;;;N;;;;;
+1229D;CUNEIFORM SIGN SAG TIMES MI;Lo;0;L;;;;;N;;;;;
+1229E;CUNEIFORM SIGN SAG TIMES NUN;Lo;0;L;;;;;N;;;;;
+1229F;CUNEIFORM SIGN SAG TIMES SAL;Lo;0;L;;;;;N;;;;;
+122A0;CUNEIFORM SIGN SAG TIMES SHID;Lo;0;L;;;;;N;;;;;
+122A1;CUNEIFORM SIGN SAG TIMES TAB;Lo;0;L;;;;;N;;;;;
+122A2;CUNEIFORM SIGN SAG TIMES U2;Lo;0;L;;;;;N;;;;;
+122A3;CUNEIFORM SIGN SAG TIMES UB;Lo;0;L;;;;;N;;;;;
+122A4;CUNEIFORM SIGN SAG TIMES UM;Lo;0;L;;;;;N;;;;;
+122A5;CUNEIFORM SIGN SAG TIMES UR;Lo;0;L;;;;;N;;;;;
+122A6;CUNEIFORM SIGN SAG TIMES USH;Lo;0;L;;;;;N;;;;;
+122A7;CUNEIFORM SIGN SAG OVER SAG;Lo;0;L;;;;;N;;;;;
+122A8;CUNEIFORM SIGN SAG GUNU;Lo;0;L;;;;;N;;;;;
+122A9;CUNEIFORM SIGN SAL;Lo;0;L;;;;;N;;;;;
+122AA;CUNEIFORM SIGN SAL LAGAB TIMES ASH2;Lo;0;L;;;;;N;;;;;
+122AB;CUNEIFORM SIGN SANGA2;Lo;0;L;;;;;N;;;;;
+122AC;CUNEIFORM SIGN SAR;Lo;0;L;;;;;N;;;;;
+122AD;CUNEIFORM SIGN SHA;Lo;0;L;;;;;N;;;;;
+122AE;CUNEIFORM SIGN SHA3;Lo;0;L;;;;;N;;;;;
+122AF;CUNEIFORM SIGN SHA3 TIMES A;Lo;0;L;;;;;N;;;;;
+122B0;CUNEIFORM SIGN SHA3 TIMES BAD;Lo;0;L;;;;;N;;;;;
+122B1;CUNEIFORM SIGN SHA3 TIMES GISH;Lo;0;L;;;;;N;;;;;
+122B2;CUNEIFORM SIGN SHA3 TIMES NE;Lo;0;L;;;;;N;;;;;
+122B3;CUNEIFORM SIGN SHA3 TIMES SHU2;Lo;0;L;;;;;N;;;;;
+122B4;CUNEIFORM SIGN SHA3 TIMES TUR;Lo;0;L;;;;;N;;;;;
+122B5;CUNEIFORM SIGN SHA3 TIMES U;Lo;0;L;;;;;N;;;;;
+122B6;CUNEIFORM SIGN SHA3 TIMES U PLUS A;Lo;0;L;;;;;N;;;;;
+122B7;CUNEIFORM SIGN SHA6;Lo;0;L;;;;;N;;;;;
+122B8;CUNEIFORM SIGN SHAB6;Lo;0;L;;;;;N;;;;;
+122B9;CUNEIFORM SIGN SHAR2;Lo;0;L;;;;;N;;;;;
+122BA;CUNEIFORM SIGN SHE;Lo;0;L;;;;;N;;;;;
+122BB;CUNEIFORM SIGN SHE HU;Lo;0;L;;;;;N;;;;;
+122BC;CUNEIFORM SIGN SHE OVER SHE GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;;
+122BD;CUNEIFORM SIGN SHE OVER SHE TAB OVER TAB GAR OVER GAR;Lo;0;L;;;;;N;;;;;
+122BE;CUNEIFORM SIGN SHEG9;Lo;0;L;;;;;N;;;;;
+122BF;CUNEIFORM SIGN SHEN;Lo;0;L;;;;;N;;;;;
+122C0;CUNEIFORM SIGN SHESH;Lo;0;L;;;;;N;;;;;
+122C1;CUNEIFORM SIGN SHESH2;Lo;0;L;;;;;N;;;;;
+122C2;CUNEIFORM SIGN SHESHLAM;Lo;0;L;;;;;N;;;;;
+122C3;CUNEIFORM SIGN SHID;Lo;0;L;;;;;N;;;;;
+122C4;CUNEIFORM SIGN SHID TIMES A;Lo;0;L;;;;;N;;;;;
+122C5;CUNEIFORM SIGN SHID TIMES IM;Lo;0;L;;;;;N;;;;;
+122C6;CUNEIFORM SIGN SHIM;Lo;0;L;;;;;N;;;;;
+122C7;CUNEIFORM SIGN SHIM TIMES A;Lo;0;L;;;;;N;;;;;
+122C8;CUNEIFORM SIGN SHIM TIMES BAL;Lo;0;L;;;;;N;;;;;
+122C9;CUNEIFORM SIGN SHIM TIMES BULUG;Lo;0;L;;;;;N;;;;;
+122CA;CUNEIFORM SIGN SHIM TIMES DIN;Lo;0;L;;;;;N;;;;;
+122CB;CUNEIFORM SIGN SHIM TIMES GAR;Lo;0;L;;;;;N;;;;;
+122CC;CUNEIFORM SIGN SHIM TIMES IGI;Lo;0;L;;;;;N;;;;;
+122CD;CUNEIFORM SIGN SHIM TIMES IGI GUNU;Lo;0;L;;;;;N;;;;;
+122CE;CUNEIFORM SIGN SHIM TIMES KUSHU2;Lo;0;L;;;;;N;;;;;
+122CF;CUNEIFORM SIGN SHIM TIMES LUL;Lo;0;L;;;;;N;;;;;
+122D0;CUNEIFORM SIGN SHIM TIMES MUG;Lo;0;L;;;;;N;;;;;
+122D1;CUNEIFORM SIGN SHIM TIMES SAL;Lo;0;L;;;;;N;;;;;
+122D2;CUNEIFORM SIGN SHINIG;Lo;0;L;;;;;N;;;;;
+122D3;CUNEIFORM SIGN SHIR;Lo;0;L;;;;;N;;;;;
+122D4;CUNEIFORM SIGN SHIR TENU;Lo;0;L;;;;;N;;;;;
+122D5;CUNEIFORM SIGN SHIR OVER SHIR BUR OVER BUR;Lo;0;L;;;;;N;;;;;
+122D6;CUNEIFORM SIGN SHITA;Lo;0;L;;;;;N;;;;;
+122D7;CUNEIFORM SIGN SHU;Lo;0;L;;;;;N;;;;;
+122D8;CUNEIFORM SIGN SHU OVER INVERTED SHU;Lo;0;L;;;;;N;;;;;
+122D9;CUNEIFORM SIGN SHU2;Lo;0;L;;;;;N;;;;;
+122DA;CUNEIFORM SIGN SHUBUR;Lo;0;L;;;;;N;;;;;
+122DB;CUNEIFORM SIGN SI;Lo;0;L;;;;;N;;;;;
+122DC;CUNEIFORM SIGN SI GUNU;Lo;0;L;;;;;N;;;;;
+122DD;CUNEIFORM SIGN SIG;Lo;0;L;;;;;N;;;;;
+122DE;CUNEIFORM SIGN SIG4;Lo;0;L;;;;;N;;;;;
+122DF;CUNEIFORM SIGN SIG4 OVER SIG4 SHU2;Lo;0;L;;;;;N;;;;;
+122E0;CUNEIFORM SIGN SIK2;Lo;0;L;;;;;N;;;;;
+122E1;CUNEIFORM SIGN SILA3;Lo;0;L;;;;;N;;;;;
+122E2;CUNEIFORM SIGN SU;Lo;0;L;;;;;N;;;;;
+122E3;CUNEIFORM SIGN SU OVER SU;Lo;0;L;;;;;N;;;;;
+122E4;CUNEIFORM SIGN SUD;Lo;0;L;;;;;N;;;;;
+122E5;CUNEIFORM SIGN SUD2;Lo;0;L;;;;;N;;;;;
+122E6;CUNEIFORM SIGN SUHUR;Lo;0;L;;;;;N;;;;;
+122E7;CUNEIFORM SIGN SUM;Lo;0;L;;;;;N;;;;;
+122E8;CUNEIFORM SIGN SUMASH;Lo;0;L;;;;;N;;;;;
+122E9;CUNEIFORM SIGN SUR;Lo;0;L;;;;;N;;;;;
+122EA;CUNEIFORM SIGN SUR9;Lo;0;L;;;;;N;;;;;
+122EB;CUNEIFORM SIGN TA;Lo;0;L;;;;;N;;;;;
+122EC;CUNEIFORM SIGN TA ASTERISK;Lo;0;L;;;;;N;;;;;
+122ED;CUNEIFORM SIGN TA TIMES HI;Lo;0;L;;;;;N;;;;;
+122EE;CUNEIFORM SIGN TA TIMES MI;Lo;0;L;;;;;N;;;;;
+122EF;CUNEIFORM SIGN TA GUNU;Lo;0;L;;;;;N;;;;;
+122F0;CUNEIFORM SIGN TAB;Lo;0;L;;;;;N;;;;;
+122F1;CUNEIFORM SIGN TAB OVER TAB NI OVER NI DISH OVER DISH;Lo;0;L;;;;;N;;;;;
+122F2;CUNEIFORM SIGN TAB SQUARED;Lo;0;L;;;;;N;;;;;
+122F3;CUNEIFORM SIGN TAG;Lo;0;L;;;;;N;;;;;
+122F4;CUNEIFORM SIGN TAG TIMES BI;Lo;0;L;;;;;N;;;;;
+122F5;CUNEIFORM SIGN TAG TIMES GUD;Lo;0;L;;;;;N;;;;;
+122F6;CUNEIFORM SIGN TAG TIMES SHE;Lo;0;L;;;;;N;;;;;
+122F7;CUNEIFORM SIGN TAG TIMES SHU;Lo;0;L;;;;;N;;;;;
+122F8;CUNEIFORM SIGN TAG TIMES TUG2;Lo;0;L;;;;;N;;;;;
+122F9;CUNEIFORM SIGN TAG TIMES UD;Lo;0;L;;;;;N;;;;;
+122FA;CUNEIFORM SIGN TAK4;Lo;0;L;;;;;N;;;;;
+122FB;CUNEIFORM SIGN TAR;Lo;0;L;;;;;N;;;;;
+122FC;CUNEIFORM SIGN TE;Lo;0;L;;;;;N;;;;;
+122FD;CUNEIFORM SIGN TE GUNU;Lo;0;L;;;;;N;;;;;
+122FE;CUNEIFORM SIGN TI;Lo;0;L;;;;;N;;;;;
+122FF;CUNEIFORM SIGN TI TENU;Lo;0;L;;;;;N;;;;;
+12300;CUNEIFORM SIGN TIL;Lo;0;L;;;;;N;;;;;
+12301;CUNEIFORM SIGN TIR;Lo;0;L;;;;;N;;;;;
+12302;CUNEIFORM SIGN TIR TIMES TAK4;Lo;0;L;;;;;N;;;;;
+12303;CUNEIFORM SIGN TIR OVER TIR;Lo;0;L;;;;;N;;;;;
+12304;CUNEIFORM SIGN TIR OVER TIR GAD OVER GAD GAR OVER GAR;Lo;0;L;;;;;N;;;;;
+12305;CUNEIFORM SIGN TU;Lo;0;L;;;;;N;;;;;
+12306;CUNEIFORM SIGN TUG2;Lo;0;L;;;;;N;;;;;
+12307;CUNEIFORM SIGN TUK;Lo;0;L;;;;;N;;;;;
+12308;CUNEIFORM SIGN TUM;Lo;0;L;;;;;N;;;;;
+12309;CUNEIFORM SIGN TUR;Lo;0;L;;;;;N;;;;;
+1230A;CUNEIFORM SIGN TUR OVER TUR ZA OVER ZA;Lo;0;L;;;;;N;;;;;
+1230B;CUNEIFORM SIGN U;Lo;0;L;;;;;N;;;;;
+1230C;CUNEIFORM SIGN U GUD;Lo;0;L;;;;;N;;;;;
+1230D;CUNEIFORM SIGN U U U;Lo;0;L;;;;;N;;;;;
+1230E;CUNEIFORM SIGN U OVER U PA OVER PA GAR OVER GAR;Lo;0;L;;;;;N;;;;;
+1230F;CUNEIFORM SIGN U OVER U SUR OVER SUR;Lo;0;L;;;;;N;;;;;
+12310;CUNEIFORM SIGN U OVER U U REVERSED OVER U REVERSED;Lo;0;L;;;;;N;;;;;
+12311;CUNEIFORM SIGN U2;Lo;0;L;;;;;N;;;;;
+12312;CUNEIFORM SIGN UB;Lo;0;L;;;;;N;;;;;
+12313;CUNEIFORM SIGN UD;Lo;0;L;;;;;N;;;;;
+12314;CUNEIFORM SIGN UD KUSHU2;Lo;0;L;;;;;N;;;;;
+12315;CUNEIFORM SIGN UD TIMES BAD;Lo;0;L;;;;;N;;;;;
+12316;CUNEIFORM SIGN UD TIMES MI;Lo;0;L;;;;;N;;;;;
+12317;CUNEIFORM SIGN UD TIMES U PLUS U PLUS U;Lo;0;L;;;;;N;;;;;
+12318;CUNEIFORM SIGN UD TIMES U PLUS U PLUS U GUNU;Lo;0;L;;;;;N;;;;;
+12319;CUNEIFORM SIGN UD GUNU;Lo;0;L;;;;;N;;;;;
+1231A;CUNEIFORM SIGN UD SHESHIG;Lo;0;L;;;;;N;;;;;
+1231B;CUNEIFORM SIGN UD SHESHIG TIMES BAD;Lo;0;L;;;;;N;;;;;
+1231C;CUNEIFORM SIGN UDUG;Lo;0;L;;;;;N;;;;;
+1231D;CUNEIFORM SIGN UM;Lo;0;L;;;;;N;;;;;
+1231E;CUNEIFORM SIGN UM TIMES LAGAB;Lo;0;L;;;;;N;;;;;
+1231F;CUNEIFORM SIGN UM TIMES ME PLUS DA;Lo;0;L;;;;;N;;;;;
+12320;CUNEIFORM SIGN UM TIMES SHA3;Lo;0;L;;;;;N;;;;;
+12321;CUNEIFORM SIGN UM TIMES U;Lo;0;L;;;;;N;;;;;
+12322;CUNEIFORM SIGN UMBIN;Lo;0;L;;;;;N;;;;;
+12323;CUNEIFORM SIGN UMUM;Lo;0;L;;;;;N;;;;;
+12324;CUNEIFORM SIGN UMUM TIMES KASKAL;Lo;0;L;;;;;N;;;;;
+12325;CUNEIFORM SIGN UMUM TIMES PA;Lo;0;L;;;;;N;;;;;
+12326;CUNEIFORM SIGN UN;Lo;0;L;;;;;N;;;;;
+12327;CUNEIFORM SIGN UN GUNU;Lo;0;L;;;;;N;;;;;
+12328;CUNEIFORM SIGN UR;Lo;0;L;;;;;N;;;;;
+12329;CUNEIFORM SIGN UR CROSSING UR;Lo;0;L;;;;;N;;;;;
+1232A;CUNEIFORM SIGN UR SHESHIG;Lo;0;L;;;;;N;;;;;
+1232B;CUNEIFORM SIGN UR2;Lo;0;L;;;;;N;;;;;
+1232C;CUNEIFORM SIGN UR2 TIMES A PLUS HA;Lo;0;L;;;;;N;;;;;
+1232D;CUNEIFORM SIGN UR2 TIMES A PLUS NA;Lo;0;L;;;;;N;;;;;
+1232E;CUNEIFORM SIGN UR2 TIMES AL;Lo;0;L;;;;;N;;;;;
+1232F;CUNEIFORM SIGN UR2 TIMES HA;Lo;0;L;;;;;N;;;;;
+12330;CUNEIFORM SIGN UR2 TIMES NUN;Lo;0;L;;;;;N;;;;;
+12331;CUNEIFORM SIGN UR2 TIMES U2;Lo;0;L;;;;;N;;;;;
+12332;CUNEIFORM SIGN UR2 TIMES U2 PLUS ASH;Lo;0;L;;;;;N;;;;;
+12333;CUNEIFORM SIGN UR2 TIMES U2 PLUS BI;Lo;0;L;;;;;N;;;;;
+12334;CUNEIFORM SIGN UR4;Lo;0;L;;;;;N;;;;;
+12335;CUNEIFORM SIGN URI;Lo;0;L;;;;;N;;;;;
+12336;CUNEIFORM SIGN URI3;Lo;0;L;;;;;N;;;;;
+12337;CUNEIFORM SIGN URU;Lo;0;L;;;;;N;;;;;
+12338;CUNEIFORM SIGN URU TIMES A;Lo;0;L;;;;;N;;;;;
+12339;CUNEIFORM SIGN URU TIMES ASHGAB;Lo;0;L;;;;;N;;;;;
+1233A;CUNEIFORM SIGN URU TIMES BAR;Lo;0;L;;;;;N;;;;;
+1233B;CUNEIFORM SIGN URU TIMES DUN;Lo;0;L;;;;;N;;;;;
+1233C;CUNEIFORM SIGN URU TIMES GA;Lo;0;L;;;;;N;;;;;
+1233D;CUNEIFORM SIGN URU TIMES GAL;Lo;0;L;;;;;N;;;;;
+1233E;CUNEIFORM SIGN URU TIMES GAN2 TENU;Lo;0;L;;;;;N;;;;;
+1233F;CUNEIFORM SIGN URU TIMES GAR;Lo;0;L;;;;;N;;;;;
+12340;CUNEIFORM SIGN URU TIMES GU;Lo;0;L;;;;;N;;;;;
+12341;CUNEIFORM SIGN URU TIMES HA;Lo;0;L;;;;;N;;;;;
+12342;CUNEIFORM SIGN URU TIMES IGI;Lo;0;L;;;;;N;;;;;
+12343;CUNEIFORM SIGN URU TIMES IM;Lo;0;L;;;;;N;;;;;
+12344;CUNEIFORM SIGN URU TIMES ISH;Lo;0;L;;;;;N;;;;;
+12345;CUNEIFORM SIGN URU TIMES KI;Lo;0;L;;;;;N;;;;;
+12346;CUNEIFORM SIGN URU TIMES LUM;Lo;0;L;;;;;N;;;;;
+12347;CUNEIFORM SIGN URU TIMES MIN;Lo;0;L;;;;;N;;;;;
+12348;CUNEIFORM SIGN URU TIMES PA;Lo;0;L;;;;;N;;;;;
+12349;CUNEIFORM SIGN URU TIMES SHE;Lo;0;L;;;;;N;;;;;
+1234A;CUNEIFORM SIGN URU TIMES SIG4;Lo;0;L;;;;;N;;;;;
+1234B;CUNEIFORM SIGN URU TIMES TU;Lo;0;L;;;;;N;;;;;
+1234C;CUNEIFORM SIGN URU TIMES U PLUS GUD;Lo;0;L;;;;;N;;;;;
+1234D;CUNEIFORM SIGN URU TIMES UD;Lo;0;L;;;;;N;;;;;
+1234E;CUNEIFORM SIGN URU TIMES URUDA;Lo;0;L;;;;;N;;;;;
+1234F;CUNEIFORM SIGN URUDA;Lo;0;L;;;;;N;;;;;
+12350;CUNEIFORM SIGN URUDA TIMES U;Lo;0;L;;;;;N;;;;;
+12351;CUNEIFORM SIGN USH;Lo;0;L;;;;;N;;;;;
+12352;CUNEIFORM SIGN USH TIMES A;Lo;0;L;;;;;N;;;;;
+12353;CUNEIFORM SIGN USH TIMES KU;Lo;0;L;;;;;N;;;;;
+12354;CUNEIFORM SIGN USH TIMES KUR;Lo;0;L;;;;;N;;;;;
+12355;CUNEIFORM SIGN USH TIMES TAK4;Lo;0;L;;;;;N;;;;;
+12356;CUNEIFORM SIGN USHX;Lo;0;L;;;;;N;;;;;
+12357;CUNEIFORM SIGN USH2;Lo;0;L;;;;;N;;;;;
+12358;CUNEIFORM SIGN USHUMX;Lo;0;L;;;;;N;;;;;
+12359;CUNEIFORM SIGN UTUKI;Lo;0;L;;;;;N;;;;;
+1235A;CUNEIFORM SIGN UZ3;Lo;0;L;;;;;N;;;;;
+1235B;CUNEIFORM SIGN UZ3 TIMES KASKAL;Lo;0;L;;;;;N;;;;;
+1235C;CUNEIFORM SIGN UZU;Lo;0;L;;;;;N;;;;;
+1235D;CUNEIFORM SIGN ZA;Lo;0;L;;;;;N;;;;;
+1235E;CUNEIFORM SIGN ZA TENU;Lo;0;L;;;;;N;;;;;
+1235F;CUNEIFORM SIGN ZA SQUARED TIMES KUR;Lo;0;L;;;;;N;;;;;
+12360;CUNEIFORM SIGN ZAG;Lo;0;L;;;;;N;;;;;
+12361;CUNEIFORM SIGN ZAMX;Lo;0;L;;;;;N;;;;;
+12362;CUNEIFORM SIGN ZE2;Lo;0;L;;;;;N;;;;;
+12363;CUNEIFORM SIGN ZI;Lo;0;L;;;;;N;;;;;
+12364;CUNEIFORM SIGN ZI OVER ZI;Lo;0;L;;;;;N;;;;;
+12365;CUNEIFORM SIGN ZI3;Lo;0;L;;;;;N;;;;;
+12366;CUNEIFORM SIGN ZIB;Lo;0;L;;;;;N;;;;;
+12367;CUNEIFORM SIGN ZIB KABA TENU;Lo;0;L;;;;;N;;;;;
+12368;CUNEIFORM SIGN ZIG;Lo;0;L;;;;;N;;;;;
+12369;CUNEIFORM SIGN ZIZ2;Lo;0;L;;;;;N;;;;;
+1236A;CUNEIFORM SIGN ZU;Lo;0;L;;;;;N;;;;;
+1236B;CUNEIFORM SIGN ZU5;Lo;0;L;;;;;N;;;;;
+1236C;CUNEIFORM SIGN ZU5 TIMES A;Lo;0;L;;;;;N;;;;;
+1236D;CUNEIFORM SIGN ZUBUR;Lo;0;L;;;;;N;;;;;
+1236E;CUNEIFORM SIGN ZUM;Lo;0;L;;;;;N;;;;;
+12400;CUNEIFORM NUMERIC SIGN TWO ASH;Nl;0;L;;;;2;N;;;;;
+12401;CUNEIFORM NUMERIC SIGN THREE ASH;Nl;0;L;;;;3;N;;;;;
+12402;CUNEIFORM NUMERIC SIGN FOUR ASH;Nl;0;L;;;;4;N;;;;;
+12403;CUNEIFORM NUMERIC SIGN FIVE ASH;Nl;0;L;;;;5;N;;;;;
+12404;CUNEIFORM NUMERIC SIGN SIX ASH;Nl;0;L;;;;6;N;;;;;
+12405;CUNEIFORM NUMERIC SIGN SEVEN ASH;Nl;0;L;;;;7;N;;;;;
+12406;CUNEIFORM NUMERIC SIGN EIGHT ASH;Nl;0;L;;;;8;N;;;;;
+12407;CUNEIFORM NUMERIC SIGN NINE ASH;Nl;0;L;;;;9;N;;;;;
+12408;CUNEIFORM NUMERIC SIGN THREE DISH;Nl;0;L;;;;3;N;;;;;
+12409;CUNEIFORM NUMERIC SIGN FOUR DISH;Nl;0;L;;;;4;N;;;;;
+1240A;CUNEIFORM NUMERIC SIGN FIVE DISH;Nl;0;L;;;;5;N;;;;;
+1240B;CUNEIFORM NUMERIC SIGN SIX DISH;Nl;0;L;;;;6;N;;;;;
+1240C;CUNEIFORM NUMERIC SIGN SEVEN DISH;Nl;0;L;;;;7;N;;;;;
+1240D;CUNEIFORM NUMERIC SIGN EIGHT DISH;Nl;0;L;;;;8;N;;;;;
+1240E;CUNEIFORM NUMERIC SIGN NINE DISH;Nl;0;L;;;;9;N;;;;;
+1240F;CUNEIFORM NUMERIC SIGN FOUR U;Nl;0;L;;;;4;N;;;;;
+12410;CUNEIFORM NUMERIC SIGN FIVE U;Nl;0;L;;;;5;N;;;;;
+12411;CUNEIFORM NUMERIC SIGN SIX U;Nl;0;L;;;;6;N;;;;;
+12412;CUNEIFORM NUMERIC SIGN SEVEN U;Nl;0;L;;;;7;N;;;;;
+12413;CUNEIFORM NUMERIC SIGN EIGHT U;Nl;0;L;;;;8;N;;;;;
+12414;CUNEIFORM NUMERIC SIGN NINE U;Nl;0;L;;;;9;N;;;;;
+12415;CUNEIFORM NUMERIC SIGN ONE GESH2;Nl;0;L;;;;1;N;;;;;
+12416;CUNEIFORM NUMERIC SIGN TWO GESH2;Nl;0;L;;;;2;N;;;;;
+12417;CUNEIFORM NUMERIC SIGN THREE GESH2;Nl;0;L;;;;3;N;;;;;
+12418;CUNEIFORM NUMERIC SIGN FOUR GESH2;Nl;0;L;;;;4;N;;;;;
+12419;CUNEIFORM NUMERIC SIGN FIVE GESH2;Nl;0;L;;;;5;N;;;;;
+1241A;CUNEIFORM NUMERIC SIGN SIX GESH2;Nl;0;L;;;;6;N;;;;;
+1241B;CUNEIFORM NUMERIC SIGN SEVEN GESH2;Nl;0;L;;;;7;N;;;;;
+1241C;CUNEIFORM NUMERIC SIGN EIGHT GESH2;Nl;0;L;;;;8;N;;;;;
+1241D;CUNEIFORM NUMERIC SIGN NINE GESH2;Nl;0;L;;;;9;N;;;;;
+1241E;CUNEIFORM NUMERIC SIGN ONE GESHU;Nl;0;L;;;;1;N;;;;;
+1241F;CUNEIFORM NUMERIC SIGN TWO GESHU;Nl;0;L;;;;2;N;;;;;
+12420;CUNEIFORM NUMERIC SIGN THREE GESHU;Nl;0;L;;;;3;N;;;;;
+12421;CUNEIFORM NUMERIC SIGN FOUR GESHU;Nl;0;L;;;;4;N;;;;;
+12422;CUNEIFORM NUMERIC SIGN FIVE GESHU;Nl;0;L;;;;5;N;;;;;
+12423;CUNEIFORM NUMERIC SIGN TWO SHAR2;Nl;0;L;;;;2;N;;;;;
+12424;CUNEIFORM NUMERIC SIGN THREE SHAR2;Nl;0;L;;;;3;N;;;;;
+12425;CUNEIFORM NUMERIC SIGN THREE SHAR2 VARIANT FORM;Nl;0;L;;;;3;N;;;;;
+12426;CUNEIFORM NUMERIC SIGN FOUR SHAR2;Nl;0;L;;;;4;N;;;;;
+12427;CUNEIFORM NUMERIC SIGN FIVE SHAR2;Nl;0;L;;;;5;N;;;;;
+12428;CUNEIFORM NUMERIC SIGN SIX SHAR2;Nl;0;L;;;;6;N;;;;;
+12429;CUNEIFORM NUMERIC SIGN SEVEN SHAR2;Nl;0;L;;;;7;N;;;;;
+1242A;CUNEIFORM NUMERIC SIGN EIGHT SHAR2;Nl;0;L;;;;8;N;;;;;
+1242B;CUNEIFORM NUMERIC SIGN NINE SHAR2;Nl;0;L;;;;9;N;;;;;
+1242C;CUNEIFORM NUMERIC SIGN ONE SHARU;Nl;0;L;;;;1;N;;;;;
+1242D;CUNEIFORM NUMERIC SIGN TWO SHARU;Nl;0;L;;;;2;N;;;;;
+1242E;CUNEIFORM NUMERIC SIGN THREE SHARU;Nl;0;L;;;;3;N;;;;;
+1242F;CUNEIFORM NUMERIC SIGN THREE SHARU VARIANT FORM;Nl;0;L;;;;3;N;;;;;
+12430;CUNEIFORM NUMERIC SIGN FOUR SHARU;Nl;0;L;;;;4;N;;;;;
+12431;CUNEIFORM NUMERIC SIGN FIVE SHARU;Nl;0;L;;;;5;N;;;;;
+12432;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS DISH;Nl;0;L;;;;;N;;;;;
+12433;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS MIN;Nl;0;L;;;;;N;;;;;
+12434;CUNEIFORM NUMERIC SIGN ONE BURU;Nl;0;L;;;;1;N;;;;;
+12435;CUNEIFORM NUMERIC SIGN TWO BURU;Nl;0;L;;;;2;N;;;;;
+12436;CUNEIFORM NUMERIC SIGN THREE BURU;Nl;0;L;;;;3;N;;;;;
+12437;CUNEIFORM NUMERIC SIGN THREE BURU VARIANT FORM;Nl;0;L;;;;3;N;;;;;
+12438;CUNEIFORM NUMERIC SIGN FOUR BURU;Nl;0;L;;;;4;N;;;;;
+12439;CUNEIFORM NUMERIC SIGN FIVE BURU;Nl;0;L;;;;5;N;;;;;
+1243A;CUNEIFORM NUMERIC SIGN THREE VARIANT FORM ESH16;Nl;0;L;;;;3;N;;;;;
+1243B;CUNEIFORM NUMERIC SIGN THREE VARIANT FORM ESH21;Nl;0;L;;;;3;N;;;;;
+1243C;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU;Nl;0;L;;;;4;N;;;;;
+1243D;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU4;Nl;0;L;;;;4;N;;;;;
+1243E;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU A;Nl;0;L;;;;4;N;;;;;
+1243F;CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU B;Nl;0;L;;;;4;N;;;;;
+12440;CUNEIFORM NUMERIC SIGN SIX VARIANT FORM ASH9;Nl;0;L;;;;6;N;;;;;
+12441;CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN3;Nl;0;L;;;;7;N;;;;;
+12442;CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN A;Nl;0;L;;;;7;N;;;;;
+12443;CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN B;Nl;0;L;;;;7;N;;;;;
+12444;CUNEIFORM NUMERIC SIGN EIGHT VARIANT FORM USSU;Nl;0;L;;;;8;N;;;;;
+12445;CUNEIFORM NUMERIC SIGN EIGHT VARIANT FORM USSU3;Nl;0;L;;;;8;N;;;;;
+12446;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU;Nl;0;L;;;;9;N;;;;;
+12447;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU3;Nl;0;L;;;;9;N;;;;;
+12448;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU4;Nl;0;L;;;;9;N;;;;;
+12449;CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU A;Nl;0;L;;;;9;N;;;;;
+1244A;CUNEIFORM NUMERIC SIGN TWO ASH TENU;Nl;0;L;;;;2;N;;;;;
+1244B;CUNEIFORM NUMERIC SIGN THREE ASH TENU;Nl;0;L;;;;3;N;;;;;
+1244C;CUNEIFORM NUMERIC SIGN FOUR ASH TENU;Nl;0;L;;;;4;N;;;;;
+1244D;CUNEIFORM NUMERIC SIGN FIVE ASH TENU;Nl;0;L;;;;5;N;;;;;
+1244E;CUNEIFORM NUMERIC SIGN SIX ASH TENU;Nl;0;L;;;;6;N;;;;;
+1244F;CUNEIFORM NUMERIC SIGN ONE BAN2;Nl;0;L;;;;1;N;;;;;
+12450;CUNEIFORM NUMERIC SIGN TWO BAN2;Nl;0;L;;;;2;N;;;;;
+12451;CUNEIFORM NUMERIC SIGN THREE BAN2;Nl;0;L;;;;3;N;;;;;
+12452;CUNEIFORM NUMERIC SIGN FOUR BAN2;Nl;0;L;;;;4;N;;;;;
+12453;CUNEIFORM NUMERIC SIGN FOUR BAN2 VARIANT FORM;Nl;0;L;;;;4;N;;;;;
+12454;CUNEIFORM NUMERIC SIGN FIVE BAN2;Nl;0;L;;;;5;N;;;;;
+12455;CUNEIFORM NUMERIC SIGN FIVE BAN2 VARIANT FORM;Nl;0;L;;;;5;N;;;;;
+12456;CUNEIFORM NUMERIC SIGN NIGIDAMIN;Nl;0;L;;;;;N;;;;;
+12457;CUNEIFORM NUMERIC SIGN NIGIDAESH;Nl;0;L;;;;;N;;;;;
+12458;CUNEIFORM NUMERIC SIGN ONE ESHE3;Nl;0;L;;;;1;N;;;;;
+12459;CUNEIFORM NUMERIC SIGN TWO ESHE3;Nl;0;L;;;;2;N;;;;;
+1245A;CUNEIFORM NUMERIC SIGN ONE THIRD DISH;Nl;0;L;;;;1/3;N;;;;;
+1245B;CUNEIFORM NUMERIC SIGN TWO THIRDS DISH;Nl;0;L;;;;2/3;N;;;;;
+1245C;CUNEIFORM NUMERIC SIGN FIVE SIXTHS DISH;Nl;0;L;;;;5/6;N;;;;;
+1245D;CUNEIFORM NUMERIC SIGN ONE THIRD VARIANT FORM A;Nl;0;L;;;;1/3;N;;;;;
+1245E;CUNEIFORM NUMERIC SIGN TWO THIRDS VARIANT FORM A;Nl;0;L;;;;2/3;N;;;;;
+1245F;CUNEIFORM NUMERIC SIGN ONE EIGHTH ASH;Nl;0;L;;;;1/8;N;;;;;
+12460;CUNEIFORM NUMERIC SIGN ONE QUARTER ASH;Nl;0;L;;;;1/4;N;;;;;
+12461;CUNEIFORM NUMERIC SIGN OLD ASSYRIAN ONE SIXTH;Nl;0;L;;;;1/6;N;;;;;
+12462;CUNEIFORM NUMERIC SIGN OLD ASSYRIAN ONE QUARTER;Nl;0;L;;;;1/4;N;;;;;
+12470;CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER;Po;0;L;;;;;N;;;;;
+12471;CUNEIFORM PUNCTUATION SIGN VERTICAL COLON;Po;0;L;;;;;N;;;;;
+12472;CUNEIFORM PUNCTUATION SIGN DIAGONAL COLON;Po;0;L;;;;;N;;;;;
+12473;CUNEIFORM PUNCTUATION SIGN DIAGONAL TRICOLON;Po;0;L;;;;;N;;;;;
+1D000;BYZANTINE MUSICAL SYMBOL PSILI;So;0;L;;;;;N;;;;;
+1D001;BYZANTINE MUSICAL SYMBOL DASEIA;So;0;L;;;;;N;;;;;
+1D002;BYZANTINE MUSICAL SYMBOL PERISPOMENI;So;0;L;;;;;N;;;;;
+1D003;BYZANTINE MUSICAL SYMBOL OXEIA EKFONITIKON;So;0;L;;;;;N;;;;;
+1D004;BYZANTINE MUSICAL SYMBOL OXEIA DIPLI;So;0;L;;;;;N;;;;;
+1D005;BYZANTINE MUSICAL SYMBOL VAREIA EKFONITIKON;So;0;L;;;;;N;;;;;
+1D006;BYZANTINE MUSICAL SYMBOL VAREIA DIPLI;So;0;L;;;;;N;;;;;
+1D007;BYZANTINE MUSICAL SYMBOL KATHISTI;So;0;L;;;;;N;;;;;
+1D008;BYZANTINE MUSICAL SYMBOL SYRMATIKI;So;0;L;;;;;N;;;;;
+1D009;BYZANTINE MUSICAL SYMBOL PARAKLITIKI;So;0;L;;;;;N;;;;;
+1D00A;BYZANTINE MUSICAL SYMBOL YPOKRISIS;So;0;L;;;;;N;;;;;
+1D00B;BYZANTINE MUSICAL SYMBOL YPOKRISIS DIPLI;So;0;L;;;;;N;;;;;
+1D00C;BYZANTINE MUSICAL SYMBOL KREMASTI;So;0;L;;;;;N;;;;;
+1D00D;BYZANTINE MUSICAL SYMBOL APESO EKFONITIKON;So;0;L;;;;;N;;;;;
+1D00E;BYZANTINE MUSICAL SYMBOL EXO EKFONITIKON;So;0;L;;;;;N;;;;;
+1D00F;BYZANTINE MUSICAL SYMBOL TELEIA;So;0;L;;;;;N;;;;;
+1D010;BYZANTINE MUSICAL SYMBOL KENTIMATA;So;0;L;;;;;N;;;;;
+1D011;BYZANTINE MUSICAL SYMBOL APOSTROFOS;So;0;L;;;;;N;;;;;
+1D012;BYZANTINE MUSICAL SYMBOL APOSTROFOS DIPLI;So;0;L;;;;;N;;;;;
+1D013;BYZANTINE MUSICAL SYMBOL SYNEVMA;So;0;L;;;;;N;;;;;
+1D014;BYZANTINE MUSICAL SYMBOL THITA;So;0;L;;;;;N;;;;;
+1D015;BYZANTINE MUSICAL SYMBOL OLIGON ARCHAION;So;0;L;;;;;N;;;;;
+1D016;BYZANTINE MUSICAL SYMBOL GORGON ARCHAION;So;0;L;;;;;N;;;;;
+1D017;BYZANTINE MUSICAL SYMBOL PSILON;So;0;L;;;;;N;;;;;
+1D018;BYZANTINE MUSICAL SYMBOL CHAMILON;So;0;L;;;;;N;;;;;
+1D019;BYZANTINE MUSICAL SYMBOL VATHY;So;0;L;;;;;N;;;;;
+1D01A;BYZANTINE MUSICAL SYMBOL ISON ARCHAION;So;0;L;;;;;N;;;;;
+1D01B;BYZANTINE MUSICAL SYMBOL KENTIMA ARCHAION;So;0;L;;;;;N;;;;;
+1D01C;BYZANTINE MUSICAL SYMBOL KENTIMATA ARCHAION;So;0;L;;;;;N;;;;;
+1D01D;BYZANTINE MUSICAL SYMBOL SAXIMATA;So;0;L;;;;;N;;;;;
+1D01E;BYZANTINE MUSICAL SYMBOL PARICHON;So;0;L;;;;;N;;;;;
+1D01F;BYZANTINE MUSICAL SYMBOL STAVROS APODEXIA;So;0;L;;;;;N;;;;;
+1D020;BYZANTINE MUSICAL SYMBOL OXEIAI ARCHAION;So;0;L;;;;;N;;;;;
+1D021;BYZANTINE MUSICAL SYMBOL VAREIAI ARCHAION;So;0;L;;;;;N;;;;;
+1D022;BYZANTINE MUSICAL SYMBOL APODERMA ARCHAION;So;0;L;;;;;N;;;;;
+1D023;BYZANTINE MUSICAL SYMBOL APOTHEMA;So;0;L;;;;;N;;;;;
+1D024;BYZANTINE MUSICAL SYMBOL KLASMA;So;0;L;;;;;N;;;;;
+1D025;BYZANTINE MUSICAL SYMBOL REVMA;So;0;L;;;;;N;;;;;
+1D026;BYZANTINE MUSICAL SYMBOL PIASMA ARCHAION;So;0;L;;;;;N;;;;;
+1D027;BYZANTINE MUSICAL SYMBOL TINAGMA;So;0;L;;;;;N;;;;;
+1D028;BYZANTINE MUSICAL SYMBOL ANATRICHISMA;So;0;L;;;;;N;;;;;
+1D029;BYZANTINE MUSICAL SYMBOL SEISMA;So;0;L;;;;;N;;;;;
+1D02A;BYZANTINE MUSICAL SYMBOL SYNAGMA ARCHAION;So;0;L;;;;;N;;;;;
+1D02B;BYZANTINE MUSICAL SYMBOL SYNAGMA META STAVROU;So;0;L;;;;;N;;;;;
+1D02C;BYZANTINE MUSICAL SYMBOL OYRANISMA ARCHAION;So;0;L;;;;;N;;;;;
+1D02D;BYZANTINE MUSICAL SYMBOL THEMA;So;0;L;;;;;N;;;;;
+1D02E;BYZANTINE MUSICAL SYMBOL LEMOI;So;0;L;;;;;N;;;;;
+1D02F;BYZANTINE MUSICAL SYMBOL DYO;So;0;L;;;;;N;;;;;
+1D030;BYZANTINE MUSICAL SYMBOL TRIA;So;0;L;;;;;N;;;;;
+1D031;BYZANTINE MUSICAL SYMBOL TESSERA;So;0;L;;;;;N;;;;;
+1D032;BYZANTINE MUSICAL SYMBOL KRATIMATA;So;0;L;;;;;N;;;;;
+1D033;BYZANTINE MUSICAL SYMBOL APESO EXO NEO;So;0;L;;;;;N;;;;;
+1D034;BYZANTINE MUSICAL SYMBOL FTHORA ARCHAION;So;0;L;;;;;N;;;;;
+1D035;BYZANTINE MUSICAL SYMBOL IMIFTHORA;So;0;L;;;;;N;;;;;
+1D036;BYZANTINE MUSICAL SYMBOL TROMIKON ARCHAION;So;0;L;;;;;N;;;;;
+1D037;BYZANTINE MUSICAL SYMBOL KATAVA TROMIKON;So;0;L;;;;;N;;;;;
+1D038;BYZANTINE MUSICAL SYMBOL PELASTON;So;0;L;;;;;N;;;;;
+1D039;BYZANTINE MUSICAL SYMBOL PSIFISTON;So;0;L;;;;;N;;;;;
+1D03A;BYZANTINE MUSICAL SYMBOL KONTEVMA;So;0;L;;;;;N;;;;;
+1D03B;BYZANTINE MUSICAL SYMBOL CHOREVMA ARCHAION;So;0;L;;;;;N;;;;;
+1D03C;BYZANTINE MUSICAL SYMBOL RAPISMA;So;0;L;;;;;N;;;;;
+1D03D;BYZANTINE MUSICAL SYMBOL PARAKALESMA ARCHAION;So;0;L;;;;;N;;;;;
+1D03E;BYZANTINE MUSICAL SYMBOL PARAKLITIKI ARCHAION;So;0;L;;;;;N;;;;;
+1D03F;BYZANTINE MUSICAL SYMBOL ICHADIN;So;0;L;;;;;N;;;;;
+1D040;BYZANTINE MUSICAL SYMBOL NANA;So;0;L;;;;;N;;;;;
+1D041;BYZANTINE MUSICAL SYMBOL PETASMA;So;0;L;;;;;N;;;;;
+1D042;BYZANTINE MUSICAL SYMBOL KONTEVMA ALLO;So;0;L;;;;;N;;;;;
+1D043;BYZANTINE MUSICAL SYMBOL TROMIKON ALLO;So;0;L;;;;;N;;;;;
+1D044;BYZANTINE MUSICAL SYMBOL STRAGGISMATA;So;0;L;;;;;N;;;;;
+1D045;BYZANTINE MUSICAL SYMBOL GRONTHISMATA;So;0;L;;;;;N;;;;;
+1D046;BYZANTINE MUSICAL SYMBOL ISON NEO;So;0;L;;;;;N;;;;;
+1D047;BYZANTINE MUSICAL SYMBOL OLIGON NEO;So;0;L;;;;;N;;;;;
+1D048;BYZANTINE MUSICAL SYMBOL OXEIA NEO;So;0;L;;;;;N;;;;;
+1D049;BYZANTINE MUSICAL SYMBOL PETASTI;So;0;L;;;;;N;;;;;
+1D04A;BYZANTINE MUSICAL SYMBOL KOUFISMA;So;0;L;;;;;N;;;;;
+1D04B;BYZANTINE MUSICAL SYMBOL PETASTOKOUFISMA;So;0;L;;;;;N;;;;;
+1D04C;BYZANTINE MUSICAL SYMBOL KRATIMOKOUFISMA;So;0;L;;;;;N;;;;;
+1D04D;BYZANTINE MUSICAL SYMBOL PELASTON NEO;So;0;L;;;;;N;;;;;
+1D04E;BYZANTINE MUSICAL SYMBOL KENTIMATA NEO ANO;So;0;L;;;;;N;;;;;
+1D04F;BYZANTINE MUSICAL SYMBOL KENTIMA NEO ANO;So;0;L;;;;;N;;;;;
+1D050;BYZANTINE MUSICAL SYMBOL YPSILI;So;0;L;;;;;N;;;;;
+1D051;BYZANTINE MUSICAL SYMBOL APOSTROFOS NEO;So;0;L;;;;;N;;;;;
+1D052;BYZANTINE MUSICAL SYMBOL APOSTROFOI SYNDESMOS NEO;So;0;L;;;;;N;;;;;
+1D053;BYZANTINE MUSICAL SYMBOL YPORROI;So;0;L;;;;;N;;;;;
+1D054;BYZANTINE MUSICAL SYMBOL KRATIMOYPORROON;So;0;L;;;;;N;;;;;
+1D055;BYZANTINE MUSICAL SYMBOL ELAFRON;So;0;L;;;;;N;;;;;
+1D056;BYZANTINE MUSICAL SYMBOL CHAMILI;So;0;L;;;;;N;;;;;
+1D057;BYZANTINE MUSICAL SYMBOL MIKRON ISON;So;0;L;;;;;N;;;;;
+1D058;BYZANTINE MUSICAL SYMBOL VAREIA NEO;So;0;L;;;;;N;;;;;
+1D059;BYZANTINE MUSICAL SYMBOL PIASMA NEO;So;0;L;;;;;N;;;;;
+1D05A;BYZANTINE MUSICAL SYMBOL PSIFISTON NEO;So;0;L;;;;;N;;;;;
+1D05B;BYZANTINE MUSICAL SYMBOL OMALON;So;0;L;;;;;N;;;;;
+1D05C;BYZANTINE MUSICAL SYMBOL ANTIKENOMA;So;0;L;;;;;N;;;;;
+1D05D;BYZANTINE MUSICAL SYMBOL LYGISMA;So;0;L;;;;;N;;;;;
+1D05E;BYZANTINE MUSICAL SYMBOL PARAKLITIKI NEO;So;0;L;;;;;N;;;;;
+1D05F;BYZANTINE MUSICAL SYMBOL PARAKALESMA NEO;So;0;L;;;;;N;;;;;
+1D060;BYZANTINE MUSICAL SYMBOL ETERON PARAKALESMA;So;0;L;;;;;N;;;;;
+1D061;BYZANTINE MUSICAL SYMBOL KYLISMA;So;0;L;;;;;N;;;;;
+1D062;BYZANTINE MUSICAL SYMBOL ANTIKENOKYLISMA;So;0;L;;;;;N;;;;;
+1D063;BYZANTINE MUSICAL SYMBOL TROMIKON NEO;So;0;L;;;;;N;;;;;
+1D064;BYZANTINE MUSICAL SYMBOL EKSTREPTON;So;0;L;;;;;N;;;;;
+1D065;BYZANTINE MUSICAL SYMBOL SYNAGMA NEO;So;0;L;;;;;N;;;;;
+1D066;BYZANTINE MUSICAL SYMBOL SYRMA;So;0;L;;;;;N;;;;;
+1D067;BYZANTINE MUSICAL SYMBOL CHOREVMA NEO;So;0;L;;;;;N;;;;;
+1D068;BYZANTINE MUSICAL SYMBOL EPEGERMA;So;0;L;;;;;N;;;;;
+1D069;BYZANTINE MUSICAL SYMBOL SEISMA NEO;So;0;L;;;;;N;;;;;
+1D06A;BYZANTINE MUSICAL SYMBOL XIRON KLASMA;So;0;L;;;;;N;;;;;
+1D06B;BYZANTINE MUSICAL SYMBOL TROMIKOPSIFISTON;So;0;L;;;;;N;;;;;
+1D06C;BYZANTINE MUSICAL SYMBOL PSIFISTOLYGISMA;So;0;L;;;;;N;;;;;
+1D06D;BYZANTINE MUSICAL SYMBOL TROMIKOLYGISMA;So;0;L;;;;;N;;;;;
+1D06E;BYZANTINE MUSICAL SYMBOL TROMIKOPARAKALESMA;So;0;L;;;;;N;;;;;
+1D06F;BYZANTINE MUSICAL SYMBOL PSIFISTOPARAKALESMA;So;0;L;;;;;N;;;;;
+1D070;BYZANTINE MUSICAL SYMBOL TROMIKOSYNAGMA;So;0;L;;;;;N;;;;;
+1D071;BYZANTINE MUSICAL SYMBOL PSIFISTOSYNAGMA;So;0;L;;;;;N;;;;;
+1D072;BYZANTINE MUSICAL SYMBOL GORGOSYNTHETON;So;0;L;;;;;N;;;;;
+1D073;BYZANTINE MUSICAL SYMBOL ARGOSYNTHETON;So;0;L;;;;;N;;;;;
+1D074;BYZANTINE MUSICAL SYMBOL ETERON ARGOSYNTHETON;So;0;L;;;;;N;;;;;
+1D075;BYZANTINE MUSICAL SYMBOL OYRANISMA NEO;So;0;L;;;;;N;;;;;
+1D076;BYZANTINE MUSICAL SYMBOL THEMATISMOS ESO;So;0;L;;;;;N;;;;;
+1D077;BYZANTINE MUSICAL SYMBOL THEMATISMOS EXO;So;0;L;;;;;N;;;;;
+1D078;BYZANTINE MUSICAL SYMBOL THEMA APLOUN;So;0;L;;;;;N;;;;;
+1D079;BYZANTINE MUSICAL SYMBOL THES KAI APOTHES;So;0;L;;;;;N;;;;;
+1D07A;BYZANTINE MUSICAL SYMBOL KATAVASMA;So;0;L;;;;;N;;;;;
+1D07B;BYZANTINE MUSICAL SYMBOL ENDOFONON;So;0;L;;;;;N;;;;;
+1D07C;BYZANTINE MUSICAL SYMBOL YFEN KATO;So;0;L;;;;;N;;;;;
+1D07D;BYZANTINE MUSICAL SYMBOL YFEN ANO;So;0;L;;;;;N;;;;;
+1D07E;BYZANTINE MUSICAL SYMBOL STAVROS;So;0;L;;;;;N;;;;;
+1D07F;BYZANTINE MUSICAL SYMBOL KLASMA ANO;So;0;L;;;;;N;;;;;
+1D080;BYZANTINE MUSICAL SYMBOL DIPLI ARCHAION;So;0;L;;;;;N;;;;;
+1D081;BYZANTINE MUSICAL SYMBOL KRATIMA ARCHAION;So;0;L;;;;;N;;;;;
+1D082;BYZANTINE MUSICAL SYMBOL KRATIMA ALLO;So;0;L;;;;;N;;;;;
+1D083;BYZANTINE MUSICAL SYMBOL KRATIMA NEO;So;0;L;;;;;N;;;;;
+1D084;BYZANTINE MUSICAL SYMBOL APODERMA NEO;So;0;L;;;;;N;;;;;
+1D085;BYZANTINE MUSICAL SYMBOL APLI;So;0;L;;;;;N;;;;;
+1D086;BYZANTINE MUSICAL SYMBOL DIPLI;So;0;L;;;;;N;;;;;
+1D087;BYZANTINE MUSICAL SYMBOL TRIPLI;So;0;L;;;;;N;;;;;
+1D088;BYZANTINE MUSICAL SYMBOL TETRAPLI;So;0;L;;;;;N;;;;;
+1D089;BYZANTINE MUSICAL SYMBOL KORONIS;So;0;L;;;;;N;;;;;
+1D08A;BYZANTINE MUSICAL SYMBOL LEIMMA ENOS CHRONOU;So;0;L;;;;;N;;;;;
+1D08B;BYZANTINE MUSICAL SYMBOL LEIMMA DYO CHRONON;So;0;L;;;;;N;;;;;
+1D08C;BYZANTINE MUSICAL SYMBOL LEIMMA TRION CHRONON;So;0;L;;;;;N;;;;;
+1D08D;BYZANTINE MUSICAL SYMBOL LEIMMA TESSARON CHRONON;So;0;L;;;;;N;;;;;
+1D08E;BYZANTINE MUSICAL SYMBOL LEIMMA IMISEOS CHRONOU;So;0;L;;;;;N;;;;;
+1D08F;BYZANTINE MUSICAL SYMBOL GORGON NEO ANO;So;0;L;;;;;N;;;;;
+1D090;BYZANTINE MUSICAL SYMBOL GORGON PARESTIGMENON ARISTERA;So;0;L;;;;;N;;;;;
+1D091;BYZANTINE MUSICAL SYMBOL GORGON PARESTIGMENON DEXIA;So;0;L;;;;;N;;;;;
+1D092;BYZANTINE MUSICAL SYMBOL DIGORGON;So;0;L;;;;;N;;;;;
+1D093;BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON ARISTERA KATO;So;0;L;;;;;N;;;;;
+1D094;BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON ARISTERA ANO;So;0;L;;;;;N;;;;;
+1D095;BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON DEXIA;So;0;L;;;;;N;;;;;
+1D096;BYZANTINE MUSICAL SYMBOL TRIGORGON;So;0;L;;;;;N;;;;;
+1D097;BYZANTINE MUSICAL SYMBOL ARGON;So;0;L;;;;;N;;;;;
+1D098;BYZANTINE MUSICAL SYMBOL IMIDIARGON;So;0;L;;;;;N;;;;;
+1D099;BYZANTINE MUSICAL SYMBOL DIARGON;So;0;L;;;;;N;;;;;
+1D09A;BYZANTINE MUSICAL SYMBOL AGOGI POLI ARGI;So;0;L;;;;;N;;;;;
+1D09B;BYZANTINE MUSICAL SYMBOL AGOGI ARGOTERI;So;0;L;;;;;N;;;;;
+1D09C;BYZANTINE MUSICAL SYMBOL AGOGI ARGI;So;0;L;;;;;N;;;;;
+1D09D;BYZANTINE MUSICAL SYMBOL AGOGI METRIA;So;0;L;;;;;N;;;;;
+1D09E;BYZANTINE MUSICAL SYMBOL AGOGI MESI;So;0;L;;;;;N;;;;;
+1D09F;BYZANTINE MUSICAL SYMBOL AGOGI GORGI;So;0;L;;;;;N;;;;;
+1D0A0;BYZANTINE MUSICAL SYMBOL AGOGI GORGOTERI;So;0;L;;;;;N;;;;;
+1D0A1;BYZANTINE MUSICAL SYMBOL AGOGI POLI GORGI;So;0;L;;;;;N;;;;;
+1D0A2;BYZANTINE MUSICAL SYMBOL MARTYRIA PROTOS ICHOS;So;0;L;;;;;N;;;;;
+1D0A3;BYZANTINE MUSICAL SYMBOL MARTYRIA ALLI PROTOS ICHOS;So;0;L;;;;;N;;;;;
+1D0A4;BYZANTINE MUSICAL SYMBOL MARTYRIA DEYTEROS ICHOS;So;0;L;;;;;N;;;;;
+1D0A5;BYZANTINE MUSICAL SYMBOL MARTYRIA ALLI DEYTEROS ICHOS;So;0;L;;;;;N;;;;;
+1D0A6;BYZANTINE MUSICAL SYMBOL MARTYRIA TRITOS ICHOS;So;0;L;;;;;N;;;;;
+1D0A7;BYZANTINE MUSICAL SYMBOL MARTYRIA TRIFONIAS;So;0;L;;;;;N;;;;;
+1D0A8;BYZANTINE MUSICAL SYMBOL MARTYRIA TETARTOS ICHOS;So;0;L;;;;;N;;;;;
+1D0A9;BYZANTINE MUSICAL SYMBOL MARTYRIA TETARTOS LEGETOS ICHOS;So;0;L;;;;;N;;;;;
+1D0AA;BYZANTINE MUSICAL SYMBOL MARTYRIA LEGETOS ICHOS;So;0;L;;;;;N;;;;;
+1D0AB;BYZANTINE MUSICAL SYMBOL MARTYRIA PLAGIOS ICHOS;So;0;L;;;;;N;;;;;
+1D0AC;BYZANTINE MUSICAL SYMBOL ISAKIA TELOUS ICHIMATOS;So;0;L;;;;;N;;;;;
+1D0AD;BYZANTINE MUSICAL SYMBOL APOSTROFOI TELOUS ICHIMATOS;So;0;L;;;;;N;;;;;
+1D0AE;BYZANTINE MUSICAL SYMBOL FANEROSIS TETRAFONIAS;So;0;L;;;;;N;;;;;
+1D0AF;BYZANTINE MUSICAL SYMBOL FANEROSIS MONOFONIAS;So;0;L;;;;;N;;;;;
+1D0B0;BYZANTINE MUSICAL SYMBOL FANEROSIS DIFONIAS;So;0;L;;;;;N;;;;;
+1D0B1;BYZANTINE MUSICAL SYMBOL MARTYRIA VARYS ICHOS;So;0;L;;;;;N;;;;;
+1D0B2;BYZANTINE MUSICAL SYMBOL MARTYRIA PROTOVARYS ICHOS;So;0;L;;;;;N;;;;;
+1D0B3;BYZANTINE MUSICAL SYMBOL MARTYRIA PLAGIOS TETARTOS ICHOS;So;0;L;;;;;N;;;;;
+1D0B4;BYZANTINE MUSICAL SYMBOL GORTHMIKON N APLOUN;So;0;L;;;;;N;;;;;
+1D0B5;BYZANTINE MUSICAL SYMBOL GORTHMIKON N DIPLOUN;So;0;L;;;;;N;;;;;
+1D0B6;BYZANTINE MUSICAL SYMBOL ENARXIS KAI FTHORA VOU;So;0;L;;;;;N;;;;;
+1D0B7;BYZANTINE MUSICAL SYMBOL IMIFONON;So;0;L;;;;;N;;;;;
+1D0B8;BYZANTINE MUSICAL SYMBOL IMIFTHORON;So;0;L;;;;;N;;;;;
+1D0B9;BYZANTINE MUSICAL SYMBOL FTHORA ARCHAION DEYTEROU ICHOU;So;0;L;;;;;N;;;;;
+1D0BA;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI PA;So;0;L;;;;;N;;;;;
+1D0BB;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NANA;So;0;L;;;;;N;;;;;
+1D0BC;BYZANTINE MUSICAL SYMBOL FTHORA NAOS ICHOS;So;0;L;;;;;N;;;;;
+1D0BD;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI DI;So;0;L;;;;;N;;;;;
+1D0BE;BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON DIATONON DI;So;0;L;;;;;N;;;;;
+1D0BF;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI KE;So;0;L;;;;;N;;;;;
+1D0C0;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI ZO;So;0;L;;;;;N;;;;;
+1D0C1;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NI KATO;So;0;L;;;;;N;;;;;
+1D0C2;BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NI ANO;So;0;L;;;;;N;;;;;
+1D0C3;BYZANTINE MUSICAL SYMBOL FTHORA MALAKON CHROMA DIFONIAS;So;0;L;;;;;N;;;;;
+1D0C4;BYZANTINE MUSICAL SYMBOL FTHORA MALAKON CHROMA MONOFONIAS;So;0;L;;;;;N;;;;;
+1D0C5;BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS;So;0;L;;;;;N;;;;;
+1D0C6;BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA SYNAFI;So;0;L;;;;;N;;;;;
+1D0C7;BYZANTINE MUSICAL SYMBOL FTHORA NENANO;So;0;L;;;;;N;;;;;
+1D0C8;BYZANTINE MUSICAL SYMBOL CHROA ZYGOS;So;0;L;;;;;N;;;;;
+1D0C9;BYZANTINE MUSICAL SYMBOL CHROA KLITON;So;0;L;;;;;N;;;;;
+1D0CA;BYZANTINE MUSICAL SYMBOL CHROA SPATHI;So;0;L;;;;;N;;;;;
+1D0CB;BYZANTINE MUSICAL SYMBOL FTHORA I YFESIS TETARTIMORION;So;0;L;;;;;N;;;;;
+1D0CC;BYZANTINE MUSICAL SYMBOL FTHORA ENARMONIOS ANTIFONIA;So;0;L;;;;;N;;;;;
+1D0CD;BYZANTINE MUSICAL SYMBOL YFESIS TRITIMORION;So;0;L;;;;;N;;;;;
+1D0CE;BYZANTINE MUSICAL SYMBOL DIESIS TRITIMORION;So;0;L;;;;;N;;;;;
+1D0CF;BYZANTINE MUSICAL SYMBOL DIESIS TETARTIMORION;So;0;L;;;;;N;;;;;
+1D0D0;BYZANTINE MUSICAL SYMBOL DIESIS APLI DYO DODEKATA;So;0;L;;;;;N;;;;;
+1D0D1;BYZANTINE MUSICAL SYMBOL DIESIS MONOGRAMMOS TESSERA DODEKATA;So;0;L;;;;;N;;;;;
+1D0D2;BYZANTINE MUSICAL SYMBOL DIESIS DIGRAMMOS EX DODEKATA;So;0;L;;;;;N;;;;;
+1D0D3;BYZANTINE MUSICAL SYMBOL DIESIS TRIGRAMMOS OKTO DODEKATA;So;0;L;;;;;N;;;;;
+1D0D4;BYZANTINE MUSICAL SYMBOL YFESIS APLI DYO DODEKATA;So;0;L;;;;;N;;;;;
+1D0D5;BYZANTINE MUSICAL SYMBOL YFESIS MONOGRAMMOS TESSERA DODEKATA;So;0;L;;;;;N;;;;;
+1D0D6;BYZANTINE MUSICAL SYMBOL YFESIS DIGRAMMOS EX DODEKATA;So;0;L;;;;;N;;;;;
+1D0D7;BYZANTINE MUSICAL SYMBOL YFESIS TRIGRAMMOS OKTO DODEKATA;So;0;L;;;;;N;;;;;
+1D0D8;BYZANTINE MUSICAL SYMBOL GENIKI DIESIS;So;0;L;;;;;N;;;;;
+1D0D9;BYZANTINE MUSICAL SYMBOL GENIKI YFESIS;So;0;L;;;;;N;;;;;
+1D0DA;BYZANTINE MUSICAL SYMBOL DIASTOLI APLI MIKRI;So;0;L;;;;;N;;;;;
+1D0DB;BYZANTINE MUSICAL SYMBOL DIASTOLI APLI MEGALI;So;0;L;;;;;N;;;;;
+1D0DC;BYZANTINE MUSICAL SYMBOL DIASTOLI DIPLI;So;0;L;;;;;N;;;;;
+1D0DD;BYZANTINE MUSICAL SYMBOL DIASTOLI THESEOS;So;0;L;;;;;N;;;;;
+1D0DE;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS;So;0;L;;;;;N;;;;;
+1D0DF;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS DISIMOU;So;0;L;;;;;N;;;;;
+1D0E0;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS TRISIMOU;So;0;L;;;;;N;;;;;
+1D0E1;BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS TETRASIMOU;So;0;L;;;;;N;;;;;
+1D0E2;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS;So;0;L;;;;;N;;;;;
+1D0E3;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS DISIMOU;So;0;L;;;;;N;;;;;
+1D0E4;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS TRISIMOU;So;0;L;;;;;N;;;;;
+1D0E5;BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS TETRASIMOU;So;0;L;;;;;N;;;;;
+1D0E6;BYZANTINE MUSICAL SYMBOL DIGRAMMA GG;So;0;L;;;;;N;;;;;
+1D0E7;BYZANTINE MUSICAL SYMBOL DIFTOGGOS OU;So;0;L;;;;;N;;;;;
+1D0E8;BYZANTINE MUSICAL SYMBOL STIGMA;So;0;L;;;;;N;;;;;
+1D0E9;BYZANTINE MUSICAL SYMBOL ARKTIKO PA;So;0;L;;;;;N;;;;;
+1D0EA;BYZANTINE MUSICAL SYMBOL ARKTIKO VOU;So;0;L;;;;;N;;;;;
+1D0EB;BYZANTINE MUSICAL SYMBOL ARKTIKO GA;So;0;L;;;;;N;;;;;
+1D0EC;BYZANTINE MUSICAL SYMBOL ARKTIKO DI;So;0;L;;;;;N;;;;;
+1D0ED;BYZANTINE MUSICAL SYMBOL ARKTIKO KE;So;0;L;;;;;N;;;;;
+1D0EE;BYZANTINE MUSICAL SYMBOL ARKTIKO ZO;So;0;L;;;;;N;;;;;
+1D0EF;BYZANTINE MUSICAL SYMBOL ARKTIKO NI;So;0;L;;;;;N;;;;;
+1D0F0;BYZANTINE MUSICAL SYMBOL KENTIMATA NEO MESO;So;0;L;;;;;N;;;;;
+1D0F1;BYZANTINE MUSICAL SYMBOL KENTIMA NEO MESO;So;0;L;;;;;N;;;;;
+1D0F2;BYZANTINE MUSICAL SYMBOL KENTIMATA NEO KATO;So;0;L;;;;;N;;;;;
+1D0F3;BYZANTINE MUSICAL SYMBOL KENTIMA NEO KATO;So;0;L;;;;;N;;;;;
+1D0F4;BYZANTINE MUSICAL SYMBOL KLASMA KATO;So;0;L;;;;;N;;;;;
+1D0F5;BYZANTINE MUSICAL SYMBOL GORGON NEO KATO;So;0;L;;;;;N;;;;;
+1D100;MUSICAL SYMBOL SINGLE BARLINE;So;0;L;;;;;N;;;;;
+1D101;MUSICAL SYMBOL DOUBLE BARLINE;So;0;L;;;;;N;;;;;
+1D102;MUSICAL SYMBOL FINAL BARLINE;So;0;L;;;;;N;;;;;
+1D103;MUSICAL SYMBOL REVERSE FINAL BARLINE;So;0;L;;;;;N;;;;;
+1D104;MUSICAL SYMBOL DASHED BARLINE;So;0;L;;;;;N;;;;;
+1D105;MUSICAL SYMBOL SHORT BARLINE;So;0;L;;;;;N;;;;;
+1D106;MUSICAL SYMBOL LEFT REPEAT SIGN;So;0;L;;;;;N;;;;;
+1D107;MUSICAL SYMBOL RIGHT REPEAT SIGN;So;0;L;;;;;N;;;;;
+1D108;MUSICAL SYMBOL REPEAT DOTS;So;0;L;;;;;N;;;;;
+1D109;MUSICAL SYMBOL DAL SEGNO;So;0;L;;;;;N;;;;;
+1D10A;MUSICAL SYMBOL DA CAPO;So;0;L;;;;;N;;;;;
+1D10B;MUSICAL SYMBOL SEGNO;So;0;L;;;;;N;;;;;
+1D10C;MUSICAL SYMBOL CODA;So;0;L;;;;;N;;;;;
+1D10D;MUSICAL SYMBOL REPEATED FIGURE-1;So;0;L;;;;;N;;;;;
+1D10E;MUSICAL SYMBOL REPEATED FIGURE-2;So;0;L;;;;;N;;;;;
+1D10F;MUSICAL SYMBOL REPEATED FIGURE-3;So;0;L;;;;;N;;;;;
+1D110;MUSICAL SYMBOL FERMATA;So;0;L;;;;;N;;;;;
+1D111;MUSICAL SYMBOL FERMATA BELOW;So;0;L;;;;;N;;;;;
+1D112;MUSICAL SYMBOL BREATH MARK;So;0;L;;;;;N;;;;;
+1D113;MUSICAL SYMBOL CAESURA;So;0;L;;;;;N;;;;;
+1D114;MUSICAL SYMBOL BRACE;So;0;L;;;;;N;;;;;
+1D115;MUSICAL SYMBOL BRACKET;So;0;L;;;;;N;;;;;
+1D116;MUSICAL SYMBOL ONE-LINE STAFF;So;0;L;;;;;N;;;;;
+1D117;MUSICAL SYMBOL TWO-LINE STAFF;So;0;L;;;;;N;;;;;
+1D118;MUSICAL SYMBOL THREE-LINE STAFF;So;0;L;;;;;N;;;;;
+1D119;MUSICAL SYMBOL FOUR-LINE STAFF;So;0;L;;;;;N;;;;;
+1D11A;MUSICAL SYMBOL FIVE-LINE STAFF;So;0;L;;;;;N;;;;;
+1D11B;MUSICAL SYMBOL SIX-LINE STAFF;So;0;L;;;;;N;;;;;
+1D11C;MUSICAL SYMBOL SIX-STRING FRETBOARD;So;0;L;;;;;N;;;;;
+1D11D;MUSICAL SYMBOL FOUR-STRING FRETBOARD;So;0;L;;;;;N;;;;;
+1D11E;MUSICAL SYMBOL G CLEF;So;0;L;;;;;N;;;;;
+1D11F;MUSICAL SYMBOL G CLEF OTTAVA ALTA;So;0;L;;;;;N;;;;;
+1D120;MUSICAL SYMBOL G CLEF OTTAVA BASSA;So;0;L;;;;;N;;;;;
+1D121;MUSICAL SYMBOL C CLEF;So;0;L;;;;;N;;;;;
+1D122;MUSICAL SYMBOL F CLEF;So;0;L;;;;;N;;;;;
+1D123;MUSICAL SYMBOL F CLEF OTTAVA ALTA;So;0;L;;;;;N;;;;;
+1D124;MUSICAL SYMBOL F CLEF OTTAVA BASSA;So;0;L;;;;;N;;;;;
+1D125;MUSICAL SYMBOL DRUM CLEF-1;So;0;L;;;;;N;;;;;
+1D126;MUSICAL SYMBOL DRUM CLEF-2;So;0;L;;;;;N;;;;;
+1D12A;MUSICAL SYMBOL DOUBLE SHARP;So;0;L;;;;;N;;;;;
+1D12B;MUSICAL SYMBOL DOUBLE FLAT;So;0;L;;;;;N;;;;;
+1D12C;MUSICAL SYMBOL FLAT UP;So;0;L;;;;;N;;;;;
+1D12D;MUSICAL SYMBOL FLAT DOWN;So;0;L;;;;;N;;;;;
+1D12E;MUSICAL SYMBOL NATURAL UP;So;0;L;;;;;N;;;;;
+1D12F;MUSICAL SYMBOL NATURAL DOWN;So;0;L;;;;;N;;;;;
+1D130;MUSICAL SYMBOL SHARP UP;So;0;L;;;;;N;;;;;
+1D131;MUSICAL SYMBOL SHARP DOWN;So;0;L;;;;;N;;;;;
+1D132;MUSICAL SYMBOL QUARTER TONE SHARP;So;0;L;;;;;N;;;;;
+1D133;MUSICAL SYMBOL QUARTER TONE FLAT;So;0;L;;;;;N;;;;;
+1D134;MUSICAL SYMBOL COMMON TIME;So;0;L;;;;;N;;;;;
+1D135;MUSICAL SYMBOL CUT TIME;So;0;L;;;;;N;;;;;
+1D136;MUSICAL SYMBOL OTTAVA ALTA;So;0;L;;;;;N;;;;;
+1D137;MUSICAL SYMBOL OTTAVA BASSA;So;0;L;;;;;N;;;;;
+1D138;MUSICAL SYMBOL QUINDICESIMA ALTA;So;0;L;;;;;N;;;;;
+1D139;MUSICAL SYMBOL QUINDICESIMA BASSA;So;0;L;;;;;N;;;;;
+1D13A;MUSICAL SYMBOL MULTI REST;So;0;L;;;;;N;;;;;
+1D13B;MUSICAL SYMBOL WHOLE REST;So;0;L;;;;;N;;;;;
+1D13C;MUSICAL SYMBOL HALF REST;So;0;L;;;;;N;;;;;
+1D13D;MUSICAL SYMBOL QUARTER REST;So;0;L;;;;;N;;;;;
+1D13E;MUSICAL SYMBOL EIGHTH REST;So;0;L;;;;;N;;;;;
+1D13F;MUSICAL SYMBOL SIXTEENTH REST;So;0;L;;;;;N;;;;;
+1D140;MUSICAL SYMBOL THIRTY-SECOND REST;So;0;L;;;;;N;;;;;
+1D141;MUSICAL SYMBOL SIXTY-FOURTH REST;So;0;L;;;;;N;;;;;
+1D142;MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH REST;So;0;L;;;;;N;;;;;
+1D143;MUSICAL SYMBOL X NOTEHEAD;So;0;L;;;;;N;;;;;
+1D144;MUSICAL SYMBOL PLUS NOTEHEAD;So;0;L;;;;;N;;;;;
+1D145;MUSICAL SYMBOL CIRCLE X NOTEHEAD;So;0;L;;;;;N;;;;;
+1D146;MUSICAL SYMBOL SQUARE NOTEHEAD WHITE;So;0;L;;;;;N;;;;;
+1D147;MUSICAL SYMBOL SQUARE NOTEHEAD BLACK;So;0;L;;;;;N;;;;;
+1D148;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP WHITE;So;0;L;;;;;N;;;;;
+1D149;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP BLACK;So;0;L;;;;;N;;;;;
+1D14A;MUSICAL SYMBOL TRIANGLE NOTEHEAD LEFT WHITE;So;0;L;;;;;N;;;;;
+1D14B;MUSICAL SYMBOL TRIANGLE NOTEHEAD LEFT BLACK;So;0;L;;;;;N;;;;;
+1D14C;MUSICAL SYMBOL TRIANGLE NOTEHEAD RIGHT WHITE;So;0;L;;;;;N;;;;;
+1D14D;MUSICAL SYMBOL TRIANGLE NOTEHEAD RIGHT BLACK;So;0;L;;;;;N;;;;;
+1D14E;MUSICAL SYMBOL TRIANGLE NOTEHEAD DOWN WHITE;So;0;L;;;;;N;;;;;
+1D14F;MUSICAL SYMBOL TRIANGLE NOTEHEAD DOWN BLACK;So;0;L;;;;;N;;;;;
+1D150;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP RIGHT WHITE;So;0;L;;;;;N;;;;;
+1D151;MUSICAL SYMBOL TRIANGLE NOTEHEAD UP RIGHT BLACK;So;0;L;;;;;N;;;;;
+1D152;MUSICAL SYMBOL MOON NOTEHEAD WHITE;So;0;L;;;;;N;;;;;
+1D153;MUSICAL SYMBOL MOON NOTEHEAD BLACK;So;0;L;;;;;N;;;;;
+1D154;MUSICAL SYMBOL TRIANGLE-ROUND NOTEHEAD DOWN WHITE;So;0;L;;;;;N;;;;;
+1D155;MUSICAL SYMBOL TRIANGLE-ROUND NOTEHEAD DOWN BLACK;So;0;L;;;;;N;;;;;
+1D156;MUSICAL SYMBOL PARENTHESIS NOTEHEAD;So;0;L;;;;;N;;;;;
+1D157;MUSICAL SYMBOL VOID NOTEHEAD;So;0;L;;;;;N;;;;;
+1D158;MUSICAL SYMBOL NOTEHEAD BLACK;So;0;L;;;;;N;;;;;
+1D159;MUSICAL SYMBOL NULL NOTEHEAD;So;0;L;;;;;N;;;;;
+1D15A;MUSICAL SYMBOL CLUSTER NOTEHEAD WHITE;So;0;L;;;;;N;;;;;
+1D15B;MUSICAL SYMBOL CLUSTER NOTEHEAD BLACK;So;0;L;;;;;N;;;;;
+1D15C;MUSICAL SYMBOL BREVE;So;0;L;;;;;N;;;;;
+1D15D;MUSICAL SYMBOL WHOLE NOTE;So;0;L;;;;;N;;;;;
+1D15E;MUSICAL SYMBOL HALF NOTE;So;0;L;1D157 1D165;;;;N;;;;;
+1D15F;MUSICAL SYMBOL QUARTER NOTE;So;0;L;1D158 1D165;;;;N;;;;;
+1D160;MUSICAL SYMBOL EIGHTH NOTE;So;0;L;1D15F 1D16E;;;;N;;;;;
+1D161;MUSICAL SYMBOL SIXTEENTH NOTE;So;0;L;1D15F 1D16F;;;;N;;;;;
+1D162;MUSICAL SYMBOL THIRTY-SECOND NOTE;So;0;L;1D15F 1D170;;;;N;;;;;
+1D163;MUSICAL SYMBOL SIXTY-FOURTH NOTE;So;0;L;1D15F 1D171;;;;N;;;;;
+1D164;MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH NOTE;So;0;L;1D15F 1D172;;;;N;;;;;
+1D165;MUSICAL SYMBOL COMBINING STEM;Mc;216;L;;;;;N;;;;;
+1D166;MUSICAL SYMBOL COMBINING SPRECHGESANG STEM;Mc;216;L;;;;;N;;;;;
+1D167;MUSICAL SYMBOL COMBINING TREMOLO-1;Mn;1;NSM;;;;;N;;;;;
+1D168;MUSICAL SYMBOL COMBINING TREMOLO-2;Mn;1;NSM;;;;;N;;;;;
+1D169;MUSICAL SYMBOL COMBINING TREMOLO-3;Mn;1;NSM;;;;;N;;;;;
+1D16A;MUSICAL SYMBOL FINGERED TREMOLO-1;So;0;L;;;;;N;;;;;
+1D16B;MUSICAL SYMBOL FINGERED TREMOLO-2;So;0;L;;;;;N;;;;;
+1D16C;MUSICAL SYMBOL FINGERED TREMOLO-3;So;0;L;;;;;N;;;;;
+1D16D;MUSICAL SYMBOL COMBINING AUGMENTATION DOT;Mc;226;L;;;;;N;;;;;
+1D16E;MUSICAL SYMBOL COMBINING FLAG-1;Mc;216;L;;;;;N;;;;;
+1D16F;MUSICAL SYMBOL COMBINING FLAG-2;Mc;216;L;;;;;N;;;;;
+1D170;MUSICAL SYMBOL COMBINING FLAG-3;Mc;216;L;;;;;N;;;;;
+1D171;MUSICAL SYMBOL COMBINING FLAG-4;Mc;216;L;;;;;N;;;;;
+1D172;MUSICAL SYMBOL COMBINING FLAG-5;Mc;216;L;;;;;N;;;;;
+1D173;MUSICAL SYMBOL BEGIN BEAM;Cf;0;BN;;;;;N;;;;;
+1D174;MUSICAL SYMBOL END BEAM;Cf;0;BN;;;;;N;;;;;
+1D175;MUSICAL SYMBOL BEGIN TIE;Cf;0;BN;;;;;N;;;;;
+1D176;MUSICAL SYMBOL END TIE;Cf;0;BN;;;;;N;;;;;
+1D177;MUSICAL SYMBOL BEGIN SLUR;Cf;0;BN;;;;;N;;;;;
+1D178;MUSICAL SYMBOL END SLUR;Cf;0;BN;;;;;N;;;;;
+1D179;MUSICAL SYMBOL BEGIN PHRASE;Cf;0;BN;;;;;N;;;;;
+1D17A;MUSICAL SYMBOL END PHRASE;Cf;0;BN;;;;;N;;;;;
+1D17B;MUSICAL SYMBOL COMBINING ACCENT;Mn;220;NSM;;;;;N;;;;;
+1D17C;MUSICAL SYMBOL COMBINING STACCATO;Mn;220;NSM;;;;;N;;;;;
+1D17D;MUSICAL SYMBOL COMBINING TENUTO;Mn;220;NSM;;;;;N;;;;;
+1D17E;MUSICAL SYMBOL COMBINING STACCATISSIMO;Mn;220;NSM;;;;;N;;;;;
+1D17F;MUSICAL SYMBOL COMBINING MARCATO;Mn;220;NSM;;;;;N;;;;;
+1D180;MUSICAL SYMBOL COMBINING MARCATO-STACCATO;Mn;220;NSM;;;;;N;;;;;
+1D181;MUSICAL SYMBOL COMBINING ACCENT-STACCATO;Mn;220;NSM;;;;;N;;;;;
+1D182;MUSICAL SYMBOL COMBINING LOURE;Mn;220;NSM;;;;;N;;;;;
+1D183;MUSICAL SYMBOL ARPEGGIATO UP;So;0;L;;;;;N;;;;;
+1D184;MUSICAL SYMBOL ARPEGGIATO DOWN;So;0;L;;;;;N;;;;;
+1D185;MUSICAL SYMBOL COMBINING DOIT;Mn;230;NSM;;;;;N;;;;;
+1D186;MUSICAL SYMBOL COMBINING RIP;Mn;230;NSM;;;;;N;;;;;
+1D187;MUSICAL SYMBOL COMBINING FLIP;Mn;230;NSM;;;;;N;;;;;
+1D188;MUSICAL SYMBOL COMBINING SMEAR;Mn;230;NSM;;;;;N;;;;;
+1D189;MUSICAL SYMBOL COMBINING BEND;Mn;230;NSM;;;;;N;;;;;
+1D18A;MUSICAL SYMBOL COMBINING DOUBLE TONGUE;Mn;220;NSM;;;;;N;;;;;
+1D18B;MUSICAL SYMBOL COMBINING TRIPLE TONGUE;Mn;220;NSM;;;;;N;;;;;
+1D18C;MUSICAL SYMBOL RINFORZANDO;So;0;L;;;;;N;;;;;
+1D18D;MUSICAL SYMBOL SUBITO;So;0;L;;;;;N;;;;;
+1D18E;MUSICAL SYMBOL Z;So;0;L;;;;;N;;;;;
+1D18F;MUSICAL SYMBOL PIANO;So;0;L;;;;;N;;;;;
+1D190;MUSICAL SYMBOL MEZZO;So;0;L;;;;;N;;;;;
+1D191;MUSICAL SYMBOL FORTE;So;0;L;;;;;N;;;;;
+1D192;MUSICAL SYMBOL CRESCENDO;So;0;L;;;;;N;;;;;
+1D193;MUSICAL SYMBOL DECRESCENDO;So;0;L;;;;;N;;;;;
+1D194;MUSICAL SYMBOL GRACE NOTE SLASH;So;0;L;;;;;N;;;;;
+1D195;MUSICAL SYMBOL GRACE NOTE NO SLASH;So;0;L;;;;;N;;;;;
+1D196;MUSICAL SYMBOL TR;So;0;L;;;;;N;;;;;
+1D197;MUSICAL SYMBOL TURN;So;0;L;;;;;N;;;;;
+1D198;MUSICAL SYMBOL INVERTED TURN;So;0;L;;;;;N;;;;;
+1D199;MUSICAL SYMBOL TURN SLASH;So;0;L;;;;;N;;;;;
+1D19A;MUSICAL SYMBOL TURN UP;So;0;L;;;;;N;;;;;
+1D19B;MUSICAL SYMBOL ORNAMENT STROKE-1;So;0;L;;;;;N;;;;;
+1D19C;MUSICAL SYMBOL ORNAMENT STROKE-2;So;0;L;;;;;N;;;;;
+1D19D;MUSICAL SYMBOL ORNAMENT STROKE-3;So;0;L;;;;;N;;;;;
+1D19E;MUSICAL SYMBOL ORNAMENT STROKE-4;So;0;L;;;;;N;;;;;
+1D19F;MUSICAL SYMBOL ORNAMENT STROKE-5;So;0;L;;;;;N;;;;;
+1D1A0;MUSICAL SYMBOL ORNAMENT STROKE-6;So;0;L;;;;;N;;;;;
+1D1A1;MUSICAL SYMBOL ORNAMENT STROKE-7;So;0;L;;;;;N;;;;;
+1D1A2;MUSICAL SYMBOL ORNAMENT STROKE-8;So;0;L;;;;;N;;;;;
+1D1A3;MUSICAL SYMBOL ORNAMENT STROKE-9;So;0;L;;;;;N;;;;;
+1D1A4;MUSICAL SYMBOL ORNAMENT STROKE-10;So;0;L;;;;;N;;;;;
+1D1A5;MUSICAL SYMBOL ORNAMENT STROKE-11;So;0;L;;;;;N;;;;;
+1D1A6;MUSICAL SYMBOL HAUPTSTIMME;So;0;L;;;;;N;;;;;
+1D1A7;MUSICAL SYMBOL NEBENSTIMME;So;0;L;;;;;N;;;;;
+1D1A8;MUSICAL SYMBOL END OF STIMME;So;0;L;;;;;N;;;;;
+1D1A9;MUSICAL SYMBOL DEGREE SLASH;So;0;L;;;;;N;;;;;
+1D1AA;MUSICAL SYMBOL COMBINING DOWN BOW;Mn;230;NSM;;;;;N;;;;;
+1D1AB;MUSICAL SYMBOL COMBINING UP BOW;Mn;230;NSM;;;;;N;;;;;
+1D1AC;MUSICAL SYMBOL COMBINING HARMONIC;Mn;230;NSM;;;;;N;;;;;
+1D1AD;MUSICAL SYMBOL COMBINING SNAP PIZZICATO;Mn;230;NSM;;;;;N;;;;;
+1D1AE;MUSICAL SYMBOL PEDAL MARK;So;0;L;;;;;N;;;;;
+1D1AF;MUSICAL SYMBOL PEDAL UP MARK;So;0;L;;;;;N;;;;;
+1D1B0;MUSICAL SYMBOL HALF PEDAL MARK;So;0;L;;;;;N;;;;;
+1D1B1;MUSICAL SYMBOL GLISSANDO UP;So;0;L;;;;;N;;;;;
+1D1B2;MUSICAL SYMBOL GLISSANDO DOWN;So;0;L;;;;;N;;;;;
+1D1B3;MUSICAL SYMBOL WITH FINGERNAILS;So;0;L;;;;;N;;;;;
+1D1B4;MUSICAL SYMBOL DAMP;So;0;L;;;;;N;;;;;
+1D1B5;MUSICAL SYMBOL DAMP ALL;So;0;L;;;;;N;;;;;
+1D1B6;MUSICAL SYMBOL MAXIMA;So;0;L;;;;;N;;;;;
+1D1B7;MUSICAL SYMBOL LONGA;So;0;L;;;;;N;;;;;
+1D1B8;MUSICAL SYMBOL BREVIS;So;0;L;;;;;N;;;;;
+1D1B9;MUSICAL SYMBOL SEMIBREVIS WHITE;So;0;L;;;;;N;;;;;
+1D1BA;MUSICAL SYMBOL SEMIBREVIS BLACK;So;0;L;;;;;N;;;;;
+1D1BB;MUSICAL SYMBOL MINIMA;So;0;L;1D1B9 1D165;;;;N;;;;;
+1D1BC;MUSICAL SYMBOL MINIMA BLACK;So;0;L;1D1BA 1D165;;;;N;;;;;
+1D1BD;MUSICAL SYMBOL SEMIMINIMA WHITE;So;0;L;1D1BB 1D16E;;;;N;;;;;
+1D1BE;MUSICAL SYMBOL SEMIMINIMA BLACK;So;0;L;1D1BC 1D16E;;;;N;;;;;
+1D1BF;MUSICAL SYMBOL FUSA WHITE;So;0;L;1D1BB 1D16F;;;;N;;;;;
+1D1C0;MUSICAL SYMBOL FUSA BLACK;So;0;L;1D1BC 1D16F;;;;N;;;;;
+1D1C1;MUSICAL SYMBOL LONGA PERFECTA REST;So;0;L;;;;;N;;;;;
+1D1C2;MUSICAL SYMBOL LONGA IMPERFECTA REST;So;0;L;;;;;N;;;;;
+1D1C3;MUSICAL SYMBOL BREVIS REST;So;0;L;;;;;N;;;;;
+1D1C4;MUSICAL SYMBOL SEMIBREVIS REST;So;0;L;;;;;N;;;;;
+1D1C5;MUSICAL SYMBOL MINIMA REST;So;0;L;;;;;N;;;;;
+1D1C6;MUSICAL SYMBOL SEMIMINIMA REST;So;0;L;;;;;N;;;;;
+1D1C7;MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE PERFECTA;So;0;L;;;;;N;;;;;
+1D1C8;MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE IMPERFECTA;So;0;L;;;;;N;;;;;
+1D1C9;MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE PERFECTA DIMINUTION-1;So;0;L;;;;;N;;;;;
+1D1CA;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE PERFECTA;So;0;L;;;;;N;;;;;
+1D1CB;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA;So;0;L;;;;;N;;;;;
+1D1CC;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-1;So;0;L;;;;;N;;;;;
+1D1CD;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-2;So;0;L;;;;;N;;;;;
+1D1CE;MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-3;So;0;L;;;;;N;;;;;
+1D1CF;MUSICAL SYMBOL CROIX;So;0;L;;;;;N;;;;;
+1D1D0;MUSICAL SYMBOL GREGORIAN C CLEF;So;0;L;;;;;N;;;;;
+1D1D1;MUSICAL SYMBOL GREGORIAN F CLEF;So;0;L;;;;;N;;;;;
+1D1D2;MUSICAL SYMBOL SQUARE B;So;0;L;;;;;N;;;;;
+1D1D3;MUSICAL SYMBOL VIRGA;So;0;L;;;;;N;;;;;
+1D1D4;MUSICAL SYMBOL PODATUS;So;0;L;;;;;N;;;;;
+1D1D5;MUSICAL SYMBOL CLIVIS;So;0;L;;;;;N;;;;;
+1D1D6;MUSICAL SYMBOL SCANDICUS;So;0;L;;;;;N;;;;;
+1D1D7;MUSICAL SYMBOL CLIMACUS;So;0;L;;;;;N;;;;;
+1D1D8;MUSICAL SYMBOL TORCULUS;So;0;L;;;;;N;;;;;
+1D1D9;MUSICAL SYMBOL PORRECTUS;So;0;L;;;;;N;;;;;
+1D1DA;MUSICAL SYMBOL PORRECTUS FLEXUS;So;0;L;;;;;N;;;;;
+1D1DB;MUSICAL SYMBOL SCANDICUS FLEXUS;So;0;L;;;;;N;;;;;
+1D1DC;MUSICAL SYMBOL TORCULUS RESUPINUS;So;0;L;;;;;N;;;;;
+1D1DD;MUSICAL SYMBOL PES SUBPUNCTIS;So;0;L;;;;;N;;;;;
+1D200;GREEK VOCAL NOTATION SYMBOL-1;So;0;ON;;;;;N;;;;;
+1D201;GREEK VOCAL NOTATION SYMBOL-2;So;0;ON;;;;;N;;;;;
+1D202;GREEK VOCAL NOTATION SYMBOL-3;So;0;ON;;;;;N;;;;;
+1D203;GREEK VOCAL NOTATION SYMBOL-4;So;0;ON;;;;;N;;;;;
+1D204;GREEK VOCAL NOTATION SYMBOL-5;So;0;ON;;;;;N;;;;;
+1D205;GREEK VOCAL NOTATION SYMBOL-6;So;0;ON;;;;;N;;;;;
+1D206;GREEK VOCAL NOTATION SYMBOL-7;So;0;ON;;;;;N;;;;;
+1D207;GREEK VOCAL NOTATION SYMBOL-8;So;0;ON;;;;;N;;;;;
+1D208;GREEK VOCAL NOTATION SYMBOL-9;So;0;ON;;;;;N;;;;;
+1D209;GREEK VOCAL NOTATION SYMBOL-10;So;0;ON;;;;;N;;;;;
+1D20A;GREEK VOCAL NOTATION SYMBOL-11;So;0;ON;;;;;N;;;;;
+1D20B;GREEK VOCAL NOTATION SYMBOL-12;So;0;ON;;;;;N;;;;;
+1D20C;GREEK VOCAL NOTATION SYMBOL-13;So;0;ON;;;;;N;;;;;
+1D20D;GREEK VOCAL NOTATION SYMBOL-14;So;0;ON;;;;;N;;;;;
+1D20E;GREEK VOCAL NOTATION SYMBOL-15;So;0;ON;;;;;N;;;;;
+1D20F;GREEK VOCAL NOTATION SYMBOL-16;So;0;ON;;;;;N;;;;;
+1D210;GREEK VOCAL NOTATION SYMBOL-17;So;0;ON;;;;;N;;;;;
+1D211;GREEK VOCAL NOTATION SYMBOL-18;So;0;ON;;;;;N;;;;;
+1D212;GREEK VOCAL NOTATION SYMBOL-19;So;0;ON;;;;;N;;;;;
+1D213;GREEK VOCAL NOTATION SYMBOL-20;So;0;ON;;;;;N;;;;;
+1D214;GREEK VOCAL NOTATION SYMBOL-21;So;0;ON;;;;;N;;;;;
+1D215;GREEK VOCAL NOTATION SYMBOL-22;So;0;ON;;;;;N;;;;;
+1D216;GREEK VOCAL NOTATION SYMBOL-23;So;0;ON;;;;;N;;;;;
+1D217;GREEK VOCAL NOTATION SYMBOL-24;So;0;ON;;;;;N;;;;;
+1D218;GREEK VOCAL NOTATION SYMBOL-50;So;0;ON;;;;;N;;;;;
+1D219;GREEK VOCAL NOTATION SYMBOL-51;So;0;ON;;;;;N;;;;;
+1D21A;GREEK VOCAL NOTATION SYMBOL-52;So;0;ON;;;;;N;;;;;
+1D21B;GREEK VOCAL NOTATION SYMBOL-53;So;0;ON;;;;;N;;;;;
+1D21C;GREEK VOCAL NOTATION SYMBOL-54;So;0;ON;;;;;N;;;;;
+1D21D;GREEK INSTRUMENTAL NOTATION SYMBOL-1;So;0;ON;;;;;N;;;;;
+1D21E;GREEK INSTRUMENTAL NOTATION SYMBOL-2;So;0;ON;;;;;N;;;;;
+1D21F;GREEK INSTRUMENTAL NOTATION SYMBOL-4;So;0;ON;;;;;N;;;;;
+1D220;GREEK INSTRUMENTAL NOTATION SYMBOL-5;So;0;ON;;;;;N;;;;;
+1D221;GREEK INSTRUMENTAL NOTATION SYMBOL-7;So;0;ON;;;;;N;;;;;
+1D222;GREEK INSTRUMENTAL NOTATION SYMBOL-8;So;0;ON;;;;;N;;;;;
+1D223;GREEK INSTRUMENTAL NOTATION SYMBOL-11;So;0;ON;;;;;N;;;;;
+1D224;GREEK INSTRUMENTAL NOTATION SYMBOL-12;So;0;ON;;;;;N;;;;;
+1D225;GREEK INSTRUMENTAL NOTATION SYMBOL-13;So;0;ON;;;;;N;;;;;
+1D226;GREEK INSTRUMENTAL NOTATION SYMBOL-14;So;0;ON;;;;;N;;;;;
+1D227;GREEK INSTRUMENTAL NOTATION SYMBOL-17;So;0;ON;;;;;N;;;;;
+1D228;GREEK INSTRUMENTAL NOTATION SYMBOL-18;So;0;ON;;;;;N;;;;;
+1D229;GREEK INSTRUMENTAL NOTATION SYMBOL-19;So;0;ON;;;;;N;;;;;
+1D22A;GREEK INSTRUMENTAL NOTATION SYMBOL-23;So;0;ON;;;;;N;;;;;
+1D22B;GREEK INSTRUMENTAL NOTATION SYMBOL-24;So;0;ON;;;;;N;;;;;
+1D22C;GREEK INSTRUMENTAL NOTATION SYMBOL-25;So;0;ON;;;;;N;;;;;
+1D22D;GREEK INSTRUMENTAL NOTATION SYMBOL-26;So;0;ON;;;;;N;;;;;
+1D22E;GREEK INSTRUMENTAL NOTATION SYMBOL-27;So;0;ON;;;;;N;;;;;
+1D22F;GREEK INSTRUMENTAL NOTATION SYMBOL-29;So;0;ON;;;;;N;;;;;
+1D230;GREEK INSTRUMENTAL NOTATION SYMBOL-30;So;0;ON;;;;;N;;;;;
+1D231;GREEK INSTRUMENTAL NOTATION SYMBOL-32;So;0;ON;;;;;N;;;;;
+1D232;GREEK INSTRUMENTAL NOTATION SYMBOL-36;So;0;ON;;;;;N;;;;;
+1D233;GREEK INSTRUMENTAL NOTATION SYMBOL-37;So;0;ON;;;;;N;;;;;
+1D234;GREEK INSTRUMENTAL NOTATION SYMBOL-38;So;0;ON;;;;;N;;;;;
+1D235;GREEK INSTRUMENTAL NOTATION SYMBOL-39;So;0;ON;;;;;N;;;;;
+1D236;GREEK INSTRUMENTAL NOTATION SYMBOL-40;So;0;ON;;;;;N;;;;;
+1D237;GREEK INSTRUMENTAL NOTATION SYMBOL-42;So;0;ON;;;;;N;;;;;
+1D238;GREEK INSTRUMENTAL NOTATION SYMBOL-43;So;0;ON;;;;;N;;;;;
+1D239;GREEK INSTRUMENTAL NOTATION SYMBOL-45;So;0;ON;;;;;N;;;;;
+1D23A;GREEK INSTRUMENTAL NOTATION SYMBOL-47;So;0;ON;;;;;N;;;;;
+1D23B;GREEK INSTRUMENTAL NOTATION SYMBOL-48;So;0;ON;;;;;N;;;;;
+1D23C;GREEK INSTRUMENTAL NOTATION SYMBOL-49;So;0;ON;;;;;N;;;;;
+1D23D;GREEK INSTRUMENTAL NOTATION SYMBOL-50;So;0;ON;;;;;N;;;;;
+1D23E;GREEK INSTRUMENTAL NOTATION SYMBOL-51;So;0;ON;;;;;N;;;;;
+1D23F;GREEK INSTRUMENTAL NOTATION SYMBOL-52;So;0;ON;;;;;N;;;;;
+1D240;GREEK INSTRUMENTAL NOTATION SYMBOL-53;So;0;ON;;;;;N;;;;;
+1D241;GREEK INSTRUMENTAL NOTATION SYMBOL-54;So;0;ON;;;;;N;;;;;
+1D242;COMBINING GREEK MUSICAL TRISEME;Mn;230;NSM;;;;;N;;;;;
+1D243;COMBINING GREEK MUSICAL TETRASEME;Mn;230;NSM;;;;;N;;;;;
+1D244;COMBINING GREEK MUSICAL PENTASEME;Mn;230;NSM;;;;;N;;;;;
+1D245;GREEK MUSICAL LEIMMA;So;0;ON;;;;;N;;;;;
+1D300;MONOGRAM FOR EARTH;So;0;ON;;;;;N;;ren *;;;
+1D301;DIGRAM FOR HEAVENLY EARTH;So;0;ON;;;;;N;;tian ren *;;;
+1D302;DIGRAM FOR HUMAN EARTH;So;0;ON;;;;;N;;di ren *;;;
+1D303;DIGRAM FOR EARTHLY HEAVEN;So;0;ON;;;;;N;;ren tian *;;;
+1D304;DIGRAM FOR EARTHLY HUMAN;So;0;ON;;;;;N;;ren di *;;;
+1D305;DIGRAM FOR EARTH;So;0;ON;;;;;N;;ren ren *;;;
+1D306;TETRAGRAM FOR CENTRE;So;0;ON;;;;;N;;;;;
+1D307;TETRAGRAM FOR FULL CIRCLE;So;0;ON;;;;;N;;;;;
+1D308;TETRAGRAM FOR MIRED;So;0;ON;;;;;N;;;;;
+1D309;TETRAGRAM FOR BARRIER;So;0;ON;;;;;N;;;;;
+1D30A;TETRAGRAM FOR KEEPING SMALL;So;0;ON;;;;;N;;;;;
+1D30B;TETRAGRAM FOR CONTRARIETY;So;0;ON;;;;;N;;;;;
+1D30C;TETRAGRAM FOR ASCENT;So;0;ON;;;;;N;;;;;
+1D30D;TETRAGRAM FOR OPPOSITION;So;0;ON;;;;;N;;;;;
+1D30E;TETRAGRAM FOR BRANCHING OUT;So;0;ON;;;;;N;;;;;
+1D30F;TETRAGRAM FOR DEFECTIVENESS OR DISTORTION;So;0;ON;;;;;N;;;;;
+1D310;TETRAGRAM FOR DIVERGENCE;So;0;ON;;;;;N;;;;;
+1D311;TETRAGRAM FOR YOUTHFULNESS;So;0;ON;;;;;N;;;;;
+1D312;TETRAGRAM FOR INCREASE;So;0;ON;;;;;N;;;;;
+1D313;TETRAGRAM FOR PENETRATION;So;0;ON;;;;;N;;;;;
+1D314;TETRAGRAM FOR REACH;So;0;ON;;;;;N;;;;;
+1D315;TETRAGRAM FOR CONTACT;So;0;ON;;;;;N;;;;;
+1D316;TETRAGRAM FOR HOLDING BACK;So;0;ON;;;;;N;;;;;
+1D317;TETRAGRAM FOR WAITING;So;0;ON;;;;;N;;;;;
+1D318;TETRAGRAM FOR FOLLOWING;So;0;ON;;;;;N;;;;;
+1D319;TETRAGRAM FOR ADVANCE;So;0;ON;;;;;N;;;;;
+1D31A;TETRAGRAM FOR RELEASE;So;0;ON;;;;;N;;;;;
+1D31B;TETRAGRAM FOR RESISTANCE;So;0;ON;;;;;N;;;;;
+1D31C;TETRAGRAM FOR EASE;So;0;ON;;;;;N;;;;;
+1D31D;TETRAGRAM FOR JOY;So;0;ON;;;;;N;;;;;
+1D31E;TETRAGRAM FOR CONTENTION;So;0;ON;;;;;N;;;;;
+1D31F;TETRAGRAM FOR ENDEAVOUR;So;0;ON;;;;;N;;;;;
+1D320;TETRAGRAM FOR DUTIES;So;0;ON;;;;;N;;;;;
+1D321;TETRAGRAM FOR CHANGE;So;0;ON;;;;;N;;;;;
+1D322;TETRAGRAM FOR DECISIVENESS;So;0;ON;;;;;N;;;;;
+1D323;TETRAGRAM FOR BOLD RESOLUTION;So;0;ON;;;;;N;;;;;
+1D324;TETRAGRAM FOR PACKING;So;0;ON;;;;;N;;;;;
+1D325;TETRAGRAM FOR LEGION;So;0;ON;;;;;N;;;;;
+1D326;TETRAGRAM FOR CLOSENESS;So;0;ON;;;;;N;;;;;
+1D327;TETRAGRAM FOR KINSHIP;So;0;ON;;;;;N;;;;;
+1D328;TETRAGRAM FOR GATHERING;So;0;ON;;;;;N;;;;;
+1D329;TETRAGRAM FOR STRENGTH;So;0;ON;;;;;N;;;;;
+1D32A;TETRAGRAM FOR PURITY;So;0;ON;;;;;N;;;;;
+1D32B;TETRAGRAM FOR FULLNESS;So;0;ON;;;;;N;;;;;
+1D32C;TETRAGRAM FOR RESIDENCE;So;0;ON;;;;;N;;;;;
+1D32D;TETRAGRAM FOR LAW OR MODEL;So;0;ON;;;;;N;;;;;
+1D32E;TETRAGRAM FOR RESPONSE;So;0;ON;;;;;N;;;;;
+1D32F;TETRAGRAM FOR GOING TO MEET;So;0;ON;;;;;N;;;;;
+1D330;TETRAGRAM FOR ENCOUNTERS;So;0;ON;;;;;N;;;;;
+1D331;TETRAGRAM FOR STOVE;So;0;ON;;;;;N;;;;;
+1D332;TETRAGRAM FOR GREATNESS;So;0;ON;;;;;N;;;;;
+1D333;TETRAGRAM FOR ENLARGEMENT;So;0;ON;;;;;N;;;;;
+1D334;TETRAGRAM FOR PATTERN;So;0;ON;;;;;N;;;;;
+1D335;TETRAGRAM FOR RITUAL;So;0;ON;;;;;N;;;;;
+1D336;TETRAGRAM FOR FLIGHT;So;0;ON;;;;;N;;;;;
+1D337;TETRAGRAM FOR VASTNESS OR WASTING;So;0;ON;;;;;N;;;;;
+1D338;TETRAGRAM FOR CONSTANCY;So;0;ON;;;;;N;;;;;
+1D339;TETRAGRAM FOR MEASURE;So;0;ON;;;;;N;;;;;
+1D33A;TETRAGRAM FOR ETERNITY;So;0;ON;;;;;N;;;;;
+1D33B;TETRAGRAM FOR UNITY;So;0;ON;;;;;N;;;;;
+1D33C;TETRAGRAM FOR DIMINISHMENT;So;0;ON;;;;;N;;;;;
+1D33D;TETRAGRAM FOR CLOSED MOUTH;So;0;ON;;;;;N;;;;;
+1D33E;TETRAGRAM FOR GUARDEDNESS;So;0;ON;;;;;N;;;;;
+1D33F;TETRAGRAM FOR GATHERING IN;So;0;ON;;;;;N;;;;;
+1D340;TETRAGRAM FOR MASSING;So;0;ON;;;;;N;;;;;
+1D341;TETRAGRAM FOR ACCUMULATION;So;0;ON;;;;;N;;;;;
+1D342;TETRAGRAM FOR EMBELLISHMENT;So;0;ON;;;;;N;;;;;
+1D343;TETRAGRAM FOR DOUBT;So;0;ON;;;;;N;;;;;
+1D344;TETRAGRAM FOR WATCH;So;0;ON;;;;;N;;;;;
+1D345;TETRAGRAM FOR SINKING;So;0;ON;;;;;N;;;;;
+1D346;TETRAGRAM FOR INNER;So;0;ON;;;;;N;;;;;
+1D347;TETRAGRAM FOR DEPARTURE;So;0;ON;;;;;N;;;;;
+1D348;TETRAGRAM FOR DARKENING;So;0;ON;;;;;N;;;;;
+1D349;TETRAGRAM FOR DIMMING;So;0;ON;;;;;N;;;;;
+1D34A;TETRAGRAM FOR EXHAUSTION;So;0;ON;;;;;N;;;;;
+1D34B;TETRAGRAM FOR SEVERANCE;So;0;ON;;;;;N;;;;;
+1D34C;TETRAGRAM FOR STOPPAGE;So;0;ON;;;;;N;;;;;
+1D34D;TETRAGRAM FOR HARDNESS;So;0;ON;;;;;N;;;;;
+1D34E;TETRAGRAM FOR COMPLETION;So;0;ON;;;;;N;;;;;
+1D34F;TETRAGRAM FOR CLOSURE;So;0;ON;;;;;N;;;;;
+1D350;TETRAGRAM FOR FAILURE;So;0;ON;;;;;N;;;;;
+1D351;TETRAGRAM FOR AGGRAVATION;So;0;ON;;;;;N;;;;;
+1D352;TETRAGRAM FOR COMPLIANCE;So;0;ON;;;;;N;;;;;
+1D353;TETRAGRAM FOR ON THE VERGE;So;0;ON;;;;;N;;;;;
+1D354;TETRAGRAM FOR DIFFICULTIES;So;0;ON;;;;;N;;;;;
+1D355;TETRAGRAM FOR LABOURING;So;0;ON;;;;;N;;;;;
+1D356;TETRAGRAM FOR FOSTERING;So;0;ON;;;;;N;;;;;
+1D360;COUNTING ROD UNIT DIGIT ONE;No;0;L;;;;1;N;;;;;
+1D361;COUNTING ROD UNIT DIGIT TWO;No;0;L;;;;2;N;;;;;
+1D362;COUNTING ROD UNIT DIGIT THREE;No;0;L;;;;3;N;;;;;
+1D363;COUNTING ROD UNIT DIGIT FOUR;No;0;L;;;;4;N;;;;;
+1D364;COUNTING ROD UNIT DIGIT FIVE;No;0;L;;;;5;N;;;;;
+1D365;COUNTING ROD UNIT DIGIT SIX;No;0;L;;;;6;N;;;;;
+1D366;COUNTING ROD UNIT DIGIT SEVEN;No;0;L;;;;7;N;;;;;
+1D367;COUNTING ROD UNIT DIGIT EIGHT;No;0;L;;;;8;N;;;;;
+1D368;COUNTING ROD UNIT DIGIT NINE;No;0;L;;;;9;N;;;;;
+1D369;COUNTING ROD TENS DIGIT ONE;No;0;L;;;;10;N;;;;;
+1D36A;COUNTING ROD TENS DIGIT TWO;No;0;L;;;;20;N;;;;;
+1D36B;COUNTING ROD TENS DIGIT THREE;No;0;L;;;;30;N;;;;;
+1D36C;COUNTING ROD TENS DIGIT FOUR;No;0;L;;;;40;N;;;;;
+1D36D;COUNTING ROD TENS DIGIT FIVE;No;0;L;;;;50;N;;;;;
+1D36E;COUNTING ROD TENS DIGIT SIX;No;0;L;;;;60;N;;;;;
+1D36F;COUNTING ROD TENS DIGIT SEVEN;No;0;L;;;;70;N;;;;;
+1D370;COUNTING ROD TENS DIGIT EIGHT;No;0;L;;;;80;N;;;;;
+1D371;COUNTING ROD TENS DIGIT NINE;No;0;L;;;;90;N;;;;;
+1D400;MATHEMATICAL BOLD CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D401;MATHEMATICAL BOLD CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D402;MATHEMATICAL BOLD CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D403;MATHEMATICAL BOLD CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D404;MATHEMATICAL BOLD CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D405;MATHEMATICAL BOLD CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D406;MATHEMATICAL BOLD CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D407;MATHEMATICAL BOLD CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D408;MATHEMATICAL BOLD CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D409;MATHEMATICAL BOLD CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D40A;MATHEMATICAL BOLD CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D40B;MATHEMATICAL BOLD CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D40C;MATHEMATICAL BOLD CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D40D;MATHEMATICAL BOLD CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D40E;MATHEMATICAL BOLD CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D40F;MATHEMATICAL BOLD CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D410;MATHEMATICAL BOLD CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D411;MATHEMATICAL BOLD CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D412;MATHEMATICAL BOLD CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D413;MATHEMATICAL BOLD CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D414;MATHEMATICAL BOLD CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D415;MATHEMATICAL BOLD CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D416;MATHEMATICAL BOLD CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D417;MATHEMATICAL BOLD CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D418;MATHEMATICAL BOLD CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D419;MATHEMATICAL BOLD CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D41A;MATHEMATICAL BOLD SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D41B;MATHEMATICAL BOLD SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D41C;MATHEMATICAL BOLD SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D41D;MATHEMATICAL BOLD SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D41E;MATHEMATICAL BOLD SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D41F;MATHEMATICAL BOLD SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D420;MATHEMATICAL BOLD SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D421;MATHEMATICAL BOLD SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D422;MATHEMATICAL BOLD SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D423;MATHEMATICAL BOLD SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D424;MATHEMATICAL BOLD SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D425;MATHEMATICAL BOLD SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D426;MATHEMATICAL BOLD SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D427;MATHEMATICAL BOLD SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D428;MATHEMATICAL BOLD SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D429;MATHEMATICAL BOLD SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D42A;MATHEMATICAL BOLD SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D42B;MATHEMATICAL BOLD SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D42C;MATHEMATICAL BOLD SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D42D;MATHEMATICAL BOLD SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D42E;MATHEMATICAL BOLD SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D42F;MATHEMATICAL BOLD SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D430;MATHEMATICAL BOLD SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D431;MATHEMATICAL BOLD SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D432;MATHEMATICAL BOLD SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D433;MATHEMATICAL BOLD SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D434;MATHEMATICAL ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D435;MATHEMATICAL ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D436;MATHEMATICAL ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D437;MATHEMATICAL ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D438;MATHEMATICAL ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D439;MATHEMATICAL ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D43A;MATHEMATICAL ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D43B;MATHEMATICAL ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D43C;MATHEMATICAL ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D43D;MATHEMATICAL ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D43E;MATHEMATICAL ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D43F;MATHEMATICAL ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D440;MATHEMATICAL ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D441;MATHEMATICAL ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D442;MATHEMATICAL ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D443;MATHEMATICAL ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D444;MATHEMATICAL ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D445;MATHEMATICAL ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D446;MATHEMATICAL ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D447;MATHEMATICAL ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D448;MATHEMATICAL ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D449;MATHEMATICAL ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D44A;MATHEMATICAL ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D44B;MATHEMATICAL ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D44C;MATHEMATICAL ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D44D;MATHEMATICAL ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D44E;MATHEMATICAL ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D44F;MATHEMATICAL ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D450;MATHEMATICAL ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D451;MATHEMATICAL ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D452;MATHEMATICAL ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D453;MATHEMATICAL ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D454;MATHEMATICAL ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D456;MATHEMATICAL ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D457;MATHEMATICAL ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D458;MATHEMATICAL ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D459;MATHEMATICAL ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D45A;MATHEMATICAL ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D45B;MATHEMATICAL ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D45C;MATHEMATICAL ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D45D;MATHEMATICAL ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D45E;MATHEMATICAL ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D45F;MATHEMATICAL ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D460;MATHEMATICAL ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D461;MATHEMATICAL ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D462;MATHEMATICAL ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D463;MATHEMATICAL ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D464;MATHEMATICAL ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D465;MATHEMATICAL ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D466;MATHEMATICAL ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D467;MATHEMATICAL ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D468;MATHEMATICAL BOLD ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D469;MATHEMATICAL BOLD ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D46A;MATHEMATICAL BOLD ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D46B;MATHEMATICAL BOLD ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D46C;MATHEMATICAL BOLD ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D46D;MATHEMATICAL BOLD ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D46E;MATHEMATICAL BOLD ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D46F;MATHEMATICAL BOLD ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D470;MATHEMATICAL BOLD ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D471;MATHEMATICAL BOLD ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D472;MATHEMATICAL BOLD ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D473;MATHEMATICAL BOLD ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D474;MATHEMATICAL BOLD ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D475;MATHEMATICAL BOLD ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D476;MATHEMATICAL BOLD ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D477;MATHEMATICAL BOLD ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D478;MATHEMATICAL BOLD ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D479;MATHEMATICAL BOLD ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D47A;MATHEMATICAL BOLD ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D47B;MATHEMATICAL BOLD ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D47C;MATHEMATICAL BOLD ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D47D;MATHEMATICAL BOLD ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D47E;MATHEMATICAL BOLD ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D47F;MATHEMATICAL BOLD ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D480;MATHEMATICAL BOLD ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D481;MATHEMATICAL BOLD ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D482;MATHEMATICAL BOLD ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D483;MATHEMATICAL BOLD ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D484;MATHEMATICAL BOLD ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D485;MATHEMATICAL BOLD ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D486;MATHEMATICAL BOLD ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D487;MATHEMATICAL BOLD ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D488;MATHEMATICAL BOLD ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D489;MATHEMATICAL BOLD ITALIC SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D48A;MATHEMATICAL BOLD ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D48B;MATHEMATICAL BOLD ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D48C;MATHEMATICAL BOLD ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D48D;MATHEMATICAL BOLD ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D48E;MATHEMATICAL BOLD ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D48F;MATHEMATICAL BOLD ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D490;MATHEMATICAL BOLD ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D491;MATHEMATICAL BOLD ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D492;MATHEMATICAL BOLD ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D493;MATHEMATICAL BOLD ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D494;MATHEMATICAL BOLD ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D495;MATHEMATICAL BOLD ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D496;MATHEMATICAL BOLD ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D497;MATHEMATICAL BOLD ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D498;MATHEMATICAL BOLD ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D499;MATHEMATICAL BOLD ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D49A;MATHEMATICAL BOLD ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D49B;MATHEMATICAL BOLD ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D49C;MATHEMATICAL SCRIPT CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D49E;MATHEMATICAL SCRIPT CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D49F;MATHEMATICAL SCRIPT CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D4A2;MATHEMATICAL SCRIPT CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D4A5;MATHEMATICAL SCRIPT CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D4A6;MATHEMATICAL SCRIPT CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D4A9;MATHEMATICAL SCRIPT CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D4AA;MATHEMATICAL SCRIPT CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D4AB;MATHEMATICAL SCRIPT CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D4AC;MATHEMATICAL SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D4AE;MATHEMATICAL SCRIPT CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D4AF;MATHEMATICAL SCRIPT CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D4B0;MATHEMATICAL SCRIPT CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D4B1;MATHEMATICAL SCRIPT CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D4B2;MATHEMATICAL SCRIPT CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D4B3;MATHEMATICAL SCRIPT CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D4B4;MATHEMATICAL SCRIPT CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D4B5;MATHEMATICAL SCRIPT CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D4B6;MATHEMATICAL SCRIPT SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D4B7;MATHEMATICAL SCRIPT SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D4B8;MATHEMATICAL SCRIPT SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D4B9;MATHEMATICAL SCRIPT SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D4BB;MATHEMATICAL SCRIPT SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D4BD;MATHEMATICAL SCRIPT SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D4BE;MATHEMATICAL SCRIPT SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D4BF;MATHEMATICAL SCRIPT SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D4C0;MATHEMATICAL SCRIPT SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D4C1;MATHEMATICAL SCRIPT SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D4C2;MATHEMATICAL SCRIPT SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D4C3;MATHEMATICAL SCRIPT SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D4C5;MATHEMATICAL SCRIPT SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D4C6;MATHEMATICAL SCRIPT SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D4C7;MATHEMATICAL SCRIPT SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D4C8;MATHEMATICAL SCRIPT SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D4C9;MATHEMATICAL SCRIPT SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D4CA;MATHEMATICAL SCRIPT SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D4CB;MATHEMATICAL SCRIPT SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D4CC;MATHEMATICAL SCRIPT SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D4CD;MATHEMATICAL SCRIPT SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D4CE;MATHEMATICAL SCRIPT SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D4CF;MATHEMATICAL SCRIPT SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D4D0;MATHEMATICAL BOLD SCRIPT CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D4D1;MATHEMATICAL BOLD SCRIPT CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D4D2;MATHEMATICAL BOLD SCRIPT CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D4D3;MATHEMATICAL BOLD SCRIPT CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D4D4;MATHEMATICAL BOLD SCRIPT CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D4D5;MATHEMATICAL BOLD SCRIPT CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D4D6;MATHEMATICAL BOLD SCRIPT CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D4D7;MATHEMATICAL BOLD SCRIPT CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D4D8;MATHEMATICAL BOLD SCRIPT CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D4D9;MATHEMATICAL BOLD SCRIPT CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D4DA;MATHEMATICAL BOLD SCRIPT CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D4DB;MATHEMATICAL BOLD SCRIPT CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D4DC;MATHEMATICAL BOLD SCRIPT CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D4DD;MATHEMATICAL BOLD SCRIPT CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D4DE;MATHEMATICAL BOLD SCRIPT CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D4DF;MATHEMATICAL BOLD SCRIPT CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D4E0;MATHEMATICAL BOLD SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D4E1;MATHEMATICAL BOLD SCRIPT CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D4E2;MATHEMATICAL BOLD SCRIPT CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D4E3;MATHEMATICAL BOLD SCRIPT CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D4E4;MATHEMATICAL BOLD SCRIPT CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D4E5;MATHEMATICAL BOLD SCRIPT CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D4E6;MATHEMATICAL BOLD SCRIPT CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D4E7;MATHEMATICAL BOLD SCRIPT CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D4E8;MATHEMATICAL BOLD SCRIPT CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D4E9;MATHEMATICAL BOLD SCRIPT CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D4EA;MATHEMATICAL BOLD SCRIPT SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D4EB;MATHEMATICAL BOLD SCRIPT SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D4EC;MATHEMATICAL BOLD SCRIPT SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D4ED;MATHEMATICAL BOLD SCRIPT SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D4EE;MATHEMATICAL BOLD SCRIPT SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D4EF;MATHEMATICAL BOLD SCRIPT SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D4F0;MATHEMATICAL BOLD SCRIPT SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D4F1;MATHEMATICAL BOLD SCRIPT SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D4F2;MATHEMATICAL BOLD SCRIPT SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D4F3;MATHEMATICAL BOLD SCRIPT SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D4F4;MATHEMATICAL BOLD SCRIPT SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D4F5;MATHEMATICAL BOLD SCRIPT SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D4F6;MATHEMATICAL BOLD SCRIPT SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D4F7;MATHEMATICAL BOLD SCRIPT SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D4F8;MATHEMATICAL BOLD SCRIPT SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D4F9;MATHEMATICAL BOLD SCRIPT SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D4FA;MATHEMATICAL BOLD SCRIPT SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D4FB;MATHEMATICAL BOLD SCRIPT SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D4FC;MATHEMATICAL BOLD SCRIPT SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D4FD;MATHEMATICAL BOLD SCRIPT SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D4FE;MATHEMATICAL BOLD SCRIPT SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D4FF;MATHEMATICAL BOLD SCRIPT SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D500;MATHEMATICAL BOLD SCRIPT SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D501;MATHEMATICAL BOLD SCRIPT SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D502;MATHEMATICAL BOLD SCRIPT SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D503;MATHEMATICAL BOLD SCRIPT SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D504;MATHEMATICAL FRAKTUR CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D505;MATHEMATICAL FRAKTUR CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D507;MATHEMATICAL FRAKTUR CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D508;MATHEMATICAL FRAKTUR CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D509;MATHEMATICAL FRAKTUR CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D50A;MATHEMATICAL FRAKTUR CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D50D;MATHEMATICAL FRAKTUR CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D50E;MATHEMATICAL FRAKTUR CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D50F;MATHEMATICAL FRAKTUR CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D510;MATHEMATICAL FRAKTUR CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D511;MATHEMATICAL FRAKTUR CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D512;MATHEMATICAL FRAKTUR CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D513;MATHEMATICAL FRAKTUR CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D514;MATHEMATICAL FRAKTUR CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D516;MATHEMATICAL FRAKTUR CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D517;MATHEMATICAL FRAKTUR CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D518;MATHEMATICAL FRAKTUR CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D519;MATHEMATICAL FRAKTUR CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D51A;MATHEMATICAL FRAKTUR CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D51B;MATHEMATICAL FRAKTUR CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D51C;MATHEMATICAL FRAKTUR CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D51E;MATHEMATICAL FRAKTUR SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D51F;MATHEMATICAL FRAKTUR SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D520;MATHEMATICAL FRAKTUR SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D521;MATHEMATICAL FRAKTUR SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D522;MATHEMATICAL FRAKTUR SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D523;MATHEMATICAL FRAKTUR SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D524;MATHEMATICAL FRAKTUR SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D525;MATHEMATICAL FRAKTUR SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D526;MATHEMATICAL FRAKTUR SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D527;MATHEMATICAL FRAKTUR SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D528;MATHEMATICAL FRAKTUR SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D529;MATHEMATICAL FRAKTUR SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D52A;MATHEMATICAL FRAKTUR SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D52B;MATHEMATICAL FRAKTUR SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D52C;MATHEMATICAL FRAKTUR SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D52D;MATHEMATICAL FRAKTUR SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D52E;MATHEMATICAL FRAKTUR SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D52F;MATHEMATICAL FRAKTUR SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D530;MATHEMATICAL FRAKTUR SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D531;MATHEMATICAL FRAKTUR SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D532;MATHEMATICAL FRAKTUR SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D533;MATHEMATICAL FRAKTUR SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D534;MATHEMATICAL FRAKTUR SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D535;MATHEMATICAL FRAKTUR SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D536;MATHEMATICAL FRAKTUR SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D537;MATHEMATICAL FRAKTUR SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D538;MATHEMATICAL DOUBLE-STRUCK CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D539;MATHEMATICAL DOUBLE-STRUCK CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D53B;MATHEMATICAL DOUBLE-STRUCK CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D53C;MATHEMATICAL DOUBLE-STRUCK CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D53D;MATHEMATICAL DOUBLE-STRUCK CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D53E;MATHEMATICAL DOUBLE-STRUCK CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D540;MATHEMATICAL DOUBLE-STRUCK CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D541;MATHEMATICAL DOUBLE-STRUCK CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D542;MATHEMATICAL DOUBLE-STRUCK CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D543;MATHEMATICAL DOUBLE-STRUCK CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D544;MATHEMATICAL DOUBLE-STRUCK CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D546;MATHEMATICAL DOUBLE-STRUCK CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D54A;MATHEMATICAL DOUBLE-STRUCK CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D54B;MATHEMATICAL DOUBLE-STRUCK CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D54C;MATHEMATICAL DOUBLE-STRUCK CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D54D;MATHEMATICAL DOUBLE-STRUCK CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D54E;MATHEMATICAL DOUBLE-STRUCK CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D54F;MATHEMATICAL DOUBLE-STRUCK CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D550;MATHEMATICAL DOUBLE-STRUCK CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D552;MATHEMATICAL DOUBLE-STRUCK SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D553;MATHEMATICAL DOUBLE-STRUCK SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D554;MATHEMATICAL DOUBLE-STRUCK SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D555;MATHEMATICAL DOUBLE-STRUCK SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D556;MATHEMATICAL DOUBLE-STRUCK SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D557;MATHEMATICAL DOUBLE-STRUCK SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D558;MATHEMATICAL DOUBLE-STRUCK SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D559;MATHEMATICAL DOUBLE-STRUCK SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D55A;MATHEMATICAL DOUBLE-STRUCK SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D55B;MATHEMATICAL DOUBLE-STRUCK SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D55C;MATHEMATICAL DOUBLE-STRUCK SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D55D;MATHEMATICAL DOUBLE-STRUCK SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D55E;MATHEMATICAL DOUBLE-STRUCK SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D55F;MATHEMATICAL DOUBLE-STRUCK SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D560;MATHEMATICAL DOUBLE-STRUCK SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D561;MATHEMATICAL DOUBLE-STRUCK SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D562;MATHEMATICAL DOUBLE-STRUCK SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D563;MATHEMATICAL DOUBLE-STRUCK SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D564;MATHEMATICAL DOUBLE-STRUCK SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D565;MATHEMATICAL DOUBLE-STRUCK SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D566;MATHEMATICAL DOUBLE-STRUCK SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D567;MATHEMATICAL DOUBLE-STRUCK SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D568;MATHEMATICAL DOUBLE-STRUCK SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D569;MATHEMATICAL DOUBLE-STRUCK SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D56A;MATHEMATICAL DOUBLE-STRUCK SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D56B;MATHEMATICAL DOUBLE-STRUCK SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D56C;MATHEMATICAL BOLD FRAKTUR CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D56D;MATHEMATICAL BOLD FRAKTUR CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D56E;MATHEMATICAL BOLD FRAKTUR CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D56F;MATHEMATICAL BOLD FRAKTUR CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D570;MATHEMATICAL BOLD FRAKTUR CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D571;MATHEMATICAL BOLD FRAKTUR CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D572;MATHEMATICAL BOLD FRAKTUR CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D573;MATHEMATICAL BOLD FRAKTUR CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D574;MATHEMATICAL BOLD FRAKTUR CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D575;MATHEMATICAL BOLD FRAKTUR CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D576;MATHEMATICAL BOLD FRAKTUR CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D577;MATHEMATICAL BOLD FRAKTUR CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D578;MATHEMATICAL BOLD FRAKTUR CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D579;MATHEMATICAL BOLD FRAKTUR CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D57A;MATHEMATICAL BOLD FRAKTUR CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D57B;MATHEMATICAL BOLD FRAKTUR CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D57C;MATHEMATICAL BOLD FRAKTUR CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D57D;MATHEMATICAL BOLD FRAKTUR CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D57E;MATHEMATICAL BOLD FRAKTUR CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D57F;MATHEMATICAL BOLD FRAKTUR CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D580;MATHEMATICAL BOLD FRAKTUR CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D581;MATHEMATICAL BOLD FRAKTUR CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D582;MATHEMATICAL BOLD FRAKTUR CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D583;MATHEMATICAL BOLD FRAKTUR CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D584;MATHEMATICAL BOLD FRAKTUR CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D585;MATHEMATICAL BOLD FRAKTUR CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D586;MATHEMATICAL BOLD FRAKTUR SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D587;MATHEMATICAL BOLD FRAKTUR SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D588;MATHEMATICAL BOLD FRAKTUR SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D589;MATHEMATICAL BOLD FRAKTUR SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D58A;MATHEMATICAL BOLD FRAKTUR SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D58B;MATHEMATICAL BOLD FRAKTUR SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D58C;MATHEMATICAL BOLD FRAKTUR SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D58D;MATHEMATICAL BOLD FRAKTUR SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D58E;MATHEMATICAL BOLD FRAKTUR SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D58F;MATHEMATICAL BOLD FRAKTUR SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D590;MATHEMATICAL BOLD FRAKTUR SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D591;MATHEMATICAL BOLD FRAKTUR SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D592;MATHEMATICAL BOLD FRAKTUR SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D593;MATHEMATICAL BOLD FRAKTUR SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D594;MATHEMATICAL BOLD FRAKTUR SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D595;MATHEMATICAL BOLD FRAKTUR SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D596;MATHEMATICAL BOLD FRAKTUR SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D597;MATHEMATICAL BOLD FRAKTUR SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D598;MATHEMATICAL BOLD FRAKTUR SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D599;MATHEMATICAL BOLD FRAKTUR SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D59A;MATHEMATICAL BOLD FRAKTUR SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D59B;MATHEMATICAL BOLD FRAKTUR SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D59C;MATHEMATICAL BOLD FRAKTUR SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D59D;MATHEMATICAL BOLD FRAKTUR SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D59E;MATHEMATICAL BOLD FRAKTUR SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D59F;MATHEMATICAL BOLD FRAKTUR SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D5A0;MATHEMATICAL SANS-SERIF CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D5A1;MATHEMATICAL SANS-SERIF CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D5A2;MATHEMATICAL SANS-SERIF CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D5A3;MATHEMATICAL SANS-SERIF CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D5A4;MATHEMATICAL SANS-SERIF CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D5A5;MATHEMATICAL SANS-SERIF CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D5A6;MATHEMATICAL SANS-SERIF CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D5A7;MATHEMATICAL SANS-SERIF CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D5A8;MATHEMATICAL SANS-SERIF CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D5A9;MATHEMATICAL SANS-SERIF CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D5AA;MATHEMATICAL SANS-SERIF CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D5AB;MATHEMATICAL SANS-SERIF CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D5AC;MATHEMATICAL SANS-SERIF CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D5AD;MATHEMATICAL SANS-SERIF CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D5AE;MATHEMATICAL SANS-SERIF CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D5AF;MATHEMATICAL SANS-SERIF CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D5B0;MATHEMATICAL SANS-SERIF CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D5B1;MATHEMATICAL SANS-SERIF CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D5B2;MATHEMATICAL SANS-SERIF CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D5B3;MATHEMATICAL SANS-SERIF CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D5B4;MATHEMATICAL SANS-SERIF CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D5B5;MATHEMATICAL SANS-SERIF CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D5B6;MATHEMATICAL SANS-SERIF CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D5B7;MATHEMATICAL SANS-SERIF CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D5B8;MATHEMATICAL SANS-SERIF CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D5B9;MATHEMATICAL SANS-SERIF CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D5BA;MATHEMATICAL SANS-SERIF SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D5BB;MATHEMATICAL SANS-SERIF SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D5BC;MATHEMATICAL SANS-SERIF SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D5BD;MATHEMATICAL SANS-SERIF SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D5BE;MATHEMATICAL SANS-SERIF SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D5BF;MATHEMATICAL SANS-SERIF SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D5C0;MATHEMATICAL SANS-SERIF SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D5C1;MATHEMATICAL SANS-SERIF SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D5C2;MATHEMATICAL SANS-SERIF SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D5C3;MATHEMATICAL SANS-SERIF SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D5C4;MATHEMATICAL SANS-SERIF SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D5C5;MATHEMATICAL SANS-SERIF SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D5C6;MATHEMATICAL SANS-SERIF SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D5C7;MATHEMATICAL SANS-SERIF SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D5C8;MATHEMATICAL SANS-SERIF SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D5C9;MATHEMATICAL SANS-SERIF SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D5CA;MATHEMATICAL SANS-SERIF SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D5CB;MATHEMATICAL SANS-SERIF SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D5CC;MATHEMATICAL SANS-SERIF SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D5CD;MATHEMATICAL SANS-SERIF SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D5CE;MATHEMATICAL SANS-SERIF SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D5CF;MATHEMATICAL SANS-SERIF SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D5D0;MATHEMATICAL SANS-SERIF SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D5D1;MATHEMATICAL SANS-SERIF SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D5D2;MATHEMATICAL SANS-SERIF SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D5D3;MATHEMATICAL SANS-SERIF SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D5D4;MATHEMATICAL SANS-SERIF BOLD CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D5D5;MATHEMATICAL SANS-SERIF BOLD CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D5D6;MATHEMATICAL SANS-SERIF BOLD CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D5D7;MATHEMATICAL SANS-SERIF BOLD CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D5D8;MATHEMATICAL SANS-SERIF BOLD CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D5D9;MATHEMATICAL SANS-SERIF BOLD CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D5DA;MATHEMATICAL SANS-SERIF BOLD CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D5DB;MATHEMATICAL SANS-SERIF BOLD CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D5DC;MATHEMATICAL SANS-SERIF BOLD CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D5DD;MATHEMATICAL SANS-SERIF BOLD CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D5DE;MATHEMATICAL SANS-SERIF BOLD CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D5DF;MATHEMATICAL SANS-SERIF BOLD CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D5E0;MATHEMATICAL SANS-SERIF BOLD CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D5E1;MATHEMATICAL SANS-SERIF BOLD CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D5E2;MATHEMATICAL SANS-SERIF BOLD CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D5E3;MATHEMATICAL SANS-SERIF BOLD CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D5E4;MATHEMATICAL SANS-SERIF BOLD CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D5E5;MATHEMATICAL SANS-SERIF BOLD CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D5E6;MATHEMATICAL SANS-SERIF BOLD CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D5E7;MATHEMATICAL SANS-SERIF BOLD CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D5E8;MATHEMATICAL SANS-SERIF BOLD CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D5E9;MATHEMATICAL SANS-SERIF BOLD CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D5EA;MATHEMATICAL SANS-SERIF BOLD CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D5EB;MATHEMATICAL SANS-SERIF BOLD CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D5EC;MATHEMATICAL SANS-SERIF BOLD CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D5ED;MATHEMATICAL SANS-SERIF BOLD CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D5EE;MATHEMATICAL SANS-SERIF BOLD SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D5EF;MATHEMATICAL SANS-SERIF BOLD SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D5F0;MATHEMATICAL SANS-SERIF BOLD SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D5F1;MATHEMATICAL SANS-SERIF BOLD SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D5F2;MATHEMATICAL SANS-SERIF BOLD SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D5F3;MATHEMATICAL SANS-SERIF BOLD SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D5F4;MATHEMATICAL SANS-SERIF BOLD SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D5F5;MATHEMATICAL SANS-SERIF BOLD SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D5F6;MATHEMATICAL SANS-SERIF BOLD SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D5F7;MATHEMATICAL SANS-SERIF BOLD SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D5F8;MATHEMATICAL SANS-SERIF BOLD SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D5F9;MATHEMATICAL SANS-SERIF BOLD SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D5FA;MATHEMATICAL SANS-SERIF BOLD SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D5FB;MATHEMATICAL SANS-SERIF BOLD SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D5FC;MATHEMATICAL SANS-SERIF BOLD SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D5FD;MATHEMATICAL SANS-SERIF BOLD SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D5FE;MATHEMATICAL SANS-SERIF BOLD SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D5FF;MATHEMATICAL SANS-SERIF BOLD SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D600;MATHEMATICAL SANS-SERIF BOLD SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D601;MATHEMATICAL SANS-SERIF BOLD SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D602;MATHEMATICAL SANS-SERIF BOLD SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D603;MATHEMATICAL SANS-SERIF BOLD SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D604;MATHEMATICAL SANS-SERIF BOLD SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D605;MATHEMATICAL SANS-SERIF BOLD SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D606;MATHEMATICAL SANS-SERIF BOLD SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D607;MATHEMATICAL SANS-SERIF BOLD SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D608;MATHEMATICAL SANS-SERIF ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D609;MATHEMATICAL SANS-SERIF ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D60A;MATHEMATICAL SANS-SERIF ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D60B;MATHEMATICAL SANS-SERIF ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D60C;MATHEMATICAL SANS-SERIF ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D60D;MATHEMATICAL SANS-SERIF ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D60E;MATHEMATICAL SANS-SERIF ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D60F;MATHEMATICAL SANS-SERIF ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D610;MATHEMATICAL SANS-SERIF ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D611;MATHEMATICAL SANS-SERIF ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D612;MATHEMATICAL SANS-SERIF ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D613;MATHEMATICAL SANS-SERIF ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D614;MATHEMATICAL SANS-SERIF ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D615;MATHEMATICAL SANS-SERIF ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D616;MATHEMATICAL SANS-SERIF ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D617;MATHEMATICAL SANS-SERIF ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D618;MATHEMATICAL SANS-SERIF ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D619;MATHEMATICAL SANS-SERIF ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D61A;MATHEMATICAL SANS-SERIF ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D61B;MATHEMATICAL SANS-SERIF ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D61C;MATHEMATICAL SANS-SERIF ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D61D;MATHEMATICAL SANS-SERIF ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D61E;MATHEMATICAL SANS-SERIF ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D61F;MATHEMATICAL SANS-SERIF ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D620;MATHEMATICAL SANS-SERIF ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D621;MATHEMATICAL SANS-SERIF ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D622;MATHEMATICAL SANS-SERIF ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D623;MATHEMATICAL SANS-SERIF ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D624;MATHEMATICAL SANS-SERIF ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D625;MATHEMATICAL SANS-SERIF ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D626;MATHEMATICAL SANS-SERIF ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D627;MATHEMATICAL SANS-SERIF ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D628;MATHEMATICAL SANS-SERIF ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D629;MATHEMATICAL SANS-SERIF ITALIC SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D62A;MATHEMATICAL SANS-SERIF ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D62B;MATHEMATICAL SANS-SERIF ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D62C;MATHEMATICAL SANS-SERIF ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D62D;MATHEMATICAL SANS-SERIF ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D62E;MATHEMATICAL SANS-SERIF ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D62F;MATHEMATICAL SANS-SERIF ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D630;MATHEMATICAL SANS-SERIF ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D631;MATHEMATICAL SANS-SERIF ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D632;MATHEMATICAL SANS-SERIF ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D633;MATHEMATICAL SANS-SERIF ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D634;MATHEMATICAL SANS-SERIF ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D635;MATHEMATICAL SANS-SERIF ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D636;MATHEMATICAL SANS-SERIF ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D637;MATHEMATICAL SANS-SERIF ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D638;MATHEMATICAL SANS-SERIF ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D639;MATHEMATICAL SANS-SERIF ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D63A;MATHEMATICAL SANS-SERIF ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D63B;MATHEMATICAL SANS-SERIF ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D63C;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D63D;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D63E;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D63F;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D640;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D641;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D642;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D643;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D644;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D645;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D646;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D647;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D648;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D649;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D64A;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D64B;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D64C;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D64D;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D64E;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D64F;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D650;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D651;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D652;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D653;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D654;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D655;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D656;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D657;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D658;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D659;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D65A;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D65B;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D65C;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D65D;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D65E;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D65F;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D660;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D661;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D662;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D663;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D664;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D665;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D666;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D667;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D668;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D669;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D66A;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D66B;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D66C;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D66D;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D66E;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D66F;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D670;MATHEMATICAL MONOSPACE CAPITAL A;Lu;0;L;<font> 0041;;;;N;;;;;
+1D671;MATHEMATICAL MONOSPACE CAPITAL B;Lu;0;L;<font> 0042;;;;N;;;;;
+1D672;MATHEMATICAL MONOSPACE CAPITAL C;Lu;0;L;<font> 0043;;;;N;;;;;
+1D673;MATHEMATICAL MONOSPACE CAPITAL D;Lu;0;L;<font> 0044;;;;N;;;;;
+1D674;MATHEMATICAL MONOSPACE CAPITAL E;Lu;0;L;<font> 0045;;;;N;;;;;
+1D675;MATHEMATICAL MONOSPACE CAPITAL F;Lu;0;L;<font> 0046;;;;N;;;;;
+1D676;MATHEMATICAL MONOSPACE CAPITAL G;Lu;0;L;<font> 0047;;;;N;;;;;
+1D677;MATHEMATICAL MONOSPACE CAPITAL H;Lu;0;L;<font> 0048;;;;N;;;;;
+1D678;MATHEMATICAL MONOSPACE CAPITAL I;Lu;0;L;<font> 0049;;;;N;;;;;
+1D679;MATHEMATICAL MONOSPACE CAPITAL J;Lu;0;L;<font> 004A;;;;N;;;;;
+1D67A;MATHEMATICAL MONOSPACE CAPITAL K;Lu;0;L;<font> 004B;;;;N;;;;;
+1D67B;MATHEMATICAL MONOSPACE CAPITAL L;Lu;0;L;<font> 004C;;;;N;;;;;
+1D67C;MATHEMATICAL MONOSPACE CAPITAL M;Lu;0;L;<font> 004D;;;;N;;;;;
+1D67D;MATHEMATICAL MONOSPACE CAPITAL N;Lu;0;L;<font> 004E;;;;N;;;;;
+1D67E;MATHEMATICAL MONOSPACE CAPITAL O;Lu;0;L;<font> 004F;;;;N;;;;;
+1D67F;MATHEMATICAL MONOSPACE CAPITAL P;Lu;0;L;<font> 0050;;;;N;;;;;
+1D680;MATHEMATICAL MONOSPACE CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
+1D681;MATHEMATICAL MONOSPACE CAPITAL R;Lu;0;L;<font> 0052;;;;N;;;;;
+1D682;MATHEMATICAL MONOSPACE CAPITAL S;Lu;0;L;<font> 0053;;;;N;;;;;
+1D683;MATHEMATICAL MONOSPACE CAPITAL T;Lu;0;L;<font> 0054;;;;N;;;;;
+1D684;MATHEMATICAL MONOSPACE CAPITAL U;Lu;0;L;<font> 0055;;;;N;;;;;
+1D685;MATHEMATICAL MONOSPACE CAPITAL V;Lu;0;L;<font> 0056;;;;N;;;;;
+1D686;MATHEMATICAL MONOSPACE CAPITAL W;Lu;0;L;<font> 0057;;;;N;;;;;
+1D687;MATHEMATICAL MONOSPACE CAPITAL X;Lu;0;L;<font> 0058;;;;N;;;;;
+1D688;MATHEMATICAL MONOSPACE CAPITAL Y;Lu;0;L;<font> 0059;;;;N;;;;;
+1D689;MATHEMATICAL MONOSPACE CAPITAL Z;Lu;0;L;<font> 005A;;;;N;;;;;
+1D68A;MATHEMATICAL MONOSPACE SMALL A;Ll;0;L;<font> 0061;;;;N;;;;;
+1D68B;MATHEMATICAL MONOSPACE SMALL B;Ll;0;L;<font> 0062;;;;N;;;;;
+1D68C;MATHEMATICAL MONOSPACE SMALL C;Ll;0;L;<font> 0063;;;;N;;;;;
+1D68D;MATHEMATICAL MONOSPACE SMALL D;Ll;0;L;<font> 0064;;;;N;;;;;
+1D68E;MATHEMATICAL MONOSPACE SMALL E;Ll;0;L;<font> 0065;;;;N;;;;;
+1D68F;MATHEMATICAL MONOSPACE SMALL F;Ll;0;L;<font> 0066;;;;N;;;;;
+1D690;MATHEMATICAL MONOSPACE SMALL G;Ll;0;L;<font> 0067;;;;N;;;;;
+1D691;MATHEMATICAL MONOSPACE SMALL H;Ll;0;L;<font> 0068;;;;N;;;;;
+1D692;MATHEMATICAL MONOSPACE SMALL I;Ll;0;L;<font> 0069;;;;N;;;;;
+1D693;MATHEMATICAL MONOSPACE SMALL J;Ll;0;L;<font> 006A;;;;N;;;;;
+1D694;MATHEMATICAL MONOSPACE SMALL K;Ll;0;L;<font> 006B;;;;N;;;;;
+1D695;MATHEMATICAL MONOSPACE SMALL L;Ll;0;L;<font> 006C;;;;N;;;;;
+1D696;MATHEMATICAL MONOSPACE SMALL M;Ll;0;L;<font> 006D;;;;N;;;;;
+1D697;MATHEMATICAL MONOSPACE SMALL N;Ll;0;L;<font> 006E;;;;N;;;;;
+1D698;MATHEMATICAL MONOSPACE SMALL O;Ll;0;L;<font> 006F;;;;N;;;;;
+1D699;MATHEMATICAL MONOSPACE SMALL P;Ll;0;L;<font> 0070;;;;N;;;;;
+1D69A;MATHEMATICAL MONOSPACE SMALL Q;Ll;0;L;<font> 0071;;;;N;;;;;
+1D69B;MATHEMATICAL MONOSPACE SMALL R;Ll;0;L;<font> 0072;;;;N;;;;;
+1D69C;MATHEMATICAL MONOSPACE SMALL S;Ll;0;L;<font> 0073;;;;N;;;;;
+1D69D;MATHEMATICAL MONOSPACE SMALL T;Ll;0;L;<font> 0074;;;;N;;;;;
+1D69E;MATHEMATICAL MONOSPACE SMALL U;Ll;0;L;<font> 0075;;;;N;;;;;
+1D69F;MATHEMATICAL MONOSPACE SMALL V;Ll;0;L;<font> 0076;;;;N;;;;;
+1D6A0;MATHEMATICAL MONOSPACE SMALL W;Ll;0;L;<font> 0077;;;;N;;;;;
+1D6A1;MATHEMATICAL MONOSPACE SMALL X;Ll;0;L;<font> 0078;;;;N;;;;;
+1D6A2;MATHEMATICAL MONOSPACE SMALL Y;Ll;0;L;<font> 0079;;;;N;;;;;
+1D6A3;MATHEMATICAL MONOSPACE SMALL Z;Ll;0;L;<font> 007A;;;;N;;;;;
+1D6A4;MATHEMATICAL ITALIC SMALL DOTLESS I;Ll;0;L;<font> 0131;;;;N;;;;;
+1D6A5;MATHEMATICAL ITALIC SMALL DOTLESS J;Ll;0;L;<font> 0237;;;;N;;;;;
+1D6A8;MATHEMATICAL BOLD CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;;
+1D6A9;MATHEMATICAL BOLD CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;;
+1D6AA;MATHEMATICAL BOLD CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;;
+1D6AB;MATHEMATICAL BOLD CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;;
+1D6AC;MATHEMATICAL BOLD CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;;
+1D6AD;MATHEMATICAL BOLD CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;;
+1D6AE;MATHEMATICAL BOLD CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;;
+1D6AF;MATHEMATICAL BOLD CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;;
+1D6B0;MATHEMATICAL BOLD CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;;
+1D6B1;MATHEMATICAL BOLD CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;;
+1D6B2;MATHEMATICAL BOLD CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;;
+1D6B3;MATHEMATICAL BOLD CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;;
+1D6B4;MATHEMATICAL BOLD CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;;
+1D6B5;MATHEMATICAL BOLD CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;;
+1D6B6;MATHEMATICAL BOLD CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;;
+1D6B7;MATHEMATICAL BOLD CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;;
+1D6B8;MATHEMATICAL BOLD CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;;
+1D6B9;MATHEMATICAL BOLD CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;;
+1D6BA;MATHEMATICAL BOLD CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;;
+1D6BB;MATHEMATICAL BOLD CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;;
+1D6BC;MATHEMATICAL BOLD CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;;
+1D6BD;MATHEMATICAL BOLD CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;;
+1D6BE;MATHEMATICAL BOLD CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;;
+1D6BF;MATHEMATICAL BOLD CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;;
+1D6C0;MATHEMATICAL BOLD CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;;
+1D6C1;MATHEMATICAL BOLD NABLA;Sm;0;L;<font> 2207;;;;N;;;;;
+1D6C2;MATHEMATICAL BOLD SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;;
+1D6C3;MATHEMATICAL BOLD SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;;
+1D6C4;MATHEMATICAL BOLD SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;;
+1D6C5;MATHEMATICAL BOLD SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;;
+1D6C6;MATHEMATICAL BOLD SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;;
+1D6C7;MATHEMATICAL BOLD SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;;
+1D6C8;MATHEMATICAL BOLD SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;;
+1D6C9;MATHEMATICAL BOLD SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;;
+1D6CA;MATHEMATICAL BOLD SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;;
+1D6CB;MATHEMATICAL BOLD SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;;
+1D6CC;MATHEMATICAL BOLD SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;;
+1D6CD;MATHEMATICAL BOLD SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;;
+1D6CE;MATHEMATICAL BOLD SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;;
+1D6CF;MATHEMATICAL BOLD SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;;
+1D6D0;MATHEMATICAL BOLD SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;;
+1D6D1;MATHEMATICAL BOLD SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;;
+1D6D2;MATHEMATICAL BOLD SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;;
+1D6D3;MATHEMATICAL BOLD SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;;
+1D6D4;MATHEMATICAL BOLD SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;;
+1D6D5;MATHEMATICAL BOLD SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;;
+1D6D6;MATHEMATICAL BOLD SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;;
+1D6D7;MATHEMATICAL BOLD SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;;
+1D6D8;MATHEMATICAL BOLD SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;;
+1D6D9;MATHEMATICAL BOLD SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;;
+1D6DA;MATHEMATICAL BOLD SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;;
+1D6DB;MATHEMATICAL BOLD PARTIAL DIFFERENTIAL;Sm;0;L;<font> 2202;;;;Y;;;;;
+1D6DC;MATHEMATICAL BOLD EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;;
+1D6DD;MATHEMATICAL BOLD THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;;
+1D6DE;MATHEMATICAL BOLD KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;;
+1D6DF;MATHEMATICAL BOLD PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;;
+1D6E0;MATHEMATICAL BOLD RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;;
+1D6E1;MATHEMATICAL BOLD PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;;
+1D6E2;MATHEMATICAL ITALIC CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;;
+1D6E3;MATHEMATICAL ITALIC CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;;
+1D6E4;MATHEMATICAL ITALIC CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;;
+1D6E5;MATHEMATICAL ITALIC CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;;
+1D6E6;MATHEMATICAL ITALIC CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;;
+1D6E7;MATHEMATICAL ITALIC CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;;
+1D6E8;MATHEMATICAL ITALIC CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;;
+1D6E9;MATHEMATICAL ITALIC CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;;
+1D6EA;MATHEMATICAL ITALIC CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;;
+1D6EB;MATHEMATICAL ITALIC CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;;
+1D6EC;MATHEMATICAL ITALIC CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;;
+1D6ED;MATHEMATICAL ITALIC CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;;
+1D6EE;MATHEMATICAL ITALIC CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;;
+1D6EF;MATHEMATICAL ITALIC CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;;
+1D6F0;MATHEMATICAL ITALIC CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;;
+1D6F1;MATHEMATICAL ITALIC CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;;
+1D6F2;MATHEMATICAL ITALIC CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;;
+1D6F3;MATHEMATICAL ITALIC CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;;
+1D6F4;MATHEMATICAL ITALIC CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;;
+1D6F5;MATHEMATICAL ITALIC CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;;
+1D6F6;MATHEMATICAL ITALIC CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;;
+1D6F7;MATHEMATICAL ITALIC CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;;
+1D6F8;MATHEMATICAL ITALIC CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;;
+1D6F9;MATHEMATICAL ITALIC CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;;
+1D6FA;MATHEMATICAL ITALIC CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;;
+1D6FB;MATHEMATICAL ITALIC NABLA;Sm;0;L;<font> 2207;;;;N;;;;;
+1D6FC;MATHEMATICAL ITALIC SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;;
+1D6FD;MATHEMATICAL ITALIC SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;;
+1D6FE;MATHEMATICAL ITALIC SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;;
+1D6FF;MATHEMATICAL ITALIC SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;;
+1D700;MATHEMATICAL ITALIC SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;;
+1D701;MATHEMATICAL ITALIC SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;;
+1D702;MATHEMATICAL ITALIC SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;;
+1D703;MATHEMATICAL ITALIC SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;;
+1D704;MATHEMATICAL ITALIC SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;;
+1D705;MATHEMATICAL ITALIC SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;;
+1D706;MATHEMATICAL ITALIC SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;;
+1D707;MATHEMATICAL ITALIC SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;;
+1D708;MATHEMATICAL ITALIC SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;;
+1D709;MATHEMATICAL ITALIC SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;;
+1D70A;MATHEMATICAL ITALIC SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;;
+1D70B;MATHEMATICAL ITALIC SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;;
+1D70C;MATHEMATICAL ITALIC SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;;
+1D70D;MATHEMATICAL ITALIC SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;;
+1D70E;MATHEMATICAL ITALIC SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;;
+1D70F;MATHEMATICAL ITALIC SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;;
+1D710;MATHEMATICAL ITALIC SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;;
+1D711;MATHEMATICAL ITALIC SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;;
+1D712;MATHEMATICAL ITALIC SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;;
+1D713;MATHEMATICAL ITALIC SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;;
+1D714;MATHEMATICAL ITALIC SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;;
+1D715;MATHEMATICAL ITALIC PARTIAL DIFFERENTIAL;Sm;0;L;<font> 2202;;;;Y;;;;;
+1D716;MATHEMATICAL ITALIC EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;;
+1D717;MATHEMATICAL ITALIC THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;;
+1D718;MATHEMATICAL ITALIC KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;;
+1D719;MATHEMATICAL ITALIC PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;;
+1D71A;MATHEMATICAL ITALIC RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;;
+1D71B;MATHEMATICAL ITALIC PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;;
+1D71C;MATHEMATICAL BOLD ITALIC CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;;
+1D71D;MATHEMATICAL BOLD ITALIC CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;;
+1D71E;MATHEMATICAL BOLD ITALIC CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;;
+1D71F;MATHEMATICAL BOLD ITALIC CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;;
+1D720;MATHEMATICAL BOLD ITALIC CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;;
+1D721;MATHEMATICAL BOLD ITALIC CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;;
+1D722;MATHEMATICAL BOLD ITALIC CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;;
+1D723;MATHEMATICAL BOLD ITALIC CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;;
+1D724;MATHEMATICAL BOLD ITALIC CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;;
+1D725;MATHEMATICAL BOLD ITALIC CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;;
+1D726;MATHEMATICAL BOLD ITALIC CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;;
+1D727;MATHEMATICAL BOLD ITALIC CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;;
+1D728;MATHEMATICAL BOLD ITALIC CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;;
+1D729;MATHEMATICAL BOLD ITALIC CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;;
+1D72A;MATHEMATICAL BOLD ITALIC CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;;
+1D72B;MATHEMATICAL BOLD ITALIC CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;;
+1D72C;MATHEMATICAL BOLD ITALIC CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;;
+1D72D;MATHEMATICAL BOLD ITALIC CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;;
+1D72E;MATHEMATICAL BOLD ITALIC CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;;
+1D72F;MATHEMATICAL BOLD ITALIC CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;;
+1D730;MATHEMATICAL BOLD ITALIC CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;;
+1D731;MATHEMATICAL BOLD ITALIC CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;;
+1D732;MATHEMATICAL BOLD ITALIC CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;;
+1D733;MATHEMATICAL BOLD ITALIC CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;;
+1D734;MATHEMATICAL BOLD ITALIC CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;;
+1D735;MATHEMATICAL BOLD ITALIC NABLA;Sm;0;L;<font> 2207;;;;N;;;;;
+1D736;MATHEMATICAL BOLD ITALIC SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;;
+1D737;MATHEMATICAL BOLD ITALIC SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;;
+1D738;MATHEMATICAL BOLD ITALIC SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;;
+1D739;MATHEMATICAL BOLD ITALIC SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;;
+1D73A;MATHEMATICAL BOLD ITALIC SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;;
+1D73B;MATHEMATICAL BOLD ITALIC SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;;
+1D73C;MATHEMATICAL BOLD ITALIC SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;;
+1D73D;MATHEMATICAL BOLD ITALIC SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;;
+1D73E;MATHEMATICAL BOLD ITALIC SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;;
+1D73F;MATHEMATICAL BOLD ITALIC SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;;
+1D740;MATHEMATICAL BOLD ITALIC SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;;
+1D741;MATHEMATICAL BOLD ITALIC SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;;
+1D742;MATHEMATICAL BOLD ITALIC SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;;
+1D743;MATHEMATICAL BOLD ITALIC SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;;
+1D744;MATHEMATICAL BOLD ITALIC SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;;
+1D745;MATHEMATICAL BOLD ITALIC SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;;
+1D746;MATHEMATICAL BOLD ITALIC SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;;
+1D747;MATHEMATICAL BOLD ITALIC SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;;
+1D748;MATHEMATICAL BOLD ITALIC SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;;
+1D749;MATHEMATICAL BOLD ITALIC SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;;
+1D74A;MATHEMATICAL BOLD ITALIC SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;;
+1D74B;MATHEMATICAL BOLD ITALIC SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;;
+1D74C;MATHEMATICAL BOLD ITALIC SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;;
+1D74D;MATHEMATICAL BOLD ITALIC SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;;
+1D74E;MATHEMATICAL BOLD ITALIC SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;;
+1D74F;MATHEMATICAL BOLD ITALIC PARTIAL DIFFERENTIAL;Sm;0;L;<font> 2202;;;;Y;;;;;
+1D750;MATHEMATICAL BOLD ITALIC EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;;
+1D751;MATHEMATICAL BOLD ITALIC THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;;
+1D752;MATHEMATICAL BOLD ITALIC KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;;
+1D753;MATHEMATICAL BOLD ITALIC PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;;
+1D754;MATHEMATICAL BOLD ITALIC RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;;
+1D755;MATHEMATICAL BOLD ITALIC PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;;
+1D756;MATHEMATICAL SANS-SERIF BOLD CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;;
+1D757;MATHEMATICAL SANS-SERIF BOLD CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;;
+1D758;MATHEMATICAL SANS-SERIF BOLD CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;;
+1D759;MATHEMATICAL SANS-SERIF BOLD CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;;
+1D75A;MATHEMATICAL SANS-SERIF BOLD CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;;
+1D75B;MATHEMATICAL SANS-SERIF BOLD CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;;
+1D75C;MATHEMATICAL SANS-SERIF BOLD CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;;
+1D75D;MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;;
+1D75E;MATHEMATICAL SANS-SERIF BOLD CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;;
+1D75F;MATHEMATICAL SANS-SERIF BOLD CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;;
+1D760;MATHEMATICAL SANS-SERIF BOLD CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;;
+1D761;MATHEMATICAL SANS-SERIF BOLD CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;;
+1D762;MATHEMATICAL SANS-SERIF BOLD CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;;
+1D763;MATHEMATICAL SANS-SERIF BOLD CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;;
+1D764;MATHEMATICAL SANS-SERIF BOLD CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;;
+1D765;MATHEMATICAL SANS-SERIF BOLD CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;;
+1D766;MATHEMATICAL SANS-SERIF BOLD CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;;
+1D767;MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;;
+1D768;MATHEMATICAL SANS-SERIF BOLD CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;;
+1D769;MATHEMATICAL SANS-SERIF BOLD CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;;
+1D76A;MATHEMATICAL SANS-SERIF BOLD CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;;
+1D76B;MATHEMATICAL SANS-SERIF BOLD CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;;
+1D76C;MATHEMATICAL SANS-SERIF BOLD CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;;
+1D76D;MATHEMATICAL SANS-SERIF BOLD CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;;
+1D76E;MATHEMATICAL SANS-SERIF BOLD CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;;
+1D76F;MATHEMATICAL SANS-SERIF BOLD NABLA;Sm;0;L;<font> 2207;;;;N;;;;;
+1D770;MATHEMATICAL SANS-SERIF BOLD SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;;
+1D771;MATHEMATICAL SANS-SERIF BOLD SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;;
+1D772;MATHEMATICAL SANS-SERIF BOLD SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;;
+1D773;MATHEMATICAL SANS-SERIF BOLD SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;;
+1D774;MATHEMATICAL SANS-SERIF BOLD SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;;
+1D775;MATHEMATICAL SANS-SERIF BOLD SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;;
+1D776;MATHEMATICAL SANS-SERIF BOLD SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;;
+1D777;MATHEMATICAL SANS-SERIF BOLD SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;;
+1D778;MATHEMATICAL SANS-SERIF BOLD SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;;
+1D779;MATHEMATICAL SANS-SERIF BOLD SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;;
+1D77A;MATHEMATICAL SANS-SERIF BOLD SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;;
+1D77B;MATHEMATICAL SANS-SERIF BOLD SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;;
+1D77C;MATHEMATICAL SANS-SERIF BOLD SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;;
+1D77D;MATHEMATICAL SANS-SERIF BOLD SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;;
+1D77E;MATHEMATICAL SANS-SERIF BOLD SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;;
+1D77F;MATHEMATICAL SANS-SERIF BOLD SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;;
+1D780;MATHEMATICAL SANS-SERIF BOLD SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;;
+1D781;MATHEMATICAL SANS-SERIF BOLD SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;;
+1D782;MATHEMATICAL SANS-SERIF BOLD SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;;
+1D783;MATHEMATICAL SANS-SERIF BOLD SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;;
+1D784;MATHEMATICAL SANS-SERIF BOLD SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;;
+1D785;MATHEMATICAL SANS-SERIF BOLD SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;;
+1D786;MATHEMATICAL SANS-SERIF BOLD SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;;
+1D787;MATHEMATICAL SANS-SERIF BOLD SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;;
+1D788;MATHEMATICAL SANS-SERIF BOLD SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;;
+1D789;MATHEMATICAL SANS-SERIF BOLD PARTIAL DIFFERENTIAL;Sm;0;L;<font> 2202;;;;Y;;;;;
+1D78A;MATHEMATICAL SANS-SERIF BOLD EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;;
+1D78B;MATHEMATICAL SANS-SERIF BOLD THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;;
+1D78C;MATHEMATICAL SANS-SERIF BOLD KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;;
+1D78D;MATHEMATICAL SANS-SERIF BOLD PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;;
+1D78E;MATHEMATICAL SANS-SERIF BOLD RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;;
+1D78F;MATHEMATICAL SANS-SERIF BOLD PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;;
+1D790;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ALPHA;Lu;0;L;<font> 0391;;;;N;;;;;
+1D791;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL BETA;Lu;0;L;<font> 0392;;;;N;;;;;
+1D792;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL GAMMA;Lu;0;L;<font> 0393;;;;N;;;;;
+1D793;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL DELTA;Lu;0;L;<font> 0394;;;;N;;;;;
+1D794;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL EPSILON;Lu;0;L;<font> 0395;;;;N;;;;;
+1D795;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ZETA;Lu;0;L;<font> 0396;;;;N;;;;;
+1D796;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ETA;Lu;0;L;<font> 0397;;;;N;;;;;
+1D797;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA;Lu;0;L;<font> 0398;;;;N;;;;;
+1D798;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL IOTA;Lu;0;L;<font> 0399;;;;N;;;;;
+1D799;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL KAPPA;Lu;0;L;<font> 039A;;;;N;;;;;
+1D79A;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL LAMDA;Lu;0;L;<font> 039B;;;;N;;;;;
+1D79B;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL MU;Lu;0;L;<font> 039C;;;;N;;;;;
+1D79C;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL NU;Lu;0;L;<font> 039D;;;;N;;;;;
+1D79D;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL XI;Lu;0;L;<font> 039E;;;;N;;;;;
+1D79E;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMICRON;Lu;0;L;<font> 039F;;;;N;;;;;
+1D79F;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PI;Lu;0;L;<font> 03A0;;;;N;;;;;
+1D7A0;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL RHO;Lu;0;L;<font> 03A1;;;;N;;;;;
+1D7A1;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA SYMBOL;Lu;0;L;<font> 03F4;;;;N;;;;;
+1D7A2;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL SIGMA;Lu;0;L;<font> 03A3;;;;N;;;;;
+1D7A3;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL TAU;Lu;0;L;<font> 03A4;;;;N;;;;;
+1D7A4;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL UPSILON;Lu;0;L;<font> 03A5;;;;N;;;;;
+1D7A5;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PHI;Lu;0;L;<font> 03A6;;;;N;;;;;
+1D7A6;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL CHI;Lu;0;L;<font> 03A7;;;;N;;;;;
+1D7A7;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PSI;Lu;0;L;<font> 03A8;;;;N;;;;;
+1D7A8;MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMEGA;Lu;0;L;<font> 03A9;;;;N;;;;;
+1D7A9;MATHEMATICAL SANS-SERIF BOLD ITALIC NABLA;Sm;0;L;<font> 2207;;;;N;;;;;
+1D7AA;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ALPHA;Ll;0;L;<font> 03B1;;;;N;;;;;
+1D7AB;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL BETA;Ll;0;L;<font> 03B2;;;;N;;;;;
+1D7AC;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL GAMMA;Ll;0;L;<font> 03B3;;;;N;;;;;
+1D7AD;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL DELTA;Ll;0;L;<font> 03B4;;;;N;;;;;
+1D7AE;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL EPSILON;Ll;0;L;<font> 03B5;;;;N;;;;;
+1D7AF;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ZETA;Ll;0;L;<font> 03B6;;;;N;;;;;
+1D7B0;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ETA;Ll;0;L;<font> 03B7;;;;N;;;;;
+1D7B1;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL THETA;Ll;0;L;<font> 03B8;;;;N;;;;;
+1D7B2;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL IOTA;Ll;0;L;<font> 03B9;;;;N;;;;;
+1D7B3;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL KAPPA;Ll;0;L;<font> 03BA;;;;N;;;;;
+1D7B4;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL LAMDA;Ll;0;L;<font> 03BB;;;;N;;;;;
+1D7B5;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL MU;Ll;0;L;<font> 03BC;;;;N;;;;;
+1D7B6;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL NU;Ll;0;L;<font> 03BD;;;;N;;;;;
+1D7B7;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL XI;Ll;0;L;<font> 03BE;;;;N;;;;;
+1D7B8;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL OMICRON;Ll;0;L;<font> 03BF;;;;N;;;;;
+1D7B9;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PI;Ll;0;L;<font> 03C0;;;;N;;;;;
+1D7BA;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL RHO;Ll;0;L;<font> 03C1;;;;N;;;;;
+1D7BB;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL FINAL SIGMA;Ll;0;L;<font> 03C2;;;;N;;;;;
+1D7BC;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL SIGMA;Ll;0;L;<font> 03C3;;;;N;;;;;
+1D7BD;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL TAU;Ll;0;L;<font> 03C4;;;;N;;;;;
+1D7BE;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL UPSILON;Ll;0;L;<font> 03C5;;;;N;;;;;
+1D7BF;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PHI;Ll;0;L;<font> 03C6;;;;N;;;;;
+1D7C0;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL CHI;Ll;0;L;<font> 03C7;;;;N;;;;;
+1D7C1;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PSI;Ll;0;L;<font> 03C8;;;;N;;;;;
+1D7C2;MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL OMEGA;Ll;0;L;<font> 03C9;;;;N;;;;;
+1D7C3;MATHEMATICAL SANS-SERIF BOLD ITALIC PARTIAL DIFFERENTIAL;Sm;0;L;<font> 2202;;;;Y;;;;;
+1D7C4;MATHEMATICAL SANS-SERIF BOLD ITALIC EPSILON SYMBOL;Ll;0;L;<font> 03F5;;;;N;;;;;
+1D7C5;MATHEMATICAL SANS-SERIF BOLD ITALIC THETA SYMBOL;Ll;0;L;<font> 03D1;;;;N;;;;;
+1D7C6;MATHEMATICAL SANS-SERIF BOLD ITALIC KAPPA SYMBOL;Ll;0;L;<font> 03F0;;;;N;;;;;
+1D7C7;MATHEMATICAL SANS-SERIF BOLD ITALIC PHI SYMBOL;Ll;0;L;<font> 03D5;;;;N;;;;;
+1D7C8;MATHEMATICAL SANS-SERIF BOLD ITALIC RHO SYMBOL;Ll;0;L;<font> 03F1;;;;N;;;;;
+1D7C9;MATHEMATICAL SANS-SERIF BOLD ITALIC PI SYMBOL;Ll;0;L;<font> 03D6;;;;N;;;;;
+1D7CA;MATHEMATICAL BOLD CAPITAL DIGAMMA;Lu;0;L;<font> 03DC;;;;N;;;;;
+1D7CB;MATHEMATICAL BOLD SMALL DIGAMMA;Ll;0;L;<font> 03DD;;;;N;;;;;
+1D7CE;MATHEMATICAL BOLD DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;;
+1D7CF;MATHEMATICAL BOLD DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;;
+1D7D0;MATHEMATICAL BOLD DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;;
+1D7D1;MATHEMATICAL BOLD DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;;
+1D7D2;MATHEMATICAL BOLD DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;;
+1D7D3;MATHEMATICAL BOLD DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;;
+1D7D4;MATHEMATICAL BOLD DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;;
+1D7D5;MATHEMATICAL BOLD DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;;
+1D7D6;MATHEMATICAL BOLD DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;;
+1D7D7;MATHEMATICAL BOLD DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;;
+1D7D8;MATHEMATICAL DOUBLE-STRUCK DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;;
+1D7D9;MATHEMATICAL DOUBLE-STRUCK DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;;
+1D7DA;MATHEMATICAL DOUBLE-STRUCK DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;;
+1D7DB;MATHEMATICAL DOUBLE-STRUCK DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;;
+1D7DC;MATHEMATICAL DOUBLE-STRUCK DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;;
+1D7DD;MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;;
+1D7DE;MATHEMATICAL DOUBLE-STRUCK DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;;
+1D7DF;MATHEMATICAL DOUBLE-STRUCK DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;;
+1D7E0;MATHEMATICAL DOUBLE-STRUCK DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;;
+1D7E1;MATHEMATICAL DOUBLE-STRUCK DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;;
+1D7E2;MATHEMATICAL SANS-SERIF DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;;
+1D7E3;MATHEMATICAL SANS-SERIF DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;;
+1D7E4;MATHEMATICAL SANS-SERIF DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;;
+1D7E5;MATHEMATICAL SANS-SERIF DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;;
+1D7E6;MATHEMATICAL SANS-SERIF DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;;
+1D7E7;MATHEMATICAL SANS-SERIF DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;;
+1D7E8;MATHEMATICAL SANS-SERIF DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;;
+1D7E9;MATHEMATICAL SANS-SERIF DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;;
+1D7EA;MATHEMATICAL SANS-SERIF DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;;
+1D7EB;MATHEMATICAL SANS-SERIF DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;;
+1D7EC;MATHEMATICAL SANS-SERIF BOLD DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;;
+1D7ED;MATHEMATICAL SANS-SERIF BOLD DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;;
+1D7EE;MATHEMATICAL SANS-SERIF BOLD DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;;
+1D7EF;MATHEMATICAL SANS-SERIF BOLD DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;;
+1D7F0;MATHEMATICAL SANS-SERIF BOLD DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;;
+1D7F1;MATHEMATICAL SANS-SERIF BOLD DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;;
+1D7F2;MATHEMATICAL SANS-SERIF BOLD DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;;
+1D7F3;MATHEMATICAL SANS-SERIF BOLD DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;;
+1D7F4;MATHEMATICAL SANS-SERIF BOLD DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;;
+1D7F5;MATHEMATICAL SANS-SERIF BOLD DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;;
+1D7F6;MATHEMATICAL MONOSPACE DIGIT ZERO;Nd;0;EN;<font> 0030;0;0;0;N;;;;;
+1D7F7;MATHEMATICAL MONOSPACE DIGIT ONE;Nd;0;EN;<font> 0031;1;1;1;N;;;;;
+1D7F8;MATHEMATICAL MONOSPACE DIGIT TWO;Nd;0;EN;<font> 0032;2;2;2;N;;;;;
+1D7F9;MATHEMATICAL MONOSPACE DIGIT THREE;Nd;0;EN;<font> 0033;3;3;3;N;;;;;
+1D7FA;MATHEMATICAL MONOSPACE DIGIT FOUR;Nd;0;EN;<font> 0034;4;4;4;N;;;;;
+1D7FB;MATHEMATICAL MONOSPACE DIGIT FIVE;Nd;0;EN;<font> 0035;5;5;5;N;;;;;
+1D7FC;MATHEMATICAL MONOSPACE DIGIT SIX;Nd;0;EN;<font> 0036;6;6;6;N;;;;;
+1D7FD;MATHEMATICAL MONOSPACE DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;;
+1D7FE;MATHEMATICAL MONOSPACE DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;;
+1D7FF;MATHEMATICAL MONOSPACE DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;;
+20000;<CJK Ideograph Extension B, First>;Lo;0;L;;;;;N;;;;;
+2A6D6;<CJK Ideograph Extension B, Last>;Lo;0;L;;;;;N;;;;;
+2F800;CJK COMPATIBILITY IDEOGRAPH-2F800;Lo;0;L;4E3D;;;;N;;;;;
+2F801;CJK COMPATIBILITY IDEOGRAPH-2F801;Lo;0;L;4E38;;;;N;;;;;
+2F802;CJK COMPATIBILITY IDEOGRAPH-2F802;Lo;0;L;4E41;;;;N;;;;;
+2F803;CJK COMPATIBILITY IDEOGRAPH-2F803;Lo;0;L;20122;;;;N;;;;;
+2F804;CJK COMPATIBILITY IDEOGRAPH-2F804;Lo;0;L;4F60;;;;N;;;;;
+2F805;CJK COMPATIBILITY IDEOGRAPH-2F805;Lo;0;L;4FAE;;;;N;;;;;
+2F806;CJK COMPATIBILITY IDEOGRAPH-2F806;Lo;0;L;4FBB;;;;N;;;;;
+2F807;CJK COMPATIBILITY IDEOGRAPH-2F807;Lo;0;L;5002;;;;N;;;;;
+2F808;CJK COMPATIBILITY IDEOGRAPH-2F808;Lo;0;L;507A;;;;N;;;;;
+2F809;CJK COMPATIBILITY IDEOGRAPH-2F809;Lo;0;L;5099;;;;N;;;;;
+2F80A;CJK COMPATIBILITY IDEOGRAPH-2F80A;Lo;0;L;50E7;;;;N;;;;;
+2F80B;CJK COMPATIBILITY IDEOGRAPH-2F80B;Lo;0;L;50CF;;;;N;;;;;
+2F80C;CJK COMPATIBILITY IDEOGRAPH-2F80C;Lo;0;L;349E;;;;N;;;;;
+2F80D;CJK COMPATIBILITY IDEOGRAPH-2F80D;Lo;0;L;2063A;;;;N;;;;;
+2F80E;CJK COMPATIBILITY IDEOGRAPH-2F80E;Lo;0;L;514D;;;;N;;;;;
+2F80F;CJK COMPATIBILITY IDEOGRAPH-2F80F;Lo;0;L;5154;;;;N;;;;;
+2F810;CJK COMPATIBILITY IDEOGRAPH-2F810;Lo;0;L;5164;;;;N;;;;;
+2F811;CJK COMPATIBILITY IDEOGRAPH-2F811;Lo;0;L;5177;;;;N;;;;;
+2F812;CJK COMPATIBILITY IDEOGRAPH-2F812;Lo;0;L;2051C;;;;N;;;;;
+2F813;CJK COMPATIBILITY IDEOGRAPH-2F813;Lo;0;L;34B9;;;;N;;;;;
+2F814;CJK COMPATIBILITY IDEOGRAPH-2F814;Lo;0;L;5167;;;;N;;;;;
+2F815;CJK COMPATIBILITY IDEOGRAPH-2F815;Lo;0;L;518D;;;;N;;;;;
+2F816;CJK COMPATIBILITY IDEOGRAPH-2F816;Lo;0;L;2054B;;;;N;;;;;
+2F817;CJK COMPATIBILITY IDEOGRAPH-2F817;Lo;0;L;5197;;;;N;;;;;
+2F818;CJK COMPATIBILITY IDEOGRAPH-2F818;Lo;0;L;51A4;;;;N;;;;;
+2F819;CJK COMPATIBILITY IDEOGRAPH-2F819;Lo;0;L;4ECC;;;;N;;;;;
+2F81A;CJK COMPATIBILITY IDEOGRAPH-2F81A;Lo;0;L;51AC;;;;N;;;;;
+2F81B;CJK COMPATIBILITY IDEOGRAPH-2F81B;Lo;0;L;51B5;;;;N;;;;;
+2F81C;CJK COMPATIBILITY IDEOGRAPH-2F81C;Lo;0;L;291DF;;;;N;;;;;
+2F81D;CJK COMPATIBILITY IDEOGRAPH-2F81D;Lo;0;L;51F5;;;;N;;;;;
+2F81E;CJK COMPATIBILITY IDEOGRAPH-2F81E;Lo;0;L;5203;;;;N;;;;;
+2F81F;CJK COMPATIBILITY IDEOGRAPH-2F81F;Lo;0;L;34DF;;;;N;;;;;
+2F820;CJK COMPATIBILITY IDEOGRAPH-2F820;Lo;0;L;523B;;;;N;;;;;
+2F821;CJK COMPATIBILITY IDEOGRAPH-2F821;Lo;0;L;5246;;;;N;;;;;
+2F822;CJK COMPATIBILITY IDEOGRAPH-2F822;Lo;0;L;5272;;;;N;;;;;
+2F823;CJK COMPATIBILITY IDEOGRAPH-2F823;Lo;0;L;5277;;;;N;;;;;
+2F824;CJK COMPATIBILITY IDEOGRAPH-2F824;Lo;0;L;3515;;;;N;;;;;
+2F825;CJK COMPATIBILITY IDEOGRAPH-2F825;Lo;0;L;52C7;;;;N;;;;;
+2F826;CJK COMPATIBILITY IDEOGRAPH-2F826;Lo;0;L;52C9;;;;N;;;;;
+2F827;CJK COMPATIBILITY IDEOGRAPH-2F827;Lo;0;L;52E4;;;;N;;;;;
+2F828;CJK COMPATIBILITY IDEOGRAPH-2F828;Lo;0;L;52FA;;;;N;;;;;
+2F829;CJK COMPATIBILITY IDEOGRAPH-2F829;Lo;0;L;5305;;;;N;;;;;
+2F82A;CJK COMPATIBILITY IDEOGRAPH-2F82A;Lo;0;L;5306;;;;N;;;;;
+2F82B;CJK COMPATIBILITY IDEOGRAPH-2F82B;Lo;0;L;5317;;;;N;;;;;
+2F82C;CJK COMPATIBILITY IDEOGRAPH-2F82C;Lo;0;L;5349;;;;N;;;;;
+2F82D;CJK COMPATIBILITY IDEOGRAPH-2F82D;Lo;0;L;5351;;;;N;;;;;
+2F82E;CJK COMPATIBILITY IDEOGRAPH-2F82E;Lo;0;L;535A;;;;N;;;;;
+2F82F;CJK COMPATIBILITY IDEOGRAPH-2F82F;Lo;0;L;5373;;;;N;;;;;
+2F830;CJK COMPATIBILITY IDEOGRAPH-2F830;Lo;0;L;537D;;;;N;;;;;
+2F831;CJK COMPATIBILITY IDEOGRAPH-2F831;Lo;0;L;537F;;;;N;;;;;
+2F832;CJK COMPATIBILITY IDEOGRAPH-2F832;Lo;0;L;537F;;;;N;;;;;
+2F833;CJK COMPATIBILITY IDEOGRAPH-2F833;Lo;0;L;537F;;;;N;;;;;
+2F834;CJK COMPATIBILITY IDEOGRAPH-2F834;Lo;0;L;20A2C;;;;N;;;;;
+2F835;CJK COMPATIBILITY IDEOGRAPH-2F835;Lo;0;L;7070;;;;N;;;;;
+2F836;CJK COMPATIBILITY IDEOGRAPH-2F836;Lo;0;L;53CA;;;;N;;;;;
+2F837;CJK COMPATIBILITY IDEOGRAPH-2F837;Lo;0;L;53DF;;;;N;;;;;
+2F838;CJK COMPATIBILITY IDEOGRAPH-2F838;Lo;0;L;20B63;;;;N;;;;;
+2F839;CJK COMPATIBILITY IDEOGRAPH-2F839;Lo;0;L;53EB;;;;N;;;;;
+2F83A;CJK COMPATIBILITY IDEOGRAPH-2F83A;Lo;0;L;53F1;;;;N;;;;;
+2F83B;CJK COMPATIBILITY IDEOGRAPH-2F83B;Lo;0;L;5406;;;;N;;;;;
+2F83C;CJK COMPATIBILITY IDEOGRAPH-2F83C;Lo;0;L;549E;;;;N;;;;;
+2F83D;CJK COMPATIBILITY IDEOGRAPH-2F83D;Lo;0;L;5438;;;;N;;;;;
+2F83E;CJK COMPATIBILITY IDEOGRAPH-2F83E;Lo;0;L;5448;;;;N;;;;;
+2F83F;CJK COMPATIBILITY IDEOGRAPH-2F83F;Lo;0;L;5468;;;;N;;;;;
+2F840;CJK COMPATIBILITY IDEOGRAPH-2F840;Lo;0;L;54A2;;;;N;;;;;
+2F841;CJK COMPATIBILITY IDEOGRAPH-2F841;Lo;0;L;54F6;;;;N;;;;;
+2F842;CJK COMPATIBILITY IDEOGRAPH-2F842;Lo;0;L;5510;;;;N;;;;;
+2F843;CJK COMPATIBILITY IDEOGRAPH-2F843;Lo;0;L;5553;;;;N;;;;;
+2F844;CJK COMPATIBILITY IDEOGRAPH-2F844;Lo;0;L;5563;;;;N;;;;;
+2F845;CJK COMPATIBILITY IDEOGRAPH-2F845;Lo;0;L;5584;;;;N;;;;;
+2F846;CJK COMPATIBILITY IDEOGRAPH-2F846;Lo;0;L;5584;;;;N;;;;;
+2F847;CJK COMPATIBILITY IDEOGRAPH-2F847;Lo;0;L;5599;;;;N;;;;;
+2F848;CJK COMPATIBILITY IDEOGRAPH-2F848;Lo;0;L;55AB;;;;N;;;;;
+2F849;CJK COMPATIBILITY IDEOGRAPH-2F849;Lo;0;L;55B3;;;;N;;;;;
+2F84A;CJK COMPATIBILITY IDEOGRAPH-2F84A;Lo;0;L;55C2;;;;N;;;;;
+2F84B;CJK COMPATIBILITY IDEOGRAPH-2F84B;Lo;0;L;5716;;;;N;;;;;
+2F84C;CJK COMPATIBILITY IDEOGRAPH-2F84C;Lo;0;L;5606;;;;N;;;;;
+2F84D;CJK COMPATIBILITY IDEOGRAPH-2F84D;Lo;0;L;5717;;;;N;;;;;
+2F84E;CJK COMPATIBILITY IDEOGRAPH-2F84E;Lo;0;L;5651;;;;N;;;;;
+2F84F;CJK COMPATIBILITY IDEOGRAPH-2F84F;Lo;0;L;5674;;;;N;;;;;
+2F850;CJK COMPATIBILITY IDEOGRAPH-2F850;Lo;0;L;5207;;;;N;;;;;
+2F851;CJK COMPATIBILITY IDEOGRAPH-2F851;Lo;0;L;58EE;;;;N;;;;;
+2F852;CJK COMPATIBILITY IDEOGRAPH-2F852;Lo;0;L;57CE;;;;N;;;;;
+2F853;CJK COMPATIBILITY IDEOGRAPH-2F853;Lo;0;L;57F4;;;;N;;;;;
+2F854;CJK COMPATIBILITY IDEOGRAPH-2F854;Lo;0;L;580D;;;;N;;;;;
+2F855;CJK COMPATIBILITY IDEOGRAPH-2F855;Lo;0;L;578B;;;;N;;;;;
+2F856;CJK COMPATIBILITY IDEOGRAPH-2F856;Lo;0;L;5832;;;;N;;;;;
+2F857;CJK COMPATIBILITY IDEOGRAPH-2F857;Lo;0;L;5831;;;;N;;;;;
+2F858;CJK COMPATIBILITY IDEOGRAPH-2F858;Lo;0;L;58AC;;;;N;;;;;
+2F859;CJK COMPATIBILITY IDEOGRAPH-2F859;Lo;0;L;214E4;;;;N;;;;;
+2F85A;CJK COMPATIBILITY IDEOGRAPH-2F85A;Lo;0;L;58F2;;;;N;;;;;
+2F85B;CJK COMPATIBILITY IDEOGRAPH-2F85B;Lo;0;L;58F7;;;;N;;;;;
+2F85C;CJK COMPATIBILITY IDEOGRAPH-2F85C;Lo;0;L;5906;;;;N;;;;;
+2F85D;CJK COMPATIBILITY IDEOGRAPH-2F85D;Lo;0;L;591A;;;;N;;;;;
+2F85E;CJK COMPATIBILITY IDEOGRAPH-2F85E;Lo;0;L;5922;;;;N;;;;;
+2F85F;CJK COMPATIBILITY IDEOGRAPH-2F85F;Lo;0;L;5962;;;;N;;;;;
+2F860;CJK COMPATIBILITY IDEOGRAPH-2F860;Lo;0;L;216A8;;;;N;;;;;
+2F861;CJK COMPATIBILITY IDEOGRAPH-2F861;Lo;0;L;216EA;;;;N;;;;;
+2F862;CJK COMPATIBILITY IDEOGRAPH-2F862;Lo;0;L;59EC;;;;N;;;;;
+2F863;CJK COMPATIBILITY IDEOGRAPH-2F863;Lo;0;L;5A1B;;;;N;;;;;
+2F864;CJK COMPATIBILITY IDEOGRAPH-2F864;Lo;0;L;5A27;;;;N;;;;;
+2F865;CJK COMPATIBILITY IDEOGRAPH-2F865;Lo;0;L;59D8;;;;N;;;;;
+2F866;CJK COMPATIBILITY IDEOGRAPH-2F866;Lo;0;L;5A66;;;;N;;;;;
+2F867;CJK COMPATIBILITY IDEOGRAPH-2F867;Lo;0;L;36EE;;;;N;;;;;
+2F868;CJK COMPATIBILITY IDEOGRAPH-2F868;Lo;0;L;36FC;;;;N;;;;;
+2F869;CJK COMPATIBILITY IDEOGRAPH-2F869;Lo;0;L;5B08;;;;N;;;;;
+2F86A;CJK COMPATIBILITY IDEOGRAPH-2F86A;Lo;0;L;5B3E;;;;N;;;;;
+2F86B;CJK COMPATIBILITY IDEOGRAPH-2F86B;Lo;0;L;5B3E;;;;N;;;;;
+2F86C;CJK COMPATIBILITY IDEOGRAPH-2F86C;Lo;0;L;219C8;;;;N;;;;;
+2F86D;CJK COMPATIBILITY IDEOGRAPH-2F86D;Lo;0;L;5BC3;;;;N;;;;;
+2F86E;CJK COMPATIBILITY IDEOGRAPH-2F86E;Lo;0;L;5BD8;;;;N;;;;;
+2F86F;CJK COMPATIBILITY IDEOGRAPH-2F86F;Lo;0;L;5BE7;;;;N;;;;;
+2F870;CJK COMPATIBILITY IDEOGRAPH-2F870;Lo;0;L;5BF3;;;;N;;;;;
+2F871;CJK COMPATIBILITY IDEOGRAPH-2F871;Lo;0;L;21B18;;;;N;;;;;
+2F872;CJK COMPATIBILITY IDEOGRAPH-2F872;Lo;0;L;5BFF;;;;N;;;;;
+2F873;CJK COMPATIBILITY IDEOGRAPH-2F873;Lo;0;L;5C06;;;;N;;;;;
+2F874;CJK COMPATIBILITY IDEOGRAPH-2F874;Lo;0;L;5F53;;;;N;;;;;
+2F875;CJK COMPATIBILITY IDEOGRAPH-2F875;Lo;0;L;5C22;;;;N;;;;;
+2F876;CJK COMPATIBILITY IDEOGRAPH-2F876;Lo;0;L;3781;;;;N;;;;;
+2F877;CJK COMPATIBILITY IDEOGRAPH-2F877;Lo;0;L;5C60;;;;N;;;;;
+2F878;CJK COMPATIBILITY IDEOGRAPH-2F878;Lo;0;L;5C6E;;;;N;;;;;
+2F879;CJK COMPATIBILITY IDEOGRAPH-2F879;Lo;0;L;5CC0;;;;N;;;;;
+2F87A;CJK COMPATIBILITY IDEOGRAPH-2F87A;Lo;0;L;5C8D;;;;N;;;;;
+2F87B;CJK COMPATIBILITY IDEOGRAPH-2F87B;Lo;0;L;21DE4;;;;N;;;;;
+2F87C;CJK COMPATIBILITY IDEOGRAPH-2F87C;Lo;0;L;5D43;;;;N;;;;;
+2F87D;CJK COMPATIBILITY IDEOGRAPH-2F87D;Lo;0;L;21DE6;;;;N;;;;;
+2F87E;CJK COMPATIBILITY IDEOGRAPH-2F87E;Lo;0;L;5D6E;;;;N;;;;;
+2F87F;CJK COMPATIBILITY IDEOGRAPH-2F87F;Lo;0;L;5D6B;;;;N;;;;;
+2F880;CJK COMPATIBILITY IDEOGRAPH-2F880;Lo;0;L;5D7C;;;;N;;;;;
+2F881;CJK COMPATIBILITY IDEOGRAPH-2F881;Lo;0;L;5DE1;;;;N;;;;;
+2F882;CJK COMPATIBILITY IDEOGRAPH-2F882;Lo;0;L;5DE2;;;;N;;;;;
+2F883;CJK COMPATIBILITY IDEOGRAPH-2F883;Lo;0;L;382F;;;;N;;;;;
+2F884;CJK COMPATIBILITY IDEOGRAPH-2F884;Lo;0;L;5DFD;;;;N;;;;;
+2F885;CJK COMPATIBILITY IDEOGRAPH-2F885;Lo;0;L;5E28;;;;N;;;;;
+2F886;CJK COMPATIBILITY IDEOGRAPH-2F886;Lo;0;L;5E3D;;;;N;;;;;
+2F887;CJK COMPATIBILITY IDEOGRAPH-2F887;Lo;0;L;5E69;;;;N;;;;;
+2F888;CJK COMPATIBILITY IDEOGRAPH-2F888;Lo;0;L;3862;;;;N;;;;;
+2F889;CJK COMPATIBILITY IDEOGRAPH-2F889;Lo;0;L;22183;;;;N;;;;;
+2F88A;CJK COMPATIBILITY IDEOGRAPH-2F88A;Lo;0;L;387C;;;;N;;;;;
+2F88B;CJK COMPATIBILITY IDEOGRAPH-2F88B;Lo;0;L;5EB0;;;;N;;;;;
+2F88C;CJK COMPATIBILITY IDEOGRAPH-2F88C;Lo;0;L;5EB3;;;;N;;;;;
+2F88D;CJK COMPATIBILITY IDEOGRAPH-2F88D;Lo;0;L;5EB6;;;;N;;;;;
+2F88E;CJK COMPATIBILITY IDEOGRAPH-2F88E;Lo;0;L;5ECA;;;;N;;;;;
+2F88F;CJK COMPATIBILITY IDEOGRAPH-2F88F;Lo;0;L;2A392;;;;N;;;;;
+2F890;CJK COMPATIBILITY IDEOGRAPH-2F890;Lo;0;L;5EFE;;;;N;;;;;
+2F891;CJK COMPATIBILITY IDEOGRAPH-2F891;Lo;0;L;22331;;;;N;;;;;
+2F892;CJK COMPATIBILITY IDEOGRAPH-2F892;Lo;0;L;22331;;;;N;;;;;
+2F893;CJK COMPATIBILITY IDEOGRAPH-2F893;Lo;0;L;8201;;;;N;;;;;
+2F894;CJK COMPATIBILITY IDEOGRAPH-2F894;Lo;0;L;5F22;;;;N;;;;;
+2F895;CJK COMPATIBILITY IDEOGRAPH-2F895;Lo;0;L;5F22;;;;N;;;;;
+2F896;CJK COMPATIBILITY IDEOGRAPH-2F896;Lo;0;L;38C7;;;;N;;;;;
+2F897;CJK COMPATIBILITY IDEOGRAPH-2F897;Lo;0;L;232B8;;;;N;;;;;
+2F898;CJK COMPATIBILITY IDEOGRAPH-2F898;Lo;0;L;261DA;;;;N;;;;;
+2F899;CJK COMPATIBILITY IDEOGRAPH-2F899;Lo;0;L;5F62;;;;N;;;;;
+2F89A;CJK COMPATIBILITY IDEOGRAPH-2F89A;Lo;0;L;5F6B;;;;N;;;;;
+2F89B;CJK COMPATIBILITY IDEOGRAPH-2F89B;Lo;0;L;38E3;;;;N;;;;;
+2F89C;CJK COMPATIBILITY IDEOGRAPH-2F89C;Lo;0;L;5F9A;;;;N;;;;;
+2F89D;CJK COMPATIBILITY IDEOGRAPH-2F89D;Lo;0;L;5FCD;;;;N;;;;;
+2F89E;CJK COMPATIBILITY IDEOGRAPH-2F89E;Lo;0;L;5FD7;;;;N;;;;;
+2F89F;CJK COMPATIBILITY IDEOGRAPH-2F89F;Lo;0;L;5FF9;;;;N;;;;;
+2F8A0;CJK COMPATIBILITY IDEOGRAPH-2F8A0;Lo;0;L;6081;;;;N;;;;;
+2F8A1;CJK COMPATIBILITY IDEOGRAPH-2F8A1;Lo;0;L;393A;;;;N;;;;;
+2F8A2;CJK COMPATIBILITY IDEOGRAPH-2F8A2;Lo;0;L;391C;;;;N;;;;;
+2F8A3;CJK COMPATIBILITY IDEOGRAPH-2F8A3;Lo;0;L;6094;;;;N;;;;;
+2F8A4;CJK COMPATIBILITY IDEOGRAPH-2F8A4;Lo;0;L;226D4;;;;N;;;;;
+2F8A5;CJK COMPATIBILITY IDEOGRAPH-2F8A5;Lo;0;L;60C7;;;;N;;;;;
+2F8A6;CJK COMPATIBILITY IDEOGRAPH-2F8A6;Lo;0;L;6148;;;;N;;;;;
+2F8A7;CJK COMPATIBILITY IDEOGRAPH-2F8A7;Lo;0;L;614C;;;;N;;;;;
+2F8A8;CJK COMPATIBILITY IDEOGRAPH-2F8A8;Lo;0;L;614E;;;;N;;;;;
+2F8A9;CJK COMPATIBILITY IDEOGRAPH-2F8A9;Lo;0;L;614C;;;;N;;;;;
+2F8AA;CJK COMPATIBILITY IDEOGRAPH-2F8AA;Lo;0;L;617A;;;;N;;;;;
+2F8AB;CJK COMPATIBILITY IDEOGRAPH-2F8AB;Lo;0;L;618E;;;;N;;;;;
+2F8AC;CJK COMPATIBILITY IDEOGRAPH-2F8AC;Lo;0;L;61B2;;;;N;;;;;
+2F8AD;CJK COMPATIBILITY IDEOGRAPH-2F8AD;Lo;0;L;61A4;;;;N;;;;;
+2F8AE;CJK COMPATIBILITY IDEOGRAPH-2F8AE;Lo;0;L;61AF;;;;N;;;;;
+2F8AF;CJK COMPATIBILITY IDEOGRAPH-2F8AF;Lo;0;L;61DE;;;;N;;;;;
+2F8B0;CJK COMPATIBILITY IDEOGRAPH-2F8B0;Lo;0;L;61F2;;;;N;;;;;
+2F8B1;CJK COMPATIBILITY IDEOGRAPH-2F8B1;Lo;0;L;61F6;;;;N;;;;;
+2F8B2;CJK COMPATIBILITY IDEOGRAPH-2F8B2;Lo;0;L;6210;;;;N;;;;;
+2F8B3;CJK COMPATIBILITY IDEOGRAPH-2F8B3;Lo;0;L;621B;;;;N;;;;;
+2F8B4;CJK COMPATIBILITY IDEOGRAPH-2F8B4;Lo;0;L;625D;;;;N;;;;;
+2F8B5;CJK COMPATIBILITY IDEOGRAPH-2F8B5;Lo;0;L;62B1;;;;N;;;;;
+2F8B6;CJK COMPATIBILITY IDEOGRAPH-2F8B6;Lo;0;L;62D4;;;;N;;;;;
+2F8B7;CJK COMPATIBILITY IDEOGRAPH-2F8B7;Lo;0;L;6350;;;;N;;;;;
+2F8B8;CJK COMPATIBILITY IDEOGRAPH-2F8B8;Lo;0;L;22B0C;;;;N;;;;;
+2F8B9;CJK COMPATIBILITY IDEOGRAPH-2F8B9;Lo;0;L;633D;;;;N;;;;;
+2F8BA;CJK COMPATIBILITY IDEOGRAPH-2F8BA;Lo;0;L;62FC;;;;N;;;;;
+2F8BB;CJK COMPATIBILITY IDEOGRAPH-2F8BB;Lo;0;L;6368;;;;N;;;;;
+2F8BC;CJK COMPATIBILITY IDEOGRAPH-2F8BC;Lo;0;L;6383;;;;N;;;;;
+2F8BD;CJK COMPATIBILITY IDEOGRAPH-2F8BD;Lo;0;L;63E4;;;;N;;;;;
+2F8BE;CJK COMPATIBILITY IDEOGRAPH-2F8BE;Lo;0;L;22BF1;;;;N;;;;;
+2F8BF;CJK COMPATIBILITY IDEOGRAPH-2F8BF;Lo;0;L;6422;;;;N;;;;;
+2F8C0;CJK COMPATIBILITY IDEOGRAPH-2F8C0;Lo;0;L;63C5;;;;N;;;;;
+2F8C1;CJK COMPATIBILITY IDEOGRAPH-2F8C1;Lo;0;L;63A9;;;;N;;;;;
+2F8C2;CJK COMPATIBILITY IDEOGRAPH-2F8C2;Lo;0;L;3A2E;;;;N;;;;;
+2F8C3;CJK COMPATIBILITY IDEOGRAPH-2F8C3;Lo;0;L;6469;;;;N;;;;;
+2F8C4;CJK COMPATIBILITY IDEOGRAPH-2F8C4;Lo;0;L;647E;;;;N;;;;;
+2F8C5;CJK COMPATIBILITY IDEOGRAPH-2F8C5;Lo;0;L;649D;;;;N;;;;;
+2F8C6;CJK COMPATIBILITY IDEOGRAPH-2F8C6;Lo;0;L;6477;;;;N;;;;;
+2F8C7;CJK COMPATIBILITY IDEOGRAPH-2F8C7;Lo;0;L;3A6C;;;;N;;;;;
+2F8C8;CJK COMPATIBILITY IDEOGRAPH-2F8C8;Lo;0;L;654F;;;;N;;;;;
+2F8C9;CJK COMPATIBILITY IDEOGRAPH-2F8C9;Lo;0;L;656C;;;;N;;;;;
+2F8CA;CJK COMPATIBILITY IDEOGRAPH-2F8CA;Lo;0;L;2300A;;;;N;;;;;
+2F8CB;CJK COMPATIBILITY IDEOGRAPH-2F8CB;Lo;0;L;65E3;;;;N;;;;;
+2F8CC;CJK COMPATIBILITY IDEOGRAPH-2F8CC;Lo;0;L;66F8;;;;N;;;;;
+2F8CD;CJK COMPATIBILITY IDEOGRAPH-2F8CD;Lo;0;L;6649;;;;N;;;;;
+2F8CE;CJK COMPATIBILITY IDEOGRAPH-2F8CE;Lo;0;L;3B19;;;;N;;;;;
+2F8CF;CJK COMPATIBILITY IDEOGRAPH-2F8CF;Lo;0;L;6691;;;;N;;;;;
+2F8D0;CJK COMPATIBILITY IDEOGRAPH-2F8D0;Lo;0;L;3B08;;;;N;;;;;
+2F8D1;CJK COMPATIBILITY IDEOGRAPH-2F8D1;Lo;0;L;3AE4;;;;N;;;;;
+2F8D2;CJK COMPATIBILITY IDEOGRAPH-2F8D2;Lo;0;L;5192;;;;N;;;;;
+2F8D3;CJK COMPATIBILITY IDEOGRAPH-2F8D3;Lo;0;L;5195;;;;N;;;;;
+2F8D4;CJK COMPATIBILITY IDEOGRAPH-2F8D4;Lo;0;L;6700;;;;N;;;;;
+2F8D5;CJK COMPATIBILITY IDEOGRAPH-2F8D5;Lo;0;L;669C;;;;N;;;;;
+2F8D6;CJK COMPATIBILITY IDEOGRAPH-2F8D6;Lo;0;L;80AD;;;;N;;;;;
+2F8D7;CJK COMPATIBILITY IDEOGRAPH-2F8D7;Lo;0;L;43D9;;;;N;;;;;
+2F8D8;CJK COMPATIBILITY IDEOGRAPH-2F8D8;Lo;0;L;6717;;;;N;;;;;
+2F8D9;CJK COMPATIBILITY IDEOGRAPH-2F8D9;Lo;0;L;671B;;;;N;;;;;
+2F8DA;CJK COMPATIBILITY IDEOGRAPH-2F8DA;Lo;0;L;6721;;;;N;;;;;
+2F8DB;CJK COMPATIBILITY IDEOGRAPH-2F8DB;Lo;0;L;675E;;;;N;;;;;
+2F8DC;CJK COMPATIBILITY IDEOGRAPH-2F8DC;Lo;0;L;6753;;;;N;;;;;
+2F8DD;CJK COMPATIBILITY IDEOGRAPH-2F8DD;Lo;0;L;233C3;;;;N;;;;;
+2F8DE;CJK COMPATIBILITY IDEOGRAPH-2F8DE;Lo;0;L;3B49;;;;N;;;;;
+2F8DF;CJK COMPATIBILITY IDEOGRAPH-2F8DF;Lo;0;L;67FA;;;;N;;;;;
+2F8E0;CJK COMPATIBILITY IDEOGRAPH-2F8E0;Lo;0;L;6785;;;;N;;;;;
+2F8E1;CJK COMPATIBILITY IDEOGRAPH-2F8E1;Lo;0;L;6852;;;;N;;;;;
+2F8E2;CJK COMPATIBILITY IDEOGRAPH-2F8E2;Lo;0;L;6885;;;;N;;;;;
+2F8E3;CJK COMPATIBILITY IDEOGRAPH-2F8E3;Lo;0;L;2346D;;;;N;;;;;
+2F8E4;CJK COMPATIBILITY IDEOGRAPH-2F8E4;Lo;0;L;688E;;;;N;;;;;
+2F8E5;CJK COMPATIBILITY IDEOGRAPH-2F8E5;Lo;0;L;681F;;;;N;;;;;
+2F8E6;CJK COMPATIBILITY IDEOGRAPH-2F8E6;Lo;0;L;6914;;;;N;;;;;
+2F8E7;CJK COMPATIBILITY IDEOGRAPH-2F8E7;Lo;0;L;3B9D;;;;N;;;;;
+2F8E8;CJK COMPATIBILITY IDEOGRAPH-2F8E8;Lo;0;L;6942;;;;N;;;;;
+2F8E9;CJK COMPATIBILITY IDEOGRAPH-2F8E9;Lo;0;L;69A3;;;;N;;;;;
+2F8EA;CJK COMPATIBILITY IDEOGRAPH-2F8EA;Lo;0;L;69EA;;;;N;;;;;
+2F8EB;CJK COMPATIBILITY IDEOGRAPH-2F8EB;Lo;0;L;6AA8;;;;N;;;;;
+2F8EC;CJK COMPATIBILITY IDEOGRAPH-2F8EC;Lo;0;L;236A3;;;;N;;;;;
+2F8ED;CJK COMPATIBILITY IDEOGRAPH-2F8ED;Lo;0;L;6ADB;;;;N;;;;;
+2F8EE;CJK COMPATIBILITY IDEOGRAPH-2F8EE;Lo;0;L;3C18;;;;N;;;;;
+2F8EF;CJK COMPATIBILITY IDEOGRAPH-2F8EF;Lo;0;L;6B21;;;;N;;;;;
+2F8F0;CJK COMPATIBILITY IDEOGRAPH-2F8F0;Lo;0;L;238A7;;;;N;;;;;
+2F8F1;CJK COMPATIBILITY IDEOGRAPH-2F8F1;Lo;0;L;6B54;;;;N;;;;;
+2F8F2;CJK COMPATIBILITY IDEOGRAPH-2F8F2;Lo;0;L;3C4E;;;;N;;;;;
+2F8F3;CJK COMPATIBILITY IDEOGRAPH-2F8F3;Lo;0;L;6B72;;;;N;;;;;
+2F8F4;CJK COMPATIBILITY IDEOGRAPH-2F8F4;Lo;0;L;6B9F;;;;N;;;;;
+2F8F5;CJK COMPATIBILITY IDEOGRAPH-2F8F5;Lo;0;L;6BBA;;;;N;;;;;
+2F8F6;CJK COMPATIBILITY IDEOGRAPH-2F8F6;Lo;0;L;6BBB;;;;N;;;;;
+2F8F7;CJK COMPATIBILITY IDEOGRAPH-2F8F7;Lo;0;L;23A8D;;;;N;;;;;
+2F8F8;CJK COMPATIBILITY IDEOGRAPH-2F8F8;Lo;0;L;21D0B;;;;N;;;;;
+2F8F9;CJK COMPATIBILITY IDEOGRAPH-2F8F9;Lo;0;L;23AFA;;;;N;;;;;
+2F8FA;CJK COMPATIBILITY IDEOGRAPH-2F8FA;Lo;0;L;6C4E;;;;N;;;;;
+2F8FB;CJK COMPATIBILITY IDEOGRAPH-2F8FB;Lo;0;L;23CBC;;;;N;;;;;
+2F8FC;CJK COMPATIBILITY IDEOGRAPH-2F8FC;Lo;0;L;6CBF;;;;N;;;;;
+2F8FD;CJK COMPATIBILITY IDEOGRAPH-2F8FD;Lo;0;L;6CCD;;;;N;;;;;
+2F8FE;CJK COMPATIBILITY IDEOGRAPH-2F8FE;Lo;0;L;6C67;;;;N;;;;;
+2F8FF;CJK COMPATIBILITY IDEOGRAPH-2F8FF;Lo;0;L;6D16;;;;N;;;;;
+2F900;CJK COMPATIBILITY IDEOGRAPH-2F900;Lo;0;L;6D3E;;;;N;;;;;
+2F901;CJK COMPATIBILITY IDEOGRAPH-2F901;Lo;0;L;6D77;;;;N;;;;;
+2F902;CJK COMPATIBILITY IDEOGRAPH-2F902;Lo;0;L;6D41;;;;N;;;;;
+2F903;CJK COMPATIBILITY IDEOGRAPH-2F903;Lo;0;L;6D69;;;;N;;;;;
+2F904;CJK COMPATIBILITY IDEOGRAPH-2F904;Lo;0;L;6D78;;;;N;;;;;
+2F905;CJK COMPATIBILITY IDEOGRAPH-2F905;Lo;0;L;6D85;;;;N;;;;;
+2F906;CJK COMPATIBILITY IDEOGRAPH-2F906;Lo;0;L;23D1E;;;;N;;;;;
+2F907;CJK COMPATIBILITY IDEOGRAPH-2F907;Lo;0;L;6D34;;;;N;;;;;
+2F908;CJK COMPATIBILITY IDEOGRAPH-2F908;Lo;0;L;6E2F;;;;N;;;;;
+2F909;CJK COMPATIBILITY IDEOGRAPH-2F909;Lo;0;L;6E6E;;;;N;;;;;
+2F90A;CJK COMPATIBILITY IDEOGRAPH-2F90A;Lo;0;L;3D33;;;;N;;;;;
+2F90B;CJK COMPATIBILITY IDEOGRAPH-2F90B;Lo;0;L;6ECB;;;;N;;;;;
+2F90C;CJK COMPATIBILITY IDEOGRAPH-2F90C;Lo;0;L;6EC7;;;;N;;;;;
+2F90D;CJK COMPATIBILITY IDEOGRAPH-2F90D;Lo;0;L;23ED1;;;;N;;;;;
+2F90E;CJK COMPATIBILITY IDEOGRAPH-2F90E;Lo;0;L;6DF9;;;;N;;;;;
+2F90F;CJK COMPATIBILITY IDEOGRAPH-2F90F;Lo;0;L;6F6E;;;;N;;;;;
+2F910;CJK COMPATIBILITY IDEOGRAPH-2F910;Lo;0;L;23F5E;;;;N;;;;;
+2F911;CJK COMPATIBILITY IDEOGRAPH-2F911;Lo;0;L;23F8E;;;;N;;;;;
+2F912;CJK COMPATIBILITY IDEOGRAPH-2F912;Lo;0;L;6FC6;;;;N;;;;;
+2F913;CJK COMPATIBILITY IDEOGRAPH-2F913;Lo;0;L;7039;;;;N;;;;;
+2F914;CJK COMPATIBILITY IDEOGRAPH-2F914;Lo;0;L;701E;;;;N;;;;;
+2F915;CJK COMPATIBILITY IDEOGRAPH-2F915;Lo;0;L;701B;;;;N;;;;;
+2F916;CJK COMPATIBILITY IDEOGRAPH-2F916;Lo;0;L;3D96;;;;N;;;;;
+2F917;CJK COMPATIBILITY IDEOGRAPH-2F917;Lo;0;L;704A;;;;N;;;;;
+2F918;CJK COMPATIBILITY IDEOGRAPH-2F918;Lo;0;L;707D;;;;N;;;;;
+2F919;CJK COMPATIBILITY IDEOGRAPH-2F919;Lo;0;L;7077;;;;N;;;;;
+2F91A;CJK COMPATIBILITY IDEOGRAPH-2F91A;Lo;0;L;70AD;;;;N;;;;;
+2F91B;CJK COMPATIBILITY IDEOGRAPH-2F91B;Lo;0;L;20525;;;;N;;;;;
+2F91C;CJK COMPATIBILITY IDEOGRAPH-2F91C;Lo;0;L;7145;;;;N;;;;;
+2F91D;CJK COMPATIBILITY IDEOGRAPH-2F91D;Lo;0;L;24263;;;;N;;;;;
+2F91E;CJK COMPATIBILITY IDEOGRAPH-2F91E;Lo;0;L;719C;;;;N;;;;;
+2F91F;CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo;0;L;243AB;;;;N;;;;;
+2F920;CJK COMPATIBILITY IDEOGRAPH-2F920;Lo;0;L;7228;;;;N;;;;;
+2F921;CJK COMPATIBILITY IDEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;
+2F922;CJK COMPATIBILITY IDEOGRAPH-2F922;Lo;0;L;7250;;;;N;;;;;
+2F923;CJK COMPATIBILITY IDEOGRAPH-2F923;Lo;0;L;24608;;;;N;;;;;
+2F924;CJK COMPATIBILITY IDEOGRAPH-2F924;Lo;0;L;7280;;;;N;;;;;
+2F925;CJK COMPATIBILITY IDEOGRAPH-2F925;Lo;0;L;7295;;;;N;;;;;
+2F926;CJK COMPATIBILITY IDEOGRAPH-2F926;Lo;0;L;24735;;;;N;;;;;
+2F927;CJK COMPATIBILITY IDEOGRAPH-2F927;Lo;0;L;24814;;;;N;;;;;
+2F928;CJK COMPATIBILITY IDEOGRAPH-2F928;Lo;0;L;737A;;;;N;;;;;
+2F929;CJK COMPATIBILITY IDEOGRAPH-2F929;Lo;0;L;738B;;;;N;;;;;
+2F92A;CJK COMPATIBILITY IDEOGRAPH-2F92A;Lo;0;L;3EAC;;;;N;;;;;
+2F92B;CJK COMPATIBILITY IDEOGRAPH-2F92B;Lo;0;L;73A5;;;;N;;;;;
+2F92C;CJK COMPATIBILITY IDEOGRAPH-2F92C;Lo;0;L;3EB8;;;;N;;;;;
+2F92D;CJK COMPATIBILITY IDEOGRAPH-2F92D;Lo;0;L;3EB8;;;;N;;;;;
+2F92E;CJK COMPATIBILITY IDEOGRAPH-2F92E;Lo;0;L;7447;;;;N;;;;;
+2F92F;CJK COMPATIBILITY IDEOGRAPH-2F92F;Lo;0;L;745C;;;;N;;;;;
+2F930;CJK COMPATIBILITY IDEOGRAPH-2F930;Lo;0;L;7471;;;;N;;;;;
+2F931;CJK COMPATIBILITY IDEOGRAPH-2F931;Lo;0;L;7485;;;;N;;;;;
+2F932;CJK COMPATIBILITY IDEOGRAPH-2F932;Lo;0;L;74CA;;;;N;;;;;
+2F933;CJK COMPATIBILITY IDEOGRAPH-2F933;Lo;0;L;3F1B;;;;N;;;;;
+2F934;CJK COMPATIBILITY IDEOGRAPH-2F934;Lo;0;L;7524;;;;N;;;;;
+2F935;CJK COMPATIBILITY IDEOGRAPH-2F935;Lo;0;L;24C36;;;;N;;;;;
+2F936;CJK COMPATIBILITY IDEOGRAPH-2F936;Lo;0;L;753E;;;;N;;;;;
+2F937;CJK COMPATIBILITY IDEOGRAPH-2F937;Lo;0;L;24C92;;;;N;;;;;
+2F938;CJK COMPATIBILITY IDEOGRAPH-2F938;Lo;0;L;7570;;;;N;;;;;
+2F939;CJK COMPATIBILITY IDEOGRAPH-2F939;Lo;0;L;2219F;;;;N;;;;;
+2F93A;CJK COMPATIBILITY IDEOGRAPH-2F93A;Lo;0;L;7610;;;;N;;;;;
+2F93B;CJK COMPATIBILITY IDEOGRAPH-2F93B;Lo;0;L;24FA1;;;;N;;;;;
+2F93C;CJK COMPATIBILITY IDEOGRAPH-2F93C;Lo;0;L;24FB8;;;;N;;;;;
+2F93D;CJK COMPATIBILITY IDEOGRAPH-2F93D;Lo;0;L;25044;;;;N;;;;;
+2F93E;CJK COMPATIBILITY IDEOGRAPH-2F93E;Lo;0;L;3FFC;;;;N;;;;;
+2F93F;CJK COMPATIBILITY IDEOGRAPH-2F93F;Lo;0;L;4008;;;;N;;;;;
+2F940;CJK COMPATIBILITY IDEOGRAPH-2F940;Lo;0;L;76F4;;;;N;;;;;
+2F941;CJK COMPATIBILITY IDEOGRAPH-2F941;Lo;0;L;250F3;;;;N;;;;;
+2F942;CJK COMPATIBILITY IDEOGRAPH-2F942;Lo;0;L;250F2;;;;N;;;;;
+2F943;CJK COMPATIBILITY IDEOGRAPH-2F943;Lo;0;L;25119;;;;N;;;;;
+2F944;CJK COMPATIBILITY IDEOGRAPH-2F944;Lo;0;L;25133;;;;N;;;;;
+2F945;CJK COMPATIBILITY IDEOGRAPH-2F945;Lo;0;L;771E;;;;N;;;;;
+2F946;CJK COMPATIBILITY IDEOGRAPH-2F946;Lo;0;L;771F;;;;N;;;;;
+2F947;CJK COMPATIBILITY IDEOGRAPH-2F947;Lo;0;L;771F;;;;N;;;;;
+2F948;CJK COMPATIBILITY IDEOGRAPH-2F948;Lo;0;L;774A;;;;N;;;;;
+2F949;CJK COMPATIBILITY IDEOGRAPH-2F949;Lo;0;L;4039;;;;N;;;;;
+2F94A;CJK COMPATIBILITY IDEOGRAPH-2F94A;Lo;0;L;778B;;;;N;;;;;
+2F94B;CJK COMPATIBILITY IDEOGRAPH-2F94B;Lo;0;L;4046;;;;N;;;;;
+2F94C;CJK COMPATIBILITY IDEOGRAPH-2F94C;Lo;0;L;4096;;;;N;;;;;
+2F94D;CJK COMPATIBILITY IDEOGRAPH-2F94D;Lo;0;L;2541D;;;;N;;;;;
+2F94E;CJK COMPATIBILITY IDEOGRAPH-2F94E;Lo;0;L;784E;;;;N;;;;;
+2F94F;CJK COMPATIBILITY IDEOGRAPH-2F94F;Lo;0;L;788C;;;;N;;;;;
+2F950;CJK COMPATIBILITY IDEOGRAPH-2F950;Lo;0;L;78CC;;;;N;;;;;
+2F951;CJK COMPATIBILITY IDEOGRAPH-2F951;Lo;0;L;40E3;;;;N;;;;;
+2F952;CJK COMPATIBILITY IDEOGRAPH-2F952;Lo;0;L;25626;;;;N;;;;;
+2F953;CJK COMPATIBILITY IDEOGRAPH-2F953;Lo;0;L;7956;;;;N;;;;;
+2F954;CJK COMPATIBILITY IDEOGRAPH-2F954;Lo;0;L;2569A;;;;N;;;;;
+2F955;CJK COMPATIBILITY IDEOGRAPH-2F955;Lo;0;L;256C5;;;;N;;;;;
+2F956;CJK COMPATIBILITY IDEOGRAPH-2F956;Lo;0;L;798F;;;;N;;;;;
+2F957;CJK COMPATIBILITY IDEOGRAPH-2F957;Lo;0;L;79EB;;;;N;;;;;
+2F958;CJK COMPATIBILITY IDEOGRAPH-2F958;Lo;0;L;412F;;;;N;;;;;
+2F959;CJK COMPATIBILITY IDEOGRAPH-2F959;Lo;0;L;7A40;;;;N;;;;;
+2F95A;CJK COMPATIBILITY IDEOGRAPH-2F95A;Lo;0;L;7A4A;;;;N;;;;;
+2F95B;CJK COMPATIBILITY IDEOGRAPH-2F95B;Lo;0;L;7A4F;;;;N;;;;;
+2F95C;CJK COMPATIBILITY IDEOGRAPH-2F95C;Lo;0;L;2597C;;;;N;;;;;
+2F95D;CJK COMPATIBILITY IDEOGRAPH-2F95D;Lo;0;L;25AA7;;;;N;;;;;
+2F95E;CJK COMPATIBILITY IDEOGRAPH-2F95E;Lo;0;L;25AA7;;;;N;;;;;
+2F95F;CJK COMPATIBILITY IDEOGRAPH-2F95F;Lo;0;L;7AEE;;;;N;;;;;
+2F960;CJK COMPATIBILITY IDEOGRAPH-2F960;Lo;0;L;4202;;;;N;;;;;
+2F961;CJK COMPATIBILITY IDEOGRAPH-2F961;Lo;0;L;25BAB;;;;N;;;;;
+2F962;CJK COMPATIBILITY IDEOGRAPH-2F962;Lo;0;L;7BC6;;;;N;;;;;
+2F963;CJK COMPATIBILITY IDEOGRAPH-2F963;Lo;0;L;7BC9;;;;N;;;;;
+2F964;CJK COMPATIBILITY IDEOGRAPH-2F964;Lo;0;L;4227;;;;N;;;;;
+2F965;CJK COMPATIBILITY IDEOGRAPH-2F965;Lo;0;L;25C80;;;;N;;;;;
+2F966;CJK COMPATIBILITY IDEOGRAPH-2F966;Lo;0;L;7CD2;;;;N;;;;;
+2F967;CJK COMPATIBILITY IDEOGRAPH-2F967;Lo;0;L;42A0;;;;N;;;;;
+2F968;CJK COMPATIBILITY IDEOGRAPH-2F968;Lo;0;L;7CE8;;;;N;;;;;
+2F969;CJK COMPATIBILITY IDEOGRAPH-2F969;Lo;0;L;7CE3;;;;N;;;;;
+2F96A;CJK COMPATIBILITY IDEOGRAPH-2F96A;Lo;0;L;7D00;;;;N;;;;;
+2F96B;CJK COMPATIBILITY IDEOGRAPH-2F96B;Lo;0;L;25F86;;;;N;;;;;
+2F96C;CJK COMPATIBILITY IDEOGRAPH-2F96C;Lo;0;L;7D63;;;;N;;;;;
+2F96D;CJK COMPATIBILITY IDEOGRAPH-2F96D;Lo;0;L;4301;;;;N;;;;;
+2F96E;CJK COMPATIBILITY IDEOGRAPH-2F96E;Lo;0;L;7DC7;;;;N;;;;;
+2F96F;CJK COMPATIBILITY IDEOGRAPH-2F96F;Lo;0;L;7E02;;;;N;;;;;
+2F970;CJK COMPATIBILITY IDEOGRAPH-2F970;Lo;0;L;7E45;;;;N;;;;;
+2F971;CJK COMPATIBILITY IDEOGRAPH-2F971;Lo;0;L;4334;;;;N;;;;;
+2F972;CJK COMPATIBILITY IDEOGRAPH-2F972;Lo;0;L;26228;;;;N;;;;;
+2F973;CJK COMPATIBILITY IDEOGRAPH-2F973;Lo;0;L;26247;;;;N;;;;;
+2F974;CJK COMPATIBILITY IDEOGRAPH-2F974;Lo;0;L;4359;;;;N;;;;;
+2F975;CJK COMPATIBILITY IDEOGRAPH-2F975;Lo;0;L;262D9;;;;N;;;;;
+2F976;CJK COMPATIBILITY IDEOGRAPH-2F976;Lo;0;L;7F7A;;;;N;;;;;
+2F977;CJK COMPATIBILITY IDEOGRAPH-2F977;Lo;0;L;2633E;;;;N;;;;;
+2F978;CJK COMPATIBILITY IDEOGRAPH-2F978;Lo;0;L;7F95;;;;N;;;;;
+2F979;CJK COMPATIBILITY IDEOGRAPH-2F979;Lo;0;L;7FFA;;;;N;;;;;
+2F97A;CJK COMPATIBILITY IDEOGRAPH-2F97A;Lo;0;L;8005;;;;N;;;;;
+2F97B;CJK COMPATIBILITY IDEOGRAPH-2F97B;Lo;0;L;264DA;;;;N;;;;;
+2F97C;CJK COMPATIBILITY IDEOGRAPH-2F97C;Lo;0;L;26523;;;;N;;;;;
+2F97D;CJK COMPATIBILITY IDEOGRAPH-2F97D;Lo;0;L;8060;;;;N;;;;;
+2F97E;CJK COMPATIBILITY IDEOGRAPH-2F97E;Lo;0;L;265A8;;;;N;;;;;
+2F97F;CJK COMPATIBILITY IDEOGRAPH-2F97F;Lo;0;L;8070;;;;N;;;;;
+2F980;CJK COMPATIBILITY IDEOGRAPH-2F980;Lo;0;L;2335F;;;;N;;;;;
+2F981;CJK COMPATIBILITY IDEOGRAPH-2F981;Lo;0;L;43D5;;;;N;;;;;
+2F982;CJK COMPATIBILITY IDEOGRAPH-2F982;Lo;0;L;80B2;;;;N;;;;;
+2F983;CJK COMPATIBILITY IDEOGRAPH-2F983;Lo;0;L;8103;;;;N;;;;;
+2F984;CJK COMPATIBILITY IDEOGRAPH-2F984;Lo;0;L;440B;;;;N;;;;;
+2F985;CJK COMPATIBILITY IDEOGRAPH-2F985;Lo;0;L;813E;;;;N;;;;;
+2F986;CJK COMPATIBILITY IDEOGRAPH-2F986;Lo;0;L;5AB5;;;;N;;;;;
+2F987;CJK COMPATIBILITY IDEOGRAPH-2F987;Lo;0;L;267A7;;;;N;;;;;
+2F988;CJK COMPATIBILITY IDEOGRAPH-2F988;Lo;0;L;267B5;;;;N;;;;;
+2F989;CJK COMPATIBILITY IDEOGRAPH-2F989;Lo;0;L;23393;;;;N;;;;;
+2F98A;CJK COMPATIBILITY IDEOGRAPH-2F98A;Lo;0;L;2339C;;;;N;;;;;
+2F98B;CJK COMPATIBILITY IDEOGRAPH-2F98B;Lo;0;L;8201;;;;N;;;;;
+2F98C;CJK COMPATIBILITY IDEOGRAPH-2F98C;Lo;0;L;8204;;;;N;;;;;
+2F98D;CJK COMPATIBILITY IDEOGRAPH-2F98D;Lo;0;L;8F9E;;;;N;;;;;
+2F98E;CJK COMPATIBILITY IDEOGRAPH-2F98E;Lo;0;L;446B;;;;N;;;;;
+2F98F;CJK COMPATIBILITY IDEOGRAPH-2F98F;Lo;0;L;8291;;;;N;;;;;
+2F990;CJK COMPATIBILITY IDEOGRAPH-2F990;Lo;0;L;828B;;;;N;;;;;
+2F991;CJK COMPATIBILITY IDEOGRAPH-2F991;Lo;0;L;829D;;;;N;;;;;
+2F992;CJK COMPATIBILITY IDEOGRAPH-2F992;Lo;0;L;52B3;;;;N;;;;;
+2F993;CJK COMPATIBILITY IDEOGRAPH-2F993;Lo;0;L;82B1;;;;N;;;;;
+2F994;CJK COMPATIBILITY IDEOGRAPH-2F994;Lo;0;L;82B3;;;;N;;;;;
+2F995;CJK COMPATIBILITY IDEOGRAPH-2F995;Lo;0;L;82BD;;;;N;;;;;
+2F996;CJK COMPATIBILITY IDEOGRAPH-2F996;Lo;0;L;82E6;;;;N;;;;;
+2F997;CJK COMPATIBILITY IDEOGRAPH-2F997;Lo;0;L;26B3C;;;;N;;;;;
+2F998;CJK COMPATIBILITY IDEOGRAPH-2F998;Lo;0;L;82E5;;;;N;;;;;
+2F999;CJK COMPATIBILITY IDEOGRAPH-2F999;Lo;0;L;831D;;;;N;;;;;
+2F99A;CJK COMPATIBILITY IDEOGRAPH-2F99A;Lo;0;L;8363;;;;N;;;;;
+2F99B;CJK COMPATIBILITY IDEOGRAPH-2F99B;Lo;0;L;83AD;;;;N;;;;;
+2F99C;CJK COMPATIBILITY IDEOGRAPH-2F99C;Lo;0;L;8323;;;;N;;;;;
+2F99D;CJK COMPATIBILITY IDEOGRAPH-2F99D;Lo;0;L;83BD;;;;N;;;;;
+2F99E;CJK COMPATIBILITY IDEOGRAPH-2F99E;Lo;0;L;83E7;;;;N;;;;;
+2F99F;CJK COMPATIBILITY IDEOGRAPH-2F99F;Lo;0;L;8457;;;;N;;;;;
+2F9A0;CJK COMPATIBILITY IDEOGRAPH-2F9A0;Lo;0;L;8353;;;;N;;;;;
+2F9A1;CJK COMPATIBILITY IDEOGRAPH-2F9A1;Lo;0;L;83CA;;;;N;;;;;
+2F9A2;CJK COMPATIBILITY IDEOGRAPH-2F9A2;Lo;0;L;83CC;;;;N;;;;;
+2F9A3;CJK COMPATIBILITY IDEOGRAPH-2F9A3;Lo;0;L;83DC;;;;N;;;;;
+2F9A4;CJK COMPATIBILITY IDEOGRAPH-2F9A4;Lo;0;L;26C36;;;;N;;;;;
+2F9A5;CJK COMPATIBILITY IDEOGRAPH-2F9A5;Lo;0;L;26D6B;;;;N;;;;;
+2F9A6;CJK COMPATIBILITY IDEOGRAPH-2F9A6;Lo;0;L;26CD5;;;;N;;;;;
+2F9A7;CJK COMPATIBILITY IDEOGRAPH-2F9A7;Lo;0;L;452B;;;;N;;;;;
+2F9A8;CJK COMPATIBILITY IDEOGRAPH-2F9A8;Lo;0;L;84F1;;;;N;;;;;
+2F9A9;CJK COMPATIBILITY IDEOGRAPH-2F9A9;Lo;0;L;84F3;;;;N;;;;;
+2F9AA;CJK COMPATIBILITY IDEOGRAPH-2F9AA;Lo;0;L;8516;;;;N;;;;;
+2F9AB;CJK COMPATIBILITY IDEOGRAPH-2F9AB;Lo;0;L;273CA;;;;N;;;;;
+2F9AC;CJK COMPATIBILITY IDEOGRAPH-2F9AC;Lo;0;L;8564;;;;N;;;;;
+2F9AD;CJK COMPATIBILITY IDEOGRAPH-2F9AD;Lo;0;L;26F2C;;;;N;;;;;
+2F9AE;CJK COMPATIBILITY IDEOGRAPH-2F9AE;Lo;0;L;455D;;;;N;;;;;
+2F9AF;CJK COMPATIBILITY IDEOGRAPH-2F9AF;Lo;0;L;4561;;;;N;;;;;
+2F9B0;CJK COMPATIBILITY IDEOGRAPH-2F9B0;Lo;0;L;26FB1;;;;N;;;;;
+2F9B1;CJK COMPATIBILITY IDEOGRAPH-2F9B1;Lo;0;L;270D2;;;;N;;;;;
+2F9B2;CJK COMPATIBILITY IDEOGRAPH-2F9B2;Lo;0;L;456B;;;;N;;;;;
+2F9B3;CJK COMPATIBILITY IDEOGRAPH-2F9B3;Lo;0;L;8650;;;;N;;;;;
+2F9B4;CJK COMPATIBILITY IDEOGRAPH-2F9B4;Lo;0;L;865C;;;;N;;;;;
+2F9B5;CJK COMPATIBILITY IDEOGRAPH-2F9B5;Lo;0;L;8667;;;;N;;;;;
+2F9B6;CJK COMPATIBILITY IDEOGRAPH-2F9B6;Lo;0;L;8669;;;;N;;;;;
+2F9B7;CJK COMPATIBILITY IDEOGRAPH-2F9B7;Lo;0;L;86A9;;;;N;;;;;
+2F9B8;CJK COMPATIBILITY IDEOGRAPH-2F9B8;Lo;0;L;8688;;;;N;;;;;
+2F9B9;CJK COMPATIBILITY IDEOGRAPH-2F9B9;Lo;0;L;870E;;;;N;;;;;
+2F9BA;CJK COMPATIBILITY IDEOGRAPH-2F9BA;Lo;0;L;86E2;;;;N;;;;;
+2F9BB;CJK COMPATIBILITY IDEOGRAPH-2F9BB;Lo;0;L;8779;;;;N;;;;;
+2F9BC;CJK COMPATIBILITY IDEOGRAPH-2F9BC;Lo;0;L;8728;;;;N;;;;;
+2F9BD;CJK COMPATIBILITY IDEOGRAPH-2F9BD;Lo;0;L;876B;;;;N;;;;;
+2F9BE;CJK COMPATIBILITY IDEOGRAPH-2F9BE;Lo;0;L;8786;;;;N;;;;;
+2F9BF;CJK COMPATIBILITY IDEOGRAPH-2F9BF;Lo;0;L;45D7;;;;N;;;;;
+2F9C0;CJK COMPATIBILITY IDEOGRAPH-2F9C0;Lo;0;L;87E1;;;;N;;;;;
+2F9C1;CJK COMPATIBILITY IDEOGRAPH-2F9C1;Lo;0;L;8801;;;;N;;;;;
+2F9C2;CJK COMPATIBILITY IDEOGRAPH-2F9C2;Lo;0;L;45F9;;;;N;;;;;
+2F9C3;CJK COMPATIBILITY IDEOGRAPH-2F9C3;Lo;0;L;8860;;;;N;;;;;
+2F9C4;CJK COMPATIBILITY IDEOGRAPH-2F9C4;Lo;0;L;8863;;;;N;;;;;
+2F9C5;CJK COMPATIBILITY IDEOGRAPH-2F9C5;Lo;0;L;27667;;;;N;;;;;
+2F9C6;CJK COMPATIBILITY IDEOGRAPH-2F9C6;Lo;0;L;88D7;;;;N;;;;;
+2F9C7;CJK COMPATIBILITY IDEOGRAPH-2F9C7;Lo;0;L;88DE;;;;N;;;;;
+2F9C8;CJK COMPATIBILITY IDEOGRAPH-2F9C8;Lo;0;L;4635;;;;N;;;;;
+2F9C9;CJK COMPATIBILITY IDEOGRAPH-2F9C9;Lo;0;L;88FA;;;;N;;;;;
+2F9CA;CJK COMPATIBILITY IDEOGRAPH-2F9CA;Lo;0;L;34BB;;;;N;;;;;
+2F9CB;CJK COMPATIBILITY IDEOGRAPH-2F9CB;Lo;0;L;278AE;;;;N;;;;;
+2F9CC;CJK COMPATIBILITY IDEOGRAPH-2F9CC;Lo;0;L;27966;;;;N;;;;;
+2F9CD;CJK COMPATIBILITY IDEOGRAPH-2F9CD;Lo;0;L;46BE;;;;N;;;;;
+2F9CE;CJK COMPATIBILITY IDEOGRAPH-2F9CE;Lo;0;L;46C7;;;;N;;;;;
+2F9CF;CJK COMPATIBILITY IDEOGRAPH-2F9CF;Lo;0;L;8AA0;;;;N;;;;;
+2F9D0;CJK COMPATIBILITY IDEOGRAPH-2F9D0;Lo;0;L;8AED;;;;N;;;;;
+2F9D1;CJK COMPATIBILITY IDEOGRAPH-2F9D1;Lo;0;L;8B8A;;;;N;;;;;
+2F9D2;CJK COMPATIBILITY IDEOGRAPH-2F9D2;Lo;0;L;8C55;;;;N;;;;;
+2F9D3;CJK COMPATIBILITY IDEOGRAPH-2F9D3;Lo;0;L;27CA8;;;;N;;;;;
+2F9D4;CJK COMPATIBILITY IDEOGRAPH-2F9D4;Lo;0;L;8CAB;;;;N;;;;;
+2F9D5;CJK COMPATIBILITY IDEOGRAPH-2F9D5;Lo;0;L;8CC1;;;;N;;;;;
+2F9D6;CJK COMPATIBILITY IDEOGRAPH-2F9D6;Lo;0;L;8D1B;;;;N;;;;;
+2F9D7;CJK COMPATIBILITY IDEOGRAPH-2F9D7;Lo;0;L;8D77;;;;N;;;;;
+2F9D8;CJK COMPATIBILITY IDEOGRAPH-2F9D8;Lo;0;L;27F2F;;;;N;;;;;
+2F9D9;CJK COMPATIBILITY IDEOGRAPH-2F9D9;Lo;0;L;20804;;;;N;;;;;
+2F9DA;CJK COMPATIBILITY IDEOGRAPH-2F9DA;Lo;0;L;8DCB;;;;N;;;;;
+2F9DB;CJK COMPATIBILITY IDEOGRAPH-2F9DB;Lo;0;L;8DBC;;;;N;;;;;
+2F9DC;CJK COMPATIBILITY IDEOGRAPH-2F9DC;Lo;0;L;8DF0;;;;N;;;;;
+2F9DD;CJK COMPATIBILITY IDEOGRAPH-2F9DD;Lo;0;L;208DE;;;;N;;;;;
+2F9DE;CJK COMPATIBILITY IDEOGRAPH-2F9DE;Lo;0;L;8ED4;;;;N;;;;;
+2F9DF;CJK COMPATIBILITY IDEOGRAPH-2F9DF;Lo;0;L;8F38;;;;N;;;;;
+2F9E0;CJK COMPATIBILITY IDEOGRAPH-2F9E0;Lo;0;L;285D2;;;;N;;;;;
+2F9E1;CJK COMPATIBILITY IDEOGRAPH-2F9E1;Lo;0;L;285ED;;;;N;;;;;
+2F9E2;CJK COMPATIBILITY IDEOGRAPH-2F9E2;Lo;0;L;9094;;;;N;;;;;
+2F9E3;CJK COMPATIBILITY IDEOGRAPH-2F9E3;Lo;0;L;90F1;;;;N;;;;;
+2F9E4;CJK COMPATIBILITY IDEOGRAPH-2F9E4;Lo;0;L;9111;;;;N;;;;;
+2F9E5;CJK COMPATIBILITY IDEOGRAPH-2F9E5;Lo;0;L;2872E;;;;N;;;;;
+2F9E6;CJK COMPATIBILITY IDEOGRAPH-2F9E6;Lo;0;L;911B;;;;N;;;;;
+2F9E7;CJK COMPATIBILITY IDEOGRAPH-2F9E7;Lo;0;L;9238;;;;N;;;;;
+2F9E8;CJK COMPATIBILITY IDEOGRAPH-2F9E8;Lo;0;L;92D7;;;;N;;;;;
+2F9E9;CJK COMPATIBILITY IDEOGRAPH-2F9E9;Lo;0;L;92D8;;;;N;;;;;
+2F9EA;CJK COMPATIBILITY IDEOGRAPH-2F9EA;Lo;0;L;927C;;;;N;;;;;
+2F9EB;CJK COMPATIBILITY IDEOGRAPH-2F9EB;Lo;0;L;93F9;;;;N;;;;;
+2F9EC;CJK COMPATIBILITY IDEOGRAPH-2F9EC;Lo;0;L;9415;;;;N;;;;;
+2F9ED;CJK COMPATIBILITY IDEOGRAPH-2F9ED;Lo;0;L;28BFA;;;;N;;;;;
+2F9EE;CJK COMPATIBILITY IDEOGRAPH-2F9EE;Lo;0;L;958B;;;;N;;;;;
+2F9EF;CJK COMPATIBILITY IDEOGRAPH-2F9EF;Lo;0;L;4995;;;;N;;;;;
+2F9F0;CJK COMPATIBILITY IDEOGRAPH-2F9F0;Lo;0;L;95B7;;;;N;;;;;
+2F9F1;CJK COMPATIBILITY IDEOGRAPH-2F9F1;Lo;0;L;28D77;;;;N;;;;;
+2F9F2;CJK COMPATIBILITY IDEOGRAPH-2F9F2;Lo;0;L;49E6;;;;N;;;;;
+2F9F3;CJK COMPATIBILITY IDEOGRAPH-2F9F3;Lo;0;L;96C3;;;;N;;;;;
+2F9F4;CJK COMPATIBILITY IDEOGRAPH-2F9F4;Lo;0;L;5DB2;;;;N;;;;;
+2F9F5;CJK COMPATIBILITY IDEOGRAPH-2F9F5;Lo;0;L;9723;;;;N;;;;;
+2F9F6;CJK COMPATIBILITY IDEOGRAPH-2F9F6;Lo;0;L;29145;;;;N;;;;;
+2F9F7;CJK COMPATIBILITY IDEOGRAPH-2F9F7;Lo;0;L;2921A;;;;N;;;;;
+2F9F8;CJK COMPATIBILITY IDEOGRAPH-2F9F8;Lo;0;L;4A6E;;;;N;;;;;
+2F9F9;CJK COMPATIBILITY IDEOGRAPH-2F9F9;Lo;0;L;4A76;;;;N;;;;;
+2F9FA;CJK COMPATIBILITY IDEOGRAPH-2F9FA;Lo;0;L;97E0;;;;N;;;;;
+2F9FB;CJK COMPATIBILITY IDEOGRAPH-2F9FB;Lo;0;L;2940A;;;;N;;;;;
+2F9FC;CJK COMPATIBILITY IDEOGRAPH-2F9FC;Lo;0;L;4AB2;;;;N;;;;;
+2F9FD;CJK COMPATIBILITY IDEOGRAPH-2F9FD;Lo;0;L;29496;;;;N;;;;;
+2F9FE;CJK COMPATIBILITY IDEOGRAPH-2F9FE;Lo;0;L;980B;;;;N;;;;;
+2F9FF;CJK COMPATIBILITY IDEOGRAPH-2F9FF;Lo;0;L;980B;;;;N;;;;;
+2FA00;CJK COMPATIBILITY IDEOGRAPH-2FA00;Lo;0;L;9829;;;;N;;;;;
+2FA01;CJK COMPATIBILITY IDEOGRAPH-2FA01;Lo;0;L;295B6;;;;N;;;;;
+2FA02;CJK COMPATIBILITY IDEOGRAPH-2FA02;Lo;0;L;98E2;;;;N;;;;;
+2FA03;CJK COMPATIBILITY IDEOGRAPH-2FA03;Lo;0;L;4B33;;;;N;;;;;
+2FA04;CJK COMPATIBILITY IDEOGRAPH-2FA04;Lo;0;L;9929;;;;N;;;;;
+2FA05;CJK COMPATIBILITY IDEOGRAPH-2FA05;Lo;0;L;99A7;;;;N;;;;;
+2FA06;CJK COMPATIBILITY IDEOGRAPH-2FA06;Lo;0;L;99C2;;;;N;;;;;
+2FA07;CJK COMPATIBILITY IDEOGRAPH-2FA07;Lo;0;L;99FE;;;;N;;;;;
+2FA08;CJK COMPATIBILITY IDEOGRAPH-2FA08;Lo;0;L;4BCE;;;;N;;;;;
+2FA09;CJK COMPATIBILITY IDEOGRAPH-2FA09;Lo;0;L;29B30;;;;N;;;;;
+2FA0A;CJK COMPATIBILITY IDEOGRAPH-2FA0A;Lo;0;L;9B12;;;;N;;;;;
+2FA0B;CJK COMPATIBILITY IDEOGRAPH-2FA0B;Lo;0;L;9C40;;;;N;;;;;
+2FA0C;CJK COMPATIBILITY IDEOGRAPH-2FA0C;Lo;0;L;9CFD;;;;N;;;;;
+2FA0D;CJK COMPATIBILITY IDEOGRAPH-2FA0D;Lo;0;L;4CCE;;;;N;;;;;
+2FA0E;CJK COMPATIBILITY IDEOGRAPH-2FA0E;Lo;0;L;4CED;;;;N;;;;;
+2FA0F;CJK COMPATIBILITY IDEOGRAPH-2FA0F;Lo;0;L;9D67;;;;N;;;;;
+2FA10;CJK COMPATIBILITY IDEOGRAPH-2FA10;Lo;0;L;2A0CE;;;;N;;;;;
+2FA11;CJK COMPATIBILITY IDEOGRAPH-2FA11;Lo;0;L;4CF8;;;;N;;;;;
+2FA12;CJK COMPATIBILITY IDEOGRAPH-2FA12;Lo;0;L;2A105;;;;N;;;;;
+2FA13;CJK COMPATIBILITY IDEOGRAPH-2FA13;Lo;0;L;2A20E;;;;N;;;;;
+2FA14;CJK COMPATIBILITY IDEOGRAPH-2FA14;Lo;0;L;2A291;;;;N;;;;;
+2FA15;CJK COMPATIBILITY IDEOGRAPH-2FA15;Lo;0;L;9EBB;;;;N;;;;;
+2FA16;CJK COMPATIBILITY IDEOGRAPH-2FA16;Lo;0;L;4D56;;;;N;;;;;
+2FA17;CJK COMPATIBILITY IDEOGRAPH-2FA17;Lo;0;L;9EF9;;;;N;;;;;
+2FA18;CJK COMPATIBILITY IDEOGRAPH-2FA18;Lo;0;L;9EFE;;;;N;;;;;
+2FA19;CJK COMPATIBILITY IDEOGRAPH-2FA19;Lo;0;L;9F05;;;;N;;;;;
+2FA1A;CJK COMPATIBILITY IDEOGRAPH-2FA1A;Lo;0;L;9F0F;;;;N;;;;;
+2FA1B;CJK COMPATIBILITY IDEOGRAPH-2FA1B;Lo;0;L;9F16;;;;N;;;;;
+2FA1C;CJK COMPATIBILITY IDEOGRAPH-2FA1C;Lo;0;L;9F3B;;;;N;;;;;
+2FA1D;CJK COMPATIBILITY IDEOGRAPH-2FA1D;Lo;0;L;2A600;;;;N;;;;;
+E0001;LANGUAGE TAG;Cf;0;BN;;;;;N;;;;;
+E0020;TAG SPACE;Cf;0;BN;;;;;N;;;;;
+E0021;TAG EXCLAMATION MARK;Cf;0;BN;;;;;N;;;;;
+E0022;TAG QUOTATION MARK;Cf;0;BN;;;;;N;;;;;
+E0023;TAG NUMBER SIGN;Cf;0;BN;;;;;N;;;;;
+E0024;TAG DOLLAR SIGN;Cf;0;BN;;;;;N;;;;;
+E0025;TAG PERCENT SIGN;Cf;0;BN;;;;;N;;;;;
+E0026;TAG AMPERSAND;Cf;0;BN;;;;;N;;;;;
+E0027;TAG APOSTROPHE;Cf;0;BN;;;;;N;;;;;
+E0028;TAG LEFT PARENTHESIS;Cf;0;BN;;;;;N;;;;;
+E0029;TAG RIGHT PARENTHESIS;Cf;0;BN;;;;;N;;;;;
+E002A;TAG ASTERISK;Cf;0;BN;;;;;N;;;;;
+E002B;TAG PLUS SIGN;Cf;0;BN;;;;;N;;;;;
+E002C;TAG COMMA;Cf;0;BN;;;;;N;;;;;
+E002D;TAG HYPHEN-MINUS;Cf;0;BN;;;;;N;;;;;
+E002E;TAG FULL STOP;Cf;0;BN;;;;;N;;;;;
+E002F;TAG SOLIDUS;Cf;0;BN;;;;;N;;;;;
+E0030;TAG DIGIT ZERO;Cf;0;BN;;;;;N;;;;;
+E0031;TAG DIGIT ONE;Cf;0;BN;;;;;N;;;;;
+E0032;TAG DIGIT TWO;Cf;0;BN;;;;;N;;;;;
+E0033;TAG DIGIT THREE;Cf;0;BN;;;;;N;;;;;
+E0034;TAG DIGIT FOUR;Cf;0;BN;;;;;N;;;;;
+E0035;TAG DIGIT FIVE;Cf;0;BN;;;;;N;;;;;
+E0036;TAG DIGIT SIX;Cf;0;BN;;;;;N;;;;;
+E0037;TAG DIGIT SEVEN;Cf;0;BN;;;;;N;;;;;
+E0038;TAG DIGIT EIGHT;Cf;0;BN;;;;;N;;;;;
+E0039;TAG DIGIT NINE;Cf;0;BN;;;;;N;;;;;
+E003A;TAG COLON;Cf;0;BN;;;;;N;;;;;
+E003B;TAG SEMICOLON;Cf;0;BN;;;;;N;;;;;
+E003C;TAG LESS-THAN SIGN;Cf;0;BN;;;;;N;;;;;
+E003D;TAG EQUALS SIGN;Cf;0;BN;;;;;N;;;;;
+E003E;TAG GREATER-THAN SIGN;Cf;0;BN;;;;;N;;;;;
+E003F;TAG QUESTION MARK;Cf;0;BN;;;;;N;;;;;
+E0040;TAG COMMERCIAL AT;Cf;0;BN;;;;;N;;;;;
+E0041;TAG LATIN CAPITAL LETTER A;Cf;0;BN;;;;;N;;;;;
+E0042;TAG LATIN CAPITAL LETTER B;Cf;0;BN;;;;;N;;;;;
+E0043;TAG LATIN CAPITAL LETTER C;Cf;0;BN;;;;;N;;;;;
+E0044;TAG LATIN CAPITAL LETTER D;Cf;0;BN;;;;;N;;;;;
+E0045;TAG LATIN CAPITAL LETTER E;Cf;0;BN;;;;;N;;;;;
+E0046;TAG LATIN CAPITAL LETTER F;Cf;0;BN;;;;;N;;;;;
+E0047;TAG LATIN CAPITAL LETTER G;Cf;0;BN;;;;;N;;;;;
+E0048;TAG LATIN CAPITAL LETTER H;Cf;0;BN;;;;;N;;;;;
+E0049;TAG LATIN CAPITAL LETTER I;Cf;0;BN;;;;;N;;;;;
+E004A;TAG LATIN CAPITAL LETTER J;Cf;0;BN;;;;;N;;;;;
+E004B;TAG LATIN CAPITAL LETTER K;Cf;0;BN;;;;;N;;;;;
+E004C;TAG LATIN CAPITAL LETTER L;Cf;0;BN;;;;;N;;;;;
+E004D;TAG LATIN CAPITAL LETTER M;Cf;0;BN;;;;;N;;;;;
+E004E;TAG LATIN CAPITAL LETTER N;Cf;0;BN;;;;;N;;;;;
+E004F;TAG LATIN CAPITAL LETTER O;Cf;0;BN;;;;;N;;;;;
+E0050;TAG LATIN CAPITAL LETTER P;Cf;0;BN;;;;;N;;;;;
+E0051;TAG LATIN CAPITAL LETTER Q;Cf;0;BN;;;;;N;;;;;
+E0052;TAG LATIN CAPITAL LETTER R;Cf;0;BN;;;;;N;;;;;
+E0053;TAG LATIN CAPITAL LETTER S;Cf;0;BN;;;;;N;;;;;
+E0054;TAG LATIN CAPITAL LETTER T;Cf;0;BN;;;;;N;;;;;
+E0055;TAG LATIN CAPITAL LETTER U;Cf;0;BN;;;;;N;;;;;
+E0056;TAG LATIN CAPITAL LETTER V;Cf;0;BN;;;;;N;;;;;
+E0057;TAG LATIN CAPITAL LETTER W;Cf;0;BN;;;;;N;;;;;
+E0058;TAG LATIN CAPITAL LETTER X;Cf;0;BN;;;;;N;;;;;
+E0059;TAG LATIN CAPITAL LETTER Y;Cf;0;BN;;;;;N;;;;;
+E005A;TAG LATIN CAPITAL LETTER Z;Cf;0;BN;;;;;N;;;;;
+E005B;TAG LEFT SQUARE BRACKET;Cf;0;BN;;;;;N;;;;;
+E005C;TAG REVERSE SOLIDUS;Cf;0;BN;;;;;N;;;;;
+E005D;TAG RIGHT SQUARE BRACKET;Cf;0;BN;;;;;N;;;;;
+E005E;TAG CIRCUMFLEX ACCENT;Cf;0;BN;;;;;N;;;;;
+E005F;TAG LOW LINE;Cf;0;BN;;;;;N;;;;;
+E0060;TAG GRAVE ACCENT;Cf;0;BN;;;;;N;;;;;
+E0061;TAG LATIN SMALL LETTER A;Cf;0;BN;;;;;N;;;;;
+E0062;TAG LATIN SMALL LETTER B;Cf;0;BN;;;;;N;;;;;
+E0063;TAG LATIN SMALL LETTER C;Cf;0;BN;;;;;N;;;;;
+E0064;TAG LATIN SMALL LETTER D;Cf;0;BN;;;;;N;;;;;
+E0065;TAG LATIN SMALL LETTER E;Cf;0;BN;;;;;N;;;;;
+E0066;TAG LATIN SMALL LETTER F;Cf;0;BN;;;;;N;;;;;
+E0067;TAG LATIN SMALL LETTER G;Cf;0;BN;;;;;N;;;;;
+E0068;TAG LATIN SMALL LETTER H;Cf;0;BN;;;;;N;;;;;
+E0069;TAG LATIN SMALL LETTER I;Cf;0;BN;;;;;N;;;;;
+E006A;TAG LATIN SMALL LETTER J;Cf;0;BN;;;;;N;;;;;
+E006B;TAG LATIN SMALL LETTER K;Cf;0;BN;;;;;N;;;;;
+E006C;TAG LATIN SMALL LETTER L;Cf;0;BN;;;;;N;;;;;
+E006D;TAG LATIN SMALL LETTER M;Cf;0;BN;;;;;N;;;;;
+E006E;TAG LATIN SMALL LETTER N;Cf;0;BN;;;;;N;;;;;
+E006F;TAG LATIN SMALL LETTER O;Cf;0;BN;;;;;N;;;;;
+E0070;TAG LATIN SMALL LETTER P;Cf;0;BN;;;;;N;;;;;
+E0071;TAG LATIN SMALL LETTER Q;Cf;0;BN;;;;;N;;;;;
+E0072;TAG LATIN SMALL LETTER R;Cf;0;BN;;;;;N;;;;;
+E0073;TAG LATIN SMALL LETTER S;Cf;0;BN;;;;;N;;;;;
+E0074;TAG LATIN SMALL LETTER T;Cf;0;BN;;;;;N;;;;;
+E0075;TAG LATIN SMALL LETTER U;Cf;0;BN;;;;;N;;;;;
+E0076;TAG LATIN SMALL LETTER V;Cf;0;BN;;;;;N;;;;;
+E0077;TAG LATIN SMALL LETTER W;Cf;0;BN;;;;;N;;;;;
+E0078;TAG LATIN SMALL LETTER X;Cf;0;BN;;;;;N;;;;;
+E0079;TAG LATIN SMALL LETTER Y;Cf;0;BN;;;;;N;;;;;
+E007A;TAG LATIN SMALL LETTER Z;Cf;0;BN;;;;;N;;;;;
+E007B;TAG LEFT CURLY BRACKET;Cf;0;BN;;;;;N;;;;;
+E007C;TAG VERTICAL LINE;Cf;0;BN;;;;;N;;;;;
+E007D;TAG RIGHT CURLY BRACKET;Cf;0;BN;;;;;N;;;;;
+E007E;TAG TILDE;Cf;0;BN;;;;;N;;;;;
+E007F;CANCEL TAG;Cf;0;BN;;;;;N;;;;;
+E0100;VARIATION SELECTOR-17;Mn;0;NSM;;;;;N;;;;;
+E0101;VARIATION SELECTOR-18;Mn;0;NSM;;;;;N;;;;;
+E0102;VARIATION SELECTOR-19;Mn;0;NSM;;;;;N;;;;;
+E0103;VARIATION SELECTOR-20;Mn;0;NSM;;;;;N;;;;;
+E0104;VARIATION SELECTOR-21;Mn;0;NSM;;;;;N;;;;;
+E0105;VARIATION SELECTOR-22;Mn;0;NSM;;;;;N;;;;;
+E0106;VARIATION SELECTOR-23;Mn;0;NSM;;;;;N;;;;;
+E0107;VARIATION SELECTOR-24;Mn;0;NSM;;;;;N;;;;;
+E0108;VARIATION SELECTOR-25;Mn;0;NSM;;;;;N;;;;;
+E0109;VARIATION SELECTOR-26;Mn;0;NSM;;;;;N;;;;;
+E010A;VARIATION SELECTOR-27;Mn;0;NSM;;;;;N;;;;;
+E010B;VARIATION SELECTOR-28;Mn;0;NSM;;;;;N;;;;;
+E010C;VARIATION SELECTOR-29;Mn;0;NSM;;;;;N;;;;;
+E010D;VARIATION SELECTOR-30;Mn;0;NSM;;;;;N;;;;;
+E010E;VARIATION SELECTOR-31;Mn;0;NSM;;;;;N;;;;;
+E010F;VARIATION SELECTOR-32;Mn;0;NSM;;;;;N;;;;;
+E0110;VARIATION SELECTOR-33;Mn;0;NSM;;;;;N;;;;;
+E0111;VARIATION SELECTOR-34;Mn;0;NSM;;;;;N;;;;;
+E0112;VARIATION SELECTOR-35;Mn;0;NSM;;;;;N;;;;;
+E0113;VARIATION SELECTOR-36;Mn;0;NSM;;;;;N;;;;;
+E0114;VARIATION SELECTOR-37;Mn;0;NSM;;;;;N;;;;;
+E0115;VARIATION SELECTOR-38;Mn;0;NSM;;;;;N;;;;;
+E0116;VARIATION SELECTOR-39;Mn;0;NSM;;;;;N;;;;;
+E0117;VARIATION SELECTOR-40;Mn;0;NSM;;;;;N;;;;;
+E0118;VARIATION SELECTOR-41;Mn;0;NSM;;;;;N;;;;;
+E0119;VARIATION SELECTOR-42;Mn;0;NSM;;;;;N;;;;;
+E011A;VARIATION SELECTOR-43;Mn;0;NSM;;;;;N;;;;;
+E011B;VARIATION SELECTOR-44;Mn;0;NSM;;;;;N;;;;;
+E011C;VARIATION SELECTOR-45;Mn;0;NSM;;;;;N;;;;;
+E011D;VARIATION SELECTOR-46;Mn;0;NSM;;;;;N;;;;;
+E011E;VARIATION SELECTOR-47;Mn;0;NSM;;;;;N;;;;;
+E011F;VARIATION SELECTOR-48;Mn;0;NSM;;;;;N;;;;;
+E0120;VARIATION SELECTOR-49;Mn;0;NSM;;;;;N;;;;;
+E0121;VARIATION SELECTOR-50;Mn;0;NSM;;;;;N;;;;;
+E0122;VARIATION SELECTOR-51;Mn;0;NSM;;;;;N;;;;;
+E0123;VARIATION SELECTOR-52;Mn;0;NSM;;;;;N;;;;;
+E0124;VARIATION SELECTOR-53;Mn;0;NSM;;;;;N;;;;;
+E0125;VARIATION SELECTOR-54;Mn;0;NSM;;;;;N;;;;;
+E0126;VARIATION SELECTOR-55;Mn;0;NSM;;;;;N;;;;;
+E0127;VARIATION SELECTOR-56;Mn;0;NSM;;;;;N;;;;;
+E0128;VARIATION SELECTOR-57;Mn;0;NSM;;;;;N;;;;;
+E0129;VARIATION SELECTOR-58;Mn;0;NSM;;;;;N;;;;;
+E012A;VARIATION SELECTOR-59;Mn;0;NSM;;;;;N;;;;;
+E012B;VARIATION SELECTOR-60;Mn;0;NSM;;;;;N;;;;;
+E012C;VARIATION SELECTOR-61;Mn;0;NSM;;;;;N;;;;;
+E012D;VARIATION SELECTOR-62;Mn;0;NSM;;;;;N;;;;;
+E012E;VARIATION SELECTOR-63;Mn;0;NSM;;;;;N;;;;;
+E012F;VARIATION SELECTOR-64;Mn;0;NSM;;;;;N;;;;;
+E0130;VARIATION SELECTOR-65;Mn;0;NSM;;;;;N;;;;;
+E0131;VARIATION SELECTOR-66;Mn;0;NSM;;;;;N;;;;;
+E0132;VARIATION SELECTOR-67;Mn;0;NSM;;;;;N;;;;;
+E0133;VARIATION SELECTOR-68;Mn;0;NSM;;;;;N;;;;;
+E0134;VARIATION SELECTOR-69;Mn;0;NSM;;;;;N;;;;;
+E0135;VARIATION SELECTOR-70;Mn;0;NSM;;;;;N;;;;;
+E0136;VARIATION SELECTOR-71;Mn;0;NSM;;;;;N;;;;;
+E0137;VARIATION SELECTOR-72;Mn;0;NSM;;;;;N;;;;;
+E0138;VARIATION SELECTOR-73;Mn;0;NSM;;;;;N;;;;;
+E0139;VARIATION SELECTOR-74;Mn;0;NSM;;;;;N;;;;;
+E013A;VARIATION SELECTOR-75;Mn;0;NSM;;;;;N;;;;;
+E013B;VARIATION SELECTOR-76;Mn;0;NSM;;;;;N;;;;;
+E013C;VARIATION SELECTOR-77;Mn;0;NSM;;;;;N;;;;;
+E013D;VARIATION SELECTOR-78;Mn;0;NSM;;;;;N;;;;;
+E013E;VARIATION SELECTOR-79;Mn;0;NSM;;;;;N;;;;;
+E013F;VARIATION SELECTOR-80;Mn;0;NSM;;;;;N;;;;;
+E0140;VARIATION SELECTOR-81;Mn;0;NSM;;;;;N;;;;;
+E0141;VARIATION SELECTOR-82;Mn;0;NSM;;;;;N;;;;;
+E0142;VARIATION SELECTOR-83;Mn;0;NSM;;;;;N;;;;;
+E0143;VARIATION SELECTOR-84;Mn;0;NSM;;;;;N;;;;;
+E0144;VARIATION SELECTOR-85;Mn;0;NSM;;;;;N;;;;;
+E0145;VARIATION SELECTOR-86;Mn;0;NSM;;;;;N;;;;;
+E0146;VARIATION SELECTOR-87;Mn;0;NSM;;;;;N;;;;;
+E0147;VARIATION SELECTOR-88;Mn;0;NSM;;;;;N;;;;;
+E0148;VARIATION SELECTOR-89;Mn;0;NSM;;;;;N;;;;;
+E0149;VARIATION SELECTOR-90;Mn;0;NSM;;;;;N;;;;;
+E014A;VARIATION SELECTOR-91;Mn;0;NSM;;;;;N;;;;;
+E014B;VARIATION SELECTOR-92;Mn;0;NSM;;;;;N;;;;;
+E014C;VARIATION SELECTOR-93;Mn;0;NSM;;;;;N;;;;;
+E014D;VARIATION SELECTOR-94;Mn;0;NSM;;;;;N;;;;;
+E014E;VARIATION SELECTOR-95;Mn;0;NSM;;;;;N;;;;;
+E014F;VARIATION SELECTOR-96;Mn;0;NSM;;;;;N;;;;;
+E0150;VARIATION SELECTOR-97;Mn;0;NSM;;;;;N;;;;;
+E0151;VARIATION SELECTOR-98;Mn;0;NSM;;;;;N;;;;;
+E0152;VARIATION SELECTOR-99;Mn;0;NSM;;;;;N;;;;;
+E0153;VARIATION SELECTOR-100;Mn;0;NSM;;;;;N;;;;;
+E0154;VARIATION SELECTOR-101;Mn;0;NSM;;;;;N;;;;;
+E0155;VARIATION SELECTOR-102;Mn;0;NSM;;;;;N;;;;;
+E0156;VARIATION SELECTOR-103;Mn;0;NSM;;;;;N;;;;;
+E0157;VARIATION SELECTOR-104;Mn;0;NSM;;;;;N;;;;;
+E0158;VARIATION SELECTOR-105;Mn;0;NSM;;;;;N;;;;;
+E0159;VARIATION SELECTOR-106;Mn;0;NSM;;;;;N;;;;;
+E015A;VARIATION SELECTOR-107;Mn;0;NSM;;;;;N;;;;;
+E015B;VARIATION SELECTOR-108;Mn;0;NSM;;;;;N;;;;;
+E015C;VARIATION SELECTOR-109;Mn;0;NSM;;;;;N;;;;;
+E015D;VARIATION SELECTOR-110;Mn;0;NSM;;;;;N;;;;;
+E015E;VARIATION SELECTOR-111;Mn;0;NSM;;;;;N;;;;;
+E015F;VARIATION SELECTOR-112;Mn;0;NSM;;;;;N;;;;;
+E0160;VARIATION SELECTOR-113;Mn;0;NSM;;;;;N;;;;;
+E0161;VARIATION SELECTOR-114;Mn;0;NSM;;;;;N;;;;;
+E0162;VARIATION SELECTOR-115;Mn;0;NSM;;;;;N;;;;;
+E0163;VARIATION SELECTOR-116;Mn;0;NSM;;;;;N;;;;;
+E0164;VARIATION SELECTOR-117;Mn;0;NSM;;;;;N;;;;;
+E0165;VARIATION SELECTOR-118;Mn;0;NSM;;;;;N;;;;;
+E0166;VARIATION SELECTOR-119;Mn;0;NSM;;;;;N;;;;;
+E0167;VARIATION SELECTOR-120;Mn;0;NSM;;;;;N;;;;;
+E0168;VARIATION SELECTOR-121;Mn;0;NSM;;;;;N;;;;;
+E0169;VARIATION SELECTOR-122;Mn;0;NSM;;;;;N;;;;;
+E016A;VARIATION SELECTOR-123;Mn;0;NSM;;;;;N;;;;;
+E016B;VARIATION SELECTOR-124;Mn;0;NSM;;;;;N;;;;;
+E016C;VARIATION SELECTOR-125;Mn;0;NSM;;;;;N;;;;;
+E016D;VARIATION SELECTOR-126;Mn;0;NSM;;;;;N;;;;;
+E016E;VARIATION SELECTOR-127;Mn;0;NSM;;;;;N;;;;;
+E016F;VARIATION SELECTOR-128;Mn;0;NSM;;;;;N;;;;;
+E0170;VARIATION SELECTOR-129;Mn;0;NSM;;;;;N;;;;;
+E0171;VARIATION SELECTOR-130;Mn;0;NSM;;;;;N;;;;;
+E0172;VARIATION SELECTOR-131;Mn;0;NSM;;;;;N;;;;;
+E0173;VARIATION SELECTOR-132;Mn;0;NSM;;;;;N;;;;;
+E0174;VARIATION SELECTOR-133;Mn;0;NSM;;;;;N;;;;;
+E0175;VARIATION SELECTOR-134;Mn;0;NSM;;;;;N;;;;;
+E0176;VARIATION SELECTOR-135;Mn;0;NSM;;;;;N;;;;;
+E0177;VARIATION SELECTOR-136;Mn;0;NSM;;;;;N;;;;;
+E0178;VARIATION SELECTOR-137;Mn;0;NSM;;;;;N;;;;;
+E0179;VARIATION SELECTOR-138;Mn;0;NSM;;;;;N;;;;;
+E017A;VARIATION SELECTOR-139;Mn;0;NSM;;;;;N;;;;;
+E017B;VARIATION SELECTOR-140;Mn;0;NSM;;;;;N;;;;;
+E017C;VARIATION SELECTOR-141;Mn;0;NSM;;;;;N;;;;;
+E017D;VARIATION SELECTOR-142;Mn;0;NSM;;;;;N;;;;;
+E017E;VARIATION SELECTOR-143;Mn;0;NSM;;;;;N;;;;;
+E017F;VARIATION SELECTOR-144;Mn;0;NSM;;;;;N;;;;;
+E0180;VARIATION SELECTOR-145;Mn;0;NSM;;;;;N;;;;;
+E0181;VARIATION SELECTOR-146;Mn;0;NSM;;;;;N;;;;;
+E0182;VARIATION SELECTOR-147;Mn;0;NSM;;;;;N;;;;;
+E0183;VARIATION SELECTOR-148;Mn;0;NSM;;;;;N;;;;;
+E0184;VARIATION SELECTOR-149;Mn;0;NSM;;;;;N;;;;;
+E0185;VARIATION SELECTOR-150;Mn;0;NSM;;;;;N;;;;;
+E0186;VARIATION SELECTOR-151;Mn;0;NSM;;;;;N;;;;;
+E0187;VARIATION SELECTOR-152;Mn;0;NSM;;;;;N;;;;;
+E0188;VARIATION SELECTOR-153;Mn;0;NSM;;;;;N;;;;;
+E0189;VARIATION SELECTOR-154;Mn;0;NSM;;;;;N;;;;;
+E018A;VARIATION SELECTOR-155;Mn;0;NSM;;;;;N;;;;;
+E018B;VARIATION SELECTOR-156;Mn;0;NSM;;;;;N;;;;;
+E018C;VARIATION SELECTOR-157;Mn;0;NSM;;;;;N;;;;;
+E018D;VARIATION SELECTOR-158;Mn;0;NSM;;;;;N;;;;;
+E018E;VARIATION SELECTOR-159;Mn;0;NSM;;;;;N;;;;;
+E018F;VARIATION SELECTOR-160;Mn;0;NSM;;;;;N;;;;;
+E0190;VARIATION SELECTOR-161;Mn;0;NSM;;;;;N;;;;;
+E0191;VARIATION SELECTOR-162;Mn;0;NSM;;;;;N;;;;;
+E0192;VARIATION SELECTOR-163;Mn;0;NSM;;;;;N;;;;;
+E0193;VARIATION SELECTOR-164;Mn;0;NSM;;;;;N;;;;;
+E0194;VARIATION SELECTOR-165;Mn;0;NSM;;;;;N;;;;;
+E0195;VARIATION SELECTOR-166;Mn;0;NSM;;;;;N;;;;;
+E0196;VARIATION SELECTOR-167;Mn;0;NSM;;;;;N;;;;;
+E0197;VARIATION SELECTOR-168;Mn;0;NSM;;;;;N;;;;;
+E0198;VARIATION SELECTOR-169;Mn;0;NSM;;;;;N;;;;;
+E0199;VARIATION SELECTOR-170;Mn;0;NSM;;;;;N;;;;;
+E019A;VARIATION SELECTOR-171;Mn;0;NSM;;;;;N;;;;;
+E019B;VARIATION SELECTOR-172;Mn;0;NSM;;;;;N;;;;;
+E019C;VARIATION SELECTOR-173;Mn;0;NSM;;;;;N;;;;;
+E019D;VARIATION SELECTOR-174;Mn;0;NSM;;;;;N;;;;;
+E019E;VARIATION SELECTOR-175;Mn;0;NSM;;;;;N;;;;;
+E019F;VARIATION SELECTOR-176;Mn;0;NSM;;;;;N;;;;;
+E01A0;VARIATION SELECTOR-177;Mn;0;NSM;;;;;N;;;;;
+E01A1;VARIATION SELECTOR-178;Mn;0;NSM;;;;;N;;;;;
+E01A2;VARIATION SELECTOR-179;Mn;0;NSM;;;;;N;;;;;
+E01A3;VARIATION SELECTOR-180;Mn;0;NSM;;;;;N;;;;;
+E01A4;VARIATION SELECTOR-181;Mn;0;NSM;;;;;N;;;;;
+E01A5;VARIATION SELECTOR-182;Mn;0;NSM;;;;;N;;;;;
+E01A6;VARIATION SELECTOR-183;Mn;0;NSM;;;;;N;;;;;
+E01A7;VARIATION SELECTOR-184;Mn;0;NSM;;;;;N;;;;;
+E01A8;VARIATION SELECTOR-185;Mn;0;NSM;;;;;N;;;;;
+E01A9;VARIATION SELECTOR-186;Mn;0;NSM;;;;;N;;;;;
+E01AA;VARIATION SELECTOR-187;Mn;0;NSM;;;;;N;;;;;
+E01AB;VARIATION SELECTOR-188;Mn;0;NSM;;;;;N;;;;;
+E01AC;VARIATION SELECTOR-189;Mn;0;NSM;;;;;N;;;;;
+E01AD;VARIATION SELECTOR-190;Mn;0;NSM;;;;;N;;;;;
+E01AE;VARIATION SELECTOR-191;Mn;0;NSM;;;;;N;;;;;
+E01AF;VARIATION SELECTOR-192;Mn;0;NSM;;;;;N;;;;;
+E01B0;VARIATION SELECTOR-193;Mn;0;NSM;;;;;N;;;;;
+E01B1;VARIATION SELECTOR-194;Mn;0;NSM;;;;;N;;;;;
+E01B2;VARIATION SELECTOR-195;Mn;0;NSM;;;;;N;;;;;
+E01B3;VARIATION SELECTOR-196;Mn;0;NSM;;;;;N;;;;;
+E01B4;VARIATION SELECTOR-197;Mn;0;NSM;;;;;N;;;;;
+E01B5;VARIATION SELECTOR-198;Mn;0;NSM;;;;;N;;;;;
+E01B6;VARIATION SELECTOR-199;Mn;0;NSM;;;;;N;;;;;
+E01B7;VARIATION SELECTOR-200;Mn;0;NSM;;;;;N;;;;;
+E01B8;VARIATION SELECTOR-201;Mn;0;NSM;;;;;N;;;;;
+E01B9;VARIATION SELECTOR-202;Mn;0;NSM;;;;;N;;;;;
+E01BA;VARIATION SELECTOR-203;Mn;0;NSM;;;;;N;;;;;
+E01BB;VARIATION SELECTOR-204;Mn;0;NSM;;;;;N;;;;;
+E01BC;VARIATION SELECTOR-205;Mn;0;NSM;;;;;N;;;;;
+E01BD;VARIATION SELECTOR-206;Mn;0;NSM;;;;;N;;;;;
+E01BE;VARIATION SELECTOR-207;Mn;0;NSM;;;;;N;;;;;
+E01BF;VARIATION SELECTOR-208;Mn;0;NSM;;;;;N;;;;;
+E01C0;VARIATION SELECTOR-209;Mn;0;NSM;;;;;N;;;;;
+E01C1;VARIATION SELECTOR-210;Mn;0;NSM;;;;;N;;;;;
+E01C2;VARIATION SELECTOR-211;Mn;0;NSM;;;;;N;;;;;
+E01C3;VARIATION SELECTOR-212;Mn;0;NSM;;;;;N;;;;;
+E01C4;VARIATION SELECTOR-213;Mn;0;NSM;;;;;N;;;;;
+E01C5;VARIATION SELECTOR-214;Mn;0;NSM;;;;;N;;;;;
+E01C6;VARIATION SELECTOR-215;Mn;0;NSM;;;;;N;;;;;
+E01C7;VARIATION SELECTOR-216;Mn;0;NSM;;;;;N;;;;;
+E01C8;VARIATION SELECTOR-217;Mn;0;NSM;;;;;N;;;;;
+E01C9;VARIATION SELECTOR-218;Mn;0;NSM;;;;;N;;;;;
+E01CA;VARIATION SELECTOR-219;Mn;0;NSM;;;;;N;;;;;
+E01CB;VARIATION SELECTOR-220;Mn;0;NSM;;;;;N;;;;;
+E01CC;VARIATION SELECTOR-221;Mn;0;NSM;;;;;N;;;;;
+E01CD;VARIATION SELECTOR-222;Mn;0;NSM;;;;;N;;;;;
+E01CE;VARIATION SELECTOR-223;Mn;0;NSM;;;;;N;;;;;
+E01CF;VARIATION SELECTOR-224;Mn;0;NSM;;;;;N;;;;;
+E01D0;VARIATION SELECTOR-225;Mn;0;NSM;;;;;N;;;;;
+E01D1;VARIATION SELECTOR-226;Mn;0;NSM;;;;;N;;;;;
+E01D2;VARIATION SELECTOR-227;Mn;0;NSM;;;;;N;;;;;
+E01D3;VARIATION SELECTOR-228;Mn;0;NSM;;;;;N;;;;;
+E01D4;VARIATION SELECTOR-229;Mn;0;NSM;;;;;N;;;;;
+E01D5;VARIATION SELECTOR-230;Mn;0;NSM;;;;;N;;;;;
+E01D6;VARIATION SELECTOR-231;Mn;0;NSM;;;;;N;;;;;
+E01D7;VARIATION SELECTOR-232;Mn;0;NSM;;;;;N;;;;;
+E01D8;VARIATION SELECTOR-233;Mn;0;NSM;;;;;N;;;;;
+E01D9;VARIATION SELECTOR-234;Mn;0;NSM;;;;;N;;;;;
+E01DA;VARIATION SELECTOR-235;Mn;0;NSM;;;;;N;;;;;
+E01DB;VARIATION SELECTOR-236;Mn;0;NSM;;;;;N;;;;;
+E01DC;VARIATION SELECTOR-237;Mn;0;NSM;;;;;N;;;;;
+E01DD;VARIATION SELECTOR-238;Mn;0;NSM;;;;;N;;;;;
+E01DE;VARIATION SELECTOR-239;Mn;0;NSM;;;;;N;;;;;
+E01DF;VARIATION SELECTOR-240;Mn;0;NSM;;;;;N;;;;;
+E01E0;VARIATION SELECTOR-241;Mn;0;NSM;;;;;N;;;;;
+E01E1;VARIATION SELECTOR-242;Mn;0;NSM;;;;;N;;;;;
+E01E2;VARIATION SELECTOR-243;Mn;0;NSM;;;;;N;;;;;
+E01E3;VARIATION SELECTOR-244;Mn;0;NSM;;;;;N;;;;;
+E01E4;VARIATION SELECTOR-245;Mn;0;NSM;;;;;N;;;;;
+E01E5;VARIATION SELECTOR-246;Mn;0;NSM;;;;;N;;;;;
+E01E6;VARIATION SELECTOR-247;Mn;0;NSM;;;;;N;;;;;
+E01E7;VARIATION SELECTOR-248;Mn;0;NSM;;;;;N;;;;;
+E01E8;VARIATION SELECTOR-249;Mn;0;NSM;;;;;N;;;;;
+E01E9;VARIATION SELECTOR-250;Mn;0;NSM;;;;;N;;;;;
+E01EA;VARIATION SELECTOR-251;Mn;0;NSM;;;;;N;;;;;
+E01EB;VARIATION SELECTOR-252;Mn;0;NSM;;;;;N;;;;;
+E01EC;VARIATION SELECTOR-253;Mn;0;NSM;;;;;N;;;;;
+E01ED;VARIATION SELECTOR-254;Mn;0;NSM;;;;;N;;;;;
+E01EE;VARIATION SELECTOR-255;Mn;0;NSM;;;;;N;;;;;
+E01EF;VARIATION SELECTOR-256;Mn;0;NSM;;;;;N;;;;;
+F0000;<Plane 15 Private Use, First>;Co;0;L;;;;;N;;;;;
+FFFFD;<Plane 15 Private Use, Last>;Co;0;L;;;;;N;;;;;
+100000;<Plane 16 Private Use, First>;Co;0;L;;;;;N;;;;;
+10FFFD;<Plane 16 Private Use, Last>;Co;0;L;;;;;N;;;;;
diff --git a/extra/unicode/authors.txt b/extra/unicode/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/unicode/breaks/breaks-tests.factor b/extra/unicode/breaks/breaks-tests.factor
new file mode 100644 (file)
index 0000000..c183c3a
--- /dev/null
@@ -0,0 +1,7 @@
+USING: tools.test unicode.breaks sequences math kernel ;
+
+[ "\u1112\u1161\u11abA\u0300a\r\r\n" ]
+[ "\r\n\raA\u0300\u1112\u1161\u11ab" string-reverse ] unit-test
+[ "dcba" ] [ "abcd" string-reverse ] unit-test
+[ 3 ] [ "\u1112\u1161\u11abA\u0300a" [ length 1- ] keep
+        [ prev-grapheme ] keep prev-grapheme ] unit-test
diff --git a/extra/unicode/breaks/breaks.factor b/extra/unicode/breaks/breaks.factor
new file mode 100644 (file)
index 0000000..5e0a1fe
--- /dev/null
@@ -0,0 +1,129 @@
+USING: unicode kernel math const combinators splitting
+sequences math.parser io.files io assocs arrays namespaces
+;
+IN: unicode.breaks
+
+ENUM: Any L V T Extend Control CR LF graphemes ;
+
+: jamo-class ( ch -- class )
+    dup initial? [ drop L ]
+    [ dup medial? [ drop V ] [ final? T Any ? ] if ] if ;
+
+CATEGORY: grapheme-control Zl Zp Cc Cf ;
+: control-class ( ch -- class )
+    {
+        { CHAR: \r [ CR ] }
+        { CHAR: \n [ LF ] }
+        { HEX: 200C [ Extend ] }
+        { HEX: 200D [ Extend ] }
+        [ drop Control ]
+    } case ;
+
+: trim-blank ( str -- newstr )
+    dup [ blank? not ] find-last 1+* head ;
+
+: process-other-extend ( lines -- set )
+    [ "#" split1 drop ";" split1 drop trim-blank ] map
+    [ empty? not ] subset
+    [ ".." split1 [ dup ] unless* [ hex> ] 2apply range ] map
+    concat >set ;
+
+: other-extend-lines ( -- lines )
+    "extra/unicode/PropList.txt" resource-path <file-reader> lines ;
+
+DEFER: other-extend
+: load-other-extend 
+    other-extend-lines process-other-extend
+    \ other-extend define-value ; parsing
+load-other-extend
+
+CATEGORY: (extend) Me Mn ;
+: extend? ( ch -- ? )
+    [ (extend)? ] [ other-extend key? ] either ;
+
+: grapheme-class ( ch -- class )
+    {
+        { [ dup jamo? ] [ jamo-class ] }
+        { [ dup grapheme-control? ] [ control-class ] }
+        { [ extend? ] [ Extend ] }
+        { [ t ] [ Any ] }
+    } cond ;
+
+: init-grapheme-table ( -- table )
+    graphemes [ drop graphemes f <array> ] map ;
+
+SYMBOL: table
+
+: finish-table ( -- table )
+    table get [ [ 1 = ] map ] map ;
+
+: set-table ( class1 class2 val -- )
+    -rot table get nth [ swap or ] change-nth ;
+
+: connect ( class1 class2 -- ) 1 set-table ;
+: disconnect ( class1 class2 -- ) 0 set-table ;
+
+: connect-before ( class classes -- )
+    [ connect ] curry* each ;
+
+: connect-after ( classes class -- )
+    [ connect ] curry each ;
+
+: break-around ( classes1 classes2 -- )
+    [ [ 2dup disconnect swap disconnect ] curry* each ] curry each ;
+
+: make-grapheme-table ( -- )
+    CR LF connect
+    { Control CR LF } graphemes break-around
+    L { L V } connect-before
+    V { V T } connect-before
+    T T connect
+    graphemes Extend connect-after ;
+
+DEFER: grapheme-table
+: load-grapheme-table
+    init-grapheme-table table
+    [ make-grapheme-table finish-table ] with-variable
+    \ grapheme-table define-value ; parsing
+load-grapheme-table
+
+: grapheme-break? ( class1 class2 -- ? )
+    grapheme-table nth nth not ;
+
+: chars ( i str n -- str[i] str[i+n] )
+    swap >r dupd + r> [ ?nth ] curry 2apply ;
+
+: next-grapheme-step ( i str -- i+1 str prev-class )
+    2dup nth grapheme-class >r >r 1+ r> r> ;
+
+: (next-grapheme) ( i str prev-class -- next-i )
+    3dup drop bounds-check? [
+        >r next-grapheme-step r> over grapheme-break?
+        [ 2drop 1- ] [ (next-grapheme) ] if
+    ] [ 2drop ] if ;
+
+: next-grapheme ( i str -- next-i )
+    next-grapheme-step (next-grapheme) ;
+
+: (>graphemes) ( i str -- )
+    2dup bounds-check? [
+        dupd [ next-grapheme ] keep
+        [ subseq , ] 2keep (>graphemes)
+    ] [ 2drop ] if ;
+: >graphemes ( str -- graphemes )
+    [ 0 swap (>graphemes) ] { } make* ;
+
+: string-reverse ( str -- rts )
+    >graphemes reverse concat ;
+
+: prev-grapheme-step ( i str -- i-1 str prev-class )
+    2dup nth grapheme-class >r >r 1- r> r> ;
+
+: (prev-grapheme) ( i str next-class -- prev-i )
+    pick zero? [
+        >r prev-grapheme-step r> dupd grapheme-break?
+        [ 2drop 1- ] [ (prev-grapheme) ] if
+    ] [ 2drop ] if ;
+
+: prev-grapheme ( i str -- prev-i )
+    prev-grapheme-step (prev-grapheme) ;
diff --git a/extra/unicode/summary.txt b/extra/unicode/summary.txt
new file mode 100644 (file)
index 0000000..ece1e61
--- /dev/null
@@ -0,0 +1 @@
+Unicode 5.0 support
diff --git a/extra/unicode/unicode-tests.factor b/extra/unicode/unicode-tests.factor
new file mode 100644 (file)
index 0000000..aeb9cfb
--- /dev/null
@@ -0,0 +1,37 @@
+USING: unicode kernel tools.test words sequences namespaces ;
+
+[ "Hello How Are You? I'M Good" ] [ "hEllo how ARE yOU? I'm good" >title ] unit-test
+[ "FUSS" ] [ "Fu\u00DF" >upper ] unit-test
+[ "\u03C3\u03C2" ] [ "\u03A3\u03A3" >lower ] unit-test
+[ t ] [ "hello how are you?" lower? ] unit-test
+[
+    "tr" locale set
+    [ "i\u0131i \u0131jj" ] [ "i\u0131I\u0307 IJj" >lower ] unit-test
+!    [ "I\u307\u0131i Ijj" ] [ "i\u0131I\u0307 IJj" >title ] unit-test
+    [ "I\u0307II\u0307 IJJ" ] [ "i\u0131I\u0307 IJj" >upper ] unit-test
+    "lt" locale set
+    ! Lithuanian casing tests
+] with-scope
+
+[ { f f t t f t t f f t } ] [ CHAR: A { 
+    blank? letter? LETTER? Letter? digit? 
+    printable? alpha? control? uncased? character? 
+} [ execute ] curry* map ] unit-test
+[ "Nd" ] [ CHAR: 3 category ] unit-test
+[ CHAR: ! ] [ UNICHAR: exclamation-mark ] unit-test
+[ "ab\u0323\u0302cd" ] [ "ab\u0302" "\u0323cd" string-append ] unit-test
+
+[ "ab\u064b\u034d\u034e\u0347\u0346" ] [ "ab\u0346\u0347\u064b\u034e\u034d" dup reorder ] unit-test
+[ "hello" "hello" ] [ "hello" [ nfd ] keep nfkd ] unit-test
+[ "\uFB012\u2075\u017F\u0323\u0307" "fi25s\u0323\u0307" ]
+[ "\uFB012\u2075\u1E9B\u0323" [ nfd ] keep nfkd ] unit-test
+
+[ "\u1E69" "s\u0323\u0307" ] [ "\u1E69" [ nfc ] keep nfd ] unit-test
+[ "\u1E0D\u0307" ] [ "\u1E0B\u0323" nfc ] unit-test
+
+[ 54620 ] [ 4370 4449 4523 jamo>hangul ] unit-test
+[ 4370 4449 4523 ] [ 54620 hangul>jamo first3 ] unit-test
+[ t ] [ 54620 hangul? ] unit-test
+[ f ] [ 0 hangul? ] unit-test
+[ "\u1112\u1161\u11ab" ] [ "\ud55c" nfd ] unit-test
+[ "\ud55c" ] [ "\u1112\u1161\u11ab" nfc ] unit-test
diff --git a/extra/unicode/unicode.factor b/extra/unicode/unicode.factor
new file mode 100644 (file)
index 0000000..bac768b
--- /dev/null
@@ -0,0 +1,503 @@
+USING: kernel hashtables sequences io arrays math 
+    hash2 namespaces strings assocs words splitting sequences.next
+    byte-arrays quotations sequences.private io.files bit-arrays
+    combinators math.parser io.streams.lines parser classes
+    classes.predicate ;
+IN: unicode
+
+! Convenience functions
+: >set ( seq -- hash )
+    [ dup ] H{ } map>assoc ;
+
+: either ( object first second -- ? )
+    >r over slip swap [ r> drop ] [ r> call ] ?if ; inline
+
+: 1+* ( n/f _ -- n+1 )
+    drop [ 1+ ] [ 0 ] if* ;
+
+: define-value ( value word -- )
+    swap 1quotation define-compound ;
+
+: ?between? ( n/f from to -- ? )
+    pick [ between? ] [ 3drop f ] if ;
+
+: range ( from to -- seq )
+    1+ over - [ + ] curry* map ;
+
+! Loading data from UnicodeData.txt
+
+: data ( filename -- data )
+    <file-reader> lines [ ";" split ] map ;
+
+: load-data ( -- data )
+    "extra/unicode/UnicodeData.txt" resource-path data ;
+
+: (process-data) ( index data -- newdata )
+    [ [ nth ] keep first swap 2array ] curry* map
+    [ second empty? not ] subset
+    [ >r hex> r> ] assoc-map ;
+
+: process-data ( index data -- hash )
+    (process-data) [ hex> ] assoc-map >hashtable ;
+
+: (chain-decomposed) ( hash value -- newvalue )
+    [
+        2dup swap at
+        [ (chain-decomposed) ] [ 1array nip ] ?if
+    ] curry* map concat ;
+
+: chain-decomposed ( hash -- newhash )
+    dup [ swap (chain-decomposed) ] curry assoc-map ;
+
+: first* ( seq -- ? )
+    second [ empty? ] [ first ] either ;
+
+: (process-decomposed) ( data -- alist )
+    5 swap (process-data)
+    [ " " split [ hex> ] map ] assoc-map ;
+
+: process-canonical ( data -- hash2 hash )
+    (process-decomposed) [ first* ] subset
+    [
+        [ second length 2 = ] subset
+        ! using 1009 as the size, the maximum load is 4
+        [ first2 first2 rot 3array ] map 1009 alist>hash2
+    ] keep
+    >hashtable chain-decomposed ;
+
+: process-compat ( data -- hash )
+    (process-decomposed)
+    [ dup first* [ first2 1 tail 2array ] unless ] map
+    >hashtable chain-decomposed ;
+
+: process-combining ( data -- hash )
+    3 swap (process-data)
+    [ string>number ] assoc-map
+    [ nip 0 = not ] assoc-subset
+    >hashtable ;
+
+: categories ( -- names )
+    ! For non-existent characters, use Cn
+    { "Lu" "Ll" "Lt" "Lm" "Lo"
+      "Mn" "Mc" "Me"
+      "Nd" "Nl" "No"
+      "Pc" "Pd" "Ps" "Pe" "Pi" "Pf" "Po"
+      "Sm" "Sc" "Sk" "So"
+      "Zs" "Zl" "Zp"
+      "Cc" "Cf" "Cs" "Co" "Cn" } ;
+
+: unicode-chars HEX: 2FA1E ;
+! the maximum unicode char in the first 3 planes
+
+: process-category ( data -- category-listing )
+    2 swap (process-data)
+    unicode-chars <byte-array> swap dupd swap [
+        >r over unicode-chars >= [ r> 3drop ]
+        [ categories index swap r> set-nth ] if
+    ] curry assoc-each ;
+
+: ascii-lower ( string -- lower )
+    [ dup CHAR: A CHAR: Z between? [ HEX: 20 + ] when ] map ;
+
+: replace ( seq old new -- newseq )
+    swap rot [ 2dup = [ drop over ] when ] map 2nip ;
+
+: process-names ( data -- names-hash )
+    1 swap (process-data)
+    [ ascii-lower CHAR: \s CHAR: - replace swap ] assoc-map
+    >hashtable ;
+
+DEFER: simple-lower
+DEFER: simple-upper
+DEFER: simple-title
+DEFER: canonical-map
+DEFER: combine-map
+DEFER: class-map
+DEFER: compat-map
+DEFER: category-map
+DEFER: name-map
+
+: load-tables ( -- )
+    load-data
+    dup process-names \ name-map define-value
+    13 over process-data \ simple-lower define-value
+    12 over process-data tuck \ simple-upper define-value
+    14 over process-data swapd union \ simple-title define-value
+    dup process-combining \ class-map define-value
+    dup process-canonical \ canonical-map define-value
+    \ combine-map define-value
+    dup process-compat \ compat-map define-value
+    process-category \ category-map define-value ; parsing
+load-tables
+
+: canonical-entry ( char -- seq ) canonical-map at ;
+: combine-chars ( a b -- char/f ) combine-map hash2 ;
+: compat-entry ( char -- seq ) compat-map at  ;
+: combining-class ( char -- n ) class-map at ;
+: non-starter? ( char -- ? ) class-map key? ;
+: name>char ( string -- char ) name-map at ;
+
+: UNICHAR:
+    scan name>char [ parsed ] [ "Invalid character" throw ] if* ; parsing
+
+! Character classes (categories)
+
+: category# ( char -- category )
+    ! There are a few characters that should be Cn
+    ! that this gives Cf or Mn
+    ! Cf = 26; Mn = 5; Cn = 29
+    dup category-map ?nth [ ] [
+        dup HEX: E0001 HEX: E007F between?
+        [ drop 26 ] [
+            HEX: E0100 HEX: E01EF between?  5 29 ?
+        ] if
+    ] ?if ;
+
+: category ( char -- category )
+    category# categories nth ;
+
+: >category-array ( categories -- bitarray )
+    categories [ swap member? ] curry* map >bit-array ;
+
+: as-string ( strings -- bit-array )
+    concat "\"" tuck 3append parse first ;
+
+: [category] ( categories -- quot )
+    [
+        [ [ categories member? not ] subset as-string ] keep 
+        [ categories member? ] subset >category-array
+        [ dup category# ] % , [ nth-unsafe [ drop t ] ] %
+        \ member? 2array >quotation ,
+        \ if ,
+    ] [ ] make ;
+
+: define-category ( word categories -- )
+    [category] fixnum -rot define-predicate-class ;
+
+: CATEGORY:
+    CREATE ";" parse-tokens define-category ; parsing
+
+: seq-minus ( seq1 seq2 -- diff )
+    [ member? not ] curry subset ;
+
+: CATEGORY-NOT:
+    CREATE ";" parse-tokens
+    categories swap seq-minus define-category ; parsing
+
+CATEGORY: blank Zs Zl Zp ;
+CATEGORY: letter Ll ;
+CATEGORY: LETTER Lu ;
+CATEGORY: Letter Lu Ll Lt Lm Lo ;
+CATEGORY: digit Nd Nl No ;
+CATEGORY-NOT: printable Cc Cf Cs Co Cn ;
+CATEGORY: alpha Lu Ll Lt Lm Lo Nd Nl No ;
+CATEGORY: control Cc ;
+CATEGORY-NOT: uncased Lu Ll Lt Lm Mn Me ; 
+CATEGORY-NOT: character Cn ;
+
+! Utility word
+: make* ( seq quot exemplar -- newseq )
+    ! quot has access to original seq on stack
+    ! this just makes the new-resizable the same length as seq
+    [
+        [
+            pick length swap new-resizable
+            [ building set call ] keep
+        ] keep like
+    ] with-scope ; inline
+
+! Case mapping
+
+: hash-default ( key hash -- value/key )
+    dupd at [ nip ] when* ;
+
+: ch>lower ( ch -- lower ) simple-lower hash-default ;
+: ch>upper ( ch -- upper ) simple-upper hash-default ;
+: ch>title ( ch -- title ) simple-title hash-default ;
+
+: load-special-data ( -- data )
+    "extra/unicode/SpecialCasing.txt" resource-path data
+    [ length 5 = ] subset ;
+
+: multihex ( hexstring -- string )
+    " " split [ hex> ] map [ ] subset ;
+
+TUPLE: code-point lower title upper ;
+
+C: <code-point> code-point
+
+: set-code-point ( seq -- )
+    4 head [ multihex ] map first4
+    <code-point> swap first set ;
+
+DEFER: special-casing
+: load-special-casing
+    load-special-data [ [ set-code-point ] each ] H{ } make-assoc
+    \ special-casing define-value ; parsing
+load-special-casing
+
+SYMBOL: locale ! Just casing locale, or overall?
+
+: i-dot? ( -- ? )
+    locale get { "tr" "az" } member? ;
+
+: lithuanian? ( -- ? ) locale get "lt" = ;
+
+: dot-over ( -- ch ) CHAR: \u0307 ;
+
+: lithuanian-ch>upper ( ? next ch -- ? )
+    rot [ 2drop f ]
+    [ swap dot-over = over "ij" member? and swap , ] if ;
+
+: lithuanian>upper ( string -- lower )
+    [ f swap [ lithuanian-ch>upper ] each-next drop ] "" make* ;
+
+: mark-above? ( ch -- ? )
+    combining-class 230 = ;
+
+: lithuanian-ch>lower ( next ch -- )
+    ! This fails to add a dot above in certain edge cases
+    ! where there is a non-above combining mark before an above one
+    ! in Lithuanian
+    dup , "IJ" member? swap mark-above? and [ dot-over , ] when ;
+
+: lithuanian>lower ( string -- lower )
+    [ [ lithuanian-ch>lower ] each-next ] "" make* ;
+
+: turk-ch>upper ( ch -- )
+    dup CHAR: i = 
+    [ drop CHAR: I , dot-over , ] [ , ] if ;
+
+: turk>upper ( string -- upper-i )
+    [ [ turk-ch>upper ] each ] "" make* ;
+
+: turk-ch>lower ( ? next ch -- ? )
+    {
+        { [ rot ] [ 2drop f ] }
+        { [ dup CHAR: I = ] [
+            drop dot-over =
+            dup CHAR: i CHAR: \u0131 ? ,
+        ] }
+        { [ t ] [ , drop f ] }
+    } cond ;
+
+: turk>lower ( string -- lower-i )
+    [ f swap [ turk-ch>lower ] each-next drop ] "" make* ;
+
+: word-boundary ( prev char -- new ? )
+    dup non-starter? [ drop dup ] when
+    swap uncased? ;
+
+: sigma-map ( string -- string )
+    [
+        swap [ uncased? ] keep not or
+        [ drop HEX: 3C2 ] when
+    ] map-next ;
+
+: final-sigma ( string -- string )
+    HEX: 3A3 over member? [ sigma-map ] when ;
+
+: map-case ( string string-quot char-quot -- case )
+    [
+        rot [
+            -rot [
+                rot dup special-casing at
+                [ -rot drop call % ]
+                [ -rot nip call , ] ?if
+            ] 2keep
+        ] each 2drop
+    ] "" make* ; inline
+
+: >lower ( string -- lower )
+    i-dot? [ turk>lower ] when
+    final-sigma [ code-point-lower ] [ ch>lower ] map-case ;
+
+: >upper ( string -- upper )
+    i-dot? [ turk>upper ] when
+    [ code-point-upper ] [ ch>upper ] map-case ;
+
+: >title ( string -- title )
+    final-sigma
+    CHAR: \s swap
+    [ tuck word-boundary swapd
+        [ code-point-title ] [ code-point-lower ] if ]
+    [ tuck word-boundary swapd 
+        [ ch>title ] [ ch>lower ] if ]
+    map-case nip ;
+
+: >case-fold ( string -- fold )
+    >upper >lower ;
+
+: insensitive= ( str1 str2 -- ? )
+    [ >case-fold ] 2apply = ;
+
+: lower? ( string -- ? )
+    dup >lower = ;
+: upper? ( string -- ? )
+    dup >lower = ;
+: title? ( string -- ? )
+    dup >title = ;
+: case-fold? ( string -- ? )
+    dup >case-fold = ;
+
+! Conjoining Jamo behavior
+
+: hangul-base HEX: ac00 ; inline
+: hangul-end HEX: D7AF ; inline
+: initial-base HEX: 1100 ; inline
+: medial-base HEX: 1161 ; inline
+: final-base HEX: 11a7 ; inline
+
+: initial-count 19 ; inline
+: medial-count 21 ; inline
+: final-count 28 ; inline
+
+: hangul? ( ch -- ? ) hangul-base hangul-end ?between? ;
+: jamo? ( ch -- ? ) HEX: 1100 HEX: 11FF ?between? ;
+
+! These numbers come from UAX 29
+: initial? ( ch -- ? )
+    [ HEX: 1100 HEX: 1159 ?between? ] [ HEX: 115F = ] either ;
+: medial? ( ch -- ? ) HEX: 1160 HEX: 11A2 ?between? ;
+: final? ( ch -- ? ) HEX: 11A8 HEX: 11F9 ?between? ;
+
+: hangul>jamo ( hangul -- jamo-string )
+    hangul-base - final-count /mod final-base +
+    >r medial-count /mod medial-base +
+    >r initial-base + r> r>
+    dup zero? [ drop 2array ] [ 3array ] if ;
+
+: jamo>hangul ( initial medial final -- hangul )
+    >r >r initial-base - medial-count *
+    r> medial-base - + final-count *
+    r> final-base - + hangul-base + ;
+
+! Normalization -- Decomposition 
+
+: (insert) ( seq n quot -- )
+    over 0 = [ 3drop ] [
+        [ >r dup 1- rot [ nth ] curry 2apply r> 2apply > ] 3keep
+        roll [ 3drop ]
+        [ >r [ dup 1- rot exchange ] 2keep 1- r> (insert) ] if
+    ] if ; inline
+
+: insert ( seq quot elt n -- )
+    swap rot >r -rot [ swap set-nth ] 2keep r> (insert) ; inline
+
+: insertion-sort ( seq quot -- )
+    ! quot is a transformation on elements
+    over dup length
+    [ >r >r 2dup r> r> insert ] 2each 2drop ; inline
+
+: reorder-slice ( string start -- slice done? )
+    2dup swap [ non-starter? not ] find* drop
+    [ [ over length ] unless* rot <slice> ] keep not ;
+
+: reorder-next ( string i -- new-i done? )
+    over [ non-starter? ] find* drop [
+        reorder-slice
+        >r dup [ combining-class ] insertion-sort slice-to r>
+    ] [ length t ] if* ;
+
+: reorder-loop ( string start -- )
+    dupd reorder-next [ 2drop ] [ reorder-loop ] if ;
+
+: reorder ( string -- )
+    0 reorder-loop ;
+
+: reorder-back ( string i -- )
+    over [ non-starter? not ] find-last* 1+* reorder-next 2drop ;
+
+: decompose ( string quot -- decomposed )
+    ! When there are 8 and 32-bit strings, this'll be
+    ! equivalent to clone on 8 and the contents of the last
+    ! main quotation on 32.
+    over [ 127 < ] all? [ drop ] [
+        swap [ [
+            dup hangul? [ hangul>jamo % drop ]
+            [ dup rot call [ % ] [ , ] ?if ] if
+        ] curry* each ] "" make*
+        dup reorder
+    ] if ; inline
+
+: nfd ( string -- string )
+    [ canonical-entry ] decompose ;
+
+: nfkd ( string -- string )
+    [ compat-entry ] decompose ;
+
+: string-append ( s1 s2 -- string )
+    ! This could be more optimized,
+    ! but in practice, it'll almost always just be append
+    [ append ] keep
+    0 over ?nth non-starter?
+    [ length dupd reorder-back ] [ drop ] if ;
+
+! Normalization -- Composition
+SYMBOL: main-str
+SYMBOL: ind
+SYMBOL: after
+SYMBOL: char
+
+: get-str ( i -- ch ) ind get + main-str get ?nth ;
+: current ( -- ch ) 0 get-str ;
+: to ( -- ) ind inc ;
+
+: initial-medial? ( -- ? )
+    current initial? [ 1 get-str medial? ] [ f ] if ;
+
+: --final? ( -- ? )
+    2 get-str final? ;
+
+: imf, ( -- )
+    current to current to current jamo>hangul , ;
+
+: im, ( -- )
+    current to current 0 jamo>hangul , ;
+
+: compose-jamo ( -- )
+    initial-medial? [
+        --final? [ imf, ] [ im, ] if
+    ] when to current jamo? [ compose-jamo ] when ;
+
+: pass-combining ( -- )
+    current non-starter? [ current , to pass-combining ] when ;
+
+: try-compose ( last-class char current-class -- )
+    swapd = [ after get push ] [
+        char get over combine-chars
+        [ nip char set ] [ after get push ] if*
+    ] if ;
+
+: compose-iter ( n -- )
+    current [
+        dup combining-class dup
+        [ [ try-compose ] keep to compose-iter ] [ 3drop ] if
+    ] [ drop ] if* ;
+
+: ?new-after ( -- )
+    after [ dup empty? [ drop SBUF" " clone ] unless ] change ;
+
+: (compose) ( -- )
+    current [
+        dup jamo? [ drop compose-jamo ] [
+            char set to ?new-after
+            0 compose-iter
+            char get , after get %
+            to
+        ] if (compose)
+    ] when* ;
+
+: compose ( str -- comp )
+    [
+        main-str set
+        0 ind set
+        SBUF" " clone after set
+        pass-combining (compose)
+    ] "" make* ;
+
+: nfc ( string -- nfc )
+    nfd compose ;
+
+: nfkc ( string -- nfkc )
+    nfkc compose ;
diff --git a/extra/units/constants/constants.factor b/extra/units/constants/constants.factor
new file mode 100644 (file)
index 0000000..7350cbf
--- /dev/null
@@ -0,0 +1,15 @@
+! USING: kernel math si-units ;
+IN: units.constants
+
+! From: http://physics.nist.gov/constants
+
+! speed of light in vacuum
+! : c 299792458 m/s ;
+! : c0 299792458 m/s ; ! same as c
+! : c-vacuum 299792458 m/s ; ! same as c
+! 
+! ! more to come
+! 
+! : avogadro
+!     6.02214179e23 { } { mol } <dimensioned> ;
+
diff --git a/extra/units/constants/constants.txt b/extra/units/constants/constants.txt
new file mode 100644 (file)
index 0000000..8adc403
--- /dev/null
@@ -0,0 +1,336 @@
+
+             Fundamental Physical Constants --- Complete Listing
+
+
+  From:  http://physics.nist.gov/constants
+
+
+
+  Quantity                                               Value                 Uncertainty          Unit
+------------------------------------------------------------------------------------------------------------------------
+{220} lattice spacing of silicon                       192.015 5762 e-12     0.000 0050 e-12       m
+alpha particle-electron mass ratio                     7294.299 5365         0.000 0031            
+alpha particle mass                                    6.644 656 20 e-27     0.000 000 33 e-27     kg
+alpha particle mass energy equivalent                  5.971 919 17 e-10     0.000 000 30 e-10     J
+alpha particle mass energy equivalent in MeV           3727.379 109          0.000 093             MeV
+alpha particle mass in u                               4.001 506 179 127     0.000 000 000 062     u
+alpha particle molar mass                              4.001 506 179 127 e-3 0.000 000 000 062 e-3 kg mol^-1
+alpha particle-proton mass ratio                       3.972 599 689 51      0.000 000 000 41      
+Angstrom star                                          1.000 014 98 e-10     0.000 000 90 e-10     m
+atomic mass constant                                   1.660 538 782 e-27    0.000 000 083 e-27    kg
+atomic mass constant energy equivalent                 1.492 417 830 e-10    0.000 000 074 e-10    J
+atomic mass constant energy equivalent in MeV          931.494 028           0.000 023             MeV
+atomic mass unit-electron volt relationship            931.494 028 e6        0.000 023 e6          eV
+atomic mass unit-hartree relationship                  3.423 177 7149 e7     0.000 000 0049 e7     E_h
+atomic mass unit-hertz relationship                    2.252 342 7369 e23    0.000 000 0032 e23    Hz
+atomic mass unit-inverse meter relationship            7.513 006 671 e14     0.000 000 011 e14     m^-1
+atomic mass unit-joule relationship                    1.492 417 830 e-10    0.000 000 074 e-10    J
+atomic mass unit-kelvin relationship                   1.080 9527 e13        0.000 0019 e13        K
+atomic mass unit-kilogram relationship                 1.660 538 782 e-27    0.000 000 083 e-27    kg
+atomic unit of 1st hyperpolarizablity                  3.206 361 533 e-53    0.000 000 081 e-53    C^3 m^3 J^-2
+atomic unit of 2nd hyperpolarizablity                  6.235 380 95 e-65     0.000 000 31 e-65     C^4 m^4 J^-3
+atomic unit of action                                  1.054 571 628 e-34    0.000 000 053 e-34    J s
+atomic unit of charge                                  1.602 176 487 e-19    0.000 000 040 e-19    C
+atomic unit of charge density                          1.081 202 300 e12     0.000 000 027 e12     C m^-3
+atomic unit of current                                 6.623 617 63 e-3      0.000 000 17 e-3      A
+atomic unit of electric dipole mom.                    8.478 352 81 e-30     0.000 000 21 e-30     C m
+atomic unit of electric field                          5.142 206 32 e11      0.000 000 13 e11      V m^-1
+atomic unit of electric field gradient                 9.717 361 66 e21      0.000 000 24 e21      V m^-2
+atomic unit of electric polarizablity                  1.648 777 2536 e-41   0.000 000 0034 e-41   C^2 m^2 J^-1
+atomic unit of electric potential                      27.211 383 86         0.000 000 68          V
+atomic unit of electric quadrupole mom.                4.486 551 07 e-40     0.000 000 11 e-40     C m^2
+atomic unit of energy                                  4.359 743 94 e-18     0.000 000 22 e-18     J
+atomic unit of force                                   8.238 722 06 e-8      0.000 000 41 e-8      N
+atomic unit of length                                  0.529 177 208 59 e-10 0.000 000 000 36 e-10 m
+atomic unit of mag. dipole mom.                        1.854 801 830 e-23    0.000 000 046 e-23    J T^-1
+atomic unit of mag. flux density                       2.350 517 382 e5      0.000 000 059 e5      T
+atomic unit of magnetizability                         7.891 036 433 e-29    0.000 000 027 e-29    J T^-2
+atomic unit of mass                                    9.109 382 15 e-31     0.000 000 45 e-31     kg
+atomic unit of momentum                                1.992 851 565 e-24    0.000 000 099 e-24    kg m s^-1
+atomic unit of permittivity                            1.112 650 056... e-10 (exact)               F m^-1
+atomic unit of time                                    2.418 884 326 505 e-17 0.000 000 000 016 e-17 s
+atomic unit of velocity                                2.187 691 2541 e6     0.000 000 0015 e6     m s^-1
+Avogadro constant                                      6.022 141 79 e23      0.000 000 30 e23      mol^-1
+Bohr magneton                                          927.400 915 e-26      0.000 023 e-26        J T^-1
+Bohr magneton in eV/T                                  5.788 381 7555 e-5    0.000 000 0079 e-5    eV T^-1
+Bohr magneton in Hz/T                                  13.996 246 04 e9      0.000 000 35 e9       Hz T^-1
+Bohr magneton in inverse meters per tesla              46.686 4515           0.000 0012            m^-1 T^-1
+Bohr magneton in K/T                                   0.671 7131            0.000 0012            K T^-1
+Bohr radius                                            0.529 177 208 59 e-10 0.000 000 000 36 e-10 m
+Boltzmann constant                                     1.380 6504 e-23       0.000 0024 e-23       J K^-1
+Boltzmann constant in eV/K                             8.617 343 e-5         0.000 015 e-5         eV K^-1
+Boltzmann constant in Hz/K                             2.083 6644 e10        0.000 0036 e10        Hz K^-1
+Boltzmann constant in inverse meters per kelvin        69.503 56             0.000 12              m^-1 K^-1
+characteristic impedance of vacuum                     376.730 313 461...    (exact)               ohm
+classical electron radius                              2.817 940 2894 e-15   0.000 000 0058 e-15   m
+Compton wavelength                                     2.426 310 2175 e-12   0.000 000 0033 e-12   m
+Compton wavelength over 2 pi                           386.159 264 59 e-15   0.000 000 53 e-15     m
+conductance quantum                                    7.748 091 7004 e-5    0.000 000 0053 e-5    S
+conventional value of Josephson constant               483 597.9 e9          (exact)               Hz V^-1
+conventional value of von Klitzing constant            25 812.807            (exact)               ohm
+Cu x unit                                              1.002 076 99 e-13     0.000 000 28 e-13     m
+deuteron-electron mag. mom. ratio                      -4.664 345 537 e-4    0.000 000 039 e-4     
+deuteron-electron mass ratio                           3670.482 9654         0.000 0016            
+deuteron g factor                                      0.857 438 2308        0.000 000 0072        
+deuteron mag. mom.                                     0.433 073 465 e-26    0.000 000 011 e-26    J T^-1
+deuteron mag. mom. to Bohr magneton ratio              0.466 975 4556 e-3    0.000 000 0039 e-3    
+deuteron mag. mom. to nuclear magneton ratio           0.857 438 2308        0.000 000 0072        
+deuteron mass                                          3.343 583 20 e-27     0.000 000 17 e-27     kg
+deuteron mass energy equivalent                        3.005 062 72 e-10     0.000 000 15 e-10     J
+deuteron mass energy equivalent in MeV                 1875.612 793          0.000 047             MeV
+deuteron mass in u                                     2.013 553 212 724     0.000 000 000 078     u
+deuteron molar mass                                    2.013 553 212 724 e-3 0.000 000 000 078 e-3 kg mol^-1
+deuteron-neutron mag. mom. ratio                       -0.448 206 52         0.000 000 11          
+deuteron-proton mag. mom. ratio                        0.307 012 2070        0.000 000 0024        
+deuteron-proton mass ratio                             1.999 007 501 08      0.000 000 000 22      
+deuteron rms charge radius                             2.1402 e-15           0.0028 e-15           m
+electric constant                                      8.854 187 817... e-12 (exact)               F m^-1
+electron charge to mass quotient                       -1.758 820 150 e11    0.000 000 044 e11     C kg^-1
+electron-deuteron mag. mom. ratio                      -2143.923 498         0.000 018             
+electron-deuteron mass ratio                           2.724 437 1093 e-4    0.000 000 0012 e-4    
+electron g factor                                      -2.002 319 304 3622   0.000 000 000 0015    
+electron gyromag. ratio                                1.760 859 770 e11     0.000 000 044 e11     s^-1 T^-1
+electron gyromag. ratio over 2 pi                      28 024.953 64         0.000 70              MHz T^-1
+electron mag. mom.                                     -928.476 377 e-26     0.000 023 e-26        J T^-1
+electron mag. mom. anomaly                             1.159 652 181 11 e-3  0.000 000 000 74 e-3  
+electron mag. mom. to Bohr magneton ratio              -1.001 159 652 181 11 0.000 000 000 000 74  
+electron mag. mom. to nuclear magneton ratio           -1838.281 970 92      0.000 000 80          
+electron mass                                          9.109 382 15 e-31     0.000 000 45 e-31     kg
+electron mass energy equivalent                        8.187 104 38 e-14     0.000 000 41 e-14     J
+electron mass energy equivalent in MeV                 0.510 998 910         0.000 000 013         MeV
+electron mass in u                                     5.485 799 0943 e-4    0.000 000 0023 e-4    u
+electron molar mass                                    5.485 799 0943 e-7    0.000 000 0023 e-7    kg mol^-1
+electron-muon mag. mom. ratio                          206.766 9877          0.000 0052            
+electron-muon mass ratio                               4.836 331 71 e-3      0.000 000 12 e-3      
+electron-neutron mag. mom. ratio                       960.920 50            0.000 23              
+electron-neutron mass ratio                            5.438 673 4459 e-4    0.000 000 0033 e-4    
+electron-proton mag. mom. ratio                        -658.210 6848         0.000 0054            
+electron-proton mass ratio                             5.446 170 2177 e-4    0.000 000 0024 e-4    
+electron-tau mass ratio                                2.875 64 e-4          0.000 47 e-4          
+electron to alpha particle mass ratio                  1.370 933 555 70 e-4  0.000 000 000 58 e-4  
+electron to shielded helion mag. mom. ratio            864.058 257           0.000 010             
+electron to shielded proton mag. mom. ratio            -658.227 5971         0.000 0072            
+electron volt                                          1.602 176 487 e-19    0.000 000 040 e-19    J
+electron volt-atomic mass unit relationship            1.073 544 188 e-9     0.000 000 027 e-9     u
+electron volt-hartree relationship                     3.674 932 540 e-2     0.000 000 092 e-2     E_h
+electron volt-hertz relationship                       2.417 989 454 e14     0.000 000 060 e14     Hz
+electron volt-inverse meter relationship               8.065 544 65 e5       0.000 000 20 e5       m^-1
+electron volt-joule relationship                       1.602 176 487 e-19    0.000 000 040 e-19    J
+electron volt-kelvin relationship                      1.160 4505 e4         0.000 0020 e4         K
+electron volt-kilogram relationship                    1.782 661 758 e-36    0.000 000 044 e-36    kg
+elementary charge                                      1.602 176 487 e-19    0.000 000 040 e-19    C
+elementary charge over h                               2.417 989 454 e14     0.000 000 060 e14     A J^-1
+Faraday constant                                       96 485.3399           0.0024                C mol^-1
+Faraday constant for conventional electric current     96 485.3401           0.0048                C_90 mol^-1
+Fermi coupling constant                                1.166 37 e-5          0.000 01 e-5          GeV^-2
+fine-structure constant                                7.297 352 5376 e-3    0.000 000 0050 e-3    
+first radiation constant                               3.741 771 18 e-16     0.000 000 19 e-16     W m^2
+first radiation constant for spectral radiance         1.191 042 759 e-16    0.000 000 059 e-16    W m^2 sr^-1
+hartree-atomic mass unit relationship                  2.921 262 2986 e-8    0.000 000 0042 e-8    u
+hartree-electron volt relationship                     27.211 383 86         0.000 000 68          eV
+Hartree energy                                         4.359 743 94 e-18     0.000 000 22 e-18     J
+Hartree energy in eV                                   27.211 383 86         0.000 000 68          eV
+hartree-hertz relationship                             6.579 683 920 722 e15 0.000 000 000 044 e15 Hz
+hartree-inverse meter relationship                     2.194 746 313 705 e7  0.000 000 000 015 e7  m^-1
+hartree-joule relationship                             4.359 743 94 e-18     0.000 000 22 e-18     J
+hartree-kelvin relationship                            3.157 7465 e5         0.000 0055 e5         K
+hartree-kilogram relationship                          4.850 869 34 e-35     0.000 000 24 e-35     kg
+helion-electron mass ratio                             5495.885 2765         0.000 0052            
+helion mass                                            5.006 411 92 e-27     0.000 000 25 e-27     kg
+helion mass energy equivalent                          4.499 538 64 e-10     0.000 000 22 e-10     J
+helion mass energy equivalent in MeV                   2808.391 383          0.000 070             MeV
+helion mass in u                                       3.014 932 2473        0.000 000 0026        u
+helion molar mass                                      3.014 932 2473 e-3    0.000 000 0026 e-3    kg mol^-1
+helion-proton mass ratio                               2.993 152 6713        0.000 000 0026        
+hertz-atomic mass unit relationship                    4.439 821 6294 e-24   0.000 000 0064 e-24   u
+hertz-electron volt relationship                       4.135 667 33 e-15     0.000 000 10 e-15     eV
+hertz-hartree relationship                             1.519 829 846 006 e-16 0.000 000 000 010 e-16 E_h
+hertz-inverse meter relationship                       3.335 640 951... e-9  (exact)               m^-1
+hertz-joule relationship                               6.626 068 96 e-34     0.000 000 33 e-34     J
+hertz-kelvin relationship                              4.799 2374 e-11       0.000 0084 e-11       K
+hertz-kilogram relationship                            7.372 496 00 e-51     0.000 000 37 e-51     kg
+inverse fine-structure constant                        137.035 999 679       0.000 000 094         
+inverse meter-atomic mass unit relationship            1.331 025 0394 e-15   0.000 000 0019 e-15   u
+inverse meter-electron volt relationship               1.239 841 875 e-6     0.000 000 031 e-6     eV
+inverse meter-hartree relationship                     4.556 335 252 760 e-8 0.000 000 000 030 e-8 E_h
+inverse meter-hertz relationship                       299 792 458           (exact)               Hz
+inverse meter-joule relationship                       1.986 445 501 e-25    0.000 000 099 e-25    J
+inverse meter-kelvin relationship                      1.438 7752 e-2        0.000 0025 e-2        K
+inverse meter-kilogram relationship                    2.210 218 70 e-42     0.000 000 11 e-42     kg
+inverse of conductance quantum                         12 906.403 7787       0.000 0088            ohm
+Josephson constant                                     483 597.891 e9        0.012 e9              Hz V^-1
+joule-atomic mass unit relationship                    6.700 536 41 e9       0.000 000 33 e9       u
+joule-electron volt relationship                       6.241 509 65 e18      0.000 000 16 e18      eV
+joule-hartree relationship                             2.293 712 69 e17      0.000 000 11 e17      E_h
+joule-hertz relationship                               1.509 190 450 e33     0.000 000 075 e33     Hz
+joule-inverse meter relationship                       5.034 117 47 e24      0.000 000 25 e24      m^-1
+joule-kelvin relationship                              7.242 963 e22         0.000 013 e22         K
+joule-kilogram relationship                            1.112 650 056... e-17 (exact)               kg
+kelvin-atomic mass unit relationship                   9.251 098 e-14        0.000 016 e-14        u
+kelvin-electron volt relationship                      8.617 343 e-5         0.000 015 e-5         eV
+kelvin-hartree relationship                            3.166 8153 e-6        0.000 0055 e-6        E_h
+kelvin-hertz relationship                              2.083 6644 e10        0.000 0036 e10        Hz
+kelvin-inverse meter relationship                      69.503 56             0.000 12              m^-1
+kelvin-joule relationship                              1.380 6504 e-23       0.000 0024 e-23       J
+kelvin-kilogram relationship                           1.536 1807 e-40       0.000 0027 e-40       kg
+kilogram-atomic mass unit relationship                 6.022 141 79 e26      0.000 000 30 e26      u
+kilogram-electron volt relationship                    5.609 589 12 e35      0.000 000 14 e35      eV
+kilogram-hartree relationship                          2.061 486 16 e34      0.000 000 10 e34      E_h
+kilogram-hertz relationship                            1.356 392 733 e50     0.000 000 068 e50     Hz
+kilogram-inverse meter relationship                    4.524 439 15 e41      0.000 000 23 e41      m^-1
+kilogram-joule relationship                            8.987 551 787... e16  (exact)               J
+kilogram-kelvin relationship                           6.509 651 e39         0.000 011 e39         K
+lattice parameter of silicon                           543.102 064 e-12      0.000 014 e-12        m
+Loschmidt constant (273.15 K, 101.325 kPa)             2.686 7774 e25        0.000 0047 e25        m^-3
+mag. constant                                          12.566 370 614... e-7 (exact)               N A^-2
+mag. flux quantum                                      2.067 833 667 e-15    0.000 000 052 e-15    Wb
+molar gas constant                                     8.314 472             0.000 015             J mol^-1 K^-1
+molar mass constant                                    1 e-3                 (exact)               kg mol^-1
+molar mass of carbon-12                                12 e-3                (exact)               kg mol^-1
+molar Planck constant                                  3.990 312 6821 e-10   0.000 000 0057 e-10   J s mol^-1
+molar Planck constant times c                          0.119 626 564 72      0.000 000 000 17      J m mol^-1
+molar volume of ideal gas (273.15 K, 100 kPa)          22.710 981 e-3        0.000 040 e-3         m^3 mol^-1
+molar volume of ideal gas (273.15 K, 101.325 kPa)      22.413 996 e-3        0.000 039 e-3         m^3 mol^-1
+molar volume of silicon                                12.058 8349 e-6       0.000 0011 e-6        m^3 mol^-1
+Mo x unit                                              1.002 099 55 e-13     0.000 000 53 e-13     m
+muon Compton wavelength                                11.734 441 04 e-15    0.000 000 30 e-15     m
+muon Compton wavelength over 2 pi                      1.867 594 295 e-15    0.000 000 047 e-15    m
+muon-electron mass ratio                               206.768 2823          0.000 0052            
+muon g factor                                          -2.002 331 8414       0.000 000 0012        
+muon mag. mom.                                         -4.490 447 86 e-26    0.000 000 16 e-26     J T^-1
+muon mag. mom. anomaly                                 1.165 920 69 e-3      0.000 000 60 e-3      
+muon mag. mom. to Bohr magneton ratio                  -4.841 970 49 e-3     0.000 000 12 e-3      
+muon mag. mom. to nuclear magneton ratio               -8.890 597 05         0.000 000 23          
+muon mass                                              1.883 531 30 e-28     0.000 000 11 e-28     kg
+muon mass energy equivalent                            1.692 833 510 e-11    0.000 000 095 e-11    J
+muon mass energy equivalent in MeV                     105.658 3668          0.000 0038            MeV
+muon mass in u                                         0.113 428 9256        0.000 000 0029        u
+muon molar mass                                        0.113 428 9256 e-3    0.000 000 0029 e-3    kg mol^-1
+muon-neutron mass ratio                                0.112 454 5167        0.000 000 0029        
+muon-proton mag. mom. ratio                            -3.183 345 137        0.000 000 085         
+muon-proton mass ratio                                 0.112 609 5261        0.000 000 0029        
+muon-tau mass ratio                                    5.945 92 e-2          0.000 97 e-2          
+natural unit of action                                 1.054 571 628 e-34    0.000 000 053 e-34    J s
+natural unit of action in eV s                         6.582 118 99 e-16     0.000 000 16 e-16     eV s
+natural unit of energy                                 8.187 104 38 e-14     0.000 000 41 e-14     J
+natural unit of energy in MeV                          0.510 998 910         0.000 000 013         MeV
+natural unit of length                                 386.159 264 59 e-15   0.000 000 53 e-15     m
+natural unit of mass                                   9.109 382 15 e-31     0.000 000 45 e-31     kg
+natural unit of momentum                               2.730 924 06 e-22     0.000 000 14 e-22     kg m s^-1
+natural unit of momentum in MeV/c                      0.510 998 910         0.000 000 013         MeV/c
+natural unit of time                                   1.288 088 6570 e-21   0.000 000 0018 e-21   s
+natural unit of velocity                               299 792 458           (exact)               m s^-1
+neutron Compton wavelength                             1.319 590 8951 e-15   0.000 000 0020 e-15   m
+neutron Compton wavelength over 2 pi                   0.210 019 413 82 e-15 0.000 000 000 31 e-15 m
+neutron-electron mag. mom. ratio                       1.040 668 82 e-3      0.000 000 25 e-3      
+neutron-electron mass ratio                            1838.683 6605         0.000 0011            
+neutron g factor                                       -3.826 085 45         0.000 000 90          
+neutron gyromag. ratio                                 1.832 471 85 e8       0.000 000 43 e8       s^-1 T^-1
+neutron gyromag. ratio over 2 pi                       29.164 6954           0.000 0069            MHz T^-1
+neutron mag. mom.                                      -0.966 236 41 e-26    0.000 000 23 e-26     J T^-1
+neutron mag. mom. to Bohr magneton ratio               -1.041 875 63 e-3     0.000 000 25 e-3      
+neutron mag. mom. to nuclear magneton ratio            -1.913 042 73         0.000 000 45          
+neutron mass                                           1.674 927 211 e-27    0.000 000 084 e-27    kg
+neutron mass energy equivalent                         1.505 349 505 e-10    0.000 000 075 e-10    J
+neutron mass energy equivalent in MeV                  939.565 346           0.000 023             MeV
+neutron mass in u                                      1.008 664 915 97      0.000 000 000 43      u
+neutron molar mass                                     1.008 664 915 97 e-3  0.000 000 000 43 e-3  kg mol^-1
+neutron-muon mass ratio                                8.892 484 09          0.000 000 23          
+neutron-proton mag. mom. ratio                         -0.684 979 34         0.000 000 16          
+neutron-proton mass ratio                              1.001 378 419 18      0.000 000 000 46      
+neutron-tau mass ratio                                 0.528 740             0.000 086             
+neutron to shielded proton mag. mom. ratio             -0.684 996 94         0.000 000 16          
+Newtonian constant of gravitation                      6.674 28 e-11         0.000 67 e-11         m^3 kg^-1 s^-2
+Newtonian constant of gravitation over h-bar c         6.708 81 e-39         0.000 67 e-39         (GeV/c^2)^-2
+nuclear magneton                                       5.050 783 24 e-27     0.000 000 13 e-27     J T^-1
+nuclear magneton in eV/T                               3.152 451 2326 e-8    0.000 000 0045 e-8    eV T^-1
+nuclear magneton in inverse meters per tesla           2.542 623 616 e-2     0.000 000 064 e-2     m^-1 T^-1
+nuclear magneton in K/T                                3.658 2637 e-4        0.000 0064 e-4        K T^-1
+nuclear magneton in MHz/T                              7.622 593 84          0.000 000 19          MHz T^-1
+Planck constant                                        6.626 068 96 e-34     0.000 000 33 e-34     J s
+Planck constant in eV s                                4.135 667 33 e-15     0.000 000 10 e-15     eV s
+Planck constant over 2 pi                              1.054 571 628 e-34    0.000 000 053 e-34    J s
+Planck constant over 2 pi in eV s                      6.582 118 99 e-16     0.000 000 16 e-16     eV s
+Planck constant over 2 pi times c in MeV fm            197.326 9631          0.000 0049            MeV fm
+Planck length                                          1.616 252 e-35        0.000 081 e-35        m
+Planck mass                                            2.176 44 e-8          0.000 11 e-8          kg
+Planck mass energy equivalent in GeV                   1.220 892 e19         0.000 061 e19         GeV
+Planck temperature                                     1.416 785 e32         0.000 071 e32         K
+Planck time                                            5.391 24 e-44         0.000 27 e-44         s
+proton charge to mass quotient                         9.578 833 92 e7       0.000 000 24 e7       C kg^-1
+proton Compton wavelength                              1.321 409 8446 e-15   0.000 000 0019 e-15   m
+proton Compton wavelength over 2 pi                    0.210 308 908 61 e-15 0.000 000 000 30 e-15 m
+proton-electron mass ratio                             1836.152 672 47       0.000 000 80          
+proton g factor                                        5.585 694 713         0.000 000 046         
+proton gyromag. ratio                                  2.675 222 099 e8      0.000 000 070 e8      s^-1 T^-1
+proton gyromag. ratio over 2 pi                        42.577 4821           0.000 0011            MHz T^-1
+proton mag. mom.                                       1.410 606 662 e-26    0.000 000 037 e-26    J T^-1
+proton mag. mom. to Bohr magneton ratio                1.521 032 209 e-3     0.000 000 012 e-3     
+proton mag. mom. to nuclear magneton ratio             2.792 847 356         0.000 000 023         
+proton mag. shielding correction                       25.694 e-6            0.014 e-6             
+proton mass                                            1.672 621 637 e-27    0.000 000 083 e-27    kg
+proton mass energy equivalent                          1.503 277 359 e-10    0.000 000 075 e-10    J
+proton mass energy equivalent in MeV                   938.272 013           0.000 023             MeV
+proton mass in u                                       1.007 276 466 77      0.000 000 000 10      u
+proton molar mass                                      1.007 276 466 77 e-3  0.000 000 000 10 e-3  kg mol^-1
+proton-muon mass ratio                                 8.880 243 39          0.000 000 23          
+proton-neutron mag. mom. ratio                         -1.459 898 06         0.000 000 34          
+proton-neutron mass ratio                              0.998 623 478 24      0.000 000 000 46      
+proton rms charge radius                               0.8768 e-15           0.0069 e-15           m
+proton-tau mass ratio                                  0.528 012             0.000 086             
+quantum of circulation                                 3.636 947 5199 e-4    0.000 000 0050 e-4    m^2 s^-1
+quantum of circulation times 2                         7.273 895 040 e-4     0.000 000 010 e-4     m^2 s^-1
+Rydberg constant                                       10 973 731.568 527    0.000 073             m^-1
+Rydberg constant times c in Hz                         3.289 841 960 361 e15 0.000 000 000 022 e15 Hz
+Rydberg constant times hc in eV                        13.605 691 93         0.000 000 34          eV
+Rydberg constant times hc in J                         2.179 871 97 e-18     0.000 000 11 e-18     J
+Sackur-Tetrode constant (1 K, 100 kPa)                 -1.151 7047           0.000 0044            
+Sackur-Tetrode constant (1 K, 101.325 kPa)             -1.164 8677           0.000 0044            
+second radiation constant                              1.438 7752 e-2        0.000 0025 e-2        m K
+shielded helion gyromag. ratio                         2.037 894 730 e8      0.000 000 056 e8      s^-1 T^-1
+shielded helion gyromag. ratio over 2 pi               32.434 101 98         0.000 000 90          MHz T^-1
+shielded helion mag. mom.                              -1.074 552 982 e-26   0.000 000 030 e-26    J T^-1
+shielded helion mag. mom. to Bohr magneton ratio       -1.158 671 471 e-3    0.000 000 014 e-3     
+shielded helion mag. mom. to nuclear magneton ratio    -2.127 497 718        0.000 000 025         
+shielded helion to proton mag. mom. ratio              -0.761 766 558        0.000 000 011         
+shielded helion to shielded proton mag. mom. ratio     -0.761 786 1313       0.000 000 0033        
+shielded proton gyromag. ratio                         2.675 153 362 e8      0.000 000 073 e8      s^-1 T^-1
+shielded proton gyromag. ratio over 2 pi               42.576 3881           0.000 0012            MHz T^-1
+shielded proton mag. mom.                              1.410 570 419 e-26    0.000 000 038 e-26    J T^-1
+shielded proton mag. mom. to Bohr magneton ratio       1.520 993 128 e-3     0.000 000 017 e-3     
+shielded proton mag. mom. to nuclear magneton ratio    2.792 775 598         0.000 000 030         
+speed of light in vacuum                               299 792 458           (exact)               m s^-1
+standard acceleration of gravity                       9.806 65              (exact)               m s^-2
+standard atmosphere                                    101 325               (exact)               Pa
+Stefan-Boltzmann constant                              5.670 400 e-8         0.000 040 e-8         W m^-2 K^-4
+tau Compton wavelength                                 0.697 72 e-15         0.000 11 e-15         m
+tau Compton wavelength over 2 pi                       0.111 046 e-15        0.000 018 e-15        m
+tau-electron mass ratio                                3477.48               0.57                  
+tau mass                                               3.167 77 e-27         0.000 52 e-27         kg
+tau mass energy equivalent                             2.847 05 e-10         0.000 46 e-10         J
+tau mass energy equivalent in MeV                      1776.99               0.29                  MeV
+tau mass in u                                          1.907 68              0.000 31              u
+tau molar mass                                         1.907 68 e-3          0.000 31 e-3          kg mol^-1
+tau-muon mass ratio                                    16.8183               0.0027                
+tau-neutron mass ratio                                 1.891 29              0.000 31              
+tau-proton mass ratio                                  1.893 90              0.000 31              
+Thomson cross section                                  0.665 245 8558 e-28   0.000 000 0027 e-28   m^2
+triton-electron mag. mom. ratio                        -1.620 514 423 e-3    0.000 000 021 e-3     
+triton-electron mass ratio                             5496.921 5269         0.000 0051            
+triton g factor                                        5.957 924 896         0.000 000 076         
+triton mag. mom.                                       1.504 609 361 e-26    0.000 000 042 e-26    J T^-1
+triton mag. mom. to Bohr magneton ratio                1.622 393 657 e-3     0.000 000 021 e-3     
+triton mag. mom. to nuclear magneton ratio             2.978 962 448         0.000 000 038         
+triton mass                                            5.007 355 88 e-27     0.000 000 25 e-27     kg
+triton mass energy equivalent                          4.500 387 03 e-10     0.000 000 22 e-10     J
+triton mass energy equivalent in MeV                   2808.920 906          0.000 070             MeV
+triton mass in u                                       3.015 500 7134        0.000 000 0025        u
+triton molar mass                                      3.015 500 7134 e-3    0.000 000 0025 e-3    kg mol^-1
+triton-neutron mag. mom. ratio                         -1.557 185 53         0.000 000 37          
+triton-proton mag. mom. ratio                          1.066 639 908         0.000 000 010         
+triton-proton mass ratio                               2.993 717 0309        0.000 000 0025        
+unified atomic mass unit                               1.660 538 782 e-27    0.000 000 083 e-27    kg
+von Klitzing constant                                  25 812.807 557        0.000 018             ohm
+weak mixing angle                                      0.222 55              0.000 56              
+Wien frequency displacement law constant               5.878 933 e10         0.000 010 e10         Hz K^-1
+Wien wavelength displacement law constant              2.897 7685 e-3        0.000 0051 e-3        m K
diff --git a/extra/units/imperial/imperial-tests.factor b/extra/units/imperial/imperial-tests.factor
new file mode 100644 (file)
index 0000000..2c41fe5
--- /dev/null
@@ -0,0 +1,21 @@
+USING: kernel math tools.test units.imperial ;
+IN: temporary
+
+[ 1 ] [ 12 inches [ feet ] undo ] unit-test
+[ 12 ] [ 1 feet [ inches ] undo ] unit-test
+
+[ t ] [ 16 ounces 1 pounds = ] unit-test
+[ t ] [ 1 pounds [ ounces ] undo 16 = ] unit-test
+
+[ 1 ] [ 4 quarts [ gallons ] undo ] unit-test
+[ 4 ] [ 1 gallons [ quarts ] undo ] unit-test
+
+[ 2 ] [ 1 pints [ cups ] undo ] unit-test
+[ 1 ] [ 2 cups [ pints ] undo ] unit-test
+
+[ 256 ] [ 1 gallons [ tablespoons ] undo ] unit-test
+[ 1 ] [ 256 tablespoons [ gallons ] undo ] unit-test
+
+[ 768 ] [ 1 gallons [ teaspoons ] undo ] unit-test
+[ 1 ] [ 768 teaspoons [ gallons ] undo ] unit-test
+
diff --git a/extra/units/imperial/imperial.factor b/extra/units/imperial/imperial.factor
new file mode 100644 (file)
index 0000000..a0c6350
--- /dev/null
@@ -0,0 +1,63 @@
+USING: kernel math prettyprint units units.si inverse ;
+IN: units.imperial
+
+: inches ( n -- dimensioned ) 254/100 * cm ;
+
+: feet ( n -- dimensioned ) 12 * inches ;
+
+: yards ( n -- dimensioned ) 3 * feet ;
+
+: miles ( n -- dimensioned ) 1760 * yards ;
+
+: nautical-miles ( n -- dimensioned ) 1852 * m ;
+
+: pounds ( n -- dimensioned ) 22/10 / kg ;
+
+: ounces ( n -- dimensioned ) 1/16 * pounds ;
+
+: gallons ( n -- dimensioned ) 379/100 * L ;
+
+: quarts ( n -- dimensioned ) 1/4 * gallons ;
+
+: pints ( n -- dimensioned ) 1/2 * quarts ;
+
+: cups ( n -- dimensioned ) 1/2 * pints ;
+
+: fluid-ounces ( n -- dimensioned ) 1/16 * pints ;
+
+: teaspoons ( n -- dimensioned ) 1/6 * fluid-ounces ;
+
+: tablespoons ( n -- dimensioned ) 1/2 * fluid-ounces ;
+
+: knots ( n -- dimensioned ) 1852/3600 * m/s ;
+
+: deg-F ( n -- dimensioned ) 32 - 5/9 * deg-C ;
+
+: imperial-gallons ( n -- dimensioned ) 454609/100000 * L ;
+
+: imperial-quarts ( n -- dimensioned ) 1/4 * imperial-gallons ;
+
+: imperial-pints ( n -- dimensioned ) 1/2 * imperial-quarts ;
+
+: imperial-fluid-ounces ( n -- dimensioned ) 1/160 * imperial-gallons ;
+
+: imperial-gill ( n -- dimensioned ) 5 * imperial-fluid-ounces ;
+
+: dry-gallons ( n -- dimensioned ) 440488377086/100000000000 * L ; 
+
+: dry-quarts ( n -- dimensioned ) 1/4 * dry-gallons ;
+
+: dry-pints ( n -- dimensioned ) 1/2 * dry-quarts ;
+
+: pecks ( n -- dimensioned ) 8 * dry-quarts ;
+
+: bushels ( n -- dimensioned ) 4 * pecks ;
+
+: rods ( n -- dimensioned ) 11/2 * yards ;
+
+
+
+
+
+
+! rod, hogshead, barrel, peck, metric ton, imperial ton..
diff --git a/extra/units/si/si-tests.factor b/extra/units/si/si-tests.factor
new file mode 100644 (file)
index 0000000..0fe4a6e
--- /dev/null
@@ -0,0 +1,12 @@
+USING: kernel tools.test units.si inverse ;
+IN: temporary
+
+[ t ] [ 1 m 100 cm = ] unit-test
+
+[ t ] [ 180 arc-deg [ radians ] undo pi 0.0001 ~ ] unit-test
+
+[ t ] [ 180 arc-min [ arc-deg ] undo 3 0.0001 ~ ] unit-test
+
+[ -40 ] [ -40 deg-F [ deg-C ] undo ] unit-test
+
+[ -40 ] [ -40 deg-C [ deg-F ] undo ] unit-test
diff --git a/extra/units/si/si.factor b/extra/units/si/si.factor
new file mode 100644 (file)
index 0000000..c07ffb8
--- /dev/null
@@ -0,0 +1,122 @@
+USING: kernel math math.constants sequences units ;
+IN: units.si
+
+! SI Conversions
+! http://physics.nist.gov/cuu/Units/
+
+! Length
+: m ( n -- dimensioned ) { m } { } <dimensioned> ;
+
+! Mass
+: kg ( n -- dimensioned ) { kg } { } <dimensioned> ;
+
+! Time
+: s ( n -- dimensioned ) { s } { } <dimensioned> ;
+
+! Electric current
+: A ( n -- dimensioned ) { A } { } <dimensioned> ;
+
+! Temperature
+: K ( n -- dimensioned ) { K } { } <dimensioned> ;
+
+! Amount of substance
+: mol ( n -- dimensioned ) { mol } { } <dimensioned> ;
+
+! Luminous intensity
+: cd ( n -- dimensioned ) { cd } { } <dimensioned> ;
+
+! SI derived units
+: m^2 { m m } { } <dimensioned> ;
+: m^3 { m m m } { } <dimensioned> ;
+: m/s { m } { s } <dimensioned> ;
+: m/s^2 { m } { s s } <dimensioned> ;
+: 1/m { } { m } <dimensioned> ;
+: kg/m^3 { kg } { m m m } <dimensioned> ;
+: A/m^2 { A } { m m } <dimensioned> ;
+: A/m { A } { m } <dimensioned> ;
+: mol/m^3 { mol } { m m m } <dimensioned> ;
+: cd/m^2 { cd } { m m } <dimensioned> ;
+: kg/kg { kg } { kg } <dimensioned> ;
+
+: radians ( n -- radian ) { m } { m } <dimensioned> ;
+: sr ( n -- steradian ) { m m } { m m } <dimensioned> ;
+: Hz ( n -- hertz ) { } { s } <dimensioned> ;
+: N ( n -- newton ) { kg m } { s s } <dimensioned> ;
+: Pa ( n -- pascal ) { kg } { m s s } <dimensioned> ;
+: J ( n -- joule ) { m m kg } { s s } <dimensioned> ;
+: W ( n -- watt ) { m m kg } { s s s } <dimensioned> ;
+: C ( n -- coulomb ) { s A } { } <dimensioned> ;
+: V ( n -- volt ) { m m kg } { s s s A } <dimensioned> ;
+: F ( n -- farad ) { s s s s A A } { m m kg } <dimensioned> ;
+: ohm ( n -- ohm ) { m m kg } { s s s A A } <dimensioned> ;
+: S ( n -- siemens ) { s s s A A } { m m kg } <dimensioned> ;
+: Wb ( n -- weber ) { m m kg } { s s A } <dimensioned> ;
+: T ( n -- tesla ) { kg } { s s A } <dimensioned> ;
+: H ( n -- henry ) { m m kg } { s s A A } <dimensioned> ;
+: deg-C ( n -- Celsius ) 27315/100 + { K } { } <dimensioned> ;
+: lm ( n -- lumen ) { m m cd } { m m } <dimensioned> ;
+: lx ( n -- lux ) { m m cd } { m m m m  } <dimensioned> ;
+: Bq ( n -- becquerel ) { } { s } <dimensioned> ;
+: Gy ( n -- gray ) { m m } { s s } <dimensioned> ;
+: Sv ( n -- sievert ) { m m } { s s } <dimensioned> ;
+: kat ( n -- katal ) { mol } { s } <dimensioned> ;
+
+! Extensions to the SI
+: arc-deg pi 180 / * radians ;
+: arc-min pi 10800 / * radians ;
+: arc-sec pi 648000 / * radians ;
+: L ( n -- liter ) 1/1000 * m^3 ;
+: tons ( n -- metric-ton ) 1000 * kg ;
+: Np ( n -- neper ) { } { } <dimensioned> ;
+: B ( n -- bel ) 1.151292546497023 * Np ;
+: eV ( n -- electronvolt ) 1.60218e-19 * J ;
+: u ( n -- unified-atomic-mass-unit ) 1.66054e-27 * kg ;
+
+! au has error of 30m, according to wikipedia
+: au ( n -- astronomical-unit ) 149597870691 * m ;
+
+: a ( n -- are ) 100 * m^2 ;
+: ha ( n -- hectare ) 10000 * m^2 ;
+: bar ( n -- bar ) 100000 * Pa ;
+: b ( n -- barn ) 1/10000000000000000000000000000 * m^2 ;
+: Ci ( n -- curie ) 37000000000 * Bq ;
+: R 258/10000 { s A } { kg } <dimensioned> ;
+: rad 100 / Gy ;
+
+! roentgen equivalent man, equal to one roentgen of X-rays
+: roentgen-equivalent-man 100 / Sv ;
+
+! inaccurate, use calendar where possible
+: minutes 60 * s ;
+: hours 60 * minutes ;
+: days 24 * hours ;
+
+! Y Z E P T G M k h da 1 d c m mu n p f a z y
+: yotta 1000000000000000000000000 * ;
+: zetta 1000000000000000000000 * ;
+: exa   1000000000000000000 * ;
+: peta  1000000000000000 * ;
+: tera  1000000000000 * ;
+: giga  1000000000 * ;
+: mega  1000000 * ;
+: kilo  1000 * ;
+: hecto 100 * ;
+: deca  10 * ;
+: deci  10 / ;
+: centi 100 / ;
+: milli 1000 / ;
+: micro 1000000 / ;
+: nano  1000000000 / ;
+: pico  1000000000000 / ;
+: femto 1000000000000000 / ;
+: atto  1000000000000000000 / ;
+: zepto 1000000000000000000000 / ;
+: yocto 1000000000000000000000000 / ;
+
+: km kilo m ;
+: cm centi m ;
+: mm milli m ;
+: nm nano m ;
+: g milli kg ;
+: ms milli s ;
+: angstrom 10 / nm ;
diff --git a/extra/units/units-tests.factor b/extra/units/units-tests.factor
new file mode 100644 (file)
index 0000000..831d68d
--- /dev/null
@@ -0,0 +1,22 @@
+USING: arrays kernel math sequences tools.test units.si units ;
+IN: temporary
+
+[ T{ dimensioned f 3 { m } { } } ] [ 3 m ] unit-test
+[ T{ dimensioned f 3 { m } { s } } ] [ 3 m/s ] unit-test
+[ T{ dimensioned f 4000 { m } { } } ] [ 4 km ] unit-test
+
+[ t ] [ 4 m 5 m d+ 9 m = ] unit-test
+[ t ] [ 5 m 1 m d- 4 m = ] unit-test
+[ t ] [ 5 m 2 m d* 10 m^2 = ] unit-test
+[ t ] [ 5 m 2 m d/ 5/2 { } { } <dimensioned> = ] unit-test
+[ t ] [ 5 m 2 m tuck d/ drop 2 m = ] unit-test
+
+[ t ] [ 1 m 2 m 3 m 3array d-product 6 m^3 = ] unit-test
+[ t ] [ 3 m d-recip 1/3 { } { m } <dimensioned> = ] unit-test
+
+! I want these to work, Dan
+
+: km/L km 1 L d/ ;
+: mpg miles 1 gallons d/ ;
+
+[ t ] [ 100 10 / km/L [ mpg ] undo 23 1 ~ ] unit-test
diff --git a/extra/units/units.factor b/extra/units/units.factor
new file mode 100644 (file)
index 0000000..95f4ed8
--- /dev/null
@@ -0,0 +1,100 @@
+USING: arrays io kernel math namespaces splitting prettyprint
+sequences sorting vectors words inverse inspector shuffle
+math.functions ;
+IN: units
+
+TUPLE: dimensioned value top bot ;
+
+TUPLE: dimensions-not-equal ;
+
+: dimensions-not-equal ( -- * )
+    \ dimensions-not-equal construct-empty throw ;
+
+M: dimensions-not-equal summary drop "Dimensions do not match" ;
+
+: seq-intersect ( seq1 seq2 -- seq1/\seq2 )
+    swap [ member? ] curry subset ;
+
+: remove-one ( seq obj -- seq )
+    1array split1 append ;
+
+: 2remove-one ( seq seq obj -- seq seq )
+    [ remove-one ] curry 2apply ;
+
+: symbolic-reduce ( seq seq -- seq seq )
+    2dup seq-intersect dup empty?
+    [ drop ] [ first 2remove-one symbolic-reduce ] if ;
+
+: <dimensioned> ( n top bot -- obj )
+    symbolic-reduce
+    [ natural-sort ] 2apply
+    dimensioned construct-boa ;
+
+: >dimensioned< ( d -- n top bot )
+    { dimensioned-value dimensioned-top dimensioned-bot }
+    get-slots ;
+
+\ <dimensioned> [ >dimensioned< ] define-inverse
+
+: dimensions ( dimensioned -- top bot )
+    { dimensioned-top dimensioned-bot } get-slots ;
+
+: check-dimensions ( d d -- )
+    [ dimensions 2array ] 2apply =
+    [ dimensions-not-equal ] unless ;
+
+: 2values [ dimensioned-value ] 2apply ;
+
+: <dimension-op
+    2dup check-dimensions dup dimensions 2swap 2values ;
+
+: dimension-op>
+    -rot <dimensioned> ;
+
+: d+ ( d d -- d ) <dimension-op + dimension-op> ;
+
+: d- ( d d -- d ) <dimension-op - dimension-op> ;
+
+: scalar ( n -- d )
+    { } { } <dimensioned> ;
+
+: d* ( d d -- d )
+    [ dup number? [ scalar ] when ] 2apply
+    [ [ dimensioned-top ] 2apply append ] 2keep
+    [ [ dimensioned-bot ] 2apply append ] 2keep
+    2values * dimension-op> ;
+
+: d-neg ( d -- d ) -1 d* ;
+
+: d-sq ( d -- d ) dup d* ;
+
+: d-recip ( d -- d' )
+    >dimensioned< swap rot recip dimension-op> ;
+
+: d/ ( d d -- d ) d-recip d* ;
+
+: comparison-op ( d d -- n n ) 2dup check-dimensions 2values ;
+
+: d< ( d d -- ? ) comparison-op < ;
+
+: d<= ( d d -- ? ) comparison-op <= ;
+
+: d> ( d d -- ? ) comparison-op > ;
+
+: d>= ( d d -- ? ) comparison-op >= ;
+
+: d= ( d d -- ? ) comparison-op number= ;
+
+: d~ ( d d delta -- ? ) >r comparison-op r> ~ ;
+
+: d-min ( d d -- d ) [ d< ] most ;
+
+: d-max ( d d -- d ) [ d> ] most ;
+
+: d-product ( v -- d ) 1 scalar [ d* ] reduce ;
+
+: d-sum ( v -- d ) unclip-slice [ d+ ] reduce ;
+
+: d-infimum ( v -- d ) unclip-slice [ d-min ] reduce ;
+
+: d-supremum ( v -- d ) unclip-slice [ d-max ] reduce ;
diff --git a/extra/unix/authors.txt b/extra/unix/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/unix/bsd/authors.txt b/extra/unix/bsd/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/unix/bsd/bsd.factor b/extra/unix/bsd/bsd.factor
new file mode 100644 (file)
index 0000000..0a5aa10
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: unix
+USING: alien.syntax ;
+
+! FreeBSD
+
+: O_RDONLY  HEX: 0000 ; inline
+: O_WRONLY  HEX: 0001 ; inline
+: O_RDWR    HEX: 0002 ; inline
+: O_APPEND  HEX: 0008 ; inline
+: O_CREAT   HEX: 0200 ; inline
+: O_TRUNC   HEX: 0400 ; inline
+: O_EXCL    HEX: 0800 ; inline
+
+: FD_SETSIZE 1024 ; inline
+
+: SOL_SOCKET HEX: ffff ; inline
+: SO_REUSEADDR HEX: 4 ; inline
+: SO_OOBINLINE HEX: 100 ; inline
+: SO_SNDTIMEO HEX: 1005 ; inline
+: SO_RCVTIMEO HEX: 1006 ; inline
+
+: F_SETFL 4 ; inline
+: O_NONBLOCK 4 ; inline
+
+C-STRUCT: addrinfo
+    { "int" "flags" }
+    { "int" "family" }
+    { "int" "socktype" }
+    { "int" "protocol" }
+    { "socklen_t" "addrlen" }
+    { "char*" "canonname" }
+    { "void*" "addr" }
+    { "addrinfo*" "next" } ;
+
+C-STRUCT: sockaddr-in
+    { "uchar" "len" }
+    { "uchar" "family" }
+    { "ushort" "port" }
+    { "in_addr_t" "addr" }
+    { "longlong" "unused" } ;
+
+C-STRUCT: sockaddr-in6
+    { "uchar" "len" }
+    { "uchar" "family" }
+    { "ushort" "port" }
+    { "uint" "flowinfo" }
+    { { "uchar" 16 } "addr" }
+    { "uint" "scopeid" } ;
+
+C-STRUCT: sockaddr-un
+    { "uchar" "len" }
+    { "uchar" "family" }
+    { { "char" 104 } "path" } ;
+
+: max-un-path 104 ; inline
+
+: EINTR HEX: 4 ; inline
+: EAGAIN HEX: 23 ; inline
+: EINPROGRESS HEX: 24 ; inline
+
+: SOCK_STREAM 1 ; inline
+: SOCK_DGRAM 2 ; inline
+
+: AF_UNSPEC 0 ; inline
+: AF_UNIX 1 ; inline
+: AF_INET 2 ; inline
+: AF_INET6 30 ; inline
+
+: PF_UNSPEC AF_UNSPEC ; inline
+: PF_UNIX AF_UNIX ; inline
+: PF_INET AF_INET ; inline
+: PF_INET6 AF_INET6 ; inline
+
+: IPPROTO_TCP 6 ; inline
+: IPPROTO_UDP 17 ; inline
+
+: AI_PASSIVE 1 ; inline
+
+: SEEK_SET 0 ; inline
+: SEEK_CUR 1 ; inline
+: SEEK_END 2 ; inline
diff --git a/extra/unix/bsd/summary.txt b/extra/unix/bsd/summary.txt
new file mode 100644 (file)
index 0000000..9acec6c
--- /dev/null
@@ -0,0 +1 @@
+*BSD/Mac OS X support
diff --git a/extra/unix/linux/linux.factor b/extra/unix/linux/linux.factor
new file mode 100644 (file)
index 0000000..d25ff71
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2005 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: unix
+USING: alien.syntax ;
+
+TYPEDEF: ulong off_t
+
+! Linux.
+
+: O_RDONLY  HEX: 0000 ; inline
+: O_WRONLY  HEX: 0001 ; inline
+: O_RDWR    HEX: 0002 ; inline
+: O_CREAT   HEX: 0040 ; inline
+: O_EXCL    HEX: 0080 ; inline
+: O_TRUNC   HEX: 0200 ; inline
+: O_APPEND  HEX: 0400 ; inline
+
+: SOL_SOCKET 1 ; inline
+
+: FD_SETSIZE 1024 ; inline
+
+: SO_REUSEADDR 2 ; inline
+: SO_OOBINLINE 10 ; inline
+: SO_SNDTIMEO HEX: 15 ; inline
+: SO_RCVTIMEO HEX: 14 ; inline
+
+: F_SETFL 4 ; inline
+: O_NONBLOCK HEX: 800 ; inline
+
+C-STRUCT: addrinfo
+    { "int" "flags" }
+    { "int" "family" }
+    { "int" "socktype" }
+    { "int" "protocol" }
+    { "socklen_t" "addrlen" }
+    { "void*" "addr" }
+    { "char*" "canonname" }
+    { "addrinfo*" "next" } ;
+
+C-STRUCT: sockaddr-in
+    { "ushort" "family" }
+    { "ushort" "port" }
+    { "in_addr_t" "addr" }
+    { "longlong" "unused" } ;
+
+C-STRUCT: sockaddr-in6
+    { "ushort" "family" }
+    { "ushort" "port" }
+    { "uint" "flowinfo" }
+    { { "uchar" 16 } "addr" }
+    { "uint" "scopeid" } ;
+
+: max-un-path 108 ; inline
+
+C-STRUCT: sockaddr-un
+    { "ushort" "family" }
+    { { "char" max-un-path } "path" } ;
+
+: EINTR HEX: 4 ; inline
+: EAGAIN HEX: b ; inline
+: EINPROGRESS HEX: 73 ; inline
+
+: SOCK_STREAM 1 ; inline
+: SOCK_DGRAM 2 ; inline
+
+: AF_UNSPEC 0 ; inline
+: AF_UNIX 1 ; inline
+: AF_INET 2 ; inline
+: AF_INET6 10 ; inline
+
+: PF_UNSPEC AF_UNSPEC ; inline
+: PF_UNIX AF_UNIX ; inline
+: PF_INET AF_INET ; inline
+: PF_INET6 AF_INET6 ; inline
+
+: IPPROTO_TCP 6 ; inline
+: IPPROTO_UDP 17 ; inline
+
+: AI_PASSIVE 1 ; inline
+
+: SEEK_SET 0 ; inline
+: SEEK_CUR 1 ; inline
+: SEEK_END 2 ; inline
diff --git a/extra/unix/solaris/solaris.factor b/extra/unix/solaris/solaris.factor
new file mode 100644 (file)
index 0000000..b4aa828
--- /dev/null
@@ -0,0 +1,83 @@
+! Copyright (C) 2006 Patrick Mauritz.
+! See http://factorcode.org/license.txt for BSD license.
+IN: unix
+USING: alien.syntax system kernel ;
+
+TYPEDEF: ulong off_t
+
+! Solaris.
+
+: O_RDONLY  HEX: 0000 ; inline
+: O_WRONLY  HEX: 0001 ; inline
+: O_RDWR    HEX: 0002 ; inline
+: O_APPEND  HEX: 0008 ; inline
+: O_CREAT   HEX: 0100 ; inline
+: O_TRUNC   HEX: 0200 ; inline
+
+: SEEK_END 2 ; inline
+
+: SOL_SOCKET HEX: ffff ; inline
+
+: FD_SETSIZE cell 4 = 1024 65536 ? ; inline
+
+: SO_REUSEADDR 4 ; inline
+: SO_OOBINLINE HEX: 0100 ; inline
+: SO_SNDTIMEO HEX: 1005 ; inline
+: SO_RCVTIMEO HEX: 1006 ; inline
+
+: F_SETFL 4 ;    ! set file status flags
+: O_NONBLOCK HEX: 80 ; ! no delay
+
+C-STRUCT: addrinfo
+    { "int" "flags" }
+    { "int" "family" }
+    { "int" "socktype" }
+    { "int" "protocol" }
+! #ifdef __sparcv9
+!         int _ai_pad;            
+! #endif
+    { "int" "addrlen" }
+    { "char*" "canonname" }
+    { "void*" "addr" }
+    { "void*" "next" } ;
+
+C-STRUCT: sockaddr-in
+    { "ushort" "family" }
+    { "ushort" "port" }
+    { "in_addr_t" "addr" }
+    { "longlong" "unused" } ;
+
+C-STRUCT: sockaddr-in6
+    { "ushort" "family" }
+    { "ushort" "port" }
+    { "uint" "flowinfo" }
+    { { "uchar" 16 } "addr" }
+    { "uint" "scopeid" } ;
+
+: max-un-path 108 ;
+
+C-STRUCT: sockaddr-un
+    { "ushort" "family" }
+    { { "char" max-un-path } "path" } ;
+
+: EINTR 4 ; inline
+: EAGAIN 11 ; inline
+: EINPROGRESS 150 ; inline
+
+: SOCK_STREAM 2 ; inline
+: SOCK_DGRAM 1 ; inline
+
+: AF_UNSPEC 0 ; inline
+: AF_UNIX 1 ; inline
+: AF_INET 2 ; inline
+: AF_INET6 26 ; inline
+
+: PF_UNSPEC AF_UNSPEC ; inline
+: PF_UNIX AF_UNIX ; inline
+: PF_INET AF_INET ; inline
+: PF_INET6 AF_INET6 ; inline
+
+: IPPROTO_TCP 6 ; inline
+: IPPROTO_UDP 17 ; inline
+
+: AI_PASSIVE 8 ; inline
diff --git a/extra/unix/summary.txt b/extra/unix/summary.txt
new file mode 100644 (file)
index 0000000..38ca371
--- /dev/null
@@ -0,0 +1 @@
+Bindings to library and system calls found on Unix-like systems
diff --git a/extra/unix/tags.txt b/extra/unix/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/unix/unix.factor b/extra/unix/unix.factor
new file mode 100644 (file)
index 0000000..8eb9403
--- /dev/null
@@ -0,0 +1,168 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: unix
+USING: alien alien.c-types alien.syntax kernel libc structs
+math namespaces system ;
+
+! ! ! Unix types
+TYPEDEF: int blksize_t
+TYPEDEF: int dev_t
+TYPEDEF: long ssize_t
+TYPEDEF: longlong blkcnt_t
+TYPEDEF: longlong quad_t
+TYPEDEF: uint gid_t
+TYPEDEF: uint in_addr_t
+TYPEDEF: uint ino_t
+TYPEDEF: uint pid_t
+TYPEDEF: uint socklen_t
+TYPEDEF: uint time_t
+TYPEDEF: uint uid_t
+TYPEDEF: ulong size_t
+TYPEDEF: ulong u_long
+TYPEDEF: ulonglong off_t
+TYPEDEF: ushort mode_t
+TYPEDEF: ushort nlink_t
+TYPEDEF: void* caddr_t
+
+USE-IF: linux? unix.linux
+USE-IF: bsd? unix.bsd
+USE-IF: solaris? unix.solaris
+
+C-STRUCT: tm
+    { "int" "sec" }    ! Seconds: 0-59 (K&R says 0-61?)
+    { "int" "min" }    ! Minutes: 0-59
+    { "int" "hour" }   ! Hours since midnight: 0-23
+    { "int" "mday" }   ! Day of the month: 1-31
+    { "int" "mon" }    ! Months *since* january: 0-11
+    { "int" "year" }   ! Years since 1900
+    { "int" "wday" }   ! Days since Sunday (0-6)
+    { "int" "yday" }   ! Days since Jan. 1: 0-365
+    { "int" "isdst" }  ! +1 Daylight Savings Time, 0 No DST,
+    { "long" "gmtoff" } ! Seconds: 0-59 (K&R says 0-61?)
+    { "char*" "zone" } ;
+
+C-STRUCT: timespec
+    { "time_t" "sec" }
+    { "long" "nsec" } ;
+
+! ! ! Unix constants
+
+! File type
+: S_IFMT    OCT: 0170000 ; inline ! type of file
+: S_IFIFO   OCT: 0010000 ; inline ! named pipe (fifo)
+: S_IFCHR   OCT: 0020000 ; inline ! character special
+: S_IFDIR   OCT: 0040000 ; inline ! directory
+: S_IFBLK   OCT: 0060000 ; inline ! block special
+: S_IFREG   OCT: 0100000 ; inline ! regular
+: S_IFLNK   OCT: 0120000 ; inline ! symbolic link
+: S_IFSOCK  OCT: 0140000 ; inline ! socket
+: S_IFWHT   OCT: 0160000 ; inline ! whiteout
+: S_IFXATTR OCT: 0200000 ; inline ! extended attribute
+
+! File mode
+! Read, write, execute/search by owner
+: S_IRWXU OCT: 0000700 ; inline    ! rwx mask owner
+: S_IRUSR OCT: 0000400 ; inline    ! r owner
+: S_IWUSR OCT: 0000200 ; inline    ! w owner
+: S_IXUSR OCT: 0000100 ; inline    ! x owner
+! Read, write, execute/search by group
+: S_IRWXG OCT: 0000070 ; inline    ! rwx mask group
+: S_IRGRP OCT: 0000040 ; inline    ! r group
+: S_IWGRP OCT: 0000020 ; inline    ! w group
+: S_IXGRP OCT: 0000010 ; inline    ! x group
+! Read, write, execute/search by others
+: S_IRWXO OCT: 0000007 ; inline    ! rwx mask other
+: S_IROTH OCT: 0000004 ; inline    ! r other
+: S_IWOTH OCT: 0000002 ; inline    ! w other
+: S_IXOTH OCT: 0000001 ; inline    ! x other
+
+: S_ISUID OCT: 0004000 ; inline    ! set user id on execution
+: S_ISGID OCT: 0002000 ; inline    ! set group id on execution
+: S_ISVTX OCT: 0001000 ; inline    ! sticky bit
+
+: PROT_NONE   0 ; inline
+: PROT_READ   1 ; inline
+: PROT_WRITE  2 ; inline
+: PROT_EXEC   4 ; inline
+
+: MAP_FILE    0 ; inline
+: MAP_SHARED  1 ; inline
+: MAP_PRIVATE 2 ; inline
+
+: MAP_FAILED -1 <alien> ; inline
+
+! ! ! Unix functions
+LIBRARY: factor
+FUNCTION: int err_no ( ) ;
+
+LIBRARY: libc
+
+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 chown ( char* path, uid_t owner, gid_t group ) ;
+FUNCTION: int chroot ( char* path ) ;
+FUNCTION: void close ( int fd ) ;
+FUNCTION: int connect ( int s, void* name, socklen_t namelen ) ;
+FUNCTION: int dup2 ( int oldd, int newd ) ;
+! FUNCTION: int dup ( int oldd ) ;
+FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
+FUNCTION: int fchdir ( int fd ) ;
+FUNCTION: int fchmod ( int fd, mode_t mode ) ;
+FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ;
+FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
+FUNCTION: int flock ( int fd, int operation ) ;
+FUNCTION: pid_t fork ( ) ;
+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: int getdtablesize ;
+FUNCTION: gid_t getegid ;
+FUNCTION: uid_t geteuid ;
+FUNCTION: gid_t getgid ;
+FUNCTION: int getgroups ( int gidsetlen, gid_t* gidset ) ;
+FUNCTION: int gethostname ( char* name, int len ) ;
+FUNCTION: uid_t getuid ;
+FUNCTION: uint htonl ( uint n ) ;
+FUNCTION: ushort htons ( ushort n ) ;
+! FUNCTION: int issetugid ;
+FUNCTION: int ioctl ( int fd, ulong request, char* argp ) ;
+FUNCTION: int lchown ( char* path, uid_t owner, gid_t group ) ;
+FUNCTION: int listen ( int s, int backlog ) ;
+FUNCTION: tm* localtime ( time_t* clock ) ;
+FUNCTION: off_t lseek ( int fildes, off_t offset, int whence ) ;
+FUNCTION: int mkdir ( char* 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 open ( char* path, int flags, int prot ) ;
+FUNCTION: int pclose ( void* file ) ;
+FUNCTION: int pipe ( int* filedes ) ;
+FUNCTION: void* popen ( char* command, char* type ) ;
+FUNCTION: ssize_t read ( int fd, void* buf, size_t nbytes ) ;
+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 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 setegid ( gid_t egid ) ;
+FUNCTION: int seteuid ( uid_t euid ) ;
+FUNCTION: int setgid ( gid_t gid ) ;
+FUNCTION: int setgroups ( int ngroups, gid_t* gidset ) ;
+FUNCTION: int setregid ( gid_t rgid, gid_t egid ) ;
+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: char* strerror ( int errno ) ;
+FUNCTION: int system ( char* command ) ;
+FUNCTION: time_t time ( time_t* t ) ;
+FUNCTION: int unlink ( char* path ) ;
+FUNCTION: int utimes ( char* path, timeval[2] times ) ;
+FUNCTION: pid_t wait ( int* status ) ;
+FUNCTION: pid_t waitpid ( pid_t wpid, int* status, int options ) ;
+FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
diff --git a/extra/vars/authors.txt b/extra/vars/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/vars/summary.txt b/extra/vars/summary.txt
new file mode 100644 (file)
index 0000000..9f5f717
--- /dev/null
@@ -0,0 +1 @@
+Shorthand notation for variables
diff --git a/extra/vars/tags.txt b/extra/vars/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/vars/vars.factor b/extra/vars/vars.factor
new file mode 100644 (file)
index 0000000..ec57502
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2005, 2006 Eduardo Cavazos
+
+! Thanks to Mackenzie Straight for the idea
+
+USING: kernel parser words namespaces sequences quotations ;
+
+IN: vars
+
+: define-var-symbol ( str -- ) create-in define-symbol ;
+
+: define-var-getter ( str -- )
+dup ">" append create-in swap in get lookup [ get ] curry define-compound ;
+
+: define-var-setter ( str -- )
+">" over append create-in swap in get lookup [ set ] curry define-compound ;
+
+: define-var ( str -- )
+dup define-var-symbol dup define-var-getter define-var-setter ;
+
+: VAR: ! var
+    scan define-var ; parsing
+
+: define-vars ( seq -- ) [ define-var ] each ;
+
+: VARS: ! vars ...
+";" parse-tokens define-vars ; parsing
diff --git a/extra/visitor/authors.txt b/extra/visitor/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/visitor/summary.txt b/extra/visitor/summary.txt
new file mode 100644 (file)
index 0000000..3093ae9
--- /dev/null
@@ -0,0 +1 @@
+Double-dispatch generic words
diff --git a/extra/visitor/tags.txt b/extra/visitor/tags.txt
new file mode 100644 (file)
index 0000000..f427429
--- /dev/null
@@ -0,0 +1 @@
+extensions
diff --git a/extra/visitor/visitor-tests.factor b/extra/visitor/visitor-tests.factor
new file mode 100644 (file)
index 0000000..8248aff
--- /dev/null
@@ -0,0 +1,18 @@
+USING: visitor math sequences math.parser strings tools.test kernel ;
+
+VISITOR: ++ ( object object -- object )
+! acts like +, coercing string arguments to a number, unless both arguments are strings, in which case it appends them
+
+V: number string ++
+    string>number + ;
+V: string number ++
+    >r string>number r> + ;
+V: number number ++
+    + ;
+V: string string ++
+    append ;
+
+[ 3 ] [ 1 2 ++ ] unit-test
+[ 3 ] [ "1" 2 ++ ] unit-test
+[ 3 ] [ 1 "2" ++ ] unit-test
+[ "12" ] [ "1" "2" ++ ] unit-test
diff --git a/extra/visitor/visitor.factor b/extra/visitor/visitor.factor
new file mode 100644 (file)
index 0000000..dd6bad7
--- /dev/null
@@ -0,0 +1,63 @@
+USING: kernel generic.standard syntax words parser assocs
+generic quotations sequences effects arrays classes definitions
+prettyprint sorting prettyprint.backend shuffle ;
+IN: visitor
+
+: define-visitor ( word -- )
+    dup dup reset-word define-simple-generic
+    dup H{ } clone "visitor-methods" set-word-prop
+    H{ } clone "visitors" set-word-prop ; 
+
+: VISITOR:
+    CREATE define-visitor ; parsing
+
+: record-visitor ( top-class generic method-word -- )
+    swap "visitors" word-prop swapd set-at ;
+
+: define-1generic ( word -- )
+    1 <standard-combination> define-generic ;
+
+: copy-effect ( from to -- )
+    swap stack-effect "declared-effect" set-word-prop ;
+
+: new-vmethod ( method bottom-class top-class generic -- )
+    gensym dup define-1generic
+    2dup copy-effect
+    3dup 1quotation -rot define-method
+    [ record-visitor ] keep
+    define-method ;
+
+: define-visitor-method ( method bottom-class top-class generic -- )
+    4dup >r 2array r> "visitor-methods" word-prop set-at
+    2dup "visitors" word-prop at
+    [ nip define-method ] [ new-vmethod ] ?if ;
+
+: V:
+    ! syntax: V: bottom-class top-class generic body... ;
+    f set-word scan-word scan-word scan-word
+    parse-definition -roll define-visitor-method ; parsing
+
+! see instance:
+! see must be redone because "methods" doesn't show methods
+
+PREDICATE: standard-generic visitor "visitors" word-prop ;
+PREDICATE: array triple length 3 = ;
+PREDICATE: triple visitor-spec
+    first3 visitor? >r [ class? ] 2apply and r> and ;
+
+M: visitor-spec definer drop \ V: \ ; ;
+M: visitor definer drop \ VISITOR: f ;
+
+M: visitor-spec synopsis*
+    ! same as method-spec#synopsis*
+    dup definer drop pprint-word
+    [ pprint-word ] each ;
+
+M: visitor-spec definition
+    first3 >r 2array r> "visitor-methods" word-prop at ;
+
+M: visitor see
+    dup (see)
+    dup see-class
+    dup "visitor-methods" word-prop keys natural-sort swap
+    [ >r first2 r> 3array ] curry map see-all ;
diff --git a/extra/webapps/article-manager/article-manager-docs.factor b/extra/webapps/article-manager/article-manager-docs.factor
new file mode 100644 (file)
index 0000000..b8dc700
--- /dev/null
@@ -0,0 +1,33 @@
+! Copyright (C) 2007 Chris Double.\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.markup help.syntax webapps.article-manager.database ;\r
+IN: webapps.article-manager\r
+\r
+ARTICLE: { "article-manager" "loading" } "Loading Article Manager"\r
+"To start an instance of the article-manager furnace application:"\r
+{ $example "\"webapps.article-manager\" run" }\r
+"The article-manager database needs to be opened before it can be accessed."\r
+{ $example "open-db" } ;\r
+\r
+ARTICLE: { "article-manager" "security" } "Article Manager Security"\r
+"To setup an article manager site you need to authenticate under the basic-authentication realm called \"article-manager-site\". To add and edit articles you need to authenticate under the realm \"article-manager-article\". The following sets up an 'admin' user under these two realms with a password of 'password'."\r
+{ $example "H{ { \"admin\" \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\" } } \"article-manager-site\" add-realm\nH{ { \"admin\" \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\" } } \"article-manager-article\" add-realm " } \r
+"Multiple users can be added with different passwords under these realms." ;\r
+\r
+ARTICLE: { "article-manager" "setup" } "Article Manager Setup"\r
+"A site must first be setup before it can be accessed by the user. This can be access via the URL " { $url "http://site-name/responder/article-manager/setup-site/" } "\n\n" \r
+"The 'hostname' is the hostname portion of the URL used to access the site. The 'title' is what appears in the title bar. 'footer' appears at the bottom of the pages in the site and can be used for a copyright notice, etc. 'Introduction' Should be Wiky code and will appear on the first index page of the site. 'HTML' will be appended to every page just before the closing of the 'body' HTML tag. It can be used to put HTML for counters, user tracking, etc.\n\n" \r
+"The 'Ad Block' sections are used for entering HTML and Javascript code for ads that will appear in the article pages. 'Ad Block 1' appears in the left hand navigation area underneat the menu and above the 'tags' list. The other two ad blocks appear at the top of articles randomly split between either no ad and one of those two blocks." ;\r
+\r
+ARTICLE: { "article-manager" "articles" } "Adding or Editing Articles"\r
+"Articles are added or edited using the URL " { $url "http://site-name/responder/article-manager/edit-article/article-name" } ". This will bring up a form with information about the article.\n\n'Publication Date' is the date you want to appear next to the article. You can click the button next to it to select it using a popup calendar. 'Title' is the title of the article.\n\n'Status' can be 'Draft' or 'Published'. 'Draft' articles do not appear in the main index page or list of tags. They can still be accessed via the direct URL however. Note that editing an existing article will default this to 'Draft' automatically, so you'll need to change it back to 'Published' if you want it to appear.\n\n'Tags' is a space-separated list of tag names that can be used for finding articles.\n\n'Body' is the text of the article. It is in Wiky format and shows a preview below it. For more on the Wiky syntax see " { $url "http://goessner.net/articles/wiky/WikyBox.html" } " or Google for 'Wikybox'." \r
+;\r
+\r
+ARTICLE: { "article-manager" "article-manager" } "Article Manager"\r
+"The article-manager is a Furnace application used to manage and display a tagged set of articles. Each instance of the article-manager responder can run multiple sites containing different articles. Follow these instructions to set up an article manager instance."\r
+{ $subsection { "article-manager" "loading" } } \r
+{ $subsection { "article-manager" "security" } } \r
+{ $subsection { "article-manager" "setup" } } \r
+{ $subsection { "article-manager" "articles" } }  ;\r
+\r
+ABOUT: { "article-manager" "article-manager" } 
\ No newline at end of file
diff --git a/extra/webapps/article-manager/article-manager.factor b/extra/webapps/article-manager/article-manager.factor
new file mode 100644 (file)
index 0000000..22daf96
--- /dev/null
@@ -0,0 +1,160 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel furnace sqlite.tuple-db webapps.article-manager.database 
+       sequences namespaces math arrays assocs quotations io.files
+       http.server http.basic-authentication http.server.responders 
+       http.server.responders.file ;
+IN: webapps.article-manager
+
+: current-site ( -- site )
+  host get-site* ;
+
+TUPLE: template-args arg1 ;
+  
+C: <template-args> template-args
+
+: setup-site ( -- )
+  "article-manager-site" [
+    current-site "setup-site" "edit-head" "Setup Site" render-titled-page* 
+  ] with-basic-authentication ;
+
+\ setup-site { } define-action
+
+: site-index ( -- )
+  host get-site [
+    current-site "index" "head" pick site-title render-titled-page* 
+  ] [  
+    "404" "Unknown Site" httpd-error 
+  ] if ;
+
+! An action called 'site-index' 
+\ site-index { } define-action
+
+: requested-article-path ( action -- url )
+  length "responder-url" get length 1 + + "request" get swap tail ;
+
+: requested-article-url ( action -- url )
+  requested-article-path CHAR: / over index dup [
+    head
+  ] [
+    drop
+  ] if ;
+
+: requested-article-filename ( action -- url )
+  requested-article-path CHAR: / over last-index 1+ tail ;
+
+: tag ( -- )
+  current-site
+  "tag" requested-article-url host swap get-tag dup >r
+  2array <template-args> "tag" "head" r> tag-title render-titled-page* ;
+
+! An action for tags
+\ tag { } define-action 
+
+: article ( -- )
+  current-site 
+  "article" requested-article-url host swap article-by-url dup >r
+  2array <template-args>
+  "article" "head" r> article-title render-titled-page* ;
+
+! An action for articles
+\ article { } define-action 
+
+
+: edit-article ( -- )
+  "article-manager-article" [
+    "edit-article" requested-article-url host swap article-by-url* 
+    "edit-article" "edit-head" "Edit" render-titled-page* 
+  ] with-basic-authentication ;
+
+! An action for articles
+\ edit-article { } define-action 
+
+: update-article ( pubdate title status tags body url -- )
+  "article-manager-article" [
+    host swap article-by-url* 
+    [ set-article-body ] keep
+    [ set-article-tags ] keep
+    [ set-article-status ] keep
+    [ set-article-title ] keep
+    [ set-article-pubdate ] keep
+    [ save-article ] keep
+    article-url "responder-url" get "article/" rot 3append "/" append permanent-redirect
+  ] with-basic-authentication ;
+  
+
+\ update-article { { "pubdate" } { "title" } { "status" } { "tags" } { "body" } { "url" } } define-action 
+
+: update-article-link ( -- link )
+  "responder-url" get "update-article" append ;
+
+: remove-article ( url -- )
+  "article-manager-article" [
+    host swap article-by-url [ remove-article ] when*
+    "responder-url" get permanent-redirect
+  ] with-basic-authentication ;
+
+\ remove-article { { "url" } } define-action 
+
+: update-site ( ad3 ad2 ad1 html title intro footer hostname -- )
+  "article-manager-site" [
+    dup get-site* 
+    [ set-site-hostname ] keep
+    [ set-site-footer ] keep
+    [ set-site-intro ] keep
+    [ set-site-title ] keep
+    [ set-site-html ] keep
+    [ set-site-ad1 ] keep
+    [ set-site-ad2 ] keep
+    [ set-site-ad3 ] keep
+    get-db swap save-tuple 
+    "responder-url" get permanent-redirect 
+  ] with-basic-authentication ;
+
+
+\ update-site { { "ad3" } { "ad2" } { "ad1" } { "html" } { "title" } { "intro" } { "footer" } { "hostname" } } define-action 
+
+: update-site-link ( -- link )
+  "responder-url" get "update-site" append ;
+
+
+SYMBOL: redirections
+
+: redirector ( url quot -- )
+  over redirections get H{ } or at dup [ 
+    2nip permanent-redirect
+  ] [
+    drop call
+  ] if ;
+
+: install-redirector ( hash responder host -- )
+  vhost [ responder ] bind [
+    "post" get [ redirector ] curry "post" set
+    "get" get [ redirector ] curry "get" set
+    redirections set
+  ] bind ;
+
+: get-redirections ( responder host -- hash )
+  vhost [ responder ] bind [ redirections get ] bind ;
+
+: article-manager-web-app ( -- )
+  ! Create the web app, providing access 
+  ! under '/responder/article-manager' which calls the
+  ! 'site-index' action.
+  "article-manager" "site-index" "extra/webapps/article-manager/furnace/" web-app
+
+  ! An URL to the javascript and css resource files
+  "article-manager-resources" [
+    [
+      "extra/webapps/article-manager/resources/" resource-path "doc-root" set
+      file-responder
+    ] with-scope
+  ] add-simple-responder ;
+
+MAIN: article-manager-web-app
+
+! Just for testing. Password is 'password'
+! H{ { "admin" "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" } } "article-manager-site" add-realm 
+! H{ { "admin" "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" } } "article-manager-article" add-realm 
+
diff --git a/extra/webapps/article-manager/authors.txt b/extra/webapps/article-manager/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/webapps/article-manager/database/database.factor b/extra/webapps/article-manager/database/database.factor
new file mode 100644 (file)
index 0000000..1b42279
--- /dev/null
@@ -0,0 +1,118 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel sqlite sqlite.tuple-db io.files sequences splitting
+       hashtables ;
+IN: webapps.article-manager.database
+
+TUPLE: site hostname title intro footer html ad1 ad2 ad3 ;
+
+C: <site> site
+
+TUPLE: article hostname url pubdate title status body tags ;
+
+C: <article> article
+
+TUPLE: tag hostname name title description ;
+
+C: <tag> tag
+
+site default-mapping set-mapping
+article default-mapping set-mapping
+tag default-mapping set-mapping 
+
+: db ( -- object )
+  { f } ;          
+
+: set-db ( value -- )
+  0 db set-nth ;
+
+
+: get-db ( -- value )
+  0 db nth ;
+
+: db-filename ( -- name )
+  "extra/webapps/article-manager/article-manager.db" resource-path ;
+
+: open-db ( -- )
+  get-db [ sqlite-close ] when*
+  db-filename exists? [
+    db-filename sqlite-open set-db 
+  ] [
+    db-filename sqlite-open dup set-db
+    dup article create-tuple-table
+    dup site create-tuple-table
+    tag create-tuple-table
+  ] if ;
+
+: close-db ( -- )
+  get-db [ sqlite-close ] when*
+  f set-db ;
+
+: all-sites ( -- sites )
+  get-db f f f f f f f f <site> find-tuples ;
+
+: get-site ( hostname -- site )
+  f f f f f f f <site> get-db swap find-tuples dup empty? [ 
+    drop f
+  ] [ 
+    first 
+  ] if ;
+
+: get-site* ( hostname -- site )
+  f f f f f f f <site> dup get-db swap find-tuples dup empty? [ 
+    drop site-hostname dup "" "" "" "" "" "" <site> 
+  ] [ 
+    nip first 
+  ] if ;
+
+: get-tag ( hostname name -- tag )
+  f f <tag> dup get-db swap find-tuples dup empty? [ 
+    drop 
+    [ dup tag-name swap set-tag-title ] keep
+    [ "" swap set-tag-description ] keep
+  ] [ 
+    nip first 
+  ] if ;
+
+: add-article ( article -- )
+  get-db swap insert-tuple ;
+
+: remove-article ( article -- )
+  get-db swap delete-tuple ;
+
+: save-article ( article -- )
+  get-db swap save-tuple ;
+
+: all-articles ( hostname -- seq )
+  f f f "published" f f <article> get-db swap find-tuples ;
+
+: article-by-url ( hostname url -- article )
+  f f f f f <article> get-db swap find-tuples dup empty? [
+    drop f
+  ] [ 
+    first
+  ] if ;
+
+: article-by-url* ( hostname url -- article )
+  f f f f f <article> dup get-db swap find-tuples dup empty? [
+    drop 
+    [ "" swap set-article-pubdate ] keep
+    [ "" swap set-article-title ] keep
+    [ "draft" swap set-article-status ] keep
+    [ "" swap set-article-body ] keep
+    [ "" swap set-article-tags ] keep
+  ] [ 
+    nip first
+  ] if ;
+
+: tags-for-article ( article -- seq )
+  article-tags " " split [ empty? not ] subset ;
+
+: all-tags ( hostname -- seq )
+  all-articles [ tags-for-article ] map concat prune ;
+
+: articles-for-tag ( tag -- seq )
+  [ tag-name ] keep tag-hostname all-articles [
+    tags-for-article member?
+  ] curry* subset ;
diff --git a/extra/webapps/article-manager/furnace/article.furnace b/extra/webapps/article-manager/furnace/article.furnace
new file mode 100644 (file)
index 0000000..4192930
--- /dev/null
@@ -0,0 +1,13 @@
+<% USING: kernel io http.server namespaces sequences math html.elements random furnace webapps.article-manager webapps.article-manager.database ; %>
+    <div id="banner"><h1><% "arg1" get second article-title write %></h1></div>
+    <% f "navigation" render-template %>
+    <div id="article">
+    <% 100 random 25 > [ "arg1" get first 100 random 50 > [ site-ad2 ] [ site-ad3 ] if write-html ] when %>
+    <% "arg1" get second article-body write-html %>
+
+       <h1>Tags</h1>
+        <% "arg1" get second tags-for-article <template-args> "tags" render-template %>
+</div>
+<p class="footer"></p>
+<p id="copyright"><% "arg1" get first site-footer write %></p>
+<% "arg1" get first site-html write-html %>
diff --git a/extra/webapps/article-manager/furnace/edit-article.furnace b/extra/webapps/article-manager/furnace/edit-article.furnace
new file mode 100644 (file)
index 0000000..76ec95f
--- /dev/null
@@ -0,0 +1,41 @@
+<% USING: kernel io namespaces furnace webapps.article-manager html.elements ; %>
+<script type="text/javascript">
+function transformWiky() {
+  var wiky = $('#wiky').get(0).value;
+  var html = Wiky.toHtml(wiky);
+  $('#html').get(0).value = html;
+  $('#preview').html(html);
+}
+function transformHtml() {
+  var html = $('#preview').get(0).innerHTML;
+  var wiky = Wiky.toWiki(html);
+  $('#wiky').get(0).value = wiky;
+  $('#html').get(0).value = html;
+}
+</script>
+<form method="post" action="<% update-article-link write %>">
+  <table>
+    <tr><td>URL:</td><td><input type="hidden" name="url" value="<% "url" get write %>"/><input type="text" name="readonlyurl" disabled="disabled" value="<% "url" get write %>"/></td></tr>
+    <tr><td>Publication Date:</td><td><input id="pubdate" type="text" name="pubdate" value="<% "pubdate" get write %>"/> <button id="calendar">[c]</button></td></tr>
+    <tr><td>Title:</td><td><input type="text" name="title" value="<% "title" get write %>"/></td></tr>
+    <tr><td>Status:</td><td><select name="status">
+                              <option value="draft">Draft</option>
+                              <option value="published">Published</option>
+        </td></tr>
+    <tr><td>Tags:</td><td><input type="text" name="tags" value="<% "tags" get write %>"/></td></tr>
+    <tr><td>Body:</td><td><textarea id='wiky' onkeyup="transformWiky();" rows="10" cols="80" name="wiky"></textarea></td></tr>
+    <tr><td>Preview:</td><td><input id="html" type='hidden' name="body" value=""/><div id="preview"><% "body" get write-html %></div></td></tr>
+    <tr><td colspan="2"><input type="submit" name="post" value="Post"/></td></tr>
+</form>
+<script type="text/javascript">
+transformHtml();
+Calendar.setup(
+  {
+    inputField: "pubdate",
+    ifFormat  : "%Y/%m/%d %H:%M",
+    showsTime : true,
+    timeFormat: "24",
+    button: "calendar"
+  });  
+</script>
+
diff --git a/extra/webapps/article-manager/furnace/edit-head.furnace b/extra/webapps/article-manager/furnace/edit-head.furnace
new file mode 100644 (file)
index 0000000..c1d55ae
--- /dev/null
@@ -0,0 +1,12 @@
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/style.css"/>\r
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/wiky.css"/>\r
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/wiky.lang.css"/>\r
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/wiky.math.css"/>\r
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/jscalendar-1.0/calendar-win2k-1.css"/>\r
+<script type="text/javascript" src="/responder/article-manager-resources/jquery.js"></script>\r
+<script type="text/javascript" src="/responder/article-manager-resources/wiky.js"></script>\r
+<script type="text/javascript" src="/responder/article-manager-resources/wiky.lang.js"></script>\r
+<script type="text/javascript" src="/responder/article-manager-resources/wiky.math.js"></script>\r
+<script type="text/javascript" src="/responder/article-manager-resources/jscalendar-1.0/calendar.js"></script>\r
+<script type="text/javascript" src="/responder/article-manager-resources/jscalendar-1.0/lang/calendar-en.js"></script>\r
+<script type="text/javascript" src="/responder/article-manager-resources/jscalendar-1.0/calendar-setup.js"></script>\r
diff --git a/extra/webapps/article-manager/furnace/head.furnace b/extra/webapps/article-manager/furnace/head.furnace
new file mode 100644 (file)
index 0000000..21a4e9c
--- /dev/null
@@ -0,0 +1,4 @@
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/style.css"/>\r
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/wiky.css"/>\r
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/wiky.lang.css"/>\r
+<link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/wiky.math.css"/>\r
diff --git a/extra/webapps/article-manager/furnace/index.furnace b/extra/webapps/article-manager/furnace/index.furnace
new file mode 100644 (file)
index 0000000..ae8963c
--- /dev/null
@@ -0,0 +1,32 @@
+<% USING: kernel sequences furnace webapps.article-manager webapps.article-manager.database io namespaces http.server sorting html.elements math ; %>
+<html>
+    <head>
+       <title><% "title" get write %></title>
+       <link rel="stylesheet" type="text/css" href="/responder/article-manager-resources/style.css">
+</head>
+    <body>
+       <div id="banner"><h1><% "title" get write %></h1></div>
+    <% f "navigation" render-template %>
+<div id="article">
+  <% "intro" get write-html %>
+    <h1>Recent Articles</h1>
+    <ul>
+      <% host all-articles [ >r article-pubdate r> article-pubdate swap <=> ] sort [ %>
+       <li><a href="article/<% dup article-url write "/" write %>"><% dup article-title write %></a> (<% article-pubdate write %>)</li>
+      <% ] each %>
+    </ul>
+
+       <h1>Tags</h1>
+       <p>The information in this site is 'tagged'. By searching or
+           selecting one of the tags below you can find information about
+           that area. A search facility will be added soon
+           but in the meantime, Google is likely to provide
+           reasonable results.
+       </p>
+        <% host all-tags <template-args> "tags" render-template %>
+</div>
+<p class="footer"></p>
+<p id="copyright"><% "footer" get write %></p>
+    <% "html" get write-html %>
+    </body>
+</html>
\ No newline at end of file
diff --git a/extra/webapps/article-manager/furnace/navigation.furnace b/extra/webapps/article-manager/furnace/navigation.furnace
new file mode 100644 (file)
index 0000000..33fb299
--- /dev/null
@@ -0,0 +1,9 @@
+<% USING: kernel furnace webapps.article-manager webapps.article-manager.database io namespaces http.server html.elements ; %>
+    <div id="navigation">
+    <ul>
+     <li><a href="<% "responder-url" get write %>">Home</a></li>
+    </ul>
+    <% current-site site-ad1 write-html %>
+    <h1>Tags</h1>
+    <% host all-tags <template-args> "tags" render-template %>
+    </div>
diff --git a/extra/webapps/article-manager/furnace/setup-site.furnace b/extra/webapps/article-manager/furnace/setup-site.furnace
new file mode 100644 (file)
index 0000000..8922b8d
--- /dev/null
@@ -0,0 +1,33 @@
+<% USING: kernel io namespaces furnace webapps.article-manager html.elements ; %>
+<script type="text/javascript">
+function transformWiky() {
+  var wiky = $('#wiky').get(0).value;
+  var html = Wiky.toHtml(wiky);
+  $('#html').get(0).value = html;
+  $('#preview').html(html);
+}
+function transformHtml() {
+  var html = $('#preview').get(0).innerHTML;
+  var wiky = Wiky.toWiki(html);
+  $('#wiky').get(0).value = wiky;
+  $('#html').get(0).value = html;
+}
+</script>
+<h1>Setup New Site</h1>
+<form method="post" action="<% update-site-link write %>">
+  <table>
+    <tr><td>Hostname:</td><td><input type="text" name="hostname" value="<% "hostname" get write %>"/></td></tr>
+    <tr><td>Title:</td><td><input type="text" name="title" value="<% "title" get write %>"/></td></tr>
+    <tr><td>footer:</td><td><input type="text" name="footer" value="<% "footer" get write %>"/></td></tr>
+    <tr><td>Introduction:</td><td><textarea id='wiky' onkeyup="transformWiky();" rows="10" cols="80"></textarea></td></tr>
+    <tr><td>Preview:</td><td><input id="html" type="hidden" name="intro" value=""/><div id="preview"><% "intro" get write-html %></div></td></tr>
+    <tr><td>HTML:</td><td><textarea name="html" rows="10" cols="80"><% "html" get write %></textarea></td></tr>
+    <tr><td>Ad Block 1:</td><td><textarea name="ad1" rows="10" cols="80"><% "ad1" get write %></textarea></td></tr>
+    <tr><td>Ad Block 2:</td><td><textarea name="ad2" rows="10" cols="80"><% "ad2" get write %></textarea></td></tr>
+    <tr><td>Ad Block 3:</td><td><textarea name="ad3" rows="10" cols="80"><% "ad3" get write %></textarea></td></tr>
+    <tr><td colspan="2"><input type="submit" name="post" value="Post"/></td></tr>
+</form>
+<script type="text/javascript">
+transformHtml();
+</script>
+
diff --git a/extra/webapps/article-manager/furnace/tag.furnace b/extra/webapps/article-manager/furnace/tag.furnace
new file mode 100644 (file)
index 0000000..493ce2e
--- /dev/null
@@ -0,0 +1,16 @@
+<% USING: kernel io http.server namespaces sequences math html furnace webapps.article-manager.database webapps.article-manager ; %>
+
+       <div id="banner"><h1><% "arg1" get second tag-title write %></h1></div>
+    <% f "navigation" render-template %>
+       <div id="article">
+       <h1><% "arg1" get second tag-title write %></h1>
+        <% "arg1" get second tag-description write-html %>
+       <ul>
+          <% "arg1" get second articles-for-tag [ %>
+           <li><a href="<% "responder-url" get write "article/" write dup article-url write "/" write %>"><% dup article-title write %></a> (<% article-pubdate write %>)</li></a></li>
+         <% ] each %>
+       </ul>    
+       </div>
+<p class="footer"></p>
+<p id="copyright"><% "arg1" get first site-footer write %></p>
+<% "arg1" get first site-html write-html %>
diff --git a/extra/webapps/article-manager/furnace/tags.furnace b/extra/webapps/article-manager/furnace/tags.furnace
new file mode 100644 (file)
index 0000000..77d3656
--- /dev/null
@@ -0,0 +1,6 @@
+<% USING: kernel namespaces sequences webapps.article-manager.database io sorting ; %>
+       <ul>
+      <% "arg1" get [ <=> ] sort [ %>
+       <li><a href="<% "responder-url" get write "tag/" write dup write "/" write %>"><% write %></a></li>
+      <% ] each %>
+       </ul>
diff --git a/extra/webapps/article-manager/load.factor b/extra/webapps/article-manager/load.factor
new file mode 100644 (file)
index 0000000..facb651
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (C) 2007 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+REQUIRES: libs/furnace libs/sqlite libs/basic-authentication ;
+
+PROVIDE: apps/article-manager
+{ 
+  +files+ { 
+  "article-manager-db.factor"
+  "article-manager.factor"
+  "article-manager.facts"
+  } 
+} {
+  +tests+ { 
+  }
+}  
+{ +help+ { "article-manager" "article-manager" } } 
+ ;
diff --git a/extra/webapps/article-manager/resources/jquery.js b/extra/webapps/article-manager/resources/jquery.js
new file mode 100644 (file)
index 0000000..2531342
--- /dev/null
@@ -0,0 +1 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('l(1T 1z.6=="Q"){1z.Q=1z.Q;u 6=q(a,c){l(a&&1T a=="q"&&6.C.1W)v 6(17).1W(a);a=a||6.1o||17;l(a.3E)v 6(6.1X(a,[]));l(c&&c.3E)v 6(c).1V(a);l(1z==7)v 1h 6(a,c);l(a.O==1C){u m=/^[^<]*(<.+>)[^>]*$/.3d(a);l(m)a=6.3D([m[1]])}7.1n(a.O==2z||a.D&&!a.1R&&a[0]!=Q&&a[0].1R?6.1X(a,[]):6.1V(a,c));u C=19[19.D-1];l(C&&1T C=="q")7.W(C);v 7};l(1T $!="Q")6.44$=$;u $=6;6.C=6.8b={3E:"1.0.3",5J:q(){v 7.D},1n:q(23){l(23&&23.O==2z){7.D=0;[].1k.16(7,23);v 7}G v 23==Q?6.1X(7,[]):7[23]},W:q(C,1g){v 6.W(7,C,1g)},8g:q(15){u 2j=-1;7.W(q(i){l(7==15)2j=i});v 2j},1t:q(1L,Y,B){v 1L.O!=1C||Y!=Q?7.W(q(){l(Y==Q)I(u E 1r 1L)6.1t(B?7.1a:7,E,1L[E]);G 6.1t(B?7.1a:7,1L,Y)}):6[B||"1t"](7[0],1L)},1f:q(1L,Y){v 7.1t(1L,Y,"26")},2B:q(e){e=e||7;u t="";I(u j=0;j<e.D;j++){u r=e[j].2f;I(u i=0;i<r.D;i++)l(r[i].1R!=8)t+=r[i].1R!=1?r[i].4Z:6.C.2B([r[i]])}v t},1Y:q(){u a=6.3D(19);v 7.W(q(){u b=a[0].3f(T);7.1i.2Y(b,7);24(b.2a)b=b.2a;b.4e(7)})},5g:q(){v 7.2T(19,T,1,q(a){7.4e(a)})},5h:q(){v 7.2T(19,T,-1,q(a){7.2Y(a,7.2a)})},5i:q(){v 7.2T(19,U,1,q(a){7.1i.2Y(a,7)})},5j:q(){v 7.2T(19,U,-1,q(a){7.1i.2Y(a,7.8j)})},4q:q(){v 7.1n(7.33.8k())},1V:q(t){v 7.2n(6.2r(7,q(a){v 6.1V(t,a)}),19)},4f:q(4D){v 7.2n(6.2r(7,q(a){v a.3f(4D!=Q?4D:T)}),19)},1c:q(t){v 7.2n(t.O==2z&&6.2r(7,q(a){I(u i=0;i<t.D;i++)l(6.1c(t[i],[a]).r.D)v a;v U})||t.O==8l&&(t?7.1n():[])||1T t=="q"&&6.2O(7,t)||6.1c(t,7).r,19)},2t:q(t){v 7.2n(t.O==1C?6.1c(t,7,U).r:6.2O(7,q(a){v a!=t}),19)},2g:q(t){v 7.2n(6.1X(7,t.O==1C?6.1V(t):t.O==2z?t:[t]),19)},4E:q(2u){v 2u?6.1c(2u,7).r.D>0:U},2T:q(1g,22,2X,C){u 4f=7.5J()>1;u a=6.3D(1g);v 7.W(q(){u 15=7;l(22&&7.2p.2b()=="8m"&&a[0].2p.2b()!="62"){u 29=7.4S("29");l(!29.D){15=17.5N("29");7.4e(15)}G 15=29[0]}I(u i=(2X<0?a.D-1:0);i!=(2X<0?2X:a.D);i+=2X){C.16(15,[4f?a[i].3f(T):a[i]])}})},2n:q(a,1g){u C=1g&&1g[1g.D-1];u 2d=1g&&1g[1g.D-2];l(C&&C.O!=1v)C=M;l(2d&&2d.O!=1v)2d=M;l(!C){l(!7.33)7.33=[];7.33.1k(7.1n());7.1n(a)}G{u 1Z=7.1n();7.1n(a);l(2d&&a.D||!2d)7.W(2d||C).1n(1Z);G 7.1n(1Z).W(C)}v 7}};6.1y=6.C.1y=q(15,E){l(19.D>1&&(E===M||E==Q))v 15;l(!E){E=15;15=7}I(u i 1r E)15[i]=E[i];v 15};6.1y({5C:q(){6.65=T;6.W(6.2e.5r,q(i,n){6.C[i]=q(a){u L=6.2r(7,n);l(a&&a.O==1C)L=6.1c(a,L).r;v 7.2n(L,19)}});6.W(6.2e.2o,q(i,n){6.C[i]=q(){u a=19;v 7.W(q(){I(u j=0;j<a.D;j++)6(a[j])[n](7)})}});6.W(6.2e.W,q(i,n){6.C[i]=q(){v 7.W(n,19)}});6.W(6.2e.1c,q(i,n){6.C[n]=q(23,C){v 7.1c(":"+n+"("+23+")",C)}});6.W(6.2e.1t,q(i,n){n=n||i;6.C[i]=q(h){v h==Q?7.D?7[0][n]:M:7.1t(n,h)}});6.W(6.2e.1f,q(i,n){6.C[n]=q(h){v h==Q?(7.D?6.1f(7[0],n):M):7.1f(n,h)}})},W:q(15,C,1g){l(15.D==Q)I(u i 1r 15)C.16(15[i],1g||[i,15[i]]);G I(u i=0;i<15.D;i++)l(C.16(15[i],1g||[i,15[i]])===U)45;v 15},1j:{2g:q(o,c){l(6.1j.3t(o,c))v;o.1j+=(o.1j?" ":"")+c},25:q(o,c){l(!c){o.1j=""}G{u 2L=o.1j.3b(" ");I(u i=0;i<2L.D;i++){l(2L[i]==c){2L.67(i,1);45}}o.1j=2L.5Z(\' \')}},3t:q(e,a){l(e.1j!=Q)e=e.1j;v 1h 43("(^|\\\\s)"+a+"(\\\\s|$)").28(e)}},4A:q(e,o,f){I(u i 1r o){e.1a["1Z"+i]=e.1a[i];e.1a[i]=o[i]}f.16(e,[]);I(u i 1r o)e.1a[i]=e.1a["1Z"+i]},1f:q(e,p){l(p=="1G"||p=="2c"){u 1Z={},3K,3F,d=["68","6O","69","7c"];I(u i 1r d){1Z["6b"+d[i]]=0;1Z["6c"+d[i]+"6e"]=0}6.4A(e,1Z,q(){l(6.1f(e,"1u")!="20"){3K=e.6f;3F=e.6g}G{e=6(e.3f(T)).1V(":3W").5u("2J").4q().1f({3U:"1S",2H:"6i",1u:"2F",6j:"0",5l:"0"}).4H(e.1i)[0];u 31=6.1f(e.1i,"2H");l(31==""||31=="3R")e.1i.1a.2H="6k";3K=e.6l;3F=e.6m;l(31==""||31=="3R")e.1i.1a.2H="3R";e.1i.3s(e)}});v p=="1G"?3K:3F}v 6.26(e,p)},26:q(F,E,4I){u L;l(E==\'1m\'&&6.11.1p)v 6.1t(F.1a,\'1m\');l(E=="3p"||E=="2y")E=6.11.1p?"37":"2y";l(!4I&&F.1a[E]){L=F.1a[E]}G l(F.34){u 5S=E.1B(/\\-(\\w)/g,q(m,c){v c.2b()});L=F.34[E]||F.34[5S]}G l(17.3g&&17.3g.4u){l(E=="2y"||E=="37")E="3p";E=E.1B(/([A-Z])/g,"-$1").4d();u 1l=17.3g.4u(F,M);l(1l)L=1l.5P(E);G l(E==\'1u\')L=\'20\';G 6.4A(F,{1u:\'2F\'},q(){L=17.3g.4u(7,M).5P(E)})}v L},3D:q(a){u r=[];I(u i=0;i<a.D;i++){u 1M=a[i];l(1M.O==1C){u s=6.2K(1M),21=17.5N("21"),1Y=[0,"",""];l(!s.1b("<6v"))1Y=[1,"<3c>","</3c>"];G l(!s.1b("<6w")||!s.1b("<29"))1Y=[1,"<22>","</22>"];G l(!s.1b("<4t"))1Y=[2,"<22>","</22>"];G l(!s.1b("<6x")||!s.1b("<6z"))1Y=[3,"<22><29><4t>","</4t></29></22>"];21.2V=1Y[1]+s+1Y[2];24(1Y[0]--)21=21.2a;I(u j=0;j<21.2f.D;j++)r.1k(21.2f[j])}G l(1M.D!=Q&&!1M.1R)I(u n=0;n<1M.D;n++)r.1k(1M[n]);G r.1k(1M.1R?1M:17.6A(1M.6C()))}v r},2u:{"":"m[2]== \'*\'||a.2p.2b()==m[2].2b()","#":"a.3a(\'3H\')&&a.3a(\'3H\')==m[2]",":":{5o:"i<m[3]-0",5X:"i>m[3]-0",5L:"m[3]-0==i",5n:"m[3]-0==i",2h:"i==0",1N:"i==r.D-1",52:"i%2==0",53:"i%2","5L-3x":"6.1x(a,m[3]).1l","2h-3x":"6.1x(a,0).1l","1N-3x":"6.1x(a,0).1N","6D-3x":"6.1x(a).D==1",5s:"a.2f.D",5B:"!a.2f.D",5p:"6.C.2B.16([a]).1b(m[3])>=0",6E:"a.B!=\'1S\'&&6.1f(a,\'1u\')!=\'20\'&&6.1f(a,\'3U\')!=\'1S\'",1S:"a.B==\'1S\'||6.1f(a,\'1u\')==\'20\'||6.1f(a,\'3U\')==\'1S\'",6F:"!a.2P",2P:"a.2P",2J:"a.2J",3V:"a.3V || 6.1t(a, \'3V\')",2B:"a.B==\'2B\'",3W:"a.B==\'3W\'",5y:"a.B==\'5y\'",3Q:"a.B==\'3Q\'",5v:"a.B==\'5v\'",4x:"a.B==\'4x\'",5w:"a.B==\'5w\'",4w:"a.B==\'4w\'",4s:"a.B==\'4s\'",5z:"a.2p.4d().4T(/5z|3c|6L|4s/)"},".":"6.1j.3t(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z && !z.1b(m[4])","$=":"z && z.32(z.D - m[4].D,m[4].D)==m[4]","*=":"z && z.1b(m[4])>=0","":"z"},"[":"6.1V(m[2],a).D"},3B:["\\\\.\\\\.|/\\\\.\\\\.","a.1i",">|/","6.1x(a.2a)","\\\\+","6.1x(a).3z","~",q(a){u r=[];u s=6.1x(a);l(s.n>0)I(u i=s.n;i<s.D;i++)r.1k(s[i]);v r}],1V:q(t,1o){l(1o&&1o.1R==Q)1o=M;1o=1o||6.1o||17;l(t.O!=1C)v[t];l(!t.1b("//")){1o=1o.4Q;t=t.32(2,t.D)}G l(!t.1b("/")){1o=1o.4Q;t=t.32(1,t.D);l(t.1b("/")>=1)t=t.32(t.1b("/"),t.D)}u L=[1o];u 1K=[];u 1N=M;24(t.D>0&&1N!=t){u r=[];1N=t;t=6.2K(t).1B(/^\\/\\//i,"");u 36=U;I(u i=0;i<6.3B.D;i+=2){l(36)51;u 2v=1h 43("^("+6.3B[i]+")");u m=2v.3d(t);l(m){r=L=6.2r(L,6.3B[i+1]);t=6.2K(t.1B(2v,""));36=T}}l(!36){l(!t.1b(",")||!t.1b("|")){l(L[0]==1o)L.4h();1K=6.1X(1K,L);r=L=[1o];t=" "+t.32(1,t.D)}G{u 3Z=/^([#.]?)([a-4Y-9\\\\*44-]*)/i;u m=3Z.3d(t);l(m[1]=="#"){u 4l=17.5V(m[2]);r=L=4l?[4l]:[];t=t.1B(3Z,"")}G{l(!m[2]||m[1]==".")m[2]="*";I(u i=0;i<L.D;i++)r=6.1X(r,m[2]=="*"?6.40(L[i]):L[i].4S(m[2]))}}}l(t){u 1D=6.1c(t,r);L=r=1D.r;t=6.2K(1D.t)}}l(L&&L[0]==1o)L.4h();1K=6.1X(1K,L);v 1K},40:q(o,r){r=r||[];u s=o.2f;I(u i=0;i<s.D;i++)l(s[i].1R==1){r.1k(s[i]);6.40(s[i],r)}v r},1t:q(F,1d,Y){u 2m={"I":"7v","6P":"1j","3p":6.11.1p?"37":"2y",2y:6.11.1p?"37":"2y",2V:"2V",1j:"1j",Y:"Y",2P:"2P",2J:"2J",6R:"6S"};l(1d=="1m"&&6.11.1p&&Y!=Q){F[\'6U\']=1;l(Y==1)v F["1c"]=F["1c"].1B(/3k\\([^\\)]*\\)/5c,"");G v F["1c"]=F["1c"].1B(/3k\\([^\\)]*\\)/5c,"")+"3k(1m="+Y*4U+")"}G l(1d=="1m"&&6.11.1p){v F["1c"]?4c(F["1c"].4T(/3k\\(1m=(.*)\\)/)[1])/4U:1}l(1d=="1m"&&6.11.2I&&Y==1)Y=0.6W;l(2m[1d]){l(Y!=Q)F[2m[1d]]=Y;v F[2m[1d]]}G l(Y==Q&&6.11.1p&&F.2p&&F.2p.2b()==\'6X\'&&(1d==\'7f\'||1d==\'7e\')){v F.70(1d).4Z}G l(F.3a!=Q&&F.7b){l(Y!=Q)F.72(1d,Y);v F.3a(1d)}G{1d=1d.1B(/-([a-z])/73,q(z,b){v b.2b()});l(Y!=Q)F[1d]=Y;v F[1d]}},4X:["\\\\[ *(@)S *([!*$^=]*) *(\'?\\"?)(.*?)\\\\4 *\\\\]","(\\\\[)\\s*(.*?)\\s*\\\\]","(:)S\\\\(\\"?\'?([^\\\\)]*?)\\"?\'?\\\\)","([:.#]*)S"],1c:q(t,r,2t){u g=2t!==U?6.2O:q(a,f){v 6.2O(a,f,T)};24(t&&/^[a-z[({<*:.#]/i.28(t)){u p=6.4X;I(u i=0;i<p.D;i++){u 2v=1h 43("^"+p[i].1B("S","([a-z*44-][a-4Y-76-]*)"),"i");u m=2v.3d(t);l(m){l(!i)m=["",m[1],m[3],m[2],m[5]];t=t.1B(2v,"");45}}l(m[1]==":"&&m[2]=="2t")r=6.1c(m[3],r,U).r;G{u f=6.2u[m[1]];l(f.O!=1C)f=6.2u[m[1]][m[2]];3A("f = q(a,i){"+(m[1]=="@"?"z=6.1t(a,m[3]);":"")+"v "+f+"}");r=g(r,f)}}v{r:r,t:t}},2K:q(t){v t.1B(/^\\s+|\\s+$/g,"")},3L:q(F){u 47=[];u 1l=F.1i;24(1l&&1l!=17){47.1k(1l);1l=1l.1i}v 47},1x:q(F,2j,2t){u 14=[];l(F){u 2k=F.1i.2f;I(u i=0;i<2k.D;i++){l(2t===T&&2k[i]==F)51;l(2k[i].1R==1)14.1k(2k[i]);l(2k[i]==F)14.n=14.D-1}}v 6.1y(14,{1N:14.n==14.D-1,1l:2j=="52"&&14.n%2==0||2j=="53"&&14.n%2||14[2j]==F,4j:14[14.n-1],3z:14[14.n+1]})},1X:q(2h,35){u 1J=[];I(u k=0;k<2h.D;k++)1J[k]=2h[k];I(u i=0;i<35.D;i++){u 48=T;I(u j=0;j<2h.D;j++)l(35[i]==2h[j])48=U;l(48)1J.1k(35[i])}v 1J},2O:q(14,C,4a){l(C.O==1C)C=1h 1v("a","i","v "+C);u 1J=[];I(u i=0;i<14.D;i++)l(!4a&&C(14[i],i)||4a&&!C(14[i],i))1J.1k(14[i]);v 1J},2r:q(14,C){l(C.O==1C)C=1h 1v("a","v "+C);u 1J=[];I(u i=0;i<14.D;i++){u 1D=C(14[i],i);l(1D!==M&&1D!=Q){l(1D.O!=2z)1D=[1D];1J=6.1X(1J,1D)}}v 1J},J:{2g:q(P,B,1H){l(6.11.1p&&P.42!=Q)P=1z;l(!1H.2q)1H.2q=7.2q++;l(!P.1E)P.1E={};u 2W=P.1E[B];l(!2W){2W=P.1E[B]={};l(P["2N"+B])2W[0]=P["2N"+B]}2W[1H.2q]=1H;P["2N"+B]=7.58;l(!7.1e[B])7.1e[B]=[];7.1e[B].1k(P)},2q:1,1e:{},25:q(P,B,1H){l(P.1E)l(B&&P.1E[B])l(1H)57 P.1E[B][1H.2q];G I(u i 1r P.1E[B])57 P.1E[B][i];G I(u j 1r P.1E)7.25(P,j)},1P:q(B,K,P){K=K||[];l(!P){u g=7.1e[B];l(g)I(u i=0;i<g.D;i++)7.1P(B,K,g[i])}G l(P["2N"+B]){K.59(7.2m({B:B,2G:P}));P["2N"+B].16(P,K)}},58:q(J){l(1T 6=="Q")v U;J=J||6.J.2m(1z.J);l(!J)v U;u 3m=T;u c=7.1E[J.B];u 1g=[].7h.3O(19,1);1g.59(J);I(u j 1r c){l(c[j].16(7,1g)===U){J.4p();J.5a();3m=U}}v 3m},2m:q(J){l(6.11.1p){J=1z.J;J.2G=J.7i}G l(6.11.2M&&J.2G.1R==3){J=6.1y({},J);J.2G=J.2G.1i}J.4p=q(){7.3m=U};J.5a=q(){7.7l=T};v J}}});1h q(){u b=5I.5K.4d();6.11={2M:/5e/.28(b),30:/30/.28(b),1p:/1p/.28(b)&&!/30/.28(b),2I:/2I/.28(b)&&!/(7m|5e)/.28(b)};6.7n=!6.11.1p||17.7o=="7p"};6.2e={2o:{4H:"5g",7q:"5h",2Y:"5i",7r:"5j"},1f:"2c,1G,7s,5l,2H,3p,3h,7t,7u".3b(","),1c:["5n","5o","5X","5p"],1t:{1D:"Y",38:"2V",3H:M,7x:M,1d:M,7z:M,3w:M,7A:M},5r:{5s:"a.1i",7B:6.3L,3L:6.3L,3z:"6.1x(a).3z",4j:"6.1x(a).4j",2k:"6.1x(a, M, T)",7C:"6.1x(a.2a)"},W:{5u:q(1L){7.7E(1L)},1A:q(){7.1a.1u=7.2A?7.2A:"";l(6.1f(7,"1u")=="20")7.1a.1u="2F"},1s:q(){7.2A=7.2A||6.1f(7,"1u");l(7.2A=="20")7.2A="2F";7.1a.1u="20"},4o:q(){6(7)[6(7).4E(":1S")?"1A":"1s"].16(6(7),19)},7F:q(c){6.1j.2g(7,c)},7G:q(c){6.1j.25(7,c)},7H:q(c){6.1j[6.1j.3t(7,c)?"25":"2g"](7,c)},25:q(a){l(!a||6.1c(a,[7]).r)7.1i.3s(7)},5B:q(){24(7.2a)7.3s(7.2a)},2Z:q(B,C){l(C.O==1C)C=1h 1v("e",(!C.1b(".")?"6(7)":"v ")+C);6.J.2g(7,B,C)},4C:q(B,C){6.J.25(7,B,C)},1P:q(B,K){6.J.1P(B,K,7)}}};6.5C();6.C.1y({5E:6.C.4o,4o:q(a,b){v a&&b&&a.O==1v&&b.O==1v?7.5M(q(e){7.1N=7.1N==a?b:a;e.4p();v 7.1N.16(7,[e])||U}):7.5E.16(7,19)},7K:q(f,g){q 4r(e){u p=(e.B=="3C"?e.7M:e.7N)||e.7O;24(p&&p!=7)3u{p=p.1i}3o(e){p=7};l(p==7)v U;v(e.B=="3C"?f:g).16(7,[e])}v 7.3C(4r).5Q(4r)},1W:q(f){l(6.3y)f.16(17);G{6.2C.1k(f)}v 7}});6.1y({3y:U,2C:[],1W:q(){l(!6.3y){6.3y=T;l(6.2C){I(u i=0;i<6.2C.D;i++)6.2C[i].16(17);6.2C=M}l(6.11.2I||6.11.30)17.7P("5T",6.1W,U)}}});1h q(){u e=("7R,7S,2S,7T,7U,4z,5M,7V,"+"7X,7Y,81,3C,5Q,83,4w,3c,"+"4x,86,87,88,2l").3b(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v f?7.2Z(o,f):7.1P(o)};6.C["89"+o]=q(f){v 7.4C(o,f)};6.C["8a"+o]=q(f){u P=6(7);u 1H=q(){P.4C(o,1H);P=M;f.16(7,19)};v 7.2Z(o,1H)}};l(6.11.2I||6.11.30){17.8c("5T",6.1W,U)}G l(6.11.1p){17.8d("<8e"+"8f 3H=5W 8n=T "+"3w=//:><\\/27>");u 27=17.5V("5W");27.2w=q(){l(7.3n!="1I")v;7.1i.3s(7);6.1W()};27=M}G l(6.11.2M){6.3N=42(q(){l(17.3n=="63"||17.3n=="1I"){56(6.3N);6.3N=M;6.1W()}},10)}6.J.2g(1z,"2S",6.1W)};l(6.11.1p)6(1z).4z(q(){u J=6.J,1e=J.1e;I(u B 1r 1e){u 3P=1e[B],i=3P.D;l(i>0)6a l(B!=\'4z\')J.25(3P[i-1],B);24(--i)}});6.C.1y({60:6.C.1A,1A:q(12,H){v 12?7.1U({1G:"1A",2c:"1A",1m:"1A"},12,H):7.60()},5U:6.C.1s,1s:q(12,H){v 12?7.1U({1G:"1s",2c:"1s",1m:"1s"},12,H):7.5U()},6n:q(12,H){v 7.1U({1G:"1A"},12,H)},6o:q(12,H){v 7.1U({1G:"1s"},12,H)},6p:q(12,H){v 7.W(q(){u 4J=6(7).4E(":1S")?"1A":"1s";6(7).1U({1G:4J},12,H)})},6r:q(12,H){v 7.1U({1m:"1A"},12,H)},6s:q(12,H){v 7.1U({1m:"1s"},12,H)},6t:q(12,2o,H){v 7.1U({1m:2o},12,H)},1U:q(E,12,H){v 7.1w(q(){7.2U=6.1y({},E);I(u p 1r E){u e=1h 6.2R(7,6.12(12,H),p);l(E[p].O==4O)e.3e(e.1l(),E[p]);G e[E[p]](E)}})},1w:q(B,C){l(!C){C=B;B="2R"}v 7.W(q(){l(!7.1w)7.1w={};l(!7.1w[B])7.1w[B]=[];7.1w[B].1k(C);l(7.1w[B].D==1)C.16(7)})}});6.1y({5f:q(e,p){l(e.5F)v;l(p=="1G"&&e.4L!=3l(6.26(e,p)))v;l(p=="2c"&&e.4M!=3l(6.26(e,p)))v;u a=e.1a[p];u o=6.26(e,p,1);l(p=="1G"&&e.4L!=o||p=="2c"&&e.4M!=o)v;e.1a[p]=e.34?"":"5H";u n=6.26(e,p,1);l(o!=n&&n!="5H"){e.1a[p]=a;e.5F=T}},12:q(s,o){o=o||{};l(o.O==1v)o={1I:o};u 5D={6G:6H,6J:4K};o.2E=(s&&s.O==4O?s:5D[s])||5k;o.3J=o.1I;o.1I=q(){6.4R(7,"2R");l(o.3J&&o.3J.O==1v)o.3J.16(7)};v o},1w:{},4R:q(F,B){B=B||"2R";l(F.1w&&F.1w[B]){F.1w[B].4h();u f=F.1w[B][0];l(f)f.16(F)}},2R:q(F,2x,E){u z=7;z.o={2E:2x.2E||5k,1I:2x.1I,2s:2x.2s};z.V=F;u y=z.V.1a;z.a=q(){l(2x.2s)2x.2s.16(F,[z.2i]);l(E=="1m")6.1t(y,"1m",z.2i);G l(3l(z.2i))y[E]=3l(z.2i)+"5d";y.1u="2F"};z.61=q(){v 4c(6.1f(z.V,E))};z.1l=q(){u r=4c(6.26(z.V,E));v r&&r>-6Z?r:z.61()};z.3e=q(41,2o){z.3M=(1h 54()).55();z.2i=41;z.a();z.49=42(q(){z.2s(41,2o)},13)};z.1A=q(){l(!z.V.1Q)z.V.1Q={};z.V.1Q[E]=7.1l();z.3e(0,z.V.1Q[E]);l(E!="1m")y[E]="77"};z.1s=q(){l(!z.V.1Q)z.V.1Q={};z.V.1Q[E]=7.1l();z.o.1s=T;z.3e(z.V.1Q[E],0)};l(!z.V.4b)z.V.4b=6.1f(z.V,"3h");y.3h="1S";z.2s=q(4B,4g){u t=(1h 54()).55();l(t>z.o.2E+z.3M){56(z.49);z.49=M;z.2i=4g;z.a();z.V.2U[E]=T;u 1K=T;I(u i 1r z.V.2U)l(z.V.2U[i]!==T)1K=U;l(1K){y.3h=z.V.4b;l(z.o.1s)y.1u=\'20\';l(z.o.1s){I(u p 1r z.V.2U){l(p=="1m")6.1t(y,p,z.V.1Q[p]);G y[p]=z.V.1Q[p]+"5d";l(p==\'1G\'||p==\'2c\')6.5f(z.V,p)}}}l(1K&&z.o.1I&&z.o.1I.O==1v)z.o.1I.16(z.V)}G{u p=(t-7.3M)/z.o.2E;z.2i=((-5q.7w(p*5q.7y)/2)+0.5)*(4g-4B)+4B;z.a()}}}});6.C.1y({7D:q(N,1O,H){7.2S(N,1O,H,1)},2S:q(N,1O,H,1F){l(N.O==1v)v 7.2Z("2S",N);H=H||q(){};u B="3T";l(1O){l(1O.O==1v){H=1O;1O=M}G{1O=6.2Q(1O);B="4W"}}u 4m=7;6.3I(B,N,1O,q(3v,18){l(18=="2D"||!1F&&18=="5m"){4m.38(3v.3G).3X().W(H,[3v.3G,18])}G H.16(4m,[3v.3G,18])},1F);v 7},7J:q(){v 6.2Q(7)},3X:q(){v 7.1V(\'27\').W(q(){l(7.3w)6.5Y(7.3w,q(){});G 3A.3O(1z,7.2B||7.7L||7.2V||"")}).4q()}});l(6.11.1p&&1T 3i=="Q")3i=q(){v 1h 7Q(5I.5K.1b("7W 5")>=0?"82.5R":"84.5R")};1h q(){u e="5O,5G,5A,5x,5t".3b(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v 7.2Z(o,f)}}};6.1y({1n:q(N,K,H,B,1F){l(K&&K.O==1v){B=H;H=K;K=M}l(K)N+=((N.1b("?")>-1)?"&":"?")+6.2Q(K);6.3I("3T",N,M,q(r,18){l(H)H(6.3r(r,B),18)},1F)},8h:q(N,K,H,B){6.1n(N,K,H,B,1)},5Y:q(N,H){l(H)6.1n(N,M,H,"27");G{6.1n(N,M,M,"27")}},64:q(N,K,H){l(H)6.1n(N,K,H,"3S");G{6.1n(N,K,"3S")}},8o:q(N,K,H,B){6.3I("4W",N,6.2Q(K),q(r,18){l(H)H(6.3r(r,B),18)})},1q:0,6h:q(1q){6.1q=1q},39:{},3I:q(B,N,K,L,1F){u 1e=T;u 1q=6.1q;l(!N){L=B.1I;u 2D=B.2D;u 2l=B.2l;u 4k=B.4k;u 1e=1T B.1e=="6q"?B.1e:T;u 1q=1T B.1q=="6u"?B.1q:6.1q;1F=B.1F||U;K=B.K;N=B.N;B=B.B}l(1e&&!6.4v++)6.J.1P("5O");u 4y=U;u R=1h 3i();R.6B(B||"3T",N,T);l(K)R.3j("6I-6K","6M/x-6N-6Q-6T");l(1F)R.3j("6V-3Y-6Y",6.39[N]||"71, 74 75 78 46:46:46 79");R.3j("X-7a-7d","3i");l(R.7g)R.3j("7j","7k");u 2w=q(4F){l(R&&(R.3n==4||4F=="1q")){4y=T;u 18=6.4G(R)&&4F!="1q"?1F&&6.4N(R,N)?"5m":"2D":"2l";l(18!="2l"){u 3q;3u{3q=R.4i("4P-3Y")}3o(e){}l(1F&&3q)6.39[N]=3q;l(2D)2D(6.3r(R,4k),18);l(1e)6.J.1P("5t")}G{l(2l)2l(R,18);l(1e)6.J.1P("5x")}l(1e)6.J.1P("5A");l(1e&&!--6.4v)6.J.1P("5G");l(L)L(R,18);R.2w=q(){};R=M}};R.2w=2w;l(1q>0)7Z(q(){l(R){R.85();l(!4y)2w("1q");R=M}},1q);R.8i(K)},4v:0,4G:q(r){3u{v!r.18&&66.6d=="3Q:"||(r.18>=4K&&r.18<6y)||r.18==5b||6.11.2M&&r.18==Q}3o(e){}v U},4N:q(R,N){3u{u 4V=R.4i("4P-3Y");v R.18==5b||4V==6.39[N]||6.11.2M&&R.18==Q}3o(e){}v U},3r:q(r,B){u 4n=r.4i("7I-B");u K=!B&&4n&&4n.1b("R")>=0;K=B=="R"||K?r.80:r.3G;l(B=="27")3A.3O(1z,K);l(B=="3S")3A("K = "+K);l(B=="38")$("<21>").38(K).3X();v K},2Q:q(a){u s=[];l(a.O==2z||a.3E){I(u i=0;i<a.D;i++)s.1k(a[i].1d+"="+50(a[i].Y))}G{I(u j 1r a)s.1k(j+"="+50(a[j]))}v s.5Z("&")}})}',62,521,'||||||jQuery|this||||||||||||||if|||||function||||var|return||||||type|fn|length|prop|elem|else|callback|for|event|data|ret|null|url|constructor|element|undefined|xml||true|false|el|each||value|||browser|speed||elems|obj|apply|document|status|arguments|style|indexOf|filter|name|global|css|args|new|parentNode|className|push|cur|opacity|get|context|msie|timeout|in|hide|attr|display|Function|queue|sibling|extend|window|show|replace|String|val|events|ifModified|height|handler|complete|result|done|key|arg|last|params|trigger|orig|nodeType|hidden|typeof|animate|find|ready|merge|wrap|old|none|div|table|num|while|remove|curCSS|script|test|tbody|firstChild|toUpperCase|width|fn2|macros|childNodes|add|first|now|pos|siblings|error|fix|pushStack|to|nodeName|guid|map|step|not|expr|re|onreadystatechange|options|cssFloat|Array|oldblock|text|readyList|success|duration|block|target|position|mozilla|checked|trim|classes|safari|on|grep|disabled|param|fx|load|domManip|curAnim|innerHTML|handlers|dir|insertBefore|bind|opera|parPos|substr|stack|currentStyle|second|foundToken|styleFloat|html|lastModified|getAttribute|split|select|exec|custom|cloneNode|defaultView|overflow|XMLHttpRequest|setRequestHeader|alpha|parseInt|returnValue|readyState|catch|float|modRes|httpData|removeChild|has|try|res|src|child|isReady|next|eval|token|mouseover|clean|jquery|oWidth|responseText|id|ajax|oldComplete|oHeight|parents|startTime|safariTimer|call|els|file|static|json|GET|visibility|selected|radio|evalScripts|Modified|re2|getAll|from|setInterval|RegExp|_|break|00|matched|noCollision|timer|inv|oldOverflow|parseFloat|toLowerCase|appendChild|clone|lastNum|shift|getResponseHeader|prev|dataType|oid|self|ct|toggle|preventDefault|end|handleHover|button|tr|getComputedStyle|active|reset|submit|requestDone|unload|swap|firstNum|unbind|deep|is|istimeout|httpSuccess|appendTo|force|state|200|scrollHeight|scrollWidth|httpNotModified|Number|Last|documentElement|dequeue|getElementsByTagName|match|100|xmlRes|POST|parse|z0|nodeValue|encodeURIComponent|continue|even|odd|Date|getTime|clearInterval|delete|handle|unshift|stopPropagation|304|gi|px|webkit|setAuto|append|prepend|before|after|400|left|notmodified|eq|lt|contains|Math|axis|parent|ajaxSuccess|removeAttr|password|image|ajaxError|checkbox|input|ajaxComplete|empty|init|ss|_toggle|notAuto|ajaxStop|auto|navigator|size|userAgent|nth|click|createElement|ajaxStart|getPropertyValue|mouseout|XMLHTTP|newProp|DOMContentLoaded|_hide|getElementById|__ie_init|gt|getScript|join|_show|max|THEAD|loaded|getJSON|initDone|location|splice|Top|Right|do|padding|border|protocol|Width|offsetHeight|offsetWidth|ajaxTimeout|absolute|right|relative|clientHeight|clientWidth|slideDown|slideUp|slideToggle|boolean|fadeIn|fadeOut|fadeTo|number|opt|thead|td|300|th|createTextNode|open|toString|only|visible|enabled|slow|600|Content|fast|Type|textarea|application|www|Bottom|class|form|readonly|readOnly|urlencoded|zoom|If|9999|FORM|Since|10000|getAttributeNode|Thu|setAttribute|ig|01|Jan|9_|1px|1970|GMT|Requested|tagName|Left|With|method|action|overrideMimeType|slice|srcElement|Connection|close|cancelBubble|compatible|boxModel|compatMode|CSS1Compat|prependTo|insertAfter|top|color|background|htmlFor|cos|title|PI|href|rel|ancestors|children|loadIfModified|removeAttribute|addClass|removeClass|toggleClass|content|serialize|hover|textContent|fromElement|toElement|relatedTarget|removeEventListener|ActiveXObject|blur|focus|resize|scroll|dblclick|MSIE|mousedown|mouseup|setTimeout|responseXML|mousemove|Microsoft|change|Msxml2|abort|keydown|keypress|keyup|un|one|prototype|addEventListener|write|scr|ipt|index|getIfModified|send|nextSibling|pop|Boolean|TABLE|defer|post'.split('|'),0,{}))
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-blue.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-blue.css
new file mode 100644 (file)
index 0000000..ca33cde
--- /dev/null
@@ -0,0 +1,232 @@
+/* The main calendar widget.  DIV containing a table. */
+
+div.calendar { position: relative; }
+
+.calendar, .calendar table {
+  border: 1px solid #556;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #eef;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;    /* They are the navigation buttons */
+  padding: 2px;          /* Make the buttons seem like they're pressing */
+}
+
+.calendar .nav {
+  background: #778 url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;      /* Pressing it will take you to the current date */
+  text-align: center;
+  background: #fff;
+  color: #000;
+  padding: 2px;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+  background: #778;
+  color: #fff;
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+  background: #bdf;
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #556;
+  padding: 2px;
+  text-align: center;
+  color: #000;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #a66;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  background-color: #aaf;
+  color: #000;
+  border: 1px solid #04f;
+  padding: 1px;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  background-color: #77c;
+  padding: 2px 0px 0px 2px;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  color: #456;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #bbb;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #fbb;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #bdf;
+}
+
+.calendar tbody .rowhilite td {
+  background: #def;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #eef;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  background: #def;
+  padding: 1px 3px 1px 1px;
+  border: 1px solid #bbb;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  background: #cde;
+  padding: 2px 2px 0px 2px;
+}
+
+.calendar tbody td.selected { /* Cell showing today date */
+  font-weight: bold;
+  border: 1px solid #000;
+  padding: 1px 3px 1px 1px;
+  background: #fff;
+  color: #000;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #a66;
+}
+
+.calendar tbody td.today { /* Cell showing selected date */
+  font-weight: bold;
+  color: #00f;
+}
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+  text-align: center;
+  background: #556;
+  color: #fff;
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  background: #fff;
+  color: #445;
+  border-top: 1px solid #556;
+  padding: 1px;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  background: #aaf;
+  border: 1px solid #04f;
+  color: #000;
+  padding: 1px;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  background: #77c;
+  padding: 2px 0px 0px 2px;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  top: 0px;
+  left: 0px;
+  width: 4em;
+  cursor: default;
+  border: 1px solid #655;
+  background: #def;
+  color: #000;
+  font-size: 90%;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .hilite {
+  background: #acf;
+}
+
+.calendar .combo .active {
+  border-top: 1px solid #46a;
+  border-bottom: 1px solid #46a;
+  background: #eef;
+  font-weight: bold;
+}
+
+.calendar td.time {
+  border-top: 1px solid #000;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #f4f0e8;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #889;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #667;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-blue2.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-blue2.css
new file mode 100644 (file)
index 0000000..47128ec
--- /dev/null
@@ -0,0 +1,236 @@
+/* The main calendar widget.  DIV containing a table. */
+
+div.calendar { position: relative; }
+
+.calendar, .calendar table {
+  border: 1px solid #206A9B;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #F1F8FC;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;    /* They are the navigation buttons */
+  padding: 2px;          /* Make the buttons seem like they're pressing */
+}
+
+.calendar .nav {
+  background: #007ED1 url(menuarrow2.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;      /* Pressing it will take you to the current date */
+  text-align: center;
+  background: #000;
+  color: #fff;
+  padding: 2px;
+}
+
+.calendar thead tr { /* Row <TR> containing navigation buttons */
+  background: #007ED1;
+  color: #fff;
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+  background: #C7E1F3;
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #206A9B;
+  padding: 2px;
+  text-align: center;
+  color: #000;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #a66;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  background-color: #34ABFA;
+  color: #000;
+  border: 1px solid #016DC5;
+  padding: 1px;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  background-color: #006AA9;
+  border: 1px solid #008AFF;
+  padding: 2px 0px 0px 2px;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  color: #456;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #bbb;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #fbb;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #C7E1F3;
+}
+
+.calendar tbody .rowhilite td {
+  background: #def;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #F1F8FC;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  background: #def;
+  padding: 1px 3px 1px 1px;
+  border: 1px solid #8FC4E8;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  background: #cde;
+  padding: 2px 2px 0px 2px;
+}
+
+.calendar tbody td.selected { /* Cell showing today date */
+  font-weight: bold;
+  border: 1px solid #000;
+  padding: 1px 3px 1px 1px;
+  background: #fff;
+  color: #000;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #a66;
+}
+
+.calendar tbody td.today { /* Cell showing selected date */
+  font-weight: bold;
+  color: #D50000;
+}
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+  text-align: center;
+  background: #206A9B;
+  color: #fff;
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  background: #000;
+  color: #fff;
+  border-top: 1px solid #206A9B;
+  padding: 1px;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  background: #B8DAF0;
+  border: 1px solid #178AEB;
+  color: #000;
+  padding: 1px;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  background: #006AA9;
+  padding: 2px 0px 0px 2px;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  top: 0px;
+  left: 0px;
+  width: 4em;
+  cursor: default;
+  border: 1px solid #655;
+  background: #def;
+  color: #000;
+  font-size: 90%;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .hilite {
+  background: #34ABFA;
+  border-top: 1px solid #46a;
+  border-bottom: 1px solid #46a;
+  font-weight: bold;
+}
+
+.calendar .combo .active {
+  border-top: 1px solid #46a;
+  border-bottom: 1px solid #46a;
+  background: #F1F8FC;
+  font-weight: bold;
+}
+
+.calendar td.time {
+  border-top: 1px solid #000;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #E3F0F9;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #889;
+  font-weight: bold;
+  background-color: #F1F8FC;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #267DB7;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: red;
+  background-color: #000;
+  color: #A5FF00;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-brown.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-brown.css
new file mode 100644 (file)
index 0000000..c42da5e
--- /dev/null
@@ -0,0 +1,225 @@
+/* The main calendar widget.  DIV containing a table. */
+
+div.calendar { position: relative; }
+
+.calendar, .calendar table {
+  border: 1px solid #655;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #ffd;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;    /* They are the navigation buttons */
+  padding: 2px;          /* Make the buttons seem like they're pressing */
+}
+
+.calendar .nav {
+  background: #edc url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;      /* Pressing it will take you to the current date */
+  text-align: center;
+  background: #654;
+  color: #fed;
+  padding: 2px;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+  background: #edc;
+  color: #000;
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #655;
+  padding: 2px;
+  text-align: center;
+  color: #000;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  background-color: #faa;
+  color: #000;
+  border: 1px solid #f40;
+  padding: 1px;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  background-color: #c77;
+  padding: 2px 0px 0px 2px;
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+  background: #fed;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #bbb;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #fbb;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #fed;
+}
+
+.calendar tbody .rowhilite td {
+  background: #ddf;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #efe;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  background: #ffe;
+  padding: 1px 3px 1px 1px;
+  border: 1px solid #bbb;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  background: #ddc;
+  padding: 2px 2px 0px 2px;
+}
+
+.calendar tbody td.selected { /* Cell showing today date */
+  font-weight: bold;
+  border: 1px solid #000;
+  padding: 1px 3px 1px 1px;
+  background: #fea;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #f00;
+}
+
+.calendar tbody td.today { font-weight: bold; }
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+  text-align: center;
+  background: #988;
+  color: #000;
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  border-top: 1px solid #655;
+  background: #dcb;
+  color: #840;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  background: #faa;
+  border: 1px solid #f40;
+  padding: 1px;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  background: #c77;
+  padding: 2px 0px 0px 2px;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  top: 0px;
+  left: 0px;
+  width: 4em;
+  cursor: default;
+  border: 1px solid #655;
+  background: #ffe;
+  color: #000;
+  font-size: 90%;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .hilite {
+  background: #fc8;
+}
+
+.calendar .combo .active {
+  border-top: 1px solid #a64;
+  border-bottom: 1px solid #a64;
+  background: #fee;
+  font-weight: bold;
+}
+
+.calendar td.time {
+  border-top: 1px solid #a88;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #fed;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #988;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #866;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-green.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-green.css
new file mode 100644 (file)
index 0000000..2e1867a
--- /dev/null
@@ -0,0 +1,229 @@
+/* The main calendar widget.  DIV containing a table. */
+
+div.calendar { position: relative; }
+
+.calendar, .calendar table {
+  border: 1px solid #565;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #efe;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;    /* They are the navigation buttons */
+  padding: 2px;          /* Make the buttons seem like they're pressing */
+  background: #676;
+  color: #fff;
+  font-size: 90%;
+}
+
+.calendar .nav {
+  background: #676 url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;      /* Pressing it will take you to the current date */
+  text-align: center;
+  padding: 2px;
+  background: #250;
+  color: #efa;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #565;
+  padding: 2px;
+  text-align: center;
+  color: #000;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #a66;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  background-color: #afa;
+  color: #000;
+  border: 1px solid #084;
+  padding: 1px;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  background-color: #7c7;
+  padding: 2px 0px 0px 2px;
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+  background: #dfb;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  color: #564;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #bbb;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #fbb;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #8a8;
+  background: #dfb;
+}
+
+.calendar tbody .rowhilite td {
+  background: #dfd;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #efe;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  background: #efd;
+  padding: 1px 3px 1px 1px;
+  border: 1px solid #bbb;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  background: #dec;
+  padding: 2px 2px 0px 2px;
+}
+
+.calendar tbody td.selected { /* Cell showing today date */
+  font-weight: bold;
+  border: 1px solid #000;
+  padding: 1px 3px 1px 1px;
+  background: #f8fff8;
+  color: #000;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #a66;
+}
+
+.calendar tbody td.today { font-weight: bold; color: #0a0; }
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+  text-align: center;
+  background: #565;
+  color: #fff;
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  padding: 2px;
+  background: #250;
+  color: #efa;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  background: #afa;
+  border: 1px solid #084;
+  color: #000;
+  padding: 1px;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  background: #7c7;
+  padding: 2px 0px 0px 2px;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  top: 0px;
+  left: 0px;
+  width: 4em;
+  cursor: default;
+  border: 1px solid #565;
+  background: #efd;
+  color: #000;
+  font-size: 90%;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .hilite {
+  background: #af8;
+}
+
+.calendar .combo .active {
+  border-top: 1px solid #6a4;
+  border-bottom: 1px solid #6a4;
+  background: #efe;
+  font-weight: bold;
+}
+
+.calendar td.time {
+  border-top: 1px solid #8a8;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #dfb;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #898;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #686;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-setup.js b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-setup.js
new file mode 100644 (file)
index 0000000..f2b4854
--- /dev/null
@@ -0,0 +1,200 @@
+/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
+ * ---------------------------------------------------------------------------
+ *
+ * The DHTML Calendar
+ *
+ * Details and latest version at:
+ * http://dynarch.com/mishoo/calendar.epl
+ *
+ * This script is distributed under the GNU Lesser General Public License.
+ * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
+ *
+ * This file defines helper functions for setting up the calendar.  They are
+ * intended to help non-programmers get a working calendar on their site
+ * quickly.  This script should not be seen as part of the calendar.  It just
+ * shows you what one can do with the calendar, while in the same time
+ * providing a quick and simple method for setting it up.  If you need
+ * exhaustive customization of the calendar creation process feel free to
+ * modify this code to suit your needs (this is recommended and much better
+ * than modifying calendar.js itself).
+ */
+
+// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $
+
+/**
+ *  This function "patches" an input field (or other element) to use a calendar
+ *  widget for date selection.
+ *
+ *  The "params" is a single object that can have the following properties:
+ *
+ *    prop. name   | description
+ *  -------------------------------------------------------------------------------------------------
+ *   inputField    | the ID of an input field to store the date
+ *   displayArea   | the ID of a DIV or other element to show the date
+ *   button        | ID of a button or other element that will trigger the calendar
+ *   eventName     | event that will trigger the calendar, without the "on" prefix (default: "click")
+ *   ifFormat      | date format that will be stored in the input field
+ *   daFormat      | the date format that will be used to display the date in displayArea
+ *   singleClick   | (true/false) wether the calendar is in single click mode or not (default: true)
+ *   firstDay      | numeric: 0 to 6.  "0" means display Sunday first, "1" means display Monday first, etc.
+ *   align         | alignment (default: "Br"); if you don't know what's this see the calendar documentation
+ *   range         | array with 2 elements.  Default: [1900, 2999] -- the range of years available
+ *   weekNumbers   | (true/false) if it's true (default) the calendar will display week numbers
+ *   flat          | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID
+ *   flatCallback  | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar)
+ *   disableFunc   | function that receives a JS Date object and should return true if that date has to be disabled in the calendar
+ *   onSelect      | function that gets called when a date is selected.  You don't _have_ to supply this (the default is generally okay)
+ *   onClose       | function that gets called when the calendar is closed.  [default]
+ *   onUpdate      | function that gets called after the date is updated in the input field.  Receives a reference to the calendar.
+ *   date          | the date that the calendar will be initially displayed to
+ *   showsTime     | default: false; if true the calendar will include a time selector
+ *   timeFormat    | the time format; can be "12" or "24", default is "12"
+ *   electric      | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close
+ *   step          | configures the step of the years in drop-down boxes; default: 2
+ *   position      | configures the calendar absolute position; default: null
+ *   cache         | if "true" (but default: "false") it will reuse the same calendar object, where possible
+ *   showOthers    | if "true" (but default: "false") it will show days from other months too
+ *
+ *  None of them is required, they all have default values.  However, if you
+ *  pass none of "inputField", "displayArea" or "button" you'll get a warning
+ *  saying "nothing to setup".
+ */
+Calendar.setup = function (params) {
+       function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };
+
+       param_default("inputField",     null);
+       param_default("displayArea",    null);
+       param_default("button",         null);
+       param_default("eventName",      "click");
+       param_default("ifFormat",       "%Y/%m/%d");
+       param_default("daFormat",       "%Y/%m/%d");
+       param_default("singleClick",    true);
+       param_default("disableFunc",    null);
+       param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined
+       param_default("dateText",       null);
+       param_default("firstDay",       null);
+       param_default("align",          "Br");
+       param_default("range",          [1900, 2999]);
+       param_default("weekNumbers",    true);
+       param_default("flat",           null);
+       param_default("flatCallback",   null);
+       param_default("onSelect",       null);
+       param_default("onClose",        null);
+       param_default("onUpdate",       null);
+       param_default("date",           null);
+       param_default("showsTime",      false);
+       param_default("timeFormat",     "24");
+       param_default("electric",       true);
+       param_default("step",           2);
+       param_default("position",       null);
+       param_default("cache",          false);
+       param_default("showOthers",     false);
+       param_default("multiple",       null);
+
+       var tmp = ["inputField", "displayArea", "button"];
+       for (var i in tmp) {
+               if (typeof params[tmp[i]] == "string") {
+                       params[tmp[i]] = document.getElementById(params[tmp[i]]);
+               }
+       }
+       if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) {
+               alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");
+               return false;
+       }
+
+       function onSelect(cal) {
+               var p = cal.params;
+               var update = (cal.dateClicked || p.electric);
+               if (update && p.inputField) {
+                       p.inputField.value = cal.date.print(p.ifFormat);
+                       if (typeof p.inputField.onchange == "function")
+                               p.inputField.onchange();
+               }
+               if (update && p.displayArea)
+                       p.displayArea.innerHTML = cal.date.print(p.daFormat);
+               if (update && typeof p.onUpdate == "function")
+                       p.onUpdate(cal);
+               if (update && p.flat) {
+                       if (typeof p.flatCallback == "function")
+                               p.flatCallback(cal);
+               }
+               if (update && p.singleClick && cal.dateClicked)
+                       cal.callCloseHandler();
+       };
+
+       if (params.flat != null) {
+               if (typeof params.flat == "string")
+                       params.flat = document.getElementById(params.flat);
+               if (!params.flat) {
+                       alert("Calendar.setup:\n  Flat specified but can't find parent.");
+                       return false;
+               }
+               var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect);
+               cal.showsOtherMonths = params.showOthers;
+               cal.showsTime = params.showsTime;
+               cal.time24 = (params.timeFormat == "24");
+               cal.params = params;
+               cal.weekNumbers = params.weekNumbers;
+               cal.setRange(params.range[0], params.range[1]);
+               cal.setDateStatusHandler(params.dateStatusFunc);
+               cal.getDateText = params.dateText;
+               if (params.ifFormat) {
+                       cal.setDateFormat(params.ifFormat);
+               }
+               if (params.inputField && typeof params.inputField.value == "string") {
+                       cal.parseDate(params.inputField.value);
+               }
+               cal.create(params.flat);
+               cal.show();
+               return false;
+       }
+
+       var triggerEl = params.button || params.displayArea || params.inputField;
+       triggerEl["on" + params.eventName] = function() {
+               var dateEl = params.inputField || params.displayArea;
+               var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
+               var mustCreate = false;
+               var cal = window.calendar;
+               if (dateEl)
+                       params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt);
+               if (!(cal && params.cache)) {
+                       window.calendar = cal = new Calendar(params.firstDay,
+                                                            params.date,
+                                                            params.onSelect || onSelect,
+                                                            params.onClose || function(cal) { cal.hide(); });
+                       cal.showsTime = params.showsTime;
+                       cal.time24 = (params.timeFormat == "24");
+                       cal.weekNumbers = params.weekNumbers;
+                       mustCreate = true;
+               } else {
+                       if (params.date)
+                               cal.setDate(params.date);
+                       cal.hide();
+               }
+               if (params.multiple) {
+                       cal.multiple = {};
+                       for (var i = params.multiple.length; --i >= 0;) {
+                               var d = params.multiple[i];
+                               var ds = d.print("%Y%m%d");
+                               cal.multiple[ds] = d;
+                       }
+               }
+               cal.showsOtherMonths = params.showOthers;
+               cal.yearStep = params.step;
+               cal.setRange(params.range[0], params.range[1]);
+               cal.params = params;
+               cal.setDateStatusHandler(params.dateStatusFunc);
+               cal.getDateText = params.dateText;
+               cal.setDateFormat(dateFmt);
+               if (mustCreate)
+                       cal.create();
+               cal.refresh();
+               if (!params.position)
+                       cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
+               else
+                       cal.showAt(params.position[0], params.position[1]);
+               return false;
+       };
+
+       return cal;
+};
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-setup_stripped.js b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-setup_stripped.js
new file mode 100644 (file)
index 0000000..91c927f
--- /dev/null
@@ -0,0 +1,21 @@
+/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
+ * ---------------------------------------------------------------------------
+ *
+ * The DHTML Calendar
+ *
+ * Details and latest version at:
+ * http://dynarch.com/mishoo/calendar.epl
+ *
+ * This script is distributed under the GNU Lesser General Public License.
+ * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
+ *
+ * This file defines helper functions for setting up the calendar.  They are
+ * intended to help non-programmers get a working calendar on their site
+ * quickly.  This script should not be seen as part of the calendar.  It just
+ * shows you what one can do with the calendar, while in the same time
+ * providing a quick and simple method for setting it up.  If you need
+ * exhaustive customization of the calendar creation process feel free to
+ * modify this code to suit your needs (this is recommended and much better
+ * than modifying calendar.js itself).
+ */
+ Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n  Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;};
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-system.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-system.css
new file mode 100644 (file)
index 0000000..b224885
--- /dev/null
@@ -0,0 +1,251 @@
+/* The main calendar widget.  DIV containing a table. */
+
+.calendar {
+  position: relative;
+  display: none;
+  border: 1px solid;
+  border-color: #fff #000 #000 #fff;
+  font-size: 11px;
+  cursor: default;
+  background: Window;
+  color: WindowText;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+.calendar table {
+  border: 1px solid;
+  border-color: #fff #000 #000 #fff;
+  font-size: 11px;
+  cursor: default;
+  background: Window;
+  color: WindowText;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;
+  padding: 1px;
+  border: 1px solid;
+  border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+  background: ButtonFace;
+}
+
+.calendar .nav {
+  background: ButtonFace url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;
+  padding: 1px;
+  border: 1px solid #000;
+  background: ActiveCaption;
+  color: CaptionText;
+  text-align: center;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid ButtonShadow;
+  padding: 2px;
+  text-align: center;
+  background: ButtonFace;
+  color: ButtonText;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  border: 2px solid;
+  padding: 0px;
+  border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  border-width: 1px;
+  padding: 2px 0px 0px 2px;
+  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #faa;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid ButtonShadow;
+  background: ButtonFace;
+  color: ButtonText;
+}
+
+.calendar tbody .rowhilite td {
+  background: Highlight;
+  color: HighlightText;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  padding: 1px 3px 1px 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  padding: 2px 2px 0px 2px;
+  border: 1px solid;
+  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+}
+
+.calendar tbody td.selected { /* Cell showing selected date */
+  font-weight: bold;
+  border: 1px solid;
+  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+  padding: 2px 2px 0px 2px;
+  background: ButtonFace;
+  color: ButtonText;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #f00;
+}
+
+.calendar tbody td.today { /* Cell showing today date */
+  font-weight: bold;
+  color: #00f;
+}
+
+.calendar tbody td.disabled { color: GrayText; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  background: ButtonFace;
+  padding: 1px;
+  border: 1px solid;
+  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+  color: ButtonText;
+  text-align: center;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  padding: 1px;
+  background: #e4e0d8;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  width: 4em;
+  top: 0px;
+  left: 0px;
+  cursor: default;
+  border: 1px solid;
+  border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+  background: Menu;
+  color: MenuText;
+  font-size: 90%;
+  padding: 1px;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .active {
+  padding: 0px;
+  border: 1px solid #000;
+}
+
+.calendar .combo .hilite {
+  background: Highlight;
+  color: HighlightText;
+}
+
+.calendar td.time {
+  border-top: 1px solid ButtonShadow;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: ButtonFace;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #889;
+  font-weight: bold;
+  background-color: Menu;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: Highlight;
+  color: HighlightText;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-tas.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-tas.css
new file mode 100644 (file)
index 0000000..c2f8721
--- /dev/null
@@ -0,0 +1,239 @@
+/* The main calendar widget.  DIV containing a table. */
+
+div.calendar { position: relative; }
+
+.calendar, .calendar table {
+  border: 1px solid #655;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #ffd;
+  font-family: tahoma,verdana,sans-serif;
+  filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF);
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;    /* They are the navigation buttons */
+  padding: 2px;          /* Make the buttons seem like they're pressing */
+  color:#363636;
+}
+
+.calendar .nav {
+  background: #edc url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;      /* Pressing it will take you to the current date */
+  text-align: center;
+  background: #654;
+  color: #363636;
+  padding: 2px;
+  filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#dddccc);
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+  /*background: #3B86A0;*/
+  color: #363636;
+  font-weight: bold;   
+filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#3b86a0);
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #655;
+  padding: 2px;
+  text-align: center;
+  color: #363636;
+    filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF);
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  background-color: #ffcc86;
+  color: #000;
+  border: 1px solid #b59345;
+  padding: 1px;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  background-color: #c77;
+  padding: 2px 0px 0px 2px;
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+  background: #fed;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #faa;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #fed;
+}
+
+.calendar tbody .rowhilite td {
+ background: #ddf;
+  
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #efe;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  background: #ffe;
+  padding: 1px 3px 1px 1px;
+  border: 1px solid #bbb;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  background: #ddc;
+  padding: 2px 2px 0px 2px;
+}
+
+.calendar tbody td.selected { /* Cell showing today date */
+  font-weight: bold;
+  border: 1px solid #000;
+  padding: 1px 3px 1px 1px;
+  background: #fea;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #f00;
+}
+
+.calendar tbody td.today { font-weight: bold; }
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+  text-align: center;
+  background: #988;
+  color: #000;
+  
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  border-top: 1px solid #655;
+  background: #dcb;
+  color: #363636;
+  font-weight: bold;
+       filter:
+progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#FFFFFF,EndColorStr=#DDDCCC);
+}
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  background: #faa;
+  border: 1px solid #f40;
+  padding: 1px;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  background: #c77;
+  padding: 2px 0px 0px 2px;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.combo {
+  position: absolute;
+  display: none;
+  top: 0px;
+  left: 0px;
+  width: 4em;
+  cursor: default;
+  border: 1px solid #655;
+  background: #ffe;
+  color: #000;
+  font-size: smaller;
+  z-index: 100;
+}
+
+.combo .label,
+.combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.combo .label-IEfix {
+  width: 4em;
+}
+
+.combo .hilite {
+  background: #fc8;
+}
+
+.combo .active {
+  border-top: 1px solid #a64;
+  border-bottom: 1px solid #a64;
+  background: #fee;
+  font-weight: bold;
+}
+
+.calendar td.time {
+  border-top: 1px solid #a88;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #fed;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #988;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #866;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-1.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-1.css
new file mode 100644 (file)
index 0000000..8c5d026
--- /dev/null
@@ -0,0 +1,271 @@
+/* The main calendar widget.  DIV containing a table. */
+
+.calendar {
+  position: relative;
+  display: none;
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #d4d0c8;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+.calendar table {
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #d4d0c8;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;
+  padding: 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar .nav {
+  background: transparent url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #848078;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #000;
+  padding: 2px;
+  text-align: center;
+  background: #f4f0e8;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  padding: 0px;
+  background-color: #e4e0d8;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  background-color: #c4c0b8;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #faa;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #f4f0e8;
+}
+
+.calendar tbody .rowhilite td {
+  background: #e4e0d8;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #d4d0c8;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  padding: 1px 3px 1px 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  padding: 2px 2px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+.calendar tbody td.selected { /* Cell showing selected date */
+  font-weight: bold;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  padding: 2px 2px 0px 2px;
+  background: #e4e0d8;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #f00;
+}
+
+.calendar tbody td.today { /* Cell showing today date */
+  font-weight: bold;
+  color: #00f;
+}
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  background: #f4f0e8;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #848078;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  padding: 1px;
+  background: #e4e0d8;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  width: 4em;
+  top: 0px;
+  left: 0px;
+  cursor: default;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  background: #e4e0d8;
+  font-size: 90%;
+  padding: 1px;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .active {
+  background: #c4c0b8;
+  padding: 0px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+.calendar .combo .hilite {
+  background: #048;
+  color: #fea;
+}
+
+.calendar td.time {
+  border-top: 1px solid #000;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #f4f0e8;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #889;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #766;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-2.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-2.css
new file mode 100644 (file)
index 0000000..6f37b7d
--- /dev/null
@@ -0,0 +1,271 @@
+/* The main calendar widget.  DIV containing a table. */
+
+.calendar {
+  position: relative;
+  display: none;
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #d4c8d0;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+.calendar table {
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #d4c8d0;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;
+  padding: 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar .nav {
+  background: transparent url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #847880;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #000;
+  padding: 2px;
+  text-align: center;
+  background: #f4e8f0;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  padding: 0px;
+  background-color: #e4d8e0;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  background-color: #c4b8c0;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #faa;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #f4e8f0;
+}
+
+.calendar tbody .rowhilite td {
+  background: #e4d8e0;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #d4c8d0;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  padding: 1px 3px 1px 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  padding: 2px 2px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+.calendar tbody td.selected { /* Cell showing selected date */
+  font-weight: bold;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  padding: 2px 2px 0px 2px;
+  background: #e4d8e0;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #f00;
+}
+
+.calendar tbody td.today { /* Cell showing today date */
+  font-weight: bold;
+  color: #00f;
+}
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  background: #f4e8f0;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #847880;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  padding: 1px;
+  background: #e4d8e0;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  width: 4em;
+  top: 0px;
+  left: 0px;
+  cursor: default;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  background: #e4d8e0;
+  font-size: 90%;
+  padding: 1px;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .active {
+  background: #d4c8d0;
+  padding: 0px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+.calendar .combo .hilite {
+  background: #408;
+  color: #fea;
+}
+
+.calendar td.time {
+  border-top: 1px solid #000;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #f4f0e8;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #889;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #766;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-cold-1.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-cold-1.css
new file mode 100644 (file)
index 0000000..fa5c093
--- /dev/null
@@ -0,0 +1,265 @@
+/* The main calendar widget.  DIV containing a table. */
+
+.calendar {
+  position: relative;
+  display: none;
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #c8d0d4;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+.calendar table {
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #c8d0d4;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;
+  padding: 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar .nav {
+  background: transparent url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #788084;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #000;
+  padding: 2px;
+  text-align: center;
+  background: #e8f0f4;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  padding: 0px;
+  background-color: #d8e0e4;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  background-color: #b8c0c4;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #faa;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #e8f4f0;
+}
+
+.calendar tbody .rowhilite td {
+  background: #d8e4e0;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #c8d4d0;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  padding: 1px 3px 1px 1px;
+  border: 1px solid;
+  border-color: #fff #000 #000 #fff;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  padding: 2px 2px 0px 2px;
+  border: 1px solid;
+  border-color: #000 #fff #fff #000;
+}
+
+.calendar tbody td.selected { /* Cell showing selected date */
+  font-weight: bold;
+  padding: 2px 2px 0px 2px;
+  border: 1px solid;
+  border-color: #000 #fff #fff #000;
+  background: #d8e0e4;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #f00;
+}
+
+.calendar tbody td.today { /* Cell showing today date */
+  font-weight: bold;
+  color: #00f;
+}
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  background: #e8f0f4;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #788084;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  padding: 1px;
+  background: #d8e0e4;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  width: 4em;
+  top: 0px;
+  left: 0px;
+  cursor: default;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  background: #d8e0e4;
+  font-size: 90%;
+  padding: 1px;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .active {
+  background: #c8d0d4;
+  padding: 0px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+.calendar .combo .hilite {
+  background: #048;
+  color: #aef;
+}
+
+.calendar td.time {
+  border-top: 1px solid #000;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #e8f0f4;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #889;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #667;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-cold-2.css b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar-win2k-cold-2.css
new file mode 100644 (file)
index 0000000..8e930c8
--- /dev/null
@@ -0,0 +1,271 @@
+/* The main calendar widget.  DIV containing a table. */
+
+.calendar {
+  position: relative;
+  display: none;
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #c8d4d0;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+.calendar table {
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  font-size: 11px;
+  color: #000;
+  cursor: default;
+  background: #c8d4d0;
+  font-family: tahoma,verdana,sans-serif;
+}
+
+/* Header part -- contains navigation buttons and day names. */
+
+.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
+  text-align: center;
+  padding: 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar .nav {
+  background: transparent url(menuarrow.gif) no-repeat 100% 100%;
+}
+
+.calendar thead .title { /* This holds the current "month, year" */
+  font-weight: bold;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #788480;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar thead .headrow { /* Row <TR> containing navigation buttons */
+}
+
+.calendar thead .daynames { /* Row <TR> containing the day names */
+}
+
+.calendar thead .name { /* Cells <TD> containing the day names */
+  border-bottom: 1px solid #000;
+  padding: 2px;
+  text-align: center;
+  background: #e8f4f0;
+}
+
+.calendar thead .weekend { /* How a weekend day name shows in header */
+  color: #f00;
+}
+
+.calendar thead .hilite { /* How do the buttons in header appear when hover */
+  border-top: 2px solid #fff;
+  border-right: 2px solid #000;
+  border-bottom: 2px solid #000;
+  border-left: 2px solid #fff;
+  padding: 0px;
+  background-color: #d8e4e0;
+}
+
+.calendar thead .active { /* Active (pressed) buttons in header */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  background-color: #b8c4c0;
+}
+
+/* The body part -- contains all the days in month. */
+
+.calendar tbody .day { /* Cells <TD> containing month days dates */
+  width: 2em;
+  text-align: right;
+  padding: 2px 4px 2px 2px;
+}
+.calendar tbody .day.othermonth {
+  font-size: 80%;
+  color: #aaa;
+}
+.calendar tbody .day.othermonth.oweekend {
+  color: #faa;
+}
+
+.calendar table .wn {
+  padding: 2px 3px 2px 2px;
+  border-right: 1px solid #000;
+  background: #e8f4f0;
+}
+
+.calendar tbody .rowhilite td {
+  background: #d8e4e0;
+}
+
+.calendar tbody .rowhilite td.wn {
+  background: #c8d4d0;
+}
+
+.calendar tbody td.hilite { /* Hovered cells <TD> */
+  padding: 1px 3px 1px 1px;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+}
+
+.calendar tbody td.active { /* Active (pressed) cells <TD> */
+  padding: 2px 2px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+.calendar tbody td.selected { /* Cell showing selected date */
+  font-weight: bold;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+  padding: 2px 2px 0px 2px;
+  background: #d8e4e0;
+}
+
+.calendar tbody td.weekend { /* Cells showing weekend days */
+  color: #f00;
+}
+
+.calendar tbody td.today { /* Cell showing today date */
+  font-weight: bold;
+  color: #00f;
+}
+
+.calendar tbody .disabled { color: #999; }
+
+.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
+  visibility: hidden;
+}
+
+.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
+  display: none;
+}
+
+/* The footer part -- status bar and "Close" button */
+
+.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
+}
+
+.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
+  background: #e8f4f0;
+  padding: 1px;
+  border: 1px solid #000;
+  background: #788480;
+  color: #fff;
+  text-align: center;
+}
+
+.calendar tfoot .hilite { /* Hover style for buttons in footer */
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  padding: 1px;
+  background: #d8e4e0;
+}
+
+.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
+  padding: 2px 0px 0px 2px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+/* Combo boxes (menus that display months/years for direct selection) */
+
+.calendar .combo {
+  position: absolute;
+  display: none;
+  width: 4em;
+  top: 0px;
+  left: 0px;
+  cursor: default;
+  border-top: 1px solid #fff;
+  border-right: 1px solid #000;
+  border-bottom: 1px solid #000;
+  border-left: 1px solid #fff;
+  background: #d8e4e0;
+  font-size: 90%;
+  padding: 1px;
+  z-index: 100;
+}
+
+.calendar .combo .label,
+.calendar .combo .label-IEfix {
+  text-align: center;
+  padding: 1px;
+}
+
+.calendar .combo .label-IEfix {
+  width: 4em;
+}
+
+.calendar .combo .active {
+  background: #c8d4d0;
+  padding: 0px;
+  border-top: 1px solid #000;
+  border-right: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+  border-left: 1px solid #000;
+}
+
+.calendar .combo .hilite {
+  background: #048;
+  color: #aef;
+}
+
+.calendar td.time {
+  border-top: 1px solid #000;
+  padding: 1px 0px;
+  text-align: center;
+  background-color: #e8f0f4;
+}
+
+.calendar td.time .hour,
+.calendar td.time .minute,
+.calendar td.time .ampm {
+  padding: 0px 3px 0px 4px;
+  border: 1px solid #889;
+  font-weight: bold;
+  background-color: #fff;
+}
+
+.calendar td.time .ampm {
+  text-align: center;
+}
+
+.calendar td.time .colon {
+  padding: 0px 2px 0px 3px;
+  font-weight: bold;
+}
+
+.calendar td.time span.hilite {
+  border-color: #000;
+  background-color: #667;
+  color: #fff;
+}
+
+.calendar td.time span.active {
+  border-color: #f00;
+  background-color: #000;
+  color: #0f0;
+}
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar.js b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar.js
new file mode 100644 (file)
index 0000000..9088e0e
--- /dev/null
@@ -0,0 +1,1806 @@
+/*  Copyright Mihai Bazon, 2002-2005  |  www.bazon.net/mishoo
+ * -----------------------------------------------------------
+ *
+ * The DHTML Calendar, version 1.0 "It is happening again"
+ *
+ * Details and latest version at:
+ * www.dynarch.com/projects/calendar
+ *
+ * This script is developed by Dynarch.com.  Visit us at www.dynarch.com.
+ *
+ * This script is distributed under the GNU Lesser General Public License.
+ * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
+ */
+
+// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $
+
+/** The Calendar object constructor. */
+Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
+       // member variables
+       this.activeDiv = null;
+       this.currentDateEl = null;
+       this.getDateStatus = null;
+       this.getDateToolTip = null;
+       this.getDateText = null;
+       this.timeout = null;
+       this.onSelected = onSelected || null;
+       this.onClose = onClose || null;
+       this.dragging = false;
+       this.hidden = false;
+       this.minYear = 1970;
+       this.maxYear = 2050;
+       this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
+       this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
+       this.isPopup = true;
+       this.weekNumbers = true;
+       this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc.
+       this.showsOtherMonths = false;
+       this.dateStr = dateStr;
+       this.ar_days = null;
+       this.showsTime = false;
+       this.time24 = true;
+       this.yearStep = 2;
+       this.hiliteToday = true;
+       this.multiple = null;
+       // HTML elements
+       this.table = null;
+       this.element = null;
+       this.tbody = null;
+       this.firstdayname = null;
+       // Combo boxes
+       this.monthsCombo = null;
+       this.yearsCombo = null;
+       this.hilitedMonth = null;
+       this.activeMonth = null;
+       this.hilitedYear = null;
+       this.activeYear = null;
+       // Information
+       this.dateClicked = false;
+
+       // one-time initializations
+       if (typeof Calendar._SDN == "undefined") {
+               // table of short day names
+               if (typeof Calendar._SDN_len == "undefined")
+                       Calendar._SDN_len = 3;
+               var ar = new Array();
+               for (var i = 8; i > 0;) {
+                       ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
+               }
+               Calendar._SDN = ar;
+               // table of short month names
+               if (typeof Calendar._SMN_len == "undefined")
+                       Calendar._SMN_len = 3;
+               ar = new Array();
+               for (var i = 12; i > 0;) {
+                       ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
+               }
+               Calendar._SMN = ar;
+       }
+};
+
+// ** constants
+
+/// "static", needed for event handlers.
+Calendar._C = null;
+
+/// detect a special case of "web browser"
+Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
+                  !/opera/i.test(navigator.userAgent) );
+
+Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );
+
+/// detect Opera browser
+Calendar.is_opera = /opera/i.test(navigator.userAgent);
+
+/// detect KHTML-based browsers
+Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
+
+// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
+//        library, at some point.
+
+Calendar.getAbsolutePos = function(el) {
+       var SL = 0, ST = 0;
+       var is_div = /^div$/i.test(el.tagName);
+       if (is_div && el.scrollLeft)
+               SL = el.scrollLeft;
+       if (is_div && el.scrollTop)
+               ST = el.scrollTop;
+       var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
+       if (el.offsetParent) {
+               var tmp = this.getAbsolutePos(el.offsetParent);
+               r.x += tmp.x;
+               r.y += tmp.y;
+       }
+       return r;
+};
+
+Calendar.isRelated = function (el, evt) {
+       var related = evt.relatedTarget;
+       if (!related) {
+               var type = evt.type;
+               if (type == "mouseover") {
+                       related = evt.fromElement;
+               } else if (type == "mouseout") {
+                       related = evt.toElement;
+               }
+       }
+       while (related) {
+               if (related == el) {
+                       return true;
+               }
+               related = related.parentNode;
+       }
+       return false;
+};
+
+Calendar.removeClass = function(el, className) {
+       if (!(el && el.className)) {
+               return;
+       }
+       var cls = el.className.split(" ");
+       var ar = new Array();
+       for (var i = cls.length; i > 0;) {
+               if (cls[--i] != className) {
+                       ar[ar.length] = cls[i];
+               }
+       }
+       el.className = ar.join(" ");
+};
+
+Calendar.addClass = function(el, className) {
+       Calendar.removeClass(el, className);
+       el.className += " " + className;
+};
+
+// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately.
+Calendar.getElement = function(ev) {
+       var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget;
+       while (f.nodeType != 1 || /^div$/i.test(f.tagName))
+               f = f.parentNode;
+       return f;
+};
+
+Calendar.getTargetElement = function(ev) {
+       var f = Calendar.is_ie ? window.event.srcElement : ev.target;
+       while (f.nodeType != 1)
+               f = f.parentNode;
+       return f;
+};
+
+Calendar.stopEvent = function(ev) {
+       ev || (ev = window.event);
+       if (Calendar.is_ie) {
+               ev.cancelBubble = true;
+               ev.returnValue = false;
+       } else {
+               ev.preventDefault();
+               ev.stopPropagation();
+       }
+       return false;
+};
+
+Calendar.addEvent = function(el, evname, func) {
+       if (el.attachEvent) { // IE
+               el.attachEvent("on" + evname, func);
+       } else if (el.addEventListener) { // Gecko / W3C
+               el.addEventListener(evname, func, true);
+       } else {
+               el["on" + evname] = func;
+       }
+};
+
+Calendar.removeEvent = function(el, evname, func) {
+       if (el.detachEvent) { // IE
+               el.detachEvent("on" + evname, func);
+       } else if (el.removeEventListener) { // Gecko / W3C
+               el.removeEventListener(evname, func, true);
+       } else {
+               el["on" + evname] = null;
+       }
+};
+
+Calendar.createElement = function(type, parent) {
+       var el = null;
+       if (document.createElementNS) {
+               // use the XHTML namespace; IE won't normally get here unless
+               // _they_ "fix" the DOM2 implementation.
+               el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
+       } else {
+               el = document.createElement(type);
+       }
+       if (typeof parent != "undefined") {
+               parent.appendChild(el);
+       }
+       return el;
+};
+
+// END: UTILITY FUNCTIONS
+
+// BEGIN: CALENDAR STATIC FUNCTIONS
+
+/** Internal -- adds a set of events to make some element behave like a button. */
+Calendar._add_evs = function(el) {
+       with (Calendar) {
+               addEvent(el, "mouseover", dayMouseOver);
+               addEvent(el, "mousedown", dayMouseDown);
+               addEvent(el, "mouseout", dayMouseOut);
+               if (is_ie) {
+                       addEvent(el, "dblclick", dayMouseDblClick);
+                       el.setAttribute("unselectable", true);
+               }
+       }
+};
+
+Calendar.findMonth = function(el) {
+       if (typeof el.month != "undefined") {
+               return el;
+       } else if (typeof el.parentNode.month != "undefined") {
+               return el.parentNode;
+       }
+       return null;
+};
+
+Calendar.findYear = function(el) {
+       if (typeof el.year != "undefined") {
+               return el;
+       } else if (typeof el.parentNode.year != "undefined") {
+               return el.parentNode;
+       }
+       return null;
+};
+
+Calendar.showMonthsCombo = function () {
+       var cal = Calendar._C;
+       if (!cal) {
+               return false;
+       }
+       var cal = cal;
+       var cd = cal.activeDiv;
+       var mc = cal.monthsCombo;
+       if (cal.hilitedMonth) {
+               Calendar.removeClass(cal.hilitedMonth, "hilite");
+       }
+       if (cal.activeMonth) {
+               Calendar.removeClass(cal.activeMonth, "active");
+       }
+       var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
+       Calendar.addClass(mon, "active");
+       cal.activeMonth = mon;
+       var s = mc.style;
+       s.display = "block";
+       if (cd.navtype < 0)
+               s.left = cd.offsetLeft + "px";
+       else {
+               var mcw = mc.offsetWidth;
+               if (typeof mcw == "undefined")
+                       // Konqueror brain-dead techniques
+                       mcw = 50;
+               s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
+       }
+       s.top = (cd.offsetTop + cd.offsetHeight) + "px";
+};
+
+Calendar.showYearsCombo = function (fwd) {
+       var cal = Calendar._C;
+       if (!cal) {
+               return false;
+       }
+       var cal = cal;
+       var cd = cal.activeDiv;
+       var yc = cal.yearsCombo;
+       if (cal.hilitedYear) {
+               Calendar.removeClass(cal.hilitedYear, "hilite");
+       }
+       if (cal.activeYear) {
+               Calendar.removeClass(cal.activeYear, "active");
+       }
+       cal.activeYear = null;
+       var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
+       var yr = yc.firstChild;
+       var show = false;
+       for (var i = 12; i > 0; --i) {
+               if (Y >= cal.minYear && Y <= cal.maxYear) {
+                       yr.innerHTML = Y;
+                       yr.year = Y;
+                       yr.style.display = "block";
+                       show = true;
+               } else {
+                       yr.style.display = "none";
+               }
+               yr = yr.nextSibling;
+               Y += fwd ? cal.yearStep : -cal.yearStep;
+       }
+       if (show) {
+               var s = yc.style;
+               s.display = "block";
+               if (cd.navtype < 0)
+                       s.left = cd.offsetLeft + "px";
+               else {
+                       var ycw = yc.offsetWidth;
+                       if (typeof ycw == "undefined")
+                               // Konqueror brain-dead techniques
+                               ycw = 50;
+                       s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
+               }
+               s.top = (cd.offsetTop + cd.offsetHeight) + "px";
+       }
+};
+
+// event handlers
+
+Calendar.tableMouseUp = function(ev) {
+       var cal = Calendar._C;
+       if (!cal) {
+               return false;
+       }
+       if (cal.timeout) {
+               clearTimeout(cal.timeout);
+       }
+       var el = cal.activeDiv;
+       if (!el) {
+               return false;
+       }
+       var target = Calendar.getTargetElement(ev);
+       ev || (ev = window.event);
+       Calendar.removeClass(el, "active");
+       if (target == el || target.parentNode == el) {
+               Calendar.cellClick(el, ev);
+       }
+       var mon = Calendar.findMonth(target);
+       var date = null;
+       if (mon) {
+               date = new Date(cal.date);
+               if (mon.month != date.getMonth()) {
+                       date.setMonth(mon.month);
+                       cal.setDate(date);
+                       cal.dateClicked = false;
+                       cal.callHandler();
+               }
+       } else {
+               var year = Calendar.findYear(target);
+               if (year) {
+                       date = new Date(cal.date);
+                       if (year.year != date.getFullYear()) {
+                               date.setFullYear(year.year);
+                               cal.setDate(date);
+                               cal.dateClicked = false;
+                               cal.callHandler();
+                       }
+               }
+       }
+       with (Calendar) {
+               removeEvent(document, "mouseup", tableMouseUp);
+               removeEvent(document, "mouseover", tableMouseOver);
+               removeEvent(document, "mousemove", tableMouseOver);
+               cal._hideCombos();
+               _C = null;
+               return stopEvent(ev);
+       }
+};
+
+Calendar.tableMouseOver = function (ev) {
+       var cal = Calendar._C;
+       if (!cal) {
+               return;
+       }
+       var el = cal.activeDiv;
+       var target = Calendar.getTargetElement(ev);
+       if (target == el || target.parentNode == el) {
+               Calendar.addClass(el, "hilite active");
+               Calendar.addClass(el.parentNode, "rowhilite");
+       } else {
+               if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
+                       Calendar.removeClass(el, "active");
+               Calendar.removeClass(el, "hilite");
+               Calendar.removeClass(el.parentNode, "rowhilite");
+       }
+       ev || (ev = window.event);
+       if (el.navtype == 50 && target != el) {
+               var pos = Calendar.getAbsolutePos(el);
+               var w = el.offsetWidth;
+               var x = ev.clientX;
+               var dx;
+               var decrease = true;
+               if (x > pos.x + w) {
+                       dx = x - pos.x - w;
+                       decrease = false;
+               } else
+                       dx = pos.x - x;
+
+               if (dx < 0) dx = 0;
+               var range = el._range;
+               var current = el._current;
+               var count = Math.floor(dx / 10) % range.length;
+               for (var i = range.length; --i >= 0;)
+                       if (range[i] == current)
+                               break;
+               while (count-- > 0)
+                       if (decrease) {
+                               if (--i < 0)
+                                       i = range.length - 1;
+                       } else if ( ++i >= range.length )
+                               i = 0;
+               var newval = range[i];
+               el.innerHTML = newval;
+
+               cal.onUpdateTime();
+       }
+       var mon = Calendar.findMonth(target);
+       if (mon) {
+               if (mon.month != cal.date.getMonth()) {
+                       if (cal.hilitedMonth) {
+                               Calendar.removeClass(cal.hilitedMonth, "hilite");
+                       }
+                       Calendar.addClass(mon, "hilite");
+                       cal.hilitedMonth = mon;
+               } else if (cal.hilitedMonth) {
+                       Calendar.removeClass(cal.hilitedMonth, "hilite");
+               }
+       } else {
+               if (cal.hilitedMonth) {
+                       Calendar.removeClass(cal.hilitedMonth, "hilite");
+               }
+               var year = Calendar.findYear(target);
+               if (year) {
+                       if (year.year != cal.date.getFullYear()) {
+                               if (cal.hilitedYear) {
+                                       Calendar.removeClass(cal.hilitedYear, "hilite");
+                               }
+                               Calendar.addClass(year, "hilite");
+                               cal.hilitedYear = year;
+                       } else if (cal.hilitedYear) {
+                               Calendar.removeClass(cal.hilitedYear, "hilite");
+                       }
+               } else if (cal.hilitedYear) {
+                       Calendar.removeClass(cal.hilitedYear, "hilite");
+               }
+       }
+       return Calendar.stopEvent(ev);
+};
+
+Calendar.tableMouseDown = function (ev) {
+       if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
+               return Calendar.stopEvent(ev);
+       }
+};
+
+Calendar.calDragIt = function (ev) {
+       var cal = Calendar._C;
+       if (!(cal && cal.dragging)) {
+               return false;
+       }
+       var posX;
+       var posY;
+       if (Calendar.is_ie) {
+               posY = window.event.clientY + document.body.scrollTop;
+               posX = window.event.clientX + document.body.scrollLeft;
+       } else {
+               posX = ev.pageX;
+               posY = ev.pageY;
+       }
+       cal.hideShowCovered();
+       var st = cal.element.style;
+       st.left = (posX - cal.xOffs) + "px";
+       st.top = (posY - cal.yOffs) + "px";
+       return Calendar.stopEvent(ev);
+};
+
+Calendar.calDragEnd = function (ev) {
+       var cal = Calendar._C;
+       if (!cal) {
+               return false;
+       }
+       cal.dragging = false;
+       with (Calendar) {
+               removeEvent(document, "mousemove", calDragIt);
+               removeEvent(document, "mouseup", calDragEnd);
+               tableMouseUp(ev);
+       }
+       cal.hideShowCovered();
+};
+
+Calendar.dayMouseDown = function(ev) {
+       var el = Calendar.getElement(ev);
+       if (el.disabled) {
+               return false;
+       }
+       var cal = el.calendar;
+       cal.activeDiv = el;
+       Calendar._C = cal;
+       if (el.navtype != 300) with (Calendar) {
+               if (el.navtype == 50) {
+                       el._current = el.innerHTML;
+                       addEvent(document, "mousemove", tableMouseOver);
+               } else
+                       addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
+               addClass(el, "hilite active");
+               addEvent(document, "mouseup", tableMouseUp);
+       } else if (cal.isPopup) {
+               cal._dragStart(ev);
+       }
+       if (el.navtype == -1 || el.navtype == 1) {
+               if (cal.timeout) clearTimeout(cal.timeout);
+               cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
+       } else if (el.navtype == -2 || el.navtype == 2) {
+               if (cal.timeout) clearTimeout(cal.timeout);
+               cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
+       } else {
+               cal.timeout = null;
+       }
+       return Calendar.stopEvent(ev);
+};
+
+Calendar.dayMouseDblClick = function(ev) {
+       Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
+       if (Calendar.is_ie) {
+               document.selection.empty();
+       }
+};
+
+Calendar.dayMouseOver = function(ev) {
+       var el = Calendar.getElement(ev);
+       if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
+               return false;
+       }
+       if (el.ttip) {
+               if (el.ttip.substr(0, 1) == "_") {
+                       el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
+               }
+               el.calendar.tooltips.innerHTML = el.ttip;
+       }
+       if (el.navtype != 300) {
+               Calendar.addClass(el, "hilite");
+               if (el.caldate) {
+                       Calendar.addClass(el.parentNode, "rowhilite");
+               }
+       }
+       return Calendar.stopEvent(ev);
+};
+
+Calendar.dayMouseOut = function(ev) {
+       with (Calendar) {
+               var el = getElement(ev);
+               if (isRelated(el, ev) || _C || el.disabled)
+                       return false;
+               removeClass(el, "hilite");
+               if (el.caldate)
+                       removeClass(el.parentNode, "rowhilite");
+               if (el.calendar)
+                       el.calendar.tooltips.innerHTML = _TT["SEL_DATE"];
+               return stopEvent(ev);
+       }
+};
+
+/**
+ *  A generic "click" handler :) handles all types of buttons defined in this
+ *  calendar.
+ */
+Calendar.cellClick = function(el, ev) {
+       var cal = el.calendar;
+       var closing = false;
+       var newdate = false;
+       var date = null;
+       if (typeof el.navtype == "undefined") {
+               if (cal.currentDateEl) {
+                       Calendar.removeClass(cal.currentDateEl, "selected");
+                       Calendar.addClass(el, "selected");
+                       closing = (cal.currentDateEl == el);
+                       if (!closing) {
+                               cal.currentDateEl = el;
+                       }
+               }
+               cal.date.setDateOnly(el.caldate);
+               date = cal.date;
+               var other_month = !(cal.dateClicked = !el.otherMonth);
+               if (!other_month && !cal.currentDateEl)
+                       cal._toggleMultipleDate(new Date(date));
+               else
+                       newdate = !el.disabled;
+               // a date was clicked
+               if (other_month)
+                       cal._init(cal.firstDayOfWeek, date);
+       } else {
+               if (el.navtype == 200) {
+                       Calendar.removeClass(el, "hilite");
+                       cal.callCloseHandler();
+                       return;
+               }
+               date = new Date(cal.date);
+               if (el.navtype == 0)
+                       date.setDateOnly(new Date()); // TODAY
+               // unless "today" was clicked, we assume no date was clicked so
+               // the selected handler will know not to close the calenar when
+               // in single-click mode.
+               // cal.dateClicked = (el.navtype == 0);
+               cal.dateClicked = false;
+               var year = date.getFullYear();
+               var mon = date.getMonth();
+               function setMonth(m) {
+                       var day = date.getDate();
+                       var max = date.getMonthDays(m);
+                       if (day > max) {
+                               date.setDate(max);
+                       }
+                       date.setMonth(m);
+               };
+               switch (el.navtype) {
+                   case 400:
+                       Calendar.removeClass(el, "hilite");
+                       var text = Calendar._TT["ABOUT"];
+                       if (typeof text != "undefined") {
+                               text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
+                       } else {
+                               // FIXME: this should be removed as soon as lang files get updated!
+                               text = "Help and about box text is not translated into this language.\n" +
+                                       "If you know this language and you feel generous please update\n" +
+                                       "the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
+                                       "and send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\n" +
+                                       "Thank you!\n" +
+                                       "http://dynarch.com/mishoo/calendar.epl\n";
+                       }
+                       alert(text);
+                       return;
+                   case -2:
+                       if (year > cal.minYear) {
+                               date.setFullYear(year - 1);
+                       }
+                       break;
+                   case -1:
+                       if (mon > 0) {
+                               setMonth(mon - 1);
+                       } else if (year-- > cal.minYear) {
+                               date.setFullYear(year);
+                               setMonth(11);
+                       }
+                       break;
+                   case 1:
+                       if (mon < 11) {
+                               setMonth(mon + 1);
+                       } else if (year < cal.maxYear) {
+                               date.setFullYear(year + 1);
+                               setMonth(0);
+                       }
+                       break;
+                   case 2:
+                       if (year < cal.maxYear) {
+                               date.setFullYear(year + 1);
+                       }
+                       break;
+                   case 100:
+                       cal.setFirstDayOfWeek(el.fdow);
+                       return;
+                   case 50:
+                       var range = el._range;
+                       var current = el.innerHTML;
+                       for (var i = range.length; --i >= 0;)
+                               if (range[i] == current)
+                                       break;
+                       if (ev && ev.shiftKey) {
+                               if (--i < 0)
+                                       i = range.length - 1;
+                       } else if ( ++i >= range.length )
+                               i = 0;
+                       var newval = range[i];
+                       el.innerHTML = newval;
+                       cal.onUpdateTime();
+                       return;
+                   case 0:
+                       // TODAY will bring us here
+                       if ((typeof cal.getDateStatus == "function") &&
+                           cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
+                               return false;
+                       }
+                       break;
+               }
+               if (!date.equalsTo(cal.date)) {
+                       cal.setDate(date);
+                       newdate = true;
+               } else if (el.navtype == 0)
+                       newdate = closing = true;
+       }
+       if (newdate) {
+               ev && cal.callHandler();
+       }
+       if (closing) {
+               Calendar.removeClass(el, "hilite");
+               ev && cal.callCloseHandler();
+       }
+};
+
+// END: CALENDAR STATIC FUNCTIONS
+
+// BEGIN: CALENDAR OBJECT FUNCTIONS
+
+/**
+ *  This function creates the calendar inside the given parent.  If _par is
+ *  null than it creates a popup calendar inside the BODY element.  If _par is
+ *  an element, be it BODY, then it creates a non-popup calendar (still
+ *  hidden).  Some properties need to be set before calling this function.
+ */
+Calendar.prototype.create = function (_par) {
+       var parent = null;
+       if (! _par) {
+               // default parent is the document body, in which case we create
+               // a popup calendar.
+               parent = document.getElementsByTagName("body")[0];
+               this.isPopup = true;
+       } else {
+               parent = _par;
+               this.isPopup = false;
+       }
+       this.date = this.dateStr ? new Date(this.dateStr) : new Date();
+
+       var table = Calendar.createElement("table");
+       this.table = table;
+       table.cellSpacing = 0;
+       table.cellPadding = 0;
+       table.calendar = this;
+       Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
+
+       var div = Calendar.createElement("div");
+       this.element = div;
+       div.className = "calendar";
+       if (this.isPopup) {
+               div.style.position = "absolute";
+               div.style.display = "none";
+       }
+       div.appendChild(table);
+
+       var thead = Calendar.createElement("thead", table);
+       var cell = null;
+       var row = null;
+
+       var cal = this;
+       var hh = function (text, cs, navtype) {
+               cell = Calendar.createElement("td", row);
+               cell.colSpan = cs;
+               cell.className = "button";
+               if (navtype != 0 && Math.abs(navtype) <= 2)
+                       cell.className += " nav";
+               Calendar._add_evs(cell);
+               cell.calendar = cal;
+               cell.navtype = navtype;
+               cell.innerHTML = "<div unselectable='on'>" + text + "</div>";
+               return cell;
+       };
+
+       row = Calendar.createElement("tr", thead);
+       var title_length = 6;
+       (this.isPopup) && --title_length;
+       (this.weekNumbers) && ++title_length;
+
+       hh("?", 1, 400).ttip = Calendar._TT["INFO"];
+       this.title = hh("", title_length, 300);
+       this.title.className = "title";
+       if (this.isPopup) {
+               this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
+               this.title.style.cursor = "move";
+               hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"];
+       }
+
+       row = Calendar.createElement("tr", thead);
+       row.className = "headrow";
+
+       this._nav_py = hh("&#x00ab;", 1, -2);
+       this._nav_py.ttip = Calendar._TT["PREV_YEAR"];
+
+       this._nav_pm = hh("&#x2039;", 1, -1);
+       this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];
+
+       this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
+       this._nav_now.ttip = Calendar._TT["GO_TODAY"];
+
+       this._nav_nm = hh("&#x203a;", 1, 1);
+       this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];
+
+       this._nav_ny = hh("&#x00bb;", 1, 2);
+       this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];
+
+       // day names
+       row = Calendar.createElement("tr", thead);
+       row.className = "daynames";
+       if (this.weekNumbers) {
+               cell = Calendar.createElement("td", row);
+               cell.className = "name wn";
+               cell.innerHTML = Calendar._TT["WK"];
+       }
+       for (var i = 7; i > 0; --i) {
+               cell = Calendar.createElement("td", row);
+               if (!i) {
+                       cell.navtype = 100;
+                       cell.calendar = this;
+                       Calendar._add_evs(cell);
+               }
+       }
+       this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;
+       this._displayWeekdays();
+
+       var tbody = Calendar.createElement("tbody", table);
+       this.tbody = tbody;
+
+       for (i = 6; i > 0; --i) {
+               row = Calendar.createElement("tr", tbody);
+               if (this.weekNumbers) {
+                       cell = Calendar.createElement("td", row);
+               }
+               for (var j = 7; j > 0; --j) {
+                       cell = Calendar.createElement("td", row);
+                       cell.calendar = this;
+                       Calendar._add_evs(cell);
+               }
+       }
+
+       if (this.showsTime) {
+               row = Calendar.createElement("tr", tbody);
+               row.className = "time";
+
+               cell = Calendar.createElement("td", row);
+               cell.className = "time";
+               cell.colSpan = 2;
+               cell.innerHTML = Calendar._TT["TIME"] || "&nbsp;";
+
+               cell = Calendar.createElement("td", row);
+               cell.className = "time";
+               cell.colSpan = this.weekNumbers ? 4 : 3;
+
+               (function(){
+                       function makeTimePart(className, init, range_start, range_end) {
+                               var part = Calendar.createElement("span", cell);
+                               part.className = className;
+                               part.innerHTML = init;
+                               part.calendar = cal;
+                               part.ttip = Calendar._TT["TIME_PART"];
+                               part.navtype = 50;
+                               part._range = [];
+                               if (typeof range_start != "number")
+                                       part._range = range_start;
+                               else {
+                                       for (var i = range_start; i <= range_end; ++i) {
+                                               var txt;
+                                               if (i < 10 && range_end >= 10) txt = '0' + i;
+                                               else txt = '' + i;
+                                               part._range[part._range.length] = txt;
+                                       }
+                               }
+                               Calendar._add_evs(part);
+                               return part;
+                       };
+                       var hrs = cal.date.getHours();
+                       var mins = cal.date.getMinutes();
+                       var t12 = !cal.time24;
+                       var pm = (hrs > 12);
+                       if (t12 && pm) hrs -= 12;
+                       var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
+                       var span = Calendar.createElement("span", cell);
+                       span.innerHTML = ":";
+                       span.className = "colon";
+                       var M = makeTimePart("minute", mins, 0, 59);
+                       var AP = null;
+                       cell = Calendar.createElement("td", row);
+                       cell.className = "time";
+                       cell.colSpan = 2;
+                       if (t12)
+                               AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]);
+                       else
+                               cell.innerHTML = "&nbsp;";
+
+                       cal.onSetTime = function() {
+                               var pm, hrs = this.date.getHours(),
+                                       mins = this.date.getMinutes();
+                               if (t12) {
+                                       pm = (hrs >= 12);
+                                       if (pm) hrs -= 12;
+                                       if (hrs == 0) hrs = 12;
+                                       AP.innerHTML = pm ? "pm" : "am";
+                               }
+                               H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs;
+                               M.innerHTML = (mins < 10) ? ("0" + mins) : mins;
+                       };
+
+                       cal.onUpdateTime = function() {
+                               var date = this.date;
+                               var h = parseInt(H.innerHTML, 10);
+                               if (t12) {
+                                       if (/pm/i.test(AP.innerHTML) && h < 12)
+                                               h += 12;
+                                       else if (/am/i.test(AP.innerHTML) && h == 12)
+                                               h = 0;
+                               }
+                               var d = date.getDate();
+                               var m = date.getMonth();
+                               var y = date.getFullYear();
+                               date.setHours(h);
+                               date.setMinutes(parseInt(M.innerHTML, 10));
+                               date.setFullYear(y);
+                               date.setMonth(m);
+                               date.setDate(d);
+                               this.dateClicked = false;
+                               this.callHandler();
+                       };
+               })();
+       } else {
+               this.onSetTime = this.onUpdateTime = function() {};
+       }
+
+       var tfoot = Calendar.createElement("tfoot", table);
+
+       row = Calendar.createElement("tr", tfoot);
+       row.className = "footrow";
+
+       cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300);
+       cell.className = "ttip";
+       if (this.isPopup) {
+               cell.ttip = Calendar._TT["DRAG_TO_MOVE"];
+               cell.style.cursor = "move";
+       }
+       this.tooltips = cell;
+
+       div = Calendar.createElement("div", this.element);
+       this.monthsCombo = div;
+       div.className = "combo";
+       for (i = 0; i < Calendar._MN.length; ++i) {
+               var mn = Calendar.createElement("div");
+               mn.className = Calendar.is_ie ? "label-IEfix" : "label";
+               mn.month = i;
+               mn.innerHTML = Calendar._SMN[i];
+               div.appendChild(mn);
+       }
+
+       div = Calendar.createElement("div", this.element);
+       this.yearsCombo = div;
+       div.className = "combo";
+       for (i = 12; i > 0; --i) {
+               var yr = Calendar.createElement("div");
+               yr.className = Calendar.is_ie ? "label-IEfix" : "label";
+               div.appendChild(yr);
+       }
+
+       this._init(this.firstDayOfWeek, this.date);
+       parent.appendChild(this.element);
+};
+
+/** keyboard navigation, only for popup calendars */
+Calendar._keyEvent = function(ev) {
+       var cal = window._dynarch_popupCalendar;
+       if (!cal || cal.multiple)
+               return false;
+       (Calendar.is_ie) && (ev = window.event);
+       var act = (Calendar.is_ie || ev.type == "keypress"),
+               K = ev.keyCode;
+       if (ev.ctrlKey) {
+               switch (K) {
+                   case 37: // KEY left
+                       act && Calendar.cellClick(cal._nav_pm);
+                       break;
+                   case 38: // KEY up
+                       act && Calendar.cellClick(cal._nav_py);
+                       break;
+                   case 39: // KEY right
+                       act && Calendar.cellClick(cal._nav_nm);
+                       break;
+                   case 40: // KEY down
+                       act && Calendar.cellClick(cal._nav_ny);
+                       break;
+                   default:
+                       return false;
+               }
+       } else switch (K) {
+           case 32: // KEY space (now)
+               Calendar.cellClick(cal._nav_now);
+               break;
+           case 27: // KEY esc
+               act && cal.callCloseHandler();
+               break;
+           case 37: // KEY left
+           case 38: // KEY up
+           case 39: // KEY right
+           case 40: // KEY down
+               if (act) {
+                       var prev, x, y, ne, el, step;
+                       prev = K == 37 || K == 38;
+                       step = (K == 37 || K == 39) ? 1 : 7;
+                       function setVars() {
+                               el = cal.currentDateEl;
+                               var p = el.pos;
+                               x = p & 15;
+                               y = p >> 4;
+                               ne = cal.ar_days[y][x];
+                       };setVars();
+                       function prevMonth() {
+                               var date = new Date(cal.date);
+                               date.setDate(date.getDate() - step);
+                               cal.setDate(date);
+                       };
+                       function nextMonth() {
+                               var date = new Date(cal.date);
+                               date.setDate(date.getDate() + step);
+                               cal.setDate(date);
+                       };
+                       while (1) {
+                               switch (K) {
+                                   case 37: // KEY left
+                                       if (--x >= 0)
+                                               ne = cal.ar_days[y][x];
+                                       else {
+                                               x = 6;
+                                               K = 38;
+                                               continue;
+                                       }
+                                       break;
+                                   case 38: // KEY up
+                                       if (--y >= 0)
+                                               ne = cal.ar_days[y][x];
+                                       else {
+                                               prevMonth();
+                                               setVars();
+                                       }
+                                       break;
+                                   case 39: // KEY right
+                                       if (++x < 7)
+                                               ne = cal.ar_days[y][x];
+                                       else {
+                                               x = 0;
+                                               K = 40;
+                                               continue;
+                                       }
+                                       break;
+                                   case 40: // KEY down
+                                       if (++y < cal.ar_days.length)
+                                               ne = cal.ar_days[y][x];
+                                       else {
+                                               nextMonth();
+                                               setVars();
+                                       }
+                                       break;
+                               }
+                               break;
+                       }
+                       if (ne) {
+                               if (!ne.disabled)
+                                       Calendar.cellClick(ne);
+                               else if (prev)
+                                       prevMonth();
+                               else
+                                       nextMonth();
+                       }
+               }
+               break;
+           case 13: // KEY enter
+               if (act)
+                       Calendar.cellClick(cal.currentDateEl, ev);
+               break;
+           default:
+               return false;
+       }
+       return Calendar.stopEvent(ev);
+};
+
+/**
+ *  (RE)Initializes the calendar to the given date and firstDayOfWeek
+ */
+Calendar.prototype._init = function (firstDayOfWeek, date) {
+       var today = new Date(),
+               TY = today.getFullYear(),
+               TM = today.getMonth(),
+               TD = today.getDate();
+       this.table.style.visibility = "hidden";
+       var year = date.getFullYear();
+       if (year < this.minYear) {
+               year = this.minYear;
+               date.setFullYear(year);
+       } else if (year > this.maxYear) {
+               year = this.maxYear;
+               date.setFullYear(year);
+       }
+       this.firstDayOfWeek = firstDayOfWeek;
+       this.date = new Date(date);
+       var month = date.getMonth();
+       var mday = date.getDate();
+       var no_days = date.getMonthDays();
+
+       // calendar voodoo for computing the first day that would actually be
+       // displayed in the calendar, even if it's from the previous month.
+       // WARNING: this is magic. ;-)
+       date.setDate(1);
+       var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
+       if (day1 < 0)
+               day1 += 7;
+       date.setDate(-day1);
+       date.setDate(date.getDate() + 1);
+
+       var row = this.tbody.firstChild;
+       var MN = Calendar._SMN[month];
+       var ar_days = this.ar_days = new Array();
+       var weekend = Calendar._TT["WEEKEND"];
+       var dates = this.multiple ? (this.datesCells = {}) : null;
+       for (var i = 0; i < 6; ++i, row = row.nextSibling) {
+               var cell = row.firstChild;
+               if (this.weekNumbers) {
+                       cell.className = "day wn";
+                       cell.innerHTML = date.getWeekNumber();
+                       cell = cell.nextSibling;
+               }
+               row.className = "daysrow";
+               var hasdays = false, iday, dpos = ar_days[i] = [];
+               for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
+                       iday = date.getDate();
+                       var wday = date.getDay();
+                       cell.className = "day";
+                       cell.pos = i << 4 | j;
+                       dpos[j] = cell;
+                       var current_month = (date.getMonth() == month);
+                       if (!current_month) {
+                               if (this.showsOtherMonths) {
+                                       cell.className += " othermonth";
+                                       cell.otherMonth = true;
+                               } else {
+                                       cell.className = "emptycell";
+                                       cell.innerHTML = "&nbsp;";
+                                       cell.disabled = true;
+                                       continue;
+                               }
+                       } else {
+                               cell.otherMonth = false;
+                               hasdays = true;
+                       }
+                       cell.disabled = false;
+                       cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
+                       if (dates)
+                               dates[date.print("%Y%m%d")] = cell;
+                       if (this.getDateStatus) {
+                               var status = this.getDateStatus(date, year, month, iday);
+                               if (this.getDateToolTip) {
+                                       var toolTip = this.getDateToolTip(date, year, month, iday);
+                                       if (toolTip)
+                                               cell.title = toolTip;
+                               }
+                               if (status === true) {
+                                       cell.className += " disabled";
+                                       cell.disabled = true;
+                               } else {
+                                       if (/disabled/i.test(status))
+                                               cell.disabled = true;
+                                       cell.className += " " + status;
+                               }
+                       }
+                       if (!cell.disabled) {
+                               cell.caldate = new Date(date);
+                               cell.ttip = "_";
+                               if (!this.multiple && current_month
+                                   && iday == mday && this.hiliteToday) {
+                                       cell.className += " selected";
+                                       this.currentDateEl = cell;
+                               }
+                               if (date.getFullYear() == TY &&
+                                   date.getMonth() == TM &&
+                                   iday == TD) {
+                                       cell.className += " today";
+                                       cell.ttip += Calendar._TT["PART_TODAY"];
+                               }
+                               if (weekend.indexOf(wday.toString()) != -1)
+                                       cell.className += cell.otherMonth ? " oweekend" : " weekend";
+                       }
+               }
+               if (!(hasdays || this.showsOtherMonths))
+                       row.className = "emptyrow";
+       }
+       this.title.innerHTML = Calendar._MN[month] + ", " + year;
+       this.onSetTime();
+       this.table.style.visibility = "visible";
+       this._initMultipleDates();
+       // PROFILE
+       // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms";
+};
+
+Calendar.prototype._initMultipleDates = function() {
+       if (this.multiple) {
+               for (var i in this.multiple) {
+                       var cell = this.datesCells[i];
+                       var d = this.multiple[i];
+                       if (!d)
+                               continue;
+                       if (cell)
+                               cell.className += " selected";
+               }
+       }
+};
+
+Calendar.prototype._toggleMultipleDate = function(date) {
+       if (this.multiple) {
+               var ds = date.print("%Y%m%d");
+               var cell = this.datesCells[ds];
+               if (cell) {
+                       var d = this.multiple[ds];
+                       if (!d) {
+                               Calendar.addClass(cell, "selected");
+                               this.multiple[ds] = date;
+                       } else {
+                               Calendar.removeClass(cell, "selected");
+                               delete this.multiple[ds];
+                       }
+               }
+       }
+};
+
+Calendar.prototype.setDateToolTipHandler = function (unaryFunction) {
+       this.getDateToolTip = unaryFunction;
+};
+
+/**
+ *  Calls _init function above for going to a certain date (but only if the
+ *  date is different than the currently selected one).
+ */
+Calendar.prototype.setDate = function (date) {
+       if (!date.equalsTo(this.date)) {
+               this._init(this.firstDayOfWeek, date);
+       }
+};
+
+/**
+ *  Refreshes the calendar.  Useful if the "disabledHandler" function is
+ *  dynamic, meaning that the list of disabled date can change at runtime.
+ *  Just * call this function if you think that the list of disabled dates
+ *  should * change.
+ */
+Calendar.prototype.refresh = function () {
+       this._init(this.firstDayOfWeek, this.date);
+};
+
+/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
+Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
+       this._init(firstDayOfWeek, this.date);
+       this._displayWeekdays();
+};
+
+/**
+ *  Allows customization of what dates are enabled.  The "unaryFunction"
+ *  parameter must be a function object that receives the date (as a JS Date
+ *  object) and returns a boolean value.  If the returned value is true then
+ *  the passed date will be marked as disabled.
+ */
+Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) {
+       this.getDateStatus = unaryFunction;
+};
+
+/** Customization of allowed year range for the calendar. */
+Calendar.prototype.setRange = function (a, z) {
+       this.minYear = a;
+       this.maxYear = z;
+};
+
+/** Calls the first user handler (selectedHandler). */
+Calendar.prototype.callHandler = function () {
+       if (this.onSelected) {
+               this.onSelected(this, this.date.print(this.dateFormat));
+       }
+};
+
+/** Calls the second user handler (closeHandler). */
+Calendar.prototype.callCloseHandler = function () {
+       if (this.onClose) {
+               this.onClose(this);
+       }
+       this.hideShowCovered();
+};
+
+/** Removes the calendar object from the DOM tree and destroys it. */
+Calendar.prototype.destroy = function () {
+       var el = this.element.parentNode;
+       el.removeChild(this.element);
+       Calendar._C = null;
+       window._dynarch_popupCalendar = null;
+};
+
+/**
+ *  Moves the calendar element to a different section in the DOM tree (changes
+ *  its parent).
+ */
+Calendar.prototype.reparent = function (new_parent) {
+       var el = this.element;
+       el.parentNode.removeChild(el);
+       new_parent.appendChild(el);
+};
+
+// This gets called when the user presses a mouse button anywhere in the
+// document, if the calendar is shown.  If the click was outside the open
+// calendar this function closes it.
+Calendar._checkCalendar = function(ev) {
+       var calendar = window._dynarch_popupCalendar;
+       if (!calendar) {
+               return false;
+       }
+       var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
+       for (; el != null && el != calendar.element; el = el.parentNode);
+       if (el == null) {
+               // calls closeHandler which should hide the calendar.
+               window._dynarch_popupCalendar.callCloseHandler();
+               return Calendar.stopEvent(ev);
+       }
+};
+
+/** Shows the calendar. */
+Calendar.prototype.show = function () {
+       var rows = this.table.getElementsByTagName("tr");
+       for (var i = rows.length; i > 0;) {
+               var row = rows[--i];
+               Calendar.removeClass(row, "rowhilite");
+               var cells = row.getElementsByTagName("td");
+               for (var j = cells.length; j > 0;) {
+                       var cell = cells[--j];
+                       Calendar.removeClass(cell, "hilite");
+                       Calendar.removeClass(cell, "active");
+               }
+       }
+       this.element.style.display = "block";
+       this.hidden = false;
+       if (this.isPopup) {
+               window._dynarch_popupCalendar = this;
+               Calendar.addEvent(document, "keydown", Calendar._keyEvent);
+               Calendar.addEvent(document, "keypress", Calendar._keyEvent);
+               Calendar.addEvent(document, "mousedown", Calendar._checkCalendar);
+       }
+       this.hideShowCovered();
+};
+
+/**
+ *  Hides the calendar.  Also removes any "hilite" from the class of any TD
+ *  element.
+ */
+Calendar.prototype.hide = function () {
+       if (this.isPopup) {
+               Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
+               Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
+               Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
+       }
+       this.element.style.display = "none";
+       this.hidden = true;
+       this.hideShowCovered();
+};
+
+/**
+ *  Shows the calendar at a given absolute position (beware that, depending on
+ *  the calendar element style -- position property -- this might be relative
+ *  to the parent's containing rectangle).
+ */
+Calendar.prototype.showAt = function (x, y) {
+       var s = this.element.style;
+       s.left = x + "px";
+       s.top = y + "px";
+       this.show();
+};
+
+/** Shows the calendar near a given element. */
+Calendar.prototype.showAtElement = function (el, opts) {
+       var self = this;
+       var p = Calendar.getAbsolutePos(el);
+       if (!opts || typeof opts != "string") {
+               this.showAt(p.x, p.y + el.offsetHeight);
+               return true;
+       }
+       function fixPosition(box) {
+               if (box.x < 0)
+                       box.x = 0;
+               if (box.y < 0)
+                       box.y = 0;
+               var cp = document.createElement("div");
+               var s = cp.style;
+               s.position = "absolute";
+               s.right = s.bottom = s.width = s.height = "0px";
+               document.body.appendChild(cp);
+               var br = Calendar.getAbsolutePos(cp);
+               document.body.removeChild(cp);
+               if (Calendar.is_ie) {
+                       br.y += document.body.scrollTop;
+                       br.x += document.body.scrollLeft;
+               } else {
+                       br.y += window.scrollY;
+                       br.x += window.scrollX;
+               }
+               var tmp = box.x + box.width - br.x;
+               if (tmp > 0) box.x -= tmp;
+               tmp = box.y + box.height - br.y;
+               if (tmp > 0) box.y -= tmp;
+       };
+       this.element.style.display = "block";
+       Calendar.continuation_for_the_fucking_khtml_browser = function() {
+               var w = self.element.offsetWidth;
+               var h = self.element.offsetHeight;
+               self.element.style.display = "none";
+               var valign = opts.substr(0, 1);
+               var halign = "l";
+               if (opts.length > 1) {
+                       halign = opts.substr(1, 1);
+               }
+               // vertical alignment
+               switch (valign) {
+                   case "T": p.y -= h; break;
+                   case "B": p.y += el.offsetHeight; break;
+                   case "C": p.y += (el.offsetHeight - h) / 2; break;
+                   case "t": p.y += el.offsetHeight - h; break;
+                   case "b": break; // already there
+               }
+               // horizontal alignment
+               switch (halign) {
+                   case "L": p.x -= w; break;
+                   case "R": p.x += el.offsetWidth; break;
+                   case "C": p.x += (el.offsetWidth - w) / 2; break;
+                   case "l": p.x += el.offsetWidth - w; break;
+                   case "r": break; // already there
+               }
+               p.width = w;
+               p.height = h + 40;
+               self.monthsCombo.style.display = "none";
+               fixPosition(p);
+               self.showAt(p.x, p.y);
+       };
+       if (Calendar.is_khtml)
+               setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
+       else
+               Calendar.continuation_for_the_fucking_khtml_browser();
+};
+
+/** Customizes the date format. */
+Calendar.prototype.setDateFormat = function (str) {
+       this.dateFormat = str;
+};
+
+/** Customizes the tooltip date format. */
+Calendar.prototype.setTtDateFormat = function (str) {
+       this.ttDateFormat = str;
+};
+
+/**
+ *  Tries to identify the date represented in a string.  If successful it also
+ *  calls this.setDate which moves the calendar to the given date.
+ */
+Calendar.prototype.parseDate = function(str, fmt) {
+       if (!fmt)
+               fmt = this.dateFormat;
+       this.setDate(Date.parseDate(str, fmt));
+};
+
+Calendar.prototype.hideShowCovered = function () {
+       if (!Calendar.is_ie && !Calendar.is_opera)
+               return;
+       function getVisib(obj){
+               var value = obj.style.visibility;
+               if (!value) {
+                       if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
+                               if (!Calendar.is_khtml)
+                                       value = document.defaultView.
+                                               getComputedStyle(obj, "").getPropertyValue("visibility");
+                               else
+                                       value = '';
+                       } else if (obj.currentStyle) { // IE
+                               value = obj.currentStyle.visibility;
+                       } else
+                               value = '';
+               }
+               return value;
+       };
+
+       var tags = new Array("applet", "iframe", "select");
+       var el = this.element;
+
+       var p = Calendar.getAbsolutePos(el);
+       var EX1 = p.x;
+       var EX2 = el.offsetWidth + EX1;
+       var EY1 = p.y;
+       var EY2 = el.offsetHeight + EY1;
+
+       for (var k = tags.length; k > 0; ) {
+               var ar = document.getElementsByTagName(tags[--k]);
+               var cc = null;
+
+               for (var i = ar.length; i > 0;) {
+                       cc = ar[--i];
+
+                       p = Calendar.getAbsolutePos(cc);
+                       var CX1 = p.x;
+                       var CX2 = cc.offsetWidth + CX1;
+                       var CY1 = p.y;
+                       var CY2 = cc.offsetHeight + CY1;
+
+                       if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
+                               if (!cc.__msh_save_visibility) {
+                                       cc.__msh_save_visibility = getVisib(cc);
+                               }
+                               cc.style.visibility = cc.__msh_save_visibility;
+                       } else {
+                               if (!cc.__msh_save_visibility) {
+                                       cc.__msh_save_visibility = getVisib(cc);
+                               }
+                               cc.style.visibility = "hidden";
+                       }
+               }
+       }
+};
+
+/** Internal function; it displays the bar with the names of the weekday. */
+Calendar.prototype._displayWeekdays = function () {
+       var fdow = this.firstDayOfWeek;
+       var cell = this.firstdayname;
+       var weekend = Calendar._TT["WEEKEND"];
+       for (var i = 0; i < 7; ++i) {
+               cell.className = "day name";
+               var realday = (i + fdow) % 7;
+               if (i) {
+                       cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]);
+                       cell.navtype = 100;
+                       cell.calendar = this;
+                       cell.fdow = realday;
+                       Calendar._add_evs(cell);
+               }
+               if (weekend.indexOf(realday.toString()) != -1) {
+                       Calendar.addClass(cell, "weekend");
+               }
+               cell.innerHTML = Calendar._SDN[(i + fdow) % 7];
+               cell = cell.nextSibling;
+       }
+};
+
+/** Internal function.  Hides all combo boxes that might be displayed. */
+Calendar.prototype._hideCombos = function () {
+       this.monthsCombo.style.display = "none";
+       this.yearsCombo.style.display = "none";
+};
+
+/** Internal function.  Starts dragging the element. */
+Calendar.prototype._dragStart = function (ev) {
+       if (this.dragging) {
+               return;
+       }
+       this.dragging = true;
+       var posX;
+       var posY;
+       if (Calendar.is_ie) {
+               posY = window.event.clientY + document.body.scrollTop;
+               posX = window.event.clientX + document.body.scrollLeft;
+       } else {
+               posY = ev.clientY + window.scrollY;
+               posX = ev.clientX + window.scrollX;
+       }
+       var st = this.element.style;
+       this.xOffs = posX - parseInt(st.left);
+       this.yOffs = posY - parseInt(st.top);
+       with (Calendar) {
+               addEvent(document, "mousemove", calDragIt);
+               addEvent(document, "mouseup", calDragEnd);
+       }
+};
+
+// BEGIN: DATE OBJECT PATCHES
+
+/** Adds the number of days array to the Date object. */
+Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
+
+/** Constants used for time computations */
+Date.SECOND = 1000 /* milliseconds */;
+Date.MINUTE = 60 * Date.SECOND;
+Date.HOUR   = 60 * Date.MINUTE;
+Date.DAY    = 24 * Date.HOUR;
+Date.WEEK   =  7 * Date.DAY;
+
+Date.parseDate = function(str, fmt) {
+       var today = new Date();
+       var y = 0;
+       var m = -1;
+       var d = 0;
+       var a = str.split(/\W+/);
+       var b = fmt.match(/%./g);
+       var i = 0, j = 0;
+       var hr = 0;
+       var min = 0;
+       for (i = 0; i < a.length; ++i) {
+               if (!a[i])
+                       continue;
+               switch (b[i]) {
+                   case "%d":
+                   case "%e":
+                       d = parseInt(a[i], 10);
+                       break;
+
+                   case "%m":
+                       m = parseInt(a[i], 10) - 1;
+                       break;
+
+                   case "%Y":
+                   case "%y":
+                       y = parseInt(a[i], 10);
+                       (y < 100) && (y += (y > 29) ? 1900 : 2000);
+                       break;
+
+                   case "%b":
+                   case "%B":
+                       for (j = 0; j < 12; ++j) {
+                               if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
+                       }
+                       break;
+
+                   case "%H":
+                   case "%I":
+                   case "%k":
+                   case "%l":
+                       hr = parseInt(a[i], 10);
+                       break;
+
+                   case "%P":
+                   case "%p":
+                       if (/pm/i.test(a[i]) && hr < 12)
+                               hr += 12;
+                       else if (/am/i.test(a[i]) && hr >= 12)
+                               hr -= 12;
+                       break;
+
+                   case "%M":
+                       min = parseInt(a[i], 10);
+                       break;
+               }
+       }
+       if (isNaN(y)) y = today.getFullYear();
+       if (isNaN(m)) m = today.getMonth();
+       if (isNaN(d)) d = today.getDate();
+       if (isNaN(hr)) hr = today.getHours();
+       if (isNaN(min)) min = today.getMinutes();
+       if (y != 0 && m != -1 && d != 0)
+               return new Date(y, m, d, hr, min, 0);
+       y = 0; m = -1; d = 0;
+       for (i = 0; i < a.length; ++i) {
+               if (a[i].search(/[a-zA-Z]+/) != -1) {
+                       var t = -1;
+                       for (j = 0; j < 12; ++j) {
+                               if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
+                       }
+                       if (t != -1) {
+                               if (m != -1) {
+                                       d = m+1;
+                               }
+                               m = t;
+                       }
+               } else if (parseInt(a[i], 10) <= 12 && m == -1) {
+                       m = a[i]-1;
+               } else if (parseInt(a[i], 10) > 31 && y == 0) {
+                       y = parseInt(a[i], 10);
+                       (y < 100) && (y += (y > 29) ? 1900 : 2000);
+               } else if (d == 0) {
+                       d = a[i];
+               }
+       }
+       if (y == 0)
+               y = today.getFullYear();
+       if (m != -1 && d != 0)
+               return new Date(y, m, d, hr, min, 0);
+       return today;
+};
+
+/** Returns the number of days in the current month */
+Date.prototype.getMonthDays = function(month) {
+       var year = this.getFullYear();
+       if (typeof month == "undefined") {
+               month = this.getMonth();
+       }
+       if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
+               return 29;
+       } else {
+               return Date._MD[month];
+       }
+};
+
+/** Returns the number of day in the year. */
+Date.prototype.getDayOfYear = function() {
+       var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
+       var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
+       var time = now - then;
+       return Math.floor(time / Date.DAY);
+};
+
+/** Returns the number of the week in year, as defined in ISO 8601. */
+Date.prototype.getWeekNumber = function() {
+       var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
+       var DoW = d.getDay();
+       d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
+       var ms = d.valueOf(); // GMT
+       d.setMonth(0);
+       d.setDate(4); // Thu in Week 1
+       return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
+};
+
+/** Checks date and time equality */
+Date.prototype.equalsTo = function(date) {
+       return ((this.getFullYear() == date.getFullYear()) &&
+               (this.getMonth() == date.getMonth()) &&
+               (this.getDate() == date.getDate()) &&
+               (this.getHours() == date.getHours()) &&
+               (this.getMinutes() == date.getMinutes()));
+};
+
+/** Set only the year, month, date parts (keep existing time) */
+Date.prototype.setDateOnly = function(date) {
+       var tmp = new Date(date);
+       this.setDate(1);
+       this.setFullYear(tmp.getFullYear());
+       this.setMonth(tmp.getMonth());
+       this.setDate(tmp.getDate());
+};
+
+/** Prints the date in a string according to the given format. */
+Date.prototype.print = function (str) {
+       var m = this.getMonth();
+       var d = this.getDate();
+       var y = this.getFullYear();
+       var wn = this.getWeekNumber();
+       var w = this.getDay();
+       var s = {};
+       var hr = this.getHours();
+       var pm = (hr >= 12);
+       var ir = (pm) ? (hr - 12) : hr;
+       var dy = this.getDayOfYear();
+       if (ir == 0)
+               ir = 12;
+       var min = this.getMinutes();
+       var sec = this.getSeconds();
+       s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N]
+       s["%A"] = Calendar._DN[w]; // full weekday name
+       s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N]
+       s["%B"] = Calendar._MN[m]; // full month name
+       // FIXME: %c : preferred date and time representation for the current locale
+       s["%C"] = 1 + Math.floor(y / 100); // the century number
+       s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
+       s["%e"] = d; // the day of the month (range 1 to 31)
+       // FIXME: %D : american date style: %m/%d/%y
+       // FIXME: %E, %F, %G, %g, %h (man strftime)
+       s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
+       s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
+       s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
+       s["%k"] = hr;           // hour, range 0 to 23 (24h format)
+       s["%l"] = ir;           // hour, range 1 to 12 (12h format)
+       s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
+       s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
+       s["%n"] = "\n";         // a newline character
+       s["%p"] = pm ? "PM" : "AM";
+       s["%P"] = pm ? "pm" : "am";
+       // FIXME: %r : the time in am/pm notation %I:%M:%S %p
+       // FIXME: %R : the time in 24-hour notation %H:%M
+       s["%s"] = Math.floor(this.getTime() / 1000);
+       s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
+       s["%t"] = "\t";         // a tab character
+       // FIXME: %T : the time in 24-hour notation (%H:%M:%S)
+       s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
+       s["%u"] = w + 1;        // the day of the week (range 1 to 7, 1 = MON)
+       s["%w"] = w;            // the day of the week (range 0 to 6, 0 = SUN)
+       // FIXME: %x : preferred date representation for the current locale without the time
+       // FIXME: %X : preferred time representation for the current locale without the date
+       s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
+       s["%Y"] = y;            // year with the century
+       s["%%"] = "%";          // a literal '%' character
+
+       var re = /%./g;
+       if (!Calendar.is_ie5 && !Calendar.is_khtml)
+               return str.replace(re, function (par) { return s[par] || par; });
+
+       var a = str.match(re);
+       for (var i = 0; i < a.length; i++) {
+               var tmp = s[a[i]];
+               if (tmp) {
+                       re = new RegExp(a[i], 'g');
+                       str = str.replace(re, tmp);
+               }
+       }
+
+       return str;
+};
+
+Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
+Date.prototype.setFullYear = function(y) {
+       var d = new Date(this);
+       d.__msh_oldSetFullYear(y);
+       if (d.getMonth() != this.getMonth())
+               this.setDate(28);
+       this.__msh_oldSetFullYear(y);
+};
+
+// END: DATE OBJECT PATCHES
+
+
+// global object that remembers the calendar
+window._dynarch_popupCalendar = null;
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/calendar_stripped.js b/extra/webapps/article-manager/resources/jscalendar-1.0/calendar_stripped.js
new file mode 100644 (file)
index 0000000..4fe03f1
--- /dev/null
@@ -0,0 +1,14 @@
+/*  Copyright Mihai Bazon, 2002-2005  |  www.bazon.net/mishoo
+ * -----------------------------------------------------------
+ *
+ * The DHTML Calendar, version 1.0 "It is happening again"
+ *
+ * Details and latest version at:
+ * www.dynarch.com/projects/calendar
+ *
+ * This script is developed by Dynarch.com.  Visit us at www.dynarch.com.
+ *
+ * This script is distributed under the GNU Lesser General Public License.
+ * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
+ */
+ Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}while(related){if(related==el){return true;}related=related.parentNode;}return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}if(typeof parent!="undefined"){parent.appendChild(el);}return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}if(show){var s=yc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)if(range[i]==current)break;while(count-->0)if(decrease){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}el.calendar.tooltips.innerHTML=el.ttip;}if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)return false;removeClass(el,"hilite");if(el.caldate)removeClass(el.parentNode,"rowhilite");if(el.calendar)el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)cal._toggleMultipleDate(new Date(date));else newdate=!el.disabled;if(other_month)cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}date=new Date(cal.date);if(el.navtype==0)date.setDateOnly(new Date());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}break;case 1:if(mon<11){setMonth(mon+1);}else if(year<cal.maxYear){date.setFullYear(year+1);setMonth(0);}break;case 2:if(year<cal.maxYear){date.setFullYear(year+1);}break;case 100:cal.setFirstDayOfWeek(el.fdow);return;case 50:var range=el._range;var current=el.innerHTML;for(var i=range.length;--i>=0;)if(range[i]==current)break;if(ev&&ev.shiftKey){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}break;}if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)newdate=closing=true;}if(newdate){ev&&cal.callHandler();}if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}this.date=this.dateStr?new Date(this.dateStr):new Date();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="<div unselectable='on'>"+text+"</div>";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("&#x00d7;",1,200).ttip=Calendar._TT["CLOSE"];}row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||"&nbsp;";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else cell.innerHTML="&nbsp;";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)h=0;}var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i<Calendar._MN.length;++i){var mn=Calendar.createElement("div");mn.className=Calendar.is_ie?"label-IEfix":"label";mn.month=i;mn.innerHTML=Calendar._SMN[i];div.appendChild(mn);}div=Calendar.createElement("div",this.element);this.yearsCombo=div;div.className="combo";for(i=12;i>0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)ne=cal.ar_days[y][x];else{x=6;K=38;continue;}break;case 38:if(--y>=0)ne=cal.ar_days[y][x];else{prevMonth();setVars();}break;case 39:if(++x<7)ne=cal.ar_days[y][x];else{x=0;K=40;continue;}break;case 40:if(++y<cal.ar_days.length)ne=cal.ar_days[y][x];else{nextMonth();setVars();}break;}break;}if(ne){if(!ne.disabled)Calendar.cellClick(ne);else if(prev)prevMonth();else nextMonth();}}break;case 13:if(act)Calendar.cellClick(cal.currentDateEl,ev);break;default:return false;}return Calendar.stopEvent(ev);};Calendar.prototype._init=function(firstDayOfWeek,date){var today=new Date(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this.table.style.visibility="hidden";var year=date.getFullYear();if(year<this.minYear){year=this.minYear;date.setFullYear(year);}else if(year>this.maxYear){year=this.maxYear;date.setFullYear(year);}this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML="&nbsp;";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)cell.title=toolTip;}if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))cell.disabled=true;cell.className+=" "+status;}}if(!cell.disabled){cell.caldate=new Date(date);cell.ttip="_";if(!this.multiple&&current_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}if(weekend.indexOf(wday.toString())!=-1)cell.className+=cell.otherMonth?" oweekend":" weekend";}}if(!(hasdays||this.showsOtherMonths))row.className="emptyrow";}this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)continue;if(cell)cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}function fixPosition(box){if(box.x<0)box.x=0;if(box.y<0)box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}switch(valign){case "T":p.y-=h;break;case "B":p.y+=el.offsetHeight;break;case "C":p.y+=(el.offsetHeight-h)/2;break;case "t":p.y+=el.offsetHeight-h;break;case "b":break;}switch(halign){case "L":p.x-=w;break;case "R":p.x+=el.offsetWidth;break;case "C":p.x+=(el.offsetWidth-w)/2;break;case "l":p.x+=el.offsetWidth-w;break;case "r":break;}p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)value=document.defaultView. getComputedStyle(obj,"").getPropertyValue("visibility");else value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else value='';}return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2<EX1)||(CY1>EY2)||(CY2<EY1)){if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility=cc.__msh_save_visibility;}else{if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var fdow=this.firstDayOfWeek;var cell=this.firstdayname;var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<7;++i){cell.className="day name";var realday=(i+fdow)%7;if(i){cell.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[realday]);cell.navtype=100;cell.calendar=this;cell.fdow=realday;Calendar._add_evs(cell);}if(weekend.indexOf(realday.toString())!=-1){Calendar.addClass(cell,"weekend");}cell.innerHTML=Calendar._SDN[(i+fdow)%7];cell=cell.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return;}this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(str,fmt){var today=new Date();var y=0;var m=-1;var d=0;var a=str.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])continue;switch(b[i]){case "%d":case "%e":d=parseInt(a[i],10);break;case "%m":m=parseInt(a[i],10)-1;break;case "%Y":case "%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case "%b":case "%B":for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}break;case "%H":case "%I":case "%k":case "%l":hr=parseInt(a[i],10);break;case "%P":case "%p":if(/pm/i.test(a[i])&&hr<12)hr+=12;else if(/am/i.test(a[i])&&hr>=12)hr-=12;break;case "%M":min=parseInt(a[i],10);break;}}if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}if(t!=-1){if(m!=-1){d=m+1;}m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}if(y==0)y=today.getFullYear();if(m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}return str;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new Date(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())this.setDate(28);this.__msh_oldSetFullYear(y);};window._dynarch_popupCalendar=null;
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-af.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-af.js
new file mode 100644 (file)
index 0000000..aeda581
--- /dev/null
@@ -0,0 +1,39 @@
+// ** I18N Afrikaans
+Calendar._DN = new Array
+("Sondag",
+ "Maandag",
+ "Dinsdag",
+ "Woensdag",
+ "Donderdag",
+ "Vrydag",
+ "Saterdag",
+ "Sondag");
+Calendar._MN = new Array
+("Januarie",
+ "Februarie",
+ "Maart",
+ "April",
+ "Mei",
+ "Junie",
+ "Julie",
+ "Augustus",
+ "September",
+ "Oktober",
+ "November",
+ "Desember");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["TOGGLE"] = "Verander eerste dag van die week";
+Calendar._TT["PREV_YEAR"] = "Vorige jaar (hou vir keuselys)";
+Calendar._TT["PREV_MONTH"] = "Vorige maand (hou vir keuselys)";
+Calendar._TT["GO_TODAY"] = "Gaan na vandag";
+Calendar._TT["NEXT_MONTH"] = "Volgende maand (hou vir keuselys)";
+Calendar._TT["NEXT_YEAR"] = "Volgende jaar (hou vir keuselys)";
+Calendar._TT["SEL_DATE"] = "Kies datum";
+Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te skuif";
+Calendar._TT["PART_TODAY"] = " (vandag)";
+Calendar._TT["MON_FIRST"] = "Vertoon Maandag eerste";
+Calendar._TT["SUN_FIRST"] = "Display Sunday first";
+Calendar._TT["CLOSE"] = "Close";
+Calendar._TT["TODAY"] = "Today";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-al.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-al.js
new file mode 100644 (file)
index 0000000..4f701cf
--- /dev/null
@@ -0,0 +1,101 @@
+// Calendar ALBANIAN language
+//author Rigels Gordani rige@hotmail.com
+
+// ditet
+Calendar._DN = new Array
+("E Diele",
+"E Hene",
+"E Marte",
+"E Merkure",
+"E Enjte",
+"E Premte",
+"E Shtune",
+"E Diele");
+
+//ditet shkurt
+Calendar._SDN = new Array
+("Die",
+"Hen",
+"Mar",
+"Mer",
+"Enj",
+"Pre",
+"Sht",
+"Die");
+
+// muajt
+Calendar._MN = new Array
+("Janar",
+"Shkurt",
+"Mars",
+"Prill",
+"Maj",
+"Qeshor",
+"Korrik",
+"Gusht",
+"Shtator",
+"Tetor",
+"Nentor",
+"Dhjetor");
+
+// muajte shkurt
+Calendar._SMN = new Array
+("Jan",
+"Shk",
+"Mar",
+"Pri",
+"Maj",
+"Qes",
+"Kor",
+"Gus",
+"Sht",
+"Tet",
+"Nen",
+"Dhj");
+
+// ndihmesa
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Per kalendarin";
+
+Calendar._TT["ABOUT"] =
+"Zgjedhes i ores/dates ne DHTML \n" +
+"\n\n" +"Zgjedhja e Dates:\n" +
+"- Perdor butonat \xab, \xbb per te zgjedhur vitin\n" +
+"- Perdor  butonat" + String.fromCharCode(0x2039) + ", " + 
+String.fromCharCode(0x203a) +
+" per te  zgjedhur muajin\n" +
+"- Mbani shtypur butonin e mousit per nje zgjedje me te shpejte.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Zgjedhja e kohes:\n" +
+"- Kliko tek ndonje nga pjeset e ores per ta rritur ate\n" +
+"- ose kliko me Shift per ta zvogeluar ate\n" +
+"- ose cliko dhe terhiq per zgjedhje me te shpejte.";
+
+Calendar._TT["PREV_YEAR"] = "Viti i shkuar (prit per menune)";
+Calendar._TT["PREV_MONTH"] = "Muaji i shkuar (prit per menune)";
+Calendar._TT["GO_TODAY"] = "Sot";
+Calendar._TT["NEXT_MONTH"] = "Muaji i ardhshem (prit per menune)";
+Calendar._TT["NEXT_YEAR"] = "Viti i ardhshem (prit per menune)";
+Calendar._TT["SEL_DATE"] = "Zgjidh daten";
+Calendar._TT["DRAG_TO_MOVE"] = "Terhiqe per te levizur";
+Calendar._TT["PART_TODAY"] = " (sot)";
+
+// "%s" eshte dita e pare e javes
+// %s do te zevendesohet me emrin e dite
+Calendar._TT["DAY_FIRST"] = "Trego te %s te paren";
+
+
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Mbyll";
+Calendar._TT["TODAY"] = "Sot";
+Calendar._TT["TIME_PART"] = "Kliko me (Shift-)ose terhiqe per te ndryshuar 
+vleren";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "Java";
+Calendar._TT["TIME"] = "Koha:";
+
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-bg.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-bg.js
new file mode 100644 (file)
index 0000000..5eb73ec
--- /dev/null
@@ -0,0 +1,124 @@
+// ** I18N\r
+\r
+// Calendar BG language\r
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>\r
+// Translator: Valentin Sheiretsky, <valio@valio.eu.org>\r
+// Encoding: Windows-1251\r
+// Distributed under the same terms as the calendar itself.\r
+\r
+// For translators: please use UTF-8 if possible.  We strongly believe that\r
+// Unicode is the answer to a real internationalized world.  Also please\r
+// include your contact information in the header, as can be seen above.\r
+\r
+// full day names\r
+Calendar._DN = new Array\r
+("Íåäåëÿ",\r
+ "Ïîíåäåëíèê",\r
+ "Âòîðíèê",\r
+ "Ñðÿäà",\r
+ "×åòâúðòúê",\r
+ "Ïåòúê",\r
+ "Ñúáîòà",\r
+ "Íåäåëÿ");\r
+\r
+// Please note that the following array of short day names (and the same goes\r
+// for short month names, _SMN) isn't absolutely necessary.  We give it here\r
+// for exemplification on how one can customize the short day names, but if\r
+// they are simply the first N letters of the full name you can simply say:\r
+//\r
+//   Calendar._SDN_len = N; // short day name length\r
+//   Calendar._SMN_len = N; // short month name length\r
+//\r
+// If N = 3 then this is not needed either since we assume a value of 3 if not\r
+// present, to be compatible with translation files that were written before\r
+// this feature.\r
+\r
+// short day names\r
+Calendar._SDN = new Array\r
+("Íåä",\r
+ "Ïîí",\r
+ "Âòî",\r
+ "Ñðÿ",\r
+ "×åò",\r
+ "Ïåò",\r
+ "Ñúá",\r
+ "Íåä");\r
+\r
+// full month names\r
+Calendar._MN = new Array\r
+("ßíóàðè",\r
+ "Ôåâðóàðè",\r
+ "Ìàðò",\r
+ "Àïðèë",\r
+ "Ìàé",\r
+ "Þíè",\r
+ "Þëè",\r
+ "Àâãóñò",\r
+ "Ñåïòåìâðè",\r
+ "Îêòîìâðè",\r
+ "Íîåìâðè",\r
+ "Äåêåìâðè");\r
+\r
+// short month names\r
+Calendar._SMN = new Array\r
+("ßíó",\r
+ "Ôåâ",\r
+ "Ìàð",\r
+ "Àïð",\r
+ "Ìàé",\r
+ "Þíè",\r
+ "Þëè",\r
+ "Àâã",\r
+ "Ñåï",\r
+ "Îêò",\r
+ "Íîå",\r
+ "Äåê");\r
+\r
+// tooltips\r
+Calendar._TT = {};\r
+Calendar._TT["INFO"] = "Èíôîðìàöèÿ çà êàëåíäàðà";\r
+\r
+Calendar._TT["ABOUT"] =\r
+"DHTML Date/Time Selector\n" +\r
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)\r
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +\r
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +\r
+"\n\n" +\r
+"Date selection:\n" +\r
+"- Use the \xab, \xbb buttons to select year\n" +\r
+"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +\r
+"- Hold mouse button on any of the above buttons for faster selection.";\r
+Calendar._TT["ABOUT_TIME"] = "\n\n" +\r
+"Time selection:\n" +\r
+"- Click on any of the time parts to increase it\n" +\r
+"- or Shift-click to decrease it\n" +\r
+"- or click and drag for faster selection.";\r
+\r
+Calendar._TT["PREV_YEAR"] = "Ïðåäíà ãîäèíà (çàäðúæòå çà ìåíþ)";\r
+Calendar._TT["PREV_MONTH"] = "Ïðåäåí ìåñåö (çàäðúæòå çà ìåíþ)";\r
+Calendar._TT["GO_TODAY"] = "Èçáåðåòå äíåñ";\r
+Calendar._TT["NEXT_MONTH"] = "Ñëåäâàù ìåñåö (çàäðúæòå çà ìåíþ)";\r
+Calendar._TT["NEXT_YEAR"] = "Ñëåäâàùà ãîäèíà (çàäðúæòå çà ìåíþ)";\r
+Calendar._TT["SEL_DATE"] = "Èçáåðåòå äàòà";\r
+Calendar._TT["DRAG_TO_MOVE"] = "Ïðåìåñòâàíå";\r
+Calendar._TT["PART_TODAY"] = " (äíåñ)";\r
+\r
+// the following is to inform that "%s" is to be the first day of week\r
+// %s will be replaced with the day name.\r
+Calendar._TT["DAY_FIRST"] = "%s êàòî ïúðâè äåí";\r
+\r
+// This may be locale-dependent.  It specifies the week-end days, as an array\r
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1\r
+// means Monday, etc.\r
+Calendar._TT["WEEKEND"] = "0,6";\r
+\r
+Calendar._TT["CLOSE"] = "Çàòâîðåòå";\r
+Calendar._TT["TODAY"] = "Äíåñ";\r
+Calendar._TT["TIME_PART"] = "(Shift-)Click èëè drag çà äà ïðîìåíèòå ñòîéíîñòòà";\r
+\r
+// date formats\r
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";\r
+Calendar._TT["TT_DATE_FORMAT"] = "%A - %e %B %Y";\r
+\r
+Calendar._TT["WK"] = "Ñåäì";\r
+Calendar._TT["TIME"] = "×àñ:";\r
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-big5-utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-big5-utf8.js
new file mode 100644 (file)
index 0000000..14e0d5d
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar big5-utf8 language
+// Author: Gary Fu, <gary@garyfu.idv.tw>
+// Encoding: utf8
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+       
+// full day names
+Calendar._DN = new Array
+("星期日",
+ "星期一",
+ "星期二",
+ "星期三",
+ "星期四",
+ "星期五",
+ "星期六",
+ "星期日");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("日",
+ "一",
+ "二",
+ "三",
+ "四",
+ "五",
+ "六",
+ "日");
+
+// full month names
+Calendar._MN = new Array
+("一月",
+ "二月",
+ "三月",
+ "四月",
+ "五月",
+ "六月",
+ "七月",
+ "八月",
+ "九月",
+ "十月",
+ "十一月",
+ "十二月");
+
+// short month names
+Calendar._SMN = new Array
+("一月",
+ "二月",
+ "三月",
+ "四月",
+ "五月",
+ "六月",
+ "七月",
+ "八月",
+ "九月",
+ "十月",
+ "十一月",
+ "十二月");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "關於";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"日期選擇方法:\n" +
+"- 使用 \xab, \xbb 按鈕可選擇年份\n" +
+"- 使用 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 按鈕可選擇月份\n" +
+"- 按住上面的按鈕可以加快選取";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"時間選擇方法:\n" +
+"- 點擊任何的時間部份可增加其值\n" +
+"- 同時按Shift鍵再點擊可減少其值\n" +
+"- 點擊並拖曳可加快改變的值";
+
+Calendar._TT["PREV_YEAR"] = "上一年 (按住選單)";
+Calendar._TT["PREV_MONTH"] = "下一年 (按住選單)";
+Calendar._TT["GO_TODAY"] = "到今日";
+Calendar._TT["NEXT_MONTH"] = "上一月 (按住選單)";
+Calendar._TT["NEXT_YEAR"] = "下一月 (按住選單)";
+Calendar._TT["SEL_DATE"] = "選擇日期";
+Calendar._TT["DRAG_TO_MOVE"] = "拖曳";
+Calendar._TT["PART_TODAY"] = " (今日)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "將 %s 顯示在前";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "關閉";
+Calendar._TT["TODAY"] = "今日";
+Calendar._TT["TIME_PART"] = "點擊or拖曳可改變時間(同時按Shift為減)";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "週";
+Calendar._TT["TIME"] = "Time:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-big5.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-big5.js
new file mode 100644 (file)
index 0000000..a589358
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar big5 language
+// Author: Gary Fu, <gary@garyfu.idv.tw>
+// Encoding: big5
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+       
+// full day names
+Calendar._DN = new Array
+("¬P´Á¤é",
+ "¬P´Á¤@",
+ "¬P´Á¤G",
+ "¬P´Á¤T",
+ "¬P´Á¥|",
+ "¬P´Á¤­",
+ "¬P´Á¤»",
+ "¬P´Á¤é");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("¤é",
+ "¤@",
+ "¤G",
+ "¤T",
+ "¥|",
+ "¤­",
+ "¤»",
+ "¤é");
+
+// full month names
+Calendar._MN = new Array
+("¤@¤ë",
+ "¤G¤ë",
+ "¤T¤ë",
+ "¥|¤ë",
+ "¤­¤ë",
+ "¤»¤ë",
+ "¤C¤ë",
+ "¤K¤ë",
+ "¤E¤ë",
+ "¤Q¤ë",
+ "¤Q¤@¤ë",
+ "¤Q¤G¤ë");
+
+// short month names
+Calendar._SMN = new Array
+("¤@¤ë",
+ "¤G¤ë",
+ "¤T¤ë",
+ "¥|¤ë",
+ "¤­¤ë",
+ "¤»¤ë",
+ "¤C¤ë",
+ "¤K¤ë",
+ "¤E¤ë",
+ "¤Q¤ë",
+ "¤Q¤@¤ë",
+ "¤Q¤G¤ë");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Ãö©ó";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"¤é´Á¿ï¾Ü¤èªk:\n" +
+"- ¨Ï¥Î \xab, \xbb «ö¶s¥i¿ï¾Ü¦~¥÷\n" +
+"- ¨Ï¥Î " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " «ö¶s¥i¿ï¾Ü¤ë¥÷\n" +
+"- «ö¦í¤W­±ªº«ö¶s¥i¥H¥[§Ö¿ï¨ú";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"®É¶¡¿ï¾Ü¤èªk:\n" +
+"- ÂIÀ»¥ô¦óªº®É¶¡³¡¥÷¥i¼W¥[¨ä­È\n" +
+"- ¦P®É«öShiftÁä¦AÂIÀ»¥i´î¤Ö¨ä­È\n" +
+"- ÂIÀ»¨Ã©ì¦²¥i¥[§Ö§ïÅܪº­È";
+
+Calendar._TT["PREV_YEAR"] = "¤W¤@¦~ («ö¦í¿ï³æ)";
+Calendar._TT["PREV_MONTH"] = "¤U¤@¦~ («ö¦í¿ï³æ)";
+Calendar._TT["GO_TODAY"] = "¨ì¤µ¤é";
+Calendar._TT["NEXT_MONTH"] = "¤W¤@¤ë («ö¦í¿ï³æ)";
+Calendar._TT["NEXT_YEAR"] = "¤U¤@¤ë («ö¦í¿ï³æ)";
+Calendar._TT["SEL_DATE"] = "¿ï¾Ü¤é´Á";
+Calendar._TT["DRAG_TO_MOVE"] = "©ì¦²";
+Calendar._TT["PART_TODAY"] = " (¤µ¤é)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "±N %s Åã¥Ü¦b«e";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Ãö³¬";
+Calendar._TT["TODAY"] = "¤µ¤é";
+Calendar._TT["TIME_PART"] = "ÂIÀ»or©ì¦²¥i§ïÅܮɶ¡(¦P®É«öShift¬°´î)";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "¶g";
+Calendar._TT["TIME"] = "Time:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-br.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-br.js
new file mode 100644 (file)
index 0000000..bfb0747
--- /dev/null
@@ -0,0 +1,108 @@
+// ** I18N
+
+// Calendar pt-BR language
+// Author: Fernando Dourado, <fernando.dourado@ig.com.br>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Domingo",
+ "Segunda",
+ "Terça",
+ "Quarta",
+ "Quinta",
+ "Sexta",
+ "Sabádo",
+ "Domingo");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+// [No changes using default values]
+
+// full month names
+Calendar._MN = new Array
+("Janeiro",
+ "Fevereiro",
+ "Março",
+ "Abril",
+ "Maio",
+ "Junho",
+ "Julho",
+ "Agosto",
+ "Setembro",
+ "Outubro",
+ "Novembro",
+ "Dezembro");
+
+// short month names
+// [No changes using default values]
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Sobre o calendário";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Translate to portuguese Brazil (pt-BR) by Fernando Dourado (fernando.dourado@ig.com.br)\n" +
+"Tradução para o português Brasil (pt-BR) por Fernando Dourado (fernando.dourado@ig.com.br)" +
+"\n\n" +
+"Selecionar data:\n" +
+"- Use as teclas \xab, \xbb para selecionar o ano\n" +
+"- Use as teclas " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mês\n" +
+"- Clique e segure com o mouse em qualquer botão para selecionar rapidamente.";
+
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Selecionar hora:\n" +
+"- Clique em qualquer uma das partes da hora para aumentar\n" +
+"- ou Shift-clique para diminuir\n" +
+"- ou clique e arraste para selecionar rapidamente.";
+
+Calendar._TT["PREV_YEAR"] = "Ano anterior (clique e segure para menu)";
+Calendar._TT["PREV_MONTH"] = "Mês anterior (clique e segure para menu)";
+Calendar._TT["GO_TODAY"] = "Ir para a data atual";
+Calendar._TT["NEXT_MONTH"] = "Próximo mês (clique e segure para menu)";
+Calendar._TT["NEXT_YEAR"] = "Próximo ano (clique e segure para menu)";
+Calendar._TT["SEL_DATE"] = "Selecione uma data";
+Calendar._TT["DRAG_TO_MOVE"] = "Clique e segure para mover";
+Calendar._TT["PART_TODAY"] = " (hoje)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Exibir %s primeiro";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Fechar";
+Calendar._TT["TODAY"] = "Hoje";
+Calendar._TT["TIME_PART"] = "(Shift-)Clique ou arraste para mudar o valor";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%d de %B de %Y";
+
+Calendar._TT["WK"] = "sem";
+Calendar._TT["TIME"] = "Hora:";
+
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ca.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ca.js
new file mode 100644 (file)
index 0000000..a2121bc
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar CA language
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Diumenge",
+ "Dilluns",
+ "Dimarts",
+ "Dimecres",
+ "Dijous",
+ "Divendres",
+ "Dissabte",
+ "Diumenge");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Diu",
+ "Dil",
+ "Dmt",
+ "Dmc",
+ "Dij",
+ "Div",
+ "Dis",
+ "Diu");
+
+// full month names
+Calendar._MN = new Array
+("Gener",
+ "Febrer",
+ "Març",
+ "Abril",
+ "Maig",
+ "Juny",
+ "Juliol",
+ "Agost",
+ "Setembre",
+ "Octubre",
+ "Novembre",
+ "Desembre");
+
+// short month names
+Calendar._SMN = new Array
+("Gen",
+ "Feb",
+ "Mar",
+ "Abr",
+ "Mai",
+ "Jun",
+ "Jul",
+ "Ago",
+ "Set",
+ "Oct",
+ "Nov",
+ "Des");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Sobre el calendari";
+
+Calendar._TT["ABOUT"] =
+"DHTML Selector de Data/Hora\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Sel.lecció de Dates:\n" +
+"- Fes servir els botons \xab, \xbb per sel.leccionar l'any\n" +
+"- Fes servir els botons " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per se.lecciconar el mes\n" +
+"- Manté el ratolí apretat en qualsevol dels anteriors per sel.lecció ràpida.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Time selection:\n" +
+"- claca en qualsevol de les parts de la hora per augmentar-les\n" +
+"- o Shift-click per decrementar-la\n" +
+"- or click and arrastra per sel.lecció ràpida.";
+
+Calendar._TT["PREV_YEAR"] = "Any anterior (Mantenir per menu)";
+Calendar._TT["PREV_MONTH"] = "Mes anterior (Mantenir per menu)";
+Calendar._TT["GO_TODAY"] = "Anar a avui";
+Calendar._TT["NEXT_MONTH"] = "Mes següent (Mantenir per menu)";
+Calendar._TT["NEXT_YEAR"] = "Any següent (Mantenir per menu)";
+Calendar._TT["SEL_DATE"] = "Sel.leccionar data";
+Calendar._TT["DRAG_TO_MOVE"] = "Arrastrar per moure";
+Calendar._TT["PART_TODAY"] = " (avui)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Mostra %s primer";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Tanca";
+Calendar._TT["TODAY"] = "Avui";
+Calendar._TT["TIME_PART"] = "(Shift-)Click a arrastra per canviar el valor";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "st";
+Calendar._TT["TIME"] = "Hora:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-cs-utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-cs-utf8.js
new file mode 100644 (file)
index 0000000..f6bbbeb
--- /dev/null
@@ -0,0 +1,65 @@
+/* 
+       calendar-cs-win.js
+       language: Czech
+       encoding: windows-1250
+       author: Lubos Jerabek (xnet@seznam.cz)
+               Jan Uhlir (espinosa@centrum.cz)
+*/
+
+// ** I18N
+Calendar._DN  = new Array('Neděle','Pondělí','Úterý','Středa','Čtvrtek','Pátek','Sobota','Neděle');
+Calendar._SDN = new Array('Ne','Po','Út','St','Čt','Pá','So','Ne');
+Calendar._MN  = new Array('Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Prosinec');
+Calendar._SMN = new Array('Led','Úno','Bře','Dub','Kvě','Črv','Čvc','Srp','Zář','Říj','Lis','Pro');
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "O komponentě kalendář";
+Calendar._TT["TOGGLE"] = "Změna prvního dne v týdnu";
+Calendar._TT["PREV_YEAR"] = "Předchozí rok (přidrž pro menu)";
+Calendar._TT["PREV_MONTH"] = "Předchozí měsíc (přidrž pro menu)";
+Calendar._TT["GO_TODAY"] = "Dnešní datum";
+Calendar._TT["NEXT_MONTH"] = "Další měsíc (přidrž pro menu)";
+Calendar._TT["NEXT_YEAR"] = "Další rok (přidrž pro menu)";
+Calendar._TT["SEL_DATE"] = "Vyber datum";
+Calendar._TT["DRAG_TO_MOVE"] = "Chyť a táhni, pro přesun";
+Calendar._TT["PART_TODAY"] = " (dnes)";
+Calendar._TT["MON_FIRST"] = "Ukaž jako první Pondělí";
+//Calendar._TT["SUN_FIRST"] = "Ukaž jako první Neděli";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Výběr datumu:\n" +
+"- Use the \xab, \xbb buttons to select year\n" +
+"- Použijte tlačítka " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " k výběru měsíce\n" +
+"- Podržte tlačítko myši na jakémkoliv z těch tlačítek pro rychlejší výběr.";
+
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Výběr času:\n" +
+"- Klikněte na jakoukoliv z částí výběru času pro zvýšení.\n" +
+"- nebo Shift-click pro snížení\n" +
+"- nebo klikněte a táhněte pro rychlejší výběr.";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Zobraz %s první";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Zavřít";
+Calendar._TT["TODAY"] = "Dnes";
+Calendar._TT["TIME_PART"] = "(Shift-)Klikni nebo táhni pro změnu hodnoty";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "d.m.yy";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "wk";
+Calendar._TT["TIME"] = "Čas:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-cs-win.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-cs-win.js
new file mode 100644 (file)
index 0000000..140dff3
--- /dev/null
@@ -0,0 +1,65 @@
+/* 
+       calendar-cs-win.js
+       language: Czech
+       encoding: windows-1250
+       author: Lubos Jerabek (xnet@seznam.cz)
+               Jan Uhlir (espinosa@centrum.cz)
+*/
+
+// ** I18N
+Calendar._DN  = new Array('Nedìle','Pondìlí','Úterý','Støeda','Ètvrtek','Pátek','Sobota','Nedìle');
+Calendar._SDN = new Array('Ne','Po','Út','St','Èt','Pá','So','Ne');
+Calendar._MN  = new Array('Leden','Únor','Bøezen','Duben','Kvìten','Èerven','Èervenec','Srpen','Záøí','Øíjen','Listopad','Prosinec');
+Calendar._SMN = new Array('Led','Úno','Bøe','Dub','Kvì','Èrv','Èvc','Srp','Záø','Øíj','Lis','Pro');
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "O komponentì kalendáø";
+Calendar._TT["TOGGLE"] = "Zmìna prvního dne v týdnu";
+Calendar._TT["PREV_YEAR"] = "Pøedchozí rok (pøidr\9e pro menu)";
+Calendar._TT["PREV_MONTH"] = "Pøedchozí mìsíc (pøidr\9e pro menu)";
+Calendar._TT["GO_TODAY"] = "Dne\9aní datum";
+Calendar._TT["NEXT_MONTH"] = "Dal\9aí mìsíc (pøidr\9e pro menu)";
+Calendar._TT["NEXT_YEAR"] = "Dal\9aí rok (pøidr\9e pro menu)";
+Calendar._TT["SEL_DATE"] = "Vyber datum";
+Calendar._TT["DRAG_TO_MOVE"] = "Chy\9d a táhni, pro pøesun";
+Calendar._TT["PART_TODAY"] = " (dnes)";
+Calendar._TT["MON_FIRST"] = "Uka\9e jako první Pondìlí";
+//Calendar._TT["SUN_FIRST"] = "Uka\9e jako první Nedìli";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Výbìr datumu:\n" +
+"- Use the \xab, \xbb buttons to select year\n" +
+"- Pou\9eijte tlaèítka " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " k výbìru mìsíce\n" +
+"- Podr\9ete tlaèítko my\9ai na jakémkoliv z tìch tlaèítek pro rychlej\9aí výbìr.";
+
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Výbìr èasu:\n" +
+"- Kliknìte na jakoukoliv z èástí výbìru èasu pro zvý\9aení.\n" +
+"- nebo Shift-click pro sní\9eení\n" +
+"- nebo kliknìte a táhnìte pro rychlej\9aí výbìr.";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Zobraz %s první";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Zavøít";
+Calendar._TT["TODAY"] = "Dnes";
+Calendar._TT["TIME_PART"] = "(Shift-)Klikni nebo táhni pro zmìnu hodnoty";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "d.m.yy";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "wk";
+Calendar._TT["TIME"] = "Èas:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-da.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-da.js
new file mode 100644 (file)
index 0000000..a99b598
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar DA language
+// Author: Michael Thingmand Henriksen, <michael (a) thingmand dot dk>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible. We strongly believe that
+// Unicode is the answer to a real internationalized world. Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Søndag",
+"Mandag",
+"Tirsdag",
+"Onsdag",
+"Torsdag",
+"Fredag",
+"Lørdag",
+"Søndag");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary. We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+// Calendar._SDN_len = N; // short day name length
+// Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Søn",
+"Man",
+"Tir",
+"Ons",
+"Tor",
+"Fre",
+"Lør",
+"Søn");
+
+// full month names
+Calendar._MN = new Array
+("Januar",
+"Februar",
+"Marts",
+"April",
+"Maj",
+"Juni",
+"Juli",
+"August",
+"September",
+"Oktober",
+"November",
+"December");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+"Feb",
+"Mar",
+"Apr",
+"Maj",
+"Jun",
+"Jul",
+"Aug",
+"Sep",
+"Okt",
+"Nov",
+"Dec");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Om Kalenderen";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For den seneste version besøg: http://www.dynarch.com/projects/calendar/\n"; +
+"Distribueret under GNU LGPL. Se http://gnu.org/licenses/lgpl.html for detajler." +
+"\n\n" +
+"Valg af dato:\n" +
+"- Brug \xab, \xbb knapperne for at vælge år\n" +
+"- Brug " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knapperne for at vælge måned\n" +
+"- Hold knappen på musen nede på knapperne ovenfor for hurtigere valg.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Valg af tid:\n" +
+"- Klik på en vilkårlig del for større værdi\n" +
+"- eller Shift-klik for for mindre værdi\n" +
+"- eller klik og træk for hurtigere valg.";
+
+Calendar._TT["PREV_YEAR"] = "Ét år tilbage (hold for menu)";
+Calendar._TT["PREV_MONTH"] = "Én måned tilbage (hold for menu)";
+Calendar._TT["GO_TODAY"] = "Gå til i dag";
+Calendar._TT["NEXT_MONTH"] = "Én måned frem (hold for menu)";
+Calendar._TT["NEXT_YEAR"] = "Ét år frem (hold for menu)";
+Calendar._TT["SEL_DATE"] = "Vælg dag";
+Calendar._TT["DRAG_TO_MOVE"] = "Træk vinduet";
+Calendar._TT["PART_TODAY"] = " (i dag)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Vis %s først";
+
+// This may be locale-dependent. It specifies the week-end days, as an array
+// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Luk";
+Calendar._TT["TODAY"] = "I dag";
+Calendar._TT["TIME_PART"] = "(Shift-)klik eller træk for at ændre værdi";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "Uge";
+Calendar._TT["TIME"] = "Tid:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-de.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-de.js
new file mode 100644 (file)
index 0000000..4bc1137
--- /dev/null
@@ -0,0 +1,124 @@
+// ** I18N
+
+// Calendar DE language
+// Author: Jack (tR), <jack@jtr.de>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Sonntag",
+ "Montag",
+ "Dienstag",
+ "Mittwoch",
+ "Donnerstag",
+ "Freitag",
+ "Samstag",
+ "Sonntag");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("So",
+ "Mo",
+ "Di",
+ "Mi",
+ "Do",
+ "Fr",
+ "Sa",
+ "So");
+
+// full month names
+Calendar._MN = new Array
+("Januar",
+ "Februar",
+ "M\u00e4rz",
+ "April",
+ "Mai",
+ "Juni",
+ "Juli",
+ "August",
+ "September",
+ "Oktober",
+ "November",
+ "Dezember");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+ "Feb",
+ "M\u00e4r",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Okt",
+ "Nov",
+ "Dez");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "\u00DCber dieses Kalendarmodul";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Datum ausw\u00e4hlen:\n" +
+"- Benutzen Sie die \xab, \xbb Buttons um das Jahr zu w\u00e4hlen\n" +
+"- Benutzen Sie die " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " Buttons um den Monat zu w\u00e4hlen\n" +
+"- F\u00fcr eine Schnellauswahl halten Sie die Maustaste \u00fcber diesen Buttons fest.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Zeit ausw\u00e4hlen:\n" +
+"- Klicken Sie auf die Teile der Uhrzeit, um diese zu erh\u00F6hen\n" +
+"- oder klicken Sie mit festgehaltener Shift-Taste um diese zu verringern\n" +
+"- oder klicken und festhalten f\u00fcr Schnellauswahl.";
+
+Calendar._TT["TOGGLE"] = "Ersten Tag der Woche w\u00e4hlen";
+Calendar._TT["PREV_YEAR"] = "Voriges Jahr (Festhalten f\u00fcr Schnellauswahl)";
+Calendar._TT["PREV_MONTH"] = "Voriger Monat (Festhalten f\u00fcr Schnellauswahl)";
+Calendar._TT["GO_TODAY"] = "Heute ausw\u00e4hlen";
+Calendar._TT["NEXT_MONTH"] = "N\u00e4chst. Monat (Festhalten f\u00fcr Schnellauswahl)";
+Calendar._TT["NEXT_YEAR"] = "N\u00e4chst. Jahr (Festhalten f\u00fcr Schnellauswahl)";
+Calendar._TT["SEL_DATE"] = "Datum ausw\u00e4hlen";
+Calendar._TT["DRAG_TO_MOVE"] = "Zum Bewegen festhalten";
+Calendar._TT["PART_TODAY"] = " (Heute)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Woche beginnt mit %s ";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Schlie\u00dfen";
+Calendar._TT["TODAY"] = "Heute";
+Calendar._TT["TIME_PART"] = "(Shift-)Klick oder Festhalten und Ziehen um den Wert zu \u00e4ndern";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "wk";
+Calendar._TT["TIME"] = "Zeit:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-du.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-du.js
new file mode 100644 (file)
index 0000000..2200448
--- /dev/null
@@ -0,0 +1,45 @@
+// ** I18N
+Calendar._DN = new Array
+("Zondag",
+ "Maandag",
+ "Dinsdag",
+ "Woensdag",
+ "Donderdag",
+ "Vrijdag",
+ "Zaterdag",
+ "Zondag");
+Calendar._MN = new Array
+("Januari",
+ "Februari",
+ "Maart",
+ "April",
+ "Mei",
+ "Juni",
+ "Juli",
+ "Augustus",
+ "September",
+ "Oktober",
+ "November",
+ "December");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["TOGGLE"] = "Toggle startdag van de week";
+Calendar._TT["PREV_YEAR"] = "Vorig jaar (indrukken voor menu)";
+Calendar._TT["PREV_MONTH"] = "Vorige month (indrukken voor menu)";
+Calendar._TT["GO_TODAY"] = "Naar Vandaag";
+Calendar._TT["NEXT_MONTH"] = "Volgende Maand (indrukken voor menu)";
+Calendar._TT["NEXT_YEAR"] = "Volgend jaar (indrukken voor menu)";
+Calendar._TT["SEL_DATE"] = "Selecteer datum";
+Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te verplaatsen";
+Calendar._TT["PART_TODAY"] = " (vandaag)";
+Calendar._TT["MON_FIRST"] = "Toon Maandag eerst";
+Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst";
+Calendar._TT["CLOSE"] = "Sluiten";
+Calendar._TT["TODAY"] = "Vandaag";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd";
+Calendar._TT["TT_DATE_FORMAT"] = "D, M d";
+
+Calendar._TT["WK"] = "wk";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-el.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-el.js
new file mode 100644 (file)
index 0000000..43a9b2c
--- /dev/null
@@ -0,0 +1,89 @@
+// ** I18N\r
+Calendar._DN = new Array\r
+("Κυριακή",\r
+ "Δευτέρα",\r
+ "Τρίτη",\r
+ "Τετάρτη",\r
+ "Πέμπτη",\r
+ "Παρασκευή",\r
+ "Σάββατο",\r
+ "Κυριακή");\r
+\r
+Calendar._SDN = new Array\r
+("Κυ",\r
+ "Δε",\r
+ "Tρ",\r
+ "Τε",\r
+ "Πε",\r
+ "Πα",\r
+ "Σα",\r
+ "Κυ");\r
+\r
+Calendar._MN = new Array\r
+("Ιανουάριος",\r
+ "Φεβρουάριος",\r
+ "Μάρτιος",\r
+ "Απρίλιος",\r
+ "Μάϊος",\r
+ "Ιούνιος",\r
+ "Ιούλιος",\r
+ "Αύγουστος",\r
+ "Σεπτέμβριος",\r
+ "Οκτώβριος",\r
+ "Νοέμβριος",\r
+ "Δεκέμβριος");\r
+\r
+Calendar._SMN = new Array\r
+("Ιαν",\r
+ "Φεβ",\r
+ "Μαρ",\r
+ "Απρ",\r
+ "Μαι",\r
+ "Ιουν",\r
+ "Ιουλ",\r
+ "Αυγ",\r
+ "Σεπ",\r
+ "Οκτ",\r
+ "Νοε",\r
+ "Δεκ");\r
+\r
+// tooltips\r
+Calendar._TT = {};\r
+Calendar._TT["INFO"] = "Για το ημερολόγιο";\r
+\r
+Calendar._TT["ABOUT"] =\r
+"Επιλογέας ημερομηνίας/ώρας σε DHTML\n" +\r
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)\r
+"Για τελευταία έκδοση: http://www.dynarch.com/projects/calendar/\n" +\r
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +\r
+"\n\n" +\r
+"Επιλογή ημερομηνίας:\n" +\r
+"- Χρησιμοποιείστε τα κουμπιά \xab, \xbb για επιλογή έτους\n" +\r
+"- Χρησιμοποιείστε τα κουμπιά " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " για επιλογή μήνα\n" +\r
+"- Κρατήστε κουμπί ποντικού πατημένο στα παραπάνω κουμπιά για πιο γρήγορη επιλογή.";\r
+Calendar._TT["ABOUT_TIME"] = "\n\n" +\r
+"Επιλογή ώρας:\n" +\r
+"- Κάντε κλικ σε ένα από τα μέρη της ώρας για αύξηση\n" +\r
+"- ή Shift-κλικ για μείωση\n" +\r
+"- ή κλικ και μετακίνηση για πιο γρήγορη επιλογή.";\r
+Calendar._TT["TOGGLE"] = "Μπάρα πρώτης ημέρας της εβδομάδας";\r
+Calendar._TT["PREV_YEAR"] = "Προηγ. έτος (κρατήστε για το μενού)";\r
+Calendar._TT["PREV_MONTH"] = "Προηγ. μήνας (κρατήστε για το μενού)";\r
+Calendar._TT["GO_TODAY"] = "Σήμερα";\r
+Calendar._TT["NEXT_MONTH"] = "Επόμενος μήνας (κρατήστε για το μενού)";\r
+Calendar._TT["NEXT_YEAR"] = "Επόμενο έτος (κρατήστε για το μενού)";\r
+Calendar._TT["SEL_DATE"] = "Επιλέξτε ημερομηνία";\r
+Calendar._TT["DRAG_TO_MOVE"] = "Σύρτε για να μετακινήσετε";\r
+Calendar._TT["PART_TODAY"] = " (σήμερα)";\r
+Calendar._TT["MON_FIRST"] = "Εμφάνιση Δευτέρας πρώτα";\r
+Calendar._TT["SUN_FIRST"] = "Εμφάνιση Κυριακής πρώτα";\r
+Calendar._TT["CLOSE"] = "Κλείσιμο";\r
+Calendar._TT["TODAY"] = "Σήμερα";\r
+Calendar._TT["TIME_PART"] = "(Shift-)κλικ ή μετακίνηση για αλλαγή";\r
+\r
+// date formats\r
+Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y";\r
+Calendar._TT["TT_DATE_FORMAT"] = "D, d M";\r
+\r
+Calendar._TT["WK"] = "εβδ";\r
+\r
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-en.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-en.js
new file mode 100644 (file)
index 0000000..0dbde79
--- /dev/null
@@ -0,0 +1,127 @@
+// ** I18N
+
+// Calendar EN language
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday",
+ "Sunday");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Sun",
+ "Mon",
+ "Tue",
+ "Wed",
+ "Thu",
+ "Fri",
+ "Sat",
+ "Sun");
+
+// First day of the week. "0" means display Sunday first, "1" means display
+// Monday first, etc.
+Calendar._FD = 0;
+
+// full month names
+Calendar._MN = new Array
+("January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "About the calendar";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Date selection:\n" +
+"- Use the \xab, \xbb buttons to select year\n" +
+"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
+"- Hold mouse button on any of the above buttons for faster selection.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Time selection:\n" +
+"- Click on any of the time parts to increase it\n" +
+"- or Shift-click to decrease it\n" +
+"- or click and drag for faster selection.";
+
+Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)";
+Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)";
+Calendar._TT["GO_TODAY"] = "Go Today";
+Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)";
+Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)";
+Calendar._TT["SEL_DATE"] = "Select date";
+Calendar._TT["DRAG_TO_MOVE"] = "Drag to move";
+Calendar._TT["PART_TODAY"] = " (today)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Display %s first";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Close";
+Calendar._TT["TODAY"] = "Today";
+Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "wk";
+Calendar._TT["TIME"] = "Time:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-es.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-es.js
new file mode 100644 (file)
index 0000000..19c1b30
--- /dev/null
@@ -0,0 +1,129 @@
+// ** I18N
+
+// Calendar ES (spanish) language
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Updater: Servilio Afre Puentes <servilios@yahoo.com>
+// Updated: 2004-06-03
+// Encoding: utf-8
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Domingo",
+ "Lunes",
+ "Martes",
+ "Miércoles",
+ "Jueves",
+ "Viernes",
+ "Sábado",
+ "Domingo");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Dom",
+ "Lun",
+ "Mar",
+ "Mié",
+ "Jue",
+ "Vie",
+ "Sáb",
+ "Dom");
+
+// First day of the week. "0" means display Sunday first, "1" means display
+// Monday first, etc.
+Calendar._FD = 1;
+
+// full month names
+Calendar._MN = new Array
+("Enero",
+ "Febrero",
+ "Marzo",
+ "Abril",
+ "Mayo",
+ "Junio",
+ "Julio",
+ "Agosto",
+ "Septiembre",
+ "Octubre",
+ "Noviembre",
+ "Diciembre");
+
+// short month names
+Calendar._SMN = new Array
+("Ene",
+ "Feb",
+ "Mar",
+ "Abr",
+ "May",
+ "Jun",
+ "Jul",
+ "Ago",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dic");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Acerca del calendario";
+
+Calendar._TT["ABOUT"] =
+"Selector DHTML de Fecha/Hora\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Para conseguir la última versión visite: http://www.dynarch.com/projects/calendar/\n" +
+"Distribuido bajo licencia GNU LGPL. Visite http://gnu.org/licenses/lgpl.html para más detalles." +
+"\n\n" +
+"Selección de fecha:\n" +
+"- Use los botones \xab, \xbb para seleccionar el año\n" +
+"- Use los botones " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para seleccionar el mes\n" +
+"- Mantenga pulsado el ratón en cualquiera de estos botones para una selección rápida.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Selección de hora:\n" +
+"- Pulse en cualquiera de las partes de la hora para incrementarla\n" +
+"- o pulse las mayúsculas mientras hace clic para decrementarla\n" +
+"- o haga clic y arrastre el ratón para una selección más rápida.";
+
+Calendar._TT["PREV_YEAR"] = "Año anterior (mantener para menú)";
+Calendar._TT["PREV_MONTH"] = "Mes anterior (mantener para menú)";
+Calendar._TT["GO_TODAY"] = "Ir a hoy";
+Calendar._TT["NEXT_MONTH"] = "Mes siguiente (mantener para menú)";
+Calendar._TT["NEXT_YEAR"] = "Año siguiente (mantener para menú)";
+Calendar._TT["SEL_DATE"] = "Seleccionar fecha";
+Calendar._TT["DRAG_TO_MOVE"] = "Arrastrar para mover";
+Calendar._TT["PART_TODAY"] = " (hoy)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Hacer %s primer día de la semana";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Cerrar";
+Calendar._TT["TODAY"] = "Hoy";
+Calendar._TT["TIME_PART"] = "(Mayúscula-)Clic o arrastre para cambiar valor";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%A, %e de %B de %Y";
+
+Calendar._TT["WK"] = "sem";
+Calendar._TT["TIME"] = "Hora:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-fi.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-fi.js
new file mode 100644 (file)
index 0000000..328eabb
--- /dev/null
@@ -0,0 +1,98 @@
+// ** I18N
+
+// Calendar FI language (Finnish, Suomi)
+// Author: Jarno Käyhkö, <gambler@phnet.fi>
+// Encoding: UTF-8
+// Distributed under the same terms as the calendar itself.
+
+// full day names
+Calendar._DN = new Array
+("Sunnuntai",
+ "Maanantai",
+ "Tiistai",
+ "Keskiviikko",
+ "Torstai",
+ "Perjantai",
+ "Lauantai",
+ "Sunnuntai");
+
+// short day names
+Calendar._SDN = new Array
+("Su",
+ "Ma",
+ "Ti",
+ "Ke",
+ "To",
+ "Pe",
+ "La",
+ "Su");
+
+// full month names
+Calendar._MN = new Array
+("Tammikuu",
+ "Helmikuu",
+ "Maaliskuu",
+ "Huhtikuu",
+ "Toukokuu",
+ "Kesäkuu",
+ "Heinäkuu",
+ "Elokuu",
+ "Syyskuu",
+ "Lokakuu",
+ "Marraskuu",
+ "Joulukuu");
+
+// short month names
+Calendar._SMN = new Array
+("Tam",
+ "Hel",
+ "Maa",
+ "Huh",
+ "Tou",
+ "Kes",
+ "Hei",
+ "Elo",
+ "Syy",
+ "Lok",
+ "Mar",
+ "Jou");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Tietoja kalenterista";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Uusin versio osoitteessa: http://www.dynarch.com/projects/calendar/\n" +
+"Julkaistu GNU LGPL lisenssin alaisuudessa. Lisätietoja osoitteessa http://gnu.org/licenses/lgpl.html" +
+"\n\n" +
+"Päivämäärä valinta:\n" +
+"- Käytä \xab, \xbb painikkeita valitaksesi vuosi\n" +
+"- Käytä " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " painikkeita valitaksesi kuukausi\n" +
+"- Pitämällä hiiren painiketta minkä tahansa yllä olevan painikkeen kohdalla, saat näkyviin valikon nopeampaan siirtymiseen.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Ajan valinta:\n" +
+"- Klikkaa kellonajan numeroita lisätäksesi aikaa\n" +
+"- tai pitämällä Shift-näppäintä pohjassa saat aikaa taaksepäin\n" +
+"- tai klikkaa ja pidä hiiren painike pohjassa sekä liikuta hiirtä muuttaaksesi aikaa nopeasti eteen- ja taaksepäin.";
+
+Calendar._TT["PREV_YEAR"] = "Edell. vuosi (paina hetki, näet valikon)";
+Calendar._TT["PREV_MONTH"] = "Edell. kuukausi (paina hetki, näet valikon)";
+Calendar._TT["GO_TODAY"] = "Siirry tähän päivään";
+Calendar._TT["NEXT_MONTH"] = "Seur. kuukausi (paina hetki, näet valikon)";
+Calendar._TT["NEXT_YEAR"] = "Seur. vuosi (paina hetki, näet valikon)";
+Calendar._TT["SEL_DATE"] = "Valitse päivämäärä";
+Calendar._TT["DRAG_TO_MOVE"] = "Siirrä kalenterin paikkaa";
+Calendar._TT["PART_TODAY"] = " (tänään)";
+Calendar._TT["MON_FIRST"] = "Näytä maanantai ensimmäisenä";
+Calendar._TT["SUN_FIRST"] = "Näytä sunnuntai ensimmäisenä";
+Calendar._TT["CLOSE"] = "Sulje";
+Calendar._TT["TODAY"] = "Tänään";
+Calendar._TT["TIME_PART"] = "(Shift-) Klikkaa tai liikuta muuttaaksesi aikaa";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%d.%m.%Y";
+
+Calendar._TT["WK"] = "Vko";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-fr.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-fr.js
new file mode 100644 (file)
index 0000000..2a9e0b2
--- /dev/null
@@ -0,0 +1,125 @@
+// ** I18N
+
+// Calendar EN language
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// Translator: David Duret, <pilgrim@mala-template.net> from previous french version
+
+// full day names
+Calendar._DN = new Array
+("Dimanche",
+ "Lundi",
+ "Mardi",
+ "Mercredi",
+ "Jeudi",
+ "Vendredi",
+ "Samedi",
+ "Dimanche");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Dim",
+ "Lun",
+ "Mar",
+ "Mar",
+ "Jeu",
+ "Ven",
+ "Sam",
+ "Dim");
+
+// full month names
+Calendar._MN = new Array
+("Janvier",
+ "Février",
+ "Mars",
+ "Avril",
+ "Mai",
+ "Juin",
+ "Juillet",
+ "Août",
+ "Septembre",
+ "Octobre",
+ "Novembre",
+ "Décembre");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+ "Fev",
+ "Mar",
+ "Avr",
+ "Mai",
+ "Juin",
+ "Juil",
+ "Aout",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "A propos du calendrier";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Heure Selecteur\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Pour la derniere version visitez : http://www.dynarch.com/projects/calendar/\n" +
+"Distribué par GNU LGPL.  Voir http://gnu.org/licenses/lgpl.html pour les details." +
+"\n\n" +
+"Selection de la date :\n" +
+"- Utiliser les bouttons \xab, \xbb  pour selectionner l\'annee\n" +
+"- Utiliser les bouttons " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pour selectionner les mois\n" +
+"- Garder la souris sur n'importe quels boutons pour une selection plus rapide";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Selection de l\'heure :\n" +
+"- Cliquer sur heures ou minutes pour incrementer\n" +
+"- ou Maj-clic pour decrementer\n" +
+"- ou clic et glisser-deplacer pour une selection plus rapide";
+
+Calendar._TT["PREV_YEAR"] = "Année préc. (maintenir pour menu)";
+Calendar._TT["PREV_MONTH"] = "Mois préc. (maintenir pour menu)";
+Calendar._TT["GO_TODAY"] = "Atteindre la date du jour";
+Calendar._TT["NEXT_MONTH"] = "Mois suiv. (maintenir pour menu)";
+Calendar._TT["NEXT_YEAR"] = "Année suiv. (maintenir pour menu)";
+Calendar._TT["SEL_DATE"] = "Sélectionner une date";
+Calendar._TT["DRAG_TO_MOVE"] = "Déplacer";
+Calendar._TT["PART_TODAY"] = " (Aujourd'hui)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Afficher %s en premier";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Fermer";
+Calendar._TT["TODAY"] = "Aujourd'hui";
+Calendar._TT["TIME_PART"] = "(Maj-)Clic ou glisser pour modifier la valeur";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "Sem.";
+Calendar._TT["TIME"] = "Heure :";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-he-utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-he-utf8.js
new file mode 100644 (file)
index 0000000..7861217
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar EN language
+// Author: Idan Sofer, <idan@idanso.dyndns.org>
+// Encoding: UTF-8
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("ראשון",
+ "שני",
+ "שלישי",
+ "רביעי",
+ "חמישי",
+ "שישי",
+ "שבת",
+ "ראשון");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("א",
+ "ב",
+ "ג",
+ "ד",
+ "ה",
+ "ו",
+ "ש",
+ "א");
+
+// full month names
+Calendar._MN = new Array
+("ינואר",
+ "פברואר",
+ "מרץ",
+ "אפריל",
+ "מאי",
+ "יוני",
+ "יולי",
+ "אוגוסט",
+ "ספטמבר",
+ "אוקטובר",
+ "נובמבר",
+ "דצמבר");
+
+// short month names
+Calendar._SMN = new Array
+("ינא",
+ "פבר",
+ "מרץ",
+ "אפר",
+ "מאי",
+ "יונ",
+ "יול",
+ "אוג",
+ "ספט",
+ "אוק",
+ "נוב",
+ "דצמ");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "אודות השנתון";
+
+Calendar._TT["ABOUT"] =
+"בחרן תאריך/שעה DHTML\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"הגירסא האחרונה זמינה ב: http://www.dynarch.com/projects/calendar/\n" +
+"מופץ תחת זיכיון ה GNU LGPL.  עיין ב http://gnu.org/licenses/lgpl.html לפרטים נוספים." +
+"\n\n" +
+בחירת תאריך:\n" +
+"- השתמש בכפתורים \xab, \xbb לבחירת שנה\n" +
+"- השתמש בכפתורים " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " לבחירת חודש\n" +
+"- החזק העכבר לחוץ מעל הכפתורים המוזכרים לעיל לבחירה מהירה יותר.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"בחירת זמן:\n" +
+"- לחץ על כל אחד מחלקי הזמן כדי להוסיף\n" +
+"- או shift בשילוב עם לחיצה כדי להחסיר\n" +
+"- או לחץ וגרור לפעולה מהירה יותר.";
+
+Calendar._TT["PREV_YEAR"] = "שנה קודמת - החזק לקבלת תפריט";
+Calendar._TT["PREV_MONTH"] = "חודש קודם - החזק לקבלת תפריט";
+Calendar._TT["GO_TODAY"] = "עבור להיום";
+Calendar._TT["NEXT_MONTH"] = "חודש הבא - החזק לתפריט";
+Calendar._TT["NEXT_YEAR"] = "שנה הבאה - החזק לתפריט";
+Calendar._TT["SEL_DATE"] = "בחר תאריך";
+Calendar._TT["DRAG_TO_MOVE"] = "גרור להזזה";
+Calendar._TT["PART_TODAY"] = " )היום(";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "הצג %s קודם";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "6";
+
+Calendar._TT["CLOSE"] = "סגור";
+Calendar._TT["TODAY"] = "היום";
+Calendar._TT["TIME_PART"] = "(שיפט-)לחץ וגרור כדי לשנות ערך";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "wk";
+Calendar._TT["TIME"] = "שעה::";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hr-utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hr-utf8.js
new file mode 100644 (file)
index 0000000..d569cfd
--- /dev/null
@@ -0,0 +1,49 @@
+/* Croatian language file for the DHTML Calendar version 0.9.2 \r
+* Author Krunoslav Zubrinic <krunoslav.zubrinic@vip.hr>, June 2003.\r
+* Feel free to use this script under the terms of the GNU Lesser General\r
+* Public License, as long as you do not remove or alter this notice.\r
+*/\r
+Calendar._DN = new Array\r
+("Nedjelja",\r
+ "Ponedjeljak",\r
+ "Utorak",\r
+ "Srijeda",\r
+ "Četvrtak",\r
+ "Petak",\r
+ "Subota",\r
+ "Nedjelja");\r
+Calendar._MN = new Array\r
+("Siječanj",\r
+ "Veljača",\r
+ "Ožujak",\r
+ "Travanj",\r
+ "Svibanj",\r
+ "Lipanj",\r
+ "Srpanj",\r
+ "Kolovoz",\r
+ "Rujan",\r
+ "Listopad",\r
+ "Studeni",\r
+ "Prosinac");\r
+\r
+// tooltips\r
+Calendar._TT = {};\r
+Calendar._TT["TOGGLE"] = "Promjeni dan s kojim počinje tjedan";\r
+Calendar._TT["PREV_YEAR"] = "Prethodna godina (dugi pritisak za meni)";\r
+Calendar._TT["PREV_MONTH"] = "Prethodni mjesec (dugi pritisak za meni)";\r
+Calendar._TT["GO_TODAY"] = "Idi na tekući dan";\r
+Calendar._TT["NEXT_MONTH"] = "Slijedeći mjesec (dugi pritisak za meni)";\r
+Calendar._TT["NEXT_YEAR"] = "Slijedeća godina (dugi pritisak za meni)";\r
+Calendar._TT["SEL_DATE"] = "Izaberite datum";\r
+Calendar._TT["DRAG_TO_MOVE"] = "Pritisni i povuci za promjenu pozicije";\r
+Calendar._TT["PART_TODAY"] = " (today)";\r
+Calendar._TT["MON_FIRST"] = "Prikaži ponedjeljak kao prvi dan";\r
+Calendar._TT["SUN_FIRST"] = "Prikaži nedjelju kao prvi dan";\r
+Calendar._TT["CLOSE"] = "Zatvori";\r
+Calendar._TT["TODAY"] = "Danas";\r
+\r
+// date formats\r
+Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y";\r
+Calendar._TT["TT_DATE_FORMAT"] = "DD, dd.mm.y";\r
+\r
+Calendar._TT["WK"] = "Tje";
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hr.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hr.js
new file mode 100644 (file)
index 0000000..6c27f60
Binary files /dev/null and b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hr.js differ
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hu.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-hu.js
new file mode 100644 (file)
index 0000000..f5bf057
--- /dev/null
@@ -0,0 +1,124 @@
+// ** I18N
+
+// Calendar HU language
+// Author: ???
+// Modifier: KARASZI Istvan, <jscalendar@spam.raszi.hu>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Vasárnap",
+ "Hétfõ",
+ "Kedd",
+ "Szerda",
+ "Csütörtök",
+ "Péntek",
+ "Szombat",
+ "Vasárnap");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("v",
+ "h",
+ "k",
+ "sze",
+ "cs",
+ "p",
+ "szo",
+ "v");
+
+// full month names
+Calendar._MN = new Array
+("január",
+ "február",
+ "március",
+ "április",
+ "május",
+ "június",
+ "július",
+ "augusztus",
+ "szeptember",
+ "október",
+ "november",
+ "december");
+
+// short month names
+Calendar._SMN = new Array
+("jan",
+ "feb",
+ "már",
+ "ápr",
+ "máj",
+ "jún",
+ "júl",
+ "aug",
+ "sze",
+ "okt",
+ "nov",
+ "dec");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "A kalendáriumról";
+
+Calendar._TT["ABOUT"] =
+"DHTML dátum/idõ kiválasztó\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"a legfrissebb verzió megtalálható: http://www.dynarch.com/projects/calendar/\n" +
+"GNU LGPL alatt terjesztve.  Lásd a http://gnu.org/licenses/lgpl.html oldalt a részletekhez." +
+"\n\n" +
+"Dátum választás:\n" +
+"- használja a \xab, \xbb gombokat az év kiválasztásához\n" +
+"- használja a " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " gombokat a hónap kiválasztásához\n" +
+"- tartsa lenyomva az egérgombot a gyors választáshoz.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Idõ választás:\n" +
+"- kattintva növelheti az idõt\n" +
+"- shift-tel kattintva csökkentheti\n" +
+"- lenyomva tartva és húzva gyorsabban kiválaszthatja.";
+
+Calendar._TT["PREV_YEAR"] = "Elõzõ év (tartsa nyomva a menühöz)";
+Calendar._TT["PREV_MONTH"] = "Elõzõ hónap (tartsa nyomva a menühöz)";
+Calendar._TT["GO_TODAY"] = "Mai napra ugrás";
+Calendar._TT["NEXT_MONTH"] = "Köv. hónap (tartsa nyomva a menühöz)";
+Calendar._TT["NEXT_YEAR"] = "Köv. év (tartsa nyomva a menühöz)";
+Calendar._TT["SEL_DATE"] = "Válasszon dátumot";
+Calendar._TT["DRAG_TO_MOVE"] = "Húzza a mozgatáshoz";
+Calendar._TT["PART_TODAY"] = " (ma)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "%s legyen a hét elsõ napja";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Bezár";
+Calendar._TT["TODAY"] = "Ma";
+Calendar._TT["TIME_PART"] = "(Shift-)Klikk vagy húzás az érték változtatásához";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%b %e, %a";
+
+Calendar._TT["WK"] = "hét";
+Calendar._TT["TIME"] = "idõ:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-it.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-it.js
new file mode 100644 (file)
index 0000000..7f84cde
--- /dev/null
@@ -0,0 +1,124 @@
+// ** I18N
+
+// Calendar EN language
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Translator: Fabio Di Bernardini, <altraqua@email.it>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Domenica",
+ "Lunedì",
+ "Martedì",
+ "Mercoledì",
+ "Giovedì",
+ "Venerdì",
+ "Sabato",
+ "Domenica");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Dom",
+ "Lun",
+ "Mar",
+ "Mer",
+ "Gio",
+ "Ven",
+ "Sab",
+ "Dom");
+
+// full month names
+Calendar._MN = new Array
+("Gennaio",
+ "Febbraio",
+ "Marzo",
+ "Aprile",
+ "Maggio",
+ "Giugno",
+ "Luglio",
+ "Augosto",
+ "Settembre",
+ "Ottobre",
+ "Novembre",
+ "Dicembre");
+
+// short month names
+Calendar._SMN = new Array
+("Gen",
+ "Feb",
+ "Mar",
+ "Apr",
+ "Mag",
+ "Giu",
+ "Lug",
+ "Ago",
+ "Set",
+ "Ott",
+ "Nov",
+ "Dic");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Informazioni sul calendario";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Per gli aggiornamenti: http://www.dynarch.com/projects/calendar/\n" +
+"Distribuito sotto licenza GNU LGPL.  Vedi http://gnu.org/licenses/lgpl.html per i dettagli." +
+"\n\n" +
+"Selezione data:\n" +
+"- Usa \xab, \xbb per selezionare l'anno\n" +
+"- Usa  " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per i mesi\n" +
+"- Tieni premuto a lungo il mouse per accedere alle funzioni di selezione veloce.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Selezione orario:\n" +
+"- Clicca sul numero per incrementarlo\n" +
+"- o Shift+click per decrementarlo\n" +
+"- o click e sinistra o destra per variarlo.";
+
+Calendar._TT["PREV_YEAR"] = "Anno prec.(clicca a lungo per il menù)";
+Calendar._TT["PREV_MONTH"] = "Mese prec. (clicca a lungo per il menù)";
+Calendar._TT["GO_TODAY"] = "Oggi";
+Calendar._TT["NEXT_MONTH"] = "Pross. mese (clicca a lungo per il menù)";
+Calendar._TT["NEXT_YEAR"] = "Pross. anno (clicca a lungo per il menù)";
+Calendar._TT["SEL_DATE"] = "Seleziona data";
+Calendar._TT["DRAG_TO_MOVE"] = "Trascina per spostarlo";
+Calendar._TT["PART_TODAY"] = " (oggi)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Mostra prima %s";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Chiudi";
+Calendar._TT["TODAY"] = "Oggi";
+Calendar._TT["TIME_PART"] = "(Shift-)Click o trascina per cambiare il valore";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a:%b:%e";
+
+Calendar._TT["WK"] = "set";
+Calendar._TT["TIME"] = "Ora:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-jp.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-jp.js
new file mode 100644 (file)
index 0000000..3bca7eb
--- /dev/null
@@ -0,0 +1,45 @@
+// ** I18N
+Calendar._DN = new Array
+("\93ú",
+ "\8c\8e",
+ "\89Î",
+ "\90\85",
+ "\96Ø",
+ "\8bà",
+ "\93y",
+ "\93ú");
+Calendar._MN = new Array
+("1\8c\8e",
+ "2\8c\8e",
+ "3\8c\8e",
+ "4\8c\8e",
+ "5\8c\8e",
+ "6\8c\8e",
+ "7\8c\8e",
+ "8\8c\8e",
+ "9\8c\8e",
+ "10\8c\8e",
+ "11\8c\8e",
+ "12\8c\8e");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["TOGGLE"] = "\8fT\82Ì\8dÅ\8f\89\82Ì\97j\93ú\82ð\90Ø\82è\91Ö\82¦";
+Calendar._TT["PREV_YEAR"] = "\91O\94N";
+Calendar._TT["PREV_MONTH"] = "\91O\8c\8e";
+Calendar._TT["GO_TODAY"] = "\8d¡\93ú";
+Calendar._TT["NEXT_MONTH"] = "\97\82\8c\8e";
+Calendar._TT["NEXT_YEAR"] = "\97\82\94N";
+Calendar._TT["SEL_DATE"] = "\93ú\95t\91I\91ð";
+Calendar._TT["DRAG_TO_MOVE"] = "\83E\83B\83\93\83h\83E\82Ì\88Ú\93®";
+Calendar._TT["PART_TODAY"] = " (\8d¡\93ú)";
+Calendar._TT["MON_FIRST"] = "\8c\8e\97j\93ú\82ð\90æ\93ª\82É";
+Calendar._TT["SUN_FIRST"] = "\93ú\97j\93ú\82ð\90æ\93ª\82É";
+Calendar._TT["CLOSE"] = "\95Â\82\82é";
+Calendar._TT["TODAY"] = "\8d¡\93ú";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd";
+Calendar._TT["TT_DATE_FORMAT"] = "%m\8c\8e %d\93ú (%a)";
+
+Calendar._TT["WK"] = "\8fT";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ko-utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ko-utf8.js
new file mode 100644 (file)
index 0000000..035dd74
--- /dev/null
@@ -0,0 +1,120 @@
+// ** I18N
+
+// Calendar EN language
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Translation: Yourim Yi <yyi@yourim.net>
+// Encoding: EUC-KR
+// lang : ko
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+
+Calendar._DN = new Array
+("일요일",
+ "월요일",
+ "화요일",
+ "수요일",
+ "목요일",
+ "금요일",
+ "토요일",
+ "일요일");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("일",
+ "월",
+ "화",
+ "수",
+ "목",
+ "금",
+ "토",
+ "일");
+
+// full month names
+Calendar._MN = new Array
+("1월",
+ "2월",
+ "3월",
+ "4월",
+ "5월",
+ "6월",
+ "7월",
+ "8월",
+ "9월",
+ "10월",
+ "11월",
+ "12월");
+
+// short month names
+Calendar._SMN = new Array
+("1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "10",
+ "11",
+ "12");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "calendar 에 대해서";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"\n"+
+"최신 버전을 받으시려면 http://www.dynarch.com/projects/calendar/ 에 방문하세요\n" +
+"\n"+
+"GNU LGPL 라이센스로 배포됩니다. \n"+
+"라이센스에 대한 자세한 내용은 http://gnu.org/licenses/lgpl.html 을 읽으세요." +
+"\n\n" +
+"날짜 선택:\n" +
+"- 연도를 선택하려면 \xab, \xbb 버튼을 사용합니다\n" +
+"- 달을 선택하려면 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 버튼을 누르세요\n" +
+"- 계속 누르고 있으면 위 값들을 빠르게 선택하실 수 있습니다.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"시간 선택:\n" +
+"- 마우스로 누르면 시간이 증가합니다\n" +
+"- Shift 키와 함께 누르면 감소합니다\n" +
+"- 누른 상태에서 마우스를 움직이면 좀 더 빠르게 값이 변합니다.\n";
+
+Calendar._TT["PREV_YEAR"] = "지난 해 (길게 누르면 목록)";
+Calendar._TT["PREV_MONTH"] = "지난 달 (길게 누르면 목록)";
+Calendar._TT["GO_TODAY"] = "오늘 날짜로";
+Calendar._TT["NEXT_MONTH"] = "다음 달 (길게 누르면 목록)";
+Calendar._TT["NEXT_YEAR"] = "다음 해 (길게 누르면 목록)";
+Calendar._TT["SEL_DATE"] = "날짜를 선택하세요";
+Calendar._TT["DRAG_TO_MOVE"] = "마우스 드래그로 이동 하세요";
+Calendar._TT["PART_TODAY"] = " (오늘)";
+Calendar._TT["MON_FIRST"] = "월요일을 한 주의 시작 요일로";
+Calendar._TT["SUN_FIRST"] = "일요일을 한 주의 시작 요일로";
+Calendar._TT["CLOSE"] = "닫기";
+Calendar._TT["TODAY"] = "오늘";
+Calendar._TT["TIME_PART"] = "(Shift-)클릭 또는 드래그 하세요";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%b/%e [%a]";
+
+Calendar._TT["WK"] = "주";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ko.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ko.js
new file mode 100644 (file)
index 0000000..8cddf58
--- /dev/null
@@ -0,0 +1,120 @@
+// ** I18N
+
+// Calendar EN language
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Translation: Yourim Yi <yyi@yourim.net>
+// Encoding: EUC-KR
+// lang : ko
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+
+Calendar._DN = new Array
+("ÀÏ¿äÀÏ",
+ "¿ù¿äÀÏ",
+ "È­¿äÀÏ",
+ "¼ö¿äÀÏ",
+ "¸ñ¿äÀÏ",
+ "±Ý¿äÀÏ",
+ "Åä¿äÀÏ",
+ "ÀÏ¿äÀÏ");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("ÀÏ",
+ "¿ù",
+ "ȭ",
+ "¼ö",
+ "¸ñ",
+ "±Ý",
+ "Åä",
+ "ÀÏ");
+
+// full month names
+Calendar._MN = new Array
+("1¿ù",
+ "2¿ù",
+ "3¿ù",
+ "4¿ù",
+ "5¿ù",
+ "6¿ù",
+ "7¿ù",
+ "8¿ù",
+ "9¿ù",
+ "10¿ù",
+ "11¿ù",
+ "12¿ù");
+
+// short month names
+Calendar._SMN = new Array
+("1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "10",
+ "11",
+ "12");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "calendar ¿¡ ´ëÇؼ­";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"\n"+
+"ÃֽŠ¹öÀüÀ» ¹ÞÀ¸½Ã·Á¸é http://www.dynarch.com/projects/calendar/ ¿¡ ¹æ¹®Çϼ¼¿ä\n" +
+"\n"+
+"GNU LGPL ¶óÀ̼¾½º·Î ¹èÆ÷µË´Ï´Ù. \n"+
+"¶óÀ̼¾½º¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº http://gnu.org/licenses/lgpl.html À» ÀÐÀ¸¼¼¿ä." +
+"\n\n" +
+"³¯Â¥ ¼±ÅÃ:\n" +
+"- ¿¬µµ¸¦ ¼±ÅÃÇÏ·Á¸é \xab, \xbb ¹öÆ°À» »ç¿ëÇÕ´Ï´Ù\n" +
+"- ´ÞÀ» ¼±ÅÃÇÏ·Á¸é " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " ¹öÆ°À» ´©¸£¼¼¿ä\n" +
+"- °è¼Ó ´©¸£°í ÀÖÀ¸¸é À§ °ªµéÀ» ºü¸£°Ô ¼±ÅÃÇϽǠ¼ö ÀÖ½À´Ï´Ù.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"½Ã°£ ¼±ÅÃ:\n" +
+"- ¸¶¿ì½º·Î ´©¸£¸é ½Ã°£ÀÌ Áõ°¡ÇÕ´Ï´Ù\n" +
+"- Shift Å°¿Í ÇÔ²² ´©¸£¸é °¨¼ÒÇÕ´Ï´Ù\n" +
+"- ´©¸¥ »óÅ¿¡¼­ ¸¶¿ì½º¸¦ ¿òÁ÷À̸é Á» ´õ ºü¸£°Ô °ªÀÌ º¯ÇÕ´Ï´Ù.\n";
+
+Calendar._TT["PREV_YEAR"] = "Áö³­ ÇØ (±æ°Ô ´©¸£¸é ¸ñ·Ï)";
+Calendar._TT["PREV_MONTH"] = "Áö³­ ´Þ (±æ°Ô ´©¸£¸é ¸ñ·Ï)";
+Calendar._TT["GO_TODAY"] = "¿À´Ã ³¯Â¥·Î";
+Calendar._TT["NEXT_MONTH"] = "´ÙÀ½ ´Þ (±æ°Ô ´©¸£¸é ¸ñ·Ï)";
+Calendar._TT["NEXT_YEAR"] = "´ÙÀ½ ÇØ (±æ°Ô ´©¸£¸é ¸ñ·Ï)";
+Calendar._TT["SEL_DATE"] = "³¯Â¥¸¦ ¼±ÅÃÇϼ¼¿ä";
+Calendar._TT["DRAG_TO_MOVE"] = "¸¶¿ì½º µå·¡±×·Î À̵¿ Çϼ¼¿ä";
+Calendar._TT["PART_TODAY"] = " (¿À´Ã)";
+Calendar._TT["MON_FIRST"] = "¿ù¿äÀÏÀ» ÇÑ ÁÖÀÇ ½ÃÀÛ ¿äÀÏ·Î";
+Calendar._TT["SUN_FIRST"] = "ÀÏ¿äÀÏÀ» ÇÑ ÁÖÀÇ ½ÃÀÛ ¿äÀÏ·Î";
+Calendar._TT["CLOSE"] = "´Ý±â";
+Calendar._TT["TODAY"] = "¿À´Ã";
+Calendar._TT["TIME_PART"] = "(Shift-)Ŭ¸¯ ¶Ç´Â µå·¡±× Çϼ¼¿ä";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%b/%e [%a]";
+
+Calendar._TT["WK"] = "ÁÖ";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lt-utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lt-utf8.js
new file mode 100644 (file)
index 0000000..d39653b
--- /dev/null
@@ -0,0 +1,114 @@
+// ** I18N
+
+// Calendar LT language
+// Author: Martynas Majeris, <martynas@solmetra.lt>
+// Encoding: UTF-8
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Sekmadienis",
+ "Pirmadienis",
+ "Antradienis",
+ "Trečiadienis",
+ "Ketvirtadienis",
+ "Pentadienis",
+ "Šeštadienis",
+ "Sekmadienis");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Sek",
+ "Pir",
+ "Ant",
+ "Tre",
+ "Ket",
+ "Pen",
+ "Šeš",
+ "Sek");
+
+// full month names
+Calendar._MN = new Array
+("Sausis",
+ "Vasaris",
+ "Kovas",
+ "Balandis",
+ "Gegužė",
+ "Birželis",
+ "Liepa",
+ "Rugpjūtis",
+ "Rugsėjis",
+ "Spalis",
+ "Lapkritis",
+ "Gruodis");
+
+// short month names
+Calendar._SMN = new Array
+("Sau",
+ "Vas",
+ "Kov",
+ "Bal",
+ "Geg",
+ "Bir",
+ "Lie",
+ "Rgp",
+ "Rgs",
+ "Spa",
+ "Lap",
+ "Gru");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Apie kalendorių";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Naujausią versiją rasite: http://www.dynarch.com/projects/calendar/\n" +
+"Platinamas pagal GNU LGPL licenciją. Aplankykite http://gnu.org/licenses/lgpl.html" +
+"\n\n" +
+"Datos pasirinkimas:\n" +
+"- Metų pasirinkimas: \xab, \xbb\n" +
+"- Mėnesio pasirinkimas: " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" +
+"- Nuspauskite ir laikykite pelės klavišą greitesniam pasirinkimui.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Laiko pasirinkimas:\n" +
+"- Spustelkite ant valandų arba minučių - skaičius padidės vienetu.\n" +
+"- Jei spausite kartu su Shift, skaičius sumažės.\n" +
+"- Greitam pasirinkimui spustelkite ir pajudinkite pelę.";
+
+Calendar._TT["PREV_YEAR"] = "Ankstesni metai (laikykite, jei norite meniu)";
+Calendar._TT["PREV_MONTH"] = "Ankstesnis mėnuo (laikykite, jei norite meniu)";
+Calendar._TT["GO_TODAY"] = "Pasirinkti šiandieną";
+Calendar._TT["NEXT_MONTH"] = "Kitas mėnuo (laikykite, jei norite meniu)";
+Calendar._TT["NEXT_YEAR"] = "Kiti metai (laikykite, jei norite meniu)";
+Calendar._TT["SEL_DATE"] = "Pasirinkite datą";
+Calendar._TT["DRAG_TO_MOVE"] = "Tempkite";
+Calendar._TT["PART_TODAY"] = " (šiandien)";
+Calendar._TT["MON_FIRST"] = "Pirma savaitės diena - pirmadienis";
+Calendar._TT["SUN_FIRST"] = "Pirma savaitės diena - sekmadienis";
+Calendar._TT["CLOSE"] = "Uždaryti";
+Calendar._TT["TODAY"] = "Šiandien";
+Calendar._TT["TIME_PART"] = "Spustelkite arba tempkite jei norite pakeisti";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%A, %Y-%m-%d";
+
+Calendar._TT["WK"] = "sav";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lt.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lt.js
new file mode 100644 (file)
index 0000000..43b93d6
--- /dev/null
@@ -0,0 +1,114 @@
+// ** I18N
+
+// Calendar LT language
+// Author: Martynas Majeris, <martynas@solmetra.lt>
+// Encoding: Windows-1257
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Sekmadienis",
+ "Pirmadienis",
+ "Antradienis",
+ "Treèiadienis",
+ "Ketvirtadienis",
+ "Pentadienis",
+ "Ðeðtadienis",
+ "Sekmadienis");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Sek",
+ "Pir",
+ "Ant",
+ "Tre",
+ "Ket",
+ "Pen",
+ "Ðeð",
+ "Sek");
+
+// full month names
+Calendar._MN = new Array
+("Sausis",
+ "Vasaris",
+ "Kovas",
+ "Balandis",
+ "Geguþë",
+ "Birþelis",
+ "Liepa",
+ "Rugpjûtis",
+ "Rugsëjis",
+ "Spalis",
+ "Lapkritis",
+ "Gruodis");
+
+// short month names
+Calendar._SMN = new Array
+("Sau",
+ "Vas",
+ "Kov",
+ "Bal",
+ "Geg",
+ "Bir",
+ "Lie",
+ "Rgp",
+ "Rgs",
+ "Spa",
+ "Lap",
+ "Gru");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Apie kalendoriø";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Naujausià versijà rasite: http://www.dynarch.com/projects/calendar/\n" +
+"Platinamas pagal GNU LGPL licencijà. Aplankykite http://gnu.org/licenses/lgpl.html" +
+"\n\n" +
+"Datos pasirinkimas:\n" +
+"- Metø pasirinkimas: \xab, \xbb\n" +
+"- Mënesio pasirinkimas: " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" +
+"- Nuspauskite ir laikykite pelës klaviðà greitesniam pasirinkimui.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Laiko pasirinkimas:\n" +
+"- Spustelkite ant valandø arba minuèiø - skaièus padidës vienetu.\n" +
+"- Jei spausite kartu su Shift, skaièius sumaþës.\n" +
+"- Greitam pasirinkimui spustelkite ir pajudinkite pelæ.";
+
+Calendar._TT["PREV_YEAR"] = "Ankstesni metai (laikykite, jei norite meniu)";
+Calendar._TT["PREV_MONTH"] = "Ankstesnis mënuo (laikykite, jei norite meniu)";
+Calendar._TT["GO_TODAY"] = "Pasirinkti ðiandienà";
+Calendar._TT["NEXT_MONTH"] = "Kitas mënuo (laikykite, jei norite meniu)";
+Calendar._TT["NEXT_YEAR"] = "Kiti metai (laikykite, jei norite meniu)";
+Calendar._TT["SEL_DATE"] = "Pasirinkite datà";
+Calendar._TT["DRAG_TO_MOVE"] = "Tempkite";
+Calendar._TT["PART_TODAY"] = " (ðiandien)";
+Calendar._TT["MON_FIRST"] = "Pirma savaitës diena - pirmadienis";
+Calendar._TT["SUN_FIRST"] = "Pirma savaitës diena - sekmadienis";
+Calendar._TT["CLOSE"] = "Uþdaryti";
+Calendar._TT["TODAY"] = "Ðiandien";
+Calendar._TT["TIME_PART"] = "Spustelkite arba tempkite jei norite pakeisti";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%A, %Y-%m-%d";
+
+Calendar._TT["WK"] = "sav";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lv.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-lv.js
new file mode 100644 (file)
index 0000000..407699d
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar LV language
+// Author: Juris Valdovskis, <juris@dc.lv>
+// Encoding: cp1257
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Svçtdiena",
+ "Pirmdiena",
+ "Otrdiena",
+ "Treðdiena",
+ "Ceturdiena",
+ "Piektdiena",
+ "Sestdiena",
+ "Svçtdiena");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Sv",
+ "Pr",
+ "Ot",
+ "Tr",
+ "Ce",
+ "Pk",
+ "Se",
+ "Sv");
+
+// full month names
+Calendar._MN = new Array
+("Janvâris",
+ "Februâris",
+ "Marts",
+ "Aprîlis",
+ "Maijs",
+ "Jûnijs",
+ "Jûlijs",
+ "Augusts",
+ "Septembris",
+ "Oktobris",
+ "Novembris",
+ "Decembris");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "Mai",
+ "Jûn",
+ "Jûl",
+ "Aug",
+ "Sep",
+ "Okt",
+ "Nov",
+ "Dec");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Par kalendâru";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Datuma izvçle:\n" +
+"- Izmanto \xab, \xbb pogas, lai izvçlçtos gadu\n" +
+"- Izmanto " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "pogas, lai izvçlçtos mçnesi\n" +
+"- Turi nospiestu peles pogu uz jebkuru no augstâk minçtajâm pogâm, lai paâtrinâtu izvçli.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Laika izvçle:\n" +
+"- Uzklikðíini uz jebkuru no laika daïâm, lai palielinâtu to\n" +
+"- vai Shift-klikðíis, lai samazinâtu to\n" +
+"- vai noklikðíini un velc uz attiecîgo virzienu lai mainîtu âtrâk.";
+
+Calendar._TT["PREV_YEAR"] = "Iepr. gads (turi izvçlnei)";
+Calendar._TT["PREV_MONTH"] = "Iepr. mçnesis (turi izvçlnei)";
+Calendar._TT["GO_TODAY"] = "Ðodien";
+Calendar._TT["NEXT_MONTH"] = "Nâkoðais mçnesis (turi izvçlnei)";
+Calendar._TT["NEXT_YEAR"] = "Nâkoðais gads (turi izvçlnei)";
+Calendar._TT["SEL_DATE"] = "Izvçlies datumu";
+Calendar._TT["DRAG_TO_MOVE"] = "Velc, lai pârvietotu";
+Calendar._TT["PART_TODAY"] = " (ðodien)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Attçlot %s kâ pirmo";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "1,7";
+
+Calendar._TT["CLOSE"] = "Aizvçrt";
+Calendar._TT["TODAY"] = "Ðodien";
+Calendar._TT["TIME_PART"] = "(Shift-)Klikðíis vai pârvieto, lai mainîtu";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b";
+
+Calendar._TT["WK"] = "wk";
+Calendar._TT["TIME"] = "Laiks:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-nl.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-nl.js
new file mode 100644 (file)
index 0000000..a1dea94
--- /dev/null
@@ -0,0 +1,73 @@
+// ** I18N
+Calendar._DN = new Array
+("Zondag",
+ "Maandag",
+ "Dinsdag",
+ "Woensdag",
+ "Donderdag",
+ "Vrijdag",
+ "Zaterdag",
+ "Zondag");
+
+Calendar._SDN_len = 2;
+
+Calendar._MN = new Array
+("Januari",
+ "Februari",
+ "Maart",
+ "April",
+ "Mei",
+ "Juni",
+ "Juli",
+ "Augustus",
+ "September",
+ "Oktober",
+ "November",
+ "December");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Info";
+
+Calendar._TT["ABOUT"] =
+"DHTML Datum/Tijd Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
+"Ga voor de meest recente versie naar: http://www.dynarch.com/projects/calendar/\n" +
+"Verspreid onder de GNU LGPL. Zie http://gnu.org/licenses/lgpl.html voor details." +
+"\n\n" +
+"Datum selectie:\n" +
+"- Gebruik de \xab \xbb knoppen om een jaar te selecteren\n" +
+"- Gebruik de " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knoppen om een maand te selecteren\n" +
+"- Houd de muis ingedrukt op de genoemde knoppen voor een snellere selectie.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Tijd selectie:\n" +
+"- Klik op een willekeurig onderdeel van het tijd gedeelte om het te verhogen\n" +
+"- of Shift-klik om het te verlagen\n" +
+"- of klik en sleep voor een snellere selectie.";
+
+//Calendar._TT["TOGGLE"] = "Selecteer de eerste week-dag";
+Calendar._TT["PREV_YEAR"] = "Vorig jaar (ingedrukt voor menu)";
+Calendar._TT["PREV_MONTH"] = "Vorige maand (ingedrukt voor menu)";
+Calendar._TT["GO_TODAY"] = "Ga naar Vandaag";
+Calendar._TT["NEXT_MONTH"] = "Volgende maand (ingedrukt voor menu)";
+Calendar._TT["NEXT_YEAR"] = "Volgend jaar (ingedrukt voor menu)";
+Calendar._TT["SEL_DATE"] = "Selecteer datum";
+Calendar._TT["DRAG_TO_MOVE"] = "Klik en sleep om te verplaatsen";
+Calendar._TT["PART_TODAY"] = " (vandaag)";
+//Calendar._TT["MON_FIRST"] = "Toon Maandag eerst";
+//Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst";
+
+Calendar._TT["DAY_FIRST"] = "Toon %s eerst";
+
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Sluiten";
+Calendar._TT["TODAY"] = "(vandaag)";
+Calendar._TT["TIME_PART"] = "(Shift-)Klik of sleep om de waarde te veranderen";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b %Y";
+
+Calendar._TT["WK"] = "wk";
+Calendar._TT["TIME"] = "Tijd:";
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-no.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-no.js
new file mode 100644 (file)
index 0000000..d9297d1
--- /dev/null
@@ -0,0 +1,114 @@
+// ** I18N
+
+// Calendar NO language
+// Author: Daniel Holmen, <daniel.holmen@ciber.no>
+// Encoding: UTF-8
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Søndag",
+ "Mandag",
+ "Tirsdag",
+ "Onsdag",
+ "Torsdag",
+ "Fredag",
+ "Lørdag",
+ "Søndag");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Søn",
+ "Man",
+ "Tir",
+ "Ons",
+ "Tor",
+ "Fre",
+ "Lør",
+ "Søn");
+
+// full month names
+Calendar._MN = new Array
+("Januar",
+ "Februar",
+ "Mars",
+ "April",
+ "Mai",
+ "Juni",
+ "Juli",
+ "August",
+ "September",
+ "Oktober",
+ "November",
+ "Desember");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "Mai",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Okt",
+ "Nov",
+ "Des");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Om kalenderen";
+
+Calendar._TT["ABOUT"] =
+"DHTML Dato-/Tidsvelger\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For nyeste versjon, gå til: http://www.dynarch.com/projects/calendar/\n" +
+"Distribuert under GNU LGPL.  Se http://gnu.org/licenses/lgpl.html for detaljer." +
+"\n\n" +
+"Datovalg:\n" +
+"- Bruk knappene \xab og \xbb for å velge år\n" +
+"- Bruk knappene " + String.fromCharCode(0x2039) + " og " + String.fromCharCode(0x203a) + " for å velge måned\n" +
+"- Hold inne musknappen eller knappene over for raskere valg.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Tidsvalg:\n" +
+"- Klikk på en av tidsdelene for å øke den\n" +
+"- eller Shift-klikk for å senke verdien\n" +
+"- eller klikk-og-dra for raskere valg..";
+
+Calendar._TT["PREV_YEAR"] = "Forrige. år (hold for meny)";
+Calendar._TT["PREV_MONTH"] = "Forrige. måned (hold for meny)";
+Calendar._TT["GO_TODAY"] = "Gå til idag";
+Calendar._TT["NEXT_MONTH"] = "Neste måned (hold for meny)";
+Calendar._TT["NEXT_YEAR"] = "Neste år (hold for meny)";
+Calendar._TT["SEL_DATE"] = "Velg dato";
+Calendar._TT["DRAG_TO_MOVE"] = "Dra for å flytte";
+Calendar._TT["PART_TODAY"] = " (idag)";
+Calendar._TT["MON_FIRST"] = "Vis mandag først";
+Calendar._TT["SUN_FIRST"] = "Vis søndag først";
+Calendar._TT["CLOSE"] = "Lukk";
+Calendar._TT["TODAY"] = "Idag";
+Calendar._TT["TIME_PART"] = "(Shift-)Klikk eller dra for å endre verdi";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "uke";
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pl-utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pl-utf8.js
new file mode 100644 (file)
index 0000000..6b8ca67
--- /dev/null
@@ -0,0 +1,93 @@
+// ** I18N
+
+// Calendar PL language
+// Author: Dariusz Pietrzak, <eyck@ghost.anime.pl>
+// Author: Janusz Piwowarski, <jpiw@go2.pl>
+// Encoding: utf-8
+// Distributed under the same terms as the calendar itself.
+
+Calendar._DN = new Array
+("Niedziela",
+ "Poniedziałek",
+ "Wtorek",
+ "Środa",
+ "Czwartek",
+ "Piątek",
+ "Sobota",
+ "Niedziela");
+Calendar._SDN = new Array
+("Nie",
+ "Pn",
+ "Wt",
+ "Śr",
+ "Cz",
+ "Pt",
+ "So",
+ "Nie");
+Calendar._MN = new Array
+("Styczeń",
+ "Luty",
+ "Marzec",
+ "Kwiecień",
+ "Maj",
+ "Czerwiec",
+ "Lipiec",
+ "Sierpień",
+ "Wrzesień",
+ "Październik",
+ "Listopad",
+ "Grudzień");
+Calendar._SMN = new Array
+("Sty",
+ "Lut",
+ "Mar",
+ "Kwi",
+ "Maj",
+ "Cze",
+ "Lip",
+ "Sie",
+ "Wrz",
+ "Paź",
+ "Lis",
+ "Gru");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "O kalendarzu";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Aby pobrać najnowszą wersję, odwiedź: http://www.dynarch.com/projects/calendar/\n" +
+"Dostępny na licencji GNU LGPL. Zobacz szczegóły na http://gnu.org/licenses/lgpl.html." +
+"\n\n" +
+"Wybór daty:\n" +
+"- Użyj przycisków \xab, \xbb by wybrać rok\n" +
+"- Użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " by wybrać miesiąc\n" +
+"- Przytrzymaj klawisz myszy nad jednym z powyższych przycisków dla szybszego wyboru.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Wybór czasu:\n" +
+"- Kliknij na jednym z pól czasu by zwiększyć jego wartość\n" +
+"- lub kliknij trzymając Shift by zmiejszyć jego wartość\n" +
+"- lub kliknij i przeciągnij dla szybszego wyboru.";
+
+//Calendar._TT["TOGGLE"] = "Zmień pierwszy dzień tygodnia";
+Calendar._TT["PREV_YEAR"] = "Poprzedni rok (przytrzymaj dla menu)";
+Calendar._TT["PREV_MONTH"] = "Poprzedni miesiąc (przytrzymaj dla menu)";
+Calendar._TT["GO_TODAY"] = "Idź do dzisiaj";
+Calendar._TT["NEXT_MONTH"] = "Następny miesiąc (przytrzymaj dla menu)";
+Calendar._TT["NEXT_YEAR"] = "Następny rok (przytrzymaj dla menu)";
+Calendar._TT["SEL_DATE"] = "Wybierz datę";
+Calendar._TT["DRAG_TO_MOVE"] = "Przeciągnij by przesunąć";
+Calendar._TT["PART_TODAY"] = " (dzisiaj)";
+Calendar._TT["MON_FIRST"] = "Wyświetl poniedziałek jako pierwszy";
+Calendar._TT["SUN_FIRST"] = "Wyświetl niedzielę jako pierwszą";
+Calendar._TT["CLOSE"] = "Zamknij";
+Calendar._TT["TODAY"] = "Dzisiaj";
+Calendar._TT["TIME_PART"] = "(Shift-)Kliknij lub przeciągnij by zmienić wartość";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%e %B, %A";
+
+Calendar._TT["WK"] = "ty";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pl.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pl.js
new file mode 100644 (file)
index 0000000..76e0551
--- /dev/null
@@ -0,0 +1,56 @@
+// ** I18N
+// Calendar PL language
+// Author: Artur Filipiak, <imagen@poczta.fm>
+// January, 2004
+// Encoding: UTF-8
+Calendar._DN = new Array
+("Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela");
+
+Calendar._SDN = new Array
+("N", "Pn", "Wt", "Śr", "Cz", "Pt", "So", "N");
+
+Calendar._MN = new Array
+("Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień");
+
+Calendar._SMN = new Array
+("Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "O kalendarzu";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Wybór daty:\n" +
+"- aby wybrać rok użyj przycisków \xab, \xbb\n" +
+"- aby wybrać miesiąc użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" +
+"- aby przyspieszyć wybór przytrzymaj wciśnięty przycisk myszy nad ww. przyciskami.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Wybór czasu:\n" +
+"- aby zwiększyć wartość kliknij na dowolnym elemencie selekcji czasu\n" +
+"- aby zmniejszyć wartość użyj dodatkowo klawisza Shift\n" +
+"- możesz również poruszać myszkę w lewo i prawo wraz z wciśniętym lewym klawiszem.";
+
+Calendar._TT["PREV_YEAR"] = "Poprz. rok (przytrzymaj dla menu)";
+Calendar._TT["PREV_MONTH"] = "Poprz. miesiąc (przytrzymaj dla menu)";
+Calendar._TT["GO_TODAY"] = "Pokaż dziś";
+Calendar._TT["NEXT_MONTH"] = "Nast. miesiąc (przytrzymaj dla menu)";
+Calendar._TT["NEXT_YEAR"] = "Nast. rok (przytrzymaj dla menu)";
+Calendar._TT["SEL_DATE"] = "Wybierz datę";
+Calendar._TT["DRAG_TO_MOVE"] = "Przesuń okienko";
+Calendar._TT["PART_TODAY"] = " (dziś)";
+Calendar._TT["MON_FIRST"] = "Pokaż Poniedziałek jako pierwszy";
+Calendar._TT["SUN_FIRST"] = "Pokaż Niedzielę jako pierwszą";
+Calendar._TT["CLOSE"] = "Zamknij";
+Calendar._TT["TODAY"] = "Dziś";
+Calendar._TT["TIME_PART"] = "(Shift-)klik | drag, aby zmienić wartość";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y.%m.%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
+
+Calendar._TT["WK"] = "wk";
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pt.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-pt.js
new file mode 100644 (file)
index 0000000..deee8a1
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar pt_BR language
+// Author: Adalberto Machado, <betosm@terra.com.br>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Domingo",
+ "Segunda",
+ "Terca",
+ "Quarta",
+ "Quinta",
+ "Sexta",
+ "Sabado",
+ "Domingo");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("Dom",
+ "Seg",
+ "Ter",
+ "Qua",
+ "Qui",
+ "Sex",
+ "Sab",
+ "Dom");
+
+// full month names
+Calendar._MN = new Array
+("Janeiro",
+ "Fevereiro",
+ "Marco",
+ "Abril",
+ "Maio",
+ "Junho",
+ "Julho",
+ "Agosto",
+ "Setembro",
+ "Outubro",
+ "Novembro",
+ "Dezembro");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+ "Fev",
+ "Mar",
+ "Abr",
+ "Mai",
+ "Jun",
+ "Jul",
+ "Ago",
+ "Set",
+ "Out",
+ "Nov",
+ "Dez");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Sobre o calendario";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Ultima versao visite: http://www.dynarch.com/projects/calendar/\n" +
+"Distribuido sobre GNU LGPL.  Veja http://gnu.org/licenses/lgpl.html para detalhes." +
+"\n\n" +
+"Selecao de data:\n" +
+"- Use os botoes \xab, \xbb para selecionar o ano\n" +
+"- Use os botoes " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mes\n" +
+"- Segure o botao do mouse em qualquer um desses botoes para selecao rapida.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Selecao de hora:\n" +
+"- Clique em qualquer parte da hora para incrementar\n" +
+"- ou Shift-click para decrementar\n" +
+"- ou clique e segure para selecao rapida.";
+
+Calendar._TT["PREV_YEAR"] = "Ant. ano (segure para menu)";
+Calendar._TT["PREV_MONTH"] = "Ant. mes (segure para menu)";
+Calendar._TT["GO_TODAY"] = "Hoje";
+Calendar._TT["NEXT_MONTH"] = "Prox. mes (segure para menu)";
+Calendar._TT["NEXT_YEAR"] = "Prox. ano (segure para menu)";
+Calendar._TT["SEL_DATE"] = "Selecione a data";
+Calendar._TT["DRAG_TO_MOVE"] = "Arraste para mover";
+Calendar._TT["PART_TODAY"] = " (hoje)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Mostre %s primeiro";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Fechar";
+Calendar._TT["TODAY"] = "Hoje";
+Calendar._TT["TIME_PART"] = "(Shift-)Click ou arraste para mudar valor";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b";
+
+Calendar._TT["WK"] = "sm";
+Calendar._TT["TIME"] = "Hora:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ro.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ro.js
new file mode 100644 (file)
index 0000000..116e358
--- /dev/null
@@ -0,0 +1,66 @@
+// ** I18N
+Calendar._DN = new Array
+("Duminică",
+ "Luni",
+ "Marţi",
+ "Miercuri",
+ "Joi",
+ "Vineri",
+ "Sâmbătă",
+ "Duminică");
+Calendar._SDN_len = 2;
+Calendar._MN = new Array
+("Ianuarie",
+ "Februarie",
+ "Martie",
+ "Aprilie",
+ "Mai",
+ "Iunie",
+ "Iulie",
+ "August",
+ "Septembrie",
+ "Octombrie",
+ "Noiembrie",
+ "Decembrie");
+
+// tooltips
+Calendar._TT = {};
+
+Calendar._TT["INFO"] = "Despre calendar";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Pentru ultima versiune vizitaţi: http://www.dynarch.com/projects/calendar/\n" +
+"Distribuit sub GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Selecţia datei:\n" +
+"- Folosiţi butoanele \xab, \xbb pentru a selecta anul\n" +
+"- Folosiţi butoanele " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pentru a selecta luna\n" +
+"- Tineţi butonul mouse-ului apăsat pentru selecţie mai rapidă.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Selecţia orei:\n" +
+"- Click pe ora sau minut pentru a mări valoarea cu 1\n" +
+"- Sau Shift-Click pentru a micşora valoarea cu 1\n" +
+"- Sau Click şi drag pentru a selecta mai repede.";
+
+Calendar._TT["PREV_YEAR"] = "Anul precedent (lung pt menu)";
+Calendar._TT["PREV_MONTH"] = "Luna precedentă (lung pt menu)";
+Calendar._TT["GO_TODAY"] = "Data de azi";
+Calendar._TT["NEXT_MONTH"] = "Luna următoare (lung pt menu)";
+Calendar._TT["NEXT_YEAR"] = "Anul următor (lung pt menu)";
+Calendar._TT["SEL_DATE"] = "Selectează data";
+Calendar._TT["DRAG_TO_MOVE"] = "Trage pentru a mişca";
+Calendar._TT["PART_TODAY"] = " (astăzi)";
+Calendar._TT["DAY_FIRST"] = "Afişează %s prima zi";
+Calendar._TT["WEEKEND"] = "0,6";
+Calendar._TT["CLOSE"] = "Închide";
+Calendar._TT["TODAY"] = "Astăzi";
+Calendar._TT["TIME_PART"] = "(Shift-)Click sau drag pentru a selecta";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%A, %d %B";
+
+Calendar._TT["WK"] = "spt";
+Calendar._TT["TIME"] = "Ora:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ru.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ru.js
new file mode 100644 (file)
index 0000000..9f75a6a
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar RU language
+// Translation: Sly Golovanov, http://golovanov.net, <sly@golovanov.net>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("воскресенье",
+ "понедельник",
+ "вторник",
+ "среда",
+ "четверг",
+ "пятница",
+ "суббота",
+ "воскресенье");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("вск",
+ "пон",
+ "втр",
+ "срд",
+ "чет",
+ "пят",
+ "суб",
+ "вск");
+
+// full month names
+Calendar._MN = new Array
+("январь",
+ "февраль",
+ "март",
+ "апрель",
+ "май",
+ "июнь",
+ "июль",
+ "август",
+ "сентябрь",
+ "октябрь",
+ "ноябрь",
+ "декабрь");
+
+// short month names
+Calendar._SMN = new Array
+("янв",
+ "фев",
+ "мар",
+ "апр",
+ "май",
+ "июн",
+ "июл",
+ "авг",
+ "сен",
+ "окт",
+ "ноя",
+ "дек");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "О календаре...";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Как выбрать дату:\n" +
+"- При помощи кнопок \xab, \xbb можно выбрать год\n" +
+"- При помощи кнопок " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " можно выбрать месяц\n" +
+"- Подержите эти кнопки нажатыми, чтобы появилось меню быстрого выбора.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Как выбрать время:\n" +
+"- При клике на часах или минутах они увеличиваются\n" +
+"- при клике с нажатой клавишей Shift они уменьшаются\n" +
+"- если нажать и двигать мышкой влево/вправо, они будут меняться быстрее.";
+
+Calendar._TT["PREV_YEAR"] = "На год назад (удерживать для меню)";
+Calendar._TT["PREV_MONTH"] = "На месяц назад (удерживать для меню)";
+Calendar._TT["GO_TODAY"] = "Сегодня";
+Calendar._TT["NEXT_MONTH"] = "На месяц вперед (удерживать для меню)";
+Calendar._TT["NEXT_YEAR"] = "На год вперед (удерживать для меню)";
+Calendar._TT["SEL_DATE"] = "Выберите дату";
+Calendar._TT["DRAG_TO_MOVE"] = "Перетаскивайте мышкой";
+Calendar._TT["PART_TODAY"] = " (сегодня)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Первый день недели будет %s";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Закрыть";
+Calendar._TT["TODAY"] = "Сегодня";
+Calendar._TT["TIME_PART"] = "(Shift-)клик или нажать и двигать";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%e %b, %a";
+
+Calendar._TT["WK"] = "нед";
+Calendar._TT["TIME"] = "Время:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ru_win_.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-ru_win_.js
new file mode 100644 (file)
index 0000000..de455af
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N
+
+// Calendar RU language
+// Translation: Sly Golovanov, http://golovanov.net, <sly@golovanov.net>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("âîñêðåñåíüå",
+ "ïîíåäåëüíèê",
+ "âòîðíèê",
+ "ñðåäà",
+ "÷åòâåðã",
+ "ïÿòíèöà",
+ "ñóááîòà",
+ "âîñêðåñåíüå");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("âñê",
+ "ïîí",
+ "âòð",
+ "ñðä",
+ "÷åò",
+ "ïÿò",
+ "ñóá",
+ "âñê");
+
+// full month names
+Calendar._MN = new Array
+("ÿíâàðü",
+ "ôåâðàëü",
+ "ìàðò",
+ "àïðåëü",
+ "ìàé",
+ "èþíü",
+ "èþëü",
+ "àâãóñò",
+ "ñåíòÿáðü",
+ "îêòÿáðü",
+ "íîÿáðü",
+ "äåêàáðü");
+
+// short month names
+Calendar._SMN = new Array
+("ÿíâ",
+ "ôåâ",
+ "ìàð",
+ "àïð",
+ "ìàé",
+ "èþí",
+ "èþë",
+ "àâã",
+ "ñåí",
+ "îêò",
+ "íîÿ",
+ "äåê");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Πêàëåíäàðå...";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Êàê âûáðàòü äàòó:\n" +
+"- Ïðè ïîìîùè êíîïîê \xab, \xbb ìîæíî âûáðàòü ãîä\n" +
+"- Ïðè ïîìîùè êíîïîê " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " ìîæíî âûáðàòü ìåñÿö\n" +
+"- Ïîäåðæèòå ýòè êíîïêè íàæàòûìè, ÷òîáû ïîÿâèëîñü ìåíþ áûñòðîãî âûáîðà.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Êàê âûáðàòü âðåìÿ:\n" +
+"- Ïðè êëèêå íà ÷àñàõ èëè ìèíóòàõ îíè óâåëè÷èâàþòñÿ\n" +
+"- ïðè êëèêå ñ íàæàòîé êëàâèøåé Shift îíè óìåíüøàþòñÿ\n" +
+"- åñëè íàæàòü è äâèãàòü ìûøêîé âëåâî/âïðàâî, îíè áóäóò ìåíÿòüñÿ áûñòðåå.";
+
+Calendar._TT["PREV_YEAR"] = "Íà ãîä íàçàä (óäåðæèâàòü äëÿ ìåíþ)";
+Calendar._TT["PREV_MONTH"] = "Íà ìåñÿö íàçàä (óäåðæèâàòü äëÿ ìåíþ)";
+Calendar._TT["GO_TODAY"] = "Ñåãîäíÿ";
+Calendar._TT["NEXT_MONTH"] = "Íà ìåñÿö âïåðåä (óäåðæèâàòü äëÿ ìåíþ)";
+Calendar._TT["NEXT_YEAR"] = "Íà ãîä âïåðåä (óäåðæèâàòü äëÿ ìåíþ)";
+Calendar._TT["SEL_DATE"] = "Âûáåðèòå äàòó";
+Calendar._TT["DRAG_TO_MOVE"] = "Ïåðåòàñêèâàéòå ìûøêîé";
+Calendar._TT["PART_TODAY"] = " (ñåãîäíÿ)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Ïåðâûé äåíü íåäåëè áóäåò %s";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Çàêðûòü";
+Calendar._TT["TODAY"] = "Ñåãîäíÿ";
+Calendar._TT["TIME_PART"] = "(Shift-)êëèê èëè íàæàòü è äâèãàòü";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%e %b, %a";
+
+Calendar._TT["WK"] = "íåä";
+Calendar._TT["TIME"] = "Âðåìÿ:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-si.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-si.js
new file mode 100644 (file)
index 0000000..cb3dfb9
--- /dev/null
@@ -0,0 +1,94 @@
+/* Slovenian language file for the DHTML Calendar version 0.9.2 \r
+* Author David Milost <mercy@volja.net>, January 2004.\r
+* Feel free to use this script under the terms of the GNU Lesser General\r
+* Public License, as long as you do not remove or alter this notice.\r
+*/\r
+ // full day names\r
+Calendar._DN = new Array\r
+("Nedelja",\r
+ "Ponedeljek",\r
+ "Torek",\r
+ "Sreda",\r
+ "Četrtek",\r
+ "Petek",\r
+ "Sobota",\r
+ "Nedelja");\r
+ // short day names\r
+ Calendar._SDN = new Array\r
+("Ned",\r
+ "Pon",\r
+ "Tor",\r
+ "Sre",\r
+ "Čet",\r
+ "Pet",\r
+ "Sob",\r
+ "Ned");\r
+// short month names\r
+Calendar._SMN = new Array\r
+("Jan",\r
+ "Feb",\r
+ "Mar",\r
+ "Apr",\r
+ "Maj",\r
+ "Jun",\r
+ "Jul",\r
+ "Avg",\r
+ "Sep",\r
+ "Okt",\r
+ "Nov",\r
+ "Dec");\r
+  // full month names\r
+Calendar._MN = new Array\r
+("Januar",\r
+ "Februar",\r
+ "Marec",\r
+ "April",\r
+ "Maj",\r
+ "Junij",\r
+ "Julij",\r
+ "Avgust",\r
+ "September",\r
+ "Oktober",\r
+ "November",\r
+ "December");\r
+\r
+// tooltips\r
+// tooltips\r
+Calendar._TT = {};\r
+Calendar._TT["INFO"] = "O koledarju";\r
+\r
+Calendar._TT["ABOUT"] =\r
+"DHTML Date/Time Selector\n" +\r
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)\r
+"Za zadnjo verzijo pojdine na naslov: http://www.dynarch.com/projects/calendar/\n" +\r
+"Distribuirano pod GNU LGPL.  Poglejte http://gnu.org/licenses/lgpl.html za podrobnosti." +\r
+"\n\n" +\r
+"Izbor datuma:\n" +\r
+"- Uporabite \xab, \xbb gumbe za izbor leta\n" +\r
+"- Uporabite " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " gumbe za izbor meseca\n" +\r
+"- Zadržite klik na kateremkoli od zgornjih gumbov za hiter izbor.";\r
+Calendar._TT["ABOUT_TIME"] = "\n\n" +\r
+"Izbor ćasa:\n" +\r
+"- Kliknite na katerikoli del ćasa za poveć. le-tega\n" +\r
+"- ali Shift-click za zmanj. le-tega\n" +\r
+"- ali kliknite in povlecite za hiter izbor.";\r
+\r
+Calendar._TT["TOGGLE"] = "Spremeni dan s katerim se prićne teden";\r
+Calendar._TT["PREV_YEAR"] = "Predhodnje leto (dolg klik za meni)";\r
+Calendar._TT["PREV_MONTH"] = "Predhodnji mesec (dolg klik za meni)";\r
+Calendar._TT["GO_TODAY"] = "Pojdi na tekoći dan";\r
+Calendar._TT["NEXT_MONTH"] = "Naslednji mesec (dolg klik za meni)";\r
+Calendar._TT["NEXT_YEAR"] = "Naslednje leto (dolg klik za meni)";\r
+Calendar._TT["SEL_DATE"] = "Izberite datum";\r
+Calendar._TT["DRAG_TO_MOVE"] = "Pritisni in povleci za spremembo pozicije";\r
+Calendar._TT["PART_TODAY"] = " (danes)";\r
+Calendar._TT["MON_FIRST"] = "Prikaži ponedeljek kot prvi dan";\r
+Calendar._TT["SUN_FIRST"] = "Prikaži nedeljo kot prvi dan";\r
+Calendar._TT["CLOSE"] = "Zapri";\r
+Calendar._TT["TODAY"] = "Danes";\r
+\r
+// date formats\r
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";\r
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";\r
+\r
+Calendar._TT["WK"] = "Ted";
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sk.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sk.js
new file mode 100644 (file)
index 0000000..4fe6a3c
--- /dev/null
@@ -0,0 +1,99 @@
+// ** I18N
+
+// Calendar SK language
+// Author: Peter Valach (pvalach@gmx.net)
+// Encoding: utf-8
+// Last update: 2003/10/29
+// Distributed under the same terms as the calendar itself.
+
+// full day names
+Calendar._DN = new Array
+("NedeÄľa",
+ "Pondelok",
+ "Utorok",
+ "Streda",
+ "Ĺ tvrtok",
+ "Piatok",
+ "Sobota",
+ "NedeÄľa");
+
+// short day names
+Calendar._SDN = new Array
+("Ned",
+ "Pon",
+ "Uto",
+ "Str",
+ "Ĺ tv",
+ "Pia",
+ "Sob",
+ "Ned");
+
+// full month names
+Calendar._MN = new Array
+("Január",
+ "Február",
+ "Marec",
+ "AprĂ­l",
+ "Máj",
+ "JĂşn",
+ "JĂşl",
+ "August",
+ "September",
+ "OktĂłber",
+ "November",
+ "December");
+
+// short month names
+Calendar._SMN = new Array
+("Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "Máj",
+ "JĂşn",
+ "JĂşl",
+ "Aug",
+ "Sep",
+ "Okt",
+ "Nov",
+ "Dec");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "O kalendári";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
+"PoslednĂş verziu nájdete na: http://www.dynarch.com/projects/calendar/\n" +
+"DistribuovanĂ© pod GNU LGPL.  ViÄŹ http://gnu.org/licenses/lgpl.html pre detaily." +
+"\n\n" +
+"VĂ˝ber dátumu:\n" +
+"- PouĹľite tlaÄŤidlá \xab, \xbb pre vĂ˝ber roku\n" +
+"- PouĹľite tlaÄŤidlá " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pre vĂ˝ber mesiaca\n" +
+"- Ak ktorĂ©koÄľvek z tĂ˝chto tlaÄŤidiel podržíte dlhšie, zobrazĂ­ sa rĂ˝chly vĂ˝ber.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"VĂ˝ber ÄŤasu:\n" +
+"- Kliknutie na niektorĂş poloĹľku ÄŤasu ju zvýši\n" +
+"- Shift-klik ju znĂ­Ĺľi\n" +
+"- Ak podržíte tlaÄŤĂ­tko stlaÄŤenĂ©, posĂşvanĂ­m menĂ­te hodnotu.";
+
+Calendar._TT["PREV_YEAR"] = "PredošlĂ˝ rok (podrĹľte pre menu)";
+Calendar._TT["PREV_MONTH"] = "PredošlĂ˝ mesiac (podrĹľte pre menu)";
+Calendar._TT["GO_TODAY"] = "PrejsĹĄ na dnešok";
+Calendar._TT["NEXT_MONTH"] = "Nasl. mesiac (podrĹľte pre menu)";
+Calendar._TT["NEXT_YEAR"] = "Nasl. rok (podrĹľte pre menu)";
+Calendar._TT["SEL_DATE"] = "ZvoÄľte dátum";
+Calendar._TT["DRAG_TO_MOVE"] = "PodrĹľanĂ­m tlaÄŤĂ­tka zmenĂ­te polohu";
+Calendar._TT["PART_TODAY"] = " (dnes)";
+Calendar._TT["MON_FIRST"] = "ZobraziĹĄ pondelok ako prvĂ˝";
+Calendar._TT["SUN_FIRST"] = "ZobraziĹĄ nedeÄľu ako prvĂş";
+Calendar._TT["CLOSE"] = "ZavrieĹĄ";
+Calendar._TT["TODAY"] = "Dnes";
+Calendar._TT["TIME_PART"] = "(Shift-)klik/ĹĄahanie zmenĂ­ hodnotu";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "$d. %m. %Y";
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %e. %b";
+
+Calendar._TT["WK"] = "týž";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sp.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sp.js
new file mode 100644 (file)
index 0000000..239d1b3
--- /dev/null
@@ -0,0 +1,110 @@
+// ** I18N
+
+// Calendar SP language
+// Author: Rafael Velasco <rvu_at_idecnet_dot_com>
+// Encoding: any
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("Domingo",
+ "Lunes",
+ "Martes",
+ "Miercoles",
+ "Jueves",
+ "Viernes",
+ "Sabado",
+ "Domingo");
+
+Calendar._SDN = new Array
+("Dom",
+ "Lun",
+ "Mar",
+ "Mie",
+ "Jue",
+ "Vie",
+ "Sab",
+ "Dom");
+
+// full month names
+Calendar._MN = new Array
+("Enero",
+ "Febrero",
+ "Marzo",
+ "Abril",
+ "Mayo",
+ "Junio",
+ "Julio",
+ "Agosto",
+ "Septiembre",
+ "Octubre",
+ "Noviembre",
+ "Diciembre");
+
+// short month names
+Calendar._SMN = new Array
+("Ene",
+ "Feb",
+ "Mar",
+ "Abr",
+ "May",
+ "Jun",
+ "Jul",
+ "Ago",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dic");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Información del Calendario";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"Nuevas versiones en: http://www.dynarch.com/projects/calendar/\n" +
+"Distribuida bajo licencia GNU LGPL.  Para detalles vea http://gnu.org/licenses/lgpl.html ." +
+"\n\n" +
+"Selección de Fechas:\n" +
+"- Use  \xab, \xbb para seleccionar el año\n" +
+"- Use " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para seleccionar el mes\n" +
+"- Mantenga presionado el botón del ratón en cualquiera de las opciones superiores para un acceso rapido .";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Selección del Reloj:\n" +
+"- Seleccione la hora para cambiar el reloj\n" +
+"- o presione  Shift-click para disminuirlo\n" +
+"- o presione click y arrastre del ratón para una selección rapida.";
+
+Calendar._TT["PREV_YEAR"] = "Año anterior (Presione para menu)";
+Calendar._TT["PREV_MONTH"] = "Mes Anterior (Presione para menu)";
+Calendar._TT["GO_TODAY"] = "Ir a Hoy";
+Calendar._TT["NEXT_MONTH"] = "Mes Siguiente (Presione para menu)";
+Calendar._TT["NEXT_YEAR"] = "Año Siguiente (Presione para menu)";
+Calendar._TT["SEL_DATE"] = "Seleccione fecha";
+Calendar._TT["DRAG_TO_MOVE"] = "Arrastre y mueva";
+Calendar._TT["PART_TODAY"] = " (Hoy)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "Mostrar %s primero";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "Cerrar";
+Calendar._TT["TODAY"] = "Hoy";
+Calendar._TT["TIME_PART"] = "(Shift-)Click o arrastra para cambar el valor";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%dd-%mm-%yy";
+Calendar._TT["TT_DATE_FORMAT"] = "%A, %e de %B de %Y";
+
+Calendar._TT["WK"] = "Sm";
+Calendar._TT["TIME"] = "Hora:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sv.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-sv.js
new file mode 100644 (file)
index 0000000..db1f4b8
--- /dev/null
@@ -0,0 +1,93 @@
+// ** I18N
+
+// Calendar SV language (Swedish, svenska)
+// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
+// Translation team: <sv@li.org>
+// Translator: Leonard Norrgård <leonard.norrgard@refactor.fi>
+// Last translator: Leonard Norrgård <leonard.norrgard@refactor.fi>
+// Encoding: iso-latin-1
+// Distributed under the same terms as the calendar itself.
+
+// For translators: please use UTF-8 if possible.  We strongly believe that
+// Unicode is the answer to a real internationalized world.  Also please
+// include your contact information in the header, as can be seen above.
+
+// full day names
+Calendar._DN = new Array
+("söndag",
+ "måndag",
+ "tisdag",
+ "onsdag",
+ "torsdag",
+ "fredag",
+ "lördag",
+ "söndag");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+Calendar._SDN_len = 2;
+Calendar._SMN_len = 3;
+
+// full month names
+Calendar._MN = new Array
+("januari",
+ "februari",
+ "mars",
+ "april",
+ "maj",
+ "juni",
+ "juli",
+ "augusti",
+ "september",
+ "oktober",
+ "november",
+ "december");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "Om kalendern";
+
+Calendar._TT["ABOUT"] =
+"DHTML Datum/tid-väljare\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"För senaste version gå till: http://www.dynarch.com/projects/calendar/\n" +
+"Distribueras under GNU LGPL.  Se http://gnu.org/licenses/lgpl.html för detaljer." +
+"\n\n" +
+"Val av datum:\n" +
+"- Använd knapparna \xab, \xbb för att välja år\n" +
+"- Använd knapparna " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " för att välja månad\n" +
+"- Håll musknappen nedtryckt på någon av ovanstående knappar för snabbare val.";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Val av tid:\n" +
+"- Klicka på en del av tiden för att öka den delen\n" +
+"- eller skift-klicka för att minska den\n" +
+"- eller klicka och drag för snabbare val.";
+
+Calendar._TT["PREV_YEAR"] = "Föregående år (håll för menu)";
+Calendar._TT["PREV_MONTH"] = "Föregående månad (håll för menu)";
+Calendar._TT["GO_TODAY"] = "Gå till dagens datum";
+Calendar._TT["NEXT_MONTH"] = "Följande månad (håll för menu)";
+Calendar._TT["NEXT_YEAR"] = "Följande år (håll för menu)";
+Calendar._TT["SEL_DATE"] = "Välj datum";
+Calendar._TT["DRAG_TO_MOVE"] = "Drag för att flytta";
+Calendar._TT["PART_TODAY"] = " (idag)";
+Calendar._TT["MON_FIRST"] = "Visa måndag först";
+Calendar._TT["SUN_FIRST"] = "Visa söndag först";
+Calendar._TT["CLOSE"] = "Stäng";
+Calendar._TT["TODAY"] = "Idag";
+Calendar._TT["TIME_PART"] = "(Skift-)klicka eller drag för att ändra tid";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%A %d %b %Y";
+
+Calendar._TT["WK"] = "vecka";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-tr.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-tr.js
new file mode 100644 (file)
index 0000000..2164687
--- /dev/null
@@ -0,0 +1,58 @@
+//////////////////////////////////////////////////////////////////////////////////////////////\r
+//     Turkish Translation by Nuri AKMAN\r
+//     Location: Ankara/TURKEY\r
+//     e-mail  : nuriakman@hotmail.com\r
+//     Date    : April, 9 2003\r
+//\r
+//     Note: if Turkish Characters does not shown on you screen\r
+//               please include falowing line your html code:\r
+//\r
+//               <meta http-equiv="Content-Type" content="text/html; charset=windows-1254">\r
+//\r
+//////////////////////////////////////////////////////////////////////////////////////////////\r
+\r
+// ** I18N\r
+Calendar._DN = new Array\r
+("Pazar",\r
+ "Pazartesi",\r
+ "Salý",\r
+ "Çarþamba",\r
+ "Perþembe",\r
+ "Cuma",\r
+ "Cumartesi",\r
+ "Pazar");\r
+Calendar._MN = new Array\r
+("Ocak",\r
+ "Þubat",\r
+ "Mart",\r
+ "Nisan",\r
+ "Mayýs",\r
+ "Haziran",\r
+ "Temmuz",\r
+ "Aðustos",\r
+ "Eylül",\r
+ "Ekim",\r
+ "Kasým",\r
+ "Aralýk");\r
+\r
+// tooltips\r
+Calendar._TT = {};\r
+Calendar._TT["TOGGLE"] = "Haftanýn ilk gününü kaydýr";\r
+Calendar._TT["PREV_YEAR"] = "Önceki Yýl (Menü için basýlý tutunuz)";\r
+Calendar._TT["PREV_MONTH"] = "Önceki Ay (Menü için basýlý tutunuz)";\r
+Calendar._TT["GO_TODAY"] = "Bugün'e git";\r
+Calendar._TT["NEXT_MONTH"] = "Sonraki Ay (Menü için basýlý tutunuz)";\r
+Calendar._TT["NEXT_YEAR"] = "Sonraki Yýl (Menü için basýlý tutunuz)";\r
+Calendar._TT["SEL_DATE"] = "Tarih seçiniz";\r
+Calendar._TT["DRAG_TO_MOVE"] = "Taþýmak için sürükleyiniz";\r
+Calendar._TT["PART_TODAY"] = " (bugün)";\r
+Calendar._TT["MON_FIRST"] = "Takvim Pazartesi gününden baþlasýn";\r
+Calendar._TT["SUN_FIRST"] = "Takvim Pazar gününden baþlasýn";\r
+Calendar._TT["CLOSE"] = "Kapat";\r
+Calendar._TT["TODAY"] = "Bugün";\r
+\r
+// date formats\r
+Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y";\r
+Calendar._TT["TT_DATE_FORMAT"] = "d MM y, DD";\r
+\r
+Calendar._TT["WK"] = "Hafta";\r
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-zh.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/calendar-zh.js
new file mode 100644 (file)
index 0000000..4a0feb6
--- /dev/null
@@ -0,0 +1,119 @@
+// ** I18N
+
+// Calendar ZH language
+// Author: muziq, <muziq@sina.com>
+// Encoding: GB2312 or GBK
+// Distributed under the same terms as the calendar itself.
+
+// full day names
+Calendar._DN = new Array
+("ÐÇÆÚÈÕ",
+ "ÐÇÆÚÒ»",
+ "ÐÇÆÚ¶þ",
+ "ÐÇÆÚÈý",
+ "ÐÇÆÚËÄ",
+ "ÐÇÆÚÎå",
+ "ÐÇÆÚÁù",
+ "ÐÇÆÚÈÕ");
+
+// Please note that the following array of short day names (and the same goes
+// for short month names, _SMN) isn't absolutely necessary.  We give it here
+// for exemplification on how one can customize the short day names, but if
+// they are simply the first N letters of the full name you can simply say:
+//
+//   Calendar._SDN_len = N; // short day name length
+//   Calendar._SMN_len = N; // short month name length
+//
+// If N = 3 then this is not needed either since we assume a value of 3 if not
+// present, to be compatible with translation files that were written before
+// this feature.
+
+// short day names
+Calendar._SDN = new Array
+("ÈÕ",
+ "һ",
+ "¶þ",
+ "Èý",
+ "ËÄ",
+ "Îå",
+ "Áù",
+ "ÈÕ");
+
+// full month names
+Calendar._MN = new Array
+("Ò»ÔÂ",
+ "¶þÔÂ",
+ "ÈýÔÂ",
+ "ËÄÔÂ",
+ "ÎåÔÂ",
+ "ÁùÔÂ",
+ "ÆßÔÂ",
+ "°ËÔÂ",
+ "¾ÅÔÂ",
+ "Ê®ÔÂ",
+ "ʮһÔÂ",
+ "Ê®¶þÔÂ");
+
+// short month names
+Calendar._SMN = new Array
+("Ò»ÔÂ",
+ "¶þÔÂ",
+ "ÈýÔÂ",
+ "ËÄÔÂ",
+ "ÎåÔÂ",
+ "ÁùÔÂ",
+ "ÆßÔÂ",
+ "°ËÔÂ",
+ "¾ÅÔÂ",
+ "Ê®ÔÂ",
+ "ʮһÔÂ",
+ "Ê®¶þÔÂ");
+
+// tooltips
+Calendar._TT = {};
+Calendar._TT["INFO"] = "°ïÖú";
+
+Calendar._TT["ABOUT"] =
+"DHTML Date/Time Selector\n" +
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
+"\n\n" +
+"Ñ¡ÔñÈÕÆÚ:\n" +
+"- µã»÷ \xab, \xbb °´Å¥Ñ¡ÔñÄê·Ý\n" +
+"- µã»÷ " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " °´Å¥Ñ¡ÔñÔ·Ý\n" +
+"- ³¤°´ÒÔÉÏ°´Å¥¿É´Ó²Ëµ¥ÖпìËÙÑ¡ÔñÄê·Ý»òÔ·Ý";
+Calendar._TT["ABOUT_TIME"] = "\n\n" +
+"Ñ¡Ôñʱ¼ä:\n" +
+"- µã»÷Сʱ»ò·ÖÖÓ¿Éʹ¸ÄÊýÖµ¼ÓÒ»\n" +
+"- °´×¡Shift¼üµã»÷Сʱ»ò·ÖÖÓ¿Éʹ¸ÄÊýÖµ¼õÒ»\n" +
+"- µã»÷Í϶¯Êó±ê¿É½øÐпìËÙÑ¡Ôñ";
+
+Calendar._TT["PREV_YEAR"] = "ÉÏÒ»Äê (°´×¡³ö²Ëµ¥)";
+Calendar._TT["PREV_MONTH"] = "ÉÏÒ»Ô (°´×¡³ö²Ëµ¥)";
+Calendar._TT["GO_TODAY"] = "תµ½½ñÈÕ";
+Calendar._TT["NEXT_MONTH"] = "ÏÂÒ»Ô (°´×¡³ö²Ëµ¥)";
+Calendar._TT["NEXT_YEAR"] = "ÏÂÒ»Äê (°´×¡³ö²Ëµ¥)";
+Calendar._TT["SEL_DATE"] = "Ñ¡ÔñÈÕÆÚ";
+Calendar._TT["DRAG_TO_MOVE"] = "Í϶¯";
+Calendar._TT["PART_TODAY"] = " (½ñÈÕ)";
+
+// the following is to inform that "%s" is to be the first day of week
+// %s will be replaced with the day name.
+Calendar._TT["DAY_FIRST"] = "×î×ó±ßÏÔʾ%s";
+
+// This may be locale-dependent.  It specifies the week-end days, as an array
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
+// means Monday, etc.
+Calendar._TT["WEEKEND"] = "0,6";
+
+Calendar._TT["CLOSE"] = "¹Ø±Õ";
+Calendar._TT["TODAY"] = "½ñÈÕ";
+Calendar._TT["TIME_PART"] = "(Shift-)µã»÷Êó±ê»òÍ϶¯¸Ä±äÖµ";
+
+// date formats
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
+Calendar._TT["TT_DATE_FORMAT"] = "%A, %b %eÈÕ";
+
+Calendar._TT["WK"] = "ÖÜ";
+Calendar._TT["TIME"] = "ʱ¼ä:";
diff --git a/extra/webapps/article-manager/resources/jscalendar-1.0/lang/cn_utf8.js b/extra/webapps/article-manager/resources/jscalendar-1.0/lang/cn_utf8.js
new file mode 100644 (file)
index 0000000..a0ef7c6
--- /dev/null
@@ -0,0 +1,123 @@
+// ** I18N\r
+\r
+// Calendar EN language\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+// Encoding: any\r
+// Translator : Niko <nikoused@gmail.com>\r
+// Distributed under the same terms as the calendar itself.\r
+\r
+// For translators: please use UTF-8 if possible.  We strongly believe that\r
+// Unicode is the answer to a real internationalized world.  Also please\r
+// include your contact information in the header, as can be seen above.\r
+\r
+// full day names\r
+Calendar._DN = new Array\r
+("\u5468\u65e5",//\u5468\u65e5\r
+ "\u5468\u4e00",//\u5468\u4e00\r
+ "\u5468\u4e8c",//\u5468\u4e8c\r
+ "\u5468\u4e09",//\u5468\u4e09\r
+ "\u5468\u56db",//\u5468\u56db\r
+ "\u5468\u4e94",//\u5468\u4e94\r
+ "\u5468\u516d",//\u5468\u516d\r
+ "\u5468\u65e5");//\u5468\u65e5\r
+\r
+// Please note that the following array of short day names (and the same goes\r
+// for short month names, _SMN) isn't absolutely necessary.  We give it here\r
+// for exemplification on how one can customize the short day names, but if\r
+// they are simply the first N letters of the full name you can simply say:\r
+//\r
+//   Calendar._SDN_len = N; // short day name length\r
+//   Calendar._SMN_len = N; // short month name length\r
+//\r
+// If N = 3 then this is not needed either since we assume a value of 3 if not\r
+// present, to be compatible with translation files that were written before\r
+// this feature.\r
+\r
+// short day names\r
+Calendar._SDN = new Array\r
+("\u5468\u65e5",\r
+ "\u5468\u4e00",\r
+ "\u5468\u4e8c",\r
+ "\u5468\u4e09",\r
+ "\u5468\u56db",\r
+ "\u5468\u4e94",\r
+ "\u5468\u516d",\r
+ "\u5468\u65e5");\r
+\r
+// full month names\r
+Calendar._MN = new Array\r
+("\u4e00\u6708",\r
+ "\u4e8c\u6708",\r
+ "\u4e09\u6708",\r
+ "\u56db\u6708",\r
+ "\u4e94\u6708",\r
+ "\u516d\u6708",\r
+ "\u4e03\u6708",\r
+ "\u516b\u6708",\r
+ "\u4e5d\u6708",\r
+ "\u5341\u6708",\r
+ "\u5341\u4e00\u6708",\r
+ "\u5341\u4e8c\u6708");\r
+\r
+// short month names\r
+Calendar._SMN = new Array\r
+("\u4e00\u6708",\r
+ "\u4e8c\u6708",\r
+ "\u4e09\u6708",\r
+ "\u56db\u6708",\r
+ "\u4e94\u6708",\r
+ "\u516d\u6708",\r
+ "\u4e03\u6708",\r
+ "\u516b\u6708",\r
+ "\u4e5d\u6708",\r
+ "\u5341\u6708",\r
+ "\u5341\u4e00\u6708",\r
+ "\u5341\u4e8c\u6708");\r
+\r
+// tooltips\r
+Calendar._TT = {};\r
+Calendar._TT["INFO"] = "\u5173\u4e8e";\r
+\r
+Calendar._TT["ABOUT"] =\r
+"   DHTML \u65e5\u8d77/\u65f6\u95f4\u9009\u62e9\u63a7\u4ef6\n" +\r
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)\r
+"For latest version visit: \u6700\u65b0\u7248\u672c\u8bf7\u767b\u9646http://www.dynarch.com/projects/calendar/\u5bdf\u770b\n" +\r
+"\u9075\u5faaGNU LGPL.  \u7ec6\u8282\u53c2\u9605 http://gnu.org/licenses/lgpl.html" +\r
+"\n\n" +\r
+"\u65e5\u671f\u9009\u62e9:\n" +\r
+"- \u70b9\u51fb\xab(\xbb)\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e00\u5e74\u5ea6.\n" +\r
+"- \u70b9\u51fb" + String.fromCharCode(0x2039) + "(" + String.fromCharCode(0x203a) + ")\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e2a\u6708\u4efd.\n" +\r
+"- \u957f\u65f6\u95f4\u6309\u7740\u6309\u94ae\u5c06\u51fa\u73b0\u66f4\u591a\u9009\u62e9\u9879.";\r
+Calendar._TT["ABOUT_TIME"] = "\n\n" +\r
+"\u65f6\u95f4\u9009\u62e9:\n" +\r
+"-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u589e\u52a0\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\n" +\r
+"-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u6309\u4f4fShift\u952e\u540e\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u51cf\u5c11\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2).";\r
+\r
+Calendar._TT["PREV_YEAR"] = "\u4e0a\u4e00\u5e74";\r
+Calendar._TT["PREV_MONTH"] = "\u4e0a\u4e2a\u6708";\r
+Calendar._TT["GO_TODAY"] = "\u5230\u4eca\u5929";\r
+Calendar._TT["NEXT_MONTH"] = "\u4e0b\u4e2a\u6708";\r
+Calendar._TT["NEXT_YEAR"] = "\u4e0b\u4e00\u5e74";\r
+Calendar._TT["SEL_DATE"] = "\u9009\u62e9\u65e5\u671f";\r
+Calendar._TT["DRAG_TO_MOVE"] = "\u62d6\u52a8";\r
+Calendar._TT["PART_TODAY"] = " (\u4eca\u5929)";\r
+\r
+// the following is to inform that "%s" is to be the first day of week\r
+// %s will be replaced with the day name.\r
+Calendar._TT["DAY_FIRST"] = "%s\u4e3a\u8fd9\u5468\u7684\u7b2c\u4e00\u5929";\r
+\r
+// This may be locale-dependent.  It specifies the week-end days, as an array\r
+// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1\r
+// means Monday, etc.\r
+Calendar._TT["WEEKEND"] = "0,6";\r
+\r
+Calendar._TT["CLOSE"] = "\u5173\u95ed";\r
+Calendar._TT["TODAY"] = "\u4eca\u5929";\r
+Calendar._TT["TIME_PART"] = "(\u6309\u7740Shift\u952e)\u5355\u51fb\u6216\u62d6\u52a8\u6539\u53d8\u503c";\r
+\r
+// date formats\r
+Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";\r
+Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e\u65e5";\r
+\r
+Calendar._TT["WK"] = "\u5468";\r
+Calendar._TT["TIME"] = "\u65f6\u95f4:";\r
diff --git a/extra/webapps/article-manager/resources/style.css b/extra/webapps/article-manager/resources/style.css
new file mode 100644 (file)
index 0000000..301cd38
--- /dev/null
@@ -0,0 +1,65 @@
+body {
+background-color : #cccccc;
+color : #000000;
+margin:10px 10px 0px 10px;
+padding:5px;
+}
+
+#navigation {
+position: absolute;
+left:10px;
+width:160px;
+background:#fff;
+border:1px solid #000;
+}
+
+#navigation h1 {
+font-size: 18px;
+text-align: center;
+}
+
+#article {
+background:#fff;
+margin-left: 159px;
+margin-right: 159px;
+border:1px solid #000;
+voice-family: "\"}\"";
+voice-family: inherit;
+margin-left: 161px;
+margin-right: 159px;
+}
+
+html>body #article {
+margin-left: 161px;
+margin-right: 159px;
+}
+
+p,h1,pre {
+margin:0px 10px 10px 10px;
+}
+               
+h1 {
+font-size:14px;
+padding-top:10px;
+}
+               
+#banner h1 {
+font-size:24px;
+padding:10px 10px 0px 10px;
+margin:0px;
+text-align: center;
+}
+
+#copyright { 
+text-align: center; 
+color: #FFF; 
+font-size: 65%;   
+}    
+
+ pre { border: 1px dashed black; border-width: 1px; 
+            line-height:1.0em;
+            background: #ffe; 
+            margin: 0.5em 0.5em 0.5em 0.5em;
+            padding: 0.5em;
+            font-size: 70%;
+             }
\ No newline at end of file
diff --git a/extra/webapps/article-manager/resources/wiky.css b/extra/webapps/article-manager/resources/wiky.css
new file mode 100644 (file)
index 0000000..062f34e
--- /dev/null
@@ -0,0 +1,15 @@
+/* == wiky == */\r
+*.wiki blockquote { background:#ddd; border:solid 1px #999; margin-left:1em; padding:0.5em;}\r
+*.wiki table {\r
+  border-collapse: collapse;\r
+  empty-cells: show;\r
+}\r
+\r
+*.wiki table td {\r
+  border: solid 1px black;\r
+  padding: 0.25em 0.5em 0.25em 0.5em;\r
+  text-align: center;\r
+}\r
+\r
+/*pre { font-size:100%; background: #eed; border:1px dotted #999; padding:0 0.5em; overflow:auto; }*/\r
+pre { font-family:courier new, monospace; overflow:auto; }\r
diff --git a/extra/webapps/article-manager/resources/wiky.js b/extra/webapps/article-manager/resources/wiky.js
new file mode 100644 (file)
index 0000000..002855b
--- /dev/null
@@ -0,0 +1,373 @@
+/*     This work is licensed under Creative Commons GNU LGPL License.
+
+       License: http://creativecommons.org/licenses/LGPL/2.1/
+
+       Author:  Stefan Goessner/2005-06
+       Web:     http://goessner.net/ 
+*/
+var Wiky = {
+  version: 0.95,
+  blocks: null,
+  rules: {
+     all: [
+       "Wiky.rules.pre",
+       "Wiky.rules.nonwikiblocks",
+       "Wiky.rules.wikiblocks",
+       "Wiky.rules.post",
+     ],
+     pre: [
+       { rex:/(\r?\n)/g, tmplt:"\xB6" },  // replace line breaks with '¶' ..
+     ],
+     post: [
+       { rex:/(^\xB6)|(\xB6$)/g, tmplt:"" },  // .. remove linebreaks at BOS and EOS ..
+       { rex:/@([0-9]+)@/g, tmplt:function($0,$1){return Wiky.restore($1);} }, // resolve blocks ..
+       { rex:/\xB6/g, tmplt:"\n" } // replace '¶' with line breaks ..
+     ],
+     nonwikiblocks: [
+       { rex:/\\([%])/g, tmplt:function($0,$1){return Wiky.store($1);} },
+       { rex:/\[(?:\{([^}]*)\})?(?:\(([^)]*)\))?%(.*?)%\]/g, tmplt:function($0,$1,$2,$3){return ":p]"+Wiky.store("<pre"+($2?(" lang=\"x-"+Wiky.attr($2)+"\""):"")+Wiky.style($1)+">" + Wiky.apply($3, $2?Wiky.rules.lang[Wiky.attr($2)]:Wiky.rules.code) + "</pre>")+"[p:";} } //programm code block
+     ],
+     wikiblocks: [
+       "Wiky.rules.nonwikiinlines",
+       "Wiky.rules.escapes",
+       { rex:/(?:^|\xB6)(={1,6})(.*?)[=]*(?=\xB6|$)/g, tmplt:function($0,$1,$2){ var h=$1.length; return ":p]\xB6<h"+h+">"+$2+"</h"+h+">\xB6[p:";} }, // <h1> .. <h6>
+       { rex:/(?:^|\xB6)[-]{4}(?:\xB6|$)/g, tmplt:"\xB6<hr/>\xB6" },  // horizontal ruler ..
+       { rex:/\\\\([ \xB6])/g, tmplt:"<br/>$1" },  // forced line break ..
+       { rex:/(^|\xB6)([*01aAiIg]*[\.*])[ ]/g, tmplt:function($0,$1,$2){var state=$2.replace(/([*])/g,"u").replace(/([\.])/,"");return ":"+state+"]"+$1+"["+state+":";}},
+       { rex:/(?:^|\xB6);[ ](.*?):[ ]/g, tmplt:"\xB6:l][l:$1:d][d:"},  // ; term : definition
+       { rex:/\[(?:\{([^}]*)\})?(?:\(([^)]*)\))?\"/g, tmplt:function($0,$1,$2){return ":p]<blockquote"+Wiky.attr($2,"cite",0)+Wiky.attr($2,"title",1)+Wiky.style($1)+">[p:"; } }, // block quotation start
+       { rex:/\"\]/g, tmplt:":p]</blockquote>[p:" }, // block quotation end
+       { rex:/\[(\{[^}]*\})?\|/g, tmplt:":t]$1[r:" },  // .. start table ..
+       { rex:/\|\]/g, tmplt:":r][t:" },  // .. end table ..
+       { rex:/\|\xB6[ ]?\|/g, tmplt:":r]\xB6[r:" },  // .. end/start table row ..
+       { rex:/\|/g, tmplt:":c][c:" },  // .. end/start table cell ..
+       { rex:/^(.*)$/g, tmplt:"[p:$1:p]" },  // start paragraph '[p:' at BOS .. end paragraph ':p]' at EOS ..
+       { rex:/(([\xB6])([ \t\f\v\xB6]*?)){2,}/g, tmplt:":p]$1[p:" },  // .. separate paragraphs at blank lines ..
+       { rex:/\[([01AIacdgilprtu]+)[:](.*?)[:]([01AIacdgilprtu]+)\]/g, tmplt:function($0,$1,$2,$3){return Wiky.sectionRule($1==undefined?"":$1,"",Wiky.apply($2,Wiky.rules.wikiinlines),!$3?"":$3);} },
+       { rex:/\[[01AIacdgilprtu]+[:]|[:][01AIacdgilprtu]+\]/g, tmplt:"" },  // .. remove singular section delimiters (they frequently exist with incomplete documents while typing) ..
+       { rex:/<td>(?:([0-9]*)[>])?([ ]?)(.*?)([ ]?)<\/td>/g, tmplt:function($0,$1,$2,$3,$4){return "<td"+($1?" colspan=\""+$1+"\"":"")+($2==" "?(" style=\"text-align:"+($2==$4?"center":"right")+";\""):($4==" "?" style=\"text-align:left;\"":""))+">"+$2+$3+$4+"</td>";} },
+       { rex:/<(p|table)>(?:\xB6)?(?:\{(.*?)\})/g, tmplt:function($0,$1,$2){return "<"+$1+Wiky.style($2)+">";} },
+       { rex:/<p>([ \t\f\v\xB6]*?)<\/p>/g, tmplt:"$1" },  // .. remove empty paragraphs ..
+       "Wiky.rules.shortcuts"
+     ],
+     nonwikiinlines: [
+       { rex:/%(?:\{([^}]*)\})?(?:\(([^)]*)\))?(.*?)%/g, tmplt:function($0,$1,$2,$3){return Wiky.store("<code"+($2?(" lang=\"x-"+Wiky.attr($2)+"\""):"")+Wiky.style($1)+">" + Wiky.apply($3, $2?Wiky.rules.lang[Wiky.attr($2)]:Wiky.rules.code) + "</code>");} }, // inline code
+       { rex:/%(.*?)%/g, tmplt:function($0,$1){return Wiky.store("<code>" + Wiky.apply($2, Wiky.rules.code) + "</code>");} }
+     ],
+     wikiinlines: [
+       { rex:/\*([^*]+)\*/g, tmplt:"<strong>$1</strong>" },  // .. strong ..
+       { rex:/_([^_]+)_/g, tmplt:"<em>$1</em>" },
+       { rex:/\^([^^]+)\^/g, tmplt:"<sup>$1</sup>" },
+       { rex:/~([^~]+)~/g, tmplt:"<sub>$1</sub>" },
+       { rex:/\(-(.+?)-\)/g, tmplt:"<del>$1</del>" },
+       { rex:/\?([^ \t\f\v\xB6]+)\((.+)\)\?/g, tmplt:"<abbr title=\"$2\">$1</abbr>" },  // .. abbreviation ..
+       { rex:/\[(?:\{([^}]*)\})?[Ii]ma?ge?\:([^ ,\]]*)(?:[, ]([^\]]*))?\]/g, tmplt:function($0,$1,$2,$3){return Wiky.store("<img"+Wiky.style($1)+" src=\""+$2+"\" alt=\""+($3?$3:$2)+"\" title=\""+($3?$3:$2)+"\"/>");} },  // wikimedia image style ..
+       { rex:/\[([^ ,]+)[, ]([^\]]*)\]/g, tmplt:function($0,$1,$2){return Wiky.store("<a href=\""+$1+"\">"+$2+"</a>");}},  // wiki block style uri's ..
+       { rex:/(((http(s?))\:\/\/)?[A-Za-z0-9\._\/~\-:]+\.(?:png|jpg|jpeg|gif|bmp))/g, tmplt:function($0,$1,$2){return Wiky.store("<img src=\""+$1+"\" alt=\""+$1+"\"/>");} },  // simple images .. 
+       { rex:/((mailto\:|javascript\:|(news|file|(ht|f)tp(s?))\:\/\/)[A-Za-z0-9\.:_\/~%\-+&#?!=()@\x80-\xB5\xB7\xFF]+)/g, tmplt:"<a href=\"$1\">$1</a>" }  // simple uri's .. 
+     ],
+     escapes: [
+       { rex:/\\([|*_~\^])/g, tmplt:function($0,$1){return Wiky.store($1);} },
+       { rex:/\\&/g, tmplt:"&amp;" },
+       { rex:/\\>/g, tmplt:"&gt;" },
+       { rex:/\\</g, tmplt:"&lt;" }
+     ],
+     shortcuts: [
+       { rex:/---/g, tmplt:"&#8212;" },  // &mdash;
+       { rex:/--/g, tmplt:"&#8211;" },  // &ndash;
+       { rex:/[\.]{3}/g, tmplt:"&#8230;"}, // &hellip;
+       { rex:/<->/g, tmplt:"&#8596;"}, // $harr;
+       { rex:/<-/g, tmplt:"&#8592;"}, // &larr;
+       { rex:/->/g, tmplt:"&#8594;"}, //&rarr;
+     ],
+     code: [
+       { rex:/&/g, tmplt:"&amp;"},
+       { rex:/</g, tmplt:"&lt;"},
+       { rex:/>/g, tmplt:"&gt;"}
+     ],
+     lang: {}
+   },
+
+   inverse: {
+     all: [
+       "Wiky.inverse.pre",
+       "Wiky.inverse.nonwikiblocks",
+       "Wiky.inverse.wikiblocks",
+       "Wiky.inverse.post"
+     ],
+     pre: [
+       { rex:/(\r?\n)/g, tmplt:"\xB6" }  // replace line breaks with '¶' ..
+     ],
+     post: [
+       { rex:/@([0-9]+)@/g, tmplt:function($0,$1){return Wiky.restore($1);} },  // resolve blocks ..
+       { rex:/\xB6/g, tmplt:"\n" }  // replace '¶' with line breaks ..
+     ],
+     nonwikiblocks: [
+       { rex:/<pre([^>]*)>(.*?)<\/pre>/mgi, tmplt:function($0,$1,$2){return Wiky.store("["+Wiky.invStyle($1)+Wiky.invAttr($1,["lang"]).replace(/x\-/,"")+"%"+Wiky.apply($2, Wiky.hasAttr($1,"lang")?Wiky.inverse.lang[Wiky.attrVal($1,"lang").substr(2)]:Wiky.inverse.code)+"%]");} } //code block
+     ],
+     wikiblocks: [
+       "Wiky.inverse.nonwikiinlines",
+       "Wiky.inverse.escapes",
+       "Wiky.inverse.wikiinlines",
+       { rex:/<h1>(.*?)<\/h1>/mgi, tmplt:"=$1=" },
+       { rex:/<h2>(.*?)<\/h2>/mgi, tmplt:"==$1==" },
+       { rex:/<h3>(.*?)<\/h3>/mgi, tmplt:"===$1===" },
+       { rex:/<h4>(.*?)<\/h4>/mgi, tmplt:"====$1====" },
+       { rex:/<h5>(.*?)<\/h5>/mgi, tmplt:"=====$1=====" },
+       { rex:/<h6>(.*?)<\/h6>/mgi, tmplt:"======$1======" },
+       { rex:/<(p|table)[^>]+(style=\"[^\"]*\")[^>]*>/mgi, tmplt:function($0,$1,$2){return "<"+$1+">"+Wiky.invStyle($2);} },
+       { rex:/\xB6{2}<li/mgi, tmplt:"\xB6<li" },  // ie6 only ..
+       { rex:/<li class=\"?([^ >\"]*)\"?[^>]*?>([^<]*)/mgi, tmplt:function($0,$1,$2){return $1.replace(/u/g,"*").replace(/([01aAiIg])$/,"$1.")+" "+$2;}},  // list items ..
+       { rex:/(^|\xB6)<(u|o)l[^>]*?>\xB6/mgi, tmplt:"$1" },  // only outer level list start at BOL ...
+       { rex:/(<\/(?:dl|ol|ul|p)>[ \xB6]*<(?:p)>)/gi, tmplt:"\xB6\xB6" },
+       { rex:/<dt>(.*?)<\/dt>[ \f\n\r\t\v]*<dd>/mgi, tmplt:"; $1: " },
+       { rex:/<blockquote([^>]*)>/mgi, tmplt:function($0,$1){return Wiky.store("["+Wiky.invStyle($1)+Wiky.invAttr($1,["cite","title"])+"\"");} },
+       { rex:/<\/blockquote>/mgi, tmplt:"\"]" },
+       { rex:/<td class=\"?lft\"?>\xB6*[ ]?|<\/tr>/mgi, tmplt:"|" },  // ie6 only ..
+       { rex:/\xB6<tr(?:[^>]*?)>/mgi, tmplt:"\xB6" },
+       { rex:/<td colspan=\"([0-9]+)\"(?:[^>]*?)>/mgi, tmplt:"|$1>" },
+       { rex:/<td(?:[^>]*?)>/mgi, tmplt:"|" },
+       { rex:/<table>/mgi, tmplt:"[" },
+       { rex:/<\/table>/mgi, tmplt:"]" },
+       { rex:/<tr(?:[^>]*?)>\xB6*|<\/td>\xB6*|<tbody>\xB6*|<\/tbody>/mgi, tmplt:"" },
+       { rex:/<hr\/?>/mgi, tmplt:"----" },
+       { rex:/<br\/?>/mgi, tmplt:"\\\\" },
+       { rex:/(<p>|<(d|o|u)l[^>]*>|<\/(dl|ol|ul|p)>|<\/(li|dd)>)/mgi, tmplt:"" },
+       "Wiky.inverse.shortcuts"
+     ],
+     nonwikiinlines: [
+       { rex:/<code>(.*?)<\/code>/g, tmplt:function($0,$1){return Wiky.store("%"+Wiky.apply($1, Wiky.inverse["code"])+"%");} }
+     ],
+     wikiinlines: [
+       { rex:/<strong[^>]*?>(.*?)<\/strong>/mgi, tmplt:"*$1*" },
+       { rex:/<b[^>]*?>(.*?)<\/b>/mgi, tmplt:"*$1*" },
+       { rex:/<em[^>]*?>(.*?)<\/em>/mgi, tmplt:"_$1_" },
+       { rex:/<i[^>]*?>(.*?)<\/i>/mgi, tmplt:"_$1_" },
+       { rex:/<sup[^>]*?>(.*?)<\/sup>/mgi, tmplt:"^$1^" },
+       { rex:/<sub[^>]*?>(.*?)<\/sub>/mgi, tmplt:"~$1~" },
+       { rex:/<del[^>]*?>(.*?)<\/del>/mgi, tmplt:"(-$1-)" },
+       { rex:/<abbr title=\"([^\"]*)\">(.*?)<\/abbr>/mgi, tmplt:"?$2($1)?" },
+       { rex:/<a href=\"([^\"]*)\"[^>]*?>(.*?)<\/a>/mgi, tmplt:function($0,$1,$2){return $1==$2?$1:"["+$1+","+$2+"]";}},
+       { rex:/<img([^>]*)\/?>/mgi, tmplt:function($0,$1){var a=Wiky.attrVal($1,"alt"),h=Wiky.attrVal($1,"src"),t=Wiky.attrVal($1,"title"),s=Wiky.attrVal($1,"style");return s||(t&&h!=t)?("["+Wiky.invStyle($1)+"img:"+h+(t&&(","+t))+"]"):h;}},
+     ],
+     escapes: [
+       { rex:/([|*_~%\^])/g, tmplt:"\\$1" },
+       { rex:/&amp;/g, tmplt:"\\&" },
+       { rex:/&gt;/g, tmplt:"\\>" },
+       { rex:/&lt;/g, tmplt:"\\<" }
+     ],
+     shortcuts: [
+       { rex:/&#8211;|\u2013/g, tmplt:"--"},
+       { rex:/&#8212;|\u2014/g, tmplt:"---"},
+       { rex:/&#8230;|\u2026/g, tmplt:"..."},
+       { rex:/&#8596;|\u2194/g, tmplt:"<->"},
+       { rex:/&#8592;|\u2190/g, tmplt:"<-"},
+       { rex:/&#8594;|\u2192/g, tmplt:"->"}
+     ],
+     code: [
+       { rex:/&amp;/g, tmplt:"&"},
+       { rex:/&lt;/g, tmplt:"<"},
+       { rex:/&gt;/g, tmplt:">"}
+     ],
+     lang: {}
+   },
+
+   toHtml: function(str) {
+      Wiky.blocks = [];
+      return Wiky.apply(str, Wiky.rules.all);
+   },
+
+   toWiki: function(str) {
+      Wiky.blocks = [];
+      return Wiky.apply(str, Wiky.inverse.all);
+   },
+
+   apply: function(str, rules) {
+      if (str && rules)
+         for (var i in rules) {
+            if (typeof(rules[i]) == "string")
+               str = Wiky.apply(str, eval(rules[i]));
+            else
+               str = str.replace(rules[i].rex, rules[i].tmplt);
+         }
+      return str;
+   },
+   store: function(str, unresolved) {
+      return unresolved ? "@" + (Wiky.blocks.push(str)-1) + "@"
+                        : "@" + (Wiky.blocks.push(str.replace(/@([0-9]+)@/g, function($0,$1){return Wiky.restore($1);}))-1) + "@";
+   },
+   restore: function(idx) {
+      return Wiky.blocks[idx];
+   },
+   attr: function(str, name, idx) {
+      var a = str && str.split(",")[idx||0];
+      return a ? (name ? (" "+name+"=\""+a+"\"") : a) : "";
+   },
+   hasAttr: function(str, name) {
+      return new RegExp(name+"=").test(str);
+   },
+   attrVal: function(str, name) {
+      return str.replace(new RegExp("^.*?"+name+"=\"(.*?)\".*?$"), "$1");
+   },
+   invAttr: function(str, names) {
+      var a=[], x;
+      for (var i in names)
+         if (str.indexOf(names[i]+"=")>=0) 
+            a.push(str.replace(new RegExp("^.*?"+names[i]+"=\"(.*?)\".*?$"), "$1"));
+      return a.length ? ("("+a.join(",")+")") : "";
+   },
+   style: function(str) {
+      var s = str && str.split(/,|;/), p, style = "";
+      for (var i in s) {
+         p = s[i].split(":");
+         if (p[0] == ">")       style += "margin-left:4em;";
+         else if (p[0] == "<")  style += "margin-right:4em;";
+         else if (p[0] == ">>") style += "float:right;";
+         else if (p[0] == "<<") style += "float:left;";
+         else if (p[0] == "=") style += "display:block;margin:0 auto;";
+         else if (p[0] == "_")  style += "text-decoration:underline;";
+         else if (p[0] == "b")  style += "border:solid 1px;";
+         else if (p[0] == "c")  style += "color:"+p[1]+";";
+         else if (p[0] == "C")  style += "background:"+p[1]+";";
+         else if (p[0] == "w")  style += "width:"+p[1]+";";
+         else                   style += p[0]+":"+p[1]+";";
+      }
+      return style ? " style=\""+style+"\"" : "";
+   },
+   invStyle: function(str) {
+      var s = /style=/.test(str) ? str.replace(/^.*?style=\"(.*?)\".*?$/, "$1") : "",
+          p = s && s.split(";"), pi, prop = [];
+      for (var i in p) {
+         pi = p[i].split(":");
+         if (pi[0] == "margin-left" && pi[1]=="4em") prop.push(">");
+         else if (pi[0] == "margin-right" && pi[1]=="4em") prop.push("<");
+         else if (pi[0] == "float" && pi[1]=="right") prop.push(">>");
+         else if (pi[0] == "float" && pi[1]=="left") prop.push("<<");
+         else if (pi[0] == "margin" && pi[1]=="0 auto") prop.push("=");
+         else if (pi[0] == "display" && pi[1]=="block") ;
+         else if (pi[0] == "text-decoration" && pi[1]=="underline") prop.push("_");
+         else if (pi[0] == "border" && pi[1]=="solid 1px") prop.push("b");
+         else if (pi[0] == "color") prop.push("c:"+pi[1]);
+         else if (pi[0] == "background") prop.push("C:"+pi[1]);
+         else if (pi[0] == "width") prop.push("w:"+pi[1]);
+         else if (pi[0]) prop.push(pi[0]+":"+pi[1]);
+      }
+      return prop.length ? ("{" + prop.join(",") + "}") : "";
+   },
+   sectionRule: function(fromLevel, style, content, toLevel) {
+      var trf = { p_p: "<p>$1</p>",
+                  p_u: "<p>$1</p><ul$3>",
+                  p_o: "<p>$1</p><ol$3>",
+                  // p - ul
+                  // ul - p
+                  u_p: "<li$2>$1</li></ul>",
+                  u_c: "<li$2>$1</li></ul></td>",
+                  u_r: "<li$2>$1</li></ul></td></tr>",
+                  uu_p: "<li$2>$1</li></ul></li></ul>",
+                  uo_p: "<li$2>$1</li></ol></li></ul>",
+                  uuu_p: "<li$2>$1</li></ul></li></ul></li></ul>",
+                  uou_p: "<li$2>$1</li></ul></li></ol></li></ul>",
+                  uuo_p: "<li$2>$1</li></ol></li></ul></li></ul>",
+                  uoo_p: "<li$2>$1</li></ol></li></ol></li></ul>",
+                  // ul - ul
+                  u_u: "<li$2>$1</li>",
+                  uu_u: "<li$2>$1</li></ul></li>",
+                  uo_u: "<li$2>$1</li></ol></li>",
+                  uuu_u: "<li$2>$1</li></ul></li></ul></li>",
+                  uou_u: "<li$2>$1</li></ul></li></ol></li>",
+                  uuo_u: "<li$2>$1</li></ol></li></ul></li>",
+                  uoo_u: "<li$2>$1</li></ol></li></ol></li>",
+                  u_uu: "<li$2>$1<ul$3>",
+                  // ul - ol
+                  u_o: "<li$2>$1</li></ul><ol$3>",
+                  uu_o: "<li$2>$1</li></ul></li></ul><ol$3>",
+                  uo_o: "<li$2>$1</li></ol></li></ul><ol$3>",
+                  uuu_o: "<li$2>$1</li></ul></li></ul></li></ul><ol$3>",
+                  uou_o: "<li$2>$1</li></ul></li></ol></li></ul><ol$3>",
+                  uuo_o: "<li$2>$1</li></ol></li></ul></li></ul><ol$3>",
+                  uoo_o: "<li$2>$1</li></ol></li></ol></li></ul><ol$3>",
+                  u_uo: "<li$2>$1<ol$3>",
+                  // ol - p
+                  o_p: "<li$2>$1</li></ol>",
+                  oo_p: "<li$2>$1</li></ol></li></ol>",
+                  ou_p: "<li$2>$1</li></ul></li></ol>",
+                  ooo_p: "<li$2>$1</li></ol></li></ol>",
+                  ouo_p: "<li$2>$1</li></ol></li></ul></li></ol>",
+                  oou_p: "<li$2>$1</li></ul></li></ol></li></ol>",
+                  ouu_p: "<li$2>$1</li></ul></li></ul></li></ol>",
+                  // ol - ul
+                  o_u: "<li$2>$1</li></ol><ul$3>",
+                  oo_u: "<li$2>$1</li></ol></li></ol><ul$3>",
+                  ou_u: "<li$2>$1</li></ul></li></ol><ul$3>",
+                  ooo_u: "<li$2>$1</li></ol></li></ol></li></ol><ul$3>",
+                  ouo_u: "<li$2>$1</li></ol></li></ul></li></ol><ul$3>",
+                  oou_u: "<li$2>$1</li></ul></li></ol></li></ol><ul$3>",
+                  ouu_u: "<li$2>$1</li></ul></li></ul></li></ol><ul$3>",
+                  o_ou: "<li$2>$1<ul$3>",
+                  // -- ol - ol --
+                  o_o: "<li$2>$1</li>",
+                  oo_o: "<li$2>$1</li></ol></li>",
+                  ou_o: "<li$2>$1</li></ul></li>",
+                  ooo_o: "<li$2>$1</li></ol></li></ol></li>",
+                  ouo_o: "<li$2>$1</li></ol></li></ul></li>",
+                  oou_o: "<li$2>$1</li></ul></li></ol></li>",
+                  ouu_o: "<li$2>$1</li></ul></li></ul></li>",
+                  o_oo: "<li$2>$1<ol$3>",
+                  // -- dl --
+                  l_d: "<dt>$1</dt>",
+                  d_l: "<dd>$1</dd>",
+                  d_u: "<dd>$1</dd></dl><ul>",
+                  d_o: "<dd>$1</dd></dl><ol>",
+                  p_l: "<p>$1</p><dl>",
+                  u_l: "<li$2>$1</li></ul><dl>",
+                  o_l: "<li$2>$1</li></ol><dl>",
+                  uu_l: "<li$2>$1</li></ul></li></ul><dl>",
+                  uo_l: "<li$2>$1</li></ol></li></ul><dl>",
+                  ou_l: "<li$2>$1</li></ul></li></ol><dl>",
+                  oo_l: "<li$2>$1</li></ol></li></ol><dl>",
+                  d_p: "<dd>$1</dd></dl>",
+                  // -- table --
+                  p_t: "<p>$1</p><table>",
+                  p_r: "<p>$1</p></td></tr>",
+                  p_c: "<p>$1</p></td>",
+                  t_p: "</table><p>$1</p>",
+                  r_r: "<tr><td>$1</td></tr>",
+                  r_p: "<tr><td><p>$1</p>",
+                  r_c: "<tr><td>$1</td>",
+                  r_u: "<tr><td>$1<ul>",
+                  c_p: "<td><p>$1</p>",
+                  c_r: "<td>$1</td></tr>",
+                  c_c: "<td>$1</td>",
+//                  c_u: "<td>$1<ul>",
+                  u_t: "<li$2>$1</li></ul><table>",
+                  o_t: "<li$2>$1</li></ol><table>",
+                  d_t: "<dd>$1</dd></dl><table>",
+                  t_u: "</table><p>$1</p><ul>",
+                  t_o: "</table><p>$1</p><ol>",
+                  t_l: "</table><p>$1</p><dl>"
+      };
+      var type = { "0": "decimal-leading-zero",
+                   "1": "decimal",
+                   "a": "lower-alpha",
+                   "A": "upper-alpha",
+                   "i": "lower-roman",
+                   "I": "upper-roman",
+                   "g": "lower-greek" };
+
+      var from = "", to = "", maxlen = Math.max(fromLevel.length, toLevel.length), sync = true, sectiontype = type[toLevel.charAt(toLevel.length-1)], transition;
+
+      for (var i=0; i<maxlen; i++)
+         if (fromLevel.charAt(i+1) != toLevel.charAt(i+1) || !sync || i == maxlen-1)
+         {
+            from += fromLevel.charAt(i) == undefined ? " " : fromLevel.charAt(i);
+            to += toLevel.charAt(i) == undefined ? " " : toLevel.charAt(i);
+            sync = false;
+         }
+      transition = (from + "_" + to).replace(/([01AIagi])/g, "o");
+      return !trf[transition] ? ("?(" +  transition + ")")  // error string !
+                              : trf[transition].replace(/\$2/, " class=\"" + fromLevel + "\"")
+                                               .replace(/\$3/, !sectiontype ? "" : (" style=\"list-style-type:" + sectiontype + ";\""))
+                                               .replace(/\$1/, content)
+                                               .replace(/<p><\/p>/, "");
+   }
+}
diff --git a/extra/webapps/article-manager/resources/wiky.lang.css b/extra/webapps/article-manager/resources/wiky.lang.css
new file mode 100644 (file)
index 0000000..0d61d75
--- /dev/null
@@ -0,0 +1,9 @@
+pre.syntax { font-size:100%; background: #eed; border:1px dotted #999; padding:0 0.5em; overflow:auto; }\r
+span.cmt { font-style: italic; color: green; }\r
+span.str { font-style: italic; color: darkred; }\r
+span.kwd { color: blue; }\r
+span.obj  { color: purple; }\r
+span.mbr  { color: gray; }\r
+span.xtag { color: blue; }\r
+span.xnam { color: purple; }\r
+span.xval { font-style: italic; color: darkred; }\r
diff --git a/extra/webapps/article-manager/resources/wiky.lang.js b/extra/webapps/article-manager/resources/wiky.lang.js
new file mode 100644 (file)
index 0000000..dd53e83
--- /dev/null
@@ -0,0 +1,40 @@
+/*     This work is licensed under Creative Commons GNU LGPL License.\r
+\r
+       License: http://creativecommons.org/licenses/LGPL/2.1/\r
+\r
+       Author:  Stefan Goessner/2005-06\r
+       Web:     http://goessner.net/\r
+\r
+   credits: http://www.regular-expressions.info/examplesprogrammer.html\r
+*/\r
+Wiky.rules.lang.js = [\r
+      "Wiky.rules.code",\r
+      { rex:/"([^"\\\xB6]*(\\.[^"\\\xB6]*)*)"/g, tmplt:function($0,$1){return Wiky.store("<span class=\"str\">\""+$1+"\"</span>");}}, // string delimited by '"' with '\"' allowed ..\r
+      { rex:/'([^'\\\xB6]*(\\.[^'\\\xB6]*)*)'/g, tmplt:function($0,$1){return Wiky.store("<span class=\"str\">\'"+$1+"\'</span>");}}, // string delimited by "'" with "\'" allowed ..\r
+      { rex:/\/\/(.*?)(?:\xB6|$)/g, tmplt:function($0,$1){return Wiky.store("<span class\=\"cmt\">//"+$1+"</span>\xB6");}}, // single line comment\r
+      { rex:/\/\*(.*?)\*\//g, tmplt:function($0,$1){return Wiky.store("<span class\=\"cmt\">\/*"+$1+"*\/</span>");}}, // multi-line comment\r
+//       { rex:/([\]\[\-+\|*!%<>=\{\}?:,\)\(]+)|(&#34;|&#47;|&#61;)+/g, tmplt:"<span class=\"op\">$1</span>"}, // operators\r
+      { rex:/\b(break|case|catch|continue|do|else|false|for|function|if|in|new|return|switch|this|throw|true|try|var|while|with)\b/g, tmplt:"<span class=\"kwd\">$1</span>" }, // keywords\r
+      { rex:/\b(arguments|Array|Boolean|Date|Error|Function|Global|Math|Number|Object|RegExp|String)\b/g, tmplt:"<span class=\"obj\">$1</span>" }, // objects\r
+      { rex:/\.(abs|acos|anchor|arguments|asin|atan|atan2|big|blink|bold|callee|caller|ceil|charAt|charCodeAt|concat|constructor|cos|E|escape|eval|exp|fixed|floor|fontcolor|fontsize|fromCharCode|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getSeconds|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getVarDate|getYear|index|indexOf|Infinity|input|isFinite|isNaN|italics|join|lastIndex|lastIndexOf|lastMatch|lastParen|leftContext|length|link|LN10|LN2|log|LOG10E|LOG2E|match|max|MAX_VALUE|min|MIN_VALUE|NaN|NaN|NEGATIVE_INFINITY|parse|parseFloat|parseInt|PI|pop|POSITIVE_INFINITY|pow|prototype|push|random|replace|reverse|rightContext|round|search|setDate|setFullYear|setHours|setMilliseconds|setMinutes|setMonth|setSeconds|setTime|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|shift|sin|slice|slice|small|sort|splice|split|sqrt|SQRT1_2|SQRT2|strike|sub|substr|substring|sup|tan|toGMTString|toLocaleString|toLowerCase|toString|toUpperCase|toUTCString|unescape|unshift|UTC|valueOf)\b/g, tmplt:".<span class=\"mbr\">$1</span>" }, // members\r
+];\r
+Wiky.rules.lang.xml = [\r
+      { rex:/<script([^>]*)>(.*?)<\/script>/g, tmplt:function($0,$1,$2){return "<script"+$1+">"+Wiky.store(Wiky.apply($2, Wiky.rules.lang.js))+"</script>";} }, // script blocks ..\r
+      { rex:/<!\[CDATA\[(.*?)\]\]>/g, tmplt:function($0,$1){return Wiky.store("&lt;![CDATA["+$1+"]]&gt;");} }, // CDATA sections, ..\r
+      { rex:/<!(.*?)>/g, tmplt:function($0,$1){return Wiky.store("<span class=\"cmt\">&lt;!"+$1+"&gt;</span>");} }, // inline xml comments, doctypes, ..\r
+      { rex:/</g, tmplt:"\xAB"}, // replace '<' by '«'\r
+      { rex:/>/g, tmplt:"\xBB"}, // replace '>' by '»'\r
+      { rex:/([-A-Za-z0-9_:]+)[ ]*=[ ]*\"(.*?)\"/g, tmplt:"<span class=\"xnam\">$1</span>=<span class=\"xval\">&quot;$2&quot;</span>"}, // "xml attribute value strings ..\r
+      { rex:/(\xAB[\/]?)([-A-Za-z0-9_:]+)/g, tmplt:"$1<span class=\"xtag\">$2</span>"}, // "xml tag ..\r
+      { rex:/\xAB/g, tmplt:"&lt;"}, // replace '«' by '<'\r
+      { rex:/\xBB/g, tmplt:"&gt;"}, // replace '»' by '>'\r
+];\r
+Wiky.inverse.lang.js = [\r
+     { rex:/<span class=\"?(cmt|kwd|mbr|obj|str)\"?>|<\/span>/mgi, tmplt:"" },\r
+     { rex:/<strong>(.*?)<\/strong>/mgi, tmplt:"[*$1*]" },\r
+      "Wiky.inverse.code"\r
+];\r
+Wiky.inverse.lang.xml = [\r
+     { rex:/<span class=\"?(cmt|xtag|xnam|xval)\"?>|<\/span>/mgi, tmplt:"" },\r
+     "Wiky.inverse.lang.js"\r
+];\r
diff --git a/extra/webapps/article-manager/resources/wiky.math.css b/extra/webapps/article-manager/resources/wiky.math.css
new file mode 100644 (file)
index 0000000..de2a6f5
--- /dev/null
@@ -0,0 +1,88 @@
+/* math */\r
+dfn, div.eq {\r
+  white-space: nowrap;\r
+  font-family: sans-serif;\r
+  font-style: normal;\r
+  color: navy;\r
+}\r
+div.eq {\r
+   margin-left: 3em;\r
+   margin-right: 1em;\r
+}\r
+div.eq a {float:right}\r
+\r
+span.h {  /* huge */\r
+  font-size:150%; \r
+}\r
+\r
+span.o, span.s, span.f {\r
+  display:-moz-inline-box;\r
+  -moz-box-orient:vertical;\r
+  display:inline-block; \r
+  vertical-align:middle; \r
+  margin:0 0.2em;\r
+}\r
+\r
+span.x, span.i, span.d, span.n, span.o span {\r
+  display: block;\r
+}\r
+\r
+span.x, span.d, span.n, span.s, span.o span {\r
+  text-align:center;\r
+  margin:0 0.2em;\r
+}\r
+\r
+span.n, span.d {\r
+  font-size: 90%;\r
+}\r
+\r
+span.i {\r
+  text-align: left;\r
+  margin:0 0.2em 0 0;\r
+}\r
+span.b {\r
+  font-weight: bold;\r
+}\r
+\r
+span.x, span.i, span.f span.f {\r
+  font-size: 80%;\r
+}\r
+\r
+span.n {\r
+  border-bottom:solid 1px navy;\r
+}\r
+\r
+span.v, span.m {\r
+  display:-moz-inline-box;\r
+  -moz-box-orient:vertical;\r
+  display:inline-block;\r
+  vertical-align:middle; \r
+}\r
+span.v span.e, span.m span.e {\r
+  font-size: 90%;\r
+  white-space:nowrap;\r
+  display: block;\r
+  text-align:center;\r
+  margin:0.2em;\r
+}\r
+/*span.m > span.e { height:2em; }*/ /* hide ie 6 */\r
+\r
+span.lb, span.rb {\r
+  margin:0; \r
+  padding:0; \r
+  vertical-align: middle; \r
+  border-top:1px solid navy; \r
+  border-bottom:1px solid navy;\r
+}\r
+span.lb {\r
+  border-left:1px solid navy; \r
+}\r
+span.rb {\r
+  border-right:1px solid navy; \r
+}\r
+span.lbrk2, span.rbrk2 {\r
+  font-size:200%; \r
+}\r
+span.lbrk3, span.rbrk3 {\r
+  font-size:300%; \r
+}\r
diff --git a/extra/webapps/article-manager/resources/wiky.math.js b/extra/webapps/article-manager/resources/wiky.math.js
new file mode 100644 (file)
index 0000000..26cf41e
--- /dev/null
@@ -0,0 +1,374 @@
+/*     This work is licensed under Creative Commons GNU LGPL License.
+
+       License: http://creativecommons.org/licenses/LGPL/2.1/
+
+       Author:  Stefan Goessner/2005-06
+       Web:     http://goessner.net/ 
+   inspired by: http://xml-maiden.com/
+*/
+Wiky.rules.math = {
+   version: 0.95,
+   preshortcuts: [
+//      { rex:/[ ]/g, tmplt:"`"},   // omit due to charset support ie6
+      { rex:/\+\-/g, tmplt:"&#177;"},
+      { rex:/\/O|\\Oslash/g, tmplt:"&#216;"},
+      { rex:/\/o|\\oslash/g, tmplt:"&#248;"},
+      { rex:/<->|\\harr/g, tmplt:"&#8596;"},
+      { rex:/<-|\\larr/g, tmplt:"&#8592;"},
+      { rex:/->|\\rarr/g, tmplt:"&#8594;"},
+      { rex:/<=>|\\hArr/g, tmplt:"&#8660;"},
+      { rex:/=>|\\rArr/g, tmplt:"&#8658;"},
+      { rex:/-=|\\equiv/g, tmplt:"&#8801;"},
+      { rex:/<=|\\le/g, tmplt:"&#8804;"},
+      { rex:/>=|\\ge/g, tmplt:"&#8805;"},
+      { rex:/</g, tmplt:"&lt;"},
+      { rex:/>/g, tmplt:"&gt;"}
+   ],
+   postshortcuts: [
+      { rex:/\*|\\middot/g, tmplt:"&#183;"},
+      { rex:/\\x|\\times/g, tmplt:"&#215;"},
+      { rex:/~=|\\cong/g, tmplt:"&#8773;"},
+      { rex:/~~|\\asymp/g, tmplt:"&#8776;"},
+      { rex:/~|\\sim/g, tmplt:"&#8764;"},
+      { rex:/!=|\\neq|\\ne/g, tmplt:"&#8800;"},
+      { rex:/\.\.\.|\\ldots/g, tmplt:"&#8230;"},
+      { rex:/\\in|\\isin/g, tmplt:"&#8712;"},
+      { rex:/([0-9])x([0-9])/g, tmplt:"$1&#215;$2"}, 
+      { rex:/([A-Za-z]) x ([A-Za-z])/g, tmplt:"$1&#215;$2"},
+//      { rex:/[`]{4}/g, tmplt:"&#8195;"},  // omit due to charset support ie6
+//      { rex:/[`]{3}/g, tmplt:"&#8194;"},
+//      { rex:/[`]{2}/g, tmplt:"  "},
+//      { rex:/[`]/g, tmplt:"&#8201;"},
+      { rex:/\{/g, tmplt:"&#8206;"},  // unvisible left-to-right mark,
+      { rex:/\}/g, tmplt:"&#8207;"}   // unvisible right-to-left mark,
+   ],
+   expr: [
+      { rex:/\^\^/g, tmplt:"^&#94;"},  // ^ overindex
+      { rex:/(\\sum|\\prod|\\int)_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"o\"><span class=\"x\">$3</span>$1<span class=\"x\">$2</span></span>"}, // over-/underscript (\sum, \prod, \int)
+      { rex:/(\\sum|\\prod|\\int)\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"o\"><span class=\"x\">$2</span>$1<span>&#160;</span></span>"},
+      { rex:/(\\sum|\\prod|\\int)_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"o\"><span>&#160;</span>$1<span class=\"x\">$2</span></span>"},
+      { rex:/_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"s\"><span class=\"i\">$2</span><span class=\"i\">$1</span></span>"}, // over-/underindex
+      { rex:/\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<sup class=\"i\">$1</sup>"}, // overindex
+      { rex:/_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<sub class=\"i\">$1</sub>"}, // underindex
+      { rex:/-/g, tmplt:"&#8722;"},
+      { rex:/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"f\"><span class=\"n\">$1</span><span class=\"d\">$2</span></span>"},  // fraction
+      { rex:/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\/\/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<sup>$1</sup>&#8260;<sub>$2</sub>"}, // fraction 
+      { rex:/\[((\[(([^,\]]+[,]){1,}[^\]]+)\][ \n]*){1,})\]/g, tmplt:function($0,$1){var m=Wiky.math.transpose($1.replace(/(^\[|\]$)/g,"").replace(/(\][ \n]*\[)/g,"|").split("|")),sz=" style=\"font-size:"+(m.len)+"00%;\"";/*alert("{("+m.mat.join(")}\n{(").split(",").join(")(")+")}");*/ return "<span class=\"lb\""+sz+">"+Wiky.math.fence()+"</span><span class=\"m\"><span class=\"e\">"+m.mat.join("</span></span>\n<span class=\"m\"><span class=\"e\">").split(",").join("</span><span class=\"e\">")+"</span></span><span class=\"rb\""+sz+">"+Wiky.math.fence()+"</span>";}}, // matrix
+      { rex:/\[((?:[^,\]]){1,}[^\]]+)\]/g, tmplt:function($0,$1){var v=$1.split(","),sz=" style=\"font-size:"+v.length+"00%;\""; return "<span class=\"lb\""+sz+">"+Wiky.math.fence()+"</span><span class=\"v\"><span class=\"e\">"+v.join("</span><span class=\"e\">")+"</span></span><span class=\"rb\""+sz+">"+Wiky.math.fence()+"</span>";}}, // vector
+      { rex:/!([a-zA-Z0-9\.&;]+)/g, tmplt:"<span class=\"b\">$1</span>" }, // bold vector symbol ..
+      { rex:/\\prod/g, tmplt:"<span class=\"h\">&#8719;</span>"},
+      { rex:/\\sum/g, tmplt:"<span class=\"h\">&#8721;</span>"},
+      { rex:/\\int/g, tmplt:"<span class=\"h\">&#8747;</span>"},
+      "Wiky.rules.math.postshortcuts"
+   ],
+   symbols: [
+      { rex:/\\Alpha/g, tmplt:"&#913;"},
+      { rex:/\\Beta/g, tmplt:"&#914;"},
+      { rex:/\\Gamma/g, tmplt:"&#915;"},
+      { rex:/\\Delta/g, tmplt:"&#916;"},
+      { rex:/\\Epsilon/g, tmplt:"&#917;"},
+      { rex:/\\Zeta/g, tmplt:"&#918;"},
+      { rex:/\\Eta/g, tmplt:"&#919;"},
+      { rex:/\\Theta/g, tmplt:"&#920;"},
+      { rex:/\\Iota/g, tmplt:"&#921;"},
+      { rex:/\\Kappa/g, tmplt:"&#922;"},
+      { rex:/\\Lambda/g, tmplt:"&#923;"},
+      { rex:/\\Mu/g, tmplt:"&#924;"},
+      { rex:/\\Nu/g, tmplt:"&#925;"},
+      { rex:/\\Xi/g, tmplt:"&#926;"},
+      { rex:/\\Omicron/g, tmplt:"&#927;"},
+      { rex:/\\Pi/g, tmplt:"&#928;"},
+      { rex:/\\Rho/g, tmplt:"&#929;"},
+      { rex:/\\Sigma/g, tmplt:"&#931;"},
+      { rex:/\\Tau/g, tmplt:"&#932;"},
+      { rex:/\\Upsilon/g, tmplt:"&#933;"},
+      { rex:/\\Phi/g, tmplt:"&#934;"},
+      { rex:/\\Chi/g, tmplt:"&#935;"},
+      { rex:/\\Psi/g, tmplt:"&#936;"},
+      { rex:/\\Omega/g, tmplt:"&#937;"},
+      { rex:/\\alpha/g, tmplt:"&#945;"},
+      { rex:/\\beta/g, tmplt:"&#946;"},
+      { rex:/\\gamma/g, tmplt:"&#947;"},
+      { rex:/\\delta/g, tmplt:"&#948;"},
+      { rex:/\\epsilon/g, tmplt:"&#949;"},
+      { rex:/\\zeta/g, tmplt:"&#950;"},
+      { rex:/\\eta/g, tmplt:"&#951;"},
+      { rex:/\\thetasym/g, tmplt:"&#977;"},
+      { rex:/\\theta/g, tmplt:"&#952;"},
+      { rex:/\\iota/g, tmplt:"&#953;"},
+      { rex:/\\kappa/g, tmplt:"&#954;"},
+      { rex:/\\lambda/g, tmplt:"&#955;"},
+      { rex:/\\mu/g, tmplt:"&#956;"},
+      { rex:/\\nu/g, tmplt:"&#957;"},
+      { rex:/\\xi/g, tmplt:"&#958;"},
+      { rex:/\\omicron/g, tmplt:"&#959;"},
+      { rex:/\\piv/g, tmplt:"&#982;"},
+      { rex:/\\pi/g, tmplt:"&#960;"},
+      { rex:/\\rho/g, tmplt:"&#961;"},
+      { rex:/\\sigmaf/g, tmplt:"&#962;"},
+      { rex:/\\sigma/g, tmplt:"&#963;"},
+      { rex:/\\tau/g, tmplt:"&#964;"},
+      { rex:/\\upsilon/g, tmplt:"&#965;"},
+      { rex:/\\phi/g, tmplt:"&#966;"},
+      { rex:/\\chi/g, tmplt:"&#967;"},
+      { rex:/\\psi/g, tmplt:"&#968;"},
+      { rex:/\\omega/g, tmplt:"&#969;"},
+      { rex:/\\upsih/g, tmplt:"&#978;"},
+      // miscellaneous symbols
+      { rex:/\\bull/g, tmplt:"&#8226;"},
+      { rex:/\\uarr/g, tmplt:"&#8593;"},
+      { rex:/\\darr/g, tmplt:"&#8595;"},
+      { rex:/\\crarr/g, tmplt:"&#8629;"},
+      { rex:/\\lArr/g, tmplt:"&#8656;"},
+      { rex:/\\uArr/g, tmplt:"&#8657;"},
+      { rex:/\\dArr/g, tmplt:"&#8659;"},
+      { rex:/\\forall/g, tmplt:"&#8704;"},
+      { rex:/\\part/g, tmplt:"&#8706;"},
+      { rex:/\\exist/g, tmplt:"&#8707;"},
+      { rex:/\\empty/g, tmplt:"&#8709;"},
+      { rex:/\\nabla/g, tmplt:"&#8711;"},
+      { rex:/\\notin/g, tmplt:"&#8713;"},
+      { rex:/\\ni/g, tmplt:"&#8715;"},
+      { rex:/\\minus/g, tmplt:"&#8722;"},
+      { rex:/\\lowast/g, tmplt:"&#8727;"},
+      { rex:/\\sqrt|\\radic/g, tmplt:"&#8730;"},
+      { rex:/\\prop/g, tmplt:"&#8733;"},
+      { rex:/\\infin/g, tmplt:"&#8734;"},
+      { rex:/\\ang/g, tmplt:"&#8736;"},
+      { rex:/\\and/g, tmplt:"&#8743;"},
+      { rex:/\\or/g, tmplt:"&#8744;"},
+      { rex:/\\cap/g, tmplt:"&#8745;"},
+      { rex:/\\cup/g, tmplt:"&#8746;"},
+      { rex:/\\there4/g, tmplt:"&#8756;"},
+      { rex:/\\sub/g, tmplt:"&#8834;"},
+      { rex:/\\sup/g, tmplt:"&#8835;"},
+      { rex:/\\nsub/g, tmplt:"&#8836;"},
+      { rex:/\\sube/g, tmplt:"&#8838;"},
+      { rex:/\\supe/g, tmplt:"&#8839;"},
+      { rex:/\\oplus/g, tmplt:"&#8853;"},
+      { rex:/\\otimes/g, tmplt:"&#8855;"},
+      { rex:/\\perp/g, tmplt:"&#8869;"},
+      { rex:/\\sdot/g, tmplt:"&#8901;"}
+   ]
+};
+
+Wiky.inverse.math = {
+   pre: [
+      { rex:/&#8722;|\u2212/g, tmplt:"-"},
+      { rex:/&#8201;|\u2009/g, tmplt:"&#8201;"},
+      { rex:/&#8206;|\u200E/g, tmplt:"{"},
+      { rex:/&#8207;|\u200F/g, tmplt:"}"}
+   ],
+   post: [
+//      { rex:/([$])/g, tmplt:"\\$1" },
+      { rex:/&#94;|\x5E/g, tmplt:"^"},
+      { rex:/&lt;/g, tmplt:"<"},
+      { rex:/&gt;/g, tmplt:">"}
+   ],
+   shortcuts: [
+//      { rex:/&#8195;|\u2003/g, tmplt:"    "}, // omit due to charset support ie6
+//      { rex:/&#8194;|\u2002/g, tmplt:"   "},
+//      { rex:/&#8201;|\u2009/g, tmplt:" "},
+      { rex:/&#177;|\xB1/g, tmplt:"+-"},
+      { rex:/&#183;|\xB7/g, tmplt:"*"},
+      { rex:/&#215;|\xD7/g, tmplt:"\\x"},
+      { rex:/&#216;|\xD8/g, tmplt:"/O"},
+      { rex:/&#248;|\xF8/g, tmplt:"/o"},
+      { rex:/&#8592;|\u2190/g, tmplt:"&lt;-"},
+      { rex:/&#8594;|\u2192/g, tmplt:"-&gt;"},
+      { rex:/&#8596;|\u2194/g, tmplt:"&lt;-&gt;"},
+      { rex:/&#8658;|\u21D2/g, tmplt:"=&gt;"},
+      { rex:/&#8660;|\u21D4/g, tmplt:"&lt;=&gt;"},
+      { rex:/&#8764;|\u223C/g, tmplt:"~"},
+      { rex:/&#8773;|\u2245/g, tmplt:"~="},
+      { rex:/&#8776;|\u2248/g, tmplt:"~~"},
+      { rex:/&#8800;|\u2260/g, tmplt:"!="},
+      { rex:/&#8230;/g, tmplt:"..."},
+      { rex:/&#8801;|\u2261/g, tmplt:"-="},
+      { rex:/&#8804;|\u2264/g, tmplt:"&lt;="},
+      { rex:/&#8805;|\u2265/g, tmplt:"&gt;="}
+   ],
+   expr: [
+      { rex:/<span class=\"s\"><span class=\"i\">(\{?@[0-9]+@\}?)<\/span><span class="i">(\{?@[0-9]+@\}?)<\/span><\/span>/g, tmplt:"_$2^$1"}, // superscript + subscript
+      { rex:/<span class=\"o\"><span class=\"x\">(\{?@[0-9]+@\}?)<\/span>(\\prod|\\sum|\\int)<span class=\"x\">(\{?@[0-9]+@\}?)<\/span><\/span>/g, tmplt:"$2_$3^$1"},  // overscript + underscript
+      { rex:/<span class=\"o\"><span>@[0-9]+@<\/span>(\\prod|\\sum|\\int)<span class=\"x\">(\{?@[0-9]+@\}?)<\/span><\/span>/mgi, tmplt:"$1_$2", dbg:true},  // underscript
+      { rex:/<span class=\"o\"><span class=\"x\">(\{?@[0-9]+@\}?)<\/span>(\\prod|\\sum|\\int)<span>@[0-9]+@<\/span><\/span>/mgi, tmplt:"$2^$1"},  // overscript
+      { rex:/<span class=\"f\"><span class=\"n\">(\{?@[0-9]+@\}?)<\/span><span class="d">(\{?@[0-9]+@\}?)<\/span><\/span>/mgi, tmplt:"$1/$2"},  // fraction
+      { rex:/<span class=\"lb\"[^>]*>&[^;]+;<\/span><span class=\"v\">((?:<span class=\"e\">[^>]*<\/span>){2,})<\/span><span class=\"rb\"[^>]*>&[^;]+;<\/span>/mgi, tmplt:function($0,$1){return "["+$1.replace(/(?:^<span class=\"e\">|<\/span>$)/g,"").replace(/<\/span><span class=\"e\">/g,",")+"]";}}, // vector ..
+      { rex:/<span class=\"lb\"[^>]*>&[^;]+;<\/span>((?:<span class=\"m\">(?:(?:<span class=\"e\">[^>]*<\/span>){2,})<\/span>[^>]*){2,})<span class=\"rb\"[^>]*>&[^;]+;<\/span>/mgi, tmplt:function($0,$1){return "[["+Wiky.math.transpose($1.replace(/(?:^<span class=\"m\"><span class=\"e\">|<\/span><\/span>$)/g,"").replace(/<\/span><span class=\"e\">/g,",").replace(/<\/span><\/span>[^>]*<span class=\"m\"><span class=\"e\">/g,"|").split("|")).mat.join("][")+"]]";}}, // matrix ..
+      { rex:/<span class=\"b\">(@[0-9]+@)<\/span>/mgi, tmplt:"!$1"}, // bold vector ..
+      { rex:/<sup>(\{?@[0-9]+@\}?)<\/sup>&#8260;<sub>(\{?@[0-9]+@\}?)<\/sub>/mgi, tmplt:"$1//$2"},
+      { rex:/<sup class=\"i\">(\{?@[0-9]+@\}?)<\/sup>/mgi, tmplt:"^$1" }, 
+      { rex:/<sub class=\"i\">(\{?@[0-9]+@\}?)<\/sub>/mgi, tmplt:"_$1" }
+   ],
+   symbols: [
+      // greek symbols
+      { rex:/&#913;|\u391/g, tmplt:"\\Alpha"},
+      { rex:/&#914;|\u392/g, tmplt:"\\Beta"},
+      { rex:/&#915;|\u393/g, tmplt:"\\Gamma"},
+      { rex:/&#916;|\u394/g, tmplt:"\\Delta"},
+      { rex:/&#917;|\u395/g, tmplt:"\\Epsilon"},
+      { rex:/&#918;|\u396/g, tmplt:"\\Zeta"},
+      { rex:/&#919;|\u397/g, tmplt:"\\Eta"},
+      { rex:/&#920;|\u398/g, tmplt:"\\Theta"},
+      { rex:/&#921;|\u399/g, tmplt:"\\Iota"},
+      { rex:/&#922;|\u39A/g, tmplt:"\\Kappa"},
+      { rex:/&#923;|\u39B/g, tmplt:"\\Lambda"},
+      { rex:/&#924;|\u39C/g, tmplt:"\\Mu"},
+      { rex:/&#925;|\u39D/g, tmplt:"\\Nu"},
+      { rex:/&#926;|\u39E/g, tmplt:"\\Xi"},
+      { rex:/&#927;|\u39F/g, tmplt:"\\Omicron"},
+      { rex:/&#928;|\u3A0/g, tmplt:"\\Pi"},
+      { rex:/&#929;|\u3A1/g, tmplt:"\\Rho"},
+      { rex:/&#931;|\u3A3/g, tmplt:"\\Sigma"},
+      { rex:/&#932;|\u3A4/g, tmplt:"\\Tau"},
+      { rex:/&#933;|\u3A5/g, tmplt:"\\Upsilon"},
+      { rex:/&#934;|\u3A6/g, tmplt:"\\Phi"},
+      { rex:/&#935;|\u3A7/g, tmplt:"\\Chi"},
+      { rex:/&#936;|\u3A8/g, tmplt:"\\Psi"},
+      { rex:/&#937;|\u3A9/g, tmplt:"\\Omega"},
+      { rex:/&#945;|\u3B1/g, tmplt:"\\alpha"},
+      { rex:/&#946;|\u3B2/g, tmplt:"\\beta"},
+      { rex:/&#947;|\u3B3/g, tmplt:"\\gamma"},
+      { rex:/&#948;|\u3B4/g, tmplt:"\\delta"},
+      { rex:/&#949;|\u3B5/g, tmplt:"\\epsilon"},
+      { rex:/&#950;|\u3B6/g, tmplt:"\\zeta"},
+      { rex:/&#951;|\u3B7/g, tmplt:"\\eta"},
+      { rex:/&#977;|\u3D1/g, tmplt:"\\thetasym"},
+      { rex:/&#952;|\u3B8/g, tmplt:"\\theta"},
+      { rex:/&#953;|\u3B9/g, tmplt:"\\iota"},
+      { rex:/&#954;|\u3BA/g, tmplt:"\\kappa"},
+      { rex:/&#955;|\u3BB/g, tmplt:"\\lambda"},
+      { rex:/&#956;|\u3BC/g, tmplt:"\\mu"},
+      { rex:/&#957;|\u3BD/g, tmplt:"\\nu"},
+      { rex:/&#958;|\u3BE/g, tmplt:"\\xi"},
+      { rex:/&#959;|\u3BF/g, tmplt:"\\omicron"},
+      { rex:/&#960;|\u3C0/g, tmplt:"\\pi"},
+      { rex:/&#961;|\u3C1/g, tmplt:"\\rho"},
+      { rex:/&#962;|\u3C2/g, tmplt:"\\sigmaf"},
+      { rex:/&#963;|\u3C3/g, tmplt:"\\sigma"},
+      { rex:/&#964;|\u3C4/g, tmplt:"\\tau"},
+      { rex:/&#965;|\u3C5/g, tmplt:"\\upsilon"},
+      { rex:/&#966;|\u3C6/g, tmplt:"\\phi"},
+      { rex:/&#967;|\u3C7/g, tmplt:"\\chi"},
+      { rex:/&#968;|\u3C8/g, tmplt:"\\psi"},
+      { rex:/&#969;|\u3C9/g, tmplt:"\\omega"},
+      // miscellaneous symbols
+      { rex:/&#978;|\u3D2/g, tmplt:"\\upsih"},
+      { rex:/&#982;|\u3D6/g, tmplt:"\\piv"},
+      { rex:/&#8226;|\u2022/g, tmplt:"\\bull"},
+      { rex:/&#8593;|\u2191/g, tmplt:"\\uarr"},
+      { rex:/&#8595;|\u2193/g, tmplt:"\\darr"},
+      { rex:/&#8629;|\u21B5/g, tmplt:"\\crarr"},
+      { rex:/&#8656;|\u21D0/g, tmplt:"\\lArr"},
+      { rex:/&#8657;|\u21D1/g, tmplt:"\\uArr"},
+      { rex:/&#8659;|\u21D3/g, tmplt:"\\dArr"},
+      { rex:/&#8704;|\u2200/g, tmplt:"\\forall"},
+      { rex:/&#8706;|\u2202/g, tmplt:"\\part"},
+      { rex:/&#8707;|\u2203/g, tmplt:"\\exist"},
+      { rex:/&#8709;|\u2205/g, tmplt:"\\empty"},
+      { rex:/&#8711;|\u2207/g, tmplt:"\\nabla"},
+      { rex:/&#8712;|\u2208/g, tmplt:"\\isin"},
+      { rex:/&#8713;|\u2209/g, tmplt:"\\notin"},
+      { rex:/&#8715;|\u220B/g, tmplt:"\\ni"},
+      { rex:/<span class=\"h\">(&#8719;|\u220F)<\/span>/g, tmplt:"\\prod"},
+      { rex:/<span class=\"h\">(&#8721;|\u2211)<\/span>/g, tmplt:"\\sum"},
+      { rex:/&#8727;|\u2217/g, tmplt:"\\lowast"},
+      { rex:/&#8730;|\u221A/g, tmplt:"\\sqrt"},
+      { rex:/&#8733;|\u221D/g, tmplt:"\\prop"},
+      { rex:/&#8734;|\u221E/g, tmplt:"\\infin"},
+      { rex:/&#8736;|\u2220/g, tmplt:"\\ang"},
+      { rex:/&#8743;|\u2227/g, tmplt:"\\and"},
+      { rex:/&#8744;|\u2228/g, tmplt:"\\or"},
+      { rex:/&#8745;|\u2229/g, tmplt:"\\cap"},
+      { rex:/&#8746;|\u222A/g, tmplt:"\\cup"},
+      { rex:/<span class=\"h\">(?:&#8747;|\u222B)<\/span>/g, tmplt:"\\int"},
+      { rex:/&#8756;|\u2234/g, tmplt:"\\there4"},
+      { rex:/&#8834;|\u2282/g, tmplt:"\\sub"},
+      { rex:/&#8835;|\u2283/g, tmplt:"\\sup"},
+      { rex:/&#8836;|\u2284/g, tmplt:"\\nsub"},
+      { rex:/&#8838;|\u2286/g, tmplt:"\\sube"},
+      { rex:/&#8839;|\u2287/g, tmplt:"\\supe"},
+      { rex:/&#8853;|\u2295/g, tmplt:"\\oplus"},
+      { rex:/&#8855;|\u2297/g, tmplt:"\\otimes"},
+      { rex:/&#8869;|\u22A5/g, tmplt:"\\perp"},
+      { rex:/&#8901;|\u22C5/g, tmplt:"\\sdot"}
+   ]
+};
+
+Wiky.math = {
+   toHtml: function(str) {
+      var expr = function(itr) {  // region from "{" to "}", nesting allowed ..
+         var s = "";
+         for (var c = itr.str.charAt(itr.pos++); itr.pos <= itr.str.length && c != "}"; c = itr.str.charAt(itr.pos++))
+            s += (c == "{") ? ("{"+expr(itr)+"}") : c;
+         return Wiky.store(Wiky.apply(s, Wiky.rules.math.expr));
+      };
+      str = Wiky.apply(str, Wiky.rules.math.preshortcuts);
+      str = Wiky.apply(str, Wiky.rules.math.symbols);
+      str = expr({str:str,pos:0});
+      return str;
+   },
+   toWiki: function(str) {
+      var parseTree = function(itr, endtag) {
+         var c, s="",gt,nam,idxof=function(s,c,p){var i=s.indexOf(c,p);return i>=0?i:s.length;}
+         for (itr.buf=itr.str.substr(itr.pos,endtag.length); 
+              itr.pos<itr.str.length && (!endtag || itr.buf!=endtag); 
+              itr.buf=itr.str.substr(++itr.pos,endtag.length)) {
+            if ((c=itr.str.charAt(itr.pos))=="<" && (gt=idxof(itr.str,">",itr.pos)) < idxof(itr.str,"/",itr.pos)) { // start tags .. no empty elements or endtags ..
+               nam = itr.str.substring(itr.pos+1,Math.min(idxof(itr.str," ",itr.pos),gt));
+               s += itr.str.substring(itr.pos,itr.pos=gt+1) + parseTree(itr, "</" + nam + ">") + "</" + nam + ">";
+               itr.pos += nam.length+3;
+            }
+            else
+               s += c;
+         }
+         itr.pos--;
+         return Wiky.store(s, true);
+      };
+      str = Wiky.apply(str, Wiky.inverse.math.pre);
+      str = Wiky.apply(str, Wiky.inverse.math.symbols);
+      str = parseTree({str:str,pos:0,buf:null}, "");
+      while (str.match(/@[0-9]+@/g) != null)
+         str = Wiky.apply(str.replace(/@([0-9]+)@/g, function($0,$1){return Wiky.restore($1);}), Wiky.inverse.math.expr);
+      str = Wiky.apply(str, Wiky.inverse.math.shortcuts);
+      str = Wiky.apply(str, Wiky.inverse.math.post);
+      return str;
+   },
+   fence: function(str) {
+      return window && window.ActiveXObject ? "&#160;" : "&#8201;";
+   },
+   transpose: function (m) {
+      var t=[];
+      for (var i in m) {
+         m[i] = m[i].split(",");
+         for (var j in m[i]) {
+            if (!t[j]) t[j]=[];
+            t[j][i] = m[i][j];
+         }
+      }
+      for (var i in t)
+         t[i] = t[i].join(",");
+     return {mat:t, len:m.length};
+  }
+};
+
+Wiky.rules.pre = Wiky.rules.pre.concat({ rex:/\\([$])/g, tmplt:function($0,$1){return Wiky.store($1);} });
+Wiky.rules.nonwikiblocks = Wiky.rules.nonwikiblocks.concat(
+[
+    { rex:/\[\(([a-zA-Z0-9\.-]+)\)\$([^$]*)\$\]/g, tmplt:function($0,$1,$2){return ":p]<div class=\"eq\"><a name=\"eq"+$1+"\">("+$1+")</a>" + Wiky.math.toHtml($2) + "</div>[p:";} }, // numbered equation
+    { rex:/\[\$([^$]*)\$\]/g, tmplt:function($0,$1){return ":p]<div class=\"eq\">" + Wiky.math.toHtml($1) + "</div>[p:";} }, // equation
+]);
+Wiky.rules.nonwikiinlines = Wiky.rules.nonwikiinlines.concat(
+    { rex:/\$([^$]*)\$/g, tmplt:function($0,$1){return "<dfn>" + Wiky.math.toHtml($1) + "</dfn>";} } // inline equation
+);
+
+Wiky.inverse.pre = Wiky.inverse.pre.concat({ rex:/([\$])/g, tmplt:"\\$1" });
+Wiky.inverse.nonwikiblocks = Wiky.inverse.nonwikiblocks.concat(
+[
+    { rex:/<div class=\"eq\"><a name=\"eq([0-9]+)\">(?:.*?)<\/a>(.*?)<\/div>/g, tmplt:function($0,$1,$2){return Wiky.store("[("+$1+")$"+Wiky.math.toWiki($2)+"$]");} }, // numbered equation
+    { rex:/<div class=\"eq\">(.*?)<\/div>/g, tmplt:function($0,$1){return Wiky.store("[$"+Wiky.math.toWiki($1)+"$]");} }, // equation
+]);
+Wiky.inverse.nonwikiinlines = Wiky.inverse.nonwikiinlines.concat(
+    { rex:/<dfn>(.*?)<\/dfn>/g, tmplt:function($0,$1){return Wiky.store("$"+Wiky.math.toWiki($1)+"$");} } // inline equation
+);
diff --git a/extra/webapps/article-manager/summary.txt b/extra/webapps/article-manager/summary.txt
new file mode 100644 (file)
index 0000000..cc43bdd
--- /dev/null
@@ -0,0 +1 @@
+Article Manager web application
diff --git a/extra/webapps/article-manager/tags.txt b/extra/webapps/article-manager/tags.txt
new file mode 100644 (file)
index 0000000..1b93c9e
--- /dev/null
@@ -0,0 +1 @@
+webapp
diff --git a/extra/webapps/fjsc/authors.txt b/extra/webapps/fjsc/authors.txt
new file mode 100644 (file)
index 0000000..44b06f9
--- /dev/null
@@ -0,0 +1 @@
+Chris Double
diff --git a/extra/webapps/fjsc/fjsc.factor b/extra/webapps/fjsc/fjsc.factor
new file mode 100644 (file)
index 0000000..83f6e62
--- /dev/null
@@ -0,0 +1,65 @@
+! Copyright (C) 2006 Chris Double. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: kernel furnace fjsc  parser-combinators namespaces
+       lazy-lists io io.files furnace.validator sequences 
+       http.client http.server http.server.responders 
+       http.server.responders.file ;
+IN: webapps.fjsc
+
+: compile ( code -- )
+  #! Compile the factor code as a string, outputting the http
+  #! response containing the javascript.
+  serving-text
+  'expression' parse car parse-result-parsed fjsc-compile 
+  write flush ;
+
+! The 'compile' action results in an URL that looks like
+! 'responder/fjsc/compile'. It takes one query or post 
+! parameter called 'code'. It calls the 'compile' word
+! passing the parameter to it on the stack.
+\ compile { 
+  { "code" v-required } 
+} define-action
+
+: compile-url ( url -- )
+  #! Compile the factor code at the given url, return the javascript.
+  dup "http:" head? [ "Unable to access remote sites." throw ] when
+  "http://" host rot 3append http-get 2nip compile "();" write flush ;
+
+\ compile-url {
+  { "url" v-required } 
+} define-action
+
+: repl ( -- )
+  #! The main 'repl' page.
+  f "repl" "head" render-page* ;
+
+! An action called 'repl' 
+\ repl { } define-action
+
+: fjsc-web-app ( -- )
+  ! Create the web app, providing access 
+  ! under '/responder/fjsc' which calls the
+  ! 'repl' action.
+  "fjsc" "repl" "extra/webapps/fjsc" web-app
+
+  ! An URL to the javascript resource files used by
+  ! the 'fjsc' responder.
+  "fjsc-resources" [
+   [
+     "extra/fjsc/resources/" resource-path "doc-root" set
+     file-responder
+   ] with-scope
+  ] add-simple-responder
+
+  ! An URL to the resource files used by
+  ! 'termlib'.
+  "fjsc-repl-resources" [
+   [
+     "extra/webapps/fjsc/resources/" resource-path "doc-root" set
+     file-responder
+   ] with-scope
+  ] add-simple-responder ;
+
+MAIN: fjsc-web-app
diff --git a/extra/webapps/fjsc/head.furnace b/extra/webapps/fjsc/head.furnace
new file mode 100644 (file)
index 0000000..97a3645
--- /dev/null
@@ -0,0 +1,7 @@
+<title>Factor to Javascript REPL</title>\r
+<link rel="stylesheet" type="text/css" href="/responder/fjsc-repl-resources/termlib/term_styles.css"/>\r
+<script type="text/javascript" src="/responder/fjsc-repl-resources/termlib/termlib.js"></script>\r
+<script type="text/javascript" src="/responder/fjsc-resources/jquery.js"></script>\r
+<script type="text/javascript" src="/responder/fjsc-resources/bootstrap.js"></script>\r
+<script type="text/javascript" src="/responder/fjsc-repl-resources/repl.js"></script>\r
+<script type="text/javascript" src="/responder/fjsc/compile-url?url=/responder/fjsc-resources/bootstrap.factor"></script>\r
diff --git a/extra/webapps/fjsc/repl.furnace b/extra/webapps/fjsc/repl.furnace
new file mode 100644 (file)
index 0000000..c67e9d4
--- /dev/null
@@ -0,0 +1,43 @@
+<table border="0">
+<tr><td valign="top">
+<div id="repl" style="position:relative;"></div>
+<p>More information on the Factor to Javascript compiler can be found at these blog posts:
+<ul>
+<li><a href="http://www.bluishcoder.co.nz/2006/12/compiling-factor-to-javascript.html">Factor to Javascript Compiler</a></li>
+<li><a href="http://www.bluishcoder.co.nz/2006/12/factor-to-javascript-compiler-updates.html">Factor to Javascript Compiler Updates</a></li>
+<li><a href="http://www.bluishcoder.co.nz/2006/12/continuations-added-to-fjsc.html">Continuations added to fjsc</a></li>
+<li><a href="http://www.bluishcoder.co.nz/2006/12/cross-domain-json-with-fjsc.html">Cross Domain JSON with fjsc</a></li>
+<li><a href="http://www.bluishcoder.co.nz/2007/02/factor-to-javascript-compiler-makeover.html">Factor to Javascript Compiler Makeover</a></li>
+</ul>
+</p>
+<p>The terminal emulation code for the Factor REPL is provided by the awesome <a href="http://www.masswerk.at/termlib/index.html">termlib</a> library by Norbert Landsteiner. Documentation for termlib is <a href="/responder/fjsc-repl-resources/termlib/">available here</a>. Please note the license of 'termlib':</p>
+<blockquote>This JavaScript-library is free for private and academic use. Please include a readable copyright statement and a backlink to <http://www.masswerk.at> in the web page. The library should always be accompanied by the "readme.txt" and the sample HTML-documents.
+
+The term "private use" includes any personal or non-commercial use, which is not related to commercial activites, but excludes intranet, extranet and/or public net applications that are related to any kind of commercial or profit oriented activity.
+
+For commercial use see <a href="http://www.masswerk.at">http://www.masswerk.at</a> for contact information.</blockquote>
+</td>
+<td valign="top">
+<p><b>Stack</b></p>
+<div id="stack">
+</div>
+<p><b>Playground</b></p>
+<div id="playground">
+</div>
+<h3>Compiled Code</h3>
+<textarea id="compiled" cols="40" rows="10">
+</textarea>
+<p>Some useful words:
+<dl>
+<dt>vocabs ( -- seq )</dt>
+<dd>Return a sequence of available vocabularies</dd>
+<dt>words ( string -- seq )</dt>
+<dd>Return a sequence of words in the given vocabulary</dd>
+<dt>all-words ( -- seq )</dt>
+<dd>Return a sequence of all words</dd>
+</dl>
+</p>
+<p>The contents of <a href="/responder/fjsc-resources/bootstrap.factor">bootstrap.factor</a> have been loaded on startup.</p>
+</td>
+</tr>
+</table>
diff --git a/extra/webapps/fjsc/resources/repl.js b/extra/webapps/fjsc/resources/repl.js
new file mode 100644 (file)
index 0000000..3bc8bdc
--- /dev/null
@@ -0,0 +1,99 @@
+/* Copyright (C) 2007 Chris Double. All Rights Reserved.\r
+   See http://factorcode.org/license.txt for BSD license. */\r
+\r
+var fjsc_repl = false;\r
+\r
+function fjsc_repl_handler() {\r
+  var my_term = this;\r
+  this.newLine();\r
+  if(this.lineBuffer != '') {\r
+    factor.server_eval(\r
+      this.lineBuffer, \r
+      function(text, result) { \r
+        document.getElementById("compiled").value = result;\r
+        display_datastack();        \r
+      }, \r
+      function() { my_term.prompt(); });\r
+  }\r
+  else\r
+    my_term.prompt();\r
+}\r
+\r
+function fjsc_init_handler() {\r
+  this.write(\r
+    [\r
+      TermGlobals.center('********************************************************'),\r
+      TermGlobals.center('*                                                      *'),\r
+      TermGlobals.center('*       Factor to Javascript Compiler Example          *'),\r
+      TermGlobals.center('*                                                      *'),\r
+      TermGlobals.center('********************************************************')\r
+    ]);\r
+  \r
+  this.prompt();\r
+}\r
+\r
+function startup() {\r
+  var conf = {\r
+    x: 0,\r
+    y: 0,\r
+    cols: 64,\r
+    rows: 18,\r
+    termDiv: "repl",\r
+    crsrBlinkMode: true,\r
+    ps: "scratchpad ",\r
+    initHandler: fjsc_init_handler,\r
+    handler: fjsc_repl_handler\r
+  };\r
+  fjsc_repl = new Terminal(conf);\r
+  fjsc_repl.open();\r
+}\r
+\r
+function display_datastack() {\r
+   var html=[];\r
+   html.push("<table border='1'>")\r
+   for(var i = 0; i < factor.cont.data_stack.length; ++i) {\r
+      html.push("<tr><td>")\r
+      html.push(factor.cont.data_stack[i])\r
+      html.push("</td></tr>")\r
+   }\r
+   html.push("</table>")\r
+   document.getElementById('stack').innerHTML=html.join("");\r
+}\r
+\r
+jQuery(function() {\r
+  startup();\r
+  display_datastack();\r
+});\r
+\r
+factor.add_word("kernel", ".s", "primitive", function(next) {   \r
+  var stack = factor.cont.data_stack;\r
+  var term = fjsc_repl;\r
+  for(var i=0; i<stack.length; ++i) {\r
+    term.type(""+stack[i]);\r
+    term.newLine();\r
+  }\r
+  factor.call_next(next);\r
+});\r
+\r
+factor.add_word("io", "print", "primitive", function(next) {   \r
+  var stack = factor.cont.data_stack;\r
+  var term = fjsc_repl;\r
+  term.type(""+stack.pop());\r
+  term.newLine();\r
+  factor.call_next(next);\r
+});\r
+\r
+factor.add_word("io", "write", "primitive", function(next) {   \r
+  var stack = factor.cont.data_stack;\r
+  var term = fjsc_repl;\r
+  term.type(""+stack.pop());\r
+  factor.call_next(next);\r
+});\r
+\r
+factor.add_word("io", ".", "primitive", function(next) {   \r
+  var stack = factor.cont.data_stack;\r
+  var term = fjsc_repl;\r
+  term.type(""+stack.pop());\r
+  term.newLine();\r
+  factor.call_next(next);\r
+});\r
diff --git a/extra/webapps/fjsc/resources/termlib/faq.html b/extra/webapps/fjsc/resources/termlib/faq.html
new file mode 100644 (file)
index 0000000..5adb516
--- /dev/null
@@ -0,0 +1,356 @@
+<HTML>\r
+<HEAD>\r
+       <TITLE>mass:werk termlib faq</TITLE>\r
+\r
+<STYLE TYPE="text/css">\r
+body,p,a,td {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #cccccc;\r
+}\r
+.lh13 {\r
+       line-height: 13px;\r
+}\r
+.lh15 {\r
+       line-height: 15px;\r
+}\r
+pre {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       color: #ccffaa;\r
+       font-size: 12px;\r
+       line-height: 15px;\r
+}\r
+.prop {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       color: #bbee99;\r
+       font-size: 12px;\r
+       line-height: 15px;\r
+}\r
+h1 {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 16px;\r
+       color: #cccccc;\r
+}\r
+b.quest {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 14px;\r
+       font-weight: bold;\r
+       color: #bbee99;\r
+}\r
+a,a:link,a:visited {\r
+       text-decoration: none;\r
+       color: #77dd11;\r
+}\r
+a:hover {\r
+       text-decoration: underline;\r
+       color: #77dd11;\r
+}\r
+a:active {\r
+       text-decoration: underline;\r
+       color: #dddddd;\r
+}\r
+\r
+@media print {\r
+       body { background-color: #ffffff; }\r
+       body,p,a,td {\r
+               font-family: courier,fixed,swiss,sans-serif;\r
+               font-size: 12px;\r
+               color: #000000;\r
+       }\r
+       .lh13 {\r
+               line-height: 13px;\r
+       }\r
+       .lh15 {\r
+               line-height: 15px;\r
+       }\r
+       pre,.prop {\r
+               font-family: courier,fixed,swiss,sans-serif;\r
+               font-size: 12px;\r
+               color: #000000;\r
+               line-height: 15px;\r
+       }\r
+       h1 {\r
+               font-family: courier,fixed,swiss,sans-serif;\r
+               font-size: 16px;\r
+               color: #000000;\r
+       }\r
+       b.quest {\r
+               font-family: courier,fixed,swiss,sans-serif;\r
+               font-size: 14px;\r
+               font-weight: bold;\r
+               color: #000000;\r
+       }\r
+       a,a:link,a:visited {\r
+               text-decoration: none;\r
+               color: #000000;\r
+       }\r
+       a:hover {\r
+               text-decoration: underline;\r
+               color: #000000;\r
+       }\r
+       a:active {\r
+               text-decoration: underline;\r
+               color: #000000;\r
+       }\r
+}\r
+</STYLE>\r
+</HEAD>\r
+\r
+\r
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"><A NAME="top"></A>\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
+<TR>\r
+       <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP>faq</TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
+</TR>\r
+</TABLE>\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" WIDTH="700" ALIGN="center">\r
+       <TR><TD>\r
+               <H1>frequently asked questions</H1>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+&nbsp;<BR>\r
+       <UL>\r
+       <LI CLASS="lh15"><A HREF="#chrome">Can I add chrome to the terminal? (e.g. a window header, a close box)</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#embed">How can I embed a terminal relative to my HTML layout?</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#syntax">I pasted your sample code and just got an error. - ???</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#keyboard">I can't get any input, but I don't get any erros too.</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#keylock">How can I temporary disable the keyboard handlers?</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#linesranges">How can I set the cusor to the start / the end of the command line?</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#historyunique">How can I limit the command history to unique entries only?</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#rebuild">How can I change my color theme on the fly?</A></LI>\r
+       <LI CLASS="lh15"><A HREF="#connect">How can I connect to a server?</A></LI>\r
+       </UL>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="chrome"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">Can I add chrome to the terminal? (e.g. a window header, a close box)</B><BR><BR>\r
+\r
+Not by the means of the Terminal object's interface (since there are way too many things that you may possibly want to add).<BR>\r
+The Terminal object allows you to specify the background color, the frame color, the frame's width and the font class used. If you want to add more chrome, you must align this in a separate division element.<BR><BR>\r
+\r
+To calculate the dimensions of the terminal use this formula:<BR><BR>\r
+\r
+width:&nbsp; 2 * frameWidth + conf.cols * &lt;width of &nbsp;&gt; + 2 * 2px padding (left and right)<BR>\r
+height: 2 * frameWidth + conf.rows * conf.rowHeight + 2 * 2px padding (top and bottom).<BR><BR>\r
+\r
+Or you could get the empirical values for width and height by calling a terminal's `<SPAN CLASS="prop">getDimensions()</SPAN>' method, once the terminal is open. (see documentation in &quot;readme.txt&quot;).<BR><BR>\r
+\r
+Finnally, you could obviously embed the terminal's division element in your custom chrome layout (see below). [This will not be compatible to Netscape 4.]<BR><BR>\r
+\r
+p.e.:<PRE>\r
+  &lt;div id=&quot;myTerminal1&quot; style=&quot;position:absolute; top:100px; left:100px;&quot;&gt;\r
+     &lt;table class=&quot;termChrome&quot;&gt;\r
+       &lt;tbody&gt;\r
+        &lt;tr&gt;\r
+           &lt;td class=&quot;termTitle&quot;&gt;terminal 1&lt;/td&gt;\r
+        &lt;/tr&gt;\r
+        &lt;tr&gt;\r
+           &lt;td class=&quot;termBody&quot;&gt;&lt;div id=&quot;termDiv1&quot; style=&quot;position:relative&quot;&gt;&lt;/div&gt;&lt;/td&gt;\r
+        &lt;/tr&gt;\r
+       &lt;/tbody&gt;\r
+     &lt;/table&gt;\r
+   &lt;/div&gt;\r
+\r
+   // get a terminal for this\r
+\r
+   var term1 = new Terminal(\r
+                 {\r
+                   x: 0,\r
+                   y: 0,\r
+                   id: 1,\r
+                   termDiv: &quot;termDiv1&quot;,\r
+                   handler: myTermHandler\r
+                 }\r
+              );\r
+   term1.open();\r
+   \r
+   // and this is how to move the chrome and the embedded terminal\r
+\r
+   TermGlobals.setElementXY( &quot;myTerminal1&quot;, 200, 80 );\r
+</PRE>\r
+To keep track of the instance for any widgets use the terminal's `id' property. (You must set this in the configuration object to a unique value for this purpose.)<BR><BR>\r
+\r
+For a demonstration see the <A HREF="chrome_sample.html">Chrome Sample Page</A>.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="embed"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">How can I embed a terminal relative to my HTML layout?</B><BR><BR>\r
+\r
+Define your devision element with attribute &quot;position&quot; set to &quot;relative&quot; and place this inside your layout. Call &quot;new Terminal()&quot; with config-values { x: 0, y: 0 } to leave it at its relative origin.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="syntax"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">I pasted your sample code and just got an error. - ???</B><BR><BR>\r
+\r
+The short examples are kept arbitrarily simple to show the syntax.<BR>\r
+Make sure that your divison element(s) is/are rendered by the browser before `Terminal.open()' is called.<BR><BR>\r
+\r
+Does not work:\r
+<PRE>  &lt;head&gt;\r
+  &lt;script&gt;\r
+    var term = new Terminal();\r
+    term.open();\r
+  &lt;/script&gt;\r
+  &lt;/head&gt;\r
+</PRE>\r
+Does work:\r
+<PRE>  &lt;head&gt;\r
+  &lt;script&gt;\r
+    var term;\r
+    \r
+    function termOpen() {\r
+       // to be called from outside after compile time\r
+       term = new Terminal();\r
+       term.open();\r
+    }\r
+  &lt;/script&gt;\r
+  &lt;/head&gt;\r
+</PRE>\r
+c.f. &quot;readme.txt&quot;<BR>\r
+(Opening a terminal by clicking a link implies also that the page has currently focus.)<BR><BR>\r
+With v.1.01 and higher this doesn't cause an error any more.<BR>`Terminal.prototype.open()' now returns a value for success.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="keyboard"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">I can't get any input, but I don't get any erros too.</B><BR><BR>\r
+\r
+The Terminal object's functionality relies on the browsers ability to generate and handle keyboard events.<BR>\r
+Sadly some browsers lack a full implementation of the event model. (e.g. Konquerer [khtml] and early versions of Apple Safari, which is a descendant of khtml.)\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="keylock"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">How can I temporary disable the keyboard handlers?</B><BR>\r
+<SPAN CLASS="prop">(The terminal is blocking my HTML form fields, etc.)</SPAN><BR><BR>\r
+\r
+With version 1.03 there's a global property `<SPAN CLASS="prop">TermGlobals.keylock</SPAN>'. Set this to `true' to disable the keyboard handlers without altering any other state. Reset it to `false' to continue with your terminal session(s).\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="linesranges"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">How can I set the cusor to the start / the end of the command line?</B><BR><BR>\r
+\r
+In case you need to implement a shortcut (like ^A of some UN*X-shells) to jump to the beginning or the end of the current input line, there are two private instance methods you could utilize:<BR><BR>\r
+`<SPAN CLASS="prop">_getLineEnd(&lt;row&gt;, &lt;col&gt;)</SPAN>' returns an array [&lt;row&gt;, &lt;col&gt;] with the position of the last character in the logical input line with ASCII value &gt;= 32 (0x20).<BR><BR>\r
+`<SPAN CLASS="prop">_getLineStart(&lt;row&gt;, &lt;col&gt;)</SPAN>' returns an array [&lt;row&gt;, &lt;col&gt;] with the position of the first character in the logical input line with ASCII value &gt;= 32 (0x20).<BR><BR>\r
+Both take a row and a column of a cursor position as arguments.<BR><BR>\r
+\r
+p.e.:\r
+<PRE>\r
+  // jump to the start of the input line\r
+\r
+  myCtrlHandler() {\r
+     // catch ^A and jump to start of the line\r
+     if (this.inputChar == 1) {\r
+        var firstChar = this._getLineStart(this.r, this.c);\r
+        this.cursorSet(firstChar[0], firstChar[1]);\r
+     }\r
+  }</PRE>\r
+(Keep in mind that this is not exactly a good example, since some browser actually don't issue a keyboard event for \r
+&quot;^A&quot;. And other browsers, which do catch such codes, are not very reliable in that.)\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="historyunique"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">How can I limit the command history to unique entries only?</B><BR>\r
+       <SPAN CLASS="prop">(My application effords commands to be commonly repeated.)</SPAN><BR><BR>\r
+\r
+With version 1.05 there is a new configuration and control flag `<SPAN CLASS="prop">historyUnique</SPAN>'. All you need is setting this to `true' in your terminal's configuration object.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="rebuild"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">How can I change my color theme on the fly?</B><BR><BR>\r
+\r
+With version 1.07 there is a new method `<SPAN CLASS="prop">Terminal.rebuild()</SPAN>'.<BR>\r
+This method updates the GUI to current config settings while preserving all other state.<BR><BR>\r
+p.e.:\r
+<PRE>\r
+   // change color settings on the fly\r
+   // here: set bgColor to white and font style to class &quot;termWhite&quot;\r
+   // method rebuild() updates the GUI without side effects\r
+   // assume var term holds a referene to a Terminal object already active\r
+\r
+   term.conf.bgColor = '#ffffff';\r
+   term.conf.fontClass = 'termWhite';\r
+   term.rebuild();</PRE>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13"><A NAME="connect"></A>\r
+&nbsp;<BR>\r
+<B CLASS="quest">How can I connect to a server?</B><BR><BR>\r
+\r
+The Terminal object only provides an interface to handle console input and output.<BR>\r
+External connections have to be handled outside the Terminal object. You could use the XMLHttpRequest-Object (and use a communication model like AJAX or JSON) or connect via a frame or iframe element to a foreign host.<BR><BR>\r
+Handling connections is considered to be out of the realm of the &quot;termlib.js&quot; library.<BR>\r
+The code you need is in fact quite simple:\r
+<PRE>\r
+  function connectToHost(url) {\r
+     if (window.XMLHttpRequest) {\r
+        request = new XMLHttpRequest();\r
+     }\r
+     else if (window.ActiveXObject) {\r
+         request = new ActiveXObject('Microsoft.XMLHTTP');\r
+     }\r
+     if (request) {\r
+         request.onreadystatechange = requestChangeHandler;\r
+         request.open('GET', url);\r
+         request.send('');\r
+     }\r
+     else {\r
+        // XMLHttpRequest not implemented\r
+     }\r
+  }\r
+  \r
+  function requestChangeHandler() {\r
+     if (request.readyState == 4) {\r
+        // readyState 4: complete; now test for server's response status\r
+        if (request.status == 200) {\r
+           // response in request.responseText or request.responseXML if XML-code\r
+           // if it's JS-code we could get this by eval(request.responseText)\r
+           // by this we could import whole functions to be used via the terminal\r
+        }\r
+        else {\r
+           // connection error\r
+           // status code and message in request.status and request.statusText\r
+        }\r
+     }\r
+  }\r
+</PRE>\r
+You should use this only together with a timer (window.setTimeout()) to handle connection timeouts.<BR>\r
+Additionally you would need some syntax to authenticate and tell the server what you want.<BR>\r
+For this purpose you could use the following methods of the XMLHttpRequest object:<BR><BR>\r
+\r
+       <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="3">\r
+       <TR VALIGN="top"><TD NOWRAP CLASS="prop">setRequestHeader(&quot;<I>headerLabel</I>&quot;, &quot;<I>value</I>&quot;)</TD><TD>set a HTTP header to be sent to the server</TD></TR>\r
+       <TR VALIGN="top"><TD NOWRAP CLASS="prop">getResponseHeader(&quot;<I>headerLabel</I>&quot;)</TD><TD>get a HTTP header sent from the server</TD></TR>\r
+       <TR VALIGN="top"><TD NOWRAP CLASS="prop">open(<I>method</I>, &quot;<I>url</I>&quot; [, <I>asyncFlag</I> [,<BR>&nbsp; &quot;<I>userid</I>&quot; [, &quot;<I>password</I>&quot;]]])</TD><TD>assign the destination properties to the request.<BR>be aware that userid and password are not encrypted!</TD></TR>\r
+       <TR VALIGN="top"><TD NOWRAP CLASS="prop">send(<I>content</I>)</TD><TD>transmit a message body (post-string or DOM object)</TD></TR>\r
+       <TR VALIGN="top"><TD NOWRAP CLASS="prop">abort()</TD><TD>use this to stop a pending connection</TD></TR>\r
+       </TABLE>\r
+\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       &nbsp;<BR>\r
+       Norbert Landsteiner - August 2005<BR>\r
+       <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       &nbsp;<BR>\r
+               <A HREF="#top">&gt; top of page</A>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       &nbsp;\r
+       </TD></TR>\r
+</TABLE>\r
+\r
+<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
+\r
+</BODY>\r
+</HTML>
\ No newline at end of file
diff --git a/extra/webapps/fjsc/resources/termlib/index.html b/extra/webapps/fjsc/resources/termlib/index.html
new file mode 100644 (file)
index 0000000..1770b2c
--- /dev/null
@@ -0,0 +1,207 @@
+<HTML>\r
+<HEAD>\r
+       <TITLE>mass:werk termlib</TITLE>\r
+\r
+<STYLE TYPE="text/css">\r
+body,p,a,td {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #cccccc;\r
+}\r
+.lh13 {\r
+       line-height: 13px;\r
+}\r
+.lh15 {\r
+       line-height: 15px;\r
+}\r
+pre {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #ccffaa;\r
+       line-height: 15px;\r
+}\r
+.prop {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       color: #bbee99;\r
+       font-size: 12px;\r
+       line-height: 15px;\r
+}\r
+h1 {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 16px;\r
+       color: #cccccc;\r
+}\r
+a,a:link,a:visited {\r
+       text-decoration: none;\r
+       color: #77dd11;\r
+}\r
+a:hover {\r
+       text-decoration: underline;\r
+       color: #77dd11;\r
+}\r
+a:active {\r
+       text-decoration: underline;\r
+       color: #dddddd;\r
+}\r
+\r
+@media print {\r
+       body { background-color: #ffffff; }\r
+       body,p,a,td {\r
+               font-family: courier,fixed,swiss,sans-serif;\r
+               font-size: 12px;\r
+               color: #000000;\r
+       }\r
+       .lh13 {\r
+               line-height: 13px;\r
+       }\r
+       .lh15 {\r
+               line-height: 15px;\r
+       }\r
+       pre,.prop {\r
+               font-family: courier,fixed,swiss,sans-serif;\r
+               font-size: 12px;\r
+               color: #000000;\r
+               line-height: 15px;\r
+       }\r
+       h1 {\r
+               font-family: courier,fixed,swiss,sans-serif;\r
+               font-size: 16px;\r
+               color: #000000;\r
+       }\r
+       a,a:link,a:visited {\r
+               text-decoration: none;\r
+               color: #000000;\r
+       }\r
+       a:hover {\r
+               text-decoration: underline;\r
+               color: #000000;\r
+       }\r
+       a:active {\r
+               text-decoration: underline;\r
+               color: #000000;\r
+       }\r
+}\r
+</STYLE>\r
+</HEAD>\r
+\r
+\r
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"><A NAME="top"></A>\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
+<TR>\r
+       <TD NOWRAP>termlib.js home</TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="faq.html">faq</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
+</TR>\r
+</TABLE>\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" WIDTH="700" ALIGN="center">\r
+       <TR><TD>\r
+               <H1>mass:werk termlib.js</H1>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+               The JavaScript library &quot;termlib.js&quot; provides a `Terminal' object, which\r
+               facillitates a simple and object oriented approach to generate and control a\r
+               terminal-like interface for web services.<BR><BR>\r
+               \r
+               "termlib.js" features direct keyboard input and powerful output methods\r
+               for multiple and simultanious instances of the `Terminal' object.<BR><BR>\r
+               \r
+               The library was written with the aim of simple usage and a maximum of compatibility\r
+               with minimal foot print in the global namespace.<BR><BR><BR>\r
+               \r
+               \r
+               A short example:<BR>\r
+  <PRE>\r
+  var term = new Terminal( {handler: termHandler} );\r
+  term.open();\r
+\r
+  function termHandler() {\r
+     this.newLine();\r
+     var line = this.lineBuffer;\r
+     if (line != &quot;&quot;) {\r
+        this.write(&quot;You typed: &quot;+line);\r
+     }\r
+     this.prompt();\r
+  }\r
+  </PRE>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       <B>License</B><BR><BR>\r
+\r
+       This JavaScript-library is <U>free for private and academic use</U>.\r
+       Please include a readable copyright statement and a backlink to &lt;http://www.masswerk.at&gt; in the\r
+       web page. The library should always be accompanied by the &quot;readme.txt&quot; and the sample HTML-documents.<BR><BR>\r
+\r
+       The term &quot;private use&quot; includes any personal or non-commercial use, which is not related\r
+       to commercial activites, but excludes intranet, extranet and/or public net applications\r
+       that are related to any kind of commercial or profit oriented activity.<BR><BR>\r
+\r
+       For commercial use see &lt;<A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>&gt; for contact information.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       <B>Distribution</B><BR><BR>\r
+\r
+       This JavaScript-library may be distributed freely as long it is distributed together with the &quot;readme.txt&quot; and the sample HTML-documents and this document.<BR><BR>\r
+\r
+       Any changes to the library should be commented and be documented in the readme-file.<BR>\r
+       Any changes must be reflected in the `Terminal.version' string as &quot;Version.Subversion&nbsp;(compatibility)&quot;.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       <B>Disclaimer</B><BR><BR>\r
+\r
+       This software is distributed AS IS and in the hope that it will be useful, but WITHOUT ANY\r
+       WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+       PURPOSE. The entire risk as to the quality and performance of the product is borne by the\r
+       user. No use of the product is authorized hereunder except under this disclaimer.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       <B>History</B><BR><BR>\r
+\r
+       This library evolved from the terminal script &quot;TermApp&quot; ((c) N. Landsteiner 2003) and is in its\r
+       current form a down scaled spinn-off of the &quot;JS/UIX&quot; project. (JS/UIX is not a free&nbsp;software by now.)\r
+       c.f.: &lt;<A HREF="http://www.masswerk.at/jsuix/" TARGET="_blank">http://www.masswerk.at/jsuix</A>&gt;<BR><BR>\r
+\r
+       For version history: see the <A HREF="readme.txt">readme.txt</A>.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       &nbsp;<BR>\r
+       <B>Download</B><BR><BR>\r
+       Be sure to have read the license information and the disclamer and that you are willing to respect copyrights.<BR><BR>\r
+\r
+       <SPAN CLASS="prop">Download:</SPAN> <A HREF="termlib.zip">termlib.zip</A> (~ 40 KB, incl. docs)<BR><BR>\r
+       Current version is &quot;1.07 (original)&quot;.<BR>\r
+       The files are now provided with line breaks  in format &lt;CRLF&gt;.<BR>\r
+       &nbsp;\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       <B>Author</B><BR><BR>\r
+       &copy; Norbert Landsteiner 2003-2005<BR>\r
+       mass:werk &#150; media environments<BR>\r
+       <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       &nbsp;<BR>\r
+       Author's note:<BR>\r
+       Please do not contact me on questions of simple usage. There is an extensive documentation (readme.txt) including plenty of sample code that should provide all information you need.\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       &nbsp;<BR>\r
+               <A HREF="#top">&gt; top of page</A>\r
+       </TD></TR>\r
+       <TR><TD CLASS="lh13">\r
+       &nbsp;\r
+       </TD></TR>\r
+</TABLE>\r
+\r
+<DIV ID="termDiv" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
+\r
+</BODY>\r
+</HTML>
\ No newline at end of file
diff --git a/extra/webapps/fjsc/resources/termlib/multiterm_test.html b/extra/webapps/fjsc/resources/termlib/multiterm_test.html
new file mode 100644 (file)
index 0000000..0a4e1ec
--- /dev/null
@@ -0,0 +1,188 @@
+<HTML>\r
+<HEAD>\r
+       <TITLE>termlib Multiple Terminal Test</TITLE>\r
+       <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib.js"></SCRIPT>\r
+\r
+<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
+<!--\r
+\r
+/*\r
+  multiple terminal test for termlib.js\r
+\r
+  (c) Norbert Landsteiner 2003-2005\r
+  mass:werk - media environments\r
+  <http://www.masswerk.at>\r
+\r
+*/\r
+\r
+var term=new Array();\r
+\r
+var helpPage=[\r
+       '%CS%+r Terminal Help %-r%n',\r
+       '  This is just a tiny test for multiple terminals.',\r
+       '  use one of the following commands:',\r
+       '     clear .... clear the terminal',\r
+       '     exit ..... close the terminal (or <ESC>)',\r
+       '     id ....... show terminal\'s id',\r
+       '     switch ... switch to other terminal',\r
+       '     help ..... show this help page',\r
+       '  other input will be echoed to the terminal.',\r
+       ' '\r
+];\r
+\r
+function termOpen(n) {\r
+       if (!term[n]) {\r
+               var y=(n==1)? 70: 280;\r
+               term[n]=new Terminal(\r
+                       {\r
+                               x: 220,\r
+                               y: y,\r
+                               rows: 12,\r
+                               greeting: '%+r +++ Terminal #'+n+' ready. +++ %-r%nType "help" for help.%n',\r
+                               id: n,\r
+                               termDiv: 'termDiv'+n,\r
+                               crsrBlinkMode: true,\r
+                               handler: termHandler,\r
+                               exitHandler: termExitHandler\r
+                       }\r
+               );\r
+               if (term[n]) term[n].open();\r
+       }\r
+       else if (term[n].closed) {\r
+               term[n].open();\r
+       }\r
+       else {\r
+               term[n].focus();\r
+       }\r
+}\r
+\r
+function termHandler() {\r
+       // called on <CR> or <ENTER>\r
+       this.newLine();\r
+       var cmd=this.lineBuffer;\r
+       if (cmd!='') {\r
+               if (cmd=='switch') {\r
+                       var other=(this.id==1)? 2:1;\r
+                       termOpen(other);\r
+               }\r
+               else if (cmd=='clear') {\r
+                       this.clear();\r
+               }\r
+               else if (cmd=='exit') {\r
+                       this.close();\r
+               }\r
+               else if (cmd=='help') {\r
+                       this.write(helpPage);\r
+               }\r
+               else if (cmd=='id') {\r
+                       this.write('terminal id: '+this.id);\r
+               }\r
+               else {\r
+                       this.type('You typed: '+cmd);\r
+                       this.newLine();\r
+               }\r
+       }\r
+       this.prompt();\r
+}\r
+\r
+function termExitHandler() {\r
+       // optional handler called on exit\r
+       // activate other terminal if open\r
+       var other=(this.id==1)? 2:1;\r
+       if ((term[other]) && (term[other].closed==false)) term[other].focus();\r
+}\r
+\r
+//-->\r
+</SCRIPT>\r
+\r
+<STYLE TYPE="text/css">\r
+body,p,a,td {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #cccccc;\r
+}\r
+.lh15 {\r
+       line-height: 15px;\r
+}\r
+.term {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #33d011;\r
+       background: none;\r
+}\r
+.termReverse {\r
+       color: #111111;\r
+       background: #33d011;\r
+}\r
+a,a:link,a:visited {\r
+       text-decoration: none;\r
+       color: #77dd11;\r
+}\r
+a:hover {\r
+       text-decoration: underline;\r
+       color: #77dd11;\r
+}\r
+a:active {\r
+       text-decoration: underline;\r
+       color: #dddddd;\r
+}\r
+\r
+a.termopen,a.termopen:link,a.termopen:visited {\r
+       text-decoration: none;\r
+       color: #77dd11;\r
+       background: none;\r
+}\r
+a.termopen:hover {\r
+       text-decoration: none;\r
+       color: #222222;\r
+       background: #77dd11;\r
+}\r
+a.termopen:active {\r
+       text-decoration: none;\r
+       color: #222222;\r
+       background: #dddddd;\r
+}\r
+\r
+</STYLE>\r
+</HEAD>\r
+\r
+\r
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
+<TR>\r
+       <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP>multiple terminal test</TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="parser_sample.html">sample parser</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="faq.html">faq</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
+</TR>\r
+</TABLE>\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0">\r
+       <TR><TD NOWRAP>\r
+               Multiple Terminal Test<BR>&nbsp;\r
+       </TD></TR>\r
+       <TR><TD NOWRAP>\r
+               <A HREF="javascript:termOpen(1)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" CLASS="termopen">&gt; open terminal 1 &nbsp;</A>\r
+       </TD></TR>\r
+       <TR><TD NOWRAP>\r
+               <A HREF="javascript:termOpen(2)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 2'; return true" onmouseout="window.status=''; return true" CLASS="termopen">&gt; open terminal 2 &nbsp;</A>\r
+       </TD></TR>\r
+       <TR><TD NOWRAP CLASS="lh15">\r
+               &nbsp;<BR>\r
+               (c) mass:werk,<BR>N. Landsteiner 2003-2005<BR>\r
+               <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
+       </TD></TR>\r
+</TABLE>\r
+\r
+<DIV ID="termDiv1" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
+<DIV ID="termDiv2" STYLE="position:absolute; top:20px; left:100px;"></DIV>\r
+\r
+</BODY>\r
+</HTML>
\ No newline at end of file
diff --git a/extra/webapps/fjsc/resources/termlib/parser_sample.html b/extra/webapps/fjsc/resources/termlib/parser_sample.html
new file mode 100644 (file)
index 0000000..b332af1
--- /dev/null
@@ -0,0 +1,293 @@
+<HTML>\r
+<HEAD>\r
+       <TITLE>termlib Sample Parser</TITLE>\r
+       <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib.js"></SCRIPT>\r
+       <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="termlib_parser.js"></SCRIPT>\r
+\r
+<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
+<!--\r
+\r
+/*\r
+  test sample for termlib.js and termlib_parser.js\r
+\r
+  (c) Norbert Landsteiner 2005\r
+  mass:werk - media environments\r
+  <http://www.masswerk.at>\r
+\r
+*/\r
+\r
+var term;\r
+\r
+var helpPage=[\r
+       '%CS%+r Terminal Help %-r%n',\r
+       '  This is just a sample to demonstrate command line parsing.',\r
+       ' ',\r
+       '  Use one of the following commands:',\r
+       '     clear [-a] .......... clear the terminal',\r
+       '                           option "a" also removes the status line',\r
+       '     number -n<value> .... return value of option "n" (test for options)',\r
+       '     repeat -n<value> .... repeats the first argument n times (another test)',\r
+       '     login <username> .... sample login (test for raw mode)',\r
+       '     exit ................ close the terminal (same as <ESC>)',\r
+       '     help ................ show this help page',\r
+       ' ',\r
+       '  other input will be echoed to the terminal as a list of parsed arguments',\r
+       '  in the format <argument index> <quoting level> "<parsed value>".',\r
+       ' '\r
+];\r
+\r
+function termOpen() {\r
+       if (!term) {\r
+               term=new Terminal(\r
+                       {\r
+                               x: 220,\r
+                               y: 70,\r
+                               termDiv: 'termDiv',\r
+                               ps: '[guest]$',\r
+                               initHandler: termInitHandler,\r
+                               handler: commandHandler\r
+                       }\r
+               );\r
+               if (term) term.open();\r
+       }\r
+       else if (term.closed) {\r
+               term.open();\r
+       }\r
+       else {\r
+               term.focus();\r
+       }\r
+}\r
+\r
+function termInitHandler() {\r
+       // output a start up screen\r
+       this.write(\r
+               [\r
+                       TermGlobals.center('####################################################', 80),\r
+                       TermGlobals.center('#                                                  #', 80),\r
+                       TermGlobals.center('#           termlib.js - Sample Parser             #', 80),\r
+                       TermGlobals.center('#  Input is echoed as a list of parsed arguments.  #', 80),\r
+                       TermGlobals.center('#                                                  #', 80),\r
+                       TermGlobals.center('#  Type "help" for commands.                       #', 80),\r
+                       TermGlobals.center('#                                                  #', 80),\r
+                       TermGlobals.center('#  (c) N. Landsteiner 2005;  www.masswerk.at       #', 80),\r
+                       TermGlobals.center('#                                                  #', 80),\r
+                       TermGlobals.center('####################################################', 80),\r
+                       '%n'\r
+               ]\r
+       );\r
+       // set a double status line\r
+       this.statusLine('', 8,2); // just a line of strike\r
+       this.statusLine(' +++ This is just a test sample for command parsing. Type "help" for help. +++');\r
+       this.maxLines -= 2;\r
+       // and leave with prompt\r
+       this.prompt();\r
+}\r
+\r
+function commandHandler() {\r
+       this.newLine();\r
+       // check for raw mode first (should not be parsed)\r
+       if (this.rawMode) {\r
+               if (this.env.getPassword) {\r
+                       // sample password handler (lineBuffer == stored username ?)\r
+                       if (this.lineBuffer == this.env.username) {\r
+                               this.user = this.env.username;\r
+                               this.ps = '['+this.user+']>';\r
+                       }\r
+                       else {\r
+                               this.type('Sorry.');\r
+                       }\r
+                       this.env.username = '';\r
+                       this.env.getPassword = false;\r
+               }\r
+               // leave in normal mode\r
+               this.rawMode = false;\r
+               this.prompt();\r
+               return;\r
+       }\r
+       // normal command parsing\r
+       // just call the termlib_parser with a reference of the calling Terminal instance\r
+       // parsed arguments will be imported in this.argv,\r
+       // quoting levels per argument in this.argQL (quoting character or empty)\r
+       // cursor for arguments is this.argc (used by parserGetopt)\r
+       // => see 'termlib_parse.js' for configuration and details\r
+       parseLine(this);\r
+       if (this.argv.length == 0) {\r
+               // no commmand line input\r
+       }\r
+       else if (this.argQL[0]) {\r
+           // first argument quoted -> error\r
+               this.write("Syntax error: first argument quoted.");\r
+       }\r
+       else {\r
+               var cmd = this.argv[this.argc++];\r
+               /*\r
+                 process commands now\r
+                 1st argument: this.argv[this.argc]\r
+               */\r
+               if (cmd == 'help') {\r
+                       this.write(helpPage);\r
+               }\r
+               else if (cmd == 'clear') {\r
+                       // get options\r
+                       var opts = parserGetopt(this, 'aA');\r
+                       if (opts.a) {\r
+                               // discard status line on opt "a" or "A"\r
+                               this.maxLines = this.conf.rows;\r
+                       }\r
+                       this.clear();\r
+               }\r
+               else if (cmd == 'number') {\r
+                       // test for value options\r
+                       var opts = parserGetopt(this, 'n');\r
+                       if (opts.illegals.length) this.type('illegal option. usage: number -n<value>')\r
+                       else if ((opts.n) && (opts.n.value != -1)) this.type('option value: '+opts.n.value)\r
+                       else this.type('usage: number -n<value>');\r
+               }\r
+               else if (cmd == 'repeat') {\r
+                       // another test for value options\r
+                       var opts = parserGetopt(this, 'n');\r
+                       if (opts.illegals.length) this.type('illegal option. usage: repeat -n<value> <string>')\r
+                       else if ((opts.n) && (opts.n.value != -1)) {\r
+                               // first normal argument is again this.argv[this.argc]\r
+                               var s = this.argv[this.argc];\r
+                               if (typeof s != 'undefined') {\r
+                                       // repeat this string n times\r
+                                       var a = [];\r
+                                       for (var i=0; i<opts.n.value; i++) a[a.length] = s;\r
+                                       this.type(a.join(' '));\r
+                               }\r
+                       }\r
+                       else this.type('usage: repeat -n<value> <string>');\r
+               }\r
+               else if (cmd == 'login') {\r
+                       // sample login (test for raw mode)\r
+                       if ((this.argc == this.argv.length) || (this.argv[this.argc] == '')) {\r
+                               this.type('usage: login <username>');\r
+                       }\r
+                       else {\r
+                               this.env.getPassword = true;\r
+                               this.env.username = this.argv[this.argc];\r
+                               this.write('%+iSample login: repeat username as password.%-i%n');\r
+                               this.type('password: ');\r
+                               // exit in raw mode (blind input)\r
+                               this.rawMode = true;\r
+                               this.lock = false;\r
+                               return;\r
+                       }\r
+               }\r
+               else if (cmd == 'exit') {\r
+                       this.close();\r
+                       return;\r
+               }\r
+               else {\r
+                       // for test purpose just output argv as list\r
+                       // assemble a string of style-escaped lines and output it in more-mode\r
+                       s=' INDEX  QL  ARGUMENT%n';\r
+                       for (var i=0; i<this.argv.length; i++) {\r
+                               s += TermGlobals.stringReplace('%', '%%',\r
+                                               TermGlobals.fillLeft(i, 6) +\r
+                                               TermGlobals.fillLeft((this.argQL[i])? this.argQL[i]:'-', 4) +\r
+                                               '  "' + this.argv[i] + '"'\r
+                                       ) + '%n';\r
+                       }\r
+                       this.write(s, 1);\r
+                       return;\r
+               }\r
+       }\r
+       this.prompt();\r
+}\r
+\r
+\r
+//-->\r
+</SCRIPT>\r
+\r
+<STYLE TYPE="text/css">\r
+body,p,a,td {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #cccccc;\r
+}\r
+.lh15 {\r
+       line-height: 15px;\r
+}\r
+.term {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #33d011;\r
+       background: none;\r
+}\r
+.termReverse {\r
+       color: #111111;\r
+       background: #33d011;\r
+}\r
+a,a:link,a:visited {\r
+       text-decoration: none;\r
+       color: #77dd11;\r
+}\r
+a:hover {\r
+       text-decoration: underline;\r
+       color: #77dd11;\r
+}\r
+a:active {\r
+       text-decoration: underline;\r
+       color: #dddddd;\r
+}\r
+\r
+a.termopen,a.termopen:link,a.termopen:visited {\r
+       text-decoration: none;\r
+       color: #77dd11;\r
+       background: none;\r
+}\r
+a.termopen:hover {\r
+       text-decoration: none;\r
+       color: #222222;\r
+       background: #77dd11;\r
+}\r
+a.termopen:active {\r
+       text-decoration: none;\r
+       color: #222222;\r
+       background: #dddddd;\r
+}\r
+\r
+</STYLE>\r
+</HEAD>\r
+\r
+\r
+<BODY BGCOLOR="#222222" LINK="#77dd11" TEXT="#cccccc" ALINK="#dddddd" VLINK="#77dd11"\r
+TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0" ALIGN="center">\r
+<TR>\r
+       <TD NOWRAP><A HREF="index.html">termlib.js home</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="multiterm_test.html">multiple terminal test</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP>sample parser</TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="faq.html">faq</A></TD>\r
+       <TD>|</TD>\r
+       <TD NOWRAP><A HREF="readme.txt" TITLE="readme.txt (text/plain)">documentation</A></TD>\r
+</TR>\r
+</TABLE>\r
+\r
+<TABLE BORDER="0" CELLSPACING="20" CELLPADDING="0">\r
+       <TR><TD NOWRAP>\r
+               Sample Parser Test<BR>&nbsp;\r
+       </TD></TR>\r
+       <TR><TD NOWRAP>\r
+               <A HREF="javascript:termOpen()" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" CLASS="termopen">&gt; open terminal &nbsp;</A>\r
+       </TD></TR>\r
+       <TR><TD NOWRAP>\r
+               &nbsp;\r
+       </TD></TR>\r
+       <TR><TD NOWRAP CLASS="lh15">\r
+               &nbsp;<BR>\r
+               (c) mass:werk,<BR>N. Landsteiner 2003-2005<BR>\r
+               <A HREF="http://www.masswerk.at/" TARGET="_blank">http://www.masswerk.at</A>\r
+       </TD></TR>\r
+</TABLE>\r
+\r
+<DIV ID="termDiv" STYLE="position:absolute;"></DIV>\r
+\r
+</BODY>\r
+</HTML>
\ No newline at end of file
diff --git a/extra/webapps/fjsc/resources/termlib/readme.txt b/extra/webapps/fjsc/resources/termlib/readme.txt
new file mode 100644 (file)
index 0000000..8a92b9c
--- /dev/null
@@ -0,0 +1,1400 @@
+****  mass:werk termlib.js - JS-WebTerminal Object v1.07  ****\r
+\r
+  (c) Norbert Landsteiner 2003-2005\r
+  mass:werk - media environments\r
+  <http://www.masswerk.at>\r
+\r
+\r
+\r
+\r
+Contents:\r
+\r
+   1  About\r
+   2  Creating a new Terminal Instance\r
+      2.1 Configuration Values\r
+   3  Using the Terminal\r
+      3.1  The Default Handler\r
+      3.2  Input Modes\r
+           3.2.1  Normal Line Input (Command Line Mode)\r
+                  3.2.1.2 Special Keys (ctrlHandler)\r
+           3.2.2  Raw Mode\r
+           3.2.3  Character Mode\r
+      3.3  Other Handlers\r
+           3.3.1  initHandler\r
+           3.3.2  exitHandler\r
+      3.4  Flags for Behaviour Control\r
+   4  Output Methods\r
+           4.1 Terminal.type()\r
+           4.2 Terminal.write()\r
+           4.3 Terminal.typeAt()\r
+           4.4 Terminal.setChar()\r
+           4.5 Terminal.newLine()\r
+           4.6 Terminal.clear()\r
+           4.7 Terminal.statusLine()\r
+           4.8 Terminal.printRowFromString()\r
+           4.9 Terminal.redraw()\r
+   5  Cursor Methods and Editing\r
+           5.1 Terminal.cursorOn()\r
+           5.2 Terminal.cursorOff()\r
+           5.3 Terminal.cursorSet()\r
+           5.4 Terminal.cursorLeft()\r
+           5.5 Terminal.cursorRight()\r
+           5.6 Terminal.backspace()\r
+           5.7 Terminal.fwdDelete()\r
+           5.8 Terminal.isPrintable()\r
+   6  Other Methods of the Terminal Object\r
+           6.1 Terminal.prompt()\r
+           6.2 Terminal.reset()\r
+           6.3 Terminal.open()\r
+           6.4 Terminal.close()\r
+           6.5 Terminal.focus()\r
+           6.6 Terminal.moveTo()\r
+           6.7 Terminal.resizeTo()\r
+           6.8 Terminal.getDimensions()\r
+           6.9 Terminal.rebuild()\r
+   7  Global Static Methods (TermGlobals)\r
+           7.1 TermGlobals.setFocus()\r
+           7.2 TermGlobals.keylock (Global Locking Flag)\r
+           7.3 TermGlobalsText Methods\r
+               7.3.1 TermGlobals.normalize()\r
+               7.3.2 TermGlobals.fillLeft()\r
+               7.3.3 TermGlobals.center()\r
+               7.3.4 TermGlobals.stringReplace()\r
+   8  Localization\r
+   9  Cross Browser Functions\r
+  10  Architecture, Internals\r
+      10.1  Global Entities\r
+      10.2  I/O Architecture\r
+      10.3  Compatibility\r
+  11  History\r
+  12  Example for a Command Line Parser\r
+  13  License\r
+  14  Disclaimer\r
+  15  References\r
+\r
+\r
+\r
+\r
+1  About\r
+\r
+The Terminal library "termlib.js" provides an object oriented constructor and control\r
+methods for a terminal-like DHTML interface.\r
+\r
+"termlib.js" features direct keyboard input and powerful output methods for multiple\r
+instances of the `Terminal' object (including focus control).\r
+\r
+The library was written with the aim of simple usage and a maximum of compatibility with\r
+minimal foot print in the global namespace.\r
+\r
+\r
+A simple example:\r
+\r
+  // creating a terminal and using it\r
+\r
+  var term = new Terminal( {handler: termHandler} );\r
+  term.open();\r
+\r
+  function termHandler() {\r
+    var line = this.lineBuffer;\r
+    this.newLine();\r
+    if (line == "help") {\r
+      this.write(helpPage)\r
+    }\r
+    else if (line == "exit") {\r
+      this.close();\r
+      return;\r
+    }\r
+    else if (line != "") {\r
+      this.write("You typed: "+line);\r
+    }\r
+    this.prompt();\r
+  }\r
+\r
+  var helpPage = [\r
+    "This is the monstrous help page for my groovy terminal.",\r
+    "Commands available:",\r
+    "   help ... print this monstrous help page",\r
+    "   exit ... leave this groovy terminal",\r
+    " ",\r
+    "Have fun!"\r
+  ];\r
+\r
+\r
+You should provide CSS font definitions for the classes ".term" (normal video) and\r
+".termReverse" (reverse video) in a monospaced font.\r
+A sample stylesheet "term_styles.css" comes with this library.\r
+\r
+See the sample application "multiterm_test.html" for a demo of multiple terminals.\r
+\r
+v.1.01: If you configure to use another font class (see 2.1 Configuration Values),\r
+        you must provide a subclass ".termReverse" for reversed video.\r
+\r
+        p.e.: .myFontClass .termReverse {\r
+                /* your definitions for reverse video here */\r
+              }\r
+        \r
+        With the addition of `conf.fontClass' you can now create multiple\r
+        instances with independend appearences.\r
+\r
+\r
+\r
+\r
+2   Creating a new Terminal Instance\r
+\r
+Use the `new' constructor to create a new instance of the Terminal object. You will want\r
+to supply a configuration object as an argument to the constructor. If the `new'\r
+constructor is called without an object as its first argument, default values are used.\r
+\r
+p.e.:\r
+\r
+  // creating a new instance of Terminal\r
+\r
+  var conf= {\r
+    x: 100,\r
+    y: 100,\r
+    cols: 80,\r
+    rows: 24\r
+  }\r
+\r
+  var term = new Term(conf);\r
+  term.open();\r
+\r
+`Terminal.open()' initializes the terminal and makes it visible to the user.\r
+This is handled in by separate method to allow the re-initilization of instances\r
+previously closed.\r
+\r
+NOTE:\r
+The division element (or NS-layer) that holds the terminal must be present when calling\r
+`Terminal.open()'. So you must not call this method from the header of a HTML-document at\r
+compile time.\r
+\r
+\r
+\r
+2.1 Configuration Values\r
+\r
+Set any of these values in your configuration object to override:\r
+\r
+  \r
+  LABEL                     DEFAULT VALUE    COMMENT\r
+  \r
+  x                                   100    terminal's position x in px\r
+  y                                   100    terminal's position y in px\r
+  divDiv                        'termDiv'    id of terminals CSS division\r
+  bgColor                       '#181818'    background color (HTML hex value)\r
+  frameColor                    '#555555'    frame color (HTML hex value)\r
+  frameWidth                            1    frame border width in px\r
+  fontClass                        'term'    class name of CSS font definition to use\r
+  cols                                 80    number of cols per row\r
+  rows                                 24    number of rows\r
+  rowHeight                            15    a row's line-height in px\r
+  blinkDelay                          500    delay for cursor blinking in milliseconds\r
+  crsrBlinkMode                     false    true for blinking cursor\r
+  crsrBlockMode                      true    true for block-cursor else underscore\r
+  DELisBS                           false    handle <DEL> as <BACKSPACE>\r
+  printTab                           true    handle <TAB> as printable (prints as space)\r
+  printEuro                          true    handle unicode 0x20AC (Euro sign) as printable\r
+  catchCtrlH                         true    handle ^H as <BACKSPACE>\r
+  closeOnESC                         true    close terminal on <ESC>\r
+  historyUnique                     false    prevent consecutive and identical entries in history\r
+  id                                    0    terminal id\r
+  ps                                  '>'    prompt string\r
+  greeting      '%+r Terminal ready. %-r'    string for greeting if no initHandler is used\r
+  handler              termDefaultHandler    reference to handler for command interpretation\r
+  ctrlHandler                        null    reference to handler called on uncatched special keys\r
+  initHandler                        null    reference to handler called at end of init()\r
+  exitHandler                        null    reference to handler called on close()\r
+\r
+\r
+At least you will want to specify `handler' to implement your own command parser.\r
+\r
+Note: While `id' is not used by the Termninal object, it provides an easy way to identify\r
+multiple terminals by the use of "this.id". (e.g.: "if (this.id == 1) startupterm = true;")\r
+\r
+p.e.:\r
+\r
+  // creating two individual Terminal instances\r
+\r
+  var term1 = new Terminal(\r
+    {\r
+      id: 1,\r
+      x: 200,\r
+      y: 10,\r
+      cols: 80,\r
+      rows: 12,\r
+      greeting: "*** This is Terminal 1 ***",\r
+      handler: myTerminalHandler\r
+    }\r
+  );\r
+  term1.open();\r
+\r
+  var term2 = new Terminal(\r
+    {\r
+      id: 2,\r
+      x, 200,\r
+      y: 220,\r
+      cols: 80\r
+      rows: 12,\r
+      greeting: "*** This is Terminal 2 ***",\r
+      handler: myTerminalHandler\r
+    }\r
+  );\r
+  term2.open();\r
+\r
+\r
+\r
+\r
+3   Using the Terminal\r
+\r
+There are 4 different handlers that are called by a Terminal instance to process input and\r
+some flags to control the input mode and behaviour.\r
+\r
+\r
+\r
+3.1 The Default Handler (a simlple example for input handling)\r
+\r
+If no handlers are defined in the configuration object, a default handler is called to\r
+handle a line of user input. The default command line handler `termDefaultHandler' just\r
+closes the command line with a new line and echos the input back to the user:\r
+\r
+  function termDefaultHandler() {\r
+    this.newLine();\r
+    if (this.lineBuffer != '') {\r
+      this.type('You typed: '+this.lineBuffer);\r
+      this.newLine();\r
+    }\r
+    this.prompt();\r
+  }\r
+\r
+First you may note that the instance is refered to as `this'. So you need not worry about\r
+which Terminal instance is calling your handler. As the handler is entered, the terminal\r
+is locked for user input and the cursor is off. The current input is available as a string\r
+value in `this.lineBuffer'.\r
+\r
+The method `type(<text>)' just does what it says and types a string at the current cursor\r
+position to the terminal screen.\r
+\r
+`newLine()' moves the cursor to a new line.\r
+\r
+The method `prompt()' adds a new line if the cursor isn't at the start of a line, outputs\r
+the prompt string (as specified in the configuration), activates the cursor, and unlocks\r
+the terminal for further input. While you're doing normal command line processing, always\r
+call `prompt()' when leaving your handler.\r
+\r
+In fact this is all you need to create your own terminal application. Please see at least\r
+the method `write()' for a more powerful output method.\r
+\r
+Below we will refer to all methods of the Terminal object as `Terminal.<method>()'.\r
+You can call them as `this.<method>()' in a handler or as methods of your named instance\r
+in other context (e.g.: "myTerminal.close()").\r
+\r
+[In technical terms these methods are methods of the Terminal's prototype object, while\r
+the properties are properties of a Termninal instance. Since this doesn't make any\r
+difference to your script, we'll refer to both as `Terminal.<method-or-property>'.]\r
+\r
+\r
+\r
+3.2 Input Modes\r
+\r
+3.2.1 Normal Line Input (Command Line Mode)\r
+\r
+By default the terminal is in normal input mode. Any printable characters in the range of\r
+ASCII 0x20 - 0xff are echoed to the terminal and may be edited with the use of the cursor\r
+keys and the <BACKSPACE> key.\r
+The cursor keys UP and DOWN let the user browse in the command line history (the list of\r
+all commands issued previously in this Terminal instance).\r
+\r
+If the user presses <CR> or <ENTER>, the line is read from the terminal buffer, converted\r
+to a string, and placed in `Terminal.lineBuffer' (-> `this.lineBuffer') for further use.\r
+The terminal is then locked for further input and the specified handler\r
+(`Terminal.handler') is called.\r
+\r
+\r
+3.2.1.2 Special Keys (ctrlHandler)\r
+\r
+If a special character (ASCII<0x20) or an according combination of <CTRL> and a key is\r
+pressed, which is not caught for editing or "enter", and a handler for `ctrlHandler' is\r
+specified, this handler is called.\r
+The ASCII value of the special character is available in `Terminal.inputChar'. Please note\r
+that the terminal is neither locked, nor is the cursor off - all further actions have to\r
+be controlled by `ctrlHandler'. (The tracking of <CTRL>-<key> combinations as "^C" usually\r
+works but cannot be taken for granted.)\r
+\r
+A named reference of the special control values in POSIX form (as well as the values of\r
+the cursor keys [LEFT, RIGHT, UP, DOWN]) is available in the `termKey' object.\r
+\r
+p.e.:\r
+\r
+  // a simple ctrlHandler\r
+\r
+  function myCtrlHandler() {\r
+    if (this.inputChar == termKey.ETX) {\r
+      // exit on ^C (^C == ASCII 0x03 == <ETX>)\r
+      this.close();\r
+    }\r
+  }\r
+\r
+If no `ctrlHandler' is specified, control keys are ignored (default).\r
+\r
+\r
+3.2.2 Raw Mode\r
+\r
+If the flag `Terminal.rawMode' is set to a value evaluating to `true', no special keys are\r
+tracked but <CR> and <ENTER> (and <ESC>, if the flag `Terminal.closeOnESC' is set).\r
+The input is NOT echoed to the terminal. All printable key values [0x20-0xff] are\r
+transformed to characters and added to `Terminal.lineBuffer' sequentially. The command\r
+line input is NOT added to the history.\r
+\r
+This mode is especially suitable for password input.\r
+\r
+p.e.:\r
+\r
+  // using raw mode for password input\r
+\r
+  function myTermHandler() {\r
+    this.newLine();\r
+    // we stored a flag in Terminal.env to track the status\r
+    if (this.env.getpassword) {\r
+      // leave raw mode\r
+      this.rawMode = false;\r
+      if (passwords[this.env.user] == this.lineBuffer) {\r
+        // matched\r
+        this.type('Welcome '+this.env.user);\r
+        this.env.loggedin = true;\r
+      }\r
+      else {\r
+        this.type('Sorry.');\r
+      }\r
+      this.env.getpassword = false;\r
+    }\r
+    else {\r
+      // simple parsing\r
+      var args = this.lineBuffer.split(' ');\r
+      var cmd = args[0];\r
+      if (cmd == 'login') {\r
+        var user = args[1];\r
+        if (!user) {\r
+          this.type('usage: login <username>');\r
+        }\r
+        else {\r
+          this.env.user = user;\r
+          this.env.getpassword = true;\r
+          this.type('password? ');\r
+          // enter raw mode\r
+          this.rawMode = true;\r
+          // leave without prompt so we must unlock first\r
+          this.lock = false;\r
+          return;\r
+        }\r
+      }\r
+      /*\r
+        other actions ...\r
+      */\r
+    }\r
+    this.prompt();\r
+  }\r
+\r
+In this example a handler is set up to process the command "login <username>" and ask for\r
+a password for the given user name in raw mode. Note the use of the object `Terminal.env'\r
+which is just an empty object set up at the creation of the Terminal instance. Its only\r
+purpose is to provide an individual namespace for private data to be stored by a Terminal\r
+instance.\r
+\r
+NOTE: The flag `Terminal.lock' is used to control the keyboard locking. If we would not\r
+set this to `false' before leaving in raw mode, we would be caught in dead-lock, since no\r
+input could be entered and our handler wouldn't be called again. - A dreadful end of our\r
+terminal session.\r
+\r
+NOTE: Raw mode utilizes the property `Terminal.lastLine' to collect the input string.\r
+This is normally emty, when a handler is called. This is not the case if your script left\r
+the input process on a call of ctrlHandler. You should clear `Terminal.lastLine' in such\r
+a case, if you're going to enter raw mode immediatly after this.\r
+\r
+\r
+3.2.3 Character Mode\r
+\r
+If the flag `Terminal.charMode' is set to a value evaluating to `true', the terminal is in\r
+character mode. In this mode the numeric ASCII value of the next key typed is stored in\r
+`Terminal.inputChar'. The input is NOT echoed to the terminal. NO locking or cursor\r
+control is performed and left to the handler.\r
+You can use this mode to implement your editor or a console game.\r
+`Terminal.charMode' takes precedence over `Terminal.rawMode'.\r
+\r
+p.e.: \r
+\r
+  // using char mode\r
+\r
+  function myTermHandler() {\r
+    // this is the normal handler\r
+    this.newLine();\r
+    // simple parsing\r
+    var args = this.lineBuffer.split(' ');\r
+    var cmd = args[0];\r
+    if (cmd == 'edit') {\r
+      // init the editor\r
+      myEditor(this);\r
+      // redirect the handler to editor\r
+      this.handler = myEditor;\r
+      // leave in char mode\r
+      this.charMode = true;\r
+      // show cursor\r
+      this.cursorOn();\r
+      // don't forget unlocking\r
+      this.lock = false;\r
+      return;\r
+    }\r
+    /*\r
+      other actions ...\r
+    */\r
+    this.prompt();\r
+  }\r
+\r
+  function myEditor(initterm) {\r
+    // our dummy editor (featuring modal behaviour)\r
+    if (initterm) {\r
+      // perform initialization tasks\r
+      initterm.clear();\r
+      initterm.write('this is a simple test editor; leave with <ESC> then "q"%n%n');\r
+      initterm.env.mode = '';\r
+      // store a reference of the calling handler\r
+      initterm.env.handler = initterm.handler;\r
+      return;\r
+    }\r
+    // called as handler -> lock first\r
+    this.lock=true;\r
+    // hide cursor\r
+    this.cursorOff();\r
+    var key = this.inputChar;\r
+    if (this.env.mode == 'ctrl') {\r
+      // control mode\r
+      if (key == 113) {\r
+        // "q" => quit\r
+        // leave charMode and reset the handler to normal\r
+        this.charMode = false;\r
+        this.handler = this.env.handler;\r
+        // clear the screen\r
+        this.clear();\r
+        // prompt and return\r
+        this.prompt();\r
+        return;\r
+      }\r
+      else {\r
+        // leave control mode\r
+        this.env.mode = '';\r
+      }\r
+    }\r
+    else {\r
+      // edit mode\r
+      if (key == termKey.ESC) {\r
+        // enter control mode\r
+        // we'd better indicate this in a status line ...\r
+        this.env.mode = 'ctrl';\r
+      }\r
+      else if (key == termKey.LEFT) {\r
+        // cursor left\r
+      }\r
+      else if (key == termKey.RIGHT) {\r
+        // cursor right\r
+      }\r
+      if (key == termKey.UP) {\r
+        // cursor up\r
+      }\r
+      else if (key == termKey.DOWN) {\r
+        // cursor down\r
+      }\r
+      else if (key == termKey.CR) {\r
+        // cr or enter\r
+      }\r
+      else if (key == termKey.BS) {\r
+        // backspace\r
+      }\r
+      else if (key == termKey.DEL) {\r
+        // fwd delete\r
+        // conf.DELisBS is not evaluated in charMode!\r
+      }\r
+      else if (this.isPrintable(key)) {\r
+        // printable char - just type it\r
+        var ch = String.fromCharCode(key);\r
+        this.type(ch);\r
+      }\r
+    }\r
+    // leave unlocked with cursor\r
+    this.lock = false;\r
+    this.cursorOn();\r
+  }\r
+\r
+\r
+Note the redirecting of the input handler to replace the command line handler by the\r
+editor. The method `Terminal.clear()' clears the terminal.\r
+`Terminal.cursorOn()' and `Terminal.cursorOff()' are used to show and hide the cursor.\r
+\r
+\r
+\r
+3.3 Other Handlers\r
+\r
+There are two more handlers that can be specified in the configuration object:\r
+\r
+\r
+3.3.1 initHandler\r
+\r
+`initHandler' is called at the end of the initialization triggered by `Terminal.open()'.\r
+The default action - if no `initHandler' is specified - is:\r
+\r
+  // default initilization\r
+\r
+  this.write(this.conf.greeting);\r
+  this.newLine();\r
+  this.prompt();\r
+\r
+Use `initHandler' to perform your own start up tasks (e.g. show a start up screen). Keep\r
+in mind that you should unlock the terminal and possibly show a cursor to give the\r
+impression of a usable terminal.\r
+\r
+\r
+3.3.2  exitHandler\r
+\r
+`exitHandler' is called by `Terminal.close()' just before hiding the terminal. You can use\r
+this handler to implement any tasks to be performed on exit. Note that this handler is\r
+called even if the terminal is closed on <ESC> outside of your inputHandlers control.\r
+\r
+See the file "multiterm_test.html" for an example.\r
+\r
+\r
+\r
+3.4   Overview: Flags for Behaviour Control\r
+\r
+These falgs are accessible as `Terminal.<flag>' at runtime. If not stated else, the\r
+initial value may be specified in the configuration object.\r
+The configuration object and its properties are accessible at runtime via `Terminal.conf'.\r
+\r
+\r
+  NAME                      DEFAULT VALUE    MEANING\r
+\r
+  blink_delay                         500    delay for cursor blinking in milliseconds.\r
+\r
+  crsrBlinkMode                     false    true for blinking cursor.\r
+                                             if false, cursor is static.\r
+  \r
+  crsrBlockMode                      true    true for block-cursor else underscore.\r
+\r
+  DELisBS                           false    handle <DEL> as <BACKSPACE>.\r
+\r
+  printTab                           true    handle <TAB> as printable (prints as space)\r
+                                             if false <TAB> is handled as a control character\r
+\r
+  printEuro                          true    handle the euro sign as valid input char.\r
+                                             if false char 0x20AC is printed, but not accepted\r
+                                             in the command line\r
+\r
+  catchCtrlH                         true    handle ^H as <BACKSPACE>.\r
+                                             if false, ^H must be tracked by a custom\r
+                                             ctrlHandler.\r
+\r
+  closeOnESC                         true    close terminal on <ESC>.\r
+                                             if true, <ESC> is not available for ctrHandler.\r
+\r
+\r
+  historyUnique                     false    unique history entries.\r
+                                             if true, entries that are identical to the last\r
+                                             entry in the user history will not be added.\r
+\r
+  charMode                          false    terminal in character mode (tracks next key-code).\r
+                                             (runtime only)\r
\r
+  rawMode                           false    terminal in raw mode (no echo, no editing).\r
+                                             (runtime only)\r
+\r
+\r
+Not exactly a flag but useful:\r
+\r
+  ps                                  '>'    prompt string.\r
+\r
+\r
+\r
+\r
+4  Output Methods\r
+\r
+Please note that any output to the terminal implies an advance of the cursor. This means,\r
+that if your output reaches the last column of your terminal, the cursor is advanced and\r
+a new line is opened automatically. This procedure may include scrolling to make room for\r
+the new line. While this is not of much interest for most purposes, please note that, if\r
+you output a string of length 80 to a 80-columns-terminal, and a new line, and another\r
+string, this will result in an empty line between the two strings.\r
+\r
+\r
+4.1  Terminal.type( <text> [,<stylevector>] )\r
+\r
+Types the string <text> at the current cursor position to the terminal. Long lines are\r
+broken where the last column of the terminal is reached and continued in the next line.\r
+`Terminal.write()' does not support any kind of arbitrary line breaks. (This is just a\r
+basic output routine. See `Terminal.write()' for a more powerful output method.)\r
+\r
+A bitvector may be supplied as an optional second argument to represent a style or a\r
+combination of styles. The meanings of the bits set are interpreted as follows:\r
+\r
+<stylevector>:\r
+\r
+   1 ... reverse    (2 power 0)\r
+   2 ... underline  (2 power 1)\r
+   4 ... italics    (2 power 2)\r
+   8 ... strike     (2 power 3)\r
+\r
+So "Terminal.type( 'text', 5 )" types "text" in italics and reverse video.\r
+\r
+Note:\r
+There is no bold, for most monospaced fonts (including Courier) tend to render wider in\r
+bold. Since this would bring the terminal's layout out of balance, we just can't use bold\r
+as a style. - Sorry.\r
+\r
+The HTML-representation of this styles are defined in "TermGlobals.termStyleOpen" and\r
+"TermGlobals.termStyleClose".\r
+\r
+\r
+4.2  Terminal.write( <text> [,<usemore>] )\r
+\r
+Writes a text with markup to the terminal. If an optional second argument evaluates to\r
+true, a UN*X-style utility like `more' is used to page the text. The text may be supplied\r
+as a single string (with newline character "\n") or as an array of lines. Any other input\r
+is transformed to a string value before output.\r
+\r
+4.2.1 Mark-up:\r
+\r
+`Terminal.write()' employs a simple mark-up with the following syntax:\r
+\r
+<markup>: %([+|-]<style>|n|CS|%)\r
+   \r
+   where "+" and '-' are used to switch on and off a style, where\r
+   \r
+   <style>:\r
+   \r
+      "i" ... italics\r
+      "r" ... reverse\r
+      "s" ... strike\r
+      "u" ... underline\r
+      \r
+      "p" ... reset to plain ("%+p" == "%-p")\r
+    \r
+   styles may be combined and may overlap. (e.g. "This is %+rREVERSE%-r, %+uUNDER%+iSCORE%-u%-i.")\r
+   \r
+   "%n"  represents a new line (in fact "\n" is translated to "%n" before processing)\r
+   \r
+   "%CS" clears the terminal screen\r
+   \r
+   "%%"  represents the percent character ('%')\r
+\r
+\r
+4.2.2 Buffering:\r
+\r
+`Terminal.write()' writes via buffered output to the terminal. This means that the\r
+provided text is rendered to a buffer first and then only the visible parts are transfered\r
+to the terminal display buffers. This avoids scrolling delays for long output.\r
+\r
+4.2.3 UseMore Mode:\r
+\r
+The buffering of `Terminal.write()' allows for pagewise output, which may be specified by\r
+a second boolean argument. If <usemore> evaluates to `true' and the output exceeds the\r
+range of empty rows on the terminal screen, `Terminal.write()' performs like the UN*X\r
+utility `more'. The next page may be accessed by hitting <SPACE> while <q> terminates\r
+paging and returns with the prompt (-> `Terminal.prompt()').\r
+\r
+To use this facillity make sure to return immediatly after calling `Terminal.write()' in\r
+order to allow the more-routine to track the user input.\r
+The terminal is set to "charMode == false" afterwards.\r
+\r
+p.e.:\r
+\r
+  // using Terminal.write as a pager\r
+\r
+  function myTermHandler() {\r
+    this.newLine();\r
+    var args = this.lineBuffer.split(' ');\r
+    var cmd = args[0];\r
+    if (cmd == 'more') {\r
+      var page = args[1];\r
+      if (myPages[page]) {\r
+        // Terminal.write as a pager\r
+        this.write(myPages[page], true);\r
+        return;\r
+      }\r
+      else {\r
+        // Terminal.write for simple output\r
+        this.write('no such page.');\r
+      }\r
+    }\r
+    /*\r
+      other actions ...\r
+    */\r
+    this.prompt();\r
+  }\r
+\r
+\r
+4.3  Terminal.typeAt( <r>, <c>, <text> [,<stylevector>] )\r
+\r
+Output the string <text> at row <r>, col <c>.\r
+For <stylevector> see `Terminal.type()'.\r
+`Terminal.typeAt()' does not move the cursor.\r
+\r
+\r
+4.4  Terminal.setChar( <charcode>, <r>, <c> [,<stylevector>] )\r
+\r
+Output a single character represented by the ASCII value of <charcode> at row <r>, col <c>.\r
+For <stylevector> see `Terminal.type()'.\r
+\r
+\r
+4.5  Terminal.newLine()\r
+\r
+Moves the cursor to the first column of the next line and performs scrolling, if needed.\r
+\r
+\r
+4.6  Terminal.clear()\r
+\r
+Clears the terminal screen. (Returns with cursor off.)\r
+\r
+\r
+4.7  Terminal.statusLine( <text> [,<stylevector> [,<lineoffset>]] )\r
+\r
+All output acts on a logical screen with the origin at row 0 / col 0. While the origin is\r
+fixed, the logical width and height of the terminal are defined by `Terminal.maxCols' and\r
+`Terminal.maxLines'. These are set to the configuration dimensions at initilization and by\r
+`Terminal.reset()', but may be altered at any moment. Please note that there are no bounds\r
+checked, so make sure that `Terminal.maxCols' and `Terminal.maxLines' are less or equal\r
+to the configuration dimensions.\r
+\r
+You may want to decrement `Terminal.maxLines' to keep space for a reserved status line.\r
+`Terminal.statusLine( <text>, <style> )' offers a simple way to type a text to the last\r
+line of the screen as defined by the configuration dimensions.\r
+\r
+  // using statusLine()\r
+\r
+  function myHandler() {\r
+    // ...\r
+    // reserve last line\r
+    this.maxLines = term.conf.rows-1;\r
+    // print to status line in reverse video\r
+    this.statusLine("Status: <none>", 1);\r
+    // ...\r
+  }\r
+\r
+For multiple status lines the optional argument <lineoffset> specifies the addressed row,\r
+where 1 is the line closest to the bottom, 2 the second line from the bottom and so on.\r
+(default: 1)\r
+\r
+\r
+4.8  Terminal.printRowFromString( <r> , <text> [,<stylevector>] )\r
+\r
+Outputs the string <text> to row <r> in the style of an optional <stylevector>.\r
+If the string's length exceeds the length of the row  (up to `Terminal.conf.cols'), extra\r
+characteres are ignored, else any extra space is filled with character code 0 (prints as\r
+<SPACE>).\r
+The valid range for <row> is: 0 >= <row> < `Terminal.maxLines'.\r
+`Terminal.printRowFromString()' does not set the cursor.\r
+\r
+You could, for example, use this method to output a line of a text editor's buffer.\r
+\r
+p.e.:\r
+\r
+  // page refresh function of a text editor\r
+\r
+  function myEditorRefresh(termref, topline) {\r
+    // termref: reference to Terminal instance\r
+    // topline: index of first line to print\r
+    // lines of text are stored in termref.env.lines\r
+    for (var r=0; r<termref.maxLines; r++) {\r
+      var i = topline + r;\r
+      if (i < termref.env.lines.length) {\r
+        // output stored line\r
+        termref.printRowFromString(r, termref.env.lines[i]);\r
+      }\r
+      else {\r
+        // output <tilde> for empty line\r
+        termref.printRowFromString(r, '~');\r
+      }\r
+    }\r
+    // set cursor to origin\r
+    termref.r = termref.c = 0; // same as termref.cursorSet(0, 0);\r
+  }\r
+\r
+\r
+4.9  Terminal.redraw( <row> )\r
+\r
+Basic function to redraw a terminal row <row> according to screen buffer values.\r
+For hackers only. (e.g.: for a console game, hack screen buffers first and redraw all\r
+changed rows at once.)\r
+\r
+\r
+\r
+\r
+5  Cursor Methods and Editing\r
+\r
+\r
+5.1  Terminal.cursorOn()\r
+\r
+Show the cursor.\r
+\r
+\r
+5.2  Terminal.cursorOff()\r
+\r
+Hide the cursor.\r
+\r
+\r
+5.3  Terminal.cursorSet( <r>, <c> )\r
+\r
+Set the cursor position to row <r> column <c>.\r
+`Terminal.cursorSet()' preserves the cursor's active state (on/off).\r
+\r
+\r
+5.4  Terminal.cursorLeft()\r
+\r
+Move the cursor left. (Movement is restricted to the logical input line.)\r
+`Terminal.cursorLeft()' preserves the cursor's active state (on/off).\r
+\r
+\r
+5.5  Terminal.cursorRight()\r
+\r
+Move the cursor right. (Movement is restricted to the logical input line.)\r
+`Terminal.cursorRight()' preserves the cursor's active state (on/off).\r
+\r
+\r
+5.6  Terminal.backspace()\r
+\r
+Delete the character left from the cursor, if the cursor is not in first position of the\r
+logical input line.\r
+`Terminal.backspace()' preserves the cursor's active state (on/off).\r
+\r
+\r
+5.7  Terminal.fwdDelete()\r
+\r
+Delete the character under the cursor.\r
+`Terminal.fwdDelete()' preserves the cursor's active state (on/off).\r
+\r
+\r
+5.8  Terminal.isPrintable( <key code> [,<unicode page 1 only>] )\r
+\r
+Returns `true' if the character represented by <key code> is printable with the current\r
+settings. An optional second argument <unicode page 1 only> limits the range of valid\r
+values to 255 with the exception of the Euro sign, if the flag `Terminal.printEuro' is set.\r
+(This second flag is used for input methods but not for output methods. So you may only\r
+enter portable characters, but you may print others to the terminals screen.)\r
+\r
+\r
+\r
+\r
+6  Other Methods of the Terminal Object\r
+\r
+6.1  Terminal.prompt()\r
+\r
+Performes the following actions:\r
+\r
+  * advance the cursor to a new line, if the cursor is not at 1st column\r
+  * type the prompt string (as specified in the configuaration object)\r
+  * show the cursor\r
+  * unlock the terminal\r
+\r
+(The value of the prompt string can be accessed and changed in `Terminal.ps'.)\r
+\r
+\r
+6.2  Terminal.reset()\r
+\r
+Resets the terminal to sane values and clears the terminal screen.\r
+\r
+\r
+6.3  Terminal.open()\r
+\r
+Opens the terminal. If this is a fresh instance, the HTML code for the terminal is\r
+generated. On re-entry the terminal's visibility is set to `true'. Initialization tasks\r
+are performed and the optional initHandler called. If no initHandler is specified in the\r
+configuration object, the greeting (configuration or default value) is shown and the user\r
+is prompted for input.\r
+\r
+v.1.01: `Terminal.open()' now checks for the existence of the DHTML element as defined in\r
+        `Terminal.conf.termDiv' and returns success.\r
+\r
+\r
+6.4  Terminal.close()\r
+\r
+Closes the terminal and hides its visibility. An optional exitHandler (specified in the\r
+configuration object) is called, and finally the flag `Terminal.closed' is set to true. So\r
+you can check for existing terminal instances as you would check for a `window' object\r
+created by `window.open()'.\r
+\r
+p.e.:\r
+\r
+  // check for a terminals state\r
+  // let array "term" hold references to terminals\r
+\r
+  if (term[n]) {\r
+    if (term[n].closed) {\r
+      // terminal exists and is closed\r
+      // re-enter via "term[n].open()"\r
+    }\r
+    else {\r
+      // terminal exists and is currently open\r
+    }\r
+  }\r
+  else {\r
+    // no such terminal\r
+    // create it via "term[n] = new Terminal()"\r
+  }\r
+\r
+\r
+6.5  Terminal.focus()\r
+\r
+Set the keyboard focus to this instance of Terminal. (As `window.focus()'.)\r
+\r
+\r
+6.6  Terminal.moveTo( <x>, <y> )\r
+\r
+Move the terminal to position <x>/<y> in px.\r
+(As `window.moveTo()', but inside the HTML page.)\r
+\r
+\r
+6.7  Terminal.resizeTo( <x>, <y> )\r
+\r
+Resize the terminal to dimensions <x> cols and <y> rows.\r
+<x> must be at least 4, <y> at least 2.\r
+`Terminal.resizeTo()' resets `Terminal.conf.rows', `Terminal.conf.cols',\r
+`Terminal.maxLines', and `Terminal.maxCols' to <y> and <x>, but leaves the instance' state\r
+else unchanged. Clears the terminal's screen and returns success.\r
+\r
+(A bit like `window.resizeTo()', but with rows and cols instead of px.)\r
+\r
+\r
+6.8  Terminal.getDimensions()\r
+\r
+Returns an object with properties "width" and "height" with numeric values for the\r
+terminal's outer dimensions in px. Values are zero (0) if the element is not present or\r
+if the method fails otherwise.\r
+\r
+\r
+6.9  Terminal.rebuild()\r
+\r
+Rebuilds the Terminal object's GUI preserving its state and content.\r
+Use this to change the color theme on the fly.\r
+\r
+p.e.:\r
+\r
+   // change color settings on the fly\r
+   // here: set bgColor to white and font style to "termWhite"\r
+   // method rebuild() updates the GUI without side effects\r
+\r
+   term.conf.bgColor = '#ffffff';\r
+   term.conf.fontClass = 'termWhite';\r
+   term.rebuild();\r
+\r
+\r
+\r
+\r
+7   Global Static Methods (TermGlobals)\r
+\r
+\r
+7.1  TermGlobals.setFocus( <termref> )\r
+\r
+Sets the keyboard focus to the instance referenced by <termref>.\r
+The focus is controlled by `TermGlobals.activeTerm' which may be accessed directly.\r
+See also: `Terminal.focus()'\r
+\r
+\r
+7.2  TermGlobals.keylock (Global Locking Flag)\r
+\r
+The global flag `TermGlobals.keylock' allows temporary keyboard locking without any\r
+other change of state. Use this to free the keyboard for any other resources.\r
+(added in v.1.03)\r
+\r
+\r
+7.3  TermGlobals Text Methods\r
+\r
+There is a small set of methods for common terminal related string tasks:\r
+\r
+\r
+7.3.1  TermGlobals.normalize( <n>, <fieldlength> )\r
+\r
+Converts a number to a string, which is filled at its left with zeros ("0") to the total\r
+length of <filedlength>. (e.g.: "TermGlobals.normalize(1, 2)" => "01")\r
+\r
+\r
+7.3.2  TermGlobals.fillLeft( <value>, <fieldlength> )\r
+\r
+Converts a value to a string and fills it to the left with blanks to <fieldlength>.\r
+\r
+\r
+7.3.3  TermGlobals.center( <text>, <length> )\r
+\r
+Adds blanks at the left of the string <text> until the text would be centered at a line\r
+of length <length>. (No blanks are added to the the right.)\r
+\r
+\r
+7.3.4  TermGlobals.stringReplace( <string1>, <string2>, <text> )\r
+\r
+Replaces all occurences of the string <string1> in <text> with <string2>.\r
+This is just a tiny work around for browsers with no support of RegExp.\r
+\r
+\r
+\r
+\r
+8   Localization\r
+\r
+The strings and key-codes used by the more utility of `Terminal.write()' are the only\r
+properties of "termlib.js" that may need localization. These properties are defined in\r
+`TermGlobals'. You may override them as needed:\r
+\r
+PROPERTY                                      STANDARD VALUE                 COMMENT\r
+\r
+TermGlobals.lcMorePrompt1                                    ' -- MORE -- '  1st string\r
+TermGlobals.lcMorePromtp1Style                                            1  reverse\r
+TermGlobals.lcMorePrompt2       ' (Type: space to continue, \'q\' to quit)'  appended string\r
+TermGlobals.lcMorePrompt2Style                                            0  plain\r
+TermGlobals.lcMoreKeyAbort                                              113  (key-code: q)\r
+TermGlobals.lcMoreKeyContinue                                            32  (key-code <SPACE>)\r
+\r
+\r
+As "TermGlobals.lcMorePrompt2" is appended to "TermGlobals.lcMorePrompt1" make sure that\r
+the length of the combined strings does not exceed `Terminal.conf.cols'.\r
+\r
+\r
+\r
+\r
+9   Cross Browser Functions\r
+\r
+For DHTML rendering some methods - as needed by the Terminal library - are provided.\r
+These may also be accessed for other purposes.\r
+\r
+\r
+9.1  TermGlobals.writeElement( <element id>, <text> [,<NS4 parent document>] )\r
+\r
+Writes <text> to the DHTML element with id/name <element id>. \r
+<NS4 parent document> is used for NS4 only and specifies an optional reference to a parent\r
+document (default `window.document').\r
+\r
+9.2  TermGlobals.setElementXY( <element id>, <x>, <y> )\r
+\r
+Sets the DHTML element with id/name <element id> to position <x>/<y>.\r
+For NS4 works only with children of the top document (window.document).\r
+\r
+\r
+9.3  TermGlobals.setVisible( <element id>, <value> )\r
+\r
+If <value> evaluates to `true' show DHTML element with id/name <element id> else hide it.\r
+For NS4 works only with children of the top document (window.document).\r
+\r
+\r
+9.4  Custom Fixes for Missing String Methods\r
+\r
+Although `String.fromCharCode' and `String.prototype.charCodeAt' are defined by ECMA-262-2\r
+specifications, a few number of browsers lack them in their JavaScript implementation. At\r
+compile time custom methods are installed to fix this. Please note that they work only\r
+with ASCII characters and values in the range of [0x20-0xff].\r
+\r
+\r
+9.5  TermGlobals.setDisplay( <element id>, <value> )\r
+\r
+Sets the style.display property of the element with id/name <element id> to the given\r
+<value>. (added with v. 1.06)\r
+\r
+\r
+\r
+\r
+10   Architecture, Internals\r
+\r
+10.1  Global Entities\r
+\r
+The library is designed to leave only a small foot print in the namespace while providing\r
+suitable usability:\r
+\r
+  Globals defined in this library:\r
+\r
+    Terminal           (Terminal object, `new' constructor and prototype methods)\r
+    TerminalDefaults   (default configuration, static object)\r
+    termDefaultHandler (default command line handler, static function)\r
+    TermGlobals        (common vars and code for all instances, static object and methods)\r
+    termKey            (named mappings for special keys, static object)\r
+    termDomKeyRef      (special key mapping for DOM key constants, static object)\r
+\r
+\r
+  Globals defined for fixing String methods, if missing\r
+  (String.fromCharCode, String.prototype.charCodeAt):\r
+\r
+    termString_keyref, termString_keycoderef, termString_makeKeyref\r
+\r
+  \r
+  Required CSS classes for font definitions: ".term", ".termReverse".\r
+\r
+\r
+\r
+10.2  I/O Architecture\r
+\r
+The Terminal object renders keyboard input from keyCodes to a line buffer and/or to a\r
+special keyCode buffer. In normal input mode printable input is echoed to the screen\r
+buffers. Special characters like <LEFT>, <RIGHT>, <BACKSPACE> are processed for command\r
+line editing by the internal key-handler `TermGlobals.keyHandler' and act directly on the\r
+screen buffers. On <CR> or <ENTER> the start and end positions of the current line are\r
+evaluated (terminated by ASCII 0x01 at the beginning which separates the prompt from the\r
+user input, and any value less than ASCII 0x20 (<SPACE>) at the right end). Then the\r
+character representation for the buffer values in this range are evaluated and\r
+concatenated to a string stored in `Terminal.lineBuffer'. As this involves some\r
+ASCII-to-String-transformations, the range of valid printable input characters is limited\r
+to the first page of unicode characters (0x0020-0x00ff).\r
+\r
+There are two screen buffers for output, one for character codes (ASCII values) and one\r
+for style codes. Style codes represent combination of styles as a bitvector (see\r
+`Terminal.type' for bit values.) The method `Terminal.redraw(<row>)' finally renders the\r
+buffers values to a string of HTML code, which is written to the HTML entity holding the\r
+according terminal row. The character buffer is a 2 dimensional array\r
+`Terminal.charBuf[<row>][<col>]' with ranges for <row> from 0 to less than\r
+`Terminal.conf.rows' and for <col> from 0 to less than `Terminal.conf.cols'. The style\r
+buffer is a 2 dimensional array `Terminal.styleBuf[<row>][<col>]' with according ranges.\r
+\r
+So every single character is represented by a ASCII code in `Terminal.charBuf' and a\r
+style-vector in `Terminal.styleBuf'. The range of printable character codes is unlimitted\r
+but should be kept to the first page of unicode characters (0x0020-0x00ff) for\r
+compatibility purpose. (c.f. 8.4)\r
+\r
+Keyboard input is first handled on the `KEYDOWN' event by the handler `TermGlobals.keyFix'\r
+to remap the keyCodes of cursor keys to consistent values. (To make them distinctable from\r
+any other possibly printable values, the values of POSIX <IS4> to <IS1> where chosen.)\r
+The mapping of the cursor keys is stored in the properties LEFT, RIGHT, UP, and DOWN of\r
+the global static object `termKey'.\r
+\r
+The main keyboard handler `TermGlobals.keyHandler' (invoked on `KEYPRESS' or by\r
+`TermGlobals.keyFix') does some final mapping first. Then the input is evaluated as\r
+controlled by the flags `Terminal.rawMode' and `Terminal.charMode' with precedence of the\r
+latter. In dependancy of the mode defined and the handlers currently defined, the input\r
+either is ignored, or is internally processed for command line editing, or one of the\r
+handlers is called.\r
+\r
+In the case of the simultanous presecence of two instances of Terminal, the keyboard focus\r
+is controlled via a reference stored in `TermGlobals.activeTerm'. This reference is also\r
+used to evaluate the `this'-context of the key handlers which are methods of the static\r
+Object `TermGlobals'.\r
+\r
+A terminal's screen consists of a HTML-table element residing in the HTML/CSS division\r
+spcified in `Terminal.conf.termDiv'. Any output is handled on a per row bases. The\r
+individual rows are either nested sub-divisions of the main divisions (used for NS4 or\r
+browsers not compatible to the "Gecko" engine) or the indiviual table data elements (<TD>)\r
+of the terminal's inner table (used for browsers employing the "Gecko" engine).\r
+(This implementation was chosen for rendering speed and in order to minimize any screen\r
+flicker.) Any output or change of state in a raw results in the inner HTML contents of a\r
+row's HTML element to be rewritten. Please note that as a result of this a blinking cursor\r
+may cause a flicker in the line containing the cursor's position while displayed by a\r
+browser, which employs the "Gecko" engine.\r
+\r
+\r
+\r
+10.3  Compatibility\r
+\r
+Standard web browsers with a JavaScript implementation compliant to ECMA-262 2nd edition\r
+[ECMA262-2] and support for the anonymous array and object constructs and the anonymous\r
+function construct in the form of "myfunc = function(x) {}" (c.f. ECMA-262 3rd edion\r
+[ECMA262-3] for details). This comprises almost all current browsers but Konquerer (khtml)\r
+and versions of Apple Safari for Mac OS 10.0-10.28 (Safari < 1.1) which lack support for\r
+keyboard events.\r
+\r
+To provide a maximum of compatibilty the extend of language keywords used was kept to a\r
+minimum and does not exceed the lexical conventions of ECMA-262-2. Especially there is no\r
+use of the `switch' statement or the `RegExp' method of the global object. Also the use of\r
+advanced Array methods like `push', `shift', `splice' was avoided.\r
+\r
+\r
+\r
+\r
+11   History\r
+\r
+This library evolved from the terminal script "TermApp" ((c) N. Landsteiner 2003) and is\r
+in its current form a down scaled spinn-off of the "JS/UIX" project [JS/UIX] (evolution\r
+"JS/UIX v0.5"). c.f.: <http://www.masswerk.at/jsuix>\r
+\r
+v 1.01: added Terminal.prototype.resizeTo(x,y)\r
+        added Terminal.conf.fontClass (=> configureable class name)\r
+        Terminal.prototype.open() now checks for element conf.termDiv in advance\r
+          and returns success.\r
+\r
+v 1.02: added support for <TAB> and Euro sign\r
+          Terminal.conf.printTab\r
+          Terminal.conf.printEuro\r
+        and method Terminal.prototype.isPrintable(keycode)\r
+        added support for getopt to sample parser ("parser_sample.html")\r
+\r
+\r
+v 1.03: added global keyboard locking (TermGlobals.keylock)\r
+        modified Terminal.prototype.redraw for speed (use of locals)\r
+\r
+\r
+v 1.04: modified the key handler to fix a bug with MSIE5/Mac\r
+        fixed a bug in TermGlobals.setVisible with older MSIE-alike browsers without\r
+        DOM support.\r
+        moved the script of the sample parser to an individual document\r
+        => "termlib_parser.js" (HTML document is "parser_sample.html" as before)\r
+\r
+v 1.05: added config flag historyUnique.\r
+\r
+v 1.06: fixed CTRl+ALT (Windows alt gr) isn't CTRL any more\r
+        -> better support for international keyboards with MSIE/Win.\r
+        fixed double backspace bug for Safari;\r
+        added TermGlobals.setDisplay for setting style.display props\r
+        termlib.js now outputs lower case html (xhtml compatibility)\r
+        (date: 12'2006)\r
+\r
+v 1.07: added method Terminal.rebuild() to rebuild the GUI with new color settings.\r
+        (date: 01'2007)\r
+\r
+\r
+\r
+\r
+12  Example for a Command Line Parser\r
+\r
+  // parser example, splits command line to args with quoting and escape\r
+  // for use as `Terminal.handler'\r
+  \r
+  function commandHandler() {\r
+    this.newLine();\r
+    var argv = [''];     // arguments vector\r
+    var argQL = [''];    // quoting level\r
+    var argc = 0;        // arguments cursor\r
+    var escape = false ; // escape flag\r
+    for (var i=0; i<this.lineBuffer.length; i++) {\r
+      var ch= this.lineBuffer.charAt(i);\r
+      if (escape) {\r
+        argv[argc] += ch;\r
+        escape = false;\r
+      }\r
+      else if ((ch == '"') || (ch == "'") || (ch == "`")) {\r
+        if (argQL[argc]) {\r
+          if (argQL[argc] == ch) {\r
+            argc ++;\r
+            argv[argc] = argQL[argc] = '';\r
+          }\r
+          else {\r
+            argv[argc] += ch;\r
+          }\r
+        }\r
+        else {\r
+          if (argv[argc] != '') {\r
+            argc ++;\r
+            argv[argc] = '';\r
+            argQL[argc] = ch;\r
+          }\r
+          else {\r
+            argQL[argc] = ch;\r
+          }\r
+        }\r
+      }\r
+      else if ((ch == ' ') || (ch == '\t')) {\r
+        if (argQL[argc]) {\r
+          argv[argc] += ch;\r
+        }\r
+        else if (argv[argc] != '') {\r
+          argc++;\r
+          argv[argc] = argQL[argc] = '';\r
+        }\r
+      }\r
+      else if (ch == '\\') {\r
+        escape = true;\r
+      }\r
+      else {\r
+        argv[argc] += ch;\r
+      }\r
+    }\r
+    if ((argv[argc] == '') && (!argQL[argc])) {\r
+      argv.length--;\r
+      argQL.length--;\r
+    }\r
+    if (argv.length == 0) {\r
+      // no commmand line input\r
+    }\r
+    else if (argQL[0]) {\r
+      // first argument quoted -> error\r
+      this.write("Error: first argument quoted by "+argQL[0]);\r
+    }\r
+    else {\r
+      argc = 0;\r
+      var cmd = argv[argc++];\r
+      /*\r
+        parse commands\r
+        1st argument is argv[argc]\r
+        arguments' quoting levels in argQL[argc] are of (<empty> | ' | " | `)\r
+      */\r
+      if (cmd == 'help') {\r
+        this.write(helpPage);\r
+      }\r
+      else if (cmd == 'clear') {\r
+        this.clear();\r
+      }\r
+      else if (cmd == 'exit') {\r
+        this.close();\r
+        return;\r
+      }\r
+      else {\r
+        // for test purpose just output argv as list\r
+        // assemple a string of style-escaped lines and output it in more-mode\r
+        s='   ARG  QL  VALUE%n';\r
+        for (var i=0; i<argv.length; i++) {\r
+          s += TermGlobals.stringReplace('%', '%%',\r
+                 TermGlobals.fillLeft(i, 6) +\r
+                 TermGlobals.fillLeft((argQL[i])? argQL[i]:'-', 4) +\r
+                 '  "' + argv[i] + '"'\r
+            ) + '%n';\r
+        }\r
+        this.write(s, 1);\r
+        return;\r
+      }\r
+    }\r
+    this.prompt();\r
+  }\r
+\r
+\r
+The file "parser_sample.html" features a stand-alone parser ("termlib_parser.js") very\r
+much like this. You are free to use it according to the termlib-license (see sect. 13).\r
+It provides configurable values for quotes and esape characters and imports the parsed\r
+argument list into a Terminal instance's namespace. ("parser_sample.html" and\r
+"termlib_parser.js" should accompany this file.)\r
+\r
+\r
+\r
+\r
+13   License\r
+\r
+This JavaScript-library is free for private and academic use.\r
+Please include a readable copyright statement and a backlink to <http://www.masswerk.at>\r
+in the web page. The library should always be accompanied by the 'readme.txt' and the\r
+sample HTML-documents.\r
+\r
+The term "private use" includes any personal or non-commercial use, which is not related\r
+to commercial activites, but excludes intranet, extranet and/or public net applications\r
+that are related to any kind of commercial or profit oriented activity.\r
+\r
+For commercial use see <http://www.masswerk.at> for contact information.\r
+\r
+Any changes to the library should be commented and be documented in the readme-file.\r
+Any changes must be reflected in the `Terminal.version' string as\r
+"Version.Subversion (compatibility)".\r
+\r
+\r
+\r
+\r
+14   Disclaimer\r
+\r
+This software is distributed AS IS and in the hope that it will be useful, but WITHOUT ANY\r
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+PURPOSE. The entire risk as to the quality and performance of the product is borne by the\r
+user. No use of the product is authorized hereunder except under this disclaimer.\r
+\r
+\r
+\r
+\r
+15   References\r
+\r
+[ECMA262-2] "ECMAScript Language Specification" Standard ECMA-262 2nd Edition\r
+            August 1998 (ISO/IEC 16262 - April 1998)\r
+\r
+[ECMA262-3] "ECMAScript Language Specification" Standard ECMA-262 3rd Edition Final\r
+            24 March 2000\r
+\r
+[JS/UIX]     JS/UIX - JavaScript Uniplexed Interface eXtension\r
+             <http://www.masswerk.at/jsuix>\r
+\r
+\r
+\r
+\r
+\r
+Norbert Landsteiner / Vienna, August 2005\r
+mass:werk - media environments\r
+<http://www.masswerk.at>\r
+See web site for contact information.\r
diff --git a/extra/webapps/fjsc/resources/termlib/term_styles.css b/extra/webapps/fjsc/resources/termlib/term_styles.css
new file mode 100644 (file)
index 0000000..4971709
--- /dev/null
@@ -0,0 +1,11 @@
+.term {\r
+       font-family: courier,fixed,swiss,sans-serif;\r
+       font-size: 12px;\r
+       color: #33d011;\r
+       background: none;\r
+}\r
+\r
+.termReverse {\r
+       color: #111111;\r
+       background: #33d011;\r
+}\r
diff --git a/extra/webapps/fjsc/resources/termlib/termlib.js b/extra/webapps/fjsc/resources/termlib/termlib.js
new file mode 100644 (file)
index 0000000..195e11f
--- /dev/null
@@ -0,0 +1,1633 @@
+/*\r
+  termlib.js - JS-WebTerminal Object v1.07\r
+\r
+  (c) Norbert Landsteiner 2003-2005\r
+  mass:werk - media environments\r
+  <http://www.masswerk.at>\r
+\r
+  Creates [multiple] Terminal instances.\r
+\r
+  Synopsis:\r
+\r
+  myTerminal = new Terminal(<config object>);\r
+  myTerminal.open();\r
+\r
+  <config object> overrides any values of object `TerminalDefaults'.\r
+  individual values of `id' must be supplied for multiple terminals.\r
+  `handler' specifies a function to be called for input handling.\r
+  (see `Terminal.prototype.termDefaultHandler()' and documentation.)\r
+\r
+  globals defined in this library:\r
+       Terminal           (Terminal object)\r
+    TerminalDefaults   (default configuration)\r
+    termDefaultHandler (default command line handler)\r
+    TermGlobals        (common vars and code for all instances)\r
+    termKey            (named mappings for special keys)\r
+    termDomKeyRef      (special key mapping for DOM constants)\r
+\r
+  globals defined for fixing String methods, if missing\r
+  (String.fromCharCode, String.prototype.charCodeAt):\r
+    termString_keyref, termString_keycoderef, termString_makeKeyref\r
+\r
+  required CSS classes for font definitions: ".term", ".termReverse".\r
+\r
+  Compatibilty:\r
+  Standard web browsers with a JavaScript implementation compliant to\r
+  ECMA-262 2nd edition and support for the anonymous array and object\r
+  constructs and the anonymous function construct in the form of\r
+  "myfunc=function(x) {}" (c.f. ECMA-262 3rd edion for details).\r
+  This comprises almost all current browsers but Konquerer (khtml) and\r
+  versions of Apple Safari for Mac OS 10.0-10.28 (Safari 1.0) which\r
+  lack support for keyboard events.\r
+\r
+  License:\r
+  This JavaScript-library is free for private and academic use.\r
+  Please include a readable copyright statement and a backlink to\r
+  <http://www.masswerk.at> in the web page.\r
+  The library should always be accompanied by the 'readme.txt' and the\r
+  sample HTML-documents.\r
+  \r
+  The term "private use" includes any personal or non-commercial use, which\r
+  is not related to commercial activites, but excludes intranet, extranet\r
+  and/or public net applications that are related to any kind of commercial\r
+  or profit oriented activity.\r
+\r
+  For commercial use see <http://www.masswerk.at> for contact information.\r
+  \r
+  Any changes should be commented and must be reflected in `Terminal.version'\r
+  in the format: "Version.Subversion (compatibility)".\r
+\r
+  Disclaimer:\r
+  This software is distributed AS IS and in the hope that it will be useful,\r
+  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The entire risk as to\r
+  the quality and performance of the product is borne by the user. No use of\r
+  the product is authorized hereunder except under this disclaimer.\r
+\r
+  ### The sections above must not be removed. ###\r
+  \r
+  version 1.01: added Terminal.prototype.resizeTo(x,y)\r
+                added Terminal.conf.fontClass (=> configureable class name)\r
+                Terminal.prototype.open() now checks for element conf.termDiv\r
+                in advance and returns success.\r
+\r
+  version 1.02: added support for <TAB> and Euro sign\r
+                (Terminal.conf.printTab, Terminal.conf.printEuro)\r
+                and a method to evaluate printable chars:\r
+                Terminal.prototype.isPrintable(keycode)\r
+\r
+  version 1.03: added global keyboard locking (TermGlobals.keylock)\r
+                modified Terminal.prototype.redraw for speed (use of locals)\r
+\r
+  version 1.04: modified the key handler to fix a bug with MSIE5/Mac\r
+                fixed a bug in TermGlobals.setVisible with older MSIE-alike\r
+                browsers without DOM support.\r
+\r
+  version 1.05: added config flag historyUnique.\r
\r
+  version 1.06: fixed CTRl+ALT (Windows alt gr) isn't CTRL any more\r
+                fixed double backspace bug for Safari;\r
+                added TermGlobals.setDisplay for setting style.display props\r
+                termlib.js now outputs lower case html (xhtml compatibility)\r
+\r
+  version 1.07: added method rebuild() to rebuild with new color settings.\r
+\r
+*/\r
+\r
+var TerminalDefaults = {\r
+       // dimensions\r
+       cols:80,\r
+       rows:24,\r
+       // appearance\r
+       x:100,\r
+       y:100,\r
+       termDiv:'termDiv',\r
+       bgColor:'#181818',\r
+       frameColor:'#555555',\r
+       frameWidth:1,\r
+       rowHeight:15,\r
+       blinkDelay:500,\r
+       // css class\r
+       fontClass:'term',\r
+       // initial cursor mode\r
+       crsrBlinkMode:false,\r
+       crsrBlockMode:true,\r
+       // key mapping\r
+       DELisBS:false,\r
+       printTab:true,\r
+       printEuro:true,\r
+       catchCtrlH:true,\r
+       closeOnESC:true,\r
+       // prevent consecutive history doublets\r
+       historyUnique:false,\r
+       // optional id\r
+       id:0,\r
+       // strings\r
+       ps:'>',\r
+       greeting:'%+r Terminal ready. %-r',\r
+       // handlers\r
+       handler:termDefaultHandler,\r
+       ctrlHandler:null,\r
+       initHandler:null,\r
+       exitHandler:null\r
+}\r
+\r
+var Terminal = function(conf) {\r
+       if (typeof conf != 'object') conf=new Object();\r
+       else {\r
+               for (var i in TerminalDefaults) {\r
+                       if (typeof conf[i] == 'undefined') conf[i]=TerminalDefaults[i];\r
+               }\r
+       }\r
+       this.conf=conf;\r
+       this.version='1.07 (original)';\r
+       this.isSafari= (navigator.userAgent.indexOf('Safari')>=0)? true:false;\r
+       this.setInitValues();\r
+}\r
+\r
+Terminal.prototype.setInitValues=function() {\r
+       this.id=this.conf.id;\r
+       this.maxLines=this.conf.rows;\r
+       this.maxCols=this.conf.cols;\r
+       this.termDiv=this.conf.termDiv;\r
+       this.crsrBlinkMode=this.conf.crsrBlinkMode;\r
+       this.crsrBlockMode=this.conf.crsrBlockMode;\r
+       this.blinkDelay=this.conf.blinkDelay;\r
+       this.DELisBS=this.conf.DELisBS;\r
+       this.printTab=this.conf.printTab;\r
+       this.printEuro=this.conf.printEuro;\r
+       this.catchCtrlH=this.conf.catchCtrlH;\r
+       this.closeOnESC=this.conf.closeOnESC;\r
+       this.historyUnique=this.conf.historyUnique;\r
+       this.ps=this.conf.ps;\r
+       this.closed=false;\r
+       this.r;\r
+       this.c;\r
+       this.charBuf=new Array();\r
+       this.styleBuf=new Array();\r
+       this.scrollBuf=null;\r
+       this.blinkBuffer=0;\r
+       this.blinkTimer;\r
+       this.cursoractive=false;\r
+       this.lock=true;\r
+       this.insert=false;\r
+       this.charMode=false;\r
+       this.rawMode=false;\r
+       this.lineBuffer='';\r
+       this.inputChar=0;\r
+       this.lastLine='';\r
+       this.guiCounter=0;\r
+       this.history=new Array();\r
+       this.histPtr=0;\r
+       this.env=new Object();\r
+       this.ns4ParentDoc=null;\r
+       this.handler=this.conf.handler;\r
+       this.ctrlHandler=this.conf.ctrlHandler;\r
+       this.initHandler=this.conf.initHandler;\r
+       this.exitHandler=this.conf.exitHandler;\r
+}\r
+\r
+function termDefaultHandler() {\r
+       this.newLine();\r
+       if (this.lineBuffer != '') {\r
+               this.type('You typed: '+this.lineBuffer);\r
+               this.newLine();\r
+       }\r
+       this.prompt();\r
+}\r
+\r
+Terminal.prototype.open=function() {\r
+       if (this.termDivReady()) {\r
+               if (!this.closed) this._makeTerm();\r
+               this.init();\r
+               return true;\r
+       }\r
+       else return false;\r
+}\r
+\r
+Terminal.prototype.close=function() {\r
+       this.lock=true;\r
+       this.cursorOff();\r
+       if (this.exitHandler) this.exitHandler();\r
+       TermGlobals.setVisible(this.termDiv,0);\r
+       this.closed=true;\r
+}\r
+\r
+Terminal.prototype.init=function() {\r
+       // wait for gui\r
+       if (this.guiReady()) {\r
+               this.guiCounter=0;\r
+               // clean up at re-entry\r
+               if (this.closed) {\r
+                       this.setInitValues();\r
+               }\r
+               this.clear();\r
+               TermGlobals.setVisible(this.termDiv,1);\r
+               TermGlobals.enableKeyboard(this);\r
+               if (this.initHandler) {\r
+                       this.initHandler();\r
+               }\r
+               else {\r
+                       this.write(this.conf.greeting);\r
+                       this.newLine();\r
+                       this.prompt();\r
+               }\r
+       }\r
+       else {\r
+               this.guiCounter++;\r
+               if (this.guiCounter>18000) {\r
+                       if (confirm('Terminal:\nYour browser hasn\'t responded for more than 2 minutes.\nRetry?')) this.guiCounter=0\r
+                       else return;\r
+               };\r
+               TermGlobals.termToInitialze=this;\r
+               window.setTimeout('TermGlobals.termToInitialze.init()',200);\r
+       }\r
+}\r
+\r
+Terminal.prototype.getRowArray=function(l,v) {\r
+       var a=new Array();\r
+       for (var i=0; i<l; i++) a[i]=v;\r
+       return a;\r
+}\r
+\r
+Terminal.prototype.type=function(text,style) {\r
+       for (var i=0; i<text.length; i++) {\r
+               var ch=text.charCodeAt(i);\r
+               if (!this.isPrintable(ch)) ch=94;\r
+               this.charBuf[this.r][this.c]=ch;\r
+               this.styleBuf[this.r][this.c]=(style)? style:0;\r
+               var last_r=this.r;\r
+               this._incCol();\r
+               if (this.r!=last_r) this.redraw(last_r);\r
+       }\r
+       this.redraw(this.r)\r
+}\r
+\r
+Terminal.prototype.write=function(text,usemore) {\r
+       // write to scroll buffer with markup\r
+       // new line = '%n' prepare any strings or arrys first\r
+       if (typeof text != 'object') {\r
+               if (typeof text!='string') text=''+text;\r
+               if (text.indexOf('\n')>=0) {\r
+                       var ta=text.split('\n');\r
+                       text=ta.join('%n');\r
+               }\r
+       }\r
+       else {\r
+               if (text.join) text=text.join('%n')\r
+               else text=''+text;\r
+       }\r
+       this._sbInit(usemore);\r
+       var chunks=text.split('%');\r
+       var esc=(text.charAt(0)!='%');\r
+       var style=0;\r
+       for (var i=0; i<chunks.length; i++) {\r
+               if (esc) {\r
+                       if (chunks[i].length>0) this._sbType(chunks[i],style)\r
+                       else if (i>0) this._sbType('%', style);\r
+                       esc=false;\r
+               }\r
+               else {\r
+                       var func=chunks[i].charAt(0);\r
+                       if ((chunks[i].length==0) && (i>0)) {\r
+                               this._sbType("%",style);\r
+                               esc=true;\r
+                       }\r
+                       else if (func=='n') {\r
+                               this._sbNewLine();\r
+                               if (chunks[i].length>1) this._sbType(chunks[i].substring(1),style);\r
+                       }\r
+                       else if (func=='+') {\r
+                               var opt=chunks[i].charAt(1);\r
+                               opt=opt.toLowerCase();\r
+                               if (opt=='p') style=0\r
+                               else if (opt=='r') style|=1\r
+                               else if (opt=='u') style|=2\r
+                               else if (opt=='i') style|=4\r
+                               else if (opt=='s') style|=8;\r
+                               if (chunks[i].length>2) this._sbType(chunks[i].substring(2),style);\r
+                       }\r
+                       else if (func=='-') {\r
+                               var opt=chunks[i].charAt(1);\r
+                               opt=opt.toLowerCase();\r
+                               if (opt=='p') style|=0\r
+                               else if (opt=='r') style&=~1\r
+                               else if (opt=='u') style&=~2\r
+                               else if (opt=='i') style&=~4\r
+                               else if (opt=='s') style&=~8;\r
+                               if (chunks[i].length>2) this._sbType(chunks[i].substring(2),style);\r
+                       }\r
+                       else if ((chunks[i].length>1) && (chunks[i].charAt(0)=='C') && (chunks[i].charAt(1)=='S')) {\r
+                               this.clear();\r
+                               this._sbInit();\r
+                               if (chunks[i].length>2) this._sbType(chunks[i].substring(2),style);\r
+                       }\r
+                       else {\r
+                               if (chunks[i].length>0) this._sbType(chunks[i],style);\r
+                       }\r
+               }\r
+       }\r
+       this._sbOut();\r
+}\r
+\r
+Terminal.prototype._sbType=function(text,style) {\r
+       // type to scroll buffer\r
+       var sb=this.scrollBuf;\r
+       for (var i=0; i<text.length; i++) {\r
+               var ch=text.charCodeAt(i);\r
+               if (!this.isPrintable(ch)) ch=94;\r
+               sb.lines[sb.r][sb.c]=ch;\r
+               sb.styles[sb.r][sb.c]=(style)? style:0;\r
+               sb.c++;\r
+               if (sb.c>=this.maxCols) this._sbNewLine();\r
+       }\r
+}\r
+\r
+Terminal.prototype._sbNewLine=function() {\r
+       var sb=this.scrollBuf;\r
+       sb.r++;\r
+       sb.c=0;\r
+       sb.lines[sb.r]=this.getRowArray(this.conf.cols,0);\r
+       sb.styles[sb.r]=this.getRowArray(this.conf.cols,0);\r
+}\r
+\r
+\r
+Terminal.prototype._sbInit=function(usemore) {\r
+       var sb=this.scrollBuf=new Object();\r
+       var sbl=sb.lines=new Array();\r
+       var sbs=sb.styles=new Array();\r
+       sb.more=usemore;\r
+       sb.line=0;\r
+       sb.status=0;\r
+       sb.r=0;\r
+       sb.c=this.c;\r
+       sbl[0]=this.getRowArray(this.conf.cols,0);\r
+       sbs[0]=this.getRowArray(this.conf.cols,0);\r
+       for (var i=0; i<this.c; i++) {\r
+               sbl[0][i]=this.charBuf[this.r][i];\r
+               sbs[0][i]=this.styleBuf[this.r][i];\r
+       }\r
+}\r
+\r
+Terminal.prototype._sbOut=function() {\r
+       var sb=this.scrollBuf;\r
+       var sbl=sb.lines;\r
+       var sbs=sb.styles;\r
+       var tcb=this.charBuf;\r
+       var tsb=this.styleBuf;\r
+       var ml=this.maxLines;\r
+       var buflen=sbl.length;\r
+       if (sb.more) {\r
+               if (sb.status) {\r
+                       if (this.inputChar==TermGlobals.lcMoreKeyAbort) {\r
+                               this.r=ml-1;\r
+                               this.c=0;\r
+                               tcb[this.r]=this.getRowArray(this.maxLines,0);\r
+                               tsb[this.r]=this.getRowArray(this.maxLines,0);\r
+                               this.redraw(this.r);\r
+                               this.handler=sb.handler;\r
+                               this.charMode=false;\r
+                               this.inputChar=0;\r
+                               this.scrollBuf=null;\r
+                               this.prompt();\r
+                               return;\r
+                       }\r
+                       else if (this.inputChar==TermGlobals.lcMoreKeyContinue) {\r
+                               this.clear();\r
+                       }\r
+                       else {\r
+                               return;\r
+                       }\r
+               }\r
+               else {\r
+                       if (this.r>=ml-1) this.clear();\r
+               }\r
+       }\r
+       if (this.r+buflen-sb.line<=ml) {\r
+               for (var i=sb.line; i<buflen; i++) {\r
+                       var r=this.r+i-sb.line;\r
+                       tcb[r]=sbl[i];\r
+                       tsb[r]=sbs[i];\r
+                       this.redraw(r);\r
+               }\r
+               this.r+=sb.r-sb.line;\r
+               this.c=sb.c;\r
+               if (sb.more) {\r
+                       if (sb.status) this.handler=sb.handler;\r
+                       this.charMode=false;\r
+                       this.inputChar=0;\r
+                       this.scrollBuf=null;\r
+                       this.prompt();\r
+                       return;\r
+               }\r
+       }\r
+       else if (sb.more) {\r
+               ml--;\r
+               if (sb.status==0) {\r
+                       sb.handler=this.handler;\r
+                       this.handler=this._sbOut;\r
+                       this.charMode=true;\r
+                       sb.status=1;\r
+               }\r
+               if (this.r) {\r
+                       var ofs=ml-this.r;\r
+                       for (var i=sb.line; i<ofs; i++) {\r
+                               var r=this.r+i-sb.line;\r
+                               tcb[r]=sbl[i];\r
+                               tsb[r]=sbs[i];\r
+                               this.redraw(r);\r
+                       }\r
+               }\r
+               else {\r
+                       var ofs=sb.line+ml;\r
+                       for (var i=sb.line; i<ofs; i++) {\r
+                               var r=this.r+i-sb.line;\r
+                               tcb[r]=sbl[i];\r
+                               tsb[r]=sbs[i];\r
+                               this.redraw(r);\r
+                       }\r
+               }\r
+               sb.line=ofs;\r
+               this.r=ml;\r
+               this.c=0;\r
+               this.type(TermGlobals.lcMorePrompt1, TermGlobals.lcMorePromtp1Style);\r
+               this.type(TermGlobals.lcMorePrompt2, TermGlobals.lcMorePrompt2Style);\r
+               this.lock=false;\r
+               return;\r
+       }\r
+       else if (buflen>=ml) {\r
+               var ofs=buflen-ml;\r
+               for (var i=0; i<ml; i++) {\r
+                       var r=ofs+i;\r
+                       tcb[i]=sbl[r];\r
+                       tsb[i]=sbs[r];\r
+                       this.redraw(i);\r
+               }\r
+               this.r=ml-1;\r
+               this.c=sb.c;\r
+       }\r
+       else {\r
+               var dr=ml-buflen;\r
+               var ofs=this.r-dr;\r
+               for (var i=0; i<dr; i++) {\r
+                       var r=ofs+i;\r
+                       for (var c=0; c<this.maxCols; c++) {\r
+                               tcb[i][c]=tcb[r][c];\r
+                               tsb[i][c]=tsb[r][c];\r
+                       }\r
+                       this.redraw(i);\r
+               }\r
+               for (var i=0; i<buflen; i++) {\r
+                       var r=dr+i;\r
+                       tcb[r]=sbl[i];\r
+                       tsb[r]=sbs[i];\r
+                       this.redraw(r);\r
+               }\r
+               this.r=ml-1;\r
+               this.c=sb.c;\r
+       }\r
+       this.scrollBuf=null;\r
+}\r
+\r
+// basic console output\r
+\r
+Terminal.prototype.typeAt=function(r,c,text,style) {\r
+       var tr1=this.r;\r
+       var tc1=this.c;\r
+       this.cursorSet(r,c);\r
+       for (var i=0; i<text.length; i++) {\r
+               var ch=text.charCodeAt(i);\r
+               if (!this.isPrintable(ch)) ch=94;\r
+               this.charBuf[this.r][this.c]=ch;\r
+               this.styleBuf[this.r][this.c]=(style)? style:0;\r
+               var last_r=this.r;\r
+               this._incCol();\r
+               if (this.r!=last_r) this.redraw(last_r);\r
+       }\r
+       this.redraw(this.r);\r
+       this.r=tr1;\r
+       this.c=tc1;\r
+}\r
+\r
+Terminal.prototype.statusLine = function(text,style,offset) {\r
+       var ch,r;\r
+       style=((style) && (!isNaN(style)))? parseInt(style)&15:0;\r
+       if ((offset) && (offset>0)) r=this.conf.rows-offset\r
+       else r=this.conf.rows-1;\r
+       for (var i=0; i<this.conf.cols; i++) {\r
+               if (i<text.length) {\r
+                       ch=text.charCodeAt(i);\r
+                       if (!this.isPrintable(ch)) ch = 94;\r
+               }\r
+               else ch=0;\r
+               this.charBuf[r][i]=ch;\r
+               this.styleBuf[r][i]=style;\r
+       }\r
+       this.redraw(r);\r
+}\r
+\r
+Terminal.prototype.printRowFromString = function(r,text,style) {\r
+       var ch;\r
+       style=((style) && (!isNaN(style)))? parseInt(style)&15:0;\r
+       if ((r>=0) && (r<this.maxLines)) {\r
+               if (typeof text != 'string') text=''+text;\r
+               for (var i=0; i<this.conf.cols; i++) {\r
+                       if (i<text.length) {\r
+                               ch=text.charCodeAt(i);\r
+                               if (!this.isPrintable(ch)) ch = 94;\r
+                       }\r
+                       else ch=0;\r
+                       this.charBuf[r][i]=ch;\r
+                       this.styleBuf[r][i]=style;\r
+               }\r
+               this.redraw(r);\r
+       }\r
+}\r
+\r
+Terminal.prototype.setChar=function(ch,r,c,style) {\r
+       this.charBuf[r][c]=ch;\r
+       this.styleBuf[this.r][this.c]=(style)? style:0;\r
+       this.redraw(r);\r
+}\r
+\r
+Terminal.prototype._charOut=function(ch, style) {\r
+       this.charBuf[this.r][this.c]=ch;\r
+       this.styleBuf[this.r][this.c]=(style)? style:0;\r
+       this.redraw(this.r);\r
+       this._incCol();\r
+}\r
+\r
+Terminal.prototype._incCol=function() {\r
+       this.c++;\r
+       if (this.c>=this.maxCols) {\r
+               this.c=0;\r
+               this._incRow();\r
+       }\r
+}\r
+\r
+Terminal.prototype._incRow=function() {\r
+       this.r++;\r
+       if (this.r>=this.maxLines) {\r
+               this._scrollLines(0,this.maxLines);\r
+               this.r=this.maxLines-1;\r
+       }\r
+}\r
+\r
+Terminal.prototype._scrollLines=function(start, end) {\r
+       window.status='Scrolling lines ...';\r
+       start++;\r
+       for (var ri=start; ri<end; ri++) {\r
+               var rt=ri-1;\r
+               this.charBuf[rt]=this.charBuf[ri];\r
+               this.styleBuf[rt]=this.styleBuf[ri];\r
+       }\r
+       // clear last line\r
+       var rt=end-1;\r
+       this.charBuf[rt]=this.getRowArray(this.conf.cols,0);\r
+       this.styleBuf[rt]=this.getRowArray(this.conf.cols,0);\r
+       this.redraw(rt);\r
+       for (var r=end-1; r>=start; r--) this.redraw(r-1);\r
+       window.status='';\r
+}\r
+\r
+Terminal.prototype.newLine=function() {\r
+       this.c=0;\r
+       this._incRow();\r
+}\r
+\r
+Terminal.prototype.clear=function() {\r
+       window.status='Clearing display ...';\r
+       this.cursorOff();\r
+       this.insert=false;\r
+       for (var ri=0; ri<this.maxLines; ri++) {\r
+               this.charBuf[ri]=this.getRowArray(this.conf.cols,0);\r
+               this.styleBuf[ri]=this.getRowArray(this.conf.cols,0);\r
+               this.redraw(ri);\r
+       }\r
+       this.r=0;\r
+       this.c=0;\r
+       window.status='';\r
+}\r
+\r
+Terminal.prototype.reset=function() {\r
+       if (this.lock) return;\r
+       this.lock=true;\r
+       this.rawMode=false;\r
+       this.charMode=false;\r
+       this.maxLines=this.conf.rows;\r
+       this.maxCols=this.conf.cols;\r
+       this.lastLine='';\r
+       this.lineBuffer='';\r
+       this.inputChar=0;\r
+       this.clear();\r
+}\r
+\r
+Terminal.prototype.cursorSet=function(r,c) {\r
+       var crsron=this.cursoractive;\r
+       if (crsron) this.cursorOff();\r
+       this.r=r%this.maxLines;\r
+       this.c=c%this.maxCols;\r
+       this._cursorReset(crsron);\r
+}\r
+\r
+Terminal.prototype._cursorReset=function(crsron) {\r
+       if (crsron) this.cursorOn()\r
+       else {\r
+               this.blinkBuffer=this.styleBuf[this.r][this.c];\r
+       }\r
+}\r
+\r
+Terminal.prototype.cursorOn=function() {\r
+       if (this.blinkTimer) clearTimeout(this.blinkTimer);\r
+       this.blinkBuffer=this.styleBuf[this.r][this.c];\r
+       this._cursorBlink();\r
+       this.cursoractive=true;\r
+}\r
+\r
+Terminal.prototype.cursorOff=function() {\r
+       if (this.blinkTimer) clearTimeout(this.blinkTimer);\r
+       if (this.cursoractive) {\r
+               this.styleBuf[this.r][this.c]=this.blinkBuffer;\r
+               this.redraw(this.r);\r
+               this.cursoractive=false;\r
+       }\r
+}\r
+\r
+Terminal.prototype._cursorBlink=function() {\r
+       if (this.blinkTimer) clearTimeout(this.blinkTimer);\r
+       if (this == TermGlobals.activeTerm) {\r
+               if (this.crsrBlockMode) {\r
+                       this.styleBuf[this.r][this.c]=(this.styleBuf[this.r][this.c]&1)?\r
+                               this.styleBuf[this.r][this.c]&254:this.styleBuf[this.r][this.c]|1;\r
+               }\r
+               else {\r
+                       this.styleBuf[this.r][this.c]=(this.styleBuf[this.r][this.c]&2)?\r
+                               this.styleBuf[this.r][this.c]&253:this.styleBuf[this.r][this.c]|2;\r
+               }\r
+               this.redraw(this.r);\r
+       }\r
+       if (this.crsrBlinkMode) this.blinkTimer=setTimeout('TermGlobals.activeTerm._cursorBlink()', this.blinkDelay);\r
+}\r
+\r
+Terminal.prototype.cursorLeft=function() {\r
+       var crsron=this.cursoractive;\r
+       if (crsron) this.cursorOff();\r
+       var r=this.r;\r
+       var c=this.c;\r
+       if (c>0) c--\r
+       else if (r>0) {\r
+               c=this.maxCols-1;\r
+               r--;\r
+       }\r
+       if (this.isPrintable(this.charBuf[r][c])) {\r
+               this.r=r;\r
+               this.c=c;\r
+       }\r
+       this.insert=true;\r
+       this._cursorReset(crsron);\r
+}\r
+\r
+Terminal.prototype.cursorRight=function() {\r
+       var crsron=this.cursoractive;\r
+       if (crsron) this.cursorOff();\r
+       var r=this.r;\r
+       var c=this.c;\r
+       if (c<this.maxCols-1) c++\r
+       else if (r<this.maxLines-1) {\r
+               c=0;\r
+               r++;\r
+       }\r
+       if (!this.isPrintable(this.charBuf[r][c])) {\r
+               this.insert=false;\r
+       }\r
+       if (this.isPrintable(this.charBuf[this.r][this.c])) {\r
+               this.r=r;\r
+               this.c=c;\r
+       }\r
+       this._cursorReset(crsron);\r
+}\r
+\r
+Terminal.prototype.backspace=function() {\r
+       var crsron=this.cursoractive;\r
+       if (crsron) this.cursorOff();\r
+       var r=this.r;\r
+       var c=this.c;\r
+       if (c>0) c--\r
+       else if (r>0) {\r
+               c=this.maxCols-1;\r
+               r--;\r
+       };\r
+       if (this.isPrintable(this.charBuf[r][c])) {\r
+               this._scrollLeft(r, c);\r
+               this.r=r;\r
+               this.c=c;\r
+       };      \r
+       this._cursorReset(crsron);\r
+}\r
+\r
+Terminal.prototype.fwdDelete=function() {\r
+       var crsron=this.cursoractive;\r
+       if (crsron) this.cursorOff();\r
+       if (this.isPrintable(this.charBuf[this.r][this.c])) {\r
+               this._scrollLeft(this.r,this.c);\r
+               if (!this.isPrintable(this.charBuf[this.r][this.c])) this.insert=false;\r
+       }\r
+       this._cursorReset(crsron);\r
+}\r
+\r
+Terminal.prototype.prompt=function() {\r
+       this.lock=true;\r
+       if (this.c>0) this.newLine();\r
+       this.type(this.ps);\r
+       this._charOut(1);\r
+       this.lock=false;\r
+       this.cursorOn();\r
+}\r
+\r
+Terminal.prototype._scrollLeft=function(r,c) {\r
+       var rows=new Array();\r
+       rows[0]=r;\r
+       while (this.isPrintable(this.charBuf[r][c])) {\r
+               var ri=r;\r
+               var ci=c+1;\r
+               if (ci==this.maxCols) {\r
+                       if (ri<this.maxLines-1) {\r
+                               ci=0;\r
+                               ri++;\r
+                               rows[rows.length]=ri;\r
+                       }\r
+                       else {\r
+                               break;\r
+                       }\r
+               }\r
+               this.charBuf[r][c]=this.charBuf[ri][ci];\r
+               this.styleBuf[r][c]=this.styleBuf[ri][ci];\r
+               c=ci;\r
+               r=ri;\r
+       }\r
+       if (this.charBuf[r][c]!=0) this.charBuf[r][c]=0;\r
+       for (var i=0; i<rows.length; i++) this.redraw(rows[i]);\r
+}\r
+\r
+Terminal.prototype._scrollRight=function(r,c) {\r
+       var rows=new Array();\r
+       var end=this._getLineEnd(r,c);\r
+       var ri=end[0];\r
+       var ci=end[1];\r
+       if ((ci==this.maxCols-1) && (ri==this.maxLines-1)) {\r
+               if (r==0) return;\r
+               this._scrollLines(0,this.maxLines);\r
+               this.r--;\r
+               r--;\r
+               ri--;\r
+       }\r
+       rows[r]=1;\r
+       while (this.isPrintable(this.charBuf[ri][ci])) {\r
+               var rt=ri;\r
+               var ct=ci+1;\r
+               if (ct==this.maxCols) {\r
+                       ct=0;\r
+                       rt++;\r
+                       rows[rt]=1;\r
+               }\r
+               this.charBuf[rt][ct]=this.charBuf[ri][ci];\r
+               this.styleBuf[rt][ct]=this.styleBuf[ri][ci];\r
+               if ((ri==r) && (ci==c)) break;\r
+               ci--;\r
+               if (ci<0) {\r
+                       ci=this.maxCols-1;\r
+                       ri--;\r
+                       rows[ri]=1;\r
+               }\r
+       }\r
+       for (var i=r; i<this.maxLines; i++) {\r
+               if (rows[i]) this.redraw(i);\r
+       }\r
+}\r
+\r
+Terminal.prototype._getLineEnd=function(r,c) {\r
+       if (!this.isPrintable(this.charBuf[r][c])) {\r
+               c--;\r
+               if (c<0) {\r
+                       if (r>0) {\r
+                               r--;\r
+                               c=this.maxCols-1;\r
+                       }\r
+                       else {\r
+                               c=0;\r
+                       }\r
+               }\r
+       }\r
+       if (this.isPrintable(this.charBuf[r][c])) {\r
+               while (true) {\r
+                       var ri=r;\r
+                       var ci=c+1;\r
+                       if (ci==this.maxCols) {\r
+                               if (ri<this.maxLines-1) {\r
+                                       ri++;\r
+                                       ci=0;\r
+                               }\r
+                               else {\r
+                                       break;\r
+                               }\r
+                       }\r
+                       if (!this.isPrintable(this.charBuf[ri][ci])) break;\r
+                       c=ci;\r
+                       r=ri;\r
+               }\r
+       }\r
+       return [r,c];\r
+}\r
+\r
+Terminal.prototype._getLineStart=function(r,c) {\r
+       // not used by now, just in case anyone needs this ...\r
+       var ci, ri;\r
+       if (!this.isPrintable(this.charBuf[r][c])) {\r
+               ci=c-1;\r
+               ri=r;\r
+               if (ci<0) {\r
+                       if (ri==0) return [0,0];\r
+                       ci=this.maxCols-1;\r
+                       ri--;\r
+               }\r
+               if (!this.isPrintable(this.charBuf[ri][ci])) return [r,c]\r
+               else {\r
+                       r=ri;\r
+                       c=ci;\r
+               }\r
+       }\r
+       while (true) {\r
+               var ri=r;\r
+               var ci=c-1;\r
+               if (ci<0) {\r
+                       if (ri==0) break;\r
+                       ci=this.maxCols-1;\r
+                       ri--;\r
+               }\r
+               if (!this.isPrintable(this.charBuf[ri][ci])) break;;\r
+               r=ri;\r
+               c=ci;\r
+       }\r
+       return [r,c];\r
+}\r
+\r
+Terminal.prototype._getLine=function() {\r
+       var end=this._getLineEnd(this.r,this.c);\r
+       var r=end[0];\r
+       var c=end[1];\r
+       var line=new Array();\r
+       while (this.isPrintable(this.charBuf[r][c])) {\r
+               line[line.length]=String.fromCharCode(this.charBuf[r][c]);\r
+               if (c>0) c--\r
+               else if (r>0) {\r
+                       c=this.maxCols-1;\r
+                       r--;\r
+               }\r
+               else break;\r
+       }\r
+       line.reverse();\r
+       return line.join('');\r
+}\r
+\r
+Terminal.prototype._clearLine=function() {\r
+       var end=this._getLineEnd(this.r,this.c);\r
+       var r=end[0];\r
+       var c=end[1];\r
+       var line='';\r
+       while (this.isPrintable(this.charBuf[r][c])) {\r
+               this.charBuf[r][c]=0;\r
+               if (c>0) {\r
+                       c--;\r
+               }\r
+               else if (r>0) {\r
+                       this.redraw(r);\r
+                       c=this.maxCols-1;\r
+                       r--;\r
+               }\r
+               else break;\r
+       }\r
+       if (r!=end[0]) this.redraw(r);\r
+       c++;\r
+       this.cursorSet(r,c);\r
+       this.insert=false;\r
+}\r
+\r
+Terminal.prototype.isPrintable=function(ch, unicodePage1only) {\r
+       if ((unicodePage1only) && (ch>255)) {\r
+               return ((ch==termKey.EURO) && (this.printEuro))? true:false;\r
+       }\r
+       return (\r
+               ((ch>=32) && (ch!=termKey.DEL)) ||\r
+               ((this.printTab) && (ch==termKey.TAB))\r
+       );\r
+}\r
+\r
+// keyboard focus\r
+\r
+Terminal.prototype.focus=function() {\r
+       TermGlobals.activeTerm=this;\r
+}\r
+\r
+// global store and functions\r
+\r
+var TermGlobals={\r
+       termToInitialze:null,\r
+       activeTerm:null,\r
+       kbdEnabled:false,\r
+       keylock:false,\r
+       lcMorePrompt1: ' -- MORE -- ',\r
+       lcMorePromtp1Style: 1,\r
+       lcMorePrompt2: ' (Type: space to continue, \'q\' to quit)',\r
+       lcMorePrompt2Style: 0,\r
+       lcMoreKeyAbort: 113,\r
+       lcMoreKeyContinue: 32\r
+};\r
+\r
+// keybard focus\r
+\r
+TermGlobals.setFocus=function(termref) {\r
+       TermGlobals.activeTerm=termref;\r
+}\r
+\r
+// text related\r
+\r
+TermGlobals.normalize=function(n,m) {\r
+       var s=''+n;\r
+       while (s.length<m) s='0'+s;\r
+       return s;\r
+}\r
+\r
+TermGlobals.fillLeft=function(t,n) {\r
+       if (typeof t != 'string') t=''+t;\r
+       while (t.length<n) t=' '+t;\r
+       return t;\r
+}\r
+\r
+TermGlobals.center=function(t,l) {\r
+       var s='';\r
+       for (var i=t.length; i<l; i+=2) s+=' ';\r
+       return s+t;\r
+}\r
+\r
+TermGlobals.stringReplace=function(s1,s2,t) {\r
+       var l1=s1.length;\r
+       var l2=s2.length;\r
+       var ofs=t.indexOf(s1);\r
+       while (ofs>=0) {\r
+               t=t.substring(0,ofs)+s2+t.substring(ofs+l1);\r
+               ofs=t.indexOf(s1,ofs+l2);\r
+       }\r
+       return t;\r
+}\r
+\r
+// keyboard\r
+\r
+var termKey= {\r
+       // special key codes\r
+       'NUL': 0x00,\r
+       'SOH': 0x01,\r
+       'STX': 0x02,\r
+       'ETX': 0x03,\r
+       'EOT': 0x04,\r
+       'ENQ': 0x05,\r
+       'ACK': 0x06,\r
+       'BEL': 0x07,\r
+       'BS': 0x08,\r
+       'HT': 0x09,\r
+       'TAB': 0x09,\r
+       'LF': 0x0A,\r
+       'VT': 0x0B,\r
+       'FF': 0x0C,\r
+       'CR': 0x0D,\r
+       'SO': 0x0E,\r
+       'SI': 0x0F,\r
+       'DLE': 0x10,\r
+       'DC1': 0x11,\r
+       'DC2': 0x12,\r
+       'DC3': 0x13,\r
+       'DC4': 0x14,\r
+       'NAK': 0x15,\r
+       'SYN': 0x16,\r
+       'ETB': 0x17,\r
+       'CAN': 0x18,\r
+       'EM': 0x19,\r
+       'SUB': 0x1A,\r
+       'ESC': 0x1B,\r
+       'IS4': 0x1C,\r
+       'IS3': 0x1D,\r
+       'IS2': 0x1E,\r
+       'IS1': 0x1F,\r
+       'DEL': 0x7F,\r
+       // other specials\r
+       'EURO': 0x20AC,\r
+       // cursor mapping\r
+       'LEFT': 0x1C,\r
+       'RIGHT': 0x1D,\r
+       'UP': 0x1E,\r
+       'DOWN': 0x1F\r
+};\r
+\r
+var termDomKeyRef = {\r
+       DOM_VK_LEFT: termKey.LEFT,\r
+       DOM_VK_RIGHT: termKey.RIGHT,\r
+       DOM_VK_UP: termKey.UP,\r
+       DOM_VK_DOWN: termKey.DOWN,\r
+       DOM_VK_BACK_SPACE: termKey.BS,\r
+       DOM_VK_RETURN: termKey.CR,\r
+       DOM_VK_ENTER: termKey.CR,\r
+       DOM_VK_ESCAPE: termKey.ESC,\r
+       DOM_VK_DELETE: termKey.DEL,\r
+       DOM_VK_TAB: termKey.TAB\r
+};\r
+\r
+TermGlobals.enableKeyboard=function(term) {\r
+       if (!this.kbdEnabled) {\r
+               if (document.addEventListener) document.addEventListener("keypress", this.keyHandler, true)\r
+               else {\r
+                       if ((self.Event) && (self.Event.KEYPRESS)) document.captureEvents(Event.KEYPRESS);\r
+                       document.onkeypress = this.keyHandler;\r
+               }\r
+               window.document.onkeydown=this.keyFix;\r
+               this.kbdEnabled=true;\r
+       }\r
+       this.activeTerm=term;\r
+}\r
+\r
+TermGlobals.keyFix=function(e) {\r
+       var term=TermGlobals.activeTerm;\r
+       if ((TermGlobals.keylock) || (term.lock)) return true;\r
+       if (window.event) {\r
+               var ch=window.event.keyCode;\r
+               if  (!e) e=window.event;\r
+               if (e.DOM_VK_UP) {\r
+                       for (var i in termDomKeyRef) {\r
+                               if ((e[i]) && (ch == e[i])) {\r
+                                       this.keyHandler({which:termDomKeyRef[i],_remapped:true});\r
+                                       if (e.preventDefault) e.preventDefault();\r
+                                       if (e.stopPropagation) e.stopPropagation();\r
+                                       e.cancleBubble=true;\r
+                                       return false;\r
+                               }\r
+                       }\r
+                       e.cancleBubble=false;\r
+                       return true;\r
+               }\r
+               else {\r
+                       // no DOM support\r
+                       if ((ch==8) && (!term.isSafari)) TermGlobals.keyHandler({which:termKey.BS,_remapped:true})\r
+                       else if (ch==9) TermGlobals.keyHandler({which:termKey.TAB,_remapped:true})\r
+                       else if (ch==37) TermGlobals.keyHandler({which:termKey.LEFT,_remapped:true})\r
+                       else if (ch==39) TermGlobals.keyHandler({which:termKey.RIGHT,_remapped:true})\r
+                       else if (ch==38) TermGlobals.keyHandler({which:termKey.UP,_remapped:true})\r
+                       else if (ch==40) TermGlobals.keyHandler({which:termKey.DOWN,_remapped:true})\r
+                       else if (ch==127) TermGlobals.keyHandler({which:termKey.DEL,_remapped:true})\r
+                       else if ((ch>=57373) && (ch<=57376)) {\r
+                               if (ch==57373) TermGlobals.keyHandler({which:termKey.UP,_remapped:true})\r
+                               else if (ch==57374) TermGlobals.keyHandler({which:termKey.DOWN,_remapped:true})\r
+                               else if (ch==57375) TermGlobals.keyHandler({which:termKey.LEFT,_remapped:true})\r
+                               else if (ch==57376) TermGlobals.keyHandler({which:termKey.RIGHT,_remapped:true});\r
+                       }\r
+                       else {\r
+                               e.cancleBubble=false;\r
+                               return true;\r
+                       }\r
+                       if (e.preventDefault) e.preventDefault();\r
+                       if (e.stopPropagation) e.stopPropagation();\r
+                       e.cancleBubble=true;\r
+                       return false;\r
+               }\r
+       }\r
+}\r
+\r
+TermGlobals.keyHandler=function(e) {\r
+       var term=TermGlobals.activeTerm;\r
+       if ((TermGlobals.keylock) || (term.lock)) return true;\r
+       if ((window.event) && (window.event.preventDefault)) window.event.preventDefault()\r
+       else if ((e) && (e.preventDefault)) e.preventDefault();\r
+       if ((window.event) && (window.event.stopPropagation)) window.event.stopPropagation()\r
+       else if ((e) && (e.stopPropagation)) e.stopPropagation();\r
+       var ch;\r
+       var ctrl=false;\r
+       var shft=false;\r
+       var remapped=false;\r
+       if (e) {\r
+               ch=e.which;\r
+               ctrl=(((e.ctrlKey) && (e.altKey)) || (e.modifiers==2));\r
+               shft=((e.shiftKey) || (e.modifiers==4));\r
+               if (e._remapped) {\r
+                       remapped=true;\r
+                       if (window.event) {\r
+                               //ctrl=((ctrl) || (window.event.ctrlKey));\r
+                               ctrl=((ctrl) || ((window.event.ctrlKey) && (!window.event.altKey)));\r
+                               shft=((shft) || (window.event.shiftKey));\r
+                       }\r
+               }\r
+       }\r
+       else if (window.event) {\r
+               ch=window.event.keyCode;\r
+               //ctrl=(window.event.ctrlKey);\r
+               ctrl=((window.event.ctrlKey) && (!window.event.altKey)); // allow alt gr == ctrl alts\r
+               shft=(window.event.shiftKey);\r
+       }\r
+       else {\r
+               return true;\r
+       }\r
+       if ((ch=='') && (remapped==false)) {\r
+               // map specials\r
+               if (e==null) e=window.event;\r
+               if ((e.charCode==0) && (e.keyCode)) {\r
+                       if (e.DOM_VK_UP) {\r
+                               for (var i in termDomKeyRef) {\r
+                                       if ((e[i]) && (e.keyCode == e[i])) {\r
+                                               ch=termDomKeyRef[i];\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+                       else {\r
+                               // NS4\r
+                               if (e.keyCode==28) ch=termKey.LEFT\r
+                               else if (e.keyCode==29) ch=termKey.RIGHT\r
+                               else if (e.keyCode==30) ch=termKey.UP\r
+                               else if (e.keyCode==31) ch=termKey.DOWN\r
+                               // Mozilla alike but no DOM support\r
+                               else if (e.keyCode==37) ch=termKey.LEFT\r
+                               else if (e.keyCode==39) ch=termKey.RIGHT\r
+                               else if (e.keyCode==38) ch=termKey.UP\r
+                               else if (e.keyCode==40) ch=termKey.DOWN\r
+                               // just to have the TAB mapping here too\r
+                               else if (e.keyCode==9) ch=termKey.TAB;\r
+                       }\r
+               }\r
+       }\r
+       // key actions\r
+       if (term.charMode) {\r
+               term.insert=false;\r
+               term.inputChar=ch;\r
+               term.lineBuffer='';\r
+               term.handler();\r
+               if ((ch<=32) && (window.event)) window.event.cancleBubble=true;\r
+               return false;\r
+       }\r
+       if (!ctrl) {\r
+               // special keys\r
+               if (ch==termKey.CR) {\r
+                       term.lock=true;\r
+                       term.cursorOff();\r
+                       term.insert=false;\r
+                       if (term.rawMode) {\r
+                               term.lineBuffer=term.lastLine;\r
+                       }\r
+                       else {\r
+                               term.lineBuffer=term._getLine();\r
+                               if (\r
+                                   (term.lineBuffer!='') && ((!term.historyUnique) ||\r
+                                   (term.history.length==0) ||\r
+                                   (term.lineBuffer!=term.history[term.history.length-1]))\r
+                                  ) {\r
+                                       term.history[term.history.length]=term.lineBuffer;\r
+                               }\r
+                               term.histPtr=term.history.length;\r
+                       }\r
+                       term.lastLine='';\r
+                       term.inputChar=0;\r
+                       term.handler();\r
+                       if (window.event) window.event.cancleBubble=true;\r
+                       return false;\r
+               }\r
+               else if (ch==termKey.ESC) {\r
+                       if (term.conf.closeOnESC) term.close();\r
+                       if (window.event) window.event.cancleBubble=true;\r
+                       return false;\r
+               }\r
+               if ((ch<32) && (term.rawMode)) {\r
+                       if (window.event) window.event.cancleBubble=true;\r
+                       return false;\r
+               }\r
+               else {\r
+                       if (ch==termKey.LEFT) {\r
+                               term.cursorLeft();\r
+                               if (window.event) window.event.cancleBubble=true;\r
+                               return false;\r
+                       }\r
+                       else if (ch==termKey.RIGHT) {\r
+                               term.cursorRight();\r
+                               if (window.event) window.event.cancleBubble=true;\r
+                               return false;\r
+                       }\r
+                       else if (ch==termKey.UP) {\r
+                               term.cursorOff();\r
+                               if (term.histPtr==term.history.length) term.lastLine=term._getLine();\r
+                               term._clearLine();\r
+                               if ((term.history.length) && (term.histPtr>=0)) {\r
+                                       if (term.histPtr>0) term.histPtr--;\r
+                                       term.type(term.history[term.histPtr]);\r
+                               }\r
+                               else if (term.lastLine) term.type(term.lastLine);\r
+                               term.cursorOn();\r
+                               if (window.event) window.event.cancleBubble=true;\r
+                               return false;\r
+                       }\r
+                       else if (ch==termKey.DOWN) {\r
+                               term.cursorOff();\r
+                               if (term.histPtr==term.history.length) term.lastLine=term._getLine();\r
+                               term._clearLine();\r
+                               if ((term.history.length) && (term.histPtr<=term.history.length)) {\r
+                                       if (term.histPtr<term.history.length) term.histPtr++;\r
+                                       if (term.histPtr<term.history.length) term.type(term.history[term.histPtr])\r
+                                       else if (term.lastLine) term.type(term.lastLine);\r
+                               }\r
+                               else if (term.lastLine) term.type(term.lastLine);\r
+                               term.cursorOn();\r
+                               if (window.event) window.event.cancleBubble=true;\r
+                               return false;\r
+                       }\r
+                       else if (ch==termKey.BS) {\r
+                               term.backspace();\r
+                               if (window.event) window.event.cancleBubble=true;\r
+                               return false;\r
+                       }\r
+                       else if (ch==termKey.DEL) {\r
+                               if (term.DELisBS) term.backspace()\r
+                               else term.fwdDelete();\r
+                               if (window.event) window.event.cancleBubble=true;\r
+                               return false;\r
+                       }\r
+               }\r
+       }\r
+       if (term.rawMode) {\r
+               if (term.isPrintable(ch)) {\r
+                       term.lastLine+=String.fromCharCode(ch);\r
+               }\r
+               if ((ch==32) && (window.event)) window.event.cancleBubble=true\r
+               else if ((window.opera) && (window.event)) window.event.cancleBubble=true;\r
+               return false;\r
+       }\r
+       else {\r
+               if ((term.conf.catchCtrlH) && ((ch==termKey.BS) || ((ctrl) && (ch==72)))) {\r
+                       // catch ^H\r
+                       term.backspace();\r
+                       if (window.event) window.event.cancleBubble=true;\r
+                       return false;\r
+               }\r
+               else if ((term.ctrlHandler) && ((ch<32) || ((ctrl) && (term.isPrintable(ch,true))))) {\r
+                       if (((ch>=65) && (ch<=96)) || (ch==63)) {\r
+                               // remap canonical\r
+                               if (ch==63) ch=31\r
+                               else ch-=64;\r
+                       }\r
+                       term.inputChar=ch;\r
+                       term.ctrlHandler();\r
+                       if (window.event) window.event.cancleBubble=true;\r
+                       return false;\r
+               }\r
+               else if ((ctrl) || (!term.isPrintable(ch,true))) {\r
+                       if (window.event) window.event.cancleBubble=true;\r
+                       return false;\r
+               }\r
+               else if (term.isPrintable(ch,true)) {\r
+                       if (term.blinkTimer) clearTimeout(term.blinkTimer);\r
+                       if (term.insert) {\r
+                               term.cursorOff();\r
+                               term._scrollRight(term.r,term.c);\r
+                       }\r
+                       term._charOut(ch);\r
+                       term.cursorOn();\r
+                       if ((ch==32) && (window.event)) window.event.cancleBubble=true\r
+                       else if ((window.opera) && (window.event)) window.event.cancleBubble=true;\r
+                       return false;\r
+               }\r
+       }\r
+       return true;\r
+}\r
+\r
+// term gui\r
+\r
+TermGlobals.hasSubDivs=false;\r
+TermGlobals.hasLayers=false;\r
+TermGlobals.termStringStart='';\r
+TermGlobals.termStringEnd='';\r
+\r
+TermGlobals.termSpecials=new Array();\r
+TermGlobals.termSpecials[0]='&nbsp;';\r
+TermGlobals.termSpecials[1]='&nbsp;';\r
+TermGlobals.termSpecials[9]='&nbsp;';\r
+TermGlobals.termSpecials[32]='&nbsp;';\r
+TermGlobals.termSpecials[34]='&quot;';\r
+TermGlobals.termSpecials[38]='&amp;';\r
+TermGlobals.termSpecials[60]='&lt;';\r
+TermGlobals.termSpecials[62]='&gt;';\r
+TermGlobals.termSpecials[127]='&loz;';\r
+TermGlobals.termSpecials[0x20AC]='&euro;';\r
+\r
+TermGlobals.termStyles=new Array(1,2,4,8);\r
+TermGlobals.termStyleOpen=new Array();\r
+TermGlobals.termStyleClose=new Array();\r
+TermGlobals.termStyleOpen[1]='<span class="termReverse">';\r
+TermGlobals.termStyleClose[1]='<\/span>';\r
+TermGlobals.termStyleOpen[2]='<u>';\r
+TermGlobals.termStyleClose[2]='<\/u>';\r
+TermGlobals.termStyleOpen[4]='<i>';\r
+TermGlobals.termStyleClose[4]='<\/i>';\r
+TermGlobals.termStyleOpen[8]='<strike>';\r
+TermGlobals.termStyleClose[8]='<\/strike>';\r
+\r
+Terminal.prototype._makeTerm=function(rebuild) {\r
+       window.status='Building terminal ...';\r
+       TermGlobals.hasLayers=(document.layers)? true:false;\r
+       TermGlobals.hasSubDivs=(navigator.userAgent.indexOf('Gecko')<0);\r
+       var divPrefix=this.termDiv+'_r';\r
+       var s='';\r
+       s+='<table border="0" cellspacing="0" cellpadding="'+this.conf.frameWidth+'">\n';\r
+       s+='<tr><td bgcolor="'+this.conf.frameColor+'"><table border="0" cellspacing="0" cellpadding="2"><tr><td  bgcolor="'+this.conf.bgColor+'"><table border="0" cellspacing="0" cellpadding="0">\n';\r
+       var rstr='';\r
+       for (var c=0; c<this.conf.cols; c++) rstr+='&nbsp;';\r
+       for (var r=0; r<this.conf.rows; r++) {\r
+               var termid=((TermGlobals.hasLayers) || (TermGlobals.hasSubDivs))? '' : ' id="'+divPrefix+r+'"';\r
+               s+='<tr><td nowrap height="'+this.conf.rowHeight+'"'+termid+' class="'+this.conf.fontClass+'">'+rstr+'<\/td><\/tr>\n';\r
+       }\r
+       s+='<\/table><\/td><\/tr>\n';\r
+       s+='<\/table><\/td><\/tr>\n';\r
+       s+='<\/table>\n';\r
+       var termOffset=2+this.conf.frameWidth;\r
+       if (TermGlobals.hasLayers) {\r
+               for (var r=0; r<this.conf.rows; r++) {\r
+                       s+='<layer name="'+divPrefix+r+'" top="'+(termOffset+r*this.conf.rowHeight)+'" left="'+termOffset+'" class="'+this.conf.fontClass+'"><\/layer>\n';\r
+               }\r
+               this.ns4ParentDoc=document.layers[this.termDiv].document;\r
+               TermGlobals.termStringStart='<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap height="'+this.conf.rowHeight+'" class="'+this.conf.fontClass+'">';\r
+               TermGlobals.termStringEnd='<\/td><\/tr><\/table>';\r
+       }\r
+       else if (TermGlobals.hasSubDivs) {\r
+               for (var r=0; r<this.conf.rows; r++) {\r
+                       s+='<div id="'+divPrefix+r+'" style="position:absolute; top:'+(termOffset+r*this.conf.rowHeight)+'px; left: '+termOffset+'px;" class="'+this.conf.fontClass+'"><\/div>\n';\r
+               }\r
+               TermGlobals.termStringStart='<table border="0" cellspacing="0" cellpadding="0"><tr><td nowrap height="'+this.conf.rowHeight+'" class="'+this.conf.fontClass+'">';\r
+               TermGlobals.termStringEnd='<\/td><\/tr><\/table>';\r
+       }\r
+       TermGlobals.writeElement(this.termDiv,s);\r
+       if (!rebuild) {\r
+               TermGlobals.setElementXY(this.termDiv,this.conf.x,this.conf.y);\r
+               TermGlobals.setVisible(this.termDiv,1);\r
+       }\r
+       window.status='';\r
+}\r
+\r
+Terminal.prototype.rebuild=function() {\r
+       // check for bounds and array lengths\r
+       var rl=this.conf.rows;\r
+       var cl=this.conf.cols;\r
+       for (var r=0; r<rl; r++) {\r
+               var cbr=this.charBuf[r];\r
+               if (!cbr) {\r
+                       this.charBuf[r]=this.getRowArray(cl,0);\r
+                       this.styleBuf[r]=this.getRowArray(cl,0);\r
+               }\r
+               else if (cbr.length<cl) {\r
+                       for (var c=cbr.length; c<cl; c++) {\r
+                               this.charBuf[r][c]=0;\r
+                               this.styleBuf[r][c]=0;\r
+                       }\r
+               }\r
+       }\r
+       var resetcrsr=false;\r
+       if (this.r>=rl) {\r
+               r=rl-1;\r
+               resetcrsr=true;\r
+       }\r
+       if (this.c>=cl) {\r
+               c=cl-1;\r
+               resetcrsr=true;\r
+       }\r
+       if ((resetcrsr) && (this.cursoractive)) this.cursorOn();\r
+       // and actually rebuild\r
+       this._makeTerm(true);\r
+       for (var r=0; r<rl; r++) {\r
+               this.redraw(r);\r
+       }\r
+}\r
+\r
+Terminal.prototype.moveTo=function(x,y) {\r
+       TermGlobals.setElementXY(this.termDiv,x,y);\r
+}\r
+\r
+Terminal.prototype.resizeTo=function(x,y) {\r
+       if (this.termDivReady()) {\r
+               x=parseInt(x,10);\r
+               y=parseInt(y,10);\r
+               if ((isNaN(x)) || (isNaN(y)) || (x<4) || (y<2)) return false;\r
+               this.maxCols=this.conf.cols=x;\r
+               this.maxLines=this.conf.rows=y;\r
+               this._makeTerm();\r
+               this.clear();\r
+               return true;\r
+       }\r
+       else return false;\r
+}\r
+\r
+Terminal.prototype.redraw=function(r) {\r
+       var s=TermGlobals.termStringStart;\r
+       var curStyle=0;\r
+       var tstls=TermGlobals.termStyles;\r
+       var tscls=TermGlobals.termStyleClose;\r
+       var tsopn=TermGlobals.termStyleOpen;\r
+       var tspcl=TermGlobals.termSpecials;\r
+       var t_cb=this.charBuf;\r
+       var t_sb=this.styleBuf;\r
+       for (var i=0; i<this.conf.cols; i++) {\r
+               var c=t_cb[r][i];\r
+               var cs=t_sb[r][i];\r
+               if (cs!=curStyle) {\r
+                       if (curStyle) {\r
+                               for (var k=tstls.length-1; k>=0; k--) {\r
+                                       var st=tstls[k];\r
+                                       if (curStyle&st) s+=tscls[st];\r
+                               }\r
+                       }\r
+                       curStyle=cs;\r
+                       for (var k=0; k<tstls.length; k++) {\r
+                               var st=tstls[k];\r
+                               if (curStyle&st) s+=tsopn[st];\r
+                       }\r
+               }\r
+               s+= (tspcl[c])? tspcl[c] : String.fromCharCode(c);\r
+       }\r
+       if (curStyle>0) {\r
+               for (var k=tstls.length-1; k>=0; k--) {\r
+                       var st=tstls[k];\r
+                       if (curStyle&st) s+=tscls[st];\r
+               }\r
+       }\r
+       s+=TermGlobals.termStringEnd;\r
+       TermGlobals.writeElement(this.termDiv+'_r'+r,s,this.ns4ParentDoc);\r
+}\r
+\r
+Terminal.prototype.guiReady=function() {\r
+       ready=true;\r
+       if (TermGlobals.guiElementsReady(this.termDiv, self.document)) {\r
+               for (var r=0; r<this.conf.rows; r++) {\r
+                       if (TermGlobals.guiElementsReady(this.termDiv+'_r'+r,this.ns4ParentDoc)==false) {\r
+                               ready=false;\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+       else ready=false;\r
+       return ready;\r
+}\r
+\r
+Terminal.prototype.termDivReady=function() {\r
+       if (document.layers) {\r
+               return (document.layers[this.termDiv])? true:false;\r
+       }\r
+       else if (document.getElementById) {\r
+               return (document.getElementById(this.termDiv))? true:false;\r
+       }\r
+       else if (document.all) {\r
+               return (document.all[this.termDiv])? true:false;\r
+       }\r
+       else {\r
+               return false;\r
+       }\r
+}\r
+\r
+Terminal.prototype.getDimensions=function() {\r
+       var w=0;\r
+       var h=0;\r
+       var d=this.termDiv;\r
+       if (document.layers) {\r
+               if (document.layers[d]) {\r
+                       w=document.layers[d].clip.right;\r
+                       h=document.layers[d].clip.bottom;\r
+               }\r
+       }\r
+       else if (document.getElementById) {\r
+               var obj=document.getElementById(d);\r
+               if ((obj) && (obj.firstChild)) {\r
+                       w=parseInt(obj.firstChild.offsetWidth,10);\r
+                       h=parseInt(obj.firstChild.offsetHeight,10);\r
+        }\r
+               else if ((obj) && (obj.children) && (obj.children[0])) {\r
+                       w=parseInt(obj.children[0].offsetWidth,10);\r
+                       h=parseInt(obj.children[0].offsetHeight,10);\r
+        }\r
+       }\r
+       else if (document.all) {\r
+               var obj=document.all[d];\r
+               if ((obj) && (obj.children) && (obj.children[0])) {\r
+                       w=parseInt(obj.children[0].offsetWidth,10);\r
+                       h=parseInt(obj.children[0].offsetHeight,10);\r
+        }\r
+       }\r
+       return { width: w, height: h };\r
+}\r
+\r
+// basic dynamics\r
+\r
+TermGlobals.writeElement=function(e,t,d) {\r
+       if (document.layers) {\r
+               var doc=(d)? d : self.document;\r
+               doc.layers[e].document.open();\r
+               doc.layers[e].document.write(t);\r
+               doc.layers[e].document.close();\r
+       }\r
+       else if (document.getElementById) {\r
+               var obj=document.getElementById(e);\r
+               obj.innerHTML=t;\r
+       }\r
+       else if (document.all) {\r
+               document.all[e].innerHTML=t;\r
+       }\r
+}\r
+\r
+TermGlobals.setElementXY=function(d,x,y) {\r
+       if (document.layers) {\r
+               document.layers[d].moveTo(x,y);\r
+       }\r
+       else if (document.getElementById) {\r
+               var obj=document.getElementById(d);\r
+               obj.style.left=x+'px';\r
+               obj.style.top=y+'px';\r
+       }\r
+       else if (document.all) {\r
+               document.all[d].style.left=x+'px';\r
+               document.all[d].style.top=y+'px';\r
+       }\r
+}\r
+\r
+TermGlobals.setVisible=function(d,v) {\r
+       if (document.layers) {\r
+               document.layers[d].visibility= (v)? 'show':'hide';\r
+       }\r
+       else if (document.getElementById) {\r
+               var obj=document.getElementById(d);\r
+               obj.style.visibility= (v)? 'visible':'hidden';\r
+       }\r
+       else if (document.all) {\r
+               document.all[d].style.visibility= (v)? 'visible':'hidden';\r
+       }\r
+}\r
+\r
+TermGlobals.setDisplay=function(d,v) {\r
+       if (document.getElementById) {\r
+               var obj=document.getElementById(d);\r
+               obj.style.display=v;\r
+       }\r
+       else if (document.all) {\r
+               document.all[d].style.display=v;\r
+       }\r
+}\r
+\r
+TermGlobals.guiElementsReady=function(e,d) {\r
+       if (document.layers) {\r
+               var doc=(d)? d : self.document;\r
+               return ((doc) && (doc.layers[e]))? true:false;\r
+       }\r
+       else if (document.getElementById) {\r
+               return (document.getElementById(e))? true:false;\r
+       }\r
+       else if (document.all) {\r
+               return (document.all[e])? true:false;\r
+       }\r
+       else return false;\r
+}\r
+\r
+\r
+// constructor mods (ie4 fix)\r
+\r
+var termString_keyref;\r
+var termString_keycoderef;\r
+\r
+function termString_makeKeyref() {\r
+       termString_keyref= new Array();\r
+       termString_keycoderef= new Array();\r
+       var hex= new Array('A','B','C','D','E','F');\r
+       for (var i=0; i<=15; i++) {\r
+               var high=(i<10)? i:hex[i-10];\r
+               for (var k=0; k<=15; k++) {\r
+                       var low=(k<10)? k:hex[k-10];\r
+                       var cc=i*16+k;\r
+                       if (cc>=32) {\r
+                               var cs=unescape("%"+high+low);\r
+                               termString_keyref[cc]=cs;\r
+                               termString_keycoderef[cs]=cc;\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+if (!String.fromCharCode) {\r
+       termString_makeKeyref();\r
+       String.fromCharCode=function(cc) {\r
+               return (cc!=null)? termString_keyref[cc] : '';\r
+       };\r
+}\r
+if (!String.prototype.charCodeAt) {\r
+       if (!termString_keycoderef) termString_makeKeyref();\r
+       String.prototype.charCodeAt=function(n) {\r
+               cs=this.charAt(n);\r
+               return (termString_keycoderef[cs])? termString_keycoderef[cs] : 0;\r
+       };\r
+}\r
+\r
+// eof
\ No newline at end of file
diff --git a/extra/webapps/fjsc/resources/termlib/termlib_parser.js b/extra/webapps/fjsc/resources/termlib/termlib_parser.js
new file mode 100644 (file)
index 0000000..27c0c5f
--- /dev/null
@@ -0,0 +1,199 @@
+/*\r
+  termlib_parser.js  v.1.0\r
+  command line parser for termlib.js\r
+  (c) Norbert Landsteiner 2005\r
+  mass:werk - media environments\r
+  <http://www.masswerk.at>\r
+\r
+  you are free to use this parser under the "termlib.js" license.\r
+\r
+  usage:  call "parseLine(this)" from your Terminal handler\r
+          parsed args in this.argv\r
+          quoting levels per arg in this.argQL (value: quote char)\r
+          this.argc: pointer to this.argv and this.argQL (used by parserGetopt)\r
+          call parseretopt(this, "<options>") from your handler to get opts\r
+          (returns an object with properties for every option flag. any float\r
+          values are stored in Object.<flag>.value; illegal opts in array\r
+          Object.illegals)\r
+\r
+  configuration: you may want to overide the follow objects (or add properties):\r
+          parserWhiteSpace: chars to be parsed as whitespace\r
+          parserQuoteChars: chars to be parsed as quotes\r
+          parserSingleEscapes: chars to escape a quote or escape expression\r
+          parserOptionChars: chars that start an option\r
+          parserEscapeExpressions: chars that start escape expressions\r
+*/\r
+\r
+// chars to be parsed as white space\r
+var parserWhiteSpace = {\r
+       ' ': true,\r
+       '\t': true\r
+}\r
+\r
+// chars to be parsed as quotes\r
+var parserQuoteChars = {\r
+       '"': true,\r
+       "'": true,\r
+       '`': true\r
+};\r
+\r
+// chars to be parsed as escape char\r
+var parserSingleEscapes = {\r
+       '\\': true\r
+};\r
+\r
+// chars that mark the start of an option-expression\r
+// for use with parserGetopt\r
+var parserOptionChars = {\r
+       '-': true\r
+}\r
+\r
+// chars that start escape expressions (value = handler)\r
+// plugin handlers for ascii escapes or variable substitution\r
+var parserEscapeExpressions = {\r
+       '%': parserHexExpression\r
+}\r
+\r
+function parserHexExpression(termref, pointer, echar, quotelevel) {\r
+       /* example for parserEscapeExpressions\r
+          params:\r
+            termref: ref to Terminal instance\r
+            pointer: position in termref.lineBuffer (echar)\r
+            echar:   escape character found\r
+            quotelevel: current quoting level (quote char or empty)\r
+          char under pointer will be ignored\r
+          the return value is added to the current argument\r
+       */\r
+       // convert hex values to chars (e.g. %20 => <SPACE>)\r
+       if (termref.lineBuffer.length > pointer+2) {\r
+               // get next 2 chars\r
+               var hi = termref.lineBuffer.charAt(pointer+1);\r
+               var lo = termref.lineBuffer.charAt(pointer+2);\r
+               lo = lo.toUpperCase();\r
+               hi = hi.toUpperCase();\r
+               // check for valid hex digits\r
+               if ((((hi>='0') && (hi<='9')) || ((hi>='A') && ((hi<='F')))) &&\r
+                   (((lo>='0') && (lo<='9')) || ((lo>='A') && ((lo<='F'))))) {\r
+                       // next 2 chars are valid hex, so strip them from lineBuffer\r
+                       parserEscExprStrip(termref, pointer+1, pointer+3);\r
+                       // and return the char\r
+                       return String.fromCharCode(parseInt(hi+lo, 16));\r
+               }\r
+       }\r
+       // if not handled return the escape character (=> no conversion)\r
+       return echar;\r
+}\r
+\r
+function parserEscExprStrip(termref, from, to) {\r
+       // strip characters from termref.lineBuffer (for use with escape expressions)\r
+       termref.lineBuffer =\r
+               termref.lineBuffer.substring(0, from) +\r
+               termref.lineBuffer.substring(to);\r
+}\r
+\r
+function parserGetopt(termref, optsstring) {\r
+    // scans argv form current position of argc for opts\r
+    // arguments in argv must not be quoted\r
+       // returns an object with a property for every option flag found\r
+       // option values (absolute floats) are stored in Object.<opt>.value (default -1)\r
+       // the property "illegals" contains an array of  all flags found but not in optstring\r
+       // argc is set to first argument that is not an option\r
+       var opts = { 'illegals':[] };\r
+       while ((termref.argc < termref.argv.length) && (termref.argQL[termref.argc]==''))  {\r
+               var a = termref.argv[termref.argc];\r
+               if ((a.length>0) && (parserOptionChars[a.charAt(0)])) {\r
+                       var i = 1;\r
+                       while (i<a.length) {\r
+                               var c=a.charAt(i);\r
+                               var v = '';\r
+                               while (i<a.length-1) {\r
+                                       var nc=a.charAt(i+1);\r
+                                       if ((nc=='.') || ((nc>='0') && (nc<='9'))) {\r
+                                               v += nc;\r
+                                               i++;\r
+                                       }\r
+                                       else break;\r
+                               }\r
+                               if (optsstring.indexOf(c)>=0) {\r
+                                       opts[c] = (v == '')? {value:-1} : (isNaN(v))? {value:0} : {value:parseFloat(v)};\r
+                               }\r
+                               else {\r
+                                       opts.illegals[opts.illegals.length]=c;\r
+                               }\r
+                               i++;\r
+                       }\r
+                       termref.argc++;\r
+               }\r
+               else break;\r
+       }\r
+       return opts;\r
+}\r
+\r
+function parseLine(termref) {\r
+       // stand-alone parser, takes a Terminal instance as argument\r
+       // parses the command line and stores results as instance properties\r
+       //   argv:  list of parsed arguments\r
+       //   argQL: argument's quoting level (<empty> or quote character)\r
+       //   argc:  cursur for argv, set initinally to zero (0)\r
+       // open quote strings are not an error but automatically closed.\r
+       var argv = [''];     // arguments vector\r
+       var argQL = [''];    // quoting level\r
+       var argc = 0;        // arguments cursor\r
+       var escape = false ; // escape flag\r
+       for (var i=0; i<termref.lineBuffer.length; i++) {\r
+               var ch= termref.lineBuffer.charAt(i);\r
+               if (escape) {\r
+                       argv[argc] += ch;\r
+                       escape = false;\r
+               }\r
+               else if (parserEscapeExpressions[ch]) {\r
+                       var v = parserEscapeExpressions[ch](termref, i, ch, argQL[argc]);\r
+                       if (typeof v != 'undefined') argv[argc] += v;\r
+               }\r
+               else if (parserQuoteChars[ch]) {\r
+                       if (argQL[argc]) {\r
+                               if (argQL[argc] == ch) {\r
+                                       argc ++;\r
+                                       argv[argc] = argQL[argc] = '';\r
+                               }\r
+                               else {\r
+                                       argv[argc] += ch;\r
+                               }\r
+                       }\r
+                       else {\r
+                               if (argv[argc] != '') {\r
+                                       argc ++;\r
+                                       argv[argc] = '';\r
+                                       argQL[argc] = ch;\r
+                               }\r
+                               else {\r
+                                       argQL[argc] = ch;\r
+                               }\r
+                       }\r
+               }\r
+               else if (parserWhiteSpace[ch]) {\r
+                       if (argQL[argc]) {\r
+                               argv[argc] += ch;\r
+                       }\r
+                       else if (argv[argc] != '') {\r
+                               argc++;\r
+                               argv[argc] = argQL[argc] = '';\r
+                       }\r
+               }\r
+               else if (parserSingleEscapes[ch]) {\r
+                       escape = true;\r
+               }\r
+               else {\r
+                       argv[argc] += ch;\r
+               }\r
+       }\r
+       if ((argv[argc] == '') && (!argQL[argc])) {\r
+               argv.length--;\r
+               argQL.length--;\r
+       }\r
+       termref.argv = argv;\r
+       termref.argQL = argQL;\r
+       termref.argc = 0;\r
+}\r
+\r
+// eof
\ No newline at end of file
diff --git a/extra/webapps/fjsc/summary.txt b/extra/webapps/fjsc/summary.txt
new file mode 100644 (file)
index 0000000..74e8bbb
--- /dev/null
@@ -0,0 +1 @@
+Web interface for Factor to Javascript compiler
diff --git a/extra/webapps/fjsc/tags.txt b/extra/webapps/fjsc/tags.txt
new file mode 100644 (file)
index 0000000..1b93c9e
--- /dev/null
@@ -0,0 +1 @@
+webapp
diff --git a/extra/webapps/help/help.factor b/extra/webapps/help/help.factor
new file mode 100644 (file)
index 0000000..ec0590d
--- /dev/null
@@ -0,0 +1,81 @@
+! Copyright (C) 2005, 2007 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel furnace furnace.validator http.server.responders
+       help help.topics html splitting sequences words strings 
+       quotations macros vocabs tools.browser combinators
+       arrays io.files ;
+IN: webapps.help 
+
+: show-help ( topic -- )
+    serving-html
+    dup article-title [
+        [ help ] with-html-stream
+    ] html-document ;
+
+: string>topic ( string -- topic )
+    " " split dup length 1 = [ first ] when ;
+
+\ show-help {
+    { "topic" "handbook" v-default string>topic }
+} define-action
+
+M: link browser-link-href
+    link-name 
+    dup word? [
+        browser-link-href
+    ] [
+        dup array? [ " " join ] when
+        [ show-help ] curry quot-link
+    ] if ;
+
+: show-word ( word vocab -- )
+    lookup show-help ;
+
+\ show-word {
+    { "vocab" "kernel" v-default }
+    { "word" "call" v-default }
+} define-action
+
+M: word browser-link-href
+    dup word-name swap word-vocabulary
+    [ show-word ] 2curry quot-link ;
+
+: show-vocab ( vocab -- )
+    f >vocab-link show-help ;
+
+\ show-vocab {
+    { "vocab" "kernel" v-default }
+} define-action
+
+M: vocab-spec browser-link-href
+    vocab-name [ show-vocab ] curry quot-link ;
+
+: show-vocabs-tagged ( tag -- )
+    <vocab-tag> show-help ;
+
+\ show-vocabs-tagged {
+    { "tag" }
+} define-action
+
+M: vocab-tag browser-link-href
+    vocab-tag-name [ show-vocabs-tagged ] curry quot-link ;
+
+: show-vocabs-by ( author -- )
+    <vocab-author> show-help ;
+
+\ show-vocabs-by {
+    { "author" }
+} define-action
+
+M: vocab-author browser-link-href
+    vocab-author-name [ show-vocabs-by ] curry quot-link ;
+
+"help" "show-help" "extra/webapps/help" web-app
+
+! Hard-coding for factorcode.org
+M: pathname browser-link-href
+    pathname-string "resource:" ?head [
+        "http://factorcode.org/repos/Factor/" swap append
+    ] [
+        drop f
+    ] if ;
diff --git a/extra/windows/advapi32/advapi32.factor b/extra/windows/advapi32/advapi32.factor
new file mode 100644 (file)
index 0000000..a749fcb
--- /dev/null
@@ -0,0 +1,753 @@
+USING: alien.syntax kernel math windows.types ;\r
+IN: windows.advapi32\r
+LIBRARY: advapi32\r
+\r
+! : I_ScGetCurrentGroupStateW ;\r
+! : A_SHAFinal ;\r
+! : A_SHAInit ;\r
+! : A_SHAUpdate ;\r
+! : AbortSystemShutdownA ;\r
+! : AbortSystemShutdownW ;\r
+! : AccessCheck ;\r
+! : AccessCheckAndAuditAlarmA ;\r
+! : AccessCheckAndAuditAlarmW ;\r
+! : AccessCheckByType ;\r
+! : AccessCheckByTypeAndAuditAlarmA ;\r
+! : AccessCheckByTypeAndAuditAlarmW ;\r
+! : AccessCheckByTypeResultList ;\r
+! : AccessCheckByTypeResultListAndAuditAlarmA ;\r
+! : AccessCheckByTypeResultListAndAuditAlarmByHandleA ;\r
+! : AccessCheckByTypeResultListAndAuditAlarmByHandleW ;\r
+! : AccessCheckByTypeResultListAndAuditAlarmW ;\r
+! : AddAccessAllowedAce ;\r
+! : AddAccessAllowedAceEx ;\r
+! : AddAccessAllowedObjectAce ;\r
+! : AddAccessDeniedAce ;\r
+! : AddAccessDeniedAceEx ;\r
+! : AddAccessDeniedObjectAce ;\r
+! : AddAce ;\r
+! : AddAuditAccessAce ;\r
+! : AddAuditAccessAceEx ;\r
+! : AddAuditAccessObjectAce ;\r
+! : AddUsersToEncryptedFile ;\r
+! : AdjustTokenGroups ;\r
+FUNCTION: BOOL AdjustTokenPrivileges ( HANDLE TokenHandle,\r
+                               BOOL DisableAllPrivileges,\r
+                               PTOKEN_PRIVILEGES NewState,\r
+                               DWORD BufferLength,\r
+                               PTOKEN_PRIVILEGES PreviousState,\r
+                               PDWORD ReturnLength ) ;\r
+\r
+! : AllocateAndInitializeSid ;\r
+! : AllocateLocallyUniqueId ;\r
+! : AreAllAccessesGranted ;\r
+! : AreAnyAccessesGranted ;\r
+! : BackupEventLogA ;\r
+! : BackupEventLogW ;\r
+! : BuildExplicitAccessWithNameA ;\r
+! : BuildExplicitAccessWithNameW ;\r
+! : BuildImpersonateExplicitAccessWithNameA ;\r
+! : BuildImpersonateExplicitAccessWithNameW ;\r
+! : BuildImpersonateTrusteeA ;\r
+! : BuildImpersonateTrusteeW ;\r
+! : BuildSecurityDescriptorA ;\r
+! : BuildSecurityDescriptorW ;\r
+! : BuildTrusteeWithNameA ;\r
+! : BuildTrusteeWithNameW ;\r
+! : BuildTrusteeWithObjectsAndNameA ;\r
+! : BuildTrusteeWithObjectsAndNameW ;\r
+! : BuildTrusteeWithObjectsAndSidA ;\r
+! : BuildTrusteeWithObjectsAndSidW ;\r
+! : BuildTrusteeWithSidA ;\r
+! : BuildTrusteeWithSidW ;\r
+! : CancelOverlappedAccess ;\r
+! : ChangeServiceConfig2A ;\r
+! : ChangeServiceConfig2W ;\r
+! : ChangeServiceConfigA ;\r
+! : ChangeServiceConfigW ;\r
+! : CheckTokenMembership ;\r
+! : ClearEventLogA ;\r
+! : ClearEventLogW ;\r
+! : CloseCodeAuthzLevel ;\r
+! : CloseEncryptedFileRaw ;\r
+! : CloseEventLog ;\r
+! : CloseServiceHandle ;\r
+! : CloseTrace ;\r
+! : CommandLineFromMsiDescriptor ;\r
+! : ComputeAccessTokenFromCodeAuthzLevel ;\r
+! : ControlService ;\r
+! : ControlTraceA ;\r
+! : ControlTraceW ;\r
+! : ConvertAccessToSecurityDescriptorA ;\r
+! : ConvertAccessToSecurityDescriptorW ;\r
+! : ConvertSDToStringSDRootDomainA ;\r
+! : ConvertSDToStringSDRootDomainW ;\r
+! : ConvertSecurityDescriptorToAccessA ;\r
+! : ConvertSecurityDescriptorToAccessNamedA ;\r
+! : ConvertSecurityDescriptorToAccessNamedW ;\r
+! : ConvertSecurityDescriptorToAccessW ;\r
+! : ConvertSecurityDescriptorToStringSecurityDescriptorA ;\r
+! : ConvertSecurityDescriptorToStringSecurityDescriptorW ;\r
+! : ConvertSidToStringSidA ;\r
+! : ConvertSidToStringSidW ;\r
+! : ConvertStringSDToSDDomainA ;\r
+! : ConvertStringSDToSDDomainW ;\r
+! : ConvertStringSDToSDRootDomainA ;\r
+! : ConvertStringSDToSDRootDomainW ;\r
+! : ConvertStringSecurityDescriptorToSecurityDescriptorA ;\r
+! : ConvertStringSecurityDescriptorToSecurityDescriptorW ;\r
+! : ConvertStringSidToSidA ;\r
+! : ConvertStringSidToSidW ;\r
+! : ConvertToAutoInheritPrivateObjectSecurity ;\r
+! : CopySid ;\r
+! : CreateCodeAuthzLevel ;\r
+! : CreatePrivateObjectSecurity ;\r
+! : CreatePrivateObjectSecurityEx ;\r
+! : CreatePrivateObjectSecurityWithMultipleInheritance ;\r
+! : CreateProcessAsUserA ;\r
+! : CreateProcessAsUserSecure ;\r
+! : CreateProcessAsUserW ;\r
+! : CreateProcessWithLogonW ;\r
+! : CreateRestrictedToken ;\r
+! : CreateServiceA ;\r
+! : CreateServiceW ;\r
+! : CreateTraceInstanceId ;\r
+! : CreateWellKnownSid ;\r
+! : CredDeleteA ;\r
+! : CredDeleteW ;\r
+! : CredEnumerateA ;\r
+! : CredEnumerateW ;\r
+! : CredFree ;\r
+! : CredGetSessionTypes ;\r
+! : CredGetTargetInfoA ;\r
+! : CredGetTargetInfoW ;\r
+! : CredIsMarshaledCredentialA ;\r
+! : CredIsMarshaledCredentialW ;\r
+! : CredMarshalCredentialA ;\r
+! : CredMarshalCredentialW ;\r
+! : CredProfileLoaded ;\r
+! : CredReadA ;\r
+! : CredReadDomainCredentialsA ;\r
+! : CredReadDomainCredentialsW ;\r
+! : CredReadW ;\r
+! : CredRenameA ;\r
+! : CredRenameW ;\r
+! : CredUnmarshalCredentialA ;\r
+! : CredUnmarshalCredentialW ;\r
+! : CredWriteA ;\r
+! : CredWriteDomainCredentialsA ;\r
+! : CredWriteDomainCredentialsW ;\r
+! : CredWriteW ;\r
+! : CredpConvertCredential ;\r
+! : CredpConvertTargetInfo ;\r
+! : CredpDecodeCredential ;\r
+! : CredpEncodeCredential ;\r
+! : CryptAcquireContextA ;\r
+! : CryptAcquireContextW ;\r
+! : CryptContextAddRef ;\r
+! : CryptCreateHash ;\r
+! : CryptDecrypt ;\r
+! : CryptDeriveKey ;\r
+! : CryptDestroyHash ;\r
+! : CryptDestroyKey ;\r
+! : CryptDuplicateHash ;\r
+! : CryptDuplicateKey ;\r
+! : CryptEncrypt ;\r
+! : CryptEnumProviderTypesA ;\r
+! : CryptEnumProviderTypesW ;\r
+! : CryptEnumProvidersA ;\r
+! : CryptEnumProvidersW ;\r
+! : CryptExportKey ;\r
+! : CryptGenKey ;\r
+! : CryptGenRandom ;\r
+! : CryptGetDefaultProviderA ;\r
+! : CryptGetDefaultProviderW ;\r
+! : CryptGetHashParam ;\r
+! : CryptGetKeyParam ;\r
+! : CryptGetProvParam ;\r
+! : CryptGetUserKey ;\r
+! : CryptHashData ;\r
+! : CryptHashSessionKey ;\r
+! : CryptImportKey ;\r
+! : CryptReleaseContext ;\r
+! : CryptSetHashParam ;\r
+! : CryptSetKeyParam ;\r
+! : CryptSetProvParam ;\r
+! : CryptSetProviderA ;\r
+! : CryptSetProviderExA ;\r
+! : CryptSetProviderExW ;\r
+! : CryptSetProviderW ;\r
+! : CryptSignHashA ;\r
+! : CryptSignHashW ;\r
+! : CryptVerifySignatureA ;\r
+! : CryptVerifySignatureW ;\r
+! : DecryptFileA ;\r
+! : DecryptFileW ;\r
+! : DeleteAce ;\r
+! : DeleteService ;\r
+! : DeregisterEventSource ;\r
+! : DestroyPrivateObjectSecurity ;\r
+! : DuplicateEncryptionInfoFile ;\r
+! : DuplicateToken ;\r
+! : DuplicateTokenEx ;\r
+! : ElfBackupEventLogFileA ;\r
+! : ElfBackupEventLogFileW ;\r
+! : ElfChangeNotify ;\r
+! : ElfClearEventLogFileA ;\r
+! : ElfClearEventLogFileW ;\r
+! : ElfCloseEventLog ;\r
+! : ElfDeregisterEventSource ;\r
+! : ElfFlushEventLog ;\r
+! : ElfNumberOfRecords ;\r
+! : ElfOldestRecord ;\r
+! : ElfOpenBackupEventLogA ;\r
+! : ElfOpenBackupEventLogW ;\r
+! : ElfOpenEventLogA ;\r
+! : ElfOpenEventLogW ;\r
+! : ElfReadEventLogA ;\r
+! : ElfReadEventLogW ;\r
+! : ElfRegisterEventSourceA ;\r
+! : ElfRegisterEventSourceW ;\r
+! : ElfReportEventA ;\r
+! : ElfReportEventW ;\r
+! : EnableTrace ;\r
+! : EncryptFileA ;\r
+! : EncryptFileW ;\r
+! : EncryptedFileKeyInfo ;\r
+! : EncryptionDisable ;\r
+! : EnumDependentServicesA ;\r
+! : EnumDependentServicesW ;\r
+! : EnumServiceGroupW ;\r
+! : EnumServicesStatusA ;\r
+! : EnumServicesStatusExA ;\r
+! : EnumServicesStatusExW ;\r
+! : EnumServicesStatusW ;\r
+! : EnumerateTraceGuids ;\r
+! : EqualDomainSid ;\r
+! : EqualPrefixSid ;\r
+! : EqualSid ;\r
+! : FileEncryptionStatusA ;\r
+! : FileEncryptionStatusW ;\r
+! : FindFirstFreeAce ;\r
+! : FlushTraceA ;\r
+! : FlushTraceW ;\r
+! : FreeEncryptedFileKeyInfo ;\r
+! : FreeEncryptionCertificateHashList ;\r
+! : FreeInheritedFromArray ;\r
+! : FreeSid ;\r
+! : GetAccessPermissionsForObjectA ;\r
+! : GetAccessPermissionsForObjectW ;\r
+! : GetAce ;\r
+! : GetAclInformation ;\r
+! : GetAuditedPermissionsFromAclA ;\r
+! : GetAuditedPermissionsFromAclW ;\r
+! : GetCurrentHwProfileA ;\r
+! : GetCurrentHwProfileW ;\r
+! : GetEffectiveRightsFromAclA ;\r
+! : GetEffectiveRightsFromAclW ;\r
+! : GetEventLogInformation ;\r
+! : GetExplicitEntriesFromAclA ;\r
+! : GetExplicitEntriesFromAclW ;\r
+! : GetFileSecurityA ;\r
+! : GetFileSecurityW ;\r
+! : GetInformationCodeAuthzLevelW ;\r
+! : GetInformationCodeAuthzPolicyW ;\r
+! : GetInheritanceSourceA ;\r
+! : GetInheritanceSourceW ;\r
+! : GetKernelObjectSecurity ;\r
+! : GetLengthSid ;\r
+! : GetLocalManagedApplicationData ;\r
+! : GetLocalManagedApplications ;\r
+! : GetManagedApplicationCategories ;\r
+! : GetManagedApplications ;\r
+! : GetMultipleTrusteeA ;\r
+! : GetMultipleTrusteeOperationA ;\r
+! : GetMultipleTrusteeOperationW ;\r
+! : GetMultipleTrusteeW ;\r
+! : GetNamedSecurityInfoA ;\r
+! : GetNamedSecurityInfoExA ;\r
+! : GetNamedSecurityInfoExW ;\r
+! : GetNamedSecurityInfoW ;\r
+! : GetNumberOfEventLogRecords ;\r
+! : GetOldestEventLogRecord ;\r
+! : GetOverlappedAccessResults ;\r
+! : GetPrivateObjectSecurity ;\r
+! : GetSecurityDescriptorControl ;\r
+! : GetSecurityDescriptorDacl ;\r
+! : GetSecurityDescriptorGroup ;\r
+! : GetSecurityDescriptorLength ;\r
+! : GetSecurityDescriptorOwner ;\r
+! : GetSecurityDescriptorRMControl ;\r
+! : GetSecurityDescriptorSacl ;\r
+! : GetSecurityInfo ;\r
+! : GetSecurityInfoExA ;\r
+! : GetSecurityInfoExW ;\r
+! : GetServiceDisplayNameA ;\r
+! : GetServiceDisplayNameW ;\r
+! : GetServiceKeyNameA ;\r
+! : GetServiceKeyNameW ;\r
+! : GetSidIdentifierAuthority ;\r
+! : GetSidLengthRequired ;\r
+! : GetSidSubAuthority ;\r
+! : GetSidSubAuthorityCount ;\r
+! : GetTokenInformation ;\r
+! : GetTraceEnableFlags ;\r
+! : GetTraceEnableLevel ;\r
+! : GetTraceLoggerHandle ;\r
+! : GetTrusteeFormA ;\r
+! : GetTrusteeFormW ;\r
+! : GetTrusteeNameA ;\r
+! : GetTrusteeNameW ;\r
+! : GetTrusteeTypeA ;\r
+! : GetTrusteeTypeW ;\r
+\r
+! : GetUserNameA ;\r
+FUNCTION: BOOL GetUserNameW ( LPCTSTR lpBuffer, LPDWORD lpnSize ) ;\r
+: GetUserName GetUserNameW ;\r
+\r
+! : GetWindowsAccountDomainSid ;\r
+! : I_ScIsSecurityProcess ;\r
+! : I_ScPnPGetServiceName ;\r
+! : I_ScSendTSMessage ;\r
+! : I_ScSetServiceBitsA ;\r
+! : I_ScSetServiceBitsW ;\r
+! : IdentifyCodeAuthzLevelW ;\r
+! : ImpersonateAnonymousToken ;\r
+! : ImpersonateLoggedOnUser ;\r
+! : ImpersonateNamedPipeClient ;\r
+! : ImpersonateSelf ;\r
+! : InitializeAcl ;\r
+! : InitializeSecurityDescriptor ;\r
+! : InitializeSid ;\r
+! : InitiateSystemShutdownA ;\r
+! : InitiateSystemShutdownExA ;\r
+! : InitiateSystemShutdownExW ;\r
+! : InitiateSystemShutdownW ;\r
+! : InstallApplication ;\r
+! : IsTextUnicode ;\r
+! : IsTokenRestricted ;\r
+! : IsTokenUntrusted ;\r
+! : IsValidAcl ;\r
+! : IsValidSecurityDescriptor ;\r
+! : IsValidSid ;\r
+! : IsWellKnownSid ;\r
+! : LockServiceDatabase ;\r
+! : LogonUserA ;\r
+! : LogonUserExA ;\r
+! : LogonUserExW ;\r
+! : LogonUserW ;\r
+! : LookupAccountNameA ;\r
+! : LookupAccountNameW ;\r
+! : LookupAccountSidA ;\r
+! : LookupAccountSidW ;\r
+! : LookupPrivilegeDisplayNameA ;\r
+! : LookupPrivilegeDisplayNameW ;\r
+! : LookupPrivilegeNameA ;\r
+! : LookupPrivilegeNameW ;\r
+! : LookupPrivilegeValueA ;\r
+FUNCTION: BOOL LookupPrivilegeValueW ( LPCTSTR lpSystemName,\r
+                               LPCTSTR lpName,\r
+                               PLUID lpLuid ) ;\r
+: LookupPrivilegeValue LookupPrivilegeValueW ;\r
+\r
+! : LookupSecurityDescriptorPartsA ;\r
+! : LookupSecurityDescriptorPartsW ;\r
+! : LsaAddAccountRights ;\r
+! : LsaAddPrivilegesToAccount ;\r
+! : LsaClearAuditLog ;\r
+! : LsaClose ;\r
+! : LsaCreateAccount ;\r
+! : LsaCreateSecret ;\r
+! : LsaCreateTrustedDomain ;\r
+! : LsaCreateTrustedDomainEx ;\r
+! : LsaDelete ;\r
+! : LsaDeleteTrustedDomain ;\r
+! : LsaEnumerateAccountRights ;\r
+! : LsaEnumerateAccounts ;\r
+! : LsaEnumerateAccountsWithUserRight ;\r
+! : LsaEnumeratePrivileges ;\r
+! : LsaEnumeratePrivilegesOfAccount ;\r
+! : LsaEnumerateTrustedDomains ;\r
+! : LsaEnumerateTrustedDomainsEx ;\r
+! : LsaFreeMemory ;\r
+! : LsaGetQuotasForAccount ;\r
+! : LsaGetRemoteUserName ;\r
+! : LsaGetSystemAccessAccount ;\r
+! : LsaGetUserName ;\r
+! : LsaICLookupNames ;\r
+! : LsaICLookupNamesWithCreds ;\r
+! : LsaICLookupSids ;\r
+! : LsaICLookupSidsWithCreds ;\r
+! : LsaLookupNames2 ;\r
+! : LsaLookupNames ;\r
+! : LsaLookupPrivilegeDisplayName ;\r
+! : LsaLookupPrivilegeName ;\r
+! : LsaLookupPrivilegeValue ;\r
+! : LsaLookupSids ;\r
+! : LsaNtStatusToWinError ;\r
+! : LsaOpenAccount ;\r
+! : LsaOpenPolicy ;\r
+! : LsaOpenPolicySce ;\r
+! : LsaOpenSecret ;\r
+! : LsaOpenTrustedDomain ;\r
+! : LsaOpenTrustedDomainByName ;\r
+! : LsaQueryDomainInformationPolicy ;\r
+! : LsaQueryForestTrustInformation ;\r
+! : LsaQueryInfoTrustedDomain ;\r
+! : LsaQueryInformationPolicy ;\r
+! : LsaQuerySecret ;\r
+! : LsaQuerySecurityObject ;\r
+! : LsaQueryTrustedDomainInfo ;\r
+! : LsaQueryTrustedDomainInfoByName ;\r
+! : LsaRemoveAccountRights ;\r
+! : LsaRemovePrivilegesFromAccount ;\r
+! : LsaRetrievePrivateData ;\r
+! : LsaSetDomainInformationPolicy ;\r
+! : LsaSetForestTrustInformation ;\r
+! : LsaSetInformationPolicy ;\r
+! : LsaSetInformationTrustedDomain ;\r
+! : LsaSetQuotasForAccount ;\r
+! : LsaSetSecret ;\r
+! : LsaSetSecurityObject ;\r
+! : LsaSetSystemAccessAccount ;\r
+! : LsaSetTrustedDomainInfoByName ;\r
+! : LsaSetTrustedDomainInformation ;\r
+! : LsaStorePrivateData ;\r
+! : MD4Final ;\r
+! : MD4Init ;\r
+! : MD4Update ;\r
+! : MD5Final ;\r
+! : MD5Init ;\r
+! : MD5Update ;\r
+! : MSChapSrvChangePassword2 ;\r
+! : MSChapSrvChangePassword ;\r
+! : MakeAbsoluteSD2 ;\r
+! : MakeAbsoluteSD ;\r
+! : MakeSelfRelativeSD ;\r
+! : MapGenericMask ;\r
+! : NotifyBootConfigStatus ;\r
+! : NotifyChangeEventLog ;\r
+! : ObjectCloseAuditAlarmA ;\r
+! : ObjectCloseAuditAlarmW ;\r
+! : ObjectDeleteAuditAlarmA ;\r
+! : ObjectDeleteAuditAlarmW ;\r
+! : ObjectOpenAuditAlarmA ;\r
+! : ObjectOpenAuditAlarmW ;\r
+! : ObjectPrivilegeAuditAlarmA ;\r
+! : ObjectPrivilegeAuditAlarmW ;\r
+! : OpenBackupEventLogA ;\r
+! : OpenBackupEventLogW ;\r
+! : OpenEncryptedFileRawA ;\r
+! : OpenEncryptedFileRawW ;\r
+! : OpenEventLogA ;\r
+! : OpenEventLogW ;\r
+\r
+! typedef enum _TOKEN_INFORMATION_CLASS {\r
+: TokenUser 1 ;\r
+: TokenGroups 2 ;\r
+: TokenPrivileges 3 ;\r
+: TokenOwner 4 ;\r
+: TokenPrimaryGroup 5 ;\r
+: TokenDefaultDacl 6 ;\r
+: TokenSource 7 ;\r
+: TokenType 8 ;\r
+: TokenImpersonationLevel 9 ;\r
+: TokenStatistics 10 ;\r
+: TokenRestrictedSids 11 ;\r
+: TokenSessionId 12 ;\r
+: TokenGroupsAndPrivileges 13 ;\r
+: TokenSessionReference 14 ;\r
+: TokenSandBoxInert 15 ;\r
+! } TOKEN_INFORMATION_CLASS;\r
+\r
+: DELETE                     HEX: 00010000 ; inline\r
+: READ_CONTROL               HEX: 00020000 ; inline\r
+: WRITE_DAC                  HEX: 00040000 ; inline\r
+: WRITE_OWNER                HEX: 00080000 ; inline\r
+: SYNCHRONIZE                HEX: 00100000 ; inline\r
+: STANDARD_RIGHTS_REQUIRED   HEX: 000f0000 ; inline\r
+\r
+: STANDARD_RIGHTS_READ       READ_CONTROL ; inline\r
+: STANDARD_RIGHTS_WRITE      READ_CONTROL ; inline\r
+: STANDARD_RIGHTS_EXECUTE    READ_CONTROL ; inline\r
+\r
+: TOKEN_TOKEN_ADJUST_DEFAULT   HEX: 0080 ; inline\r
+: TOKEN_ADJUST_GROUPS          HEX: 0040 ; inline\r
+: TOKEN_ADJUST_PRIVILEGES      HEX: 0020 ; inline\r
+: TOKEN_ADJUST_SESSIONID       HEX: 0100 ; inline\r
+: TOKEN_ASSIGN_PRIMARY         HEX: 0001 ; inline\r
+: TOKEN_DUPLICATE              HEX: 0002 ; inline\r
+: TOKEN_EXECUTE                STANDARD_RIGHTS_EXECUTE ; inline\r
+: TOKEN_IMPERSONATE            HEX: 0004 ; inline\r
+: TOKEN_QUERY                  HEX: 0008 ; inline\r
+: TOKEN_QUERY_SOURCE           HEX: 0010 ; inline\r
+: TOKEN_ADJUST_DEFAULT         HEX: 0080 ; inline\r
+: TOKEN_READ STANDARD_RIGHTS_READ TOKEN_QUERY bitor ;\r
+: TOKEN_WRITE       STANDARD_RIGHTS_WRITE\r
+                                       TOKEN_ADJUST_PRIVILEGES bitor\r
+                                       TOKEN_ADJUST_GROUPS bitor\r
+                                       TOKEN_ADJUST_DEFAULT bitor ; foldable\r
+: TOKEN_ALL_ACCESS  STANDARD_RIGHTS_REQUIRED\r
+                                       TOKEN_ASSIGN_PRIMARY bitor\r
+                                       TOKEN_DUPLICATE bitor\r
+                                       TOKEN_IMPERSONATE bitor\r
+                                       TOKEN_QUERY bitor\r
+                                       TOKEN_QUERY_SOURCE bitor\r
+                                       TOKEN_ADJUST_PRIVILEGES bitor\r
+                                       TOKEN_ADJUST_GROUPS bitor\r
+                                       TOKEN_ADJUST_SESSIONID bitor\r
+                                       TOKEN_ADJUST_DEFAULT bitor ; foldable\r
+\r
+FUNCTION: BOOL OpenProcessToken ( HANDLE ProcessHandle,\r
+                                  DWORD DesiredAccess,\r
+                                  PHANDLE TokenHandle ) ;\r
+! : OpenSCManagerA ;\r
+! : OpenSCManagerW ;\r
+! : OpenServiceA ;\r
+! : OpenServiceW ;\r
+FUNCTION: BOOL OpenThreadToken ( HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, PHANDLE TokenHandle ) ;\r
+! : OpenTraceA ;\r
+! : OpenTraceW ;\r
+! : PrivilegeCheck ;\r
+! : PrivilegedServiceAuditAlarmA ;\r
+! : PrivilegedServiceAuditAlarmW ;\r
+! : ProcessIdleTasks ;\r
+! : ProcessTrace ;\r
+! : QueryAllTracesA ;\r
+! : QueryAllTracesW ;\r
+! : QueryRecoveryAgentsOnEncryptedFile ;\r
+! : QueryServiceConfig2A ;\r
+! : QueryServiceConfig2W ;\r
+! : QueryServiceConfigA ;\r
+! : QueryServiceConfigW ;\r
+! : QueryServiceLockStatusA ;\r
+! : QueryServiceLockStatusW ;\r
+! : QueryServiceObjectSecurity ;\r
+! : QueryServiceStatus ;\r
+! : QueryServiceStatusEx ;\r
+! : QueryTraceA ;\r
+! : QueryTraceW ;\r
+! : QueryUsersOnEncryptedFile ;\r
+! : QueryWindows31FilesMigration ;\r
+! : ReadEncryptedFileRaw ;\r
+! : ReadEventLogA ;\r
+! : ReadEventLogW ;\r
+! : RegCloseKey ;\r
+! : RegConnectRegistryA ;\r
+! : RegConnectRegistryW ;\r
+! : RegCreateKeyA ;\r
+! : RegCreateKeyExA ;\r
+! : RegCreateKeyExW ;\r
+! : RegCreateKeyW ;\r
+! : RegDeleteKeyA ;\r
+! : RegDeleteKeyW ;\r
+! : RegDeleteValueA ;\r
+! : RegDeleteValueW ;\r
+! : RegDisablePredefinedCache ;\r
+! : RegEnumKeyA ;\r
+! : RegEnumKeyExA ;\r
+! : RegEnumKeyExW ;\r
+! : RegEnumKeyW ;\r
+! : RegEnumValueA ;\r
+! : RegEnumValueW ;\r
+! : RegFlushKey ;\r
+! : RegGetKeySecurity ;\r
+! : RegLoadKeyA ;\r
+! : RegLoadKeyW ;\r
+! : RegNotifyChangeKeyValue ;\r
+! : RegOpenCurrentUser ;\r
+! : RegOpenKeyA ;\r
+! : RegOpenKeyExA ;\r
+! : RegOpenKeyExW ;\r
+! : RegOpenKeyW ;\r
+! : RegOpenUserClassesRoot ;\r
+! : RegOverridePredefKey ;\r
+! : RegQueryInfoKeyA ;\r
+! : RegQueryInfoKeyW ;\r
+! : RegQueryMultipleValuesA ;\r
+! : RegQueryMultipleValuesW ;\r
+! : RegQueryValueA ;\r
+! : RegQueryValueExA ;\r
+! : RegQueryValueExW ;\r
+! : RegQueryValueW ;\r
+! : RegReplaceKeyA ;\r
+! : RegReplaceKeyW ;\r
+! : RegRestoreKeyA ;\r
+! : RegRestoreKeyW ;\r
+! : RegSaveKeyA ;\r
+! : RegSaveKeyExA ;\r
+! : RegSaveKeyExW ;\r
+! : RegSaveKeyW ;\r
+! : RegSetKeySecurity ;\r
+! : RegSetValueA ;\r
+! : RegSetValueExA ;\r
+! : RegSetValueExW ;\r
+! : RegSetValueW ;\r
+! : RegUnLoadKeyA ;\r
+! : RegUnLoadKeyW ;\r
+! : RegisterEventSourceA ;\r
+! : RegisterEventSourceW ;\r
+! : RegisterIdleTask ;\r
+! : RegisterServiceCtrlHandlerA ;\r
+! : RegisterServiceCtrlHandlerExA ;\r
+! : RegisterServiceCtrlHandlerExW ;\r
+! : RegisterServiceCtrlHandlerW ;\r
+! : RegisterTraceGuidsA ;\r
+! : RegisterTraceGuidsW ;\r
+! : RemoveTraceCallback ;\r
+! : RemoveUsersFromEncryptedFile ;\r
+! : ReportEventA ;\r
+! : ReportEventW ;\r
+! : RevertToSelf ;\r
+! : SaferCloseLevel ;\r
+! : SaferComputeTokenFromLevel ;\r
+! : SaferCreateLevel ;\r
+! : SaferGetLevelInformation ;\r
+! : SaferGetPolicyInformation ;\r
+! : SaferIdentifyLevel ;\r
+! : SaferRecordEventLogEntry ;\r
+! : SaferSetLevelInformation ;\r
+! : SaferSetPolicyInformation ;\r
+! : SaferiChangeRegistryScope ;\r
+! : SaferiCompareTokenLevels ;\r
+! : SaferiIsExecutableFileType ;\r
+! : SaferiPopulateDefaultsInRegistry ;\r
+! : SaferiRecordEventLogEntry ;\r
+! : SaferiReplaceProcessThreadTokens ;\r
+! : SaferiSearchMatchingHashRules ;\r
+! : SetAclInformation ;\r
+! : SetEntriesInAccessListA ;\r
+! : SetEntriesInAccessListW ;\r
+! : SetEntriesInAclA ;\r
+! : SetEntriesInAclW ;\r
+! : SetEntriesInAuditListA ;\r
+! : SetEntriesInAuditListW ;\r
+! : SetFileSecurityA ;\r
+! : SetFileSecurityW ;\r
+! : SetInformationCodeAuthzLevelW ;\r
+! : SetInformationCodeAuthzPolicyW ;\r
+! : SetKernelObjectSecurity ;\r
+! : SetNamedSecurityInfoA ;\r
+! : SetNamedSecurityInfoExA ;\r
+! : SetNamedSecurityInfoExW ;\r
+! : SetNamedSecurityInfoW ;\r
+! : SetPrivateObjectSecurity ;\r
+! : SetPrivateObjectSecurityEx ;\r
+! : SetSecurityDescriptorControl ;\r
+! : SetSecurityDescriptorDacl ;\r
+! : SetSecurityDescriptorGroup ;\r
+! : SetSecurityDescriptorOwner ;\r
+! : SetSecurityDescriptorRMControl ;\r
+! : SetSecurityDescriptorSacl ;\r
+! : SetSecurityInfo ;\r
+! : SetSecurityInfoExA ;\r
+! : SetSecurityInfoExW ;\r
+! : SetServiceBits ;\r
+! : SetServiceObjectSecurity ;\r
+! : SetServiceStatus ;\r
+! : SetThreadToken ;\r
+! : SetTokenInformation ;\r
+! : SetTraceCallback ;\r
+! : SetUserFileEncryptionKey ;\r
+! : StartServiceA ;\r
+! : StartServiceCtrlDispatcherA ;\r
+! : StartServiceCtrlDispatcherW ;\r
+! : StartServiceW ;\r
+! : StartTraceA ;\r
+! : StartTraceW ;\r
+! : StopTraceA ;\r
+! : StopTraceW ;\r
+! : SynchronizeWindows31FilesAndWindowsNTRegistry ;\r
+! : SystemFunction001 ;\r
+! : SystemFunction002 ;\r
+! : SystemFunction003 ;\r
+! : SystemFunction004 ;\r
+! : SystemFunction005 ;\r
+! : SystemFunction006 ;\r
+! : SystemFunction007 ;\r
+! : SystemFunction008 ;\r
+! : SystemFunction009 ;\r
+! : SystemFunction010 ;\r
+! : SystemFunction011 ;\r
+! : SystemFunction012 ;\r
+! : SystemFunction013 ;\r
+! : SystemFunction014 ;\r
+! : SystemFunction015 ;\r
+! : SystemFunction016 ;\r
+! : SystemFunction017 ;\r
+! : SystemFunction018 ;\r
+! : SystemFunction019 ;\r
+! : SystemFunction020 ;\r
+! : SystemFunction021 ;\r
+! : SystemFunction022 ;\r
+! : SystemFunction023 ;\r
+! : SystemFunction024 ;\r
+! : SystemFunction025 ;\r
+! : SystemFunction026 ;\r
+! : SystemFunction027 ;\r
+! : SystemFunction028 ;\r
+! : SystemFunction029 ;\r
+! : SystemFunction030 ;\r
+! : SystemFunction031 ;\r
+! : SystemFunction032 ;\r
+! : SystemFunction033 ;\r
+! : SystemFunction034 ;\r
+! : SystemFunction035 ;\r
+! : SystemFunction036 ;\r
+! : SystemFunction040 ;\r
+! : SystemFunction041 ;\r
+! : TraceEvent ;\r
+! : TraceEventInstance ;\r
+! : TraceMessage ;\r
+! : TraceMessageVa ;\r
+! : TreeResetNamedSecurityInfoA ;\r
+! : TreeResetNamedSecurityInfoW ;\r
+! : TrusteeAccessToObjectA ;\r
+! : TrusteeAccessToObjectW ;\r
+! : UninstallApplication ;\r
+! : UnlockServiceDatabase ;\r
+! : UnregisterIdleTask ;\r
+! : UnregisterTraceGuids ;\r
+! : UpdateTraceA ;\r
+! : UpdateTraceW ;\r
+! : WdmWmiServiceMain ;\r
+! : WmiCloseBlock ;\r
+! : WmiCloseTraceWithCursor ;\r
+! : WmiConvertTimestamp ;\r
+! : WmiDevInstToInstanceNameA ;\r
+! : WmiDevInstToInstanceNameW ;\r
+! : WmiEnumerateGuids ;\r
+! : WmiExecuteMethodA ;\r
+! : WmiExecuteMethodW ;\r
+! : WmiFileHandleToInstanceNameA ;\r
+! : WmiFileHandleToInstanceNameW ;\r
+! : WmiFreeBuffer ;\r
+! : WmiGetFirstTraceOffset ;\r
+! : WmiGetNextEvent ;\r
+! : WmiGetTraceHeader ;\r
+! : WmiMofEnumerateResourcesA ;\r
+! : WmiMofEnumerateResourcesW ;\r
+! : WmiNotificationRegistrationA ;\r
+! : WmiNotificationRegistrationW ;\r
+! : WmiOpenBlock ;\r
+! : WmiOpenTraceWithCursor ;\r
+! : WmiParseTraceEvent ;\r
+! : WmiQueryAllDataA ;\r
+! : WmiQueryAllDataMultipleA ;\r
+! : WmiQueryAllDataMultipleW ;\r
+! : WmiQueryAllDataW ;\r
+! : WmiQueryGuidInformation ;\r
+! : WmiQuerySingleInstanceA ;\r
+! : WmiQuerySingleInstanceMultipleA ;\r
+! : WmiQuerySingleInstanceMultipleW ;\r
+! : WmiQuerySingleInstanceW ;\r
+! : WmiReceiveNotificationsA ;\r
+! : WmiReceiveNotificationsW ;\r
+! : WmiSetSingleInstanceA ;\r
+! : WmiSetSingleInstanceW ;\r
+! : WmiSetSingleItemA ;\r
+! : WmiSetSingleItemW ;\r
+! : Wow64Win32ApiEntry ;\r
+! : WriteEncryptedFileRaw ;\r
+\r
+\r
diff --git a/extra/windows/authors.txt b/extra/windows/authors.txt
new file mode 100644 (file)
index 0000000..781acc2
--- /dev/null
@@ -0,0 +1,2 @@
+Doug Coleman
+Mackenzie Straight
diff --git a/extra/windows/ce/ce.factor b/extra/windows/ce/ce.factor
new file mode 100644 (file)
index 0000000..1180d78
--- /dev/null
@@ -0,0 +1,14 @@
+USING: alien sequences ;
+{
+    { "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" }
+    ! { "freetype" "libfreetype-6.dll"      "stdcall" }
+} [ first3 add-library ] each
diff --git a/extra/windows/errors/errors.factor b/extra/windows/errors/errors.factor
new file mode 100644 (file)
index 0000000..b0a5972
--- /dev/null
@@ -0,0 +1,8 @@
+USING: kernel ;
+IN: windows.errors 
+
+: ERROR_SUCCESS 0 ; inline
+: ERROR_HANDLE_EOF 38 ; inline
+: ERROR_IO_INCOMPLETE 996 ; inline
+: ERROR_IO_PENDING 997 ; inline
+
diff --git a/extra/windows/gdi32/gdi32.factor b/extra/windows/gdi32/gdi32.factor
new file mode 100644 (file)
index 0000000..b1f9d8a
--- /dev/null
@@ -0,0 +1,638 @@
+! FUNCTION: AbortDoc
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax kernel windows.types ;
+IN: windows.gdi32
+
+! Stock Logical Objects
+: WHITE_BRUSH         0 ; inline
+: LTGRAY_BRUSH        1 ; inline
+: GRAY_BRUSH          2 ; inline
+: DKGRAY_BRUSH        3 ; inline
+: BLACK_BRUSH         4 ; inline
+: NULL_BRUSH          5 ; inline
+: HOLLOW_BRUSH        NULL_BRUSH ; inline
+: WHITE_PEN           6 ; inline
+: BLACK_PEN           7 ; inline
+: NULL_PEN            8 ; inline
+: OEM_FIXED_FONT      10 ; inline
+: ANSI_FIXED_FONT     11 ; inline
+: ANSI_VAR_FONT       12 ; inline
+: SYSTEM_FONT         13 ; inline
+: DEVICE_DEFAULT_FONT 14 ; inline
+: DEFAULT_PALETTE     15 ; inline
+: SYSTEM_FIXED_FONT   16 ; inline
+: DEFAULT_GUI_FONT    17 ; inline
+: DC_BRUSH            18 ; inline
+: DC_PEN              19 ; inline
+
+LIBRARY: gdi32
+
+! FUNCTION: AbortPath
+! FUNCTION: AddFontMemResourceEx
+! FUNCTION: AddFontResourceA
+! FUNCTION: AddFontResourceExA
+! FUNCTION: AddFontResourceExW
+! FUNCTION: AddFontResourceTracking
+! FUNCTION: AddFontResourceW
+! FUNCTION: AngleArc
+! FUNCTION: AnimatePalette
+! FUNCTION: AnyLinkedFonts
+! FUNCTION: Arc
+! FUNCTION: ArcTo
+! FUNCTION: BeginPath
+! FUNCTION: bInitSystemAndFontsDirectoriesW
+! FUNCTION: BitBlt
+! FUNCTION: bMakePathNameW
+! FUNCTION: BRUSHOBJ_hGetColorTransform
+! FUNCTION: BRUSHOBJ_pvAllocRbrush
+! FUNCTION: BRUSHOBJ_pvGetRbrush
+! FUNCTION: BRUSHOBJ_ulGetBrushColor
+! FUNCTION: CancelDC
+! FUNCTION: cGetTTFFromFOT
+! FUNCTION: CheckColorsInGamut
+FUNCTION: int ChoosePixelFormat ( HDC hDC, PFD* ppfd ) ;
+! FUNCTION: Chord
+! FUNCTION: ClearBitmapAttributes
+! FUNCTION: ClearBrushAttributes
+! FUNCTION: CLIPOBJ_bEnum
+! FUNCTION: CLIPOBJ_cEnumStart
+! FUNCTION: CLIPOBJ_ppoGetPath
+! FUNCTION: CloseEnhMetaFile
+! FUNCTION: CloseFigure
+! FUNCTION: CloseMetaFile
+! FUNCTION: ColorCorrectPalette
+! FUNCTION: ColorMatchToTarget
+! FUNCTION: CombineRgn
+! FUNCTION: CombineTransform
+! FUNCTION: CopyEnhMetaFileA
+! FUNCTION: CopyEnhMetaFileW
+! FUNCTION: CopyMetaFileA
+! FUNCTION: CopyMetaFileW
+! FUNCTION: CreateBitmap
+! FUNCTION: CreateBitmapIndirect
+! FUNCTION: CreateBrushIndirect
+! FUNCTION: CreateColorSpaceA
+! FUNCTION: CreateColorSpaceW
+! FUNCTION: CreateCompatibleBitmap
+! FUNCTION: CreateCompatibleDC
+! FUNCTION: CreateDCA
+! FUNCTION: CreateDCW
+! FUNCTION: CreateDIBitmap
+! FUNCTION: CreateDIBPatternBrush
+! FUNCTION: CreateDIBPatternBrushPt
+! FUNCTION: CreateDIBSection
+! FUNCTION: CreateDiscardableBitmap
+! FUNCTION: CreateEllipticRgn
+! FUNCTION: CreateEllipticRgnIndirect
+! FUNCTION: CreateEnhMetaFileA
+! FUNCTION: CreateEnhMetaFileW
+! FUNCTION: CreateFontA
+! FUNCTION: CreateFontIndirectA
+! FUNCTION: CreateFontIndirectExA
+! FUNCTION: CreateFontIndirectExW
+! FUNCTION: CreateFontIndirectW
+! FUNCTION: CreateFontW
+! FUNCTION: CreateHalftonePalette
+! FUNCTION: CreateHatchBrush
+! FUNCTION: CreateICA
+! FUNCTION: CreateICW
+! FUNCTION: CreateMetaFileA
+! FUNCTION: CreateMetaFileW
+! FUNCTION: CreatePalette
+! FUNCTION: CreatePatternBrush
+! FUNCTION: CreatePen
+! FUNCTION: CreatePenIndirect
+! FUNCTION: CreatePolygonRgn
+! FUNCTION: CreatePolyPolygonRgn
+FUNCTION: HRGN CreateRectRgn ( int x, int y, int w, int h ) ;
+! FUNCTION: CreateRectRgnIndirect
+! FUNCTION: CreateRoundRectRgn
+! FUNCTION: CreateScalableFontResourceA
+! FUNCTION: CreateScalableFontResourceW
+! FUNCTION: CreateSolidBrush
+! FUNCTION: DdEntry0
+! FUNCTION: DdEntry1
+! FUNCTION: DdEntry10
+! FUNCTION: DdEntry11
+! FUNCTION: DdEntry12
+! FUNCTION: DdEntry13
+! FUNCTION: DdEntry14
+! FUNCTION: DdEntry15
+! FUNCTION: DdEntry16
+! FUNCTION: DdEntry17
+! FUNCTION: DdEntry18
+! FUNCTION: DdEntry19
+! FUNCTION: DdEntry2
+! FUNCTION: DdEntry20
+! FUNCTION: DdEntry21
+! FUNCTION: DdEntry22
+! FUNCTION: DdEntry23
+! FUNCTION: DdEntry24
+! FUNCTION: DdEntry25
+! FUNCTION: DdEntry26
+! FUNCTION: DdEntry27
+! FUNCTION: DdEntry28
+! FUNCTION: DdEntry29
+! FUNCTION: DdEntry3
+! FUNCTION: DdEntry30
+! FUNCTION: DdEntry31
+! FUNCTION: DdEntry32
+! FUNCTION: DdEntry33
+! FUNCTION: DdEntry34
+! FUNCTION: DdEntry35
+! FUNCTION: DdEntry36
+! FUNCTION: DdEntry37
+! FUNCTION: DdEntry38
+! FUNCTION: DdEntry39
+! FUNCTION: DdEntry4
+! FUNCTION: DdEntry40
+! FUNCTION: DdEntry41
+! FUNCTION: DdEntry42
+! FUNCTION: DdEntry43
+! FUNCTION: DdEntry44
+! FUNCTION: DdEntry45
+! FUNCTION: DdEntry46
+! FUNCTION: DdEntry47
+! FUNCTION: DdEntry48
+! FUNCTION: DdEntry49
+! FUNCTION: DdEntry5
+! FUNCTION: DdEntry50
+! FUNCTION: DdEntry51
+! FUNCTION: DdEntry52
+! FUNCTION: DdEntry53
+! FUNCTION: DdEntry54
+! FUNCTION: DdEntry55
+! FUNCTION: DdEntry56
+! FUNCTION: DdEntry6
+! FUNCTION: DdEntry7
+! FUNCTION: DdEntry8
+! FUNCTION: DdEntry9
+! FUNCTION: DeleteColorSpace
+! FUNCTION: DeleteDC
+! FUNCTION: DeleteEnhMetaFile
+! FUNCTION: DeleteMetaFile
+FUNCTION: BOOL DeleteObject ( HGDIOBJ hObject ) ;
+! FUNCTION: DescribePixelFormat
+! FUNCTION: DeviceCapabilitiesExA
+! FUNCTION: DeviceCapabilitiesExW
+! FUNCTION: DPtoLP
+! FUNCTION: DrawEscape
+! FUNCTION: Ellipse
+! FUNCTION: EnableEUDC
+! FUNCTION: EndDoc
+! FUNCTION: EndFormPage
+! FUNCTION: EndPage
+! FUNCTION: EndPath
+! FUNCTION: EngAcquireSemaphore
+! FUNCTION: EngAlphaBlend
+! FUNCTION: EngAssociateSurface
+! FUNCTION: EngBitBlt
+! FUNCTION: EngCheckAbort
+! FUNCTION: EngComputeGlyphSet
+! FUNCTION: EngCopyBits
+! FUNCTION: EngCreateBitmap
+! FUNCTION: EngCreateClip
+! FUNCTION: EngCreateDeviceBitmap
+! FUNCTION: EngCreateDeviceSurface
+! FUNCTION: EngCreatePalette
+! FUNCTION: EngCreateSemaphore
+! FUNCTION: EngDeleteClip
+! FUNCTION: EngDeletePalette
+! FUNCTION: EngDeletePath
+! FUNCTION: EngDeleteSemaphore
+! FUNCTION: EngDeleteSurface
+! FUNCTION: EngEraseSurface
+! FUNCTION: EngFillPath
+! FUNCTION: EngFindResource
+! FUNCTION: EngFreeModule
+! FUNCTION: EngGetCurrentCodePage
+! FUNCTION: EngGetDriverName
+! FUNCTION: EngGetPrinterDataFileName
+! FUNCTION: EngGradientFill
+! FUNCTION: EngLineTo
+! FUNCTION: EngLoadModule
+! FUNCTION: EngLockSurface
+! FUNCTION: EngMarkBandingSurface
+! FUNCTION: EngMultiByteToUnicodeN
+! FUNCTION: EngMultiByteToWideChar
+! FUNCTION: EngPaint
+! FUNCTION: EngPlgBlt
+! FUNCTION: EngQueryEMFInfo
+! FUNCTION: EngQueryLocalTime
+! FUNCTION: EngReleaseSemaphore
+! FUNCTION: EngStretchBlt
+! FUNCTION: EngStretchBltROP
+! FUNCTION: EngStrokeAndFillPath
+! FUNCTION: EngStrokePath
+! FUNCTION: EngTextOut
+! FUNCTION: EngTransparentBlt
+! FUNCTION: EngUnicodeToMultiByteN
+! FUNCTION: EngUnlockSurface
+! FUNCTION: EngWideCharToMultiByte
+! FUNCTION: EnumEnhMetaFile
+! FUNCTION: EnumFontFamiliesA
+! FUNCTION: EnumFontFamiliesExA
+! FUNCTION: EnumFontFamiliesExW
+! FUNCTION: EnumFontFamiliesW
+! FUNCTION: EnumFontsA
+! FUNCTION: EnumFontsW
+! FUNCTION: EnumICMProfilesA
+! FUNCTION: EnumICMProfilesW
+! FUNCTION: EnumMetaFile
+! FUNCTION: EnumObjects
+! FUNCTION: EqualRgn
+! FUNCTION: Escape
+! FUNCTION: EudcLoadLinkW
+! FUNCTION: EudcUnloadLinkW
+! FUNCTION: ExcludeClipRect
+! FUNCTION: ExtCreatePen
+! FUNCTION: ExtCreateRegion
+! FUNCTION: ExtEscape
+! FUNCTION: ExtFloodFill
+! FUNCTION: ExtSelectClipRgn
+! FUNCTION: ExtTextOutA
+! FUNCTION: ExtTextOutW
+! FUNCTION: FillPath
+! FUNCTION: FillRgn
+! FUNCTION: FixBrushOrgEx
+! FUNCTION: FlattenPath
+! FUNCTION: FloodFill
+! FUNCTION: FontIsLinked
+! FUNCTION: FONTOBJ_cGetAllGlyphHandles
+! FUNCTION: FONTOBJ_cGetGlyphs
+! FUNCTION: FONTOBJ_pfdg
+! FUNCTION: FONTOBJ_pifi
+! FUNCTION: FONTOBJ_pQueryGlyphAttrs
+! FUNCTION: FONTOBJ_pvTrueTypeFontFile
+! FUNCTION: FONTOBJ_pxoGetXform
+! FUNCTION: FONTOBJ_vGetInfo
+! FUNCTION: FrameRgn
+! FUNCTION: GdiAddFontResourceW
+! FUNCTION: GdiAddGlsBounds
+! FUNCTION: GdiAddGlsRecord
+! FUNCTION: GdiAlphaBlend
+! FUNCTION: GdiArtificialDecrementDriver
+! FUNCTION: GdiCleanCacheDC
+! FUNCTION: GdiComment
+! FUNCTION: GdiConsoleTextOut
+! FUNCTION: GdiConvertAndCheckDC
+! FUNCTION: GdiConvertBitmap
+! FUNCTION: GdiConvertBitmapV5
+! FUNCTION: GdiConvertBrush
+! FUNCTION: GdiConvertDC
+! FUNCTION: GdiConvertEnhMetaFile
+! FUNCTION: GdiConvertFont
+! FUNCTION: GdiConvertMetaFilePict
+! FUNCTION: GdiConvertPalette
+! FUNCTION: GdiConvertRegion
+! FUNCTION: GdiConvertToDevmodeW
+! FUNCTION: GdiCreateLocalEnhMetaFile
+! FUNCTION: GdiCreateLocalMetaFilePict
+! FUNCTION: GdiDeleteLocalDC
+! FUNCTION: GdiDeleteSpoolFileHandle
+! FUNCTION: GdiDescribePixelFormat
+! FUNCTION: GdiDllInitialize
+! FUNCTION: GdiDrawStream
+! FUNCTION: GdiEndDocEMF
+! FUNCTION: GdiEndPageEMF
+! FUNCTION: GdiEntry1
+! FUNCTION: GdiEntry10
+! FUNCTION: GdiEntry11
+! FUNCTION: GdiEntry12
+! FUNCTION: GdiEntry13
+! FUNCTION: GdiEntry14
+! FUNCTION: GdiEntry15
+! FUNCTION: GdiEntry16
+! FUNCTION: GdiEntry2
+! FUNCTION: GdiEntry3
+! FUNCTION: GdiEntry4
+! FUNCTION: GdiEntry5
+! FUNCTION: GdiEntry6
+! FUNCTION: GdiEntry7
+! FUNCTION: GdiEntry8
+! FUNCTION: GdiEntry9
+! FUNCTION: GdiFixUpHandle
+! FUNCTION: GdiFlush
+! FUNCTION: GdiFullscreenControl
+! FUNCTION: GdiGetBatchLimit
+! FUNCTION: GdiGetCharDimensions
+! FUNCTION: GdiGetCodePage
+! FUNCTION: GdiGetDC
+! FUNCTION: GdiGetDevmodeForPage
+! FUNCTION: GdiGetLocalBrush
+! FUNCTION: GdiGetLocalDC
+! FUNCTION: GdiGetLocalFont
+! FUNCTION: GdiGetPageCount
+! FUNCTION: GdiGetPageHandle
+! FUNCTION: GdiGetSpoolFileHandle
+! FUNCTION: GdiGetSpoolMessage
+! FUNCTION: GdiGradientFill
+! FUNCTION: GdiInitializeLanguagePack
+! FUNCTION: GdiInitSpool
+! FUNCTION: GdiIsMetaFileDC
+! FUNCTION: GdiIsMetaPrintDC
+! FUNCTION: GdiIsPlayMetafileDC
+! FUNCTION: GdiPlayDCScript
+! FUNCTION: GdiPlayEMF
+! FUNCTION: GdiPlayJournal
+! FUNCTION: GdiPlayPageEMF
+! FUNCTION: GdiPlayPrivatePageEMF
+! FUNCTION: GdiPlayScript
+! FUNCTION: gdiPlaySpoolStream
+! FUNCTION: GdiPrinterThunk
+! FUNCTION: GdiProcessSetup
+! FUNCTION: GdiQueryFonts
+! FUNCTION: GdiQueryTable
+! FUNCTION: GdiRealizationInfo
+! FUNCTION: GdiReleaseDC
+! FUNCTION: GdiReleaseLocalDC
+! FUNCTION: GdiResetDCEMF
+! FUNCTION: GdiSetAttrs
+! FUNCTION: GdiSetBatchLimit
+! FUNCTION: GdiSetLastError
+! FUNCTION: GdiSetPixelFormat
+! FUNCTION: GdiSetServerAttr
+! FUNCTION: GdiStartDocEMF
+! FUNCTION: GdiStartPageEMF
+! FUNCTION: GdiSwapBuffers
+! FUNCTION: GdiTransparentBlt
+! FUNCTION: GdiValidateHandle
+! FUNCTION: GetArcDirection
+! FUNCTION: GetAspectRatioFilterEx
+! FUNCTION: GetBitmapAttributes
+! FUNCTION: GetBitmapBits
+! FUNCTION: GetBitmapDimensionEx
+! FUNCTION: GetBkColor
+! FUNCTION: GetBkMode
+! FUNCTION: GetBoundsRect
+! FUNCTION: GetBrushAttributes
+! FUNCTION: GetBrushOrgEx
+! FUNCTION: GetCharABCWidthsA
+! FUNCTION: GetCharABCWidthsFloatA
+! FUNCTION: GetCharABCWidthsFloatW
+! FUNCTION: GetCharABCWidthsI
+! FUNCTION: GetCharABCWidthsW
+! FUNCTION: GetCharacterPlacementA
+! FUNCTION: GetCharacterPlacementW
+! FUNCTION: GetCharWidth32A
+! FUNCTION: GetCharWidth32W
+! FUNCTION: GetCharWidthA
+! FUNCTION: GetCharWidthFloatA
+! FUNCTION: GetCharWidthFloatW
+! FUNCTION: GetCharWidthI
+! FUNCTION: GetCharWidthInfo
+! FUNCTION: GetCharWidthW
+! FUNCTION: GetClipBox
+! FUNCTION: GetClipRgn
+! FUNCTION: GetColorAdjustment
+! FUNCTION: GetColorSpace
+! FUNCTION: GetCurrentObject
+! FUNCTION: GetCurrentPositionEx
+! FUNCTION: GetDCBrushColor
+! FUNCTION: GetDCOrgEx
+! FUNCTION: GetDCPenColor
+! FUNCTION: GetDeviceCaps
+! FUNCTION: GetDeviceGammaRamp
+! FUNCTION: GetDIBColorTable
+! FUNCTION: GetDIBits
+! FUNCTION: GetEnhMetaFileA
+! FUNCTION: GetEnhMetaFileBits
+! FUNCTION: GetEnhMetaFileDescriptionA
+! FUNCTION: GetEnhMetaFileDescriptionW
+! FUNCTION: GetEnhMetaFileHeader
+! FUNCTION: GetEnhMetaFilePaletteEntries
+! FUNCTION: GetEnhMetaFilePixelFormat
+! FUNCTION: GetEnhMetaFileW
+! FUNCTION: GetETM
+! FUNCTION: GetEUDCTimeStamp
+! FUNCTION: GetEUDCTimeStampExW
+! FUNCTION: GetFontAssocStatus
+! FUNCTION: GetFontData
+! FUNCTION: GetFontLanguageInfo
+! FUNCTION: GetFontResourceInfoW
+! FUNCTION: GetFontUnicodeRanges
+! FUNCTION: GetGlyphIndicesA
+! FUNCTION: GetGlyphIndicesW
+! FUNCTION: GetGlyphOutline
+! FUNCTION: GetGlyphOutlineA
+! FUNCTION: GetGlyphOutlineW
+! FUNCTION: GetGlyphOutlineWow
+! FUNCTION: GetGraphicsMode
+! FUNCTION: GetHFONT
+! FUNCTION: GetICMProfileA
+! FUNCTION: GetICMProfileW
+! FUNCTION: GetKerningPairs
+! FUNCTION: GetKerningPairsA
+! FUNCTION: GetKerningPairsW
+! FUNCTION: GetLayout
+! FUNCTION: GetLogColorSpaceA
+! FUNCTION: GetLogColorSpaceW
+! FUNCTION: GetMapMode
+! FUNCTION: GetMetaFileA
+! FUNCTION: GetMetaFileBitsEx
+! FUNCTION: GetMetaFileW
+! FUNCTION: GetMetaRgn
+! FUNCTION: GetMiterLimit
+! FUNCTION: GetNearestColor
+! FUNCTION: GetNearestPaletteIndex
+! FUNCTION: GetObjectA
+! FUNCTION: GetObjectType
+! FUNCTION: GetObjectW
+! FUNCTION: GetOutlineTextMetricsA
+! FUNCTION: GetOutlineTextMetricsW
+! FUNCTION: GetPaletteEntries
+! FUNCTION: GetPath
+! FUNCTION: GetPixel
+! FUNCTION: GetPixelFormat
+! FUNCTION: GetPolyFillMode
+! FUNCTION: GetRandomRgn
+! FUNCTION: GetRasterizerCaps
+! FUNCTION: GetRegionData
+! FUNCTION: GetRelAbs
+! FUNCTION: GetRgnBox
+! FUNCTION: GetROP2
+FUNCTION: HGDIOBJ GetStockObject ( int fnObject ) ;
+! FUNCTION: GetStretchBltMode
+! FUNCTION: GetStringBitmapA
+! FUNCTION: GetStringBitmapW
+! FUNCTION: GetSystemPaletteEntries
+! FUNCTION: GetSystemPaletteUse
+! FUNCTION: GetTextAlign
+! FUNCTION: GetTextCharacterExtra
+! FUNCTION: GetTextCharset
+! FUNCTION: GetTextCharsetInfo
+! FUNCTION: GetTextColor
+! FUNCTION: GetTextExtentExPointA
+! FUNCTION: GetTextExtentExPointI
+! FUNCTION: GetTextExtentExPointW
+! FUNCTION: GetTextExtentExPointWPri
+! FUNCTION: GetTextExtentPoint32A
+! FUNCTION: GetTextExtentPoint32W
+! FUNCTION: GetTextExtentPointA
+! FUNCTION: GetTextExtentPointI
+! FUNCTION: GetTextExtentPointW
+! FUNCTION: GetTextFaceA
+! FUNCTION: GetTextFaceAliasW
+! FUNCTION: GetTextFaceW
+! FUNCTION: GetTextMetricsA
+! FUNCTION: GetTextMetricsW
+! FUNCTION: GetTransform
+! FUNCTION: GetViewportExtEx
+! FUNCTION: GetViewportOrgEx
+! FUNCTION: GetWindowExtEx
+! FUNCTION: GetWindowOrgEx
+! FUNCTION: GetWinMetaFileBits
+! FUNCTION: GetWorldTransform
+! FUNCTION: HT_Get8BPPFormatPalette
+! FUNCTION: HT_Get8BPPMaskPalette
+! FUNCTION: IntersectClipRect
+! FUNCTION: InvertRgn
+! FUNCTION: IsValidEnhMetaRecord
+! FUNCTION: IsValidEnhMetaRecordOffExt
+! FUNCTION: LineDDA
+! FUNCTION: LineTo
+! FUNCTION: LPtoDP
+! FUNCTION: MaskBlt
+! FUNCTION: MirrorRgn
+! FUNCTION: ModifyWorldTransform
+! FUNCTION: MoveToEx
+! FUNCTION: NamedEscape
+! FUNCTION: OffsetClipRgn
+! FUNCTION: OffsetRgn
+! FUNCTION: OffsetViewportOrgEx
+! FUNCTION: OffsetWindowOrgEx
+! FUNCTION: PaintRgn
+! FUNCTION: PatBlt
+! FUNCTION: PATHOBJ_bEnum
+! FUNCTION: PATHOBJ_bEnumClipLines
+! FUNCTION: PATHOBJ_vEnumStart
+! FUNCTION: PATHOBJ_vEnumStartClipLines
+! FUNCTION: PATHOBJ_vGetBounds
+! FUNCTION: PathToRegion
+! FUNCTION: Pie
+! FUNCTION: PlayEnhMetaFile
+! FUNCTION: PlayEnhMetaFileRecord
+! FUNCTION: PlayMetaFile
+! FUNCTION: PlayMetaFileRecord
+! FUNCTION: PlgBlt
+! FUNCTION: PolyBezier
+! FUNCTION: PolyBezierTo
+! FUNCTION: PolyDraw
+! FUNCTION: Polygon
+! FUNCTION: Polyline
+! FUNCTION: PolylineTo
+! FUNCTION: PolyPatBlt
+! FUNCTION: PolyPolygon
+! FUNCTION: PolyPolyline
+! FUNCTION: PolyTextOutA
+! FUNCTION: PolyTextOutW
+! FUNCTION: PtInRegion
+! FUNCTION: PtVisible
+! FUNCTION: QueryFontAssocStatus
+! FUNCTION: RealizePalette
+! FUNCTION: Rectangle
+! FUNCTION: RectInRegion
+! FUNCTION: RectVisible
+! FUNCTION: RemoveFontMemResourceEx
+! FUNCTION: RemoveFontResourceA
+! FUNCTION: RemoveFontResourceExA
+! FUNCTION: RemoveFontResourceExW
+! FUNCTION: RemoveFontResourceTracking
+! FUNCTION: RemoveFontResourceW
+! FUNCTION: ResetDCA
+! FUNCTION: ResetDCW
+! FUNCTION: ResizePalette
+! FUNCTION: RestoreDC
+! FUNCTION: RoundRect
+! FUNCTION: SaveDC
+! FUNCTION: ScaleViewportExtEx
+! FUNCTION: ScaleWindowExtEx
+! FUNCTION: SelectBrushLocal
+! FUNCTION: SelectClipPath
+FUNCTION: int SelectClipRgn ( HDC hDC, HRGN hrgn ) ;
+! FUNCTION: SelectFontLocal
+! FUNCTION: SelectObject
+! FUNCTION: SelectPalette
+! FUNCTION: SetAbortProc
+! FUNCTION: SetArcDirection
+! FUNCTION: SetBitmapAttributes
+! FUNCTION: SetBitmapBits
+! FUNCTION: SetBitmapDimensionEx
+! FUNCTION: SetBkColor
+! FUNCTION: SetBkMode
+! FUNCTION: SetBoundsRect
+! FUNCTION: SetBrushAttributes
+! FUNCTION: SetBrushOrgEx
+! FUNCTION: SetColorAdjustment
+! FUNCTION: SetColorSpace
+! FUNCTION: SetDCBrushColor
+! FUNCTION: SetDCPenColor
+! FUNCTION: SetDeviceGammaRamp
+! FUNCTION: SetDIBColorTable
+! FUNCTION: SetDIBits
+! FUNCTION: SetDIBitsToDevice
+! FUNCTION: SetEnhMetaFileBits
+! FUNCTION: SetFontEnumeration
+! FUNCTION: SetGraphicsMode
+! FUNCTION: SetICMMode
+! FUNCTION: SetICMProfileA
+! FUNCTION: SetICMProfileW
+! FUNCTION: SetLayout
+! FUNCTION: SetLayoutWidth
+! FUNCTION: SetMagicColors
+! FUNCTION: SetMapMode
+! FUNCTION: SetMapperFlags
+! FUNCTION: SetMetaFileBitsEx
+! FUNCTION: SetMetaRgn
+! FUNCTION: SetMiterLimit
+! FUNCTION: SetPaletteEntries
+! FUNCTION: SetPixel
+FUNCTION: BOOL SetPixelFormat ( HDC hDC, int iPixelFormat, PFD* ppfd ) ;
+! FUNCTION: SetPixelV
+! FUNCTION: SetPolyFillMode
+! FUNCTION: SetRectRgn
+! FUNCTION: SetRelAbs
+! FUNCTION: SetROP2
+! FUNCTION: SetStretchBltMode
+! FUNCTION: SetSystemPaletteUse
+! FUNCTION: SetTextAlign
+! FUNCTION: SetTextCharacterExtra
+! FUNCTION: SetTextColor
+! FUNCTION: SetTextJustification
+! FUNCTION: SetViewportExtEx
+! FUNCTION: SetViewportOrgEx
+! FUNCTION: SetVirtualResolution
+! FUNCTION: SetWindowExtEx
+! FUNCTION: SetWindowOrgEx
+! FUNCTION: SetWinMetaFileBits
+! FUNCTION: SetWorldTransform
+! FUNCTION: StartDocA
+! FUNCTION: StartDocW
+! FUNCTION: StartFormPage
+! FUNCTION: StartPage
+! FUNCTION: StretchBlt
+! FUNCTION: StretchDIBits
+! FUNCTION: STROBJ_bEnum
+! FUNCTION: STROBJ_bEnumPositionsOnly
+! FUNCTION: STROBJ_bGetAdvanceWidths
+! FUNCTION: STROBJ_dwGetCodePage
+! FUNCTION: STROBJ_vEnumStart
+! FUNCTION: StrokeAndFillPath
+! FUNCTION: StrokePath
+FUNCTION: BOOL SwapBuffers ( HDC hDC ) ;
+! FUNCTION: TextOutA
+! FUNCTION: TextOutW
+! FUNCTION: TranslateCharsetInfo
+! FUNCTION: UnloadNetworkFonts
+! FUNCTION: UnrealizeObject
+! FUNCTION: UpdateColors
+! FUNCTION: UpdateICMRegKeyA
+! FUNCTION: UpdateICMRegKeyW
+! FUNCTION: WidenPath
+! FUNCTION: XFORMOBJ_bApplyXform
+! FUNCTION: XFORMOBJ_iGetXform
+! FUNCTION: XLATEOBJ_cGetPalette
+! FUNCTION: XLATEOBJ_hGetColorTransform
+! FUNCTION: XLATEOBJ_iXlate
+! FUNCTION: XLATEOBJ_piVector
diff --git a/extra/windows/kernel32/kernel32.factor b/extra/windows/kernel32/kernel32.factor
new file mode 100644 (file)
index 0000000..a11d352
--- /dev/null
@@ -0,0 +1,1513 @@
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax windows.types ;
+IN: windows.kernel32
+
+: MAX_PATH 260 ; inline
+
+: GHND          HEX: 40 ; inline
+: GMEM_FIXED          0 ; inline
+: GMEM_MOVEABLE       2 ; inline
+: GMEM_ZEROINIT HEX: 40 ; inline
+: GPTR          HEX: 40 ; inline
+
+: GENERIC_READ    HEX: 80000000 ; inline
+: GENERIC_WRITE   HEX: 40000000 ; inline
+: GENERIC_EXECUTE HEX: 20000000 ; inline
+: GENERIC_ALL     HEX: 10000000 ; inline
+
+: DELETE                   HEX: 00010000 ; inline
+: READ_CONTROL             HEX: 00020000 ; inline
+: WRITE_DAC                HEX: 00040000 ; inline
+: WRITE_OWNER              HEX: 00080000 ; inline
+: SYNCHRONIZE              HEX: 00100000 ; inline
+: STANDARD_RIGHTS_REQUIRED HEX: 000f0000 ; inline
+
+: CREATE_NEW        1 ; inline
+: CREATE_ALWAYS     2 ; inline
+: OPEN_EXISTING     3 ; inline
+: OPEN_ALWAYS       4 ; inline
+: TRUNCATE_EXISTING 5 ; inline
+              
+: FILE_LIST_DIRECTORY       HEX: 00000001 ; inline
+: FILE_READ_DAT             HEX: 00000001 ; inline
+: FILE_ADD_FILE             HEX: 00000002 ; inline
+: FILE_WRITE_DATA           HEX: 00000002 ; inline
+: FILE_ADD_SUBDIRECTORY     HEX: 00000004 ; inline
+: FILE_APPEND_DATA          HEX: 00000004 ; inline
+: FILE_CREATE_PIPE_INSTANCE HEX: 00000004 ; inline
+: FILE_READ_EA              HEX: 00000008 ; inline
+: FILE_READ_PROPERTIES      HEX: 00000008 ; inline
+: FILE_WRITE_EA             HEX: 00000010 ; inline
+: FILE_WRITE_PROPERTIES     HEX: 00000010 ; inline
+: FILE_EXECUTE              HEX: 00000020 ; inline
+: FILE_TRAVERSE             HEX: 00000020 ; inline
+: FILE_DELETE_CHILD         HEX: 00000040 ; inline
+: FILE_READ_ATTRIBUTES      HEX: 00000080 ; inline
+: FILE_WRITE_ATTRIBUTES     HEX: 00000100 ; inline
+
+: FILE_SHARE_READ        1 ; inline
+: FILE_SHARE_WRITE       2 ; inline
+: FILE_SHARE_DELETE      4 ; inline
+: FILE_SHARE_VALID_FLAGS 7 ; inline
+
+: FILE_FLAG_WRITE_THROUGH       HEX: 80000000 ; inline
+: FILE_FLAG_OVERLAPPED          HEX: 40000000 ; inline
+: FILE_FLAG_NO_BUFFERING        HEX: 20000000 ; inline
+: FILE_FLAG_RANDOM_ACCESS       HEX: 10000000 ; inline
+: FILE_FLAG_SEQUENTIAL_SCAN     HEX: 08000000 ; inline
+: FILE_FLAG_DELETE_ON_CLOSE     HEX: 04000000 ; inline
+: FILE_FLAG_BACKUP_SEMANTICS    HEX: 02000000 ; inline
+: FILE_FLAG_POSIX_SEMANTICS     HEX: 01000000 ; inline
+: FILE_FLAG_OPEN_REPARSE_POINT  HEX: 00200000 ; inline
+: FILE_FLAG_OPEN_NO_RECALL      HEX: 00100000 ; inline
+: FILE_FLAG_FIRST_PIPE_INSTANCE HEX: 00080000 ; inline
+
+: FILE_ATTRIBUTE_READONLY            HEX: 00000001 ; inline
+: FILE_ATTRIBUTE_HIDDEN              HEX: 00000002 ; inline
+: FILE_ATTRIBUTE_SYSTEM              HEX: 00000004 ; inline
+: FILE_ATTRIBUTE_DIRECTORY           HEX: 00000010 ; inline
+: FILE_ATTRIBUTE_ARCHIVE             HEX: 00000020 ; inline
+: FILE_ATTRIBUTE_DEVICE              HEX: 00000040 ; inline
+: FILE_ATTRIBUTE_NORMAL              HEX: 00000080 ; inline
+: FILE_ATTRIBUTE_TEMPORARY           HEX: 00000100 ; inline
+: FILE_ATTRIBUTE_SPARSE_FILE         HEX: 00000200 ; inline
+: FILE_ATTRIBUTE_REPARSE_POINT       HEX: 00000400 ; inline
+: FILE_ATTRIBUTE_COMPRESSED          HEX: 00000800 ; inline
+: FILE_ATTRIBUTE_OFFLINE             HEX: 00001000 ; inline
+: FILE_ATTRIBUTE_NOT_CONTENT_INDEXED HEX: 00002000 ; inline
+: FILE_ATTRIBUTE_ENCRYPTED           HEX: 00004000 ; inline
+
+: FILE_NOTIFY_CHANGE_FILE        HEX: 001 ; inline
+: FILE_NOTIFY_CHANGE_DIR_NAME    HEX: 002 ; inline
+: FILE_NOTIFY_CHANGE_ATTRIBUTES  HEX: 004 ; inline
+: FILE_NOTIFY_CHANGE_SIZE        HEX: 008 ; inline
+: FILE_NOTIFY_CHANGE_LAST_WRITE  HEX: 010 ; inline
+: FILE_NOTIFY_CHANGE_LAST_ACCESS HEX: 020 ; inline
+: FILE_NOTIFY_CHANGE_CREATION    HEX: 040 ; inline
+: FILE_NOTIFY_CHANGE_EA          HEX: 080 ; inline
+: FILE_NOTIFY_CHANGE_SECURITY    HEX: 100 ; inline
+: FILE_NOTIFY_CHANGE_FILE_NAME   HEX: 200 ; inline
+: FILE_NOTIFY_CHANGE_ALL         HEX: 3ff ; inline
+
+C-STRUCT: FILE_NOTIFY_INFORMATION
+    { "DWORD" "NextEntryOffset" }
+    { "DWORD" "Action" }
+    { "DWORD" "FileNameLength" }
+    { "WCHAR*" "FileName" } ;
+TYPEDEF: FILE_NOTIFY_INFORMATION* PFILE_NOTIFY_INFORMATION
+
+: STD_INPUT_HANDLE  -10 ; inline
+: STD_OUTPUT_HANDLE -11 ; inline
+: STD_ERROR_HANDLE  -12 ; inline
+
+: INVALID_HANDLE_VALUE -1 <alien> ; inline
+: INVALID_FILE_SIZE HEX: FFFFFFFF ; inline
+
+: FILE_BEGIN 0 ; inline
+: FILE_CURRENT 1 ; inline
+: FILE_END 2 ; inline
+
+: OF_READ 0 ;
+: OF_READWRITE    2 ;
+: OF_WRITE    1 ;
+: OF_SHARE_COMPAT    0 ;
+: OF_SHARE_DENY_NONE    64 ;
+: OF_SHARE_DENY_READ    48 ;
+: OF_SHARE_DENY_WRITE    32 ;
+: OF_SHARE_EXCLUSIVE    16 ;
+: OF_CANCEL    2048 ;
+: OF_CREATE    4096 ;
+: OF_DELETE    512 ;
+: OF_EXIST    16384 ;
+: OF_PARSE    256 ;
+: OF_PROMPT    8192 ;
+: OF_REOPEN    32768 ;
+: OF_VERIFY    1024 ;
+
+
+: INFINITE HEX: FFFFFFFF ; inline
+
+! From C:\cygwin\usr\include\w32api\winbase.h
+: FILE_TYPE_UNKNOWN 0 ;
+: FILE_TYPE_DISK 1 ;
+: FILE_TYPE_CHAR 2 ;
+: FILE_TYPE_PIPE 3 ;
+: FILE_TYPE_REMOTE HEX: 8000 ;
+
+: TIME_ZONE_ID_UNKNOWN 0 ; inline
+: TIME_ZONE_ID_STANDARD 1 ; inline
+: TIME_ZONE_ID_DAYLIGHT 2 ; inline
+: TIME_ZONE_ID_INVALID HEX: FFFFFFFF ; inline
+
+
+: CREATE_DEFAULT_ERROR_MODE HEX: 4000000 ; inline
+: DETACHED_PROCESS 8 ; inline
+: PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 ; inline
+: PF_SSE3_INSTRUCTIONS_AVAILABLE 13 ; inline
+
+: MAX_COMPUTERNAME_LENGTH 15 ; inline
+: UNLEN 256 ; inline
+
+: PROCESS_TERMINATE ( -- n ) HEX: 1 ; inline
+: PROCESS_CREATE_THREAD ( -- n ) HEX: 2 ; inline
+: PROCESS_VM_OPERATION ( -- n ) HEX: 8 ; inline
+: PROCESS_VM_READ ( -- n ) HEX: 10 ; inline
+: PROCESS_VM_WRITE ( -- n ) HEX: 20 ; inline
+: PROCESS_DUP_HANDLE ( -- n ) HEX: 40 ; inline
+: PROCESS_CREATE_PROCESS ( -- n ) HEX: 80 ; inline
+: PROCESS_SET_QUOTA ( -- n ) HEX: 100 ; inline
+: PROCESS_SET_INFORMATION ( -- n ) HEX: 200 ; inline
+: PROCESS_QUERY_INFORMATION ( -- n ) HEX: 400 ; inline
+
+: MEM_COMMIT ( -- n ) HEX: 1000 ; inline
+: MEM_RELEASE ( -- n ) HEX: 8000 ; inline
+
+: PAGE_NOACCESS    1 ; inline
+: PAGE_READONLY    2 ; inline
+: PAGE_READWRITE 4 ; inline
+: PAGE_WRITECOPY 8 ; inline
+: PAGE_EXECUTE HEX: 10 ; inline
+: PAGE_EXECUTE_READ HEX: 20 ; inline
+: PAGE_EXECUTE_READWRITE HEX: 40 ; inline
+: PAGE_EXECUTE_WRITECOPY HEX: 80 ; inline
+: PAGE_GUARD HEX: 100 ; inline
+: PAGE_NOCACHE HEX: 200 ; inline
+
+: SEC_BASED HEX: 00200000 ; inline
+: SEC_NO_CHANGE HEX: 00400000 ; inline
+: SEC_FILE HEX: 00800000 ; inline
+: SEC_IMAGE HEX: 01000000 ; inline
+: SEC_VLM HEX: 02000000 ; inline
+: SEC_RESERVE HEX: 04000000 ; inline
+: SEC_COMMIT HEX: 08000000 ; inline
+: SEC_NOCACHE HEX: 10000000 ; inline
+: MEM_IMAGE SEC_IMAGE ; inline
+
+: ERROR_ALREADY_EXISTS 183 ; inline
+
+: FILE_MAP_ALL_ACCESS HEX: f001f ;
+: FILE_MAP_READ   4 ;
+: FILE_MAP_WRITE  2 ;
+: FILE_MAP_COPY   1 ;
+
+C-STRUCT: OVERLAPPED
+    { "int" "internal" }
+    { "int" "internal-high" }
+    { "int" "offset" }
+    { "int" "offset-high" }
+    { "void*" "event" } ;
+
+C-STRUCT: SYSTEMTIME
+    { "WORD" "wYear" }
+    { "WORD" "wMonth" }
+    { "WORD" "wDayOfWeek" }
+    { "WORD" "wDay" }
+    { "WORD" "wHour" }
+    { "WORD" "wMinute" }
+    { "WORD" "wSecond" }
+    { "WORD" "wMilliseconds" } ;
+
+C-STRUCT: TIME_ZONE_INFORMATION
+    { "LONG" "Bias" }
+    { { "WCHAR" 32 } "StandardName" }
+    { "SYSTEMTIME" "StandardDate" }
+    { "LONG" "StandardBias" }
+    { { "WCHAR" 32 } "DaylightName" }
+    { "SYSTEMTIME" "DaylightDate" }
+    { "LONG" "DaylightBias" } ;
+
+C-STRUCT: FILETIME
+    { "DWORD" "dwLowDateTime" }
+    { "DWORD" "dwHighDateTime" } ;
+
+C-STRUCT: STARTUPINFO
+    { "DWORD" "cb" }
+    { "LPTSTR" "lpReserved" }
+    { "LPTSTR" "lpDesktop" }
+    { "LPTSTR" "lpTitle" }
+    { "DWORD" "dwX" }
+    { "DWORD" "dwY" }
+    { "DWORD" "dwXSize" }
+    { "DWORD" "dwYSize" }
+    { "DWORD" "dwXCountChars" }
+    { "DWORD" "dwYCountChars" }
+    { "DWORD" "dwFillAttribute" }
+    { "DWORD" "dwFlags" }
+    { "WORD" "wShowWindow" }
+    { "WORD" "cbReserved2" }
+    { "LPBYTE" "lpReserved2" }
+    { "HANDLE" "hStdInput" }
+    { "HANDLE" "hStdOutput" }
+    { "HANDLE" "hStdError" } ;
+
+TYPEDEF: void* LPSTARTUPINFO
+
+C-STRUCT: PROCESS_INFORMATION
+    { "HANDLE" "hProcess" }
+    { "HANDLE" "hThread" }
+    { "DWORD" "dwProcessId" }
+    { "DWORD" "dwThreadId" } ;
+
+C-STRUCT: SYSTEM_INFO
+    { "DWORD" "dwOemId" }
+    { "DWORD" "dwPageSize" }
+    { "LPVOID" "lpMinimumApplicationAddress" }
+    { "LPVOID" "lpMaximumApplicationAddress" }
+    { "DWORD_PTR" "dwActiveProcessorMask" }
+    { "DWORD" "dwNumberOfProcessors" }
+    { "DWORD" "dwProcessorType" }
+    { "DWORD" "dwAllocationGranularity" }
+    { "WORD" "wProcessorLevel" }
+    { "WORD" "wProcessorRevision" } ;
+
+TYPEDEF: void* LPSYSTEM_INFO
+
+C-STRUCT: MEMORYSTATUS
+    { "DWORD" "dwLength" }
+    { "DWORD" "dwMemoryLoad" }
+    { "SIZE_T" "dwTotalPhys" }
+    { "SIZE_T" "dwAvailPhys" }
+    { "SIZE_T" "dwTotalPageFile" }
+    { "SIZE_T" "dwAvailPageFile" }
+    { "SIZE_T" "dwTotalVirtual" }
+    { "SIZE_T" "dwAvailVirtual" } ;
+
+TYPEDEF: void* LPMEMORYSTATUS
+
+C-STRUCT: MEMORYSTATUSEX
+    { "DWORD" "dwLength" }
+    { "DWORD" "dwMemoryLoad" }
+    { "DWORDLONG" "ullTotalPhys" }
+    { "DWORDLONG" "ullAvailPhys" }
+    { "DWORDLONG" "ullTotalPageFile" }
+    { "DWORDLONG" "ullAvailPageFile" }
+    { "DWORDLONG" "ullTotalVirtual" }
+    { "DWORDLONG" "ullAvailVirtual" }
+    { "DWORDLONG" "ullAvailExtendedVirtual" } ;
+
+TYPEDEF: void* LPMEMORYSTATUSEX
+
+C-STRUCT: OSVERSIONINFO
+    { "DWORD" "dwOSVersionInfoSize" }
+    { "DWORD" "dwMajorVersion" }
+    { "DWORD" "dwMinorVersion" }
+    { "DWORD" "dwBuildNumber" }
+    { "DWORD" "dwPlatformId" }
+    { { "WCHAR" 128 } "szCSDVersion" } ;
+
+TYPEDEF: void* LPOSVERSIONINFO
+
+C-STRUCT: MEMORY_BASIC_INFORMATION
+  { "void*" "BaseAddress" }
+  { "void*" "AllocationBase" }
+  { "DWORD" "AllocationProtect" }
+  { "SIZE_T" "RegionSize" }
+  { "DWORD" "state" }
+  { "DWORD" "protect" }
+  { "DWORD" "type" } ;
+
+C-STRUCT: GUID
+    { "ulong" "Data1" }
+    { "ushort" "Data2" }
+    { "ushort" "Data3" }
+    { { "uchar" 8 } "Data4" } ;
+
+
+: SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege" ;
+: SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege" ;
+: SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege" ;
+: SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege" ;
+: SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege" ;
+: SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege" ;
+: SE_TCB_NAME "SeTcbPrivilege" ;
+: SE_SECURITY_NAME "SeSecurityPrivilege" ;
+: SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege" ;
+: SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege" ;
+: SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege" ;
+: SE_SYSTEMTIME_NAME "SeSystemtimePrivilege" ;
+: SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege" ;
+: SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege" ;
+: SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege" ;
+: SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege" ;
+: SE_BACKUP_NAME "SeBackupPrivilege" ;
+: SE_RESTORE_NAME "SeRestorePrivilege" ;
+: SE_SHUTDOWN_NAME "SeShutdownPrivilege" ;
+: SE_DEBUG_NAME "SeDebugPrivilege" ;
+: SE_AUDIT_NAME "SeAuditPrivilege" ;
+: SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege" ;
+: SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege" ;
+: SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege" ;
+: SE_UNDOCK_NAME "SeUndockPrivilege" ;
+: SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege" ;
+: SE_MANAGE_VOLUME_NAME "SeManageVolumePrivilege" ;
+: SE_IMPERSONATE_NAME "SeImpersonatePrivilege" ;
+: SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege" ;
+
+: SE_GROUP_MANDATORY HEX: 00000001 ;
+: SE_GROUP_ENABLED_BY_DEFAULT HEX: 00000002 ;
+: SE_GROUP_ENABLED HEX: 00000004 ;
+: SE_GROUP_OWNER HEX: 00000008 ;
+: SE_GROUP_USE_FOR_DENY_ONLY HEX: 00000010 ;
+: SE_GROUP_LOGON_ID HEX: C0000000 ;
+: SE_GROUP_RESOURCE HEX: 20000000 ;
+
+: SE_PRIVILEGE_ENABLED_BY_DEFAULT HEX: 00000001 ;
+: SE_PRIVILEGE_ENABLED HEX: 00000002 ;
+: SE_PRIVILEGE_REMOVE HEX: 00000004 ;
+: SE_PRIVILEGE_USED_FOR_ACCESS HEX: 80000000 ;
+
+: PRIVILEGE_SET_ALL_NECESSARY 1 ;
+
+: SE_OWNER_DEFAULTED HEX: 00000001 ;
+: SE_GROUP_DEFAULTED HEX: 00000002 ;
+: SE_DACL_PRESENT HEX: 00000004 ;
+: SE_DACL_DEFAULTED HEX: 00000008 ;
+: SE_SACL_PRESENT HEX: 00000010 ;
+: SE_SACL_DEFAULTED HEX: 00000020 ;
+: SE_DACL_AUTO_INHERIT_REQ HEX: 00000100 ;
+: SE_SACL_AUTO_INHERIT_REQ HEX: 00000200 ;
+: SE_DACL_AUTO_INHERITED HEX: 00000400 ;
+: SE_SACL_AUTO_INHERITED HEX: 00000800 ;
+: SE_DACL_PROTECTED  HEX: 00001000 ;
+: SE_SACL_PROTECTED  HEX: 00002000 ;
+: SE_SELF_RELATIVE HEX: 00008000 ;
+
+: ANYSIZE_ARRAY 1 ; inline
+
+: MAXIMUM_WAIT_OBJECTS 64 ; inline
+: MAXIMUM_SUSPEND_COUNT HEX: 7f ; inline
+: WAIT_OBJECT_0 0 ; inline
+: WAIT_ABANDONED_0 128 ; inline
+: WAIT_TIMEOUT 258 ; inline
+: WAIT_IO_COMPLETION HEX: c0 ; inline
+: WAIT_FAILED HEX: ffffffff ; inline
+
+C-STRUCT: LUID
+    { "DWORD" "LowPart" }
+    { "LONG" "HighPart" } ;
+TYPEDEF: LUID* PLUID
+
+C-STRUCT: LUID_AND_ATTRIBUTES
+    { "LUID" "Luid" }
+    { "DWORD" "Attributes" } ;
+TYPEDEF: LUID_AND_ATTRIBUTES* PLUID_AND_ATTRIBUTES
+
+C-STRUCT: TOKEN_PRIVILEGES
+    { "DWORD" "PrivilegeCount" }
+    { "LUID_AND_ATTRIBUTES*" "Privileges" } ;
+TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
+
+C-STRUCT: WIN32_FILE_ATTRIBUTE_DATA
+    { "DWORD" "dwFileAttributes" }
+    { "FILETIME" "ftCreationTime" }
+    { "FILETIME" "ftLastAccessTime" }
+    { "FILETIME" "ftLastWriteTime" }
+    { "DWORD" "nFileSizeHigh" }
+    { "DWORD" "nFileSizeLow" } ;
+TYPEDEF: WIN32_FILE_ATTRIBUTE_DATA* LPWIN32_FILE_ATTRIBUTE_DATA
+
+C-STRUCT: BY_HANDLE_FILE_INFORMATION
+  { "DWORD" "dwFileAttributes" }
+  { "FILETIME" "ftCreationTime" }
+  { "FILETIME" "ftLastAccessTime" }
+  { "FILETIME" "ftLastWriteTime" }
+  { "DWORD" "dwVolumeSerialNumber" }
+  { "DWORD" "nFileSizeHigh" }
+  { "DWORD" "nFileSizeLow" }
+  { "DWORD" "nNumberOfLinks" }
+  { "DWORD" "nFileIndexHigh" }
+  { "DWORD" "nFileIndexLow" } ;
+TYPEDEF: BY_HANDLE_FILE_INFORMATION* LPBY_HANDLE_FILE_INFORMATION
+
+: OFS_MAXPATHNAME 128 ;
+
+C-STRUCT: OFSTRUCT
+    { "BYTE" "cBytes" }
+    { "BYTE" "fFixedDisk" }
+    { "WORD" "nErrCode" }
+    { "WORD" "Reserved1" }
+    { "WORD" "Reserved2" }
+    ! { { "CHAR" OFS_MAXPATHNAME } "szPathName" } ;
+    { { "CHAR" 128 } "szPathName" } ;
+
+TYPEDEF: OFSTRUCT* LPOFSTRUCT
+
+! MAX_PATH = 260
+C-STRUCT: WIN32_FIND_DATA
+    { "DWORD" "dwFileAttributes" }
+    { "FILETIME" "ftCreationTime" }
+    { "FILETIME" "ftLastAccessTime" }
+    { "FILETIME" "ftLastWriteTime" }
+    { "DWORD" "nFileSizeHigh" }
+    { "DWORD" "nFileSizeLow" }
+    { "DWORD" "dwReserved0" }
+    { "DWORD" "dwReserved1" }
+    ! { { "TCHAR" MAX_PATH } "cFileName" }
+    { { "TCHAR" 260 } "cFileName" }
+    { { "TCHAR" 14 } "cAlternateFileName" } ;
+
+TYPEDEF: WIN32_FIND_DATA* PWIN32_FIND_DATA
+TYPEDEF: WIN32_FIND_DATA* LPWIN32_FIND_DATA
+TYPEDEF: void* POVERLAPPED
+TYPEDEF: void* LPOVERLAPPED
+TYPEDEF: void* LPSECURITY_ATTRIBUTES
+TYPEDEF: void* LPPROCESS_INFORMATION
+
+TYPEDEF: SYSTEMTIME* PSYSTEMTIME
+TYPEDEF: PSYSTEMTIME LPSYSTEMTIME
+
+TYPEDEF: TIME_ZONE_INFORMATION* PTIME_ZONE_INFORMATION
+TYPEDEF: PTIME_ZONE_INFORMATION LPTIME_ZONE_INFORMATION
+
+TYPEDEF: FILETIME* PFILETIME
+TYPEDEF: PFILETIME LPFILETIME
+
+TYPEDEF: int GET_FILEEX_INFO_LEVELS
+
+C-STRUCT: SECURITY_ATTRIBUTES
+    { "DWORD" "nLength" }
+    { "LPVOID" "lpSecurityDescriptor" }
+    { "BOOL" "bInheritHandle" } ;
+
+: HANDLE_FLAG_INHERIT 1 ; inline
+: HANDLE_FLAG_PROTECT_FROM_CLOSE 2 ; inline
+
+: STARTF_USESHOWWINDOW    HEX: 00000001 ; inline
+: STARTF_USESIZE          HEX: 00000002 ; inline
+: STARTF_USEPOSITION      HEX: 00000004 ; inline
+: STARTF_USECOUNTCHARS    HEX: 00000008 ; inline
+: STARTF_USEFILLATTRIBUTE HEX: 00000010 ; inline
+: STARTF_RUNFULLSCREEN    HEX: 00000020 ; inline
+: STARTF_FORCEONFEEDBACK  HEX: 00000040 ; inline
+: STARTF_FORCEOFFFEEDBACK HEX: 00000080 ; inline
+: STARTF_USESTDHANDLES    HEX: 00000100 ; inline
+: STARTF_USEHOTKEY        HEX: 00000200 ; inline
+
+: PIPE_ACCESS_INBOUND  1 ; inline
+: PIPE_ACCESS_OUTBOUND 2 ; inline
+: PIPE_ACCESS_DUPLEX   3 ; inline
+
+: PIPE_TYPE_BYTE    0 ; inline
+: PIPE_TYPE_MESSAGE 4 ; inline
+
+: PIPE_READMODE_BYTE    0 ; inline
+: PIPE_READMODE_MESSAGE 2 ; inline
+
+: PIPE_WAIT   0 ; inline
+: PIPE_NOWAIT 1 ; inline
+
+: PIPE_UNLIMITED_INSTANCES 255 ; inline
+
+LIBRARY: kernel32
+! FUNCTION: _hread
+! FUNCTION: _hwrite
+! FUNCTION: _lclose
+! FUNCTION: _lcreat
+! FUNCTION: _llseek
+! FUNCTION: _lopen
+! FUNCTION: _lread
+! FUNCTION: _lwrite
+! FUNCTION: ActivateActCtx
+! FUNCTION: AddAtomA
+! FUNCTION: AddAtomW
+! FUNCTION: AddConsoleAliasA
+! FUNCTION: AddConsoleAliasW
+! FUNCTION: AddLocalAlternateComputerNameA
+! FUNCTION: AddLocalAlternateComputerNameW
+! FUNCTION: AddRefActCtx
+! FUNCTION: AddVectoredExceptionHandler
+! FUNCTION: AllocateUserPhysicalPages
+! FUNCTION: AllocConsole
+! FUNCTION: AreFileApisANSI
+! FUNCTION: AssignProcessToJobObject
+! FUNCTION: AttachConsole
+! FUNCTION: BackupRead
+! FUNCTION: BackupSeek
+! FUNCTION: BackupWrite
+! FUNCTION: BaseCheckAppcompatCache
+! FUNCTION: BaseCleanupAppcompatCache
+! FUNCTION: BaseCleanupAppcompatCacheSupport
+! FUNCTION: BaseDumpAppcompatCache
+! FUNCTION: BaseFlushAppcompatCache
+! FUNCTION: BaseInitAppcompatCache
+! FUNCTION: BaseInitAppcompatCacheSupport
+! FUNCTION: BasepCheckWinSaferRestrictions
+! FUNCTION: BaseProcessInitPostImport
+! FUNCTION: BaseQueryModuleData
+! FUNCTION: BaseUpdateAppcompatCache
+! FUNCTION: Beep
+! FUNCTION: BeginUpdateResourceA
+! FUNCTION: BeginUpdateResourceW
+! FUNCTION: BindIoCompletionCallback
+! FUNCTION: BuildCommDCBA
+! FUNCTION: BuildCommDCBAndTimeoutsA
+! FUNCTION: BuildCommDCBAndTimeoutsW
+! FUNCTION: BuildCommDCBW
+! FUNCTION: CallNamedPipeA
+! FUNCTION: CallNamedPipeW
+! FUNCTION: CancelDeviceWakeupRequest
+FUNCTION: BOOL CancelIo ( HANDLE h ) ;
+! FUNCTION: CancelTimerQueueTimer
+! FUNCTION: CancelWaitableTimer
+! FUNCTION: ChangeTimerQueueTimer
+! FUNCTION: CheckNameLegalDOS8Dot3A
+! FUNCTION: CheckNameLegalDOS8Dot3W
+! FUNCTION: CheckRemoteDebuggerPresent
+! FUNCTION: ClearCommBreak
+! FUNCTION: ClearCommError
+! FUNCTION: CloseConsoleHandle
+FUNCTION: BOOL CloseHandle ( HANDLE h ) ;
+! FUNCTION: CloseProfileUserMapping
+! FUNCTION: CmdBatNotification
+! FUNCTION: CommConfigDialogA
+! FUNCTION: CommConfigDialogW
+! FUNCTION: CompareFileTime
+! FUNCTION: CompareStringA
+! FUNCTION: CompareStringW
+FUNCTION: BOOL ConnectNamedPipe ( HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped ) ;
+! FUNCTION: ConsoleMenuControl
+! FUNCTION: ContinueDebugEvent
+! FUNCTION: ConvertDefaultLocale
+! FUNCTION: ConvertFiberToThread
+! FUNCTION: ConvertThreadToFiber
+! FUNCTION: CopyFileA
+! FUNCTION: CopyFileExA
+! FUNCTION: CopyFileExW
+! FUNCTION: CopyFileW
+! FUNCTION: CopyLZFile
+! FUNCTION: CreateActCtxA
+! FUNCTION: CreateActCtxW
+! FUNCTION: CreateConsoleScreenBuffer
+! FUNCTION: CreateDirectoryA
+! FUNCTION: CreateDirectoryExA
+! FUNCTION: CreateDirectoryExW
+FUNCTION: BOOL CreateDirectoryW ( LPCTSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttribytes ) ;
+: CreateDirectory CreateDirectoryW ;
+
+! FUNCTION: CreateEventA
+! FUNCTION: CreateEventW
+! FUNCTION: CreateFiber
+! FUNCTION: CreateFiberEx
+
+
+FUNCTION: HANDLE CreateFileW ( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttribures, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) ;
+: CreateFile CreateFileW ; inline
+
+FUNCTION: HANDLE  CreateFileMappingW ( HANDLE hFile,
+                                       LPSECURITY_ATTRIBUTES lpAttributes,
+                                       DWORD flProtect,
+                                       DWORD dwMaximumSizeHigh,
+                                       DWORD dwMaximumSizeLow,
+                                       LPCTSTR lpName ) ;
+: CreateFileMapping CreateFileMappingW ;
+
+! FUNCTION: CreateHardLinkA
+! FUNCTION: CreateHardLinkW
+! FUNCTION: HANDLE CreateIoCompletionPort ( HANDLE hFileHandle, HANDLE hExistingCompletionPort, ULONG_PTR uCompletionKey, DWORD dwNumberofConcurrentThreads ) ;
+FUNCTION: HANDLE CreateIoCompletionPort ( HANDLE hFileHandle, HANDLE hExistingCompletionPort, void* uCompletionKey, DWORD dwNumberofConcurrentThreads ) ;
+! FUNCTION: CreateJobObjectA
+! FUNCTION: CreateJobObjectW
+! FUNCTION: CreateJobSet
+! FUNCTION: CreateMailslotA
+! FUNCTION: CreateMailslotW
+! FUNCTION: CreateMemoryResourceNotification
+! FUNCTION: CreateMutexA
+! FUNCTION: CreateMutexW
+! FUNCTION: CreateNamedPipeA
+FUNCTION: HANDLE CreateNamedPipeW ( LPCTSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) ;
+: CreateNamedPipe CreateNamedPipeW ;
+
+! FUNCTION: CreateNlsSecurityDescriptor
+FUNCTION: BOOL CreatePipe ( PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize ) ;
+FUNCTION: BOOL CreateProcessW ( LPCTSTR lpApplicationname,
+                                LPTSTR lpCommandLine,
+                                LPSECURITY_ATTRIBUTES lpProcessAttributes,
+                                LPSECURITY_ATTRIBUTES lpThreadAttributes,
+                                BOOL bInheritHandles,
+                                DWORD dwCreationFlags,
+                                LPVOID lpEnvironment,
+                                LPCTSTR lpCurrentDirectory,
+                                LPSTARTUPINFO lpStartupInfo,
+                                LPPROCESS_INFORMATION lpProcessInformation ) ;
+: CreateProcess CreateProcessW ;
+! FUNCTION: CreateProcessInternalA
+! FUNCTION: CreateProcessInternalW
+! FUNCTION: CreateProcessInternalWSecure
+FUNCTION: HANDLE CreateRemoteThread ( HANDLE hProcess,
+                                      LPSECURITY_ATTRIBUTES lpThreadAttributes,
+                                      SIZE_T dwStackSize,
+                                      LPVOID lpStartAddress,
+                                      LPVOID lpParameter,
+                                      DWORD dwCreationFlags,
+                                      LPDWORD lpThreadId ) ; 
+! FUNCTION: CreateSemaphoreA
+! FUNCTION: CreateSemaphoreW
+! FUNCTION: CreateSocketHandle
+! FUNCTION: CreateTapePartition
+! FUNCTION: CreateThread
+! FUNCTION: CreateTimerQueue
+! FUNCTION: CreateTimerQueueTimer
+! FUNCTION: CreateToolhelp32Snapshot
+! FUNCTION: CreateVirtualBuffer
+! FUNCTION: CreateWaitableTimerA
+! FUNCTION: CreateWaitableTimerW
+! FUNCTION: DeactivateActCtx
+! FUNCTION: DebugActiveProcess
+! FUNCTION: DebugActiveProcessStop
+! FUNCTION: DebugBreak
+! FUNCTION: DebugBreakProcess
+! FUNCTION: DebugSetProcessKillOnExit
+! FUNCTION: DecodePointer
+! FUNCTION: DecodeSystemPointer
+! FUNCTION: DefineDosDeviceA
+! FUNCTION: DefineDosDeviceW
+! FUNCTION: DelayLoadFailureHook
+! FUNCTION: DeleteAtom
+! FUNCTION: DeleteCriticalSection
+! FUNCTION: DeleteFiber
+! FUNCTION: DeleteFileA
+FUNCTION: BOOL DeleteFileW ( LPCTSTR lpFileName ) ;
+: DeleteFile DeleteFileW ;
+! FUNCTION: DeleteTimerQueue
+! FUNCTION: DeleteTimerQueueEx
+! FUNCTION: DeleteTimerQueueTimer
+! FUNCTION: DeleteVolumeMountPointA
+! FUNCTION: DeleteVolumeMountPointW
+! FUNCTION: DeviceIoControl
+! FUNCTION: DisableThreadLibraryCalls
+! FUNCTION: DisconnectNamedPipe
+! FUNCTION: DnsHostnameToComputerNameA
+! FUNCTION: DnsHostnameToComputerNameW
+! FUNCTION: DosDateTimeToFileTime
+! FUNCTION: DosPathToSessionPathA
+! FUNCTION: DosPathToSessionPathW
+! FUNCTION: DuplicateConsoleHandle
+! FUNCTION: DuplicateHandle
+! FUNCTION: EncodePointer
+! FUNCTION: EncodeSystemPointer
+! FUNCTION: EndUpdateResourceA
+! FUNCTION: EndUpdateResourceW
+! FUNCTION: EnterCriticalSection
+! FUNCTION: EnumCalendarInfoA
+! FUNCTION: EnumCalendarInfoExA
+! FUNCTION: EnumCalendarInfoExW
+! FUNCTION: EnumCalendarInfoW
+! FUNCTION: EnumDateFormatsA
+! FUNCTION: EnumDateFormatsExA
+! FUNCTION: EnumDateFormatsExW
+! FUNCTION: EnumDateFormatsW
+! FUNCTION: EnumerateLocalComputerNamesA
+! FUNCTION: EnumerateLocalComputerNamesW
+! FUNCTION: EnumLanguageGroupLocalesA
+! FUNCTION: EnumLanguageGroupLocalesW
+! FUNCTION: EnumResourceLanguagesA
+! FUNCTION: EnumResourceLanguagesW
+! FUNCTION: EnumResourceNamesA
+! FUNCTION: EnumResourceNamesW
+! FUNCTION: EnumResourceTypesA
+! FUNCTION: EnumResourceTypesW
+! FUNCTION: EnumSystemCodePagesA
+! FUNCTION: EnumSystemCodePagesW
+! FUNCTION: EnumSystemGeoID
+! FUNCTION: EnumSystemLanguageGroupsA
+! FUNCTION: EnumSystemLanguageGroupsW
+! FUNCTION: EnumSystemLocalesA
+! FUNCTION: EnumSystemLocalesW
+! FUNCTION: EnumTimeFormatsA
+! FUNCTION: EnumTimeFormatsW
+! FUNCTION: EnumUILanguagesA
+! FUNCTION: EnumUILanguagesW
+! FUNCTION: EraseTape
+! FUNCTION: EscapeCommFunction
+! FUNCTION: ExitProcess
+! FUNCTION: ExitThread
+! FUNCTION: ExitVDM
+! FUNCTION: ExpandEnvironmentStringsA
+! FUNCTION: ExpandEnvironmentStringsW
+! FUNCTION: ExpungeConsoleCommandHistoryA
+! FUNCTION: ExpungeConsoleCommandHistoryW
+! FUNCTION: ExtendVirtualBuffer
+! FUNCTION: FatalAppExitA
+! FUNCTION: FatalAppExitW
+! FUNCTION: FatalExit
+! FUNCTION: FileTimeToDosDateTime
+! FUNCTION: FileTimeToLocalFileTime
+! FUNCTION: FileTimeToSystemTime
+! FUNCTION: FillConsoleOutputAttribute
+! FUNCTION: FillConsoleOutputCharacterA
+! FUNCTION: FillConsoleOutputCharacterW
+! FUNCTION: FindActCtxSectionGuid
+! FUNCTION: FindActCtxSectionStringA
+! FUNCTION: FindActCtxSectionStringW
+! FUNCTION: FindAtomA
+! FUNCTION: FindAtomW
+FUNCTION: BOOL FindClose ( HANDLE hFindFile ) ;
+FUNCTION: BOOL FindCloseChangeNotification ( HANDLE hChangeHandle ) ;
+FUNCTION: HANDLE FindFirstChangeNotificationW ( LPCTSTR lpPathName,
+                                        BOOL bWatchSubtree,
+                                        DWORD dwNotifyFilter ) ;
+: FindFirstChangeNotification FindFirstChangeNotificationW ;
+! FUNCTION: FindFirstFileA
+! FUNCTION: FindFirstFileExA
+! FUNCTION: FindFirstFileExW
+FUNCTION: HANDLE FindFirstFileW ( LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData ) ;
+: FindFirstFile FindFirstFileW ;
+! FUNCTION: FindFirstVolumeA
+! FUNCTION: FindFirstVolumeMountPointA
+! FUNCTION: FindFirstVolumeMountPointW
+! FUNCTION: FindFirstVolumeW
+FUNCTION: BOOL FindNextChangeNotification ( HANDLE hChangeHandle ) ;
+! FUNCTION: FindNextFileA
+FUNCTION: BOOL FindNextFileW ( HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData ) ;
+: FindNextFile FindNextFileW ;
+! FUNCTION: FindNextVolumeA
+! FUNCTION: FindNextVolumeMountPointA
+! FUNCTION: FindNextVolumeMountPointW
+! FUNCTION: FindNextVolumeW
+! FUNCTION: FindResourceA
+! FUNCTION: FindResourceExA
+! FUNCTION: FindResourceExW
+! FUNCTION: FindResourceW
+! FUNCTION: FindVolumeClose
+! FUNCTION: FindVolumeMountPointClose
+! FUNCTION: FlushConsoleInputBuffer
+! FUNCTION: FlushFileBuffers
+! FUNCTION: FlushInstructionCache
+! FUNCTION: FlushViewOfFile
+! FUNCTION: FoldStringA
+! FUNCTION: FoldStringW
+! FUNCTION: FormatMessageA
+! FUNCTION: FormatMessageW
+! FUNCTION: FreeConsole
+! FUNCTION: FreeEnvironmentStringsA
+! FUNCTION: FreeEnvironmentStringsW
+! FUNCTION: FreeLibrary
+! FUNCTION: FreeLibraryAndExitThread
+! FUNCTION: FreeResource
+! FUNCTION: FreeUserPhysicalPages
+! FUNCTION: FreeVirtualBuffer
+! FUNCTION: GenerateConsoleCtrlEvent
+! FUNCTION: GetACP
+! FUNCTION: GetAtomNameA
+! FUNCTION: GetAtomNameW
+! FUNCTION: GetBinaryType
+! FUNCTION: GetBinaryTypeA
+! FUNCTION: GetBinaryTypeW
+! FUNCTION: GetCalendarInfoA
+! FUNCTION: GetCalendarInfoW
+! FUNCTION: GetCommandLineA
+! FUNCTION: GetCommandLineW
+! FUNCTION: GetCommConfig
+! FUNCTION: GetCommMask
+! FUNCTION: GetCommModemStatus
+! FUNCTION: GetCommProperties
+! FUNCTION: GetCommState
+! FUNCTION: GetCommTimeouts
+! FUNCTION: GetComPlusPackageInstallStatus
+! FUNCTION: GetCompressedFileSizeA
+! FUNCTION: GetCompressedFileSizeW
+FUNCTION: BOOL GetComputerNameW ( LPTSTR lpBuffer, LPDWORD lpnSize ) ;
+! FUNCTION: GetComputerNameExW
+! FUNCTION: GetComputerNameW
+: GetComputerName GetComputerNameW ;
+! FUNCTION: GetConsoleAliasA
+! FUNCTION: GetConsoleAliasesA
+! FUNCTION: GetConsoleAliasesLengthA
+! FUNCTION: GetConsoleAliasesLengthW
+! FUNCTION: GetConsoleAliasesW
+! FUNCTION: GetConsoleAliasExesA
+! FUNCTION: GetConsoleAliasExesLengthA
+! FUNCTION: GetConsoleAliasExesLengthW
+! FUNCTION: GetConsoleAliasExesW
+! FUNCTION: GetConsoleAliasW
+! FUNCTION: GetConsoleCharType
+! FUNCTION: GetConsoleCommandHistoryA
+! FUNCTION: GetConsoleCommandHistoryLengthA
+! FUNCTION: GetConsoleCommandHistoryLengthW
+! FUNCTION: GetConsoleCommandHistoryW
+! FUNCTION: GetConsoleCP
+! FUNCTION: GetConsoleCursorInfo
+! FUNCTION: GetConsoleCursorMode
+! FUNCTION: GetConsoleDisplayMode
+! FUNCTION: GetConsoleFontInfo
+! FUNCTION: GetConsoleFontSize
+! FUNCTION: GetConsoleHardwareState
+! FUNCTION: GetConsoleInputExeNameA
+! FUNCTION: GetConsoleInputExeNameW
+! FUNCTION: GetConsoleInputWaitHandle
+! FUNCTION: GetConsoleKeyboardLayoutNameA
+! FUNCTION: GetConsoleKeyboardLayoutNameW
+! FUNCTION: GetConsoleMode
+! FUNCTION: GetConsoleNlsMode
+! FUNCTION: GetConsoleOutputCP
+! FUNCTION: GetConsoleProcessList
+! FUNCTION: GetConsoleScreenBufferInfo
+! FUNCTION: GetConsoleSelectionInfo
+FUNCTION: DWORD GetConsoleTitleW ( LPWSTR lpConsoleTitle, DWORD nSize ) ;
+: GetConsoleTitle GetConsoleTitleW ; inline
+! FUNCTION: GetConsoleWindow
+! FUNCTION: GetCPFileNameFromRegistry
+! FUNCTION: GetCPInfo
+! FUNCTION: GetCPInfoExA
+! FUNCTION: GetCPInfoExW
+! FUNCTION: GetCurrencyFormatA
+! FUNCTION: GetCurrencyFormatW
+! FUNCTION: GetCurrentActCtx
+! FUNCTION: GetCurrentConsoleFont
+! FUNCTION: GetCurrentDirectoryA
+! FUNCTION: GetCurrentDirectoryW
+FUNCTION: HANDLE GetCurrentProcess ( ) ;
+! FUNCTION: GetCurrentProcessId
+FUNCTION: HANDLE GetCurrentThread ( ) ;
+! FUNCTION: GetCurrentThreadId
+! FUNCTION: GetDateFormatA
+! FUNCTION: GetDateFormatW
+! FUNCTION: GetDefaultCommConfigA
+! FUNCTION: GetDefaultCommConfigW
+! FUNCTION: GetDefaultSortkeySize
+! FUNCTION: GetDevicePowerState
+! FUNCTION: GetDiskFreeSpaceA
+! FUNCTION: GetDiskFreeSpaceExA
+! FUNCTION: GetDiskFreeSpaceExW
+! FUNCTION: GetDiskFreeSpaceW
+! FUNCTION: GetDllDirectoryA
+! FUNCTION: GetDllDirectoryW
+! FUNCTION: GetDriveTypeA
+! FUNCTION: GetDriveTypeW
+! FUNCTION: GetEnvironmentStrings
+! FUNCTION: GetEnvironmentStringsA
+! FUNCTION: GetEnvironmentStringsW
+! FUNCTION: GetEnvironmentVariableA
+! FUNCTION: GetEnvironmentVariableW
+! FUNCTION: GetExitCodeProcess
+! FUNCTION: GetExitCodeThread
+! FUNCTION: GetExpandedNameA
+! FUNCTION: GetExpandedNameW
+! FUNCTION: GetFileAttributesA
+FUNCTION: DWORD GetFileAttributesW ( LPCTSTR lpFileName ) ;
+! FUNCTION: GetFileAttributesExA
+
+: GetFileExInfoStandard 0 ; inline
+
+
+FUNCTION: BOOL GetFileAttributesExW ( LPCTSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ) ;
+
+: GetFileAttributesEx GetFileAttributesExW ;
+
+FUNCTION: BOOL GetFileInformationByHandle ( HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation ) ;
+FUNCTION: DWORD GetFileSize ( HANDLE hFile, LPDWORD lpFileSizeHigh ) ;
+! FUNCTION: GetFileSizeEx
+FUNCTION: BOOL GetFileTime ( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ) ;
+FUNCTION: DWORD GetFileType ( HANDLE hFile ) ;
+! FUNCTION: GetFirmwareEnvironmentVariableA
+! FUNCTION: GetFirmwareEnvironmentVariableW
+! FUNCTION: GetFullPathNameA
+FUNCTION: DWORD GetFullPathNameW ( LPCTSTR lpFileName, DWORD nBufferLength, LPTSTR lpBuffer, LPTSTR* lpFilePart ) ;
+: GetFullPathName GetFullPathNameW ;
+
+!  clear "license.txt" 32768 "char[32768]" <c-object> f over >r GetFullPathName r> swap 2 * head >string .
+
+! FUNCTION: GetGeoInfoA
+! FUNCTION: GetGeoInfoW
+! FUNCTION: GetHandleContext
+FUNCTION: BOOL GetHandleInformation ( HANDLE hObject, LPDWORD lpdwFlags ) ;
+! FUNCTION: GetLargestConsoleWindowSize
+FUNCTION: DWORD GetLastError ( ) ;
+! FUNCTION: GetLinguistLangSize
+! FUNCTION: GetLocaleInfoA
+! FUNCTION: GetLocaleInfoW
+! FUNCTION: GetLocalTime
+! FUNCTION: GetLogicalDrives
+! FUNCTION: GetLogicalDriveStringsA
+! FUNCTION: GetLogicalDriveStringsW
+! FUNCTION: GetLongPathNameA
+! FUNCTION: GetLongPathNameW
+! FUNCTION: GetMailslotInfo
+! FUNCTION: GetModuleFileNameA
+! FUNCTION: GetModuleFileNameW
+FUNCTION: HMODULE GetModuleHandleW ( LPCWSTR lpModuleName ) ;
+: GetModuleHandle GetModuleHandleW ; inline
+! FUNCTION: GetModuleHandleExA
+! FUNCTION: GetModuleHandleExW
+! FUNCTION: GetNamedPipeHandleStateA
+! FUNCTION: GetNamedPipeHandleStateW
+! FUNCTION: GetNamedPipeInfo
+! FUNCTION: GetNativeSystemInfo
+! FUNCTION: GetNextVDMCommand
+! FUNCTION: GetNlsSectionName
+! FUNCTION: GetNumaAvailableMemory
+! FUNCTION: GetNumaAvailableMemoryNode
+! FUNCTION: GetNumaHighestNodeNumber
+! FUNCTION: GetNumaNodeProcessorMask
+! FUNCTION: GetNumaProcessorMap
+! FUNCTION: GetNumaProcessorNode
+! FUNCTION: GetNumberFormatA
+! FUNCTION: GetNumberFormatW
+! FUNCTION: GetNumberOfConsoleFonts
+! FUNCTION: GetNumberOfConsoleInputEvents
+! FUNCTION: GetNumberOfConsoleMouseButtons
+! FUNCTION: GetOEMCP
+FUNCTION: BOOL GetOverlappedResult ( HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait ) ;
+! FUNCTION: GetPriorityClass
+! FUNCTION: GetPrivateProfileIntA
+! FUNCTION: GetPrivateProfileIntW
+! FUNCTION: GetPrivateProfileSectionA
+! FUNCTION: GetPrivateProfileSectionNamesA
+! FUNCTION: GetPrivateProfileSectionNamesW
+! FUNCTION: GetPrivateProfileSectionW
+! FUNCTION: GetPrivateProfileStringA
+! FUNCTION: GetPrivateProfileStringW
+! FUNCTION: GetPrivateProfileStructA
+! FUNCTION: GetPrivateProfileStructW
+FUNCTION: LPVOID GetProcAddress ( HMODULE hModule, char* lpProcName ) ;
+! FUNCTION: GetProcessAffinityMask
+! FUNCTION: GetProcessHandleCount
+! FUNCTION: GetProcessHeap
+! FUNCTION: GetProcessHeaps
+! FUNCTION: GetProcessId
+! FUNCTION: GetProcessIoCounters
+! FUNCTION: GetProcessPriorityBoost
+! FUNCTION: GetProcessShutdownParameters
+! FUNCTION: GetProcessTimes
+! FUNCTION: GetProcessVersion
+! FUNCTION: GetProcessWorkingSetSize
+! FUNCTION: GetProfileIntA
+! FUNCTION: GetProfileIntW
+! FUNCTION: GetProfileSectionA
+! FUNCTION: GetProfileSectionW
+! FUNCTION: GetProfileStringA
+! FUNCTION: GetProfileStringW
+FUNCTION: BOOL GetQueuedCompletionStatus ( HANDLE hCompletionPort, LPDWORD lpNumberOfBytes, void* lpCompletionKey, LPOVERLAPPED lpOverlapped, DWORD dwMilliseconds ) ;
+! FUNCTION: GetShortPathNameA
+! FUNCTION: GetShortPathNameW
+! FUNCTION: GetStartupInfoA
+! FUNCTION: GetStartupInfoW
+FUNCTION: HANDLE GetStdHandle ( DWORD nStdHandle ) ;
+! FUNCTION: GetStringTypeA
+! FUNCTION: GetStringTypeExA
+! FUNCTION: GetStringTypeExW
+! FUNCTION: GetStringTypeW
+! FUNCTION: GetSystemDefaultLangID
+! FUNCTION: GetSystemDefaultLCID
+! FUNCTION: GetSystemDefaultUILanguage
+! FUNCTION: GetSystemDirectoryA
+! FUNCTION: GetSystemDirectoryW
+FUNCTION: void GetSystemInfo ( LPSYSTEM_INFO lpSystemInfo ) ;
+! FUNCTION: GetSystemPowerStatus
+! FUNCTION: GetSystemRegistryQuota
+FUNCTION: void GetSystemTime ( LPSYSTEMTIME lpSystemTime ) ;
+! FUNCTION: GetSystemTimeAdjustment
+FUNCTION: void GetSystemTimeAsFileTime ( LPFILETIME lpSystemTimeAsFileTime ) ;
+! FUNCTION: GetSystemTimes
+! FUNCTION: GetSystemWindowsDirectoryA
+! FUNCTION: GetSystemWindowsDirectoryW
+! FUNCTION: GetSystemWow64DirectoryA
+! FUNCTION: GetSystemWow64DirectoryW
+! FUNCTION: GetTapeParameters
+! FUNCTION: GetTapePosition
+! FUNCTION: GetTapeStatus
+! FUNCTION: GetTempFileNameA
+! FUNCTION: GetTempFileNameW
+! FUNCTION: GetTempPathA
+! FUNCTION: GetTempPathW
+! FUNCTION: GetThreadContext
+! FUNCTION: GetThreadIOPendingFlag
+! FUNCTION: GetThreadLocale
+! FUNCTION: GetThreadPriority
+! FUNCTION: GetThreadPriorityBoost
+! FUNCTION: GetThreadSelectorEntry
+! FUNCTION: GetThreadTimes
+! FUNCTION: GetTickCount
+! FUNCTION: GetTimeFormatA
+! FUNCTION: GetTimeFormatW
+FUNCTION: DWORD GetTimeZoneInformation ( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ) ;
+! FUNCTION: GetUserDefaultLangID
+! FUNCTION: GetUserDefaultLCID
+! FUNCTION: GetUserDefaultUILanguage
+! FUNCTION: GetUserGeoID
+! FUNCTION: GetVDMCurrentDirectories
+FUNCTION: DWORD GetVersion ( ) ;
+FUNCTION: BOOL GetVersionExW ( LPOSVERSIONINFO lpVersionInfo ) ;
+: GetVersionEx GetVersionExW ;
+! FUNCTION: GetVolumeInformationA
+! FUNCTION: GetVolumeInformationW
+! FUNCTION: GetVolumeNameForVolumeMountPointA
+! FUNCTION: GetVolumeNameForVolumeMountPointW
+! FUNCTION: GetVolumePathNameA
+! FUNCTION: GetVolumePathNamesForVolumeNameA
+! FUNCTION: GetVolumePathNamesForVolumeNameW
+! FUNCTION: GetVolumePathNameW
+! FUNCTION: GetWindowsDirectoryA
+! FUNCTION: GetWindowsDirectoryW
+! FUNCTION: GetWriteWatch
+! FUNCTION: GlobalAddAtomA
+! FUNCTION: GlobalAddAtomW
+FUNCTION: HGLOBAL GlobalAlloc ( UINT uFlags, SIZE_T dwBytes ) ;
+! FUNCTION: GlobalCompact
+! FUNCTION: GlobalDeleteAtom
+! FUNCTION: GlobalFindAtomA
+! FUNCTION: GlobalFindAtomW
+! FUNCTION: GlobalFix
+! FUNCTION: GlobalFlags
+! FUNCTION: GlobalFree
+! FUNCTION: GlobalGetAtomNameA
+! FUNCTION: GlobalGetAtomNameW
+! FUNCTION: GlobalHandle
+FUNCTION: LPVOID GlobalLock ( HGLOBAL hMem ) ;
+FUNCTION: void GlobalMemoryStatus ( LPMEMORYSTATUS lpBuffer ) ;
+FUNCTION: BOOL GlobalMemoryStatusEx ( LPMEMORYSTATUSEX lpBuffer ) ;
+! FUNCTION: GlobalReAlloc
+! FUNCTION: GlobalSize
+! FUNCTION: GlobalUnfix
+FUNCTION: BOOL GlobalUnlock ( HGLOBAL hMem ) ;
+! FUNCTION: GlobalUnWire
+! FUNCTION: GlobalWire
+! FUNCTION: Heap32First
+! FUNCTION: Heap32ListFirst
+! FUNCTION: Heap32ListNext
+! FUNCTION: Heap32Next
+! FUNCTION: HeapAlloc
+! FUNCTION: HeapCompact
+! FUNCTION: HeapCreate
+! FUNCTION: HeapCreateTagsW
+! FUNCTION: HeapDestroy
+! FUNCTION: HeapExtend
+! FUNCTION: HeapFree
+! FUNCTION: HeapLock
+! FUNCTION: HeapQueryInformation
+! FUNCTION: HeapQueryTagW
+! FUNCTION: HeapReAlloc
+! FUNCTION: HeapSetInformation
+! FUNCTION: HeapSize
+! FUNCTION: HeapSummary
+! FUNCTION: HeapUnlock
+! FUNCTION: HeapUsage
+! FUNCTION: HeapValidate
+! FUNCTION: HeapWalk
+! FUNCTION: InitAtomTable
+! FUNCTION: InitializeCriticalSection
+! FUNCTION: InitializeCriticalSectionAndSpinCount
+! FUNCTION: InitializeSListHead
+! FUNCTION: InterlockedCompareExchange
+! FUNCTION: InterlockedDecrement
+! FUNCTION: InterlockedExchange
+! FUNCTION: InterlockedExchangeAdd
+! FUNCTION: InterlockedFlushSList
+! FUNCTION: InterlockedIncrement
+! FUNCTION: InterlockedPopEntrySList
+! FUNCTION: InterlockedPushEntrySList
+! FUNCTION: InvalidateConsoleDIBits
+! FUNCTION: IsBadCodePtr
+! FUNCTION: IsBadHugeReadPtr
+! FUNCTION: IsBadHugeWritePtr
+! FUNCTION: IsBadReadPtr
+! FUNCTION: IsBadStringPtrA
+! FUNCTION: IsBadStringPtrW
+! FUNCTION: IsBadWritePtr
+! FUNCTION: IsDBCSLeadByte
+! FUNCTION: IsDBCSLeadByteEx
+! FUNCTION: IsDebuggerPresent
+! FUNCTION: IsProcessInJob
+FUNCTION: BOOL IsProcessorFeaturePresent ( DWORD ProcessorFeature ) ;
+! FUNCTION: IsSystemResumeAutomatic
+! FUNCTION: IsValidCodePage
+! FUNCTION: IsValidLanguageGroup
+! FUNCTION: IsValidLocale
+! FUNCTION: IsValidUILanguage
+! FUNCTION: IsWow64Process
+! FUNCTION: LCMapStringA
+! FUNCTION: LCMapStringW
+! FUNCTION: LeaveCriticalSection
+! FUNCTION: LoadLibraryA
+! FUNCTION: LoadLibraryExA
+! FUNCTION: LoadLibraryExW
+! FUNCTION: LoadLibraryW
+! FUNCTION: LoadModule
+! FUNCTION: LoadResource
+! FUNCTION: LocalAlloc
+! FUNCTION: LocalCompact
+! FUNCTION: LocalFileTimeToFileTime
+! FUNCTION: LocalFlags
+FUNCTION: HLOCAL LocalFree ( HLOCAL hMem ) ;
+! FUNCTION: LocalHandle
+! FUNCTION: LocalLock
+! FUNCTION: LocalReAlloc
+! FUNCTION: LocalShrink
+! FUNCTION: LocalSize
+! FUNCTION: LocalUnlock
+! FUNCTION: LockFile
+! FUNCTION: LockFileEx
+! FUNCTION: LockResource
+! FUNCTION: lstrcat
+! FUNCTION: lstrcatA
+! FUNCTION: lstrcatW
+! FUNCTION: lstrcmp
+! FUNCTION: lstrcmpA
+! FUNCTION: lstrcmpi
+! FUNCTION: lstrcmpiA
+! FUNCTION: lstrcmpiW
+! FUNCTION: lstrcmpW
+! FUNCTION: lstrcpy
+! FUNCTION: lstrcpyA
+! FUNCTION: lstrcpyn
+! FUNCTION: lstrcpynA
+! FUNCTION: lstrcpynW
+! FUNCTION: lstrcpyW
+! FUNCTION: lstrlen
+! FUNCTION: lstrlenA
+! FUNCTION: lstrlenW
+! FUNCTION: LZClose
+! FUNCTION: LZCloseFile
+! FUNCTION: LZCopy
+! FUNCTION: LZCreateFileW
+! FUNCTION: LZDone
+! FUNCTION: LZInit
+! FUNCTION: LZOpenFileA
+! FUNCTION: LZOpenFileW
+! FUNCTION: LZRead
+! FUNCTION: LZSeek
+! FUNCTION: LZStart
+! FUNCTION: MapUserPhysicalPages
+! FUNCTION: MapUserPhysicalPagesScatter
+FUNCTION: LPVOID MapViewOfFile ( HANDLE hFileMappingObject,
+                                 DWORD dwDesiredAccess,
+                                 DWORD dwFileOffsetHigh,
+                                 DWORD dwFileOffsetLow,
+                                 SIZE_T dwNumberOfBytesToMap ) ;
+
+FUNCTION: LPVOID MapViewOfFileEx ( HANDLE hFileMappingObject,
+                                 DWORD dwDesiredAccess,
+                                 DWORD dwFileOffsetHigh,
+                                 DWORD dwFileOffsetLow,
+                                 SIZE_T dwNumberOfBytesToMap,
+                                 LPVOID lpBaseAddress ) ;
+
+! FUNCTION: Module32First
+! FUNCTION: Module32FirstW
+! FUNCTION: Module32Next
+! FUNCTION: Module32NextW
+! FUNCTION: MoveFileA
+! FUNCTION: MoveFileExA
+! FUNCTION: MoveFileExW
+FUNCTION: BOOL MoveFileW ( LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName ) ;
+: MoveFile MoveFileW ;
+! FUNCTION: MoveFileWithProgressA
+! FUNCTION: MoveFileWithProgressW
+! FUNCTION: MulDiv
+! FUNCTION: MultiByteToWideChar
+! FUNCTION: NlsConvertIntegerToString
+! FUNCTION: NlsGetCacheUpdateCount
+! FUNCTION: NlsResetProcessLocale
+! FUNCTION: NumaVirtualQueryNode
+! FUNCTION: OpenConsoleW
+! FUNCTION: OpenDataFile
+! FUNCTION: OpenEventA
+! FUNCTION: OpenEventW
+! WARNING: OpenFile is limited to paths of 128 chars in length.  Do not use!
+! FUNCTION: HFILE OpenFile ( LPCTSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle ) ;
+FUNCTION: HANDLE OpenFileMappingW ( DWORD dwDesiredAccess,
+                                    BOOL bInheritHandle,
+                                    LPCTSTR lpName ) ;
+: OpenFileMapping OpenFileMappingW ;
+! FUNCTION: OpenJobObjectA
+! FUNCTION: OpenJobObjectW
+! FUNCTION: OpenMutexA
+! FUNCTION: OpenMutexW
+FUNCTION: HANDLE OpenProcess ( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ) ;
+! FUNCTION: OpenProfileUserMapping
+! FUNCTION: OpenSemaphoreA
+! FUNCTION: OpenSemaphoreW
+! FUNCTION: OpenThread
+! FUNCTION: OpenWaitableTimerA
+! FUNCTION: OpenWaitableTimerW
+! FUNCTION: OutputDebugStringA
+! FUNCTION: OutputDebugStringW
+! FUNCTION: PeekConsoleInputA
+! FUNCTION: PeekConsoleInputW
+! FUNCTION: PeekNamedPipe
+! FUNCTION: PostQueuedCompletionStatus
+! FUNCTION: PrepareTape
+! FUNCTION: PrivCopyFileExW
+! FUNCTION: PrivMoveFileIdentityW
+! FUNCTION: Process32First
+! FUNCTION: Process32FirstW
+! FUNCTION: Process32Next
+! FUNCTION: Process32NextW
+! FUNCTION: ProcessIdToSessionId
+! FUNCTION: PulseEvent
+! FUNCTION: PurgeComm
+! FUNCTION: QueryActCtxW
+! FUNCTION: QueryDepthSList
+! FUNCTION: QueryDosDeviceA
+! FUNCTION: QueryDosDeviceW
+! FUNCTION: QueryInformationJobObject
+! FUNCTION: QueryMemoryResourceNotification
+! FUNCTION: QueryPerformanceCounter
+! FUNCTION: QueryPerformanceFrequency
+! FUNCTION: QueryWin31IniFilesMappedToRegistry
+! FUNCTION: QueueUserAPC
+! FUNCTION: QueueUserWorkItem
+! FUNCTION: RaiseException
+! FUNCTION: ReadConsoleA
+! FUNCTION: ReadConsoleInputA
+! FUNCTION: ReadConsoleInputExA
+! FUNCTION: ReadConsoleInputExW
+! FUNCTION: ReadConsoleInputW
+! FUNCTION: ReadConsoleOutputA
+! FUNCTION: ReadConsoleOutputAttribute
+! FUNCTION: ReadConsoleOutputCharacterA
+! FUNCTION: ReadConsoleOutputCharacterW
+! FUNCTION: ReadConsoleOutputW
+! FUNCTION: ReadConsoleW
+FUNCTION: BOOL ReadDirectoryChangesW ( HANDLE hDirectory, LPVOID lpBuffer, DWORD nBufferLength, BOOL bWatchSubtree, DWORD dwNotifyFilter, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped, void* lpCompletionRoutine ) ;
+FUNCTION: BOOL ReadFile ( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, void* lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) ;
+! FUNCTION: BOOL ReadFile ( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) ;
+FUNCTION: BOOL ReadFileEx ( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) ;
+! FUNCTION: ReadFileScatter
+FUNCTION: BOOL ReadProcessMemory ( HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, long nSize, long* lpNumberOfBytesRead )  ;
+! FUNCTION: RegisterConsoleIME
+! FUNCTION: RegisterConsoleOS2
+! FUNCTION: RegisterConsoleVDM
+! FUNCTION: RegisterWaitForInputIdle
+! FUNCTION: RegisterWaitForSingleObject
+! FUNCTION: RegisterWaitForSingleObjectEx
+! FUNCTION: RegisterWowBaseHandlers
+! FUNCTION: RegisterWowExec
+! FUNCTION: ReleaseActCtx
+! FUNCTION: ReleaseMutex
+! FUNCTION: ReleaseSemaphore
+! FUNCTION: RemoveDirectoryA
+FUNCTION: BOOL RemoveDirectoryW ( LPCTSTR lpPathName ) ;
+: RemoveDirectory RemoveDirectoryW ;
+! FUNCTION: RemoveLocalAlternateComputerNameA
+! FUNCTION: RemoveLocalAlternateComputerNameW
+! FUNCTION: RemoveVectoredExceptionHandler
+! FUNCTION: ReplaceFile
+! FUNCTION: ReplaceFileA
+! FUNCTION: ReplaceFileW
+! FUNCTION: RequestDeviceWakeup
+! FUNCTION: RequestWakeupLatency
+! FUNCTION: ResetEvent
+! FUNCTION: ResetWriteWatch
+! FUNCTION: RestoreLastError
+! FUNCTION: ResumeThread
+! FUNCTION: RtlCaptureContext
+! FUNCTION: RtlCaptureStackBackTrace
+! FUNCTION: RtlFillMemory
+! FUNCTION: RtlMoveMemory
+! FUNCTION: RtlUnwind
+! FUNCTION: RtlZeroMemory
+! FUNCTION: ScrollConsoleScreenBufferA
+! FUNCTION: ScrollConsoleScreenBufferW
+! FUNCTION: SearchPathA
+! FUNCTION: SearchPathW
+! FUNCTION: SetCalendarInfoA
+! FUNCTION: SetCalendarInfoW
+! FUNCTION: SetClientTimeZoneInformation
+! FUNCTION: SetCommBreak
+! FUNCTION: SetCommConfig
+! FUNCTION: SetCommMask
+! FUNCTION: SetCommState
+! FUNCTION: SetCommTimeouts
+! FUNCTION: SetComPlusPackageInstallStatus
+! FUNCTION: SetComputerNameA
+! FUNCTION: SetComputerNameExA
+! FUNCTION: SetComputerNameExW
+! FUNCTION: SetComputerNameW
+! FUNCTION: SetConsoleActiveScreenBuffer
+! FUNCTION: SetConsoleCommandHistoryMode
+! FUNCTION: SetConsoleCP
+! FUNCTION: SetConsoleCtrlHandler
+! FUNCTION: SetConsoleCursor
+! FUNCTION: SetConsoleCursorInfo
+! FUNCTION: SetConsoleCursorMode
+! FUNCTION: SetConsoleCursorPosition
+! FUNCTION: SetConsoleDisplayMode
+! FUNCTION: SetConsoleFont
+! FUNCTION: SetConsoleHardwareState
+! FUNCTION: SetConsoleIcon
+! FUNCTION: SetConsoleInputExeNameA
+! FUNCTION: SetConsoleInputExeNameW
+! FUNCTION: SetConsoleKeyShortcuts
+! FUNCTION: SetConsoleLocalEUDC
+! FUNCTION: SetConsoleMaximumWindowSize
+! FUNCTION: SetConsoleMenuClose
+! FUNCTION: SetConsoleMode
+! FUNCTION: SetConsoleNlsMode
+! FUNCTION: SetConsoleNumberOfCommandsA
+! FUNCTION: SetConsoleNumberOfCommandsW
+! FUNCTION: SetConsoleOS2OemFormat
+! FUNCTION: SetConsoleOutputCP
+! FUNCTION: SetConsolePalette
+! FUNCTION: SetConsoleScreenBufferSize
+FUNCTION: BOOL SetConsoleTextAttribute ( HANDLE hConsoleOutput, WORD wAttributes ) ;
+FUNCTION: BOOL SetConsoleTitleW ( LPCWSTR lpConsoleTitle ) ;
+: SetConsoleTitle SetConsoleTitleW ;
+! FUNCTION: SetConsoleWindowInfo
+! FUNCTION: SetCPGlobal
+! FUNCTION: SetCriticalSectionSpinCount
+! FUNCTION: SetCurrentDirectoryA
+! FUNCTION: SetCurrentDirectoryW
+! FUNCTION: SetDefaultCommConfigA
+! FUNCTION: SetDefaultCommConfigW
+! FUNCTION: SetDllDirectoryA
+! FUNCTION: SetDllDirectoryW
+FUNCTION: BOOL SetEndOfFile ( HANDLE hFile ) ;
+! FUNCTION: SetEnvironmentVariableA
+! FUNCTION: SetEnvironmentVariableW
+! FUNCTION: SetErrorMode
+! FUNCTION: SetEvent
+! FUNCTION: SetFileApisToANSI
+! FUNCTION: SetFileApisToOEM
+! FUNCTION: SetFileAttributesA
+! FUNCTION: SetFileAttributesW
+FUNCTION: DWORD SetFilePointer ( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ) ;
+FUNCTION: DWORD SetFilePointerEx ( HANDLE hFile, LARGE_INTEGER lDistanceToMove, PLARGE_INTEGER lpDistanceToMoveHigh, DWORD dwMoveMethod ) ;
+! FUNCTION: SetFileShortNameA
+! FUNCTION: SetFileShortNameW
+FUNCTION: BOOL SetFileTime ( HANDLE hFile, FILETIME* lpCreationTime, FILETIME* lpLastAccessTime, FILETIME* lpLastWriteTime ) ;
+! FUNCTION: SetFileValidData
+! FUNCTION: SetFirmwareEnvironmentVariableA
+! FUNCTION: SetFirmwareEnvironmentVariableW
+! FUNCTION: SetHandleContext
+! FUNCTION: SetHandleCount
+FUNCTION: BOOL SetHandleInformation ( HANDLE hObject, DWORD dwMask, DWORD dwFlags ) ;
+! FUNCTION: SetInformationJobObject
+! FUNCTION: SetLastConsoleEventActive
+! FUNCTION: SetLastError
+! FUNCTION: SetLocaleInfoA
+! FUNCTION: SetLocaleInfoW
+! FUNCTION: SetLocalPrimaryComputerNameA
+! FUNCTION: SetLocalPrimaryComputerNameW
+! FUNCTION: SetLocalTime
+! FUNCTION: SetMailslotInfo
+! FUNCTION: SetMessageWaitingIndicator
+! FUNCTION: SetNamedPipeHandleState
+! FUNCTION: SetPriorityClass
+! FUNCTION: SetProcessAffinityMask
+! FUNCTION: SetProcessPriorityBoost
+! FUNCTION: SetProcessShutdownParameters
+! FUNCTION: SetProcessWorkingSetSize
+! FUNCTION: SetStdHandle
+! FUNCTION: SetSystemPowerState
+! FUNCTION: SetSystemTime
+! FUNCTION: SetSystemTimeAdjustment
+! FUNCTION: SetTapeParameters
+! FUNCTION: SetTapePosition
+! FUNCTION: SetTermsrvAppInstallMode
+! FUNCTION: SetThreadAffinityMask
+! FUNCTION: SetThreadContext
+! FUNCTION: SetThreadExecutionState
+! FUNCTION: SetThreadIdealProcessor
+! FUNCTION: SetThreadLocale
+! FUNCTION: SetThreadPriority
+! FUNCTION: SetThreadPriorityBoost
+! FUNCTION: SetThreadUILanguage
+! FUNCTION: SetTimerQueueTimer
+! FUNCTION: SetTimeZoneInformation
+! FUNCTION: SetUnhandledExceptionFilter
+! FUNCTION: SetupComm
+! FUNCTION: SetUserGeoID
+! FUNCTION: SetVDMCurrentDirectories
+! FUNCTION: SetVolumeLabelA
+! FUNCTION: SetVolumeLabelW
+! FUNCTION: SetVolumeMountPointA
+! FUNCTION: SetVolumeMountPointW
+! FUNCTION: SetWaitableTimer
+! FUNCTION: ShowConsoleCursor
+! FUNCTION: SignalObjectAndWait
+! FUNCTION: SizeofResource
+! FUNCTION: Sleep
+FUNCTION: DWORD SleepEx ( DWORD dwMilliSeconds, BOOL bAlertable ) ;
+! FUNCTION: SuspendThread
+! FUNCTION: SwitchToFiber
+! FUNCTION: SwitchToThread
+FUNCTION: BOOL SystemTimeToFileTime ( SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime ) ;
+! FUNCTION: SystemTimeToTzSpecificLocalTime
+! FUNCTION: TerminateJobObject
+! FUNCTION: TerminateProcess
+! FUNCTION: TerminateThread
+! FUNCTION: TermsrvAppInstallMode
+! FUNCTION: Thread32First
+! FUNCTION: Thread32Next
+! FUNCTION: TlsAlloc
+! FUNCTION: TlsFree
+! FUNCTION: TlsGetValue
+! FUNCTION: TlsSetValue
+! FUNCTION: Toolhelp32ReadProcessMemory
+! FUNCTION: TransactNamedPipe
+! FUNCTION: TransmitCommChar
+! FUNCTION: TrimVirtualBuffer
+! FUNCTION: TryEnterCriticalSection
+! FUNCTION: TzSpecificLocalTimeToSystemTime
+! FUNCTION: UnhandledExceptionFilter
+! FUNCTION: UnlockFile
+! FUNCTION: UnlockFileEx
+FUNCTION: BOOL UnmapViewOfFile ( LPCVOID lpBaseAddress ) ;
+! FUNCTION: UnregisterConsoleIME
+! FUNCTION: UnregisterWait
+! FUNCTION: UnregisterWaitEx
+! FUNCTION: UpdateResourceA
+! FUNCTION: UpdateResourceW
+! FUNCTION: UTRegister
+! FUNCTION: UTUnRegister
+! FUNCTION: ValidateLCType
+! FUNCTION: ValidateLocale
+! FUNCTION: VDMConsoleOperation
+! FUNCTION: VDMOperationStarted
+! FUNCTION: VerifyConsoleIoHandle
+! FUNCTION: VerifyVersionInfoA
+! FUNCTION: VerifyVersionInfoW
+! FUNCTION: VerLanguageNameA
+! FUNCTION: VerLanguageNameW
+! FUNCTION: VerSetConditionMask
+! FUNCTION: VirtualAlloc
+FUNCTION: HANDLE VirtualAllocEx ( HANDLE hProcess, void* lpAddress, long dwSize, DWORD flAllocationType, DWORD flProtect ) ;
+! FUNCTION: VirtualBufferExceptionHandler
+! FUNCTION: VirtualFree
+FUNCTION: BOOL VirtualFreeEx ( HANDLE hProcess, void* lpAddress, long dwSize, DWORD dwFreeType ) ;
+! FUNCTION: VirtualLock
+! FUNCTION: VirtualProtect
+! FUNCTION: VirtualProtectEx
+! FUNCTION: VirtualQuery
+FUNCTION: BOOL VirtualQueryEx ( HANDLE hProcess, void* lpAddress, MEMORY_BASIC_INFORMATION* lpBuffer, SIZE_T dwLength ) ;
+! FUNCTION: VirtualUnlock
+! FUNCTION: WaitCommEvent
+! FUNCTION: WaitForDebugEvent
+! FUNCTION: WaitForMultipleObjects
+! FUNCTION: WaitForMultipleObjectsEx
+! FUNCTION: WaitForSingleObject
+! FUNCTION: WaitForSingleObjectEx
+! FUNCTION: WaitNamedPipeA
+! FUNCTION: WaitNamedPipeW
+! FUNCTION: WideCharToMultiByte
+! FUNCTION: WinExec
+! FUNCTION: WriteConsoleA
+! FUNCTION: WriteConsoleInputA
+! FUNCTION: WriteConsoleInputVDMA
+! FUNCTION: WriteConsoleInputVDMW
+! FUNCTION: WriteConsoleInputW
+! FUNCTION: WriteConsoleOutputA
+! FUNCTION: WriteConsoleOutputAttribute
+! FUNCTION: WriteConsoleOutputCharacterA
+! FUNCTION: WriteConsoleOutputCharacterW
+! FUNCTION: WriteConsoleOutputW
+! FUNCTION: WriteConsoleW
+FUNCTION: BOOL WriteFile ( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToWrite, void* lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ) ;
+FUNCTION: BOOL WriteFileEx ( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) ;
+! FUNCTION: WriteFileGather
+! FUNCTION: WritePrivateProfileSectionA
+! FUNCTION: WritePrivateProfileSectionW
+! FUNCTION: WritePrivateProfileStringA
+! FUNCTION: WritePrivateProfileStringW
+! FUNCTION: WritePrivateProfileStructA
+! FUNCTION: WritePrivateProfileStructW
+FUNCTION: BOOL WriteProcessMemory ( HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, long nSize, long* lpNumberOfBytesWritten )  ;
+! FUNCTION: WriteProfileSectionA
+! FUNCTION: WriteProfileSectionW
+! FUNCTION: WriteProfileStringA
+! FUNCTION: WriteProfileStringW
+! FUNCTION: WriteTapemark
+! FUNCTION: WTSGetActiveConsoleSessionId
+! FUNCTION: ZombifyActCtx
diff --git a/extra/windows/messages/messages.factor b/extra/windows/messages/messages.factor
new file mode 100644 (file)
index 0000000..bc8fe0f
--- /dev/null
@@ -0,0 +1,1003 @@
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs hashtables kernel math namespaces parser prettyprint words windows.types ;
+IN: windows.messages
+
+SYMBOL: windows-messages
+
+: maybe-create-windows-messages
+  global [ windows-messages
+  [ H{ } assoc-like ] change ] bind ;
+
+: add-windows-message ( -- )
+    word [ word-name ] keep execute maybe-create-windows-messages
+    windows-messages get set-at ; parsing
+
+: get-windows-message-name ( n -- name )
+    windows-messages get at* [ drop "unknown message" ] unless ;
+
+: WM_NULL HEX: 0000 ; inline add-windows-message
+: WM_CREATE HEX: 0001 ; inline add-windows-message
+: WM_DESTROY HEX: 0002 ; inline add-windows-message
+: WM_MOVE HEX: 0003 ; inline add-windows-message
+: WM_SIZE HEX: 0005 ; inline add-windows-message
+: WM_ACTIVATE HEX: 0006 ; inline add-windows-message
+: WM_SETFOCUS HEX: 0007 ; inline add-windows-message
+: WM_KILLFOCUS HEX: 0008 ; inline add-windows-message
+: WM_ENABLE HEX: 000A ; inline add-windows-message
+: WM_SETREDRAW HEX: 000B ; inline add-windows-message
+: WM_SETTEXT HEX: 000C ; inline add-windows-message
+: WM_GETTEXT HEX: 000D ; inline add-windows-message
+: WM_GETTEXTLENGTH HEX: 000E ; inline add-windows-message
+: WM_PAINT HEX: 000F ; inline add-windows-message
+: WM_CLOSE HEX: 0010 ; inline add-windows-message
+: WM_QUERYENDSESSION HEX: 0011 ; inline add-windows-message
+: WM_QUERYOPEN HEX: 0013 ; inline add-windows-message
+: WM_ENDSESSION HEX: 0016 ; inline add-windows-message
+: WM_QUIT HEX: 0012 ; inline add-windows-message
+: WM_ERASEBKGND HEX: 0014 ; inline add-windows-message
+: WM_SYSCOLORCHANGE HEX: 0015 ; inline add-windows-message
+: WM_SHOWWINDOW HEX: 0018 ; inline add-windows-message
+: WM_WININICHANGE HEX: 001A ; inline add-windows-message
+: WM_SETTINGCHANGE HEX: 001A ; inline add-windows-message
+: WM_DEVMODECHANGE HEX: 001B ; inline add-windows-message
+: WM_ACTIVATEAPP HEX: 001C ; inline add-windows-message
+: WM_FONTCHANGE HEX: 001D ; inline add-windows-message
+: WM_TIMECHANGE HEX: 001E ; inline add-windows-message
+: WM_CANCELMODE HEX: 001F ; inline add-windows-message
+: WM_SETCURSOR HEX: 0020 ; inline add-windows-message
+: WM_MOUSEACTIVATE HEX: 0021 ; inline add-windows-message
+: WM_CHILDACTIVATE HEX: 0022 ; inline add-windows-message
+: WM_QUEUESYNC HEX: 0023 ; inline add-windows-message
+: WM_GETMINMAXINFO HEX: 0024 ; inline add-windows-message
+: WM_PAINTICON HEX: 0026 ; inline add-windows-message
+: WM_ICONERASEBKGND HEX: 0027 ; inline add-windows-message
+: WM_NEXTDLGCTL HEX: 0028 ; inline add-windows-message
+: WM_SPOOLERSTATUS HEX: 002A ; inline add-windows-message
+: WM_DRAWITEM HEX: 002B ; inline add-windows-message
+: WM_MEASUREITEM HEX: 002C ; inline add-windows-message
+: WM_DELETEITEM HEX: 002D ; inline add-windows-message
+: WM_VKEYTOITEM HEX: 002E ; inline add-windows-message
+: WM_CHARTOITEM HEX: 002F ; inline add-windows-message
+: WM_SETFONT HEX: 0030 ; inline add-windows-message
+: WM_GETFONT HEX: 0031 ; inline add-windows-message
+: WM_SETHOTKEY HEX: 0032 ; inline add-windows-message
+: WM_GETHOTKEY HEX: 0033 ; inline add-windows-message
+: WM_QUERYDRAGICON HEX: 0037 ; inline add-windows-message
+: WM_COMPAREITEM HEX: 0039 ; inline add-windows-message
+: WM_GETOBJECT HEX: 003D ; inline add-windows-message
+: WM_COMPACTING HEX: 0041 ; inline add-windows-message
+: WM_COMMNOTIFY HEX: 0044 ; inline add-windows-message
+: WM_WINDOWPOSCHANGING HEX: 0046 ; inline add-windows-message
+: WM_WINDOWPOSCHANGED HEX: 0047 ; inline add-windows-message
+: WM_POWER HEX: 0048 ; inline add-windows-message
+: WM_COPYDATA HEX: 004A ; inline add-windows-message
+: WM_CANCELJOURNAL HEX: 004B ; inline add-windows-message
+: WM_NOTIFY HEX: 004E ; inline add-windows-message
+: WM_INPUTLANGCHANGEREQUEST HEX: 0050 ; inline add-windows-message
+: WM_INPUTLANGCHANGE HEX: 0051 ; inline add-windows-message
+: WM_TCARD HEX: 0052 ; inline add-windows-message
+: WM_HELP HEX: 0053 ; inline add-windows-message
+: WM_USERCHANGED HEX: 0054 ; inline add-windows-message
+: WM_NOTIFYFORMAT HEX: 0055 ; inline add-windows-message
+: WM_CONTEXTMENU HEX: 007B ; inline add-windows-message
+: WM_STYLECHANGING HEX: 007C ; inline add-windows-message
+: WM_STYLECHANGED HEX: 007D ; inline add-windows-message
+: WM_DISPLAYCHANGE HEX: 007E ; inline add-windows-message
+: WM_GETICON HEX: 007F ; inline add-windows-message
+: WM_SETICON HEX: 0080 ; inline add-windows-message
+: WM_NCCREATE HEX: 0081 ; inline add-windows-message
+: WM_NCDESTROY HEX: 0082 ; inline add-windows-message
+: WM_NCCALCSIZE HEX: 0083 ; inline add-windows-message
+: WM_NCHITTEST HEX: 0084 ; inline add-windows-message
+: WM_NCPAINT HEX: 0085 ; inline add-windows-message
+: WM_NCACTIVATE HEX: 0086 ; inline add-windows-message
+: WM_GETDLGCODE HEX: 0087 ; inline add-windows-message
+: WM_SYNCPAINT HEX: 0088 ; inline add-windows-message
+: WM_NCMOUSEMOVE HEX: 00A0 ; inline add-windows-message
+: WM_NCLBUTTONDOWN HEX: 00A1 ; inline add-windows-message
+: WM_NCLBUTTONUP HEX: 00A2 ; inline add-windows-message
+: WM_NCLBUTTONDBLCLK HEX: 00A3 ; inline add-windows-message
+: WM_NCRBUTTONDOWN HEX: 00A4 ; inline add-windows-message
+: WM_NCRBUTTONUP HEX: 00A5 ; inline add-windows-message
+: WM_NCRBUTTONDBLCLK HEX: 00A6 ; inline add-windows-message
+: WM_NCMBUTTONDOWN HEX: 00A7 ; inline add-windows-message
+: WM_NCMBUTTONUP HEX: 00A8 ; inline add-windows-message
+: WM_NCMBUTTONDBLCLK HEX: 00A9 ; inline add-windows-message
+: WM_NCXBUTTONDOWN HEX: 00AB ; inline add-windows-message
+: WM_NCXBUTTONUP HEX: 00AC ; inline add-windows-message
+: WM_NCXBUTTONDBLCLK HEX: 00AD ; inline add-windows-message
+: WM_INPUT HEX: 00FF ; inline add-windows-message
+: WM_KEYFIRST HEX: 0100 ; inline add-windows-message
+: WM_KEYDOWN HEX: 0100 ; inline add-windows-message
+: WM_KEYUP HEX: 0101 ; inline add-windows-message
+: WM_CHAR HEX: 0102 ; inline add-windows-message
+: WM_DEADCHAR HEX: 0103 ; inline add-windows-message
+: WM_SYSKEYDOWN HEX: 0104 ; inline add-windows-message
+: WM_SYSKEYUP HEX: 0105 ; inline add-windows-message
+: WM_SYSCHAR HEX: 0106 ; inline add-windows-message
+: WM_SYSDEADCHAR HEX: 0107 ; inline add-windows-message
+: WM_UNICHAR HEX: 0109 ; inline add-windows-message
+: WM_KEYLAST_NT501 HEX: 0109 ; inline add-windows-message
+: UNICODE_NOCHAR HEX: FFFF ; inline add-windows-message
+: WM_KEYLAST_PRE501 HEX: 0108 ; inline add-windows-message
+: WM_IME_STARTCOMPOSITION HEX: 010D ; inline add-windows-message
+: WM_IME_ENDCOMPOSITION HEX: 010E ; inline add-windows-message
+: WM_IME_COMPOSITION HEX: 010F ; inline add-windows-message
+: WM_IME_KEYLAST HEX: 010F ; inline add-windows-message
+: WM_INITDIALOG HEX: 0110 ; inline add-windows-message
+: WM_COMMAND HEX: 0111 ; inline add-windows-message
+: WM_SYSCOMMAND HEX: 0112 ; inline add-windows-message
+: WM_TIMER HEX: 0113 ; inline add-windows-message
+: WM_HSCROLL HEX: 0114 ; inline add-windows-message
+: WM_VSCROLL HEX: 0115 ; inline add-windows-message
+: WM_INITMENU HEX: 0116 ; inline add-windows-message
+: WM_INITMENUPOPUP HEX: 0117 ; inline add-windows-message
+: WM_MENUSELECT HEX: 011F ; inline add-windows-message
+: WM_MENUCHAR HEX: 0120 ; inline add-windows-message
+: WM_ENTERIDLE HEX: 0121 ; inline add-windows-message
+: WM_MENURBUTTONUP HEX: 0122 ; inline add-windows-message
+: WM_MENUDRAG HEX: 0123 ; inline add-windows-message
+: WM_MENUGETOBJECT HEX: 0124 ; inline add-windows-message
+: WM_UNINITMENUPOPUP HEX: 0125 ; inline add-windows-message
+: WM_MENUCOMMAND HEX: 0126 ; inline add-windows-message
+: WM_CHANGEUISTATE HEX: 0127 ; inline add-windows-message
+: WM_UPDATEUISTATE HEX: 0128 ; inline add-windows-message
+: WM_QUERYUISTATE HEX: 0129 ; inline add-windows-message
+: WM_CTLCOLORMSGBOX HEX: 0132 ; inline add-windows-message
+: WM_CTLCOLOREDIT HEX: 0133 ; inline add-windows-message
+: WM_CTLCOLORLISTBOX HEX: 0134 ; inline add-windows-message
+: WM_CTLCOLORBTN HEX: 0135 ; inline add-windows-message
+: WM_CTLCOLORDLG HEX: 0136 ; inline add-windows-message
+: WM_CTLCOLORSCROLLBAR HEX: 0137 ; inline add-windows-message
+: WM_CTLCOLORSTATIC HEX: 0138 ; inline add-windows-message
+: WM_MOUSEFIRST HEX: 0200 ; inline add-windows-message
+: WM_MOUSEMOVE HEX: 0200 ; inline add-windows-message
+: WM_LBUTTONDOWN HEX: 0201 ; inline add-windows-message
+: WM_LBUTTONUP HEX: 0202 ; inline add-windows-message
+: WM_LBUTTONDBLCLK HEX: 0203 ; inline add-windows-message
+: WM_RBUTTONDOWN HEX: 0204 ; inline add-windows-message
+: WM_RBUTTONUP HEX: 0205 ; inline add-windows-message
+: WM_RBUTTONDBLCLK HEX: 0206 ; inline add-windows-message
+: WM_MBUTTONDOWN HEX: 0207 ; inline add-windows-message
+: WM_MBUTTONUP HEX: 0208 ; inline add-windows-message
+: WM_MBUTTONDBLCLK HEX: 0209 ; inline add-windows-message
+: WM_MOUSEWHEEL HEX: 020A ; inline add-windows-message
+: WM_XBUTTONDOWN HEX: 020B ; inline add-windows-message
+: WM_XBUTTONUP HEX: 020C ; inline add-windows-message
+: WM_XBUTTONDBLCLK HEX: 020D ; inline add-windows-message
+: WM_MOUSELAST_5 HEX: 020D ; inline add-windows-message
+: WM_MOUSELAST_4 HEX: 020A ; inline add-windows-message
+: WM_MOUSELAST_PRE_4 HEX: 0209 ; inline add-windows-message
+: WM_PARENTNOTIFY HEX: 0210 ; inline add-windows-message
+: WM_ENTERMENULOOP HEX: 0211 ; inline add-windows-message
+: WM_EXITMENULOOP HEX: 0212 ; inline add-windows-message
+: WM_NEXTMENU HEX: 0213 ; inline add-windows-message
+: WM_SIZING HEX: 0214 ; inline add-windows-message
+: WM_CAPTURECHANGED HEX: 0215 ; inline add-windows-message
+: WM_MOVING HEX: 0216 ; inline add-windows-message
+: WM_POWERBROADCAST HEX: 0218 ; inline add-windows-message
+: WM_DEVICECHANGE HEX: 0219 ; inline add-windows-message
+: WM_MDICREATE HEX: 0220 ; inline add-windows-message
+: WM_MDIDESTROY HEX: 0221 ; inline add-windows-message
+: WM_MDIACTIVATE HEX: 0222 ; inline add-windows-message
+: WM_MDIRESTORE HEX: 0223 ; inline add-windows-message
+: WM_MDINEXT HEX: 0224 ; inline add-windows-message
+: WM_MDIMAXIMIZE HEX: 0225 ; inline add-windows-message
+: WM_MDITILE HEX: 0226 ; inline add-windows-message
+: WM_MDICASCADE HEX: 0227 ; inline add-windows-message
+: WM_MDIICONARRANGE HEX: 0228 ; inline add-windows-message
+: WM_MDIGETACTIVE HEX: 0229 ; inline add-windows-message
+: WM_MDISETMENU HEX: 0230 ; inline add-windows-message
+: WM_ENTERSIZEMOVE HEX: 0231 ; inline add-windows-message
+: WM_EXITSIZEMOVE HEX: 0232 ; inline add-windows-message
+: WM_DROPFILES HEX: 0233 ; inline add-windows-message
+: WM_MDIREFRESHMENU HEX: 0234 ; inline add-windows-message
+: WM_IME_SETCONTEXT HEX: 0281 ; inline add-windows-message
+: WM_IME_NOTIFY HEX: 0282 ; inline add-windows-message
+: WM_IME_CONTROL HEX: 0283 ; inline add-windows-message
+: WM_IME_COMPOSITIONFULL HEX: 0284 ; inline add-windows-message
+: WM_IME_SELECT HEX: 0285 ; inline add-windows-message
+: WM_IME_CHAR HEX: 0286 ; inline add-windows-message
+: WM_IME_REQUEST HEX: 0288 ; inline add-windows-message
+: WM_IME_KEYDOWN HEX: 0290 ; inline add-windows-message
+: WM_IME_KEYUP HEX: 0291 ; inline add-windows-message
+: WM_MOUSEHOVER HEX: 02A1 ; inline add-windows-message
+: WM_MOUSELEAVE HEX: 02A3 ; inline add-windows-message
+: WM_NCMOUSEHOVER HEX: 02A0 ; inline add-windows-message
+: WM_NCMOUSELEAVE HEX: 02A2 ; inline add-windows-message
+: WM_WTSSESSION_CHANGE HEX: 02B1 ; inline add-windows-message
+: WM_TABLET_FIRST HEX: 02c0 ; inline add-windows-message
+: WM_TABLET_LAST HEX: 02df ; inline add-windows-message
+: WM_CUT HEX: 0300 ; inline add-windows-message
+: WM_COPY HEX: 0301 ; inline add-windows-message
+: WM_PASTE HEX: 0302 ; inline add-windows-message
+: WM_CLEAR HEX: 0303 ; inline add-windows-message
+: WM_UNDO HEX: 0304 ; inline add-windows-message
+: WM_RENDERFORMAT HEX: 0305 ; inline add-windows-message
+: WM_RENDERALLFORMATS HEX: 0306 ; inline add-windows-message
+: WM_DESTROYCLIPBOARD HEX: 0307 ; inline add-windows-message
+: WM_DRAWCLIPBOARD HEX: 0308 ; inline add-windows-message
+: WM_PAINTCLIPBOARD HEX: 0309 ; inline add-windows-message
+: WM_VSCROLLCLIPBOARD HEX: 030A ; inline add-windows-message
+: WM_SIZECLIPBOARD HEX: 030B ; inline add-windows-message
+: WM_ASKCBFORMATNAME HEX: 030C ; inline add-windows-message
+: WM_CHANGECBCHAIN HEX: 030D ; inline add-windows-message
+: WM_HSCROLLCLIPBOARD HEX: 030E ; inline add-windows-message
+: WM_QUERYNEWPALETTE HEX: 030F ; inline add-windows-message
+: WM_PALETTEISCHANGING HEX: 0310 ; inline add-windows-message
+: WM_PALETTECHANGED HEX: 0311 ; inline add-windows-message
+: WM_HOTKEY HEX: 0312 ; inline add-windows-message
+: WM_PRINT HEX: 0317 ; inline add-windows-message
+: WM_PRINTCLIENT HEX: 0318 ; inline add-windows-message
+: WM_APPCOMMAND HEX: 0319 ; inline add-windows-message
+: WM_THEMECHANGED HEX: 031A ; inline add-windows-message
+: WM_HANDHELDFIRST HEX: 0358 ; inline add-windows-message
+: WM_HANDHELDLAST HEX: 035F ; inline add-windows-message
+: WM_AFXFIRST HEX: 0360 ; inline add-windows-message
+: WM_AFXLAST HEX: 037F ; inline add-windows-message
+: WM_PENWINFIRST HEX: 0380 ; inline add-windows-message
+: WM_PENWINLAST HEX: 038F ; inline add-windows-message
+: WM_APP HEX: 8000 ; inline add-windows-message
+: WM_USER HEX: 0400 ; inline add-windows-message
+: EM_GETSEL HEX: 00B0 ; inline add-windows-message
+: EM_SETSEL HEX: 00B1 ; inline add-windows-message
+: EM_GETRECT HEX: 00B2 ; inline add-windows-message
+: EM_SETRECT HEX: 00B3 ; inline add-windows-message
+: EM_SETRECTNP HEX: 00B4 ; inline add-windows-message
+: EM_SCROLL HEX: 00B5 ; inline add-windows-message
+: EM_LINESCROLL HEX: 00B6 ; inline add-windows-message
+: EM_SCROLLCARET HEX: 00B7 ; inline add-windows-message
+: EM_GETMODIFY HEX: 00B8 ; inline add-windows-message
+: EM_SETMODIFY HEX: 00B9 ; inline add-windows-message
+: EM_GETLINECOUNT HEX: 00BA ; inline add-windows-message
+: EM_LINEINDEX HEX: 00BB ; inline add-windows-message
+: EM_SETHANDLE HEX: 00BC ; inline add-windows-message
+: EM_GETHANDLE HEX: 00BD ; inline add-windows-message
+: EM_GETTHUMB HEX: 00BE ; inline add-windows-message
+: EM_LINELENGTH HEX: 00C1 ; inline add-windows-message
+: EM_REPLACESEL HEX: 00C2 ; inline add-windows-message
+: EM_GETLINE HEX: 00C4 ; inline add-windows-message
+: EM_LIMITTEXT HEX: 00C5 ; inline add-windows-message
+: EM_CANUNDO HEX: 00C6 ; inline add-windows-message
+: EM_UNDO HEX: 00C7 ; inline add-windows-message
+: EM_FMTLINES HEX: 00C8 ; inline add-windows-message
+: EM_LINEFROMCHAR HEX: 00C9 ; inline add-windows-message
+: EM_SETTABSTOPS HEX: 00CB ; inline add-windows-message
+: EM_SETPASSWORDCHAR HEX: 00CC ; inline add-windows-message
+: EM_EMPTYUNDOBUFFER HEX: 00CD ; inline add-windows-message
+: EM_GETFIRSTVISIBLELINE HEX: 00CE ; inline add-windows-message
+: EM_SETREADONLY HEX: 00CF ; inline add-windows-message
+: EM_SETWORDBREAKPROC HEX: 00D0 ; inline add-windows-message
+: EM_GETWORDBREAKPROC HEX: 00D1 ; inline add-windows-message
+: EM_GETPASSWORDCHAR HEX: 00D2 ; inline add-windows-message
+: EM_SETMARGINS HEX: 00D3 ; inline add-windows-message
+: EM_GETMARGINS HEX: 00D4 ; inline add-windows-message
+: EM_SETLIMITTEXT EM_LIMITTEXT ; inline add-windows-message
+: EM_GETLIMITTEXT HEX: 00D5 ; inline add-windows-message
+: EM_POSFROMCHAR HEX: 00D6 ; inline add-windows-message
+: EM_CHARFROMPOS HEX: 00D7 ; inline add-windows-message
+: EM_SETIMESTATUS HEX: 00D8 ; inline add-windows-message
+: EM_GETIMESTATUS HEX: 00D9 ; inline add-windows-message
+: BM_GETCHECK HEX: 00F0 ; inline add-windows-message
+: BM_SETCHECK HEX: 00F1 ; inline add-windows-message
+: BM_GETSTATE HEX: 00F2 ; inline add-windows-message
+: BM_SETSTATE HEX: 00F3 ; inline add-windows-message
+: BM_SETSTYLE HEX: 00F4 ; inline add-windows-message
+: BM_CLICK HEX: 00F5 ; inline add-windows-message
+: BM_GETIMAGE HEX: 00F6 ; inline add-windows-message
+: BM_SETIMAGE HEX: 00F7 ; inline add-windows-message
+: STM_SETICON HEX: 0170 ; inline add-windows-message
+: STM_GETICON HEX: 0171 ; inline add-windows-message
+: STM_SETIMAGE HEX: 0172 ; inline add-windows-message
+: STM_GETIMAGE HEX: 0173 ; inline add-windows-message
+: STM_MSGMAX HEX: 0174 ; inline add-windows-message
+: DM_GETDEFID WM_USER ; inline add-windows-message
+: DM_SETDEFID  WM_USER 1 + ; inline add-windows-message
+: DM_REPOSITION WM_USER 2 + ; inline add-windows-message
+: LB_ADDSTRING HEX: 0180 ; inline add-windows-message
+: LB_INSERTSTRING HEX: 0181 ; inline add-windows-message
+: LB_DELETESTRING HEX: 0182 ; inline add-windows-message
+: LB_SELITEMRANGEEX HEX: 0183 ; inline add-windows-message
+: LB_RESETCONTENT HEX: 0184 ; inline add-windows-message
+: LB_SETSEL HEX: 0185 ; inline add-windows-message
+: LB_SETCURSEL HEX: 0186 ; inline add-windows-message
+: LB_GETSEL HEX: 0187 ; inline add-windows-message
+: LB_GETCURSEL HEX: 0188 ; inline add-windows-message
+: LB_GETTEXT HEX: 0189 ; inline add-windows-message
+: LB_GETTEXTLEN HEX: 018A ; inline add-windows-message
+: LB_GETCOUNT HEX: 018B ; inline add-windows-message
+: LB_SELECTSTRING HEX: 018C ; inline add-windows-message
+: LB_DIR HEX: 018D ; inline add-windows-message
+: LB_GETTOPINDEX HEX: 018E ; inline add-windows-message
+: LB_FINDSTRING HEX: 018F ; inline add-windows-message
+: LB_GETSELCOUNT HEX: 0190 ; inline add-windows-message
+: LB_GETSELITEMS HEX: 0191 ; inline add-windows-message
+: LB_SETTABSTOPS HEX: 0192 ; inline add-windows-message
+: LB_GETHORIZONTALEXTENT HEX: 0193 ; inline add-windows-message
+: LB_SETHORIZONTALEXTENT HEX: 0194 ; inline add-windows-message
+: LB_SETCOLUMNWIDTH HEX: 0195 ; inline add-windows-message
+: LB_ADDFILE HEX: 0196 ; inline add-windows-message
+: LB_SETTOPINDEX HEX: 0197 ; inline add-windows-message
+: LB_GETITEMRECT HEX: 0198 ; inline add-windows-message
+: LB_GETITEMDATA HEX: 0199 ; inline add-windows-message
+: LB_SETITEMDATA HEX: 019A ; inline add-windows-message
+: LB_SELITEMRANGE HEX: 019B ; inline add-windows-message
+: LB_SETANCHORINDEX HEX: 019C ; inline add-windows-message
+: LB_GETANCHORINDEX HEX: 019D ; inline add-windows-message
+: LB_SETCARETINDEX HEX: 019E ; inline add-windows-message
+: LB_GETCARETINDEX HEX: 019F ; inline add-windows-message
+: LB_SETITEMHEIGHT HEX: 01A0 ; inline add-windows-message
+: LB_GETITEMHEIGHT HEX: 01A1 ; inline add-windows-message
+: LB_FINDSTRINGEXACT HEX: 01A2 ; inline add-windows-message
+: LB_SETLOCALE HEX: 01A5 ; inline add-windows-message
+: LB_GETLOCALE HEX: 01A6 ; inline add-windows-message
+: LB_SETCOUNT HEX: 01A7 ; inline add-windows-message
+: LB_INITSTORAGE HEX: 01A8 ; inline add-windows-message
+: LB_ITEMFROMPOINT HEX: 01A9 ; inline add-windows-message
+: LB_MULTIPLEADDSTRING HEX: 01B1 ; inline add-windows-message
+: LB_GETLISTBOXINFO HEX: 01B2 ; inline add-windows-message
+: LB_MSGMAX_501 HEX: 01B3 ; inline add-windows-message
+: LB_MSGMAX_WCE4 HEX: 01B1 ; inline add-windows-message
+: LB_MSGMAX_4 HEX: 01B0 ; inline add-windows-message
+: LB_MSGMAX_PRE4 HEX: 01A8 ; inline add-windows-message
+: CB_GETEDITSEL HEX: 0140 ; inline add-windows-message
+: CB_LIMITTEXT HEX: 0141 ; inline add-windows-message
+: CB_SETEDITSEL HEX: 0142 ; inline add-windows-message
+: CB_ADDSTRING HEX: 0143 ; inline add-windows-message
+: CB_DELETESTRING HEX: 0144 ; inline add-windows-message
+: CB_DIR HEX: 0145 ; inline add-windows-message
+: CB_GETCOUNT HEX: 0146 ; inline add-windows-message
+: CB_GETCURSEL HEX: 0147 ; inline add-windows-message
+: CB_GETLBTEXT HEX: 0148 ; inline add-windows-message
+: CB_GETLBTEXTLEN HEX: 0149 ; inline add-windows-message
+: CB_INSERTSTRING HEX: 014A ; inline add-windows-message
+: CB_RESETCONTENT HEX: 014B ; inline add-windows-message
+: CB_FINDSTRING HEX: 014C ; inline add-windows-message
+: CB_SELECTSTRING HEX: 014D ; inline add-windows-message
+: CB_SETCURSEL HEX: 014E ; inline add-windows-message
+: CB_SHOWDROPDOWN HEX: 014F ; inline add-windows-message
+: CB_GETITEMDATA HEX: 0150 ; inline add-windows-message
+: CB_SETITEMDATA HEX: 0151 ; inline add-windows-message
+: CB_GETDROPPEDCONTROLRECT HEX: 0152 ; inline add-windows-message
+: CB_SETITEMHEIGHT HEX: 0153 ; inline add-windows-message
+: CB_GETITEMHEIGHT HEX: 0154 ; inline add-windows-message
+: CB_SETEXTENDEDUI HEX: 0155 ; inline add-windows-message
+: CB_GETEXTENDEDUI HEX: 0156 ; inline add-windows-message
+: CB_GETDROPPEDSTATE HEX: 0157 ; inline add-windows-message
+: CB_FINDSTRINGEXACT HEX: 0158 ; inline add-windows-message
+: CB_SETLOCALE HEX: 0159 ; inline add-windows-message
+: CB_GETLOCALE HEX: 015A ; inline add-windows-message
+: CB_GETTOPINDEX HEX: 015B ; inline add-windows-message
+: CB_SETTOPINDEX HEX: 015C ; inline add-windows-message
+: CB_GETHORIZONTALEXTENT HEX: 015d ; inline add-windows-message
+: CB_SETHORIZONTALEXTENT HEX: 015e ; inline add-windows-message
+: CB_GETDROPPEDWIDTH HEX: 015f ; inline add-windows-message
+: CB_SETDROPPEDWIDTH HEX: 0160 ; inline add-windows-message
+: CB_INITSTORAGE HEX: 0161 ; inline add-windows-message
+: CB_MULTIPLEADDSTRING HEX: 0163 ; inline add-windows-message
+: CB_GETCOMBOBOXINFO HEX: 0164 ; inline add-windows-message
+: CB_MSGMAX_501 HEX: 0165 ; inline add-windows-message
+: CB_MSGMAX_WCE400 HEX: 0163 ; inline add-windows-message
+: CB_MSGMAX_400 HEX: 0162 ; inline add-windows-message
+: CB_MSGMAX_PRE400 HEX: 015B ; inline add-windows-message
+: SBM_SETPOS HEX: 00E0 ; inline add-windows-message 
+: SBM_GETPOS HEX: 00E1 ; inline add-windows-message 
+: SBM_SETRANGE HEX: 00E2 ; inline add-windows-message 
+: SBM_SETRANGEREDRAW HEX: 00E6 ; inline add-windows-message
+: SBM_GETRANGE HEX: 00E3 ; inline add-windows-message
+: SBM_ENABLE_ARROWS HEX: 00E4 ; inline add-windows-message
+: SBM_SETSCROLLINFO HEX: 00E9 ; inline add-windows-message
+: SBM_GETSCROLLINFO HEX: 00EA ; inline add-windows-message
+: SBM_GETSCROLLBARINFO HEX: 00EB ; inline add-windows-message
+: LVM_FIRST HEX: 1000 ; inline add-windows-message ! ListView messages
+: TV_FIRST HEX: 1100 ; inline add-windows-message ! TreeView messages
+: HDM_FIRST HEX: 1200 ; inline add-windows-message ! Header messages
+: TCM_FIRST HEX: 1300 ; inline add-windows-message ! Tab control messages
+: PGM_FIRST HEX: 1400 ; inline add-windows-message ! Pager control messages
+: ECM_FIRST HEX: 1500 ; inline add-windows-message ! Edit control messages
+: BCM_FIRST HEX: 1600 ; inline add-windows-message ! Button control messages
+: CBM_FIRST HEX: 1700 ; inline add-windows-message ! Combobox control messages
+: CCM_FIRST HEX: 2000 ; inline add-windows-message ! Common control shared messages
+: CCM_LAST CCM_FIRST HEX: 0200 + ; inline add-windows-message
+: CCM_SETBKCOLOR CCM_FIRST  1 +  ; inline add-windows-message
+: CCM_SETCOLORSCHEME CCM_FIRST  2 +  ; inline add-windows-message
+: CCM_GETCOLORSCHEME CCM_FIRST  3 +  ; inline add-windows-message
+: CCM_GETDROPTARGET CCM_FIRST  4 +  ; inline add-windows-message
+: CCM_SETUNICODEFORMAT CCM_FIRST  5 +  ; inline add-windows-message
+: CCM_GETUNICODEFORMAT CCM_FIRST  6 +  ; inline add-windows-message
+: CCM_SETVERSION CCM_FIRST  7 +  ; inline add-windows-message
+: CCM_GETVERSION CCM_FIRST  8 +  ; inline add-windows-message
+: CCM_SETNOTIFYWINDOW CCM_FIRST  9 +  ; inline add-windows-message
+: CCM_SETWINDOWTHEME CCM_FIRST  HEX: b +  ; inline add-windows-message
+: CCM_DPISCALE CCM_FIRST  HEX: c +  ; inline add-windows-message
+: HDM_GETITEMCOUNT HDM_FIRST  0 +  ; inline add-windows-message
+: HDM_INSERTITEMA HDM_FIRST  1 +  ; inline add-windows-message
+: HDM_INSERTITEMW HDM_FIRST  10 +  ; inline add-windows-message
+: HDM_DELETEITEM HDM_FIRST  2 +  ; inline add-windows-message
+: HDM_GETITEMA HDM_FIRST  3 +  ; inline add-windows-message
+: HDM_GETITEMW HDM_FIRST  11 +  ; inline add-windows-message
+: HDM_SETITEMA HDM_FIRST  4 +  ; inline add-windows-message
+: HDM_SETITEMW HDM_FIRST  12 +  ; inline add-windows-message
+: HDM_LAYOUT HDM_FIRST  5 +  ; inline add-windows-message
+: HDM_HITTEST HDM_FIRST  6 +  ; inline add-windows-message
+: HDM_GETITEMRECT HDM_FIRST  7 +  ; inline add-windows-message
+: HDM_SETIMAGELIST HDM_FIRST  8 +  ; inline add-windows-message
+: HDM_GETIMAGELIST HDM_FIRST  9 +  ; inline add-windows-message
+: HDM_ORDERTOINDEX HDM_FIRST  15 +  ; inline add-windows-message
+: HDM_CREATEDRAGIMAGE HDM_FIRST  16 +  ; inline add-windows-message
+: HDM_GETORDERARRAY HDM_FIRST  17 +  ; inline add-windows-message
+: HDM_SETORDERARRAY HDM_FIRST  18 +  ; inline add-windows-message
+: HDM_SETHOTDIVIDER HDM_FIRST  19 +  ; inline add-windows-message
+: HDM_SETBITMAPMARGIN HDM_FIRST  20 +  ; inline add-windows-message
+: HDM_GETBITMAPMARGIN HDM_FIRST  21 +  ; inline add-windows-message
+: HDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: HDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: HDM_SETFILTERCHANGETIMEOUT HDM_FIRST 22 + ; inline add-windows-message
+: HDM_EDITFILTER HDM_FIRST 23 + ; inline add-windows-message
+: HDM_CLEARFILTER HDM_FIRST 24 + ; inline add-windows-message
+: TB_ENABLEBUTTON WM_USER 1 + ; inline add-windows-message
+: TB_CHECKBUTTON WM_USER 2 + ; inline add-windows-message
+: TB_PRESSBUTTON WM_USER 3 + ; inline add-windows-message
+: TB_HIDEBUTTON WM_USER  4 +  ; inline add-windows-message
+: TB_INDETERMINATE WM_USER  5 +  ; inline add-windows-message
+: TB_MARKBUTTON WM_USER  6 +  ; inline add-windows-message
+: TB_ISBUTTONENABLED WM_USER  9 +  ; inline add-windows-message
+: TB_ISBUTTONCHECKED WM_USER  10 +  ; inline add-windows-message
+: TB_ISBUTTONPRESSED WM_USER  11 +  ; inline add-windows-message
+: TB_ISBUTTONHIDDEN WM_USER  12 +  ; inline add-windows-message
+: TB_ISBUTTONINDETERMINATE WM_USER  13 +  ; inline add-windows-message
+: TB_ISBUTTONHIGHLIGHTED WM_USER  14 +  ; inline add-windows-message
+: TB_SETSTATE WM_USER  17 +  ; inline add-windows-message
+: TB_GETSTATE WM_USER  18 +  ; inline add-windows-message
+: TB_ADDBITMAP WM_USER  19 +  ; inline add-windows-message
+: TB_ADDBUTTONSA WM_USER  20 +  ; inline add-windows-message
+: TB_INSERTBUTTONA WM_USER  21 +  ; inline add-windows-message
+: TB_ADDBUTTONS WM_USER  20 +  ; inline add-windows-message
+: TB_INSERTBUTTON WM_USER  21 +  ; inline add-windows-message
+: TB_DELETEBUTTON WM_USER  22 +  ; inline add-windows-message
+: TB_GETBUTTON WM_USER  23 +  ; inline add-windows-message
+: TB_BUTTONCOUNT WM_USER  24 +  ; inline add-windows-message
+: TB_COMMANDTOINDEX WM_USER  25 +  ; inline add-windows-message
+: TB_SAVERESTOREA WM_USER  26 +  ; inline add-windows-message
+: TB_SAVERESTOREW WM_USER  76 +  ; inline add-windows-message
+: TB_CUSTOMIZE WM_USER  27 +  ; inline add-windows-message
+: TB_ADDSTRINGA WM_USER  28 +  ; inline add-windows-message
+: TB_ADDSTRINGW WM_USER  77 +  ; inline add-windows-message
+: TB_GETITEMRECT WM_USER  29 +  ; inline add-windows-message
+: TB_BUTTONSTRUCTSIZE WM_USER  30 +  ; inline add-windows-message
+: TB_SETBUTTONSIZE WM_USER  31 +  ; inline add-windows-message
+: TB_SETBITMAPSIZE WM_USER  32 +  ; inline add-windows-message
+: TB_AUTOSIZE WM_USER  33 +  ; inline add-windows-message
+: TB_GETTOOLTIPS WM_USER  35 +  ; inline add-windows-message
+: TB_SETTOOLTIPS WM_USER  36 +  ; inline add-windows-message
+: TB_SETPARENT WM_USER  37 +  ; inline add-windows-message
+: TB_SETROWS WM_USER  39 +  ; inline add-windows-message
+: TB_GETROWS WM_USER  40 +  ; inline add-windows-message
+: TB_SETCMDID WM_USER  42 +  ; inline add-windows-message
+: TB_CHANGEBITMAP WM_USER  43 +  ; inline add-windows-message
+: TB_GETBITMAP WM_USER  44 +  ; inline add-windows-message
+: TB_GETBUTTONTEXTA WM_USER  45 +  ; inline add-windows-message
+: TB_GETBUTTONTEXTW WM_USER  75 +  ; inline add-windows-message
+: TB_REPLACEBITMAP WM_USER  46 +  ; inline add-windows-message
+: TB_SETINDENT WM_USER  47 +  ; inline add-windows-message
+: TB_SETIMAGELIST WM_USER  48 +  ; inline add-windows-message
+: TB_GETIMAGELIST WM_USER  49 +  ; inline add-windows-message
+: TB_LOADIMAGES WM_USER  50 +  ; inline add-windows-message
+: TB_GETRECT WM_USER  51 +  ; inline add-windows-message
+: TB_SETHOTIMAGELIST WM_USER  52 +  ; inline add-windows-message
+: TB_GETHOTIMAGELIST WM_USER  53 +  ; inline add-windows-message
+: TB_SETDISABLEDIMAGELIST WM_USER  54 +  ; inline add-windows-message
+: TB_GETDISABLEDIMAGELIST WM_USER  55 +  ; inline add-windows-message
+: TB_SETSTYLE WM_USER  56 +  ; inline add-windows-message
+: TB_GETSTYLE WM_USER  57 +  ; inline add-windows-message
+: TB_GETBUTTONSIZE WM_USER  58 +  ; inline add-windows-message
+: TB_SETBUTTONWIDTH WM_USER  59 +  ; inline add-windows-message
+: TB_SETMAXTEXTROWS WM_USER  60 +  ; inline add-windows-message
+: TB_GETTEXTROWS WM_USER  61 +  ; inline add-windows-message
+: TB_GETOBJECT WM_USER  62 +  ; inline add-windows-message
+: TB_GETHOTITEM WM_USER  71 +  ; inline add-windows-message
+: TB_SETHOTITEM WM_USER  72 +  ; inline add-windows-message 
+: TB_SETANCHORHIGHLIGHT WM_USER  73 +  ; inline add-windows-message 
+: TB_GETANCHORHIGHLIGHT WM_USER  74 +  ; inline add-windows-message
+: TB_MAPACCELERATORA WM_USER  78 +  ; inline add-windows-message 
+: TB_GETINSERTMARK WM_USER  79 +  ; inline add-windows-message 
+: TB_SETINSERTMARK WM_USER  80 +  ; inline add-windows-message 
+: TB_INSERTMARKHITTEST WM_USER  81 +  ; inline add-windows-message
+: TB_MOVEBUTTON WM_USER  82 +  ; inline add-windows-message
+: TB_GETMAXSIZE WM_USER  83 +  ; inline add-windows-message
+: TB_SETEXTENDEDSTYLE WM_USER  84 +  ; inline add-windows-message
+: TB_GETEXTENDEDSTYLE WM_USER  85 +  ; inline add-windows-message
+: TB_GETPADDING WM_USER  86 +  ; inline add-windows-message
+: TB_SETPADDING WM_USER  87 +  ; inline add-windows-message
+: TB_SETINSERTMARKCOLOR WM_USER  88 +  ; inline add-windows-message
+: TB_GETINSERTMARKCOLOR WM_USER  89 +  ; inline add-windows-message
+: TB_SETCOLORSCHEME CCM_SETCOLORSCHEME ; inline add-windows-message
+: TB_GETCOLORSCHEME CCM_GETCOLORSCHEME ; inline add-windows-message
+: TB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: TB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: TB_MAPACCELERATORW WM_USER  90 +  ; inline add-windows-message
+: TB_GETBITMAPFLAGS WM_USER  41 +  ; inline add-windows-message
+: TB_GETBUTTONINFOW WM_USER  63 +  ; inline add-windows-message
+: TB_SETBUTTONINFOW WM_USER  64 +  ; inline add-windows-message
+: TB_GETBUTTONINFOA WM_USER  65 +  ; inline add-windows-message
+: TB_SETBUTTONINFOA WM_USER  66 +  ; inline add-windows-message
+: TB_INSERTBUTTONW WM_USER  67 +  ; inline add-windows-message
+: TB_ADDBUTTONSW WM_USER  68 +  ; inline add-windows-message
+: TB_HITTEST WM_USER  69 +  ; inline add-windows-message
+: TB_SETDRAWTEXTFLAGS WM_USER  70 +  ; inline add-windows-message
+: TB_GETSTRINGW WM_USER  91 +  ; inline add-windows-message
+: TB_GETSTRINGA WM_USER  92 +  ; inline add-windows-message
+: TB_GETMETRICS WM_USER  101 +  ; inline add-windows-message
+: TB_SETMETRICS WM_USER  102 +  ; inline add-windows-message
+: TB_SETWINDOWTHEME CCM_SETWINDOWTHEME ; inline add-windows-message
+: RB_INSERTBANDA WM_USER  1 +  ; inline add-windows-message
+: RB_DELETEBAND WM_USER  2 +  ; inline add-windows-message
+: RB_GETBARINFO WM_USER  3 +  ; inline add-windows-message
+: RB_SETBARINFO WM_USER  4 +  ; inline add-windows-message
+: RB_GETBANDINFO WM_USER  5 +  ; inline add-windows-message
+: RB_SETBANDINFOA WM_USER  6 +  ; inline add-windows-message
+: RB_SETPARENT WM_USER  7 +  ; inline add-windows-message
+: RB_HITTEST WM_USER  8 +  ; inline add-windows-message
+: RB_GETRECT WM_USER  9 +  ; inline add-windows-message
+: RB_INSERTBANDW WM_USER  10 +  ; inline add-windows-message
+: RB_SETBANDINFOW WM_USER  11 +  ; inline add-windows-message
+: RB_GETBANDCOUNT WM_USER  12 +  ; inline add-windows-message
+: RB_GETROWCOUNT WM_USER  13 +  ; inline add-windows-message
+: RB_GETROWHEIGHT WM_USER  14 +  ; inline add-windows-message
+: RB_IDTOINDEX WM_USER  16 +  ; inline add-windows-message 
+: RB_GETTOOLTIPS WM_USER  17 +  ; inline add-windows-message
+: RB_SETTOOLTIPS WM_USER  18 +  ; inline add-windows-message
+: RB_SETBKCOLOR WM_USER  19 +  ; inline add-windows-message
+: RB_GETBKCOLOR WM_USER  20 +  ; inline add-windows-message
+: RB_SETTEXTCOLOR WM_USER  21 +  ; inline add-windows-message
+: RB_GETTEXTCOLOR WM_USER  22 +  ; inline add-windows-message
+: RB_SIZETORECT WM_USER  23 +  ; inline add-windows-message
+: RB_SETCOLORSCHEME CCM_SETCOLORSCHEME ; inline add-windows-message
+: RB_GETCOLORSCHEME CCM_GETCOLORSCHEME ; inline add-windows-message
+: RB_BEGINDRAG WM_USER  24 +  ; inline add-windows-message
+: RB_ENDDRAG WM_USER  25 +  ; inline add-windows-message
+: RB_DRAGMOVE WM_USER  26 +  ; inline add-windows-message
+: RB_GETBARHEIGHT WM_USER  27 +  ; inline add-windows-message
+: RB_GETBANDINFOW WM_USER  28 +  ; inline add-windows-message
+: RB_GETBANDINFOA WM_USER  29 +  ; inline add-windows-message
+: RB_MINIMIZEBAND WM_USER  30 +  ; inline add-windows-message
+: RB_MAXIMIZEBAND WM_USER  31 +  ; inline add-windows-message
+: RB_GETDROPTARGET CCM_GETDROPTARGET ; inline add-windows-message
+: RB_GETBANDBORDERS WM_USER  34 +  ; inline add-windows-message 
+: RB_SHOWBAND WM_USER  35 +  ; inline add-windows-message 
+: RB_SETPALETTE WM_USER  37 +  ; inline add-windows-message
+: RB_GETPALETTE WM_USER  38 +  ; inline add-windows-message
+: RB_MOVEBAND WM_USER  39 +  ; inline add-windows-message
+: RB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: RB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: RB_GETBANDMARGINS WM_USER  40 +  ; inline add-windows-message
+: RB_SETWINDOWTHEME CCM_SETWINDOWTHEME ; inline add-windows-message
+: RB_PUSHCHEVRON WM_USER  43 +  ; inline add-windows-message
+: TTM_ACTIVATE WM_USER  1 +  ; inline add-windows-message
+: TTM_SETDELAYTIME WM_USER  3 +  ; inline add-windows-message
+: TTM_ADDTOOLA WM_USER  4 +  ; inline add-windows-message
+: TTM_ADDTOOLW WM_USER  50 +  ; inline add-windows-message
+: TTM_DELTOOLA WM_USER  5 +  ; inline add-windows-message
+: TTM_DELTOOLW WM_USER  51 +  ; inline add-windows-message
+: TTM_NEWTOOLRECTA WM_USER  6 +  ; inline add-windows-message
+: TTM_NEWTOOLRECTW WM_USER  52 +  ; inline add-windows-message
+: TTM_RELAYEVENT WM_USER  7 +  ; inline add-windows-message
+: TTM_GETTOOLINFOA WM_USER  8 +  ; inline add-windows-message
+: TTM_GETTOOLINFOW WM_USER  53 +  ; inline add-windows-message
+: TTM_SETTOOLINFOA WM_USER  9 +  ; inline add-windows-message
+: TTM_SETTOOLINFOW WM_USER  54 +  ; inline add-windows-message
+: TTM_HITTESTA WM_USER 10 + ; inline add-windows-message
+: TTM_HITTESTW WM_USER 55 + ; inline add-windows-message
+: TTM_GETTEXTA WM_USER 11 + ; inline add-windows-message
+: TTM_GETTEXTW WM_USER 56 + ; inline add-windows-message
+: TTM_UPDATETIPTEXTA WM_USER 12 + ; inline add-windows-message
+: TTM_UPDATETIPTEXTW WM_USER 57 + ; inline add-windows-message
+: TTM_GETTOOLCOUNT WM_USER 13 + ; inline add-windows-message
+: TTM_ENUMTOOLSA WM_USER 14 + ; inline add-windows-message
+: TTM_ENUMTOOLSW WM_USER 58 + ; inline add-windows-message
+: TTM_GETCURRENTTOOLA WM_USER  15 +  ; inline add-windows-message
+: TTM_GETCURRENTTOOLW WM_USER  59 +  ; inline add-windows-message
+: TTM_WINDOWFROMPOINT WM_USER  16 +  ; inline add-windows-message
+: TTM_TRACKACTIVATE WM_USER  17 +  ; inline add-windows-message
+: TTM_TRACKPOSITION WM_USER  18 +  ; inline add-windows-message
+: TTM_SETTIPBKCOLOR WM_USER  19 +  ; inline add-windows-message
+: TTM_SETTIPTEXTCOLOR WM_USER  20 +  ; inline add-windows-message
+: TTM_GETDELAYTIME WM_USER  21 +  ; inline add-windows-message
+: TTM_GETTIPBKCOLOR WM_USER  22 +  ; inline add-windows-message
+: TTM_GETTIPTEXTCOLOR WM_USER  23 +  ; inline add-windows-message
+: TTM_SETMAXTIPWIDTH WM_USER  24 +  ; inline add-windows-message
+: TTM_GETMAXTIPWIDTH WM_USER  25 +  ; inline add-windows-message
+: TTM_SETMARGIN WM_USER  26 +  ; inline add-windows-message
+: TTM_GETMARGIN WM_USER  27 +  ; inline add-windows-message
+: TTM_POP WM_USER  28 +  ; inline add-windows-message
+: TTM_UPDATE WM_USER  29 +  ; inline add-windows-message
+: TTM_GETBUBBLESIZE WM_USER  30 +  ; inline add-windows-message
+: TTM_ADJUSTRECT WM_USER  31 +  ; inline add-windows-message
+: TTM_SETTITLEA WM_USER  32 +  ; inline add-windows-message
+: TTM_SETTITLEW WM_USER  33 +  ; inline add-windows-message
+: TTM_POPUP WM_USER  34 +  ; inline add-windows-message
+: TTM_GETTITLE WM_USER  35 +  ; inline add-windows-message
+: TTM_SETWINDOWTHEME CCM_SETWINDOWTHEME ; inline add-windows-message
+: SB_SETTEXTA WM_USER 1+  ; inline add-windows-message
+: SB_SETTEXTW WM_USER 11 +  ; inline add-windows-message
+: SB_GETTEXTA WM_USER 2 +  ; inline add-windows-message
+: SB_GETTEXTW WM_USER 13 +  ; inline add-windows-message
+: SB_GETTEXTLENGTHA WM_USER 3 +  ; inline add-windows-message
+: SB_GETTEXTLENGTHW WM_USER 12 +  ; inline add-windows-message
+: SB_SETPARTS WM_USER 4 +  ; inline add-windows-message
+: SB_GETPARTS WM_USER 6 +  ; inline add-windows-message
+: SB_GETBORDERS WM_USER 7 +  ; inline add-windows-message
+: SB_SETMINHEIGHT WM_USER 8 +  ; inline add-windows-message
+: SB_SIMPLE WM_USER 9 +  ; inline add-windows-message
+: SB_GETRECT WM_USER 10 +  ; inline add-windows-message
+: SB_ISSIMPLE WM_USER 14 +  ; inline add-windows-message
+: SB_SETICON WM_USER 15 +  ; inline add-windows-message
+: SB_SETTIPTEXTA WM_USER 16 +  ; inline add-windows-message
+: SB_SETTIPTEXTW WM_USER 17 +  ; inline add-windows-message
+: SB_GETTIPTEXTA WM_USER 18 +  ; inline add-windows-message
+: SB_GETTIPTEXTW WM_USER 19 +  ; inline add-windows-message
+: SB_GETICON WM_USER 20 +  ; inline add-windows-message
+: SB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: SB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: SB_SETBKCOLOR CCM_SETBKCOLOR ; inline add-windows-message
+: SB_SIMPLEID HEX: 00ff ; inline add-windows-message
+: TBM_GETPOS WM_USER ; inline add-windows-message
+: TBM_GETRANGEMIN WM_USER 1 +  ; inline add-windows-message
+: TBM_GETRANGEMAX WM_USER 2 +  ; inline add-windows-message
+: TBM_GETTIC WM_USER 3 +  ; inline add-windows-message
+: TBM_SETTIC WM_USER 4 +  ; inline add-windows-message
+: TBM_SETPOS WM_USER 5 +  ; inline add-windows-message
+: TBM_SETRANGE WM_USER 6 +  ; inline add-windows-message
+: TBM_SETRANGEMIN WM_USER 7 +  ; inline add-windows-message
+: TBM_SETRANGEMAX WM_USER 8 +  ; inline add-windows-message
+: TBM_CLEARTICS WM_USER 9 +  ; inline add-windows-message
+: TBM_SETSEL WM_USER 10 +  ; inline add-windows-message
+: TBM_SETSELSTART WM_USER 11 +  ; inline add-windows-message
+: TBM_SETSELEND WM_USER 12 +  ; inline add-windows-message
+: TBM_GETPTICS WM_USER 14 +  ; inline add-windows-message
+: TBM_GETTICPOS WM_USER 15 +  ; inline add-windows-message
+: TBM_GETNUMTICS WM_USER 16 +  ; inline add-windows-message
+: TBM_GETSELSTART WM_USER 17 +  ; inline add-windows-message
+: TBM_GETSELEND WM_USER 18 +  ; inline add-windows-message
+: TBM_CLEARSEL WM_USER 19 +  ; inline add-windows-message
+: TBM_SETTICFREQ WM_USER 20 +  ; inline add-windows-message
+: TBM_SETPAGESIZE WM_USER 21 +  ; inline add-windows-message
+: TBM_GETPAGESIZE WM_USER 22 +  ; inline add-windows-message
+: TBM_SETLINESIZE WM_USER 23 +  ; inline add-windows-message
+: TBM_GETLINESIZE WM_USER 24 +  ; inline add-windows-message
+: TBM_GETTHUMBRECT WM_USER 25 +  ; inline add-windows-message
+: TBM_GETCHANNELRECT WM_USER 26 +  ; inline add-windows-message
+: TBM_SETTHUMBLENGTH WM_USER 27 +  ; inline add-windows-message
+: TBM_GETTHUMBLENGTH WM_USER 28 +  ; inline add-windows-message
+: TBM_SETTOOLTIPS WM_USER 29 +  ; inline add-windows-message
+: TBM_GETTOOLTIPS WM_USER 30 +  ; inline add-windows-message
+: TBM_SETTIPSIDE WM_USER 31 +  ; inline add-windows-message
+: TBM_SETBUDDY WM_USER 32 +  ; inline add-windows-message 
+: TBM_GETBUDDY WM_USER 33 +  ; inline add-windows-message 
+: TBM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: TBM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: DL_BEGINDRAG WM_USER 133 +  ; inline add-windows-message
+: DL_DRAGGING WM_USER 134 +  ; inline add-windows-message
+: DL_DROPPED WM_USER 135 +  ; inline add-windows-message
+: DL_CANCELDRAG WM_USER 136 +  ; inline add-windows-message
+: UDM_SETRANGE WM_USER 101 +  ; inline add-windows-message
+: UDM_GETRANGE WM_USER 102 +  ; inline add-windows-message
+: UDM_SETPOS WM_USER 103 +  ; inline add-windows-message
+: UDM_GETPOS WM_USER 104 +  ; inline add-windows-message
+: UDM_SETBUDDY WM_USER 105 +  ; inline add-windows-message
+: UDM_GETBUDDY WM_USER 106 +  ; inline add-windows-message
+: UDM_SETACCEL WM_USER 107 +  ; inline add-windows-message
+: UDM_GETACCEL WM_USER 108 +  ; inline add-windows-message
+: UDM_SETBASE WM_USER 109 +  ; inline add-windows-message
+: UDM_GETBASE WM_USER 110 +  ; inline add-windows-message
+: UDM_SETRANGE32 WM_USER 111 +  ; inline add-windows-message
+: UDM_GETRANGE32 WM_USER 112 +  ; inline add-windows-message
+: UDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: UDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: UDM_SETPOS32 WM_USER 113 +  ; inline add-windows-message
+: UDM_GETPOS32 WM_USER 114 +  ; inline add-windows-message
+: PBM_SETRANGE WM_USER 1 +  ; inline add-windows-message
+: PBM_SETPOS WM_USER 2 +  ; inline add-windows-message
+: PBM_DELTAPOS WM_USER 3 +  ; inline add-windows-message
+: PBM_SETSTEP WM_USER 4 +  ; inline add-windows-message
+: PBM_STEPIT WM_USER 5 +  ; inline add-windows-message
+: PBM_SETRANGE32 WM_USER 6 +  ; inline add-windows-message
+: PBM_GETRANGE WM_USER 7 +  ; inline add-windows-message 
+: PBM_GETPOS WM_USER 8 +  ; inline add-windows-message
+: PBM_SETBARCOLOR WM_USER 9 +  ; inline add-windows-message
+: PBM_SETBKCOLOR CCM_SETBKCOLOR ; inline add-windows-message 
+: HKM_SETHOTKEY WM_USER 1 +  ; inline add-windows-message
+: HKM_GETHOTKEY WM_USER 2 +  ; inline add-windows-message
+: HKM_SETRULES WM_USER 3 +  ; inline add-windows-message
+: LVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: LVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: LVM_GETBKCOLOR LVM_FIRST  0 +  ; inline add-windows-message
+: LVM_SETBKCOLOR LVM_FIRST  1 +  ; inline add-windows-message
+: LVM_GETIMAGELIST LVM_FIRST  2 +  ; inline add-windows-message
+: LVM_SETIMAGELIST LVM_FIRST  3 +  ; inline add-windows-message
+: LVM_GETITEMCOUNT LVM_FIRST  4 +  ; inline add-windows-message
+: LVM_GETITEMA LVM_FIRST  5 +  ; inline add-windows-message
+: LVM_GETITEMW LVM_FIRST  75 +  ; inline add-windows-message
+: LVM_SETITEMA LVM_FIRST  6 +  ; inline add-windows-message
+: LVM_SETITEMW LVM_FIRST  76 +  ; inline add-windows-message
+: LVM_INSERTITEMA LVM_FIRST  7 +  ; inline add-windows-message
+: LVM_INSERTITEMW LVM_FIRST  77 +  ; inline add-windows-message
+: LVM_DELETEITEM LVM_FIRST  8 +  ; inline add-windows-message
+: LVM_DELETEALLITEMS LVM_FIRST  9 +  ; inline add-windows-message
+: LVM_GETCALLBACKMASK LVM_FIRST  10 +  ; inline add-windows-message
+: LVM_SETCALLBACKMASK LVM_FIRST  11 +  ; inline add-windows-message
+: LVM_FINDITEMA LVM_FIRST  13 +  ; inline add-windows-message
+: LVM_FINDITEMW LVM_FIRST  83 +  ; inline add-windows-message
+: LVM_GETITEMRECT LVM_FIRST  14 +  ; inline add-windows-message
+: LVM_SETITEMPOSITION LVM_FIRST  15 +  ; inline add-windows-message
+: LVM_GETITEMPOSITION LVM_FIRST  16 +  ; inline add-windows-message
+: LVM_GETSTRINGWIDTHA LVM_FIRST  17 +  ; inline add-windows-message
+: LVM_GETSTRINGWIDTHW LVM_FIRST  87 +  ; inline add-windows-message
+: LVM_HITTEST LVM_FIRST  18 +  ; inline add-windows-message
+: LVM_ENSUREVISIBLE LVM_FIRST  19 +  ; inline add-windows-message
+: LVM_SCROLL LVM_FIRST  20 +  ; inline add-windows-message
+: LVM_REDRAWITEMS LVM_FIRST  21 +  ; inline add-windows-message
+: LVM_ARRANGE LVM_FIRST  22 +  ; inline add-windows-message
+: LVM_EDITLABELA LVM_FIRST  23 +  ; inline add-windows-message
+: LVM_EDITLABELW LVM_FIRST  118 +  ; inline add-windows-message
+: LVM_GETEDITCONTROL LVM_FIRST  24 +  ; inline add-windows-message
+: LVM_GETCOLUMNA LVM_FIRST  25 +  ; inline add-windows-message
+: LVM_GETCOLUMNW LVM_FIRST  95 +  ; inline add-windows-message
+: LVM_SETCOLUMNA LVM_FIRST  26 +  ; inline add-windows-message
+: LVM_SETCOLUMNW LVM_FIRST  96 +  ; inline add-windows-message
+: LVM_INSERTCOLUMNA LVM_FIRST  27 +  ; inline add-windows-message
+: LVM_INSERTCOLUMNW LVM_FIRST  97 +  ; inline add-windows-message
+: LVM_DELETECOLUMN LVM_FIRST  28 +  ; inline add-windows-message
+: LVM_GETCOLUMNWIDTH LVM_FIRST  29 +  ; inline add-windows-message
+: LVM_SETCOLUMNWIDTH LVM_FIRST  30 +  ; inline add-windows-message
+: LVM_CREATEDRAGIMAGE LVM_FIRST  33 +  ; inline add-windows-message
+: LVM_GETVIEWRECT LVM_FIRST  34 +  ; inline add-windows-message
+: LVM_GETTEXTCOLOR LVM_FIRST  35 +  ; inline add-windows-message
+: LVM_SETTEXTCOLOR LVM_FIRST  36 +  ; inline add-windows-message
+: LVM_GETTEXTBKCOLOR LVM_FIRST  37 +  ; inline add-windows-message
+: LVM_SETTEXTBKCOLOR LVM_FIRST  38 +  ; inline add-windows-message
+: LVM_GETTOPINDEX LVM_FIRST  39 +  ; inline add-windows-message
+: LVM_GETCOUNTPERPAGE LVM_FIRST  40 +  ; inline add-windows-message
+: LVM_GETORIGIN LVM_FIRST  41 +  ; inline add-windows-message
+: LVM_UPDATE LVM_FIRST  42 +  ; inline add-windows-message
+: LVM_SETITEMSTATE LVM_FIRST  43 +  ; inline add-windows-message
+: LVM_GETITEMSTATE LVM_FIRST  44 +  ; inline add-windows-message
+: LVM_GETITEMTEXTA LVM_FIRST  45 +  ; inline add-windows-message
+: LVM_GETITEMTEXTW LVM_FIRST  115 +  ; inline add-windows-message
+: LVM_SETITEMTEXTA LVM_FIRST  46 +  ; inline add-windows-message
+: LVM_SETITEMTEXTW LVM_FIRST  116 +  ; inline add-windows-message
+: LVM_SETITEMCOUNT LVM_FIRST  47 +  ; inline add-windows-message
+: LVM_SORTITEMS LVM_FIRST  48 +  ; inline add-windows-message
+: LVM_SETITEMPOSITION32 LVM_FIRST  49 +  ; inline add-windows-message
+: LVM_GETSELECTEDCOUNT LVM_FIRST  50 +  ; inline add-windows-message
+: LVM_GETITEMSPACING LVM_FIRST  51 +  ; inline add-windows-message
+: LVM_GETISEARCHSTRINGA LVM_FIRST  52 +  ; inline add-windows-message
+: LVM_GETISEARCHSTRINGW LVM_FIRST  117 +  ; inline add-windows-message
+: LVM_SETICONSPACING LVM_FIRST  53 +  ; inline add-windows-message
+: LVM_SETEXTENDEDLISTVIEWSTYLE LVM_FIRST  54 +  ; inline add-windows-message
+: LVM_GETEXTENDEDLISTVIEWSTYLE LVM_FIRST  55 +  ; inline add-windows-message
+: LVM_GETSUBITEMRECT LVM_FIRST  56 +  ; inline add-windows-message
+: LVM_SUBITEMHITTEST LVM_FIRST  57 +  ; inline add-windows-message
+: LVM_SETCOLUMNORDERARRAY LVM_FIRST  58 +  ; inline add-windows-message
+: LVM_GETCOLUMNORDERARRAY LVM_FIRST  59 +  ; inline add-windows-message
+: LVM_SETHOTITEM LVM_FIRST  60 +  ; inline add-windows-message
+: LVM_GETHOTITEM LVM_FIRST  61 +  ; inline add-windows-message
+: LVM_SETHOTCURSOR LVM_FIRST  62 +  ; inline add-windows-message
+: LVM_GETHOTCURSOR LVM_FIRST  63 +  ; inline add-windows-message
+: LVM_APPROXIMATEVIEWRECT LVM_FIRST  64 +  ; inline add-windows-message
+: LVM_SETWORKAREAS LVM_FIRST  65 +  ; inline add-windows-message
+: LVM_GETWORKAREAS LVM_FIRST  70 +  ; inline add-windows-message
+: LVM_GETNUMBEROFWORKAREAS LVM_FIRST  73 +  ; inline add-windows-message
+: LVM_GETSELECTIONMARK LVM_FIRST  66 +  ; inline add-windows-message
+: LVM_SETSELECTIONMARK LVM_FIRST  67 +  ; inline add-windows-message
+: LVM_SETHOVERTIME LVM_FIRST  71 +  ; inline add-windows-message
+: LVM_GETHOVERTIME LVM_FIRST  72 +  ; inline add-windows-message
+: LVM_SETTOOLTIPS LVM_FIRST  74 +  ; inline add-windows-message
+: LVM_GETTOOLTIPS LVM_FIRST  78 +  ; inline add-windows-message
+: LVM_SORTITEMSEX LVM_FIRST  81 +  ; inline add-windows-message
+: LVM_SETBKIMAGEA LVM_FIRST  68 +  ; inline add-windows-message
+: LVM_SETBKIMAGEW LVM_FIRST  138 +  ; inline add-windows-message
+: LVM_GETBKIMAGEA LVM_FIRST  69 +  ; inline add-windows-message
+: LVM_GETBKIMAGEW LVM_FIRST  139 +  ; inline add-windows-message
+: LVM_SETSELECTEDCOLUMN LVM_FIRST  140 +  ; inline add-windows-message
+: LVM_SETTILEWIDTH LVM_FIRST  141 +  ; inline add-windows-message
+: LVM_SETVIEW LVM_FIRST  142 +  ; inline add-windows-message
+: LVM_GETVIEW LVM_FIRST  143 +  ; inline add-windows-message
+: LVM_INSERTGROUP LVM_FIRST  145 +  ; inline add-windows-message
+: LVM_SETGROUPINFO LVM_FIRST  147 +  ; inline add-windows-message
+: LVM_GETGROUPINFO LVM_FIRST  149 +  ; inline add-windows-message
+: LVM_REMOVEGROUP LVM_FIRST  150 +  ; inline add-windows-message
+: LVM_MOVEGROUP LVM_FIRST  151 +  ; inline add-windows-message
+: LVM_MOVEITEMTOGROUP LVM_FIRST  154 +  ; inline add-windows-message
+: LVM_SETGROUPMETRICS LVM_FIRST  155 +  ; inline add-windows-message
+: LVM_GETGROUPMETRICS LVM_FIRST  156 +  ; inline add-windows-message
+: LVM_ENABLEGROUPVIEW LVM_FIRST  157 +  ; inline add-windows-message
+: LVM_SORTGROUPS LVM_FIRST  158 +  ; inline add-windows-message
+: LVM_INSERTGROUPSORTED LVM_FIRST  159 +  ; inline add-windows-message
+: LVM_REMOVEALLGROUPS LVM_FIRST  160 +  ; inline add-windows-message
+: LVM_HASGROUP LVM_FIRST  161 +  ; inline add-windows-message
+: LVM_SETTILEVIEWINFO LVM_FIRST  162 +  ; inline add-windows-message
+: LVM_GETTILEVIEWINFO LVM_FIRST  163 +  ; inline add-windows-message
+: LVM_SETTILEINFO LVM_FIRST  164 +  ; inline add-windows-message
+: LVM_GETTILEINFO LVM_FIRST  165 +  ; inline add-windows-message
+: LVM_SETINSERTMARK LVM_FIRST  166 +  ; inline add-windows-message
+: LVM_GETINSERTMARK LVM_FIRST  167 +  ; inline add-windows-message
+: LVM_INSERTMARKHITTEST LVM_FIRST  168 +  ; inline add-windows-message
+: LVM_GETINSERTMARKRECT LVM_FIRST  169 +  ; inline add-windows-message
+: LVM_SETINSERTMARKCOLOR LVM_FIRST  170 +  ; inline add-windows-message
+: LVM_GETINSERTMARKCOLOR LVM_FIRST  171 +  ; inline add-windows-message
+: LVM_SETINFOTIP LVM_FIRST  173 +  ; inline add-windows-message
+: LVM_GETSELECTEDCOLUMN LVM_FIRST  174 +  ; inline add-windows-message
+: LVM_ISGROUPVIEWENABLED LVM_FIRST  175 +  ; inline add-windows-message
+: LVM_GETOUTLINECOLOR LVM_FIRST  176 +  ; inline add-windows-message
+: LVM_SETOUTLINECOLOR LVM_FIRST  177 +  ; inline add-windows-message
+: LVM_CANCELEDITLABEL LVM_FIRST  179 +  ; inline add-windows-message
+: LVM_MAPINDEXTOID LVM_FIRST  180 +  ; inline add-windows-message
+: LVM_MAPIDTOINDEX LVM_FIRST  181 +  ; inline add-windows-message
+: TVM_INSERTITEMA TV_FIRST  0 +  ; inline add-windows-message
+: TVM_INSERTITEMW TV_FIRST  50 +  ; inline add-windows-message
+: TVM_DELETEITEM TV_FIRST  1 +  ; inline add-windows-message
+: TVM_EXPAND TV_FIRST  2 +  ; inline add-windows-message
+: TVM_GETITEMRECT TV_FIRST  4 +  ; inline add-windows-message
+: TVM_GETCOUNT TV_FIRST  5 +  ; inline add-windows-message
+: TVM_GETINDENT TV_FIRST  6 +  ; inline add-windows-message
+: TVM_SETINDENT TV_FIRST  7 +  ; inline add-windows-message
+: TVM_GETIMAGELIST TV_FIRST  8 +  ; inline add-windows-message
+: TVM_SETIMAGELIST TV_FIRST  9 +  ; inline add-windows-message
+: TVM_GETNEXTITEM TV_FIRST  10 +  ; inline add-windows-message
+: TVM_SELECTITEM TV_FIRST  11 +  ; inline add-windows-message
+: TVM_GETITEMA TV_FIRST  12 +  ; inline add-windows-message
+: TVM_GETITEMW TV_FIRST  62 +  ; inline add-windows-message
+: TVM_SETITEMA TV_FIRST  13 +  ; inline add-windows-message
+: TVM_SETITEMW TV_FIRST  63 +  ; inline add-windows-message
+: TVM_EDITLABELA TV_FIRST  14 +  ; inline add-windows-message
+: TVM_EDITLABELW TV_FIRST  65 +  ; inline add-windows-message
+: TVM_GETEDITCONTROL TV_FIRST  15 +  ; inline add-windows-message
+: TVM_GETVISIBLECOUNT TV_FIRST  16 +  ; inline add-windows-message
+: TVM_HITTEST TV_FIRST  17 +  ; inline add-windows-message
+: TVM_CREATEDRAGIMAGE TV_FIRST  18 +  ; inline add-windows-message
+: TVM_SORTCHILDREN TV_FIRST  19 +  ; inline add-windows-message
+: TVM_ENSUREVISIBLE TV_FIRST  20 +  ; inline add-windows-message
+: TVM_SORTCHILDRENCB TV_FIRST  21 +  ; inline add-windows-message
+: TVM_ENDEDITLABELNOW TV_FIRST  22 +  ; inline add-windows-message
+: TVM_GETISEARCHSTRINGA TV_FIRST  23 +  ; inline add-windows-message
+: TVM_GETISEARCHSTRINGW TV_FIRST  64 +  ; inline add-windows-message
+: TVM_SETTOOLTIPS TV_FIRST  24 +  ; inline add-windows-message
+: TVM_GETTOOLTIPS TV_FIRST  25 +  ; inline add-windows-message
+: TVM_SETINSERTMARK TV_FIRST  26 +  ; inline add-windows-message
+: TVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: TVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: TVM_SETITEMHEIGHT TV_FIRST  27 +  ; inline add-windows-message
+: TVM_GETITEMHEIGHT TV_FIRST  28 +  ; inline add-windows-message
+: TVM_SETBKCOLOR TV_FIRST  29 +  ; inline add-windows-message
+: TVM_SETTEXTCOLOR TV_FIRST  30 +  ; inline add-windows-message
+: TVM_GETBKCOLOR TV_FIRST  31 +  ; inline add-windows-message
+: TVM_GETTEXTCOLOR TV_FIRST  32 +  ; inline add-windows-message
+: TVM_SETSCROLLTIME TV_FIRST  33 +  ; inline add-windows-message
+: TVM_GETSCROLLTIME TV_FIRST  34 +  ; inline add-windows-message
+: TVM_SETINSERTMARKCOLOR TV_FIRST  37 +  ; inline add-windows-message
+: TVM_GETINSERTMARKCOLOR TV_FIRST  38 +  ; inline add-windows-message
+: TVM_GETITEMSTATE TV_FIRST  39 +  ; inline add-windows-message
+: TVM_SETLINECOLOR TV_FIRST  40 +  ; inline add-windows-message
+: TVM_GETLINECOLOR TV_FIRST  41 +  ; inline add-windows-message
+: TVM_MAPACCIDTOHTREEITEM TV_FIRST  42 +  ; inline add-windows-message
+: TVM_MAPHTREEITEMTOACCID TV_FIRST  43 +  ; inline add-windows-message
+: CBEM_INSERTITEMA WM_USER  1 +  ; inline add-windows-message
+: CBEM_SETIMAGELIST WM_USER  2 +  ; inline add-windows-message
+: CBEM_GETIMAGELIST WM_USER  3 +  ; inline add-windows-message
+: CBEM_GETITEMA WM_USER  4 +  ; inline add-windows-message
+: CBEM_SETITEMA WM_USER  5 +  ; inline add-windows-message
+: CBEM_DELETEITEM CB_DELETESTRING ; inline add-windows-message
+: CBEM_GETCOMBOCONTROL WM_USER  6 +  ; inline add-windows-message
+: CBEM_GETEDITCONTROL WM_USER  7 +  ; inline add-windows-message
+: CBEM_SETEXTENDEDSTYLE WM_USER  14 +  ; inline add-windows-message
+: CBEM_GETEXTENDEDSTYLE WM_USER  9 +  ; inline add-windows-message
+: CBEM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: CBEM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: CBEM_SETEXSTYLE WM_USER  8 +  ; inline add-windows-message
+: CBEM_GETEXSTYLE WM_USER  9 +  ; inline add-windows-message
+: CBEM_HASEDITCHANGED WM_USER  10 +  ; inline add-windows-message
+: CBEM_INSERTITEMW WM_USER  11 +  ; inline add-windows-message
+: CBEM_SETITEMW WM_USER  12 +  ; inline add-windows-message
+: CBEM_GETITEMW WM_USER  13 +  ; inline add-windows-message
+: TCM_GETIMAGELIST TCM_FIRST  2 +  ; inline add-windows-message
+: TCM_SETIMAGELIST TCM_FIRST  3 +  ; inline add-windows-message
+: TCM_GETITEMCOUNT TCM_FIRST  4 +  ; inline add-windows-message
+: TCM_GETITEMA TCM_FIRST  5 +  ; inline add-windows-message
+: TCM_GETITEMW TCM_FIRST  60 +  ; inline add-windows-message
+: TCM_SETITEMA TCM_FIRST  6 +  ; inline add-windows-message
+: TCM_SETITEMW TCM_FIRST  61 +  ; inline add-windows-message
+: TCM_INSERTITEMA TCM_FIRST  7 +  ; inline add-windows-message
+: TCM_INSERTITEMW TCM_FIRST  62 +  ; inline add-windows-message
+: TCM_DELETEITEM TCM_FIRST  8 +  ; inline add-windows-message
+: TCM_DELETEALLITEMS TCM_FIRST  9 +  ; inline add-windows-message
+: TCM_GETITEMRECT TCM_FIRST  10 +  ; inline add-windows-message
+: TCM_GETCURSEL TCM_FIRST  11 +  ; inline add-windows-message
+: TCM_SETCURSEL TCM_FIRST  12 +  ; inline add-windows-message
+: TCM_HITTEST TCM_FIRST  13 +  ; inline add-windows-message
+: TCM_SETITEMEXTRA TCM_FIRST  14 +  ; inline add-windows-message
+: TCM_ADJUSTRECT TCM_FIRST  40 +  ; inline add-windows-message
+: TCM_SETITEMSIZE TCM_FIRST  41 +  ; inline add-windows-message
+: TCM_REMOVEIMAGE TCM_FIRST  42 +  ; inline add-windows-message
+: TCM_SETPADDING TCM_FIRST  43 +  ; inline add-windows-message
+: TCM_GETROWCOUNT TCM_FIRST  44 +  ; inline add-windows-message
+: TCM_GETTOOLTIPS TCM_FIRST  45 +  ; inline add-windows-message
+: TCM_SETTOOLTIPS TCM_FIRST  46 +  ; inline add-windows-message
+: TCM_GETCURFOCUS TCM_FIRST  47 +  ; inline add-windows-message
+: TCM_SETCURFOCUS TCM_FIRST  48 +  ; inline add-windows-message
+: TCM_SETMINTABWIDTH TCM_FIRST  49 +  ; inline add-windows-message
+: TCM_DESELECTALL TCM_FIRST  50 +  ; inline add-windows-message
+: TCM_HIGHLIGHTITEM TCM_FIRST  51 +  ; inline add-windows-message
+: TCM_SETEXTENDEDSTYLE TCM_FIRST  52 +  ; inline add-windows-message
+: TCM_GETEXTENDEDSTYLE TCM_FIRST  53 +  ; inline add-windows-message
+: TCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: TCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: ACM_OPENA WM_USER 100 +  ; inline add-windows-message
+: ACM_OPENW WM_USER 103 +  ; inline add-windows-message
+: ACM_PLAY WM_USER 101 +  ; inline add-windows-message
+: ACM_STOP WM_USER 102 +  ; inline add-windows-message
+: MCM_FIRST HEX: 1000 ; inline add-windows-message
+: MCM_GETCURSEL MCM_FIRST  1 +  ; inline add-windows-message
+: MCM_SETCURSEL MCM_FIRST  2 +  ; inline add-windows-message
+: MCM_GETMAXSELCOUNT MCM_FIRST  3 +  ; inline add-windows-message
+: MCM_SETMAXSELCOUNT MCM_FIRST  4 +  ; inline add-windows-message
+: MCM_GETSELRANGE MCM_FIRST  5 +  ; inline add-windows-message
+: MCM_SETSELRANGE MCM_FIRST  6 +  ; inline add-windows-message
+: MCM_GETMONTHRANGE MCM_FIRST  7 +  ; inline add-windows-message
+: MCM_SETDAYSTATE MCM_FIRST  8 +  ; inline add-windows-message
+: MCM_GETMINREQRECT MCM_FIRST  9 +  ; inline add-windows-message
+: MCM_SETCOLOR MCM_FIRST  10 +  ; inline add-windows-message
+: MCM_GETCOLOR MCM_FIRST  11 +  ; inline add-windows-message
+: MCM_SETTODAY MCM_FIRST  12 +  ; inline add-windows-message
+: MCM_GETTODAY MCM_FIRST  13 +  ; inline add-windows-message
+: MCM_HITTEST MCM_FIRST  14 +  ; inline add-windows-message
+: MCM_SETFIRSTDAYOFWEEK MCM_FIRST  15 +  ; inline add-windows-message
+: MCM_GETFIRSTDAYOFWEEK MCM_FIRST  16 +  ; inline add-windows-message
+: MCM_GETRANGE MCM_FIRST  17 +  ; inline add-windows-message
+: MCM_SETRANGE MCM_FIRST  18 +  ; inline add-windows-message
+: MCM_GETMONTHDELTA MCM_FIRST  19 +  ; inline add-windows-message
+: MCM_SETMONTHDELTA MCM_FIRST  20 +  ; inline add-windows-message
+: MCM_GETMAXTODAYWIDTH MCM_FIRST  21 +  ; inline add-windows-message
+: MCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT ; inline add-windows-message
+: MCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT ; inline add-windows-message
+: DTM_FIRST HEX: 1000 ; inline add-windows-message
+: DTM_GETSYSTEMTIME DTM_FIRST  1 +  ; inline add-windows-message
+: DTM_SETSYSTEMTIME DTM_FIRST  2 +  ; inline add-windows-message
+: DTM_GETRANGE DTM_FIRST  3 +  ; inline add-windows-message
+: DTM_SETRANGE DTM_FIRST  4 +  ; inline add-windows-message
+: DTM_SETFORMATA DTM_FIRST  5 +  ; inline add-windows-message
+: DTM_SETFORMATW DTM_FIRST  50 +  ; inline add-windows-message
+: DTM_SETMCCOLOR DTM_FIRST  6 +  ; inline add-windows-message
+: DTM_GETMCCOLOR DTM_FIRST  7 +  ; inline add-windows-message
+: DTM_GETMONTHCAL DTM_FIRST  8 +  ; inline add-windows-message
+: DTM_SETMCFONT DTM_FIRST  9 +  ; inline add-windows-message
+: DTM_GETMCFONT DTM_FIRST  10 +  ; inline add-windows-message
+: PGM_SETCHILD PGM_FIRST  1 +  ; inline add-windows-message
+: PGM_RECALCSIZE PGM_FIRST  2 +  ; inline add-windows-message
+: PGM_FORWARDMOUSE PGM_FIRST  3 +  ; inline add-windows-message
+: PGM_SETBKCOLOR PGM_FIRST  4 +  ; inline add-windows-message
+: PGM_GETBKCOLOR PGM_FIRST  5 +  ; inline add-windows-message
+: PGM_SETBORDER PGM_FIRST  6 +  ; inline add-windows-message
+: PGM_GETBORDER PGM_FIRST  7 +  ; inline add-windows-message
+: PGM_SETPOS PGM_FIRST  8 +  ; inline add-windows-message
+: PGM_GETPOS PGM_FIRST  9 +  ; inline add-windows-message
+: PGM_SETBUTTONSIZE PGM_FIRST  10 +  ; inline add-windows-message
+: PGM_GETBUTTONSIZE PGM_FIRST  11 +  ; inline add-windows-message
+: PGM_GETBUTTONSTATE PGM_FIRST  12 +  ; inline add-windows-message
+: PGM_GETDROPTARGET CCM_GETDROPTARGET ; inline add-windows-message
+: BCM_GETIDEALSIZE BCM_FIRST  1 +  ; inline add-windows-message
+: BCM_SETIMAGELIST BCM_FIRST  2 +  ; inline add-windows-message
+: BCM_GETIMAGELIST BCM_FIRST  3 +  ; inline add-windows-message
+: BCM_SETTEXTMARGIN BCM_FIRST 4 +  ; inline add-windows-message
+: BCM_GETTEXTMARGIN BCM_FIRST 5 +  ; inline add-windows-message
+: EM_SETCUEBANNER       ECM_FIRST  1 +  ; inline add-windows-message
+: EM_GETCUEBANNER       ECM_FIRST  2 +  ; inline add-windows-message
+: EM_SHOWBALLOONTIP ECM_FIRST  3 +  ; inline add-windows-message
+: EM_HIDEBALLOONTIP ECM_FIRST  4 +  ; inline add-windows-message 
+: CB_SETMINVISIBLE CBM_FIRST  1 +  ; inline add-windows-message
+: CB_GETMINVISIBLE CBM_FIRST  2 +  ; inline add-windows-message
+: LM_HITTEST WM_USER  HEX: 0300 +  ; inline add-windows-message 
+: LM_GETIDEALHEIGHT WM_USER  HEX: 0301 +  ; inline add-windows-message
+: LM_SETITEM WM_USER  HEX: 0302 + ; inline add-windows-message 
+: LM_GETITEM WM_USER  HEX: 0303 + ; inline add-windows-message
diff --git a/extra/windows/nt/nt.factor b/extra/windows/nt/nt.factor
new file mode 100644 (file)
index 0000000..d9e8f58
--- /dev/null
@@ -0,0 +1,14 @@
+USING: alien sequences ;
+{
+    { "advapi32" "advapi32.dll" "stdcall" }
+    { "gdi32"    "gdi32.dll"    "stdcall" }
+    { "user32"   "user32.dll"   "stdcall" }
+    { "kernel32" "kernel32.dll" "stdcall" }
+    { "winsock"  "ws2_32.dll"   "stdcall" }
+    { "mswsock"  "mswsock.dll"  "stdcall" }
+    { "libc"     "msvcrt.dll"   "cdecl"   }
+    { "libm"     "msvcrt.dll"   "cdecl"   }
+    { "gl"       "opengl32.dll" "stdcall" }
+    { "glu"      "glu32.dll"    "stdcall" }
+    { "freetype" "freetype6.dll" "cdecl"  }
+} [ first3 add-library ] each
diff --git a/extra/windows/opengl32/opengl32.factor b/extra/windows/opengl32/opengl32.factor
new file mode 100644 (file)
index 0000000..fcda38c
--- /dev/null
@@ -0,0 +1,109 @@
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.syntax parser namespaces kernel
+math windows.types windows.types init assocs sequences opengl.gl ;
+IN: windows.opengl32
+
+! PIXELFORMATDESCRIPTOR flags
+: PFD_DOUBLEBUFFER            HEX: 00000001 ; inline
+: PFD_STEREO                  HEX: 00000002 ; inline
+: PFD_DRAW_TO_WINDOW          HEX: 00000004 ; inline
+: PFD_DRAW_TO_BITMAP          HEX: 00000008 ; inline
+: PFD_SUPPORT_GDI             HEX: 00000010 ; inline
+: PFD_SUPPORT_OPENGL          HEX: 00000020 ; inline
+: PFD_GENERIC_FORMAT          HEX: 00000040 ; inline
+: PFD_NEED_PALETTE            HEX: 00000080 ; inline
+: PFD_NEED_SYSTEM_PALETTE     HEX: 00000100 ; inline
+: PFD_SWAP_EXCHANGE           HEX: 00000200 ; inline
+: PFD_SWAP_COPY               HEX: 00000400 ; inline
+: PFD_SWAP_LAYER_BUFFERS      HEX: 00000800 ; inline
+: PFD_GENERIC_ACCELERATED     HEX: 00001000 ; inline
+: PFD_SUPPORT_DIRECTDRAW      HEX: 00002000 ; inline
+
+! PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only
+: PFD_DEPTH_DONTCARE          HEX: 20000000 ; inline
+: PFD_DOUBLEBUFFER_DONTCARE   HEX: 40000000 ; inline
+: PFD_STEREO_DONTCARE         HEX: 80000000 ; inline
+
+! pixel types
+: PFD_TYPE_RGBA        0 ; inline
+: PFD_TYPE_COLORINDEX  1 ; inline
+! layer types
+: PFD_MAIN_PLANE       0 ; inline
+: PFD_OVERLAY_PLANE    1 ; inline
+: PFD_UNDERLAY_PLANE   -1 ; inline
+
+: LPD_TYPE_RGBA        0 ; inline
+: LPD_TYPE_COLORINDEX  1 ; inline
+
+! wglSwapLayerBuffers flags
+: WGL_SWAP_MAIN_PLANE     HEX: 00000001 ; inline
+: WGL_SWAP_OVERLAY1       HEX: 00000002 ; inline
+: WGL_SWAP_OVERLAY2       HEX: 00000004 ; inline
+: WGL_SWAP_OVERLAY3       HEX: 00000008 ; inline
+: WGL_SWAP_OVERLAY4       HEX: 00000010 ; inline
+: WGL_SWAP_OVERLAY5       HEX: 00000020 ; inline
+: WGL_SWAP_OVERLAY6       HEX: 00000040 ; inline
+: WGL_SWAP_OVERLAY7       HEX: 00000080 ; inline
+: WGL_SWAP_OVERLAY8       HEX: 00000100 ; inline
+: WGL_SWAP_OVERLAY9       HEX: 00000200 ; inline
+: WGL_SWAP_OVERLAY10      HEX: 00000400 ; inline
+: WGL_SWAP_OVERLAY11      HEX: 00000800 ; inline
+: WGL_SWAP_OVERLAY12      HEX: 00001000 ; inline
+: WGL_SWAP_OVERLAY13      HEX: 00002000 ; inline
+: WGL_SWAP_OVERLAY14      HEX: 00004000 ; inline
+: WGL_SWAP_OVERLAY15      HEX: 00008000 ; inline
+: WGL_SWAP_UNDERLAY1      HEX: 00010000 ; inline
+: WGL_SWAP_UNDERLAY2      HEX: 00020000 ; inline
+: WGL_SWAP_UNDERLAY3      HEX: 00040000 ; inline
+: WGL_SWAP_UNDERLAY4      HEX: 00080000 ; inline
+: WGL_SWAP_UNDERLAY5      HEX: 00100000 ; inline
+: WGL_SWAP_UNDERLAY6      HEX: 00200000 ; inline
+: WGL_SWAP_UNDERLAY7      HEX: 00400000 ; inline
+: WGL_SWAP_UNDERLAY8      HEX: 00800000 ; inline
+: WGL_SWAP_UNDERLAY9      HEX: 01000000 ; inline
+: WGL_SWAP_UNDERLAY10     HEX: 02000000 ; inline
+: WGL_SWAP_UNDERLAY11     HEX: 04000000 ; inline
+: WGL_SWAP_UNDERLAY12     HEX: 08000000 ; inline
+: WGL_SWAP_UNDERLAY13     HEX: 10000000 ; inline
+: WGL_SWAP_UNDERLAY14     HEX: 20000000 ; inline
+: WGL_SWAP_UNDERLAY15     HEX: 40000000 ; inline
+
+
+
+: pfd-dwFlags
+    PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL bitor PFD_DOUBLEBUFFER bitor ;
+
+! TODO: compare to http://www.nullterminator.net/opengl32.html
+: make-pfd ( bits -- pfd )
+    "PIXELFORMATDESCRIPTOR" <c-object>
+    "PIXELFORMATDESCRIPTOR" heap-size over set-PIXELFORMATDESCRIPTOR-nSize
+    1 over set-PIXELFORMATDESCRIPTOR-nVersion
+    pfd-dwFlags over set-PIXELFORMATDESCRIPTOR-dwFlags
+    PFD_TYPE_RGBA over set-PIXELFORMATDESCRIPTOR-iPixelType
+    [ set-PIXELFORMATDESCRIPTOR-cColorBits ] keep
+    16 over set-PIXELFORMATDESCRIPTOR-cDepthBits
+    PFD_MAIN_PLANE over set-PIXELFORMATDESCRIPTOR-dwLayerMask ;
+
+
+LIBRARY: gl
+
+
+! FUNCTION: int ReleaseDC ( HWND hWnd, HDC hDC ) ;
+! FUNCTION: HDC ResetDC ( HDC hdc, DEVMODE* lpInitData ) ;
+! FUNCTION: BOOL RestoreDC ( HDC hdc, int nSavedDC ) ;
+! FUNCTION: int SaveDC( HDC hDC ) ;
+! FUNCTION: HGDIOBJ SelectObject ( HDC hDC, HGDIOBJ hgdiobj ) ;
+
+FUNCTION: HGLRC wglCreateContext ( HDC hDC ) ;
+FUNCTION: BOOL wglDeleteContext ( HGLRC hRC ) ;
+FUNCTION: BOOL wglMakeCurrent ( HDC hDC, HGLRC hglrc ) ;
+FUNCTION: void* wglGetProcAddress ( char* name ) ;
+
+: glAddSwapHintRectWIN ( x y width height -- )
+    "glAddSwapHintRectWIN" wglGetProcAddress check-ptr
+    "void" { "int" "int" "int" "int" } "stdcall" alien-indirect ;
+
+: swap-hint-supported? ( -- ? )
+    "GL_WIN_swap_hint" GL_EXTENSIONS glGetString subseq? ;
diff --git a/extra/windows/summary.txt b/extra/windows/summary.txt
new file mode 100644 (file)
index 0000000..cfe1d88
--- /dev/null
@@ -0,0 +1 @@
+Microsoft Windows CE/XP/Vista API bindings
diff --git a/extra/windows/tags.txt b/extra/windows/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/windows/types/types.factor b/extra/windows/types/types.factor
new file mode 100644 (file)
index 0000000..6702dd6
--- /dev/null
@@ -0,0 +1,336 @@
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax namespaces kernel words ;
+IN: windows.types
+
+TYPEDEF: char                CHAR
+TYPEDEF: uchar               UCHAR
+TYPEDEF: uchar               BYTE
+
+TYPEDEF: ushort               wchar_t
+TYPEDEF: wchar_t             WCHAR
+
+TYPEDEF: short               SHORT
+TYPEDEF: ushort              USHORT
+
+TYPEDEF: ushort              WORD
+TYPEDEF: ulong               DWORD
+
+TYPEDEF: int                 INT
+TYPEDEF: uint                UINT
+
+TYPEDEF: int                 BOOL
+
+TYPEDEF: int*                PINT
+TYPEDEF: int*                LPINT
+TYPEDEF: int                 HFILE
+
+TYPEDEF: long                LONG
+TYPEDEF: long*               LPLONG
+TYPEDEF: long                LONG_PTR
+TYPEDEF: long*               PLONG_PTR
+
+TYPEDEF: int                 ULONG
+TYPEDEF: void*               ULONG_PTR
+TYPEDEF: void*               PULONG_PTR
+
+TYPEDEF: void                VOID
+TYPEDEF: void*               PVOID
+TYPEDEF: void*               LPVOID
+TYPEDEF: void*               LPCVOID
+
+TYPEDEF: float               FLOAT
+TYPEDEF: short       HALF_PTR
+TYPEDEF: ushort      UHALF_PTR
+TYPEDEF: int         INT_PTR
+TYPEDEF: uint        UINT_PTR
+
+TYPEDEF: int         LONG_PTR
+TYPEDEF: ulong       ULONG_PTR
+
+TYPEDEF: int         INT32
+TYPEDEF: uint        UINT32
+TYPEDEF: uint        DWORD32
+TYPEDEF: ulong       ULONG32
+TYPEDEF: ulonglong   ULONG64
+TYPEDEF: long*       POINTER_32
+TYPEDEF: longlong*   POINTER_64
+TYPEDEF: longlong    INT64
+TYPEDEF: ulonglong   UINT64
+TYPEDEF: longlong    LONGLONG
+TYPEDEF: ulonglong   ULONGLONG
+TYPEDEF: longlong    LONG64
+TYPEDEF: ulonglong   DWORD64
+TYPEDEF: longlong    LARGE_INTEGER
+TYPEDEF: LARGE_INTEGER* PLARGE_INTEGER
+
+TYPEDEF: WCHAR       TCHAR
+TYPEDEF: TCHAR       TBYTE
+! TYPEDEF: uchar*  LPCSTR
+TYPEDEF: ushort*  LPCSTR
+TYPEDEF: ushort*  LPWSTR
+
+
+
+TYPEDEF: WORD                ATOM
+TYPEDEF: BYTE                BOOLEAN
+TYPEDEF: DWORD               COLORREF
+TYPEDEF: ULONGLONG           DWORDLONG
+TYPEDEF: ULONG_PTR           DWORD_PTR
+TYPEDEF: PVOID               HANDLE
+TYPEDEF: HANDLE              HACCEL
+TYPEDEF: HANDLE              HBITMAP
+TYPEDEF: HANDLE              HBRUSH
+TYPEDEF: HANDLE              HCOLORSPACE
+TYPEDEF: HANDLE              HCONV
+TYPEDEF: HANDLE              HCONVLIST
+TYPEDEF: HANDLE              HICON
+TYPEDEF: HICON               HCURSOR
+TYPEDEF: HANDLE              HDC
+TYPEDEF: HANDLE              HDDEDATA
+TYPEDEF: HANDLE              HDESK
+TYPEDEF: HANDLE              HDROP
+TYPEDEF: HANDLE              HDWP
+TYPEDEF: HANDLE              HENMETAFILE
+TYPEDEF: HANDLE              HFONT
+TYPEDEF: HANDLE              HGDIOBJ
+TYPEDEF: HANDLE              HGLOBAL
+TYPEDEF: HANDLE              HHOOK
+TYPEDEF: HANDLE              HINSTANCE
+TYPEDEF: HANDLE              HKEY
+TYPEDEF: HANDLE              HKL
+TYPEDEF: HANDLE              HLOCAL
+TYPEDEF: HANDLE              HMENU
+TYPEDEF: HANDLE              HMETAFILE
+TYPEDEF: HINSTANCE           HMODULE
+TYPEDEF: HANDLE              HMONITOR
+TYPEDEF: HANDLE              HPALETTE
+TYPEDEF: HANDLE              HPEN
+TYPEDEF: LONG                HRESULT
+TYPEDEF: HANDLE              HRGN
+TYPEDEF: HANDLE              HRSRC
+TYPEDEF: HANDLE              HSZ
+TYPEDEF: HANDLE              WINSTA   ! MS docs say  typedef HANDLE WINSTA ;
+TYPEDEF: HANDLE              HWINSTA  ! typo??
+TYPEDEF: HANDLE              HWND
+TYPEDEF: WORD                LANGID
+TYPEDEF: DWORD               LCID
+TYPEDEF: DWORD               LCTYPE
+TYPEDEF: DWORD               LGRPID
+TYPEDEF: LONG_PTR            LPARAM
+TYPEDEF: BOOL*               LPBOOL
+TYPEDEF: BYTE*               LPBYTE
+TYPEDEF: DWORD*              LPCOLORREF
+TYPEDEF: WCHAR*              LPCWSTR
+! TYPEDEF: WCHAR*              LPWSTR
+
+TYPEDEF: WCHAR*               LPSTR
+TYPEDEF: ushort* LPCTSTR
+TYPEDEF: ushort* LPWTSTR
+
+TYPEDEF: ushort*       LPTSTR
+TYPEDEF: LPCSTR      PCTSTR
+TYPEDEF: LPSTR       PTSTR
+
+TYPEDEF: DWORD*              LPDWORD
+TYPEDEF: HANDLE*             LPHANDLE
+TYPEDEF: WORD*               LPWORD
+TYPEDEF: LONG_PTR            LRESULT
+TYPEDEF: BOOL*               PBOOL
+TYPEDEF: BOOLEAN*            PBOOLEAN
+TYPEDEF: BYTE*               PBYTE
+TYPEDEF: CHAR*               PCHAR
+TYPEDEF: CHAR*               PCSTR
+TYPEDEF: WCHAR*              PCWSTR
+TYPEDEF: DWORD*              PDWORD
+TYPEDEF: DWORDLONG*          PDWORDLONG
+TYPEDEF: DWORD_PTR*          PDWORD_PTR
+TYPEDEF: DWORD32*            PDWORD32
+TYPEDEF: DWORD64*            PDWORD64
+TYPEDEF: FLOAT*              PFLOAT
+TYPEDEF: HALF_PTR*           PHALF_PTR
+TYPEDEF: HANDLE*             PHANDLE
+TYPEDEF: HKEY*               PHKEY
+TYPEDEF: INT_PTR*            PINT_PTR
+TYPEDEF: INT32*              PINT32
+TYPEDEF: INT64*              PINT64
+TYPEDEF: PDWORD              PLCID
+TYPEDEF: LONG*               PLONG
+TYPEDEF: LONGLONG*           PLONGLONG
+TYPEDEF: LONG_PTR*           PLONG_PTR
+TYPEDEF: LONG32*             PLONG32
+TYPEDEF: LONG64*             PLONG64
+TYPEDEF: SHORT*              PSHORT
+TYPEDEF: SIZE_T*             PSIZE_T
+TYPEDEF: SSIZE_T*            PSSIZE_T
+TYPEDEF: CHAR*               PSTR
+TYPEDEF: TBYTE*              PTBYTE
+TYPEDEF: TCHAR*              PTCHAR
+TYPEDEF: UCHAR*              PUCHAR
+TYPEDEF: UHALF_PTR*          PUHALF_PTR
+TYPEDEF: UINT*               PUINT
+TYPEDEF: UINT_PTR*           PUINT_PTR
+TYPEDEF: UINT32*             PUINT32
+TYPEDEF: UINT64*             PUINT64
+TYPEDEF: ULONG*              PULONG
+TYPEDEF: ULONGLONG*          PULONGLONG
+TYPEDEF: ULONG_PTR*          PULONG_PTR
+TYPEDEF: ULONG32*            PULONG32
+TYPEDEF: ULONG64*            PULONG64
+TYPEDEF: USHORT*             PUSHORT
+TYPEDEF: WCHAR*              PWCHAR
+TYPEDEF: WORD*               PWORD
+TYPEDEF: WCHAR*              PWSTR
+TYPEDEF: HANDLE              SC_HANDLE
+TYPEDEF: LPVOID              SC_LOCK
+TYPEDEF: HANDLE              SERVICE_STATUS_HANDLE
+TYPEDEF: ULONG_PTR           SIZE_T
+TYPEDEF: LONG_PTR            SSIZE_T
+TYPEDEF: LONGLONG            USN
+TYPEDEF: UINT_PTR            WPARAM
+
+TYPEDEF: RECT* LPRECT
+TYPEDEF: void* PWNDCLASS
+TYPEDEF: void* PWNDCLASSEX
+TYPEDEF: void* LPWNDCLASS
+TYPEDEF: void* LPWNDCLASSEX
+TYPEDEF: void* MSGBOXPARAMSA
+TYPEDEF: void* MSGBOXPARAMSW
+TYPEDEF: void* LPOVERLAPPED_COMPLETION_ROUTINE
+
+TYPEDEF: int size_t
+TYPEDEF: size_t socklen_t
+
+TYPEDEF: void* WNDPROC
+
+: FALSE 0 ; inline
+: TRUE 1 ; inline
+
+: >BOOLEAN ( ? -- 1/0 ) 1 0 ? ; inline
+
+! typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
+
+C-STRUCT: WNDCLASS
+    { "UINT" "style" }
+    { "WNDPROC" "lpfnWndProc" }
+    { "int" "cbClsExtra" }
+    { "int" "cbWndExtra" }
+    { "HINSTANCE" "hInstance" }
+    { "HICON" "hIcon" }
+    { "HCURSOR" "hCursor" }
+    { "HBRUSH" "hbrBackground" }
+    { "LPCTSTR" "lpszMenuName" }
+    { "LPCTSTR" "lpszClassName" } ;
+
+C-STRUCT: WNDCLASSEX
+    { "UINT" "cbSize" }
+    { "UINT" "style" }
+    { "WNDPROC" "lpfnWndProc" }
+    { "int" "cbClsExtra" }
+    { "int" "cbWndExtra" }
+    { "HINSTANCE" "hInstance" }
+    { "HICON" "hIcon" }
+    { "HCURSOR" "hCursor" }
+    { "HBRUSH" "hbrBackground" }
+    { "LPCTSTR" "lpszMenuName" }
+    { "LPCTSTR" "lpszClassName" }
+    { "HICON" "hIconSm" } ;
+
+C-STRUCT: RECT
+    { "LONG" "left" }
+    { "LONG" "top" }
+    { "LONG" "right" }
+    { "LONG" "bottom" } ;
+
+! C-STRUCT: PAINTSTRUCT
+    ! { "HDC" " hdc" }
+    ! { "BOOL" "fErase" }
+    ! { "RECT" "rcPaint" }
+    ! { "BOOL" "fRestore" }
+    ! { "BOOL" "fIncUpdate" }
+    ! { "BYTE[32]" "rgbReserved" }
+! ;
+
+TYPEDEF: void* LPPAINTSTRUCT
+TYPEDEF: void* PAINTSTRUCT
+
+C-STRUCT: POINT
+    { "LONG" "x" }
+    { "LONG" "y" } ; 
+
+C-STRUCT: MSG
+    { "HWND" "hWnd" }
+    { "UINT" "message" }
+    { "WPARAM" "wParam" }
+    { "LPARAM" "lParam" }
+    { "DWORD" "time" }
+    { "POINT" "pt" } ;
+
+TYPEDEF: MSG*                LPMSG
+
+C-STRUCT: PIXELFORMATDESCRIPTOR
+    { "WORD" "nSize" }
+    { "WORD" "nVersion" }
+    { "DWORD" "dwFlags" }
+    { "BYTE" "iPixelType" }
+    { "BYTE" "cColorBits" }
+    { "BYTE" "cRedBits" }
+    { "BYTE" "cRedShift" }
+    { "BYTE" "cGreenBits" }
+    { "BYTE" "cGreenShift" }
+    { "BYTE" "cBlueBits" }
+    { "BYTE" "cBlueShift" }
+    { "BYTE" "cAlphaBits" }
+    { "BYTE" "cAlphaShift" }
+    { "BYTE" "cAccumBits" }
+    { "BYTE" "cAccumRedBits" }
+    { "BYTE" "cAccumGreenBits" }
+    { "BYTE" "cAccumBlueBits" }
+    { "BYTE" "cAccumAlphaBits" }
+    { "BYTE" "cDepthBits" }
+    { "BYTE" "cStencilBits" }
+    { "BYTE" "cAuxBuffers" }
+    { "BYTE" "iLayerType" }
+    { "BYTE" "bReserved" }
+    { "DWORD" "dwLayerMask" }
+    { "DWORD" "dwVisibleMask" }
+    { "DWORD" "dwDamageMask" } ;
+
+C-STRUCT: RECT
+    { "LONG" "left" }
+    { "LONG" "top" }
+    { "LONG" "right" }
+    { "LONG" "bottom" } ;
+
+TYPEDEF: RECT* PRECT
+TYPEDEF: RECT* LPRECT
+TYPEDEF: PIXELFORMATDESCRIPTOR PFD
+TYPEDEF: PFD* LPPFD
+TYPEDEF: HANDLE HGLRC
+TYPEDEF: HANDLE HRGN
+
+C-STRUCT: LVITEM
+    { "uint" "mask" }
+    { "int" "iItem" }
+    { "int" "iSubItem" }
+    { "uint" "state" }
+    { "uint" "stateMask" }
+    { "void*" "pszText" }
+    { "int" "cchTextMax" }
+    { "int" "iImage" }
+    { "long" "lParam" }
+    { "int" "iIndent" }
+    { "int" "iGroupId" }
+    { "uint" "cColumns" }
+    { "uint*" "puColumns" }
+    { "int*" "piColFmt" }
+    { "int" "iGroup" } ;
+
+C-STRUCT: LVFINDINFO
+    { "uint" "flags" }
+    { "char*" "psz" }
+    { "long" "lParam" }
+    { "POINT" "pt" }
+    { "uint" "vkDirection" } ;
+
+
diff --git a/extra/windows/user32/user32.factor b/extra/windows/user32/user32.factor
new file mode 100644 (file)
index 0000000..59378c7
--- /dev/null
@@ -0,0 +1,1321 @@
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax parser namespaces kernel math
+windows.types shuffle ;
+IN: windows.user32
+
+! HKL for ActivateKeyboardLayout
+: HKL_PREV 0 ;
+: HKL_NEXT 1 ;
+
+: CW_USEDEFAULT HEX: 80000000 ;
+
+: WS_OVERLAPPED       HEX: 00000000 ;
+: WS_POPUP            HEX: 80000000 ;
+: WS_CHILD            HEX: 40000000 ;
+: WS_MINIMIZE         HEX: 20000000 ;
+: WS_VISIBLE          HEX: 10000000 ;
+: WS_DISABLED         HEX: 08000000 ;
+: WS_CLIPSIBLINGS     HEX: 04000000 ;
+: WS_CLIPCHILDREN     HEX: 02000000 ;
+: WS_MAXIMIZE         HEX: 01000000 ;
+: WS_CAPTION          HEX: 00C00000 ; !    /* WS_BORDER | WS_DLGFRAME  */
+: WS_BORDER           HEX: 00800000 ;
+: WS_DLGFRAME         HEX: 00400000 ;
+: WS_VSCROLL          HEX: 00200000 ;
+: WS_HSCROLL          HEX: 00100000 ;
+: WS_SYSMENU          HEX: 00080000 ;
+: WS_THICKFRAME       HEX: 00040000 ;
+: WS_GROUP            HEX: 00020000 ;
+: WS_TABSTOP          HEX: 00010000 ;
+: WS_MINIMIZEBOX      HEX: 00020000 ;
+: WS_MAXIMIZEBOX      HEX: 00010000 ;
+
+! Common window styles
+: WS_OVERLAPPEDWINDOW WS_OVERLAPPED WS_CAPTION WS_SYSMENU WS_THICKFRAME WS_MINIMIZEBOX WS_MAXIMIZEBOX bitor bitor bitor bitor bitor ;
+
+: WS_POPUPWINDOW      WS_POPUP WS_BORDER WS_SYSMENU bitor bitor ;
+
+: WS_CHILDWINDOW      WS_CHILD ;
+
+: WS_TILED            WS_OVERLAPPED ;
+: WS_ICONIC           WS_MINIMIZE ;
+: WS_SIZEBOX          WS_THICKFRAME ;
+: WS_TILEDWINDOW      WS_OVERLAPPEDWINDOW ;
+
+! Extended window styles
+
+: WS_EX_DLGMODALFRAME     HEX: 00000001 ; inline
+: WS_EX_NOPARENTNOTIFY    HEX: 00000004 ; inline
+: WS_EX_TOPMOST           HEX: 00000008 ; inline
+: WS_EX_ACCEPTFILES       HEX: 00000010 ; inline
+: WS_EX_TRANSPARENT       HEX: 00000020 ; inline
+: WS_EX_MDICHILD          HEX: 00000040 ; inline
+: WS_EX_TOOLWINDOW        HEX: 00000080 ; inline
+: WS_EX_WINDOWEDGE        HEX: 00000100 ; inline
+: WS_EX_CLIENTEDGE        HEX: 00000200 ; inline
+: WS_EX_CONTEXTHELP       HEX: 00000400 ; inline
+
+: WS_EX_RIGHT             HEX: 00001000 ; inline
+: WS_EX_LEFT              HEX: 00000000 ; inline
+: WS_EX_RTLREADING        HEX: 00002000 ; inline
+: WS_EX_LTRREADING        HEX: 00000000 ; inline
+: WS_EX_LEFTSCROLLBAR     HEX: 00004000 ; inline
+: WS_EX_RIGHTSCROLLBAR    HEX: 00000000 ; inline
+: WS_EX_CONTROLPARENT     HEX: 00010000 ; inline
+: WS_EX_STATICEDGE        HEX: 00020000 ; inline
+: WS_EX_APPWINDOW         HEX: 00040000 ; inline
+: WS_EX_OVERLAPPEDWINDOW WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE bitor ; inline
+: WS_EX_PALETTEWINDOW
+    WS_EX_WINDOWEDGE WS_EX_TOOLWINDOW bitor WS_EX_TOPMOST bitor ; inline
+
+: CS_VREDRAW          HEX: 0001 ;
+: CS_HREDRAW          HEX: 0002 ;
+: CS_DBLCLKS          HEX: 0008 ;
+: CS_OWNDC            HEX: 0020 ;
+: CS_CLASSDC          HEX: 0040 ;
+: CS_PARENTDC         HEX: 0080 ;
+: CS_NOCLOSE          HEX: 0200 ;
+: CS_SAVEBITS         HEX: 0800 ;
+: CS_BYTEALIGNCLIENT  HEX: 1000 ;
+: CS_BYTEALIGNWINDOW  HEX: 2000 ;
+: CS_GLOBALCLASS      HEX: 4000 ;
+
+: COLOR_SCROLLBAR         0 ;
+: COLOR_BACKGROUND        1 ;
+: COLOR_ACTIVECAPTION     2 ;
+: COLOR_INACTIVECAPTION   3 ;
+: COLOR_MENU              4 ;
+: COLOR_WINDOW            5 ;
+: COLOR_WINDOWFRAME       6 ;
+: COLOR_MENUTEXT          7 ;
+: COLOR_WINDOWTEXT        8 ;
+: COLOR_CAPTIONTEXT       9 ;
+: COLOR_ACTIVEBORDER      10 ;
+: COLOR_INACTIVEBORDER    11 ;
+: COLOR_APPWORKSPACE      12 ;
+: COLOR_HIGHLIGHT         13 ;
+: COLOR_HIGHLIGHTTEXT     14 ;
+: COLOR_BTNFACE           15 ;
+: COLOR_BTNSHADOW         16 ;
+: COLOR_GRAYTEXT          17 ;
+: COLOR_BTNTEXT           18 ;
+: COLOR_INACTIVECAPTIONTEXT 19 ;
+: COLOR_BTNHIGHLIGHT      20 ;
+
+: IDI_APPLICATION     32512 ;
+: IDI_HAND            32513 ;
+: IDI_QUESTION        32514 ;
+: IDI_EXCLAMATION     32515 ;
+: IDI_ASTERISK        32516 ;
+: IDI_WINLOGO         32517 ;
+
+! ShowWindow() Commands
+: SW_HIDE             0 ;
+: SW_SHOWNORMAL       1 ;
+: SW_NORMAL           1 ;
+: SW_SHOWMINIMIZED    2 ;
+: SW_SHOWMAXIMIZED    3 ;
+: SW_MAXIMIZE         3 ;
+: SW_SHOWNOACTIVATE   4 ;
+: SW_SHOW             5 ;
+: SW_MINIMIZE         6 ;
+: SW_SHOWMINNOACTIVE  7 ;
+: SW_SHOWNA           8 ;
+: SW_RESTORE          9 ;
+: SW_SHOWDEFAULT      10 ;
+: SW_FORCEMINIMIZE    11 ;
+: SW_MAX              11 ;
+
+! PeekMessage
+: PM_NOREMOVE   0 ;
+: PM_REMOVE     1 ;
+: PM_NOYIELD    2 ;
+! : PM_QS_INPUT         (QS_INPUT << 16) ;
+! : PM_QS_POSTMESSAGE   ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16) ;
+! : PM_QS_PAINT         (QS_PAINT << 16) ;
+! : PM_QS_SENDMESSAGE   (QS_SENDMESSAGE << 16) ;
+
+
+! 
+! Standard Cursor IDs
+!
+: IDC_ARROW           32512 ;
+: IDC_IBEAM           32513 ;
+: IDC_WAIT            32514 ;
+: IDC_CROSS           32515 ;
+: IDC_UPARROW         32516 ;
+: IDC_SIZE            32640 ; ! OBSOLETE: use IDC_SIZEALL
+: IDC_ICON            32641 ; ! OBSOLETE: use IDC_ARROW
+: IDC_SIZENWSE        32642 ;
+: IDC_SIZENESW        32643 ;
+: IDC_SIZEWE          32644 ;
+: IDC_SIZENS          32645 ;
+: IDC_SIZEALL         32646 ;
+: IDC_NO              32648 ; ! not in win3.1
+: IDC_HAND            32649 ;
+: IDC_APPSTARTING     32650 ; ! not in win3.1
+: IDC_HELP            32651 ;
+
+! Predefined Clipboard Formats
+: CF_TEXT             1 ; inline
+: CF_BITMAP           2 ; inline
+: CF_METAFILEPICT     3 ; inline
+: CF_SYLK             4 ; inline
+: CF_DIF              5 ; inline
+: CF_TIFF             6 ; inline
+: CF_OEMTEXT          7 ; inline
+: CF_DIB              8 ; inline
+: CF_PALETTE          9 ; inline
+: CF_PENDATA          10 ; inline
+: CF_RIFF             11 ; inline
+: CF_WAVE             12 ; inline
+: CF_UNICODETEXT      13 ; inline
+: CF_ENHMETAFILE      14 ; inline
+: CF_HDROP            15 ; inline
+: CF_LOCALE           16 ; inline
+: CF_DIBV5            17 ; inline
+: CF_MAX              18 ; inline
+
+: CF_OWNERDISPLAY HEX: 0080 ; inline
+: CF_DSPTEXT HEX: 0081 ; inline
+: CF_DSPBITMAP HEX: 0082 ; inline
+: CF_DSPMETAFILEPICT HEX: 0083 ; inline
+: CF_DSPENHMETAFILE HEX: 008E ; inline
+
+! "Private" formats don't get GlobalFree()'d
+: CF_PRIVATEFIRST HEX: 200 ; inline
+: CF_PRIVATELAST HEX: 2FF ; inline
+
+! "GDIOBJ" formats do get DeleteObject()'d
+: CF_GDIOBJFIRST HEX: 300 ; inline
+: CF_GDIOBJLAST HEX: 3FF ; inline
+
+! Virtual Keys, Standard Set
+: VK_LBUTTON        HEX: 01 ; inline
+: VK_RBUTTON        HEX: 02 ; inline
+: VK_CANCEL         HEX: 03 ; inline
+: VK_MBUTTON        HEX: 04 ; inline  ! NOT contiguous with L & RBUTTON
+: VK_XBUTTON1       HEX: 05 ; inline  ! NOT contiguous with L & RBUTTON
+: VK_XBUTTON2       HEX: 06 ; inline  ! NOT contiguous with L & RBUTTON
+! 0x07 : unassigned
+: VK_BACK           HEX: 08 ; inline
+: VK_TAB            HEX: 09 ; inline
+! 0x0A - 0x0B : reserved
+
+: VK_CLEAR          HEX: 0C ; inline
+: VK_RETURN         HEX: 0D ; inline
+
+: VK_SHIFT          HEX: 10 ; inline
+: VK_CONTROL        HEX: 11 ; inline
+: VK_MENU           HEX: 12 ; inline
+: VK_PAUSE          HEX: 13 ; inline
+: VK_CAPITAL        HEX: 14 ; inline
+
+: VK_KANA           HEX: 15 ; inline
+: VK_HANGEUL        HEX: 15 ; inline ! old name - here for compatibility
+: VK_HANGUL         HEX: 15 ; inline
+: VK_JUNJA          HEX: 17 ; inline
+: VK_FINAL          HEX: 18 ; inline
+: VK_HANJA          HEX: 19 ; inline
+: VK_KANJI          HEX: 19 ; inline
+
+: VK_ESCAPE         HEX: 1B ; inline
+
+: VK_CONVERT        HEX: 1C ; inline
+: VK_NONCONVERT     HEX: 1D ; inline
+: VK_ACCEPT         HEX: 1E ; inline
+: VK_MODECHANGE     HEX: 1F ; inline
+
+: VK_SPACE          HEX: 20 ; inline
+: VK_PRIOR          HEX: 21 ; inline
+: VK_NEXT           HEX: 22 ; inline
+: VK_END            HEX: 23 ; inline
+: VK_HOME           HEX: 24 ; inline
+: VK_LEFT           HEX: 25 ; inline
+: VK_UP             HEX: 26 ; inline
+: VK_RIGHT          HEX: 27 ; inline
+: VK_DOWN           HEX: 28 ; inline
+: VK_SELECT         HEX: 29 ; inline
+: VK_PRINT          HEX: 2A ; inline
+: VK_EXECUTE        HEX: 2B ; inline
+: VK_SNAPSHOT       HEX: 2C ; inline
+: VK_INSERT         HEX: 2D ; inline
+: VK_DELETE         HEX: 2E ; inline
+: VK_HELP           HEX: 2F ; inline
+
+! VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
+! 0x40 : unassigned
+! VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
+
+: VK_LWIN           HEX: 5B ; inline
+: VK_RWIN           HEX: 5C ; inline
+: VK_APPS           HEX: 5D ; inline
+
+! 0x5E : reserved
+
+: VK_SLEEP          HEX: 5F ; inline
+
+: VK_NUMPAD0        HEX: 60 ; inline
+: VK_NUMPAD1        HEX: 61 ; inline
+: VK_NUMPAD2        HEX: 62 ; inline
+: VK_NUMPAD3        HEX: 63 ; inline
+: VK_NUMPAD4        HEX: 64 ; inline
+: VK_NUMPAD5        HEX: 65 ; inline
+: VK_NUMPAD6        HEX: 66 ; inline
+: VK_NUMPAD7        HEX: 67 ; inline
+: VK_NUMPAD8        HEX: 68 ; inline
+: VK_NUMPAD9        HEX: 69 ; inline
+: VK_MULTIPLY       HEX: 6A ; inline
+: VK_ADD            HEX: 6B ; inline
+: VK_SEPARATOR      HEX: 6C ; inline
+: VK_SUBTRACT       HEX: 6D ; inline
+: VK_DECIMAL        HEX: 6E ; inline
+: VK_DIVIDE         HEX: 6F ; inline
+: VK_F1             HEX: 70 ; inline
+: VK_F2             HEX: 71 ; inline
+: VK_F3             HEX: 72 ; inline
+: VK_F4             HEX: 73 ; inline
+: VK_F5             HEX: 74 ; inline
+: VK_F6             HEX: 75 ; inline
+: VK_F7             HEX: 76 ; inline
+: VK_F8             HEX: 77 ; inline
+: VK_F9             HEX: 78 ; inline
+: VK_F10            HEX: 79 ; inline
+: VK_F11            HEX: 7A ; inline
+: VK_F12            HEX: 7B ; inline
+: VK_F13            HEX: 7C ; inline
+: VK_F14            HEX: 7D ; inline
+: VK_F15            HEX: 7E ; inline
+: VK_F16            HEX: 7F ; inline
+: VK_F17            HEX: 80 ; inline
+: VK_F18            HEX: 81 ; inline
+: VK_F19            HEX: 82 ; inline
+: VK_F20            HEX: 83 ; inline
+: VK_F21            HEX: 84 ; inline
+: VK_F22            HEX: 85 ; inline
+: VK_F23            HEX: 86 ; inline
+: VK_F24            HEX: 87 ; inline
+
+! 0x88 - 0x8F : unassigned
+
+: VK_NUMLOCK        HEX: 90 ; inline
+: VK_SCROLL         HEX: 91 ; inline
+
+! NEC PC-9800 kbd definitions
+: VK_OEM_NEC_EQUAL  HEX: 92 ; inline  ! '=' key on numpad
+
+! Fujitsu/OASYS kbd definitions
+: VK_OEM_FJ_JISHO   HEX: 92 ; inline  ! 'Dictionary' key
+: VK_OEM_FJ_MASSHOU HEX: 93 ; inline  ! 'Unregister word' key
+: VK_OEM_FJ_TOUROKU HEX: 94 ; inline  ! 'Register word' key
+: VK_OEM_FJ_LOYA    HEX: 95 ; inline  ! 'Left OYAYUBI' key
+: VK_OEM_FJ_ROYA    HEX: 96 ; inline  ! 'Right OYAYUBI' key
+
+! 0x97 - 0x9F : unassigned
+
+! VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
+! Used only as parameters to GetAsyncKeyState() and GetKeyState().
+! No other API or message will distinguish left and right keys in this way.
+: VK_LSHIFT         HEX: A0 ; inline
+: VK_RSHIFT         HEX: A1 ; inline
+: VK_LCONTROL       HEX: A2 ; inline
+: VK_RCONTROL       HEX: A3 ; inline
+: VK_LMENU          HEX: A4 ; inline
+: VK_RMENU          HEX: A5 ; inline
+
+: VK_BROWSER_BACK        HEX: A6 ; inline
+: VK_BROWSER_FORWARD     HEX: A7 ; inline
+: VK_BROWSER_REFRESH     HEX: A8 ; inline
+: VK_BROWSER_STOP        HEX: A9 ; inline
+: VK_BROWSER_SEARCH      HEX: AA ; inline
+: VK_BROWSER_FAVORITES   HEX: AB ; inline
+: VK_BROWSER_HOME        HEX: AC ; inline
+
+: VK_VOLUME_MUTE         HEX: AD ; inline
+: VK_VOLUME_DOWN         HEX: AE ; inline
+: VK_VOLUME_UP           HEX: AF ; inline
+: VK_MEDIA_NEXT_TRACK    HEX: B0 ; inline
+: VK_MEDIA_PREV_TRACK    HEX: B1 ; inline
+: VK_MEDIA_STOP          HEX: B2 ; inline
+: VK_MEDIA_PLAY_PAUSE    HEX: B3 ; inline
+: VK_LAUNCH_MAIL         HEX: B4 ; inline
+: VK_LAUNCH_MEDIA_SELECT HEX: B5 ; inline
+: VK_LAUNCH_APP1         HEX: B6 ; inline
+: VK_LAUNCH_APP2         HEX: B7 ; inline
+
+! 0xB8 - 0xB9 : reserved
+
+: VK_OEM_1          HEX: BA ; inline  ! ';:' for US
+: VK_OEM_PLUS       HEX: BB ; inline  ! '+' any country
+: VK_OEM_COMMA      HEX: BC ; inline  ! ',' any country
+: VK_OEM_MINUS      HEX: BD ; inline  ! '-' any country
+: VK_OEM_PERIOD     HEX: BE ; inline  ! '.' any country
+: VK_OEM_2          HEX: BF ; inline  ! '/?' for US
+: VK_OEM_3          HEX: C0 ; inline  ! '`~' for US
+
+! 0xC1 - 0xD7 : reserved
+
+! 0xD8 - 0xDA : unassigned
+
+: VK_OEM_4          HEX: DB ; inline !  '[{' for US
+: VK_OEM_5          HEX: DC ; inline !  '\|' for US
+: VK_OEM_6          HEX: DD ; inline !  ']}' for US
+: VK_OEM_7          HEX: DE ; inline !  ''"' for US
+: VK_OEM_8          HEX: DF ; inline
+
+! 0xE0 : reserved
+
+! Various extended or enhanced keyboards
+: VK_OEM_AX         HEX: E1 ; inline !  'AX' key on Japanese AX kbd
+: VK_OEM_102        HEX: E2 ; inline !  "<>" or "\|" on RT 102-key kbd.
+: VK_ICO_HELP       HEX: E3 ; inline !  Help key on ICO
+: VK_ICO_00         HEX: E4 ; inline !  00 key on ICO
+
+: VK_PROCESSKEY     HEX: E5 ; inline
+
+: VK_ICO_CLEAR      HEX: E6 ; inline
+
+: VK_PACKET         HEX: E7 ; inline
+
+! 0xE8 : unassigned
+
+! Nokia/Ericsson definitions
+: VK_OEM_RESET      HEX: E9 ; inline
+: VK_OEM_JUMP       HEX: EA ; inline
+: VK_OEM_PA1        HEX: EB ; inline
+: VK_OEM_PA2        HEX: EC ; inline
+: VK_OEM_PA3        HEX: ED ; inline
+: VK_OEM_WSCTRL     HEX: EE ; inline
+: VK_OEM_CUSEL      HEX: EF ; inline
+: VK_OEM_ATTN       HEX: F0 ; inline
+: VK_OEM_FINISH     HEX: F1 ; inline
+: VK_OEM_COPY       HEX: F2 ; inline
+: VK_OEM_AUTO       HEX: F3 ; inline
+: VK_OEM_ENLW       HEX: F4 ; inline
+: VK_OEM_BACKTAB    HEX: F5 ; inline
+
+: VK_ATTN           HEX: F6 ; inline
+: VK_CRSEL          HEX: F7 ; inline
+: VK_EXSEL          HEX: F8 ; inline
+: VK_EREOF          HEX: F9 ; inline
+: VK_PLAY           HEX: FA ; inline
+: VK_ZOOM           HEX: FB ; inline
+: VK_NONAME         HEX: FC ; inline
+: VK_PA1            HEX: FD ; inline
+: VK_OEM_CLEAR      HEX: FE ; inline
+! 0xFF : reserved
+
+! Key State Masks for Mouse Messages
+: MK_LBUTTON          HEX: 0001 ; inline
+: MK_RBUTTON          HEX: 0002 ; inline
+: MK_SHIFT            HEX: 0004 ; inline
+: MK_CONTROL          HEX: 0008 ; inline
+: MK_MBUTTON          HEX: 0010 ; inline
+: MK_XBUTTON1         HEX: 0020 ; inline
+: MK_XBUTTON2         HEX: 0040 ; inline
+
+! Some fields are not defined for win64
+! Window field offsets for GetWindowLong()
+: GWL_WNDPROC         -4 ;
+: GWL_HINSTANCE       -6 ;
+: GWL_HWNDPARENT      -8 ;
+: GWL_USERDATA        -21 ;
+: GWL_ID              -12 ;
+
+: GWL_STYLE           -16 ;
+: GWL_EXSTYLE         -20 ;
+
+: GWLP_WNDPROC        -4 ;
+: GWLP_HINSTANCE      -6 ;
+: GWLP_HWNDPARENT     -8 ;
+: GWLP_USERDATA       -21 ;
+: GWLP_ID             -12 ;
+
+! Class field offsets for GetClassLong()
+: GCL_MENUNAME        -8 ;
+: GCL_HBRBACKGROUND   -10 ;
+: GCL_HCURSOR         -12 ;
+: GCL_HICON           -14 ;
+: GCL_HMODULE         -16 ;
+: GCL_WNDPROC         -24 ;
+: GCL_HICONSM         -34 ;
+: GCL_CBWNDEXTRA      -18 ;
+: GCL_CBCLSEXTRA      -20 ;
+: GCL_STYLE           -26 ;
+: GCW_ATOM            -32 ;
+
+: GCLP_MENUNAME       -8 ;
+: GCLP_HBRBACKGROUND  -10 ;
+: GCLP_HCURSOR        -12 ;
+: GCLP_HICON          -14 ;
+: GCLP_HMODULE        -16 ;
+: GCLP_WNDPROC        -24 ;
+: GCLP_HICONSM        -34 ;
+
+: MB_ICONASTERISK    HEX: 00000040 ;
+: MB_ICONEXCLAMATION HEX: 00000030 ;
+: MB_ICONHAND        HEX: 00000010 ;
+: MB_ICONQUESTION    HEX: 00000020 ;
+: MB_OK              HEX: 00000000 ;
+
+: TME_HOVER 1 ; inline
+: TME_LEAVE 2 ; inline
+: TME_NONCLIENT 16 ; inline
+: TME_QUERY HEX: 40000000 ; inline
+: TME_CANCEL HEX: 80000000 ; inline
+: HOVER_DEFAULT HEX: ffffffff ; inline
+C-STRUCT: TRACKMOUSEEVENT
+    { "DWORD" "cbSize" }
+    { "DWORD" "dwFlags" }
+    { "HWND" "hwndTrack" }
+    { "DWORD" "dwHoverTime" } ;
+TYPEDEF: TRACKMOUSEEVENT* LPTRACKMOUSEEVENT
+
+LIBRARY: user32
+
+FUNCTION: HKL ActivateKeyboardLayout ( HKL hkl, UINT Flags ) ;
+FUNCTION: BOOL AdjustWindowRect ( LPRECT lpRect, DWORD dwStyle, BOOL bMenu ) ;
+FUNCTION: BOOL AdjustWindowRectEx ( LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle ) ;
+! FUNCTION: AlignRects
+! FUNCTION: AllowForegroundActivation
+! FUNCTION: AllowSetForegroundWindow
+! FUNCTION: AnimateWindow
+
+FUNCTION: BOOL AnyPopup ( ) ;
+
+! FUNCTION: AppendMenuA
+! FUNCTION: AppendMenuW
+! FUNCTION: ArrangeIconicWindows
+! FUNCTION: AttachThreadInput
+! FUNCTION: BeginDeferWindowPos
+
+FUNCTION: HDC BeginPaint ( HWND hwnd, LPPAINTSTRUCT lpPaint ) ;
+
+! FUNCTION: BlockInput
+! FUNCTION: BringWindowToTop
+! FUNCTION: BroadcastSystemMessage
+! FUNCTION: BroadcastSystemMessageA
+! FUNCTION: BroadcastSystemMessageExA
+! FUNCTION: BroadcastSystemMessageExW
+! FUNCTION: BroadcastSystemMessageW
+! FUNCTION: BuildReasonArray
+! FUNCTION: CalcMenuBar
+! FUNCTION: CallMsgFilter
+! FUNCTION: CallMsgFilterA
+! FUNCTION: CallMsgFilterW
+! FUNCTION: CallNextHookEx
+! FUNCTION: CallWindowProcA
+! FUNCTION: CallWindowProcW
+! FUNCTION: CascadeChildWindows
+! FUNCTION: CascadeWindows
+! FUNCTION: ChangeClipboardChain
+! FUNCTION: ChangeDisplaySettingsA
+! FUNCTION: ChangeDisplaySettingsExA
+! FUNCTION: ChangeDisplaySettingsExW
+! FUNCTION: ChangeDisplaySettingsW
+! FUNCTION: ChangeMenuA
+! FUNCTION: ChangeMenuW
+! FUNCTION: CharLowerA
+! FUNCTION: CharLowerBuffA
+! FUNCTION: CharLowerBuffW
+! FUNCTION: CharLowerW
+! FUNCTION: CharNextA
+! FUNCTION: CharNextExA
+! FUNCTION: CharNextW
+! FUNCTION: CharPrevA
+! FUNCTION: CharPrevExA
+! FUNCTION: CharPrevW
+! FUNCTION: CharToOemA
+! FUNCTION: CharToOemBuffA
+! FUNCTION: CharToOemBuffW
+! FUNCTION: CharToOemW
+! FUNCTION: CharUpperA
+! FUNCTION: CharUpperBuffA
+! FUNCTION: CharUpperBuffW
+! FUNCTION: CharUpperW
+! FUNCTION: CheckDlgButton
+! FUNCTION: CheckMenuItem
+! FUNCTION: CheckMenuRadioItem
+! FUNCTION: CheckRadioButton
+FUNCTION: HWND ChildWindowFromPoint ( HWND hWndParent, POINT point ) ;
+! FUNCTION: ChildWindowFromPointEx
+! FUNCTION: ClientThreadSetup
+! FUNCTION: ClientToScreen
+! FUNCTION: CliImmSetHotKey
+! FUNCTION: ClipCursor
+FUNCTION: BOOL CloseClipboard ( ) ;
+! FUNCTION: CloseDesktop
+! FUNCTION: CloseWindow
+! FUNCTION: CloseWindowStation
+! FUNCTION: CopyAcceleratorTableA
+! FUNCTION: CopyAcceleratorTableW
+! FUNCTION: CopyIcon
+! FUNCTION: CopyImage
+! FUNCTION: CopyRect
+! FUNCTION: CountClipboardFormats
+! FUNCTION: CreateAcceleratorTableA
+! FUNCTION: CreateAcceleratorTableW
+! FUNCTION: CreateCaret
+! FUNCTION: CreateCursor
+! FUNCTION: CreateDesktopA
+! FUNCTION: CreateDesktopW
+! FUNCTION: CreateDialogIndirectParamA
+! FUNCTION: CreateDialogIndirectParamAorW
+! FUNCTION: CreateDialogIndirectParamW
+! FUNCTION: CreateDialogParamA
+! FUNCTION: CreateDialogParamW
+! FUNCTION: CreateIcon
+! FUNCTION: CreateIconFromResource
+! FUNCTION: CreateIconFromResourceEx
+! FUNCTION: CreateIconIndirect
+! FUNCTION: CreateMDIWindowA
+! FUNCTION: CreateMDIWindowW
+! FUNCTION: CreateMenu
+! FUNCTION: CreatePopupMenu
+! FUNCTION: CreateSystemThreads
+
+FUNCTION: HWND CreateWindowExW (
+                DWORD dwExStyle,
+                LPCTSTR lpClassName,
+                LPCTSTR lpWindowName,
+                DWORD dwStyle,
+                uint X,
+                uint Y,
+                uint nWidth,
+                uint nHeight,
+                HWND hWndParent,
+                HMENU hMenu,
+                HINSTANCE hInstance,
+                LPVOID lpParam ) ;
+
+: CreateWindowEx CreateWindowExW ; inline
+
+: CreateWindow 0 12 -nrot CreateWindowEx ;
+
+
+! FUNCTION: CreateWindowStationA
+! FUNCTION: CreateWindowStationW
+! FUNCTION: CsrBroadcastSystemMessageExW
+! FUNCTION: CtxInitUser32
+! FUNCTION: DdeAbandonTransaction
+! FUNCTION: DdeAccessData
+! FUNCTION: DdeAddData
+! FUNCTION: DdeClientTransaction
+! FUNCTION: DdeCmpStringHandles
+! FUNCTION: DdeConnect
+! FUNCTION: DdeConnectList
+! FUNCTION: DdeCreateDataHandle
+! FUNCTION: DdeCreateStringHandleA
+! FUNCTION: DdeCreateStringHandleW
+! FUNCTION: DdeDisconnect
+! FUNCTION: DdeDisconnectList
+! FUNCTION: DdeEnableCallback
+! FUNCTION: DdeFreeDataHandle
+! FUNCTION: DdeFreeStringHandle
+! FUNCTION: DdeGetData
+! FUNCTION: DdeGetLastError
+! FUNCTION: DdeGetQualityOfService
+! FUNCTION: DdeImpersonateClient
+! FUNCTION: DdeInitializeA
+! FUNCTION: DdeInitializeW
+! FUNCTION: DdeKeepStringHandle
+! FUNCTION: DdeNameService
+! FUNCTION: DdePostAdvise
+! FUNCTION: DdeQueryConvInfo
+! FUNCTION: DdeQueryNextServer
+! FUNCTION: DdeQueryStringA
+! FUNCTION: DdeQueryStringW
+! FUNCTION: DdeReconnect
+! FUNCTION: DdeSetQualityOfService
+! FUNCTION: DdeSetUserHandle
+! FUNCTION: DdeUnaccessData
+! FUNCTION: DdeUninitialize
+! FUNCTION: DefDlgProcA
+! FUNCTION: DefDlgProcW
+! FUNCTION: DeferWindowPos
+! FUNCTION: DefFrameProcA
+! FUNCTION: DefFrameProcW
+! FUNCTION: DefMDIChildProcA
+! FUNCTION: DefMDIChildProcW
+! FUNCTION: DefRawInputProc
+FUNCTION: LRESULT DefWindowProcW ( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ) ;
+: DefWindowProc DefWindowProcW ; inline
+! FUNCTION: DeleteMenu
+! FUNCTION: DeregisterShellHookWindow
+! FUNCTION: DestroyAcceleratorTable
+! FUNCTION: DestroyCaret
+! FUNCTION: DestroyCursor
+! FUNCTION: DestroyIcon
+! FUNCTION: DestroyMenu
+! FUNCTION: DestroyReasons
+FUNCTION: BOOL DestroyWindow ( HWND hWnd ) ;
+! FUNCTION: DeviceEventWorker
+! FUNCTION: DialogBoxIndirectParamA
+! FUNCTION: DialogBoxIndirectParamAorW
+! FUNCTION: DialogBoxIndirectParamW
+! FUNCTION: DialogBoxParamA
+! FUNCTION: DialogBoxParamW
+! FUNCTION: DisableProcessWindowsGhosting
+
+FUNCTION: LONG DispatchMessageW ( MSG* lpMsg ) ;
+: DispatchMessage DispatchMessageW ; inline
+
+! FUNCTION: DisplayExitWindowsWarnings
+! FUNCTION: DlgDirListA
+! FUNCTION: DlgDirListComboBoxA
+! FUNCTION: DlgDirListComboBoxW
+! FUNCTION: DlgDirListW
+! FUNCTION: DlgDirSelectComboBoxExA
+! FUNCTION: DlgDirSelectComboBoxExW
+! FUNCTION: DlgDirSelectExA
+! FUNCTION: DlgDirSelectExW
+! FUNCTION: DragDetect
+! FUNCTION: DragObject
+
+
+FUNCTION: BOOL DrawAnimatedRects ( HWND hWnd, int idAni, RECT* lprcFrom, RECT* lprcTo ) ;
+! FUNCTION: BOOL DrawCaption ( HWND hWnd, HDC hdc, LPRECT lprc, UINT uFlags ) ;
+
+! FUNCTION: DrawEdge
+! FUNCTION: DrawFocusRect
+! FUNCTION: DrawFrame
+! FUNCTION: DrawFrameControl
+
+FUNCTION: BOOL DrawIcon ( HDC hDC, int X, int Y, HICON hIcon ) ;
+
+! FUNCTION: DrawIconEx
+! FUNCTION: DrawMenuBar
+! FUNCTION: DrawMenuBarTemp
+! FUNCTION: DrawStateA
+! FUNCTION: DrawStateW
+! FUNCTION: DrawTextA
+! FUNCTION: DrawTextExA
+! FUNCTION: DrawTextExW
+! FUNCTION: DrawTextW
+! FUNCTION: EditWndProc
+FUNCTION: BOOL EmptyClipboard ( ) ;
+! FUNCTION: EnableMenuItem
+! FUNCTION: EnableScrollBar
+! FUNCTION: EnableWindow
+! FUNCTION: EndDeferWindowPos
+! FUNCTION: EndDialog
+! FUNCTION: EndMenu
+
+FUNCTION: BOOL EndPaint ( HWND hWnd, PAINTSTRUCT* lpPaint) ;
+
+! FUNCTION: EndTask
+! FUNCTION: EnterReaderModeHelper
+! FUNCTION: EnumChildWindows
+FUNCTION: UINT EnumClipboardFormats ( UINT format ) ;
+! FUNCTION: EnumDesktopsA
+! FUNCTION: EnumDesktopsW
+! FUNCTION: EnumDesktopWindows
+! FUNCTION: EnumDisplayDevicesA
+! FUNCTION: EnumDisplayDevicesW
+! FUNCTION: EnumDisplayMonitors
+! FUNCTION: EnumDisplaySettingsA
+! FUNCTION: EnumDisplaySettingsExA
+! FUNCTION: EnumDisplaySettingsExW
+! FUNCTION: EnumDisplaySettingsW
+! FUNCTION: EnumPropsA
+! FUNCTION: EnumPropsExA
+! FUNCTION: EnumPropsExW
+! FUNCTION: EnumPropsW
+! FUNCTION: EnumThreadWindows
+! FUNCTION: EnumWindows
+! FUNCTION: EnumWindowStationsA
+! FUNCTION: EnumWindowStationsW
+! FUNCTION: EqualRect
+! FUNCTION: ExcludeUpdateRgn
+! FUNCTION: ExitWindowsEx
+! FUNCTION: FillRect
+FUNCTION: HWND FindWindowA ( char* lpClassName, char* lpWindowName ) ;
+FUNCTION: HWND FindWindowExA ( HWND hwndParent, HWND childAfter, char* lpClassName, char* lpWindowName ) ;
+! FUNCTION: FindWindowExW
+! FUNCTION: FindWindowW
+! FUNCTION: FlashWindow
+! FUNCTION: FlashWindowEx
+! FUNCTION: FrameRect
+! FUNCTION: FreeDDElParam
+! FUNCTION: GetActiveWindow
+! FUNCTION: GetAltTabInfo
+! FUNCTION: GetAltTabInfoA
+! FUNCTION: GetAltTabInfoW
+! FUNCTION: GetAncestor
+! FUNCTION: GetAppCompatFlags
+! FUNCTION: GetAppCompatFlags2
+! FUNCTION: GetAsyncKeyState
+FUNCTION: HWND GetCapture ( ) ;
+! FUNCTION: GetCaretBlinkTime
+! FUNCTION: GetCaretPos
+FUNCTION: BOOL GetClassInfoW ( HINSTANCE hInst, LPCWSTR lpszClass, LPWNDCLASS lpwcx ) ;
+: GetClassInfo GetClassInfoW ;
+
+FUNCTION: BOOL GetClassInfoExW ( HINSTANCE hInst, LPCWSTR lpszClass, LPWNDCLASSEX lpwcx ) ;
+: GetClassInfoEx GetClassInfoExW ; inline
+
+FUNCTION: ULONG_PTR GetClassLongW ( HWND hWnd, int nIndex ) ;
+: GetClassLong GetClassLongW ; inline
+: GetClassLongPtr GetClassLongW ; inline
+
+
+! FUNCTION: GetClassNameA
+! FUNCTION: GetClassNameW
+! FUNCTION: GetClassWord
+FUNCTION: BOOL GetClientRect ( HWND hWnd, LPRECT lpRect ) ;
+
+FUNCTION: HANDLE GetClipboardData ( UINT uFormat ) ;
+
+! FUNCTION: GetClipboardFormatNameA
+! FUNCTION: GetClipboardFormatNameW
+FUNCTION: HWND GetClipboardOwner ( ) ;
+FUNCTION: DWORD GetClipboardSequenceNumber ( ) ;
+! FUNCTION: GetClipboardViewer
+! FUNCTION: GetClipCursor
+! FUNCTION: GetComboBoxInfo
+! FUNCTION: GetCursor
+! FUNCTION: GetCursorFrameInfo
+! FUNCTION: GetCursorInfo
+! FUNCTION: GetCursorPos
+FUNCTION: HDC GetDC ( HWND hWnd ) ;
+FUNCTION: HDC GetDCEx ( HWND hWnd, HRGN hrgnClip, DWORD flags ) ;
+! FUNCTION: GetDesktopWindow
+! FUNCTION: GetDialogBaseUnits
+! FUNCTION: GetDlgCtrlID
+! FUNCTION: GetDlgItem
+! FUNCTION: GetDlgItemInt
+! FUNCTION: GetDlgItemTextA
+! FUNCTION: GetDlgItemTextW
+FUNCTION: uint GetDoubleClickTime ( ) ;
+FUNCTION: HWND GetFocus ( ) ;
+! FUNCTION: GetForegroundWindow
+! FUNCTION: GetGuiResources
+! FUNCTION: GetGUIThreadInfo
+! FUNCTION: GetIconInfo
+! FUNCTION: GetInputDesktop
+! FUNCTION: GetInputState
+! FUNCTION: GetInternalWindowPos
+! FUNCTION: GetKBCodePage
+! FUNCTION: GetKeyboardLayout
+! FUNCTION: GetKeyboardLayoutList
+! FUNCTION: GetKeyboardLayoutNameA
+! FUNCTION: GetKeyboardLayoutNameW
+! FUNCTION: GetKeyboardState
+! FUNCTION: GetKeyboardType
+! FUNCTION: GetKeyNameTextA
+! FUNCTION: GetKeyNameTextW
+FUNCTION: SHORT GetKeyState ( int nVirtKey ) ;
+! FUNCTION: GetLastActivePopup
+! FUNCTION: GetLastInputInfo
+! FUNCTION: GetLayeredWindowAttributes
+! FUNCTION: GetListBoxInfo
+! FUNCTION: GetMenu
+! FUNCTION: GetMenuBarInfo
+! FUNCTION: GetMenuCheckMarkDimensions
+! FUNCTION: GetMenuContextHelpId
+! FUNCTION: GetMenuDefaultItem
+! FUNCTION: GetMenuInfo
+! FUNCTION: GetMenuItemCount
+! FUNCTION: GetMenuItemID
+! FUNCTION: GetMenuItemInfoA
+! FUNCTION: GetMenuItemInfoW
+! FUNCTION: GetMenuItemRect
+! FUNCTION: GetMenuState
+! FUNCTION: GetMenuStringA
+! FUNCTION: GetMenuStringW
+
+FUNCTION: BOOL GetMessageW ( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) ;
+: GetMessage GetMessageW ; inline
+
+! FUNCTION: GetMessageExtraInfo
+! FUNCTION: GetMessagePos
+! FUNCTION: GetMessageTime
+! FUNCTION: GetMonitorInfoA
+! FUNCTION: GetMonitorInfoW
+! FUNCTION: GetMouseMovePointsEx
+! FUNCTION: GetNextDlgGroupItem
+! FUNCTION: GetNextDlgTabItem
+! FUNCTION: GetOpenClipboardWindow
+FUNCTION: HWND GetParent ( HWND hWnd ) ;
+FUNCTION: int GetPriorityClipboardFormat ( UINT* paFormatPriorityList, int cFormats ) ;
+! FUNCTION: GetProcessDefaultLayout
+! FUNCTION: GetProcessWindowStation
+! FUNCTION: GetProgmanWindow
+! FUNCTION: GetPropA
+! FUNCTION: GetPropW
+! FUNCTION: GetQueueStatus
+! FUNCTION: GetRawInputBuffer
+! FUNCTION: GetRawInputData
+! FUNCTION: GetRawInputDeviceInfoA
+! FUNCTION: GetRawInputDeviceInfoW
+! FUNCTION: GetRawInputDeviceList
+! FUNCTION: GetReasonTitleFromReasonCode
+! FUNCTION: GetRegisteredRawInputDevices
+! FUNCTION: GetScrollBarInfo
+! FUNCTION: GetScrollInfo
+! FUNCTION: GetScrollPos
+! FUNCTION: GetScrollRange
+! FUNCTION: GetShellWindow
+! FUNCTION: GetSubMenu
+! FUNCTION: GetSysColor
+FUNCTION: HBRUSH GetSysColorBrush ( int nIndex ) ;
+! FUNCTION: GetSystemMenu
+! FUNCTION: GetSystemMetrics
+! FUNCTION: GetTabbedTextExtentA
+! FUNCTION: GetTabbedTextExtentW
+! FUNCTION: GetTaskmanWindow
+! FUNCTION: GetThreadDesktop
+! FUNCTION: GetTitleBarInfo
+
+
+FUNCTION: HWND GetTopWindow ( HWND hWnd ) ;
+! FUNCTION: BOOL GetUpdateRect ( HWND hWnd, LPRECT lpRect, BOOL bErase ) ;
+FUNCTION: int GetUpdateRgn ( HWND hWnd, HRGN hRgn, BOOL bErase ) ;
+
+
+! FUNCTION: GetUserObjectInformationA
+! FUNCTION: GetUserObjectInformationW
+! FUNCTION: GetUserObjectSecurity
+FUNCTION: HWND GetWindow ( HWND hWnd, UINT uCmd ) ;
+! FUNCTION: GetWindowContextHelpId
+! FUNCTION: GetWindowDC
+! FUNCTION: GetWindowInfo
+! FUNCTION: GetWindowLongA
+! FUNCTION: GetWindowLongW
+! FUNCTION: GetWindowModuleFileName
+! FUNCTION: GetWindowModuleFileNameA
+! FUNCTION: GetWindowModuleFileNameW
+! FUNCTION: GetWindowPlacement
+FUNCTION: BOOL GetWindowRect ( HWND hWnd, LPRECT lpRect ) ;
+! FUNCTION: GetWindowRgn
+! FUNCTION: GetWindowRgnBox
+FUNCTION: int GetWindowTextA ( HWND hWnd, char* lpString, int nMaxCount ) ;
+! FUNCTION: GetWindowTextLengthA
+! FUNCTION: GetWindowTextLengthW
+! FUNCTION: GetWindowTextW
+FUNCTION: DWORD GetWindowThreadProcessId ( HWND hWnd, void* lpdwProcessId ) ;
+! FUNCTION: GetWindowWord
+! FUNCTION: GetWinStationInfo
+! FUNCTION: GrayStringA
+! FUNCTION: GrayStringW
+! FUNCTION: HideCaret
+! FUNCTION: HiliteMenuItem
+! FUNCTION: ImpersonateDdeClientWindow
+! FUNCTION: IMPGetIMEA
+! FUNCTION: IMPGetIMEW
+! FUNCTION: IMPQueryIMEA
+! FUNCTION: IMPQueryIMEW
+! FUNCTION: IMPSetIMEA
+! FUNCTION: IMPSetIMEW
+! FUNCTION: InflateRect
+! FUNCTION: InitializeLpkHooks
+! FUNCTION: InitializeWin32EntryTable
+! FUNCTION: InSendMessage
+! FUNCTION: InSendMessageEx
+! FUNCTION: InsertMenuA
+! FUNCTION: InsertMenuItemA
+! FUNCTION: InsertMenuItemW
+! FUNCTION: InsertMenuW
+! FUNCTION: InternalGetWindowText
+! FUNCTION: IntersectRect
+! FUNCTION: InvalidateRect
+! FUNCTION: InvalidateRgn
+! FUNCTION: InvertRect
+! FUNCTION: IsCharAlphaA
+! FUNCTION: IsCharAlphaNumericA
+! FUNCTION: IsCharAlphaNumericW
+! FUNCTION: IsCharAlphaW
+! FUNCTION: IsCharLowerA
+! FUNCTION: IsCharLowerW
+! FUNCTION: IsCharUpperA
+! FUNCTION: IsCharUpperW
+FUNCTION: BOOL IsChild ( HWND hWndParent, HWND hWnd ) ;
+FUNCTION: BOOL IsClipboardFormatAvailable ( UINT format ) ;
+! FUNCTION: IsDialogMessage
+! FUNCTION: IsDialogMessageA
+! FUNCTION: IsDialogMessageW
+! FUNCTION: IsDlgButtonChecked
+FUNCTION: BOOL IsGUIThread ( BOOL bConvert ) ;
+FUNCTION: BOOL IsHungAppWindow ( HWND hWnd ) ;
+FUNCTION: BOOL IsIconic ( HWND hWnd ) ;
+FUNCTION: BOOL IsMenu ( HMENU hMenu ) ;
+! FUNCTION: BOOL IsRectEmpty
+! FUNCTION: BOOL IsServerSideWindow
+FUNCTION: BOOL IsWindow ( HWND hWnd ) ;
+! FUNCTION: BOOL IsWindowEnabled
+! FUNCTION: BOOL IsWindowInDestroy
+FUNCTION: BOOL IsWindowUnicode ( HWND hWnd ) ;
+FUNCTION: BOOL IsWindowVisible ( HWND hWnd ) ;
+! FUNCTION: BOOL IsWinEventHookInstalled
+FUNCTION: BOOL IsZoomed ( HWND hWnd ) ;
+! FUNCTION: keybd_event
+! FUNCTION: KillSystemTimer
+! FUNCTION: KillTimer
+! FUNCTION: LoadAcceleratorsA
+! FUNCTION: LoadAcceleratorsW
+! FUNCTION: LoadBitmapA
+! FUNCTION: LoadBitmapW
+! FUNCTION: LoadCursorFromFileA
+! FUNCTION: LoadCursorFromFileW
+
+
+! FUNCTION: HCURSOR LoadCursorW ( HINSTANCE hInstance, LPCWSTR lpCursorName ) ;
+FUNCTION: HCURSOR LoadCursorW ( HINSTANCE hInstance, ushort lpCursorName ) ;
+: LoadCursor LoadCursorW ; inline
+
+! FUNCTION: HICON LoadIconA ( HINSTANCE hInstance, LPCTSTR lpIconName ) ;
+FUNCTION: HICON LoadIconW ( HINSTANCE hInstance, LPCTSTR lpIconName ) ;
+: LoadIcon LoadIconW ; inline
+
+! FUNCTION: LoadImageA
+! FUNCTION: LoadImageW
+! FUNCTION: LoadKeyboardLayoutA
+! FUNCTION: LoadKeyboardLayoutEx
+! FUNCTION: LoadKeyboardLayoutW
+! FUNCTION: LoadLocalFonts
+! FUNCTION: LoadMenuA
+! FUNCTION: LoadMenuIndirectA
+! FUNCTION: LoadMenuIndirectW
+! FUNCTION: LoadMenuW
+! FUNCTION: LoadRemoteFonts
+! FUNCTION: LoadStringA
+! FUNCTION: LoadStringW
+! FUNCTION: LockSetForegroundWindow
+! FUNCTION: LockWindowStation
+! FUNCTION: LockWindowUpdate
+! FUNCTION: LockWorkStation
+! FUNCTION: LookupIconIdFromDirectory
+! FUNCTION: LookupIconIdFromDirectoryEx
+! FUNCTION: MapDialogRect
+! FUNCTION: MapVirtualKeyA
+! FUNCTION: MapVirtualKeyExA
+! FUNCTION: MapVirtualKeyExW
+! FUNCTION: MapVirtualKeyW
+! FUNCTION: MapWindowPoints
+! FUNCTION: MB_GetString
+! FUNCTION: MBToWCSEx
+! FUNCTION: MenuItemFromPoint
+! FUNCTION: MenuWindowProcA
+! FUNCTION: MenuWindowProcW
+
+! -1 is Simple beep
+FUNCTION: BOOL MessageBeep ( UINT uType ) ;
+
+FUNCTION: int MessageBoxA ( 
+                HWND hWnd,
+                LPCSTR lpText,
+                LPCSTR lpCaption,
+                UINT uType ) ;
+
+FUNCTION: int MessageBoxW (
+                HWND hWnd,
+                LPCWSTR lpText,
+                LPCWSTR lpCaption,
+                UINT uType) ;
+
+FUNCTION: int MessageBoxExA ( HWND hWnd,
+                LPCSTR lpText,
+                LPCSTR lpCaption,
+                UINT uType,
+                WORD wLanguageId
+                ) ;
+
+FUNCTION: int MessageBoxExW (
+                HWND hWnd,
+                LPCWSTR lpText,
+                LPCWSTR lpCaption,
+                UINT uType,
+                WORD wLanguageId ) ;
+
+! FUNCTION: int MessageBoxIndirectA ( MSGBOXPARAMSA* params ) ;
+! FUNCTION: int MessageBoxIndirectW ( MSGBOXPARAMSW* params ) ;
+
+
+: MessageBox MessageBoxW ;
+
+: MessageBoxEx MessageBoxExW ;
+
+! : MessageBoxIndirect
+    ! \ MessageBoxIndirectW \ MessageBoxIndirectA unicode-exec ;
+
+! FUNCTION: MessageBoxTimeoutA ! dllexported, not in header
+! FUNCTION: MessageBoxTimeoutW ! dllexported, not in header
+
+! FUNCTION: ModifyMenuA
+! FUNCTION: ModifyMenuW
+! FUNCTION: MonitorFromPoint
+! FUNCTION: MonitorFromRect
+! FUNCTION: MonitorFromWindow
+! FUNCTION: mouse_event
+
+
+
+FUNCTION: BOOL MoveWindow (
+    HWND hWnd,
+    int X,
+    int Y,
+    int nWidth,
+    int nHeight,
+    BOOL bRepaint ) ;
+
+
+! FUNCTION: MsgWaitForMultipleObjects
+! FUNCTION: MsgWaitForMultipleObjectsEx
+! FUNCTION: NotifyWinEvent
+! FUNCTION: OemKeyScan
+! FUNCTION: OemToCharA
+! FUNCTION: OemToCharBuffA
+! FUNCTION: OemToCharBuffW
+! FUNCTION: OemToCharW
+! FUNCTION: OffsetRect
+FUNCTION: BOOL OpenClipboard ( HWND hWndNewOwner ) ;
+! FUNCTION: OpenDesktopA
+! FUNCTION: OpenDesktopW
+! FUNCTION: OpenIcon
+! FUNCTION: OpenInputDesktop
+! FUNCTION: OpenWindowStationA
+! FUNCTION: OpenWindowStationW
+! FUNCTION: PackDDElParam
+! FUNCTION: PaintDesktop
+! FUNCTION: PaintMenuBar
+FUNCTION: BOOL PeekMessageA ( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) ;
+FUNCTION: BOOL PeekMessageW ( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) ;
+: PeekMessage PeekMessageW ;
+
+! FUNCTION: PostMessageA
+! FUNCTION: PostMessageW
+FUNCTION: void PostQuitMessage ( int nExitCode ) ;
+! FUNCTION: PostThreadMessageA
+! FUNCTION: PostThreadMessageW
+! FUNCTION: PrintWindow
+! FUNCTION: PrivateExtractIconExA
+! FUNCTION: PrivateExtractIconExW
+! FUNCTION: PrivateExtractIconsA
+! FUNCTION: PrivateExtractIconsW
+! FUNCTION: PrivateSetDbgTag
+! FUNCTION: PrivateSetRipFlags
+! FUNCTION: PtInRect
+! FUNCTION: QuerySendMessage
+! FUNCTION: QueryUserCounters
+! FUNCTION: RealChildWindowFromPoint
+! FUNCTION: RealGetWindowClass
+! FUNCTION: RealGetWindowClassA
+! FUNCTION: RealGetWindowClassW
+! FUNCTION: ReasonCodeNeedsBugID
+! FUNCTION: ReasonCodeNeedsComment
+! FUNCTION: RecordShutdownReason
+! FUNCTION: RedrawWindow
+
+FUNCTION: ATOM RegisterClassA ( WNDCLASS* lpWndClass) ;
+FUNCTION: ATOM RegisterClassW ( WNDCLASS* lpWndClass ) ;
+FUNCTION: ATOM RegisterClassExA ( WNDCLASSEX* lpwcx ) ;
+FUNCTION: ATOM RegisterClassExW ( WNDCLASSEX* lpwcx ) ;
+
+: RegisterClass RegisterClassW ;
+: RegisterClassEx RegisterClassExW ;
+
+! FUNCTION: RegisterClipboardFormatA
+! FUNCTION: RegisterClipboardFormatW
+! FUNCTION: RegisterDeviceNotificationA
+! FUNCTION: RegisterDeviceNotificationW
+! FUNCTION: RegisterHotKey
+! FUNCTION: RegisterLogonProcess
+! FUNCTION: RegisterMessagePumpHook
+! FUNCTION: RegisterRawInputDevices
+! FUNCTION: RegisterServicesProcess
+! FUNCTION: RegisterShellHookWindow
+! FUNCTION: RegisterSystemThread
+! FUNCTION: RegisterTasklist
+! FUNCTION: RegisterUserApiHook
+! FUNCTION: RegisterWindowMessageA
+! FUNCTION: RegisterWindowMessageW
+FUNCTION: BOOL ReleaseCapture ( ) ;
+FUNCTION: int ReleaseDC ( HWND hWnd, HDC hDC ) ;
+! FUNCTION: RemoveMenu
+! FUNCTION: RemovePropA
+! FUNCTION: RemovePropW
+! FUNCTION: ReplyMessage
+! FUNCTION: ResolveDesktopForWOW
+! FUNCTION: ReuseDDElParam
+! FUNCTION: ScreenToClient
+! FUNCTION: ScrollChildren
+! FUNCTION: ScrollDC
+! FUNCTION: ScrollWindow
+! FUNCTION: ScrollWindowEx
+! FUNCTION: SendDlgItemMessageA
+! FUNCTION: SendDlgItemMessageW
+! FUNCTION: SendIMEMessageExA
+! FUNCTION: SendIMEMessageExW
+! FUNCTION: UINT SendInput ( UINT nInputs, LPINPUT pInputs, int cbSize ) ;
+FUNCTION: LRESULT SendMessageW ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) ;
+: SendMessage SendMessageW ;
+! FUNCTION: SendMessageCallbackA
+! FUNCTION: SendMessageCallbackW
+! FUNCTION: SendMessageTimeoutA
+! FUNCTION: SendMessageTimeoutW
+! FUNCTION: SendNotifyMessageA
+! FUNCTION: SendNotifyMessageW
+! FUNCTION: SetActiveWindow
+FUNCTION: HWND SetCapture ( HWND hWnd ) ;
+! FUNCTION: SetCaretBlinkTime
+! FUNCTION: SetCaretPos
+
+FUNCTION: ULONG_PTR SetClassLongW ( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) ;
+: SetClassLongPtr SetClassLongW ;
+: SetClassLong SetClassLongW ;
+
+! FUNCTION: SetClassWord
+FUNCTION: HANDLE SetClipboardData ( UINT uFormat, HANDLE hMem ) ;
+! FUNCTION: SetClipboardViewer
+! FUNCTION: SetConsoleReserveKeys
+! FUNCTION: SetCursor
+! FUNCTION: SetCursorContents
+! FUNCTION: SetCursorPos
+! FUNCTION: SetDebugErrorLevel
+! FUNCTION: SetDeskWallpaper
+! FUNCTION: SetDlgItemInt
+! FUNCTION: SetDlgItemTextA
+! FUNCTION: SetDlgItemTextW
+! FUNCTION: SetDoubleClickTime
+FUNCTION: HWND SetFocus ( HWND hWnd ) ;
+FUNCTION: BOOL SetForegroundWindow ( HWND hWnd ) ;
+! FUNCTION: SetInternalWindowPos
+! FUNCTION: SetKeyboardState
+! type is ignored
+FUNCTION: void SetLastErrorEx ( DWORD dwErrCode, DWORD dwType ) ; 
+: SetLastError 0 SetLastErrorEx ;
+! FUNCTION: SetLayeredWindowAttributes
+! FUNCTION: SetLogonNotifyWindow
+! FUNCTION: SetMenu
+! FUNCTION: SetMenuContextHelpId
+! FUNCTION: SetMenuDefaultItem
+! FUNCTION: SetMenuInfo
+! FUNCTION: SetMenuItemBitmaps
+! FUNCTION: SetMenuItemInfoA
+! FUNCTION: SetMenuItemInfoW
+! FUNCTION: SetMessageExtraInfo
+! FUNCTION: SetMessageQueue
+! FUNCTION: SetParent
+! FUNCTION: SetProcessDefaultLayout
+! FUNCTION: SetProcessWindowStation
+! FUNCTION: SetProgmanWindow
+! FUNCTION: SetPropA
+! FUNCTION: SetPropW
+! FUNCTION: SetRect
+! FUNCTION: SetRectEmpty
+! FUNCTION: SetScrollInfo
+! FUNCTION: SetScrollPos
+! FUNCTION: SetScrollRange
+! FUNCTION: SetShellWindow
+! FUNCTION: SetShellWindowEx
+! FUNCTION: SetSysColors
+! FUNCTION: SetSysColorsTemp
+! FUNCTION: SetSystemCursor
+! FUNCTION: SetSystemMenu
+! FUNCTION: SetSystemTimer
+! FUNCTION: SetTaskmanWindow
+! FUNCTION: SetThreadDesktop
+! FUNCTION: SetTimer
+! FUNCTION: SetUserObjectInformationA
+! FUNCTION: SetUserObjectInformationW
+! FUNCTION: SetUserObjectSecurity
+! FUNCTION: SetWindowContextHelpId
+! FUNCTION: SetWindowLongA
+! FUNCTION: SetWindowLongW
+! FUNCTION: SetWindowPlacement
+! FUNCTION: SetWindowPos
+! FUNCTION: SetWindowRgn
+! FUNCTION: SetWindowsHookA
+! FUNCTION: SetWindowsHookExA
+! FUNCTION: SetWindowsHookExW
+! FUNCTION: SetWindowsHookW
+! FUNCTION: SetWindowStationUser
+! FUNCTION: SetWindowTextA
+! FUNCTION: SetWindowTextW
+! FUNCTION: SetWindowWord
+! FUNCTION: SetWinEventHook
+! FUNCTION: ShowCaret
+! FUNCTION: ShowCursor
+! FUNCTION: ShowOwnedPopups
+! FUNCTION: ShowScrollBar
+! FUNCTION: ShowStartGlass
+
+FUNCTION: BOOL ShowWindow ( HWND hWnd, int nCmdShow ) ;
+
+! FUNCTION: ShowWindowAsync
+! FUNCTION: SoftModalMessageBox
+! FUNCTION: SubtractRect
+! FUNCTION: SwapMouseButton
+! FUNCTION: SwitchDesktop
+! FUNCTION: SwitchToThisWindow
+! FUNCTION: SystemParametersInfoA
+! FUNCTION: SystemParametersInfoW
+! FUNCTION: TabbedTextOutA
+! FUNCTION: TabbedTextOutW
+! FUNCTION: TileChildWindows
+! FUNCTION: TileWindows
+! FUNCTION: ToAscii
+! FUNCTION: ToAsciiEx
+! FUNCTION: ToUnicode
+! FUNCTION: ToUnicodeEx
+FUNCTION: BOOL TrackMouseEvent ( LPTRACKMOUSEEVENT lpEventTrack ) ;
+! FUNCTION: TrackPopupMenu
+! FUNCTION: TrackPopupMenuEx
+! FUNCTION: TranslateAccelerator
+! FUNCTION: TranslateAcceleratorA
+! FUNCTION: TranslateAcceleratorW
+! FUNCTION: TranslateMDISysAccel
+FUNCTION: BOOL TranslateMessage ( MSG* lpMsg ) ;
+
+! FUNCTION: UnhookWindowsHook
+! FUNCTION: UnhookWindowsHookEx
+! FUNCTION: UnhookWinEvent
+! FUNCTION: UnionRect
+! FUNCTION: UnloadKeyboardLayout
+! FUNCTION: UnlockWindowStation
+! FUNCTION: UnpackDDElParam
+FUNCTION: BOOL UnregisterClassW ( LPCWSTR lpClassName, HINSTANCE hInstance ) ;
+: UnregisterClass UnregisterClassW ;
+! FUNCTION: UnregisterDeviceNotification
+! FUNCTION: UnregisterHotKey
+! FUNCTION: UnregisterMessagePumpHook
+! FUNCTION: UnregisterUserApiHook
+! FUNCTION: UpdateLayeredWindow
+! FUNCTION: UpdatePerUserSystemParameters
+
+FUNCTION: BOOL UpdateWindow ( HWND hWnd ) ;
+
+! FUNCTION: User32InitializeImmEntryTable
+! FUNCTION: UserClientDllInitialize
+! FUNCTION: UserHandleGrantAccess
+! FUNCTION: UserLpkPSMTextOut
+! FUNCTION: UserLpkTabbedTextOut
+! FUNCTION: UserRealizePalette
+! FUNCTION: UserRegisterWowHandlers
+! FUNCTION: ValidateRect
+! FUNCTION: ValidateRgn
+! FUNCTION: VkKeyScanA
+! FUNCTION: VkKeyScanExA
+! FUNCTION: VkKeyScanExW
+! FUNCTION: VkKeyScanW
+! FUNCTION: VRipOutput
+! FUNCTION: VTagOutput
+! FUNCTION: WaitForInputIdle
+! FUNCTION: WaitMessage
+! FUNCTION: WCSToMBEx
+! FUNCTION: Win32PoolAllocationStats
+! FUNCTION: WindowFromDC
+! FUNCTION: WindowFromPoint
+! FUNCTION: WinHelpA
+! FUNCTION: WinHelpW
+! FUNCTION: WINNLSEnableIME
+! FUNCTION: WINNLSGetEnableStatus
+! FUNCTION: WINNLSGetIMEHotkey
+! FUNCTION: wsprintfA
+! FUNCTION: wsprintfW
+! FUNCTION: wvsprintfA
+! FUNCTION: wvsprintfW
+
+: msgbox ( str -- )
+    f swap "DebugMsg" MB_OK MessageBox drop ;
diff --git a/extra/windows/windows.factor b/extra/windows/windows.factor
new file mode 100644 (file)
index 0000000..ade1025
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2005, 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.syntax alien.c-types arrays combinators
+io io.nonblocking kernel math namespaces parser prettyprint
+sequences windows.errors windows.types windows.kernel32 words ;
+IN: windows
+
+: lo-word ( wparam -- lo ) <short> *short ; inline
+: hi-word ( wparam -- hi ) -16 shift lo-word ; inline
+
+! You must LocalFree the return value!
+FUNCTION: void* error_message ( DWORD id ) ;
+
+: (win32-error-string) ( n -- string )
+    error_message
+    dup alien>u16-string
+    swap LocalFree drop ;
+
+: win32-error-string ( -- str )
+    GetLastError (win32-error-string) ;
+
+: (win32-error) ( n -- )
+    dup zero? [
+        drop
+    ] [
+        win32-error-string throw
+    ] if ;
+
+: win32-error ( -- )
+    GetLastError (win32-error) ;
+
+: win32-error=0/f { 0 f } member? [ win32-error ] when ;
+: win32-error>0 0 > [ win32-error ] when ;
+: win32-error<0 0 < [ win32-error ] when ;
+: win32-error<>0 zero? [ win32-error ] unless ;
+
+: invalid-handle? ( handle -- )
+    INVALID_HANDLE_VALUE = [
+        win32-error-string throw
+    ] when ;
+
+: (expected-io-error?) ( error-code -- ? )
+    ERROR_SUCCESS
+    ERROR_IO_INCOMPLETE
+    ERROR_IO_PENDING
+    WAIT_TIMEOUT 4array member? ;
+
+: expected-io-error? ( error-code -- )
+    dup (expected-io-error?) [
+        drop
+    ] [
+        (win32-error-string) throw
+    ] if ;
+
+: io-error ( return-value -- )
+    { 0 f } member? [ GetLastError expected-io-error? ] when ;
+
+: overlapped-error? ( port n -- ? )
+    zero? [
+        GetLastError
+        {
+            { [ dup (expected-io-error?) ] [ 2drop t ] }
+            { [ dup ERROR_HANDLE_EOF = ] [ drop t swap set-port-eof? f ] }
+            { [ t ] [ (win32-error-string) throw ] }
+        } cond
+    ] [
+        drop t
+    ] if ;
diff --git a/extra/windows/winsock/winsock.factor b/extra/windows/winsock/winsock.factor
new file mode 100644 (file)
index 0000000..9a031ba
--- /dev/null
@@ -0,0 +1,435 @@
+! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
+
+USING: alien alien.c-types alien.syntax arrays byte-arrays kernel
+math sequences windows.types windows.kernel32 windows.errors structs
+windows ;
+IN: windows.winsock
+
+USE: libc
+: alien>byte-array ( alien str -- byte-array )
+    heap-size dup <byte-array> [ -rot memcpy ] keep ;
+
+TYPEDEF: void* SOCKET
+
+: <wsadata> ( -- byte-array )
+    HEX: 190 <byte-array> ;
+
+: SOCK_STREAM    1 ; inline
+: SOCK_DGRAM     2 ; inline
+: SOCK_RAW       3 ; inline
+: SOCK_RDM       4 ; inline
+: SOCK_SEQPACKET 5 ; inline
+
+: SO_DEBUG       HEX:   1 ; inline
+: SO_ACCEPTCONN  HEX:   2 ; inline
+: SO_REUSEADDR   HEX:   4 ; inline
+: SO_KEEPALIVE   HEX:   8 ; inline
+: SO_DONTROUTE   HEX:  10 ; inline
+: SO_BROADCAST   HEX:  20 ; inline
+: SO_USELOOPBACK HEX:  40 ; inline
+: SO_LINGER      HEX:  80 ; inline
+: SO_OOBINLINE   HEX: 100 ; inline
+: SO_DONTLINGER SO_LINGER bitnot ; inline
+
+: SO_SNDBUF     HEX: 1001 ; inline
+: SO_RCVBUF     HEX: 1002 ; inline
+: SO_SNDLOWAT   HEX: 1003 ; inline
+: SO_RCVLOWAT   HEX: 1004 ; inline
+: SO_SNDTIMEO   HEX: 1005 ; inline
+: SO_RCVTIMEO   HEX: 1006 ; inline
+: SO_ERROR      HEX: 1007 ; inline
+: SO_TYPE       HEX: 1008 ; inline
+
+: TCP_NODELAY   HEX:    1 ; inline
+
+: AF_UNSPEC      0 ; inline
+: AF_UNIX        1 ; inline
+: AF_INET        2 ; inline
+: AF_IMPLINK     3 ; inline
+: AF_PUP         4 ; inline
+: AF_CHAOS       5 ; inline
+: AF_NS          6 ; inline
+: AF_ISO         7 ; inline
+: AF_OSI    AF_ISO ; inline
+: AF_ECMA        8 ; inline
+: AF_DATAKIT     9 ; inline
+: AF_CCITT      10 ; inline
+: AF_SNA        11 ; inline
+: AF_DECnet     12 ; inline
+: AF_DLI        13 ; inline
+: AF_LAT        14 ; inline
+: AF_HYLINK     15 ; inline
+: AF_APPLETALK  16 ; inline
+: AF_NETBIOS    17 ; inline
+: AF_MAX        18 ; inline
+: AF_INET6      23 ; inline
+: AF_IRDA       26 ; inline
+: AF_BTM        32 ; inline
+
+: PF_UNSPEC      0 ; inline
+: PF_LOCAL       1 ; inline
+: PF_INET        2 ; inline
+: PF_INET6      23 ; inline
+
+: AI_PASSIVE     1 ; inline
+: AI_CANONNAME   2 ; inline
+: AI_NUMERICHOST 4 ; inline
+: AI_MASK AI_PASSIVE AI_CANONNAME bitor AI_NUMERICHOST bitor ;
+
+: NI_NUMERICHOST 1 ;
+: NI_NUMERICSERV 2 ;
+
+: IPPROTO_TCP    6 ; inline
+: IPPROTO_UDP   17 ; inline
+: IPPROTO_RM   113 ; inline
+
+: WSA_FLAG_OVERLAPPED 1 ; inline
+: WSA_WAIT_EVENT_0 WAIT_OBJECT_0 ; inline
+: WSA_MAXIMUM_WAIT_EVENTS MAXIMUM_WAIT_OBJECTS ; inline
+: WSA_INVALID_EVENT f ; inline
+: WSA_WAIT_FAILED -1 ; inline
+: WSA_WAIT_IO_COMPLETION WAIT_IO_COMPLETION ; inline
+: WSA_WAIT_TIMEOUT WAIT_TIMEOUT ; inline
+: WSA_INFINITE INFINITE ; inline
+: WSA_IO_PENDING ERROR_IO_PENDING ; inline
+
+: INADDR_ANY 0 ; inline
+
+: INVALID_SOCKET -1 <alien> ; inline
+: SOCKET_ERROR -1 ; inline
+
+: SD_RECV 0 ; inline
+: SD_SEND 1 ; inline
+: SD_BOTH 2 ; inline
+
+: SOL_SOCKET HEX: ffff ; inline
+
+! TYPEDEF: uint in_addr_t
+! C-STRUCT: in_addr
+    ! { "in_addr_t" "s_addr" } ;
+
+C-STRUCT: sockaddr-in
+    { "short" "family" }
+    { "ushort" "port" }
+    { "uint" "addr" }
+    { { "char" 8 } "pad" } ;
+
+C-STRUCT: sockaddr-in6
+    { "uchar" "family" }
+    { "ushort" "port" }
+    { "uint" "flowinfo" }
+    { { "uchar" 16 } "addr" }
+    { "uint" "scopeid" } ;
+
+C-STRUCT: hostent
+    { "char*" "name" }
+    { "void*" "aliases" }
+    { "short" "addrtype" }
+    { "short" "length" }
+    { "void*" "addr-list" } ;
+
+C-STRUCT: addrinfo
+    { "int" "flags" }
+    { "int" "family" }
+    { "int" "socktype" }
+    { "int" "protocol" }
+    { "size_t" "addrlen" }
+    { "char*" "canonname" }
+    { "sockaddr*" "addr" }
+    { "addrinfo*" "next" } ;
+
+: hostent-addr hostent-addr-list *void* ; ! *uint ;
+
+LIBRARY: winsock
+
+
+FUNCTION: int setsockopt ( SOCKET s, int level, int optname, char* optval, int optlen ) ;
+
+FUNCTION: ushort htons ( ushort n ) ;
+FUNCTION: ushort ntohs ( ushort n ) ;
+<PRIVATE
+FUNCTION: int bind ( void* socket, sockaddr_in* sockaddr, int len ) ;
+FUNCTION: int listen ( void* socket, int backlog ) ;
+FUNCTION: char* inet_ntoa ( int in-addr ) ;
+PRIVATE>
+FUNCTION: int getaddrinfo ( char* nodename,
+                            char* servername,
+                            addrinfo* hints,
+                            addrinfo** res ) ;
+
+FUNCTION: void freeaddrinfo ( addrinfo* ai ) ;
+
+
+FUNCTION: hostent* gethostbyname ( char* name ) ;
+FUNCTION: int gethostname ( char* 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 ) ;
+
+
+TYPEDEF: uint SERVICETYPE
+TYPEDEF: OVERLAPPED WSAOVERLAPPED
+TYPEDEF: WSAOVERLAPPED* LPWSAOVERLAPPED
+TYPEDEF: uint GROUP
+TYPEDEF: void* LPCONDITIONPROC
+TYPEDEF: HANDLE WSAEVENT
+TYPEDEF: LPHANDLE LPWSAEVENT
+TYPEDEF: sockaddr* LPSOCKADDR
+
+C-STRUCT: FLOWSPEC
+    { "uint"        "TokenRate" }
+    { "uint"        "TokenBucketSize" }
+    { "uint"        "PeakBandwidth" }
+    { "uint"        "Latency" }
+    { "uint"        "DelayVariation" }
+    { "SERVICETYPE" "ServiceType" }
+    { "uint"        "MaxSduSize" }
+    { "uint"        "MinimumPolicedSize" } ;
+TYPEDEF: FLOWSPEC* PFLOWSPEC
+TYPEDEF: FLOWSPEC* LPFLOWSPEC
+
+C-STRUCT: WSABUF
+    { "ulong" "len" }
+    { "void*" "buf" } ;
+TYPEDEF: WSABUF* LPWSABUF
+
+C-STRUCT: QOS
+    { "FLOWSPEC" "SendingFlowspec" }
+    { "FLOWSPEC" "ReceivingFlowspec" }
+    { "WSABUF" "ProviderSpecific" } ;
+TYPEDEF: QOS* LPQOS
+
+: MAX_PROTOCOL_CHAIN 7 ; inline
+
+C-STRUCT: WSAPROTOCOLCHAIN
+    { "int" "ChainLen" }
+    ! { { "DWORD" MAX_PROTOCOL_CHAIN } "ChainEntries" } ;
+    { { "DWORD" 7 } "ChainEntries" } ;
+TYPEDEF: WSAPROTOCOLCHAIN* LPWSAPROTOCOLCHAIN
+
+: WSAPROTOCOL_LEN 255 ; inline
+
+C-STRUCT: WSAPROTOCOL_INFOW
+    { "DWORD" "dwServiceFlags1" }
+    { "DWORD" "dwServiceFlags2" }
+    { "DWORD" "dwServiceFlags3" }
+    { "DWORD" "dwServiceFlags4" }
+    { "DWORD" "dwProviderFlags" }
+    { "GUID" "ProviderId" }
+    { "DWORD" "dwCatalogEntryId" }
+    { "WSAPROTOCOLCHAIN" "ProtocolChain" }
+    { "int" "iVersion" }
+    { "int" "iAddressFamily" }
+    { "int" "iMaxSockAddr" }
+    { "int" "iMinSockAddr" }
+    { "int" "iSocketType" }
+    { "int" "iProtocol" }
+    { "int" "iProtocolMaxOffset" }
+    { "int" "iNetworkByteOrder" }
+    { "int" "iSecurityScheme" }
+    { "DWORD" "dwMessageSize" }
+    { "DWORD" "dwProviderReserved" }
+    { { "WCHAR" 256 } "szProtocol" } ;
+    ! { { "WCHAR" 256 } "szProtocol"[WSAPROTOCOL_LEN+1] } ;
+TYPEDEF: WSAPROTOCOL_INFOW* PWSAPROTOCOL_INFOW
+TYPEDEF: WSAPROTOCOL_INFOW* LPWSAPROTOCOL_INFOW
+TYPEDEF: WSAPROTOCOL_INFOW WSAPROTOCOL_INFO
+TYPEDEF: WSAPROTOCOL_INFOW* PWSAPROTOCOL_INFO
+TYPEDEF: WSAPROTOCOL_INFOW* LPWSAPROTOCOL_INFO
+
+
+C-STRUCT: WSANAMESPACE_INFOW
+    { "GUID"    "NSProviderId" }
+    { "DWORD"   "dwNameSpace" }
+    { "BOOL"    "fActive" }
+    { "DWORD"   "dwVersion" }
+    { "LPWSTR"  "lpszIdentifier" } ;
+TYPEDEF: WSANAMESPACE_INFOW* PWSANAMESPACE_INFOW
+TYPEDEF: WSANAMESPACE_INFOW* LPWSANAMESPACE_INFOW
+TYPEDEF: WSANAMESPACE_INFOW WSANAMESPACE_INFO
+TYPEDEF: WSANAMESPACE_INFO* PWSANAMESPACE_INFO
+TYPEDEF: WSANAMESPACE_INFO* LPWSANAMESPACE_INFO
+
+: FD_MAX_EVENTS 10 ;
+
+C-STRUCT: WSANETWORKEVENTS
+    { "long" "lNetworkEvents" }
+    ! { { "int" "FD_MAX_EVENTS" } "iErrorCode" } ;
+    { { "int" 10 } "iErrorCode" } ;
+TYPEDEF: WSANETWORKEVENTS* PWSANETWORKEVENTS
+TYPEDEF: WSANETWORKEVENTS* LPWSANETWORKEVENTS
+
+! C-STRUCT: WSAOVERLAPPED
+    ! { "DWORD" "Internal" }
+    ! { "DWORD" "InternalHigh" }
+    ! { "DWORD" "Offset" }
+    ! { "DWORD" "OffsetHigh" }
+    ! { "WSAEVENT" "hEvent" }
+    ! { "DWORD" "bytesTransferred" } ;
+! TYPEDEF: WSAOVERLAPPED* LPWSAOVERLAPPED
+
+FUNCTION: SOCKET WSAAccept ( SOCKET s,
+                             sockaddr* addr,
+                             LPINT addrlen,
+                             LPCONDITIONPROC lpfnCondition,
+                             DWORD dwCallbackData ) ;
+
+! FUNCTION: INT WSAAddressToString ( LPSOCKADDR lpsaAddress, DWORD dwAddressLength, LPWSAPROTOCOL_INFO lpProtocolInfo, LPTSTR lpszAddressString, LPDWORD lpdwAddressStringLength ) ;
+
+FUNCTION: int WSACleanup ( ) ;
+FUNCTION: BOOL WSACloseEvent ( WSAEVENT hEvent ) ;
+
+FUNCTION: int WSAConnect ( SOCKET s,
+                           sockaddr* name,
+                           int namelen,
+                           LPWSABUF lpCallerData,
+                           LPWSABUF lpCalleeData,
+                           LPQOS lpSQOS,
+                           LPQOS lpGQOS ) ;
+FUNCTION: WSAEVENT WSACreateEvent ( ) ;
+! FUNCTION: INT WSAEnumNameSpaceProviders ( LPDWORD lpdwBufferLength, LPWSANAMESPACE_INFO lpnspBuffer ) ;
+FUNCTION: int WSAEnumNetworkEvents ( SOCKET s,
+                                     WSAEVENT hEventObject,
+                                     LPWSANETWORKEVENTS lpNetworkEvents ) ;
+! FUNCTION: int WSAEnumProtocols ( LPINT lpiProtocols, LPWSAPROTOCOL_INFO lpProtocolBuffer, LPDWORD lpwdBufferLength ) ;
+
+FUNCTION: int WSAEventSelect ( SOCKET s,
+                               WSAEVENT hEventObject,
+                               long lNetworkEvents ) ;
+FUNCTION: int WSAGetLastError ( ) ;
+FUNCTION: BOOL WSAGetOverlappedResult ( SOCKET s,
+                                        LPWSAOVERLAPPED lpOverlapped,
+                                        LPDWORD lpcbTransfer,
+                                        BOOL fWait,
+                                        LPDWORD lpdwFlags ) ;
+
+FUNCTION: int WSAIoctl ( SOCKET s,
+                         DWORD dwIoControlCode,
+                         LPVOID lpvInBuffer,
+                         DWORD cbInBuffer,
+                         LPVOID lpvOutBuffer,
+                         DWORD cbOutBuffer,
+                         LPDWORD lpcbBytesReturned,
+                         void* lpOverlapped,
+                         void* lpCompletionRoutine ) ;
+
+TYPEDEF: void* LPWSAOVERLAPPED_COMPLETION_ROUTINE
+FUNCTION: int WSARecv ( SOCKET s,
+                        LPWSABUF lpBuffers,
+                        DWORD dwBufferCount,
+                        LPDWORD lpNumberOfBytesRecvd,
+                        LPDWORD lpFlags,
+                        LPWSAOVERLAPPED lpOverlapped,
+                    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) ;
+
+FUNCTION: int WSARecvFrom ( SOCKET s,
+                    LPWSABUF lpBuffers,
+                    DWORD dwBufferCount,
+                    LPDWORD lpNumberOfBytesRecvd,
+                    LPDWORD lpFlags,
+                    sockaddr* lpFrom,
+                    LPINT lpFromlen,
+                    LPWSAOVERLAPPED lpOverlapped,
+                    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) ;
+
+FUNCTION: BOOL WSAResetEvent ( WSAEVENT hEvent ) ;
+FUNCTION: int WSASend ( SOCKET s,
+                        LPWSABUF lpBuffers,
+                        DWORD dwBufferCount,
+                        LPDWORD lpNumberOfBytesSent,
+                        LPDWORD lpFlags,
+                        LPWSAOVERLAPPED lpOverlapped,
+                 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) ;
+
+FUNCTION: int WSASendTo ( SOCKET s,
+                          LPWSABUF lpBuffers,
+                          DWORD dwBufferCount,
+                          LPDWORD lpNumberOfBytesSent,
+                          DWORD dwFlags,
+                          sockaddr* lpTo,
+                          int iToLen,
+                          LPWSAOVERLAPPED lpOverlapped,
+  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) ;
+
+
+FUNCTION: int WSAStartup ( short version, void* out-data ) ;
+
+
+
+FUNCTION: SOCKET WSASocketW ( int af,
+                             int type,
+                             int protocol,
+                             LPWSAPROTOCOL_INFOW lpProtocolInfo,
+                             GROUP g,
+                             DWORD flags ) ;
+: WSASocket WSASocketW ;
+
+FUNCTION: DWORD WSAWaitForMultipleEvents ( DWORD cEvents,
+                                           WSAEVENT* lphEvents,
+                                           BOOL fWaitAll,
+                                           DWORD dwTimeout,
+                                           BOOL fAlertable ) ;
+
+
+
+
+LIBRARY: mswsock
+
+! Not in Windows CE
+FUNCTION: int AcceptEx ( void* listen, void* accept, void* out-buf, int recv-len, int addr-len, int remote-len, void* out-len, void* overlapped ) ;
+FUNCTION: void GetAcceptExSockaddrs ( void* a, int b, int c, int d, void* e, void* f, void* g, void* h ) ;
+
+: SIO_GET_EXTENSION_FUNCTION_POINTER -939524090 ; inline
+
+: WSAID_CONNECTEX
+    "GUID" <c-object>
+    HEX: 25a207b9 over set-GUID-Data1
+    HEX: ddf3 over set-GUID-Data2
+    HEX: 4660 over set-GUID-Data3
+    B{
+        HEX: 8e HEX: e9 HEX: 76 HEX: e5
+        HEX: 8c HEX: 74 HEX: 06 HEX: 3e
+    } over set-GUID-Data4 ;
+
+: winsock-expected-error? ( n -- ? )
+    ERROR_IO_PENDING ERROR_SUCCESS WSA_IO_PENDING 3array member? ;
+
+: (winsock-error-string) ( n -- str )
+    ! #! WSAStartup returns the error code 'n' directly
+    dup winsock-expected-error?
+    [ drop f ] [ error_message alien>u16-string ] if ;
+
+: winsock-error-string ( -- string/f )
+    WSAGetLastError (winsock-error-string) ;
+
+: winsock-error=0/f ( n/f -- )
+    { 0 f } member? [
+        winsock-error-string throw
+    ] when ;
+
+: winsock-error!=0/f ( n/f -- )
+    dup { 0 f } member? [
+        drop
+    ] [
+        (winsock-error-string) throw
+    ] if ;
+
+: socket-error* ( n -- )
+    SOCKET_ERROR = [
+        WSAGetLastError
+        dup WSA_IO_PENDING = [
+            drop
+        ] [
+            (winsock-error-string) throw
+        ] if
+    ] when ;
+
+: socket-error ( n -- )
+    SOCKET_ERROR = [ winsock-error-string throw ] when ;
+
+: init-winsock ( -- )
+    HEX: 0202 <wsadata> WSAStartup winsock-error!=0/f ;
+
diff --git a/extra/x/authors.txt b/extra/x/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/x/font/font.factor b/extra/x/font/font.factor
new file mode 100644 (file)
index 0000000..77743fa
--- /dev/null
@@ -0,0 +1,27 @@
+
+USING: kernel namespaces arrays sequences math x11.xlib 
+       mortar slot-accessors x ;
+
+IN: x.font
+
+SYMBOL: <font>
+
+<font> { "dpy" "name" "id" "struct" } accessors define-independent-class
+
+<font> "create" !( name <font> -- font ) [
+new-empty swap >>name dpy get >>dpy
+dpy get $ptr   over $name   XLoadQueryFont >>struct
+dup $struct XFontStruct-fid >>id
+] add-class-method
+
+<font> {
+
+"ascent" !( font -- ascent ) [ $struct XFontStruct-ascent ]
+
+"descent" !( font -- ascent ) [ $struct XFontStruct-descent ]
+
+"height" !( font -- ascent ) [ dup <- ascent swap <- descent + ]
+
+"text-width" !( font string -- width ) [ >r $struct r> dup length XTextWidth ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/gc/gc.factor b/extra/x/gc/gc.factor
new file mode 100644 (file)
index 0000000..77e5313
--- /dev/null
@@ -0,0 +1,27 @@
+
+USING: kernel namespaces arrays x11.xlib mortar slot-accessors x x.font ;
+
+IN: x.gc
+
+SYMBOL: <gc>
+
+<gc> { "dpy" "ptr" "font" } accessors define-independent-class
+
+<gc> "create" !( <gc> -- gc ) [
+new-empty dpy get >>dpy
+dpy get $ptr  dpy get $default-root $id  0 f XCreateGC >>ptr
+"6x13" <font> new* >>font
+] add-class-method
+
+<gc> {
+
+"set-subwindow-mode" !( gc mode -- gc )
+  [ >r dup $dpy $ptr over $ptr r> XSetSubwindowMode drop ]
+
+"set-function" !( gc function -- gc )
+  [ >r dup $dpy $ptr over $ptr r> XSetFunction drop ]
+
+"set-foreground" !( gc foreground -- gc )
+  [ >r dup $dpy $ptr over $ptr r> lookup-color XSetForeground drop ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/keysym-table/keysym-table.factor b/extra/x/keysym-table/keysym-table.factor
new file mode 100644 (file)
index 0000000..55d2ab4
--- /dev/null
@@ -0,0 +1,45 @@
+USING: kernel strings assocs sequences math ;
+
+IN: x.keysym-table
+
+: keysym-table ( -- table )
+H{ { HEX: FF08 "BACKSPACE"     }
+   { HEX: FF09 "TAB"           }
+   { HEX: FF0D "RETURN"        }
+   { HEX: FF8D "ENTER"         }
+   { HEX: FF1B "ESCAPE"        }
+   { HEX: FFFF "DELETE"        }
+   { HEX: FF50 "HOME"          }
+   { HEX: FF51 "LEFT"          }
+   { HEX: FF52 "UP"            }
+   { HEX: FF53 "RIGHT"         }
+   { HEX: FF54 "DOWN"          }
+   { HEX: FF55 "PAGE-UP"       }
+   { HEX: FF56 "PAGE-DOWN"     }
+   { HEX: FF57 "END"           }
+   { HEX: FF58 "BEGIN"         }
+   { HEX: FFBE "F1"            }
+   { HEX: FFBF "F2"            }
+   { HEX: FFC0 "F3"            }
+   { HEX: FFC1 "F4"            }
+   { HEX: FFC2 "F5"            }
+   { HEX: FFC3 "F6"            }
+   { HEX: FFC4 "F7"            }
+   { HEX: FFC5 "F8"            }
+   { HEX: FFC6 "F9"            }
+   { HEX: FFC7 "F10"           }
+   { HEX: FFC8 "F11"           }
+   { HEX: FFC9 "F12"           }
+   { HEX: FFE1 "LEFT-SHIFT"    }
+   { HEX: FFE2 "RIGHT-SHIFT"   }
+   { HEX: FFE3 "LEFT-CONTROL"  }
+   { HEX: FFE4 "RIGHT-CONTROL" }
+   { HEX: FFE5 "CAPSLOCK"      }
+   { HEX: FFE9 "LEFT-ALT"      }
+   { HEX: FFEA "RIGHT-ALT"     }
+} ;
+
+: keysym>name ( keysym -- name )
+dup keysym-table at dup [ nip ] [ drop 1string ] if ;
+
+: name>keysym ( name -- keysym ) keysym-table value-at ;
diff --git a/extra/x/pen/pen.factor b/extra/x/pen/pen.factor
new file mode 100644 (file)
index 0000000..c4fc6cf
--- /dev/null
@@ -0,0 +1,26 @@
+
+USING: kernel arrays math.vectors mortar x.gc slot-accessors geom.pos ;
+
+IN: x.pen
+
+SYMBOL: <pen>
+
+<pen> <pos> { "window" "gc" } accessors define-simple-class
+
+<pen> "create" !( window <pen> -- pen )
+[ new-empty swap >>window <gc> new* >>gc 0 0 2array >>pos ]
+add-class-method
+
+<pen> {
+
+"line-to" ! ( pen point -- pen )
+  [ 2dup >r dup $window swap dup $gc swap $pos r> <---- draw-line >>pos ]
+
+"line-by" ! ( pen offset -- pen )
+  [ 2dup >r dup $window swap dup $gc swap $pos dup r> v+ <---- draw-line
+    <-- move-by ]
+
+"draw-string" ! ( pen string -- pen )
+  [ >r dup dup $window swap dup $gc swap $pos r> <---- draw-string ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/widgets/button/button.factor b/extra/x/widgets/button/button.factor
new file mode 100644 (file)
index 0000000..b26431c
--- /dev/null
@@ -0,0 +1,24 @@
+
+USING: kernel combinators math x11.xlib
+       mortar slot-accessors x.gc x.widgets.label ;
+
+IN: x.widgets.button
+
+SYMBOL: <button>
+
+<button>
+  <label>
+  { "action-1" "action-2" "action-3" } accessors
+define-simple-class
+
+<button> "create" ( <button> -- button ) [
+new-empty
+<gc> new* >>gc ExposureMask ButtonPressMask bitor >>mask <- init-widget
+] add-class-method
+
+<button> "handle-button-press" !( event button -- ) [
+{ { [ over XButtonEvent-button Button1 = ] [ nip $action-1 call ] }
+  { [ over XButtonEvent-button Button2 = ] [ nip $action-2 call ] }
+  { [ over XButtonEvent-button Button3 = ] [ nip $action-3 call ] } }
+cond
+] add-method
\ No newline at end of file
diff --git a/extra/x/widgets/keymenu/keymenu.factor b/extra/x/widgets/keymenu/keymenu.factor
new file mode 100644 (file)
index 0000000..6c2fbb1
--- /dev/null
@@ -0,0 +1,65 @@
+
+USING: kernel strings arrays sequences sequences.lib math x11.xlib
+       mortar slot-accessors x x.pen x.widgets ;
+
+IN: x.widgets.keymenu
+
+SYMBOL: <keymenu>
+
+<keymenu> <widget> { "items" "pen" } accessors define-simple-class
+
+<keymenu> "create" !( <keymenu> -- keymenu )
+  [ new-empty <- keymenu-init ]
+add-class-method
+
+: numbers-and-letters ( -- seq )
+"1234567890abcdefghijklmnopqrstuvwxyz" [ 1string ] { } map-as ;
+
+<keymenu> {
+
+"keymenu-init" !( keymenu -- keymenu ) [
+  dup <pen> new* >>pen
+  ExposureMask KeyPressMask bitor >>mask
+  <- init-widget
+]
+
+"item-labels" !( keymenu -- labels ) [ $items [ first ] map ]
+
+"item-actions" !( keymenu -- actions ) [ $items [ second ] map ]
+
+"keymenu-labels" !( keymenu -- seq )
+[ numbers-and-letters swap <- item-labels [ " - " swap 3append ] 2map ]
+
+"reset-pen" !( keymenu -- keymenu ) [
+  dup $pen
+    1 <-- set-x
+    dup $gc $font <- ascent 1+ <-- set-y
+  drop ]
+
+"handle-expose" !( event keymenu -- ) [
+  nip
+  <- reset-pen
+  dup $pen swap <- keymenu-labels
+  [ <-- draw-string dup $gc $font <- height <-- move-by-y ] each drop ]
+
+"keymenu-handle-key-press" !( event keymenu -- ) [
+  swap 0 key-event-to-string numbers-and-letters index
+  [ swap <- item-actions ?nth [ call ] when* ]
+  [ drop ]
+  if* ]
+
+"handle-key-press" !( event keymenu -- ) [ <- keymenu-handle-key-press ]
+
+"calc-height" !( keymenu -- height )
+  [ dup $items length swap $pen $gc $font <- height * ]
+
+"calc-width" !( keymenu -- width )
+  [ dup $pen $gc $font
+    swap $items [ first "    " append ] map
+    dup empty? [ drop "" ] [ longest ] if
+    <-- text-width ]
+
+"calc-size" !( keymenu -- size )
+  [ dup <- calc-width swap <- calc-height 2array ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/widgets/label/label.factor b/extra/x/widgets/label/label.factor
new file mode 100644 (file)
index 0000000..11201ae
--- /dev/null
@@ -0,0 +1,16 @@
+
+USING: kernel x11.xlib mortar slot-accessors x.gc x.widgets ;
+
+IN: x.widgets.label
+
+SYMBOL: <label>
+
+<label> <widget> { "gc" "text" } accessors define-simple-class
+
+<label> "create" !( text <label> -- label ) [
+new-empty swap >>text <gc> new* >>gc ExposureMask >>mask <- init-widget
+] add-class-method
+
+<label> "handle-expose" !( event label -- ) [
+  nip <- clear dup $gc { 20 20 } pick $text <---- draw-string
+] add-method
diff --git a/extra/x/widgets/widgets.factor b/extra/x/widgets/widgets.factor
new file mode 100644 (file)
index 0000000..34540c4
--- /dev/null
@@ -0,0 +1,38 @@
+
+USING: kernel io namespaces arrays sequences combinators math x11.xlib
+       mortar slot-accessors x ;
+
+IN: x.widgets
+
+SYMBOL: <widget>
+
+<widget> <window> { "mask" } accessors define-simple-class
+
+<widget> {
+
+"init-widget" !( widget -- widget )
+  [ <- init-window <- add-to-window-table dup $mask <-- select-input ]
+
+"add-to-window-table" !( window -- window )
+  [ dup $dpy over <-- add-to-window-table ]
+
+"remove-from-window-table" !( window -- window )
+  [ dup $dpy over <-- remove-from-window-table ]
+
+"handle-event" !( event widget -- ) [ 
+  over XAnyEvent-type
+  { { [ dup Expose = ]           [ drop <- handle-expose ] }
+    { [ dup KeyPress = ]         [ drop <- handle-key-press ] }
+    { [ dup ButtonPress = ]      [ drop <- handle-button-press ] }
+    { [ dup EnterNotify = ]      [ drop <- handle-enter-window ] }
+    { [ dup DestroyNotify = ]    [ drop <- handle-destroy-window ] }
+    { [ dup MapRequest = ]       [ drop <- handle-map-request ] }
+    { [ dup MapNotify = ]        [ drop <- handle-map ] }
+    { [ dup ConfigureRequest = ] [ drop <- handle-configure-request ] }
+    { [ dup UnmapNotify = ]      [ drop <- handle-unmap ] }
+    { [ dup PropertyNotify = ]   [ drop <- handle-property ] }
+    { [ t ]                      [ "handle-event :: ignoring event"
+                                    print flush 3drop ] }
+  } cond ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/widgets/wm/child/child.factor b/extra/x/widgets/wm/child/child.factor
new file mode 100644 (file)
index 0000000..c0c6f9d
--- /dev/null
@@ -0,0 +1,23 @@
+
+USING: kernel io namespaces arrays sequences
+       x11.xlib mortar slot-accessors x x.widgets ;
+
+IN: x.widgets.wm.child
+
+SYMBOL: <wm-child>
+
+<wm-child> <widget> { } define-simple-class
+
+<wm-child> "create" !( id <wm-child> -- wm-child ) [ 
+  new-empty swap >>id dpy get >>dpy PropertyChangeMask >>mask
+  <- add-to-save-set
+  0 <-- set-border-width
+  <- add-to-window-table
+  dup $mask <-- select-input
+] add-class-method
+
+<wm-child> "handle-property" !( event wm-child -- ) [
+  drop
+  "child handle-property :: atom name = " write
+  XPropertyEvent-atom get-atom-name print flush
+] add-method
\ No newline at end of file
diff --git a/extra/x/widgets/wm/frame/drag/drag.factor b/extra/x/widgets/wm/frame/drag/drag.factor
new file mode 100644 (file)
index 0000000..0c6cabf
--- /dev/null
@@ -0,0 +1,24 @@
+
+USING: kernel namespaces arrays sequences combinators math.vectors
+       x11.xlib x11.constants
+       mortar slot-accessors x x.gc geom.rect ;
+
+IN: x.widgets.wm.frame.drag
+
+SYMBOL: <wm-frame-drag>
+
+<wm-frame-drag>
+  { "dpy" "gc" "frame" "event" "push" "posn" } accessors
+define-independent-class
+
+<wm-frame-drag> {
+
+"next-event" !( wfdm -- wfdm ) [ dup $dpy over $event <-- next-event 2drop ]
+
+"event-type" !( wfdm -- wfdm event-type ) [ dup $event XAnyEvent-type ]
+
+"drag-offset" !( wfdm -- offset ) [ dup $posn swap $push v- ]
+
+"update-posn" !( wfd -- wfd ) [ dup $event XMotionEvent-root-position >>posn ]
+
+} add-methods
diff --git a/extra/x/widgets/wm/frame/drag/move/move.factor b/extra/x/widgets/wm/frame/drag/move/move.factor
new file mode 100644 (file)
index 0000000..2ebb5a7
--- /dev/null
@@ -0,0 +1,46 @@
+
+USING: kernel combinators namespaces math.vectors x11.xlib x11.constants 
+       mortar slot-accessors x x.gc x.widgets.wm.frame.drag ;
+
+IN: x.widgets.wm.frame.drag.move
+
+SYMBOL: <wm-frame-drag-move>
+
+<wm-frame-drag-move> <wm-frame-drag> { } define-simple-class
+
+<wm-frame-drag-move> "create" !( event frame <wm-frame-drag-move> -- ) [
+  new-empty swap >>frame swap >>event dup $frame $dpy >>dpy
+
+  <gc> new*
+    IncludeInferiors <-- set-subwindow-mode
+    GXxor            <-- set-function
+    "white"          <-- set-foreground
+  >>gc
+
+  dup $event XButtonEvent-root-position >>push
+  dup $event XButtonEvent-root-position >>posn
+  <- draw-move-outline
+  <- loop
+] add-class-method
+
+<wm-frame-drag-move> {
+
+"move-outline" !( wfdm -- rect )
+  [ dup $frame <- as-rect swap <- drag-offset <-- move-by ]
+
+"draw-move-outline" !( wfdm -- wfdm )
+  [ dpy get $default-root over $gc pick <- move-outline <--- draw-rect ]
+
+"loop" !( wfdm -- wfdm ) [ 
+  <- next-event
+  { { [ <- event-type MotionNotify = ]
+      [ <- draw-move-outline <- update-posn <- draw-move-outline <- loop ] }
+    { [ <- event-type ButtonRelease = ]
+      [ <- draw-move-outline
+       dup $frame <- position over <- drag-offset v+ >r
+       dup $frame r> <-- move drop
+       dup $frame <- raise drop drop ] }
+    { [ t ] [ <- loop ] } }
+  cond ]
+
+} add-methods
diff --git a/extra/x/widgets/wm/frame/drag/size/size.factor b/extra/x/widgets/wm/frame/drag/size/size.factor
new file mode 100644 (file)
index 0000000..e98d752
--- /dev/null
@@ -0,0 +1,45 @@
+
+USING: kernel combinators namespaces math.vectors x11.xlib x11.constants 
+       mortar slot-accessors geom.rect x x.gc x.widgets.wm.frame.drag ;
+
+IN: x.widgets.wm.frame.drag.size
+
+SYMBOL: <wm-frame-drag-size>
+
+<wm-frame-drag-size> <wm-frame-drag> { } define-simple-class
+
+<wm-frame-drag-size> "create" !( event frame <wfds> -- ) [ 
+  new-empty swap >>frame swap >>event
+  dup $frame $dpy >>dpy
+
+  <gc> new*
+    IncludeInferiors <-- set-subwindow-mode
+    GXxor <-- set-function
+    "white" <-- set-foreground
+  >>gc
+
+  dup $event XButtonEvent-root-position >>push
+  dup $event XButtonEvent-root-position >>posn
+  <- draw-size-outline <- loop
+] add-class-method
+
+<wm-frame-drag-size> {
+
+"size-outline" !( wfds -- rect )
+  [ dup $frame <- position swap $posn over v- <rect> new ]
+
+"draw-size-outline" !( wfdm -- wfdm )
+  [ dup $dpy $default-root over $gc pick <- size-outline <--- draw-rect ]
+
+"loop" !( wfdm -- ) [
+  <- next-event
+  { { [ <- event-type MotionNotify = ]
+      [ <- draw-size-outline <- update-posn <- draw-size-outline <- loop ] }
+    { [ <- event-type ButtonRelease = ]
+      [ <- draw-size-outline
+       dup $frame over $posn pick $frame <- position v- <-- resize
+       <- adjust-child drop ] }
+    { [ t ] [ <- loop ] } }
+  cond ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/widgets/wm/frame/frame.factor b/extra/x/widgets/wm/frame/frame.factor
new file mode 100644 (file)
index 0000000..0c0075e
--- /dev/null
@@ -0,0 +1,176 @@
+
+USING: kernel io combinators namespaces quotations arrays sequences
+       math math.vectors
+       x11.xlib x11.constants
+       mortar slot-accessors
+       geom.rect
+       x x.gc x.widgets
+       x.widgets.button
+       x.widgets.wm.child
+       x.widgets.wm.frame.drag.move
+       x.widgets.wm.frame.drag.size ;
+
+IN: x.widgets.wm.frame
+
+SYMBOL: <wm-frame>
+
+<wm-frame> <widget> { "child" "gc" "last-state" } accessors define-simple-class
+
+<wm-frame> "create" !( id <wm-frame> -- wm-frame ) [
+  new-empty
+  swap <wm-child> new* >>child
+  <gc> new* "white" <-- set-foreground >>gc
+
+  SubstructureRedirectMask
+  ExposureMask bitor
+  ButtonPressMask bitor
+  ButtonReleaseMask bitor
+  ButtonMotionMask bitor
+  EnterWindowMask bitor
+  ! experimental masks
+  SubstructureNotifyMask bitor
+  >>mask
+
+  <- init-widget
+  "cornflowerblue" <-- set-background
+  dup $child <- position <-- move
+  dup $child over <-- reparent drop
+  <- position-child
+  <- fit-to-child
+  <- make-frame-button
+
+  <- map-subwindows
+  <- map
+] add-class-method
+
+SYMBOL: WM_PROTOCOLS
+SYMBOL: WM_DELETE_WINDOW
+
+: init-atoms ( -- )
+"WM_PROTOCOLS" 0 intern-atom WM_PROTOCOLS set
+"WM_DELETE_WINDOW" 0 intern-atom WM_DELETE_WINDOW set ;
+
+<wm-frame> {
+
+"fit-to-child" !( wm-frame -- wm-frame )
+  [ dup $child <- size { 10 20 } v+ <-- resize ]
+
+"position-child" !( wm-frame -- wm-frame ) 
+  [ dup $child { 5 15 } <-- move drop ]
+
+"set-child-size" !( wm-frame size -- frame )
+  [ >r dup $child r> <-- resize drop <- fit-to-child ]
+
+"set-child-width" !( wm-frame width -- frame )
+  [ >r dup $child r> <- set-width drop <- fit-to-child ]
+
+"set-child-height" !( wm-frame height -- frame )
+  [ >r dup $child r> <- set-height drop <- fit-to-child ]
+
+"adjust-child" !( wm-frame -- wm-frame )
+  [ dup $child over <- size { 10 20 } v- <-- resize drop ]
+
+"update-title" !( wm-frame -- wm-frame )
+  [ <- clear
+    dup >r
+    ! dup $gc { 5 1 } pick $child <- fetch-name <--- draw-string/top-left
+    dup $gc { 5 11 } pick $child <- fetch-name <---- draw-string
+    r> ]
+
+"delete-child" !( wm-frame -- wm-frame ) [
+  dup $child WM_PROTOCOLS get WM_DELETE_WINDOW get <--- send-client-message
+  drop ]
+
+"drag-move" !( event wm-frame -- ) [ <wm-frame-drag-move> new* ]
+
+"drag-size" !( event wm-frame -- ) [ <wm-frame-drag-size> new* ]
+
+"make-frame-button" !( frame -- frame ) [
+<button> new*
+  over <-- reparent
+  "" >>text
+  over [ <- unmap drop ]        curry >>action-1
+  over [ <- delete-child drop ] curry >>action-3
+  { 9 9 } <-- resize
+  NorthEastGravity <-- set-gravity
+  "white" <-- set-background
+  over <- width 9 -  5 -  3 2array <-- move
+  drop ]
+
+! !!!!!!!!!! Event handlers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+"handle-enter-window" !( event wm-frame -- )
+  [ nip $child RevertToPointerRoot CurrentTime <--- set-input-focus drop ]
+
+"handle-expose" !( event wm-frame -- ) [ nip <- clear <- update-title drop ]
+
+"handle-button-press" !( event wm-frame -- ) [
+  over XButtonEvent-button
+  { { [ dup Button1 = ] [ drop <- drag-move ] }
+    { [ dup Button2 = ] [ drop <- drag-size ] }
+    { [ t ] [ 3drop ] } }
+  cond ]
+
+"handle-map" !( event wm-frame -- )
+  [ "<wm-frame> handle-map :: ignoring values" print flush 2drop ]
+
+"handle-unmap" !( event wm-frame -- ) [ nip <- unmap drop ]
+
+"handle-destroy-window" !( event wm-frame -- ) [
+  nip dup $child <- remove-from-window-table drop
+  <- remove-from-window-table <- destroy ]
+
+"handle-configure-request" !( event frame -- ) [
+  { { [ over dup CWX? swap CWY? and ]
+      [ over XConfigureRequestEvent-position <-- move ] }
+    { [ over CWX? ] [ over XConfigureRequestEvent-x <-- set-x ] }
+    { [ over CWY? ] [ over XConfigureRequestEvent-y <-- set-y ] }
+    { [ t ] [ "<wm-frame> handle-configure-request :: move not requested"
+              print flush ] } }
+  cond
+
+  { { [ over dup CWWidth? swap CWHeight? and ]
+      [ over XConfigureRequestEvent-size <-- set-child-size ] }
+    { [ over CWWidth? ]
+      [ over XConfigureRequestEvent-width <-- set-child-width ] }
+    { [ over CWHeight? ]
+      [ over XConfigureRequestEvent-height <-- set-child-height ] }
+    { [ t ]
+      [ "<wm-frame> handle-configure-request :: resize not requested"
+       print flush ] } }
+  cond
+  2drop ]
+
+} add-methods
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: wm-frame-maximize ( wm-frame -- wm-frame )
+<- save-state
+{ 0 0 } <-- move
+dup $dpy $default-root <- size
+  <-- resize
+<- adjust-child 
+<- raise ;
+
+: wm-frame-maximize-vertical ( wm-frame -- wm-frame )
+0 <-- set-y
+dup $dpy $default-root <- height
+  <-- set-height
+<- adjust-child ;
+
+<wm-frame> "save-state" !( wm-frame -- wm-frame ) [
+  dup <- position
+  over <- size
+    <rect> new
+  >>last-state
+] add-method
+
+<wm-frame> "restore-state" !( wm-frame -- wm-frame ) [
+  dup $last-state $pos <-- move
+  dup $last-state $dim <-- resize
+  <- adjust-child
+] add-method
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
diff --git a/extra/x/widgets/wm/menu/menu.factor b/extra/x/widgets/wm/menu/menu.factor
new file mode 100644 (file)
index 0000000..e836b21
--- /dev/null
@@ -0,0 +1,26 @@
+
+USING: kernel x11.constants mortar slot-accessors x.widgets.keymenu ;
+
+IN: x.widgets.wm.menu
+
+SYMBOL: <wm-menu>
+
+<wm-menu> <keymenu> { } define-simple-class
+
+<wm-menu> "create" !( <wm-menu> -- wm-menu )
+  [ new-empty <- keymenu-init ]
+add-class-method
+
+<wm-menu> {
+
+"wm-menu-handle-key-press" !( event wm-menu -- )
+  [ <- unmap <- keymenu-handle-key-press ]
+
+"handle-key-press" !( event wm-menu -- ) [ <- wm-menu-handle-key-press ]
+
+"wm-menu-popup" !( wm-menu -- wm-menu )
+  [ <- map <- raise RevertToPointerRoot CurrentTime <--- set-input-focus ]
+
+"popup" !( wm-menu -- wm-menu ) [ <- wm-menu-popup ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/widgets/wm/root/root.factor b/extra/x/widgets/wm/root/root.factor
new file mode 100644 (file)
index 0000000..0ce91d5
--- /dev/null
@@ -0,0 +1,103 @@
+
+USING: kernel io combinators namespaces arrays assocs sequences math
+       x11.xlib
+       x11.constants
+       vars mortar slot-accessors
+       x x.keysym-table x.widgets x.widgets.wm.child x.widgets.wm.frame ;
+
+IN: x.widgets.wm.root
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: <wm-root>
+
+<wm-root>
+  <widget>
+  { "keymap" } accessors
+define-simple-class
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: wm-root
+
+: create-wm-root ( -- )
+  <wm-root> new-empty
+    dpy> >>dpy
+    dpy> $default-root $id >>id
+    SubstructureRedirectMask >>mask
+    <- add-to-window-table
+    SubstructureRedirectMask <-- select-input
+    H{ } clone >>keymap
+  >wm-root ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: find-in-table ( window -- object )
+dup >r $id   dpy get $window-table   at r> or ;
+
+: circulate-focus ( -- )
+dpy get $default-root <- children
+[ find-in-table ] map [ <- mapped? ] subset   dup length 1 >
+[ reverse dup first <- lower drop
+  second <- raise
+  dup <wm-frame> is? [ $child ] [ ] if
+  RevertToPointerRoot CurrentTime <--- set-input-focus drop ]
+[ drop ]
+if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: managed? ( id -- ? )
+dpy get $window-table values [ <wm-child> is? ] subset [ $id ] map member? ;
+
+: event>keyname ( event -- keyname ) lookup-keysym keysym>name ;
+
+: event>state-and-name ( event -- array )
+dup XKeyEvent-state swap event>keyname 2array ;
+
+: resolve-key-event ( keymap event -- item ) event>state-and-name swap at ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<wm-root> {
+
+"handle-map-request" !( event wm-root -- ) [
+  { { [ over XMapRequestEvent-window managed? ]
+      [ "<wm-root> handle-map-request :: window already managed" print flush
+       2drop ] }
+    { [ t ] [ drop XMapRequestEvent-window <wm-frame> <<- create drop ] } }
+  cond ]
+
+"handle-unmap" !( event wm-root -- ) [ 2drop ]
+
+"handle-key-press" !( event wm-root -- )
+  [ $keymap swap resolve-key-event call ]
+
+"grab-key" !( wm-root modifiers keyname -- wm-root modifiers keyname ) [
+  3dup name>keysym keysym-to-keycode swap rot
+  False GrabModeAsync GrabModeAsync grab-key ]
+
+"set-key-action" !( wm-root modifiers keyname action -- wm-root ) [
+  >r <--- grab-key r>
+  -rot 2array pick $keymap set-at ]
+
+"handle-configure-request" !( event wm-root -- ) [
+  $dpy over XConfigureRequestEvent-window <window> new ! event window
+  { { [ over dup CWX? swap CWY? and ]
+      [ over XConfigureRequestEvent-position <-- move ] }
+    { [ over CWX? ] [ over XConfigureRequestEvent-x <-- set-x ] }
+    { [ over CWY? ] [ over XConfigureRequestEvent-y <-- set-y ] }
+    { [ t ] [ "<wm-root> handle-configure-request :: move not requested"
+             print flush ] } }
+  cond
+
+  { { [ over dup CWWidth? swap CWHeight? and ]
+      [ over XConfigureRequestEvent-size <-- resize ] }
+    { [ over CWWidth? ] [ over XConfigureRequestEvent-width <-- set-width ] }
+    { [ over CWHeight? ] [ over XConfigureRequestEvent-height <-- set-height ] }
+    { [ t ] [ "<wm-root> handle-configure-request :: resize not requested"
+             print flush ] } }
+  cond
+  2drop ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/widgets/wm/unmapped-frames-menu/unmapped-frames-menu.factor b/extra/x/widgets/wm/unmapped-frames-menu/unmapped-frames-menu.factor
new file mode 100644 (file)
index 0000000..e1b3c5d
--- /dev/null
@@ -0,0 +1,41 @@
+
+USING: kernel namespaces quotations arrays assocs sequences
+       mortar slot-accessors x x.widgets.wm.menu x.widgets.wm.frame
+       vars ;
+
+IN: x.widgets.wm.unmapped-frames-menu
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: <unmapped-frames-menu>
+
+<unmapped-frames-menu> <wm-menu> { } define-simple-class
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+VAR: unmapped-frames-menu
+
+: create-unmapped-frames-menu ( -- )
+<unmapped-frames-menu>
+  new-empty
+  <- keymenu-init
+  1 <-- set-border-width
+>unmapped-frames-menu ;
+
+: unmapped-frames ( -- seq )
+dpy get $window-table values
+[ <wm-frame> is? ] subset [ <- mapped? not ] subset ;
+
+<unmapped-frames-menu> {
+
+"refresh" !( menu -- menu ) [
+  unmapped-frames dup
+  [ $child <- fetch-name ] map swap
+  [ [ <- map ] curry ] map
+  [ 2array ] 2map
+  >>items
+  dup <- calc-size <-- resize ]
+
+"popup" !( menu -- menu ) [ <- refresh <- wm-menu-popup ]
+
+} add-methods
\ No newline at end of file
diff --git a/extra/x/widgets/wm/workspace/workspace.factor b/extra/x/widgets/wm/workspace/workspace.factor
new file mode 100644 (file)
index 0000000..f456c06
--- /dev/null
@@ -0,0 +1,47 @@
+
+USING: kernel namespaces namespaces.lib math sequences vars mortar slot-accessors x ;
+
+IN: x.widgets.wm.workspace
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: workspace windows ;
+
+C: <workspace> workspace
+
+VAR: workspaces
+
+VAR: current-workspace
+
+: init-workspaces ( -- ) V{ } clone >workspaces ;
+
+: add-workspace ( -- ) { } clone <workspace> workspaces> push ;
+
+: mapped-windows ( -- seq )
+dpy get $default-root <- children [ <- mapped? ] subset ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: switch-to-workspace ( n -- )
+mapped-windows current-workspace> workspaces> nth set-workspace-windows
+mapped-windows [ <- unmap drop ] each
+dup workspaces> nth workspace-windows [ <- map drop ] each
+current-workspace set* ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: next-workspace ( -- )
+current-workspace> 1+ dup workspaces> length <
+[ switch-to-workspace ] [ drop ] if ;
+
+: prev-workspace ( -- )
+current-workspace> 1- dup 0 >=
+[ switch-to-workspace ] [ drop ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: setup-workspaces ( n -- )
+workspaces>
+  [ drop ]
+  [ init-workspaces [ add-workspace ] times 0 >current-workspace ]
+if ;
\ No newline at end of file
diff --git a/extra/x/x.factor b/extra/x/x.factor
new file mode 100644 (file)
index 0000000..e55dc3f
--- /dev/null
@@ -0,0 +1,503 @@
+
+USING: kernel io alien alien.c-types namespaces threads
+       arrays sequences assocs math vars combinators.lib
+       x11.constants x11.events x11.xlib mortar slot-accessors geom.rect ;
+
+IN: x
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: <display>
+
+SYMBOL: <window>
+
+! SYMBOL: dpy
+
+VAR: dpy
+
+<display>
+  { "ptr"
+    "name"
+    "default-screen"
+    "default-root"
+    "default-gc"
+    "black-pixel"
+    "white-pixel"
+    "colormap" 
+    "window-table" } accessors
+define-independent-class
+
+<display> "create" !( name <display> -- display ) [
+  new-empty swap >>name
+  dup $name dup [ string>char-alien ] [ ] if XOpenDisplay >>ptr
+  dup $ptr XDefaultScreen >>default-screen
+  dup $ptr XDefaultRootWindow dupd <window> new >>default-root
+  dup $ptr over $default-screen XDefaultGC >>default-gc
+  dup $ptr over $default-screen XBlackPixel >>black-pixel
+  dup $ptr over $default-screen XWhitePixel >>white-pixel
+  dup $ptr over $default-screen XDefaultColormap >>colormap 
+  H{ } clone >>window-table
+  [ <- start-event-loop ] in-thread
+] add-class-method
+
+{ "id" } accessors drop
+
+DEFER: check-window-table
+
+<display> {
+
+"add-to-window-table" !( display window -- )
+  [ dup $id rot $window-table set-at ]
+
+"remove-from-window-table" !( display window -- )
+  [ $id swap $window-table delete-at ]
+
+"next-event" !( display event -- display event )
+  [ over $ptr over XNextEvent drop ]
+
+"events-queued" !( display mode -- n ) [ >r $ptr r> XEventsQueued ]
+
+"concurrent-next-event" !( display event -- display event )
+  [ over QueuedAfterFlush <-- events-queued 0 >
+    [ <-- next-event ] [ 100 sleep <-- concurrent-next-event ] if ]
+
+"event-loop" !( display event -- )
+[ <-- concurrent-next-event
+  2dup >r >r
+  dup XAnyEvent-window rot $window-table at dup
+  [ <- handle-event ] [ 2drop ] if
+  r> r>
+  <-- event-loop ]
+
+"start-event-loop" !( display -- ) [ "XEvent" <c-object> <-- event-loop ]
+
+"flush" !( display -- display ) [ dup $ptr XFlush drop ]
+
+"pointer-window" !( display -- window ) [
+  dup $ptr
+  over $default-root $id
+  0 <Window>
+  0 <Window> dup >r
+  0 <int>
+  0 <int>
+  0 <int>
+  0 <int>
+  0 <uint>
+    XQueryPointer drop
+  r> *Window <window> new
+  check-window-table ]
+
+} add-methods
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<window> { "dpy" "id" } accessors define-independent-class
+
+: create-window ( -- window ) <window> new-empty <- init-window ;
+
+: create-window-from-id ( dpy id -- window ) <window> new ;
+
+: check-window-table ( window -- window )
+  dup $id
+  over $dpy $window-table
+    at
+  swap or ;
+
+<window> "init-window"
+  !( window -- window )
+  [ dpy get
+      >>dpy
+    dpy get $ptr
+    dpy get $default-root $id
+    0 0 100 100 0
+    dpy get $black-pixel
+    dpy get $white-pixel
+    XCreateSimpleWindow
+      >>id ]
+add-method
+
+! <window> new-empty <- init
+
+<window> "raw"
+  !( window -- dpy-ptr id )
+  [ dup $dpy $ptr swap $id ]
+add-method
+
+<window> "move"
+  !( window point -- window )
+  [ >r dup <- raw r> first2 XMoveWindow drop ]
+add-method
+
+<window> "set-x" !( window x -- window ) [
+  over <- y 2array <-- move
+] add-method
+
+<window> "set-y" !( window y -- window ) [ 
+  over <- x swap 2array <-- move
+] add-method
+
+<window> "flush"
+  !( window -- window )
+  [ dup $dpy <- flush drop ]
+add-method
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 3 - Window Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 3.3 - Creating Windows
+
+<window> "destroy" !( window -- window )
+  [ dup <- raw XDestroyWindow drop ]
+add-method
+
+<window> "map"
+  !( window -- window )
+  [ dup <- raw XMapWindow drop ]
+add-method
+
+<window> "map-subwindows"
+  !( window -- window )
+  [ dup <- raw XMapSubwindows drop ]
+add-method
+
+<window> "unmap"
+  !( window -- window )
+  [ dup <- raw XUnmapWindow drop ]
+add-method
+
+<window> "unmap-subwindows"
+  !( window -- window )
+  [ dup <- raw XUnmapSubwindows drop ]
+add-method
+
+! 3.7 - Configuring Windows
+
+<window> "resize"
+  !( window size -- window )
+  [ >r dup <- raw r> first2 XResizeWindow drop ]
+add-method
+
+<window> "set-width"
+  !( window width -- window )
+  [ over <- height 2array <-- resize ]
+add-method
+
+<window> "set-height"
+  !( window height -- window )
+  [ over <- width swap 2array <-- resize ]
+add-method
+
+<window> "set-border-width"
+  !( window n -- window )
+  [ >r dup <- raw r> XSetWindowBorderWidth drop ]
+add-method
+
+! 3.8 Changing Window Stacking Order
+
+<window> "raise"
+  !( window -- window )
+  [ dup <- raw XRaiseWindow drop ]
+add-method
+
+<window> "lower"
+  !( window -- window )
+  [ dup <- raw XLowerWindow drop ]
+add-method
+
+! 3.9 - Changing Window Attributes
+
+! : change-window-attributes ( valuemask attr window -- )
+! -rot >r >r <- raw r> r> XChangeWindowAttributes drop ;
+
+<window> "change-attributes" !( window valuemask attr -- window ) [
+>r >r dup <- raw r> r> XChangeWindowAttributes drop 
+] add-method
+
+DEFER: lookup-color
+
+<window> "set-background"
+  !( window color -- window )
+  [ >r dup <- raw r> lookup-color XSetWindowBackground drop ]
+add-method
+
+<window> "set-gravity" !( window gravity -- window ) [
+CWWinGravity swap
+"XSetWindowAttributes" <c-object> tuck set-XSetWindowAttributes-win_gravity
+<--- change-attributes
+] add-method
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 4 - Window Information Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 4.1 - Obtaining Window Information
+
+<window> {
+
+"children" !( window -- seq )
+  [ <- raw 0 <uint> 0 <uint> f <void*> 0 <uint> 2dup >r >r XQueryTree drop
+    r> r> swap *void* swap *uint c-uint-array>
+    [ dpy get swap <window> new ] map ]
+
+"parent" !( window -- parent ) [
+  dup $dpy >r
+
+  dup $dpy $ptr
+  swap $id
+  0 <Window>
+  0 <Window> dup >r
+  f <void*>
+  0 <uint>
+    XQueryTree drop
+  r> *Window
+  r> swap
+    <window> new
+  check-window-table ]
+
+"size" !( window -- size )
+  [ <- raw 0 <Window> 0 <int> 0 <int>
+    0 <uint> 0 <uint> 2dup 2array >r
+    0 <uint> 0 <uint>
+    XGetGeometry drop r> [ *uint ] map ]
+
+"width" !( window -- width ) [ <- size first ]
+
+"height" !( window -- height ) [ <- size second ]
+
+"position" !( window -- position )
+  [ <- raw 0 <Window>
+    0 <uint> 0 <uint> 2dup 2array >r
+    0 <uint> 0 <uint> 0 <uint> 0 <uint>
+    XGetGeometry drop r> [ *int ] map ]
+
+"x" !( window -- x ) [ <- position first ]
+
+"y" !( window -- y ) [ <- position second ]
+
+"as-rect" !( window -- rect ) [ dup <- position swap <- size <rect> new ]
+
+"attributes" !( window -- XWindowAttributes )
+  [ <- raw "XWindowAttributes" <c-object> dup >r XGetWindowAttributes drop r> ]
+
+"map-state" !( window -- state ) [ <- attributes XWindowAttributes-map_state ]
+
+"mapped?" !( window -- ? ) [ <- map-state IsUnmapped = not ]
+
+} add-methods
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: get-atom-name ( atom -- name ) dpy get $ptr swap XGetAtomName ;
+
+: intern-atom ( atom-name only-if-exists? -- atom )
+dpy get $ptr -rot XInternAtom ;
+
+: lookup-color ( name -- pixel )
+dpy get $ptr dpy get $colormap rot
+"XColor" <c-object> dup >r "XColor" <c-object> XLookupColor drop
+dpy get $ptr dpy get $colormap r> dup >r XAllocColor drop r> XColor-pixel ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 8 - Graphics Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<window> "clear"
+  !( window -- window )
+  [ dup <- raw XClearWindow drop ]
+add-method
+
+<window> "draw-string"
+  !( window gc pos string -- )
+  [ >r >r >r <- raw r> $ptr r> [ >fixnum ] map first2 r> dup length
+    XDrawString drop ]
+add-method
+
+! <window> "draw-string"
+!   !( window gc pos string -- )
+!   [ >r >r >r <- raw r> $ptr r> [ >fixnum ] map first2 r> dup length
+!     XDrawString drop ]
+! add-method
+
+<window> "draw-line"
+  !( window gc a b -- )
+  [ >r >r >r <- raw r> $ptr r> first2 r> first2 XDrawLine drop ]
+add-method
+
+<window> "draw-rect"
+  !( window gc rect -- )
+  [ 3dup dup <- top-left    swap <- top-right    <---- draw-line
+    3dup dup <- top-right   swap <- bottom-right <---- draw-line
+    3dup dup <- bottom-left swap <- bottom-right <---- draw-line
+        dup <- top-left    swap <- bottom-left  <---- draw-line ]
+add-method
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 9 - Window and Session Manager Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<window> "reparent"
+  !( window parent -- window )
+  [ >r dup <- raw r> $id 0 0 XReparentWindow drop ]
+add-method
+
+<window> "add-to-save-set" !( window -- window ) [
+  dup <- raw XAddToSaveSet drop
+] add-method
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 10 - Events
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: XButtonEvent-root-position ( event -- position )
+dup XButtonEvent-x_root swap XButtonEvent-y_root 2array ;
+
+: XMotionEvent-root-position ( event -- position )
+dup XMotionEvent-x_root swap XMotionEvent-y_root 2array ;
+
+! Utility words for XConfigureRequestEvent
+
+: XConfigureRequestEvent-position ( XConfigureRequestEvent -- position )
+dup XConfigureRequestEvent-x swap XConfigureRequestEvent-y 2array ;
+
+: XConfigureRequestEvent-size ( XConfigureRequestEvent -- size )
+dup XConfigureRequestEvent-width swap XConfigureRequestEvent-height 2array ;
+
+: bit-test ( a b -- t-or-f ) bitand 0 = not ;
+
+: CWX? ( XConfigureRequestEvent -- bool )
+XConfigureRequestEvent-value_mask CWX bit-test ;
+
+: CWY? ( XConfigureRequestEvent -- bool )
+XConfigureRequestEvent-value_mask CWY bit-test ;
+
+: CWWidth? ( XConfigureRequestEvent -- bool )
+XConfigureRequestEvent-value_mask CWWidth bit-test ;
+
+: CWHeight? ( XConfigureRequestEvent -- bool )
+XConfigureRequestEvent-value_mask CWHeight bit-test ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 11 - Event Handling Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<window> "select-input"
+  !( window mask -- window )
+  [ >r dup <- raw r> XSelectInput drop ]
+add-method
+
+! 11.8 - Handling Protocol Errors
+
+SYMBOL: error-handler-quot
+
+: error-handler-callback ( -- xt )
+"void" { "Display*" "XErrorEvent*" } "cdecl"
+[ error-handler-quot get call ] alien-callback ; 
+
+: set-error-handler ( quot -- )
+error-handler-quot set error-handler-callback XSetErrorHandler drop ;
+
+: install-default-error-handler ( -- )
+[ "X11 : error-handler called" print flush ] set-error-handler ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 12 - Input Device Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 12.2 - Keyboard Grabbing
+
+: grab-key
+( keycode modifiers grab-window owner-events pointer-mode keyboard-mode -- )
+>r >r >r <- raw >r -rot r> r> r> r> XGrabKey drop ;
+
+! 12.5 - Controlling Input Focus
+
+<window> "set-input-focus" !( window revert-to time -- window )
+  [ >r >r dup <- raw r> r> XSetInputFocus drop ]
+add-method
+
+: get-input-focus ( -- window )
+  dpy> $ptr
+  0 <Window> dup >r
+  0 <int>
+    XGetInputFocus drop
+  r> *Window
+    dpy> swap
+  create-window-from-id
+  check-window-table ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 14 - Inter-Client Communication Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+<window> "fetch-name" !( window -- name-or-f )
+  [ <- raw f <void*> dup >r   XFetchName drop   r>
+    dup *void* alien-address 0 = [ drop f ] [ *char* ] if ]
+add-method
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 16 - Application Utility Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 16.1 - Using Keyboard Utility Functions
+
+! this should go in xlib.factor
+
+USING: alien.syntax ;
+
+FUNCTION: KeyCode XKeysymToKeycode ( Display* display, KeySym keysym ) ;
+
+FUNCTION: KeySym XKeycodeToKeysym ( Display* display,
+                                   KeyCode keycode,
+                                   int index ) ;
+
+FUNCTION: char* XKeysymToString ( KeySym keysym ) ;
+
+: keysym-to-keycode ( keysym -- keycode ) dpy get $ptr swap XKeysymToKeycode ;
+
+USE: strings
+
+: lookup-string* ( event -- keysym string )
+10 "char" <c-array> dup >r  10  0 <KeySym> dup >r  f  XLookupString
+r> *KeySym  swap r> swap c-char-array> >string ;
+
+: lookup-string ( event -- string ) lookup-string* nip ;
+
+: lookup-keysym ( event -- keysym ) lookup-string* drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!7
+
+: event-to-keysym ( event index -- keysym )
+>r dup XKeyEvent-display swap XKeyEvent-keycode r> XKeycodeToKeysym ;
+
+: keysym-to-string ( keysym -- string ) XKeysymToString ;
+
+: key-event-to-string ( event index -- str ) event-to-keysym keysym-to-string ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Misc
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: no-modifiers ( -- mask ) 0 ;
+
+: control-alt ( -- mask ) ControlMask Mod1Mask bitor ;
+
+: alt ( -- mask ) Mod1Mask ;
+
+: True  1 ;
+: False 0 ;
+
+<window> "send-client-message" !( window message-type data -- window ) [
+
+"XClientMessageEvent" <c-object>
+
+tuck               set-XClientMessageEvent-data0
+tuck               set-XClientMessageEvent-message_type
+over $id over      set-XClientMessageEvent-window
+ClientMessage over set-XClientMessageEvent-type
+32            over set-XClientMessageEvent-format
+CurrentTime   over set-XClientMessageEvent-data1
+
+>r dup <- raw False NoEventMask r> XSendEvent drop
+
+] add-method
\ No newline at end of file
diff --git a/extra/x11/clipboard/authors.txt b/extra/x11/clipboard/authors.txt
new file mode 100644 (file)
index 0000000..db8d844
--- /dev/null
@@ -0,0 +1,2 @@
+Eduardo Cavazos
+Slava Pestov
diff --git a/extra/x11/clipboard/clipboard.factor b/extra/x11/clipboard/clipboard.factor
new file mode 100644 (file)
index 0000000..5978ee6
--- /dev/null
@@ -0,0 +1,80 @@
+! Copyright (C) 2006, 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types alien.syntax arrays kernel math
+namespaces sequences io.utf8 x11.xlib x11.constants ;
+IN: x11.clipboard
+
+! This code was based on by McCLIM's Backends/CLX/port.lisp
+! and http://common-lisp.net/~crhodes/clx/demo/clipboard.lisp.
+
+: XA_CLIPBOARD "CLIPBOARD" x-atom ;
+
+: XA_UTF8_STRING "UTF8_STRING" x-atom ;
+
+TUPLE: x-clipboard atom contents ;
+
+: <x-clipboard> ( atom -- clipboard )
+    "" x-clipboard construct-boa ;
+
+: selection-property ( -- n )
+    "org.factorcode.Factor.SELECTION" x-atom ;
+
+: convert-selection ( win selection -- )
+    swap >r >r dpy get r> XA_UTF8_STRING selection-property r>
+    CurrentTime XConvertSelection drop ;
+
+: snarf-property ( prop-return -- string )
+    dup *void* [ *char* ] [ drop f ] if ;
+
+: window-property ( win prop delete? -- string )
+    >r dpy get -rot 0 -1 r> AnyPropertyType
+    0 <Atom> 0 <int> 0 <ulong> 0 <ulong> f <void*>
+    [ XGetWindowProperty drop ] keep snarf-property ;
+
+: selection-from-event ( event window -- string )
+    >r XSelectionEvent-property zero? [
+        r> drop f
+    ] [
+        r> selection-property 1 window-property decode-utf8
+    ] if ;
+
+: own-selection ( prop win -- )
+    dpy get -rot CurrentTime XSetSelectionOwner drop
+    flush-dpy ;
+
+: set-targets-prop ( evt -- )
+    dpy get swap
+    [ XSelectionRequestEvent-requestor ] keep
+    XSelectionRequestEvent-property
+    "TARGETS" x-atom 32 PropModeReplace
+    {
+        "UTF8_STRING" "STRING" "TARGETS" "TIMESTAMP"
+    } [ x-atom ] map >c-int-array
+    4 XChangeProperty drop ;
+
+: set-timestamp-prop ( evt -- )
+    dpy get swap
+    [ XSelectionRequestEvent-requestor ] keep
+    [ XSelectionRequestEvent-property ] keep
+    >r "TIMESTAMP" x-atom 32 PropModeReplace r>
+    XSelectionRequestEvent-time 1array >c-int-array
+    1 XChangeProperty drop ;
+
+: send-notify ( evt prop -- )
+    "XSelectionEvent" <c-object>
+    SelectionNotify over set-XSelectionEvent-type
+    [ set-XSelectionEvent-property ] keep
+    over XSelectionRequestEvent-display   over set-XSelectionEvent-display
+    over XSelectionRequestEvent-requestor over set-XSelectionEvent-requestor
+    over XSelectionRequestEvent-selection over set-XSelectionEvent-selection
+    over XSelectionRequestEvent-target    over set-XSelectionEvent-target
+    over XSelectionRequestEvent-time      over set-XSelectionEvent-time
+    >r dpy get swap XSelectionRequestEvent-requestor 0 0 r>
+    XSendEvent drop
+    flush-dpy ;
+
+: send-notify-success ( evt -- )
+    dup XSelectionRequestEvent-property send-notify ;
+
+: send-notify-failure ( evt -- )
+    0 send-notify ;
diff --git a/extra/x11/clipboard/summary.txt b/extra/x11/clipboard/summary.txt
new file mode 100644 (file)
index 0000000..19d8bc0
--- /dev/null
@@ -0,0 +1 @@
+X11 clipboard access utilities
diff --git a/extra/x11/constants/authors.txt b/extra/x11/constants/authors.txt
new file mode 100644 (file)
index 0000000..db8d844
--- /dev/null
@@ -0,0 +1,2 @@
+Eduardo Cavazos
+Slava Pestov
diff --git a/extra/x11/constants/constants.factor b/extra/x11/constants/constants.factor
new file mode 100644 (file)
index 0000000..ac0367e
--- /dev/null
@@ -0,0 +1,404 @@
+! Copyright (C) 2005, 2006 Eduardo Cavazos and Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+
+! Based on X.h
+
+USING: alien alien.syntax math x11.xlib ;
+IN: x11.constants
+
+TYPEDEF: ulong Mask
+
+TYPEDEF: uchar KeyCode
+
+! Reserved Resource and Constant Definitions
+
+: ParentRelative 1 ;
+: CopyFromParent 0 ;
+: PointerWindow 0 ;
+: InputFocus 1 ;
+: PointerRoot 1 ;
+: AnyPropertyType 0 ;
+: AnyKey 0 ;
+: AnyButton 0 ;
+: AllTemporary 0 ;
+: CurrentTime 0 ;
+: NoSymbol 0 ;
+
+! Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
+!   state in various key-, mouse-, and button-related events.
+
+
+! modifier names.  Used to build a SetModifierMapping request or
+! to read a GetModifierMapping request.  These correspond to the
+! masks defined above.
+: ShiftMapIndex                0 ;
+: LockMapIndex         1 ;
+: ControlMapIndex      2 ;
+: Mod1MapIndex         3 ;
+: Mod2MapIndex         4 ;
+: Mod3MapIndex         5 ;
+: Mod4MapIndex         6 ;
+: Mod5MapIndex         7 ;
+
+
+! button masks.  Used in same manner as Key masks above. Not to be confused
+! with button names below.
+
+
+: AnyModifier          1 15 shift ; ! used in GrabButton, GrabKey
+
+! button names. Used as arguments to GrabButton and as detail in ButtonPress
+! and ButtonRelease events.  Not to be confused with button masks above.
+! Note that 0 is already defined above as "AnyButton".
+
+! Notify modes
+
+: NotifyNormal         0 ;
+: NotifyGrab           1 ;
+: NotifyUngrab         2 ;
+: NotifyWhileGrabbed   3 ;
+
+: NotifyHint           1 ; ! for MotionNotify events
+                      
+! Notify detail
+
+: NotifyAncestor        0 ;
+: NotifyVirtual                 1 ;
+: NotifyInferior        2 ;
+: NotifyNonlinear       3 ;
+: NotifyNonlinearVirtual 4 ;
+: NotifyPointer                 5 ;
+: NotifyPointerRoot     6 ;
+: NotifyDetailNone      7 ;
+
+! Visibility notify
+
+: VisibilityUnobscured         0 ;
+: VisibilityPartiallyObscured  1 ;
+: VisibilityFullyObscured      2 ;
+
+! Circulation request
+
+: PlaceOnTop           0 ;
+: PlaceOnBottom                1 ;
+
+! protocol families
+
+: FamilyInternet       0 ;     ! IPv4
+: FamilyDECnet         1 ;
+: FamilyChaos          2 ;
+: FamilyInternet6      6 ;     ! IPv6
+
+! authentication families not tied to a specific protocol
+: FamilyServerInterpreted 5 ;
+
+! Property notification
+
+: PropertyNewValue     0 ;
+: PropertyDelete       1 ;
+
+! Color Map notification
+
+: ColormapUninstalled  0 ;
+: ColormapInstalled    1 ;
+
+! GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes
+
+: GrabModeSync         0 ;
+: GrabModeAsync                1 ;
+
+! GrabPointer, GrabKeyboard reply status
+
+: GrabSuccess          0 ;
+: AlreadyGrabbed       1 ;
+: GrabInvalidTime      2 ;
+: GrabNotViewable      3 ;
+: GrabFrozen           4 ;
+
+! AllowEvents modes
+
+: AsyncPointer         0 ;
+: SyncPointer          1 ;
+: ReplayPointer                2 ;
+: AsyncKeyboard                3 ;
+: SyncKeyboard         4 ;
+: ReplayKeyboard       5 ;
+: AsyncBoth            6 ;
+: SyncBoth             7 ;
+
+! Used in SetInputFocus, GetInputFocus
+
+: RevertToNone         None ;
+: RevertToPointerRoot  PointerRoot ;
+: RevertToParent       2 ;
+
+! *****************************************************************
+! * ERROR CODES 
+! *****************************************************************
+
+: Success         0 ; ! everything's okay
+: BadRequest      1 ; ! bad request code
+: BadValue        2 ; ! int parameter out of range
+: BadWindow       3 ; ! parameter not a Window
+: BadPixmap       4 ; ! parameter not a Pixmap
+: BadAtom         5 ; ! parameter not an Atom
+: BadCursor       6 ; ! parameter not a Cursor
+: BadFont         7 ; ! parameter not a Font
+: BadMatch        8 ; ! parameter mismatch
+: BadDrawable     9 ; ! parameter not a Pixmap or Window
+: BadAccess      10 ; ! depending on context:
+                      !         - key/button already grabbed
+                      !         - attempt to free an illegal 
+                      !           cmap entry 
+                      !        - attempt to store into a read-only 
+                      !           color map entry.
+                      !        - attempt to modify the access control
+                      !           list from other than the local host.
+: BadAlloc         11 ; ! insufficient resources
+: BadColor         12 ; ! no such colormap
+: BadGC                    13 ; ! parameter not a GC
+: BadIDChoice      14 ; ! choice not in range or already used
+: BadName           15 ; ! font or color name doesn't exist
+: BadLength        16 ; ! Request length incorrect
+: BadImplementation 17 ; ! server is defective
+
+: FirstExtensionError  128 ;
+: LastExtensionError   255 ;
+
+! *****************************************************************
+! * WINDOW DEFINITIONS 
+! *****************************************************************
+
+! Window classes used by CreateWindow
+! Note that CopyFromParent is already defined as 0 above
+
+: InputOutput          1 ;
+: InputOnly            2 ;
+
+! Used in CreateWindow for backing-store hint
+
+: NotUseful               0 ;
+: WhenMapped              1 ;
+: Always                  2 ;
+
+! Used in ChangeSaveSet
+
+: SetModeInsert           0 ;
+: SetModeDelete           1 ;
+
+! Used in ChangeCloseDownMode
+
+: DestroyAll              0 ;
+: RetainPermanent         1 ;
+: RetainTemporary         2 ;
+
+! Window stacking method (in configureWindow)
+
+: Above                   0 ;
+: Below                   1 ;
+: TopIf                   2 ;
+: BottomIf                3 ;
+: Opposite                4 ;
+
+! Circulation direction
+
+: RaiseLowest             0 ;
+: LowerHighest            1 ;
+
+! Property modes
+
+: PropModeReplace         0 ;
+: PropModePrepend         1 ;
+: PropModeAppend          2 ;
+
+! *****************************************************************
+! * GRAPHICS DEFINITIONS
+! *****************************************************************
+
+! LineStyle
+
+: LineSolid            0 ;
+: LineOnOffDash                1 ;
+: LineDoubleDash       2 ;
+
+! capStyle
+
+: CapNotLast           0 ;
+: CapButt              1 ;
+: CapRound             2 ;
+: CapProjecting                3 ;
+
+! joinStyle
+
+: JoinMiter            0 ;
+: JoinRound            1 ;
+: JoinBevel            2 ;
+
+! fillStyle
+
+: FillSolid            0 ;
+: FillTiled            1 ;
+: FillStippled         2 ;
+: FillOpaqueStippled   3 ;
+
+! fillRule
+
+: EvenOddRule          0 ;
+: WindingRule          1 ;
+
+! subwindow mode
+
+: ClipByChildren       0 ;
+: IncludeInferiors     1 ;
+
+! SetClipRectangles ordering
+
+: Unsorted             0 ;
+: YSorted              1 ;
+: YXSorted             2 ;
+: YXBanded             3 ;
+
+! CoordinateMode for drawing routines
+
+: CoordModeOrigin   0 ; ! relative to the origin
+: CoordModePrevious 1 ; ! relative to previous point
+
+! Polygon shapes
+
+: Complex      0 ; ! paths may intersect
+: Nonconvex    1 ; ! no paths intersect, but not convex
+: Convex       2 ; ! wholly convex
+
+! Arc modes for PolyFillArc
+
+: ArcChord    0 ; ! join endpoints of arc
+: ArcPieSlice 1 ; ! join endpoints to center of arc
+
+! *****************************************************************
+! * FONTS 
+! *****************************************************************
+
+! used in QueryFont -- draw direction
+
+: FontLeftToRight              0 ;
+: FontRightToLeft              1 ;
+
+: FontChange           255 ;
+
+! *****************************************************************
+! *  IMAGING 
+! *****************************************************************
+
+! ImageFormat -- PutImage, GetImage
+
+: XYBitmap             0 ; ! depth 1, XYFormat
+: XYPixmap             1 ; ! depth == drawable depth
+: ZPixmap              2 ; ! depth == drawable depth
+
+! *****************************************************************
+! *  COLOR MAP STUFF 
+! *****************************************************************
+
+! For CreateColormap
+
+: AllocNone            0 ; ! create map with no entries
+: AllocAll             1 ; ! allocate entire map writeable
+
+
+! Flags used in StoreNamedColor, StoreColors
+
+: DoRed                1 0 shift ;
+: DoGreen      1 1 shift ;
+: DoBlue       1 2 shift ;
+
+! *****************************************************************
+! * CURSOR STUFF
+! *****************************************************************
+
+! QueryBestSize Class
+
+: CursorShape          0 ; ! largest size that can be displayed
+: TileShape            1 ; ! size tiled fastest
+: StippleShape         2 ; ! size stippled fastest
+
+! ***************************************************************** 
+! * KEYBOARD/POINTER STUFF
+! *****************************************************************
+
+: AutoRepeatModeOff    0 ;
+: AutoRepeatModeOn     1 ;
+: AutoRepeatModeDefault        2 ;
+
+: LedModeOff           0 ;
+: LedModeOn            1 ;
+
+! masks for ChangeKeyboardControl
+
+: KBKeyClickPercent    1 0 shift ;
+: KBBellPercent                1 1 shift ;
+: KBBellPitch          1 2 shift ;
+: KBBellDuration       1 3 shift ;
+: KBLed                        1 4 shift ;
+: KBLedMode            1 5 shift ;
+: KBKey                        1 6 shift ;
+: KBAutoRepeatMode     1 7 shift ;
+
+: MappingSuccess       0 ;
+: MappingBusy          1 ;
+: MappingFailed                2 ;
+
+: MappingModifier              0 ;
+: MappingKeyboard              1 ;
+: MappingPointer               2 ;
+
+! *****************************************************************
+! * SCREEN SAVER STUFF 
+! *****************************************************************
+
+: DontPreferBlanking   0 ;
+: PreferBlanking       1 ;
+: DefaultBlanking      2 ;
+
+: DisableScreenSaver   0 ;
+: DisableScreenInterval        0 ;
+
+: DontAllowExposures   0 ;
+: AllowExposures       1 ;
+: DefaultExposures     2 ;
+
+! for ForceScreenSaver
+
+: ScreenSaverReset 0 ;
+: ScreenSaverActive 1 ;
+
+! *****************************************************************
+! * HOSTS AND CONNECTIONS
+! *****************************************************************
+
+! for ChangeHosts
+
+: HostInsert           0 ;
+: HostDelete           1 ;
+
+! for ChangeAccessControl
+
+: EnableAccess         1 ;
+: DisableAccess                0 ;
+
+! Display classes  used in opening the connection 
+! Note that the statically allocated ones are even numbered and the
+! dynamically changeable ones are odd numbered
+
+: StaticGray           0 ;
+: GrayScale            1 ;
+: StaticColor          2 ;
+: PseudoColor          3 ;
+: TrueColor            4 ;
+: DirectColor          5 ;
+
+
+! Byte order  used in imageByteOrder and bitmapBitOrder
+
+: LSBFirst             0 ;
+: MSBFirst             1 ;
+
diff --git a/extra/x11/constants/summary.txt b/extra/x11/constants/summary.txt
new file mode 100644 (file)
index 0000000..9580806
--- /dev/null
@@ -0,0 +1 @@
+Xlib constants
diff --git a/extra/x11/events/authors.txt b/extra/x11/events/authors.txt
new file mode 100644 (file)
index 0000000..db8d844
--- /dev/null
@@ -0,0 +1,2 @@
+Eduardo Cavazos
+Slava Pestov
diff --git a/extra/x11/events/events.factor b/extra/x11/events/events.factor
new file mode 100644 (file)
index 0000000..05b3318
--- /dev/null
@@ -0,0 +1,84 @@
+! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types arrays hashtables io kernel math
+namespaces prettyprint sequences strings combinators x11.xlib ;
+IN: x11.events
+
+GENERIC: expose-event ( event window -- )
+
+GENERIC: configure-event ( event window -- )
+
+GENERIC: button-down-event ( event window -- )
+
+GENERIC: button-up-event ( event window -- )
+
+GENERIC: enter-event ( event window -- )
+
+GENERIC: leave-event ( event window -- )
+
+GENERIC: wheel-event ( event window -- )
+
+GENERIC: motion-event ( event window -- )
+
+GENERIC: key-down-event ( event window -- )
+
+GENERIC: key-up-event ( event window -- )
+
+GENERIC: focus-in-event ( event window -- )
+
+GENERIC: focus-out-event ( event window -- )
+
+GENERIC: selection-notify-event ( event window -- )
+
+GENERIC: selection-request-event ( event window -- )
+
+GENERIC: client-event ( event window -- )
+
+: next-event ( -- event )
+    dpy get "XEvent" <c-object> dup >r XNextEvent drop r> ;
+
+: mask-event ( mask -- event )
+    >r dpy get r> "XEvent" <c-object> dup >r XMaskEvent drop r> ;
+
+: events-queued ( mode -- n ) >r dpy get r> XEventsQueued ;
+
+: wheel? ( event -- ? ) XButtonEvent-button { 4 5 } member? ;
+
+: button-down-event$ ( event window -- )
+    over wheel? [ wheel-event ] [ button-down-event ] if ;
+
+: button-up-event$ ( event window -- )
+    over wheel? [ 2drop ] [ button-up-event ] if ;
+
+: handle-event ( event window -- )
+    over XAnyEvent-type {
+        { [ dup Expose = ] [ drop expose-event ] }
+        { [ dup ConfigureNotify = ] [ drop configure-event ] }
+        { [ dup ButtonPress = ] [ drop button-down-event$ ] }
+        { [ dup ButtonRelease = ] [ drop button-up-event$ ] }
+        { [ dup EnterNotify = ] [ drop enter-event ] }
+        { [ dup LeaveNotify = ] [ drop leave-event ] }
+        { [ dup MotionNotify = ] [ drop motion-event ] }
+        { [ dup KeyPress = ] [ drop key-down-event ] }
+        { [ dup KeyRelease = ] [ drop key-up-event ] }
+        { [ dup FocusIn = ] [ drop focus-in-event ] }
+        { [ dup FocusOut = ] [ drop focus-out-event ] }
+        { [ dup SelectionNotify = ] [ drop selection-notify-event ] }
+        { [ dup SelectionRequest = ] [ drop selection-request-event ] }
+        { [ dup ClientMessage = ] [ drop client-event ] }
+        { [ t ] [ 3drop ] }
+    } cond ;
+
+: configured-loc ( event -- dim )
+    dup XConfigureEvent-x swap XConfigureEvent-y 2array ;
+
+: configured-dim ( event -- dim )
+    dup XConfigureEvent-width swap XConfigureEvent-height 2array ;
+
+: mouse-event-loc ( event -- loc )
+    dup XButtonEvent-x swap XButtonEvent-y 2array ;
+
+: close-box? ( event -- ? )
+    dup XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom =
+    swap XClientMessageEvent-data0 "WM_DELETE_WINDOW" x-atom =
+    and ;
diff --git a/extra/x11/events/summary.txt b/extra/x11/events/summary.txt
new file mode 100644 (file)
index 0000000..532a996
--- /dev/null
@@ -0,0 +1 @@
+Xlib events
diff --git a/extra/x11/glx/authors.txt b/extra/x11/glx/authors.txt
new file mode 100644 (file)
index 0000000..db8d844
--- /dev/null
@@ -0,0 +1,2 @@
+Eduardo Cavazos
+Slava Pestov
diff --git a/extra/x11/glx/glx.factor b/extra/x11/glx/glx.factor
new file mode 100644 (file)
index 0000000..5402575
--- /dev/null
@@ -0,0 +1,111 @@
+! Copyright (C) 2005, 2006 Eduardo Cavazos and Alex Chapman
+! See http://factorcode.org/license.txt for BSD license.
+!
+! based on glx.h from xfree86, and some of glxtokens.h
+USING: alien alien.c-types alien.syntax x11.xlib
+namespaces kernel sequences ;
+IN: x11.glx
+
+LIBRARY: glx
+
+! Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib)
+: GLX_USE_GL           1  ; ! support GLX rendering
+: GLX_BUFFER_SIZE      2  ; ! depth of the color buffer
+: GLX_LEVEL            3  ; ! level in plane stacking
+: GLX_RGBA             4  ; ! true if RGBA mode
+: GLX_DOUBLEBUFFER     5  ; ! double buffering supported
+: GLX_STEREO           6  ; ! stereo buffering supported
+: GLX_AUX_BUFFERS      7  ; ! number of aux buffers
+: GLX_RED_SIZE         8  ; ! number of red component bits
+: GLX_GREEN_SIZE       9  ; ! number of green component bits
+: GLX_BLUE_SIZE                10 ; ! number of blue component bits
+: GLX_ALPHA_SIZE       11 ; ! number of alpha component bits
+: GLX_DEPTH_SIZE       12 ; ! number of depth bits
+: GLX_STENCIL_SIZE     13 ; ! number of stencil bits
+: GLX_ACCUM_RED_SIZE   14 ; ! number of red accum bits
+: GLX_ACCUM_GREEN_SIZE 15 ; ! number of green accum bits
+: GLX_ACCUM_BLUE_SIZE  16 ; ! number of blue accum bits
+: GLX_ACCUM_ALPHA_SIZE 17 ; ! number of alpha accum bits
+
+TYPEDEF: XID GLXContextID
+TYPEDEF: XID GLXPixmap
+TYPEDEF: XID GLXDrawable
+TYPEDEF: XID GLXPbuffer
+TYPEDEF: XID GLXWindow
+TYPEDEF: XID GLXFBConfigID
+TYPEDEF: void* GLXContext  ! typedef struct __GLXcontextRec *GLXContext;
+TYPEDEF: void* GLXFBConfig ! typedef struct __GLXFBConfigRec *GLXFBConfig;
+
+FUNCTION: XVisualInfo* glXChooseVisual ( Display* dpy, int screen, int* attribList ) ;
+FUNCTION: void glXCopyContext ( Display* dpy, GLXContext src, GLXContext dst, ulong mask ) ;
+FUNCTION: GLXContext glXCreateContext ( Display* dpy, XVisualInfo* vis, GLXContext shareList, bool direct ) ;
+FUNCTION: GLXPixmap glXCreateGLXPixmap ( Display* dpy, XVisualInfo* vis, Pixmap pixmap ) ;
+FUNCTION: void glXDestroyContext ( Display* dpy, GLXContext ctx ) ;
+FUNCTION: void glXDestroyGLXPixmap ( Display* dpy, GLXPixmap pix ) ;
+FUNCTION: int glXGetConfig ( Display* dpy, XVisualInfo* vis, int attrib, int* value) ;
+FUNCTION: GLXContext glXGetCurrentContext ( ) ;
+FUNCTION: GLXDrawable glXGetCurrentDrawable ( ) ;
+FUNCTION: bool glXIsDirect ( Display* dpy, GLXContext ctx ) ;
+FUNCTION: bool glXMakeCurrent ( Display* dpy, GLXDrawable drawable, GLXContext ctx ) ;
+FUNCTION: bool glXQueryExtension ( Display* dpy, int* errorBase, int* eventBase ) ;
+FUNCTION: bool glXQueryVersion ( Display* dpy, int* major, int* minor ) ;
+FUNCTION: void glXSwapBuffers ( Display* dpy, GLXDrawable drawable ) ;
+FUNCTION: void glXUseXFont ( Font font, int first, int count, int listBase ) ;
+FUNCTION: void glXWaitGL ( ) ;
+FUNCTION: void glXWaitX ( ) ;
+FUNCTION: char* glXGetClientString ( Display* dpy, int name ) ;
+FUNCTION: char* glXQueryServerString ( Display* dpy, int screen, int name ) ;
+FUNCTION: char* glXQueryExtensionsString ( Display* dpy, int screen ) ;
+
+! New for GLX 1.3
+FUNCTION: GLXFBConfig* glXGetFBConfigs ( Display* dpy, int screen, int* nelements ) ;
+FUNCTION: GLXFBConfig* glXChooseFBConfig ( Display* dpy, int screen, int* attrib_list, int* nelements ) ;
+FUNCTION: int glXGetFBConfigAttrib ( Display* dpy, GLXFBConfig config, int attribute, int* value ) ;
+FUNCTION: XVisualInfo* glXGetVisualFromFBConfig ( Display* dpy, GLXFBConfig config ) ;
+FUNCTION: GLXWindow glXCreateWindow ( Display* dpy, GLXFBConfig config, Window win, int* attrib_list ) ;
+FUNCTION: void glXDestroyWindow ( Display* dpy, GLXWindow win ) ;
+FUNCTION: GLXPixmap glXCreatePixmap ( Display* dpy, GLXFBConfig config, Pixmap pixmap, int* attrib_list ) ;
+FUNCTION: void glXDestroyPixmap ( Display* dpy, GLXPixmap pixmap ) ;
+FUNCTION: GLXPbuffer glXCreatePbuffer ( Display* dpy, GLXFBConfig config, int* attrib_list ) ;
+FUNCTION: void glXDestroyPbuffer ( Display* dpy, GLXPbuffer pbuf ) ;
+FUNCTION: void glXQueryDrawable ( Display* dpy, GLXDrawable draw, int attribute, uint* value ) ;
+FUNCTION: GLXContext glXCreateNewContext ( Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, bool direct ) ;
+FUNCTION: bool glXMakeContextCurrent ( Display* display, GLXDrawable draw, GLXDrawable read, GLXContext ctx ) ;
+FUNCTION: GLXDrawable glXGetCurrentReadDrawable ( ) ;
+FUNCTION: Display*  glXGetCurrentDisplay ( ) ;
+FUNCTION: int glXQueryContext ( Display* dpy, GLXContext ctx, int attribute, int* value ) ;
+FUNCTION: void glXSelectEvent ( Display* dpy, GLXDrawable draw, ulong event_mask ) ;
+FUNCTION: void glXGetSelectedEvent ( Display* dpy, GLXDrawable draw, ulong* event_mask ) ;
+
+! GLX 1.4 and later
+FUNCTION: void* glXGetProcAddress ( char* procname ) ;
+
+! GLX Events
+! (also skipped for now. only has GLXPbufferClobberEvent, the rest is handled by xlib methinks
+
+: choose-visual ( -- XVisualInfo* )
+    dpy get scr get
+    [
+        GLX_RGBA ,
+        GLX_DOUBLEBUFFER ,
+        GLX_DEPTH_SIZE , 16 ,
+        0 ,
+    ] { } make >c-int-array
+    glXChooseVisual
+    [ "Could not get a double-buffered GLX RGBA visual" throw ] unless* ;
+
+: create-glx ( XVisualInfo* -- GLXContext )
+    >r dpy get r> f 1 glXCreateContext
+    [ "Failed to create GLX context" throw ] unless* ;
+
+: destroy-glx ( GLXContext -- )
+    dpy get swap glXDestroyContext ;
+
+: copy-sub-buffer-supported? ( -- ? )
+    "GLX_MESA_copy_sub_buffer"
+    dpy get scr get glXQueryExtensionsString subseq? ;
+
+: glXCopySubBufferMESA ( dpy drawable x y width height -- )
+    "glXCopySubBufferMESA" glXGetProcAddress
+    "void" { "Display*" "GLXDrawable" "int" "int" "int" "int" }
+    "cdecl" alien-indirect ;
\ No newline at end of file
diff --git a/extra/x11/glx/summary.txt b/extra/x11/glx/summary.txt
new file mode 100644 (file)
index 0000000..499a8b8
--- /dev/null
@@ -0,0 +1 @@
+GLX (X11 OpenGL) binding
diff --git a/extra/x11/glx/tags.txt b/extra/x11/glx/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/x11/summary.txt b/extra/x11/summary.txt
new file mode 100644 (file)
index 0000000..afb0ebc
--- /dev/null
@@ -0,0 +1 @@
+X11 Xlib and GLX bindings
diff --git a/extra/x11/tags.txt b/extra/x11/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/x11/windows/authors.txt b/extra/x11/windows/authors.txt
new file mode 100644 (file)
index 0000000..db8d844
--- /dev/null
@@ -0,0 +1,2 @@
+Eduardo Cavazos
+Slava Pestov
diff --git a/extra/x11/windows/summary.txt b/extra/x11/windows/summary.txt
new file mode 100644 (file)
index 0000000..e8b6bf0
--- /dev/null
@@ -0,0 +1 @@
+Xlib window management utilities
diff --git a/extra/x11/windows/windows.factor b/extra/x11/windows/windows.factor
new file mode 100644 (file)
index 0000000..1f44460
--- /dev/null
@@ -0,0 +1,66 @@
+! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types hashtables kernel math math.vectors
+namespaces sequences x11.xlib x11.constants x11.glx ;
+IN: x11.windows
+
+: create-window-mask ( -- n )
+    CWBackPixel CWBorderPixel bitor
+    CWColormap bitor CWEventMask bitor ;
+
+: create-colormap ( visinfo -- colormap )
+    dpy get root get rot XVisualInfo-visual AllocNone
+    XCreateColormap ;
+
+: event-mask ( -- n )
+    ExposureMask
+    StructureNotifyMask bitor
+    KeyPressMask bitor
+    KeyReleaseMask bitor
+    ButtonPressMask    bitor
+    ButtonReleaseMask bitor
+    PointerMotionMask bitor
+    FocusChangeMask bitor
+    EnterWindowMask bitor
+    LeaveWindowMask bitor
+    PropertyChangeMask bitor ;
+
+: window-attributes ( visinfo -- attributes )
+    "XSetWindowAttributes" <c-object>
+    0 over set-XSetWindowAttributes-background_pixel
+    0 over set-XSetWindowAttributes-border_pixel
+    [ >r create-colormap r> set-XSetWindowAttributes-colormap ] keep
+    event-mask over set-XSetWindowAttributes-event_mask ;
+
+: set-size-hints ( window -- )
+    "XSizeHints" <c-object>
+    USPosition over set-XSizeHints-flags
+    dpy get -rot XSetWMNormalHints ;
+
+: auto-position ( window loc -- )
+    { 0 0 } = [ drop ] [ set-size-hints ] if ;
+
+: create-window ( loc dim visinfo -- window )
+    pick >r
+    >r >r >r dpy get root get r> first2 r> { 1 1 } vmax first2 0 r>
+    [ XVisualInfo-depth InputOutput ] keep
+    [ XVisualInfo-visual create-window-mask ] keep
+    window-attributes XCreateWindow
+    dup r> auto-position ;
+
+: glx-window ( loc dim -- window glx )
+    choose-visual
+    [ create-window ] keep
+    [ create-glx ] keep
+    XFree ;
+
+: destroy-window ( win -- )
+    dpy get swap XDestroyWindow drop ;
+
+: set-closable ( win -- )
+    dpy get swap "WM_DELETE_WINDOW" x-atom <Atom> 1
+    XSetWMProtocols drop ;
+
+: map-window ( win -- ) dpy get swap XMapWindow drop ;
+
+: unmap-window ( win -- ) dpy get swap XUnmapWindow drop ;
diff --git a/extra/x11/xim/authors.txt b/extra/x11/xim/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/extra/x11/xim/summary.txt b/extra/x11/xim/summary.txt
new file mode 100644 (file)
index 0000000..2546aa7
--- /dev/null
@@ -0,0 +1 @@
+X11 input method support
diff --git a/extra/x11/xim/tags.txt b/extra/x11/xim/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/x11/xim/xim.factor b/extra/x11/xim/xim.factor
new file mode 100644 (file)
index 0000000..6fb6ada
--- /dev/null
@@ -0,0 +1,48 @@
+! Copyright (C) 2007 Slava Pestov
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.c-types arrays byte-arrays hashtables
+io kernel math namespaces sequences strings
+continuations x11.xlib ;
+IN: x11.xim
+
+SYMBOL: xim
+
+: init-xim ( classname -- )
+    dpy get f rot dup XOpenIM
+    [ "XOpenIM() failed" throw ] unless* xim set-global ;
+
+: close-xim ( -- )
+    xim get-global XCloseIM drop f xim set-global ;
+
+: with-xim ( quot -- )
+    >r "Factor" init-xim r> [ close-xim ] [ ] cleanup ;
+
+: create-xic ( window classname -- xic )
+    >r >r xim get-global
+    XNClientWindow r>
+    XNFocusWindow over
+    XNInputStyle XIMPreeditNothing XIMStatusNothing bitor
+    XNResourceName r>
+    XNResourceClass over 0 XCreateIC
+    [ "XCreateIC() failed" throw ] unless* ;
+
+: buf-size 100 ;
+
+SYMBOL: keybuf
+SYMBOL: keysym
+
+: prepare-lookup ( -- )
+    buf-size "ulong" <c-array> keybuf set
+    0 <KeySym> keysym set ;
+
+: finish-lookup ( len -- string keysym )
+    keybuf get swap c-ulong-array> >string
+    keysym get *KeySym ;
+
+: lookup-string ( event xic -- string keysym )
+    [
+        prepare-lookup
+        swap keybuf get buf-size keysym get 0 <int>
+        XwcLookupString
+        finish-lookup
+    ] with-scope ;
diff --git a/extra/x11/xlib/authors.txt b/extra/x11/xlib/authors.txt
new file mode 100644 (file)
index 0000000..6cfd5da
--- /dev/null
@@ -0,0 +1 @@
+Eduardo Cavazos
diff --git a/extra/x11/xlib/summary.txt b/extra/x11/xlib/summary.txt
new file mode 100644 (file)
index 0000000..7e295b6
--- /dev/null
@@ -0,0 +1 @@
+Xlib binding
diff --git a/extra/x11/xlib/tags.txt b/extra/x11/xlib/tags.txt
new file mode 100644 (file)
index 0000000..bb863cf
--- /dev/null
@@ -0,0 +1 @@
+bindings
diff --git a/extra/x11/xlib/xlib.factor b/extra/x11/xlib/xlib.factor
new file mode 100644 (file)
index 0000000..730c4cf
--- /dev/null
@@ -0,0 +1,1364 @@
+! Copyright (C) 2005, 2006 Eduardo Cavazos
+! See http://factorcode.org/license.txt for BSD license.
+!
+! The most popular guides to programming the X Window System are
+! the series from Oreilly. For programming with Xlib, there is
+! the reference manual and the programmers guide. However, a
+! lesser known manual is the free Xlib manual that comes with
+! the MIT X distribution. The arrangement and order of these
+! bindings follows the structure of the free Xlib manual. If you
+! add to this library and are wondering what part of the file to
+! modify, just find the function or data structure in the manual
+! and note the section.
+
+USING: kernel arrays alien alien.c-types alien.syntax
+math words sequences namespaces continuations ;
+IN: x11.xlib
+
+LIBRARY: xlib
+
+TYPEDEF: ulong XID
+TYPEDEF: XID Window
+TYPEDEF: XID Drawable
+TYPEDEF: XID Font
+TYPEDEF: XID Pixmap
+TYPEDEF: XID Cursor
+TYPEDEF: XID Colormap
+TYPEDEF: XID GContext
+TYPEDEF: XID KeySym
+
+TYPEDEF: ulong Atom
+
+TYPEDEF: char* XPointer
+TYPEDEF: void* Display*
+TYPEDEF: void* Screen*
+TYPEDEF: void* GC
+TYPEDEF: void* Visual*
+TYPEDEF: void* XExtData*
+TYPEDEF: void* XFontProp*
+TYPEDEF: void* XComposeStatus*
+TYPEDEF: void* XIM
+TYPEDEF: void* XIC
+
+TYPEDEF: int Status
+
+TYPEDEF: int Bool
+
+TYPEDEF: ulong VisualID
+TYPEDEF: ulong Time
+
+TYPEDEF: void* Window**
+TYPEDEF: void* Atom**
+
+: <XID> <ulong> ; inline
+: <Window> <XID> ; inline
+: <Drawable> <XID> ; inline
+: <KeySym> <XID> ; inline
+: <Atom> <ulong> ; inline
+
+: *XID *ulong ; inline
+: *Window *XID ; inline
+: *Drawable *XID ; inline
+: *KeySym *XID ; inline
+: *Atom *ulong ; inline
+!
+! 2 - Display Functions
+!
+
+FUNCTION: Display* XOpenDisplay ( void* display_name ) ;
+
+! 2.2 Obtaining Information about the Display, Image Formats, or Screens
+
+FUNCTION: ulong XBlackPixel ( Display* display, int screen_number ) ;
+FUNCTION: ulong XWhitePixel ( Display* display, int screen_number ) ;
+FUNCTION: Colormap XDefaultColormap ( Display* display, int screen_number ) ;
+FUNCTION: int XDefaultDepth ( Display* display, int screen_number ) ;
+FUNCTION: GC XDefaultGC ( Display* display, int screen_number ) ;
+FUNCTION: int XDefaultScreen ( Display* display ) ;
+FUNCTION: Window XRootWindow ( Display* display, int screen_number ) ;
+FUNCTION: Window XDefaultRootWindow ( Display* display ) ;
+FUNCTION: int XProtocolVersion ( Display* display ) ;
+FUNCTION: int XProtocolRevision ( Display* display ) ;
+FUNCTION: int XQLength ( Display* display ) ;
+FUNCTION: int XScreenCount ( Display* display ) ;
+FUNCTION: int XConnectionNumber ( Display* display ) ;
+
+! 2.5 Closing the Display
+FUNCTION: int XCloseDisplay ( Display* display ) ;
+
+!
+! 3 - Window Functions
+!
+
+! 3.2 - Window Attributes
+
+: CWBackPixmap         1 0 shift ; inline
+: CWBackPixel          1 1 shift ; inline
+: CWBorderPixmap       1 2 shift ; inline
+: CWBorderPixel         1 3 shift ; inline
+: CWBitGravity         1 4 shift ; inline
+: CWWinGravity         1 5 shift ; inline
+: CWBackingStore        1 6 shift ; inline
+: CWBackingPlanes      1 7 shift ; inline
+: CWBackingPixel       1 8 shift ; inline
+: CWOverrideRedirect   1 9 shift ; inline
+: CWSaveUnder          1 10 shift ; inline
+: CWEventMask          1 11 shift ; inline
+: CWDontPropagate      1 12 shift ; inline
+: CWColormap           1 13 shift ; inline
+: CWCursor             1 14 shift ; inline
+
+C-STRUCT: XSetWindowAttributes
+       { "Pixmap" "background_pixmap" }
+       { "ulong" "background_pixel" }
+       { "Pixmap" "border_pixmap" }
+       { "ulong" "border_pixel" }
+       { "int" "bit_gravity" }
+       { "int" "win_gravity" }
+       { "int" "backing_store" }
+       { "ulong" "backing_planes" }
+       { "ulong" "backing_pixel" }
+       { "Bool" "save_under" }
+       { "long" "event_mask" }
+       { "long" "do_not_propagate_mask" }
+       { "Bool" "override_redirect" }
+       { "Colormap" "colormap" }
+       { "Cursor" "cursor" } ;
+
+: UnmapGravity         0 ; inline
+
+: ForgetGravity                0 ; inline
+: NorthWestGravity     1 ; inline
+: NorthGravity         2 ; inline
+: NorthEastGravity     3 ; inline
+: WestGravity          4 ; inline
+: CenterGravity                5 ; inline
+: EastGravity          6 ; inline
+: SouthWestGravity     7 ; inline
+: SouthGravity         8 ; inline
+: SouthEastGravity     9 ; inline
+: StaticGravity                10 ; inline
+
+! 3.3 - Creating Windows
+
+FUNCTION: Window XCreateWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class, Visual* visual, ulong valuemask, XSetWindowAttributes* attributes ) ;
+FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ;
+FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ;
+FUNCTION: Status XMapWindow ( Display* display, Window window ) ;
+FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ;
+FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ;
+FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ;
+
+! 3.5 Mapping Windows
+
+FUNCTION: int XMapRaised ( Display* display, Window w ) ;
+
+! 3.7 - Configuring Windows
+
+: CWX                  1 0 shift ; inline
+: CWY                  1 1 shift ; inline
+: CWWidth              1 2 shift ; inline
+: CWHeight             1 3 shift ; inline
+: CWBorderWidth                1 4 shift ; inline
+: CWSibling            1 5 shift ; inline
+: CWStackMode          1 6 shift ; inline
+
+C-STRUCT: XWindowChanges
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "width" }
+       { "int" "height" }
+       { "int" "border_width" }
+       { "Window" "sibling" }
+       { "int" "stack_mode" } ;
+
+FUNCTION: Status XConfigureWindow ( Display* display, Window w, uint value_mask, XWindowChanges* values ) ;
+FUNCTION: Status XMoveWindow ( Display* display, Window w, int x, int y ) ;
+FUNCTION: Status XResizeWindow ( Display* display, Window w, uint width, uint height ) ;
+FUNCTION: Status XSetWindowBorderWidth ( Display* display, ulong w, uint width ) ;
+
+
+! 3.8 Changing Window Stacking Order
+
+FUNCTION: Status XRaiseWindow ( Display* display, Window w ) ;
+FUNCTION: Status XLowerWindow ( Display* display, Window w ) ;
+
+! 3.9 - Changing Window Attributes
+
+FUNCTION: Status XChangeWindowAttributes (
+  Display* display, Window w, ulong valuemask, XSetWindowAttributes* attr ) ;
+FUNCTION: Status XSetWindowBackground (
+  Display* display, Window w, ulong background_pixel ) ;
+FUNCTION: Status XDefineCursor ( Display* display, Window w, Cursor cursor ) ;
+FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 4 - Window Information Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 4.1 - Obtaining Window Information
+
+FUNCTION: Status XQueryTree (
+  Display* display,
+  Window w,
+  Window* root_return,
+  Window* parent_return,
+  Window** children_return, uint* nchildren_return ) ;
+
+C-STRUCT: XWindowAttributes
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "width" }
+       { "int" " height" }
+       { "int" "border_width" }
+       { "int" "depth" }
+       { "Visual*" "visual" }
+       { "Window" "root" }
+       { "int" "class" }
+       { "int" "bit_gravity" }
+       { "int" "win_gravity" }
+       { "int" "backing_store" }
+       { "ulong" "backing_planes" }
+       { "ulong" "backing_pixel" }
+       { "Bool" "save_under" }
+       { "Colormap" "colormap" }
+       { "Bool" "map_installed" }
+       { "int" "map_state" }
+       { "long" "all_event_masks" }
+       { "long" "your_event_mask" }
+       { "long" "do_not_propagate_mask" }
+       { "Bool" "override_redirect" }
+       { "Screen*" "screen" } ;
+
+FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
+
+: IsUnmapped           0 ; inline
+: IsUnviewable         1 ; inline
+: IsViewable           2 ; inline
+
+FUNCTION: Status XGetGeometry (
+  Display* display,
+  Drawable d,
+  Window* root_return,
+  int* x_return,
+  int* y_return,
+  uint* width_return,
+  uint* height_return,
+  uint* border_width_return,
+  uint* depth_return ) ;
+
+! 4.2 - Translating Screen Coordinates
+
+FUNCTION: Bool XQueryPointer ( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, uint* mask_return ) ;
+
+! 4.3 - Properties and Atoms
+
+FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
+
+FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
+
+! 4.4 - Obtaining and Changing Window Properties
+
+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 ) ;
+
+FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, void* data, int nelements ) ;
+
+! 4.5 Selections
+
+FUNCTION: int XSetSelectionOwner ( Display* display, Atom selection, Window owner, Time time ) ;
+
+FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ;
+
+FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 6 - Color Management Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XColor
+       { "ulong" "pixel" }
+       { "ushort" "red" }
+       { "ushort" "green" }
+       { "ushort" "blue" }
+       { "char" "flags" }
+       { "char" "pad" } ;
+
+FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color_name, XColor* exact_def_return, XColor* screen_def_return ) ;
+FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
+FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
+
+! 6.4 Creating, Copying, and Destroying Colormaps
+
+FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 7 - Graphics Context Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: GCFunction            1 0 shift ; inline
+: GCPlaneMask           1 1 shift ; inline
+: GCForeground          1 2 shift ; inline
+: GCBackground          1 3 shift ; inline
+: GCLineWidth           1 4 shift ; inline
+: GCLineStyle           1 5 shift ; inline
+: GCCapStyle            1 6 shift ; inline
+: GCJoinStyle          1 7 shift ; inline
+: GCFillStyle          1 8 shift ; inline
+: GCFillRule           1 9 shift ; inline
+: GCTile               1 10 shift ; inline
+: GCStipple            1 11 shift ; inline
+: GCTileStipXOrigin    1 12 shift ; inline
+: GCTileStipYOrigin    1 13 shift ; inline
+: GCFont               1 14 shift ; inline
+: GCSubwindowMode      1 15 shift ; inline
+: GCGraphicsExposures   1 16 shift ; inline
+: GCClipXOrigin                1 17 shift ; inline
+: GCClipYOrigin                1 18 shift ; inline
+: GCClipMask           1 19 shift ; inline
+: GCDashOffset         1 20 shift ; inline
+: GCDashList           1 21 shift ; inline
+: GCArcMode            1 22 shift ; inline
+
+: GXclear              HEX: 0 ; inline
+: GXand                        HEX: 1 ; inline
+: GXandReverse         HEX: 2 ; inline
+: GXcopy               HEX: 3 ; inline
+: GXandInverted                HEX: 4 ; inline
+: GXnoop               HEX: 5 ; inline
+: GXxor                        HEX: 6 ; inline
+: GXor                 HEX: 7 ; inline
+: GXnor                        HEX: 8 ; inline
+: GXequiv              HEX: 9 ; inline
+: GXinvert             HEX: a ; inline
+: GXorReverse          HEX: b ; inline
+: GXcopyInverted       HEX: c ; inline
+: GXorInverted         HEX: d ; inline
+: GXnand               HEX: e ; inline
+: GXset                        HEX: f ; inline
+
+C-STRUCT: XGCValues
+       { "int" "function" }
+       { "ulong" "plane_mask" }
+       { "ulong" "foreground" }
+       { "ulong" "background" }
+       { "int" "line_width" }
+       { "int" "line_style" }
+       { "int" "cap_style" }
+       { "int" "join_style" }
+       { "int" "fill_style" }
+       { "int" "fill_rule" }
+       { "int" "arc_mode" }
+       { "Pixmap" "tile" }
+       { "Pixmap" "stipple" }
+       { "int" "ts_x_origin" }
+       { "int" "ts_y_origin" }
+       { "Font" "font" }
+       { "int" "subwindow_mode" }
+       { "Bool" "graphics_exposures" }
+       { "int" "clip_x_origin" }
+       { "int" "clip_y_origin" }
+       { "Pixmap" "clip_mask" }
+       { "int" "dash_offset" }
+       { "char" "dashes" } ;
+
+FUNCTION: GC XCreateGC ( Display* display, Window d, ulong valuemask, XGCValues* values ) ;
+FUNCTION: int XChangeGC ( Display* display, GC gc, ulong valuemask, XGCValues* values ) ;
+FUNCTION: Status XGetGCValues ( Display* display, GC gc, ulong valuemask, XGCValues* values_return ) ;
+FUNCTION: Status XSetForeground ( Display* display, GC gc, ulong foreground ) ;
+FUNCTION: Status XSetBackground ( Display* display, GC gc, ulong background ) ;
+FUNCTION: Status XSetFunction ( Display* display, GC gc, int function ) ;
+FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode ) ;
+
+FUNCTION: GContext XGContextFromGC ( GC gc ) ;
+
+FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 8 - Graphics Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
+FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
+FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1, int x2, int y2 ) ;
+FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
+FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
+
+! 8.5 - Font Metrics
+
+C-STRUCT: XCharStruct
+       { "short" "lbearing" }
+       { "short" "rbearing" }
+       { "short" "width" }
+       { "short" "ascent" }
+       { "short" "descent" }
+       { "ushort" "attributes" } ;
+
+FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
+FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
+FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
+
+C-STRUCT: XFontStruct
+       { "XExtData*" "ext_data" }
+       { "Font" "fid" }
+       { "uint" "direction" }
+       { "uint" "min_char_or_byte2" }
+       { "uint" "max_char_or_byte2" }
+       { "uint" "min_byte1" }
+       { "uint" "max_byte1" }
+       { "Bool" "all_chars_exist" }
+       { "uint" "default_char" }
+       { "int" "n_properties" }
+       { "XFontProp*" "properties" }
+       { "XCharStruct" "min_bounds" }
+       { "XCharStruct" "max_bounds" }
+       { "XCharStruct*" "per_char" }
+       { "int" "ascent" }
+       { "int" "descent" } ;
+
+FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
+
+! 8.6 - Drawing Text
+
+FUNCTION: Status XDrawString (
+       Display* display,
+       Drawable d,
+       GC gc,
+       int x,
+       int y,
+       char* string,
+       int length ) ;
+
+!
+! 9 - Window and Session Manager Functions
+!
+
+FUNCTION: Status XReparentWindow ( Display* display, Window w, Window parent, int x, int y ) ;
+FUNCTION: Status XAddToSaveSet ( Display* display, Window w ) ;
+FUNCTION: Status XRemoveFromSaveSet ( Display* display, Window w ) ;
+FUNCTION: Status XGrabServer ( Display* display ) ;
+FUNCTION: Status XUngrabServer ( Display* display ) ;
+FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 10 - Events
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 10.3 - Event Masks
+
+: NoEventMask                  0 ; inline
+: KeyPressMask                 1 0 shift ; inline
+: KeyReleaseMask               1 1 shift ; inline
+: ButtonPressMask              1 2 shift ; inline
+: ButtonReleaseMask            1 3 shift ; inline
+: EnterWindowMask              1 4 shift ; inline
+: LeaveWindowMask              1 5 shift ; inline
+: PointerMotionMask            1 6 shift ; inline
+: PointerMotionHintMask                1 7 shift ; inline
+: Button1MotionMask            1 8 shift ; inline
+: Button2MotionMask            1 9 shift ; inline
+: Button3MotionMask            1 10 shift ; inline
+: Button4MotionMask            1 11 shift ; inline
+: Button5MotionMask            1 12 shift ; inline
+: ButtonMotionMask             1 13 shift ; inline
+: KeymapStateMask              1 14 shift ; inline
+: ExposureMask                 1 15 shift ; inline
+: VisibilityChangeMask         1 16 shift ; inline
+: StructureNotifyMask          1 17 shift ; inline
+: ResizeRedirectMask           1 18 shift ; inline
+: SubstructureNotifyMask       1 19 shift ; inline
+: SubstructureRedirectMask     1 20 shift ; inline
+: FocusChangeMask              1 21 shift ; inline
+: PropertyChangeMask           1 22 shift ; inline
+: ColormapChangeMask           1 23 shift ; inline
+: OwnerGrabButtonMask          1 24 shift ; inline
+
+: KeyPress             2 ; inline
+: KeyRelease           3 ; inline
+: ButtonPress          4 ; inline
+: ButtonRelease                5 ; inline
+: MotionNotify         6 ; inline
+: EnterNotify          7 ; inline
+: LeaveNotify          8 ; inline
+: FocusIn                      9 ; inline
+: FocusOut             10 ; inline
+: KeymapNotify         11 ; inline
+: Expose                       12 ; inline
+: GraphicsExpose               13 ; inline
+: NoExpose             14 ; inline
+: VisibilityNotify     15 ; inline
+: CreateNotify         16 ; inline
+: DestroyNotify                17 ; inline
+: UnmapNotify          18 ; inline
+: MapNotify            19 ; inline
+: MapRequest           20 ; inline
+: ReparentNotify               21 ; inline
+: ConfigureNotify              22 ; inline
+: ConfigureRequest     23 ; inline
+: GravityNotify                24 ; inline
+: ResizeRequest                25 ; inline
+: CirculateNotify              26 ; inline
+: CirculateRequest     27 ; inline
+: PropertyNotify               28 ; inline
+: SelectionClear               29 ; inline
+: SelectionRequest     30 ; inline
+: SelectionNotify              31 ; inline
+: ColormapNotify               32 ; inline
+: ClientMessage                33 ; inline
+: MappingNotify                34 ; inline
+: LASTEvent            35 ; inline
+
+C-STRUCT: XAnyEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 10.5 Keyboard and Pointer Events
+
+: Button1 1 ; inline
+: Button2 2 ; inline
+: Button3 3 ; inline
+: Button4 4 ; inline
+: Button5 5 ; inline
+
+: Button1Mask          1 8  shift ; inline
+: Button2Mask          1 9  shift ; inline
+: Button3Mask          1 10 shift ; inline
+: Button4Mask          1 11 shift ; inline
+: Button5Mask          1 12 shift ; inline
+
+: ShiftMask    1 0 shift ; inline
+: LockMask     1 1 shift ; inline
+: ControlMask  1 2 shift ; inline
+: Mod1Mask     1 3 shift ; inline
+: Mod2Mask     1 4 shift ; inline
+: Mod3Mask     1 5 shift ; inline
+: Mod4Mask     1 6 shift ; inline
+: Mod5Mask     1 7 shift ; inline
+
+C-STRUCT: XButtonEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Window" "root" }
+       { "Window" "subwindow" }
+       { "Time" "time" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "x_root" }
+       { "int" "y_root" }
+       { "uint" "state" }
+       { "uint" "button" }
+       { "Bool" "same_screen" } ;
+
+TYPEDEF: XButtonEvent XButtonPressedEvent
+TYPEDEF: XButtonEvent XButtonReleasedEvent
+
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XKeyEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Window" "root" }
+       { "Window" "subwindow" }
+       { "Time" "time" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "x_root" }
+       { "int" "y_root" }
+       { "uint" "state" }
+       { "uint" "keycode" }
+       { "Bool" "same_screen" } ;
+
+TYPEDEF: XKeyEvent XKeyPressedEvent
+TYPEDEF: XKeyEvent XKeyReleasedEvent
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XMotionEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Window" "root" }
+       { "Window" "subwindow" }
+       { "Time" "time" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "x_root" }
+       { "int" "y_root" }
+       { "uint" "state" }
+       { "char" "is_hint" }
+       { "Bool" "same_screen" } ;
+
+TYPEDEF: XMotionEvent XPointerMovedEvent
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XCrossingEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Window" "root" }
+       { "Window" "subwindow" }
+       { "Time" "time" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "x_root" }
+       { "int" "y_root" }
+       { "int" "mode" }
+       { "int" "detail" }
+       { "Bool" "same_screen" }
+       { "Bool" "focus" }
+       { "uint" "state" } ;
+
+TYPEDEF: XCrossingEvent XEnterWindowEvent
+TYPEDEF: XCrossingEvent XLeaveWindowEvent
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XFocusChangeEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "int" "mode" }
+       { "int" "detail" } ;
+
+TYPEDEF: XFocusChangeEvent XFocusInEvent
+TYPEDEF: XFocusChangeEvent XFocusOutEvent
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XExposeEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "width" }
+       { "int" "height" }
+       { "int" "count" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XGraphicsExposeEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Drawable" "drawable" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "width" }
+       { "int" "height" }
+       { "int" "count" }
+       { "int" "major_code" }
+       { "int" "minor_code" } ;
+
+C-STRUCT: XNoExposeEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Drawable" "drawable" }
+       { "int" "major_code" }
+       { "int" "minor_code" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XVisibilityEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "int" "state" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XCreateWindowEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "parent" }
+       { "Window" "window" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "width" }
+       { "int" "height" }
+       { "int" "border_width" }
+       { "Bool" "override_redirect" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XDestroyWindowEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "event" }
+       { "Window" "window" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XUnmapEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "event" }
+       { "Window" "window" }
+       { "Bool" "from_configure" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XMapEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "event" }
+       { "Window" "window" }
+       { "Bool" "override_redirect" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XMapRequestEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "parent" }
+       { "Window" "window" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XReparentEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "event" }
+       { "Window" "window" }
+       { "Window" "parent" }
+       { "int" "x" }
+       { "int" "y" }
+       { "Bool" "override_redirect" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XConfigureEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "event" }
+       { "Window" "window" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "width" }
+       { "int" "height" }
+       { "int" "border_width" }
+       { "Window" "above" }
+       { "Bool" "override_redirect" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XGravityEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "event" }
+       { "Window" "window" }
+       { "int" "x" }
+       { "int" "y" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XResizeRequestEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "int" "width" }
+       { "int" "height" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XConfigureRequestEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "parent" }
+       { "Window" "window" }
+       { "int" "x" }
+       { "int" "y" }
+       { "int" "width" }
+       { "int" "height" }
+       { "int" "border_width" }
+       { "Window" "above" }
+       { "int" "detail" }
+       { "ulong" "value_mask" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XCirculateEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "event" }
+       { "Window" "window" }
+       { "int" "place" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XCirculateRequestEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "parent" }
+       { "Window" "window" }
+       { "int" "place" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XPropertyEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Atom" "atom" }
+       { "Time" "time" }
+       { "int" "state" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XSelectionClearEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Atom" "selection" }
+       { "Time" "time" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XSelectionRequestEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "owner" }
+       { "Window" "requestor" }
+       { "Atom" "selection" }
+       { "Atom" "target" }
+       { "Atom" "property" }
+       { "Time" "time" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XSelectionEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "requestor" }
+       { "Atom" "selection" }
+       { "Atom" "target" }
+       { "Atom" "property" }
+       { "Time" "time" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XColormapEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Colormap" "colormap" }
+       { "Bool" "new" }
+       { "int" "state" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XClientMessageEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "Atom" "message_type" }
+       { "int" "format" }
+       { "long" "data0" }
+       { "long" "data1" }
+       { "long" "data2" }
+       { "long" "data3" }
+       { "long" "data4" }
+!       union {
+!              char  b[20];
+!              short s[10];
+!              long  l[5];
+!      } data;
+;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XMappingEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       { "int" "request" }
+       { "int" "first_keycode" }
+       { "int" "count" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XErrorEvent
+       { "int" "type" }
+       { "Display*" "display" }
+       { "XID" "resourceid" }
+       { "ulong" "serial" }
+       { "uchar" "error_code" }
+       { "uchar" "request_code" }
+       { "uchar" "minor_code" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+C-STRUCT: XKeymapEvent
+       { "int" "type" }
+       { "ulong" "serial" }
+       { "Bool" "send_event" }
+       { "Display*" "display" }
+       { "Window" "window" }
+       ! char key_vector[32];
+       { "int" "pad" }
+       { "int" "pad" }
+       { "int" "pad" }
+       { "int" "pad" }
+       { "int" "pad" }
+       { "int" "pad" }
+       { "int" "pad" }
+       { "int" "pad" } ;
+
+C-UNION: XEvent
+       "int"
+       "XAnyEvent"
+       "XKeyEvent"
+       "XButtonEvent"
+       "XMotionEvent"
+       "XCrossingEvent"
+       "XFocusChangeEvent"
+       "XExposeEvent"
+       "XGraphicsExposeEvent"
+       "XNoExposeEvent"
+       "XVisibilityEvent"
+       "XCreateWindowEvent"
+       "XDestroyWindowEvent"
+       "XUnmapEvent"
+       "XMapEvent"
+       "XMapRequestEvent"
+       "XReparentEvent"
+       "XConfigureEvent"
+       "XGravityEvent"
+       "XResizeRequestEvent"
+       "XConfigureRequestEvent"
+       "XCirculateEvent"
+       "XCirculateRequestEvent"
+       "XPropertyEvent"
+       "XSelectionClearEvent"
+       "XSelectionRequestEvent"
+       "XSelectionEvent"
+       "XColormapEvent"
+       "XClientMessageEvent"
+       "XMappingEvent"
+       "XErrorEvent"
+       "XKeymapEvent"
+       { "long" 24 } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 11 - Event Handling Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
+FUNCTION: Status XFlush ( Display* display ) ;
+FUNCTION: Status XSync ( Display* display, int discard ) ;
+FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
+FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
+
+! 11.3 - Event Queue Management
+
+: QueuedAlready 0 ; inline
+: QueuedAfterReading 1 ; inline
+: QueuedAfterFlush 2 ; inline
+
+FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
+FUNCTION: int XPending ( Display* display ) ;
+
+! 11.6 - Sending Events to Other Applications
+
+FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
+
+! 11.8 - Handling Protocol Errors
+
+FUNCTION: int XSetErrorHandler ( void* handler ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 12 - Input Device Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: None 0 ; inline
+
+FUNCTION: int XGrabPointer (
+  Display* display,
+  Window grab_window,
+  Bool owner_events,
+  uint event_mask,
+  int pointer_mode,
+  int keyboard_mode,
+  Window confine_to,
+  Cursor cursor,
+  Time time ) ;
+
+FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
+FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
+FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
+FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
+
+FUNCTION: Status XGetInputFocus ( Display* display,
+                                 Window*  focus_return,
+                                 int*     revert_to_return ) ;
+
+FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 14 - Inter-Client Communication Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 14.1 Client to Window Manager Communication
+
+FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
+FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
+
+! 14.1.1.  Manipulating Top-Level Windows
+
+FUNCTION: Status XIconifyWindow (
+       Display* display, Window w, int screen_number ) ;
+
+FUNCTION: Status XWithdrawWindow (
+       Display* display, Window w, int screen_number ) ;
+
+! 14.1.6 - Setting and Reading the WM_HINTS Property
+
+! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
+
+: USPosition   1 0 shift ; inline
+: USSize       1 1 shift ; inline
+: PPosition    1 2 shift ; inline
+: PSize                1 3 shift ; inline
+: PMinSize     1 4 shift ; inline
+: PMaxSize     1 5 shift ; inline
+: PResizeInc   1 6 shift ; inline
+: PAspect      1 7 shift ; inline
+: PBaseSize    1 8 shift ; inline
+: PWinGravity  1 9 shift ; inline
+: PAllHints [ PPosition PSize PMinSize PMaxSize PResizeInc PAspect ]
+0 [ execute bitor ] reduce ; inline
+
+C-STRUCT: XSizeHints
+    { "long" "flags" }
+    { "int" "x" }
+    { "int" "y" }
+    { "int" "width" }
+    { "int" "height" }
+    { "int" "min_width" }
+    { "int" "min_height" }
+    { "int" "max_width" }
+    { "int" "max_height" }
+    { "int" "width_inc" }
+    { "int" "height_inc" }
+    { "int" "min_aspect_x" }
+    { "int" "min_aspect_y" }
+    { "int" "max_aspect_x" }
+    { "int" "max_aspect_y" }
+    { "int" "base_width" }
+    { "int" "base_height" }
+    { "int" "win_gravity" } ;
+
+! 14.1.10.  Setting and Reading the WM_PROTOCOLS Property
+
+FUNCTION: Status XSetWMProtocols (
+       Display* display, Window w, Atom* protocols, int count ) ;
+
+FUNCTION: Status XGetWMProtocols (
+       Display* display,
+       Window w,
+       Atom** protocols_return,
+       int* count_return ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 16 - Application Utility Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 16.1 Keyboard Utility Functions
+
+FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
+
+FUNCTION: int XLookupString (
+       XKeyEvent* event_struct,
+       void* buffer_return,
+       int bytes_buffer,
+       KeySym* keysym_return,
+       XComposeStatus* status_in_out ) ;
+
+! 16.7 Determining the Appropriate Visual Type
+
+: VisualNoMask                 HEX: 0 ; inline
+: VisualIDMask                         HEX: 1 ; inline
+: VisualScreenMask             HEX: 2 ; inline
+: VisualDepthMask              HEX: 4 ; inline
+: VisualClassMask              HEX: 8 ; inline
+: VisualRedMaskMask            HEX: 10 ; inline
+: VisualGreenMaskMask          HEX: 20 ; inline
+: VisualBlueMaskMask           HEX: 40 ; inline
+: VisualColormapSizeMask       HEX: 80 ; inline
+: VisualBitsPerRGBMask         HEX: 100 ; inline
+: VisualAllMask                        HEX: 1FF ; inline
+
+C-STRUCT: XVisualInfo
+       { "Visual*" "visual" }
+       { "VisualID" "visualid" }
+       { "int" "screen" }
+       { "uint" "depth" }
+       { "int" "class" }
+       { "ulong" "red_mask" }
+       { "ulong" "green_mask" }
+       { "ulong" "blue_mask" }
+       { "int" "colormap_size" }
+       { "int" "bits_per_rgb" } ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Appendix D - Compatibility Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+FUNCTION: Status XSetStandardProperties (
+       Display* display,
+       Window w,
+       char* window_name,
+       char* icon_name,
+       Pixmap icon_pixmap,
+       char** argv,
+       int argc,
+       XSizeHints* hints ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: XA_PRIMARY  1 ; inline
+: XA_SECONDARY 2 ; inline
+: XA_ARC 3 ; inline
+: XA_ATOM 4 ; inline
+: XA_BITMAP 5 ; inline
+: XA_CARDINAL 6 ; inline
+: XA_COLORMAP 7 ; inline
+: XA_CURSOR 8 ; inline
+: XA_CUT_BUFFER0 9 ; inline
+: XA_CUT_BUFFER1 10 ; inline
+: XA_CUT_BUFFER2 11 ; inline
+: XA_CUT_BUFFER3 12 ; inline
+: XA_CUT_BUFFER4 13 ; inline
+: XA_CUT_BUFFER5 14 ; inline
+: XA_CUT_BUFFER6 15 ; inline
+: XA_CUT_BUFFER7 16 ; inline
+: XA_DRAWABLE 17 ; inline
+: XA_FONT 18 ; inline
+: XA_INTEGER 19 ; inline
+: XA_PIXMAP 20 ; inline
+: XA_POINT 21 ; inline
+: XA_RECTANGLE 22 ; inline
+: XA_RESOURCE_MANAGER 23 ; inline
+: XA_RGB_COLOR_MAP 24 ; inline
+: XA_RGB_BEST_MAP 25 ; inline
+: XA_RGB_BLUE_MAP 26 ; inline
+: XA_RGB_DEFAULT_MAP 27 ; inline
+: XA_RGB_GRAY_MAP 28 ; inline
+: XA_RGB_GREEN_MAP 29 ; inline
+: XA_RGB_RED_MAP 30 ; inline
+: XA_STRING 31 ; inline
+: XA_VISUALID 32 ; inline
+: XA_WINDOW 33 ; inline
+: XA_WM_COMMAND 34 ; inline
+: XA_WM_HINTS 35 ; inline
+: XA_WM_CLIENT_MACHINE 36 ; inline
+: XA_WM_ICON_NAME 37 ; inline
+: XA_WM_ICON_SIZE 38 ; inline
+: XA_WM_NAME 39 ; inline
+: XA_WM_NORMAL_HINTS 40 ; inline
+: XA_WM_SIZE_HINTS 41 ; inline
+: XA_WM_ZOOM_HINTS 42 ; inline
+: XA_MIN_SPACE 43 ; inline
+: XA_NORM_SPACE 44 ; inline
+: XA_MAX_SPACE 45 ; inline
+: XA_END_SPACE 46 ; inline
+: XA_SUPERSCRIPT_X 47 ; inline
+: XA_SUPERSCRIPT_Y 48 ; inline
+: XA_SUBSCRIPT_X 49 ; inline
+: XA_SUBSCRIPT_Y 50 ; inline
+: XA_UNDERLINE_POSITION 51 ; inline
+: XA_UNDERLINE_THICKNESS 52 ; inline
+: XA_STRIKEOUT_ASCENT 53 ; inline
+: XA_STRIKEOUT_DESCENT 54 ; inline
+: XA_ITALIC_ANGLE 55 ; inline
+: XA_X_HEIGHT 56 ; inline
+: XA_QUAD_WIDTH 57 ; inline
+: XA_WEIGHT 58 ; inline
+: XA_POINT_SIZE 59 ; inline
+: XA_RESOLUTION 60 ; inline
+: XA_COPYRIGHT 61 ; inline
+: XA_NOTICE 62 ; inline
+: XA_FONT_NAME 63 ; inline
+: XA_FAMILY_NAME 64 ; inline
+: XA_FULL_NAME 65 ; inline
+: XA_CAP_HEIGHT 66 ; inline
+: XA_WM_CLASS 67 ; inline
+: XA_WM_TRANSIENT_FOR 68 ; inline
+
+: XA_LAST_PREDEFINED 68 ; inline
+    
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! The rest of the stuff is not from the book.
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+FUNCTION: void XFree ( void* data ) ;
+FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
+
+FUNCTION: void XSetWMNormalHints ( Display* display, Window w, XSizeHints* hints ) ;
+
+! !!! INPUT METHODS
+
+: XIMPreeditArea      HEX: 0001 ;
+: XIMPreeditCallbacks HEX: 0002 ;
+: XIMPreeditPosition  HEX: 0004 ;
+: XIMPreeditNothing   HEX: 0008 ;
+: XIMPreeditNone      HEX: 0010 ;
+: XIMStatusArea       HEX: 0100 ;
+: XIMStatusCallbacks  HEX: 0200 ;
+: XIMStatusNothing    HEX: 0400 ;
+: XIMStatusNone       HEX: 0800 ;
+
+: XNVaNestedList "XNVaNestedList" ;
+: XNQueryInputStyle "queryInputStyle" ;
+: XNClientWindow "clientWindow" ;
+: XNInputStyle "inputStyle" ;
+: XNFocusWindow "focusWindow" ;
+: XNResourceName "resourceName" ;
+: XNResourceClass "resourceClass" ;
+: XNGeometryCallback "geometryCallback" ;
+: XNDestroyCallback "destroyCallback" ;
+: XNFilterEvents "filterEvents" ;
+: XNPreeditStartCallback "preeditStartCallback" ;
+: XNPreeditDoneCallback "preeditDoneCallback" ;
+: XNPreeditDrawCallback "preeditDrawCallback" ;
+: XNPreeditCaretCallback "preeditCaretCallback" ;
+: XNPreeditStateNotifyCallback "preeditStateNotifyCallback" ;
+: XNPreeditAttributes "preeditAttributes" ;
+: XNStatusStartCallback "statusStartCallback" ;
+: XNStatusDoneCallback "statusDoneCallback" ;
+: XNStatusDrawCallback "statusDrawCallback" ;
+: XNStatusAttributes "statusAttributes" ;
+: XNArea "area" ;
+: XNAreaNeeded "areaNeeded" ;
+: XNSpotLocation "spotLocation" ;
+: XNColormap "colorMap" ;
+: XNStdColormap "stdColorMap" ;
+: XNForeground "foreground" ;
+: XNBackground "background" ;
+: XNBackgroundPixmap "backgroundPixmap" ;
+: XNFontSet "fontSet" ;
+: XNLineSpace "lineSpace" ;
+: XNCursor "cursor" ;
+
+: XNQueryIMValuesList "queryIMValuesList" ;
+: XNQueryICValuesList "queryICValuesList" ;
+: XNVisiblePosition "visiblePosition" ;
+: XNR6PreeditCallback "r6PreeditCallback" ;
+: XNStringConversionCallback "stringConversionCallback" ;
+: XNStringConversion "stringConversion" ;
+: XNResetState "resetState" ;
+: XNHotKey "hotKey" ;
+: XNHotKeyState "hotKeyState" ;
+: XNPreeditState "preeditState" ;
+: XNSeparatorofNestedList "separatorofNestedList" ;
+
+: XBufferOverflow -1 ;
+: XLookupNone      1 ;
+: XLookupChars     2 ;
+: XLookupKeySym    3 ;
+: XLookupBoth      4 ;
+
+FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ;
+
+FUNCTION: XIM XOpenIM ( Display* dpy, void* rdb, char* res_name, char* res_class ) ;
+
+FUNCTION: Status XCloseIM ( XIM im ) ;
+
+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 ) ;
+
+FUNCTION: void XDestroyIC ( XIC ic ) ;
+
+FUNCTION: void XSetICFocus ( XIC ic ) ;
+        
+FUNCTION: void XUnsetICFocus ( XIC ic ) ;
+
+FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
+
+FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
+
+SYMBOL: dpy
+SYMBOL: scr
+SYMBOL: root
+
+: flush-dpy ( -- ) dpy get XFlush drop ;
+
+: x-atom ( string -- atom ) dpy get swap 0 XInternAtom ;
+
+: check-display
+    [
+        "Cannot connect to X server - check $DISPLAY" throw
+    ] unless* ;
+
+: initialize-x ( display-string -- )
+    dup [ string>char-alien ] when
+    XOpenDisplay check-display dpy set-global
+    dpy get XDefaultScreen scr set-global
+    dpy get scr get XRootWindow root set-global ;
+
+: close-x ( -- ) dpy get XCloseDisplay drop ;
+
+: with-x ( display-string quot -- )
+    >r initialize-x r> [ close-x ] [ ] cleanup ;
diff --git a/extra/xml-rpc/authors.txt b/extra/xml-rpc/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/xml-rpc/example.factor b/extra/xml-rpc/example.factor
new file mode 100644 (file)
index 0000000..0223dfd
--- /dev/null
@@ -0,0 +1,27 @@
+IN: rpc-example
+REQUIRES: contrib/http-client contrib/calendar ;
+USING: kernel hashtables xml-rpc xml calendar sequences
+    arrays math httpd io http-client namespaces ;
+
+: functions
+    H{ { "add" [ + ] }
+       { "subtract" [ - ] }
+       { "multiply" [ * ] }
+       { "divide" [ / ] } } ;
+
+: apply-function ( name args -- {number} )
+    >r functions hash r> first2 rot call 1array ;
+
+: problem>solution ( xml-doc -- xml-doc )
+    receive-rpc dup rpc-method-name swap rpc-method-params
+    apply-function <rpc-response> send-rpc ;
+
+: respond-rpc-arith ( -- )
+    "raw-response" get
+    string>xml problem>solution xml>string
+    put-http-response ;
+
+: test-rpc-arith
+    "add" { 1 2 } <rpc-method> send-rpc xml>string
+    "text/xml" swap "http://localhost:8080/responder/rpc/"
+    http-post ;
diff --git a/extra/xml-rpc/summary.txt b/extra/xml-rpc/summary.txt
new file mode 100644 (file)
index 0000000..eb652a7
--- /dev/null
@@ -0,0 +1 @@
+XML RPC client and server
diff --git a/extra/xml-rpc/tags.txt b/extra/xml-rpc/tags.txt
new file mode 100644 (file)
index 0000000..c077218
--- /dev/null
@@ -0,0 +1 @@
+web
diff --git a/extra/xml-rpc/xml-rpc-docs.factor b/extra/xml-rpc/xml-rpc-docs.factor
new file mode 100644 (file)
index 0000000..323e103
--- /dev/null
@@ -0,0 +1,71 @@
+USING: xml-rpc help.syntax help.markup ;
+
+HELP: send-rpc
+{ $values { "rpc" "an RPC data type" } { "xml" "an XML document" } }
+{ $description "converts an RPC data type into an XML document which can be sent to another computer" }
+{ $see-also receive-rpc } ;
+
+HELP: receive-rpc
+{ $values  { "xml" "an XML document" } { "rpc" "an RPC data type" } }
+{ $description "parses an XML document into an RPC data type, for further local processing" }
+{ $see-also send-rpc } ;
+
+HELP: <base64>
+{ $values { "string" "a string" } { "base64" "a base64 tuple" } }
+{ $description "creates a base64 tuple using the data in the string. This marks the data for encoding in the base64 format" }
+{ $see-also base64 } ;
+
+HELP: base64
+{ $class-description "a piece of data marked for encoding as base64 in an XML-RPC message" }
+{ $see-also <base64> } ;
+
+HELP: <rpc-method>
+{ $values { "name" "a string" } { "params" "a sequence" } }
+{ $description "creates a tuple reprsenting a method call which can be translated using send-rpc into an XML-RPC document" }
+{ $see-also rpc-method <rpc-response> <rpc-fault> } ;
+
+HELP: rpc-method
+{ $class-description "a tuple which is equivalent to an XML-RPC method send. Contains two fields, name and params" }
+{ $see-also <rpc-method> rpc-response rpc-fault } ;
+
+HELP: <rpc-response>
+{ $values { "params" "a sequence" } }
+{ $description "creates a tuple representing a data response in XML-RPC" }
+{ $see-also rpc-response <rpc-method> <rpc-fault> } ;
+
+HELP: rpc-response
+{ $class-description "represents an XML-RPC method response, with a number of paramters holding data. Contains one field, params, a sequence" }
+{ $see-also <rpc-response> rpc-method rpc-fault } ;
+
+HELP: <rpc-fault>
+{ $values { "code" "an integer" } { "string" "a string" } }
+{ $description "creates a tuple representing an exception in RPC, to be returned to the caller. The code is a number representing what type of error it is, and the string is a description" }
+{ $see-also rpc-fault <rpc-method> <rpc-response> } ;
+
+HELP: rpc-fault
+{ $class-description "represents an XML-RPC fault" }
+{ $see-also <rpc-fault> rpc-method rpc-response } ;
+
+HELP: post-rpc
+{ $values { "rpc" "an XML-RPC input tuple" } { "url" "a URL" }
+    { "rpc" "an XML-RPC output tuple" } }
+{ $description "posts an XML-RPC document to the specified URL, receives the response and parses it as XML-RPC, returning the tuple" } ;
+
+ARTICLE: { "xml-rpc" "intro" } "XML-RPC"
+    "This is the XML-RPC library. XML-RPC is used instead of SOAP because it is far simpler and easier to use for most tasks. The library was implemented by Daniel Ehrenberg."
+    $nl
+    "The most important words that this library implements are:"
+    { $subsection send-rpc }
+    { $subsection receive-rpc } 
+    "data types in XML-RPC"
+    { $subsection base64 }
+    { $subsection rpc-method }
+    { $subsection rpc-response }
+    { $subsection rpc-fault }
+    "the constructors for these are"
+    { $subsection <base64> }
+    { $subsection <rpc-method> }
+    { $subsection <rpc-response> }
+    { $subsection <rpc-fault> }
+    "other words include"
+    { $subsection post-rpc } ; 
diff --git a/extra/xml-rpc/xml-rpc-tests.factor b/extra/xml-rpc/xml-rpc-tests.factor
new file mode 100644 (file)
index 0000000..df7f2f1
--- /dev/null
@@ -0,0 +1,5 @@
+USING: xml-rpc tools.test ;
+
+[ T{ rpc-method f "blah" { 1 H{ { "2" 3 } { "5" t } } } } ]
+[ "blah" { 1 H{ { "2" 3 } { "5" t } } }
+    <rpc-method> send-rpc receive-rpc ] unit-test 
diff --git a/extra/xml-rpc/xml-rpc.factor b/extra/xml-rpc/xml-rpc.factor
new file mode 100644 (file)
index 0000000..3e04a8d
--- /dev/null
@@ -0,0 +1,171 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+IN: xml-rpc
+USING: kernel xml arrays math generic http.client combinators
+    hashtables namespaces io base64 sequences strings calendar
+    xml.data xml.writer xml.utilities assocs math.parser debugger ;
+
+! * Sending RPC requests
+! TODO: time
+! The word for what this does is "serialization"! Wow!
+
+GENERIC: item>xml ( object -- xml )
+
+M: integer item>xml
+    dup 31 2^ neg 31 2^ 1 - between?
+    [ "Integers must fit in 32 bits" throw ] unless
+    number>string "i4" build-tag ;
+
+PREDICATE: object boolean { t f } member? ;
+
+M: boolean item>xml
+    "1" "0" ? "boolean" build-tag ;
+
+M: float item>xml
+    number>string "double" build-tag ;
+
+M: string item>xml ! This should change < and &
+    "string" build-tag ;
+
+: struct-member ( name value -- tag )
+    swap dup string?
+    [ "Struct member name must be string" throw ] unless
+    "name" build-tag swap
+    item>xml "value" build-tag
+    2array "member" build-tag* ;
+
+M: hashtable item>xml
+    [ [ struct-member , ] assoc-each ] { } make
+    "struct" build-tag* ;
+
+M: array item>xml
+    [ item>xml "value" build-tag ] map
+    "data" build-tag* "array" build-tag ;
+
+TUPLE: base64 string ;
+
+C: <base64> base64
+
+M: base64 item>xml
+    base64-string >base64 "base64" build-tag ;
+
+: params ( seq -- xml )
+    [ item>xml "value" build-tag "param" build-tag ] map
+    "params" build-tag* ;
+
+: method-call ( name seq -- xml )
+    params >r "methodName" build-tag r>
+    2array "methodCall" build-tag* build-xml ;
+
+: return-params ( seq -- xml )
+    params "methodResponse" build-tag build-xml ;
+
+: return-fault ( fault-code fault-string -- xml )
+    [ "faultString" set "faultCode" set ] H{ } make-assoc item>xml
+    "value" build-tag "fault" build-tag "methodResponse" build-tag
+    build-xml ;
+
+TUPLE: rpc-method name params ;
+
+C: <rpc-method> rpc-method
+
+TUPLE: rpc-response params ;
+
+C: <rpc-response> rpc-response
+
+TUPLE: rpc-fault code string ;
+
+C: <rpc-fault> rpc-fault
+
+GENERIC: send-rpc ( rpc -- xml )
+M: rpc-method send-rpc
+    [ rpc-method-name ] keep rpc-method-params method-call ;
+M: rpc-response send-rpc
+    rpc-response-params return-params ;
+M: rpc-fault send-rpc
+    [ rpc-fault-code ] keep rpc-fault-string return-fault ;
+
+! * Recieving RPC requests
+! this needs to have much better error checking
+
+TUPLE: server-error tag message ;
+
+: server-error ( tag message -- * )
+    \ server-error construct-boa throw ;
+
+M: server-error error.
+    "Error in XML supplied to server" print
+    "Description: " write dup server-error-message print
+    "Tag: " write server-error-tag xml>string print ;
+
+PROCESS: xml>item ( tag -- object )
+
+TAG: string xml>item
+    children>string ;
+
+TAG: i4/int/double xml>item
+    children>string string>number ;
+
+TAG: boolean xml>item
+    dup children>string {
+        { [ dup "1" = ] [ 2drop t ] }
+        { [ "0" = ] [ drop f ] }
+        { [ t ] [ "Bad boolean" server-error ] }
+    } cond ;
+
+: unstruct-member ( tag -- )
+    children-tags first2
+    first-child-tag xml>item
+    >r children>string r> swap set ;
+
+TAG: struct xml>item
+    [
+        children-tags [ unstruct-member ] each
+    ] H{ } make-assoc ;
+
+TAG: base64 xml>item
+    children>string base64> <base64> ;
+
+TAG: array xml>item
+    first-child-tag children-tags
+    [ first-child-tag xml>item ] map ;
+
+: params>array ( tag -- array )
+    children-tags
+    [ first-child-tag first-child-tag xml>item ] map ;
+
+: parse-rpc-response ( xml -- array )
+    first-child-tag params>array ;
+
+: parse-method ( xml -- string array )
+    children-tags dup first children>string
+    swap second params>array ;
+
+: parse-fault ( xml -- fault-code fault-string )
+    first-child-tag first-child-tag first-child-tag
+    xml>item [ "faultCode" get "faultString" get ] bind ;
+
+: receive-rpc ( xml -- rpc )
+    dup name-tag dup "methodCall" =
+    [ drop parse-method <rpc-method> ] [
+        "methodResponse" = [
+            dup first-child-tag name-tag "fault" =
+            [ parse-fault <rpc-fault> ]
+            [ parse-rpc-response <rpc-response> ] if
+        ] [ "Bad main tag name" server-error ] if
+    ] if ;
+
+: post-rpc ( rpc url -- rpc )
+    ! This needs to do something in the event of an error
+    >r "text/xml" swap send-rpc xml>string r> http-post
+    2nip string>xml receive-rpc ;
+
+: invoke-method ( params method url -- )
+    >r swap <rpc-method> r> post-rpc ;
+
+: put-http-response ( string -- )
+    "HTTP/1.1 200 OK\nConnection: close\nContent-Length: " write
+    dup length number>string write
+    "\nContent-Type: text/xml\nDate: " write
+    now timestamp>http-string write "\n\n" write
+    write ;
diff --git a/extra/xml/authors.txt b/extra/xml/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/xml/char-classes/char-classes.factor b/extra/xml/char-classes/char-classes.factor
new file mode 100644 (file)
index 0000000..37ac3f5
--- /dev/null
@@ -0,0 +1,21 @@
+! Copyright (C) 2005, 2007 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences unicode math ;
+IN: xml.char-classes
+
+CATEGORY: 1.0name-start* Ll Lu Lo Lt Nl \u0559\u06E5\u06E6_ ;
+: 1.0name-start? ( char -- ? )
+    dup 1.0name-start*? [ drop t ] 
+    [ HEX: 2BB HEX: 2C1 between? ] if ;
+
+CATEGORY: 1.0name-char Ll Lu Lo Lt Nl Mc Me Mn Lm Nd _-.\u0387 ;
+
+CATEGORY: 1.1name-start Ll Lu Lo Lm Ln Nl _ ;
+
+CATEGORY: 1.1name-char Ll Lu Lo Lm Ln Nl Mc Mn Nd Pc Cf _-.\u00b7 ;
+
+: name-start? ( 1.0? char -- ? )
+    swap [ 1.0name-start? ] [ 1.1name-start? ] if ;
+
+: name-char? ( 1.0? char -- ? )
+    swap [ 1.0name-char? ] [ 1.1name-char? ] if ;
diff --git a/extra/xml/data/data.factor b/extra/xml/data/data.factor
new file mode 100644 (file)
index 0000000..56e34b7
--- /dev/null
@@ -0,0 +1,115 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences sequences.private assocs arrays ;
+IN: xml.data
+
+TUPLE: name space tag url ;
+C: <name> name
+
+: ?= ( object/f object/f -- ? )
+    2dup and [ = ] [ 2drop t ] if ;
+
+: names-match? ( name1 name2 -- ? )
+    [ name-space swap name-space ?= ] 2keep
+    [ name-url swap name-url ?= ] 2keep
+    name-tag swap name-tag ?= and and ;
+
+: <name-tag> ( string -- name )
+    f swap f <name> ;
+
+: assure-name ( string/name -- name )
+    dup name? [ <name-tag> ] unless ;
+
+TUPLE: opener name attrs ;
+C: <opener> opener
+
+TUPLE: closer name ;
+C: <closer> closer
+
+TUPLE: contained name attrs ;
+C: <contained> contained
+
+TUPLE: comment text ;
+C: <comment> comment
+
+TUPLE: directive text ;
+C: <directive> directive
+
+TUPLE: instruction text ;
+C: <instruction> instruction
+
+TUPLE: prolog version encoding standalone ;
+C: <prolog> prolog
+
+TUPLE: xml prolog before after ;
+: <xml> ( prolog before main after -- xml )
+    { set-xml-prolog set-xml-before set-delegate set-xml-after }
+    xml construct ;
+
+TUPLE: attrs ;
+: <attrs> ( alist -- attrs )
+    attrs construct-delegate ;
+
+: attr@ ( key alist -- index {key,value} )
+    >r assure-name r>
+    [ first names-match? ] curry* find ;
+
+M: attrs at*
+    attr@ nip [ second t ] [ f f ] if* ;
+M: attrs set-at
+    2dup attr@ nip [
+        2nip set-second
+    ] [
+        >r assure-name swap 2array r> push
+    ] if* ;
+
+M: attrs assoc-size length ;
+M: attrs new-assoc drop V{ } new <attrs> ;
+
+: >attrs ( assoc -- attrs )
+    V{ } assoc-clone-like
+    [ >r assure-name r> ] assoc-map
+    <attrs> ;
+M: attrs assoc-like
+    drop dup attrs? [ >attrs ] unless ;
+
+M: attrs clear-assoc
+    delete-all ;
+M: attrs delete-at
+    tuck attr@ drop [ swap delete-nth ] [ drop ] if* ;
+
+INSTANCE: attrs assoc
+
+TUPLE: tag attrs children ;
+: <tag> ( name attrs children -- tag )
+    >r >r assure-name r> T{ attrs } assoc-like r>
+    { set-delegate set-tag-attrs set-tag-children }
+    tag construct ;
+
+! For convenience, tags follow the assoc protocol too (for attrs)
+M: tag at* tag-attrs at* ;
+M: tag set-at tag-attrs set-at ;
+M: tag new-assoc tag-attrs new-assoc ;
+M: tag >alist tag-attrs >alist ;
+M: tag delete-at tag-attrs delete-at ;
+M: tag clear-assoc tag-attrs clear-assoc ;
+M: tag assoc-size tag-attrs assoc-size ;
+M: tag assoc-like tag-attrs assoc-like ;
+
+INSTANCE: tag assoc
+
+! They also follow the sequence protocol (for children)
+M: tag nth tag-children nth ;
+M: tag nth-unsafe tag-children nth-unsafe ;
+M: tag set-nth tag-children set-nth ;
+M: tag set-nth-unsafe tag-children set-nth-unsafe ;
+M: tag length tag-children length ;
+
+INSTANCE: tag sequence
+
+! tag with children=f is contained
+: <contained-tag> ( name attrs -- tag )
+    f <tag> ;
+
+PREDICATE: tag contained-tag tag-children not ;
+PREDICATE: tag open-tag tag-children ;
diff --git a/extra/xml/entities/entities.factor b/extra/xml/entities/entities.factor
new file mode 100644 (file)
index 0000000..a52f5be
--- /dev/null
@@ -0,0 +1,276 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces kernel ;
+IN: xml.entities
+
+: entities
+    H{
+        { "lt"    CHAR: <  }
+        { "gt"    CHAR: >  }
+        { "amp"   CHAR: &  }
+        { "apos"  CHAR: '  }
+        { "quot"  CHAR: "  }
+    } ;
+
+: html-entities
+    #! generated from:
+    #! http://www.w3.org/TR/REC-html40/sgml/entities.html
+    H{
+        { "nbsp"   160 }
+        { "iexcl"  161 }
+        { "cent"   162 }
+        { "pound"  163 }
+        { "curren" 164 }
+        { "yen"    165 }
+        { "brvbar" 166 }
+        { "sect"   167 }
+        { "uml"    168 }
+        { "copy"   169 }
+        { "ordf"   170 }
+        { "laquo"  171 }
+        { "not"    172 }
+        { "shy"    173 }
+        { "reg"    174 }
+        { "macr"   175 }
+        { "deg"    176 }
+        { "plusmn" 177 }
+        { "sup2"   178 }
+        { "sup3"   179 }
+        { "acute"  180 }
+        { "micro"  181 }
+        { "para"   182 }
+        { "middot" 183 }
+        { "cedil"  184 }
+        { "sup1"   185 }
+        { "ordm"   186 }
+        { "raquo"  187 }
+        { "frac14" 188 }
+        { "frac12" 189 }
+        { "frac34" 190 }
+        { "iquest" 191 }
+        { "Agrave" 192 }
+        { "Aacute" 193 }
+        { "Acirc"  194 }
+        { "Atilde" 195 }
+        { "Auml"   196 }
+        { "Aring"  197 }
+        { "AElig"  198 }
+        { "Ccedil" 199 }
+        { "Egrave" 200 }
+        { "Eacute" 201 }
+        { "Ecirc"  202 }
+        { "Euml"   203 }
+        { "Igrave" 204 }
+        { "Iacute" 205 }
+        { "Icirc"  206 }
+        { "Iuml"   207 }
+        { "ETH"    208 }
+        { "Ntilde" 209 }
+        { "Ograve" 210 }
+        { "Oacute" 211 }
+        { "Ocirc"  212 }
+        { "Otilde" 213 }
+        { "Ouml"   214 }
+        { "times"  215 }
+        { "Oslash" 216 }
+        { "Ugrave" 217 }
+        { "Uacute" 218 }
+        { "Ucirc"  219 }
+        { "Uuml"   220 }
+        { "Yacute" 221 }
+        { "THORN"  222 }
+        { "szlig"  223 }
+        { "agrave" 224 }
+        { "aacute" 225 }
+        { "acirc"  226 }
+        { "atilde" 227 }
+        { "auml"   228 }
+        { "aring"  229 }
+        { "aelig"  230 }
+        { "ccedil" 231 }
+        { "egrave" 232 }
+        { "eacute" 233 }
+        { "ecirc"  234 }
+        { "euml"   235 }
+        { "igrave" 236 }
+        { "iacute" 237 }
+        { "icirc"  238 }
+        { "iuml"   239 }
+        { "eth"    240 }
+        { "ntilde" 241 }
+        { "ograve" 242 }
+        { "oacute" 243 }
+        { "ocirc"  244 }
+        { "otilde" 245 }
+        { "ouml"   246 }
+        { "divide" 247 }
+        { "oslash" 248 }
+        { "ugrave" 249 }
+        { "uacute" 250 }
+        { "ucirc"  251 }
+        { "uuml"   252 }
+        { "yacute" 253 }
+        { "thorn"  254 }
+        { "yuml"   255 }
+        { "fnof"     402 }
+        { "Alpha"    913 }
+        { "Beta"     914 }
+        { "Gamma"    915 }
+        { "Delta"    916 }
+        { "Epsilon"  917 }
+        { "Zeta"     918 }
+        { "Eta"      919 }
+        { "Theta"    920 }
+        { "Iota"     921 }
+        { "Kappa"    922 }
+        { "Lambda"   923 }
+        { "Mu"       924 }
+        { "Nu"       925 }
+        { "Xi"       926 }
+        { "Omicron"  927 }
+        { "Pi"       928 }
+        { "Rho"      929 }
+        { "Sigma"    931 }
+        { "Tau"      932 }
+        { "Upsilon"  933 }
+        { "Phi"      934 }
+        { "Chi"      935 }
+        { "Psi"      936 }
+        { "Omega"    937 }
+        { "alpha"    945 }
+        { "beta"     946 }
+        { "gamma"    947 }
+        { "delta"    948 }
+        { "epsilon"  949 }
+        { "zeta"     950 }
+        { "eta"      951 }
+        { "theta"    952 }
+        { "iota"     953 }
+        { "kappa"    954 }
+        { "lambda"   955 }
+        { "mu"       956 }
+        { "nu"       957 }
+        { "xi"       958 }
+        { "omicron"  959 }
+        { "pi"       960 }
+        { "rho"      961 }
+        { "sigmaf"   962 }
+        { "sigma"    963 }
+        { "tau"      964 }
+        { "upsilon"  965 }
+        { "phi"      966 }
+        { "chi"      967 }
+        { "psi"      968 }
+        { "omega"    969 }
+        { "thetasym" 977 }
+        { "upsih"    978 }
+        { "piv"      982 }
+        { "bull"     8226 }
+        { "hellip"   8230 }
+        { "prime"    8242 }
+        { "Prime"    8243 }
+        { "oline"    8254 }
+        { "frasl"    8260 }
+        { "weierp"   8472 }
+        { "image"    8465 }
+        { "real"     8476 }
+        { "trade"    8482 }
+        { "alefsym"  8501 }
+        { "larr"     8592 }
+        { "uarr"     8593 }
+        { "rarr"     8594 }
+        { "darr"     8595 }
+        { "harr"     8596 }
+        { "crarr"    8629 }
+        { "lArr"     8656 }
+        { "uArr"     8657 }
+        { "rArr"     8658 }
+        { "dArr"     8659 }
+        { "hArr"     8660 }
+        { "forall"   8704 }
+        { "part"     8706 }
+        { "exist"    8707 }
+        { "empty"    8709 }
+        { "nabla"    8711 }
+        { "isin"     8712 }
+        { "notin"    8713 }
+        { "ni"       8715 }
+        { "prod"     8719 }
+        { "sum"      8721 }
+        { "minus"    8722 }
+        { "lowast"   8727 }
+        { "radic"    8730 }
+        { "prop"     8733 }
+        { "infin"    8734 }
+        { "ang"      8736 }
+        { "and"      8743 }
+        { "or"       8744 }
+        { "cap"      8745 }
+        { "cup"      8746 }
+        { "int"      8747 }
+        { "there4"   8756 }
+        { "sim"      8764 }
+        { "cong"     8773 }
+        { "asymp"    8776 }
+        { "ne"       8800 }
+        { "equiv"    8801 }
+        { "le"       8804 }
+        { "ge"       8805 }
+        { "sub"      8834 }
+        { "sup"      8835 }
+        { "nsub"     8836 }
+        { "sube"     8838 }
+        { "supe"     8839 }
+        { "oplus"    8853 }
+        { "otimes"   8855 }
+        { "perp"     8869 }
+        { "sdot"     8901 }
+        { "lceil"    8968 }
+        { "rceil"    8969 }
+        { "lfloor"   8970 }
+        { "rfloor"   8971 }
+        { "lang"     9001 }
+        { "rang"     9002 }
+        { "loz"      9674 }
+        { "spades"   9824 }
+        { "clubs"    9827 }
+        { "hearts"   9829 }
+        { "diams"    9830 }
+        { "OElig"   338 }
+        { "oelig"   339 }
+        { "Scaron"  352 }
+        { "scaron"  353 }
+        { "Yuml"    376 }
+        { "circ"    710 }
+        { "tilde"   732 }
+        { "ensp"    8194 }
+        { "emsp"    8195 }
+        { "thinsp"  8201 }
+        { "zwnj"    8204 }
+        { "zwj"     8205 }
+        { "lrm"     8206 }
+        { "rlm"     8207 }
+        { "ndash"   8211 }
+        { "mdash"   8212 }
+        { "lsquo"   8216 }
+        { "rsquo"   8217 }
+        { "sbquo"   8218 }
+        { "ldquo"   8220 }
+        { "rdquo"   8221 }
+        { "bdquo"   8222 }
+        { "dagger"  8224 }
+        { "Dagger"  8225 }
+        { "permil"  8240 }
+        { "lsaquo"  8249 }
+        { "rsaquo"  8250 }
+        { "euro"   8364 }
+    } ;
+
+SYMBOL: extra-entities
+f extra-entities set-global
+
+: with-entities ( entities quot -- )
+    [ swap extra-entities set call ] with-scope ; inline
+
+: with-html-entities ( quot -- )
+    html-entities swap with-entities ; inline
diff --git a/extra/xml/errors/errors.factor b/extra/xml/errors/errors.factor
new file mode 100644 (file)
index 0000000..5b41a7f
--- /dev/null
@@ -0,0 +1,152 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: xml.data xml.writer kernel generic io prettyprint math 
+debugger sequences state-parser ;
+IN: xml.errors
+
+TUPLE: no-entity thing ;
+: <no-entity> ( string -- error )
+    { set-no-entity-thing } no-entity construct-parsing-error ;
+M: no-entity error.
+    dup parsing-error.
+    "Entity does not exist: &" write no-entity-thing write ";" print ;
+
+TUPLE: xml-string-error string ; ! this should not exist
+: <xml-string-error> ( string -- xml-string-error )
+    { set-xml-string-error-string }
+    xml-string-error construct-parsing-error ;
+M: xml-string-error error.
+    dup parsing-error.
+    xml-string-error-string print ;
+
+TUPLE: mismatched open close ;
+: <mismatched>
+    { set-mismatched-open set-mismatched-close }
+    mismatched construct-parsing-error ;
+M: mismatched error.
+    dup parsing-error.
+    "Mismatched tags" print
+    "Opening tag: <" write dup mismatched-open print-name ">" print
+    "Closing tag: </" write mismatched-close print-name ">" print ;
+
+TUPLE: unclosed tags ;
+! <unclosed> is ( -- unclosed ), see presentation.factor
+M: unclosed error.
+    "Unclosed tags" print
+    "Tags: " print
+    unclosed-tags [ "  <" write print-name ">" print ] each ;
+
+TUPLE: bad-uri string ;
+: <bad-uri> ( string -- bad-uri )
+    { set-bad-uri-string } bad-uri construct-parsing-error ;
+M: bad-uri error.
+    dup parsing-error.
+    "Bad URI:" print bad-uri-string . ;
+
+TUPLE: nonexist-ns name ;
+: <nonexist-ns> ( name-string -- nonexist-ns )
+    { set-nonexist-ns-name }
+    nonexist-ns construct-parsing-error ;
+M: nonexist-ns error.
+    dup parsing-error.
+    "Namespace " write nonexist-ns-name write " has not been declared" print ;
+
+TUPLE: unopened ; ! this should give which tag was unopened
+: <unopened> ( -- unopened )
+    { } unopened construct-parsing-error ;
+M: unopened error.
+    parsing-error.
+    "Closed an unopened tag" print ;
+
+TUPLE: not-yes/no text ;
+: <not-yes/no> ( text -- not-yes/no )
+    { set-not-yes/no-text } not-yes/no construct-parsing-error ;
+M: not-yes/no error.
+    dup parsing-error.
+    "standalone must be either yes or no, not \"" write
+    not-yes/no-text write "\"." print ;
+
+TUPLE: extra-attrs attrs ; ! this should actually print the names
+: <extra-attrs> ( attrs -- extra-attrs )
+    { set-extra-attrs-attrs }
+    extra-attrs construct-parsing-error ;
+M: extra-attrs error.
+    dup parsing-error.
+    "Extra attributes included in xml version declaration:" print
+    extra-attrs-attrs . ;
+
+TUPLE: bad-version num ;
+: <bad-version>
+    { set-bad-version-num }
+    bad-version construct-parsing-error ;
+M: bad-version error.
+    "XML version must be \"1.0\" or \"1.1\". Version here was " write
+    bad-version-num . ;
+
+TUPLE: notags ;
+C: <notags> notags
+M: notags error.
+    drop "XML document lacks a main tag" print ;
+
+TUPLE: multitags ;
+C: <multitags> multitags
+M: multitags error.
+    drop "XML document contains multiple main tags" print ;
+
+TUPLE: bad-prolog prolog ;
+: <bad-prolog> ( prolog -- bad-prolog )
+    { set-bad-prolog-prolog }
+    bad-prolog construct-parsing-error ;
+M: bad-prolog error.
+    dup parsing-error.
+    "Misplaced XML prolog" print
+    bad-prolog-prolog write-prolog nl ;
+
+TUPLE: capitalized-prolog name ;
+: <capitalized-prolog> ( name -- capitalized-prolog )
+    { set-capitalized-prolog-name }
+    capitalized-prolog construct-parsing-error ;
+M: capitalized-prolog error.
+    dup parsing-error.
+    "XML prolog name was partially or totally capitalized, using" print
+    "<?" write capitalized-prolog-name write "...?>" write
+    " instead of <?xml...?>" print ;
+
+TUPLE: pre/post-content string pre? ;
+C: <pre/post-content> pre/post-content
+M: pre/post-content error.
+    "The text string:" print
+    dup pre/post-content-string .
+    "was used " write
+    pre/post-content-pre? "before" "after" ? write
+    " the main tag." print ;
+
+TUPLE: versionless-prolog ;
+: <versionless-prolog> ( -- versionless-prolog )
+    { } versionless-prolog construct-parsing-error ;
+M: versionless-prolog error.
+    parsing-error.
+    "XML prolog lacks a version declaration" print ;
+
+TUPLE: bad-instruction inst ;
+: <bad-instruction> ( instruction -- bad-instruction )
+    { set-bad-instruction-inst }
+    bad-instruction construct-parsing-error ;
+M: bad-instruction error.
+    dup parsing-error.
+    "Misplaced processor instruction:" print
+    bad-instruction-inst write-item nl ;
+
+TUPLE: bad-directive dir ;
+: <bad-directive> ( directive -- bad-directive )
+    { set-bad-directive-dir }
+    bad-directive construct-parsing-error ;
+M: bad-directive error.
+    dup parsing-error.
+    "Misplaced directive:" print
+    bad-directive-dir write-item nl ;
+
+UNION: xml-parse-error multitags notags extra-attrs nonexist-ns
+       not-yes/no unclosed mismatched xml-string-error expected no-entity
+       bad-prolog versionless-prolog capitalized-prolog bad-instruction
+       bad-directive ;
diff --git a/extra/xml/generator/generator-tests.factor b/extra/xml/generator/generator-tests.factor
new file mode 100644 (file)
index 0000000..5a6b146
--- /dev/null
@@ -0,0 +1,3 @@
+USING: tools.test io.streams.string xml.generator xml.writer ;
+[ "<html><body><a href=\"blah\"/></body></html>" ]
+[ "html" [ "body" [ "a" { { "href" "blah" } } contained*, ] tag, ] make-xml [ write-item ] string-out ] unit-test
diff --git a/extra/xml/generator/generator.factor b/extra/xml/generator/generator.factor
new file mode 100644 (file)
index 0000000..d5eb643
--- /dev/null
@@ -0,0 +1,23 @@
+USING: namespaces kernel xml.data xml.utilities ;
+IN: xml.generator
+
+: comment, ( string -- ) <comment> , ;
+: directive, ( string -- ) <directive> , ;
+: instruction, ( string -- ) <instruction> , ;
+: nl, ( -- ) "\n" , ;
+
+: (tag,) ( name attrs quot -- tag )
+    -rot >r >r V{ } make r> r> rot <tag> ; inline
+: tag*, ( name attrs quot -- )
+    (tag,) , ; inline
+
+: contained*, ( name attrs -- )
+    f <tag> , ;
+
+: tag, ( name quot -- ) f swap tag*, ; inline
+: contained, ( name -- ) f contained*, ; inline
+
+: make-xml* ( name attrs quot -- xml )
+    (tag,) build-xml ; inline
+: make-xml ( name quot -- xml )
+    f swap make-xml* ; inline
diff --git a/extra/xml/summary.txt b/extra/xml/summary.txt
new file mode 100644 (file)
index 0000000..f67799b
--- /dev/null
@@ -0,0 +1 @@
+XML reader and writer
diff --git a/extra/xml/tags.txt b/extra/xml/tags.txt
new file mode 100644 (file)
index 0000000..c077218
--- /dev/null
@@ -0,0 +1 @@
+web
diff --git a/extra/xml/test/arithmetic.factor b/extra/xml/test/arithmetic.factor
new file mode 100644 (file)
index 0000000..371bf2d
--- /dev/null
@@ -0,0 +1,30 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+IN: xml-arith
+USING: xml io kernel math sequences strings xml.utilities tools.test math.parser ;
+
+PROCESS: calculate ( tag -- n )
+
+: calc-2children ( tag -- n n )
+    children-tags first2 >r calculate r> calculate ;
+
+TAG: number calculate
+    children>string string>number ;
+TAG: add calculate
+    calc-2children + ;
+TAG: minus calculate
+    calc-2children - ;
+TAG: times calculate
+    calc-2children * ;
+TAG: divide calculate
+    calc-2children / ;
+TAG: neg calculate
+    children-tags first calculate neg ;
+
+: calc-arith ( string -- n )
+    string>xml first-child-tag calculate ;
+
+[ 32 ] [
+    "<math><times><add><number>1</number><number>3</number></add><neg><number>-8</number></neg></times></math>"
+    calc-arith
+] unit-test
diff --git a/extra/xml/test/errors.factor b/extra/xml/test/errors.factor
new file mode 100644 (file)
index 0000000..596f1e6
--- /dev/null
@@ -0,0 +1,27 @@
+USING: continuations xml xml.errors tools.test kernel arrays xml.data state-parser quotations ;
+
+: xml-error-test ( expected-error xml-string -- )
+    swap 1array >quotation swap [ [ string>xml ] catch nip ] curry unit-test ;
+
+T{ no-entity T{ parsing-error f 1 10 } "nbsp" } "<x>&nbsp;</x>" xml-error-test
+T{ mismatched T{ parsing-error f 1 8 } T{ name f "" "x" "" } T{ name f "" "y" "" }
+} "<x></y>" xml-error-test
+T{ unclosed f V{ T{ name f "" "x" "" } } } "<x>" xml-error-test
+T{ nonexist-ns T{ parsing-error f 1 5 } "x" } "<x:y/>" xml-error-test
+T{ unopened T{ parsing-error f 1 5 } } "</x>" xml-error-test
+T{ not-yes/no T{ parsing-error f 1 41 } "maybe" } "<?xml version='1.0' standalone='maybe'?><x/>" xml-error-test
+T{ extra-attrs T{ parsing-error f 1 32 } V{ T{ name f "" "foo" f } }
+} "<?xml version='1.1' foo='bar'?><x/>" xml-error-test
+T{ bad-version T{ parsing-error f 1 28 } "5 million" } "<?xml version='5 million'?><x/>" xml-error-test
+T{ notags f } "" xml-error-test
+T{ multitags f } "<x/><y/>" xml-error-test
+T{ bad-prolog T{ parsing-error f 1 26 } T{ prolog f "1.0" "iso-8859-1" f }
+} "<x/><?xml version='1.0'?>" xml-error-test
+T{ capitalized-prolog T{ parsing-error f 1 6 } "XmL" } "<?XmL version='1.0'?><x/>"
+xml-error-test
+T{ pre/post-content f "x" t } "x<y/>" xml-error-test
+T{ versionless-prolog T{ parsing-error f 1 8 } } "<?xml?><x/>" xml-error-test
+T{ bad-instruction T{ parsing-error f 1 11 } T{ instruction f "xsl" }
+} "<x><?xsl?></x>" xml-error-test
+T{ bad-directive T{ parsing-error f 1 15 } T{ directive f "DOCTYPE" }
+} "<x/><!DOCTYPE>" xml-error-test
diff --git a/extra/xml/test/soap.factor b/extra/xml/test/soap.factor
new file mode 100644 (file)
index 0000000..ed8bd70
--- /dev/null
@@ -0,0 +1,14 @@
+USING: sequences xml kernel arrays xml.utilities io.files tools.test ;
+
+: assemble-data ( tag -- 3array )
+    { "URL" "snippet" "title" }
+    [ tag-named children>string ] curry* map ;
+
+: parse-result ( xml -- seq )
+    "resultElements" tag-named* "item" tags-named
+    [ assemble-data ] map ;
+
+[ "http://www.foxnews.com/oreilly/" ] [
+    "extra/xml/test/soap.xml" resource-path file>xml
+    parse-result first first
+] unit-test
diff --git a/extra/xml/test/soap.xml b/extra/xml/test/soap.xml
new file mode 100644 (file)
index 0000000..063090b
--- /dev/null
@@ -0,0 +1,168 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
+<SOAP-ENV:Body>
+<ns1:doGoogleSearchResponse xmlns:ns1="urn:GoogleSearch" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
+<return xsi:type="ns1:GoogleSearchResult">
+<directoryCategories xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" ns2:arrayType="ns1:DirectoryCategory[1]">
+<item xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string">Top/Regional/North_America/Canada/Arts_and_Entertainment/Music/Organizations</fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</item>
+</directoryCategories>
+<documentFiltering xsi:type="xsd:boolean">false</documentFiltering>
+<endIndex xsi:type="xsd:int">10</endIndex>
+<estimateIsExact xsi:type="xsd:boolean">false</estimateIsExact>
+<estimatedTotalResultsCount xsi:type="xsd:int">268000000</estimatedTotalResultsCount>
+<resultElements xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]">
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.foxnews.com/oreilly/</URL>
+<cachedSize xsi:type="xsd:string">47k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">The O\e$-1òùReilly &lt;b&gt;Factor&lt;/b&gt; with Bill OòùReilly on FOXNews.com. Bill OòùReilly hosts The &lt;br&gt;  OòùReilly &lt;b&gt;Factor&lt;/b&gt;, the most-watched program on cable news.</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">Bill O\e$-1òùReilly | The OòùReilly &lt;b&gt;Factor&lt;/b&gt; - FOXNews.com</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.factor.ca/</URL>
+<cachedSize xsi:type="xsd:string">8k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">The &lt;b&gt;Foundation to Assist Canadian Talent on Records&lt;/b&gt;.</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">&lt;b&gt;FACTOR&lt;/b&gt;</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.billoreilly.com/</URL>
+<cachedSize xsi:type="xsd:string">112k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">Call the Radio &lt;b&gt;Factor&lt;/b&gt; LIVE on the air with your question or comment! &lt;b&gt;...&lt;/b&gt; Check out &lt;br&gt;  the O&amp;#39;Reilly &lt;b&gt;Factor&lt;/b&gt; Archive for more on past programs! &lt;b&gt;...&lt;/b&gt;</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">Bill&amp;#39;s Official Home On The Web</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.factorcode.org/</URL>
+<cachedSize xsi:type="xsd:string">13k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">&lt;b&gt;Factor&lt;/b&gt; is a dynamically typed, stack-based programming language. &lt;b&gt;...&lt;/b&gt; Slava Pestov &lt;br&gt;  is &lt;b&gt;Factor&amp;#39;s&lt;/b&gt; lead developer. The project also has a number of active &lt;b&gt;...&lt;/b&gt;</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">&lt;b&gt;Factor&lt;/b&gt;, a stack programming language</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.newsfactor.com/</URL>
+<cachedSize xsi:type="xsd:string"></cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">The starting point for a network of technology news and information sites, &lt;br&gt;  including Wireless NewsFactor and CRM Daily.</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">NewsFactor Network</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.baddesigns.com/</URL>
+<cachedSize xsi:type="xsd:string">4k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">A scrapbook of illustrated examples of things that are hard to use because they &lt;br&gt;  do not follow human &lt;b&gt;factors&lt;/b&gt; principles.</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">Bad Human &lt;b&gt;Factors&lt;/b&gt; Designs</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.nbc.com/Fear_Factor/</URL>
+<cachedSize xsi:type="xsd:string">50k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">Find information on the Fear &lt;b&gt;Factor&lt;/b&gt; TV show! Watch exclusive Fear &lt;b&gt;Factor&lt;/b&gt; video &lt;br&gt;  clips with host Joe Rogan on the official NBC TV site.</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">Fear &lt;b&gt;Factor&lt;/b&gt; TV Show: Find Joe Rogan Video Clips Online . NBC &lt;b&gt;...&lt;/b&gt;</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.hfes.org/</URL>
+<cachedSize xsi:type="xsd:string">28k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">Information about the Society, its member services, and activities.</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">Human &lt;b&gt;Factors&lt;/b&gt; and Ergonomics Society</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://www.miamisci.org/ph/</URL>
+<cachedSize xsi:type="xsd:string">4k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">Virtual chemistry lab about the pH scale.</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">Miami Museum of Science-The pH &lt;b&gt;Factor&lt;/b&gt;</title>
+</item>
+<item xsi:type="ns1:ResultElement">
+<URL xsi:type="xsd:string">http://mathforum.org/dr.math/faq/faq.learn.factor.html</URL>
+<cachedSize xsi:type="xsd:string">15k</cachedSize>
+<directoryCategory xsi:type="ns1:DirectoryCategory">
+<fullViewableName xsi:type="xsd:string"></fullViewableName>
+<specialEncoding xsi:type="xsd:string"></specialEncoding>
+</directoryCategory>
+<directoryTitle xsi:type="xsd:string"></directoryTitle>
+<hostName xsi:type="xsd:string"></hostName>
+<relatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent>
+<snippet xsi:type="xsd:string">Students regularly ask questions about how to &lt;b&gt;factor&lt;/b&gt;. Here are some answers from our &lt;br&gt;  &lt;b&gt;...&lt;/b&gt; Identify and &lt;b&gt;factor&lt;/b&gt; out common &lt;b&gt;factors&lt;/b&gt; of all the coefficients. 2. &lt;b&gt;...&lt;/b&gt;</snippet>
+<summary xsi:type="xsd:string"></summary>
+<title xsi:type="xsd:string">Math Forum: Ask Dr. Math FAQ: Learning to &lt;b&gt;Factor&lt;/b&gt;</title>
+</item>
+</resultElements>
+<searchComments xsi:type="xsd:string"></searchComments>
+<searchQuery xsi:type="xsd:string">factor</searchQuery>
+<searchTime xsi:type="xsd:double">0.022271</searchTime>
+<searchTips xsi:type="xsd:string"></searchTips>
+<startIndex xsi:type="xsd:int">1</startIndex>
+</return>
+</ns1:doGoogleSearchResponse>
+
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
diff --git a/extra/xml/test/templating.factor b/extra/xml/test/templating.factor
new file mode 100644 (file)
index 0000000..baa0e3b
--- /dev/null
@@ -0,0 +1,43 @@
+IN: templating
+USING: kernel xml sequences assocs tools.test io arrays namespaces
+    xml.data xml.utilities xml.writer generic ;
+
+: sub-tag
+    T{ name f f "sub" "http://littledan.onigirihouse.com/namespaces/replace" } ;
+
+SYMBOL: ref-table
+
+GENERIC: (r-ref) ( xml -- )
+M: tag (r-ref)
+    sub-tag over at [
+        ref-table get at
+        swap set-tag-children
+    ] [ drop ] if* ;
+M: object (r-ref) drop ;
+
+: template ( xml -- )
+    [ (r-ref) ] xml-each ;
+
+! Example
+
+: sample-doc
+    {
+        "<html xmlns:f='http://littledan.onigirihouse.com/namespaces/replace'>"
+        "<body>"
+        "<span f:sub='foo'/>"
+        "<div f:sub='bar'/>"
+        "<p f:sub='baz'>paragraph</p>"
+        "</body></html>"
+    } concat ;
+
+: test-refs ( -- string )
+    [
+        H{
+            { "foo" { "foo" } }
+            { "bar" { "blah" T{ tag T{ name f "" "a" "" } V{ } f } } }
+            { "baz" f }
+        } ref-table set
+        sample-doc string>xml dup template xml>string
+    ] with-scope ;
+
+[ "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><html xmlns:f=\"http://littledan.onigirihouse.com/namespaces/replace\"><body><span f:sub=\"foo\">foo</span><div f:sub=\"bar\">blah<a/></div><p f:sub=\"baz\"/></body></html>" ] [ test-refs ] unit-test
diff --git a/extra/xml/test/test.factor b/extra/xml/test/test.factor
new file mode 100644 (file)
index 0000000..d9c7ca7
--- /dev/null
@@ -0,0 +1,44 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
+! See http://factorcode.org/license.txt for BSD license.\r
+IN: temporary\r
+USING: kernel xml tools.test io namespaces sequences xml.errors xml.entities\r
+    parser strings xml.data io.files xml.writer xml.utilities state-parser 
+    continuations assocs ;\r
+\r
+! This is insufficient\r
+SYMBOL: xml-file\r
+[ ] [ "extra/xml/test/test.xml" resource-path\r
+    [ file>xml ] with-html-entities xml-file set ] unit-test\r
+[ "1.0" ] [ xml-file get xml-prolog prolog-version ] unit-test\r
+[ f ] [ xml-file get xml-prolog prolog-standalone ] unit-test\r
+[ "a" ] [ xml-file get name-space ] unit-test\r
+[ "http://www.hello.com" ] [ xml-file get name-url ] unit-test\r
+[ "that" ] [\r
+    xml-file get T{ name f "" "this" "http://d.de" } swap at\r
+] unit-test\r
+[ t ] [ xml-file get tag-children second contained-tag? ] unit-test\r
+[ t ] [ [ "<a></b>" string>xml ] catch xml-parse-error? ] unit-test\r
+[ T{ comment f "This is where the fun begins!" } ] [\r
+    xml-file get xml-before [ comment? ] find nip\r
+] unit-test\r
+[ "xsl stylesheet=\"that-one.xsl\"" ] [\r
+    xml-file get xml-after [ instruction? ] find nip instruction-text\r
+] unit-test\r
+[ V{ "fa&g" } ] [ xml-file get "x" get-id tag-children ] unit-test\r
+[ "that" ] [ xml-file get "this" swap at ] unit-test\r
+[ "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><a b=\"c\"/>" ]\r
+    [ "<a b='c'/>" string>xml xml>string ] unit-test\r
+[ "abcd" ] [\r
+    "<main>a<sub>bc</sub>d<nothing/></main>" string>xml\r
+    [ [ dup string? [ % ] [ drop ] if ] xml-each ] "" make\r
+] unit-test\r
+[ "abcd" ] [\r
+    "<main>a<sub>bc</sub>d<nothing/></main>" string>xml\r
+    [ string? ] xml-subset concat
+] unit-test\r
+[ "foo" ] [\r
+    "<a><b id='c'>foo</b><d id='e'/></a>" string>xml\r
+    "c" get-id children>string\r
+] unit-test\r
+[ "foo" ] [ "<x y='foo'/>" string>xml "y" <name-tag> over\r
+at swap "z" <name-tag> >r tuck r> swap set-at T{ name f "blah" "z" f } swap at ] unit-test\r
diff --git a/extra/xml/test/test.xml b/extra/xml/test/test.xml
new file mode 100644 (file)
index 0000000..76b568a
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding="UTF-8"     standalone="no" ?>\r
+<!--This is where the fun begins!-->\r
+<!DOCTYPE greeting SYSTEM "hello.dtd">\r
+       <!--this is fun, isn't it, guys?-->\r
+<a:b xmlns:a='http://www.hello.com' xmlns='http://d.de'\r
+     this='that' that="this">\r
+   <b xmlns='http://b.nu' feeling='sombre'/>\r
+           Here's a new, undefined &euro;\r
+ and here's a to go along with it!\r
+        isn't this fun?\r
+   <a:c><d mood="happy"></d>\r
+              <e a:id='x'>f&#97;&amp;g</e>\r
+   </a:c>\r
+</a:b>\r
+<!--Well, that went over pretty well-->\r
+<?xsl stylesheet="that-one.xsl"?>\r
diff --git a/extra/xml/tokenize/tokenize.factor b/extra/xml/tokenize/tokenize.factor
new file mode 100644 (file)
index 0000000..d89ae57
--- /dev/null
@@ -0,0 +1,201 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: xml.errors xml.data xml.utilities xml.char-classes
+xml.entities kernel state-parser kernel namespaces strings math
+math.parser sequences assocs arrays splitting combinators ;
+IN: xml.tokenize
+
+! XML namespace processing: ns = namespace
+
+! A stack of hashtables
+SYMBOL: ns-stack
+
+: attrs>ns ( attrs-alist -- hash )
+    ! this should check to make sure URIs are valid
+    [
+        [
+            swap dup name-space "xmlns" =
+            [ name-tag set ]
+            [
+                T{ name f "" "xmlns" f } names-match?
+                [ "" set ] [ drop ] if
+            ] if
+        ] assoc-each
+    ] { } make-assoc f like ;
+
+: add-ns ( name -- )
+    dup name-space dup ns-stack get assoc-stack
+    [ nip ] [ <nonexist-ns> throw ] if* swap set-name-url ;
+
+: push-ns ( hash -- )
+    ns-stack get push ;
+
+: pop-ns ( -- )
+    ns-stack get pop* ;
+
+: init-ns-stack ( -- )
+    V{ H{
+        { "xml" "http://www.w3.org/XML/1998/namespace" }
+        { "xmlns" "http://www.w3.org/2000/xmlns" }
+        { "" "" }
+    } } clone
+    ns-stack set ;
+
+: tag-ns ( name attrs-alist -- name attrs )
+    dup attrs>ns push-ns
+    >r dup add-ns r> dup [ drop add-ns ] assoc-each <attrs> ;
+
+! Parsing names
+
+: version=1.0? ( -- ? )
+    prolog-data get prolog-version "1.0" = ;
+
+! version=1.0? is calculated once and passed around for efficiency
+
+: (parse-name) ( -- str )
+    version=1.0? dup
+    get-char name-start? [
+        [ dup get-char name-char? not ] take-until nip
+    ] [
+        "Malformed name" <xml-string-error> throw
+    ] if ;
+
+: parse-name ( -- name )
+    (parse-name) get-char CHAR: : =
+    [ next (parse-name) ] [ "" swap ] if f <name> ;
+
+!   -- Parsing strings
+
+: (parse-entity) ( string -- )
+    dup entities at [ , ] [ 
+        prolog-data get prolog-standalone
+        [ <no-entity> throw ] [
+            dup extra-entities get at
+            [ , ] [ <no-entity> throw ] ?if
+        ] if
+    ] ?if ;
+
+: parse-entity ( -- )
+    next CHAR: ; take-char next
+    "#" ?head [
+        "x" ?head 16 10 ? base> ,
+    ] [ (parse-entity) ] if ;
+
+: (parse-char) ( ch -- )
+    get-char {
+        { [ dup not ] [ 2drop ] }
+        { [ 2dup = ] [ 2drop next ] }
+        { [ dup CHAR: & = ] [ drop parse-entity (parse-char) ] }
+        { [ t ] [ , next (parse-char) ] }
+    } cond ;
+
+: parse-char ( ch -- string )
+    [ (parse-char) ] "" make ;
+
+: parse-quot ( ch -- string )
+    parse-char get-char
+    [ "XML file ends in a quote" <xml-string-error> throw ] unless ;
+
+: parse-text ( -- string )
+    CHAR: < parse-char ;
+
+! Parsing tags
+
+: start-tag ( -- name ? )
+    #! Outputs the name and whether this is a closing tag
+    get-char CHAR: / = dup [ next ] when
+    parse-name swap ;
+
+: parse-attr-value ( -- seq )
+    get-char dup "'\"" member? [
+        next parse-quot
+    ] [
+        "Attribute lacks quote" <xml-string-error> throw
+    ] if ;
+
+: parse-attr ( -- )
+    [ parse-name ] with-scope
+    pass-blank CHAR: = expect pass-blank
+    [ parse-attr-value ] with-scope
+    2array , ;
+
+: (middle-tag) ( -- )
+    pass-blank version=1.0? get-char name-start?
+    [ parse-attr (middle-tag) ] when ;
+
+: middle-tag ( -- attrs-alist )
+    [ (middle-tag) ] V{ } make pass-blank ;
+
+: end-tag ( name attrs-alist -- tag )
+    tag-ns pass-blank get-char CHAR: / =
+    [ pop-ns <contained> next ] [ <opener> ] if ;
+
+: take-comment ( -- comment )
+    "--" expect-string
+    "--" take-string
+    <comment>
+    CHAR: > expect ;
+
+: take-cdata ( -- string )
+    "[CDATA[" expect-string "]]>" take-string next ;
+
+: take-directive ( -- directive )
+    CHAR: > take-char <directive> next ;
+
+: direct ( -- object )
+    get-char {
+        { CHAR: - [ take-comment ] }
+        { CHAR: [ [ take-cdata ] }
+        [ drop take-directive ]
+    } case ;
+
+: yes/no>bool ( string -- t/f )
+    {
+        { "yes" [ t ] }
+        { "no" [ f ] }
+        [ <not-yes/no> throw ]
+    } case ;
+
+: assure-no-extra ( seq -- )
+    [ first ] map {
+        T{ name f "" "version" f }
+        T{ name f "" "encoding" f }
+        T{ name f "" "standalone" f }
+    } swap seq-diff
+    dup empty? [ drop ] [ <extra-attrs> throw ] if ; 
+
+: good-version ( version -- version )
+    dup { "1.0" "1.1" } member? [ <bad-version> throw ] unless ;
+
+: prolog-attrs ( alist -- prolog )
+    [ T{ name f "" "version" f } swap at
+      [ good-version ] [ <versionless-prolog> throw ] if* ] keep
+    [ T{ name f "" "encoding" f } swap at
+      "iso-8859-1" or ] keep
+    T{ name f "" "standalone" f } swap at
+    [ yes/no>bool ] [ f ] if*
+    <prolog> ;
+
+: parse-prolog ( -- prolog )
+    pass-blank middle-tag "?>" expect-string
+    dup assure-no-extra prolog-attrs
+    dup prolog-data set ;
+
+: instruct ( -- instruction )
+    (parse-name) dup "xml" =
+    [ drop parse-prolog ] [
+        dup >lower "xml" =
+        [ <capitalized-prolog> throw ]
+        [ "?>" take-string append <instruction> ] if
+    ] if ;
+
+: make-tag ( -- tag )
+    {
+        { [ get-char dup CHAR: ! = ] [ drop next direct ] }
+        { [ CHAR: ? = ] [ next instruct ] } 
+        { [ t ] [
+            start-tag [ dup add-ns pop-ns <closer> ]
+            [ middle-tag end-tag ] if
+            CHAR: > expect
+        ] }
+    } cond ;
diff --git a/extra/xml/utilities/utilities.factor b/extra/xml/utilities/utilities.factor
new file mode 100644 (file)
index 0000000..f88d4c5
--- /dev/null
@@ -0,0 +1,140 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: kernel namespaces sequences words io assocs\r
+quotations strings parser arrays xml.data xml.writer debugger\r
+splitting ;\r
+IN: xml.utilities\r
+\r
+! * System for words specialized on tag names\r
+\r
+TUPLE: process-missing process tag ;\r
+M: process-missing error.\r
+    "Tag <" write\r
+    process-missing-tag print-name\r
+    "> not implemented on process process " write\r
+    dup process-missing-process word-name print ;\r
+\r
+: run-process ( tag word -- )\r
+    2dup "xtable" word-prop\r
+    >r dup name-tag r> at* [ 2nip call ] [\r
+        drop \ process-missing construct-boa throw\r
+    ] if ;\r
+\r
+: PROCESS:\r
+    CREATE\r
+    dup H{ } clone "xtable" set-word-prop\r
+    dup [ run-process ] curry define-compound ; parsing\r
+\r
+: TAG:\r
+    scan scan-word\r
+    parse-definition\r
+    swap "xtable" word-prop\r
+    rot "/" split [ >r 2dup r> swap set-at ] each 2drop ;\r
+    parsing\r
+\r
+\r
+! * Common utility functions\r
+\r
+: build-tag* ( items name -- tag )\r
+    "" swap "" <name>\r
+    swap >r { } r> <tag> ;\r
+\r
+: build-tag ( item name -- tag )\r
+    >r 1array r> build-tag* ;\r
+\r
+: build-xml ( tag -- xml )\r
+    T{ prolog f "1.0" "iso-8859-1" f } { } rot { } <xml> ;\r
+\r
+: children>string ( tag -- string )\r
+    tag-children\r
+    dup [ string? ] all?\r
+    [ "XML tag unexpectedly contains non-text children" throw ] unless\r
+    concat ;\r
+\r
+: children-tags ( tag -- sequence )\r
+    tag-children [ tag? ] subset ;\r
+\r
+: first-child-tag ( tag -- tag )\r
+    tag-children [ tag? ] find nip ;\r
+\r
+! * Utilities for searching through XML documents\r
+! These all work from the outside in, top to bottom.\r
+\r
+: with-delegate ( object quot -- object )\r
+    over clone >r >r delegate r> call r>\r
+    [ set-delegate ] keep ; inline\r
+\r
+GENERIC# xml-each 1 ( quot tag -- ) inline\r
+M: tag xml-each\r
+    [ call ] 2keep\r
+    swap tag-children [ swap xml-each ] curry* each ;\r
+M: object xml-each\r
+    call ;\r
+M: xml xml-each\r
+    >r delegate r> xml-each ;\r
+\r
+GENERIC# xml-map 1 ( quot tag -- tag ) inline\r
+M: tag xml-map\r
+    swap clone over >r swap call r> \r
+    swap [ tag-children [ swap xml-map ] curry* map ] keep \r
+    [ set-tag-children ] keep ;\r
+M: object xml-map\r
+    call ;\r
+M: xml xml-map\r
+    swap [ swap xml-map ] with-delegate ;\r
+\r
+: xml-subset ( quot tag -- seq ) ! quot: tag -- ?\r
+    V{ } clone rot [\r
+        swap >r [ swap call ] 2keep rot r>\r
+        swap [ [ push ] keep ] [ nip ] if\r
+    ] xml-each nip ;\r
+\r
+GENERIC# xml-find 1 ( quot tag -- tag ) inline\r
+M: tag xml-find\r
+    [ call ] 2keep swap rot [\r
+        f swap\r
+        [ nip over >r swap xml-find r> swap dup ] find\r
+        2drop ! leaves result of quot\r
+    ] unless nip ;\r
+M: object xml-find\r
+    keep f ? ;\r
+M: xml xml-find\r
+    >r delegate r> xml-find ;\r
+\r
+GENERIC# xml-inject 1 ( quot tag -- ) inline\r
+M: tag xml-inject\r
+    swap [\r
+        swap [ call ] keep\r
+        [ xml-inject ] keep\r
+    ] change-each ;\r
+M: object xml-inject 2drop ;\r
+M: xml xml-inject >r delegate >r xml-inject ;\r
+\r
+! * Accessing part of an XML document\r
+\r
+: get-id ( tag id -- elem ) ! elem=tag.getElementById(id)\r
+    swap [\r
+        dup tag?\r
+        [ "id" swap at over = ]\r
+        [ drop f ] if\r
+    ] xml-find nip ;\r
+\r
+: (get-tag) ( name elem -- ? )\r
+    dup tag? [ names-match? ] [ 2drop f ] if ;\r
+\r
+: tag-named* ( tag name/string -- matching-tag )\r
+    assure-name swap [ dupd (get-tag) ] xml-find nip ;\r
+\r
+: tags-named* ( tag name/string -- tags-seq )\r
+    assure-name swap [ dupd (get-tag) ] xml-subset nip ;\r
+\r
+: tag-named ( tag name/string -- matching-tag )\r
+    ! like get-name-tag but only looks at direct children,\r
+    ! not all the children down the tree.\r
+    assure-name swap [ (get-tag) ] curry* find nip ;\r
+\r
+: tags-named ( tag name/string -- tags-seq )\r
+    assure-name swap [ (get-tag) ] curry* subset ;\r
+\r
+: assert-tag ( name name -- )\r
+    names-match? [ "Unexpected XML tag found" throw ] unless ;\r
diff --git a/extra/xml/writer/writer.factor b/extra/xml/writer/writer.factor
new file mode 100644 (file)
index 0000000..986f1b5
--- /dev/null
@@ -0,0 +1,82 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: hashtables kernel math namespaces sequences strings\r
+io io.streams.string xml.data assocs ;\r
+IN: xml.writer\r
+\r
+: write-entities\r
+    H{\r
+        { CHAR: < "&lt;"   }\r
+        { CHAR: > "&gt;"   }\r
+        { CHAR: & "&amp;"  }\r
+        { CHAR: ' "&apos;" }\r
+        { CHAR: " "&quot;" }\r
+    } ;\r
+\r
+: chars>entities ( str -- str )\r
+    #! Convert <, >, &, ' and " to HTML entities.\r
+    [ [ dup write-entities at [ % ] [ , ] ?if ] each ] "" make ;\r
+\r
+: print-name ( name -- )\r
+    dup name-space f like\r
+    [ write CHAR: : write1 ] when*\r
+    name-tag write ;\r
+\r
+: print-attrs ( hash -- )\r
+    [\r
+        first2 " " write\r
+        swap print-name\r
+        "=\"" write\r
+        chars>entities write\r
+        "\"" write\r
+    ] each ;\r
+\r
+GENERIC: write-item ( object -- )\r
+\r
+M: string write-item\r
+    chars>entities write ;\r
+\r
+M: contained-tag write-item\r
+    CHAR: < write1\r
+    dup print-name\r
+    tag-attrs print-attrs\r
+    "/>" write ;\r
+\r
+M: open-tag write-item\r
+    CHAR: < write1\r
+    dup print-name\r
+    dup tag-attrs print-attrs\r
+    CHAR: > write1\r
+    dup tag-children [ write-item ] each\r
+    "</" write print-name CHAR: > write1 ;\r
+\r
+M: comment write-item\r
+    "<!--" write comment-text write "-->" write ;\r
+\r
+M: directive write-item\r
+    "<!" write directive-text write CHAR: > write1 ;\r
+\r
+M: instruction write-item\r
+    "<?" write instruction-text write "?>" write ;\r
+\r
+: write-prolog ( xml -- )\r
+    "<?xml version=\"" write dup prolog-version write\r
+    "\" encoding=\"" write dup prolog-encoding write\r
+    prolog-standalone [ "\" standalone=\"yes" write ] when\r
+    "\"?>" write ;\r
+\r
+: write-chunk ( seq -- )\r
+    [ write-item ] each ;\r
+\r
+: write-xml ( xml -- )\r
+    dup xml-prolog write-prolog\r
+    dup xml-before write-chunk\r
+    dup write-item\r
+    xml-after write-chunk ;\r
+\r
+: print-xml ( xml -- )\r
+    write-xml nl ;\r
+\r
+: xml>string ( xml -- string )\r
+    [ write-xml ] string-out ;\r
+\r
diff --git a/extra/xml/xml-docs.factor b/extra/xml/xml-docs.factor
new file mode 100644 (file)
index 0000000..bb83358
--- /dev/null
@@ -0,0 +1,475 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
+! See http://factorcode.org/license.txt for BSD license.\r
+USING: help.markup help.syntax kernel xml xml.data xml.errors\r
+xml.writer state-parser xml.tokenize xml.utilities xml.entities\r
+strings sequences io ;\r
+\r
+HELP: string>xml\r
+{ $values { "string" "a string" } { "xml" "an xml document" } }\r
+{ $description "converts a string into an " { $link xml }\r
+    " datatype for further processing" }\r
+{ $see-also xml>string xml-reprint } ;\r
+\r
+HELP: xml>string\r
+{ $values { "xml" "an xml document" } { "string" "a string" } }\r
+{ $description "converts an xml document (" { $link xml } ") into a string" }\r
+{ $notes "does not preserve what type of quotes were used or what data was omitted from version declaration" }\r
+{ $see-also string>xml xml-reprint write-xml } ;\r
+\r
+HELP: xml-parse-error\r
+{ $class-description "the exception class that all parsing errors in XML documents are in." } ;\r
+\r
+HELP: xml-reprint\r
+{ $values { "string" "a string of XML" } }\r
+{ $description "parses XML and prints it out again, for testing purposes" }\r
+{ $notes "does not preserve what type of quotes were used or what data was omitted from version declaration" }\r
+{ $see-also write-xml xml>string string>xml } ;\r
+\r
+HELP: write-xml\r
+{ $values { "xml" "an XML document" } }\r
+{ $description "prints the contents of an XML document (" { $link xml } ") to stdio" }\r
+{ $notes "does not preserve what type of quotes were used or what data was omitted from version declaration" }\r
+{ $see-also xml>string xml-reprint read-xml } ;\r
+\r
+HELP: read-xml\r
+{ $values { "stream" "a stream that supports readln" }\r
+    { "xml" "an XML document" } }\r
+{ $description "exausts the given stream, reading an XML document from it" }\r
+{ $see-also write-xml string>xml } ;\r
+\r
+HELP: PROCESS:\r
+{ $syntax "PROCESS: word" }\r
+{ $values { "word" "a new word to define" } }\r
+{ $description "creates a new word to process XML tags" }\r
+{ $see-also POSTPONE: TAG: } ;\r
+\r
+HELP: TAG:\r
+{ $syntax "TAG: tag word definition... ;" }\r
+{ $values { "tag" "an xml tag name" } { "word" "an XML process" } }\r
+{ $description "defines what a process should do when it encounters a specific tag" }\r
+{ $examples { $code "PROCESS: x ( tag -- )\nTAG: a x drop \"hi\" write ;" } }\r
+{ $see-also POSTPONE: PROCESS: } ;\r
+\r
+HELP: xml-each\r
+{ $values { "tag" tag } { "quot" "a quotation ( element -- )" } }\r
+{ $description "applies the quotation to each element (tags, strings, etc) in the tag, moving top-down" }\r
+{ $see-also xml-map xml-subset } ;\r
+\r
+HELP: xml-map\r
+{ $values { "tag" tag } { "quot" "a quotation ( element -- element )" }\r
+    { "tag" "an XML tag with the quotation applied to each element" } }\r
+{ $description "applies the quotation to each element (tags, strings, etc) in the tag, moving top-down, and produces a new tag" }\r
+{ $see-also xml-each xml-subset } ;\r
+\r
+HELP: xml-subset\r
+{ $values { "tag" tag } { "quot" "a quotation ( tag -- ? )" }\r
+    { "seq" "sequence of elements" } }\r
+{ $description "applies the quotation to each element (tags, strings, etc) in the tag, moving top-down, producing a sequence of elements which do not return false for the sequence" }\r
+{ $see-also xml-map xml-each } ;\r
+\r
+HELP: build-tag*\r
+{ $values { "items" "sequence of elements" } { "name" "string" }\r
+    { "tag" tag } }\r
+{ $description "builds a " { $link tag } " with the specified name, in the namespace \"\" and URL \"\" containing the children listed in item" }\r
+{ $see-also build-tag build-xml } ;\r
+\r
+HELP: build-tag\r
+{ $values { "item" "an element" } { "name" string } { "tag" tag } }\r
+{ $description "builds a " { $link tag } " with the specified name containing the single child item" }\r
+{ $see-also build-tag* build-xml } ;\r
+\r
+HELP: build-xml\r
+{ $values { "tag" tag } { "xml" "an XML document" } }\r
+{ $description "builds an XML document out of a tag" }\r
+{ $see-also build-tag* build-tag } ;\r
+\r
+HELP: tag\r
+{ $class-description "tuple representing an XML tag, delegating to a " { $link\r
+name } ", containing the slots attrs (an alist of names to strings) and children (a sequence). Tags implement the sequence protocol by acting like a sequence of its chidren, and the assoc protocol by acting like its attributes." }\r
+{ $see-also <tag> name contained-tag xml } ;\r
+\r
+HELP: <tag>\r
+{ $values { "name" "an XML tag name" }\r
+    { "attrs" "an alist of names to strings" }\r
+    { "children" sequence }\r
+    { "tag" tag } }\r
+{ $description "constructs an XML " { $link tag } " with the name (not a string) and tag attributes specified in attrs and children specified" }\r
+{ $see-also tag <contained-tag> build-tag build-tag* } ;\r
+\r
+HELP: name\r
+{ $class-description "represents an XML name, with the fields space (a string representing the namespace, as written in the document, tag (a string of the actual name of the tag) and url (a string of the URL that the namespace points to)" }\r
+{ $see-also <name> tag } ;\r
+\r
+HELP: <name> ( space tag url -- name )\r
+{ $values { "space" "a string" } { "tag" "a string" } { "url" "a string" }\r
+    { "name" "an XML tag name" } }\r
+{ $description "creates a name tuple with the name-space space and the tag-name tag and the tag-url url." }\r
+{ $see-also name <tag> } ;\r
+\r
+HELP: contained-tag\r
+{ $class-description "delegates to tag representing a tag like <a/> with no contents. The tag attributes are accessed with tag-attrs" }\r
+{ $see-also tag <contained-tag> } ;\r
+\r
+HELP: <contained-tag>\r
+{ $values { "name" "an XML tag name" }\r
+    { "attrs" "an alist from names to strings" }\r
+    { "tag" tag } }\r
+{ $description "creates an empty tag (like <a/>) with the specified name and tag attributes. This delegates to tag" }\r
+{ $see-also contained-tag <tag> } ;\r
+\r
+HELP: xml\r
+{ $class-description "tuple representing an XML document, delegating to the main tag, containing the fields prolog (the header <?xml...?>), before (whatever comes between the prolog and the main tag) and after (whatever comes after the main tag)" }\r
+{ $see-also <xml> tag prolog } ;\r
+\r
+HELP: <xml>\r
+{ $values { "prolog" "an XML prolog" } { "before" "a sequence of XML elements" }\r
+{ "main" tag } { "after" "a sequence of XML elements" } { "xml" "an XML document" } }\r
+{ $description "creates an XML document, delegating to the main tag, with the specified prolog, before, and after" }\r
+{ $see-also xml <tag> } ;\r
+\r
+HELP: prolog\r
+{ $class-description "represents an XML prolog, with the tuple fields version (containing \"1.0\" or \"1.1\"), encoding (a string representing the encoding type), and standalone (t or f, whether the document is standalone without external entities)" }\r
+{ $see-also <prolog> xml } ;\r
+\r
+HELP: <prolog> ( version encoding standalone -- prolog )\r
+{ $values { "version" "a string, 1.0 or 1.1" }\r
+{ "encoding" "a string" } { "standalone" "a boolean" } { "prolog" "an XML prolog" } }\r
+{ $description "creates an XML prolog tuple" }\r
+{ $see-also prolog <xml> } ;\r
+\r
+HELP: comment\r
+{ $class-description "represents a comment in XML. Has one slot, text, which contains the string of the comment" }\r
+{ $see-also <comment> } ;\r
+\r
+HELP: <comment> ( text -- comment )\r
+{ $values { "text" "a string" } { "comment" "a comment" } }\r
+{ $description "creates an XML comment tuple" }\r
+{ $see-also comment } ;\r
+\r
+HELP: instruction\r
+{ $class-description "represents an XML instruction, such as <?xsl stylesheet='foo.xml'?>. Contains one slot, text, which contains the string between the question marks." }\r
+{ $see-also <instruction> } ;\r
+\r
+HELP: <instruction> ( text -- instruction )\r
+{ $values { "text" "a string" } { "instruction" "an XML instruction" } }\r
+{ $description "creates an XML parsing instruction, such as <?xsl stylesheet='foo.xml'?>." }\r
+{ $see-also instruction } ;\r
+\r
+HELP: names-match?\r
+{ $values { "name1" "a name" } { "name2" "a name" } { "?" "t or f" } }\r
+{ $description "checks to see if the two names match, that is, if all fields are equal, ignoring fields whose value is f in either name." }\r
+{ $example "USE: xml.data" "T{ name f \"rpc\" \"methodCall\" f } T{ name f f \"methodCall\" \"http://www.xmlrpc.org/\" } names-match? ." "t" }\r
+{ $see-also name } ;\r
+\r
+HELP: xml-chunk\r
+{ $values { "stream" "an input stream" } { "seq" "a sequence of elements" } }\r
+{ $description "rather than parse a document, as " { $link read-xml } " does, this word parses and returns a sequence of XML elements (tags, strings, etc), ie a document fragment. This is useful for pieces of XML which may have more than one main tag." }\r
+{ $see-also write-chunk read-xml } ;\r
+\r
+HELP: xml-find\r
+{ $values { "tag" "an XML element or document" } { "quot" "a quotation ( elem -- ? )" } { "tag" "an XML element which satisfies the predicate" } }\r
+{ $description "finds the first element in the XML document which satisfies the predicate, moving from the outermost element to the innermost, top-down" }\r
+{ $see-also xml-each xml-map get-id } ;\r
+\r
+HELP: get-id\r
+{ $values { "tag" "an XML tag or document" } { "id" "a string" } { "elem" "an XML element or f" } }\r
+{ $description "finds the XML tag with the specified id, ignoring the namespace" }\r
+{ $see-also xml-find } ;\r
+\r
+HELP: process\r
+{ $values { "object" "an opener, closer, contained or text element" } }\r
+{ $description  "takes an XML event and, using the XML stack, processes it and adds it to the tree"  } ;\r
+\r
+HELP: sax\r
+{ $values { "stream" "an input stream" } { "quot" "a quotation ( xml-elem -- )" } }\r
+{ $description "parses the XML document, and whenever an event is encountered (a tag piece, comment, parsing instruction, directive or string element), the quotation is called with that event on the stack. The quotation has all responsibility to deal with the event properly, and it is advised that generic words be used in dispatching on the event class." }\r
+{ $notes "It is important to note that this is not SAX, merely an event-based XML view" }\r
+{ $see-also read-xml } ;\r
+\r
+HELP: opener\r
+{ $class-description "describes an opening tag, like <a>. Contains two slots, name and attrs containing, respectively, the name of the tag and its attributes. Usually, the name-url will be f." }\r
+{ $see-also closer contained } ;\r
+\r
+HELP: closer\r
+{ $class-description "describes a closing tag, like </a>. Contains one slot, name, containing the tag's name. Usually, the name-url will be f." }\r
+{ $see-also opener contained } ;\r
+\r
+HELP: contained\r
+{ $class-description "represents a self-closing tag, like <a/>. Contains two slots, name and attrs containing, respectively, the name of the tag and its attributes. Usually, the name-url will be f." }\r
+{ $see-also opener closer } ;\r
+\r
+HELP: parse-text\r
+{ $values { "string" "a string" } }\r
+{ $description "moves the pointer from the current spot to the beginning of the next tag, parsing the text underneath, returning the text element it passed. This parses XML entities like &bar; &#97; and &amp;" }\r
+{ $see-also parse-name } ;\r
+\r
+HELP: parse-name\r
+{ $values { "name" "an XML name" } }\r
+{ $description "parses a " { $link name } " from the input stream. Returns a name with only the name-space and name-tag defined, with name-url=f" }\r
+{ $see-also parse-text } ;\r
+\r
+HELP: make-tag\r
+{ $values { "tag" "an opener, closer or contained" } }\r
+{ $description "assuming the pointer is just past a <, this word parses until the next > and emits a tuple representing the tag parsed" }\r
+{ $see-also opener closer contained } ;\r
+\r
+HELP: pull-xml\r
+{ $class-description "represents the state of a pull-parser for XML. Has one slot, scope, which is a namespace which contains all relevant state information." }\r
+{ $see-also <pull-xml> pull-event pull-elem } ;\r
+\r
+HELP: <pull-xml>\r
+{ $values { "pull-xml" "a pull-xml tuple" } }\r
+{ $description "creates an XML pull-based parser which reads from the " { $link stdio } " stream, executing all initial XML commands to set up the parser." }\r
+{ $see-also pull-xml pull-elem pull-event } ;\r
+\r
+HELP: pull-elem\r
+{ $values { "pull" "an XML pull parser" } { "xml-elem/f" "an XML tag, string, or f" } }\r
+{ $description "gets the next XML element from the given XML pull parser. Returns f upon exhaustion." }\r
+{ $see-also pull-xml <pull-xml> pull-event } ;\r
+\r
+HELP: pull-event\r
+{ $values { "pull" "an XML pull parser" } { "xml-event/f" "an XML tag event, string, or f" } }\r
+{ $description "gets the next XML event from the given XML pull parser. Returns f upon exhaustion." }\r
+{ $see-also pull-xml <pull-xml> pull-elem } ;\r
+\r
+HELP: write-item\r
+{ $values { "object" "an XML element" } }\r
+{ $description "writes an XML element to the " { $link stdio } " stream." }\r
+{ $see-also write-chunk write-xml } ;\r
+\r
+HELP: write-chunk\r
+{ $values { "seq" "an XML document fragment" } }\r
+{ $description "writes an XML document fragment, ie a sequence of XML elements, to the " { $link stdio } " stream." }\r
+{ $see-also write-item write-xml } ;\r
+\r
+HELP: tag-named*\r
+{ $values { "tag" "an XML tag or document" } { "name/string" "an XML name or string representing a name" } { "matching-tag" tag } }\r
+{ $description "finds an XML tag with a matching name, recursively searching children and children of children" }\r
+{ $see-also tags-named tag-named tags-named* } ;\r
+\r
+HELP: tags-named*\r
+{ $values { "tag" "an XML tag or document" } { "name/string" "an XML name or string representing a name" } { "tags-seq" "a sequence of tags" } }\r
+{ $description "returns a sequence of all tags of a matching name, recursively searching children and children of children" }\r
+{ $see-also tag-named tag-named* tags-named } ;\r
+\r
+HELP: children>string\r
+{ $values { "tag" "an XML tag or document" } { "string" "a string" } }\r
+{ $description "concatenates the children of the tag, ignoring everything that's not a string" } ;\r
+\r
+HELP: children-tags\r
+{ $values { "tag" "an XML tag or document" } { "sequence" sequence } }\r
+{ $description "gets the children of the tag that are themselves tags" }\r
+{ $see-also first-child-tag } ;\r
+\r
+HELP: first-child-tag\r
+{ $values { "tag" "an XML tag or document" } { "tag" tag } }\r
+{ $description "returns the first child of the given tag that is a tag" }\r
+{ $see-also children-tags } ;\r
+\r
+HELP: multitags\r
+{ $class-description "XML parsing error describing the case where there is more than one main tag in a document. Contains no slots" } ;\r
+\r
+HELP: notags\r
+{ $class-description "XML parsing error describing the case where an XML document contains no main tag, or any tags at all" } ;\r
+\r
+HELP: extra-attrs\r
+{ $class-description "XML parsing error describing the case where the XML prolog (<?xml ...?>) contains attributes other than the three allowed ones, standalone, version and encoding. Contains one slot, attrs, which is a hashtable of all the extra attributes' names. Delegates to " { $link parsing-error } "." } ;\r
+\r
+HELP: nonexist-ns\r
+{ $class-description "XML parsing error describing the case where a namespace doesn't exist but it is used in a tag. Contains one slot, name, which contains the name of the undeclared namespace, and delegates to " { $link parsing-error } "." } ;\r
+\r
+HELP: not-yes/no\r
+{ $class-description "XML parsing error used to describe the case where standalone is set in the XML prolog to something other than 'yes' or 'no'. Delegates to " { $link parsing-error } " and contains one slot, text, which contains offending value." } ;\r
+\r
+HELP: unclosed\r
+{ $class-description "XML parsing error used to describe the case where the XML document contains classes which are not closed by the end of the document. Contains one slot, tags, a sequence of names." } ;\r
+\r
+HELP: mismatched\r
+{ $class-description "XML parsing error describing mismatched tags, eg <a></c>. Contains two slots: open is the name of the opening tag and close is the name of the closing tag. Delegates to " { $link parsing-error } " showing the location of the closing tag" } ;\r
+\r
+HELP: expected\r
+{ $class-description "XML parsing error describing when an expected token was not present. Delegates to " { $link parsing-error } ". Contains two slots, should-be, which has the expected string, and was, which has the actual string." } ;\r
+\r
+HELP: no-entity\r
+{ $class-description "XML parsing error describing the use of an undefined entity in a case where standalone is marked yes. Delegates to " { $link parsing-error } ". Contains one slot, thing, containing a string representing the entity." } ;\r
+\r
+HELP: xml-string-error\r
+{ $class-description "XML parsing error that delegates to " { $link parsing-error } " and represents an other, unspecified error, which is represented by the slot string, containing a string describing the error." } ;\r
+\r
+HELP: open-tag\r
+{ $class-description "represents a tag that does have children, ie is not a contained tag" }\r
+{ $notes "the constructor used for this class is simply " { $link <tag> } "." }\r
+{ $see-also tag contained-tag } ;\r
+\r
+HELP: tag-named\r
+{ $values { "tag" "an XML tag or document" }\r
+    { "name/string" "an XML name or string representing the name" }\r
+    { "matching-tag" tag } }\r
+{ $description "finds the first tag with matching name which is the direct child of the given tag" }\r
+{ $see-also tags-named* tag-named* tags-named } ;\r
+\r
+HELP: tags-named\r
+{ $values { "tag" "an XML tag or document" }\r
+    { "name/string" "an XML name or string representing the name" }\r
+    { "tags-seq" "a sequence of tags" } }\r
+{ $description "finds all tags with matching name that are the direct children of the given tag" }\r
+{ $see-also tag-named* tags-named* tag-named } ;\r
+\r
+HELP: state-parse\r
+{ $values { "stream" "an input stream" } { "quot" "a quotation ( -- )" } }\r
+{ $description "takes a stream and runs an imperative parser on it, allowing words like " { $link next } " to be used within the context of the stream." } ;\r
+\r
+HELP: pre/post-content\r
+{ $class-description "describes the error where a non-whitespace string is used before or after the main tag in an XML document. Contains two slots: string contains the offending string, and pre? is t if it occured before the main tag and f if it occured after" } ;\r
+\r
+HELP: entities\r
+{ $description "a hash table from default XML entity names (like &amp; and &lt;) to the characters they represent. This is automatically included when parsing any XML document." }\r
+{ $see-also html-entities } ;\r
+\r
+HELP: html-entities\r
+{ $description "a hash table from HTML entity names to their character values" }\r
+{ $see-also entities with-html-entities } ;\r
+\r
+HELP: with-entities\r
+{ $values { "entities" "a hash table of strings to chars" }\r
+    { "quot" "a quotation ( -- )" } }\r
+{ $description "calls the quotation using the given table of entity values (symbolizing, eg, that &foo; represents CHAR: a) on top of the default XML entities" }\r
+{ $see-also with-html-entities } ;\r
+\r
+HELP: with-html-entities\r
+{ $values { "quot" "a quotation ( -- )" } }\r
+{ $description "calls the given quotation using HTML entity values" }\r
+{ $see-also html-entities with-entities } ;\r
+\r
+HELP: file>xml\r
+{ $values { "filename" "a string representing a filename" }\r
+    { "xml" "an XML document" } }\r
+{ $description "opens the given file, reads it in as XML, closes the file and returns the corresponding XML tree" }\r
+{ $see-also string>xml read-xml } ;\r
+\r
+ARTICLE: { "xml" "basic" } "Basic words for XML processing"\r
+    "These are the most basic words needed for processing an XML document"\r
+    $nl\r
+    "Parsing XML:"\r
+    { $subsection string>xml }\r
+    { $subsection read-xml }\r
+    { $subsection xml-chunk }\r
+    { $subsection file>xml }\r
+    "Printing XML"\r
+    { $subsection xml>string }\r
+    { $subsection write-xml }\r
+    { $subsection write-item }\r
+    { $subsection write-chunk }\r
+    "Other"\r
+    { $subsection xml-reprint } ;\r
+\r
+ARTICLE: { "xml" "classes" } "XML data classes"\r
+    "Data types that XML documents are made of:"\r
+    { $subsection name }\r
+    { $subsection tag }\r
+    { $subsection contained-tag }\r
+    { $subsection open-tag }\r
+    { $subsection xml }\r
+    { $subsection prolog }\r
+    { $subsection comment }\r
+    { $subsection instruction } ;\r
+\r
+ARTICLE: { "xml" "construct" } "XML data constructors"\r
+    "These data types are constructed with:"\r
+    { $subsection <name> }\r
+    { $subsection <tag> }\r
+    { $subsection <contained-tag> }\r
+    { $subsection <xml> }\r
+    { $subsection <prolog> }\r
+    { $subsection <comment> }\r
+    { $subsection <instruction> } ;\r
+\r
+ARTICLE: { "xml" "utils" } "XML processing utilities"\r
+    "Utilities for processing XML include..."\r
+    $nl\r
+    "System sfor creating words which dispatch on XML tags:"\r
+    { $subsection POSTPONE: PROCESS: }\r
+    { $subsection POSTPONE: TAG: }\r
+    "Combinators for traversing XML trees:"\r
+    { $subsection xml-each }\r
+    { $subsection xml-map }\r
+    { $subsection xml-subset }\r
+    { $subsection xml-find }\r
+    "Getting parts of an XML document or tag:"\r
+    $nl\r
+    "Note: the difference between tag-named* and tag-named is that the former searches recursively among all children and children of children of the tag, while the latter only looks at the direct children, and is therefore more efficient."\r
+    { $subsection tag-named }\r
+    { $subsection tags-named }\r
+    { $subsection tag-named* }\r
+    { $subsection tags-named* }\r
+    { $subsection get-id }\r
+    "Words for simplified generation of XML:"\r
+    { $subsection build-tag* }\r
+    { $subsection build-tag }\r
+    { $subsection build-xml }\r
+    "Other relevant words:"\r
+    { $subsection children>string }\r
+    { $subsection children-tags }\r
+    { $subsection first-child-tag }\r
+    { $subsection names-match? }\r
+    { $subsection assert-tag } ;\r
+\r
+ARTICLE: { "xml" "internal" } "Internals of the XML parser"\r
+    "The XML parser creates its own parsing framework to process XML documents. The parser operates on streams. Important words involved in processing are:"\r
+    { $subsection parse-text }\r
+    { $subsection make-tag }\r
+    { $subsection parse-name }\r
+    { $subsection process }\r
+    "The XML parser is implemented using the libs/state-parser module. For more information, see " { $link { "state-parser" "main" } } ;\r
+\r
+ARTICLE: { "xml" "events" } "Event-based XML parsing"\r
+    "In addition to DOM-style parsing based around " { $link read-xml } ", the XML module also provides SAX-style event-based parsing. This uses much of the same data structures as normal XML, with the exception of the classes " { $link xml } " and " { $link tag } " and as such, the articles " { $link { "xml" "classes" } } " and " { $link { "xml" "construct" } } " may be useful in learning how to process documents in this way. Other useful words are:"\r
+    { $subsection sax }\r
+    { $subsection opener }\r
+    { $subsection closer }\r
+    { $subsection contained }\r
+    "There is also pull-based parsing to augment the push-parsing of SAX. This is probably easier to use and more logical. It uses the same parsing objects as the above style of parsing, except string elements are always in arrays, for example { \"\" }. Relevant pull-parsing words are:"\r
+    { $subsection <pull-xml> }\r
+    { $subsection pull-xml }\r
+    { $subsection pull-event }\r
+    { $subsection pull-elem } ;\r
+\r
+ARTICLE: { "xml" "errors" } "XML parsing errors"\r
+    "The XML module provides a rich and highly inspectable set of parsing errors. All XML errors are described by the union class " { $link xml-parse-error } " but there are many classes contained in that:"\r
+    { $subsection multitags }\r
+    { $subsection notags }\r
+    { $subsection extra-attrs }\r
+    { $subsection nonexist-ns }\r
+    { $subsection not-yes/no }\r
+    { $subsection unclosed }\r
+    { $subsection mismatched }\r
+    { $subsection expected }\r
+    { $subsection no-entity }\r
+    { $subsection pre/post-content }\r
+    "Additionally, most of these errors delegate to " { $link parsing-error } " in order to provide more information"\r
+    $nl\r
+    "Note that, in parsing an XML document, only the first error is reported." ;\r
+\r
+ARTICLE: { "xml" "entities" } "XML entities"\r
+    "When XML is parsed, entities like &foo; are replaced with the characters they represent. A few entities like &amp; and &lt; are defined by default, but more are available, and the set of entities can be customized. Below are some words involved in XML entities, defined in the vocabulary 'entities':"\r
+    { $subsection entities }\r
+    { $subsection html-entities }\r
+    { $subsection with-entities }\r
+    { $subsection with-html-entities } ;\r
+\r
+ARTICLE: { "xml" "intro" } "XML"\r
+    "The XML module attempts to implement the XML 1.1 standard, converting strings of text into XML and vice versa. It currently is a work in progress."\r
+    $nl\r
+    "The XML module was implemented by Daniel Ehrenberg, with contributions from the Factor community"\r
+    { $subsection { "xml" "basic" } }\r
+    { $subsection { "xml" "classes" } }\r
+    { $subsection { "xml" "construct" } }\r
+    { $subsection { "xml" "utils" } }\r
+    { $subsection { "xml" "internal" } }\r
+    { $subsection { "xml" "events" } }\r
+    { $subsection { "xml" "errors" } }\r
+    { $subsection { "xml" "entities" } } ;\r
+\r
+IN: xml\r
+\r
+ABOUT: { "xml" "intro" }\r
diff --git a/extra/xml/xml-tests.factor b/extra/xml/xml-tests.factor
new file mode 100644 (file)
index 0000000..1292383
--- /dev/null
@@ -0,0 +1,13 @@
+USING: io.files tools.test sequences namespaces kernel ;
+
+{
+    "arithmetic"
+    "errors"
+    "soap"
+    "templating"
+    "test"
+}
+[
+    "resource:extra/xml/test/" swap ".factor" 3append run-test
+    failures get push-all
+] each
diff --git a/extra/xml/xml.factor b/extra/xml/xml.factor
new file mode 100644 (file)
index 0000000..0889d79
--- /dev/null
@@ -0,0 +1,174 @@
+! Copyright (C) 2005, 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: io io.streams.string io.files kernel math namespaces
+prettyprint sequences arrays generic strings vectors
+xml.char-classes xml.data xml.errors xml.tokenize xml.writer
+xml.utilities state-parser assocs ;
+IN: xml
+
+!   -- Overall parser with data tree
+
+! A stack of { tag children } pairs
+SYMBOL: xml-stack
+
+: <unclosed> ( -- unclosed )
+    xml-stack get 1 tail-slice [ first opener-name ] map
+    { set-unclosed-tags } unclosed construct ;
+
+: add-child ( object -- )
+    xml-stack get peek second push ;
+
+: push-xml ( object -- )
+    V{ } clone 2array xml-stack get push ;
+
+: pop-xml ( -- object )
+    xml-stack get pop ;
+
+GENERIC: process ( object -- )
+
+M: object process add-child ;
+
+M: prolog process
+    xml-stack get V{ { f V{ "" } } } =
+    [ <bad-prolog> throw ] unless drop ;
+
+M: instruction process
+    xml-stack get length 1 =
+    [ <bad-instruction> throw ] unless
+    add-child ;
+
+M: directive process
+    xml-stack get dup length 1 =
+    swap first second [ tag? ] contains? not and
+    [ <bad-directive> throw ] unless
+    add-child ;
+
+M: contained process
+    [ contained-name ] keep contained-attrs 
+    <contained-tag> add-child ;
+
+M: opener process push-xml ;
+
+: check-closer ( name opener -- name opener )
+    dup [ <unopened> throw ] unless
+    2dup opener-name =
+    [ opener-name swap <mismatched> throw ] unless ;
+
+M: closer process
+    closer-name pop-xml first2
+    >r check-closer opener-attrs r>
+    <tag> add-child ;
+
+: init-xml-stack ( -- )
+    V{ } clone xml-stack set f push-xml ;
+
+: default-prolog ( -- prolog )
+    "1.0" "iso-8859-1" f <prolog> ;
+
+: reset-prolog ( -- )
+    default-prolog prolog-data set ;
+
+: init-xml ( -- )
+    reset-prolog init-xml-stack init-ns-stack ;
+
+: assert-blanks ( seq pre? -- )
+    swap [ string? ] subset
+    [
+        dup [ blank? ] all?
+        [ drop ] [ swap <pre/post-content> throw ] if
+    ] each drop ;
+
+: no-pre/post ( pre post -- pre post/* )
+    ! this does *not* affect the contents of the stack
+    >r dup t assert-blanks r>
+    dup f assert-blanks ;
+
+: no-post-tags ( post -- post/* )
+    ! this does *not* affect the contents of the stack
+    dup [ tag? ] contains? [ <multitags> throw ] when ; 
+
+: assure-tags ( seq -- seq )
+    ! this does *not* affect the contents of the stack
+    [ <notags> throw ] unless* ;
+
+: make-xml-doc ( prolog seq -- xml-doc )
+    dup [ tag? ] find
+    >r assure-tags swap cut 1 tail
+    no-pre/post no-post-tags
+    r> swap <xml> ;
+
+! * Views of XML
+
+SYMBOL: text-now?
+
+TUPLE: pull-xml scope ;
+: <pull-xml> ( -- pull-xml )
+    [
+        stdio [ ] change ! bring stdio var in this scope
+        init-parser reset-prolog init-ns-stack
+        text-now? on
+    ] H{ } make-assoc
+    { set-pull-xml-scope } pull-xml construct ;
+
+: pull-event ( pull -- xml-event/f )
+    pull-xml-scope [
+        text-now? get [ parse-text f ] [
+            get-char [ make-tag t ] [ f f ] if
+        ] if text-now? set
+    ] bind ;
+
+: done? ( -- ? )
+    xml-stack get length 1 = ;
+
+: (pull-elem) ( pull -- xml-elem/f )
+    dup pull-event dup closer? done? and [ nip ] [
+        process done?
+        [ drop xml-stack get first second ]
+        [ (pull-elem) ] if
+    ] if ;
+
+: pull-elem ( pull -- xml-elem/f )
+    [ init-xml-stack (pull-elem) ] with-scope ;
+
+: call-under ( quot object -- quot )
+    swap dup slip ; inline
+
+: sax-loop ( quot -- ) ! quot: xml-elem --
+    parse-text call-under
+    get-char [ make-tag call-under sax-loop ]
+    [ drop ] if ; inline
+
+: sax ( stream quot -- ) ! quot: xml-elem --
+    swap [
+        reset-prolog init-ns-stack
+        prolog-data get call-under
+        sax-loop
+    ] state-parse ; inline
+
+: (read-xml) ( -- )
+    [ process ] sax-loop ; inline
+
+: (xml-chunk) ( stream -- prolog seq )
+    [
+        init-xml (read-xml)
+        done? [ <unclosed> throw ] unless
+        xml-stack get first second
+        prolog-data get swap
+    ] state-parse ;
+
+: read-xml ( stream -- xml )
+    #! Produces a tree of XML nodes
+    (xml-chunk) make-xml-doc ;
+
+: xml-chunk ( stream -- seq )
+    (xml-chunk) nip ;
+
+: string>xml ( string -- xml )
+    <string-reader> read-xml ;
+
+: file>xml ( filename -- xml )
+    <file-reader> read-xml ;
+
+: xml-reprint ( string -- )
+    string>xml print-xml ;
+
diff --git a/extra/yahoo/authors.txt b/extra/yahoo/authors.txt
new file mode 100644 (file)
index 0000000..f990dd0
--- /dev/null
@@ -0,0 +1 @@
+Daniel Ehrenberg
diff --git a/extra/yahoo/summary.txt b/extra/yahoo/summary.txt
new file mode 100644 (file)
index 0000000..662369d
--- /dev/null
@@ -0,0 +1 @@
+Yahoo! search example using XML-RPC
diff --git a/extra/yahoo/tags.txt b/extra/yahoo/tags.txt
new file mode 100644 (file)
index 0000000..2675462
--- /dev/null
@@ -0,0 +1,2 @@
+demos
+web
diff --git a/extra/yahoo/test-results.xml b/extra/yahoo/test-results.xml
new file mode 100644 (file)
index 0000000..98345ae
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:srch" xsi:schemaLocation="urn:yahoo:srch http://api.search.yahoo.com/WebSearchService/V1/WebSearchResponse.xsd" type="web" totalResultsAvailable="16800000" totalResultsReturned="3" firstResultPosition="1" moreSearch="/WebSearchService/V1/webSearch?query=foo&amp;appid=Factor-search&amp;region=us">
+<Result><Title>Official Foo Fighters</Title><Summary>Official site with news, tour dates, discography, store, community, and more.</Summary><Url>http://www.foofighters.com/</Url><ClickUrl>http://uk.wrs.yahoo.com/_ylt=A9htfSKQuq5FGiUA_S7dmMwF;_ylu=X3oDMTB2b2gzdDdtBGNvbG8DZQRsA1dTMQRwb3MDMQRzZWMDc3IEdnRpZAM-/SIG=11fm5b0tf/EXP=1169165328/**http%3a//www.foofighters.com/</ClickUrl><DisplayUrl>www.foofighters.com/</DisplayUrl><ModificationDate>1169020800</ModificationDate><MimeType>text/html</MimeType>
+<Cache><Url>http://uk.wrs.yahoo.com/_ylt=A9htfSKQuq5FGiUA_i7dmMwF;_ylu=X3oDMTBwZTdwbWtkBGNvbG8DZQRwb3MDMQRzZWMDc3IEdnRpZAM-/SIG=15l9o35km/EXP=1169165328/**http%3a//216.109.125.130/search/cache%3fei=UTF-8%26appid=Factor-search%26query=foo%26results=3%26u=www.foofighters.com/%26w=foo%26d=abqay0VuOItD%26icp=1%26.intl=us</Url><Size>17070</Size></Cache>
+</Result>
+
+<Result><Title>foo</Title><Summary>When foo' is used in connection with bar' it has generally traced to the WWII ... was itself a derivative of foo' perhaps influenced by German furchtbar ...</Summary><Url>http://www.catb.org/~esr/jargon/html/F/foo.html</Url><ClickUrl>http://uk.wrs.yahoo.com/_ylt=A9htfSKQuq5FGiUAAC_dmMwF;_ylu=X3oDMTB2dnY0Nm1iBGNvbG8DZQRsA1dTMQRwb3MDMgRzZWMDc3IEdnRpZAM-/SIG=125tgmioe/EXP=1169165328/**http%3a//www.catb.org/%7eesr/jargon/html/F/foo.html</ClickUrl><DisplayUrl>www.catb.org/~esr/jargon/html/F/foo.html</DisplayUrl><ModificationDate>1072684800</ModificationDate><MimeType>text/html</MimeType>
+<Cache><Url>http://uk.wrs.yahoo.com/_ylt=A9htfSKQuq5FGiUAAS_dmMwF;_ylu=X3oDMTBwbGppbHRwBGNvbG8DZQRwb3MDMgRzZWMDc3IEdnRpZAM-/SIG=16d2m07tf/EXP=1169165328/**http%3a//216.109.125.130/search/cache%3fei=UTF-8%26appid=Factor-search%26query=foo%26results=3%26u=www.catb.org/%257Eesr/jargon/html/F/foo.html%26w=foo%26d=N-xgzEVuOH3u%26icp=1%26.intl=us</Url><Size>10208</Size></Cache>
+</Result>
+
+<Result><Title>foo - a definition from Whatis.com</Title><Summary>... tend to use the term foo (pronounced FOO) as a universal substitute for ... The unofficial "Etymology of Foo" from the IETF traces it back to Bill Holman's cartoon. ...</Summary><Url>http://whatis.techtarget.com/definition/0,,sid9_gci212139,00.html</Url><ClickUrl>http://uk.wrs.yahoo.com/_ylt=A9htfSKQuq5FGiUAAy_dmMwF;_ylu=X3oDMTB2c2Zzc202BGNvbG8DZQRsA1dTMQRwb3MDMwRzZWMDc3IEdnRpZAM-/SIG=12lhlmeju/EXP=1169165328/**http%3a//whatis.techtarget.com/definition/0,,sid9_gci212139,00.html</ClickUrl><DisplayUrl>whatis.techtarget.com/definition/0,,sid9_gci212139,00.html</DisplayUrl><ModificationDate>1169020800</ModificationDate><MimeType>text/html</MimeType>
+<Cache><Url>http://uk.wrs.yahoo.com/_ylt=A9htfSKQuq5FGiUABC_dmMwF;_ylu=X3oDMTBwbTJyZTk4BGNvbG8DZQRwb3MDMwRzZWMDc3IEdnRpZAM-/SIG=177a52ljh/EXP=1169165328/**http%3a//216.109.125.130/search/cache%3fei=UTF-8%26appid=Factor-search%26query=foo%26results=3%26u=whatis.techtarget.com/definition/0%252C%252Csid9_gci212139%252C00.html%26w=foo%26d=I3EHekVuOIqr%26icp=1%26.intl=us</Url><Size>64567</Size></Cache>
+</Result>
+</ResultSet>
+<!-- ws02.search.re2.yahoo.com compressed/chunked Wed Jan 17 16:08:48 PST 2007 -->
diff --git a/extra/yahoo/yahoo-docs.factor b/extra/yahoo/yahoo-docs.factor
new file mode 100644 (file)
index 0000000..abc80c4
--- /dev/null
@@ -0,0 +1,5 @@
+USING: yahoo help.syntax help.markup ;
+
+HELP: search-yahoo
+{ $values { "search" "a string" } { "num" "a positive integer" } { "seq" "sequence of arrays of length 3" } }
+{ $description "Uses Yahoo's REST API to search for the query specified in the search string, getting the number of answers specified. Returns a sequence of 3arrays, { title url summary }, each of which is a string." } ;
diff --git a/extra/yahoo/yahoo-tests.factor b/extra/yahoo/yahoo-tests.factor
new file mode 100644 (file)
index 0000000..22ea687
--- /dev/null
@@ -0,0 +1,11 @@
+USING: tools.test yahoo kernel io.files xml sequences ;
+
+[ T{
+    result
+    f
+    "Official Foo Fighters"
+    "http://www.foofighters.com/"
+    "Official site with news, tour dates, discography, store, community, and more."
+} ] [ "extra/yahoo/test-results.xml" resource-path <file-reader> read-xml parse-yahoo first ] unit-test
+
+[ "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=Factor-search&query=hi&results=1" ] [ "hi" 1 query ] unit-test
diff --git a/extra/yahoo/yahoo.factor b/extra/yahoo/yahoo.factor
new file mode 100644 (file)
index 0000000..8bcb913
--- /dev/null
@@ -0,0 +1,31 @@
+! Copyright (C) 2006 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: http.client xml xml.utilities kernel sequences
+namespaces http math.parser help ;
+IN: yahoo
+
+TUPLE: result title url summary ;
+
+C: <result> result
+
+: parse-yahoo ( xml -- seq )
+    "Result" tags-named* [
+        { "Title" "Url" "Summary" }
+        [ tag-named children>string ] curry* map
+        first3 <result>
+    ] map ;
+
+: yahoo-url ( -- str )
+    "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=Factor-search&query=" ;
+
+: query ( search num -- url )
+    [
+        yahoo-url %
+        swap url-encode %
+        "&results=" % #
+    ] "" make ;
+
+: search-yahoo ( search num -- seq )
+    query http-get 2nip
+    [ "Search failed" throw ] unless*
+    string>xml parse-yahoo ;
diff --git a/libs/README.txt b/libs/README.txt
deleted file mode 100644 (file)
index 469299d..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-This directory contains Factor code that is not part of the core
-library, but is useful enough to ship with the Factor distribution.
-
-Modules can be loaded from the listener:
-
-  "libs/modulename" require
-
-Available libraries:
-
-- alien -- Alien utility words (Eduardo Cavazos)
-- automata -- Graphics demo for the UI (Eduardo Cavazos)
-- base64 -- base64 encoding/decoding (Doug Coleman)
-- benchmarks -- Various performance benchmarks (Slava Pestov)
-- boids -- Graphics demo for the UI (Eduardo Cavazos)
-- cairo -- cairo bindings (Sampo Vuori)
-- calendar -- timestamp/calendar with timezones (Doug Coleman)
-- cocoa-callbacks -- Allows you to use Factor quotations as actions (Slava Pestov)
-- concurrency -- Erlang/Termite-style distibuted concurrency (Chris Double)
-- coroutines -- coroutines (Chris Double)
-- crypto -- Various cryptographic algorithms (Doug Coleman)
-- dlists -- double-linked-lists (Mackenzie Straight)
-- emacs -- emacs integration (Eduardo Cavazos)
-- factory -- X11 window manager (Eduardo Cavazos)
-- fjsc -- Factor to Javascript compiler (Chris Double)
-- furnace -- Web framework (Slava Pestov)
-- furnace-pastebin -- demo app for Furnace (Slava Pestov)
-- gap-buffer -- Efficient text editor buffer (Alex Chapman)
-- google-search -- Access Google Search SOAP API (Chris Double)
-- hardware-info -- Information about your computer (Doug Coleman)
-- hexdump -- Hexdump routine (Doug Coleman)
-- http -- Code shared by HTTP server and client (Slava Pestov)
-- httpd -- HTTP server (Slava Pestov, Chris Double)
-- http-client -- HTTP client (Slava Pestov)
-- jedit -- jEdit editor integration (Slava Pestov)
-- jni -- Java Native Interface Wrapper (Chris Double)
-- json -- JSON reader and writer (Chris Double)
-- lambda -- Lambda calculus interpreter (Matthew Willis)
-- lazy-lists -- Lazy evaluation lists (Chris Double, Matthew Willis)
-- lindenmayer -- L-systems tool (Eduardo Cavazos)
-- match -- pattern matching (Chris Double)
-- math -- extended math library (Doug Coleman, Slava Pestov)
-- parser-combinators -- Haskell-style parser combinators (Chris Double)
-- porter-stemmer -- Porter stemming algorithm (Slava Pestov)
-- postgresql -- PostgreSQL binding (Doug Coleman)
-- process -- Run external programs (Slava Pestov, Doug Coleman)
-- random-tester -- Random compiler tester (Doug Coleman)
-- rss -- Code to retrieve and parse an RSS2 file (Chris Double)
-- sequences -- Non-core sequence words (Eduardo Cavazos)
-- serialize -- Binary object serialization (Chris Double)
-- shuffle -- Shuffle words not in the core library (Doug Coleman)
-- slate -- Graphics canvas for the UI (Eduardo Cavazos)
-- slate-examples -- Examples of how to use slate (Eduardo Cavazos)
-- space-invaders -- Intel 8080-based Space Invaders arcade machine emulator (Chris Double)
-- splay-trees -- Splay trees (Mackenzie Straight)
-- sqlite -- SQLite binding (Chris Double)
-- tetris -- Tetris game (Alex Chapman)
-- textmate -- TextMate integration (Benjamin Pollack)
-- topology -- Computational algebraic topology (Slava Pestov)
-- usb -- Wrapper for libusb (Chris Double)
-- units -- Unit conversion (Doug Coleman)
-- vars -- Alternative syntax for variables (Eduardo Cavazos)
-- vim -- VIM integration (Alex Chapman)
-- x11 -- X Window System client library (Eduardo Cavazos)
-- xml -- XML parser (Daniel Ehrenberg)
-- xml-rpc -- XML-RPC client and server (Daniel Ehrenberg)
diff --git a/libs/alien.factor b/libs/alien.factor
deleted file mode 100644 (file)
index 6741ef6..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-USING: kernel alien sequences ;
-IN: alien-contrib
-
-: copy-seq-to-float-array ( seq byte-array -- byte-array )
-swap dup length [ pick set-float-nth ] 2each ;
-
-: >float-array ( seq -- byte-array )
-dup length "float" <c-array> copy-seq-to-float-array ;
-
-: float-array>array ( byte-array n -- array ) [ swap float-nth ] map-with ;
-
-: >void*-array 
-    [ length "void*" <c-array> ] keep
-    dup length [ pick set-char*-nth ] 2each ;
-
-: seq>void*-array ( seq -- seq byte-array )
-    #! output seq is an array of pointers that must be freed
-    [ <malloc-string> ] map dup >void*-array ;
-
-PROVIDE: libs/alien ;
diff --git a/libs/all.factor b/libs/all.factor
deleted file mode 100644 (file)
index 649c7d6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-USING: kernel modules words ;
-
-REQUIRES: libs/alien libs/base64 libs/cairo
-libs/calendar libs/concurrency libs/coroutines libs/crypto
-libs/dlists libs/emacs libs/fjsc libs/furnace libs/gap-buffer
-libs/google-search libs/hardware-info libs/http libs/httpd libs/http-client
-libs/jedit libs/jni libs/json libs/lambda libs/levenshtein 
-libs/lazy-lists libs/match libs/math libs/parser-combinators
-libs/porter-stemmer libs/postgresql libs/process
-libs/sequences libs/serialize libs/shuffle
-libs/slate libs/splay-trees libs/sqlite libs/textmate
-libs/topology libs/units libs/usb libs/vars libs/vim libs/xml
-libs/xml-rpc ;
-
-"x11" vocab [
-    "libs/x11" require
-] when
-
-"cocoa" vocab [
-    "libs/cocoa-callbacks" require
-] when
-
-PROVIDE: libs/all ;
diff --git a/libs/base64/base64.factor b/libs/base64/base64.factor
deleted file mode 100644 (file)
index a4d4f09..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-USING: kernel math sequences namespaces io strings hashtables ;
-IN: base64-internals
-
-: count-end ( seq quot -- count )
-    >r [ length ] keep r> find-last drop dup -1 = [ 2drop 0 ] [ - 1- ] if ;
-
-: ch>base64 ( ch -- ch )
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" nth ;
-
-: base64>ch ( ch -- ch )
-    {
-        f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f
-        f f f f f f f f f f 62 f f f 63 52 53 54 55 56 57 58 59 60 61 f f
-        f 0 f f f 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
-        22 23 24 25 f f f f f f 26 27 28 29 30 31 32 33 34 35 36 37 38 39
-        40 41 42 43 44 45 46 47 48 49 50 51
-    } nth ;
-
-: encode3 ( seq -- seq )
-    be> 4 [ 3 swap - -6 * shift HEX: 3f bitand ch>base64 ] map-with ;
-
-: decode4 ( str -- str )
-    [ base64>ch ] map 0 [ swap 6 shift bitor ] reduce 3 >be ;
-
-: >base64-rem ( str -- str )
-    [ 3 0 pad-right encode3 ] keep length 1+ head 4 CHAR: = pad-right ;
-
-IN: base64
-: >base64 ( str -- str )
-    #! cut string into two pieces, convert 3 bytes at a time
-    #! pad string with = when not enough bits
-    [ length dup 3 mod - ] keep cut swap
-    [
-        3 group [ encode3 % ] each
-        dup empty? [ drop ] [ >base64-rem % ] if
-    ] "" make ;
-
-: base64> ( str -- str )
-    #! input length must be a mulitple of 4
-    [
-        [ 4 group [ decode4 % ] each ] keep [ CHAR: = = not ] count-end 
-    ] SBUF" " make swap [ dup pop* ] times >string ;
-
diff --git a/libs/base64/load.factor b/libs/base64/load.factor
deleted file mode 100644 (file)
index 692e489..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-PROVIDE: libs/base64
-{ +files+ {
-    "base64.factor"
-} }
-{  +tests+ {
-    "test.factor"
-} } ;
diff --git a/libs/base64/test.factor b/libs/base64/test.factor
deleted file mode 100644 (file)
index 9bb1780..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-USING: test base64 ;
-
-[ "abcdefghijklmnopqrstuvwxyz" ] [ "abcdefghijklmnopqrstuvwxyz" >base64 base64>
-] unit-test
-[ "" ] [ "" >base64 base64> ] unit-test
-[ "a" ] [ "a" >base64 base64> ] unit-test
-[ "ab" ] [ "ab" >base64 base64> ] unit-test
-[ "abc" ] [ "abc" >base64 base64> ] unit-test
diff --git a/libs/cairo.factor b/libs/cairo.factor
deleted file mode 100644 (file)
index 0cb6a16..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-! Cairo binding
-IN: cairo
-USE: hashtables
-USE: compiler
-USE: alien
-USE: errors
-USE: kernel
-USE: math
-USE: namespaces
-USE: vectors
-USE: prettyprint
-USE: io
-USE: test
-USE: syntax
-USE: sequences
-
-! cairo_status_t
-C-ENUM:
-       CAIRO_STATUS_SUCCESS
-       CAIRO_STATUS_NO_MEMORY
-       CAIRO_STATUS_INVALID_RESTORE
-       CAIRO_STATUS_INVALID_POP_GROUP
-       CAIRO_STATUS_NO_CURRENT_POINT
-       CAIRO_STATUS_INVALID_MATRIX
-       CAIRO_STATUS_NO_TARGET_SURFACE
-       CAIRO_STATUS_NULL_POINTER
-       CAIRO_STATUS_INVALID_STRING
-;
-
-! cairo_operator_t
-C-ENUM:
-       CAIRO_OPERATOR_CLEAR
-       CAIRO_OPERATOR_SRC
-       CAIRO_OPERATOR_DST
-       CAIRO_OPERATOR_OVER
-       CAIRO_OPERATOR_OVER_REVERSE
-       CAIRO_OPERATOR_IN
-       CAIRO_OPERATOR_IN_REVERSE
-       CAIRO_OPERATOR_OUT
-       CAIRO_OPERATOR_OUT_REVERSE
-       CAIRO_OPERATOR_ATOP
-       CAIRO_OPERATOR_ATOP_REVERSE
-       CAIRO_OPERATOR_XOR
-       CAIRO_OPERATOR_ADD
-       CAIRO_OPERATOR_SATURATE
-;
-
-! cairo_line_cap_t
-C-ENUM:
-       CAIRO_LINE_CAP_BUTT
-       CAIRO_LINE_CAP_ROUND
-       CAIRO_LINE_CAP_SQUARE
-;
-
-! cair_line_join_t
-C-ENUM:
-       CAIRO_LINE_JOIN_MITER
-       CAIRO_LINE_JOIN_ROUND
-       CAIRO_LINE_JOIN_BEVEL
-;
-
-! cairo_fill_rule_t
-C-ENUM:
-       CAIRO_FILL_RULE_WINDING
-       CAIRO_FILL_RULE_EVEN_ODD
-;
-
-! cairo_font_slant_t
-C-ENUM:
-       CAIRO_FONT_SLANT_NORMAL
-       CAIRO_FONT_SLANT_ITALIC
-       CAIRO_FONT_SLANT_OBLIQUE
-;
-
-! cairo_font_weight_t
-C-ENUM:
-       CAIRO_FONT_WEIGHT_NORMAL
-       CAIRO_FONT_WEIGHT_BOLD
-;
-
-BEGIN-STRUCT: cairo_font_t
-       FIELD:  int                                     refcount
-       FIELD:  uint                            scale
-       FIELD:  void*                           backend                 ! cairo_font_backend*
-END-STRUCT
-
-BEGIN-STRUCT: cairo_rectangle_t
-       FIELD:  short                           x
-       FIELD:  short                           y
-       FIELD:  ushort                          width
-       FIELD:  ushort                          height
-END-STRUCT
-
-BEGIN-STRUCT: cairo_clip_rec_t
-       FIELD:  cairo_rectangle_t       rect
-       FIELD:  void*                           region
-       FIELD:  void*                           surface
-END-STRUCT
-
-BEGIN-STRUCT: cairo_matrix_t
-       FIELD:  void*                           m
-END-STRUCT
-
-BEGIN-STRUCT: cairo_gstate_t
-       FIELD:  uint                            operator                ! cairo_operator_t
-       FIELD:  double                          tolerance
-       FIELD:  double                          line_width
-       FIELD:  uint                            line_cap                ! cairo_line_cap_t
-       FIELD:  uint                            line_join               ! cairo_line_join_t
-       FIELD:  double                          miter_limit
-       FIELD:  uint                            fill_rule               ! cairo_fill_rule_t
-       FIELD:  void*                           dash                    ! double*
-       FIELD:  int                                     num_dashes
-       FIELD:  double                          dash_offset
-       FIELD:  char*                           font_family 
-       FIELD:  uint                            font_slant              ! cairo_font_slant_t
-       FIELD:  uint                            font_weight             ! cairo_font_weight_t
-       FIELD:  void*                           font                    ! cairo_font_t*
-       FIELD:  void*                           surface                 ! cairo_surface_t*
-       FIELD:  void*                           pattern                 ! cairo_pattern_t*
-       FIELD:  double                          alpha
-       FIELD:  cairo_clip_rec_t        clip
-       FIELD:  double                          pixels_per_inch
-       FIELD:  cairo_matrix_t          font_matrix
-       FIELD:  cairo_matrix_t          ctm
-       FIELD:  cairo_matrix_t          ctm_inverse
-       FIELD:  void*                           path                    ! cairo_path_t
-       FIELD:  void*                           pen_regular             ! cairo_pen_t
-       FIELD:  void*                           next                    ! cairo_gstate*
-END-STRUCT
-
-BEGIN-STRUCT: cairo_t
-       FIELD:  uint                    ref_count
-       FIELD:  cairo_gstate_t* gstate
-       FIELD:  uint                    status  ! cairo_status_t
-END-STRUCT
-
-! cairo_format_t
-C-ENUM:
-       CAIRO_FORMAT_ARGB32
-       CAIRO_FORMAT_RGB24
-       CAIRO_FORMAT_A8
-       CAIRO_FORMAT_A1
-;
-
-! cairo_antialias_t
-C-ENUM:
-       CAIRO_ANTIALIAS_DEFAULT
-       CAIRO_ANTIALIAS_NONE
-       CAIRO_ANTIALIAS_GRAY
-       CAIRO_ANTIALIAS_SUBPIXEL
-;
-
-! cairo_subpixel_order_t
-C-ENUM:
-       CAIRO_SUBPIXEL_ORDER_DEFAULT
-       CAIRO_SUBPIXEL_ORDER_RGB
-       CAIRO_SUBPIXEL_ORDER_BGR
-       CAIRO_SUBPIXEL_ORDER_VRGB
-       CAIRO_SUBPIXEL_ORDER_VBGR
-;
-
-! cairo_hint_style_t
-C-ENUM:
-       CAIRO_HINT_STYLE_DEFAULT
-       CAIRO_HINT_STYLE_NONE
-       CAIRO_HINT_STYLE_SLIGHT
-       CAIRO_HINT_STYLE_MEDIUM
-       CAIRO_HINT_STYLE_FULL
-;
-
-! cairo_hint_metrics_t
-C-ENUM:
-       CAIRO_HINT_METRICS_DEFAULT
-       CAIRO_HINT_METRICS_OFF
-       CAIRO_HINT_METRICS_ON
-;
-
-: cairo_create ( cairo_surface_t -- cairo_t )
-       "cairo_t*" "cairo" "cairo_create" [ "void*" ] alien-invoke ;
-
-: cairo_destroy ( cairo_t -- )
-       "void" "cairo" "cairo_destroy" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_set_operator ( cairo_t cairo_operator_t -- )
-       "void" "cairo" "cairo_set_operator" [ "cairo_t*" "int" ] alien-invoke ;
-
-: cairo_image_surface_create_for_data ( data format width height stride -- cairo_surface_t )
-       "void*" "cairo" "cairo_image_surface_create_for_data" [ "void*" "uint" "int" "int" "int" ] alien-invoke ;
-       
-: cairo_set_source_rgb ( cairo_t red green blue -- )
-       "void" "cairo" "cairo_set_source_rgb" [ "cairo_t*" "double" "double" "double" ] alien-invoke ;
-
-: cairo_set_source_rgba ( cairo_t red green blue alpha -- )
-       "void" "cairo" "cairo_set_source_rgb" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_set_source_surface ( cairo_t cairo_surface_t x y -- )
-       "void" "cairo" "cairo_set_source_surface" [ "cairo_t*" "void*" "double" "double" ] alien-invoke ;
-
-: cairo_set_tolerance ( cairo_t tolerance -- )
-       "void" "cairo" "cairo_set_tolerance" [ "cairo_t*" "double" ] alien-invoke ;
-
-: cairo_set_antialias ( cairo_t cairo_antialias_t -- )
-       "void" "cairo" "cairo_set_antialias" [ "cairo_t*" "int" ] alien-invoke ;
-
-: cairo_set_fill_rule ( cairo_t cairo_fill_rule_t -- )
-       "void" "cairo" "cairo_set_fill_rule" [ "cairo_t*" "int" ] alien-invoke ;
-
-: cairo_set_line_width ( cairo_t width -- )
-       "void" "cairo" "cairo_set_line_width" [ "cairo_t*" "double" ] alien-invoke ;
-
-: cairo_set_line_cap ( cairo_t cairo_line_cap_t -- )
-       "void" "cairo" "cairo_set_line_cap" [ "cairo_t*" "int" ] alien-invoke ;
-
-: cairo_set_line_join ( cairo_t cairo_line_join_t -- )
-       "void" "cairo" "cairo_set_line_join" [ "cairo_t*" "int" ] alien-invoke ;
-
-: cairo_set_dash ( cairo_t dashes num_dashes offset -- )
-       "void" "cairo" "cairo_set_dash" [ "cairo_t*" "double" "int" "double" ] alien-invoke ;
-
-: cairo_set_miter_limit ( cairo_t limit -- )
-       "void" "cairo" "cairo_set_miter_limit" [ "cairo_t*" "double" ] alien-invoke ;
-
-: cairo_translate ( cairo_t x y -- )
-       "void" "cairo" "cairo_translate" [ "cairo_t*" "double" "double" ] alien-invoke ;
-
-: cairo_scale ( cairo_t sx sy -- )
-       "void" "cairo" "cairo_scale" [ "cairo_t*" "double" "double" ] alien-invoke ;
-
-: cairo_rotate ( cairo_t angle -- )
-       "void" "cairo" "cairo_rotate" [ "cairo_t*" "double" ] alien-invoke ;
-
-
-! cairo path creating functions
-
-: cairo_new_path ( cairo_t -- )
-       "void" "cairo" "cairo_new_path" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_move_to ( cairo_t x y -- )
-       "void" "cairo" "cairo_move_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
-       
-: cairo_line_to ( cairo_t x y -- )
-       "void" "cairo" "cairo_line_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
-
-: cairo_curve_to ( cairo_t x1 y1 x2 y2 x3 y3 -- )
-       "void" "cairo" "cairo_curve_to" [ "cairo_t*" "double" "double" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_arc ( cairo_t xc yc radius angle1 angle2 -- )
-       "void" "cairo" "cairo_arc" [ "cairo_t*" "double" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_arc_negative ( cairo_t xc yc radius angle1 angle2 -- )
-       "void" "cairo" "cairo_arc_negative" [ "cairo_t*" "double" "double" "double" "double" "double" ] alien-invoke ;
-       
-: cairo_rel_move_to ( cairo_t dx dy -- )
-       "void" "cairo" "cairo_rel_move_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
-       
-: cairo_rel_line_to ( cairo_t dx dy -- )
-       "void" "cairo" "cairo_rel_line_to" [ "cairo_t*" "double" "double" ] alien-invoke ;
-
-: cairo_rel_curve_to ( cairo_t dx1 dy1 dx2 dy2 dx3 dy3 -- )
-       "void" "cairo" "cairo_rel_curve_to" [ "cairo_t*" "double" "double" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_rectangle ( cairo_t x y width height -- )
-       "void" "cairo" "cairo_rectangle" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_close_path ( cairo_t -- )
-       "void" "cairo" "cairo_close_path" [ "cairo_t*" ] alien-invoke ;
-
-! painting functions
-: cairo_paint ( cairo_t -- )
-       "void" "cairo" "cairo_paint" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_paint_with_alpha ( cairo_t alpha -- )
-       "void" "cairo" "cairo_paint_with_alpha" [ "cairo_t*" "double" ] alien-invoke ;
-
-: cairo_mask ( cairo_t cairo_pattern_t -- )
-       "void" "cairo" "cairo_mask" [ "cairo_t*" "void*" ] alien-invoke ;
-
-: cairo_mask_surface ( cairo_t cairo_pattern_t surface-x surface-y -- )
-       "void" "cairo" "cairo_mask_surface" [ "cairo_t*" "void*" "double" "double" ] alien-invoke ;
-
-: cairo_stroke ( cairo_t -- )
-       "void" "cairo" "cairo_stroke" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_stroke_preserve ( cairo_t -- )
-       "void" "cairo" "cairo_stroke_preserve" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_fill ( cairo_t -- )
-       "void" "cairo" "cairo_fill" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_fill_preserve ( cairo_t -- )
-       "void" "cairo" "cairo_fill_preserve" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_copy_page ( cairo_t -- )
-       "void" "cairo" "cairo_copy_page" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_show_page ( cairo_t -- )
-       "void" "cairo" "cairo_show_page" [ "cairo_t*" ] alien-invoke ;
-
-! insideness testing
-: cairo_in_stroke ( cairo_t x y -- t/f )
-       "int" "cairo" "cairo_in_stroke" [ "cairo_t*" "double" "double" ] alien-invoke ;
-
-: cairo_in_fill ( cairo_t x y -- t/f )
-       "int" "cairo" "cairo_in_fill" [ "cairo_t*" "double" "double" ] alien-invoke ;
-
-! rectangular extents
-: cairo_stroke_extents ( cairo_t x1 y1 x2 y2 -- )
-       "void" "cairo" "cairo_stroke_extents" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_fill_extents ( cairo_t x1 y1 x2 y2 -- )
-       "void" "cairo" "cairo_fill_extents" [ "cairo_t*" "double" "double" "double" "double" ] alien-invoke ;
-
-! clipping
-: cairo_reset_clip ( cairo_t -- )
-       "void" "cairo" "cairo_reset_clip" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_clip ( cairo_t -- )
-       "void" "cairo" "cairo_clip" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_clip_preserve ( cairo_t -- )
-       "void" "cairo" "cairo_clip_preserve" [ "cairo_t*" ] alien-invoke ;
-
-: cairo_set_source ( cairo_t cairo_pattern_t -- )
-       "void" "cairo" "cairo_set_source" [ "cairo_t*" "void*" ] alien-invoke ;
-
-: cairo_pattern_create_linear ( x0 y0 x1 y1 -- cairo_pattern_t )
-       "void*" "cairo" "cairo_pattern_create_linear" [ "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_pattern_create_radial ( cx0 cy0 radius0 cx1 cy1 radius1 -- cairo_pattern_t )
-       "void*" "cairo" "cairo_pattern_create_radial" [ "double" "double" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_pattern_add_color_stop_rgba ( pattern offset red green blue alpha -- status )
-       "uint" "cairo" "cairo_pattern_add_color_stop_rgba" [ "void*" "double" "double" "double" "double" "double" ] alien-invoke ;
-
-: cairo_show_text ( cairo_t msg_utf8 -- )
-       "void" "cairo" "cairo_show_text" [ "cairo_t*" "char*" ] alien-invoke ;
-
-: cairo_text_path ( cairo_t msg_utf8 -- )
-       "void" "cairo" "cairo_text_path" [ "cairo_t*" "char*" ] alien-invoke ;
-
-: cairo_select_font_face ( cairo_t family font_slant font_weight -- )
-       "void" "cairo" "cairo_select_font_face" [ "cairo_t*" "char*" "uint" "uint" ] alien-invoke ;
-
-: cairo_set_font_size ( cairo_t scale -- )
-       "void" "cairo" "cairo_set_font_size" [ "cairo_t*" "double" ] alien-invoke ;
-
-: cairo_identity_matrix ( cairo_t -- )
-       "void" "cairo" "cairo_identity_matrix" [ "cairo_t*" ] alien-invoke ;
-
-PROVIDE: libs/cairo ;
diff --git a/libs/calendar/calendar.factor b/libs/calendar/calendar.factor
deleted file mode 100644 (file)
index 3679bb4..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-IN: calendar
-USING: arrays errors generic hashtables io kernel math
-namespaces sequences strings prettyprint tools ;
-
-TUPLE: timestamp year month day hour minute second gmt-offset ;
-TUPLE: dt year month day hour minute second ;
-
-: month-names
-    {
-        "Not a month" "January" "February" "March" "April" "May" "June"
-        "July" "August" "September" "October" "November" "December"
-    } ;
-
-: months-abbreviations
-    {
-        "Not a month"
-        "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"
-    } ;
-
-: day-names
-    {
-        "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"
-    } ;
-
-: day-abbreviations2 { "Su" "Mo" "Tu" "We" "Th" "Fr" "Sa" } ;
-: day-abbreviations3 { "Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" } ;
-
-: average-month ( -- x )
-    #! length of average month in days
-    30.41666666666667 ;
-
-: compare-timestamps ( tuple tuple -- n )
-    [ tuple-slots ] 2apply <=> ;
-
-SYMBOL: a
-SYMBOL: b
-SYMBOL: c
-SYMBOL: d
-SYMBOL: e
-SYMBOL: y
-SYMBOL: m
-
-: julian-day-number ( year month day -- n )
-    #! Returns a composite date number
-    #! Not valid before year -4800
-    [
-        14 pick - 12 /i a set
-        pick 4800 + a get - y set
-        over 12 a get * + 3 - m set
-        2nip 153 m get * 2 + 5 /i + 365 y get * +
-        y get 4 /i + y get 100 /i - y get 400 /i + 32045 -
-    ] with-scope ;
-
-: julian-day-number>date ( n -- year month day )
-    #! Inverse of julian-day-number
-    [
-        32044 + a set
-        4 a get * 3 + 146097 /i b set
-        a get 146097 b get * 4 /i - c set
-        4 c get * 3 + 1461 /i d set
-        c get 1461 d get * 4 /i - e set
-        5 e get * 2 + 153 /i m set
-        100 b get * d get + 4800 -
-        m get 10 /i + m get 3 +
-        12 m get 10 /i * -
-        e get 153 m get * 2 + 5 /i - 1+
-    ] with-scope ;
-
-: set-date ( year month day timestamp -- )
-    [ set-timestamp-day ] keep
-    [ set-timestamp-month ] keep
-    set-timestamp-year ;
-
-: set-time ( hour minute second timestamp -- )
-    [ set-timestamp-second ] keep
-    [ set-timestamp-minute ] keep
-    set-timestamp-hour ;
-
-: >date< ( timestamp -- year month day )
-    [ timestamp-year ] keep
-    [ timestamp-month ] keep
-    timestamp-day ;
-
-: >time< ( timestamp -- hour minute second )
-    [ timestamp-hour ] keep
-    [ timestamp-minute ] keep
-    timestamp-second ;
-
-: zero-dt ( -- <dt> ) 0 0 0 0 0 0 <dt> ;
-: years ( n -- dt ) zero-dt [ set-dt-year ] keep ;
-: months ( n -- dt ) zero-dt [ set-dt-month ] keep ;
-: weeks ( n -- dt ) 7 * zero-dt [ set-dt-day ] keep ;
-: days ( n -- dt ) zero-dt [ set-dt-day ] keep ;
-: hours ( n -- dt ) zero-dt [ set-dt-hour ] keep ;
-: minutes ( n -- dt ) zero-dt [ set-dt-minute ] keep ;
-: seconds ( n -- dt ) zero-dt [ set-dt-second ] keep ;
-
-: julian-day-number>timestamp ( n -- timestamp )
-    julian-day-number>date 0 0 0 0 <timestamp> ;
-
-GENERIC: +year ( timestamp x -- timestamp )
-GENERIC: +month ( timestamp x -- timestamp )
-GENERIC: +day ( timestamp x -- timestamp )
-GENERIC: +hour ( timestamp x -- timestamp )
-GENERIC: +minute ( timestamp x -- timestamp )
-GENERIC: +second ( timestamp x -- timestamp )
-
-: /rem ( f n -- q r )
-    #! q is positive or negative, r is positive from 0 <= r < n
-    [ /f floor >bignum ] 2keep rem ;
-
-: float>whole-part ( float -- int float )
-    [ floor >bignum ] keep dupd swap - ;
-
-: leap-year? ( year -- ? )
-    dup 100 mod zero? 400 4 ? mod zero? ;
-
-: adjust-leap-year ( timestamp -- timestamp )
-    dup >date< 29 = swap 2 = and swap leap-year? not and [
-        dup >r timestamp-year 3 1 r> [ set-date ] keep
-    ] when ;
-
-M: integer +year ( timestamp n -- timestamp )
-    over timestamp-year + swap [ set-timestamp-year ] keep
-    adjust-leap-year ;
-M: real +year ( timestamp n -- timestamp )
-    float>whole-part rot swap 365.2425 * +day swap +year ;
-
-M: integer +month ( timestamp n -- timestamp )
-    over timestamp-month + 12 /rem
-    dup zero? [ drop 12 >r 1- r> ] when pick set-timestamp-month
-    +year ;
-M: real +month ( timestamp n -- timestamp )
-    float>whole-part rot swap average-month * +day swap +month ;
-
-M: integer +day ( timestamp n -- timestamp )
-    swap [
-        >date< julian-day-number + julian-day-number>timestamp
-    ] keep swap >r >time< r> [ set-time ] keep ;
-M: real +day ( timestamp n -- timestamp )
-    float>whole-part rot swap 24 * +hour swap +day ;
-
-M: integer +hour ( timestamp n -- timestamp )
-    over timestamp-hour + 24 /rem pick set-timestamp-hour
-    +day ;
-M: real +hour ( timestamp n -- timestamp )
-    float>whole-part rot swap 60 * +minute swap +hour ;
-
-M: integer +minute ( timestamp n -- timestamp )
-    over timestamp-minute + 60 /rem pick
-    set-timestamp-minute +hour ;
-M: real +minute ( timestamp n -- timestamp )
-    float>whole-part rot swap 60 * +second swap +minute ; 
-
-M: number +second ( timestamp n -- timestamp )
-    over timestamp-second + 60 /rem >r >bignum r>
-    pick set-timestamp-second +minute ;
-
-: +dt ( timestamp dt -- timestamp )
-    dupd
-    [ dt-second +second ] keep
-    [ dt-minute +minute ] keep
-    [ dt-hour +hour ] keep
-    [ dt-day +day ] keep
-    [ dt-month +month ] keep
-    dt-year +year
-    swap timestamp-gmt-offset over set-timestamp-gmt-offset ;
-
-: make-timestamp ( year month day hour minute second gmt-offset -- timestamp )
-    <timestamp> [ 0 seconds +dt ] keep
-    [ = [ "invalid timestamp" throw ] unless ] keep ;
-
-: array>dt ( vec -- dt ) { dt f } swap append >tuple ;
-: +dts ( dt dt -- dt ) [ tuple-slots ] 2apply v+ array>dt ;
-
-: dt>years ( dt -- x )
-    #! Uses average month/year length since dt loses calendar
-    #! data
-    tuple-slots
-    { 1 12 365.2425 8765.82 525949.2 31556952.0 }
-    [ / ] 2map sum ;
-: dt>months ( dt -- x ) dt>years 12 * ;
-: dt>days ( dt -- x ) dt>years 365.2425 * ;
-: dt>hours ( dt -- x ) dt>years 8765.82 * ;
-: dt>minutes ( dt -- x ) dt>years 525949.2 * ;
-: dt>seconds ( dt -- x ) dt>years 31556952 * ;
-
-: convert-timezone ( timestamp n -- timestamp )
-    [ over timestamp-gmt-offset - hours +dt ] keep
-    over set-timestamp-gmt-offset ;
-
-: >local-time ( timestamp -- timestamp )
-    gmt-offset convert-timezone ;
-
-: >gmt ( timestamp -- timestamp )
-    0 convert-timezone ;
-
-: unix-1970
-    1970 1 1 0 0 0 0 <timestamp> ;
-
-: unix>gmt ( n -- timestamp )
-    unix-1970 swap seconds +dt ; 
-
-: gmt ( -- timestamp )
-    #! GMT time, right now
-    unix-1970 millis 1000 /f seconds +dt ; 
-
-: timestamp- ( timestamp timestamp -- dt )
-    [ >gmt tuple-slots ] 2apply v- array>dt ;
-
-: now ( -- timestamp ) gmt >local-time ;
-: before ( dt -- -dt ) tuple-slots [ neg ] map array>dt ;
-: from-now ( dt -- timestamp ) now swap +dt ;
-: ago ( dt -- timestamp ) before from-now ;
-
-: days-in-year ( year -- n ) leap-year? 366 365 ? ;
-: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 } ;
-: days-in-month ( year month -- n )
-    swap leap-year? [
-        [ day-counts nth ] keep 2 = [ 1+ ] when
-    ] [
-        day-counts nth
-    ] if ;
-
-: zeller-congruence ( year month day -- n )
-    #! Zeller Congruence
-    #! http://web.textfiles.com/computers/formulas.txt
-    #! good for any date since October 15, 1582
-    >r dup 2 <= [ 12 + >r 1- r> ] when
-    >r dup [ 4 /i + ] keep [ 100 /i - ] keep 400 /i + r>
-        [ 1+ 3 * 5 /i + ] keep 2 * + r>
-    1+ + 7 mod ;
-
-: day-of-week ( timestamp -- n )
-    [ timestamp-year ] keep
-    [ timestamp-month ] keep
-    timestamp-day
-    zeller-congruence ;
-
-: day-of-year ( timestamp -- n )
-    [
-        [ timestamp-year leap-year? ] keep
-        [ >date< 3array ] keep timestamp-year 3 1 3array <=>
-        0 >= and 1 0 ?
-    ] keep 
-    [ timestamp-month day-counts swap head-slice sum + ] keep
-    timestamp-day + ;
-
-: print-day ( n -- )
-    number>string dup length 2 < [ bl ] when write ;
-
-: print-month ( year month -- )
-    [ month-names nth write bl . ] 2keep
-    [ 1 zeller-congruence ] 2keep
-    days-in-month day-abbreviations2 " " join print
-    over [ "   " write ] times
-    [
-        [ 1+ print-day ] keep
-        1+ + 7 mod zero? [ terpri ] [ bl ] if
-    ] each-with terpri ;
-
-: print-year ( year -- )
-    12 [ 1+ print-month terpri ] each-with ;
-
-: (timestamp>string) ( timestamp -- )
-    dup day-of-week day-abbreviations3 nth write ", " write
-    dup timestamp-day unparse write bl
-    dup timestamp-month months-abbreviations nth write bl
-    dup timestamp-year unparse write bl
-    dup timestamp-hour unparse 2 CHAR: 0 pad-left write ":" write
-    dup timestamp-minute unparse 2 CHAR: 0 pad-left write ":" write
-    timestamp-second >fixnum unparse 2 CHAR: 0 pad-left write ;
-
-: timestamp>string ( timestamp -- str )
-    [
-        (timestamp>string)
-    ] string-out ;
-
-: timestamp>http-string ( timestamp -- str )
-    #! http timestamp format
-    #! Example: Tue, 15 Nov 1994 08:12:31 GMT
-    >gmt [
-        (timestamp>string)
-        " GMT" write
-    ] string-out ;
-
diff --git a/libs/calendar/load.factor b/libs/calendar/load.factor
deleted file mode 100644 (file)
index 0533c39..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-USE: kernel
-
-PROVIDE: libs/calendar
-{ +files+ {
-    { "os-unix.factor" [ unix? ] }
-    { "os-win32.factor" [ windows? ] }
-    "calendar.factor"
-} }
-{ +tests+ { "test/calendar.factor" } } ;
diff --git a/libs/calendar/os-unix.factor b/libs/calendar/os-unix.factor
deleted file mode 100644 (file)
index 23d5a10..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-IN: calendar
-USING: alien arrays compiler errors kernel math ;
-
-TYPEDEF: uint time_t
-
-BEGIN-STRUCT: tm
-    FIELD: int sec     ! Seconds: 0-59 (K&R says 0-61?)
-    FIELD: int min     ! Minutes: 0-59
-    FIELD: int hour    ! Hours since midnight: 0-23
-    FIELD: int mday    ! Day of the month: 1-31
-    FIELD: int mon     ! Months *since* january: 0-11
-    FIELD: int year    ! Years since 1900
-    FIELD: int wday    ! Days since Sunday (0-6)
-    FIELD: int yday    ! Days since Jan. 1: 0-365
-    FIELD: int isdst   ! +1 Daylight Savings Time, 0 No DST,
-    FIELD: long gmtoff
-    FIELD: char* zone
-END-STRUCT
-
-FUNCTION: time_t time ( time_t* t ) ;
-FUNCTION: tm* localtime ( time_t* clock ) ;
-
-BEGIN-STRUCT: t
-    FIELD: long tv_sec
-    FIELD: long tv_usec
-END-STRUCT
-
-: get-time
-    f time <uint> localtime ;
-
-: timezone-name
-    get-time tm-zone ;
-
-: gmt-offset
-    get-time tm-gmtoff 3600 / ;
-
diff --git a/libs/calendar/os-win32.factor b/libs/calendar/os-win32.factor
deleted file mode 100644 (file)
index e8f0018..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-IN: calendar
-USING: alien kernel math win32-api ;
-
-: gmt-offset
-    "TIME_ZONE_INFORMATION" <c-object> dup GetTimeZoneInformation drop
-    dup TIME_ZONE_INFORMATION-Bias swap TIME_ZONE_INFORMATION-DaylightBias +
-    60 /f neg ;
-    
diff --git a/libs/calendar/test/calendar.factor b/libs/calendar/test/calendar.factor
deleted file mode 100644 (file)
index 1440677..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-USING: arrays calendar errors kernel math sequences test ;
-
-[ "invalid timestamp" ] [ [ 2004 12 32 0 0 0 0 make-timestamp ] catch ] unit-test
-[ "invalid timestamp" ] [ [ 2004 2 30 0 0 0 0 make-timestamp ] catch ] unit-test
-[ "invalid timestamp" ] [ [ 2003 2 29 0 0 0 0 make-timestamp ] catch ] unit-test
-[ "invalid timestamp" ] [ [ 2004 -2 9 0 0 0 0 make-timestamp ] catch ] unit-test
-[ "invalid timestamp" ] [ [ 2004 12 0 0 0 0 0 make-timestamp ] catch ] unit-test
-[ "invalid timestamp" ] [ [ 2004 12 1 24 0 0 0 make-timestamp ] catch ] unit-test
-[ "invalid timestamp" ] [ [ 2004 12 1 23 60 0 0 make-timestamp ] catch ] unit-test
-[ "invalid timestamp" ] [ [ 2004 12 1 23 59 60 0 0 make-timestamp ] catch ] unit-test
-
-[ f ] [ 1900 leap-year? ] unit-test
-[ t ] [ 1904 leap-year? ] unit-test
-[ t ] [ 2000 leap-year? ] unit-test
-[ f ] [ 2001 leap-year? ] unit-test
-[ f ] [ 2006 leap-year? ] unit-test
-
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 1 seconds +dt
-        2006 10 10 0 0 1 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 100 seconds +dt
-        2006 10 10 0 1 40 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -100 seconds +dt
-        2006 10 9 23 58 20 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 86400 seconds +dt
-        2006 10 11 0 0 0 0 make-timestamp = ] unit-test
-
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 10 minutes +dt
-        2006 10 10 0 10 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 10.5 minutes +dt
-        2006 10 10 0 10 30 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 3/4 minutes +dt
-        2006 10 10 0 0 45 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -3/4 minutes +dt
-        2006 10 9 23 59 15 0 make-timestamp = ] unit-test
-
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp 7200 minutes +dt
-        2006 10 15 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -10 minutes +dt
-        2006 10 9 23 50 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 10 10 0 0 0 0 make-timestamp -100 minutes +dt
-        2006 10 9 22 20 0 0 make-timestamp = ] unit-test
-
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 hours +dt
-        2006 1 1 1 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 24 hours +dt
-        2006 1 2 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -24 hours +dt
-        2005 12 31 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 12 hours +dt
-        2006 1 1 12 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 72 hours +dt
-        2006 1 4 0 0 0 0 make-timestamp = ] unit-test
-
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 days +dt
-        2006 1 2 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -1 days +dt
-        2005 12 31 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 365 days +dt
-        2007 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -365 days +dt
-        2005 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 0 make-timestamp 365 days +dt
-        2004 12 31 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 0 make-timestamp 366 days +dt
-        2005 1 1 0 0 0 0 make-timestamp = ] unit-test
-
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 11 months +dt
-        2006 12 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 12 months +dt
-        2007 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 24 months +dt
-        2008 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 13 months +dt
-        2007 2 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 months +dt
-        2006 2 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 0 months +dt
-        2006 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -1 months +dt
-        2005 12 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -2 months +dt
-        2005 11 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -13 months +dt
-        2004 12 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -24 months +dt
-        2004 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2004 2 29 0 0 0 0 make-timestamp 12 months +dt
-        2005 3 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2004 2 29 0 0 0 0 make-timestamp -12 months +dt
-        2003 3 1 0 0 0 0 make-timestamp = ] unit-test
-
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 0 years +dt
-        2006 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp 1 years +dt
-        2007 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -1 years +dt
-        2005 1 1 0 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2006 1 1 0 0 0 0 make-timestamp -100 years +dt
-        1906 1 1 0 0 0 0 make-timestamp = ] unit-test
-! [ t ] [ 2004 2 29 0 0 0 0 make-timestamp -1 years +dt
-        ! 2003 2 28 0 0 0 0 make-timestamp = ] unit-test
-
-[ 5 ] [ 2006 7 14 0 0 0 0 make-timestamp day-of-week ] unit-test
-
-[ t ] [ 2006 7 14 [ julian-day-number julian-day-number>date 0 0 0 0 make-timestamp ] 3keep 0 0 0 0 make-timestamp = ] unit-test
-
-[ 1 ] [ 2006 1 1 0 0 0 0 make-timestamp day-of-year ] unit-test
-[ 60 ] [ 2004 2 29 0 0 0 0 make-timestamp day-of-year ] unit-test
-[ 61 ] [ 2004 3 1 0 0 0 0 make-timestamp day-of-year ] unit-test
-[ 366 ] [ 2004 12 31 0 0 0 0 make-timestamp day-of-year ] unit-test
-[ 365 ] [ 2003 12 31 0 0 0 0 make-timestamp day-of-year ] unit-test
-[ 60 ] [ 2003 3 1 0 0 0 0 make-timestamp day-of-year ] unit-test
-
-[ t ] [ 2004 12 31 0 0 0 0 make-timestamp dup = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 0 make-timestamp 10 seconds 5 years +dts +dt
-        2009 1 1 0 0 10 0 make-timestamp = ] unit-test
-[ t ] [ 2004 1 1 0 0 0 0 make-timestamp -10 seconds -5 years +dts +dt
-        1998 12 31 23 59 50 0 make-timestamp = ] unit-test
-
-[ t ] [ 2004 1 1 23 0 0 12 make-timestamp 0 convert-timezone
-        2004 1 1 11 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2004 1 1 5 0 0 -11 make-timestamp 0 convert-timezone
-        2004 1 1 16 0 0 0 make-timestamp = ] unit-test
-[ t ] [ 2004 1 1 23 0 0 9.5 make-timestamp 0 convert-timezone
-        2004 1 1 13 30 0 0 make-timestamp = ] unit-test
-
diff --git a/libs/cocoa-callbacks.factor b/libs/cocoa-callbacks.factor
deleted file mode 100644 (file)
index ff2e103..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-! Copyright (C) 2005, 2006 Kevin Reid.
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc-classes
-DEFER: FactorCallback
-
-IN: cocoa-callbacks
-USING: gadgets hashtables kernel namespaces objc cocoa ;
-
-SYMBOL: callbacks
-
-: reset-callbacks ( -- )
-    H{ } clone callbacks set-global ;
-
-reset-callbacks
-
-"NSObject" "FactorCallback" {
-    { "perform:" "void" { "id" "SEL" "id" }
-        [ 2drop callbacks get hash ui-try ]
-    }
-    
-    { "dealloc" "void" { "id" "SEL" }
-        [
-            drop
-            dup callbacks get remove-hash
-            SUPER-> dealloc
-        ]
-    }
-} define-objc-class
-
-: <FactorCallback> ( quot -- id )
-    FactorCallback -> alloc -> init
-    [ callbacks get set-hash ] keep ;
-
-PROVIDE: libs/cocoa-callbacks ;
diff --git a/libs/concurrency/concurrency-tests.factor b/libs/concurrency/concurrency-tests.factor
deleted file mode 100644 (file)
index a76d49e..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-! Copyright (C) 2005 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-USING: kernel concurrency threads vectors arrays sequences namespaces 
-test errors dlists strings math words match ;
-IN: temporary
-
-[ "junk" ] [ 
-  <dlist> 
-  5 over dlist-push-end 
-  "junk" over dlist-push-end 
-  20 over dlist-push-end 
-  [ string? ] swap dlist-pop? 
-] unit-test
-
-[ 5 20 ] [ 
-  <dlist> 
-  5 over dlist-push-end 
-  "junk" over dlist-push-end 
-  20 over dlist-push-end 
-  [ string? ] over dlist-pop? drop
-  [ ] dlist-each
-] unit-test
-
-[ "junk" ] [ 
-  <dlist> 
-  5 over dlist-push-end 
-  "junk" over dlist-push-end 
-  20 over dlist-push-end 
-  [ integer? ] over dlist-pop? drop
-  [ integer? ] over dlist-pop? drop
-  [ ] dlist-each
-] unit-test
-
-[ t ] [ 
-  <dlist> 
-  5 over dlist-push-end 
-  "junk" over dlist-push-end 
-  20 over dlist-push-end 
-  [ string? ] swap dlist-pred?
-] unit-test
-
-[ t ] [ 
-  <dlist> 
-  5 over dlist-push-end 
-  "junk" over dlist-push-end 
-  20 over dlist-push-end 
-  [ integer? ] swap dlist-pred?
-] unit-test
-
-[ f ] [ 
-  <dlist> 
-  5 over dlist-push-end 
-  "junk" over dlist-push-end 
-  20 over dlist-push-end 
-  [ string? ] over dlist-pop? drop
-  [ string? ] swap dlist-pred?
-] unit-test
-
-[ V{ 1 2 3 } ] [
-  0 <vector>
-  make-mailbox
-  2dup [ mailbox-get swap push ] curry curry in-thread
-  2dup [ mailbox-get swap push ] curry curry in-thread
-  2dup [ mailbox-get swap push ] curry curry in-thread
-  1 over mailbox-put
-  2 over mailbox-put
-  3 swap mailbox-put
-] unit-test
-
-[ V{ 1 2 3 } ] [
-  0 <vector>
-  make-mailbox
-  2dup [ [ integer? ] swap mailbox-get? swap push ] curry curry in-thread
-  2dup [ [ integer? ] swap mailbox-get? swap push ] curry curry in-thread
-  2dup [ [ integer? ] swap mailbox-get? swap push ] curry curry in-thread
-  1 over mailbox-put
-  2 over mailbox-put
-  3 swap mailbox-put
-] unit-test
-
-[ V{ 1 "junk" 3 "junk2" } [ 456 ] ] [
-  0 <vector>
-  make-mailbox
-  2dup [ [ integer? ] swap mailbox-get? swap push ] curry curry in-thread
-  2dup [ [ integer? ] swap mailbox-get? swap push ] curry curry in-thread
-  2dup [ [ string? ] swap mailbox-get? swap push ] curry curry in-thread
-  2dup [ [ string? ] swap mailbox-get? swap push ] curry curry in-thread
-  1 over mailbox-put
-  "junk" over mailbox-put
-  [ 456 ] over mailbox-put
-  3 over mailbox-put
-  "junk2" over mailbox-put
-  mailbox-get
-] unit-test
-
-[ "test" ] [
-  [ self ] "test" with-process
-] unit-test
-
-
-[ "received" ] [ 
-  [
-    receive { 
-      { { ?from ?tag _ } [ ?tag "received" 2array ?from send ] } 
-    } match-cond
-  ] spawn
-  "sent" swap send-synchronous
-] unit-test
-
-[ 1 3 2 ] [
-  1 self send
-  2 self send
-  3 self send
-  receive
-  [ 2 mod 0 = not ] receive-if
-  receive
-] unit-test
-
-
-[ "crash" ] [
-  [
-    [
-      "crash" throw
-    ] spawn-link drop
-    receive
-  ] 
-  catch
-] unit-test 
-
-[ 50 ] [
-  [ 50 ] future ?future
-] unit-test
-
-[ V{ 50 50 50 } ] [
-  0 <vector>
-  <promise>
-  2dup [ ?promise swap push ] curry curry spawn drop
-  2dup [ ?promise swap push ] curry curry spawn drop
-  2dup [ ?promise swap push ] curry curry spawn drop
-  50 swap fulfill
-] unit-test  
-
-MATCH-VARS: ?value ;
-SYMBOL: increment
-SYMBOL: decrement
-SYMBOL: value
-
-: counter ( value -- )
-  receive {
-    { { increment ?value } [ ?value + counter ] }
-    { { decrement ?value } [ ?value - counter ] }
-    { { value ?from }      [ dup ?from send counter ] }
-  } match-cond ;
-
-[ -5 ] [
-  [ 0 counter ] spawn
-  { increment 10 } over send
-  { decrement 15 } over send
-  [ value , self , ] { } make swap send 
-  receive
-] unit-test
\ No newline at end of file
diff --git a/libs/concurrency/concurrency.factor b/libs/concurrency/concurrency.factor
deleted file mode 100644 (file)
index 83c92e2..0000000
+++ /dev/null
@@ -1,401 +0,0 @@
-! Copyright (C) 2005 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! Concurrency library for Factor based on Erlang/Termite style
-! concurrency.
-USING: kernel generic threads io namespaces errors words arrays
-       math sequences hashtables strings vectors dlists serialize 
-       match ;
-IN: concurrency
-
-#! Debug
-USE:  prettyprint
-
-: (dlist-pop?) ( dlist pred dnode -- obj | f )
-  [
-    [ dlist-node-data swap call ] 2keep rot [
-      swapd [ (dlist-unlink) ] keep dlist-node-data nip
-    ] [
-      dlist-node-next (dlist-pop?)
-    ] if
-  ] [
-    2drop f
-  ] if* ;
-
-: dlist-pop? ( pred dlist -- obj | f )
-  #! Return first item in the dlist that when passed to the
-  #! predicate quotation, true is left on the stack. The
-  #! item is removed from the dlist. The 'pred' quotation
-  #! must have stack effect ( obj -- bool ).
-  #! TODO: needs a better name and should be moved to dlists.
-  dup dlist-first swapd (dlist-pop?) ;  
-
-: (dlist-pred?) ( pred dnode -- bool )
-  [
-    [ dlist-node-data swap call ] 2keep rot [
-      2drop t
-    ] [
-      dlist-node-next (dlist-pred?)
-    ] if
-  ] [
-    drop f
-  ] if* ;
-
-: dlist-pred? ( pred dlist -- obj | f )
-  #! Return true if any item in the dlist that when passed to the
-  #! predicate quotation, true is left on the stack. 
-  #! The 'pred' quotation must have stack effect ( obj -- bool ).
-  #! TODO: needs a better name and should be moved to dlists.
-  dlist-first (dlist-pred?) ;  
-
-TUPLE: mailbox threads data ;
-
-: make-mailbox ( -- mailbox )
-  0 <vector> <dlist> <mailbox> ;
-
-: mailbox-empty? ( mailbox -- bool )
-  mailbox-data dlist-empty? ;
-
-: mailbox-put ( obj mailbox -- )
-  [ mailbox-data dlist-push-end ] keep 
-  [ mailbox-threads ] keep 0 <vector> swap set-mailbox-threads
-  [ schedule-thread ] each yield ;
-
-: (mailbox-block-unless-pred) ( pred mailbox -- pred2 mailbox2 )  
-  dup mailbox-data pick swap dlist-pred? [
-    [
-      swap mailbox-threads push stop      
-    ] callcc0 
-    (mailbox-block-unless-pred)
-  ] unless ;
-
-: (mailbox-block-if-empty) ( mailbox -- mailbox2 )  
-  dup mailbox-empty? [
-    [
-      swap mailbox-threads push stop      
-    ] callcc0 
-    (mailbox-block-if-empty)
-  ] when ;
-  
-: mailbox-get ( mailbox -- obj )
-  (mailbox-block-if-empty)
-  mailbox-data dlist-pop-front ;
-
-: (mailbox-get-all) ( mailbox -- )
-  dup mailbox-empty? [
-    drop
-  ] [
-    dup mailbox-data dlist-pop-front , (mailbox-get-all)
-  ] if ;
-
-: mailbox-get-all ( mailbox -- array )
-  (mailbox-block-if-empty)
-  [ (mailbox-get-all) ] { } make ;
-  
-: while-mailbox-empty ( mailbox quot -- )
-  over mailbox-empty? [
-    dup >r swap >r call r> r> while-mailbox-empty
-  ] [
-    2drop
-  ] if ; inline
-
-: mailbox-get? ( pred mailbox -- obj )
-  (mailbox-block-unless-pred) mailbox-data dlist-pop? ;
-
-TUPLE: node hostname port ;
-
-: localnode ( -- node )
-  \ localnode get ;
-    
-TUPLE: process links pid mailbox ;
-TUPLE: remote-process node pid ;
-
-GENERIC: send ( message process -- )
-
-: random-64 ( -- id ) 
-    #! Generate a random id to use for pids
-    [ "ID" % 64 [ 9 random-int CHAR: 0 + , ] times ] "" make ;
-
-: make-process ( -- process )
-  #! Return a process set to run on the local node. A process is 
-  #! similar to a thread but can send and receive messages to and
-  #! from other processes. It may also be linked to other processes so
-  #! that it receives a message if that process terminates.
-  [ ] random-64 make-mailbox <process> ;
-
-: make-linked-process ( process -- process )
-  #! Return a process set to run on the local node. That process is
-  #! linked to the process on the stack. It will receive a message if
-  #! that process terminates.
-  unit random-64 make-mailbox <process> ;
-
-: self ( -- process )
-  \ self get  ;
-
-: init-main-process ( -- )
-  #! Setup the main process.  
-  make-process \ self set-global ;
-
-init-main-process
-
-: with-process ( quot process -- )
-  #! Calls the quotation with 'self' set
-  #! to the given process.
-  [
-    \ self set 
-  ] make-hash
-  swap bind ;
-
-DEFER: register-process
-DEFER: unregister-process
-
-: (spawn) ( quot -- process )
-  [ in-thread ] make-process [ with-process ] over slip ;
-
-: spawn ( quot -- process )
-  [ self dup process-pid swap register-process call self process-pid unregister-process ] curry (spawn) ;
-
-TUPLE: linked-exception error ;
-
-: while-no-messages ( quot -- )
-  #! Run the quotation in a loop while no messages are in
-  #! the processes mailbox. The quot should have stack effect
-  #! ( -- ).
-  >r self process-mailbox r> while-mailbox-empty ; inline
-
-M: process send ( message process -- )
-  process-mailbox mailbox-put ;
-
-: receive ( -- message )
-  self process-mailbox mailbox-get dup linked-exception? [
-    linked-exception-error throw
-  ] when ;
-
-: receive-if ( pred -- message )
-  self process-mailbox mailbox-get? dup linked-exception? [
-    linked-exception-error throw
-  ] when ; 
-
-: rethrow-linked ( error -- )
-  #! Rethrow the error to the linked process
-  self process-links [ over <linked-exception> swap send ] each drop ;
-
-: (spawn-link) ( quot -- process )
-  [ in-thread ] self make-linked-process [ with-process ] over slip ;
-
-: spawn-link ( quot -- process )
-  [ catch [ rethrow-linked ] when* ] curry
-  [ self dup process-pid swap register-process call self process-pid unregister-process ] curry (spawn-link) ;
-
-: (recv) ( msg form -- )
-  #! Process a form with the following format:
-  #!   [ pred match-quot ] 
-  #! 'pred' is a word that has stack effect ( msg -- bool ). It is 
-  #! executed with the message on the stack. It should return a 
-  #! boolean if it is a message this form should process.
-  #! 'match-quot' is a quotation with stack effect ( msg -- ). It
-  #! will be called with the message on the top of the stack if
-  #! the 'pred' word returned true.
-  [ first execute ] 2keep rot [ second call ] [ 2drop ] if ;
-
-: recv ( forms -- ) 
-  #! Get a message from the processes mailbox. Compare it against the
-  #! forms to run a quotation if it matches the given message. 'forms'
-  #! is a list of quotations in the following format:
-  #!   [ pred match-quot ] 
-  #! 'pred' is a word that has stack effect ( msg -- bool ). It is 
-  #! executed with the message on the stack. It should return a 
-  #! boolean if it is a message this form should process.
-  #! 'match-quot' is a quotation with stack effect ( msg -- ). It
-  #! will be called with the message on the top of the stack if
-  #! the 'pred' word returned true.
-  #! Each form in the list will be matched against the message, 
-  #! even if a prior match succeeded. This means multiple quotations
-  #! may be run against the message.
-  receive swap [ dupd (recv) ] each drop ;
-
-MATCH-VARS: ?from ?tag ;
-
-: tag-message ( message -- tagged-message )
-  #! Given a message, wrap it with the sending process and a unique tag.
-  >r self random-64 r> 3array ;
-
-: send-synchronous ( message process -- reply )
-  #! Sends a message to the process synchronously. The
-  #! message will be wrapped to include the process of the sender 
-  #! and a unique tag. After being sent the sending process will
-  #! block for a reply tagged with the same unique tag.
-  >r tag-message dup r> send second _ 2array [ match ] curry receive-if second ;
-
-: forever ( quot -- )
-  #! Loops forever executing the quotation.
-  dup >r call r> forever ; 
-
-SYMBOL: quit-cc
-
-: (spawn-server) ( quot -- )
-  #! Receive a message, and run 'quot' on it. If 'quot' 
-  #! returns true, start again, otherwise exit loop.
-  #! The quotation should have stack effect ( message -- bool ).
-  "Waiting for message in server: " write self process-pid print
-  receive over call [ (spawn-server) ] when ;
-
-: spawn-server ( quot -- process )
-  #! Spawn a server that receives messages, calling the
-  #! quotation on the message. If the quotation returns false
-  #! the spawned process exits. If it returns true, the process
-  #! starts from the beginning again. The quotation should have
-  #! stack effect ( message -- bool ).
-  [  
-    (spawn-server)
-    "Exiting process: " write self process-pid print
-  ] curry spawn ;
-
-: spawn-linked-server ( quot -- process )
-  #! Similar to 'spawn-server' but the parent process will be linked
-  #! to the child.
-  [  
-    (spawn-server)
-    "Exiting process: " write self process-pid print
-  ] curry spawn-link ;
-
-: server-cc ( -- cc | process )
-  #! Captures the current continuation and returns the value.
-  #! If that CC is called with a process on the stack it will
-  #! set 'self' for the current process to it. Otherwise it will
-  #! return the value. This allows capturing a continuation in a server,
-  #! and jumping back into it from a spawn and keeping the 'self'
-  #! variable correct. It's a workaround until I can find out how to
-  #! stop 'self' from being clobbered back to its old value.
-  [ ] callcc1 dup process? [ \ self set-global f ] when ;
-  
-: call-server-cc ( server-cc -- )
-  #! Calls the server continuation passing the current 'self'
-  #! so the server continuation gets its new self updated.
-  self swap call ;
-
-: future ( quot -- future )
-  #! Spawn a process to call the quotation and immediately return
-  #! a 'future' on the stack. The future can later be queried with
-  #! ?future. If the quotation has completed the result will be returned.
-  #! If not, the process will block until the quotation completes.
-  #! 'quot' must have stack effect ( -- X ).
-  [ self send ] append spawn ;
-
-: ?future ( future -- result )
-  #! Block the process until the future has completed and then place the
-  #! result on the stack. Return the result immediately if the future has completed.
-  process-mailbox mailbox-get ;
-
-TUPLE: promise fulfilled? value processes ;
-
-C: promise ( -- <promise> )
-  [ 0 <vector> swap set-promise-processes ] keep ;
-
-: fulfill ( value promise  -- )
-  #! Set the future of the promise to the given value. Threads
-  #! blocking on the promise will then be released.
-  dup promise-fulfilled? [
-    [ set-promise-value ] keep
-    [ t swap set-promise-fulfilled? ] keep    
-    [ promise-processes ] keep 0 <vector> swap set-promise-processes
-    [ schedule-thread ] each yield 
-  ] unless ;
-
- : (maybe-block-promise) ( promise -- promise )  
-  #! Block the process if the promise is unfulfilled. This is different from
-  #! (mailbox-block-if-empty) in that when a promise is fulfilled, all threads
-  #! need to be resumed, rather than just one.
-  dup promise-fulfilled? [
-    [
-      swap promise-processes push stop      
-    ] callcc0 
-  ] unless ;
-
-: ?promise ( promise -- result ) 
-  (maybe-block-promise) promise-value ;
-  
-! ******************************
-! Experimental code below
-! ******************************
-: (lazy) ( v -- )
-  receive {
-    { { ?from ?tag _ } [ ?tag over 2array ?from send (lazy) ] }
-  } match-cond ;
-
-: lazy ( quot -- lazy )
-  #! Spawn a process that immediately blocks and return it. 
-  #! When '?lazy' is called on the returned process, call the quotation
-  #! and return the result. The quotation must have stack effect ( -- X ).
-  [ 
-    receive {
-      { { ?from ?tag _ } [ call ?tag over 2array ?from send (lazy) ] }
-    } match-cond 
-  ] spawn nip ;
-
-: ?lazy ( lazy -- result )
-  #! Given a process spawned using 'lazy', evaluate it and return the result.
-  f swap send-synchronous ;
-
-! ******************************
-! Standard Processes
-! ******************************
-MATCH-VARS: ?process ?name ;
-SYMBOL: register
-SYMBOL: unregister
-
-: process-registry ( table -- )
-  receive {
-    { { register ?name ?process }  [ ?process ?name pick set-hash ] }
-    { { unregister ?name }         [ ?name over remove-hash ] }
-    { { ?from ?tag { process ?name } } [ ?tag ?name pick hash 2array ?from send  ] }
-  } match-cond process-registry ;
-
-: register-process ( name process -- )
-  [ register , swap , , ] { } make \ process-registry get send ;
-
-: unregister-process ( name -- )
-  [ unregister , , ] { } make \ process-registry get send ;
-
-: get-process ( name -- )
-  [ process , , ] { } make \ process-registry get send-synchronous ;
-
-[ H{ } clone process-registry ] (spawn) \ process-registry set-global
-
-: handle-node-client ( stream -- )
-  [ [ deserialize ] with-serialized ] with-stream first2 get-process send ;
-
-: (node-server) ( server -- )
-  dup accept handle-node-client (node-server) ;
-
-: node-server ( port -- )
-  <server> (node-server) ;
-
-: send-to-node ( msg pid  host port -- )
-  <client> [ 2array [ serialize ] with-serialized ] with-stream ;
-
-: start-node ( hostname port -- )
-  [ node-server ] in-thread
-  <node> \ localnode set-global ;
-
-M: remote-process send ( message process -- )
-  #! Send the message via the inter-node protocol
-  [ remote-process-pid ] keep 
-  remote-process-node 
-  [ node-hostname ] keep
-  node-port send-to-node ;
-
-M: process serialize ( obj -- )
-  localnode swap process-pid <remote-process> serialize ;
-
-: (test-node1) 
-  receive {
-    { { ?from ?tag _ } [ ?tag "ack" 2array ?from send (test-node1) ] }
-  } match-cond ;
-
-: test-node1 ( -- )
-  [ (test-node1) ] spawn
-  "test1" swap register-process ;
-
-: test-node2 ( hostname port -- )
-  [ <node> "test1" <remote-process> "message" swap send-synchronous . ] spawn 2drop ;
\ No newline at end of file
diff --git a/libs/concurrency/concurrency.facts b/libs/concurrency/concurrency.facts
deleted file mode 100644 (file)
index 2b3def5..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: help concurrency match ;
-
-HELP: make-mailbox
-{ $values { "mailbox" "a mailbox object" } 
-}
-{ $description "A mailbox is an object that can be used for safe thread communication. Items can be put in the mailbox and retrieved in a FIFO order. If the mailbox is empty when a get operation is performed then the thread will block until another thread places something in the mailbox. If multiple threads are waiting on the same mailbox, only one of the waiting threads will be unblocked to process the get operation." } 
-{ $see-also mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
-
-HELP: mailbox-empty?
-{ $values { "mailbox" "a mailbox object" } 
-          { "bool" "a boolean value" }
-}
-{ $description "Return true if the mailbox is empty." } 
-{ $see-also make-mailbox mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
-
-HELP: mailbox-put
-{ $values { "obj" "an object" } 
-          { "mailbox" "a mailbox object" } 
-}
-{ $description "Put the object into the mailbox. Any threads that have a blocking get on the mailbox are resumed. Only one of those threads will successfully get the object, the rest will immediately block waiting for the next item in the mailbox." } 
-{ $see-also make-mailbox mailbox-empty? mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
-
-HELP: (mailbox-block-unless-pred)
-{ $values { "pred" "a quotation with stack effect " { $snippet "( X -- bool )" } } 
-          { "mailbox" "a mailbox object" } 
-         { "pred2" "same object as 'pred'" }
-         { "mailbox2" "same object as 'mailbox'" }
-}
-{ $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. The predicate must have stack effect " { $snippet "( X -- bool )" } "." } 
-{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
-
-HELP: (mailbox-block-if-empty)
-{ $values { "mailbox" "a mailbox object" } 
-         { "mailbox2" "same object as 'mailbox'" }
-}
-{ $description "Block the thread if the mailbox is empty." } 
-{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty mailbox-get? } ;
-
-HELP: mailbox-get
-{ $values { "mailbox" "a mailbox object" } 
-         { "object" "an object" }
-}
-{ $description "Get the first item put into the mailbox. If it is empty the thread blocks until an item is put into it. The thread then resumes, leaving the item on the stack." } 
-{ $see-also make-mailbox mailbox-empty? mailbox-put while-mailbox-empty mailbox-get-all mailbox-get? } ;
-
-HELP: mailbox-get-all
-{ $values { "mailbox" "a mailbox object" } 
-         { "array" "an array" }
-}
-{ $description "Blocks the thread if the mailbox is empty, otherwise removes all objects in the mailbox and returns an array containing the objects." } 
-{ $see-also make-mailbox mailbox-empty? mailbox-put while-mailbox-empty mailbox-get-all mailbox-get? } ;
-
-HELP: while-mailbox-empty
-{ $values { "mailbox" "a mailbox object" } 
-         { "quot" "a quotation with stack effect " { $snippet "( -- )" } }
-}
-{ $description "Repeatedly call the quotation while there are no items in the mailbox. Quotation should have stack effect " { $snippet "( -- )" } "." } 
-{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all mailbox-get? } ;
-
-HELP: mailbox-get?
-{ $values { "pred" "a quotation with stack effect " { $snippet "( X -- bool )" } }
-          { "mailbox" "a mailbox object" } 
-         { "obj" "an object" }
-}
-{ $description "Get the first item in the mailbox which satisfies the predicate. 'pred' will be called repeatedly for each item in the mailbox. When 'pred' returns true that item will be returned. If nothing in the mailbox satisfies the predicate then the thread will block until something does. 'pred' must have stack effect " { $snippet "( X -- bool }" } "." } 
-{ $see-also make-mailbox mailbox-empty? mailbox-put mailbox-get mailbox-get-all while-mailbox-empty } ;
-
-HELP: <node> 
-{ $values { "hostname" "the hostname of the node as a string" } 
-          { "port" "the integer port number of the node" } 
-          { "node" "the constructed node object" } 
-}
-{ $description "Processes run on nodes. Each node has a hostname and a port." } 
-{ $see-also localnode } ;
-
-HELP: localnode
-{ $values { "node" "a node object" } 
-}
-{ $description "Return the node the process is currently running on." } 
-{ $see-also <node> } ;
-
-HELP: <process>
-{ $values { "links" "an array of processes" } 
-          { "pid" "the process id" } 
-          { "mailbox" "a mailbox object" } 
-}
-{ $description "Constructs a process object. A process is a lightweight thread with a mailbox that can be used to communicate with other processes. Each process has a unique process id." } 
-{ $see-also <remote-process> spawn send receive } ;
-
-HELP: <remote-process>
-{ $values { "node" "a node object" } 
-          { "pid" "a process id" } 
-          { "remote-process" "the constructed remote-process object" } 
-}
-{ $description "Constructs a proxy to a process running on another node. It can be used to send messages to the process it is acting as a proxy for." } 
-{ $see-also <node> <process> spawn send } ;
-
-HELP: self
-{ $values { "process" "a process object" } 
-}
-{ $description "Returns the currently running process object." } 
-{ $see-also <process> <remote-process> send receive receive-if } ;
-
-HELP: send
-{ $values { "message" "an object" } 
-          { "process" "a process object" } 
-}
-{ $description "Send the message to the process by placing it in the processes mailbox. This is an asynchronous operation and will return immediately. The receving process will act on the message the next time it retrieves that item from its mailbox (usually using the " { $link receive } " word. The message can be any Factor object. For destinations that are instances of remote-process the message must be a serializable Factor type." } 
-{ $see-also <process> <remote-process> receive receive-if } ;
-
-HELP: receive
-{ $values { "message" "an object" } 
-}
-{ $description "Return a message from the current processes mailbox. If the box is empty, suspend the process until another process places an item in the mailbox (usually via the " { $link send } " word." } 
-{ $see-also send receive-if } ;
-
-HELP: receive-if
-{ $values { "pred" "a predicate with stack effect " { $snippet "( X -- bool )" } }  
-          { "message" "an object" } 
-}
-{ $description "Return the first message from the current processes mailbox that satisfies the predicate. To satisfy the predicate, 'pred' is called  with the item on the stack and the predicate should leave a boolean indicating whether it was satisfied or not. The predicate must have stack effect " { $snippet "( X -- bool )" } ". If nothing in the mailbox satisfies the predicate then the process will block until something does." } 
-{ $see-also send receive } ;
-
-HELP: spawn
-{ $values { "quot" "a predicate with stack effect " { $snippet "( -- )" } }  
-          { "process" "a process object" } 
-}
-{ $description "Start a process which runs the given quotation." } 
-{ $see-also send receive receive-if self spawn-link } ;
-
-HELP: spawn-link
-{ $values { "quot" "a predicate with stack effect " { $snippet "( -- )" } }  
-          { "process" "a process object" } 
-}
-{ $description "Start a process which runs the given quotation. If that quotation throws an error which is not caught then the error will get propagated to the process that spawned it. This can be used to set up 'supervisor' processes that restart child processes that crash due to uncaught errors.\n" } 
-{ $see-also spawn } ;
-
-ARTICLE: { "concurrency" "loading" } "Loading"
-"The Factor module system can be used to load the Concurrency library:" 
-{ $code "\"libs/concurrency\" require\nUSE: concurrency" } ;
-
-ARTICLE: { "concurrency" "processes" } "Processes"
-"A process is basically a thread with a message queue. Other processes can place items on this queue by sending the process a message. A process can check its queue for messages, blocking if none are pending, and process them as they are queued.\n\nFactor processes are very lightweight. Each process can take as little as 900 bytes of memory. This library has been tested running hundreds of thousands of simple processes.\n\nThe messages that are sent from process to process are any Factor value. Factor tuples are ideal for this sort of thing as you can send a tuple to a process and the predicate dispatch mechanism can be used to perform actions depending on what the type of the tuple is.\n\nProcesses are usually created using " { $link spawn } ". This word takes a quotation on the stack and starts a process that will execute that quotation asynchronously. When the quotation completes the process will die. 'spawn'  leaves on the stack the process object that was started. This object can be used to send messages to the process using " { $link send }  ".\n\n'send' will return immediately after placing the message in the target processes message queue.\n\nA process can get a message from its queue using " { $link receive } ". This will get the most recent message and leave it on the stack. If there are no messages in the queue the process will 'block' until a message is available. When a process is blocked it takes no CPU time at all." 
-{ $code "[ receive print ] spawn\n\"Hello Process!\" swap send" } 
-"This example spawns a process that first blocks, waiting to receive a message. When a message is received, the 'receive' call returns leaving it on the stack. It then prints the message and exits. 'spawn' left the process on the stack so it's available to send the 'Hello Process!' message to it. Immediately after the 'send' you should see 'Hello Process!' printed on the console.\n\nIt is also possible to selectively retrieve messages from the message queue. " { $link receive-if } " takes a predicate quotation on the stack and returns the first message in the queue that satisfies the predicate. If no items satisfy the predicate then the process is blocked until a message is received that does." 
-{ $code ": odd? ( n -- ? ) 2 mod 1 = ;\n1 self send 2 self send 3 self send\n\nreceive .\n => 1\n\n[ odd? ] receive-if .\n => 3\n\nreceive .\n => 2" } ;
-
-ARTICLE: { "concurrency" "self" } "Self"
-"A process can get access to its own process object using " { $link self } " so it can pass it to other processes. This allows the other processes to send messages back. A simple example of using this gets the current processes 'self' and spawns a process which sends a message to it. We then receive the message from the original process:" 
-{ $code "self [ \"Hello!\" swap send ] spawn 2drop receive .\n => \"Hello!\"" } ;
-
-ARTICLE: { "concurrency" "servers" } "Servers"
-"A common idiom is to create 'server' processes that act on messages that are sent to it. These follow a basic pattern of blocking until a message is received, processing that message then looping back to blocking for a message.\n\nThe following example shows a very simple server that expects an array as its message. The first item of the array should be the senders process object. If the second item is 'ping' then the server sends 'pong' back to the caller. If the second item is anything else then the server exits:" 
-{ $code ": pong-server ( -- )\n  receive {\n    { { ?from \"ping\" } [ \"pong\" ?from send pong-server ] }\n    { { ?from _ } [ \"server shutdown\" ?from send ] }\n  } match-cond ;\n\n[ pong-server ] spawn" } 
-"Handling the deconstructing of messages and dispatching based on the message can be a bit of a chore. Especially in servers that take a number of different messages. The approach taken above is to use the 'match' library which allows easy deconstructing of messages using " { $link match-cond } "." ;
-
-ARTICLE: { "concurrency" "synchronous-sends" } "Synchronous Sends"
-{ $link send } " sends a message asynchronously, and the sending process continues immediately. The 'pong server' example shown previously all sent messages to the server and waited for a reply back from the server. This pattern of synchronous sending is made easier with " { $link send-synchronous } ".\n\nThis word will send a message to the given process and immediately block until a reply is received for this particular message send. It leaves the reply on the stack. Note that it doesn't wait for just any reply, it waits for a reply specifically to this send.\n\nTo do this it wraps the requested message inside a tagged message format using " { $link tag-message } ":"
-{ $code "\"My Message\" tag-message .\n => { ...from... ...tag... \"My Message\" }" }
-"The message is wrapped in array where the first item is the sending process object, the second is a unique tag, and the third is the original message. Server processes can use the 'from' to reply to the process that originally sent the message. The tag can is used in the receiving server to include the value in the reply. After the send-synchronous call the current process will block waiting for a reply that has the exact same tag. In this way you can be sure that the reply you got was for the specific message sent. Here is the pong-server recoded to use 'send-synchronous':"
-{ $code ": pong-server ( -- )\n  receive {\n    { { ?from ?tag \"ping\" } [ ?tag \"pong\" 2array ?from send pong-server ] }\n    { { ?from _ } [ ?tag \"server shutdown\" 2array ?from send ] }\n  } match-cond ;\n\n[ pong-server ] spawn \"ping\" swap send-synchronous .\n => \"pong\"" } 
-"Notice that the code to send the reply back to the original caller wraps the reply in an array where the first item is the tag originally sent. 'send-synchronous' only returns if it receives a reply containing that specific tag." ;
-
-ARTICLE: { "concurrency" "exceptions" } "Exceptions"
-"A process can handle exceptions using the standard Factor exception handling mechanism. If an exception is uncaught the process will terminate. For example:" 
-{ $code "[ 1 0 / \"This will not print\" print ] spawn" } 
-"Processes can be linked so that a parent process can receive the exception that caused the child process to terminate. In this way 'supervisor' processes can be created that are notified when child processes terminate and possibly restart them.\n\nThe easiest way to form this link is using " { $link spawn-link } ". This will create a unidirectional link, such that if an uncaught exception causes the child to terminate, the parent process can catch it:"
-{ $code "[\n  [ 1 0 / \"This will not print\" print ] spawn-link drop\n  receive\n] catch [ \"Exception caught.\" print ] when" } 
-"Exceptions are only raised in the parent when the parent does a " { $link receive } " or " { $link receive-if } ". This is because the exception is sent from the child to the parent as a message." ;
-
-ARTICLE: { "concurrency" "futures" } "Futures"
-"A future is a placeholder for the result of a computation that is being calculated in a process. When the process has completed the computation the future can be queried to find out the result. If the computation has not completed when the future is queried them the process will block until the result is completed. <p>A future is created using " { $link future } ".\n\nThe quotation will be run in a spawned process, and a future object is immediately returned. This future object can be resolved using " { $link ?future } ".\n\nFutures are useful for starting calculations that take a long time to run but aren't needed until later in the process. When the process needs the value it can use '?future' to get the result or block until the result is available. For example:"
-{ $code "[ 30 fib ] future\n...do stuff...\n?future" } ;
-
-ARTICLE: { "concurrency" "promises" } "Promises"
-"A promise is similar to a future but it is not produced by calcuating something in the background. It represents a promise to provide a value sometime later. A process can request the value of a promise and will block if the promise is not fulfilled. Later, another process can fulfill the promise, providing a value. All threads waiting on the promise will then resume with that value on the stack. Use " { $link <promise> } " to create a promise, " { $link fulfill } " to set it to a value, and " { $link ?promise } " to retrieve the value, or block until the promise is fulfilled:"
-{ $code "<promise>\n[ ?promise \"Promise fulfilled: \" write print ] spawn drop\n[ ?promise \"Promise fulfilled: \" write print ] spawn drop\n[ ?promise \"Promise fulfilled: \" write print ] spawn drop\n\"hello\" swap fulfill\n => Promise fulfilled: hello\n    Promise fulfilled: hello\n    Promise fulfilled: hello" } ;
-
-ARTICLE: { "concurrency" "concurrency" } "Concurrency"
-"The concurrency library is based upon the style of concurrency used in systems like Erlang and Termite. It is built on top of the standard Factor lightweight thread system.\nA concurrency oriented program is one in which multiple processes run simultaneously in a single Factor image or across multiple running Factor instances. The processes can communicate with each other by asynchronous message sends. Although processes can share data via Factor's mutable data structures it is not recommended as the use of shared state concurrency is often a cause of problems."
-{ $subsection { "concurrency" "loading" } } 
-{ $subsection { "concurrency" "processes" } } 
-{ $subsection { "concurrency" "self" } } 
-{ $subsection { "concurrency" "servers" } } 
-{ $subsection { "concurrency" "synchronous-sends" } } 
-{ $subsection { "concurrency" "exceptions" } } 
-{ $subsection { "concurrency" "futures" } } 
-{ $subsection { "concurrency" "promises" } } ;
diff --git a/libs/concurrency/load.factor b/libs/concurrency/load.factor
deleted file mode 100644 (file)
index 8204ca9..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-! Copyright (C) 2005 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-REQUIRES: libs/dlists libs/serialize libs/match ;
-
-PROVIDE: libs/concurrency
-{ +files+ { 
-  "concurrency.factor" 
-  "concurrency.facts"
-} }
-{ +tests+ { 
-  "concurrency-tests.factor" 
-} }
-{ +help+ { "concurrency" "concurrency" } } ;
diff --git a/libs/coroutines/coroutines.factor b/libs/coroutines/coroutines.factor
deleted file mode 100644 (file)
index de2fbaa..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-! Copyright (C) 2005 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-IN: coroutines
-USING: kernel generic ;
-
-TUPLE: coroutine resumecc exitcc ;
-
-: cocreate ( quot -- co )
-  #! Create a new coroutine, which will execute the quotation
-  #! when resumed. The quotation will have the coroutine
-  #! on the stack and an initial value (received from coresume)
-  #! when first resumed. ie. The quotation should have stack
-  #! effect ( co value -- ).
-  f f <coroutine> dup rot curry over set-coroutine-resumecc ;
-
-: coresume ( v co -- result )
-  #! Resume a coroutine with 'v' as the first item on the
-  #! stack. The result placed on the stack is that of the 
-  #! topmost argument on the stack when coyield is called
-  #! within the coroutine.
-  [ 
-    over set-coroutine-exitcc
-    coroutine-resumecc call
-  ] callcc1 rot drop ;
-
-: coyield ( v co -- result )
-  #! Suspend a coroutine, leaving the value 'v' on the 
-  #! stack when control is passed to the 'coresume' caller.
-  [  
-    [ continue-with ] curry
-    over set-coroutine-resumecc  
-    coroutine-exitcc continue-with
-  ] callcc1 rot drop ;
diff --git a/libs/coroutines/load.factor b/libs/coroutines/load.factor
deleted file mode 100644 (file)
index c047679..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-PROVIDE: libs/coroutines
-{ +files+ { "coroutines.factor" } }
-{ +tests+ { "tests.factor" } } ;
diff --git a/libs/coroutines/tests.factor b/libs/coroutines/tests.factor
deleted file mode 100644 (file)
index 1608a1e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-IN: temporary
-USING: coroutines kernel sequences prettyprint ;
-
-: test1 ( list -- co )
-  [ swap [ over coyield 2drop ] each f swap coyield ] cocreate ; 
-  
-: test2 ( -- co )
-  [ 1 over coyield drop 2 over coyield drop 3 over coyield ] cocreate ;
-
-test2 f swap coresume . f swap coresume . f swap coresume . drop
-
-: test3 ( -- co )
-  [ [ 1 2 3 ] [ over coyield drop ] each ] cocreate ;
-
-test3 f swap coresume . f swap coresume . f swap coresume . drop
diff --git a/libs/crypto/barrett.factor b/libs/crypto/barrett.factor
deleted file mode 100644 (file)
index 356d828..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-USING: kernel math ;
-IN: crypto
-
-: barrett-mu ( n size -- mu )
-    #! Calculates Barrett's reduction parameter mu
-    #! size = word size in bits (8, 16, 32, 64, ...)
-    over log2 1+ over / 2 * >r 2 swap ^ r> ^ swap / floor ;
-
diff --git a/libs/crypto/blum-blum-shub.factor b/libs/crypto/blum-blum-shub.factor
deleted file mode 100644 (file)
index dca88de..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-USING: kernel math sequences namespaces crypto math-contrib ;
-IN: crypto-internals
-
-! TODO: take (log log M) bits instead of 1 bit
-! Blum Blum Shub, M = pq
-TUPLE: bbs x n ;
-
-: generate-bbs-primes ( numbits -- p q )
-    #! two primes congruent to 3 (mod 4)
-    dup [ random-miller-rabin-prime==3(mod4) ] 2apply ;
-
-IN: crypto
-: make-bbs ( numbits -- blum-blum-shub )
-    #! returns a Blum-Blum-Shub tuple
-    generate-bbs-primes * [ find-relative-prime ] keep <bbs> ;
-
-IN: crypto-internals
-SYMBOL: blum-blum-shub 256 make-bbs blum-blum-shub set-global
-
-: next-bbs-bit ( bbs -- bit )
-    #! x = x^2 mod n, return low bit of calculated x
-    [ [ bbs-x ] keep 2 swap bbs-n ^mod ] keep
-    [ set-bbs-x ] keep bbs-x 1 bitand ;
-
-SYMBOL: temp-bbs
-: (bbs-bits) ( numbits bbs -- n )
-    temp-bbs set [ [ temp-bbs get next-bbs-bit ] swap make-bits ] with-scope ;
-
-IN: crypto
-: random-bbs-bits* ( numbits bbs -- n ) (bbs-bits) ;
-: random-bits ( numbits -- n ) blum-blum-shub get (bbs-bits) ;
-: random-bytes ( numbits -- n ) 8 * random-bits ;
-: random-int ( n -- n )
-    ! #! Cryptographically secure random number using Blum-Blum-Shub 256
-    [ log2 1+ random-bits ] keep dupd >= [ -1 shift ] when ;
-
diff --git a/libs/crypto/common.factor b/libs/crypto/common.factor
deleted file mode 100644 (file)
index 0c214c4..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-IN: crypto-internals
-USING: kernel io strings sequences namespaces math parser ;
-
-IN: crypto
-: >32-bit ( n -- n ) HEX: ffffffff bitand ; inline
-: >64-bit ( n -- n ) HEX: ffffffffffffffff bitand ; inline
-
-IN: crypto-internals
-: w+ ( int int -- int ) + >32-bit ; inline
-: nth-int ( string n -- int ) 2 shift dup 4 + rot <slice> le> ; inline
-: nth-int-be ( string n -- int ) 2 shift dup 4 + rot <slice> be> ; inline
-: update ( num var -- ) [ w+ ] change ; inline
-
-: update-old-new ( old new -- )
-    [ get >r get r> ] 2keep >r >r w+ dup r> set r> set ; inline
-    
-: calculate-pad-length ( length -- pad-length )
-    dup 56 < 55 119 ? swap - ;
-
-: preprocess-plaintext ( string big-endian? -- padded-string )
-    #! pad 0x80 then 00 til 8 bytes left, then 64bit length in bits
-    >r >sbuf r> over [
-        HEX: 80 ,
-        dup length HEX: 3f bitand calculate-pad-length 0 <string> %
-        length 3 shift 8 rot [ >be ] [ >le ] if %
-    ] "" make dupd nappend ;
-
-SYMBOL: bytes-read
-SYMBOL: big-endian?
-
-: pad-last-block ( str big-endian? length -- str )
-    [
-        rot %
-        HEX: 80 ,
-        dup HEX: 3f bitand calculate-pad-length 0 <string> %
-        3 shift 8 rot [ >be ] [ >le ] if %
-    ] "" make 64 group ;
-
-: shift-mod ( n s w -- n ) >r shift r> 1 swap shift 1 - bitand ; inline
-
-
-IN: crypto
-
-: bitroll ( n s w -- n' )
-     #! Roll n by s bits to the left, wrapping around after
-     #! w bits.
-     [ 1 - bitand ] keep
-     over 0 < [ [ + ] keep ] when
-     [ shift-mod ] 3keep
-     [ - ] keep shift-mod bitor ; inline
-
-: bitroll-32 ( n s -- n' ) 32 bitroll ;
-: bitroll-64 ( n s -- n' ) 64 bitroll ;
-: hex-string ( str -- str ) [ [ >hex 2 48 pad-left % ] each ] "" make ;
-: slice3 ( n seq -- a b c ) >r dup 3 + r> <slice> first3 ;
-
-: 4dup ( a b c d -- a b c d a b c d )
-    >r >r 2dup r> r> 2swap >r >r 2dup r> r> 2swap ;
-
-: 4keep ( w x y z quot -- w x y z )
-    >r 4dup r> swap >r swap >r swap >r swap >r call r> r> r> r> ; inline
diff --git a/libs/crypto/crc32.factor b/libs/crypto/crc32.factor
deleted file mode 100644 (file)
index 6623880..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-USING: kernel math sequences namespaces ;
-
-IN: crypto-internals
-: crc32-polynomial HEX: edb88320 ; inline
-
-: crc32-init ( -- table )
-    256 [
-        8 [
-            dup 1 bitand zero? >r -1 shift r> [ crc32-polynomial bitxor ] unless
-        ] times
-    ] map ;
-
-SYMBOL: crc32-table
-crc32-init crc32-table set-global
-
-: calc-crc32 ( ch crc -- crc )
-    dupd bitxor HEX: ff bitand crc32-table get nth swap -8 shift bitxor ;
-
-IN: crypto
-: >crc32 ( seq -- n )
-   >r HEX: ffffffff dup r> [ calc-crc32 ] each bitxor ;
-
diff --git a/libs/crypto/load.factor b/libs/crypto/load.factor
deleted file mode 100644 (file)
index c0c829b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-REQUIRES: libs/math ;
-
-PROVIDE: libs/crypto
-{ +files+ {
-
-    "common.factor"
-    "timing.factor"
-    "barrett.factor"
-    "montgomery.factor"
-    "random.factor"
-    "miller-rabin.factor"
-
-! Rngs
-    "blum-blum-shub.factor"
-
-! Hash
-    "crc32.factor"
-    "md5.factor"
-    "sha1.factor"
-    "sha2.factor"
-
-! Block ciphers
-    "rc4.factor"
-
-! Public key
-    "rsa.factor"
-
-} }
-{ +tests+ {
-    "test/common.factor"
-    "test/md5.factor"
-    "test/sha1.factor"
-    "test/sha2.factor"
-    "test/miller-rabin.factor"
-    "test/crc32.factor"
-    "test/rsa.factor"
-    "test/barrett.factor"
-    "test/montgomery.factor"
-    "test/blum-blum-shub.factor"
-} } ;
diff --git a/libs/crypto/md5.factor b/libs/crypto/md5.factor
deleted file mode 100644 (file)
index f439661..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-USING: kernel io strings sequences namespaces math parser crypto ;
-IN: crypto-internals
-
-SYMBOL: a
-SYMBOL: b
-SYMBOL: c
-SYMBOL: d
-SYMBOL: old-a
-SYMBOL: old-b
-SYMBOL: old-c
-SYMBOL: old-d
-
-: calculate-sin ( int -- int )
-    sin abs 4294967296 * >bignum ; inline
-
-SYMBOL: md5-sin-table
-65 [ calculate-sin ] map md5-sin-table set-global
-
-: initialize-md5 ( -- )
-    0 bytes-read set
-    HEX: 67452301 dup a set old-a set
-    HEX: efcdab89 dup b set old-b set
-    HEX: 98badcfe dup c set old-c set
-    HEX: 10325476 dup d set old-d set ;
-
-: update-md ( -- )
-    old-a a update-old-new
-    old-b b update-old-new
-    old-c c update-old-new
-    old-d d update-old-new ;
-
-! Let [abcd k s i] denote the operation
-! a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s)
-
-: 1to4 dup second get over third get pick fourth get ;
-
-: (F) ( vars func -- vars result ) >r 1to4 r> call ; inline
-
-: (ABCD) ( s i x vars result -- )
-    #! bits to shift, input to float-sin, x, func
-    swap >r w+ swap md5-sin-table get nth w+ r> dup first >r swap r> update
-    dup first get rot bitroll-32 over second get w+ swap first set ;
-
-: ABCD { a b c d } swap (F) (ABCD) ; inline
-: BCDA { b c d a } swap (F) (ABCD) ; inline
-: CDAB { c d a b } swap (F) (ABCD) ; inline
-: DABC { d a b c } swap (F) (ABCD) ; inline
-
-! F(X,Y,Z) = XY v not(X) Z
-: F ( X Y Z -- FXYZ )
-    pick bitnot bitand >r bitand r> bitor ;
-
-! G(X,Y,Z) = XZ v Y not(Z)
-: G ( X Y Z -- GXYZ )
-    dup bitnot rot bitand >r bitand r> bitor ;
-    
-! H(X,Y,Z) = X xor Y xor Z
-: H ( X Y Z -- HXYZ )
-    bitxor bitxor ;
-    
-! I(X,Y,Z) = Y xor (X v not(Z))
-: I ( X Y Z -- IXYZ )
-    rot swap bitnot bitor bitxor ;
-: S11 7  ; inline
-: S12 12 ; inline
-: S13 17 ; inline
-: S14 22 ; inline
-: S21 5  ; inline
-: S22 9  ; inline
-: S23 14 ; inline
-: S24 20 ; inline
-: S31 4 ;  inline
-: S32 11 ; inline
-: S33 16 ; inline
-: S34 23 ; inline
-: S41 6  ; inline
-: S42 10 ; inline
-: S43 15 ; inline
-: S44 21 ; inline
-
-: process-md5-block ( block -- )
-    S11 1 pick 0 nth-int   [ F ] ABCD
-    S12 2 pick 1 nth-int   [ F ] DABC
-    S13 3 pick 2 nth-int   [ F ] CDAB
-    S14 4 pick 3 nth-int   [ F ] BCDA
-    S11 5 pick 4 nth-int   [ F ] ABCD
-    S12 6 pick 5 nth-int   [ F ] DABC
-    S13 7 pick 6 nth-int   [ F ] CDAB
-    S14 8 pick 7 nth-int   [ F ] BCDA
-    S11 9 pick 8 nth-int   [ F ] ABCD
-    S12 10 pick 9 nth-int  [ F ] DABC
-    S13 11 pick 10 nth-int [ F ] CDAB
-    S14 12 pick 11 nth-int [ F ] BCDA
-    S11 13 pick 12 nth-int [ F ] ABCD
-    S12 14 pick 13 nth-int [ F ] DABC
-    S13 15 pick 14 nth-int [ F ] CDAB
-    S14 16 pick 15 nth-int [ F ] BCDA
-
-    S21 17 pick 1 nth-int  [ G ] ABCD
-    S22 18 pick 6 nth-int  [ G ] DABC
-    S23 19 pick 11 nth-int [ G ] CDAB
-    S24 20 pick 0 nth-int  [ G ] BCDA
-    S21 21 pick 5 nth-int  [ G ] ABCD
-    S22 22 pick 10 nth-int [ G ] DABC
-    S23 23 pick 15 nth-int [ G ] CDAB
-    S24 24 pick 4 nth-int  [ G ] BCDA
-    S21 25 pick 9 nth-int  [ G ] ABCD
-    S22 26 pick 14 nth-int [ G ] DABC
-    S23 27 pick 3 nth-int  [ G ] CDAB
-    S24 28 pick 8 nth-int  [ G ] BCDA
-    S21 29 pick 13 nth-int [ G ] ABCD
-    S22 30 pick 2 nth-int  [ G ] DABC
-    S23 31 pick 7 nth-int  [ G ] CDAB
-    S24 32 pick 12 nth-int [ G ] BCDA
-
-    S31 33 pick 5 nth-int  [ H ] ABCD
-    S32 34 pick 8 nth-int  [ H ] DABC
-    S33 35 pick 11 nth-int [ H ] CDAB
-    S34 36 pick 14 nth-int [ H ] BCDA
-    S31 37 pick 1 nth-int  [ H ] ABCD
-    S32 38 pick 4 nth-int  [ H ] DABC
-    S33 39 pick 7 nth-int  [ H ] CDAB
-    S34 40 pick 10 nth-int [ H ] BCDA
-    S31 41 pick 13 nth-int [ H ] ABCD
-    S32 42 pick 0 nth-int  [ H ] DABC
-    S33 43 pick 3 nth-int  [ H ] CDAB
-    S34 44 pick 6 nth-int  [ H ] BCDA
-    S31 45 pick 9 nth-int  [ H ] ABCD
-    S32 46 pick 12 nth-int [ H ] DABC
-    S33 47 pick 15 nth-int [ H ] CDAB
-    S34 48 pick 2 nth-int  [ H ] BCDA
-
-    S41 49 pick 0 nth-int  [ I ] ABCD
-    S42 50 pick 7 nth-int  [ I ] DABC
-    S43 51 pick 14 nth-int [ I ] CDAB
-    S44 52 pick 5 nth-int  [ I ] BCDA
-    S41 53 pick 12 nth-int [ I ] ABCD
-    S42 54 pick 3 nth-int  [ I ] DABC
-    S43 55 pick 10 nth-int [ I ] CDAB
-    S44 56 pick 1 nth-int  [ I ] BCDA
-    S41 57 pick 8 nth-int  [ I ] ABCD
-    S42 58 pick 15 nth-int [ I ] DABC
-    S43 59 pick 6 nth-int  [ I ] CDAB
-    S44 60 pick 13 nth-int [ I ] BCDA
-    S41 61 pick 4 nth-int  [ I ] ABCD
-    S42 62 pick 11 nth-int [ I ] DABC
-    S43 63 pick 2 nth-int  [ I ] CDAB
-    S44 64 rot 9 nth-int  [ I ] BCDA
-    update-md ;
-
-: get-md5 ( -- str )
-    [ [ a b c d ] [ get 4 >le % ] each ] "" make ;
-
-: (stream>md5) ( -- )
-    64 read dup length dup bytes-read [ + ] change 64 = [
-        process-md5-block (stream>md5)
-    ] [
-        f bytes-read get pad-last-block [ process-md5-block ] each
-    ] if ;
-
-IN: crypto
-
-: stream>md5 ( stream -- md5 )
-    [ [ initialize-md5 (stream>md5) get-md5 ] with-stream ] with-scope ;
-
-: string>md5 ( string -- md5 ) <string-reader> stream>md5 ;
-: string>md5str ( string -- str ) string>md5 hex-string ;
-: file>md5 ( file -- md5 ) <file-reader> stream>md5 ;
-
diff --git a/libs/crypto/miller-rabin.factor b/libs/crypto/miller-rabin.factor
deleted file mode 100644 (file)
index f1c451b..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-USING: kernel math errors namespaces math-contrib sequences io ;
-IN: crypto-internals
-
-SYMBOL: a
-SYMBOL: n
-SYMBOL: r
-SYMBOL: s
-SYMBOL: composite
-SYMBOL: count
-SYMBOL: trials
-
-: rand[1..n-1] ( m -- n ) 1- random-int 1+ ;
-
-: (factor-2s) ( s n -- s n )
-    dup 2 mod 0 = [ -1 shift >r 1+ r> (factor-2s) ] when ;
-
-: factor-2s ( n -- r s )
-    #! factor an even number into 2 ^ s * m
-    dup dup even? >r 0 > r> and [
-        "input must be positive and even" throw
-    ] unless 0 swap (factor-2s) ;
-
-: init-miller-rabin ( n trials -- ) 0 composite set trials set n set ;
-
-: (miller-rabin) ( -- bool )
-    n get dup 1 = [ drop f ]
-    [
-        even? [
-            f ] [
-            n get 1- factor-2s s set r set
-            trials get [
-                n get rand[1..n-1] a set
-                a get s get n get ^mod 1 = [
-                    0 count set
-                    r get [
-                        2 over ^ s get * a get swap n get ^mod n get - -1 = [
-                            count [ 1+ ] change
-                            r get +
-                        ] when
-                    ] repeat
-                    count get zero? [
-                        composite on
-                        trials get +
-                    ] when
-                ] unless
-            ] repeat
-            composite get 0 = [ t ] [ composite get not ] if
-        ] if
-    ] if ;
-
-IN: crypto
-
-: miller-rabin* ( n num-trials -- bool )
-    #! Probailistic primality test for n > 2, with num-trials as a parameter
-    over 2 > [ "miller-rabin error: must call with n > 2" throw ] unless
-    [ init-miller-rabin (miller-rabin) ] with-scope ;
-
-: miller-rabin ( n -- bool )
-    #! Probabilistic primality test for n > 2, 100 trials
-    [ 100 miller-rabin* ] with-scope ;
-
-: next-miller-rabin-prime ( n -- p )
-    #! finds the next prime probabilistically
-    dup even? [ 1+ ] [ 2 + ] if
-    dup miller-rabin [ next-miller-rabin-prime ] unless ;
-
-! random miller rabin prime from a number, or a number of bits
-! expand
-: random-miller-rabin-prime ( numbits -- p )
-    #! n = bits
-    large-random-bits next-miller-rabin-prime ;
-
-: random-miller-rabin-prime==3(mod4) ( numbits -- p )
-    dup random-miller-rabin-prime dup 4 mod 3 = [
-        drop random-miller-rabin-prime==3(mod4)
-    ] [
-        nip
-    ] if ;
-
-: (find-relative-prime) ( m g -- p )
-    2dup gcd nip 1 > [ 2 + (find-relative-prime) ] [ nip ] if ;
-
-: find-relative-prime* ( m g -- p )
-    #! find a prime relative to m with initial guess g
-    dup even? [ 1+ ] when (find-relative-prime) ;
-
-: find-relative-prime ( m -- p )
-    dup random-int dup even? [ 1+ ] when (find-relative-prime) ;
-
-: generate-two-unique-primes ( n -- p q )
-    #! generate two primes
-    dup 5 < [ "not enough primes below 5 bits" throw ] when
-    dup [ random-miller-rabin-prime ] keep random-miller-rabin-prime 2dup =
-    [ 2drop generate-two-unique-primes ] [ rot drop ] if ;
diff --git a/libs/crypto/montgomery.factor b/libs/crypto/montgomery.factor
deleted file mode 100644 (file)
index 1151c0e..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-USING: kernel math errors math-contrib ;
-IN: crypto
-
-! As per http://www.cyphercalc.com/index.htm
-:  montgomery-image ( a n -- a' )
-    #! a' = a * nextpowerof2(a) mod n
-    >r dup next-power-of-2 * r> mod ;
-
-! : montgomery* ( a b -- a*b )
-    ! "todo" throw ;
-
-: montgomery-r^2 ( n -- a )
-    #! ans = r^2 mod n, where r = nextpowerof2(n)
-    [ next-power-of-2 sq ] keep mod ;
-
-: montgomery-n0' ( n0 size -- n0' )
-    #! size should be a multiple of 2, n0 is odd and n0 < 2^size
-    #! n0 * n0' = -1 mod 2^w
-    2 swap ^ swap neg mod-inv ;
-
diff --git a/libs/crypto/random.factor b/libs/crypto/random.factor
deleted file mode 100644 (file)
index aa5e9eb..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-USING: kernel math math-contrib sequences namespaces errors
-hashtables words arrays parser compiler syntax io threads ;
-IN: crypto
-: make-bits ( quot numbits -- n | quot: -- 0/1 )
-    0 -rot [ drop dup call rot 1 shift bitor swap ] each drop ;
-
-DEFER: random-bits
-: add-bit ( bit integer -- integer ) 1 shift bitor ;
-: append-bits ( inta intb nbits -- int ) swapd shift bitor ;
-: large-random-bits ( n -- int )
-    #! random number with high bit and low bit enabled (odd)
-    2 swap ^ [ random-int ] keep -1 shift 1 bitor bitor ;
-: next-double ( -- f ) 53 random-bits 9007199254740992 /f ;
-
-
-SYMBOL: last-keyboard
-: crypto-random-int ( numbits -- integer )
-    [ 
-        millis last-keyboard set
-        2 /  ! how many bits for repeat?
-        0 swap
-        [
-            readln 2drop 100 random-int sleep 
-            millis [ last-keyboard get - HEX: 3 bitand 2 append-bits ] keep
-            last-keyboard set
-        ] each
-    ] with-scope ;
-
-: auto-crypto-random-int ( numbits -- integer )
-    [ 
-        millis last-keyboard set
-        0 swap
-        [
-            drop 10 random-int sleep 
-            millis [ last-keyboard get - HEX: 1 bitand swap add-bit ] keep
-            last-keyboard set
-        ] each
-    ] with-scope ;
-    
-IN: crypto
-
-: 0count ( integer -- n ) 0 swap [ 0 = [ 1+ ] when ] each-bit ;
-: 1count ( integer -- n ) 0 swap [ 1 = [ 1+ ] when ] each-bit ;
-
-IN: crypto-internals
-SYMBOL: a
-SYMBOL: b
-SYMBOL: c
-SYMBOL: d
-SYMBOL: n
-
-
-IN: crypto
-
-: bit-reverse-table
-{
-    HEX: 00 HEX: 80 HEX: 40 HEX: C0 HEX: 20 HEX: A0 HEX: 60 HEX: E0 HEX: 10 HEX: 90 HEX: 50 HEX: D0 HEX: 30 HEX: B0 HEX: 70 HEX: F0 
-    HEX: 08 HEX: 88 HEX: 48 HEX: C8 HEX: 28 HEX: A8 HEX: 68 HEX: E8 HEX: 18 HEX: 98 HEX: 58 HEX: D8 HEX: 38 HEX: B8 HEX: 78 HEX: F8 
-    HEX: 04 HEX: 84 HEX: 44 HEX: C4 HEX: 24 HEX: A4 HEX: 64 HEX: E4 HEX: 14 HEX: 94 HEX: 54 HEX: D4 HEX: 34 HEX: B4 HEX: 74 HEX: F4 
-    HEX: 0C HEX: 8C HEX: 4C HEX: CC HEX: 2C HEX: AC HEX: 6C HEX: EC HEX: 1C HEX: 9C HEX: 5C HEX: DC HEX: 3C HEX: BC HEX: 7C HEX: FC 
-    HEX: 02 HEX: 82 HEX: 42 HEX: C2 HEX: 22 HEX: A2 HEX: 62 HEX: E2 HEX: 12 HEX: 92 HEX: 52 HEX: D2 HEX: 32 HEX: B2 HEX: 72 HEX: F2 
-    HEX: 0A HEX: 8A HEX: 4A HEX: CA HEX: 2A HEX: AA HEX: 6A HEX: EA HEX: 1A HEX: 9A HEX: 5A HEX: DA HEX: 3A HEX: BA HEX: 7A HEX: FA
-    HEX: 06 HEX: 86 HEX: 46 HEX: C6 HEX: 26 HEX: A6 HEX: 66 HEX: E6 HEX: 16 HEX: 96 HEX: 56 HEX: D6 HEX: 36 HEX: B6 HEX: 76 HEX: F6 
-    HEX: 0E HEX: 8E HEX: 4E HEX: CE HEX: 2E HEX: AE HEX: 6E HEX: EE HEX: 1E HEX: 9E HEX: 5E HEX: DE HEX: 3E HEX: BE HEX: 7E HEX: FE
-    HEX: 01 HEX: 81 HEX: 41 HEX: C1 HEX: 21 HEX: A1 HEX: 61 HEX: E1 HEX: 11 HEX: 91 HEX: 51 HEX: D1 HEX: 31 HEX: B1 HEX: 71 HEX: F1
-    HEX: 09 HEX: 89 HEX: 49 HEX: C9 HEX: 29 HEX: A9 HEX: 69 HEX: E9 HEX: 19 HEX: 99 HEX: 59 HEX: D9 HEX: 39 HEX: B9 HEX: 79 HEX: F9 
-    HEX: 05 HEX: 85 HEX: 45 HEX: C5 HEX: 25 HEX: A5 HEX: 65 HEX: E5 HEX: 15 HEX: 95 HEX: 55 HEX: D5 HEX: 35 HEX: B5 HEX: 75 HEX: F5
-    HEX: 0D HEX: 8D HEX: 4D HEX: CD HEX: 2D HEX: AD HEX: 6D HEX: ED HEX: 1D HEX: 9D HEX: 5D HEX: DD HEX: 3D HEX: BD HEX: 7D HEX: FD
-    HEX: 03 HEX: 83 HEX: 43 HEX: C3 HEX: 23 HEX: A3 HEX: 63 HEX: E3 HEX: 13 HEX: 93 HEX: 53 HEX: D3 HEX: 33 HEX: B3 HEX: 73 HEX: F3 
-    HEX: 0B HEX: 8B HEX: 4B HEX: CB HEX: 2B HEX: AB HEX: 6B HEX: EB HEX: 1B HEX: 9B HEX: 5B HEX: DB HEX: 3B HEX: BB HEX: 7B HEX: FB
-    HEX: 07 HEX: 87 HEX: 47 HEX: C7 HEX: 27 HEX: A7 HEX: 67 HEX: E7 HEX: 17 HEX: 97 HEX: 57 HEX: D7 HEX: 37 HEX: B7 HEX: 77 HEX: F7 
-    HEX: 0F HEX: 8F HEX: 4F HEX: CF HEX: 2F HEX: AF HEX: 6F HEX: EF HEX: 1F HEX: 9F HEX: 5F HEX: DF HEX: 3F HEX: BF HEX: 7F HEX: FF
-} ; inline
-
diff --git a/libs/crypto/rc4.factor b/libs/crypto/rc4.factor
deleted file mode 100644 (file)
index 24f5231..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-USING: kernel math sequences namespaces math-contrib ;
-IN: crypto-internals
-
-! http://en.wikipedia.org/wiki/RC4_%28cipher%29
-
-SYMBOL: i
-SYMBOL: j
-SYMBOL: s
-SYMBOL: key
-SYMBOL: l
-
-
-! key scheduling algorithm, initialize s
-: ksa ( -- )
-    256 [ ] map s set
-    0 j set
-    256 [
-        dup s get nth j get + over l get mod key get nth + 255 bitand j set
-        dup j get s get exchange
-    ] repeat ;
-
-: generate ( -- n )
-    i get 1+ 255 bitand i set
-    j get i get s get nth + 255 bitand j set
-    i get j get s get exchange
-    i get s get nth j get s get nth + 255 bitand s get nth ;
-
-IN: crypto
-
-: rc4 ( key -- )
-    [ key set ] keep
-    length l set
-    ksa
-    0 i set
-    0 j set ;
-
diff --git a/libs/crypto/rsa.factor b/libs/crypto/rsa.factor
deleted file mode 100644 (file)
index e082e43..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-USING: kernel math namespaces math-contrib errors ;
-
-IN: crypto
-SYMBOL: d
-SYMBOL: p
-SYMBOL: q
-SYMBOL: n
-SYMBOL: m
-SYMBOL: ee
-
-! e = public key, d = private key, n = public modulus
-TUPLE: rsa e d n ;
-
-! n bits
-: generate-rsa-keypair ( bitlen -- <rsa> )
-    [
-        2 /i generate-two-unique-primes [ q set p set ] 2keep [ * n set ] 2keep
-        [ 1- ] 2apply * m set
-        65537 ee set
-        m get ee get mod-inv m get + d set
-        ee get d get n get <rsa>
-    ] with-scope ;
-
-: rsa-encrypt ( message rsa -- encrypted ) [ rsa-e ] keep rsa-n ^mod ;
-: rsa-decrypt ( encrypted rsa -- message ) [ rsa-d ] keep rsa-n ^mod ;
-
diff --git a/libs/crypto/sha1.factor b/libs/crypto/sha1.factor
deleted file mode 100644 (file)
index 689c11b..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-USING: kernel io strings sequences namespaces math parser
-vectors hashtables math-contrib crypto ;
-IN: crypto-internals
-
-! Implemented according to RFC 3174.
-
-SYMBOL: h0
-SYMBOL: h1
-SYMBOL: h2
-SYMBOL: h3
-SYMBOL: h4
-SYMBOL: A
-SYMBOL: B
-SYMBOL: C
-SYMBOL: D
-SYMBOL: E
-SYMBOL: w
-SYMBOL: K
-
-: get-wth ( n -- wth ) w get nth ; inline
-: shift-wth ( n -- x ) get-wth 1 bitroll-32 ; inline
-
-: initialize-sha1 ( -- )
-    0 bytes-read set
-    HEX: 67452301 dup h0 set A set
-    HEX: efcdab89 dup h1 set B set
-    HEX: 98badcfe dup h2 set C set
-    HEX: 10325476 dup h3 set D set
-    HEX: c3d2e1f0 dup h4 set E set
-    [
-        20 [ HEX: 5a827999 , ] times
-        20 [ HEX: 6ed9eba1 , ] times
-        20 [ HEX: 8f1bbcdc , ] times
-        20 [ HEX: ca62c1d6 , ] times
-    ] { } make K set ;
-
-! W(t) = S^1(W(t-3) XOR W(t-8) XOR W(t-14) XOR W(t-16))
-: sha1-W ( t -- W_t )
-     dup 3 - get-wth
-     over 8 - get-wth bitxor
-     over 14 - get-wth bitxor
-     swap 16 - get-wth bitxor 1 bitroll-32 ;
-
-! f(t;B,C,D) = (B AND C) OR ((NOT B) AND D)         ( 0 <= t <= 19)
-! f(t;B,C,D) = B XOR C XOR D                        (20 <= t <= 39)
-! f(t;B,C,D) = (B AND C) OR (B AND D) OR (C AND D)  (40 <= t <= 59)
-! f(t;B,C,D) = B XOR C XOR D                        (60 <= t <= 79)
-: sha1-f ( B C D t -- f_tbcd )
-    #! Maybe use dispatch
-    20 /i
-    {   
-        { [ dup 0 = ] [ drop >r over bitnot r> bitand >r bitand r> bitor ] }
-        { [ dup 1 = ] [ drop bitxor bitxor ] }
-        { [ dup 2 = ] [ drop 2dup bitand >r pick bitand >r bitand r> r> bitor bitor ] }
-        { [ dup 3 = ] [ drop bitxor bitxor ] }
-    } cond ;
-
-: make-w ( str -- )
-    #! compute w, steps a-b of RFC 3174, section 6.1
-    16 [ nth-int-be w get push ] each-with
-    16 80 dup <slice> [ sha1-W w get push ] each ;
-
-: init-letters ( -- )
-    ! step c of RFC 3174, section 6.1
-    h0 get A set
-    h1 get B set
-    h2 get C set
-    h3 get D set
-    h4 get E set ;
-
-: inner-loop ( n -- temp )
-    ! TEMP = S^5(A) + f(t;B,C,D) + E + W(t) + K(t);
-    [
-        [ B get C get D get ] keep sha1-f ,
-        dup get-wth ,
-        K get nth ,
-        A get 5 bitroll-32 ,
-        E get ,
-    ] { } make sum 4294967295 bitand ; inline
-
-: set-vars ( temp -- )
-    ! E = D;  D = C;  C = S^30(B);  B = A; A = TEMP;
-    D get E set
-    C get D set
-    B get 30 bitroll-32 C set
-    A get B set
-    A set ;
-
-: calculate-letters ( -- )
-    ! step d of RFC 3174, section 6.1
-    80 [ inner-loop set-vars ] each ;
-
-: update-hs ( -- )
-    ! step e of RFC 3174, section 6.1
-    A h0 update-old-new
-    B h1 update-old-new
-    C h2 update-old-new
-    D h3 update-old-new
-    E h4 update-old-new ;
-
-: process-sha1-block ( str -- )
-    80 <vector> w set make-w init-letters calculate-letters update-hs ;
-
-: get-sha1 ( -- str )
-    [ [ h0 h1 h2 h3 h4 ] [ get 4 >be % ] each ] "" make ;
-
-: (stream>sha1) ( -- )
-    64 read dup length dup bytes-read [ + ] change 64 = [
-        process-sha1-block (stream>sha1)
-    ] [
-        t bytes-read get pad-last-block [ process-sha1-block ] each
-    ] if ;
-
-IN: crypto
-
-: stream>sha1 ( stream -- sha1 )
-    [ [ initialize-sha1 (stream>sha1) get-sha1 ] with-stream ] with-scope ;
-
-: string>sha1 ( string -- sha1 ) <string-reader> stream>sha1 ;
-: string>sha1str ( string -- str ) string>sha1 hex-string ;
-: file>sha1 ( file -- sha1 ) <file-reader> stream>sha1 ;
-
diff --git a/libs/crypto/sha2.factor b/libs/crypto/sha2.factor
deleted file mode 100644 (file)
index bdd0400..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-USING: crypto crypto-internals io kernel math namespaces sequences words ;
-IN: sha2-internals
-
-SYMBOL: vars
-SYMBOL: M
-SYMBOL: K
-SYMBOL: H
-SYMBOL: S0
-SYMBOL: S1
-SYMBOL: process-M
-SYMBOL: word-size
-SYMBOL: block-size
-SYMBOL: >word
-
-: a 0 ;
-: b 1 ;
-: c 2 ;
-: d 3 ;
-: e 4 ;
-: f 5 ;
-: g 6 ;
-: h 7 ;
-
-: initial-H-256 ( -- seq )
-    {
-        HEX: 6a09e667 HEX: bb67ae85 HEX: 3c6ef372 HEX: a54ff53a
-        HEX: 510e527f HEX: 9b05688c HEX: 1f83d9ab HEX: 5be0cd19
-    } ;
-
-: K-256 ( -- seq )
-    {
-        HEX: 428a2f98 HEX: 71374491 HEX: b5c0fbcf HEX: e9b5dba5
-        HEX: 3956c25b HEX: 59f111f1 HEX: 923f82a4 HEX: ab1c5ed5
-        HEX: d807aa98 HEX: 12835b01 HEX: 243185be HEX: 550c7dc3
-        HEX: 72be5d74 HEX: 80deb1fe HEX: 9bdc06a7 HEX: c19bf174
-        HEX: e49b69c1 HEX: efbe4786 HEX: 0fc19dc6 HEX: 240ca1cc
-        HEX: 2de92c6f HEX: 4a7484aa HEX: 5cb0a9dc HEX: 76f988da
-        HEX: 983e5152 HEX: a831c66d HEX: b00327c8 HEX: bf597fc7
-        HEX: c6e00bf3 HEX: d5a79147 HEX: 06ca6351 HEX: 14292967
-        HEX: 27b70a85 HEX: 2e1b2138 HEX: 4d2c6dfc HEX: 53380d13
-        HEX: 650a7354 HEX: 766a0abb HEX: 81c2c92e HEX: 92722c85
-        HEX: a2bfe8a1 HEX: a81a664b HEX: c24b8b70 HEX: c76c51a3
-        HEX: d192e819 HEX: d6990624 HEX: f40e3585 HEX: 106aa070
-        HEX: 19a4c116 HEX: 1e376c08 HEX: 2748774c HEX: 34b0bcb5
-        HEX: 391c0cb3 HEX: 4ed8aa4a HEX: 5b9cca4f HEX: 682e6ff3
-        HEX: 748f82ee HEX: 78a5636f HEX: 84c87814 HEX: 8cc70208
-        HEX: 90befffa HEX: a4506ceb HEX: bef9a3f7 HEX: c67178f2
-    } ;
-
-: s0-256 ( x -- x' )
-    [ -7 bitroll-32 ] keep
-    [ -18 bitroll-32 ] keep
-    -3 shift bitxor bitxor ; inline
-
-: s1-256 ( x -- x' )
-    [ -17 bitroll-32 ] keep
-    [ -19 bitroll-32 ] keep
-    -10 shift bitxor bitxor ; inline
-
-: process-M-256 ( seq n -- )
-    [ 16 - swap nth ] 2keep
-    [ 15 - swap nth s0-256 ] 2keep
-    [ 7 - swap nth ] 2keep
-    [ 2 - swap nth s1-256 ] 2keep
-    >r >r + + w+ r> r> swap set-nth ; inline
-
-: prepare-message-schedule ( seq -- w-seq )
-    word-size get group [ be> ] map block-size get 0 pad-right
-    dup 16 64 dup <slice> [
-        process-M-256
-    ] each-with ;
-
-: ch ( x y z -- x' )
-    [ bitxor bitand ] keep bitxor ;
-
-: maj ( x y z -- x' )
-    >r [ bitand ] 2keep bitor r> bitand bitor ;
-
-: S0-256 ( x -- x' )
-    [ -2 bitroll-32 ] keep
-    [ -13 bitroll-32 ] keep
-    -22 bitroll-32 bitxor bitxor ; inline
-
-: S1-256 ( x -- x' )
-    [ -6 bitroll-32 ] keep
-    [ -11 bitroll-32 ] keep
-    -25 bitroll-32 bitxor bitxor ; inline
-
-: T1 ( W n -- T1 )
-    [ swap nth ] keep
-    K get nth +
-    e vars get slice3 ch +
-    e vars get nth S1-256 +
-    h vars get nth w+ ;
-
-: T2 ( -- T2 )
-    a vars get nth S0-256
-    a vars get slice3 maj w+ ;
-
-: update-vars ( T1 T2 -- )
-    vars get
-    h g pick exchange
-    g f pick exchange
-    f e pick exchange
-    pick d pick nth w+ e pick set-nth
-    d c pick exchange
-    c b pick exchange
-    b a pick exchange
-    >r w+ a r> set-nth ;
-
-: process-chunk ( M -- )
-    H get clone vars set
-    prepare-message-schedule block-size get [
-        T1 T2 update-vars
-    ] each-with vars get H get [ w+ ] 2map H set ;
-
-: seq>string ( n seq -- string )
-    [ [ swap >be % ] each-with ] "" make ;
-
-: string>sha2 ( string -- string )
-    t preprocess-plaintext
-    block-size get group [ process-chunk ] each
-    4 H get seq>string ;
-
-IN: sha2
-: string>sha-256 ( string -- string )
-    [
-        K-256 K set
-        initial-H-256 H set
-        4 word-size set
-        64 block-size set
-        \ >32-bit >word set
-        string>sha2
-    ] with-scope ;
-
-: string>sha-256-string ( string -- hexstring )
-    string>sha-256 hex-string ;
-
diff --git a/libs/crypto/test/barrett.factor b/libs/crypto/test/barrett.factor
deleted file mode 100644 (file)
index 2f26eb1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-USING: kernel math test namespaces crypto ;
-
-[ HEX: 1f63edfb7e838622c7412eafaf0439cf0cdf3aae8bdd09e2de69b509a53883a83560d5ce50ea039e4 ] [  HEX: 827c67f31b2b46afa49ed95d7f7a3011e5875f7052d4c55437ce726d3c6ce0dc9c445fda63b6dc4e 16 barrett-mu ] unit-test
-
diff --git a/libs/crypto/test/blum-blum-shub.factor b/libs/crypto/test/blum-blum-shub.factor
deleted file mode 100644 (file)
index b1b6034..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-USING: kernel math test namespaces crypto crypto-internals ;
-
-[ 6 ] [ 5 T{ bbs f 590695557939 811977232793 } random-bbs-bits* ] unit-test
-[ 792723710536787233474130382522 ] [ 100 T{ bbs f 200352954495 846054538649 } [ random-bbs-bits* drop ] 2keep random-bbs-bits* ] unit-test
-
diff --git a/libs/crypto/test/common.factor b/libs/crypto/test/common.factor
deleted file mode 100644 (file)
index 6050454..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-USING: kernel math test namespaces crypto ;
-
-[ 0 ] [ 1 0 0 bitroll ] unit-test
-[ 1 ] [ 1 0 1 bitroll ] unit-test
-[ 1 ] [ 1 1 1 bitroll ] unit-test
-[ 1 ] [ 1 0 2 bitroll ] unit-test
-[ 1 ] [ 1 0 1 bitroll ] unit-test
-[ 1 ] [ 1 20 2 bitroll ] unit-test
-[ 1 ] [ 1 8 8 bitroll ] unit-test
-[ 1 ] [ 1 -8 8 bitroll ] unit-test
-[ 1 ] [ 1 -32 8 bitroll ] unit-test
-[ 128 ] [ 1 -1 8 bitroll ] unit-test
-[ 8 ] [ 1 3 32 bitroll ] unit-test
-
-
diff --git a/libs/crypto/test/crc32.factor b/libs/crypto/test/crc32.factor
deleted file mode 100644 (file)
index e463900..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-USING: kernel math test namespaces crypto ;
-
-[ 0 ] [ "" >crc32 ] unit-test
-[ HEX: cbf43926 ] [ "123456789" >crc32 ] unit-test
-
diff --git a/libs/crypto/test/md5.factor b/libs/crypto/test/md5.factor
deleted file mode 100644 (file)
index 42d8b92..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-USING: kernel math test namespaces crypto ;
-
-[ "d41d8cd98f00b204e9800998ecf8427e" ] [ "" string>md5str ] unit-test
-[ "0cc175b9c0f1b6a831c399e269772661" ] [ "a" string>md5str ] unit-test
-[ "900150983cd24fb0d6963f7d28e17f72" ] [ "abc" string>md5str ] unit-test
-[ "f96b697d7cb7938d525a2f31aaf161d0" ] [ "message digest" string>md5str ] unit-test
-[ "c3fcd3d76192e4007dfb496cca67e13b" ] [ "abcdefghijklmnopqrstuvwxyz" string>md5str ] unit-test
-[ "d174ab98d277d9f5a5611c2c9f419d9f" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" string>md5str ] unit-test
-[ "57edf4a22be3c955ac49da2e2107b67a" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" string>md5str ] unit-test
-
diff --git a/libs/crypto/test/miller-rabin.factor b/libs/crypto/test/miller-rabin.factor
deleted file mode 100644 (file)
index 1590180..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-USING: errors kernel math test namespaces crypto ;
-
-[ f ] [ 473155932665450549999756893736999469773678960651272093993257221235459777950185377130233556540099119926369437865330559863 miller-rabin ] unit-test
-[ "miller-rabin error: must call with n > 2" ] [ [ 2 miller-rabin ] catch ] unit-test
-[ t ] [ 3 miller-rabin ] unit-test
-[ f ] [ 36 miller-rabin ] unit-test
-[ t ] [ 37 miller-rabin ] unit-test
-[ 101 ] [ 100 next-miller-rabin-prime ] unit-test
-[ 100000000000031 ] [ 100000000000000 next-miller-rabin-prime ] unit-test
-
diff --git a/libs/crypto/test/montgomery.factor b/libs/crypto/test/montgomery.factor
deleted file mode 100644 (file)
index 8ab0f01..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-USING: kernel math test namespaces crypto ;
-
-
-[ HEX: 7155b978fed765e2ec80b472b4eae1154d2f75dd753e7efaca0449b8eaf7c047f94564302c80c717 ] [ HEX: c8d30cdd849cc1cbccf75340f903cde3acc0e7b5e0326aa91f82f442cc1ab23f66cf042c2af22a0b montgomery-r^2 ] unit-test
-
-[ HEX: 5aee1477 ] [ HEX: d681fab9 32 montgomery-n0' ] unit-test
-
-
diff --git a/libs/crypto/test/rsa.factor b/libs/crypto/test/rsa.factor
deleted file mode 100644 (file)
index cddad58..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: kernel math test namespaces crypto ;
-
-[ 123456789 ] [ 128 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
-[ 123456789 ] [ 129 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
-[ 123456789 ] [ 130 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
-[ 123 ] [ 17 2753 3233 <rsa> 123 over rsa-encrypt swap rsa-decrypt ] unit-test
-
diff --git a/libs/crypto/test/sha1.factor b/libs/crypto/test/sha1.factor
deleted file mode 100644 (file)
index 24f9de5..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: kernel math test namespaces crypto ;
-
-[ "a9993e364706816aba3e25717850c26c9cd0d89d" ] [ "abc" string>sha1str ] unit-test
-[ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" ] [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" string>sha1str ] unit-test
-! [ "34aa973cd4c4daa4f61eeb2bdbad27316534016f" ] [ 1000000 CHAR: a fill string>sha1str ] unit-test ! takes a long time...
-[ "dea356a2cddd90c7a7ecedc5ebb563934f460452" ] [ "0123456701234567012345670123456701234567012345670123456701234567" [ 10 [ dup % ] times ] "" make nip string>sha1str ] unit-test
-
diff --git a/libs/crypto/test/sha2.factor b/libs/crypto/test/sha2.factor
deleted file mode 100644 (file)
index b235487..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: kernel math test namespaces crypto sha2 ;
-[ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ] [ "" string>sha-256-string ] unit-test
-[ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ] [ "abc" string>sha-256-string ] unit-test
-[ "f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650" ] [ "message digest" string>sha-256-string ] unit-test
-[ "71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73" ] [ "abcdefghijklmnopqrstuvwxyz" string>sha-256-string ] unit-test
-[ "db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0" ] [ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" string>sha-256-string ] unit-test
-[ "f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e" ] [ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" string>sha-256-string ] unit-test
diff --git a/libs/crypto/timing.factor b/libs/crypto/timing.factor
deleted file mode 100644 (file)
index e599950..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-IN: timing
-USING: kernel math threads ;
-
-: with-timing ( n quot -- )
-    #! force the quotation to execute in, at minimum, n milliseconds
-    millis >r call millis r> - - sleep ;
diff --git a/libs/dlists.factor b/libs/dlists.factor
deleted file mode 100644 (file)
index b5bd1da..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-! Copyright (C) 2005 Mackenzie Straight.
-! See http://factor.sf.net/license.txt for BSD license.
-IN: dlists
-USING: generic kernel math modules ;
-
-! Double-linked lists.
-
-TUPLE: dlist first last ;
-TUPLE: dlist-node next prev data ;
-
-C: dlist ;
-C: dlist-node
-    [ set-dlist-node-next ] keep
-    [ set-dlist-node-prev ] keep
-    [ set-dlist-node-data ] keep ;
-
-: dlist-push-end ( data dlist -- )
-    [ dlist-last f <dlist-node> ] keep
-    [ dlist-last [ dupd set-dlist-node-next ] when* ] keep
-    2dup set-dlist-last
-    dup dlist-first [ 2drop ] [ set-dlist-first ] if ;
-
-: dlist-empty? ( dlist -- ? )
-    dlist-first f = ;
-    
-: (unlink-prev) ( dlist dnode -- )
-    dup dlist-node-prev [
-        dupd swap dlist-node-next swap set-dlist-node-next
-    ] when*
-    2dup swap dlist-first eq? [ 
-        dlist-node-next swap set-dlist-first 
-    ] [ 2drop ] if ;
-
-: (unlink-next) ( dlist dnode -- )
-    dup dlist-node-next [
-        dupd swap dlist-node-prev swap set-dlist-node-prev
-    ] when*
-    2dup swap dlist-last eq? [
-        dlist-node-prev swap set-dlist-last
-    ] [ 2drop ] if ;
-
-: (dlist-unlink) ( dlist dnode -- )
-    [ (unlink-prev) ] 2keep (unlink-next) ;
-
-: (dlist-pop-front) ( dlist -- data )
-    [ dlist-first dlist-node-data ] keep dup dlist-first (dlist-unlink) ;
-
-: dlist-pop-front ( dlist -- data )
-    dup dlist-empty? [ drop f ] [ (dlist-pop-front) ] if ;
-
-: (dlist-each) ( quot dnode -- )
-    [
-        [ dlist-node-data swap call ] 2keep 
-        dlist-node-next (dlist-each)
-    ] [
-        drop
-    ] if* ; inline
-
-: dlist-each ( dlist quot -- )
-    swap dlist-first (dlist-each) ; inline
-
-: dlist-length ( dlist -- length )
-    0 swap [ drop 1 + ] dlist-each ;
-
-PROVIDE: libs/dlists ;
diff --git a/libs/emacs.factor b/libs/emacs.factor
deleted file mode 100644 (file)
index 765d260..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-REQUIRES: libs/process ;
-
-USING: definitions kernel parser words sequences math process
-namespaces ;
-
-IN: emacs
-
-: emacsclient ( file line -- )
-[ "emacsclient --no-wait +" % # " " % % ] "" make system drop ;
-
-: emacs ( word -- )
-where first2 emacsclient ;
-
-[ emacsclient ] edit-hook set-global
-
-PROVIDE: libs/emacs ;
diff --git a/libs/factor.el b/libs/factor.el
deleted file mode 100644 (file)
index 2531f13..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-;; Eduardo Cavazos - wayo.cavazos@gmail.com
-
-;; Add these lines to your .emacs file:
-
-;; (load-file "/scratch/repos/Factor/contrib/factor.el")
-;; (setq factor-binary "/scratch/repos/Factor/f")
-;; (setq factor-image "/scratch/repos/Factor/factor.image")
-
-;; Of course, you'll have to edit the directory paths for your system
-;; accordingly.
-
-;; That's all you have to do to "install" factor.el on your
-;; system. Whenever you edit a factor file, Emacs will know to switch
-;; to Factor mode.
-
-;; M-x factor-listener === Start a new factor listener inside Emacs
-;; M-x factor-listener-restart === Restart a factor listener whose
-;;                                 session has ended.
-
-;; BUG: A double quote character on a commented line will break the
-;; syntax highlighting for that line.
-
-(defgroup factor nil
-  "Factor mode"
-  :group 'languages)
-
-(defvar factor-mode-syntax-table nil
-  "Syntax table used while in Factor mode.")
-
-(if factor-mode-syntax-table
-    ()
-  (let ((i 0))
-    (setq factor-mode-syntax-table (make-syntax-table))
-
-    ;; Default is atom-constituent
-    (while (< i 256)
-      (modify-syntax-entry i "_   ")
-      (setq i (1+ i)))
-
-    ;; Word components.
-    (setq i ?0)
-    (while (<= i ?9)
-      (modify-syntax-entry i "w   ")
-      (setq i (1+ i)))
-    (setq i ?A)
-    (while (<= i ?Z)
-      (modify-syntax-entry i "w   ")
-      (setq i (1+ i)))
-    (setq i ?a)
-    (while (<= i ?z)
-      (modify-syntax-entry i "w   ")
-      (setq i (1+ i)))
-
-    ;; Whitespace
-    (modify-syntax-entry ?\t " ")
-    (modify-syntax-entry ?\n ">")
-    (modify-syntax-entry ?\f " ")
-    (modify-syntax-entry ?\r " ")
-    (modify-syntax-entry ?  " ")
-
-    (modify-syntax-entry ?\[ "(]  ")
-    (modify-syntax-entry ?\] ")[  ")
-    (modify-syntax-entry ?{ "(}  ")
-    (modify-syntax-entry ?} "){  ")
-
-    (modify-syntax-entry ?\( "()")
-    (modify-syntax-entry ?\) ")(")
-    (modify-syntax-entry ?\" "\"    ")))
-    
-(defcustom factor-mode-hook nil
-  "Hook run when entering Factor mode."
-  :type 'hook
-  :group 'factor)
-
-(defconst factor-font-lock-keywords
-  '(("#!.*$" . font-lock-comment-face)
-    ("!.*$" . font-lock-comment-face)
-    ("( .* )" . font-lock-comment-face)
-    "IN:" "USING:" "TUPLE:" "^C:" "^M:" "USE:" "REQUIRE:" "PROVIDE:"
-    "REQUIRES:"
-    "GENERIC:" "SYMBOL:" "PREDICATE:" "VAR:"))
-
-(defun factor-mode ()
-  "A mode for editing programs written in the Factor programming language."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'factor-mode)
-  (setq mode-name "Factor")
-  (make-local-variable 'comment-start)
-  (setq comment-start "! ")
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults
-       '(factor-font-lock-keywords nil nil nil nil))
-  (set-syntax-table factor-mode-syntax-table)
-  (run-hooks 'factor-mode-hooks))
-
-(add-to-list 'auto-mode-alist '("\\.factor\\'" . factor-mode))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(require 'comint)
-
-(define-derived-mode factor-listener-mode comint-mode "Factor listener"
-  (setq comint-prompt-regexp "ok "))
-
-(defvar factor-binary "/scratch/factor-darcs/repos/Factor/f")
-(defvar factor-image "/scratch/factor-darcs/repos/Factor/factor.image")
-
-(defun factor-server ()
-  (interactive)
-  (make-comint "factor-server" factor-binary nil factor-image "-shell=tty")
-  (comint-send-string "*factor-server*" "USE: shells telnet\n"))
-
-;; (defun factor-listener ()
-;;   (interactive)
-;;   (factor-server)
-;;   (sleep-for 0 500)
-;;   (switch-to-buffer (make-comint "factor-listener" '("localhost" . 9999)))
-;;   (rename-uniquely)
-;;   (factor-listener-mode))
-
-(defun factor-listener ()
-  (interactive)
-  (factor-server)
-  (sleep-for 0 1000)
-  (if (get-buffer "*factor-listener*")
-      (save-excursion
-       (set-buffer "*factor-listener*")
-       (rename-uniquely)))
-  (switch-to-buffer (make-comint "factor-listener" '("localhost" . 9999)))
-  (factor-listener-mode))
-
-(defun factor-listener-restart ()
-  (interactive)
-  (factor-server)
-  (sleep-for 0 1000)
-  (make-comint-in-buffer
-   "factor-listener" (current-buffer) '("localhost" . 9999)))
-
-(defun factor-run-file (file-name)
-  (interactive "fRun Factor file: ")
-  (comint-send-string nil (format "\"%s\" run-file\n" file-name)))
-
-(defun factor-update-stack-buffer (&optional string)
-  (interactive)
-  (save-excursion
-    (set-buffer (get-buffer-create "*factor-stack*"))
-    (erase-buffer)
-    (comint-redirect-send-command-to-process
-     ".s" "*factor-stack*" "*factor-listener*" nil)))
-
-(defvar factor-update-stackp nil "*")
-
-(defun factor-send-input ()
-  (interactive)
-  (comint-send-input)
-  (if factor-update-stackp
-      (progn (sleep-for 0 250) (factor-update-stack-buffer))))
-
-(defun factor-synopsis ()
-  (interactive)
-  (message
-   (first
-    (comint-redirect-results-list-from-process 
-     (get-buffer-process "*factor-listener*")
-     (format "\\ %s summary print" (thing-at-point 'symbol))
-     ;; "[ ]*\\(.*\\)\n"
-     "\\(.*\\)\n"
-     1))))
-
-(fset 'factor-comment-line "\C-a! ")
\ No newline at end of file
diff --git a/libs/fjsc/fjsc.factor b/libs/fjsc/fjsc.factor
deleted file mode 100644 (file)
index a410964..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-! Copyright (C) 2006 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: fjsc
-USING: kernel lazy-lists parser-combinators strings math sequences namespaces io words arrays ;
-
-TUPLE: ast-number value ;
-TUPLE: ast-identifier value vocab ;
-TUPLE: ast-string value ;
-TUPLE: ast-quotation values ;
-TUPLE: ast-array elements ;
-TUPLE: ast-define name stack-effect expression ;
-TUPLE: ast-expression values ;
-TUPLE: ast-word value vocab ;
-TUPLE: ast-comment ;
-TUPLE: ast-stack-effect in out ;
-
-LAZY: 'digit' ( -- parser )
-  [ digit? ] satisfy [ digit> ] <@ ;
-
-LAZY: 'number' ( -- parser )
-  'digit' <!+> [ 0 [ swap 10 * + ] reduce <ast-number> ] <@ ;
-
-LAZY: 'quote' ( -- parser )
-  [ CHAR: " = ] satisfy ;
-
-LAZY: 'string' ( -- parser )
-  'quote' sp [
-    CHAR: " = not
-  ] satisfy <*> [ >string <ast-string> ] <@ &> 'quote' <& ;
-: identifier-middle? ( ch -- bool )
-  [ blank? not ] keep
-  [ CHAR: } = not ] keep
-  [ CHAR: ] = not ] keep
-  [ CHAR: ;" = not ] keep
-  [ CHAR: " = not ] keep
-  digit? not 
-  and and and and and ;
-
-LAZY: 'identifier-ends' ( -- parser )  
-  [ 
-    [ blank? not ] keep
-    [ CHAR: " = not ] keep
-    [ CHAR: ;" = not ] keep
-    [ LETTER? not ] keep
-    [ letter? not ] keep
-    identifier-middle? not
-    and and and and and
-  ] satisfy <!*> ;
-
-LAZY: 'identifier-middle' ( -- parser )  
-  [ identifier-middle? ] satisfy <!+> ;
-
-LAZY: 'identifier' ( -- parser )
-  'identifier-ends' 
-  'identifier-middle' <&>
-  'identifier-ends' <:&> 
-  [ concat >string f <ast-identifier> ] <@ ;
-
-  
-DEFER: 'expression'
-
-LAZY: 'effect-name' ( -- parser )
-  [ 
-    [ blank? not ] keep
-    CHAR: - = not
-    and    
-  ] satisfy <!+> [ >string ] <@ ;
-
-LAZY: 'stack-effect' ( -- parser )
-  "(" token sp
-  'effect-name' sp <*> &>
-  "--" token sp <&
-  'effect-name' sp <*> <&>
-  ")" token sp <& [ first2 <ast-stack-effect> ] <@ ;
-
-LAZY: 'define' ( -- parser )
-  ":" token sp 
-  'identifier' sp [ ast-identifier-value ] <@ &>
-  'stack-effect' sp <!?> <&>
-  'expression' <:&>
-  ";" token sp <& [ first3 <ast-define> ] <@ ;
-
-LAZY: 'quotation' ( -- parser )
-  "[" token sp 
-  'expression' [ ast-expression-values ] <@ &>
-  "]" token sp <& [ <ast-quotation> ] <@ ;
-
-LAZY: 'array' ( -- parser )
-  "{" token sp 
-  'expression' [ ast-expression-values ] <@ &>
-  "}" token sp <& [ <ast-array> ] <@ ;
-
-LAZY: 'word' ( -- parser )
-  "\\" token sp 
-  'identifier' sp &> [ ast-identifier-value f <ast-word> ] <@ ;
-
-LAZY: 'atom' ( -- parser )
-  'identifier' 'number' <|> 'string' <|> ;
-
-LAZY: 'comment' ( -- parser )
-  "#!" token sp
-  "!" token sp <|> [
-    dup CHAR: \n = swap CHAR: \r = or not
-  ] satisfy <*> <&> [ drop <ast-comment> ] <@ ;
-
-LAZY: 'expression' ( -- parser )
-  'comment' 
-  'quotation' sp <|> 
-  'define' sp <|>
-  'array' sp <|>
-  'word' sp <|>
-  'atom' sp <|> 
-  <*> [ <ast-expression> ] <@ ;
-
-LAZY: 'statement' ( -- parser )
-  'expression' ;
-
-GENERIC: (compile) ( ast -- )
-GENERIC: (literal) ( ast -- )
-
-M: ast-number (literal) 
-  ast-number-value number>string , ;
-
-M: ast-number (compile) 
-  "factor.push_data(" ,
-  (literal)  
-  "," , ;
-
-M: ast-string (literal) 
-  "\"" ,
-  ast-string-value ,
-  "\"" , ;
-
-M: ast-string (compile) 
-  "factor.push_data(" ,
-  (literal)
-  "," , ;
-
-M: ast-identifier (literal) 
-  dup ast-identifier-vocab [
-   "factor.get_word(\"" , 
-   dup ast-identifier-vocab ,
-   "\",\"" ,
-   ast-identifier-value , 
-   "\")" ,  
-  ] [
-   "factor.find_word(\"" , ast-identifier-value , "\")" ,  
-  ] if ;
-
-M: ast-identifier (compile) 
-  (literal) ".execute(" ,  ;
-
-M: ast-define (compile) 
-  "factor.define_word(\"" , 
-  dup ast-define-name , 
-  "\",\"source\"," ,
-  ast-define-expression (compile)
-  "," , ;
-
-: do-expressions ( seq -- )
-  dup empty? not [
-    unclip
-    dup ast-comment? not [
-      "function() {" ,
-      (compile) 
-      do-expressions
-      ")}" ,
-    ] [
-      drop do-expressions
-    ] if
-  ] [
-    drop "factor.cont.next" ,
-  ] if  ;
-
-M: ast-quotation (literal)   
-  "factor.make_quotation(\"source\"," ,
-  ast-quotation-values do-expressions
-  ")" , ;
-
-M: ast-quotation (compile)   
-  "factor.push_data(factor.make_quotation(\"source\"," ,
-  ast-quotation-values do-expressions
-  ")," , ;
-
-M: ast-array (literal)   
-  "[" ,  
-  ast-array-elements [ (literal) ] [ "," , ] interleave
-  "]" , ;
-
-M: ast-array (compile)   
-  "factor.push_data(" , (literal) "," , ;
-
-
-M: ast-expression (literal)
-  ast-expression-values [
-    (literal) 
-  ] each ;
-  
-M: ast-expression (compile)
-  ast-expression-values do-expressions ;
-
-M: ast-word (literal)   
-  dup ast-word-vocab [
-   "factor.get_word(\"" , 
-   dup ast-word-vocab ,
-   "\",\"" ,
-   ast-word-value , 
-   "\")" ,  
-  ] [
-   "factor.find_word(\"" , ast-word-value , "\")" ,  
-  ] if ;
-
-M: ast-word (compile)
-  "factor.push_data(" ,
-  (literal)
-  "," , ;
-  
-M: ast-comment (compile)
-  drop ;
-
-M: ast-stack-effect (compile)
-  drop ;
-
-GENERIC: (parse-factor-quotation) ( object -- ast )
-
-M: number (parse-factor-quotation) ( object -- ast )
-  <ast-number> ;
-
-M: symbol (parse-factor-quotation) ( object -- ast )
-  dup >string swap word-vocabulary <ast-identifier> ;
-
-M: word (parse-factor-quotation) ( object -- ast )
-  dup word-name swap word-vocabulary <ast-identifier> ;
-
-M: string (parse-factor-quotation) ( object -- ast )
-  <ast-string> ;
-
-M: quotation (parse-factor-quotation) ( object -- ast )
-  [ 
-    [ (parse-factor-quotation) , ] each
-  ] { } make <ast-quotation> ;
-
-M: array (parse-factor-quotation) ( object -- ast )
-  [ 
-    [ (parse-factor-quotation) , ] each
-  ] { } make <ast-array> ;
-
-M: wrapper (parse-factor-quotation) ( object -- ast )
-  wrapped dup word-name swap word-vocabulary <ast-word> ;
-
-GENERIC: fjsc-parse ( object -- ast )
-
-M: string fjsc-parse ( object -- ast )
-  'expression' parse car parse-result-parsed ;
-
-M: quotation fjsc-parse ( object -- ast )
-  [
-    [ (parse-factor-quotation) , ] each 
-  ] { } make <ast-expression> ;
-
-: fjsc-compile ( ast -- string )
-  [
-    [ 
-      "(" ,
-      (compile) 
-      ")" ,
-    ] { } make [ write ] each
-  ] string-out ;
-  
-: fjsc-compile* ( string -- string )
-  'statement' parse car parse-result-parsed fjsc-compile ;
-
-: fc* ( string -- string )
-  [
-  'statement' parse car parse-result-parsed ast-expression-values do-expressions 
-  ] { } make [ write ] each ;
-  
-
-: fjsc-literal ( ast -- string )
-  [
-    [ (literal) ] { } make [ write ] each
-  ] string-out ;
-  
\ No newline at end of file
diff --git a/libs/fjsc/load.factor b/libs/fjsc/load.factor
deleted file mode 100644 (file)
index 9f44876..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-! Copyright (C) 2006 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-REQUIRES: libs/lazy-lists libs/parser-combinators ;
-
-PROVIDE: libs/fjsc 
-{ 
-  +files+ { 
-  "fjsc.factor" 
-  } 
-} {
-  +tests+ { 
-  "tests.factor"
-  }
-} { 
-  +help+ 
-  { 
-  } 
-} ;
diff --git a/libs/fjsc/resources/bootstrap.factor b/libs/fjsc/resources/bootstrap.factor
deleted file mode 100644 (file)
index 7c16049..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-: alert ( string -- )
-  #! Display the string in an alert box
-  window { } "" "alert" { "string" } alien-invoke ;
-
-"browser-dom" in
-
-: elements ( string -- result )
-  #! Call JQuery's $ function
-  window { "result" } "" "$" { "string" } alien-invoke ;
-  
-: html ( string -- element ) 
-  #! Set the innerHTML of element using jQuery
-  { } "" "html" { "string" } alien-invoke ;
-
-: bind-event ( name element quot -- )
-  >function swap { } "" "bind" { "string" "function" } alien-invoke ;
-
-"scratchpad" in
-
-: example1 ( -- )
-  "<button id='test'>Press Me</button>" "#playground" elements html ;
-
-: example2 ( -- )
-  "click" "#test" elements [ "clicked" alert ] bind-event ;
-
-: example3 ( -- )
-  [
-    [
-      >r "click" "#test" elements r> [ continue ] curry bind-event
-      "Waiting for click on button" alert
-      continue
-    ] callcc0
-    drop "Click done!" alert 
-  ] callcc0 ;
-  
diff --git a/libs/fjsc/resources/bootstrap.js b/libs/fjsc/resources/bootstrap.js
deleted file mode 100644 (file)
index 4707e03..0000000
+++ /dev/null
@@ -1,599 +0,0 @@
-function Word(vocab, name, source, func) {
-  this.vocab = vocab;
-  this.name = name;
-  this.source = source;
-  this.func = func;
-}
-
-Word.prototype.execute = function(next) {
-  this.func(next);
-}
-
-Word.prototype.toString = function() {
-  var html = [];
-  html.push("<a href='/responder/browser/browse?vocab=")
-  html.push(this.vocab);
-  html.push("&amp;word=")
-  html.push(this.name);
-  html.push("'>")
-  html.push(this.name);
-  html.push("</a>");
-  return html.join("");
-}
-
-function Continuation() {
-  this.data_stack = [ ];
-  this.retain_stack = [ ];
-  this.next = false;
-  this.nesting = 0;
-}
-
-Continuation.prototype.clone = function() {
-  var c = new Continuation();
-  c.data_stack = this.data_stack.slice(0);
-  c.retain_stack = this.retain_stack.slice(0);
-  c.nesting = this.nesting;
-  c.next = this.next;
-  return c;
-}
-
-function Factor() {
-  this.vocabs = { scratchpad: { } };
-  this.in_vocab = "scratchpad";
-  this.using_vocabs = [ "scratchpad", "kernel","math","sequences","parser","alien","browser-dom", "words" ];
-  this.cont = new Continuation();
-}
-
-var factor = new Factor();
-
-Factor.prototype.call_next = function(next) {
-  if(next) {
-    if(this.cont.nesting++ > 150) {
-      this.cont.nesting = 0;
-      setTimeout(next, 0);
-   }
-    else {
-      next();
-    }
-  }
-}
-
-Factor.prototype.push_data = function(v, next) {
-  factor.cont.data_stack.push(v);
-  factor.call_next(next);
-}
-
-Factor.prototype.get_word = function(vocab,name) {
-  return factor.vocabs[vocab][name];
-}
-
-Factor.prototype.find_word = function(name) {
-  for(var v = 0; v<factor.using_vocabs.length; ++v) {
-    var w = factor.vocabs[factor.using_vocabs[v]][name];
-    if(w)
-      return w;
-  }
-  return false;
-}
-
-Factor.prototype.add_word = function(vocab,name, source, func) {
-  var v = factor.vocabs[vocab];
-  if(!v) {
-    v = { };
-    factor.vocabs[vocab] = v;
-  }
-  v[name] = new Word(vocab,name,source,func);
-}
-
-Factor.prototype.remove_word = function(vocab,name) {
-  var v = factor.vocabs[vocab];
-  if(!v) {
-    v = { };
-    factor.vocabs[vocab] = v;
-  }
-  delete v[name];
-}
-    
-Factor.prototype.define_word = function(name, source, func, next) {
-  factor.vocabs[factor.in_vocab][name] = new Word(factor.in_vocab, name, source, function(next) {
-    var old = factor.cont.next;
-    factor.cont.next = function() {
-      factor.cont.next = old;
-      factor.call_next(next);
-    }
-    func();
-  });
-  factor.call_next(next);
-}
-
-Factor.prototype.make_quotation = function(source, func) {
-  return new Word("quotations", "quotation", source, function(next) {
-    var old = factor.cont.next;
-    factor.cont.next = function() {
-      factor.cont.next = old;
-      factor.call_next(next);
-    }
-    func();
-  });
-}
-
-Factor.prototype.server_eval = function(text, next) {
-   var self = this;
-   $.post("/responder/fjsc/compile", { code: text }, function(result) {
-     document.getElementById('compiled').value=result;
-     document.getElementById('code').value="";
-     var func = eval(result);
-     factor.cont.next = function() { self.display_datastack(); } 
-     func(factor);
-     if(next) 
-       factor.call_next(next);
-   });
-}
-
-Factor.prototype.display_datastack = function() {
-   var html=[];
-   html.push("<table border='1'>")
-   for(var i = 0; i < this.cont.data_stack.length; ++i) {
-      html.push("<tr><td>")
-      html.push(this.cont.data_stack[i])
-      html.push("</td></tr>")
-   }
-   html.push("</table>")
-   document.getElementById('stack').innerHTML=html.join("");
-}
-
-/* Kernel Vocabulary */
-factor.add_word("kernel","dup", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  stack[stack.length] = stack[stack.length-1];
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "drop", "primitive", function(next) {
-  factor.cont.data_stack.pop();
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "nip", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  stack[stack.length-2] = stack[stack.length-1];
-  stack.pop();
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "over", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  stack[stack.length] = stack[stack.length-2];
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "swap", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  var temp = stack[stack.length-2];
-  stack[stack.length-2] = stack[stack.length-1];
-  stack[stack.length-1] = temp;
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", ">r", "primitive", function(next) {
-  var data_stack = factor.cont.data_stack;
-  var retain_stack = factor.cont.retain_stack;
-  retain_stack.push(data_stack.pop());
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "r>", "primitive", function(next) {
-  var data_stack = factor.cont.data_stack;
-  var retain_stack = factor.cont.retain_stack;
-  data_stack.push(retain_stack.pop());
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "call", "primitive", function(next) {
-  var quot = factor.cont.data_stack.pop();
-  quot.execute(next);
-});
-
-factor.add_word("kernel", "execute", "primitive", function(next) {
-  var quot = factor.cont.data_stack.pop();
-  quot.execute(next);
-});
-
-factor.add_word("kernel", "clear", "primitive", function(next) {
-  factor.cont.data_stack = [];
-  factor.cont.retain_stack = [];
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "if", "primitive", function(next) {  
-  var stack = factor.cont.data_stack;
-  var else_quot = stack.pop();
-  var then_quot = stack.pop();
-  var condition = stack.pop();
-  if(condition) {
-    then_quot.execute(next);
-  } else {
-    else_quot.execute(next);
-  }
-});
-
-factor.add_word("kernel", "f", "primitive", function(next) {  
-  factor.cont.data_stack.push(false);
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "t", "primitive", function(next) {  
-  factor.cont.data_stack.push(true);
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "=", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  stack.push(stack.pop()==stack.pop());
-  factor.call_next(next);
-});
-
-factor.add_word("kernel", "bootstrap", "primitive", function(next) {  
-  factor.cont.data_stack.push("/responder/fjsc-resources/bootstrap.factor");
-  factor.get_word("parser", "run-file").execute(next);
-});
-
-factor.add_word("kernel", "callcc0", "primitive", function(next) {  
-  var data_stack = factor.cont.data_stack;
-  var quot = data_stack.pop();
-  var new_cont = factor.cont.clone();  
-  var old_next = factor.cont.next;
-  factor.cont.next = function() {
-      factor.cont.next = old_next;
-      factor.call_next(next);
-  }
-  new_cont.data_stack.push(factor.cont);
-  factor.cont = new_cont;
-  quot.execute(next);  
-});
-
-factor.add_word("kernel", "callcc1", "primitive", function(next) {  
-  factor.get_word("kernel", "callcc0").execute(next);
-});
-
-factor.add_word("kernel", "continue", "primitive", function(next) {  
-  var data_stack = factor.cont.data_stack;
-  var cont = data_stack.pop(); 
-  factor.cont = cont.clone();
-  factor.call_next(cont.next);
-});
-
-factor.add_word("kernel", "continue-with", "primitive", function(next) {  
-  var data_stack = factor.cont.data_stack;
-  var cont = data_stack.pop(); 
-  var data = data_stack.pop(); 
-  factor.cont = cont.clone();
-  factor.cont.data_stack.push(data);
-  factor.call_next(cont.next);
-});
-
-factor.add_word("kernel", "in", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var vocab = stack.pop();
-  var v = factor.vocabs[vocab];
-  if(!v) {
-    v = { };
-    factor.vocabs[vocab] = v;
-  }
-  factor.in_vocab = vocab;
-  factor.call_next(next);  
-});
-
-factor.add_word("kernel", "current-vocab", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  stack.push(factor.in_vocab);
-  factor.call_next(next);  
-});
-
-factor.add_word("kernel", "use", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var vocab = stack.pop();
-  var v = factor.vocabs[vocab];
-  if(!v) {
-    v = { };
-    factor.vocabs[vocab] = v;
-  }
-  factor.using_vocabs.push(vocab);
-  factor.call_next(next);  
-});
-
-factor.add_word("kernel", "using", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var vocabs = stack.pop();
-  factor.using_vocabs = [];
-  for(var i=0;i<vocabs.length;++i) {  
-    var v = factor.vocabs[vocabs[i]];
-    if(!v) {
-      v = { };
-      factor.vocabs[vocabs[i]] = v;
-    }
-  }
-  factor.using_vocabs = vocabs;
-  factor.call_next(next);  
-});
-
-factor.add_word("kernel", "current-using", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  stack.push(factor.using_vocabs);
-  factor.call_next(next);  
-});
-
-factor.add_word("kernel", "forget", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var word = stack.pop();
-  factor.remove_word(word.vocab, word.name);
-  factor.call_next(next);  
-});
-
-factor.add_word("kernel", ">function", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var word = stack.pop();
-  stack.push(function() { word.func(function() { }) });
-  factor.call_next(next);  
-});
-
-factor.add_word("kernel", "curry", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var quot = stack.pop();
-  var value = stack.pop();
-  
-  stack.push(factor.make_quotation("quotation", function(next) {
-    factor.cont.data_stack.push(value);   
-    quot.execute(factor.cont.next);
-  }));
-  factor.call_next(next);
-});
-
-/* Math vocabulary */
-factor.add_word("math", "*", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  stack.push(stack.pop() * stack.pop());
-  factor.call_next(next);
-});
-
-factor.add_word("math", "+", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  stack.push(stack.pop() + stack.pop());
-  factor.call_next(next);
-});
-
-factor.add_word("math", "-", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  var v1 = stack.pop();
-  var v2 = stack.pop();
-  stack.push(v2 - v1);
-  factor.call_next(next);
-});
-
-factor.add_word("math", "/", "primitive", function(next) {
-  var stack = factor.cont.data_stack;
-  var v1 = stack.pop();
-  var v2 = stack.pop();
-  stack.push(v2 / v1);
-  factor.call_next(next);
-});
-
-factor.add_word("prettyprint", ".", "primitive", function(next) {
-  alert(factor.cont.data_stack.pop());
-  factor.call_next(next);
-});
-
-factor.add_word("parser", "run-file", "primitive", function(next) {  
-  var stack = factor.cont.data_stack;
-  var url = stack.pop();
-  $.get(url, function(result) {
-    factor.server_eval(result, next);
-  });
-});
-
-
-factor.add_word("alien", "alien-invoke", "primitive", function(next) {  
-  var stack = factor.cont.data_stack;
-  var arg_types = stack.pop();
-  var method_name = stack.pop();
-  var library_name = stack.pop();
-  var return_values = stack.pop();
-  var obj = stack.pop();
-  var args = [ ];
-  for(var i = 0; i < arg_types.length; ++i) {
-    args[i] = stack.pop();
-  }
-  var v = obj[method_name].apply(obj, args.reverse());
-  if(return_values.length > 0)
-    stack.push(v);
-  factor.call_next(next);
-});
-
-factor.add_word("alien", "alien-property", "primitive", function(next) {  
-  var stack = factor.cont.data_stack;
-  var obj = stack.pop();
-  var property_name = stack.pop();
-  var v = obj[property_name];
-  stack.push(v);
-  factor.call_next(next);
-});
-
-factor.add_word("alien", "set-alien-property", "primitive", function(next) {  
-  var stack = factor.cont.data_stack;
-  var obj = stack.pop();
-  var property_name = stack.pop();
-  var data = stack.pop();
-  obj[property_name] = v;
-  factor.call_next(next);
-});
-
-factor.add_word("words", "vocabs", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var result = [];
-  for(v in factor.vocabs) {
-    result.push(v);
-  }
-  stack.push(result);
-  factor.call_next(next);
-});
-
-factor.add_word("words", "words", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var vocab = factor.vocabs[stack.pop()];
-  var result = [];
-  for(w in vocab) {
-    result.push(vocab[w]);
-  }
-  stack.push(result);
-  factor.call_next(next);
-});
-
-factor.add_word("words", "all-words", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var result = [];
-  for(v in factor.vocabs) {
-    for(w in factor.vocabs[v]) {
-      result.push(factor.vocabs[v][w]);
-    }
-  }
-  stack.push(result);
-  factor.call_next(next);
-});
-
-/* Sequences vocabulary */
-factor.add_word("sequences", "nth", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  var index = stack.pop();
-  stack.push(seq[index]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "first", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  stack.push(seq[0]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "second", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  stack.push(seq[1]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "third", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  stack.push(seq[2]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "fourth", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  stack.push(seq[0]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "first2", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  stack.push(seq[0],seq[1]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "first3", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  stack.push(seq[0],seq[1],seq[2]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "first4", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var seq = stack.pop();
-  stack.push(seq[0],seq[1],seq[2],seq[3]);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "each", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var quot = stack.pop();
-  var seq = stack.pop();
-  for(var i=0;i<seq.length;++i) {  
-    stack.push(seq[i]);
-    quot.execute();
-  }
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "map", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var quot = stack.pop();
-  var seq = stack.pop();
-  var result = [ ];
-  for(var i=0;i<seq.length;++i) {  
-    stack.push(seq[i]);
-    quot.execute();
-    result[i]=stack.pop();
-  }
-  stack.push(result);
-  factor.call_next(next);
-});
-
-factor.add_word("sequences", "reduce", "primitive", function(next) {   
-  var stack = factor.cont.data_stack;
-  var quot = stack.pop();
-  var prev = stack.pop();
-  var seq = stack.pop();
-  for(var i=0;i<seq.length;++i) {  
-    stack.push(prev);
-    stack.push(seq[i]);
-    quot.execute();
-    prev=stack.pop();
-  }
-  stack.push(prev);
-  factor.call_next(next);
-});
-
-/* browser-dom vocab */
-factor.add_word("browser-dom", "window", "primitive", function(next) {  
-  factor.cont.data_stack.push(window);
-  factor.call_next(next);
-});
-
-factor.add_word("browser-dom", "document", "primitive", function(next) {  
-  factor.cont.data_stack.push(document);
-  factor.call_next(next);
-});
-
-factor.add_word("browser-dom", "load-script", "primitive", function(next) {  
-  var stack = factor.cont.data_stack;
-  $("head/script#jsonrequest").remove();
-  var script = document.createElement("script");
-  script.id = "jsonrequest";    
-  script.type = "text/javascript";
-  script.src = stack.pop();
-  $("head").append(script);
-  factor.call_next(next); 
-});
-
-var handle_json = false;
-factor.add_word("browser-dom", "json-request", "primitive", function(next) {  
-  var stack = factor.cont.data_stack;
-  handle_json = function(data) { 
-    factor.cont.data_stack.push(data);
-    factor.call_next(next);
-  }
-  factor.get_word("browser-dom", "load-script").execute();
-});
-
-
-/* Run initial factor code */
-$(document).ready(function() {
-  $.get("/responder/fjsc-resources/bootstrap.factor", function(result) {
-    factor.server_eval(result, function() { });
-  });
-});
diff --git a/libs/fjsc/resources/jquery.js b/libs/fjsc/resources/jquery.js
deleted file mode 100644 (file)
index 2531342..0000000
+++ /dev/null
@@ -1 +0,0 @@
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('l(1T 1z.6=="Q"){1z.Q=1z.Q;u 6=q(a,c){l(a&&1T a=="q"&&6.C.1W)v 6(17).1W(a);a=a||6.1o||17;l(a.3E)v 6(6.1X(a,[]));l(c&&c.3E)v 6(c).1V(a);l(1z==7)v 1h 6(a,c);l(a.O==1C){u m=/^[^<]*(<.+>)[^>]*$/.3d(a);l(m)a=6.3D([m[1]])}7.1n(a.O==2z||a.D&&!a.1R&&a[0]!=Q&&a[0].1R?6.1X(a,[]):6.1V(a,c));u C=19[19.D-1];l(C&&1T C=="q")7.W(C);v 7};l(1T $!="Q")6.44$=$;u $=6;6.C=6.8b={3E:"1.0.3",5J:q(){v 7.D},1n:q(23){l(23&&23.O==2z){7.D=0;[].1k.16(7,23);v 7}G v 23==Q?6.1X(7,[]):7[23]},W:q(C,1g){v 6.W(7,C,1g)},8g:q(15){u 2j=-1;7.W(q(i){l(7==15)2j=i});v 2j},1t:q(1L,Y,B){v 1L.O!=1C||Y!=Q?7.W(q(){l(Y==Q)I(u E 1r 1L)6.1t(B?7.1a:7,E,1L[E]);G 6.1t(B?7.1a:7,1L,Y)}):6[B||"1t"](7[0],1L)},1f:q(1L,Y){v 7.1t(1L,Y,"26")},2B:q(e){e=e||7;u t="";I(u j=0;j<e.D;j++){u r=e[j].2f;I(u i=0;i<r.D;i++)l(r[i].1R!=8)t+=r[i].1R!=1?r[i].4Z:6.C.2B([r[i]])}v t},1Y:q(){u a=6.3D(19);v 7.W(q(){u b=a[0].3f(T);7.1i.2Y(b,7);24(b.2a)b=b.2a;b.4e(7)})},5g:q(){v 7.2T(19,T,1,q(a){7.4e(a)})},5h:q(){v 7.2T(19,T,-1,q(a){7.2Y(a,7.2a)})},5i:q(){v 7.2T(19,U,1,q(a){7.1i.2Y(a,7)})},5j:q(){v 7.2T(19,U,-1,q(a){7.1i.2Y(a,7.8j)})},4q:q(){v 7.1n(7.33.8k())},1V:q(t){v 7.2n(6.2r(7,q(a){v 6.1V(t,a)}),19)},4f:q(4D){v 7.2n(6.2r(7,q(a){v a.3f(4D!=Q?4D:T)}),19)},1c:q(t){v 7.2n(t.O==2z&&6.2r(7,q(a){I(u i=0;i<t.D;i++)l(6.1c(t[i],[a]).r.D)v a;v U})||t.O==8l&&(t?7.1n():[])||1T t=="q"&&6.2O(7,t)||6.1c(t,7).r,19)},2t:q(t){v 7.2n(t.O==1C?6.1c(t,7,U).r:6.2O(7,q(a){v a!=t}),19)},2g:q(t){v 7.2n(6.1X(7,t.O==1C?6.1V(t):t.O==2z?t:[t]),19)},4E:q(2u){v 2u?6.1c(2u,7).r.D>0:U},2T:q(1g,22,2X,C){u 4f=7.5J()>1;u a=6.3D(1g);v 7.W(q(){u 15=7;l(22&&7.2p.2b()=="8m"&&a[0].2p.2b()!="62"){u 29=7.4S("29");l(!29.D){15=17.5N("29");7.4e(15)}G 15=29[0]}I(u i=(2X<0?a.D-1:0);i!=(2X<0?2X:a.D);i+=2X){C.16(15,[4f?a[i].3f(T):a[i]])}})},2n:q(a,1g){u C=1g&&1g[1g.D-1];u 2d=1g&&1g[1g.D-2];l(C&&C.O!=1v)C=M;l(2d&&2d.O!=1v)2d=M;l(!C){l(!7.33)7.33=[];7.33.1k(7.1n());7.1n(a)}G{u 1Z=7.1n();7.1n(a);l(2d&&a.D||!2d)7.W(2d||C).1n(1Z);G 7.1n(1Z).W(C)}v 7}};6.1y=6.C.1y=q(15,E){l(19.D>1&&(E===M||E==Q))v 15;l(!E){E=15;15=7}I(u i 1r E)15[i]=E[i];v 15};6.1y({5C:q(){6.65=T;6.W(6.2e.5r,q(i,n){6.C[i]=q(a){u L=6.2r(7,n);l(a&&a.O==1C)L=6.1c(a,L).r;v 7.2n(L,19)}});6.W(6.2e.2o,q(i,n){6.C[i]=q(){u a=19;v 7.W(q(){I(u j=0;j<a.D;j++)6(a[j])[n](7)})}});6.W(6.2e.W,q(i,n){6.C[i]=q(){v 7.W(n,19)}});6.W(6.2e.1c,q(i,n){6.C[n]=q(23,C){v 7.1c(":"+n+"("+23+")",C)}});6.W(6.2e.1t,q(i,n){n=n||i;6.C[i]=q(h){v h==Q?7.D?7[0][n]:M:7.1t(n,h)}});6.W(6.2e.1f,q(i,n){6.C[n]=q(h){v h==Q?(7.D?6.1f(7[0],n):M):7.1f(n,h)}})},W:q(15,C,1g){l(15.D==Q)I(u i 1r 15)C.16(15[i],1g||[i,15[i]]);G I(u i=0;i<15.D;i++)l(C.16(15[i],1g||[i,15[i]])===U)45;v 15},1j:{2g:q(o,c){l(6.1j.3t(o,c))v;o.1j+=(o.1j?" ":"")+c},25:q(o,c){l(!c){o.1j=""}G{u 2L=o.1j.3b(" ");I(u i=0;i<2L.D;i++){l(2L[i]==c){2L.67(i,1);45}}o.1j=2L.5Z(\' \')}},3t:q(e,a){l(e.1j!=Q)e=e.1j;v 1h 43("(^|\\\\s)"+a+"(\\\\s|$)").28(e)}},4A:q(e,o,f){I(u i 1r o){e.1a["1Z"+i]=e.1a[i];e.1a[i]=o[i]}f.16(e,[]);I(u i 1r o)e.1a[i]=e.1a["1Z"+i]},1f:q(e,p){l(p=="1G"||p=="2c"){u 1Z={},3K,3F,d=["68","6O","69","7c"];I(u i 1r d){1Z["6b"+d[i]]=0;1Z["6c"+d[i]+"6e"]=0}6.4A(e,1Z,q(){l(6.1f(e,"1u")!="20"){3K=e.6f;3F=e.6g}G{e=6(e.3f(T)).1V(":3W").5u("2J").4q().1f({3U:"1S",2H:"6i",1u:"2F",6j:"0",5l:"0"}).4H(e.1i)[0];u 31=6.1f(e.1i,"2H");l(31==""||31=="3R")e.1i.1a.2H="6k";3K=e.6l;3F=e.6m;l(31==""||31=="3R")e.1i.1a.2H="3R";e.1i.3s(e)}});v p=="1G"?3K:3F}v 6.26(e,p)},26:q(F,E,4I){u L;l(E==\'1m\'&&6.11.1p)v 6.1t(F.1a,\'1m\');l(E=="3p"||E=="2y")E=6.11.1p?"37":"2y";l(!4I&&F.1a[E]){L=F.1a[E]}G l(F.34){u 5S=E.1B(/\\-(\\w)/g,q(m,c){v c.2b()});L=F.34[E]||F.34[5S]}G l(17.3g&&17.3g.4u){l(E=="2y"||E=="37")E="3p";E=E.1B(/([A-Z])/g,"-$1").4d();u 1l=17.3g.4u(F,M);l(1l)L=1l.5P(E);G l(E==\'1u\')L=\'20\';G 6.4A(F,{1u:\'2F\'},q(){L=17.3g.4u(7,M).5P(E)})}v L},3D:q(a){u r=[];I(u i=0;i<a.D;i++){u 1M=a[i];l(1M.O==1C){u s=6.2K(1M),21=17.5N("21"),1Y=[0,"",""];l(!s.1b("<6v"))1Y=[1,"<3c>","</3c>"];G l(!s.1b("<6w")||!s.1b("<29"))1Y=[1,"<22>","</22>"];G l(!s.1b("<4t"))1Y=[2,"<22>","</22>"];G l(!s.1b("<6x")||!s.1b("<6z"))1Y=[3,"<22><29><4t>","</4t></29></22>"];21.2V=1Y[1]+s+1Y[2];24(1Y[0]--)21=21.2a;I(u j=0;j<21.2f.D;j++)r.1k(21.2f[j])}G l(1M.D!=Q&&!1M.1R)I(u n=0;n<1M.D;n++)r.1k(1M[n]);G r.1k(1M.1R?1M:17.6A(1M.6C()))}v r},2u:{"":"m[2]== \'*\'||a.2p.2b()==m[2].2b()","#":"a.3a(\'3H\')&&a.3a(\'3H\')==m[2]",":":{5o:"i<m[3]-0",5X:"i>m[3]-0",5L:"m[3]-0==i",5n:"m[3]-0==i",2h:"i==0",1N:"i==r.D-1",52:"i%2==0",53:"i%2","5L-3x":"6.1x(a,m[3]).1l","2h-3x":"6.1x(a,0).1l","1N-3x":"6.1x(a,0).1N","6D-3x":"6.1x(a).D==1",5s:"a.2f.D",5B:"!a.2f.D",5p:"6.C.2B.16([a]).1b(m[3])>=0",6E:"a.B!=\'1S\'&&6.1f(a,\'1u\')!=\'20\'&&6.1f(a,\'3U\')!=\'1S\'",1S:"a.B==\'1S\'||6.1f(a,\'1u\')==\'20\'||6.1f(a,\'3U\')==\'1S\'",6F:"!a.2P",2P:"a.2P",2J:"a.2J",3V:"a.3V || 6.1t(a, \'3V\')",2B:"a.B==\'2B\'",3W:"a.B==\'3W\'",5y:"a.B==\'5y\'",3Q:"a.B==\'3Q\'",5v:"a.B==\'5v\'",4x:"a.B==\'4x\'",5w:"a.B==\'5w\'",4w:"a.B==\'4w\'",4s:"a.B==\'4s\'",5z:"a.2p.4d().4T(/5z|3c|6L|4s/)"},".":"6.1j.3t(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z && !z.1b(m[4])","$=":"z && z.32(z.D - m[4].D,m[4].D)==m[4]","*=":"z && z.1b(m[4])>=0","":"z"},"[":"6.1V(m[2],a).D"},3B:["\\\\.\\\\.|/\\\\.\\\\.","a.1i",">|/","6.1x(a.2a)","\\\\+","6.1x(a).3z","~",q(a){u r=[];u s=6.1x(a);l(s.n>0)I(u i=s.n;i<s.D;i++)r.1k(s[i]);v r}],1V:q(t,1o){l(1o&&1o.1R==Q)1o=M;1o=1o||6.1o||17;l(t.O!=1C)v[t];l(!t.1b("//")){1o=1o.4Q;t=t.32(2,t.D)}G l(!t.1b("/")){1o=1o.4Q;t=t.32(1,t.D);l(t.1b("/")>=1)t=t.32(t.1b("/"),t.D)}u L=[1o];u 1K=[];u 1N=M;24(t.D>0&&1N!=t){u r=[];1N=t;t=6.2K(t).1B(/^\\/\\//i,"");u 36=U;I(u i=0;i<6.3B.D;i+=2){l(36)51;u 2v=1h 43("^("+6.3B[i]+")");u m=2v.3d(t);l(m){r=L=6.2r(L,6.3B[i+1]);t=6.2K(t.1B(2v,""));36=T}}l(!36){l(!t.1b(",")||!t.1b("|")){l(L[0]==1o)L.4h();1K=6.1X(1K,L);r=L=[1o];t=" "+t.32(1,t.D)}G{u 3Z=/^([#.]?)([a-4Y-9\\\\*44-]*)/i;u m=3Z.3d(t);l(m[1]=="#"){u 4l=17.5V(m[2]);r=L=4l?[4l]:[];t=t.1B(3Z,"")}G{l(!m[2]||m[1]==".")m[2]="*";I(u i=0;i<L.D;i++)r=6.1X(r,m[2]=="*"?6.40(L[i]):L[i].4S(m[2]))}}}l(t){u 1D=6.1c(t,r);L=r=1D.r;t=6.2K(1D.t)}}l(L&&L[0]==1o)L.4h();1K=6.1X(1K,L);v 1K},40:q(o,r){r=r||[];u s=o.2f;I(u i=0;i<s.D;i++)l(s[i].1R==1){r.1k(s[i]);6.40(s[i],r)}v r},1t:q(F,1d,Y){u 2m={"I":"7v","6P":"1j","3p":6.11.1p?"37":"2y",2y:6.11.1p?"37":"2y",2V:"2V",1j:"1j",Y:"Y",2P:"2P",2J:"2J",6R:"6S"};l(1d=="1m"&&6.11.1p&&Y!=Q){F[\'6U\']=1;l(Y==1)v F["1c"]=F["1c"].1B(/3k\\([^\\)]*\\)/5c,"");G v F["1c"]=F["1c"].1B(/3k\\([^\\)]*\\)/5c,"")+"3k(1m="+Y*4U+")"}G l(1d=="1m"&&6.11.1p){v F["1c"]?4c(F["1c"].4T(/3k\\(1m=(.*)\\)/)[1])/4U:1}l(1d=="1m"&&6.11.2I&&Y==1)Y=0.6W;l(2m[1d]){l(Y!=Q)F[2m[1d]]=Y;v F[2m[1d]]}G l(Y==Q&&6.11.1p&&F.2p&&F.2p.2b()==\'6X\'&&(1d==\'7f\'||1d==\'7e\')){v F.70(1d).4Z}G l(F.3a!=Q&&F.7b){l(Y!=Q)F.72(1d,Y);v F.3a(1d)}G{1d=1d.1B(/-([a-z])/73,q(z,b){v b.2b()});l(Y!=Q)F[1d]=Y;v F[1d]}},4X:["\\\\[ *(@)S *([!*$^=]*) *(\'?\\"?)(.*?)\\\\4 *\\\\]","(\\\\[)\\s*(.*?)\\s*\\\\]","(:)S\\\\(\\"?\'?([^\\\\)]*?)\\"?\'?\\\\)","([:.#]*)S"],1c:q(t,r,2t){u g=2t!==U?6.2O:q(a,f){v 6.2O(a,f,T)};24(t&&/^[a-z[({<*:.#]/i.28(t)){u p=6.4X;I(u i=0;i<p.D;i++){u 2v=1h 43("^"+p[i].1B("S","([a-z*44-][a-4Y-76-]*)"),"i");u m=2v.3d(t);l(m){l(!i)m=["",m[1],m[3],m[2],m[5]];t=t.1B(2v,"");45}}l(m[1]==":"&&m[2]=="2t")r=6.1c(m[3],r,U).r;G{u f=6.2u[m[1]];l(f.O!=1C)f=6.2u[m[1]][m[2]];3A("f = q(a,i){"+(m[1]=="@"?"z=6.1t(a,m[3]);":"")+"v "+f+"}");r=g(r,f)}}v{r:r,t:t}},2K:q(t){v t.1B(/^\\s+|\\s+$/g,"")},3L:q(F){u 47=[];u 1l=F.1i;24(1l&&1l!=17){47.1k(1l);1l=1l.1i}v 47},1x:q(F,2j,2t){u 14=[];l(F){u 2k=F.1i.2f;I(u i=0;i<2k.D;i++){l(2t===T&&2k[i]==F)51;l(2k[i].1R==1)14.1k(2k[i]);l(2k[i]==F)14.n=14.D-1}}v 6.1y(14,{1N:14.n==14.D-1,1l:2j=="52"&&14.n%2==0||2j=="53"&&14.n%2||14[2j]==F,4j:14[14.n-1],3z:14[14.n+1]})},1X:q(2h,35){u 1J=[];I(u k=0;k<2h.D;k++)1J[k]=2h[k];I(u i=0;i<35.D;i++){u 48=T;I(u j=0;j<2h.D;j++)l(35[i]==2h[j])48=U;l(48)1J.1k(35[i])}v 1J},2O:q(14,C,4a){l(C.O==1C)C=1h 1v("a","i","v "+C);u 1J=[];I(u i=0;i<14.D;i++)l(!4a&&C(14[i],i)||4a&&!C(14[i],i))1J.1k(14[i]);v 1J},2r:q(14,C){l(C.O==1C)C=1h 1v("a","v "+C);u 1J=[];I(u i=0;i<14.D;i++){u 1D=C(14[i],i);l(1D!==M&&1D!=Q){l(1D.O!=2z)1D=[1D];1J=6.1X(1J,1D)}}v 1J},J:{2g:q(P,B,1H){l(6.11.1p&&P.42!=Q)P=1z;l(!1H.2q)1H.2q=7.2q++;l(!P.1E)P.1E={};u 2W=P.1E[B];l(!2W){2W=P.1E[B]={};l(P["2N"+B])2W[0]=P["2N"+B]}2W[1H.2q]=1H;P["2N"+B]=7.58;l(!7.1e[B])7.1e[B]=[];7.1e[B].1k(P)},2q:1,1e:{},25:q(P,B,1H){l(P.1E)l(B&&P.1E[B])l(1H)57 P.1E[B][1H.2q];G I(u i 1r P.1E[B])57 P.1E[B][i];G I(u j 1r P.1E)7.25(P,j)},1P:q(B,K,P){K=K||[];l(!P){u g=7.1e[B];l(g)I(u i=0;i<g.D;i++)7.1P(B,K,g[i])}G l(P["2N"+B]){K.59(7.2m({B:B,2G:P}));P["2N"+B].16(P,K)}},58:q(J){l(1T 6=="Q")v U;J=J||6.J.2m(1z.J);l(!J)v U;u 3m=T;u c=7.1E[J.B];u 1g=[].7h.3O(19,1);1g.59(J);I(u j 1r c){l(c[j].16(7,1g)===U){J.4p();J.5a();3m=U}}v 3m},2m:q(J){l(6.11.1p){J=1z.J;J.2G=J.7i}G l(6.11.2M&&J.2G.1R==3){J=6.1y({},J);J.2G=J.2G.1i}J.4p=q(){7.3m=U};J.5a=q(){7.7l=T};v J}}});1h q(){u b=5I.5K.4d();6.11={2M:/5e/.28(b),30:/30/.28(b),1p:/1p/.28(b)&&!/30/.28(b),2I:/2I/.28(b)&&!/(7m|5e)/.28(b)};6.7n=!6.11.1p||17.7o=="7p"};6.2e={2o:{4H:"5g",7q:"5h",2Y:"5i",7r:"5j"},1f:"2c,1G,7s,5l,2H,3p,3h,7t,7u".3b(","),1c:["5n","5o","5X","5p"],1t:{1D:"Y",38:"2V",3H:M,7x:M,1d:M,7z:M,3w:M,7A:M},5r:{5s:"a.1i",7B:6.3L,3L:6.3L,3z:"6.1x(a).3z",4j:"6.1x(a).4j",2k:"6.1x(a, M, T)",7C:"6.1x(a.2a)"},W:{5u:q(1L){7.7E(1L)},1A:q(){7.1a.1u=7.2A?7.2A:"";l(6.1f(7,"1u")=="20")7.1a.1u="2F"},1s:q(){7.2A=7.2A||6.1f(7,"1u");l(7.2A=="20")7.2A="2F";7.1a.1u="20"},4o:q(){6(7)[6(7).4E(":1S")?"1A":"1s"].16(6(7),19)},7F:q(c){6.1j.2g(7,c)},7G:q(c){6.1j.25(7,c)},7H:q(c){6.1j[6.1j.3t(7,c)?"25":"2g"](7,c)},25:q(a){l(!a||6.1c(a,[7]).r)7.1i.3s(7)},5B:q(){24(7.2a)7.3s(7.2a)},2Z:q(B,C){l(C.O==1C)C=1h 1v("e",(!C.1b(".")?"6(7)":"v ")+C);6.J.2g(7,B,C)},4C:q(B,C){6.J.25(7,B,C)},1P:q(B,K){6.J.1P(B,K,7)}}};6.5C();6.C.1y({5E:6.C.4o,4o:q(a,b){v a&&b&&a.O==1v&&b.O==1v?7.5M(q(e){7.1N=7.1N==a?b:a;e.4p();v 7.1N.16(7,[e])||U}):7.5E.16(7,19)},7K:q(f,g){q 4r(e){u p=(e.B=="3C"?e.7M:e.7N)||e.7O;24(p&&p!=7)3u{p=p.1i}3o(e){p=7};l(p==7)v U;v(e.B=="3C"?f:g).16(7,[e])}v 7.3C(4r).5Q(4r)},1W:q(f){l(6.3y)f.16(17);G{6.2C.1k(f)}v 7}});6.1y({3y:U,2C:[],1W:q(){l(!6.3y){6.3y=T;l(6.2C){I(u i=0;i<6.2C.D;i++)6.2C[i].16(17);6.2C=M}l(6.11.2I||6.11.30)17.7P("5T",6.1W,U)}}});1h q(){u e=("7R,7S,2S,7T,7U,4z,5M,7V,"+"7X,7Y,81,3C,5Q,83,4w,3c,"+"4x,86,87,88,2l").3b(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v f?7.2Z(o,f):7.1P(o)};6.C["89"+o]=q(f){v 7.4C(o,f)};6.C["8a"+o]=q(f){u P=6(7);u 1H=q(){P.4C(o,1H);P=M;f.16(7,19)};v 7.2Z(o,1H)}};l(6.11.2I||6.11.30){17.8c("5T",6.1W,U)}G l(6.11.1p){17.8d("<8e"+"8f 3H=5W 8n=T "+"3w=//:><\\/27>");u 27=17.5V("5W");27.2w=q(){l(7.3n!="1I")v;7.1i.3s(7);6.1W()};27=M}G l(6.11.2M){6.3N=42(q(){l(17.3n=="63"||17.3n=="1I"){56(6.3N);6.3N=M;6.1W()}},10)}6.J.2g(1z,"2S",6.1W)};l(6.11.1p)6(1z).4z(q(){u J=6.J,1e=J.1e;I(u B 1r 1e){u 3P=1e[B],i=3P.D;l(i>0)6a l(B!=\'4z\')J.25(3P[i-1],B);24(--i)}});6.C.1y({60:6.C.1A,1A:q(12,H){v 12?7.1U({1G:"1A",2c:"1A",1m:"1A"},12,H):7.60()},5U:6.C.1s,1s:q(12,H){v 12?7.1U({1G:"1s",2c:"1s",1m:"1s"},12,H):7.5U()},6n:q(12,H){v 7.1U({1G:"1A"},12,H)},6o:q(12,H){v 7.1U({1G:"1s"},12,H)},6p:q(12,H){v 7.W(q(){u 4J=6(7).4E(":1S")?"1A":"1s";6(7).1U({1G:4J},12,H)})},6r:q(12,H){v 7.1U({1m:"1A"},12,H)},6s:q(12,H){v 7.1U({1m:"1s"},12,H)},6t:q(12,2o,H){v 7.1U({1m:2o},12,H)},1U:q(E,12,H){v 7.1w(q(){7.2U=6.1y({},E);I(u p 1r E){u e=1h 6.2R(7,6.12(12,H),p);l(E[p].O==4O)e.3e(e.1l(),E[p]);G e[E[p]](E)}})},1w:q(B,C){l(!C){C=B;B="2R"}v 7.W(q(){l(!7.1w)7.1w={};l(!7.1w[B])7.1w[B]=[];7.1w[B].1k(C);l(7.1w[B].D==1)C.16(7)})}});6.1y({5f:q(e,p){l(e.5F)v;l(p=="1G"&&e.4L!=3l(6.26(e,p)))v;l(p=="2c"&&e.4M!=3l(6.26(e,p)))v;u a=e.1a[p];u o=6.26(e,p,1);l(p=="1G"&&e.4L!=o||p=="2c"&&e.4M!=o)v;e.1a[p]=e.34?"":"5H";u n=6.26(e,p,1);l(o!=n&&n!="5H"){e.1a[p]=a;e.5F=T}},12:q(s,o){o=o||{};l(o.O==1v)o={1I:o};u 5D={6G:6H,6J:4K};o.2E=(s&&s.O==4O?s:5D[s])||5k;o.3J=o.1I;o.1I=q(){6.4R(7,"2R");l(o.3J&&o.3J.O==1v)o.3J.16(7)};v o},1w:{},4R:q(F,B){B=B||"2R";l(F.1w&&F.1w[B]){F.1w[B].4h();u f=F.1w[B][0];l(f)f.16(F)}},2R:q(F,2x,E){u z=7;z.o={2E:2x.2E||5k,1I:2x.1I,2s:2x.2s};z.V=F;u y=z.V.1a;z.a=q(){l(2x.2s)2x.2s.16(F,[z.2i]);l(E=="1m")6.1t(y,"1m",z.2i);G l(3l(z.2i))y[E]=3l(z.2i)+"5d";y.1u="2F"};z.61=q(){v 4c(6.1f(z.V,E))};z.1l=q(){u r=4c(6.26(z.V,E));v r&&r>-6Z?r:z.61()};z.3e=q(41,2o){z.3M=(1h 54()).55();z.2i=41;z.a();z.49=42(q(){z.2s(41,2o)},13)};z.1A=q(){l(!z.V.1Q)z.V.1Q={};z.V.1Q[E]=7.1l();z.3e(0,z.V.1Q[E]);l(E!="1m")y[E]="77"};z.1s=q(){l(!z.V.1Q)z.V.1Q={};z.V.1Q[E]=7.1l();z.o.1s=T;z.3e(z.V.1Q[E],0)};l(!z.V.4b)z.V.4b=6.1f(z.V,"3h");y.3h="1S";z.2s=q(4B,4g){u t=(1h 54()).55();l(t>z.o.2E+z.3M){56(z.49);z.49=M;z.2i=4g;z.a();z.V.2U[E]=T;u 1K=T;I(u i 1r z.V.2U)l(z.V.2U[i]!==T)1K=U;l(1K){y.3h=z.V.4b;l(z.o.1s)y.1u=\'20\';l(z.o.1s){I(u p 1r z.V.2U){l(p=="1m")6.1t(y,p,z.V.1Q[p]);G y[p]=z.V.1Q[p]+"5d";l(p==\'1G\'||p==\'2c\')6.5f(z.V,p)}}}l(1K&&z.o.1I&&z.o.1I.O==1v)z.o.1I.16(z.V)}G{u p=(t-7.3M)/z.o.2E;z.2i=((-5q.7w(p*5q.7y)/2)+0.5)*(4g-4B)+4B;z.a()}}}});6.C.1y({7D:q(N,1O,H){7.2S(N,1O,H,1)},2S:q(N,1O,H,1F){l(N.O==1v)v 7.2Z("2S",N);H=H||q(){};u B="3T";l(1O){l(1O.O==1v){H=1O;1O=M}G{1O=6.2Q(1O);B="4W"}}u 4m=7;6.3I(B,N,1O,q(3v,18){l(18=="2D"||!1F&&18=="5m"){4m.38(3v.3G).3X().W(H,[3v.3G,18])}G H.16(4m,[3v.3G,18])},1F);v 7},7J:q(){v 6.2Q(7)},3X:q(){v 7.1V(\'27\').W(q(){l(7.3w)6.5Y(7.3w,q(){});G 3A.3O(1z,7.2B||7.7L||7.2V||"")}).4q()}});l(6.11.1p&&1T 3i=="Q")3i=q(){v 1h 7Q(5I.5K.1b("7W 5")>=0?"82.5R":"84.5R")};1h q(){u e="5O,5G,5A,5x,5t".3b(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v 7.2Z(o,f)}}};6.1y({1n:q(N,K,H,B,1F){l(K&&K.O==1v){B=H;H=K;K=M}l(K)N+=((N.1b("?")>-1)?"&":"?")+6.2Q(K);6.3I("3T",N,M,q(r,18){l(H)H(6.3r(r,B),18)},1F)},8h:q(N,K,H,B){6.1n(N,K,H,B,1)},5Y:q(N,H){l(H)6.1n(N,M,H,"27");G{6.1n(N,M,M,"27")}},64:q(N,K,H){l(H)6.1n(N,K,H,"3S");G{6.1n(N,K,"3S")}},8o:q(N,K,H,B){6.3I("4W",N,6.2Q(K),q(r,18){l(H)H(6.3r(r,B),18)})},1q:0,6h:q(1q){6.1q=1q},39:{},3I:q(B,N,K,L,1F){u 1e=T;u 1q=6.1q;l(!N){L=B.1I;u 2D=B.2D;u 2l=B.2l;u 4k=B.4k;u 1e=1T B.1e=="6q"?B.1e:T;u 1q=1T B.1q=="6u"?B.1q:6.1q;1F=B.1F||U;K=B.K;N=B.N;B=B.B}l(1e&&!6.4v++)6.J.1P("5O");u 4y=U;u R=1h 3i();R.6B(B||"3T",N,T);l(K)R.3j("6I-6K","6M/x-6N-6Q-6T");l(1F)R.3j("6V-3Y-6Y",6.39[N]||"71, 74 75 78 46:46:46 79");R.3j("X-7a-7d","3i");l(R.7g)R.3j("7j","7k");u 2w=q(4F){l(R&&(R.3n==4||4F=="1q")){4y=T;u 18=6.4G(R)&&4F!="1q"?1F&&6.4N(R,N)?"5m":"2D":"2l";l(18!="2l"){u 3q;3u{3q=R.4i("4P-3Y")}3o(e){}l(1F&&3q)6.39[N]=3q;l(2D)2D(6.3r(R,4k),18);l(1e)6.J.1P("5t")}G{l(2l)2l(R,18);l(1e)6.J.1P("5x")}l(1e)6.J.1P("5A");l(1e&&!--6.4v)6.J.1P("5G");l(L)L(R,18);R.2w=q(){};R=M}};R.2w=2w;l(1q>0)7Z(q(){l(R){R.85();l(!4y)2w("1q");R=M}},1q);R.8i(K)},4v:0,4G:q(r){3u{v!r.18&&66.6d=="3Q:"||(r.18>=4K&&r.18<6y)||r.18==5b||6.11.2M&&r.18==Q}3o(e){}v U},4N:q(R,N){3u{u 4V=R.4i("4P-3Y");v R.18==5b||4V==6.39[N]||6.11.2M&&R.18==Q}3o(e){}v U},3r:q(r,B){u 4n=r.4i("7I-B");u K=!B&&4n&&4n.1b("R")>=0;K=B=="R"||K?r.80:r.3G;l(B=="27")3A.3O(1z,K);l(B=="3S")3A("K = "+K);l(B=="38")$("<21>").38(K).3X();v K},2Q:q(a){u s=[];l(a.O==2z||a.3E){I(u i=0;i<a.D;i++)s.1k(a[i].1d+"="+50(a[i].Y))}G{I(u j 1r a)s.1k(j+"="+50(a[j]))}v s.5Z("&")}})}',62,521,'||||||jQuery|this||||||||||||||if|||||function||||var|return||||||type|fn|length|prop|elem|else|callback|for|event|data|ret|null|url|constructor|element|undefined|xml||true|false|el|each||value|||browser|speed||elems|obj|apply|document|status|arguments|style|indexOf|filter|name|global|css|args|new|parentNode|className|push|cur|opacity|get|context|msie|timeout|in|hide|attr|display|Function|queue|sibling|extend|window|show|replace|String|val|events|ifModified|height|handler|complete|result|done|key|arg|last|params|trigger|orig|nodeType|hidden|typeof|animate|find|ready|merge|wrap|old|none|div|table|num|while|remove|curCSS|script|test|tbody|firstChild|toUpperCase|width|fn2|macros|childNodes|add|first|now|pos|siblings|error|fix|pushStack|to|nodeName|guid|map|step|not|expr|re|onreadystatechange|options|cssFloat|Array|oldblock|text|readyList|success|duration|block|target|position|mozilla|checked|trim|classes|safari|on|grep|disabled|param|fx|load|domManip|curAnim|innerHTML|handlers|dir|insertBefore|bind|opera|parPos|substr|stack|currentStyle|second|foundToken|styleFloat|html|lastModified|getAttribute|split|select|exec|custom|cloneNode|defaultView|overflow|XMLHttpRequest|setRequestHeader|alpha|parseInt|returnValue|readyState|catch|float|modRes|httpData|removeChild|has|try|res|src|child|isReady|next|eval|token|mouseover|clean|jquery|oWidth|responseText|id|ajax|oldComplete|oHeight|parents|startTime|safariTimer|call|els|file|static|json|GET|visibility|selected|radio|evalScripts|Modified|re2|getAll|from|setInterval|RegExp|_|break|00|matched|noCollision|timer|inv|oldOverflow|parseFloat|toLowerCase|appendChild|clone|lastNum|shift|getResponseHeader|prev|dataType|oid|self|ct|toggle|preventDefault|end|handleHover|button|tr|getComputedStyle|active|reset|submit|requestDone|unload|swap|firstNum|unbind|deep|is|istimeout|httpSuccess|appendTo|force|state|200|scrollHeight|scrollWidth|httpNotModified|Number|Last|documentElement|dequeue|getElementsByTagName|match|100|xmlRes|POST|parse|z0|nodeValue|encodeURIComponent|continue|even|odd|Date|getTime|clearInterval|delete|handle|unshift|stopPropagation|304|gi|px|webkit|setAuto|append|prepend|before|after|400|left|notmodified|eq|lt|contains|Math|axis|parent|ajaxSuccess|removeAttr|password|image|ajaxError|checkbox|input|ajaxComplete|empty|init|ss|_toggle|notAuto|ajaxStop|auto|navigator|size|userAgent|nth|click|createElement|ajaxStart|getPropertyValue|mouseout|XMLHTTP|newProp|DOMContentLoaded|_hide|getElementById|__ie_init|gt|getScript|join|_show|max|THEAD|loaded|getJSON|initDone|location|splice|Top|Right|do|padding|border|protocol|Width|offsetHeight|offsetWidth|ajaxTimeout|absolute|right|relative|clientHeight|clientWidth|slideDown|slideUp|slideToggle|boolean|fadeIn|fadeOut|fadeTo|number|opt|thead|td|300|th|createTextNode|open|toString|only|visible|enabled|slow|600|Content|fast|Type|textarea|application|www|Bottom|class|form|readonly|readOnly|urlencoded|zoom|If|9999|FORM|Since|10000|getAttributeNode|Thu|setAttribute|ig|01|Jan|9_|1px|1970|GMT|Requested|tagName|Left|With|method|action|overrideMimeType|slice|srcElement|Connection|close|cancelBubble|compatible|boxModel|compatMode|CSS1Compat|prependTo|insertAfter|top|color|background|htmlFor|cos|title|PI|href|rel|ancestors|children|loadIfModified|removeAttribute|addClass|removeClass|toggleClass|content|serialize|hover|textContent|fromElement|toElement|relatedTarget|removeEventListener|ActiveXObject|blur|focus|resize|scroll|dblclick|MSIE|mousedown|mouseup|setTimeout|responseXML|mousemove|Microsoft|change|Msxml2|abort|keydown|keypress|keyup|un|one|prototype|addEventListener|write|scr|ipt|index|getIfModified|send|nextSibling|pop|Boolean|TABLE|defer|post'.split('|'),0,{}))
diff --git a/libs/fjsc/tests.factor b/libs/fjsc/tests.factor
deleted file mode 100644 (file)
index 0c3b1dc..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-! Copyright (C) 2006 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-USING: kernel test parser-combinators lazy-lists fjsc ;
-IN: temporary
-
-{ T{ ast-expression f { T{ ast-number f 55 } T{ ast-identifier f "2abc1" } T{ ast-number f 100 } } } } [
-  "55 2abc1 100" 'expression' parse car parse-result-parsed
-] unit-test
-
-{ T{ ast-quotation f T{ ast-expression f { T{ ast-number f 55 } T{ ast-identifier f "2abc1" } T{ ast-number f 100 } } } } } [
-  "[ 55 2abc1 100 ]" 'quotation' parse car parse-result-parsed
-] unit-test
-
-{ T{ ast-array f T{ ast-expression f { T{ ast-number f 55 } T{ ast-identifier f "2abc1" } T{ ast-number f 100 } } } } } [
-  "{ 55 2abc1 100 }" 'array' parse car parse-result-parsed
-] unit-test
-
-{ T{ ast-stack-effect f { } { "d" "e" "f" } } } [
-  "( -- d e f )" 'stack-effect' parse car parse-result-parsed 
-] unit-test
-
-{ T{ ast-stack-effect f { "a" "b" "c" } { "d" "e" "f" } } } [
-  "( a b c -- d e f )" 'stack-effect' parse car parse-result-parsed 
-] unit-test
-
-{ T{ ast-stack-effect f { "a" "b" "c" } { } } } [
-  "( a b c -- )" 'stack-effect' parse car parse-result-parsed 
-] unit-test
-
-{ T{ ast-stack-effect f { } { } } } [
-  "( -- )" 'stack-effect' parse car parse-result-parsed 
-] unit-test
-
-{ } [
-  ": foo ( a b -- c d ) abcdefghijklmn 123 ;" 'expression' parse car drop
-] unit-test
\ No newline at end of file
diff --git a/libs/furnace/load.factor b/libs/furnace/load.factor
deleted file mode 100644 (file)
index 527ff92..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-REQUIRES: libs/httpd ;
-
-PROVIDE: libs/furnace
-{ +files+ { 
-    "validator.factor"
-    "responder.factor"
-    "tools/help.factor"
-    "tools/browser.factor"
-} }
-{ +tests+ { 
-    "test/validator.factor"
-    "test/responder.factor"
-} } ;
diff --git a/libs/furnace/responder.factor b/libs/furnace/responder.factor
deleted file mode 100644 (file)
index 44ec893..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: furnace
-USING: embedded generic arrays namespaces prettyprint io
-sequences words kernel httpd html errors hashtables http
-callback-responder vectors strings ;
-
-SYMBOL: default-action
-
-SYMBOL: template-path
-
-: define-action ( word params -- )
-    over t "action" set-word-prop
-    "action-params" set-word-prop ;
-
-: define-redirect ( word quot -- )
-    "action-redirect" set-word-prop ;
-
-: responder-vocab ( name -- vocab )
-    "furnace:" swap append ;
-
-: lookup-action ( name webapp -- word )
-    responder-vocab lookup dup [
-        dup "action" word-prop [ drop f ] unless
-    ] when ;
-
-: current-action ( url -- word/f )
-    dup empty? [ drop default-action get ] when
-    "responder" get lookup-action ;
-
-PREDICATE: word action "action" word-prop ;
-
-: quot>query ( seq action -- hash )
-    "action-params" word-prop
-    [ first swap 2array ] 2map alist>hash ;
-
-: action-link ( query action -- url )
-    [
-        "/responder/" %
-        dup word-vocabulary "furnace:" ?head drop %
-        "/" %
-        word-name %
-    ] "" make swap build-url ;
-
-: action-call? ( quot -- ? )
-    >vector dup pop action? >r [ word? not ] all? r> and ;
-
-: unclip* dup 1 head* swap peek ;
-
-: quot-link ( quot -- url )
-    dup action-call? [
-        unclip* [ quot>query ] keep action-link
-    ] [
-        t register-html-callback
-    ] if ;
-
-: render-link ( quot name -- )
-    <a swap quot-link =href a> write </a> ;
-
-: action-param ( params paramspec -- obj error/f )
-    unclip rot hash swap >quotation apply-validators ;
-
-: query>quot ( params action -- seq )
-    "action-params" word-prop [ action-param drop ] map-with ;
-
-SYMBOL: request-params
-
-: perform-redirect ( action -- )
-    "action-redirect" word-prop
-    [ dup string? [ request-params get hash ] when ] map
-    [ quot-link redirect ] when* ;
-
-: call-action ( params action -- )
-    over request-params set
-    [ query>quot ] keep [ add >quotation call ] keep
-    perform-redirect ;
-
-: service-request ( params url -- )
-    current-action [
-        [ call-action ] [ <pre> print-error </pre> ] recover
-    ] [
-        "404 no such action: " "argument" get append httpd-error
-    ] if* ;
-
-: service-get ( url -- ) "query" get swap service-request ;
-
-: service-post ( url -- ) "response" get swap service-request ;
-
-: explode-tuple ( tuple -- )
-    dup tuple-slots swap class "slot-names" word-prop
-    [ set ] 2each ;
-
-SYMBOL: model
-
-: call-template ( model template -- )
-    [
-        >r [ dup model set explode-tuple ] when* r>
-        ".fhtml" append resource-path run-embedded-file
-    ] with-scope ;
-
-: render-template ( model template -- )
-    template-path get swap path+ call-template ;
-
-: render-page ( model template title -- )
-    serving-html [
-        [
-            render-template
-        ] html-document
-    ] with-html-stream ;
-
-: web-app ( name default path -- )
-    over responder-vocab create-vocab drop
-    [
-        template-path set
-        default-action set
-        "responder" set
-        [ service-get ] "get" set
-        [ service-post ] "post" set
-        ! [ service-head ] "head" set
-    ] make-responder ;
diff --git a/libs/furnace/test/responder.factor b/libs/furnace/test/responder.factor
deleted file mode 100644 (file)
index f659f29..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-IN: temporary
-USING: test namespaces furnace math kernel sequences ;
-
-TUPLE: test-tuple m n ;
-
-[ H{ { "m" 3 } { "n" 2 } } ]
-[
-    [ T{ test-tuple f 3 2 } explode-tuple ] make-hash
-] unit-test
-
-[
-    { 3 }
-] [
-    H{ { "n" "3" } } { { "n" v-number } }
-    [ action-param drop ] map-with
-] unit-test
-
-: foo ;
-
-\ foo { { "foo" "2" v-default } { "bar" v-required } } define-action
-
-[ t ] [ [ 1 2 foo ] action-call? ] unit-test
-[ f ] [ [ 2 + ] action-call? ] unit-test
-
-[
-    { "2" "hello" }
-] [
-    [
-        H{
-            { "bar" "hello" }
-        } \ foo query>quot
-    ] with-scope
-] unit-test
-
-[
-    H{ { "foo" "1" } { "bar" "2" } }
-] [
-    { "1" "2" } \ foo quot>query
-] unit-test
-
-[
-    "/responder/temporary/foo?foo=3"
-] [
-    [
-        [ "3" foo ] quot-link
-    ] with-scope
-] unit-test
diff --git a/libs/furnace/test/validator.factor b/libs/furnace/test/validator.factor
deleted file mode 100644 (file)
index e7d92c7..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-IN: temporary
-USING: test namespaces furnace math kernel sequences ;
-
-[
-    123 f
-] [
-    H{ { "foo" "123" } } { "foo" v-number } action-param
-] unit-test
-
-: validation-fails
-    [ action-param nip not ] append [ f ] swap unit-test ;
-
-[ H{ { "foo" "12X3" } } { "foo" v-number } ] validation-fails
-
-[ H{ { "foo" "" } } { "foo" 4 v-min-length } ] validation-fails
-
-[ "ABCD" f ]
-[ H{ { "foo" "ABCD" } } { "foo" 4 v-min-length } action-param ]
-unit-test
-
-[ H{ { "foo" "ABCD" } } { "foo" 2 v-max-length } ]
-validation-fails
-
-[ "AB" f ]
-[ H{ { "foo" "AB" } } { "foo" 2 v-max-length } action-param ]
-unit-test
-
-[ "AB" f ]
-[ H{ { "foo" f } } { "foo" "AB" v-default } action-param ]
-unit-test
diff --git a/libs/furnace/tools/browser.factor b/libs/furnace/tools/browser.factor
deleted file mode 100644 (file)
index a09ccc0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-! Copyright (C) 2004 Chris Double
-! Copyright (C) 2004, 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: furnace:browser
-USING: definitions hashtables help html httpd io kernel memory
-namespaces prettyprint sequences words xml furnace arrays ;
-
-TUPLE: list current options name ;
-
-: list ( current options name -- )
-    <list> "list" render-template ;
-
-: vocab-list ( vocab -- ) vocabs "vocab" list ;
-
-: word-list ( word vocab -- )
-    [ lookup [ word-name ] [ f ] if* ] keep
-    vocab hash-keys natural-sort "word" list ;
-
-: browser-title ( word vocab -- str )
-    2dup lookup dup
-    [ 2nip summary ] [ drop nip "IN: " swap append ] if ;
-
-TUPLE: browser word vocab apropos ;
-
-: browse ( word vocab apropos -- )
-    pick pick browser-title >r <browser> "browser" r> render-page ;
-
-\ browse {
-    { "word" }
-    { "vocab" "kernel" v-default }
-    { "apropos" }
-} define-action
-
-"browser" "browse" "libs/furnace/tools" web-app
-
-M: word browser-link-href
-    dup word-name swap word-vocabulary f \ browse
-    4array >quotation quot-link ;
diff --git a/libs/furnace/tools/browser.fhtml b/libs/furnace/tools/browser.fhtml
deleted file mode 100644 (file)
index be4c94e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<% USING: namespaces furnace:browser words help kernel tools sequences io
-html ; %>
-
-<form id="main" action="browse" method="get">
-    <table width="100%">
-        <tr>
-            <th align="left">Vocabularies</th>
-            <th align="left">Words</th>
-            <th align="left">Documentation</th>
-        </tr>
-        <tr>
-            <td valign="top" style="width: 200px;">
-                <% "vocab" get vocab-list %>
-            </td>
-            <td valign="top" style="width: 200px;">
-                <% "word" get "vocab" get word-list %>
-            </td>
-            <td valign="top">
-                <% "word" get "vocab" get lookup [ help ] when* %>
-            </td>
-        </tr>
-    </table>
-    <h2>Apropos</h2>
-    <input type="field" name="apropos" /><br/>
-    <%
-        "apropos" get dup empty? [
-            drop
-        ] [
-            <b> "Results for " write dup write ":" write </b> <br/>
-            apropos
-        ] if
-    %>
-</form>
diff --git a/libs/furnace/tools/help.factor b/libs/furnace/tools/help.factor
deleted file mode 100644 (file)
index 15771d1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: furnace:help
-USING: furnace help httpd html kernel sequences words strings
-io ;
-
-: show-help ( topic -- )
-    serving-html
-    dup article-title [
-        [ help ] with-html-stream
-    ] html-document ;
-
-: string>topic ( string -- topic )
-    " " split dup length 1 = [ first ] when ;
-
-\ show-help {
-    { "topic" "handbook" v-default string>topic }
-} define-action
-
-M: link browser-link-href
-    link-name [ \ f ] unless* dup word? [
-        browser-link-href
-    ] [
-        dup [ string? ] all? [ " " join ] when
-        [ show-help ] curry quot-link
-    ] if ;
-
-"help" "show-help" "libs/furnace/tools" web-app
diff --git a/libs/furnace/tools/list.fhtml b/libs/furnace/tools/list.fhtml
deleted file mode 100644 (file)
index a4eed92..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<% USING: namespaces kernel html io sequences ; %>
-
-<select name="<% "name" get write %>" style="width: 200px;" size="20"
-    onchange="JavaScript:document.getElementById('main').submit();">
-
-    <%
-        "options" get [
-            <option dup "current" get = [ "selected" =selected ] when option>
-                write
-            </option>
-        ] each
-    %>
-
-</select>
diff --git a/libs/furnace/validator.factor b/libs/furnace/validator.factor
deleted file mode 100644 (file)
index 9efc944..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: furnace
-USING: generic kernel errors words sequences math
-namespaces ;
-
-TUPLE: validation-error reason ;
-
-: apply-validators ( string quot -- obj error/f )
-    [
-        call f
-    ] [
-        dup validation-error? [ >r 2drop f r> ] [ rethrow ] if
-    ] recover ;
-
-: validation-error ( msg -- * ) <validation-error> throw ;
-
-: v-default ( obj value -- obj )
-    over empty? [ nip ] [ drop ] if ;
-
-: v-required ( str -- str )
-    dup empty? [ "required" validation-error ] when ;
-
-: v-min-length ( str n -- str )
-    over length over < [
-        [ "must be at least " % # " characters" % ] "" make
-        validation-error
-    ] [
-        drop
-    ] if ;
-
-: v-max-length ( str n -- str )
-    over length over > [
-        [ "must be no more than " % # " characters" % ] "" make
-        validation-error
-    ] [
-        drop
-    ] if ;
-
-: v-number ( str -- n )
-    string>number [
-        "must be a number" validation-error
-    ] unless* ;
diff --git a/libs/gap-buffer/circular-tests.factor b/libs/gap-buffer/circular-tests.factor
deleted file mode 100644 (file)
index 409359d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-USING: kernel test sequences sequences-internals circular ;
-
-[ 0 ] [ { 0 1 2 3 4 } <circular> 0 swap circular@ drop ] unit-test
-[ 2 ] [ { 0 1 2 3 4 } <circular> 2 swap circular@ drop ] unit-test
-
-[ CHAR: t ] [ "test" <circular> 0 swap nth ] unit-test
-[ "test"  ] [ "test" <circular> "" like ] unit-test
-
-[ "test" <circular> 5 swap nth ] unit-test-fails
-[ CHAR: e ] [ "test" <circular> 5 swap nth-unsafe ] unit-test
-[ [ 1 2 3 ] ] [ { 1 2 3 } <circular> [ ] like ] unit-test
-[ [ 2 3 1 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start [ ] like ] unit-test
-[ [ 3 1 2 ] ] [ { 1 2 3 } <circular> 1 over change-circular-start 1 over change-circular-start [ ] like ] unit-test
-
-[ "fob" ] [ "foo" <circular> CHAR: b 2 pick set-nth "" like ] unit-test
-[ "foo" <circular> CHAR: b 3 rot set-nth ] unit-test-fails
-[ "boo" ] [ "foo" <circular> CHAR: b 3 pick set-nth-unsafe "" like ] unit-test
-[ "ornact" ] [ "factor" <circular> 4 over change-circular-start CHAR: n 2 pick set-nth "" like ] unit-test
-
diff --git a/libs/gap-buffer/circular.factor b/libs/gap-buffer/circular.factor
deleted file mode 100644 (file)
index 461ad22..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-USING: kernel sequences math generic sequences-internals ;
-IN: circular
-
-! a circular sequence wraps another sequence, but begins at an arbitrary
-! element in the underlying sequence.
-TUPLE: circular start ;
-
-C: circular ( seq -- circular )
-    0 over set-circular-start [ set-delegate ] keep ;
-
-: circular@ ( n circular -- n seq )
-    [ tuck circular-start + swap length mod ] keep delegate ;
-
-M: circular nth ( n seq -- elt ) bounds-check circular@ nth ;
-
-M: circular nth-unsafe ( n seq -- elt ) circular@ nth-unsafe ;
-
-M: circular set-nth ( elt n seq -- ) bounds-check circular@ set-nth ;
-
-M: circular set-nth-unsafe ( elt n seq -- ) circular@ set-nth-unsafe ;
-
-: change-circular-start ( n circular -- )
-    #! change start to (start + n) mod length
-    [ circular@ drop ] keep set-circular-start ;
-
diff --git a/libs/gap-buffer/gap-buffer-tests.factor b/libs/gap-buffer/gap-buffer-tests.factor
deleted file mode 100644 (file)
index 435abee..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-USING: kernel sequences test gap-buffer strings math ;
-IN: gb-tests
-
-! test copy-elements
-[ { 0 3 4 3 4 5 } ] [ { 0 1 2 3 4 5 } dup >r -2 3 5 r> copy-elements ] unit-test
-[ { 0 1 2 1 2 5 } ] [ { 0 1 2 3 4 5 } dup >r 2 2 0 r> copy-elements ] unit-test
-[ "01234567856" ] [ "01234567890" dup >r 4 6 4 r> copy-elements ] unit-test
-
-! test sequence protocol (like, length, nth, set-nth)
-[ "gap buffers are cool" ] [ "gap buffers are cool" <gb> "" like ] unit-test
-
-! test move-gap-back-inside
-[ t f ] [ 5 "0123456" <gb> move-gap-forward? >r move-gap-back-inside? 2nip r> ] unit-test
-[ "0123456" ] [ "0123456" <gb> 5 over move-gap >string ] unit-test
-! test move-gap-forward-inside
-[ t ] [ "I once ate a spaniel" <gb> 15 over move-gap 17 swap move-gap-forward-inside? 2nip ] unit-test
-[ "I once ate a spaniel" ] [ "I once ate a spaniel" <gb> 15 over move-gap 17 over move-gap >string ] unit-test
-! test move-gap-back-around
-[ f f ] [ 2 "terriers are ok too" <gb> move-gap-forward? >r move-gap-back-inside? 2nip r> ] unit-test
-[ "terriers are ok too" ] [ "terriers are ok too" <gb> 2 over move-gap >string ] unit-test
-! test move-gap-forward-around
-[ f t ] [ "god is nam's best friend" <gb> 2 over move-gap 22 over position>index swap move-gap-forward? >r move-gap-forward-inside? 2nip r> ] unit-test
-[ "god is nam's best friend" ] [ "god is nam's best friend" <gb> 2 over move-gap 22 over move-gap >string ] unit-test
-
-! test changing buffer contents
-[ "factory" ] [ "factor" <gb> CHAR: y 6 pick insert* >string ] unit-test
-! test inserting multiple elements in different places. buffer should grow
-[ "refractory" ] [ "factor" <gb> CHAR: y 6 pick insert* "re" 0 pick insert* CHAR: r 3 pick insert* >string ] unit-test
-! test deleting elements. buffer should shrink
-[ "for" ] [ "factor" <gb> 3 [ 1 over delete* ] times >string ] unit-test
-! more testing of nth and set-nth
-[ "raptor" ] [ "factor" <gb> CHAR: p 2 pick set-nth 5 over nth 0 pick set-nth >string ] unit-test
-
-! test stack/queue operations
-[ "slaughter" ] [ "laughter" <gb> CHAR: s over push-start >string ] unit-test
-[ "pantonio" ] [ "pant" <gb> "onio" over push-end >string ] unit-test
-[ CHAR: f "actor" ] [ "factor" <gb> dup pop-start swap >string ] unit-test
-[ CHAR: s "pant" ] [ "pants" <gb> dup pop-end swap >string ] unit-test
-[ "end this is the " ] [ "this is the end " <gb> 4 over rotate >string ] unit-test
-[ "your jedi training is finished " ] [ "finished your jedi training is " <gb> -9 over rotate >string ] unit-test
-
diff --git a/libs/gap-buffer/gap-buffer.factor b/libs/gap-buffer/gap-buffer.factor
deleted file mode 100644 (file)
index 234a1e9..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-! gap buffer -- Alex Chapman (chapman.alex@gmail.com)
-! largely influenced by Strandh and Villeneuve's Flexichain
-! for a good introduction see:
-! http://p-cos.net/lisp-ecoop/submissions/StrandhVilleneuveMoore.pdf
-USING: kernel arrays sequences sequences-internals circular math generic ;
-IN: gap-buffer
-
-! gap-start     -- the first element of the gap
-! gap-end       -- the first element after the gap
-! expand-factor -- should be > 1
-! min-size      -- < 5 is not sensible
-
-TUPLE: gb
-    gap-start
-    gap-end
-    expand-factor
-    min-size ;
-
-: required-space ( n gb -- n )
-    tuck gb-expand-factor * ceiling >fixnum swap gb-min-size max ;
-
-C: gb ( seq -- gb )
-    5 over set-gb-min-size
-    1.5 over set-gb-expand-factor
-    [ >r length r> set-gb-gap-start ] 2keep
-    [ swap length over required-space swap set-gb-gap-end ] 2keep
-    [
-       over length over required-space rot { } like resize-array <circular> swap set-delegate
-    ] keep ;
-
-M: gb like ( seq gb -- seq ) drop <gb> ;
-
-: gap-length ( gb -- n ) [ gb-gap-end ] keep gb-gap-start - ;
-
-: buffer-length ( gb -- n ) delegate length ;
-
-M: gb length ( gb -- n ) [ buffer-length ] keep gap-length - ;
-
-: position>index ( n gb -- n )
-    2dup gb-gap-start >= [
-       gap-length +
-    ] [ drop ] if ;
-
-: gb@ ( n gb -- n seq ) [ position>index ] keep delegate ;
-    
-M: gb nth ( n gb -- elt ) bounds-check gb@ nth-unsafe ;
-
-M: gb nth-unsafe ( n gb -- elt ) gb@ nth-unsafe ;
-
-M: gb set-nth ( elt n seq -- ) bounds-check gb@ set-nth-unsafe ;
-
-M: gb set-nth-unsafe ( elt n seq -- ) gb@ set-nth-unsafe ;
-
-! ------------- moving the gap -------------------------------
-
-: (copy-element) ( to start seq -- ) tuck nth -rot set-nth ;
-
-: copy-element ( dst start seq -- ) >r [ + ] keep r> (copy-element) ;
-
-: copy-elements-back ( dst start seq n -- )
-    dup 0 > [
-       >r [ copy-element ] 3keep >r 1+ r> r> 1- copy-elements-back
-    ] [ 3drop drop ] if ;
-
-: copy-elements-forward ( dst start seq n -- )
-    dup 0 > [
-       >r [ copy-element ] 3keep >r 1- r> r> 1- copy-elements-forward
-    ] [ 3drop drop ] if ;
-
-: copy-elements ( dst start end seq -- )
-    pick pick > [
-       >r dupd - r> swap copy-elements-forward
-    ] [
-       >r over - r> swap copy-elements-back
-    ] if ;
-
-! the gap can be moved either forward or back. Moving the gap 'inside' means
-! moving elements across the gap. Moving the gap 'around' means changing the
-! start of the circular buffer to avoid moving as many elements.
-
-! We decide which method (inside or around) to pick based on the number of
-! elements that will need to be moved. We always try to move as few elements as
-! possible.
-
-: move-gap? ( i gb -- i gb ? ) 2dup gb-gap-end = not ;
-
-: move-gap-forward? ( i gb -- i gb ? ) 2dup gb-gap-start >= ;
-
-: move-gap-back-inside? ( i gb -- i gb ? )
-    #! is it cheaper to move the gap inside than around?
-    2dup [ gb-gap-start swap 2 * - ] keep [ buffer-length ] keep gb-gap-end - <= ;
-
-: move-gap-forward-inside? ( i gb -- i gb ? )
-    #! is it cheaper to move the gap inside than around?
-    2dup [ gb-gap-end >r 2 * r> - ] keep [ gb-gap-start ] keep buffer-length + <= ;
-
-: move-gap-forward-inside ( i gb -- )
-    [ dup gap-length neg swap gb-gap-end rot ] keep delegate copy-elements ;
-
-: move-gap-back-inside ( i gb -- )
-    [ dup gap-length swap gb-gap-start 1- rot 1- ] keep delegate copy-elements ;
-
-: move-gap-forward-around ( i gb -- )
-    0 over move-gap-back-inside [
-       dup buffer-length [
-           swap gap-length - neg swap
-       ] keep
-    ] keep [
-       delegate copy-elements
-    ] keep dup gap-length swap delegate change-circular-start ;
-
-: move-gap-back-around ( i gb -- )
-    dup buffer-length over move-gap-forward-inside [
-       length swap -1
-    ] keep [
-       delegate copy-elements
-    ] keep dup length swap delegate change-circular-start ;
-
-: move-gap-forward ( i gb -- )
-    move-gap-forward-inside? [
-       move-gap-forward-inside
-    ] [
-       move-gap-forward-around
-    ] if ;
-
-: move-gap-back ( i gb -- )
-    move-gap-back-inside? [
-       move-gap-back-inside
-    ] [
-       move-gap-back-around
-    ] if ;
-
-: (move-gap) ( i gb -- )
-    move-gap? [
-       move-gap-forward? [
-           move-gap-forward
-       ] [
-           move-gap-back
-       ] if
-    ] [ 2drop ] if ;
-
-: fix-gap ( n gb -- )
-    2dup [ gap-length + ] keep set-gb-gap-end set-gb-gap-start ;
-
-: move-gap ( n gb -- ) 2dup [ position>index ] keep (move-gap) fix-gap ;
-
-! ------------ resizing -------------------------------------
-
-: enough-room? ( n gb -- ? )
-    #! is there enough room to add 'n' elements to gb?
-    tuck length + swap buffer-length <= ;
-
-: set-new-gap-end ( array gb -- )
-    [ buffer-length swap length swap - ] keep
-    [ gb-gap-end + ] keep set-gb-gap-end ;
-
-: after-gap ( gb -- gb )
-    dup delegate swap gb-gap-end tail ;
-
-: before-gap ( gb -- gb )
-    dup gb-gap-start head ;
-
-: copy-after-gap ( array gb -- )
-    #! copy everything after the gap in 'gb' into the end of 'array',
-    #! and change 'gb's gap-end to reflect the gap-end in 'array'
-    dup after-gap >r 2dup set-new-gap-end gb-gap-end swap r> copy-into ;
-
-: copy-before-gap ( array gb -- )
-    #! copy everything before the gap in 'gb' into the start of 'array'
-    before-gap 0 -rot copy-into ; ! gap start doesn't change
-
-: resize-buffer ( gb new-size -- )
-    f <array> swap 2dup copy-before-gap 2dup copy-after-gap
-    >r <circular> r> set-delegate ;
-
-: decrease-buffer-size ( gb -- )
-    #! the gap is too big, so resize to something sensible
-    dup length over required-space resize-buffer ;
-
-: increase-buffer-size ( n gb -- )
-    #! increase the buffer to fit at least 'n' more elements
-    tuck length + over required-space resize-buffer ;
-
-: gb-too-big? ( gb -- ? )
-    dup buffer-length over gb-min-size > [
-       dup length over buffer-length rot gb-expand-factor sq / <
-    ] [ drop f ] if ;
-
-: maybe-decrease ( gb -- )
-    dup gb-too-big? [
-       decrease-buffer-size
-    ] [ drop ] if ;
-
-: ensure-room ( n gb -- )
-    #! ensure that ther will be enough room for 'n' more elements
-    2dup enough-room? [ 2drop ] [
-       increase-buffer-size
-    ] if ;
-
-! ------- editing operations ---------------
-
-G: insert* ( seq position gb -- ) 2 standard-combination ;
-
-: prepare-insert ( seq position gb -- seq gb )
-    tuck move-gap over length over ensure-room ;
-
-: insert-elements ( seq gb -- )
-    dup gb-gap-start swap delegate rot copy-into ;
-
-: increment-gap-start ( gb n -- )
-    over gb-gap-start + swap set-gb-gap-start ;
-
-M: sequence insert* ( seq position gb -- )
-    prepare-insert [ insert-elements ] 2keep swap length increment-gap-start ;
-
-M: object insert* ( elem position gb -- ) >r >r 1array r> r> insert* ;
-
-: delete* ( position gb -- )
-    tuck move-gap dup gb-gap-end 1+ over set-gb-gap-end maybe-decrease ;
-
-! -------- stack/queue operations -----------
-
-: push-start ( obj gb -- ) 0 swap insert* ;
-
-: push-end ( obj gb -- ) [ length ] keep insert* ;
-
-: pop-elem ( position gb -- elem ) [ nth ] 2keep delete* ;
-
-: pop-start ( gb -- elem ) 0 swap pop-elem ;
-
-: pop-end ( gb -- elem ) [ length 1- ] keep pop-elem ;
-
-: rotate ( n gb -- )
-    dup length 1 > [
-       swap dup 0 > [
-           [ dup [ pop-end ] keep push-start ]
-       ] [
-           neg [ dup [ pop-start ] keep push-end ]
-       ] if times drop
-    ] [ 2drop ] if ;
-
diff --git a/libs/gap-buffer/load.factor b/libs/gap-buffer/load.factor
deleted file mode 100644 (file)
index 7f8cebc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-PROVIDE: libs/gap-buffer
-{ +files+ {  "circular.factor" "gap-buffer.factor" } }
-{ +tests+ {  "circular-tests.factor" "gap-buffer-tests.factor" } } ;
diff --git a/libs/google-search/google-search.factor b/libs/google-search/google-search.factor
deleted file mode 100644 (file)
index 6c6bff3..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-! Copyright (C) 2006 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-USING: kernel http-client namespaces io errors sequences rss ;
-IN: google-search
-
-: build-soap-request ( key string -- soap )
-  #! Return the soap request for a google search
-  [
-    "<?xml version='1.0' encoding='UTF-8'?>" %
-    "<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>" %
-    "<SOAP-ENV:Body>" %
-    "<ns1:doGoogleSearch xmlns:ns1='urn:GoogleSearch'" %
-    "    SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>" %
-    "  <key xsi:type='xsd:string'>" %
-    swap %
-    "</key>" %
-    "  <q xsi:type='xsd:string'>" %
-    %
-    "</q>" %
-    "  <start xsi:type='xsd:int'>0</start>" %
-    "  <maxResults xsi:type='xsd:int'>10</maxResults>" %
-    "  <filter xsi:type='xsd:boolean'>true</filter>" %
-    "  <restrict xsi:type='xsd:string'></restrict>" %
-    "  <safeSearch xsi:type='xsd:boolean'>false</safeSearch>" %
-    "  <lr xsi:type='xsd:string'></lr>" %
-    "  <ie xsi:type='xsd:string'>latin1</ie>" %
-    "  <oe xsi:type='xsd:string'>latin1</oe>" %
-    "</ns1:doGoogleSearch>" %
-    "  </SOAP-ENV:Body>" %
-    "</SOAP-ENV:Envelope> " %
-  ] "" make ;
-
-TUPLE: search-item url snippet title ;
-
-: parse-result ( string -- seq )
-  "resultElements" swap between-tags "item" swap child-tags [
-    [ "URL" swap between-tags ] keep
-    [ "snippet" swap between-tags ] keep
-    "title" swap between-tags <search-item>
-  ] map ;
-
-: google-search ( key string -- result )
-  #! Perform a google searching using the Google Web API
-  #! key and the search string.
-  build-soap-request "text/xml" swap "http://api.google.com/search/beta2" http-post 
-  rot 200 = not [ 2drop "Google search failed." throw ] [ nip ] if parse-result ;
diff --git a/libs/google-search/google-search.facts b/libs/google-search/google-search.facts
deleted file mode 100644 (file)
index 7f5ca35..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-! Copyright (C) 2006 Chris Double\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: help google-search ;\r
-\r
-HELP: build-soap-request\r
-{ $values { "key" "the Google Web API key" } { "string" "the Google search string" } { "soap" "the SOAP body for the request" } }\r
-{ $description \r
-  "Return a string containing the SOAP request to performthe results of a google search from the Google Web API."\r
-  "The given key must be the authentication key obtained from Google to use the API." } \r
-{ $see-also google-search } ;\r
-\r
-HELP: google-search\r
-{ $values { "key" "the Google Web API key" } { "string" "the Google search string" } { "result" "a sequence of search results" } }\r
-{ $description "Request the results of a google search from the Google Web API. The given key must be the authentication key obtained from Google to use the API. The search results are returned as a sequence of " { $link search-item } " objects." } \r
-{ $see-also search-item-url search-item-snippet search-item-title } ;\r
-\r
-HELP: search-item-url\r
-{ $values { "item" "a search item" } { "url" "a string" } }\r
-{ $description "Return the URL of the given search item." } \r
-{ $see-also google-search search-item-snippet search-item-title } ;\r
-\r
-HELP: search-item-snippet\r
-{ $values { "item" "a search item" } { "snippet" "a string" } }\r
-{ $description "Return the snippet of the given search item." } \r
-{ $see-also google-search search-item-url search-item-title } ;\r
-\r
-HELP: search-item-title\r
-{ $values { "item" "a search item" } { "title" "a string" } }\r
-{ $description "Return the title of the given search item." } \r
-{ $see-also google-search search-item-snippet search-item-url } ;\r
-\r
-ARTICLE: { "google-search" "overview" } "Google Search"\r
-"The google-search library is used for querying the Google search engine using their "\r
-"SOAP based API. It requires a special key that used to be obtained from Google to use "\r
-"the service."\r
-$terpri\r
-"Unfortunately as of December 2006 the service has been deprecated and keys "\r
-"are no longer available. The service continues to be usable if you have (or can find) "\r
-"an existing key. I'll update this library when an alternative service becomes available."\r
-$terpri\r
-"An example of usage is:"\r
-{ $code "\"mygooglekey\" \"factor programming language\" google-search" }\r
-"This returns a sequence of " { $link search-item } " objects. The following methods on this object can be used to get the results of the search:"\r
-{ $subsection search-item-url }\r
-{ $subsection search-item-title }\r
-{ $subsection search-item-snippet }\r
-"For example:"\r
-{ $code "\"mygooglekey\" \"factor programming language\" google-search [ search-item-title ] map" } ;
\ No newline at end of file
diff --git a/libs/google-search/load.factor b/libs/google-search/load.factor
deleted file mode 100644 (file)
index e2439c5..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2006 Chris Double. All Rights Reserved.
-! See http://factorcode.org/license.txt for BSD license.
-!
-REQUIRES: libs/http-client apps/rss ;
-
-PROVIDE: libs/google-search 
-{ 
-  +files+ { 
-  "google-search.factor" 
-  "google-search.facts"
-  } 
-} {
-  +tests+ { 
-  }
-} { 
-  +help+ { "google-search" "overview" } 
-} ;
diff --git a/libs/hardware-info/cpuinfo.factor b/libs/hardware-info/cpuinfo.factor
deleted file mode 100644 (file)
index 360a86c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-IN: cpuinfo
-USING: kernel math ;
-
-: >megs ( m -- n )
-       -20 shift ;
diff --git a/libs/hardware-info/load.factor b/libs/hardware-info/load.factor
deleted file mode 100644 (file)
index 7c461d9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel ;
-
-PROVIDE: libs/hardware-info
-{ +files+ {
-    { "os-windows.factor" [ windows? ] }
-    { "os-unix.factor" [ unix? ] }
-    "cpuinfo.factor"
-} }
-{ +tests+ {
-} } ;
-
diff --git a/libs/hardware-info/os-unix.factor b/libs/hardware-info/os-unix.factor
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/libs/hardware-info/os-windows.factor b/libs/hardware-info/os-windows.factor
deleted file mode 100644 (file)
index a58c0cc..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-IN: cpuinfo
-USING: alien kernel math win32-api ;
-
-: memory-status ( -- MEMORYSTATUSEX )
-    "MEMORYSTATUSEX" <c-object>
-    "MEMORYSTATUSEX" c-size over set-MEMORYSTATUSEX-dwLength
-    [ GlobalMemoryStatusEx ] keep swap zero? [ win32-error ] when ;
-
-: physical-ram ( -- n )
-    memory-status MEMORYSTATUSEX-ullTotalPhys ;
-
-: available-ram ( -- n )
-    memory-status MEMORYSTATUSEX-ullAvailPhys ;
-
-: system-info ( -- SYSTEM_INFO )
-    "SYSTEM_INFO" <c-object> [ GetSystemInfo ] keep ;
-
-: page-size ( -- n )
-    system-info SYSTEM_INFO-dwPageSize ;
-
-: processor# ( -- n )
-    system-info SYSTEM_INFO-dwNumberOfProcessors ;
-
-! 386, 486, 586, 2200 (IA64), 8664 (AMD_X8664)
-: processor-type ( -- n )
-    system-info SYSTEM_INFO-dwProcessorType ;
-
-! 0 = x86, 6 = Intel Itanium, 9 = x64 (AMD or Intel), 10 = WOW64, 0xffff = Unk
-: processor-architecture ( -- n )
-    system-info SYSTEM_INFO-dwOemId HEX: ffff0000 bitand ;
-
-: os-version
-    "OSVERSIONINFO" <c-object>
-    "OSVERSIONINFO" c-size over set-OSVERSIONINFO-dwOSVersionInfoSize
-    [ GetVersionEx ] keep swap zero? [ win32-error ] when ;
-
-: windows-major ( -- n )
-    os-version OSVERSIONINFO-dwMajorVersion ;
-
-: windows-minor ( -- n )
-    os-version OSVERSIONINFO-dwMinorVersion ;
-
-: windows-build# ( -- n )
-    os-version OSVERSIONINFO-dwBuildNumber ;
-
-: windows-platform-id ( -- n )
-    os-version OSVERSIONINFO-dwPlatformId ;
-
-: windows-service-pack ( -- string )
-    os-version OSVERSIONINFO-szCSDVersion ;
-
-: sse2? ( -- ? )
-    PF_XMMI64_INSTRUCTIONS_AVAILABLE IsProcessorFeaturePresent zero? not ;
-
diff --git a/libs/http-client/http-client.factor b/libs/http-client/http-client.factor
deleted file mode 100644 (file)
index 9e575f2..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: http-client
-USING: errors hashtables http kernel math namespaces parser
-sequences io strings ;
-
-: parse-host ( url -- host port )
-    #! Extract the host name and port number from an HTTP URL.
-    ":" split1 [ string>number ] [ 80 ] if* ;
-
-: parse-url ( url -- host resource )
-    "http://" ?head [
-        "URL must begin with http://" throw
-    ] unless
-    "/" split1 [ "/" swap append ] [ "/" ] if* ;
-
-: parse-response ( line -- code )
-    "HTTP/" ?head [ " " split1 nip ] when
-    " " split1 drop string>number ;
-
-: read-response ( -- code header )
-    #! After sending a GET or POST we read a response line and
-    #! header.
-    flush readln parse-response read-header ;
-
-: crlf "\r\n" write ;
-
-: http-request ( host resource method -- )
-    write " " write write " HTTP/1.0" write crlf
-    "Host: " write write crlf ;
-
-: get-request ( host resource -- )
-    "GET" http-request crlf ;
-
-DEFER: http-get
-
-: do-redirect ( code headers string -- code headers string )
-    #! Should this support Location: headers that are
-    #! relative URLs?
-    pick 302 = [
-        drop "Location" swap hash nip http-get
-    ] when ;
-
-: http-get ( url -- code headers string )
-    #! Opens a stream for reading from an HTTP URL.
-    parse-url over parse-host <client> [
-        get-request read-response stdio get contents
-    ] with-stream do-redirect ;
-
-: download ( url file -- )
-    #! Downloads the contents of a URL to a file.
-    >r http-get 2nip r> <file-writer> [ write ] with-stream ;
-
-: post-request ( content-type content host resource -- )
-    #! Note: It is up to the caller to url encode the content if
-    #! it is required according to the content-type.
-    "POST" http-request [
-        "Content-Length: " write length number>string write crlf
-        "Content-Type: " write url-encode write crlf
-        crlf
-    ] keep write ;
-
-: http-post ( content-type content url -- code headers string )
-    #! Make a POST request. The content is URL encoded for you.
-    parse-url over parse-host <client> [
-        post-request flush read-response stdio get contents
-    ] with-stream ;
\ No newline at end of file
diff --git a/libs/http-client/load.factor b/libs/http-client/load.factor
deleted file mode 100644 (file)
index 121c41f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-REQUIRES: libs/http ;
-
-PROVIDE: libs/http-client
-{ +files+ { "http-client.factor" } }
-{ +tests+ { "test.factor" } } ;
diff --git a/libs/http-client/test.factor b/libs/http-client/test.factor
deleted file mode 100644 (file)
index 49e72db..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-USING: http-client test ;
-[ "localhost" 80 ] [ "localhost" parse-host ] unit-test
-[ "localhost" 8888 ] [ "localhost:8888" parse-host ] unit-test
-[ "localhost:8888" "/foo" ] [ "http://localhost:8888/foo" parse-url ] unit-test
-[ "localhost:8888" "/" ] [ "http://localhost:8888" parse-url ] unit-test
-[ 404 ] [ "HTTP/1.1 404 File not found" parse-response ] unit-test
-[ 404 ] [ "404 File not found" parse-response ] unit-test
-[ 200 ] [ "HTTP/1.0 200" parse-response ] unit-test
-[ 200 ] [ "HTTP/1.0 200 Success" parse-response ] unit-test
diff --git a/libs/http.factor b/libs/http.factor
deleted file mode 100644 (file)
index cdd3d20..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-! Copyright (C) 2003, 2005 Slava Pestov
-IN: http
-USING: errors hashtables io kernel math namespaces parser
-sequences strings ;
-
-: header-line ( line -- )
-    ": " split1 dup [ swap set ] [ 2drop ] if ;
-
-: (read-header) ( hash -- hash )
-    readln dup
-    empty? [ drop ] [ header-line (read-header) ] if ;
-
-: read-header ( -- hash )
-    [ (read-header) ] make-hash ;
-
-: url-quotable? ( ch -- ? )
-    #! In a URL, can this character be used without
-    #! URL-encoding?
-    dup letter?
-    over LETTER? or
-    over digit? or
-    swap "/_?." member? or ; foldable
-
-: url-encode ( str -- str )
-    [
-        [
-            dup url-quotable? [
-                ,
-            ] [
-                CHAR: % , >hex 2 CHAR: 0 pad-left %
-            ] if
-        ] each
-    ] "" make ;
-
-: catch-hex> ( str -- n/f )
-    #! Push f if string is not a valid hex literal.
-    [ hex> ] catch [ drop f ] when ;
-
-: url-decode-hex ( index str -- )
-    2dup length 2 - >= [
-        2drop
-    ] [
-        >r 1+ dup 2 + r> subseq  catch-hex> [ , ] when*
-    ] if ;
-
-: url-decode-% ( index str -- index str )
-    2dup url-decode-hex >r 3 + r> ;
-
-: url-decode-+-or-other ( index str ch -- index str )
-    dup CHAR: + = [ drop CHAR: \s ] when , >r 1+ r> ;
-
-: url-decode-iter ( index str -- )
-    2dup length >= [
-        2drop
-    ] [
-        2dup nth dup CHAR: % = [
-            drop url-decode-%
-        ] [
-            url-decode-+-or-other
-        ] if url-decode-iter
-    ] if ;
-
-: url-decode ( str -- str )
-    [ 0 swap url-decode-iter ] "" make ;
-
-: build-url ( path query-params -- str )
-    [
-        swap % dup hash-empty? [
-            "?" %
-            dup hash>alist
-            [ [ url-encode ] map "=" join ] map "&" join %
-        ] unless drop
-    ] "" make ;
-
-PROVIDE: libs/http ;
diff --git a/libs/httpd/callback-responder.factor b/libs/httpd/callback-responder.factor
deleted file mode 100644 (file)
index 09995dc..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-! Copyright (C) 2004 Chris Double.
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: callback-responder
-USING: hashtables html http httpd io kernel math namespaces
-sequences ;
-
-#! Name of the variable holding the continuation used to exit
-#! back to the httpd responder.
-SYMBOL: exit-continuation 
-
-#! Tuple to hold global request data. This gets passed to
-#! the continuation when resumed so it can restore things
-#! like 'stdio' so it writes to the correct socket. 
-TUPLE: request stream exitcc method url raw-query query header response ;
-
-C: request ( -- request )
-  [ stdio get swap set-request-stream ] keep 
-  [ "method" get swap set-request-method ] keep 
-  [ "request" get swap set-request-url ] keep 
-  [ "raw-query" get swap set-request-raw-query ] keep 
-  [ "query" get swap set-request-query ] keep 
-  [ "header" get swap set-request-header ] keep 
-  [ "response" get swap set-request-response ] keep 
-  [ exit-continuation get swap set-request-exitcc ] keep ;
-
-: restore-request ( -- )
-  request get 
-  dup request-stream stdio set 
-  dup request-method "method" set 
-  dup request-raw-query "raw-query" set 
-  dup request-query "query" set 
-  dup request-header "header" set 
-  dup request-response "response" set 
-  request-exitcc exit-continuation set ;
-
-: update-request ( request new-request -- )
-  [ request-stream over set-request-stream ] keep 
-  [ request-method over set-request-method ] keep 
-  [ request-url over set-request-url ] keep 
-  [ request-raw-query over set-request-raw-query ] keep 
-  [ request-query over set-request-query ] keep 
-  [ request-header over set-request-header ] keep 
-  [ request-response over set-request-response ] keep 
-  request-exitcc swap set-request-exitcc ;
-  
-: with-exit-continuation ( quot -- ) 
-    #! Call the quotation with the variable exit-continuation bound 
-    #! such that when the exit continuation is called, computation 
-    #! will resume from the end of this 'with-exit-continuation' call. 
-    [ 
-        exit-continuation set call exit-continuation get continue
-    ] callcc0 drop ;
-
-: expiry-timeout ( -- ms ) 900 1000 * ;
-
-: get-random-id ( -- id ) 
-    #! Generate a random id to use for continuation URL's
-    [ "ID" % 32 [ 9 random-int CHAR: 0 + , ] times ] "" make ;
-
-: callback-table ( -- <hashtable> ) 
-    #! Return the global table of continuations
-    \ callback-table get-global ;
-
-: reset-callback-table ( -- ) 
-    #! Create the initial global table
-    H{ } clone \ callback-table set-global ;
-
-reset-callback-table
-
-#! Tuple for holding data related to a callback.
-TUPLE: item quot expire? request id  time-added ;
-
-C: item ( quot expire? request id -- item )
-    millis over set-item-time-added
-    [ set-item-id ] keep
-    [ set-item-request ] keep
-    [ set-item-expire? ] keep
-    [ set-item-quot ] keep ;
-
-: expired? ( item -- ? )
-    #! Return true if the callback item is expirable
-    #! and has expired (ie. was added to the table more than
-    #! timeout milliseconds ago).
-    [ item-time-added expiry-timeout + millis < ] keep
-    item-expire? and ;
-
-: expire-callbacks ( -- )
-    #! Expire all continuations in the continuation table
-    #! if they are 'timeout-seconds' old (ie. were added
-    #! more than 'timeout-seconds' ago.
-    callback-table clone [
-        expired? [ callback-table remove-hash ] [ drop ] if
-    ] hash-each ;
-
-: id>url ( id -- string )
-    #! Convert the continuation id to an URL suitable for
-    #! embedding in an HREF or other HTML.
-    "/responder/callback/?id=" swap url-encode append ;
-
-: register-callback ( quot expire? -- url ) 
-    #! Store a continuation in the table and associate it with
-    #! a random id. That continuation will be expired after
-    #! a certain period of time if 'expire?' is true.  
-    request get get-random-id [ <item> ] keep
-    [ callback-table set-hash ] keep
-    id>url ;
-
-: register-html-callback ( quot expire? -- url )
-    >r [ serving-html ] swap append r> register-callback ;
-
-: callback-responder ( -- )   
-    expire-callbacks
-    "id" query-param callback-table hash [
-        [
-         dup item-request [
-            <request> update-request
-          ] when*
-          item-quot call 
-          exit-continuation get continue 
-        ] with-exit-continuation drop
-    ] [
-        "404 Callback not available" httpd-error
-    ] if* ;
diff --git a/libs/httpd/cont-responder.factor b/libs/httpd/cont-responder.factor
deleted file mode 100644 (file)
index 61aa59b..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-! Copyright (C) 2004 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: http httpd math namespaces io strings kernel html hashtables
-       parser generic sequences callback-responder ;
-IN: cont-responder
-
-#! Used inside the session state of responders to indicate whether the
-#! next request should use the post-refresh-get pattern. It is set to
-#! true after each request.
-SYMBOL: post-refresh-get?
-
-: >callable ( quot|interp|f -- interp )
-    dup continuation? [        
-        [ continue ] curry
-    ] when ;
-
-: forward-to-url ( url -- )
-    #! When executed inside a 'show' call, this will force a
-    #! HTTP 302 to occur to instruct the browser to forward to
-    #! the request URL.
-    [ 
-        "HTTP/1.1 302 Document Moved\nLocation: " % %
-        "\nContent-Length: 0\nContent-Type: text/plain\n\n" %
-    ] "" make write exit-continuation get continue ;
-
-: forward-to-id ( id -- )
-    #! When executed inside a 'show' call, this will force a
-    #! HTTP 302 to occur to instruct the browser to forward to
-    #! the request URL.
-    >r "request" get r> id>url append forward-to-url ;
-
-SYMBOL: current-show
-
-: store-current-show ( -- )
-  #! Store the current continuation in the variable 'current-show' 
-  #! so it can be returned to later by href callbacks. Note that it
-  #! recalls itself when the continuation is called to ensure that
-  #! it resets its value back to the most recent show call.
-  [  ( 0 -- )
-    [ ( 0 1 -- )
-      current-show set ( 0 -- )
-      continue
-    ] callcc1 ! 0 [ ] ==
-    nip
-    restore-request
-    call
-    store-current-show
-  ] callcc0 restore-request ;
-
-: redirect-to-here ( -- )
-  #! Force a redirect to the client browser so that the browser
-  #! goes to the current point in the code. This forces an URL
-  #! change on the browser so that refreshing that URL will
-  #! immediately run from this code point. This prevents the 
-  #! "this request will issue a POST" warning from the browser
-  #! and prevents re-running the previous POST logic. This is
-  #! known as the 'post-refresh-get' pattern.
-  post-refresh-get? get [
-    [ 
-      >callable t register-callback forward-to-url
-    ] callcc1 drop restore-request
-  ] [
-    t post-refresh-get? set
-  ] if ;
-
-: (show) ( quot -- hashtable )   
-    #! See comments for show. The difference is the 
-    #! quotation MUST set the content-type using 'serving-html'
-    #! or similar.
-    store-current-show redirect-to-here
-    [ 
-        >callable t register-callback swap with-scope 
-        exit-continuation get  continue
-    ] callcc0 drop restore-request "response" get ;
-
-: show ( quot -- namespace )   
-    #! Call the quotation with the URL associated with the current
-    #! continuation. All output from the quotation goes to the client
-    #! browser. When the URL is later referenced then 
-    #! computation will resume from this 'show' call with a hashtable on
-    #! the stack containing any query or post parameters.
-    #! 'quot' has stack effect ( url -- )
-    #! NOTE: On return from 'show' the stack is exactly the same as
-    #! initial entry with 'quot' popped off and the hashtable pushed on. Even
-    #! if the quotation consumes items on the stack.
-    [ serving-html ] swap append (show) ;
-
-: (show-final) ( quot -- namespace )
-    #! See comments for show-final. The difference is the 
-    #! quotation MUST set the content-type using 'serving-html'
-    #! or similar.
-    store-current-show redirect-to-here
-    with-scope exit-continuation get continue ;
-
-: show-final ( quot -- namespace )
-    #! Similar to 'show', except the quotation does not receive the URL
-    #! to resume computation following 'show-final'. No continuation is
-    #! stored for this resumption. As a result, 'show-final' is for use
-    #! when a page is to be displayed with no further action to occur. Its
-    #! use is an optimisation to save having to generate and save a continuation
-    #! in that special case.
-    #! 'quot' has stack effect ( -- ).
-    [ serving-html ] swap append (show-final) ;
-
-#! Name of variable for holding initial continuation id that starts
-#! the responder.
-SYMBOL: root-callback
-
-: cont-get/post-responder ( id-or-f -- ) 
-    #! httpd responder that handles the root continuation request.
-    #! The requests for actual continuation are processed by the
-    #! 'callback-responder'.
-    [         
-        [ f post-refresh-get? set <request> request set root-callback get call ] with-scope
-        exit-continuation get continue
-    ] with-exit-continuation  drop ;
-
-: quot-url ( quot -- url )
-    current-show get [ continue-with ] curry curry t register-callback ;
-
-: quot-href ( text quot -- )
-    #! Write to standard output an HTML HREF where the href,
-    #! when referenced, will call the quotation and then return
-    #! back to the most recent 'show' call (via the callback-cc).
-    #! The text of the link will be the 'text' argument on the 
-    #! stack.
-    <a quot-url =href a> write </a> ;
-
-: install-cont-responder ( name quot -- )
-    #! Install a cont-responder with the given name
-    #! that will initially run the given quotation.
-    #!
-    #! Convert the quotation so it is run within a session namespace
-    #! and that namespace is initialized first.
-    [ 
-        [ cont-get/post-responder ] "get" set 
-        [ cont-get/post-responder ] "post" set 
-        swap "responder" set
-        root-callback set        
-    ] make-responder ;
-
-: simple-page ( title quot -- )
-    #! Call the quotation, with all output going to the
-    #! body of an html page with the given title.
-    <html>  
-        <head> <title> swap write </title> </head> 
-        <body> call </body>
-    </html> ;
-
-: styled-page ( title stylesheet-quot quot -- )
-    #! Call the quotation, with all output going to the
-    #! body of an html page with the given title. stylesheet-quot
-    #! is called to generate the required stylesheet.
-    <html>  
-        <head>  
-             <title> rot write </title> 
-             swap call 
-        </head> 
-        <body> call </body>
-    </html> ;
-
-: paragraph ( str -- )
-    #! Output the string as an html paragraph
-    <p> write </p> ;
-
-: show-message-page ( message -- )
-    #! Display the message in an HTML page with an OK button.
-    [
-        "Press OK to Continue" [
-            swap paragraph 
-            <a =href a> "OK" write </a>
-        ] simple-page 
-    ] show 2drop ;
-
-: vertical-layout ( list -- )
-    #! Given a list of HTML components, arrange them vertically.
-    <table> 
-    [ <tr> <td> call </td> </tr> ] each
-    </table> ;
-
-: horizontal-layout ( list -- )
-    #! Given a list of HTML components, arrange them horizontally.
-    <table> 
-     <tr "top" =valign tr> [ <td> call </td> ] each </tr>
-    </table> ;
-
-: button ( label -- )
-    #! Output an HTML submit button with the given label.
-    <input "submit" =type =value input/> ;
diff --git a/libs/httpd/default-responders.factor b/libs/httpd/default-responders.factor
deleted file mode 100644 (file)
index 03250dc..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: httpd
-USING: callback-responder file-responder io kernel namespaces ;
-
-#! Remove all existing responders, and create a blank
-#! responder table.
-global [
-    H{ } clone responders set
-
-    ! 404 error message pages are served by this guy
-    "404" [ no-such-responder ] add-simple-responder
-    
-    ! Used by other responders
-    "callback" [ callback-responder ] add-simple-responder
-
-    ! Javascript source used by ajax libraries
-    "resources" [ 
-        [
-            "libs/httpd/resources/" resource-path "doc-root" set
-            file-responder
-        ] with-scope
-    ] add-simple-responder
-
-    ! Serves files from a directory stored in the "doc-root"
-    ! variable. You can set the variable in the global namespace,
-    ! or inside the responder.
-    "file" [ file-responder ] add-simple-responder
-    
-    ! The root directory is served by...
-    "file" set-default-responder
-
-    vhosts nest [ H{ } clone "default" set ] bind
-] bind
diff --git a/libs/httpd/documentation.tex b/libs/httpd/documentation.tex
deleted file mode 100644 (file)
index 820565b..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-\documentclass{article}
-
-\usepackage[plainpages=false,colorlinks]{hyperref}
-\usepackage{alltt}
-\usepackage{times}
-\usepackage{tabularx}
-\usepackage{epsfig}
-\usepackage{amssymb}
-\usepackage{epstopdf}
-%\usepackage{fancyref}
-
-\pagestyle{headings}
-
-\setcounter{tocdepth}{3}
-\setcounter{secnumdepth}{3}
-
-\setlength\parskip{\medskipamount}
-\setlength\parindent{0pt}
-
-\newcommand{\bs}{\char'134}
-\newcommand{\dq}{\char'42}
-\newcommand{\tto}{\symbol{123}}
-\newcommand{\ttc}{\symbol{125}}
-\newcommand{\pound}{\char'43}
-\newcommand{\hhat}{\symbol{94}}
-
-\newcommand{\ttindex}[1]{\texttt{#1}\index{\texttt{#1}}}
-
-\newcommand{\vocabulary}[1]{\emph{Vocabulary:} \texttt{#1}&\\}
-
-\newcommand{\parsingword}[2]{\index{\texttt{#1}}\emph{Parsing word:} \texttt{#2}&\\}
-
-\newcommand{\ordinaryword}[2]{\index{\texttt{#1}}\emph{Word:} \texttt{#2}&\\}
-
-\newcommand{\symbolword}[1]{\index{\texttt{#1}}\emph{Symbol:} \texttt{#1}&\\}
-
-\newcommand{\classword}[1]{\index{\texttt{#1}}\emph{Class:} \texttt{#1}&\\}
-
-\newcommand{\genericword}[2]{\index{\texttt{#1}}\emph{Generic word:} \texttt{#2}&\\}
-
-\newcommand{\predword}[1]{\ordinaryword{#1}{#1~( object -- ?~)}}
-
-\setlength{\tabcolsep}{1mm}
-
-\newcommand{\wordtable}[1]{
-
-%HEVEA\renewcommand{\index}[1]{}
-%HEVEA\renewcommand{\glossary}[1]{}
-
-\begin{tabularx}{12cm}{lX}
-\hline
-#1
-\hline
-\end{tabularx}
-
-}
-
-\makeatletter
-
-\makeatother
-
-\makeindex
-
-\begin{document}
-
-\title{Factor Web Framework}
-
-\author{Slava Pestov}
-
-\maketitle
-\tableofcontents{}
-
-Factor includes facilities for interoperating with web-based services. This includes an HTTP client, and an HTTP server with a continuation-based web application framework.
-
-\section{HTTP client}
-
-\wordtable{
-\vocabulary{http-client}
-\ordinaryword{http-get}{http-get ( url -- code headers stream )}
-}
-Connects to the server specified in the URL, and makes a \verb|GET| request to retreive that resource.
-
-\wordtable{
-\vocabulary{http-client}
-\ordinaryword{http-post}{http-post ( type content url -- code headers stream )}
-}
-Attempts to connect to the server specified in the URL, and makes a \verb|POST| request with the specified content type and content. The content is automatically URL-encoded for you.
-
-With both words, the output values are as follows:
-\begin{description}
-\item[\texttt{code}] an integer with the HTTP response code; for example, 404 denotes ``file not found'' whereas 200 means ``success''.
-\item[\texttt{headers}] an association list of returned headers.
-\item[\texttt{stream}] a stream for reading the resource.
-\end{description}
-
-The following pair of words convert a string to and from its URL-encoded form.
-
-\wordtable{
-\vocabulary{http}
-\ordinaryword{url-encode}{url-encode ( string -- string )}
-\ordinaryword{url-decode}{url-decode ( string -- string )}
-}
-These words are called automatically by much of the web framework, however they are sometimes useful to call directly.
-
-\section{HTTP server}\label{httpd}
-
-The HTTP server listens for requests on a port and hands them off to responders. A responder takes action based on the type of request.
-
-\wordtable{
-\vocabulary{httpd}
-\ordinaryword{httpd}{httpd ( port -- )}
-}
-Starts listening for HTTP requests on \verb|port|.
-
-The HTTP server is usually started with a phrase like the following:
-\begin{alltt}
-  USING: httpd threads ;
-  [ 8888 httpd ] in-thread
-\end{alltt}
-
-\wordtable{
-\vocabulary{httpd}
-\ordinaryword{stop-httpd}{stop-httpd ( -- )}
-}
-Stops the HTTP server.
-
-A useful application of the HTTP server is the built-in vocabulary browser. You can use it simply by starting the HTTP server then visiting the following location:
-
-\begin{verbatim}
-http://localhost:8888/responder/browser/
-\end{verbatim}
-
-\subsection{Serving static content}
-
-Static content may be served by setting the \verb|"doc-root"| variable to a directory holding the content. This variable may be set in the global namespace, or indeed, individually on each virtual host.
-\begin{verbatim}
-"/var/www/" "doc-root" set
-\end{verbatim}
-
-If a directory holds an \verb|index.html| file, the file is served when the directory is requested, otherwise a directory listing is produced.
-
-A facility for ad-hoc server-side scripting exists. If a file with the \verb|.factsp| filename extension is requested, the file is run with \verb|run-file| and any output it sends to the default stream is sent to the client. These ``Factor server pages'' are slower and less powerful than responders, so it is recommended that responders be used instead.
-
-A different static site can be associated with each virtual host by setting the \verb|"doc-root"| variable in each virtual host (\ref{vhosts}).
-
-\subsection{Responders}
-
-The HTTP server listens on a port number for HTTP requests and issues requests to \emph{responders}. The following form of request is understood specially by the HTTP server:
-\begin{verbatim}
-http://myhost/responder/foo/bar
-\end{verbatim}
-Such a request results in the \verb|foo| responder being invoked with the \verb|bar| argument. Requesting a path that does not begin with \verb|/responder| simply invokes the file responder with that path, as documented in the previous section.
-
-\subsubsection{Managing responders}
-
-\wordtable{
-\vocabulary{httpd}
-\symbolword{responders}
-}
-Responders are located in a hashtable stored in the \verb|responders| variable. This variable must be in scope when the \verb|httpd| word is invoked. This is usually the case, as the global namespace includes a default value filled out with all responders that are included as part of the library.
-
-The following words manage the set of installed responders:
-
-\wordtable{
-\vocabulary{httpd}
-\ordinaryword{set-default-responder}{set-default-responder ( name -- )}
-}
-Sets the default responder, that is, the one handling requests not prefixed by \verb|/responder|, to the responder \verb|name|. The initial value for the default responder is \verb|"file"|, identifying the file responder.
-\wordtable{
-\vocabulary{httpd}
-\ordinaryword{add-responder}{add-responder ( responder -- )}
-}
-Adds a responder to the hashtable stored in the \verb|responders| variable that is in scope.
-
-\subsubsection{Developing a responder}
-
-A responder is a hashtable where the following keys must be set:
-
-\begin{description}
-\item[\texttt{"responder"}] The name of the responder
-\item[\texttt{"get"}] A quotation with stack effect \verb|( resource -- )|, invoked when a client requests the path \texttt{/responder/\emph{name}/\emph{resource}} using the \texttt{GET} method
-\item[\texttt{"post"}] A quotation with stack effect \verb|( resource -- )|, invoked when a client requests the path using the \texttt{POST} method
-\item[\texttt{"head"}] A quotation with stack effect \verb|( resource -- )|, invoked when a client requests the path using the \texttt{HEAD} method
-\end{description}
-
-The quotations are called by the HTTP server in the dynamic scope of the responder, with the following additional variables set:
-
-\begin{description}
-\item[\texttt{"method"}] The HTTP method requested by the client; one of \texttt{"get"}, \texttt{"post"} or \texttt{"head"}
-\item[\texttt{"request"}] The full URL requested by the client, sans any query parameters trailing a \verb|?| character
-\item[\texttt{"query"}] An association list of URL-decoded string pairs, obtained by splitting the query string, if any
-\item[\texttt{"raw-query"}] The raw query string. Usually not used
-\item[\texttt{"header"}] An association list of URL-decoded string pairs, obtained from the headers sent by the client
-\item[\texttt{"response"}] Only set in the \verb|POST| method, an association list of string pairs, obtained from the response sent by the client
-\end{description}
-
-\subsection{Virtual hosts}\label{vhosts}
-
-Factor's HTTP server supports virtual hosting. This is done with an additional layer of indirection, where each virtual host has its own set of responders. Virtual hosting is optional; by default, all virtual hosts share the same set of responders.
-
-\wordtable{
-\vocabulary{httpd}
-\symbolword{vhosts}
-}
-
-Virtual hosts are defined in a hashtable mapping virtual host names to hashtables of responders. An initial value for this variable is defined in the global namespace; it provides an empty default virtual host. The default virtual host is the value associated with the \verb|"default"| key.
-
-When a client makes a request, the HTTP server first searches for a responder in the requested virtual host; if no responder is found there, the default virtual host is checked. If this also fails, the global \verb|responders| variable is tested.
-
-As an example, suppose the machine running the HTTP server has two DNS aliases, \verb|porky.ham.net| and \verb|spam.ham.net|. The following setup will serve two different static web sites from each virtual host, whereas all other responders are taken from the global table, and are shared between the two hosts:
-
-\begin{verbatim}
-vhosts get [
-    "porky.ham.net" {{
-        [[ "doc-root" "/var/www/porky/" ]]
-    }} set
-    "spam.ham.net" {{
-        [[ "doc-root" "/var/www/spam/" ]]
-    }} set
-] bind
-\end{verbatim}
-
-\section{HTML streams}\label{html}
-
-An HTML stream wraps an existing stream. Strings written to the HTML stream have their special characters converted to HTML entities via the \verb|chars>entities| word documented below. In addition, the \texttt{attrs} parameter to the \texttt{stream-format} word is inspected for style attributes that direct the stream to wrap the output in various HTML tags.
-
-\wordtable{
-\vocabulary{html}
-\ordinaryword{with-html-stream}{with-html-stream ( quot -- )}
-}
-Calls the quotation in a new dynamic scope. The \texttt{stdio} variable is set to an HTML stream wrapping the previous value of \texttt{stdio}, so calls to \texttt{write}, \texttt{format} and \texttt{print} go through the HTML stream.
-
-\wordtable{
-\vocabulary{html}
-\ordinaryword{html-document}{html-document ( title quot -- )}
-}
-Builds on \texttt{with-html-stream} to emit the basic structure of an HTML document, consisting of \texttt{<html>}, \texttt{<head>} and \texttt{<body>} tags. The title is output in two places; a \texttt{<title>} tag  and \texttt{<h1>} tag.
-
-\wordtable{
-\vocabulary{html}
-\ordinaryword{simple-html-document}{simple-html-document ( title quot -- )}
-}
-Like \texttt{html-document}, except the output is wrapped inside a \texttt{<pre>} tag.
-
-\wordtable{
-\vocabulary{html}
-\ordinaryword{chars>entities}{chars>entities ( string -- string )}
-}
-Converts various special characters in the input string (or any sequence of characters) into corresponding HTML entities. The following characters are converted:
-
-\begin{tabular}{l|l}
-Character&Entity\\
-\hline
-\verb|<|   &\verb|&lt;|\\
-\verb|>|   &\verb|&gt;|\\
-\verb|&|   &\verb|&amp;|\\
-\verb|'|   &\verb|&apos;|\\
-\verb|"|   &\verb|&quot;|
-\end{tabular}
-
-\end{document}
diff --git a/libs/httpd/embedded.factor b/libs/httpd/embedded.factor
deleted file mode 100644 (file)
index e9b0757..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-! Copyright (C) 2005 Alex Chapman
-! Copyright (C) 2006 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-IN: embedded
-USING: sequences kernel parser namespaces io html errors ;
-
-! See libs/httpd/test/ or libs/furnace/ for embedded usage
-! examples!
-
-: process-html ( parse-tree string -- parse-tree )
-    dup empty? [ drop ] [ parsed \ write-html parsed ] if ;
-
-: process-embedded ( parse-tree string -- string parse-tree )
-    "<%" split1 >r process-html r> "%>" split1 >r (parse) r> ;
-
-: (parse-embedded) ( parse-tree string -- parse-tree )
-    dup empty?
-    [ drop ] [ process-embedded (parse-embedded) ] if ;
-
-: parse-embedded ( string -- quot )
-    [ f swap (parse-embedded) >quotation ] with-parser ;
-
-: eval-embedded ( string -- ) parse-embedded call ;
-
-: run-embedded-file ( filename -- )
-    [
-        [
-            file-vocabs
-            dup file set ! so that reload works properly
-            dup <file-reader> contents eval-embedded
-        ] with-scope
-    ] assert-depth drop ;
-
-: embedded-convert ( infile outfile -- )
-    <file-writer> [ run-embedded-file ] with-stream ;
diff --git a/libs/httpd/examples/cont-examples.factor b/libs/httpd/examples/cont-examples.factor
deleted file mode 100644 (file)
index c8ea370..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-! Copyright (C) 2004 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-! Simple test applications
-IN: cont-examples
-USE: cont-responder
-USE: hashtables
-USE: html
-USE: kernel
-USE: io
-USE: html
-USE: strings
-USE: math
-USE: namespaces
-USE: prettyprint
-USE: tools
-USE: sequences
-
-: display-page ( title -- ) 
-  #! Display a page with some text to test the cont-responder.
-  #! The page has a link to the 'next' continuation.
-  [ 
-    <h1> over write </h1>
-    swap [ 
-      <a =href a> "Next" write </a>
-    ] html-document 
-  ] show 2drop ;
-
-: display-get-name-page ( -- name )
-  #! Display a page prompting for input of a name and return that name.
-  [ 
-    "Enter your name" [
-      <h1> swap write </h1>
-      <form "post" =method =action form> 
-        "Name: " write
-        <input "text" =type "name" =name "20" =size input/>
-        <input "submit" =type "Ok" =value input/>
-      </form>
-    ] html-document
-  ] show "name" swap hash ;
-
-: test-cont-responder ( - )
-  #! Test the cont-responder responder by displaying a few pages in a row.
-  "Page one" display-page 
-  "Hello " display-get-name-page append display-page
-  "Page three" display-page ;
-
-: test-cont-responder2 ( - )
-  #! Test the cont-responder responder by displaying a few pages in a loop.
-  [ "one" "two" "three" "four" ] [ display-page ]  each 
-  "Done!" display-page  ;
-
-: test-cont-responder3 ( - )
-  #! Test the quot-href word by displaying a menu of the current
-  #! test words. Note that we use show-final as we don't link to a 'next' page.
-  [ 
-    "Menu" [ 
-      <h1> "Menu" write </h1>
-      <ol> 
-        <li> "Test responder1" [ test-cont-responder ] quot-href </li>
-        <li> "Test responder2" [ test-cont-responder2 ] quot-href </li>
-      </ol>
-    ] html-document 
-  ] show-final ;
-
-: counter-example ( count - )
-  #! Display a counter which can be incremented or decremented
-  #! using anchors.
-  #!
-  #! Don't need the original alist
-  [ 
-    #! And we don't need the 'url' argument
-    drop         
-    "Counter: " over unparse append [ 
-      dup <h2> unparse write </h2>
-      "++" over unit [ f ] swap append [ 1 + counter-example ] append quot-href
-      "--" over unit [ f ] swap append [ 1 - counter-example ] append quot-href
-      drop
-    ] html-document 
-  ] show drop ;
-
-: counter-example2 ( - )
-  #! Display a counter which can be incremented or decremented
-  #! using anchors.
-  #!
-  0 "counter" set
-  [ 
-    #! We don't need the 'url' argument
-    drop   
-    "Counter: " "counter" get unparse append [ 
-      <h2> "counter" get unparse write </h2>
-      "++" [ "counter" get 1 + "counter" set ] quot-href
-      "--" [ "counter" get 1 - "counter" set ] quot-href
-    ] html-document 
-  ] show 
-  drop ;
-
-! Install the examples
-"counter1" [ drop 0 counter-example ] install-cont-responder
-"counter2" [ drop counter-example2 ] install-cont-responder
-"test1" [ test-cont-responder ] install-cont-responder
-"test2" [ drop test-cont-responder2 ] install-cont-responder
-"test3" [ drop test-cont-responder3 ] install-cont-responder
diff --git a/libs/httpd/examples/cont-numbers-game.factor b/libs/httpd/examples/cont-numbers-game.factor
deleted file mode 100644 (file)
index 2984093..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-! cont-number-guess
-!
-! Copyright (C) 2004 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-! This example modifies the console based 'numbers-game' example
-! in a very minimal way to demonstrate conversion of a console
-! program to a web based application.
-!
-! All that was required was changing the input and output functions
-! to use HTML. The remaining code was untouched. 
-!
-! The result is not that pretty but it shows the basic idea.
-IN: numbers-game
-USE: kernel
-USE: math
-USE: parser
-USE: html
-USE: cont-responder
-USE: io
-USE: namespaces
-
-: web-print ( str -- )
-  #! Display the string in a web page.
-  [
-    swap dup
-    <html>
-      <head> <title> write </title> </head>
-      <body>
-        <p> write </p>
-        <p> <a =href a> "Press to continue" write </a> </p>
-      </body>
-    </html>
-  ] show 2drop ;
-
-: read-number ( -- )
-  [
-    <html>
-      <head> <title> "Enter a number" write </title> </head>
-      <body>
-        <form =action "post" =method form>
-          <p> 
-            "Enter a number:" write
-            <input "text" =type "num" =name "20" =size input/>
-            <input "submit" =type "Press to continue" =value input/>
-          </p>
-        </form>
-      </body>
-    </html>
-  ] show [ "num" get ] bind string>number ;
-
-: guess-banner
-  "I'm thinking of a number between 0 and 100." web-print ;
-: guess-prompt  ;
-: too-high "Too high" web-print ;
-: too-low "Too low" web-print ;
-: correct "Correct - you win!" web-print ;
-: inexact-guess ( actual guess -- )
-     < [ too-high ] [ too-low ] if ;
-
-: judge-guess ( actual guess -- ? )
-    2dup = [
-        2drop correct f
-    ] [
-        inexact-guess t
-    ] if ;
-
-: number-to-guess ( -- n ) 100 random-int ;
-
-: numbers-game-loop ( actual -- )
-    dup guess-prompt read-number judge-guess [
-        numbers-game-loop
-    ] [
-        drop
-    ] if ;
-
-: numbers-game number-to-guess numbers-game-loop ;
-
-"numbers-game" [ numbers-game ] install-cont-responder
diff --git a/libs/httpd/examples/load.factor b/libs/httpd/examples/load.factor
deleted file mode 100644 (file)
index b325e06..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-USING: modules ;
-
-REQUIRES: libs/httpd ;
-
-{ 
-    "resource:libs/httpd/examples/cont-examples.factor"
-    "resource:libs/httpd/examples/cont-numbers-game.factor"
-} run-files
diff --git a/libs/httpd/file-responder.factor b/libs/httpd/file-responder.factor
deleted file mode 100644 (file)
index 0e44afb..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: calendar embedded errors html httpd io kernel math
-namespaces parser sequences strings hashtables ;
-IN: file-responder
-
-: serving-path ( filename -- filename )
-    [ "" ] unless* "doc-root" get swap path+ ;
-
-: file-http-date ( filename -- string )
-    file-modified unix>gmt timestamp>http-string ;
-
-: file-response ( filename mime-type -- )
-    [
-        "Content-Type" set
-        dup file-length number>string "Content-Length" set
-        file-http-date "Last-Modified" set
-        now timestamp>http-string "Date" set
-    ] make-hash "200 OK" response terpri ;
-
-: last-modified-matches? ( filename -- bool )
-    file-http-date dup [
-        "If-Modified-Since" "header" get hash = 
-    ] when ;
-
-: not-modified-response ( -- )
-    now timestamp>http-string "Date" associate
-    "304 Not Modified" response terpri ;  
-
-: serve-static ( filename mime-type -- )
-    over last-modified-matches? [
-        2drop not-modified-response
-    ] [
-        dupd file-response
-        "method" get "head" = [
-            drop
-        ] [
-            <file-reader> stdio get stream-copy
-        ] if 
-    ] if ;
-
-SYMBOL: page
-
-: run-page ( filename -- )
-    dup
-    [ [ dup page set run-embedded-file ] with-scope ] try
-    drop ;
-
-: include-page ( filename -- )
-    "doc-root" get swap path+ run-page ;
-
-: serve-file ( filename -- )
-    dup mime-type dup "application/x-factor-server-page" =
-    [ drop serving-html run-page ] [ serve-static ] if ;
-
-: file. ( path name -- )
-    tuck path+
-    directory? "[DIR] " "      " ? write
-    write-pathname terpri ;
-
-: directory. ( path -- )
-    dup directory natural-sort [ file. ] each-with ;
-
-: list-directory ( directory -- )
-    serving-html
-     "method" get "head" = [
-        drop
-    ] [
-        "request" get [
-            "" swap directory.
-        ] simple-html-document
-    ] if ;
-
-: find-index ( filename -- path )
-    { "index.html" "index.fhtml" }
-    [ dupd path+ exists? ] find nip
-    dup [ path+ ] [ nip ] if ;
-
-: serve-directory ( filename -- )
-    dup "/" tail? [
-        dup find-index
-        [ serve-file ] [ list-directory ] ?if
-    ] [
-        drop directory-no/
-    ] if ;
-
-: serve-object ( filename -- )
-    dup directory? [ serve-directory ] [ serve-file ] if ;
-
-: file-responder ( -- )
-    "doc-root" get [
-        "argument" get serving-path dup exists? [
-            serve-object
-        ] [
-            drop "404 not found" httpd-error
-        ] if
-    ] [
-        "404 doc-root not set" httpd-error
-    ] if ;
diff --git a/libs/httpd/html-tags.factor b/libs/httpd/html-tags.factor
deleted file mode 100644 (file)
index ed635fe..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-! cont-html v0.6
-!
-! Copyright (C) 2004 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-IN: html
-USE: prettyprint
-USE: strings
-USE: kernel
-USE: io
-USE: namespaces
-USE: words
-USE: sequences
-
-! These words are used to provide a means of writing
-! formatted HTML to standard output with a familiar 'html' look
-! and feel in the code. 
-!
-! HTML tags can be used in a number of different ways. The highest
-! level involves a similar syntax to HTML:
-! 
-! <p> "someoutput" write </p>
-!
-! <p> will output the opening tag and </p> will output the closing
-! tag with no attributes.
-!
-! <p "red" =class p> "someoutput" write </p>
-!
-! This time the opening tag does not have the '>'. It pushes
-! a namespace on the stack to hold the attributes and values.
-! Any attribute words used will store the attribute and values
-! in that namespace. Before the attribute word should come the
-! value of that attribute.
-! The finishing word will print out the operning tag including
-! attributes. 
-! Any writes after this will appear after the opening tag.
-!
-! Values for attributes can be used directly without any stack
-! operations:
-!
-! (url -- )
-! <a =href a> "Click me" write </a>
-!
-! (url -- )
-! <a "http://" swap append =href a> "click" write </a>
-!
-! (url -- )
-! <a [ "http://" % % ] "" make =href a> "click" write </a>
-!
-! Tags that have no 'closing' equivalent have a trailing tag/> form:
-!
-! <input "text" =type "name" =name "20" =size input/>
-
-SYMBOL: html
-
-: write-html ( str -- )
-    H{ { html t } } format ;
-
-: html-word ( name def -- )
-    #! Define 'word creating' word to allow
-    #! dynamically creating words.
-    >r "html" create r> define-compound ;
-: <foo> "<" swap ">" 3append ;
-
-: def-for-html-word-<foo> ( name -- )
-    #! Return the name and code for the <foo> patterned
-    #! word.
-    dup <foo> swap [ <foo> write-html ] curry html-word ;
-
-: <foo "<" swap append ;
-
-: def-for-html-word-<foo ( name -- )
-    #! Return the name and code for the <foo patterned
-    #! word.
-    <foo dup [ write-html ] curry html-word ;
-
-: foo> ">" append ;
-
-: def-for-html-word-foo> ( name -- )
-    #! Return the name and code for the foo> patterned
-    #! word.
-    foo> [ ">" write-html ] html-word ;
-
-: </foo> [ "</" % % ">" % ] "" make ;
-
-: def-for-html-word-</foo> ( name -- )
-    #! Return the name and code for the </foo> patterned
-    #! word.    
-    </foo> dup [ write-html ] curry html-word ;
-
-: <foo/> [ "<" % % "/>" % ] "" make ;
-
-: def-for-html-word-<foo/> ( name -- )
-    #! Return the name and code for the <foo/> patterned
-    #! word.
-    dup <foo/> swap [ <foo/> write-html ] curry html-word ;
-
-: foo/> "/>" append ;
-
-: def-for-html-word-foo/> ( name -- )
-    #! Return the name and code for the foo/> patterned
-    #! word.    
-    foo/> [ "/>" write-html ] html-word ;
-
-: define-closed-html-word ( name -- ) 
-    #! Given an HTML tag name, define the words for
-    #! that closable HTML tag.
-    dup def-for-html-word-<foo>
-    dup def-for-html-word-<foo
-    dup def-for-html-word-foo>
-    def-for-html-word-</foo> ;
-
-: define-open-html-word ( name -- ) 
-    #! Given an HTML tag name, define the words for
-    #! that open HTML tag.
-    dup def-for-html-word-<foo/>
-    dup def-for-html-word-<foo
-    def-for-html-word-foo/> ;
-
-: write-attr ( value name -- )
-    " " write-html
-    write-html
-    "='" write-html
-    write
-    "'" write-html ;
-
-: define-attribute-word ( name -- )
-    dup "=" swap append swap
-    [ write-attr ] curry html-word ;
-
-! Define some closed HTML tags
-[
-    "h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8" "h9"    
-    "ol" "li" "form" "a" "p" "html" "head" "body" "title"
-    "b" "i" "ul" "table" "tbody" "tr" "td" "th" "pre" "textarea"
-    "script" "div" "span" "select" "option" "style"
-] [ define-closed-html-word ] each
-
-! Define some open HTML tags
-[ 
-    "input" 
-    "br" 
-    "link"
-    "img"
-] [ define-open-html-word ] each
-
-! Define some attributes
-[ 
-    "method" "action" "type" "value" "name" 
-    "size" "href" "class" "border" "rows" "cols" 
-    "id" "onclick" "style" "valign" "accesskey"
-    "src" "language" "colspan" "onchange" "rel"
-    "width" "selected" "onsubmit"
-] [ define-attribute-word ] each 
diff --git a/libs/httpd/html.factor b/libs/httpd/html.factor
deleted file mode 100644 (file)
index fcdd231..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: callback-responder generic hashtables help http tools
-io kernel math namespaces prototype-js sequences strings styles
-words xml ;
-IN: html
-
-: hex-color, ( triplet -- )
-    3 head-slice
-    [ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ;
-
-: fg-css, ( color -- )
-    "color: #" % hex-color, "; " % ;
-
-: bg-css, ( color -- )
-    "background-color: #" % hex-color, "; " % ;
-
-: style-css, ( flag -- )
-    dup
-    { italic bold-italic } member?
-    "font-style: " % "italic" "normal" ? % "; " %
-    { bold bold-italic } member?
-    "font-weight: " % "bold" "normal" ? % "; " % ;
-
-: size-css, ( size -- )
-    "font-size: " % # "pt; " % ;
-
-: font-css, ( font -- )
-    "font-family: " % % "; " % ;
-
-: hash-apply ( value-hash quot-hash -- )
-    #! Looks up the key of each pair in the first list in the
-    #! second list to produce a quotation. The quotation is
-    #! applied to the value of the pair. If there is no
-    #! corresponding quotation, the value is popped off the
-    #! stack.
-    swap [
-        swap rot hash dup [ call ] [ 2drop ] if
-    ] hash-each-with ;
-
-: span-css-style ( style -- str )
-    [
-        H{
-            { foreground  [ fg-css,        ] }
-            { background  [ bg-css,        ] }
-            { font        [ font-css,      ] }
-            { font-style  [ style-css,     ] }
-            { font-size   [ size-css,      ] }
-        } hash-apply
-    ] "" make ;
-
-: span-tag ( style quot -- )
-    over span-css-style dup empty? [
-        drop call
-    ] [
-        <span =style span> call </span>
-    ] if ;
-
-: border-css, ( border -- )
-    "border: 1px solid #" % hex-color, "; " % ;
-
-: padding-css, ( padding -- ) "padding: " % # "px; " % ;
-
-: pre-css, ( -- )
-    "white-space: pre; font-family: monospace; " % ;
-
-: div-css-style ( style -- str )
-    [
-        H{
-            { page-color [ bg-css, ] }
-            { border-color [ border-css, ] }
-            { border-width [ padding-css, ] }
-            { wrap-margin [ [ pre-css, ] unless ] }
-        } hash-apply
-    ] "" make ;
-
-: div-tag ( style quot -- )
-    swap div-css-style dup empty? [
-        drop call
-    ] [
-        <div =style div> call </div>
-    ] if ;
-
-: do-escaping ( string style -- string )
-    html swap hash [ chars>entities ] unless ;
-
-GENERIC: browser-link-href ( presented -- href )
-
-M: object browser-link-href drop f ;
-
-M: pathname browser-link-href pathname-string url-encode ;
-
-: object-link-tag ( style quot -- )
-    presented pick hash browser-link-href
-    [ <a =href a> call </a> ] [ call ] if* ;
-
-TUPLE: nested-stream ;
-
-C: nested-stream [ set-delegate ] keep ;
-
-M: nested-stream stream-close drop ;
-
-TUPLE: html-stream ;
-
-C: html-stream ( stream -- stream ) [ set-delegate ] keep ;
-
-M: html-stream stream-write1 ( char stream -- )
-    >r ch>string r> stream-write ;
-
-: delegate-write delegate stream-write ;
-
-M: html-stream stream-write ( str stream -- )
-    >r chars>entities r> delegate-write ;
-
-: with-html-style ( quot style stream -- )
-    [ [ swap span-tag ] object-link-tag ] with-stream* ; inline
-
-M: html-stream with-stream-style ( quot style stream -- )
-    [ drop call ] -rot with-html-style ;
-
-M: html-stream stream-format ( str style stream -- )
-    [ do-escaping stdio get delegate-write ] -rot
-    with-html-style ;
-
-: with-html-stream ( quot -- )
-    stdio get <html-stream> swap with-stream* ;
-
-: make-outliner-quot
-    [
-        <div "padding-left: 20px; " =style div>
-            with-html-stream
-        </div>
-    ] curry ;
-            
-: html-outliner ( caption contents -- )
-    "+ " get-random-id dup >r
-    rot make-outliner-quot updating-anchor call
-    <span r> =id "display: none; " =style span> </span> ;
-
-: outliner-tag ( style quot -- )
-    outline pick hash [ html-outliner ] [ call ] if* ;
-
-M: html-stream with-nested-stream ( quot style stream -- )
-    [
-        [
-            [
-                [
-                    stdio get <nested-stream> swap with-stream*
-                ] div-tag
-            ] object-link-tag
-        ] outliner-tag
-    ] with-stream* ;
-
-: border-spacing-css,
-    "padding: " % first2 max 2 /i # "px; " % ;
-
-: table-style ( style -- str )
-    [
-        H{
-            { table-border [ border-css,         ] }
-            { table-gap    [ border-spacing-css, ] }
-        } hash-apply
-    ] "" make ;
-
-: table-attrs ( style -- )
-    table-style " border-collapse: collapse;" append =style ;
-
-M: html-stream with-stream-table ( grid quot style stream -- )
-    [
-        <table dup table-attrs table> rot [
-            <tr> [
-                <td "top" =valign over table-style =style td>
-                    pick H{ } swap with-nesting
-                </td>
-            ] each </tr>
-        ] each 2drop </table>
-    ] with-stream* ;
-
-M: html-stream stream-terpri [ <br/> ] with-stream* ;
-
-: default-css ( -- )
-    <link
-    "stylesheet" =rel "text/css" =type
-    "/responder/resources/stylesheet.css" =href
-    link/> ;
-
-: xhtml-preamble
-    "<?xml version=\"1.0\"?>" write-html
-    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" write-html ;
-
-: html-document ( title quot -- )
-    xhtml-preamble
-    swap chars>entities
-    <html " xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"" write-html html>
-        <head>
-            <title> write </title>
-            default-css
-            include-prototype-js
-        </head>
-        <body>
-            call
-        </body>
-    </html> ;
-
-: simple-html-document ( title quot -- )
-    swap [ <pre> with-html-stream </pre> ] html-document ;
diff --git a/libs/httpd/httpd.factor b/libs/httpd/httpd.factor
deleted file mode 100644 (file)
index 89e7775..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-! Copyright (C) 2003, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: httpd
-USING: errors hashtables kernel namespaces io strings 
-threads http sequences prettyprint ;
-
-: (url>path) ( uri -- path )
-    url-decode "http://" ?head [
-        "/" split1 dup "" ? nip
-    ] when ;
-
-: url>path ( uri -- path )
-    "?" split1 dup [
-      >r (url>path) "?" r> 3append
-    ] [
-      drop (url>path)
-    ] if ;
-
-: secure-path ( path -- path )
-    ".." over subseq? [ drop f ] when ;
-
-: request-method ( cmd -- method )
-    H{
-        { "GET" "get" }
-        { "POST" "post" }
-        { "HEAD" "head" }
-    } hash [ "bad" ] unless* ;
-
-: host ( -- string )
-    #! The host the current responder was called from.
-    "Host" "header" get hash ":" split1 drop ;
-
-: (handle-request) ( arg cmd -- method path host )
-    request-method dup "method" set swap
-    prepare-url prepare-header host ;
-
-: handle-request ( arg cmd -- )
-    [ (handle-request) serve-responder ] with-scope ;
-
-: parse-request ( request -- )
-    dup log-message
-    " " split1 dup [
-        " HTTP" split1 drop url>path secure-path dup [
-            swap handle-request
-        ] [
-            2drop bad-request
-        ] if
-    ] [
-        2drop bad-request
-    ] if ;
-
-: httpd ( port -- )
-    "Starting HTTP server on port " write dup . flush
-    \ httpd [
-        60000 stdio get set-timeout
-        readln [ parse-request ] when*
-    ] with-server ;
-
-: stop-httpd ( -- )
-    #! Stop the server.
-    \ httpd get stream-close ;
diff --git a/libs/httpd/load.factor b/libs/httpd/load.factor
deleted file mode 100644 (file)
index 1f27e14..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-USING: io ;
-
-REQUIRES: libs/calendar libs/http libs/xml ;
-
-PROVIDE: libs/httpd
-{ +files+ {
-    "mime.factor"
-    "html-tags.factor"
-    "responder.factor"
-    "httpd.factor"
-    "callback-responder.factor"
-    "cont-responder.factor"
-    "prototype-js.factor"
-    "html.factor"
-    "embedded.factor"
-    "file-responder.factor"
-    "default-responders.factor"
-} }
-{ +tests+ {
-    "test/html.factor"
-    "test/httpd.factor"
-    "test/url-encoding.factor"
-    "test/embedded.factor"
-} } ;
-
-USE: httpd
-MAIN: libs/httpd 8888 httpd ;
diff --git a/libs/httpd/mime.factor b/libs/httpd/mime.factor
deleted file mode 100644 (file)
index 0f04e8b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: httpd
-USING: io hashtables kernel sequences math namespaces ;
-
-: file-extension ( filename -- extension )
-    "." split dup length 1 <= [ drop f ] [ peek ] if ;
-
-: mime-type ( filename -- mime-type )
-    file-extension "mime-types" get
-    hash [ "text/plain" ] unless* ;
-
-H{
-    { "html"   "text/html"                        }
-    { "txt"    "text/plain"                       }
-    { "xml"    "text/xml"                         }
-    { "css"    "text/css"                         }
-                                                    
-    { "gif"    "image/gif"                        }
-    { "png"    "image/png"                        }
-    { "jpg"    "image/jpeg"                       }
-    { "jpeg"   "image/jpeg"                       }
-                                                    
-    { "jar"    "application/octet-stream"         }
-    { "zip"    "application/octet-stream"         }
-    { "tgz"    "application/octet-stream"         }
-    { "tar.gz" "application/octet-stream"         }
-    { "gz"     "application/octet-stream"         }
-
-    { "pdf"    "application/pdf"                  }
-
-    { "factor" "text/plain"                       }
-    { "fhtml"  "application/x-factor-server-page" }
-} "mime-types" global set-hash
diff --git a/libs/httpd/prototype-js.factor b/libs/httpd/prototype-js.factor
deleted file mode 100644 (file)
index 738ae3c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! Wrapper for the Prototype javascript library.
-! For information and license details for protoype 
-! see http://prototype.conio.net
-IN: prototype-js
-USING: callback-responder html httpd io kernel namespaces
-strings ;
-
-: include-prototype-js ( -- )
-  #! Write out the HTML script tag to include the prototype
-  #! javascript library.
-  <script "text/javascript" =type "/responder/resources/prototype.js"
-  =src script>
-  </script> ;
-
-: updating-javascript ( id quot -- string )
-  #! Return the javascript code to perform the updating
-  #! ajax call.
-  t register-html-callback swap 
-  [ "new Ajax.Updater(\"" % % "\",\"" % % "\", { method: \"get\" });" % ] "" make ;
-
-: toggle-javascript ( string id -- string )
-    [
-        "if(Element.visible(\"" % dup % "\"))" %
-        "Element.hide(\"" % dup % "\");" %
-        "else {" %
-        swap %
-        " Element.show(\"" % % "\"); }" %
-    ] "" make ;
-
-: updating-anchor ( text id quot -- )
-  #! Write the HTML for an anchor that when clicked will
-  #! call the given quotation on the server. The output generated
-  #! from that quotation will replace the DOM element on the page with
-  #! the given id. The 'text' is the anchor text.
-  over >r updating-javascript r> toggle-javascript
-  <a =onclick a> write </a> ;
diff --git a/libs/httpd/resources/prototype.js b/libs/httpd/resources/prototype.js
deleted file mode 100644 (file)
index 0e85338..0000000
+++ /dev/null
@@ -1,1781 +0,0 @@
-/*  Prototype JavaScript framework, version 1.4.0
- *  (c) 2005 Sam Stephenson <sam@conio.net>
- *
- *  Prototype is freely distributable under the terms of an MIT-style license.
- *  For details, see the Prototype web site: http://prototype.conio.net/
- *
-/*--------------------------------------------------------------------------*/
-
-var Prototype = {
-  Version: '1.4.0',
-  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
-
-  emptyFunction: function() {},
-  K: function(x) {return x}
-}
-
-var Class = {
-  create: function() {
-    return function() {
-      this.initialize.apply(this, arguments);
-    }
-  }
-}
-
-var Abstract = new Object();
-
-Object.extend = function(destination, source) {
-  for (property in source) {
-    destination[property] = source[property];
-  }
-  return destination;
-}
-
-Object.inspect = function(object) {
-  try {
-    if (object == undefined) return 'undefined';
-    if (object == null) return 'null';
-    return object.inspect ? object.inspect() : object.toString();
-  } catch (e) {
-    if (e instanceof RangeError) return '...';
-    throw e;
-  }
-}
-
-Function.prototype.bind = function() {
-  var __method = this, args = $A(arguments), object = args.shift();
-  return function() {
-    return __method.apply(object, args.concat($A(arguments)));
-  }
-}
-
-Function.prototype.bindAsEventListener = function(object) {
-  var __method = this;
-  return function(event) {
-    return __method.call(object, event || window.event);
-  }
-}
-
-Object.extend(Number.prototype, {
-  toColorPart: function() {
-    var digits = this.toString(16);
-    if (this < 16) return '0' + digits;
-    return digits;
-  },
-
-  succ: function() {
-    return this + 1;
-  },
-
-  times: function(iterator) {
-    $R(0, this, true).each(iterator);
-    return this;
-  }
-});
-
-var Try = {
-  these: function() {
-    var returnValue;
-
-    for (var i = 0; i < arguments.length; i++) {
-      var lambda = arguments[i];
-      try {
-        returnValue = lambda();
-        break;
-      } catch (e) {}
-    }
-
-    return returnValue;
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
-  initialize: function(callback, frequency) {
-    this.callback = callback;
-    this.frequency = frequency;
-    this.currentlyExecuting = false;
-
-    this.registerCallback();
-  },
-
-  registerCallback: function() {
-    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
-  },
-
-  onTimerEvent: function() {
-    if (!this.currentlyExecuting) {
-      try {
-        this.currentlyExecuting = true;
-        this.callback();
-      } finally {
-        this.currentlyExecuting = false;
-      }
-    }
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-function $() {
-  var elements = new Array();
-
-  for (var i = 0; i < arguments.length; i++) {
-    var element = arguments[i];
-    if (typeof element == 'string')
-      element = document.getElementById(element);
-
-    if (arguments.length == 1)
-      return element;
-
-    elements.push(element);
-  }
-
-  return elements;
-}
-Object.extend(String.prototype, {
-  stripTags: function() {
-    return this.replace(/<\/?[^>]+>/gi, '');
-  },
-
-  stripScripts: function() {
-    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
-  },
-
-  extractScripts: function() {
-    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
-    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
-    return (this.match(matchAll) || []).map(function(scriptTag) {
-      return (scriptTag.match(matchOne) || ['', ''])[1];
-    });
-  },
-
-  evalScripts: function() {
-    return this.extractScripts().map(eval);
-  },
-
-  escapeHTML: function() {
-    var div = document.createElement('div');
-    var text = document.createTextNode(this);
-    div.appendChild(text);
-    return div.innerHTML;
-  },
-
-  unescapeHTML: function() {
-    var div = document.createElement('div');
-    div.innerHTML = this.stripTags();
-    return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
-  },
-
-  toQueryParams: function() {
-    var pairs = this.match(/^\??(.*)$/)[1].split('&');
-    return pairs.inject({}, function(params, pairString) {
-      var pair = pairString.split('=');
-      params[pair[0]] = pair[1];
-      return params;
-    });
-  },
-
-  toArray: function() {
-    return this.split('');
-  },
-
-  camelize: function() {
-    var oStringList = this.split('-');
-    if (oStringList.length == 1) return oStringList[0];
-
-    var camelizedString = this.indexOf('-') == 0
-      ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
-      : oStringList[0];
-
-    for (var i = 1, len = oStringList.length; i < len; i++) {
-      var s = oStringList[i];
-      camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
-    }
-
-    return camelizedString;
-  },
-
-  inspect: function() {
-    return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'";
-  }
-});
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-var $break    = new Object();
-var $continue = new Object();
-
-var Enumerable = {
-  each: function(iterator) {
-    var index = 0;
-    try {
-      this._each(function(value) {
-        try {
-          iterator(value, index++);
-        } catch (e) {
-          if (e != $continue) throw e;
-        }
-      });
-    } catch (e) {
-      if (e != $break) throw e;
-    }
-  },
-
-  all: function(iterator) {
-    var result = true;
-    this.each(function(value, index) {
-      result = result && !!(iterator || Prototype.K)(value, index);
-      if (!result) throw $break;
-    });
-    return result;
-  },
-
-  any: function(iterator) {
-    var result = true;
-    this.each(function(value, index) {
-      if (result = !!(iterator || Prototype.K)(value, index))
-        throw $break;
-    });
-    return result;
-  },
-
-  collect: function(iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      results.push(iterator(value, index));
-    });
-    return results;
-  },
-
-  detect: function (iterator) {
-    var result;
-    this.each(function(value, index) {
-      if (iterator(value, index)) {
-        result = value;
-        throw $break;
-      }
-    });
-    return result;
-  },
-
-  findAll: function(iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      if (iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  grep: function(pattern, iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      var stringValue = value.toString();
-      if (stringValue.match(pattern))
-        results.push((iterator || Prototype.K)(value, index));
-    })
-    return results;
-  },
-
-  include: function(object) {
-    var found = false;
-    this.each(function(value) {
-      if (value == object) {
-        found = true;
-        throw $break;
-      }
-    });
-    return found;
-  },
-
-  inject: function(memo, iterator) {
-    this.each(function(value, index) {
-      memo = iterator(memo, value, index);
-    });
-    return memo;
-  },
-
-  invoke: function(method) {
-    var args = $A(arguments).slice(1);
-    return this.collect(function(value) {
-      return value[method].apply(value, args);
-    });
-  },
-
-  max: function(iterator) {
-    var result;
-    this.each(function(value, index) {
-      value = (iterator || Prototype.K)(value, index);
-      if (value >= (result || value))
-        result = value;
-    });
-    return result;
-  },
-
-  min: function(iterator) {
-    var result;
-    this.each(function(value, index) {
-      value = (iterator || Prototype.K)(value, index);
-      if (value <= (result || value))
-        result = value;
-    });
-    return result;
-  },
-
-  partition: function(iterator) {
-    var trues = [], falses = [];
-    this.each(function(value, index) {
-      ((iterator || Prototype.K)(value, index) ?
-        trues : falses).push(value);
-    });
-    return [trues, falses];
-  },
-
-  pluck: function(property) {
-    var results = [];
-    this.each(function(value, index) {
-      results.push(value[property]);
-    });
-    return results;
-  },
-
-  reject: function(iterator) {
-    var results = [];
-    this.each(function(value, index) {
-      if (!iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  sortBy: function(iterator) {
-    return this.collect(function(value, index) {
-      return {value: value, criteria: iterator(value, index)};
-    }).sort(function(left, right) {
-      var a = left.criteria, b = right.criteria;
-      return a < b ? -1 : a > b ? 1 : 0;
-    }).pluck('value');
-  },
-
-  toArray: function() {
-    return this.collect(Prototype.K);
-  },
-
-  zip: function() {
-    var iterator = Prototype.K, args = $A(arguments);
-    if (typeof args.last() == 'function')
-      iterator = args.pop();
-
-    var collections = [this].concat(args).map($A);
-    return this.map(function(value, index) {
-      iterator(value = collections.pluck(index));
-      return value;
-    });
-  },
-
-  inspect: function() {
-    return '#<Enumerable:' + this.toArray().inspect() + '>';
-  }
-}
-
-Object.extend(Enumerable, {
-  map:     Enumerable.collect,
-  find:    Enumerable.detect,
-  select:  Enumerable.findAll,
-  member:  Enumerable.include,
-  entries: Enumerable.toArray
-});
-var $A = Array.from = function(iterable) {
-  if (!iterable) return [];
-  if (iterable.toArray) {
-    return iterable.toArray();
-  } else {
-    var results = [];
-    for (var i = 0; i < iterable.length; i++)
-      results.push(iterable[i]);
-    return results;
-  }
-}
-
-Object.extend(Array.prototype, Enumerable);
-
-Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
-  _each: function(iterator) {
-    for (var i = 0; i < this.length; i++)
-      iterator(this[i]);
-  },
-
-  clear: function() {
-    this.length = 0;
-    return this;
-  },
-
-  first: function() {
-    return this[0];
-  },
-
-  last: function() {
-    return this[this.length - 1];
-  },
-
-  compact: function() {
-    return this.select(function(value) {
-      return value != undefined || value != null;
-    });
-  },
-
-  flatten: function() {
-    return this.inject([], function(array, value) {
-      return array.concat(value.constructor == Array ?
-        value.flatten() : [value]);
-    });
-  },
-
-  without: function() {
-    var values = $A(arguments);
-    return this.select(function(value) {
-      return !values.include(value);
-    });
-  },
-
-  indexOf: function(object) {
-    for (var i = 0; i < this.length; i++)
-      if (this[i] == object) return i;
-    return -1;
-  },
-
-  reverse: function(inline) {
-    return (inline !== false ? this : this.toArray())._reverse();
-  },
-
-  shift: function() {
-    var result = this[0];
-    for (var i = 0; i < this.length - 1; i++)
-      this[i] = this[i + 1];
-    this.length--;
-    return result;
-  },
-
-  inspect: function() {
-    return '[' + this.map(Object.inspect).join(', ') + ']';
-  }
-});
-var Hash = {
-  _each: function(iterator) {
-    for (key in this) {
-      var value = this[key];
-      if (typeof value == 'function') continue;
-
-      var pair = [key, value];
-      pair.key = key;
-      pair.value = value;
-      iterator(pair);
-    }
-  },
-
-  keys: function() {
-    return this.pluck('key');
-  },
-
-  values: function() {
-    return this.pluck('value');
-  },
-
-  merge: function(hash) {
-    return $H(hash).inject($H(this), function(mergedHash, pair) {
-      mergedHash[pair.key] = pair.value;
-      return mergedHash;
-    });
-  },
-
-  toQueryString: function() {
-    return this.map(function(pair) {
-      return pair.map(encodeURIComponent).join('=');
-    }).join('&');
-  },
-
-  inspect: function() {
-    return '#<Hash:{' + this.map(function(pair) {
-      return pair.map(Object.inspect).join(': ');
-    }).join(', ') + '}>';
-  }
-}
-
-function $H(object) {
-  var hash = Object.extend({}, object || {});
-  Object.extend(hash, Enumerable);
-  Object.extend(hash, Hash);
-  return hash;
-}
-ObjectRange = Class.create();
-Object.extend(ObjectRange.prototype, Enumerable);
-Object.extend(ObjectRange.prototype, {
-  initialize: function(start, end, exclusive) {
-    this.start = start;
-    this.end = end;
-    this.exclusive = exclusive;
-  },
-
-  _each: function(iterator) {
-    var value = this.start;
-    do {
-      iterator(value);
-      value = value.succ();
-    } while (this.include(value));
-  },
-
-  include: function(value) {
-    if (value < this.start)
-      return false;
-    if (this.exclusive)
-      return value < this.end;
-    return value <= this.end;
-  }
-});
-
-var $R = function(start, end, exclusive) {
-  return new ObjectRange(start, end, exclusive);
-}
-
-var Ajax = {
-  getTransport: function() {
-    return Try.these(
-      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
-      function() {return new ActiveXObject('Microsoft.XMLHTTP')},
-      function() {return new XMLHttpRequest()}
-    ) || false;
-  },
-
-  activeRequestCount: 0
-}
-
-Ajax.Responders = {
-  responders: [],
-
-  _each: function(iterator) {
-    this.responders._each(iterator);
-  },
-
-  register: function(responderToAdd) {
-    if (!this.include(responderToAdd))
-      this.responders.push(responderToAdd);
-  },
-
-  unregister: function(responderToRemove) {
-    this.responders = this.responders.without(responderToRemove);
-  },
-
-  dispatch: function(callback, request, transport, json) {
-    this.each(function(responder) {
-      if (responder[callback] && typeof responder[callback] == 'function') {
-        try {
-          responder[callback].apply(responder, [request, transport, json]);
-        } catch (e) {}
-      }
-    });
-  }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
-  onCreate: function() {
-    Ajax.activeRequestCount++;
-  },
-
-  onComplete: function() {
-    Ajax.activeRequestCount--;
-  }
-});
-
-Ajax.Base = function() {};
-Ajax.Base.prototype = {
-  setOptions: function(options) {
-    this.options = {
-      method:       'post',
-      asynchronous: true,
-      parameters:   ''
-    }
-    Object.extend(this.options, options || {});
-  },
-
-  responseIsSuccess: function() {
-    return this.transport.status == undefined
-        || this.transport.status == 0
-        || (this.transport.status >= 200 && this.transport.status < 300);
-  },
-
-  responseIsFailure: function() {
-    return !this.responseIsSuccess();
-  }
-}
-
-Ajax.Request = Class.create();
-Ajax.Request.Events =
-  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
-  initialize: function(url, options) {
-    this.transport = Ajax.getTransport();
-    this.setOptions(options);
-    this.request(url);
-  },
-
-  request: function(url) {
-    var parameters = this.options.parameters || '';
-    if (parameters.length > 0) parameters += '&_=';
-
-    try {
-      this.url = url;
-      if (this.options.method == 'get' && parameters.length > 0)
-        this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
-
-      Ajax.Responders.dispatch('onCreate', this, this.transport);
-
-      this.transport.open(this.options.method, this.url,
-        this.options.asynchronous);
-
-      if (this.options.asynchronous) {
-        this.transport.onreadystatechange = this.onStateChange.bind(this);
-        setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
-      }
-
-      this.setRequestHeaders();
-
-      var body = this.options.postBody ? this.options.postBody : parameters;
-      this.transport.send(this.options.method == 'post' ? body : null);
-
-    } catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  setRequestHeaders: function() {
-    var requestHeaders =
-      ['X-Requested-With', 'XMLHttpRequest',
-       'X-Prototype-Version', Prototype.Version];
-
-    if (this.options.method == 'post') {
-      requestHeaders.push('Content-type',
-        'application/x-www-form-urlencoded');
-
-      /* Force "Connection: close" for Mozilla browsers to work around
-       * a bug where XMLHttpReqeuest sends an incorrect Content-length
-       * header. See Mozilla Bugzilla #246651.
-       */
-      if (this.transport.overrideMimeType)
-        requestHeaders.push('Connection', 'close');
-    }
-
-    if (this.options.requestHeaders)
-      requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
-
-    for (var i = 0; i < requestHeaders.length; i += 2)
-      this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
-  },
-
-  onStateChange: function() {
-    var readyState = this.transport.readyState;
-    if (readyState != 1)
-      this.respondToReadyState(this.transport.readyState);
-  },
-
-  header: function(name) {
-    try {
-      return this.transport.getResponseHeader(name);
-    } catch (e) {}
-  },
-
-  evalJSON: function() {
-    try {
-      return eval(this.header('X-JSON'));
-    } catch (e) {}
-  },
-
-  evalResponse: function() {
-    try {
-      return eval(this.transport.responseText);
-    } catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  respondToReadyState: function(readyState) {
-    var event = Ajax.Request.Events[readyState];
-    var transport = this.transport, json = this.evalJSON();
-
-    if (event == 'Complete') {
-      try {
-        (this.options['on' + this.transport.status]
-         || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
-         || Prototype.emptyFunction)(transport, json);
-      } catch (e) {
-        this.dispatchException(e);
-      }
-
-      if ((this.header('Content-type') || '').match(/^text\/javascript/i))
-        this.evalResponse();
-    }
-
-    try {
-      (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
-      Ajax.Responders.dispatch('on' + event, this, transport, json);
-    } catch (e) {
-      this.dispatchException(e);
-    }
-
-    /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
-    if (event == 'Complete')
-      this.transport.onreadystatechange = Prototype.emptyFunction;
-  },
-
-  dispatchException: function(exception) {
-    (this.options.onException || Prototype.emptyFunction)(this, exception);
-    Ajax.Responders.dispatch('onException', this, exception);
-  }
-});
-
-Ajax.Updater = Class.create();
-
-Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
-  initialize: function(container, url, options) {
-    this.containers = {
-      success: container.success ? $(container.success) : $(container),
-      failure: container.failure ? $(container.failure) :
-        (container.success ? null : $(container))
-    }
-
-    this.transport = Ajax.getTransport();
-    this.setOptions(options);
-
-    var onComplete = this.options.onComplete || Prototype.emptyFunction;
-    this.options.onComplete = (function(transport, object) {
-      this.updateContent();
-      onComplete(transport, object);
-    }).bind(this);
-
-    this.request(url);
-  },
-
-  updateContent: function() {
-    var receiver = this.responseIsSuccess() ?
-      this.containers.success : this.containers.failure;
-    var response = this.transport.responseText;
-
-    if (!this.options.evalScripts)
-      response = response.stripScripts();
-
-    if (receiver) {
-      if (this.options.insertion) {
-        new this.options.insertion(receiver, response);
-      } else {
-        Element.update(receiver, response);
-      }
-    }
-
-    if (this.responseIsSuccess()) {
-      if (this.onComplete)
-        setTimeout(this.onComplete.bind(this), 10);
-    }
-  }
-});
-
-Ajax.PeriodicalUpdater = Class.create();
-Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
-  initialize: function(container, url, options) {
-    this.setOptions(options);
-    this.onComplete = this.options.onComplete;
-
-    this.frequency = (this.options.frequency || 2);
-    this.decay = (this.options.decay || 1);
-
-    this.updater = {};
-    this.container = container;
-    this.url = url;
-
-    this.start();
-  },
-
-  start: function() {
-    this.options.onComplete = this.updateComplete.bind(this);
-    this.onTimerEvent();
-  },
-
-  stop: function() {
-    this.updater.onComplete = undefined;
-    clearTimeout(this.timer);
-    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
-  },
-
-  updateComplete: function(request) {
-    if (this.options.decay) {
-      this.decay = (request.responseText == this.lastText ?
-        this.decay * this.options.decay : 1);
-
-      this.lastText = request.responseText;
-    }
-    this.timer = setTimeout(this.onTimerEvent.bind(this),
-      this.decay * this.frequency * 1000);
-  },
-
-  onTimerEvent: function() {
-    this.updater = new Ajax.Updater(this.container, this.url, this.options);
-  }
-});
-document.getElementsByClassName = function(className, parentElement) {
-  var children = ($(parentElement) || document.body).getElementsByTagName('*');
-  return $A(children).inject([], function(elements, child) {
-    if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
-      elements.push(child);
-    return elements;
-  });
-}
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Element) {
-  var Element = new Object();
-}
-
-Object.extend(Element, {
-  visible: function(element) {
-    return $(element).style.display != 'none';
-  },
-
-  toggle: function() {
-    for (var i = 0; i < arguments.length; i++) {
-      var element = $(arguments[i]);
-      Element[Element.visible(element) ? 'hide' : 'show'](element);
-    }
-  },
-
-  hide: function() {
-    for (var i = 0; i < arguments.length; i++) {
-      var element = $(arguments[i]);
-      element.style.display = 'none';
-    }
-  },
-
-  show: function() {
-    for (var i = 0; i < arguments.length; i++) {
-      var element = $(arguments[i]);
-      element.style.display = '';
-    }
-  },
-
-  remove: function(element) {
-    element = $(element);
-    element.parentNode.removeChild(element);
-  },
-
-  update: function(element, html) {
-    $(element).innerHTML = html.stripScripts();
-    setTimeout(function() {html.evalScripts()}, 10);
-  },
-
-  getHeight: function(element) {
-    element = $(element);
-    return element.offsetHeight;
-  },
-
-  classNames: function(element) {
-    return new Element.ClassNames(element);
-  },
-
-  hasClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    return Element.classNames(element).include(className);
-  },
-
-  addClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    return Element.classNames(element).add(className);
-  },
-
-  removeClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    return Element.classNames(element).remove(className);
-  },
-
-  // removes whitespace-only text node children
-  cleanWhitespace: function(element) {
-    element = $(element);
-    for (var i = 0; i < element.childNodes.length; i++) {
-      var node = element.childNodes[i];
-      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
-        Element.remove(node);
-    }
-  },
-
-  empty: function(element) {
-    return $(element).innerHTML.match(/^\s*$/);
-  },
-
-  scrollTo: function(element) {
-    element = $(element);
-    var x = element.x ? element.x : element.offsetLeft,
-        y = element.y ? element.y : element.offsetTop;
-    window.scrollTo(x, y);
-  },
-
-  getStyle: function(element, style) {
-    element = $(element);
-    var value = element.style[style.camelize()];
-    if (!value) {
-      if (document.defaultView && document.defaultView.getComputedStyle) {
-        var css = document.defaultView.getComputedStyle(element, null);
-        value = css ? css.getPropertyValue(style) : null;
-      } else if (element.currentStyle) {
-        value = element.currentStyle[style.camelize()];
-      }
-    }
-
-    if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
-      if (Element.getStyle(element, 'position') == 'static') value = 'auto';
-
-    return value == 'auto' ? null : value;
-  },
-
-  setStyle: function(element, style) {
-    element = $(element);
-    for (name in style)
-      element.style[name.camelize()] = style[name];
-  },
-
-  getDimensions: function(element) {
-    element = $(element);
-    if (Element.getStyle(element, 'display') != 'none')
-      return {width: element.offsetWidth, height: element.offsetHeight};
-
-    // All *Width and *Height properties give 0 on elements with display none,
-    // so enable the element temporarily
-    var els = element.style;
-    var originalVisibility = els.visibility;
-    var originalPosition = els.position;
-    els.visibility = 'hidden';
-    els.position = 'absolute';
-    els.display = '';
-    var originalWidth = element.clientWidth;
-    var originalHeight = element.clientHeight;
-    els.display = 'none';
-    els.position = originalPosition;
-    els.visibility = originalVisibility;
-    return {width: originalWidth, height: originalHeight};
-  },
-
-  makePositioned: function(element) {
-    element = $(element);
-    var pos = Element.getStyle(element, 'position');
-    if (pos == 'static' || !pos) {
-      element._madePositioned = true;
-      element.style.position = 'relative';
-      // Opera returns the offset relative to the positioning context, when an
-      // element is position relative but top and left have not been defined
-      if (window.opera) {
-        element.style.top = 0;
-        element.style.left = 0;
-      }
-    }
-  },
-
-  undoPositioned: function(element) {
-    element = $(element);
-    if (element._madePositioned) {
-      element._madePositioned = undefined;
-      element.style.position =
-        element.style.top =
-        element.style.left =
-        element.style.bottom =
-        element.style.right = '';
-    }
-  },
-
-  makeClipping: function(element) {
-    element = $(element);
-    if (element._overflow) return;
-    element._overflow = element.style.overflow;
-    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
-      element.style.overflow = 'hidden';
-  },
-
-  undoClipping: function(element) {
-    element = $(element);
-    if (element._overflow) return;
-    element.style.overflow = element._overflow;
-    element._overflow = undefined;
-  }
-});
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
-  this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
-  initialize: function(element, content) {
-    this.element = $(element);
-    this.content = content.stripScripts();
-
-    if (this.adjacency && this.element.insertAdjacentHTML) {
-      try {
-        this.element.insertAdjacentHTML(this.adjacency, this.content);
-      } catch (e) {
-        if (this.element.tagName.toLowerCase() == 'tbody') {
-          this.insertContent(this.contentFromAnonymousTable());
-        } else {
-          throw e;
-        }
-      }
-    } else {
-      this.range = this.element.ownerDocument.createRange();
-      if (this.initializeRange) this.initializeRange();
-      this.insertContent([this.range.createContextualFragment(this.content)]);
-    }
-
-    setTimeout(function() {content.evalScripts()}, 10);
-  },
-
-  contentFromAnonymousTable: function() {
-    var div = document.createElement('div');
-    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
-    return $A(div.childNodes[0].childNodes[0].childNodes);
-  }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
-  initializeRange: function() {
-    this.range.setStartBefore(this.element);
-  },
-
-  insertContent: function(fragments) {
-    fragments.each((function(fragment) {
-      this.element.parentNode.insertBefore(fragment, this.element);
-    }).bind(this));
-  }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
-  initializeRange: function() {
-    this.range.selectNodeContents(this.element);
-    this.range.collapse(true);
-  },
-
-  insertContent: function(fragments) {
-    fragments.reverse(false).each((function(fragment) {
-      this.element.insertBefore(fragment, this.element.firstChild);
-    }).bind(this));
-  }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
-  initializeRange: function() {
-    this.range.selectNodeContents(this.element);
-    this.range.collapse(this.element);
-  },
-
-  insertContent: function(fragments) {
-    fragments.each((function(fragment) {
-      this.element.appendChild(fragment);
-    }).bind(this));
-  }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
-  initializeRange: function() {
-    this.range.setStartAfter(this.element);
-  },
-
-  insertContent: function(fragments) {
-    fragments.each((function(fragment) {
-      this.element.parentNode.insertBefore(fragment,
-        this.element.nextSibling);
-    }).bind(this));
-  }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
-  initialize: function(element) {
-    this.element = $(element);
-  },
-
-  _each: function(iterator) {
-    this.element.className.split(/\s+/).select(function(name) {
-      return name.length > 0;
-    })._each(iterator);
-  },
-
-  set: function(className) {
-    this.element.className = className;
-  },
-
-  add: function(classNameToAdd) {
-    if (this.include(classNameToAdd)) return;
-    this.set(this.toArray().concat(classNameToAdd).join(' '));
-  },
-
-  remove: function(classNameToRemove) {
-    if (!this.include(classNameToRemove)) return;
-    this.set(this.select(function(className) {
-      return className != classNameToRemove;
-    }).join(' '));
-  },
-
-  toString: function() {
-    return this.toArray().join(' ');
-  }
-}
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Field = {
-  clear: function() {
-    for (var i = 0; i < arguments.length; i++)
-      $(arguments[i]).value = '';
-  },
-
-  focus: function(element) {
-    $(element).focus();
-  },
-
-  present: function() {
-    for (var i = 0; i < arguments.length; i++)
-      if ($(arguments[i]).value == '') return false;
-    return true;
-  },
-
-  select: function(element) {
-    $(element).select();
-  },
-
-  activate: function(element) {
-    element = $(element);
-    element.focus();
-    if (element.select)
-      element.select();
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Form = {
-  serialize: function(form) {
-    var elements = Form.getElements($(form));
-    var queryComponents = new Array();
-
-    for (var i = 0; i < elements.length; i++) {
-      var queryComponent = Form.Element.serialize(elements[i]);
-      if (queryComponent)
-        queryComponents.push(queryComponent);
-    }
-
-    return queryComponents.join('&');
-  },
-
-  getElements: function(form) {
-    form = $(form);
-    var elements = new Array();
-
-    for (tagName in Form.Element.Serializers) {
-      var tagElements = form.getElementsByTagName(tagName);
-      for (var j = 0; j < tagElements.length; j++)
-        elements.push(tagElements[j]);
-    }
-    return elements;
-  },
-
-  getInputs: function(form, typeName, name) {
-    form = $(form);
-    var inputs = form.getElementsByTagName('input');
-
-    if (!typeName && !name)
-      return inputs;
-
-    var matchingInputs = new Array();
-    for (var i = 0; i < inputs.length; i++) {
-      var input = inputs[i];
-      if ((typeName && input.type != typeName) ||
-          (name && input.name != name))
-        continue;
-      matchingInputs.push(input);
-    }
-
-    return matchingInputs;
-  },
-
-  disable: function(form) {
-    var elements = Form.getElements(form);
-    for (var i = 0; i < elements.length; i++) {
-      var element = elements[i];
-      element.blur();
-      element.disabled = 'true';
-    }
-  },
-
-  enable: function(form) {
-    var elements = Form.getElements(form);
-    for (var i = 0; i < elements.length; i++) {
-      var element = elements[i];
-      element.disabled = '';
-    }
-  },
-
-  findFirstElement: function(form) {
-    return Form.getElements(form).find(function(element) {
-      return element.type != 'hidden' && !element.disabled &&
-        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
-    });
-  },
-
-  focusFirstElement: function(form) {
-    Field.activate(Form.findFirstElement(form));
-  },
-
-  reset: function(form) {
-    $(form).reset();
-  }
-}
-
-Form.Element = {
-  serialize: function(element) {
-    element = $(element);
-    var method = element.tagName.toLowerCase();
-    var parameter = Form.Element.Serializers[method](element);
-
-    if (parameter) {
-      var key = encodeURIComponent(parameter[0]);
-      if (key.length == 0) return;
-
-      if (parameter[1].constructor != Array)
-        parameter[1] = [parameter[1]];
-
-      return parameter[1].map(function(value) {
-        return key + '=' + encodeURIComponent(value);
-      }).join('&');
-    }
-  },
-
-  getValue: function(element) {
-    element = $(element);
-    var method = element.tagName.toLowerCase();
-    var parameter = Form.Element.Serializers[method](element);
-
-    if (parameter)
-      return parameter[1];
-  }
-}
-
-Form.Element.Serializers = {
-  input: function(element) {
-    switch (element.type.toLowerCase()) {
-      case 'submit':
-      case 'hidden':
-      case 'password':
-      case 'text':
-        return Form.Element.Serializers.textarea(element);
-      case 'checkbox':
-      case 'radio':
-        return Form.Element.Serializers.inputSelector(element);
-    }
-    return false;
-  },
-
-  inputSelector: function(element) {
-    if (element.checked)
-      return [element.name, element.value];
-  },
-
-  textarea: function(element) {
-    return [element.name, element.value];
-  },
-
-  select: function(element) {
-    return Form.Element.Serializers[element.type == 'select-one' ?
-      'selectOne' : 'selectMany'](element);
-  },
-
-  selectOne: function(element) {
-    var value = '', opt, index = element.selectedIndex;
-    if (index >= 0) {
-      opt = element.options[index];
-      value = opt.value;
-      if (!value && !('value' in opt))
-        value = opt.text;
-    }
-    return [element.name, value];
-  },
-
-  selectMany: function(element) {
-    var value = new Array();
-    for (var i = 0; i < element.length; i++) {
-      var opt = element.options[i];
-      if (opt.selected) {
-        var optValue = opt.value;
-        if (!optValue && !('value' in opt))
-          optValue = opt.text;
-        value.push(optValue);
-      }
-    }
-    return [element.name, value];
-  }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
-  initialize: function(element, frequency, callback) {
-    this.frequency = frequency;
-    this.element   = $(element);
-    this.callback  = callback;
-
-    this.lastValue = this.getValue();
-    this.registerCallback();
-  },
-
-  registerCallback: function() {
-    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
-  },
-
-  onTimerEvent: function() {
-    var value = this.getValue();
-    if (this.lastValue != value) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
-  initialize: function(element, callback) {
-    this.element  = $(element);
-    this.callback = callback;
-
-    this.lastValue = this.getValue();
-    if (this.element.tagName.toLowerCase() == 'form')
-      this.registerFormCallbacks();
-    else
-      this.registerCallback(this.element);
-  },
-
-  onElementEvent: function() {
-    var value = this.getValue();
-    if (this.lastValue != value) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  },
-
-  registerFormCallbacks: function() {
-    var elements = Form.getElements(this.element);
-    for (var i = 0; i < elements.length; i++)
-      this.registerCallback(elements[i]);
-  },
-
-  registerCallback: function(element) {
-    if (element.type) {
-      switch (element.type.toLowerCase()) {
-        case 'checkbox':
-        case 'radio':
-          Event.observe(element, 'click', this.onElementEvent.bind(this));
-          break;
-        case 'password':
-        case 'text':
-        case 'textarea':
-        case 'select-one':
-        case 'select-multiple':
-          Event.observe(element, 'change', this.onElementEvent.bind(this));
-          break;
-      }
-    }
-  }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-if (!window.Event) {
-  var Event = new Object();
-}
-
-Object.extend(Event, {
-  KEY_BACKSPACE: 8,
-  KEY_TAB:       9,
-  KEY_RETURN:   13,
-  KEY_ESC:      27,
-  KEY_LEFT:     37,
-  KEY_UP:       38,
-  KEY_RIGHT:    39,
-  KEY_DOWN:     40,
-  KEY_DELETE:   46,
-
-  element: function(event) {
-    return event.target || event.srcElement;
-  },
-
-  isLeftClick: function(event) {
-    return (((event.which) && (event.which == 1)) ||
-            ((event.button) && (event.button == 1)));
-  },
-
-  pointerX: function(event) {
-    return event.pageX || (event.clientX +
-      (document.documentElement.scrollLeft || document.body.scrollLeft));
-  },
-
-  pointerY: function(event) {
-    return event.pageY || (event.clientY +
-      (document.documentElement.scrollTop || document.body.scrollTop));
-  },
-
-  stop: function(event) {
-    if (event.preventDefault) {
-      event.preventDefault();
-      event.stopPropagation();
-    } else {
-      event.returnValue = false;
-      event.cancelBubble = true;
-    }
-  },
-
-  // find the first node with the given tagName, starting from the
-  // node the event was triggered on; traverses the DOM upwards
-  findElement: function(event, tagName) {
-    var element = Event.element(event);
-    while (element.parentNode && (!element.tagName ||
-        (element.tagName.toUpperCase() != tagName.toUpperCase())))
-      element = element.parentNode;
-    return element;
-  },
-
-  observers: false,
-
-  _observeAndCache: function(element, name, observer, useCapture) {
-    if (!this.observers) this.observers = [];
-    if (element.addEventListener) {
-      this.observers.push([element, name, observer, useCapture]);
-      element.addEventListener(name, observer, useCapture);
-    } else if (element.attachEvent) {
-      this.observers.push([element, name, observer, useCapture]);
-      element.attachEvent('on' + name, observer);
-    }
-  },
-
-  unloadCache: function() {
-    if (!Event.observers) return;
-    for (var i = 0; i < Event.observers.length; i++) {
-      Event.stopObserving.apply(this, Event.observers[i]);
-      Event.observers[i][0] = null;
-    }
-    Event.observers = false;
-  },
-
-  observe: function(element, name, observer, useCapture) {
-    var element = $(element);
-    useCapture = useCapture || false;
-
-    if (name == 'keypress' &&
-        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
-        || element.attachEvent))
-      name = 'keydown';
-
-    this._observeAndCache(element, name, observer, useCapture);
-  },
-
-  stopObserving: function(element, name, observer, useCapture) {
-    var element = $(element);
-    useCapture = useCapture || false;
-
-    if (name == 'keypress' &&
-        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
-        || element.detachEvent))
-      name = 'keydown';
-
-    if (element.removeEventListener) {
-      element.removeEventListener(name, observer, useCapture);
-    } else if (element.detachEvent) {
-      element.detachEvent('on' + name, observer);
-    }
-  }
-});
-
-/* prevent memory leaks in IE */
-Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
-  // set to true if needed, warning: firefox performance problems
-  // NOT neeeded for page scrolling, only if draggable contained in
-  // scrollable elements
-  includeScrollOffsets: false,
-
-  // must be called before calling withinIncludingScrolloffset, every time the
-  // page is scrolled
-  prepare: function() {
-    this.deltaX =  window.pageXOffset
-                || document.documentElement.scrollLeft
-                || document.body.scrollLeft
-                || 0;
-    this.deltaY =  window.pageYOffset
-                || document.documentElement.scrollTop
-                || document.body.scrollTop
-                || 0;
-  },
-
-  realOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.scrollTop  || 0;
-      valueL += element.scrollLeft || 0;
-      element = element.parentNode;
-    } while (element);
-    return [valueL, valueT];
-  },
-
-  cumulativeOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-    } while (element);
-    return [valueL, valueT];
-  },
-
-  positionedOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-      if (element) {
-        p = Element.getStyle(element, 'position');
-        if (p == 'relative' || p == 'absolute') break;
-      }
-    } while (element);
-    return [valueL, valueT];
-  },
-
-  offsetParent: function(element) {
-    if (element.offsetParent) return element.offsetParent;
-    if (element == document.body) return element;
-
-    while ((element = element.parentNode) && element != document.body)
-      if (Element.getStyle(element, 'position') != 'static')
-        return element;
-
-    return document.body;
-  },
-
-  // caches x/y coordinate pair to use with overlap
-  within: function(element, x, y) {
-    if (this.includeScrollOffsets)
-      return this.withinIncludingScrolloffsets(element, x, y);
-    this.xcomp = x;
-    this.ycomp = y;
-    this.offset = this.cumulativeOffset(element);
-
-    return (y >= this.offset[1] &&
-            y <  this.offset[1] + element.offsetHeight &&
-            x >= this.offset[0] &&
-            x <  this.offset[0] + element.offsetWidth);
-  },
-
-  withinIncludingScrolloffsets: function(element, x, y) {
-    var offsetcache = this.realOffset(element);
-
-    this.xcomp = x + offsetcache[0] - this.deltaX;
-    this.ycomp = y + offsetcache[1] - this.deltaY;
-    this.offset = this.cumulativeOffset(element);
-
-    return (this.ycomp >= this.offset[1] &&
-            this.ycomp <  this.offset[1] + element.offsetHeight &&
-            this.xcomp >= this.offset[0] &&
-            this.xcomp <  this.offset[0] + element.offsetWidth);
-  },
-
-  // within must be called directly before
-  overlap: function(mode, element) {
-    if (!mode) return 0;
-    if (mode == 'vertical')
-      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
-        element.offsetHeight;
-    if (mode == 'horizontal')
-      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
-        element.offsetWidth;
-  },
-
-  clone: function(source, target) {
-    source = $(source);
-    target = $(target);
-    target.style.position = 'absolute';
-    var offsets = this.cumulativeOffset(source);
-    target.style.top    = offsets[1] + 'px';
-    target.style.left   = offsets[0] + 'px';
-    target.style.width  = source.offsetWidth + 'px';
-    target.style.height = source.offsetHeight + 'px';
-  },
-
-  page: function(forElement) {
-    var valueT = 0, valueL = 0;
-
-    var element = forElement;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-
-      // Safari fix
-      if (element.offsetParent==document.body)
-        if (Element.getStyle(element,'position')=='absolute') break;
-
-    } while (element = element.offsetParent);
-
-    element = forElement;
-    do {
-      valueT -= element.scrollTop  || 0;
-      valueL -= element.scrollLeft || 0;
-    } while (element = element.parentNode);
-
-    return [valueL, valueT];
-  },
-
-  clone: function(source, target) {
-    var options = Object.extend({
-      setLeft:    true,
-      setTop:     true,
-      setWidth:   true,
-      setHeight:  true,
-      offsetTop:  0,
-      offsetLeft: 0
-    }, arguments[2] || {})
-
-    // find page position of source
-    source = $(source);
-    var p = Position.page(source);
-
-    // find coordinate system to use
-    target = $(target);
-    var delta = [0, 0];
-    var parent = null;
-    // delta [0,0] will do fine with position: fixed elements,
-    // position:absolute needs offsetParent deltas
-    if (Element.getStyle(target,'position') == 'absolute') {
-      parent = Position.offsetParent(target);
-      delta = Position.page(parent);
-    }
-
-    // correct by body offsets (fixes Safari)
-    if (parent == document.body) {
-      delta[0] -= document.body.offsetLeft;
-      delta[1] -= document.body.offsetTop;
-    }
-
-    // set position
-    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
-    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
-    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
-    if(options.setHeight) target.style.height = source.offsetHeight + 'px';
-  },
-
-  absolutize: function(element) {
-    element = $(element);
-    if (element.style.position == 'absolute') return;
-    Position.prepare();
-
-    var offsets = Position.positionedOffset(element);
-    var top     = offsets[1];
-    var left    = offsets[0];
-    var width   = element.clientWidth;
-    var height  = element.clientHeight;
-
-    element._originalLeft   = left - parseFloat(element.style.left  || 0);
-    element._originalTop    = top  - parseFloat(element.style.top || 0);
-    element._originalWidth  = element.style.width;
-    element._originalHeight = element.style.height;
-
-    element.style.position = 'absolute';
-    element.style.top    = top + 'px';;
-    element.style.left   = left + 'px';;
-    element.style.width  = width + 'px';;
-    element.style.height = height + 'px';;
-  },
-
-  relativize: function(element) {
-    element = $(element);
-    if (element.style.position == 'relative') return;
-    Position.prepare();
-
-    element.style.position = 'relative';
-    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
-    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
-    element.style.top    = top + 'px';
-    element.style.left   = left + 'px';
-    element.style.height = element._originalHeight;
-    element.style.width  = element._originalWidth;
-  }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned.  For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
-  Position.cumulativeOffset = function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      if (element.offsetParent == document.body)
-        if (Element.getStyle(element, 'position') == 'absolute') break;
-
-      element = element.offsetParent;
-    } while (element);
-
-    return [valueL, valueT];
-  }
-}
\ No newline at end of file
diff --git a/libs/httpd/resources/stylesheet.css b/libs/httpd/resources/stylesheet.css
deleted file mode 100644 (file)
index a1afce7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-a:link { text-decoration: none; color: black; }
-a:visited { text-decoration: none; color: black; }
-a:active { text-decoration: none; color: black; }
-a:hover { text-decoration: underline; color: black; }
diff --git a/libs/httpd/responder.factor b/libs/httpd/responder.factor
deleted file mode 100644 (file)
index 3eda247..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
-IN: httpd
-USING: arrays hashtables html http io kernel math namespaces
-parser sequences strings ;
-
-! Variables
-SYMBOL: vhosts
-SYMBOL: responders
-
-: print-header ( alist -- )
-    [ swap write ": " write print ] hash-each ;
-
-: response ( header msg -- )
-    "HTTP/1.0 " write print print-header ;
-
-: error-body ( error -- body )
-    <html> <body> <h1> write </h1> </body> </html> ;
-
-: error-head ( error -- )
-    dup log-error
-    H{ { "Content-Type" "text/html" } } over response ;
-
-: httpd-error ( error -- )
-    #! This must be run from handle-request
-    error-head
-    "head" "method" get = [ drop ] [ terpri error-body ] if ;
-
-: bad-request ( -- )
-    [
-        ! Make httpd-error print a body
-        "get" "method" set
-        "400 Bad request" httpd-error
-    ] with-scope ;
-
-: serving-content ( mime -- )
-    "Content-Type" associate
-    "200 Document follows" response terpri ;
-
-: serving-html "text/html" serving-content ;
-
-: serving-text "text/plain" serving-content ;
-
-: redirect ( to -- )
-    "Location" associate
-    "301 Moved Permanently" response terpri ;
-
-: directory-no/ ( -- )
-    [
-        "request" get % CHAR: / ,
-        "raw-query" get [ CHAR: ? , % ] when*
-    ] "" make redirect ;
-
-: query>hash ( query -- hash )
-    dup [
-        "&" split [
-            "=" split1 [ dup [ url-decode ] when ] 2apply 2array
-        ] map
-    ] when alist>hash ;
-
-: read-post-request ( header -- hash )
-    "Content-Length" swap hash dup
-    [ string>number read dup "raw-response" set query>hash ] when ;
-
-: log-headers ( hash -- )
-    [
-        drop { "User-Agent" "X-Forwarded-For" "Host" } member?
-    ] hash-subset [ ": " swap 3append log-message ] hash-each ;
-
-: prepare-url ( url -- url )
-    #! This is executed in the with-request namespace.
-    "?" split1
-    dup "raw-query" set query>hash "query" set
-    dup "request" set ;
-
-: prepare-header ( -- )
-    read-header dup "header" set
-    dup log-headers
-    read-post-request "response" set ;
-
-! Responders are called in a new namespace with these
-! variables:
-
-! - method -- one of get, post, or head.
-! - request -- the entire URL requested, including responder
-!              name
-! - raw-query -- raw query string
-! - query -- a hashtable of query parameters, eg
-!            foo.bar?a=b&c=d becomes
-!            H{ { "a" "b" } { "c" "d" } }
-! - header -- a hashtable of headers from the user's client
-! - response -- a hashtable of the POST request response
-! - raw-response -- raw POST request response
-
-: query-param ( key -- value ) "query" get hash ;
-
-: add-responder ( responder -- )
-    #! Add a responder object to the list.
-    "responder" over hash  responders get set-hash ;
-
-: add-simple-responder ( name quot -- )
-    [
-        [ drop ] swap append dup "get" set "post" set
-        "responder" set
-    ] make-hash add-responder ;
-
-: make-responder ( quot -- responder )
-    #! quot has stack effect ( url -- )
-    [
-        [
-            drop "GET method not implemented" httpd-error
-        ] "get" set
-        [
-            drop "POST method not implemented" httpd-error
-        ] "post" set
-        [
-            drop "HEAD method not implemented" httpd-error
-        ] "head" set
-        [
-            drop bad-request
-        ] "bad" set
-        
-        call
-    ] make-hash add-responder ;
-
-: vhost ( name -- vhost )
-    vhosts get hash [ "default" vhost ] unless* ;
-
-: responder ( name -- responder )
-    responders get hash [ "404" responder ] unless* ;
-
-: set-default-responder ( name -- )
-    responder "default" responders get set-hash ;
-
-: call-responder ( method argument responder -- )
-    over "argument" set [ swap get call ] bind ;
-
-: serve-default-responder ( method url -- )
-    "default" responder call-responder ;
-
-: log-responder ( path -- )
-    "Calling responder " swap append log-message ;
-
-: trim-/ ( url -- url )
-    #! Trim a leading /, if there is one.
-    "/" ?head drop ;
-
-: serve-explicit-responder ( method url -- )
-    "/" split1 dup [
-        swap responder call-responder
-    ] [
-        ! Just a responder name by itself
-        drop "request" get "/" append redirect 2drop
-    ] if ;
-
-: serve-responder ( method path host -- )
-    #! Responder paths come in two forms:
-    #! /foo/bar... - default responder used
-    #! /responder/foo/bar - responder foo, argument bar
-    vhost [
-        dup log-responder trim-/ "responder/" ?head [
-            serve-explicit-responder
-        ] [
-            serve-default-responder
-        ] if
-    ] bind ;
-
-: no-such-responder ( -- )
-    "404 No such responder" httpd-error ;
diff --git a/libs/httpd/test/embedded.factor b/libs/httpd/test/embedded.factor
deleted file mode 100644 (file)
index d85845e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-IN: temporary
-USING: io embedded kernel test ;
-
-[ t ] [
-    "libs/httpd/test/example.fhtml" resource-path
-    [ run-embedded-file ] string-out
-    
-    "libs/httpd/test/example.html"
-    resource-path <file-reader> contents
-    =
-] unit-test
diff --git a/libs/httpd/test/example.fhtml b/libs/httpd/test/example.fhtml
deleted file mode 100644 (file)
index 211f44a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<% USING: math ; %>
-
-<html>
-    <head><title>Simple Embedded Factor Example</title></head>
-    <body>
-        <% 5 [ %><p>I like repetition</p><% ] times %>
-    </body>
-</html>
diff --git a/libs/httpd/test/example.html b/libs/httpd/test/example.html
deleted file mode 100644 (file)
index 33829bf..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-<html>
-    <head><title>Simple Embedded Factor Example</title></head>
-    <body>
-        <p>I like repetition</p><p>I like repetition</p><p>I like repetition</p><p>I like repetition</p><p>I like repetition</p>
-    </body>
-</html>
diff --git a/libs/httpd/test/html.factor b/libs/httpd/test/html.factor
deleted file mode 100644 (file)
index aca595c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-IN: temporary
-USING: html http io kernel namespaces styles test xml ;
-
-[
-    "/responder/foo?z=%20"
-] [
-    "/responder/foo" H{ { "z" " " } } build-url
-] unit-test
-
-[
-    "&lt;html&gt;&amp;&apos;sgml&apos;"
-] [ "<html>&'sgml'" chars>entities ] unit-test
-
-[ "/foo/bar" ]
-[
-    [
-        "/home/slava/doc/" "doc-root" set
-        "/home/slava/doc/foo/bar" <pathname> browser-link-href
-    ] with-scope
-] unit-test
-
-[ "" ]
-[
-    [
-        H{ } [ drop ] span-tag
-    ] string-out
-] unit-test
-
-: html-format ( string style -- string )
-    [ format ] with-html-stream ;
-
-[ "hello world" ]
-[
-    [ "hello world" H{ } html-format ] string-out
-] unit-test
-
-[ "<span style='font-family: monospace; '>car</span>" ]
-[
-    [
-        "car"
-        H{ { font "monospace" } }
-        html-format
-    ] string-out
-] unit-test
-
-[ "<span style='color: #ff00ff; '>car</span>" ]
-[
-    [
-        "car"
-        H{ { foreground { 1 0 1 1 } } }
-        html-format
-    ] string-out
-] unit-test
diff --git a/libs/httpd/test/httpd.factor b/libs/httpd/test/httpd.factor
deleted file mode 100644 (file)
index ff3ce56..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-IN: temporary
-USE: file-responder
-USE: http
-USE: httpd
-USE: namespaces
-USE: io
-USE: test
-USE: strings
-
-[ ] [ "404 not found" httpd-error ] unit-test
-
-[ "inspect/global" ] [ "/inspect/global" trim-/ ] unit-test
-
-[ ] [
-    "unit/test" log-responder
-] unit-test
-
-[ "index.html" ]
-[ "http://www.jedit.org/index.html" url>path ] unit-test
-
-[ "foo/bar" ]
-[ "http://www.jedit.org/foo/bar" url>path ] unit-test
-
-[ "" ]
-[ "http://www.jedit.org/" url>path ] unit-test
-
-[ "" ]
-[ "http://www.jedit.org" url>path ] unit-test
-
-[ "foobar" ]
-[ "foobar" secure-path ] unit-test
-
-[ f ]
-[ "foobar/../baz" secure-path ] unit-test
-
-[ ] [ "GET ../index.html" parse-request ] unit-test
-[ ] [ "POO" parse-request ] unit-test
-
-[ H{ { "Foo" "Bar" } } ] [ "Foo=Bar" query>hash ] unit-test
-
-[ H{ { "Foo" "Bar" } { "Baz" "Quux" } } ]
-[ "Foo=Bar&Baz=Quux" query>hash ] unit-test
-
-[ H{ { "Baz" " " } } ]
-[ "Baz=%20" query>hash ] unit-test
-
-[ H{ { "Foo" f } } ] [ "Foo" query>hash ] unit-test
diff --git a/libs/httpd/test/url-encoding.factor b/libs/httpd/test/url-encoding.factor
deleted file mode 100644 (file)
index 1f6bc45..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: temporary
-USE: http
-USE: test
-
-[ "hello%20world" ] [ "hello world" url-encode ] unit-test
-[ "hello world" ] [ "hello%20world" url-decode ] unit-test
-[ "~hello world" ] [ "%7ehello+world" url-decode ] unit-test
-[ "" ] [ "%XX%XX%XX" url-decode ] unit-test
-[ "" ] [ "%XX%XX%X" url-decode ] unit-test
-
-[ "hello world"   ] [ "hello+world"    url-decode ] unit-test
-[ "hello world"   ] [ "hello%20world"  url-decode ] unit-test
-[ " ! "           ] [ "%20%21%20"      url-decode ] unit-test
-[ "hello world"   ] [ "hello world%"   url-decode ] unit-test
-[ "hello world"   ] [ "hello world%x"  url-decode ] unit-test
-[ "hello%20world" ] [ "hello world"    url-encode ] unit-test
-[ "%20%21%20"     ] [ " ! "            url-encode ] unit-test
diff --git a/libs/jedit/jedit.factor b/libs/jedit/jedit.factor
deleted file mode 100644 (file)
index aee9d11..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-! Copyright (C) 2004, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: jedit
-USING: arrays definitions errors io kernel listener math
-namespaces parser prettyprint sequences strings words shells ;
-
-: jedit-server-info ( -- port auth )
-    home "/.jedit/server" path+ <file-reader> [
-        readln drop
-        readln string>number
-        readln string>number
-    ] with-stream ;
-
-: make-jedit-request ( files -- code )
-    [
-        "EditServer.handleClient(false,false,false," write
-        cwd pprint
-        "," write
-        "new String[] {" write
-        [ pprint "," write ] each
-        "null});\n" write
-    ] string-out ;
-
-: send-jedit-request ( request -- )
-    jedit-server-info swap "localhost" swap <client> [
-        4 >be write
-        dup length 2 >be write
-        write
-    ] with-stream ;
-
-: jedit-location ( file line -- )
-    number>string "+line:" swap append 2array
-    make-jedit-request send-jedit-request ;
-
-: jedit-file ( file -- )
-    1array make-jedit-request send-jedit-request ;
-
-[ jedit-location ] edit-hook set-global
diff --git a/libs/jedit/load.factor b/libs/jedit/load.factor
deleted file mode 100644 (file)
index c7d20be..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-PROVIDE: libs/jedit
-{ +files+ { "jedit.factor" } } ;
diff --git a/libs/jni/jni-internals.factor b/libs/jni/jni-internals.factor
deleted file mode 100644 (file)
index 8a60e58..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-IN: jni-internals
-USING: kernel alien arrays sequences ;
-
-LIBRARY: jvm
-
-TYPEDEF: int jint
-TYPEDEF: uchar jboolean
-TYPEDEF: void* JNIEnv
-
-BEGIN-STRUCT: jdk-init-args
-       FIELD: jint version
-       FIELD: void* properties
-       FIELD: jint check-source
-       FIELD: jint native-stack-size
-       FIELD: jint java-stack-size
-       FIELD: jint min-heap-size
-       FIELD: jint max-heap-size
-       FIELD: jint verify-mode
-       FIELD: char* classpath
-       FIELD: void* vprintf
-       FIELD: void* exit
-       FIELD: void* abort
-       FIELD: jint enable-class-gc
-       FIELD: jint enable-verbose-gc
-       FIELD: jint disable-async-gc
-       FIELD: jint verbose
-       FIELD: jboolean debugging
-       FIELD: jint debug-port
-END-STRUCT
-
-BEGIN-STRUCT: JNIInvokeInterface
-       FIELD: void* reserved0
-       FIELD: void* reserved1
-       FIELD: void* reserved2
-       FIELD: void* DestroyJavaVM
-       FIELD: void* AttachCurrentThread
-       FIELD: void* DetachCurrentThread
-       FIELD: void* GetEnv
-       FIELD: void* AttachCurrentThreadAsDaemon
-END-STRUCT
-
-BEGIN-STRUCT: JavaVM
-       FIELD: JNIInvokeInterface* functions
-END-STRUCT
-
-BEGIN-STRUCT: JNINativeInterface
-       FIELD: void* reserved0
-       FIELD: void* reserved1
-       FIELD: void* reserved2
-       FIELD: void* reserved3
-       FIELD: void* GetVersion
-       FIELD: void* DefineClass
-       FIELD: void* FindClass
-       FIELD: void* FromReflectedMethod
-       FIELD: void* FromReflectedField
-       FIELD: void* ToReflectedMethod
-       FIELD: void* GetSuperclass
-       FIELD: void* IsAssignableFrom
-       FIELD: void* ToReflectedField
-        FIELD: void* Throw
-        FIELD: void* ThrowNew
-        FIELD: void* ExceptionOccurred
-        FIELD: void* ExceptionDescribe
-        FIELD: void* ExceptionClear
-        FIELD: void* FatalError
-        FIELD: void* PushLocalFrame
-        FIELD: void* PopLocalFrame
-        FIELD: void* NewGlobalRef
-        FIELD: void* DeleteGlobalRef
-        FIELD: void* DeleteLocalRef
-        FIELD: void* IsSameObject
-        FIELD: void* NewLocalRef
-        FIELD: void* EnsureLocalCapacity
-        FIELD: void* AllocObject
-        FIELD: void* NewObject
-        FIELD: void* NewObjectV
-        FIELD: void* NewObjectA
-        FIELD: void* GetObjectClass
-        FIELD: void* IsInstanceOf
-        FIELD: void* GetMethodID
-        FIELD: void* CallObjectMethod
-        FIELD: void* CallObjectMethodV
-        FIELD: void* CallObjectMethodA
-        FIELD: void* CallBooleanMethod
-        FIELD: void* CallBooleanMethodV
-        FIELD: void* CallBooleanMethodA
-        FIELD: void* CallByteMethod
-        FIELD: void* CallByteMethodV
-        FIELD: void* CallByteMethodA
-        FIELD: void* CallCharMethod
-        FIELD: void* CallCharMethodV
-        FIELD: void* CallCharMethodA
-        FIELD: void* CallShortMethod
-        FIELD: void* CallShortMethodV
-        FIELD: void* CallShortMethodA
-        FIELD: void* CallIntMethod
-        FIELD: void* CallIntMethodV
-        FIELD: void* CallIntMethodA
-        FIELD: void* CallLongMethod
-        FIELD: void* CallLongMethodV
-        FIELD: void* CallLongMethodA
-        FIELD: void* CallFloatMethod
-        FIELD: void* CallFloatMethodV
-        FIELD: void* CallFloatMethodA
-        FIELD: void* CallDoubleMethod
-        FIELD: void* CallDoubleMethodV
-        FIELD: void* CallDoubleMethodA
-        FIELD: void* CallVoidMethod
-        FIELD: void* CallVoidMethodV
-        FIELD: void* CallVoidMethodA
-        FIELD: void* CallNonvirtualObjectMethod
-        FIELD: void* CallNonvirtualObjectMethodV
-        FIELD: void* CallNonvirtualObjectMethodA
-        FIELD: void* CallNonvirtualBooleanMethod
-        FIELD: void* CallNonvirtualBooleanMethodV
-        FIELD: void* CallNonvirtualBooleanMethodA
-        FIELD: void* CallNonvirtualByteMethod
-        FIELD: void* CallNonvirtualByteMethodV
-        FIELD: void* CallNonvirtualByteMethodA
-        FIELD: void* CallNonvirtualCharMethod
-        FIELD: void* CallNonvirtualCharMethodV
-        FIELD: void* CallNonvirtualCharMethodA
-        FIELD: void* CallNonvirtualShortMethod
-        FIELD: void* CallNonvirtualShortMethodV
-        FIELD: void* CallNonvirtualShortMethodA
-        FIELD: void* CallNonvirtualIntMethod
-        FIELD: void* CallNonvirtualIntMethodV
-        FIELD: void* CallNonvirtualIntMethodA
-        FIELD: void* CallNonvirtualLongMethod
-        FIELD: void* CallNonvirtualLongMethodV
-        FIELD: void* CallNonvirtualLongMethodA
-        FIELD: void* CallNonvirtualFloatMethod
-        FIELD: void* CallNonvirtualFloatMethodV
-        FIELD: void* CallNonvirtualFloatMethodA
-        FIELD: void* CallNonvirtualDoubleMethod
-        FIELD: void* CallNonvirtualDoubleMethodV
-        FIELD: void* CallNonvirtualDoubleMethodA
-        FIELD: void* CallNonvirtualVoidMethod
-        FIELD: void* CallNonvirtualVoidMethodV
-        FIELD: void* CallNonvirtualVoidMethodA
-        FIELD: void* GetFieldID
-        FIELD: void* GetObjectField
-        FIELD: void* GetBooleanField
-        FIELD: void* GetByteField
-        FIELD: void* GetCharField
-        FIELD: void* GetShortField
-        FIELD: void* GetIntField
-        FIELD: void* GetLongField
-        FIELD: void* GetFloatField
-        FIELD: void* GetDoubleField
-        FIELD: void* SetObjectField
-        FIELD: void* SetBooleanField
-        FIELD: void* SetByteField
-        FIELD: void* SetCharField
-        FIELD: void* SetShortField
-        FIELD: void* SetIntField
-        FIELD: void* SetLongField
-        FIELD: void* SetFloatField
-        FIELD: void* SetDoubleField
-        FIELD: void* GetStaticMethodID
-        FIELD: void* CallStaticObjectMethod
-        FIELD: void* CallStaticObjectMethodV
-        FIELD: void* CallStaticObjectMethodA
-        FIELD: void* CallStaticBooleanMethod
-        FIELD: void* CallStaticBooleanMethodV
-        FIELD: void* CallStaticBooleanMethodA
-        FIELD: void* CallStaticByteMethod
-        FIELD: void* CallStaticByteMethodV
-        FIELD: void* CallStaticByteMethodA
-        FIELD: void* CallStaticCharMethod
-        FIELD: void* CallStaticCharMethodV
-        FIELD: void* CallStaticCharMethodA
-        FIELD: void* CallStaticShortMethod
-        FIELD: void* CallStaticShortMethodV
-        FIELD: void* CallStaticShortMethodA
-        FIELD: void* CallStaticIntMethod
-        FIELD: void* CallStaticIntMethodV
-        FIELD: void* CallStaticIntMethodA
-        FIELD: void* CallStaticLongMethod
-        FIELD: void* CallStaticLongMethodV
-        FIELD: void* CallStaticLongMethodA
-        FIELD: void* CallStaticFloatMethod
-        FIELD: void* CallStaticFloatMethodV
-        FIELD: void* CallStaticFloatMethodA
-        FIELD: void* CallStaticDoubleMethod
-        FIELD: void* CallStaticDoubleMethodV
-        FIELD: void* CallStaticDoubleMethodA
-        FIELD: void* CallStaticVoidMethod
-        FIELD: void* CallStaticVoidMethodV
-        FIELD: void* CallStaticVoidMethodA
-        FIELD: void* GetStaticFieldID
-        FIELD: void* GetStaticObjectField
-        FIELD: void* GetStaticBooleanField
-        FIELD: void* GetStaticByteField
-        FIELD: void* GetStaticCharField
-        FIELD: void* GetStaticShortField
-        FIELD: void* GetStaticIntField
-        FIELD: void* GetStaticLongField
-        FIELD: void* GetStaticFloatField
-        FIELD: void* GetStaticDoubleField
-        FIELD: void* SetStaticObjectField
-        FIELD: void* SetStaticBooleanField
-        FIELD: void* SetStaticByteField
-        FIELD: void* SetStaticCharField
-        FIELD: void* SetStaticShortField
-        FIELD: void* SetStaticIntField
-        FIELD: void* SetStaticLongField
-        FIELD: void* SetStaticFloatField
-        FIELD: void* SetStaticDoubleField
-        FIELD: void* NewString
-        FIELD: void* GetStringLength
-        FIELD: void* GetStringChars
-        FIELD: void* ReleaseStringChars
-        FIELD: void* NewStringUTF
-        FIELD: void* GetStringUTFLength
-        FIELD: void* GetStringUTFChars
-        FIELD: void* ReleaseStringUTFChars
-        FIELD: void* GetArrayLength
-        FIELD: void* NewObjectArray
-        FIELD: void* GetObjectArrayElement
-        FIELD: void* SetObjectArrayElement
-        FIELD: void* NewBooleanArray
-        FIELD: void* NewByteArray
-        FIELD: void* NewCharArray
-        FIELD: void* NewShortArray
-        FIELD: void* NewIntArray
-        FIELD: void* NewLongArray
-        FIELD: void* NewFloatArray
-        FIELD: void* NewDoubleArray
-        FIELD: void* GetBooleanArrayElements
-        FIELD: void* GetByteArrayElements
-        FIELD: void* GetCharArrayElements
-        FIELD: void* GetShortArrayElements
-        FIELD: void* GetIntArrayElements
-        FIELD: void* GetLongArrayElements
-        FIELD: void* GetFloatArrayElements
-        FIELD: void* GetDoubleArrayElements
-        FIELD: void* ReleaseBooleanArrayElements
-        FIELD: void* ReleaseByteArrayElements
-        FIELD: void* ReleaseCharArrayElements
-        FIELD: void* ReleaseShortArrayElements
-        FIELD: void* ReleaseIntArrayElements
-        FIELD: void* ReleaseLongArrayElements
-        FIELD: void* ReleaseFloatArrayElements
-        FIELD: void* ReleaseDoubleArrayElements
-        FIELD: void* GetBooleanArrayRegion
-        FIELD: void* GetByteArrayRegion
-        FIELD: void* GetCharArrayRegion
-        FIELD: void* GetShortArrayRegion
-        FIELD: void* GetIntArrayRegion
-        FIELD: void* GetLongArrayRegion
-        FIELD: void* GetFloatArrayRegion
-        FIELD: void* GetDoubleArrayRegion
-        FIELD: void* SetBooleanArrayRegion
-        FIELD: void* SetByteArrayRegion
-        FIELD: void* SetCharArrayRegion
-        FIELD: void* SetShortArrayRegion
-        FIELD: void* SetIntArrayRegion
-        FIELD: void* SetLongArrayRegion
-        FIELD: void* SetFloatArrayRegion
-        FIELD: void* SetDoubleArrayRegion
-        FIELD: void* RegisterNatives
-        FIELD: void* UnregisterNatives
-        FIELD: void* MonitorEnter
-        FIELD: void* MonitorExit
-        FIELD: void* GetJavaVM
-        FIELD: void* GetStringRegion
-        FIELD: void* GetStringUTFRegion
-        FIELD: void* GetPrimitiveArrayCritical
-        FIELD: void* ReleasePrimitiveArrayCritical
-        FIELD: void* GetStringCritical
-        FIELD: void* ReleaseStringCritical
-        FIELD: void* NewWeakGlobalRef
-        FIELD: void* DeleteWeakGlobalRef
-        FIELD: void* ExceptionCheck
-        FIELD: void* NewDirectByteBuffer
-        FIELD: void* GetDirectBufferAddress
-        FIELD: void* GetDirectBufferCapacity
-END-STRUCT
-
-BEGIN-STRUCT: JNIEnv
-       FIELD: JNINativeInterface* functions
-END-STRUCT
-
-FUNCTION: jint JNI_GetDefaultJavaVMInitArgs ( jdk-init-args* args ) ;
-FUNCTION: jint JNI_CreateJavaVM ( void** pvm, void** penv, void* args ) ;
-
-: <jdk-init-args> ( -- jdk-init-args )
-  "jdk-init-args" <c-object>  HEX: 00010004 over set-jdk-init-args-version ;
-
-: jni1 ( -- init-args int )
-  <jdk-init-args> dup JNI_GetDefaultJavaVMInitArgs ;
-
-: jni2 ( -- vm env int )
-  f <void*> f <void*> [
-    jni1 drop JNI_CreateJavaVM
-  ] 2keep rot dup 0 = [
-    >r >r 0 swap void*-nth r> 0 swap void*-nth r> 
-  ] when ;
-
-: (destroy-java-vm) 
-  "int" { "void*" } "cdecl" alien-indirect ;
-
-: (attach-current-thread) 
-  "int" { "void*" "void*" "void*" } "cdecl" alien-indirect ;
-
-: (detach-current-thread) 
-  "int" { "void*" } "cdecl" alien-indirect ;
-
-: (get-env) 
-  "int" { "void*" "void*" "int" } "cdecl" alien-indirect ;
-
-: (attach-current-thread-as-daemon) 
-  "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 ;
-
-: get-version ( jnienv -- int )
-  dup JNIEnv-functions JNINativeInterface-GetVersion (get-version) ;
-  
-: (find-class) 
-  "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 ;
-
-: 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 ;
-
-: 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 ;
-
-: 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 ;
-
-: 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 ;
-
-: call1 ( obj method-id jstr jnienv -- )
-  dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-CallObjectMethod (call1) ;
-
diff --git a/libs/jni/jni.factor b/libs/jni/jni.factor
deleted file mode 100644 (file)
index 86e1670..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-IN: jni
-USING: kernel jni-internals namespaces ;
-
-! High level interface for JNI to be added here...
-
-: test0 ( -- )
-  jni2 drop nip "env" set ;
-
-: test1 ( -- system )
-  "java/lang/System" "env" get find-class ;
-
-: test2 ( system -- system.out )
-  dup "out" "Ljava/io/PrintStream;" "env" get get-static-field-id 
-  "env" get get-static-object-field ;
-
-: test3 ( int system.out -- )
-  "java/io/PrintStream" "env" get find-class ! jstr out class
-  "println" "(I)V" "env" get get-method-id ! jstr out id
-  rot "env" get call1 ;
-  
\ No newline at end of file
diff --git a/libs/jni/load.factor b/libs/jni/load.factor
deleted file mode 100644 (file)
index f5fd45c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-PROVIDE: libs/jni
-{ +files+ { "jni-internals.factor" "jni.factor" } } ;
diff --git a/libs/json/json-reader.factor b/libs/json/json-reader.factor
deleted file mode 100644 (file)
index 0c330b7..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-USING: kernel namespaces sequences strings math hashtables parser-combinators lazy-lists ;
-IN: json
-
-! Grammar for JSON from RFC 4627
-USE: tools
-
-: [<&>] ( quot -- quot )
-  { } make unclip [ <&> ] reduce ;
-
-: [<|>] ( quot -- quot )
-  { } make unclip [ <|> ] reduce ;
-
-LAZY: 'ws' ( -- parser )
-  " " token 
-  "\n" token <|>
-  "\r" token <|>
-  "\t" token <|> 
-  "" token <|> ;
-
-LAZY: spaced ( parser -- parser )
-  'ws' swap &> 'ws' <& ;
-
-LAZY: 'begin-array' ( -- parser )
-  "[" token spaced ;
-
-LAZY: 'begin-object' ( -- parser )
-  "{" token spaced ;
-
-LAZY: 'end-array' ( -- parser )
-  "]" token spaced ;
-
-LAZY: 'end-object' ( -- parser )
-  "}" token spaced ;
-
-LAZY: 'name-separator' ( -- parser )
-  ":" token spaced ;
-
-LAZY: 'value-separator' ( -- parser )
-  "," token spaced ;
-
-LAZY: 'false' ( -- parser )
-  "false" token ;
-
-LAZY: 'null' ( -- parser )
-  "null" token ;
-
-LAZY: 'true' ( -- parser )
-  "true" token ;
-
-LAZY: 'quot' ( -- parser )
-  "\"" token ;
-
-LAZY: 'string' ( -- parser )
-  'quot' 
-  [ quotable? ] satisfy <+> &> 
-  'quot' <& [ >string ] <@  ;
-
-DEFER: 'value'
-
-LAZY: 'member' ( -- parser )
-  'string'
-  'name-separator' <&  
-  'value' <&> ;
-
-: object>hashtable ( object -- hashtable )
-  #! Convert json object to hashtable
-  H{ } clone dup rot [ dup second swap first rot set-hash ] each-with ;
-
-LAZY: 'object' ( -- parser )
-  'begin-object' 
-  'member' &>
-  'value-separator' 'member' &> <*> <&:>
-  'end-object' <& [ object>hashtable ] <@ ;
-
-LAZY: 'array' ( -- parser )
-  'begin-array' 
-  'value' &>
-  'value-separator' 'value' &> <*> <&:> 
-  'end-array' <&  ;
-  
-LAZY: 'minus' ( -- parser )
-  "-" token ;
-
-LAZY: 'plus' ( -- parser )
-  "+" token ;
-
-LAZY: 'zero' ( -- parser )
-  "0" token [ drop 0 ] <@ ;
-
-LAZY: 'decimal-point' ( -- parser )
-  "." token ;
-
-LAZY: 'digit1-9' ( -- parser )
-  [ 
-    dup integer? [ 
-      CHAR: 1 CHAR: 9 between? 
-    ] [ 
-      drop f 
-    ] if 
-  ] satisfy [ digit> ] <@ ;
-
-LAZY: 'digit0-9' ( -- parser )
-  [ digit? ] satisfy [ digit> ] <@ ;
-
-: sequence>number ( seq -- num ) 
-  #! { 1 2 3 } => 123
-  0 [ swap 10 * + ] reduce ;
-
-LAZY: 'int' ( -- parser )
-  'zero' 
-  'digit1-9' 'digit0-9' <*> <&:> [ sequence>number ] <@ <|>  ;
-
-LAZY: 'e' ( -- parser )
-  "e" token "E" token <|> ;
-
-: sign-number ( pair -- number )
-  #! Pair is { minus? num }
-  #! Convert the json number value to a factor number
-  dup second swap first [ -1 * ] when ;
-
-LAZY: 'exp' ( -- parser )
-    'e' 
-    'minus' 'plus' <|> <?> &>
-    'digit0-9' <+> [ sequence>number ] <@ <&> [ sign-number ] <@ ;
-
-: sequence>frac ( seq -- num ) 
-  #! { 1 2 3 } => 0.123
-  reverse 0 [ swap 10 / + ] reduce 10 / >float ;
-
-LAZY: 'frac' ( -- parser )
-  'decimal-point' 'digit0-9' <+> &> [ sequence>frac ] <@ ;
-
-: raise-to-power ( pair -- num )
-  #! Pair is { num exp }.
-  #! Multiply 'num' by 10^exp
-  dup second dup [ 10 swap first ^ swap first * ] [ drop first ] if ;
-
-LAZY: 'number' ( -- parser )
-  'minus' <?>
-  [ 'int' , 'frac' 0 succeed <|> , ] [<&>] [ sum ] <@ 
-  'exp' <?> <&> [ raise-to-power ] <@ <&> [ sign-number ] <@ ;
-
-LAZY: 'value' ( -- parser )
-  [
-    'false' ,
-    'null' ,
-    'true' ,
-    'string' ,
-    'object' ,
-    'array' ,
-    'number' ,
-  ] [<|>] ;
-
-: json> ( string -- object )
-  #! Parse a json formatted string to a factor object
-  'value' some parse force ;
\ No newline at end of file
diff --git a/libs/json/json-writer.factor b/libs/json/json-writer.factor
deleted file mode 100644 (file)
index 0b75c54..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-USING: kernel strings namespaces math arrays sequences generic words hashtables kernel-internals io ;
-IN: json
-
-#! Writes the object out to a stream in JSON format
-GENERIC: json-print ( obj -- )
-
-: >json ( obj -- string )
-  #! Returns a string representing the factor object in JSON format
-  [ json-print ] string-out ;
-
-M: f json-print ( f -- )
-  "false" write ;
-
-M: string json-print ( obj -- )
-  CHAR: " write1 write CHAR: " write1 ;
-
-M: number json-print ( num -- )  
-  number>string write ;
-
-M: sequence json-print ( array -- string ) 
-  CHAR: [ write1 [ >json ] map "," join write CHAR: ] write1 ;
-
-: (jsvar-encode) ( char -- char )
-  #! Convert the given character to a character usable in
-  #! javascript variable names.
-  dup H{ { CHAR: - CHAR: _ } } hash dup [ nip ] [ drop ] if ;
-
-: jsvar-encode ( string -- string )
-  #! Convert the string so that it contains characters usable within
-  #! javascript variable names.
-  [ (jsvar-encode) ] map ;
-  
-: >tuple< ( object -- array )
-  #! Return an array holding the value of the slots of the tuple
-  dup class "slots" word-prop [ first slot ] map-with ;
-
-: slots ( object -- values names )
-  #! Given an object return an array of slots names and a sequence of slot values
-  #! the slot name and the slot value. 
-  [ >tuple< 1 tail ] keep class "slot-names" word-prop ;
-
-: slots>fields ( values names -- array )
-  #! Convert the arrays containing the slot names and values
-  #! to an array of strings suitable for describing that slot
-  #! as a field in a javascript object.
-  [ 
-    [ jsvar-encode >json % " : " % >json % ] "" make 
-  ] 2map ;
-
-M: object json-print ( object -- string )
-  CHAR: { write1 slots slots>fields "," join write CHAR: } write1 ;
-
-: hash-map ( hashtable quot -- array )
-  >r hash>alist r> [ dup first swap second ] swap append map ;
-
-M: hashtable json-print ( hashtable -- string )
-  CHAR: { write1 
-  [ [ swap jsvar-encode >json % CHAR: : , >json % ] "" make ] hash-map "," join write 
-  CHAR: } write1 ;
-  
\ No newline at end of file
diff --git a/libs/json/json.facts b/libs/json/json.facts
deleted file mode 100644 (file)
index 2214df4..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-USING: help json ;
-
-HELP: >json "( obj -- string )"
-{ $values { "obj" "an object" } { "string" "the object converted to JSON format" } }
-{ $description "Serializes the object into a JSON formatted string." } 
-{ $see-also json-print json> } ;
-
-HELP: json-print "( obj -- )"
-{ $values { "obj" "an object" } }
-{ $description "Serializes the object into a JSON formatted string and outputs it to the standard output stream." } 
-{ $see-also >json json> } ;
-
-HELP: json> "( string -- object )"
-{ $values { "string" "a string in JSON format" } { "object" "yhe object deserialized from the JSON string" } }
-{ $description "Deserializes the JSON formatted string into a Factor object. JSON objects are converted to Factor hashtables. All other JSON objects convert to their obvious Factor equivalents." } 
-{ $see-also json-print >json } ;
diff --git a/libs/json/load.factor b/libs/json/load.factor
deleted file mode 100644 (file)
index f69d063..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-REQUIRES: libs/parser-combinators ;
-PROVIDE: libs/json
-{ +files+ {
-    "json-reader.factor"
-    "json-writer.factor"
-    "json.facts"
-} } ;
\ No newline at end of file
diff --git a/libs/lambda/TODO.txt b/libs/lambda/TODO.txt
deleted file mode 100644 (file)
index c196e95..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-Lambda TODO
------------
-Documentation
-Unit tests
-More graceful parse error handling
-Factor out tree traversing into its own lib
-
-Redesign
---------
-Why doesn't PRED work?
-
-Core
-----
-ISNIL
-READCHAR
\ No newline at end of file
diff --git a/libs/lambda/core.factor b/libs/lambda/core.factor
deleted file mode 100644 (file)
index c5637af..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-USING: lazy-lists io strings sequences math namespaces kernel ;
-IN: lambda
-
-: lambda-core ( -- expr-string-array )
-    {
-        ":0 (one.(zero.zero))"
-        ":SUCC (num.(one.(zero.(one((num one) zero)))))"
-    }
-    
-    0 lfrom 100 swap ltake list>array
-    [ 
-        [ ":" , dup 1 + number>string , " (SUCC " , number>string ,
-        ")" , ] { } make concat
-    ] map append
-    
-    0 lfrom 26 swap ltake list>array
-    [
-        [ ":" , 65 + dup ch>string , " " , number>string , ] { } make concat
-    ] map append
-    
-    {
-        ":LF 10"
-        ":FALSE (t.(f.f))"
-        ":TRUE (t.(f.t))"
-        ":AND (p.(q.((p q) FALSE)))"
-        ":OR (p.(q.((p TRUE) q)))"
-        ":ISZERO (num.((num (pred. FALSE)) TRUE))"
-        ":ADD (num.(other.((num SUCC) other)))"
-        ":MULT (num.(other.((num (ADD other)) 0)))"
-        ":PRED (n.(f.(x.(((n (g.(h.(h(g f))))) (u. x)) (u.u)))))"
-        ":SUBFROM (num.(other.((num PRED) other)))"
-        ":EQUAL (num.(other.((AND (ISZERO ((SUBFROM num) other))) (ISZERO ((SUBFROM other) num)))))"
-        ":FACT (fact.(num.(((ISZERO num) 1) ((MULT num) (fact (PRED num))))))"
-        ":YCOMBINATOR (func.((y. (func (y y)))(y. (func (y y)))))"
-        ":FACTORIAL (YCOMBINATOR FACT)"
-        ":CONS (car.(cdr.(which.((which car) cdr))))"
-        ":CAR (cons.(cons TRUE))"
-        ":CDR (cons.(cons FALSE))"
-        ":PCONS (pcons.(num.(cons.(((ISZERO num) (PRINTSPECIAL LF)) ((PRINTCHAR (CAR cons)) ((pcons (PRED num)) (CDR cons)))))))"
-        ":PRINTCONS (YCOMBINATOR PCONS)"
-        ":NUMTOCHAR (num. ((ADD 48) num))"
-        ":PRINTNUM (num.(PRINTCHAR (NUMTOCHAR num)))"
-        ":PRINTCHAR (char.([PRINTCHAR] (ALIENNUM char)))"
-        ":PRINTSPECIAL (special.([PRINTCHAR] (ALIENNUM special)))"
-        ":ALIEN0 alienbaseonenum"
-        ":ALIENNUM (num.((num [ALIENSUCC]) ALIEN0))"
-        ":HELLOCONS ((CONS H) ((CONS E) ((CONS Y) ((CONS 0) nil))))"
-        ":HELLO ((PRINTCONS 3) HELLOCONS)"
-        "(([HELLO] nil) ([INFO] nil))"
-    } append ;
-
-: print-return ( -- node )
-    write "(nil.nil)" lambda-parse second ;
-    
-: HELLO ( node -- node )
-    drop "\nHello and Welcome to Lambda!\n" print-return ;
-
-: INFO ( node -- node )
-    drop "Type HELLO and wait 10 seconds to see me flex my io muscles.\n" print-return ;
-
-: ALIENSUCC ( node -- node )
-    var-node-name "a" append <var-node> ;
-
-: ALIENPRED ( node -- node )
-    var-node-name dup length 1 - swap remove-nth <var-node> ;
-
-: ALIENISZERO ( node -- node )
-    ;
-
-: PRINTCHAR ( node -- node )
-    #! takes a base one num and prints its char equivalent
-    var-node-name length "alienbaseonenum" length - ch>string print-return ;
-
-: READCHAR ( node -- node )
-    #! reads one character of input and stores it as a base one num
-    "alienbaseonenum" read1 [ "a" append ] times <var-node> ;
-
-    
\ No newline at end of file
diff --git a/libs/lambda/lambda.factor b/libs/lambda/lambda.factor
deleted file mode 100644 (file)
index 441eff8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#! An interpreter for lambda expressions, by Matthew Willis
-USING: io strings hashtables sequences namespaces kernel ;
-IN: lambda
-
-: lambda-print ( name/expr -- )
-    dup string? 
-    [   dup lambda-names get hash expr>string " " swap 
-        append append "DEF " swap append 
-    ] [ expr>string "=> " swap append 
-    ] if print flush ;
-
-: lambda-define ( parse-result -- name/expr )
-    #! Make sure not to evaluate definitions.
-    first2 over [ over lambda-names get set-hash ] [ nip ] if ;
-
-: lambda-eval ( name/expr -- name/expr )
-    dup string? [ normalize ] unless ;
-
-: lambda-boot ( -- )
-    #! load the core lambda library
-    H{ } clone lambda-names set lambda-core
-    [ lambda-parse lambda-define lambda-eval lambda-print ] each ;
-: lambda ( -- )
-    lambda-names get [ lambda-boot ] unless
-    readln dup "." = [ drop ] [
-        lambda-parse lambda-define lambda-eval lambda-print lambda
-    ] if ;
\ No newline at end of file
diff --git a/libs/lambda/load.factor b/libs/lambda/load.factor
deleted file mode 100644 (file)
index bd0dd66..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-REQUIRES: libs/lazy-lists libs/parser-combinators ;
-PROVIDE: libs/lambda
-{ +files+ {
-    "nodes.factor"
-    "parser.factor"
-    "core.factor"
-    "lambda.factor"
-} }
-{ +tests+ {
-    "test/lambda.factor"
-} } ;
-
-USE: lambda
-MAIN: libs/lambda lambda ;
\ No newline at end of file
diff --git a/libs/lambda/nodes.factor b/libs/lambda/nodes.factor
deleted file mode 100644 (file)
index 4697eeb..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-#! A lambda expression manipulator, by Matthew Willis
-USING: lazy-lists strings arrays hashtables 
-sequences namespaces words parser kernel ;
-
-IN: lambda
-
-: dip swap slip ; inline
-
-SYMBOL: lambda-names
-TUPLE: lambda-node self expr name ;
-TUPLE: apply-node func arg ;
-TUPLE: var-node name ; #! var is either a var, name, or pointer to a lambda-node
-TUPLE: beta-node expr lambdas ; #! a namespace node
-TUPLE: alien-node word ;
-
-M: lambda-node equal? eq? ;
-
-GENERIC: bind-var
-M: lambda-node bind-var ( binding lambda -- ) 
-    lambda-node-expr bind-var ; 
-
-M: apply-node bind-var ( binding apply -- )
-    [ apply-node-func bind-var ] 2keep apply-node-arg bind-var ;
-
-M: var-node bind-var ( binding var-node -- )
-    2dup var-node-name swap lambda-node-name = 
-    [ set-var-node-name ] [ 2drop ] if ;
-
-M: alien-node bind-var ( binding alien -- ) 2drop ;
-
-C: lambda-node ( expr var lambda -- lambda )
-    swapd [ set-lambda-node-name ] keep
-    [ set-lambda-node-expr ] 2keep
-    dup [ set-lambda-node-self ] keep
-    [ swap bind-var ] keep ;
-
-GENERIC: beta-push
-#! push the beta further down the syntax tree
-#!  this is how lambda achieves lazy beta reduction and efficient cloning.
-#!  everything outside of the beta must have been cloned.
-M: lambda-node beta-push ( beta lambda -- lambda )
-    clone dup lambda-node-expr pick set-beta-node-expr
-    [ set-lambda-node-expr ] keep ;
-
-M: apply-node beta-push ( beta apply -- apply )
-    #! push the beta into each branch, cloning the beta
-    swap dup clone 
-    pick apply-node-func swap [ set-beta-node-expr ] keep swap
-    rot apply-node-arg swap [ set-beta-node-expr ] keep
-    <apply-node> ;
-
-M: var-node beta-push ( beta var -- expr )
-    #! substitute the variable with the appropriate entry from the
-    #! beta namespace
-    tuck var-node-name swap beta-node-lambdas hash dup
-    [ nip ] [ drop ] if ;
-
-M: beta-node beta-push ( beta inner-beta -- beta )
-    #! combines the namespaces of two betas
-    dup beta-node-lambdas rot beta-node-lambdas hash-union
-    swap [ set-beta-node-lambdas ] keep ;
-
-M: alien-node beta-push ( beta alien -- alien ) nip ;
-
-: beta-reduce ( apply -- beta )
-    #! construct a beta-node which carries the namespace of the lambda
-    dup apply-node-arg swap apply-node-func dup lambda-node-expr -rot
-    lambda-node-self H{ } clone [ set-hash ] keep <beta-node> ;
-
-DEFER: evaluate
-: left-reduce ( apply -- apply/f )
-    #! we are at an application node -- evaluate the function
-    dup apply-node-func evaluate dup
-    [ swap [ set-apply-node-func ] keep ]
-    [ nip ] if ;
-
-: alien-reduce ( apply -- node/f )
-    #! we have come to an alien application, which requires us to
-    #! fully normalize the argument before proceeding
-    dup apply-node-arg evaluate dup
-    [ swap [ set-apply-node-arg ] keep ]
-    [ #! right side is normalized, we are ready to do the alien application
-        drop dup apply-node-arg swap apply-node-func
-        alien-node-word "lambda" lookup execute
-    ] if ;
-
-GENERIC: evaluate
-#! There are 
-#!   beta-reduction, beta-pushing, and name replacing.
-: normalize ( expr -- expr )
-    dup evaluate [ nip normalize ] when* ;
-    
-M: lambda-node evaluate ( lambda -- node/f ) drop f ;
-
-M: apply-node evaluate ( apply -- node )
-    dup apply-node-func lambda-node?
-    [ beta-reduce ] 
-    [ 
-        dup apply-node-func alien-node?
-        [ alien-reduce ]
-        [ left-reduce ] if
-    ] if ;
-
-M: var-node evaluate ( var -- node/f ) 
-    var-node-name lambda-names get hash ;
-
-M: beta-node evaluate ( beta -- node/f ) 
-    dup beta-node-expr beta-push ;
-
-M: alien-node evaluate ( alien -- node/f ) drop f ;
-
-GENERIC: expr>string
-M: lambda-node expr>string ( lambda-node -- string )
-    [ 
-        dup "(" , lambda-node-name , ". " , 
-        lambda-node-expr expr>string , ")" , 
-    ] { } make concat ;
-
-M: apply-node expr>string ( apply-node -- string ) 
-    [ 
-        dup "(" , apply-node-func expr>string , " " , 
-        apply-node-arg expr>string , ")" , 
-    ] { } make concat ;
-
-M: var-node expr>string ( variable-node -- string ) 
-    var-node-name dup string? [ lambda-node-name ] unless ;
-
-M: alien-node expr>string ( alien-node -- string )
-    [ "[" , alien-node-word , "]" , ] { } make concat ;
-
-M: beta-node expr>string ( beta -- string )
-    [ "beta<" , beta-node-expr expr>string , ">" , ] { } make concat ;
\ No newline at end of file
diff --git a/libs/lambda/parser.factor b/libs/lambda/parser.factor
deleted file mode 100644 (file)
index c69d515..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#! A parser for lambda expressions, by Matthew Willis
-#! The grammar in BNF is:
-#! <expr> ::= <id>
-#! <expr> ::= <name>
-#! <expr> ::= (<id> . <expr>)
-#! <expr> ::= (<expr> <expr>)
-#! <line> ::= <expr>
-#! <line> ::= <name> : <expr>
-USING: lazy-lists parser-combinators strings sequences kernel ;
-
-IN: lambda
-
-LAZY: <letter> 
-    #! parses an uppercase or lowercase letter
-       [ letter? ] satisfy [ ch>string ] <@ ;
-
-LAZY: <LETTER> 
-    #! parses an uppercase or lowercase letter
-    [ LETTER? ] satisfy [ ch>string ] <@ ;
-
-LAZY: <number>
-    #! parses a number
-    [ digit? ] satisfy [ ch>string ] <@ ;
-
-LAZY: <alphanumeric>
-    #! parses an alphanumeral
-    <letter> <number> <|> ;
-
-LAZY: <ALPHANUMERIC>
-    #! parses an alphanumeral
-    <LETTER> <number> <|> ;
-
-LAZY: <id>
-    #! parses an identifier (string for now)
-    #! TODO: do we need to enter it into a symbol table?
-    <letter> <alphanumeric> <*> <&:> [ concat <var-node> ] <@ ;
-
-LAZY: <name>
-    #! parses a name, which is used in replacement
-    <ALPHANUMERIC> <+> [ concat ] <@ ;
-
-DEFER: <expr>
-LAZY: <lambda> ( -- parser )
-    #! parses (<id>.<expr>), the "lambda" expression
-    #! all occurences of <id> are replaced with a pointer to this
-    #! lambda expression.
-    "(" token <id> sp &> "." token sp <& 
-    <expr> sp <&> ")" token sp <&
-    [ [ first var-node-name ] keep second <lambda-node> ] <@ ;
-
-LAZY: <apply> ( -- parser )
-    #! parses (<expr> <expr>), the function application
-    "(" token <expr> sp &> <expr> sp <&> ")" token sp <& 
-    [ [ first ] keep second <apply-node> ] <@ ;
-
-LAZY: <alien> ( -- parser )
-    #! parses [<FACTOR-WORD>], the alien invocation
-    #! an alien factor word must be all capital letters and numerals
-    "[" token <name> sp &> "]" token sp <& [ <alien-node> ] <@ ;
-
-LAZY: <expr>
-    <id> <lambda> <apply> <|> <|>
-    <name> [ <var-node> ] <@ <|> <alien> <|> ;
-
-LAZY: <line>
-    ":" token <name> &> <expr> sp <&> f succeed <expr> <&> 
-    <|> "." token <name> &> f succeed <&> <|> ;
-
-: lambda-parse
-    <line> some parse force ;
\ No newline at end of file
diff --git a/libs/lambda/test/lambda.factor b/libs/lambda/test/lambda.factor
deleted file mode 100644 (file)
index 96c27a3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-USING: lambda test hashtables sequences kernel ;
-
-#! test simple parsing
-[ "(A. A)" ] [ "(b.b)" lambda-parse second bound-vars swap expr>string ] unit-test
-
-#! test name replacement
-[ "(A. A)" ] [ 
-                "(b.b)" lambda-parse second "OK" H{ } clone [ set-hash ] keep
-                "OK" lambda-parse second replace-names bound-vars
-                swap expr>string 
-             ] unit-test
\ No newline at end of file
diff --git a/libs/lazy-lists/examples.factor b/libs/lazy-lists/examples.factor
deleted file mode 100644 (file)
index d2fa217..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-! Rewritten by Matthew Willis, July 2006
-! Copyright (C) 2004 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: lazy-lists math kernel sequences test ;
-IN: lazy-examples
-
-: naturals 0 lfrom ;
-: positives 1 lfrom ;
-: evens 0 [ 2 + ] lfrom-by ;
-: odds 1 lfrom [ 2 mod 1 = ] lsubset ;
-: powers-of-2 1 [ 2 * ] lfrom-by ;
-: ones 1 [ ] lfrom-by ;
-: squares naturals [ dup * ] lmap ;
-: first-five-squares 5 squares ltake list>array ;
-
-: divisible-by? ( a b -- bool )
-    #! Return true if a is divisible by b
-    mod 0 = ;
-
-: filter-multiples ( n list -- list )
-    #! Given a lazy list of numbers, filter multiples of n
-    swap [ divisible-by? not ] curry lsubset ;
-
-! : primes ( -- list )
-!    2 lfrom [ filter-multiples ] lapply ;
-
-! : first-ten-primes 10 primes ltake list>array ;
diff --git a/libs/lazy-lists/lazy-io.factor b/libs/lazy-lists/lazy-io.factor
deleted file mode 100644 (file)
index fbd6a55..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: kernel lazy-lists io ;
-IN: lazy-lists
-
-TUPLE: lazy-io stream car cdr quot ;
-
-: lcontents ( stream -- result )
-  f f [ stream-read1 ] <lazy-io> ;
-
-: llines ( stream -- result )
-  f f [ stream-readln ] <lazy-io> ;
-
-M: lazy-io car ( lazy-io -- car )
-  dup lazy-io-car dup [
-    nip  
-  ] [ 
-    drop dup lazy-io-stream over lazy-io-quot call 
-    swap dupd set-lazy-io-car
-  ] if ;
-
-M: lazy-io cdr ( lazy-io -- cdr )
-  dup lazy-io-cdr dup [
-    nip
-  ] [
-    drop dup
-    [ lazy-io-stream ] keep
-    [ lazy-io-quot ] keep
-    car [
-      >r f f r> <lazy-io> [ swap set-lazy-io-cdr ] keep
-    ] [
-      3drop nil
-    ] if 
-  ] if ;
-
-M: lazy-io nil? ( lazy-io -- bool )
-  car not ;
diff --git a/libs/lazy-lists/lazy-io.facts b/libs/lazy-lists/lazy-io.facts
deleted file mode 100644 (file)
index a9743e5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: help lazy-lists sequences ;
-
-HELP: lcontents
-{ $values { "stream" "a stream" } }
-{ $description "Returns a lazy list of all characters in the file. " { $link car } " returns the next character in the file, " { $link cdr } " returns the remaining characters as a lazy list. " { $link nil? } " indicates end of file." } 
-{ $see-also llines } ;
-
-HELP: llines
-{ $values { "stream" "a stream" } }
-{ $description "Returns a lazy list of all lines in the file. " { $link car } " returns the next lines in the file, " { $link cdr } " returns the remaining lines as a lazy list. " { $link nil? } " indicates end of file." } 
-{ $see-also lcontents } ;
-
diff --git a/libs/lazy-lists/lazy.factor b/libs/lazy-lists/lazy.factor
deleted file mode 100644 (file)
index 7b96bfa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-! Copyright (C) 2004 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-USING: kernel sequences words inference namespaces math parser ;
-IN: lazy-lists
-
-: stack-effect-in ( quot word -- n )
-  stack-effect dup [ 
-    nip effect-in length 
-  ] [ 
-    drop infer effect-in length nip
-  ] if ;
-
-: make-lazy-quot ( word quot -- quot )
-  [
-    dup , swap stack-effect-in [ \ curry , ] times \ <promise> , 
-  ] [ ] make ;
-
-: LAZY: ( -- object object object )
-  CREATE dup reset-generic [ dupd make-lazy-quot define-compound ] f ; parsing
diff --git a/libs/lazy-lists/lazy.facts b/libs/lazy-lists/lazy.facts
deleted file mode 100644 (file)
index 5f30950..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: help lazy-lists ;
-
-HELP: LAZY:
-{ $syntax "LAZY: word definition... ;" } 
-{ $values { "word" "a new word to define" } { "definition" "a word definition" } }
-{ $description "Creates a lazy word in the current vocabulary. When executed the word will return a " { $link <promise> } " that when forced, executes the word definition. Any values on the stack that are required by the word definition are captured along with the promise." } 
-{ $examples
-  { $example "LAZY: my-add ( a b -- c ) + ;\n1 2 my-add force ." }
-}
-{ $see-also force promise-with promise-with2 } ;
diff --git a/libs/lazy-lists/lists.factor b/libs/lazy-lists/lists.factor
deleted file mode 100644 (file)
index c080b03..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-! Copyright (C) 2004 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! Updated by Matthew Willis, July 2006
-! Updated by Chris Double, September 2006
-!
-USING: kernel sequences math vectors arrays namespaces generic errors ;
-IN: lazy-lists
-
-! Lazy List Protocol
-GENERIC: car   ( cons -- car )
-GENERIC: cdr   ( cons -- cdr )
-GENERIC: nil?  ( cons -- bool )
-GENERIC: list? ( object -- bool )
-
-TUPLE: promise quot forced? value ;
-
-C: promise ( quot -- promise ) [ set-promise-quot ] keep ;
-
-: promise ( quot -- promise ) 
-  <promise> ;
-
-: promise-with ( value quot -- promise )
-  curry <promise> ;
-
-: promise-with2 ( value1 value2 quot -- promise )
-  curry curry <promise> ;
-
-: force ( promise -- value )
-    #! Force the given promise leaving the value of calling the
-    #! promises quotation on the stack. Re-forcing the promise
-    #! will return the same value and not recall the quotation.
-    dup promise-forced? [
-        dup promise-quot call over set-promise-value
-        t over set-promise-forced?
-    ] unless
-    promise-value ;
-
-M: promise car ( promise -- car )
-  force car ;
-
-M: promise cdr ( promise -- cdr )
-  force cdr ;
-
-M: promise nil? ( cons -- bool )
-  force nil? ;
-
-M: promise list? ( object -- bool )
-  drop t ;
-
-TUPLE: cons car cdr ;
-
-M: object list? ( object -- bool )
-  drop f ;
-
-C: cons ( car cdr -- list ) 
-    [ set-cons-cdr ] keep 
-    [ set-cons-car ] keep ;
-
-M: cons car ( cons -- car )
-    cons-car ;    
-
-M: cons cdr ( cons -- cdr )
-    cons-cdr ;    
-
-: nil ( -- cons )
-  T{ cons f f f } ;
-
-M: cons nil? ( cons -- bool )
-    nil eq? ;
-
-M: cons list? ( object -- bool )
-  drop t ;
-
-: cons ( car cdr -- list )
-    <cons> ;
-
-: 1list ( obj -- cons )
-    nil <cons> ;
-
-: 2list ( a b -- cons )
-    nil <cons> <cons> ;
-
-: 3list ( a b c -- cons )
-    nil <cons> <cons> <cons> ;
-
-! Both 'car' and 'cdr' are promises  
-TUPLE: lazy-cons car cdr ;
-
-: lazy-cons ( car cdr -- promise ) 
-    >r promise r> promise <lazy-cons> 
-    T{ promise f f t f } clone [ set-promise-value ] keep ;
-
-M: lazy-cons car ( lazy-cons -- car )
-    lazy-cons-car force ;    
-
-M: lazy-cons cdr ( lazy-cons -- cdr )
-    lazy-cons-cdr force ;    
-
-M: lazy-cons nil? ( lazy-cons -- bool )
-    nil eq? ;
-
-M: lazy-cons list? ( object -- bool )
-  drop t ;
-
-DEFER: lunit 
-DEFER: lnth 
-TUPLE: list ;
-
-: 1lazy-list ( a -- lazy-cons )
-  [ nil ] lazy-cons ;
-
-: 2lazy-list ( a b -- lazy-cons )
-  1lazy-list unit lazy-cons ;
-
-: 3lazy-list ( a b c -- lazy-cons )
-  2lazy-list unit lazy-cons ;
-
-: lnth ( n list -- elt ) 
-  swap [ cdr ] times car ;
-
-: uncons ( cons -- car cdr )
-    #! Return the car and cdr of the lazy list
-    dup car swap cdr ;
-
-: leach ( list quot -- )
-  swap dup nil? [ 
-    2drop 
-  ] [
-    uncons swap pick call swap leach
-  ] if ;
-
-: 2curry ( a b quot -- quot )
-  curry curry ;
-
-TUPLE: memoized-cons original car cdr nil? ;
-
-: not-memoized ( -- obj )
-  { } ;
-
-: not-memoized? ( obj -- bool )
-  not-memoized eq? ;
-
-C: memoized-cons ( cons -- memoized-cons )
-  [ set-memoized-cons-original ] keep
-  not-memoized over set-memoized-cons-car 
-  not-memoized over set-memoized-cons-cdr 
-  not-memoized over set-memoized-cons-nil? ;
-
-M: memoized-cons car ( memoized-cons -- car )
-  dup memoized-cons-car not-memoized? [
-    dup memoized-cons-original car [ swap set-memoized-cons-car ] keep
-  ] [
-    memoized-cons-car
-  ] if ;
-
-M: memoized-cons cdr ( memoized-cons -- cdr )
-  dup memoized-cons-cdr not-memoized? [
-    dup memoized-cons-original cdr [ swap set-memoized-cons-cdr ] keep
-  ] [
-    memoized-cons-cdr
-  ] if ;
-
-M: memoized-cons nil? ( memoized-cons -- bool )
-  dup memoized-cons-nil? not-memoized? [
-    dup memoized-cons-original nil? [ swap set-memoized-cons-nil? ] keep
-  ] [
-    memoized-cons-nil?
-  ] if ;
-
-M: memoized-cons list? ( object -- bool )
-  drop t ;
-
-TUPLE: lazy-map cons quot ;
-
-: lmap ( list quot -- result )
-    over nil? [ 2drop nil ] [ <lazy-map> <memoized-cons> ] if ;
-
-M: lazy-map car ( lazy-map -- car )
-  [ lazy-map-cons car ] keep
-  lazy-map-quot call ;
-
-M: lazy-map cdr ( lazy-map -- cdr )
-  [ lazy-map-cons cdr ] keep
-  lazy-map-quot lmap ;
-
-M: lazy-map nil? ( lazy-map -- bool )
-  lazy-map-cons nil? ;
-
-M: lazy-map list? ( object -- bool )
-  drop t ;
-
-TUPLE: lazy-map-with value cons quot ;
-
-: lmap-with ( value list quot -- result )
-  over nil? [ 3drop nil ] [ <lazy-map-with> <memoized-cons> ] if ;
-
-M: lazy-map-with car ( lazy-map-with -- car )
-  [ lazy-map-with-value ] keep
-  [ lazy-map-with-cons car ] keep
-  lazy-map-with-quot call ;
-
-M: lazy-map-with cdr ( lazy-map-with -- cdr )
-  [ lazy-map-with-value ] keep
-  [ lazy-map-with-cons cdr ] keep
-  lazy-map-with-quot lmap-with ;
-
-M: lazy-map-with nil? ( lazy-map-with -- bool )
-  lazy-map-with-cons nil? ;
-
-M: lazy-map-with list? ( object -- bool )
-  drop t ;
-
-TUPLE: lazy-take n cons ;
-
-: ltake ( n list -- result )
-    over zero? [ 2drop nil ] [ <lazy-take> ] if ;
-     
-M: lazy-take car ( lazy-take -- car )
-  lazy-take-cons car ;
-
-M: lazy-take cdr ( lazy-take -- cdr )
-  [ lazy-take-n 1- ] keep
-  lazy-take-cons cdr ltake ;
-
-M: lazy-take nil? ( lazy-take -- bool )
-  dup lazy-take-n zero? [
-    drop t
-  ] [ 
-    lazy-take-cons nil?
-  ] if ;
-
-M: lazy-take list? ( object -- bool )
-  drop t ;
-
-TUPLE: lazy-subset cons quot ;
-
-: lsubset ( list quot -- list )
-    over nil? [ 2drop nil ] [ <lazy-subset> <memoized-cons> ] if ;
-
-: car-subset?  ( lazy-subset -- )
-  [ lazy-subset-cons car ] keep
-  lazy-subset-quot call ;
-
-: skip ( lazy-subset -- )
-  [ lazy-subset-cons cdr ] keep
-  set-lazy-subset-cons ;
-
-M: lazy-subset car ( lazy-subset -- car )
-  dup car-subset? [
-    lazy-subset-cons car
-  ] [
-    dup skip car
-  ] if ;
-
-M: lazy-subset cdr ( lazy-subset -- cdr )
-  dup car-subset? [
-    [ lazy-subset-cons cdr ] keep
-    lazy-subset-quot lsubset
-  ] [
-    dup skip cdr
-  ] if ;
-
-M: lazy-subset nil? ( lazy-subset -- bool )
-  dup lazy-subset-cons nil? [
-    drop t
-  ] [
-    dup car-subset? [
-      drop f
-    ] [
-      dup skip nil?
-    ] if 
-  ] if ;
-
-M: lazy-subset list? ( object -- bool )
-  drop t ;
-
-: list>vector ( list -- vector )
-  [ [ , ] leach ] V{ } make ;
-
-: list>array ( list -- array )
-  [ [ , ] leach ] { } make ;
-
-TUPLE: lazy-append list1 list2 ;
-
-: lappend ( list1 list2 -- result )
-  {
-    { [ over nil? ] [ nip ] }
-    { [ t ] [ <lazy-append> ] }
-  } cond ;
-
-M: lazy-append car ( lazy-append -- car )
-  lazy-append-list1 car ;
-
-M: lazy-append cdr ( lazy-append -- cdr )
-  [ lazy-append-list1 cdr  ] keep
-  lazy-append-list2 lappend ;
-
-M: lazy-append nil? ( lazy-append -- bool )
-  dup lazy-append-list1 nil? [
-    lazy-append-list2 nil?     
-  ] [
-    drop f
-  ] if ;
-
-M: lazy-append list? ( object -- bool )
-  drop t ;
-
-TUPLE: lazy-from-by n quot ;
-
-: lfrom-by ( n quot -- list )
-  <lazy-from-by> ;
-    
-: lfrom ( n -- list )
-  [ 1 + ] lfrom-by ;
-
-M: lazy-from-by car ( lazy-from-by -- car )
-  lazy-from-by-n ;
-
-M: lazy-from-by cdr ( lazy-from-by -- cdr )
-  [ lazy-from-by-n ] keep
-  lazy-from-by-quot dup >r call r> lfrom-by ;
-
-M: lazy-from-by nil? ( lazy-from-by -- bool )
-  drop f ;
-  
-M: lazy-from-by list? ( object -- bool )
-  drop t ;
-
-TUPLE: lazy-zip list1 list2 ;
-
-: lzip ( list1 list2 -- lazy-zip )
-    over nil? over nil? or 
-    [ 2drop nil ] [ <lazy-zip> ] if ;
-
-M: lazy-zip car ( lazy-zip -- car )
-    [ lazy-zip-list1 car ] keep lazy-zip-list2 car 2array ;
-   
-M: lazy-zip cdr ( lazy-zip -- cdr )
-    [ lazy-zip-list1 cdr ] keep lazy-zip-list2 cdr lzip ;
-
-M: lazy-zip nil? ( lazy-zip -- bool )
-    drop f ;
-
-M: lazy-zip list? ( object -- bool )
-  drop t ;
-
-TUPLE: sequence-cons index seq ;
-
-: seq>list ( index seq -- list )
-  2dup length >= [
-    2drop nil
-  ] [
-    <sequence-cons>
-  ] if ;
-
-M: sequence-cons car ( sequence-cons -- car )
-  [ sequence-cons-index ] keep
-  sequence-cons-seq nth ;
-  
-M: sequence-cons cdr ( sequence-cons -- cdr )
-  [ sequence-cons-index 1+ ] keep
-  sequence-cons-seq seq>list ;
-
-M: sequence-cons nil? ( sequence-cons -- bool )
-    drop f ;      
-
-M: sequence-cons list? ( object -- bool )
-  drop t ;
-
-: >list ( object -- list )
-  {
-    { [ dup sequence? ] [ 0 swap seq>list ] }
-    { [ dup list?     ] [ ] }
-    { [ t ] [ "Could not convert object to a list" throw ] }
-  } cond ;
-
-TUPLE: lazy-concat car cdr ;
-
-DEFER: lconcat
-
-: (lconcat) ( car cdr -- list )
-  over nil? [
-    nip lconcat 
-  ] [
-    <lazy-concat>    
-  ] if ;
-  
-: lconcat ( list -- list )
-  dup nil? [
-    drop nil
-  ] [
-    uncons (lconcat)
-  ] if ;
-
-M: lazy-concat car ( lazy-concat -- car )
-  lazy-concat-car car ;
-
-M: lazy-concat cdr ( lazy-concat -- cdr )
-  [ lazy-concat-car cdr ] keep lazy-concat-cdr (lconcat) ;
-
-M: lazy-concat nil? ( lazy-concat -- bool )
-  dup lazy-concat-car nil? [
-    lazy-concat-cdr nil?
-  ] [
-    drop f
-  ] if ;
-
-M: lazy-concat list? ( object -- bool )
-  drop t ;
-
-: lcartesian-product ( list1 list2 -- result ) 
-  swap [ swap [ 2array ] lmap-with ] lmap-with lconcat ;
-
-: lcartesian-product* ( lists -- result )
-  dup nil? [
-    drop nil
-  ] [
-    [ car ] keep cdr [ car lcartesian-product ] keep cdr list>array swap [ 
-      swap [ swap [ add ] lmap-with ] lmap-with lconcat     
-    ] reduce    
-  ] if ;
-
-: lcomp ( list quot -- result )
-  >r lcartesian-product* r> lmap ;
-
-: lcomp* ( list guards quot -- result )
-  >r >r lcartesian-product* r> [ lsubset ] each r> lmap ;
-
-DEFER: lmerge
-
-: (lmerge) ( list1 list2 -- result )
-  over [ car ] curry -rot 
-  [ 
-    dup [ car ] curry -rot
-    [
-      >r cdr r> cdr lmerge
-    ] curry curry lazy-cons       
-  ] curry curry lazy-cons ;
-
-: lmerge ( list1 list2 -- result ) 
-  {
-    { [ over nil? ] [ nip   ] }
-    { [ dup nil?  ]  [ drop ] }
-    { [ t         ]  [ (lmerge) ] }
-  } cond ;
\ No newline at end of file
diff --git a/libs/lazy-lists/lists.facts b/libs/lazy-lists/lists.facts
deleted file mode 100644 (file)
index 9543fb7..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: help lazy-lists sequences ;
-
-HELP: promise 
-{ $values { "quot" "a quotation with stack effect ( -- X )" } { "promise" "a promise object" } }
-{ $description "Creates a promise to return a value. When forced this quotation is called and the value returned. The value is memorised so that calling " { $link force } " again does not call the quotation again, instead the previous value is returned directly." } 
-{ $see-also force promise-with promise-with2 } ;
-
-HELP: promise-with
-{ $values { "value" "an object" } { "quot" "a quotation with stack effect ( value -- X )" } { "promise" "a promise object" } }
-{ $description "Creates a promise to return a value. When forced this quotation is called with the given value on the stack and the result returned. The value is memorised so that calling " { $link force } " again does not call the quotation again, instead the previous value is returned directly." } 
-{ $see-also force promise promise-with2 } ;
-
-HELP: promise-with2
-{ $values { "value1" "an object" } { "value2" "an object" } { "quot" "a quotation with stack effect ( value1 value2 -- X )" } { "promise" "a promise object" } }
-{ $description "Creates a promise to return a value. When forced this quotation is called with the given values on the stack and the result returned. The value is memorised so that calling " { $link force } " again does not call the quotation again, instead the previous value is returned directly." } 
-{ $see-also force promise promise-with2 } ;
-
-HELP: force
-{ $values { "promise" "a promise object" } { "value" "a factor object" } }
-{ $description "Calls the quotation associated with the promise if it has not been called before, and returns the value. If the promise has been forced previously, returns the value from the previous call." } 
-{ $see-also promise promise-with promise-with2 } ;
-
-HELP: <cons> 
-{ $values { "car" "the head of the lazy list" } { "cdr" "the tail of the lazy list" } { "cons" "a cons object" } }
-{ $description "Constructs a cons cell." }
-{ $see-also cons car cdr nil nil? list? } ;
-
-HELP: car
-{ $values { "cons" "a cons object" } { "car" "the first item in the list" } }
-{ $description "Returns the first item in the list." } 
-{ $see-also cons cdr nil nil? list? } ;
-
-HELP: cdr
-{ $values { "cons" "a cons object" } { "cdr" "a cons object" } }
-{ $description "Returns the tail of the list." } 
-{ $see-also cons car nil nil? list? } ;
-
-HELP: nil 
-{ $values { "cons" "An empty cons" } }
-{ $description "Returns a representation of an empty list" } 
-{ $see-also cons car cdr nil? list? } ;
-
-HELP: nil? 
-{ $values { "cons" "a cons object" } }
-{ $description "Return true if the cons object is the nil cons." } 
-{ $see-also cons car cdr nil list? } ;
-
-HELP: list? 
-{ $values { "object" "an object" } }
-{ $description "Returns true if the object conforms to the list protocol." } 
-{ $see-also cons car cdr nil } ;
-
-HELP: cons 
-{ $values { "car" "the head of the lazy list" } { "cdr" "the tail of the lazy list" } { "cons" "a cons object" } }
-{ $description "Constructs a cons cell." }
-{ $see-also car cdr nil nil? } ;
-
-HELP: 1list
-{ $values { "obj" "an object" } { "cons" "a cons object" } }
-{ $description "Create a list with 1 element." } 
-{ $see-also 2list 3list } ;
-
-HELP: 2list
-{ $values { "a" "an object" } { "b" "an object" } { "cons" "a cons object" } }
-{ $description "Create a list with 2 elements." } 
-{ $see-also 1list 3list } ;
-
-HELP: 3list
-{ $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" "a cons object" } }
-{ $description "Create a list with 3 elements." } 
-{ $see-also 1list 2list } ;
-
-HELP: lazy-cons
-{ $values { "car" "a quotation with stack effect ( -- X )" } { "cdr" "a quotation with stack effect ( -- cons )" } { "cons" "the resulting cons object" } }
-{ $description "Constructs a cons object for a lazy list from two quotations. The 'car' quotation should return the head of the list, and the 'cons' quotation the tail when called. When " { $link cons } " or " { $link cdr } " are called on the lazy-cons object then the appropriate quotation is called." } 
-{ $see-also cons car cdr nil nil? } ;
-
-HELP: 1lazy-list
-{ $values { "a" "a quotation with stack effect ( -- X )" } { "lazy-cons" "a lazy-cons object" } }
-{ $description "Create a lazy list with 1 element. The element is the result of calling the quotation. The quotation is only called when the list element is requested." } 
-{ $see-also 2lazy-list 3lazy-list } ;
-
-HELP: 2lazy-list
-{ $values { "a" "a quotation with stack effect ( -- X )" } { "b" "a quotation with stack effect ( -- X )" } { "lazy-cons" "a lazy-cons object" } }
-{ $description "Create a lazy list with 2 elements. The elements are the result of calling the quotations. The quotations are only called when the list elements are requested." } 
-{ $see-also 1lazy-list 3lazy-list } ;
-
-HELP: 3lazy-list
-{ $values { "a" "a quotation with stack effect ( -- X )" } { "b" "a quotation with stack effect ( -- X )" } { "c" "a quotation with stack effect ( -- X )" } { "lazy-cons" "a lazy-cons object" } }
-{ $description "Create a lazy list with 3 elements. The elements are the result of calling the quotations. The quotations are only called when the list elements are requested." } 
-{ $see-also 1lazy-list 2lazy-list } ;
-
-HELP: <memoized-cons>
-{ $values { "cons" "a cons object" } { "cons" "the resulting memoized-cons object" } }
-{ $description "Constructs a cons object that wraps an existing cons object. Requests for the car, cdr and nil? will be remembered after the first call, and the previous result returned on subsequent calls." } 
-{ $see-also cons car cdr nil nil? } ;
-
-HELP: lnth
-{ $values { "n" "an integer index" } { "list" "a cons object" } { "elt" "the element at the nth index" } }
-{ $description "Outputs the nth element of the list." } 
-{ $see-also cons car cdr } ;
-
-HELP: uncons
-{ $values { "cons" "a cons object" } { "car" "the head of the list" } { "cdr" "the tail of the list" } }
-{ $description "Put the head and tail of the list on the stack." } 
-{ $see-also cons car cdr } ;
-
-HELP: leach
-{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- )" } }
-{ $description "Call the quotation for each item in the list." } 
-{ $see-also lmap lmap-with ltake lsubset lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: lmap
-{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- X )" } { "result" "resulting cons object" } }
-{ $description "Perform a similar functionality to that of the " { $link map } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-map> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } 
-{ $see-also leach ltake lsubset lappend lmap-with  lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: lmap-with
-{ $values { "value" "an object" } { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj elt -- X )" } { "result" "resulting cons object" } }
-{ $description "Variant of " { $link lmap } " which pushes a retained object on each invocation of the quotation." } 
-{ $see-also leach ltake lsubset lappend lmap lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: ltake
-{ $values { "n" "a non negative integer" } { "list" "a cons object" } { "result" "resulting cons object" } }
-{ $description "Outputs a lazy list containing the first n items in the list. This is done a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-take> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } 
-{ $see-also leach lmap lmap-with lsubset lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: lsubset
-{ $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( -- X )" } { "result" "resulting cons object" } }
-{ $description "Perform a similar functionality to that of the " { $link subset } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-subset> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } 
-{ $see-also leach lmap lmap-with ltake lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: list>vector
-{ $values { "list" "a cons object" } { "vector" "the list converted to a vector" } }
-{ $description "Convert a list to a vector. If the list is a lazy infinite list then this will enter an infinite loop." } 
-{ $see-also list>array } ;
-
-HELP: list>array
-{ $values { "list" "a cons object" } { "array" "the list converted to an array" } }
-{ $description "Convert a list to an array. If the list is a lazy infinite list then this will enter an infinite loop." } 
-{ $see-also list>vector } ;
-
-HELP: lappend
-{ $values { "list1" "a cons object" } { "list2" "a cons object" } { "result" "a lazy list of list2 appended to list1" } }
-{ $description "Perform a similar functionality to that of the " { $link append } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-append> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required. Successive calls to " { $link cdr } " will iterate through list1, followed by list2." } 
-{ $see-also leach lmap lmap-with ltake lsubset lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: lfrom-by
-{ $values { "n" "an integer" } { "quot" "a quotation with stack effect ( -- int )" } { "result" "a lazy list of integers" } }
-{ $description "Return an infinite lazy list of values starting from n, with each successive value being the result of applying quot to n." } 
-{ $see-also leach lmap lmap-with ltake lsubset lfrom lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: lfrom
-{ $values { "n" "an integer" } { "result" "a lazy list of integers" } }
-{ $description "Return an infinite lazy list of incrementing integers starting from n." } 
-{ $see-also leach lmap lmap-with ltake lsubset lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: seq>list
-{ $values { "index" "an integer 0 or greater" } { "seq" "a sequence" } { "list" "a list" } }
-{ $description "Convert the sequence into a list, starting from the 'index' offset into the sequence." } 
-{ $see-also >list } ;
-
-HELP: >list
-{ $values { "object" "an object" } { "list" "a list" } }
-{ $description "Convert the object into a list. Existing lists are passed through intact, sequences are converted using " { $link seq>list } " and other objects cause an error to be thrown." } 
-{ $see-also seq>list } ;
-
-HELP: lconcat
-{ $values { "list" "a list of lists" } { "result" "a list" } }
-{ $description "Concatenates a list of lists together into one list." } 
-{ $see-also leach lmap lmap-with ltake lsubset lcartesian-product lcartesian-product* lfrom-by lcomp lcomp* lmerge } ;
-
-HELP: lcartesian-product
-{ $values { "list1" "a list" } { "list2" "a list" } { "result" "list of cartesian products" } }
-{ $description "Given two lists, return a list containing the cartesian product of those lists." } 
-{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product* lcomp lcomp* lmerge } ;
-
-HELP: lcartesian-product*
-{ $values { "list" "a list of lists" } { "result" "list of cartesian products" } }
-{ $description "Given a list of lists, return a list containing the cartesian product of those lists." } 
-{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp lcomp* lmerge } ;
-
-HELP: lcomp
-{ $values { "list" "a list of lists" } { "quot" "a quotation with stack effect ( seq -- X )" } { "list" "the resulting list" } }
-{ $description "Get the cartesian product of the lists in 'list' and call 'quot' call with each element from the cartesian product on the stack, the result of which is returned in the final 'list'." } 
-{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp* lmerge } ;
-
-HELP: lcomp*
-{ $values { "list" "a list of lists" } { "guards" "a sequence of quotations with stack effect ( seq -- bool )" } { "quot" "a quotation with stack effect ( seq -- X )" } { "list" "the resulting list" } }
-{ $description "Get the cartesian product of the lists in 'list', filter it by applying each guard quotation to it and call 'quot' call with each element from the remaining cartesian product items on the stack, the result of which is returned in the final 'list'." } 
-{ $examples
-  { $example "{ 1 2 3 } >list { 4 5 6 } >list 2list { [ first odd? ] } [ first2 + ] lcomp*" }
-}
-{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp lmerge } ;
-
-HELP: lmerge
-{ $values { "list1" "a list" } { "list2" "a list" } { "result" "lazy list merging list1 and list2" } }
-{ $description "Return the result of merging the two lists in a lazy manner." } 
-{ $examples
-  { $example "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array\n => { 1 4 2 5 3 6 }" }
-}
-{ $see-also leach lmap lmap-with lconcat ltake lsubset lfrom-by lcartesian-product lcomp } ;
-
diff --git a/libs/lazy-lists/load.factor b/libs/lazy-lists/load.factor
deleted file mode 100644 (file)
index 1aa6357..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-PROVIDE: libs/lazy-lists
-{ +files+ {
-    "lists.factor"
-    "lists.facts"
-    "lazy.factor"
-    "lazy.facts"
-    "lazy-io.factor"
-    "lazy-io.facts"
-    "examples.factor"
-} }
-{ +tests+ {
-    "test/lists.factor"
-} } ;
\ No newline at end of file
diff --git a/libs/lazy-lists/old-doc.html b/libs/lazy-lists/old-doc.html
deleted file mode 100644 (file)
index 4c04301..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-<html>
-  <head>
-    <title>Lazy Evaluation</title>
-    <link rel="stylesheet" type="text/css" href="style.css">
-      </head>
-  <body>
-    <h1>Lazy Evaluation</h1>
-<p>The 'lazy' vocabulary adds lazy lists to Factor. This provides the
-    ability to describe infinite structures, and to delay execution of
-    expressions until they are actually used.</p>
-<p>Lazy lists, like normal lists, are composed of a head and tail. In
-    a lazy list the head and tail are something called a 'promise'. 
-    To convert a
-    'promise' into its actual value a word called 'force' is used. To
-    convert a value into a 'promise' the word to use is 'delay'.</p>
-<table border="1">
-<tr><td><a href="#delay">delay</a></td></tr>
-<tr><td><a href="#force">force</a></td></tr>
-</table>
-
-<p>Many of the lazy list words are named similar to the standard list
-    words but with an 'l' suffixed to it. Here are the commonly used
-    words and their equivalent list operation:</p>
-<table border="1">
-<tr><th>Lazy List</th><th>Normal List</th></tr>
-<tr><td><a href="#lnil">lnil</a></td><td>[ ]</td></tr>
-<tr><td><a href="#lnilp">lnil?</a></td><td>Test for nil value</td></tr>
-<tr><td><a href="#lcons">lcons</a></td><td>cons</td></tr>
-<tr><td><a href="#lunit">lunit</a></td><td>unit</td></tr>
-<tr><td><a href="#lcar">lcar</a></td><td>car</td></tr>
-<tr><td><a href="#lcdr">lcdr</a></td><td>cdr</td></tr>
-<tr><td><a href="#lnth">lnth</a></td><td>nth</td></tr>
-<tr><td><a href="#luncons">luncons</a></td><td>uncons</td></tr>
-<tr><td><a href="#lmap">lmap</a></td><td>map</td></tr>
-<tr><td><a href="#lsubset">lsubset</a></td><td>subset</td></tr>
-<tr><td><a href="#leach">leach</a></td><td>each</td></tr>
-<tr><td><a href="#lappend">lappend</a></td><td>append</td></tr>
-</table>
-<p>A few additional words specific to lazy lists are:</p>
-<table border="1">
-<tr><td><a href="#ltake">ltake</a></td><td>Returns a normal list containing a specified
-number of items from the lazy list.</td></tr>
-<tr><td><a href="#lappendstar">lappend*</a></td><td>Given a lazy list of lazy lists,
-concatenate them together in a lazy manner, returning a single lazy
-list.</td></tr>
-<tr><td><a href="#list>llist">list>llist</a></td><td>Given a normal list, return a lazy list
-that contains the same elements as the normal list.</td></tr>
-</table>
-<h2>Reference</h2>
-<!-- delay description -->
-<a name="delay">
-<h3>delay ( quot -- &lt;promise&gt; )</h3>
-<p>'delay' is used to convert a value or expression into a promise.
-   The word 'force' is used to convert that promise back to its
-   value, or to force evaluation of the expression to return a value.
-</p>
-<p>The value on the stack that 'delay' expects must be quoted. This is
-   a requirement to prevent it from being evaluated.
-</p>
-<pre class="code">
-  ( 1 ) [ 42 ] <a href="#delay">delay</a> dup .
-       => &lt;&lt; promise [ ] [ 42 ] [ ] [ ] &gt;&gt;
-  ( 2 ) <a href="#force">force</a> .
-       => 42
-</pre>
-
-<!-- force description -->
-<a name="force">
-<h3>force ( &lt;promise&gt; -- value )</h3>
-<p>'force' will evaluate a promises original expression
-   and leave the value of that expression on the stack.
-</p>
-<p>A promise can be forced multiple times but the expression
-   is only evaluated once. Future calls of 'force' on the promise
-   will returned the cached value of the original force. If the
-   expression contains side effects, such as i/o, then that i/o
-   will only occur on the first 'force'. See below for an example
-   (steps 3-5).
-</p>
-<p>If a promise is itself delayed, a force will evaluate all promises
-   until a value is returned. Due to this behaviour it is generally not
-   possible to delay a promise. The example below shows what happens
-   in this case.
-</p>
-<pre class="code">       
-  ( 1 ) [ 42 ] <a href="#delay">delay</a> dup .
-       => &lt;&lt; promise [ ] [ 42 ] [ ] [ ] &gt;&gt;
-  ( 2 ) <a href="#force">force</a> .
-       => 42
-       
-        #! Multiple forces on a promise returns cached value
-  ( 3 ) [ "hello" print 42 ] <a href="#delay">delay</a> dup .
-       => << promise [ ] [ "hello" print 42 ] [ ] [ ] >>
-  ( 4 ) dup <a href="#force">force</a> .
-       => hello
-          42
-  ( 5 ) <a href="#force">force</a> .
-       => 42
-
-        #! Forcing a delayed promise cascades up to return
-        #! original value, rather than the promise.
-  ( 6 ) [ [ 42 ] <a href="#delay">delay</a> ] <a href="#delay">delay</a> dup .
-       => << promise [ ] [ [ 42 ] delay ] [ ] [ ] >>
-  ( 7 ) <a href="#force">force</a> .
-       => 42
-</pre>
-
-<!-- lnil description -->
-<a name="lnil">
-<h3>lnil ( -- lcons )</h3>
-<p>Returns a value representing the empty lazy list.</p>
-<pre class="code">
-  ( 1 ) <a href="#lnil">lnil</a> .
-       => << promise [ ] [ [ ] ] t [ ] >>
-</pre>
-
-<!-- lnil description -->
-<a name="lnilp">
-<h3>lnil? ( lcons -- bool )</h3>
-<p>Returns true if the given lazy cons is the value representing 
-   the empty lazy list.</p>
-<pre class="code">
-  ( 1 ) <a href="#lnil">lnil</a> <a href="#lnilp">lnil?</a> .
-       => t
-  ( 2 ) [ 1 ] <a href="#list2llist">list&gt;llist</a> dup <a href="#lnilp">lnil?</a> .
-       => [ ]
-  ( 3 ) <a href="#lcdr">lcdr</a> <a href="#lnilp">lnil?</a> .
-       => t
-</pre>
-
-<!-- lcons description -->
-<a name="lcons">
-<h3>lcons ( car-promise cdr-promise -- lcons )</h3>
-<p>Provides the same effect as 'cons' does for normal lists. 
-   Both values provided must be promises (ie. expressions that have
-   had <a href="#delay">delay</a> called on them).
-</p>
-<p>As the car and cdr passed on the stack are promises, they are not
-   evaluated until <a href="#lcar">lcar</a> or <a href="#lcdr">lcdr</a>
-   are called on the lazy cons.</p>
-<pre class="code">
-  ( 1 ) [ "car" ] <a href="#delay">delay</a> [ "cdr" ] <a href="#delay">delay</a> <a href="#lcons">lcons</a> dup .
-       => &lt;&lt; promise ... &gt;&gt;
-  ( 2 ) dup <a href="#lcar">lcar</a> .
-       => "car"
-  ( 3 ) dup <a href="#lcdr">lcdr</a> .
-       => "cdr"
-</pre>
-  
-<!-- lunit description -->
-<a name="lunit">
-<h3>lunit ( value-promise -- llist )</h3>
-<p>Provides the same effect as 'unit' does for normal lists. It
-creates a lazy list where the first element is the value given.</p>
-<p>Like <a href="#lcons">lcons</a>, the value on the stack must be
-   a promise and is not evaluated until the <a href="#lcar">lcar</a>
-   of the list is requested.</a>
-<pre class="code">
-  ( 1 ) [ 42 ] <a href="#delay">delay</a> <a href="#lunit">lunit</a> dup .
-       => &lt;&lt; promise ... &gt;&gt;
-  ( 2 ) dup <a href="#lcar">lcar</a> .
-       => 42
-  ( 3 ) dup <a href="#lcdr">lcdr</a> <a href="#lnilp">lnil?</a> .
-       => t
-  ( 4 ) [ . ] <a href="#leach">leach</a>
-       => 42
-</pre>
-
-<!-- lcar description -->
-<a name="lcar">
-<h3>lcar ( lcons -- value )</h3>
-<p>Provides the same effect as 'car' does for normal lists. It
-returns the first element in a lazy cons cell. This will force
-the evaluation of that element.</p>
-<pre class="code">
-  ( 1 ) [ 42 ] <a href="#delay">delay</a> <a href="#lunit">lunit</a> dup .
-       => &lt;&lt; promise ... &gt;&gt;
-  ( 2 ) <a href="#lcar">lcar</a> .
-       => 42
-</pre>
-
-<!-- lcdr description -->
-<a name="lcdr">
-<h3>lcdr ( lcons -- value )</h3>
-<p>Provides the same effect as 'cdr' does for normal lists. It
-returns the second element in a lazy cons cell and forces it. This
-causes that element to be evaluated immediately.</p>
-<pre class="code">
-  ( 1 ) [ 1 ] <a href="#delay">delay</a> [ 5 6 + ] <a href="#delay">delay</a> <a href="#lcons">lcons</a> dup .
-       => &lt;&lt; promise ... &gt;&gt;
-  ( 2 ) <a href="#lcdr">lcdr</a> .
-       => 11
-</pre>
-
-<pre class="code">
-  ( 1 ) 5 <a href="#lfrom">lfrom</a> dup .
-       => &lt;&lt; promise ... &gt;&gt;
-  ( 2 ) <a href="#lcdr">lcdr</a> dup <a href="#lcar">lcar</a> .
-       => 6
-  ( 3 ) <a href="#lcdr">lcdr</a> dup <a href="#lcar">lcar</a> .
-       => 7
-  ( 4 ) <a href="#lcdr">lcdr</a> dup <a href="#lcar">lcar</a> .
-       => 8
-</pre>
-
-<!-- lnth description -->
-<a name="lnth">
-<h3>lnth ( n llist -- value )</h3>
-<p>Provides the same effect as 'nth' does for normal lists. It
-returns the nth value in the lazy list. It causes all the values up to
-'n' to be evaluated.</p>
-<pre class="code">
-  ( 1 ) 1 <a href="#lfrom">lfrom</a> dup .
-       => &lt;&lt; promise ... &gt;&gt;
-  ( 2 ) 5 swap <a href="#lnth">lnth</a> .
-       => 6
-</pre>
-
-<!-- luncons description -->
-<a name="luncons">
-<h3>luncons ( lcons -- car cdr )</h3>
-<p>Provides the same effect as 'uncons' does for normal lists. It
-returns the car and cdr of the lazy list.</p>
-<pre class="code">
-  ( 1 ) [ 5 ] <a href="#delay">delay</a> [ 6 ] <a  href="#delay">delay</a> <a href="#lcons">lcons</a> dup .
-       => &lt;&lt; promise ... &gt;&gt;
-  ( 2 ) <a href="#luncons">luncons</a> . .
-       => 6
-          5
-</pre>
-
-<!-- lmap description -->
-<a name="lmap">
-<h3>lmap ( llist quot -- llist )</h3>
-<p>Lazily maps over a lazy list applying the quotation to each element.
-A new lazy list is returned which contains the results of the
-quotation.</p>
-<p>When intially called nothing in the original lazy list is
-evaluated. Only when <a href="#lcar">lcar</a> is called will the item
-in the list be evaluated and applied to the quotation. Ditto with <a
-href="#lcdr">lcdr</a>, thus allowing infinite lists to be mapped over.</p>
-<pre class="code">
-  ( 1 ) 1 <a href="#lfrom">lfrom</a>
-       => < infinite list of incrementing numbers >
-  ( 2 ) [ 2 * ] <a href="#lmap">lmap</a>
-       => < infinite list of numbers incrementing by 2 >
-  ( 3 ) 5 swap <a href="#ltake">ltake</a> <a  href="#llist2list">llist&gt;list</a> .
-       => [ 2 4 6 8 10 ]
-</pre>
-
-<!-- lsubset description -->
-<a name="lsubset">
-<h3>lsubset ( llist pred -- llist )</h3>
-<p>Provides the same effect as 'subset' does for normal lists. It
-lazily iterates over a lazy list applying the predicate quotation to each
-element. If that quotation returns true, the element will be included
-in the resulting lazy list. If it is false, the element will be skipped.
-A new lazy list is returned which contains  all elements where the
-predicate returned true.</p>
-<p>Like <a href="#lmap">lmap</a>, when initially called no evaluation
-will occur. A lazy list is returned that when values are retrieved
-from in then items are evaluated and checked against the predicate.</p>
-<pre class="code">
-  ( 1 ) 1 <a href="#lfrom">lfrom</a>
-       => < infinite list of incrementing numbers >
-  ( 2 ) [ <a href="#primep">prime?</a> ] <a href="#lsubset">lsubset</a>
-       => < infinite list of prime numbers >
-  ( 3 ) 5 swap <a href="#ltake">ltake</a> <a  href="#llist2list">llist&gt;list</a> .
-       => [ 2 3 5 7 11 ]
-</pre>
-
-<!-- leach description -->
-<a name="leach">
-<h3>leach ( llist quot --  )</h3>
-<p>Provides the same effect as 'each' does for normal lists. It
-lazily iterates over a lazy list applying the quotation to each
-element. If this operation is applied to an infinite list it will
-never return unless the quotation escapes out by calling a continuation.</p>
-<pre class="code">
-  ( 1 ) 1 <a href="#lfrom">lfrom</a>
-       => < infinite list of incrementing numbers >
-  ( 2 ) [ 2 mod 1 = ] <a href="#lsubset">lsubset</a>
-       => < infinite list of odd numbers >
-  ( 3 ) [ . ] <a href="#leach">leach</a> 
-       => 1
-          3
-          5
-          7
-          ... for ever ...
-</pre>
-
-<!-- ltake description -->
-<a name="ltake">
-<h3>ltake ( n llist -- llist )</h3>
-<p>Iterates over the lazy list 'n' times, appending each element to a
-lazy list. This provides a convenient way of getting elements out of
-an infinite lazy list.</p>
-<pre class="code">
-  ( 1 ) : ones [ 1 ] delay [ ones ] delay <a href="#lcons">lcons</a> ;
-  ( 2 ) 5 ones <a href="#ltake">ltake</a> <a  href="#llist2list">llist&gt;list</a> .
-       => [ 1 1 1 1 1  ]
-</pre>
-
-<!-- lappend description -->
-<a name="lappend">
-<h3>lappend ( llist1 llist2 -- llist )</h3>
-<p>Lazily appends two lists together. The actual appending is done
-lazily on iteration rather than immediately so it works very fast no
-matter how large the list.</p>
-<pre class="code">
-  ( 1 ) [ 1 2 3 ] <a href="#list2llist">list&gt;llist</a> [ 4 5 6 ] <a href="#list2llist">list&gt;llist</a> <a href="#lappend">lappend</a>
-  ( 2 ) [ . ] <a href="#leach">leach</a>
-       => 1
-          2
-          3
-          4
-          5
-          6
-</pre>
-
-<!-- lappend* description -->
-<a name="lappendstar">
-<h3>lappend* ( llists -- llist )</h3>
-<p>Given a lazy list of lazy lists, concatenate them together in a
-lazy fashion. The actual appending is done lazily on iteration rather
-than immediately so it works very fast no matter how large the lists.</p>
-<pre class="code">
-  ( 1 ) [ 1 2 3 ] <a href="#list2>llist">list&gt;llist</a> 
-  ( 2 ) [ 4 5 6 ] <a href="#list2llist">list&gt;llist</a> 
-  ( 3 ) [ 7 8 9 ] <a href="#list2llist">list&gt;llist</a>
-  ( 4 ) 3list <a href="#list2llist">list&gt;llist</a> <a href="#lappendstar">lappend*</a>
-  ( 5 ) [ . ] <a href="#leach">leach</a>
-       => 1
-          2
-          3
-          4
-          5
-          6
-          7
-          8
-          9
-</pre>
-
-<!-- list>llist description -->
-<a name="list2llist">
-<h3>list&gt;llist ( list  -- llist )</h3>
-<p>Converts a normal list into a lazy list. This is done lazily so the
-initial list is not iterated through immediately.</p>
-<pre class="code">
-  ( 1 ) [ 1 2 3 ] <a href="#list2llist">list&gt;llist</a> 
-  ( 2 ) [ . ] <a href="#leach">leach</a>
-       => 1
-          2
-          3
-</pre>
-
-<p class="footer">
-News and updates to this software can be obtained from the authors
-weblog: <a href="http://radio.weblogs.com/0102385">Chris Double</a>.</p>
-<p id="copyright">Copyright (c) 2004, Chris Double. All Rights Reserved.</p>
-</body> </html>
diff --git a/libs/lazy-lists/test/examples.factor b/libs/lazy-lists/test/examples.factor
deleted file mode 100644 (file)
index e60305a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: lazy-examples lazy-lists test ;
-IN: temporary
-
-[ { 1 3 5 7 } ] [ 4 odds ltake list>array ] unit-test
-[ { 0 1 4 9 16 } ] [ first-five-squares ] unit-test
-[ { 2 3 5 7 11 13 17 19 23 29 } ] [ first-ten-primes ] unit-test
diff --git a/libs/lazy-lists/test/lists.factor b/libs/lazy-lists/test/lists.factor
deleted file mode 100644 (file)
index def76a4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-! Copyright (C) 2006 Matthew Willis and Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-USING: lazy-lists test kernel math io sequences ;
-IN: temporary
-
-[ { 1 2 3 4 } ] [
-  { 1 2 3 4 } >list list>array
-] unit-test
-
-[ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
-  { 1 2 3 } >list { 4 5 } >list 2list lcartesian-product* list>array
-] unit-test
-
-[ { { 1 4 } { 1 5 } { 2 4 } { 2 5 } { 3 4 } { 3 5 } } ] [
-  { 1 2 3 } >list { 4 5 } >list lcartesian-product list>array
-] unit-test
-
-[ { 5 6 6 7 7 8 } ] [ 
-  { 1 2 3 } >list { 4 5 } >list 2list [ first2 + ] lcomp list>array
-] unit-test
-
-[ { 5 6 7 8 } ] [ 
-  { 1 2 3 } >list { 4 5 } >list 2list { [ first odd? ] } [ first2 + ] lcomp* list>array
-] unit-test
diff --git a/libs/levenshtein/levenshtein.factor b/libs/levenshtein/levenshtein.factor
deleted file mode 100644 (file)
index 8aab1d9..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays help io kernel math namespaces sequences words ;
-IN: levenshtein
-
-: <matrix> ( m n -- matrix )
-    [ drop 0 <array> ] map-with ; inline
-
-: matrix-> nth nth ; inline
-: ->matrix nth set-nth ; inline
-
-SYMBOL: d
-
-: ->d ( n i j -- ) d get ->matrix ; inline
-: d-> ( i j -- n ) d get matrix-> ; inline
-
-SYMBOL: costs
-
-: init-d ( str1 str2 -- )
-    [ length 1+ ] 2apply 2dup <matrix> d set
-    [ 0 over ->d ] each
-    [ dup 0 ->d ] each ; inline
-
-: compute-costs ( str1 str2 -- )
-    >array [
-        swap >array [ = 0 1 ? ] map-with
-    ] map-with costs set ; inline
-
-: levenshtein-step ( i j -- )
-    [ 1+ d-> 1+ ] 2keep
-    [ >r 1+ r> d-> 1+ ] 2keep
-    [ d-> ] 2keep
-    [ costs get matrix-> + min min ] 2keep
-    >r 1+ r> 1+ ->d ; inline
-
-: levenshtein-result ( -- n ) d get peek peek ; inline
-
-: levenshtein ( str1 str2 -- n )
-    [
-        2dup init-d
-        2dup compute-costs
-        [ length ] 2apply [
-            swap [ swap levenshtein-step ] each-with
-        ] each-with
-        levenshtein-result
-    ] with-scope ;
-
-: fancy-apropos ( str -- )
-    all-words
-    [ [ word-name levenshtein ] keep 2array ] map-with
-    [ first 3 <= ] subset
-    natural-sort [
-        second [ word-name ] keep [ help ] write-outliner
-        terpri
-    ] each ;
diff --git a/libs/levenshtein/load.factor b/libs/levenshtein/load.factor
deleted file mode 100644 (file)
index 9405e55..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-PROVIDE: libs/levenshtein
-{ +files+ { "levenshtein.factor" } }
-{ +tests+ { "tests.factor" } } ;
diff --git a/libs/levenshtein/tests.factor b/libs/levenshtein/tests.factor
deleted file mode 100644 (file)
index 7dd649b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: levenshtein
-USING: test ;
-
-[ 3 ] [ "sitting" "kitten" levenshtein ] unit-test
-[ 3 ] [ "kitten" "sitting" levenshtein ] unit-test
-[ 1 ] [ "freshpak" "freshpack" levenshtein ] unit-test
-[ 1 ] [ "freshpack" "freshpak" levenshtein ] unit-test
diff --git a/libs/match/load.factor b/libs/match/load.factor
deleted file mode 100644 (file)
index 35cc94c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-PROVIDE: libs/match
-{ +files+ {
-  "match.factor"
-  "match.facts"
-} }
-{ +tests+ {
-  "tests.factor"
-} } ;
diff --git a/libs/match/match.factor b/libs/match/match.factor
deleted file mode 100644 (file)
index 564a80a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! Based on pattern matching code from Paul Graham's book 'On Lisp'.
-IN: match
-USING: kernel words sequences namespaces hashtables parser generic ;
-
-SYMBOL: _
-USE: prettyprint
-
-: define-match-var ( name -- )
-  create-in dup t "match-var" set-word-prop [ dup <wrapper> , \ get , ] [ ] make define-compound ;
-
-: define-match-vars ( seq -- )
-  [ define-match-var ] each ;
-
-: MATCH-VARS: ! vars ...
-  string-mode on [ string-mode off define-match-vars ] f ; parsing
-
-: match-var? ( symbol -- bool )
-  dup word? [
-    "match-var" word-prop
-  ] [
-    drop f
-  ] if ;
-
-: && ( obj seq -- ? ) [ call ] all-with? ;
-
-: (match) ( seq1 seq2 -- matched? )
-  {
-    { [ 2dup = ] [ 2drop t ] }
-    { [ over _ = ] [ 2drop t ] } 
-    { [ dup _ = ] [ 2drop t ] }
-    { [ dup match-var? ] [ set t ] }
-    { [ over match-var? ] [ swap set t ] }
-    { [ over { [ sequence? ] [ empty? not ] } && over { [ sequence? ] [ empty? not ] } && and [ over first over first (match) ] [ f ] if ] [ >r 1 tail r> 1 tail (match) ] }
-    { [ over tuple? over tuple? and ] [ >r tuple>array r> tuple>array (match) ] }
-    { [ t ] [ 2drop f ] }
-  } cond ;
-
-: match ( seq1 seq2 -- bindings )
-  [ (match) ] make-hash swap [ drop f ] unless ;
-
-SYMBOL: result
-
-: match-cond ( seq assoc -- )
-  [
-    [ first over match dup result set ] find 2nip dup [ result get [ second call ] bind ] [ no-cond ] if 
-  ] with-scope ;
diff --git a/libs/match/match.facts b/libs/match/match.facts
deleted file mode 100644 (file)
index 530bbd1..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: help match namespaces ;
-
-HELP: match 
-{ $values { "value1" "an object" } { "value2" "an object" } { "bindings" "A hashtable" }
-}
-{ $description "Pattern match value1 against value2. These values can be any Factor value, including sequences and tuples. The values can contain pattern variables, which are symbols that begin with '?'. The result is a hashtable of the bindings, mapping the pattern variables from one sequence to the equivalent value in the other sequence. The '_' symbol can be used to ignore the value at that point in the pattern for the match. " } 
-{ $examples 
-    { $example "MATCH-VARS: ?a ?b ;\n{ ?a { 2 ?b } 5 } { 1 { 2 3 } _ } match\n => H{ { ?a 1 } { ?b 3 } }" }
-}
-{ $see-also match-cond POSTPONE: MATCH-VARS: } ;
-
-HELP: match-cond
-{ $values { "value" "an object" } { "assoc" "A sequence of quotation pairs" } }
-{ $description "Calls the second quotation in the first pair whose first sequence yields a successful " { $link match } " against 'value'. The second quotation, when called, has the hashtable returned from the " { $link match } " call bound as the top namespace so " { $link get } " can be used to retrieve the values. To have a fallthrough match clause use the '_' match variable." } 
-{ $examples 
-    { $example "MATCH-VARS: ?value ;\n{ increment ?value } {\n  { { increment ?value } [ ?value do-something ] }\n  { { decrement ?value } [ ?value do-something-else ] }\n  { _ [ no-match-found ] }\n} match-cond" }
-}
-{ $see-also match POSTPONE: MATCH-VARS: } ;
-
-
-HELP: MATCH-VARS:
-{ $syntax "MATCH-VARS: var ... ;" }
-{ $values { "var" "a match variable name beginning with '?'" } }
-{ $description "Creates a symbol that can be used in " { $link match } " and " { $link match-cond } " for binding values in the matched sequence. The symbol name is created as a word that is defined to get the value of the symbol out of the current namespace. This can be used in " { $link match-cond } " to retrive the values in the quotation body." }
-{ $examples 
-    { $example "MATCH-VARS: ?value ;\n{ increment ?value } {\n  { { increment ?value } [ ?value do-something ] }\n  { { decrement ?value } [ ?value do-something-else ] }\n  { _ [ no-match-found ] }\n} match-cond" }
-}
-{ $see-also match match-cond } ;
\ No newline at end of file
diff --git a/libs/match/tests.factor b/libs/match/tests.factor
deleted file mode 100644 (file)
index 326fa06..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: test match namespaces arrays ;
-IN: temporary
-
-MATCH-VARS: ?a ?b ;
-
-[ H{ { ?a 1 } { ?b 2 } } ] [
- { ?a ?b } { 1 2 } match
-] unit-test
-
-[ { 1 2 } ] [ 
-  { 1 2 } 
-  {
-    { { ?a ?b } [ ?a ?b 2array ] }
-  } match-cond
-] unit-test
-
-[ t ] [ 
-  { 1 2 } 
-  {
-    { { 1 2 } [ t ] }
-    { f [ f ] }
-  } match-cond
-] unit-test
-
-[ t ] [ 
-  { 1 3 } 
-  {
-    { { 1 2 } [ t ] }
-    { { 1 3 } [ t ] }
-  } match-cond
-] unit-test
-
-[ f ] [ 
-  { 1 5 } 
-  {
-    { { 1 2 } [ t ] }
-    { { 1 3 } [ t ] }
-    { _       [ f ] }
-  } match-cond
-] unit-test
-
-TUPLE: foo a b ;
-
-{ 1 2 } [
-  1 2 <foo> T{ foo f ?a ?b } match [
-    ?a ?b
-  ] bind
-] unit-test
-
-{ 1 2 } [
-  1 2 <foo> \ ?a \ ?b <foo> match [
-    ?a ?b
-  ] bind
-] unit-test
\ No newline at end of file
diff --git a/libs/math/TODO.txt b/libs/math/TODO.txt
deleted file mode 100644 (file)
index b3ee36d..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-Nice to have:
-
-- Permutations -- composition (trivial; use sort and map-with)
-- Analysis:
-  - error function, cosine integral, sine integral, fresnel functions
-  - logarithm integral, zeta function
-  - airy wave function
-  - hypergeometric functions
-  - elliptic functions
-  - numerical integration
-  - numerical differentiation
-  - infinite limits, sums, products (all done using a limit combinator)
-  - finding roots with Newton's method
-  - solving ODEs with Runge-Kutta
-  - matrices: singular value decomposition, eigenvalues, LU decomposition,
-    polar decomposition
-  - square root of a matrix, e^matrix
-  - finding roots of polynomials
-- Algebra:
-  - p^
-  - p^mod for polynomials
-  - pmod-inv for polynomials
-  - matrices: row reduction, integer row reduction, matrix inverse,
-    determinant
-  - probablistic primality tests
-  - polynomials over finite fields
-  - elliptic curves: group of points, over Q and finite fields
-  - elliptic curve factorization of integers
-  - interval arithmetic
-  - combinatorics: stirling numbers
-  - factoring polynomials over finite fields
-  - minimal and characteristic polynomials of algebraic numbers
-  - norm and trace of algebraic numbers
-  - minimal and characteristic polynomials of matrices
-- Logic:
-  - tautology checker
-  - CNF, DNF
-  - natural deduction proof checker
-- Statistics:
-  - linear regression
-- Geometry:
-  - regions
-  - rectangles, ellipses, lines
-  - unions, intersections, complements of regions
-  - shortest distance between two regions
-  - tangents
-  - intersection testing
-  - projections
-- Symbolic algebra:
-  - trigonometric identities
-  - symbolic differentiation
-  - differential forms
-  - wedge product
-  - power series
-- Graphics:
-  - 2D, 3D plots
-  - y=f(x), implicit, parametric
-  - "4D" animated 3D plots
-  - prettyprinting of symbolic expressions
diff --git a/libs/math/analysis.factor b/libs/math/analysis.factor
deleted file mode 100644 (file)
index c99f1e4..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-IN: analysis-internals
-USING: kernel sequences errors namespaces math ;
-
-: Z:(-inf,0]? ( n -- bool )
-    #! nonpositive integer
-    dup 0 <= [ integer? ] [ drop f ] if ;
-
-! http://www.rskey.org/gamma.htm  "Lanczos Approximation"
-! n=6: error ~ 3 x 10^-11
-
-: gamma-g6 5.15 ; inline
-
-: gamma-p6
-    {
-        2.50662827563479526904 225.525584619175212544 -268.295973841304927459
-        80.9030806934622512966 -5.00757863970517583837 0.0114684895434781459556 
-    } ; inline
-
-: gamma-z ( x n -- seq )
-    [ + recip ] map-with 1.0 0 pick set-nth ;
-
-: (gamma-lanczos6) ( x -- log[gamma[x+1]] )
-    #! log(gamma(x+1)
-    dup 0.5 + dup gamma-g6 + dup >r log * r> -
-    swap 6 gamma-z gamma-p6 v. log + ;
-
-: gamma-lanczos6 ( x -- gamma[x] )
-    #! gamma(x) = gamma(x+1) / x
-    dup (gamma-lanczos6) exp swap / ;
-
-: gammaln-lanczos6 ( x -- gammaln[x] )
-    #! log(gamma(x)) = log(gamma(x+1)) - log(x)
-    dup (gamma-lanczos6) swap log - ;
-
-: gamma-neg ( gamma[abs[x]] x -- gamma[x] )
-    dup pi * sin * * pi neg swap / ; inline
-
-IN: math-contrib
-
-: gamma ( x -- y )
-    #! gamma(x) = integral 0..inf [ t^(x-1) exp(-t) ] dt
-    #! gamma(n+1) = n! for n > 0
-    dup Z:(-inf,0]? [
-            drop 1./0.
-        ] [
-            dup abs gamma-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if
-    ] if ;
-
-: gammaln ( x -- gamma[x] )
-    #! gammaln(x) is an alternative when gamma(x)'s range
-    #! varies too widely
-    dup 0 < [
-            drop 1./0.
-        ] [
-            dup abs gammaln-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if
-    ] if ;
-
-: nth-root ( n x -- y )
-    over 0 = [ "0th root is undefined" throw ] when >r recip r> swap ^ ;
-
-! Forth Scientific Library Algorithm #1
-!
-! Evaluates the Real Exponential Integral,
-!     E1(x) = - Ei(-x) =   int_x^\infty exp^{-u}/u du      for x > 0
-! using a rational approximation
-!
-! Collected Algorithms from ACM, Volume 1 Algorithms 1-220,
-! 1980; Association for Computing Machinery Inc., New York,
-! ISBN 0-89791-017-6
-!
-! (c) Copyright 1994 Everett F. Carter.  Permission is granted by the
-! author to use this software for any application provided the
-! copyright notice is preserved.
-
-: exp-int ( x -- y )
-    #! For real values of x only. Accurate to 7 decimals.
-    dup 1.0 < [
-        dup 0.00107857 * 0.00976004 -
-        over *
-        0.05519968 +
-        over *
-        0.24991055 -
-        over *
-        0.99999193 +
-        over *
-        0.57721566 -
-        swap log -
-    ] [
-        dup 8.5733287401 +
-        over *
-        18.059016973 +
-        over *
-        8.6347608925 +
-        over *
-        0.2677737343 +
-
-        over
-        dup 9.5733223454 +
-        over *
-        25.6329561486 +
-        over *
-        21.0996530827 +
-        over *
-        3.9584969228 +
-
-        nip
-        /
-        over /
-        swap -1.0 * exp
-        *
-    ] if ;
diff --git a/libs/math/combinatorics.factor b/libs/math/combinatorics.factor
deleted file mode 100644 (file)
index 2a60f2b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-IN: math-contrib
-USING: arrays kernel sequences errors namespaces math ;
-
-: <range> ( from to -- seq ) dup <slice> ; inline
-: (0..n] ( n -- (0..n] ) 1+ 1 swap <range> ; inline
-: [1..n] ( n -- [1..n] ) (0..n] ; inline
-: [k..n] ( k n -- [k..n] ) 1+ <range> ; inline
-: (k..n] ( k n -- (k..n] ) [ 1+ ] 2apply <range> ; inline
-
-: Z:(-inf,0]? ( n -- bool )
-    #! nonpositive integer
-    dup 0 <= [ integer? ] [ drop f ] if ;
-
-: factorial ( n -- n! ) (0..n] product ;
-
-: factorial-part ( k! k n -- n! )
-    #! calculate n! given n, k, k!
-    (k..n] product * ;
-
-: nCk ( n k -- nCk )
-    #! uses the results from min(k!,(n-k)!) to compute max(k!,(n-k)!)
-    #! use max(k!,(n-k)!) to compute n!
-    2dup < [
-        2drop 0
-    ] [
-        [ - ] 2keep rot 2dup < [ swap ] when
-        [ factorial ] keep over
-        >r rot [ factorial-part ] keep rot pick >r factorial-part r> r> * /
-    ] if ;
-
-: nPk ( n k -- nPk )
-    #! uses the results from (n-k)! to compute n!
-    2dup < [
-        2drop 0
-    ] [
-        2dup - nip [ factorial ] keep rot pick >r factorial-part r> /
-    ] if ;
-
-: inverse-permutation ( seq -- seq )
-    dup length dup 0 <array> -rot swap [ pick set-nth ] 2each ;
-
diff --git a/libs/math/load.factor b/libs/math/load.factor
deleted file mode 100644 (file)
index 9a31bf7..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-REQUIRES: libs/sequences ;
-PROVIDE: libs/math
-{ +files+ {
-    "utils.factor"
-    "combinatorics.factor"
-    "analysis.factor"
-    "polynomials.factor"
-    "quaternions.factor"
-    "matrices.factor"
-    "statistics.factor"
-    "numerical-integration.factor"
-} }
-{ +tests+ {
-    "test.factor"
-} } ;
diff --git a/libs/math/matrices.factor b/libs/math/matrices.factor
deleted file mode 100644 (file)
index 9cadf76..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
-IN: math-contrib
-USING: arrays generic kernel sequences math ;
-
-! Matrices
-: zero-matrix ( m n -- matrix )
-    swap [ drop 0 <array> ] map-with ;
-
-: identity-matrix ( n -- matrix )
-    #! Make a nxn identity matrix.
-    dup [ swap [ = 1 0 ? ] map-with ] map-with ;
-
-! Matrix operations
-: mneg ( m -- m ) [ vneg ] map ;
-
-: n*m ( n m -- m ) [ n*v ] map-with ;
-: m*n ( m n -- m ) swap n*m ;
-: n/m ( n m -- m ) [ n/v ] map-with ;
-: m/n ( m n -- m ) swap [ swap v/n ] map-with ;
-
-: m+   ( m m -- m ) [ v+ ] 2map ;
-: m-   ( m m -- m ) [ v- ] 2map ;
-: m*   ( m m -- m ) [ v* ] 2map ;
-: m/   ( m m -- m ) [ v/ ] 2map ;
-
-: v.m ( v m -- v ) flip [ v. ] map-with ;
-: m.v ( m v -- v ) swap [ v. ] map-with ;
-: m.  ( m m -- m ) flip swap [ m.v ] map-with ;
-
-: mmin ( m -- n ) >r 1/0. r> [ [ min ] each ] each ;
-: mmax ( m -- n ) >r -1/0. r> [ [ max ] each ] each ;
-: mnorm ( m -- n ) dup mmax abs m/n ;
-: m-almost= ( m n -- ? )
-    t -rot [ [ almost= and ] 2each ] 2each ;
-
diff --git a/libs/math/numerical-integration.factor b/libs/math/numerical-integration.factor
deleted file mode 100644 (file)
index 2e237ed..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-IN: math-contrib
-USING: kernel sequences errors namespaces math vectors errors prettyprint io tools ;
-
-: setup-range ( from to -- frange )
-    >r step-size get r> <frange-no-endpt> ;
-
-: integrate-rect ( from to f -- x )
-    >r setup-range r>
-    [ step-size get * + ] append >r 0 r> reduce ;
-
-: integrate-trap ( from to f -- x )
-    >r setup-range r>
-    map dup 1 tail >r >vector dup pop drop r>
-    [ + 2 / step-size get * ] 2map sum ;
-
-SYMBOL: num-steps 180 num-steps set-global
-: setup-simpson-range ( from to -- frange )
-    [ swap - num-steps get /f ] 2keep swapd <frange> ;
-
-: generate-simpson-weights ( seq -- seq )
-    [ { 1 4 } % length 2 / 2 - [ { 2 4 } % ] times 1 , ] { } make ;
-
-: integrate-simpson ( from to f -- x )
-    >r setup-simpson-range r> dupd map dup generate-simpson-weights
-    0 [ * + ] 2reduce swap [ third ] keep first - 6 / * ; 
-
-
-: quadrature ( from to f -- x ) integrate-simpson ;
-
diff --git a/libs/math/polynomials.factor b/libs/math/polynomials.factor
deleted file mode 100644 (file)
index f13e7b4..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-IN: polynomials-internals
-USING: arrays kernel sequences vectors math math-internals namespaces arrays
-    sequences-contrib ;
-
-! Polynomials are vectors with the highest powers on the right:
-! { 1 1 0 1 } -> 1 + x + x^3
-! { } -> 0
-
-: 2pad-left ( p p n -- p p ) 0 [ pad-left swap ] 2keep pad-left swap ;
-: 2pad-right ( p p n -- p p ) 0 [ pad-right swap ] 2keep pad-right swap ;
-: pextend ( p p -- p p ) 2dup [ length ] 2apply max 2pad-right ;
-: pextend-left ( p p -- p p ) 2dup [ length ] 2apply max 2pad-left ;
-: unempty ( seq -- seq ) dup empty? [ drop { 0 } ] when ;
-: 2unempty ( seq seq -- seq seq ) [ unempty ] 2apply ;
-
-IN: math-contrib
-: p= ( p p -- ? ) pextend = ;
-
-: ptrim ( p -- p ) dup length 1 = [ [ zero? ] rtrim* ] unless ;
-
-: 2ptrim ( p p -- p p ) [ ptrim ] 2apply ;
-: p+ ( p p -- p ) pextend v+ ;
-: p- ( p p -- p ) pextend v- ;
-: n*p ( n p -- n*p ) n*v ;
-
-! convolution
-: pextend-conv ( p p -- p p )
-    #! extend to: p_m + p_n - 1 
-    2dup [ length ] 2apply + 1- 2pad-right [ >vector ] 2apply ;
-
-: p* ( p p -- p )
-    #! Multiply two polynomials.
-    2unempty pextend-conv <reversed> dup length
-    [ over length pick <slice> pick [ * ] 2map sum ] map 2nip reverse ;
-    
-: p-sq ( p -- p-sq )
-    dup p* ;
-
-IN: polynomials-internals
-
-: pop-front ( seq -- seq )
-    1 tail-slice ;
-
-: /-last ( seq seq -- a )
-    #! divide the last two numbers in the sequences
-    [ peek ] 2apply / ;
-
-: p/mod-setup ( p p -- p p n )
-    2ptrim 2dup [ length ] 2apply - dup 1 < [ drop 1 ] when
-    dup >r over length + 0 pad-left pextend r> 1+ ;
-
-: (p/mod)
-    2dup /-last 2dup , n*p swapd p- >vector dup pop drop swap pop-front ;
-
-IN: math-contrib
-: p/mod
-    p/mod-setup [ [ (p/mod) ] times ] V{ } make
-    reverse nip swap 2ptrim pextend ;
-
-: (pgcd) ( b a y x -- a d )
-    dup V{ 0 } clone p= [
-        drop nip
-    ] [
-        tuck p/mod >r pick p* swap >r swapd p- r> r> (pgcd)
-    ] if ;
-
-: pgcd ( p p -- p q )
-    swap V{ 0 } clone V{ 1 } clone 2swap (pgcd) [ >array ] 2apply ;
-
-: pdiff ( p -- p' )
-    #! Polynomial derivative.
-    dup length v* { 0 } ?head drop ;
-
-: polyval ( p x -- p[x] )
-    #! Evaluate a polynomial.
-    >r dup length r> powers v. ;
diff --git a/libs/math/primes.factor b/libs/math/primes.factor
deleted file mode 100644 (file)
index d41310d..0000000
+++ /dev/null
@@ -1,6421 +0,0 @@
-IN: math-contrib
-
-: primes-under-million ( -- seq )
-{
-2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 
-107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 
-223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 
-337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 
-457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 
-593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 
-719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 
-857 859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 
-997 
-1009 1013 1019 1021 1031 1033 1039 1049 1051 1061 1063 1069 1087 1091 1093 1097 
-1103 1109 1117 1123 1129 1151 1153 1163 1171 1181 1187 1193 1201 1213 1217 1223 
-1229 1231 1237 1249 1259 1277 1279 1283 1289 1291 1297 1301 1303 1307 1319 1321 
-1327 1361 1367 1373 1381 1399 1409 1423 1427 1429 1433 1439 1447 1451 1453 1459 
-1471 1481 1483 1487 1489 1493 1499 1511 1523 1531 1543 1549 1553 1559 1567 1571 
-1579 1583 1597 1601 1607 1609 1613 1619 1621 1627 1637 1657 1663 1667 1669 1693 
-1697 1699 1709 1721 1723 1733 1741 1747 1753 1759 1777 1783 1787 1789 1801 1811 
-1823 1831 1847 1861 1867 1871 1873 1877 1879 1889 1901 1907 1913 1931 1933 1949 
-1951 1973 1979 1987 1993 1997 1999 2003 2011 2017 2027 2029 2039 2053 2063 2069 
-2081 2083 2087 2089 2099 2111 2113 2129 2131 2137 2141 2143 2153 2161 2179 2203 
-2207 2213 2221 2237 2239 2243 2251 2267 2269 2273 2281 2287 2293 2297 2309 2311 
-2333 2339 2341 2347 2351 2357 2371 2377 2381 2383 2389 2393 2399 2411 2417 2423 
-2437 2441 2447 2459 2467 2473 2477 2503 2521 2531 2539 2543 2549 2551 2557 2579 
-2591 2593 2609 2617 2621 2633 2647 2657 2659 2663 2671 2677 2683 2687 2689 2693 
-2699 2707 2711 2713 2719 2729 2731 2741 2749 2753 2767 2777 2789 2791 2797 2801 
-2803 2819 2833 2837 2843 2851 2857 2861 2879 2887 2897 2903 2909 2917 2927 2939 
-2953 2957 2963 2969 2971 2999 3001 3011 3019 3023 3037 3041 3049 3061 3067 3079 
-3083 3089 3109 3119 3121 3137 3163 3167 3169 3181 3187 3191 3203 3209 3217 3221 
-3229 3251 3253 3257 3259 3271 3299 3301 3307 3313 3319 3323 3329 3331 3343 3347 
-3359 3361 3371 3373 3389 3391 3407 3413 3433 3449 3457 3461 3463 3467 3469 3491 
-3499 3511 3517 3527 3529 3533 3539 3541 3547 3557 3559 3571 3581 3583 3593 3607 
-3613 3617 3623 3631 3637 3643 3659 3671 3673 3677 3691 3697 3701 3709 3719 3727 
-3733 3739 3761 3767 3769 3779 3793 3797 3803 3821 3823 3833 3847 3851 3853 3863 
-3877 3881 3889 3907 3911 3917 3919 3923 3929 3931 3943 3947 3967 3989 4001 4003 
-4007 4013 4019 4021 4027 4049 4051 4057 4073 4079 4091 4093 4099 4111 4127 4129 
-4133 4139 4153 4157 4159 4177 4201 4211 4217 4219 4229 4231 4241 4243 4253 4259 
-4261 4271 4273 4283 4289 4297 4327 4337 4339 4349 4357 4363 4373 4391 4397 4409 
-4421 4423 4441 4447 4451 4457 4463 4481 4483 4493 4507 4513 4517 4519 4523 4547 
-4549 4561 4567 4583 4591 4597 4603 4621 4637 4639 4643 4649 4651 4657 4663 4673 
-4679 4691 4703 4721 4723 4729 4733 4751 4759 4783 4787 4789 4793 4799 4801 4813 
-4817 4831 4861 4871 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 
-4969 4973 4987 4993 4999 5003 5009 5011 5021 5023 5039 5051 5059 5077 5081 5087 
-5099 5101 5107 5113 5119 5147 5153 5167 5171 5179 5189 5197 5209 5227 5231 5233 
-5237 5261 5273 5279 5281 5297 5303 5309 5323 5333 5347 5351 5381 5387 5393 5399 
-5407 5413 5417 5419 5431 5437 5441 5443 5449 5471 5477 5479 5483 5501 5503 5507 
-5519 5521 5527 5531 5557 5563 5569 5573 5581 5591 5623 5639 5641 5647 5651 5653 
-5657 5659 5669 5683 5689 5693 5701 5711 5717 5737 5741 5743 5749 5779 5783 5791 
-5801 5807 5813 5821 5827 5839 5843 5849 5851 5857 5861 5867 5869 5879 5881 5897 
-5903 5923 5927 5939 5953 5981 5987 6007 6011 6029 6037 6043 6047 6053 6067 6073 
-6079 6089 6091 6101 6113 6121 6131 6133 6143 6151 6163 6173 6197 6199 6203 6211 
-6217 6221 6229 6247 6257 6263 6269 6271 6277 6287 6299 6301 6311 6317 6323 6329 
-6337 6343 6353 6359 6361 6367 6373 6379 6389 6397 6421 6427 6449 6451 6469 6473 
-6481 6491 6521 6529 6547 6551 6553 6563 6569 6571 6577 6581 6599 6607 6619 6637 
-6653 6659 6661 6673 6679 6689 6691 6701 6703 6709 6719 6733 6737 6761 6763 6779 
-6781 6791 6793 6803 6823 6827 6829 6833 6841 6857 6863 6869 6871 6883 6899 6907 
-6911 6917 6947 6949 6959 6961 6967 6971 6977 6983 6991 6997 7001 7013 7019 7027 
-7039 7043 7057 7069 7079 7103 7109 7121 7127 7129 7151 7159 7177 7187 7193 7207 
-7211 7213 7219 7229 7237 7243 7247 7253 7283 7297 7307 7309 7321 7331 7333 7349 
-7351 7369 7393 7411 7417 7433 7451 7457 7459 7477 7481 7487 7489 7499 7507 7517 
-7523 7529 7537 7541 7547 7549 7559 7561 7573 7577 7583 7589 7591 7603 7607 7621 
-7639 7643 7649 7669 7673 7681 7687 7691 7699 7703 7717 7723 7727 7741 7753 7757 
-7759 7789 7793 7817 7823 7829 7841 7853 7867 7873 7877 7879 7883 7901 7907 7919 
-7927 7933 7937 7949 7951 7963 7993 8009 8011 8017 8039 8053 8059 8069 8081 8087 
-8089 8093 8101 8111 8117 8123 8147 8161 8167 8171 8179 8191 8209 8219 8221 8231 
-8233 8237 8243 8263 8269 8273 8287 8291 8293 8297 8311 8317 8329 8353 8363 8369 
-8377 8387 8389 8419 8423 8429 8431 8443 8447 8461 8467 8501 8513 8521 8527 8537 
-8539 8543 8563 8573 8581 8597 8599 8609 8623 8627 8629 8641 8647 8663 8669 8677 
-8681 8689 8693 8699 8707 8713 8719 8731 8737 8741 8747 8753 8761 8779 8783 8803 
-8807 8819 8821 8831 8837 8839 8849 8861 8863 8867 8887 8893 8923 8929 8933 8941 
-8951 8963 8969 8971 8999 9001 9007 9011 9013 9029 9041 9043 9049 9059 9067 9091 
-9103 9109 9127 9133 9137 9151 9157 9161 9173 9181 9187 9199 9203 9209 9221 9227 
-9239 9241 9257 9277 9281 9283 9293 9311 9319 9323 9337 9341 9343 9349 9371 9377 
-9391 9397 9403 9413 9419 9421 9431 9433 9437 9439 9461 9463 9467 9473 9479 9491 
-9497 9511 9521 9533 9539 9547 9551 9587 9601 9613 9619 9623 9629 9631 9643 9649 
-9661 9677 9679 9689 9697 9719 9721 9733 9739 9743 9749 9767 9769 9781 9787 9791 
-9803 9811 9817 9829 9833 9839 9851 9857 9859 9871 9883 9887 9901 9907 9923 9929 
-9931 9941 9949 9967 9973 
-10007 10009 10037 10039 10061 10067 10069 10079 10091 10093 10099 10103 10111 10133 
-10139 10141 10151 10159 10163 10169 10177 10181 10193 10211 10223 10243 10247 10253 
-10259 10267 10271 10273 10289 10301 10303 10313 10321 10331 10333 10337 10343 10357 
-10369 10391 10399 10427 10429 10433 10453 10457 10459 10463 10477 10487 10499 10501 
-10513 10529 10531 10559 10567 10589 10597 10601 10607 10613 10627 10631 10639 10651 
-10657 10663 10667 10687 10691 10709 10711 10723 10729 10733 10739 10753 10771 10781 
-10789 10799 10831 10837 10847 10853 10859 10861 10867 10883 10889 10891 10903 10909 
-10937 10939 10949 10957 10973 10979 10987 10993 11003 11027 11047 11057 11059 11069 
-11071 11083 11087 11093 11113 11117 11119 11131 11149 11159 11161 11171 11173 11177 
-11197 11213 11239 11243 11251 11257 11261 11273 11279 11287 11299 11311 11317 11321 
-11329 11351 11353 11369 11383 11393 11399 11411 11423 11437 11443 11447 11467 11471 
-11483 11489 11491 11497 11503 11519 11527 11549 11551 11579 11587 11593 11597 11617 
-11621 11633 11657 11677 11681 11689 11699 11701 11717 11719 11731 11743 11777 11779 
-11783 11789 11801 11807 11813 11821 11827 11831 11833 11839 11863 11867 11887 11897 
-11903 11909 11923 11927 11933 11939 11941 11953 11959 11969 11971 11981 11987 12007 
-12011 12037 12041 12043 12049 12071 12073 12097 12101 12107 12109 12113 12119 12143 
-12149 12157 12161 12163 12197 12203 12211 12227 12239 12241 12251 12253 12263 12269 
-12277 12281 12289 12301 12323 12329 12343 12347 12373 12377 12379 12391 12401 12409 
-12413 12421 12433 12437 12451 12457 12473 12479 12487 12491 12497 12503 12511 12517 
-12527 12539 12541 12547 12553 12569 12577 12583 12589 12601 12611 12613 12619 12637 
-12641 12647 12653 12659 12671 12689 12697 12703 12713 12721 12739 12743 12757 12763 
-12781 12791 12799 12809 12821 12823 12829 12841 12853 12889 12893 12899 12907 12911 
-12917 12919 12923 12941 12953 12959 12967 12973 12979 12983 13001 13003 13007 13009 
-13033 13037 13043 13049 13063 13093 13099 13103 13109 13121 13127 13147 13151 13159 
-13163 13171 13177 13183 13187 13217 13219 13229 13241 13249 13259 13267 13291 13297 
-13309 13313 13327 13331 13337 13339 13367 13381 13397 13399 13411 13417 13421 13441 
-13451 13457 13463 13469 13477 13487 13499 13513 13523 13537 13553 13567 13577 13591 
-13597 13613 13619 13627 13633 13649 13669 13679 13681 13687 13691 13693 13697 13709 
-13711 13721 13723 13729 13751 13757 13759 13763 13781 13789 13799 13807 13829 13831 
-13841 13859 13873 13877 13879 13883 13901 13903 13907 13913 13921 13931 13933 13963 
-13967 13997 13999 14009 14011 14029 14033 14051 14057 14071 14081 14083 14087 14107 
-14143 14149 14153 14159 14173 14177 14197 14207 14221 14243 14249 14251 14281 14293 
-14303 14321 14323 14327 14341 14347 14369 14387 14389 14401 14407 14411 14419 14423 
-14431 14437 14447 14449 14461 14479 14489 14503 14519 14533 14537 14543 14549 14551 
-14557 14561 14563 14591 14593 14621 14627 14629 14633 14639 14653 14657 14669 14683 
-14699 14713 14717 14723 14731 14737 14741 14747 14753 14759 14767 14771 14779 14783 
-14797 14813 14821 14827 14831 14843 14851 14867 14869 14879 14887 14891 14897 14923 
-14929 14939 14947 14951 14957 14969 14983 15013 15017 15031 15053 15061 15073 15077 
-15083 15091 15101 15107 15121 15131 15137 15139 15149 15161 15173 15187 15193 15199 
-15217 15227 15233 15241 15259 15263 15269 15271 15277 15287 15289 15299 15307 15313 
-15319 15329 15331 15349 15359 15361 15373 15377 15383 15391 15401 15413 15427 15439 
-15443 15451 15461 15467 15473 15493 15497 15511 15527 15541 15551 15559 15569 15581 
-15583 15601 15607 15619 15629 15641 15643 15647 15649 15661 15667 15671 15679 15683 
-15727 15731 15733 15737 15739 15749 15761 15767 15773 15787 15791 15797 15803 15809 
-15817 15823 15859 15877 15881 15887 15889 15901 15907 15913 15919 15923 15937 15959 
-15971 15973 15991 16001 16007 16033 16057 16061 16063 16067 16069 16073 16087 16091 
-16097 16103 16111 16127 16139 16141 16183 16187 16189 16193 16217 16223 16229 16231 
-16249 16253 16267 16273 16301 16319 16333 16339 16349 16361 16363 16369 16381 16411 
-16417 16421 16427 16433 16447 16451 16453 16477 16481 16487 16493 16519 16529 16547 
-16553 16561 16567 16573 16603 16607 16619 16631 16633 16649 16651 16657 16661 16673 
-16691 16693 16699 16703 16729 16741 16747 16759 16763 16787 16811 16823 16829 16831 
-16843 16871 16879 16883 16889 16901 16903 16921 16927 16931 16937 16943 16963 16979 
-16981 16987 16993 17011 17021 17027 17029 17033 17041 17047 17053 17077 17093 17099 
-17107 17117 17123 17137 17159 17167 17183 17189 17191 17203 17207 17209 17231 17239 
-17257 17291 17293 17299 17317 17321 17327 17333 17341 17351 17359 17377 17383 17387 
-17389 17393 17401 17417 17419 17431 17443 17449 17467 17471 17477 17483 17489 17491 
-17497 17509 17519 17539 17551 17569 17573 17579 17581 17597 17599 17609 17623 17627 
-17657 17659 17669 17681 17683 17707 17713 17729 17737 17747 17749 17761 17783 17789 
-17791 17807 17827 17837 17839 17851 17863 17881 17891 17903 17909 17911 17921 17923 
-17929 17939 17957 17959 17971 17977 17981 17987 17989 18013 18041 18043 18047 18049 
-18059 18061 18077 18089 18097 18119 18121 18127 18131 18133 18143 18149 18169 18181 
-18191 18199 18211 18217 18223 18229 18233 18251 18253 18257 18269 18287 18289 18301 
-18307 18311 18313 18329 18341 18353 18367 18371 18379 18397 18401 18413 18427 18433 
-18439 18443 18451 18457 18461 18481 18493 18503 18517 18521 18523 18539 18541 18553 
-18583 18587 18593 18617 18637 18661 18671 18679 18691 18701 18713 18719 18731 18743 
-18749 18757 18773 18787 18793 18797 18803 18839 18859 18869 18899 18911 18913 18917 
-18919 18947 18959 18973 18979 19001 19009 19013 19031 19037 19051 19069 19073 19079 
-19081 19087 19121 19139 19141 19157 19163 19181 19183 19207 19211 19213 19219 19231 
-19237 19249 19259 19267 19273 19289 19301 19309 19319 19333 19373 19379 19381 19387 
-19391 19403 19417 19421 19423 19427 19429 19433 19441 19447 19457 19463 19469 19471 
-19477 19483 19489 19501 19507 19531 19541 19543 19553 19559 19571 19577 19583 19597 
-19603 19609 19661 19681 19687 19697 19699 19709 19717 19727 19739 19751 19753 19759 
-19763 19777 19793 19801 19813 19819 19841 19843 19853 19861 19867 19889 19891 19913 
-19919 19927 19937 19949 19961 19963 19973 19979 19991 19993 19997 20011 20021 20023 
-20029 20047 20051 20063 20071 20089 20101 20107 20113 20117 20123 20129 20143 20147 
-20149 20161 20173 20177 20183 20201 20219 20231 20233 20249 20261 20269 20287 20297 
-20323 20327 20333 20341 20347 20353 20357 20359 20369 20389 20393 20399 20407 20411 
-20431 20441 20443 20477 20479 20483 20507 20509 20521 20533 20543 20549 20551 20563 
-20593 20599 20611 20627 20639 20641 20663 20681 20693 20707 20717 20719 20731 20743 
-20747 20749 20753 20759 20771 20773 20789 20807 20809 20849 20857 20873 20879 20887 
-20897 20899 20903 20921 20929 20939 20947 20959 20963 20981 20983 21001 21011 21013 
-21017 21019 21023 21031 21059 21061 21067 21089 21101 21107 21121 21139 21143 21149 
-21157 21163 21169 21179 21187 21191 21193 21211 21221 21227 21247 21269 21277 21283 
-21313 21317 21319 21323 21341 21347 21377 21379 21383 21391 21397 21401 21407 21419 
-21433 21467 21481 21487 21491 21493 21499 21503 21517 21521 21523 21529 21557 21559 
-21563 21569 21577 21587 21589 21599 21601 21611 21613 21617 21647 21649 21661 21673 
-21683 21701 21713 21727 21737 21739 21751 21757 21767 21773 21787 21799 21803 21817 
-21821 21839 21841 21851 21859 21863 21871 21881 21893 21911 21929 21937 21943 21961 
-21977 21991 21997 22003 22013 22027 22031 22037 22039 22051 22063 22067 22073 22079 
-22091 22093 22109 22111 22123 22129 22133 22147 22153 22157 22159 22171 22189 22193 
-22229 22247 22259 22271 22273 22277 22279 22283 22291 22303 22307 22343 22349 22367 
-22369 22381 22391 22397 22409 22433 22441 22447 22453 22469 22481 22483 22501 22511 
-22531 22541 22543 22549 22567 22571 22573 22613 22619 22621 22637 22639 22643 22651 
-22669 22679 22691 22697 22699 22709 22717 22721 22727 22739 22741 22751 22769 22777 
-22783 22787 22807 22811 22817 22853 22859 22861 22871 22877 22901 22907 22921 22937 
-22943 22961 22963 22973 22993 23003 23011 23017 23021 23027 23029 23039 23041 23053 
-23057 23059 23063 23071 23081 23087 23099 23117 23131 23143 23159 23167 23173 23189 
-23197 23201 23203 23209 23227 23251 23269 23279 23291 23293 23297 23311 23321 23327 
-23333 23339 23357 23369 23371 23399 23417 23431 23447 23459 23473 23497 23509 23531 
-23537 23539 23549 23557 23561 23563 23567 23581 23593 23599 23603 23609 23623 23627 
-23629 23633 23663 23669 23671 23677 23687 23689 23719 23741 23743 23747 23753 23761 
-23767 23773 23789 23801 23813 23819 23827 23831 23833 23857 23869 23873 23879 23887 
-23893 23899 23909 23911 23917 23929 23957 23971 23977 23981 23993 24001 24007 24019 
-24023 24029 24043 24049 24061 24071 24077 24083 24091 24097 24103 24107 24109 24113 
-24121 24133 24137 24151 24169 24179 24181 24197 24203 24223 24229 24239 24247 24251 
-24281 24317 24329 24337 24359 24371 24373 24379 24391 24407 24413 24419 24421 24439 
-24443 24469 24473 24481 24499 24509 24517 24527 24533 24547 24551 24571 24593 24611 
-24623 24631 24659 24671 24677 24683 24691 24697 24709 24733 24749 24763 24767 24781 
-24793 24799 24809 24821 24841 24847 24851 24859 24877 24889 24907 24917 24919 24923 
-24943 24953 24967 24971 24977 24979 24989 25013 25031 25033 25037 25057 25073 25087 
-25097 25111 25117 25121 25127 25147 25153 25163 25169 25171 25183 25189 25219 25229 
-25237 25243 25247 25253 25261 25301 25303 25307 25309 25321 25339 25343 25349 25357 
-25367 25373 25391 25409 25411 25423 25439 25447 25453 25457 25463 25469 25471 25523 
-25537 25541 25561 25577 25579 25583 25589 25601 25603 25609 25621 25633 25639 25643 
-25657 25667 25673 25679 25693 25703 25717 25733 25741 25747 25759 25763 25771 25793 
-25799 25801 25819 25841 25847 25849 25867 25873 25889 25903 25913 25919 25931 25933 
-25939 25943 25951 25969 25981 25997 25999 26003 26017 26021 26029 26041 26053 26083 
-26099 26107 26111 26113 26119 26141 26153 26161 26171 26177 26183 26189 26203 26209 
-26227 26237 26249 26251 26261 26263 26267 26293 26297 26309 26317 26321 26339 26347 
-26357 26371 26387 26393 26399 26407 26417 26423 26431 26437 26449 26459 26479 26489 
-26497 26501 26513 26539 26557 26561 26573 26591 26597 26627 26633 26641 26647 26669 
-26681 26683 26687 26693 26699 26701 26711 26713 26717 26723 26729 26731 26737 26759 
-26777 26783 26801 26813 26821 26833 26839 26849 26861 26863 26879 26881 26891 26893 
-26903 26921 26927 26947 26951 26953 26959 26981 26987 26993 27011 27017 27031 27043 
-27059 27061 27067 27073 27077 27091 27103 27107 27109 27127 27143 27179 27191 27197 
-27211 27239 27241 27253 27259 27271 27277 27281 27283 27299 27329 27337 27361 27367 
-27397 27407 27409 27427 27431 27437 27449 27457 27479 27481 27487 27509 27527 27529 
-27539 27541 27551 27581 27583 27611 27617 27631 27647 27653 27673 27689 27691 27697 
-27701 27733 27737 27739 27743 27749 27751 27763 27767 27773 27779 27791 27793 27799 
-27803 27809 27817 27823 27827 27847 27851 27883 27893 27901 27917 27919 27941 27943 
-27947 27953 27961 27967 27983 27997 28001 28019 28027 28031 28051 28057 28069 28081 
-28087 28097 28099 28109 28111 28123 28151 28163 28181 28183 28201 28211 28219 28229 
-28277 28279 28283 28289 28297 28307 28309 28319 28349 28351 28387 28393 28403 28409 
-28411 28429 28433 28439 28447 28463 28477 28493 28499 28513 28517 28537 28541 28547 
-28549 28559 28571 28573 28579 28591 28597 28603 28607 28619 28621 28627 28631 28643 
-28649 28657 28661 28663 28669 28687 28697 28703 28711 28723 28729 28751 28753 28759 
-28771 28789 28793 28807 28813 28817 28837 28843 28859 28867 28871 28879 28901 28909 
-28921 28927 28933 28949 28961 28979 29009 29017 29021 29023 29027 29033 29059 29063 
-29077 29101 29123 29129 29131 29137 29147 29153 29167 29173 29179 29191 29201 29207 
-29209 29221 29231 29243 29251 29269 29287 29297 29303 29311 29327 29333 29339 29347 
-29363 29383 29387 29389 29399 29401 29411 29423 29429 29437 29443 29453 29473 29483 
-29501 29527 29531 29537 29567 29569 29573 29581 29587 29599 29611 29629 29633 29641 
-29663 29669 29671 29683 29717 29723 29741 29753 29759 29761 29789 29803 29819 29833 
-29837 29851 29863 29867 29873 29879 29881 29917 29921 29927 29947 29959 29983 29989 
-30011 30013 30029 30047 30059 30071 30089 30091 30097 30103 30109 30113 30119 30133 
-30137 30139 30161 30169 30181 30187 30197 30203 30211 30223 30241 30253 30259 30269 
-30271 30293 30307 30313 30319 30323 30341 30347 30367 30389 30391 30403 30427 30431 
-30449 30467 30469 30491 30493 30497 30509 30517 30529 30539 30553 30557 30559 30577 
-30593 30631 30637 30643 30649 30661 30671 30677 30689 30697 30703 30707 30713 30727 
-30757 30763 30773 30781 30803 30809 30817 30829 30839 30841 30851 30853 30859 30869 
-30871 30881 30893 30911 30931 30937 30941 30949 30971 30977 30983 31013 31019 31033 
-31039 31051 31063 31069 31079 31081 31091 31121 31123 31139 31147 31151 31153 31159 
-31177 31181 31183 31189 31193 31219 31223 31231 31237 31247 31249 31253 31259 31267 
-31271 31277 31307 31319 31321 31327 31333 31337 31357 31379 31387 31391 31393 31397 
-31469 31477 31481 31489 31511 31513 31517 31531 31541 31543 31547 31567 31573 31583 
-31601 31607 31627 31643 31649 31657 31663 31667 31687 31699 31721 31723 31727 31729 
-31741 31751 31769 31771 31793 31799 31817 31847 31849 31859 31873 31883 31891 31907 
-31957 31963 31973 31981 31991 32003 32009 32027 32029 32051 32057 32059 32063 32069 
-32077 32083 32089 32099 32117 32119 32141 32143 32159 32173 32183 32189 32191 32203 
-32213 32233 32237 32251 32257 32261 32297 32299 32303 32309 32321 32323 32327 32341 
-32353 32359 32363 32369 32371 32377 32381 32401 32411 32413 32423 32429 32441 32443 
-32467 32479 32491 32497 32503 32507 32531 32533 32537 32561 32563 32569 32573 32579 
-32587 32603 32609 32611 32621 32633 32647 32653 32687 32693 32707 32713 32717 32719 
-32749 32771 32779 32783 32789 32797 32801 32803 32831 32833 32839 32843 32869 32887 
-32909 32911 32917 32933 32939 32941 32957 32969 32971 32983 32987 32993 32999 33013 
-33023 33029 33037 33049 33053 33071 33073 33083 33091 33107 33113 33119 33149 33151 
-33161 33179 33181 33191 33199 33203 33211 33223 33247 33287 33289 33301 33311 33317 
-33329 33331 33343 33347 33349 33353 33359 33377 33391 33403 33409 33413 33427 33457 
-33461 33469 33479 33487 33493 33503 33521 33529 33533 33547 33563 33569 33577 33581 
-33587 33589 33599 33601 33613 33617 33619 33623 33629 33637 33641 33647 33679 33703 
-33713 33721 33739 33749 33751 33757 33767 33769 33773 33791 33797 33809 33811 33827 
-33829 33851 33857 33863 33871 33889 33893 33911 33923 33931 33937 33941 33961 33967 
-33997 34019 34031 34033 34039 34057 34061 34123 34127 34129 34141 34147 34157 34159 
-34171 34183 34211 34213 34217 34231 34253 34259 34261 34267 34273 34283 34297 34301 
-34303 34313 34319 34327 34337 34351 34361 34367 34369 34381 34403 34421 34429 34439 
-34457 34469 34471 34483 34487 34499 34501 34511 34513 34519 34537 34543 34549 34583 
-34589 34591 34603 34607 34613 34631 34649 34651 34667 34673 34679 34687 34693 34703 
-34721 34729 34739 34747 34757 34759 34763 34781 34807 34819 34841 34843 34847 34849 
-34871 34877 34883 34897 34913 34919 34939 34949 34961 34963 34981 35023 35027 35051 
-35053 35059 35069 35081 35083 35089 35099 35107 35111 35117 35129 35141 35149 35153 
-35159 35171 35201 35221 35227 35251 35257 35267 35279 35281 35291 35311 35317 35323 
-35327 35339 35353 35363 35381 35393 35401 35407 35419 35423 35437 35447 35449 35461 
-35491 35507 35509 35521 35527 35531 35533 35537 35543 35569 35573 35591 35593 35597 
-35603 35617 35671 35677 35729 35731 35747 35753 35759 35771 35797 35801 35803 35809 
-35831 35837 35839 35851 35863 35869 35879 35897 35899 35911 35923 35933 35951 35963 
-35969 35977 35983 35993 35999 36007 36011 36013 36017 36037 36061 36067 36073 36083 
-36097 36107 36109 36131 36137 36151 36161 36187 36191 36209 36217 36229 36241 36251 
-36263 36269 36277 36293 36299 36307 36313 36319 36341 36343 36353 36373 36383 36389 
-36433 36451 36457 36467 36469 36473 36479 36493 36497 36523 36527 36529 36541 36551 
-36559 36563 36571 36583 36587 36599 36607 36629 36637 36643 36653 36671 36677 36683 
-36691 36697 36709 36713 36721 36739 36749 36761 36767 36779 36781 36787 36791 36793 
-36809 36821 36833 36847 36857 36871 36877 36887 36899 36901 36913 36919 36923 36929 
-36931 36943 36947 36973 36979 36997 37003 37013 37019 37021 37039 37049 37057 37061 
-37087 37097 37117 37123 37139 37159 37171 37181 37189 37199 37201 37217 37223 37243 
-37253 37273 37277 37307 37309 37313 37321 37337 37339 37357 37361 37363 37369 37379 
-37397 37409 37423 37441 37447 37463 37483 37489 37493 37501 37507 37511 37517 37529 
-37537 37547 37549 37561 37567 37571 37573 37579 37589 37591 37607 37619 37633 37643 
-37649 37657 37663 37691 37693 37699 37717 37747 37781 37783 37799 37811 37813 37831 
-37847 37853 37861 37871 37879 37889 37897 37907 37951 37957 37963 37967 37987 37991 
-37993 37997 38011 38039 38047 38053 38069 38083 38113 38119 38149 38153 38167 38177 
-38183 38189 38197 38201 38219 38231 38237 38239 38261 38273 38281 38287 38299 38303 
-38317 38321 38327 38329 38333 38351 38371 38377 38393 38431 38447 38449 38453 38459 
-38461 38501 38543 38557 38561 38567 38569 38593 38603 38609 38611 38629 38639 38651 
-38653 38669 38671 38677 38693 38699 38707 38711 38713 38723 38729 38737 38747 38749 
-38767 38783 38791 38803 38821 38833 38839 38851 38861 38867 38873 38891 38903 38917 
-38921 38923 38933 38953 38959 38971 38977 38993 39019 39023 39041 39043 39047 39079 
-39089 39097 39103 39107 39113 39119 39133 39139 39157 39161 39163 39181 39191 39199 
-39209 39217 39227 39229 39233 39239 39241 39251 39293 39301 39313 39317 39323 39341 
-39343 39359 39367 39371 39373 39383 39397 39409 39419 39439 39443 39451 39461 39499 
-39503 39509 39511 39521 39541 39551 39563 39569 39581 39607 39619 39623 39631 39659 
-39667 39671 39679 39703 39709 39719 39727 39733 39749 39761 39769 39779 39791 39799 
-39821 39827 39829 39839 39841 39847 39857 39863 39869 39877 39883 39887 39901 39929 
-39937 39953 39971 39979 39983 39989 40009 40013 40031 40037 40039 40063 40087 40093 
-40099 40111 40123 40127 40129 40151 40153 40163 40169 40177 40189 40193 40213 40231 
-40237 40241 40253 40277 40283 40289 40343 40351 40357 40361 40387 40423 40427 40429 
-40433 40459 40471 40483 40487 40493 40499 40507 40519 40529 40531 40543 40559 40577 
-40583 40591 40597 40609 40627 40637 40639 40693 40697 40699 40709 40739 40751 40759 
-40763 40771 40787 40801 40813 40819 40823 40829 40841 40847 40849 40853 40867 40879 
-40883 40897 40903 40927 40933 40939 40949 40961 40973 40993 41011 41017 41023 41039 
-41047 41051 41057 41077 41081 41113 41117 41131 41141 41143 41149 41161 41177 41179 
-41183 41189 41201 41203 41213 41221 41227 41231 41233 41243 41257 41263 41269 41281 
-41299 41333 41341 41351 41357 41381 41387 41389 41399 41411 41413 41443 41453 41467 
-41479 41491 41507 41513 41519 41521 41539 41543 41549 41579 41593 41597 41603 41609 
-41611 41617 41621 41627 41641 41647 41651 41659 41669 41681 41687 41719 41729 41737 
-41759 41761 41771 41777 41801 41809 41813 41843 41849 41851 41863 41879 41887 41893 
-41897 41903 41911 41927 41941 41947 41953 41957 41959 41969 41981 41983 41999 42013 
-42017 42019 42023 42043 42061 42071 42073 42083 42089 42101 42131 42139 42157 42169 
-42179 42181 42187 42193 42197 42209 42221 42223 42227 42239 42257 42281 42283 42293 
-42299 42307 42323 42331 42337 42349 42359 42373 42379 42391 42397 42403 42407 42409 
-42433 42437 42443 42451 42457 42461 42463 42467 42473 42487 42491 42499 42509 42533 
-42557 42569 42571 42577 42589 42611 42641 42643 42649 42667 42677 42683 42689 42697 
-42701 42703 42709 42719 42727 42737 42743 42751 42767 42773 42787 42793 42797 42821 
-42829 42839 42841 42853 42859 42863 42899 42901 42923 42929 42937 42943 42953 42961 
-42967 42979 42989 43003 43013 43019 43037 43049 43051 43063 43067 43093 43103 43117 
-43133 43151 43159 43177 43189 43201 43207 43223 43237 43261 43271 43283 43291 43313 
-43319 43321 43331 43391 43397 43399 43403 43411 43427 43441 43451 43457 43481 43487 
-43499 43517 43541 43543 43573 43577 43579 43591 43597 43607 43609 43613 43627 43633 
-43649 43651 43661 43669 43691 43711 43717 43721 43753 43759 43777 43781 43783 43787 
-43789 43793 43801 43853 43867 43889 43891 43913 43933 43943 43951 43961 43963 43969 
-43973 43987 43991 43997 44017 44021 44027 44029 44041 44053 44059 44071 44087 44089 
-44101 44111 44119 44123 44129 44131 44159 44171 44179 44189 44201 44203 44207 44221 
-44249 44257 44263 44267 44269 44273 44279 44281 44293 44351 44357 44371 44381 44383 
-44389 44417 44449 44453 44483 44491 44497 44501 44507 44519 44531 44533 44537 44543 
-44549 44563 44579 44587 44617 44621 44623 44633 44641 44647 44651 44657 44683 44687 
-44699 44701 44711 44729 44741 44753 44771 44773 44777 44789 44797 44809 44819 44839 
-44843 44851 44867 44879 44887 44893 44909 44917 44927 44939 44953 44959 44963 44971 
-44983 44987 45007 45013 45053 45061 45077 45083 45119 45121 45127 45131 45137 45139 
-45161 45179 45181 45191 45197 45233 45247 45259 45263 45281 45289 45293 45307 45317 
-45319 45329 45337 45341 45343 45361 45377 45389 45403 45413 45427 45433 45439 45481 
-45491 45497 45503 45523 45533 45541 45553 45557 45569 45587 45589 45599 45613 45631 
-45641 45659 45667 45673 45677 45691 45697 45707 45737 45751 45757 45763 45767 45779 
-45817 45821 45823 45827 45833 45841 45853 45863 45869 45887 45893 45943 45949 45953 
-45959 45971 45979 45989 46021 46027 46049 46051 46061 46073 46091 46093 46099 46103 
-46133 46141 46147 46153 46171 46181 46183 46187 46199 46219 46229 46237 46261 46271 
-46273 46279 46301 46307 46309 46327 46337 46349 46351 46381 46399 46411 46439 46441 
-46447 46451 46457 46471 46477 46489 46499 46507 46511 46523 46549 46559 46567 46573 
-46589 46591 46601 46619 46633 46639 46643 46649 46663 46679 46681 46687 46691 46703 
-46723 46727 46747 46751 46757 46769 46771 46807 46811 46817 46819 46829 46831 46853 
-46861 46867 46877 46889 46901 46919 46933 46957 46993 46997 47017 47041 47051 47057 
-47059 47087 47093 47111 47119 47123 47129 47137 47143 47147 47149 47161 47189 47207 
-47221 47237 47251 47269 47279 47287 47293 47297 47303 47309 47317 47339 47351 47353 
-47363 47381 47387 47389 47407 47417 47419 47431 47441 47459 47491 47497 47501 47507 
-47513 47521 47527 47533 47543 47563 47569 47581 47591 47599 47609 47623 47629 47639 
-47653 47657 47659 47681 47699 47701 47711 47713 47717 47737 47741 47743 47777 47779 
-47791 47797 47807 47809 47819 47837 47843 47857 47869 47881 47903 47911 47917 47933 
-47939 47947 47951 47963 47969 47977 47981 48017 48023 48029 48049 48073 48079 48091 
-48109 48119 48121 48131 48157 48163 48179 48187 48193 48197 48221 48239 48247 48259 
-48271 48281 48299 48311 48313 48337 48341 48353 48371 48383 48397 48407 48409 48413 
-48437 48449 48463 48473 48479 48481 48487 48491 48497 48523 48527 48533 48539 48541 
-48563 48571 48589 48593 48611 48619 48623 48647 48649 48661 48673 48677 48679 48731 
-48733 48751 48757 48761 48767 48779 48781 48787 48799 48809 48817 48821 48823 48847 
-48857 48859 48869 48871 48883 48889 48907 48947 48953 48973 48989 48991 49003 49009 
-49019 49031 49033 49037 49043 49057 49069 49081 49103 49109 49117 49121 49123 49139 
-49157 49169 49171 49177 49193 49199 49201 49207 49211 49223 49253 49261 49277 49279 
-49297 49307 49331 49333 49339 49363 49367 49369 49391 49393 49409 49411 49417 49429 
-49433 49451 49459 49463 49477 49481 49499 49523 49529 49531 49537 49547 49549 49559 
-49597 49603 49613 49627 49633 49639 49663 49667 49669 49681 49697 49711 49727 49739 
-49741 49747 49757 49783 49787 49789 49801 49807 49811 49823 49831 49843 49853 49871 
-49877 49891 49919 49921 49927 49937 49939 49943 49957 49991 49993 49999 50021 50023 
-50033 50047 50051 50053 50069 50077 50087 50093 50101 50111 50119 50123 50129 50131 
-50147 50153 50159 50177 50207 50221 50227 50231 50261 50263 50273 50287 50291 50311 
-50321 50329 50333 50341 50359 50363 50377 50383 50387 50411 50417 50423 50441 50459 
-50461 50497 50503 50513 50527 50539 50543 50549 50551 50581 50587 50591 50593 50599 
-50627 50647 50651 50671 50683 50707 50723 50741 50753 50767 50773 50777 50789 50821 
-50833 50839 50849 50857 50867 50873 50891 50893 50909 50923 50929 50951 50957 50969 
-50971 50989 50993 51001 51031 51043 51047 51059 51061 51071 51109 51131 51133 51137 
-51151 51157 51169 51193 51197 51199 51203 51217 51229 51239 51241 51257 51263 51283 
-51287 51307 51329 51341 51343 51347 51349 51361 51383 51407 51413 51419 51421 51427 
-51431 51437 51439 51449 51461 51473 51479 51481 51487 51503 51511 51517 51521 51539 
-51551 51563 51577 51581 51593 51599 51607 51613 51631 51637 51647 51659 51673 51679 
-51683 51691 51713 51719 51721 51749 51767 51769 51787 51797 51803 51817 51827 51829 
-51839 51853 51859 51869 51871 51893 51899 51907 51913 51929 51941 51949 51971 51973 
-51977 51991 52009 52021 52027 52051 52057 52067 52069 52081 52103 52121 52127 52147 
-52153 52163 52177 52181 52183 52189 52201 52223 52237 52249 52253 52259 52267 52289 
-52291 52301 52313 52321 52361 52363 52369 52379 52387 52391 52433 52453 52457 52489 
-52501 52511 52517 52529 52541 52543 52553 52561 52567 52571 52579 52583 52609 52627 
-52631 52639 52667 52673 52691 52697 52709 52711 52721 52727 52733 52747 52757 52769 
-52783 52807 52813 52817 52837 52859 52861 52879 52883 52889 52901 52903 52919 52937 
-52951 52957 52963 52967 52973 52981 52999 53003 53017 53047 53051 53069 53077 53087 
-53089 53093 53101 53113 53117 53129 53147 53149 53161 53171 53173 53189 53197 53201 
-53231 53233 53239 53267 53269 53279 53281 53299 53309 53323 53327 53353 53359 53377 
-53381 53401 53407 53411 53419 53437 53441 53453 53479 53503 53507 53527 53549 53551 
-53569 53591 53593 53597 53609 53611 53617 53623 53629 53633 53639 53653 53657 53681 
-53693 53699 53717 53719 53731 53759 53773 53777 53783 53791 53813 53819 53831 53849 
-53857 53861 53881 53887 53891 53897 53899 53917 53923 53927 53939 53951 53959 53987 
-53993 54001 54011 54013 54037 54049 54059 54083 54091 54101 54121 54133 54139 54151 
-54163 54167 54181 54193 54217 54251 54269 54277 54287 54293 54311 54319 54323 54331 
-54347 54361 54367 54371 54377 54401 54403 54409 54413 54419 54421 54437 54443 54449 
-54469 54493 54497 54499 54503 54517 54521 54539 54541 54547 54559 54563 54577 54581 
-54583 54601 54617 54623 54629 54631 54647 54667 54673 54679 54709 54713 54721 54727 
-54751 54767 54773 54779 54787 54799 54829 54833 54851 54869 54877 54881 54907 54917 
-54919 54941 54949 54959 54973 54979 54983 55001 55009 55021 55049 55051 55057 55061 
-55073 55079 55103 55109 55117 55127 55147 55163 55171 55201 55207 55213 55217 55219 
-55229 55243 55249 55259 55291 55313 55331 55333 55337 55339 55343 55351 55373 55381 
-55399 55411 55439 55441 55457 55469 55487 55501 55511 55529 55541 55547 55579 55589 
-55603 55609 55619 55621 55631 55633 55639 55661 55663 55667 55673 55681 55691 55697 
-55711 55717 55721 55733 55763 55787 55793 55799 55807 55813 55817 55819 55823 55829 
-55837 55843 55849 55871 55889 55897 55901 55903 55921 55927 55931 55933 55949 55967 
-55987 55997 56003 56009 56039 56041 56053 56081 56087 56093 56099 56101 56113 56123 
-56131 56149 56167 56171 56179 56197 56207 56209 56237 56239 56249 56263 56267 56269 
-56299 56311 56333 56359 56369 56377 56383 56393 56401 56417 56431 56437 56443 56453 
-56467 56473 56477 56479 56489 56501 56503 56509 56519 56527 56531 56533 56543 56569 
-56591 56597 56599 56611 56629 56633 56659 56663 56671 56681 56687 56701 56711 56713 
-56731 56737 56747 56767 56773 56779 56783 56807 56809 56813 56821 56827 56843 56857 
-56873 56891 56893 56897 56909 56911 56921 56923 56929 56941 56951 56957 56963 56983 
-56989 56993 56999 57037 57041 57047 57059 57073 57077 57089 57097 57107 57119 57131 
-57139 57143 57149 57163 57173 57179 57191 57193 57203 57221 57223 57241 57251 57259 
-57269 57271 57283 57287 57301 57329 57331 57347 57349 57367 57373 57383 57389 57397 
-57413 57427 57457 57467 57487 57493 57503 57527 57529 57557 57559 57571 57587 57593 
-57601 57637 57641 57649 57653 57667 57679 57689 57697 57709 57713 57719 57727 57731 
-57737 57751 57773 57781 57787 57791 57793 57803 57809 57829 57839 57847 57853 57859 
-57881 57899 57901 57917 57923 57943 57947 57973 57977 57991 58013 58027 58031 58043 
-58049 58057 58061 58067 58073 58099 58109 58111 58129 58147 58151 58153 58169 58171 
-58189 58193 58199 58207 58211 58217 58229 58231 58237 58243 58271 58309 58313 58321 
-58337 58363 58367 58369 58379 58391 58393 58403 58411 58417 58427 58439 58441 58451 
-58453 58477 58481 58511 58537 58543 58549 58567 58573 58579 58601 58603 58613 58631 
-58657 58661 58679 58687 58693 58699 58711 58727 58733 58741 58757 58763 58771 58787 
-58789 58831 58889 58897 58901 58907 58909 58913 58921 58937 58943 58963 58967 58979 
-58991 58997 59009 59011 59021 59023 59029 59051 59053 59063 59069 59077 59083 59093 
-59107 59113 59119 59123 59141 59149 59159 59167 59183 59197 59207 59209 59219 59221 
-59233 59239 59243 59263 59273 59281 59333 59341 59351 59357 59359 59369 59377 59387 
-59393 59399 59407 59417 59419 59441 59443 59447 59453 59467 59471 59473 59497 59509 
-59513 59539 59557 59561 59567 59581 59611 59617 59621 59627 59629 59651 59659 59663 
-59669 59671 59693 59699 59707 59723 59729 59743 59747 59753 59771 59779 59791 59797 
-59809 59833 59863 59879 59887 59921 59929 59951 59957 59971 59981 59999 60013 60017 
-60029 60037 60041 60077 60083 60089 60091 60101 60103 60107 60127 60133 60139 60149 
-60161 60167 60169 60209 60217 60223 60251 60257 60259 60271 60289 60293 60317 60331 
-60337 60343 60353 60373 60383 60397 60413 60427 60443 60449 60457 60493 60497 60509 
-60521 60527 60539 60589 60601 60607 60611 60617 60623 60631 60637 60647 60649 60659 
-60661 60679 60689 60703 60719 60727 60733 60737 60757 60761 60763 60773 60779 60793 
-60811 60821 60859 60869 60887 60889 60899 60901 60913 60917 60919 60923 60937 60943 
-60953 60961 61001 61007 61027 61031 61043 61051 61057 61091 61099 61121 61129 61141 
-61151 61153 61169 61211 61223 61231 61253 61261 61283 61291 61297 61331 61333 61339 
-61343 61357 61363 61379 61381 61403 61409 61417 61441 61463 61469 61471 61483 61487 
-61493 61507 61511 61519 61543 61547 61553 61559 61561 61583 61603 61609 61613 61627 
-61631 61637 61643 61651 61657 61667 61673 61681 61687 61703 61717 61723 61729 61751 
-61757 61781 61813 61819 61837 61843 61861 61871 61879 61909 61927 61933 61949 61961 
-61967 61979 61981 61987 61991 62003 62011 62017 62039 62047 62053 62057 62071 62081 
-62099 62119 62129 62131 62137 62141 62143 62171 62189 62191 62201 62207 62213 62219 
-62233 62273 62297 62299 62303 62311 62323 62327 62347 62351 62383 62401 62417 62423 
-62459 62467 62473 62477 62483 62497 62501 62507 62533 62539 62549 62563 62581 62591 
-62597 62603 62617 62627 62633 62639 62653 62659 62683 62687 62701 62723 62731 62743 
-62753 62761 62773 62791 62801 62819 62827 62851 62861 62869 62873 62897 62903 62921 
-62927 62929 62939 62969 62971 62981 62983 62987 62989 63029 63031 63059 63067 63073 
-63079 63097 63103 63113 63127 63131 63149 63179 63197 63199 63211 63241 63247 63277 
-63281 63299 63311 63313 63317 63331 63337 63347 63353 63361 63367 63377 63389 63391 
-63397 63409 63419 63421 63439 63443 63463 63467 63473 63487 63493 63499 63521 63527 
-63533 63541 63559 63577 63587 63589 63599 63601 63607 63611 63617 63629 63647 63649 
-63659 63667 63671 63689 63691 63697 63703 63709 63719 63727 63737 63743 63761 63773 
-63781 63793 63799 63803 63809 63823 63839 63841 63853 63857 63863 63901 63907 63913 
-63929 63949 63977 63997 64007 64013 64019 64033 64037 64063 64067 64081 64091 64109 
-64123 64151 64153 64157 64171 64187 64189 64217 64223 64231 64237 64271 64279 64283 
-64301 64303 64319 64327 64333 64373 64381 64399 64403 64433 64439 64451 64453 64483 
-64489 64499 64513 64553 64567 64577 64579 64591 64601 64609 64613 64621 64627 64633 
-64661 64663 64667 64679 64693 64709 64717 64747 64763 64781 64783 64793 64811 64817 
-64849 64853 64871 64877 64879 64891 64901 64919 64921 64927 64937 64951 64969 64997 
-65003 65011 65027 65029 65033 65053 65063 65071 65089 65099 65101 65111 65119 65123 
-65129 65141 65147 65167 65171 65173 65179 65183 65203 65213 65239 65257 65267 65269 
-65287 65293 65309 65323 65327 65353 65357 65371 65381 65393 65407 65413 65419 65423 
-65437 65447 65449 65479 65497 65519 65521 65537 65539 65543 65551 65557 65563 65579 
-65581 65587 65599 65609 65617 65629 65633 65647 65651 65657 65677 65687 65699 65701 
-65707 65713 65717 65719 65729 65731 65761 65777 65789 65809 65827 65831 65837 65839 
-65843 65851 65867 65881 65899 65921 65927 65929 65951 65957 65963 65981 65983 65993 
-66029 66037 66041 66047 66067 66071 66083 66089 66103 66107 66109 66137 66161 66169 
-66173 66179 66191 66221 66239 66271 66293 66301 66337 66343 66347 66359 66361 66373 
-66377 66383 66403 66413 66431 66449 66457 66463 66467 66491 66499 66509 66523 66529 
-66533 66541 66553 66569 66571 66587 66593 66601 66617 66629 66643 66653 66683 66697 
-66701 66713 66721 66733 66739 66749 66751 66763 66791 66797 66809 66821 66841 66851 
-66853 66863 66877 66883 66889 66919 66923 66931 66943 66947 66949 66959 66973 66977 
-67003 67021 67033 67043 67049 67057 67061 67073 67079 67103 67121 67129 67139 67141 
-67153 67157 67169 67181 67187 67189 67211 67213 67217 67219 67231 67247 67261 67271 
-67273 67289 67307 67339 67343 67349 67369 67391 67399 67409 67411 67421 67427 67429 
-67433 67447 67453 67477 67481 67489 67493 67499 67511 67523 67531 67537 67547 67559 
-67567 67577 67579 67589 67601 67607 67619 67631 67651 67679 67699 67709 67723 67733 
-67741 67751 67757 67759 67763 67777 67783 67789 67801 67807 67819 67829 67843 67853 
-67867 67883 67891 67901 67927 67931 67933 67939 67943 67957 67961 67967 67979 67987 
-67993 68023 68041 68053 68059 68071 68087 68099 68111 68113 68141 68147 68161 68171 
-68207 68209 68213 68219 68227 68239 68261 68279 68281 68311 68329 68351 68371 68389 
-68399 68437 68443 68447 68449 68473 68477 68483 68489 68491 68501 68507 68521 68531 
-68539 68543 68567 68581 68597 68611 68633 68639 68659 68669 68683 68687 68699 68711 
-68713 68729 68737 68743 68749 68767 68771 68777 68791 68813 68819 68821 68863 68879 
-68881 68891 68897 68899 68903 68909 68917 68927 68947 68963 68993 69001 69011 69019 
-69029 69031 69061 69067 69073 69109 69119 69127 69143 69149 69151 69163 69191 69193 
-69197 69203 69221 69233 69239 69247 69257 69259 69263 69313 69317 69337 69341 69371 
-69379 69383 69389 69401 69403 69427 69431 69439 69457 69463 69467 69473 69481 69491 
-69493 69497 69499 69539 69557 69593 69623 69653 69661 69677 69691 69697 69709 69737 
-69739 69761 69763 69767 69779 69809 69821 69827 69829 69833 69847 69857 69859 69877 
-69899 69911 69929 69931 69941 69959 69991 69997 70001 70003 70009 70019 70039 70051 
-70061 70067 70079 70099 70111 70117 70121 70123 70139 70141 70157 70163 70177 70181 
-70183 70199 70201 70207 70223 70229 70237 70241 70249 70271 70289 70297 70309 70313 
-70321 70327 70351 70373 70379 70381 70393 70423 70429 70439 70451 70457 70459 70481 
-70487 70489 70501 70507 70529 70537 70549 70571 70573 70583 70589 70607 70619 70621 
-70627 70639 70657 70663 70667 70687 70709 70717 70729 70753 70769 70783 70793 70823 
-70841 70843 70849 70853 70867 70877 70879 70891 70901 70913 70919 70921 70937 70949 
-70951 70957 70969 70979 70981 70991 70997 70999 71011 71023 71039 71059 71069 71081 
-71089 71119 71129 71143 71147 71153 71161 71167 71171 71191 71209 71233 71237 71249 
-71257 71261 71263 71287 71293 71317 71327 71329 71333 71339 71341 71347 71353 71359 
-71363 71387 71389 71399 71411 71413 71419 71429 71437 71443 71453 71471 71473 71479 
-71483 71503 71527 71537 71549 71551 71563 71569 71593 71597 71633 71647 71663 71671 
-71693 71699 71707 71711 71713 71719 71741 71761 71777 71789 71807 71809 71821 71837 
-71843 71849 71861 71867 71879 71881 71887 71899 71909 71917 71933 71941 71947 71963 
-71971 71983 71987 71993 71999 72019 72031 72043 72047 72053 72073 72077 72089 72091 
-72101 72103 72109 72139 72161 72167 72169 72173 72211 72221 72223 72227 72229 72251 
-72253 72269 72271 72277 72287 72307 72313 72337 72341 72353 72367 72379 72383 72421 
-72431 72461 72467 72469 72481 72493 72497 72503 72533 72547 72551 72559 72577 72613 
-72617 72623 72643 72647 72649 72661 72671 72673 72679 72689 72701 72707 72719 72727 
-72733 72739 72763 72767 72797 72817 72823 72859 72869 72871 72883 72889 72893 72901 
-72907 72911 72923 72931 72937 72949 72953 72959 72973 72977 72997 73009 73013 73019 
-73037 73039 73043 73061 73063 73079 73091 73121 73127 73133 73141 73181 73189 73237 
-73243 73259 73277 73291 73303 73309 73327 73331 73351 73361 73363 73369 73379 73387 
-73417 73421 73433 73453 73459 73471 73477 73483 73517 73523 73529 73547 73553 73561 
-73571 73583 73589 73597 73607 73609 73613 73637 73643 73651 73673 73679 73681 73693 
-73699 73709 73721 73727 73751 73757 73771 73783 73819 73823 73847 73849 73859 73867 
-73877 73883 73897 73907 73939 73943 73951 73961 73973 73999 74017 74021 74027 74047 
-74051 74071 74077 74093 74099 74101 74131 74143 74149 74159 74161 74167 74177 74189 
-74197 74201 74203 74209 74219 74231 74257 74279 74287 74293 74297 74311 74317 74323 
-74353 74357 74363 74377 74381 74383 74411 74413 74419 74441 74449 74453 74471 74489 
-74507 74509 74521 74527 74531 74551 74561 74567 74573 74587 74597 74609 74611 74623 
-74653 74687 74699 74707 74713 74717 74719 74729 74731 74747 74759 74761 74771 74779 
-74797 74821 74827 74831 74843 74857 74861 74869 74873 74887 74891 74897 74903 74923 
-74929 74933 74941 74959 75011 75013 75017 75029 75037 75041 75079 75083 75109 75133 
-75149 75161 75167 75169 75181 75193 75209 75211 75217 75223 75227 75239 75253 75269 
-75277 75289 75307 75323 75329 75337 75347 75353 75367 75377 75389 75391 75401 75403 
-75407 75431 75437 75479 75503 75511 75521 75527 75533 75539 75541 75553 75557 75571 
-75577 75583 75611 75617 75619 75629 75641 75653 75659 75679 75683 75689 75703 75707 
-75709 75721 75731 75743 75767 75773 75781 75787 75793 75797 75821 75833 75853 75869 
-75883 75913 75931 75937 75941 75967 75979 75983 75989 75991 75997 76001 76003 76031 
-76039 76079 76081 76091 76099 76103 76123 76129 76147 76157 76159 76163 76207 76213 
-76231 76243 76249 76253 76259 76261 76283 76289 76303 76333 76343 76367 76369 76379 
-76387 76403 76421 76423 76441 76463 76471 76481 76487 76493 76507 76511 76519 76537 
-76541 76543 76561 76579 76597 76603 76607 76631 76649 76651 76667 76673 76679 76697 
-76717 76733 76753 76757 76771 76777 76781 76801 76819 76829 76831 76837 76847 76871 
-76873 76883 76907 76913 76919 76943 76949 76961 76963 76991 77003 77017 77023 77029 
-77041 77047 77069 77081 77093 77101 77137 77141 77153 77167 77171 77191 77201 77213 
-77237 77239 77243 77249 77261 77263 77267 77269 77279 77291 77317 77323 77339 77347 
-77351 77359 77369 77377 77383 77417 77419 77431 77447 77471 77477 77479 77489 77491 
-77509 77513 77521 77527 77543 77549 77551 77557 77563 77569 77573 77587 77591 77611 
-77617 77621 77641 77647 77659 77681 77687 77689 77699 77711 77713 77719 77723 77731 
-77743 77747 77761 77773 77783 77797 77801 77813 77839 77849 77863 77867 77893 77899 
-77929 77933 77951 77969 77977 77983 77999 78007 78017 78031 78041 78049 78059 78079 
-78101 78121 78137 78139 78157 78163 78167 78173 78179 78191 78193 78203 78229 78233 
-78241 78259 78277 78283 78301 78307 78311 78317 78341 78347 78367 78401 78427 78437 
-78439 78467 78479 78487 78497 78509 78511 78517 78539 78541 78553 78569 78571 78577 
-78583 78593 78607 78623 78643 78649 78653 78691 78697 78707 78713 78721 78737 78779 
-78781 78787 78791 78797 78803 78809 78823 78839 78853 78857 78877 78887 78889 78893 
-78901 78919 78929 78941 78977 78979 78989 79031 79039 79043 79063 79087 79103 79111 
-79133 79139 79147 79151 79153 79159 79181 79187 79193 79201 79229 79231 79241 79259 
-79273 79279 79283 79301 79309 79319 79333 79337 79349 79357 79367 79379 79393 79397 
-79399 79411 79423 79427 79433 79451 79481 79493 79531 79537 79549 79559 79561 79579 
-79589 79601 79609 79613 79621 79627 79631 79633 79657 79669 79687 79691 79693 79697 
-79699 79757 79769 79777 79801 79811 79813 79817 79823 79829 79841 79843 79847 79861 
-79867 79873 79889 79901 79903 79907 79939 79943 79967 79973 79979 79987 79997 79999 
-80021 80039 80051 80071 80077 80107 80111 80141 80147 80149 80153 80167 80173 80177 
-80191 80207 80209 80221 80231 80233 80239 80251 80263 80273 80279 80287 80309 80317 
-80329 80341 80347 80363 80369 80387 80407 80429 80447 80449 80471 80473 80489 80491 
-80513 80527 80537 80557 80567 80599 80603 80611 80621 80627 80629 80651 80657 80669 
-80671 80677 80681 80683 80687 80701 80713 80737 80747 80749 80761 80777 80779 80783 
-80789 80803 80809 80819 80831 80833 80849 80863 80897 80909 80911 80917 80923 80929 
-80933 80953 80963 80989 81001 81013 81017 81019 81023 81031 81041 81043 81047 81049 
-81071 81077 81083 81097 81101 81119 81131 81157 81163 81173 81181 81197 81199 81203 
-81223 81233 81239 81281 81283 81293 81299 81307 81331 81343 81349 81353 81359 81371 
-81373 81401 81409 81421 81439 81457 81463 81509 81517 81527 81533 81547 81551 81553 
-81559 81563 81569 81611 81619 81629 81637 81647 81649 81667 81671 81677 81689 81701 
-81703 81707 81727 81737 81749 81761 81769 81773 81799 81817 81839 81847 81853 81869 
-81883 81899 81901 81919 81929 81931 81937 81943 81953 81967 81971 81973 82003 82007 
-82009 82013 82021 82031 82037 82039 82051 82067 82073 82129 82139 82141 82153 82163 
-82171 82183 82189 82193 82207 82217 82219 82223 82231 82237 82241 82261 82267 82279 
-82301 82307 82339 82349 82351 82361 82373 82387 82393 82421 82457 82463 82469 82471 
-82483 82487 82493 82499 82507 82529 82531 82549 82559 82561 82567 82571 82591 82601 
-82609 82613 82619 82633 82651 82657 82699 82721 82723 82727 82729 82757 82759 82763 
-82781 82787 82793 82799 82811 82813 82837 82847 82883 82889 82891 82903 82913 82939 
-82963 82981 82997 83003 83009 83023 83047 83059 83063 83071 83077 83089 83093 83101 
-83117 83137 83177 83203 83207 83219 83221 83227 83231 83233 83243 83257 83267 83269 
-83273 83299 83311 83339 83341 83357 83383 83389 83399 83401 83407 83417 83423 83431 
-83437 83443 83449 83459 83471 83477 83497 83537 83557 83561 83563 83579 83591 83597 
-83609 83617 83621 83639 83641 83653 83663 83689 83701 83717 83719 83737 83761 83773 
-83777 83791 83813 83833 83843 83857 83869 83873 83891 83903 83911 83921 83933 83939 
-83969 83983 83987 84011 84017 84047 84053 84059 84061 84067 84089 84121 84127 84131 
-84137 84143 84163 84179 84181 84191 84199 84211 84221 84223 84229 84239 84247 84263 
-84299 84307 84313 84317 84319 84347 84349 84377 84389 84391 84401 84407 84421 84431 
-84437 84443 84449 84457 84463 84467 84481 84499 84503 84509 84521 84523 84533 84551 
-84559 84589 84629 84631 84649 84653 84659 84673 84691 84697 84701 84713 84719 84731 
-84737 84751 84761 84787 84793 84809 84811 84827 84857 84859 84869 84871 84913 84919 
-84947 84961 84967 84977 84979 84991 85009 85021 85027 85037 85049 85061 85081 85087 
-85091 85093 85103 85109 85121 85133 85147 85159 85193 85199 85201 85213 85223 85229 
-85237 85243 85247 85259 85297 85303 85313 85331 85333 85361 85363 85369 85381 85411 
-85427 85429 85439 85447 85451 85453 85469 85487 85513 85517 85523 85531 85549 85571 
-85577 85597 85601 85607 85619 85621 85627 85639 85643 85661 85667 85669 85691 85703 
-85711 85717 85733 85751 85781 85793 85817 85819 85829 85831 85837 85843 85847 85853 
-85889 85903 85909 85931 85933 85991 85999 86011 86017 86027 86029 86069 86077 86083 
-86111 86113 86117 86131 86137 86143 86161 86171 86179 86183 86197 86201 86209 86239 
-86243 86249 86257 86263 86269 86287 86291 86293 86297 86311 86323 86341 86351 86353 
-86357 86369 86371 86381 86389 86399 86413 86423 86441 86453 86461 86467 86477 86491 
-86501 86509 86531 86533 86539 86561 86573 86579 86587 86599 86627 86629 86677 86689 
-86693 86711 86719 86729 86743 86753 86767 86771 86783 86813 86837 86843 86851 86857 
-86861 86869 86923 86927 86929 86939 86951 86959 86969 86981 86993 87011 87013 87037 
-87041 87049 87071 87083 87103 87107 87119 87121 87133 87149 87151 87179 87181 87187 
-87211 87221 87223 87251 87253 87257 87277 87281 87293 87299 87313 87317 87323 87337 
-87359 87383 87403 87407 87421 87427 87433 87443 87473 87481 87491 87509 87511 87517 
-87523 87539 87541 87547 87553 87557 87559 87583 87587 87589 87613 87623 87629 87631 
-87641 87643 87649 87671 87679 87683 87691 87697 87701 87719 87721 87739 87743 87751 
-87767 87793 87797 87803 87811 87833 87853 87869 87877 87881 87887 87911 87917 87931 
-87943 87959 87961 87973 87977 87991 88001 88003 88007 88019 88037 88069 88079 88093 
-88117 88129 88169 88177 88211 88223 88237 88241 88259 88261 88289 88301 88321 88327 
-88337 88339 88379 88397 88411 88423 88427 88463 88469 88471 88493 88499 88513 88523 
-88547 88589 88591 88607 88609 88643 88651 88657 88661 88663 88667 88681 88721 88729 
-88741 88747 88771 88789 88793 88799 88801 88807 88811 88813 88817 88819 88843 88853 
-88861 88867 88873 88883 88897 88903 88919 88937 88951 88969 88993 88997 89003 89009 
-89017 89021 89041 89051 89057 89069 89071 89083 89087 89101 89107 89113 89119 89123 
-89137 89153 89189 89203 89209 89213 89227 89231 89237 89261 89269 89273 89293 89303 
-89317 89329 89363 89371 89381 89387 89393 89399 89413 89417 89431 89443 89449 89459 
-89477 89491 89501 89513 89519 89521 89527 89533 89561 89563 89567 89591 89597 89599 
-89603 89611 89627 89633 89653 89657 89659 89669 89671 89681 89689 89753 89759 89767 
-89779 89783 89797 89809 89819 89821 89833 89839 89849 89867 89891 89897 89899 89909 
-89917 89923 89939 89959 89963 89977 89983 89989 90001 90007 90011 90017 90019 90023 
-90031 90053 90059 90067 90071 90073 90089 90107 90121 90127 90149 90163 90173 90187 
-90191 90197 90199 90203 90217 90227 90239 90247 90263 90271 90281 90289 90313 90353 
-90359 90371 90373 90379 90397 90401 90403 90407 90437 90439 90469 90473 90481 90499 
-90511 90523 90527 90529 90533 90547 90583 90599 90617 90619 90631 90641 90647 90659 
-90677 90679 90697 90703 90709 90731 90749 90787 90793 90803 90821 90823 90833 90841 
-90847 90863 90887 90901 90907 90911 90917 90931 90947 90971 90977 90989 90997 91009 
-91019 91033 91079 91081 91097 91099 91121 91127 91129 91139 91141 91151 91153 91159 
-91163 91183 91193 91199 91229 91237 91243 91249 91253 91283 91291 91297 91303 91309 
-91331 91367 91369 91373 91381 91387 91393 91397 91411 91423 91433 91453 91457 91459 
-91463 91493 91499 91513 91529 91541 91571 91573 91577 91583 91591 91621 91631 91639 
-91673 91691 91703 91711 91733 91753 91757 91771 91781 91801 91807 91811 91813 91823 
-91837 91841 91867 91873 91909 91921 91939 91943 91951 91957 91961 91967 91969 91997 
-92003 92009 92033 92041 92051 92077 92083 92107 92111 92119 92143 92153 92173 92177 
-92179 92189 92203 92219 92221 92227 92233 92237 92243 92251 92269 92297 92311 92317 
-92333 92347 92353 92357 92363 92369 92377 92381 92383 92387 92399 92401 92413 92419 
-92431 92459 92461 92467 92479 92489 92503 92507 92551 92557 92567 92569 92581 92593 
-92623 92627 92639 92641 92647 92657 92669 92671 92681 92683 92693 92699 92707 92717 
-92723 92737 92753 92761 92767 92779 92789 92791 92801 92809 92821 92831 92849 92857 
-92861 92863 92867 92893 92899 92921 92927 92941 92951 92957 92959 92987 92993 93001 
-93047 93053 93059 93077 93083 93089 93097 93103 93113 93131 93133 93139 93151 93169 
-93179 93187 93199 93229 93239 93241 93251 93253 93257 93263 93281 93283 93287 93307 
-93319 93323 93329 93337 93371 93377 93383 93407 93419 93427 93463 93479 93481 93487 
-93491 93493 93497 93503 93523 93529 93553 93557 93559 93563 93581 93601 93607 93629 
-93637 93683 93701 93703 93719 93739 93761 93763 93787 93809 93811 93827 93851 93871 
-93887 93889 93893 93901 93911 93913 93923 93937 93941 93949 93967 93971 93979 93983 
-93997 94007 94009 94033 94049 94057 94063 94079 94099 94109 94111 94117 94121 94151 
-94153 94169 94201 94207 94219 94229 94253 94261 94273 94291 94307 94309 94321 94327 
-94331 94343 94349 94351 94379 94397 94399 94421 94427 94433 94439 94441 94447 94463 
-94477 94483 94513 94529 94531 94541 94543 94547 94559 94561 94573 94583 94597 94603 
-94613 94621 94649 94651 94687 94693 94709 94723 94727 94747 94771 94777 94781 94789 
-94793 94811 94819 94823 94837 94841 94847 94849 94873 94889 94903 94907 94933 94949 
-94951 94961 94993 94999 95003 95009 95021 95027 95063 95071 95083 95087 95089 95093 
-95101 95107 95111 95131 95143 95153 95177 95189 95191 95203 95213 95219 95231 95233 
-95239 95257 95261 95267 95273 95279 95287 95311 95317 95327 95339 95369 95383 95393 
-95401 95413 95419 95429 95441 95443 95461 95467 95471 95479 95483 95507 95527 95531 
-95539 95549 95561 95569 95581 95597 95603 95617 95621 95629 95633 95651 95701 95707 
-95713 95717 95723 95731 95737 95747 95773 95783 95789 95791 95801 95803 95813 95819 
-95857 95869 95873 95881 95891 95911 95917 95923 95929 95947 95957 95959 95971 95987 
-95989 96001 96013 96017 96043 96053 96059 96079 96097 96137 96149 96157 96167 96179 
-96181 96199 96211 96221 96223 96233 96259 96263 96269 96281 96289 96293 96323 96329 
-96331 96337 96353 96377 96401 96419 96431 96443 96451 96457 96461 96469 96479 96487 
-96493 96497 96517 96527 96553 96557 96581 96587 96589 96601 96643 96661 96667 96671 
-96697 96703 96731 96737 96739 96749 96757 96763 96769 96779 96787 96797 96799 96821 
-96823 96827 96847 96851 96857 96893 96907 96911 96931 96953 96959 96973 96979 96989 
-96997 97001 97003 97007 97021 97039 97073 97081 97103 97117 97127 97151 97157 97159 
-97169 97171 97177 97187 97213 97231 97241 97259 97283 97301 97303 97327 97367 97369 
-97373 97379 97381 97387 97397 97423 97429 97441 97453 97459 97463 97499 97501 97511 
-97523 97547 97549 97553 97561 97571 97577 97579 97583 97607 97609 97613 97649 97651 
-97673 97687 97711 97729 97771 97777 97787 97789 97813 97829 97841 97843 97847 97849 
-97859 97861 97871 97879 97883 97919 97927 97931 97943 97961 97967 97973 97987 98009 
-98011 98017 98041 98047 98057 98081 98101 98123 98129 98143 98179 98207 98213 98221 
-98227 98251 98257 98269 98297 98299 98317 98321 98323 98327 98347 98369 98377 98387 
-98389 98407 98411 98419 98429 98443 98453 98459 98467 98473 98479 98491 98507 98519 
-98533 98543 98561 98563 98573 98597 98621 98627 98639 98641 98663 98669 98689 98711 
-98713 98717 98729 98731 98737 98773 98779 98801 98807 98809 98837 98849 98867 98869 
-98873 98887 98893 98897 98899 98909 98911 98927 98929 98939 98947 98953 98963 98981 
-98993 98999 99013 99017 99023 99041 99053 99079 99083 99089 99103 99109 99119 99131 
-99133 99137 99139 99149 99173 99181 99191 99223 99233 99241 99251 99257 99259 99277 
-99289 99317 99347 99349 99367 99371 99377 99391 99397 99401 99409 99431 99439 99469 
-99487 99497 99523 99527 99529 99551 99559 99563 99571 99577 99581 99607 99611 99623 
-99643 99661 99667 99679 99689 99707 99709 99713 99719 99721 99733 99761 99767 99787 
-99793 99809 99817 99823 99829 99833 99839 99859 99871 99877 99881 99901 99907 99923 
-99929 99961 99971 99989 99991 
-100003 100019 100043 100049 100057 100069 100103 100109 100129 100151 100153 100169 
-100183 100189 100193 100207 100213 100237 100267 100271 100279 100291 100297 100313 
-100333 100343 100357 100361 100363 100379 100391 100393 100403 100411 100417 100447 
-100459 100469 100483 100493 100501 100511 100517 100519 100523 100537 100547 100549 
-100559 100591 100609 100613 100621 100649 100669 100673 100693 100699 100703 100733 
-100741 100747 100769 100787 100799 100801 100811 100823 100829 100847 100853 100907 
-100913 100927 100931 100937 100943 100957 100981 100987 100999 101009 101021 101027 
-101051 101063 101081 101089 101107 101111 101113 101117 101119 101141 101149 101159 
-101161 101173 101183 101197 101203 101207 101209 101221 101267 101273 101279 101281 
-101287 101293 101323 101333 101341 101347 101359 101363 101377 101383 101399 101411 
-101419 101429 101449 101467 101477 101483 101489 101501 101503 101513 101527 101531 
-101533 101537 101561 101573 101581 101599 101603 101611 101627 101641 101653 101663 
-101681 101693 101701 101719 101723 101737 101741 101747 101749 101771 101789 101797 
-101807 101833 101837 101839 101863 101869 101873 101879 101891 101917 101921 101929 
-101939 101957 101963 101977 101987 101999 102001 102013 102019 102023 102031 102043 
-102059 102061 102071 102077 102079 102101 102103 102107 102121 102139 102149 102161 
-102181 102191 102197 102199 102203 102217 102229 102233 102241 102251 102253 102259 
-102293 102299 102301 102317 102329 102337 102359 102367 102397 102407 102409 102433 
-102437 102451 102461 102481 102497 102499 102503 102523 102533 102539 102547 102551 
-102559 102563 102587 102593 102607 102611 102643 102647 102653 102667 102673 102677 
-102679 102701 102761 102763 102769 102793 102797 102811 102829 102841 102859 102871 
-102877 102881 102911 102913 102929 102931 102953 102967 102983 103001 103007 103043 
-103049 103067 103069 103079 103087 103091 103093 103099 103123 103141 103171 103177 
-103183 103217 103231 103237 103289 103291 103307 103319 103333 103349 103357 103387 
-103391 103393 103399 103409 103421 103423 103451 103457 103471 103483 103511 103529 
-103549 103553 103561 103567 103573 103577 103583 103591 103613 103619 103643 103651 
-103657 103669 103681 103687 103699 103703 103723 103769 103787 103801 103811 103813 
-103837 103841 103843 103867 103889 103903 103913 103919 103951 103963 103967 103969 
-103979 103981 103991 103993 103997 104003 104009 104021 104033 104047 104053 104059 
-104087 104089 104107 104113 104119 104123 104147 104149 104161 104173 104179 104183 
-104207 104231 104233 104239 104243 104281 104287 104297 104309 104311 104323 104327 
-104347 104369 104381 104383 104393 104399 104417 104459 104471 104473 104479 104491 
-104513 104527 104537 104543 104549 104551 104561 104579 104593 104597 104623 104639 
-104651 104659 104677 104681 104683 104693 104701 104707 104711 104717 104723 104729 
-104743 104759 104761 104773 104779 104789 104801 104803 104827 104831 104849 104851 
-104869 104879 104891 104911 104917 104933 104947 104953 104959 104971 104987 104999 
-105019 105023 105031 105037 105071 105097 105107 105137 105143 105167 105173 105199 
-105211 105227 105229 105239 105251 105253 105263 105269 105277 105319 105323 105331 
-105337 105341 105359 105361 105367 105373 105379 105389 105397 105401 105407 105437 
-105449 105467 105491 105499 105503 105509 105517 105527 105529 105533 105541 105557 
-105563 105601 105607 105613 105619 105649 105653 105667 105673 105683 105691 105701 
-105727 105733 105751 105761 105767 105769 105817 105829 105863 105871 105883 105899 
-105907 105913 105929 105943 105953 105967 105971 105977 105983 105997 106013 106019 
-106031 106033 106087 106103 106109 106121 106123 106129 106163 106181 106187 106189 
-106207 106213 106217 106219 106243 106261 106273 106277 106279 106291 106297 106303 
-106307 106319 106321 106331 106349 106357 106363 106367 106373 106391 106397 106411 
-106417 106427 106433 106441 106451 106453 106487 106501 106531 106537 106541 106543 
-106591 106619 106621 106627 106637 106649 106657 106661 106663 106669 106681 106693 
-106699 106703 106721 106727 106739 106747 106751 106753 106759 106781 106783 106787 
-106801 106823 106853 106859 106861 106867 106871 106877 106903 106907 106921 106937 
-106949 106957 106961 106963 106979 106993 107021 107033 107053 107057 107069 107071 
-107077 107089 107099 107101 107119 107123 107137 107171 107183 107197 107201 107209 
-107227 107243 107251 107269 107273 107279 107309 107323 107339 107347 107351 107357 
-107377 107441 107449 107453 107467 107473 107507 107509 107563 107581 107599 107603 
-107609 107621 107641 107647 107671 107687 107693 107699 107713 107717 107719 107741 
-107747 107761 107773 107777 107791 107827 107837 107839 107843 107857 107867 107873 
-107881 107897 107903 107923 107927 107941 107951 107971 107981 107999 108007 108011 
-108013 108023 108037 108041 108061 108079 108089 108107 108109 108127 108131 108139 
-108161 108179 108187 108191 108193 108203 108211 108217 108223 108233 108247 108263 
-108271 108287 108289 108293 108301 108343 108347 108359 108377 108379 108401 108413 
-108421 108439 108457 108461 108463 108497 108499 108503 108517 108529 108533 108541 
-108553 108557 108571 108587 108631 108637 108643 108649 108677 108707 108709 108727 
-108739 108751 108761 108769 108791 108793 108799 108803 108821 108827 108863 108869 
-108877 108881 108883 108887 108893 108907 108917 108923 108929 108943 108947 108949 
-108959 108961 108967 108971 108991 109001 109013 109037 109049 109063 109073 109097 
-109103 109111 109121 109133 109139 109141 109147 109159 109169 109171 109199 109201 
-109211 109229 109253 109267 109279 109297 109303 109313 109321 109331 109357 109363 
-109367 109379 109387 109391 109397 109423 109433 109441 109451 109453 109469 109471 
-109481 109507 109517 109519 109537 109541 109547 109567 109579 109583 109589 109597 
-109609 109619 109621 109639 109661 109663 109673 109717 109721 109741 109751 109789 
-109793 109807 109819 109829 109831 109841 109843 109847 109849 109859 109873 109883 
-109891 109897 109903 109913 109919 109937 109943 109961 109987 110017 110023 110039 
-110051 110059 110063 110069 110083 110119 110129 110161 110183 110221 110233 110237 
-110251 110261 110269 110273 110281 110291 110311 110321 110323 110339 110359 110419 
-110431 110437 110441 110459 110477 110479 110491 110501 110503 110527 110533 110543 
-110557 110563 110567 110569 110573 110581 110587 110597 110603 110609 110623 110629 
-110641 110647 110651 110681 110711 110729 110731 110749 110753 110771 110777 110807 
-110813 110819 110821 110849 110863 110879 110881 110899 110909 110917 110921 110923 
-110927 110933 110939 110947 110951 110969 110977 110989 111029 111031 111043 111049 
-111053 111091 111103 111109 111119 111121 111127 111143 111149 111187 111191 111211 
-111217 111227 111229 111253 111263 111269 111271 111301 111317 111323 111337 111341 
-111347 111373 111409 111427 111431 111439 111443 111467 111487 111491 111493 111497 
-111509 111521 111533 111539 111577 111581 111593 111599 111611 111623 111637 111641 
-111653 111659 111667 111697 111721 111731 111733 111751 111767 111773 111779 111781 
-111791 111799 111821 111827 111829 111833 111847 111857 111863 111869 111871 111893 
-111913 111919 111949 111953 111959 111973 111977 111997 112019 112031 112061 112067 
-112069 112087 112097 112103 112111 112121 112129 112139 112153 112163 112181 112199 
-112207 112213 112223 112237 112241 112247 112249 112253 112261 112279 112289 112291 
-112297 112303 112327 112331 112337 112339 112349 112361 112363 112397 112403 112429 
-112459 112481 112501 112507 112543 112559 112571 112573 112577 112583 112589 112601 
-112603 112621 112643 112657 112663 112687 112691 112741 112757 112759 112771 112787 
-112799 112807 112831 112843 112859 112877 112901 112909 112913 112919 112921 112927 
-112939 112951 112967 112979 112997 113011 113017 113021 113023 113027 113039 113041 
-113051 113063 113081 113083 113089 113093 113111 113117 113123 113131 113143 113147 
-113149 113153 113159 113161 113167 113171 113173 113177 113189 113209 113213 113227 
-113233 113279 113287 113327 113329 113341 113357 113359 113363 113371 113381 113383 
-113417 113437 113453 113467 113489 113497 113501 113513 113537 113539 113557 113567 
-113591 113621 113623 113647 113657 113683 113717 113719 113723 113731 113749 113759 
-113761 113777 113779 113783 113797 113809 113819 113837 113843 113891 113899 113903 
-113909 113921 113933 113947 113957 113963 113969 113983 113989 114001 114013 114031 
-114041 114043 114067 114073 114077 114083 114089 114113 114143 114157 114161 114167 
-114193 114197 114199 114203 114217 114221 114229 114259 114269 114277 114281 114299 
-114311 114319 114329 114343 114371 114377 114407 114419 114451 114467 114473 114479 
-114487 114493 114547 114553 114571 114577 114593 114599 114601 114613 114617 114641 
-114643 114649 114659 114661 114671 114679 114689 114691 114713 114743 114749 114757 
-114761 114769 114773 114781 114797 114799 114809 114827 114833 114847 114859 114883 
-114889 114901 114913 114941 114967 114973 114997 115001 115013 115019 115021 115057 
-115061 115067 115079 115099 115117 115123 115127 115133 115151 115153 115163 115183 
-115201 115211 115223 115237 115249 115259 115279 115301 115303 115309 115319 115321 
-115327 115331 115337 115343 115361 115363 115399 115421 115429 115459 115469 115471 
-115499 115513 115523 115547 115553 115561 115571 115589 115597 115601 115603 115613 
-115631 115637 115657 115663 115679 115693 115727 115733 115741 115751 115757 115763 
-115769 115771 115777 115781 115783 115793 115807 115811 115823 115831 115837 115849 
-115853 115859 115861 115873 115877 115879 115883 115891 115901 115903 115931 115933 
-115963 115979 115981 115987 116009 116027 116041 116047 116089 116099 116101 116107 
-116113 116131 116141 116159 116167 116177 116189 116191 116201 116239 116243 116257 
-116269 116273 116279 116293 116329 116341 116351 116359 116371 116381 116387 116411 
-116423 116437 116443 116447 116461 116471 116483 116491 116507 116531 116533 116537 
-116539 116549 116579 116593 116639 116657 116663 116681 116687 116689 116707 116719 
-116731 116741 116747 116789 116791 116797 116803 116819 116827 116833 116849 116867 
-116881 116903 116911 116923 116927 116929 116933 116953 116959 116969 116981 116989 
-116993 117017 117023 117037 117041 117043 117053 117071 117101 117109 117119 117127 
-117133 117163 117167 117191 117193 117203 117209 117223 117239 117241 117251 117259 
-117269 117281 117307 117319 117329 117331 117353 117361 117371 117373 117389 117413 
-117427 117431 117437 117443 117497 117499 117503 117511 117517 117529 117539 117541 
-117563 117571 117577 117617 117619 117643 117659 117671 117673 117679 117701 117703 
-117709 117721 117727 117731 117751 117757 117763 117773 117779 117787 117797 117809 
-117811 117833 117839 117841 117851 117877 117881 117883 117889 117899 117911 117917 
-117937 117959 117973 117977 117979 117989 117991 118033 118037 118043 118051 118057 
-118061 118081 118093 118127 118147 118163 118169 118171 118189 118211 118213 118219 
-118247 118249 118253 118259 118273 118277 118297 118343 118361 118369 118373 118387 
-118399 118409 118411 118423 118429 118453 118457 118463 118471 118493 118529 118543 
-118549 118571 118583 118589 118603 118619 118621 118633 118661 118669 118673 118681 
-118687 118691 118709 118717 118739 118747 118751 118757 118787 118799 118801 118819 
-118831 118843 118861 118873 118891 118897 118901 118903 118907 118913 118927 118931 
-118967 118973 119027 119033 119039 119047 119057 119069 119083 119087 119089 119099 
-119101 119107 119129 119131 119159 119173 119179 119183 119191 119227 119233 119237 
-119243 119267 119291 119293 119297 119299 119311 119321 119359 119363 119389 119417 
-119419 119429 119447 119489 119503 119513 119533 119549 119551 119557 119563 119569 
-119591 119611 119617 119627 119633 119653 119657 119659 119671 119677 119687 119689 
-119699 119701 119723 119737 119747 119759 119771 119773 119783 119797 119809 119813 
-119827 119831 119839 119849 119851 119869 119881 119891 119921 119923 119929 119953 
-119963 119971 119981 119983 119993 120011 120017 120041 120047 120049 120067 120077 
-120079 120091 120097 120103 120121 120157 120163 120167 120181 120193 120199 120209 
-120223 120233 120247 120277 120283 120293 120299 120319 120331 120349 120371 120383 
-120391 120397 120401 120413 120427 120431 120473 120503 120511 120539 120551 120557 
-120563 120569 120577 120587 120607 120619 120623 120641 120647 120661 120671 120677 
-120689 120691 120709 120713 120721 120737 120739 120749 120763 120767 120779 120811 
-120817 120823 120829 120833 120847 120851 120863 120871 120877 120889 120899 120907 
-120917 120919 120929 120937 120941 120943 120947 120977 120997 121001 121007 121013 
-121019 121021 121039 121061 121063 121067 121081 121123 121139 121151 121157 121169 
-121171 121181 121189 121229 121259 121267 121271 121283 121291 121309 121313 121321 
-121327 121333 121343 121349 121351 121357 121367 121369 121379 121403 121421 121439 
-121441 121447 121453 121469 121487 121493 121501 121507 121523 121531 121547 121553 
-121559 121571 121577 121579 121591 121607 121609 121621 121631 121633 121637 121661 
-121687 121697 121711 121721 121727 121763 121787 121789 121843 121853 121867 121883 
-121889 121909 121921 121931 121937 121949 121951 121963 121967 121993 121997 122011 
-122021 122027 122029 122033 122039 122041 122051 122053 122069 122081 122099 122117 
-122131 122147 122149 122167 122173 122201 122203 122207 122209 122219 122231 122251 
-122263 122267 122273 122279 122299 122321 122323 122327 122347 122363 122387 122389 
-122393 122399 122401 122443 122449 122453 122471 122477 122489 122497 122501 122503 
-122509 122527 122533 122557 122561 122579 122597 122599 122609 122611 122651 122653 
-122663 122693 122701 122719 122741 122743 122753 122761 122777 122789 122819 122827 
-122833 122839 122849 122861 122867 122869 122887 122891 122921 122929 122939 122953 
-122957 122963 122971 123001 123007 123017 123031 123049 123059 123077 123083 123091 
-123113 123121 123127 123143 123169 123191 123203 123209 123217 123229 123239 123259 
-123269 123289 123307 123311 123323 123341 123373 123377 123379 123397 123401 123407 
-123419 123427 123433 123439 123449 123457 123479 123491 123493 123499 123503 123517 
-123527 123547 123551 123553 123581 123583 123593 123601 123619 123631 123637 123653 
-123661 123667 123677 123701 123707 123719 123727 123731 123733 123737 123757 123787 
-123791 123803 123817 123821 123829 123833 123853 123863 123887 123911 123923 123931 
-123941 123953 123973 123979 123983 123989 123997 124001 124021 124067 124087 124097 
-124121 124123 124133 124139 124147 124153 124171 124181 124183 124193 124199 124213 
-124231 124247 124249 124277 124291 124297 124301 124303 124309 124337 124339 124343 
-124349 124351 124363 124367 124427 124429 124433 124447 124459 124471 124477 124489 
-124493 124513 124529 124541 124543 124561 124567 124577 124601 124633 124643 124669 
-124673 124679 124693 124699 124703 124717 124721 124739 124753 124759 124769 124771 
-124777 124781 124783 124793 124799 124819 124823 124847 124853 124897 124907 124909 
-124919 124951 124979 124981 124987 124991 125003 125017 125029 125053 125063 125093 
-125101 125107 125113 125117 125119 125131 125141 125149 125183 125197 125201 125207 
-125219 125221 125231 125243 125261 125269 125287 125299 125303 125311 125329 125339 
-125353 125371 125383 125387 125399 125407 125423 125429 125441 125453 125471 125497 
-125507 125509 125527 125539 125551 125591 125597 125617 125621 125627 125639 125641 
-125651 125659 125669 125683 125687 125693 125707 125711 125717 125731 125737 125743 
-125753 125777 125789 125791 125803 125813 125821 125863 125887 125897 125899 125921 
-125927 125929 125933 125941 125959 125963 126001 126011 126013 126019 126023 126031 
-126037 126041 126047 126067 126079 126097 126107 126127 126131 126143 126151 126173 
-126199 126211 126223 126227 126229 126233 126241 126257 126271 126307 126311 126317 
-126323 126337 126341 126349 126359 126397 126421 126433 126443 126457 126461 126473 
-126481 126487 126491 126493 126499 126517 126541 126547 126551 126583 126601 126611 
-126613 126631 126641 126653 126683 126691 126703 126713 126719 126733 126739 126743 
-126751 126757 126761 126781 126823 126827 126839 126851 126857 126859 126913 126923 
-126943 126949 126961 126967 126989 127031 127033 127037 127051 127079 127081 127103 
-127123 127133 127139 127157 127163 127189 127207 127217 127219 127241 127247 127249 
-127261 127271 127277 127289 127291 127297 127301 127321 127331 127343 127363 127373 
-127399 127403 127423 127447 127453 127481 127487 127493 127507 127529 127541 127549 
-127579 127583 127591 127597 127601 127607 127609 127637 127643 127649 127657 127663 
-127669 127679 127681 127691 127703 127709 127711 127717 127727 127733 127739 127747 
-127763 127781 127807 127817 127819 127837 127843 127849 127859 127867 127873 127877 
-127913 127921 127931 127951 127973 127979 127997 128021 128033 128047 128053 128099 
-128111 128113 128119 128147 128153 128159 128173 128189 128201 128203 128213 128221 
-128237 128239 128257 128273 128287 128291 128311 128321 128327 128339 128341 128347 
-128351 128377 128389 128393 128399 128411 128413 128431 128437 128449 128461 128467 
-128473 128477 128483 128489 128509 128519 128521 128549 128551 128563 128591 128599 
-128603 128621 128629 128657 128659 128663 128669 128677 128683 128693 128717 128747 
-128749 128761 128767 128813 128819 128831 128833 128837 128857 128861 128873 128879 
-128903 128923 128939 128941 128951 128959 128969 128971 128981 128983 128987 128993 
-129001 129011 129023 129037 129049 129061 129083 129089 129097 129113 129119 129121 
-129127 129169 129187 129193 129197 129209 129221 129223 129229 129263 129277 129281 
-129287 129289 129293 129313 129341 129347 129361 129379 129401 129403 129419 129439 
-129443 129449 129457 129461 129469 129491 129497 129499 129509 129517 129527 129529 
-129533 129539 129553 129581 129587 129589 129593 129607 129629 129631 129641 129643 
-129671 129707 129719 129733 129737 129749 129757 129763 129769 129793 129803 129841 
-129853 129887 129893 129901 129917 129919 129937 129953 129959 129967 129971 130003 
-130021 130027 130043 130051 130057 130069 130073 130079 130087 130099 130121 130127 
-130147 130171 130183 130199 130201 130211 130223 130241 130253 130259 130261 130267 
-130279 130303 130307 130337 130343 130349 130363 130367 130369 130379 130399 130409 
-130411 130423 130439 130447 130457 130469 130477 130483 130489 130513 130517 130523 
-130531 130547 130553 130579 130589 130619 130621 130631 130633 130639 130643 130649 
-130651 130657 130681 130687 130693 130699 130729 130769 130783 130787 130807 130811 
-130817 130829 130841 130843 130859 130873 130927 130957 130969 130973 130981 130987 
-131009 131011 131023 131041 131059 131063 131071 131101 131111 131113 131129 131143 
-131149 131171 131203 131213 131221 131231 131249 131251 131267 131293 131297 131303 
-131311 131317 131321 131357 131363 131371 131381 131413 131431 131437 131441 131447 
-131449 131477 131479 131489 131497 131501 131507 131519 131543 131561 131581 131591 
-131611 131617 131627 131639 131641 131671 131687 131701 131707 131711 131713 131731 
-131743 131749 131759 131771 131777 131779 131783 131797 131837 131839 131849 131861 
-131891 131893 131899 131909 131927 131933 131939 131941 131947 131959 131969 132001 
-132019 132047 132049 132059 132071 132103 132109 132113 132137 132151 132157 132169 
-132173 132199 132229 132233 132241 132247 132257 132263 132283 132287 132299 132313 
-132329 132331 132347 132361 132367 132371 132383 132403 132409 132421 132437 132439 
-132469 132491 132499 132511 132523 132527 132529 132533 132541 132547 132589 132607 
-132611 132619 132623 132631 132637 132647 132661 132667 132679 132689 132697 132701 
-132707 132709 132721 132739 132749 132751 132757 132761 132763 132817 132833 132851 
-132857 132859 132863 132887 132893 132911 132929 132947 132949 132953 132961 132967 
-132971 132989 133013 133033 133039 133051 133069 133073 133087 133097 133103 133109 
-133117 133121 133153 133157 133169 133183 133187 133201 133213 133241 133253 133261 
-133271 133277 133279 133283 133303 133319 133321 133327 133337 133349 133351 133379 
-133387 133391 133403 133417 133439 133447 133451 133481 133493 133499 133519 133541 
-133543 133559 133571 133583 133597 133631 133633 133649 133657 133669 133673 133691 
-133697 133709 133711 133717 133723 133733 133769 133781 133801 133811 133813 133831 
-133843 133853 133873 133877 133919 133949 133963 133967 133979 133981 133993 133999 
-134033 134039 134047 134053 134059 134077 134081 134087 134089 134093 134129 134153 
-134161 134171 134177 134191 134207 134213 134219 134227 134243 134257 134263 134269 
-134287 134291 134293 134327 134333 134339 134341 134353 134359 134363 134369 134371 
-134399 134401 134417 134437 134443 134471 134489 134503 134507 134513 134581 134587 
-134591 134593 134597 134609 134639 134669 134677 134681 134683 134699 134707 134731 
-134741 134753 134777 134789 134807 134837 134839 134851 134857 134867 134873 134887 
-134909 134917 134921 134923 134947 134951 134989 134999 135007 135017 135019 135029 
-135043 135049 135059 135077 135089 135101 135119 135131 135151 135173 135181 135193 
-135197 135209 135211 135221 135241 135257 135271 135277 135281 135283 135301 135319 
-135329 135347 135349 135353 135367 135389 135391 135403 135409 135427 135431 135433 
-135449 135461 135463 135467 135469 135479 135497 135511 135533 135559 135571 135581 
-135589 135593 135599 135601 135607 135613 135617 135623 135637 135647 135649 135661 
-135671 135697 135701 135719 135721 135727 135731 135743 135757 135781 135787 135799 
-135829 135841 135851 135859 135887 135893 135899 135911 135913 135929 135937 135977 
-135979 136013 136027 136033 136043 136057 136067 136069 136093 136099 136111 136133 
-136139 136163 136177 136189 136193 136207 136217 136223 136237 136247 136261 136273 
-136277 136303 136309 136319 136327 136333 136337 136343 136351 136361 136373 136379 
-136393 136397 136399 136403 136417 136421 136429 136447 136453 136463 136471 136481 
-136483 136501 136511 136519 136523 136531 136537 136541 136547 136559 136573 136601 
-136603 136607 136621 136649 136651 136657 136691 136693 136709 136711 136727 136733 
-136739 136751 136753 136769 136777 136811 136813 136841 136849 136859 136861 136879 
-136883 136889 136897 136943 136949 136951 136963 136973 136979 136987 136991 136993 
-136999 137029 137077 137087 137089 137117 137119 137131 137143 137147 137153 137177 
-137183 137191 137197 137201 137209 137219 137239 137251 137273 137279 137303 137321 
-137339 137341 137353 137359 137363 137369 137383 137387 137393 137399 137413 137437 
-137443 137447 137453 137477 137483 137491 137507 137519 137537 137567 137573 137587 
-137593 137597 137623 137633 137639 137653 137659 137699 137707 137713 137723 137737 
-137743 137771 137777 137791 137803 137827 137831 137849 137867 137869 137873 137909 
-137911 137927 137933 137941 137947 137957 137983 137993 137999 138007 138041 138053 
-138059 138071 138077 138079 138101 138107 138113 138139 138143 138157 138163 138179 
-138181 138191 138197 138209 138239 138241 138247 138251 138283 138289 138311 138319 
-138323 138337 138349 138371 138373 138389 138401 138403 138407 138427 138433 138449 
-138451 138461 138469 138493 138497 138511 138517 138547 138559 138563 138569 138571 
-138577 138581 138587 138599 138617 138629 138637 138641 138647 138661 138679 138683 
-138727 138731 138739 138763 138793 138797 138799 138821 138829 138841 138863 138869 
-138883 138889 138893 138899 138917 138923 138937 138959 138967 138977 139021 139033 
-139067 139079 139091 139109 139121 139123 139133 139169 139177 139187 139199 139201 
-139241 139267 139273 139291 139297 139301 139303 139309 139313 139333 139339 139343 
-139361 139367 139369 139387 139393 139397 139409 139423 139429 139439 139457 139459 
-139483 139487 139493 139501 139511 139537 139547 139571 139589 139591 139597 139609 
-139619 139627 139661 139663 139681 139697 139703 139709 139721 139729 139739 139747 
-139753 139759 139787 139801 139813 139831 139837 139861 139871 139883 139891 139901 
-139907 139921 139939 139943 139967 139969 139981 139987 139991 139999 140009 140053 
-140057 140069 140071 140111 140123 140143 140159 140167 140171 140177 140191 140197 
-140207 140221 140227 140237 140249 140263 140269 140281 140297 140317 140321 140333 
-140339 140351 140363 140381 140401 140407 140411 140417 140419 140423 140443 140449 
-140453 140473 140477 140521 140527 140533 140549 140551 140557 140587 140593 140603 
-140611 140617 140627 140629 140639 140659 140663 140677 140681 140683 140689 140717 
-140729 140731 140741 140759 140761 140773 140779 140797 140813 140827 140831 140837 
-140839 140863 140867 140869 140891 140893 140897 140909 140929 140939 140977 140983 
-140989 141023 141041 141061 141067 141073 141079 141101 141107 141121 141131 141157 
-141161 141179 141181 141199 141209 141221 141223 141233 141241 141257 141263 141269 
-141277 141283 141301 141307 141311 141319 141353 141359 141371 141397 141403 141413 
-141439 141443 141461 141481 141497 141499 141509 141511 141529 141539 141551 141587 
-141601 141613 141619 141623 141629 141637 141649 141653 141667 141671 141677 141679 
-141689 141697 141707 141709 141719 141731 141761 141767 141769 141773 141793 141803 
-141811 141829 141833 141851 141853 141863 141871 141907 141917 141931 141937 141941 
-141959 141961 141971 141991 142007 142019 142031 142039 142049 142057 142061 142067 
-142097 142099 142111 142123 142151 142157 142159 142169 142183 142189 142193 142211 
-142217 142223 142231 142237 142271 142297 142319 142327 142357 142369 142381 142391 
-142403 142421 142427 142433 142453 142469 142501 142529 142537 142543 142547 142553 
-142559 142567 142573 142589 142591 142601 142607 142609 142619 142657 142673 142697 
-142699 142711 142733 142757 142759 142771 142787 142789 142799 142811 142837 142841 
-142867 142871 142873 142897 142903 142907 142939 142949 142963 142969 142973 142979 
-142981 142993 143053 143063 143093 143107 143111 143113 143137 143141 143159 143177 
-143197 143239 143243 143249 143257 143261 143263 143281 143287 143291 143329 143333 
-143357 143387 143401 143413 143419 143443 143461 143467 143477 143483 143489 143501 
-143503 143509 143513 143519 143527 143537 143551 143567 143569 143573 143593 143609 
-143617 143629 143651 143653 143669 143677 143687 143699 143711 143719 143729 143743 
-143779 143791 143797 143807 143813 143821 143827 143831 143833 143873 143879 143881 
-143909 143947 143953 143971 143977 143981 143999 144013 144031 144037 144061 144071 
-144073 144103 144139 144161 144163 144167 144169 144173 144203 144223 144241 144247 
-144253 144259 144271 144289 144299 144307 144311 144323 144341 144349 144379 144383 
-144407 144409 144413 144427 144439 144451 144461 144479 144481 144497 144511 144539 
-144541 144563 144569 144577 144583 144589 144593 144611 144629 144659 144667 144671 
-144701 144709 144719 144731 144737 144751 144757 144763 144773 144779 144791 144817 
-144829 144839 144847 144883 144887 144889 144899 144917 144931 144941 144961 144967 
-144973 144983 145007 145009 145021 145031 145037 145043 145063 145069 145091 145109 
-145121 145133 145139 145177 145193 145207 145213 145219 145253 145259 145267 145283 
-145289 145303 145307 145349 145361 145381 145391 145399 145417 145423 145433 145441 
-145451 145459 145463 145471 145477 145487 145501 145511 145513 145517 145531 145543 
-145547 145549 145577 145589 145601 145603 145633 145637 145643 145661 145679 145681 
-145687 145703 145709 145721 145723 145753 145757 145759 145771 145777 145799 145807 
-145819 145823 145829 145861 145879 145897 145903 145931 145933 145949 145963 145967 
-145969 145987 145991 146009 146011 146021 146023 146033 146051 146057 146059 146063 
-146077 146093 146099 146117 146141 146161 146173 146191 146197 146203 146213 146221 
-146239 146249 146273 146291 146297 146299 146309 146317 146323 146347 146359 146369 
-146381 146383 146389 146407 146417 146423 146437 146449 146477 146513 146519 146521 
-146527 146539 146543 146563 146581 146603 146609 146617 146639 146647 146669 146677 
-146681 146683 146701 146719 146743 146749 146767 146777 146801 146807 146819 146833 
-146837 146843 146849 146857 146891 146893 146917 146921 146933 146941 146953 146977 
-146983 146987 146989 147011 147029 147031 147047 147073 147083 147089 147097 147107 
-147137 147139 147151 147163 147179 147197 147209 147211 147221 147227 147229 147253 
-147263 147283 147289 147293 147299 147311 147319 147331 147341 147347 147353 147377 
-147391 147397 147401 147409 147419 147449 147451 147457 147481 147487 147503 147517 
-147541 147547 147551 147557 147571 147583 147607 147613 147617 147629 147647 147661 
-147671 147673 147689 147703 147709 147727 147739 147743 147761 147769 147773 147779 
-147787 147793 147799 147811 147827 147853 147859 147863 147881 147919 147937 147949 
-147977 147997 148013 148021 148061 148063 148073 148079 148091 148123 148139 148147 
-148151 148153 148157 148171 148193 148199 148201 148207 148229 148243 148249 148279 
-148301 148303 148331 148339 148361 148367 148381 148387 148399 148403 148411 148429 
-148439 148457 148469 148471 148483 148501 148513 148517 148531 148537 148549 148573 
-148579 148609 148627 148633 148639 148663 148667 148669 148691 148693 148711 148721 
-148723 148727 148747 148763 148781 148783 148793 148817 148829 148853 148859 148861 
-148867 148873 148891 148913 148921 148927 148931 148933 148949 148957 148961 148991 
-148997 149011 149021 149027 149033 149053 149057 149059 149069 149077 149087 149099 
-149101 149111 149113 149119 149143 149153 149159 149161 149173 149183 149197 149213 
-149239 149249 149251 149257 149269 149287 149297 149309 149323 149333 149341 149351 
-149371 149377 149381 149393 149399 149411 149417 149419 149423 149441 149459 149489 
-149491 149497 149503 149519 149521 149531 149533 149543 149551 149561 149563 149579 
-149603 149623 149627 149629 149689 149711 149713 149717 149729 149731 149749 149759 
-149767 149771 149791 149803 149827 149837 149839 149861 149867 149873 149893 149899 
-149909 149911 149921 149939 149953 149969 149971 149993 150001 150011 150041 150053 
-150061 150067 150077 150083 150089 150091 150097 150107 150131 150151 150169 150193 
-150197 150203 150209 150211 150217 150221 150223 150239 150247 150287 150299 150301 
-150323 150329 150343 150373 150377 150379 150383 150401 150407 150413 150427 150431 
-150439 150473 150497 150503 150517 150523 150533 150551 150559 150571 150583 150587 
-150589 150607 150611 150617 150649 150659 150697 150707 150721 150743 150767 150769 
-150779 150791 150797 150827 150833 150847 150869 150881 150883 150889 150893 150901 
-150907 150919 150929 150959 150961 150967 150979 150989 150991 151007 151009 151013 
-151027 151049 151051 151057 151091 151121 151141 151153 151157 151163 151169 151171 
-151189 151201 151213 151237 151241 151243 151247 151253 151273 151279 151289 151303 
-151337 151339 151343 151357 151379 151381 151391 151397 151423 151429 151433 151451 
-151471 151477 151483 151499 151507 151517 151523 151531 151537 151549 151553 151561 
-151573 151579 151597 151603 151607 151609 151631 151637 151643 151651 151667 151673 
-151681 151687 151693 151703 151717 151729 151733 151769 151771 151783 151787 151799 
-151813 151817 151841 151847 151849 151871 151883 151897 151901 151903 151909 151937 
-151939 151967 151969 152003 152017 152027 152029 152039 152041 152063 152077 152081 
-152083 152093 152111 152123 152147 152183 152189 152197 152203 152213 152219 152231 
-152239 152249 152267 152287 152293 152297 152311 152363 152377 152381 152389 152393 
-152407 152417 152419 152423 152429 152441 152443 152459 152461 152501 152519 152531 
-152533 152539 152563 152567 152597 152599 152617 152623 152629 152639 152641 152657 
-152671 152681 152717 152723 152729 152753 152767 152777 152783 152791 152809 152819 
-152821 152833 152837 152839 152843 152851 152857 152879 152897 152899 152909 152939 
-152941 152947 152953 152959 152981 152989 152993 153001 153059 153067 153071 153073 
-153077 153089 153107 153113 153133 153137 153151 153191 153247 153259 153269 153271 
-153277 153281 153287 153313 153319 153337 153343 153353 153359 153371 153379 153407 
-153409 153421 153427 153437 153443 153449 153457 153469 153487 153499 153509 153511 
-153521 153523 153529 153533 153557 153563 153589 153607 153611 153623 153641 153649 
-153689 153701 153719 153733 153739 153743 153749 153757 153763 153817 153841 153871 
-153877 153887 153889 153911 153913 153929 153941 153947 153949 153953 153991 153997 
-154001 154027 154043 154057 154061 154067 154073 154079 154081 154087 154097 154111 
-154127 154153 154157 154159 154181 154183 154211 154213 154229 154243 154247 154267 
-154277 154279 154291 154303 154313 154321 154333 154339 154351 154369 154373 154387 
-154409 154417 154423 154439 154459 154487 154493 154501 154523 154543 154571 154573 
-154579 154589 154591 154613 154619 154621 154643 154667 154669 154681 154691 154699 
-154723 154727 154733 154747 154753 154769 154787 154789 154799 154807 154823 154841 
-154849 154871 154873 154877 154883 154897 154927 154933 154937 154943 154981 154991 
-155003 155009 155017 155027 155047 155069 155081 155083 155087 155119 155137 155153 
-155161 155167 155171 155191 155201 155203 155209 155219 155231 155251 155269 155291 
-155299 155303 155317 155327 155333 155371 155377 155381 155383 155387 155399 155413 
-155423 155443 155453 155461 155473 155501 155509 155521 155537 155539 155557 155569 
-155579 155581 155593 155599 155609 155621 155627 155653 155657 155663 155671 155689 
-155693 155699 155707 155717 155719 155723 155731 155741 155747 155773 155777 155783 
-155797 155801 155809 155821 155833 155849 155851 155861 155863 155887 155891 155893 
-155921 156007 156011 156019 156041 156059 156061 156071 156089 156109 156119 156127 
-156131 156139 156151 156157 156217 156227 156229 156241 156253 156257 156259 156269 
-156307 156319 156329 156347 156353 156361 156371 156419 156421 156437 156467 156487 
-156491 156493 156511 156521 156539 156577 156589 156593 156601 156619 156623 156631 
-156641 156659 156671 156677 156679 156683 156691 156703 156707 156719 156727 156733 
-156749 156781 156797 156799 156817 156823 156833 156841 156887 156899 156901 156913 
-156941 156943 156967 156971 156979 157007 157013 157019 157037 157049 157051 157057 
-157061 157081 157103 157109 157127 157133 157141 157163 157177 157181 157189 157207 
-157211 157217 157219 157229 157231 157243 157247 157253 157259 157271 157273 157277 
-157279 157291 157303 157307 157321 157327 157349 157351 157363 157393 157411 157427 
-157429 157433 157457 157477 157483 157489 157513 157519 157523 157543 157559 157561 
-157571 157579 157627 157637 157639 157649 157667 157669 157679 157721 157733 157739 
-157747 157769 157771 157793 157799 157813 157823 157831 157837 157841 157867 157877 
-157889 157897 157901 157907 157931 157933 157951 157991 157999 158003 158009 158017 
-158029 158047 158071 158077 158113 158129 158141 158143 158161 158189 158201 158209 
-158227 158231 158233 158243 158261 158269 158293 158303 158329 158341 158351 158357 
-158359 158363 158371 158393 158407 158419 158429 158443 158449 158489 158507 158519 
-158527 158537 158551 158563 158567 158573 158581 158591 158597 158611 158617 158621 
-158633 158647 158657 158663 158699 158731 158747 158749 158759 158761 158771 158777 
-158791 158803 158843 158849 158863 158867 158881 158909 158923 158927 158941 158959 
-158981 158993 159013 159017 159023 159059 159073 159079 159097 159113 159119 159157 
-159161 159167 159169 159179 159191 159193 159199 159209 159223 159227 159233 159287 
-159293 159311 159319 159337 159347 159349 159361 159389 159403 159407 159421 159431 
-159437 159457 159463 159469 159473 159491 159499 159503 159521 159539 159541 159553 
-159563 159569 159571 159589 159617 159623 159629 159631 159667 159671 159673 159683 
-159697 159701 159707 159721 159737 159739 159763 159769 159773 159779 159787 159791 
-159793 159799 159811 159833 159839 159853 159857 159869 159871 159899 159911 159931 
-159937 159977 159979 160001 160009 160019 160031 160033 160049 160073 160079 160081 
-160087 160091 160093 160117 160141 160159 160163 160169 160183 160201 160207 160217 
-160231 160243 160253 160309 160313 160319 160343 160357 160367 160373 160387 160397 
-160403 160409 160423 160441 160453 160481 160483 160499 160507 160541 160553 160579 
-160583 160591 160603 160619 160621 160627 160637 160639 160649 160651 160663 160669 
-160681 160687 160697 160709 160711 160723 160739 160751 160753 160757 160781 160789 
-160807 160813 160817 160829 160841 160861 160877 160879 160883 160903 160907 160933 
-160967 160969 160981 160997 161009 161017 161033 161039 161047 161053 161059 161071 
-161087 161093 161123 161137 161141 161149 161159 161167 161201 161221 161233 161237 
-161263 161267 161281 161303 161309 161323 161333 161339 161341 161363 161377 161387 
-161407 161411 161453 161459 161461 161471 161503 161507 161521 161527 161531 161543 
-161561 161563 161569 161573 161591 161599 161611 161627 161639 161641 161659 161683 
-161717 161729 161731 161741 161743 161753 161761 161771 161773 161779 161783 161807 
-161831 161839 161869 161873 161879 161881 161911 161921 161923 161947 161957 161969 
-161971 161977 161983 161999 162007 162011 162017 162053 162059 162079 162091 162109 
-162119 162143 162209 162221 162229 162251 162257 162263 162269 162277 162287 162289 
-162293 162343 162359 162389 162391 162413 162419 162439 162451 162457 162473 162493 
-162499 162517 162523 162527 162529 162553 162557 162563 162577 162593 162601 162611 
-162623 162629 162641 162649 162671 162677 162683 162691 162703 162709 162713 162727 
-162731 162739 162749 162751 162779 162787 162791 162821 162823 162829 162839 162847 
-162853 162859 162881 162889 162901 162907 162917 162937 162947 162971 162973 162989 
-162997 163003 163019 163021 163027 163061 163063 163109 163117 163127 163129 163147 
-163151 163169 163171 163181 163193 163199 163211 163223 163243 163249 163259 163307 
-163309 163321 163327 163337 163351 163363 163367 163393 163403 163409 163411 163417 
-163433 163469 163477 163481 163483 163487 163517 163543 163561 163567 163573 163601 
-163613 163621 163627 163633 163637 163643 163661 163673 163679 163697 163729 163733 
-163741 163753 163771 163781 163789 163811 163819 163841 163847 163853 163859 163861 
-163871 163883 163901 163909 163927 163973 163979 163981 163987 163991 163993 163997 
-164011 164023 164039 164051 164057 164071 164089 164093 164113 164117 164147 164149 
-164173 164183 164191 164201 164209 164231 164233 164239 164249 164251 164267 164279 
-164291 164299 164309 164321 164341 164357 164363 164371 164377 164387 164413 164419 
-164429 164431 164443 164447 164449 164471 164477 164503 164513 164531 164569 164581 
-164587 164599 164617 164621 164623 164627 164653 164663 164677 164683 164701 164707 
-164729 164743 164767 164771 164789 164809 164821 164831 164837 164839 164881 164893 
-164911 164953 164963 164987 164999 165001 165037 165041 165047 165049 165059 165079 
-165083 165089 165103 165133 165161 165173 165181 165203 165211 165229 165233 165247 
-165287 165293 165311 165313 165317 165331 165343 165349 165367 165379 165383 165391 
-165397 165437 165443 165449 165457 165463 165469 165479 165511 165523 165527 165533 
-165541 165551 165553 165559 165569 165587 165589 165601 165611 165617 165653 165667 
-165673 165701 165703 165707 165709 165713 165719 165721 165749 165779 165799 165811 
-165817 165829 165833 165857 165877 165883 165887 165901 165931 165941 165947 165961 
-165983 166013 166021 166027 166031 166043 166063 166081 166099 166147 166151 166157 
-166169 166183 166189 166207 166219 166237 166247 166259 166273 166289 166297 166301 
-166303 166319 166349 166351 166357 166363 166393 166399 166403 166409 166417 166429 
-166457 166471 166487 166541 166561 166567 166571 166597 166601 166603 166609 166613 
-166619 166627 166631 166643 166657 166667 166669 166679 166693 166703 166723 166739 
-166741 166781 166783 166799 166807 166823 166841 166843 166847 166849 166853 166861 
-166867 166871 166909 166919 166931 166949 166967 166973 166979 166987 167009 167017 
-167021 167023 167033 167039 167047 167051 167071 167077 167081 167087 167099 167107 
-167113 167117 167119 167149 167159 167173 167177 167191 167197 167213 167221 167249 
-167261 167267 167269 167309 167311 167317 167329 167339 167341 167381 167393 167407 
-167413 167423 167429 167437 167441 167443 167449 167471 167483 167491 167521 167537 
-167543 167593 167597 167611 167621 167623 167627 167633 167641 167663 167677 167683 
-167711 167729 167747 167759 167771 167777 167779 167801 167809 167861 167863 167873 
-167879 167887 167891 167899 167911 167917 167953 167971 167987 168013 168023 168029 
-168037 168043 168067 168071 168083 168089 168109 168127 168143 168151 168193 168197 
-168211 168227 168247 168253 168263 168269 168277 168281 168293 168323 168331 168347 
-168353 168391 168409 168433 168449 168451 168457 168463 168481 168491 168499 168523 
-168527 168533 168541 168559 168599 168601 168617 168629 168631 168643 168673 168677 
-168697 168713 168719 168731 168737 168743 168761 168769 168781 168803 168851 168863 
-168869 168887 168893 168899 168901 168913 168937 168943 168977 168991 169003 169007 
-169009 169019 169049 169063 169067 169069 169079 169093 169097 169111 169129 169151 
-169159 169177 169181 169199 169217 169219 169241 169243 169249 169259 169283 169307 
-169313 169319 169321 169327 169339 169343 169361 169369 169373 169399 169409 169427 
-169457 169471 169483 169489 169493 169501 169523 169531 169553 169567 169583 169591 
-169607 169627 169633 169639 169649 169657 169661 169667 169681 169691 169693 169709 
-169733 169751 169753 169769 169777 169783 169789 169817 169823 169831 169837 169843 
-169859 169889 169891 169909 169913 169919 169933 169937 169943 169951 169957 169987 
-169991 170003 170021 170029 170047 170057 170063 170081 170099 170101 170111 170123 
-170141 170167 170179 170189 170197 170207 170213 170227 170231 170239 170243 170249 
-170263 170267 170279 170293 170299 170327 170341 170347 170351 170353 170363 170369 
-170371 170383 170389 170393 170413 170441 170447 170473 170483 170497 170503 170509 
-170537 170539 170551 170557 170579 170603 170609 170627 170633 170641 170647 170669 
-170689 170701 170707 170711 170741 170749 170759 170761 170767 170773 170777 170801 
-170809 170813 170827 170837 170843 170851 170857 170873 170881 170887 170899 170921 
-170927 170953 170957 170971 171007 171023 171029 171043 171047 171049 171053 171077 
-171079 171091 171103 171131 171161 171163 171167 171169 171179 171203 171233 171251 
-171253 171263 171271 171293 171299 171317 171329 171341 171383 171401 171403 171427 
-171439 171449 171467 171469 171473 171481 171491 171517 171529 171539 171541 171553 
-171559 171571 171583 171617 171629 171637 171641 171653 171659 171671 171673 171679 
-171697 171707 171713 171719 171733 171757 171761 171763 171793 171799 171803 171811 
-171823 171827 171851 171863 171869 171877 171881 171889 171917 171923 171929 171937 
-171947 172001 172009 172021 172027 172031 172049 172069 172079 172093 172097 172127 
-172147 172153 172157 172169 172171 172181 172199 172213 172217 172219 172223 172243 
-172259 172279 172283 172297 172307 172313 172321 172331 172343 172351 172357 172373 
-172399 172411 172421 172423 172427 172433 172439 172441 172489 172507 172517 172519 
-172541 172553 172561 172573 172583 172589 172597 172603 172607 172619 172633 172643 
-172649 172657 172663 172673 172681 172687 172709 172717 172721 172741 172751 172759 
-172787 172801 172807 172829 172849 172853 172859 172867 172871 172877 172883 172933 
-172969 172973 172981 172987 172993 172999 173021 173023 173039 173053 173059 173081 
-173087 173099 173137 173141 173149 173177 173183 173189 173191 173207 173209 173219 
-173249 173263 173267 173273 173291 173293 173297 173309 173347 173357 173359 173429 
-173431 173473 173483 173491 173497 173501 173531 173539 173543 173549 173561 173573 
-173599 173617 173629 173647 173651 173659 173669 173671 173683 173687 173699 173707 
-173713 173729 173741 173743 173773 173777 173779 173783 173807 173819 173827 173839 
-173851 173861 173867 173891 173897 173909 173917 173923 173933 173969 173977 173981 
-173993 174007 174017 174019 174047 174049 174061 174067 174071 174077 174079 174091 
-174101 174121 174137 174143 174149 174157 174169 174197 174221 174241 174257 174259 
-174263 174281 174289 174299 174311 174329 174331 174337 174347 174367 174389 174407 
-174413 174431 174443 174457 174467 174469 174481 174487 174491 174527 174533 174569 
-174571 174583 174599 174613 174617 174631 174637 174649 174653 174659 174673 174679 
-174703 174721 174737 174749 174761 174763 174767 174773 174799 174821 174829 174851 
-174859 174877 174893 174901 174907 174917 174929 174931 174943 174959 174989 174991 
-175003 175013 175039 175061 175067 175069 175079 175081 175103 175129 175141 175211 
-175229 175261 175267 175277 175291 175303 175309 175327 175333 175349 175361 175391 
-175393 175403 175411 175433 175447 175453 175463 175481 175493 175499 175519 175523 
-175543 175573 175601 175621 175631 175633 175649 175663 175673 175687 175691 175699 
-175709 175723 175727 175753 175757 175759 175781 175783 175811 175829 175837 175843 
-175853 175859 175873 175891 175897 175909 175919 175937 175939 175949 175961 175963 
-175979 175991 175993 176017 176021 176023 176041 176047 176051 176053 176063 176081 
-176087 176089 176123 176129 176153 176159 176161 176179 176191 176201 176207 176213 
-176221 176227 176237 176243 176261 176299 176303 176317 176321 176327 176329 176333 
-176347 176353 176357 176369 176383 176389 176401 176413 176417 176419 176431 176459 
-176461 176467 176489 176497 176503 176507 176509 176521 176531 176537 176549 176551 
-176557 176573 176591 176597 176599 176609 176611 176629 176641 176651 176677 176699 
-176711 176713 176741 176747 176753 176777 176779 176789 176791 176797 176807 176809 
-176819 176849 176857 176887 176899 176903 176921 176923 176927 176933 176951 176977 
-176983 176989 177007 177011 177013 177019 177043 177091 177101 177109 177113 177127 
-177131 177167 177173 177209 177211 177217 177223 177239 177257 177269 177283 177301 
-177319 177323 177337 177347 177379 177383 177409 177421 177427 177431 177433 177467 
-177473 177481 177487 177493 177511 177533 177539 177553 177589 177601 177623 177647 
-177677 177679 177691 177739 177743 177761 177763 177787 177791 177797 177811 177823 
-177839 177841 177883 177887 177889 177893 177907 177913 177917 177929 177943 177949 
-177953 177967 177979 178001 178021 178037 178039 178067 178069 178091 178093 178103 
-178117 178127 178141 178151 178169 178183 178187 178207 178223 178231 178247 178249 
-178259 178261 178289 178301 178307 178327 178333 178349 178351 178361 178393 178397 
-178403 178417 178439 178441 178447 178469 178481 178487 178489 178501 178513 178531 
-178537 178559 178561 178567 178571 178597 178601 178603 178609 178613 178621 178627 
-178639 178643 178681 178691 178693 178697 178753 178757 178781 178793 178799 178807 
-178813 178817 178819 178831 178853 178859 178873 178877 178889 178897 178903 178907 
-178909 178921 178931 178933 178939 178951 178973 178987 179021 179029 179033 179041 
-179051 179057 179083 179089 179099 179107 179111 179119 179143 179161 179167 179173 
-179203 179209 179213 179233 179243 179261 179269 179281 179287 179317 179321 179327 
-179351 179357 179369 179381 179383 179393 179407 179411 179429 179437 179441 179453 
-179461 179471 179479 179483 179497 179519 179527 179533 179549 179563 179573 179579 
-179581 179591 179593 179603 179623 179633 179651 179657 179659 179671 179687 179689 
-179693 179717 179719 179737 179743 179749 179779 179801 179807 179813 179819 179821 
-179827 179833 179849 179897 179899 179903 179909 179917 179923 179939 179947 179951 
-179953 179957 179969 179981 179989 179999 180001 180007 180023 180043 180053 180071 
-180073 180077 180097 180137 180161 180179 180181 180211 180221 180233 180239 180241 
-180247 180259 180263 180281 180287 180289 180307 180311 180317 180331 180337 180347 
-180361 180371 180379 180391 180413 180419 180437 180463 180473 180491 180497 180503 
-180511 180533 180539 180541 180547 180563 180569 180617 180623 180629 180647 180667 
-180679 180701 180731 180749 180751 180773 180779 180793 180797 180799 180811 180847 
-180871 180883 180907 180949 180959 181001 181003 181019 181031 181039 181061 181063 
-181081 181087 181123 181141 181157 181183 181193 181199 181201 181211 181213 181219 
-181243 181253 181273 181277 181283 181297 181301 181303 181361 181387 181397 181399 
-181409 181421 181439 181457 181459 181499 181501 181513 181523 181537 181549 181553 
-181603 181607 181609 181619 181639 181667 181669 181693 181711 181717 181721 181729 
-181739 181751 181757 181759 181763 181777 181787 181789 181813 181837 181871 181873 
-181889 181891 181903 181913 181919 181927 181931 181943 181957 181967 181981 181997 
-182009 182011 182027 182029 182041 182047 182057 182059 182089 182099 182101 182107 
-182111 182123 182129 182131 182141 182159 182167 182177 182179 182201 182209 182233 
-182239 182243 182261 182279 182297 182309 182333 182339 182341 182353 182387 182389 
-182417 182423 182431 182443 182453 182467 182471 182473 182489 182503 182509 182519 
-182537 182549 182561 182579 182587 182593 182599 182603 182617 182627 182639 182641 
-182653 182657 182659 182681 182687 182701 182711 182713 182747 182773 182779 182789 
-182803 182813 182821 182839 182851 182857 182867 182887 182893 182899 182921 182927 
-182929 182933 182953 182957 182969 182981 182999 183023 183037 183041 183047 183059 
-183067 183089 183091 183119 183151 183167 183191 183203 183247 183259 183263 183283 
-183289 183299 183301 183307 183317 183319 183329 183343 183349 183361 183373 183377 
-183383 183389 183397 183437 183439 183451 183461 183473 183479 183487 183497 183499 
-183503 183509 183511 183523 183527 183569 183571 183577 183581 183587 183593 183611 
-183637 183661 183683 183691 183697 183707 183709 183713 183761 183763 183797 183809 
-183823 183829 183871 183877 183881 183907 183917 183919 183943 183949 183959 183971 
-183973 183979 184003 184007 184013 184031 184039 184043 184057 184073 184081 184087 
-184111 184117 184133 184153 184157 184181 184187 184189 184199 184211 184231 184241 
-184259 184271 184273 184279 184291 184309 184321 184333 184337 184351 184369 184409 
-184417 184441 184447 184463 184477 184487 184489 184511 184517 184523 184553 184559 
-184567 184571 184577 184607 184609 184627 184631 184633 184649 184651 184669 184687 
-184693 184703 184711 184721 184727 184733 184753 184777 184823 184829 184831 184837 
-184843 184859 184879 184901 184903 184913 184949 184957 184967 184969 184993 184997 
-184999 185021 185027 185051 185057 185063 185069 185071 185077 185089 185099 185123 
-185131 185137 185149 185153 185161 185167 185177 185183 185189 185221 185233 185243 
-185267 185291 185299 185303 185309 185323 185327 185359 185363 185369 185371 185401 
-185429 185441 185467 185477 185483 185491 185519 185527 185531 185533 185539 185543 
-185551 185557 185567 185569 185593 185599 185621 185641 185651 185677 185681 185683 
-185693 185699 185707 185711 185723 185737 185747 185749 185753 185767 185789 185797 
-185813 185819 185821 185831 185833 185849 185869 185873 185893 185897 185903 185917 
-185923 185947 185951 185957 185959 185971 185987 185993 186007 186013 186019 186023 
-186037 186041 186049 186071 186097 186103 186107 186113 186119 186149 186157 186161 
-186163 186187 186191 186211 186227 186229 186239 186247 186253 186259 186271 186283 
-186299 186301 186311 186317 186343 186377 186379 186391 186397 186419 186437 186451 
-186469 186479 186481 186551 186569 186581 186583 186587 186601 186619 186629 186647 
-186649 186653 186671 186679 186689 186701 186707 186709 186727 186733 186743 186757 
-186761 186763 186773 186793 186799 186841 186859 186869 186871 186877 186883 186889 
-186917 186947 186959 187003 187009 187027 187043 187049 187067 187069 187073 187081 
-187091 187111 187123 187127 187129 187133 187139 187141 187163 187171 187177 187181 
-187189 187193 187211 187217 187219 187223 187237 187273 187277 187303 187337 187339 
-187349 187361 187367 187373 187379 187387 187393 187409 187417 187423 187433 187441 
-187463 187469 187471 187477 187507 187513 187531 187547 187559 187573 187597 187631 
-187633 187637 187639 187651 187661 187669 187687 187699 187711 187721 187751 187763 
-187787 187793 187823 187843 187861 187871 187877 187883 187897 187907 187909 187921 
-187927 187931 187951 187963 187973 187987 188011 188017 188021 188029 188107 188137 
-188143 188147 188159 188171 188179 188189 188197 188249 188261 188273 188281 188291 
-188299 188303 188311 188317 188323 188333 188351 188359 188369 188389 188401 188407 
-188417 188431 188437 188443 188459 188473 188483 188491 188519 188527 188533 188563 
-188579 188603 188609 188621 188633 188653 188677 188681 188687 188693 188701 188707 
-188711 188719 188729 188753 188767 188779 188791 188801 188827 188831 188833 188843 
-188857 188861 188863 188869 188891 188911 188927 188933 188939 188941 188953 188957 
-188983 188999 189011 189017 189019 189041 189043 189061 189067 189127 189139 189149 
-189151 189169 189187 189199 189223 189229 189239 189251 189253 189257 189271 189307 
-189311 189337 189347 189349 189353 189361 189377 189389 189391 189401 189407 189421 
-189433 189437 189439 189463 189467 189473 189479 189491 189493 189509 189517 189523 
-189529 189547 189559 189583 189593 189599 189613 189617 189619 189643 189653 189661 
-189671 189691 189697 189701 189713 189733 189743 189757 189767 189797 189799 189817 
-189823 189851 189853 189859 189877 189881 189887 189901 189913 189929 189947 189949 
-189961 189967 189977 189983 189989 189997 190027 190031 190051 190063 190093 190097 
-190121 190129 190147 190159 190181 190207 190243 190249 190261 190271 190283 190297 
-190301 190313 190321 190331 190339 190357 190367 190369 190387 190391 190403 190409 
-190471 190507 190523 190529 190537 190543 190573 190577 190579 190583 190591 190607 
-190613 190633 190639 190649 190657 190667 190669 190699 190709 190711 190717 190753 
-190759 190763 190769 190783 190787 190793 190807 190811 190823 190829 190837 190843 
-190871 190889 190891 190901 190909 190913 190921 190979 190997 191021 191027 191033 
-191039 191047 191057 191071 191089 191099 191119 191123 191137 191141 191143 191161 
-191173 191189 191227 191231 191237 191249 191251 191281 191297 191299 191339 191341 
-191353 191413 191441 191447 191449 191453 191459 191461 191467 191473 191491 191497 
-191507 191509 191519 191531 191533 191537 191551 191561 191563 191579 191599 191621 
-191627 191657 191669 191671 191677 191689 191693 191699 191707 191717 191747 191749 
-191773 191783 191791 191801 191803 191827 191831 191833 191837 191861 191899 191903 
-191911 191929 191953 191969 191977 191999 192007 192013 192029 192037 192043 192047 
-192053 192091 192097 192103 192113 192121 192133 192149 192161 192173 192187 192191 
-192193 192229 192233 192239 192251 192259 192263 192271 192307 192317 192319 192323 
-192341 192343 192347 192373 192377 192383 192391 192407 192431 192461 192463 192497 
-192499 192529 192539 192547 192553 192557 192571 192581 192583 192587 192601 192611 
-192613 192617 192629 192631 192637 192667 192677 192697 192737 192743 192749 192757 
-192767 192781 192791 192799 192811 192817 192833 192847 192853 192859 192877 192883 
-192887 192889 192917 192923 192931 192949 192961 192971 192977 192979 192991 193003 
-193009 193013 193031 193043 193051 193057 193073 193093 193133 193139 193147 193153 
-193163 193181 193183 193189 193201 193243 193247 193261 193283 193301 193327 193337 
-193357 193367 193373 193379 193381 193387 193393 193423 193433 193441 193447 193451 
-193463 193469 193493 193507 193513 193541 193549 193559 193573 193577 193597 193601 
-193603 193607 193619 193649 193663 193679 193703 193723 193727 193741 193751 193757 
-193763 193771 193789 193793 193799 193811 193813 193841 193847 193859 193861 193871 
-193873 193877 193883 193891 193937 193939 193943 193951 193957 193979 193993 194003 
-194017 194027 194057 194069 194071 194083 194087 194093 194101 194113 194119 194141 
-194149 194167 194179 194197 194203 194239 194263 194267 194269 194309 194323 194353 
-194371 194377 194413 194431 194443 194471 194479 194483 194507 194521 194527 194543 
-194569 194581 194591 194609 194647 194653 194659 194671 194681 194683 194687 194707 
-194713 194717 194723 194729 194749 194767 194771 194809 194813 194819 194827 194839 
-194861 194863 194867 194869 194891 194899 194911 194917 194933 194963 194977 194981 
-194989 195023 195029 195043 195047 195049 195053 195071 195077 195089 195103 195121 
-195127 195131 195137 195157 195161 195163 195193 195197 195203 195229 195241 195253 
-195259 195271 195277 195281 195311 195319 195329 195341 195343 195353 195359 195389 
-195401 195407 195413 195427 195443 195457 195469 195479 195493 195497 195511 195527 
-195539 195541 195581 195593 195599 195659 195677 195691 195697 195709 195731 195733 
-195737 195739 195743 195751 195761 195781 195787 195791 195809 195817 195863 195869 
-195883 195887 195893 195907 195913 195919 195929 195931 195967 195971 195973 195977 
-195991 195997 196003 196033 196039 196043 196051 196073 196081 196087 196111 196117 
-196139 196159 196169 196171 196177 196181 196187 196193 196201 196247 196271 196277 
-196279 196291 196303 196307 196331 196337 196379 196387 196429 196439 196453 196459 
-196477 196499 196501 196519 196523 196541 196543 196549 196561 196579 196583 196597 
-196613 196643 196657 196661 196663 196681 196687 196699 196709 196717 196727 196739 
-196751 196769 196771 196799 196817 196831 196837 196853 196871 196873 196879 196901 
-196907 196919 196927 196961 196991 196993 197003 197009 197023 197033 197059 197063 
-197077 197083 197089 197101 197117 197123 197137 197147 197159 197161 197203 197207 
-197221 197233 197243 197257 197261 197269 197273 197279 197293 197297 197299 197311 
-197339 197341 197347 197359 197369 197371 197381 197383 197389 197419 197423 197441 
-197453 197479 197507 197521 197539 197551 197567 197569 197573 197597 197599 197609 
-197621 197641 197647 197651 197677 197683 197689 197699 197711 197713 197741 197753 
-197759 197767 197773 197779 197803 197807 197831 197837 197887 197891 197893 197909 
-197921 197927 197933 197947 197957 197959 197963 197969 197971 198013 198017 198031 
-198043 198047 198073 198083 198091 198097 198109 198127 198139 198173 198179 198193 
-198197 198221 198223 198241 198251 198257 198259 198277 198281 198301 198313 198323 
-198337 198347 198349 198377 198391 198397 198409 198413 198427 198437 198439 198461 
-198463 198469 198479 198491 198503 198529 198533 198553 198571 198589 198593 198599 
-198613 198623 198637 198641 198647 198659 198673 198689 198701 198719 198733 198761 
-198769 198811 198817 198823 198827 198829 198833 198839 198841 198851 198859 198899 
-198901 198929 198937 198941 198943 198953 198959 198967 198971 198977 198997 199021 
-199033 199037 199039 199049 199081 199103 199109 199151 199153 199181 199193 199207 
-199211 199247 199261 199267 199289 199313 199321 199337 199343 199357 199373 199379 
-199399 199403 199411 199417 199429 199447 199453 199457 199483 199487 199489 199499 
-199501 199523 199559 199567 199583 199601 199603 199621 199637 199657 199669 199673 
-199679 199687 199697 199721 199729 199739 199741 199751 199753 199777 199783 199799 
-199807 199811 199813 199819 199831 199853 199873 199877 199889 199909 199921 199931 
-199933 199961 199967 199999 200003 200009 200017 200023 200029 200033 200041 200063 
-200087 200117 200131 200153 200159 200171 200177 200183 200191 200201 200227 200231 
-200237 200257 200273 200293 200297 200323 200329 200341 200351 200357 200363 200371 
-200381 200383 200401 200407 200437 200443 200461 200467 200483 200513 200569 200573 
-200579 200587 200591 200597 200609 200639 200657 200671 200689 200699 200713 200723 
-200731 200771 200779 200789 200797 200807 200843 200861 200867 200869 200881 200891 
-200899 200903 200909 200927 200929 200971 200983 200987 200989 201007 201011 201031 
-201037 201049 201073 201101 201107 201119 201121 201139 201151 201163 201167 201193 
-201203 201209 201211 201233 201247 201251 201281 201287 201307 201329 201337 201359 
-201389 201401 201403 201413 201437 201449 201451 201473 201491 201493 201497 201499 
-201511 201517 201547 201557 201577 201581 201589 201599 201611 201623 201629 201653 
-201661 201667 201673 201683 201701 201709 201731 201743 201757 201767 201769 201781 
-201787 201791 201797 201809 201821 201823 201827 201829 201833 201847 201881 201889 
-201893 201907 201911 201919 201923 201937 201947 201953 201961 201973 201979 201997 
-202001 202021 202031 202049 202061 202063 202067 202087 202099 202109 202121 202127 
-202129 202183 202187 202201 202219 202231 202243 202277 202289 202291 202309 202327 
-202339 202343 202357 202361 202381 202387 202393 202403 202409 202441 202471 202481 
-202493 202519 202529 202549 202567 202577 202591 202613 202621 202627 202637 202639 
-202661 202667 202679 202693 202717 202729 202733 202747 202751 202753 202757 202777 
-202799 202817 202823 202841 202859 202877 202879 202889 202907 202921 202931 202933 
-202949 202967 202973 202981 202987 202999 203011 203017 203023 203039 203051 203057 
-203117 203141 203173 203183 203207 203209 203213 203221 203227 203233 203249 203279 
-203293 203309 203311 203317 203321 203323 203339 203341 203351 203353 203363 203381 
-203383 203387 203393 203417 203419 203429 203431 203449 203459 203461 203531 203549 
-203563 203569 203579 203591 203617 203627 203641 203653 203657 203659 203663 203669 
-203713 203761 203767 203771 203773 203789 203807 203809 203821 203843 203857 203869 
-203873 203897 203909 203911 203921 203947 203953 203969 203971 203977 203989 203999 
-204007 204013 204019 204023 204047 204059 204067 204101 204107 204133 204137 204143 
-204151 204161 204163 204173 204233 204251 204299 204301 204311 204319 204329 204331 
-204353 204359 204361 204367 204371 204377 204397 204427 204431 204437 204439 204443 
-204461 204481 204487 204509 204511 204517 204521 204557 204563 204583 204587 204599 
-204601 204613 204623 204641 204667 204679 204707 204719 204733 204749 204751 204781 
-204791 204793 204797 204803 204821 204857 204859 204871 204887 204913 204917 204923 
-204931 204947 204973 204979 204983 205019 205031 205033 205043 205063 205069 205081 
-205097 205103 205111 205129 205133 205141 205151 205157 205171 205187 205201 205211 
-205213 205223 205237 205253 205267 205297 205307 205319 205327 205339 205357 205391 
-205397 205399 205417 205421 205423 205427 205433 205441 205453 205463 205477 205483 
-205487 205493 205507 205519 205529 205537 205549 205553 205559 205589 205603 205607 
-205619 205627 205633 205651 205657 205661 205663 205703 205721 205759 205763 205783 
-205817 205823 205837 205847 205879 205883 205913 205937 205949 205951 205957 205963 
-205967 205981 205991 205993 206009 206021 206027 206033 206039 206047 206051 206069 
-206077 206081 206083 206123 206153 206177 206179 206183 206191 206197 206203 206209 
-206221 206233 206237 206249 206251 206263 206273 206279 206281 206291 206299 206303 
-206341 206347 206351 206369 206383 206399 206407 206411 206413 206419 206447 206461 
-206467 206477 206483 206489 206501 206519 206527 206543 206551 206593 206597 206603 
-206623 206627 206639 206641 206651 206699 206749 206779 206783 206803 206807 206813 
-206819 206821 206827 206879 206887 206897 206909 206911 206917 206923 206933 206939 
-206951 206953 206993 207013 207017 207029 207037 207041 207061 207073 207079 207113 
-207121 207127 207139 207169 207187 207191 207197 207199 207227 207239 207241 207257 
-207269 207287 207293 207301 207307 207329 207331 207341 207343 207367 207371 207377 
-207401 207409 207433 207443 207457 207463 207469 207479 207481 207491 207497 207509 
-207511 207517 207521 207523 207541 207547 207551 207563 207569 207589 207593 207619 
-207629 207643 207653 207661 207671 207673 207679 207709 207719 207721 207743 207763 
-207769 207797 207799 207811 207821 207833 207847 207869 207877 207923 207931 207941 
-207947 207953 207967 207971 207973 207997 208001 208003 208009 208037 208049 208057 
-208067 208073 208099 208111 208121 208129 208139 208141 208147 208189 208207 208213 
-208217 208223 208231 208253 208261 208277 208279 208283 208291 208309 208319 208333 
-208337 208367 208379 208387 208391 208393 208409 208433 208441 208457 208459 208463 
-208469 208489 208493 208499 208501 208511 208513 208519 208529 208553 208577 208589 
-208591 208609 208627 208631 208657 208667 208673 208687 208697 208699 208721 208729 
-208739 208759 208787 208799 208807 208837 208843 208877 208889 208891 208907 208927 
-208931 208933 208961 208963 208991 208993 208997 209021 209029 209039 209063 209071 
-209089 209123 209147 209159 209173 209179 209189 209201 209203 209213 209221 209227 
-209233 209249 209257 209263 209267 209269 209299 209311 209317 209327 209333 209347 
-209353 209357 209359 209371 209381 209393 209401 209431 209441 209449 209459 209471 
-209477 209497 209519 209533 209543 209549 209563 209567 209569 209579 209581 209597 
-209621 209623 209639 209647 209659 209669 209687 209701 209707 209717 209719 209743 
-209767 209771 209789 209801 209809 209813 209819 209821 209837 209851 209857 209861 
-209887 209917 209927 209929 209939 209953 209959 209971 209977 209983 209987 210011 
-210019 210031 210037 210053 210071 210097 210101 210109 210113 210127 210131 210139 
-210143 210157 210169 210173 210187 210191 210193 210209 210229 210233 210241 210247 
-210257 210263 210277 210283 210299 210317 210319 210323 210347 210359 210361 210391 
-210401 210403 210407 210421 210437 210461 210467 210481 210487 210491 210499 210523 
-210527 210533 210557 210599 210601 210619 210631 210643 210659 210671 210709 210713 
-210719 210731 210739 210761 210773 210803 210809 210811 210823 210827 210839 210853 
-210857 210869 210901 210907 210911 210913 210923 210929 210943 210961 210967 211007 
-211039 211049 211051 211061 211063 211067 211073 211093 211097 211129 211151 211153 
-211177 211187 211193 211199 211213 211217 211219 211229 211231 211241 211247 211271 
-211283 211291 211297 211313 211319 211333 211339 211349 211369 211373 211403 211427 
-211433 211441 211457 211469 211493 211499 211501 211507 211543 211559 211571 211573 
-211583 211597 211619 211639 211643 211657 211661 211663 211681 211691 211693 211711 
-211723 211727 211741 211747 211777 211781 211789 211801 211811 211817 211859 211867 
-211873 211877 211879 211889 211891 211927 211931 211933 211943 211949 211969 211979 
-211997 212029 212039 212057 212081 212099 212117 212123 212131 212141 212161 212167 
-212183 212203 212207 212209 212227 212239 212243 212281 212293 212297 212353 212369 
-212383 212411 212419 212423 212437 212447 212453 212461 212467 212479 212501 212507 
-212557 212561 212573 212579 212587 212593 212627 212633 212651 212669 212671 212677 
-212683 212701 212777 212791 212801 212827 212837 212843 212851 212867 212869 212873 
-212881 212897 212903 212909 212917 212923 212969 212981 212987 212999 213019 213023 
-213029 213043 213067 213079 213091 213097 213119 213131 213133 213139 213149 213173 
-213181 213193 213203 213209 213217 213223 213229 213247 213253 213263 213281 213287 
-213289 213307 213319 213329 213337 213349 213359 213361 213383 213391 213397 213407 
-213449 213461 213467 213481 213491 213523 213533 213539 213553 213557 213589 213599 
-213611 213613 213623 213637 213641 213649 213659 213713 213721 213727 213737 213751 
-213791 213799 213821 213827 213833 213847 213859 213881 213887 213901 213919 213929 
-213943 213947 213949 213953 213973 213977 213989 214003 214007 214009 214021 214031 
-214033 214043 214051 214063 214069 214087 214091 214129 214133 214141 214147 214163 
-214177 214189 214211 214213 214219 214237 214243 214259 214283 214297 214309 214351 
-214363 214373 214381 214391 214399 214433 214439 214451 214457 214463 214469 214481 
-214483 214499 214507 214517 214519 214531 214541 214559 214561 214589 214603 214607 
-214631 214639 214651 214657 214663 214667 214673 214691 214723 214729 214733 214741 
-214759 214763 214771 214783 214787 214789 214807 214811 214817 214831 214849 214853 
-214867 214883 214891 214913 214939 214943 214967 214987 214993 215051 215063 215077 
-215087 215123 215141 215143 215153 215161 215179 215183 215191 215197 215239 215249 
-215261 215273 215279 215297 215309 215317 215329 215351 215353 215359 215381 215389 
-215393 215399 215417 215443 215447 215459 215461 215471 215483 215497 215503 215507 
-215521 215531 215563 215573 215587 215617 215653 215659 215681 215687 215689 215693 
-215723 215737 215753 215767 215771 215797 215801 215827 215833 215843 215851 215857 
-215863 215893 215899 215909 215921 215927 215939 215953 215959 215981 215983 216023 
-216037 216061 216071 216091 216103 216107 216113 216119 216127 216133 216149 216157 
-216173 216179 216211 216217 216233 216259 216263 216289 216317 216319 216329 216347 
-216371 216373 216379 216397 216401 216421 216431 216451 216481 216493 216509 216523 
-216551 216553 216569 216571 216577 216607 216617 216641 216647 216649 216653 216661 
-216679 216703 216719 216731 216743 216751 216757 216761 216779 216781 216787 216791 
-216803 216829 216841 216851 216859 216877 216899 216901 216911 216917 216919 216947 
-216967 216973 216991 217001 217003 217027 217033 217057 217069 217081 217111 217117 
-217121 217157 217163 217169 217199 217201 217207 217219 217223 217229 217241 217253 
-217271 217307 217309 217313 217319 217333 217337 217339 217351 217361 217363 217367 
-217369 217387 217397 217409 217411 217421 217429 217439 217457 217463 217489 217499 
-217517 217519 217559 217561 217573 217577 217579 217619 217643 217661 217667 217681 
-217687 217691 217697 217717 217727 217733 217739 217747 217771 217781 217793 217823 
-217829 217849 217859 217901 217907 217909 217933 217937 217969 217979 217981 218003 
-218021 218047 218069 218077 218081 218083 218087 218107 218111 218117 218131 218137 
-218143 218149 218171 218191 218213 218227 218233 218249 218279 218287 218357 218363 
-218371 218381 218389 218401 218417 218419 218423 218437 218447 218453 218459 218461 
-218479 218509 218513 218521 218527 218531 218549 218551 218579 218591 218599 218611 
-218623 218627 218629 218641 218651 218657 218677 218681 218711 218717 218719 218723 
-218737 218749 218761 218783 218797 218809 218819 218833 218839 218843 218849 218857 
-218873 218887 218923 218941 218947 218963 218969 218971 218987 218989 218993 219001 
-219017 219019 219031 219041 219053 219059 219071 219083 219091 219097 219103 219119 
-219133 219143 219169 219187 219217 219223 219251 219277 219281 219293 219301 219311 
-219313 219353 219361 219371 219377 219389 219407 219409 219433 219437 219451 219463 
-219467 219491 219503 219517 219523 219529 219533 219547 219577 219587 219599 219607 
-219613 219619 219629 219647 219649 219677 219679 219683 219689 219707 219721 219727 
-219731 219749 219757 219761 219763 219767 219787 219797 219799 219809 219823 219829 
-219839 219847 219851 219871 219881 219889 219911 219917 219931 219937 219941 219943 
-219953 219959 219971 219977 219979 219983 220009 220013 220019 220021 220057 220063 
-220123 220141 220147 220151 220163 220169 220177 220189 220217 220243 220279 220291 
-220301 220307 220327 220333 220351 220357 220361 220369 220373 220391 220399 220403 
-220411 220421 220447 220469 220471 220511 220513 220529 220537 220543 220553 220559 
-220573 220579 220589 220613 220663 220667 220673 220681 220687 220699 220709 220721 
-220747 220757 220771 220783 220789 220793 220807 220811 220841 220859 220861 220873 
-220877 220879 220889 220897 220901 220903 220907 220919 220931 220933 220939 220973 
-221021 221047 221059 221069 221071 221077 221083 221087 221093 221101 221159 221171 
-221173 221197 221201 221203 221209 221219 221227 221233 221239 221251 221261 221281 
-221303 221311 221317 221327 221393 221399 221401 221411 221413 221447 221453 221461 
-221471 221477 221489 221497 221509 221537 221539 221549 221567 221581 221587 221603 
-221621 221623 221653 221657 221659 221671 221677 221707 221713 221717 221719 221723 
-221729 221737 221747 221773 221797 221807 221813 221827 221831 221849 221873 221891 
-221909 221941 221951 221953 221957 221987 221989 221999 222007 222011 222023 222029 
-222041 222043 222059 222067 222073 222107 222109 222113 222127 222137 222149 222151 
-222161 222163 222193 222197 222199 222247 222269 222289 222293 222311 222317 222323 
-222329 222337 222347 222349 222361 222367 222379 222389 222403 222419 222437 222461 
-222493 222499 222511 222527 222533 222553 222557 222587 222601 222613 222619 222643 
-222647 222659 222679 222707 222713 222731 222773 222779 222787 222791 222793 222799 
-222823 222839 222841 222857 222863 222877 222883 222913 222919 222931 222941 222947 
-222953 222967 222977 222979 222991 223007 223009 223019 223037 223049 223051 223061 
-223063 223087 223099 223103 223129 223133 223151 223207 223211 223217 223219 223229 
-223241 223243 223247 223253 223259 223273 223277 223283 223291 223303 223313 223319 
-223331 223337 223339 223361 223367 223381 223403 223423 223429 223439 223441 223463 
-223469 223481 223493 223507 223529 223543 223547 223549 223577 223589 223621 223633 
-223637 223667 223679 223681 223697 223711 223747 223753 223757 223759 223781 223823 
-223829 223831 223837 223841 223843 223849 223903 223919 223921 223939 223963 223969 
-223999 224011 224027 224033 224041 224047 224057 224069 224071 224101 224113 224129 
-224131 224149 224153 224171 224177 224197 224201 224209 224221 224233 224239 224251 
-224261 224267 224291 224299 224303 224309 224317 224327 224351 224359 224363 224401 
-224423 224429 224443 224449 224461 224467 224473 224491 224501 224513 224527 224563 
-224569 224579 224591 224603 224611 224617 224629 224633 224669 224677 224683 224699 
-224711 224717 224729 224737 224743 224759 224771 224797 224813 224831 224863 224869 
-224881 224891 224897 224909 224911 224921 224929 224947 224951 224969 224977 224993 
-225023 225037 225061 225067 225077 225079 225089 225109 225119 225133 225143 225149 
-225157 225161 225163 225167 225217 225221 225223 225227 225241 225257 225263 225287 
-225289 225299 225307 225341 225343 225347 225349 225353 225371 225373 225383 225427 
-225431 225457 225461 225479 225493 225499 225503 225509 225523 225527 225529 225569 
-225581 225583 225601 225611 225613 225619 225629 225637 225671 225683 225689 225697 
-225721 225733 225749 225751 225767 225769 225779 225781 225809 225821 225829 225839 
-225859 225871 225889 225919 225931 225941 225943 225949 225961 225977 225983 225989 
-226001 226007 226013 226027 226063 226087 226099 226103 226123 226129 226133 226141 
-226169 226183 226189 226199 226201 226217 226231 226241 226267 226283 226307 226313 
-226337 226357 226367 226379 226381 226397 226409 226427 226433 226451 226453 226463 
-226483 226487 226511 226531 226547 226549 226553 226571 226601 226609 226621 226631 
-226637 226643 226649 226657 226663 226669 226691 226697 226741 226753 226769 226777 
-226783 226789 226799 226813 226817 226819 226823 226843 226871 226901 226903 226907 
-226913 226937 226943 226991 227011 227027 227053 227081 227089 227093 227111 227113 
-227131 227147 227153 227159 227167 227177 227189 227191 227207 227219 227231 227233 
-227251 227257 227267 227281 227299 227303 227363 227371 227377 227387 227393 227399 
-227407 227419 227431 227453 227459 227467 227471 227473 227489 227497 227501 227519 
-227531 227533 227537 227561 227567 227569 227581 227593 227597 227603 227609 227611 
-227627 227629 227651 227653 227663 227671 227693 227699 227707 227719 227729 227743 
-227789 227797 227827 227849 227869 227873 227893 227947 227951 227977 227989 227993 
-228013 228023 228049 228061 228077 228097 228103 228113 228127 228131 228139 228181 
-228197 228199 228203 228211 228223 228233 228251 228257 228281 228299 228301 228307 
-228311 228331 228337 228341 228353 228359 228383 228409 228419 228421 228427 228443 
-228451 228457 228461 228469 228479 228509 228511 228517 228521 228523 228539 228559 
-228577 228581 228587 228593 228601 228611 228617 228619 228637 228647 228677 228707 
-228713 228731 228733 228737 228751 228757 228773 228793 228797 228799 228829 228841 
-228847 228853 228859 228869 228881 228883 228887 228901 228911 228913 228923 228929 
-228953 228959 228961 228983 228989 229003 229027 229037 229081 229093 229123 229127 
-229133 229139 229153 229157 229171 229181 229189 229199 229213 229217 229223 229237 
-229247 229249 229253 229261 229267 229283 229309 229321 229343 229351 229373 229393 
-229399 229403 229409 229423 229433 229459 229469 229487 229499 229507 229519 229529 
-229547 229549 229553 229561 229583 229589 229591 229601 229613 229627 229631 229637 
-229639 229681 229693 229699 229703 229711 229717 229727 229739 229751 229753 229759 
-229763 229769 229771 229777 229781 229799 229813 229819 229837 229841 229847 229849 
-229897 229903 229937 229939 229949 229961 229963 229979 229981 230003 230017 230047 
-230059 230063 230077 230081 230089 230101 230107 230117 230123 230137 230143 230149 
-230189 230203 230213 230221 230227 230233 230239 230257 230273 230281 230291 230303 
-230309 230311 230327 230339 230341 230353 230357 230369 230383 230387 230389 230393 
-230431 230449 230453 230467 230471 230479 230501 230507 230539 230551 230561 230563 
-230567 230597 230611 230647 230653 230663 230683 230693 230719 230729 230743 230761 
-230767 230771 230773 230779 230807 230819 230827 230833 230849 230861 230863 230873 
-230891 230929 230933 230939 230941 230959 230969 230977 230999 231001 231017 231019 
-231031 231041 231053 231067 231079 231107 231109 231131 231169 231197 231223 231241 
-231269 231271 231277 231289 231293 231299 231317 231323 231331 231347 231349 231359 
-231367 231379 231409 231419 231431 231433 231443 231461 231463 231479 231481 231493 
-231503 231529 231533 231547 231551 231559 231563 231571 231589 231599 231607 231611 
-231613 231631 231643 231661 231677 231701 231709 231719 231779 231799 231809 231821 
-231823 231827 231839 231841 231859 231871 231877 231893 231901 231919 231923 231943 
-231947 231961 231967 232003 232007 232013 232049 232051 232073 232079 232081 232091 
-232103 232109 232117 232129 232153 232171 232187 232189 232207 232217 232259 232303 
-232307 232333 232357 232363 232367 232381 232391 232409 232411 232417 232433 232439 
-232451 232457 232459 232487 232499 232513 232523 232549 232567 232571 232591 232597 
-232607 232621 232633 232643 232663 232669 232681 232699 232709 232711 232741 232751 
-232753 232777 232801 232811 232819 232823 232847 232853 232861 232871 232877 232891 
-232901 232907 232919 232937 232961 232963 232987 233021 233069 233071 233083 233113 
-233117 233141 233143 233159 233161 233173 233183 233201 233221 233231 233239 233251 
-233267 233279 233293 233297 233323 233327 233329 233341 233347 233353 233357 233371 
-233407 233417 233419 233423 233437 233477 233489 233509 233549 233551 233557 233591 
-233599 233609 233617 233621 233641 233663 233669 233683 233687 233689 233693 233713 
-233743 233747 233759 233777 233837 233851 233861 233879 233881 233911 233917 233921 
-233923 233939 233941 233969 233983 233993 234007 234029 234043 234067 234083 234089 
-234103 234121 234131 234139 234149 234161 234167 234181 234187 234191 234193 234197 
-234203 234211 234217 234239 234259 234271 234281 234287 234293 234317 234319 234323 
-234331 234341 234343 234361 234383 234431 234457 234461 234463 234467 234473 234499 
-234511 234527 234529 234539 234541 234547 234571 234587 234589 234599 234613 234629 
-234653 234659 234673 234683 234713 234721 234727 234733 234743 234749 234769 234781 
-234791 234799 234803 234809 234811 234833 234847 234851 234863 234869 234893 234907 
-234917 234931 234947 234959 234961 234967 234977 234979 234989 235003 235007 235009 
-235013 235043 235051 235057 235069 235091 235099 235111 235117 235159 235171 235177 
-235181 235199 235211 235231 235241 235243 235273 235289 235307 235309 235337 235349 
-235369 235397 235439 235441 235447 235483 235489 235493 235513 235519 235523 235537 
-235541 235553 235559 235577 235591 235601 235607 235621 235661 235663 235673 235679 
-235699 235723 235747 235751 235783 235787 235789 235793 235811 235813 235849 235871 
-235877 235889 235891 235901 235919 235927 235951 235967 235979 235997 236017 236021 
-236053 236063 236069 236077 236087 236107 236111 236129 236143 236153 236167 236207 
-236209 236219 236231 236261 236287 236293 236297 236323 236329 236333 236339 236377 
-236381 236387 236399 236407 236429 236449 236461 236471 236477 236479 236503 236507 
-236519 236527 236549 236563 236573 236609 236627 236641 236653 236659 236681 236699 
-236701 236707 236713 236723 236729 236737 236749 236771 236773 236779 236783 236807 
-236813 236867 236869 236879 236881 236891 236893 236897 236909 236917 236947 236981 
-236983 236993 237011 237019 237043 237053 237067 237071 237073 237089 237091 237137 
-237143 237151 237157 237161 237163 237173 237179 237203 237217 237233 237257 237271 
-237277 237283 237287 237301 237313 237319 237331 237343 237361 237373 237379 237401 
-237409 237467 237487 237509 237547 237563 237571 237581 237607 237619 237631 237673 
-237683 237689 237691 237701 237707 237733 237737 237749 237763 237767 237781 237791 
-237821 237851 237857 237859 237877 237883 237901 237911 237929 237959 237967 237971 
-237973 237977 237997 238001 238009 238019 238031 238037 238039 238079 238081 238093 
-238099 238103 238109 238141 238151 238157 238159 238163 238171 238181 238201 238207 
-238213 238223 238229 238237 238247 238261 238267 238291 238307 238313 238321 238331 
-238339 238361 238363 238369 238373 238397 238417 238423 238439 238451 238463 238471 
-238477 238481 238499 238519 238529 238531 238547 238573 238591 238627 238639 238649 
-238657 238673 238681 238691 238703 238709 238723 238727 238729 238747 238759 238781 
-238789 238801 238829 238837 238841 238853 238859 238877 238879 238883 238897 238919 
-238921 238939 238943 238949 238967 238991 239017 239023 239027 239053 239069 239081 
-239087 239119 239137 239147 239167 239171 239179 239201 239231 239233 239237 239243 
-239251 239263 239273 239287 239297 239329 239333 239347 239357 239383 239387 239389 
-239417 239423 239429 239431 239441 239461 239489 239509 239521 239527 239531 239539 
-239543 239557 239567 239579 239587 239597 239611 239623 239633 239641 239671 239689 
-239699 239711 239713 239731 239737 239753 239779 239783 239803 239807 239831 239843 
-239849 239851 239857 239873 239879 239893 239929 239933 239947 239957 239963 239977 
-239999 240007 240011 240017 240041 240043 240047 240049 240059 240073 240089 240101 
-240109 240113 240131 240139 240151 240169 240173 240197 240203 240209 240257 240259 
-240263 240271 240283 240287 240319 240341 240347 240349 240353 240371 240379 240421 
-240433 240437 240473 240479 240491 240503 240509 240517 240551 240571 240587 240589 
-240599 240607 240623 240631 240641 240659 240677 240701 240707 240719 240727 240733 
-240739 240743 240763 240769 240797 240811 240829 240841 240853 240859 240869 240881 
-240883 240893 240899 240913 240943 240953 240959 240967 240997 241013 241027 241037 
-241049 241051 241061 241067 241069 241079 241093 241117 241127 241141 241169 241177 
-241183 241207 241229 241249 241253 241259 241261 241271 241291 241303 241313 241321 
-241327 241333 241337 241343 241361 241363 241391 241393 241421 241429 241441 241453 
-241463 241469 241489 241511 241513 241517 241537 241543 241559 241561 241567 241589 
-241597 241601 241603 241639 241643 241651 241663 241667 241679 241687 241691 241711 
-241727 241739 241771 241781 241783 241793 241807 241811 241817 241823 241847 241861 
-241867 241873 241877 241883 241903 241907 241919 241921 241931 241939 241951 241963 
-241973 241979 241981 241993 242009 242057 242059 242069 242083 242093 242101 242119 
-242129 242147 242161 242171 242173 242197 242201 242227 242243 242257 242261 242273 
-242279 242309 242329 242357 242371 242377 242393 242399 242413 242419 242441 242447 
-242449 242453 242467 242479 242483 242491 242509 242519 242521 242533 242551 242591 
-242603 242617 242621 242629 242633 242639 242647 242659 242677 242681 242689 242713 
-242729 242731 242747 242773 242779 242789 242797 242807 242813 242819 242863 242867 
-242873 242887 242911 242923 242927 242971 242989 242999 243011 243031 243073 243077 
-243091 243101 243109 243119 243121 243137 243149 243157 243161 243167 243197 243203 
-243209 243227 243233 243239 243259 243263 243301 243311 243343 243367 243391 243401 
-243403 243421 243431 243433 243437 243461 243469 243473 243479 243487 243517 243521 
-243527 243533 243539 243553 243577 243583 243587 243589 243613 243623 243631 243643 
-243647 243671 243673 243701 243703 243707 243709 243769 243781 243787 243799 243809 
-243829 243839 243851 243857 243863 243871 243889 243911 243917 243931 243953 243973 
-243989 244003 244009 244021 244033 244043 244087 244091 244109 244121 244129 244141 
-244147 244157 244159 244177 244199 244217 244219 244243 244247 244253 244261 244291 
-244297 244301 244303 244313 244333 244339 244351 244357 244367 244379 244381 244393 
-244399 244403 244411 244423 244429 244451 244457 244463 244471 244481 244493 244507 
-244529 244547 244553 244561 244567 244583 244589 244597 244603 244619 244633 244637 
-244639 244667 244669 244687 244691 244703 244711 244721 244733 244747 244753 244759 
-244781 244787 244813 244837 244841 244843 244859 244861 244873 244877 244889 244897 
-244901 244939 244943 244957 244997 245023 245029 245033 245039 245071 245083 245087 
-245107 245129 245131 245149 245171 245173 245177 245183 245209 245251 245257 245261 
-245269 245279 245291 245299 245317 245321 245339 245383 245389 245407 245411 245417 
-245419 245437 245471 245473 245477 245501 245513 245519 245521 245527 245533 245561 
-245563 245587 245591 245593 245621 245627 245629 245639 245653 245671 245681 245683 
-245711 245719 245723 245741 245747 245753 245759 245771 245783 245789 245821 245849 
-245851 245863 245881 245897 245899 245909 245911 245941 245963 245977 245981 245983 
-245989 246011 246017 246049 246073 246097 246119 246121 246131 246133 246151 246167 
-246173 246187 246193 246203 246209 246217 246223 246241 246247 246251 246271 246277 
-246289 246317 246319 246329 246343 246349 246361 246371 246391 246403 246439 246469 
-246473 246497 246509 246511 246523 246527 246539 246557 246569 246577 246599 246607 
-246611 246613 246637 246641 246643 246661 246683 246689 246707 246709 246713 246731 
-246739 246769 246773 246781 246787 246793 246803 246809 246811 246817 246833 246839 
-246889 246899 246907 246913 246919 246923 246929 246931 246937 246941 246947 246971 
-246979 247001 247007 247031 247067 247069 247073 247087 247099 247141 247183 247193 
-247201 247223 247229 247241 247249 247259 247279 247301 247309 247337 247339 247343 
-247363 247369 247381 247391 247393 247409 247421 247433 247439 247451 247463 247501 
-247519 247529 247531 247547 247553 247579 247591 247601 247603 247607 247609 247613 
-247633 247649 247651 247691 247693 247697 247711 247717 247729 247739 247759 247769 
-247771 247781 247799 247811 247813 247829 247847 247853 247873 247879 247889 247901 
-247913 247939 247943 247957 247991 247993 247997 247999 248021 248033 248041 248051 
-248057 248063 248071 248077 248089 248099 248117 248119 248137 248141 248161 248167 
-248177 248179 248189 248201 248203 248231 248243 248257 248267 248291 248293 248299 
-248309 248317 248323 248351 248357 248371 248389 248401 248407 248431 248441 248447 
-248461 248473 248477 248483 248509 248533 248537 248543 248569 248579 248587 248593 
-248597 248609 248621 248627 248639 248641 248657 248683 248701 248707 248719 248723 
-248737 248749 248753 248779 248783 248789 248797 248813 248821 248827 248839 248851 
-248861 248867 248869 248879 248887 248891 248893 248903 248909 248971 248981 248987 
-249017 249037 249059 249079 249089 249097 249103 249107 249127 249131 249133 249143 
-249181 249187 249199 249211 249217 249229 249233 249253 249257 249287 249311 249317 
-249329 249341 249367 249377 249383 249397 249419 249421 249427 249433 249437 249439 
-249449 249463 249497 249499 249503 249517 249521 249533 249539 249541 249563 249583 
-249589 249593 249607 249647 249659 249671 249677 249703 249721 249727 249737 249749 
-249763 249779 249797 249811 249827 249833 249853 249857 249859 249863 249871 249881 
-249911 249923 249943 249947 249967 249971 249973 249989 250007 250013 250027 250031 
-250037 250043 250049 250051 250057 250073 250091 250109 250123 250147 250153 250169 
-250199 250253 250259 250267 250279 250301 250307 250343 250361 250403 250409 250423 
-250433 250441 250451 250489 250499 250501 250543 250583 250619 250643 250673 250681 
-250687 250693 250703 250709 250721 250727 250739 250741 250751 250753 250777 250787 
-250793 250799 250807 250813 250829 250837 250841 250853 250867 250871 250889 250919 
-250949 250951 250963 250967 250969 250979 250993 251003 251033 251051 251057 251059 
-251063 251071 251081 251087 251099 251117 251143 251149 251159 251171 251177 251179 
-251191 251197 251201 251203 251219 251221 251231 251233 251257 251261 251263 251287 
-251291 251297 251323 251347 251353 251359 251387 251393 251417 251429 251431 251437 
-251443 251467 251473 251477 251483 251491 251501 251513 251519 251527 251533 251539 
-251543 251561 251567 251609 251611 251621 251623 251639 251653 251663 251677 251701 
-251707 251737 251761 251789 251791 251809 251831 251833 251843 251857 251861 251879 
-251887 251893 251897 251903 251917 251939 251941 251947 251969 251971 251983 252001 
-252013 252017 252029 252037 252079 252101 252139 252143 252151 252157 252163 252169 
-252173 252181 252193 252209 252223 252233 252253 252277 252283 252289 252293 252313 
-252319 252323 252341 252359 252383 252391 252401 252409 252419 252431 252443 252449 
-252457 252463 252481 252509 252533 252541 252559 252583 252589 252607 252611 252617 
-252641 252667 252691 252709 252713 252727 252731 252737 252761 252767 252779 252817 
-252823 252827 252829 252869 252877 252881 252887 252893 252899 252911 252913 252919 
-252937 252949 252971 252979 252983 253003 253013 253049 253063 253081 253103 253109 
-253133 253153 253157 253159 253229 253243 253247 253273 253307 253321 253343 253349 
-253361 253367 253369 253381 253387 253417 253423 253427 253433 253439 253447 253469 
-253481 253493 253501 253507 253531 253537 253543 253553 253567 253573 253601 253607 
-253609 253613 253633 253637 253639 253651 253661 253679 253681 253703 253717 253733 
-253741 253751 253763 253769 253777 253787 253789 253801 253811 253819 253823 253853 
-253867 253871 253879 253901 253907 253909 253919 253937 253949 253951 253969 253987 
-253993 253999 254003 254021 254027 254039 254041 254047 254053 254071 254083 254119 
-254141 254147 254161 254179 254197 254207 254209 254213 254249 254257 254279 254281 
-254291 254299 254329 254369 254377 254383 254389 254407 254413 254437 254447 254461 
-254489 254491 254519 254537 254557 254593 254623 254627 254647 254659 254663 254699 
-254713 254729 254731 254741 254747 254753 254773 254777 254783 254791 254803 254827 
-254831 254833 254857 254869 254873 254879 254887 254899 254911 254927 254929 254941 
-254959 254963 254971 254977 254987 254993 255007 255019 255023 255043 255049 255053 
-255071 255077 255083 255097 255107 255121 255127 255133 255137 255149 255173 255179 
-255181 255191 255193 255197 255209 255217 255239 255247 255251 255253 255259 255313 
-255329 255349 255361 255371 255383 255413 255419 255443 255457 255467 255469 255473 
-255487 255499 255503 255511 255517 255523 255551 255571 255587 255589 255613 255617 
-255637 255641 255649 255653 255659 255667 255679 255709 255713 255733 255743 255757 
-255763 255767 255803 255839 255841 255847 255851 255859 255869 255877 255887 255907 
-255917 255919 255923 255947 255961 255971 255973 255977 255989 256019 256021 256031 
-256033 256049 256057 256079 256093 256117 256121 256129 256133 256147 256163 256169 
-256181 256187 256189 256199 256211 256219 256279 256301 256307 256313 256337 256349 
-256363 256369 256391 256393 256423 256441 256469 256471 256483 256489 256493 256499 
-256517 256541 256561 256567 256577 256579 256589 256603 256609 256639 256643 256651 
-256661 256687 256699 256721 256723 256757 256771 256799 256801 256813 256831 256873 
-256877 256889 256901 256903 256931 256939 256957 256967 256981 257003 257017 257053 
-257069 257077 257093 257099 257107 257123 257141 257161 257171 257177 257189 257219 
-257221 257239 257249 257263 257273 257281 257287 257293 257297 257311 257321 257339 
-257351 257353 257371 257381 257399 257401 257407 257437 257443 257447 257459 257473 
-257489 257497 257501 257503 257519 257539 257561 257591 257611 257627 257639 257657 
-257671 257687 257689 257707 257711 257713 257717 257731 257783 257791 257797 257837 
-257857 257861 257863 257867 257869 257879 257893 257903 257921 257947 257953 257981 
-257987 257989 257993 258019 258023 258031 258061 258067 258101 258107 258109 258113 
-258119 258127 258131 258143 258157 258161 258173 258197 258211 258233 258241 258253 
-258277 258283 258299 258317 258319 258329 258331 258337 258353 258373 258389 258403 
-258407 258413 258421 258437 258443 258449 258469 258487 258491 258499 258521 258527 
-258539 258551 258563 258569 258581 258607 258611 258613 258617 258623 258631 258637 
-258659 258673 258677 258691 258697 258703 258707 258721 258733 258737 258743 258763 
-258779 258787 258803 258809 258827 258847 258871 258887 258917 258919 258949 258959 
-258967 258971 258977 258983 258991 259001 259009 259019 259033 259099 259121 259123 
-259151 259157 259159 259163 259169 259177 259183 259201 259211 259213 259219 259229 
-259271 259277 259309 259321 259339 259379 259381 259387 259397 259411 259421 259429 
-259451 259453 259459 259499 259507 259517 259531 259537 259547 259577 259583 259603 
-259619 259621 259627 259631 259639 259643 259657 259667 259681 259691 259697 259717 
-259723 259733 259751 259771 259781 259783 259801 259813 259823 259829 259837 259841 
-259867 259907 259933 259937 259943 259949 259967 259991 259993 260003 260009 260011 
-260017 260023 260047 260081 260089 260111 260137 260171 260179 260189 260191 260201 
-260207 260209 260213 260231 260263 260269 260317 260329 260339 260363 260387 260399 
-260411 260413 260417 260419 260441 260453 260461 260467 260483 260489 260527 260539 
-260543 260549 260551 260569 260573 260581 260587 260609 260629 260647 260651 260671 
-260677 260713 260717 260723 260747 260753 260761 260773 260791 260807 260809 260849 
-260857 260861 260863 260873 260879 260893 260921 260941 260951 260959 260969 260983 
-260987 260999 261011 261013 261017 261031 261043 261059 261061 261071 261077 261089 
-261101 261127 261167 261169 261223 261229 261241 261251 261271 261281 261301 261323 
-261329 261337 261347 261353 261379 261389 261407 261427 261431 261433 261439 261451 
-261463 261467 261509 261523 261529 261557 261563 261577 261581 261587 261593 261601 
-261619 261631 261637 261641 261643 261673 261697 261707 261713 261721 261739 261757 
-261761 261773 261787 261791 261799 261823 261847 261881 261887 261917 261959 261971 
-261973 261977 261983 262007 262027 262049 262051 262069 262079 262103 262109 262111 
-262121 262127 262133 262139 262147 262151 262153 262187 262193 262217 262231 262237 
-262253 262261 262271 262303 262313 262321 262331 262337 262349 262351 262369 262387 
-262391 262399 262411 262433 262459 262469 262489 262501 262511 262513 262519 262541 
-262543 262553 262567 262583 262597 262621 262627 262643 262649 262651 262657 262681 
-262693 262697 262709 262723 262733 262739 262741 262747 262781 262783 262807 262819 
-262853 262877 262883 262897 262901 262909 262937 262949 262957 262981 263009 263023 
-263047 263063 263071 263077 263083 263089 263101 263111 263119 263129 263167 263171 
-263183 263191 263201 263209 263213 263227 263239 263257 263267 263269 263273 263287 
-263293 263303 263323 263369 263383 263387 263399 263401 263411 263423 263429 263437 
-263443 263489 263491 263503 263513 263519 263521 263533 263537 263561 263567 263573 
-263591 263597 263609 263611 263621 263647 263651 263657 263677 263723 263729 263737 
-263759 263761 263803 263819 263821 263827 263843 263849 263863 263867 263869 263881 
-263899 263909 263911 263927 263933 263941 263951 263953 263957 263983 264007 264013 
-264029 264031 264053 264059 264071 264083 264091 264101 264113 264127 264133 264137 
-264139 264167 264169 264179 264211 264221 264263 264269 264283 264289 264301 264323 
-264331 264343 264349 264353 264359 264371 264391 264403 264437 264443 264463 264487 
-264527 264529 264553 264559 264577 264581 264599 264601 264619 264631 264637 264643 
-264659 264697 264731 264739 264743 264749 264757 264763 264769 264779 264787 264791 
-264793 264811 264827 264829 264839 264871 264881 264889 264893 264899 264919 264931 
-264949 264959 264961 264977 264991 264997 265003 265007 265021 265037 265079 265091 
-265093 265117 265123 265129 265141 265151 265157 265163 265169 265193 265207 265231 
-265241 265247 265249 265261 265271 265273 265277 265313 265333 265337 265339 265381 
-265399 265403 265417 265423 265427 265451 265459 265471 265483 265493 265511 265513 
-265541 265543 265547 265561 265567 265571 265579 265607 265613 265619 265621 265703 
-265709 265711 265717 265729 265739 265747 265757 265781 265787 265807 265813 265819 
-265831 265841 265847 265861 265871 265873 265883 265891 265921 265957 265961 265987 
-266003 266009 266023 266027 266029 266047 266051 266053 266059 266081 266083 266089 
-266093 266099 266111 266117 266129 266137 266153 266159 266177 266183 266221 266239 
-266261 266269 266281 266291 266293 266297 266333 266351 266353 266359 266369 266381 
-266401 266411 266417 266447 266449 266477 266479 266489 266491 266521 266549 266587 
-266599 266603 266633 266641 266647 266663 266671 266677 266681 266683 266687 266689 
-266701 266711 266719 266759 266767 266797 266801 266821 266837 266839 266863 266867 
-266891 266897 266899 266909 266921 266927 266933 266947 266953 266957 266971 266977 
-266983 266993 266999 267017 267037 267049 267097 267131 267133 267139 267143 267167 
-267187 267193 267199 267203 267217 267227 267229 267233 267259 267271 267277 267299 
-267301 267307 267317 267341 267353 267373 267389 267391 267401 267403 267413 267419 
-267431 267433 267439 267451 267469 267479 267481 267493 267497 267511 267517 267521 
-267523 267541 267551 267557 267569 267581 267587 267593 267601 267611 267613 267629 
-267637 267643 267647 267649 267661 267667 267671 267677 267679 267713 267719 267721 
-267727 267737 267739 267749 267763 267781 267791 267797 267803 267811 267829 267833 
-267857 267863 267877 267887 267893 267899 267901 267907 267913 267929 267941 267959 
-267961 268003 268013 268043 268049 268063 268069 268091 268123 268133 268153 268171 
-268189 268199 268207 268211 268237 268253 268267 268271 268283 268291 268297 268343 
-268403 268439 268459 268487 268493 268501 268507 268517 268519 268529 268531 268537 
-268547 268573 268607 268613 268637 268643 268661 268693 268721 268729 268733 268747 
-268757 268759 268771 268777 268781 268783 268789 268811 268813 268817 268819 268823 
-268841 268843 268861 268883 268897 268909 268913 268921 268927 268937 268969 268973 
-268979 268993 268997 268999 269023 269029 269039 269041 269057 269063 269069 269089 
-269117 269131 269141 269167 269177 269179 269183 269189 269201 269209 269219 269221 
-269231 269237 269251 269257 269281 269317 269327 269333 269341 269351 269377 269383 
-269387 269389 269393 269413 269419 269429 269431 269441 269461 269473 269513 269519 
-269527 269539 269543 269561 269573 269579 269597 269617 269623 269641 269651 269663 
-269683 269701 269713 269719 269723 269741 269749 269761 269779 269783 269791 269851 
-269879 269887 269891 269897 269923 269939 269947 269953 269981 269987 270001 270029 
-270031 270037 270059 270071 270073 270097 270121 270131 270133 270143 270157 270163 
-270167 270191 270209 270217 270223 270229 270239 270241 270269 270271 270287 270299 
-270307 270311 270323 270329 270337 270343 270371 270379 270407 270421 270437 270443 
-270451 270461 270463 270493 270509 270527 270539 270547 270551 270553 270563 270577 
-270583 270587 270593 270601 270619 270631 270653 270659 270667 270679 270689 270701 
-270709 270719 270737 270749 270761 270763 270791 270797 270799 270821 270833 270841 
-270859 270899 270913 270923 270931 270937 270953 270961 270967 270973 271003 271013 
-271021 271027 271043 271057 271067 271079 271097 271109 271127 271129 271163 271169 
-271177 271181 271211 271217 271231 271241 271253 271261 271273 271277 271279 271289 
-271333 271351 271357 271363 271367 271393 271409 271429 271451 271463 271471 271483 
-271489 271499 271501 271517 271549 271553 271571 271573 271597 271603 271619 271637 
-271639 271651 271657 271693 271703 271723 271729 271753 271769 271771 271787 271807 
-271811 271829 271841 271849 271853 271861 271867 271879 271897 271903 271919 271927 
-271939 271967 271969 271981 272003 272009 272011 272029 272039 272053 272059 272093 
-272131 272141 272171 272179 272183 272189 272191 272201 272203 272227 272231 272249 
-272257 272263 272267 272269 272287 272299 272317 272329 272333 272341 272347 272351 
-272353 272359 272369 272381 272383 272399 272407 272411 272417 272423 272449 272453 
-272477 272507 272533 272537 272539 272549 272563 272567 272581 272603 272621 272651 
-272659 272683 272693 272717 272719 272737 272759 272761 272771 272777 272807 272809 
-272813 272863 272879 272887 272903 272911 272917 272927 272933 272959 272971 272981 
-272983 272989 272999 273001 273029 273043 273047 273059 273061 273067 273073 273083 
-273107 273113 273127 273131 273149 273157 273181 273187 273193 273233 273253 273269 
-273271 273281 273283 273289 273311 273313 273323 273349 273359 273367 273433 273457 
-273473 273503 273517 273521 273527 273551 273569 273601 273613 273617 273629 273641 
-273643 273653 273697 273709 273719 273727 273739 273773 273787 273797 273803 273821 
-273827 273857 273881 273899 273901 273913 273919 273929 273941 273943 273967 273971 
-273979 273997 274007 274019 274033 274061 274069 274081 274093 274103 274117 274121 
-274123 274139 274147 274163 274171 274177 274187 274199 274201 274213 274223 274237 
-274243 274259 274271 274277 274283 274301 274333 274349 274357 274361 274403 274423 
-274441 274451 274453 274457 274471 274489 274517 274529 274579 274583 274591 274609 
-274627 274661 274667 274679 274693 274697 274709 274711 274723 274739 274751 274777 
-274783 274787 274811 274817 274829 274831 274837 274843 274847 274853 274861 274867 
-274871 274889 274909 274931 274943 274951 274957 274961 274973 274993 275003 275027 
-275039 275047 275053 275059 275083 275087 275129 275131 275147 275153 275159 275161 
-275167 275183 275201 275207 275227 275251 275263 275269 275299 275309 275321 275323 
-275339 275357 275371 275389 275393 275399 275419 275423 275447 275449 275453 275459 
-275461 275489 275491 275503 275521 275531 275543 275549 275573 275579 275581 275591 
-275593 275599 275623 275641 275651 275657 275669 275677 275699 275711 275719 275729 
-275741 275767 275773 275783 275813 275827 275837 275881 275897 275911 275917 275921 
-275923 275929 275939 275941 275963 275969 275981 275987 275999 276007 276011 276019 
-276037 276041 276043 276047 276049 276079 276083 276091 276113 276137 276151 276173 
-276181 276187 276191 276209 276229 276239 276247 276251 276257 276277 276293 276319 
-276323 276337 276343 276347 276359 276371 276373 276389 276401 276439 276443 276449 
-276461 276467 276487 276499 276503 276517 276527 276553 276557 276581 276587 276589 
-276593 276599 276623 276629 276637 276671 276673 276707 276721 276739 276763 276767 
-276779 276781 276817 276821 276823 276827 276833 276839 276847 276869 276883 276901 
-276907 276917 276919 276929 276949 276953 276961 276977 277003 277007 277021 277051 
-277063 277073 277087 277097 277099 277157 277163 277169 277177 277183 277213 277217 
-277223 277231 277247 277259 277261 277273 277279 277297 277301 277309 277331 277363 
-277373 277411 277421 277427 277429 277483 277493 277499 277513 277531 277547 277549 
-277567 277577 277579 277597 277601 277603 277637 277639 277643 277657 277663 277687 
-277691 277703 277741 277747 277751 277757 277787 277789 277793 277813 277829 277847 
-277859 277883 277889 277891 277897 277903 277919 277961 277993 277999 278017 278029 
-278041 278051 278063 278071 278087 278111 278119 278123 278143 278147 278149 278177 
-278191 278207 278209 278219 278227 278233 278237 278261 278269 278279 278321 278329 
-278347 278353 278363 278387 278393 278413 278437 278459 278479 278489 278491 278497 
-278501 278503 278543 278549 278557 278561 278563 278581 278591 278609 278611 278617 
-278623 278627 278639 278651 278671 278687 278689 278701 278717 278741 278743 278753 
-278767 278801 278807 278809 278813 278819 278827 278843 278849 278867 278879 278881 
-278891 278903 278909 278911 278917 278947 278981 279001 279007 279023 279029 279047 
-279073 279109 279119 279121 279127 279131 279137 279143 279173 279179 279187 279203 
-279211 279221 279269 279311 279317 279329 279337 279353 279397 279407 279413 279421 
-279431 279443 279451 279479 279481 279511 279523 279541 279551 279553 279557 279571 
-279577 279583 279593 279607 279613 279619 279637 279641 279649 279659 279679 279689 
-279707 279709 279731 279751 279761 279767 279779 279817 279823 279847 279857 279863 
-279883 279913 279919 279941 279949 279967 279977 279991 280001 280009 280013 280031 
-280037 280061 280069 280097 280099 280103 280121 280129 280139 280183 280187 280199 
-280207 280219 280223 280229 280243 280249 280253 280277 280297 280303 280321 280327 
-280337 280339 280351 280373 280409 280411 280451 280463 280487 280499 280507 280513 
-280537 280541 280547 280549 280561 280583 280589 280591 280597 280603 280607 280613 
-280627 280639 280673 280681 280697 280699 280703 280711 280717 280729 280751 280759 
-280769 280771 280811 280817 280837 280843 280859 280871 280879 280883 280897 280909 
-280913 280921 280927 280933 280939 280949 280957 280963 280967 280979 280997 281023 
-281033 281053 281063 281069 281081 281117 281131 281153 281159 281167 281189 281191 
-281207 281227 281233 281243 281249 281251 281273 281279 281291 281297 281317 281321 
-281327 281339 281353 281357 281363 281381 281419 281423 281429 281431 281509 281527 
-281531 281539 281549 281551 281557 281563 281579 281581 281609 281621 281623 281627 
-281641 281647 281651 281653 281663 281669 281683 281717 281719 281737 281747 281761 
-281767 281777 281783 281791 281797 281803 281807 281833 281837 281839 281849 281857 
-281867 281887 281893 281921 281923 281927 281933 281947 281959 281971 281989 281993 
-282001 282011 282019 282053 282059 282071 282089 282091 282097 282101 282103 282127 
-282143 282157 282167 282221 282229 282239 282241 282253 282281 282287 282299 282307 
-282311 282313 282349 282377 282383 282389 282391 282407 282409 282413 282427 282439 
-282461 282481 282487 282493 282559 282563 282571 282577 282589 282599 282617 282661 
-282671 282677 282679 282683 282691 282697 282703 282707 282713 282767 282769 282773 
-282797 282809 282827 282833 282847 282851 282869 282881 282889 282907 282911 282913 
-282917 282959 282973 282977 282991 283001 283007 283009 283027 283051 283079 283093 
-283097 283099 283111 283117 283121 283133 283139 283159 283163 283181 283183 283193 
-283207 283211 283267 283277 283289 283303 283369 283397 283403 283411 283447 283463 
-283487 283489 283501 283511 283519 283541 283553 283571 283573 283579 283583 283601 
-283607 283609 283631 283637 283639 283669 283687 283697 283721 283741 283763 283769 
-283771 283793 283799 283807 283813 283817 283831 283837 283859 283861 283873 283909 
-283937 283949 283957 283961 283979 284003 284023 284041 284051 284057 284059 284083 
-284093 284111 284117 284129 284131 284149 284153 284159 284161 284173 284191 284201 
-284227 284231 284233 284237 284243 284261 284267 284269 284293 284311 284341 284357 
-284369 284377 284387 284407 284413 284423 284429 284447 284467 284477 284483 284489 
-284507 284509 284521 284527 284539 284551 284561 284573 284587 284591 284593 284623 
-284633 284651 284657 284659 284681 284689 284701 284707 284723 284729 284731 284737 
-284741 284743 284747 284749 284759 284777 284783 284803 284807 284813 284819 284831 
-284833 284839 284857 284881 284897 284899 284917 284927 284957 284969 284989 285007 
-285023 285031 285049 285071 285079 285091 285101 285113 285119 285121 285139 285151 
-285161 285179 285191 285199 285221 285227 285251 285281 285283 285287 285289 285301 
-285317 285343 285377 285421 285433 285451 285457 285463 285469 285473 285497 285517 
-285521 285533 285539 285553 285557 285559 285569 285599 285611 285613 285629 285631 
-285641 285643 285661 285667 285673 285697 285707 285709 285721 285731 285749 285757 
-285763 285767 285773 285781 285823 285827 285839 285841 285871 285937 285949 285953 
-285977 285979 285983 285997 286001 286009 286019 286043 286049 286061 286063 286073 
-286103 286129 286163 286171 286199 286243 286249 286289 286301 286333 286367 286369 
-286381 286393 286397 286411 286421 286427 286453 286457 286459 286469 286477 286483 
-286487 286493 286499 286513 286519 286541 286543 286547 286553 286589 286591 286609 
-286613 286619 286633 286651 286673 286687 286697 286703 286711 286721 286733 286751 
-286753 286763 286771 286777 286789 286801 286813 286831 286859 286873 286927 286973 
-286981 286987 286999 287003 287047 287057 287059 287087 287093 287099 287107 287117 
-287137 287141 287149 287159 287167 287173 287179 287191 287219 287233 287237 287239 
-287251 287257 287269 287279 287281 287291 287297 287321 287327 287333 287341 287347 
-287383 287387 287393 287437 287449 287491 287501 287503 287537 287549 287557 287579 
-287597 287611 287629 287669 287671 287681 287689 287701 287731 287747 287783 287789 
-287801 287813 287821 287849 287851 287857 287863 287867 287873 287887 287921 287933 
-287939 287977 288007 288023 288049 288053 288061 288077 288089 288109 288137 288179 
-288181 288191 288199 288203 288209 288227 288241 288247 288257 288283 288293 288307 
-288313 288317 288349 288359 288361 288383 288389 288403 288413 288427 288433 288461 
-288467 288481 288493 288499 288527 288529 288539 288551 288559 288571 288577 288583 
-288647 288649 288653 288661 288679 288683 288689 288697 288731 288733 288751 288767 
-288773 288803 288817 288823 288833 288839 288851 288853 288877 288907 288913 288929 
-288931 288947 288973 288979 288989 288991 288997 289001 289019 289021 289031 289033 
-289039 289049 289063 289067 289099 289103 289109 289111 289127 289129 289139 289141 
-289151 289169 289171 289181 289189 289193 289213 289241 289243 289249 289253 289273 
-289283 289291 289297 289309 289319 289343 289349 289361 289369 289381 289397 289417 
-289423 289439 289453 289463 289469 289477 289489 289511 289543 289559 289573 289577 
-289589 289603 289607 289637 289643 289657 289669 289717 289721 289727 289733 289741 
-289759 289763 289771 289789 289837 289841 289843 289847 289853 289859 289871 289889 
-289897 289937 289951 289957 289967 289973 289987 289999 290011 290021 290023 290027 
-290033 290039 290041 290047 290057 290083 290107 290113 290119 290137 290141 290161 
-290183 290189 290201 290209 290219 290233 290243 290249 290317 290327 290347 290351 
-290359 290369 290383 290393 290399 290419 290429 290441 290443 290447 290471 290473 
-290489 290497 290509 290527 290531 290533 290539 290557 290593 290597 290611 290617 
-290621 290623 290627 290657 290659 290663 290669 290671 290677 290701 290707 290711 
-290737 290761 290767 290791 290803 290821 290827 290837 290839 290861 290869 290879 
-290897 290923 290959 290963 290971 290987 290993 290999 291007 291013 291037 291041 
-291043 291077 291089 291101 291103 291107 291113 291143 291167 291169 291173 291191 
-291199 291209 291217 291253 291257 291271 291287 291293 291299 291331 291337 291349 
-291359 291367 291371 291373 291377 291419 291437 291439 291443 291457 291481 291491 
-291503 291509 291521 291539 291547 291559 291563 291569 291619 291647 291649 291661 
-291677 291689 291691 291701 291721 291727 291743 291751 291779 291791 291817 291829 
-291833 291853 291857 291869 291877 291887 291899 291901 291923 291971 291979 291983 
-291997 292021 292027 292037 292057 292069 292079 292081 292091 292093 292133 292141 
-292147 292157 292181 292183 292223 292231 292241 292249 292267 292283 292301 292309 
-292319 292343 292351 292363 292367 292381 292393 292427 292441 292459 292469 292471 
-292477 292483 292489 292493 292517 292531 292541 292549 292561 292573 292577 292601 
-292627 292631 292661 292667 292673 292679 292693 292703 292709 292711 292717 292727 
-292753 292759 292777 292793 292801 292807 292819 292837 292841 292849 292867 292879 
-292909 292921 292933 292969 292973 292979 292993 293021 293071 293081 293087 293093 
-293099 293107 293123 293129 293147 293149 293173 293177 293179 293201 293207 293213 
-293221 293257 293261 293263 293269 293311 293329 293339 293351 293357 293399 293413 
-293431 293441 293453 293459 293467 293473 293483 293507 293543 293599 293603 293617 
-293621 293633 293639 293651 293659 293677 293681 293701 293717 293723 293729 293749 
-293767 293773 293791 293803 293827 293831 293861 293863 293893 293899 293941 293957 
-293983 293989 293999 294001 294013 294023 294029 294043 294053 294059 294067 294103 
-294127 294131 294149 294157 294167 294169 294179 294181 294199 294211 294223 294227 
-294241 294247 294251 294269 294277 294289 294293 294311 294313 294317 294319 294337 
-294341 294347 294353 294383 294391 294397 294403 294431 294439 294461 294467 294479 
-294499 294509 294523 294529 294551 294563 294629 294641 294647 294649 294659 294673 
-294703 294731 294751 294757 294761 294773 294781 294787 294793 294799 294803 294809 
-294821 294829 294859 294869 294887 294893 294911 294919 294923 294947 294949 294953 
-294979 294989 294991 294997 295007 295033 295037 295039 295049 295073 295079 295081 
-295111 295123 295129 295153 295187 295199 295201 295219 295237 295247 295259 295271 
-295277 295283 295291 295313 295319 295333 295357 295363 295387 295411 295417 295429 
-295433 295439 295441 295459 295513 295517 295541 295553 295567 295571 295591 295601 
-295663 295693 295699 295703 295727 295751 295759 295769 295777 295787 295819 295831 
-295837 295843 295847 295853 295861 295871 295873 295877 295879 295901 295903 295909 
-295937 295943 295949 295951 295961 295973 295993 296011 296017 296027 296041 296047 
-296071 296083 296099 296117 296129 296137 296159 296183 296201 296213 296221 296237 
-296243 296249 296251 296269 296273 296279 296287 296299 296347 296353 296363 296369 
-296377 296437 296441 296473 296477 296479 296489 296503 296507 296509 296519 296551 
-296557 296561 296563 296579 296581 296587 296591 296627 296651 296663 296669 296683 
-296687 296693 296713 296719 296729 296731 296741 296749 296753 296767 296771 296773 
-296797 296801 296819 296827 296831 296833 296843 296909 296911 296921 296929 296941 
-296969 296971 296981 296983 296987 297019 297023 297049 297061 297067 297079 297083 
-297097 297113 297133 297151 297161 297169 297191 297233 297247 297251 297257 297263 
-297289 297317 297359 297371 297377 297391 297397 297403 297421 297439 297457 297467 
-297469 297481 297487 297503 297509 297523 297533 297581 297589 297601 297607 297613 
-297617 297623 297629 297641 297659 297683 297691 297707 297719 297727 297757 297779 
-297793 297797 297809 297811 297833 297841 297853 297881 297889 297893 297907 297911 
-297931 297953 297967 297971 297989 297991 298013 298021 298031 298043 298049 298063 
-298087 298093 298099 298153 298157 298159 298169 298171 298187 298201 298211 298213 
-298223 298237 298247 298261 298283 298303 298307 298327 298339 298343 298349 298369 
-298373 298399 298409 298411 298427 298451 298477 298483 298513 298559 298579 298583 
-298589 298601 298607 298621 298631 298651 298667 298679 298681 298687 298691 298693 
-298709 298723 298733 298757 298759 298777 298799 298801 298817 298819 298841 298847 
-298853 298861 298897 298937 298943 298993 298999 299011 299017 299027 299029 299053 
-299059 299063 299087 299099 299107 299113 299137 299147 299171 299179 299191 299197 
-299213 299239 299261 299281 299287 299311 299317 299329 299333 299357 299359 299363 
-299371 299389 299393 299401 299417 299419 299447 299471 299473 299477 299479 299501 
-299513 299521 299527 299539 299567 299569 299603 299617 299623 299653 299671 299681 
-299683 299699 299701 299711 299723 299731 299743 299749 299771 299777 299807 299843 
-299857 299861 299881 299891 299903 299909 299933 299941 299951 299969 299977 299983 
-299993 300007 300017 300023 300043 300073 300089 300109 300119 300137 300149 300151 
-300163 300187 300191 300193 300221 300229 300233 300239 300247 300277 300299 300301 
-300317 300319 300323 300331 300343 300347 300367 300397 300413 300427 300431 300439 
-300463 300481 300491 300493 300497 300499 300511 300557 300569 300581 300583 300589 
-300593 300623 300631 300647 300649 300661 300667 300673 300683 300691 300719 300721 
-300733 300739 300743 300749 300757 300761 300779 300787 300799 300809 300821 300823 
-300851 300857 300869 300877 300889 300893 300929 300931 300953 300961 300967 300973 
-300977 300997 301013 301027 301039 301051 301057 301073 301079 301123 301127 301141 
-301153 301159 301177 301181 301183 301211 301219 301237 301241 301243 301247 301267 
-301303 301319 301331 301333 301349 301361 301363 301381 301403 301409 301423 301429 
-301447 301459 301463 301471 301487 301489 301493 301501 301531 301577 301579 301583 
-301591 301601 301619 301627 301643 301649 301657 301669 301673 301681 301703 301711 
-301747 301751 301753 301759 301789 301793 301813 301831 301841 301843 301867 301877 
-301897 301901 301907 301913 301927 301933 301943 301949 301979 301991 301993 301997 
-301999 302009 302053 302111 302123 302143 302167 302171 302173 302189 302191 302213 
-302221 302227 302261 302273 302279 302287 302297 302299 302317 302329 302399 302411 
-302417 302429 302443 302459 302483 302507 302513 302551 302563 302567 302573 302579 
-302581 302587 302593 302597 302609 302629 302647 302663 302681 302711 302723 302747 
-302759 302767 302779 302791 302801 302831 302833 302837 302843 302851 302857 302873 
-302891 302903 302909 302921 302927 302941 302959 302969 302971 302977 302983 302989 
-302999 303007 303011 303013 303019 303029 303049 303053 303073 303089 303091 303097 
-303119 303139 303143 303151 303157 303187 303217 303257 303271 303283 303287 303293 
-303299 303307 303313 303323 303337 303341 303361 303367 303371 303377 303379 303389 
-303409 303421 303431 303463 303469 303473 303491 303493 303497 303529 303539 303547 
-303551 303553 303571 303581 303587 303593 303613 303617 303619 303643 303647 303649 
-303679 303683 303689 303691 303703 303713 303727 303731 303749 303767 303781 303803 
-303817 303827 303839 303859 303871 303889 303907 303917 303931 303937 303959 303983 
-303997 304009 304013 304021 304033 304039 304049 304063 304067 304069 304081 304091 
-304099 304127 304151 304153 304163 304169 304193 304211 304217 304223 304253 304259 
-304279 304301 304303 304331 304349 304357 304363 304373 304391 304393 304411 304417 
-304429 304433 304439 304457 304459 304477 304481 304489 304501 304511 304517 304523 
-304537 304541 304553 304559 304561 304597 304609 304631 304643 304651 304663 304687 
-304709 304723 304729 304739 304751 304757 304763 304771 304781 304789 304807 304813 
-304831 304847 304849 304867 304879 304883 304897 304901 304903 304907 304933 304937 
-304943 304949 304961 304979 304981 305017 305021 305023 305029 305033 305047 305069 
-305093 305101 305111 305113 305119 305131 305143 305147 305209 305219 305231 305237 
-305243 305267 305281 305297 305329 305339 305351 305353 305363 305369 305377 305401 
-305407 305411 305413 305419 305423 305441 305449 305471 305477 305479 305483 305489 
-305497 305521 305533 305551 305563 305581 305593 305597 305603 305611 305621 305633 
-305639 305663 305717 305719 305741 305743 305749 305759 305761 305771 305783 305803 
-305821 305839 305849 305857 305861 305867 305873 305917 305927 305933 305947 305971 
-305999 306011 306023 306029 306041 306049 306083 306091 306121 306133 306139 306149 
-306157 306167 306169 306191 306193 306209 306239 306247 306253 306259 306263 306301 
-306329 306331 306347 306349 306359 306367 306377 306389 306407 306419 306421 306431 
-306437 306457 306463 306473 306479 306491 306503 306511 306517 306529 306533 306541 
-306563 306577 306587 306589 306643 306653 306661 306689 306701 306703 306707 306727 
-306739 306749 306763 306781 306809 306821 306827 306829 306847 306853 306857 306871 
-306877 306883 306893 306899 306913 306919 306941 306947 306949 306953 306991 307009 
-307019 307031 307033 307067 307079 307091 307093 307103 307121 307129 307147 307163 
-307169 307171 307187 307189 307201 307243 307253 307259 307261 307267 307273 307277 
-307283 307289 307301 307337 307339 307361 307367 307381 307397 307399 307409 307423 
-307451 307471 307481 307511 307523 307529 307537 307543 307577 307583 307589 307609 
-307627 307631 307633 307639 307651 307669 307687 307691 307693 307711 307733 307759 
-307817 307823 307831 307843 307859 307871 307873 307891 307903 307919 307939 307969 
-308003 308017 308027 308041 308051 308081 308093 308101 308107 308117 308129 308137 
-308141 308149 308153 308213 308219 308249 308263 308291 308293 308303 308309 308311 
-308317 308323 308327 308333 308359 308383 308411 308423 308437 308447 308467 308489 
-308491 308501 308507 308509 308519 308521 308527 308537 308551 308569 308573 308587 
-308597 308621 308639 308641 308663 308681 308701 308713 308723 308761 308773 308801 
-308809 308813 308827 308849 308851 308857 308887 308899 308923 308927 308929 308933 
-308939 308951 308989 308999 309007 309011 309013 309019 309031 309037 309059 309079 
-309083 309091 309107 309109 309121 309131 309137 309157 309167 309173 309193 309223 
-309241 309251 309259 309269 309271 309277 309289 309293 309311 309313 309317 309359 
-309367 309371 309391 309403 309433 309437 309457 309461 309469 309479 309481 309493 
-309503 309521 309523 309539 309541 309559 309571 309577 309583 309599 309623 309629 
-309637 309667 309671 309677 309707 309713 309731 309737 309769 309779 309781 309797 
-309811 309823 309851 309853 309857 309877 309899 309929 309931 309937 309977 309989 
-310019 310021 310027 310043 310049 310081 310087 310091 310111 310117 310127 310129 
-310169 310181 310187 310223 310229 310231 310237 310243 310273 310283 310291 310313 
-310333 310357 310361 310363 310379 310397 310423 310433 310439 310447 310459 310463 
-310481 310489 310501 310507 310511 310547 310553 310559 310567 310571 310577 310591 
-310627 310643 310663 310693 310697 310711 310721 310727 310729 310733 310741 310747 
-310771 310781 310789 310801 310819 310823 310829 310831 310861 310867 310883 310889 
-310901 310927 310931 310949 310969 310987 310997 311009 311021 311027 311033 311041 
-311099 311111 311123 311137 311153 311173 311177 311183 311189 311197 311203 311237 
-311279 311291 311293 311299 311303 311323 311329 311341 311347 311359 311371 311393 
-311407 311419 311447 311453 311473 311533 311537 311539 311551 311557 311561 311567 
-311569 311603 311609 311653 311659 311677 311681 311683 311687 311711 311713 311737 
-311743 311747 311749 311791 311803 311807 311821 311827 311867 311869 311881 311897 
-311951 311957 311963 311981 312007 312023 312029 312031 312043 312047 312071 312073 
-312083 312089 312101 312107 312121 312161 312197 312199 312203 312209 312211 312217 
-312229 312233 312241 312251 312253 312269 312281 312283 312289 312311 312313 312331 
-312343 312349 312353 312371 312383 312397 312401 312407 312413 312427 312451 312469 
-312509 312517 312527 312551 312553 312563 312581 312583 312589 312601 312617 312619 
-312623 312643 312673 312677 312679 312701 312703 312709 312727 312737 312743 312757 
-312773 312779 312799 312839 312841 312857 312863 312887 312899 312929 312931 312937 
-312941 312943 312967 312971 312979 312989 313003 313009 313031 313037 313081 313087 
-313109 313127 313129 313133 313147 313151 313153 313163 313207 313211 313219 313241 
-313249 313267 313273 313289 313297 313301 313307 313321 313331 313333 313343 313351 
-313373 313381 313387 313399 313409 313471 313477 313507 313517 313543 313549 313553 
-313561 313567 313571 313583 313589 313597 313603 313613 313619 313637 313639 313661 
-313669 313679 313699 313711 313717 313721 313727 313739 313741 313763 313777 313783 
-313829 313849 313853 313879 313883 313889 313897 313909 313921 313931 313933 313949 
-313961 313969 313979 313981 313987 313991 313993 313997 314003 314021 314059 314063 
-314077 314107 314113 314117 314129 314137 314159 314161 314173 314189 314213 314219 
-314227 314233 314239 314243 314257 314261 314263 314267 314299 314329 314339 314351 
-314357 314359 314399 314401 314407 314423 314441 314453 314467 314491 314497 314513 
-314527 314543 314549 314569 314581 314591 314597 314599 314603 314623 314627 314641 
-314651 314693 314707 314711 314719 314723 314747 314761 314771 314777 314779 314807 
-314813 314827 314851 314879 314903 314917 314927 314933 314953 314957 314983 314989 
-315011 315013 315037 315047 315059 315067 315083 315097 315103 315109 315127 315179 
-315181 315193 315199 315223 315247 315251 315257 315269 315281 315313 315349 315361 
-315373 315377 315389 315407 315409 315421 315437 315449 315451 315461 315467 315481 
-315493 315517 315521 315527 315529 315547 315551 315559 315569 315589 315593 315599 
-315613 315617 315631 315643 315671 315677 315691 315697 315701 315703 315739 315743 
-315751 315779 315803 315811 315829 315851 315857 315881 315883 315893 315899 315907 
-315937 315949 315961 315967 315977 316003 316031 316033 316037 316051 316067 316073 
-316087 316097 316109 316133 316139 316153 316177 316189 316193 316201 316213 316219 
-316223 316241 316243 316259 316271 316291 316297 316301 316321 316339 316343 316363 
-316373 316391 316403 316423 316429 316439 316453 316469 316471 316493 316499 316501 
-316507 316531 316567 316571 316577 316583 316621 316633 316637 316649 316661 316663 
-316681 316691 316697 316699 316703 316717 316753 316759 316769 316777 316783 316793 
-316801 316817 316819 316847 316853 316859 316861 316879 316891 316903 316907 316919 
-316937 316951 316957 316961 316991 317003 317011 317021 317029 317047 317063 317071 
-317077 317087 317089 317123 317159 317171 317179 317189 317197 317209 317227 317257 
-317263 317267 317269 317279 317321 317323 317327 317333 317351 317353 317363 317371 
-317399 317411 317419 317431 317437 317453 317459 317483 317489 317491 317503 317539 
-317557 317563 317587 317591 317593 317599 317609 317617 317621 317651 317663 317671 
-317693 317701 317711 317717 317729 317731 317741 317743 317771 317773 317777 317783 
-317789 317797 317827 317831 317839 317857 317887 317903 317921 317923 317957 317959 
-317963 317969 317971 317983 317987 318001 318007 318023 318077 318103 318107 318127 
-318137 318161 318173 318179 318181 318191 318203 318209 318211 318229 318233 318247 
-318259 318271 318281 318287 318289 318299 318301 318313 318319 318323 318337 318347 
-318349 318377 318403 318407 318419 318431 318443 318457 318467 318473 318503 318523 
-318557 318559 318569 318581 318589 318601 318629 318641 318653 318671 318677 318679 
-318683 318691 318701 318713 318737 318743 318749 318751 318781 318793 318809 318811 
-318817 318823 318833 318841 318863 318881 318883 318889 318907 318911 318917 318919 
-318949 318979 319001 319027 319031 319037 319049 319057 319061 319069 319093 319097 
-319117 319127 319129 319133 319147 319159 319169 319183 319201 319211 319223 319237 
-319259 319279 319289 319313 319321 319327 319339 319343 319351 319357 319387 319391 
-319399 319411 319427 319433 319439 319441 319453 319469 319477 319483 319489 319499 
-319511 319519 319541 319547 319567 319577 319589 319591 319601 319607 319639 319673 
-319679 319681 319687 319691 319699 319727 319729 319733 319747 319757 319763 319811 
-319817 319819 319829 319831 319849 319883 319897 319901 319919 319927 319931 319937 
-319967 319973 319981 319993 320009 320011 320027 320039 320041 320053 320057 320063 
-320081 320083 320101 320107 320113 320119 320141 320143 320149 320153 320179 320209 
-320213 320219 320237 320239 320267 320269 320273 320291 320293 320303 320317 320329 
-320339 320377 320387 320389 320401 320417 320431 320449 320471 320477 320483 320513 
-320521 320533 320539 320561 320563 320591 320609 320611 320627 320647 320657 320659 
-320669 320687 320693 320699 320713 320741 320759 320767 320791 320821 320833 320839 
-320843 320851 320861 320867 320899 320911 320923 320927 320939 320941 320953 321007 
-321017 321031 321037 321047 321053 321073 321077 321091 321109 321143 321163 321169 
-321187 321193 321199 321203 321221 321227 321239 321247 321289 321301 321311 321313 
-321319 321323 321329 321331 321341 321359 321367 321371 321383 321397 321403 321413 
-321427 321443 321449 321467 321469 321509 321547 321553 321569 321571 321577 321593 
-321611 321617 321619 321631 321647 321661 321679 321707 321709 321721 321733 321743 
-321751 321757 321779 321799 321817 321821 321823 321829 321833 321847 321851 321889 
-321901 321911 321947 321949 321961 321983 321991 322001 322009 322013 322037 322039 
-322051 322057 322067 322073 322079 322093 322097 322109 322111 322139 322169 322171 
-322193 322213 322229 322237 322243 322247 322249 322261 322271 322319 322327 322339 
-322349 322351 322397 322403 322409 322417 322429 322433 322459 322463 322501 322513 
-322519 322523 322537 322549 322559 322571 322573 322583 322589 322591 322607 322613 
-322627 322631 322633 322649 322669 322709 322727 322747 322757 322769 322771 322781 
-322783 322807 322849 322859 322871 322877 322891 322901 322919 322921 322939 322951 
-322963 322969 322997 322999 323003 323009 323027 323053 323077 323083 323087 323093 
-323101 323123 323131 323137 323149 323201 323207 323233 323243 323249 323251 323273 
-323333 323339 323341 323359 323369 323371 323377 323381 323383 323413 323419 323441 
-323443 323467 323471 323473 323507 323509 323537 323549 323567 323579 323581 323591 
-323597 323599 323623 323641 323647 323651 323699 323707 323711 323717 323759 323767 
-323789 323797 323801 323803 323819 323837 323879 323899 323903 323923 323927 323933 
-323951 323957 323987 324011 324031 324053 324067 324073 324089 324097 324101 324113 
-324119 324131 324143 324151 324161 324179 324199 324209 324211 324217 324223 324239 
-324251 324293 324299 324301 324319 324329 324341 324361 324391 324397 324403 324419 
-324427 324431 324437 324439 324449 324451 324469 324473 324491 324497 324503 324517 
-324523 324529 324557 324587 324589 324593 324617 324619 324637 324641 324647 324661 
-324673 324689 324697 324707 324733 324743 324757 324763 324773 324781 324791 324799 
-324809 324811 324839 324847 324869 324871 324889 324893 324901 324931 324941 324949 
-324953 324977 324979 324983 324991 324997 325001 325009 325019 325021 325027 325043 
-325051 325063 325079 325081 325093 325133 325153 325163 325181 325187 325189 325201 
-325217 325219 325229 325231 325249 325271 325301 325307 325309 325319 325333 325343 
-325349 325379 325411 325421 325439 325447 325453 325459 325463 325477 325487 325513 
-325517 325537 325541 325543 325571 325597 325607 325627 325631 325643 325667 325673 
-325681 325691 325693 325697 325709 325723 325729 325747 325751 325753 325769 325777 
-325781 325783 325807 325813 325849 325861 325877 325883 325889 325891 325901 325921 
-325939 325943 325951 325957 325987 325993 325999 326023 326057 326063 326083 326087 
-326099 326101 326113 326119 326141 326143 326147 326149 326153 326159 326171 326189 
-326203 326219 326251 326257 326309 326323 326351 326353 326369 326437 326441 326449 
-326467 326479 326497 326503 326537 326539 326549 326561 326563 326567 326581 326593 
-326597 326609 326611 326617 326633 326657 326659 326663 326681 326687 326693 326701 
-326707 326737 326741 326773 326779 326831 326863 326867 326869 326873 326881 326903 
-326923 326939 326941 326947 326951 326983 326993 326999 327001 327007 327011 327017 
-327023 327059 327071 327079 327127 327133 327163 327179 327193 327203 327209 327211 
-327247 327251 327263 327277 327289 327307 327311 327317 327319 327331 327337 327343 
-327347 327401 327407 327409 327419 327421 327433 327443 327463 327469 327473 327479 
-327491 327493 327499 327511 327517 327529 327553 327557 327559 327571 327581 327583 
-327599 327619 327629 327647 327661 327667 327673 327689 327707 327721 327737 327739 
-327757 327779 327797 327799 327809 327823 327827 327829 327839 327851 327853 327869 
-327871 327881 327889 327917 327923 327941 327953 327967 327979 327983 328007 328037 
-328043 328051 328061 328063 328067 328093 328103 328109 328121 328127 328129 328171 
-328177 328213 328243 328249 328271 328277 328283 328291 328303 328327 328331 328333 
-328343 328357 328373 328379 328381 328397 328411 328421 328429 328439 328481 328511 
-328513 328519 328543 328579 328589 328591 328619 328621 328633 328637 328639 328651 
-328667 328687 328709 328721 328753 328777 328781 328787 328789 328813 328829 328837 
-328847 328849 328883 328891 328897 328901 328919 328921 328931 328961 328981 329009 
-329027 329053 329059 329081 329083 329089 329101 329111 329123 329143 329167 329177 
-329191 329201 329207 329209 329233 329243 329257 329267 329269 329281 329293 329297 
-329299 329309 329317 329321 329333 329347 329387 329393 329401 329419 329431 329471 
-329473 329489 329503 329519 329533 329551 329557 329587 329591 329597 329603 329617 
-329627 329629 329639 329657 329663 329671 329677 329683 329687 329711 329717 329723 
-329729 329761 329773 329779 329789 329801 329803 329863 329867 329873 329891 329899 
-329941 329947 329951 329957 329969 329977 329993 329999 330017 330019 330037 330041 
-330047 330053 330061 330067 330097 330103 330131 330133 330139 330149 330167 330199 
-330203 330217 330227 330229 330233 330241 330247 330271 330287 330289 330311 330313 
-330329 330331 330347 330359 330383 330389 330409 330413 330427 330431 330433 330439 
-330469 330509 330557 330563 330569 330587 330607 330611 330623 330641 330643 330653 
-330661 330679 330683 330689 330697 330703 330719 330721 330731 330749 330767 330787 
-330791 330793 330821 330823 330839 330853 330857 330859 330877 330887 330899 330907 
-330917 330943 330983 330997 331013 331027 331031 331043 331063 331081 331099 331127 
-331141 331147 331153 331159 331171 331183 331207 331213 331217 331231 331241 331249 
-331259 331277 331283 331301 331307 331319 331333 331337 331339 331349 331367 331369 
-331391 331399 331423 331447 331451 331489 331501 331511 331519 331523 331537 331543 
-331547 331549 331553 331577 331579 331589 331603 331609 331613 331651 331663 331691 
-331693 331697 331711 331739 331753 331769 331777 331781 331801 331819 331841 331843 
-331871 331883 331889 331897 331907 331909 331921 331937 331943 331957 331967 331973 
-331997 331999 332009 332011 332039 332053 332069 332081 332099 332113 332117 332147 
-332159 332161 332179 332183 332191 332201 332203 332207 332219 332221 332251 332263 
-332273 332287 332303 332309 332317 332393 332399 332411 332417 332441 332447 332461 
-332467 332471 332473 332477 332489 332509 332513 332561 332567 332569 332573 332611 
-332617 332623 332641 332687 332699 332711 332729 332743 332749 332767 332779 332791 
-332803 332837 332851 332873 332881 332887 332903 332921 332933 332947 332951 332987 
-332989 332993 333019 333023 333029 333031 333041 333049 333071 333097 333101 333103 
-333107 333131 333139 333161 333187 333197 333209 333227 333233 333253 333269 333271 
-333283 333287 333299 333323 333331 333337 333341 333349 333367 333383 333397 333419 
-333427 333433 333439 333449 333451 333457 333479 333491 333493 333497 333503 333517 
-333533 333539 333563 333581 333589 333623 333631 333647 333667 333673 333679 333691 
-333701 333713 333719 333721 333737 333757 333769 333779 333787 333791 333793 333803 
-333821 333857 333871 333911 333923 333929 333941 333959 333973 333989 333997 334021 
-334031 334043 334049 334057 334069 334093 334099 334127 334133 334157 334171 334177 
-334183 334189 334199 334231 334247 334261 334289 334297 334319 334331 334333 334349 
-334363 334379 334387 334393 334403 334421 334423 334427 334429 334447 334487 334493 
-334507 334511 334513 334541 334547 334549 334561 334603 334619 334637 334643 334651 
-334661 334667 334681 334693 334699 334717 334721 334727 334751 334753 334759 334771 
-334777 334783 334787 334793 334843 334861 334877 334889 334891 334897 334931 334963 
-334973 334987 334991 334993 335009 335021 335029 335033 335047 335051 335057 335077 
-335081 335089 335107 335113 335117 335123 335131 335149 335161 335171 335173 335207 
-335213 335221 335249 335261 335273 335281 335299 335323 335341 335347 335381 335383 
-335411 335417 335429 335449 335453 335459 335473 335477 335507 335519 335527 335539 
-335557 335567 335579 335591 335609 335633 335641 335653 335663 335669 335681 335689 
-335693 335719 335729 335743 335747 335771 335807 335809 335813 335821 335833 335843 
-335857 335879 335893 335897 335917 335941 335953 335957 335999 336029 336031 336041 
-336059 336079 336101 336103 336109 336113 336121 336143 336151 336157 336163 336181 
-336199 336211 336221 336223 336227 336239 336247 336251 336253 336263 336307 336317 
-336353 336361 336373 336397 336403 336419 336437 336463 336491 336499 336503 336521 
-336527 336529 336533 336551 336563 336571 336577 336587 336593 336599 336613 336631 
-336643 336649 336653 336667 336671 336683 336689 336703 336727 336757 336761 336767 
-336769 336773 336793 336799 336803 336823 336827 336829 336857 336863 336871 336887 
-336899 336901 336911 336929 336961 336977 336983 336989 336997 337013 337021 337031 
-337039 337049 337069 337081 337091 337097 337121 337153 337189 337201 337213 337217 
-337219 337223 337261 337277 337279 337283 337291 337301 337313 337327 337339 337343 
-337349 337361 337367 337369 337397 337411 337427 337453 337457 337487 337489 337511 
-337517 337529 337537 337541 337543 337583 337607 337609 337627 337633 337639 337651 
-337661 337669 337681 337691 337697 337721 337741 337751 337759 337781 337793 337817 
-337837 337853 337859 337861 337867 337871 337873 337891 337901 337903 337907 337919 
-337949 337957 337969 337973 337999 338017 338027 338033 338119 338137 338141 338153 
-338159 338161 338167 338171 338183 338197 338203 338207 338213 338231 338237 338251 
-338263 338267 338269 338279 338287 338293 338297 338309 338321 338323 338339 338341 
-338347 338369 338383 338389 338407 338411 338413 338423 338431 338449 338461 338473 
-338477 338497 338531 338543 338563 338567 338573 338579 338581 338609 338659 338669 
-338683 338687 338707 338717 338731 338747 338753 338761 338773 338777 338791 338803 
-338839 338851 338857 338867 338893 338909 338927 338959 338993 338999 339023 339049 
-339067 339071 339091 339103 339107 339121 339127 339137 339139 339151 339161 339173 
-339187 339211 339223 339239 339247 339257 339263 339289 339307 339323 339331 339341 
-339373 339389 339413 339433 339467 339491 339517 339527 339539 339557 339583 339589 
-339601 339613 339617 339631 339637 339649 339653 339659 339671 339673 339679 339707 
-339727 339749 339751 339761 339769 339799 339811 339817 339821 339827 339839 339841 
-339863 339887 339907 339943 339959 339991 340007 340027 340031 340037 340049 340057 
-340061 340063 340073 340079 340103 340111 340117 340121 340127 340129 340169 340183 
-340201 340211 340237 340261 340267 340283 340297 340321 340337 340339 340369 340381 
-340387 340393 340397 340409 340429 340447 340451 340453 340477 340481 340519 340541 
-340559 340573 340577 340579 340583 340591 340601 340619 340633 340643 340649 340657 
-340661 340687 340693 340709 340723 340757 340777 340787 340789 340793 340801 340811 
-340819 340849 340859 340877 340889 340897 340903 340909 340913 340919 340927 340931 
-340933 340937 340939 340957 340979 340999 341017 341027 341041 341057 341059 341063 
-341083 341087 341123 341141 341171 341179 341191 341203 341219 341227 341233 341269 
-341273 341281 341287 341293 341303 341311 341321 341323 341333 341339 341347 341357 
-341423 341443 341447 341459 341461 341477 341491 341501 341507 341521 341543 341557 
-341569 341587 341597 341603 341617 341623 341629 341641 341647 341659 341681 341687 
-341701 341729 341743 341749 341771 341773 341777 341813 341821 341827 341839 341851 
-341863 341879 341911 341927 341947 341951 341953 341959 341963 341983 341993 342037 
-342047 342049 342059 342061 342071 342073 342077 342101 342107 342131 342143 342179 
-342187 342191 342197 342203 342211 342233 342239 342241 342257 342281 342283 342299 
-342319 342337 342341 342343 342347 342359 342371 342373 342379 342389 342413 342421 
-342449 342451 342467 342469 342481 342497 342521 342527 342547 342553 342569 342593 
-342599 342607 342647 342653 342659 342673 342679 342691 342697 342733 342757 342761 
-342791 342799 342803 342821 342833 342841 342847 342863 342869 342871 342889 342899 
-342929 342949 342971 342989 343019 343037 343051 343061 343073 343081 343087 343127 
-343141 343153 343163 343169 343177 343193 343199 343219 343237 343243 343253 343261 
-343267 343289 343303 343307 343309 343313 343327 343333 343337 343373 343379 343381 
-343391 343393 343411 343423 343433 343481 343489 343517 343529 343531 343543 343547 
-343559 343561 343579 343583 343589 343591 343601 343627 343631 343639 343649 343661 
-343667 343687 343709 343727 343769 343771 343787 343799 343801 343813 343817 343823 
-343829 343831 343891 343897 343901 343913 343933 343939 343943 343951 343963 343997 
-344017 344021 344039 344053 344083 344111 344117 344153 344161 344167 344171 344173 
-344177 344189 344207 344209 344213 344221 344231 344237 344243 344249 344251 344257 
-344263 344269 344273 344291 344293 344321 344327 344347 344353 344363 344371 344417 
-344423 344429 344453 344479 344483 344497 344543 344567 344587 344599 344611 344621 
-344629 344639 344653 344671 344681 344683 344693 344719 344749 344753 344759 344791 
-344797 344801 344807 344819 344821 344843 344857 344863 344873 344887 344893 344909 
-344917 344921 344941 344957 344959 344963 344969 344987 345001 345011 345017 345019 
-345041 345047 345067 345089 345109 345133 345139 345143 345181 345193 345221 345227 
-345229 345259 345263 345271 345307 345311 345329 345379 345413 345431 345451 345461 
-345463 345473 345479 345487 345511 345517 345533 345547 345551 345571 345577 345581 
-345599 345601 345607 345637 345643 345647 345659 345673 345679 345689 345701 345707 
-345727 345731 345733 345739 345749 345757 345769 345773 345791 345803 345811 345817 
-345823 345853 345869 345881 345887 345889 345907 345923 345937 345953 345979 345997 
-346013 346039 346043 346051 346079 346091 346097 346111 346117 346133 346139 346141 
-346147 346169 346187 346201 346207 346217 346223 346259 346261 346277 346303 346309 
-346321 346331 346337 346349 346361 346369 346373 346391 346393 346397 346399 346417 
-346421 346429 346433 346439 346441 346447 346453 346469 346501 346529 346543 346547 
-346553 346559 346561 346589 346601 346607 346627 346639 346649 346651 346657 346667 
-346669 346699 346711 346721 346739 346751 346763 346793 346831 346849 346867 346873 
-346877 346891 346903 346933 346939 346943 346961 346963 347003 347033 347041 347051 
-347057 347059 347063 347069 347071 347099 347129 347131 347141 347143 347161 347167 
-347173 347177 347183 347197 347201 347209 347227 347233 347239 347251 347257 347287 
-347297 347299 347317 347329 347341 347359 347401 347411 347437 347443 347489 347509 
-347513 347519 347533 347539 347561 347563 347579 347587 347591 347609 347621 347629 
-347651 347671 347707 347717 347729 347731 347747 347759 347771 347773 347779 347801 
-347813 347821 347849 347873 347887 347891 347899 347929 347933 347951 347957 347959 
-347969 347981 347983 347987 347989 347993 348001 348011 348017 348031 348043 348053 
-348077 348083 348097 348149 348163 348181 348191 348209 348217 348221 348239 348241 
-348247 348253 348259 348269 348287 348307 348323 348353 348367 348389 348401 348407 
-348419 348421 348431 348433 348437 348443 348451 348457 348461 348463 348487 348527 
-348547 348553 348559 348563 348571 348583 348587 348617 348629 348637 348643 348661 
-348671 348709 348731 348739 348757 348763 348769 348779 348811 348827 348833 348839 
-348851 348883 348889 348911 348917 348919 348923 348937 348949 348989 348991 349007 
-349039 349043 349051 349079 349081 349093 349099 349109 349121 349133 349171 349177 
-349183 349187 349199 349207 349211 349241 349291 349303 349313 349331 349337 349343 
-349357 349369 349373 349379 349381 349387 349397 349399 349403 349409 349411 349423 
-349471 349477 349483 349493 349499 349507 349519 349529 349553 349567 349579 349589 
-349603 349637 349663 349667 349697 349709 349717 349729 349753 349759 349787 349793 
-349801 349813 349819 349829 349831 349837 349841 349849 349871 349903 349907 349913 
-349919 349927 349931 349933 349939 349949 349963 349967 349981 350003 350029 350033 
-350039 350087 350089 350093 350107 350111 350137 350159 350179 350191 350213 350219 
-350237 350249 350257 350281 350293 350347 350351 350377 350381 350411 350423 350429 
-350431 350437 350443 350447 350453 350459 350503 350521 350549 350561 350563 350587 
-350593 350617 350621 350629 350657 350663 350677 350699 350711 350719 350729 350731 
-350737 350741 350747 350767 350771 350783 350789 350803 350809 350843 350851 350869 
-350881 350887 350891 350899 350941 350947 350963 350971 350981 350983 350989 351011 
-351023 351031 351037 351041 351047 351053 351059 351061 351077 351079 351097 351121 
-351133 351151 351157 351179 351217 351223 351229 351257 351259 351269 351287 351289 
-351293 351301 351311 351341 351343 351347 351359 351361 351383 351391 351397 351401 
-351413 351427 351437 351457 351469 351479 351497 351503 351517 351529 351551 351563 
-351587 351599 351643 351653 351661 351667 351691 351707 351727 351731 351733 351749 
-351751 351763 351773 351779 351797 351803 351811 351829 351847 351851 351859 351863 
-351887 351913 351919 351929 351931 351959 351971 351991 352007 352021 352043 352049 
-352057 352069 352073 352081 352097 352109 352111 352123 352133 352181 352193 352201 
-352217 352229 352237 352249 352267 352271 352273 352301 352309 352327 352333 352349 
-352357 352361 352367 352369 352381 352399 352403 352409 352411 352421 352423 352441 
-352459 352463 352481 352483 352489 352493 352511 352523 352543 352549 352579 352589 
-352601 352607 352619 352633 352637 352661 352691 352711 352739 352741 352753 352757 
-352771 352813 352817 352819 352831 352837 352841 352853 352867 352883 352907 352909 
-352931 352939 352949 352951 352973 352991 353011 353021 353047 353053 353057 353069 
-353081 353099 353117 353123 353137 353147 353149 353161 353173 353179 353201 353203 
-353237 353263 353293 353317 353321 353329 353333 353341 353359 353389 353401 353411 
-353429 353443 353453 353459 353471 353473 353489 353501 353527 353531 353557 353567 
-353603 353611 353621 353627 353629 353641 353653 353657 353677 353681 353687 353699 
-353711 353737 353747 353767 353777 353783 353797 353807 353813 353819 353833 353867 
-353869 353879 353891 353897 353911 353917 353921 353929 353939 353963 354001 354007 
-354017 354023 354031 354037 354041 354043 354047 354073 354091 354097 354121 354139 
-354143 354149 354163 354169 354181 354209 354247 354251 354253 354257 354259 354271 
-354301 354307 354313 354317 354323 354329 354337 354353 354371 354373 354377 354383 
-354391 354401 354421 354439 354443 354451 354461 354463 354469 354479 354533 354539 
-354551 354553 354581 354587 354619 354643 354647 354661 354667 354677 354689 354701 
-354703 354727 354737 354743 354751 354763 354779 354791 354799 354829 354833 354839 
-354847 354869 354877 354881 354883 354911 354953 354961 354971 354973 354979 354983 
-354997 355007 355009 355027 355031 355037 355039 355049 355057 355063 355073 355087 
-355093 355099 355109 355111 355127 355139 355171 355193 355211 355261 355297 355307 
-355321 355331 355339 355343 355361 355363 355379 355417 355427 355441 355457 355463 
-355483 355499 355501 355507 355513 355517 355519 355529 355541 355549 355559 355571 
-355573 355591 355609 355633 355643 355651 355669 355679 355697 355717 355721 355723 
-355753 355763 355777 355783 355799 355811 355819 355841 355847 355853 355867 355891 
-355909 355913 355933 355937 355939 355951 355967 355969 356023 356039 356077 356093 
-356101 356113 356123 356129 356137 356141 356143 356171 356173 356197 356219 356243 
-356261 356263 356287 356299 356311 356327 356333 356351 356387 356399 356441 356443 
-356449 356453 356467 356479 356501 356509 356533 356549 356561 356563 356567 356579 
-356591 356621 356647 356663 356693 356701 356731 356737 356749 356761 356803 356819 
-356821 356831 356869 356887 356893 356927 356929 356933 356947 356959 356969 356977 
-356981 356989 356999 357031 357047 357073 357079 357083 357103 357107 357109 357131 
-357139 357169 357179 357197 357199 357211 357229 357239 357241 357263 357271 357281 
-357283 357293 357319 357347 357349 357353 357359 357377 357389 357421 357431 357437 
-357473 357503 357509 357517 357551 357559 357563 357569 357571 357583 357587 357593 
-357611 357613 357619 357649 357653 357659 357661 357667 357671 357677 357683 357689 
-357703 357727 357733 357737 357739 357767 357779 357781 357787 357793 357809 357817 
-357823 357829 357839 357859 357883 357913 357967 357977 357983 357989 357997 358031 
-358051 358069 358073 358079 358103 358109 358153 358157 358159 358181 358201 358213 
-358219 358223 358229 358243 358273 358277 358279 358289 358291 358297 358301 358313 
-358327 358331 358349 358373 358417 358427 358429 358441 358447 358459 358471 358483 
-358487 358499 358531 358541 358571 358573 358591 358597 358601 358607 358613 358637 
-358667 358669 358681 358691 358697 358703 358711 358723 358727 358733 358747 358753 
-358769 358783 358793 358811 358829 358847 358859 358861 358867 358877 358879 358901 
-358903 358907 358909 358931 358951 358973 358979 358987 358993 358999 359003 359017 
-359027 359041 359063 359069 359101 359111 359129 359137 359143 359147 359153 359167 
-359171 359207 359209 359231 359243 359263 359267 359279 359291 359297 359299 359311 
-359323 359327 359353 359357 359377 359389 359407 359417 359419 359441 359449 359477 
-359479 359483 359501 359509 359539 359549 359561 359563 359581 359587 359599 359621 
-359633 359641 359657 359663 359701 359713 359719 359731 359747 359753 359761 359767 
-359783 359837 359851 359869 359897 359911 359929 359981 359987 360007 360023 360037 
-360049 360053 360071 360089 360091 360163 360167 360169 360181 360187 360193 360197 
-360223 360229 360233 360257 360271 360277 360287 360289 360293 360307 360317 360323 
-360337 360391 360407 360421 360439 360457 360461 360497 360509 360511 360541 360551 
-360589 360593 360611 360637 360649 360653 360749 360769 360779 360781 360803 360817 
-360821 360823 360827 360851 360853 360863 360869 360901 360907 360947 360949 360953 
-360959 360973 360977 360979 360989 361001 361003 361013 361033 361069 361091 361093 
-361111 361159 361183 361211 361213 361217 361219 361223 361237 361241 361271 361279 
-361313 361321 361327 361337 361349 361351 361357 361363 361373 361409 361411 361421 
-361433 361441 361447 361451 361463 361469 361481 361499 361507 361511 361523 361531 
-361541 361549 361561 361577 361637 361643 361649 361651 361663 361679 361687 361723 
-361727 361747 361763 361769 361787 361789 361793 361799 361807 361843 361871 361873 
-361877 361901 361903 361909 361919 361927 361943 361961 361967 361973 361979 361993 
-362003 362027 362051 362053 362059 362069 362081 362093 362099 362107 362137 362143 
-362147 362161 362177 362191 362203 362213 362221 362233 362237 362281 362291 362293 
-362303 362309 362333 362339 362347 362353 362357 362363 362371 362377 362381 362393 
-362407 362419 362429 362431 362443 362449 362459 362473 362521 362561 362569 362581 
-362599 362629 362633 362657 362693 362707 362717 362723 362741 362743 362749 362753 
-362759 362801 362851 362863 362867 362897 362903 362911 362927 362941 362951 362953 
-362969 362977 362983 362987 363017 363019 363037 363043 363047 363059 363061 363067 
-363119 363149 363151 363157 363161 363173 363179 363199 363211 363217 363257 363269 
-363271 363277 363313 363317 363329 363343 363359 363361 363367 363371 363373 363379 
-363397 363401 363403 363431 363437 363439 363463 363481 363491 363497 363523 363529 
-363533 363541 363551 363557 363563 363569 363577 363581 363589 363611 363619 363659 
-363677 363683 363691 363719 363731 363751 363757 363761 363767 363773 363799 363809 
-363829 363833 363841 363871 363887 363889 363901 363911 363917 363941 363947 363949 
-363959 363967 363977 363989 364027 364031 364069 364073 364079 364103 364127 364129 
-364141 364171 364183 364187 364193 364213 364223 364241 364267 364271 364289 364291 
-364303 364313 364321 364333 364337 364349 364373 364379 364393 364411 364417 364423 
-364433 364447 364451 364459 364471 364499 364513 364523 364537 364541 364543 364571 
-364583 364601 364607 364621 364627 364643 364657 364669 364687 364691 364699 364717 
-364739 364747 364751 364753 364759 364801 364829 364853 364873 364879 364883 364891 
-364909 364919 364921 364937 364943 364961 364979 364993 364997 365003 365017 365021 
-365039 365063 365069 365089 365107 365119 365129 365137 365147 365159 365173 365179 
-365201 365213 365231 365249 365251 365257 365291 365293 365297 365303 365327 365333 
-365357 365369 365377 365411 365413 365419 365423 365441 365461 365467 365471 365473 
-365479 365489 365507 365509 365513 365527 365531 365537 365557 365567 365569 365587 
-365591 365611 365627 365639 365641 365669 365683 365689 365699 365747 365749 365759 
-365773 365779 365791 365797 365809 365837 365839 365851 365903 365929 365933 365941 
-365969 365983 366001 366013 366019 366029 366031 366053 366077 366097 366103 366127 
-366133 366139 366161 366167 366169 366173 366181 366193 366199 366211 366217 366221 
-366227 366239 366259 366269 366277 366287 366293 366307 366313 366329 366341 366343 
-366347 366383 366397 366409 366419 366433 366437 366439 366461 366463 366467 366479 
-366497 366511 366517 366521 366547 366593 366599 366607 366631 366677 366683 366697 
-366701 366703 366713 366721 366727 366733 366787 366791 366811 366829 366841 366851 
-366853 366859 366869 366881 366889 366901 366907 366917 366923 366941 366953 366967 
-366973 366983 366997 367001 367007 367019 367021 367027 367033 367049 367069 367097 
-367121 367123 367127 367139 367163 367181 367189 367201 367207 367219 367229 367231 
-367243 367259 367261 367273 367277 367307 367309 367313 367321 367357 367369 367391 
-367397 367427 367453 367457 367469 367501 367519 367531 367541 367547 367559 367561 
-367573 367597 367603 367613 367621 367637 367649 367651 367663 367673 367687 367699 
-367711 367721 367733 367739 367751 367771 367777 367781 367789 367819 367823 367831 
-367841 367849 367853 367867 367879 367883 367889 367909 367949 367957 368021 368029 
-368047 368059 368077 368083 368089 368099 368107 368111 368117 368129 368141 368149 
-368153 368171 368189 368197 368227 368231 368233 368243 368273 368279 368287 368293 
-368323 368327 368359 368363 368369 368399 368411 368443 368447 368453 368471 368491 
-368507 368513 368521 368531 368539 368551 368579 368593 368597 368609 368633 368647 
-368651 368653 368689 368717 368729 368737 368743 368773 368783 368789 368791 368801 
-368803 368833 368857 368873 368881 368899 368911 368939 368947 368957 369007 369013 
-369023 369029 369067 369071 369077 369079 369097 369119 369133 369137 369143 369169 
-369181 369191 369197 369211 369247 369253 369263 369269 369283 369293 369301 369319 
-369331 369353 369361 369407 369409 369419 369469 369487 369491 369539 369553 369557 
-369581 369637 369647 369659 369661 369673 369703 369709 369731 369739 369751 369791 
-369793 369821 369827 369829 369833 369841 369851 369877 369893 369913 369917 369947 
-369959 369961 369979 369983 369991 369997 370003 370009 370021 370033 370057 370061 
-370067 370081 370091 370103 370121 370133 370147 370159 370169 370193 370199 370207 
-370213 370217 370241 370247 370261 370373 370387 370399 370411 370421 370423 370427 
-370439 370441 370451 370463 370471 370477 370483 370493 370511 370529 370537 370547 
-370561 370571 370597 370603 370609 370613 370619 370631 370661 370663 370673 370679 
-370687 370693 370723 370759 370793 370801 370813 370837 370871 370873 370879 370883 
-370891 370897 370919 370949 371027 371029 371057 371069 371071 371083 371087 371099 
-371131 371141 371143 371153 371177 371179 371191 371213 371227 371233 371237 371249 
-371251 371257 371281 371291 371299 371303 371311 371321 371333 371339 371341 371353 
-371359 371383 371387 371389 371417 371447 371453 371471 371479 371491 371509 371513 
-371549 371561 371573 371587 371617 371627 371633 371639 371663 371669 371699 371719 
-371737 371779 371797 371831 371837 371843 371851 371857 371869 371873 371897 371927 
-371929 371939 371941 371951 371957 371971 371981 371999 372013 372023 372037 372049 
-372059 372061 372067 372107 372121 372131 372137 372149 372167 372173 372179 372223 
-372241 372263 372269 372271 372277 372289 372293 372299 372311 372313 372353 372367 
-372371 372377 372397 372401 372409 372413 372443 372451 372461 372473 372481 372497 
-372511 372523 372539 372607 372611 372613 372629 372637 372653 372661 372667 372677 
-372689 372707 372709 372719 372733 372739 372751 372763 372769 372773 372797 372803 
-372809 372817 372829 372833 372839 372847 372859 372871 372877 372881 372901 372917 
-372941 372943 372971 372973 372979 373003 373007 373019 373049 373063 373073 373091 
-373127 373151 373157 373171 373181 373183 373187 373193 373199 373207 373211 373213 
-373229 373231 373273 373291 373297 373301 373327 373339 373343 373349 373357 373361 
-373363 373379 373393 373447 373453 373459 373463 373487 373489 373501 373517 373553 
-373561 373567 373613 373621 373631 373649 373657 373661 373669 373693 373717 373721 
-373753 373757 373777 373783 373823 373837 373859 373861 373903 373909 373937 373943 
-373951 373963 373969 373981 373987 373999 374009 374029 374039 374041 374047 374063 
-374069 374083 374089 374093 374111 374117 374123 374137 374149 374159 374173 374177 
-374189 374203 374219 374239 374287 374291 374293 374299 374317 374321 374333 374347 
-374351 374359 374389 374399 374441 374443 374447 374461 374483 374501 374531 374537 
-374557 374587 374603 374639 374641 374653 374669 374677 374681 374683 374687 374701 
-374713 374719 374729 374741 374753 374761 374771 374783 374789 374797 374807 374819 
-374837 374839 374849 374879 374887 374893 374903 374909 374929 374939 374953 374977 
-374981 374987 374989 374993 375017 375019 375029 375043 375049 375059 375083 375091 
-375097 375101 375103 375113 375119 375121 375127 375149 375157 375163 375169 375203 
-375209 375223 375227 375233 375247 375251 375253 375257 375259 375281 375283 375311 
-375341 375359 375367 375371 375373 375391 375407 375413 375443 375449 375451 375457 
-375467 375481 375509 375511 375523 375527 375533 375553 375559 375563 375569 375593 
-375607 375623 375631 375643 375647 375667 375673 375703 375707 375709 375743 375757 
-375761 375773 375779 375787 375799 375833 375841 375857 375899 375901 375923 375931 
-375967 375971 375979 375983 375997 376001 376003 376009 376021 376039 376049 376063 
-376081 376097 376099 376127 376133 376147 376153 376171 376183 376199 376231 376237 
-376241 376283 376291 376297 376307 376351 376373 376393 376399 376417 376463 376469 
-376471 376477 376483 376501 376511 376529 376531 376547 376573 376577 376583 376589 
-376603 376609 376627 376631 376633 376639 376657 376679 376687 376699 376709 376721 
-376729 376757 376759 376769 376787 376793 376801 376807 376811 376819 376823 376837 
-376841 376847 376853 376889 376891 376897 376921 376927 376931 376933 376949 376963 
-376969 377011 377021 377051 377059 377071 377099 377123 377129 377137 377147 377171 
-377173 377183 377197 377219 377231 377257 377263 377287 377291 377297 377327 377329 
-377339 377347 377353 377369 377371 377387 377393 377459 377471 377477 377491 377513 
-377521 377527 377537 377543 377557 377561 377563 377581 377593 377599 377617 377623 
-377633 377653 377681 377687 377711 377717 377737 377749 377761 377771 377779 377789 
-377801 377809 377827 377831 377843 377851 377873 377887 377911 377963 377981 377999 
-378011 378019 378023 378041 378071 378083 378089 378101 378127 378137 378149 378151 
-378163 378167 378179 378193 378223 378229 378239 378241 378253 378269 378277 378283 
-378289 378317 378353 378361 378379 378401 378407 378439 378449 378463 378467 378493 
-378503 378509 378523 378533 378551 378559 378569 378571 378583 378593 378601 378619 
-378629 378661 378667 378671 378683 378691 378713 378733 378739 378757 378761 378779 
-378793 378809 378817 378821 378823 378869 378883 378893 378901 378919 378929 378941 
-378949 378953 378967 378977 378997 379007 379009 379013 379033 379039 379073 379081 
-379087 379097 379103 379123 379133 379147 379157 379163 379177 379187 379189 379199 
-379207 379273 379277 379283 379289 379307 379319 379333 379343 379369 379387 379391 
-379397 379399 379417 379433 379439 379441 379451 379459 379499 379501 379513 379531 
-379541 379549 379571 379573 379579 379597 379607 379633 379649 379663 379667 379679 
-379681 379693 379699 379703 379721 379723 379727 379751 379777 379787 379811 379817 
-379837 379849 379853 379859 379877 379889 379903 379909 379913 379927 379931 379963 
-379979 379993 379997 379999 380041 380047 380059 380071 380117 380129 380131 380141 
-380147 380179 380189 380197 380201 380203 380207 380231 380251 380267 380269 380287 
-380291 380299 380309 380311 380327 380329 380333 380363 380377 380383 380417 380423 
-380441 380447 380453 380459 380461 380483 380503 380533 380557 380563 380591 380621 
-380623 380629 380641 380651 380657 380707 380713 380729 380753 380777 380797 380803 
-380819 380837 380839 380843 380867 380869 380879 380881 380909 380917 380929 380951 
-380957 380971 380977 380983 381001 381011 381019 381037 381047 381061 381071 381077 
-381097 381103 381167 381169 381181 381209 381221 381223 381233 381239 381253 381287 
-381289 381301 381319 381323 381343 381347 381371 381373 381377 381383 381389 381401 
-381413 381419 381439 381443 381461 381467 381481 381487 381509 381523 381527 381529 
-381533 381541 381559 381569 381607 381629 381631 381637 381659 381673 381697 381707 
-381713 381737 381739 381749 381757 381761 381791 381793 381817 381841 381853 381859 
-381911 381917 381937 381943 381949 381977 381989 381991 382001 382003 382021 382037 
-382061 382069 382073 382087 382103 382117 382163 382171 382189 382229 382231 382241 
-382253 382267 382271 382303 382331 382351 382357 382363 382373 382391 382427 382429 
-382457 382463 382493 382507 382511 382519 382541 382549 382553 382567 382579 382583 
-382589 382601 382621 382631 382643 382649 382661 382663 382693 382703 382709 382727 
-382729 382747 382751 382763 382769 382777 382801 382807 382813 382843 382847 382861 
-382867 382871 382873 382883 382919 382933 382939 382961 382979 382999 383011 383023 
-383029 383041 383051 383069 383077 383081 383083 383099 383101 383107 383113 383143 
-383147 383153 383171 383179 383219 383221 383261 383267 383281 383291 383297 383303 
-383321 383347 383371 383393 383399 383417 383419 383429 383459 383483 383489 383519 
-383521 383527 383533 383549 383557 383573 383587 383609 383611 383623 383627 383633 
-383651 383657 383659 383681 383683 383693 383723 383729 383753 383759 383767 383777 
-383791 383797 383807 383813 383821 383833 383837 383839 383869 383891 383909 383917 
-383923 383941 383951 383963 383969 383983 383987 384001 384017 384029 384049 384061 
-384067 384079 384089 384107 384113 384133 384143 384151 384157 384173 384187 384193 
-384203 384227 384247 384253 384257 384259 384277 384287 384289 384299 384301 384317 
-384331 384343 384359 384367 384383 384403 384407 384437 384469 384473 384479 384481 
-384487 384497 384509 384533 384547 384577 384581 384589 384599 384611 384619 384623 
-384641 384673 384691 384697 384701 384719 384733 384737 384751 384757 384773 384779 
-384817 384821 384827 384841 384847 384851 384889 384907 384913 384919 384941 384961 
-384973 385001 385013 385027 385039 385057 385069 385079 385081 385087 385109 385127 
-385129 385139 385141 385153 385159 385171 385193 385199 385223 385249 385261 385267 
-385279 385289 385291 385321 385327 385331 385351 385379 385391 385393 385397 385403 
-385417 385433 385471 385481 385493 385501 385519 385531 385537 385559 385571 385573 
-385579 385589 385591 385597 385607 385621 385631 385639 385657 385661 385663 385709 
-385739 385741 385771 385783 385793 385811 385817 385831 385837 385843 385859 385877 
-385897 385901 385907 385927 385939 385943 385967 385991 385997 386017 386039 386041 
-386047 386051 386083 386093 386117 386119 386129 386131 386143 386149 386153 386159 
-386161 386173 386219 386227 386233 386237 386249 386263 386279 386297 386299 386303 
-386329 386333 386339 386363 386369 386371 386381 386383 386401 386411 386413 386429 
-386431 386437 386471 386489 386501 386521 386537 386543 386549 386569 386587 386609 
-386611 386621 386629 386641 386647 386651 386677 386689 386693 386713 386719 386723 
-386731 386747 386777 386809 386839 386851 386887 386891 386921 386927 386963 386977 
-386987 386989 386993 387007 387017 387031 387047 387071 387077 387083 387089 387109 
-387137 387151 387161 387169 387173 387187 387197 387199 387203 387227 387253 387263 
-387269 387281 387307 387313 387329 387341 387371 387397 387403 387433 387437 387449 
-387463 387493 387503 387509 387529 387551 387577 387587 387613 387623 387631 387641 
-387659 387677 387679 387683 387707 387721 387727 387743 387749 387763 387781 387791 
-387799 387839 387853 387857 387911 387913 387917 387953 387967 387971 387973 387977 
-388009 388051 388057 388067 388081 388099 388109 388111 388117 388133 388159 388163 
-388169 388177 388181 388183 388187 388211 388231 388237 388253 388259 388273 388277 
-388301 388313 388319 388351 388363 388369 388373 388391 388403 388459 388471 388477 
-388481 388483 388489 388499 388519 388529 388541 388567 388573 388621 388651 388657 
-388673 388691 388693 388697 388699 388711 388727 388757 388777 388781 388789 388793 
-388813 388823 388837 388859 388879 388891 388897 388901 388903 388931 388933 388937 
-388961 388963 388991 389003 389023 389027 389029 389041 389047 389057 389083 389089 
-389099 389111 389117 389141 389149 389161 389167 389171 389173 389189 389219 389227 
-389231 389269 389273 389287 389297 389299 389303 389357 389369 389381 389399 389401 
-389437 389447 389461 389479 389483 389507 389513 389527 389531 389533 389539 389561 
-389563 389567 389569 389579 389591 389621 389629 389651 389659 389663 389687 389699 
-389713 389723 389743 389749 389761 389773 389783 389791 389797 389819 389839 389849 
-389867 389891 389897 389903 389911 389923 389927 389941 389947 389953 389957 389971 
-389981 389989 389999 390001 390043 390067 390077 390083 390097 390101 390107 390109 
-390113 390119 390151 390157 390161 390191 390193 390199 390209 390211 390223 390263 
-390281 390289 390307 390323 390343 390347 390353 390359 390367 390373 390389 390391 
-390407 390413 390419 390421 390433 390437 390449 390463 390479 390487 390491 390493 
-390499 390503 390527 390539 390553 390581 390647 390653 390671 390673 390703 390707 
-390721 390727 390737 390739 390743 390751 390763 390781 390791 390809 390821 390829 
-390851 390869 390877 390883 390889 390893 390953 390959 390961 390967 390989 390991 
-391009 391019 391021 391031 391049 391057 391063 391067 391073 391103 391117 391133 
-391151 391159 391163 391177 391199 391217 391219 391231 391247 391249 391273 391283 
-391291 391301 391331 391337 391351 391367 391373 391379 391387 391393 391397 391399 
-391403 391441 391451 391453 391487 391519 391537 391553 391579 391613 391619 391627 
-391631 391639 391661 391679 391691 391693 391711 391717 391733 391739 391751 391753 
-391757 391789 391801 391817 391823 391847 391861 391873 391879 391889 391891 391903 
-391907 391921 391939 391961 391967 391987 391999 392011 392033 392053 392059 392069 
-392087 392099 392101 392111 392113 392131 392143 392149 392153 392159 392177 392201 
-392209 392213 392221 392233 392239 392251 392261 392263 392267 392269 392279 392281 
-392297 392299 392321 392333 392339 392347 392351 392363 392383 392389 392423 392437 
-392443 392467 392473 392477 392489 392503 392519 392531 392543 392549 392569 392593 
-392599 392611 392629 392647 392663 392669 392699 392723 392737 392741 392759 392761 
-392767 392803 392807 392809 392827 392831 392837 392849 392851 392857 392879 392893 
-392911 392923 392927 392929 392957 392963 392969 392981 392983 393007 393013 393017 
-393031 393059 393073 393077 393079 393083 393097 393103 393109 393121 393137 393143 
-393157 393161 393181 393187 393191 393203 393209 393241 393247 393257 393271 393287 
-393299 393301 393311 393331 393361 393373 393377 393383 393401 393403 393413 393451 
-393473 393479 393487 393517 393521 393539 393541 393551 393557 393571 393577 393581 
-393583 393587 393593 393611 393629 393637 393649 393667 393671 393677 393683 393697 
-393709 393713 393721 393727 393739 393749 393761 393779 393797 393847 393853 393857 
-393859 393863 393871 393901 393919 393929 393931 393947 393961 393977 393989 393997 
-394007 394019 394039 394049 394063 394073 394099 394123 394129 394153 394157 394169 
-394187 394201 394211 394223 394241 394249 394259 394271 394291 394319 394327 394357 
-394363 394367 394369 394393 394409 394411 394453 394481 394489 394501 394507 394523 
-394529 394549 394571 394577 394579 394601 394619 394631 394633 394637 394643 394673 
-394699 394717 394721 394727 394729 394733 394739 394747 394759 394787 394811 394813 
-394817 394819 394829 394837 394861 394879 394897 394931 394943 394963 394967 394969 
-394981 394987 394993 395023 395027 395039 395047 395069 395089 395093 395107 395111 
-395113 395119 395137 395141 395147 395159 395173 395189 395191 395201 395231 395243 
-395251 395261 395273 395287 395293 395303 395309 395321 395323 395377 395383 395407 
-395429 395431 395443 395449 395453 395459 395491 395509 395513 395533 395537 395543 
-395581 395597 395611 395621 395627 395657 395671 395677 395687 395701 395719 395737 
-395741 395749 395767 395803 395849 395851 395873 395887 395891 395897 395909 395921 
-395953 395959 395971 396001 396029 396031 396041 396043 396061 396079 396091 396103 
-396107 396119 396157 396173 396181 396197 396199 396203 396217 396239 396247 396259 
-396269 396293 396299 396301 396311 396323 396349 396353 396373 396377 396379 396413 
-396427 396437 396443 396449 396479 396509 396523 396527 396533 396541 396547 396563 
-396577 396581 396601 396619 396623 396629 396631 396637 396647 396667 396679 396703 
-396709 396713 396719 396733 396833 396871 396881 396883 396887 396919 396931 396937 
-396943 396947 396953 396971 396983 396997 397013 397027 397037 397051 397057 397063 
-397073 397093 397099 397127 397151 397153 397181 397183 397211 397217 397223 397237 
-397253 397259 397283 397289 397297 397301 397303 397337 397351 397357 397361 397373 
-397379 397427 397429 397433 397459 397469 397489 397493 397517 397519 397541 397543 
-397547 397549 397567 397589 397591 397597 397633 397643 397673 397687 397697 397721 
-397723 397729 397751 397753 397757 397759 397763 397799 397807 397811 397829 397849 
-397867 397897 397907 397921 397939 397951 397963 397973 397981 398011 398023 398029 
-398033 398039 398053 398059 398063 398077 398087 398113 398117 398119 398129 398143 
-398149 398171 398207 398213 398219 398227 398249 398261 398267 398273 398287 398303 
-398311 398323 398339 398341 398347 398353 398357 398369 398393 398407 398417 398423 
-398441 398459 398467 398471 398473 398477 398491 398509 398539 398543 398549 398557 
-398569 398581 398591 398609 398611 398621 398627 398669 398681 398683 398693 398711 
-398729 398731 398759 398771 398813 398819 398821 398833 398857 398863 398887 398903 
-398917 398921 398933 398941 398969 398977 398989 399023 399031 399043 399059 399067 
-399071 399079 399097 399101 399107 399131 399137 399149 399151 399163 399173 399181 
-399197 399221 399227 399239 399241 399263 399271 399277 399281 399283 399353 399379 
-399389 399391 399401 399403 399409 399433 399439 399473 399481 399491 399493 399499 
-399523 399527 399541 399557 399571 399577 399583 399587 399601 399613 399617 399643 
-399647 399667 399677 399689 399691 399719 399727 399731 399739 399757 399761 399769 
-399781 399787 399793 399851 399853 399871 399887 399899 399911 399913 399937 399941 
-399953 399979 399983 399989 400009 400031 400033 400051 400067 400069 400087 400093 
-400109 400123 400151 400157 400187 400199 400207 400217 400237 400243 400247 400249 
-400261 400277 400291 400297 400307 400313 400321 400331 400339 400381 400391 400409 
-400417 400429 400441 400457 400471 400481 400523 400559 400579 400597 400601 400607 
-400619 400643 400651 400657 400679 400681 400703 400711 400721 400723 400739 400753 
-400759 400823 400837 400849 400853 400859 400871 400903 400927 400931 400943 400949 
-400963 400997 401017 401029 401039 401053 401057 401069 401077 401087 401101 401113 
-401119 401161 401173 401179 401201 401209 401231 401237 401243 401279 401287 401309 
-401311 401321 401329 401341 401347 401371 401381 401393 401407 401411 401417 401473 
-401477 401507 401519 401537 401539 401551 401567 401587 401593 401627 401629 401651 
-401669 401671 401689 401707 401711 401743 401771 401773 401809 401813 401827 401839 
-401861 401867 401887 401903 401909 401917 401939 401953 401957 401959 401981 401987 
-401993 402023 402029 402037 402043 402049 402053 402071 402089 402091 402107 402131 
-402133 402137 402139 402197 402221 402223 402239 402253 402263 402277 402299 402307 
-402313 402329 402331 402341 402343 402359 402361 402371 402379 402383 402403 402419 
-402443 402487 402503 402511 402517 402527 402529 402541 402551 402559 402581 402583 
-402587 402593 402601 402613 402631 402691 402697 402739 402751 402757 402761 402763 
-402767 402769 402797 402803 402817 402823 402847 402851 402859 402863 402869 402881 
-402923 402943 402947 402949 402991 403001 403003 403037 403043 403049 403057 403061 
-403063 403079 403097 403103 403133 403141 403159 403163 403181 403219 403241 403243 
-403253 403261 403267 403289 403301 403309 403327 403331 403339 403363 403369 403387 
-403391 403433 403439 403483 403499 403511 403537 403547 403549 403553 403567 403577 
-403591 403603 403607 403621 403649 403661 403679 403681 403687 403703 403717 403721 
-403729 403757 403783 403787 403817 403829 403831 403849 403861 403867 403877 403889 
-403901 403933 403951 403957 403969 403979 403981 403993 404009 404011 404017 404021 
-404029 404051 404081 404099 404113 404119 404123 404161 404167 404177 404189 404191 
-404197 404213 404221 404249 404251 404267 404269 404273 404291 404309 404321 404323 
-404357 404381 404387 404389 404399 404419 404423 404429 404431 404449 404461 404483 
-404489 404497 404507 404513 404527 404531 404533 404539 404557 404597 404671 404693 
-404699 404713 404773 404779 404783 404819 404827 404837 404843 404849 404851 404941 
-404951 404959 404969 404977 404981 404983 405001 405011 405029 405037 405047 405049 
-405071 405073 405089 405091 405143 405157 405179 405199 405211 405221 405227 405239 
-405241 405247 405253 405269 405277 405287 405299 405323 405341 405343 405347 405373 
-405401 405407 405413 405437 405439 405473 405487 405491 405497 405499 405521 405527 
-405529 405541 405553 405577 405599 405607 405611 405641 405659 405667 405677 405679 
-405683 405689 405701 405703 405709 405719 405731 405749 405763 405767 405781 405799 
-405817 405827 405829 405857 405863 405869 405871 405893 405901 405917 405947 405949 
-405959 405967 405989 405991 405997 406013 406027 406037 406067 406073 406093 406117 
-406123 406169 406171 406177 406183 406207 406247 406253 406267 406271 406309 406313 
-406327 406331 406339 406349 406361 406381 406397 406403 406423 406447 406481 406499 
-406501 406507 406513 406517 406531 406547 406559 406561 406573 406577 406579 406583 
-406591 406631 406633 406649 406661 406673 406697 406699 406717 406729 406739 406789 
-406807 406811 406817 406837 406859 406873 406883 406907 406951 406969 406981 406993 
-407023 407047 407059 407083 407119 407137 407149 407153 407177 407179 407191 407203 
-407207 407219 407221 407233 407249 407257 407263 407273 407287 407291 407299 407311 
-407317 407321 407347 407357 407359 407369 407377 407383 407401 407437 407471 407483 
-407489 407501 407503 407509 407521 407527 407567 407573 407579 407587 407599 407621 
-407633 407639 407651 407657 407669 407699 407707 407713 407717 407723 407741 407747 
-407783 407789 407791 407801 407807 407821 407833 407843 407857 407861 407879 407893 
-407899 407917 407923 407947 407959 407969 407971 407977 407993 408011 408019 408041 
-408049 408071 408077 408091 408127 408131 408137 408169 408173 408197 408203 408209 
-408211 408217 408223 408229 408241 408251 408263 408271 408283 408311 408337 408341 
-408347 408361 408379 408389 408403 408413 408427 408431 408433 408437 408461 408469 
-408479 408491 408497 408533 408539 408553 408563 408607 408623 408631 408637 408643 
-408659 408677 408689 408691 408701 408703 408713 408719 408743 408763 408769 408773 
-408787 408803 408809 408817 408841 408857 408869 408911 408913 408923 408943 408953 
-408959 408971 408979 408997 409007 409021 409027 409033 409043 409063 409069 409081 
-409099 409121 409153 409163 409177 409187 409217 409237 409259 409261 409267 409271 
-409289 409291 409327 409333 409337 409349 409351 409369 409379 409391 409397 409429 
-409433 409441 409463 409471 409477 409483 409499 409517 409523 409529 409543 409573 
-409579 409589 409597 409609 409639 409657 409691 409693 409709 409711 409723 409729 
-409733 409753 409769 409777 409781 409813 409817 409823 409831 409841 409861 409867 
-409879 409889 409891 409897 409901 409909 409933 409943 409951 409961 409967 409987 
-409993 409999 410009 410029 410063 410087 410093 410117 410119 410141 410143 410149 
-410171 410173 410203 410231 410233 410239 410243 410257 410279 410281 410299 410317 
-410323 410339 410341 410353 410359 410383 410387 410393 410401 410411 410413 410453 
-410461 410477 410489 410491 410497 410507 410513 410519 410551 410561 410587 410617 
-410621 410623 410629 410651 410659 410671 410687 410701 410717 410731 410741 410747 
-410749 410759 410783 410789 410801 410807 410819 410833 410857 410899 410903 410929 
-410953 410983 410999 411001 411007 411011 411013 411031 411041 411049 411067 411071 
-411083 411101 411113 411119 411127 411143 411157 411167 411193 411197 411211 411233 
-411241 411251 411253 411259 411287 411311 411337 411347 411361 411371 411379 411409 
-411421 411443 411449 411469 411473 411479 411491 411503 411527 411529 411557 411563 
-411569 411577 411583 411589 411611 411613 411617 411637 411641 411667 411679 411683 
-411703 411707 411709 411721 411727 411737 411739 411743 411751 411779 411799 411809 
-411821 411823 411833 411841 411883 411919 411923 411937 411941 411947 411967 411991 
-412001 412007 412019 412031 412033 412037 412039 412051 412067 412073 412081 412099 
-412109 412123 412127 412133 412147 412157 412171 412187 412189 412193 412201 412211 
-412213 412219 412249 412253 412273 412277 412289 412303 412333 412339 412343 412387 
-412397 412411 412457 412463 412481 412487 412493 412537 412561 412567 412571 412589 
-412591 412603 412609 412619 412627 412637 412639 412651 412663 412667 412717 412739 
-412771 412793 412807 412831 412849 412859 412891 412901 412903 412939 412943 412949 
-412967 412987 413009 413027 413033 413053 413069 413071 413081 413087 413089 413093 
-413111 413113 413129 413141 413143 413159 413167 413183 413197 413201 413207 413233 
-413243 413251 413263 413267 413293 413299 413353 413411 413417 413429 413443 413461 
-413477 413521 413527 413533 413537 413551 413557 413579 413587 413597 413629 413653 
-413681 413683 413689 413711 413713 413719 413737 413753 413759 413779 413783 413807 
-413827 413849 413863 413867 413869 413879 413887 413911 413923 413951 413981 414013 
-414017 414019 414031 414049 414053 414061 414077 414083 414097 414101 414107 414109 
-414131 414157 414179 414199 414203 414209 414217 414221 414241 414259 414269 414277 
-414283 414311 414313 414329 414331 414347 414361 414367 414383 414389 414397 414413 
-414431 414433 414451 414457 414461 414467 414487 414503 414521 414539 414553 414559 
-414571 414577 414607 414611 414629 414641 414643 414653 414677 414679 414683 414691 
-414697 414703 414707 414709 414721 414731 414737 414763 414767 414769 414773 414779 
-414793 414803 414809 414833 414857 414871 414889 414893 414899 414913 414923 414929 
-414949 414959 414971 414977 414991 415013 415031 415039 415061 415069 415073 415087 
-415097 415109 415111 415133 415141 415147 415153 415159 415171 415187 415189 415201 
-415213 415231 415253 415271 415273 415319 415343 415379 415381 415391 415409 415427 
-415447 415469 415477 415489 415507 415517 415523 415543 415553 415559 415567 415577 
-415603 415607 415609 415627 415631 415643 415651 415661 415669 415673 415687 415691 
-415697 415717 415721 415729 415759 415783 415787 415799 415801 415819 415823 415861 
-415873 415879 415901 415931 415937 415949 415951 415957 415963 415969 415979 415993 
-415999 416011 416023 416071 416077 416089 416107 416147 416149 416153 416159 416167 
-416201 416219 416239 416243 416249 416257 416263 416281 416291 416333 416359 416387 
-416389 416393 416399 416401 416407 416413 416417 416419 416441 416443 416459 416473 
-416477 416491 416497 416501 416503 416513 416531 416543 416573 416579 416593 416621 
-416623 416629 416659 416677 416693 416719 416761 416797 416821 416833 416839 416849 
-416851 416873 416881 416887 416947 416957 416963 416989 417007 417017 417019 417023 
-417037 417089 417097 417113 417119 417127 417133 417161 417169 417173 417181 417187 
-417191 417203 417217 417227 417239 417251 417271 417283 417293 417311 417317 417331 
-417337 417371 417377 417379 417383 417419 417437 417451 417457 417479 417491 417493 
-417509 417511 417523 417541 417553 417559 417577 417581 417583 417617 417623 417631 
-417643 417649 417671 417691 417719 417721 417727 417731 417733 417737 417751 417763 
-417773 417793 417811 417821 417839 417863 417869 417881 417883 417899 417931 417941 
-417947 417953 417959 417961 417983 417997 418007 418009 418027 418031 418043 418051 
-418069 418073 418079 418087 418109 418129 418157 418169 418177 418181 418189 418199 
-418207 418219 418259 418273 418279 418289 418303 418321 418331 418337 418339 418343 
-418349 418351 418357 418373 418381 418391 418423 418427 418447 418459 418471 418493 
-418511 418553 418559 418597 418601 418603 418631 418633 418637 418657 418667 418699 
-418709 418721 418739 418751 418763 418771 418783 418787 418793 418799 418811 418813 
-418819 418837 418843 418849 418861 418867 418871 418883 418889 418909 418921 418927 
-418933 418939 418961 418981 418987 418993 418997 419047 419051 419053 419057 419059 
-419087 419141 419147 419161 419171 419183 419189 419191 419201 419231 419249 419261 
-419281 419291 419297 419303 419317 419329 419351 419383 419401 419417 419423 419429 
-419443 419449 419459 419467 419473 419477 419483 419491 419513 419527 419537 419557 
-419561 419563 419567 419579 419591 419597 419599 419603 419609 419623 419651 419687 
-419693 419701 419711 419743 419753 419777 419789 419791 419801 419803 419821 419827 
-419831 419873 419893 419921 419927 419929 419933 419953 419959 419999 420001 420029 
-420037 420041 420047 420073 420097 420103 420149 420163 420191 420193 420221 420241 
-420253 420263 420269 420271 420293 420307 420313 420317 420319 420323 420331 420341 
-420349 420353 420361 420367 420383 420397 420419 420421 420439 420457 420467 420479 
-420481 420499 420503 420521 420551 420557 420569 420571 420593 420599 420613 420671 
-420677 420683 420691 420731 420737 420743 420757 420769 420779 420781 420799 420803 
-420809 420811 420851 420853 420857 420859 420899 420919 420929 420941 420967 420977 
-420997 421009 421019 421033 421037 421049 421079 421081 421093 421103 421121 421123 
-421133 421147 421159 421163 421177 421181 421189 421207 421241 421273 421279 421303 
-421313 421331 421339 421349 421361 421381 421397 421409 421417 421423 421433 421453 
-421459 421469 421471 421483 421493 421501 421517 421559 421607 421609 421621 421633 
-421639 421643 421657 421661 421691 421697 421699 421703 421709 421711 421717 421727 
-421739 421741 421783 421801 421807 421831 421847 421891 421907 421913 421943 421973 
-421987 421997 422029 422041 422057 422063 422069 422077 422083 422087 422089 422099 
-422101 422111 422113 422129 422137 422141 422183 422203 422209 422231 422239 422243 
-422249 422267 422287 422291 422309 422311 422321 422339 422353 422363 422369 422377 
-422393 422407 422431 422453 422459 422479 422537 422549 422551 422557 422563 422567 
-422573 422581 422621 422627 422657 422689 422701 422707 422711 422749 422753 422759 
-422761 422789 422797 422803 422827 422857 422861 422867 422869 422879 422881 422893 
-422897 422899 422911 422923 422927 422969 422987 423001 423013 423019 423043 423053 
-423061 423067 423083 423091 423097 423103 423109 423121 423127 423133 423173 423179 
-423191 423209 423221 423229 423233 423251 423257 423259 423277 423281 423287 423289 
-423299 423307 423323 423341 423347 423389 423403 423413 423427 423431 423439 423457 
-423461 423463 423469 423481 423497 423503 423509 423541 423547 423557 423559 423581 
-423587 423601 423617 423649 423667 423697 423707 423713 423727 423749 423751 423763 
-423769 423779 423781 423791 423803 423823 423847 423853 423859 423869 423883 423887 
-423931 423949 423961 423977 423989 423991 424001 424003 424007 424019 424027 424037 
-424079 424091 424093 424103 424117 424121 424129 424139 424147 424157 424163 424169 
-424187 424199 424223 424231 424243 424247 424261 424267 424271 424273 424313 424331 
-424339 424343 424351 424397 424423 424429 424433 424451 424471 424481 424493 424519 
-424537 424547 424549 424559 424573 424577 424597 424601 424639 424661 424667 424679 
-424687 424693 424709 424727 424729 424757 424769 424771 424777 424811 424817 424819 
-424829 424841 424843 424849 424861 424867 424889 424891 424903 424909 424913 424939 
-424961 424967 424997 425003 425027 425039 425057 425059 425071 425083 425101 425107 
-425123 425147 425149 425189 425197 425207 425233 425237 425251 425273 425279 425281 
-425291 425297 425309 425317 425329 425333 425363 425377 425387 425393 425417 425419 
-425423 425441 425443 425471 425473 425489 425501 425519 425521 425533 425549 425563 
-425591 425603 425609 425641 425653 425681 425701 425713 425779 425783 425791 425801 
-425813 425819 425837 425839 425851 425857 425861 425869 425879 425899 425903 425911 
-425939 425959 425977 425987 425989 426007 426011 426061 426073 426077 426089 426091 
-426103 426131 426161 426163 426193 426197 426211 426229 426233 426253 426287 426301 
-426311 426319 426331 426353 426383 426389 426401 426407 426421 426427 426469 426487 
-426527 426541 426551 426553 426563 426583 426611 426631 426637 426641 426661 426691 
-426697 426707 426709 426731 426737 426739 426743 426757 426761 426763 426773 426779 
-426787 426799 426841 426859 426863 426871 426889 426893 426913 426917 426919 426931 
-426941 426971 426973 426997 427001 427013 427039 427043 427067 427069 427073 427079 
-427081 427103 427117 427151 427169 427181 427213 427237 427241 427243 427247 427249 
-427279 427283 427307 427309 427327 427333 427351 427369 427379 427381 427403 427417 
-427421 427423 427429 427433 427439 427447 427451 427457 427477 427513 427517 427523 
-427529 427541 427579 427591 427597 427619 427621 427681 427711 427717 427723 427727 
-427733 427751 427781 427787 427789 427813 427849 427859 427877 427879 427883 427913 
-427919 427939 427949 427951 427957 427967 427969 427991 427993 427997 428003 428023 
-428027 428033 428039 428041 428047 428083 428093 428137 428143 428147 428149 428161 
-428167 428173 428177 428221 428227 428231 428249 428251 428273 428297 428299 428303 
-428339 428353 428369 428401 428411 428429 428471 428473 428489 428503 428509 428531 
-428539 428551 428557 428563 428567 428569 428579 428629 428633 428639 428657 428663 
-428671 428677 428683 428693 428731 428741 428759 428777 428797 428801 428807 428809 
-428833 428843 428851 428863 428873 428899 428951 428957 428977 429007 429017 429043 
-429083 429101 429109 429119 429127 429137 429139 429161 429181 429197 429211 429217 
-429223 429227 429241 429259 429271 429277 429281 429283 429329 429347 429349 429361 
-429367 429389 429397 429409 429413 429427 429431 429449 429463 429467 429469 429487 
-429497 429503 429509 429511 429521 429529 429547 429551 429563 429581 429587 429589 
-429599 429631 429643 429659 429661 429673 429677 429679 429683 429701 429719 429727 
-429731 429733 429773 429791 429797 429817 429823 429827 429851 429853 429881 429887 
-429889 429899 429901 429907 429911 429917 429929 429931 429937 429943 429953 429971 
-429973 429991 430007 430009 430013 430019 430057 430061 430081 430091 430093 430121 
-430139 430147 430193 430259 430267 430277 430279 430289 430303 430319 430333 430343 
-430357 430393 430411 430427 430433 430453 430487 430499 430511 430513 430517 430543 
-430553 430571 430579 430589 430601 430603 430649 430663 430691 430697 430699 430709 
-430723 430739 430741 430747 430751 430753 430769 430783 430789 430799 430811 430819 
-430823 430841 430847 430861 430873 430879 430883 430891 430897 430907 430909 430921 
-430949 430957 430979 430981 430987 430999 431017 431021 431029 431047 431051 431063 
-431077 431083 431099 431107 431141 431147 431153 431173 431191 431203 431213 431219 
-431237 431251 431257 431267 431269 431287 431297 431311 431329 431339 431363 431369 
-431377 431381 431399 431423 431429 431441 431447 431449 431479 431513 431521 431533 
-431567 431581 431597 431603 431611 431617 431621 431657 431659 431663 431671 431693 
-431707 431729 431731 431759 431777 431797 431801 431803 431807 431831 431833 431857 
-431863 431867 431869 431881 431887 431891 431903 431911 431929 431933 431947 431983 
-431993 432001 432007 432023 432031 432037 432043 432053 432059 432067 432073 432097 
-432121 432137 432139 432143 432149 432161 432163 432167 432199 432203 432227 432241 
-432251 432277 432281 432287 432301 432317 432323 432337 432343 432349 432359 432373 
-432389 432391 432401 432413 432433 432437 432449 432457 432479 432491 432499 432503 
-432511 432527 432539 432557 432559 432569 432577 432587 432589 432613 432631 432637 
-432659 432661 432713 432721 432727 432737 432743 432749 432781 432793 432797 432799 
-432833 432847 432857 432869 432893 432907 432923 432931 432959 432961 432979 432983 
-432989 433003 433033 433049 433051 433061 433073 433079 433087 433093 433099 433117 
-433123 433141 433151 433187 433193 433201 433207 433229 433241 433249 433253 433259 
-433261 433267 433271 433291 433309 433319 433337 433351 433357 433361 433369 433373 
-433393 433399 433421 433429 433439 433453 433469 433471 433501 433507 433513 433549 
-433571 433577 433607 433627 433633 433639 433651 433661 433663 433673 433679 433681 
-433703 433723 433729 433747 433759 433777 433781 433787 433813 433817 433847 433859 
-433861 433877 433883 433889 433931 433943 433963 433967 433981 434009 434011 434029 
-434039 434081 434087 434107 434111 434113 434117 434141 434167 434179 434191 434201 
-434209 434221 434237 434243 434249 434261 434267 434293 434297 434303 434311 434323 
-434347 434353 434363 434377 434383 434387 434389 434407 434411 434431 434437 434459 
-434461 434471 434479 434501 434509 434521 434561 434563 434573 434593 434597 434611 
-434647 434659 434683 434689 434699 434717 434719 434743 434761 434783 434803 434807 
-434813 434821 434827 434831 434839 434849 434857 434867 434873 434881 434909 434921 
-434923 434927 434933 434939 434947 434957 434963 434977 434981 434989 435037 435041 
-435059 435103 435107 435109 435131 435139 435143 435151 435161 435179 435181 435187 
-435191 435221 435223 435247 435257 435263 435277 435283 435287 435307 435317 435343 
-435349 435359 435371 435397 435401 435403 435419 435427 435437 435439 435451 435481 
-435503 435529 435541 435553 435559 435563 435569 435571 435577 435583 435593 435619 
-435623 435637 435641 435647 435649 435653 435661 435679 435709 435731 435733 435739 
-435751 435763 435769 435779 435817 435839 435847 435857 435859 435881 435889 435893 
-435907 435913 435923 435947 435949 435973 435983 435997 436003 436013 436027 436061 
-436081 436087 436091 436097 436127 436147 436151 436157 436171 436181 436217 436231 
-436253 436273 436279 436283 436291 436307 436309 436313 436343 436357 436399 436417 
-436427 436439 436459 436463 436477 436481 436483 436507 436523 436529 436531 436547 
-436549 436571 436591 436607 436621 436627 436649 436651 436673 436687 436693 436717 
-436727 436729 436739 436741 436757 436801 436811 436819 436831 436841 436853 436871 
-436889 436913 436957 436963 436967 436973 436979 436993 436999 437011 437033 437071 
-437077 437083 437093 437111 437113 437137 437141 437149 437153 437159 437191 437201 
-437219 437237 437243 437263 437273 437279 437287 437293 437321 437351 437357 437363 
-437387 437389 437401 437413 437467 437471 437473 437497 437501 437509 437519 437527 
-437533 437539 437543 437557 437587 437629 437641 437651 437653 437677 437681 437687 
-437693 437719 437729 437743 437753 437771 437809 437819 437837 437849 437861 437867 
-437881 437909 437923 437947 437953 437959 437977 438001 438017 438029 438047 438049 
-438091 438131 438133 438143 438169 438203 438211 438223 438233 438241 438253 438259 
-438271 438281 438287 438301 438313 438329 438341 438377 438391 438401 438409 438419 
-438439 438443 438467 438479 438499 438517 438521 438523 438527 438533 438551 438569 
-438589 438601 438611 438623 438631 438637 438661 438667 438671 438701 438707 438721 
-438733 438761 438769 438793 438827 438829 438833 438847 438853 438869 438877 438887 
-438899 438913 438937 438941 438953 438961 438967 438979 438983 438989 439007 439009 
-439063 439081 439123 439133 439141 439157 439163 439171 439183 439199 439217 439253 
-439273 439279 439289 439303 439339 439349 439357 439367 439381 439409 439421 439427 
-439429 439441 439459 439463 439471 439493 439511 439519 439541 439559 439567 439573 
-439577 439583 439601 439613 439631 439639 439661 439667 439687 439693 439697 439709 
-439723 439729 439753 439759 439763 439771 439781 439787 439799 439811 439823 439849 
-439853 439861 439867 439883 439891 439903 439919 439949 439961 439969 439973 439981 
-439991 440009 440023 440039 440047 440087 440093 440101 440131 440159 440171 440177 
-440179 440183 440203 440207 440221 440227 440239 440261 440269 440281 440303 440311 
-440329 440333 440339 440347 440371 440383 440389 440393 440399 440431 440441 440443 
-440471 440497 440501 440507 440509 440527 440537 440543 440549 440551 440567 440569 
-440579 440581 440641 440651 440653 440669 440677 440681 440683 440711 440717 440723 
-440731 440753 440761 440773 440807 440809 440821 440831 440849 440863 440893 440903 
-440911 440939 440941 440953 440959 440983 440987 440989 441011 441029 441041 441043 
-441053 441073 441079 441101 441107 441109 441113 441121 441127 441157 441169 441179 
-441187 441191 441193 441229 441247 441251 441257 441263 441281 441307 441319 441349 
-441359 441361 441403 441421 441443 441449 441461 441479 441499 441517 441523 441527 
-441547 441557 441563 441569 441587 441607 441613 441619 441631 441647 441667 441697 
-441703 441713 441737 441751 441787 441797 441799 441811 441827 441829 441839 441841 
-441877 441887 441907 441913 441923 441937 441953 441971 442003 442007 442009 442019 
-442027 442031 442033 442061 442069 442097 442109 442121 442139 442147 442151 442157 
-442171 442177 442181 442193 442201 442207 442217 442229 442237 442243 442271 442283 
-442291 442319 442327 442333 442363 442367 442397 442399 442439 442447 442457 442469 
-442487 442489 442499 442501 442517 442531 442537 442571 442573 442577 442579 442601 
-442609 442619 442633 442691 442699 442703 442721 442733 442747 442753 442763 442769 
-442777 442781 442789 442807 442817 442823 442829 442831 442837 442843 442861 442879 
-442903 442919 442961 442963 442973 442979 442987 442991 442997 443011 443017 443039 
-443041 443057 443059 443063 443077 443089 443117 443123 443129 443147 443153 443159 
-443161 443167 443171 443189 443203 443221 443227 443231 443237 443243 443249 443263 
-443273 443281 443291 443293 443341 443347 443353 443363 443369 443389 443407 443413 
-443419 443423 443431 443437 443453 443467 443489 443501 443533 443543 443551 443561 
-443563 443567 443587 443591 443603 443609 443629 443659 443687 443689 443701 443711 
-443731 443749 443753 443759 443761 443771 443777 443791 443837 443851 443867 443869 
-443873 443879 443881 443893 443899 443909 443917 443939 443941 443953 443983 443987 
-443999 444001 444007 444029 444043 444047 444079 444089 444109 444113 444121 444127 
-444131 444151 444167 444173 444179 444181 444187 444209 444253 444271 444281 444287 
-444289 444293 444307 444341 444343 444347 444349 444401 444403 444421 444443 444449 
-444461 444463 444469 444473 444487 444517 444523 444527 444529 444539 444547 444553 
-444557 444569 444589 444607 444623 444637 444641 444649 444671 444677 444701 444713 
-444739 444767 444791 444793 444803 444811 444817 444833 444841 444859 444863 444869 
-444877 444883 444887 444893 444901 444929 444937 444953 444967 444971 444979 445001 
-445019 445021 445031 445033 445069 445087 445091 445097 445103 445141 445157 445169 
-445183 445187 445199 445229 445261 445271 445279 445283 445297 445307 445321 445339 
-445363 445427 445433 445447 445453 445463 445477 445499 445507 445537 445541 445567 
-445573 445583 445589 445597 445619 445631 445633 445649 445657 445691 445699 445703 
-445741 445747 445769 445771 445789 445799 445807 445829 445847 445853 445871 445877 
-445883 445891 445931 445937 445943 445967 445969 446003 446009 446041 446053 446081 
-446087 446111 446123 446129 446141 446179 446189 446191 446197 446221 446227 446231 
-446261 446263 446273 446279 446293 446309 446323 446333 446353 446363 446387 446389 
-446399 446401 446417 446441 446447 446461 446473 446477 446503 446533 446549 446561 
-446569 446597 446603 446609 446647 446657 446713 446717 446731 446753 446759 446767 
-446773 446819 446827 446839 446863 446881 446891 446893 446909 446911 446921 446933 
-446951 446969 446983 447001 447011 447019 447053 447067 447079 447101 447107 447119 
-447133 447137 447173 447179 447193 447197 447211 447217 447221 447233 447247 447257 
-447259 447263 447311 447319 447323 447331 447353 447401 447409 447427 447439 447443 
-447449 447451 447463 447467 447481 447509 447521 447527 447541 447569 447571 447611 
-447617 447637 447641 447677 447683 447701 447703 447743 447749 447757 447779 447791 
-447793 447817 447823 447827 447829 447841 447859 447877 447883 447893 447901 447907 
-447943 447961 447983 447991 448003 448013 448027 448031 448057 448067 448073 448093 
-448111 448121 448139 448141 448157 448159 448169 448177 448187 448193 448199 448207 
-448241 448249 448303 448309 448313 448321 448351 448363 448367 448373 448379 448387 
-448397 448421 448451 448519 448531 448561 448597 448607 448627 448631 448633 448667 
-448687 448697 448703 448727 448733 448741 448769 448793 448801 448807 448829 448843 
-448853 448859 448867 448871 448873 448879 448883 448907 448927 448939 448969 448993 
-448997 448999 449003 449011 449051 449077 449083 449093 449107 449117 449129 449131 
-449149 449153 449161 449171 449173 449201 449203 449209 449227 449243 449249 449261 
-449263 449269 449287 449299 449303 449311 449321 449333 449347 449353 449363 449381 
-449399 449411 449417 449419 449437 449441 449459 449473 449543 449549 449557 449563 
-449567 449569 449591 449609 449621 449629 449653 449663 449671 449677 449681 449689 
-449693 449699 449741 449759 449767 449773 449783 449797 449807 449821 449833 449851 
-449879 449921 449929 449941 449951 449959 449963 449971 449987 449989 450001 450011 
-450019 450029 450067 450071 450077 450083 450101 450103 450113 450127 450137 450161 
-450169 450193 450199 450209 450217 450223 450227 450239 450257 450259 450277 450287 
-450293 450299 450301 450311 450343 450349 450361 450367 450377 450383 450391 450403 
-450413 450421 450431 450451 450473 450479 450481 450487 450493 450503 450529 450533 
-450557 450563 450581 450587 450599 450601 450617 450641 450643 450649 450677 450691 
-450707 450719 450727 450761 450767 450787 450797 450799 450803 450809 450811 450817 
-450829 450839 450841 450847 450859 450881 450883 450887 450893 450899 450913 450917 
-450929 450943 450949 450971 450991 450997 451013 451039 451051 451057 451069 451093 
-451097 451103 451109 451159 451177 451181 451183 451201 451207 451249 451277 451279 
-451301 451303 451309 451313 451331 451337 451343 451361 451387 451397 451411 451439 
-451441 451481 451499 451519 451523 451541 451547 451553 451579 451601 451609 451621 
-451637 451657 451663 451667 451669 451679 451681 451691 451699 451709 451723 451747 
-451753 451771 451783 451793 451799 451823 451831 451837 451859 451873 451879 451897 
-451901 451903 451909 451921 451933 451937 451939 451961 451967 451987 452009 452017 
-452027 452033 452041 452077 452083 452087 452131 452159 452161 452171 452191 452201 
-452213 452227 452233 452239 452269 452279 452293 452297 452329 452363 452377 452393 
-452401 452443 452453 452497 452519 452521 452531 452533 452537 452539 452549 452579 
-452587 452597 452611 452629 452633 452671 452687 452689 452701 452731 452759 452773 
-452797 452807 452813 452821 452831 452857 452869 452873 452923 452953 452957 452983 
-452989 453023 453029 453053 453073 453107 453119 453133 453137 453143 453157 453161 
-453181 453197 453199 453209 453217 453227 453239 453247 453269 453289 453293 453301 
-453311 453317 453329 453347 453367 453371 453377 453379 453421 453451 453461 453527 
-453553 453559 453569 453571 453599 453601 453617 453631 453637 453641 453643 453659 
-453667 453671 453683 453703 453707 453709 453737 453757 453797 453799 453823 453833 
-453847 453851 453877 453889 453907 453913 453923 453931 453949 453961 453977 453983 
-453991 454009 454021 454031 454033 454039 454061 454063 454079 454109 454141 454151 
-454159 454183 454199 454211 454213 454219 454229 454231 454247 454253 454277 454297 
-454303 454313 454331 454351 454357 454361 454379 454387 454409 454417 454451 454453 
-454483 454501 454507 454513 454541 454543 454547 454577 454579 454603 454609 454627 
-454637 454673 454679 454709 454711 454721 454723 454759 454763 454777 454799 454823 
-454843 454847 454849 454859 454889 454891 454907 454919 454921 454931 454943 454967 
-454969 454973 454991 455003 455011 455033 455047 455053 455093 455099 455123 455149 
-455159 455167 455171 455177 455201 455219 455227 455233 455237 455261 455263 455269 
-455291 455309 455317 455321 455333 455339 455341 455353 455381 455393 455401 455407 
-455419 455431 455437 455443 455461 455471 455473 455479 455489 455491 455513 455527 
-455531 455537 455557 455573 455579 455597 455599 455603 455627 455647 455659 455681 
-455683 455687 455701 455711 455717 455737 455761 455783 455789 455809 455827 455831 
-455849 455863 455881 455899 455921 455933 455941 455953 455969 455977 455989 455993 
-455999 456007 456013 456023 456037 456047 456061 456091 456107 456109 456119 456149 
-456151 456167 456193 456223 456233 456241 456283 456293 456329 456349 456353 456367 
-456377 456403 456409 456427 456439 456451 456457 456461 456499 456503 456517 456523 
-456529 456539 456553 456557 456559 456571 456581 456587 456607 456611 456613 456623 
-456641 456647 456649 456653 456679 456683 456697 456727 456737 456763 456767 456769 
-456791 456809 456811 456821 456871 456877 456881 456899 456901 456923 456949 456959 
-456979 456991 457001 457003 457013 457021 457043 457049 457057 457087 457091 457097 
-457099 457117 457139 457151 457153 457183 457189 457201 457213 457229 457241 457253 
-457267 457271 457277 457279 457307 457319 457333 457339 457363 457367 457381 457393 
-457397 457399 457403 457411 457421 457433 457459 457469 457507 457511 457517 457547 
-457553 457559 457571 457607 457609 457621 457643 457651 457661 457669 457673 457679 
-457687 457697 457711 457739 457757 457789 457799 457813 457817 457829 457837 457871 
-457889 457903 457913 457943 457979 457981 457987 458009 458027 458039 458047 458053 
-458057 458063 458069 458119 458123 458173 458179 458189 458191 458197 458207 458219 
-458239 458309 458317 458323 458327 458333 458357 458363 458377 458399 458401 458407 
-458449 458477 458483 458501 458531 458533 458543 458567 458569 458573 458593 458599 
-458611 458621 458629 458639 458651 458663 458669 458683 458701 458719 458729 458747 
-458789 458791 458797 458807 458819 458849 458863 458879 458891 458897 458917 458921 
-458929 458947 458957 458959 458963 458971 458977 458981 458987 458993 459007 459013 
-459023 459029 459031 459037 459047 459089 459091 459113 459127 459167 459169 459181 
-459209 459223 459229 459233 459257 459271 459293 459301 459313 459317 459337 459341 
-459343 459353 459373 459377 459383 459397 459421 459427 459443 459463 459467 459469 
-459479 459509 459521 459523 459593 459607 459611 459619 459623 459631 459647 459649 
-459671 459677 459691 459703 459749 459763 459791 459803 459817 459829 459841 459847 
-459883 459913 459923 459929 459937 459961 460013 460039 460051 460063 460073 460079 
-460081 460087 460091 460099 460111 460127 460147 460157 460171 460181 460189 460211 
-460217 460231 460247 460267 460289 460297 460301 460337 460349 460373 460379 460387 
-460393 460403 460409 460417 460451 460463 460477 460531 460543 460561 460571 460589 
-460609 460619 460627 460633 460637 460643 460657 460673 460697 460709 460711 460721 
-460771 460777 460787 460793 460813 460829 460841 460843 460871 460891 460903 460907 
-460913 460919 460937 460949 460951 460969 460973 460979 460981 460987 460991 461009 
-461011 461017 461051 461053 461059 461093 461101 461119 461143 461147 461171 461183 
-461191 461207 461233 461239 461257 461269 461273 461297 461299 461309 461317 461323 
-461327 461333 461359 461381 461393 461407 461411 461413 461437 461441 461443 461467 
-461479 461507 461521 461561 461569 461581 461599 461603 461609 461627 461639 461653 
-461677 461687 461689 461693 461707 461717 461801 461803 461819 461843 461861 461887 
-461891 461917 461921 461933 461957 461971 461977 461983 462013 462041 462067 462073 
-462079 462097 462103 462109 462113 462131 462149 462181 462191 462199 462221 462239 
-462263 462271 462307 462311 462331 462337 462361 462373 462377 462401 462409 462419 
-462421 462437 462443 462467 462481 462491 462493 462499 462529 462541 462547 462557 
-462569 462571 462577 462589 462607 462629 462641 462643 462653 462659 462667 462673 
-462677 462697 462713 462719 462727 462733 462739 462773 462827 462841 462851 462863 
-462871 462881 462887 462899 462901 462911 462937 462947 462953 462983 463003 463031 
-463033 463093 463103 463157 463181 463189 463207 463213 463219 463231 463237 463247 
-463249 463261 463283 463291 463297 463303 463313 463319 463321 463339 463343 463363 
-463387 463399 463433 463447 463451 463453 463457 463459 463483 463501 463511 463513 
-463523 463531 463537 463549 463579 463613 463627 463633 463643 463649 463663 463679 
-463693 463711 463717 463741 463747 463753 463763 463781 463787 463807 463823 463829 
-463831 463849 463861 463867 463873 463889 463891 463907 463919 463921 463949 463963 
-463973 463987 463993 464003 464011 464021 464033 464047 464069 464081 464089 464119 
-464129 464131 464137 464141 464143 464171 464173 464197 464201 464213 464237 464251 
-464257 464263 464279 464281 464291 464309 464311 464327 464351 464371 464381 464383 
-464413 464419 464437 464447 464459 464467 464479 464483 464521 464537 464539 464549 
-464557 464561 464587 464591 464603 464617 464621 464647 464663 464687 464699 464741 
-464747 464749 464753 464767 464771 464773 464777 464801 464803 464809 464813 464819 
-464843 464857 464879 464897 464909 464917 464923 464927 464939 464941 464951 464953 
-464963 464983 464993 464999 465007 465011 465013 465019 465041 465061 465067 465071 
-465077 465079 465089 465107 465119 465133 465151 465161 465163 465167 465169 465173 
-465187 465209 465211 465259 465271 465277 465281 465293 465299 465317 465319 465331 
-465337 465373 465379 465383 465407 465419 465433 465463 465469 465523 465529 465541 
-465551 465581 465587 465611 465631 465643 465649 465659 465679 465701 465721 465739 
-465743 465761 465781 465797 465799 465809 465821 465833 465841 465887 465893 465901 
-465917 465929 465931 465947 465977 465989 466009 466019 466027 466033 466043 466061 
-466069 466073 466079 466087 466091 466121 466139 466153 466171 466181 466183 466201 
-466243 466247 466261 466267 466273 466283 466303 466321 466331 466339 466357 466369 
-466373 466409 466423 466441 466451 466483 466517 466537 466547 466553 466561 466567 
-466573 466579 466603 466619 466637 466649 466651 466673 466717 466723 466729 466733 
-466747 466751 466777 466787 466801 466819 466853 466859 466897 466909 466913 466919 
-466951 466957 466997 467003 467009 467017 467021 467063 467081 467083 467101 467119 
-467123 467141 467147 467171 467183 467197 467209 467213 467237 467239 467261 467293 
-467297 467317 467329 467333 467353 467371 467399 467417 467431 467437 467447 467471 
-467473 467477 467479 467491 467497 467503 467507 467527 467531 467543 467549 467557 
-467587 467591 467611 467617 467627 467629 467633 467641 467651 467657 467669 467671 
-467681 467689 467699 467713 467729 467737 467743 467749 467773 467783 467813 467827 
-467833 467867 467869 467879 467881 467893 467897 467899 467903 467927 467941 467953 
-467963 467977 468001 468011 468019 468029 468049 468059 468067 468071 468079 468107 
-468109 468113 468121 468133 468137 468151 468157 468173 468187 468191 468199 468239 
-468241 468253 468271 468277 468289 468319 468323 468353 468359 468371 468389 468421 
-468439 468451 468463 468473 468491 468493 468499 468509 468527 468551 468557 468577 
-468581 468593 468599 468613 468619 468623 468641 468647 468653 468661 468667 468683 
-468691 468697 468703 468709 468719 468737 468739 468761 468773 468781 468803 468817 
-468821 468841 468851 468859 468869 468883 468887 468889 468893 468899 468913 468953 
-468967 468973 468983 469009 469031 469037 469069 469099 469121 469127 469141 469153 
-469169 469193 469207 469219 469229 469237 469241 469253 469267 469279 469283 469303 
-469321 469331 469351 469363 469367 469369 469379 469397 469411 469429 469439 469457 
-469487 469501 469529 469541 469543 469561 469583 469589 469613 469627 469631 469649 
-469657 469673 469687 469691 469717 469723 469747 469753 469757 469769 469787 469793 
-469801 469811 469823 469841 469849 469877 469879 469891 469907 469919 469939 469957 
-469969 469979 469993 470021 470039 470059 470077 470081 470083 470087 470089 470131 
-470149 470153 470161 470167 470179 470201 470207 470209 470213 470219 470227 470243 
-470251 470263 470279 470297 470299 470303 470317 470333 470347 470359 470389 470399 
-470411 470413 470417 470429 470443 470447 470453 470461 470471 470473 470489 470501 
-470513 470521 470531 470539 470551 470579 470593 470597 470599 470609 470621 470627 
-470647 470651 470653 470663 470669 470689 470711 470719 470731 470749 470779 470783 
-470791 470819 470831 470837 470863 470867 470881 470887 470891 470903 470927 470933 
-470941 470947 470957 470959 470993 470999 471007 471041 471061 471073 471089 471091 
-471101 471137 471139 471161 471173 471179 471187 471193 471209 471217 471241 471253 
-471259 471277 471281 471283 471299 471301 471313 471353 471389 471391 471403 471407 
-471439 471451 471467 471481 471487 471503 471509 471521 471533 471539 471553 471571 
-471589 471593 471607 471617 471619 471641 471649 471659 471671 471673 471677 471683 
-471697 471703 471719 471721 471749 471769 471781 471791 471803 471817 471841 471847 
-471853 471871 471893 471901 471907 471923 471929 471931 471943 471949 471959 471997 
-472019 472027 472051 472057 472063 472067 472103 472111 472123 472127 472133 472139 
-472151 472159 472163 472189 472193 472247 472249 472253 472261 472273 472289 472301 
-472309 472319 472331 472333 472349 472369 472391 472393 472399 472411 472421 472457 
-472469 472477 472523 472541 472543 472559 472561 472573 472597 472631 472639 472643 
-472669 472687 472691 472697 472709 472711 472721 472741 472751 472763 472793 472799 
-472817 472831 472837 472847 472859 472883 472907 472909 472921 472937 472939 472963 
-472993 473009 473021 473027 473089 473101 473117 473141 473147 473159 473167 473173 
-473191 473197 473201 473203 473219 473227 473257 473279 473287 473293 473311 473321 
-473327 473351 473353 473377 473381 473383 473411 473419 473441 473443 473453 473471 
-473477 473479 473497 473503 473507 473513 473519 473527 473531 473533 473549 473579 
-473597 473611 473617 473633 473647 473659 473719 473723 473729 473741 473743 473761 
-473789 473833 473839 473857 473861 473867 473887 473899 473911 473923 473927 473929 
-473939 473951 473953 473971 473981 473987 473999 474017 474029 474037 474043 474049 
-474059 474073 474077 474101 474119 474127 474137 474143 474151 474163 474169 474197 
-474211 474223 474241 474263 474289 474307 474311 474319 474337 474343 474347 474359 
-474379 474389 474391 474413 474433 474437 474443 474479 474491 474497 474499 474503 
-474533 474541 474547 474557 474569 474571 474581 474583 474619 474629 474647 474659 
-474667 474671 474707 474709 474737 474751 474757 474769 474779 474787 474809 474811 
-474839 474847 474857 474899 474907 474911 474917 474923 474931 474937 474941 474949 
-474959 474977 474983 475037 475051 475073 475081 475091 475093 475103 475109 475141 
-475147 475151 475159 475169 475207 475219 475229 475243 475271 475273 475283 475289 
-475297 475301 475327 475331 475333 475351 475367 475369 475379 475381 475403 475417 
-475421 475427 475429 475441 475457 475469 475483 475511 475523 475529 475549 475583 
-475597 475613 475619 475621 475637 475639 475649 475669 475679 475681 475691 475693 
-475697 475721 475729 475751 475753 475759 475763 475777 475789 475793 475807 475823 
-475831 475837 475841 475859 475877 475879 475889 475897 475903 475907 475921 475927 
-475933 475957 475973 475991 475997 476009 476023 476027 476029 476039 476041 476059 
-476081 476087 476089 476101 476107 476111 476137 476143 476167 476183 476219 476233 
-476237 476243 476249 476279 476299 476317 476347 476351 476363 476369 476381 476401 
-476407 476419 476423 476429 476467 476477 476479 476507 476513 476519 476579 476587 
-476591 476599 476603 476611 476633 476639 476647 476659 476681 476683 476701 476713 
-476719 476737 476743 476753 476759 476783 476803 476831 476849 476851 476863 476869 
-476887 476891 476911 476921 476929 476977 476981 476989 477011 477013 477017 477019 
-477031 477047 477073 477077 477091 477131 477149 477163 477209 477221 477229 477259 
-477277 477293 477313 477317 477329 477341 477359 477361 477383 477409 477439 477461 
-477469 477497 477511 477517 477523 477539 477551 477553 477557 477571 477577 477593 
-477619 477623 477637 477671 477677 477721 477727 477731 477739 477767 477769 477791 
-477797 477809 477811 477821 477823 477839 477847 477857 477863 477881 477899 477913 
-477941 477947 477973 477977 477991 478001 478039 478063 478067 478069 478087 478099 
-478111 478129 478139 478157 478169 478171 478189 478199 478207 478213 478241 478243 
-478253 478259 478271 478273 478321 478339 478343 478351 478391 478399 478403 478411 
-478417 478421 478427 478433 478441 478451 478453 478459 478481 478483 478493 478523 
-478531 478571 478573 478579 478589 478603 478627 478631 478637 478651 478679 478697 
-478711 478727 478729 478739 478741 478747 478763 478769 478787 478801 478811 478813 
-478823 478831 478843 478853 478861 478871 478879 478897 478901 478913 478927 478931 
-478937 478943 478963 478967 478991 478999 479023 479027 479029 479041 479081 479131 
-479137 479147 479153 479189 479191 479201 479209 479221 479231 479239 479243 479263 
-479267 479287 479299 479309 479317 479327 479357 479371 479377 479387 479419 479429 
-479431 479441 479461 479473 479489 479497 479509 479513 479533 479543 479561 479569 
-479581 479593 479599 479623 479629 479639 479701 479749 479753 479761 479771 479777 
-479783 479797 479813 479821 479833 479839 479861 479879 479881 479891 479903 479909 
-479939 479951 479953 479957 479971 480013 480017 480019 480023 480043 480047 480049 
-480059 480061 480071 480091 480101 480107 480113 480133 480143 480157 480167 480169 
-480203 480209 480287 480299 480317 480329 480341 480343 480349 480367 480373 480379 
-480383 480391 480409 480419 480427 480449 480451 480461 480463 480499 480503 480509 
-480517 480521 480527 480533 480541 480553 480563 480569 480583 480587 480647 480661 
-480707 480713 480731 480737 480749 480761 480773 480787 480803 480827 480839 480853 
-480881 480911 480919 480929 480937 480941 480959 480967 480979 480989 481001 481003 
-481009 481021 481043 481051 481067 481073 481087 481093 481097 481109 481123 481133 
-481141 481147 481153 481157 481171 481177 481181 481199 481207 481211 481231 481249 
-481297 481301 481303 481307 481343 481363 481373 481379 481387 481409 481417 481433 
-481447 481469 481489 481501 481513 481531 481549 481571 481577 481589 481619 481633 
-481639 481651 481667 481673 481681 481693 481697 481699 481721 481751 481753 481769 
-481787 481801 481807 481813 481837 481843 481847 481849 481861 481867 481879 481883 
-481909 481939 481963 481997 482017 482021 482029 482033 482039 482051 482071 482093 
-482099 482101 482117 482123 482179 482189 482203 482213 482227 482231 482233 482243 
-482263 482281 482309 482323 482347 482351 482359 482371 482387 482393 482399 482401 
-482407 482413 482423 482437 482441 482483 482501 482507 482509 482513 482519 482527 
-482539 482569 482593 482597 482621 482627 482633 482641 482659 482663 482683 482687 
-482689 482707 482711 482717 482719 482731 482743 482753 482759 482767 482773 482789 
-482803 482819 482827 482837 482861 482863 482873 482897 482899 482917 482941 482947 
-482957 482971 483017 483031 483061 483071 483097 483127 483139 483163 483167 483179 
-483209 483211 483221 483229 483233 483239 483247 483251 483281 483289 483317 483323 
-483337 483347 483367 483377 483389 483397 483407 483409 483433 483443 483467 483481 
-483491 483499 483503 483523 483541 483551 483557 483563 483577 483611 483619 483629 
-483643 483649 483671 483697 483709 483719 483727 483733 483751 483757 483761 483767 
-483773 483787 483809 483811 483827 483829 483839 483853 483863 483869 483883 483907 
-483929 483937 483953 483971 483991 484019 484027 484037 484061 484067 484079 484091 
-484111 484117 484123 484129 484151 484153 484171 484181 484193 484201 484207 484229 
-484243 484259 484283 484301 484303 484327 484339 484361 484369 484373 484397 484411 
-484417 484439 484447 484457 484459 484487 484489 484493 484531 484543 484577 484597 
-484607 484609 484613 484621 484639 484643 484691 484703 484727 484733 484751 484763 
-484769 484777 484787 484829 484853 484867 484927 484951 484987 484999 485021 485029 
-485041 485053 485059 485063 485081 485101 485113 485123 485131 485137 485161 485167 
-485171 485201 485207 485209 485263 485311 485347 485351 485363 485371 485383 485389 
-485411 485417 485423 485437 485447 485479 485497 485509 485519 485543 485567 485587 
-485593 485603 485609 485647 485657 485671 485689 485701 485717 485729 485731 485753 
-485777 485819 485827 485831 485833 485893 485899 485909 485923 485941 485959 485977 
-485993 486023 486037 486041 486043 486053 486061 486071 486091 486103 486119 486133 
-486139 486163 486179 486181 486193 486203 486221 486223 486247 486281 486293 486307 
-486313 486323 486329 486331 486341 486349 486377 486379 486389 486391 486397 486407 
-486433 486443 486449 486481 486491 486503 486509 486511 486527 486539 486559 486569 
-486583 486589 486601 486617 486637 486641 486643 486653 486667 486671 486677 486679 
-486683 486697 486713 486721 486757 486767 486769 486781 486797 486817 486821 486833 
-486839 486869 486907 486923 486929 486943 486947 486949 486971 486977 486991 487007 
-487013 487021 487049 487051 487057 487073 487079 487093 487099 487111 487133 487177 
-487183 487187 487211 487213 487219 487247 487261 487283 487303 487307 487313 487349 
-487363 487381 487387 487391 487397 487423 487427 487429 487447 487457 487463 487469 
-487471 487477 487481 487489 487507 487561 487589 487601 487603 487607 487637 487649 
-487651 487657 487681 487691 487703 487709 487717 487727 487733 487741 487757 487769 
-487783 487789 487793 487811 487819 487829 487831 487843 487873 487889 487891 487897 
-487933 487943 487973 487979 487997 488003 488009 488011 488021 488051 488057 488069 
-488119 488143 488149 488153 488161 488171 488197 488203 488207 488209 488227 488231 
-488233 488239 488249 488261 488263 488287 488303 488309 488311 488317 488321 488329 
-488333 488339 488347 488353 488381 488399 488401 488407 488417 488419 488441 488459 
-488473 488503 488513 488539 488567 488573 488603 488611 488617 488627 488633 488639 
-488641 488651 488687 488689 488701 488711 488717 488723 488729 488743 488749 488759 
-488779 488791 488797 488821 488827 488833 488861 488879 488893 488897 488909 488921 
-488947 488959 488981 488993 489001 489011 489019 489043 489053 489061 489101 489109 
-489113 489127 489133 489157 489161 489179 489191 489197 489217 489239 489241 489257 
-489263 489283 489299 489329 489337 489343 489361 489367 489389 489407 489409 489427 
-489431 489439 489449 489457 489479 489487 489493 489529 489539 489551 489553 489557 
-489571 489613 489631 489653 489659 489673 489677 489679 489689 489691 489733 489743 
-489761 489791 489793 489799 489803 489817 489823 489833 489847 489851 489869 489871 
-489887 489901 489911 489913 489941 489943 489959 489961 489977 489989 490001 490003 
-490019 490031 490033 490057 490097 490103 490111 490117 490121 490151 490159 490169 
-490183 490201 490207 490223 490241 490247 490249 490267 490271 490277 490283 490309 
-490313 490339 490367 490393 490417 490421 490453 490459 490463 490481 490493 490499 
-490519 490537 490541 490543 490549 490559 490571 490573 490577 490579 490591 490619 
-490627 490631 490643 490661 490663 490697 490733 490741 490769 490771 490783 490829 
-490837 490849 490859 490877 490891 490913 490921 490927 490937 490949 490951 490957 
-490967 490969 490991 490993 491003 491039 491041 491059 491081 491083 491129 491137 
-491149 491159 491167 491171 491201 491213 491219 491251 491261 491273 491279 491297 
-491299 491327 491329 491333 491339 491341 491353 491357 491371 491377 491417 491423 
-491429 491461 491483 491489 491497 491501 491503 491527 491531 491537 491539 491581 
-491591 491593 491611 491627 491633 491639 491651 491653 491669 491677 491707 491719 
-491731 491737 491747 491773 491783 491789 491797 491819 491833 491837 491851 491857 
-491867 491873 491899 491923 491951 491969 491977 491983 492007 492013 492017 492029 
-492047 492053 492059 492061 492067 492077 492083 492103 492113 492227 492251 492253 
-492257 492281 492293 492299 492319 492377 492389 492397 492403 492409 492413 492421 
-492431 492463 492467 492487 492491 492511 492523 492551 492563 492587 492601 492617 
-492619 492629 492631 492641 492647 492659 492671 492673 492707 492719 492721 492731 
-492757 492761 492763 492769 492781 492799 492839 492853 492871 492883 492893 492901 
-492911 492967 492979 493001 493013 493021 493027 493043 493049 493067 493093 493109 
-493111 493121 493123 493127 493133 493139 493147 493159 493169 493177 493193 493201 
-493211 493217 493219 493231 493243 493249 493277 493279 493291 493301 493313 493333 
-493351 493369 493393 493397 493399 493403 493433 493447 493457 493463 493481 493523 
-493531 493541 493567 493573 493579 493583 493607 493621 493627 493643 493657 493693 
-493709 493711 493721 493729 493733 493747 493777 493793 493807 493811 493813 493817 
-493853 493859 493873 493877 493897 493919 493931 493937 493939 493967 493973 493979 
-493993 494023 494029 494041 494051 494069 494077 494083 494093 494101 494107 494129 
-494141 494147 494167 494191 494213 494237 494251 494257 494267 494269 494281 494287 
-494317 494327 494341 494353 494359 494369 494381 494383 494387 494407 494413 494441 
-494443 494471 494497 494519 494521 494539 494561 494563 494567 494587 494591 494609 
-494617 494621 494639 494647 494651 494671 494677 494687 494693 494699 494713 494719 
-494723 494731 494737 494743 494749 494759 494761 494783 494789 494803 494843 494849 
-494873 494899 494903 494917 494927 494933 494939 494959 494987 495017 495037 495041 
-495043 495067 495071 495109 495113 495119 495133 495139 495149 495151 495161 495181 
-495199 495211 495221 495241 495269 495277 495289 495301 495307 495323 495337 495343 
-495347 495359 495361 495371 495377 495389 495401 495413 495421 495433 495437 495449 
-495457 495461 495491 495511 495527 495557 495559 495563 495569 495571 495587 495589 
-495611 495613 495617 495619 495629 495637 495647 495667 495679 495701 495707 495713 
-495749 495751 495757 495769 495773 495787 495791 495797 495799 495821 495827 495829 
-495851 495877 495893 495899 495923 495931 495947 495953 495959 495967 495973 495983 
-496007 496019 496039 496051 496063 496073 496079 496123 496127 496163 496187 496193 
-496211 496229 496231 496259 496283 496289 496291 496297 496303 496313 496333 496339 
-496343 496381 496399 496427 496439 496453 496459 496471 496477 496481 496487 496493 
-496499 496511 496549 496579 496583 496609 496631 496669 496681 496687 496703 496711 
-496733 496747 496763 496789 496813 496817 496841 496849 496871 496877 496889 496891 
-496897 496901 496913 496919 496949 496963 496997 496999 497011 497017 497041 497047 
-497051 497069 497093 497111 497113 497117 497137 497141 497153 497171 497177 497197 
-497239 497257 497261 497269 497279 497281 497291 497297 497303 497309 497323 497339 
-497351 497389 497411 497417 497423 497449 497461 497473 497479 497491 497501 497507 
-497509 497521 497537 497551 497557 497561 497579 497587 497597 497603 497633 497659 
-497663 497671 497677 497689 497701 497711 497719 497729 497737 497741 497771 497773 
-497801 497813 497831 497839 497851 497867 497869 497873 497899 497929 497957 497963 
-497969 497977 497989 497993 497999 498013 498053 498061 498073 498089 498101 498103 
-498119 498143 498163 498167 498181 498209 498227 498257 498259 498271 498301 498331 
-498343 498361 498367 498391 498397 498401 498403 498409 498439 498461 498467 498469 
-498493 498497 498521 498523 498527 498551 498557 498577 498583 498599 498611 498613 
-498643 498647 498653 498679 498689 498691 498733 498739 498749 498761 498767 498779 
-498781 498787 498791 498803 498833 498857 498859 498881 498907 498923 498931 498937 
-498947 498961 498973 498977 498989 499021 499027 499033 499039 499063 499067 499099 
-499117 499127 499129 499133 499139 499141 499151 499157 499159 499181 499183 499189 
-499211 499229 499253 499267 499277 499283 499309 499321 499327 499349 499361 499363 
-499391 499397 499403 499423 499439 499459 499481 499483 499493 499507 499519 499523 
-499549 499559 499571 499591 499601 499607 499621 499633 499637 499649 499661 499663 
-499669 499673 499679 499687 499691 499693 499711 499717 499729 499739 499747 499781 
-499787 499801 499819 499853 499879 499883 499897 499903 499927 499943 499957 499969 
-499973 499979 500009 500029 500041 500057 500069 500083 500107 500111 500113 500119 
-500153 500167 500173 500177 500179 500197 500209 500231 500233 500237 500239 500249 
-500257 500287 500299 500317 500321 500333 500341 500363 500369 500389 500393 500413 
-500417 500431 500443 500459 500471 500473 500483 500501 500509 500519 500527 500567 
-500579 500587 500603 500629 500671 500677 500693 500699 500713 500719 500723 500729 
-500741 500777 500791 500807 500809 500831 500839 500861 500873 500881 500887 500891 
-500909 500911 500921 500923 500933 500947 500953 500957 500977 501001 501013 501019 
-501029 501031 501037 501043 501077 501089 501103 501121 501131 501133 501139 501157 
-501173 501187 501191 501197 501203 501209 501217 501223 501229 501233 501257 501271 
-501287 501299 501317 501341 501343 501367 501383 501401 501409 501419 501427 501451 
-501463 501493 501503 501511 501563 501577 501593 501601 501617 501623 501637 501659 
-501691 501701 501703 501707 501719 501731 501769 501779 501803 501817 501821 501827 
-501829 501841 501863 501889 501911 501931 501947 501953 501967 501971 501997 502001 
-502013 502039 502043 502057 502063 502079 502081 502087 502093 502121 502133 502141 
-502171 502181 502217 502237 502247 502259 502261 502277 502301 502321 502339 502393 
-502409 502421 502429 502441 502451 502487 502499 502501 502507 502517 502543 502549 
-502553 502591 502597 502613 502631 502633 502643 502651 502669 502687 502699 502703 
-502717 502729 502769 502771 502781 502787 502807 502819 502829 502841 502847 502861 
-502883 502919 502921 502937 502961 502973 503003 503017 503039 503053 503077 503123 
-503131 503137 503147 503159 503197 503207 503213 503227 503231 503233 503249 503267 
-503287 503297 503303 503317 503339 503351 503359 503369 503381 503383 503389 503407 
-503413 503423 503431 503441 503453 503483 503501 503543 503549 503551 503563 503593 
-503599 503609 503611 503621 503623 503647 503653 503663 503707 503717 503743 503753 
-503771 503777 503779 503791 503803 503819 503821 503827 503851 503857 503869 503879 
-503911 503927 503929 503939 503947 503959 503963 503969 503983 503989 504001 504011 
-504017 504047 504061 504073 504103 504121 504139 504143 504149 504151 504157 504181 
-504187 504197 504209 504221 504247 504269 504289 504299 504307 504311 504323 504337 
-504349 504353 504359 504377 504379 504389 504403 504457 504461 504473 504479 504521 
-504523 504527 504547 504563 504593 504599 504607 504617 504619 504631 504661 504667 
-504671 504677 504683 504727 504767 504787 504797 504799 504817 504821 504851 504853 
-504857 504871 504877 504893 504901 504929 504937 504943 504947 504953 504967 504983 
-504989 504991 505027 505031 505033 505049 505051 505061 505067 505073 505091 505097 
-505111 505117 505123 505129 505139 505157 505159 505181 505187 505201 505213 505231 
-505237 505277 505279 505283 505301 505313 505319 505321 505327 505339 505357 505367 
-505369 505399 505409 505411 505429 505447 505459 505469 505481 505493 505501 505511 
-505513 505523 505537 505559 505573 505601 505607 505613 505619 505633 505639 505643 
-505657 505663 505669 505691 505693 505709 505711 505727 505759 505763 505777 505781 
-505811 505819 505823 505867 505871 505877 505907 505919 505927 505949 505961 505969 
-505979 506047 506071 506083 506101 506113 506119 506131 506147 506171 506173 506183 
-506201 506213 506251 506263 506269 506281 506291 506327 506329 506333 506339 506347 
-506351 506357 506381 506393 506417 506423 506449 506459 506461 506479 506491 506501 
-506507 506531 506533 506537 506551 506563 506573 506591 506593 506599 506609 506629 
-506647 506663 506683 506687 506689 506699 506729 506731 506743 506773 506783 506791 
-506797 506809 506837 506843 506861 506873 506887 506893 506899 506903 506911 506929 
-506941 506963 506983 506993 506999 507029 507049 507071 507077 507079 507103 507109 
-507113 507119 507137 507139 507149 507151 507163 507193 507197 507217 507289 507301 
-507313 507317 507329 507347 507349 507359 507361 507371 507383 507401 507421 507431 
-507461 507491 507497 507499 507503 507523 507557 507571 507589 507593 507599 507607 
-507631 507641 507667 507673 507691 507697 507713 507719 507743 507757 507779 507781 
-507797 507803 507809 507821 507827 507839 507883 507901 507907 507917 507919 507937 
-507953 507961 507971 507979 508009 508019 508021 508033 508037 508073 508087 508091 
-508097 508103 508129 508159 508171 508187 508213 508223 508229 508237 508243 508259 
-508271 508273 508297 508301 508327 508331 508349 508363 508367 508373 508393 508433 
-508439 508451 508471 508477 508489 508499 508513 508517 508531 508549 508559 508567 
-508577 508579 508583 508619 508621 508637 508643 508661 508693 508709 508727 508771 
-508789 508799 508811 508817 508841 508847 508867 508901 508903 508909 508913 508919 
-508931 508943 508951 508957 508961 508969 508973 508987 509023 509027 509053 509063 
-509071 509087 509101 509123 509137 509147 509149 509203 509221 509227 509239 509263 
-509281 509287 509293 509297 509317 509329 509359 509363 509389 509393 509413 509417 
-509429 509441 509449 509477 509513 509521 509543 509549 509557 509563 509569 509573 
-509581 509591 509603 509623 509633 509647 509653 509659 509681 509687 509689 509693 
-509699 509723 509731 509737 509741 509767 509783 509797 509801 509833 509837 509843 
-509863 509867 509879 509909 509911 509921 509939 509947 509959 509963 509989 510007 
-510031 510047 510049 510061 510067 510073 510077 510079 510089 510101 510121 510127 
-510137 510157 510179 510199 510203 510217 510227 510233 510241 510247 510253 510271 
-510287 510299 510311 510319 510331 510361 510379 510383 510401 510403 510449 510451 
-510457 510463 510481 510529 510551 510553 510569 510581 510583 510589 510611 510613 
-510617 510619 510677 510683 510691 510707 510709 510751 510767 510773 510793 510803 
-510817 510823 510827 510847 510889 510907 510919 510931 510941 510943 510989 511001 
-511013 511019 511033 511039 511057 511061 511087 511109 511111 511123 511151 511153 
-511163 511169 511171 511177 511193 511201 511211 511213 511223 511237 511243 511261 
-511279 511289 511297 511327 511333 511337 511351 511361 511387 511391 511409 511417 
-511439 511447 511453 511457 511463 511477 511487 511507 511519 511523 511541 511549 
-511559 511573 511579 511583 511591 511603 511627 511631 511633 511669 511691 511703 
-511711 511723 511757 511787 511793 511801 511811 511831 511843 511859 511867 511873 
-511891 511897 511909 511933 511939 511961 511963 511991 511997 512009 512011 512021 
-512047 512059 512093 512101 512137 512147 512167 512207 512249 512251 512269 512287 
-512311 512321 512333 512353 512389 512419 512429 512443 512467 512497 512503 512507 
-512521 512531 512537 512543 512569 512573 512579 512581 512591 512593 512597 512609 
-512621 512641 512657 512663 512671 512683 512711 512713 512717 512741 512747 512761 
-512767 512779 512797 512803 512819 512821 512843 512849 512891 512899 512903 512917 
-512921 512927 512929 512959 512977 512989 512999 513001 513013 513017 513031 513041 
-513047 513053 513059 513067 513083 513101 513103 513109 513131 513137 513157 513167 
-513169 513173 513203 513239 513257 513269 513277 513283 513307 513311 513313 513319 
-513341 513347 513353 513367 513371 513397 513407 513419 513427 513431 513439 513473 
-513479 513481 513509 513511 513529 513533 513593 513631 513641 513649 513673 513679 
-513683 513691 513697 513719 513727 513731 513739 513749 513761 513767 513769 513781 
-513829 513839 513841 513871 513881 513899 513917 513923 513937 513943 513977 513991 
-514001 514009 514013 514021 514049 514051 514057 514061 514079 514081 514093 514103 
-514117 514123 514127 514147 514177 514187 514201 514219 514229 514243 514247 514249 
-514271 514277 514289 514309 514313 514333 514343 514357 514361 514379 514399 514417 
-514429 514433 514453 514499 514513 514519 514523 514529 514531 514543 514561 514571 
-514621 514637 514639 514643 514649 514651 514669 514681 514711 514733 514739 514741 
-514747 514751 514757 514769 514783 514793 514819 514823 514831 514841 514847 514853 
-514859 514867 514873 514889 514903 514933 514939 514949 514967 515041 515087 515089 
-515111 515143 515149 515153 515173 515191 515227 515231 515233 515237 515279 515293 
-515311 515323 515351 515357 515369 515371 515377 515381 515401 515429 515477 515507 
-515519 515539 515563 515579 515587 515597 515611 515621 515639 515651 515653 515663 
-515677 515681 515687 515693 515701 515737 515741 515761 515771 515773 515777 515783 
-515803 515813 515839 515843 515857 515861 515873 515887 515917 515923 515929 515941 
-515951 515969 515993 516017 516023 516049 516053 516077 516091 516127 516151 516157 
-516161 516163 516169 516179 516193 516199 516209 516223 516227 516233 516247 516251 
-516253 516277 516283 516293 516319 516323 516349 516359 516361 516371 516377 516391 
-516407 516421 516431 516433 516437 516449 516457 516469 516493 516499 516517 516521 
-516539 516541 516563 516587 516589 516599 516611 516617 516619 516623 516643 516653 
-516673 516679 516689 516701 516709 516713 516721 516727 516757 516793 516811 516821 
-516829 516839 516847 516871 516877 516883 516907 516911 516931 516947 516949 516959 
-516973 516977 516979 516991 517003 517043 517061 517067 517073 517079 517081 517087 
-517091 517129 517151 517169 517177 517183 517189 517207 517211 517217 517229 517241 
-517243 517249 517261 517267 517277 517289 517303 517337 517343 517367 517373 517381 
-517393 517399 517403 517411 517417 517457 517459 517469 517471 517481 517487 517499 
-517501 517507 517511 517513 517547 517549 517553 517571 517577 517589 517597 517603 
-517609 517613 517619 517637 517639 517711 517717 517721 517729 517733 517739 517747 
-517817 517823 517831 517861 517873 517877 517901 517919 517927 517931 517949 517967 
-517981 517991 517999 518017 518047 518057 518059 518083 518099 518101 518113 518123 
-518129 518131 518137 518153 518159 518171 518179 518191 518207 518209 518233 518237 
-518239 518249 518261 518291 518299 518311 518327 518341 518387 518389 518411 518417 
-518429 518431 518447 518467 518471 518473 518509 518521 518533 518543 518579 518587 
-518597 518611 518621 518657 518689 518699 518717 518729 518737 518741 518743 518747 
-518759 518761 518767 518779 518801 518803 518807 518809 518813 518831 518863 518867 
-518893 518911 518933 518953 518981 518983 518989 519011 519031 519037 519067 519083 
-519089 519091 519097 519107 519119 519121 519131 519151 519161 519193 519217 519227 
-519229 519247 519257 519269 519283 519287 519301 519307 519349 519353 519359 519371 
-519373 519383 519391 519413 519427 519433 519457 519487 519499 519509 519521 519523 
-519527 519539 519551 519553 519577 519581 519587 519611 519619 519643 519647 519667 
-519683 519691 519703 519713 519733 519737 519769 519787 519793 519797 519803 519817 
-519863 519881 519889 519907 519917 519919 519923 519931 519943 519947 519971 519989 
-519997 520019 520021 520031 520043 520063 520067 520073 520103 520111 520123 520129 
-520151 520193 520213 520241 520279 520291 520297 520307 520309 520313 520339 520349 
-520357 520361 520363 520369 520379 520381 520393 520409 520411 520423 520427 520433 
-520447 520451 520529 520547 520549 520567 520571 520589 520607 520609 520621 520631 
-520633 520649 520679 520691 520699 520703 520717 520721 520747 520759 520763 520787 
-520813 520837 520841 520853 520867 520889 520913 520921 520943 520957 520963 520967 
-520969 520981 521009 521021 521023 521039 521041 521047 521051 521063 521107 521119 
-521137 521153 521161 521167 521173 521177 521179 521201 521231 521243 521251 521267 
-521281 521299 521309 521317 521329 521357 521359 521363 521369 521377 521393 521399 
-521401 521429 521447 521471 521483 521491 521497 521503 521519 521527 521533 521537 
-521539 521551 521557 521567 521581 521603 521641 521657 521659 521669 521671 521693 
-521707 521723 521743 521749 521753 521767 521777 521789 521791 521809 521813 521819 
-521831 521861 521869 521879 521881 521887 521897 521903 521923 521929 521981 521993 
-521999 522017 522037 522047 522059 522061 522073 522079 522083 522113 522127 522157 
-522161 522167 522191 522199 522211 522227 522229 522233 522239 522251 522259 522281 
-522283 522289 522317 522323 522337 522371 522373 522383 522391 522409 522413 522439 
-522449 522469 522479 522497 522517 522521 522523 522541 522553 522569 522601 522623 
-522637 522659 522661 522673 522677 522679 522689 522703 522707 522719 522737 522749 
-522757 522761 522763 522787 522811 522827 522829 522839 522853 522857 522871 522881 
-522883 522887 522919 522943 522947 522959 522961 522989 523007 523021 523031 523049 
-523093 523097 523109 523129 523169 523177 523207 523213 523219 523261 523297 523307 
-523333 523349 523351 523357 523387 523403 523417 523427 523433 523459 523463 523487 
-523489 523493 523511 523519 523541 523543 523553 523571 523573 523577 523597 523603 
-523631 523637 523639 523657 523667 523669 523673 523681 523717 523729 523741 523759 
-523763 523771 523777 523793 523801 523829 523847 523867 523877 523903 523907 523927 
-523937 523949 523969 523987 523997 524047 524053 524057 524063 524071 524081 524087 
-524099 524113 524119 524123 524149 524171 524189 524197 524201 524203 524219 524221 
-524231 524243 524257 524261 524269 524287 524309 524341 524347 524351 524353 524369 
-524387 524389 524411 524413 524429 524453 524497 524507 524509 524519 524521 524591 
-524593 524599 524633 524669 524681 524683 524701 524707 524731 524743 524789 524801 
-524803 524827 524831 524857 524863 524869 524873 524893 524899 524921 524933 524939 
-524941 524947 524957 524959 524963 524969 524971 524981 524983 524999 525001 525013 
-525017 525029 525043 525101 525127 525137 525143 525157 525163 525167 525191 525193 
-525199 525209 525221 525241 525247 525253 525257 525299 525313 525353 525359 525361 
-525373 525377 525379 525391 525397 525409 525431 525433 525439 525457 525461 525467 
-525491 525493 525517 525529 525533 525541 525571 525583 525593 525599 525607 525641 
-525649 525671 525677 525697 525709 525713 525719 525727 525731 525739 525769 525773 
-525781 525809 525817 525839 525869 525871 525887 525893 525913 525923 525937 525947 
-525949 525953 525961 525979 525983 526027 526037 526049 526051 526063 526067 526069 
-526073 526087 526117 526121 526139 526157 526159 526189 526193 526199 526213 526223 
-526231 526249 526271 526283 526289 526291 526297 526307 526367 526373 526381 526387 
-526391 526397 526423 526429 526441 526453 526459 526483 526499 526501 526511 526531 
-526543 526571 526573 526583 526601 526619 526627 526633 526637 526649 526651 526657 
-526667 526679 526681 526703 526709 526717 526733 526739 526741 526759 526763 526777 
-526781 526829 526831 526837 526853 526859 526871 526909 526913 526931 526937 526943 
-526951 526957 526963 526993 526997 527053 527057 527063 527069 527071 527081 527099 
-527123 527129 527143 527159 527161 527173 527179 527203 527207 527209 527237 527251 
-527273 527281 527291 527327 527333 527347 527353 527377 527381 527393 527399 527407 
-527411 527419 527441 527447 527453 527489 527507 527533 527557 527563 527581 527591 
-527599 527603 527623 527627 527633 527671 527699 527701 527729 527741 527749 527753 
-527789 527803 527809 527819 527843 527851 527869 527881 527897 527909 527921 527929 
-527941 527981 527983 527987 527993 528001 528013 528041 528043 528053 528091 528097 
-528107 528127 528131 528137 528163 528167 528191 528197 528217 528223 528247 528263 
-528289 528299 528313 528317 528329 528373 528383 528391 528401 528403 528413 528419 
-528433 528469 528487 528491 528509 528511 528527 528559 528611 528623 528629 528631 
-528659 528667 528673 528679 528691 528707 528709 528719 528763 528779 528791 528799 
-528811 528821 528823 528833 528863 528877 528881 528883 528911 528929 528947 528967 
-528971 528973 528991 529003 529007 529027 529033 529037 529043 529049 529051 529097 
-529103 529117 529121 529127 529129 529153 529157 529181 529183 529213 529229 529237 
-529241 529259 529271 529273 529301 529307 529313 529327 529343 529349 529357 529381 
-529393 529411 529421 529423 529471 529489 529513 529517 529519 529531 529547 529577 
-529579 529603 529619 529637 529649 529657 529673 529681 529687 529691 529693 529709 
-529723 529741 529747 529751 529807 529811 529813 529819 529829 529847 529871 529927 
-529933 529939 529957 529961 529973 529979 529981 529987 529999 530017 530021 530027 
-530041 530051 530063 530087 530093 530129 530137 530143 530177 530183 530197 530203 
-530209 530227 530237 530249 530251 530261 530267 530279 530293 530297 530303 530329 
-530333 530339 530353 530359 530389 530393 530401 530429 530443 530447 530501 530507 
-530513 530527 530531 530533 530539 530549 530567 530597 530599 530603 530609 530641 
-530653 530659 530669 530693 530701 530711 530713 530731 530741 530743 530753 530767 
-530773 530797 530807 530833 530837 530843 530851 530857 530861 530869 530897 530911 
-530947 530969 530977 530983 530989 531017 531023 531043 531071 531079 531101 531103 
-531121 531133 531143 531163 531169 531173 531197 531203 531229 531239 531253 531263 
-531281 531287 531299 531331 531337 531343 531347 531353 531359 531383 531457 531481 
-531497 531521 531547 531551 531569 531571 531581 531589 531611 531613 531623 531631 
-531637 531667 531673 531689 531701 531731 531793 531799 531821 531823 531827 531833 
-531841 531847 531857 531863 531871 531877 531901 531911 531919 531977 531983 531989 
-531997 532001 532009 532027 532033 532061 532069 532093 532099 532141 532153 532159 
-532163 532183 532187 532193 532199 532241 532249 532261 532267 532277 532283 532307 
-532313 532327 532331 532333 532349 532373 532379 532391 532403 532417 532421 532439 
-532447 532451 532453 532489 532501 532523 532529 532531 532537 532547 532561 532601 
-532603 532607 532619 532621 532633 532639 532663 532669 532687 532691 532709 532733 
-532739 532751 532757 532771 532781 532783 532789 532801 532811 532823 532849 532853 
-532867 532907 532919 532949 532951 532981 532993 532999 533003 533009 533011 533033 
-533051 533053 533063 533077 533089 533111 533129 533149 533167 533177 533189 533191 
-533213 533219 533227 533237 533249 533257 533261 533263 533297 533303 533317 533321 
-533327 533353 533363 533371 533389 533399 533413 533447 533453 533459 533509 533543 
-533549 533573 533581 533593 533633 533641 533671 533693 533711 533713 533719 533723 
-533737 533747 533777 533801 533809 533821 533831 533837 533857 533879 533887 533893 
-533909 533921 533927 533959 533963 533969 533971 533989 533993 533999 534007 534013 
-534019 534029 534043 534047 534049 534059 534073 534077 534091 534101 534113 534137 
-534167 534173 534199 534203 534211 534229 534241 534253 534283 534301 534307 534311 
-534323 534329 534341 534367 534371 534403 534407 534431 534439 534473 534491 534511 
-534529 534553 534571 534577 534581 534601 534607 534617 534629 534631 534637 534647 
-534649 534659 534661 534671 534697 534707 534739 534799 534811 534827 534839 534841 
-534851 534857 534883 534889 534913 534923 534931 534943 534949 534971 535013 535019 
-535033 535037 535061 535099 535103 535123 535133 535151 535159 535169 535181 535193 
-535207 535219 535229 535237 535243 535273 535303 535319 535333 535349 535351 535361 
-535387 535391 535399 535481 535487 535489 535499 535511 535523 535529 535547 535571 
-535573 535589 535607 535609 535627 535637 535663 535669 535673 535679 535697 535709 
-535727 535741 535751 535757 535771 535783 535793 535811 535849 535859 535861 535879 
-535919 535937 535939 535943 535957 535967 535973 535991 535999 536017 536023 536051 
-536057 536059 536069 536087 536099 536101 536111 536141 536147 536149 536189 536191 
-536203 536213 536219 536227 536233 536243 536267 536273 536279 536281 536287 536293 
-536311 536323 536353 536357 536377 536399 536407 536423 536441 536443 536447 536449 
-536453 536461 536467 536479 536491 536509 536513 536531 536533 536561 536563 536593 
-536609 536621 536633 536651 536671 536677 536687 536699 536717 536719 536729 536743 
-536749 536771 536773 536777 536779 536791 536801 536803 536839 536849 536857 536867 
-536869 536891 536909 536917 536923 536929 536933 536947 536953 536971 536989 536999 
-537001 537007 537011 537023 537029 537037 537041 537067 537071 537079 537091 537127 
-537133 537143 537157 537169 537181 537191 537197 537221 537233 537241 537269 537281 
-537287 537307 537331 537343 537347 537373 537379 537401 537403 537413 537497 537527 
-537547 537569 537583 537587 537599 537611 537637 537661 537673 537679 537703 537709 
-537739 537743 537749 537769 537773 537781 537787 537793 537811 537841 537847 537853 
-537877 537883 537899 537913 537919 537941 537991 538001 538019 538049 538051 538073 
-538079 538093 538117 538121 538123 538127 538147 538151 538157 538159 538163 538199 
-538201 538247 538249 538259 538267 538283 538297 538301 538303 538309 538331 538333 
-538357 538367 538397 538399 538411 538423 538457 538471 538481 538487 538511 538513 
-538519 538523 538529 538553 538561 538567 538579 538589 538597 538621 538649 538651 
-538697 538709 538711 538721 538723 538739 538751 538763 538771 538777 538789 538799 
-538801 538817 538823 538829 538841 538871 538877 538921 538927 538931 538939 538943 
-538987 539003 539009 539039 539047 539089 539093 539101 539107 539111 539113 539129 
-539141 539153 539159 539167 539171 539207 539219 539233 539237 539261 539267 539269 
-539293 539303 539309 539311 539321 539323 539339 539347 539351 539389 539401 539447 
-539449 539479 539501 539503 539507 539509 539533 539573 539621 539629 539633 539639 
-539641 539653 539663 539677 539687 539711 539713 539723 539729 539743 539761 539783 
-539797 539837 539839 539843 539849 539863 539881 539897 539899 539921 539947 539993 
-540041 540061 540079 540101 540119 540121 540139 540149 540157 540167 540173 540179 
-540181 540187 540203 540217 540233 540251 540269 540271 540283 540301 540307 540343 
-540347 540349 540367 540373 540377 540383 540389 540391 540433 540437 540461 540469 
-540509 540511 540517 540539 540541 540557 540559 540577 540587 540599 540611 540613 
-540619 540629 540677 540679 540689 540691 540697 540703 540713 540751 540769 540773 
-540779 540781 540803 540809 540823 540851 540863 540871 540877 540901 540907 540961 
-540989 541001 541007 541027 541049 541061 541087 541097 541129 541133 541141 541153 
-541181 541193 541201 541217 541231 541237 541249 541267 541271 541283 541301 541309 
-541339 541349 541361 541363 541369 541381 541391 541417 541439 541447 541469 541483 
-541507 541511 541523 541529 541531 541537 541543 541547 541549 541571 541577 541579 
-541589 541613 541631 541657 541661 541669 541693 541699 541711 541721 541727 541759 
-541763 541771 541777 541781 541799 541817 541831 541837 541859 541889 541901 541927 
-541951 541967 541987 541991 541993 541999 542021 542023 542027 542053 542063 542071 
-542081 542083 542093 542111 542117 542119 542123 542131 542141 542149 542153 542167 
-542183 542189 542197 542207 542219 542237 542251 542261 542263 542281 542293 542299 
-542323 542371 542401 542441 542447 542461 542467 542483 542489 542497 542519 542533 
-542537 542539 542551 542557 542567 542579 542587 542599 542603 542683 542687 542693 
-542713 542719 542723 542747 542761 542771 542783 542791 542797 542821 542831 542837 
-542873 542891 542911 542921 542923 542933 542939 542947 542951 542981 542987 542999 
-543017 543019 543029 543061 543097 543113 543131 543139 543143 543149 543157 543161 
-543163 543187 543203 543217 543223 543227 543233 543241 543253 543259 543281 543287 
-543289 543299 543307 543311 543313 543341 543349 543353 543359 543379 543383 543407 
-543427 543463 543497 543503 543509 543539 543551 543553 543593 543601 543607 543611 
-543617 543637 543659 543661 543671 543679 543689 543703 543707 543713 543769 543773 
-543787 543791 543793 543797 543811 543827 543841 543853 543857 543859 543871 543877 
-543883 543887 543889 543901 543911 543929 543967 543971 543997 544001 544007 544009 
-544013 544021 544031 544097 544099 544109 544123 544129 544133 544139 544171 544177 
-544183 544199 544223 544259 544273 544277 544279 544367 544373 544399 544403 544429 
-544451 544471 544477 544487 544501 544513 544517 544543 544549 544601 544613 544627 
-544631 544651 544667 544699 544717 544721 544723 544727 544757 544759 544771 544781 
-544793 544807 544813 544837 544861 544877 544879 544883 544889 544897 544903 544919 
-544927 544937 544961 544963 544979 545023 545029 545033 545057 545063 545087 545089 
-545093 545117 545131 545141 545143 545161 545189 545203 545213 545231 545239 545257 
-545267 545291 545329 545371 545387 545429 545437 545443 545449 545473 545477 545483 
-545497 545521 545527 545533 545543 545549 545551 545579 545599 545609 545617 545621 
-545641 545647 545651 545663 545711 545723 545731 545747 545749 545759 545773 545789 
-545791 545827 545843 545863 545873 545893 545899 545911 545917 545929 545933 545939 
-545947 545959 546001 546017 546019 546031 546047 546053 546067 546071 546097 546101 
-546103 546109 546137 546149 546151 546173 546179 546197 546211 546233 546239 546241 
-546253 546263 546283 546289 546317 546323 546341 546349 546353 546361 546367 546373 
-546391 546461 546467 546479 546509 546523 546547 546569 546583 546587 546599 546613 
-546617 546619 546631 546643 546661 546671 546677 546683 546691 546709 546719 546731 
-546739 546781 546841 546859 546863 546869 546881 546893 546919 546937 546943 546947 
-546961 546967 546977 547007 547021 547037 547061 547087 547093 547097 547103 547121 
-547133 547139 547171 547223 547229 547237 547241 547249 547271 547273 547291 547301 
-547321 547357 547361 547363 547369 547373 547387 547397 547399 547411 547441 547453 
-547471 547483 547487 547493 547499 547501 547513 547529 547537 547559 547567 547577 
-547583 547601 547609 547619 547627 547639 547643 547661 547663 547681 547709 547727 
-547741 547747 547753 547763 547769 547787 547817 547819 547823 547831 547849 547853 
-547871 547889 547901 547909 547951 547957 547999 548003 548039 548059 548069 548083 
-548089 548099 548117 548123 548143 548153 548189 548201 548213 548221 548227 548239 
-548243 548263 548291 548309 548323 548347 548351 548363 548371 548393 548399 548407 
-548417 548423 548441 548453 548459 548461 548489 548501 548503 548519 548521 548533 
-548543 548557 548567 548579 548591 548623 548629 548657 548671 548677 548687 548693 
-548707 548719 548749 548753 548761 548771 548783 548791 548827 548831 548833 548837 
-548843 548851 548861 548869 548893 548897 548903 548909 548927 548953 548957 548963 
-549001 549011 549013 549019 549023 549037 549071 549089 549091 549097 549121 549139 
-549149 549161 549163 549167 549169 549193 549203 549221 549229 549247 549257 549259 
-549281 549313 549319 549323 549331 549379 549391 549403 549421 549431 549443 549449 
-549481 549503 549509 549511 549517 549533 549547 549551 549553 549569 549587 549589 
-549607 549623 549641 549643 549649 549667 549683 549691 549701 549707 549713 549719 
-549733 549737 549739 549749 549751 549767 549817 549833 549839 549863 549877 549883 
-549911 549937 549943 549949 549977 549979 550007 550009 550027 550049 550061 550063 
-550073 550111 550117 550127 550129 550139 550163 550169 550177 550181 550189 550211 
-550213 550241 550267 550279 550283 550289 550309 550337 550351 550369 550379 550427 
-550439 550441 550447 550457 550469 550471 550489 550513 550519 550531 550541 550553 
-550577 550607 550609 550621 550631 550637 550651 550657 550661 550663 550679 550691 
-550703 550717 550721 550733 550757 550763 550789 550801 550811 550813 550831 550841 
-550843 550859 550861 550903 550909 550937 550939 550951 550961 550969 550973 550993 
-550997 551003 551017 551027 551039 551059 551063 551069 551093 551099 551107 551113 
-551129 551143 551179 551197 551207 551219 551231 551233 551269 551281 551297 551311 
-551321 551339 551347 551363 551381 551387 551407 551423 551443 551461 551483 551489 
-551503 551519 551539 551543 551549 551557 551569 551581 551587 551597 551651 551653 
-551659 551671 551689 551693 551713 551717 551723 551729 551731 551743 551753 551767 
-551773 551801 551809 551813 551843 551849 551861 551909 551911 551917 551927 551933 
-551951 551959 551963 551981 552001 552011 552029 552031 552047 552053 552059 552089 
-552091 552103 552107 552113 552127 552137 552179 552193 552217 552239 552241 552259 
-552263 552271 552283 552301 552317 552341 552353 552379 552397 552401 552403 552469 
-552473 552481 552491 552493 552511 552523 552527 552553 552581 552583 552589 552611 
-552649 552659 552677 552703 552707 552709 552731 552749 552751 552757 552787 552791 
-552793 552809 552821 552833 552841 552847 552859 552883 552887 552899 552913 552917 
-552971 552983 552991 553013 553037 553043 553051 553057 553067 553073 553093 553097 
-553099 553103 553123 553139 553141 553153 553171 553181 553193 553207 553211 553229 
-553249 553253 553277 553279 553309 553351 553363 553369 553411 553417 553433 553439 
-553447 553457 553463 553471 553481 553507 553513 553517 553529 553543 553549 553561 
-553573 553583 553589 553591 553601 553607 553627 553643 553649 553667 553681 553687 
-553699 553703 553727 553733 553747 553757 553759 553769 553789 553811 553837 553849 
-553867 553873 553897 553901 553919 553921 553933 553961 553963 553981 553991 554003 
-554011 554017 554051 554077 554087 554089 554117 554123 554129 554137 554167 554171 
-554179 554189 554207 554209 554233 554237 554263 554269 554293 554299 554303 554317 
-554347 554377 554383 554417 554419 554431 554447 554453 554467 554503 554527 554531 
-554569 554573 554597 554611 554627 554633 554639 554641 554663 554669 554677 554699 
-554707 554711 554731 554747 554753 554759 554767 554779 554789 554791 554797 554803 
-554821 554833 554837 554839 554843 554849 554887 554891 554893 554899 554923 554927 
-554951 554959 554969 554977 555029 555041 555043 555053 555073 555077 555083 555091 
-555097 555109 555119 555143 555167 555209 555221 555251 555253 555257 555277 555287 
-555293 555301 555307 555337 555349 555361 555383 555391 555419 555421 555439 555461 
-555487 555491 555521 555523 555557 555589 555593 555637 555661 555671 555677 555683 
-555691 555697 555707 555739 555743 555761 555767 555823 555827 555829 555853 555857 
-555871 555931 555941 555953 555967 556007 556021 556027 556037 556043 556051 556067 
-556069 556093 556103 556123 556159 556177 556181 556211 556219 556229 556243 556253 
-556261 556267 556271 556273 556279 556289 556313 556321 556327 556331 556343 556351 
-556373 556399 556403 556441 556459 556477 556483 556487 556513 556519 556537 556559 
-556573 556579 556583 556601 556607 556609 556613 556627 556639 556651 556679 556687 
-556691 556693 556697 556709 556723 556727 556741 556753 556763 556769 556781 556789 
-556793 556799 556811 556817 556819 556823 556841 556849 556859 556861 556867 556883 
-556891 556931 556939 556943 556957 556967 556981 556987 556999 557017 557021 557027 
-557033 557041 557057 557059 557069 557087 557093 557153 557159 557197 557201 557261 
-557269 557273 557281 557303 557309 557321 557329 557339 557369 557371 557377 557423 
-557443 557449 557461 557483 557489 557519 557521 557533 557537 557551 557567 557573 
-557591 557611 557633 557639 557663 557671 557693 557717 557729 557731 557741 557743 
-557747 557759 557761 557779 557789 557801 557803 557831 557857 557861 557863 557891 
-557899 557903 557927 557981 557987 558007 558017 558029 558053 558067 558083 558091 
-558109 558113 558121 558139 558149 558167 558179 558197 558203 558209 558223 558241 
-558251 558253 558287 558289 558307 558319 558343 558401 558413 558421 558427 558431 
-558457 558469 558473 558479 558491 558497 558499 558521 558529 558533 558539 558541 
-558563 558583 558587 558599 558611 558629 558643 558661 558683 558703 558721 558731 
-558757 558769 558781 558787 558791 558793 558827 558829 558863 558869 558881 558893 
-558913 558931 558937 558947 558973 558979 558997 559001 559049 559051 559067 559081 
-559093 559099 559123 559133 559157 559177 559183 559201 559211 559213 559217 559219 
-559231 559243 559259 559277 559297 559313 559319 559343 559357 559367 559369 559397 
-559421 559451 559459 559469 559483 559511 559513 559523 559529 559541 559547 559549 
-559561 559571 559577 559583 559591 559597 559631 559633 559639 559649 559667 559673 
-559679 559687 559703 559709 559739 559747 559777 559781 559799 559807 559813 559831 
-559841 559849 559859 559877 559883 559901 559907 559913 559939 559967 559973 559991 
-560017 560023 560029 560039 560047 560081 560083 560089 560093 560107 560113 560117 
-560123 560137 560149 560159 560171 560173 560179 560191 560207 560213 560221 560227 
-560233 560237 560239 560243 560249 560281 560293 560297 560299 560311 560317 560341 
-560353 560393 560411 560437 560447 560459 560471 560477 560479 560489 560491 560501 
-560503 560531 560543 560551 560561 560597 560617 560621 560639 560641 560653 560669 
-560683 560689 560701 560719 560737 560753 560761 560767 560771 560783 560797 560803 
-560827 560837 560863 560869 560873 560887 560891 560893 560897 560929 560939 560941 
-560969 560977 561019 561047 561053 561059 561061 561079 561083 561091 561097 561101 
-561103 561109 561161 561173 561181 561191 561199 561229 561251 561277 561307 561313 
-561343 561347 561359 561367 561373 561377 561389 561409 561419 561439 561461 561521 
-561529 561551 561553 561559 561599 561607 561667 561703 561713 561733 561761 561767 
-561787 561797 561809 561829 561839 561907 561917 561923 561931 561943 561947 561961 
-561973 561983 561997 562007 562019 562021 562043 562091 562103 562129 562147 562169 
-562181 562193 562201 562231 562259 562271 562273 562283 562291 562297 562301 562307 
-562313 562333 562337 562349 562351 562357 562361 562399 562403 562409 562417 562421 
-562427 562439 562459 562477 562493 562501 562517 562519 562537 562577 562579 562589 
-562591 562607 562613 562621 562631 562633 562651 562663 562669 562673 562691 562693 
-562699 562703 562711 562721 562739 562753 562759 562763 562781 562789 562813 562831 
-562841 562871 562897 562901 562909 562931 562943 562949 562963 562967 562973 562979 
-562987 562997 563009 563011 563021 563039 563041 563047 563051 563077 563081 563099 
-563113 563117 563119 563131 563149 563153 563183 563197 563219 563249 563263 563287 
-563327 563351 563357 563359 563377 563401 563411 563413 563417 563419 563447 563449 
-563467 563489 563501 563503 563543 563551 563561 563587 563593 563599 563623 563657 
-563663 563723 563743 563747 563777 563809 563813 563821 563831 563837 563851 563869 
-563881 563887 563897 563929 563933 563947 563971 563987 563999 564013 564017 564041 
-564049 564059 564061 564089 564097 564103 564127 564133 564149 564163 564173 564191 
-564197 564227 564229 564233 564251 564257 564269 564271 564299 564301 564307 564313 
-564323 564353 564359 564367 564371 564373 564391 564401 564407 564409 564419 564437 
-564449 564457 564463 564467 564491 564497 564523 564533 564593 564607 564617 564643 
-564653 564667 564671 564679 564701 564703 564709 564713 564761 564779 564793 564797 
-564827 564871 564881 564899 564917 564919 564923 564937 564959 564973 564979 564983 
-564989 564997 565013 565039 565049 565057 565069 565109 565111 565127 565163 565171 
-565177 565183 565189 565207 565237 565241 565247 565259 565261 565273 565283 565289 
-565303 565319 565333 565337 565343 565361 565379 565381 565387 565391 565393 565427 
-565429 565441 565451 565463 565469 565483 565489 565507 565511 565517 565519 565549 
-565553 565559 565567 565571 565583 565589 565597 565603 565613 565637 565651 565661 
-565667 565723 565727 565769 565771 565787 565793 565813 565849 565867 565889 565891 
-565907 565909 565919 565921 565937 565973 565979 565997 566011 566023 566047 566057 
-566077 566089 566101 566107 566131 566149 566161 566173 566179 566183 566201 566213 
-566227 566231 566233 566273 566311 566323 566347 566387 566393 566413 566417 566429 
-566431 566437 566441 566443 566453 566521 566537 566539 566543 566549 566551 566557 
-566563 566567 566617 566633 566639 566653 566659 566677 566681 566693 566701 566707 
-566717 566719 566723 566737 566759 566767 566791 566821 566833 566851 566857 566879 
-566911 566939 566947 566963 566971 566977 566987 566999 567011 567013 567031 567053 
-567059 567067 567097 567101 567107 567121 567143 567179 567181 567187 567209 567257 
-567263 567277 567319 567323 567367 567377 567383 567389 567401 567407 567439 567449 
-567451 567467 567487 567493 567499 567527 567529 567533 567569 567601 567607 567631 
-567649 567653 567659 567661 567667 567673 567689 567719 567737 567751 567761 567767 
-567779 567793 567811 567829 567841 567857 567863 567871 567877 567881 567883 567899 
-567937 567943 567947 567949 567961 567979 567991 567997 568019 568027 568033 568049 
-568069 568091 568097 568109 568133 568151 568153 568163 568171 568177 568187 568189 
-568193 568201 568207 568231 568237 568241 568273 568279 568289 568303 568349 568363 
-568367 568387 568391 568433 568439 568441 568453 568471 568481 568493 568523 568541 
-568549 568577 568609 568619 568627 568643 568657 568669 568679 568691 568699 568709 
-568723 568751 568783 568787 568807 568823 568831 568853 568877 568891 568903 568907 
-568913 568921 568963 568979 568987 568991 568999 569003 569011 569021 569047 569053 
-569057 569071 569077 569081 569083 569111 569117 569137 569141 569159 569161 569189 
-569197 569201 569209 569213 569237 569243 569249 569251 569263 569267 569269 569321 
-569323 569369 569417 569419 569423 569431 569447 569461 569479 569497 569507 569533 
-569573 569579 569581 569599 569603 569609 569617 569623 569659 569663 569671 569683 
-569711 569713 569717 569729 569731 569747 569759 569771 569773 569797 569809 569813 
-569819 569831 569839 569843 569851 569861 569869 569887 569893 569897 569903 569927 
-569939 569957 569983 570001 570013 570029 570041 570043 570047 570049 570071 570077 
-570079 570083 570091 570107 570109 570113 570131 570139 570161 570173 570181 570191 
-570217 570221 570233 570253 570329 570359 570373 570379 570389 570391 570403 570407 
-570413 570419 570421 570461 570463 570467 570487 570491 570497 570499 570509 570511 
-570527 570529 570539 570547 570553 570569 570587 570601 570613 570637 570643 570649 
-570659 570667 570671 570677 570683 570697 570719 570733 570737 570743 570781 570821 
-570827 570839 570841 570851 570853 570859 570881 570887 570901 570919 570937 570949 
-570959 570961 570967 570991 571001 571019 571031 571037 571049 571069 571093 571099 
-571111 571133 571147 571157 571163 571199 571201 571211 571223 571229 571231 571261 
-571267 571279 571303 571321 571331 571339 571369 571381 571397 571399 571409 571433 
-571453 571471 571477 571531 571541 571579 571583 571589 571601 571603 571633 571657 
-571673 571679 571699 571709 571717 571721 571741 571751 571759 571777 571783 571789 
-571799 571801 571811 571841 571847 571853 571861 571867 571871 571873 571877 571903 
-571933 571939 571969 571973 572023 572027 572041 572051 572053 572059 572063 572069 
-572087 572093 572107 572137 572161 572177 572179 572183 572207 572233 572239 572251 
-572269 572281 572303 572311 572321 572323 572329 572333 572357 572387 572399 572417 
-572419 572423 572437 572449 572461 572471 572479 572491 572497 572519 572521 572549 
-572567 572573 572581 572587 572597 572599 572609 572629 572633 572639 572651 572653 
-572657 572659 572683 572687 572699 572707 572711 572749 572777 572791 572801 572807 
-572813 572821 572827 572833 572843 572867 572879 572881 572903 572909 572927 572933 
-572939 572941 572963 572969 572993 573007 573031 573047 573101 573107 573109 573119 
-573143 573161 573163 573179 573197 573247 573253 573263 573277 573289 573299 573317 
-573329 573341 573343 573371 573379 573383 573409 573437 573451 573457 573473 573479 
-573481 573487 573493 573497 573509 573511 573523 573527 573557 573569 573571 573637 
-573647 573673 573679 573691 573719 573737 573739 573757 573761 573763 573787 573791 
-573809 573817 573829 573847 573851 573863 573871 573883 573887 573899 573901 573929 
-573941 573953 573967 573973 573977 574003 574031 574033 574051 574061 574081 574099 
-574109 574127 574157 574159 574163 574169 574181 574183 574201 574219 574261 574279 
-574283 574289 574297 574307 574309 574363 574367 574373 574393 574423 574429 574433 
-574439 574477 574489 574493 574501 574507 574529 574543 574547 574597 574619 574621 
-574627 574631 574643 574657 574667 574687 574699 574703 574711 574723 574727 574733 
-574741 574789 574799 574801 574813 574817 574859 574907 574913 574933 574939 574949 
-574963 574967 574969 575009 575027 575033 575053 575063 575077 575087 575119 575123 
-575129 575131 575137 575153 575173 575177 575203 575213 575219 575231 575243 575249 
-575251 575257 575261 575303 575317 575359 575369 575371 575401 575417 575429 575431 
-575441 575473 575479 575489 575503 575513 575551 575557 575573 575579 575581 575591 
-575593 575611 575623 575647 575651 575669 575677 575689 575693 575699 575711 575717 
-575723 575747 575753 575777 575791 575821 575837 575849 575857 575863 575867 575893 
-575903 575921 575923 575941 575957 575959 575963 575987 576001 576013 576019 576029 
-576031 576041 576049 576089 576101 576119 576131 576151 576161 576167 576179 576193 
-576203 576211 576217 576221 576223 576227 576287 576293 576299 576313 576319 576341 
-576377 576379 576391 576421 576427 576431 576439 576461 576469 576473 576493 576509 
-576523 576529 576533 576539 576551 576553 576577 576581 576613 576617 576637 576647 
-576649 576659 576671 576677 576683 576689 576701 576703 576721 576727 576731 576739 
-576743 576749 576757 576769 576787 576791 576881 576883 576889 576899 576943 576949 
-576967 576977 577007 577009 577033 577043 577063 577067 577069 577081 577097 577111 
-577123 577147 577151 577153 577169 577177 577193 577219 577249 577259 577271 577279 
-577307 577327 577331 577333 577349 577351 577363 577387 577397 577399 577427 577453 
-577457 577463 577471 577483 577513 577517 577523 577529 577531 577537 577547 577559 
-577573 577589 577601 577613 577627 577637 577639 577667 577721 577739 577751 577757 
-577781 577799 577807 577817 577831 577849 577867 577873 577879 577897 577901 577909 
-577919 577931 577937 577939 577957 577979 577981 578021 578029 578041 578047 578063 
-578077 578093 578117 578131 578167 578183 578191 578203 578209 578213 578251 578267 
-578297 578299 578309 578311 578317 578327 578353 578363 578371 578399 578401 578407 
-578419 578441 578453 578467 578477 578483 578489 578497 578503 578509 578533 578537 
-578563 578573 578581 578587 578597 578603 578609 578621 578647 578659 578687 578689 
-578693 578701 578719 578729 578741 578777 578779 578789 578803 578819 578821 578827 
-578839 578843 578857 578861 578881 578917 578923 578957 578959 578971 578999 579011 
-579017 579023 579053 579079 579083 579107 579113 579119 579133 579179 579197 579199 
-579239 579251 579259 579263 579277 579281 579283 579287 579311 579331 579353 579379 
-579407 579409 579427 579433 579451 579473 579497 579499 579503 579517 579521 579529 
-579533 579539 579541 579563 579569 579571 579583 579587 579611 579613 579629 579637 
-579641 579643 579653 579673 579701 579707 579713 579721 579737 579757 579763 579773 
-579779 579809 579829 579851 579869 579877 579881 579883 579893 579907 579947 579949 
-579961 579967 579973 579983 580001 580031 580033 580079 580081 580093 580133 580163 
-580169 580183 580187 580201 580213 580219 580231 580259 580291 580301 580303 580331 
-580339 580343 580357 580361 580373 580379 580381 580409 580417 580471 580477 580487 
-580513 580529 580549 580553 580561 580577 580607 580627 580631 580633 580639 580663 
-580673 580687 580691 580693 580711 580717 580733 580747 580757 580759 580763 580787 
-580793 580807 580813 580837 580843 580859 580871 580889 580891 580901 580913 580919 
-580927 580939 580969 580981 580997 581029 581041 581047 581069 581071 581089 581099 
-581101 581137 581143 581149 581171 581173 581177 581183 581197 581201 581227 581237 
-581239 581261 581263 581293 581303 581311 581323 581333 581341 581351 581353 581369 
-581377 581393 581407 581411 581429 581443 581447 581459 581473 581491 581521 581527 
-581549 581551 581557 581573 581597 581599 581617 581639 581657 581663 581683 581687 
-581699 581701 581729 581731 581743 581753 581767 581773 581797 581809 581821 581843 
-581857 581863 581869 581873 581891 581909 581921 581941 581947 581953 581981 581983 
-582011 582013 582017 582031 582037 582067 582083 582119 582137 582139 582157 582161 
-582167 582173 582181 582203 582209 582221 582223 582227 582247 582251 582299 582317 
-582319 582371 582391 582409 582419 582427 582433 582451 582457 582469 582499 582509 
-582511 582541 582551 582563 582587 582601 582623 582643 582649 582677 582689 582691 
-582719 582721 582727 582731 582737 582761 582763 582767 582773 582781 582793 582809 
-582821 582851 582853 582859 582887 582899 582931 582937 582949 582961 582971 582973 
-582983 583007 583013 583019 583021 583031 583069 583087 583127 583139 583147 583153 
-583169 583171 583181 583189 583207 583213 583229 583237 583249 583267 583273 583279 
-583291 583301 583337 583339 583351 583367 583391 583397 583403 583409 583417 583421 
-583447 583459 583469 583481 583493 583501 583511 583519 583523 583537 583543 583577 
-583603 583613 583619 583621 583631 583651 583657 583669 583673 583697 583727 583733 
-583753 583769 583777 583783 583789 583801 583841 583853 583859 583861 583873 583879 
-583903 583909 583937 583969 583981 583991 583997 584011 584027 584033 584053 584057 
-584063 584081 584099 584141 584153 584167 584183 584203 584249 584261 584279 584281 
-584303 584347 584357 584359 584377 584387 584393 584399 584411 584417 584429 584447 
-584471 584473 584509 584531 584557 584561 584587 584593 584599 584603 584609 584621 
-584627 584659 584663 584677 584693 584699 584707 584713 584719 584723 584737 584767 
-584777 584789 584791 584809 584849 584863 584869 584873 584879 584897 584911 584917 
-584923 584951 584963 584971 584981 584993 584999 585019 585023 585031 585037 585041 
-585043 585049 585061 585071 585073 585077 585107 585113 585119 585131 585149 585163 
-585199 585217 585251 585269 585271 585283 585289 585313 585317 585337 585341 585367 
-585383 585391 585413 585437 585443 585461 585467 585493 585503 585517 585547 585551 
-585569 585577 585581 585587 585593 585601 585619 585643 585653 585671 585677 585691 
-585721 585727 585733 585737 585743 585749 585757 585779 585791 585799 585839 585841 
-585847 585853 585857 585863 585877 585881 585883 585889 585899 585911 585913 585917 
-585919 585953 585989 585997 586009 586037 586051 586057 586067 586073 586087 586111 
-586121 586123 586129 586139 586147 586153 586189 586213 586237 586273 586277 586291 
-586301 586309 586319 586349 586361 586363 586367 586387 586403 586429 586433 586457 
-586459 586463 586471 586493 586499 586501 586541 586543 586567 586571 586577 586589 
-586601 586603 586609 586627 586631 586633 586667 586679 586693 586711 586723 586741 
-586769 586787 586793 586801 586811 586813 586819 586837 586841 586849 586871 586897 
-586903 586909 586919 586921 586933 586939 586951 586961 586973 586979 586981 587017 
-587021 587033 587051 587053 587057 587063 587087 587101 587107 587117 587123 587131 
-587137 587143 587149 587173 587179 587189 587201 587219 587263 587267 587269 587281 
-587287 587297 587303 587341 587371 587381 587387 587413 587417 587429 587437 587441 
-587459 587467 587473 587497 587513 587519 587527 587533 587539 587549 587551 587563 
-587579 587599 587603 587617 587621 587623 587633 587659 587669 587677 587687 587693 
-587711 587731 587737 587747 587749 587753 587771 587773 587789 587813 587827 587833 
-587849 587863 587887 587891 587897 587927 587933 587947 587959 587969 587971 587987 
-587989 587999 588011 588019 588037 588043 588061 588073 588079 588083 588097 588113 
-588121 588131 588151 588167 588169 588173 588191 588199 588229 588239 588241 588257 
-588277 588293 588311 588347 588359 588361 588383 588389 588397 588403 588433 588437 
-588463 588481 588493 588503 588509 588517 588521 588529 588569 588571 588619 588631 
-588641 588647 588649 588667 588673 588683 588703 588733 588737 588743 588767 588773 
-588779 588811 588827 588839 588871 588877 588881 588893 588911 588937 588941 588947 
-588949 588953 588977 589021 589027 589049 589063 589109 589111 589123 589139 589159 
-589163 589181 589187 589189 589207 589213 589219 589231 589241 589243 589273 589289 
-589291 589297 589327 589331 589349 589357 589387 589409 589439 589451 589453 589471 
-589481 589493 589507 589529 589531 589579 589583 589591 589601 589607 589609 589639 
-589643 589681 589711 589717 589751 589753 589759 589763 589783 589793 589807 589811 
-589829 589847 589859 589861 589873 589877 589903 589921 589933 589993 589997 590021 
-590027 590033 590041 590071 590077 590099 590119 590123 590129 590131 590137 590141 
-590153 590171 590201 590207 590243 590251 590263 590267 590269 590279 590309 590321 
-590323 590327 590357 590363 590377 590383 590389 590399 590407 590431 590437 590489 
-590537 590543 590567 590573 590593 590599 590609 590627 590641 590647 590657 590659 
-590669 590713 590717 590719 590741 590753 590771 590797 590809 590813 590819 590833 
-590839 590867 590899 590921 590923 590929 590959 590963 590983 590987 591023 591053 
-591061 591067 591079 591089 591091 591113 591127 591131 591137 591161 591163 591181 
-591193 591233 591259 591271 591287 591289 591301 591317 591319 591341 591377 591391 
-591403 591407 591421 591431 591443 591457 591469 591499 591509 591523 591553 591559 
-591581 591599 591601 591611 591623 591649 591653 591659 591673 591691 591709 591739 
-591743 591749 591751 591757 591779 591791 591827 591841 591847 591863 591881 591887 
-591893 591901 591937 591959 591973 592019 592027 592049 592057 592061 592073 592087 
-592099 592121 592129 592133 592139 592157 592199 592217 592219 592223 592237 592261 
-592289 592303 592307 592309 592321 592337 592343 592351 592357 592367 592369 592387 
-592391 592393 592429 592451 592453 592463 592469 592483 592489 592507 592517 592531 
-592547 592561 592577 592589 592597 592601 592609 592621 592639 592643 592649 592661 
-592663 592681 592693 592723 592727 592741 592747 592759 592763 592793 592843 592849 
-592853 592861 592873 592877 592897 592903 592919 592931 592939 592967 592973 592987 
-592993 593003 593029 593041 593051 593059 593071 593081 593083 593111 593119 593141 
-593143 593149 593171 593179 593183 593207 593209 593213 593227 593231 593233 593251 
-593261 593273 593291 593293 593297 593321 593323 593353 593381 593387 593399 593401 
-593407 593429 593447 593449 593473 593479 593491 593497 593501 593507 593513 593519 
-593531 593539 593573 593587 593597 593603 593627 593629 593633 593641 593647 593651 
-593689 593707 593711 593767 593777 593783 593839 593851 593863 593869 593899 593903 
-593933 593951 593969 593977 593987 593993 594023 594037 594047 594091 594103 594107 
-594119 594137 594151 594157 594161 594163 594179 594193 594203 594211 594227 594241 
-594271 594281 594283 594287 594299 594311 594313 594329 594359 594367 594379 594397 
-594401 594403 594421 594427 594449 594457 594467 594469 594499 594511 594521 594523 
-594533 594551 594563 594569 594571 594577 594617 594637 594641 594653 594667 594679 
-594697 594709 594721 594739 594749 594751 594773 594793 594821 594823 594827 594829 
-594857 594889 594899 594911 594917 594929 594931 594953 594959 594961 594977 594989 
-595003 595037 595039 595043 595057 595069 595073 595081 595087 595093 595097 595117 
-595123 595129 595139 595141 595157 595159 595181 595183 595201 595207 595229 595247 
-595253 595261 595267 595271 595277 595291 595303 595313 595319 595333 595339 595351 
-595363 595373 595379 595381 595411 595451 595453 595481 595513 595519 595523 595547 
-595549 595571 595577 595579 595613 595627 595687 595703 595709 595711 595717 595733 
-595741 595801 595807 595817 595843 595873 595877 595927 595939 595943 595949 595951 
-595957 595961 595963 595967 595981 596009 596021 596027 596047 596053 596059 596069 
-596081 596083 596093 596117 596119 596143 596147 596159 596179 596209 596227 596231 
-596243 596251 596257 596261 596273 596279 596291 596293 596317 596341 596363 596369 
-596399 596419 596423 596461 596489 596503 596507 596537 596569 596573 596579 596587 
-596593 596599 596611 596623 596633 596653 596663 596669 596671 596693 596707 596737 
-596741 596749 596767 596779 596789 596803 596821 596831 596839 596851 596857 596861 
-596863 596879 596899 596917 596927 596929 596933 596941 596963 596977 596983 596987 
-597031 597049 597053 597059 597073 597127 597131 597133 597137 597169 597209 597221 
-597239 597253 597263 597269 597271 597301 597307 597349 597353 597361 597367 597383 
-597391 597403 597407 597409 597419 597433 597437 597451 597473 597497 597521 597523 
-597539 597551 597559 597577 597581 597589 597593 597599 597613 597637 597643 597659 
-597671 597673 597677 597679 597689 597697 597757 597761 597767 597769 597781 597803 
-597823 597827 597833 597853 597859 597869 597889 597899 597901 597923 597929 597967 
-597997 598007 598049 598051 598057 598079 598093 598099 598123 598127 598141 598151 
-598159 598163 598187 598189 598193 598219 598229 598261 598303 598307 598333 598363 
-598369 598379 598387 598399 598421 598427 598439 598447 598457 598463 598487 598489 
-598501 598537 598541 598571 598613 598643 598649 598651 598657 598669 598681 598687 
-598691 598711 598721 598727 598729 598777 598783 598789 598799 598817 598841 598853 
-598867 598877 598883 598891 598903 598931 598933 598963 598967 598973 598981 598987 
-598999 599003 599009 599021 599023 599069 599087 599117 599143 599147 599149 599153 
-599191 599213 599231 599243 599251 599273 599281 599303 599309 599321 599341 599353 
-599359 599371 599383 599387 599399 599407 599413 599419 599429 599477 599479 599491 
-599513 599519 599537 599551 599561 599591 599597 599603 599611 599623 599629 599657 
-599663 599681 599693 599699 599701 599713 599719 599741 599759 599779 599783 599803 
-599831 599843 599857 599869 599891 599899 599927 599933 599939 599941 599959 599983 
-599993 599999 600011 600043 600053 600071 600073 600091 600101 600109 600167 600169 
-600203 600217 600221 600233 600239 600241 600247 600269 600283 600289 600293 600307 
-600311 600317 600319 600337 600359 600361 600367 600371 600401 600403 600407 600421 
-600433 600449 600451 600463 600469 600487 600517 600529 600557 600569 600577 600601 
-600623 600631 600641 600659 600673 600689 600697 600701 600703 600727 600751 600791 
-600823 600827 600833 600841 600857 600877 600881 600883 600889 600893 600931 600947 
-600949 600959 600961 600973 600979 600983 601021 601031 601037 601039 601043 601061 
-601067 601079 601093 601127 601147 601187 601189 601193 601201 601207 601219 601231 
-601241 601247 601259 601267 601283 601291 601297 601309 601313 601319 601333 601339 
-601357 601379 601397 601411 601423 601439 601451 601457 601487 601507 601541 601543 
-601589 601591 601607 601631 601651 601669 601687 601697 601717 601747 601751 601759 
-601763 601771 601801 601807 601813 601819 601823 601831 601849 601873 601883 601889 
-601897 601903 601943 601949 601961 601969 601981 602029 602033 602039 602047 602057 
-602081 602083 602087 602093 602099 602111 602137 602141 602143 602153 602179 602197 
-602201 602221 602227 602233 602257 602267 602269 602279 602297 602309 602311 602317 
-602321 602333 602341 602351 602377 602383 602401 602411 602431 602453 602461 602477 
-602479 602489 602501 602513 602521 602543 602551 602593 602597 602603 602621 602627 
-602639 602647 602677 602687 602689 602711 602713 602717 602729 602743 602753 602759 
-602773 602779 602801 602821 602831 602839 602867 602873 602887 602891 602909 602929 
-602947 602951 602971 602977 602983 602999 603011 603013 603023 603047 603077 603091 
-603101 603103 603131 603133 603149 603173 603191 603203 603209 603217 603227 603257 
-603283 603311 603319 603349 603389 603391 603401 603431 603443 603457 603467 603487 
-603503 603521 603523 603529 603541 603553 603557 603563 603569 603607 603613 603623 
-603641 603667 603679 603689 603719 603731 603739 603749 603761 603769 603781 603791 
-603793 603817 603821 603833 603847 603851 603853 603859 603881 603893 603899 603901 
-603907 603913 603917 603919 603923 603931 603937 603947 603949 603989 604001 604007 
-604013 604031 604057 604063 604069 604073 604171 604189 604223 604237 604243 604249 
-604259 604277 604291 604309 604313 604319 604339 604343 604349 604361 604369 604379 
-604397 604411 604427 604433 604441 604477 604481 604517 604529 604547 604559 604579 
-604589 604603 604609 604613 604619 604649 604651 604661 604697 604699 604711 604727 
-604729 604733 604753 604759 604781 604787 604801 604811 604819 604823 604829 604837 
-604859 604861 604867 604883 604907 604931 604939 604949 604957 604973 604997 605009 
-605021 605023 605039 605051 605069 605071 605113 605117 605123 605147 605167 605173 
-605177 605191 605221 605233 605237 605239 605249 605257 605261 605309 605323 605329 
-605333 605347 605369 605393 605401 605411 605413 605443 605471 605477 605497 605503 
-605509 605531 605533 605543 605551 605573 605593 605597 605599 605603 605609 605617 
-605629 605639 605641 605687 605707 605719 605779 605789 605809 605837 605849 605861 
-605867 605873 605879 605887 605893 605909 605921 605933 605947 605953 605977 605987 
-605993 606017 606029 606031 606037 606041 606049 606059 606077 606079 606083 606091 
-606113 606121 606131 606173 606181 606223 606241 606247 606251 606299 606301 606311 
-606313 606323 606341 606379 606383 606413 606433 606443 606449 606493 606497 606503 
-606521 606527 606539 606559 606569 606581 606587 606589 606607 606643 606649 606653 
-606659 606673 606721 606731 606733 606737 606743 606757 606791 606811 606829 606833 
-606839 606847 606857 606863 606899 606913 606919 606943 606959 606961 606967 606971 
-606997 607001 607003 607007 607037 607043 607049 607063 607067 607081 607091 607093 
-607097 607109 607127 607129 607147 607151 607153 607157 607163 607181 607199 607213 
-607219 607249 607253 607261 607301 607303 607307 607309 607319 607331 607337 607339 
-607349 607357 607363 607417 607421 607423 607471 607493 607517 607531 607549 607573 
-607583 607619 607627 607667 607669 607681 607697 607703 607721 607723 607727 607741 
-607769 607813 607819 607823 607837 607843 607861 607883 607889 607909 607921 607931 
-607933 607939 607951 607961 607967 607991 607993 608011 608029 608033 608087 608089 
-608099 608117 608123 608129 608131 608147 608161 608177 608191 608207 608213 608269 
-608273 608297 608299 608303 608339 608347 608357 608359 608369 608371 608383 608389 
-608393 608401 608411 608423 608429 608431 608459 608471 608483 608497 608519 608521 
-608527 608581 608591 608593 608609 608611 608633 608653 608659 608669 608677 608693 
-608701 608737 608743 608749 608759 608767 608789 608819 608831 608843 608851 608857 
-608863 608873 608887 608897 608899 608903 608941 608947 608953 608977 608987 608989 
-608999 609043 609047 609067 609071 609079 609101 609107 609113 609143 609149 609163 
-609173 609179 609199 609209 609221 609227 609233 609241 609253 609269 609277 609283 
-609289 609307 609313 609337 609359 609361 609373 609379 609391 609397 609403 609407 
-609421 609437 609443 609461 609487 609503 609509 609517 609527 609533 609541 609571 
-609589 609593 609599 609601 609607 609613 609617 609619 609641 609673 609683 609701 
-609709 609743 609751 609757 609779 609781 609803 609809 609821 609859 609877 609887 
-609907 609911 609913 609923 609929 609979 609989 609991 609997 610031 610063 610081 
-610123 610157 610163 610187 610193 610199 610217 610219 610229 610243 610271 610279 
-610289 610301 610327 610331 610339 610391 610409 610417 610429 610439 610447 610457 
-610469 610501 610523 610541 610543 610553 610559 610567 610579 610583 610619 610633 
-610639 610651 610661 610667 610681 610699 610703 610721 610733 610739 610741 610763 
-610781 610783 610787 610801 610817 610823 610829 610837 610843 610847 610849 610867 
-610877 610879 610891 610913 610919 610921 610933 610957 610969 610993 611011 611027 
-611033 611057 611069 611071 611081 611101 611111 611113 611131 611137 611147 611189 
-611207 611213 611257 611263 611279 611293 611297 611323 611333 611389 611393 611411 
-611419 611441 611449 611453 611459 611467 611483 611497 611531 611543 611549 611551 
-611557 611561 611587 611603 611621 611641 611657 611671 611693 611707 611729 611753 
-611791 611801 611803 611827 611833 611837 611839 611873 611879 611887 611903 611921 
-611927 611939 611951 611953 611957 611969 611977 611993 611999 612011 612023 612037 
-612041 612043 612049 612061 612067 612071 612083 612107 612109 612113 612133 612137 
-612149 612169 612173 612181 612193 612217 612223 612229 612259 612263 612301 612307 
-612317 612319 612331 612341 612349 612371 612373 612377 612383 612401 612407 612439 
-612481 612497 612511 612553 612583 612589 612611 612613 612637 612643 612649 612671 
-612679 612713 612719 612727 612737 612751 612763 612791 612797 612809 612811 612817 
-612823 612841 612847 612853 612869 612877 612889 612923 612929 612947 612967 612971 
-612977 613007 613009 613013 613049 613061 613097 613099 613141 613153 613163 613169 
-613177 613181 613189 613199 613213 613219 613229 613231 613243 613247 613253 613267 
-613279 613289 613297 613337 613357 613363 613367 613381 613421 613427 613439 613441 
-613447 613451 613463 613469 613471 613493 613499 613507 613523 613549 613559 613573 
-613577 613597 613607 613609 613633 613637 613651 613661 613667 613673 613699 613733 
-613741 613747 613759 613763 613807 613813 613817 613829 613841 613849 613861 613883 
-613889 613903 613957 613967 613969 613981 613993 613999 614041 614051 614063 614071 
-614093 614101 614113 614129 614143 614147 614153 614167 614177 614179 614183 614219 
-614267 614279 614291 614293 614297 614321 614333 614377 614387 614413 614417 614437 
-614477 614483 614503 614527 614531 614543 614561 614563 614569 614609 614611 614617 
-614623 614633 614639 614657 614659 614671 614683 614687 614693 614701 614717 614729 
-614741 614743 614749 614753 614759 614773 614827 614843 614849 614851 614863 614881 
-614893 614909 614917 614927 614963 614981 614983 615019 615031 615047 615053 615067 
-615101 615103 615107 615137 615151 615161 615187 615229 615233 615253 615259 615269 
-615289 615299 615313 615337 615341 615343 615367 615379 615389 615401 615403 615413 
-615427 615431 615437 615449 615473 615479 615491 615493 615497 615509 615521 615539 
-615557 615577 615599 615607 615617 615623 615661 615677 615679 615709 615721 615731 
-615739 615743 615749 615751 615761 615767 615773 615793 615799 615821 615827 615829 
-615833 615869 615883 615887 615907 615919 615941 615949 615971 615997 616003 616027 
-616051 616069 616073 616079 616103 616111 616117 616129 616139 616141 616153 616157 
-616169 616171 616181 616207 616211 616219 616223 616229 616243 616261 616277 616289 
-616307 616313 616321 616327 616361 616367 616387 616391 616393 616409 616411 616433 
-616439 616459 616463 616481 616489 616501 616507 616513 616519 616523 616529 616537 
-616547 616579 616589 616597 616639 616643 616669 616673 616703 616717 616723 616729 
-616741 616757 616769 616783 616787 616789 616793 616799 616829 616841 616843 616849 
-616871 616877 616897 616909 616933 616943 616951 616961 616991 616997 616999 617011 
-617027 617039 617051 617053 617059 617077 617087 617107 617119 617129 617131 617147 
-617153 617161 617189 617191 617231 617233 617237 617249 617257 617269 617273 617293 
-617311 617327 617333 617339 617341 617359 617363 617369 617387 617401 617411 617429 
-617447 617453 617467 617471 617473 617479 617509 617521 617531 617537 617579 617587 
-617647 617651 617657 617677 617681 617689 617693 617699 617707 617717 617719 617723 
-617731 617759 617761 617767 617777 617791 617801 617809 617819 617843 617857 617873 
-617879 617887 617917 617951 617959 617963 617971 617983 618029 618031 618041 618049 
-618053 618083 618119 618131 618161 618173 618199 618227 618229 618253 618257 618269 
-618271 618287 618301 618311 618323 618329 618337 618347 618349 618361 618377 618407 
-618413 618421 618437 618439 618463 618509 618521 618547 618559 618571 618577 618581 
-618587 618589 618593 618619 618637 618643 618671 618679 618703 618707 618719 618799 
-618823 618833 618841 618847 618857 618859 618869 618883 618913 618929 618941 618971 
-618979 618991 618997 619007 619009 619019 619027 619033 619057 619061 619067 619079 
-619111 619117 619139 619159 619169 619181 619187 619189 619207 619247 619253 619261 
-619273 619277 619279 619303 619309 619313 619331 619363 619373 619391 619397 619471 
-619477 619511 619537 619543 619561 619573 619583 619589 619603 619607 619613 619621 
-619657 619669 619681 619687 619693 619711 619739 619741 619753 619763 619771 619793 
-619807 619811 619813 619819 619831 619841 619849 619867 619897 619909 619921 619967 
-619979 619981 619987 619999 620003 620029 620033 620051 620099 620111 620117 620159 
-620161 620171 620183 620197 620201 620227 620233 620237 620239 620251 620261 620297 
-620303 620311 620317 620329 620351 620359 620363 620377 620383 620393 620401 620413 
-620429 620437 620441 620461 620467 620491 620507 620519 620531 620549 620561 620567 
-620569 620579 620603 620623 620639 620647 620657 620663 620671 620689 620693 620717 
-620731 620743 620759 620771 620773 620777 620813 620821 620827 620831 620849 620869 
-620887 620909 620911 620929 620933 620947 620957 620981 620999 621007 621013 621017 
-621029 621031 621043 621059 621083 621097 621113 621133 621139 621143 621217 621223 
-621227 621239 621241 621259 621289 621301 621317 621337 621343 621347 621353 621359 
-621371 621389 621419 621427 621431 621443 621451 621461 621473 621521 621527 621541 
-621583 621611 621617 621619 621629 621631 621641 621671 621679 621697 621701 621703 
-621721 621739 621749 621757 621769 621779 621799 621821 621833 621869 621871 621883 
-621893 621913 621923 621937 621941 621983 621997 622009 622019 622043 622049 622051 
-622067 622073 622091 622103 622109 622123 622129 622133 622151 622157 622159 622177 
-622187 622189 622241 622243 622247 622249 622277 622301 622313 622331 622333 622337 
-622351 622367 622397 622399 622423 622477 622481 622483 622493 622513 622519 622529 
-622547 622549 622561 622571 622577 622603 622607 622613 622619 622621 622637 622639 
-622663 622669 622709 622723 622729 622751 622777 622781 622793 622813 622849 622861 
-622879 622889 622901 622927 622943 622957 622967 622987 622997 623003 623009 623017 
-623023 623041 623057 623059 623071 623107 623171 623209 623221 623261 623263 623269 
-623279 623281 623291 623299 623303 623321 623327 623341 623351 623353 623383 623387 
-623393 623401 623417 623423 623431 623437 623477 623521 623531 623537 623563 623591 
-623617 623621 623633 623641 623653 623669 623671 623677 623681 623683 623699 623717 
-623719 623723 623729 623743 623759 623767 623771 623803 623839 623851 623867 623869 
-623879 623881 623893 623923 623929 623933 623947 623957 623963 623977 623983 623989 
-624007 624031 624037 624047 624049 624067 624089 624097 624119 624133 624139 624149 
-624163 624191 624199 624203 624209 624229 624233 624241 624251 624259 624271 624277 
-624311 624313 624319 624329 624331 624347 624391 624401 624419 624443 624451 624467 
-624469 624479 624487 624497 624509 624517 624521 624539 624541 624577 624593 624599 
-624601 624607 624643 624649 624667 624683 624707 624709 624721 624727 624731 624737 
-624763 624769 624787 624791 624797 624803 624809 624829 624839 624847 624851 624859 
-624917 624961 624973 624977 624983 624997 625007 625033 625057 625063 625087 625103 
-625109 625111 625129 625133 625169 625171 625181 625187 625199 625213 625231 625237 
-625253 625267 625279 625283 625307 625319 625343 625351 625367 625369 625397 625409 
-625451 625477 625483 625489 625507 625517 625529 625543 625589 625591 625609 625621 
-625627 625631 625637 625643 625657 625661 625663 625697 625699 625763 625777 625789 
-625811 625819 625831 625837 625861 625871 625883 625909 625913 625927 625939 625943 
-625969 625979 625997 626009 626011 626033 626051 626063 626113 626117 626147 626159 
-626173 626177 626189 626191 626201 626207 626239 626251 626261 626317 626323 626333 
-626341 626347 626363 626377 626389 626393 626443 626477 626489 626519 626533 626539 
-626581 626597 626599 626609 626611 626617 626621 626623 626627 626629 626663 626683 
-626687 626693 626701 626711 626713 626723 626741 626749 626761 626771 626783 626797 
-626809 626833 626837 626861 626887 626917 626921 626929 626947 626953 626959 626963 
-626987 627017 627041 627059 627071 627073 627083 627089 627091 627101 627119 627131 
-627139 627163 627169 627191 627197 627217 627227 627251 627257 627269 627271 627293 
-627301 627329 627349 627353 627377 627379 627383 627391 627433 627449 627479 627481 
-627491 627511 627541 627547 627559 627593 627611 627617 627619 627637 627643 627659 
-627661 627667 627673 627709 627721 627733 627749 627773 627787 627791 627797 627799 
-627811 627841 627859 627901 627911 627919 627943 627947 627953 627961 627973 628013 
-628021 628037 628049 628051 628057 628063 628093 628097 628127 628139 628171 628183 
-628189 628193 628207 628213 628217 628219 628231 628261 628267 628289 628301 628319 
-628357 628363 628373 628379 628391 628399 628423 628427 628447 628477 628487 628493 
-628499 628547 628561 628583 628591 628651 628673 628679 628681 628687 628699 628709 
-628721 628753 628757 628759 628781 628783 628787 628799 628801 628811 628819 628841 
-628861 628877 628909 628913 628921 628937 628939 628973 628993 628997 629003 629009 
-629011 629023 629029 629059 629081 629113 629137 629143 629171 629177 629203 629243 
-629249 629263 629281 629311 629339 629341 629351 629371 629381 629383 629401 629411 
-629417 629429 629449 629467 629483 629491 629509 629513 629537 629567 629569 629591 
-629593 629609 629611 629617 629623 629653 629683 629687 629689 629701 629711 629723 
-629737 629743 629747 629767 629773 629779 629803 629807 629819 629843 629857 629861 
-629873 629891 629897 629899 629903 629921 629927 629929 629939 629963 629977 629987 
-629989 630017 630023 630029 630043 630067 630101 630107 630127 630151 630163 630167 
-630169 630181 630193 630197 630229 630247 630263 630281 630299 630307 630319 630349 
-630353 630391 630433 630451 630467 630473 630481 630493 630521 630523 630529 630559 
-630577 630583 630587 630589 630593 630607 630613 630659 630677 630689 630701 630709 
-630713 630719 630733 630737 630797 630803 630823 630827 630841 630863 630871 630893 
-630899 630901 630907 630911 630919 630941 630967 630997 631003 631013 631039 631061 
-631121 631133 631139 631151 631153 631157 631171 631181 631187 631223 631229 631247 
-631249 631259 631271 631273 631291 631307 631339 631357 631361 631387 631391 631399 
-631409 631429 631453 631457 631459 631469 631471 631483 631487 631507 631513 631529 
-631531 631537 631549 631559 631573 631577 631583 631597 631613 631619 631643 631667 
-631679 631681 631711 631717 631723 631733 631739 631751 631753 631789 631817 631819 
-631843 631847 631853 631859 631861 631867 631889 631901 631903 631913 631927 631931 
-631937 631979 631987 631991 631993 632029 632041 632053 632081 632083 632087 632089 
-632101 632117 632123 632141 632147 632153 632189 632209 632221 632227 632231 632251 
-632257 632267 632273 632297 632299 632321 632323 632327 632329 632347 632351 632353 
-632363 632371 632381 632389 632393 632447 632459 632473 632483 632497 632501 632503 
-632521 632557 632561 632591 632609 632623 632627 632629 632647 632669 632677 632683 
-632699 632713 632717 632743 632747 632773 632777 632813 632839 632843 632851 632857 
-632881 632897 632911 632923 632939 632941 632971 632977 632987 632993 633001 633013 
-633037 633053 633067 633079 633091 633133 633151 633161 633187 633197 633209 633221 
-633253 633257 633263 633271 633287 633307 633317 633337 633359 633377 633379 633383 
-633401 633407 633427 633449 633461 633463 633467 633469 633473 633487 633497 633559 
-633569 633571 633583 633599 633613 633623 633629 633649 633653 633667 633739 633751 
-633757 633767 633781 633791 633793 633797 633799 633803 633823 633833 633877 633883 
-633923 633931 633937 633943 633953 633961 633967 633991 634003 634013 634031 634061 
-634079 634091 634097 634103 634141 634157 634159 634169 634177 634181 634187 634199 
-634211 634223 634237 634241 634247 634261 634267 634273 634279 634301 634307 634313 
-634327 634331 634343 634367 634373 634397 634421 634441 634471 634483 634493 634499 
-634511 634519 634523 634531 634541 634567 634573 634577 634597 634603 634609 634643 
-634649 634651 634679 634681 634687 634703 634709 634717 634727 634741 634747 634757 
-634759 634793 634807 634817 634841 634853 634859 634861 634871 634891 634901 634903 
-634927 634937 634939 634943 634969 634979 635003 635021 635039 635051 635057 635087 
-635119 635147 635149 635197 635203 635207 635249 635251 635263 635267 635279 635287 
-635291 635293 635309 635317 635333 635339 635347 635351 635353 635359 635363 635387 
-635389 635413 635423 635431 635441 635449 635461 635471 635483 635507 635519 635527 
-635533 635563 635567 635599 635603 635617 635639 635653 635659 635689 635707 635711 
-635729 635731 635737 635777 635801 635809 635813 635821 635837 635849 635867 635879 
-635891 635893 635909 635917 635923 635939 635959 635969 635977 635981 635983 635989 
-636017 636023 636043 636059 636061 636071 636073 636107 636109 636133 636137 636149 
-636193 636211 636217 636241 636247 636257 636263 636277 636283 636287 636301 636313 
-636319 636331 636343 636353 636359 636403 636407 636409 636421 636469 636473 636499 
-636533 636539 636541 636547 636553 636563 636569 636613 636619 636631 636653 636673 
-636697 636719 636721 636731 636739 636749 636761 636763 636773 636781 636809 636817 
-636821 636829 636851 636863 636877 636917 636919 636931 636947 636953 636967 636983 
-636997 637001 637003 637067 637073 637079 637097 637129 637139 637157 637163 637171 
-637199 637201 637229 637243 637271 637277 637283 637291 637297 637309 637319 637321 
-637327 637337 637339 637349 637369 637379 637409 637421 637423 637447 637459 637463 
-637471 637489 637499 637513 637519 637529 637531 637543 637573 637597 637601 637603 
-637607 637627 637657 637669 637691 637699 637709 637711 637717 637723 637727 637729 
-637751 637771 637781 637783 637787 637817 637829 637831 637841 637873 637883 637909 
-637933 637937 637939 638023 638047 638051 638059 638063 638081 638117 638123 638147 
-638159 638161 638171 638177 638179 638201 638233 638263 638269 638303 638317 638327 
-638347 638359 638371 638423 638431 638437 638453 638459 638467 638489 638501 638527 
-638567 638581 638587 638621 638629 638633 638663 638669 638689 638699 638717 638719 
-638767 638801 638819 638839 638857 638861 638893 638923 638933 638959 638971 638977 
-638993 638999 639007 639011 639043 639049 639053 639083 639091 639137 639143 639151 
-639157 639167 639169 639181 639211 639253 639257 639259 639263 639269 639299 639307 
-639311 639329 639337 639361 639371 639391 639433 639439 639451 639487 639491 639493 
-639511 639517 639533 639547 639563 639571 639577 639589 639599 639601 639631 639637 
-639647 639671 639677 639679 639689 639697 639701 639703 639713 639719 639731 639739 
-639757 639833 639839 639851 639853 639857 639907 639911 639937 639941 639949 639959 
-639983 639997 640007 640009 640019 640027 640039 640043 640049 640061 640069 640099 
-640109 640121 640127 640139 640151 640153 640163 640193 640219 640223 640229 640231 
-640247 640249 640259 640261 640267 640279 640303 640307 640333 640363 640369 640411 
-640421 640457 640463 640477 640483 640499 640529 640531 640579 640583 640589 640613 
-640621 640631 640649 640663 640667 640669 640687 640691 640727 640733 640741 640771 
-640777 640793 640837 640847 640853 640859 640873 640891 640901 640907 640919 640933 
-640943 640949 640957 640963 640967 640973 640993 641051 641057 641077 641083 641089 
-641093 641101 641129 641131 641143 641167 641197 641203 641213 641227 641239 641261 
-641279 641287 641299 641317 641327 641371 641387 641411 641413 641419 641437 641441 
-641453 641467 641471 641479 641491 641513 641519 641521 641549 641551 641579 641581 
-641623 641633 641639 641681 641701 641713 641747 641749 641761 641789 641791 641803 
-641813 641819 641821 641827 641833 641843 641863 641867 641873 641881 641891 641897 
-641909 641923 641929 641959 641969 641981 642011 642013 642049 642071 642077 642079 
-642113 642121 642133 642149 642151 642157 642163 642197 642199 642211 642217 642223 
-642233 642241 642247 642253 642281 642359 642361 642373 642403 642407 642419 642427 
-642457 642487 642517 642527 642529 642533 642547 642557 642563 642581 642613 642623 
-642673 642683 642701 642737 642739 642769 642779 642791 642797 642799 642809 642833 
-642853 642869 642871 642877 642881 642899 642907 642931 642937 642947 642953 642973 
-642977 642997 643009 643021 643031 643039 643043 643051 643061 643073 643081 643087 
-643099 643121 643129 643183 643187 643199 643213 643217 643231 643243 643273 643301 
-643303 643369 643373 643403 643421 643429 643439 643453 643457 643463 643469 643493 
-643507 643523 643547 643553 643567 643583 643589 643619 643633 643639 643649 643651 
-643661 643681 643691 643693 643697 643703 643723 643729 643751 643781 643847 643849 
-643859 643873 643879 643883 643889 643919 643927 643949 643957 643961 643969 643991 
-644009 644029 644047 644051 644053 644057 644089 644101 644107 644117 644123 644129 
-644131 644141 644143 644153 644159 644173 644191 644197 644201 644227 644239 644257 
-644261 644291 644297 644327 644341 644353 644359 644363 644377 644381 644383 644401 
-644411 644431 644443 644447 644489 644491 644507 644513 644519 644531 644549 644557 
-644563 644569 644593 644597 644599 644617 644629 644647 644653 644669 644671 644687 
-644701 644717 644729 644731 644747 644753 644767 644783 644789 644797 644801 644837 
-644843 644857 644863 644867 644869 644881 644899 644909 644911 644923 644933 644951 
-644977 644999 645011 645013 645019 645023 645037 645041 645049 645067 645077 645083 
-645091 645097 645131 645137 645149 645179 645187 645233 645257 645313 645329 645347 
-645353 645367 645383 645397 645409 645419 645431 645433 645443 645467 645481 645493 
-645497 645499 645503 645521 645527 645529 645571 645577 645581 645583 645599 645611 
-645629 645641 645647 645649 645661 645683 645691 645703 645713 645727 645737 645739 
-645751 645763 645787 645803 645833 645839 645851 645857 645877 645889 645893 645901 
-645907 645937 645941 645973 645979 646003 646013 646027 646039 646067 646073 646099 
-646103 646147 646157 646159 646169 646181 646183 646189 646193 646199 646237 646253 
-646259 646267 646271 646273 646291 646301 646307 646309 646339 646379 646397 646403 
-646411 646421 646423 646433 646453 646519 646523 646537 646543 646549 646571 646573 
-646577 646609 646619 646631 646637 646643 646669 646687 646721 646757 646771 646781 
-646823 646831 646837 646843 646859 646873 646879 646883 646889 646897 646909 646913 
-646927 646937 646957 646979 646981 646991 646993 647011 647033 647039 647047 647057 
-647069 647081 647099 647111 647113 647117 647131 647147 647161 647189 647201 647209 
-647219 647261 647263 647293 647303 647321 647327 647333 647341 647357 647359 647363 
-647371 647399 647401 647417 647429 647441 647453 647477 647489 647503 647509 647527 
-647531 647551 647557 647579 647587 647593 647609 647617 647627 647641 647651 647659 
-647663 647687 647693 647719 647723 647741 647743 647747 647753 647771 647783 647789 
-647809 647821 647837 647839 647851 647861 647891 647893 647909 647917 647951 647953 
-647963 647987 648007 648019 648029 648041 648047 648059 648061 648073 648079 648097 
-648101 648107 648119 648133 648173 648181 648191 648199 648211 648217 648229 648239 
-648257 648259 648269 648283 648289 648293 648317 648331 648341 648343 648371 648377 
-648379 648383 648391 648433 648437 648449 648481 648509 648563 648607 648617 648619 
-648629 648631 648649 648653 648671 648677 648689 648709 648719 648731 648763 648779 
-648803 648841 648859 648863 648871 648887 648889 648911 648917 648931 648937 648953 
-648961 648971 648997 649001 649007 649039 649063 649069 649073 649079 649081 649087 
-649093 649123 649141 649147 649151 649157 649183 649217 649261 649273 649277 649279 
-649283 649291 649307 649321 649361 649379 649381 649403 649421 649423 649427 649457 
-649469 649471 649483 649487 649499 649501 649507 649511 649529 649541 649559 649567 
-649573 649577 649613 649619 649631 649633 649639 649643 649651 649657 649661 649697 
-649709 649717 649739 649751 649769 649771 649777 649783 649787 649793 649799 649801 
-649813 649829 649843 649849 649867 649871 649877 649879 649897 649907 649921 649937 
-649969 649981 649991 650011 650017 650059 650071 650081 650099 650107 650179 650183 
-650189 650213 650227 650261 650269 650281 650291 650317 650327 650329 650347 650359 
-650387 650401 650413 650449 650477 650479 650483 650519 650537 650543 650549 650563 
-650567 650581 650591 650599 650609 650623 650627 650669 650701 650759 650761 650779 
-650813 650821 650827 650833 650851 650861 650863 650869 650873 650911 650917 650927 
-650933 650953 650971 650987 651017 651019 651029 651043 651067 651071 651097 651103 
-651109 651127 651139 651143 651169 651179 651181 651191 651193 651221 651223 651239 
-651247 651251 651257 651271 651281 651289 651293 651323 651331 651347 651361 651397 
-651401 651437 651439 651461 651473 651481 651487 651503 651509 651517 651587 651617 
-651641 651647 651649 651667 651683 651689 651697 651727 651731 651733 651767 651769 
-651793 651803 651809 651811 651821 651839 651841 651853 651857 651863 651869 651877 
-651881 651901 651913 651943 651971 651997 652019 652033 652039 652063 652079 652081 
-652087 652117 652121 652153 652189 652207 652217 652229 652237 652241 652243 652261 
-652279 652283 652291 652319 652321 652331 652339 652343 652357 652361 652369 652373 
-652381 652411 652417 652429 652447 652451 652453 652493 652499 652507 652541 652543 
-652549 652559 652567 652573 652577 652591 652601 652607 652609 652621 652627 652651 
-652657 652667 652699 652723 652727 652733 652739 652741 652747 652753 652759 652787 
-652811 652831 652837 652849 652853 652871 652903 652909 652913 652921 652931 652933 
-652937 652943 652957 652969 652991 652997 652999 653033 653057 653083 653111 653113 
-653117 653143 653153 653197 653203 653207 653209 653243 653267 653273 653281 653311 
-653321 653339 653357 653363 653431 653461 653473 653491 653501 653503 653507 653519 
-653537 653539 653561 653563 653579 653593 653617 653621 653623 653641 653647 653651 
-653659 653687 653693 653707 653711 653713 653743 653749 653761 653777 653789 653797 
-653801 653819 653831 653879 653881 653893 653899 653903 653927 653929 653941 653951 
-653963 653969 653977 653993 654001 654011 654019 654023 654029 654047 654053 654067 
-654089 654107 654127 654149 654161 654163 654167 654169 654187 654191 654209 654221 
-654223 654229 654233 654257 654293 654301 654307 654323 654343 654349 654371 654397 
-654413 654421 654427 654439 654491 654499 654509 654527 654529 654539 654541 654553 
-654571 654587 654593 654601 654611 654613 654623 654629 654671 654679 654697 654701 
-654727 654739 654743 654749 654767 654779 654781 654799 654803 654817 654821 654827 
-654839 654853 654877 654889 654917 654923 654931 654943 654967 654991 655001 655003 
-655013 655021 655033 655037 655043 655069 655087 655103 655111 655121 655157 655181 
-655211 655219 655223 655229 655241 655243 655261 655267 655273 655283 655289 655301 
-655331 655337 655351 655357 655373 655379 655387 655399 655439 655453 655471 655489 
-655507 655511 655517 655531 655541 655547 655559 655561 655579 655583 655597 655601 
-655637 655643 655649 655651 655657 655687 655693 655717 655723 655727 655757 655807 
-655847 655849 655859 655883 655901 655909 655913 655927 655943 655961 655987 656023 
-656039 656063 656077 656113 656119 656129 656141 656147 656153 656171 656221 656237 
-656263 656267 656273 656291 656297 656303 656311 656321 656323 656329 656333 656347 
-656371 656377 656389 656407 656423 656429 656459 656471 656479 656483 656519 656527 
-656561 656587 656597 656599 656603 656609 656651 656657 656671 656681 656683 656687 
-656701 656707 656737 656741 656749 656753 656771 656783 656791 656809 656819 656833 
-656839 656891 656917 656923 656939 656951 656959 656977 656989 656993 657017 657029 
-657047 657049 657061 657071 657079 657089 657091 657113 657121 657127 657131 657187 
-657193 657197 657233 657257 657269 657281 657289 657299 657311 657313 657323 657347 
-657361 657383 657403 657413 657431 657439 657451 657469 657473 657491 657493 657497 
-657499 657523 657529 657539 657557 657581 657583 657589 657607 657617 657649 657653 
-657659 657661 657703 657707 657719 657743 657779 657793 657809 657827 657841 657863 
-657893 657911 657929 657931 657947 657959 657973 657983 658001 658043 658051 658057 
-658069 658079 658111 658117 658123 658127 658139 658153 658159 658169 658187 658199 
-658211 658219 658247 658253 658261 658277 658279 658303 658309 658319 658321 658327 
-658349 658351 658367 658379 658391 658403 658417 658433 658447 658453 658477 658487 
-658507 658547 658549 658573 658579 658589 658591 658601 658607 658613 658633 658639 
-658643 658649 658663 658681 658703 658751 658753 658783 658807 658817 658831 658837 
-658841 658871 658873 658883 658897 658907 658913 658919 658943 658961 658963 658969 
-658979 658991 658997 659011 659023 659047 659059 659063 659069 659077 659101 659137 
-659159 659171 659173 659177 659189 659221 659231 659237 659251 659279 659299 659317 
-659327 659333 659353 659371 659419 659423 659437 659453 659467 659473 659497 659501 
-659513 659521 659531 659539 659563 659569 659591 659597 659609 659611 659621 659629 
-659639 659653 659657 659669 659671 659689 659693 659713 659723 659741 659759 659761 
-659783 659819 659831 659843 659849 659863 659873 659881 659899 659917 659941 659947 
-659951 659963 659983 659999 660001 660013 660029 660047 660053 660061 660067 660071 
-660073 660097 660103 660119 660131 660137 660157 660167 660181 660197 660199 660217 
-660227 660241 660251 660271 660277 660281 660299 660329 660337 660347 660349 660367 
-660377 660379 660391 660403 660409 660449 660493 660503 660509 660521 660529 660547 
-660557 660559 660563 660589 660593 660599 660601 660607 660617 660619 660643 660659 
-660661 660683 660719 660727 660731 660733 660757 660769 660787 660791 660799 660809 
-660811 660817 660833 660851 660853 660887 660893 660899 660901 660917 660923 660941 
-660949 660973 660983 661009 661019 661027 661049 661061 661091 661093 661097 661099 
-661103 661109 661117 661121 661139 661183 661187 661189 661201 661217 661231 661237 
-661253 661259 661267 661321 661327 661343 661361 661373 661393 661417 661421 661439 
-661459 661477 661481 661483 661513 661517 661541 661547 661553 661603 661607 661613 
-661621 661663 661673 661679 661697 661721 661741 661769 661777 661823 661849 661873 
-661877 661879 661883 661889 661897 661909 661931 661939 661949 661951 661961 661987 
-661993 662003 662021 662029 662047 662059 662063 662083 662107 662111 662141 662143 
-662149 662177 662203 662227 662231 662251 662261 662267 662281 662287 662309 662323 
-662327 662339 662351 662353 662357 662369 662401 662407 662443 662449 662477 662483 
-662491 662513 662527 662531 662537 662539 662551 662567 662591 662617 662639 662647 
-662657 662671 662681 662689 662693 662713 662719 662743 662771 662773 662789 662797 
-662819 662833 662839 662843 662867 662897 662899 662917 662939 662941 662947 662951 
-662953 662957 662999 663001 663007 663031 663037 663049 663053 663071 663097 663127 
-663149 663161 663163 663167 663191 663203 663209 663239 663241 663263 663269 663281 
-663283 663301 663319 663331 663349 663359 663371 663407 663409 663437 663463 663517 
-663529 663539 663541 663547 663557 663563 663569 663571 663581 663583 663587 663589 
-663599 663601 663631 663653 663659 663661 663683 663709 663713 663737 663763 663787 
-663797 663821 663823 663827 663853 663857 663869 663881 663893 663907 663937 663959 
-663961 663967 663973 663977 663979 663983 663991 663997 664009 664019 664043 664061 
-664067 664091 664099 664109 664117 664121 664123 664133 664141 664151 664177 664193 
-664199 664211 664243 664253 664271 664273 664289 664319 664331 664357 664369 664379 
-664381 664403 664421 664427 664441 664459 664471 664507 664511 664529 664537 664549 
-664561 664571 664579 664583 664589 664597 664603 664613 664619 664621 664633 664661 
-664663 664667 664669 664679 664687 664691 664693 664711 664739 664757 664771 664777 
-664789 664793 664799 664843 664847 664849 664879 664891 664933 664949 664967 664973 
-664997 665011 665017 665029 665039 665047 665051 665053 665069 665089 665111 665113 
-665117 665123 665131 665141 665153 665177 665179 665201 665207 665213 665221 665233 
-665239 665251 665267 665279 665293 665299 665303 665311 665351 665359 665369 665381 
-665387 665419 665429 665447 665479 665501 665503 665507 665527 665549 665557 665563 
-665569 665573 665591 665603 665617 665629 665633 665659 665677 665713 665719 665723 
-665747 665761 665773 665783 665789 665801 665803 665813 665843 665857 665897 665921 
-665923 665947 665953 665981 665983 665993 666013 666019 666023 666031 666041 666067 
-666073 666079 666089 666091 666109 666119 666139 666143 666167 666173 666187 666191 
-666203 666229 666233 666269 666277 666301 666329 666353 666403 666427 666431 666433 
-666437 666439 666461 666467 666493 666511 666527 666529 666541 666557 666559 666599 
-666607 666637 666643 666647 666649 666667 666671 666683 666697 666707 666727 666733 
-666737 666749 666751 666769 666773 666811 666821 666823 666829 666857 666871 666889 
-666901 666929 666937 666959 666979 666983 666989 667013 667019 667021 667081 667091 
-667103 667123 667127 667129 667141 667171 667181 667211 667229 667241 667243 667273 
-667283 667309 667321 667333 667351 667361 667363 667367 667379 667417 667421 667423 
-667427 667441 667463 667477 667487 667501 667507 667519 667531 667547 667549 667553 
-667559 667561 667577 667631 667643 667649 667657 667673 667687 667691 667697 667699 
-667727 667741 667753 667769 667781 667801 667817 667819 667829 667837 667859 667861 
-667867 667883 667903 667921 667949 667963 667987 667991 667999 668009 668029 668033 
-668047 668051 668069 668089 668093 668111 668141 668153 668159 668179 668201 668203 
-668209 668221 668243 668273 668303 668347 668407 668417 668471 668509 668513 668527 
-668531 668533 668539 668543 668567 668579 668581 668599 668609 668611 668617 668623 
-668671 668677 668687 668699 668713 668719 668737 668741 668747 668761 668791 668803 
-668813 668821 668851 668867 668869 668873 668879 668903 668929 668939 668947 668959 
-668963 668989 668999 669023 669029 669049 669077 669089 669091 669107 669113 669121 
-669127 669133 669167 669173 669181 669241 669247 669271 669283 669287 669289 669301 
-669311 669329 669359 669371 669377 669379 669391 669401 669413 669419 669433 669437 
-669451 669463 669479 669481 669527 669551 669577 669607 669611 669637 669649 669659 
-669661 669667 669673 669677 669679 669689 669701 669707 669733 669763 669787 669791 
-669839 669847 669853 669857 669859 669863 669869 669887 669901 669913 669923 669931 
-669937 669943 669947 669971 669989 670001 670031 670037 670039 670049 670051 670097 
-670099 670129 670139 670147 670177 670193 670199 670211 670217 670223 670231 670237 
-670249 670261 670279 670297 670303 670321 670333 670343 670349 670363 670379 670399 
-670409 670447 670457 670471 670487 670489 670493 670507 670511 670517 670541 670543 
-670559 670577 670583 670597 670613 670619 670627 670639 670669 670673 670693 670711 
-670727 670729 670739 670763 670777 670781 670811 670823 670849 670853 670867 670877 
-670897 670903 670919 670931 670951 670963 670987 670991 671003 671017 671029 671039 
-671059 671063 671081 671087 671093 671123 671131 671141 671159 671161 671189 671201 
-671219 671233 671249 671257 671261 671269 671287 671299 671303 671323 671339 671353 
-671357 671369 671383 671401 671417 671431 671443 671467 671471 671477 671501 671519 
-671533 671537 671557 671581 671591 671603 671609 671633 671647 671651 671681 671701 
-671717 671729 671743 671753 671777 671779 671791 671831 671837 671851 671887 671893 
-671903 671911 671917 671921 671933 671939 671941 671947 671969 671971 671981 671999 
-672019 672029 672041 672043 672059 672073 672079 672097 672103 672107 672127 672131 
-672137 672143 672151 672167 672169 672181 672193 672209 672223 672227 672229 672251 
-672271 672283 672289 672293 672311 672317 672323 672341 672349 672377 672379 672439 
-672443 672473 672493 672499 672521 672557 672577 672587 672593 672629 672641 672643 
-672653 672667 672703 672743 672757 672767 672779 672781 672787 672799 672803 672811 
-672817 672823 672827 672863 672869 672871 672883 672901 672913 672937 672943 672949 
-672953 672967 672977 672983 673019 673039 673063 673069 673073 673091 673093 673109 
-673111 673117 673121 673129 673157 673193 673199 673201 673207 673223 673241 673247 
-673271 673273 673291 673297 673313 673327 673339 673349 673381 673391 673397 673399 
-673403 673411 673427 673429 673441 673447 673451 673457 673459 673469 673487 673499 
-673513 673529 673549 673553 673567 673573 673579 673609 673613 673619 673637 673639 
-673643 673649 673667 673669 673747 673769 673781 673787 673793 673801 673811 673817 
-673837 673879 673891 673921 673943 673951 673961 673979 673991 674017 674057 674059 
-674071 674083 674099 674117 674123 674131 674159 674161 674173 674183 674189 674227 
-674231 674239 674249 674263 674269 674273 674299 674321 674347 674357 674363 674371 
-674393 674419 674431 674449 674461 674483 674501 674533 674537 674551 674563 674603 
-674647 674669 674677 674683 674693 674699 674701 674711 674717 674719 674731 674741 
-674749 674759 674761 674767 674771 674789 674813 674827 674831 674833 674837 674851 
-674857 674867 674879 674903 674929 674941 674953 674957 674977 674987 675029 675067 
-675071 675079 675083 675097 675109 675113 675131 675133 675151 675161 675163 675173 
-675179 675187 675197 675221 675239 675247 675251 675253 675263 675271 675299 675313 
-675319 675341 675347 675391 675407 675413 675419 675449 675457 675463 675481 675511 
-675539 675541 675551 675553 675559 675569 675581 675593 675601 675607 675611 675617 
-675629 675643 675713 675739 675743 675751 675781 675797 675817 675823 675827 675839 
-675841 675859 675863 675877 675881 675889 675923 675929 675931 675959 675973 675977 
-675979 676007 676009 676031 676037 676043 676051 676057 676061 676069 676099 676103 
-676111 676129 676147 676171 676211 676217 676219 676241 676253 676259 676279 676289 
-676297 676337 676339 676349 676363 676373 676387 676391 676409 676411 676421 676427 
-676463 676469 676493 676523 676573 676589 676597 676601 676649 676661 676679 676703 
-676717 676721 676727 676733 676747 676751 676763 676771 676807 676829 676859 676861 
-676883 676891 676903 676909 676919 676927 676931 676937 676943 676961 676967 676979 
-676981 676987 676993 677011 677021 677029 677041 677057 677077 677081 677107 677111 
-677113 677119 677147 677167 677177 677213 677227 677231 677233 677239 677309 677311 
-677321 677323 677333 677357 677371 677387 677423 677441 677447 677459 677461 677471 
-677473 677531 677533 677539 677543 677561 677563 677587 677627 677639 677647 677657 
-677681 677683 677687 677717 677737 677767 677779 677783 677791 677813 677827 677857 
-677891 677927 677947 677953 677959 677983 678023 678037 678047 678061 678077 678101 
-678103 678133 678157 678169 678179 678191 678199 678203 678211 678217 678221 678229 
-678253 678289 678299 678329 678341 678343 678367 678371 678383 678401 678407 678409 
-678413 678421 678437 678451 678463 678479 678481 678493 678499 678533 678541 678553 
-678563 678577 678581 678593 678599 678607 678611 678631 678637 678641 678647 678649 
-678653 678659 678719 678721 678731 678739 678749 678757 678761 678763 678767 678773 
-678779 678809 678823 678829 678833 678859 678871 678883 678901 678907 678941 678943 
-678949 678959 678971 678989 679033 679037 679039 679051 679067 679087 679111 679123 
-679127 679153 679157 679169 679171 679183 679207 679219 679223 679229 679249 679277 
-679279 679297 679309 679319 679333 679361 679363 679369 679373 679381 679403 679409 
-679417 679423 679433 679451 679463 679487 679501 679517 679519 679531 679537 679561 
-679597 679603 679607 679633 679639 679669 679681 679691 679699 679709 679733 679741 
-679747 679751 679753 679781 679793 679807 679823 679829 679837 679843 679859 679867 
-679879 679883 679891 679897 679907 679909 679919 679933 679951 679957 679961 679969 
-679981 679993 679999 680003 680027 680039 680059 680077 680081 680083 680107 680123 
-680129 680159 680161 680177 680189 680203 680209 680213 680237 680249 680263 680291 
-680293 680297 680299 680321 680327 680341 680347 680353 680377 680387 680399 680401 
-680411 680417 680431 680441 680443 680453 680489 680503 680507 680509 680531 680539 
-680567 680569 680587 680597 680611 680623 680633 680651 680657 680681 680707 680749 
-680759 680767 680783 680803 680809 680831 680857 680861 680873 680879 680881 680917 
-680929 680959 680971 680987 680989 680993 681001 681011 681019 681041 681047 681049 
-681061 681067 681089 681091 681113 681127 681137 681151 681167 681179 681221 681229 
-681251 681253 681257 681259 681271 681293 681311 681337 681341 681361 681367 681371 
-681403 681407 681409 681419 681427 681449 681451 681481 681487 681493 681497 681521 
-681523 681539 681557 681563 681589 681607 681613 681623 681631 681647 681673 681677 
-681689 681719 681727 681731 681763 681773 681781 681787 681809 681823 681833 681839 
-681841 681883 681899 681913 681931 681943 681949 681971 681977 681979 681983 681997 
-682001 682009 682037 682049 682063 682069 682079 682141 682147 682151 682153 682183 
-682207 682219 682229 682237 682247 682259 682277 682289 682291 682303 682307 682321 
-682327 682333 682337 682361 682373 682411 682417 682421 682427 682439 682447 682463 
-682471 682483 682489 682511 682519 682531 682547 682597 682607 682637 682657 682673 
-682679 682697 682699 682723 682729 682733 682739 682751 682763 682777 682789 682811 
-682819 682901 682933 682943 682951 682967 683003 683021 683041 683047 683071 683083 
-683087 683119 683129 683143 683149 683159 683201 683231 683251 683257 683273 683299 
-683303 683317 683323 683341 683351 683357 683377 683381 683401 683407 683437 683447 
-683453 683461 683471 683477 683479 683483 683489 683503 683513 683567 683591 683597 
-683603 683651 683653 683681 683687 683693 683699 683701 683713 683719 683731 683737 
-683747 683759 683777 683783 683789 683807 683819 683821 683831 683833 683843 683857 
-683861 683863 683873 683887 683899 683909 683911 683923 683933 683939 683957 683983 
-684007 684017 684037 684053 684091 684109 684113 684119 684121 684127 684157 684163 
-684191 684217 684221 684239 684269 684287 684289 684293 684311 684329 684337 684347 
-684349 684373 684379 684407 684419 684427 684433 684443 684451 684469 684473 684493 
-684527 684547 684557 684559 684569 684581 684587 684599 684617 684637 684643 684647 
-684683 684713 684727 684731 684751 684757 684767 684769 684773 684791 684793 684799 
-684809 684829 684841 684857 684869 684889 684923 684949 684961 684973 684977 684989 
-685001 685019 685031 685039 685051 685057 685063 685073 685081 685093 685099 685103 
-685109 685123 685141 685169 685177 685199 685231 685247 685249 685271 685297 685301 
-685319 685337 685339 685361 685367 685369 685381 685393 685417 685427 685429 685453 
-685459 685471 685493 685511 685513 685519 685537 685541 685547 685591 685609 685613 
-685621 685631 685637 685649 685669 685679 685697 685717 685723 685733 685739 685747 
-685753 685759 685781 685793 685819 685849 685859 685907 685939 685963 685969 685973 
-685987 685991 686003 686009 686011 686027 686029 686039 686041 686051 686057 686087 
-686089 686099 686117 686131 686141 686143 686149 686173 686177 686197 686201 686209 
-686267 686269 686293 686317 686321 686333 686339 686353 686359 686363 686417 686423 
-686437 686449 686453 686473 686479 686503 686513 686519 686551 686563 686593 686611 
-686639 686669 686671 686687 686723 686729 686731 686737 686761 686773 686789 686797 
-686801 686837 686843 686863 686879 686891 686893 686897 686911 686947 686963 686969 
-686971 686977 686989 686993 687007 687013 687017 687019 687023 687031 687041 687061 
-687073 687083 687101 687107 687109 687121 687131 687139 687151 687161 687163 687179 
-687223 687233 687277 687289 687299 687307 687311 687317 687331 687341 687343 687359 
-687383 687389 687397 687403 687413 687431 687433 687437 687443 687457 687461 687473 
-687481 687499 687517 687521 687523 687541 687551 687559 687581 687593 687623 687637 
-687641 687647 687679 687683 687691 687707 687721 687737 687749 687767 687773 687779 
-687787 687809 687823 687829 687839 687847 687893 687901 687917 687923 687931 687949 
-687961 687977 688003 688013 688027 688031 688063 688067 688073 688087 688097 688111 
-688133 688139 688147 688159 688187 688201 688217 688223 688249 688253 688277 688297 
-688309 688333 688339 688357 688379 688393 688397 688403 688411 688423 688433 688447 
-688451 688453 688477 688511 688531 688543 688561 688573 688591 688621 688627 688631 
-688637 688657 688661 688669 688679 688697 688717 688729 688733 688741 688747 688757 
-688763 688777 688783 688799 688813 688861 688867 688871 688889 688907 688939 688951 
-688957 688969 688979 688999 689021 689033 689041 689063 689071 689077 689081 689089 
-689093 689107 689113 689131 689141 689167 689201 689219 689233 689237 689257 689261 
-689267 689279 689291 689309 689317 689321 689341 689357 689369 689383 689389 689393 
-689411 689431 689441 689459 689461 689467 689509 689551 689561 689581 689587 689597 
-689599 689603 689621 689629 689641 689693 689699 689713 689723 689761 689771 689779 
-689789 689797 689803 689807 689827 689831 689851 689867 689869 689873 689879 689891 
-689893 689903 689917 689921 689929 689951 689957 689959 689963 689981 689987 690037 
-690059 690073 690089 690103 690119 690127 690139 690143 690163 690187 690233 690259 
-690269 690271 690281 690293 690323 690341 690367 690377 690397 690407 690419 690427 
-690433 690439 690449 690467 690491 690493 690509 690511 690533 690541 690553 690583 
-690589 690607 690611 690629 690661 690673 690689 690719 690721 690757 690787 690793 
-690817 690839 690841 690869 690871 690887 690889 690919 690929 690953 690997 691001 
-691037 691051 691063 691079 691109 691111 691121 691129 691147 691151 691153 691181 
-691183 691189 691193 691199 691231 691241 691267 691289 691297 691309 691333 691337 
-691343 691349 691363 691381 691399 691409 691433 691451 691463 691489 691499 691531 
-691553 691573 691583 691589 691591 691631 691637 691651 691661 691681 691687 691693 
-691697 691709 691721 691723 691727 691729 691739 691759 691763 691787 691799 691813 
-691829 691837 691841 691843 691871 691877 691891 691897 691903 691907 691919 691921 
-691931 691949 691973 691979 691991 691997 692009 692017 692051 692059 692063 692071 
-692089 692099 692117 692141 692147 692149 692161 692191 692221 692239 692249 692269 
-692273 692281 692287 692297 692299 692309 692327 692333 692347 692353 692371 692387 
-692389 692399 692401 692407 692413 692423 692431 692441 692453 692459 692467 692513 
-692521 692537 692539 692543 692567 692581 692591 692621 692641 692647 692651 692663 
-692689 692707 692711 692717 692729 692743 692753 692761 692771 692779 692789 692821 
-692851 692863 692893 692917 692927 692929 692933 692957 692963 692969 692983 693019 
-693037 693041 693061 693079 693089 693097 693103 693127 693137 693149 693157 693167 
-693169 693179 693223 693257 693283 693317 693323 693337 693353 693359 693373 693397 
-693401 693403 693409 693421 693431 693437 693487 693493 693503 693523 693527 693529 
-693533 693569 693571 693601 693607 693619 693629 693659 693661 693677 693683 693689 
-693691 693697 693701 693727 693731 693733 693739 693743 693757 693779 693793 693799 
-693809 693827 693829 693851 693859 693871 693877 693881 693943 693961 693967 693989 
-694019 694033 694039 694061 694069 694079 694081 694087 694091 694123 694189 694193 
-694201 694207 694223 694259 694261 694271 694273 694277 694313 694319 694327 694333 
-694339 694349 694357 694361 694367 694373 694381 694387 694391 694409 694427 694457 
-694471 694481 694483 694487 694511 694513 694523 694541 694549 694559 694567 694571 
-694591 694597 694609 694619 694633 694649 694651 694717 694721 694747 694763 694781 
-694783 694789 694829 694831 694867 694871 694873 694879 694901 694919 694951 694957 
-694979 694987 694997 694999 695003 695017 695021 695047 695059 695069 695081 695087 
-695089 695099 695111 695117 695131 695141 695171 695207 695239 695243 695257 695263 
-695269 695281 695293 695297 695309 695323 695327 695329 695347 695369 695371 695377 
-695389 695407 695411 695441 695447 695467 695477 695491 695503 695509 695561 695567 
-695573 695581 695593 695599 695603 695621 695627 695641 695659 695663 695677 695687 
-695689 695701 695719 695743 695749 695771 695777 695791 695801 695809 695839 695843 
-695867 695873 695879 695881 695899 695917 695927 695939 695999 696019 696053 696061 
-696067 696077 696079 696083 696107 696109 696119 696149 696181 696239 696253 696257 
-696263 696271 696281 696313 696317 696323 696343 696349 696359 696361 696373 696379 
-696403 696413 696427 696433 696457 696481 696491 696497 696503 696517 696523 696533 
-696547 696569 696607 696611 696617 696623 696629 696653 696659 696679 696691 696719 
-696721 696737 696743 696757 696763 696793 696809 696811 696823 696827 696833 696851 
-696853 696887 696889 696893 696907 696929 696937 696961 696989 696991 697009 697013 
-697019 697033 697049 697063 697069 697079 697087 697093 697111 697121 697127 697133 
-697141 697157 697181 697201 697211 697217 697259 697261 697267 697271 697303 697327 
-697351 697373 697379 697381 697387 697397 697399 697409 697423 697441 697447 697453 
-697457 697481 697507 697511 697513 697519 697523 697553 697579 697583 697591 697601 
-697603 697637 697643 697673 697681 697687 697691 697693 697703 697727 697729 697733 
-697757 697759 697787 697819 697831 697877 697891 697897 697909 697913 697937 697951 
-697967 697973 697979 697993 697999 698017 698021 698039 698051 698053 698077 698083 
-698111 698171 698183 698239 698249 698251 698261 698263 698273 698287 698293 698297 
-698311 698329 698339 698359 698371 698387 698393 698413 698417 698419 698437 698447 
-698471 698483 698491 698507 698521 698527 698531 698539 698543 698557 698567 698591 
-698641 698653 698669 698701 698713 698723 698729 698773 698779 698821 698827 698849 
-698891 698899 698903 698923 698939 698977 698983 699001 699007 699037 699053 699059 
-699073 699077 699089 699113 699119 699133 699151 699157 699169 699187 699191 699197 
-699211 699217 699221 699241 699253 699271 699287 699289 699299 699319 699323 699343 
-699367 699373 699379 699383 699401 699427 699437 699443 699449 699463 699469 699493 
-699511 699521 699527 699529 699539 699541 699557 699571 699581 699617 699631 699641 
-699649 699697 699709 699719 699733 699757 699761 699767 699791 699793 699817 699823 
-699863 699931 699943 699947 699953 699961 699967 700001 700027 700057 700067 700079 
-700081 700087 700099 700103 700109 700127 700129 700171 700199 700201 700211 700223 
-700229 700237 700241 700277 700279 700303 700307 700319 700331 700339 700361 700363 
-700367 700387 700391 700393 700423 700429 700433 700459 700471 700499 700523 700537 
-700561 700571 700573 700577 700591 700597 700627 700633 700639 700643 700673 700681 
-700703 700717 700751 700759 700781 700789 700801 700811 700831 700837 700849 700871 
-700877 700883 700897 700907 700919 700933 700937 700949 700963 700993 701009 701011 
-701023 701033 701047 701089 701117 701147 701159 701177 701179 701209 701219 701221 
-701227 701257 701279 701291 701299 701329 701341 701357 701359 701377 701383 701399 
-701401 701413 701417 701419 701443 701447 701453 701473 701479 701489 701497 701507 
-701509 701527 701531 701549 701579 701581 701593 701609 701611 701621 701627 701629 
-701653 701669 701671 701681 701699 701711 701719 701731 701741 701761 701783 701791 
-701819 701837 701863 701881 701903 701951 701957 701963 701969 702007 702011 702017 
-702067 702077 702101 702113 702127 702131 702137 702139 702173 702179 702193 702199 
-702203 702211 702239 702257 702269 702281 702283 702311 702313 702323 702329 702337 
-702341 702347 702349 702353 702379 702391 702407 702413 702431 702433 702439 702451 
-702469 702497 702503 702511 702517 702523 702529 702539 702551 702557 702587 702589 
-702599 702607 702613 702623 702671 702679 702683 702701 702707 702721 702731 702733 
-702743 702773 702787 702803 702809 702817 702827 702847 702851 702853 702869 702881 
-702887 702893 702913 702937 702983 702991 703013 703033 703039 703081 703117 703121 
-703123 703127 703139 703141 703169 703193 703211 703217 703223 703229 703231 703243 
-703249 703267 703277 703301 703309 703321 703327 703331 703349 703357 703379 703393 
-703411 703441 703447 703459 703463 703471 703489 703499 703531 703537 703559 703561 
-703631 703643 703657 703663 703673 703679 703691 703699 703709 703711 703721 703733 
-703753 703763 703789 703819 703837 703849 703861 703873 703883 703897 703903 703907 
-703943 703949 703957 703981 703991 704003 704009 704017 704023 704027 704029 704059 
-704069 704087 704101 704111 704117 704131 704141 704153 704161 704177 704183 704189 
-704213 704219 704233 704243 704251 704269 704279 704281 704287 704299 704303 704309 
-704321 704357 704393 704399 704419 704441 704447 704449 704453 704461 704477 704507 
-704521 704527 704549 704551 704567 704569 704579 704581 704593 704603 704617 704647 
-704657 704663 704681 704687 704713 704719 704731 704747 704761 704771 704777 704779 
-704783 704797 704801 704807 704819 704833 704839 704849 704857 704861 704863 704867 
-704897 704929 704933 704947 704983 704989 704993 704999 705011 705013 705017 705031 
-705043 705053 705073 705079 705097 705113 705119 705127 705137 705161 705163 705167 
-705169 705181 705191 705197 705209 705247 705259 705269 705277 705293 705307 705317 
-705389 705403 705409 705421 705427 705437 705461 705491 705493 705499 705521 705533 
-705559 705613 705631 705643 705689 705713 705737 705751 705763 705769 705779 705781 
-705787 705821 705827 705829 705833 705841 705863 705871 705883 705899 705919 705937 
-705949 705967 705973 705989 706001 706003 706009 706019 706033 706039 706049 706051 
-706067 706099 706109 706117 706133 706141 706151 706157 706159 706183 706193 706201 
-706207 706213 706229 706253 706267 706283 706291 706297 706301 706309 706313 706337 
-706357 706369 706373 706403 706417 706427 706463 706481 706487 706499 706507 706523 
-706547 706561 706597 706603 706613 706621 706631 706633 706661 706669 706679 706703 
-706709 706729 706733 706747 706751 706753 706757 706763 706787 706793 706801 706829 
-706837 706841 706847 706883 706897 706907 706913 706919 706921 706943 706961 706973 
-706987 706999 707011 707027 707029 707053 707071 707099 707111 707117 707131 707143 
-707153 707159 707177 707191 707197 707219 707249 707261 707279 707293 707299 707321 
-707341 707359 707383 707407 707429 707431 707437 707459 707467 707501 707527 707543 
-707561 707563 707573 707627 707633 707647 707653 707669 707671 707677 707683 707689 
-707711 707717 707723 707747 707753 707767 707789 707797 707801 707813 707827 707831 
-707849 707857 707869 707873 707887 707911 707923 707929 707933 707939 707951 707953 
-707957 707969 707981 707983 708007 708011 708017 708023 708031 708041 708047 708049 
-708053 708061 708091 708109 708119 708131 708137 708139 708161 708163 708179 708199 
-708221 708223 708229 708251 708269 708283 708287 708293 708311 708329 708343 708347 
-708353 708359 708361 708371 708403 708437 708457 708473 708479 708481 708493 708497 
-708517 708527 708559 708563 708569 708583 708593 708599 708601 708641 708647 708667 
-708689 708703 708733 708751 708803 708823 708839 708857 708859 708893 708899 708907 
-708913 708923 708937 708943 708959 708979 708989 708991 708997 709043 709057 709097 
-709117 709123 709139 709141 709151 709153 709157 709201 709211 709217 709231 709237 
-709271 709273 709279 709283 709307 709321 709337 709349 709351 709381 709409 709417 
-709421 709433 709447 709451 709453 709469 709507 709519 709531 709537 709547 709561 
-709589 709603 709607 709609 709649 709651 709663 709673 709679 709691 709693 709703 
-709729 709739 709741 709769 709777 709789 709799 709817 709823 709831 709843 709847 
-709853 709861 709871 709879 709901 709909 709913 709921 709927 709957 709963 709967 
-709981 709991 710009 710023 710027 710051 710053 710081 710089 710119 710189 710207 
-710219 710221 710257 710261 710273 710293 710299 710321 710323 710327 710341 710351 
-710371 710377 710383 710389 710399 710441 710443 710449 710459 710473 710483 710491 
-710503 710513 710519 710527 710531 710557 710561 710569 710573 710599 710603 710609 
-710621 710623 710627 710641 710663 710683 710693 710713 710777 710779 710791 710813 
-710837 710839 710849 710851 710863 710867 710873 710887 710903 710909 710911 710917 
-710929 710933 710951 710959 710971 710977 710987 710989 711001 711017 711019 711023 
-711041 711049 711089 711097 711121 711131 711133 711143 711163 711173 711181 711187 
-711209 711223 711259 711287 711299 711307 711317 711329 711353 711371 711397 711409 
-711427 711437 711463 711479 711497 711499 711509 711517 711523 711539 711563 711577 
-711583 711589 711617 711629 711649 711653 711679 711691 711701 711707 711709 711713 
-711727 711731 711749 711751 711757 711793 711811 711817 711829 711839 711847 711859 
-711877 711889 711899 711913 711923 711929 711937 711947 711959 711967 711973 711983 
-712007 712021 712051 712067 712093 712109 712121 712133 712157 712169 712171 712183 
-712199 712219 712237 712279 712289 712301 712303 712319 712321 712331 712339 712357 
-712409 712417 712427 712429 712433 712447 712477 712483 712489 712493 712499 712507 
-712511 712531 712561 712571 712573 712601 712603 712631 712651 712669 712681 712687 
-712693 712697 712711 712717 712739 712781 712807 712819 712837 712841 712843 712847 
-712883 712889 712891 712909 712913 712927 712939 712951 712961 712967 712973 712981 
-713021 713039 713059 713077 713107 713117 713129 713147 713149 713159 713171 713177 
-713183 713189 713191 713227 713233 713239 713243 713261 713267 713281 713287 713309 
-713311 713329 713347 713351 713353 713357 713381 713389 713399 713407 713411 713417 
-713467 713477 713491 713497 713501 713509 713533 713563 713569 713597 713599 713611 
-713627 713653 713663 713681 713737 713743 713747 713753 713771 713807 713827 713831 
-713833 713861 713863 713873 713891 713903 713917 713927 713939 713941 713957 713981 
-713987 714029 714037 714061 714073 714107 714113 714139 714143 714151 714163 714169 
-714199 714223 714227 714247 714257 714283 714341 714349 714361 714377 714443 714463 
-714479 714481 714487 714503 714509 714517 714521 714529 714551 714557 714563 714569 
-714577 714601 714619 714673 714677 714691 714719 714739 714751 714773 714781 714787 
-714797 714809 714827 714839 714841 714851 714853 714869 714881 714887 714893 714907 
-714911 714919 714943 714947 714949 714971 714991 715019 715031 715049 715063 715069 
-715073 715087 715109 715123 715151 715153 715157 715159 715171 715189 715193 715223 
-715229 715237 715243 715249 715259 715289 715301 715303 715313 715339 715357 715361 
-715373 715397 715417 715423 715439 715441 715453 715457 715489 715499 715523 715537 
-715549 715567 715571 715577 715579 715613 715621 715639 715643 715651 715657 715679 
-715681 715699 715727 715739 715753 715777 715789 715801 715811 715817 715823 715843 
-715849 715859 715867 715873 715877 715879 715889 715903 715909 715919 715927 715943 
-715961 715963 715969 715973 715991 715999 716003 716033 716063 716087 716117 716123 
-716137 716143 716161 716171 716173 716249 716257 716279 716291 716299 716321 716351 
-716383 716389 716399 716411 716413 716447 716449 716453 716459 716477 716479 716483 
-716491 716501 716531 716543 716549 716563 716581 716591 716621 716629 716633 716659 
-716663 716671 716687 716693 716707 716713 716731 716741 716743 716747 716783 716789 
-716809 716819 716827 716857 716861 716869 716897 716899 716917 716929 716951 716953 
-716959 716981 716987 717001 717011 717047 717089 717091 717103 717109 717113 717127 
-717133 717139 717149 717151 717161 717191 717229 717259 717271 717289 717293 717317 
-717323 717331 717341 717397 717413 717419 717427 717443 717449 717463 717491 717511 
-717527 717529 717533 717539 717551 717559 717581 717589 717593 717631 717653 717659 
-717667 717679 717683 717697 717719 717751 717797 717803 717811 717817 717841 717851 
-717883 717887 717917 717919 717923 717967 717979 717989 718007 718043 718049 718051 
-718087 718093 718121 718139 718163 718169 718171 718183 718187 718241 718259 718271 
-718303 718321 718331 718337 718343 718349 718357 718379 718381 718387 718391 718411 
-718423 718427 718433 718453 718457 718463 718493 718511 718513 718541 718547 718559 
-718579 718603 718621 718633 718657 718661 718691 718703 718717 718723 718741 718747 
-718759 718801 718807 718813 718841 718847 718871 718897 718901 718919 718931 718937 
-718943 718973 718999 719009 719011 719027 719041 719057 719063 719071 719101 719119 
-719143 719149 719153 719167 719177 719179 719183 719189 719197 719203 719227 719237 
-719239 719267 719281 719297 719333 719351 719353 719377 719393 719413 719419 719441 
-719447 719483 719503 719533 719557 719567 719569 719573 719597 719599 719633 719639 
-719659 719671 719681 719683 719689 719699 719713 719717 719723 719731 719749 719753 
-719773 719779 719791 719801 719813 719821 719833 719839 719893 719903 719911 719941 
-719947 719951 719959 719981 719989 720007 720019 720023 720053 720059 720089 720091 
-720101 720127 720133 720151 720173 720179 720193 720197 720211 720221 720229 720241 
-720253 720257 720281 720283 720289 720299 720301 720311 720319 720359 720361 720367 
-720373 720397 720403 720407 720413 720439 720481 720491 720497 720527 720547 720569 
-720571 720607 720611 720617 720619 720653 720661 720677 720683 720697 720703 720743 
-720763 720767 720773 720779 720791 720793 720829 720847 720857 720869 720877 720887 
-720899 720901 720913 720931 720943 720947 720961 720971 720983 720991 720997 721003 
-721013 721037 721043 721051 721057 721079 721087 721109 721111 721117 721129 721139 
-721141 721159 721163 721169 721177 721181 721199 721207 721213 721219 721223 721229 
-721243 721261 721267 721283 721291 721307 721319 721321 721333 721337 721351 721363 
-721379 721381 721387 721397 721439 721451 721481 721499 721529 721547 721561 721571 
-721577 721597 721613 721619 721621 721631 721661 721663 721687 721697 721703 721709 
-721733 721739 721783 721793 721843 721849 721859 721883 721891 721909 721921 721951 
-721961 721979 721991 721997 722011 722023 722027 722047 722063 722069 722077 722093 
-722119 722123 722147 722149 722153 722159 722167 722173 722213 722237 722243 722257 
-722273 722287 722291 722299 722311 722317 722321 722333 722341 722353 722363 722369 
-722377 722389 722411 722417 722431 722459 722467 722479 722489 722509 722521 722537 
-722539 722563 722581 722599 722611 722633 722639 722663 722669 722713 722723 722737 
-722749 722783 722791 722797 722807 722819 722833 722849 722881 722899 722903 722921 
-722933 722963 722971 722977 722983 723029 723031 723043 723049 723053 723067 723071 
-723089 723101 723103 723109 723113 723119 723127 723133 723157 723161 723167 723169 
-723181 723193 723209 723221 723227 723257 723259 723263 723269 723271 723287 723293 
-723319 723337 723353 723361 723379 723391 723407 723409 723413 723421 723439 723451 
-723467 723473 723479 723491 723493 723529 723551 723553 723559 723563 723587 723589 
-723601 723607 723617 723623 723661 723721 723727 723739 723761 723791 723797 723799 
-723803 723823 723829 723839 723851 723857 723859 723893 723901 723907 723913 723917 
-723923 723949 723959 723967 723973 723977 723997 724001 724007 724021 724079 724093 
-724099 724111 724117 724121 724123 724153 724187 724211 724219 724259 724267 724277 
-724291 724303 724309 724313 724331 724393 724403 724433 724441 724447 724453 724459 
-724469 724481 724487 724499 724513 724517 724519 724531 724547 724553 724567 724573 
-724583 724597 724601 724609 724621 724627 724631 724639 724643 724651 724721 724723 
-724729 724733 724747 724751 724769 724777 724781 724783 724807 724813 724837 724847 
-724853 724879 724901 724903 724939 724949 724961 724967 724991 724993 725009 725041 
-725057 725071 725077 725099 725111 725113 725119 725147 725149 725159 725161 725189 
-725201 725209 725273 725293 725303 725317 725321 725323 725327 725341 725357 725359 
-725371 725381 725393 725399 725423 725437 725447 725449 725479 725507 725519 725531 
-725537 725579 725587 725597 725603 725639 725653 725663 725671 725687 725723 725731 
-725737 725749 725789 725801 725807 725827 725861 725863 725867 725891 725897 725909 
-725929 725939 725953 725981 725983 725993 725999 726007 726013 726023 726043 726071 
-726091 726097 726101 726107 726109 726137 726139 726149 726157 726163 726169 726181 
-726191 726221 726287 726289 726301 726307 726331 726337 726367 726371 726377 726379 
-726391 726413 726419 726431 726457 726463 726469 726487 726497 726521 726527 726533 
-726559 726589 726599 726601 726611 726619 726623 726629 726641 726647 726659 726679 
-726689 726697 726701 726707 726751 726779 726787 726797 726809 726811 726839 726841 
-726853 726893 726899 726911 726917 726923 726941 726953 726983 726989 726991 727003 
-727009 727019 727021 727049 727061 727063 727079 727121 727123 727157 727159 727169 
-727183 727189 727201 727211 727241 727247 727249 727261 727267 727271 727273 727289 
-727297 727313 727327 727343 727351 727369 727399 727409 727427 727451 727459 727471 
-727483 727487 727499 727501 727541 727561 727577 727589 727613 727621 727633 727667 
-727673 727691 727703 727711 727717 727729 727733 727747 727759 727763 727777 727781 
-727799 727807 727817 727823 727843 727847 727877 727879 727891 727933 727939 727949 
-727981 727997 728003 728017 728027 728047 728069 728087 728113 728129 728131 728173 
-728191 728207 728209 728261 728267 728269 728281 728293 728303 728317 728333 728369 
-728381 728383 728417 728423 728437 728471 728477 728489 728521 728527 728537 728551 
-728557 728561 728573 728579 728627 728639 728647 728659 728681 728687 728699 728701 
-728713 728723 728729 728731 728743 728747 728771 728809 728813 728831 728837 728839 
-728843 728851 728867 728869 728873 728881 728891 728899 728911 728921 728927 728929 
-728941 728947 728953 728969 728971 728993 729019 729023 729037 729041 729059 729073 
-729139 729143 729173 729187 729191 729199 729203 729217 729257 729269 729271 729293 
-729301 729329 729331 729359 729367 729371 729373 729389 729403 729413 729451 729457 
-729473 729493 729497 729503 729511 729527 729551 729557 729559 729569 729571 729577 
-729587 729601 729607 729613 729637 729643 729649 729661 729671 729679 729689 729713 
-729719 729737 729749 729761 729779 729787 729791 729821 729851 729871 729877 729907 
-729913 729919 729931 729941 729943 729947 729977 729979 729991 730003 730021 730033 
-730049 730069 730091 730111 730139 730157 730187 730199 730217 730237 730253 730277 
-730283 730297 730321 730339 730363 730397 730399 730421 730447 730451 730459 730469 
-730487 730537 730553 730559 730567 730571 730573 730589 730591 730603 730619 730633 
-730637 730663 730669 730679 730727 730747 730753 730757 730777 730781 730783 730789 
-730799 730811 730819 730823 730837 730843 730853 730867 730879 730889 730901 730909 
-730913 730943 730969 730973 730993 730999 731033 731041 731047 731053 731057 731113 
-731117 731141 731173 731183 731189 731191 731201 731209 731219 731233 731243 731249 
-731251 731257 731261 731267 731287 731299 731327 731333 731359 731363 731369 731389 
-731413 731447 731483 731501 731503 731509 731531 731539 731567 731587 731593 731597 
-731603 731611 731623 731639 731651 731681 731683 731711 731713 731719 731729 731737 
-731741 731761 731767 731779 731803 731807 731821 731827 731831 731839 731851 731869 
-731881 731893 731909 731911 731921 731923 731933 731957 731981 731999 732023 732029 
-732041 732073 732077 732079 732097 732101 732133 732157 732169 732181 732187 732191 
-732197 732209 732211 732217 732229 732233 732239 732257 732271 732283 732287 732293 
-732299 732311 732323 732331 732373 732439 732449 732461 732467 732491 732493 732497 
-732509 732521 732533 732541 732601 732617 732631 732653 732673 732689 732703 732709 
-732713 732731 732749 732761 732769 732799 732817 732827 732829 732833 732841 732863 
-732877 732889 732911 732923 732943 732959 732967 732971 732997 733003 733009 733067 
-733097 733099 733111 733123 733127 733133 733141 733147 733157 733169 733177 733189 
-733237 733241 733273 733277 733283 733289 733301 733307 733321 733331 733333 733339 
-733351 733373 733387 733391 733393 733399 733409 733427 733433 733459 733477 733489 
-733511 733517 733519 733559 733561 733591 733619 733639 733651 733687 733697 733741 
-733751 733753 733757 733793 733807 733813 733823 733829 733841 733847 733849 733867 
-733871 733879 733883 733919 733921 733937 733939 733949 733963 733973 733981 733991 
-734003 734017 734021 734047 734057 734087 734113 734131 734143 734159 734171 734177 
-734189 734197 734203 734207 734221 734233 734263 734267 734273 734291 734303 734329 
-734347 734381 734389 734401 734411 734423 734429 734431 734443 734471 734473 734477 
-734479 734497 734537 734543 734549 734557 734567 734627 734647 734653 734659 734663 
-734687 734693 734707 734717 734729 734737 734743 734759 734771 734803 734807 734813 
-734819 734837 734849 734869 734879 734887 734897 734911 734933 734941 734953 734957 
-734959 734971 735001 735019 735043 735061 735067 735071 735073 735083 735107 735109 
-735113 735139 735143 735157 735169 735173 735181 735187 735193 735209 735211 735239 
-735247 735263 735271 735283 735307 735311 735331 735337 735341 735359 735367 735373 
-735389 735391 735419 735421 735431 735439 735443 735451 735461 735467 735473 735479 
-735491 735529 735533 735557 735571 735617 735649 735653 735659 735673 735689 735697 
-735719 735731 735733 735739 735751 735781 735809 735821 735829 735853 735871 735877 
-735883 735901 735919 735937 735949 735953 735979 735983 735997 736007 736013 736027 
-736037 736039 736051 736061 736063 736091 736093 736097 736111 736121 736147 736159 
-736181 736187 736243 736247 736249 736259 736273 736277 736279 736357 736361 736363 
-736367 736369 736381 736387 736399 736403 736409 736429 736433 736441 736447 736469 
-736471 736511 736577 736607 736639 736657 736679 736691 736699 736717 736721 736741 
-736787 736793 736817 736823 736843 736847 736867 736871 736889 736903 736921 736927 
-736937 736951 736961 736973 736987 736993 737017 737039 737041 737047 737053 737059 
-737083 737089 737111 737119 737129 737131 737147 737159 737179 737183 737203 737207 
-737251 737263 737279 737281 737287 737291 737293 737309 737327 737339 737351 737353 
-737411 737413 737423 737431 737479 737483 737497 737501 737507 737509 737531 737533 
-737537 737563 737567 737573 737591 737593 737617 737629 737641 737657 737663 737683 
-737687 737717 737719 737729 737747 737753 737767 737773 737797 737801 737809 737819 
-737843 737857 737861 737873 737887 737897 737921 737927 737929 737969 737981 737999 
-738011 738029 738043 738053 738071 738083 738107 738109 738121 738151 738163 738173 
-738197 738211 738217 738223 738247 738263 738301 738313 738317 738319 738341 738349 
-738373 738379 738383 738391 738401 738403 738421 738443 738457 738469 738487 738499 
-738509 738523 738539 738547 738581 738583 738589 738623 738643 738677 738707 738713 
-738721 738743 738757 738781 738791 738797 738811 738827 738839 738847 738851 738863 
-738877 738889 738917 738919 738923 738937 738953 738961 738977 738989 739003 739021 
-739027 739031 739051 739061 739069 739087 739099 739103 739111 739117 739121 739153 
-739163 739171 739183 739187 739199 739201 739217 739241 739253 739273 739283 739301 
-739303 739307 739327 739331 739337 739351 739363 739369 739373 739379 739391 739393 
-739397 739399 739433 739439 739463 739469 739493 739507 739511 739513 739523 739549 
-739553 739579 739601 739603 739621 739631 739633 739637 739649 739693 739699 739723 
-739751 739759 739771 739777 739787 739799 739813 739829 739847 739853 739859 739861 
-739909 739931 739943 739951 739957 739967 739969 740011 740021 740023 740041 740053 
-740059 740087 740099 740123 740141 740143 740153 740161 740171 740189 740191 740227 
-740237 740279 740287 740303 740321 740323 740329 740351 740359 740371 740387 740423 
-740429 740461 740473 740477 740483 740513 740521 740527 740533 740549 740561 740581 
-740591 740599 740603 740651 740653 740659 740671 740681 740687 740693 740711 740713 
-740717 740737 740749 740801 740849 740891 740893 740897 740903 740923 740939 740951 
-740969 740989 741001 741007 741011 741031 741043 741053 741061 741071 741077 741079 
-741101 741119 741121 741127 741131 741137 741163 741187 741193 741227 741229 741233 
-741253 741283 741337 741341 741343 741347 741373 741401 741409 741413 741431 741457 
-741467 741469 741473 741479 741491 741493 741509 741541 741547 741563 741569 741593 
-741599 741641 741661 741667 741677 741679 741683 741691 741709 741721 741781 741787 
-741803 741809 741827 741833 741847 741857 741859 741869 741877 741883 741913 741929 
-741941 741967 741973 741991 742009 742031 742037 742057 742069 742073 742111 742117 
-742127 742151 742153 742193 742199 742201 742211 742213 742219 742229 742241 742243 
-742253 742277 742283 742289 742307 742327 742333 742351 742369 742381 742393 742409 
-742439 742457 742499 742507 742513 742519 742531 742537 742541 742549 742559 742579 
-742591 742607 742619 742657 742663 742673 742681 742697 742699 742711 742717 742723 
-742757 742759 742783 742789 742801 742817 742891 742897 742909 742913 742943 742949 
-742967 742981 742991 742993 742999 743027 743047 743059 743069 743089 743111 743123 
-743129 743131 743137 743143 743159 743161 743167 743173 743177 743179 743203 743209 
-743221 743251 743263 743269 743273 743279 743297 743321 743333 743339 743363 743377 
-743401 743423 743447 743507 743549 743551 743573 743579 743591 743609 743657 743669 
-743671 743689 743693 743711 743731 743747 743777 743779 743791 743803 743819 743833 
-743837 743849 743851 743881 743891 743917 743921 743923 743933 743947 743987 743989 
-744019 744043 744071 744077 744083 744113 744127 744137 744179 744187 744199 744203 
-744221 744239 744251 744253 744283 744301 744313 744353 744371 744377 744389 744391 
-744397 744407 744409 744431 744451 744493 744503 744511 744539 744547 744559 744599 
-744607 744637 744641 744649 744659 744661 744677 744701 744707 744721 744727 744739 
-744761 744767 744791 744811 744817 744823 744829 744833 744859 744893 744911 744917 
-744941 744949 744959 744977 745001 745013 745027 745033 745037 745051 745067 745103 
-745117 745133 745141 745181 745187 745189 745201 745231 745243 745247 745249 745273 
-745301 745307 745337 745343 745357 745369 745379 745391 745397 745471 745477 745517 
-745529 745531 745543 745567 745573 745601 745609 745621 745631 745649 745673 745697 
-745699 745709 745711 745727 745733 745741 745747 745751 745753 745757 745817 745837 
-745859 745873 745903 745931 745933 745939 745951 745973 745981 745993 745999 746017 
-746023 746033 746041 746047 746069 746099 746101 746107 746117 746129 746153 746167 
-746171 746177 746183 746191 746197 746203 746209 746227 746231 746233 746243 746267 
-746287 746303 746309 746329 746353 746363 746371 746411 746413 746429 746477 746479 
-746483 746497 746503 746507 746509 746531 746533 746561 746563 746597 746653 746659 
-746671 746677 746723 746737 746743 746747 746749 746773 746777 746791 746797 746807 
-746813 746839 746843 746869 746873 746891 746899 746903 746939 746951 746957 746959 
-746969 746981 746989 747037 747049 747053 747073 747107 747113 747139 747157 747161 
-747199 747203 747223 747239 747259 747277 747283 747287 747319 747323 747343 747361 
-747377 747391 747401 747407 747421 747427 747449 747451 747457 747463 747493 747497 
-747499 747521 747529 747547 747557 747563 747583 747587 747599 747611 747619 747647 
-747673 747679 747713 747731 747737 747743 747763 747781 747811 747827 747829 747833 
-747839 747841 747853 747863 747869 747871 747889 747917 747919 747941 747953 747977 
-747979 747991 748003 748019 748021 748039 748057 748091 748093 748133 748169 748183 
-748199 748207 748211 748217 748219 748249 748271 748273 748283 748301 748331 748337 
-748339 748343 748361 748379 748387 748441 748453 748463 748471 748481 748487 748499 
-748513 748523 748541 748567 748589 748597 748603 748609 748613 748633 748637 748639 
-748669 748687 748691 748703 748711 748717 748723 748729 748763 748777 748789 748801 
-748807 748817 748819 748823 748829 748831 748849 748861 748871 748877 748883 748889 
-748921 748933 748963 748973 748981 748987 749011 749027 749051 749069 749081 749083 
-749093 749129 749137 749143 749149 749153 749167 749171 749183 749197 749209 749219 
-749237 749249 749257 749267 749279 749297 749299 749323 749339 749347 749351 749383 
-749393 749401 749423 749429 749431 749443 749449 749453 749461 749467 749471 749543 
-749557 749587 749641 749653 749659 749677 749701 749711 749729 749741 749747 749761 
-749773 749779 749803 749807 749809 749843 749851 749863 749891 749893 749899 749909 
-749923 749927 749939 749941 749971 749993 750019 750037 750059 750077 750083 750097 
-750119 750121 750131 750133 750137 750151 750157 750161 750163 750173 750179 750203 
-750209 750223 750229 750287 750311 750313 750353 750383 750401 750413 750419 750437 
-750457 750473 750487 750509 750517 750521 750553 750571 750599 750613 750641 750653 
-750661 750667 750679 750691 750707 750713 750719 750721 750749 750769 750787 750791 
-750797 750803 750809 750817 750829 750853 750857 750863 750917 750929 750943 750961 
-750977 750983 751001 751007 751021 751027 751057 751061 751087 751103 751123 751133 
-751139 751141 751147 751151 751181 751183 751189 751193 751199 751207 751217 751237 
-751259 751273 751277 751291 751297 751301 751307 751319 751321 751327 751343 751351 
-751357 751363 751367 751379 751411 751423 751447 751453 751463 751481 751523 751529 
-751549 751567 751579 751609 751613 751627 751631 751633 751637 751643 751661 751669 
-751691 751711 751717 751727 751739 751747 751753 751759 751763 751787 751799 751813 
-751823 751841 751853 751867 751871 751879 751901 751909 751913 751921 751943 751957 
-751969 751987 751997 752009 752023 752033 752053 752083 752093 752107 752111 752117 
-752137 752149 752177 752183 752189 752197 752201 752203 752207 752251 752263 752273 
-752281 752287 752291 752293 752299 752303 752351 752359 752383 752413 752431 752447 
-752449 752459 752483 752489 752503 752513 752519 752527 752569 752581 752593 752603 
-752627 752639 752651 752681 752683 752699 752701 752707 752747 752771 752789 752797 
-752803 752809 752819 752821 752831 752833 752861 752867 752881 752891 752903 752911 
-752929 752933 752977 752993 753001 753007 753019 753023 753031 753079 753091 753127 
-753133 753139 753143 753161 753187 753191 753197 753229 753257 753307 753329 753341 
-753353 753367 753373 753383 753409 753421 753427 753437 753439 753461 753463 753497 
-753499 753527 753547 753569 753583 753587 753589 753611 753617 753619 753631 753647 
-753659 753677 753679 753689 753691 753707 753719 753721 753737 753743 753751 753773 
-753793 753799 753803 753811 753821 753839 753847 753859 753931 753937 753941 753947 
-753959 753979 753983 754003 754027 754037 754043 754057 754067 754073 754081 754093 
-754099 754109 754111 754121 754123 754133 754153 754157 754181 754183 754207 754211 
-754217 754223 754241 754249 754267 754279 754283 754289 754297 754301 754333 754337 
-754343 754367 754373 754379 754381 754399 754417 754421 754427 754451 754463 754483 
-754489 754513 754531 754549 754573 754577 754583 754597 754627 754639 754651 754703 
-754709 754711 754717 754723 754739 754751 754771 754781 754811 754829 754861 754877 
-754891 754903 754907 754921 754931 754937 754939 754967 754969 754973 754979 754981 
-754991 754993 755009 755033 755057 755071 755077 755081 755087 755107 755137 755143 
-755147 755171 755173 755203 755213 755233 755239 755257 755267 755273 755309 755311 
-755317 755329 755333 755351 755357 755371 755387 755393 755399 755401 755413 755437 
-755441 755449 755473 755483 755509 755539 755551 755561 755567 755569 755593 755597 
-755617 755627 755663 755681 755707 755717 755719 755737 755759 755767 755771 755789 
-755791 755809 755813 755861 755863 755869 755879 755899 755903 755959 755969 755977 
-756011 756023 756043 756053 756097 756101 756127 756131 756139 756149 756167 756179 
-756191 756199 756227 756247 756251 756253 756271 756281 756289 756293 756319 756323 
-756331 756373 756403 756419 756421 756433 756443 756463 756467 756527 756533 756541 
-756563 756571 756593 756601 756607 756629 756641 756649 756667 756673 756683 756689 
-756703 756709 756719 756727 756739 756773 756799 756829 756839 756853 756869 756881 
-756887 756919 756923 756961 756967 756971 757019 757039 757063 757067 757109 757111 
-757151 757157 757171 757181 757201 757241 757243 757247 757259 757271 757291 757297 
-757307 757319 757327 757331 757343 757363 757381 757387 757403 757409 757417 757429 
-757433 757457 757481 757487 757507 757513 757517 757543 757553 757577 757579 757583 
-757607 757633 757651 757661 757693 757699 757709 757711 757727 757751 757753 757763 
-757793 757807 757811 757819 757829 757879 757903 757909 757927 757937 757943 757951 
-757993 757997 758003 758029 758041 758053 758071 758083 758099 758101 758111 758137 
-758141 758159 758179 758189 758201 758203 758227 758231 758237 758243 758267 758269 
-758273 758279 758299 758323 758339 758341 758357 758363 758383 758393 758411 758431 
-758441 758449 758453 758491 758501 758503 758519 758521 758551 758561 758573 758579 
-758599 758617 758629 758633 758671 758687 758699 758707 758711 758713 758729 758731 
-758741 758743 758753 758767 758783 758789 758819 758827 758837 758851 758867 758887 
-758893 758899 758929 758941 758957 758963 758969 758971 758987 759001 759019 759029 
-759037 759047 759053 759089 759103 759113 759131 759149 759167 759173 759179 759181 
-759193 759223 759229 759263 759287 759293 759301 759313 759329 759359 759371 759377 
-759397 759401 759431 759433 759457 759463 759467 759491 759503 759523 759547 759553 
-759557 759559 759569 759571 759581 759589 759599 759617 759623 759631 759637 759641 
-759653 759659 759673 759691 759697 759701 759709 759719 759727 759739 759757 759763 
-759797 759799 759821 759833 759881 759893 759911 759923 759929 759947 759953 759959 
-759961 759973 760007 760043 760063 760079 760093 760103 760117 760129 760141 760147 
-760153 760163 760169 760183 760187 760211 760229 760231 760237 760241 760261 760267 
-760273 760289 760297 760301 760321 760343 760367 760373 760411 760423 760433 760447 
-760453 760457 760477 760489 760499 760511 760519 760531 760537 760549 760553 760561 
-760567 760579 760607 760619 760621 760637 760649 760657 760693 760723 760729 760759 
-760769 760783 760807 760813 760841 760843 760847 760871 760891 760897 760901 760913 
-760927 760933 760939 760951 760961 760993 760997 761003 761009 761023 761051 761069 
-761087 761113 761119 761129 761153 761161 761177 761179 761183 761203 761207 761213 
-761227 761249 761251 761261 761263 761291 761297 761347 761351 761357 761363 761377 
-761381 761389 761393 761399 761407 761417 761429 761437 761441 761443 761459 761471 
-761477 761483 761489 761521 761531 761533 761543 761561 761567 761591 761597 761603 
-761611 761623 761633 761669 761671 761681 761689 761711 761713 761731 761773 761777 
-761779 761807 761809 761833 761861 761863 761869 761879 761897 761927 761939 761963 
-761977 761983 761993 762001 762007 762017 762031 762037 762049 762053 762061 762101 
-762121 762187 762211 762227 762233 762239 762241 762253 762257 762277 762319 762329 
-762367 762371 762373 762379 762389 762397 762401 762407 762409 762479 762491 762499 
-762529 762539 762547 762557 762563 762571 762577 762583 762599 762647 762653 762659 
-762667 762721 762737 762743 762761 762779 762791 762809 762821 762823 762847 762871 
-762877 762893 762899 762901 762913 762917 762919 762959 762967 762973 762989 763001 
-763013 763027 763031 763039 763043 763067 763073 763093 763111 763123 763141 763157 
-763159 763183 763201 763223 763237 763261 763267 763271 763303 763307 763339 763349 
-763369 763381 763391 763403 763409 763417 763423 763429 763447 763457 763471 763481 
-763493 763513 763523 763549 763559 763573 763579 763583 763597 763601 763613 763619 
-763621 763627 763649 763663 763673 763699 763739 763751 763753 763757 763771 763787 
-763801 763811 763823 763843 763859 763879 763883 763897 763901 763907 763913 763921 
-763927 763937 763943 763957 763967 763999 764003 764011 764017 764021 764041 764051 
-764053 764059 764081 764089 764111 764131 764143 764149 764171 764189 764209 764233 
-764249 764251 764261 764273 764293 764317 764321 764327 764339 764341 764369 764381 
-764399 764431 764447 764459 764471 764501 764521 764539 764551 764563 764587 764591 
-764593 764611 764623 764627 764629 764657 764683 764689 764717 764719 764723 764783 
-764789 764809 764837 764839 764849 764857 764887 764891 764893 764899 764903 764947 
-764969 764971 764977 764989 764993 764999 765007 765031 765041 765043 765047 765059 
-765091 765097 765103 765109 765131 765137 765139 765143 765151 765169 765181 765199 
-765203 765209 765211 765227 765229 765241 765251 765257 765283 765287 765293 765307 
-765313 765319 765329 765353 765379 765383 765389 765409 765437 765439 765461 765467 
-765487 765497 765503 765521 765533 765539 765577 765581 765587 765613 765619 765623 
-765649 765659 765673 765707 765727 765749 765763 765767 765773 765781 765823 765827 
-765847 765851 765857 765859 765881 765889 765893 765899 765907 765913 765931 765949 
-765953 765971 765983 765991 766021 766039 766049 766067 766079 766091 766097 766109 
-766111 766127 766163 766169 766177 766187 766211 766223 766229 766231 766237 766247 
-766261 766273 766277 766301 766313 766321 766333 766357 766361 766369 766373 766387 
-766393 766399 766421 766439 766453 766457 766471 766477 766487 766501 766511 766531 
-766541 766543 766553 766559 766583 766609 766637 766639 766651 766679 766687 766721 
-766739 766757 766763 766769 766793 766807 766811 766813 766817 766861 766867 766873 
-766877 766891 766901 766907 766937 766939 766943 766957 766967 766999 767017 767029 
-767051 767071 767089 767093 767101 767111 767131 767147 767153 767161 767167 767203 
-767243 767279 767287 767293 767309 767317 767321 767323 767339 767357 767359 767381 
-767399 767423 767443 767471 767489 767509 767513 767521 767527 767537 767539 767549 
-767551 767587 767597 767603 767617 767623 767633 767647 767677 767681 767707 767729 
-767747 767749 767759 767761 767773 767783 767813 767827 767831 767843 767857 767863 
-767867 767869 767881 767909 767951 767957 768013 768029 768041 768049 768059 768073 
-768101 768107 768127 768133 768139 768161 768167 768169 768191 768193 768197 768199 
-768203 768221 768241 768259 768263 768301 768319 768323 768329 768343 768347 768353 
-768359 768371 768373 768377 768389 768401 768409 768419 768431 768437 768457 768461 
-768479 768491 768503 768541 768563 768571 768589 768613 768623 768629 768631 768641 
-768643 768653 768671 768727 768751 768767 768773 768787 768793 768799 768811 768841 
-768851 768853 768857 768869 768881 768923 768931 768941 768953 768979 768983 769003 
-769007 769019 769033 769039 769057 769073 769081 769091 769117 769123 769147 769151 
-769159 769169 769207 769231 769243 769247 769259 769261 769273 769289 769297 769309 
-769319 769339 769357 769387 769411 769421 769423 769429 769453 769459 769463 769469 
-769487 769541 769543 769547 769553 769577 769579 769589 769591 769597 769619 769627 
-769661 769663 769673 769687 769723 769729 769733 769739 769751 769781 769789 769799 
-769807 769837 769871 769903 769919 769927 769943 769961 769963 769973 769987 769997 
-769999 770027 770039 770041 770047 770053 770057 770059 770069 770101 770111 770113 
-770123 770129 770167 770177 770179 770183 770191 770207 770227 770233 770239 770261 
-770281 770291 770309 770311 770353 770359 770387 770401 770417 770437 770447 770449 
-770459 770503 770519 770527 770533 770537 770551 770557 770573 770579 770587 770591 
-770597 770611 770639 770641 770647 770657 770663 770669 770741 770761 770767 770771 
-770789 770801 770813 770837 770839 770843 770863 770867 770873 770881 770897 770909 
-770927 770929 770951 770971 770981 770993 771011 771013 771019 771031 771037 771047 
-771049 771073 771079 771091 771109 771143 771163 771179 771181 771209 771217 771227 
-771233 771269 771283 771289 771293 771299 771301 771349 771359 771389 771401 771403 
-771427 771431 771437 771439 771461 771473 771481 771499 771503 771509 771517 771527 
-771553 771569 771583 771587 771607 771619 771623 771629 771637 771643 771653 771679 
-771691 771697 771703 771739 771763 771769 771781 771809 771853 771863 771877 771887 
-771889 771899 771917 771937 771941 771961 771971 771973 771997 772001 772003 772019 
-772061 772073 772081 772091 772097 772127 772139 772147 772159 772169 772181 772207 
-772229 772231 772273 772279 772297 772313 772333 772339 772349 772367 772379 772381 
-772391 772393 772403 772439 772441 772451 772459 772477 772493 772517 772537 772567 
-772571 772573 772591 772619 772631 772649 772657 772661 772663 772669 772691 772697 
-772703 772721 772757 772771 772789 772843 772847 772853 772859 772867 772903 772907 
-772909 772913 772921 772949 772963 772987 772991 773021 773023 773027 773029 773039 
-773057 773063 773081 773083 773093 773117 773147 773153 773159 773207 773209 773231 
-773239 773249 773251 773273 773287 773299 773317 773341 773363 773371 773387 773393 
-773407 773417 773447 773453 773473 773491 773497 773501 773533 773537 773561 773567 
-773569 773579 773599 773603 773609 773611 773657 773659 773681 773683 773693 773713 
-773719 773723 773767 773777 773779 773803 773821 773831 773837 773849 773863 773867 
-773869 773879 773897 773909 773933 773939 773951 773953 773987 773989 773999 774001 
-774017 774023 774047 774071 774073 774083 774107 774119 774127 774131 774133 774143 
-774149 774161 774173 774181 774199 774217 774223 774229 774233 774239 774283 774289 
-774313 774317 774337 774343 774377 774427 774439 774463 774467 774491 774511 774523 
-774541 774551 774577 774583 774589 774593 774601 774629 774643 774661 774667 774671 
-774679 774691 774703 774733 774757 774773 774779 774791 774797 774799 774803 774811 
-774821 774833 774853 774857 774863 774901 774919 774929 774931 774959 774997 775007 
-775037 775043 775057 775063 775079 775087 775091 775097 775121 775147 775153 775157 
-775163 775189 775193 775237 775241 775259 775267 775273 775309 775343 775349 775361 
-775363 775367 775393 775417 775441 775451 775477 775507 775513 775517 775531 775553 
-775573 775601 775603 775613 775627 775633 775639 775661 775669 775681 775711 775729 
-775739 775741 775757 775777 775787 775807 775811 775823 775861 775871 775889 775919 
-775933 775937 775939 775949 775963 775987 776003 776029 776047 776057 776059 776077 
-776099 776117 776119 776137 776143 776159 776173 776177 776179 776183 776201 776219 
-776221 776233 776249 776257 776267 776287 776317 776327 776357 776389 776401 776429 
-776449 776453 776467 776471 776483 776497 776507 776513 776521 776551 776557 776561 
-776563 776569 776599 776627 776651 776683 776693 776719 776729 776749 776753 776759 
-776801 776813 776819 776837 776851 776861 776869 776879 776887 776899 776921 776947 
-776969 776977 776983 776987 777001 777011 777013 777031 777041 777071 777097 777103 
-777109 777137 777143 777151 777167 777169 777173 777181 777187 777191 777199 777209 
-777221 777241 777247 777251 777269 777277 777313 777317 777349 777353 777373 777383 
-777389 777391 777419 777421 777431 777433 777437 777451 777463 777473 777479 777541 
-777551 777571 777583 777589 777617 777619 777641 777643 777661 777671 777677 777683 
-777731 777737 777743 777761 777769 777781 777787 777817 777839 777857 777859 777863 
-777871 777877 777901 777911 777919 777977 777979 777989 778013 778027 778049 778051 
-778061 778079 778081 778091 778097 778109 778111 778121 778123 778153 778163 778187 
-778201 778213 778223 778237 778241 778247 778301 778307 778313 778319 778333 778357 
-778361 778363 778391 778397 778403 778409 778417 778439 778469 778507 778511 778513 
-778523 778529 778537 778541 778553 778559 778567 778579 778597 778633 778643 778663 
-778667 778681 778693 778697 778699 778709 778717 778727 778733 778759 778763 778769 
-778777 778793 778819 778831 778847 778871 778873 778879 778903 778907 778913 778927 
-778933 778951 778963 778979 778993 779003 779011 779021 779039 779063 779069 779081 
-779101 779111 779131 779137 779159 779173 779189 779221 779231 779239 779249 779267 
-779327 779329 779341 779347 779351 779353 779357 779377 779413 779477 779489 779507 
-779521 779531 779543 779561 779563 779573 779579 779591 779593 779599 779609 779617 
-779621 779657 779659 779663 779693 779699 779707 779731 779747 779749 779761 779767 
-779771 779791 779797 779827 779837 779869 779873 779879 779887 779899 779927 779939 
-779971 779981 779983 779993 780029 780037 780041 780047 780049 780061 780119 780127 
-780163 780173 780179 780191 780193 780211 780223 780233 780253 780257 780287 780323 
-780343 780347 780371 780379 780383 780389 780397 780401 780421 780433 780457 780469 
-780499 780523 780553 780583 780587 780601 780613 780631 780649 780667 780671 780679 
-780683 780697 780707 780719 780721 780733 780799 780803 780809 780817 780823 780833 
-780841 780851 780853 780869 780877 780887 780889 780917 780931 780953 780961 780971 
-780973 780991 781003 781007 781021 781043 781051 781063 781069 781087 781111 781117 
-781127 781129 781139 781163 781171 781199 781211 781217 781229 781243 781247 781271 
-781283 781301 781307 781309 781321 781327 781351 781357 781367 781369 781387 781397 
-781399 781409 781423 781427 781433 781453 781481 781483 781493 781511 781513 781519 
-781523 781531 781559 781567 781589 781601 781607 781619 781631 781633 781661 781673 
-781681 781721 781733 781741 781771 781799 781801 781817 781819 781853 781861 781867 
-781883 781889 781897 781919 781951 781961 781967 781969 781973 781987 781997 781999 
-782003 782009 782011 782053 782057 782071 782083 782087 782107 782113 782123 782129 
-782137 782141 782147 782149 782183 782189 782191 782209 782219 782231 782251 782263 
-782267 782297 782311 782329 782339 782371 782381 782387 782389 782393 782429 782443 
-782461 782473 782489 782497 782501 782519 782539 782581 782611 782641 782659 782669 
-782671 782687 782689 782707 782711 782723 782777 782783 782791 782839 782849 782861 
-782891 782911 782921 782941 782963 782981 782983 782993 783007 783011 783019 783023 
-783043 783077 783089 783119 783121 783131 783137 783143 783149 783151 783191 783193 
-783197 783227 783247 783257 783259 783269 783283 783317 783323 783329 783337 783359 
-783361 783373 783379 783407 783413 783421 783473 783487 783527 783529 783533 783553 
-783557 783569 783571 783599 783613 783619 783641 783647 783661 783677 783689 783691 
-783701 783703 783707 783719 783721 783733 783737 783743 783749 783763 783767 783779 
-783781 783787 783791 783793 783799 783803 783829 783869 783877 783931 783953 784009 
-784039 784061 784081 784087 784097 784103 784109 784117 784129 784153 784171 784181 
-784183 784211 784213 784219 784229 784243 784249 784283 784307 784309 784313 784321 
-784327 784349 784351 784367 784373 784379 784387 784409 784411 784423 784447 784451 
-784457 784463 784471 784481 784489 784501 784513 784541 784543 784547 784561 784573 
-784577 784583 784603 784627 784649 784661 784687 784697 784717 784723 784727 784753 
-784789 784799 784831 784837 784841 784859 784867 784897 784913 784919 784939 784957 
-784961 784981 785003 785017 785033 785053 785093 785101 785107 785119 785123 785129 
-785143 785153 785159 785167 785203 785207 785219 785221 785227 785249 785269 785287 
-785293 785299 785303 785311 785321 785329 785333 785341 785347 785353 785357 785363 
-785377 785413 785423 785431 785459 785461 785483 785501 785503 785527 785537 785549 
-785569 785573 785579 785591 785597 785623 785627 785641 785651 785671 785693 785717 
-785731 785737 785753 785773 785777 785779 785801 785803 785809 785839 785857 785861 
-785879 785903 785921 785923 785947 785951 785963 786001 786013 786017 786031 786047 
-786053 786059 786061 786077 786109 786127 786151 786167 786173 786179 786197 786211 
-786223 786241 786251 786271 786307 786311 786319 786329 786337 786349 786371 786407 
-786419 786431 786433 786449 786469 786491 786547 786551 786553 786587 786589 786613 
-786629 786659 786661 786673 786691 786697 786701 786703 786707 786719 786739 786763 
-786803 786823 786829 786833 786859 786881 786887 786889 786901 786931 786937 786941 
-786949 786959 786971 786979 786983 787021 787043 787051 787057 787067 787069 787079 
-787091 787099 787123 787139 787153 787181 787187 787207 787217 787243 787261 787277 
-787289 787309 787331 787333 787337 787357 787361 787427 787429 787433 787439 787447 
-787469 787477 787483 787489 787513 787517 787519 787529 787537 787541 787547 787573 
-787601 787609 787621 787639 787649 787667 787697 787711 787747 787751 787757 787769 
-787771 787777 787783 787793 787807 787811 787817 787823 787837 787879 787883 787903 
-787907 787939 787973 787981 787993 787999 788009 788023 788027 788033 788041 788071 
-788077 788087 788089 788093 788107 788129 788153 788159 788167 788173 788189 788209 
-788213 788231 788261 788267 788287 788309 788317 788321 788351 788353 788357 788363 
-788369 788377 788383 788387 788393 788399 788413 788419 788429 788449 788467 788479 
-788497 788521 788527 788531 788537 788549 788561 788563 788569 788603 788621 788651 
-788659 788677 788687 788701 788719 788761 788779 788789 788813 788819 788849 788863 
-788867 788869 788873 788891 788897 788903 788927 788933 788941 788947 788959 788971 
-788993 788999 789001 789017 789029 789031 789067 789077 789091 789097 789101 789109 
-789121 789133 789137 789149 789169 789181 789221 789227 789251 789311 789323 789331 
-789343 789367 789377 789389 789391 789407 789419 789443 789473 789491 789493 789511 
-789527 789533 789557 789571 789577 789587 789589 789611 789623 789631 789653 789671 
-789673 789683 789689 789709 789713 789721 789731 789739 789749 789793 789823 789829 
-789847 789851 789857 789883 789941 789959 789961 789967 789977 789979 790003 790021 
-790033 790043 790051 790057 790063 790087 790093 790099 790121 790169 790171 790189 
-790199 790201 790219 790241 790261 790271 790277 790289 790291 790327 790331 790333 
-790351 790369 790379 790397 790403 790417 790421 790429 790451 790459 790481 790501 
-790513 790519 790523 790529 790547 790567 790583 790589 790607 790613 790633 790637 
-790649 790651 790693 790697 790703 790709 790733 790739 790747 790753 790781 790793 
-790817 790819 790831 790843 790861 790871 790879 790883 790897 790927 790957 790961 
-790967 790969 790991 790997 791003 791009 791017 791029 791047 791053 791081 791093 
-791099 791111 791117 791137 791159 791191 791201 791209 791227 791233 791251 791257 
-791261 791291 791309 791311 791317 791321 791347 791363 791377 791387 791411 791419 
-791431 791443 791447 791473 791489 791519 791543 791561 791563 791569 791573 791599 
-791627 791629 791657 791663 791677 791699 791773 791783 791789 791797 791801 791803 
-791827 791849 791851 791887 791891 791897 791899 791909 791927 791929 791933 791951 
-791969 791971 791993 792023 792031 792037 792041 792049 792061 792067 792073 792101 
-792107 792109 792119 792131 792151 792163 792179 792223 792227 792229 792241 792247 
-792257 792263 792277 792283 792293 792299 792301 792307 792317 792359 792371 792377 
-792383 792397 792413 792443 792461 792479 792481 792487 792521 792529 792551 792553 
-792559 792563 792581 792593 792601 792613 792629 792637 792641 792643 792647 792667 
-792679 792689 792691 792697 792703 792709 792713 792731 792751 792769 792793 792797 
-792821 792871 792881 792893 792907 792919 792929 792941 792959 792973 792983 792989 
-792991 793043 793069 793099 793103 793123 793129 793139 793159 793181 793187 793189 
-793207 793229 793253 793279 793297 793301 793327 793333 793337 793343 793379 793399 
-793439 793447 793453 793487 793489 793493 793511 793517 793519 793537 793547 793553 
-793561 793591 793601 793607 793621 793627 793633 793669 793673 793691 793699 793711 
-793717 793721 793733 793739 793757 793769 793777 793787 793789 793813 793841 793843 
-793853 793867 793889 793901 793927 793931 793939 793957 793967 793979 793981 793999 
-794009 794011 794023 794033 794039 794041 794063 794071 794077 794089 794111 794113 
-794119 794137 794141 794149 794153 794161 794173 794179 794191 794201 794203 794207 
-794221 794231 794239 794249 794327 794341 794363 794383 794389 794399 794407 794413 
-794449 794471 794473 794477 794483 794491 794509 794531 794537 794543 794551 794557 
-794569 794579 794587 794593 794641 794653 794657 794659 794669 794693 794711 794741 
-794743 794749 794779 794831 794879 794881 794887 794921 794923 794953 794957 794993 
-794999 795001 795007 795023 795071 795077 795079 795083 795097 795101 795103 795121 
-795127 795139 795149 795161 795187 795203 795211 795217 795233 795239 795251 795253 
-795299 795307 795323 795329 795337 795343 795349 795427 795449 795461 795467 795479 
-795493 795503 795517 795527 795533 795539 795551 795581 795589 795601 795643 795647 
-795649 795653 795659 795661 795667 795679 795703 795709 795713 795727 795737 795761 
-795763 795791 795793 795797 795799 795803 795827 795829 795871 795877 795913 795917 
-795931 795937 795941 795943 795947 795979 795983 795997 796001 796009 796063 796067 
-796091 796121 796139 796141 796151 796171 796177 796181 796189 796193 796217 796247 
-796259 796267 796291 796303 796307 796337 796339 796361 796363 796373 796379 796387 
-796391 796409 796447 796451 796459 796487 796493 796517 796531 796541 796553 796561 
-796567 796571 796583 796591 796619 796633 796657 796673 796687 796693 796699 796709 
-796711 796751 796759 796769 796777 796781 796799 796801 796813 796819 796847 796849 
-796853 796867 796871 796877 796889 796921 796931 796933 796937 796951 796967 796969 
-796981 797003 797009 797021 797029 797033 797039 797051 797053 797057 797063 797077 
-797119 797131 797143 797161 797171 797201 797207 797273 797281 797287 797309 797311 
-797333 797353 797359 797383 797389 797399 797417 797429 797473 797497 797507 797509 
-797539 797549 797551 797557 797561 797567 797569 797579 797581 797591 797593 797611 
-797627 797633 797647 797681 797689 797701 797711 797729 797743 797747 797767 797773 
-797813 797833 797851 797869 797887 797897 797911 797917 797933 797947 797957 797977 
-797987 798023 798043 798059 798067 798071 798079 798089 798097 798101 798121 798131 
-798139 798143 798151 798173 798179 798191 798197 798199 798221 798223 798227 798251 
-798257 798263 798271 798293 798319 798331 798373 798383 798397 798403 798409 798443 
-798451 798461 798481 798487 798503 798517 798521 798527 798533 798569 798599 798613 
-798641 798647 798649 798667 798691 798697 798701 798713 798727 798737 798751 798757 
-798773 798781 798799 798823 798871 798887 798911 798923 798929 798937 798943 798961 
-799003 799021 799031 799061 799063 799091 799093 799103 799147 799151 799171 799217 
-799219 799223 799259 799291 799301 799303 799307 799313 799333 799343 799361 799363 
-799369 799417 799427 799441 799453 799471 799481 799483 799489 799507 799523 799529 
-799543 799553 799573 799609 799613 799619 799621 799633 799637 799651 799657 799661 
-799679 799723 799727 799739 799741 799753 799759 799789 799801 799807 799817 799837 
-799853 799859 799873 799891 799921 799949 799961 799979 799991 799993 799999 800011 
-800029 800053 800057 800077 800083 800089 800113 800117 800119 800123 800131 800143 
-800159 800161 800171 800209 800213 800221 800231 800237 800243 800281 800287 800291 
-800311 800329 800333 800351 800357 800399 800407 800417 800419 800441 800447 800473 
-800477 800483 800497 800509 800519 800521 800533 800537 800539 800549 800557 800573 
-800587 800593 800599 800621 800623 800647 800651 800659 800663 800669 800677 800687 
-800693 800707 800711 800729 800731 800741 800743 800759 800773 800783 800801 800861 
-800873 800879 800897 800903 800909 800923 800953 800959 800971 800977 800993 800999 
-801001 801007 801011 801019 801037 801061 801077 801079 801103 801107 801127 801137 
-801179 801187 801197 801217 801247 801277 801289 801293 801301 801331 801337 801341 
-801349 801371 801379 801403 801407 801419 801421 801461 801469 801487 801503 801517 
-801539 801551 801557 801569 801571 801607 801611 801617 801631 801641 801677 801683 
-801701 801707 801709 801733 801761 801791 801809 801811 801817 801833 801841 801859 
-801883 801947 801949 801959 801973 801989 802007 802019 802027 802031 802037 802073 
-802103 802121 802127 802129 802133 802141 802147 802159 802163 802177 802181 802183 
-802189 802231 802253 802279 802283 802297 802331 802339 802357 802387 802421 802441 
-802453 802463 802471 802499 802511 802523 802531 802573 802583 802589 802597 802603 
-802609 802643 802649 802651 802661 802667 802709 802721 802729 802733 802751 802759 
-802777 802783 802787 802793 802799 802811 802829 802831 802873 802909 802913 802933 
-802951 802969 802979 802987 803027 803041 803053 803057 803059 803087 803093 803119 
-803141 803171 803189 803207 803227 803237 803251 803269 803273 803287 803311 803323 
-803333 803347 803359 803389 803393 803399 803417 803441 803443 803447 803449 803461 
-803479 803483 803497 803501 803513 803519 803549 803587 803591 803609 803611 803623 
-803629 803651 803659 803669 803687 803717 803729 803731 803741 803749 803813 803819 
-803849 803857 803867 803893 803897 803911 803921 803927 803939 803963 803977 803987 
-803989 804007 804017 804031 804043 804059 804073 804077 804091 804107 804113 804119 
-804127 804157 804161 804179 804191 804197 804203 804211 804239 804259 804281 804283 
-804313 804317 804329 804337 804341 804367 804371 804383 804409 804443 804449 804473 
-804493 804497 804511 804521 804523 804541 804553 804571 804577 804581 804589 804607 
-804611 804613 804619 804653 804689 804697 804703 804709 804743 804751 804757 804761 
-804767 804803 804823 804829 804833 804847 804857 804877 804889 804893 804901 804913 
-804919 804929 804941 804943 804983 804989 804997 805019 805027 805031 805033 805037 
-805061 805067 805073 805081 805097 805099 805109 805111 805121 805153 805159 805177 
-805187 805213 805219 805223 805241 805249 805267 805271 805279 805289 805297 805309 
-805313 805327 805331 805333 805339 805369 805381 805397 805403 805421 805451 805463 
-805471 805487 805499 805501 805507 805517 805523 805531 805537 805559 805573 805583 
-805589 805633 805639 805687 805703 805711 805723 805729 805741 805757 805789 805799 
-805807 805811 805843 805853 805859 805867 805873 805877 805891 805901 805913 805933 
-805967 805991 806009 806011 806017 806023 806027 806033 806041 806051 806059 806087 
-806107 806111 806129 806137 806153 806159 806177 806203 806213 806233 806257 806261 
-806263 806269 806291 806297 806317 806329 806363 806369 806371 806381 806383 806389 
-806447 806453 806467 806483 806503 806513 806521 806543 806549 806579 806581 806609 
-806639 806657 806671 806719 806737 806761 806783 806789 806791 806801 806807 806821 
-806857 806893 806903 806917 806929 806941 806947 806951 806977 806999 807011 807017 
-807071 807077 807083 807089 807097 807113 807119 807127 807151 807181 807187 807193 
-807197 807203 807217 807221 807241 807251 807259 807281 807299 807337 807371 807379 
-807383 807403 807407 807409 807419 807427 807463 807473 807479 807487 807491 807493 
-807509 807511 807523 807539 807559 807571 807607 807613 807629 807637 807647 807689 
-807707 807731 807733 807749 807757 807787 807797 807809 807817 807869 807871 807901 
-807907 807923 807931 807941 807943 807949 807973 807997 808019 808021 808039 808081 
-808097 808111 808147 808153 808169 808177 808187 808211 808217 808229 808237 808261 
-808267 808307 808309 808343 808349 808351 808361 808363 808369 808373 808391 808399 
-808417 808421 808439 808441 808459 808481 808517 808523 808553 808559 808579 808589 
-808597 808601 808603 808627 808637 808651 808679 808681 808693 808699 808721 808733 
-808739 808747 808751 808771 808777 808789 808793 808837 808853 808867 808919 808937 
-808957 808961 808981 808991 808993 809023 809041 809051 809063 809087 809093 809101 
-809141 809143 809147 809173 809177 809189 809201 809203 809213 809231 809239 809243 
-809261 809269 809273 809297 809309 809323 809339 809357 809359 809377 809383 809399 
-809401 809407 809423 809437 809443 809447 809453 809461 809491 809507 809521 809527 
-809563 809569 809579 809581 809587 809603 809629 809701 809707 809719 809729 809737 
-809741 809747 809749 809759 809771 809779 809797 809801 809803 809821 809827 809833 
-809839 809843 809869 809891 809903 809909 809917 809929 809981 809983 809993 810013 
-810023 810049 810053 810059 810071 810079 810091 810109 810137 810149 810151 810191 
-810193 810209 810223 810239 810253 810259 810269 810281 810307 810319 810343 810349 
-810353 810361 810367 810377 810379 810389 810391 810401 810409 810419 810427 810437 
-810443 810457 810473 810487 810493 810503 810517 810533 810539 810541 810547 810553 
-810571 810581 810583 810587 810643 810653 810659 810671 810697 810737 810757 810763 
-810769 810791 810809 810839 810853 810871 810881 810893 810907 810913 810923 810941 
-810949 810961 810967 810973 810989 811037 811039 811067 811081 811099 811123 811127 
-811147 811157 811163 811171 811183 811193 811199 811207 811231 811241 811253 811259 
-811273 811277 811289 811297 811337 811351 811379 811387 811411 811429 811441 811457 
-811469 811493 811501 811511 811519 811523 811553 811561 811583 811607 811619 811627 
-811637 811649 811651 811667 811691 811697 811703 811709 811729 811747 811753 811757 
-811763 811771 811777 811799 811819 811861 811871 811879 811897 811919 811931 811933 
-811957 811961 811981 811991 811997 812011 812033 812047 812051 812057 812081 812101 
-812129 812137 812167 812173 812179 812183 812191 812213 812221 812233 812249 812257 
-812267 812281 812297 812299 812309 812341 812347 812351 812353 812359 812363 812381 
-812387 812393 812401 812431 812443 812467 812473 812477 812491 812501 812503 812519 
-812527 812587 812597 812599 812627 812633 812639 812641 812671 812681 812689 812699 
-812701 812711 812717 812731 812759 812761 812807 812849 812857 812869 812921 812939 
-812963 812969 813013 813017 813023 813041 813049 813061 813083 813089 813091 813097 
-813107 813121 813133 813157 813167 813199 813203 813209 813217 813221 813227 813251 
-813269 813277 813283 813287 813299 813301 813311 813343 813361 813367 813377 813383 
-813401 813419 813427 813443 813493 813499 813503 813511 813529 813541 813559 813577 
-813583 813601 813613 813623 813647 813677 813697 813707 813721 813749 813767 813797 
-813811 813817 813829 813833 813847 813863 813871 813893 813907 813931 813961 813971 
-813991 813997 814003 814007 814013 814019 814031 814043 814049 814061 814063 814067 
-814069 814081 814097 814127 814129 814139 814171 814183 814193 814199 814211 814213 
-814237 814241 814243 814279 814309 814327 814337 814367 814379 814381 814393 814399 
-814403 814423 814447 814469 814477 814493 814501 814531 814537 814543 814559 814577 
-814579 814601 814603 814609 814631 814633 814643 814687 814699 814717 814741 814747 
-814763 814771 814783 814789 814799 814823 814829 814841 814859 814873 814883 814889 
-814901 814903 814927 814937 814939 814943 814949 814991 815029 815033 815047 815053 
-815063 815123 815141 815149 815159 815173 815197 815209 815231 815251 815257 815261 
-815273 815279 815291 815317 815333 815341 815351 815389 815401 815411 815413 815417 
-815431 815453 815459 815471 815491 815501 815519 815527 815533 815539 815543 815569 
-815587 815599 815621 815623 815627 815653 815663 815669 815671 815681 815687 815693 
-815713 815729 815809 815819 815821 815831 815851 815869 815891 815897 815923 815933 
-815939 815953 815963 815977 815989 816019 816037 816043 816047 816077 816091 816103 
-816113 816121 816131 816133 816157 816161 816163 816169 816191 816203 816209 816217 
-816223 816227 816239 816251 816271 816317 816329 816341 816353 816367 816377 816401 
-816427 816443 816451 816469 816499 816521 816539 816547 816559 816581 816587 816589 
-816593 816649 816653 816667 816689 816691 816703 816709 816743 816763 816769 816779 
-816811 816817 816821 816839 816841 816847 816857 816859 816869 816883 816887 816899 
-816911 816917 816919 816929 816941 816947 816961 816971 817013 817027 817039 817049 
-817051 817073 817081 817087 817093 817111 817123 817127 817147 817151 817153 817163 
-817169 817183 817211 817237 817273 817277 817279 817291 817303 817319 817321 817331 
-817337 817357 817379 817403 817409 817433 817457 817463 817483 817519 817529 817549 
-817561 817567 817603 817637 817651 817669 817679 817697 817709 817711 817721 817723 
-817727 817757 817769 817777 817783 817787 817793 817823 817837 817841 817867 817871 
-817877 817889 817891 817897 817907 817913 817919 817933 817951 817979 817987 818011 
-818017 818021 818093 818099 818101 818113 818123 818143 818171 818173 818189 818219 
-818231 818239 818249 818281 818287 818291 818303 818309 818327 818339 818341 818347 
-818353 818359 818371 818383 818393 818399 818413 818429 818453 818473 818509 818561 
-818569 818579 818581 818603 818621 818659 818683 818687 818689 818707 818717 818723 
-818813 818819 818821 818827 818837 818887 818897 818947 818959 818963 818969 818977 
-818999 819001 819017 819029 819031 819037 819061 819073 819083 819101 819131 819149 
-819157 819167 819173 819187 819229 819239 819241 819251 819253 819263 819271 819289 
-819307 819311 819317 819319 819367 819373 819389 819391 819407 819409 819419 819431 
-819437 819443 819449 819457 819463 819473 819487 819491 819493 819499 819503 819509 
-819523 819563 819583 819593 819607 819617 819619 819629 819647 819653 819659 819673 
-819691 819701 819719 819737 819739 819761 819769 819773 819781 819787 819799 819811 
-819823 819827 819829 819853 819899 819911 819913 819937 819943 819977 819989 819991 
-820037 820051 820067 820073 820093 820109 820117 820129 820133 820163 820177 820187 
-820201 820213 820223 820231 820241 820243 820247 820271 820273 820279 820319 820321 
-820331 820333 820343 820349 820361 820367 820399 820409 820411 820427 820429 820441 
-820459 820481 820489 820537 820541 820559 820577 820597 820609 820619 820627 820637 
-820643 820649 820657 820679 820681 820691 820711 820723 820733 820747 820753 820759 
-820763 820789 820793 820837 820873 820891 820901 820907 820909 820921 820927 820957 
-820969 820991 820997 821003 821027 821039 821053 821057 821063 821069 821081 821089 
-821099 821101 821113 821131 821143 821147 821153 821167 821173 821207 821209 821263 
-821281 821291 821297 821311 821329 821333 821377 821383 821411 821441 821449 821459 
-821461 821467 821477 821479 821489 821497 821507 821519 821551 821573 821603 821641 
-821647 821651 821663 821677 821741 821747 821753 821759 821771 821801 821803 821809 
-821819 821827 821833 821851 821857 821861 821869 821879 821897 821911 821939 821941 
-821971 821993 821999 822007 822011 822013 822037 822049 822067 822079 822113 822131 
-822139 822161 822163 822167 822169 822191 822197 822221 822223 822229 822233 822253 
-822259 822277 822293 822299 822313 822317 822323 822329 822343 822347 822361 822379 
-822383 822389 822391 822407 822431 822433 822517 822539 822541 822551 822553 822557 
-822571 822581 822587 822589 822599 822607 822611 822631 822667 822671 822673 822683 
-822691 822697 822713 822721 822727 822739 822743 822761 822763 822781 822791 822793 
-822803 822821 822823 822839 822853 822881 822883 822889 822893 822901 822907 822949 
-822971 822973 822989 823001 823003 823013 823033 823051 823117 823127 823129 823153 
-823169 823177 823183 823201 823219 823231 823237 823241 823243 823261 823271 823283 
-823309 823337 823349 823351 823357 823373 823399 823421 823447 823451 823457 823481 
-823483 823489 823499 823519 823541 823547 823553 823573 823591 823601 823619 823621 
-823637 823643 823651 823663 823679 823703 823709 823717 823721 823723 823727 823729 
-823741 823747 823759 823777 823787 823789 823799 823819 823829 823831 823841 823843 
-823877 823903 823913 823961 823967 823969 823981 823993 823997 824017 824029 824039 
-824063 824069 824077 824081 824099 824123 824137 824147 824179 824183 824189 824191 
-824227 824231 824233 824269 824281 824287 824339 824393 824399 824401 824413 824419 
-824437 824443 824459 824477 824489 824497 824501 824513 824531 824539 824563 824591 
-824609 824641 824647 824651 824669 824671 824683 824699 824701 824723 824741 824749 
-824753 824773 824777 824779 824801 824821 824833 824843 824861 824893 824899 824911 
-824921 824933 824939 824947 824951 824977 824981 824983 825001 825007 825017 825029 
-825047 825049 825059 825067 825073 825101 825107 825109 825131 825161 825191 825193 
-825199 825203 825229 825241 825247 825259 825277 825281 825283 825287 825301 825329 
-825337 825343 825347 825353 825361 825389 825397 825403 825413 825421 825439 825443 
-825467 825479 825491 825509 825527 825533 825547 825551 825553 825577 825593 825611 
-825613 825637 825647 825661 825679 825689 825697 825701 825709 825733 825739 825749 
-825763 825779 825791 825821 825827 825829 825857 825883 825889 825919 825947 825959 
-825961 825971 825983 825991 825997 826019 826037 826039 826051 826061 826069 826087 
-826093 826097 826129 826151 826153 826169 826171 826193 826201 826211 826271 826283 
-826289 826303 826313 826333 826339 826349 826351 826363 826379 826381 826391 826393 
-826403 826411 826453 826477 826493 826499 826541 826549 826559 826561 826571 826583 
-826603 826607 826613 826621 826663 826667 826669 826673 826681 826697 826699 826711 
-826717 826723 826729 826753 826759 826783 826799 826807 826811 826831 826849 826867 
-826879 826883 826907 826921 826927 826939 826957 826963 826967 826979 826997 827009 
-827023 827039 827041 827063 827087 827129 827131 827143 827147 827161 827213 827227 
-827231 827251 827269 827293 827303 827311 827327 827347 827369 827389 827417 827423 
-827429 827443 827447 827461 827473 827501 827521 827537 827539 827549 827581 827591 
-827599 827633 827639 827677 827681 827693 827699 827719 827737 827741 827767 827779 
-827791 827803 827809 827821 827833 827837 827843 827851 827857 827867 827873 827899 
-827903 827923 827927 827929 827941 827969 827987 827989 828007 828011 828013 828029 
-828043 828059 828067 828071 828101 828109 828119 828127 828131 828133 828169 828199 
-828209 828221 828239 828277 828349 828361 828371 828379 828383 828397 828407 828409 
-828431 828449 828517 828523 828547 828557 828577 828587 828601 828637 828643 828649 
-828673 828677 828691 828697 828701 828703 828721 828731 828743 828757 828787 828797 
-828809 828811 828823 828829 828833 828859 828871 828881 828889 828899 828901 828917 
-828923 828941 828953 828967 828977 829001 829013 829057 829063 829069 829093 829097 
-829111 829121 829123 829151 829159 829177 829187 829193 829211 829223 829229 829237 
-829249 829267 829273 829289 829319 829349 829399 829453 829457 829463 829469 829501 
-829511 829519 829537 829547 829561 829601 829613 829627 829637 829639 829643 829657 
-829687 829693 829709 829721 829723 829727 829729 829733 829757 829789 829811 829813 
-829819 829831 829841 829847 829849 829867 829877 829883 829949 829967 829979 829987 
-829993 830003 830017 830041 830051 830099 830111 830117 830131 830143 830153 830173 
-830177 830191 830233 830237 830257 830267 830279 830293 830309 830311 830327 830329 
-830339 830341 830353 830359 830363 830383 830387 830411 830413 830419 830441 830447 
-830449 830477 830483 830497 830503 830513 830549 830551 830561 830567 830579 830587 
-830591 830597 830617 830639 830657 830677 830693 830719 830729 830741 830743 830777 
-830789 830801 830827 830833 830839 830849 830861 830873 830887 830891 830899 830911 
-830923 830939 830957 830981 830989 831023 831031 831037 831043 831067 831071 831073 
-831091 831109 831139 831161 831163 831167 831191 831217 831221 831239 831253 831287 
-831301 831323 831329 831361 831367 831371 831373 831407 831409 831431 831433 831437 
-831443 831461 831503 831529 831539 831541 831547 831553 831559 831583 831587 831599 
-831617 831619 831631 831643 831647 831653 831659 831661 831679 831683 831697 831707 
-831709 831713 831731 831739 831751 831757 831769 831781 831799 831811 831821 831829 
-831847 831851 831863 831881 831889 831893 831899 831911 831913 831917 831967 831983 
-832003 832063 832079 832081 832103 832109 832121 832123 832129 832141 832151 832157 
-832159 832189 832211 832217 832253 832291 832297 832309 832327 832331 832339 832361 
-832367 832369 832373 832379 832399 832411 832421 832427 832451 832457 832477 832483 
-832487 832493 832499 832519 832583 832591 832597 832607 832613 832621 832627 832631 
-832633 832639 832673 832679 832681 832687 832693 832703 832709 832717 832721 832729 
-832747 832757 832763 832771 832787 832801 832837 832841 832861 832879 832883 832889 
-832913 832919 832927 832933 832943 832957 832963 832969 832973 832987 833009 833023 
-833033 833047 833057 833099 833101 833117 833171 833177 833179 833191 833197 833201 
-833219 833251 833269 833281 833293 833299 833309 833347 833353 833363 833377 833389 
-833429 833449 833453 833461 833467 833477 833479 833491 833509 833537 833557 833563 
-833593 833597 833617 833633 833659 833669 833689 833711 833713 833717 833719 833737 
-833747 833759 833783 833801 833821 833839 833843 833857 833873 833887 833893 833897 
-833923 833927 833933 833947 833977 833999 834007 834013 834023 834059 834107 834131 
-834133 834137 834143 834149 834151 834181 834199 834221 834257 834259 834269 834277 
-834283 834287 834299 834311 834341 834367 834433 834439 834469 834487 834497 834503 
-834511 834523 834527 834569 834571 834593 834599 834607 834611 834623 834629 834641 
-834643 834653 834671 834703 834709 834721 834761 834773 834781 834787 834797 834809 
-834811 834829 834857 834859 834893 834913 834941 834947 834949 834959 834961 834983 
-834991 835001 835013 835019 835033 835039 835097 835099 835117 835123 835139 835141 
-835207 835213 835217 835249 835253 835271 835313 835319 835321 835327 835369 835379 
-835391 835399 835421 835427 835441 835451 835453 835459 835469 835489 835511 835531 
-835553 835559 835591 835603 835607 835609 835633 835643 835661 835663 835673 835687 
-835717 835721 835733 835739 835759 835789 835811 835817 835819 835823 835831 835841 
-835847 835859 835897 835909 835927 835931 835937 835951 835957 835973 835979 835987 
-835993 835997 836047 836063 836071 836107 836117 836131 836137 836149 836153 836159 
-836161 836183 836189 836191 836203 836219 836233 836239 836243 836267 836291 836299 
-836317 836327 836347 836351 836369 836377 836387 836413 836449 836471 836477 836491 
-836497 836501 836509 836567 836569 836573 836609 836611 836623 836657 836663 836677 
-836683 836699 836701 836707 836713 836729 836747 836749 836753 836761 836789 836807 
-836821 836833 836839 836861 836863 836873 836879 836881 836917 836921 836939 836951 
-836971 837017 837043 837047 837059 837071 837073 837077 837079 837107 837113 837139 
-837149 837157 837191 837203 837257 837271 837283 837293 837307 837313 837359 837367 
-837373 837377 837379 837409 837413 837439 837451 837461 837467 837497 837503 837509 
-837521 837533 837583 837601 837611 837619 837631 837659 837667 837673 837677 837679 
-837721 837731 837737 837773 837779 837797 837817 837833 837847 837853 837887 837923 
-837929 837931 837937 837943 837979 838003 838021 838037 838039 838043 838063 838069 
-838091 838093 838099 838133 838139 838141 838153 838157 838169 838171 838193 838207 
-838247 838249 838349 838351 838363 838367 838379 838391 838393 838399 838403 838421 
-838429 838441 838447 838459 838463 838471 838483 838517 838547 838553 838561 838571 
-838583 838589 838597 838601 838609 838613 838631 838633 838657 838667 838687 838693 
-838711 838751 838757 838769 838771 838777 838781 838807 838813 838837 838853 838889 
-838897 838909 838913 838919 838927 838931 838939 838949 838951 838963 838969 838991 
-838993 839009 839029 839051 839071 839087 839117 839131 839161 839203 839207 839221 
-839227 839261 839269 839303 839323 839327 839351 839353 839369 839381 839413 839429 
-839437 839441 839453 839459 839471 839473 839483 839491 839497 839519 839539 839551 
-839563 839599 839603 839609 839611 839617 839621 839633 839651 839653 839669 839693 
-839723 839731 839767 839771 839791 839801 839809 839831 839837 839873 839879 839887 
-839897 839899 839903 839911 839921 839957 839959 839963 839981 839999 840023 840053 
-840061 840067 840083 840109 840137 840139 840149 840163 840179 840181 840187 840197 
-840223 840239 840241 840253 840269 840277 840289 840299 840319 840331 840341 840347 
-840353 840439 840451 840457 840467 840473 840479 840491 840523 840547 840557 840571 
-840589 840601 840611 840643 840661 840683 840703 840709 840713 840727 840733 840743 
-840757 840761 840767 840817 840821 840823 840839 840841 840859 840863 840907 840911 
-840923 840929 840941 840943 840967 840979 840989 840991 841003 841013 841019 841021 
-841063 841069 841079 841081 841091 841097 841103 841147 841157 841189 841193 841207 
-841213 841219 841223 841231 841237 841241 841259 841273 841277 841283 841289 841297 
-841307 841327 841333 841349 841369 841391 841397 841411 841427 841447 841457 841459 
-841541 841549 841559 841573 841597 841601 841637 841651 841661 841663 841691 841697 
-841727 841741 841751 841793 841801 841849 841859 841873 841879 841889 841913 841921 
-841927 841931 841933 841979 841987 842003 842021 842041 842047 842063 842071 842077 
-842081 842087 842089 842111 842113 842141 842147 842159 842161 842167 842173 842183 
-842203 842209 842249 842267 842279 842291 842293 842311 842321 842323 842339 842341 
-842351 842353 842371 842383 842393 842399 842407 842417 842419 842423 842447 842449 
-842473 842477 842483 842489 842497 842507 842519 842521 842531 842551 842581 842587 
-842599 842617 842623 842627 842657 842701 842729 842747 842759 842767 842771 842791 
-842801 842813 842819 842857 842869 842879 842887 842923 842939 842951 842957 842969 
-842977 842981 842987 842993 843043 843067 843079 843091 843103 843113 843127 843131 
-843137 843173 843179 843181 843209 843211 843229 843253 843257 843289 843299 843301 
-843307 843331 843347 843361 843371 843377 843379 843383 843397 843443 843449 843457 
-843461 843473 843487 843497 843503 843527 843539 843553 843559 843587 843589 843607 
-843613 843629 843643 843649 843677 843679 843701 843737 843757 843763 843779 843781 
-843793 843797 843811 843823 843833 843841 843881 843883 843889 843901 843907 843911 
-844001 844013 844043 844061 844069 844087 844093 844111 844117 844121 844127 844139 
-844141 844153 844157 844163 844183 844187 844199 844201 844243 844247 844253 844279 
-844289 844297 844309 844321 844351 844369 844421 844427 844429 844433 844439 844447 
-844453 844457 844463 844469 844483 844489 844499 844507 844511 844513 844517 844523 
-844549 844553 844601 844603 844609 844619 844621 844631 844639 844643 844651 844709 
-844717 844733 844757 844763 844769 844771 844777 844841 844847 844861 844867 844891 
-844897 844903 844913 844927 844957 844999 845003 845017 845021 845027 845041 845069 
-845083 845099 845111 845129 845137 845167 845179 845183 845197 845203 845209 845219 
-845231 845237 845261 845279 845287 845303 845309 845333 845347 845357 845363 845371 
-845381 845387 845431 845441 845447 845459 845489 845491 845531 845567 845599 845623 
-845653 845657 845659 845683 845717 845723 845729 845749 845753 845771 845777 845809 
-845833 845849 845863 845879 845881 845893 845909 845921 845927 845941 845951 845969 
-845981 845983 845987 845989 846037 846059 846061 846067 846113 846137 846149 846161 
-846179 846187 846217 846229 846233 846247 846259 846271 846323 846341 846343 846353 
-846359 846361 846383 846389 846397 846401 846403 846407 846421 846427 846437 846457 
-846487 846493 846499 846529 846563 846577 846589 846647 846661 846667 846673 846689 
-846721 846733 846739 846749 846751 846757 846779 846823 846841 846851 846869 846871 
-846877 846913 846917 846919 846931 846943 846949 846953 846961 846973 846977 846983 
-846997 847009 847031 847037 847043 847051 847069 847073 847079 847097 847103 847109 
-847129 847139 847151 847157 847163 847169 847193 847201 847213 847219 847237 847247 
-847271 847277 847279 847283 847309 847321 847339 847361 847367 847373 847393 847423 
-847453 847477 847493 847499 847507 847519 847531 847537 847543 847549 847577 847589 
-847601 847607 847621 847657 847663 847673 847681 847687 847697 847703 847727 847729 
-847741 847787 847789 847813 847817 847853 847871 847883 847901 847919 847933 847937 
-847949 847967 847969 847991 847993 847997 848017 848051 848087 848101 848119 848123 
-848131 848143 848149 848173 848201 848203 848213 848227 848251 848269 848273 848297 
-848321 848359 848363 848383 848387 848399 848417 848423 848429 848443 848461 848467 
-848473 848489 848531 848537 848557 848567 848579 848591 848593 848599 848611 848629 
-848633 848647 848651 848671 848681 848699 848707 848713 848737 848747 848761 848779 
-848789 848791 848797 848803 848807 848839 848843 848849 848851 848857 848879 848893 
-848909 848921 848923 848927 848933 848941 848959 848983 848993 849019 849047 849049 
-849061 849083 849097 849103 849119 849127 849131 849143 849161 849179 849197 849203 
-849217 849221 849223 849241 849253 849271 849301 849311 849347 849349 849353 849383 
-849391 849419 849427 849461 849467 849481 849523 849533 849539 849571 849581 849587 
-849593 849599 849601 849649 849691 849701 849703 849721 849727 849731 849733 849743 
-849763 849767 849773 849829 849833 849839 849857 849869 849883 849917 849923 849931 
-849943 849967 849973 849991 849997 850009 850021 850027 850033 850043 850049 850061 
-850063 850081 850093 850121 850133 850139 850147 850177 850181 850189 850207 850211 
-850229 850243 850247 850253 850261 850271 850273 850301 850303 850331 850337 850349 
-850351 850373 850387 850393 850397 850403 850417 850427 850433 850439 850453 850457 
-850481 850529 850537 850567 850571 850613 850631 850637 850673 850679 850691 850711 
-850727 850753 850781 850807 850823 850849 850853 850879 850891 850897 850933 850943 
-850951 850973 850979 851009 851017 851033 851041 851051 851057 851087 851093 851113 
-851117 851131 851153 851159 851171 851177 851197 851203 851209 851231 851239 851251 
-851261 851267 851273 851293 851297 851303 851321 851327 851351 851359 851363 851381 
-851387 851393 851401 851413 851419 851423 851449 851471 851491 851507 851519 851537 
-851549 851569 851573 851597 851603 851623 851633 851639 851647 851659 851671 851677 
-851689 851723 851731 851749 851761 851797 851801 851803 851813 851821 851831 851839 
-851843 851863 851881 851891 851899 851953 851957 851971 852011 852013 852031 852037 
-852079 852101 852121 852139 852143 852149 852151 852167 852179 852191 852197 852199 
-852211 852233 852239 852253 852259 852263 852287 852289 852301 852323 852347 852367 
-852391 852409 852427 852437 852457 852463 852521 852557 852559 852563 852569 852581 
-852583 852589 852613 852617 852623 852641 852661 852671 852673 852689 852749 852751 
-852757 852763 852769 852793 852799 852809 852827 852829 852833 852847 852851 852857 
-852871 852881 852889 852893 852913 852937 852953 852959 852989 852997 853007 853031 
-853033 853049 853057 853079 853091 853103 853123 853133 853159 853187 853189 853211 
-853217 853241 853283 853289 853291 853319 853339 853357 853387 853403 853427 853429 
-853439 853477 853481 853493 853529 853543 853547 853571 853577 853597 853637 853663 
-853667 853669 853687 853693 853703 853717 853733 853739 853759 853763 853793 853799 
-853807 853813 853819 853823 853837 853843 853873 853889 853901 853903 853913 853933 
-853949 853969 853981 853999 854017 854033 854039 854041 854047 854053 854083 854089 
-854093 854099 854111 854123 854129 854141 854149 854159 854171 854213 854257 854263 
-854299 854303 854323 854327 854333 854351 854353 854363 854383 854387 854407 854417 
-854419 854423 854431 854443 854459 854461 854467 854479 854527 854533 854569 854587 
-854593 854599 854617 854621 854629 854647 854683 854713 854729 854747 854771 854801 
-854807 854849 854869 854881 854897 854899 854921 854923 854927 854929 854951 854957 
-854963 854993 854999 855031 855059 855061 855067 855079 855089 855119 855131 855143 
-855187 855191 855199 855203 855221 855229 855241 855269 855271 855277 855293 855307 
-855311 855317 855331 855359 855373 855377 855391 855397 855401 855419 855427 855431 
-855461 855467 855499 855511 855521 855527 855581 855601 855607 855619 855641 855667 
-855671 855683 855697 855709 855713 855719 855721 855727 855731 855733 855737 855739 
-855781 855787 855821 855851 855857 855863 855887 855889 855901 855919 855923 855937 
-855947 855983 855989 855997 856021 856043 856057 856061 856073 856081 856099 856111 
-856117 856133 856139 856147 856153 856169 856181 856187 856213 856237 856241 856249 
-856277 856279 856301 856309 856333 856343 856351 856369 856381 856391 856393 856411 
-856417 856421 856441 856459 856469 856483 856487 856507 856519 856529 856547 856549 
-856553 856567 856571 856627 856637 856649 856693 856697 856699 856703 856711 856717 
-856721 856733 856759 856787 856789 856799 856811 856813 856831 856841 856847 856853 
-856897 856901 856903 856909 856927 856939 856943 856949 856969 856993 857009 857011 
-857027 857029 857039 857047 857053 857069 857081 857083 857099 857107 857137 857161 
-857167 857201 857203 857221 857249 857267 857273 857281 857287 857309 857321 857333 
-857341 857347 857357 857369 857407 857411 857419 857431 857453 857459 857471 857513 
-857539 857551 857567 857569 857573 857579 857581 857629 857653 857663 857669 857671 
-857687 857707 857711 857713 857723 857737 857741 857743 857749 857809 857821 857827 
-857839 857851 857867 857873 857897 857903 857929 857951 857953 857957 857959 857963 
-857977 857981 858001 858029 858043 858073 858083 858101 858103 858113 858127 858149 
-858161 858167 858217 858223 858233 858239 858241 858251 858259 858269 858281 858293 
-858301 858307 858311 858317 858373 858397 858427 858433 858457 858463 858467 858479 
-858497 858503 858527 858563 858577 858589 858623 858631 858673 858691 858701 858707 
-858709 858713 858749 858757 858763 858769 858787 858817 858821 858833 858841 858859 
-858877 858883 858899 858911 858919 858931 858943 858953 858961 858989 858997 859003 
-859031 859037 859049 859051 859057 859081 859091 859093 859109 859121 859181 859189 
-859213 859223 859249 859259 859267 859273 859277 859279 859297 859321 859361 859363 
-859373 859381 859393 859423 859433 859447 859459 859477 859493 859513 859553 859559 
-859561 859567 859577 859601 859603 859609 859619 859633 859657 859667 859669 859679 
-859681 859697 859709 859751 859783 859787 859799 859801 859823 859841 859849 859853 
-859861 859891 859913 859919 859927 859933 859939 859973 859981 859987 860009 860011 
-860029 860051 860059 860063 860071 860077 860087 860089 860107 860113 860117 860143 
-860239 860257 860267 860291 860297 860309 860311 860317 860323 860333 860341 860351 
-860357 860369 860381 860383 860393 860399 860413 860417 860423 860441 860479 860501 
-860507 860513 860533 860543 860569 860579 860581 860593 860599 860609 860623 860641 
-860647 860663 860689 860701 860747 860753 860759 860779 860789 860791 860809 860813 
-860819 860843 860861 860887 860891 860911 860917 860921 860927 860929 860939 860941 
-860957 860969 860971 861001 861013 861019 861031 861037 861043 861053 861059 861079 
-861083 861089 861109 861121 861131 861139 861163 861167 861191 861199 861221 861239 
-861293 861299 861317 861347 861353 861361 861391 861433 861437 861439 861491 861493 
-861499 861541 861547 861551 861559 861563 861571 861589 861599 861613 861617 861647 
-861659 861691 861701 861703 861719 861733 861739 861743 861761 861797 861799 861803 
-861823 861829 861853 861857 861871 861877 861881 861899 861901 861907 861929 861937 
-861941 861947 861977 861979 861997 862009 862013 862031 862033 862061 862067 862097 
-862117 862123 862129 862139 862157 862159 862171 862177 862181 862187 862207 862219 
-862229 862231 862241 862249 862259 862261 862273 862283 862289 862297 862307 862319 
-862331 862343 862369 862387 862397 862399 862409 862417 862423 862441 862447 862471 
-862481 862483 862487 862493 862501 862541 862553 862559 862567 862571 862573 862583 
-862607 862627 862633 862649 862651 862669 862703 862727 862739 862769 862777 862783 
-862789 862811 862819 862861 862879 862907 862909 862913 862919 862921 862943 862957 
-862973 862987 862991 862997 863003 863017 863047 863081 863087 863119 863123 863131 
-863143 863153 863179 863197 863231 863251 863279 863287 863299 863309 863323 863363 
-863377 863393 863479 863491 863497 863509 863521 863537 863539 863561 863593 863609 
-863633 863641 863671 863689 863693 863711 863729 863743 863749 863767 863771 863783 
-863801 863803 863833 863843 863851 863867 863869 863879 863887 863897 863899 863909 
-863917 863921 863959 863983 864007 864011 864013 864029 864037 864047 864049 864053 
-864077 864079 864091 864103 864107 864119 864121 864131 864137 864151 864167 864169 
-864191 864203 864211 864221 864223 864251 864277 864289 864299 864301 864307 864319 
-864323 864341 864359 864361 864379 864407 864419 864427 864439 864449 864491 864503 
-864509 864511 864533 864541 864551 864581 864583 864587 864613 864623 864629 864631 
-864641 864673 864679 864691 864707 864733 864737 864757 864781 864793 864803 864811 
-864817 864883 864887 864901 864911 864917 864947 864953 864959 864967 864979 864989 
-865001 865003 865043 865049 865057 865061 865069 865087 865091 865103 865121 865153 
-865159 865177 865201 865211 865213 865217 865231 865247 865253 865259 865261 865301 
-865307 865313 865321 865327 865339 865343 865349 865357 865363 865379 865409 865457 
-865477 865481 865483 865493 865499 865511 865537 865577 865591 865597 865609 865619 
-865637 865639 865643 865661 865681 865687 865717 865721 865729 865741 865747 865751 
-865757 865769 865771 865783 865801 865807 865817 865819 865829 865847 865859 865867 
-865871 865877 865889 865933 865937 865957 865979 865993 866003 866009 866011 866029 
-866051 866053 866057 866081 866083 866087 866093 866101 866119 866123 866161 866183 
-866197 866213 866221 866231 866279 866293 866309 866311 866329 866353 866389 866399 
-866417 866431 866443 866461 866471 866477 866513 866519 866573 866581 866623 866629 
-866639 866641 866653 866683 866689 866693 866707 866713 866717 866737 866743 866759 
-866777 866783 866819 866843 866849 866851 866857 866869 866909 866917 866927 866933 
-866941 866953 866963 866969 867001 867007 867011 867023 867037 867059 867067 867079 
-867091 867121 867131 867143 867151 867161 867173 867203 867211 867227 867233 867253 
-867257 867259 867263 867271 867281 867301 867319 867337 867343 867371 867389 867397 
-867401 867409 867413 867431 867443 867457 867463 867467 867487 867509 867511 867541 
-867547 867553 867563 867571 867577 867589 867617 867619 867623 867631 867641 867653 
-867677 867679 867689 867701 867719 867733 867743 867773 867781 867793 867803 867817 
-867827 867829 867857 867871 867887 867913 867943 867947 867959 867991 868019 868033 
-868039 868051 868069 868073 868081 868103 868111 868121 868123 868151 868157 868171 
-868177 868199 868211 868229 868249 868267 868271 868277 868291 868313 868327 868331 
-868337 868349 868369 868379 868381 868397 868409 868423 868451 868453 868459 868487 
-868489 868493 868529 868531 868537 868559 868561 868577 868583 868603 868613 868639 
-868663 868669 868691 868697 868727 868739 868741 868771 868783 868787 868793 868799 
-868801 868817 868841 868849 868867 868873 868877 868883 868891 868909 868937 868939 
-868943 868951 868957 868993 868997 868999 869017 869021 869039 869053 869059 869069 
-869081 869119 869131 869137 869153 869173 869179 869203 869233 869249 869251 869257 
-869273 869291 869293 869299 869303 869317 869321 869339 869369 869371 869381 869399 
-869413 869419 869437 869443 869461 869467 869471 869489 869501 869521 869543 869551 
-869563 869579 869587 869597 869599 869657 869663 869683 869689 869707 869717 869747 
-869753 869773 869777 869779 869807 869809 869819 869849 869863 869879 869887 869893 
-869899 869909 869927 869951 869959 869983 869989 870007 870013 870031 870047 870049 
-870059 870083 870097 870109 870127 870131 870137 870151 870161 870169 870173 870197 
-870211 870223 870229 870239 870241 870253 870271 870283 870301 870323 870329 870341 
-870367 870391 870403 870407 870413 870431 870433 870437 870461 870479 870491 870497 
-870517 870533 870547 870577 870589 870593 870601 870613 870629 870641 870643 870679 
-870691 870703 870731 870739 870743 870773 870787 870809 870811 870823 870833 870847 
-870853 870871 870889 870901 870907 870911 870917 870929 870931 870953 870967 870977 
-870983 870997 871001 871021 871027 871037 871061 871103 871147 871159 871163 871177 
-871181 871229 871231 871249 871259 871271 871289 871303 871337 871349 871393 871439 
-871459 871463 871477 871513 871517 871531 871553 871571 871589 871597 871613 871621 
-871639 871643 871649 871657 871679 871681 871687 871727 871763 871771 871789 871817 
-871823 871837 871867 871883 871901 871919 871931 871957 871963 871973 871987 871993 
-872017 872023 872033 872041 872057 872071 872077 872089 872099 872107 872129 872141 
-872143 872149 872159 872161 872173 872177 872189 872203 872227 872231 872237 872243 
-872251 872257 872269 872281 872317 872323 872351 872353 872369 872381 872383 872387 
-872393 872411 872419 872429 872437 872441 872453 872471 872477 872479 872533 872549 
-872561 872563 872567 872587 872609 872611 872621 872623 872647 872657 872659 872671 
-872687 872731 872737 872747 872749 872761 872789 872791 872843 872863 872923 872947 
-872951 872953 872959 872999 873017 873043 873049 873073 873079 873083 873091 873109 
-873113 873121 873133 873139 873157 873209 873247 873251 873263 873293 873317 873319 
-873331 873343 873349 873359 873403 873407 873419 873421 873427 873437 873461 873463 
-873469 873497 873527 873529 873539 873541 873553 873569 873571 873617 873619 873641 
-873643 873659 873667 873671 873689 873707 873709 873721 873727 873739 873767 873773 
-873781 873787 873863 873877 873913 873959 873979 873989 873991 874001 874009 874037 
-874063 874087 874091 874099 874103 874109 874117 874121 874127 874151 874193 874213 
-874217 874229 874249 874267 874271 874277 874301 874303 874331 874337 874343 874351 
-874373 874387 874397 874403 874409 874427 874457 874459 874477 874487 874537 874543 
-874547 874567 874583 874597 874619 874637 874639 874651 874661 874673 874681 874693 
-874697 874711 874721 874723 874729 874739 874763 874771 874777 874799 874807 874813 
-874823 874831 874847 874859 874873 874879 874889 874891 874919 874957 874967 874987 
-875011 875027 875033 875089 875107 875113 875117 875129 875141 875183 875201 875209 
-875213 875233 875239 875243 875261 875263 875267 875269 875297 875299 875317 875323 
-875327 875333 875339 875341 875363 875377 875389 875393 875417 875419 875429 875443 
-875447 875477 875491 875503 875509 875513 875519 875521 875543 875579 875591 875593 
-875617 875621 875627 875629 875647 875659 875663 875681 875683 875689 875701 875711 
-875717 875731 875741 875759 875761 875773 875779 875783 875803 875821 875837 875851 
-875893 875923 875929 875933 875947 875969 875981 875983 876011 876013 876017 876019 
-876023 876041 876067 876077 876079 876097 876103 876107 876121 876131 876137 876149 
-876181 876191 876193 876199 876203 876229 876233 876257 876263 876287 876301 876307 
-876311 876329 876331 876341 876349 876371 876373 876431 876433 876443 876479 876481 
-876497 876523 876529 876569 876581 876593 876607 876611 876619 876643 876647 876653 
-876661 876677 876719 876721 876731 876749 876751 876761 876769 876787 876791 876797 
-876817 876823 876833 876851 876853 876871 876893 876913 876929 876947 876971 877003 
-877027 877043 877057 877073 877091 877109 877111 877117 877133 877169 877181 877187 
-877199 877213 877223 877237 877267 877291 877297 877301 877313 877321 877333 877343 
-877351 877361 877367 877379 877397 877399 877403 877411 877423 877463 877469 877531 
-877543 877567 877573 877577 877601 877609 877619 877621 877651 877661 877699 877739 
-877771 877783 877817 877823 877837 877843 877853 877867 877871 877873 877879 877883 
-877907 877909 877937 877939 877949 877997 878011 878021 878023 878039 878041 878077 
-878083 878089 878099 878107 878113 878131 878147 878153 878159 878167 878173 878183 
-878191 878197 878201 878221 878239 878279 878287 878291 878299 878309 878359 878377 
-878387 878411 878413 878419 878443 878453 878467 878489 878513 878539 878551 878567 
-878573 878593 878597 878609 878621 878629 878641 878651 878659 878663 878677 878681 
-878699 878719 878737 878743 878749 878777 878783 878789 878797 878821 878831 878833 
-878837 878851 878863 878869 878873 878893 878929 878939 878953 878957 878987 878989 
-879001 879007 879023 879031 879061 879089 879097 879103 879113 879119 879133 879143 
-879167 879169 879181 879199 879227 879239 879247 879259 879269 879271 879283 879287 
-879299 879331 879341 879343 879353 879371 879391 879401 879413 879449 879457 879493 
-879523 879533 879539 879553 879581 879583 879607 879617 879623 879629 879649 879653 
-879661 879667 879673 879679 879689 879691 879701 879707 879709 879713 879721 879743 
-879797 879799 879817 879821 879839 879859 879863 879881 879917 879919 879941 879953 
-879961 879973 879979 880001 880007 880021 880027 880031 880043 880057 880067 880069 
-880091 880097 880109 880127 880133 880151 880153 880199 880211 880219 880223 880247 
-880249 880259 880283 880301 880303 880331 880337 880343 880349 880361 880367 880409 
-880421 880423 880427 880483 880487 880513 880519 880531 880541 880543 880553 880559 
-880571 880573 880589 880603 880661 880667 880673 880681 880687 880699 880703 880709 
-880723 880727 880729 880751 880793 880799 880801 880813 880819 880823 880853 880861 
-880871 880883 880903 880907 880909 880939 880949 880951 880961 880981 880993 881003 
-881009 881017 881029 881057 881071 881077 881099 881119 881141 881143 881147 881159 
-881171 881173 881191 881197 881207 881219 881233 881249 881269 881273 881311 881317 
-881327 881333 881351 881357 881369 881393 881407 881411 881417 881437 881449 881471 
-881473 881477 881479 881509 881527 881533 881537 881539 881591 881597 881611 881641 
-881663 881669 881681 881707 881711 881729 881743 881779 881813 881833 881849 881897 
-881899 881911 881917 881939 881953 881963 881983 881987 882017 882019 882029 882031 
-882047 882061 882067 882071 882083 882103 882139 882157 882169 882173 882179 882187 
-882199 882239 882241 882247 882251 882253 882263 882289 882313 882359 882367 882377 
-882389 882391 882433 882439 882449 882451 882461 882481 882491 882517 882529 882551 
-882571 882577 882587 882593 882599 882617 882631 882653 882659 882697 882701 882703 
-882719 882727 882733 882751 882773 882779 882823 882851 882863 882877 882881 882883 
-882907 882913 882923 882943 882953 882961 882967 882979 883013 883049 883061 883073 
-883087 883093 883109 883111 883117 883121 883163 883187 883193 883213 883217 883229 
-883231 883237 883241 883247 883249 883273 883279 883307 883327 883331 883339 883343 
-883357 883391 883397 883409 883411 883423 883429 883433 883451 883471 883483 883489 
-883517 883537 883549 883577 883579 883613 883621 883627 883639 883661 883667 883691 
-883697 883699 883703 883721 883733 883739 883763 883777 883781 883783 883807 883871 
-883877 883889 883921 883933 883963 883969 883973 883979 883991 884003 884011 884029 
-884057 884069 884077 884087 884111 884129 884131 884159 884167 884171 884183 884201 
-884227 884231 884243 884251 884267 884269 884287 884293 884309 884311 884321 884341 
-884353 884363 884369 884371 884417 884423 884437 884441 884453 884483 884489 884491 
-884497 884501 884537 884573 884579 884591 884593 884617 884651 884669 884693 884699 
-884717 884743 884789 884791 884803 884813 884827 884831 884857 884881 884899 884921 
-884951 884959 884977 884981 884987 884999 885023 885041 885061 885083 885091 885097 
-885103 885107 885127 885133 885161 885163 885169 885187 885217 885223 885233 885239 
-885251 885257 885263 885289 885301 885307 885331 885359 885371 885383 885389 885397 
-885403 885421 885427 885449 885473 885487 885497 885503 885509 885517 885529 885551 
-885553 885589 885607 885611 885623 885679 885713 885721 885727 885733 885737 885769 
-885791 885793 885803 885811 885821 885823 885839 885869 885881 885883 885889 885893 
-885919 885923 885931 885943 885947 885959 885961 885967 885971 885977 885991 886007 
-886013 886019 886021 886031 886043 886069 886097 886117 886129 886163 886177 886181 
-886183 886189 886199 886241 886243 886247 886271 886283 886307 886313 886337 886339 
-886349 886367 886381 886387 886421 886427 886429 886433 886453 886463 886469 886471 
-886493 886511 886517 886519 886537 886541 886547 886549 886583 886591 886607 886609 
-886619 886643 886651 886663 886667 886741 886747 886751 886759 886777 886793 886799 
-886807 886819 886859 886867 886891 886909 886913 886967 886969 886973 886979 886981 
-886987 886993 886999 887017 887057 887059 887069 887093 887101 887113 887141 887143 
-887153 887171 887177 887191 887203 887233 887261 887267 887269 887291 887311 887323 
-887333 887377 887387 887399 887401 887423 887441 887449 887459 887479 887483 887503 
-887533 887543 887567 887569 887573 887581 887599 887617 887629 887633 887641 887651 
-887657 887659 887669 887671 887681 887693 887701 887707 887717 887743 887749 887759 
-887819 887827 887837 887839 887849 887867 887903 887911 887921 887923 887941 887947 
-887987 887989 888001 888011 888047 888059 888061 888077 888091 888103 888109 888133 
-888143 888157 888161 888163 888179 888203 888211 888247 888257 888263 888271 888287 
-888313 888319 888323 888359 888361 888373 888389 888397 888409 888413 888427 888431 
-888443 888451 888457 888469 888479 888493 888499 888533 888541 888557 888623 888631 
-888637 888653 888659 888661 888683 888689 888691 888721 888737 888751 888761 888773 
-888779 888781 888793 888799 888809 888827 888857 888869 888871 888887 888917 888919 
-888931 888959 888961 888967 888983 888989 888997 889001 889027 889037 889039 889043 
-889051 889069 889081 889087 889123 889139 889171 889177 889211 889237 889247 889261 
-889271 889279 889289 889309 889313 889327 889337 889349 889351 889363 889367 889373 
-889391 889411 889429 889439 889453 889481 889489 889501 889519 889579 889589 889597 
-889631 889639 889657 889673 889687 889697 889699 889703 889727 889747 889769 889783 
-889829 889871 889873 889877 889879 889891 889901 889907 889909 889921 889937 889951 
-889957 889963 889997 890003 890011 890027 890053 890063 890083 890107 890111 890117 
-890119 890129 890147 890159 890161 890177 890221 890231 890237 890287 890291 890303 
-890317 890333 890371 890377 890419 890429 890437 890441 890459 890467 890501 890531 
-890543 890551 890563 890597 890609 890653 890657 890671 890683 890707 890711 890717 
-890737 890761 890789 890797 890803 890809 890821 890833 890843 890861 890863 890867 
-890881 890887 890893 890927 890933 890941 890957 890963 890969 890993 890999 891001 
-891017 891047 891049 891061 891067 891091 891101 891103 891133 891151 891161 891173 
-891179 891223 891239 891251 891277 891287 891311 891323 891329 891349 891377 891379 
-891389 891391 891409 891421 891427 891439 891481 891487 891491 891493 891509 891521 
-891523 891551 891557 891559 891563 891571 891577 891587 891593 891601 891617 891629 
-891643 891647 891659 891661 891677 891679 891707 891743 891749 891763 891767 891797 
-891799 891809 891817 891823 891827 891829 891851 891859 891887 891889 891893 891899 
-891907 891923 891929 891967 891983 891991 891997 892019 892027 892049 892057 892079 
-892091 892093 892097 892103 892123 892141 892153 892159 892169 892189 892219 892237 
-892249 892253 892261 892267 892271 892291 892321 892351 892357 892387 892391 892421 
-892433 892439 892457 892471 892481 892513 892523 892531 892547 892553 892559 892579 
-892597 892603 892609 892627 892643 892657 892663 892667 892709 892733 892747 892757 
-892763 892777 892781 892783 892817 892841 892849 892861 892877 892901 892919 892933 
-892951 892973 892987 892999 893003 893023 893029 893033 893041 893051 893059 893093 
-893099 893107 893111 893117 893119 893131 893147 893149 893161 893183 893213 893219 
-893227 893237 893257 893261 893281 893317 893339 893341 893351 893359 893363 893381 
-893383 893407 893413 893419 893429 893441 893449 893479 893489 893509 893521 893549 
-893567 893591 893603 893609 893653 893657 893671 893681 893701 893719 893723 893743 
-893777 893797 893821 893839 893857 893863 893873 893881 893897 893903 893917 893929 
-893933 893939 893989 893999 894011 894037 894059 894067 894073 894097 894109 894119 
-894137 894139 894151 894161 894167 894181 894191 894193 894203 894209 894211 894221 
-894227 894233 894239 894247 894259 894277 894281 894287 894301 894329 894343 894371 
-894391 894403 894407 894409 894419 894427 894431 894449 894451 894503 894511 894521 
-894527 894541 894547 894559 894581 894589 894611 894613 894637 894643 894667 894689 
-894709 894713 894721 894731 894749 894763 894779 894791 894793 894811 894869 894871 
-894893 894917 894923 894947 894973 894997 895003 895007 895009 895039 895049 895051 
-895079 895087 895127 895133 895151 895157 895159 895171 895189 895211 895231 895241 
-895243 895247 895253 895277 895283 895291 895309 895313 895319 895333 895343 895351 
-895357 895361 895387 895393 895421 895423 895457 895463 895469 895471 895507 895529 
-895553 895571 895579 895591 895613 895627 895633 895649 895651 895667 895669 895673 
-895681 895691 895703 895709 895721 895729 895757 895771 895777 895787 895789 895799 
-895801 895813 895823 895841 895861 895879 895889 895901 895903 895913 895927 895933 
-895957 895987 896003 896009 896047 896069 896101 896107 896111 896113 896123 896143 
-896167 896191 896201 896263 896281 896293 896297 896299 896323 896327 896341 896347 
-896353 896369 896381 896417 896443 896447 896449 896453 896479 896491 896509 896521 
-896531 896537 896543 896549 896557 896561 896573 896587 896617 896633 896647 896669 
-896677 896681 896717 896719 896723 896771 896783 896803 896837 896867 896879 896897 
-896921 896927 896947 896953 896963 896983 897007 897011 897019 897049 897053 897059 
-897067 897077 897101 897103 897119 897133 897137 897157 897163 897191 897223 897229 
-897241 897251 897263 897269 897271 897301 897307 897317 897319 897329 897349 897359 
-897373 897401 897433 897443 897461 897467 897469 897473 897497 897499 897517 897527 
-897553 897557 897563 897571 897577 897581 897593 897601 897607 897629 897647 897649 
-897671 897691 897703 897707 897709 897727 897751 897779 897781 897817 897829 897847 
-897877 897881 897887 897899 897907 897931 897947 897971 897983 898013 898019 898033 
-898063 898067 898069 898091 898097 898109 898129 898133 898147 898153 898171 898181 
-898189 898199 898211 898213 898223 898231 898241 898243 898253 898259 898279 898283 
-898291 898307 898319 898327 898361 898369 898409 898421 898423 898427 898439 898459 
-898477 898481 898483 898493 898519 898523 898543 898549 898553 898561 898607 898613 
-898621 898661 898663 898669 898673 898691 898717 898727 898753 898763 898769 898787 
-898813 898819 898823 898853 898867 898873 898889 898897 898921 898927 898951 898981 
-898987 899009 899051 899057 899069 899123 899149 899153 899159 899161 899177 899179 
-899183 899189 899209 899221 899233 899237 899263 899273 899291 899309 899321 899387 
-899401 899413 899429 899447 899467 899473 899477 899491 899519 899531 899537 899611 
-899617 899659 899671 899681 899687 899693 899711 899719 899749 899753 899761 899779 
-899791 899807 899831 899849 899851 899863 899881 899891 899893 899903 899917 899939 
-899971 899981 900001 900007 900019 900037 900061 900089 900091 900103 900121 900139 
-900143 900149 900157 900161 900169 900187 900217 900233 900241 900253 900259 900283 
-900287 900293 900307 900329 900331 900349 900397 900409 900443 900461 900481 900491 
-900511 900539 900551 900553 900563 900569 900577 900583 900587 900589 900593 900607 
-900623 900649 900659 900671 900673 900689 900701 900719 900737 900743 900751 900761 
-900763 900773 900797 900803 900817 900821 900863 900869 900917 900929 900931 900937 
-900959 900971 900973 900997 901007 901009 901013 901063 901067 901079 901093 901097 
-901111 901133 901141 901169 901171 901177 901183 901193 901207 901211 901213 901247 
-901249 901253 901273 901279 901309 901333 901339 901367 901399 901403 901423 901427 
-901429 901441 901447 901451 901457 901471 901489 901499 901501 901513 901517 901529 
-901547 901567 901591 901613 901643 901657 901679 901687 901709 901717 901739 901741 
-901751 901781 901787 901811 901819 901841 901861 901891 901907 901909 901919 901931 
-901937 901963 901973 901993 901997 902009 902017 902029 902039 902047 902053 902087 
-902089 902119 902137 902141 902179 902191 902201 902227 902261 902263 902281 902299 
-902303 902311 902333 902347 902351 902357 902389 902401 902413 902437 902449 902471 
-902477 902483 902501 902507 902521 902563 902569 902579 902591 902597 902599 902611 
-902639 902653 902659 902669 902677 902687 902719 902723 902753 902761 902767 902771 
-902777 902789 902807 902821 902827 902849 902873 902903 902933 902953 902963 902971 
-902977 902981 902987 903017 903029 903037 903073 903079 903103 903109 903143 903151 
-903163 903179 903197 903211 903223 903251 903257 903269 903311 903323 903337 903347 
-903359 903367 903389 903391 903403 903407 903421 903443 903449 903451 903457 903479 
-903493 903527 903541 903547 903563 903569 903607 903613 903641 903649 903673 903677 
-903691 903701 903709 903751 903757 903761 903781 903803 903827 903841 903871 903883 
-903899 903913 903919 903949 903967 903979 904019 904027 904049 904067 904069 904073 
-904087 904093 904097 904103 904117 904121 904147 904157 904181 904193 904201 904207 
-904217 904219 904261 904283 904289 904297 904303 904357 904361 904369 904399 904441 
-904459 904483 904489 904499 904511 904513 904517 904523 904531 904559 904573 904577 
-904601 904619 904627 904633 904637 904643 904661 904663 904667 904679 904681 904693 
-904697 904721 904727 904733 904759 904769 904777 904781 904789 904793 904801 904811 
-904823 904847 904861 904867 904873 904879 904901 904903 904907 904919 904931 904933 
-904987 904997 904999 905011 905053 905059 905071 905083 905087 905111 905123 905137 
-905143 905147 905161 905167 905171 905189 905197 905207 905209 905213 905227 905249 
-905269 905291 905297 905299 905329 905339 905347 905381 905413 905449 905453 905461 
-905477 905491 905497 905507 905551 905581 905587 905599 905617 905621 905629 905647 
-905651 905659 905677 905683 905687 905693 905701 905713 905719 905759 905761 905767 
-905783 905803 905819 905833 905843 905897 905909 905917 905923 905951 905959 905963 
-905999 906007 906011 906013 906023 906029 906043 906089 906107 906119 906121 906133 
-906179 906187 906197 906203 906211 906229 906233 906259 906263 906289 906293 906313 
-906317 906329 906331 906343 906349 906371 906377 906383 906391 906403 906421 906427 
-906431 906461 906473 906481 906487 906497 906517 906523 906539 906541 906557 906589 
-906601 906613 906617 906641 906649 906673 906679 906691 906701 906707 906713 906727 
-906749 906751 906757 906767 906779 906793 906809 906817 906823 906839 906847 906869 
-906881 906901 906911 906923 906929 906931 906943 906949 906973 907019 907021 907031 
-907063 907073 907099 907111 907133 907139 907141 907163 907169 907183 907199 907211 
-907213 907217 907223 907229 907237 907259 907267 907279 907297 907301 907321 907331 
-907363 907367 907369 907391 907393 907397 907399 907427 907433 907447 907457 907469 
-907471 907481 907493 907507 907513 907549 907561 907567 907583 907589 907637 907651 
-907657 907663 907667 907691 907693 907703 907717 907723 907727 907733 907757 907759 
-907793 907807 907811 907813 907831 907843 907849 907871 907891 907909 907913 907927 
-907957 907967 907969 907997 907999 908003 908041 908053 908057 908071 908081 908101 
-908113 908129 908137 908153 908179 908183 908197 908213 908221 908233 908249 908287 
-908317 908321 908353 908359 908363 908377 908381 908417 908419 908441 908449 908459 
-908471 908489 908491 908503 908513 908521 908527 908533 908539 908543 908549 908573 
-908581 908591 908597 908603 908617 908623 908627 908653 908669 908671 908711 908723 
-908731 908741 908749 908759 908771 908797 908807 908813 908819 908821 908849 908851 
-908857 908861 908863 908879 908881 908893 908909 908911 908927 908953 908959 908993 
-909019 909023 909031 909037 909043 909047 909061 909071 909089 909091 909107 909113 
-909119 909133 909151 909173 909203 909217 909239 909241 909247 909253 909281 909287 
-909289 909299 909301 909317 909319 909329 909331 909341 909343 909371 909379 909383 
-909401 909409 909437 909451 909457 909463 909481 909521 909529 909539 909541 909547 
-909577 909599 909611 909613 909631 909637 909679 909683 909691 909697 909731 909737 
-909743 909761 909767 909773 909787 909791 909803 909809 909829 909833 909859 909863 
-909877 909889 909899 909901 909907 909911 909917 909971 909973 909977 910003 910031 
-910051 910069 910093 910097 910099 910103 910109 910121 910127 910139 910141 910171 
-910177 910199 910201 910207 910213 910219 910229 910277 910279 910307 910361 910369 
-910421 910447 910451 910453 910457 910471 910519 910523 910561 910577 910583 910603 
-910619 910621 910627 910631 910643 910661 910691 910709 910711 910747 910751 910771 
-910781 910787 910799 910807 910817 910849 910853 910883 910909 910939 910957 910981 
-911003 911011 911023 911033 911039 911063 911077 911087 911089 911101 911111 911129 
-911147 911159 911161 911167 911171 911173 911179 911201 911219 911227 911231 911233 
-911249 911269 911291 911293 911303 911311 911321 911327 911341 911357 911359 911363 
-911371 911413 911419 911437 911453 911459 911503 911507 911527 911549 911593 911597 
-911621 911633 911657 911663 911671 911681 911683 911689 911707 911719 911723 911737 
-911749 911773 911777 911783 911819 911831 911837 911839 911851 911861 911873 911879 
-911893 911899 911903 911917 911947 911951 911957 911959 911969 912007 912031 912047 
-912049 912053 912061 912083 912089 912103 912167 912173 912187 912193 912211 912217 
-912227 912239 912251 912269 912287 912337 912343 912349 912367 912391 912397 912403 
-912409 912413 912449 912451 912463 912467 912469 912481 912487 912491 912497 912511 
-912521 912523 912533 912539 912559 912581 912631 912647 912649 912727 912763 912773 
-912797 912799 912809 912823 912829 912839 912851 912853 912859 912869 912871 912911 
-912929 912941 912953 912959 912971 912973 912979 912991 913013 913027 913037 913039 
-913063 913067 913103 913139 913151 913177 913183 913217 913247 913259 913279 913309 
-913321 913327 913331 913337 913373 913397 913417 913421 913433 913441 913447 913457 
-913483 913487 913513 913571 913573 913579 913589 913637 913639 913687 913709 913723 
-913739 913753 913771 913799 913811 913853 913873 913889 913907 913921 913933 913943 
-913981 913999 914021 914027 914041 914047 914117 914131 914161 914189 914191 914213 
-914219 914237 914239 914257 914269 914279 914293 914321 914327 914339 914351 914357 
-914359 914363 914369 914371 914429 914443 914449 914461 914467 914477 914491 914513 
-914519 914521 914533 914561 914569 914579 914581 914591 914597 914609 914611 914629 
-914647 914657 914701 914713 914723 914731 914737 914777 914783 914789 914791 914801 
-914813 914819 914827 914843 914857 914861 914867 914873 914887 914891 914897 914941 
-914951 914971 914981 915007 915017 915029 915041 915049 915053 915067 915071 915113 
-915139 915143 915157 915181 915191 915197 915199 915203 915221 915223 915247 915251 
-915253 915259 915283 915301 915311 915353 915367 915379 915391 915437 915451 915479 
-915487 915527 915533 915539 915547 915557 915587 915589 915601 915611 915613 915623 
-915631 915641 915659 915683 915697 915703 915727 915731 915737 915757 915763 915769 
-915799 915839 915851 915869 915881 915911 915917 915919 915947 915949 915961 915973 
-915991 916031 916033 916049 916057 916061 916073 916099 916103 916109 916121 916127 
-916129 916141 916169 916177 916183 916187 916189 916213 916217 916219 916259 916261 
-916273 916291 916319 916337 916339 916361 916367 916387 916411 916417 916441 916451 
-916457 916463 916469 916471 916477 916501 916507 916511 916537 916561 916571 916583 
-916613 916621 916633 916649 916651 916679 916703 916733 916771 916781 916787 916831 
-916837 916841 916859 916871 916879 916907 916913 916931 916933 916939 916961 916973 
-916999 917003 917039 917041 917051 917053 917083 917089 917093 917101 917113 917117 
-917123 917141 917153 917159 917173 917179 917209 917219 917227 917237 917239 917243 
-917251 917281 917291 917317 917327 917333 917353 917363 917381 917407 917443 917459 
-917461 917471 917503 917513 917519 917549 917557 917573 917591 917593 917611 917617 
-917629 917633 917641 917659 917669 917687 917689 917713 917729 917737 917753 917759 
-917767 917771 917773 917783 917789 917803 917809 917827 917831 917837 917843 917849 
-917869 917887 917893 917923 917927 917951 917971 917993 918011 918019 918041 918067 
-918079 918089 918103 918109 918131 918139 918143 918149 918157 918161 918173 918193 
-918199 918209 918223 918257 918259 918263 918283 918301 918319 918329 918341 918347 
-918353 918361 918371 918389 918397 918431 918433 918439 918443 918469 918481 918497 
-918529 918539 918563 918581 918583 918587 918613 918641 918647 918653 918677 918679 
-918683 918733 918737 918751 918763 918767 918779 918787 918793 918823 918829 918839 
-918857 918877 918889 918899 918913 918943 918947 918949 918959 918971 918989 919013 
-919019 919021 919031 919033 919063 919067 919081 919109 919111 919129 919147 919153 
-919169 919183 919189 919223 919229 919231 919249 919253 919267 919301 919313 919319 
-919337 919349 919351 919381 919393 919409 919417 919421 919423 919427 919447 919511 
-919519 919531 919559 919571 919591 919613 919621 919631 919679 919691 919693 919703 
-919729 919757 919759 919769 919781 919799 919811 919817 919823 919859 919871 919883 
-919901 919903 919913 919927 919937 919939 919949 919951 919969 919979 920011 920021 
-920039 920053 920107 920123 920137 920147 920149 920167 920197 920201 920203 920209 
-920219 920233 920263 920267 920273 920279 920281 920291 920323 920333 920357 920371 
-920377 920393 920399 920407 920411 920419 920441 920443 920467 920473 920477 920497 
-920509 920519 920539 920561 920609 920641 920651 920653 920677 920687 920701 920707 
-920729 920741 920743 920753 920761 920783 920789 920791 920807 920827 920833 920849 
-920863 920869 920891 920921 920947 920951 920957 920963 920971 920999 921001 921007 
-921013 921029 921031 921073 921079 921091 921121 921133 921143 921149 921157 921169 
-921191 921197 921199 921203 921223 921233 921241 921257 921259 921287 921293 921331 
-921353 921373 921379 921407 921409 921457 921463 921467 921491 921497 921499 921517 
-921523 921563 921581 921589 921601 921611 921629 921637 921643 921647 921667 921677 
-921703 921733 921737 921743 921749 921751 921761 921779 921787 921821 921839 921841 
-921871 921887 921889 921901 921911 921913 921919 921931 921959 921989 922021 922027 
-922037 922039 922043 922057 922067 922069 922073 922079 922081 922087 922099 922123 
-922169 922211 922217 922223 922237 922247 922261 922283 922289 922291 922303 922309 
-922321 922331 922333 922351 922357 922367 922391 922423 922451 922457 922463 922487 
-922489 922499 922511 922513 922517 922531 922549 922561 922601 922613 922619 922627 
-922631 922637 922639 922643 922667 922679 922681 922699 922717 922729 922739 922741 
-922781 922807 922813 922853 922861 922897 922907 922931 922973 922993 923017 923023 
-923029 923047 923051 923053 923107 923123 923129 923137 923141 923147 923171 923177 
-923179 923183 923201 923203 923227 923233 923239 923249 923309 923311 923333 923341 
-923347 923369 923371 923387 923399 923407 923411 923437 923441 923449 923453 923467 
-923471 923501 923509 923513 923539 923543 923551 923561 923567 923579 923581 923591 
-923599 923603 923617 923641 923653 923687 923693 923701 923711 923719 923743 923773 
-923789 923809 923833 923849 923851 923861 923869 923903 923917 923929 923939 923947 
-923953 923959 923963 923971 923977 923983 923987 924019 924023 924031 924037 924041 
-924043 924059 924073 924083 924097 924101 924109 924139 924151 924173 924191 924197 
-924241 924269 924281 924283 924299 924323 924337 924359 924361 924383 924397 924401 
-924403 924419 924421 924431 924437 924463 924493 924499 924503 924523 924527 924529 
-924551 924557 924601 924617 924641 924643 924659 924661 924683 924697 924709 924713 
-924719 924727 924731 924743 924751 924757 924769 924773 924779 924793 924809 924811 
-924827 924829 924841 924871 924877 924881 924907 924929 924961 924967 924997 925019 
-925027 925033 925039 925051 925063 925073 925079 925081 925087 925097 925103 925109 
-925117 925121 925147 925153 925159 925163 925181 925189 925193 925217 925237 925241 
-925271 925273 925279 925291 925307 925339 925349 925369 925373 925387 925391 925399 
-925409 925423 925447 925469 925487 925499 925501 925513 925517 925523 925559 925577 
-925579 925597 925607 925619 925621 925637 925649 925663 925669 925679 925697 925721 
-925733 925741 925783 925789 925823 925831 925843 925849 925891 925901 925913 925921 
-925937 925943 925949 925961 925979 925987 925997 926017 926027 926033 926077 926087 
-926089 926099 926111 926113 926129 926131 926153 926161 926171 926179 926183 926203 
-926227 926239 926251 926273 926293 926309 926327 926351 926353 926357 926377 926389 
-926399 926411 926423 926437 926461 926467 926489 926503 926507 926533 926537 926557 
-926561 926567 926581 926587 926617 926623 926633 926657 926659 926669 926671 926689 
-926701 926707 926741 926747 926767 926777 926797 926803 926819 926843 926851 926867 
-926879 926899 926903 926921 926957 926963 926971 926977 926983 927001 927007 927013 
-927049 927077 927083 927089 927097 927137 927149 927161 927167 927187 927191 927229 
-927233 927259 927287 927301 927313 927317 927323 927361 927373 927397 927403 927431 
-927439 927491 927497 927517 927529 927533 927541 927557 927569 927587 927629 927631 
-927643 927649 927653 927671 927677 927683 927709 927727 927743 927763 927769 927779 
-927791 927803 927821 927833 927841 927847 927853 927863 927869 927961 927967 927973 
-928001 928043 928051 928063 928079 928097 928099 928111 928139 928141 928153 928157 
-928159 928163 928177 928223 928231 928253 928267 928271 928273 928289 928307 928313 
-928331 928337 928351 928399 928409 928423 928427 928429 928453 928457 928463 928469 
-928471 928513 928547 928559 928561 928597 928607 928619 928621 928637 928643 928649 
-928651 928661 928679 928699 928703 928769 928771 928787 928793 928799 928813 928817 
-928819 928849 928859 928871 928883 928903 928913 928927 928933 928979 929003 929009 
-929011 929023 929029 929051 929057 929059 929063 929069 929077 929083 929087 929113 
-929129 929141 929153 929161 929171 929197 929207 929209 929239 929251 929261 929281 
-929293 929303 929311 929323 929333 929381 929389 929393 929399 929417 929419 929431 
-929459 929483 929497 929501 929507 929527 929549 929557 929561 929573 929581 929587 
-929609 929623 929627 929629 929639 929641 929647 929671 929693 929717 929737 929741 
-929743 929749 929777 929791 929807 929809 929813 929843 929861 929869 929881 929891 
-929897 929941 929953 929963 929977 929983 930011 930043 930071 930073 930077 930079 
-930089 930101 930113 930119 930157 930173 930179 930187 930191 930197 930199 930211 
-930229 930269 930277 930283 930287 930289 930301 930323 930337 930379 930389 930409 
-930437 930467 930469 930481 930491 930499 930509 930547 930551 930569 930571 930583 
-930593 930617 930619 930637 930653 930667 930689 930707 930719 930737 930749 930763 
-930773 930779 930817 930827 930841 930847 930859 930863 930889 930911 930931 930973 
-930977 930989 930991 931003 931013 931067 931087 931097 931123 931127 931129 931153 
-931163 931169 931181 931193 931199 931213 931237 931241 931267 931289 931303 931309 
-931313 931319 931351 931363 931387 931417 931421 931487 931499 931517 931529 931537 
-931543 931571 931573 931577 931597 931621 931639 931657 931691 931709 931727 931729 
-931739 931747 931751 931757 931781 931783 931789 931811 931837 931849 931859 931873 
-931877 931883 931901 931907 931913 931921 931933 931943 931949 931967 931981 931999 
-932003 932021 932039 932051 932081 932101 932117 932119 932131 932149 932153 932177 
-932189 932203 932207 932209 932219 932221 932227 932231 932257 932303 932317 932333 
-932341 932353 932357 932413 932417 932419 932431 932441 932447 932471 932473 932483 
-932497 932513 932521 932537 932549 932557 932563 932567 932579 932587 932593 932597 
-932609 932647 932651 932663 932677 932681 932683 932749 932761 932779 932783 932801 
-932803 932819 932839 932863 932879 932887 932917 932923 932927 932941 932947 932951 
-932963 932969 932983 932999 933001 933019 933047 933059 933061 933067 933073 933151 
-933157 933173 933199 933209 933217 933221 933241 933259 933263 933269 933293 933301 
-933313 933319 933329 933349 933389 933397 933403 933407 933421 933433 933463 933479 
-933497 933523 933551 933553 933563 933601 933607 933613 933643 933649 933671 933677 
-933703 933707 933739 933761 933781 933787 933797 933809 933811 933817 933839 933847 
-933851 933853 933883 933893 933923 933931 933943 933949 933953 933967 933973 933979 
-934001 934009 934033 934039 934049 934051 934057 934067 934069 934079 934111 934117 
-934121 934127 934151 934159 934187 934223 934229 934243 934253 934259 934277 934291 
-934301 934319 934343 934387 934393 934399 934403 934429 934441 934463 934469 934481 
-934487 934489 934499 934517 934523 934537 934543 934547 934561 934567 934579 934597 
-934603 934607 934613 934639 934669 934673 934693 934721 934723 934733 934753 934763 
-934771 934793 934799 934811 934831 934837 934853 934861 934883 934889 934891 934897 
-934907 934909 934919 934939 934943 934951 934961 934979 934981 935003 935021 935023 
-935059 935063 935071 935093 935107 935113 935147 935149 935167 935183 935189 935197 
-935201 935213 935243 935257 935261 935303 935339 935353 935359 935377 935381 935393 
-935399 935413 935423 935443 935447 935461 935489 935507 935513 935531 935537 935581 
-935587 935591 935593 935603 935621 935639 935651 935653 935677 935687 935689 935699 
-935707 935717 935719 935761 935771 935777 935791 935813 935819 935827 935839 935843 
-935861 935899 935903 935971 935999 936007 936029 936053 936097 936113 936119 936127 
-936151 936161 936179 936181 936197 936203 936223 936227 936233 936253 936259 936281 
-936283 936311 936319 936329 936361 936379 936391 936401 936407 936413 936437 936451 
-936469 936487 936493 936499 936511 936521 936527 936539 936557 936577 936587 936599 
-936619 936647 936659 936667 936673 936679 936697 936709 936713 936731 936737 936739 
-936769 936773 936779 936797 936811 936827 936869 936889 936907 936911 936917 936919 
-936937 936941 936953 936967 937003 937007 937009 937031 937033 937049 937067 937121 
-937127 937147 937151 937171 937187 937207 937229 937231 937241 937243 937253 937331 
-937337 937351 937373 937379 937421 937429 937459 937463 937477 937481 937501 937511 
-937537 937571 937577 937589 937591 937613 937627 937633 937637 937639 937661 937663 
-937667 937679 937681 937693 937709 937721 937747 937751 937777 937789 937801 937813 
-937819 937823 937841 937847 937877 937883 937891 937901 937903 937919 937927 937943 
-937949 937969 937991 938017 938023 938027 938033 938051 938053 938057 938059 938071 
-938083 938089 938099 938107 938117 938129 938183 938207 938219 938233 938243 938251 
-938257 938263 938279 938293 938309 938323 938341 938347 938351 938359 938369 938387 
-938393 938437 938447 938453 938459 938491 938507 938533 938537 938563 938569 938573 
-938591 938611 938617 938659 938677 938681 938713 938747 938761 938803 938807 938827 
-938831 938843 938857 938869 938879 938881 938921 938939 938947 938953 938963 938969 
-938981 938983 938989 939007 939011 939019 939061 939089 939091 939109 939119 939121 
-939157 939167 939179 939181 939193 939203 939229 939247 939287 939293 939299 939317 
-939347 939349 939359 939361 939373 939377 939391 939413 939431 939439 939443 939451 
-939469 939487 939511 939551 939581 939599 939611 939613 939623 939649 939661 939677 
-939707 939713 939737 939739 939749 939767 939769 939773 939791 939793 939823 939839 
-939847 939853 939871 939881 939901 939923 939931 939971 939973 939989 939997 940001 
-940003 940019 940031 940067 940073 940087 940097 940127 940157 940169 940183 940189 
-940201 940223 940229 940241 940249 940259 940271 940279 940297 940301 940319 940327 
-940349 940351 940361 940369 940399 940403 940421 940469 940477 940483 940501 940523 
-940529 940531 940543 940547 940549 940553 940573 940607 940619 940649 940669 940691 
-940703 940721 940727 940733 940739 940759 940781 940783 940787 940801 940813 940817 
-940829 940853 940871 940879 940889 940903 940913 940921 940931 940949 940957 940981 
-940993 941009 941011 941023 941027 941041 941093 941099 941117 941119 941123 941131 
-941153 941159 941167 941179 941201 941207 941209 941221 941249 941251 941263 941267 
-941299 941309 941323 941329 941351 941359 941383 941407 941429 941441 941449 941453 
-941461 941467 941471 941489 941491 941503 941509 941513 941519 941537 941557 941561 
-941573 941593 941599 941609 941617 941641 941653 941663 941669 941671 941683 941701 
-941723 941737 941741 941747 941753 941771 941791 941813 941839 941861 941879 941903 
-941911 941929 941933 941947 941971 941981 941989 941999 942013 942017 942031 942037 
-942041 942043 942049 942061 942079 942091 942101 942113 942143 942163 942167 942169 
-942187 942199 942217 942223 942247 942257 942269 942301 942311 942313 942317 942341 
-942367 942371 942401 942433 942437 942439 942449 942479 942509 942521 942527 942541 
-942569 942577 942583 942593 942607 942637 942653 942659 942661 942691 942709 942719 
-942727 942749 942763 942779 942787 942811 942827 942847 942853 942857 942859 942869 
-942883 942889 942899 942901 942917 942943 942979 942983 943003 943009 943013 943031 
-943043 943057 943073 943079 943081 943091 943097 943127 943139 943153 943157 943183 
-943199 943213 943219 943231 943249 943273 943277 943289 943301 943303 943307 943321 
-943343 943357 943363 943367 943373 943387 943403 943409 943421 943429 943471 943477 
-943499 943511 943541 943543 943567 943571 943589 943601 943603 943637 943651 943693 
-943699 943729 943741 943751 943757 943763 943769 943777 943781 943783 943799 943801 
-943819 943837 943841 943843 943849 943871 943903 943909 943913 943931 943951 943967 
-944003 944017 944029 944039 944071 944077 944123 944137 944143 944147 944149 944161 
-944179 944191 944233 944239 944257 944261 944263 944297 944309 944329 944369 944387 
-944389 944393 944399 944417 944429 944431 944453 944467 944473 944491 944497 944519 
-944521 944527 944533 944543 944551 944561 944563 944579 944591 944609 944621 944651 
-944659 944677 944687 944689 944701 944711 944717 944729 944731 944773 944777 944803 
-944821 944833 944857 944873 944887 944893 944897 944899 944929 944953 944963 944969 
-944987 945031 945037 945059 945089 945103 945143 945151 945179 945209 945211 945227 
-945233 945289 945293 945331 945341 945349 945359 945367 945377 945389 945391 945397 
-945409 945431 945457 945463 945473 945479 945481 945521 945547 945577 945587 945589 
-945601 945629 945631 945647 945671 945673 945677 945701 945731 945733 945739 945767 
-945787 945799 945809 945811 945817 945823 945851 945881 945883 945887 945899 945907 
-945929 945937 945941 945943 945949 945961 945983 946003 946021 946031 946037 946079 
-946081 946091 946093 946109 946111 946123 946133 946163 946177 946193 946207 946223 
-946249 946273 946291 946307 946327 946331 946367 946369 946391 946397 946411 946417 
-946453 946459 946469 946487 946489 946507 946511 946513 946549 946573 946579 946607 
-946661 946663 946667 946669 946681 946697 946717 946727 946733 946741 946753 946769 
-946783 946801 946819 946823 946853 946859 946861 946873 946877 946901 946919 946931 
-946943 946949 946961 946969 946987 946993 946997 947027 947033 947083 947119 947129 
-947137 947171 947183 947197 947203 947239 947263 947299 947327 947341 947351 947357 
-947369 947377 947381 947383 947389 947407 947411 947413 947417 947423 947431 947449 
-947483 947501 947509 947539 947561 947579 947603 947621 947627 947641 947647 947651 
-947659 947707 947711 947719 947729 947741 947743 947747 947753 947773 947783 947803 
-947819 947833 947851 947857 947861 947873 947893 947911 947917 947927 947959 947963 
-947987 948007 948019 948029 948041 948049 948053 948061 948067 948089 948091 948133 
-948139 948149 948151 948169 948173 948187 948247 948253 948263 948281 948287 948293 
-948317 948331 948349 948377 948391 948401 948403 948407 948427 948439 948443 948449 
-948457 948469 948487 948517 948533 948547 948551 948557 948581 948593 948659 948671 
-948707 948713 948721 948749 948767 948797 948799 948839 948847 948853 948877 948887 
-948901 948907 948929 948943 948947 948971 948973 948989 949001 949019 949021 949033 
-949037 949043 949051 949111 949121 949129 949147 949153 949159 949171 949211 949213 
-949241 949243 949253 949261 949303 949307 949381 949387 949391 949409 949423 949427 
-949439 949441 949451 949453 949471 949477 949513 949517 949523 949567 949583 949589 
-949607 949609 949621 949631 949633 949643 949649 949651 949667 949673 949687 949691 
-949699 949733 949759 949771 949777 949789 949811 949849 949853 949889 949891 949903 
-949931 949937 949939 949951 949957 949961 949967 949973 949979 949987 949997 950009 
-950023 950029 950039 950041 950071 950083 950099 950111 950149 950161 950177 950179 
-950207 950221 950227 950231 950233 950239 950251 950269 950281 950329 950333 950347 
-950357 950363 950393 950401 950423 950447 950459 950461 950473 950479 950483 950497 
-950501 950507 950519 950527 950531 950557 950569 950611 950617 950633 950639 950647 
-950671 950681 950689 950693 950699 950717 950723 950737 950743 950753 950783 950791 
-950809 950813 950819 950837 950839 950867 950869 950879 950921 950927 950933 950947 
-950953 950959 950993 951001 951019 951023 951029 951047 951053 951059 951061 951079 
-951089 951091 951101 951107 951109 951131 951151 951161 951193 951221 951259 951277 
-951281 951283 951299 951331 951341 951343 951361 951367 951373 951389 951407 951413 
-951427 951437 951449 951469 951479 951491 951497 951553 951557 951571 951581 951583 
-951589 951623 951637 951641 951647 951649 951659 951689 951697 951749 951781 951787 
-951791 951803 951829 951851 951859 951887 951893 951911 951941 951943 951959 951967 
-951997 952001 952009 952037 952057 952073 952087 952097 952111 952117 952123 952129 
-952141 952151 952163 952169 952183 952199 952207 952219 952229 952247 952253 952277 
-952279 952291 952297 952313 952349 952363 952379 952381 952397 952423 952429 952439 
-952481 952487 952507 952513 952541 952547 952559 952573 952583 952597 952619 952649 
-952657 952667 952669 952681 952687 952691 952709 952739 952741 952753 952771 952789 
-952811 952813 952823 952829 952843 952859 952873 952877 952883 952921 952927 952933 
-952937 952943 952957 952967 952979 952981 952997 953023 953039 953041 953053 953077 
-953081 953093 953111 953131 953149 953171 953179 953191 953221 953237 953243 953261 
-953273 953297 953321 953333 953341 953347 953399 953431 953437 953443 953473 953483 
-953497 953501 953503 953507 953521 953539 953543 953551 953567 953593 953621 953639 
-953647 953651 953671 953681 953699 953707 953731 953747 953773 953789 953791 953831 
-953851 953861 953873 953881 953917 953923 953929 953941 953969 953977 953983 953987 
-954001 954007 954011 954043 954067 954097 954103 954131 954133 954139 954157 954167 
-954181 954203 954209 954221 954229 954253 954257 954259 954263 954269 954277 954287 
-954307 954319 954323 954367 954377 954379 954391 954409 954433 954451 954461 954469 
-954491 954497 954509 954517 954539 954571 954599 954619 954623 954641 954649 954671 
-954677 954697 954713 954719 954727 954743 954757 954763 954827 954829 954847 954851 
-954853 954857 954869 954871 954911 954917 954923 954929 954971 954973 954977 954979 
-954991 955037 955039 955051 955061 955063 955091 955093 955103 955127 955139 955147 
-955153 955183 955193 955211 955217 955223 955243 955261 955267 955271 955277 955307 
-955309 955313 955319 955333 955337 955363 955379 955391 955433 955439 955441 955457 
-955469 955477 955481 955483 955501 955511 955541 955601 955607 955613 955649 955657 
-955693 955697 955709 955711 955727 955729 955769 955777 955781 955793 955807 955813 
-955819 955841 955853 955879 955883 955891 955901 955919 955937 955939 955951 955957 
-955963 955967 955987 955991 955993 956003 956051 956057 956083 956107 956113 956119 
-956143 956147 956177 956231 956237 956261 956269 956273 956281 956303 956311 956341 
-956353 956357 956377 956383 956387 956393 956399 956401 956429 956477 956503 956513 
-956521 956569 956587 956617 956633 956689 956699 956713 956723 956749 956759 956789 
-956801 956831 956843 956849 956861 956881 956903 956909 956929 956941 956951 956953 
-956987 956993 956999 957031 957037 957041 957043 957059 957071 957091 957097 957107 
-957109 957119 957133 957139 957161 957169 957181 957193 957211 957221 957241 957247 
-957263 957289 957317 957331 957337 957349 957361 957403 957409 957413 957419 957431 
-957433 957499 957529 957547 957553 957557 957563 957587 957599 957601 957611 957641 
-957643 957659 957701 957703 957709 957721 957731 957751 957769 957773 957811 957821 
-957823 957851 957871 957877 957889 957917 957937 957949 957953 957959 957977 957991 
-958007 958021 958039 958043 958049 958051 958057 958063 958121 958123 958141 958159 
-958163 958183 958193 958213 958259 958261 958289 958313 958319 958327 958333 958339 
-958343 958351 958357 958361 958367 958369 958381 958393 958423 958439 958459 958481 
-958487 958499 958501 958519 958523 958541 958543 958547 958549 958553 958577 958609 
-958627 958637 958667 958669 958673 958679 958687 958693 958729 958739 958777 958787 
-958807 958819 958829 958843 958849 958871 958877 958883 958897 958901 958921 958931 
-958933 958957 958963 958967 958973 959009 959083 959093 959099 959131 959143 959149 
-959159 959173 959183 959207 959209 959219 959227 959237 959263 959267 959269 959279 
-959323 959333 959339 959351 959363 959369 959377 959383 959389 959449 959461 959467 
-959471 959473 959477 959479 959489 959533 959561 959579 959597 959603 959617 959627 
-959659 959677 959681 959689 959719 959723 959737 959759 959773 959779 959801 959809 
-959831 959863 959867 959869 959873 959879 959887 959911 959921 959927 959941 959947 
-959953 959969 960017 960019 960031 960049 960053 960059 960077 960119 960121 960131 
-960137 960139 960151 960173 960191 960199 960217 960229 960251 960259 960293 960299 
-960329 960331 960341 960353 960373 960383 960389 960419 960467 960493 960497 960499 
-960521 960523 960527 960569 960581 960587 960593 960601 960637 960643 960647 960649 
-960667 960677 960691 960703 960709 960737 960763 960793 960803 960809 960829 960833 
-960863 960889 960931 960937 960941 960961 960977 960983 960989 960991 961003 961021 
-961033 961063 961067 961069 961073 961087 961091 961097 961099 961109 961117 961123 
-961133 961139 961141 961151 961157 961159 961183 961187 961189 961201 961241 961243 
-961273 961277 961283 961313 961319 961339 961393 961397 961399 961427 961447 961451 
-961453 961459 961487 961507 961511 961529 961531 961547 961549 961567 961601 961613 
-961619 961627 961633 961637 961643 961657 961661 961663 961679 961687 961691 961703 
-961729 961733 961739 961747 961757 961769 961777 961783 961789 961811 961813 961817 
-961841 961847 961853 961861 961871 961879 961927 961937 961943 961957 961973 961981 
-961991 961993 962009 962011 962033 962041 962051 962063 962077 962099 962119 962131 
-962161 962177 962197 962233 962237 962243 962257 962267 962303 962309 962341 962363 
-962413 962417 962431 962441 962447 962459 962461 962471 962477 962497 962503 962509 
-962537 962543 962561 962569 962587 962603 962609 962617 962623 962627 962653 962669 
-962671 962677 962681 962683 962737 962743 962747 962779 962783 962789 962791 962807 
-962837 962839 962861 962867 962869 962903 962909 962911 962921 962959 962963 962971 
-962993 963019 963031 963043 963047 963097 963103 963121 963143 963163 963173 963181 
-963187 963191 963211 963223 963227 963239 963241 963253 963283 963299 963301 963311 
-963323 963331 963341 963343 963349 963367 963379 963397 963419 963427 963461 963481 
-963491 963497 963499 963559 963581 963601 963607 963629 963643 963653 963659 963667 
-963689 963691 963701 963707 963709 963719 963731 963751 963761 963763 963779 963793 
-963799 963811 963817 963839 963841 963847 963863 963871 963877 963899 963901 963913 
-963943 963973 963979 964009 964021 964027 964039 964049 964081 964097 964133 964151 
-964153 964199 964207 964213 964217 964219 964253 964259 964261 964267 964283 964289 
-964297 964303 964309 964333 964339 964351 964357 964363 964373 964417 964423 964433 
-964463 964499 964501 964507 964517 964519 964531 964559 964571 964577 964583 964589 
-964609 964637 964661 964679 964693 964697 964703 964721 964753 964757 964783 964787 
-964793 964823 964829 964861 964871 964879 964883 964889 964897 964913 964927 964933 
-964939 964967 964969 964973 964981 965023 965047 965059 965087 965089 965101 965113 
-965117 965131 965147 965161 965171 965177 965179 965189 965191 965197 965201 965227 
-965233 965249 965267 965291 965303 965317 965329 965357 965369 965399 965401 965407 
-965411 965423 965429 965443 965453 965467 965483 965491 965507 965519 965533 965551 
-965567 965603 965611 965621 965623 965639 965647 965659 965677 965711 965749 965759 
-965773 965777 965779 965791 965801 965843 965851 965857 965893 965927 965953 965963 
-965969 965983 965989 966011 966013 966029 966041 966109 966113 966139 966149 966157 
-966191 966197 966209 966211 966221 966227 966233 966241 966257 966271 966293 966307 
-966313 966319 966323 966337 966347 966353 966373 966377 966379 966389 966401 966409 
-966419 966431 966439 966463 966481 966491 966499 966509 966521 966527 966547 966557 
-966583 966613 966617 966619 966631 966653 966659 966661 966677 966727 966751 966781 
-966803 966817 966863 966869 966871 966883 966893 966907 966913 966919 966923 966937 
-966961 966971 966991 966997 967003 967019 967049 967061 967111 967129 967139 967171 
-967201 967229 967259 967261 967289 967297 967319 967321 967327 967333 967349 967361 
-967363 967391 967397 967427 967429 967441 967451 967459 967481 967493 967501 967507 
-967511 967529 967567 967583 967607 967627 967663 967667 967693 967699 967709 967721 
-967739 967751 967753 967763 967781 967787 967819 967823 967831 967843 967847 967859 
-967873 967877 967903 967919 967931 967937 967951 967961 967979 967999 968003 968017 
-968021 968027 968041 968063 968089 968101 968111 968113 968117 968137 968141 968147 
-968159 968173 968197 968213 968237 968239 968251 968263 968267 968273 968291 968299 
-968311 968321 968329 968333 968353 968377 968381 968389 968419 968423 968431 968437 
-968459 968467 968479 968501 968503 968519 968521 968537 968557 968567 968573 968593 
-968641 968647 968659 968663 968689 968699 968713 968729 968731 968761 968801 968809 
-968819 968827 968831 968857 968879 968897 968909 968911 968917 968939 968959 968963 
-968971 969011 969037 969041 969049 969071 969083 969097 969109 969113 969131 969139 
-969167 969179 969181 969233 969239 969253 969257 969259 969271 969301 969341 969343 
-969347 969359 969377 969403 969407 969421 969431 969433 969443 969457 969461 969467 
-969481 969497 969503 969509 969533 969559 969569 969593 969599 969637 969641 969667 
-969671 969677 969679 969713 969719 969721 969743 969757 969763 969767 969791 969797 
-969809 969821 969851 969863 969869 969877 969889 969907 969911 969919 969923 969929 
-969977 969989 970027 970031 970043 970051 970061 970063 970069 970087 970091 970111 
-970133 970147 970201 970213 970217 970219 970231 970237 970247 970259 970261 970267 
-970279 970297 970303 970313 970351 970391 970421 970423 970433 970441 970447 970457 
-970469 970481 970493 970537 970549 970561 970573 970583 970603 970633 970643 970657 
-970667 970687 970699 970721 970747 970777 970787 970789 970793 970799 970813 970817 
-970829 970847 970859 970861 970867 970877 970883 970903 970909 970927 970939 970943 
-970961 970967 970969 970987 970997 970999 971021 971027 971029 971039 971051 971053 
-971063 971077 971093 971099 971111 971141 971143 971149 971153 971171 971177 971197 
-971207 971237 971251 971263 971273 971279 971281 971291 971309 971339 971353 971357 
-971371 971381 971387 971389 971401 971419 971429 971441 971473 971479 971483 971491 
-971501 971513 971521 971549 971561 971563 971569 971591 971639 971651 971653 971683 
-971693 971699 971713 971723 971753 971759 971767 971783 971821 971833 971851 971857 
-971863 971899 971903 971917 971921 971933 971939 971951 971959 971977 971981 971989 
-972001 972017 972029 972031 972047 972071 972079 972091 972113 972119 972121 972131 
-972133 972137 972161 972163 972197 972199 972221 972227 972229 972259 972263 972271 
-972277 972313 972319 972329 972337 972343 972347 972353 972373 972403 972407 972409 
-972427 972431 972443 972469 972473 972481 972493 972533 972557 972577 972581 972599 
-972611 972613 972623 972637 972649 972661 972679 972683 972701 972721 972787 972793 
-972799 972823 972827 972833 972847 972869 972887 972899 972901 972941 972943 972967 
-972977 972991 973001 973003 973031 973033 973051 973057 973067 973069 973073 973081 
-973099 973129 973151 973169 973177 973187 973213 973253 973277 973279 973283 973289 
-973321 973331 973333 973367 973373 973387 973397 973409 973411 973421 973439 973459 
-973487 973523 973529 973537 973547 973561 973591 973597 973631 973657 973669 973681 
-973691 973727 973757 973759 973781 973787 973789 973801 973813 973823 973837 973853 
-973891 973897 973901 973919 973957 974003 974009 974033 974041 974053 974063 974089 
-974107 974123 974137 974143 974147 974159 974161 974167 974177 974179 974189 974213 
-974249 974261 974269 974273 974279 974293 974317 974329 974359 974383 974387 974401 
-974411 974417 974419 974431 974437 974443 974459 974473 974489 974497 974507 974513 
-974531 974537 974539 974551 974557 974563 974581 974591 974599 974651 974653 974657 
-974707 974711 974713 974737 974747 974749 974761 974773 974803 974819 974821 974837 
-974849 974861 974863 974867 974873 974879 974887 974891 974923 974927 974957 974959 
-974969 974971 974977 974983 974989 974999 975011 975017 975049 975053 975071 975083 
-975089 975133 975151 975157 975181 975187 975193 975199 975217 975257 975259 975263 
-975277 975281 975287 975313 975323 975343 975367 975379 975383 975389 975421 975427 
-975433 975439 975463 975493 975497 975509 975521 975523 975551 975553 975581 975599 
-975619 975629 975643 975649 975661 975671 975691 975701 975731 975739 975743 975797 
-975803 975811 975823 975827 975847 975857 975869 975883 975899 975901 975907 975941 
-975943 975967 975977 975991 976009 976013 976033 976039 976091 976093 976103 976109 
-976117 976127 976147 976177 976187 976193 976211 976231 976253 976271 976279 976301 
-976303 976307 976309 976351 976369 976403 976411 976439 976447 976453 976457 976471 
-976477 976483 976489 976501 976513 976537 976553 976559 976561 976571 976601 976607 
-976621 976637 976639 976643 976669 976699 976709 976721 976727 976777 976799 976817 
-976823 976849 976853 976883 976909 976919 976933 976951 976957 976991 977021 977023 
-977047 977057 977069 977087 977107 977147 977149 977167 977183 977191 977203 977209 
-977233 977239 977243 977257 977269 977299 977323 977351 977357 977359 977363 977369 
-977407 977411 977413 977437 977447 977507 977513 977521 977539 977567 977591 977593 
-977609 977611 977629 977671 977681 977693 977719 977723 977747 977761 977791 977803 
-977813 977819 977831 977849 977861 977881 977897 977923 977927 977971 978001 978007 
-978011 978017 978031 978037 978041 978049 978053 978067 978071 978073 978077 978079 
-978091 978113 978149 978151 978157 978179 978181 978203 978209 978217 978223 978233 
-978239 978269 978277 978283 978287 978323 978337 978343 978347 978349 978359 978389 
-978403 978413 978427 978449 978457 978463 978473 978479 978491 978511 978521 978541 
-978569 978599 978611 978617 978619 978643 978647 978683 978689 978697 978713 978727 
-978743 978749 978773 978797 978799 978821 978839 978851 978853 978863 978871 978883 
-978907 978917 978931 978947 978973 978997 979001 979009 979031 979037 979061 979063 
-979093 979103 979109 979117 979159 979163 979171 979177 979189 979201 979207 979211 
-979219 979229 979261 979273 979283 979291 979313 979327 979333 979337 979343 979361 
-979369 979373 979379 979403 979423 979439 979457 979471 979481 979519 979529 979541 
-979543 979549 979553 979567 979651 979691 979709 979717 979747 979757 979787 979807 
-979819 979831 979873 979883 979889 979907 979919 979921 979949 979969 979987 980027 
-980047 980069 980071 980081 980107 980117 980131 980137 980149 980159 980173 980179 
-980197 980219 980249 980261 980293 980299 980321 980327 980363 980377 980393 980401 
-980417 980423 980431 980449 980459 980471 980489 980491 980503 980549 980557 980579 
-980587 980591 980593 980599 980621 980641 980677 980687 980689 980711 980717 980719 
-980729 980731 980773 980801 980803 980827 980831 980851 980887 980893 980897 980899 
-980909 980911 980921 980957 980963 980999 981011 981017 981023 981037 981049 981061 
-981067 981073 981077 981091 981133 981137 981139 981151 981173 981187 981199 981209 
-981221 981241 981263 981271 981283 981287 981289 981301 981311 981319 981373 981377 
-981391 981397 981419 981437 981439 981443 981451 981467 981473 981481 981493 981517 
-981523 981527 981569 981577 981587 981599 981601 981623 981637 981653 981683 981691 
-981697 981703 981707 981713 981731 981769 981797 981809 981811 981817 981823 981887 
-981889 981913 981919 981941 981947 981949 981961 981979 981983 982021 982057 982061 
-982063 982067 982087 982097 982099 982103 982117 982133 982147 982151 982171 982183 
-982187 982211 982213 982217 982231 982271 982273 982301 982321 982337 982339 982343 
-982351 982363 982381 982393 982403 982453 982489 982493 982559 982571 982573 982577 
-982589 982603 982613 982621 982633 982643 982687 982693 982697 982703 982741 982759 
-982769 982777 982783 982789 982801 982819 982829 982841 982843 982847 982867 982871 
-982903 982909 982931 982939 982967 982973 982981 983063 983069 983083 983113 983119 
-983123 983131 983141 983149 983153 983173 983179 983189 983197 983209 983233 983239 
-983243 983261 983267 983299 983317 983327 983329 983347 983363 983371 983377 983407 
-983429 983431 983441 983443 983447 983449 983461 983491 983513 983519 983527 983531 
-983533 983557 983579 983581 983597 983617 983659 983699 983701 983737 983771 983777 
-983783 983789 983791 983803 983809 983813 983819 983849 983861 983863 983881 983911 
-983923 983929 983951 983987 983993 984007 984017 984037 984047 984059 984083 984091 
-984119 984121 984127 984149 984167 984199 984211 984241 984253 984299 984301 984307 
-984323 984329 984337 984341 984349 984353 984359 984367 984383 984391 984397 984407 
-984413 984421 984427 984437 984457 984461 984481 984491 984497 984539 984541 984563 
-984583 984587 984593 984611 984617 984667 984689 984701 984703 984707 984733 984749 
-984757 984761 984817 984847 984853 984859 984877 984881 984911 984913 984917 984923 
-984931 984947 984959 985003 985007 985013 985027 985057 985063 985079 985097 985109 
-985121 985129 985151 985177 985181 985213 985219 985253 985277 985279 985291 985301 
-985307 985331 985339 985351 985379 985399 985403 985417 985433 985447 985451 985463 
-985471 985483 985487 985493 985499 985519 985529 985531 985547 985571 985597 985601 
-985613 985631 985639 985657 985667 985679 985703 985709 985723 985729 985741 985759 
-985781 985783 985799 985807 985819 985867 985871 985877 985903 985921 985937 985951 
-985969 985973 985979 985981 985991 985993 985997 986023 986047 986053 986071 986101 
-986113 986131 986137 986143 986147 986149 986177 986189 986191 986197 986207 986213 
-986239 986257 986267 986281 986287 986333 986339 986351 986369 986411 986417 986429 
-986437 986471 986477 986497 986507 986509 986519 986533 986543 986563 986567 986569 
-986581 986593 986597 986599 986617 986633 986641 986659 986693 986707 986717 986719 
-986729 986737 986749 986759 986767 986779 986801 986813 986819 986837 986849 986851 
-986857 986903 986927 986929 986933 986941 986959 986963 986981 986983 986989 987013 
-987023 987029 987043 987053 987061 987067 987079 987083 987089 987097 987101 987127 
-987143 987191 987193 987199 987209 987211 987227 987251 987293 987299 987313 987353 
-987361 987383 987391 987433 987457 987463 987473 987491 987509 987523 987533 987541 
-987559 987587 987593 987599 987607 987631 987659 987697 987713 987739 987793 987797 
-987803 987809 987821 987851 987869 987911 987913 987929 987941 987971 987979 987983 
-987991 987997 988007 988021 988033 988051 988061 988067 988069 988093 988109 988111 
-988129 988147 988157 988199 988213 988217 988219 988231 988237 988243 988271 988279 
-988297 988313 988319 988321 988343 988357 988367 988409 988417 988439 988453 988459 
-988483 988489 988501 988511 988541 988549 988571 988577 988579 988583 988591 988607 
-988643 988649 988651 988661 988681 988693 988711 988727 988733 988759 988763 988783 
-988789 988829 988837 988849 988859 988861 988877 988901 988909 988937 988951 988963 
-988979 989011 989029 989059 989071 989081 989099 989119 989123 989171 989173 989231 
-989239 989249 989251 989279 989293 989309 989321 989323 989327 989341 989347 989353 
-989377 989381 989411 989419 989423 989441 989467 989477 989479 989507 989533 989557 
-989561 989579 989581 989623 989629 989641 989647 989663 989671 989687 989719 989743 
-989749 989753 989761 989777 989783 989797 989803 989827 989831 989837 989839 989869 
-989873 989887 989909 989917 989921 989929 989939 989951 989959 989971 989977 989981 
-989999 990001 990013 990023 990037 990043 990053 990137 990151 990163 990169 990179 
-990181 990211 990239 990259 990277 990281 990287 990289 990293 990307 990313 990323 
-990329 990331 990349 990359 990361 990371 990377 990383 990389 990397 990463 990469 
-990487 990497 990503 990511 990523 990529 990547 990559 990589 990593 990599 990631 
-990637 990643 990673 990707 990719 990733 990761 990767 990797 990799 990809 990841 
-990851 990881 990887 990889 990893 990917 990923 990953 990961 990967 990973 990989 
-991009 991027 991031 991037 991043 991057 991063 991069 991073 991079 991091 991127 
-991129 991147 991171 991181 991187 991201 991217 991223 991229 991261 991273 991313 
-991327 991343 991357 991381 991387 991409 991427 991429 991447 991453 991483 991493 
-991499 991511 991531 991541 991547 991567 991579 991603 991607 991619 991621 991633 
-991643 991651 991663 991693 991703 991717 991723 991733 991741 991751 991777 991811 
-991817 991867 991871 991873 991883 991889 991901 991909 991927 991931 991943 991951 
-991957 991961 991973 991979 991981 991987 991999 992011 992021 992023 992051 992087 
-992111 992113 992129 992141 992153 992179 992183 992219 992231 992249 992263 992267 
-992269 992281 992309 992317 992357 992359 992363 992371 992393 992417 992429 992437 
-992441 992449 992461 992513 992521 992539 992549 992561 992591 992603 992609 992623 
-992633 992659 992689 992701 992707 992723 992737 992777 992801 992809 992819 992843 
-992857 992861 992863 992867 992891 992903 992917 992923 992941 992947 992963 992983 
-993001 993011 993037 993049 993053 993079 993103 993107 993121 993137 993169 993197 
-993199 993203 993211 993217 993233 993241 993247 993253 993269 993283 993287 993319 
-993323 993341 993367 993397 993401 993407 993431 993437 993451 993467 993479 993481 
-993493 993527 993541 993557 993589 993611 993617 993647 993679 993683 993689 993703 
-993763 993779 993781 993793 993821 993823 993827 993841 993851 993869 993887 993893 
-993907 993913 993919 993943 993961 993977 993983 993997 994013 994027 994039 994051 
-994067 994069 994073 994087 994093 994141 994163 994181 994183 994193 994199 994229 
-994237 994241 994247 994249 994271 994297 994303 994307 994309 994319 994321 994337 
-994339 994363 994369 994391 994393 994417 994447 994453 994457 994471 994489 994501 
-994549 994559 994561 994571 994579 994583 994603 994621 994657 994663 994667 994691 
-994699 994709 994711 994717 994723 994751 994769 994793 994811 994813 994817 994831 
-994837 994853 994867 994871 994879 994901 994907 994913 994927 994933 994949 994963 
-994991 994997 995009 995023 995051 995053 995081 995117 995119 995147 995167 995173 
-995219 995227 995237 995243 995273 995303 995327 995329 995339 995341 995347 995363 
-995369 995377 995381 995387 995399 995431 995443 995447 995461 995471 995513 995531 
-995539 995549 995551 995567 995573 995587 995591 995593 995611 995623 995641 995651 
-995663 995669 995677 995699 995713 995719 995737 995747 995783 995791 995801 995833 
-995881 995887 995903 995909 995927 995941 995957 995959 995983 995987 995989 996001 
-996011 996019 996049 996067 996103 996109 996119 996143 996157 996161 996167 996169 
-996173 996187 996197 996209 996211 996253 996257 996263 996271 996293 996301 996311 
-996323 996329 996361 996367 996403 996407 996409 996431 996461 996487 996511 996529 
-996539 996551 996563 996571 996599 996601 996617 996629 996631 996637 996647 996649 
-996689 996703 996739 996763 996781 996803 996811 996841 996847 996857 996859 996871 
-996881 996883 996887 996899 996953 996967 996973 996979 997001 997013 997019 997021 
-997037 997043 997057 997069 997081 997091 997097 997099 997103 997109 997111 997121 
-997123 997141 997147 997151 997153 997163 997201 997207 997219 997247 997259 997267 
-997273 997279 997307 997309 997319 997327 997333 997343 997357 997369 997379 997391 
-997427 997433 997439 997453 997463 997511 997541 997547 997553 997573 997583 997589 
-997597 997609 997627 997637 997649 997651 997663 997681 997693 997699 997727 997739 
-997741 997751 997769 997783 997793 997807 997811 997813 997877 997879 997889 997891 
-997897 997933 997949 997961 997963 997973 997991 998009 998017 998027 998029 998069 
-998071 998077 998083 998111 998117 998147 998161 998167 998197 998201 998213 998219 
-998237 998243 998273 998281 998287 998311 998329 998353 998377 998381 998399 998411 
-998419 998423 998429 998443 998471 998497 998513 998527 998537 998539 998551 998561 
-998617 998623 998629 998633 998651 998653 998681 998687 998689 998717 998737 998743 
-998749 998759 998779 998813 998819 998831 998839 998843 998857 998861 998897 998909 
-998917 998927 998941 998947 998951 998957 998969 998983 998989 999007 999023 999029 
-999043 999049 999067 999083 999091 999101 999133 999149 999169 999181 999199 999217 
-999221 999233 999239 999269 999287 999307 999329 999331 999359 999371 999377 999389 
-999431 999433 999437 999451 999491 999499 999521 999529 999541 999553 999563 999599 
-999611 999613 999623 999631 999653 999667 999671 999683 999721 999727 999749 999763 
-999769 999773 999809 999853 999863 999883 999907 999917 999931 999953 999959 999961 
-999979 999983 } ;
diff --git a/libs/math/quaternions.factor b/libs/math/quaternions.factor
deleted file mode 100644 (file)
index 8a5fcd9..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
-
-! Everybody's favorite non-commutative skew field, the
-! quaternions!
-
-! Quaternions are represented as pairs of complex numbers,
-! using the identity: (a+bi)+(c+di)j = a+bi+cj+dk.
-USING: arrays kernel math sequences math-contrib ;
-IN: quaternions-internals
-
-: 2q [ first2 ] 2apply ; inline
-
-: q*a 2q swapd ** >r * r> - ; inline
-
-: q*b 2q >r ** swap r> * + ; inline
-
-IN: math-contrib
-
-: q* ( u v -- u*v )
-    #! Multiply quaternions.
-    [ q*a ] 2keep q*b 2array ;
-
-: qconjugate ( u -- u' )
-    #! Quaternion conjugate.
-    first2 neg >r conjugate r> 2array ;
-
-: qrecip ( u -- 1/u )
-    #! Quaternion inverse.
-    qconjugate dup norm-sq v/n ;
-
-: q/ ( u v -- u/v )
-    #! Divide quaternions.
-    qrecip q* ;
-
-: q*n ( q n -- q )
-    #! Note: you will get the wrong result if you try to
-    #! multiply a quaternion by a complex number on the right
-    #! using v*n. Use this word instead. Note that v*n with a
-    #! quaternion and a real is okay.
-    conjugate v*n ;
-
-: c>q ( c -- q )
-    #! Turn a complex number into a quaternion.
-    0 2array ;
-
-: v>q ( v -- q )
-    #! Turn a 3-vector into a quaternion with real part 0.
-    first3 rect> >r 0 swap rect> r> 2array ;
-
-: q>v ( q -- v )
-    #! Get the vector part of a quaternion, discarding the real
-    #! part.
-    first2 >r imaginary r> >rect 3array ;
-
-: cross ( u v -- u*v )
-    #! Cross product of two 3-vectors can be computed using
-    #! quaternion multiplication.
-    [ v>q ] 2apply q* q>v ;
-
-! Zero
-: q0 { 0 0 } ;
-
-! Units
-: q1 { 1 0 } ;
-: qi { C{ 0 1 } 0 } ;
-: qj { 0 1 } ;
-: qk { 0 C{ 0 1 } } ;
-
-! Euler angles -- see
-! http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/euleranglestoquaternions.html
-
-: (euler) ( theta unit -- q )
-    >r -0.5 * dup cos c>q swap sin r> n*v v- ;
-
-: euler ( phi theta psi -- q )
-    qk (euler) >r qj (euler) >r qi (euler) r> q* r> q* ;
-
diff --git a/libs/math/statistics.factor b/libs/math/statistics.factor
deleted file mode 100644 (file)
index cfb00c0..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-IN: math-contrib
-USING: kernel math sequences ;
-
-: mean ( seq -- n )
-    #! arithmetic mean, sum divided by length
-    [ sum ] keep length / ;
-
-: geometric-mean ( seq -- n )
-    #! geometric mean, nth root of product
-    [ product ] keep length swap nth-root ;
-
-: harmonic-mean ( seq -- n )
-    #! harmonic mean, reciprocal of sum of reciprocals.
-    #! positive reals only
-    0 [ recip + ] reduce recip ;
-
-: median ( seq -- n )
-    #! middle number if odd, avg of two middle numbers if even
-    natural-sort dup length dup even? [
-        1- 2 / swap [ nth ] 2keep >r 1+ r> nth + 2 /
-    ] [
-        2 / swap nth
-    ] if ;
-
-: range ( seq -- n )
-    #! max - min
-    minmax swap - ;
-
-: var ( seq -- x )
-    #! variance, normalize by N-1
-    dup length 1- dup zero? [
-        0 2nip
-    ] [
-        swap [ mean ] keep 0 [ pick - sq + ] reduce nip swap /
-    ] if ;
-
-: std ( seq -- x )
-    #! standard deviation, sqrt of variance
-    var sqrt ;
diff --git a/libs/math/test.factor b/libs/math/test.factor
deleted file mode 100644 (file)
index 5a42b07..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-IN: temporary
-USING: kernel math test sequences math-contrib ;
-
-! Tests
-[ { 0 1 } ] [ { 0 1 0 0 } ptrim ] unit-test
-[ { 1 } ] [ { 1 0 0 } ptrim ] unit-test
-[ { 0 } ] [ { 0 } ptrim ] unit-test
-[ { 3 10 8 } ] [ { 1 2 } { 3 4 } p* ] unit-test
-[ { 3 10 8 } ] [ { 3 4 } { 1 2 } p* ] unit-test
-[ { 0 0 0 0 0 0 0 0 0 0 } ] [ { 0 0 0 } { 0 0 0 0 0 0 0 0 } p* ] unit-test
-[ { 0 1 } ] [ { 0 1 } { 1 } p* ] unit-test
-[ { 0 } ] [ { } { } p* ] unit-test
-[ { 0 } ] [ { 0 } { } p* ] unit-test
-[ { 0 } ] [ { } { 0 } p* ] unit-test
-[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p+ ] unit-test
-[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p- ] unit-test
-[ { 0 0 0 } ] [ 4 { 0 0 0 } n*p ] unit-test
-[ { 4 8 0 12 } ] [ 4 { 1 2 0 3 } n*p ] unit-test
-[ { 1 4 7 6 0 0 0 0 0 } ] [ { 1 2 3 0 0 0 } { 1 2 0 0 } p* ] unit-test
-[ V{ 7 -2 1 } V{ -20 0 0 } ] [ { 1 1 1 1 } { 3 1 } p/mod ] unit-test
-[ V{ 0 0 } V{ 1 1 } ] [ { 1 1 } { 1 1 1 1 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 0 0 0 0 0 0 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 0 0 0 0 } { 1 1 0 0 } p/mod ] unit-test
-[ V{ 5.0 } V{ 0.0 } ] [ { 10.0 } { 2.0 } p/mod ] unit-test
-[ V{ 15/16 } V{ 0 } ] [ { 3/4 } { 4/5 } p/mod ] unit-test
-[ t ] [ { 0 1 } { 0 1 0 } p= ] unit-test
-[ f ] [ { 0 0 1 } { 0 1 0 } p= ] unit-test
-[ t ] [ { 1 1 1 } { 1 1 1 } p= ] unit-test
-[ { 0 0 } { 1 1 } ] [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test
-
-[ t ] [ 10 3 nPk 10 factorial 7 factorial / = ] unit-test
-[ t ] [ 10 3 nCk 10 factorial 3 factorial 7 factorial * / = ] unit-test
-[ { 3 7 9 0 5 2 6 8 1 4 } ] [ { 3 8 5 0 9 4 6 1 7 2 } inverse-permutation ] unit-test
-[ { } ] [ { } inverse-permutation ] unit-test
-[ 1 ] [ 0 factorial ] unit-test
-[ 1 ] [ 1 factorial ] unit-test
-[ 2 ] [ 2 factorial ] unit-test
-[ 120 ] [ 5 factorial ] unit-test
-[ 3628800 ] [ 10 factorial ] unit-test
-[ 1 ] [ 1 0 1 factorial-part ] unit-test
-[ 2 ] [ 1 1 2 factorial-part ] unit-test
-[ 1 ] [ 1 1 1 factorial-part ] unit-test
-[ 3628800 ] [ 120 5 10 factorial-part ] unit-test
-[ 1 ] [ 2 2 nCk ] unit-test
-[ 2 ] [ 2 2 nPk ] unit-test
-[ 1 ] [ 2 0 nCk ] unit-test
-[ 1 ] [ 2 0 nPk ] unit-test
-[ t ] [ -9000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
-[ t ] [ -1.5 gamma 2.363271801207344 almost= ] unit-test
-[ t ] [ -1 gamma 1/0. = ] unit-test
-[ t ] [ -0.5 gamma -3.544907701811 almost= ] unit-test
-[ t ] [ 0 gamma 1/0. = ] unit-test
-[ t ] [ .5 gamma 1.7724538 almost= ] unit-test
-[ t ] [ 1 gamma 1 almost= ] unit-test
-[ t ] [ 2 gamma 1 almost= ] unit-test
-[ t ] [ 3 gamma 2 almost= ] unit-test
-[ t ] [ 11 gamma 3628800.000015679 almost= ] unit-test
-[ t ] [ 90000000000000000000000000000000000000000000 gamma 1/0. = ] unit-test
-! some fun identities
-[ t ] [ 2/3 gamma 2 pi * 3 sqrt 1/3 gamma * / almost= ] unit-test
-[ t ] [ 3/4 gamma 2 sqrt pi * 1/4 gamma / almost= ] unit-test
-[ t ] [ 4/5 gamma 2 5 sqrt / 2 + sqrt pi * 1/5 gamma / almost= ] unit-test
-[ t ] [ 3/5 gamma 2 2 5 sqrt / - sqrt pi * 2/5 gamma / almost= ] unit-test
-[ t ] [ -90000000000000000000000000000000000000000000 gammaln 1/0. = ] unit-test
-[ t ] [ -1.5 gammaln 1/0. = ] unit-test
-[ t ] [ -1 gammaln 1/0. = ] unit-test
-[ t ] [ -0.5 gammaln 1/0. = ] unit-test
-! [ t ] [ 0 gammaln 1/0. = ] unit-test
-[ t ] [ .5 gammaln 0.57236494 almost= ] unit-test
-[ t ] [ 1 gammaln 0 almost= ] unit-test
-[ t ] [ 2 gammaln 0 almost= ] unit-test
-[ t ] [ 3 gammaln 0.693147180 almost= ] unit-test
-[ t ] [ 11 gammaln 15.1044125 almost= ] unit-test
-[ t ] [ 9000000000000000000000000000000000000000000 gammaln 8.811521863477754e+44 almost= ] unit-test
-
-[ 1 ] [ qi norm ] unit-test
-[ 1 ] [ qj norm ] unit-test
-[ 1 ] [ qk norm ] unit-test
-[ 1 ] [ q1 norm ] unit-test
-[ 0 ] [ q0 norm ] unit-test
-[ t ] [ qi qj q* qk = ] unit-test
-[ t ] [ qj qk q* qi = ] unit-test
-[ t ] [ qk qi q* qj = ] unit-test
-[ t ] [ qi qi q* q1 v+ q0 = ] unit-test
-[ t ] [ qj qj q* q1 v+ q0 = ] unit-test
-[ t ] [ qk qk q* q1 v+ q0 = ] unit-test
-[ t ] [ qi qj qk q* q* q1 v+ q0 = ] unit-test
-[ t ] [ i qj n*v qk = ] unit-test
-[ t ] [ qj i q*n qk v+ q0 = ] unit-test
-[ t ] [ qk qj q/ qi = ] unit-test
-[ t ] [ qi qk q/ qj = ] unit-test
-[ t ] [ qj qi q/ qk = ] unit-test
-[ t ] [ qi q>v v>q qi = ] unit-test
-[ t ] [ qj q>v v>q qj = ] unit-test
-[ t ] [ qk q>v v>q qk = ] unit-test
-[ t ] [ 1 c>q q1 = ] unit-test
-[ t ] [ i c>q qi = ] unit-test
-
-[
-    { { 0 } { 0 } { 0 } }
-] [
-    3 1 zero-matrix
-] unit-test
-
-[
-    { { 1 0 0 }
-       { 0 1 0 }
-       { 0 0 1 } }
-] [
-    3 identity-matrix
-] unit-test
-
-[
-    { { 1 0 4 }
-       { 0 7 0 }
-       { 6 0 3 } }
-] [
-    { { 1 0 0 }
-       { 0 2 0 }
-       { 0 0 3 } }
-       
-    { { 0 0 4 }
-       { 0 5 0 }
-       { 6 0 0 } }
-
-    m+
-] unit-test
-
-[
-    { { 1 0 4 }
-       { 0 7 0 }
-       { 6 0 3 } }
-] [
-    { { 1 0 0 }
-       { 0 2 0 }
-       { 0 0 3 } }
-       
-    { { 0 0 -4 }
-       { 0 -5 0 }
-       { -6 0 0 } }
-
-    m-
-] unit-test
-
-[
-    { 10 20 30 }
-] [
-    10 { 1 2 3 } n*v
-] unit-test
-
-[
-    { 3 4 }
-] [
-    { { 1 0 }
-       { 0 1 } }
-
-    { 3 4 }
-
-    m.v
-] unit-test
-
-[
-    { 4 3 }
-] [
-    { { 0 1 }
-       { 1 0 } }
-
-    { 3 4 }
-
-    m.v
-] 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
-
-[ { { 1 2 } { 3 4 } { 5 6 } } ]
-[ { { 1 2 } { 3 4 } { 5 6 } } flip flip ]
-unit-test
-
-[ { { 1 3 5 } { 2 4 6 } } ]
-[ { { 1 3 5 } { 2 4 6 } } flip flip ]
-unit-test
-
-[ { { 1 3 5 } { 2 4 6 } } ]
-[ { { 1 2 } { 3 4 } { 5 6 } } flip ]
-unit-test
-
-[
-    { { 6 } }
-] [
-    { { 3 } } { { 2 } } m.
-] unit-test
-
-[
-    { { 11 } }
-] [
-    { { 1 3 } } { { 5 } { 2 } } m.
-] unit-test
-
-[
-    { { 28 } }
-] [
-    { { 2 4 6 } }
-
-    { { 1 }
-       { 2 }
-       { 3 } }
-    
-    m.
-] unit-test
-
-[ 1 ] [ { 1 } mean ] unit-test
-[ 3/2 ] [ { 1 2 } mean ] unit-test
-[ 0 ] [ { 0 0 0 } geometric-mean ] unit-test
-[ t ] [ { 2 2 2 2 } geometric-mean 2.0 almost= ] unit-test
-[ 1 ] [ { 1 1 1 } geometric-mean ] unit-test
-[ 1/3 ] [ { 1 1 1 } harmonic-mean ] unit-test
-
-[ 0 ] [ { 1 } range ] unit-test
-[ 89 ] [ { 1 2 30 90 } range ] unit-test
-[ 2 ] [ { 1 2 3 } median ] unit-test
-[ 5/2 ] [ { 1 2 3 4 } median ] unit-test
-
-[ 1 ] [ { 1 2 3 } var ] unit-test
-[ 1 ] [ { 1 2 3 } std ] unit-test
-
-[ t ] [ { 23.2 33.4 22.5 66.3 44.5 } std 18.1906 - .0001 < ] unit-test
-
-[ 0 ] [ { 1 } var ] unit-test
-[ 0 ] [ { 1 } std ] unit-test
-
-[ -2 ] [ 5 7 mod-inv ] unit-test
-[ -53889431 ] [ 234829342 342389423843 mod-inv ] unit-test
diff --git a/libs/math/utils.factor b/libs/math/utils.factor
deleted file mode 100644 (file)
index e12a5ed..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-IN: math-contrib
-USING: errors kernel sequences math sequences-internals namespaces arrays ;
-
-: deg>rad pi * 180 / ; inline
-: rad>deg 180 * pi / ; inline
-
-: lcm ( a b -- c )
-    #! Smallest integer such that c/a and c/b are both integers.
-    [ * ] 2keep gcd nip /i ; foldable
-
-: mod-inv ( x n -- y )
-    #! Compute the multiplicative inverse of x mod n.
-    gcd 1 = [ "Non-trivial divisor found" throw ] unless ;
-    foldable
-
-: each-bit ( n quot -- )
-    over zero? pick -1 number= or [
-        2drop
-    ] [
-        2dup >r >r >r 1 bitand r> call r> -1 shift r> each-bit
-    ] if ; inline
-
-: (^mod) ( n z w -- z^w )
-    1 swap [
-        1 number= [ dupd * pick mod ] when >r sq over mod r>
-    ] each-bit 2nip ; inline
-
-: ^mod ( z w n -- z^w )
-    #! Compute z^w mod n.
-    over 0 < [
-        [ >r neg r> ^mod ] keep mod-inv
-    ] [
-        -rot (^mod)
-    ] if ; foldable
-
-: powers ( n x -- seq )
-    #! Output sequence has n elements, { 1 x x^2 x^3 ... }
-    <array> 1 [ * ] accumulate nip ;
-
-: ** ( u v -- u*v' ) conjugate * ; inline
-
-: c. ( v v -- x )
-    #! Complex inner product.
-    0 [ ** + ] 2reduce ;
-
-: proj ( u v -- w )
-    #! Orthogonal projection of u onto v.
-    [ [ v. ] keep norm-sq v/n ] keep n*v ;
-
-: minmax ( seq -- min max )
-    #! find the min and max of a seq in one pass
-    1./0. -1./0. rot [ dup pick max -rot nip pick min -rot nip ] each ;
-
-: absminmax ( seq -- min max )
-    #! find the absolute values of the min and max of a seq in one pass
-    minmax 2dup [ abs ] 2apply > [ swap ] when ;
-
-SYMBOL: almost=-precision .000001 almost=-precision set-global
-: almost= ( a b -- bool )
-    - abs almost=-precision get < ;
-
-TUPLE: frange from step length ;
-
-C: frange ( from step to -- seq )
-    #! example: 0 .01 10 <frange> >array
-    >r pick - swap [ / ceiling 1+ >bignum ] keep r> 
-    [ set-frange-step ] keep
-    [ set-frange-length ] keep
-    [ set-frange-from ] keep ;
-
-: <frange-no-endpt> ( from step to -- seq )
-    over - <frange> ;
-
-M: frange length ( frange -- n ) frange-length ;
-M: frange nth ( n frange -- obj ) [ frange-step * ] keep frange-from + ;
-
-: frange-range ( frange -- range )
-    [ frange-step ] keep frange-length 1- * ;
-
-SYMBOL: step-size .01 step-size set-global  ! TODO: base on arguments
-: (limit) ( count diff quot -- x quot )
-    pick 10 > [ "Not converging fast enough" throw ] when
-    [ call ] keep >r 2dup swap - 0 < [ "not converging" throw ] when
-    2dup almost= rot drop r>
-    swap [ step-size [ 2 / ] change rot 1+ -rot (limit) ] unless ;
-
-: limit ( quot -- x )
-    .1 step-size set [ call ] keep
-    step-size [ 2 / ] change 0 -rot (limit) 2drop ;
-
-: nth-rand ( seq -- elem ) [ length random-int ] keep nth ;
-
diff --git a/libs/parser-combinators/load.factor b/libs/parser-combinators/load.factor
deleted file mode 100644 (file)
index 2d1175a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-REQUIRES: libs/lazy-lists libs/sequences ;
-PROVIDE: libs/parser-combinators
-{ +files+ {
-    "parser-combinators.factor"
-} }
-{ +tests+ {
-    "tests.factor"
-} } ;
\ No newline at end of file
diff --git a/libs/parser-combinators/parser-combinators.factor b/libs/parser-combinators/parser-combinators.factor
deleted file mode 100644 (file)
index 82af77c..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-! Copyright (C) 2004 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-USING: lazy-lists kernel sequences sequences-contrib strings math io arrays errors namespaces ;
-IN: parser-combinators
-
-! Parser combinator protocol
-GENERIC: (parse) ( input parser -- list )
-
-M: promise (parse) ( input parser -- list )
-  force (parse) ;
-
-LAZY: parse ( input parser -- promise )
-  (parse) ;
-
-TUPLE: parse-result parsed unparsed ;
-TUPLE: token-parser string ;
-
-LAZY: token ( string -- parser )
-  <token-parser> ;
-
-M: token-parser (parse) ( input parser -- list )
-  token-parser-string swap over ?head-slice [
-    <parse-result> 1list    
-  ] [
-    2drop nil
-  ] if ;
-
-TUPLE: satisfy-parser quot ;
-
-LAZY: satisfy ( quot -- parser )
-  <satisfy-parser> ;
-
-M: satisfy-parser (parse) ( input parser -- list )
-  #! A parser that succeeds if the predicate,
-  #! when passed the first character in the input, returns
-  #! true.
-  over empty? [
-    2drop nil
-  ] [
-    satisfy-parser-quot >r unclip-slice dup r> call [
-      swap <parse-result> 1list
-    ] [
-      2drop nil
-    ] if 
-  ] if ;
-
-TUPLE: epsilon-parser ;
-
-LAZY: epsilon ( -- parser )
-  <epsilon-parser> ;
-
-M: epsilon-parser (parse) ( input parser -- list )
-  #! A parser that parses the empty string. It
-  #! does not consume any input and always returns
-  #! an empty list as the parse tree with the
-  #! unmodified input.
-  drop "" swap <parse-result> 1list ;
-
-TUPLE: succeed-parser result ;
-
-LAZY: succeed ( result -- parser )
-  <succeed-parser> ;
-
-M: succeed-parser (parse) ( input parser -- list )
-  #! A parser that always returns 'result' as a
-  #! successful parse with no input consumed.  
-  succeed-parser-result swap <parse-result> 1list ;
-
-TUPLE: fail-parser ;
-
-LAZY: fail ( -- parser )
-  <fail-parser> ;
-
-M: fail-parser (parse) ( input parser -- list )
-  #! A parser that always fails and returns
-  #! an empty list of successes.
-  2drop nil ;
-
-TUPLE: and-parser p1 p2 ;
-
-LAZY: <&> ( parser1 parser2 -- parser )
-  <and-parser> ;
-
-M: and-parser (parse) ( input parser -- list )
-  #! Parse 'input' by sequentially combining the
-  #! two parsers. First parser1 is applied to the
-  #! input then parser2 is applied to the rest of
-  #! the input strings from the first parser. 
-  [ and-parser-p1 ] keep and-parser-p2 -rot parse [
-    dup parse-result-unparsed rot parse
-    [
-      >r parse-result-parsed r>
-      [ parse-result-parsed 2array ] keep
-      parse-result-unparsed <parse-result>
-    ] lmap-with
-  ] lmap-with lconcat ;  
-
-TUPLE: or-parser p1 p2 ;
-
-LAZY: <|> ( parser1 parser2 -- parser )
-  <or-parser> ;
-
-M: or-parser (parse) ( input parser1 -- list )
-  #! Return the combined list resulting from the parses
-  #! of parser1 and parser2 being applied to the same
-  #! input. This implements the choice parsing operator.
-  [ or-parser-p1 ] keep or-parser-p2 >r dupd parse swap r> parse lappend ;
-
-: ltrim-slice ( string -- string )
-  #! Return a new string without any leading whitespace
-  #! from the original string.
-  dup empty? [
-    dup first blank? [ 1 tail-slice ltrim-slice ] when 
-  ] unless ;
-
-TUPLE: sp-parser p1 ;
-
-LAZY: sp ( p1 -- parser )
-  #! Return a parser that first skips all whitespace before
-  #! calling the original parser.
-  <sp-parser> ;
-
-M: sp-parser (parse) ( input parser -- list )
-  #! Skip all leading whitespace from the input then call
-  #! the parser on the remaining input.
-  >r ltrim-slice r> sp-parser-p1 parse ;
-
-TUPLE: just-parser p1 ;
-
-LAZY: just ( p1 -- parser )
-  <just-parser> ;
-
-M: just-parser (parse) ( input parser -- result )
-  #! Calls the given parser on the input removes
-  #! from the results anything where the remaining
-  #! input to be parsed is not empty. So ensures a 
-  #! fully parsed input string.
-  just-parser-p1 parse [ parse-result-unparsed empty? ] lsubset ;
-
-TUPLE: apply-parser p1 quot ;
-
-LAZY: <@ ( parser quot -- parser )
-  <apply-parser> ;
-
-M: apply-parser (parse) ( input parser -- result )
-  #! Calls the parser on the input. For each successfull
-  #! parse the quot is call with the parse result on the stack.
-  #! The result of that quotation then becomes the new parse result.
-  #! This allows modification of parse tree results (like
-  #! converting strings to integers, etc).
-  [ apply-parser-p1 ] keep apply-parser-quot 
-  -rot parse [ 
-    [ parse-result-parsed swap call ] keep
-    parse-result-unparsed <parse-result>
-  ] lmap-with ;
-
-TUPLE: some-parser p1 ;
-
-LAZY: some ( p1 -- parser )
-  <some-parser> ;
-
-M: some-parser (parse) ( input parser -- result )
-  #! Calls the parser on the input, guarantees
-  #! the parse is complete (the remaining input is empty),
-  #! picks the first solution and only returns the parse
-  #! tree since the remaining input is empty.
-  some-parser-p1 just parse car parse-result-parsed ;
-
-
-LAZY: <& ( parser1 parser2 -- parser )
-  #! Same as <&> except discard the results of the second parser.
-  <&> [ first ] <@ ;
-
-LAZY: &> ( parser1 parser2 -- parser )
-  #! Same as <&> except discard the results of the first parser.
-  <&> [ second ] <@ ;
-
-LAZY: <:&> ( parser1 parser2 -- result )
-  #! Same as <&> except flatten the result.
-  <&> [ dup second swap first [ % , ] { } make ] <@ ;
-
-LAZY: <&:> ( parser1 parser2 -- result )
-  #! Same as <&> except flatten the result.
-  <&> [ dup second swap first [ , % ] { } make ] <@ ;
-
-LAZY: <*> ( parser -- parser )
-  dup <*> <&:> { } succeed <|> ;
-
-LAZY: <+> ( parser -- parser )
-  #! Return a parser that accepts one or more occurences of the original
-  #! parser.
-  dup <*> <&:> ;
-
-LAZY: <?> ( parser -- parser )
-  #! Return a parser that optionally uses the parser
-  #! if that parser would be successfull.
-  [ 1array ] <@ f succeed <|> ;
-
-TUPLE: only-first-parser p1 ;
-LAZY: only-first ( parser -- parser )
-  <only-first-parser> ;
-
-M: only-first-parser (parse) ( input parser -- list )
-  #! Transform a parser into a parser that only yields
-  #! the first possibility.
-  only-first-parser-p1 parse 1 swap ltake ;
-
-LAZY: <!*> ( parser -- parser )
-  #! Like <*> but only return one possible result
-  #! containing all matching parses. Does not return
-  #! partial matches. Useful for efficiency since that's
-  #! usually the effect you want and cuts down on backtracking
-  #! required.
-  <*> only-first ;
-
-LAZY: <!+> ( parser -- parser )
-  #! Like <+> but only return one possible result
-  #! containing all matching parses. Does not return
-  #! partial matches. Useful for efficiency since that's
-  #! usually the effect you want and cuts down on backtracking
-  #! required.
-  <+> only-first ;
-
-LAZY: <!?> ( parser -- parser )
-  #! Like <?> but only return one possible result
-  #! containing all matching parses. Does not return
-  #! partial matches. Useful for efficiency since that's
-  #! usually the effect you want and cuts down on backtracking
-  #! required.
-  <?> only-first ;
diff --git a/libs/parser-combinators/parser-combinators.html b/libs/parser-combinators/parser-combinators.html
deleted file mode 100644 (file)
index 33aeaba..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-<html>
-  <head>
-    <title>Parser Combinators</title>
-    <link rel="stylesheet" type="text/css" href="style.css">
-      </head>
-  <body>
-    <h1>Parsers</h1>
-<p class="note">The parser combinator library described here is based
-  on a library written for the Clean pure functional programming language and
-  described in chapter 5 of the 'Clean Book' (<a
-  href="ftp://ftp.cs.kun.nl/pub/Clean/papers/cleanbook/II.05.ParserCombinators.pdf">PDF
-  available here</a>). Based on the description
-  in that chapter I developed a version for Factor, a concatenative
-  language.</p>  
-<p>A parser is a word or quotation that, when called, processes
-   an input string on the stack, performs some parsing operation on
-   it, and returns a result indicating the success of the parsing
-   operation.</p> 
-<p>The result returned by a parser is known as a 'list of
-successes'. It is a lazy list of standard Factor cons cells. Each cons
-cell is a result of a parse. The car of the cell is the remaining
-input left to be parsed and the cdr of the cell is the result of the
-parsing operation.</p>
-<p>A lazy list is used for the result as a parse operation can potentially
-return many successful results. For example, a parser that parses one
-or more digits will return more than one result for the input "123". A
-successful parse could be "1", "12" or "123".</p>
-<p>The list is lazy so if only one parse result is required the
-remaining results won't actually be processed if they are not
-requested. This improves efficiency.</p>
-<p>The cdr of the result pair can be any value that the parser wishes
-to return. It could be the successful portion of the input string
-parsed, an abstract syntax tree representing the parsed input, or even
-a quotation that should get called for later processing.</p>
-<p>A Parser Combinator is a word that takes one or more parsers and
-returns a parser that when called uses the original parsers in some
-manner.</p>
-<h1>Example Parsers</h1>
-<p>The following are some very simple parsers that demonstrate how
-general parsers work and the 'list of sucesses' that are returned as a
-result.</p>
-<pre class="code">
-  (1) : char-a ( inp -- result )
-        0 over string-nth CHAR: a = [
-          1 swap string-tail CHAR: a cons unit delay lunit
-        ] [
-          drop lnil
-        ] ifte ;
-  (2) "atest" char-a [ [ . ] leach ] when*
-      =&gt; [[ "test" 97 ]]
-  (3) "test"  char-a [ [ . ] leach ] when*
-      =&gt;
-</pre>
-<p>'char-a' is a parser that only accepts the character 'a' in the
-input string. When passed an input string with a string with a leading
-'a' then the 'list of successes' has 1 result value. The cdr of that
-result value is the character 'a' successfully parsed, and the car is
-the remaining input string. On failure of the parse an empty list is
-returned.</p> 
-<p>The parser combinator library provides a combinator, &lt;&amp;&gt;, that takes
-two parsers off the stack and returns a parser that calls the original
-two in sequence. An example of use would be calling 'char-a' twice,
-which would then result in an input string expected with two 'a'
-characters leading:</p>
-<pre class="code">
-  (1) "aatest" [ char-a ] [ char-a ] &lt;&amp;&gt; call
-      =&gt; < list of successes >
-  (2) [ . ] leach
-      =&gt; [[ "test" [[ 97 97 ]] ]]
-</pre>
-<h2>Tokens</h2>
-<p>Creating parsers for specfic characters and tokens can be a chore
-so there is a word that, given a string token on the stack, returns
-a parser that parses that particular token:</p>
-<pre class="code">
-  (1) "begin" token 
-      =&gt; < a parser that parses the token "begin" >
-  (2) dup "this should fail" swap call lnil? .
-      =&gt; t
-  (3) "begin a successfull parse" swap call 
-      =&gt; < lazy list >
-  (4) [ . ] leach
-      =&gt; [[ " a successfull parse" "begin" ]]
-</pre>
-<h2>Predicate matching</h2>
-<p>The word 'satisfy' takes a quotation from the top of the stack and
-returns a parser than when called will call the quotation with the
-first item in the input string on the stack. If the quotation returns
-true then the parse is successful, otherwise it fails:</p>
-<pre class="code">
-  (1) : digit-parser ( -- parser )
-        [ digit? ] satisfy ;
-  (2) "5" digit-parser call [ . ] leach
-      =&gt; [[ "" 53 ]]
-  (3) "a" digit-parser call lnil? .
-      =&gt; t
-</pre>
-<p>Note that 'digit-parser' returns a parser, it is not the parser
-itself. It is really a parser generating word like 'token'. Whereas
-our 'char-a' word defined originally was a parser itself.</p>
-<h2>Zero or more matches</h2>
-<p>Now that we can parse single digits it would be nice to easily
-parse a string of them. The '<*>' parser combinator word will do
-this. It accepts a parser on the top of the stack and produces a
-parser that parses zero or more of the constructs that the original
-parser parsed. The result of the '<*>' generated parser will be a list
-of the successful results returned by the original parser.</p>
-<pre class="code">
-  (1) digit-parser <*>
-      =&gt; < parser >
-  (2) "123" swap call
-      =&gt; < lazy list >
-  (3) [ . ] leach
-      =&gt; [ "" [ 49 50 51 ] ]
-           [ "3" [ 49 50 ] ]
-           [ "23" [ 49 ] ]
-           [ "123" ]
-</pre>
-<p>In this case there are multiple successful parses. This is because
-the occurrence of zero or more digits happens more than once. There is
-also the 'f' case where zero digits is parsed. If only the 'longest
-match' is required then the lcar of the lazy list can be used and the
-remaining parse results are never produced.</p>
-<h2>Manipulating parse trees</h2>
-<p>The result of the previous parse was the list of characters
-parsed. Sometimes you want this to be something else, like an abstract
-syntax tree, or some calculation. For the digit case we may want the
-actual integer number.</p>
-<p>For this we can use the '&lt;@' parser
-combinator. This combinator takes a parser and a quotation on the
-stack and returns a new parser. When the new parser is called it will
-call the original parser to produce the results, then it will call the
-quotation on each successfull result, and the result of that quotation
-will be the result of the parse:</p>
-<pre class="code">
-  (1) : digit-parser2 ( -- parser )
-        [ digit? ] satisfy [ digit> ] &lt;@ ;
-  (2) "5" digit-parser2 call [ . ] leach
-      =&gt; [[ "" 5 ]]
-</pre>
-<p>Notice that now the result is the actual integer '5' rather than
-character code '53'.</p>
-<pre class="code">
-  (1) : digit-list>number ( list -- number )
-         #! Converts a list of digits to a number
-         [ >digit ] map >string dup empty? [ 
-           drop 0 
-         ] [
-          str>number 
-         ]  ifte ;
-  (2) : natural-parser ( -- parser )
-        digit-parser2 <*> [ car digit-list>number unit  ] &lt;@  ;
-  (3) "123" natural-parser call
-      =&gt; < lazy list >
-  (4) [ . ] leach
-      =&gt; [ "" 123 ]
-           [ "3" 12 ]
-           [ "23" 1 ]
-           [ "123" 0 ]
-           [ [ 123 ] | "" ]
-</pre>
-<p>The number parsed is the actual integer number due to the operation
-of the '&lt;@' word. This allows parsers to not only parse the input
-string but perform operations and transformations on the syntax tree
-returned.</p>
-<p>A useful debugging method to work out what to use in the quotation
-passed to &lt;@ is to write an initial version of the parser that just
-displays the topmost item on the stack:</p>
-<pre class="code">
-  (1) : natural-parser-debug ( -- parser )
-        digit-parser2 <*> [ "debug: " write dup . ] &lt;@  ;
-  (3) "123" natural-parser-debug call lcar .
-      =&gt; debug: [ [ 1 2 3 ] ]
-           [ "" [ 1 2 3 ] ]
-</pre>
-<p>From the debug output we can see how to manipulate the result to
-get what we want. In this case it's the quotation in the previous example.</p>
-<h2>Sequential combinator</h2>
-<p>To create a full grammar we need a parser combinator that does
-sequential compositions. That is, given two parsers, the sequential
-combinator will first run the first parser, and then run the second on
-the remaining text to be parsed. As the first parser returns a lazy
-list, the second parser will be run on each item of the lazy list. Of
-course this is done lazily so it only ends up being done when those
-list items are requested. The sequential combinator word is &lt;&amp;&gt;.</p>
-<pre class="code">
-  ( 1 ) "number:" token 
-       =&gt; < parser that parses the text 'number:' >
-  ( 2 ) natural-parser
-       =&gt; < parser that parses natural numbers >
-  ( 3 ) &lt;&amp;&gt;
-       =&gt; < parser that parses 'number:' followed by a natural >
-  ( 4 ) "number:100" swap call
-       =&gt; < list of successes >
-  ( 5 ) [ . ] leach
-       =&gt; [ "" "number:" 100 ]
-            [ "0" "number:" 10 ]
-            [ "00" "number:" 1 ]
-            [ "100" "number:" 0 ]
-</pre>
-<p>In this  example we might prefer not to have the parse result
-contain the token, we want just the number. Two alternatives to &lt;&amp;&gt;
-provide the ability to select which result to use from the two
-parsers. These operators are &lt;&amp; and &amp;&gt;. The &lt; or &gt; points 
-in the direction of which parser to retain the results from. So our
-example above could be:</p>
-<pre class="code">
-  ( 1 ) "number:" token 
-       =&gt; < parser that parses the text 'number:' >
-  ( 2 ) natural-parser
-       =&gt; < parser that parses natural numbers >
-  ( 3 ) &amp;&gt;
-       =&gt; < parser that parses 'number:' followed by a natural >
-  ( 4 ) "number:100" swap call
-       =&gt; < list of successes >
-  ( 5 ) [ . ] leach
-       =&gt; [ "" 100 ]
-            [ "0" 10 ]
-            [ "00" 1 ]
-            [ "100" 0 ]
-</pre>
-<p>Notice how the parse result only contains the number due to &&gt;
-being used to retain the result of the second parser.</p>
-
-<h2>Choice combinator</h2>
-<p>As well as a sequential combinator we need an alternative
-combinator. The word for this is &lt;|&gt;. It takes two parsers from the
-stack and returns a parser that will first try the first parser. If it
-succeeds then the result for that is returned. If it fails then the
-second parser is tried and its result returned.</p>
-<pre class="code">
-  ( 1 ) "one" token
-        =&gt; < parser that parses the text 'one' >
-  ( 2 ) "two" token 
-        =&gt; < parser that parses the text 'two' >
-  ( 3 ) &lt;|&gt;
-        =&gt; < parser that parses 'one' or 'two' >
-  ( 4 ) "one" over call [ . ] leach
-        =&gt; [[ "" "one" ]]
-  ( 5 ) "two" swap call [ . ] leach
-        =&gt; [[ "" "two" ]]
-</pre>
-
-<h2>Option combinator</h2>
-<p>The option combinator, &lt;?&gt; allows adding optional elements to
-a parser. It takes one parser off the stack and if the parse succeeds
-add it to the result tree, otherwise it will ignore it and
-continue. The example below extends our natural-parser to parse
-integers with an optional leading minus sign.</p>
-<pre class="code">
-  ( 1 ) : integer-parser
-          "-" token &lt;?&gt; natural-parser &lt;&amp;&gt; ;
-  ( 2 ) "200" integer-parser call [ . ] leach 
-       =&gt; [ "" [ ] 200 ]
-            [ "0" [ ] 20 ]
-            [ "00" [ ] 2 ]
-            [ "200" [ ] 0 ]
-  ( 3 ) "-200" integer-parser call [ . ] leach
-       =&gt; [ "" [ "-" ] 200 ]
-            [ "0" [ "-" ] 20 ]
-            [ "00" [ "-" ] 2 ]
-            [ "200" [ "-" ] 0 ]
-            [ "-200" [ ] 0 ]
-  ( 4 ) : integer-parser2
-          integer-parser [ uncons swap [ car -1 * ] when ] &lt;@ ;
-  ( 5 ) "200" integer-parser2 call [ . ] leach 
-       =&gt; [ "" 200 ]
-            [ "0" 20 ]
-            [ "00" 2 ]
-            [ "200" 0 ]
-  ( 6 ) "-200" integer-parser2 call [ . ] leach
-       =&gt; [ "" -200 ]
-            [ "0" -20 ]
-            [ "00" -2 ]
-            [ "200" 0 ]
-            [ "-200" 0 ]
-
-</pre>
-
-<h2>Skipping Whitespace</h2>
-<p>A parser transformer exists, the word 'sp', that takes an existing
-parser and returns a new one that will first skip any whitespace
-before calling the original parser. This makes it easy to write
-grammers that avoid whitespace without having to explicitly code it
-into the grammar.</p>
-<pre class="code">
-  ( 1 ) "  123" natural-parser call [ . ] leach
-        =&gt; [ "  123" 0 ]
-  ( 2 ) "  123" natural-parser sp call [ . ] leach
-        =&gt; [ "" 123 ]
-             [ "3" 12 ]
-             [ "23" 1 ]
-             [ "123" 0 ]
-</pre>
-<h2>Eval grammar example</h2>
-<p>This example presents a simple grammar that will parse a number
-followed by an operator and another number. A factor expression that
-computes the entered value will be executed.</p>
-<pre class="code">
-  ( 1 ) natural-parser
-        =&gt; < a parser for natural numbers >
-  ( 2 ) "/" token "*" token "+" token "-" token &lt;|&gt; &lt;|&gt; &lt;|&gt;
-        =&gt; < a parser for the operator >
-  ( 3 ) sp [ "\\ " swap cat2 eval unit ] &lt;@
-        =&gt; < operator parser that skips whitespace and converts to a 
-             factor expression >
-  ( 4 ) natural-parser sp
-        =&gt; < a whitespace skipping natural parser >
-  ( 5 ) &lt;&amp;&gt; &lt;&amp;&gt; [ uncons uncons swap append append call ] &lt;@
-        =&gt; < a parser that parsers the expression, converts it to
-             factor, calls it and puts the result in the parse tree >
-  ( 6 ) "123 + 456" over call lcar .
-        =&gt; [[ "" 579 ]]
-  ( 7 ) "300-100" over call lcar .
-        =&gt; [[ "" 200 ]]
-  ( 8 ) "200/2" over call lcar .
-        =&gt; [[ "" 100 ]]
-</pre>
-<p>It looks complicated when expanded as above but the entire parser,
-factored a little, looks quite readable:</p>
-<pre class="code">
-  ( 1 ) : operator ( -- parser )
-          "/" token 
-          "*" token &lt;|&gt;
-          "+" token &lt;|&gt;
-          "-" token &lt;|&gt;
-          [ "\\ " swap cat2 eval unit ] &lt;@ ;
-  ( 2 ) : expression ( -- parser )
-          natural-parser 
-          operator sp &lt;&amp;&gt;  
-          natural-parser sp &lt;&amp;&gt; 
-          [ uncons swap uncons -rot append append reverse call ] &lt;@ ;
-  ( 3 ) "40+2" expression call lcar .
-        =&gt; [[ "" 42 ]]
-</pre>
-<p class="footer">
-News and updates to this software can be obtained from the authors
-weblog: <a href="http://radio.weblogs.com/0102385">Chris Double</a>.</p>
-<p id="copyright">Copyright (c) 2004, Chris Double. All Rights Reserved.</p>
-</body> </html>
diff --git a/libs/parser-combinators/tests.factor b/libs/parser-combinators/tests.factor
deleted file mode 100644 (file)
index 74b6737..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-! Copyright (C) 2005 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-USING: kernel lazy-lists test errors strings parser math sequences parser-combinators arrays ;
-IN: scratchpad
-
-! Testing <&>
-{ { T{ parse-result f { "a" "b" } T{ slice f "abcd" 2 4 } } }  } [
-  "abcd" "a" token "b" token <&> parse list>array
-] unit-test
-
-{ { T{ parse-result f { { "a" "b" } "c" } T{ slice f "abcd" 3 4 } } } } [
-  "abcd" "a" token "b" token <&> "c" token <&> parse list>array
-] unit-test
-
-{ { T{ parse-result f { "a" { "b" "c" } } T{ slice f "abcd" 3 4 }  } } } [
-  "abcd" "a" token "b" token "c" token <&> <&> parse list>array
-] unit-test
-
-{ { } } [
-  "decd" "a" token "b" token <&> parse list>array
-] unit-test
-
-{ { } } [
-  "dbcd" "a" token "b" token <&> parse list>array
-] unit-test
-
-{ { } } [
-  "adcd" "a" token "b" token <&> parse list>array
-] unit-test
-
-! Testing <|>
-{ { T{ parse-result f "a" T{ slice f "abcd" 1 4 } } } } [
-  "abcd" "a" token "b" token <|> parse list>array
-] unit-test
-
-{ { T{ parse-result f "b" T{ slice f "bbcd" 1 4 } } }  } [
-  "bbcd" "a" token "b" token <|> parse list>array
-] unit-test
-
-{ { } } [
-  "cbcd" "a" token "b" token <|> parse list>array
-] unit-test
-
-! Testing sp
-{ { } } [
-  "  abcd" "a" token parse list>array 
-] unit-test
-
-{ { T{ parse-result f "a" T{ slice f "  abcd" 3 6 } } }  } [
-  "  abcd" "a" token sp parse list>array 
-] unit-test
-
-! Testing just
-{ { T{ parse-result f "abcd" T{ slice f "abcd" 4 4 } } T{ parse-result f "abc" T{ slice f "abcd" 3 4 } } } } [
-  "abcd" "abcd" token "abc" token <|> parse list>array
-] unit-test
-
-{ { T{ parse-result f "abcd" T{ slice f "abcd" 4 4 } } } } [
-  "abcd" "abcd" token "abc" token <|> just parse list>array
-] unit-test 
-
-! Testing <@
-{ { T{ parse-result f 48 T{ slice f "01234" 1 5 } } } } [
-  "01234" [ digit? ] satisfy parse list>array 
-] unit-test
-
-{ { T{ parse-result f 0 T{ slice f "01234" 1 5 } } } } [
-  "01234" [ digit? ] satisfy [ digit> ] <@ parse list>array 
-] unit-test
-
-! Testing some
-{ { T{ parse-result f "begin" T{ slice f "begin1" 5 6 } } } } [
-  "begin1" "begin" token parse list>array
-] unit-test
-
-[
-  "begin1" "begin" token some parse force
-] unit-test-fails 
-
-{ "begin" } [
-  "begin" "begin" token some parse force
-] unit-test
-
-! <& parser and &> parser
-{ { T{ parse-result f { "a" "b" } T{ slice f "abcd" 2 4 } } } } [
-  "abcd" "a" token "b" token <&> parse list>array
-] unit-test
-
-{ { T{ parse-result f "a" T{ slice f "abcd" 2 4 } } } } [
-  "abcd" "a" token "b" token <& parse list>array
-] unit-test
-
-{ { T{ parse-result f "b" T{ slice f "abcd" 2 4 } } } } [
-  "abcd" "a" token "b" token &> parse list>array
-] unit-test
-
-! Testing <*> and <:&>
-{ { T{ parse-result f { "1" } T{ slice f "1234" 1 4 } } T{ parse-result f { } "1234" } } } [
-  "1234" "1" token <*> parse list>array
-] unit-test
-
-{ 
-  {
-    T{ parse-result f { "1" "1" "1" "1" } T{ slice f "1111234" 4 7 }  }
-    T{ parse-result f { "1" "1" "1" } T{ slice f "1111234" 3 7 } }
-    T{ parse-result f { "1" "1" } T{ slice f "1111234" 2 7 } }
-    T{ parse-result f { "1" } T{ slice f "1111234" 1 7 } }
-    T{ parse-result f { } "1111234" }
-  }
-
-} [
-  "1111234" "1" token <*> parse list>array
-] unit-test
-
-{ 
-  {
-    T{ parse-result f { "1111" } T{ slice f "1111234" 4 7 } }
-    T{ parse-result f { "111" } T{ slice f "1111234" 3 7 } }
-    T{ parse-result f { "11" } T{ slice f "1111234" 2 7 } }
-    T{ parse-result f { "1" } T{ slice f "1111234" 1 7 } }
-    T{ parse-result f { { } } "1111234" }
-  }
-} [
-  "1111234" "1" token <*> [ concat 1array ] <@ parse list>array
-] unit-test
-
-{ { T{ parse-result f { } "234" } } } [
-  "234" "1" token <*> parse list>array
-] unit-test
-
-! Testing <+>
-{ { T{ parse-result f { "1" } T{ slice f "1234" 1 4 } } } } [
-  "1234" "1" token <+> parse list>array
-] unit-test
-
-{ 
-  {
-    T{ parse-result f { "1" "1" "1" "1" } T{ slice f "1111234" 4 7 } }
-    T{ parse-result f { "1" "1" "1" }  T{ slice f "1111234" 3 7 } }
-    T{ parse-result f { "1" "1" }  T{ slice f "1111234" 2 7 } }
-    T{ parse-result f { "1" } T{ slice f "1111234" 1 7 } }
-  }
-} [
-  "1111234" "1" token <+> parse list>array
-] unit-test
-
-{ { } } [
-  "234" "1" token <+> parse list>array
-] unit-test
-
-
diff --git a/libs/partial-continuations.factor b/libs/partial-continuations.factor
deleted file mode 100644 (file)
index e44f7ec..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-! Based on Scheme code for bshift and breset from:
-! http://groups.google.com/group/comp.lang.scheme/msg/9f0d61da01540816
-!
-! See this blog entry for more details:
-! http://www.bluishcoder.co.nz/2006/03/factor-partial-continuation-updates.html
-!
-IN: continuations
-USING: kernel io math prettyprint tools lists arrays sequences
-namespaces ;
-
-: breset ( quot -- )
-  #! Marks the boundary of the partial continuation.
-  #! The quotation has stack effect ( r -- v ), where
-  #! 'r' identifies the breset in scope and should be passed
-  #! to bshift to mark the boundary of the continuation.
-  #! It is important to note that even if the quotation
-  #! discards items on the stack, the stack will be restored to
-  #! the way it was before it is called (which is true of callcc
-  #! usage in general).
-  [ 1array swap keep first continue-with ] callcc1 nip ;
-
-: (bshift) ( v r k -- )
-  >r dup first -rot r>
-  [
-    rot 0 swap set-nth
-    continue-with  
-  ] callcc1
-  >r drop nip 0 swap set-nth r> ;
-
-: bshift ( r quot -- )
-  #! Calls the quotation with the partial continuation 
-  #! on the stack. The quotation should have stack effect
-  #! ( pcc -- v ). The partial continuation can be called
-  #! with 'call' and has stack effect ( a -- b ). 
-  #! It is important to note that even if the quotation
-  #! discards items on the stack, the stack will be restored to
-  #! the way it was before it is called (which is true of callcc
-  #! usage in general).
-  [ ! r quot k
-    [ (bshift) ] cons pick  swons swap
-    rot >r call
-    r> first continue-with        
-  ] callcc1 2nip ;
-
diff --git a/libs/porter-stemmer/load.factor b/libs/porter-stemmer/load.factor
deleted file mode 100644 (file)
index 0a42c4c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-PROVIDE: libs/porter-stemmer
-{ +files+ { "porter-stemmer.factor" "porter-stemmer.facts" } }
-{ +tests+ { "test/porter-stemmer.factor" } }
-{ +help+ "porter-stemmer" } ;
diff --git a/libs/porter-stemmer/porter-stemmer.factor b/libs/porter-stemmer/porter-stemmer.factor
deleted file mode 100644 (file)
index 2e1a1c7..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-IN: porter-stemmer
-USING: kernel math parser sequences ;
-
-: consonant? ( i str -- ? )
-    2dup nth dup "aeiou" member? [
-        3drop f
-    ] [
-        CHAR: y = [
-            over zero?
-            [ 2drop t ] [ >r 1- r> consonant? not ] if
-        ] [
-            2drop t
-        ] if
-    ] if ;
-
-: skip-vowels ( i str -- i str )
-    2dup bounds-check? [
-        2dup consonant? [ >r 1+ r> skip-vowels ] unless
-    ] when ;
-
-: skip-consonants ( i str -- i str )
-    2dup bounds-check? [
-        2dup consonant? [ >r 1+ r> skip-consonants ] when
-    ] when ;
-
-: (consonant-seq) ( n i str -- n )
-    skip-vowels
-    2dup bounds-check? [
-        >r 1+ >r 1+ r> r> skip-consonants >r 1+ r>
-        (consonant-seq)
-    ] [
-        2drop
-    ] if ;
-
-: consonant-seq ( str -- n )
-    0 0 rot skip-consonants (consonant-seq) ;
-
-: stem-vowel? ( str -- ? )
-    dup length [ swap consonant? ] all-with? not ;
-
-: double-consonant? ( i str -- ? )
-    over 1 < [
-        2drop f
-    ] [
-        2dup nth >r over 1- over nth r> = [
-            consonant?
-        ] [
-            2drop f
-        ] if
-    ] if ;
-
-: consonant-end? ( n seq -- ? )
-    [ length swap - ] keep consonant? ;
-
-: last-is? ( str possibilities -- ? ) >r peek r> member? ;
-
-: cvc? ( str -- ? )
-    {
-        { [ dup length 3 < ] [ drop f ] }
-        { [ 1 over consonant-end? not ] [ drop f ] }
-        { [ 2 over consonant-end? ] [ drop f ] }
-        { [ 3 over consonant-end? not ] [ drop f ] }
-        { [ t ] [ "wxy" last-is? not ] }
-    } cond ;
-
-: r ( str oldsuffix newsuffix -- str )
-    pick consonant-seq 0 > [ nip ] [ drop ] if append ;
-
-: butlast ( seq -- seq ) 1 head-slice* ;
-
-: step1a ( str -- newstr )
-    dup peek CHAR: s = [
-        {
-            { [ "sses" ?tail ] [ "ss" append ] }
-            { [ "ies" ?tail ] [ "i" append ] }
-            { [ dup "ss" tail? ] [ ] }
-            { [ "s" ?tail ] [ ] }
-            { [ t ] [ ] }
-        } cond
-    ] when ;
-
-: -eed ( str -- str )
-    dup consonant-seq 0 > "ee" "eed" ? append ;
-
-: -ed ( str -- str ? )
-    dup stem-vowel? [ [ "ed" append ] unless ] keep ;
-
-: -ing ( str -- str ? )
-    dup stem-vowel? [ [ "ing" append ] unless ] keep ;
-
-: -ed/ing ( str -- str )
-    {
-        { [ "at" ?tail ] [ "ate" append ] }
-        { [ "bl" ?tail ] [ "ble" append ] }
-        { [ "iz" ?tail ] [ "ize" append ] }
-        {
-            [ dup length 1- over double-consonant? ]
-            [ dup "lsz" last-is? [ butlast ] unless ]
-        }
-        {
-            [ t ]
-            [
-                dup consonant-seq 1 = over cvc? and
-                [ "e" append ] when
-            ]
-        }
-    } cond ;
-
-: step1b ( str -- newstr )
-    {
-        { [ "eed" ?tail ] [ -eed ] }
-        {
-            [
-                {
-                    { [ "ed" ?tail ] [ -ed ] }
-                    { [ "ing" ?tail ] [ -ing ] }
-                    { [ t ] [ f ] }
-                } cond
-            ] [ -ed/ing ]
-        }
-        { [ t ] [ ] }
-    } cond ;
-
-: step1c ( str -- newstr )
-    dup butlast stem-vowel? [
-        "y" ?tail [ "i" append ] when
-    ] when ;
-
-: step2 ( str -- newstr )
-    {
-        { [ "ational" ?tail ] [ "ational" "ate"  r ] }
-        { [ "tional"  ?tail ] [ "tional"  "tion" r ] }
-        { [ "enci"    ?tail ] [ "enci"    "ence" r ] }
-        { [ "anci"    ?tail ] [ "anci"    "ance" r ] }
-        { [ "izer"    ?tail ] [ "izer"    "ize"  r ] }
-        { [ "bli"     ?tail ] [ "bli"     "ble"  r ] }
-        { [ "alli"    ?tail ] [ "alli"    "al"   r ] }
-        { [ "entli"   ?tail ] [ "entli"   "ent"  r ] }
-        { [ "eli"     ?tail ] [ "eli"     "e"    r ] }
-        { [ "ousli"   ?tail ] [ "ousli"   "ous"  r ] }
-        { [ "ization" ?tail ] [ "ization" "ize"  r ] }
-        { [ "ation"   ?tail ] [ "ation"   "ate"  r ] }
-        { [ "ator"    ?tail ] [ "ator"    "ate"  r ] }
-        { [ "alism"   ?tail ] [ "alism"   "al"   r ] }
-        { [ "iveness" ?tail ] [ "iveness" "ive"  r ] }
-        { [ "fulness" ?tail ] [ "fulness" "ful"  r ] }
-        { [ "ousness" ?tail ] [ "ousness" "ous"  r ] }
-        { [ "aliti"   ?tail ] [ "aliti"   "al"   r ] }
-        { [ "iviti"   ?tail ] [ "iviti"   "ive"  r ] }
-        { [ "biliti"  ?tail ] [ "biliti"  "ble"  r ] }
-        { [ "logi"    ?tail ] [ "logi"    "log"  r ] }
-        { [ t ] [ ] }
-    } cond ;
-
-: step3 ( str -- newstr )
-    {
-        { [ "icate" ?tail ] [ "icate" "ic" r ] }
-        { [ "ative" ?tail ] [ "ative" ""   r ] }
-        { [ "alize" ?tail ] [ "alize" "al" r ] }
-        { [ "iciti" ?tail ] [ "iciti" "ic" r ] }
-        { [ "ical"  ?tail ] [ "ical"  "ic" r ] }
-        { [ "ful"   ?tail ] [ "ful"   ""   r ] }
-        { [ "ness"  ?tail ] [ "ness"  ""   r ] }
-        { [ t ] [ ] }
-    } cond ;
-
-: -ion ( str -- newstr )
-    dup empty? [
-        drop "ion"
-    ] [
-        dup "st" last-is? [ "ion" append ] unless
-    ] if ;
-
-: step4 ( str -- newstr )
-    dup {
-        { [ "al"    ?tail ] [ ] }
-        { [ "ance"  ?tail ] [ ] }
-        { [ "ence"  ?tail ] [ ] }
-        { [ "er"    ?tail ] [ ] }
-        { [ "ic"    ?tail ] [ ] }
-        { [ "able"  ?tail ] [ ] }
-        { [ "ible"  ?tail ] [ ] }
-        { [ "ant"   ?tail ] [ ] }
-        { [ "ement" ?tail ] [ ] }
-        { [ "ment"  ?tail ] [ ] }
-        { [ "ent"   ?tail ] [ ] }
-        { [ "ion"   ?tail ] [ -ion ] }
-        { [ "ou"    ?tail ] [ ] }
-        { [ "ism"   ?tail ] [ ] }
-        { [ "ate"   ?tail ] [ ] }
-        { [ "iti"   ?tail ] [ ] }
-        { [ "ous"   ?tail ] [ ] }
-        { [ "ive"   ?tail ] [ ] }
-        { [ "ize"   ?tail ] [ ] }
-        { [ t ] [ ] }
-    } cond dup consonant-seq 1 > [ nip ] [ drop ] if ;
-
-: remove-e? ( str -- ? )
-    dup consonant-seq dup 1 >
-    [ 2drop t ]
-    [ 1 = [ butlast cvc? not ] [ drop f ] if ] if ;
-
-: remove-e ( str -- newstr )
-    dup peek CHAR: e = [
-        dup remove-e? [ butlast ] when
-    ] when ;
-
-: ll->l ( str -- newstr )
-    {
-        { [ dup peek CHAR: l = not ] [ ] }
-        { [ dup length 1- over double-consonant? not ] [ ] }
-        { [ dup consonant-seq 1 > ] [ butlast ] }
-        { [ t ] [ ] }
-    } cond ;
-
-: step5 ( str -- newstr ) remove-e ll->l ;
-
-: stem ( str -- newstr )
-    dup length 2 <= [
-        step1a step1b step1c step2 step3 step4 step5 "" like
-    ] unless ;
diff --git a/libs/porter-stemmer/porter-stemmer.facts b/libs/porter-stemmer/porter-stemmer.facts
deleted file mode 100644 (file)
index e86340c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-IN: porter-stemmer
-USING: help ;
-
-HELP: step1a
-{ $values { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Gets rid of plurals." }
-{ $examples
-    { $table
-        { "Input:" "Output:" }
-        { "caresses" "caress" }
-        { "ponies" "poni" }
-        { "ties" "ti" }
-        { "caress" "caress" }
-        { "cats" "cat" }
-    }
-} ;
-
-HELP: step1b
-{ $values { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Gets rid of \"-ed\" and \"-ing\" suffixes." }
-{ $examples
-    { $table
-        { "Input:" "Output:" }
-        { "feed"  "feed" }
-        { "agreed"  "agree" }
-        { "disabled"  "disable" }
-        { "matting"  "mat" }
-        { "mating"  "mate" }
-        { "meeting"  "meet" }
-        { "milling"  "mill" }
-        { "messing"  "mess" }
-        { "meetings"  "meet" }
-    }
-} ;
-
-HELP: step1c
-{ $values { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Turns a terminal y to i when there is another vowel in the stem." } ;
-
-HELP: step2
-{ $values { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Maps double suffices to single ones. so -ization maps to -ize etc. note that the string before the suffix must give positive " { $link consonant-seq } "." } ;
-
-HELP: step3
-{ $values { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Deals with -c-, -full, -ness, etc. Similar strategy to " { $link step2 } "." } ;
-
-HELP: step5
-{ $values { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Removes a final -e and changes a final -ll to -l if " { $link consonant-seq } " is greater than 1," } ;
-
-HELP: stem
-{ $values { "str" "a string" } { "newstr" "a new string" } }
-{ $description "Applies the Porter stemming algorithm to the input string." } ;
-
-ARTICLE: "porter-stemmer" "Porter stemming algorithm"
-"The help system uses the Porter stemming algorithm to normalize words when building the full-text search index."
-$terpri
-"The Factor implementation of the algorithm is based on the Common Lisp version, which was hand-translated from ANSI C by Steven M. Haflich. The original ANSI C was written by Martin Porter."
-$terpri
-"A detailed description of the algorithm, along with implementations in various languages, can be at in " { $url "http://www.tartarus.org/~martin/PorterStemmer" } "."
-$terpri
-"The main word of the algorithm takes an English word as input and outputs its stem:"
-{ $subsection stem }
-"The algorithm consists of a number of steps:"
-{ $subsection step1a }
-{ $subsection step1b }
-{ $subsection step1c }
-{ $subsection step2 }
-{ $subsection step3 }
-{ $subsection step4 }
-{ $subsection step5 } ;
diff --git a/libs/porter-stemmer/test/output.txt b/libs/porter-stemmer/test/output.txt
deleted file mode 100644 (file)
index 595cb67..0000000
+++ /dev/null
@@ -1,23531 +0,0 @@
-a
-aaron
-abaissiez
-abandon
-abandon
-abas
-abash
-abat
-abat
-abat
-abat
-abat
-abbess
-abbei
-abbei
-abbomin
-abbot
-abbot
-abbrevi
-ab
-abel
-aberga
-abergavenni
-abet
-abet
-abhomin
-abhor
-abhorr
-abhor
-abhor
-abhor
-abhorson
-abid
-abid
-abil
-abil
-abject
-abjectli
-abject
-abjur
-abjur
-abl
-abler
-aboard
-abod
-abod
-abod
-abod
-abomin
-abomin
-abomin
-abort
-abort
-abound
-abound
-about
-abov
-abr
-abraham
-abram
-abreast
-abridg
-abridg
-abridg
-abridg
-abroach
-abroad
-abrog
-abrook
-abrupt
-abrupt
-abruptli
-absenc
-absent
-absei
-absolut
-absolut
-absolv
-absolv
-abstain
-abstemi
-abstin
-abstract
-absurd
-absyrtu
-abund
-abund
-abundantli
-abu
-abus
-abus
-abus
-abus
-abus
-abut
-abi
-abysm
-ac
-academ
-academ
-accent
-accent
-accept
-accept
-accept
-accept
-accept
-access
-accessari
-access
-accid
-accid
-accident
-accident
-accid
-accit
-accit
-accit
-acclam
-accommod
-accommod
-accommod
-accommod
-accommodo
-accompani
-accompani
-accompani
-accomplic
-accomplish
-accomplish
-accomplish
-accomplish
-accompt
-accord
-accord
-accord
-accordeth
-accord
-accordingli
-accord
-accost
-accost
-account
-account
-account
-account
-accoutr
-accoutr
-accoutr
-accru
-accumul
-accumul
-accumul
-accur
-accurs
-accurst
-accu
-accus
-accus
-accus
-accusativo
-accus
-accus
-accus
-accus
-accus
-accuseth
-accus
-accustom
-accustom
-ac
-acerb
-ach
-acheron
-ach
-achiev
-achiev
-achiev
-achiev
-achiev
-achiev
-achiev
-achiev
-achil
-ach
-achitophel
-acknowledg
-acknowledg
-acknowledg
-acknowledg
-acknown
-acold
-aconitum
-acordo
-acorn
-acquaint
-acquaint
-acquaint
-acquaint
-acquir
-acquir
-acquisit
-acquit
-acquitt
-acquitt
-acquit
-acr
-acr
-across
-act
-actaeon
-act
-act
-action
-action
-actium
-activ
-activ
-activ
-actor
-actor
-act
-actual
-actur
-acut
-acut
-ad
-adag
-adalla
-adam
-adam
-add
-ad
-adder
-adder
-addeth
-addict
-addict
-addict
-ad
-addit
-addit
-addl
-address
-address
-addrest
-add
-adher
-adher
-adieu
-adieu
-adjac
-adjoin
-adjoin
-adjourn
-adjudg
-adjudg
-adjunct
-administ
-administr
-admir
-admir
-admir
-admir
-admir
-admir
-admir
-admir
-admiringli
-admiss
-admit
-admit
-admitt
-admit
-admit
-admonish
-admonish
-admonish
-admonish
-admonit
-ado
-adoni
-adopt
-adopt
-adoptedli
-adopt
-adopti
-adopt
-ador
-ador
-ador
-ador
-ador
-ador
-adorest
-adoreth
-ador
-adorn
-adorn
-adorn
-adorn
-adorn
-adown
-adramadio
-adrian
-adriana
-adriano
-adriat
-adsum
-adul
-adulter
-adulter
-adulter
-adulteress
-adulteri
-adulter
-adulteri
-adultress
-advanc
-advanc
-advanc
-advanc
-advanc
-advanc
-advanc
-advantag
-advantag
-advantag
-advantag
-advantag
-advantag
-advent
-adventur
-adventur
-adventur
-adventur
-adventur
-adventur
-adversari
-adversari
-advers
-advers
-advers
-advers
-adverti
-advertis
-advertis
-advertis
-advertis
-advic
-advi
-advis
-advis
-advisedli
-advis
-advis
-advoc
-advoc
-aeacida
-aeacid
-aedil
-aedil
-aegeon
-aegion
-aegl
-aemelia
-aemilia
-aemiliu
-aenea
-aeolu
-aer
-aerial
-aeri
-aesculapiu
-aeson
-aesop
-aetna
-afar
-afear
-afeard
-affabl
-affabl
-affair
-affair
-affair
-affect
-affect
-affect
-affect
-affectedli
-affecteth
-affect
-affect
-affection
-affection
-affect
-affect
-affeer
-affianc
-affianc
-affianc
-affi
-affin
-affin
-affin
-affirm
-affirm
-affirm
-afflict
-afflict
-afflict
-afflict
-afflict
-afford
-affordeth
-afford
-affrai
-affright
-affright
-affright
-affront
-affront
-affi
-afield
-afir
-afloat
-afoot
-afor
-aforehand
-aforesaid
-afraid
-afresh
-afric
-africa
-african
-afront
-after
-afternoon
-afterward
-afterward
-ag
-again
-against
-agamemmon
-agamemnon
-agat
-agaz
-ag
-ag
-agenor
-agent
-agent
-ag
-aggrav
-aggrief
-agil
-agincourt
-agit
-aglet
-agniz
-ago
-agon
-agoni
-agre
-agre
-agre
-agreement
-agre
-agrippa
-aground
-agu
-aguecheek
-agu
-aguefac
-agu
-ah
-aha
-ahungri
-ai
-aialvolio
-aiaria
-aid
-aidanc
-aidant
-aid
-aid
-aidless
-aid
-ail
-aim
-aim
-aimest
-aim
-aim
-ainsi
-aio
-air
-air
-airless
-air
-airi
-ajax
-akil
-al
-alabast
-alack
-alacr
-alarbu
-alarm
-alarm
-alarum
-alarum
-ala
-alb
-alban
-alban
-albani
-albeit
-albion
-alchemist
-alchemi
-alcibiad
-alcid
-alder
-alderman
-aldermen
-al
-alecto
-alehous
-alehous
-alencon
-alengon
-aleppo
-al
-alewif
-alexand
-alexand
-alexandria
-alexandrian
-alexa
-alia
-alic
-alien
-aliena
-alight
-alight
-alight
-alii
-alik
-alisand
-aliv
-all
-alla
-allai
-allai
-allai
-allay
-allay
-allai
-alleg
-alleg
-alleg
-alleg
-allegi
-allegi
-allei
-allei
-allhallowma
-allianc
-allicholi
-alli
-alli
-allig
-allig
-allon
-allot
-allot
-allot
-allotteri
-allow
-allow
-allow
-allow
-allow
-allur
-allur
-allur
-allur
-allus
-alli
-allycholli
-almain
-almanac
-almanack
-almanac
-almighti
-almond
-almost
-alm
-almsman
-alo
-aloft
-alon
-along
-alonso
-aloof
-aloud
-alphabet
-alphabet
-alphonso
-alp
-alreadi
-also
-alt
-altar
-altar
-alter
-alter
-alter
-alter
-althaea
-although
-altitud
-altogeth
-alton
-alwai
-alwai
-am
-amaimon
-amain
-amak
-amamon
-amaz
-amaz
-amaz
-amazedli
-amazed
-amaz
-amaz
-amazeth
-amaz
-amazon
-amazonian
-amazon
-ambassador
-ambassador
-amber
-ambiguid
-ambigu
-ambigu
-ambit
-ambit
-ambiti
-ambiti
-ambl
-ambl
-ambl
-ambl
-ambo
-ambuscado
-ambush
-amen
-amend
-amend
-amend
-amend
-amerc
-america
-am
-amiabl
-amid
-amidst
-amien
-ami
-amiss
-amiti
-amiti
-amnipot
-among
-amongst
-amor
-amor
-amort
-amount
-amount
-amour
-amphimacu
-ampl
-ampler
-amplest
-amplifi
-amplifi
-ampli
-ampthil
-amurath
-amynta
-an
-anatomiz
-anatom
-anatomi
-ancestor
-ancestor
-ancestri
-anchis
-anchor
-anchorag
-anchor
-anchor
-anchor
-anchovi
-ancient
-ancientri
-ancient
-ancu
-and
-andiron
-andpholu
-andren
-andrew
-andromach
-andronici
-andronicu
-anew
-ang
-angel
-angelica
-angel
-angelo
-angel
-anger
-angerli
-anger
-ang
-angier
-angl
-anglai
-angl
-angler
-angleterr
-anglia
-angl
-anglish
-angrili
-angri
-anguish
-angu
-anim
-anim
-animi
-anjou
-ankl
-anna
-annal
-ann
-annex
-annex
-annexion
-annex
-annothan
-announc
-annoi
-annoy
-annoi
-annual
-anoint
-anoint
-anon
-anoth
-anselmo
-answer
-answer
-answer
-answerest
-answer
-answer
-ant
-ant
-antenor
-antenorid
-anteroom
-anthem
-anthem
-anthoni
-anthropophagi
-anthropophaginian
-antiat
-antic
-anticip
-anticip
-anticipatest
-anticip
-anticip
-antick
-anticli
-antic
-antidot
-antidot
-antigonu
-antiopa
-antipathi
-antipholu
-antipholus
-antipod
-antiquari
-antiqu
-antiqu
-antium
-antoniad
-antonio
-antoniu
-antoni
-antr
-anvil
-ani
-anybodi
-anyon
-anyth
-anywher
-ap
-apac
-apart
-apart
-apart
-ap
-apemantu
-apennin
-ap
-apiec
-apish
-apollinem
-apollo
-apollodoru
-apolog
-apoplex
-apoplexi
-apostl
-apostl
-apostropha
-apoth
-apothecari
-appal
-appal
-appal
-appal
-apparel
-apparel
-apparel
-appar
-appar
-apparit
-apparit
-appeach
-appeal
-appeal
-appear
-appear
-appear
-appeareth
-appear
-appear
-appea
-appeas
-appeas
-appel
-appel
-appele
-appel
-appelez
-appel
-appel
-appelon
-appendix
-apperil
-appertain
-appertain
-appertain
-appertain
-appertin
-appertin
-appetit
-appetit
-applaud
-applaud
-applaud
-applaus
-applaus
-appl
-appl
-appletart
-applianc
-applianc
-applic
-appli
-appli
-appli
-appli
-appoint
-appoint
-appoint
-appoint
-appoint
-apprehend
-apprehend
-apprehend
-apprehens
-apprehens
-apprehens
-apprendr
-apprenn
-apprenticehood
-appri
-approach
-approach
-approach
-approacheth
-approach
-approb
-approof
-appropri
-approv
-approv
-approv
-approv
-approv
-appurten
-appurten
-apricock
-april
-apron
-apron
-apt
-apter
-aptest
-aptli
-apt
-aqua
-aquilon
-aquitain
-arabia
-arabian
-arais
-arbitr
-arbitr
-arbitr
-arbitr
-arbor
-arbour
-arc
-arch
-archbishop
-archbishopr
-archdeacon
-arch
-archelau
-archer
-archer
-archeri
-archibald
-archidamu
-architect
-arcu
-ard
-arden
-ardent
-ardour
-ar
-argal
-argier
-argo
-argosi
-argosi
-argu
-argu
-argu
-argu
-argu
-argument
-argument
-argu
-ariachn
-ariadn
-ariel
-ari
-aright
-arinado
-arini
-arion
-aris
-aris
-ariseth
-aris
-aristod
-aristotl
-arithmet
-arithmetician
-ark
-arm
-arma
-armado
-armado
-armagnac
-arm
-arm
-armenia
-armi
-armigero
-arm
-armipot
-armor
-armour
-armour
-armour
-armour
-armouri
-arm
-armi
-arn
-aroint
-aros
-arous
-arous
-arragon
-arraign
-arraign
-arraign
-arraign
-arrant
-arra
-arrai
-arrearag
-arrest
-arrest
-arrest
-arriv
-arriv
-arriv
-arriv
-arriv
-arriv
-arriv
-arrog
-arrog
-arrog
-arrow
-arrow
-art
-artemidoru
-arteri
-arthur
-articl
-articl
-articul
-artific
-artifici
-artilleri
-artir
-artist
-artist
-artless
-artoi
-art
-artu
-arviragu
-as
-asaph
-ascaniu
-ascend
-ascend
-ascendeth
-ascend
-ascens
-ascent
-ascrib
-ascrib
-ash
-asham
-asham
-asher
-ash
-ashford
-ashor
-ashout
-ashi
-asia
-asid
-ask
-askanc
-ask
-asker
-asketh
-ask
-ask
-aslant
-asleep
-asmath
-asp
-aspect
-aspect
-aspen
-aspers
-aspic
-aspici
-aspic
-aspir
-aspir
-aspir
-aspir
-asquint
-ass
-assail
-assail
-assail
-assail
-assail
-assaileth
-assail
-assail
-assassin
-assault
-assault
-assault
-assai
-assai
-assai
-assembl
-assembl
-assembl
-assembl
-assembl
-assent
-ass
-assez
-assign
-assign
-assign
-assinico
-assist
-assist
-assist
-assist
-assist
-assist
-assist
-associ
-associ
-associ
-assuag
-assubjug
-assum
-assum
-assum
-assumpt
-assur
-assur
-assur
-assur
-assuredli
-assur
-assyrian
-astonish
-astonish
-astraea
-astrai
-astrea
-astronom
-astronom
-astronom
-astronomi
-asund
-at
-atalanta
-at
-at
-athenian
-athenian
-athen
-athol
-athversari
-athwart
-atla
-atomi
-atomi
-aton
-aton
-aton
-atropo
-attach
-attach
-attach
-attain
-attaind
-attain
-attaint
-attaint
-attaintur
-attempt
-attempt
-attempt
-attempt
-attempt
-attend
-attend
-attend
-attend
-attend
-attend
-attendeth
-attend
-attend
-attent
-attent
-attent
-attentiven
-attest
-attest
-attir
-attir
-attir
-attir
-attornei
-attornei
-attornei
-attorneyship
-attract
-attract
-attract
-attract
-attribut
-attribut
-attribut
-attribut
-attribut
-atwain
-au
-aubrei
-auburn
-aucun
-audaci
-audaci
-audac
-audibl
-audienc
-audi
-audit
-auditor
-auditor
-auditori
-audr
-audrei
-aufidiu
-aufidius
-auger
-aught
-augment
-augment
-augment
-augment
-augur
-augur
-augur
-augur
-augur
-auguri
-august
-augustu
-auld
-aumerl
-aunchient
-aunt
-aunt
-auricular
-aurora
-auspici
-aussi
-auster
-auster
-auster
-auster
-austria
-aut
-authent
-author
-author
-author
-author
-author
-author
-autolycu
-autr
-autumn
-auvergn
-avail
-avail
-avaric
-avarici
-avaunt
-av
-aveng
-aveng
-aveng
-aver
-avert
-av
-avez
-avi
-avoid
-avoid
-avoid
-avoid
-avoirdupoi
-avouch
-avouch
-avouch
-avouch
-avow
-aw
-await
-await
-awak
-awak
-awak
-awaken
-awaken
-awaken
-awak
-awak
-award
-award
-awasi
-awai
-aw
-aweari
-aweless
-aw
-awhil
-awkward
-awl
-awoo
-awork
-awri
-ax
-axl
-axletre
-ay
-ay
-ayez
-ayli
-azur
-azur
-b
-ba
-baa
-babbl
-babbl
-babbl
-babe
-babe
-babi
-baboon
-baboon
-babi
-babylon
-bacar
-bacchan
-bacchu
-bach
-bachelor
-bachelor
-back
-backbit
-backbitten
-back
-back
-backward
-backwardli
-backward
-bacon
-bacon
-bad
-bade
-badg
-badg
-badg
-badli
-bad
-bae
-baffl
-baffl
-baffl
-bag
-baggag
-bagot
-bagpip
-bag
-bail
-bailiff
-baillez
-baili
-baisant
-baise
-baiser
-bait
-bait
-bait
-bait
-bait
-bajazet
-bak
-bake
-bake
-baker
-baker
-bake
-bake
-bal
-balanc
-balanc
-balconi
-bald
-baldrick
-bale
-bale
-balk
-ball
-ballad
-ballad
-ballast
-ballast
-ballet
-ballow
-ball
-balm
-balm
-balmi
-balsam
-balsamum
-balth
-balthasar
-balthazar
-bame
-ban
-banburi
-band
-bandi
-band
-bandit
-banditti
-banditto
-band
-bandi
-bandi
-bane
-bane
-bang
-bangor
-banish
-banish
-banish
-banish
-banist
-bank
-bankrout
-bankrupt
-bankrupt
-bank
-banner
-banneret
-banner
-ban
-bann
-banquet
-banquet
-banquet
-banquet
-banquo
-ban
-baptism
-baptista
-baptiz
-bar
-barbarian
-barbarian
-barbar
-barbar
-barbari
-barbason
-barb
-barber
-barbermong
-bard
-bardolph
-bard
-bare
-bare
-barefac
-barefac
-barefoot
-barehead
-bare
-bare
-bar
-bargain
-bargain
-barg
-bargulu
-bare
-bark
-bark
-barkloughli
-bark
-barki
-barlei
-barm
-barn
-barnacl
-barnardin
-barn
-barn
-barnet
-barn
-baron
-baron
-baroni
-barr
-barraba
-barrel
-barrel
-barren
-barrenli
-barren
-barricado
-barricado
-barrow
-bar
-barson
-barter
-bartholomew
-ba
-basan
-base
-baseless
-base
-base
-baser
-base
-basest
-bash
-bash
-basilisco
-basilisk
-basilisk
-basimecu
-basin
-basingstok
-basin
-basi
-bask
-basket
-basket
-bass
-bassanio
-basset
-bassianu
-basta
-bastard
-bastard
-bastardli
-bastard
-bastardi
-bast
-bast
-bastinado
-bast
-bat
-batail
-batch
-bate
-bate
-bate
-bath
-bath
-bath
-bath
-bath
-bate
-batler
-bat
-batt
-battalia
-battalion
-batten
-batter
-batter
-batter
-batteri
-battl
-battl
-battlefield
-battlement
-battl
-batti
-baubl
-baubl
-baubl
-baulk
-bavin
-bawcock
-bawd
-bawdri
-bawd
-bawdi
-bawl
-bawl
-bai
-bai
-baynard
-bayonn
-bai
-be
-beach
-beach
-beachi
-beacon
-bead
-bead
-beadl
-beadl
-bead
-beadsmen
-beagl
-beagl
-beak
-beak
-beam
-beam
-beam
-bean
-bean
-bear
-beard
-beard
-beardless
-beard
-bearer
-bearer
-bearest
-beareth
-bear
-bear
-beast
-beastliest
-beastli
-beastli
-beast
-beat
-beat
-beaten
-beat
-beatric
-beat
-beau
-beaufort
-beaumond
-beaumont
-beauteou
-beauti
-beauti
-beautifi
-beauti
-beautifi
-beauti
-beaver
-beaver
-becam
-becaus
-bechanc
-bechanc
-bechanc
-beck
-beckon
-beckon
-beck
-becom
-becom
-becom
-becom
-becom
-becom
-bed
-bedabbl
-bedash
-bedaub
-bedazzl
-bedchamb
-bedcloth
-bed
-bedeck
-bedeck
-bedew
-bedfellow
-bedfellow
-bedford
-bedlam
-bedrench
-bedrid
-bed
-bedtim
-bedward
-bee
-beef
-beef
-beehiv
-been
-beer
-bee
-beest
-beetl
-beetl
-beev
-befal
-befallen
-befal
-befel
-befit
-befit
-befit
-befor
-befor
-beforehand
-befortun
-befriend
-befriend
-befriend
-beg
-began
-beget
-beget
-beget
-begg
-beggar
-beggar
-beggarli
-beggarman
-beggar
-beggari
-beg
-begin
-beginn
-begin
-begin
-begin
-begnawn
-begon
-begot
-begotten
-begrim
-beg
-beguil
-beguil
-beguil
-beguil
-beguil
-begun
-behalf
-behalf
-behav
-behav
-behavedst
-behavior
-behavior
-behaviour
-behaviour
-behead
-behead
-beheld
-behest
-behest
-behind
-behold
-behold
-behold
-beholdest
-behold
-behold
-behoof
-behoofful
-behoov
-behov
-behov
-behowl
-be
-bel
-belariu
-belch
-belch
-beldam
-beldam
-beldam
-bele
-belgia
-beli
-beli
-belief
-beliest
-believ
-believ
-believ
-believ
-believest
-believ
-belik
-bell
-bellario
-bell
-belli
-belli
-bellman
-bellona
-bellow
-bellow
-bellow
-bellow
-bell
-belli
-belly
-belman
-belmont
-belock
-belong
-belong
-belong
-belong
-belov
-belov
-belov
-below
-belt
-belzebub
-bemad
-bemet
-bemet
-bemoan
-bemoan
-bemock
-bemoil
-bemonst
-ben
-bench
-bencher
-bench
-bend
-bend
-bend
-bend
-bene
-beneath
-benedicit
-benedick
-benedict
-benedictu
-benefactor
-benefic
-benefici
-benefit
-benefit
-benefit
-benet
-benevol
-benevol
-beni
-benison
-bennet
-bent
-bentii
-bentivolii
-bent
-benumb
-benvolio
-bepaint
-beprai
-bequeath
-bequeath
-bequeath
-bequest
-ber
-berard
-berattl
-berai
-bere
-bereav
-bereav
-bereav
-bereft
-bergamo
-bergomask
-berhym
-berhym
-berkelei
-bermooth
-bernardo
-berod
-berown
-berri
-berri
-berrord
-berri
-bertram
-berwick
-bescreen
-beseech
-beseech
-beseech
-beseech
-beseek
-beseem
-beseemeth
-beseem
-beseem
-beset
-beshrew
-besid
-besid
-besieg
-besieg
-besieg
-beslubb
-besmear
-besmear
-besmirch
-besom
-besort
-besot
-bespak
-bespeak
-bespic
-bespok
-bespot
-bess
-bessi
-best
-bestain
-best
-bestial
-bestir
-bestirr
-bestow
-bestow
-bestow
-bestow
-bestraught
-bestrew
-bestrid
-bestrid
-bestrid
-bet
-betak
-beteem
-bethink
-bethought
-bethroth
-bethump
-betid
-betid
-betideth
-betim
-betim
-betoken
-betook
-betoss
-betrai
-betrai
-betrai
-betrai
-betrim
-betroth
-betroth
-betroth
-bett
-bet
-better
-better
-better
-better
-bet
-bettr
-between
-betwixt
-bevel
-beverag
-bevi
-bevi
-bewail
-bewail
-bewail
-bewail
-bewar
-bewast
-beweep
-bewept
-bewet
-bewhor
-bewitch
-bewitch
-bewitch
-bewrai
-beyond
-bezonian
-bezonian
-bianca
-bianco
-bia
-bibbl
-bicker
-bid
-bidden
-bid
-bid
-biddi
-bide
-bide
-bide
-bid
-bien
-bier
-bifold
-big
-bigami
-biggen
-bigger
-big
-bigot
-bilberri
-bilbo
-bilbo
-bilbow
-bill
-billet
-billet
-billiard
-bill
-billow
-billow
-bill
-bin
-bind
-bindeth
-bind
-bind
-biondello
-birch
-bird
-bird
-birdlim
-bird
-birnam
-birth
-birthdai
-birthdom
-birthplac
-birthright
-birthright
-birth
-bi
-biscuit
-bishop
-bishop
-bisson
-bit
-bitch
-bite
-biter
-bite
-bite
-bit
-bitt
-bitten
-bitter
-bitterest
-bitterli
-bitter
-blab
-blabb
-blab
-blab
-black
-blackamoor
-blackamoor
-blackberri
-blackberri
-blacker
-blackest
-blackfriar
-blackheath
-blackmer
-black
-black
-bladder
-bladder
-blade
-blade
-blade
-blain
-blam
-blame
-blame
-blame
-blameless
-blame
-blanc
-blanca
-blanch
-blank
-blanket
-blank
-blasphem
-blasphem
-blasphem
-blasphemi
-blast
-blast
-blast
-blastment
-blast
-blaz
-blaze
-blaze
-blaze
-blazon
-blazon
-blazon
-bleach
-bleach
-bleak
-blear
-blear
-bleat
-bleat
-bleat
-bled
-bleed
-bleedest
-bleedeth
-bleed
-bleed
-blemish
-blemish
-blench
-blench
-blend
-blend
-blent
-bless
-bless
-blessedli
-blessed
-bless
-blesseth
-bless
-bless
-blest
-blew
-blind
-blind
-blindfold
-blind
-blindli
-blind
-blind
-blink
-blink
-bliss
-blist
-blister
-blister
-blith
-blithild
-bloat
-block
-blockish
-block
-bloi
-blood
-blood
-bloodhound
-bloodi
-bloodier
-bloodiest
-bloodili
-bloodless
-blood
-bloodsh
-bloodshed
-bloodstain
-bloodi
-bloom
-bloom
-blossom
-blossom
-blossom
-blot
-blot
-blot
-blot
-blount
-blow
-blow
-blower
-blowest
-blow
-blown
-blow
-blows
-blubb
-blubber
-blubber
-blue
-bluecap
-bluest
-blunt
-blunt
-blunter
-bluntest
-blunt
-bluntli
-blunt
-blunt
-blur
-blurr
-blur
-blush
-blush
-blushest
-blush
-blust
-bluster
-bluster
-bluster
-bo
-boar
-board
-board
-board
-board
-boarish
-boar
-boast
-boast
-boast
-boast
-boast
-boat
-boat
-boatswain
-bob
-bobb
-boblibindo
-bobtail
-bocchu
-bode
-bode
-bodement
-bode
-bodg
-bodi
-bodi
-bodiless
-bodili
-bode
-bodkin
-bodi
-bodykin
-bog
-boggl
-boggler
-bog
-bohemia
-bohemian
-bohun
-boil
-boil
-boil
-boist
-boister
-boister
-boitier
-bold
-bolden
-bolder
-boldest
-boldli
-bold
-bold
-bolingbrok
-bolster
-bolt
-bolt
-bolter
-bolter
-bolt
-bolt
-bombard
-bombard
-bombast
-bon
-bona
-bond
-bondag
-bond
-bondmaid
-bondman
-bondmen
-bond
-bondslav
-bone
-boneless
-bone
-bonfir
-bonfir
-bonjour
-bonn
-bonnet
-bonnet
-bonni
-bono
-bonto
-bonvil
-bood
-book
-bookish
-book
-boon
-boor
-boorish
-boor
-boot
-boot
-booti
-bootless
-boot
-booti
-bor
-bora
-borachio
-bordeaux
-border
-border
-border
-border
-bore
-borea
-bore
-bore
-born
-born
-borough
-borough
-borrow
-borrow
-borrow
-borrow
-borrow
-bosko
-bosko
-boski
-bosom
-bosom
-boson
-boss
-bosworth
-botch
-botcher
-botch
-botchi
-both
-bot
-bottl
-bottl
-bottl
-bottom
-bottomless
-bottom
-bouciqualt
-boug
-bough
-bough
-bought
-bounc
-bounc
-bound
-bound
-bounden
-boundeth
-bound
-boundless
-bound
-bounteou
-bounteous
-bounti
-bounti
-bountifulli
-bounti
-bourbier
-bourbon
-bourchier
-bourdeaux
-bourn
-bout
-bout
-bove
-bow
-bowcas
-bow
-bowel
-bower
-bow
-bowl
-bowler
-bowl
-bowl
-bow
-bowsprit
-bowstr
-box
-box
-boi
-boyet
-boyish
-boi
-brabant
-brabantio
-brabbl
-brabbler
-brac
-brace
-bracelet
-bracelet
-brach
-braci
-brag
-bragg
-braggard
-braggard
-braggart
-braggart
-brag
-brag
-bragless
-brag
-braid
-braid
-brain
-brain
-brainford
-brainish
-brainless
-brain
-brainsick
-brainsickli
-brake
-brakenburi
-brake
-brambl
-bran
-branch
-branch
-branchless
-brand
-brand
-brandish
-brandon
-brand
-bra
-brass
-brassi
-brat
-brat
-brav
-brave
-brave
-brave
-braver
-braveri
-brave
-bravest
-brave
-brawl
-brawler
-brawl
-brawl
-brawn
-brawn
-brai
-brai
-braz
-brazen
-brazier
-breach
-breach
-bread
-breadth
-break
-breaker
-breakfast
-break
-break
-breast
-breast
-breast
-breastplat
-breast
-breath
-breath
-breath
-breather
-breather
-breath
-breathest
-breath
-breathless
-breath
-brecknock
-bred
-breech
-breech
-breech
-breed
-breeder
-breeder
-breed
-breed
-brees
-breez
-breff
-bretagn
-brethen
-bretheren
-brethren
-brevi
-breviti
-brew
-brewag
-brewer
-brewer
-brew
-brew
-briareu
-briar
-brib
-bribe
-briber
-bribe
-brick
-bricklay
-brick
-bridal
-bride
-bridegroom
-bridegroom
-bride
-bridg
-bridgenorth
-bridg
-bridget
-bridl
-bridl
-brief
-briefer
-briefest
-briefli
-brief
-brier
-brier
-brigandin
-bright
-brighten
-brightest
-brightli
-bright
-brim
-brim
-brim
-brimston
-brind
-brine
-bring
-bringer
-bringeth
-bring
-bring
-bring
-brinish
-brink
-brisk
-briski
-bristl
-bristl
-bristli
-bristol
-bristow
-britain
-britain
-britain
-british
-briton
-briton
-brittani
-brittl
-broach
-broach
-broad
-broader
-broadsid
-broca
-brock
-brogu
-broil
-broil
-broil
-broke
-broken
-brokenli
-broker
-broker
-broke
-broke
-brooch
-brooch
-brood
-brood
-brood
-brook
-brook
-broom
-broomstaff
-broth
-brothel
-brother
-brotherhood
-brotherhood
-brotherli
-brother
-broth
-brought
-brow
-brown
-browner
-brownist
-browni
-brow
-brows
-brows
-brui
-bruis
-bruis
-bruis
-bruis
-bruit
-bruit
-brundusium
-brunt
-brush
-brush
-brute
-brutish
-brutu
-bubbl
-bubbl
-bubbl
-bubukl
-buck
-bucket
-bucket
-buck
-buckingham
-buckl
-buckl
-buckler
-buckler
-bucklersburi
-buckl
-buckram
-buck
-bud
-bud
-bud
-budg
-budger
-budget
-bud
-buff
-buffet
-buffet
-buffet
-bug
-bugbear
-bugl
-bug
-build
-build
-buildeth
-build
-build
-build
-built
-bulk
-bulk
-bull
-bullcalf
-bullen
-bullen
-bullet
-bullet
-bullock
-bull
-bulli
-bulmer
-bulwark
-bulwark
-bum
-bumbast
-bump
-bumper
-bum
-bunch
-bunch
-bundl
-bung
-bunghol
-bungl
-bunt
-buoi
-bur
-burbolt
-burd
-burden
-burden
-burden
-burden
-burden
-burgh
-burgher
-burgher
-burglari
-burgomast
-burgonet
-burgundi
-burial
-buri
-burier
-buriest
-burli
-burn
-burn
-burnet
-burneth
-burn
-burnish
-burn
-burnt
-burr
-burrow
-bur
-burst
-burst
-burst
-burthen
-burthen
-burton
-buri
-buri
-bush
-bushel
-bush
-bushi
-busi
-busili
-busin
-busi
-busi
-buskin
-buski
-buss
-buss
-buss
-bustl
-bustl
-busi
-but
-butche
-butcher
-butcher
-butcheri
-butcherli
-butcher
-butcheri
-butler
-butt
-butter
-butter
-butterfli
-butterfli
-butterwoman
-butteri
-buttock
-buttock
-button
-buttonhol
-button
-buttress
-buttri
-butt
-buxom
-bui
-buyer
-bui
-bui
-buzz
-buzzard
-buzzard
-buzzer
-buzz
-by
-bye
-byzantium
-c
-ca
-cabbag
-cabilero
-cabin
-cabin
-cabl
-cabl
-cackl
-cacodemon
-caddi
-caddiss
-cade
-cadenc
-cadent
-cade
-cadmu
-caduceu
-cadwal
-cadwallad
-caeliu
-caelo
-caesar
-caesarion
-caesar
-cage
-cage
-cagion
-cain
-caith
-caitiff
-caitiff
-caiu
-cak
-cake
-cake
-calab
-calai
-calam
-calam
-calcha
-calcul
-calen
-calendar
-calendar
-calf
-caliban
-caliban
-calipoli
-caliti
-caliv
-call
-callat
-call
-callet
-call
-call
-calm
-calmest
-calmli
-calm
-calm
-calpurnia
-calumni
-calumni
-calumni
-calumni
-calv
-calv
-calv
-calveskin
-calydon
-cam
-cambio
-cambria
-cambric
-cambric
-cambridg
-cambys
-came
-camel
-camelot
-camel
-camest
-camillo
-camlet
-camomil
-camp
-campeiu
-camp
-camp
-can
-canakin
-canari
-canari
-cancel
-cancel
-cancel
-cancel
-cancel
-cancer
-candidatu
-candi
-candl
-candl
-candlestick
-candi
-canidiu
-cank
-canker
-cankerblossom
-canker
-cannib
-cannib
-cannon
-cannon
-cannon
-cannot
-canon
-canoniz
-canon
-canon
-canon
-canopi
-canopi
-canopi
-canst
-canstick
-canterburi
-cantl
-canton
-canu
-canva
-canvass
-canzonet
-cap
-capabl
-capabl
-capac
-capac
-caparison
-capdv
-cape
-capel
-capel
-caper
-caper
-capet
-caphi
-capilet
-capitain
-capit
-capit
-capitol
-capitul
-capocchia
-capon
-capon
-capp
-cappadocia
-capriccio
-caprici
-cap
-capt
-captain
-captain
-captainship
-captiou
-captiv
-captiv
-captiv
-captiv
-captiv
-captiv
-captum
-capuciu
-capulet
-capulet
-car
-carack
-carack
-carat
-carawai
-carbonado
-carbuncl
-carbuncl
-carbuncl
-carcanet
-carcas
-carcas
-carcass
-carcass
-card
-cardecu
-card
-carder
-cardin
-cardin
-cardin
-cardmak
-card
-carduu
-care
-care
-career
-career
-care
-carefulli
-careless
-carelessli
-careless
-care
-caret
-cargo
-carl
-carlisl
-carlot
-carman
-carmen
-carnal
-carnal
-carnarvonshir
-carnat
-carnat
-carol
-carou
-carous
-carous
-carous
-carous
-carp
-carpent
-carper
-carpet
-carpet
-carp
-carriag
-carriag
-carri
-carrier
-carrier
-carri
-carrion
-carrion
-carri
-carri
-car
-cart
-carter
-carthag
-cart
-carv
-carv
-carv
-carver
-carv
-carv
-ca
-casa
-casaer
-casca
-case
-casement
-casement
-case
-cash
-cashier
-case
-cask
-casket
-casket
-casket
-casqu
-casqu
-cassado
-cassandra
-cassibelan
-cassio
-cassiu
-cassock
-cast
-castalion
-castawai
-castawai
-cast
-caster
-castig
-castig
-castil
-castiliano
-cast
-castl
-castl
-cast
-casual
-casual
-casualti
-casualti
-cat
-cataian
-catalogu
-cataplasm
-cataract
-catarrh
-catastroph
-catch
-catcher
-catch
-catch
-cate
-catechis
-catech
-catech
-cater
-caterpillar
-cater
-caterwaul
-cate
-catesbi
-cathedr
-catlik
-catl
-catl
-cato
-cat
-cattl
-caucasu
-caudl
-cauf
-caught
-cauldron
-cau
-caus
-caus
-causeless
-causer
-caus
-causest
-causeth
-cautel
-cautel
-cautel
-cauter
-caution
-caution
-cavaleiro
-cavaleri
-cavali
-cave
-cavern
-cavern
-cave
-caveto
-caviari
-cavil
-cavil
-cawdor
-cawdron
-caw
-ce
-cea
-ceas
-ceas
-ceaseth
-cedar
-cedar
-cediu
-celebr
-celebr
-celebr
-celebr
-celer
-celesti
-celia
-cell
-cellar
-cellarag
-celsa
-cement
-censer
-censor
-censorinu
-censur
-censur
-censur
-censur
-censur
-censur
-centaur
-centaur
-centr
-cent
-centuri
-centurion
-centurion
-centuri
-cerberu
-cerecloth
-cerement
-ceremoni
-ceremoni
-ceremoni
-ceremoni
-ceremoni
-cere
-cern
-certain
-certain
-certainli
-certainti
-certainti
-cert
-certif
-certifi
-certifi
-certifi
-ce
-cesario
-cess
-cess
-cestern
-cetera
-cett
-chace
-chaf
-chafe
-chafe
-chafe
-chaff
-chaffless
-chafe
-chain
-chain
-chair
-chair
-chalic
-chalic
-chalic
-chalk
-chalk
-chalki
-challeng
-challeng
-challeng
-challeng
-challeng
-challeng
-cham
-chamber
-chamber
-chamberlain
-chamberlain
-chambermaid
-chambermaid
-chamber
-chameleon
-champ
-champagn
-champain
-champain
-champion
-champion
-chanc
-chanc
-chanc
-chancellor
-chanc
-chandler
-chang
-chang
-changeabl
-chang
-chang
-changel
-changel
-changer
-chang
-changest
-chang
-channel
-channel
-chanson
-chant
-chanticl
-chant
-chantri
-chantri
-chant
-chao
-chap
-chape
-chapel
-chapeless
-chapel
-chaplain
-chaplain
-chapless
-chaplet
-chapmen
-chap
-chapter
-charact
-charact
-characterless
-charact
-characteri
-charact
-charbon
-chare
-chare
-charg
-charg
-charg
-charg
-charg
-chargeth
-charg
-chariest
-chari
-chare
-chariot
-chariot
-charit
-charit
-chariti
-chariti
-charlemain
-charl
-charm
-charm
-charmer
-charmeth
-charmian
-charm
-charmingli
-charm
-charneco
-charnel
-charoloi
-charon
-charter
-charter
-chartreux
-chari
-charybdi
-cha
-chase
-chase
-chaser
-chaseth
-chase
-chast
-chast
-chasti
-chastis
-chastis
-chastis
-chastiti
-chat
-chatham
-chatillon
-chat
-chatt
-chattel
-chatter
-chatter
-chattl
-chaud
-chaunt
-chaw
-chawdron
-che
-cheap
-cheapen
-cheaper
-cheapest
-cheapli
-cheapsid
-cheat
-cheat
-cheater
-cheater
-cheat
-cheat
-check
-check
-checker
-check
-check
-cheek
-cheek
-cheer
-cheer
-cheerer
-cheer
-cheerfulli
-cheer
-cheerless
-cheerli
-cheer
-chees
-chequer
-cher
-cherish
-cherish
-cherish
-cherish
-cherish
-cherri
-cherri
-cherrypit
-chertsei
-cherub
-cherubim
-cherubin
-cherubin
-cheshu
-chess
-chest
-chester
-chestnut
-chestnut
-chest
-cheta
-chev
-cheval
-chevali
-chevali
-cheveril
-chew
-chew
-chewet
-chew
-chez
-chi
-chick
-chicken
-chicken
-chicurmurco
-chid
-chidden
-chide
-chider
-chide
-chide
-chief
-chiefest
-chiefli
-chien
-child
-child
-childer
-childhood
-childhood
-child
-childish
-childish
-childlik
-child
-children
-chill
-chill
-chime
-chime
-chimnei
-chimneypiec
-chimnei
-chimurcho
-chin
-china
-chine
-chine
-chink
-chink
-chin
-chipp
-chipper
-chip
-chiron
-chirp
-chirrah
-chirurgeonli
-chisel
-chitoph
-chivalr
-chivalri
-choic
-choic
-choicest
-choir
-choir
-chok
-choke
-choke
-choke
-choke
-choler
-choler
-choler
-chollor
-choos
-chooser
-choos
-chooseth
-choos
-chop
-chopin
-choplog
-chopp
-chop
-chop
-choppi
-chop
-chopt
-chor
-chorist
-choru
-chose
-chosen
-chough
-chough
-chrish
-christ
-christen
-christendom
-christendom
-christen
-christen
-christian
-christianlik
-christian
-christma
-christom
-christoph
-christophero
-chronicl
-chronicl
-chronicl
-chronicl
-chronicl
-chrysolit
-chuck
-chuck
-chud
-chuff
-church
-church
-churchman
-churchmen
-churchyard
-churchyard
-churl
-churlish
-churlishli
-churl
-churn
-chu
-cicatric
-cicatric
-cice
-cicero
-cicet
-ciel
-ciitzen
-cilicia
-cimber
-cimmerian
-cinabl
-cinctur
-cinder
-cine
-cinna
-cinqu
-cipher
-cipher
-circa
-circ
-circl
-circl
-circlet
-circl
-circuit
-circum
-circumcis
-circumfer
-circummur
-circumscrib
-circumscrib
-circumscript
-circumspect
-circumst
-circumstanc
-circumst
-circumstanti
-circumv
-circumvent
-cistern
-citadel
-cital
-cite
-cite
-cite
-citi
-cite
-citizen
-citizen
-cittern
-citi
-civet
-civil
-civil
-civilli
-clack
-clad
-claim
-claim
-claim
-clamb
-clamber
-clammer
-clamor
-clamor
-clamor
-clamour
-clamour
-clang
-clangor
-clap
-clapp
-clap
-clapper
-clap
-clap
-clare
-clarenc
-claret
-claribel
-clasp
-clasp
-clatter
-claud
-claudio
-claudiu
-claus
-claw
-claw
-claw
-claw
-clai
-clai
-clean
-cleanliest
-cleanli
-clean
-cleans
-cleans
-clear
-clearer
-clearest
-clearli
-clear
-clear
-cleav
-cleav
-clef
-cleft
-cleitu
-clemenc
-clement
-cleomen
-cleopatpa
-cleopatra
-clepeth
-clept
-clerestori
-clergi
-clergyman
-clergymen
-clerk
-clerkli
-clerk
-clew
-client
-client
-cliff
-clifford
-clifford
-cliff
-clifton
-climat
-climatur
-climb
-climb
-climber
-climbeth
-climb
-climb
-clime
-cling
-clink
-clink
-clinquant
-clip
-clipp
-clipper
-clippeth
-clip
-clipt
-clitu
-clo
-cloak
-cloakbag
-cloak
-clock
-clock
-clod
-cloddi
-clodpol
-clog
-clog
-clog
-cloister
-cloistress
-cloquenc
-clo
-close
-close
-close
-close
-closer
-close
-closest
-closet
-close
-closur
-cloten
-cloten
-cloth
-clothair
-clothariu
-cloth
-cloth
-clothier
-clothier
-cloth
-cloth
-clotpol
-clotpol
-cloud
-cloud
-cloudi
-cloud
-cloudi
-clout
-clout
-clout
-cloven
-clover
-clove
-clovest
-clowder
-clown
-clownish
-clown
-cloi
-cloi
-cloi
-cloyless
-cloyment
-cloi
-club
-club
-cluck
-clung
-clust
-cluster
-clutch
-clyster
-cneiu
-cnemi
-co
-coach
-coach
-coachmak
-coact
-coactiv
-coagul
-coal
-coal
-coars
-coars
-coast
-coast
-coast
-coat
-coat
-coat
-cobbl
-cobbl
-cobbler
-cobham
-cobloaf
-cobweb
-cobweb
-cock
-cockatric
-cockatric
-cockl
-cockl
-cocknei
-cockpit
-cock
-cocksur
-coctu
-cocytu
-cod
-cod
-codl
-codpiec
-codpiec
-cod
-coelestibu
-coesar
-coeur
-coffer
-coffer
-coffin
-coffin
-cog
-cog
-cogit
-cogit
-cognit
-cogniz
-cogscomb
-cohabit
-coher
-coher
-coher
-coher
-cohort
-coif
-coign
-coil
-coin
-coinag
-coiner
-coin
-coin
-col
-colbrand
-colcho
-cold
-colder
-coldest
-coldli
-cold
-coldspur
-colebrook
-colic
-collar
-collar
-collater
-colleagu
-collect
-collect
-collect
-colleg
-colleg
-colli
-collier
-collier
-collop
-collus
-colm
-colmekil
-coloquintida
-color
-color
-colossu
-colour
-colour
-colour
-colour
-colour
-colt
-colt
-colt
-columbin
-columbin
-colvil
-com
-comagen
-comart
-comb
-combat
-combat
-combat
-combat
-combat
-combin
-combin
-combin
-combin
-combin
-combless
-combust
-come
-comedian
-comedian
-comedi
-comeli
-come
-comer
-comer
-come
-comest
-comet
-cometh
-comet
-comfect
-comfit
-comfit
-comfort
-comfort
-comfort
-comfort
-comfort
-comfortless
-comfort
-comic
-comic
-come
-come
-cominiu
-comma
-command
-command
-command
-command
-command
-command
-command
-command
-command
-comm
-commenc
-commenc
-commenc
-commenc
-commenc
-commenc
-commend
-commend
-commend
-commend
-commend
-commend
-commend
-comment
-commentari
-comment
-comment
-commerc
-commingl
-commiser
-commiss
-commission
-commiss
-commit
-commit
-committ
-commit
-commit
-commix
-commix
-commixt
-commixtur
-commodi
-commod
-commod
-common
-commonalti
-common
-common
-commonli
-common
-commonw
-commonwealth
-commot
-commot
-commun
-communicat
-commun
-commun
-commun
-commun
-comonti
-compact
-compani
-companion
-companion
-companionship
-compani
-compar
-compar
-compar
-compar
-compar
-comparison
-comparison
-compartn
-compass
-compass
-compass
-compass
-compassion
-compeer
-compel
-compel
-compel
-compel
-compel
-compens
-compet
-compet
-compet
-competitor
-competitor
-compil
-compil
-compil
-complain
-complain
-complainest
-complain
-complain
-complain
-complaint
-complaint
-complement
-complement
-complet
-complexion
-complexion
-complexion
-complic
-compli
-compliment
-compliment
-compliment
-complot
-complot
-complot
-compli
-compo
-compos
-compos
-composit
-compost
-compostur
-composur
-compound
-compound
-compound
-comprehend
-comprehend
-comprehend
-compremis
-compri
-compris
-compromi
-compromis
-compt
-comptibl
-comptrol
-compulsatori
-compuls
-compuls
-compuncti
-comput
-comrad
-comrad
-comutu
-con
-concav
-concav
-conceal
-conceal
-conceal
-conceal
-conceal
-conceal
-conceit
-conceit
-conceitless
-conceit
-conceiv
-conceiv
-conceiv
-conceiv
-conceiv
-concept
-concept
-concepti
-concern
-concern
-concerneth
-concern
-concern
-concern
-conclav
-conclud
-conclud
-conclud
-conclud
-conclud
-conclus
-conclus
-concolinel
-concord
-concubin
-concupisc
-concupi
-concur
-concur
-concur
-condemn
-condemn
-condemn
-condemn
-condemn
-condescend
-condign
-condit
-condition
-condit
-condol
-condol
-condol
-conduc
-conduct
-conduct
-conduct
-conductor
-conduit
-conduit
-conect
-conei
-confect
-confectionari
-confect
-confederaci
-confeder
-confeder
-confer
-confer
-conferr
-confer
-confess
-confess
-confess
-confesseth
-confess
-confess
-confess
-confessor
-confid
-confid
-confid
-confin
-confin
-confin
-confineless
-confin
-confin
-confin
-confirm
-confirm
-confirm
-confirm
-confirm
-confirm
-confirm
-confirm
-confirm
-confisc
-confisc
-confisc
-confix
-conflict
-conflict
-conflict
-confluenc
-conflux
-conform
-conform
-confound
-confound
-confound
-confound
-confront
-confront
-confu
-confus
-confusedli
-confus
-confus
-confut
-confut
-congeal
-congeal
-congeal
-conge
-conger
-congest
-congi
-congratul
-congre
-congreet
-congreg
-congreg
-congreg
-congreg
-congruent
-congru
-coni
-conjectur
-conjectur
-conjectur
-conjoin
-conjoin
-conjoin
-conjointli
-conjunct
-conjunct
-conjunct
-conjur
-conjur
-conjur
-conjur
-conjur
-conjur
-conjur
-conjur
-conjur
-conjuro
-conn
-connect
-conniv
-conqu
-conquer
-conquer
-conquer
-conqueror
-conqueror
-conquer
-conquest
-conquest
-conqur
-conrad
-con
-consanguin
-consanguin
-conscienc
-conscienc
-conscienc
-conscion
-consecr
-consecr
-consecr
-consent
-consent
-consent
-consent
-consequ
-consequ
-consequ
-conserv
-conserv
-conserv
-consid
-consider
-consider
-consider
-consider
-consid
-consid
-consid
-consid
-consign
-consign
-consist
-consisteth
-consist
-consistori
-consist
-consol
-consol
-conson
-conson
-consort
-consort
-consortest
-conspectu
-conspir
-conspiraci
-conspir
-conspir
-conspir
-conspir
-conspir
-conspir
-conspir
-conspir
-constabl
-constabl
-constanc
-constanc
-constanc
-constant
-constantin
-constantinopl
-constantli
-constel
-constitut
-constrain
-constrain
-constraineth
-constrain
-constraint
-constr
-construct
-constru
-consul
-consul
-consulship
-consulship
-consult
-consult
-consult
-consum
-consum
-consum
-consum
-consum
-consumm
-consumm
-consumpt
-consumpt
-contagion
-contagi
-contain
-contain
-contain
-contamin
-contamin
-contemn
-contemn
-contemn
-contemn
-contempl
-contempl
-contempl
-contempt
-contempt
-contempt
-contemptu
-contemptu
-contend
-contend
-contend
-contendon
-content
-contenta
-content
-contenteth
-content
-contenti
-contentless
-contento
-content
-contest
-contest
-contin
-contin
-contin
-contin
-continu
-continu
-continu
-continu
-continuantli
-continu
-continu
-continu
-continu
-continu
-continu
-contract
-contract
-contract
-contract
-contradict
-contradict
-contradict
-contradict
-contrari
-contrarieti
-contrarieti
-contrari
-contrari
-contrari
-contr
-contribut
-contributor
-contrit
-contriv
-contriv
-contriv
-contriv
-contriv
-contriv
-control
-control
-control
-control
-control
-control
-controversi
-contumeli
-contumeli
-contum
-contus
-conveni
-conveni
-conveni
-conveni
-conveni
-convent
-conventicl
-convent
-conver
-convers
-convers
-convers
-convers
-convers
-convers
-convers
-convers
-convert
-convert
-convertest
-convert
-convertit
-convertit
-convert
-convei
-convey
-convey
-convey
-convei
-convict
-convict
-convinc
-convinc
-convinc
-conviv
-convoc
-convoi
-convuls
-coni
-cook
-cookeri
-cook
-cool
-cool
-cool
-cool
-coop
-coop
-cop
-copatain
-cope
-cophetua
-copi
-copi
-copiou
-copper
-copperspur
-coppic
-copul
-copul
-copi
-cor
-coragio
-coral
-coram
-corambu
-coranto
-coranto
-corbo
-cord
-cord
-cordelia
-cordial
-cordi
-cord
-core
-corin
-corinth
-corinthian
-coriolanu
-corioli
-cork
-corki
-cormor
-corn
-cornelia
-corneliu
-corner
-corner
-cornerston
-cornet
-cornish
-corn
-cornuto
-cornwal
-corollari
-coron
-coron
-coronet
-coronet
-corpor
-corpor
-corpor
-corps
-corpul
-correct
-correct
-correct
-correct
-correction
-correct
-correspond
-correspond
-correspond
-correspons
-corrig
-corriv
-corriv
-corrobor
-corros
-corrupt
-corrupt
-corrupt
-corrupt
-corrupt
-corrupt
-corrupt
-corrupt
-corruptli
-corrupt
-cors
-cors
-corslet
-cosmo
-cost
-costard
-costermong
-costlier
-costli
-cost
-cot
-cote
-cote
-cotsal
-cotsol
-cotswold
-cottag
-cottag
-cotu
-couch
-couch
-couch
-couch
-coud
-cough
-cough
-could
-couldst
-coulter
-council
-councillor
-council
-counsel
-counsel
-counsellor
-counsellor
-counselor
-counselor
-counsel
-count
-count
-countenanc
-counten
-counten
-counter
-counterchang
-countercheck
-counterfeit
-counterfeit
-counterfeit
-counterfeitli
-counterfeit
-countermand
-countermand
-countermin
-counterpart
-counterpoint
-counterpoi
-counterpois
-counter
-countervail
-countess
-countess
-counti
-count
-countless
-countri
-countrv
-countri
-countryman
-countrymen
-count
-counti
-couper
-coupl
-coupl
-couplement
-coupl
-couplet
-couplet
-cour
-courag
-courag
-courag
-courag
-courier
-courier
-couronn
-cour
-cours
-cours
-courser
-courser
-cours
-cours
-court
-court
-courteou
-courteous
-courtesan
-courtesi
-courtesi
-courtezan
-courtezan
-courtier
-courtier
-courtlik
-courtli
-courtnei
-court
-courtship
-cousin
-cousin
-couterfeit
-coutum
-coven
-coven
-covent
-coventri
-cover
-cover
-cover
-coverlet
-cover
-covert
-covertli
-covertur
-covet
-covet
-covet
-covet
-covet
-covet
-covet
-covet
-cow
-coward
-coward
-cowardic
-cowardli
-coward
-cowardship
-cowish
-cowl
-cowslip
-cowslip
-cox
-coxcomb
-coxcomb
-coi
-coystril
-coz
-cozen
-cozenag
-cozen
-cozen
-cozen
-cozen
-cozier
-crab
-crab
-crab
-crack
-crack
-cracker
-cracker
-crack
-crack
-cradl
-cradl
-cradl
-craft
-craft
-crafti
-craftier
-craftili
-craft
-craftsmen
-crafti
-cram
-cramm
-cramp
-cramp
-cram
-crank
-crank
-cranmer
-cranni
-cranni
-cranni
-crant
-crare
-crash
-crassu
-crav
-crave
-crave
-craven
-craven
-crave
-craveth
-crave
-crawl
-crawl
-crawl
-craz
-craze
-crazi
-creak
-cream
-creat
-creat
-creat
-creat
-creation
-creator
-creatur
-creatur
-credenc
-credent
-credibl
-credit
-creditor
-creditor
-credo
-credul
-credul
-creed
-creek
-creek
-creep
-creep
-creep
-crept
-crescent
-cresciv
-cresset
-cressid
-cressida
-cressid
-cressi
-crest
-crest
-crestfal
-crestless
-crest
-cretan
-crete
-crevic
-crew
-crew
-crib
-cribb
-crib
-cricket
-cricket
-cri
-criedst
-crier
-cri
-criest
-crieth
-crime
-crime
-crimeless
-crime
-crimin
-crimson
-cring
-crippl
-crisp
-crisp
-crispian
-crispianu
-crispin
-critic
-critic
-critic
-croak
-croak
-croak
-crocodil
-cromer
-cromwel
-crone
-crook
-crookback
-crook
-crook
-crop
-cropp
-crosbi
-cross
-cross
-cross
-crossest
-cross
-cross
-crossli
-cross
-crost
-crotchet
-crouch
-crouch
-crow
-crowd
-crowd
-crowd
-crowd
-crowflow
-crow
-crowkeep
-crown
-crown
-crowner
-crownet
-crownet
-crown
-crown
-crow
-crudi
-cruel
-cruell
-crueller
-cruelli
-cruel
-cruelti
-crum
-crumbl
-crumb
-crupper
-crusado
-crush
-crush
-crushest
-crush
-crust
-crust
-crusti
-crutch
-crutch
-cry
-cry
-crystal
-crystallin
-crystal
-cub
-cubbert
-cubiculo
-cubit
-cub
-cuckold
-cuckoldli
-cuckold
-cuckoo
-cucullu
-cudgel
-cudgel
-cudgel
-cudgel
-cudgel
-cue
-cue
-cuff
-cuff
-cuiqu
-cull
-cull
-cullion
-cullionli
-cullion
-culpabl
-culverin
-cum
-cumber
-cumberland
-cun
-cunningli
-cun
-cuor
-cup
-cupbear
-cupboard
-cupid
-cupid
-cuppel
-cup
-cur
-curan
-curat
-curb
-curb
-curb
-curb
-curd
-curdi
-curd
-cure
-cure
-cureless
-curer
-cure
-curfew
-cure
-curio
-curios
-curiou
-curious
-curl
-curl
-curl
-curl
-curranc
-currant
-current
-current
-currish
-curri
-cur
-curs
-curs
-curs
-cursi
-curs
-cursorari
-curst
-curster
-curstest
-curst
-cursi
-curtail
-curtain
-curtain
-curtal
-curti
-curtl
-curtsi
-curtsi
-curtsi
-curvet
-curvet
-cush
-cushion
-cushion
-custalorum
-custard
-custodi
-custom
-customari
-custom
-custom
-custom
-custom
-custur
-cut
-cutler
-cutpurs
-cutpurs
-cut
-cutter
-cut
-cuttl
-cxsar
-cyclop
-cydnu
-cygnet
-cygnet
-cym
-cymbal
-cymbelin
-cyme
-cynic
-cynthia
-cypress
-cypriot
-cypru
-cyru
-cytherea
-d
-dabbl
-dace
-dad
-daedalu
-daemon
-daff
-daf
-daffest
-daffodil
-dagger
-dagger
-dagonet
-daili
-daintier
-dainti
-daintiest
-daintili
-dainti
-daintri
-dainti
-daisi
-daisi
-daisi
-dale
-dallianc
-dalli
-dalli
-dalli
-dalli
-dalmatian
-dam
-damag
-damascu
-damask
-damask
-dame
-dame
-damm
-damn
-damnabl
-damnabl
-damnat
-damn
-damn
-damoisel
-damon
-damosella
-damp
-dam
-damsel
-damson
-dan
-danc
-danc
-dancer
-danc
-danc
-dandl
-dandi
-dane
-dang
-danger
-danger
-danger
-danger
-dangl
-daniel
-danish
-dank
-dankish
-dansker
-daphn
-dappl
-dappl
-dar
-dardan
-dardanian
-dardaniu
-dare
-dare
-dare
-dare
-darest
-dare
-dariu
-dark
-darken
-darken
-darken
-darker
-darkest
-darkl
-darkli
-dark
-darl
-darl
-darnel
-darraign
-dart
-dart
-darter
-dartford
-dart
-dart
-dash
-dash
-dash
-dastard
-dastard
-dat
-datchet
-date
-date
-dateless
-date
-daub
-daughter
-daughter
-daunt
-daunt
-dauntless
-dauphin
-daventri
-davi
-daw
-dawn
-dawn
-daw
-dai
-daylight
-dai
-dazzl
-dazzl
-dazzl
-de
-dead
-deadli
-deaf
-deaf
-deaf
-deaf
-deal
-dealer
-dealer
-dealest
-deal
-deal
-deal
-dealt
-dean
-deaneri
-dear
-dearer
-dearest
-dearli
-dear
-dear
-dearth
-dearth
-death
-deathb
-death
-death
-deathsman
-deathsmen
-debar
-debas
-debat
-debat
-debat
-debateth
-debat
-debauch
-debil
-debil
-debitor
-debonair
-deborah
-debosh
-debt
-debt
-debtor
-debtor
-debt
-debuti
-decai
-decai
-decay
-decai
-decai
-decea
-deceas
-deceas
-deceit
-deceit
-deceit
-deceiv
-deceiv
-deceiv
-deceiv
-deceiv
-deceiv
-deceiv
-deceivest
-deceiveth
-deceiv
-decemb
-decent
-decepti
-decern
-decid
-decid
-decim
-deciph
-deciph
-decis
-deciu
-deck
-deck
-deck
-deckt
-declar
-declar
-declens
-declens
-declin
-declin
-declin
-declin
-declin
-decoct
-decorum
-decrea
-decreas
-decreas
-decre
-decre
-decre
-decrepit
-dedic
-dedic
-dedic
-dedic
-deed
-deedless
-deed
-deem
-deem
-deep
-deeper
-deepest
-deepli
-deep
-deepvow
-deer
-deess
-defac
-defac
-defac
-defac
-defac
-defac
-defam
-default
-defeat
-defeat
-defeat
-defeatur
-defect
-defect
-defect
-defenc
-defenc
-defend
-defend
-defend
-defend
-defend
-defend
-defend
-defens
-defens
-defens
-defer
-deferr
-defianc
-defici
-defi
-defi
-defil
-defil
-defil
-defil
-defil
-defin
-defin
-definit
-definit
-definit
-deflow
-deflow
-deflow
-deform
-deform
-deform
-deform
-deftli
-defunct
-defunct
-defus
-defi
-defi
-degener
-degrad
-degre
-degre
-deifi
-deifi
-deign
-deign
-deiphobu
-deiti
-deiti
-deja
-deject
-deject
-delabreth
-delai
-delai
-delai
-delai
-delect
-deliber
-delic
-delic
-delici
-delici
-delight
-delight
-delight
-delight
-delinqu
-deliv
-deliv
-deliver
-deliv
-deliv
-deliv
-deliveri
-delpho
-delud
-delud
-delug
-delv
-delver
-delv
-demand
-demand
-demand
-demand
-demean
-demeanor
-demeanour
-demerit
-demesn
-demetriu
-demi
-demigod
-demis
-demoisel
-demon
-demonstr
-demonstr
-demonstr
-demonstr
-demonstr
-demonstr
-demur
-demur
-demur
-den
-denai
-deni
-denial
-denial
-deni
-denier
-deni
-deniest
-deni
-denmark
-denni
-denni
-denot
-denot
-denot
-denounc
-denounc
-denounc
-den
-denunci
-deni
-deni
-deo
-depart
-depart
-departest
-depart
-departur
-depech
-depend
-depend
-depend
-depend
-depend
-depend
-depend
-depend
-depend
-depend
-depend
-depend
-deplor
-deplor
-depopul
-depo
-depos
-depos
-depos
-depositari
-deprav
-deprav
-deprav
-deprav
-deprav
-depress
-depriv
-depriv
-depth
-depth
-deput
-deput
-deput
-deputi
-deput
-deputi
-deracin
-derbi
-derceta
-dere
-derid
-deris
-deriv
-deriv
-deriv
-deriv
-deriv
-deriv
-derog
-derog
-derog
-de
-desartless
-descant
-descend
-descend
-descend
-descend
-descens
-descent
-descent
-describ
-describ
-describ
-descri
-descript
-descript
-descri
-desdemon
-desdemona
-desert
-desert
-deserv
-deserv
-deserv
-deservedli
-deserv
-deserv
-deserv
-deservest
-deserv
-deserv
-design
-design
-design
-design
-desir
-desir
-desir
-desir
-desir
-desirest
-desir
-desir
-desist
-desk
-desol
-desol
-desp
-despair
-despair
-despair
-despatch
-desper
-desper
-desper
-despi
-despis
-despis
-despis
-despiseth
-despis
-despit
-despit
-despoil
-dest
-destin
-destin
-destini
-destini
-destitut
-destroi
-destroi
-destroy
-destroy
-destroi
-destroi
-destruct
-destruct
-det
-detain
-detain
-detect
-detect
-detect
-detect
-detector
-detect
-detent
-determin
-determin
-determin
-determin
-determin
-determin
-determin
-detest
-detest
-detest
-detest
-detest
-detract
-detract
-detract
-deucalion
-deuc
-deum
-deux
-devant
-devest
-devic
-devic
-devil
-devilish
-devil
-devi
-devis
-devis
-devis
-devis
-devoid
-devonshir
-devot
-devot
-devot
-devour
-devour
-devour
-devour
-devour
-devout
-devoutli
-dew
-dewberri
-dewdrop
-dewlap
-dewlapp
-dew
-dewi
-dexter
-dexteri
-dexter
-di
-diabl
-diablo
-diadem
-dial
-dialect
-dialogu
-dialogu
-dial
-diamet
-diamond
-diamond
-dian
-diana
-diaper
-dibbl
-dic
-dice
-dicer
-dich
-dick
-dicken
-dickon
-dicki
-dictat
-diction
-dictynna
-did
-diddl
-didest
-dido
-didst
-die
-di
-diedst
-di
-diest
-diet
-diet
-dieter
-dieu
-diff
-differ
-differ
-differ
-differ
-differ
-differ
-differ
-difficil
-difficult
-difficulti
-difficulti
-diffid
-diffid
-diffu
-diffus
-diffusest
-dig
-digest
-digest
-digest
-digest
-digg
-dig
-dighton
-dignifi
-dignifi
-dignifi
-digniti
-digniti
-digress
-digress
-digress
-dig
-digt
-dilat
-dilat
-dilat
-dilatori
-dild
-dildo
-dilemma
-dilemma
-dilig
-dilig
-diluculo
-dim
-dimens
-dimens
-diminish
-diminish
-diminut
-diminut
-diminut
-dimm
-dim
-dim
-dimpl
-dimpl
-dim
-din
-dine
-dine
-diner
-dine
-ding
-dine
-dinner
-dinner
-dinnertim
-dint
-diom
-diomed
-diomed
-dion
-dip
-dipp
-dip
-dip
-dir
-dire
-direct
-direct
-direct
-direct
-direct
-directitud
-direct
-directli
-direct
-dire
-dire
-direst
-dirg
-dirg
-dirt
-dirti
-di
-disabl
-disabl
-disabl
-disabl
-disadvantag
-disagre
-disallow
-disanim
-disannul
-disannul
-disappoint
-disarm
-disarm
-disarmeth
-disarm
-disast
-disast
-disastr
-disbench
-disbranch
-disburden
-disbur
-disburs
-disburs
-discandi
-discandi
-discard
-discard
-discas
-discas
-discern
-discern
-discern
-discern
-discern
-discharg
-discharg
-discharg
-discharg
-discipl
-discipl
-disciplin
-disciplin
-disciplin
-disciplin
-disclaim
-disclaim
-disclaim
-disclo
-disclos
-disclos
-disclos
-discolour
-discolour
-discolour
-discomfit
-discomfit
-discomfitur
-discomfort
-discomfort
-discommend
-disconsol
-discont
-discont
-discontentedli
-discont
-discont
-discontinu
-discontinu
-discord
-discord
-discord
-discours
-discours
-discours
-discours
-discours
-discourtesi
-discov
-discov
-discov
-discover
-discoveri
-discov
-discov
-discoveri
-discredit
-discredit
-discredit
-discreet
-discreetli
-discret
-discret
-discuss
-disdain
-disdain
-disdaineth
-disdain
-disdainfulli
-disdain
-disdain
-disdnguish
-disea
-diseas
-diseas
-diseas
-disedg
-disembark
-disfigur
-disfigur
-disfurnish
-disgorg
-disgrac
-disgrac
-disgrac
-disgrac
-disgrac
-disgrac
-disgraci
-disgui
-disguis
-disguis
-disguis
-disguis
-disguis
-dish
-dishabit
-dishclout
-dishearten
-dishearten
-dish
-dishonest
-dishonestli
-dishonesti
-dishonor
-dishonor
-dishonor
-dishonour
-dishonour
-dishonour
-dishonour
-disinherit
-disinherit
-disjoin
-disjoin
-disjoin
-disjoint
-disjunct
-dislik
-dislik
-disliken
-dislik
-dislimn
-disloc
-dislodg
-disloy
-disloyalti
-dismal
-dismantl
-dismantl
-dismask
-dismai
-dismai
-dismemb
-dismemb
-dism
-dismiss
-dismiss
-dismiss
-dismiss
-dismount
-dismount
-disnatur
-disobedi
-disobedi
-disobei
-disobei
-disorb
-disord
-disord
-disorderli
-disord
-disparag
-disparag
-disparag
-dispark
-dispatch
-dispens
-dispens
-dispens
-disper
-dispers
-dispers
-dispersedli
-dispers
-dispit
-displac
-displac
-displac
-displant
-displant
-displai
-displai
-displea
-displeas
-displeas
-displeas
-displeasur
-displeasur
-dispong
-disport
-disport
-dispo
-dispos
-dispos
-dispos
-dispos
-disposit
-disposit
-dispossess
-dispossess
-disprai
-disprais
-disprais
-dispraisingli
-disproperti
-disproport
-disproport
-disprov
-disprov
-disprov
-dispurs
-disput
-disput
-disput
-disput
-disput
-disput
-disput
-disquant
-disquiet
-disquietli
-disrelish
-disrob
-disseat
-dissembl
-dissembl
-dissembl
-dissembl
-dissembl
-dissembl
-dissens
-dissens
-dissenti
-dissev
-dissip
-dissolut
-dissolut
-dissolut
-dissolut
-dissolv
-dissolv
-dissolv
-dissolv
-dissuad
-dissuad
-distaff
-distaff
-distain
-distain
-distanc
-distant
-distast
-distast
-distast
-distemp
-distemp
-distemperatur
-distemperatur
-distemp
-distemp
-distil
-distil
-distil
-distil
-distil
-distil
-distinct
-distinct
-distinctli
-distingu
-distinguish
-distinguish
-distinguish
-distract
-distract
-distractedli
-distract
-distract
-distract
-distrain
-distraught
-distress
-distress
-distress
-distress
-distribut
-distribut
-distribut
-distrust
-distrust
-disturb
-disturb
-disturb
-disturb
-disunit
-disvalu
-disvouch
-dit
-ditch
-ditcher
-ditch
-dite
-ditti
-ditti
-diurnal
-div
-dive
-diver
-diver
-divers
-divers
-divert
-divert
-divert
-dive
-divest
-divid
-divid
-divid
-divid
-divid
-divideth
-divin
-divin
-divin
-divin
-divin
-divin
-divin
-divinest
-divin
-divin
-divis
-divis
-divorc
-divorc
-divorc
-divorc
-divorc
-divulg
-divulg
-divulg
-divulg
-dizi
-dizzi
-do
-doat
-dobbin
-dock
-dock
-doct
-doctor
-doctor
-doctrin
-document
-dodg
-doe
-doer
-doer
-doe
-doest
-doff
-dog
-dogberri
-dogfish
-dogg
-dog
-dog
-doigt
-do
-do
-doit
-doit
-dolabella
-dole
-dole
-doll
-dollar
-dollar
-dolor
-dolor
-dolour
-dolour
-dolphin
-dolt
-dolt
-domest
-domest
-domin
-domin
-domin
-domin
-domin
-domin
-domin
-dominion
-dominion
-domitiu
-dommelton
-don
-donalbain
-donat
-donc
-doncast
-done
-dong
-donn
-donn
-donner
-donnerai
-doom
-doomsdai
-door
-doorkeep
-door
-dorca
-doreu
-doricl
-dormous
-dorothi
-dorset
-dorsetshir
-dost
-dotag
-dotant
-dotard
-dotard
-dote
-dote
-doter
-dote
-doteth
-doth
-dote
-doubl
-doubl
-doubl
-doubler
-doublet
-doublet
-doubl
-doubli
-doubt
-doubt
-doubt
-doubtfulli
-doubt
-doubtless
-doubt
-doug
-dough
-doughti
-doughi
-dougla
-dout
-dout
-dout
-dove
-dovehous
-dover
-dove
-dow
-dowag
-dowdi
-dower
-dowerless
-dower
-dowla
-dowl
-down
-downfal
-downright
-down
-downstair
-downtrod
-downward
-downward
-downi
-dowri
-dowri
-dowsabel
-doxi
-doze
-dozen
-dozen
-dozi
-drab
-drab
-drab
-drachma
-drachma
-draff
-drag
-dragg
-drag
-drag
-dragon
-dragonish
-dragon
-drain
-drain
-drain
-drake
-dram
-dramati
-drank
-draught
-draught
-drave
-draw
-drawbridg
-drawer
-drawer
-draweth
-draw
-drawl
-drawn
-draw
-drayman
-draymen
-dread
-dread
-dread
-dreadfulli
-dread
-dread
-dream
-dreamer
-dreamer
-dream
-dream
-dreamt
-drearn
-dreari
-dreg
-dreg
-drench
-drench
-dress
-dress
-dresser
-dress
-dress
-drest
-drew
-dribbl
-dri
-drier
-dri
-drift
-drili
-drink
-drinketh
-drink
-drink
-drink
-driv
-drive
-drivel
-driven
-drive
-driveth
-drive
-drizzl
-drizzl
-drizzl
-droit
-drolleri
-dromio
-dromio
-drone
-drone
-droop
-droopeth
-droop
-droop
-drop
-dropheir
-droplet
-dropp
-dropper
-droppeth
-drop
-drop
-drop
-dropsi
-dropsi
-dropsi
-dropt
-dross
-drossi
-drought
-drove
-droven
-drovier
-drown
-drown
-drown
-drown
-drow
-drows
-drowsili
-drowsi
-drowsi
-drudg
-drudgeri
-drudg
-drug
-drugg
-drug
-drum
-drumbl
-drummer
-drum
-drum
-drunk
-drunkard
-drunkard
-drunken
-drunkenli
-drunken
-dry
-dryness
-dst
-du
-dub
-dubb
-ducat
-ducat
-ducdam
-duchess
-duchi
-duchi
-duck
-duck
-duck
-dudgeon
-due
-duellist
-duello
-duer
-due
-duff
-dug
-dug
-duke
-dukedom
-dukedom
-duke
-dulcet
-dulch
-dull
-dullard
-duller
-dullest
-dull
-dull
-dull
-dulli
-dul
-duli
-dumain
-dumb
-dumb
-dumbl
-dumb
-dump
-dump
-dun
-duncan
-dung
-dungeon
-dungeon
-dunghil
-dunghil
-dungi
-dunnest
-dunsinan
-dunsmor
-dunstabl
-dupp
-duranc
-dure
-durst
-duski
-dust
-dust
-dusti
-dutch
-dutchman
-duteou
-duti
-duti
-duti
-dwarf
-dwarfish
-dwell
-dweller
-dwell
-dwell
-dwelt
-dwindl
-dy
-dye
-dy
-dyer
-dy
-e
-each
-eager
-eagerli
-eager
-eagl
-eagl
-ean
-eanl
-ear
-ear
-earl
-earldom
-earlier
-earliest
-earli
-earl
-earli
-earn
-earn
-earnest
-earnestli
-earnest
-earn
-ear
-earth
-earthen
-earthlier
-earthli
-earthquak
-earthquak
-earthi
-ea
-eas
-eas
-eas
-eas
-easier
-easiest
-easiliest
-easili
-easi
-eas
-east
-eastcheap
-easter
-eastern
-eastward
-easi
-eat
-eaten
-eater
-eater
-eat
-eat
-eaux
-eav
-ebb
-eb
-ebb
-ebon
-eboni
-ebrew
-ecc
-echapp
-echo
-echo
-eclip
-eclips
-eclips
-ecoli
-ecoutez
-ecstaci
-ecstasi
-ecstasi
-ecu
-eden
-edg
-edgar
-edg
-edg
-edgeless
-edg
-edict
-edict
-edific
-edific
-edifi
-edifi
-edit
-edm
-edmund
-edmund
-edmundsburi
-educ
-educ
-educ
-edward
-eel
-eel
-effect
-effect
-effectless
-effect
-effectu
-effectu
-effemin
-effigi
-effu
-effus
-effus
-eftest
-egal
-egal
-eget
-egeu
-egg
-egg
-eggshel
-eglamour
-eglantin
-egma
-ego
-egregi
-egregi
-egress
-egypt
-egyptian
-egyptian
-eie
-eight
-eighteen
-eighth
-eightpenni
-eighti
-eisel
-either
-eject
-ek
-el
-elb
-elbow
-elbow
-eld
-elder
-elder
-eldest
-eleanor
-elect
-elect
-elect
-eleg
-elegi
-element
-element
-eleph
-eleph
-elev
-eleven
-eleventh
-elf
-elflock
-eliad
-elinor
-elizabeth
-ell
-ell
-ellen
-elm
-eloqu
-eloqu
-els
-elsewher
-elsinor
-eltham
-elv
-elvish
-eli
-elysium
-em
-embal
-embalm
-embalm
-embark
-embark
-embarqu
-embassad
-embassag
-embassi
-embassi
-embattail
-embattl
-embattl
-embai
-embellish
-ember
-emblaz
-emblem
-emblem
-embodi
-embold
-embolden
-emboss
-emboss
-embound
-embowel
-embowel
-embrac
-embrac
-embrac
-embrac
-embrac
-embrac
-embrac
-embrasur
-embroid
-embroideri
-emhrac
-emilia
-emin
-emin
-emin
-emmanuel
-emniti
-empal
-emper
-emperess
-emperi
-emperor
-emperi
-emphasi
-empir
-empir
-empiricut
-empleach
-emploi
-emploi
-employ
-employ
-employ
-empoison
-empress
-empti
-emptier
-empti
-empti
-empti
-empti
-emul
-emul
-emul
-emul
-emul
-en
-enact
-enact
-enact
-enactur
-enamel
-enamel
-enamour
-enamour
-enanmour
-encamp
-encamp
-encav
-enceladu
-enchaf
-enchaf
-enchant
-enchant
-enchant
-enchantingli
-enchant
-enchantress
-enchant
-encha
-encircl
-encircl
-enclo
-enclos
-enclos
-enclos
-encloseth
-enclos
-encloud
-encompass
-encompass
-encompasseth
-encompass
-encor
-encorpor
-encount
-encount
-encount
-encount
-encourag
-encourag
-encourag
-encrimson
-encroach
-encumb
-end
-endamag
-endamag
-endang
-endart
-endear
-endear
-endeavour
-endeavour
-end
-ender
-end
-end
-endit
-endless
-endow
-endow
-endow
-endow
-end
-endu
-endu
-endur
-endur
-endur
-endur
-endur
-endur
-endymion
-enea
-enemi
-enemi
-enerni
-enew
-enfeebl
-enfeebl
-enfeoff
-enfett
-enfold
-enforc
-enforc
-enforc
-enforcedli
-enforc
-enforc
-enforcest
-enfranch
-enfranchi
-enfranchis
-enfranchis
-enfranchis
-enfre
-enfreedom
-engag
-engag
-engag
-engag
-engag
-engaol
-engend
-engend
-engend
-engild
-engin
-engin
-engin
-engin
-engirt
-england
-english
-englishman
-englishmen
-englut
-englut
-engraf
-engraft
-engraft
-engrav
-engrav
-engross
-engross
-engrossest
-engross
-engross
-enguard
-enigma
-enigmat
-enjoin
-enjoin
-enjoi
-enjoi
-enjoy
-enjoi
-enjoi
-enkindl
-enkindl
-enlard
-enlarg
-enlarg
-enlarg
-enlarg
-enlargeth
-enlighten
-enlink
-enmesh
-enmiti
-enmiti
-ennobl
-ennobl
-enobarb
-enobarbu
-enon
-enorm
-enorm
-enough
-enow
-enpatron
-enpierc
-enquir
-enquir
-enquir
-enrag
-enrag
-enrag
-enrag
-enrank
-enrapt
-enrich
-enrich
-enrich
-enridg
-enr
-enrob
-enrob
-enrol
-enrol
-enroot
-enround
-enschedul
-ensconc
-ensconc
-enseam
-ensear
-enseign
-enseignez
-ensembl
-enshelt
-enshield
-enshrin
-ensign
-ensign
-enski
-ensman
-ensnar
-ensnar
-ensnareth
-ensteep
-ensu
-ensu
-ensu
-ensu
-ensu
-enswath
-ent
-entail
-entam
-entangl
-entangl
-entendr
-enter
-enter
-enter
-enterpris
-enterpris
-enter
-entertain
-entertain
-entertain
-entertain
-entertain
-entertain
-enthral
-enthral
-enthron
-enthron
-entic
-entic
-entic
-entir
-entir
-entitl
-entitl
-entitl
-entomb
-entomb
-entrail
-entranc
-entranc
-entrap
-entrapp
-entr
-entreat
-entreat
-entreati
-entreat
-entreat
-entreat
-entreati
-entrench
-entri
-entwist
-envelop
-envenom
-envenom
-envenom
-envi
-envi
-enviou
-envious
-environ
-environ
-envoi
-envi
-envi
-enwheel
-enwomb
-enwrap
-ephesian
-ephesian
-ephesu
-epicur
-epicurean
-epicur
-epicur
-epicuru
-epidamnum
-epidauru
-epigram
-epilepsi
-epilept
-epilogu
-epilogu
-epistl
-epistrophu
-epitaph
-epitaph
-epithet
-epitheton
-epithet
-epitom
-equal
-equal
-equal
-equal
-equal
-equal
-equal
-equinocti
-equinox
-equipag
-equiti
-equivoc
-equivoc
-equivoc
-equivoc
-equivoc
-er
-erbear
-erbear
-erbear
-erbeat
-erblow
-erboard
-erborn
-ercam
-ercast
-ercharg
-ercharg
-ercharg
-ercl
-ercom
-ercov
-ercrow
-erdo
-er
-erebu
-erect
-erect
-erect
-erect
-erect
-erewhil
-erflourish
-erflow
-erflow
-erflow
-erfraught
-erga
-ergal
-erglanc
-ergo
-ergon
-ergrow
-ergrown
-ergrowth
-erhang
-erhang
-erhasti
-erhear
-erheard
-eringo
-erjoi
-erleap
-erleap
-erleaven
-erlook
-erlook
-ermast
-ermengar
-ermount
-ern
-ernight
-ero
-erpaid
-erpart
-erpast
-erpai
-erpeer
-erperch
-erpictur
-erpingham
-erpost
-erpow
-erpress
-erpress
-err
-errand
-errand
-errant
-errat
-erraught
-erreach
-er
-errest
-er
-erron
-error
-error
-err
-errul
-errun
-erset
-ershad
-ershad
-ershin
-ershot
-ersiz
-erskip
-erslip
-erspread
-erst
-erstar
-erstep
-erstunk
-erswai
-erswai
-erswel
-erta
-ertak
-erteem
-erthrow
-erthrown
-erthrow
-ertook
-ertop
-ertop
-ertrip
-erturn
-erudit
-erupt
-erupt
-ervalu
-erwalk
-erwatch
-erween
-erween
-erweigh
-erweigh
-erwhelm
-erwhelm
-erworn
-es
-escalu
-escap
-escap
-escap
-escap
-eschew
-escot
-esil
-especi
-especi
-esper
-espial
-espi
-espi
-espou
-espous
-espi
-esquir
-esquir
-essai
-essai
-essenc
-essenti
-essenti
-ess
-essex
-est
-establish
-establish
-estat
-estat
-esteem
-esteem
-esteemeth
-esteem
-esteem
-estim
-estim
-estim
-estim
-estim
-estrang
-estridg
-estridg
-et
-etc
-etcetera
-et
-etern
-etern
-etern
-etern
-eterniz
-et
-ethiop
-ethiop
-ethiop
-ethiopian
-etna
-eton
-etr
-eunuch
-eunuch
-euphrat
-euphroniu
-euriphil
-europa
-europ
-ev
-evad
-evad
-evan
-evas
-evas
-ev
-even
-even
-evenli
-event
-event
-event
-ever
-everlast
-everlastingli
-evermor
-everi
-everyon
-everyth
-everywher
-evid
-evid
-evid
-evil
-evilli
-evil
-evit
-ew
-ewer
-ewer
-ew
-exact
-exact
-exactest
-exact
-exact
-exact
-exactli
-exact
-exalt
-exalt
-examin
-examin
-examin
-examin
-examin
-examin
-exampl
-exampl
-exampl
-exampl
-exasper
-exasper
-exce
-exceed
-exceedeth
-exceed
-exceedingli
-exce
-excel
-excel
-excel
-excel
-excel
-excel
-excel
-excel
-excel
-except
-except
-except
-except
-except
-exceptless
-excess
-excess
-exchang
-exchang
-exchang
-exchequ
-exchequ
-excit
-excit
-excit
-excit
-exclaim
-exclaim
-exclam
-exclam
-exclud
-excommun
-excommun
-excrement
-excrement
-excurs
-excurs
-excu
-excus
-excus
-excus
-excus
-excusez
-excus
-execr
-execr
-execut
-execut
-execut
-execut
-execution
-execution
-executor
-executor
-exempt
-exempt
-exequi
-exercis
-exercis
-exet
-exeunt
-exhal
-exhal
-exhal
-exhal
-exhal
-exhaust
-exhibit
-exhibit
-exhibit
-exhort
-exhort
-exig
-exil
-exil
-exil
-exion
-exist
-exist
-exit
-exit
-exorcis
-exorc
-exorcist
-expect
-expect
-expect
-expect
-expect
-expect
-expect
-expect
-expect
-expedi
-expedi
-expedi
-expedit
-expediti
-expel
-expel
-expel
-expel
-expend
-expens
-expens
-experienc
-experi
-experi
-experi
-experiment
-experi
-expert
-expert
-expiat
-expiat
-expir
-expir
-expir
-expir
-expir
-expir
-explic
-exploit
-exploit
-expo
-expos
-expos
-exposit
-expositor
-expostul
-expostul
-expostur
-exposur
-expound
-expound
-express
-express
-expresseth
-express
-express
-expressli
-expressur
-expul
-expuls
-exquisit
-exsuffl
-extant
-extempor
-extempor
-extempor
-extend
-extend
-extend
-extent
-extenu
-extenu
-extenu
-extenu
-exterior
-exteriorli
-exterior
-extermin
-extern
-extern
-extinct
-extinct
-extinctur
-extinguish
-extirp
-extirp
-extirp
-extol
-extol
-extol
-exton
-extort
-extort
-extort
-extort
-extra
-extract
-extract
-extract
-extraordinarili
-extraordinari
-extraught
-extravag
-extravag
-extrem
-extrem
-extrem
-extremest
-extrem
-extrem
-exuent
-exult
-exult
-ey
-eya
-eyas
-ey
-eyebal
-eyebal
-eyebrow
-eyebrow
-ei
-eyeless
-eyelid
-eyelid
-ey
-eyesight
-eyestr
-ei
-eyn
-eyri
-fa
-fabian
-fabl
-fabl
-fabric
-fabul
-fac
-face
-face
-facer
-face
-faciant
-facil
-facil
-facineri
-face
-facit
-fact
-faction
-factionari
-faction
-factiou
-factor
-factor
-faculti
-faculti
-fade
-fade
-fadeth
-fadg
-fade
-fade
-fadom
-fadom
-fagot
-fagot
-fail
-fail
-fail
-fain
-faint
-faint
-fainter
-faint
-faintli
-faint
-faint
-fair
-fairer
-fairest
-fairi
-fair
-fair
-fairli
-fair
-fair
-fairwel
-fairi
-fai
-fait
-fait
-faith
-faith
-faithful
-faithfulli
-faithless
-faith
-faitor
-fal
-falchion
-falcon
-falconbridg
-falcon
-falcon
-fall
-fallaci
-fallen
-falleth
-falliabl
-fallibl
-fall
-fallow
-fallow
-fall
-falli
-falor
-fals
-falsehood
-fals
-fals
-falser
-falsifi
-fals
-falstaff
-falstaff
-falter
-fam
-fame
-fame
-familiar
-familiar
-familiarli
-familiar
-famili
-famin
-famish
-famish
-famou
-famous
-famous
-fan
-fanat
-fanci
-fanci
-fane
-fane
-fang
-fangl
-fangless
-fang
-fann
-fan
-fan
-fantasi
-fantasi
-fantast
-fantast
-fantast
-fantastico
-fantasi
-fap
-far
-farborough
-farc
-fardel
-fardel
-fare
-fare
-farewel
-farewel
-farin
-fare
-farm
-farmer
-farmhous
-farm
-farr
-farrow
-farther
-farthest
-farth
-farthingal
-farthingal
-farth
-fartuou
-fa
-fashion
-fashion
-fashion
-fashion
-fast
-fast
-fasten
-fasten
-faster
-fastest
-fast
-fastli
-fastolf
-fast
-fat
-fatal
-fatal
-fate
-fate
-fate
-father
-father
-fatherless
-fatherli
-father
-fathom
-fathomless
-fathom
-fatig
-fat
-fat
-fat
-fatter
-fattest
-fat
-fatuu
-fauconbridg
-faulconbridg
-fault
-faulti
-faultless
-fault
-faulti
-fauss
-faust
-faustus
-faut
-favor
-favor
-favor
-favor
-favour
-favour
-favour
-favouredli
-favour
-favour
-favour
-favourit
-favourit
-favour
-favout
-fawn
-fawneth
-fawn
-fawn
-fai
-fe
-fealti
-fear
-fear
-fearest
-fear
-fearful
-fearfulli
-fear
-fear
-fearless
-fear
-feast
-feast
-feast
-feast
-feat
-feat
-feater
-feather
-feather
-feather
-featli
-feat
-featur
-featur
-featur
-featureless
-featur
-februari
-feck
-fed
-fedari
-federari
-fee
-feebl
-feebl
-feebl
-feebl
-feebli
-feed
-feeder
-feeder
-feedeth
-feed
-feed
-feel
-feeler
-feel
-feelingli
-feel
-fee
-feet
-fehement
-feign
-feign
-feign
-feil
-feith
-felicit
-felic
-fell
-fellest
-felli
-fellow
-fellowli
-fellow
-fellowship
-fellowship
-fell
-felon
-feloni
-feloni
-felt
-femal
-femal
-feminin
-fen
-fenc
-fenc
-fencer
-fenc
-fend
-fennel
-fenni
-fen
-fenton
-fer
-ferdinand
-fere
-fernse
-ferrara
-ferrer
-ferret
-ferri
-ferryman
-fertil
-fertil
-fervenc
-fervour
-feri
-fest
-fest
-fester
-festin
-festin
-festiv
-festiv
-fet
-fetch
-fetch
-fetch
-fetlock
-fetlock
-fett
-fetter
-fetter
-fetter
-fettl
-feu
-feud
-fever
-fever
-fever
-few
-fewer
-fewest
-few
-fickl
-fickl
-fico
-fiction
-fiddl
-fiddler
-fiddlestick
-fidel
-fidelicet
-fidel
-fidiu
-fie
-field
-field
-field
-fiend
-fiend
-fierc
-fierc
-fierc
-fieri
-fife
-fife
-fifteen
-fifteen
-fifteenth
-fifth
-fifti
-fiftyfold
-fig
-fight
-fighter
-fightest
-fighteth
-fight
-fight
-figo
-fig
-figur
-figur
-figur
-figur
-figur
-fike
-fil
-filbert
-filch
-filch
-filch
-file
-file
-file
-filial
-filiu
-fill
-fill
-fillet
-fill
-fillip
-fill
-filli
-film
-fil
-filth
-filth
-filthi
-fin
-final
-finch
-find
-finder
-findeth
-find
-find
-find
-fine
-fineless
-fine
-finem
-fine
-finer
-fine
-finest
-fing
-finger
-finger
-finger
-fingr
-fingr
-finic
-finish
-finish
-finish
-finless
-finn
-fin
-finsburi
-fir
-firago
-fire
-firebrand
-firebrand
-fire
-fire
-firework
-firework
-fire
-firk
-firm
-firmament
-firmli
-firm
-first
-firstl
-fish
-fisher
-fishermen
-fisher
-fish
-fishifi
-fishmong
-fishpond
-fisnomi
-fist
-fist
-fist
-fistula
-fit
-fitchew
-fit
-fitli
-fitment
-fit
-fit
-fit
-fitter
-fittest
-fitteth
-fit
-fitzwat
-five
-fivep
-five
-fix
-fix
-fix
-fixeth
-fix
-fixtur
-fl
-flag
-flag
-flagon
-flagon
-flag
-flail
-flake
-flaki
-flam
-flame
-flamen
-flamen
-flame
-flame
-flaminiu
-flander
-flannel
-flap
-flare
-flash
-flash
-flash
-flask
-flat
-flatli
-flat
-flat
-flatt
-flatter
-flatter
-flatter
-flatter
-flatterest
-flatteri
-flatter
-flatter
-flatteri
-flaunt
-flavio
-flaviu
-flaw
-flaw
-flax
-flaxen
-flai
-flai
-flea
-fleanc
-flea
-fleck
-fled
-fledg
-flee
-fleec
-fleec
-fleec
-fleer
-fleer
-fleer
-fleet
-fleeter
-fleet
-fleme
-flemish
-flesh
-flesh
-fleshli
-fleshment
-fleshmong
-flew
-flexibl
-flexur
-flibbertigibbet
-flicker
-flidg
-flier
-fli
-flieth
-flight
-flight
-flighti
-flinch
-fling
-flint
-flint
-flinti
-flirt
-float
-float
-float
-flock
-flock
-flood
-floodgat
-flood
-floor
-flora
-florenc
-florentin
-florentin
-florentiu
-florizel
-flote
-floulish
-flour
-flourish
-flourish
-flourisheth
-flourish
-flout
-flout
-flout
-flout
-flow
-flow
-flower
-floweret
-flower
-flow
-flown
-flow
-fluellen
-fluent
-flung
-flush
-flush
-fluster
-flute
-flute
-flutter
-flux
-fluxiv
-fly
-fly
-fo
-foal
-foal
-foam
-foam
-foam
-foam
-foami
-fob
-foc
-fodder
-foe
-foeman
-foemen
-foe
-fog
-foggi
-fog
-foh
-foi
-foil
-foil
-foil
-foin
-foin
-foin
-foi
-foison
-foison
-foist
-foix
-fold
-fold
-fold
-folio
-folk
-folk
-folli
-follow
-follow
-follow
-follow
-followest
-follow
-follow
-folli
-fond
-fonder
-fondli
-fond
-font
-fontibel
-food
-fool
-fooleri
-fooleri
-foolhardi
-fool
-foolish
-foolishli
-foolish
-fool
-foot
-footbal
-footboi
-footboi
-foot
-footfal
-foot
-footman
-footmen
-footpath
-footstep
-footstool
-fopp
-fop
-fopperi
-foppish
-fop
-for
-forag
-forag
-forbad
-forbear
-forbear
-forbear
-forbid
-forbidden
-forbiddenli
-forbid
-forbod
-forborn
-forc
-forc
-forc
-forc
-forceless
-forc
-forcibl
-forcibl
-forc
-ford
-fordid
-fordo
-fordo
-fordon
-fore
-forecast
-forefath
-forefath
-forefing
-forego
-foregon
-forehand
-forehead
-forehead
-forehors
-foreign
-foreign
-foreign
-foreknow
-foreknowledg
-foremost
-forenam
-forenoon
-forerun
-forerunn
-forerun
-forerun
-foresaid
-foresaw
-foresai
-forese
-forese
-forese
-foreshow
-foreskirt
-foresp
-forest
-forestal
-forestal
-forest
-forest
-forest
-foretel
-foretel
-foretel
-forethink
-forethought
-foretold
-forev
-foreward
-forewarn
-forewarn
-forewarn
-forfeit
-forfeit
-forfeit
-forfeit
-forfeit
-forfeitur
-forfeitur
-forfend
-forfend
-forg
-forgav
-forg
-forg
-forgeri
-forgeri
-forg
-forget
-forget
-forget
-forget
-forget
-forget
-forgiv
-forgiven
-forgiv
-forgo
-forgo
-forgon
-forgot
-forgotten
-fork
-fork
-fork
-forlorn
-form
-formal
-formal
-form
-former
-formerli
-formless
-form
-fornic
-fornic
-fornicatress
-forr
-forrest
-forsak
-forsaken
-forsaketh
-forslow
-forsook
-forsooth
-forspent
-forspok
-forswear
-forswear
-forswor
-forsworn
-fort
-fort
-forth
-forthcom
-forthlight
-forthright
-forthwith
-fortif
-fortif
-fortifi
-fortifi
-fortifi
-fortinbra
-fortitud
-fortnight
-fortress
-fortress
-fort
-fortun
-fortuna
-fortun
-fortun
-fortun
-fortun
-fortun
-fortward
-forti
-forum
-forward
-forward
-forward
-forward
-forweari
-fosset
-fost
-foster
-foster
-fought
-foughten
-foul
-fouler
-foulest
-foulli
-foul
-found
-foundat
-foundat
-found
-founder
-fount
-fountain
-fountain
-fount
-four
-fourscor
-fourteen
-fourth
-foutra
-fowl
-fowler
-fowl
-fowl
-fox
-fox
-foxship
-fract
-fraction
-fraction
-fragil
-fragment
-fragment
-fragrant
-frail
-frailer
-frailti
-frailti
-fram
-frame
-frame
-frame
-frampold
-fran
-francai
-franc
-franc
-franchis
-franchis
-franchis
-franchis
-francia
-franci
-francisca
-franciscan
-francisco
-frank
-franker
-frankfort
-franklin
-franklin
-frankli
-frank
-frantic
-franticli
-frateretto
-fratrum
-fraud
-fraud
-fraught
-fraughtag
-fraught
-frai
-frai
-freckl
-freckl
-freckl
-frederick
-free
-freed
-freedom
-freedom
-freeheart
-freelier
-freeli
-freeman
-freemen
-freeness
-freer
-free
-freeston
-freetown
-freez
-freez
-freez
-freez
-french
-frenchman
-frenchmen
-frenchwoman
-frenzi
-frequent
-frequent
-fresh
-fresher
-fresh
-freshest
-freshli
-fresh
-fret
-fret
-fret
-fret
-fretten
-fret
-friar
-friar
-fridai
-fridai
-friend
-friend
-friend
-friendless
-friendli
-friendli
-friend
-friendship
-friendship
-friez
-fright
-fright
-frighten
-fright
-fright
-fright
-fring
-fring
-fripperi
-frisk
-fritter
-frivol
-fro
-frock
-frog
-frogmor
-froissart
-frolic
-from
-front
-front
-frontier
-frontier
-front
-frontlet
-front
-frost
-frost
-frosti
-froth
-froward
-frown
-frown
-frowningli
-frown
-froze
-frozen
-fructifi
-frugal
-fruit
-fruiter
-fruit
-fruitfulli
-fruit
-fruition
-fruitless
-fruit
-frush
-frustrat
-frutifi
-fry
-fubb
-fuel
-fugit
-fulfil
-fulfil
-fulfil
-fulfil
-full
-fullam
-fuller
-fuller
-fullest
-full
-fulli
-ful
-fulsom
-fulvia
-fum
-fumbl
-fumbl
-fumblest
-fumbl
-fume
-fume
-fume
-fumit
-fumitori
-fun
-function
-function
-fundament
-funer
-funer
-fur
-furbish
-furi
-furiou
-furlong
-furnac
-furnac
-furnish
-furnish
-furnish
-furnitur
-furniv
-furor
-furr
-furrow
-furrow
-furrow
-furth
-further
-further
-further
-furthermor
-furthest
-furi
-furz
-furz
-fust
-fustian
-fustilarian
-fusti
-fut
-futur
-futur
-g
-gabbl
-gaberdin
-gabriel
-gad
-gad
-gad
-gadshil
-gag
-gage
-gage
-gagg
-gage
-gagn
-gain
-gain
-gainer
-gaingiv
-gain
-gainsaid
-gainsai
-gainsai
-gainsai
-gainst
-gait
-gait
-galath
-gale
-galen
-gale
-gall
-gallant
-gallantli
-gallantri
-gallant
-gall
-galleri
-gallei
-gallei
-gallia
-gallian
-galliard
-galliass
-gallimaufri
-gall
-gallon
-gallop
-gallop
-gallop
-gallow
-gallowai
-gallowglass
-gallow
-gallows
-gall
-gallu
-gam
-gambol
-gambold
-gambol
-gamboi
-game
-gamer
-game
-gamesom
-gamest
-game
-gammon
-gamut
-gan
-gangren
-ganymed
-gaol
-gaoler
-gaoler
-gaol
-gap
-gape
-gape
-gape
-gar
-garb
-garbag
-garboil
-garcon
-gard
-gard
-garden
-garden
-garden
-garden
-gardez
-gardin
-gardon
-gargantua
-gargrav
-garish
-garland
-garland
-garlic
-garment
-garment
-garmet
-garner
-garner
-garnish
-garnish
-garret
-garrison
-garrison
-gart
-garter
-garterd
-garter
-garter
-gasconi
-gash
-gash
-gaskin
-gasp
-gasp
-gast
-gast
-gat
-gate
-gate
-gate
-gath
-gather
-gather
-gather
-gather
-gatori
-gatori
-gaud
-gaudeo
-gaudi
-gaug
-gaul
-gaultre
-gaunt
-gauntlet
-gauntlet
-gav
-gave
-gavest
-gawd
-gawd
-gawsei
-gai
-gay
-gaz
-gaze
-gaze
-gazer
-gazer
-gaze
-gazeth
-gaze
-gear
-geck
-gees
-geffrei
-geld
-geld
-geld
-gelida
-gelidu
-gelt
-gem
-gemini
-gem
-gen
-gender
-gender
-gener
-gener
-gener
-gener
-gener
-gener
-generos
-gener
-genit
-genitivo
-geniu
-gennet
-genoa
-genoux
-gen
-gent
-gentilhomm
-gentil
-gentl
-gentlefolk
-gentleman
-gentlemanlik
-gentlemen
-gentl
-gentler
-gentl
-gentlest
-gentlewoman
-gentlewomen
-gentli
-gentri
-georg
-gerard
-germain
-germain
-german
-german
-german
-germani
-gertrud
-gest
-gest
-gestur
-gestur
-get
-getrud
-get
-getter
-get
-ghastli
-ghost
-ghost
-ghostli
-ghost
-gi
-giant
-giantess
-giantlik
-giant
-gib
-gibber
-gibbet
-gibbet
-gibe
-giber
-gibe
-gibe
-gibingli
-giddili
-giddi
-giddi
-gift
-gift
-gig
-giglet
-giglot
-gilbert
-gild
-gild
-gild
-gilliam
-gillian
-gill
-gillyvor
-gilt
-gimmal
-gimmer
-gin
-ging
-ginger
-gingerbread
-gingerli
-ginn
-gin
-gioucestershir
-gipe
-gipsi
-gipsi
-gird
-gird
-girdl
-girdl
-girdl
-girdl
-girl
-girl
-girt
-girth
-gi
-giv
-give
-given
-giver
-giver
-give
-givest
-giveth
-give
-give
-glad
-glad
-glad
-gladli
-glad
-glami
-glanc
-glanc
-glanc
-glanc
-glanc
-glander
-glansdal
-glare
-glare
-glass
-glass
-glassi
-glaz
-glaze
-gleam
-glean
-glean
-glean
-gleeful
-gleek
-gleek
-gleek
-glend
-glendow
-glib
-glide
-glide
-glide
-glideth
-glide
-glimmer
-glimmer
-glimmer
-glimps
-glimps
-glist
-glisten
-glister
-glister
-glister
-glitt
-glitter
-globe
-globe
-gloom
-gloomi
-glori
-glorifi
-glorifi
-gloriou
-glorious
-glori
-glose
-gloss
-gloss
-glou
-gloucest
-gloucest
-gloucestershir
-glove
-glover
-glove
-glow
-glow
-glow
-glowworm
-gloz
-gloze
-gloze
-glu
-glue
-glu
-glue
-glut
-glutt
-glut
-glutton
-glutton
-gluttoni
-gnarl
-gnarl
-gnat
-gnat
-gnaw
-gnaw
-gnawn
-gnaw
-go
-goad
-goad
-goad
-goal
-goat
-goatish
-goat
-gobbet
-gobbo
-goblet
-goblet
-goblin
-goblin
-god
-god
-godden
-goddess
-goddess
-goddild
-godfath
-godfath
-godhead
-godlik
-godli
-godli
-godmoth
-god
-godson
-goer
-goer
-goe
-goest
-goeth
-goff
-gog
-go
-gold
-golden
-goldenli
-goldsmith
-goldsmith
-golgotha
-golias
-goliath
-gon
-gondola
-gondoli
-gone
-goneril
-gong
-gonzago
-gonzalo
-good
-goodfellow
-goodlier
-goodliest
-goodli
-goodman
-good
-goodnight
-goodrig
-good
-goodwif
-goodwil
-goodwin
-goodwin
-goodyear
-goodyear
-goos
-gooseberri
-goosequil
-goot
-gor
-gorbelli
-gorboduc
-gordian
-gore
-gore
-gorg
-gorg
-gorgeou
-gorget
-gorg
-gorgon
-gormand
-gormand
-gori
-gosl
-gospel
-gospel
-goss
-gossam
-gossip
-gossip
-gossiplik
-gossip
-got
-goth
-goth
-gotten
-gourd
-gout
-gout
-gouti
-govern
-govern
-govern
-gover
-govern
-governor
-governor
-govern
-gower
-gown
-gown
-grac
-grace
-grace
-grace
-gracefulli
-graceless
-grace
-grace
-graciou
-gracious
-gradat
-graff
-graf
-graft
-graft
-grafter
-grain
-grain
-grain
-gramerci
-gramerci
-grammar
-grand
-grandam
-grandam
-grandchild
-grand
-grandeur
-grandfath
-grandjuror
-grandmoth
-grandpr
-grandsir
-grandsir
-grandsir
-grang
-grant
-grant
-grant
-grant
-grape
-grape
-grappl
-grappl
-grappl
-grasp
-grasp
-grasp
-grass
-grasshopp
-grassi
-grate
-grate
-grate
-grate
-gratiano
-gratifi
-gratii
-gratil
-grate
-grati
-gratitud
-gratul
-grav
-grave
-gravedigg
-gravel
-graveless
-gravel
-grave
-graven
-grave
-graver
-grave
-gravest
-graveston
-graviti
-graviti
-gravi
-grai
-graymalkin
-graz
-graze
-graze
-graze
-greas
-greas
-greasili
-greasi
-great
-greater
-greatest
-greatli
-great
-grecian
-grecian
-gree
-greec
-greed
-greedili
-greedi
-greedi
-gree
-greek
-greekish
-greek
-green
-greener
-greenli
-green
-greensleev
-greenwich
-greenwood
-greet
-greet
-greet
-greet
-greet
-greg
-gregori
-gremio
-grew
-grei
-greybeard
-greybeard
-greyhound
-greyhound
-grief
-grief
-griev
-grievanc
-grievanc
-griev
-griev
-griev
-grievest
-griev
-grievingli
-grievou
-grievous
-griffin
-griffith
-grim
-grime
-grimli
-grin
-grind
-grind
-grindston
-grin
-grip
-gripe
-gripe
-gripe
-grise
-grisli
-grissel
-grize
-grizzl
-grizzl
-groan
-groan
-groan
-groat
-groat
-groin
-groom
-groom
-grop
-grope
-gro
-gross
-grosser
-grossli
-gross
-ground
-ground
-groundl
-ground
-grove
-grovel
-grovel
-grove
-grow
-groweth
-grow
-grown
-grow
-growth
-grub
-grubb
-grub
-grudg
-grudg
-grudg
-grudg
-gruel
-grumbl
-grumblest
-grumbl
-grumbl
-grumio
-grund
-grunt
-gualtier
-guard
-guardag
-guardant
-guard
-guardian
-guardian
-guard
-guardsman
-gud
-gudgeon
-guerdon
-guerra
-guess
-guess
-guessingli
-guest
-guest
-guiana
-guichard
-guid
-guid
-guider
-guideriu
-guid
-guid
-guidon
-guienn
-guil
-guildenstern
-guilder
-guildford
-guildhal
-guil
-guil
-guil
-guilford
-guilt
-guiltian
-guiltier
-guiltili
-guilti
-guiltless
-guilt
-guilti
-guinea
-guinev
-guis
-gul
-gule
-gulf
-gulf
-gull
-gull
-gum
-gumm
-gum
-gun
-gunner
-gunpowd
-gun
-gurnet
-gurnei
-gust
-gust
-gusti
-gut
-gutter
-gui
-guyn
-guysor
-gypsi
-gyve
-gyve
-gyve
-h
-ha
-haberdash
-habili
-habili
-habit
-habit
-habit
-habit
-habitud
-hack
-hacket
-hacknei
-hack
-had
-hadst
-haec
-haer
-hag
-hagar
-haggard
-haggard
-haggish
-haggl
-hag
-hail
-hail
-hailston
-hailston
-hair
-hairless
-hair
-hairi
-hal
-halberd
-halberd
-halcyon
-hale
-hale
-hale
-half
-halfcan
-halfpenc
-halfpenni
-halfpennyworth
-halfwai
-halidom
-hall
-halloa
-hallo
-hallond
-halloo
-halloo
-hallow
-hallow
-hallowma
-hallown
-hal
-halt
-halter
-halter
-halt
-halt
-halv
-ham
-hame
-hamlet
-hammer
-hammer
-hammer
-hammer
-hamper
-hampton
-ham
-hamstr
-hand
-hand
-hand
-handicraft
-handicraftsmen
-hand
-handiwork
-handkerch
-handkerch
-handkerchief
-handl
-handl
-handl
-handless
-handlest
-handl
-handmaid
-handmaid
-hand
-handsaw
-handsom
-handsom
-handsom
-handwrit
-handi
-hang
-hang
-hanger
-hangeth
-hang
-hang
-hangman
-hangmen
-hang
-hannib
-hap
-hapless
-hapli
-happ
-happen
-happen
-happier
-happi
-happiest
-happili
-happi
-happi
-hap
-harbing
-harbing
-harbor
-harbour
-harbourag
-harbour
-harbour
-harcourt
-hard
-harder
-hardest
-hardiest
-hardiment
-hardi
-hardli
-hard
-hardock
-hardi
-hare
-harelip
-hare
-harfleur
-hark
-harlot
-harlotri
-harlot
-harm
-harm
-harm
-harm
-harmless
-harmoni
-harmoni
-harm
-har
-harp
-harper
-harpier
-harp
-harpi
-harri
-harrow
-harrow
-harri
-harsh
-harshli
-harsh
-hart
-hart
-harum
-harvest
-ha
-hast
-hast
-hast
-hasten
-hast
-hastili
-hast
-hast
-hasti
-hat
-hatch
-hatch
-hatchet
-hatch
-hatchment
-hate
-hate
-hate
-hater
-hater
-hate
-hateth
-hatfield
-hath
-hate
-hatr
-hat
-haud
-hauf
-haught
-haughti
-haughti
-haunch
-haunch
-haunt
-haunt
-haunt
-haunt
-hautboi
-hautboi
-have
-haven
-haven
-haver
-have
-have
-havior
-haviour
-havoc
-hawk
-hawk
-hawk
-hawthorn
-hawthorn
-hai
-hazard
-hazard
-hazard
-hazel
-hazelnut
-he
-head
-headborough
-head
-headier
-head
-headland
-headless
-headlong
-head
-headsman
-headstrong
-headi
-heal
-heal
-heal
-heal
-health
-health
-health
-healthsom
-healthi
-heap
-heap
-heap
-hear
-heard
-hearer
-hearer
-hearest
-heareth
-hear
-hear
-heark
-hearken
-hearken
-hear
-hearsai
-hears
-hears
-hearst
-heart
-heartach
-heartbreak
-heartbreak
-heart
-hearten
-hearth
-hearth
-heartili
-hearti
-heartless
-heartl
-heartli
-heart
-heartsick
-heartstr
-hearti
-heat
-heat
-heath
-heathen
-heathenish
-heat
-heat
-heauti
-heav
-heav
-heav
-heaven
-heavenli
-heaven
-heav
-heavier
-heaviest
-heavili
-heavi
-heav
-heav
-heavi
-hebona
-hebrew
-hecat
-hectic
-hector
-hector
-hecuba
-hedg
-hedg
-hedgehog
-hedgehog
-hedg
-heed
-heed
-heed
-heedful
-heedfulli
-heedless
-heel
-heel
-heft
-heft
-heifer
-heifer
-heigh
-height
-heighten
-heinou
-heinous
-heir
-heiress
-heirless
-heir
-held
-helen
-helena
-helenu
-helia
-helicon
-hell
-hellespont
-hellfir
-hellish
-helm
-helm
-helmet
-helmet
-helm
-help
-helper
-helper
-help
-help
-helpless
-help
-helter
-hem
-heme
-hemlock
-hemm
-hemp
-hempen
-hem
-hen
-henc
-henceforth
-henceforward
-henchman
-henri
-henricu
-henri
-hen
-hent
-henton
-her
-herald
-heraldri
-herald
-herb
-herbert
-herblet
-herb
-herculean
-hercul
-herd
-herd
-herdsman
-herdsmen
-here
-hereabout
-hereabout
-hereaft
-herebi
-hereditari
-hereford
-herefordshir
-herein
-hereof
-heresi
-heresi
-heret
-heret
-hereto
-hereupon
-heritag
-heriti
-herm
-hermia
-hermion
-hermit
-hermitag
-hermit
-hern
-hero
-herod
-herod
-hero
-heroic
-heroic
-her
-her
-her
-herself
-hesperid
-hesperu
-hest
-hest
-heur
-heureux
-hew
-hewgh
-hew
-hewn
-hew
-hei
-heydai
-hibocr
-hic
-hiccup
-hick
-hid
-hidden
-hide
-hideou
-hideous
-hideous
-hide
-hidest
-hide
-hie
-hi
-hiem
-hi
-hig
-high
-higher
-highest
-highli
-highmost
-high
-hight
-highwai
-highwai
-hild
-hild
-hill
-hillo
-hilloa
-hill
-hilt
-hilt
-hili
-him
-himself
-hinc
-hincklei
-hind
-hinder
-hinder
-hinder
-hindmost
-hind
-hing
-hing
-hing
-hint
-hip
-hipp
-hipparchu
-hippolyta
-hip
-hir
-hire
-hire
-hiren
-hirtiu
-hi
-hisperia
-hiss
-hiss
-hiss
-hist
-histor
-histori
-hit
-hither
-hitherto
-hitherward
-hitherward
-hit
-hit
-hive
-hive
-hizz
-ho
-hoa
-hoar
-hoard
-hoard
-hoard
-hoar
-hoars
-hoari
-hob
-hobbidid
-hobbi
-hobbyhors
-hobgoblin
-hobnail
-hoc
-hod
-hodg
-hog
-hog
-hogshead
-hogshead
-hoi
-hois
-hoist
-hoist
-hoist
-holborn
-hold
-holden
-holder
-holdeth
-holdfast
-hold
-hold
-hole
-hole
-holidam
-holidam
-holidai
-holidai
-holier
-holiest
-holili
-holi
-holla
-holland
-holland
-holland
-holloa
-holloa
-hollow
-hollowli
-hollow
-holli
-holmedon
-holofern
-holp
-holi
-homag
-homag
-home
-home
-home
-homespun
-homeward
-homeward
-homicid
-homicid
-homili
-hominem
-homm
-homo
-honest
-honest
-honestest
-honestli
-honesti
-honei
-honeycomb
-honei
-honeyless
-honeysuckl
-honeysuckl
-honi
-honneur
-honor
-honor
-honor
-honorato
-honorificabilitudinitatibu
-honor
-honour
-honour
-honour
-honour
-honourest
-honour
-honour
-honour
-hoo
-hood
-hood
-hoodman
-hood
-hoodwink
-hoof
-hoof
-hook
-hook
-hook
-hoop
-hoop
-hoot
-hoot
-hoot
-hoot
-hop
-hope
-hope
-hopeless
-hope
-hopest
-hope
-hopkin
-hopped
-hor
-horac
-horatio
-horizon
-horn
-hornbook
-horn
-horner
-horn
-hornpip
-horn
-horolog
-horribl
-horribl
-horrid
-horrid
-horridli
-horror
-horror
-hor
-hors
-horseback
-hors
-horsehair
-horseman
-horsemanship
-horsemen
-hors
-horsewai
-hors
-hortensio
-hortensiu
-horum
-hose
-hospit
-hospit
-hospit
-host
-hostag
-hostag
-hostess
-hostil
-hostil
-hostiliu
-host
-hot
-hotli
-hotspur
-hotter
-hottest
-hound
-hound
-hour
-hourli
-hour
-hou
-hous
-household
-household
-household
-household
-housekeep
-housekeep
-housekeep
-houseless
-hous
-housewif
-housewiferi
-housew
-hovel
-hover
-hover
-hover
-hover
-how
-howbeit
-how
-howeer
-howev
-howl
-howl
-howlet
-howl
-howl
-howso
-howsoev
-howsom
-hox
-hoi
-hoydai
-hubert
-huddl
-huddl
-hue
-hu
-hue
-hug
-huge
-huge
-huge
-hugg
-hugger
-hugh
-hug
-huju
-hulk
-hulk
-hull
-hull
-hullo
-hum
-human
-human
-human
-human
-humbl
-humbl
-humbl
-humbler
-humbl
-humblest
-humbl
-humbl
-hume
-humh
-humid
-humil
-hum
-humor
-humor
-humor
-humour
-humourist
-humour
-humphrei
-humphri
-hum
-hundr
-hundr
-hundredth
-hung
-hungarian
-hungari
-hunger
-hungerford
-hungerli
-hungri
-hunt
-hunt
-hunter
-hunter
-hunteth
-hunt
-huntington
-huntress
-hunt
-huntsman
-huntsmen
-hurdl
-hurl
-hurl
-hurl
-hurli
-hurlyburli
-hurricano
-hurricano
-hurri
-hurri
-hurri
-hurt
-hurt
-hurtl
-hurtless
-hurtl
-hurt
-husband
-husband
-husbandless
-husbandri
-husband
-hush
-hush
-husht
-husk
-huswif
-huswif
-hutch
-hybla
-hydra
-hyen
-hymen
-hymenaeu
-hymn
-hymn
-hyperbol
-hyperbol
-hyperion
-hypocrisi
-hypocrit
-hypocrit
-hyrcan
-hyrcania
-hyrcanian
-hyssop
-hysterica
-i
-iachimo
-iaculi
-iago
-iament
-ibat
-icaru
-ic
-iceland
-ici
-icicl
-icicl
-ici
-idea
-idea
-idem
-iden
-id
-idiot
-idiot
-idl
-idl
-idl
-idli
-idol
-idolatr
-idolatri
-ield
-if
-if
-igni
-ignobl
-ignobl
-ignomini
-ignomini
-ignomi
-ignor
-ignor
-ii
-iii
-iiii
-il
-ilbow
-ild
-ilion
-ilium
-ill
-illegitim
-illiter
-ill
-illo
-ill
-illum
-illumin
-illumin
-illumineth
-illus
-illus
-illustr
-illustr
-illustri
-illyria
-illyrian
-il
-im
-imag
-imageri
-imag
-imagin
-imaginari
-imagin
-imagin
-imagin
-imagin
-imagin
-imbar
-imbecil
-imbru
-imitari
-imit
-imit
-imit
-imit
-immacul
-imman
-immask
-immateri
-immediaci
-immedi
-immedi
-immin
-immin
-immoder
-immoder
-immodest
-immoment
-immort
-immortaliz
-immort
-immur
-immur
-immur
-imogen
-imp
-impaint
-impair
-impair
-impal
-impal
-impanel
-impart
-impart
-imparti
-impart
-impart
-impast
-impati
-impati
-impati
-impawn
-impeach
-impeach
-impeach
-impeach
-imped
-impedi
-impedi
-impenetr
-imper
-imperceiver
-imperfect
-imperfect
-imperfect
-imperfectli
-imperi
-imperi
-imperi
-impertin
-impertin
-impetico
-impetuos
-impetu
-impieti
-impieti
-impiou
-implac
-implement
-impli
-implor
-implor
-implor
-implor
-implor
-impon
-import
-import
-import
-import
-importantli
-import
-importeth
-import
-importless
-import
-importun
-importunaci
-importun
-importun
-importun
-importun
-impo
-impos
-impos
-imposit
-imposit
-imposs
-imposs
-imposs
-imposthum
-impostor
-impostor
-impot
-impot
-impound
-impregn
-impres
-impress
-impress
-impressest
-impress
-impressur
-imprimendum
-imprimi
-imprint
-imprint
-imprison
-imprison
-imprison
-imprison
-improb
-improp
-improv
-improvid
-impud
-impud
-impud
-impud
-impudiqu
-impugn
-impugn
-impur
-imput
-imput
-in
-inaccess
-inaid
-inaud
-inauspici
-incag
-incant
-incap
-incardin
-incarnadin
-incarn
-incarn
-incen
-incens
-incens
-incens
-incens
-incens
-incertain
-incertainti
-incertainti
-incess
-incessantli
-incest
-incestu
-inch
-incharit
-inch
-incid
-incid
-incis
-incit
-incit
-incivil
-incivil
-inclin
-inclin
-inclin
-inclin
-inclin
-inclin
-inclin
-inclip
-includ
-includ
-includ
-inclus
-incompar
-incomprehens
-inconsider
-inconst
-inconst
-incontin
-incontin
-incontin
-inconveni
-inconveni
-inconveni
-inconi
-incorpor
-incorp
-incorrect
-increa
-increas
-increas
-increaseth
-increas
-incred
-incredul
-incur
-incur
-incurr
-incur
-incurs
-ind
-ind
-indebt
-inde
-indent
-indent
-indentur
-indentur
-index
-index
-india
-indian
-indict
-indict
-indict
-indi
-indiffer
-indiffer
-indiffer
-indig
-indigest
-indigest
-indign
-indign
-indign
-indign
-indign
-indign
-indirect
-indirect
-indirect
-indirectli
-indiscreet
-indiscret
-indispo
-indisposit
-indissolubl
-indistinct
-indistinguish
-indistinguish
-indit
-individ
-indrench
-indu
-indubit
-induc
-induc
-induc
-induc
-induct
-induct
-indu
-indu
-indu
-indulg
-indulg
-indulg
-indur
-industri
-industri
-industri
-inequ
-inestim
-inevit
-inexecr
-inexor
-inexplic
-infal
-infal
-infamon
-infam
-infami
-infanc
-infant
-infant
-infect
-infect
-infect
-infect
-infect
-infecti
-infecti
-infect
-infer
-infer
-inferior
-inferior
-infern
-inferr
-inferreth
-infer
-infest
-infidel
-infidel
-infinit
-infinit
-infinit
-infirm
-infirm
-infirm
-infix
-infix
-inflam
-inflam
-inflam
-inflamm
-inflict
-inflict
-influenc
-influenc
-infold
-inform
-inform
-inform
-inform
-inform
-inform
-inform
-infortun
-infr
-infring
-infring
-infu
-infus
-infus
-infus
-infus
-ingen
-ingeni
-ingeni
-inglori
-ingot
-ingraf
-ingraft
-ingrat
-ingrat
-ingrat
-ingratitud
-ingratitud
-ingredi
-ingredi
-ingross
-inhabit
-inhabit
-inhabit
-inhabit
-inhabit
-inhears
-inhears
-inher
-inherit
-inherit
-inherit
-inherit
-inheritor
-inheritor
-inheritrix
-inherit
-inhibit
-inhibit
-inhoop
-inhuman
-iniqu
-iniqu
-initi
-injoint
-injunct
-injunct
-injur
-injur
-injur
-injuri
-injuri
-injuri
-injustic
-ink
-inkhorn
-inkl
-inkl
-inkl
-inki
-inlaid
-inland
-inlai
-inli
-inmost
-inn
-inner
-innkeep
-innoc
-innoc
-innoc
-innoc
-innov
-innov
-inn
-innumer
-inocul
-inordin
-inprimi
-inquir
-inquir
-inquiri
-inquisit
-inquisit
-inroad
-insan
-insani
-insati
-insconc
-inscrib
-inscript
-inscript
-inscrol
-inscrut
-insculp
-insculptur
-insens
-insepar
-insepar
-insert
-insert
-inset
-inshel
-inshipp
-insid
-insinew
-insinu
-insinuateth
-insinu
-insinu
-insist
-insist
-insistur
-insoci
-insol
-insol
-insomuch
-inspir
-inspir
-inspir
-inspir
-inspir
-instal
-instal
-instal
-instanc
-instanc
-instant
-instantli
-instat
-instead
-insteep
-instig
-instig
-instig
-instig
-instig
-instinct
-instinct
-institut
-institut
-instruct
-instruct
-instruct
-instruct
-instruct
-instrument
-instrument
-instrument
-insubstanti
-insuffici
-insuffici
-insult
-insult
-insult
-insult
-insult
-insupport
-insuppress
-insurrect
-insurrect
-int
-integ
-integrita
-integr
-intellect
-intellect
-intellectu
-intellig
-intelligenc
-intelligenc
-intellig
-intelligi
-intelligo
-intemper
-intemper
-intend
-intend
-intendeth
-intend
-intend
-intend
-inten
-intent
-intent
-intent
-intent
-inter
-intercept
-intercept
-intercept
-intercept
-intercept
-intercess
-intercessor
-interchain
-interchang
-interchang
-interchang
-interchang
-interchang
-interdict
-interest
-interim
-interim
-interior
-interject
-interjoin
-interlud
-intermingl
-intermiss
-intermiss
-intermit
-intermix
-intermix
-interpos
-interpos
-interpos
-interpret
-interpret
-interpret
-interpret
-interpret
-interpret
-interr
-inter
-interrogatori
-interrupt
-interrupt
-interrupt
-interruptest
-interrupt
-interrupt
-intertissu
-intervallum
-interview
-intest
-intestin
-intil
-intim
-intim
-intitl
-intitul
-into
-intoler
-intox
-intreasur
-intreat
-intrench
-intrench
-intric
-intrins
-intrins
-intrud
-intrud
-intrud
-intrus
-inund
-inur
-inurn
-invad
-invad
-invas
-invas
-invect
-invect
-inveigl
-invent
-invent
-invent
-invent
-inventor
-inventori
-inventori
-inventor
-inventori
-inver
-invert
-invest
-invest
-invest
-invest
-inveter
-invinc
-inviol
-invis
-invis
-invit
-invit
-invit
-invit
-invit
-inviti
-invoc
-invoc
-invok
-invok
-invulner
-inward
-inwardli
-inward
-inward
-ionia
-ionian
-ips
-ipswich
-ira
-ira
-ira
-ir
-ir
-ireland
-iri
-irish
-irishman
-irishmen
-irk
-irksom
-iron
-iron
-irreconcil
-irrecover
-irregular
-irregul
-irreligi
-irremov
-irrepar
-irresolut
-irrevoc
-is
-isabel
-isabella
-isbel
-isbel
-iscariot
-is
-ish
-isidor
-isi
-island
-island
-island
-island
-isl
-isl
-israel
-issu
-issu
-issu
-issueless
-issu
-issu
-ist
-ista
-it
-italian
-itali
-itch
-itch
-itch
-item
-item
-iter
-ithaca
-it
-itself
-itshal
-iv
-ivori
-ivi
-iwi
-ix
-j
-jacet
-jack
-jackanap
-jack
-jacksauc
-jackslav
-jacob
-jade
-jade
-jade
-jail
-jake
-jamani
-jame
-jami
-jane
-jangl
-jangl
-januari
-janu
-japhet
-jaquenetta
-jaqu
-jar
-jar
-jar
-jarteer
-jason
-jaunc
-jaunc
-jaundic
-jaundi
-jaw
-jawbon
-jaw
-jai
-jai
-jc
-je
-jealou
-jealousi
-jealousi
-jeer
-jeer
-jelli
-jenni
-jeopardi
-jephtha
-jephthah
-jerkin
-jerkin
-jerk
-jeronimi
-jerusalem
-jeshu
-jess
-jessica
-jest
-jest
-jester
-jester
-jest
-jest
-jesu
-jesu
-jet
-jet
-jew
-jewel
-jewel
-jewel
-jewess
-jewish
-jewri
-jew
-jezebel
-jig
-jig
-jill
-jill
-jingl
-joan
-job
-jockei
-jocund
-jog
-jog
-john
-john
-join
-joinder
-join
-joiner
-joineth
-join
-joint
-joint
-joint
-jointli
-jointress
-joint
-jointur
-jolliti
-jolli
-jolt
-jolthead
-jordan
-joseph
-joshua
-jot
-jour
-jourdain
-journal
-journei
-journei
-journeyman
-journeymen
-journei
-jove
-jovem
-jovial
-jowl
-jowl
-joi
-joi
-joy
-joyfulli
-joyless
-joyou
-joi
-juan
-jud
-juda
-judas
-jude
-judg
-judg
-judg
-judgement
-judg
-judgest
-judg
-judgment
-judgment
-judici
-jug
-juggl
-juggl
-juggler
-juggler
-juggl
-jug
-juic
-juic
-jul
-jule
-julia
-juliet
-julietta
-julio
-juliu
-juli
-jump
-jumpeth
-jump
-jump
-june
-june
-junior
-juniu
-junket
-juno
-jupit
-jure
-jurement
-jurisdict
-juror
-juror
-juri
-jurymen
-just
-justeiu
-justest
-justic
-justic
-justic
-justic
-justif
-justifi
-justifi
-justl
-justl
-justl
-justl
-justli
-just
-just
-jut
-jutti
-juven
-kam
-kate
-kate
-kate
-katharin
-katherina
-katherin
-kecksi
-keech
-keel
-keel
-keen
-keen
-keep
-keepdown
-keeper
-keeper
-keepest
-keep
-keep
-keiser
-ken
-kendal
-kennel
-kent
-kentish
-kentishman
-kentishmen
-kept
-kerchief
-kere
-kern
-kernal
-kernel
-kernel
-kern
-kersei
-kettl
-kettledrum
-kettledrum
-kei
-kei
-kibe
-kibe
-kick
-kick
-kickshaw
-kickshaws
-kicki
-kid
-kidnei
-kike
-kildar
-kill
-kill
-killer
-killeth
-kill
-killingworth
-kill
-kiln
-kimbolton
-kin
-kind
-kinder
-kindest
-kindl
-kindl
-kindless
-kindlier
-kindl
-kindli
-kind
-kind
-kindr
-kindr
-kind
-kine
-king
-kingdom
-kingdom
-kingli
-king
-kinr
-kin
-kinsman
-kinsmen
-kinswoman
-kirtl
-kirtl
-kiss
-kiss
-kiss
-kiss
-kitchen
-kitchen
-kite
-kite
-kitten
-kj
-kl
-klll
-knack
-knack
-knapp
-knav
-knave
-knaveri
-knaveri
-knave
-knavish
-knead
-knead
-knead
-knee
-kneel
-kneel
-kneel
-knee
-knell
-knew
-knewest
-knife
-knight
-knight
-knighthood
-knighthood
-knightli
-knight
-knit
-knit
-knitter
-knitteth
-knive
-knob
-knock
-knock
-knock
-knog
-knoll
-knot
-knot
-knot
-knotti
-know
-knower
-knowest
-know
-knowingli
-know
-knowledg
-known
-know
-l
-la
-laban
-label
-label
-labienu
-labio
-labor
-labor
-labor
-labour
-labour
-labour
-labour
-labour
-labour
-laboursom
-labra
-labyrinth
-lac
-lace
-lace
-lacedaemon
-lace
-laci
-lack
-lackbeard
-lack
-lackei
-lackei
-lackei
-lack
-lack
-lad
-ladder
-ladder
-lade
-laden
-ladi
-lade
-lad
-ladi
-ladybird
-ladyship
-ladyship
-laer
-laert
-lafeu
-lag
-lag
-laid
-lain
-laissez
-lake
-lake
-lakin
-lam
-lamb
-lambert
-lambkin
-lambkin
-lamb
-lame
-lame
-lame
-lament
-lament
-lament
-lament
-lament
-lament
-lament
-lament
-lament
-lame
-lame
-lamma
-lammastid
-lamound
-lamp
-lampass
-lamp
-lanc
-lancast
-lanc
-lanc
-lanceth
-lanch
-land
-land
-land
-landless
-landlord
-landmen
-land
-lane
-lane
-langag
-langlei
-langton
-languag
-languageless
-languag
-langu
-languish
-languish
-languish
-languish
-languish
-languish
-languor
-lank
-lantern
-lantern
-lanthorn
-lap
-lapi
-lapland
-lapp
-lap
-laps
-laps
-laps
-lapw
-laquai
-lard
-larder
-lard
-lard
-larg
-larg
-larg
-larger
-largess
-largest
-lark
-lark
-larron
-lartiu
-larum
-larum
-la
-lascivi
-lash
-lass
-lass
-last
-last
-last
-lastli
-last
-latch
-latch
-late
-late
-late
-later
-latest
-lath
-latin
-latten
-latter
-lattic
-laud
-laudabl
-laudi
-laugh
-laughabl
-laugh
-laugher
-laughest
-laugh
-laugh
-laughter
-launc
-launcelot
-launc
-launch
-laund
-laundress
-laundri
-laur
-laura
-laurel
-laurel
-laurenc
-lau
-lavach
-lave
-lave
-lavend
-lavina
-lavinia
-lavish
-lavishli
-lavolt
-lavolta
-law
-law
-lawfulli
-lawless
-lawlessli
-lawn
-lawn
-lawrenc
-law
-lawyer
-lawyer
-lai
-layer
-layest
-lai
-lai
-lazar
-lazar
-lazaru
-lazi
-lc
-ld
-ldst
-le
-lead
-leaden
-leader
-leader
-leadest
-lead
-lead
-leaf
-leagu
-leagu
-leagu
-leaguer
-leagu
-leah
-leak
-leaki
-lean
-leander
-leaner
-lean
-lean
-lean
-leap
-leap
-leap
-leap
-leapt
-lear
-learn
-learn
-learnedli
-learn
-learn
-learn
-learnt
-lea
-leas
-leas
-leash
-leas
-least
-leather
-leathern
-leav
-leav
-leaven
-leaven
-leaver
-leav
-leav
-leavi
-lecher
-lecher
-lecher
-lecheri
-lecon
-lectur
-lectur
-led
-leda
-leech
-leech
-leek
-leek
-leer
-leer
-lee
-lees
-leet
-leet
-left
-leg
-legaci
-legaci
-legat
-legatin
-lege
-leger
-lege
-legg
-legion
-legion
-legitim
-legitim
-leg
-leicest
-leicestershir
-leiger
-leiger
-leisur
-leisur
-leisur
-leman
-lemon
-lena
-lend
-lender
-lend
-lend
-lend
-length
-lengthen
-lengthen
-length
-leniti
-lennox
-lent
-lenten
-lentu
-leo
-leon
-leonardo
-leonati
-leonato
-leonatu
-leont
-leopard
-leopard
-leper
-leper
-lepidu
-leprosi
-lequel
-ler
-le
-less
-lessen
-lessen
-lesser
-lesson
-lesson
-lesson
-lest
-lestrak
-let
-lethargi
-lethargi
-lethargi
-leth
-let
-lett
-letter
-letter
-let
-lettuc
-leur
-leve
-level
-level
-level
-level
-leven
-lever
-leviathan
-leviathan
-levi
-levi
-leviti
-levi
-levi
-lewd
-lewdli
-lewd
-lewdster
-lewi
-liabl
-liar
-liar
-libbard
-libel
-libel
-liber
-liber
-libert
-liberti
-libertin
-libertin
-liberti
-librari
-libya
-licenc
-licen
-licens
-licenti
-licha
-licio
-lick
-lick
-licker
-lictor
-lid
-lid
-lie
-li
-lief
-liefest
-lieg
-liegeman
-liegemen
-lien
-li
-liest
-lieth
-lieu
-lieuten
-lieutenantri
-lieuten
-liev
-life
-lifeblood
-lifeless
-lifel
-lift
-lift
-lifter
-lifteth
-lift
-lift
-lig
-ligariu
-liggen
-light
-light
-lighten
-lighten
-lighter
-lightest
-lightli
-light
-lightn
-lightn
-light
-lik
-like
-like
-likeliest
-likelihood
-likelihood
-like
-like
-liker
-like
-likest
-likewis
-like
-like
-lili
-lili
-lim
-limand
-limb
-limbeck
-limbeck
-limber
-limbo
-limb
-lime
-lime
-limehous
-limekiln
-limit
-limit
-limit
-limit
-limn
-limp
-limp
-limp
-lin
-lincoln
-lincolnshir
-line
-lineal
-lineal
-lineament
-lineament
-line
-linen
-linen
-line
-ling
-lingar
-linger
-linger
-linger
-linguist
-line
-link
-link
-linsei
-linstock
-linta
-lion
-lionel
-lioness
-lion
-lip
-lipp
-lip
-lipsburi
-liquid
-liquor
-liquorish
-liquor
-lirra
-lisbon
-lisp
-lisp
-list
-listen
-listen
-list
-literatur
-lither
-litter
-littl
-littlest
-liv
-live
-live
-liveli
-livelihood
-livelong
-live
-liver
-liveri
-liver
-liveri
-live
-livest
-liveth
-livia
-live
-live
-lizard
-lizard
-ll
-lll
-llou
-lnd
-lo
-loa
-loach
-load
-loaden
-load
-load
-loaf
-loam
-loan
-loath
-loath
-loath
-loather
-loath
-loath
-loathli
-loath
-loathsom
-loathsom
-loathsomest
-loav
-lob
-lobbi
-lobbi
-local
-lochab
-lock
-lock
-lock
-lockram
-lock
-locust
-lode
-lodg
-lodg
-lodg
-lodger
-lodg
-lodg
-lodg
-lodovico
-lodowick
-lofti
-log
-logger
-loggerhead
-loggerhead
-logget
-logic
-log
-loin
-loiter
-loiter
-loiter
-loiter
-loll
-loll
-lombardi
-london
-london
-lone
-loneli
-lone
-long
-longavil
-longboat
-long
-longer
-longest
-longeth
-long
-long
-longli
-long
-longtail
-loo
-loof
-look
-look
-looker
-looker
-lookest
-look
-look
-loon
-loop
-loo
-loos
-loos
-loos
-loosen
-loos
-lop
-lopp
-loquitur
-lord
-lord
-lord
-lord
-lordli
-lordli
-lord
-lordship
-lordship
-lorenzo
-lorn
-lorrain
-lorship
-lo
-lose
-loser
-loser
-lose
-losest
-loseth
-lose
-loss
-loss
-lost
-lot
-lot
-lott
-lotteri
-loud
-louder
-loudli
-lour
-loureth
-lour
-lous
-lous
-lousi
-lout
-lout
-lout
-louvr
-lov
-love
-love
-lovedst
-lovel
-loveli
-loveli
-lovel
-love
-lover
-lover
-lover
-love
-lovest
-loveth
-love
-lovingli
-low
-low
-lower
-lowest
-low
-lowli
-lowli
-lown
-low
-loyal
-loyal
-loyalti
-loyalti
-lozel
-lt
-lubber
-lubberli
-luc
-luccico
-luce
-lucentio
-luce
-lucetta
-luciana
-lucianu
-lucif
-lucifi
-luciliu
-lucina
-lucio
-luciu
-luck
-luckier
-luckiest
-luckili
-luckless
-lucki
-lucr
-lucrec
-lucretia
-luculliu
-lucullu
-luci
-lud
-ludlow
-lug
-lugg
-luggag
-luke
-lukewarm
-lull
-lulla
-lullabi
-lull
-lumbert
-lump
-lumpish
-luna
-lunaci
-lunaci
-lunat
-lunat
-lune
-lung
-luperc
-lurch
-lure
-lurk
-lurketh
-lurk
-lurk
-lusciou
-lush
-lust
-lust
-luster
-lust
-lustier
-lustiest
-lustig
-lustihood
-lustili
-lustr
-lustrou
-lust
-lusti
-lute
-lute
-lutestr
-lutheran
-luxuri
-luxuri
-luxuri
-ly
-lycaonia
-lycurgus
-lydia
-lye
-lyen
-ly
-lym
-lymog
-lynn
-lysand
-m
-ma
-maan
-mab
-macbeth
-maccabaeu
-macdonwald
-macduff
-mace
-macedon
-mace
-machiavel
-machin
-machin
-machin
-mack
-macmorri
-macul
-macul
-mad
-madam
-madam
-madam
-madcap
-mad
-mad
-made
-madeira
-madli
-madman
-madmen
-mad
-madonna
-madrig
-mad
-maecena
-maggot
-maggot
-magic
-magic
-magician
-magistr
-magistr
-magnanim
-magnanim
-magni
-magnifi
-magnific
-magnific
-magnifico
-magnifico
-magnu
-mahomet
-mahu
-maid
-maiden
-maidenhead
-maidenhead
-maidenhood
-maidenhood
-maidenliest
-maidenli
-maiden
-maidhood
-maid
-mail
-mail
-mail
-maim
-maim
-maim
-main
-maincours
-main
-mainli
-mainmast
-main
-maintain
-maintain
-maintain
-mainten
-mai
-maison
-majesta
-majeste
-majest
-majest
-majest
-majesti
-majesti
-major
-major
-mak
-make
-makeless
-maker
-maker
-make
-makest
-maketh
-make
-make
-mal
-mala
-maladi
-maladi
-malapert
-malcolm
-malcont
-malcont
-male
-maledict
-malefact
-malefactor
-malefactor
-male
-malevol
-malevol
-malhecho
-malic
-malici
-malici
-malign
-malign
-malign
-malignantli
-malkin
-mall
-mallard
-mallet
-mallow
-malmsei
-malt
-maltworm
-malvolio
-mamilliu
-mammer
-mammet
-mammet
-mammock
-man
-manacl
-manacl
-manag
-manag
-manag
-manag
-manakin
-manchu
-mandat
-mandragora
-mandrak
-mandrak
-mane
-manent
-mane
-manet
-manfulli
-mangl
-mangl
-mangl
-mangl
-mangi
-manhood
-manhood
-manifest
-manifest
-manifest
-manifold
-manifoldli
-manka
-mankind
-manlik
-manli
-mann
-manna
-manner
-mannerli
-manner
-manningtre
-mannish
-manor
-manor
-man
-mansion
-mansionri
-mansion
-manslaught
-mantl
-mantl
-mantl
-mantua
-mantuan
-manual
-manur
-manur
-manu
-mani
-map
-mapp
-map
-mar
-marbl
-marbl
-marcad
-marcellu
-march
-march
-marcheth
-march
-marchio
-marchpan
-marcian
-marciu
-marcu
-mardian
-mare
-mare
-marg
-margarelon
-margaret
-marg
-margent
-margeri
-maria
-marian
-mariana
-mari
-marigold
-marin
-marin
-maritim
-marjoram
-mark
-mark
-market
-market
-marketplac
-market
-mark
-markman
-mark
-marl
-marl
-marmoset
-marquess
-marqui
-marr
-marriag
-marriag
-marri
-marri
-mar
-marrow
-marrowless
-marrow
-marri
-marri
-mar
-marseil
-marsh
-marshal
-marshalsea
-marshalship
-mart
-mart
-martem
-martext
-martial
-martin
-martino
-martiu
-martlema
-martlet
-mart
-martyr
-martyr
-marullu
-marv
-marvel
-marvel
-marvel
-marvel
-marvel
-mari
-ma
-masculin
-masham
-mask
-mask
-masker
-masker
-mask
-mask
-mason
-masonri
-mason
-masqu
-masquer
-masqu
-masqu
-mass
-massacr
-massacr
-mass
-massi
-mast
-mastcr
-master
-masterdom
-masterest
-masterless
-masterli
-masterpiec
-master
-mastership
-mastic
-mastiff
-mastiff
-mast
-match
-match
-matcheth
-match
-matchless
-mate
-mate
-mater
-materi
-mate
-mathemat
-matin
-matron
-matron
-matter
-matter
-matthew
-mattock
-mattress
-matur
-matur
-maud
-maudlin
-maugr
-maul
-maund
-mauri
-mauritania
-mauvai
-maw
-maw
-maxim
-mai
-maydai
-mayest
-mayor
-maypol
-mayst
-maz
-maze
-maze
-maze
-mazzard
-me
-meacock
-mead
-meadow
-meadow
-mead
-meagr
-meal
-meal
-meali
-mean
-meander
-meaner
-meanest
-meaneth
-mean
-mean
-meanli
-mean
-meant
-meantim
-meanwhil
-measl
-measur
-measur
-measur
-measur
-measureless
-measur
-measur
-meat
-meat
-mechan
-mechan
-mechan
-mechan
-mechant
-med
-medal
-meddl
-meddler
-meddl
-mede
-medea
-media
-mediat
-mediat
-medic
-medicin
-medicin
-medicin
-medit
-medit
-medit
-medit
-medit
-mediterranean
-mediterraneum
-medlar
-medlar
-meed
-meed
-meek
-meekli
-meek
-meet
-meeter
-meetest
-meet
-meet
-meetli
-meet
-meet
-meg
-mehercl
-meilleur
-meini
-meisen
-melancholi
-melancholi
-melford
-mell
-melliflu
-mellow
-mellow
-melodi
-melodi
-melt
-melt
-melteth
-melt
-melt
-melun
-member
-member
-memento
-memor
-memorandum
-memori
-memori
-memori
-memoriz
-memor
-memori
-memphi
-men
-menac
-menac
-menac
-menaphon
-mena
-mend
-mend
-mender
-mend
-mend
-menecr
-menelau
-meneniu
-mental
-menteith
-mention
-menti
-menton
-mephostophilu
-mer
-mercatant
-mercatio
-mercenari
-mercenari
-mercer
-merchandis
-merchand
-merchant
-merchant
-merci
-merci
-mercifulli
-merciless
-mercuri
-mercuri
-mercuri
-mercutio
-merci
-mere
-mere
-mere
-merest
-meridian
-merit
-merit
-meritori
-merit
-merlin
-mermaid
-mermaid
-merop
-merrier
-merriest
-merrili
-merriman
-merriment
-merriment
-merri
-merri
-mervail
-me
-mesh
-mesh
-mesopotamia
-mess
-messag
-messag
-messala
-messalin
-messeng
-messeng
-mess
-messina
-met
-metal
-metal
-metamorphi
-metamorphos
-metaphor
-metaphys
-metaphys
-mete
-metellu
-meteor
-meteor
-meteyard
-metheglin
-metheglin
-methink
-methink
-method
-method
-methought
-methought
-metr
-metr
-metropoli
-mett
-mettl
-mettl
-meu
-mew
-mew
-mewl
-mexico
-mi
-mice
-michael
-michaelma
-micher
-mich
-mickl
-microcosm
-mid
-mida
-middest
-middl
-middleham
-midnight
-midriff
-midst
-midsumm
-midwai
-midwif
-midwiv
-mienn
-might
-might
-mightier
-mightiest
-mightili
-mighti
-mightst
-mighti
-milan
-milch
-mild
-milder
-mildest
-mildew
-mildew
-mildli
-mild
-mile
-mile
-milford
-militarist
-militari
-milk
-milk
-milkmaid
-milk
-milksop
-milki
-mill
-mill
-miller
-millin
-million
-million
-million
-mill
-millston
-milo
-mimic
-minc
-minc
-minc
-minc
-mind
-mind
-mind
-mindless
-mind
-mine
-miner
-miner
-minerva
-mine
-mingl
-mingl
-mingl
-minikin
-minim
-minim
-minimo
-minimu
-mine
-minion
-minion
-minist
-minist
-minist
-ministr
-minnow
-minnow
-minola
-minor
-mino
-minotaur
-minstrel
-minstrel
-minstrelsi
-mint
-mint
-minut
-minut
-minut
-minx
-mio
-mir
-mirabl
-miracl
-miracl
-miracul
-miranda
-mire
-mirror
-mirror
-mirth
-mirth
-miri
-mi
-misadventur
-misadventur
-misanthropo
-misappli
-misbecam
-misbecom
-misbecom
-misbegot
-misbegotten
-misbeliev
-misbeliev
-misbhav
-miscal
-miscal
-miscarri
-miscarri
-miscarri
-miscarri
-mischanc
-mischanc
-mischief
-mischief
-mischiev
-misconceiv
-misconst
-misconst
-misconstruct
-misconstru
-misconstru
-miscreant
-miscreat
-misde
-misde
-misdemean
-misdemeanour
-misdoubt
-misdoubteth
-misdoubt
-misenum
-miser
-miser
-miser
-misericord
-miseri
-miser
-miseri
-misfortun
-misfortun
-misgiv
-misgiv
-misgiv
-misgovern
-misgovern
-misgraf
-misguid
-mishap
-mishap
-misheard
-misinterpret
-mislead
-mislead
-mislead
-mislead
-misl
-mislik
-misord
-misplac
-misplac
-misplac
-mispri
-mispris
-mispris
-mispriz
-misproud
-misquot
-misreport
-miss
-miss
-miss
-misshap
-misshapen
-missheath
-miss
-missingli
-mission
-missiv
-missiv
-misspok
-mist
-mista
-mistak
-mistak
-mistaken
-mistak
-mistaketh
-mistak
-mistak
-mistemp
-mistemp
-misterm
-mist
-misthink
-misthought
-mistleto
-mistook
-mistread
-mistress
-mistress
-mistresss
-mistriship
-mistrust
-mistrust
-mistrust
-mistrust
-mist
-misti
-misu
-misus
-misus
-misus
-mite
-mithrid
-mitig
-mitig
-mix
-mix
-mixtur
-mixtur
-mm
-mnd
-moan
-moan
-moat
-moat
-mobl
-mock
-mockabl
-mocker
-mockeri
-mocker
-mockeri
-mock
-mock
-mockvat
-mockwat
-model
-modena
-moder
-moder
-moder
-modern
-modest
-modesti
-modestli
-modesti
-modicum
-modo
-modul
-moe
-moi
-moieti
-moist
-moisten
-moistur
-moldwarp
-mole
-molehil
-mole
-molest
-molest
-mollif
-molli
-molten
-molto
-mome
-moment
-momentari
-mome
-mon
-monachum
-monarch
-monarchi
-monarch
-monarcho
-monarch
-monarchi
-monast
-monasteri
-monast
-mondai
-mond
-monei
-monei
-mong
-monger
-monger
-mong
-mongrel
-mongrel
-mongst
-monk
-monkei
-monkei
-monk
-monmouth
-monopoli
-mon
-monsieur
-monsieur
-monster
-monster
-monstrou
-monstrous
-monstrous
-monstruos
-montacut
-montag
-montagu
-montagu
-montano
-montant
-montez
-montferrat
-montgomeri
-month
-monthli
-month
-montjoi
-monument
-monument
-monument
-mood
-mood
-moodi
-moon
-moonbeam
-moonish
-moonlight
-moon
-moonshin
-moonshin
-moor
-moorfield
-moor
-moorship
-mop
-mope
-mope
-mop
-mopsa
-moral
-moral
-moral
-moral
-mordak
-more
-moreov
-more
-morgan
-mori
-morisco
-morn
-morn
-morn
-morocco
-morri
-morrow
-morrow
-morsel
-morsel
-mort
-mortal
-mortal
-mortal
-mortal
-mortar
-mortgag
-mortifi
-mortifi
-mortim
-mortim
-morti
-mortis
-morton
-mose
-moss
-mossgrown
-most
-mote
-moth
-mother
-mother
-moth
-motion
-motionless
-motion
-motiv
-motiv
-motlei
-mot
-mought
-mould
-mould
-mouldeth
-mould
-mouldi
-moult
-moulten
-mounch
-mounseur
-mounsieur
-mount
-mountain
-mountain
-mountain
-mountain
-mountain
-mountant
-mountanto
-mountebank
-mountebank
-mount
-mounteth
-mount
-mount
-mourn
-mourn
-mourner
-mourner
-mourn
-mournfulli
-mourn
-mourningli
-mourn
-mourn
-mou
-mous
-mousetrap
-mous
-mouth
-mouth
-mouth
-mov
-movabl
-move
-moveabl
-moveabl
-move
-mover
-mover
-move
-moveth
-move
-movingli
-movousu
-mow
-mowbrai
-mower
-mow
-mow
-moi
-moi
-moys
-mr
-much
-muck
-mud
-mud
-muddi
-muddi
-muffin
-muffl
-muffl
-muffl
-muffler
-muffl
-mugger
-mug
-mulberri
-mulberri
-mule
-mule
-mulet
-mulier
-mulier
-muliteu
-mull
-mulmutiu
-multipli
-multipli
-multipli
-multipot
-multitud
-multitud
-multitudin
-mum
-mumbl
-mumbl
-mummer
-mummi
-mun
-munch
-muniment
-munit
-murd
-murder
-murder
-murder
-murder
-murder
-murder
-murder
-mure
-murk
-murkiest
-murki
-murmur
-murmur
-murmur
-murrain
-murrai
-murrion
-murther
-murther
-murther
-murther
-murther
-murther
-mu
-muscadel
-muscovit
-muscovit
-muscovi
-muse
-muse
-mush
-mushroom
-music
-music
-musician
-musician
-music
-muse
-muse
-musk
-musket
-musket
-musko
-muss
-mussel
-mussel
-must
-mustachio
-mustard
-mustardse
-muster
-muster
-muster
-musti
-mutabl
-mutabl
-mutat
-mutat
-mute
-mute
-mutest
-mutin
-mutin
-mutin
-mutin
-mutini
-mutin
-mutini
-mutiu
-mutter
-mutter
-mutton
-mutton
-mutual
-mutual
-mutual
-muzzl
-muzzl
-muzzl
-mv
-mww
-my
-mynheer
-myrmidon
-myrmidon
-myrtl
-myself
-myst
-mysteri
-mysteri
-n
-nag
-nage
-nag
-naiad
-nail
-nail
-nak
-nake
-naked
-nal
-nam
-name
-name
-nameless
-name
-name
-namest
-name
-nan
-nanc
-nap
-nape
-nape
-napkin
-napkin
-napl
-napless
-nap
-nap
-narbon
-narcissu
-narin
-narrow
-narrowli
-naso
-nasti
-nathaniel
-natif
-nation
-nation
-nativ
-nativ
-natur
-natur
-natur
-natur
-natur
-natur
-natur
-natu
-naught
-naughtili
-naughti
-navarr
-nave
-navel
-navig
-navi
-nai
-nayward
-nayword
-nazarit
-ne
-neaf
-neamnoin
-neanmoin
-neapolitan
-neapolitan
-near
-nearer
-nearest
-nearli
-near
-neat
-neatli
-neb
-nebour
-nebuchadnezzar
-nec
-necessari
-necessarili
-necessari
-necess
-necess
-necess
-neck
-necklac
-neck
-nectar
-ned
-nedar
-need
-need
-needer
-need
-needful
-need
-needl
-needl
-needless
-needli
-need
-needi
-neer
-neez
-nefa
-negat
-neg
-neg
-neglect
-neglect
-neglect
-neglectingli
-neglect
-neglig
-neglig
-negoti
-negoti
-negro
-neigh
-neighbor
-neighbour
-neighbourhood
-neighbour
-neighbourli
-neighbour
-neigh
-neigh
-neither
-nell
-nemean
-nemesi
-neoptolemu
-nephew
-nephew
-neptun
-ner
-nereid
-nerissa
-nero
-nero
-ner
-nerv
-nerv
-nervii
-nervi
-nessu
-nest
-nestor
-nest
-net
-nether
-netherland
-net
-nettl
-nettl
-nettl
-neuter
-neutral
-nev
-never
-nevil
-nevil
-new
-newborn
-newer
-newest
-newgat
-newli
-new
-new
-newsmong
-newt
-newt
-next
-nibbl
-nicanor
-nice
-nice
-nice
-nicer
-niceti
-nichola
-nick
-nicknam
-nick
-niec
-niec
-niggard
-niggard
-niggardli
-nigh
-night
-nightcap
-nightcap
-night
-nightgown
-nightingal
-nightingal
-nightli
-nightmar
-night
-nightwork
-nihil
-nile
-nill
-nilu
-nimbl
-nimbl
-nimbler
-nimbl
-nine
-nineteen
-ning
-ningli
-ninni
-ninth
-ninu
-niob
-niob
-nip
-nipp
-nip
-nippl
-nip
-nit
-nly
-nnight
-nnight
-no
-noah
-nob
-nobil
-nobi
-nobl
-nobleman
-noblemen
-nobl
-nobler
-nobl
-nobless
-noblest
-nobli
-nobodi
-noce
-nod
-nod
-nod
-noddl
-noddl
-noddi
-nod
-noe
-noint
-noi
-nois
-noiseless
-noisemak
-nois
-noisom
-nole
-nomin
-nomin
-nomin
-nominativo
-non
-nonag
-nonc
-none
-nonino
-nonni
-nonpareil
-nonsuit
-noni
-nook
-nook
-noon
-noondai
-noontid
-nor
-norberi
-norfolk
-norman
-normandi
-norman
-north
-northampton
-northamptonshir
-northerli
-northern
-northgat
-northumberland
-northumberland
-northward
-norwai
-norwai
-norwegian
-norweyan
-no
-nose
-nosegai
-noseless
-nose
-noster
-nostra
-nostril
-nostril
-not
-notabl
-notabl
-notari
-notch
-note
-notebook
-note
-notedli
-note
-notest
-noteworthi
-noth
-noth
-notic
-notifi
-note
-notion
-notori
-notori
-notr
-notwithstand
-nought
-noun
-noun
-nourish
-nourish
-nourish
-nourish
-nourisheth
-nourish
-nourish
-nou
-novel
-novelti
-novelti
-noverb
-novi
-novic
-novic
-novum
-now
-nowher
-noyanc
-ns
-nt
-nubibu
-numa
-numb
-number
-number
-number
-numberless
-number
-numb
-nun
-nuncio
-nuncl
-nunneri
-nun
-nuntiu
-nuptial
-nur
-nurs
-nurs
-nurser
-nurseri
-nurs
-nurseth
-nursh
-nurs
-nurtur
-nurtur
-nut
-nuthook
-nutmeg
-nutmeg
-nutriment
-nut
-nutshel
-ny
-nym
-nymph
-nymph
-o
-oak
-oaken
-oak
-oar
-oar
-oatcak
-oaten
-oath
-oathabl
-oath
-oat
-ob
-obduraci
-obdur
-obedi
-obedi
-obeis
-oberon
-obei
-obei
-obei
-obei
-obidicut
-object
-object
-object
-object
-oblat
-oblat
-oblig
-oblig
-oblig
-obliqu
-oblivion
-oblivi
-obloqui
-obscen
-obscen
-obscur
-obscur
-obscur
-obscur
-obscur
-obscur
-obscur
-obsequi
-obsequi
-obsequi
-observ
-observ
-observ
-observ
-observ
-observ
-observ
-observ
-observ
-observ
-observ
-observ
-observingli
-obsqu
-obstacl
-obstacl
-obstinaci
-obstin
-obstin
-obstruct
-obstruct
-obstruct
-obtain
-obtain
-obtain
-occas
-occas
-occid
-occident
-occult
-occupat
-occup
-occup
-occupi
-occupi
-occupi
-occurr
-occurr
-occurr
-ocean
-ocean
-octavia
-octaviu
-ocular
-od
-odd
-oddest
-oddli
-odd
-od
-od
-odiou
-odorifer
-odor
-odour
-odour
-od
-oeillad
-oe
-oeuvr
-of
-ofephesu
-off
-offal
-offenc
-offenc
-offenc
-offend
-offend
-offendendo
-offend
-offend
-offendeth
-offend
-offendress
-offend
-offens
-offenseless
-offens
-offens
-offer
-offer
-offer
-offer
-offer
-offert
-offic
-offic
-offic
-offic
-offic
-offic
-offici
-offici
-offspr
-oft
-often
-often
-oftentim
-oh
-oil
-oil
-oili
-old
-oldcastl
-olden
-older
-oldest
-old
-oliv
-oliv
-oliv
-oliv
-olivia
-olympian
-olympu
-oman
-oman
-omen
-omin
-omiss
-omit
-omitt
-omit
-omit
-omn
-omn
-omnipot
-on
-onc
-on
-on
-oney
-ongl
-onion
-onion
-onli
-onset
-onward
-onward
-oo
-ooz
-ooz
-oozi
-op
-opal
-op
-open
-open
-open
-openli
-open
-open
-oper
-oper
-oper
-oper
-oper
-op
-oph
-ophelia
-opinion
-opinion
-opportun
-opportun
-opportun
-oppo
-oppos
-oppos
-opposeless
-oppos
-oppos
-oppos
-oppos
-opposit
-opposit
-opposit
-opposit
-oppress
-oppress
-oppress
-oppresseth
-oppress
-oppress
-oppressor
-opprest
-opprobri
-oppugn
-opul
-opul
-or
-oracl
-oracl
-orang
-orat
-orat
-orat
-oratori
-orb
-orb
-orb
-orchard
-orchard
-ord
-ordain
-ordain
-ordain
-order
-order
-order
-orderless
-orderli
-order
-ordin
-ordin
-ordinari
-ordinari
-ordnanc
-ord
-ordur
-or
-organ
-organ
-orgil
-orient
-orifex
-origin
-origin
-orison
-ork
-orlando
-orld
-orlean
-ornament
-ornament
-orod
-orphan
-orphan
-orpheu
-orsino
-ort
-orthographi
-ort
-oscorbidulcho
-osier
-osier
-osprei
-osr
-osric
-ossa
-ost
-ostent
-ostentar
-ostent
-ostent
-ostler
-ostler
-ostrich
-osw
-oswald
-othello
-other
-otherg
-other
-otherwher
-otherwhil
-otherwis
-otter
-ottoman
-ottomit
-oubli
-ouch
-ought
-oui
-ounc
-ounc
-ouph
-our
-our
-ourself
-ourselv
-ousel
-out
-outbid
-outbrav
-outbrav
-outbreak
-outcast
-outcri
-outcri
-outdar
-outdar
-outdar
-outdon
-outfac
-outfac
-outfac
-outfac
-outfli
-outfrown
-outgo
-outgo
-outgrown
-outjest
-outlaw
-outlawri
-outlaw
-outliv
-outliv
-outliv
-outliv
-outlook
-outlustr
-outpriz
-outrag
-outrag
-outrag
-outran
-outright
-outroar
-outrun
-outrun
-outrun
-outscold
-outscorn
-outsel
-outsel
-outsid
-outsid
-outspeak
-outsport
-outstar
-outstai
-outstood
-outstretch
-outstretch
-outstrik
-outstrip
-outstrip
-outswear
-outvenom
-outward
-outwardli
-outward
-outwear
-outweigh
-outwent
-outworn
-outworth
-oven
-over
-overaw
-overbear
-overblown
-overboard
-overbold
-overborn
-overbulk
-overbui
-overcam
-overcast
-overcharg
-overcharg
-overcom
-overcom
-overdon
-overearnest
-overfar
-overflow
-overflown
-overgl
-overgo
-overgon
-overgorg
-overgrown
-overhead
-overhear
-overheard
-overhold
-overjoi
-overkind
-overland
-overleath
-overl
-overlook
-overlook
-overlook
-overmast
-overmount
-overmuch
-overpass
-overp
-overp
-overplu
-overrul
-overrun
-overscutch
-overset
-overshad
-overshin
-overshin
-overshot
-oversight
-overspread
-overstain
-overswear
-overt
-overta
-overtak
-overtaketh
-overthrow
-overthrown
-overthrow
-overtook
-overtopp
-overtur
-overturn
-overwatch
-overween
-overween
-overweigh
-overwhelm
-overwhelm
-overworn
-ovid
-ovidiu
-ow
-ow
-ow
-owedst
-owen
-ow
-owest
-oweth
-ow
-owl
-owl
-own
-owner
-owner
-own
-own
-owi
-ox
-oxen
-oxford
-oxfordshir
-oxlip
-oy
-oyster
-p
-pabbl
-pabylon
-pac
-pace
-pace
-pace
-pacifi
-pacifi
-pace
-pack
-packet
-packet
-packhors
-pack
-pack
-pack
-packthread
-pacoru
-paction
-pad
-paddl
-paddl
-paddock
-padua
-pagan
-pagan
-page
-pageant
-pageant
-page
-pah
-paid
-pail
-pail
-pail
-pain
-pain
-pain
-painfulli
-pain
-paint
-paint
-painter
-paint
-paint
-paint
-pair
-pair
-pair
-pajock
-pal
-palabra
-palac
-palac
-palamed
-palat
-palat
-palatin
-palat
-pale
-pale
-pale
-paler
-pale
-palestin
-palfrei
-palfrei
-palisado
-pall
-pallabri
-palla
-pallet
-palm
-palmer
-palmer
-palm
-palmi
-palpabl
-palsi
-palsi
-palsi
-palt
-palter
-paltri
-pali
-pamp
-pamper
-pamphlet
-pan
-pancack
-pancak
-pancak
-pandar
-pandar
-pandaru
-pander
-panderli
-pander
-pandulph
-panel
-pang
-pang
-pang
-pannier
-pannonian
-pansa
-pansi
-pant
-pantaloon
-pant
-pantheon
-panther
-panthino
-pant
-pantingli
-pantler
-pantri
-pant
-pap
-papal
-paper
-paper
-paphlagonia
-papho
-papist
-pap
-par
-parabl
-paracelsu
-paradis
-paradox
-paradox
-paragon
-paragon
-parallel
-parallel
-paramour
-paramour
-parapet
-paraquito
-parasit
-parasit
-parca
-parcel
-parcel
-parcel
-parch
-parch
-parch
-parchment
-pard
-pardon
-pardona
-pardon
-pardon
-pardon
-pardonn
-pardonn
-pardonnez
-pardon
-pare
-pare
-parel
-parent
-parentag
-parent
-parfect
-pare
-pare
-pari
-parish
-parishion
-parisian
-paritor
-park
-park
-parl
-parler
-parl
-parlei
-parlez
-parliament
-parlor
-parlour
-parlou
-parmac
-parol
-parricid
-parricid
-parrot
-parrot
-parslei
-parson
-part
-partak
-partaken
-partak
-partak
-part
-parthia
-parthian
-parthian
-parti
-partial
-partial
-partial
-particip
-particip
-particl
-particular
-particular
-particular
-particularli
-particular
-parti
-part
-partisan
-partisan
-partit
-partizan
-partlet
-partli
-partner
-partner
-partridg
-part
-parti
-pa
-pash
-pash
-pash
-pass
-passabl
-passado
-passag
-passag
-passant
-pass
-passeng
-passeng
-pass
-passeth
-pass
-passio
-passion
-passion
-passion
-passion
-passiv
-passport
-passi
-past
-past
-pastern
-pasti
-pastim
-pastim
-pastor
-pastor
-pastor
-pastri
-pastur
-pastur
-pasti
-pat
-patai
-patch
-patcheri
-patch
-pate
-pate
-patent
-patent
-patern
-pate
-path
-pathet
-path
-pathwai
-pathwai
-patienc
-patient
-patient
-patient
-patin
-patrician
-patrician
-patrick
-patrimoni
-patroclu
-patron
-patronag
-patro
-patron
-patrum
-patter
-pattern
-pattern
-pattl
-pauca
-pauca
-paul
-paulina
-paunch
-paunch
-paus
-pauser
-paus
-pausingli
-pauvr
-pav
-pave
-pavement
-pavilion
-pavilion
-pavin
-paw
-pawn
-pawn
-paw
-pax
-pai
-payest
-pai
-payment
-payment
-pai
-paysan
-paysan
-pe
-peac
-peaceabl
-peaceabl
-peac
-peacemak
-peac
-peach
-peach
-peacock
-peacock
-peak
-peak
-peal
-peal
-pear
-peard
-pearl
-pearl
-pear
-pea
-peasant
-peasantri
-peasant
-peascod
-peas
-peaseblossom
-peat
-peaten
-peat
-pebbl
-pebbl
-pebbl
-peck
-peck
-peculiar
-pecu
-pedant
-pedant
-pedascul
-pede
-pedest
-pedigre
-pedlar
-pedlar
-pedro
-ped
-peel
-peep
-peep
-peep
-peep
-peer
-peereth
-peer
-peerless
-peer
-peesel
-peevish
-peevishli
-peflur
-peg
-pegasu
-peg
-peis
-peis
-peiz
-pelf
-pelican
-pelion
-pell
-pella
-pellet
-peloponnesu
-pelt
-pelt
-pembrok
-pen
-penalti
-penalti
-penanc
-penc
-pencil
-pencil
-pencil
-pendant
-pendent
-pendragon
-pendul
-penelop
-penetr
-penetr
-penetr
-penit
-penit
-penitenti
-penit
-penit
-penker
-penknif
-penn
-pen
-pen
-pennon
-penni
-pennyworth
-pennyworth
-pen
-pens
-pension
-pension
-pensiv
-pensiv
-pensiv
-pent
-pentecost
-penthesilea
-penthous
-penuri
-penuri
-peopl
-peopl
-peopl
-peopl
-pepin
-pepper
-peppercorn
-pepper
-per
-peradventur
-peradventur
-perceiv
-perceiv
-perceiv
-perceiv
-perceiveth
-perch
-perchanc
-perci
-percuss
-perci
-perdi
-perdita
-perdit
-perdonato
-perdu
-perdur
-perdur
-perdi
-pere
-peregrin
-peremptorili
-peremptori
-perfect
-perfect
-perfect
-perfectest
-perfect
-perfect
-perfectli
-perfect
-perfidi
-perfidi
-perforc
-perform
-perform
-perform
-perform
-perform
-perform
-perform
-perform
-perfum
-perfum
-perfum
-perfum
-perfum
-perg
-perhap
-periapt
-perigort
-perigouna
-peril
-peril
-peril
-period
-period
-perish
-perish
-perishest
-perisheth
-perish
-periwig
-perjur
-perjur
-perjur
-perjuri
-perjuri
-perk
-perk
-permafoi
-perman
-permiss
-permiss
-permit
-permit
-pernici
-pernici
-peror
-perpend
-perpendicular
-perpendicularli
-perpetu
-perpetu
-perpetu
-perplex
-perplex
-perplex
-per
-persecut
-persecut
-persecutor
-perseu
-persev
-persever
-persev
-persia
-persian
-persist
-persist
-persist
-persist
-persist
-person
-persona
-personag
-personag
-person
-person
-person
-person
-person
-person
-person
-perspect
-perspect
-perspect
-perspicu
-persuad
-persuad
-persuad
-persuad
-persuas
-persuas
-pert
-pertain
-pertain
-pertain
-pertaunt
-pertin
-pertli
-perturb
-perturb
-perturb
-perturb
-peru
-perus
-perus
-perus
-perus
-pervers
-pervers
-pervers
-pervert
-pervert
-peseech
-pest
-pester
-pestifer
-pestil
-pestil
-pet
-petar
-peter
-petit
-petit
-petitionari
-petition
-petition
-petit
-peto
-petrarch
-petruchio
-petter
-petticoat
-petticoat
-petti
-pettish
-pettito
-petti
-peu
-pew
-pewter
-pewter
-phaethon
-phaeton
-phantasim
-phantasim
-phantasma
-pharamond
-pharaoh
-pharsalia
-pheasant
-pheazar
-phebe
-phebe
-pheebu
-pheez
-phibbu
-philadelpho
-philario
-philarmonu
-philemon
-philip
-philippan
-philipp
-philippi
-phillida
-philo
-philomel
-philomela
-philosoph
-philosoph
-philosoph
-philosophi
-philostr
-philotu
-phlegmat
-phoeb
-phoebu
-phoenicia
-phoenician
-phoenix
-phorbu
-photinu
-phrase
-phraseless
-phrase
-phrygia
-phrygian
-phrynia
-physic
-physic
-physician
-physician
-physic
-pia
-pibbl
-pibl
-picardi
-pick
-pickax
-pickax
-pickbon
-pick
-picker
-pick
-pickl
-picklock
-pickpurs
-pick
-pickt
-pickthank
-pictur
-pictur
-pictur
-pictur
-pid
-pie
-piec
-piec
-piec
-piec
-pi
-pied
-pier
-pierc
-pierc
-pierc
-pierc
-pierceth
-pierc
-pierci
-pier
-pi
-pieti
-pig
-pigeon
-pigeon
-pight
-pigmi
-pigrogromitu
-pike
-pike
-pil
-pilat
-pilat
-pilcher
-pile
-pile
-pilf
-pilfer
-pilgrim
-pilgrimag
-pilgrim
-pill
-pillag
-pillag
-pillar
-pillar
-pillicock
-pillori
-pillow
-pillow
-pill
-pilot
-pilot
-pimpernel
-pin
-pinch
-pinch
-pinch
-pinch
-pindaru
-pine
-pine
-pine
-pinfold
-pine
-pinion
-pink
-pinn
-pinnac
-pin
-pins
-pint
-pintpot
-pion
-pioneer
-pioner
-pioner
-piou
-pip
-pipe
-piper
-piper
-pipe
-pipe
-pippin
-pippin
-pirat
-pirat
-pisa
-pisanio
-pish
-pismir
-piss
-piss
-pistol
-pistol
-pit
-pitch
-pitch
-pitcher
-pitcher
-pitchi
-piteou
-piteous
-pitfal
-pith
-pithless
-pithi
-piti
-piti
-piti
-piti
-pitifulli
-pitiless
-pit
-pittanc
-pitti
-pittikin
-piti
-piti
-piu
-plac
-place
-place
-placentio
-place
-placeth
-placid
-place
-plack
-placket
-placket
-plagu
-plagu
-plagu
-plagu
-plagu
-plagui
-plain
-plainer
-plainest
-plain
-plain
-plainli
-plain
-plain
-plainsong
-plaint
-plaintiff
-plaintiff
-plaint
-planch
-planet
-planetari
-planet
-plank
-plant
-plantag
-plantagenet
-plantagenet
-plantain
-plantat
-plant
-planteth
-plant
-plash
-plashi
-plast
-plaster
-plaster
-plat
-plate
-plate
-plate
-platform
-platform
-plat
-plat
-plausibl
-plausiv
-plautu
-plai
-plai
-player
-player
-playeth
-playfellow
-playfellow
-playhous
-plai
-plai
-plea
-pleach
-pleach
-plead
-plead
-pleader
-pleader
-plead
-plead
-plea
-pleasanc
-pleasant
-pleasantli
-pleas
-pleas
-pleaser
-pleaser
-pleas
-pleasest
-pleaseth
-pleas
-pleasur
-pleasur
-plebeian
-plebeii
-pleb
-pledg
-pledg
-plein
-plenitud
-plenteou
-plenteous
-plenti
-plenti
-plentifulli
-plenti
-pless
-pless
-pless
-pliant
-pli
-pli
-plight
-plight
-plighter
-plod
-plod
-plodder
-plod
-plod
-plood
-ploodi
-plot
-plot
-plot
-plotter
-plough
-plough
-ploughman
-ploughmen
-plow
-plow
-pluck
-pluck
-plucker
-pluck
-pluck
-plue
-plum
-plume
-plume
-plume
-plummet
-plump
-plumpi
-plum
-plung
-plung
-plung
-plural
-plurisi
-plu
-pluto
-plutu
-ply
-po
-pocket
-pocket
-pocket
-pocki
-podi
-poem
-poesi
-poet
-poetic
-poetri
-poet
-poictier
-poinard
-poin
-point
-pointblank
-point
-point
-point
-poi
-pois
-pois
-poison
-poison
-poison
-poison
-poison
-poison
-poke
-poke
-pol
-polack
-polack
-poland
-pold
-pole
-poleax
-polecat
-polecat
-polemon
-pole
-poli
-polici
-polici
-polish
-polish
-polit
-politician
-politician
-politicli
-polixen
-poll
-pollut
-pollut
-poloniu
-poltroon
-polus
-polydamu
-polydor
-polyxena
-pomand
-pomegran
-pomewat
-pomfret
-pomgarnet
-pommel
-pomp
-pompeiu
-pompei
-pompion
-pompou
-pomp
-pond
-ponder
-ponder
-pond
-poniard
-poniard
-pont
-pontic
-pontif
-ponton
-pooh
-pool
-pool
-poop
-poor
-poorer
-poorest
-poorli
-pop
-pope
-popedom
-popiliu
-popingai
-popish
-popp
-poppi
-pop
-popular
-popular
-popul
-porch
-porch
-pore
-pore
-pork
-porn
-porpentin
-porridg
-porring
-port
-portabl
-portag
-portal
-portanc
-portculli
-portend
-portend
-portent
-portent
-portent
-porter
-porter
-portia
-portion
-portli
-portotartarossa
-portrait
-portraitur
-port
-portug
-pose
-posi
-posi
-posit
-posit
-posit
-poss
-possess
-possess
-possess
-possesseth
-possess
-possess
-possess
-possessor
-posset
-posset
-possibl
-possibl
-possibl
-possibl
-possit
-post
-post
-post
-posterior
-posterior
-poster
-postern
-postern
-poster
-posthors
-posthors
-posthumu
-post
-postmast
-post
-postscript
-postur
-postur
-posi
-pot
-potabl
-potat
-potato
-potato
-potch
-potenc
-potent
-potent
-potenti
-potent
-potent
-pothecari
-pother
-potion
-potion
-potpan
-pot
-potter
-pot
-pottl
-pouch
-poulter
-poultic
-poultnei
-pouncet
-pound
-pound
-pour
-pourest
-pour
-pourquoi
-pour
-pout
-poverti
-pow
-powd
-powder
-power
-power
-powerfulli
-powerless
-power
-pox
-poi
-poysam
-prabbl
-practic
-practic
-practic
-practic
-practic
-practic
-practi
-practis
-practis
-practis
-practis
-practis
-practis
-praeclarissimu
-praemunir
-praetor
-praetor
-prag
-pragu
-prain
-prain
-prai
-prais
-prais
-prais
-praisest
-praiseworthi
-prais
-pranc
-prank
-prank
-prat
-prate
-prate
-prater
-prate
-prattl
-prattler
-prattl
-prave
-prawl
-prawn
-prai
-prayer
-prayer
-prai
-prai
-pre
-preach
-preach
-preacher
-preach
-preach
-preachment
-pread
-preambul
-preced
-preced
-preced
-precept
-precepti
-precept
-precinct
-preciou
-precious
-precipic
-precipit
-precipit
-precis
-precis
-precis
-precisian
-precor
-precurs
-precursor
-predeceas
-predecessor
-predecessor
-predestin
-predica
-predict
-predict
-predict
-predomin
-predomin
-predomin
-preech
-preemin
-prefac
-prefer
-prefer
-prefer
-preferr
-preferreth
-prefer
-prefer
-prefigur
-prefix
-prefix
-preform
-pregnanc
-pregnant
-pregnantli
-prejud
-prejudic
-prejudici
-prelat
-premedit
-premedit
-premis
-premis
-prenez
-prenomin
-prentic
-prentic
-preordin
-prepar
-prepar
-prepar
-prepar
-prepar
-preparedli
-prepar
-prepar
-prepost
-preposter
-preposter
-prerogatif
-prerog
-prerogativ
-presag
-presag
-presag
-presageth
-presag
-prescienc
-prescrib
-prescript
-prescript
-prescript
-prescript
-presenc
-presenc
-present
-present
-present
-present
-present
-presenteth
-present
-present
-present
-present
-preserv
-preserv
-preserv
-preserv
-preserv
-preserv
-preserv
-preserv
-presid
-press
-press
-presser
-press
-press
-pressur
-pressur
-prest
-prester
-presum
-presum
-presum
-presumpt
-presumptu
-presuppo
-pret
-pretenc
-pretenc
-pretend
-pretend
-pretend
-pretens
-pretext
-pretia
-prettier
-prettiest
-prettili
-pretti
-pretti
-prevail
-prevail
-prevaileth
-prevail
-prevail
-prevail
-prevent
-prevent
-prevent
-prevent
-prevent
-prei
-prey
-prei
-priam
-priami
-priamu
-pribbl
-price
-prick
-prick
-pricket
-prick
-prick
-pricksong
-pride
-pride
-pridg
-prie
-pri
-prief
-pri
-priest
-priesthood
-priest
-prig
-primal
-prime
-primer
-primero
-primest
-primit
-primo
-primogen
-primros
-primros
-primi
-princ
-princ
-princ
-princess
-princip
-princip
-princip
-principl
-principl
-princox
-pring
-print
-print
-print
-printless
-print
-prioress
-priori
-prioriti
-priori
-priscian
-prison
-prison
-prison
-prison
-prisonni
-prison
-pristin
-prith
-prithe
-privaci
-privat
-privat
-privat
-privilag
-privileg
-privileg
-privileg
-privileg
-privilegio
-privili
-priviti
-privi
-priz
-prize
-prize
-prizer
-prize
-prizest
-prize
-pro
-probabl
-probal
-probat
-proce
-proceed
-proceed
-proceed
-proceed
-proce
-process
-process
-proclaim
-proclaim
-proclaimeth
-proclaim
-proclam
-proclam
-proconsul
-procrastin
-procreant
-procreant
-procreat
-procru
-proculeiu
-procur
-procur
-procur
-procur
-procur
-procur
-prodig
-prodig
-prodig
-prodig
-prodigi
-prodigi
-prodigi
-prodigi
-proditor
-produc
-produc
-produc
-produc
-produc
-profac
-profan
-profan
-profan
-profan
-profan
-profan
-profan
-profan
-profess
-profess
-profess
-profess
-profess
-professor
-proffer
-proffer
-proffer
-proffer
-profici
-profit
-profit
-profit
-profit
-profit
-profitless
-profit
-profound
-profoundest
-profoundli
-progenitor
-progeni
-progn
-prognost
-prognost
-progress
-progress
-prohibit
-prohibit
-project
-project
-project
-prolixi
-prolix
-prologu
-prologu
-prolong
-prolong
-promethean
-prometheu
-promi
-promis
-promis
-promis
-promiseth
-promis
-promontori
-promot
-promot
-prompt
-prompt
-promptement
-prompter
-prompt
-prompt
-promptur
-promulg
-prone
-prononc
-prononcez
-pronoun
-pronounc
-pronounc
-pronounc
-pronounc
-pronoun
-proof
-proof
-prop
-propag
-propag
-propend
-propens
-proper
-proper
-properli
-properti
-properti
-properti
-propheci
-propheci
-prophesi
-prophesi
-prophesi
-prophesi
-prophet
-prophetess
-prophet
-prophet
-prophet
-propinqu
-propont
-proport
-proportion
-proport
-propo
-propos
-propos
-propos
-propos
-propos
-proposit
-proposit
-propound
-propp
-propr
-proprieti
-prop
-propugn
-prorogu
-prorogu
-proscript
-proscript
-prose
-prosecut
-prosecut
-proselyt
-proserpina
-prosp
-prospect
-prosper
-prosper
-prospero
-prosper
-prosper
-prosper
-prostitut
-prostrat
-protect
-protect
-protect
-protector
-protector
-protectorship
-protectress
-protect
-protest
-protest
-protest
-protest
-protest
-protest
-protest
-proteu
-protheu
-protract
-protract
-proud
-prouder
-proudest
-proudlier
-proudli
-proud
-prov
-provand
-prove
-prove
-provend
-proverb
-proverb
-prove
-proveth
-provid
-provid
-provid
-provid
-provid
-provid
-provid
-provinc
-provinc
-provinci
-prove
-provis
-proviso
-provoc
-provok
-provok
-provok
-provok
-provok
-provoketh
-provok
-provost
-prowess
-prudenc
-prudent
-prun
-prune
-prune
-prune
-pry
-pry
-psalm
-psalmist
-psalm
-psalteri
-ptolemi
-ptolemi
-public
-publican
-public
-publicli
-publicola
-publish
-publish
-publish
-publish
-publiu
-pucel
-puck
-pudder
-pud
-pud
-puddl
-puddl
-pudenc
-pueritia
-puff
-puf
-puff
-pug
-pui
-puissanc
-puissant
-puke
-puke
-pulcher
-pule
-pull
-puller
-pullet
-pull
-pull
-pulpit
-pulpit
-pulpit
-puls
-pulsidg
-pump
-pumpion
-pump
-pun
-punch
-punish
-punish
-punish
-punish
-punish
-punk
-punto
-puni
-pupil
-pupil
-puppet
-puppet
-puppi
-puppi
-pur
-purblind
-purcha
-purchas
-purchas
-purchas
-purchaseth
-purchas
-pure
-pure
-purer
-purest
-purg
-purgat
-purg
-purgatori
-purg
-purg
-purger
-purg
-purifi
-purifi
-puritan
-puriti
-purlieu
-purpl
-purpl
-purpl
-purport
-purpo
-purpos
-purpos
-purpos
-purpos
-purposeth
-purpos
-purr
-pur
-purs
-pursent
-purs
-pursu
-pursu
-pursu
-pursuer
-pursu
-pursuest
-pursueth
-pursu
-pursuit
-pursuiv
-pursuiv
-pursi
-puru
-purveyor
-push
-push
-pusillanim
-put
-putrefi
-putrifi
-put
-putter
-put
-puttock
-puzzel
-puzzl
-puzzl
-puzzl
-py
-pygmalion
-pygmi
-pygmi
-pyramid
-pyramid
-pyramid
-pyrami
-pyramis
-pyramu
-pyrenean
-pyrrhu
-pythagora
-qu
-quadrangl
-quae
-quaff
-quaf
-quagmir
-quail
-quail
-quail
-quaint
-quaintli
-quak
-quak
-quak
-qualif
-qualifi
-qualifi
-qualifi
-qualifi
-qualit
-qualiti
-qualiti
-qualm
-qualmish
-quam
-quand
-quando
-quantiti
-quantiti
-quar
-quarrel
-quarrel
-quarrel
-quarrel
-quarrel
-quarrel
-quarrelsom
-quarri
-quarri
-quart
-quarter
-quarter
-quarter
-quarter
-quart
-quasi
-quat
-quatch
-quai
-que
-quean
-quea
-queasi
-queasi
-queen
-queen
-quell
-queller
-quench
-quench
-quench
-quenchless
-quern
-quest
-questant
-question
-question
-question
-question
-questionless
-question
-questrist
-quest
-queubu
-qui
-quick
-quicken
-quicken
-quicker
-quicklier
-quickli
-quick
-quicksand
-quicksand
-quicksilverr
-quid
-quidditi
-quiddit
-quier
-quiet
-quieter
-quietli
-quiet
-quietu
-quill
-quillet
-quill
-quilt
-quinapalu
-quinc
-quinc
-quintain
-quintess
-quintu
-quip
-quip
-quir
-quir
-quirk
-quirk
-qui
-quit
-quit
-quit
-quittanc
-quit
-quit
-quiver
-quiver
-quiver
-quo
-quod
-quoif
-quoint
-quoit
-quoit
-quondam
-quoniam
-quot
-quot
-quot
-quoth
-quotidian
-r
-rabbit
-rabbl
-rabblement
-race
-rack
-racker
-racket
-racket
-rack
-rack
-radianc
-radiant
-radish
-rafe
-raft
-rag
-rage
-rage
-rageth
-ragg
-rag
-ragged
-rage
-ragozin
-rag
-rah
-rail
-rail
-railer
-railest
-raileth
-rail
-rail
-raiment
-rain
-rainbow
-raineth
-rain
-rainold
-rain
-raini
-rai
-rais
-rais
-rais
-rais
-raisin
-rak
-rake
-raker
-rake
-ral
-rald
-ralph
-ram
-rambur
-ramm
-rampallian
-rampant
-ramp
-rampir
-ramp
-ram
-ramsei
-ramston
-ran
-ranc
-rancor
-rancor
-rancour
-random
-rang
-rang
-rang
-ranger
-rang
-rang
-rank
-ranker
-rankest
-rank
-rankl
-rankli
-rank
-rank
-ransack
-ransack
-ransom
-ransom
-ransom
-ransomless
-ransom
-rant
-rant
-rap
-rape
-rape
-rapier
-rapier
-rapin
-rap
-rapt
-raptur
-raptur
-rar
-rare
-rare
-rare
-rarer
-rarest
-rariti
-rariti
-rascal
-rascalliest
-rascal
-rascal
-rase
-rash
-rasher
-rashli
-rash
-rat
-ratcatch
-ratcliff
-rate
-rate
-rate
-rate
-rather
-ratherest
-ratifi
-ratifi
-ratifi
-rate
-ration
-ratolorum
-rat
-ratsban
-rattl
-rattl
-rattl
-ratur
-raught
-rav
-rave
-ravel
-raven
-raven
-raven
-raven
-ravenspurgh
-rave
-ravin
-rave
-ravish
-ravish
-ravish
-ravish
-ravish
-raw
-rawer
-rawli
-raw
-rai
-rai
-rai
-raz
-raze
-raze
-raze
-razeth
-raze
-razor
-razor
-razor
-razur
-re
-reach
-reach
-reacheth
-reach
-read
-reader
-readiest
-readili
-readi
-read
-readin
-read
-readi
-real
-realli
-realm
-realm
-reap
-reaper
-reap
-reap
-rear
-rear
-rearward
-reason
-reason
-reason
-reason
-reason
-reasonless
-reason
-reav
-rebat
-rebato
-rebeck
-rebel
-rebel
-rebel
-rebellion
-rebelli
-rebel
-rebound
-rebuk
-rebuk
-rebuk
-rebuk
-rebuk
-rebu
-recal
-recant
-recant
-recant
-recant
-receipt
-receipt
-receiv
-receiv
-receiv
-receiv
-receiv
-receivest
-receiveth
-receiv
-receptacl
-rechat
-reciproc
-reciproc
-recit
-recit
-reciterai
-reck
-reck
-reckless
-reckon
-reckon
-reckon
-reckon
-reck
-reclaim
-reclaim
-reclus
-recogniz
-recogniz
-recoil
-recoil
-recollect
-recomfort
-recomfortur
-recommend
-recommend
-recommend
-recompen
-recompens
-reconcil
-reconcil
-reconcil
-reconcil
-reconcil
-reconcil
-reconcili
-record
-record
-record
-record
-record
-record
-recount
-recount
-recount
-recount
-recount
-recours
-recov
-recov
-recover
-recov
-recoveri
-recov
-recoveri
-recreant
-recreant
-recreat
-recreat
-rectifi
-rector
-rectorship
-recur
-recur
-red
-redbreast
-redder
-reddest
-rede
-redeem
-redeem
-redeem
-redeem
-redeem
-redeliv
-redempt
-redim
-red
-redoubl
-redoubt
-redound
-redress
-redress
-redress
-reduc
-reechi
-reed
-reed
-reek
-reek
-reek
-reeki
-reel
-reeleth
-reel
-reel
-refel
-refer
-refer
-referr
-refer
-refigur
-refin
-refin
-reflect
-reflect
-reflect
-reflex
-reform
-reform
-reform
-refractori
-refrain
-refresh
-refresh
-reft
-reft
-refug
-refu
-refus
-refus
-refus
-refusest
-refus
-reg
-regal
-regalia
-regan
-regard
-regard
-regard
-regardfulli
-regard
-regard
-regener
-regent
-regentship
-regia
-regiment
-regiment
-regina
-region
-region
-regist
-regist
-regist
-regreet
-regreet
-regress
-reguerdon
-regular
-rehear
-rehears
-rehears
-reign
-reign
-reignier
-reign
-reign
-rein
-reinforc
-reinforc
-reinforc
-rein
-reiter
-reject
-reject
-rejoic
-rejoic
-rejoic
-rejoiceth
-rejoic
-rejoicingli
-rejoindur
-rejourn
-rel
-relaps
-relat
-relat
-relat
-relat
-rel
-relea
-releas
-releas
-releas
-relent
-relent
-relent
-relianc
-relic
-relief
-reliev
-reliev
-reliev
-reliev
-reliev
-religion
-religion
-religi
-religi
-relinquish
-reliqu
-reliquit
-relish
-relum
-reli
-reli
-remain
-remaind
-remaind
-remain
-remaineth
-remain
-remain
-remark
-remark
-remedi
-remedi
-remedi
-remedi
-rememb
-rememb
-rememb
-rememb
-remembr
-remembranc
-remembr
-remercimen
-remiss
-remiss
-remiss
-remit
-remnant
-remnant
-remonstr
-remors
-remors
-remorseless
-remot
-remot
-remov
-remov
-remov
-removed
-remov
-remov
-remov
-remuner
-remuner
-renc
-rend
-render
-render
-render
-rendezv
-renegado
-reneg
-reneg
-renew
-renew
-renewest
-renounc
-renounc
-renounc
-renowm
-renown
-renown
-rent
-rent
-repaid
-repair
-repair
-repair
-repair
-repass
-repast
-repastur
-repai
-repai
-repai
-repeal
-repeal
-repeal
-repeat
-repeat
-repeat
-repeat
-repel
-repent
-repent
-repent
-repent
-repent
-repent
-repetit
-repetit
-repin
-repin
-repin
-replant
-replenish
-replenish
-replet
-replic
-repli
-repli
-repliest
-repli
-repli
-report
-report
-report
-reportest
-report
-reportingli
-report
-repos
-repos
-reposeth
-repos
-repossess
-reprehend
-reprehend
-reprehend
-repres
-repres
-repriev
-repriev
-repris
-reproach
-reproach
-reproach
-reproachfulli
-reprob
-reprob
-reproof
-reprov
-reprov
-reprov
-reprov
-reprov
-repugn
-repugn
-repugn
-repuls
-repuls
-repurcha
-repur
-reput
-reput
-reput
-reputeless
-reput
-reput
-request
-request
-request
-request
-requiem
-requir
-requir
-requir
-requir
-requireth
-requir
-requisit
-requisit
-requit
-requit
-requit
-requit
-requit
-rer
-rere
-rer
-rescu
-rescu
-rescu
-rescu
-rescu
-resembl
-resembl
-resembl
-resembl
-resembleth
-resembl
-reserv
-reserv
-reserv
-reserv
-reserv
-resid
-resid
-resid
-resid
-resid
-residu
-resign
-resign
-resist
-resist
-resist
-resist
-resist
-resolut
-resolut
-resolut
-resolut
-resolv
-resolv
-resolv
-resolvedli
-resolv
-resolveth
-resort
-resort
-resound
-resound
-respeak
-respect
-respect
-respect
-respect
-respect
-respect
-respic
-respit
-respit
-respons
-respos
-ress
-rest
-rest
-resteth
-rest
-rest
-restitut
-restless
-restor
-restor
-restor
-restor
-restor
-restor
-restor
-restrain
-restrain
-restrain
-restrain
-restraint
-rest
-resti
-resum
-resum
-resum
-resurrect
-retail
-retail
-retain
-retain
-retain
-retel
-retent
-retent
-retinu
-retir
-retir
-retir
-retir
-retir
-retir
-retold
-retort
-retort
-retourn
-retract
-retreat
-retrograd
-ret
-return
-return
-returnest
-returneth
-return
-return
-revania
-reveal
-reveal
-revel
-revel
-revel
-revel
-revel
-revel
-revelri
-revel
-reveng
-reveng
-reveng
-reveng
-reveng
-reveng
-reveng
-reveng
-reveng
-revengingli
-revenu
-revenu
-reverb
-reverber
-reverb
-reverenc
-rever
-reverend
-rever
-rever
-rever
-revers
-revers
-revert
-review
-reviewest
-revil
-revil
-revisit
-reviv
-reviv
-reviv
-reviv
-revok
-revok
-revok
-revolt
-revolt
-revolt
-revolt
-revolut
-revolut
-revolv
-revolv
-reward
-reward
-reward
-reward
-reward
-reword
-reword
-rex
-rei
-reynaldo
-rford
-rful
-rfull
-rhapsodi
-rheim
-rhenish
-rhesu
-rhetor
-rheum
-rheumat
-rheum
-rheumi
-rhinocero
-rhode
-rhodop
-rhubarb
-rhym
-rhyme
-rhymer
-rhyme
-rhyme
-rialto
-rib
-ribald
-riband
-riband
-ribaudr
-ribb
-rib
-ribbon
-ribbon
-rib
-rice
-rich
-richard
-richer
-rich
-richest
-richli
-richmond
-richmond
-rid
-riddanc
-ridden
-riddl
-riddl
-riddl
-ride
-rider
-rider
-ride
-ridest
-rideth
-ridg
-ridg
-ridicul
-ride
-rid
-rien
-ri
-rifl
-rift
-rift
-rig
-rigg
-riggish
-right
-righteou
-righteous
-right
-rightfulli
-rightli
-right
-rigol
-rigor
-rigor
-rigour
-ril
-rim
-rin
-rinaldo
-rind
-ring
-ring
-ringlead
-ringlet
-ring
-ringwood
-riot
-rioter
-riot
-riotou
-riot
-rip
-ripe
-ripe
-ripen
-ripen
-ripe
-ripen
-ripen
-riper
-ripest
-ripe
-ripp
-rip
-rise
-risen
-rise
-riseth
-rish
-rise
-rite
-rite
-rivag
-rival
-rival
-rival
-rival
-rive
-rive
-rivel
-river
-river
-rivet
-rivet
-rivet
-rivo
-rj
-rless
-road
-road
-roam
-roam
-roan
-roar
-roar
-roarer
-roar
-roar
-roast
-roast
-rob
-roba
-roba
-robb
-rob
-robber
-robber
-robberi
-rob
-robe
-robe
-robert
-robe
-robin
-rob
-robusti
-rochest
-rochford
-rock
-rock
-rocki
-rod
-rode
-roderigo
-rod
-roe
-roe
-roger
-rogero
-rogu
-rogueri
-rogu
-roguish
-roi
-roist
-roll
-roll
-roll
-roll
-rom
-romag
-roman
-romano
-romano
-roman
-rome
-romeo
-romish
-rondur
-ronyon
-rood
-roof
-roof
-rook
-rook
-rooki
-room
-room
-root
-root
-rootedli
-rooteth
-root
-root
-rope
-roperi
-rope
-rope
-ro
-rosalind
-rosalinda
-rosalind
-rosalin
-rosciu
-rose
-rose
-rosemari
-rosencrantz
-rose
-ross
-rosi
-rot
-rote
-rote
-rother
-rotherham
-rot
-rot
-rotten
-rotten
-rot
-rotund
-rouen
-rough
-rougher
-roughest
-roughli
-rough
-round
-round
-roundel
-rounder
-roundest
-round
-roundli
-round
-roundur
-rou
-rous
-rous
-rousillon
-rousli
-roussi
-rout
-rout
-rout
-rove
-rover
-row
-rowel
-rowland
-rowland
-roi
-royal
-royal
-royal
-royalti
-royalti
-roynish
-rs
-rt
-rub
-rubb
-rub
-rubbish
-rubi
-rubiou
-rub
-rubi
-rud
-rudand
-rudder
-ruddi
-ruddock
-ruddi
-rude
-rude
-rude
-ruder
-rudesbi
-rudest
-rudiment
-rue
-ru
-ruff
-ruffian
-ruffian
-ruffl
-ruffl
-ruff
-rug
-rugbi
-rugemount
-rug
-ruin
-ruinat
-ruin
-ruin
-ruinou
-ruin
-rul
-rule
-rule
-ruler
-ruler
-rule
-rule
-rumbl
-ruminai
-ruminat
-rumin
-rumin
-rumin
-rumin
-rumor
-rumour
-rumour
-rumour
-rump
-run
-runag
-runag
-runawai
-runawai
-rung
-runn
-runner
-runner
-run
-run
-ruptur
-ruptur
-rural
-rush
-rush
-rush
-rushl
-rushi
-russet
-russia
-russian
-russian
-rust
-rust
-rustic
-rustic
-rustic
-rustl
-rustl
-rust
-rusti
-rut
-ruth
-ruth
-ruthless
-rutland
-ruttish
-ry
-rye
-ryth
-s
-sa
-saba
-sabbath
-sabl
-sabl
-sack
-sackbut
-sackcloth
-sack
-sackerson
-sack
-sacrament
-sacr
-sacrif
-sacrific
-sacrific
-sacrific
-sacrifici
-sacrif
-sacrilegi
-sacr
-sad
-sadder
-saddest
-saddl
-saddler
-saddl
-sadli
-sad
-saf
-safe
-safeguard
-safe
-safer
-safest
-safeti
-safeti
-saffron
-sag
-sage
-sagittari
-said
-saidst
-sail
-sail
-sailmak
-sailor
-sailor
-sail
-sain
-saint
-saint
-saintlik
-saint
-saith
-sake
-sake
-sala
-salad
-salamand
-salari
-sale
-salerio
-salicam
-saliqu
-salisburi
-sall
-sallet
-sallet
-salli
-sallow
-salli
-salmon
-salmon
-salt
-salter
-saltier
-salt
-saltpetr
-salut
-salut
-salut
-salut
-salut
-saluteth
-salv
-salvat
-salv
-salv
-same
-samingo
-samp
-sampir
-sampl
-sampler
-sampson
-samson
-samson
-sancta
-sanctifi
-sanctifi
-sanctifi
-sanctimoni
-sanctimoni
-sanctimoni
-sanctiti
-sanctiti
-sanctuar
-sanctuari
-sand
-sandal
-sandbag
-sand
-sand
-sandi
-sandi
-sang
-sanguin
-sangui
-saniti
-san
-santrail
-sap
-sapient
-sapit
-sapless
-sapl
-sapphir
-sapphir
-saracen
-sarcenet
-sard
-sardian
-sardinia
-sardi
-sarum
-sat
-satan
-satchel
-sate
-sate
-satiat
-satieti
-satin
-satir
-satir
-sati
-satisfact
-satisfi
-satisfi
-satisfi
-satisfi
-saturdai
-saturdai
-saturn
-saturnin
-saturninu
-satyr
-satyr
-sauc
-sauc
-sauc
-saucer
-sauc
-saucili
-sauci
-sauci
-sauf
-saunder
-sav
-savag
-savag
-savag
-savageri
-savag
-save
-save
-save
-save
-saviour
-savori
-savour
-savour
-savour
-savouri
-savoi
-saw
-saw
-sawest
-sawn
-sawpit
-saw
-sawyer
-saxon
-saxoni
-saxton
-sai
-sayest
-sai
-sai
-sai
-sayst
-sblood
-sc
-scab
-scabbard
-scab
-scaffold
-scaffoldag
-scal
-scald
-scald
-scald
-scale
-scale
-scale
-scale
-scall
-scalp
-scalp
-scali
-scambl
-scambl
-scamel
-scan
-scandal
-scandaliz
-scandal
-scandi
-scann
-scant
-scant
-scanter
-scant
-scantl
-scant
-scap
-scape
-scape
-scape
-scapeth
-scar
-scarc
-scarc
-scarciti
-scare
-scarecrow
-scarecrow
-scarf
-scarf
-scarf
-scare
-scarlet
-scarr
-scarr
-scar
-scaru
-scath
-scath
-scath
-scatt
-scatter
-scatter
-scatter
-scatter
-scelera
-scelerisqu
-scene
-scene
-scent
-scent
-scept
-scepter
-sceptr
-sceptr
-sceptr
-schedul
-schedul
-scholar
-scholarli
-scholar
-school
-schoolboi
-schoolboi
-schoolfellow
-school
-schoolmast
-schoolmast
-school
-sciatica
-sciatica
-scienc
-scienc
-scimitar
-scion
-scion
-scissor
-scoff
-scoffer
-scof
-scoff
-scoggin
-scold
-scold
-scold
-sconc
-scone
-scope
-scope
-scorch
-scorch
-score
-score
-score
-score
-scorn
-scorn
-scorn
-scornfulli
-scorn
-scorn
-scorpion
-scorpion
-scot
-scotch
-scotch
-scotland
-scot
-scottish
-scoundrel
-scour
-scour
-scourg
-scourg
-scour
-scout
-scout
-scowl
-scrap
-scrape
-scrape
-scrap
-scratch
-scratch
-scratch
-scream
-scream
-screech
-screech
-screen
-screen
-screw
-screw
-scribbl
-scribbl
-scribe
-scribe
-scrimer
-scrip
-scrippag
-scriptur
-scriptur
-scriven
-scroll
-scroll
-scroop
-scrowl
-scroyl
-scrub
-scrupl
-scrupl
-scrupul
-scuffl
-scuffl
-scullion
-scull
-scum
-scurril
-scurril
-scurril
-scurvi
-scuse
-scut
-scutcheon
-scutcheon
-scylla
-scyth
-scyth
-scythia
-scythian
-sdeath
-se
-sea
-seacoal
-seafar
-seal
-seal
-seal
-seal
-seam
-seamen
-seami
-seaport
-sear
-searc
-search
-searcher
-search
-searcheth
-search
-sear
-sea
-seasick
-seasid
-season
-season
-season
-seat
-seat
-seat
-sebastian
-second
-secondarili
-secondari
-second
-second
-secreci
-secret
-secretari
-secretari
-secretli
-secret
-sect
-sectari
-sect
-secundo
-secur
-secur
-secur
-secur
-sedg
-sedg
-sedg
-sedgi
-sedit
-sediti
-seduc
-seduc
-seduc
-seduc
-seduc
-see
-seed
-seed
-seed
-seed
-seedsman
-seein
-see
-seek
-seek
-seek
-seel
-seel
-seeli
-seem
-seem
-seemer
-seemest
-seemeth
-seem
-seemingli
-seemli
-seem
-seen
-seer
-see
-sees
-seest
-seeth
-seeth
-seeth
-seet
-segreg
-seigneur
-seigneur
-seiz
-seiz
-seiz
-seiz
-seizeth
-seiz
-seizur
-seld
-seldom
-select
-seleucu
-self
-selfsam
-sell
-seller
-sell
-sell
-selv
-semblabl
-semblabl
-semblanc
-semblanc
-sembl
-semi
-semicircl
-semirami
-semper
-semproniu
-senat
-senat
-senat
-send
-sender
-sendeth
-send
-send
-seneca
-senior
-seniori
-seni
-sennet
-senoi
-sens
-senseless
-sens
-sensibl
-sensibl
-sensual
-sensual
-sent
-sentenc
-sentenc
-sentenc
-sententi
-sentinel
-sentinel
-separ
-separ
-separ
-separ
-separ
-septentrion
-sepulchr
-sepulchr
-sepulchr
-sequel
-sequenc
-sequent
-sequest
-sequest
-sequestr
-sere
-sereni
-serg
-sergeant
-seriou
-serious
-sermon
-sermon
-serpent
-serpentin
-serpent
-serpigo
-serv
-servant
-servant
-servant
-serv
-serv
-server
-serv
-serveth
-servic
-servic
-servic
-servil
-servil
-serviliu
-serv
-servingman
-servingmen
-serviteur
-servitor
-servitor
-servitud
-sessa
-session
-session
-sesto
-set
-setebo
-set
-setter
-set
-settl
-settl
-settlest
-settl
-sev
-seven
-sevenfold
-sevennight
-seventeen
-seventh
-seventi
-sever
-sever
-sever
-sever
-sever
-sever
-sever
-severest
-sever
-sever
-severn
-sever
-sew
-seward
-sewer
-sew
-sex
-sex
-sexton
-sextu
-seymour
-seyton
-sfoot
-sh
-shackl
-shackl
-shade
-shade
-shadow
-shadow
-shadow
-shadow
-shadowi
-shadi
-shafalu
-shaft
-shaft
-shag
-shak
-shake
-shake
-shaken
-shake
-shake
-shale
-shall
-shalleng
-shallow
-shallowest
-shallowli
-shallow
-shalt
-sham
-shambl
-shame
-shame
-shame
-shamefulli
-shameless
-shame
-shamest
-shame
-shank
-shank
-shap
-shape
-shape
-shapeless
-shapen
-shape
-shape
-shar
-shard
-shard
-shard
-share
-share
-sharer
-share
-share
-shark
-sharp
-sharpen
-sharpen
-sharpen
-sharper
-sharpest
-sharpli
-sharp
-sharp
-shatter
-shav
-shave
-shaven
-shaw
-she
-sheaf
-sheal
-shear
-shearer
-shear
-shearman
-shear
-sheath
-sheath
-sheath
-sheath
-sheath
-sheav
-sheav
-shed
-shed
-shed
-sheen
-sheep
-sheepcot
-sheepcot
-sheep
-sheepskin
-sheer
-sheet
-sheet
-sheet
-sheffield
-shelf
-shell
-shell
-shelt
-shelter
-shelter
-shelv
-shelv
-shelvi
-shent
-shepherd
-shepherd
-shepherdess
-shepherdess
-shepherd
-sher
-sheriff
-sherri
-she
-sheweth
-shield
-shield
-shield
-shift
-shift
-shift
-shift
-shill
-shill
-shin
-shine
-shine
-shineth
-shine
-shin
-shini
-ship
-shipboard
-shipman
-shipmast
-shipmen
-shipp
-ship
-ship
-ship
-shipt
-shipwreck
-shipwreck
-shipwright
-shipwright
-shire
-shirlei
-shirt
-shirt
-shive
-shiver
-shiver
-shiver
-shoal
-shoal
-shock
-shock
-shod
-shoe
-shoe
-shoemak
-shoe
-shog
-shone
-shook
-shoon
-shoot
-shooter
-shooti
-shoot
-shoot
-shop
-shop
-shore
-shore
-shorn
-short
-shortcak
-shorten
-shorten
-shorten
-shorter
-shortli
-short
-shot
-shotten
-shough
-should
-shoulder
-shoulder
-shoulder
-shouldst
-shout
-shout
-shout
-shout
-shov
-shove
-shovel
-shovel
-show
-show
-shower
-shower
-showest
-show
-shown
-show
-shred
-shrew
-shrewd
-shrewdli
-shrewd
-shrewish
-shrewishli
-shrewish
-shrew
-shrewsburi
-shriek
-shriek
-shriek
-shriev
-shrift
-shrill
-shriller
-shrill
-shrilli
-shrimp
-shrine
-shrink
-shrink
-shrink
-shriv
-shrive
-shriver
-shrive
-shrive
-shroud
-shroud
-shroud
-shroud
-shrove
-shrow
-shrow
-shrub
-shrub
-shrug
-shrug
-shrunk
-shudd
-shudder
-shuffl
-shuffl
-shuffl
-shuffl
-shun
-shunless
-shunn
-shun
-shun
-shun
-shut
-shut
-shuttl
-shy
-shylock
-si
-sibyl
-sibylla
-sibyl
-sicil
-sicilia
-sicilian
-siciliu
-sicil
-sicili
-siciniu
-sick
-sicken
-sicken
-sicker
-sickl
-sicklemen
-sickli
-sickli
-sickli
-sick
-sicl
-sicyon
-side
-side
-side
-sieg
-sieg
-sienna
-si
-siev
-sift
-sift
-sigeia
-sigh
-sigh
-sigh
-sigh
-sight
-sight
-sightless
-sightli
-sight
-sign
-signal
-signet
-signieur
-signific
-signific
-signifi
-signifi
-signifi
-signifi
-signior
-signiori
-signior
-signiori
-signor
-signori
-sign
-signum
-silenc
-silenc
-silenc
-silenc
-silent
-silent
-siliu
-silk
-silken
-silkman
-silk
-silliest
-silli
-sill
-silli
-silva
-silver
-silver
-silverli
-silvia
-silviu
-sima
-simil
-simil
-simoi
-simon
-simoni
-simp
-simpcox
-simpl
-simpl
-simpler
-simpl
-simplic
-simpli
-simular
-simul
-sin
-sinc
-sincer
-sincer
-sincer
-sinel
-sinew
-sinew
-sinew
-sinewi
-sin
-sinfulli
-sing
-sing
-sing
-singer
-sing
-singeth
-sing
-singl
-singl
-singl
-singli
-sing
-singular
-singularit
-singular
-singular
-singul
-sinist
-sink
-sink
-sink
-sinn
-sinner
-sinner
-sin
-sinon
-sin
-sip
-sip
-sir
-sire
-siren
-sirrah
-sir
-sist
-sister
-sisterhood
-sisterli
-sister
-sit
-sith
-sithenc
-sit
-sit
-situat
-situat
-situat
-siward
-six
-sixpenc
-sixpenc
-sixpenni
-sixteen
-sixth
-sixti
-siz
-size
-size
-sizzl
-skain
-skambl
-skein
-skelter
-ski
-skil
-skilfulli
-skill
-skilless
-skillet
-skill
-skill
-skim
-skimbl
-skin
-skinker
-skinni
-skin
-skip
-skipp
-skipper
-skip
-skirmish
-skirmish
-skirr
-skirt
-skirt
-skittish
-skulk
-skull
-skull
-sky
-skyei
-skyish
-slab
-slack
-slackli
-slack
-slain
-slake
-sland
-slander
-slander
-slander
-slander
-slander
-slander
-slander
-slash
-slaught
-slaughter
-slaughter
-slaughter
-slaughterman
-slaughtermen
-slaughter
-slaughter
-slave
-slaver
-slaveri
-slave
-slavish
-slai
-slayeth
-slai
-slai
-sleav
-sled
-sleek
-sleekli
-sleep
-sleeper
-sleeper
-sleepest
-sleep
-sleep
-sleepi
-sleev
-sleev
-sleid
-sleid
-sleight
-sleight
-slender
-slender
-slenderli
-slept
-slew
-slewest
-slice
-slid
-slide
-slide
-slide
-slight
-slight
-slightest
-slightli
-slight
-slight
-slili
-slime
-slimi
-sling
-slink
-slip
-slipp
-slipper
-slipper
-slipperi
-slip
-slish
-slit
-sliver
-slobb
-slomber
-slop
-slope
-slop
-sloth
-sloth
-slough
-slovenli
-slovenri
-slow
-slower
-slowli
-slow
-slubber
-slug
-sluggard
-sluggardiz
-sluggish
-sluic
-slumb
-slumber
-slumber
-slumberi
-slunk
-slut
-slut
-slutteri
-sluttish
-sluttish
-sly
-sly
-smack
-smack
-smack
-small
-smaller
-smallest
-small
-smalu
-smart
-smart
-smartli
-smatch
-smatter
-smear
-smell
-smell
-smell
-smelt
-smil
-smile
-smile
-smile
-smilest
-smilet
-smile
-smilingli
-smirch
-smirch
-smit
-smite
-smite
-smith
-smithfield
-smock
-smock
-smok
-smoke
-smoke
-smoke
-smoke
-smoki
-smooth
-smooth
-smooth
-smoothli
-smooth
-smooth
-smote
-smoth
-smother
-smother
-smother
-smug
-smulkin
-smutch
-snaffl
-snail
-snail
-snake
-snake
-snaki
-snap
-snapp
-snapper
-snar
-snare
-snare
-snarl
-snarleth
-snarl
-snatch
-snatcher
-snatch
-snatch
-sneak
-sneak
-sneap
-sneap
-sneck
-snip
-snipe
-snipt
-snore
-snore
-snore
-snort
-snout
-snow
-snowbal
-snow
-snowi
-snuff
-snuff
-snug
-so
-soak
-soak
-soak
-soar
-soar
-soar
-sob
-sob
-sober
-soberli
-sobrieti
-sob
-sociabl
-societi
-societi
-sock
-socrat
-sod
-sodden
-soe
-soever
-soft
-soften
-soften
-softer
-softest
-softli
-soft
-soil
-soil
-soilur
-soit
-sojourn
-sol
-sola
-solac
-solanio
-sold
-soldat
-solder
-soldest
-soldier
-soldier
-soldiership
-sole
-sole
-solem
-solemn
-solem
-solemn
-solemn
-solemniz
-solemn
-solemn
-solemnli
-sole
-solicit
-solicit
-solicit
-solicit
-solicit
-solicitor
-solicit
-solid
-solidar
-solid
-solinu
-solitari
-solomon
-solon
-solum
-solu
-solyman
-some
-somebodi
-someon
-somerset
-somervil
-someth
-sometim
-sometim
-somev
-somewhat
-somewher
-somewhith
-somm
-son
-sonanc
-song
-song
-sonnet
-sonnet
-sonnet
-son
-sont
-sonti
-soon
-sooner
-soonest
-sooth
-sooth
-soother
-sooth
-soothsai
-soothsay
-sooti
-sop
-sophist
-sophist
-sophi
-sop
-sorcer
-sorcer
-sorceress
-sorceri
-sorceri
-sore
-sorel
-sore
-sorer
-sore
-sorrier
-sorriest
-sorrow
-sorrow
-sorrowest
-sorrow
-sorrow
-sorrow
-sorri
-sort
-sortanc
-sort
-sort
-sort
-sossiu
-sot
-soto
-sot
-sottish
-soud
-sought
-soul
-sould
-soulless
-soul
-sound
-sound
-sounder
-soundest
-sound
-soundless
-soundli
-sound
-soundpost
-sound
-sour
-sourc
-sourc
-sourest
-sourli
-sour
-sou
-sous
-south
-southam
-southampton
-southerli
-southern
-southward
-southwark
-southwel
-souviendrai
-sov
-sovereign
-sovereignest
-sovereignli
-sovereignti
-sovereignvour
-sow
-sow
-sowl
-sowter
-space
-space
-spaciou
-spade
-spade
-spain
-spak
-spake
-spakest
-span
-spangl
-spangl
-spaniard
-spaniel
-spaniel
-spanish
-spann
-span
-spar
-spare
-spare
-spare
-sparingli
-spark
-sparkl
-sparkl
-sparkl
-spark
-sparrow
-sparrow
-sparta
-spartan
-spavin
-spavin
-spawn
-speak
-speaker
-speaker
-speakest
-speaketh
-speak
-speak
-spear
-speargrass
-spear
-special
-special
-special
-specialti
-specialti
-specifi
-specious
-spectacl
-spectacl
-spectacl
-spectat
-spectatorship
-specul
-specul
-specul
-sped
-speech
-speech
-speechless
-speed
-speed
-speedier
-speediest
-speedili
-speedi
-speed
-speed
-speedi
-speen
-spell
-spell
-spell
-spelt
-spencer
-spend
-spendest
-spend
-spend
-spendthrift
-spent
-sperato
-sperm
-spero
-sperr
-spher
-sphere
-sphere
-sphere
-spheric
-spheri
-sphinx
-spice
-spice
-spiceri
-spice
-spider
-spider
-spi
-spi
-spieth
-spightfulli
-spigot
-spill
-spill
-spill
-spilt
-spilth
-spin
-spinii
-spinner
-spinster
-spinster
-spire
-spirit
-spirit
-spiritless
-spirit
-spiritu
-spiritualti
-spirt
-spit
-spital
-spite
-spite
-spite
-spite
-spit
-spit
-spit
-splai
-spleen
-spleen
-spleen
-spleeni
-splendour
-splenit
-splinter
-splinter
-split
-split
-split
-split
-spoil
-spoil
-spok
-spoke
-spoken
-spoke
-spokesman
-spong
-spongi
-spoon
-spoon
-sport
-sport
-sport
-sportiv
-sport
-spot
-spotless
-spot
-spot
-spousal
-spous
-spout
-spout
-spout
-sprag
-sprang
-sprat
-sprawl
-sprai
-sprai
-spread
-spread
-spread
-spright
-spright
-sprightli
-sprig
-spring
-spring
-spring
-springeth
-springhalt
-spring
-spring
-springtim
-sprinkl
-sprinkl
-sprite
-sprite
-sprite
-sprite
-sprite
-sprout
-spruce
-sprung
-spun
-spur
-spurio
-spurn
-spurn
-spurr
-spurrer
-spur
-spur
-spy
-spy
-squabbl
-squadron
-squadron
-squand
-squar
-squar
-squarer
-squar
-squash
-squeak
-squeak
-squeal
-squeal
-squeez
-squeez
-squel
-squier
-squint
-squini
-squir
-squir
-squirrel
-st
-stab
-stabb
-stab
-stab
-stabl
-stabl
-stabl
-stablish
-stablish
-stab
-stack
-staff
-stafford
-stafford
-staffordshir
-stag
-stage
-stage
-stagger
-stagger
-stagger
-stag
-staid
-staider
-stain
-stain
-stain
-staineth
-stain
-stainless
-stain
-stair
-stair
-stake
-stake
-stale
-stale
-stalk
-stalk
-stalk
-stall
-stall
-stall
-stamford
-stammer
-stamp
-stamp
-stamp
-stanch
-stanchless
-stand
-standard
-standard
-stander
-stander
-standest
-standeth
-stand
-stand
-staniel
-stanlei
-stanz
-stanzo
-stanzo
-stapl
-stapl
-star
-stare
-stare
-stare
-stare
-stare
-stark
-starkli
-starlight
-starl
-starr
-starri
-star
-start
-start
-start
-startingli
-startl
-startl
-start
-starv
-starv
-starv
-starvelackei
-starvel
-starveth
-starv
-state
-stateli
-state
-state
-statesman
-statesmen
-statiliu
-station
-statist
-statist
-statu
-statu
-statur
-statur
-statut
-statut
-stave
-stave
-stai
-stai
-stayest
-stai
-stai
-stead
-stead
-steadfast
-steadier
-stead
-steal
-stealer
-stealer
-steal
-steal
-stealth
-stealthi
-steed
-steed
-steel
-steel
-steeli
-steep
-steep
-steepl
-steepl
-steep
-steepi
-steer
-steerag
-steer
-steer
-stell
-stem
-stem
-stench
-step
-stepdam
-stephano
-stephen
-stepmoth
-stepp
-step
-step
-steril
-steril
-sterl
-stern
-sternag
-sterner
-sternest
-stern
-steterat
-stew
-steward
-steward
-stewardship
-stew
-stew
-stick
-stick
-stickler
-stick
-stiff
-stiffen
-stiffli
-stifl
-stifl
-stifl
-stigmat
-stigmat
-stile
-still
-stiller
-stillest
-still
-stilli
-sting
-sting
-stingless
-sting
-stink
-stink
-stinkingli
-stink
-stint
-stint
-stint
-stir
-stirr
-stir
-stirrer
-stirrer
-stirreth
-stir
-stirrup
-stirrup
-stir
-stitcheri
-stitch
-stithi
-stithi
-stoccado
-stoccata
-stock
-stockfish
-stock
-stock
-stockish
-stock
-stog
-stog
-stoic
-stokesli
-stol
-stole
-stolen
-stolest
-stomach
-stomach
-stomach
-stomach
-ston
-stone
-stonecutt
-stone
-stonish
-stoni
-stood
-stool
-stool
-stoop
-stoop
-stoop
-stop
-stope
-stopp
-stop
-stop
-stop
-stor
-store
-storehous
-storehous
-store
-stori
-storm
-storm
-storm
-storm
-stormi
-stori
-stoup
-stoup
-stout
-stouter
-stoutli
-stout
-stover
-stow
-stowag
-stow
-strachi
-straggler
-straggl
-straight
-straightest
-straightwai
-strain
-strain
-strain
-strain
-strait
-strait
-straiter
-straitli
-strait
-strait
-strand
-strang
-strang
-strang
-stranger
-stranger
-strangest
-strangl
-strangl
-strangler
-strangl
-strangl
-strappado
-strap
-stratagem
-stratagem
-stratford
-strato
-straw
-strawberri
-strawberri
-straw
-strawi
-strai
-strai
-strai
-streak
-streak
-stream
-streamer
-stream
-stream
-strech
-street
-street
-strength
-strengthen
-strengthen
-strengthless
-strength
-stretch
-stretch
-stretch
-stretch
-strew
-strew
-strew
-strewment
-stricken
-strict
-stricter
-strictest
-strictli
-strictur
-stride
-stride
-stride
-strife
-strife
-strik
-strike
-striker
-strike
-strikest
-strike
-string
-stringless
-string
-strip
-stripe
-stripl
-stripl
-stripp
-strip
-striv
-strive
-strive
-strive
-strok
-stroke
-stroke
-strond
-strond
-strong
-stronger
-strongest
-strongli
-strook
-strosser
-strove
-strown
-stroi
-struck
-strucken
-struggl
-struggl
-struggl
-strumpet
-strumpet
-strumpet
-strung
-strut
-strut
-strut
-strut
-stubbl
-stubborn
-stubbornest
-stubbornli
-stubborn
-stuck
-stud
-student
-student
-studi
-studi
-studiou
-studious
-stud
-studi
-studi
-stuff
-stuf
-stuff
-stumbl
-stumbl
-stumblest
-stumbl
-stump
-stump
-stung
-stupefi
-stupid
-stupifi
-stuprum
-sturdi
-sty
-styga
-stygian
-styl
-style
-styx
-su
-sub
-subcontract
-subdu
-subdu
-subdu
-subduement
-subdu
-subdu
-subject
-subject
-subject
-subject
-submerg
-submiss
-submiss
-submit
-submit
-submit
-suborn
-suborn
-suborn
-subscrib
-subscrib
-subscrib
-subscrib
-subscript
-subsequ
-subsidi
-subsidi
-subsist
-subsist
-substanc
-substanc
-substanti
-substitut
-substitut
-substitut
-substitut
-subtil
-subtilli
-subtl
-subtleti
-subtleti
-subtli
-subtractor
-suburb
-subvers
-subvert
-succed
-succe
-succeed
-succeed
-succeed
-succe
-success
-successantli
-success
-success
-successfulli
-success
-success
-success
-successor
-successor
-succour
-succour
-such
-suck
-sucker
-sucker
-suck
-suckl
-suck
-sudden
-suddenli
-sue
-su
-suerli
-sue
-sueth
-suff
-suffer
-suffer
-suffer
-suffer
-suffer
-suffer
-suffic
-suffic
-suffic
-suffic
-sufficeth
-suffici
-suffici
-suffici
-suffic
-sufficit
-suffig
-suffoc
-suffoc
-suffoc
-suffolk
-suffrag
-suffrag
-sug
-sugar
-sugarsop
-suggest
-suggest
-suggest
-suggest
-suggest
-suggest
-sui
-suit
-suitabl
-suit
-suit
-suitor
-suitor
-suit
-suivez
-sullen
-sullen
-sulli
-sulli
-sulli
-sulph
-sulpher
-sulphur
-sulphur
-sultan
-sultri
-sum
-sumless
-summ
-summa
-summari
-summer
-summer
-summit
-summon
-summon
-summon
-sumpter
-sumptuou
-sumptuous
-sum
-sun
-sunbeam
-sunburn
-sunburnt
-sund
-sundai
-sundai
-sunder
-sunder
-sundri
-sung
-sunk
-sunken
-sunni
-sunris
-sun
-sunset
-sunshin
-sup
-super
-superfici
-superfici
-superflu
-superflu
-superflu
-superflux
-superior
-supern
-supernatur
-superprais
-superscript
-superscript
-superservic
-superstit
-superstiti
-superstiti
-supersubtl
-supervis
-supervisor
-supp
-supper
-supper
-suppertim
-sup
-supplant
-suppl
-suppler
-supplianc
-suppliant
-suppliant
-supplic
-supplic
-supplic
-suppli
-suppli
-suppli
-suppliest
-suppli
-supplyant
-suppli
-supplyment
-support
-support
-support
-support
-support
-support
-support
-supportor
-suppo
-suppos
-suppos
-suppos
-suppos
-supposest
-suppos
-supposit
-suppress
-suppress
-suppresseth
-supremaci
-suprem
-sup
-sur
-suranc
-surceas
-surd
-sure
-surecard
-sure
-surer
-surest
-sureti
-sureti
-surfeit
-surfeit
-surfeit
-surfeit
-surfeit
-surg
-surgeon
-surgeon
-surger
-surgeri
-surg
-surli
-surmi
-surmis
-surmis
-surmis
-surmount
-surmount
-surmount
-surnam
-surnam
-surnam
-surpasseth
-surpass
-surplic
-surplu
-surpri
-surpris
-surpris
-surrend
-surrei
-surrei
-survei
-surveyest
-survei
-surveyor
-surveyor
-survei
-surviv
-surviv
-survivor
-susan
-suspect
-suspect
-suspect
-suspect
-suspend
-suspens
-suspicion
-suspicion
-suspici
-suspir
-suspir
-sust
-sustain
-sustain
-sutler
-sutton
-suum
-swabber
-swaddl
-swag
-swagg
-swagger
-swagger
-swagger
-swagger
-swain
-swain
-swallow
-swallow
-swallow
-swallow
-swam
-swan
-swan
-sward
-sware
-swarm
-swarm
-swart
-swarth
-swarth
-swarthi
-swasher
-swash
-swath
-swath
-swathl
-swai
-swai
-swai
-swear
-swearer
-swearer
-swearest
-swear
-swear
-swear
-sweat
-sweaten
-sweat
-sweat
-sweati
-sweep
-sweeper
-sweep
-sweet
-sweeten
-sweeten
-sweeter
-sweetest
-sweetheart
-sweet
-sweetli
-sweetmeat
-sweet
-sweet
-swell
-swell
-swell
-swell
-swelter
-sweno
-swept
-swerv
-swerver
-swerv
-swift
-swifter
-swiftest
-swiftli
-swift
-swill
-swill
-swim
-swimmer
-swimmer
-swim
-swim
-swine
-swineherd
-swing
-swing
-swinish
-swinstead
-switch
-swit
-switzer
-swol
-swoll
-swoln
-swoon
-swoon
-swoon
-swoon
-swoop
-swoopstak
-swor
-sword
-sworder
-sword
-swore
-sworn
-swound
-swound
-swum
-swung
-sy
-sycamor
-sycorax
-sylla
-syllabl
-syllabl
-syllog
-symbol
-sympathis
-sympathiz
-sympath
-sympath
-sympathi
-synagogu
-synod
-synod
-syracus
-syracusian
-syracusian
-syria
-syrup
-t
-ta
-taber
-tabl
-tabl
-tabl
-tablet
-tabor
-tabor
-tabor
-tabourin
-taciturn
-tack
-tackl
-tackl
-tackl
-tackl
-tackl
-taddl
-tadpol
-taffeta
-taffeti
-tag
-tagrag
-tah
-tail
-tailor
-tailor
-tail
-taint
-taint
-taint
-taint
-taintur
-tak
-take
-taken
-taker
-take
-takest
-taketh
-take
-tal
-talbot
-talbotit
-talbot
-tale
-talent
-talent
-taleport
-tale
-talk
-talk
-talker
-talker
-talkest
-talk
-talk
-tall
-taller
-tallest
-talli
-tallow
-talli
-talon
-tam
-tambourin
-tame
-tame
-tame
-tame
-tamer
-tame
-tame
-tamora
-tamworth
-tan
-tang
-tangl
-tangl
-tank
-tanl
-tann
-tan
-tanner
-tanquam
-tanta
-tantaen
-tap
-tape
-taper
-taper
-tapestri
-tapestri
-taphous
-tapp
-tapster
-tapster
-tar
-tardi
-tardili
-tardi
-tardi
-tarentum
-targ
-targ
-target
-target
-tarpeian
-tarquin
-tarquin
-tarr
-tarr
-tarrianc
-tarri
-tarri
-tarri
-tarri
-tart
-tartar
-tartar
-tartli
-tart
-task
-tasker
-task
-task
-tassel
-tast
-tast
-tast
-tast
-tatt
-tatter
-tatter
-tatter
-tattl
-tattl
-tattl
-taught
-taunt
-taunt
-taunt
-tauntingli
-taunt
-tauru
-tavern
-tavern
-tavi
-tawdri
-tawni
-tax
-taxat
-taxat
-tax
-tax
-tc
-te
-teach
-teacher
-teacher
-teach
-teachest
-teacheth
-teach
-team
-tear
-tear
-tear
-tear
-tearsheet
-teat
-tediou
-tedious
-tedious
-teem
-teem
-teem
-teen
-teeth
-teipsum
-telamon
-telamoniu
-tell
-teller
-tell
-tell
-tellu
-temp
-temper
-temper
-temper
-temper
-temper
-temper
-tempest
-tempest
-tempestu
-templ
-templ
-tempor
-temporari
-temporiz
-tempor
-tempor
-temp
-tempt
-temptat
-temptat
-tempt
-tempter
-tempter
-tempteth
-tempt
-tempt
-ten
-tenabl
-tenant
-tenantiu
-tenantless
-tenant
-tench
-tend
-tendanc
-tend
-tender
-tender
-tenderli
-tender
-tender
-tend
-tend
-tenedo
-tenement
-tenement
-tenfold
-tenni
-tenour
-tenour
-ten
-tent
-tent
-tenth
-tenth
-tent
-tenur
-tenur
-tercel
-tereu
-term
-termag
-term
-termin
-termless
-term
-terra
-terrac
-terram
-terra
-terr
-terren
-terrestri
-terribl
-terribl
-territori
-territori
-terror
-terror
-tertian
-tertio
-test
-testament
-test
-tester
-testern
-testifi
-testimoni
-testimoni
-testimoni
-testi
-testril
-testi
-tetchi
-tether
-tetter
-tevil
-tewksburi
-text
-tgv
-th
-thae
-thame
-than
-thane
-thane
-thank
-thank
-thank
-thankfulli
-thank
-thank
-thank
-thankless
-thank
-thanksgiv
-thaso
-that
-thatch
-thaw
-thaw
-thaw
-the
-theatr
-theban
-thebe
-thee
-theft
-theft
-thein
-their
-their
-theis
-them
-theme
-theme
-themselv
-then
-thenc
-thenceforth
-theoric
-there
-thereabout
-thereabout
-thereaft
-thereat
-therebi
-therefor
-therein
-thereof
-thereon
-thereto
-thereunto
-thereupon
-therewith
-therewith
-thersit
-these
-theseu
-thessalian
-thessali
-theti
-thew
-thei
-thick
-thicken
-thicken
-thicker
-thickest
-thicket
-thickskin
-thief
-thieveri
-thiev
-thievish
-thigh
-thigh
-thimbl
-thimbl
-thin
-thine
-thing
-thing
-think
-thinkest
-think
-think
-think
-thinkst
-thinli
-third
-thirdli
-third
-thirst
-thirst
-thirst
-thirsti
-thirteen
-thirti
-thirtieth
-thirti
-thi
-thisbi
-thisn
-thistl
-thistl
-thither
-thitherward
-thoa
-thoma
-thorn
-thorn
-thorni
-thorough
-thoroughli
-those
-thou
-though
-thought
-thought
-thought
-thousand
-thousand
-thracian
-thraldom
-thrall
-thrall
-thrall
-thrash
-thrason
-thread
-threadbar
-threaden
-thread
-threat
-threaten
-threaten
-threaten
-threatest
-threat
-three
-threefold
-threepenc
-threepil
-three
-threescor
-thresher
-threshold
-threw
-thrice
-thrift
-thriftless
-thrift
-thrifti
-thrill
-thrill
-thrill
-thrive
-thrive
-thriver
-thrive
-thrive
-throat
-throat
-throb
-throb
-throca
-throe
-throe
-thromuldo
-thron
-throne
-throne
-throne
-throng
-throng
-throng
-throstl
-throttl
-through
-throughfar
-throughfar
-throughli
-throughout
-throw
-thrower
-throwest
-throw
-thrown
-throw
-thrum
-thrumm
-thrush
-thrust
-thrusteth
-thrust
-thrust
-thumb
-thumb
-thump
-thund
-thunder
-thunderbolt
-thunderbolt
-thunder
-thunder
-thunderston
-thunderstrok
-thurio
-thursdai
-thu
-thwack
-thwart
-thwart
-thwart
-thwart
-thy
-thyme
-thymu
-thyreu
-thyself
-ti
-tib
-tiber
-tiberio
-tibei
-tice
-tick
-tickl
-tickl
-tickl
-tickl
-tickl
-ticklish
-tiddl
-tide
-tide
-tide
-tidi
-tie
-ti
-ti
-tiff
-tiger
-tiger
-tight
-tightli
-tike
-til
-tile
-till
-tillag
-tilli
-tilt
-tilter
-tilth
-tilt
-tilt
-tiltyard
-tim
-timandra
-timber
-time
-timeless
-timeli
-time
-time
-timon
-timor
-timor
-timor
-tinct
-tinctur
-tinctur
-tinder
-tingl
-tinker
-tinker
-tinsel
-tini
-tip
-tipp
-tippl
-tip
-tipsi
-tipto
-tir
-tire
-tire
-tire
-tirest
-tire
-tirra
-tirrit
-ti
-tish
-tisick
-tissu
-titan
-titania
-tith
-tith
-tith
-titiniu
-titl
-titl
-titleless
-titl
-tittl
-tittl
-titular
-titu
-tn
-to
-toad
-toad
-toadstool
-toast
-toast
-toast
-toast
-toaz
-tobi
-tock
-tod
-todai
-todpol
-tod
-toe
-toe
-tofor
-toge
-toge
-togeth
-toil
-toil
-toil
-toil
-token
-token
-told
-toledo
-toler
-toll
-toll
-tom
-tomb
-tomb
-tomb
-tombless
-tomboi
-tomb
-tomorrow
-tomyri
-ton
-tong
-tongu
-tongu
-tongu
-tongueless
-tongu
-tonight
-too
-took
-tool
-tool
-tooth
-toothach
-toothpick
-toothpick
-top
-topa
-top
-topgal
-topless
-topmast
-topp
-top
-toppl
-toppl
-top
-topsail
-topsi
-torch
-torchbear
-torchbear
-torcher
-torch
-torchlight
-tore
-torment
-tormenta
-torment
-torment
-torment
-tormentor
-torment
-torn
-torrent
-tortiv
-tortois
-tortur
-tortur
-tortur
-tortur
-tortur
-tortur
-torturest
-tortur
-toryn
-toss
-toss
-tosseth
-toss
-tot
-total
-total
-tott
-totter
-totter
-tou
-touch
-touch
-touch
-toucheth
-touch
-touchston
-tough
-tougher
-tough
-tourain
-tournament
-tour
-tou
-tout
-touz
-tow
-toward
-towardli
-toward
-tower
-tower
-tower
-town
-town
-township
-townsman
-townsmen
-towton
-toi
-toi
-trace
-trace
-track
-tract
-tractabl
-trade
-trade
-trader
-trade
-tradesman
-tradesmen
-trade
-tradit
-tradit
-traduc
-traduc
-traduc
-traffic
-traffick
-traffic
-tragedian
-tragedian
-tragedi
-tragedi
-tragic
-tragic
-trail
-train
-train
-train
-train
-trait
-traitor
-traitorli
-traitor
-traitor
-traitor
-traitress
-traject
-trammel
-trampl
-trampl
-trampl
-tranc
-tranc
-tranio
-tranquil
-tranquil
-transcend
-transcend
-transfer
-transfigur
-transfix
-transform
-transform
-transform
-transform
-transgress
-transgress
-transgress
-transgress
-translat
-translat
-translat
-translat
-transmigr
-transmut
-transpar
-transport
-transport
-transport
-transport
-transport
-transpos
-transshap
-trap
-trapp
-trap
-trap
-trash
-travail
-travail
-travel
-travel
-travel
-travel
-travel
-travel
-travel
-travellest
-travel
-travel
-traver
-travers
-trai
-treacher
-treacher
-treacher
-treacheri
-tread
-tread
-tread
-treason
-treason
-treason
-treason
-treasur
-treasur
-treasur
-treasuri
-treasuri
-treat
-treati
-treatis
-treat
-treati
-trebl
-trebl
-trebl
-treboniu
-tree
-tree
-trembl
-trembl
-trembl
-tremblest
-trembl
-tremblingli
-tremor
-trempl
-trench
-trenchant
-trench
-trencher
-trencher
-trencherman
-trencher
-trench
-trench
-trent
-tre
-trespass
-trespass
-tressel
-tress
-trei
-trial
-trial
-trib
-tribe
-tribe
-tribul
-tribun
-tribun
-tribun
-tributari
-tributari
-tribut
-tribut
-trice
-trick
-trick
-trickl
-trick
-tricksi
-trident
-tri
-trier
-trifl
-trifl
-trifler
-trifl
-trifl
-trigon
-trill
-trim
-trimli
-trimm
-trim
-trim
-trim
-trinculo
-trinculo
-trinket
-trip
-tripartit
-tripe
-tripl
-triplex
-tripoli
-tripoli
-tripp
-trip
-trippingli
-trip
-trist
-triton
-triumph
-triumphant
-triumphantli
-triumpher
-triumpher
-triumph
-triumph
-triumvir
-triumvir
-triumvir
-triumviri
-trivial
-troat
-trod
-trodden
-troiant
-troien
-troilu
-troilus
-trojan
-trojan
-troll
-tromperi
-trompet
-troop
-troop
-troop
-trop
-trophi
-trophi
-tropic
-trot
-troth
-troth
-troth
-trot
-trot
-troubl
-troubl
-troubler
-troubl
-troublesom
-troublest
-troublou
-trough
-trout
-trout
-trovato
-trow
-trowel
-trowest
-troi
-troyan
-troyan
-truant
-truce
-truckl
-trudg
-true
-trueborn
-truepenni
-truer
-truest
-truie
-trull
-trull
-truli
-trump
-trumperi
-trumpet
-trumpet
-trumpet
-trumpet
-truncheon
-truncheon
-trundl
-trunk
-trunk
-trust
-trust
-truster
-truster
-trust
-trust
-trusti
-truth
-truth
-try
-ts
-tu
-tuae
-tub
-tubal
-tub
-tuck
-tucket
-tuesdai
-tuft
-tuft
-tug
-tugg
-tug
-tuition
-tullu
-tulli
-tumbl
-tumbl
-tumbler
-tumbl
-tumult
-tumultu
-tun
-tune
-tuneabl
-tune
-tuner
-tune
-tuni
-tun
-tup
-turban
-turban
-turbul
-turbul
-turd
-turf
-turfi
-turk
-turkei
-turkei
-turkish
-turk
-turlygod
-turmoil
-turmoil
-turn
-turnbul
-turncoat
-turncoat
-turn
-turneth
-turn
-turnip
-turn
-turph
-turpitud
-turquois
-turret
-turret
-turtl
-turtl
-turvi
-tuscan
-tush
-tut
-tutor
-tutor
-tutor
-tutto
-twain
-twang
-twangl
-twa
-twai
-tweak
-tween
-twelfth
-twelv
-twelvemonth
-twentieth
-twenti
-twere
-twice
-twig
-twiggen
-twig
-twilight
-twill
-twill
-twin
-twine
-twink
-twinkl
-twinkl
-twinkl
-twinn
-twin
-twire
-twist
-twist
-twit
-twit
-twit
-twixt
-two
-twofold
-twopenc
-twopenc
-two
-twould
-tyb
-tybalt
-tybalt
-tyburn
-ty
-tyke
-tymbria
-type
-type
-typhon
-tyrann
-tyrann
-tyrann
-tyrann
-tyranni
-tyrant
-tyrant
-tyrian
-tyrrel
-u
-ubiqu
-udder
-udg
-ud
-uglier
-ugliest
-ugli
-ulcer
-ulcer
-ulyss
-um
-umber
-umbra
-umbrag
-umfrevil
-umpir
-umpir
-un
-unabl
-unaccommod
-unaccompani
-unaccustom
-unach
-unacquaint
-unact
-unadvi
-unadvis
-unadvisedli
-unagre
-unanel
-unansw
-unappea
-unapprov
-unapt
-unapt
-unarm
-unarm
-unarm
-unassail
-unassail
-unattaint
-unattempt
-unattend
-unauspici
-unauthor
-unavoid
-unawar
-unback
-unbak
-unband
-unbar
-unbarb
-unbash
-unbat
-unbatt
-unbecom
-unbefit
-unbegot
-unbegotten
-unbeliev
-unbend
-unbent
-unbewail
-unbid
-unbidden
-unbind
-unbind
-unbit
-unbless
-unblest
-unbloodi
-unblown
-unbodi
-unbolt
-unbolt
-unbonnet
-unbookish
-unborn
-unbosom
-unbound
-unbound
-unbow
-unbow
-unbrac
-unbrac
-unbraid
-unbreath
-unbr
-unbreech
-unbridl
-unbrok
-unbrui
-unbruis
-unbuckl
-unbuckl
-unbuckl
-unbuild
-unburden
-unburden
-unburi
-unburnt
-unburthen
-unbutton
-unbutton
-uncap
-uncap
-uncas
-uncas
-uncaught
-uncertain
-uncertainti
-unchain
-unchang
-uncharg
-uncharg
-uncharit
-unchari
-unchast
-uncheck
-unchild
-uncivil
-unclaim
-unclasp
-uncl
-unclean
-uncleanli
-uncleanli
-unclean
-uncl
-unclew
-unclog
-uncoin
-uncolt
-uncomeli
-uncomfort
-uncompassion
-uncomprehens
-unconfin
-unconfirm
-unconfirm
-unconqu
-unconqu
-unconsid
-unconst
-unconstrain
-unconstrain
-uncontemn
-uncontrol
-uncorrect
-uncount
-uncoupl
-uncourt
-uncouth
-uncov
-uncov
-uncrop
-uncross
-uncrown
-unction
-unctuou
-uncuckold
-uncur
-uncurb
-uncurb
-uncurl
-uncurr
-uncurs
-undaunt
-undeaf
-undeck
-undeed
-under
-underbear
-underborn
-undercrest
-underfoot
-undergo
-undergo
-undergo
-undergon
-underground
-underhand
-underl
-undermin
-undermin
-underneath
-underpr
-underprop
-understand
-understandeth
-understand
-understand
-understand
-understood
-underta
-undertak
-undertak
-undertak
-undertak
-undertak
-undertak
-undertook
-undervalu
-undervalu
-underw
-underwrit
-underwrit
-undescri
-undeserv
-undeserv
-undeserv
-undeserv
-undetermin
-undid
-undint
-undiscern
-undiscov
-undishonour
-undispo
-undistinguish
-undistinguish
-undivid
-undivid
-undivulg
-undo
-undo
-undo
-undon
-undoubt
-undoubtedli
-undream
-undress
-undress
-undrown
-undut
-unduti
-un
-unear
-unearn
-unearthli
-uneasin
-uneasi
-uneath
-uneduc
-uneffectu
-unelect
-unequ
-uneven
-unexamin
-unexecut
-unexpect
-unexperienc
-unexperi
-unexpress
-unfair
-unfaith
-unfal
-unfam
-unfashion
-unfasten
-unfath
-unfath
-unf
-unfe
-unfeel
-unfeign
-unfeignedli
-unfellow
-unfelt
-unfenc
-unfili
-unfil
-unfinish
-unfirm
-unfit
-unfit
-unfix
-unfledg
-unfold
-unfold
-unfoldeth
-unfold
-unfold
-unfool
-unforc
-unforc
-unforfeit
-unfortifi
-unfortun
-unfought
-unfrequ
-unfriend
-unfurnish
-ungain
-ungal
-ungart
-ungart
-ungenitur
-ungentl
-ungentl
-ungent
-ungird
-ungodli
-ungor
-ungot
-ungotten
-ungovern
-ungraci
-ungrat
-ungrav
-ungrown
-unguard
-unguem
-unguid
-unhack
-unhair
-unhallow
-unhallow
-unhand
-unhandl
-unhandsom
-unhang
-unhappi
-unhappili
-unhappi
-unhappi
-unharden
-unharm
-unhatch
-unheard
-unheart
-unheed
-unheedfulli
-unheedi
-unhelp
-unhidden
-unholi
-unhop
-unhopefullest
-unhors
-unhospit
-unhou
-unhous
-unhurt
-unicorn
-unicorn
-unimprov
-uninhabit
-uninhabit
-unintellig
-union
-union
-unit
-unit
-uniti
-univers
-univers
-univers
-univers
-unjoint
-unjust
-unjustic
-unjustli
-unkennel
-unkept
-unkind
-unkindest
-unkindli
-unkind
-unk
-unkinglik
-unkiss
-unknit
-unknow
-unknown
-unlac
-unlaid
-unlaw
-unlawfulli
-unlearn
-unlearn
-unless
-unlesson
-unlett
-unlett
-unlick
-unlik
-unlik
-unlimit
-unlin
-unlink
-unload
-unload
-unload
-unload
-unlock
-unlock
-unlook
-unlook
-unloo
-unloos
-unlov
-unlov
-unluckili
-unlucki
-unmad
-unmak
-unmanli
-unmann
-unmann
-unmannerd
-unmannerli
-unmarri
-unmask
-unmask
-unmask
-unmask
-unmast
-unmatch
-unmatch
-unmatch
-unmeasur
-unmeet
-unmellow
-unmerci
-unmerit
-unmerit
-unmind
-unmindful
-unmingl
-unmitig
-unmitig
-unmix
-unmoan
-unmov
-unmov
-unmov
-unmuffl
-unmuffl
-unmus
-unmuzzl
-unmuzzl
-unnatur
-unnatur
-unnatur
-unnecessarili
-unnecessari
-unneighbourli
-unnerv
-unnobl
-unnot
-unnumb
-unnumb
-unow
-unpack
-unpaid
-unparagon
-unparallel
-unparti
-unpath
-unpav
-unpai
-unpeac
-unpeg
-unpeopl
-unpeopl
-unperfect
-unperfect
-unpick
-unpin
-unpink
-unpiti
-unpitifulli
-unplagu
-unplaus
-unplea
-unpleas
-unpleas
-unpolici
-unpolish
-unpolish
-unpollut
-unpossess
-unpossess
-unposs
-unpracti
-unpregn
-unpremedit
-unprepar
-unprepar
-unpress
-unprevail
-unprev
-unpriz
-unpriz
-unprofit
-unprofit
-unprop
-unproperli
-unproport
-unprovid
-unprovid
-unprovid
-unprovok
-unprun
-unprun
-unpublish
-unpurg
-unpurpo
-unqual
-unqueen
-unquest
-unquestion
-unquiet
-unquietli
-unquiet
-unrais
-unrak
-unread
-unreadi
-unreal
-unreason
-unreason
-unreclaim
-unreconcil
-unreconcili
-unrecount
-unrecur
-unregard
-unregist
-unrel
-unremov
-unremov
-unrepriev
-unresolv
-unrespect
-unrespect
-unrest
-unrestor
-unrestrain
-unreveng
-unreverend
-unrever
-unrev
-unreward
-unright
-unright
-unrip
-unripp
-unrival
-unrol
-unroof
-unroost
-unroot
-unrough
-unruli
-unsaf
-unsalut
-unsanctifi
-unsatisfi
-unsavouri
-unsai
-unscal
-unscann
-unscarr
-unschool
-unscorch
-unscour
-unscratch
-unseal
-unseam
-unsearch
-unseason
-unseason
-unseason
-unseason
-unsecond
-unsecret
-unseduc
-unse
-unseem
-unseemli
-unseen
-unseminar
-unsepar
-unservic
-unset
-unsettl
-unsettl
-unsev
-unsex
-unshak
-unshak
-unshaken
-unshap
-unshap
-unsheath
-unsheath
-unshorn
-unshout
-unshown
-unshrink
-unshrubb
-unshunn
-unshunn
-unsift
-unsightli
-unsinew
-unsist
-unskil
-unskilfulli
-unskil
-unslip
-unsmirch
-unsoil
-unsolicit
-unsort
-unsought
-unsound
-unsound
-unspeak
-unspeak
-unspeak
-unspher
-unspok
-unspoken
-unspot
-unsquar
-unstabl
-unstaid
-unstain
-unstain
-unstanch
-unstat
-unsteadfast
-unstoop
-unstring
-unstuff
-unsubstanti
-unsuit
-unsuit
-unsulli
-unsunn
-unsur
-unsur
-unsuspect
-unswai
-unsway
-unswai
-unswear
-unswept
-unsworn
-untaint
-untalk
-untangl
-untangl
-untast
-untaught
-untemp
-untend
-untent
-untent
-unthank
-unthank
-unthink
-unthought
-unthread
-unthrift
-unthrift
-unthrifti
-unti
-unti
-until
-untimb
-untim
-untir
-untir
-untir
-untitl
-unto
-untold
-untouch
-untoward
-untowardli
-untrad
-untrain
-untrain
-untread
-untreasur
-untri
-untrim
-untrod
-untrodden
-untroubl
-untru
-untruss
-untruth
-untruth
-untuck
-untun
-untun
-untun
-untutor
-untutor
-untwin
-unurg
-unu
-unus
-unusu
-unvalu
-unvanquish
-unvarnish
-unveil
-unveil
-unvener
-unvex
-unviol
-unvirtu
-unvisit
-unvulner
-unwar
-unwarili
-unwash
-unwatch
-unweari
-unw
-unwedg
-unweed
-unweigh
-unweigh
-unwelcom
-unwept
-unwhipp
-unwholesom
-unwieldi
-unwil
-unwillingli
-unwilling
-unwind
-unwip
-unwis
-unwis
-unwish
-unwish
-unwit
-unwittingli
-unwont
-unwoo
-unworthi
-unworthiest
-unworthili
-unworthi
-unworthi
-unwrung
-unyok
-unyok
-up
-upbraid
-upbraid
-upbraid
-upbraid
-uphoard
-uphold
-upholdeth
-uphold
-uphold
-uplift
-uplift
-upmost
-upon
-upper
-uprear
-uprear
-upright
-upright
-upright
-upris
-upris
-uproar
-uproar
-uprou
-upshoot
-upshot
-upsid
-upspr
-upstair
-upstart
-upturn
-upward
-upward
-urchin
-urchinfield
-urchin
-urg
-urg
-urg
-urgent
-urg
-urgest
-urg
-urin
-urin
-urin
-urn
-urn
-ur
-ursa
-urslei
-ursula
-urswick
-us
-usag
-usanc
-usanc
-us
-us
-us
-useless
-user
-us
-usest
-useth
-usher
-usher
-usher
-usher
-us
-usual
-usual
-usur
-usur
-usuri
-usur
-usurp
-usurp
-usurp
-usurp
-usurp
-usurp
-usurpingli
-usurp
-usuri
-ut
-utensil
-utensil
-util
-utmost
-utt
-utter
-utter
-utter
-uttereth
-utter
-utterli
-uttermost
-utter
-uy
-v
-va
-vacanc
-vacant
-vacat
-vade
-vagabond
-vagabond
-vagram
-vagrom
-vail
-vail
-vail
-vaillant
-vain
-vainer
-vainglori
-vainli
-vain
-vai
-valanc
-valanc
-vale
-valenc
-valentin
-valentinu
-valentio
-valeria
-valeriu
-vale
-valiant
-valiantli
-valiant
-valid
-vallant
-vallei
-vallei
-valli
-valor
-valor
-valor
-valour
-valu
-valuat
-valu
-valu
-valueless
-valu
-valu
-vane
-vanish
-vanish
-vanish
-vanishest
-vanish
-vaniti
-vaniti
-vanquish
-vanquish
-vanquish
-vanquishest
-vanquisheth
-vant
-vantag
-vantag
-vantbrac
-vapian
-vapor
-vapor
-vapour
-vapour
-vara
-variabl
-varianc
-variat
-variat
-vari
-variest
-varieti
-varld
-varlet
-varletri
-varlet
-varletto
-varnish
-varriu
-varro
-vari
-vari
-vassal
-vassalag
-vassal
-vast
-vastid
-vasti
-vat
-vater
-vaudemont
-vaughan
-vault
-vaultag
-vault
-vault
-vault
-vaulti
-vaumond
-vaunt
-vaunt
-vaunter
-vaunt
-vauntingli
-vaunt
-vauvado
-vaux
-vaward
-ve
-veal
-vede
-vehem
-vehem
-vehement
-vehor
-veil
-veil
-veil
-vein
-vein
-vell
-velur
-velutu
-velvet
-vendibl
-vener
-vener
-venetia
-venetian
-venetian
-venei
-veng
-vengeanc
-vengeanc
-veng
-veni
-venial
-venic
-venison
-venit
-venom
-venom
-venom
-vent
-ventag
-vent
-ventidiu
-ventricl
-vent
-ventur
-ventur
-ventur
-ventur
-ventur
-ventur
-venu
-venu
-venuto
-ver
-verb
-verba
-verbal
-verbatim
-verbos
-verdict
-verdun
-verdur
-vere
-verefor
-verg
-verg
-verger
-verg
-verier
-veriest
-verifi
-verifi
-verili
-verit
-verit
-veriti
-veriti
-vermilion
-vermin
-vernon
-verona
-veronesa
-versal
-vers
-vers
-vers
-vert
-veri
-vesper
-vessel
-vessel
-vestal
-vestment
-vestur
-vetch
-vetch
-veux
-vex
-vexat
-vexat
-vex
-vex
-vexest
-vexeth
-vex
-vi
-via
-vial
-vial
-viand
-viand
-vic
-vicar
-vice
-viceger
-vicentio
-viceroi
-viceroi
-vice
-vici
-viciou
-vicious
-vict
-victim
-victor
-victoress
-victori
-victori
-victor
-victori
-victual
-victual
-victual
-videlicet
-video
-vide
-videsn
-vidi
-vie
-vi
-vienna
-view
-viewest
-vieweth
-view
-viewless
-view
-vigil
-vigil
-vigil
-vigit
-vigour
-vii
-viii
-vile
-vile
-vile
-viler
-vilest
-vill
-villag
-villag
-villageri
-villag
-villain
-villaini
-villain
-villain
-villain
-villaini
-villani
-villan
-villani
-villiago
-villian
-villianda
-villian
-vinaigr
-vincentio
-vincer
-vindic
-vine
-vinegar
-vine
-vineyard
-vineyard
-vint
-vintner
-viol
-viola
-violat
-violat
-violat
-violat
-violat
-violenc
-violent
-violenta
-violenteth
-violent
-violet
-violet
-viper
-viper
-viper
-vir
-virgilia
-virgin
-virgin
-virginal
-virgin
-virginiu
-virgin
-virgo
-virtu
-virtu
-virtuou
-virtuous
-visag
-visag
-visag
-visard
-viscount
-visibl
-visibl
-vision
-vision
-visit
-visit
-visit
-visit
-visit
-visit
-visitor
-visitor
-visit
-visor
-vita
-vita
-vital
-vitement
-vitruvio
-vitx
-viva
-vivant
-vive
-vixen
-viz
-vizament
-vizard
-vizard
-vizard
-vizor
-vlout
-vocat
-vocativo
-vocatur
-voce
-voic
-voic
-voic
-void
-void
-void
-voke
-volabl
-volant
-volivorco
-vollei
-volquessen
-volsc
-volsc
-volscian
-volscian
-volt
-voltemand
-volubl
-volubl
-volum
-volum
-volumnia
-volumniu
-voluntari
-voluntari
-voluptu
-voluptu
-vomiss
-vomit
-vomit
-vor
-vore
-vortnight
-vot
-votari
-votarist
-votarist
-votari
-votr
-vouch
-voucher
-voucher
-vouch
-vouch
-vouchsaf
-vouchsaf
-vouchsaf
-vouchsaf
-vouchsaf
-voudrai
-vour
-vou
-voutsaf
-vow
-vow
-vowel
-vowel
-vow
-vow
-vox
-voyag
-voyag
-vraiment
-vulcan
-vulgar
-vulgarli
-vulgar
-vulgo
-vulner
-vultur
-vultur
-vurther
-w
-wad
-waddl
-wade
-wade
-wafer
-waft
-waftag
-waft
-waft
-wag
-wage
-wager
-wager
-wage
-wag
-waggish
-waggl
-waggon
-waggon
-wagon
-wagon
-wag
-wagtail
-wail
-wail
-wail
-wail
-wain
-wainrop
-wainscot
-waist
-wait
-wait
-waiter
-waiteth
-wait
-wait
-wak
-wake
-wake
-wakefield
-waken
-waken
-wake
-wakest
-wake
-wale
-walk
-walk
-walk
-walk
-wall
-wall
-wallet
-wallet
-wallon
-walloon
-wallow
-wall
-walnut
-walter
-wan
-wand
-wander
-wander
-wander
-wander
-wander
-wand
-wane
-wane
-wane
-wane
-wann
-want
-want
-wanteth
-want
-wanton
-wantonli
-wanton
-wanton
-want
-wappen
-war
-warbl
-warbl
-ward
-ward
-warden
-warder
-warder
-wardrob
-wardrop
-ward
-ware
-ware
-warili
-warkworth
-warlik
-warm
-warm
-warmer
-warm
-warm
-warmth
-warn
-warn
-warn
-warn
-warn
-warp
-warp
-warr
-warrant
-warrant
-warranteth
-warrantis
-warrant
-warrant
-warranti
-warren
-warren
-war
-warrior
-warrior
-war
-wart
-warwick
-warwickshir
-wari
-wa
-wash
-wash
-washer
-wash
-washford
-wash
-wasp
-waspish
-wasp
-wassail
-wassail
-wast
-wast
-wast
-wast
-waster
-wast
-wast
-wat
-watch
-watch
-watcher
-watch
-watch
-watch
-watch
-watchman
-watchmen
-watchword
-water
-waterdrop
-water
-waterfli
-waterford
-water
-waterish
-waterpot
-waterrug
-water
-waterton
-wateri
-wav
-wave
-wave
-waver
-waver
-waver
-wave
-wave
-waw
-wawl
-wax
-wax
-waxen
-wax
-wax
-wai
-waylaid
-waylai
-wai
-wayward
-wayward
-wayward
-we
-weak
-weaken
-weaken
-weaker
-weakest
-weakl
-weakli
-weak
-weal
-wealsmen
-wealth
-wealthiest
-wealthili
-wealthi
-wealtlli
-wean
-weapon
-weapon
-wear
-wearer
-wearer
-weari
-weari
-weariest
-wearili
-weari
-wear
-wearisom
-wear
-weari
-weasel
-weather
-weathercock
-weather
-weav
-weav
-weaver
-weaver
-weav
-weav
-web
-wed
-wed
-wed
-wedg
-wedg
-wedg
-wedlock
-wednesdai
-weed
-weed
-weeder
-weed
-weed
-weedi
-week
-week
-weekli
-week
-ween
-ween
-weep
-weeper
-weep
-weepingli
-weep
-weep
-weet
-weigh
-weigh
-weigh
-weigh
-weight
-weightier
-weightless
-weight
-weighti
-weird
-welcom
-welcom
-welcom
-welcom
-welcomest
-welfar
-welkin
-well
-well
-welsh
-welshman
-welshmen
-welshwomen
-wench
-wench
-wench
-wend
-went
-wept
-weradai
-were
-wert
-west
-western
-westminst
-westmoreland
-westward
-wet
-wether
-wet
-wezand
-whale
-whale
-wharf
-wharf
-what
-whate
-whatev
-whatso
-whatsoev
-whatsom
-whe
-wheat
-wheaten
-wheel
-wheel
-wheel
-wheer
-wheeson
-wheez
-whelk
-whelk
-whelm
-whelp
-whelp
-whelp
-when
-whena
-whenc
-whencesoev
-whene
-whenev
-whensoev
-where
-whereabout
-wherea
-whereat
-wherebi
-wherefor
-wherein
-whereinto
-whereof
-whereon
-whereout
-whereso
-whereso
-wheresoev
-wheresom
-whereto
-whereuntil
-whereunto
-whereupon
-wherev
-wherewith
-wherewith
-whet
-whether
-whetston
-whet
-whew
-whei
-which
-whiff
-whiffler
-while
-while
-whilst
-whin
-whine
-whine
-whinid
-whine
-whip
-whipp
-whipper
-whip
-whip
-whipster
-whipstock
-whipt
-whirl
-whirl
-whirligig
-whirl
-whirlpool
-whirl
-whirlwind
-whirlwind
-whisp
-whisper
-whisper
-whisper
-whisper
-whist
-whistl
-whistl
-whistl
-whit
-white
-whitehal
-white
-white
-whiter
-white
-whitest
-whither
-white
-whitmor
-whitster
-whitsun
-whittl
-whizz
-who
-whoa
-whoe
-whoever
-whole
-wholesom
-wholesom
-wholli
-whom
-whoobub
-whoop
-whoop
-whor
-whore
-whoremast
-whoremasterli
-whoremong
-whore
-whoreson
-whoreson
-whore
-whorish
-whose
-whoso
-whoso
-whosoev
-why
-wi
-wick
-wick
-wickedn
-wicked
-wicket
-wicki
-wid
-wide
-widen
-wider
-widow
-widow
-widow
-widowhood
-widow
-wield
-wife
-wight
-wight
-wild
-wildcat
-wilder
-wilder
-wildest
-wildfir
-wildli
-wild
-wild
-wile
-wil
-wilful
-wilfulli
-wilfuln
-wil
-will
-will
-willer
-willeth
-william
-william
-will
-willingli
-willing
-willoughbi
-willow
-will
-wilt
-wiltshir
-wimpl
-win
-winc
-winch
-winchest
-wincot
-wind
-wind
-windgal
-wind
-windlass
-windmil
-window
-window
-windpip
-wind
-windsor
-windi
-wine
-wing
-wing
-wingfield
-wingham
-wing
-wink
-wink
-wink
-winner
-winner
-win
-winnow
-winnow
-winnow
-win
-winter
-winterli
-winter
-wip
-wipe
-wipe
-wipe
-wipe
-wire
-wire
-wiri
-wisdom
-wisdom
-wise
-wiseli
-wise
-wiser
-wisest
-wish
-wish
-wisher
-wisher
-wish
-wishest
-wisheth
-wish
-wish
-wishtli
-wisp
-wist
-wit
-witb
-witch
-witchcraft
-witch
-witch
-with
-withal
-withdraw
-withdraw
-withdrawn
-withdrew
-wither
-wither
-wither
-wither
-withheld
-withhold
-withhold
-within
-withold
-without
-withstand
-withstand
-withstood
-witless
-wit
-wit
-witnesseth
-wit
-wit
-wit
-wittenberg
-wittiest
-wittili
-wit
-wittingli
-wittol
-wittolli
-witti
-wiv
-wive
-wive
-wive
-wive
-wizard
-wizard
-wo
-woe
-woeful
-woeful
-woefullest
-woe
-woful
-wolf
-wolfish
-wolsei
-wolv
-wolvish
-woman
-womanhood
-womanish
-womankind
-womanli
-womb
-womb
-wombi
-women
-won
-woncot
-wond
-wonder
-wonder
-wonder
-wonderfulli
-wonder
-wonder
-wondrou
-wondrous
-wont
-wont
-woo
-wood
-woodbin
-woodcock
-woodcock
-wooden
-woodland
-woodman
-woodmong
-wood
-woodstock
-woodvil
-woo
-wooer
-wooer
-wooe
-woof
-woo
-wooingli
-wool
-woollen
-woolli
-woolsack
-woolsei
-woolward
-woo
-wor
-worcest
-word
-word
-wore
-worin
-work
-worker
-work
-work
-workman
-workmanli
-workmanship
-workmen
-work
-worki
-world
-worldl
-worldli
-world
-worm
-worm
-wormwood
-wormi
-worn
-worri
-worri
-worri
-worri
-wors
-worser
-worship
-worship
-worshipfulli
-worshipp
-worshipp
-worshipp
-worshippest
-worship
-worst
-worst
-wort
-worth
-worthi
-worthier
-worthi
-worthiest
-worthili
-worthi
-worthless
-worth
-worthi
-wort
-wot
-wot
-wot
-wouid
-would
-wouldest
-wouldst
-wound
-wound
-wound
-wound
-woundless
-wound
-woun
-woven
-wow
-wrack
-wrack
-wrangl
-wrangler
-wrangler
-wrangl
-wrap
-wrapp
-wrap
-wrapt
-wrath
-wrath
-wrathfulli
-wrath
-wreak
-wreak
-wreak
-wreath
-wreath
-wreathen
-wreath
-wreck
-wreck
-wreck
-wren
-wrench
-wrench
-wren
-wrest
-wrest
-wrest
-wrestl
-wrestl
-wrestler
-wrestl
-wretch
-wretchcd
-wretch
-wretched
-wretch
-wring
-wringer
-wring
-wring
-wrinkl
-wrinkl
-wrinkl
-wrist
-wrist
-writ
-write
-writer
-writer
-write
-writhl
-write
-write
-writ
-written
-wrong
-wrong
-wronger
-wrong
-wrongfulli
-wrong
-wrongli
-wrong
-wronk
-wrote
-wroth
-wrought
-wrung
-wry
-wry
-wt
-wul
-wye
-x
-xanthipp
-xi
-xii
-xiii
-xiv
-xv
-y
-yard
-yard
-yare
-yare
-yarn
-yaughan
-yaw
-yawn
-yawn
-yclepe
-yclipe
-ye
-yea
-yead
-year
-yearli
-yearn
-yearn
-year
-yea
-yeast
-yedward
-yell
-yellow
-yellow
-yellow
-yellow
-yellow
-yell
-yelp
-yeoman
-yeomen
-yerk
-ye
-yesterdai
-yesterdai
-yesternight
-yesti
-yet
-yew
-yicld
-yield
-yield
-yielder
-yielder
-yield
-yield
-yok
-yoke
-yoke
-yokefellow
-yoke
-yoketh
-yon
-yond
-yonder
-yongrei
-yore
-yorick
-york
-yorkist
-york
-yorkshir
-you
-young
-younger
-youngest
-youngl
-youngl
-youngli
-younker
-your
-your
-yourself
-yourselv
-youth
-youth
-youth
-youtli
-zani
-zani
-zeal
-zealou
-zeal
-zed
-zenelophon
-zenith
-zephyr
-zir
-zo
-zodiac
-zodiac
-zone
-zound
-zwagger
diff --git a/libs/porter-stemmer/test/porter-stemmer.factor b/libs/porter-stemmer/test/porter-stemmer.factor
deleted file mode 100644 (file)
index 8cf9aa0..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-IN: temporary
-USING: arrays io kernel porter-stemmer sequences test ;
-
-[ 0 ] [ "xa" consonant-seq ] unit-test
-[ 0 ] [ "xxaa" consonant-seq ] unit-test
-[ 1 ] [ "xaxa" consonant-seq ] unit-test
-[ 2 ] [ "xaxaxa" consonant-seq ] unit-test
-[ 3 ] [ "xaxaxaxa" consonant-seq ] unit-test
-[ 3 ] [ "zzzzxaxaxaxaeee" consonant-seq ] unit-test
-
-[ t ] [ 0 "fish" consonant? ] unit-test
-[ f ] [ 0 "and" consonant? ] unit-test
-[ t ] [ 0 "yes" consonant? ] unit-test
-[ f ] [ 1 "gym" consonant? ] unit-test
-
-[ t ] [ 5 "splitting" double-consonant? ] unit-test
-[ f ] [ 2 "feel" double-consonant? ] unit-test
-
-[ f ] [ "xxxz" stem-vowel? ] unit-test
-[ t ] [ "baobab" stem-vowel? ] unit-test
-
-[ t ] [ "hop" cvc? ] unit-test
-[ t ] [ "cav" cvc? ] unit-test
-[ t ] [ "lov" cvc? ] unit-test
-[ t ] [ "crim" cvc? ] unit-test
-[ f ] [ "show" cvc? ] unit-test
-[ f ] [ "box" cvc? ] unit-test
-[ f ] [ "tray" cvc? ] unit-test
-[ f ] [ "meet" cvc? ] unit-test
-
-[ "caress" ] [ "caresses" step1a step1b "" like ] unit-test
-[ "poni" ] [ "ponies" step1a step1b "" like ] unit-test
-[ "ti" ] [ "ties" step1a step1b "" like ] unit-test
-[ "caress" ] [ "caress" step1a step1b "" like ] unit-test
-[ "cat" ] [ "cats" step1a step1b "" like ] unit-test
-[ "feed" ] [ "feed" step1a step1b "" like ] unit-test
-[ "agree" ] [ "agreed" step1a step1b "" like ] unit-test
-[ "disable" ] [ "disabled" step1a step1b "" like ] unit-test
-[ "mat" ] [ "matting" step1a step1b "" like ] unit-test
-[ "mate" ] [ "mating" step1a step1b "" like ] unit-test
-[ "meet" ] [ "meeting" step1a step1b "" like ] unit-test
-[ "mill" ] [ "milling" step1a step1b "" like ] unit-test
-[ "mess" ] [ "messing" step1a step1b "" like ] unit-test
-[ "meet" ] [ "meetings" step1a step1b "" like ] unit-test
-
-[ "fishi" ] [ "fishy" step1c ] unit-test
-[ "by" ] [ "by" step1c ] unit-test
-
-[ "realizat" ] [ "realization" step4 ] unit-test
-[ "ion" ] [ "ion" step4 ] unit-test
-[ "able" ] [ "able" step4 ] unit-test
-
-[ "fear" ] [ "feare" step5 "" like ] unit-test
-[ "mate" ] [ "mate" step5 "" like ] unit-test
-[ "hell" ] [ "hell" step5 "" like ] unit-test
-[ "mate" ] [ "mate" step5 "" like ] unit-test
-
-: resource-lines resource-path <file-reader> lines ;
-
-[ { } ] [
-    "/libs/porter-stemmer/test/voc.txt" resource-lines
-    [ stem ] map
-    "/libs/porter-stemmer/test/output.txt" resource-lines
-    [ 2array ] 2map [ first2 = not ] subset
-] unit-test
diff --git a/libs/porter-stemmer/test/voc.txt b/libs/porter-stemmer/test/voc.txt
deleted file mode 100644 (file)
index 604ef40..0000000
+++ /dev/null
@@ -1,23531 +0,0 @@
-a
-aaron
-abaissiez
-abandon
-abandoned
-abase
-abash
-abate
-abated
-abatement
-abatements
-abates
-abbess
-abbey
-abbeys
-abbominable
-abbot
-abbots
-abbreviated
-abed
-abel
-aberga
-abergavenny
-abet
-abetting
-abhominable
-abhor
-abhorr
-abhorred
-abhorring
-abhors
-abhorson
-abide
-abides
-abilities
-ability
-abject
-abjectly
-abjects
-abjur
-abjure
-able
-abler
-aboard
-abode
-aboded
-abodements
-aboding
-abominable
-abominably
-abominations
-abortive
-abortives
-abound
-abounding
-about
-above
-abr
-abraham
-abram
-abreast
-abridg
-abridge
-abridged
-abridgment
-abroach
-abroad
-abrogate
-abrook
-abrupt
-abruption
-abruptly
-absence
-absent
-absey
-absolute
-absolutely
-absolv
-absolver
-abstains
-abstemious
-abstinence
-abstract
-absurd
-absyrtus
-abundance
-abundant
-abundantly
-abus
-abuse
-abused
-abuser
-abuses
-abusing
-abutting
-aby
-abysm
-ac
-academe
-academes
-accent
-accents
-accept
-acceptable
-acceptance
-accepted
-accepts
-access
-accessary
-accessible
-accidence
-accident
-accidental
-accidentally
-accidents
-accite
-accited
-accites
-acclamations
-accommodate
-accommodated
-accommodation
-accommodations
-accommodo
-accompanied
-accompany
-accompanying
-accomplices
-accomplish
-accomplished
-accomplishing
-accomplishment
-accompt
-accord
-accordant
-accorded
-accordeth
-according
-accordingly
-accords
-accost
-accosted
-account
-accountant
-accounted
-accounts
-accoutred
-accoutrement
-accoutrements
-accrue
-accumulate
-accumulated
-accumulation
-accurs
-accursed
-accurst
-accus
-accusation
-accusations
-accusative
-accusativo
-accuse
-accused
-accuser
-accusers
-accuses
-accuseth
-accusing
-accustom
-accustomed
-ace
-acerb
-ache
-acheron
-aches
-achiev
-achieve
-achieved
-achievement
-achievements
-achiever
-achieves
-achieving
-achilles
-aching
-achitophel
-acknowledg
-acknowledge
-acknowledged
-acknowledgment
-acknown
-acold
-aconitum
-acordo
-acorn
-acquaint
-acquaintance
-acquainted
-acquaints
-acquir
-acquire
-acquisition
-acquit
-acquittance
-acquittances
-acquitted
-acre
-acres
-across
-act
-actaeon
-acted
-acting
-action
-actions
-actium
-active
-actively
-activity
-actor
-actors
-acts
-actual
-acture
-acute
-acutely
-ad
-adage
-adallas
-adam
-adamant
-add
-added
-adder
-adders
-addeth
-addict
-addicted
-addiction
-adding
-addition
-additions
-addle
-address
-addressing
-addrest
-adds
-adhere
-adheres
-adieu
-adieus
-adjacent
-adjoin
-adjoining
-adjourn
-adjudg
-adjudged
-adjunct
-administer
-administration
-admir
-admirable
-admiral
-admiration
-admire
-admired
-admirer
-admiring
-admiringly
-admission
-admit
-admits
-admittance
-admitted
-admitting
-admonish
-admonishing
-admonishment
-admonishments
-admonition
-ado
-adonis
-adopt
-adopted
-adoptedly
-adoption
-adoptious
-adopts
-ador
-adoration
-adorations
-adore
-adorer
-adores
-adorest
-adoreth
-adoring
-adorn
-adorned
-adornings
-adornment
-adorns
-adown
-adramadio
-adrian
-adriana
-adriano
-adriatic
-adsum
-adulation
-adulterate
-adulterates
-adulterers
-adulteress
-adulteries
-adulterous
-adultery
-adultress
-advanc
-advance
-advanced
-advancement
-advancements
-advances
-advancing
-advantage
-advantageable
-advantaged
-advantageous
-advantages
-advantaging
-advent
-adventur
-adventure
-adventures
-adventuring
-adventurous
-adventurously
-adversaries
-adversary
-adverse
-adversely
-adversities
-adversity
-advertis
-advertise
-advertised
-advertisement
-advertising
-advice
-advis
-advise
-advised
-advisedly
-advises
-advisings
-advocate
-advocation
-aeacida
-aeacides
-aedile
-aediles
-aegeon
-aegion
-aegles
-aemelia
-aemilia
-aemilius
-aeneas
-aeolus
-aer
-aerial
-aery
-aesculapius
-aeson
-aesop
-aetna
-afar
-afear
-afeard
-affability
-affable
-affair
-affaire
-affairs
-affect
-affectation
-affectations
-affected
-affectedly
-affecteth
-affecting
-affection
-affectionate
-affectionately
-affections
-affects
-affeer
-affianc
-affiance
-affianced
-affied
-affin
-affined
-affinity
-affirm
-affirmation
-affirmatives
-afflict
-afflicted
-affliction
-afflictions
-afflicts
-afford
-affordeth
-affords
-affray
-affright
-affrighted
-affrights
-affront
-affronted
-affy
-afield
-afire
-afloat
-afoot
-afore
-aforehand
-aforesaid
-afraid
-afresh
-afric
-africa
-african
-afront
-after
-afternoon
-afterward
-afterwards
-ag
-again
-against
-agamemmon
-agamemnon
-agate
-agaz
-age
-aged
-agenor
-agent
-agents
-ages
-aggravate
-aggrief
-agile
-agincourt
-agitation
-aglet
-agnize
-ago
-agone
-agony
-agree
-agreed
-agreeing
-agreement
-agrees
-agrippa
-aground
-ague
-aguecheek
-agued
-agueface
-agues
-ah
-aha
-ahungry
-ai
-aialvolio
-aiaria
-aid
-aidance
-aidant
-aided
-aiding
-aidless
-aids
-ail
-aim
-aimed
-aimest
-aiming
-aims
-ainsi
-aio
-air
-aired
-airless
-airs
-airy
-ajax
-akilling
-al
-alabaster
-alack
-alacrity
-alarbus
-alarm
-alarms
-alarum
-alarums
-alas
-alb
-alban
-albans
-albany
-albeit
-albion
-alchemist
-alchemy
-alcibiades
-alcides
-alder
-alderman
-aldermen
-ale
-alecto
-alehouse
-alehouses
-alencon
-alengon
-aleppo
-ales
-alewife
-alexander
-alexanders
-alexandria
-alexandrian
-alexas
-alias
-alice
-alien
-aliena
-alight
-alighted
-alights
-aliis
-alike
-alisander
-alive
-all
-alla
-allay
-allayed
-allaying
-allayment
-allayments
-allays
-allegation
-allegations
-allege
-alleged
-allegiance
-allegiant
-alley
-alleys
-allhallowmas
-alliance
-allicholy
-allied
-allies
-alligant
-alligator
-allons
-allot
-allots
-allotted
-allottery
-allow
-allowance
-allowed
-allowing
-allows
-allur
-allure
-allurement
-alluring
-allusion
-ally
-allycholly
-almain
-almanac
-almanack
-almanacs
-almighty
-almond
-almost
-alms
-almsman
-aloes
-aloft
-alone
-along
-alonso
-aloof
-aloud
-alphabet
-alphabetical
-alphonso
-alps
-already
-also
-alt
-altar
-altars
-alter
-alteration
-altered
-alters
-althaea
-although
-altitude
-altogether
-alton
-alway
-always
-am
-amaimon
-amain
-amaking
-amamon
-amaz
-amaze
-amazed
-amazedly
-amazedness
-amazement
-amazes
-amazeth
-amazing
-amazon
-amazonian
-amazons
-ambassador
-ambassadors
-amber
-ambiguides
-ambiguities
-ambiguous
-ambition
-ambitions
-ambitious
-ambitiously
-amble
-ambled
-ambles
-ambling
-ambo
-ambuscadoes
-ambush
-amen
-amend
-amended
-amendment
-amends
-amerce
-america
-ames
-amiable
-amid
-amidst
-amiens
-amis
-amiss
-amities
-amity
-amnipotent
-among
-amongst
-amorous
-amorously
-amort
-amount
-amounts
-amour
-amphimacus
-ample
-ampler
-amplest
-amplified
-amplify
-amply
-ampthill
-amurath
-amyntas
-an
-anatomiz
-anatomize
-anatomy
-ancestor
-ancestors
-ancestry
-anchises
-anchor
-anchorage
-anchored
-anchoring
-anchors
-anchovies
-ancient
-ancientry
-ancients
-ancus
-and
-andirons
-andpholus
-andren
-andrew
-andromache
-andronici
-andronicus
-anew
-ang
-angel
-angelica
-angelical
-angelo
-angels
-anger
-angerly
-angers
-anges
-angiers
-angl
-anglais
-angle
-angler
-angleterre
-angliae
-angling
-anglish
-angrily
-angry
-anguish
-angus
-animal
-animals
-animis
-anjou
-ankle
-anna
-annals
-anne
-annex
-annexed
-annexions
-annexment
-annothanize
-announces
-annoy
-annoyance
-annoying
-annual
-anoint
-anointed
-anon
-another
-anselmo
-answer
-answerable
-answered
-answerest
-answering
-answers
-ant
-ante
-antenor
-antenorides
-anteroom
-anthem
-anthems
-anthony
-anthropophagi
-anthropophaginian
-antiates
-antic
-anticipate
-anticipates
-anticipatest
-anticipating
-anticipation
-antick
-anticly
-antics
-antidote
-antidotes
-antigonus
-antiopa
-antipathy
-antipholus
-antipholuses
-antipodes
-antiquary
-antique
-antiquity
-antium
-antoniad
-antonio
-antonius
-antony
-antres
-anvil
-any
-anybody
-anyone
-anything
-anywhere
-ap
-apace
-apart
-apartment
-apartments
-ape
-apemantus
-apennines
-apes
-apiece
-apish
-apollinem
-apollo
-apollodorus
-apology
-apoplex
-apoplexy
-apostle
-apostles
-apostrophas
-apoth
-apothecary
-appal
-appall
-appalled
-appals
-apparel
-apparell
-apparelled
-apparent
-apparently
-apparition
-apparitions
-appeach
-appeal
-appeals
-appear
-appearance
-appeared
-appeareth
-appearing
-appears
-appeas
-appease
-appeased
-appelant
-appele
-appelee
-appeles
-appelez
-appellant
-appellants
-appelons
-appendix
-apperil
-appertain
-appertaining
-appertainings
-appertains
-appertinent
-appertinents
-appetite
-appetites
-applaud
-applauded
-applauding
-applause
-applauses
-apple
-apples
-appletart
-appliance
-appliances
-applications
-applied
-applies
-apply
-applying
-appoint
-appointed
-appointment
-appointments
-appoints
-apprehend
-apprehended
-apprehends
-apprehension
-apprehensions
-apprehensive
-apprendre
-apprenne
-apprenticehood
-appris
-approach
-approachers
-approaches
-approacheth
-approaching
-approbation
-approof
-appropriation
-approv
-approve
-approved
-approvers
-approves
-appurtenance
-appurtenances
-apricocks
-april
-apron
-aprons
-apt
-apter
-aptest
-aptly
-aptness
-aqua
-aquilon
-aquitaine
-arabia
-arabian
-araise
-arbitrate
-arbitrating
-arbitrator
-arbitrement
-arbors
-arbour
-arc
-arch
-archbishop
-archbishopric
-archdeacon
-arched
-archelaus
-archer
-archers
-archery
-archibald
-archidamus
-architect
-arcu
-arde
-arden
-ardent
-ardour
-are
-argal
-argier
-argo
-argosies
-argosy
-argu
-argue
-argued
-argues
-arguing
-argument
-arguments
-argus
-ariachne
-ariadne
-ariel
-aries
-aright
-arinado
-arinies
-arion
-arise
-arises
-ariseth
-arising
-aristode
-aristotle
-arithmetic
-arithmetician
-ark
-arm
-arma
-armado
-armadoes
-armagnac
-arme
-armed
-armenia
-armies
-armigero
-arming
-armipotent
-armor
-armour
-armourer
-armourers
-armours
-armoury
-arms
-army
-arn
-aroint
-arose
-arouse
-aroused
-arragon
-arraign
-arraigned
-arraigning
-arraignment
-arrant
-arras
-array
-arrearages
-arrest
-arrested
-arrests
-arriv
-arrival
-arrivance
-arrive
-arrived
-arrives
-arriving
-arrogance
-arrogancy
-arrogant
-arrow
-arrows
-art
-artemidorus
-arteries
-arthur
-article
-articles
-articulate
-artificer
-artificial
-artillery
-artire
-artist
-artists
-artless
-artois
-arts
-artus
-arviragus
-as
-asaph
-ascanius
-ascend
-ascended
-ascendeth
-ascends
-ascension
-ascent
-ascribe
-ascribes
-ash
-asham
-ashamed
-asher
-ashes
-ashford
-ashore
-ashouting
-ashy
-asia
-aside
-ask
-askance
-asked
-asker
-asketh
-asking
-asks
-aslant
-asleep
-asmath
-asp
-aspect
-aspects
-aspen
-aspersion
-aspic
-aspicious
-aspics
-aspir
-aspiration
-aspire
-aspiring
-asquint
-ass
-assail
-assailable
-assailant
-assailants
-assailed
-assaileth
-assailing
-assails
-assassination
-assault
-assaulted
-assaults
-assay
-assaying
-assays
-assemblance
-assemble
-assembled
-assemblies
-assembly
-assent
-asses
-assez
-assign
-assigned
-assigns
-assinico
-assist
-assistance
-assistances
-assistant
-assistants
-assisted
-assisting
-associate
-associated
-associates
-assuage
-assubjugate
-assum
-assume
-assumes
-assumption
-assur
-assurance
-assure
-assured
-assuredly
-assures
-assyrian
-astonish
-astonished
-astraea
-astray
-astrea
-astronomer
-astronomers
-astronomical
-astronomy
-asunder
-at
-atalanta
-ate
-ates
-athenian
-athenians
-athens
-athol
-athversary
-athwart
-atlas
-atomies
-atomy
-atone
-atonement
-atonements
-atropos
-attach
-attached
-attachment
-attain
-attainder
-attains
-attaint
-attainted
-attainture
-attempt
-attemptable
-attempted
-attempting
-attempts
-attend
-attendance
-attendant
-attendants
-attended
-attendents
-attendeth
-attending
-attends
-attent
-attention
-attentive
-attentivenes
-attest
-attested
-attir
-attire
-attired
-attires
-attorney
-attorneyed
-attorneys
-attorneyship
-attract
-attraction
-attractive
-attracts
-attribute
-attributed
-attributes
-attribution
-attributive
-atwain
-au
-aubrey
-auburn
-aucun
-audacious
-audaciously
-audacity
-audible
-audience
-audis
-audit
-auditor
-auditors
-auditory
-audre
-audrey
-aufidius
-aufidiuses
-auger
-aught
-augment
-augmentation
-augmented
-augmenting
-augurer
-augurers
-augures
-auguring
-augurs
-augury
-august
-augustus
-auld
-aumerle
-aunchient
-aunt
-aunts
-auricular
-aurora
-auspicious
-aussi
-austere
-austerely
-austereness
-austerity
-austria
-aut
-authentic
-author
-authorities
-authority
-authorized
-authorizing
-authors
-autolycus
-autre
-autumn
-auvergne
-avail
-avails
-avarice
-avaricious
-avaunt
-ave
-aveng
-avenge
-avenged
-averring
-avert
-aves
-avez
-avis
-avoid
-avoided
-avoiding
-avoids
-avoirdupois
-avouch
-avouched
-avouches
-avouchment
-avow
-aw
-await
-awaits
-awak
-awake
-awaked
-awaken
-awakened
-awakens
-awakes
-awaking
-award
-awards
-awasy
-away
-awe
-aweary
-aweless
-awful
-awhile
-awkward
-awl
-awooing
-awork
-awry
-axe
-axle
-axletree
-ay
-aye
-ayez
-ayli
-azur
-azure
-b
-ba
-baa
-babbl
-babble
-babbling
-babe
-babes
-babies
-baboon
-baboons
-baby
-babylon
-bacare
-bacchanals
-bacchus
-bach
-bachelor
-bachelors
-back
-backbite
-backbitten
-backing
-backs
-backward
-backwardly
-backwards
-bacon
-bacons
-bad
-bade
-badge
-badged
-badges
-badly
-badness
-baes
-baffl
-baffle
-baffled
-bag
-baggage
-bagot
-bagpipe
-bags
-bail
-bailiff
-baillez
-baily
-baisant
-baisees
-baiser
-bait
-baited
-baiting
-baitings
-baits
-bajazet
-bak
-bake
-baked
-baker
-bakers
-bakes
-baking
-bal
-balanc
-balance
-balcony
-bald
-baldrick
-bale
-baleful
-balk
-ball
-ballad
-ballads
-ballast
-ballasting
-ballet
-ballow
-balls
-balm
-balms
-balmy
-balsam
-balsamum
-balth
-balthasar
-balthazar
-bames
-ban
-banbury
-band
-bandied
-banding
-bandit
-banditti
-banditto
-bands
-bandy
-bandying
-bane
-banes
-bang
-bangor
-banish
-banished
-banishers
-banishment
-banister
-bank
-bankrout
-bankrupt
-bankrupts
-banks
-banner
-bannerets
-banners
-banning
-banns
-banquet
-banqueted
-banqueting
-banquets
-banquo
-bans
-baptism
-baptista
-baptiz
-bar
-barbarian
-barbarians
-barbarism
-barbarous
-barbary
-barbason
-barbed
-barber
-barbermonger
-bard
-bardolph
-bards
-bare
-bared
-barefac
-barefaced
-barefoot
-bareheaded
-barely
-bareness
-barful
-bargain
-bargains
-barge
-bargulus
-baring
-bark
-barking
-barkloughly
-barks
-barky
-barley
-barm
-barn
-barnacles
-barnardine
-barne
-barnes
-barnet
-barns
-baron
-barons
-barony
-barr
-barrabas
-barrel
-barrels
-barren
-barrenly
-barrenness
-barricado
-barricadoes
-barrow
-bars
-barson
-barter
-bartholomew
-bas
-basan
-base
-baseless
-basely
-baseness
-baser
-bases
-basest
-bashful
-bashfulness
-basilisco
-basilisk
-basilisks
-basimecu
-basin
-basingstoke
-basins
-basis
-bask
-basket
-baskets
-bass
-bassanio
-basset
-bassianus
-basta
-bastard
-bastardizing
-bastardly
-bastards
-bastardy
-basted
-bastes
-bastinado
-basting
-bat
-batailles
-batch
-bate
-bated
-bates
-bath
-bathe
-bathed
-bathing
-baths
-bating
-batler
-bats
-batt
-battalia
-battalions
-batten
-batter
-battering
-batters
-battery
-battle
-battled
-battlefield
-battlements
-battles
-batty
-bauble
-baubles
-baubling
-baulk
-bavin
-bawcock
-bawd
-bawdry
-bawds
-bawdy
-bawl
-bawling
-bay
-baying
-baynard
-bayonne
-bays
-be
-beach
-beached
-beachy
-beacon
-bead
-beaded
-beadle
-beadles
-beads
-beadsmen
-beagle
-beagles
-beak
-beaks
-beam
-beamed
-beams
-bean
-beans
-bear
-beard
-bearded
-beardless
-beards
-bearer
-bearers
-bearest
-beareth
-bearing
-bears
-beast
-beastliest
-beastliness
-beastly
-beasts
-beat
-beated
-beaten
-beating
-beatrice
-beats
-beau
-beaufort
-beaumond
-beaumont
-beauteous
-beautied
-beauties
-beautified
-beautiful
-beautify
-beauty
-beaver
-beavers
-became
-because
-bechanc
-bechance
-bechanced
-beck
-beckon
-beckons
-becks
-becom
-become
-becomed
-becomes
-becoming
-becomings
-bed
-bedabbled
-bedash
-bedaub
-bedazzled
-bedchamber
-bedclothes
-bedded
-bedeck
-bedecking
-bedew
-bedfellow
-bedfellows
-bedford
-bedlam
-bedrench
-bedrid
-beds
-bedtime
-bedward
-bee
-beef
-beefs
-beehives
-been
-beer
-bees
-beest
-beetle
-beetles
-beeves
-befall
-befallen
-befalls
-befell
-befits
-befitted
-befitting
-befor
-before
-beforehand
-befortune
-befriend
-befriended
-befriends
-beg
-began
-beget
-begets
-begetting
-begg
-beggar
-beggared
-beggarly
-beggarman
-beggars
-beggary
-begging
-begin
-beginners
-beginning
-beginnings
-begins
-begnawn
-begone
-begot
-begotten
-begrimed
-begs
-beguil
-beguile
-beguiled
-beguiles
-beguiling
-begun
-behalf
-behalfs
-behav
-behaved
-behavedst
-behavior
-behaviors
-behaviour
-behaviours
-behead
-beheaded
-beheld
-behest
-behests
-behind
-behold
-beholder
-beholders
-beholdest
-beholding
-beholds
-behoof
-behooffull
-behooves
-behove
-behoves
-behowls
-being
-bel
-belarius
-belch
-belching
-beldam
-beldame
-beldams
-belee
-belgia
-belie
-belied
-belief
-beliest
-believ
-believe
-believed
-believes
-believest
-believing
-belike
-bell
-bellario
-belle
-bellied
-bellies
-bellman
-bellona
-bellow
-bellowed
-bellowing
-bellows
-bells
-belly
-bellyful
-belman
-belmont
-belock
-belong
-belonging
-belongings
-belongs
-belov
-beloved
-beloving
-below
-belt
-belzebub
-bemadding
-bemet
-bemete
-bemoan
-bemoaned
-bemock
-bemoil
-bemonster
-ben
-bench
-bencher
-benches
-bend
-bended
-bending
-bends
-bene
-beneath
-benedicite
-benedick
-benediction
-benedictus
-benefactors
-benefice
-beneficial
-benefit
-benefited
-benefits
-benetted
-benevolence
-benevolences
-benied
-benison
-bennet
-bent
-bentii
-bentivolii
-bents
-benumbed
-benvolio
-bepaint
-bepray
-bequeath
-bequeathed
-bequeathing
-bequest
-ber
-berard
-berattle
-beray
-bere
-bereave
-bereaved
-bereaves
-bereft
-bergamo
-bergomask
-berhym
-berhyme
-berkeley
-bermoothes
-bernardo
-berod
-berowne
-berri
-berries
-berrord
-berry
-bertram
-berwick
-bescreen
-beseech
-beseeched
-beseechers
-beseeching
-beseek
-beseem
-beseemeth
-beseeming
-beseems
-beset
-beshrew
-beside
-besides
-besieg
-besiege
-besieged
-beslubber
-besmear
-besmeared
-besmirch
-besom
-besort
-besotted
-bespake
-bespeak
-bespice
-bespoke
-bespotted
-bess
-bessy
-best
-bestained
-bested
-bestial
-bestir
-bestirr
-bestow
-bestowed
-bestowing
-bestows
-bestraught
-bestrew
-bestrid
-bestride
-bestrides
-bet
-betake
-beteem
-bethink
-bethought
-bethrothed
-bethump
-betid
-betide
-betideth
-betime
-betimes
-betoken
-betook
-betossed
-betray
-betrayed
-betraying
-betrays
-betrims
-betroth
-betrothed
-betroths
-bett
-betted
-better
-bettered
-bettering
-betters
-betting
-bettre
-between
-betwixt
-bevel
-beverage
-bevis
-bevy
-bewail
-bewailed
-bewailing
-bewails
-beware
-bewasted
-beweep
-bewept
-bewet
-bewhored
-bewitch
-bewitched
-bewitchment
-bewray
-beyond
-bezonian
-bezonians
-bianca
-bianco
-bias
-bibble
-bickerings
-bid
-bidden
-bidding
-biddings
-biddy
-bide
-bides
-biding
-bids
-bien
-bier
-bifold
-big
-bigamy
-biggen
-bigger
-bigness
-bigot
-bilberry
-bilbo
-bilboes
-bilbow
-bill
-billeted
-billets
-billiards
-billing
-billow
-billows
-bills
-bin
-bind
-bindeth
-binding
-binds
-biondello
-birch
-bird
-birding
-birdlime
-birds
-birnam
-birth
-birthday
-birthdom
-birthplace
-birthright
-birthrights
-births
-bis
-biscuit
-bishop
-bishops
-bisson
-bit
-bitch
-bite
-biter
-bites
-biting
-bits
-bitt
-bitten
-bitter
-bitterest
-bitterly
-bitterness
-blab
-blabb
-blabbing
-blabs
-black
-blackamoor
-blackamoors
-blackberries
-blackberry
-blacker
-blackest
-blackfriars
-blackheath
-blackmere
-blackness
-blacks
-bladder
-bladders
-blade
-bladed
-blades
-blains
-blam
-blame
-blamed
-blameful
-blameless
-blames
-blanc
-blanca
-blanch
-blank
-blanket
-blanks
-blaspheme
-blaspheming
-blasphemous
-blasphemy
-blast
-blasted
-blasting
-blastments
-blasts
-blaz
-blaze
-blazes
-blazing
-blazon
-blazoned
-blazoning
-bleach
-bleaching
-bleak
-blear
-bleared
-bleat
-bleated
-bleats
-bled
-bleed
-bleedest
-bleedeth
-bleeding
-bleeds
-blemish
-blemishes
-blench
-blenches
-blend
-blended
-blent
-bless
-blessed
-blessedly
-blessedness
-blesses
-blesseth
-blessing
-blessings
-blest
-blew
-blind
-blinded
-blindfold
-blinding
-blindly
-blindness
-blinds
-blink
-blinking
-bliss
-blist
-blister
-blisters
-blithe
-blithild
-bloat
-block
-blockish
-blocks
-blois
-blood
-blooded
-bloodhound
-bloodied
-bloodier
-bloodiest
-bloodily
-bloodless
-bloods
-bloodshed
-bloodshedding
-bloodstained
-bloody
-bloom
-blooms
-blossom
-blossoming
-blossoms
-blot
-blots
-blotted
-blotting
-blount
-blow
-blowed
-blowers
-blowest
-blowing
-blown
-blows
-blowse
-blubb
-blubber
-blubbering
-blue
-bluecaps
-bluest
-blunt
-blunted
-blunter
-bluntest
-blunting
-bluntly
-bluntness
-blunts
-blur
-blurr
-blurs
-blush
-blushes
-blushest
-blushing
-blust
-bluster
-blusterer
-blusters
-bo
-boar
-board
-boarded
-boarding
-boards
-boarish
-boars
-boast
-boasted
-boastful
-boasting
-boasts
-boat
-boats
-boatswain
-bob
-bobb
-boblibindo
-bobtail
-bocchus
-bode
-boded
-bodements
-bodes
-bodg
-bodied
-bodies
-bodiless
-bodily
-boding
-bodkin
-body
-bodykins
-bog
-boggle
-boggler
-bogs
-bohemia
-bohemian
-bohun
-boil
-boiling
-boils
-boist
-boisterous
-boisterously
-boitier
-bold
-bolden
-bolder
-boldest
-boldly
-boldness
-bolds
-bolingbroke
-bolster
-bolt
-bolted
-bolter
-bolters
-bolting
-bolts
-bombard
-bombards
-bombast
-bon
-bona
-bond
-bondage
-bonded
-bondmaid
-bondman
-bondmen
-bonds
-bondslave
-bone
-boneless
-bones
-bonfire
-bonfires
-bonjour
-bonne
-bonnet
-bonneted
-bonny
-bonos
-bonto
-bonville
-bood
-book
-bookish
-books
-boon
-boor
-boorish
-boors
-boot
-booted
-booties
-bootless
-boots
-booty
-bor
-bora
-borachio
-bordeaux
-border
-bordered
-borderers
-borders
-bore
-boreas
-bores
-boring
-born
-borne
-borough
-boroughs
-borrow
-borrowed
-borrower
-borrowing
-borrows
-bosko
-boskos
-bosky
-bosom
-bosoms
-boson
-boss
-bosworth
-botch
-botcher
-botches
-botchy
-both
-bots
-bottle
-bottled
-bottles
-bottom
-bottomless
-bottoms
-bouciqualt
-bouge
-bough
-boughs
-bought
-bounce
-bouncing
-bound
-bounded
-bounden
-boundeth
-bounding
-boundless
-bounds
-bounteous
-bounteously
-bounties
-bountiful
-bountifully
-bounty
-bourbier
-bourbon
-bourchier
-bourdeaux
-bourn
-bout
-bouts
-bove
-bow
-bowcase
-bowed
-bowels
-bower
-bowing
-bowl
-bowler
-bowling
-bowls
-bows
-bowsprit
-bowstring
-box
-boxes
-boy
-boyet
-boyish
-boys
-brabant
-brabantio
-brabble
-brabbler
-brac
-brace
-bracelet
-bracelets
-brach
-bracy
-brag
-bragg
-braggardism
-braggards
-braggart
-braggarts
-bragged
-bragging
-bragless
-brags
-braid
-braided
-brain
-brained
-brainford
-brainish
-brainless
-brains
-brainsick
-brainsickly
-brake
-brakenbury
-brakes
-brambles
-bran
-branch
-branches
-branchless
-brand
-branded
-brandish
-brandon
-brands
-bras
-brass
-brassy
-brat
-brats
-brav
-brave
-braved
-bravely
-braver
-bravery
-braves
-bravest
-braving
-brawl
-brawler
-brawling
-brawls
-brawn
-brawns
-bray
-braying
-braz
-brazen
-brazier
-breach
-breaches
-bread
-breadth
-break
-breaker
-breakfast
-breaking
-breaks
-breast
-breasted
-breasting
-breastplate
-breasts
-breath
-breathe
-breathed
-breather
-breathers
-breathes
-breathest
-breathing
-breathless
-breaths
-brecknock
-bred
-breech
-breeches
-breeching
-breed
-breeder
-breeders
-breeding
-breeds
-breese
-breeze
-breff
-bretagne
-brethen
-bretheren
-brethren
-brevis
-brevity
-brew
-brewage
-brewer
-brewers
-brewing
-brews
-briareus
-briars
-brib
-bribe
-briber
-bribes
-brick
-bricklayer
-bricks
-bridal
-bride
-bridegroom
-bridegrooms
-brides
-bridge
-bridgenorth
-bridges
-bridget
-bridle
-bridled
-brief
-briefer
-briefest
-briefly
-briefness
-brier
-briers
-brigandine
-bright
-brighten
-brightest
-brightly
-brightness
-brim
-brimful
-brims
-brimstone
-brinded
-brine
-bring
-bringer
-bringeth
-bringing
-bringings
-brings
-brinish
-brink
-brisk
-brisky
-bristle
-bristled
-bristly
-bristol
-bristow
-britain
-britaine
-britaines
-british
-briton
-britons
-brittany
-brittle
-broach
-broached
-broad
-broader
-broadsides
-brocas
-brock
-brogues
-broil
-broiling
-broils
-broke
-broken
-brokenly
-broker
-brokers
-brokes
-broking
-brooch
-brooches
-brood
-brooded
-brooding
-brook
-brooks
-broom
-broomstaff
-broth
-brothel
-brother
-brotherhood
-brotherhoods
-brotherly
-brothers
-broths
-brought
-brow
-brown
-browner
-brownist
-browny
-brows
-browse
-browsing
-bruis
-bruise
-bruised
-bruises
-bruising
-bruit
-bruited
-brundusium
-brunt
-brush
-brushes
-brute
-brutish
-brutus
-bubble
-bubbles
-bubbling
-bubukles
-buck
-bucket
-buckets
-bucking
-buckingham
-buckle
-buckled
-buckler
-bucklers
-bucklersbury
-buckles
-buckram
-bucks
-bud
-budded
-budding
-budge
-budger
-budget
-buds
-buff
-buffet
-buffeting
-buffets
-bug
-bugbear
-bugle
-bugs
-build
-builded
-buildeth
-building
-buildings
-builds
-built
-bulk
-bulks
-bull
-bullcalf
-bullen
-bullens
-bullet
-bullets
-bullocks
-bulls
-bully
-bulmer
-bulwark
-bulwarks
-bum
-bumbast
-bump
-bumper
-bums
-bunch
-bunches
-bundle
-bung
-bunghole
-bungle
-bunting
-buoy
-bur
-burbolt
-burd
-burden
-burdened
-burdening
-burdenous
-burdens
-burgh
-burgher
-burghers
-burglary
-burgomasters
-burgonet
-burgundy
-burial
-buried
-burier
-buriest
-burly
-burn
-burned
-burnet
-burneth
-burning
-burnish
-burns
-burnt
-burr
-burrows
-burs
-burst
-bursting
-bursts
-burthen
-burthens
-burton
-bury
-burying
-bush
-bushels
-bushes
-bushy
-busied
-busily
-busines
-business
-businesses
-buskin
-busky
-buss
-busses
-bussing
-bustle
-bustling
-busy
-but
-butcheed
-butcher
-butchered
-butcheries
-butcherly
-butchers
-butchery
-butler
-butt
-butter
-buttered
-butterflies
-butterfly
-butterwoman
-buttery
-buttock
-buttocks
-button
-buttonhole
-buttons
-buttress
-buttry
-butts
-buxom
-buy
-buyer
-buying
-buys
-buzz
-buzzard
-buzzards
-buzzers
-buzzing
-by
-bye
-byzantium
-c
-ca
-cabbage
-cabileros
-cabin
-cabins
-cable
-cables
-cackling
-cacodemon
-caddis
-caddisses
-cade
-cadence
-cadent
-cades
-cadmus
-caduceus
-cadwal
-cadwallader
-caelius
-caelo
-caesar
-caesarion
-caesars
-cage
-caged
-cagion
-cain
-caithness
-caitiff
-caitiffs
-caius
-cak
-cake
-cakes
-calaber
-calais
-calamities
-calamity
-calchas
-calculate
-calen
-calendar
-calendars
-calf
-caliban
-calibans
-calipolis
-cality
-caliver
-call
-callat
-called
-callet
-calling
-calls
-calm
-calmest
-calmly
-calmness
-calms
-calpurnia
-calumniate
-calumniating
-calumnious
-calumny
-calve
-calved
-calves
-calveskins
-calydon
-cam
-cambio
-cambria
-cambric
-cambrics
-cambridge
-cambyses
-came
-camel
-camelot
-camels
-camest
-camillo
-camlet
-camomile
-camp
-campeius
-camping
-camps
-can
-canakin
-canaries
-canary
-cancel
-cancell
-cancelled
-cancelling
-cancels
-cancer
-candidatus
-candied
-candle
-candles
-candlesticks
-candy
-canidius
-cank
-canker
-cankerblossom
-cankers
-cannibally
-cannibals
-cannon
-cannoneer
-cannons
-cannot
-canon
-canoniz
-canonize
-canonized
-canons
-canopied
-canopies
-canopy
-canst
-canstick
-canterbury
-cantle
-cantons
-canus
-canvas
-canvass
-canzonet
-cap
-capability
-capable
-capacities
-capacity
-caparison
-capdv
-cape
-capel
-capels
-caper
-capers
-capet
-caphis
-capilet
-capitaine
-capital
-capite
-capitol
-capitulate
-capocchia
-capon
-capons
-capp
-cappadocia
-capriccio
-capricious
-caps
-capt
-captain
-captains
-captainship
-captious
-captivate
-captivated
-captivates
-captive
-captives
-captivity
-captum
-capucius
-capulet
-capulets
-car
-carack
-caracks
-carat
-caraways
-carbonado
-carbuncle
-carbuncled
-carbuncles
-carcanet
-carcase
-carcases
-carcass
-carcasses
-card
-cardecue
-carded
-carders
-cardinal
-cardinally
-cardinals
-cardmaker
-cards
-carduus
-care
-cared
-career
-careers
-careful
-carefully
-careless
-carelessly
-carelessness
-cares
-caret
-cargo
-carl
-carlisle
-carlot
-carman
-carmen
-carnal
-carnally
-carnarvonshire
-carnation
-carnations
-carol
-carous
-carouse
-caroused
-carouses
-carousing
-carp
-carpenter
-carper
-carpet
-carpets
-carping
-carriage
-carriages
-carried
-carrier
-carriers
-carries
-carrion
-carrions
-carry
-carrying
-cars
-cart
-carters
-carthage
-carts
-carv
-carve
-carved
-carver
-carves
-carving
-cas
-casa
-casaer
-casca
-case
-casement
-casements
-cases
-cash
-cashier
-casing
-cask
-casket
-casketed
-caskets
-casque
-casques
-cassado
-cassandra
-cassibelan
-cassio
-cassius
-cassocks
-cast
-castalion
-castaway
-castaways
-casted
-caster
-castigate
-castigation
-castile
-castiliano
-casting
-castle
-castles
-casts
-casual
-casually
-casualties
-casualty
-cat
-cataian
-catalogue
-cataplasm
-cataracts
-catarrhs
-catastrophe
-catch
-catcher
-catches
-catching
-cate
-catechising
-catechism
-catechize
-cater
-caterpillars
-caters
-caterwauling
-cates
-catesby
-cathedral
-catlike
-catling
-catlings
-cato
-cats
-cattle
-caucasus
-caudle
-cauf
-caught
-cauldron
-caus
-cause
-caused
-causeless
-causer
-causes
-causest
-causeth
-cautel
-cautelous
-cautels
-cauterizing
-caution
-cautions
-cavaleiro
-cavalery
-cavaliers
-cave
-cavern
-caverns
-caves
-caveto
-caviary
-cavil
-cavilling
-cawdor
-cawdron
-cawing
-ce
-ceas
-cease
-ceases
-ceaseth
-cedar
-cedars
-cedius
-celebrate
-celebrated
-celebrates
-celebration
-celerity
-celestial
-celia
-cell
-cellar
-cellarage
-celsa
-cement
-censer
-censor
-censorinus
-censur
-censure
-censured
-censurers
-censures
-censuring
-centaur
-centaurs
-centre
-cents
-centuries
-centurion
-centurions
-century
-cerberus
-cerecloth
-cerements
-ceremonial
-ceremonies
-ceremonious
-ceremoniously
-ceremony
-ceres
-cerns
-certain
-certainer
-certainly
-certainties
-certainty
-certes
-certificate
-certified
-certifies
-certify
-ces
-cesario
-cess
-cesse
-cestern
-cetera
-cette
-chaces
-chaf
-chafe
-chafed
-chafes
-chaff
-chaffless
-chafing
-chain
-chains
-chair
-chairs
-chalic
-chalice
-chalices
-chalk
-chalks
-chalky
-challeng
-challenge
-challenged
-challenger
-challengers
-challenges
-cham
-chamber
-chamberers
-chamberlain
-chamberlains
-chambermaid
-chambermaids
-chambers
-chameleon
-champ
-champagne
-champain
-champains
-champion
-champions
-chanc
-chance
-chanced
-chancellor
-chances
-chandler
-chang
-change
-changeable
-changed
-changeful
-changeling
-changelings
-changer
-changes
-changest
-changing
-channel
-channels
-chanson
-chant
-chanticleer
-chanting
-chantries
-chantry
-chants
-chaos
-chap
-chape
-chapel
-chapeless
-chapels
-chaplain
-chaplains
-chapless
-chaplet
-chapmen
-chaps
-chapter
-character
-charactered
-characterless
-characters
-charactery
-characts
-charbon
-chare
-chares
-charg
-charge
-charged
-chargeful
-charges
-chargeth
-charging
-chariest
-chariness
-charing
-chariot
-chariots
-charitable
-charitably
-charities
-charity
-charlemain
-charles
-charm
-charmed
-charmer
-charmeth
-charmian
-charming
-charmingly
-charms
-charneco
-charnel
-charolois
-charon
-charter
-charters
-chartreux
-chary
-charybdis
-chas
-chase
-chased
-chaser
-chaseth
-chasing
-chaste
-chastely
-chastis
-chastise
-chastised
-chastisement
-chastity
-chat
-chatham
-chatillon
-chats
-chatt
-chattels
-chatter
-chattering
-chattles
-chaud
-chaunted
-chaw
-chawdron
-che
-cheap
-cheapen
-cheaper
-cheapest
-cheaply
-cheapside
-cheat
-cheated
-cheater
-cheaters
-cheating
-cheats
-check
-checked
-checker
-checking
-checks
-cheek
-cheeks
-cheer
-cheered
-cheerer
-cheerful
-cheerfully
-cheering
-cheerless
-cheerly
-cheers
-cheese
-chequer
-cher
-cherish
-cherished
-cherisher
-cherishes
-cherishing
-cherries
-cherry
-cherrypit
-chertsey
-cherub
-cherubims
-cherubin
-cherubins
-cheshu
-chess
-chest
-chester
-chestnut
-chestnuts
-chests
-chetas
-chev
-cheval
-chevalier
-chevaliers
-cheveril
-chew
-chewed
-chewet
-chewing
-chez
-chi
-chick
-chicken
-chickens
-chicurmurco
-chid
-chidden
-chide
-chiders
-chides
-chiding
-chief
-chiefest
-chiefly
-chien
-child
-childed
-childeric
-childhood
-childhoods
-childing
-childish
-childishness
-childlike
-childness
-children
-chill
-chilling
-chime
-chimes
-chimney
-chimneypiece
-chimneys
-chimurcho
-chin
-china
-chine
-chines
-chink
-chinks
-chins
-chipp
-chipper
-chips
-chiron
-chirping
-chirrah
-chirurgeonly
-chisel
-chitopher
-chivalrous
-chivalry
-choice
-choicely
-choicest
-choir
-choirs
-chok
-choke
-choked
-chokes
-choking
-choler
-choleric
-cholers
-chollors
-choose
-chooser
-chooses
-chooseth
-choosing
-chop
-chopine
-choplogic
-chopp
-chopped
-chopping
-choppy
-chops
-chopt
-chor
-choristers
-chorus
-chose
-chosen
-chough
-choughs
-chrish
-christ
-christen
-christendom
-christendoms
-christening
-christenings
-christian
-christianlike
-christians
-christmas
-christom
-christopher
-christophero
-chronicle
-chronicled
-chronicler
-chroniclers
-chronicles
-chrysolite
-chuck
-chucks
-chud
-chuffs
-church
-churches
-churchman
-churchmen
-churchyard
-churchyards
-churl
-churlish
-churlishly
-churls
-churn
-chus
-cicatrice
-cicatrices
-cicely
-cicero
-ciceter
-ciel
-ciitzens
-cilicia
-cimber
-cimmerian
-cinable
-cincture
-cinders
-cine
-cinna
-cinque
-cipher
-ciphers
-circa
-circe
-circle
-circled
-circlets
-circling
-circuit
-circum
-circumcised
-circumference
-circummur
-circumscrib
-circumscribed
-circumscription
-circumspect
-circumstance
-circumstanced
-circumstances
-circumstantial
-circumvent
-circumvention
-cistern
-citadel
-cital
-cite
-cited
-cites
-cities
-citing
-citizen
-citizens
-cittern
-city
-civet
-civil
-civility
-civilly
-clack
-clad
-claim
-claiming
-claims
-clamb
-clamber
-clammer
-clamor
-clamorous
-clamors
-clamour
-clamours
-clang
-clangor
-clap
-clapp
-clapped
-clapper
-clapping
-claps
-clare
-clarence
-claret
-claribel
-clasp
-clasps
-clatter
-claud
-claudio
-claudius
-clause
-claw
-clawed
-clawing
-claws
-clay
-clays
-clean
-cleanliest
-cleanly
-cleans
-cleanse
-cleansing
-clear
-clearer
-clearest
-clearly
-clearness
-clears
-cleave
-cleaving
-clef
-cleft
-cleitus
-clemency
-clement
-cleomenes
-cleopatpa
-cleopatra
-clepeth
-clept
-clerestories
-clergy
-clergyman
-clergymen
-clerk
-clerkly
-clerks
-clew
-client
-clients
-cliff
-clifford
-cliffords
-cliffs
-clifton
-climate
-climature
-climb
-climbed
-climber
-climbeth
-climbing
-climbs
-clime
-cling
-clink
-clinking
-clinquant
-clip
-clipp
-clipper
-clippeth
-clipping
-clipt
-clitus
-clo
-cloak
-cloakbag
-cloaks
-clock
-clocks
-clod
-cloddy
-clodpole
-clog
-clogging
-clogs
-cloister
-cloistress
-cloquence
-clos
-close
-closed
-closely
-closeness
-closer
-closes
-closest
-closet
-closing
-closure
-cloten
-clotens
-cloth
-clothair
-clotharius
-clothe
-clothes
-clothier
-clothiers
-clothing
-cloths
-clotpoles
-clotpoll
-cloud
-clouded
-cloudiness
-clouds
-cloudy
-clout
-clouted
-clouts
-cloven
-clover
-cloves
-clovest
-clowder
-clown
-clownish
-clowns
-cloy
-cloyed
-cloying
-cloyless
-cloyment
-cloys
-club
-clubs
-cluck
-clung
-clust
-clusters
-clutch
-clyster
-cneius
-cnemies
-co
-coach
-coaches
-coachmakers
-coact
-coactive
-coagulate
-coal
-coals
-coarse
-coarsely
-coast
-coasting
-coasts
-coat
-coated
-coats
-cobble
-cobbled
-cobbler
-cobham
-cobloaf
-cobweb
-cobwebs
-cock
-cockatrice
-cockatrices
-cockle
-cockled
-cockney
-cockpit
-cocks
-cocksure
-coctus
-cocytus
-cod
-codding
-codling
-codpiece
-codpieces
-cods
-coelestibus
-coesar
-coeur
-coffer
-coffers
-coffin
-coffins
-cog
-cogging
-cogitation
-cogitations
-cognition
-cognizance
-cogscomb
-cohabitants
-coher
-cohere
-coherence
-coherent
-cohorts
-coif
-coign
-coil
-coin
-coinage
-coiner
-coining
-coins
-col
-colbrand
-colchos
-cold
-colder
-coldest
-coldly
-coldness
-coldspur
-colebrook
-colic
-collar
-collars
-collateral
-colleagued
-collect
-collected
-collection
-college
-colleges
-collied
-collier
-colliers
-collop
-collusion
-colme
-colmekill
-coloquintida
-color
-colors
-colossus
-colour
-colourable
-coloured
-colouring
-colours
-colt
-colted
-colts
-columbine
-columbines
-colville
-com
-comagene
-comart
-comb
-combat
-combatant
-combatants
-combated
-combating
-combin
-combinate
-combination
-combine
-combined
-combless
-combustion
-come
-comedian
-comedians
-comedy
-comeliness
-comely
-comer
-comers
-comes
-comest
-comet
-cometh
-comets
-comfect
-comfit
-comfits
-comfort
-comfortable
-comforted
-comforter
-comforting
-comfortless
-comforts
-comic
-comical
-coming
-comings
-cominius
-comma
-command
-commande
-commanded
-commander
-commanders
-commanding
-commandment
-commandments
-commands
-comme
-commenc
-commence
-commenced
-commencement
-commences
-commencing
-commend
-commendable
-commendation
-commendations
-commended
-commending
-commends
-comment
-commentaries
-commenting
-comments
-commerce
-commingled
-commiseration
-commission
-commissioners
-commissions
-commit
-commits
-committ
-committed
-committing
-commix
-commixed
-commixtion
-commixture
-commodious
-commodities
-commodity
-common
-commonalty
-commoner
-commoners
-commonly
-commons
-commonweal
-commonwealth
-commotion
-commotions
-commune
-communicat
-communicate
-communication
-communities
-community
-comonty
-compact
-companies
-companion
-companions
-companionship
-company
-compar
-comparative
-compare
-compared
-comparing
-comparison
-comparisons
-compartner
-compass
-compasses
-compassing
-compassion
-compassionate
-compeers
-compel
-compell
-compelled
-compelling
-compels
-compensation
-competence
-competency
-competent
-competitor
-competitors
-compil
-compile
-compiled
-complain
-complainer
-complainest
-complaining
-complainings
-complains
-complaint
-complaints
-complement
-complements
-complete
-complexion
-complexioned
-complexions
-complices
-complies
-compliment
-complimental
-compliments
-complot
-complots
-complotted
-comply
-compos
-compose
-composed
-composition
-compost
-composture
-composure
-compound
-compounded
-compounds
-comprehend
-comprehended
-comprehends
-compremises
-compris
-comprising
-compromis
-compromise
-compt
-comptible
-comptrollers
-compulsatory
-compulsion
-compulsive
-compunctious
-computation
-comrade
-comrades
-comutual
-con
-concave
-concavities
-conceal
-concealed
-concealing
-concealment
-concealments
-conceals
-conceit
-conceited
-conceitless
-conceits
-conceiv
-conceive
-conceived
-conceives
-conceiving
-conception
-conceptions
-conceptious
-concern
-concernancy
-concerneth
-concerning
-concernings
-concerns
-conclave
-conclud
-conclude
-concluded
-concludes
-concluding
-conclusion
-conclusions
-concolinel
-concord
-concubine
-concupiscible
-concupy
-concur
-concurring
-concurs
-condemn
-condemnation
-condemned
-condemning
-condemns
-condescend
-condign
-condition
-conditionally
-conditions
-condole
-condolement
-condoling
-conduce
-conduct
-conducted
-conducting
-conductor
-conduit
-conduits
-conected
-coney
-confection
-confectionary
-confections
-confederacy
-confederate
-confederates
-confer
-conference
-conferr
-conferring
-confess
-confessed
-confesses
-confesseth
-confessing
-confession
-confessions
-confessor
-confidence
-confident
-confidently
-confin
-confine
-confined
-confineless
-confiners
-confines
-confining
-confirm
-confirmation
-confirmations
-confirmed
-confirmer
-confirmers
-confirming
-confirmities
-confirms
-confiscate
-confiscated
-confiscation
-confixed
-conflict
-conflicting
-conflicts
-confluence
-conflux
-conform
-conformable
-confound
-confounded
-confounding
-confounds
-confront
-confronted
-confus
-confused
-confusedly
-confusion
-confusions
-confutation
-confutes
-congeal
-congealed
-congealment
-congee
-conger
-congest
-congied
-congratulate
-congreeing
-congreeted
-congregate
-congregated
-congregation
-congregations
-congruent
-congruing
-conies
-conjectural
-conjecture
-conjectures
-conjoin
-conjoined
-conjoins
-conjointly
-conjunct
-conjunction
-conjunctive
-conjur
-conjuration
-conjurations
-conjure
-conjured
-conjurer
-conjurers
-conjures
-conjuring
-conjuro
-conn
-connected
-connive
-conqu
-conquer
-conquered
-conquering
-conqueror
-conquerors
-conquers
-conquest
-conquests
-conquring
-conrade
-cons
-consanguineous
-consanguinity
-conscienc
-conscience
-consciences
-conscionable
-consecrate
-consecrated
-consecrations
-consent
-consented
-consenting
-consents
-consequence
-consequences
-consequently
-conserve
-conserved
-conserves
-consider
-considerance
-considerate
-consideration
-considerations
-considered
-considering
-considerings
-considers
-consign
-consigning
-consist
-consisteth
-consisting
-consistory
-consists
-consolate
-consolation
-consonancy
-consonant
-consort
-consorted
-consortest
-conspectuities
-conspir
-conspiracy
-conspirant
-conspirator
-conspirators
-conspire
-conspired
-conspirers
-conspires
-conspiring
-constable
-constables
-constance
-constancies
-constancy
-constant
-constantine
-constantinople
-constantly
-constellation
-constitution
-constrain
-constrained
-constraineth
-constrains
-constraint
-constring
-construction
-construe
-consul
-consuls
-consulship
-consulships
-consult
-consulting
-consults
-consum
-consume
-consumed
-consumes
-consuming
-consummate
-consummation
-consumption
-consumptions
-contagion
-contagious
-contain
-containing
-contains
-contaminate
-contaminated
-contemn
-contemned
-contemning
-contemns
-contemplate
-contemplation
-contemplative
-contempt
-contemptible
-contempts
-contemptuous
-contemptuously
-contend
-contended
-contending
-contendon
-content
-contenta
-contented
-contenteth
-contention
-contentious
-contentless
-contento
-contents
-contest
-contestation
-continence
-continency
-continent
-continents
-continu
-continual
-continually
-continuance
-continuantly
-continuate
-continue
-continued
-continuer
-continues
-continuing
-contract
-contracted
-contracting
-contraction
-contradict
-contradicted
-contradiction
-contradicts
-contraries
-contrarieties
-contrariety
-contrarious
-contrariously
-contrary
-contre
-contribution
-contributors
-contrite
-contriv
-contrive
-contrived
-contriver
-contrives
-contriving
-control
-controll
-controller
-controlling
-controlment
-controls
-controversy
-contumelious
-contumeliously
-contumely
-contusions
-convenience
-conveniences
-conveniency
-convenient
-conveniently
-convented
-conventicles
-convents
-convers
-conversant
-conversation
-conversations
-converse
-conversed
-converses
-conversing
-conversion
-convert
-converted
-convertest
-converting
-convertite
-convertites
-converts
-convey
-conveyance
-conveyances
-conveyers
-conveying
-convict
-convicted
-convince
-convinced
-convinces
-convive
-convocation
-convoy
-convulsions
-cony
-cook
-cookery
-cooks
-cool
-cooled
-cooling
-cools
-coop
-coops
-cop
-copatain
-cope
-cophetua
-copied
-copies
-copious
-copper
-copperspur
-coppice
-copulation
-copulatives
-copy
-cor
-coragio
-coral
-coram
-corambus
-coranto
-corantos
-corbo
-cord
-corded
-cordelia
-cordial
-cordis
-cords
-core
-corin
-corinth
-corinthian
-coriolanus
-corioli
-cork
-corky
-cormorant
-corn
-cornelia
-cornelius
-corner
-corners
-cornerstone
-cornets
-cornish
-corns
-cornuto
-cornwall
-corollary
-coronal
-coronation
-coronet
-coronets
-corporal
-corporals
-corporate
-corpse
-corpulent
-correct
-corrected
-correcting
-correction
-correctioner
-corrects
-correspondence
-correspondent
-corresponding
-corresponsive
-corrigible
-corrival
-corrivals
-corroborate
-corrosive
-corrupt
-corrupted
-corrupter
-corrupters
-corruptible
-corruptibly
-corrupting
-corruption
-corruptly
-corrupts
-corse
-corses
-corslet
-cosmo
-cost
-costard
-costermongers
-costlier
-costly
-costs
-cot
-cote
-coted
-cotsall
-cotsole
-cotswold
-cottage
-cottages
-cotus
-couch
-couched
-couching
-couchings
-coude
-cough
-coughing
-could
-couldst
-coulter
-council
-councillor
-councils
-counsel
-counsell
-counsellor
-counsellors
-counselor
-counselors
-counsels
-count
-counted
-countenanc
-countenance
-countenances
-counter
-counterchange
-countercheck
-counterfeit
-counterfeited
-counterfeiting
-counterfeitly
-counterfeits
-countermand
-countermands
-countermines
-counterpart
-counterpoints
-counterpois
-counterpoise
-counters
-countervail
-countess
-countesses
-counties
-counting
-countless
-countries
-countrv
-country
-countryman
-countrymen
-counts
-county
-couper
-couple
-coupled
-couplement
-couples
-couplet
-couplets
-cour
-courage
-courageous
-courageously
-courages
-courier
-couriers
-couronne
-cours
-course
-coursed
-courser
-coursers
-courses
-coursing
-court
-courted
-courteous
-courteously
-courtesan
-courtesies
-courtesy
-courtezan
-courtezans
-courtier
-courtiers
-courtlike
-courtly
-courtney
-courts
-courtship
-cousin
-cousins
-couterfeit
-coutume
-covenant
-covenants
-covent
-coventry
-cover
-covered
-covering
-coverlet
-covers
-covert
-covertly
-coverture
-covet
-coveted
-coveting
-covetings
-covetous
-covetously
-covetousness
-covets
-cow
-coward
-cowarded
-cowardice
-cowardly
-cowards
-cowardship
-cowish
-cowl
-cowslip
-cowslips
-cox
-coxcomb
-coxcombs
-coy
-coystrill
-coz
-cozen
-cozenage
-cozened
-cozener
-cozeners
-cozening
-coziers
-crab
-crabbed
-crabs
-crack
-cracked
-cracker
-crackers
-cracking
-cracks
-cradle
-cradled
-cradles
-craft
-crafted
-craftied
-craftier
-craftily
-crafts
-craftsmen
-crafty
-cram
-cramm
-cramp
-cramps
-crams
-cranking
-cranks
-cranmer
-crannied
-crannies
-cranny
-crants
-crare
-crash
-crassus
-crav
-crave
-craved
-craven
-cravens
-craves
-craveth
-craving
-crawl
-crawling
-crawls
-craz
-crazed
-crazy
-creaking
-cream
-create
-created
-creates
-creating
-creation
-creator
-creature
-creatures
-credence
-credent
-credible
-credit
-creditor
-creditors
-credo
-credulity
-credulous
-creed
-creek
-creeks
-creep
-creeping
-creeps
-crept
-crescent
-crescive
-cressets
-cressid
-cressida
-cressids
-cressy
-crest
-crested
-crestfall
-crestless
-crests
-cretan
-crete
-crevice
-crew
-crews
-crib
-cribb
-cribs
-cricket
-crickets
-cried
-criedst
-crier
-cries
-criest
-crieth
-crime
-crimeful
-crimeless
-crimes
-criminal
-crimson
-cringe
-cripple
-crisp
-crisped
-crispian
-crispianus
-crispin
-critic
-critical
-critics
-croak
-croaking
-croaks
-crocodile
-cromer
-cromwell
-crone
-crook
-crookback
-crooked
-crooking
-crop
-cropp
-crosby
-cross
-crossed
-crosses
-crossest
-crossing
-crossings
-crossly
-crossness
-crost
-crotchets
-crouch
-crouching
-crow
-crowd
-crowded
-crowding
-crowds
-crowflowers
-crowing
-crowkeeper
-crown
-crowned
-crowner
-crownet
-crownets
-crowning
-crowns
-crows
-crudy
-cruel
-cruell
-crueller
-cruelly
-cruels
-cruelty
-crum
-crumble
-crumbs
-crupper
-crusadoes
-crush
-crushed
-crushest
-crushing
-crust
-crusts
-crusty
-crutch
-crutches
-cry
-crying
-crystal
-crystalline
-crystals
-cub
-cubbert
-cubiculo
-cubit
-cubs
-cuckold
-cuckoldly
-cuckolds
-cuckoo
-cucullus
-cudgel
-cudgeled
-cudgell
-cudgelling
-cudgels
-cue
-cues
-cuff
-cuffs
-cuique
-cull
-culling
-cullion
-cullionly
-cullions
-culpable
-culverin
-cum
-cumber
-cumberland
-cunning
-cunningly
-cunnings
-cuore
-cup
-cupbearer
-cupboarding
-cupid
-cupids
-cuppele
-cups
-cur
-curan
-curate
-curb
-curbed
-curbing
-curbs
-curd
-curdied
-curds
-cure
-cured
-cureless
-curer
-cures
-curfew
-curing
-curio
-curiosity
-curious
-curiously
-curl
-curled
-curling
-curls
-currance
-currants
-current
-currents
-currish
-curry
-curs
-curse
-cursed
-curses
-cursies
-cursing
-cursorary
-curst
-curster
-curstest
-curstness
-cursy
-curtail
-curtain
-curtains
-curtal
-curtis
-curtle
-curtsied
-curtsies
-curtsy
-curvet
-curvets
-cushes
-cushion
-cushions
-custalorum
-custard
-custody
-custom
-customary
-customed
-customer
-customers
-customs
-custure
-cut
-cutler
-cutpurse
-cutpurses
-cuts
-cutter
-cutting
-cuttle
-cxsar
-cyclops
-cydnus
-cygnet
-cygnets
-cym
-cymbals
-cymbeline
-cyme
-cynic
-cynthia
-cypress
-cypriot
-cyprus
-cyrus
-cytherea
-d
-dabbled
-dace
-dad
-daedalus
-daemon
-daff
-daffed
-daffest
-daffodils
-dagger
-daggers
-dagonet
-daily
-daintier
-dainties
-daintiest
-daintily
-daintiness
-daintry
-dainty
-daisied
-daisies
-daisy
-dale
-dalliance
-dallied
-dallies
-dally
-dallying
-dalmatians
-dam
-damage
-damascus
-damask
-damasked
-dame
-dames
-damm
-damn
-damnable
-damnably
-damnation
-damned
-damns
-damoiselle
-damon
-damosella
-damp
-dams
-damsel
-damsons
-dan
-danc
-dance
-dancer
-dances
-dancing
-dandle
-dandy
-dane
-dang
-danger
-dangerous
-dangerously
-dangers
-dangling
-daniel
-danish
-dank
-dankish
-danskers
-daphne
-dappled
-dapples
-dar
-dardan
-dardanian
-dardanius
-dare
-dared
-dareful
-dares
-darest
-daring
-darius
-dark
-darken
-darkening
-darkens
-darker
-darkest
-darkling
-darkly
-darkness
-darling
-darlings
-darnel
-darraign
-dart
-darted
-darter
-dartford
-darting
-darts
-dash
-dashes
-dashing
-dastard
-dastards
-dat
-datchet
-date
-dated
-dateless
-dates
-daub
-daughter
-daughters
-daunt
-daunted
-dauntless
-dauphin
-daventry
-davy
-daw
-dawn
-dawning
-daws
-day
-daylight
-days
-dazzle
-dazzled
-dazzling
-de
-dead
-deadly
-deaf
-deafing
-deafness
-deafs
-deal
-dealer
-dealers
-dealest
-dealing
-dealings
-deals
-dealt
-dean
-deanery
-dear
-dearer
-dearest
-dearly
-dearness
-dears
-dearth
-dearths
-death
-deathbed
-deathful
-deaths
-deathsman
-deathsmen
-debarred
-debase
-debate
-debated
-debatement
-debateth
-debating
-debauch
-debile
-debility
-debitor
-debonair
-deborah
-debosh
-debt
-debted
-debtor
-debtors
-debts
-debuty
-decay
-decayed
-decayer
-decaying
-decays
-deceas
-decease
-deceased
-deceit
-deceitful
-deceits
-deceiv
-deceivable
-deceive
-deceived
-deceiver
-deceivers
-deceives
-deceivest
-deceiveth
-deceiving
-december
-decent
-deceptious
-decerns
-decide
-decides
-decimation
-decipher
-deciphers
-decision
-decius
-deck
-decking
-decks
-deckt
-declare
-declares
-declension
-declensions
-declin
-decline
-declined
-declines
-declining
-decoct
-decorum
-decreas
-decrease
-decreasing
-decree
-decreed
-decrees
-decrepit
-dedicate
-dedicated
-dedicates
-dedication
-deed
-deedless
-deeds
-deem
-deemed
-deep
-deeper
-deepest
-deeply
-deeps
-deepvow
-deer
-deesse
-defac
-deface
-defaced
-defacer
-defacers
-defacing
-defam
-default
-defeat
-defeated
-defeats
-defeatures
-defect
-defective
-defects
-defence
-defences
-defend
-defendant
-defended
-defender
-defenders
-defending
-defends
-defense
-defensible
-defensive
-defer
-deferr
-defiance
-deficient
-defied
-defies
-defil
-defile
-defiler
-defiles
-defiling
-define
-definement
-definite
-definitive
-definitively
-deflow
-deflower
-deflowered
-deform
-deformed
-deformities
-deformity
-deftly
-defunct
-defunction
-defuse
-defy
-defying
-degenerate
-degraded
-degree
-degrees
-deified
-deifying
-deign
-deigned
-deiphobus
-deities
-deity
-deja
-deject
-dejected
-delabreth
-delay
-delayed
-delaying
-delays
-delectable
-deliberate
-delicate
-delicates
-delicious
-deliciousness
-delight
-delighted
-delightful
-delights
-delinquents
-deliv
-deliver
-deliverance
-delivered
-delivering
-delivers
-delivery
-delphos
-deluded
-deluding
-deluge
-delve
-delver
-delves
-demand
-demanded
-demanding
-demands
-demean
-demeanor
-demeanour
-demerits
-demesnes
-demetrius
-demi
-demigod
-demise
-demoiselles
-demon
-demonstrable
-demonstrate
-demonstrated
-demonstrating
-demonstration
-demonstrative
-demure
-demurely
-demuring
-den
-denay
-deni
-denial
-denials
-denied
-denier
-denies
-deniest
-denis
-denmark
-dennis
-denny
-denote
-denoted
-denotement
-denounc
-denounce
-denouncing
-dens
-denunciation
-deny
-denying
-deo
-depart
-departed
-departest
-departing
-departure
-depeche
-depend
-dependant
-dependants
-depended
-dependence
-dependences
-dependency
-dependent
-dependents
-depender
-depending
-depends
-deplore
-deploring
-depopulate
-depos
-depose
-deposed
-deposing
-depositaries
-deprav
-depravation
-deprave
-depraved
-depraves
-depress
-depriv
-deprive
-depth
-depths
-deputation
-depute
-deputed
-deputies
-deputing
-deputy
-deracinate
-derby
-dercetas
-dere
-derides
-derision
-deriv
-derivation
-derivative
-derive
-derived
-derives
-derogate
-derogately
-derogation
-des
-desartless
-descant
-descend
-descended
-descending
-descends
-descension
-descent
-descents
-describe
-described
-describes
-descried
-description
-descriptions
-descry
-desdemon
-desdemona
-desert
-deserts
-deserv
-deserve
-deserved
-deservedly
-deserver
-deservers
-deserves
-deservest
-deserving
-deservings
-design
-designment
-designments
-designs
-desir
-desire
-desired
-desirers
-desires
-desirest
-desiring
-desirous
-desist
-desk
-desolate
-desolation
-desp
-despair
-despairing
-despairs
-despatch
-desperate
-desperately
-desperation
-despis
-despise
-despised
-despiser
-despiseth
-despising
-despite
-despiteful
-despoiled
-dest
-destin
-destined
-destinies
-destiny
-destitute
-destroy
-destroyed
-destroyer
-destroyers
-destroying
-destroys
-destruction
-destructions
-det
-detain
-detains
-detect
-detected
-detecting
-detection
-detector
-detects
-detention
-determin
-determinate
-determination
-determinations
-determine
-determined
-determines
-detest
-detestable
-detested
-detesting
-detests
-detract
-detraction
-detractions
-deucalion
-deuce
-deum
-deux
-devant
-devesting
-device
-devices
-devil
-devilish
-devils
-devis
-devise
-devised
-devises
-devising
-devoid
-devonshire
-devote
-devoted
-devotion
-devour
-devoured
-devourers
-devouring
-devours
-devout
-devoutly
-dew
-dewberries
-dewdrops
-dewlap
-dewlapp
-dews
-dewy
-dexter
-dexteriously
-dexterity
-di
-diable
-diablo
-diadem
-dial
-dialect
-dialogue
-dialogued
-dials
-diameter
-diamond
-diamonds
-dian
-diana
-diaper
-dibble
-dic
-dice
-dicers
-dich
-dick
-dickens
-dickon
-dicky
-dictator
-diction
-dictynna
-did
-diddle
-didest
-dido
-didst
-die
-died
-diedst
-dies
-diest
-diet
-dieted
-dieter
-dieu
-diff
-differ
-difference
-differences
-differency
-different
-differing
-differs
-difficile
-difficult
-difficulties
-difficulty
-diffidence
-diffidences
-diffus
-diffused
-diffusest
-dig
-digest
-digested
-digestion
-digestions
-digg
-digging
-dighton
-dignified
-dignifies
-dignify
-dignities
-dignity
-digress
-digressing
-digression
-digs
-digt
-dilate
-dilated
-dilations
-dilatory
-dild
-dildos
-dilemma
-dilemmas
-diligence
-diligent
-diluculo
-dim
-dimension
-dimensions
-diminish
-diminishing
-diminution
-diminutive
-diminutives
-dimm
-dimmed
-dimming
-dimpled
-dimples
-dims
-din
-dine
-dined
-diner
-dines
-ding
-dining
-dinner
-dinners
-dinnertime
-dint
-diomed
-diomede
-diomedes
-dion
-dip
-dipp
-dipping
-dips
-dir
-dire
-direct
-directed
-directing
-direction
-directions
-directitude
-directive
-directly
-directs
-direful
-direness
-direst
-dirge
-dirges
-dirt
-dirty
-dis
-disability
-disable
-disabled
-disabling
-disadvantage
-disagree
-disallow
-disanimates
-disannul
-disannuls
-disappointed
-disarm
-disarmed
-disarmeth
-disarms
-disaster
-disasters
-disastrous
-disbench
-disbranch
-disburdened
-disburs
-disburse
-disbursed
-discandy
-discandying
-discard
-discarded
-discase
-discased
-discern
-discerner
-discerning
-discernings
-discerns
-discharg
-discharge
-discharged
-discharging
-discipled
-disciples
-disciplin
-discipline
-disciplined
-disciplines
-disclaim
-disclaiming
-disclaims
-disclos
-disclose
-disclosed
-discloses
-discolour
-discoloured
-discolours
-discomfit
-discomfited
-discomfiture
-discomfort
-discomfortable
-discommend
-disconsolate
-discontent
-discontented
-discontentedly
-discontenting
-discontents
-discontinue
-discontinued
-discord
-discordant
-discords
-discourse
-discoursed
-discourser
-discourses
-discoursive
-discourtesy
-discov
-discover
-discovered
-discoverers
-discoveries
-discovering
-discovers
-discovery
-discredit
-discredited
-discredits
-discreet
-discreetly
-discretion
-discretions
-discuss
-disdain
-disdained
-disdaineth
-disdainful
-disdainfully
-disdaining
-disdains
-disdnguish
-diseas
-disease
-diseased
-diseases
-disedg
-disembark
-disfigure
-disfigured
-disfurnish
-disgorge
-disgrac
-disgrace
-disgraced
-disgraceful
-disgraces
-disgracing
-disgracious
-disguis
-disguise
-disguised
-disguiser
-disguises
-disguising
-dish
-dishabited
-dishclout
-dishearten
-disheartens
-dishes
-dishonest
-dishonestly
-dishonesty
-dishonor
-dishonorable
-dishonors
-dishonour
-dishonourable
-dishonoured
-dishonours
-disinherit
-disinherited
-disjoin
-disjoining
-disjoins
-disjoint
-disjunction
-dislik
-dislike
-disliken
-dislikes
-dislimns
-dislocate
-dislodg
-disloyal
-disloyalty
-dismal
-dismantle
-dismantled
-dismask
-dismay
-dismayed
-dismemb
-dismember
-dismes
-dismiss
-dismissed
-dismissing
-dismission
-dismount
-dismounted
-disnatur
-disobedience
-disobedient
-disobey
-disobeys
-disorb
-disorder
-disordered
-disorderly
-disorders
-disparage
-disparagement
-disparagements
-dispark
-dispatch
-dispensation
-dispense
-dispenses
-dispers
-disperse
-dispersed
-dispersedly
-dispersing
-dispiteous
-displac
-displace
-displaced
-displant
-displanting
-display
-displayed
-displeas
-displease
-displeased
-displeasing
-displeasure
-displeasures
-disponge
-disport
-disports
-dispos
-dispose
-disposed
-disposer
-disposing
-disposition
-dispositions
-dispossess
-dispossessing
-disprais
-dispraise
-dispraising
-dispraisingly
-dispropertied
-disproportion
-disproportioned
-disprov
-disprove
-disproved
-dispursed
-disputable
-disputation
-disputations
-dispute
-disputed
-disputes
-disputing
-disquantity
-disquiet
-disquietly
-disrelish
-disrobe
-disseat
-dissemble
-dissembled
-dissembler
-dissemblers
-dissembling
-dissembly
-dissension
-dissensions
-dissentious
-dissever
-dissipation
-dissolute
-dissolutely
-dissolution
-dissolutions
-dissolv
-dissolve
-dissolved
-dissolves
-dissuade
-dissuaded
-distaff
-distaffs
-distain
-distains
-distance
-distant
-distaste
-distasted
-distasteful
-distemp
-distemper
-distemperature
-distemperatures
-distempered
-distempering
-distil
-distill
-distillation
-distilled
-distills
-distilment
-distinct
-distinction
-distinctly
-distingue
-distinguish
-distinguishes
-distinguishment
-distract
-distracted
-distractedly
-distraction
-distractions
-distracts
-distrain
-distraught
-distress
-distressed
-distresses
-distressful
-distribute
-distributed
-distribution
-distrust
-distrustful
-disturb
-disturbed
-disturbers
-disturbing
-disunite
-disvalued
-disvouch
-dit
-ditch
-ditchers
-ditches
-dites
-ditties
-ditty
-diurnal
-div
-dive
-diver
-divers
-diversely
-diversity
-divert
-diverted
-diverts
-dives
-divest
-dividable
-dividant
-divide
-divided
-divides
-divideth
-divin
-divination
-divine
-divinely
-divineness
-diviner
-divines
-divinest
-divining
-divinity
-division
-divisions
-divorc
-divorce
-divorced
-divorcement
-divorcing
-divulg
-divulge
-divulged
-divulging
-dizy
-dizzy
-do
-doating
-dobbin
-dock
-docks
-doct
-doctor
-doctors
-doctrine
-document
-dodge
-doe
-doer
-doers
-does
-doest
-doff
-dog
-dogberry
-dogfish
-dogg
-dogged
-dogs
-doigts
-doing
-doings
-doit
-doits
-dolabella
-dole
-doleful
-doll
-dollar
-dollars
-dolor
-dolorous
-dolour
-dolours
-dolphin
-dolt
-dolts
-domestic
-domestics
-dominance
-dominations
-dominator
-domine
-domineer
-domineering
-dominical
-dominion
-dominions
-domitius
-dommelton
-don
-donalbain
-donation
-donc
-doncaster
-done
-dong
-donn
-donne
-donner
-donnerai
-doom
-doomsday
-door
-doorkeeper
-doors
-dorcas
-doreus
-doricles
-dormouse
-dorothy
-dorset
-dorsetshire
-dost
-dotage
-dotant
-dotard
-dotards
-dote
-doted
-doters
-dotes
-doteth
-doth
-doting
-double
-doubled
-doubleness
-doubler
-doublet
-doublets
-doubling
-doubly
-doubt
-doubted
-doubtful
-doubtfully
-doubting
-doubtless
-doubts
-doug
-dough
-doughty
-doughy
-douglas
-dout
-doute
-douts
-dove
-dovehouse
-dover
-doves
-dow
-dowager
-dowdy
-dower
-dowerless
-dowers
-dowlas
-dowle
-down
-downfall
-downright
-downs
-downstairs
-downtrod
-downward
-downwards
-downy
-dowries
-dowry
-dowsabel
-doxy
-dozed
-dozen
-dozens
-dozy
-drab
-drabbing
-drabs
-drachma
-drachmas
-draff
-drag
-dragg
-dragged
-dragging
-dragon
-dragonish
-dragons
-drain
-drained
-drains
-drake
-dram
-dramatis
-drank
-draught
-draughts
-drave
-draw
-drawbridge
-drawer
-drawers
-draweth
-drawing
-drawling
-drawn
-draws
-drayman
-draymen
-dread
-dreaded
-dreadful
-dreadfully
-dreading
-dreads
-dream
-dreamer
-dreamers
-dreaming
-dreams
-dreamt
-drearning
-dreary
-dreg
-dregs
-drench
-drenched
-dress
-dressed
-dresser
-dressing
-dressings
-drest
-drew
-dribbling
-dried
-drier
-dries
-drift
-drily
-drink
-drinketh
-drinking
-drinkings
-drinks
-driv
-drive
-drivelling
-driven
-drives
-driveth
-driving
-drizzle
-drizzled
-drizzles
-droit
-drollery
-dromio
-dromios
-drone
-drones
-droop
-droopeth
-drooping
-droops
-drop
-dropheir
-droplets
-dropp
-dropper
-droppeth
-dropping
-droppings
-drops
-dropsied
-dropsies
-dropsy
-dropt
-dross
-drossy
-drought
-drove
-droven
-drovier
-drown
-drowned
-drowning
-drowns
-drows
-drowse
-drowsily
-drowsiness
-drowsy
-drudge
-drudgery
-drudges
-drug
-drugg
-drugs
-drum
-drumble
-drummer
-drumming
-drums
-drunk
-drunkard
-drunkards
-drunken
-drunkenly
-drunkenness
-dry
-dryness
-dst
-du
-dub
-dubb
-ducat
-ducats
-ducdame
-duchess
-duchies
-duchy
-duck
-ducking
-ducks
-dudgeon
-due
-duellist
-duello
-duer
-dues
-duff
-dug
-dugs
-duke
-dukedom
-dukedoms
-dukes
-dulcet
-dulche
-dull
-dullard
-duller
-dullest
-dulling
-dullness
-dulls
-dully
-dulness
-duly
-dumain
-dumb
-dumbe
-dumbly
-dumbness
-dump
-dumps
-dun
-duncan
-dung
-dungeon
-dungeons
-dunghill
-dunghills
-dungy
-dunnest
-dunsinane
-dunsmore
-dunstable
-dupp
-durance
-during
-durst
-dusky
-dust
-dusted
-dusty
-dutch
-dutchman
-duteous
-duties
-dutiful
-duty
-dwarf
-dwarfish
-dwell
-dwellers
-dwelling
-dwells
-dwelt
-dwindle
-dy
-dye
-dyed
-dyer
-dying
-e
-each
-eager
-eagerly
-eagerness
-eagle
-eagles
-eaning
-eanlings
-ear
-earing
-earl
-earldom
-earlier
-earliest
-earliness
-earls
-early
-earn
-earned
-earnest
-earnestly
-earnestness
-earns
-ears
-earth
-earthen
-earthlier
-earthly
-earthquake
-earthquakes
-earthy
-eas
-ease
-eased
-easeful
-eases
-easier
-easiest
-easiliest
-easily
-easiness
-easing
-east
-eastcheap
-easter
-eastern
-eastward
-easy
-eat
-eaten
-eater
-eaters
-eating
-eats
-eaux
-eaves
-ebb
-ebbing
-ebbs
-ebon
-ebony
-ebrew
-ecce
-echapper
-echo
-echoes
-eclips
-eclipse
-eclipses
-ecolier
-ecoutez
-ecstacy
-ecstasies
-ecstasy
-ecus
-eden
-edg
-edgar
-edge
-edged
-edgeless
-edges
-edict
-edicts
-edifice
-edifices
-edified
-edifies
-edition
-edm
-edmund
-edmunds
-edmundsbury
-educate
-educated
-education
-edward
-eel
-eels
-effect
-effected
-effectless
-effects
-effectual
-effectually
-effeminate
-effigies
-effus
-effuse
-effusion
-eftest
-egal
-egally
-eget
-egeus
-egg
-eggs
-eggshell
-eglamour
-eglantine
-egma
-ego
-egregious
-egregiously
-egress
-egypt
-egyptian
-egyptians
-eie
-eight
-eighteen
-eighth
-eightpenny
-eighty
-eisel
-either
-eject
-eke
-el
-elbe
-elbow
-elbows
-eld
-elder
-elders
-eldest
-eleanor
-elect
-elected
-election
-elegancy
-elegies
-element
-elements
-elephant
-elephants
-elevated
-eleven
-eleventh
-elf
-elflocks
-eliads
-elinor
-elizabeth
-ell
-elle
-ellen
-elm
-eloquence
-eloquent
-else
-elsewhere
-elsinore
-eltham
-elves
-elvish
-ely
-elysium
-em
-emballing
-embalm
-embalms
-embark
-embarked
-embarquements
-embassade
-embassage
-embassies
-embassy
-embattailed
-embattl
-embattle
-embay
-embellished
-embers
-emblaze
-emblem
-emblems
-embodied
-embold
-emboldens
-emboss
-embossed
-embounded
-embowel
-embowell
-embrac
-embrace
-embraced
-embracement
-embracements
-embraces
-embracing
-embrasures
-embroider
-embroidery
-emhracing
-emilia
-eminence
-eminent
-eminently
-emmanuel
-emnity
-empale
-emperal
-emperess
-emperial
-emperor
-empery
-emphasis
-empire
-empirics
-empiricutic
-empleached
-employ
-employed
-employer
-employment
-employments
-empoison
-empress
-emptied
-emptier
-empties
-emptiness
-empty
-emptying
-emulate
-emulation
-emulations
-emulator
-emulous
-en
-enact
-enacted
-enacts
-enactures
-enamell
-enamelled
-enamour
-enamoured
-enanmour
-encamp
-encamped
-encave
-enceladus
-enchaf
-enchafed
-enchant
-enchanted
-enchanting
-enchantingly
-enchantment
-enchantress
-enchants
-enchas
-encircle
-encircled
-enclos
-enclose
-enclosed
-encloses
-encloseth
-enclosing
-enclouded
-encompass
-encompassed
-encompasseth
-encompassment
-encore
-encorporal
-encount
-encounter
-encountered
-encounters
-encourage
-encouraged
-encouragement
-encrimsoned
-encroaching
-encumb
-end
-endamage
-endamagement
-endanger
-endart
-endear
-endeared
-endeavour
-endeavours
-ended
-ender
-ending
-endings
-endite
-endless
-endow
-endowed
-endowments
-endows
-ends
-endu
-endue
-endur
-endurance
-endure
-endured
-endures
-enduring
-endymion
-eneas
-enemies
-enemy
-enernies
-enew
-enfeebled
-enfeebles
-enfeoff
-enfetter
-enfoldings
-enforc
-enforce
-enforced
-enforcedly
-enforcement
-enforces
-enforcest
-enfranched
-enfranchis
-enfranchise
-enfranchised
-enfranchisement
-enfreed
-enfreedoming
-engag
-engage
-engaged
-engagements
-engaging
-engaol
-engend
-engender
-engenders
-engilds
-engine
-engineer
-enginer
-engines
-engirt
-england
-english
-englishman
-englishmen
-engluts
-englutted
-engraffed
-engraft
-engrafted
-engrav
-engrave
-engross
-engrossed
-engrossest
-engrossing
-engrossments
-enguard
-enigma
-enigmatical
-enjoin
-enjoined
-enjoy
-enjoyed
-enjoyer
-enjoying
-enjoys
-enkindle
-enkindled
-enlard
-enlarg
-enlarge
-enlarged
-enlargement
-enlargeth
-enlighten
-enlink
-enmesh
-enmities
-enmity
-ennoble
-ennobled
-enobarb
-enobarbus
-enon
-enormity
-enormous
-enough
-enow
-enpatron
-enpierced
-enquir
-enquire
-enquired
-enrag
-enrage
-enraged
-enrages
-enrank
-enrapt
-enrich
-enriched
-enriches
-enridged
-enrings
-enrob
-enrobe
-enroll
-enrolled
-enrooted
-enrounded
-enschedul
-ensconce
-ensconcing
-enseamed
-ensear
-enseigne
-enseignez
-ensemble
-enshelter
-enshielded
-enshrines
-ensign
-ensigns
-enskied
-ensman
-ensnare
-ensnared
-ensnareth
-ensteep
-ensu
-ensue
-ensued
-ensues
-ensuing
-enswathed
-ent
-entail
-entame
-entangled
-entangles
-entendre
-enter
-entered
-entering
-enterprise
-enterprises
-enters
-entertain
-entertained
-entertainer
-entertaining
-entertainment
-entertainments
-enthrall
-enthralled
-enthron
-enthroned
-entice
-enticements
-enticing
-entire
-entirely
-entitle
-entitled
-entitling
-entomb
-entombed
-entrails
-entrance
-entrances
-entrap
-entrapp
-entre
-entreat
-entreated
-entreaties
-entreating
-entreatments
-entreats
-entreaty
-entrench
-entry
-entwist
-envelop
-envenom
-envenomed
-envenoms
-envied
-envies
-envious
-enviously
-environ
-environed
-envoy
-envy
-envying
-enwheel
-enwombed
-enwraps
-ephesian
-ephesians
-ephesus
-epicure
-epicurean
-epicures
-epicurism
-epicurus
-epidamnum
-epidaurus
-epigram
-epilepsy
-epileptic
-epilogue
-epilogues
-epistles
-epistrophus
-epitaph
-epitaphs
-epithet
-epitheton
-epithets
-epitome
-equal
-equalities
-equality
-equall
-equally
-equalness
-equals
-equinoctial
-equinox
-equipage
-equity
-equivocal
-equivocate
-equivocates
-equivocation
-equivocator
-er
-erbear
-erbearing
-erbears
-erbeat
-erblows
-erboard
-erborne
-ercame
-ercast
-ercharg
-ercharged
-ercharging
-ercles
-ercome
-ercover
-ercrows
-erdoing
-ere
-erebus
-erect
-erected
-erecting
-erection
-erects
-erewhile
-erflourish
-erflow
-erflowing
-erflows
-erfraught
-erga
-ergalled
-erglanced
-ergo
-ergone
-ergrow
-ergrown
-ergrowth
-erhang
-erhanging
-erhasty
-erhear
-erheard
-eringoes
-erjoy
-erleap
-erleaps
-erleavens
-erlook
-erlooking
-ermaster
-ermengare
-ermount
-ern
-ernight
-eros
-erpaid
-erparted
-erpast
-erpays
-erpeer
-erperch
-erpicturing
-erpingham
-erposting
-erpow
-erpress
-erpressed
-err
-errand
-errands
-errant
-errate
-erraught
-erreaches
-erred
-errest
-erring
-erroneous
-error
-errors
-errs
-errule
-errun
-erset
-ershade
-ershades
-ershine
-ershot
-ersized
-erskip
-erslips
-erspreads
-erst
-erstare
-erstep
-erstunk
-ersway
-ersways
-erswell
-erta
-ertake
-erteemed
-erthrow
-erthrown
-erthrows
-ertook
-ertop
-ertopping
-ertrip
-erturn
-erudition
-eruption
-eruptions
-ervalues
-erwalk
-erwatch
-erween
-erweens
-erweigh
-erweighs
-erwhelm
-erwhelmed
-erworn
-es
-escalus
-escap
-escape
-escaped
-escapes
-eschew
-escoted
-esill
-especial
-especially
-esperance
-espials
-espied
-espies
-espous
-espouse
-espy
-esquire
-esquires
-essay
-essays
-essence
-essential
-essentially
-esses
-essex
-est
-establish
-established
-estate
-estates
-esteem
-esteemed
-esteemeth
-esteeming
-esteems
-estimable
-estimate
-estimation
-estimations
-estime
-estranged
-estridge
-estridges
-et
-etc
-etceteras
-ete
-eternal
-eternally
-eterne
-eternity
-eterniz
-etes
-ethiop
-ethiope
-ethiopes
-ethiopian
-etna
-eton
-etre
-eunuch
-eunuchs
-euphrates
-euphronius
-euriphile
-europa
-europe
-ev
-evade
-evades
-evans
-evasion
-evasions
-eve
-even
-evening
-evenly
-event
-eventful
-events
-ever
-everlasting
-everlastingly
-evermore
-every
-everyone
-everything
-everywhere
-evidence
-evidences
-evident
-evil
-evilly
-evils
-evitate
-ewe
-ewer
-ewers
-ewes
-exact
-exacted
-exactest
-exacting
-exaction
-exactions
-exactly
-exacts
-exalt
-exalted
-examin
-examination
-examinations
-examine
-examined
-examines
-exampl
-example
-exampled
-examples
-exasperate
-exasperates
-exceed
-exceeded
-exceedeth
-exceeding
-exceedingly
-exceeds
-excel
-excelled
-excellence
-excellencies
-excellency
-excellent
-excellently
-excelling
-excels
-except
-excepted
-excepting
-exception
-exceptions
-exceptless
-excess
-excessive
-exchang
-exchange
-exchanged
-exchequer
-exchequers
-excite
-excited
-excitements
-excites
-exclaim
-exclaims
-exclamation
-exclamations
-excludes
-excommunicate
-excommunication
-excrement
-excrements
-excursion
-excursions
-excus
-excusable
-excuse
-excused
-excuses
-excusez
-excusing
-execrable
-execrations
-execute
-executed
-executing
-execution
-executioner
-executioners
-executor
-executors
-exempt
-exempted
-exequies
-exercise
-exercises
-exeter
-exeunt
-exhal
-exhalation
-exhalations
-exhale
-exhales
-exhaust
-exhibit
-exhibiters
-exhibition
-exhort
-exhortation
-exigent
-exil
-exile
-exiled
-exion
-exist
-exists
-exit
-exits
-exorciser
-exorcisms
-exorcist
-expect
-expectance
-expectancy
-expectation
-expectations
-expected
-expecters
-expecting
-expects
-expedience
-expedient
-expediently
-expedition
-expeditious
-expel
-expell
-expelling
-expels
-expend
-expense
-expenses
-experienc
-experience
-experiences
-experiment
-experimental
-experiments
-expert
-expertness
-expiate
-expiation
-expir
-expiration
-expire
-expired
-expires
-expiring
-explication
-exploit
-exploits
-expos
-expose
-exposing
-exposition
-expositor
-expostulate
-expostulation
-exposture
-exposure
-expound
-expounded
-express
-expressed
-expresseth
-expressing
-expressive
-expressly
-expressure
-expuls
-expulsion
-exquisite
-exsufflicate
-extant
-extemporal
-extemporally
-extempore
-extend
-extended
-extends
-extent
-extenuate
-extenuated
-extenuates
-extenuation
-exterior
-exteriorly
-exteriors
-extermin
-extern
-external
-extinct
-extincted
-extincture
-extinguish
-extirp
-extirpate
-extirped
-extol
-extoll
-extolment
-exton
-extort
-extorted
-extortion
-extortions
-extra
-extract
-extracted
-extracting
-extraordinarily
-extraordinary
-extraught
-extravagancy
-extravagant
-extreme
-extremely
-extremes
-extremest
-extremities
-extremity
-exuent
-exult
-exultation
-ey
-eyas
-eyases
-eye
-eyeball
-eyeballs
-eyebrow
-eyebrows
-eyed
-eyeless
-eyelid
-eyelids
-eyes
-eyesight
-eyestrings
-eying
-eyne
-eyrie
-fa
-fabian
-fable
-fables
-fabric
-fabulous
-fac
-face
-faced
-facere
-faces
-faciant
-facile
-facility
-facinerious
-facing
-facit
-fact
-faction
-factionary
-factions
-factious
-factor
-factors
-faculties
-faculty
-fade
-faded
-fadeth
-fadge
-fading
-fadings
-fadom
-fadoms
-fagot
-fagots
-fail
-failing
-fails
-fain
-faint
-fainted
-fainter
-fainting
-faintly
-faintness
-faints
-fair
-fairer
-fairest
-fairies
-fairing
-fairings
-fairly
-fairness
-fairs
-fairwell
-fairy
-fais
-fait
-faites
-faith
-faithful
-faithfull
-faithfully
-faithless
-faiths
-faitors
-fal
-falchion
-falcon
-falconbridge
-falconer
-falconers
-fall
-fallacy
-fallen
-falleth
-falliable
-fallible
-falling
-fallow
-fallows
-falls
-fally
-falorous
-false
-falsehood
-falsely
-falseness
-falser
-falsify
-falsing
-falstaff
-falstaffs
-falter
-fam
-fame
-famed
-familiar
-familiarity
-familiarly
-familiars
-family
-famine
-famish
-famished
-famous
-famoused
-famously
-fan
-fanatical
-fancies
-fancy
-fane
-fanes
-fang
-fangled
-fangless
-fangs
-fann
-fanning
-fans
-fantasied
-fantasies
-fantastic
-fantastical
-fantastically
-fantasticoes
-fantasy
-fap
-far
-farborough
-farced
-fardel
-fardels
-fare
-fares
-farewell
-farewells
-fariner
-faring
-farm
-farmer
-farmhouse
-farms
-farre
-farrow
-farther
-farthest
-farthing
-farthingale
-farthingales
-farthings
-fartuous
-fas
-fashion
-fashionable
-fashioning
-fashions
-fast
-fasted
-fasten
-fastened
-faster
-fastest
-fasting
-fastly
-fastolfe
-fasts
-fat
-fatal
-fatally
-fate
-fated
-fates
-father
-fathered
-fatherless
-fatherly
-fathers
-fathom
-fathomless
-fathoms
-fatigate
-fatness
-fats
-fatted
-fatter
-fattest
-fatting
-fatuus
-fauconbridge
-faulconbridge
-fault
-faultiness
-faultless
-faults
-faulty
-fausse
-fauste
-faustuses
-faut
-favor
-favorable
-favorably
-favors
-favour
-favourable
-favoured
-favouredly
-favourer
-favourers
-favouring
-favourite
-favourites
-favours
-favout
-fawn
-fawneth
-fawning
-fawns
-fay
-fe
-fealty
-fear
-feared
-fearest
-fearful
-fearfull
-fearfully
-fearfulness
-fearing
-fearless
-fears
-feast
-feasted
-feasting
-feasts
-feat
-feated
-feater
-feather
-feathered
-feathers
-featly
-feats
-featur
-feature
-featured
-featureless
-features
-february
-fecks
-fed
-fedary
-federary
-fee
-feeble
-feebled
-feebleness
-feebling
-feebly
-feed
-feeder
-feeders
-feedeth
-feeding
-feeds
-feel
-feeler
-feeling
-feelingly
-feels
-fees
-feet
-fehemently
-feign
-feigned
-feigning
-feil
-feith
-felicitate
-felicity
-fell
-fellest
-fellies
-fellow
-fellowly
-fellows
-fellowship
-fellowships
-fells
-felon
-felonious
-felony
-felt
-female
-females
-feminine
-fen
-fenc
-fence
-fencer
-fencing
-fends
-fennel
-fenny
-fens
-fenton
-fer
-ferdinand
-fere
-fernseed
-ferrara
-ferrers
-ferret
-ferry
-ferryman
-fertile
-fertility
-fervency
-fervour
-fery
-fest
-feste
-fester
-festinate
-festinately
-festival
-festivals
-fet
-fetch
-fetches
-fetching
-fetlock
-fetlocks
-fett
-fetter
-fettering
-fetters
-fettle
-feu
-feud
-fever
-feverous
-fevers
-few
-fewer
-fewest
-fewness
-fickle
-fickleness
-fico
-fiction
-fiddle
-fiddler
-fiddlestick
-fidele
-fidelicet
-fidelity
-fidius
-fie
-field
-fielded
-fields
-fiend
-fiends
-fierce
-fiercely
-fierceness
-fiery
-fife
-fifes
-fifteen
-fifteens
-fifteenth
-fifth
-fifty
-fiftyfold
-fig
-fight
-fighter
-fightest
-fighteth
-fighting
-fights
-figo
-figs
-figur
-figure
-figured
-figures
-figuring
-fike
-fil
-filberts
-filch
-filches
-filching
-file
-filed
-files
-filial
-filius
-fill
-filled
-fillet
-filling
-fillip
-fills
-filly
-film
-fils
-filth
-filths
-filthy
-fin
-finally
-finch
-find
-finder
-findeth
-finding
-findings
-finds
-fine
-fineless
-finely
-finem
-fineness
-finer
-fines
-finest
-fing
-finger
-fingering
-fingers
-fingre
-fingres
-finical
-finish
-finished
-finisher
-finless
-finn
-fins
-finsbury
-fir
-firago
-fire
-firebrand
-firebrands
-fired
-fires
-firework
-fireworks
-firing
-firk
-firm
-firmament
-firmly
-firmness
-first
-firstlings
-fish
-fisher
-fishermen
-fishers
-fishes
-fishified
-fishmonger
-fishpond
-fisnomy
-fist
-fisting
-fists
-fistula
-fit
-fitchew
-fitful
-fitly
-fitment
-fitness
-fits
-fitted
-fitter
-fittest
-fitteth
-fitting
-fitzwater
-five
-fivepence
-fives
-fix
-fixed
-fixes
-fixeth
-fixing
-fixture
-fl
-flag
-flagging
-flagon
-flagons
-flags
-flail
-flakes
-flaky
-flam
-flame
-flamen
-flamens
-flames
-flaming
-flaminius
-flanders
-flannel
-flap
-flaring
-flash
-flashes
-flashing
-flask
-flat
-flatly
-flatness
-flats
-flatt
-flatter
-flattered
-flatterer
-flatterers
-flatterest
-flatteries
-flattering
-flatters
-flattery
-flaunts
-flavio
-flavius
-flaw
-flaws
-flax
-flaxen
-flay
-flaying
-flea
-fleance
-fleas
-flecked
-fled
-fledge
-flee
-fleec
-fleece
-fleeces
-fleer
-fleering
-fleers
-fleet
-fleeter
-fleeting
-fleming
-flemish
-flesh
-fleshes
-fleshly
-fleshment
-fleshmonger
-flew
-flexible
-flexure
-flibbertigibbet
-flickering
-flidge
-fliers
-flies
-flieth
-flight
-flights
-flighty
-flinch
-fling
-flint
-flints
-flinty
-flirt
-float
-floated
-floating
-flock
-flocks
-flood
-floodgates
-floods
-floor
-flora
-florence
-florentine
-florentines
-florentius
-florizel
-flote
-floulish
-flour
-flourish
-flourishes
-flourisheth
-flourishing
-flout
-flouted
-flouting
-flouts
-flow
-flowed
-flower
-flowerets
-flowers
-flowing
-flown
-flows
-fluellen
-fluent
-flung
-flush
-flushing
-fluster
-flute
-flutes
-flutter
-flux
-fluxive
-fly
-flying
-fo
-foal
-foals
-foam
-foamed
-foaming
-foams
-foamy
-fob
-focative
-fodder
-foe
-foeman
-foemen
-foes
-fog
-foggy
-fogs
-foh
-foi
-foil
-foiled
-foils
-foin
-foining
-foins
-fois
-foison
-foisons
-foist
-foix
-fold
-folded
-folds
-folio
-folk
-folks
-follies
-follow
-followed
-follower
-followers
-followest
-following
-follows
-folly
-fond
-fonder
-fondly
-fondness
-font
-fontibell
-food
-fool
-fooleries
-foolery
-foolhardy
-fooling
-foolish
-foolishly
-foolishness
-fools
-foot
-football
-footboy
-footboys
-footed
-footfall
-footing
-footman
-footmen
-footpath
-footsteps
-footstool
-fopp
-fopped
-foppery
-foppish
-fops
-for
-forage
-foragers
-forbade
-forbear
-forbearance
-forbears
-forbid
-forbidden
-forbiddenly
-forbids
-forbod
-forborne
-forc
-force
-forced
-forceful
-forceless
-forces
-forcible
-forcibly
-forcing
-ford
-fordid
-fordo
-fordoes
-fordone
-fore
-forecast
-forefather
-forefathers
-forefinger
-forego
-foregone
-forehand
-forehead
-foreheads
-forehorse
-foreign
-foreigner
-foreigners
-foreknowing
-foreknowledge
-foremost
-forenamed
-forenoon
-forerun
-forerunner
-forerunning
-foreruns
-foresaid
-foresaw
-foresay
-foresee
-foreseeing
-foresees
-foreshow
-foreskirt
-forespent
-forest
-forestall
-forestalled
-forester
-foresters
-forests
-foretell
-foretelling
-foretells
-forethink
-forethought
-foretold
-forever
-foreward
-forewarn
-forewarned
-forewarning
-forfeit
-forfeited
-forfeiters
-forfeiting
-forfeits
-forfeiture
-forfeitures
-forfend
-forfended
-forg
-forgave
-forge
-forged
-forgeries
-forgery
-forges
-forget
-forgetful
-forgetfulness
-forgetive
-forgets
-forgetting
-forgive
-forgiven
-forgiveness
-forgo
-forgoing
-forgone
-forgot
-forgotten
-fork
-forked
-forks
-forlorn
-form
-formal
-formally
-formed
-former
-formerly
-formless
-forms
-fornication
-fornications
-fornicatress
-forres
-forrest
-forsake
-forsaken
-forsaketh
-forslow
-forsook
-forsooth
-forspent
-forspoke
-forswear
-forswearing
-forswore
-forsworn
-fort
-forted
-forth
-forthcoming
-forthlight
-forthright
-forthwith
-fortification
-fortifications
-fortified
-fortifies
-fortify
-fortinbras
-fortitude
-fortnight
-fortress
-fortresses
-forts
-fortun
-fortuna
-fortunate
-fortunately
-fortune
-fortuned
-fortunes
-fortward
-forty
-forum
-forward
-forwarding
-forwardness
-forwards
-forwearied
-fosset
-fost
-foster
-fostered
-fought
-foughten
-foul
-fouler
-foulest
-foully
-foulness
-found
-foundation
-foundations
-founded
-founder
-fount
-fountain
-fountains
-founts
-four
-fourscore
-fourteen
-fourth
-foutra
-fowl
-fowler
-fowling
-fowls
-fox
-foxes
-foxship
-fracted
-fraction
-fractions
-fragile
-fragment
-fragments
-fragrant
-frail
-frailer
-frailties
-frailty
-fram
-frame
-framed
-frames
-frampold
-fran
-francais
-france
-frances
-franchise
-franchised
-franchisement
-franchises
-franciae
-francis
-francisca
-franciscan
-francisco
-frank
-franker
-frankfort
-franklin
-franklins
-frankly
-frankness
-frantic
-franticly
-frateretto
-fratrum
-fraud
-fraudful
-fraught
-fraughtage
-fraughting
-fray
-frays
-freckl
-freckled
-freckles
-frederick
-free
-freed
-freedom
-freedoms
-freehearted
-freelier
-freely
-freeman
-freemen
-freeness
-freer
-frees
-freestone
-freetown
-freeze
-freezes
-freezing
-freezings
-french
-frenchman
-frenchmen
-frenchwoman
-frenzy
-frequent
-frequents
-fresh
-fresher
-freshes
-freshest
-freshly
-freshness
-fret
-fretful
-frets
-fretted
-fretten
-fretting
-friar
-friars
-friday
-fridays
-friend
-friended
-friending
-friendless
-friendliness
-friendly
-friends
-friendship
-friendships
-frieze
-fright
-frighted
-frightened
-frightful
-frighting
-frights
-fringe
-fringed
-frippery
-frisk
-fritters
-frivolous
-fro
-frock
-frog
-frogmore
-froissart
-frolic
-from
-front
-fronted
-frontier
-frontiers
-fronting
-frontlet
-fronts
-frost
-frosts
-frosty
-froth
-froward
-frown
-frowning
-frowningly
-frowns
-froze
-frozen
-fructify
-frugal
-fruit
-fruiterer
-fruitful
-fruitfully
-fruitfulness
-fruition
-fruitless
-fruits
-frush
-frustrate
-frutify
-fry
-fubb
-fuel
-fugitive
-fulfil
-fulfill
-fulfilling
-fulfils
-full
-fullam
-fuller
-fullers
-fullest
-fullness
-fully
-fulness
-fulsome
-fulvia
-fum
-fumble
-fumbles
-fumblest
-fumbling
-fume
-fumes
-fuming
-fumiter
-fumitory
-fun
-function
-functions
-fundamental
-funeral
-funerals
-fur
-furbish
-furies
-furious
-furlongs
-furnace
-furnaces
-furnish
-furnished
-furnishings
-furniture
-furnival
-furor
-furr
-furrow
-furrowed
-furrows
-furth
-further
-furtherance
-furtherer
-furthermore
-furthest
-fury
-furze
-furzes
-fust
-fustian
-fustilarian
-fusty
-fut
-future
-futurity
-g
-gabble
-gaberdine
-gabriel
-gad
-gadding
-gads
-gadshill
-gag
-gage
-gaged
-gagg
-gaging
-gagne
-gain
-gained
-gainer
-gaingiving
-gains
-gainsaid
-gainsay
-gainsaying
-gainsays
-gainst
-gait
-gaited
-galathe
-gale
-galen
-gales
-gall
-gallant
-gallantly
-gallantry
-gallants
-galled
-gallery
-galley
-galleys
-gallia
-gallian
-galliard
-galliasses
-gallimaufry
-galling
-gallons
-gallop
-galloping
-gallops
-gallow
-galloway
-gallowglasses
-gallows
-gallowses
-galls
-gallus
-gam
-gambol
-gambold
-gambols
-gamboys
-game
-gamers
-games
-gamesome
-gamester
-gaming
-gammon
-gamut
-gan
-gangren
-ganymede
-gaol
-gaoler
-gaolers
-gaols
-gap
-gape
-gapes
-gaping
-gar
-garb
-garbage
-garboils
-garcon
-gard
-garde
-garden
-gardener
-gardeners
-gardens
-gardez
-gardiner
-gardon
-gargantua
-gargrave
-garish
-garland
-garlands
-garlic
-garment
-garments
-garmet
-garner
-garners
-garnish
-garnished
-garret
-garrison
-garrisons
-gart
-garter
-garterd
-gartering
-garters
-gascony
-gash
-gashes
-gaskins
-gasp
-gasping
-gasted
-gastness
-gat
-gate
-gated
-gates
-gath
-gather
-gathered
-gathering
-gathers
-gatories
-gatory
-gaud
-gaudeo
-gaudy
-gauge
-gaul
-gaultree
-gaunt
-gauntlet
-gauntlets
-gav
-gave
-gavest
-gawded
-gawds
-gawsey
-gay
-gayness
-gaz
-gaze
-gazed
-gazer
-gazers
-gazes
-gazeth
-gazing
-gear
-geck
-geese
-geffrey
-geld
-gelded
-gelding
-gelida
-gelidus
-gelt
-gem
-geminy
-gems
-gen
-gender
-genders
-general
-generally
-generals
-generation
-generations
-generative
-generosity
-generous
-genitive
-genitivo
-genius
-gennets
-genoa
-genoux
-gens
-gent
-gentilhomme
-gentility
-gentle
-gentlefolks
-gentleman
-gentlemanlike
-gentlemen
-gentleness
-gentler
-gentles
-gentlest
-gentlewoman
-gentlewomen
-gently
-gentry
-george
-gerard
-germaines
-germains
-german
-germane
-germans
-germany
-gertrude
-gest
-gests
-gesture
-gestures
-get
-getrude
-gets
-getter
-getting
-ghastly
-ghost
-ghosted
-ghostly
-ghosts
-gi
-giant
-giantess
-giantlike
-giants
-gib
-gibber
-gibbet
-gibbets
-gibe
-giber
-gibes
-gibing
-gibingly
-giddily
-giddiness
-giddy
-gift
-gifts
-gig
-giglets
-giglot
-gilbert
-gild
-gilded
-gilding
-gilliams
-gillian
-gills
-gillyvors
-gilt
-gimmal
-gimmers
-gin
-ging
-ginger
-gingerbread
-gingerly
-ginn
-gins
-gioucestershire
-gipes
-gipsies
-gipsy
-gird
-girded
-girdle
-girdled
-girdles
-girdling
-girl
-girls
-girt
-girth
-gis
-giv
-give
-given
-giver
-givers
-gives
-givest
-giveth
-giving
-givings
-glad
-gladded
-gladding
-gladly
-gladness
-glamis
-glanc
-glance
-glanced
-glances
-glancing
-glanders
-glansdale
-glare
-glares
-glass
-glasses
-glassy
-glaz
-glazed
-gleams
-glean
-gleaned
-gleaning
-gleeful
-gleek
-gleeking
-gleeks
-glend
-glendower
-glib
-glide
-glided
-glides
-glideth
-gliding
-glimmer
-glimmering
-glimmers
-glimpse
-glimpses
-glist
-glistening
-glister
-glistering
-glisters
-glitt
-glittering
-globe
-globes
-glooming
-gloomy
-glories
-glorified
-glorify
-glorious
-gloriously
-glory
-glose
-gloss
-glosses
-glou
-glouceste
-gloucester
-gloucestershire
-glove
-glover
-gloves
-glow
-glowed
-glowing
-glowworm
-gloz
-gloze
-glozes
-glu
-glue
-glued
-glues
-glut
-glutt
-glutted
-glutton
-gluttoning
-gluttony
-gnarled
-gnarling
-gnat
-gnats
-gnaw
-gnawing
-gnawn
-gnaws
-go
-goad
-goaded
-goads
-goal
-goat
-goatish
-goats
-gobbets
-gobbo
-goblet
-goblets
-goblin
-goblins
-god
-godded
-godden
-goddess
-goddesses
-goddild
-godfather
-godfathers
-godhead
-godlike
-godliness
-godly
-godmother
-gods
-godson
-goer
-goers
-goes
-goest
-goeth
-goffe
-gogs
-going
-gold
-golden
-goldenly
-goldsmith
-goldsmiths
-golgotha
-goliases
-goliath
-gon
-gondola
-gondolier
-gone
-goneril
-gong
-gonzago
-gonzalo
-good
-goodfellow
-goodlier
-goodliest
-goodly
-goodman
-goodness
-goodnight
-goodrig
-goods
-goodwife
-goodwill
-goodwin
-goodwins
-goodyear
-goodyears
-goose
-gooseberry
-goosequills
-goot
-gor
-gorbellied
-gorboduc
-gordian
-gore
-gored
-gorg
-gorge
-gorgeous
-gorget
-gorging
-gorgon
-gormandize
-gormandizing
-gory
-gosling
-gospel
-gospels
-goss
-gossamer
-gossip
-gossiping
-gossiplike
-gossips
-got
-goth
-goths
-gotten
-gourd
-gout
-gouts
-gouty
-govern
-governance
-governed
-governess
-government
-governor
-governors
-governs
-gower
-gown
-gowns
-grac
-grace
-graced
-graceful
-gracefully
-graceless
-graces
-gracing
-gracious
-graciously
-gradation
-graff
-graffing
-graft
-grafted
-grafters
-grain
-grained
-grains
-gramercies
-gramercy
-grammar
-grand
-grandam
-grandame
-grandchild
-grande
-grandeur
-grandfather
-grandjurors
-grandmother
-grandpre
-grandsir
-grandsire
-grandsires
-grange
-grant
-granted
-granting
-grants
-grape
-grapes
-grapple
-grapples
-grappling
-grasp
-grasped
-grasps
-grass
-grasshoppers
-grassy
-grate
-grated
-grateful
-grates
-gratiano
-gratify
-gratii
-gratillity
-grating
-gratis
-gratitude
-gratulate
-grav
-grave
-gravediggers
-gravel
-graveless
-gravell
-gravely
-graven
-graveness
-graver
-graves
-gravest
-gravestone
-gravities
-gravity
-gravy
-gray
-graymalkin
-graz
-graze
-grazed
-grazing
-grease
-greases
-greasily
-greasy
-great
-greater
-greatest
-greatly
-greatness
-grecian
-grecians
-gree
-greece
-greed
-greedily
-greediness
-greedy
-greeing
-greek
-greekish
-greeks
-green
-greener
-greenly
-greens
-greensleeves
-greenwich
-greenwood
-greet
-greeted
-greeting
-greetings
-greets
-greg
-gregory
-gremio
-grew
-grey
-greybeard
-greybeards
-greyhound
-greyhounds
-grief
-griefs
-griev
-grievance
-grievances
-grieve
-grieved
-grieves
-grievest
-grieving
-grievingly
-grievous
-grievously
-griffin
-griffith
-grim
-grime
-grimly
-grin
-grind
-grinding
-grindstone
-grinning
-grip
-gripe
-gripes
-griping
-grise
-grisly
-grissel
-grize
-grizzle
-grizzled
-groan
-groaning
-groans
-groat
-groats
-groin
-groom
-grooms
-grop
-groping
-gros
-gross
-grosser
-grossly
-grossness
-ground
-grounded
-groundlings
-grounds
-grove
-grovel
-grovelling
-groves
-grow
-groweth
-growing
-grown
-grows
-growth
-grub
-grubb
-grubs
-grudge
-grudged
-grudges
-grudging
-gruel
-grumble
-grumblest
-grumbling
-grumblings
-grumio
-grund
-grunt
-gualtier
-guard
-guardage
-guardant
-guarded
-guardian
-guardians
-guards
-guardsman
-gud
-gudgeon
-guerdon
-guerra
-guess
-guesses
-guessingly
-guest
-guests
-guiana
-guichard
-guide
-guided
-guider
-guiderius
-guides
-guiding
-guidon
-guienne
-guil
-guildenstern
-guilders
-guildford
-guildhall
-guile
-guiled
-guileful
-guilfords
-guilt
-guiltian
-guiltier
-guiltily
-guiltiness
-guiltless
-guilts
-guilty
-guinea
-guinever
-guise
-gul
-gules
-gulf
-gulfs
-gull
-gulls
-gum
-gumm
-gums
-gun
-gunner
-gunpowder
-guns
-gurnet
-gurney
-gust
-gusts
-gusty
-guts
-gutter
-guy
-guynes
-guysors
-gypsy
-gyve
-gyved
-gyves
-h
-ha
-haberdasher
-habiliment
-habiliments
-habit
-habitation
-habited
-habits
-habitude
-hack
-hacket
-hackney
-hacks
-had
-hadst
-haec
-haeres
-hag
-hagar
-haggard
-haggards
-haggish
-haggled
-hags
-hail
-hailed
-hailstone
-hailstones
-hair
-hairless
-hairs
-hairy
-hal
-halberd
-halberds
-halcyon
-hale
-haled
-hales
-half
-halfcan
-halfpence
-halfpenny
-halfpennyworth
-halfway
-halidom
-hall
-halloa
-halloing
-hallond
-halloo
-hallooing
-hallow
-hallowed
-hallowmas
-hallown
-hals
-halt
-halter
-halters
-halting
-halts
-halves
-ham
-hames
-hamlet
-hammer
-hammered
-hammering
-hammers
-hamper
-hampton
-hams
-hamstring
-hand
-handed
-handful
-handicraft
-handicraftsmen
-handing
-handiwork
-handkercher
-handkerchers
-handkerchief
-handle
-handled
-handles
-handless
-handlest
-handling
-handmaid
-handmaids
-hands
-handsaw
-handsome
-handsomely
-handsomeness
-handwriting
-handy
-hang
-hanged
-hangers
-hangeth
-hanging
-hangings
-hangman
-hangmen
-hangs
-hannibal
-hap
-hapless
-haply
-happ
-happen
-happened
-happier
-happies
-happiest
-happily
-happiness
-happy
-haps
-harbinger
-harbingers
-harbor
-harbour
-harbourage
-harbouring
-harbours
-harcourt
-hard
-harder
-hardest
-hardiest
-hardiment
-hardiness
-hardly
-hardness
-hardocks
-hardy
-hare
-harelip
-hares
-harfleur
-hark
-harlot
-harlotry
-harlots
-harm
-harmed
-harmful
-harming
-harmless
-harmonious
-harmony
-harms
-harness
-harp
-harper
-harpier
-harping
-harpy
-harried
-harrow
-harrows
-harry
-harsh
-harshly
-harshness
-hart
-harts
-harum
-harvest
-has
-hast
-haste
-hasted
-hasten
-hastes
-hastily
-hasting
-hastings
-hasty
-hat
-hatch
-hatches
-hatchet
-hatching
-hatchment
-hate
-hated
-hateful
-hater
-haters
-hates
-hateth
-hatfield
-hath
-hating
-hatred
-hats
-haud
-hauf
-haught
-haughtiness
-haughty
-haunch
-haunches
-haunt
-haunted
-haunting
-haunts
-hautboy
-hautboys
-have
-haven
-havens
-haver
-having
-havings
-havior
-haviour
-havoc
-hawk
-hawking
-hawks
-hawthorn
-hawthorns
-hay
-hazard
-hazarded
-hazards
-hazel
-hazelnut
-he
-head
-headborough
-headed
-headier
-heading
-headland
-headless
-headlong
-heads
-headsman
-headstrong
-heady
-heal
-healed
-healing
-heals
-health
-healthful
-healths
-healthsome
-healthy
-heap
-heaping
-heaps
-hear
-heard
-hearer
-hearers
-hearest
-heareth
-hearing
-hearings
-heark
-hearken
-hearkens
-hears
-hearsay
-hearse
-hearsed
-hearst
-heart
-heartache
-heartbreak
-heartbreaking
-hearted
-hearten
-hearth
-hearths
-heartily
-heartiness
-heartless
-heartlings
-heartly
-hearts
-heartsick
-heartstrings
-hearty
-heat
-heated
-heath
-heathen
-heathenish
-heating
-heats
-heauties
-heav
-heave
-heaved
-heaven
-heavenly
-heavens
-heaves
-heavier
-heaviest
-heavily
-heaviness
-heaving
-heavings
-heavy
-hebona
-hebrew
-hecate
-hectic
-hector
-hectors
-hecuba
-hedg
-hedge
-hedgehog
-hedgehogs
-hedges
-heed
-heeded
-heedful
-heedfull
-heedfully
-heedless
-heel
-heels
-hefted
-hefts
-heifer
-heifers
-heigh
-height
-heighten
-heinous
-heinously
-heir
-heiress
-heirless
-heirs
-held
-helen
-helena
-helenus
-helias
-helicons
-hell
-hellespont
-hellfire
-hellish
-helm
-helmed
-helmet
-helmets
-helms
-help
-helper
-helpers
-helpful
-helping
-helpless
-helps
-helter
-hem
-heme
-hemlock
-hemm
-hemp
-hempen
-hems
-hen
-hence
-henceforth
-henceforward
-henchman
-henri
-henricus
-henry
-hens
-hent
-henton
-her
-herald
-heraldry
-heralds
-herb
-herbert
-herblets
-herbs
-herculean
-hercules
-herd
-herds
-herdsman
-herdsmen
-here
-hereabout
-hereabouts
-hereafter
-hereby
-hereditary
-hereford
-herefordshire
-herein
-hereof
-heresies
-heresy
-heretic
-heretics
-hereto
-hereupon
-heritage
-heritier
-hermes
-hermia
-hermione
-hermit
-hermitage
-hermits
-herne
-hero
-herod
-herods
-heroes
-heroic
-heroical
-herring
-herrings
-hers
-herself
-hesperides
-hesperus
-hest
-hests
-heure
-heureux
-hew
-hewgh
-hewing
-hewn
-hews
-hey
-heyday
-hibocrates
-hic
-hiccups
-hick
-hid
-hidden
-hide
-hideous
-hideously
-hideousness
-hides
-hidest
-hiding
-hie
-hied
-hiems
-hies
-hig
-high
-higher
-highest
-highly
-highmost
-highness
-hight
-highway
-highways
-hilding
-hildings
-hill
-hillo
-hilloa
-hills
-hilt
-hilts
-hily
-him
-himself
-hinc
-hinckley
-hind
-hinder
-hindered
-hinders
-hindmost
-hinds
-hing
-hinge
-hinges
-hint
-hip
-hipp
-hipparchus
-hippolyta
-hips
-hir
-hire
-hired
-hiren
-hirtius
-his
-hisperia
-hiss
-hisses
-hissing
-hist
-historical
-history
-hit
-hither
-hitherto
-hitherward
-hitherwards
-hits
-hitting
-hive
-hives
-hizzing
-ho
-hoa
-hoar
-hoard
-hoarded
-hoarding
-hoars
-hoarse
-hoary
-hob
-hobbididence
-hobby
-hobbyhorse
-hobgoblin
-hobnails
-hoc
-hod
-hodge
-hog
-hogs
-hogshead
-hogsheads
-hois
-hoise
-hoist
-hoisted
-hoists
-holborn
-hold
-holden
-holder
-holdeth
-holdfast
-holding
-holds
-hole
-holes
-holidam
-holidame
-holiday
-holidays
-holier
-holiest
-holily
-holiness
-holla
-holland
-hollander
-hollanders
-holloa
-holloaing
-hollow
-hollowly
-hollowness
-holly
-holmedon
-holofernes
-holp
-holy
-homage
-homager
-home
-homely
-homes
-homespuns
-homeward
-homewards
-homicide
-homicides
-homily
-hominem
-hommes
-homo
-honest
-honester
-honestest
-honestly
-honesty
-honey
-honeycomb
-honeying
-honeyless
-honeysuckle
-honeysuckles
-honi
-honneur
-honor
-honorable
-honorably
-honorato
-honorificabilitudinitatibus
-honors
-honour
-honourable
-honourably
-honoured
-honourest
-honourible
-honouring
-honours
-hoo
-hood
-hooded
-hoodman
-hoods
-hoodwink
-hoof
-hoofs
-hook
-hooking
-hooks
-hoop
-hoops
-hoot
-hooted
-hooting
-hoots
-hop
-hope
-hopeful
-hopeless
-hopes
-hopest
-hoping
-hopkins
-hoppedance
-hor
-horace
-horatio
-horizon
-horn
-hornbook
-horned
-horner
-horning
-hornpipes
-horns
-horologe
-horrible
-horribly
-horrid
-horrider
-horridly
-horror
-horrors
-hors
-horse
-horseback
-horsed
-horsehairs
-horseman
-horsemanship
-horsemen
-horses
-horseway
-horsing
-hortensio
-hortensius
-horum
-hose
-hospitable
-hospital
-hospitality
-host
-hostage
-hostages
-hostess
-hostile
-hostility
-hostilius
-hosts
-hot
-hotly
-hotspur
-hotter
-hottest
-hound
-hounds
-hour
-hourly
-hours
-hous
-house
-household
-householder
-householders
-households
-housekeeper
-housekeepers
-housekeeping
-houseless
-houses
-housewife
-housewifery
-housewives
-hovel
-hover
-hovered
-hovering
-hovers
-how
-howbeit
-howe
-howeer
-however
-howl
-howled
-howlet
-howling
-howls
-howsoe
-howsoever
-howsome
-hoxes
-hoy
-hoyday
-hubert
-huddled
-huddling
-hue
-hued
-hues
-hug
-huge
-hugely
-hugeness
-hugg
-hugger
-hugh
-hugs
-hujus
-hulk
-hulks
-hull
-hulling
-hullo
-hum
-human
-humane
-humanely
-humanity
-humble
-humbled
-humbleness
-humbler
-humbles
-humblest
-humbling
-humbly
-hume
-humh
-humidity
-humility
-humming
-humor
-humorous
-humors
-humour
-humourists
-humours
-humphrey
-humphry
-hums
-hundred
-hundreds
-hundredth
-hung
-hungarian
-hungary
-hunger
-hungerford
-hungerly
-hungry
-hunt
-hunted
-hunter
-hunters
-hunteth
-hunting
-huntington
-huntress
-hunts
-huntsman
-huntsmen
-hurdle
-hurl
-hurling
-hurls
-hurly
-hurlyburly
-hurricano
-hurricanoes
-hurried
-hurries
-hurry
-hurt
-hurting
-hurtled
-hurtless
-hurtling
-hurts
-husband
-husbanded
-husbandless
-husbandry
-husbands
-hush
-hushes
-husht
-husks
-huswife
-huswifes
-hutch
-hybla
-hydra
-hyen
-hymen
-hymenaeus
-hymn
-hymns
-hyperboles
-hyperbolical
-hyperion
-hypocrisy
-hypocrite
-hypocrites
-hyrcan
-hyrcania
-hyrcanian
-hyssop
-hysterica
-i
-iachimo
-iaculis
-iago
-iament
-ibat
-icarus
-ice
-iceland
-ici
-icicle
-icicles
-icy
-idea
-ideas
-idem
-iden
-ides
-idiot
-idiots
-idle
-idleness
-idles
-idly
-idol
-idolatrous
-idolatry
-ield
-if
-ifs
-ignis
-ignoble
-ignobly
-ignominious
-ignominy
-ignomy
-ignorance
-ignorant
-ii
-iii
-iiii
-il
-ilbow
-ild
-ilion
-ilium
-ill
-illegitimate
-illiterate
-illness
-illo
-ills
-illume
-illumin
-illuminate
-illumineth
-illusion
-illusions
-illustrate
-illustrated
-illustrious
-illyria
-illyrian
-ils
-im
-image
-imagery
-images
-imagin
-imaginary
-imagination
-imaginations
-imagine
-imagining
-imaginings
-imbar
-imbecility
-imbrue
-imitari
-imitate
-imitated
-imitation
-imitations
-immaculate
-immanity
-immask
-immaterial
-immediacy
-immediate
-immediately
-imminence
-imminent
-immoderate
-immoderately
-immodest
-immoment
-immortal
-immortaliz
-immortally
-immur
-immured
-immures
-imogen
-imp
-impaint
-impair
-impairing
-impale
-impaled
-impanelled
-impart
-imparted
-impartial
-impartment
-imparts
-impasted
-impatience
-impatient
-impatiently
-impawn
-impeach
-impeached
-impeachment
-impeachments
-impedes
-impediment
-impediments
-impenetrable
-imperator
-imperceiverant
-imperfect
-imperfection
-imperfections
-imperfectly
-imperial
-imperious
-imperiously
-impertinency
-impertinent
-impeticos
-impetuosity
-impetuous
-impieties
-impiety
-impious
-implacable
-implements
-implies
-implor
-implorators
-implore
-implored
-imploring
-impon
-import
-importance
-importancy
-important
-importantly
-imported
-importeth
-importing
-importless
-imports
-importun
-importunacy
-importunate
-importune
-importunes
-importunity
-impos
-impose
-imposed
-imposition
-impositions
-impossibilities
-impossibility
-impossible
-imposthume
-impostor
-impostors
-impotence
-impotent
-impounded
-impregnable
-imprese
-impress
-impressed
-impressest
-impression
-impressure
-imprimendum
-imprimis
-imprint
-imprinted
-imprison
-imprisoned
-imprisoning
-imprisonment
-improbable
-improper
-improve
-improvident
-impudence
-impudency
-impudent
-impudently
-impudique
-impugn
-impugns
-impure
-imputation
-impute
-in
-inaccessible
-inaidable
-inaudible
-inauspicious
-incaged
-incantations
-incapable
-incardinate
-incarnadine
-incarnate
-incarnation
-incens
-incense
-incensed
-incensement
-incenses
-incensing
-incertain
-incertainties
-incertainty
-incessant
-incessantly
-incest
-incestuous
-inch
-incharitable
-inches
-incidency
-incident
-incision
-incite
-incites
-incivil
-incivility
-inclin
-inclinable
-inclination
-incline
-inclined
-inclines
-inclining
-inclips
-include
-included
-includes
-inclusive
-incomparable
-incomprehensible
-inconsiderate
-inconstancy
-inconstant
-incontinency
-incontinent
-incontinently
-inconvenience
-inconveniences
-inconvenient
-incony
-incorporate
-incorps
-incorrect
-increas
-increase
-increases
-increaseth
-increasing
-incredible
-incredulous
-incur
-incurable
-incurr
-incurred
-incursions
-ind
-inde
-indebted
-indeed
-indent
-indented
-indenture
-indentures
-index
-indexes
-india
-indian
-indict
-indicted
-indictment
-indies
-indifferency
-indifferent
-indifferently
-indigent
-indigest
-indigested
-indign
-indignation
-indignations
-indigne
-indignities
-indignity
-indirect
-indirection
-indirections
-indirectly
-indiscreet
-indiscretion
-indispos
-indisposition
-indissoluble
-indistinct
-indistinguish
-indistinguishable
-indited
-individable
-indrench
-indu
-indubitate
-induc
-induce
-induced
-inducement
-induction
-inductions
-indue
-indued
-indues
-indulgence
-indulgences
-indulgent
-indurance
-industrious
-industriously
-industry
-inequality
-inestimable
-inevitable
-inexecrable
-inexorable
-inexplicable
-infallible
-infallibly
-infamonize
-infamous
-infamy
-infancy
-infant
-infants
-infect
-infected
-infecting
-infection
-infections
-infectious
-infectiously
-infects
-infer
-inference
-inferior
-inferiors
-infernal
-inferr
-inferreth
-inferring
-infest
-infidel
-infidels
-infinite
-infinitely
-infinitive
-infirm
-infirmities
-infirmity
-infixed
-infixing
-inflam
-inflame
-inflaming
-inflammation
-inflict
-infliction
-influence
-influences
-infold
-inform
-informal
-information
-informations
-informed
-informer
-informs
-infortunate
-infring
-infringe
-infringed
-infus
-infuse
-infused
-infusing
-infusion
-ingener
-ingenious
-ingeniously
-inglorious
-ingots
-ingraffed
-ingraft
-ingrate
-ingrated
-ingrateful
-ingratitude
-ingratitudes
-ingredient
-ingredients
-ingross
-inhabit
-inhabitable
-inhabitants
-inhabited
-inhabits
-inhearse
-inhearsed
-inherent
-inherit
-inheritance
-inherited
-inheriting
-inheritor
-inheritors
-inheritrix
-inherits
-inhibited
-inhibition
-inhoop
-inhuman
-iniquities
-iniquity
-initiate
-injointed
-injunction
-injunctions
-injur
-injure
-injurer
-injuries
-injurious
-injury
-injustice
-ink
-inkhorn
-inkle
-inkles
-inkling
-inky
-inlaid
-inland
-inlay
-inly
-inmost
-inn
-inner
-innkeeper
-innocence
-innocency
-innocent
-innocents
-innovation
-innovator
-inns
-innumerable
-inoculate
-inordinate
-inprimis
-inquir
-inquire
-inquiry
-inquisition
-inquisitive
-inroads
-insane
-insanie
-insatiate
-insconce
-inscrib
-inscription
-inscriptions
-inscroll
-inscrutable
-insculp
-insculpture
-insensible
-inseparable
-inseparate
-insert
-inserted
-inset
-inshell
-inshipp
-inside
-insinewed
-insinuate
-insinuateth
-insinuating
-insinuation
-insisted
-insisting
-insisture
-insociable
-insolence
-insolent
-insomuch
-inspir
-inspiration
-inspirations
-inspire
-inspired
-install
-installed
-instalment
-instance
-instances
-instant
-instantly
-instate
-instead
-insteeped
-instigate
-instigated
-instigation
-instigations
-instigator
-instinct
-instinctively
-institute
-institutions
-instruct
-instructed
-instruction
-instructions
-instructs
-instrument
-instrumental
-instruments
-insubstantial
-insufficience
-insufficiency
-insult
-insulted
-insulting
-insultment
-insults
-insupportable
-insuppressive
-insurrection
-insurrections
-int
-integer
-integritas
-integrity
-intellect
-intellects
-intellectual
-intelligence
-intelligencer
-intelligencing
-intelligent
-intelligis
-intelligo
-intemperance
-intemperate
-intend
-intended
-intendeth
-intending
-intendment
-intends
-intenible
-intent
-intention
-intentively
-intents
-inter
-intercept
-intercepted
-intercepter
-interception
-intercepts
-intercession
-intercessors
-interchained
-interchang
-interchange
-interchangeably
-interchangement
-interchanging
-interdiction
-interest
-interim
-interims
-interior
-interjections
-interjoin
-interlude
-intermingle
-intermission
-intermissive
-intermit
-intermix
-intermixed
-interpose
-interposer
-interposes
-interpret
-interpretation
-interpreted
-interpreter
-interpreters
-interprets
-interr
-interred
-interrogatories
-interrupt
-interrupted
-interrupter
-interruptest
-interruption
-interrupts
-intertissued
-intervallums
-interview
-intestate
-intestine
-intil
-intimate
-intimation
-intitled
-intituled
-into
-intolerable
-intoxicates
-intreasured
-intreat
-intrench
-intrenchant
-intricate
-intrinse
-intrinsicate
-intrude
-intruder
-intruding
-intrusion
-inundation
-inure
-inurn
-invade
-invades
-invasion
-invasive
-invectively
-invectives
-inveigled
-invent
-invented
-invention
-inventions
-inventor
-inventorially
-inventoried
-inventors
-inventory
-inverness
-invert
-invest
-invested
-investing
-investments
-inveterate
-invincible
-inviolable
-invised
-invisible
-invitation
-invite
-invited
-invites
-inviting
-invitis
-invocate
-invocation
-invoke
-invoked
-invulnerable
-inward
-inwardly
-inwardness
-inwards
-ionia
-ionian
-ipse
-ipswich
-ira
-irae
-iras
-ire
-ireful
-ireland
-iris
-irish
-irishman
-irishmen
-irks
-irksome
-iron
-irons
-irreconcil
-irrecoverable
-irregular
-irregulous
-irreligious
-irremovable
-irreparable
-irresolute
-irrevocable
-is
-isabel
-isabella
-isbel
-isbels
-iscariot
-ise
-ish
-isidore
-isis
-island
-islander
-islanders
-islands
-isle
-isles
-israel
-issu
-issue
-issued
-issueless
-issues
-issuing
-ist
-ista
-it
-italian
-italy
-itch
-itches
-itching
-item
-items
-iteration
-ithaca
-its
-itself
-itshall
-iv
-ivory
-ivy
-iwis
-ix
-j
-jacet
-jack
-jackanapes
-jacks
-jacksauce
-jackslave
-jacob
-jade
-jaded
-jades
-jail
-jakes
-jamany
-james
-jamy
-jane
-jangled
-jangling
-january
-janus
-japhet
-jaquenetta
-jaques
-jar
-jarring
-jars
-jarteer
-jasons
-jaunce
-jauncing
-jaundice
-jaundies
-jaw
-jawbone
-jaws
-jay
-jays
-jc
-je
-jealous
-jealousies
-jealousy
-jeer
-jeering
-jelly
-jenny
-jeopardy
-jephtha
-jephthah
-jerkin
-jerkins
-jerks
-jeronimy
-jerusalem
-jeshu
-jesses
-jessica
-jest
-jested
-jester
-jesters
-jesting
-jests
-jesu
-jesus
-jet
-jets
-jew
-jewel
-jeweller
-jewels
-jewess
-jewish
-jewry
-jews
-jezebel
-jig
-jigging
-jill
-jills
-jingling
-joan
-job
-jockey
-jocund
-jog
-jogging
-john
-johns
-join
-joinder
-joined
-joiner
-joineth
-joins
-joint
-jointed
-jointing
-jointly
-jointress
-joints
-jointure
-jollity
-jolly
-jolt
-joltheads
-jordan
-joseph
-joshua
-jot
-jour
-jourdain
-journal
-journey
-journeying
-journeyman
-journeymen
-journeys
-jove
-jovem
-jovial
-jowl
-jowls
-joy
-joyed
-joyful
-joyfully
-joyless
-joyous
-joys
-juan
-jud
-judas
-judases
-jude
-judg
-judge
-judged
-judgement
-judges
-judgest
-judging
-judgment
-judgments
-judicious
-jug
-juggle
-juggled
-juggler
-jugglers
-juggling
-jugs
-juice
-juiced
-jul
-jule
-julia
-juliet
-julietta
-julio
-julius
-july
-jump
-jumpeth
-jumping
-jumps
-june
-junes
-junior
-junius
-junkets
-juno
-jupiter
-jure
-jurement
-jurisdiction
-juror
-jurors
-jury
-jurymen
-just
-justeius
-justest
-justice
-justicer
-justicers
-justices
-justification
-justified
-justify
-justle
-justled
-justles
-justling
-justly
-justness
-justs
-jutting
-jutty
-juvenal
-kam
-kate
-kated
-kates
-katharine
-katherina
-katherine
-kecksies
-keech
-keel
-keels
-keen
-keenness
-keep
-keepdown
-keeper
-keepers
-keepest
-keeping
-keeps
-keiser
-ken
-kendal
-kennel
-kent
-kentish
-kentishman
-kentishmen
-kept
-kerchief
-kerely
-kern
-kernal
-kernel
-kernels
-kerns
-kersey
-kettle
-kettledrum
-kettledrums
-key
-keys
-kibe
-kibes
-kick
-kicked
-kickshaws
-kickshawses
-kicky
-kid
-kidney
-kikely
-kildare
-kill
-killed
-killer
-killeth
-killing
-killingworth
-kills
-kiln
-kimbolton
-kin
-kind
-kinder
-kindest
-kindle
-kindled
-kindless
-kindlier
-kindling
-kindly
-kindness
-kindnesses
-kindred
-kindreds
-kinds
-kine
-king
-kingdom
-kingdoms
-kingly
-kings
-kinred
-kins
-kinsman
-kinsmen
-kinswoman
-kirtle
-kirtles
-kiss
-kissed
-kisses
-kissing
-kitchen
-kitchens
-kite
-kites
-kitten
-kj
-kl
-klll
-knack
-knacks
-knapp
-knav
-knave
-knaveries
-knavery
-knaves
-knavish
-knead
-kneaded
-kneading
-knee
-kneel
-kneeling
-kneels
-knees
-knell
-knew
-knewest
-knife
-knight
-knighted
-knighthood
-knighthoods
-knightly
-knights
-knit
-knits
-knitters
-knitteth
-knives
-knobs
-knock
-knocking
-knocks
-knog
-knoll
-knot
-knots
-knotted
-knotty
-know
-knower
-knowest
-knowing
-knowingly
-knowings
-knowledge
-known
-knows
-l
-la
-laban
-label
-labell
-labienus
-labio
-labor
-laboring
-labors
-labour
-laboured
-labourer
-labourers
-labouring
-labours
-laboursome
-labras
-labyrinth
-lac
-lace
-laced
-lacedaemon
-laces
-lacies
-lack
-lackbeard
-lacked
-lackey
-lackeying
-lackeys
-lacking
-lacks
-lad
-ladder
-ladders
-lade
-laden
-ladies
-lading
-lads
-lady
-ladybird
-ladyship
-ladyships
-laer
-laertes
-lafeu
-lag
-lagging
-laid
-lain
-laissez
-lake
-lakes
-lakin
-lam
-lamb
-lambert
-lambkin
-lambkins
-lambs
-lame
-lamely
-lameness
-lament
-lamentable
-lamentably
-lamentation
-lamentations
-lamented
-lamenting
-lamentings
-laments
-lames
-laming
-lammas
-lammastide
-lamound
-lamp
-lampass
-lamps
-lanc
-lancaster
-lance
-lances
-lanceth
-lanch
-land
-landed
-landing
-landless
-landlord
-landmen
-lands
-lane
-lanes
-langage
-langley
-langton
-language
-languageless
-languages
-langues
-languish
-languished
-languishes
-languishing
-languishings
-languishment
-languor
-lank
-lantern
-lanterns
-lanthorn
-lap
-lapis
-lapland
-lapp
-laps
-lapse
-lapsed
-lapsing
-lapwing
-laquais
-larded
-larder
-larding
-lards
-large
-largely
-largeness
-larger
-largess
-largest
-lark
-larks
-larron
-lartius
-larum
-larums
-las
-lascivious
-lash
-lass
-lasses
-last
-lasted
-lasting
-lastly
-lasts
-latch
-latches
-late
-lated
-lately
-later
-latest
-lath
-latin
-latten
-latter
-lattice
-laud
-laudable
-laudis
-laugh
-laughable
-laughed
-laugher
-laughest
-laughing
-laughs
-laughter
-launce
-launcelot
-launces
-launch
-laund
-laundress
-laundry
-laur
-laura
-laurel
-laurels
-laurence
-laus
-lavache
-lave
-lavee
-lavender
-lavina
-lavinia
-lavish
-lavishly
-lavolt
-lavoltas
-law
-lawful
-lawfully
-lawless
-lawlessly
-lawn
-lawns
-lawrence
-laws
-lawyer
-lawyers
-lay
-layer
-layest
-laying
-lays
-lazar
-lazars
-lazarus
-lazy
-lc
-ld
-ldst
-le
-lead
-leaden
-leader
-leaders
-leadest
-leading
-leads
-leaf
-leagu
-league
-leagued
-leaguer
-leagues
-leah
-leak
-leaky
-lean
-leander
-leaner
-leaning
-leanness
-leans
-leap
-leaped
-leaping
-leaps
-leapt
-lear
-learn
-learned
-learnedly
-learning
-learnings
-learns
-learnt
-leas
-lease
-leases
-leash
-leasing
-least
-leather
-leathern
-leav
-leave
-leaven
-leavening
-leaver
-leaves
-leaving
-leavy
-lecher
-lecherous
-lechers
-lechery
-lecon
-lecture
-lectures
-led
-leda
-leech
-leeches
-leek
-leeks
-leer
-leers
-lees
-leese
-leet
-leets
-left
-leg
-legacies
-legacy
-legate
-legatine
-lege
-legerity
-leges
-legg
-legion
-legions
-legitimate
-legitimation
-legs
-leicester
-leicestershire
-leiger
-leigers
-leisure
-leisurely
-leisures
-leman
-lemon
-lena
-lend
-lender
-lending
-lendings
-lends
-length
-lengthen
-lengthens
-lengths
-lenity
-lennox
-lent
-lenten
-lentus
-leo
-leon
-leonardo
-leonati
-leonato
-leonatus
-leontes
-leopard
-leopards
-leper
-leperous
-lepidus
-leprosy
-lequel
-lers
-les
-less
-lessen
-lessens
-lesser
-lesson
-lessoned
-lessons
-lest
-lestrake
-let
-lethargied
-lethargies
-lethargy
-lethe
-lets
-lett
-letter
-letters
-letting
-lettuce
-leur
-leve
-level
-levell
-levelled
-levels
-leven
-levers
-leviathan
-leviathans
-levied
-levies
-levity
-levy
-levying
-lewd
-lewdly
-lewdness
-lewdsters
-lewis
-liable
-liar
-liars
-libbard
-libelling
-libels
-liberal
-liberality
-liberte
-liberties
-libertine
-libertines
-liberty
-library
-libya
-licence
-licens
-license
-licentious
-lichas
-licio
-lick
-licked
-licker
-lictors
-lid
-lids
-lie
-lied
-lief
-liefest
-liege
-liegeman
-liegemen
-lien
-lies
-liest
-lieth
-lieu
-lieutenant
-lieutenantry
-lieutenants
-lieve
-life
-lifeblood
-lifeless
-lifelings
-lift
-lifted
-lifter
-lifteth
-lifting
-lifts
-lig
-ligarius
-liggens
-light
-lighted
-lighten
-lightens
-lighter
-lightest
-lightly
-lightness
-lightning
-lightnings
-lights
-lik
-like
-liked
-likeliest
-likelihood
-likelihoods
-likely
-likeness
-liker
-likes
-likest
-likewise
-liking
-likings
-lilies
-lily
-lim
-limander
-limb
-limbeck
-limbecks
-limber
-limbo
-limbs
-lime
-limed
-limehouse
-limekilns
-limit
-limitation
-limited
-limits
-limn
-limp
-limping
-limps
-lin
-lincoln
-lincolnshire
-line
-lineal
-lineally
-lineament
-lineaments
-lined
-linen
-linens
-lines
-ling
-lingare
-linger
-lingered
-lingers
-linguist
-lining
-link
-links
-linsey
-linstock
-linta
-lion
-lionel
-lioness
-lions
-lip
-lipp
-lips
-lipsbury
-liquid
-liquor
-liquorish
-liquors
-lirra
-lisbon
-lisp
-lisping
-list
-listen
-listening
-lists
-literatured
-lither
-litter
-little
-littlest
-liv
-live
-lived
-livelier
-livelihood
-livelong
-lively
-liver
-liveries
-livers
-livery
-lives
-livest
-liveth
-livia
-living
-livings
-lizard
-lizards
-ll
-lll
-llous
-lnd
-lo
-loa
-loach
-load
-loaden
-loading
-loads
-loaf
-loam
-loan
-loath
-loathe
-loathed
-loather
-loathes
-loathing
-loathly
-loathness
-loathsome
-loathsomeness
-loathsomest
-loaves
-lob
-lobbies
-lobby
-local
-lochaber
-lock
-locked
-locking
-lockram
-locks
-locusts
-lode
-lodg
-lodge
-lodged
-lodgers
-lodges
-lodging
-lodgings
-lodovico
-lodowick
-lofty
-log
-logger
-loggerhead
-loggerheads
-loggets
-logic
-logs
-loins
-loiter
-loiterer
-loiterers
-loitering
-lolling
-lolls
-lombardy
-london
-londoners
-lone
-loneliness
-lonely
-long
-longaville
-longboat
-longed
-longer
-longest
-longeth
-longing
-longings
-longly
-longs
-longtail
-loo
-loof
-look
-looked
-looker
-lookers
-lookest
-looking
-looks
-loon
-loop
-loos
-loose
-loosed
-loosely
-loosen
-loosing
-lop
-lopp
-loquitur
-lord
-lorded
-lording
-lordings
-lordliness
-lordly
-lords
-lordship
-lordships
-lorenzo
-lorn
-lorraine
-lorship
-los
-lose
-loser
-losers
-loses
-losest
-loseth
-losing
-loss
-losses
-lost
-lot
-lots
-lott
-lottery
-loud
-louder
-loudly
-lour
-loureth
-louring
-louse
-louses
-lousy
-lout
-louted
-louts
-louvre
-lov
-love
-loved
-lovedst
-lovel
-lovelier
-loveliness
-lovell
-lovely
-lover
-lovered
-lovers
-loves
-lovest
-loveth
-loving
-lovingly
-low
-lowe
-lower
-lowest
-lowing
-lowliness
-lowly
-lown
-lowness
-loyal
-loyally
-loyalties
-loyalty
-lozel
-lt
-lubber
-lubberly
-luc
-luccicos
-luce
-lucentio
-luces
-lucetta
-luciana
-lucianus
-lucifer
-lucifier
-lucilius
-lucina
-lucio
-lucius
-luck
-luckier
-luckiest
-luckily
-luckless
-lucky
-lucre
-lucrece
-lucretia
-lucullius
-lucullus
-lucy
-lud
-ludlow
-lug
-lugg
-luggage
-luke
-lukewarm
-lull
-lulla
-lullaby
-lulls
-lumbert
-lump
-lumpish
-luna
-lunacies
-lunacy
-lunatic
-lunatics
-lunes
-lungs
-lupercal
-lurch
-lure
-lurk
-lurketh
-lurking
-lurks
-luscious
-lush
-lust
-lusted
-luster
-lustful
-lustier
-lustiest
-lustig
-lustihood
-lustily
-lustre
-lustrous
-lusts
-lusty
-lute
-lutes
-lutestring
-lutheran
-luxurious
-luxuriously
-luxury
-ly
-lycaonia
-lycurguses
-lydia
-lye
-lyen
-lying
-lym
-lymoges
-lynn
-lysander
-m
-ma
-maan
-mab
-macbeth
-maccabaeus
-macdonwald
-macduff
-mace
-macedon
-maces
-machiavel
-machination
-machinations
-machine
-mack
-macmorris
-maculate
-maculation
-mad
-madam
-madame
-madams
-madcap
-madded
-madding
-made
-madeira
-madly
-madman
-madmen
-madness
-madonna
-madrigals
-mads
-maecenas
-maggot
-maggots
-magic
-magical
-magician
-magistrate
-magistrates
-magnanimity
-magnanimous
-magni
-magnifi
-magnificence
-magnificent
-magnifico
-magnificoes
-magnus
-mahomet
-mahu
-maid
-maiden
-maidenhead
-maidenheads
-maidenhood
-maidenhoods
-maidenliest
-maidenly
-maidens
-maidhood
-maids
-mail
-mailed
-mails
-maim
-maimed
-maims
-main
-maincourse
-maine
-mainly
-mainmast
-mains
-maintain
-maintained
-maintains
-maintenance
-mais
-maison
-majestas
-majestee
-majestic
-majestical
-majestically
-majesties
-majesty
-major
-majority
-mak
-make
-makeless
-maker
-makers
-makes
-makest
-maketh
-making
-makings
-mal
-mala
-maladies
-malady
-malapert
-malcolm
-malcontent
-malcontents
-male
-maledictions
-malefactions
-malefactor
-malefactors
-males
-malevolence
-malevolent
-malhecho
-malice
-malicious
-maliciously
-malign
-malignancy
-malignant
-malignantly
-malkin
-mall
-mallard
-mallet
-mallows
-malmsey
-malt
-maltworms
-malvolio
-mamillius
-mammering
-mammet
-mammets
-mammock
-man
-manacle
-manacles
-manage
-managed
-manager
-managing
-manakin
-manchus
-mandate
-mandragora
-mandrake
-mandrakes
-mane
-manent
-manes
-manet
-manfully
-mangle
-mangled
-mangles
-mangling
-mangy
-manhood
-manhoods
-manifest
-manifested
-manifests
-manifold
-manifoldly
-manka
-mankind
-manlike
-manly
-mann
-manna
-manner
-mannerly
-manners
-manningtree
-mannish
-manor
-manors
-mans
-mansion
-mansionry
-mansions
-manslaughter
-mantle
-mantled
-mantles
-mantua
-mantuan
-manual
-manure
-manured
-manus
-many
-map
-mapp
-maps
-mar
-marble
-marbled
-marcade
-marcellus
-march
-marches
-marcheth
-marching
-marchioness
-marchpane
-marcians
-marcius
-marcus
-mardian
-mare
-mares
-marg
-margarelon
-margaret
-marge
-margent
-margery
-maria
-marian
-mariana
-maries
-marigold
-mariner
-mariners
-maritime
-marjoram
-mark
-marked
-market
-marketable
-marketplace
-markets
-marking
-markman
-marks
-marl
-marle
-marmoset
-marquess
-marquis
-marr
-marriage
-marriages
-married
-marries
-marring
-marrow
-marrowless
-marrows
-marry
-marrying
-mars
-marseilles
-marsh
-marshal
-marshalsea
-marshalship
-mart
-marted
-martem
-martext
-martial
-martin
-martino
-martius
-martlemas
-martlet
-marts
-martyr
-martyrs
-marullus
-marv
-marvel
-marvell
-marvellous
-marvellously
-marvels
-mary
-mas
-masculine
-masham
-mask
-masked
-masker
-maskers
-masking
-masks
-mason
-masonry
-masons
-masque
-masquers
-masques
-masquing
-mass
-massacre
-massacres
-masses
-massy
-mast
-mastcr
-master
-masterdom
-masterest
-masterless
-masterly
-masterpiece
-masters
-mastership
-mastic
-mastiff
-mastiffs
-masts
-match
-matches
-matcheth
-matching
-matchless
-mate
-mated
-mater
-material
-mates
-mathematics
-matin
-matron
-matrons
-matter
-matters
-matthew
-mattock
-mattress
-mature
-maturity
-maud
-maudlin
-maugre
-maul
-maund
-mauri
-mauritania
-mauvais
-maw
-maws
-maxim
-may
-mayday
-mayest
-mayor
-maypole
-mayst
-maz
-maze
-mazed
-mazes
-mazzard
-me
-meacock
-mead
-meadow
-meadows
-meads
-meagre
-meal
-meals
-mealy
-mean
-meanders
-meaner
-meanest
-meaneth
-meaning
-meanings
-meanly
-means
-meant
-meantime
-meanwhile
-measles
-measur
-measurable
-measure
-measured
-measureless
-measures
-measuring
-meat
-meats
-mechanic
-mechanical
-mechanicals
-mechanics
-mechante
-med
-medal
-meddle
-meddler
-meddling
-mede
-medea
-media
-mediation
-mediators
-medice
-medicinal
-medicine
-medicines
-meditate
-meditates
-meditating
-meditation
-meditations
-mediterranean
-mediterraneum
-medlar
-medlars
-meed
-meeds
-meek
-meekly
-meekness
-meet
-meeter
-meetest
-meeting
-meetings
-meetly
-meetness
-meets
-meg
-mehercle
-meilleur
-meiny
-meisen
-melancholies
-melancholy
-melford
-mell
-mellifluous
-mellow
-mellowing
-melodious
-melody
-melt
-melted
-melteth
-melting
-melts
-melun
-member
-members
-memento
-memorable
-memorandums
-memorial
-memorials
-memories
-memoriz
-memorize
-memory
-memphis
-men
-menac
-menace
-menaces
-menaphon
-menas
-mend
-mended
-mender
-mending
-mends
-menecrates
-menelaus
-menenius
-mental
-menteith
-mention
-mentis
-menton
-mephostophilus
-mer
-mercatante
-mercatio
-mercenaries
-mercenary
-mercer
-merchandise
-merchandized
-merchant
-merchants
-mercies
-merciful
-mercifully
-merciless
-mercurial
-mercuries
-mercury
-mercutio
-mercy
-mere
-mered
-merely
-merest
-meridian
-merit
-merited
-meritorious
-merits
-merlin
-mermaid
-mermaids
-merops
-merrier
-merriest
-merrily
-merriman
-merriment
-merriments
-merriness
-merry
-mervailous
-mes
-mesh
-meshes
-mesopotamia
-mess
-message
-messages
-messala
-messaline
-messenger
-messengers
-messes
-messina
-met
-metal
-metals
-metamorphis
-metamorphoses
-metaphor
-metaphysical
-metaphysics
-mete
-metellus
-meteor
-meteors
-meteyard
-metheglin
-metheglins
-methink
-methinks
-method
-methods
-methought
-methoughts
-metre
-metres
-metropolis
-mette
-mettle
-mettled
-meus
-mew
-mewed
-mewling
-mexico
-mi
-mice
-michael
-michaelmas
-micher
-miching
-mickle
-microcosm
-mid
-midas
-middest
-middle
-middleham
-midnight
-midriff
-midst
-midsummer
-midway
-midwife
-midwives
-mienne
-might
-mightful
-mightier
-mightiest
-mightily
-mightiness
-mightst
-mighty
-milan
-milch
-mild
-milder
-mildest
-mildew
-mildews
-mildly
-mildness
-mile
-miles
-milford
-militarist
-military
-milk
-milking
-milkmaid
-milks
-milksops
-milky
-mill
-mille
-miller
-milliner
-million
-millioned
-millions
-mills
-millstones
-milo
-mimic
-minc
-mince
-minces
-mincing
-mind
-minded
-minding
-mindless
-minds
-mine
-mineral
-minerals
-minerva
-mines
-mingle
-mingled
-mingling
-minikin
-minim
-minime
-minimo
-minimus
-mining
-minion
-minions
-minist
-minister
-ministers
-ministration
-minnow
-minnows
-minola
-minority
-minos
-minotaurs
-minstrel
-minstrels
-minstrelsy
-mint
-mints
-minute
-minutely
-minutes
-minx
-mio
-mir
-mirable
-miracle
-miracles
-miraculous
-miranda
-mire
-mirror
-mirrors
-mirth
-mirthful
-miry
-mis
-misadventur
-misadventure
-misanthropos
-misapplied
-misbecame
-misbecom
-misbecome
-misbegot
-misbegotten
-misbeliever
-misbelieving
-misbhav
-miscall
-miscalled
-miscarried
-miscarries
-miscarry
-miscarrying
-mischance
-mischances
-mischief
-mischiefs
-mischievous
-misconceived
-misconst
-misconster
-misconstruction
-misconstrued
-misconstrues
-miscreant
-miscreate
-misdeed
-misdeeds
-misdemean
-misdemeanours
-misdoubt
-misdoubteth
-misdoubts
-misenum
-miser
-miserable
-miserably
-misericorde
-miseries
-misers
-misery
-misfortune
-misfortunes
-misgive
-misgives
-misgiving
-misgoverned
-misgovernment
-misgraffed
-misguide
-mishap
-mishaps
-misheard
-misinterpret
-mislead
-misleader
-misleaders
-misleading
-misled
-mislike
-misord
-misplac
-misplaced
-misplaces
-mispris
-misprised
-misprision
-misprizing
-misproud
-misquote
-misreport
-miss
-missed
-misses
-misshap
-misshapen
-missheathed
-missing
-missingly
-missions
-missive
-missives
-misspoke
-mist
-mista
-mistak
-mistake
-mistaken
-mistakes
-mistaketh
-mistaking
-mistakings
-mistemp
-mistempered
-misterm
-mistful
-misthink
-misthought
-mistletoe
-mistook
-mistreadings
-mistress
-mistresses
-mistresss
-mistriship
-mistrust
-mistrusted
-mistrustful
-mistrusting
-mists
-misty
-misus
-misuse
-misused
-misuses
-mites
-mithridates
-mitigate
-mitigation
-mix
-mixed
-mixture
-mixtures
-mm
-mnd
-moan
-moans
-moat
-moated
-mobled
-mock
-mockable
-mocker
-mockeries
-mockers
-mockery
-mocking
-mocks
-mockvater
-mockwater
-model
-modena
-moderate
-moderately
-moderation
-modern
-modest
-modesties
-modestly
-modesty
-modicums
-modo
-module
-moe
-moi
-moiety
-moist
-moisten
-moisture
-moldwarp
-mole
-molehill
-moles
-molest
-molestation
-mollification
-mollis
-molten
-molto
-mome
-moment
-momentary
-moming
-mon
-monachum
-monarch
-monarchies
-monarchize
-monarcho
-monarchs
-monarchy
-monast
-monastery
-monastic
-monday
-monde
-money
-moneys
-mong
-monger
-mongers
-monging
-mongrel
-mongrels
-mongst
-monk
-monkey
-monkeys
-monks
-monmouth
-monopoly
-mons
-monsieur
-monsieurs
-monster
-monsters
-monstrous
-monstrously
-monstrousness
-monstruosity
-montacute
-montage
-montague
-montagues
-montano
-montant
-montez
-montferrat
-montgomery
-month
-monthly
-months
-montjoy
-monument
-monumental
-monuments
-mood
-moods
-moody
-moon
-moonbeams
-moonish
-moonlight
-moons
-moonshine
-moonshines
-moor
-moorfields
-moors
-moorship
-mop
-mope
-moping
-mopping
-mopsa
-moral
-moraler
-morality
-moralize
-mordake
-more
-moreover
-mores
-morgan
-mori
-morisco
-morn
-morning
-mornings
-morocco
-morris
-morrow
-morrows
-morsel
-morsels
-mort
-mortal
-mortality
-mortally
-mortals
-mortar
-mortgaged
-mortified
-mortifying
-mortimer
-mortimers
-mortis
-mortise
-morton
-mose
-moss
-mossgrown
-most
-mote
-moth
-mother
-mothers
-moths
-motion
-motionless
-motions
-motive
-motives
-motley
-mots
-mought
-mould
-moulded
-mouldeth
-moulds
-mouldy
-moult
-moulten
-mounch
-mounseur
-mounsieur
-mount
-mountain
-mountaineer
-mountaineers
-mountainous
-mountains
-mountant
-mountanto
-mountebank
-mountebanks
-mounted
-mounteth
-mounting
-mounts
-mourn
-mourned
-mourner
-mourners
-mournful
-mournfully
-mourning
-mourningly
-mournings
-mourns
-mous
-mouse
-mousetrap
-mousing
-mouth
-mouthed
-mouths
-mov
-movables
-move
-moveable
-moveables
-moved
-mover
-movers
-moves
-moveth
-moving
-movingly
-movousus
-mow
-mowbray
-mower
-mowing
-mows
-moy
-moys
-moyses
-mrs
-much
-muck
-mud
-mudded
-muddied
-muddy
-muffins
-muffl
-muffle
-muffled
-muffler
-muffling
-mugger
-mugs
-mulberries
-mulberry
-mule
-mules
-muleteers
-mulier
-mulieres
-muliteus
-mull
-mulmutius
-multiplied
-multiply
-multiplying
-multipotent
-multitude
-multitudes
-multitudinous
-mum
-mumble
-mumbling
-mummers
-mummy
-mun
-munch
-muniments
-munition
-murd
-murder
-murdered
-murderer
-murderers
-murdering
-murderous
-murders
-mure
-murk
-murkiest
-murky
-murmur
-murmurers
-murmuring
-murrain
-murray
-murrion
-murther
-murtherer
-murtherers
-murthering
-murtherous
-murthers
-mus
-muscadel
-muscovites
-muscovits
-muscovy
-muse
-muses
-mush
-mushrooms
-music
-musical
-musician
-musicians
-musics
-musing
-musings
-musk
-musket
-muskets
-muskos
-muss
-mussel
-mussels
-must
-mustachio
-mustard
-mustardseed
-muster
-mustering
-musters
-musty
-mutability
-mutable
-mutation
-mutations
-mute
-mutes
-mutest
-mutine
-mutineer
-mutineers
-mutines
-mutinies
-mutinous
-mutiny
-mutius
-mutter
-muttered
-mutton
-muttons
-mutual
-mutualities
-mutually
-muzzl
-muzzle
-muzzled
-mv
-mww
-my
-mynheers
-myrmidon
-myrmidons
-myrtle
-myself
-myst
-mysteries
-mystery
-n
-nag
-nage
-nags
-naiads
-nail
-nails
-nak
-naked
-nakedness
-nal
-nam
-name
-named
-nameless
-namely
-names
-namest
-naming
-nan
-nance
-nap
-nape
-napes
-napkin
-napkins
-naples
-napless
-napping
-naps
-narbon
-narcissus
-narines
-narrow
-narrowly
-naso
-nasty
-nathaniel
-natifs
-nation
-nations
-native
-nativity
-natur
-natural
-naturalize
-naturally
-nature
-natured
-natures
-natus
-naught
-naughtily
-naughty
-navarre
-nave
-navel
-navigation
-navy
-nay
-nayward
-nayword
-nazarite
-ne
-neaf
-neamnoins
-neanmoins
-neapolitan
-neapolitans
-near
-nearer
-nearest
-nearly
-nearness
-neat
-neatly
-neb
-nebour
-nebuchadnezzar
-nec
-necessaries
-necessarily
-necessary
-necessitied
-necessities
-necessity
-neck
-necklace
-necks
-nectar
-ned
-nedar
-need
-needed
-needer
-needful
-needfull
-needing
-needle
-needles
-needless
-needly
-needs
-needy
-neer
-neeze
-nefas
-negation
-negative
-negatives
-neglect
-neglected
-neglecting
-neglectingly
-neglection
-negligence
-negligent
-negotiate
-negotiations
-negro
-neigh
-neighbors
-neighbour
-neighbourhood
-neighbouring
-neighbourly
-neighbours
-neighing
-neighs
-neither
-nell
-nemean
-nemesis
-neoptolemus
-nephew
-nephews
-neptune
-ner
-nereides
-nerissa
-nero
-neroes
-ners
-nerve
-nerves
-nervii
-nervy
-nessus
-nest
-nestor
-nests
-net
-nether
-netherlands
-nets
-nettle
-nettled
-nettles
-neuter
-neutral
-nev
-never
-nevil
-nevils
-new
-newborn
-newer
-newest
-newgate
-newly
-newness
-news
-newsmongers
-newt
-newts
-next
-nibbling
-nicanor
-nice
-nicely
-niceness
-nicer
-nicety
-nicholas
-nick
-nickname
-nicks
-niece
-nieces
-niggard
-niggarding
-niggardly
-nigh
-night
-nightcap
-nightcaps
-nighted
-nightgown
-nightingale
-nightingales
-nightly
-nightmare
-nights
-nightwork
-nihil
-nile
-nill
-nilus
-nimble
-nimbleness
-nimbler
-nimbly
-nine
-nineteen
-ning
-ningly
-ninny
-ninth
-ninus
-niobe
-niobes
-nip
-nipp
-nipping
-nipple
-nips
-nit
-nly
-nnight
-nnights
-no
-noah
-nob
-nobility
-nobis
-noble
-nobleman
-noblemen
-nobleness
-nobler
-nobles
-noblesse
-noblest
-nobly
-nobody
-noces
-nod
-nodded
-nodding
-noddle
-noddles
-noddy
-nods
-noes
-nointed
-nois
-noise
-noiseless
-noisemaker
-noises
-noisome
-nole
-nominate
-nominated
-nomination
-nominativo
-non
-nonage
-nonce
-none
-nonino
-nonny
-nonpareil
-nonsuits
-nony
-nook
-nooks
-noon
-noonday
-noontide
-nor
-norbery
-norfolk
-norman
-normandy
-normans
-north
-northampton
-northamptonshire
-northerly
-northern
-northgate
-northumberland
-northumberlands
-northward
-norway
-norways
-norwegian
-norweyan
-nos
-nose
-nosegays
-noseless
-noses
-noster
-nostra
-nostril
-nostrils
-not
-notable
-notably
-notary
-notch
-note
-notebook
-noted
-notedly
-notes
-notest
-noteworthy
-nothing
-nothings
-notice
-notify
-noting
-notion
-notorious
-notoriously
-notre
-notwithstanding
-nought
-noun
-nouns
-nourish
-nourished
-nourisher
-nourishes
-nourisheth
-nourishing
-nourishment
-nous
-novel
-novelties
-novelty
-noverbs
-novi
-novice
-novices
-novum
-now
-nowhere
-noyance
-ns
-nt
-nubibus
-numa
-numb
-number
-numbered
-numbering
-numberless
-numbers
-numbness
-nun
-nuncio
-nuncle
-nunnery
-nuns
-nuntius
-nuptial
-nurs
-nurse
-nursed
-nurser
-nursery
-nurses
-nurseth
-nursh
-nursing
-nurtur
-nurture
-nut
-nuthook
-nutmeg
-nutmegs
-nutriment
-nuts
-nutshell
-ny
-nym
-nymph
-nymphs
-o
-oak
-oaken
-oaks
-oared
-oars
-oatcake
-oaten
-oath
-oathable
-oaths
-oats
-ob
-obduracy
-obdurate
-obedience
-obedient
-obeisance
-oberon
-obey
-obeyed
-obeying
-obeys
-obidicut
-object
-objected
-objections
-objects
-oblation
-oblations
-obligation
-obligations
-obliged
-oblique
-oblivion
-oblivious
-obloquy
-obscene
-obscenely
-obscur
-obscure
-obscured
-obscurely
-obscures
-obscuring
-obscurity
-obsequies
-obsequious
-obsequiously
-observ
-observance
-observances
-observancy
-observant
-observants
-observation
-observe
-observed
-observer
-observers
-observing
-observingly
-obsque
-obstacle
-obstacles
-obstinacy
-obstinate
-obstinately
-obstruct
-obstruction
-obstructions
-obtain
-obtained
-obtaining
-occasion
-occasions
-occident
-occidental
-occulted
-occupat
-occupation
-occupations
-occupied
-occupies
-occupy
-occurrence
-occurrences
-occurrents
-ocean
-oceans
-octavia
-octavius
-ocular
-od
-odd
-oddest
-oddly
-odds
-ode
-odes
-odious
-odoriferous
-odorous
-odour
-odours
-ods
-oeillades
-oes
-oeuvres
-of
-ofephesus
-off
-offal
-offence
-offenceful
-offences
-offend
-offended
-offendendo
-offender
-offenders
-offendeth
-offending
-offendress
-offends
-offense
-offenseless
-offenses
-offensive
-offer
-offered
-offering
-offerings
-offers
-offert
-offic
-office
-officed
-officer
-officers
-offices
-official
-officious
-offspring
-oft
-often
-oftener
-oftentimes
-oh
-oil
-oils
-oily
-old
-oldcastle
-olden
-older
-oldest
-oldness
-olive
-oliver
-olivers
-olives
-olivia
-olympian
-olympus
-oman
-omans
-omen
-ominous
-omission
-omit
-omittance
-omitted
-omitting
-omne
-omnes
-omnipotent
-on
-once
-one
-ones
-oneyers
-ongles
-onion
-onions
-only
-onset
-onward
-onwards
-oo
-ooze
-oozes
-oozy
-op
-opal
-ope
-open
-opener
-opening
-openly
-openness
-opens
-operant
-operate
-operation
-operations
-operative
-opes
-oph
-ophelia
-opinion
-opinions
-opportune
-opportunities
-opportunity
-oppos
-oppose
-opposed
-opposeless
-opposer
-opposers
-opposes
-opposing
-opposite
-opposites
-opposition
-oppositions
-oppress
-oppressed
-oppresses
-oppresseth
-oppressing
-oppression
-oppressor
-opprest
-opprobriously
-oppugnancy
-opulency
-opulent
-or
-oracle
-oracles
-orange
-oration
-orator
-orators
-oratory
-orb
-orbed
-orbs
-orchard
-orchards
-ord
-ordain
-ordained
-ordaining
-order
-ordered
-ordering
-orderless
-orderly
-orders
-ordinance
-ordinant
-ordinaries
-ordinary
-ordnance
-ords
-ordure
-ore
-organ
-organs
-orgillous
-orient
-orifex
-origin
-original
-orisons
-ork
-orlando
-orld
-orleans
-ornament
-ornaments
-orodes
-orphan
-orphans
-orpheus
-orsino
-ort
-orthography
-orts
-oscorbidulchos
-osier
-osiers
-osprey
-osr
-osric
-ossa
-ost
-ostent
-ostentare
-ostentation
-ostents
-ostler
-ostlers
-ostrich
-osw
-oswald
-othello
-other
-othergates
-others
-otherwhere
-otherwhiles
-otherwise
-otter
-ottoman
-ottomites
-oublie
-ouches
-ought
-oui
-ounce
-ounces
-ouphes
-our
-ours
-ourself
-ourselves
-ousel
-out
-outbids
-outbrave
-outbraves
-outbreak
-outcast
-outcries
-outcry
-outdar
-outdare
-outdares
-outdone
-outfac
-outface
-outfaced
-outfacing
-outfly
-outfrown
-outgo
-outgoes
-outgrown
-outjest
-outlaw
-outlawry
-outlaws
-outliv
-outlive
-outlives
-outliving
-outlook
-outlustres
-outpriz
-outrage
-outrageous
-outrages
-outran
-outright
-outroar
-outrun
-outrunning
-outruns
-outscold
-outscorn
-outsell
-outsells
-outside
-outsides
-outspeaks
-outsport
-outstare
-outstay
-outstood
-outstretch
-outstretched
-outstrike
-outstrip
-outstripped
-outswear
-outvenoms
-outward
-outwardly
-outwards
-outwear
-outweighs
-outwent
-outworn
-outworths
-oven
-over
-overawe
-overbear
-overblown
-overboard
-overbold
-overborne
-overbulk
-overbuys
-overcame
-overcast
-overcharg
-overcharged
-overcome
-overcomes
-overdone
-overearnest
-overfar
-overflow
-overflown
-overglance
-overgo
-overgone
-overgorg
-overgrown
-overhead
-overhear
-overheard
-overhold
-overjoyed
-overkind
-overland
-overleather
-overlive
-overlook
-overlooking
-overlooks
-overmaster
-overmounting
-overmuch
-overpass
-overpeer
-overpeering
-overplus
-overrul
-overrun
-overscutch
-overset
-overshades
-overshine
-overshines
-overshot
-oversights
-overspread
-overstain
-overswear
-overt
-overta
-overtake
-overtaketh
-overthrow
-overthrown
-overthrows
-overtook
-overtopp
-overture
-overturn
-overwatch
-overween
-overweening
-overweigh
-overwhelm
-overwhelming
-overworn
-ovid
-ovidius
-ow
-owe
-owed
-owedst
-owen
-owes
-owest
-oweth
-owing
-owl
-owls
-own
-owner
-owners
-owning
-owns
-owy
-ox
-oxen
-oxford
-oxfordshire
-oxlips
-oyes
-oyster
-p
-pabble
-pabylon
-pac
-pace
-paced
-paces
-pacified
-pacify
-pacing
-pack
-packet
-packets
-packhorses
-packing
-packings
-packs
-packthread
-pacorus
-paction
-pad
-paddle
-paddling
-paddock
-padua
-pagan
-pagans
-page
-pageant
-pageants
-pages
-pah
-paid
-pail
-pailfuls
-pails
-pain
-pained
-painful
-painfully
-pains
-paint
-painted
-painter
-painting
-paintings
-paints
-pair
-paired
-pairs
-pajock
-pal
-palabras
-palace
-palaces
-palamedes
-palate
-palates
-palatine
-palating
-pale
-paled
-paleness
-paler
-pales
-palestine
-palfrey
-palfreys
-palisadoes
-pall
-pallabris
-pallas
-pallets
-palm
-palmer
-palmers
-palms
-palmy
-palpable
-palsied
-palsies
-palsy
-palt
-palter
-paltry
-paly
-pamp
-pamper
-pamphlets
-pan
-pancackes
-pancake
-pancakes
-pandar
-pandars
-pandarus
-pander
-panderly
-panders
-pandulph
-panel
-pang
-panging
-pangs
-pannier
-pannonians
-pansa
-pansies
-pant
-pantaloon
-panted
-pantheon
-panther
-panthino
-panting
-pantingly
-pantler
-pantry
-pants
-pap
-papal
-paper
-papers
-paphlagonia
-paphos
-papist
-paps
-par
-parable
-paracelsus
-paradise
-paradox
-paradoxes
-paragon
-paragons
-parallel
-parallels
-paramour
-paramours
-parapets
-paraquito
-parasite
-parasites
-parca
-parcel
-parcell
-parcels
-parch
-parched
-parching
-parchment
-pard
-pardon
-pardona
-pardoned
-pardoner
-pardoning
-pardonne
-pardonner
-pardonnez
-pardons
-pare
-pared
-parel
-parent
-parentage
-parents
-parfect
-paring
-parings
-paris
-parish
-parishioners
-parisians
-paritors
-park
-parks
-parle
-parler
-parles
-parley
-parlez
-parliament
-parlors
-parlour
-parlous
-parmacity
-parolles
-parricide
-parricides
-parrot
-parrots
-parsley
-parson
-part
-partake
-partaken
-partaker
-partakers
-parted
-parthia
-parthian
-parthians
-parti
-partial
-partialize
-partially
-participate
-participation
-particle
-particular
-particularities
-particularize
-particularly
-particulars
-parties
-parting
-partisan
-partisans
-partition
-partizan
-partlet
-partly
-partner
-partners
-partridge
-parts
-party
-pas
-pash
-pashed
-pashful
-pass
-passable
-passado
-passage
-passages
-passant
-passed
-passenger
-passengers
-passes
-passeth
-passing
-passio
-passion
-passionate
-passioning
-passions
-passive
-passport
-passy
-past
-paste
-pasterns
-pasties
-pastime
-pastimes
-pastoral
-pastorals
-pastors
-pastry
-pasture
-pastures
-pasty
-pat
-patay
-patch
-patchery
-patches
-pate
-pated
-patent
-patents
-paternal
-pates
-path
-pathetical
-paths
-pathway
-pathways
-patience
-patient
-patiently
-patients
-patines
-patrician
-patricians
-patrick
-patrimony
-patroclus
-patron
-patronage
-patroness
-patrons
-patrum
-patter
-pattern
-patterns
-pattle
-pauca
-paucas
-paul
-paulina
-paunch
-paunches
-pause
-pauser
-pauses
-pausingly
-pauvres
-pav
-paved
-pavement
-pavilion
-pavilions
-pavin
-paw
-pawn
-pawns
-paws
-pax
-pay
-payest
-paying
-payment
-payments
-pays
-paysan
-paysans
-pe
-peace
-peaceable
-peaceably
-peaceful
-peacemakers
-peaces
-peach
-peaches
-peacock
-peacocks
-peak
-peaking
-peal
-peals
-pear
-peard
-pearl
-pearls
-pears
-peas
-peasant
-peasantry
-peasants
-peascod
-pease
-peaseblossom
-peat
-peaten
-peating
-pebble
-pebbled
-pebbles
-peck
-pecks
-peculiar
-pecus
-pedant
-pedantical
-pedascule
-pede
-pedestal
-pedigree
-pedlar
-pedlars
-pedro
-peds
-peel
-peep
-peeped
-peeping
-peeps
-peer
-peereth
-peering
-peerless
-peers
-peesel
-peevish
-peevishly
-peflur
-peg
-pegasus
-pegs
-peise
-peised
-peize
-pelf
-pelican
-pelion
-pell
-pella
-pelleted
-peloponnesus
-pelt
-pelting
-pembroke
-pen
-penalties
-penalty
-penance
-pence
-pencil
-pencill
-pencils
-pendant
-pendent
-pendragon
-pendulous
-penelope
-penetrable
-penetrate
-penetrative
-penitence
-penitent
-penitential
-penitently
-penitents
-penker
-penknife
-penn
-penned
-penning
-pennons
-penny
-pennyworth
-pennyworths
-pens
-pense
-pension
-pensioners
-pensive
-pensived
-pensively
-pent
-pentecost
-penthesilea
-penthouse
-penurious
-penury
-peopl
-people
-peopled
-peoples
-pepin
-pepper
-peppercorn
-peppered
-per
-peradventure
-peradventures
-perceiv
-perceive
-perceived
-perceives
-perceiveth
-perch
-perchance
-percies
-percussion
-percy
-perdie
-perdita
-perdition
-perdonato
-perdu
-perdurable
-perdurably
-perdy
-pere
-peregrinate
-peremptorily
-peremptory
-perfect
-perfected
-perfecter
-perfectest
-perfection
-perfections
-perfectly
-perfectness
-perfidious
-perfidiously
-perforce
-perform
-performance
-performances
-performed
-performer
-performers
-performing
-performs
-perfum
-perfume
-perfumed
-perfumer
-perfumes
-perge
-perhaps
-periapts
-perigort
-perigouna
-peril
-perilous
-perils
-period
-periods
-perish
-perished
-perishest
-perisheth
-perishing
-periwig
-perjur
-perjure
-perjured
-perjuries
-perjury
-perk
-perkes
-permafoy
-permanent
-permission
-permissive
-permit
-permitted
-pernicious
-perniciously
-peroration
-perpend
-perpendicular
-perpendicularly
-perpetual
-perpetually
-perpetuity
-perplex
-perplexed
-perplexity
-pers
-persecuted
-persecutions
-persecutor
-perseus
-persever
-perseverance
-persevers
-persia
-persian
-persist
-persisted
-persistency
-persistive
-persists
-person
-personae
-personage
-personages
-personal
-personally
-personate
-personated
-personates
-personating
-persons
-perspective
-perspectively
-perspectives
-perspicuous
-persuade
-persuaded
-persuades
-persuading
-persuasion
-persuasions
-pert
-pertain
-pertaining
-pertains
-pertaunt
-pertinent
-pertly
-perturb
-perturbation
-perturbations
-perturbed
-perus
-perusal
-peruse
-perused
-perusing
-perverse
-perversely
-perverseness
-pervert
-perverted
-peseech
-pest
-pester
-pestiferous
-pestilence
-pestilent
-pet
-petar
-peter
-petit
-petition
-petitionary
-petitioner
-petitioners
-petitions
-peto
-petrarch
-petruchio
-petter
-petticoat
-petticoats
-pettiness
-pettish
-pettitoes
-petty
-peu
-pew
-pewter
-pewterer
-phaethon
-phaeton
-phantasime
-phantasimes
-phantasma
-pharamond
-pharaoh
-pharsalia
-pheasant
-pheazar
-phebe
-phebes
-pheebus
-pheeze
-phibbus
-philadelphos
-philario
-philarmonus
-philemon
-philip
-philippan
-philippe
-philippi
-phillida
-philo
-philomel
-philomela
-philosopher
-philosophers
-philosophical
-philosophy
-philostrate
-philotus
-phlegmatic
-phoebe
-phoebus
-phoenicia
-phoenicians
-phoenix
-phorbus
-photinus
-phrase
-phraseless
-phrases
-phrygia
-phrygian
-phrynia
-physic
-physical
-physician
-physicians
-physics
-pia
-pibble
-pible
-picardy
-pick
-pickaxe
-pickaxes
-pickbone
-picked
-pickers
-picking
-pickle
-picklock
-pickpurse
-picks
-pickt
-pickthanks
-pictur
-picture
-pictured
-pictures
-pid
-pie
-piec
-piece
-pieces
-piecing
-pied
-piedness
-pier
-pierc
-pierce
-pierced
-pierces
-pierceth
-piercing
-piercy
-piers
-pies
-piety
-pig
-pigeon
-pigeons
-pight
-pigmy
-pigrogromitus
-pike
-pikes
-pil
-pilate
-pilates
-pilchers
-pile
-piles
-pilf
-pilfering
-pilgrim
-pilgrimage
-pilgrims
-pill
-pillage
-pillagers
-pillar
-pillars
-pillicock
-pillory
-pillow
-pillows
-pills
-pilot
-pilots
-pimpernell
-pin
-pinch
-pinched
-pinches
-pinching
-pindarus
-pine
-pined
-pines
-pinfold
-pining
-pinion
-pink
-pinn
-pinnace
-pins
-pinse
-pint
-pintpot
-pioned
-pioneers
-pioner
-pioners
-pious
-pip
-pipe
-piper
-pipers
-pipes
-piping
-pippin
-pippins
-pirate
-pirates
-pisa
-pisanio
-pish
-pismires
-piss
-pissing
-pistol
-pistols
-pit
-pitch
-pitched
-pitcher
-pitchers
-pitchy
-piteous
-piteously
-pitfall
-pith
-pithless
-pithy
-pitie
-pitied
-pities
-pitiful
-pitifully
-pitiless
-pits
-pittance
-pittie
-pittikins
-pity
-pitying
-pius
-plac
-place
-placed
-placentio
-places
-placeth
-placid
-placing
-plack
-placket
-plackets
-plagu
-plague
-plagued
-plagues
-plaguing
-plaguy
-plain
-plainer
-plainest
-plaining
-plainings
-plainly
-plainness
-plains
-plainsong
-plaintful
-plaintiff
-plaintiffs
-plaints
-planched
-planet
-planetary
-planets
-planks
-plant
-plantage
-plantagenet
-plantagenets
-plantain
-plantation
-planted
-planteth
-plants
-plash
-plashy
-plast
-plaster
-plasterer
-plat
-plate
-plated
-plates
-platform
-platforms
-plats
-platted
-plausible
-plausive
-plautus
-play
-played
-player
-players
-playeth
-playfellow
-playfellows
-playhouse
-playing
-plays
-plea
-pleach
-pleached
-plead
-pleaded
-pleader
-pleaders
-pleading
-pleads
-pleas
-pleasance
-pleasant
-pleasantly
-please
-pleased
-pleaser
-pleasers
-pleases
-pleasest
-pleaseth
-pleasing
-pleasure
-pleasures
-plebeians
-plebeii
-plebs
-pledge
-pledges
-pleines
-plenitude
-plenteous
-plenteously
-plenties
-plentiful
-plentifully
-plenty
-pless
-plessed
-plessing
-pliant
-plied
-plies
-plight
-plighted
-plighter
-plod
-plodded
-plodders
-plodding
-plods
-plood
-ploody
-plot
-plots
-plotted
-plotter
-plough
-ploughed
-ploughman
-ploughmen
-plow
-plows
-pluck
-plucked
-plucker
-plucking
-plucks
-plue
-plum
-plume
-plumed
-plumes
-plummet
-plump
-plumpy
-plums
-plung
-plunge
-plunged
-plural
-plurisy
-plus
-pluto
-plutus
-ply
-po
-pocket
-pocketing
-pockets
-pocky
-pody
-poem
-poesy
-poet
-poetical
-poetry
-poets
-poictiers
-poinards
-poins
-point
-pointblank
-pointed
-pointing
-points
-pois
-poise
-poising
-poison
-poisoned
-poisoner
-poisoning
-poisonous
-poisons
-poke
-poking
-pol
-polack
-polacks
-poland
-pold
-pole
-poleaxe
-polecat
-polecats
-polemon
-poles
-poli
-policies
-policy
-polish
-polished
-politic
-politician
-politicians
-politicly
-polixenes
-poll
-polluted
-pollution
-polonius
-poltroons
-polusion
-polydamus
-polydore
-polyxena
-pomander
-pomegranate
-pomewater
-pomfret
-pomgarnet
-pommel
-pomp
-pompeius
-pompey
-pompion
-pompous
-pomps
-pond
-ponder
-ponderous
-ponds
-poniard
-poniards
-pont
-pontic
-pontifical
-ponton
-pooh
-pool
-poole
-poop
-poor
-poorer
-poorest
-poorly
-pop
-pope
-popedom
-popilius
-popingay
-popish
-popp
-poppy
-pops
-popular
-popularity
-populous
-porch
-porches
-pore
-poring
-pork
-porn
-porpentine
-porridge
-porringer
-port
-portable
-portage
-portal
-portance
-portcullis
-portend
-portends
-portent
-portentous
-portents
-porter
-porters
-portia
-portion
-portly
-portotartarossa
-portrait
-portraiture
-ports
-portugal
-pose
-posied
-posies
-position
-positive
-positively
-posse
-possess
-possessed
-possesses
-possesseth
-possessing
-possession
-possessions
-possessor
-posset
-possets
-possibilities
-possibility
-possible
-possibly
-possitable
-post
-poste
-posted
-posterior
-posteriors
-posterity
-postern
-posterns
-posters
-posthorse
-posthorses
-posthumus
-posting
-postmaster
-posts
-postscript
-posture
-postures
-posy
-pot
-potable
-potations
-potato
-potatoes
-potch
-potency
-potent
-potentates
-potential
-potently
-potents
-pothecary
-pother
-potion
-potions
-potpan
-pots
-potter
-potting
-pottle
-pouch
-poulter
-poultice
-poultney
-pouncet
-pound
-pounds
-pour
-pourest
-pouring
-pourquoi
-pours
-pout
-poverty
-pow
-powd
-powder
-power
-powerful
-powerfully
-powerless
-powers
-pox
-poys
-poysam
-prabbles
-practic
-practice
-practiced
-practicer
-practices
-practicing
-practis
-practisants
-practise
-practiser
-practisers
-practises
-practising
-praeclarissimus
-praemunire
-praetor
-praetors
-pragging
-prague
-prain
-prains
-prais
-praise
-praised
-praises
-praisest
-praiseworthy
-praising
-prancing
-prank
-pranks
-prat
-prate
-prated
-prater
-prating
-prattle
-prattler
-prattling
-prave
-prawls
-prawns
-pray
-prayer
-prayers
-praying
-prays
-pre
-preach
-preached
-preachers
-preaches
-preaching
-preachment
-pread
-preambulate
-precedence
-precedent
-preceding
-precept
-preceptial
-precepts
-precinct
-precious
-preciously
-precipice
-precipitating
-precipitation
-precise
-precisely
-preciseness
-precisian
-precor
-precurse
-precursors
-predeceased
-predecessor
-predecessors
-predestinate
-predicament
-predict
-prediction
-predictions
-predominance
-predominant
-predominate
-preeches
-preeminence
-preface
-prefer
-preferment
-preferments
-preferr
-preferreth
-preferring
-prefers
-prefiguring
-prefix
-prefixed
-preformed
-pregnancy
-pregnant
-pregnantly
-prejudicates
-prejudice
-prejudicial
-prelate
-premeditated
-premeditation
-premised
-premises
-prenez
-prenominate
-prentice
-prentices
-preordinance
-prepar
-preparation
-preparations
-prepare
-prepared
-preparedly
-prepares
-preparing
-prepost
-preposterous
-preposterously
-prerogatifes
-prerogative
-prerogatived
-presage
-presagers
-presages
-presageth
-presaging
-prescience
-prescribe
-prescript
-prescription
-prescriptions
-prescripts
-presence
-presences
-present
-presentation
-presented
-presenter
-presenters
-presenteth
-presenting
-presently
-presentment
-presents
-preserv
-preservation
-preservative
-preserve
-preserved
-preserver
-preservers
-preserving
-president
-press
-pressed
-presser
-presses
-pressing
-pressure
-pressures
-prest
-prester
-presume
-presumes
-presuming
-presumption
-presumptuous
-presuppos
-pret
-pretence
-pretences
-pretend
-pretended
-pretending
-pretense
-pretext
-pretia
-prettier
-prettiest
-prettily
-prettiness
-pretty
-prevail
-prevailed
-prevaileth
-prevailing
-prevailment
-prevails
-prevent
-prevented
-prevention
-preventions
-prevents
-prey
-preyful
-preys
-priam
-priami
-priamus
-pribbles
-price
-prick
-pricked
-pricket
-pricking
-pricks
-pricksong
-pride
-prides
-pridge
-prie
-pried
-prief
-pries
-priest
-priesthood
-priests
-prig
-primal
-prime
-primer
-primero
-primest
-primitive
-primo
-primogenity
-primrose
-primroses
-primy
-prince
-princely
-princes
-princess
-principal
-principalities
-principality
-principle
-principles
-princox
-prings
-print
-printed
-printing
-printless
-prints
-prioress
-priories
-priority
-priory
-priscian
-prison
-prisoner
-prisoners
-prisonment
-prisonnier
-prisons
-pristine
-prithe
-prithee
-privacy
-private
-privately
-privates
-privilage
-privileg
-privilege
-privileged
-privileges
-privilegio
-privily
-privity
-privy
-priz
-prize
-prized
-prizer
-prizes
-prizest
-prizing
-pro
-probable
-probal
-probation
-proceed
-proceeded
-proceeders
-proceeding
-proceedings
-proceeds
-process
-procession
-proclaim
-proclaimed
-proclaimeth
-proclaims
-proclamation
-proclamations
-proconsul
-procrastinate
-procreant
-procreants
-procreation
-procrus
-proculeius
-procur
-procurator
-procure
-procured
-procures
-procuring
-prodigal
-prodigality
-prodigally
-prodigals
-prodigies
-prodigious
-prodigiously
-prodigy
-proditor
-produc
-produce
-produced
-produces
-producing
-proface
-profan
-profanation
-profane
-profaned
-profanely
-profaneness
-profaners
-profaning
-profess
-professed
-professes
-profession
-professions
-professors
-proffer
-proffered
-profferer
-proffers
-proficient
-profit
-profitable
-profitably
-profited
-profiting
-profitless
-profits
-profound
-profoundest
-profoundly
-progenitors
-progeny
-progne
-prognosticate
-prognostication
-progress
-progression
-prohibit
-prohibition
-project
-projection
-projects
-prolixious
-prolixity
-prologue
-prologues
-prolong
-prolongs
-promethean
-prometheus
-promis
-promise
-promised
-promises
-promiseth
-promising
-promontory
-promotion
-promotions
-prompt
-prompted
-promptement
-prompter
-prompting
-prompts
-prompture
-promulgate
-prone
-prononcer
-prononcez
-pronoun
-pronounc
-pronounce
-pronounced
-pronouncing
-pronouns
-proof
-proofs
-prop
-propagate
-propagation
-propend
-propension
-proper
-properer
-properly
-propertied
-properties
-property
-prophecies
-prophecy
-prophesied
-prophesier
-prophesy
-prophesying
-prophet
-prophetess
-prophetic
-prophetically
-prophets
-propinquity
-propontic
-proportion
-proportionable
-proportions
-propos
-propose
-proposed
-proposer
-proposes
-proposing
-proposition
-propositions
-propounded
-propp
-propre
-propriety
-props
-propugnation
-prorogue
-prorogued
-proscription
-proscriptions
-prose
-prosecute
-prosecution
-proselytes
-proserpina
-prosp
-prospect
-prosper
-prosperity
-prospero
-prosperous
-prosperously
-prospers
-prostitute
-prostrate
-protect
-protected
-protection
-protector
-protectors
-protectorship
-protectress
-protects
-protest
-protestation
-protestations
-protested
-protester
-protesting
-protests
-proteus
-protheus
-protract
-protractive
-proud
-prouder
-proudest
-proudlier
-proudly
-prouds
-prov
-provand
-prove
-proved
-provender
-proverb
-proverbs
-proves
-proveth
-provide
-provided
-providence
-provident
-providently
-provider
-provides
-province
-provinces
-provincial
-proving
-provision
-proviso
-provocation
-provok
-provoke
-provoked
-provoker
-provokes
-provoketh
-provoking
-provost
-prowess
-prudence
-prudent
-prun
-prune
-prunes
-pruning
-pry
-prying
-psalm
-psalmist
-psalms
-psalteries
-ptolemies
-ptolemy
-public
-publican
-publication
-publicly
-publicola
-publish
-published
-publisher
-publishing
-publius
-pucelle
-puck
-pudder
-pudding
-puddings
-puddle
-puddled
-pudency
-pueritia
-puff
-puffing
-puffs
-pugging
-puis
-puissance
-puissant
-puke
-puking
-pulcher
-puling
-pull
-puller
-pullet
-pulling
-pulls
-pulpit
-pulpiter
-pulpits
-pulse
-pulsidge
-pump
-pumpion
-pumps
-pun
-punched
-punish
-punished
-punishes
-punishment
-punishments
-punk
-punto
-puny
-pupil
-pupils
-puppet
-puppets
-puppies
-puppy
-pur
-purblind
-purchas
-purchase
-purchased
-purchases
-purchaseth
-purchasing
-pure
-purely
-purer
-purest
-purg
-purgation
-purgative
-purgatory
-purge
-purged
-purgers
-purging
-purifies
-purifying
-puritan
-purity
-purlieus
-purple
-purpled
-purples
-purport
-purpos
-purpose
-purposed
-purposely
-purposes
-purposeth
-purposing
-purr
-purs
-purse
-pursents
-purses
-pursu
-pursue
-pursued
-pursuers
-pursues
-pursuest
-pursueth
-pursuing
-pursuit
-pursuivant
-pursuivants
-pursy
-purus
-purveyor
-push
-pushes
-pusillanimity
-put
-putrefy
-putrified
-puts
-putter
-putting
-puttock
-puzzel
-puzzle
-puzzled
-puzzles
-py
-pygmalion
-pygmies
-pygmy
-pyramid
-pyramides
-pyramids
-pyramis
-pyramises
-pyramus
-pyrenean
-pyrrhus
-pythagoras
-qu
-quadrangle
-quae
-quaff
-quaffing
-quagmire
-quail
-quailing
-quails
-quaint
-quaintly
-quak
-quake
-quakes
-qualification
-qualified
-qualifies
-qualify
-qualifying
-qualite
-qualities
-quality
-qualm
-qualmish
-quam
-quand
-quando
-quantities
-quantity
-quare
-quarrel
-quarrell
-quarreller
-quarrelling
-quarrelous
-quarrels
-quarrelsome
-quarries
-quarry
-quart
-quarter
-quartered
-quartering
-quarters
-quarts
-quasi
-quat
-quatch
-quay
-que
-quean
-queas
-queasiness
-queasy
-queen
-queens
-quell
-queller
-quench
-quenched
-quenching
-quenchless
-quern
-quest
-questant
-question
-questionable
-questioned
-questioning
-questionless
-questions
-questrists
-quests
-queubus
-qui
-quick
-quicken
-quickens
-quicker
-quicklier
-quickly
-quickness
-quicksand
-quicksands
-quicksilverr
-quid
-quiddities
-quiddits
-quier
-quiet
-quieter
-quietly
-quietness
-quietus
-quill
-quillets
-quills
-quilt
-quinapalus
-quince
-quinces
-quintain
-quintessence
-quintus
-quip
-quips
-quire
-quiring
-quirk
-quirks
-quis
-quit
-quite
-quits
-quittance
-quitted
-quitting
-quiver
-quivering
-quivers
-quo
-quod
-quoifs
-quoint
-quoit
-quoits
-quondam
-quoniam
-quote
-quoted
-quotes
-quoth
-quotidian
-r
-rabbit
-rabble
-rabblement
-race
-rack
-rackers
-racket
-rackets
-racking
-racks
-radiance
-radiant
-radish
-rafe
-raft
-rag
-rage
-rages
-rageth
-ragg
-ragged
-raggedness
-raging
-ragozine
-rags
-rah
-rail
-railed
-railer
-railest
-raileth
-railing
-rails
-raiment
-rain
-rainbow
-raineth
-raining
-rainold
-rains
-rainy
-rais
-raise
-raised
-raises
-raising
-raisins
-rak
-rake
-rakers
-rakes
-ral
-rald
-ralph
-ram
-rambures
-ramm
-rampallian
-rampant
-ramping
-rampir
-ramps
-rams
-ramsey
-ramston
-ran
-rance
-rancorous
-rancors
-rancour
-random
-rang
-range
-ranged
-rangers
-ranges
-ranging
-rank
-ranker
-rankest
-ranking
-rankle
-rankly
-rankness
-ranks
-ransack
-ransacking
-ransom
-ransomed
-ransoming
-ransomless
-ransoms
-rant
-ranting
-rap
-rape
-rapes
-rapier
-rapiers
-rapine
-raps
-rapt
-rapture
-raptures
-rar
-rare
-rarely
-rareness
-rarer
-rarest
-rarities
-rarity
-rascal
-rascalliest
-rascally
-rascals
-rased
-rash
-rasher
-rashly
-rashness
-rat
-ratcatcher
-ratcliff
-rate
-rated
-rately
-rates
-rather
-ratherest
-ratified
-ratifiers
-ratify
-rating
-rational
-ratolorum
-rats
-ratsbane
-rattle
-rattles
-rattling
-rature
-raught
-rav
-rave
-ravel
-raven
-ravening
-ravenous
-ravens
-ravenspurgh
-raves
-ravin
-raving
-ravish
-ravished
-ravisher
-ravishing
-ravishments
-raw
-rawer
-rawly
-rawness
-ray
-rayed
-rays
-raz
-raze
-razed
-razes
-razeth
-razing
-razor
-razorable
-razors
-razure
-re
-reach
-reaches
-reacheth
-reaching
-read
-reader
-readiest
-readily
-readiness
-reading
-readins
-reads
-ready
-real
-really
-realm
-realms
-reap
-reapers
-reaping
-reaps
-rear
-rears
-rearward
-reason
-reasonable
-reasonably
-reasoned
-reasoning
-reasonless
-reasons
-reave
-rebate
-rebato
-rebeck
-rebel
-rebell
-rebelling
-rebellion
-rebellious
-rebels
-rebound
-rebuk
-rebuke
-rebukeable
-rebuked
-rebukes
-rebus
-recall
-recant
-recantation
-recanter
-recanting
-receipt
-receipts
-receiv
-receive
-received
-receiver
-receives
-receivest
-receiveth
-receiving
-receptacle
-rechate
-reciprocal
-reciprocally
-recite
-recited
-reciterai
-reck
-recking
-reckless
-reckon
-reckoned
-reckoning
-reckonings
-recks
-reclaim
-reclaims
-reclusive
-recognizance
-recognizances
-recoil
-recoiling
-recollected
-recomforted
-recomforture
-recommend
-recommended
-recommends
-recompens
-recompense
-reconcil
-reconcile
-reconciled
-reconcilement
-reconciler
-reconciles
-reconciliation
-record
-recordation
-recorded
-recorder
-recorders
-records
-recount
-recounted
-recounting
-recountments
-recounts
-recourse
-recov
-recover
-recoverable
-recovered
-recoveries
-recovers
-recovery
-recreant
-recreants
-recreate
-recreation
-rectify
-rector
-rectorship
-recure
-recured
-red
-redbreast
-redder
-reddest
-rede
-redeem
-redeemed
-redeemer
-redeeming
-redeems
-redeliver
-redemption
-redime
-redness
-redoubled
-redoubted
-redound
-redress
-redressed
-redresses
-reduce
-reechy
-reed
-reeds
-reek
-reeking
-reeks
-reeky
-reel
-reeleth
-reeling
-reels
-refell
-refer
-reference
-referr
-referred
-refigured
-refin
-refined
-reflect
-reflecting
-reflection
-reflex
-reform
-reformation
-reformed
-refractory
-refrain
-refresh
-refreshing
-reft
-refts
-refuge
-refus
-refusal
-refuse
-refused
-refusest
-refusing
-reg
-regal
-regalia
-regan
-regard
-regardance
-regarded
-regardfully
-regarding
-regards
-regenerate
-regent
-regentship
-regia
-regiment
-regiments
-regina
-region
-regions
-regist
-register
-registers
-regreet
-regreets
-regress
-reguerdon
-regular
-rehears
-rehearsal
-rehearse
-reign
-reigned
-reignier
-reigning
-reigns
-rein
-reinforc
-reinforce
-reinforcement
-reins
-reiterate
-reject
-rejected
-rejoic
-rejoice
-rejoices
-rejoiceth
-rejoicing
-rejoicingly
-rejoindure
-rejourn
-rel
-relapse
-relate
-relates
-relation
-relations
-relative
-releas
-release
-released
-releasing
-relent
-relenting
-relents
-reliances
-relics
-relief
-reliev
-relieve
-relieved
-relieves
-relieving
-religion
-religions
-religious
-religiously
-relinquish
-reliques
-reliquit
-relish
-relume
-rely
-relying
-remain
-remainder
-remainders
-remained
-remaineth
-remaining
-remains
-remark
-remarkable
-remediate
-remedied
-remedies
-remedy
-rememb
-remember
-remembered
-remembers
-remembrance
-remembrancer
-remembrances
-remercimens
-remiss
-remission
-remissness
-remit
-remnant
-remnants
-remonstrance
-remorse
-remorseful
-remorseless
-remote
-remotion
-remov
-remove
-removed
-removedness
-remover
-removes
-removing
-remunerate
-remuneration
-rence
-rend
-render
-rendered
-renders
-rendezvous
-renegado
-renege
-reneges
-renew
-renewed
-renewest
-renounce
-renouncement
-renouncing
-renowmed
-renown
-renowned
-rent
-rents
-repaid
-repair
-repaired
-repairing
-repairs
-repass
-repast
-repasture
-repay
-repaying
-repays
-repeal
-repealing
-repeals
-repeat
-repeated
-repeating
-repeats
-repel
-repent
-repentance
-repentant
-repented
-repenting
-repents
-repetition
-repetitions
-repin
-repine
-repining
-replant
-replenish
-replenished
-replete
-replication
-replied
-replies
-repliest
-reply
-replying
-report
-reported
-reporter
-reportest
-reporting
-reportingly
-reports
-reposal
-repose
-reposeth
-reposing
-repossess
-reprehend
-reprehended
-reprehending
-represent
-representing
-reprieve
-reprieves
-reprisal
-reproach
-reproaches
-reproachful
-reproachfully
-reprobate
-reprobation
-reproof
-reprov
-reprove
-reproveable
-reproves
-reproving
-repugn
-repugnancy
-repugnant
-repulse
-repulsed
-repurchas
-repured
-reputation
-repute
-reputed
-reputeless
-reputes
-reputing
-request
-requested
-requesting
-requests
-requiem
-requir
-require
-required
-requires
-requireth
-requiring
-requisite
-requisites
-requit
-requital
-requite
-requited
-requites
-rer
-rere
-rers
-rescu
-rescue
-rescued
-rescues
-rescuing
-resemblance
-resemble
-resembled
-resembles
-resembleth
-resembling
-reserv
-reservation
-reserve
-reserved
-reserves
-reside
-residence
-resident
-resides
-residing
-residue
-resign
-resignation
-resist
-resistance
-resisted
-resisting
-resists
-resolute
-resolutely
-resolutes
-resolution
-resolv
-resolve
-resolved
-resolvedly
-resolves
-resolveth
-resort
-resorted
-resounding
-resounds
-respeaking
-respect
-respected
-respecting
-respective
-respectively
-respects
-respice
-respite
-respites
-responsive
-respose
-ress
-rest
-rested
-resteth
-restful
-resting
-restitution
-restless
-restor
-restoration
-restorative
-restore
-restored
-restores
-restoring
-restrain
-restrained
-restraining
-restrains
-restraint
-rests
-resty
-resum
-resume
-resumes
-resurrections
-retail
-retails
-retain
-retainers
-retaining
-retell
-retention
-retentive
-retinue
-retir
-retire
-retired
-retirement
-retires
-retiring
-retold
-retort
-retorts
-retourne
-retract
-retreat
-retrograde
-rets
-return
-returned
-returnest
-returneth
-returning
-returns
-revania
-reveal
-reveals
-revel
-reveler
-revell
-reveller
-revellers
-revelling
-revelry
-revels
-reveng
-revenge
-revenged
-revengeful
-revengement
-revenger
-revengers
-revenges
-revenging
-revengingly
-revenue
-revenues
-reverb
-reverberate
-reverbs
-reverenc
-reverence
-reverend
-reverent
-reverently
-revers
-reverse
-reversion
-reverted
-review
-reviewest
-revil
-revile
-revisits
-reviv
-revive
-revives
-reviving
-revok
-revoke
-revokement
-revolt
-revolted
-revolting
-revolts
-revolution
-revolutions
-revolve
-revolving
-reward
-rewarded
-rewarder
-rewarding
-rewards
-reword
-reworded
-rex
-rey
-reynaldo
-rford
-rful
-rfull
-rhapsody
-rheims
-rhenish
-rhesus
-rhetoric
-rheum
-rheumatic
-rheums
-rheumy
-rhinoceros
-rhodes
-rhodope
-rhubarb
-rhym
-rhyme
-rhymers
-rhymes
-rhyming
-rialto
-rib
-ribald
-riband
-ribands
-ribaudred
-ribb
-ribbed
-ribbon
-ribbons
-ribs
-rice
-rich
-richard
-richer
-riches
-richest
-richly
-richmond
-richmonds
-rid
-riddance
-ridden
-riddle
-riddles
-riddling
-ride
-rider
-riders
-rides
-ridest
-rideth
-ridge
-ridges
-ridiculous
-riding
-rids
-rien
-ries
-rifle
-rift
-rifted
-rig
-rigg
-riggish
-right
-righteous
-righteously
-rightful
-rightfully
-rightly
-rights
-rigol
-rigorous
-rigorously
-rigour
-ril
-rim
-rin
-rinaldo
-rind
-ring
-ringing
-ringleader
-ringlets
-rings
-ringwood
-riot
-rioter
-rioting
-riotous
-riots
-rip
-ripe
-ripely
-ripen
-ripened
-ripeness
-ripening
-ripens
-riper
-ripest
-riping
-ripp
-ripping
-rise
-risen
-rises
-riseth
-rish
-rising
-rite
-rites
-rivage
-rival
-rivality
-rivall
-rivals
-rive
-rived
-rivelled
-river
-rivers
-rivet
-riveted
-rivets
-rivo
-rj
-rless
-road
-roads
-roam
-roaming
-roan
-roar
-roared
-roarers
-roaring
-roars
-roast
-roasted
-rob
-roba
-robas
-robb
-robbed
-robber
-robbers
-robbery
-robbing
-robe
-robed
-robert
-robes
-robin
-robs
-robustious
-rochester
-rochford
-rock
-rocks
-rocky
-rod
-rode
-roderigo
-rods
-roe
-roes
-roger
-rogero
-rogue
-roguery
-rogues
-roguish
-roi
-roisting
-roll
-rolled
-rolling
-rolls
-rom
-romage
-roman
-romano
-romanos
-romans
-rome
-romeo
-romish
-rondure
-ronyon
-rood
-roof
-roofs
-rook
-rooks
-rooky
-room
-rooms
-root
-rooted
-rootedly
-rooteth
-rooting
-roots
-rope
-ropery
-ropes
-roping
-ros
-rosalind
-rosalinda
-rosalinde
-rosaline
-roscius
-rose
-rosed
-rosemary
-rosencrantz
-roses
-ross
-rosy
-rot
-rote
-roted
-rother
-rotherham
-rots
-rotted
-rotten
-rottenness
-rotting
-rotundity
-rouen
-rough
-rougher
-roughest
-roughly
-roughness
-round
-rounded
-roundel
-rounder
-roundest
-rounding
-roundly
-rounds
-roundure
-rous
-rouse
-roused
-rousillon
-rously
-roussi
-rout
-routed
-routs
-rove
-rover
-row
-rowel
-rowland
-rowlands
-roy
-royal
-royalize
-royally
-royalties
-royalty
-roynish
-rs
-rt
-rub
-rubb
-rubbing
-rubbish
-rubies
-rubious
-rubs
-ruby
-rud
-rudand
-rudder
-ruddiness
-ruddock
-ruddy
-rude
-rudely
-rudeness
-ruder
-rudesby
-rudest
-rudiments
-rue
-rued
-ruff
-ruffian
-ruffians
-ruffle
-ruffling
-ruffs
-rug
-rugby
-rugemount
-rugged
-ruin
-ruinate
-ruined
-ruining
-ruinous
-ruins
-rul
-rule
-ruled
-ruler
-rulers
-rules
-ruling
-rumble
-ruminaies
-ruminat
-ruminate
-ruminated
-ruminates
-rumination
-rumor
-rumour
-rumourer
-rumours
-rump
-run
-runagate
-runagates
-runaway
-runaways
-rung
-runn
-runner
-runners
-running
-runs
-rupture
-ruptures
-rural
-rush
-rushes
-rushing
-rushling
-rushy
-russet
-russia
-russian
-russians
-rust
-rusted
-rustic
-rustically
-rustics
-rustle
-rustling
-rusts
-rusty
-rut
-ruth
-ruthful
-ruthless
-rutland
-ruttish
-ry
-rye
-rything
-s
-sa
-saba
-sabbath
-sable
-sables
-sack
-sackbuts
-sackcloth
-sacked
-sackerson
-sacks
-sacrament
-sacred
-sacrific
-sacrifice
-sacrificers
-sacrifices
-sacrificial
-sacrificing
-sacrilegious
-sacring
-sad
-sadder
-saddest
-saddle
-saddler
-saddles
-sadly
-sadness
-saf
-safe
-safeguard
-safely
-safer
-safest
-safeties
-safety
-saffron
-sag
-sage
-sagittary
-said
-saidst
-sail
-sailing
-sailmaker
-sailor
-sailors
-sails
-sain
-saint
-sainted
-saintlike
-saints
-saith
-sake
-sakes
-sala
-salad
-salamander
-salary
-sale
-salerio
-salicam
-salique
-salisbury
-sall
-sallet
-sallets
-sallies
-sallow
-sally
-salmon
-salmons
-salt
-salter
-saltiers
-saltness
-saltpetre
-salutation
-salutations
-salute
-saluted
-salutes
-saluteth
-salv
-salvation
-salve
-salving
-same
-samingo
-samp
-sampire
-sample
-sampler
-sampson
-samson
-samsons
-sancta
-sanctified
-sanctifies
-sanctify
-sanctimonies
-sanctimonious
-sanctimony
-sanctities
-sanctity
-sanctuarize
-sanctuary
-sand
-sandal
-sandbag
-sanded
-sands
-sandy
-sandys
-sang
-sanguine
-sanguis
-sanity
-sans
-santrailles
-sap
-sapient
-sapit
-sapless
-sapling
-sapphire
-sapphires
-saracens
-sarcenet
-sard
-sardians
-sardinia
-sardis
-sarum
-sat
-satan
-satchel
-sate
-sated
-satiate
-satiety
-satin
-satire
-satirical
-satis
-satisfaction
-satisfied
-satisfies
-satisfy
-satisfying
-saturday
-saturdays
-saturn
-saturnine
-saturninus
-satyr
-satyrs
-sauc
-sauce
-sauced
-saucers
-sauces
-saucily
-sauciness
-saucy
-sauf
-saunder
-sav
-savage
-savagely
-savageness
-savagery
-savages
-save
-saved
-saves
-saving
-saviour
-savory
-savour
-savouring
-savours
-savoury
-savoy
-saw
-sawed
-sawest
-sawn
-sawpit
-saws
-sawyer
-saxons
-saxony
-saxton
-say
-sayest
-saying
-sayings
-says
-sayst
-sblood
-sc
-scab
-scabbard
-scabs
-scaffold
-scaffoldage
-scal
-scald
-scalded
-scalding
-scale
-scaled
-scales
-scaling
-scall
-scalp
-scalps
-scaly
-scamble
-scambling
-scamels
-scan
-scandal
-scandaliz
-scandalous
-scandy
-scann
-scant
-scanted
-scanter
-scanting
-scantling
-scants
-scap
-scape
-scaped
-scapes
-scapeth
-scar
-scarce
-scarcely
-scarcity
-scare
-scarecrow
-scarecrows
-scarf
-scarfed
-scarfs
-scaring
-scarlet
-scarr
-scarre
-scars
-scarus
-scath
-scathe
-scathful
-scatt
-scatter
-scattered
-scattering
-scatters
-scelera
-scelerisque
-scene
-scenes
-scent
-scented
-scept
-scepter
-sceptre
-sceptred
-sceptres
-schedule
-schedules
-scholar
-scholarly
-scholars
-school
-schoolboy
-schoolboys
-schoolfellows
-schooling
-schoolmaster
-schoolmasters
-schools
-sciatica
-sciaticas
-science
-sciences
-scimitar
-scion
-scions
-scissors
-scoff
-scoffer
-scoffing
-scoffs
-scoggin
-scold
-scolding
-scolds
-sconce
-scone
-scope
-scopes
-scorch
-scorched
-score
-scored
-scores
-scoring
-scorn
-scorned
-scornful
-scornfully
-scorning
-scorns
-scorpion
-scorpions
-scot
-scotch
-scotches
-scotland
-scots
-scottish
-scoundrels
-scour
-scoured
-scourg
-scourge
-scouring
-scout
-scouts
-scowl
-scrap
-scrape
-scraping
-scraps
-scratch
-scratches
-scratching
-scream
-screams
-screech
-screeching
-screen
-screens
-screw
-screws
-scribbl
-scribbled
-scribe
-scribes
-scrimers
-scrip
-scrippage
-scripture
-scriptures
-scrivener
-scroll
-scrolls
-scroop
-scrowl
-scroyles
-scrubbed
-scruple
-scruples
-scrupulous
-scuffles
-scuffling
-scullion
-sculls
-scum
-scurril
-scurrility
-scurrilous
-scurvy
-scuse
-scut
-scutcheon
-scutcheons
-scylla
-scythe
-scythed
-scythia
-scythian
-sdeath
-se
-sea
-seacoal
-seafaring
-seal
-sealed
-sealing
-seals
-seam
-seamen
-seamy
-seaport
-sear
-searce
-search
-searchers
-searches
-searcheth
-searching
-seared
-seas
-seasick
-seaside
-season
-seasoned
-seasons
-seat
-seated
-seats
-sebastian
-second
-secondarily
-secondary
-seconded
-seconds
-secrecy
-secret
-secretaries
-secretary
-secretly
-secrets
-sect
-sectary
-sects
-secundo
-secure
-securely
-securing
-security
-sedg
-sedge
-sedges
-sedgy
-sedition
-seditious
-seduc
-seduce
-seduced
-seducer
-seducing
-see
-seed
-seeded
-seedness
-seeds
-seedsman
-seein
-seeing
-seek
-seeking
-seeks
-seel
-seeling
-seely
-seem
-seemed
-seemers
-seemest
-seemeth
-seeming
-seemingly
-seemly
-seems
-seen
-seer
-sees
-seese
-seest
-seethe
-seethes
-seething
-seeting
-segregation
-seigneur
-seigneurs
-seiz
-seize
-seized
-seizes
-seizeth
-seizing
-seizure
-seld
-seldom
-select
-seleucus
-self
-selfsame
-sell
-seller
-selling
-sells
-selves
-semblable
-semblably
-semblance
-semblances
-semblative
-semi
-semicircle
-semiramis
-semper
-sempronius
-senate
-senator
-senators
-send
-sender
-sendeth
-sending
-sends
-seneca
-senior
-seniory
-senis
-sennet
-senoys
-sense
-senseless
-senses
-sensible
-sensibly
-sensual
-sensuality
-sent
-sentenc
-sentence
-sentences
-sententious
-sentinel
-sentinels
-separable
-separate
-separated
-separates
-separation
-septentrion
-sepulchre
-sepulchres
-sepulchring
-sequel
-sequence
-sequent
-sequest
-sequester
-sequestration
-sere
-serenis
-serge
-sergeant
-serious
-seriously
-sermon
-sermons
-serpent
-serpentine
-serpents
-serpigo
-serv
-servant
-servanted
-servants
-serve
-served
-server
-serves
-serveth
-service
-serviceable
-services
-servile
-servility
-servilius
-serving
-servingman
-servingmen
-serviteur
-servitor
-servitors
-servitude
-sessa
-session
-sessions
-sestos
-set
-setebos
-sets
-setter
-setting
-settle
-settled
-settlest
-settling
-sev
-seven
-sevenfold
-sevennight
-seventeen
-seventh
-seventy
-sever
-several
-severally
-severals
-severe
-severed
-severely
-severest
-severing
-severity
-severn
-severs
-sew
-seward
-sewer
-sewing
-sex
-sexes
-sexton
-sextus
-seymour
-seyton
-sfoot
-sh
-shackle
-shackles
-shade
-shades
-shadow
-shadowed
-shadowing
-shadows
-shadowy
-shady
-shafalus
-shaft
-shafts
-shag
-shak
-shake
-shaked
-shaken
-shakes
-shaking
-shales
-shall
-shallenge
-shallow
-shallowest
-shallowly
-shallows
-shalt
-sham
-shambles
-shame
-shamed
-shameful
-shamefully
-shameless
-shames
-shamest
-shaming
-shank
-shanks
-shap
-shape
-shaped
-shapeless
-shapen
-shapes
-shaping
-shar
-shard
-sharded
-shards
-share
-shared
-sharers
-shares
-sharing
-shark
-sharp
-sharpen
-sharpened
-sharpens
-sharper
-sharpest
-sharply
-sharpness
-sharps
-shatter
-shav
-shave
-shaven
-shaw
-she
-sheaf
-sheal
-shear
-shearers
-shearing
-shearman
-shears
-sheath
-sheathe
-sheathed
-sheathes
-sheathing
-sheaved
-sheaves
-shed
-shedding
-sheds
-sheen
-sheep
-sheepcote
-sheepcotes
-sheeps
-sheepskins
-sheer
-sheet
-sheeted
-sheets
-sheffield
-shelf
-shell
-shells
-shelt
-shelter
-shelters
-shelves
-shelving
-shelvy
-shent
-shepherd
-shepherdes
-shepherdess
-shepherdesses
-shepherds
-sher
-sheriff
-sherris
-shes
-sheweth
-shield
-shielded
-shields
-shift
-shifted
-shifting
-shifts
-shilling
-shillings
-shin
-shine
-shines
-shineth
-shining
-shins
-shiny
-ship
-shipboard
-shipman
-shipmaster
-shipmen
-shipp
-shipped
-shipping
-ships
-shipt
-shipwreck
-shipwrecking
-shipwright
-shipwrights
-shire
-shirley
-shirt
-shirts
-shive
-shiver
-shivering
-shivers
-shoal
-shoals
-shock
-shocks
-shod
-shoe
-shoeing
-shoemaker
-shoes
-shog
-shone
-shook
-shoon
-shoot
-shooter
-shootie
-shooting
-shoots
-shop
-shops
-shore
-shores
-shorn
-short
-shortcake
-shorten
-shortened
-shortens
-shorter
-shortly
-shortness
-shot
-shotten
-shoughs
-should
-shoulder
-shouldering
-shoulders
-shouldst
-shout
-shouted
-shouting
-shouts
-shov
-shove
-shovel
-shovels
-show
-showed
-shower
-showers
-showest
-showing
-shown
-shows
-shreds
-shrew
-shrewd
-shrewdly
-shrewdness
-shrewish
-shrewishly
-shrewishness
-shrews
-shrewsbury
-shriek
-shrieking
-shrieks
-shrieve
-shrift
-shrill
-shriller
-shrills
-shrilly
-shrimp
-shrine
-shrink
-shrinking
-shrinks
-shriv
-shrive
-shriver
-shrives
-shriving
-shroud
-shrouded
-shrouding
-shrouds
-shrove
-shrow
-shrows
-shrub
-shrubs
-shrug
-shrugs
-shrunk
-shudd
-shudders
-shuffl
-shuffle
-shuffled
-shuffling
-shun
-shunless
-shunn
-shunned
-shunning
-shuns
-shut
-shuts
-shuttle
-shy
-shylock
-si
-sibyl
-sibylla
-sibyls
-sicil
-sicilia
-sicilian
-sicilius
-sicils
-sicily
-sicinius
-sick
-sicken
-sickens
-sicker
-sickle
-sicklemen
-sicklied
-sickliness
-sickly
-sickness
-sicles
-sicyon
-side
-sided
-sides
-siege
-sieges
-sienna
-sies
-sieve
-sift
-sifted
-sigeia
-sigh
-sighed
-sighing
-sighs
-sight
-sighted
-sightless
-sightly
-sights
-sign
-signal
-signet
-signieur
-significant
-significants
-signified
-signifies
-signify
-signifying
-signior
-signiories
-signiors
-signiory
-signor
-signories
-signs
-signum
-silenc
-silence
-silenced
-silencing
-silent
-silently
-silius
-silk
-silken
-silkman
-silks
-silliest
-silliness
-silling
-silly
-silva
-silver
-silvered
-silverly
-silvia
-silvius
-sima
-simile
-similes
-simois
-simon
-simony
-simp
-simpcox
-simple
-simpleness
-simpler
-simples
-simplicity
-simply
-simular
-simulation
-sin
-since
-sincere
-sincerely
-sincerity
-sinel
-sinew
-sinewed
-sinews
-sinewy
-sinful
-sinfully
-sing
-singe
-singeing
-singer
-singes
-singeth
-singing
-single
-singled
-singleness
-singly
-sings
-singular
-singulariter
-singularities
-singularity
-singuled
-sinister
-sink
-sinking
-sinks
-sinn
-sinner
-sinners
-sinning
-sinon
-sins
-sip
-sipping
-sir
-sire
-siren
-sirrah
-sirs
-sist
-sister
-sisterhood
-sisterly
-sisters
-sit
-sith
-sithence
-sits
-sitting
-situate
-situation
-situations
-siward
-six
-sixpence
-sixpences
-sixpenny
-sixteen
-sixth
-sixty
-siz
-size
-sizes
-sizzle
-skains
-skamble
-skein
-skelter
-skies
-skilful
-skilfully
-skill
-skilless
-skillet
-skillful
-skills
-skim
-skimble
-skin
-skinker
-skinny
-skins
-skip
-skipp
-skipper
-skipping
-skirmish
-skirmishes
-skirr
-skirted
-skirts
-skittish
-skulking
-skull
-skulls
-sky
-skyey
-skyish
-slab
-slack
-slackly
-slackness
-slain
-slake
-sland
-slander
-slandered
-slanderer
-slanderers
-slandering
-slanderous
-slanders
-slash
-slaught
-slaughter
-slaughtered
-slaughterer
-slaughterman
-slaughtermen
-slaughterous
-slaughters
-slave
-slaver
-slavery
-slaves
-slavish
-slay
-slayeth
-slaying
-slays
-sleave
-sledded
-sleek
-sleekly
-sleep
-sleeper
-sleepers
-sleepest
-sleeping
-sleeps
-sleepy
-sleeve
-sleeves
-sleid
-sleided
-sleight
-sleights
-slender
-slenderer
-slenderly
-slept
-slew
-slewest
-slice
-slid
-slide
-slides
-sliding
-slight
-slighted
-slightest
-slightly
-slightness
-slights
-slily
-slime
-slimy
-slings
-slink
-slip
-slipp
-slipper
-slippers
-slippery
-slips
-slish
-slit
-sliver
-slobb
-slomber
-slop
-slope
-slops
-sloth
-slothful
-slough
-slovenly
-slovenry
-slow
-slower
-slowly
-slowness
-slubber
-slug
-sluggard
-sluggardiz
-sluggish
-sluic
-slumb
-slumber
-slumbers
-slumbery
-slunk
-slut
-sluts
-sluttery
-sluttish
-sluttishness
-sly
-slys
-smack
-smacking
-smacks
-small
-smaller
-smallest
-smallness
-smalus
-smart
-smarting
-smartly
-smatch
-smatter
-smear
-smell
-smelling
-smells
-smelt
-smil
-smile
-smiled
-smiles
-smilest
-smilets
-smiling
-smilingly
-smirch
-smirched
-smit
-smite
-smites
-smith
-smithfield
-smock
-smocks
-smok
-smoke
-smoked
-smokes
-smoking
-smoky
-smooth
-smoothed
-smoothing
-smoothly
-smoothness
-smooths
-smote
-smoth
-smother
-smothered
-smothering
-smug
-smulkin
-smutch
-snaffle
-snail
-snails
-snake
-snakes
-snaky
-snap
-snapp
-snapper
-snar
-snare
-snares
-snarl
-snarleth
-snarling
-snatch
-snatchers
-snatches
-snatching
-sneak
-sneaking
-sneap
-sneaping
-sneck
-snip
-snipe
-snipt
-snore
-snores
-snoring
-snorting
-snout
-snow
-snowballs
-snowed
-snowy
-snuff
-snuffs
-snug
-so
-soak
-soaking
-soaks
-soar
-soaring
-soars
-sob
-sobbing
-sober
-soberly
-sobriety
-sobs
-sociable
-societies
-society
-socks
-socrates
-sod
-sodden
-soe
-soever
-soft
-soften
-softens
-softer
-softest
-softly
-softness
-soil
-soiled
-soilure
-soit
-sojourn
-sol
-sola
-solace
-solanio
-sold
-soldat
-solder
-soldest
-soldier
-soldiers
-soldiership
-sole
-solely
-solem
-solemn
-solemness
-solemnities
-solemnity
-solemniz
-solemnize
-solemnized
-solemnly
-soles
-solicit
-solicitation
-solicited
-soliciting
-solicitings
-solicitor
-solicits
-solid
-solidares
-solidity
-solinus
-solitary
-solomon
-solon
-solum
-solus
-solyman
-some
-somebody
-someone
-somerset
-somerville
-something
-sometime
-sometimes
-somever
-somewhat
-somewhere
-somewhither
-somme
-son
-sonance
-song
-songs
-sonnet
-sonneting
-sonnets
-sons
-sont
-sonties
-soon
-sooner
-soonest
-sooth
-soothe
-soothers
-soothing
-soothsay
-soothsayer
-sooty
-sop
-sophister
-sophisticated
-sophy
-sops
-sorcerer
-sorcerers
-sorceress
-sorceries
-sorcery
-sore
-sorel
-sorely
-sorer
-sores
-sorrier
-sorriest
-sorrow
-sorrowed
-sorrowest
-sorrowful
-sorrowing
-sorrows
-sorry
-sort
-sortance
-sorted
-sorting
-sorts
-sossius
-sot
-soto
-sots
-sottish
-soud
-sought
-soul
-sould
-soulless
-souls
-sound
-sounded
-sounder
-soundest
-sounding
-soundless
-soundly
-soundness
-soundpost
-sounds
-sour
-source
-sources
-sourest
-sourly
-sours
-sous
-souse
-south
-southam
-southampton
-southerly
-southern
-southward
-southwark
-southwell
-souviendrai
-sov
-sovereign
-sovereignest
-sovereignly
-sovereignty
-sovereignvours
-sow
-sowing
-sowl
-sowter
-space
-spaces
-spacious
-spade
-spades
-spain
-spak
-spake
-spakest
-span
-spangle
-spangled
-spaniard
-spaniel
-spaniels
-spanish
-spann
-spans
-spar
-spare
-spares
-sparing
-sparingly
-spark
-sparkle
-sparkles
-sparkling
-sparks
-sparrow
-sparrows
-sparta
-spartan
-spavin
-spavins
-spawn
-speak
-speaker
-speakers
-speakest
-speaketh
-speaking
-speaks
-spear
-speargrass
-spears
-special
-specialities
-specially
-specialties
-specialty
-specify
-speciously
-spectacle
-spectacled
-spectacles
-spectators
-spectatorship
-speculation
-speculations
-speculative
-sped
-speech
-speeches
-speechless
-speed
-speeded
-speedier
-speediest
-speedily
-speediness
-speeding
-speeds
-speedy
-speens
-spell
-spelling
-spells
-spelt
-spencer
-spend
-spendest
-spending
-spends
-spendthrift
-spent
-sperato
-sperm
-spero
-sperr
-spher
-sphere
-sphered
-spheres
-spherical
-sphery
-sphinx
-spice
-spiced
-spicery
-spices
-spider
-spiders
-spied
-spies
-spieth
-spightfully
-spigot
-spill
-spilling
-spills
-spilt
-spilth
-spin
-spinii
-spinners
-spinster
-spinsters
-spire
-spirit
-spirited
-spiritless
-spirits
-spiritual
-spiritualty
-spirt
-spit
-spital
-spite
-spited
-spiteful
-spites
-spits
-spitted
-spitting
-splay
-spleen
-spleenful
-spleens
-spleeny
-splendour
-splenitive
-splinter
-splinters
-split
-splits
-splitted
-splitting
-spoil
-spoils
-spok
-spoke
-spoken
-spokes
-spokesman
-sponge
-spongy
-spoon
-spoons
-sport
-sportful
-sporting
-sportive
-sports
-spot
-spotless
-spots
-spotted
-spousal
-spouse
-spout
-spouting
-spouts
-sprag
-sprang
-sprat
-sprawl
-spray
-sprays
-spread
-spreading
-spreads
-sprighted
-sprightful
-sprightly
-sprigs
-spring
-springe
-springes
-springeth
-springhalt
-springing
-springs
-springtime
-sprinkle
-sprinkles
-sprite
-sprited
-spritely
-sprites
-spriting
-sprout
-spruce
-sprung
-spun
-spur
-spurio
-spurn
-spurns
-spurr
-spurrer
-spurring
-spurs
-spy
-spying
-squabble
-squadron
-squadrons
-squand
-squar
-square
-squarer
-squares
-squash
-squeak
-squeaking
-squeal
-squealing
-squeezes
-squeezing
-squele
-squier
-squints
-squiny
-squire
-squires
-squirrel
-st
-stab
-stabb
-stabbed
-stabbing
-stable
-stableness
-stables
-stablish
-stablishment
-stabs
-stacks
-staff
-stafford
-staffords
-staffordshire
-stag
-stage
-stages
-stagger
-staggering
-staggers
-stags
-staid
-staider
-stain
-stained
-staines
-staineth
-staining
-stainless
-stains
-stair
-stairs
-stake
-stakes
-stale
-staled
-stalk
-stalking
-stalks
-stall
-stalling
-stalls
-stamford
-stammer
-stamp
-stamped
-stamps
-stanch
-stanchless
-stand
-standard
-standards
-stander
-standers
-standest
-standeth
-standing
-stands
-staniel
-stanley
-stanze
-stanzo
-stanzos
-staple
-staples
-star
-stare
-stared
-stares
-staring
-starings
-stark
-starkly
-starlight
-starling
-starr
-starry
-stars
-start
-started
-starting
-startingly
-startle
-startles
-starts
-starv
-starve
-starved
-starvelackey
-starveling
-starveth
-starving
-state
-statelier
-stately
-states
-statesman
-statesmen
-statilius
-station
-statist
-statists
-statue
-statues
-stature
-statures
-statute
-statutes
-stave
-staves
-stay
-stayed
-stayest
-staying
-stays
-stead
-steaded
-steadfast
-steadier
-steads
-steal
-stealer
-stealers
-stealing
-steals
-stealth
-stealthy
-steed
-steeds
-steel
-steeled
-steely
-steep
-steeped
-steeple
-steeples
-steeps
-steepy
-steer
-steerage
-steering
-steers
-stelled
-stem
-stemming
-stench
-step
-stepdame
-stephano
-stephen
-stepmothers
-stepp
-stepping
-steps
-sterile
-sterility
-sterling
-stern
-sternage
-sterner
-sternest
-sternness
-steterat
-stew
-steward
-stewards
-stewardship
-stewed
-stews
-stick
-sticking
-stickler
-sticks
-stiff
-stiffen
-stiffly
-stifle
-stifled
-stifles
-stigmatic
-stigmatical
-stile
-still
-stiller
-stillest
-stillness
-stilly
-sting
-stinging
-stingless
-stings
-stink
-stinking
-stinkingly
-stinks
-stint
-stinted
-stints
-stir
-stirr
-stirred
-stirrer
-stirrers
-stirreth
-stirring
-stirrup
-stirrups
-stirs
-stitchery
-stitches
-stithied
-stithy
-stoccadoes
-stoccata
-stock
-stockfish
-stocking
-stockings
-stockish
-stocks
-stog
-stogs
-stoics
-stokesly
-stol
-stole
-stolen
-stolest
-stomach
-stomachers
-stomaching
-stomachs
-ston
-stone
-stonecutter
-stones
-stonish
-stony
-stood
-stool
-stools
-stoop
-stooping
-stoops
-stop
-stope
-stopp
-stopped
-stopping
-stops
-stor
-store
-storehouse
-storehouses
-stores
-stories
-storm
-stormed
-storming
-storms
-stormy
-story
-stoup
-stoups
-stout
-stouter
-stoutly
-stoutness
-stover
-stow
-stowage
-stowed
-strachy
-stragglers
-straggling
-straight
-straightest
-straightway
-strain
-strained
-straining
-strains
-strait
-straited
-straiter
-straitly
-straitness
-straits
-strand
-strange
-strangely
-strangeness
-stranger
-strangers
-strangest
-strangle
-strangled
-strangler
-strangles
-strangling
-strappado
-straps
-stratagem
-stratagems
-stratford
-strato
-straw
-strawberries
-strawberry
-straws
-strawy
-stray
-straying
-strays
-streak
-streaks
-stream
-streamers
-streaming
-streams
-streching
-street
-streets
-strength
-strengthen
-strengthened
-strengthless
-strengths
-stretch
-stretched
-stretches
-stretching
-strew
-strewing
-strewings
-strewments
-stricken
-strict
-stricter
-strictest
-strictly
-stricture
-stride
-strides
-striding
-strife
-strifes
-strik
-strike
-strikers
-strikes
-strikest
-striking
-string
-stringless
-strings
-strip
-stripes
-stripling
-striplings
-stripp
-stripping
-striv
-strive
-strives
-striving
-strok
-stroke
-strokes
-strond
-stronds
-strong
-stronger
-strongest
-strongly
-strooke
-strossers
-strove
-strown
-stroy
-struck
-strucken
-struggle
-struggles
-struggling
-strumpet
-strumpeted
-strumpets
-strung
-strut
-struts
-strutted
-strutting
-stubble
-stubborn
-stubbornest
-stubbornly
-stubbornness
-stuck
-studded
-student
-students
-studied
-studies
-studious
-studiously
-studs
-study
-studying
-stuff
-stuffing
-stuffs
-stumble
-stumbled
-stumblest
-stumbling
-stump
-stumps
-stung
-stupefy
-stupid
-stupified
-stuprum
-sturdy
-sty
-styga
-stygian
-styl
-style
-styx
-su
-sub
-subcontracted
-subdu
-subdue
-subdued
-subduements
-subdues
-subduing
-subject
-subjected
-subjection
-subjects
-submerg
-submission
-submissive
-submit
-submits
-submitting
-suborn
-subornation
-suborned
-subscrib
-subscribe
-subscribed
-subscribes
-subscription
-subsequent
-subsidies
-subsidy
-subsist
-subsisting
-substance
-substances
-substantial
-substitute
-substituted
-substitutes
-substitution
-subtile
-subtilly
-subtle
-subtleties
-subtlety
-subtly
-subtractors
-suburbs
-subversion
-subverts
-succedant
-succeed
-succeeded
-succeeders
-succeeding
-succeeds
-success
-successantly
-successes
-successful
-successfully
-succession
-successive
-successively
-successor
-successors
-succour
-succours
-such
-suck
-sucker
-suckers
-sucking
-suckle
-sucks
-sudden
-suddenly
-sue
-sued
-suerly
-sues
-sueth
-suff
-suffer
-sufferance
-sufferances
-suffered
-suffering
-suffers
-suffic
-suffice
-sufficed
-suffices
-sufficeth
-sufficiency
-sufficient
-sufficiently
-sufficing
-sufficit
-suffigance
-suffocate
-suffocating
-suffocation
-suffolk
-suffrage
-suffrages
-sug
-sugar
-sugarsop
-suggest
-suggested
-suggesting
-suggestion
-suggestions
-suggests
-suis
-suit
-suitable
-suited
-suiting
-suitor
-suitors
-suits
-suivez
-sullen
-sullens
-sullied
-sullies
-sully
-sulph
-sulpherous
-sulphur
-sulphurous
-sultan
-sultry
-sum
-sumless
-summ
-summa
-summary
-summer
-summers
-summit
-summon
-summoners
-summons
-sumpter
-sumptuous
-sumptuously
-sums
-sun
-sunbeams
-sunburning
-sunburnt
-sund
-sunday
-sundays
-sunder
-sunders
-sundry
-sung
-sunk
-sunken
-sunny
-sunrising
-suns
-sunset
-sunshine
-sup
-super
-superficial
-superficially
-superfluity
-superfluous
-superfluously
-superflux
-superior
-supernal
-supernatural
-superpraise
-superscript
-superscription
-superserviceable
-superstition
-superstitious
-superstitiously
-supersubtle
-supervise
-supervisor
-supp
-supper
-suppers
-suppertime
-supping
-supplant
-supple
-suppler
-suppliance
-suppliant
-suppliants
-supplicant
-supplication
-supplications
-supplie
-supplied
-supplies
-suppliest
-supply
-supplyant
-supplying
-supplyment
-support
-supportable
-supportance
-supported
-supporter
-supporters
-supporting
-supportor
-suppos
-supposal
-suppose
-supposed
-supposes
-supposest
-supposing
-supposition
-suppress
-suppressed
-suppresseth
-supremacy
-supreme
-sups
-sur
-surance
-surcease
-surd
-sure
-surecard
-surely
-surer
-surest
-sureties
-surety
-surfeit
-surfeited
-surfeiter
-surfeiting
-surfeits
-surge
-surgeon
-surgeons
-surgere
-surgery
-surges
-surly
-surmis
-surmise
-surmised
-surmises
-surmount
-surmounted
-surmounts
-surnam
-surname
-surnamed
-surpasseth
-surpassing
-surplice
-surplus
-surpris
-surprise
-surprised
-surrender
-surrey
-surreys
-survey
-surveyest
-surveying
-surveyor
-surveyors
-surveys
-survive
-survives
-survivor
-susan
-suspect
-suspected
-suspecting
-suspects
-suspend
-suspense
-suspicion
-suspicions
-suspicious
-suspiration
-suspire
-sust
-sustain
-sustaining
-sutler
-sutton
-suum
-swabber
-swaddling
-swag
-swagg
-swagger
-swaggerer
-swaggerers
-swaggering
-swain
-swains
-swallow
-swallowed
-swallowing
-swallows
-swam
-swan
-swans
-sward
-sware
-swarm
-swarming
-swart
-swarth
-swarths
-swarthy
-swashers
-swashing
-swath
-swathing
-swathling
-sway
-swaying
-sways
-swear
-swearer
-swearers
-swearest
-swearing
-swearings
-swears
-sweat
-sweaten
-sweating
-sweats
-sweaty
-sweep
-sweepers
-sweeps
-sweet
-sweeten
-sweetens
-sweeter
-sweetest
-sweetheart
-sweeting
-sweetly
-sweetmeats
-sweetness
-sweets
-swell
-swelling
-swellings
-swells
-swelter
-sweno
-swept
-swerve
-swerver
-swerving
-swift
-swifter
-swiftest
-swiftly
-swiftness
-swill
-swills
-swim
-swimmer
-swimmers
-swimming
-swims
-swine
-swineherds
-swing
-swinge
-swinish
-swinstead
-switches
-swits
-switzers
-swol
-swoll
-swoln
-swoon
-swooned
-swooning
-swoons
-swoop
-swoopstake
-swor
-sword
-sworder
-swords
-swore
-sworn
-swounded
-swounds
-swum
-swung
-sy
-sycamore
-sycorax
-sylla
-syllable
-syllables
-syllogism
-symbols
-sympathise
-sympathiz
-sympathize
-sympathized
-sympathy
-synagogue
-synod
-synods
-syracuse
-syracusian
-syracusians
-syria
-syrups
-t
-ta
-taber
-table
-tabled
-tables
-tablet
-tabor
-taborer
-tabors
-tabourines
-taciturnity
-tack
-tackle
-tackled
-tackles
-tackling
-tacklings
-taddle
-tadpole
-taffeta
-taffety
-tag
-tagrag
-tah
-tail
-tailor
-tailors
-tails
-taint
-tainted
-tainting
-taints
-tainture
-tak
-take
-taken
-taker
-takes
-takest
-taketh
-taking
-tal
-talbot
-talbotites
-talbots
-tale
-talent
-talents
-taleporter
-tales
-talk
-talked
-talker
-talkers
-talkest
-talking
-talks
-tall
-taller
-tallest
-tallies
-tallow
-tally
-talons
-tam
-tambourines
-tame
-tamed
-tamely
-tameness
-tamer
-tames
-taming
-tamora
-tamworth
-tan
-tang
-tangle
-tangled
-tank
-tanlings
-tann
-tanned
-tanner
-tanquam
-tanta
-tantaene
-tap
-tape
-taper
-tapers
-tapestries
-tapestry
-taphouse
-tapp
-tapster
-tapsters
-tar
-tardied
-tardily
-tardiness
-tardy
-tarentum
-targe
-targes
-target
-targets
-tarpeian
-tarquin
-tarquins
-tarr
-tarre
-tarriance
-tarried
-tarries
-tarry
-tarrying
-tart
-tartar
-tartars
-tartly
-tartness
-task
-tasker
-tasking
-tasks
-tassel
-taste
-tasted
-tastes
-tasting
-tatt
-tatter
-tattered
-tatters
-tattle
-tattling
-tattlings
-taught
-taunt
-taunted
-taunting
-tauntingly
-taunts
-taurus
-tavern
-taverns
-tavy
-tawdry
-tawny
-tax
-taxation
-taxations
-taxes
-taxing
-tc
-te
-teach
-teacher
-teachers
-teaches
-teachest
-teacheth
-teaching
-team
-tear
-tearful
-tearing
-tears
-tearsheet
-teat
-tedious
-tediously
-tediousness
-teem
-teeming
-teems
-teen
-teeth
-teipsum
-telamon
-telamonius
-tell
-teller
-telling
-tells
-tellus
-temp
-temper
-temperality
-temperance
-temperate
-temperately
-tempers
-tempest
-tempests
-tempestuous
-temple
-temples
-temporal
-temporary
-temporiz
-temporize
-temporizer
-temps
-tempt
-temptation
-temptations
-tempted
-tempter
-tempters
-tempteth
-tempting
-tempts
-ten
-tenable
-tenant
-tenantius
-tenantless
-tenants
-tench
-tend
-tendance
-tended
-tender
-tendered
-tenderly
-tenderness
-tenders
-tending
-tends
-tenedos
-tenement
-tenements
-tenfold
-tennis
-tenour
-tenours
-tens
-tent
-tented
-tenth
-tenths
-tents
-tenure
-tenures
-tercel
-tereus
-term
-termagant
-termed
-terminations
-termless
-terms
-terra
-terrace
-terram
-terras
-terre
-terrene
-terrestrial
-terrible
-terribly
-territories
-territory
-terror
-terrors
-tertian
-tertio
-test
-testament
-tested
-tester
-testern
-testify
-testimonied
-testimonies
-testimony
-testiness
-testril
-testy
-tetchy
-tether
-tetter
-tevil
-tewksbury
-text
-tgv
-th
-thaes
-thames
-than
-thane
-thanes
-thank
-thanked
-thankful
-thankfully
-thankfulness
-thanking
-thankings
-thankless
-thanks
-thanksgiving
-thasos
-that
-thatch
-thaw
-thawing
-thaws
-the
-theatre
-theban
-thebes
-thee
-theft
-thefts
-thein
-their
-theirs
-theise
-them
-theme
-themes
-themselves
-then
-thence
-thenceforth
-theoric
-there
-thereabout
-thereabouts
-thereafter
-thereat
-thereby
-therefore
-therein
-thereof
-thereon
-thereto
-thereunto
-thereupon
-therewith
-therewithal
-thersites
-these
-theseus
-thessalian
-thessaly
-thetis
-thews
-they
-thick
-thicken
-thickens
-thicker
-thickest
-thicket
-thickskin
-thief
-thievery
-thieves
-thievish
-thigh
-thighs
-thimble
-thimbles
-thin
-thine
-thing
-things
-think
-thinkest
-thinking
-thinkings
-thinks
-thinkst
-thinly
-third
-thirdly
-thirds
-thirst
-thirsting
-thirsts
-thirsty
-thirteen
-thirties
-thirtieth
-thirty
-this
-thisby
-thisne
-thistle
-thistles
-thither
-thitherward
-thoas
-thomas
-thorn
-thorns
-thorny
-thorough
-thoroughly
-those
-thou
-though
-thought
-thoughtful
-thoughts
-thousand
-thousands
-thracian
-thraldom
-thrall
-thralled
-thralls
-thrash
-thrasonical
-thread
-threadbare
-threaden
-threading
-threat
-threaten
-threatening
-threatens
-threatest
-threats
-three
-threefold
-threepence
-threepile
-threes
-threescore
-thresher
-threshold
-threw
-thrice
-thrift
-thriftless
-thrifts
-thrifty
-thrill
-thrilling
-thrills
-thrive
-thrived
-thrivers
-thrives
-thriving
-throat
-throats
-throbbing
-throbs
-throca
-throe
-throes
-thromuldo
-thron
-throne
-throned
-thrones
-throng
-thronging
-throngs
-throstle
-throttle
-through
-throughfare
-throughfares
-throughly
-throughout
-throw
-thrower
-throwest
-throwing
-thrown
-throws
-thrum
-thrumm
-thrush
-thrust
-thrusteth
-thrusting
-thrusts
-thumb
-thumbs
-thump
-thund
-thunder
-thunderbolt
-thunderbolts
-thunderer
-thunders
-thunderstone
-thunderstroke
-thurio
-thursday
-thus
-thwack
-thwart
-thwarted
-thwarting
-thwartings
-thy
-thyme
-thymus
-thyreus
-thyself
-ti
-tib
-tiber
-tiberio
-tibey
-ticed
-tick
-tickl
-tickle
-tickled
-tickles
-tickling
-ticklish
-tiddle
-tide
-tides
-tidings
-tidy
-tie
-tied
-ties
-tiff
-tiger
-tigers
-tight
-tightly
-tike
-til
-tile
-till
-tillage
-tilly
-tilt
-tilter
-tilth
-tilting
-tilts
-tiltyard
-tim
-timandra
-timber
-time
-timeless
-timelier
-timely
-times
-timon
-timor
-timorous
-timorously
-tinct
-tincture
-tinctures
-tinder
-tingling
-tinker
-tinkers
-tinsel
-tiny
-tip
-tipp
-tippling
-tips
-tipsy
-tiptoe
-tir
-tire
-tired
-tires
-tirest
-tiring
-tirra
-tirrits
-tis
-tish
-tisick
-tissue
-titan
-titania
-tithe
-tithed
-tithing
-titinius
-title
-titled
-titleless
-titles
-tittle
-tittles
-titular
-titus
-tn
-to
-toad
-toads
-toadstool
-toast
-toasted
-toasting
-toasts
-toaze
-toby
-tock
-tod
-today
-todpole
-tods
-toe
-toes
-tofore
-toge
-toged
-together
-toil
-toiled
-toiling
-toils
-token
-tokens
-told
-toledo
-tolerable
-toll
-tolling
-tom
-tomb
-tombe
-tombed
-tombless
-tomboys
-tombs
-tomorrow
-tomyris
-ton
-tongs
-tongu
-tongue
-tongued
-tongueless
-tongues
-tonight
-too
-took
-tool
-tools
-tooth
-toothache
-toothpick
-toothpicker
-top
-topas
-topful
-topgallant
-topless
-topmast
-topp
-topping
-topple
-topples
-tops
-topsail
-topsy
-torch
-torchbearer
-torchbearers
-torcher
-torches
-torchlight
-tore
-torment
-tormenta
-tormente
-tormented
-tormenting
-tormentors
-torments
-torn
-torrent
-tortive
-tortoise
-tortur
-torture
-tortured
-torturer
-torturers
-tortures
-torturest
-torturing
-toryne
-toss
-tossed
-tosseth
-tossing
-tot
-total
-totally
-tott
-tottered
-totters
-tou
-touch
-touched
-touches
-toucheth
-touching
-touchstone
-tough
-tougher
-toughness
-touraine
-tournaments
-tours
-tous
-tout
-touze
-tow
-toward
-towardly
-towards
-tower
-towering
-towers
-town
-towns
-township
-townsman
-townsmen
-towton
-toy
-toys
-trace
-traces
-track
-tract
-tractable
-trade
-traded
-traders
-trades
-tradesman
-tradesmen
-trading
-tradition
-traditional
-traduc
-traduced
-traducement
-traffic
-traffickers
-traffics
-tragedian
-tragedians
-tragedies
-tragedy
-tragic
-tragical
-trail
-train
-trained
-training
-trains
-trait
-traitor
-traitorly
-traitorous
-traitorously
-traitors
-traitress
-traject
-trammel
-trample
-trampled
-trampling
-tranc
-trance
-tranio
-tranquil
-tranquillity
-transcendence
-transcends
-transferred
-transfigur
-transfix
-transform
-transformation
-transformations
-transformed
-transgress
-transgresses
-transgressing
-transgression
-translate
-translated
-translates
-translation
-transmigrates
-transmutation
-transparent
-transport
-transportance
-transported
-transporting
-transports
-transpose
-transshape
-trap
-trapp
-trappings
-traps
-trash
-travail
-travails
-travel
-traveler
-traveling
-travell
-travelled
-traveller
-travellers
-travellest
-travelling
-travels
-travers
-traverse
-tray
-treacherous
-treacherously
-treachers
-treachery
-tread
-treading
-treads
-treason
-treasonable
-treasonous
-treasons
-treasure
-treasurer
-treasures
-treasuries
-treasury
-treat
-treaties
-treatise
-treats
-treaty
-treble
-trebled
-trebles
-trebonius
-tree
-trees
-tremble
-trembled
-trembles
-tremblest
-trembling
-tremblingly
-tremor
-trempling
-trench
-trenchant
-trenched
-trencher
-trenchering
-trencherman
-trenchers
-trenches
-trenching
-trent
-tres
-trespass
-trespasses
-tressel
-tresses
-treys
-trial
-trials
-trib
-tribe
-tribes
-tribulation
-tribunal
-tribune
-tribunes
-tributaries
-tributary
-tribute
-tributes
-trice
-trick
-tricking
-trickling
-tricks
-tricksy
-trident
-tried
-trier
-trifle
-trifled
-trifler
-trifles
-trifling
-trigon
-trill
-trim
-trimly
-trimm
-trimmed
-trimming
-trims
-trinculo
-trinculos
-trinkets
-trip
-tripartite
-tripe
-triple
-triplex
-tripoli
-tripolis
-tripp
-tripping
-trippingly
-trips
-tristful
-triton
-triumph
-triumphant
-triumphantly
-triumpher
-triumphers
-triumphing
-triumphs
-triumvir
-triumvirate
-triumvirs
-triumviry
-trivial
-troat
-trod
-trodden
-troiant
-troien
-troilus
-troiluses
-trojan
-trojans
-troll
-tromperies
-trompet
-troop
-trooping
-troops
-trop
-trophies
-trophy
-tropically
-trot
-troth
-trothed
-troths
-trots
-trotting
-trouble
-troubled
-troubler
-troubles
-troublesome
-troublest
-troublous
-trough
-trout
-trouts
-trovato
-trow
-trowel
-trowest
-troy
-troyan
-troyans
-truant
-truce
-truckle
-trudge
-true
-trueborn
-truepenny
-truer
-truest
-truie
-trull
-trulls
-truly
-trump
-trumpery
-trumpet
-trumpeter
-trumpeters
-trumpets
-truncheon
-truncheoners
-trundle
-trunk
-trunks
-trust
-trusted
-truster
-trusters
-trusting
-trusts
-trusty
-truth
-truths
-try
-ts
-tu
-tuae
-tub
-tubal
-tubs
-tuck
-tucket
-tuesday
-tuft
-tufts
-tug
-tugg
-tugging
-tuition
-tullus
-tully
-tumble
-tumbled
-tumbler
-tumbling
-tumult
-tumultuous
-tun
-tune
-tuneable
-tuned
-tuners
-tunes
-tunis
-tuns
-tupping
-turban
-turbans
-turbulence
-turbulent
-turd
-turf
-turfy
-turk
-turkey
-turkeys
-turkish
-turks
-turlygod
-turmoil
-turmoiled
-turn
-turnbull
-turncoat
-turncoats
-turned
-turneth
-turning
-turnips
-turns
-turph
-turpitude
-turquoise
-turret
-turrets
-turtle
-turtles
-turvy
-tuscan
-tush
-tut
-tutor
-tutored
-tutors
-tutto
-twain
-twang
-twangling
-twas
-tway
-tweaks
-tween
-twelfth
-twelve
-twelvemonth
-twentieth
-twenty
-twere
-twice
-twig
-twiggen
-twigs
-twilight
-twill
-twilled
-twin
-twine
-twink
-twinkle
-twinkled
-twinkling
-twinn
-twins
-twire
-twist
-twisted
-twit
-twits
-twitting
-twixt
-two
-twofold
-twopence
-twopences
-twos
-twould
-tyb
-tybalt
-tybalts
-tyburn
-tying
-tyke
-tymbria
-type
-types
-typhon
-tyrannical
-tyrannically
-tyrannize
-tyrannous
-tyranny
-tyrant
-tyrants
-tyrian
-tyrrel
-u
-ubique
-udders
-udge
-uds
-uglier
-ugliest
-ugly
-ulcer
-ulcerous
-ulysses
-um
-umber
-umbra
-umbrage
-umfrevile
-umpire
-umpires
-un
-unable
-unaccommodated
-unaccompanied
-unaccustom
-unaching
-unacquainted
-unactive
-unadvis
-unadvised
-unadvisedly
-unagreeable
-unanel
-unanswer
-unappeas
-unapproved
-unapt
-unaptness
-unarm
-unarmed
-unarms
-unassail
-unassailable
-unattainted
-unattempted
-unattended
-unauspicious
-unauthorized
-unavoided
-unawares
-unback
-unbak
-unbanded
-unbar
-unbarb
-unbashful
-unbated
-unbatter
-unbecoming
-unbefitting
-unbegot
-unbegotten
-unbelieved
-unbend
-unbent
-unbewail
-unbid
-unbidden
-unbind
-unbinds
-unbitted
-unbless
-unblest
-unbloodied
-unblown
-unbodied
-unbolt
-unbolted
-unbonneted
-unbookish
-unborn
-unbosom
-unbound
-unbounded
-unbow
-unbowed
-unbrac
-unbraced
-unbraided
-unbreathed
-unbred
-unbreech
-unbridled
-unbroke
-unbruis
-unbruised
-unbuckle
-unbuckles
-unbuckling
-unbuild
-unburden
-unburdens
-unburied
-unburnt
-unburthen
-unbutton
-unbuttoning
-uncapable
-uncape
-uncase
-uncasing
-uncaught
-uncertain
-uncertainty
-unchain
-unchanging
-uncharge
-uncharged
-uncharitably
-unchary
-unchaste
-uncheck
-unchilded
-uncivil
-unclaim
-unclasp
-uncle
-unclean
-uncleanliness
-uncleanly
-uncleanness
-uncles
-unclew
-unclog
-uncoined
-uncolted
-uncomeliness
-uncomfortable
-uncompassionate
-uncomprehensive
-unconfinable
-unconfirm
-unconfirmed
-unconquer
-unconquered
-unconsidered
-unconstant
-unconstrain
-unconstrained
-uncontemn
-uncontroll
-uncorrected
-uncounted
-uncouple
-uncourteous
-uncouth
-uncover
-uncovered
-uncropped
-uncross
-uncrown
-unction
-unctuous
-uncuckolded
-uncurable
-uncurbable
-uncurbed
-uncurls
-uncurrent
-uncurse
-undaunted
-undeaf
-undeck
-undeeded
-under
-underbearing
-underborne
-undercrest
-underfoot
-undergo
-undergoes
-undergoing
-undergone
-underground
-underhand
-underlings
-undermine
-underminers
-underneath
-underprizing
-underprop
-understand
-understandeth
-understanding
-understandings
-understands
-understood
-underta
-undertake
-undertakeing
-undertaker
-undertakes
-undertaking
-undertakings
-undertook
-undervalu
-undervalued
-underwent
-underwrit
-underwrite
-undescried
-undeserved
-undeserver
-undeservers
-undeserving
-undetermin
-undid
-undinted
-undiscernible
-undiscover
-undishonoured
-undispos
-undistinguishable
-undistinguished
-undividable
-undivided
-undivulged
-undo
-undoes
-undoing
-undone
-undoubted
-undoubtedly
-undream
-undress
-undressed
-undrown
-unduteous
-undutiful
-une
-uneared
-unearned
-unearthly
-uneasines
-uneasy
-uneath
-uneducated
-uneffectual
-unelected
-unequal
-uneven
-unexamin
-unexecuted
-unexpected
-unexperienc
-unexperient
-unexpressive
-unfair
-unfaithful
-unfallible
-unfam
-unfashionable
-unfasten
-unfather
-unfathered
-unfed
-unfeed
-unfeeling
-unfeigned
-unfeignedly
-unfellowed
-unfelt
-unfenced
-unfilial
-unfill
-unfinish
-unfirm
-unfit
-unfitness
-unfix
-unfledg
-unfold
-unfolded
-unfoldeth
-unfolding
-unfolds
-unfool
-unforc
-unforced
-unforfeited
-unfortified
-unfortunate
-unfought
-unfrequented
-unfriended
-unfurnish
-ungain
-ungalled
-ungart
-ungarter
-ungenitur
-ungentle
-ungentleness
-ungently
-ungird
-ungodly
-ungor
-ungot
-ungotten
-ungovern
-ungracious
-ungrateful
-ungravely
-ungrown
-unguarded
-unguem
-unguided
-unhack
-unhair
-unhallow
-unhallowed
-unhand
-unhandled
-unhandsome
-unhang
-unhappied
-unhappily
-unhappiness
-unhappy
-unhardened
-unharm
-unhatch
-unheard
-unhearts
-unheedful
-unheedfully
-unheedy
-unhelpful
-unhidden
-unholy
-unhop
-unhopefullest
-unhorse
-unhospitable
-unhous
-unhoused
-unhurtful
-unicorn
-unicorns
-unimproved
-uninhabitable
-uninhabited
-unintelligent
-union
-unions
-unite
-united
-unity
-universal
-universe
-universities
-university
-unjointed
-unjust
-unjustice
-unjustly
-unkennel
-unkept
-unkind
-unkindest
-unkindly
-unkindness
-unking
-unkinglike
-unkiss
-unknit
-unknowing
-unknown
-unlace
-unlaid
-unlawful
-unlawfully
-unlearn
-unlearned
-unless
-unlesson
-unletter
-unlettered
-unlick
-unlike
-unlikely
-unlimited
-unlineal
-unlink
-unload
-unloaded
-unloading
-unloads
-unlock
-unlocks
-unlook
-unlooked
-unloos
-unloose
-unlov
-unloving
-unluckily
-unlucky
-unmade
-unmake
-unmanly
-unmann
-unmanner
-unmannerd
-unmannerly
-unmarried
-unmask
-unmasked
-unmasking
-unmasks
-unmast
-unmatch
-unmatchable
-unmatched
-unmeasurable
-unmeet
-unmellowed
-unmerciful
-unmeritable
-unmeriting
-unminded
-unmindfull
-unmingled
-unmitigable
-unmitigated
-unmix
-unmoan
-unmov
-unmoved
-unmoving
-unmuffles
-unmuffling
-unmusical
-unmuzzle
-unmuzzled
-unnatural
-unnaturally
-unnaturalness
-unnecessarily
-unnecessary
-unneighbourly
-unnerved
-unnoble
-unnoted
-unnumb
-unnumber
-unowed
-unpack
-unpaid
-unparagon
-unparallel
-unpartial
-unpath
-unpaved
-unpay
-unpeaceable
-unpeg
-unpeople
-unpeopled
-unperfect
-unperfectness
-unpick
-unpin
-unpink
-unpitied
-unpitifully
-unplagu
-unplausive
-unpleas
-unpleasant
-unpleasing
-unpolicied
-unpolish
-unpolished
-unpolluted
-unpossess
-unpossessing
-unpossible
-unpractis
-unpregnant
-unpremeditated
-unprepar
-unprepared
-unpress
-unprevailing
-unprevented
-unpriz
-unprizable
-unprofitable
-unprofited
-unproper
-unproperly
-unproportion
-unprovide
-unprovided
-unprovident
-unprovokes
-unprun
-unpruned
-unpublish
-unpurged
-unpurpos
-unqualitied
-unqueen
-unquestion
-unquestionable
-unquiet
-unquietly
-unquietness
-unraised
-unrak
-unread
-unready
-unreal
-unreasonable
-unreasonably
-unreclaimed
-unreconciled
-unreconciliable
-unrecounted
-unrecuring
-unregarded
-unregist
-unrelenting
-unremovable
-unremovably
-unreprievable
-unresolv
-unrespected
-unrespective
-unrest
-unrestor
-unrestrained
-unreveng
-unreverend
-unreverent
-unrevers
-unrewarded
-unrighteous
-unrightful
-unripe
-unripp
-unrivall
-unroll
-unroof
-unroosted
-unroot
-unrough
-unruly
-unsafe
-unsaluted
-unsanctified
-unsatisfied
-unsavoury
-unsay
-unscalable
-unscann
-unscarr
-unschool
-unscorch
-unscour
-unscratch
-unseal
-unseam
-unsearch
-unseason
-unseasonable
-unseasonably
-unseasoned
-unseconded
-unsecret
-unseduc
-unseeing
-unseeming
-unseemly
-unseen
-unseminar
-unseparable
-unserviceable
-unset
-unsettle
-unsettled
-unsever
-unsex
-unshak
-unshaked
-unshaken
-unshaped
-unshapes
-unsheath
-unsheathe
-unshorn
-unshout
-unshown
-unshrinking
-unshrubb
-unshunn
-unshunnable
-unsifted
-unsightly
-unsinew
-unsisting
-unskilful
-unskilfully
-unskillful
-unslipping
-unsmirched
-unsoil
-unsolicited
-unsorted
-unsought
-unsound
-unsounded
-unspeak
-unspeakable
-unspeaking
-unsphere
-unspoke
-unspoken
-unspotted
-unsquar
-unstable
-unstaid
-unstain
-unstained
-unstanched
-unstate
-unsteadfast
-unstooping
-unstringed
-unstuff
-unsubstantial
-unsuitable
-unsuiting
-unsullied
-unsunn
-unsur
-unsure
-unsuspected
-unsway
-unswayable
-unswayed
-unswear
-unswept
-unsworn
-untainted
-untalk
-untangle
-untangled
-untasted
-untaught
-untempering
-untender
-untent
-untented
-unthankful
-unthankfulness
-unthink
-unthought
-unthread
-unthrift
-unthrifts
-unthrifty
-untie
-untied
-until
-untimber
-untimely
-untir
-untirable
-untired
-untitled
-unto
-untold
-untouch
-untoward
-untowardly
-untraded
-untrain
-untrained
-untread
-untreasur
-untried
-untrimmed
-untrod
-untrodden
-untroubled
-untrue
-untrussing
-untruth
-untruths
-untucked
-untun
-untune
-untuneable
-untutor
-untutored
-untwine
-unurg
-unus
-unused
-unusual
-unvalued
-unvanquish
-unvarnish
-unveil
-unveiling
-unvenerable
-unvex
-unviolated
-unvirtuous
-unvisited
-unvulnerable
-unwares
-unwarily
-unwash
-unwatch
-unwearied
-unwed
-unwedgeable
-unweeded
-unweighed
-unweighing
-unwelcome
-unwept
-unwhipp
-unwholesome
-unwieldy
-unwilling
-unwillingly
-unwillingness
-unwind
-unwiped
-unwise
-unwisely
-unwish
-unwished
-unwitted
-unwittingly
-unwonted
-unwooed
-unworthier
-unworthiest
-unworthily
-unworthiness
-unworthy
-unwrung
-unyok
-unyoke
-up
-upbraid
-upbraided
-upbraidings
-upbraids
-uphoarded
-uphold
-upholdeth
-upholding
-upholds
-uplift
-uplifted
-upmost
-upon
-upper
-uprear
-upreared
-upright
-uprighteously
-uprightness
-uprise
-uprising
-uproar
-uproars
-uprous
-upshoot
-upshot
-upside
-upspring
-upstairs
-upstart
-upturned
-upward
-upwards
-urchin
-urchinfield
-urchins
-urg
-urge
-urged
-urgent
-urges
-urgest
-urging
-urinal
-urinals
-urine
-urn
-urns
-urs
-ursa
-ursley
-ursula
-urswick
-us
-usage
-usance
-usances
-use
-used
-useful
-useless
-user
-uses
-usest
-useth
-usher
-ushered
-ushering
-ushers
-using
-usual
-usually
-usurer
-usurers
-usuries
-usuring
-usurp
-usurpation
-usurped
-usurper
-usurpers
-usurping
-usurpingly
-usurps
-usury
-ut
-utensil
-utensils
-utility
-utmost
-utt
-utter
-utterance
-uttered
-uttereth
-uttering
-utterly
-uttermost
-utters
-uy
-v
-va
-vacancy
-vacant
-vacation
-vade
-vagabond
-vagabonds
-vagram
-vagrom
-vail
-vailed
-vailing
-vaillant
-vain
-vainer
-vainglory
-vainly
-vainness
-vais
-valanc
-valance
-vale
-valence
-valentine
-valentinus
-valentio
-valeria
-valerius
-vales
-valiant
-valiantly
-valiantness
-validity
-vallant
-valley
-valleys
-vally
-valor
-valorous
-valorously
-valour
-valu
-valuation
-value
-valued
-valueless
-values
-valuing
-vane
-vanish
-vanished
-vanishes
-vanishest
-vanishing
-vanities
-vanity
-vanquish
-vanquished
-vanquisher
-vanquishest
-vanquisheth
-vant
-vantage
-vantages
-vantbrace
-vapians
-vapor
-vaporous
-vapour
-vapours
-vara
-variable
-variance
-variation
-variations
-varied
-variest
-variety
-varld
-varlet
-varletry
-varlets
-varletto
-varnish
-varrius
-varro
-vary
-varying
-vassal
-vassalage
-vassals
-vast
-vastidity
-vasty
-vat
-vater
-vaudemont
-vaughan
-vault
-vaultages
-vaulted
-vaulting
-vaults
-vaulty
-vaumond
-vaunt
-vaunted
-vaunter
-vaunting
-vauntingly
-vaunts
-vauvado
-vaux
-vaward
-ve
-veal
-vede
-vehemence
-vehemency
-vehement
-vehor
-veil
-veiled
-veiling
-vein
-veins
-vell
-velure
-velutus
-velvet
-vendible
-venerable
-venereal
-venetia
-venetian
-venetians
-veneys
-venge
-vengeance
-vengeances
-vengeful
-veni
-venial
-venice
-venison
-venit
-venom
-venomous
-venomously
-vent
-ventages
-vented
-ventidius
-ventricle
-vents
-ventur
-venture
-ventured
-ventures
-venturing
-venturous
-venue
-venus
-venuto
-ver
-verb
-verba
-verbal
-verbatim
-verbosity
-verdict
-verdun
-verdure
-vere
-verefore
-verg
-verge
-vergers
-verges
-verier
-veriest
-verified
-verify
-verily
-veritable
-verite
-verities
-verity
-vermilion
-vermin
-vernon
-verona
-veronesa
-versal
-verse
-verses
-versing
-vert
-very
-vesper
-vessel
-vessels
-vestal
-vestments
-vesture
-vetch
-vetches
-veux
-vex
-vexation
-vexations
-vexed
-vexes
-vexest
-vexeth
-vexing
-vi
-via
-vial
-vials
-viand
-viands
-vic
-vicar
-vice
-vicegerent
-vicentio
-viceroy
-viceroys
-vices
-vici
-vicious
-viciousness
-vict
-victims
-victor
-victoress
-victories
-victorious
-victors
-victory
-victual
-victuall
-victuals
-videlicet
-video
-vides
-videsne
-vidi
-vie
-vied
-vienna
-view
-viewest
-vieweth
-viewing
-viewless
-views
-vigil
-vigilance
-vigilant
-vigitant
-vigour
-vii
-viii
-vile
-vilely
-vileness
-viler
-vilest
-vill
-village
-villager
-villagery
-villages
-villain
-villainies
-villainous
-villainously
-villains
-villainy
-villanies
-villanous
-villany
-villiago
-villian
-villianda
-villians
-vinaigre
-vincentio
-vincere
-vindicative
-vine
-vinegar
-vines
-vineyard
-vineyards
-vint
-vintner
-viol
-viola
-violate
-violated
-violates
-violation
-violator
-violence
-violent
-violenta
-violenteth
-violently
-violet
-violets
-viper
-viperous
-vipers
-vir
-virgilia
-virgin
-virginal
-virginalling
-virginity
-virginius
-virgins
-virgo
-virtue
-virtues
-virtuous
-virtuously
-visag
-visage
-visages
-visard
-viscount
-visible
-visibly
-vision
-visions
-visit
-visitation
-visitations
-visited
-visiting
-visitings
-visitor
-visitors
-visits
-visor
-vita
-vitae
-vital
-vitement
-vitruvio
-vitx
-viva
-vivant
-vive
-vixen
-viz
-vizaments
-vizard
-vizarded
-vizards
-vizor
-vlouting
-vocation
-vocativo
-vocatur
-voce
-voic
-voice
-voices
-void
-voided
-voiding
-voke
-volable
-volant
-volivorco
-volley
-volquessen
-volsce
-volsces
-volscian
-volscians
-volt
-voltemand
-volubility
-voluble
-volume
-volumes
-volumnia
-volumnius
-voluntaries
-voluntary
-voluptuously
-voluptuousness
-vomissement
-vomit
-vomits
-vor
-vore
-vortnight
-vot
-votaries
-votarist
-votarists
-votary
-votre
-vouch
-voucher
-vouchers
-vouches
-vouching
-vouchsaf
-vouchsafe
-vouchsafed
-vouchsafes
-vouchsafing
-voudrais
-vour
-vous
-voutsafe
-vow
-vowed
-vowel
-vowels
-vowing
-vows
-vox
-voyage
-voyages
-vraiment
-vulcan
-vulgar
-vulgarly
-vulgars
-vulgo
-vulnerable
-vulture
-vultures
-vurther
-w
-wad
-waddled
-wade
-waded
-wafer
-waft
-waftage
-wafting
-wafts
-wag
-wage
-wager
-wagers
-wages
-wagging
-waggish
-waggling
-waggon
-waggoner
-wagon
-wagoner
-wags
-wagtail
-wail
-wailful
-wailing
-wails
-wain
-wainropes
-wainscot
-waist
-wait
-waited
-waiter
-waiteth
-waiting
-waits
-wak
-wake
-waked
-wakefield
-waken
-wakened
-wakes
-wakest
-waking
-wales
-walk
-walked
-walking
-walks
-wall
-walled
-wallet
-wallets
-wallon
-walloon
-wallow
-walls
-walnut
-walter
-wan
-wand
-wander
-wanderer
-wanderers
-wandering
-wanders
-wands
-wane
-waned
-wanes
-waning
-wann
-want
-wanted
-wanteth
-wanting
-wanton
-wantonly
-wantonness
-wantons
-wants
-wappen
-war
-warble
-warbling
-ward
-warded
-warden
-warder
-warders
-wardrobe
-wardrop
-wards
-ware
-wares
-warily
-warkworth
-warlike
-warm
-warmed
-warmer
-warming
-warms
-warmth
-warn
-warned
-warning
-warnings
-warns
-warp
-warped
-warr
-warrant
-warranted
-warranteth
-warrantise
-warrantize
-warrants
-warranty
-warren
-warrener
-warring
-warrior
-warriors
-wars
-wart
-warwick
-warwickshire
-wary
-was
-wash
-washed
-washer
-washes
-washford
-washing
-wasp
-waspish
-wasps
-wassail
-wassails
-wast
-waste
-wasted
-wasteful
-wasters
-wastes
-wasting
-wat
-watch
-watched
-watchers
-watches
-watchful
-watching
-watchings
-watchman
-watchmen
-watchword
-water
-waterdrops
-watered
-waterfly
-waterford
-watering
-waterish
-waterpots
-waterrugs
-waters
-waterton
-watery
-wav
-wave
-waved
-waver
-waverer
-wavering
-waves
-waving
-waw
-wawl
-wax
-waxed
-waxen
-waxes
-waxing
-way
-waylaid
-waylay
-ways
-wayward
-waywarder
-waywardness
-we
-weak
-weaken
-weakens
-weaker
-weakest
-weakling
-weakly
-weakness
-weal
-wealsmen
-wealth
-wealthiest
-wealthily
-wealthy
-wealtlly
-wean
-weapon
-weapons
-wear
-wearer
-wearers
-wearied
-wearies
-weariest
-wearily
-weariness
-wearing
-wearisome
-wears
-weary
-weasel
-weather
-weathercock
-weathers
-weav
-weave
-weaver
-weavers
-weaves
-weaving
-web
-wed
-wedded
-wedding
-wedg
-wedged
-wedges
-wedlock
-wednesday
-weed
-weeded
-weeder
-weeding
-weeds
-weedy
-week
-weeke
-weekly
-weeks
-ween
-weening
-weep
-weeper
-weeping
-weepingly
-weepings
-weeps
-weet
-weigh
-weighed
-weighing
-weighs
-weight
-weightier
-weightless
-weights
-weighty
-weird
-welcom
-welcome
-welcomer
-welcomes
-welcomest
-welfare
-welkin
-well
-wells
-welsh
-welshman
-welshmen
-welshwomen
-wench
-wenches
-wenching
-wend
-went
-wept
-weraday
-were
-wert
-west
-western
-westminster
-westmoreland
-westward
-wet
-wether
-wetting
-wezand
-whale
-whales
-wharf
-wharfs
-what
-whate
-whatever
-whatsoe
-whatsoever
-whatsome
-whe
-wheat
-wheaten
-wheel
-wheeling
-wheels
-wheer
-wheeson
-wheezing
-whelk
-whelks
-whelm
-whelp
-whelped
-whelps
-when
-whenas
-whence
-whencesoever
-whene
-whenever
-whensoever
-where
-whereabout
-whereas
-whereat
-whereby
-wherefore
-wherein
-whereinto
-whereof
-whereon
-whereout
-whereso
-wheresoe
-wheresoever
-wheresome
-whereto
-whereuntil
-whereunto
-whereupon
-wherever
-wherewith
-wherewithal
-whet
-whether
-whetstone
-whetted
-whew
-whey
-which
-whiff
-whiffler
-while
-whiles
-whilst
-whin
-whine
-whined
-whinid
-whining
-whip
-whipp
-whippers
-whipping
-whips
-whipster
-whipstock
-whipt
-whirl
-whirled
-whirligig
-whirling
-whirlpool
-whirls
-whirlwind
-whirlwinds
-whisp
-whisper
-whispering
-whisperings
-whispers
-whist
-whistle
-whistles
-whistling
-whit
-white
-whitehall
-whitely
-whiteness
-whiter
-whites
-whitest
-whither
-whiting
-whitmore
-whitsters
-whitsun
-whittle
-whizzing
-who
-whoa
-whoe
-whoever
-whole
-wholesom
-wholesome
-wholly
-whom
-whoobub
-whoop
-whooping
-whor
-whore
-whoremaster
-whoremasterly
-whoremonger
-whores
-whoreson
-whoresons
-whoring
-whorish
-whose
-whoso
-whosoe
-whosoever
-why
-wi
-wick
-wicked
-wickednes
-wickedness
-wicket
-wicky
-wid
-wide
-widens
-wider
-widow
-widowed
-widower
-widowhood
-widows
-wield
-wife
-wight
-wights
-wild
-wildcats
-wilder
-wilderness
-wildest
-wildfire
-wildly
-wildness
-wilds
-wiles
-wilful
-wilfull
-wilfully
-wilfulnes
-wilfulness
-will
-willed
-willers
-willeth
-william
-williams
-willing
-willingly
-willingness
-willoughby
-willow
-wills
-wilt
-wiltshire
-wimpled
-win
-wince
-winch
-winchester
-wincot
-wind
-winded
-windgalls
-winding
-windlasses
-windmill
-window
-windows
-windpipe
-winds
-windsor
-windy
-wine
-wing
-winged
-wingfield
-wingham
-wings
-wink
-winking
-winks
-winner
-winners
-winning
-winnow
-winnowed
-winnows
-wins
-winter
-winterly
-winters
-wip
-wipe
-wiped
-wipes
-wiping
-wire
-wires
-wiry
-wisdom
-wisdoms
-wise
-wiselier
-wisely
-wiser
-wisest
-wish
-wished
-wisher
-wishers
-wishes
-wishest
-wisheth
-wishful
-wishing
-wishtly
-wisp
-wist
-wit
-witb
-witch
-witchcraft
-witches
-witching
-with
-withal
-withdraw
-withdrawing
-withdrawn
-withdrew
-wither
-withered
-withering
-withers
-withheld
-withhold
-withholds
-within
-withold
-without
-withstand
-withstanding
-withstood
-witless
-witness
-witnesses
-witnesseth
-witnessing
-wits
-witted
-wittenberg
-wittiest
-wittily
-witting
-wittingly
-wittol
-wittolly
-witty
-wiv
-wive
-wived
-wives
-wiving
-wizard
-wizards
-wo
-woe
-woeful
-woefull
-woefullest
-woes
-woful
-wolf
-wolfish
-wolsey
-wolves
-wolvish
-woman
-womanhood
-womanish
-womankind
-womanly
-womb
-wombs
-womby
-women
-won
-woncot
-wond
-wonder
-wondered
-wonderful
-wonderfully
-wondering
-wonders
-wondrous
-wondrously
-wont
-wonted
-woo
-wood
-woodbine
-woodcock
-woodcocks
-wooden
-woodland
-woodman
-woodmonger
-woods
-woodstock
-woodville
-wooed
-wooer
-wooers
-wooes
-woof
-wooing
-wooingly
-wool
-woollen
-woolly
-woolsack
-woolsey
-woolward
-woos
-wor
-worcester
-word
-words
-wore
-worins
-work
-workers
-working
-workings
-workman
-workmanly
-workmanship
-workmen
-works
-worky
-world
-worldlings
-worldly
-worlds
-worm
-worms
-wormwood
-wormy
-worn
-worried
-worries
-worry
-worrying
-worse
-worser
-worship
-worshipful
-worshipfully
-worshipp
-worshipper
-worshippers
-worshippest
-worships
-worst
-worsted
-wort
-worth
-worthied
-worthier
-worthies
-worthiest
-worthily
-worthiness
-worthless
-worths
-worthy
-worts
-wot
-wots
-wotting
-wouid
-would
-wouldest
-wouldst
-wound
-wounded
-wounding
-woundings
-woundless
-wounds
-wouns
-woven
-wow
-wrack
-wrackful
-wrangle
-wrangler
-wranglers
-wrangling
-wrap
-wrapp
-wraps
-wrapt
-wrath
-wrathful
-wrathfully
-wraths
-wreak
-wreakful
-wreaks
-wreath
-wreathed
-wreathen
-wreaths
-wreck
-wrecked
-wrecks
-wren
-wrench
-wrenching
-wrens
-wrest
-wrested
-wresting
-wrestle
-wrestled
-wrestler
-wrestling
-wretch
-wretchcd
-wretched
-wretchedness
-wretches
-wring
-wringer
-wringing
-wrings
-wrinkle
-wrinkled
-wrinkles
-wrist
-wrists
-writ
-write
-writer
-writers
-writes
-writhled
-writing
-writings
-writs
-written
-wrong
-wronged
-wronger
-wrongful
-wrongfully
-wronging
-wrongly
-wrongs
-wronk
-wrote
-wroth
-wrought
-wrung
-wry
-wrying
-wt
-wul
-wye
-x
-xanthippe
-xi
-xii
-xiii
-xiv
-xv
-y
-yard
-yards
-yare
-yarely
-yarn
-yaughan
-yaw
-yawn
-yawning
-ycleped
-ycliped
-ye
-yea
-yead
-year
-yearly
-yearn
-yearns
-years
-yeas
-yeast
-yedward
-yell
-yellow
-yellowed
-yellowing
-yellowness
-yellows
-yells
-yelping
-yeoman
-yeomen
-yerk
-yes
-yesterday
-yesterdays
-yesternight
-yesty
-yet
-yew
-yicld
-yield
-yielded
-yielder
-yielders
-yielding
-yields
-yok
-yoke
-yoked
-yokefellow
-yokes
-yoketh
-yon
-yond
-yonder
-yongrey
-yore
-yorick
-york
-yorkists
-yorks
-yorkshire
-you
-young
-younger
-youngest
-youngling
-younglings
-youngly
-younker
-your
-yours
-yourself
-yourselves
-youth
-youthful
-youths
-youtli
-zanies
-zany
-zeal
-zealous
-zeals
-zed
-zenelophon
-zenith
-zephyrs
-zir
-zo
-zodiac
-zodiacs
-zone
-zounds
-zwagger
diff --git a/libs/postgresql/libpq.factor b/libs/postgresql/libpq.factor
deleted file mode 100644 (file)
index 3786d1d..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-! See http://factor.sf.net/license.txt for BSD license.
-
-! adapted from libpq-fe.h version 7.4.7
-! tested on debian linux with postgresql 7.4.7
-! Updated to 8.1
-
-IN: postgresql
-USING: alien ;
-
-
-! ConnSatusType
-: CONNECTION_OK                                        HEX: 0 ; inline
-: CONNECTION_BAD                                       HEX: 1 ; inline
-: CONNECTION_STARTED                           HEX: 2 ; inline
-: CONNECTION_MADE                                      HEX: 3 ; inline
-: CONNECTION_AWAITING_RESPONSE         HEX: 4 ; inline
-: CONNECTION_AUTH_OK                           HEX: 5 ; inline
-: CONNECTION_SETENV                                    HEX: 6 ; inline
-: CONNECTION_SSL_STARTUP                       HEX: 7 ; inline
-: CONNECTION_NEEDED                                    HEX: 8 ; inline
-
-! PostgresPollingStatusType
-: PGRES_POLLING_FAILED                                 HEX: 0 ; inline
-: PGRES_POLLING_READING                        HEX: 1 ; inline
-: PGRES_POLLING_WRITING                        HEX: 2 ; inline
-: PGRES_POLLING_OK                                     HEX: 3 ; inline
-: PGRES_POLLING_ACTIVE                                 HEX: 4 ; inline
-
-! ExecStatusType;
-: PGRES_EMPTY_QUERY                            HEX: 0 ; inline
-: PGRES_COMMAND_OK                                     HEX: 1 ; inline
-: PGRES_TUPLES_OK                                      HEX: 2 ; inline
-: PGRES_COPY_OUT                                       HEX: 3 ; inline
-: PGRES_COPY_IN                                                HEX: 4 ; inline
-: PGRES_BAD_RESPONSE                           HEX: 5 ; inline
-: PGRES_NONFATAL_ERROR                         HEX: 6 ; inline
-: PGRES_FATAL_ERROR                                    HEX: 7 ; inline
-
-! PGTransactionStatusType;
-: PQTRANS_IDLE                                         HEX: 0 ; inline
-: PQTRANS_ACTIVE                                       HEX: 1 ; inline
-: PQTRANS_INTRANS                                      HEX: 2 ; inline
-: PQTRANS_INERROR                                      HEX: 3 ; inline
-: PQTRANS_UNKNOWN                                      HEX: 4 ; inline
-
-! PGVerbosity;
-: PQERRORS_TERSE                                       HEX: 0 ; inline
-: PQERRORS_DEFAULT                                     HEX: 1 ; inline
-: PQERRORS_VERBOSE                                     HEX: 2 ; inline
-
-
-TYPEDEF: int size_t
-TYPEDEF: int ConnStatusType
-TYPEDEF: int ExecStatusType 
-TYPEDEF: int PostgresPollingStatusType
-TYPEDEF: int PGTransactionStatusType 
-TYPEDEF: int PGVerbosity 
-
-TYPEDEF: void* PGconn*
-TYPEDEF: void* PGresult*
-TYPEDEF: void* PGcancel*
-TYPEDEF: uint Oid
-TYPEDEF: uint* Oid*
-TYPEDEF: char pqbool
-TYPEDEF: void* PQconninfoOption*
-TYPEDEF: void* PGnotify*
-TYPEDEF: void* PQArgBlock*
-TYPEDEF: void* PQprintOpt*
-TYPEDEF: void* FILE*
-TYPEDEF: void* SSL*
-
-LIBRARY: postgresql
-
-
-! Exported functions of libpq
-! ===  in fe-connect.c ===
-
-! make a new client connection to the backend
-! Asynchronous (non-blocking)
-FUNCTION: PGconn* PQconnectStart ( char* 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 ) ;
-
-: PQsetdb ( M_PGHOST M_PGPORT M_PGOPT M_PGTTY M_DBNAME -- PGconn* )
-       f f PQsetdbLogin ;
-
-! close the current connection and free the PGconn data structure
-FUNCTION: void PQfinish ( PGconn* conn ) ;
-
-! get info about connection options known to PQconnectdb
-FUNCTION: PQconninfoOption* PQconndefaults ( ) ;
-
-! free the data structure returned by PQconndefaults()
-FUNCTION: void PQconninfoFree ( PQconninfoOption* connOptions ) ;
-
-! 
-! close the current connection and restablish a new one with the same
-! parameters
-!
-! Asynchronous (non-blocking)
-FUNCTION: int  PQresetStart ( PGconn* conn ) ;
-FUNCTION: PostgresPollingStatusType PQresetPoll ( PGconn* conn ) ;
-
-! Synchronous (blocking)
-FUNCTION: void PQreset ( PGconn* conn ) ;
-
-! request a cancel structure
-FUNCTION: PGcancel* PQgetCancel ( PGconn* conn ) ;
-
-! free a cancel structure
-FUNCTION: void PQfreeCancel ( PGcancel* cancel ) ;
-
-! issue a cancel request
-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: ConnStatusType PQstatus ( PGconn* conn ) ;
-FUNCTION: PGTransactionStatusType PQtransactionStatus ( PGconn* conn ) ;
-FUNCTION: char* PQparameterStatus ( PGconn* conn,
-                                 char* paramName ) ;
-FUNCTION: int  PQprotocolVersion ( PGconn* conn ) ;
-FUNCTION: int  PQServerVersion ( PGconn* conn ) ;
-FUNCTION: char* 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 ) ;
-
-! May not be compiled into libpq
-! Get the SSL structure associated with a connection
-FUNCTION: SSL* PQgetssl ( PGconn* conn ) ;
-
-! Tell libpq whether it needs to initialize OpenSSL
-FUNCTION: void PQinitSSL ( int do_init ) ;
-
-! Set verbosity for PQerrorMessage and PQresultErrorMessage
-FUNCTION: PGVerbosity PQsetErrorVerbosity ( PGconn* conn,
-       PGVerbosity verbosity ) ;
-
-! Enable/disable tracing
-FUNCTION: void PQtrace ( PGconn* conn, FILE* debug_port ) ;
-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);
-! ALIAS: void* PQnoticeReceiver
-! ALIAS: void* PQnoticeProcessor
-
-! Override default notice handling routines
-! FUNCTION: PQnoticeReceiver PQsetNoticeReceiver ( PGconn* conn,
-                                       ! PQnoticeReceiver proc,
-                                       ! void* arg ) ;
-! FUNCTION: PQnoticeProcessor PQsetNoticeProcessor ( PGconn* conn,
-                                       ! PQnoticeProcessor proc,
-                                       ! void* arg ) ;
-! END BROKEN
-
-! === in fe-exec.c ===
-
-! Simple synchronous query
-FUNCTION: PGresult* PQexec ( PGconn* conn, char* query ) ;
-FUNCTION: PGresult* PQexecParams ( PGconn* conn,
-                        char* command,
-                        int nParams,
-                        Oid* paramTypes,
-                        char** paramValues,
-                        int* paramLengths,
-                        int* paramFormats,
-                        int resultFormat ) ;
-FUNCTION: PGresult* PQprepare ( PGconn* conn, char* stmtName,
-        char* query, int nParams,
-        Oid* paramTypes ) ;
-FUNCTION: PGresult* PQexecPrepared ( PGconn* conn,
-                        char* stmtName,
-                        int nParams,
-                        char** paramValues,
-                        int* paramLengths,
-                        int* paramFormats,
-                        int resultFormat ) ;
-
-! Interface for multiple-result or asynchronous queries
-FUNCTION: int PQsendQuery ( PGconn* conn, char* query ) ;
-FUNCTION: int PQsendQueryParams ( PGconn* conn,
-                                 char* command,
-                                 int nParams,
-                                 Oid* paramTypes,
-                                 char** paramValues,
-                                 int* paramLengths,
-                                 int* paramFormats,
-                                 int resultFormat ) ;
-FUNCTION: PGresult* PQsendPrepare ( PGconn* conn, char* stmtName,
-            char* query, int nParams,
-            Oid* paramTypes ) ;
-FUNCTION: int PQsendQueryPrepared ( PGconn* conn,
-                                 char* stmtName,
-                                 int nParams,
-                                 char** paramValues,
-                                 int *paramLengths,
-                                 int *paramFormats,
-                                 int resultFormat ) ;
-FUNCTION: PGresult* PQgetResult ( PGconn* conn ) ;
-
-! Routines for managing an asynchronous query
-FUNCTION: int  PQisBusy ( PGconn* conn ) ;
-FUNCTION: int  PQconsumeInput ( PGconn* conn ) ;
-
-! LISTEN/NOTIFY support
-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 ) ;
-
-! 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  PQendcopy ( PGconn* conn ) ;
-
-! Set blocking/nonblocking connection to the backend
-FUNCTION: int  PQsetnonblocking ( PGconn* conn, int arg ) ;
-FUNCTION: int  PQisnonblocking ( PGconn* conn ) ;
-
-! Force the write buffer to be written (or at least try)
-FUNCTION: int  PQflush ( PGconn* conn ) ;
-
-! 
-! * "Fast path" interface --- not really recommended for application
-! * use
-!
-FUNCTION: PGresult* PQfn ( PGconn* conn,
-        int fnid,
-        int* result_buf,
-        int* result_len,
-        int result_is_int,
-        PQArgBlock* args,
-        int nargs ) ;
-
-! 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: 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: 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: Oid  PQoidValue ( PGresult* res ) ;
-FUNCTION: char* PQcmdTuples ( PGresult* res ) ;
-FUNCTION: char* 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 ) ;
-
-! Delete a PGresult
-FUNCTION: void PQclear ( PGresult* res ) ;
-
-! For freeing other alloc'd results, such as PGnotify structs
-FUNCTION: void PQfreemem ( void* ptr ) ;
-
-! Exists for backward compatibility.
-: PQfreeNotify PQfreemem ;
-
-!
-! Make an empty PGresult with given status (some apps find this
-! useful). If conn is not NULL and status indicates an error, the
-! conn's errorMessage is copied.
-!
-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,
-                                    int* error ) ;
-FUNCTION: uchar* PQescapeByteaConn ( PGconn* conn,
-                                    char* from, size_t length,
-                                    size_t* to_length ) ;
-FUNCTION: uchar* PQunescapeBytea ( uchar* 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,
-                         size_t* bytealen ) ;
-
-! === in fe-print.c ===
-
-FUNCTION: void PQprint ( FILE* fout, PGresult* res, PQprintOpt* ps ) ;
-
-! really old printing routines
-FUNCTION: void PQdisplayTuples ( PGresult* res,
-                               FILE* fp,               
-                               int fillAlign,
-                               char* fieldSep,
-                               int printHeader,
-                               int quiet ) ;
-
-FUNCTION: void PQprintTuples ( PGresult* res,
-                         FILE* fout,           
-                         int printAttName,
-                         int terseOutput,      
-                         int width ) ; 
-                                               
-! === in fe-lobj.c ===
-
-! 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_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 ) ;
-
-! === in fe-misc.c ===
-
-! Determine length of multibyte encoded char at *s
-FUNCTION: int  PQmblen ( uchar* s, int encoding ) ;
-
-! Determine display length of multibyte encoded char at *s
-FUNCTION: int  PQdsplen ( uchar* s, int encoding ) ;
-
-! Get encoding id from environment variable PGCLIENTENCODING
-FUNCTION: int  PQenv2encoding ( ) ;
-
diff --git a/libs/postgresql/load.factor b/libs/postgresql/load.factor
deleted file mode 100644 (file)
index 3156cdc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-PROVIDE: libs/postgresql
-{ +files+ {
-    "libpq.factor"
-    "postgresql.factor"
-} }
-{ +tests+ {
-    "postgresql-test.factor"
-} } ;
diff --git a/libs/postgresql/postgresql-test.factor b/libs/postgresql/postgresql-test.factor
deleted file mode 100644 (file)
index 04c9789..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-! You will need to run  'createdb factor-test' to create the database.
-! Set username and password in  the 'connect' word.
-
-IN: postgresql-test
-USING: kernel postgresql alien errors io prettyprint sequences namespaces ;
-
-
-: test-connection ( host port pgopts pgtty db user pass -- bool )
-    [ [ ] with-postgres ] catch "Error connecting!" "Connected!" ? print ;
-
-! just a basic demo
-
-"localhost" "" "" "" "test" "postgres" "" [
-    "drop table animal" do-command
-
-    "create table animal (id serial not null primary key, species varchar(256), name varchar(256), age integer)" do-command
-    "insert into animal (species, name, age) values ('lion', 'Mufasa', 5)"
-    do-command
-
-    "select * from animal where name = 'Mufasa'" [ ] do-query
-    "select * from animal where name = 'Mufasa'"
-    [
-        result>seq length 1 = [ "...there can only be one Mufasa..." throw ] unless
-    ] do-query
-
-    "insert into animal (species, name, age) values ('lion', 'Simba', 1)"
-    do-command
-
-    "select * from animal" 
-    [
-          "Animal table:" print
-          result>seq print-table
-    ] do-query
-
-    ! intentional errors
-    ! [ "select asdf from animal"
-    ! [ ] do-query ] catch [ "caught: " write print ] when*
-    ! "select asdf from animal" [ ] do-query 
-    ! "aofijweafew" do-command
-] with-postgres-catch
-
diff --git a/libs/postgresql/postgresql.factor b/libs/postgresql/postgresql.factor
deleted file mode 100644 (file)
index 528b409..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-! See http://factor.sf.net/license.txt for BSD license.
-
-! adapted from libpq-fe.h version 7.4.7
-! tested on debian linux with postgresql 7.4.7
-
-IN: postgresql
-USING: kernel alien errors io prettyprint sequences namespaces arrays math ;
-
-SYMBOL: db
-SYMBOL: query-res
-
-: connect-postgres ( host port pgopts pgtty db user pass -- conn )
-    PQsetdbLogin
-    dup PQstatus zero? [ "couldn't connect to database" throw ] unless ;
-
-: with-postgres ( host port pgopts pgtty db user pass quot -- )
-    [ >r connect-postgres db set r>
-    [ db get PQfinish ] cleanup ] with-scope ; inline
-
-: with-postgres-catch ( host port pgopts pgtty db user pass quot -- )
-    [ with-postgres ] catch [ "caught: " write print ] when* ;
-
-: postgres-error ( ret -- ret )
-    dup zero? [ PQresultErrorMessage throw ] when ;
-
-: (do-query) ( PGconn query -- PGresult* )
-    ! For queries that do not return rows, PQexec() returns PGRES_COMMAND_OK
-    ! For queries that return rows, PQexec() returns PGRES_TUPLES_OK
-    PQexec
-    dup PQresultStatus PGRES_COMMAND_OK =
-    over PQresultStatus PGRES_TUPLES_OK =
-    or [
-        [ PQresultErrorMessage CHAR: \n swap remove ] keep PQclear throw
-    ] unless ;
-
-: (do-command) ( PGconn query -- PGresult* )
-    [ (do-query) ] catch
-    [
-        swap
-        "non-fatal error: " print
-        "\tQuery: " write "'" write write "'" print
-        "\t" write print
-    ] when* drop ;
-
-: do-command ( str -- )
-    unit \ (do-command) add db get swap call ;
-
-: prepare ( str quot word -- conn quot )
-    rot unit swap append swap append db get swap ;
-
-: do-query ( str quot -- )
-    [ (do-query) query-res set ] prepare catch
-    [ rethrow ] [ query-res get PQclear ] if* ;
-
-: result>seq ( -- seq )
-    query-res get [ PQnfields ] keep PQntuples
-    [ swap [ query-res get -rot PQgetvalue ] map-with ] map-with ;
-
-: print-table ( seq -- )
-    [ [ write bl ] each "\n" write ] each ;
-
diff --git a/libs/print-dataflow/load.factor b/libs/print-dataflow/load.factor
deleted file mode 100644 (file)
index b5050ec..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-PROVIDE: libs/print-dataflow
-{ +files+ { "print-dataflow.factor" } }
-{ +tests+ { "tests.factor" } } ;
diff --git a/libs/print-dataflow/print-dataflow.factor b/libs/print-dataflow/print-dataflow.factor
deleted file mode 100644 (file)
index 06f7556..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-IN: print-dataflow
-USING: generic hashtables inference io kernel kernel-internals
-math namespaces prettyprint sequences styles vectors words
-optimizer ;
-
-! A simple tool for turning dataflow IR into quotations, for
-! debugging purposes.
-
-GENERIC: node>quot ( ? node -- )
-
-TUPLE: comment node text ;
-
-M: comment pprint*
-    "( " over comment-text " )" 3append
-    swap comment-node presented associate
-    styled-text ;
-
-: comment, ( ? node text -- )
-    rot [ <comment> , ] [ 2drop ] if ;
-
-: values% ( prefix values -- )
-    [
-        swap %
-        dup value? [
-            value-literal unparse %
-        ] [
-            "@" % #
-        ] if
-    ] each-with ;
-
-: effect-str ( node -- str )
-    [
-        " " over node-in-d values%
-        " r: " over node-in-r values%
-        " --" %
-        " " over node-out-d values%
-        " r: " swap node-out-r values%
-    ] "" make 1 tail ;
-
-M: #shuffle node>quot
-    >r drop t r> dup effect-str "#shuffle: " swap append comment, ;
-
-M: #push node>quot nip >#push< % ;
-
-DEFER: dataflow>quot
-
-: #call>quot ( ? node -- )
-    dup node-param dup
-    [ , dup effect-str comment, ] [ 3drop ] if ;
-
-M: #call node>quot #call>quot ;
-
-M: #call-label node>quot #call>quot ;
-
-M: #label node>quot
-    [ "#label: " over node-param word-name append comment, ] 2keep
-    node-child swap dataflow>quot , \ call ,  ;
-
-M: #if node>quot
-    [ "#if" comment, ] 2keep
-    node-children [ swap dataflow>quot ] map-with % \ if , ;
-
-M: #dispatch node>quot
-    [ "#dispatch" comment, ] 2keep
-    node-children [ swap dataflow>quot ] map-with , \ dispatch , ;
-
-M: #return node>quot
-    dup node-param unparse "#return " swap append comment, ;
-
-M: object node>quot dup class word-name comment, ;
-
-: (dataflow>quot) ( ? node -- )
-    dup [
-        2dup node>quot node-successor (dataflow>quot)
-    ] [
-        2drop
-    ] if ;
-
-: dataflow>quot ( node ? -- quot )
-    [ swap (dataflow>quot) ] [ ] make ;
-
-: dataflow. ( quot ? -- )
-    #! Print dataflow IR for a quotation. Flag indicates if
-    #! annotations should be printed or not.
-    >r dataflow optimize r> dataflow>quot . ;
diff --git a/libs/print-dataflow/tests.factor b/libs/print-dataflow/tests.factor
deleted file mode 100644 (file)
index 56fe05b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-IN: print-dataflow
-
-[ ] [ [ 2 ] t dataflow. ] unit-test
-[ ] [ [ 3 + ] t dataflow. ] unit-test
-[ ] [ [ drop ] t dataflow. ] unit-test
-[ ] [ [ [ sq ] [ abs ] if ] t dataflow. ] unit-test
-[ ] [ [ { [ sq ] [ abs ] } dispatch ] t dataflow. ] unit-test
-[ ] [ \ unify-values word-def t dataflow. ] unit-test
-[ ] [ [ 0 0 / ] t dataflow. ] unit-test
diff --git a/libs/process/load.factor b/libs/process/load.factor
deleted file mode 100644 (file)
index 6ddb995..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USE: kernel
-PROVIDE: libs/process
-{ +files+ {
-    { "os-unix.factor" [ unix? ] }
-    { "os-windows.factor" [ windows? ] }
-} } ;
diff --git a/libs/process/os-unix.factor b/libs/process/os-unix.factor
deleted file mode 100644 (file)
index 5ee05ae..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-IN: process
-USING: compiler io io-internals kernel parser generic
-sequences ;
-
-LIBRARY: libc
-FUNCTION: int system ( char* command ) ;
-FUNCTION: void* popen ( char* command, char* type ) ;
-FUNCTION: int pclose ( void* file ) ;
-
-: run-process ( string -- ) system io-error ;
-: run-detached ( string -- ) " &" append run-process ;
-
-! Help me implement the equivalent feature on Windows, please...
-
-TUPLE: process-stream pipe ;
-
-C: process-stream ( command mode -- stream )
-  >r popen dup r>
-  [ set-process-stream-pipe ] keep
-  >r dup <duplex-c-stream> r> 
-  [ set-delegate ] keep ;
-
-M: process-stream stream-close 
-  process-stream-pipe [ pclose drop ] when* ;
-
-: !" parse-string system drop ; parsing
diff --git a/libs/process/os-windows.factor b/libs/process/os-windows.factor
deleted file mode 100644 (file)
index a71eba9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: process
-USING: alien compiler io io-internals kernel math parser generic
-win32-api ;
-
-: (run-process) ( string flag -- )
-    >r f swap f f 0 r> f f
-    "STARTUPINFO" <c-object>
-    "STARTUPINFO" c-size over set-STARTUPINFO-cb
-    "PROCESS_INFORMATION" <c-object> CreateProcess
-    win32-error=0 ;
-
-: run-process ( string -- )
-    0 (run-process) ;
-
-: run-detached ( string -- )
-    DETACHED_PROCESS (run-process) ;
-
diff --git a/libs/sequences.factor b/libs/sequences.factor
deleted file mode 100644 (file)
index 0f90ebe..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-USING: kernel math sequences strings ;
-IN: sequences-contrib
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: 3nth ( n seq -- slice ) >r dup 3 + r> <slice> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: map3-i ( seq -- i ) length 2 - ;
-
-: map3-quot ( quot -- quot ) [ swap 3nth ] swap append ;
-
-: map3 ( seq quot -- seq ) over map3-i swap map3-quot map-with ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: (rtrim*) ( seq quot -- newseq )
-    over length 0 > [
-        2dup >r peek r> call
-        [ >r dup length 1- head-slice r> (rtrim*) ] [ drop ] if
-    ] [
-        drop
-    ] if ;
-: rtrim* ( seq quot -- newseq ) [ (rtrim*) ] 2keep drop like ;
-: rtrim ( seq -- newseq ) [ blank? ] rtrim* ;
-
-: (ltrim*) ( seq quot -- newseq )
-    over length 0 > [
-        2dup >r first r> call [ >r 1 tail-slice r> (ltrim*) ] [ drop ] if
-    ] [
-        drop
-    ] if ;
-: ltrim* ( seq quot -- newseq ) [ (ltrim*) ] 2keep drop like ;
-: ltrim ( seq -- newseq ) [ blank? ] ltrim* ;
-
-: trim* ( seq quot -- newseq ) [ (ltrim*) ] keep rtrim* ;
-: trim ( seq -- newseq ) [ blank? ] trim* ;
-
-: ?head-slice ( seq begin -- newseq ? )
-  2dup head? [ length tail-slice t ] [ drop f ] if ;
-
-: ?tail-slice ( seq end -- newseq ? )
-  2dup tail? [ length head-slice* t ] [ drop f ] if ;
-
-: unclip-slice ( seq -- rest first )
-  dup 1 tail-slice swap first ;
-
-PROVIDE: libs/sequences ;
diff --git a/libs/serialize/load.factor b/libs/serialize/load.factor
deleted file mode 100644 (file)
index e2a7342..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-PROVIDE: libs/serialize
-{ +files+ {
-       "serialize.factor"
-       "serialize.facts"
-} }
-{ +tests+ {
-       "tests.factor"
-} } ;
diff --git a/libs/serialize/serialize.factor b/libs/serialize/serialize.factor
deleted file mode 100644 (file)
index d4cb612..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-! Copyright (C) 2006 Adam Langley and Chris Double.
-! Adam Langley was the original author of this work.
-!
-! Chris Double modified it to fix bugs and get it working
-! correctly under the latest versions of Factor.
-!
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: serialize
-USING: kernel kernel-internals math hashtables namespaces io strings sequences generic words errors arrays vectors alien ;
-
-! Variable holding a sequence of objects already serialized
-SYMBOL: serialized
-
-: add-object ( obj -- id )
-  #! Add an object to the sequence of already serialized objects.
-  #! Return the id of that object.
-  serialized get [ push ] keep length 1 - ;
-
-: object-id ( obj -- id )
-  #! Return the id of an already serialized object 
-  serialized get [ eq? ] find-with [ drop f ] unless ;
-
-USE: prettyprint 
-
-! Serialize object
-GENERIC: serialize  ( obj -- )
-
-: serialize-shared ( obj quot -- )
-  >r dup object-id [ "o" write serialize drop ] r> if* ; inline
-
-M: f serialize ( obj -- )
-  drop "n" write ;
-
-: bytes-needed ( number -- int )
-  log2 8 + 8 /i ;
-
-M: integer serialize ( obj -- )
-  dup 0 = [
-    drop "z" write
-  ] [
-    dup 0 < [ neg "m" ] [ "p" ] if write 
-    dup bytes-needed dup 4 >be write
-    >be write 
-  ] if ;
-
-M: float serialize ( obj -- )
-  "F" write
-  float>bits serialize ;
-
-M: complex serialize ( obj -- )
-  [
-    "c" write
-    dup add-object serialize
-    dup real serialize
-    imaginary serialize 
-  ] serialize-shared ;
-
-M: ratio serialize ( obj -- )
-  "r" write
-  dup numerator serialize
-  denominator serialize ;
-
-M: string serialize ( obj -- )
-  [
-    "s" write
-    dup add-object serialize
-    dup length serialize
-    write 
-  ] serialize-shared ;
-
-M: object serialize ( obj -- )
-  class word-name "Don't know to serialize a " swap append throw ;
-
-M: sbuf serialize ( obj -- )
-  "S" write 
-  dup length serialize
-  [ serialize ] each ;
-
-: serialize-seq ( seq code -- )
-  swap [ 
-    over write
-    dup add-object serialize
-    dup length serialize
-    [ serialize ] each
-  ] serialize-shared drop ;
-
-M: tuple serialize ( obj -- )
-  [
-    "T" write 
-    dup add-object serialize
-    tuple>array serialize 
-  ] serialize-shared ;
-
-M: array serialize ( obj -- )
-  "a" serialize-seq ;
-
-M: vector serialize ( obj -- )
-  "v" serialize-seq ;
-
-M: quotation serialize ( obj -- )
-  "q" serialize-seq ;
-
-M: hashtable serialize ( obj -- )
-  [
-    "h" write
-    dup add-object serialize
-    hash>alist serialize
-  ] serialize-shared ;
-
-M: word serialize ( obj -- )
-  "w" write
-  dup word-name serialize
-  word-vocabulary serialize ;
-
-M: wrapper serialize ( obj -- )
-  "W" write
-  wrapped serialize ;
-
-M: byte-array serialize ( obj -- )
-  [
-    "A" write
-    dup add-object serialize
-    dup length cells dup serialize
-    [
-      2dup alien-unsigned-1 serialize
-    ] repeat    
-  ] serialize-shared drop ;
-
-DEFER: deserialize ( -- obj )
-
-: intern-object ( id obj -- )
-  swap serialized get set-nth ;
-
-: deserialize-false ( -- f )
-  f ;
-
-: deserialize-string ( -- string )
-  deserialize deserialize read [ intern-object ] keep ;
-
-: deserialize-ratio ( -- ratio )
-  deserialize deserialize / ;
-
-: deserialize-complex ( -- complex )
-  deserialize deserialize deserialize rect> [ intern-object ] keep ;
-
-: deserialize-negative-integer ( -- number )
-  4 read be> read be> neg ;
-
-: deserialize-positive-integer ( -- number )
-  4 read be> read be> ;
-
-: deserialize-zero ( -- number )
-  0 ;
-
-: deserialize-float ( -- float )
-  deserialize bits>float ;
-
-: deserialize-word ( -- word )
-  deserialize dup deserialize lookup dup [ nip ] [ "Unknown word" throw ] if ;
-
-: deserialize-wrapper ( -- wrapper )
-  deserialize <wrapper> ;
-
-: deserialize-array ( -- array )
-  deserialize     
-  [ 
-    deserialize 
-    [ deserialize , ] repeat 
-  ] { } make 
-  [ intern-object ] keep ;
-
-: deserialize-vector ( -- array )
-  deserialize     
-  [ 
-    deserialize 
-    [ deserialize , ] repeat 
-  ] V{ } make 
-  [ intern-object ] keep ;
-
-: deserialize-quotation ( -- array )
-  deserialize     
-  [ 
-    deserialize 
-    [ deserialize , ] repeat 
-  ] [ ] make 
-  [ intern-object ] keep ;
-
-: deserialize-hashtable ( -- array )
-  deserialize 
-  deserialize alist>hash    
-  [ intern-object ] keep ;
-
-: deserialize-tuple ( -- array )
-  deserialize 
-  deserialize >tuple
-  [ intern-object ] keep ;
-
-: deserialize-byte-array ( -- byte-array )
-  deserialize 
-  deserialize dup <byte-array> swap 
-  [
-    deserialize pick pick set-alien-unsigned-1
-  ] repeat
-  [ intern-object ] keep ;
-
-: deserialize-unknown ( -- object )
-  deserialize serialized get nth ;
-
-: deserialize ( -- object )
-  read1 ch>string dup
-  H{ { "s" deserialize-string }
-     { "r" deserialize-ratio }
-     { "c" deserialize-complex }
-     { "p" deserialize-positive-integer }
-     { "m" deserialize-negative-integer }
-     { "F" deserialize-float }
-     { "w" deserialize-word }
-     { "W" deserialize-wrapper }
-     { "n" deserialize-false }
-     { "a" deserialize-array }
-     { "v" deserialize-vector }
-     { "q" deserialize-quotation }
-     { "h" deserialize-hashtable }
-     { "T" deserialize-tuple }
-     { "z" deserialize-zero }
-     { "A" deserialize-byte-array }
-     { "o" deserialize-unknown }
-  }
-  hash dup [ "Unknown typecode" throw ] unless nip execute ;
-
-: with-serialized ( quot -- )
-  [ V{ } serialized set call ] with-scope ; inline 
-
diff --git a/libs/serialize/serialize.facts b/libs/serialize/serialize.facts
deleted file mode 100644 (file)
index 79bc4cf..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: help serialize ;
-
-HELP: serialize 
-{ $values { "obj" "object to serialize" } 
-}
-{ $description "Serializes the object to the current output stream. Object references within the structure being serialized are maintained. It must be called from within the scope of a " { $link with-serialized } " call." } 
-{ $examples 
-    { $example "[\n  [ { 1 2 } dup  serialize serialize ] with-serialized\n] string-out\n\n[\n  [ deserialize deserialize ] with-serialized\n] string-in eq?\n => t" }
-}
-{ $see-also deserialize with-serialized } ;
-
-HELP: deserialize 
-{ $values { "obj" "deserialized object" } 
-}
-{ $description "Deserializes an object by reading from the current input stream. Object references within the structure that was originally serialized are maintained. It must be called from within the scope of a " { $link with-serialized } " call." } 
-{ $examples 
-    { $example "[\n  [ { 1 2 } dup  serialize serialize ] with-serialized\n] string-out\n\n[\n  [ deserialize deserialize ] with-serialized\n] string-in eq?\n => t" }
-}
-{ $see-also serialize with-serialized } ;
-
-HELP: with-serialized
-{ $values { "quot" "a quotation" } 
-}
-{ $description "Creates a scope for serialization and deserialization operations. The quotation is called within this scope. The scope is used for maintaining the structure and object references of serialized objects." } 
-{ $examples 
-    { $example "[\n  [ { 1 2 } dup  serialize serialize ] with-serialized\n] string-out\n\n[\n  [ deserialize deserialize ] with-serialized\n] string-in eq?\n => t" }
-}
-{ $see-also serialize deserialize } ;
diff --git a/libs/serialize/tests.factor b/libs/serialize/tests.factor
deleted file mode 100644 (file)
index c783920..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-! 
-USING: test kernel serialize io math alien arrays ;
-IN: temporary
-
-[ f  ] [
-  [ [ f serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ t  ] [
-  [ [ t serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ 0  ] [
-  [ [ 0 serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ -50  ] [
-  [ [ -50 serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ 20  ] [
-  [ [ 20 serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ t  ] [
-  [ [ 5 5 5 ^ ^ serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in 5 5 5 ^ ^ =
-] unit-test
-
-[ t  ] [
-  [ [ 5 5 5 ^ ^ neg serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in 5 5 5 ^ ^ neg =
-] unit-test
-
-[ 5.25  ] [
-  [ [ 5.25 serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ -5.25  ] [
-  [ [ -5.25 serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ C{ 1 2 }  ] [
-  [ [ C{ 1 2 } serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ t ] [
-  [ [ C{ 1 2 } dup serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ f ] [
-  [ [ C{ 1 2 } C{ 1 2 } serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ 1/2  ] [
-  [ [ 1/2 serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ "test"  ] [
-  [ [ "test" serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ t  ] [
-  [ [ "test" dup serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ f  ] [
-  [ [ "test" "test" serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ t ] [
-  [ [ "test" dup serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ { 1 2 "three" }  ] [
-  [ [ { 1 2 "three" }  serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ t ] [
-  [ [ { 1 2 "three" }  dup serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ f ] [
-  [ [ { 1 2 "three" }  { 1 2 "three" } serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ V{ 1 2 "three" }  ] [
-  [ [ V{ 1 2 "three" }  serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ t ] [
-  [ [ V{ 1 2 "three" }  dup serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ f ] [
-  [ [ V{ 1 2 "three" }  V{ 1 2 "three" } serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ [ \ dup dup ]  ] [
-  [ [ [ \ dup dup ]  serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-] unit-test
-
-[ t ] [
-  [ [ [ \ dup dup ]  dup serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ f ] [
-  [ [ [ \ dup dup ] [ \ dup dup ] serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-TUPLE: serialize-test a b ;
-
-[ T{ serialize-test f "a" 2 } ] [
-  [ [ "a" 2 <serialize-test> serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in 
-] unit-test
-
-[ t ] [
-  [ [ "a" 2 <serialize-test> dup serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ f ] [
-  [ [ "a" 2 <serialize-test> "a" 2 <serialize-test> serialize serialize ] with-serialized ] string-out
-  [ [ deserialize deserialize ] with-serialized ] string-in eq?
-] unit-test
-
-[ 50 ] [
-  [ [ 5 <byte-array> 50 over 0 set-alien-unsigned-1 serialize ] with-serialized ] string-out
-  [ [ deserialize ] with-serialized ] string-in
-  0 alien-unsigned-1
-] unit-test 
diff --git a/libs/shuffle/load.factor b/libs/shuffle/load.factor
deleted file mode 100644 (file)
index 055c8cc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USE: kernel
-
-PROVIDE: libs/shuffle
-{ +files+ {
-    "shuffle.factor"
-} }
-{ +tests+ { "test/shuffle.factor" } } ;
diff --git a/libs/shuffle/shuffle.factor b/libs/shuffle/shuffle.factor
deleted file mode 100644 (file)
index 2af198b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-USING: kernel sequences ;
-IN: shuffle
-
-: reach ( a b c d -- a b c d a )
-    >r pick r> swap ; inline
-
-: roll ( a b c d -- b c d a )
-    >r rot r> swap ; inline
-
-: -roll ( a b c d -- d a b c )
-    -rot >r >r swap r> r> ; inline
-
-: 2over ( a b c -- a b c a b )
-    pick pick ; inline
-
-: 2pick ( a b c d -- a b c d a b )
-    reach reach ; inline
-
-: nipd ( a b c -- b c )
-    rot drop ; inline
-
-: 3nip ( a b c d -- d )
-    2nip nip ; inline
-
-: keepd ( obj obj quot -- obj )
-    pick >r call r> ; inline
-
-: with2 ( obj obj quot elt -- obj obj quot )
-    >r 3dup r> -rot >r >r swap >r swap call r> r> r> ; inline
-
-: map-with2 ( obj obj list quot -- newseq )
-    swap [ with2 roll ] map 3nip ; inline
-
-: each-with2 ( obj obj list quot -- )
-    swap [ with2 roll ] map 3drop ;
-
diff --git a/libs/shuffle/test/shuffle.factor b/libs/shuffle/test/shuffle.factor
deleted file mode 100644 (file)
index a16a1d8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: shuffle kernel math test ;
-
-[ 2 3 4 1 ] [ 1 2 3 4 roll ] unit-test
-[ 1 2 3 4 ] [ 2 3 4 1 -roll ] unit-test
-[ 1 2 3 4 1 ] [ 1 2 3 4 reach ] unit-test
-[ { 910 911 912 } ] [ 10 900 3 [ + + ] map-with2 ] unit-test
-[ 8 ] [ 5 6 7 8 3nip ] unit-test
diff --git a/libs/slate/load.factor b/libs/slate/load.factor
deleted file mode 100644 (file)
index 57d0a3e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-PROVIDE: libs/slate { +files+ { "slate.factor" } } ;
\ No newline at end of file
diff --git a/libs/slate/slate.factor b/libs/slate/slate.factor
deleted file mode 100644 (file)
index b959f11..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-REQUIRES: libs/vars ;
-USING: kernel namespaces gadgets vars ;
-IN: slate
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: slate action ns ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-C: slate ( -- slate )
-dup delegate>gadget
-[ ] over set-slate-action
-H{ } clone over set-slate-ns ;
-
-M: slate pref-dim* ( slate -- ) drop { 100 100 0 } ;
-
-M: slate draw-gadget* ( slate -- ) dup slate-ns swap slate-action bind ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-VAR: slate
-
-: action> ( -- quot ) slate> slate-action ;
-
-: >action ( quot -- ) slate> set-slate-action ;
-
-: .slate ( -- ) slate> relayout-1 ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: slate-window ( -- ) <slate> dup >slate "Slate" open-titled-window ;
diff --git a/libs/splay-trees/load.factor b/libs/splay-trees/load.factor
deleted file mode 100644 (file)
index ef59ced..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-PROVIDE: libs/splay-trees
-{ +files+ { "splay-trees.factor" } }
-{ +tests+ { "tests.factor" } } ;
diff --git a/libs/splay-trees/splay-trees.factor b/libs/splay-trees/splay-trees.factor
deleted file mode 100644 (file)
index 44d31d3..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-! Copyright (c) 2005 Mackenzie Straight.
-! See http://factor.sf.net/license.txt for BSD license.
-IN: splay-trees
-USING: kernel math sequences ;
-
-TUPLE: splay-tree r ;
-TUPLE: splay-node v k l r ;
-
-C: splay-tree ;
-
-: rotate-right ( node -- node )
-    dup splay-node-l
-    [ splay-node-r swap set-splay-node-l ] 2keep
-    [ set-splay-node-r ] keep ;
-
-: rotate-left ( node -- node )
-    dup splay-node-r
-    [ splay-node-l swap set-splay-node-r ] 2keep
-    [ set-splay-node-l ] keep ;
-
-: link-right ( left right key node -- left right key node )
-    swap >r [ swap set-splay-node-l ] 2keep
-    nip dup splay-node-l r> swap ;
-
-: link-left ( left right key node -- left right key node )
-    swap >r rot [ set-splay-node-r ] 2keep
-    drop dup splay-node-r swapd r> swap ;
-
-: cmp ( key node -- obj node -1/0/1 )
-    2dup splay-node-k <=> ;
-
-: lcmp ( key node -- obj node -1/0/1 ) 
-    2dup splay-node-l splay-node-k <=> ;
-
-: rcmp ( key node -- obj node -1/0/1 ) 
-    2dup splay-node-r splay-node-k <=> ;
-
-DEFER: (splay)
-
-: splay-left ( left right key node -- left right key node )
-    dup splay-node-l [
-        lcmp 0 < [ rotate-right ] when
-        dup splay-node-l [ link-right (splay) ] when
-    ] when ;
-
-: splay-right ( left right key node -- left right key node )
-    dup splay-node-r [
-        rcmp 0 > [ rotate-left ] when
-        dup splay-node-r [ 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 ;
-
-: assemble ( head left right node -- root )
-    [ splay-node-r swap set-splay-node-l ] keep
-    [ splay-node-l swap set-splay-node-r ] keep
-    [ swap splay-node-l swap set-splay-node-r ] 2keep
-    [ swap splay-node-r swap set-splay-node-l ] keep ;
-
-: splay-at ( key node -- node )
-    >r >r T{ splay-node } dup dup r> r> (splay) nip assemble ;
-
-: splay ( key tree -- )
-    [ splay-tree-r splay-at ] keep set-splay-tree-r ;
-
-: splay-split ( key tree -- node node )
-    2dup splay splay-tree-r cmp 0 < [
-        nip dup splay-node-l swap f over set-splay-node-l
-    ] [
-        nip dup splay-node-r swap f over set-splay-node-r swap
-    ] if ;
-
-: (get-splay) ( key tree -- node )
-    2dup splay splay-tree-r cmp 0 = [ nip ] [ 2drop f ] if ;
-
-: get-largest ( node -- node )
-    dup [ dup splay-node-r [ nip get-largest ] when* ] when ;
-
-: splay-largest
-    dup [ dup get-largest splay-node-k swap splay-at ] when ;
-
-: splay-join ( n2 n1 -- node )
-    splay-largest [ [ set-splay-node-r ] keep ] [ drop f ] if* ;
-
-: (remove-splay) ( key tree -- )
-    tuck (get-splay) [
-        dup splay-node-r swap splay-node-l splay-join
-        swap set-splay-tree-r
-    ] [ drop ] if* ;
-
-: (set-splay) ( value key tree -- )
-    2dup (get-splay) [ 2nip set-splay-node-v ] [
-       2dup splay-split rot >r <splay-node> r> set-splay-tree-r
-    ] if* ;
-
-: new-root ( value key tree -- )
-    >r f f <splay-node> r> set-splay-tree-r ;
-
-: set-splay ( value key tree -- )
-    dup splay-tree-r [ (set-splay) ] [ new-root ] if ;
-
-: get-splay ( key tree -- value )
-    dup splay-tree-r [
-        (get-splay) dup [ splay-node-v ] when
-    ] [
-        2drop f
-    ] if ;
-
-: remove-splay ( key tree -- )
-    dup splay-tree-r [ (remove-splay) ] [ 2drop ] if ;
diff --git a/libs/splay-trees/tests.factor b/libs/splay-trees/tests.factor
deleted file mode 100644 (file)
index 38c5d79..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-USING: splay-trees namespaces sequences kernel namespaces words ;
-
-<splay-tree> "foo" set
-all-words [ dup word-name "foo" get set-splay ] each
-all-words [ word-name "foo" get get-splay drop ] each
diff --git a/libs/sql/execute.factor b/libs/sql/execute.factor
deleted file mode 100644 (file)
index 38bf53f..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-USING: errors generic kernel namespaces sql:utils ;\r
-IN: sql\r
-\r
-G: execute-sql* ( db string -- ) 1 standard-combination ; \r
-G: query-sql* ( db string -- seq ) 1 standard-combination ; \r
-\r
-: execute-sql ( string -- ) >r db get r> execute-sql* ;\r
-: query-sql ( string -- ) >r db get r> query-sql* ;\r
-\r
-G: create-table* ( db tuple -- ) 1 standard-combination ;\r
-G: drop-table* ( db tuple -- ) 1 standard-combination ;\r
-G: insert-tuple* ( db tuple -- ) 1 standard-combination ;\r
-G: delete-tuple* ( db tuple -- ) 1 standard-combination ;\r
-G: update-tuple* ( db tuple -- ) 1 standard-combination ;\r
-G: select-tuple* ( db tuple -- ) 1 standard-combination ;\r
-\r
-TUPLE: persistent-error message ;\r
-\r
-: create-table ( tuple -- ) >r db get r> create-table* ;\r
-: drop-table ( tuple -- ) >r db get r> drop-table* ;\r
-: insert-tuple ( tuple -- ) \r
-    dup bottom-delegate persistent?\r
-    [\r
-        "tuple is persistent, call update not insert"\r
-        <persistent-error> throw\r
-    ] when\r
-    >r db get r> insert-tuple* ;\r
-\r
-: delete-tuple ( tuple -- )\r
-    dup bottom-delegate persistent?\r
-    [\r
-        "tuple is not persistent, cannot delete"\r
-        <persistent-error> throw\r
-    ] unless\r
-    >r db get r> delete-tuple* ;\r
-\r
-: update-tuple ( tuple -- )\r
-    dup bottom-delegate persistent?\r
-    [\r
-        "tuple is not persistent, call insert not update"\r
-        <persistent-error> throw\r
-    ] unless\r
-    >r db get r> update-tuple* ;\r
-\r
-: select-tuple ( tuple -- )\r
-    >r db get r> select-tuple* ;\r
-\r
diff --git a/libs/sql/load.factor b/libs/sql/load.factor
deleted file mode 100644 (file)
index 847cb54..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-PROVIDE: libs/sql\r
-{ +files+ {\r
-    "sql.factor"\r
-    "utils.factor"\r
-    "simple.factor"\r
-    "mappings.factor"\r
-    "execute.factor"\r
-\r
-    "sqlite/libsqlite.factor"\r
-    "sqlite/sqlite.factor"\r
-    "sqlite/simple.factor"\r
-    "sqlite/execute.factor"\r
-    "postgresql/libpq.factor"\r
-    "postgresql/postgresql.factor"\r
-    "postgresql/simple.factor"\r
-    "postgresql/execute.factor"\r
-\r
-    "tupledb.factor"\r
-\r
-    "thewebsite.factor"\r
-} }\r
-{ +tests+ {\r
-    "test/data.factor"\r
-    "test/insert.factor"\r
-    "test/util.factor"\r
-} } ;\r
-\r
diff --git a/libs/sql/mappings.factor b/libs/sql/mappings.factor
deleted file mode 100644 (file)
index e648a2b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-IN: sql\r
diff --git a/libs/sql/postgresql/execute.factor b/libs/sql/postgresql/execute.factor
deleted file mode 100644 (file)
index cff5fcb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-IN: postgresql\r
diff --git a/libs/sql/postgresql/libpq.factor b/libs/sql/postgresql/libpq.factor
deleted file mode 100644 (file)
index 3786d1d..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-! See http://factor.sf.net/license.txt for BSD license.
-
-! adapted from libpq-fe.h version 7.4.7
-! tested on debian linux with postgresql 7.4.7
-! Updated to 8.1
-
-IN: postgresql
-USING: alien ;
-
-
-! ConnSatusType
-: CONNECTION_OK                                        HEX: 0 ; inline
-: CONNECTION_BAD                                       HEX: 1 ; inline
-: CONNECTION_STARTED                           HEX: 2 ; inline
-: CONNECTION_MADE                                      HEX: 3 ; inline
-: CONNECTION_AWAITING_RESPONSE         HEX: 4 ; inline
-: CONNECTION_AUTH_OK                           HEX: 5 ; inline
-: CONNECTION_SETENV                                    HEX: 6 ; inline
-: CONNECTION_SSL_STARTUP                       HEX: 7 ; inline
-: CONNECTION_NEEDED                                    HEX: 8 ; inline
-
-! PostgresPollingStatusType
-: PGRES_POLLING_FAILED                                 HEX: 0 ; inline
-: PGRES_POLLING_READING                        HEX: 1 ; inline
-: PGRES_POLLING_WRITING                        HEX: 2 ; inline
-: PGRES_POLLING_OK                                     HEX: 3 ; inline
-: PGRES_POLLING_ACTIVE                                 HEX: 4 ; inline
-
-! ExecStatusType;
-: PGRES_EMPTY_QUERY                            HEX: 0 ; inline
-: PGRES_COMMAND_OK                                     HEX: 1 ; inline
-: PGRES_TUPLES_OK                                      HEX: 2 ; inline
-: PGRES_COPY_OUT                                       HEX: 3 ; inline
-: PGRES_COPY_IN                                                HEX: 4 ; inline
-: PGRES_BAD_RESPONSE                           HEX: 5 ; inline
-: PGRES_NONFATAL_ERROR                         HEX: 6 ; inline
-: PGRES_FATAL_ERROR                                    HEX: 7 ; inline
-
-! PGTransactionStatusType;
-: PQTRANS_IDLE                                         HEX: 0 ; inline
-: PQTRANS_ACTIVE                                       HEX: 1 ; inline
-: PQTRANS_INTRANS                                      HEX: 2 ; inline
-: PQTRANS_INERROR                                      HEX: 3 ; inline
-: PQTRANS_UNKNOWN                                      HEX: 4 ; inline
-
-! PGVerbosity;
-: PQERRORS_TERSE                                       HEX: 0 ; inline
-: PQERRORS_DEFAULT                                     HEX: 1 ; inline
-: PQERRORS_VERBOSE                                     HEX: 2 ; inline
-
-
-TYPEDEF: int size_t
-TYPEDEF: int ConnStatusType
-TYPEDEF: int ExecStatusType 
-TYPEDEF: int PostgresPollingStatusType
-TYPEDEF: int PGTransactionStatusType 
-TYPEDEF: int PGVerbosity 
-
-TYPEDEF: void* PGconn*
-TYPEDEF: void* PGresult*
-TYPEDEF: void* PGcancel*
-TYPEDEF: uint Oid
-TYPEDEF: uint* Oid*
-TYPEDEF: char pqbool
-TYPEDEF: void* PQconninfoOption*
-TYPEDEF: void* PGnotify*
-TYPEDEF: void* PQArgBlock*
-TYPEDEF: void* PQprintOpt*
-TYPEDEF: void* FILE*
-TYPEDEF: void* SSL*
-
-LIBRARY: postgresql
-
-
-! Exported functions of libpq
-! ===  in fe-connect.c ===
-
-! make a new client connection to the backend
-! Asynchronous (non-blocking)
-FUNCTION: PGconn* PQconnectStart ( char* 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 ) ;
-
-: PQsetdb ( M_PGHOST M_PGPORT M_PGOPT M_PGTTY M_DBNAME -- PGconn* )
-       f f PQsetdbLogin ;
-
-! close the current connection and free the PGconn data structure
-FUNCTION: void PQfinish ( PGconn* conn ) ;
-
-! get info about connection options known to PQconnectdb
-FUNCTION: PQconninfoOption* PQconndefaults ( ) ;
-
-! free the data structure returned by PQconndefaults()
-FUNCTION: void PQconninfoFree ( PQconninfoOption* connOptions ) ;
-
-! 
-! close the current connection and restablish a new one with the same
-! parameters
-!
-! Asynchronous (non-blocking)
-FUNCTION: int  PQresetStart ( PGconn* conn ) ;
-FUNCTION: PostgresPollingStatusType PQresetPoll ( PGconn* conn ) ;
-
-! Synchronous (blocking)
-FUNCTION: void PQreset ( PGconn* conn ) ;
-
-! request a cancel structure
-FUNCTION: PGcancel* PQgetCancel ( PGconn* conn ) ;
-
-! free a cancel structure
-FUNCTION: void PQfreeCancel ( PGcancel* cancel ) ;
-
-! issue a cancel request
-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: ConnStatusType PQstatus ( PGconn* conn ) ;
-FUNCTION: PGTransactionStatusType PQtransactionStatus ( PGconn* conn ) ;
-FUNCTION: char* PQparameterStatus ( PGconn* conn,
-                                 char* paramName ) ;
-FUNCTION: int  PQprotocolVersion ( PGconn* conn ) ;
-FUNCTION: int  PQServerVersion ( PGconn* conn ) ;
-FUNCTION: char* 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 ) ;
-
-! May not be compiled into libpq
-! Get the SSL structure associated with a connection
-FUNCTION: SSL* PQgetssl ( PGconn* conn ) ;
-
-! Tell libpq whether it needs to initialize OpenSSL
-FUNCTION: void PQinitSSL ( int do_init ) ;
-
-! Set verbosity for PQerrorMessage and PQresultErrorMessage
-FUNCTION: PGVerbosity PQsetErrorVerbosity ( PGconn* conn,
-       PGVerbosity verbosity ) ;
-
-! Enable/disable tracing
-FUNCTION: void PQtrace ( PGconn* conn, FILE* debug_port ) ;
-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);
-! ALIAS: void* PQnoticeReceiver
-! ALIAS: void* PQnoticeProcessor
-
-! Override default notice handling routines
-! FUNCTION: PQnoticeReceiver PQsetNoticeReceiver ( PGconn* conn,
-                                       ! PQnoticeReceiver proc,
-                                       ! void* arg ) ;
-! FUNCTION: PQnoticeProcessor PQsetNoticeProcessor ( PGconn* conn,
-                                       ! PQnoticeProcessor proc,
-                                       ! void* arg ) ;
-! END BROKEN
-
-! === in fe-exec.c ===
-
-! Simple synchronous query
-FUNCTION: PGresult* PQexec ( PGconn* conn, char* query ) ;
-FUNCTION: PGresult* PQexecParams ( PGconn* conn,
-                        char* command,
-                        int nParams,
-                        Oid* paramTypes,
-                        char** paramValues,
-                        int* paramLengths,
-                        int* paramFormats,
-                        int resultFormat ) ;
-FUNCTION: PGresult* PQprepare ( PGconn* conn, char* stmtName,
-        char* query, int nParams,
-        Oid* paramTypes ) ;
-FUNCTION: PGresult* PQexecPrepared ( PGconn* conn,
-                        char* stmtName,
-                        int nParams,
-                        char** paramValues,
-                        int* paramLengths,
-                        int* paramFormats,
-                        int resultFormat ) ;
-
-! Interface for multiple-result or asynchronous queries
-FUNCTION: int PQsendQuery ( PGconn* conn, char* query ) ;
-FUNCTION: int PQsendQueryParams ( PGconn* conn,
-                                 char* command,
-                                 int nParams,
-                                 Oid* paramTypes,
-                                 char** paramValues,
-                                 int* paramLengths,
-                                 int* paramFormats,
-                                 int resultFormat ) ;
-FUNCTION: PGresult* PQsendPrepare ( PGconn* conn, char* stmtName,
-            char* query, int nParams,
-            Oid* paramTypes ) ;
-FUNCTION: int PQsendQueryPrepared ( PGconn* conn,
-                                 char* stmtName,
-                                 int nParams,
-                                 char** paramValues,
-                                 int *paramLengths,
-                                 int *paramFormats,
-                                 int resultFormat ) ;
-FUNCTION: PGresult* PQgetResult ( PGconn* conn ) ;
-
-! Routines for managing an asynchronous query
-FUNCTION: int  PQisBusy ( PGconn* conn ) ;
-FUNCTION: int  PQconsumeInput ( PGconn* conn ) ;
-
-! LISTEN/NOTIFY support
-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 ) ;
-
-! 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  PQendcopy ( PGconn* conn ) ;
-
-! Set blocking/nonblocking connection to the backend
-FUNCTION: int  PQsetnonblocking ( PGconn* conn, int arg ) ;
-FUNCTION: int  PQisnonblocking ( PGconn* conn ) ;
-
-! Force the write buffer to be written (or at least try)
-FUNCTION: int  PQflush ( PGconn* conn ) ;
-
-! 
-! * "Fast path" interface --- not really recommended for application
-! * use
-!
-FUNCTION: PGresult* PQfn ( PGconn* conn,
-        int fnid,
-        int* result_buf,
-        int* result_len,
-        int result_is_int,
-        PQArgBlock* args,
-        int nargs ) ;
-
-! 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: 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: 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: Oid  PQoidValue ( PGresult* res ) ;
-FUNCTION: char* PQcmdTuples ( PGresult* res ) ;
-FUNCTION: char* 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 ) ;
-
-! Delete a PGresult
-FUNCTION: void PQclear ( PGresult* res ) ;
-
-! For freeing other alloc'd results, such as PGnotify structs
-FUNCTION: void PQfreemem ( void* ptr ) ;
-
-! Exists for backward compatibility.
-: PQfreeNotify PQfreemem ;
-
-!
-! Make an empty PGresult with given status (some apps find this
-! useful). If conn is not NULL and status indicates an error, the
-! conn's errorMessage is copied.
-!
-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,
-                                    int* error ) ;
-FUNCTION: uchar* PQescapeByteaConn ( PGconn* conn,
-                                    char* from, size_t length,
-                                    size_t* to_length ) ;
-FUNCTION: uchar* PQunescapeBytea ( uchar* 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,
-                         size_t* bytealen ) ;
-
-! === in fe-print.c ===
-
-FUNCTION: void PQprint ( FILE* fout, PGresult* res, PQprintOpt* ps ) ;
-
-! really old printing routines
-FUNCTION: void PQdisplayTuples ( PGresult* res,
-                               FILE* fp,               
-                               int fillAlign,
-                               char* fieldSep,
-                               int printHeader,
-                               int quiet ) ;
-
-FUNCTION: void PQprintTuples ( PGresult* res,
-                         FILE* fout,           
-                         int printAttName,
-                         int terseOutput,      
-                         int width ) ; 
-                                               
-! === in fe-lobj.c ===
-
-! 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_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 ) ;
-
-! === in fe-misc.c ===
-
-! Determine length of multibyte encoded char at *s
-FUNCTION: int  PQmblen ( uchar* s, int encoding ) ;
-
-! Determine display length of multibyte encoded char at *s
-FUNCTION: int  PQdsplen ( uchar* s, int encoding ) ;
-
-! Get encoding id from environment variable PGCLIENTENCODING
-FUNCTION: int  PQenv2encoding ( ) ;
-
diff --git a/libs/sql/postgresql/postgresql.factor b/libs/sql/postgresql/postgresql.factor
deleted file mode 100644 (file)
index 54e73cc..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-! See http://factor.sf.net/license.txt for BSD license.
-
-! adapted from libpq-fe.h version 7.4.7
-! tested on debian linux with postgresql 7.4.7
-
-IN: postgresql
-USING: kernel alien errors io prettyprint sequences namespaces arrays math sql ;
-
-SYMBOL: query-res
-
-: connect-postgres ( host port pgopts pgtty db user pass -- conn )
-    PQsetdbLogin
-    dup PQstatus zero? [ "couldn't connect to database" throw ] unless ;
-
-: with-postgres ( host port pgopts pgtty db user pass quot -- )
-    [ >r connect-postgres db set r>
-    [ db get PQfinish ] cleanup ] with-scope ; inline
-
-: with-postgres-catch ( host port pgopts pgtty db user pass quot -- )
-    [ with-postgres ] catch [ "caught: " write print ] when* ;
-
-: postgres-error ( ret -- ret )
-    dup zero? [ PQresultErrorMessage throw ] when ;
-
-: (do-query) ( PGconn query -- PGresult* )
-    ! For queries that do not return rows, PQexec() returns PGRES_COMMAND_OK
-    ! For queries that return rows, PQexec() returns PGRES_TUPLES_OK
-    PQexec
-    dup PQresultStatus PGRES_COMMAND_OK =
-    over PQresultStatus PGRES_TUPLES_OK =
-    or [
-        [ PQresultErrorMessage CHAR: \n swap remove ] keep PQclear throw
-    ] unless ;
-
-: (do-command) ( PGconn query -- PGresult* )
-    [ (do-query) ] catch
-    [
-        swap
-        "non-fatal error: " print
-        "\tQuery: " write "'" write write "'" print
-        "\t" write print
-    ] when* drop ;
-
-: do-command ( str -- )
-    unit \ (do-command) add db get swap call ;
-
-: prepare ( str quot word -- conn quot )
-    rot unit swap append swap append db get swap ;
-
-: do-query ( str quot -- )
-    [ (do-query) query-res set ] prepare catch
-    [ rethrow ] [ query-res get PQclear ] if* ;
-
-: result>seq ( -- seq )
-    query-res get [ PQnfields ] keep PQntuples
-    [ swap [ query-res get -rot PQgetvalue ] map-with ] map-with ;
-
-: print-table ( seq -- )
-    [ [ write bl ] each "\n" write ] each ;
-
diff --git a/libs/sql/postgresql/simple.factor b/libs/sql/postgresql/simple.factor
deleted file mode 100644 (file)
index cff5fcb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-IN: postgresql\r
diff --git a/libs/sql/simple-bind.factor b/libs/sql/simple-bind.factor
deleted file mode 100644 (file)
index 124fb86..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-USING: kernel ;\r
-IN: sql\r
-\r
-\r
diff --git a/libs/sql/simple.factor b/libs/sql/simple.factor
deleted file mode 100644 (file)
index 5ab99d2..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-USING: errors generic kernel namespaces prettyprint\r
-sequences sql:utils ;\r
-IN: sql\r
-\r
-G: create-sql* ( db tuple -- string ) 1 standard-combination ;\r
-G: drop-sql* ( db tuple -- string ) 1 standard-combination ;\r
-G: insert-sql* ( db tuple -- string ) 1 standard-combination ;\r
-G: delete-sql* ( db tuple -- string ) 1 standard-combination ;\r
-G: update-sql* ( db tuple -- string ) 1 standard-combination ;\r
-G: select-sql* ( db tuple -- string ) 1 standard-combination ;\r
-\r
-: create-sql ( tuple -- string ) >r db get r> create-sql* ;\r
-: drop-sql ( tuple -- string ) >r db get r> drop-sql* ;\r
-: insert-sql ( tuple -- string ) >r db get r> insert-sql* ;\r
-: delete-sql ( tuple -- string ) >r db get r> delete-sql* ;\r
-: update-sql ( tuple -- string ) >r db get r> update-sql* ;\r
-: select-sql ( tuple -- string ) >r db get r> select-sql* ;\r
-\r
-! M: connection create-sql* ( db tuple -- string )\r
-    ! nip [\r
-        ! "create table " %\r
-        ! dup class unparse % "(" %\r
-        ! tuple>mapping%\r
-        ! ");" %\r
-    ! ] "" make ;\r
-\r
-! M: connection drop-sql* ( db tuple -- string )\r
-    ! nip [ "drop table " % tuple>sql-name % ";" % ] "" make ;\r
-! \r
-! M: connection insert-sql* ( db tuple -- string )\r
-    ! nip [\r
-        ! "insert into " %\r
-        ! dup tuple>sql-name %\r
-        ! ! " (" % fulltuple>insert-all-parts dup first ", " join %\r
-        ! ") values(" %\r
-        ! second [ escape-sql enquote ] map ", " join %\r
-        ! ");" %\r
-    ! ] "" make ;\r
-! \r
-! M: connection delete-sql* ( db tuples -- string )\r
-    ! nip [\r
-        ! ! "delete from table " % unparse % ";" %\r
-    ! ] "" make ;\r
-! \r
-! M: connection update-sql* ( db tuples -- string )\r
-    ! nip [\r
-    ! ] "" make ;\r
-! \r
-! M: connection select-sql* ( db tuples -- string )\r
-    ! nip [\r
-    ! ] "" make ;\r
-\r
-\r
diff --git a/libs/sql/sql.factor b/libs/sql/sql.factor
deleted file mode 100644 (file)
index e47c54e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-USING: kernel namespaces ;\r
-IN: sql\r
-\r
-SYMBOL: db\r
-TUPLE: connection handle ;\r
-TUPLE: persistent id ;\r
-\r
-! TESTING\r
-"handle" <connection> db set-global\r
-\r
-\r
diff --git a/libs/sql/sqlite/execute.factor b/libs/sql/sqlite/execute.factor
deleted file mode 100644 (file)
index 3b02769..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-USING: kernel math namespaces sql sql:utils ;\r
-IN: sqlite\r
-\r
-M: sqlite execute-sql* ( db string -- )\r
-    >r connection-handle r>\r
-    sqlite-prepare dup [ drop ] sqlite-each sqlite-finalize ;\r
-\r
-M: sqlite create-table* ( db tuple -- )\r
-    create-sql execute-sql* ;\r
-\r
-M: sqlite drop-table* ( db tuple -- )\r
-    drop-sql execute-sql* ;\r
-\r
-M: sqlite insert-tuple* ( db tuple -- )\r
-    2dup insert-sql* >r >r connection-handle r> over r>\r
-    sqlite-prepare over bind-for-insert\r
-    [ drop ] sqlite-each sqlite-finalize\r
-    >r sqlite-last-insert-rowid number>string r> make-persistent ;\r
-\r
-M: sqlite delete-tuple* ( db tuple -- )\r
-    2dup delete-sql* >r >r connection-handle r> r>\r
-    swapd sqlite-prepare over bind-for-delete\r
-    [ drop ] sqlite-each sqlite-finalize remove-bottom-delegate ;\r
-\r
-M: sqlite update-tuple* ( db tuple -- )\r
-    2dup update-sql* >r >r connection-handle r> r>\r
-    swapd sqlite-prepare swap bind-for-update\r
-    [ drop ] sqlite-each sqlite-finalize drop ;\r
-\r
-M: sqlite select-tuple* ( db tuple -- )\r
-    2dup select-sql* >r >r connection-handle r> r>\r
-    swapd sqlite-prepare over bind-for-select\r
-    [ break [ break pick restore-tuple , ] sqlite-each ] { } make\r
-    [ sqlite-finalize ] keep ;\r
diff --git a/libs/sql/sqlite/libsqlite.factor b/libs/sql/sqlite/libsqlite.factor
deleted file mode 100644 (file)
index 75f3cd6..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-! Copyright (C) 2005 Chris Double, Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! An interface to the sqlite database. Tested against sqlite v3.1.3.
-! Remeber to pass the following to factor:
-!  -libraries:sqlite=libsqlite3.so
-!
-! Not all functions have been wrapped yet. Only those directly involving
-! executing SQL calls and obtaining results.
-!
-IN: libsqlite
-USING: alien compiler errors kernel math namespaces sequences strings ;
-
-! Return values from sqlite functions
-: SQLITE_OK           0   ; inline ! Successful result
-: SQLITE_ERROR        1   ; inline ! SQL error or missing database
-: SQLITE_INTERNAL     2   ; inline ! An internal logic error in SQLite 
-: SQLITE_PERM         3   ; inline ! Access permission denied 
-: SQLITE_ABORT        4   ; inline ! Callback routine requested an abort 
-: SQLITE_BUSY         5   ; inline ! The database file is locked 
-: SQLITE_LOCKED       6   ; inline ! A table in the database is locked 
-: SQLITE_NOMEM        7   ; inline ! A malloc() failed 
-: SQLITE_READONLY     8   ; inline ! Attempt to write a readonly database 
-: SQLITE_INTERRUPT    9   ; inline ! Operation terminated by sqlite_interrupt() 
-: SQLITE_IOERR       10   ; inline ! Some kind of disk I/O error occurred 
-: SQLITE_CORRUPT     11   ; inline ! The database disk image is malformed 
-: SQLITE_NOTFOUND    12   ; inline ! (Internal Only) Table or record not found 
-: SQLITE_FULL        13   ; inline ! Insertion failed because database is full 
-: SQLITE_CANTOPEN    14   ; inline ! Unable to open the database file 
-: SQLITE_PROTOCOL    15   ; inline ! Database lock protocol error 
-: SQLITE_EMPTY       16   ; inline ! (Internal Only) Database table is empty 
-: SQLITE_SCHEMA      17   ; inline ! The database schema changed 
-: SQLITE_TOOBIG      18   ; inline ! Too much data for one row of a table 
-: SQLITE_CONSTRAINT  19   ; inline ! Abort due to contraint violation 
-: SQLITE_MISMATCH    20   ; inline ! Data type mismatch 
-: SQLITE_MISUSE      21   ; inline ! Library used incorrectly 
-: SQLITE_NOLFS       22   ; inline ! Uses OS features not supported on host 
-: SQLITE_AUTH        23   ; inline ! Authorization denied 
-: SQLITE_FORMAT      24   ; inline ! Auxiliary database format error
-: SQLITE_RANGE       25   ; inline ! 2nd parameter to sqlite3_bind out of range
-: SQLITE_NOTADB      26   ; inline ! File opened that is not a database file
-
-: sqlite-error-messages ( -- seq ) {
-    "Successful result"
-    "SQL error or missing database"
-    "An internal logic error in SQLite"
-    "Access permission denied"
-    "Callback routine requested an abort"
-    "The database file is locked"
-    "A table in the database is locked"
-    "A malloc() failed"
-    "Attempt to write a readonly database"
-    "Operation terminated by sqlite_interrupt()"
-    "Some kind of disk I/O error occurred"
-    "The database disk image is malformed"
-    "(Internal Only) Table or record not found"
-    "Insertion failed because database is full"
-    "Unable to open the database file"
-    "Database lock protocol error"
-    "(Internal Only) Database table is empty"
-    "The database schema changed"
-    "Too much data for one row of a table"
-    "Abort due to contraint violation"
-    "Data type mismatch"
-    "Library used incorrectly"
-    "Uses OS features not supported on host"
-    "Authorization denied"
-    "Auxiliary database format error"
-    "2nd parameter to sqlite3_bind out of range"
-    "File opened that is not a database file"
-} ;
-
-: SQLITE_ROW         100  ; inline ! sqlite_step() has another row ready 
-: SQLITE_DONE        101  ; inline ! sqlite_step() has finished executing 
-
-! Return values from the sqlite3_column_type function
-: SQLITE_INTEGER     1 ; inline
-: SQLITE_FLOAT       2 ; inline
-: SQLITE_TEXT        3 ; inline
-: SQLITE_BLOB        4 ; inline
-: SQLITE_NULL        5 ; inline
-
-! Values for the 'destructor' parameter of the 'bind' routines. 
-: SQLITE_STATIC      0  ; inline
-: SQLITE_TRANSIENT   -1 ; inline
-
-TYPEDEF: void sqlite3
-TYPEDEF: void sqlite3_stmt
-
-LIBRARY: sqlite
-FUNCTION: int sqlite3_open ( char* filename, void* ppDb ) ;
-FUNCTION: int sqlite3_close ( sqlite3* pDb ) ;
-FUNCTION: int sqlite3_prepare ( sqlite3* pDb, char* 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 ) ;
-FUNCTION: int sqlite3_last_insert_rowid ( sqlite3* pStmt ) ;
-FUNCTION: int sqlite3_bind_blob ( sqlite3_stmt* pStmt, int index, void* ptr, int len, int destructor ) ;
-FUNCTION: int sqlite3_bind_int ( sqlite3_stmt* pStmt, int index, int n ) ;
-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_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: int sqlite3_column_int ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: int sqlite3_column_name ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: char* sqlite3_column_text ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: int sqlite3_column_type ( sqlite3_stmt* pStmt, int col ) ;
-
diff --git a/libs/sql/sqlite/load.factor b/libs/sql/sqlite/load.factor
deleted file mode 100644 (file)
index 9818e3b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-PROVIDE: libs/sqlite
-{ +files+ {
-       "libsqlite.factor"
-       "sqlite.factor"
-       "sqlite.facts"
-       "tuple-db.factor"
-       "tuple-db.facts"
-} }
-{ +tests+ {
-       "tuple-db-tests.factor"
-} } ;
diff --git a/libs/sql/sqlite/simple.factor b/libs/sql/sqlite/simple.factor
deleted file mode 100644 (file)
index eed89fc..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-USING: generic kernel namespaces prettyprint sequences sql sql:utils ;\r
-IN: sqlite\r
-\r
-TUPLE: sqlite ;\r
-C: sqlite ( path -- db )\r
-    >r sqlite-open <connection> r>\r
-    [ set-delegate ] keep ;\r
-\r
-M: sqlite create-sql* ( db tuple -- string )\r
-    nip [\r
-        "create table " % dup tuple>sql-name %\r
-        " (" % full-tuple>alist "id" alist-remove-key\r
-        [ first sanitize ] map ", " join %\r
-        ");" %\r
-    ] "" make ;\r
-\r
-M: sqlite drop-sql* ( db tuple -- string )\r
-    nip [ "drop table " % tuple>sql-name % ";" % ] "" make \r
-\r
-M: sqlite insert-sql* ( db tuple -- string )\r
-    #! Insert and fill in the ID column\r
-    nip [\r
-        "insert into " %\r
-        dup tuple>sql-name %\r
-        " (" % tuple>insert-alist\r
-        [ [ first ] map ", " join % ] keep\r
-        ") values(" %\r
-        [ first field>sqlite-bind-name ] map ", " join %\r
-        ");" %\r
-    ] "" make ;\r
-\r
-M: sqlite delete-sql* ( db tuple -- string )\r
-    #! Delete based on the ID column\r
-    nip [\r
-        "delete from " % tuple>sql-name %\r
-        " where ROWID=:rowid;" %\r
-    ] "" make ;\r
-\r
-M: sqlite update-sql* ( db tuple -- string )\r
-    #! Update based on the ID column\r
-    nip [\r
-        "update " % dup tuple>sql-name%\r
-        " set " % full-tuple>alist "id" alist-remove-key\r
-        [\r
-            [\r
-                first [ sanitize % ] keep\r
-                " = " % field>sqlite-bind-name %\r
-            ] "" make\r
-        ] map ", " join %\r
-        " where ROWID = :rowid;" %\r
-    ] "" make ;\r
-\r
-M: sqlite select-sql* ( db tuple -- string )\r
-    nip [\r
-        "select ROWID,* from " % dup tuple>sql-name %\r
-        " where " % tuple>select-alist\r
-        [\r
-            [\r
-                first dup %\r
-                " = " %\r
-                field>sqlite-bind-name %\r
-            ] "" make\r
-        ] map " and " join %\r
-        ";" %\r
-    ] "" make ;\r
-\r
-\r
diff --git a/libs/sql/sqlite/sqlite.factor b/libs/sql/sqlite/sqlite.factor
deleted file mode 100644 (file)
index cf5d68a..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-! Copyright (C) 2005 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! An interface to the sqlite database. Tested against sqlite v3.0.8.
-! Remeber to pass the following to factor:
-!  -libraries:sqlite=libsqlite3.so
-!
-! Not all functions have been wrapped yet. Only those directly involving
-! executing SQL calls and obtaining results.
-!
-IN: sqlite
-USING: alien compiler errors generic libsqlite kernel math namespaces
-prettyprint sequences sql strings sql:utils ;
-
-TUPLE: sqlite-error n message ;
-
-! High level sqlite routines
-: sqlite-check-result ( result -- )
-  #! Check the result from a sqlite call is ok. If it is
-  #! return, otherwise throw an error.
-  dup SQLITE_OK = [
-    drop 
-  ] [
-    dup sqlite-error-messages nth <sqlite-error> throw
-  ] if ;
-
-: sqlite-open ( filename -- db )
-  #! Open the database referenced by the filename and return
-  #! a handle to that database. An error is thrown if the database
-  #! failed to open.
-  "void*" <c-object> [ sqlite3_open sqlite-check-result ] keep *void* ;
-
-: sqlite-close ( db -- )
-  #! Close the given database
-  sqlite3_close sqlite-check-result ;
-
-: sqlite-last-insert-rowid ( db -- rowid )
-  #! Return the rowid of the last insert
-  sqlite3_last_insert_rowid ;
-
-: sqlite-prepare ( db sql -- statement )
-  #! Prepare a SQL statement. Returns the statement which
-  #! can have values bound to parameters or simply executed.
-  #! TODO: Support multiple statements in the SQL string.
-  dup length "void*" <c-object> "void*" <c-object>
-  [ sqlite3_prepare sqlite-check-result ] 2keep
-  drop *void* ;
-
-: sqlite-bind-text ( statement index text -- )
-  #! Bind the text to the parameterized value in the statement.  
-  dup length SQLITE_TRANSIENT sqlite3_bind_text sqlite-check-result ;
-
-: sqlite-bind-parameter-index ( statement name -- index )
-  sqlite3_bind_parameter_index ;
-
- : sqlite-bind-text-by-name ( statement name text -- )
-  >r dupd sqlite-bind-parameter-index r> sqlite-bind-text ;
-
-: sqlite-finalize ( statement -- )
-  #! Clean up all resources related to a statement. Once called
-  #! the statement cannot be used. All statements must be finalized
-  #! before closing the database.
-  sqlite3_finalize sqlite-check-result ;
-
-: sqlite-reset ( statement -- )
-  #! Reset a statement so it can be called again, possibly with
-  #! different parameters.
-  sqlite3_reset sqlite-check-result ;
-
-: column-count ( statement -- int )
-  #! Given a prepared statement, return the number of
-  #! columns in each row of the result set of that statement.
-  sqlite3_column_count ;
-
-: column-text ( statement index -- string )
-  #! Return the value of the given column, indexed
-  #! from zero, as a string.
-  sqlite3_column_text ;
-
-: step-complete? ( step-result -- bool )
-  #! Return true if the result of a sqlite3_step is
-  #! such that the iteration has completed (ie. it is
-  #! SQLITE_DONE). Throw an error if an error occurs. 
-  dup SQLITE_ROW =  [
-    drop f
-  ] [
-    dup SQLITE_DONE = [
-      drop t 
-    ] [
-      sqlite-check-result t
-    ] if
-  ] if ;
-
-: sqlite-each ( statement quot -- )    
-  #! Execute the SQL statement, and call the quotation for
-  #! each row returned from executing the statement with the
-  #! statement on the top of the stack.
-  over sqlite3_step step-complete? [ 
-    2drop
-  ] [
-    [ call ] 2keep sqlite-each
-  ] if ; inline
-
-! For comparison, here is the linrec implementation of sqlite-each
-! [ drop sqlite3_step step-complete? ]
-! [ 2drop ]
-! [ 2dup 2slip ]
-! [ ] linrec ; 
-
-DEFER: (sqlite-map)
-
-: (sqlite-map) ( statement quot seq -- )    
-  pick sqlite3_step step-complete? [ 
-    2nip
-  ] [
-    >r 2dup call r> curry (sqlite-map)
-  ] if ; 
-
-: sqlite-map ( statement quot -- seq )
-  [ ] (sqlite-map) ;
-
-: with-sqlite ( path quot -- )
-    [
-        >r sqlite-open db set r>
-        [ db get sqlite-close ] cleanup
-    ] with-scope ;
-
-: bind-for-sql ( statement alist -- )
-    [
-        first2 >r field>sqlite-bind-name r>
-        obj>string/f sqlite-bind-text-by-name
-    ] each-with ;
-
-: bind-for-insert ( statement tuple -- )
-    tuple>insert-alist dupd dupd bind-for-sql ;
-
-: bind-for-update ( statement tuple -- )
-    tuple>update-alist dupd dupd dupd bind-for-sql ;
-
-: bind-for-delete ( statement tuple -- )
-    tuple>delete-alist dupd dupd bind-for-sql ;
-
-: bind-for-select ( statement tuple -- )
-    tuple>select-alist dupd dupd bind-for-sql ;
-
-: restore-tuple ( statement tuple -- tuple )
-    break
-    clone dup dup full-tuple>fields
-    [
-        2drop
-        ! over 1+ >r
-        ! db-field-slot >r
-        ! pick swap column-text
-        ! over r> set-slot r>
-    ] each-with
-    ! drop make-persistent swap 0 column-text swap
-    ! [ set-persistent-key ] keep
-    ;
-
diff --git a/libs/sql/tupledb.factor b/libs/sql/tupledb.factor
deleted file mode 100644 (file)
index b9d45a5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-USING: kernel math sql:utils ;
-IN: sql
-
-: save-tuple ( tuple -- )
-    dup "id" tuple-slot [
-        update-tuple
-    ] [
-        insert-tuple
-    ] if ;
-
-: restore-tuple ( tuple -- )
-    ;
-
-
diff --git a/libs/sql/utils.factor b/libs/sql/utils.factor
deleted file mode 100644 (file)
index 11736d1..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-USING: arrays errors generic hashtables kernel kernel-internals\r
-math namespaces parser prettyprint sequences sql\r
-strings tools words ;\r
-IN: sql:utils\r
-\r
-: sanitize ( string -- string )\r
-    "_p" "-?" pick subst ;\r
-\r
-: obj>string/f ( obj -- string/f )\r
-   dup [ dup string? [ unparse ] unless ] when ;\r
-\r
-: bottom-delegate ( tuple -- tuple/f )\r
-    dup delegate [ nip bottom-delegate ] when* ;\r
-\r
-: set-bottom-delegate ( delegate tuple -- )\r
-    bottom-delegate set-delegate ;\r
-\r
-: make-persistent ( id tuple -- )\r
-    >r <persistent> r> set-bottom-delegate ;\r
-\r
-: remove-bottom-delegate ( tuple -- )\r
-    dup delegate [\r
-        delegate [\r
-            delegate remove-bottom-delegate\r
-        ] [\r
-            f swap set-delegate\r
-        ] if\r
-    ] [\r
-        drop\r
-    ] if* ;\r
-\r
-: make-empty-tuple ( string -- tuple )\r
-    parse call dup tuple-size <tuple> ;\r
-\r
-: field>sqlite-bind-name ( string -- string )\r
-    >r ":" r> append sanitize ;\r
-\r
-: tuple-slot ( string tuple -- ? obj )\r
-    "slot-names" over class word-props hash\r
-    pick [ = ] curry find over -1 = [\r
-        2drop delegate dup [ tuple-slot ] [ 2drop f -1 ] if\r
-    ] [\r
-        drop rot drop 2 + swap tuple>array nth >r t r>\r
-    ] if ;\r
-\r
-: tuple-fields ( tuple -- seq )\r
-    class "slot-names" word-prop ;\r
-\r
-: tuple>parts ( tuple -- values names )\r
-    [ tuple-slots ] keep tuple-fields ;\r
-\r
-: tuple>alist ( tuple -- alist )\r
-    tuple>parts [ swap 2array ] 2map ;\r
-\r
-: full-tuple>fields ( tuple -- seq )\r
-    delegates <reversed> V{ } clone\r
-    [ tuple-fields dupd nappend ] reduce\r
-    <reversed> prune <reversed> >array ;\r
-\r
-: full-tuple>slots ( tuple -- seq )\r
-    dup full-tuple>fields [ swap tuple-slot nip ] map-with ;\r
-\r
-: full-tuple>parts ( tuple -- values names )\r
-    [ full-tuple>slots ] keep full-tuple>fields ;\r
-\r
-: full-tuple>alist ( tuple -- alist )\r
-    full-tuple>parts [ swap 2array ] 2map ;\r
-\r
-: alist-remove-key ( alist key -- seq )\r
-    [ >r first r> = not ] curry subset ;\r
-\r
-: alist-remove-value ( alist value -- seq )\r
-    [ >r second r> = not ] curry subset ;\r
-\r
-: alist-key-each ( alist quot -- )\r
-    [ first ] swap append each ;\r
-\r
-: tuple>insert-alist ( tuple -- alist )\r
-    full-tuple>alist\r
-    "id" alist-remove-key\r
-    f alist-remove-value ;\r
-\r
-: tuple>update-alist ( tuple -- alist )\r
-    full-tuple>alist "id" over assoc\r
-    >r "rowid" r> 2array 1array append \r
-    "id" alist-remove-key ;\r
-\r
-: tuple>delete-alist ( tuple -- alist )\r
-    >r "rowid" r> "id" swap tuple-slot nip 2array 1array ;\r
-\r
-: tuple>select-alist ( tuple -- alist )\r
-    full-tuple>alist\r
-    f alist-remove-value ;\r
-\r
-! : 2seq>hash 2array flip alist>hash ;\r
-\r
-: 2seq>hash ( seq seq -- hash )\r
-    H{ } clone -rot [ pick set-hash ] 2each ;\r
-\r
-\r
-: tuple>hash ( tuple -- hash ) tuple>parts 2seq>hash ;\r
-    \r
-: full-tuple>hash ( tuple -- hash )\r
-    delegates <reversed>\r
-    H{ } clone [ tuple>hash hash-union ] reduce ;\r
-\r
-: maybe-unparse ( obj -- )\r
-    dup string? [ unparse ] unless ;\r
-\r
-: replace ( new old seq -- seq )\r
-    >r 2seq>hash r> [\r
-        [\r
-            [\r
-                tuck swap hash* [ nip ] [ drop ] if\r
-                dup sequence? [ % ] [ , ] if \r
-            ] each-with\r
-        ] { } make\r
-    ] keep like ;\r
-\r
-GENERIC: escape-sql* ( string db -- string )\r
-\r
-M: connection escape-sql* ( string db -- string )\r
-    drop dup string? [\r
-        { "''" } "'" rot replace\r
-    ] when ;\r
-\r
-: escape-sql ( string -- string ) db get escape-sql* ;\r
-\r
-: tuple>sql-name ( tuple -- string )\r
-    class unparse sanitize ;\r
-\r
-: tuple>sql-name% ( tuple -- string )\r
-    tuple>sql-name % ;\r
-\r
-\r
-: enquote% "'" % dup string? [ unparse ] unless % "'" % ;\r
-\r
-: enquote ( string -- 'string' )\r
-    [ enquote% ] "" make ;\r
-\r
-: split-last ( seq -- last most )\r
-    dup length {\r
-        { [ dup zero? ] [ 2drop f f ] }\r
-        { [ dup 1 = ] [ drop f ] }\r
-        { [ t ] [ >r [ peek 1array ] keep r> 1- head ] }\r
-    } cond ;\r
-\r
-: (each-last) ( seq quot quot -- )\r
-    >r >r split-last r> each r> each ; inline\r
-\r
-: each-last ( seq quot quot -- )\r
-    >r dup clone r> append swap (each-last) ; inline\r
-\r
-: (2each-last) ( seq seq quot quot -- )\r
-    >r >r [ split-last ] 2apply swapd r> 2each r> 2each ; inline\r
-\r
-: 2each-last ( seq seq quot quot -- )\r
-    #! apply first quotation on all but last elt of seq\r
-    #! apply second quotation on last element\r
-    >r dup clone r> append swap (2each-last) ; inline\r
-\r
-! <foo1> { integer string }\r
-! mapping: { integer { varchar(256) "not null" } }\r
-! { "a integer" "b string" }\r
-\r
-SYMBOL: mappings\r
-H{ } clone mappings set-global\r
-\r
-: get-mapping ( tuple -- seq )\r
-    dup class mappings get hash* [\r
-        nip\r
-    ] [\r
-        drop tuple-slots [ drop "varchar" ] map\r
-    ] if ;\r
-\r
-: tuple>mapping% ( obj -- seq )\r
-    [ get-mapping ] keep tuple-fields\r
-    [ sanitize % " " % % ] [ ", " % ] 2each-last ;\r
-\r
-: tuple>mapping ( tuple -- string )\r
-    [ tuple>mapping% ] "" make ;\r
-\r
-\r
-: explode-tuple ( tuple -- )\r
-    dup tuple-slots swap class "slot-names" word-prop\r
-    [ set ] 2each ;\r
-\r
-\r
-\r
diff --git a/libs/sqlite/libsqlite.factor b/libs/sqlite/libsqlite.factor
deleted file mode 100644 (file)
index 75f3cd6..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-! Copyright (C) 2005 Chris Double, Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! An interface to the sqlite database. Tested against sqlite v3.1.3.
-! Remeber to pass the following to factor:
-!  -libraries:sqlite=libsqlite3.so
-!
-! Not all functions have been wrapped yet. Only those directly involving
-! executing SQL calls and obtaining results.
-!
-IN: libsqlite
-USING: alien compiler errors kernel math namespaces sequences strings ;
-
-! Return values from sqlite functions
-: SQLITE_OK           0   ; inline ! Successful result
-: SQLITE_ERROR        1   ; inline ! SQL error or missing database
-: SQLITE_INTERNAL     2   ; inline ! An internal logic error in SQLite 
-: SQLITE_PERM         3   ; inline ! Access permission denied 
-: SQLITE_ABORT        4   ; inline ! Callback routine requested an abort 
-: SQLITE_BUSY         5   ; inline ! The database file is locked 
-: SQLITE_LOCKED       6   ; inline ! A table in the database is locked 
-: SQLITE_NOMEM        7   ; inline ! A malloc() failed 
-: SQLITE_READONLY     8   ; inline ! Attempt to write a readonly database 
-: SQLITE_INTERRUPT    9   ; inline ! Operation terminated by sqlite_interrupt() 
-: SQLITE_IOERR       10   ; inline ! Some kind of disk I/O error occurred 
-: SQLITE_CORRUPT     11   ; inline ! The database disk image is malformed 
-: SQLITE_NOTFOUND    12   ; inline ! (Internal Only) Table or record not found 
-: SQLITE_FULL        13   ; inline ! Insertion failed because database is full 
-: SQLITE_CANTOPEN    14   ; inline ! Unable to open the database file 
-: SQLITE_PROTOCOL    15   ; inline ! Database lock protocol error 
-: SQLITE_EMPTY       16   ; inline ! (Internal Only) Database table is empty 
-: SQLITE_SCHEMA      17   ; inline ! The database schema changed 
-: SQLITE_TOOBIG      18   ; inline ! Too much data for one row of a table 
-: SQLITE_CONSTRAINT  19   ; inline ! Abort due to contraint violation 
-: SQLITE_MISMATCH    20   ; inline ! Data type mismatch 
-: SQLITE_MISUSE      21   ; inline ! Library used incorrectly 
-: SQLITE_NOLFS       22   ; inline ! Uses OS features not supported on host 
-: SQLITE_AUTH        23   ; inline ! Authorization denied 
-: SQLITE_FORMAT      24   ; inline ! Auxiliary database format error
-: SQLITE_RANGE       25   ; inline ! 2nd parameter to sqlite3_bind out of range
-: SQLITE_NOTADB      26   ; inline ! File opened that is not a database file
-
-: sqlite-error-messages ( -- seq ) {
-    "Successful result"
-    "SQL error or missing database"
-    "An internal logic error in SQLite"
-    "Access permission denied"
-    "Callback routine requested an abort"
-    "The database file is locked"
-    "A table in the database is locked"
-    "A malloc() failed"
-    "Attempt to write a readonly database"
-    "Operation terminated by sqlite_interrupt()"
-    "Some kind of disk I/O error occurred"
-    "The database disk image is malformed"
-    "(Internal Only) Table or record not found"
-    "Insertion failed because database is full"
-    "Unable to open the database file"
-    "Database lock protocol error"
-    "(Internal Only) Database table is empty"
-    "The database schema changed"
-    "Too much data for one row of a table"
-    "Abort due to contraint violation"
-    "Data type mismatch"
-    "Library used incorrectly"
-    "Uses OS features not supported on host"
-    "Authorization denied"
-    "Auxiliary database format error"
-    "2nd parameter to sqlite3_bind out of range"
-    "File opened that is not a database file"
-} ;
-
-: SQLITE_ROW         100  ; inline ! sqlite_step() has another row ready 
-: SQLITE_DONE        101  ; inline ! sqlite_step() has finished executing 
-
-! Return values from the sqlite3_column_type function
-: SQLITE_INTEGER     1 ; inline
-: SQLITE_FLOAT       2 ; inline
-: SQLITE_TEXT        3 ; inline
-: SQLITE_BLOB        4 ; inline
-: SQLITE_NULL        5 ; inline
-
-! Values for the 'destructor' parameter of the 'bind' routines. 
-: SQLITE_STATIC      0  ; inline
-: SQLITE_TRANSIENT   -1 ; inline
-
-TYPEDEF: void sqlite3
-TYPEDEF: void sqlite3_stmt
-
-LIBRARY: sqlite
-FUNCTION: int sqlite3_open ( char* filename, void* ppDb ) ;
-FUNCTION: int sqlite3_close ( sqlite3* pDb ) ;
-FUNCTION: int sqlite3_prepare ( sqlite3* pDb, char* 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 ) ;
-FUNCTION: int sqlite3_last_insert_rowid ( sqlite3* pStmt ) ;
-FUNCTION: int sqlite3_bind_blob ( sqlite3_stmt* pStmt, int index, void* ptr, int len, int destructor ) ;
-FUNCTION: int sqlite3_bind_int ( sqlite3_stmt* pStmt, int index, int n ) ;
-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_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: int sqlite3_column_int ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: int sqlite3_column_name ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: char* sqlite3_column_text ( sqlite3_stmt* pStmt, int col ) ;
-FUNCTION: int sqlite3_column_type ( sqlite3_stmt* pStmt, int col ) ;
-
diff --git a/libs/sqlite/load.factor b/libs/sqlite/load.factor
deleted file mode 100644 (file)
index 9818e3b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-PROVIDE: libs/sqlite
-{ +files+ {
-       "libsqlite.factor"
-       "sqlite.factor"
-       "sqlite.facts"
-       "tuple-db.factor"
-       "tuple-db.facts"
-} }
-{ +tests+ {
-       "tuple-db-tests.factor"
-} } ;
diff --git a/libs/sqlite/sqlite.factor b/libs/sqlite/sqlite.factor
deleted file mode 100644 (file)
index 2900fa9..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-! Copyright (C) 2005 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-! An interface to the sqlite database. Tested against sqlite v3.0.8.
-! Remeber to pass the following to factor:
-!  -libraries:sqlite=libsqlite3.so
-!
-! Not all functions have been wrapped yet. Only those directly involving
-! executing SQL calls and obtaining results.
-!
-IN: sqlite
-USING: alien compiler errors libsqlite kernel namespaces sequences strings ;
-
-TUPLE: sqlite-error n message ;
-SYMBOL: db
-
-! High level sqlite routines
-: sqlite-check-result ( result -- )
-  #! Check the result from a sqlite call is ok. If it is
-  #! return, otherwise throw an error.
-  dup SQLITE_OK = [
-    drop 
-  ] [
-    dup sqlite-error-messages nth <sqlite-error> throw
-  ] if ;
-
-: sqlite-open ( filename -- db )
-  #! Open the database referenced by the filename and return
-  #! a handle to that database. An error is thrown if the database
-  #! failed to open.
-  "void*" <c-object> [ sqlite3_open sqlite-check-result ] keep *void* ;
-
-: sqlite-close ( db -- )
-  #! Close the given database
-  sqlite3_close sqlite-check-result ;
-
-: sqlite-last-insert-rowid ( db -- rowid )
-  #! Return the rowid of the last insert
-  sqlite3_last_insert_rowid ;
-
-: sqlite-prepare ( db sql -- statement )
-  #! Prepare a SQL statement. Returns the statement which
-  #! can have values bound to parameters or simply executed.
-  #! TODO: Support multiple statements in the SQL string.
-  dup length "void*" <c-object> "void*" <c-object>
-  [ sqlite3_prepare sqlite-check-result ] 2keep
-  drop *void* ;
-
-: sqlite-bind-text ( statement index text -- )
-  #! Bind the text to the parameterized value in the statement.  
-  dup length SQLITE_TRANSIENT sqlite3_bind_text sqlite-check-result ;
-
-: sqlite-bind-parameter-index ( statement name -- index )
-  sqlite3_bind_parameter_index ;
-
-: sqlite-bind-text-by-name ( statement name text -- )
-  >r dupd sqlite-bind-parameter-index r> sqlite-bind-text ;
-
-: sqlite-finalize ( statement -- )
-  #! Clean up all resources related to a statement. Once called
-  #! the statement cannot be used. All statements must be finalized
-  #! before closing the database.
-  sqlite3_finalize sqlite-check-result ;
-
-: sqlite-reset ( statement -- )
-  #! Reset a statement so it can be called again, possibly with
-  #! different parameters.
-  sqlite3_reset sqlite-check-result ;
-
-: column-count ( statement -- int )
-  #! Given a prepared statement, return the number of
-  #! columns in each row of the result set of that statement.
-  sqlite3_column_count ;
-
-: column-text ( statement index -- string )
-  #! Return the value of the given column, indexed
-  #! from zero, as a string.
-  sqlite3_column_text ;
-
-: step-complete? ( step-result -- bool )
-  #! Return true if the result of a sqlite3_step is
-  #! such that the iteration has completed (ie. it is
-  #! SQLITE_DONE). Throw an error if an error occurs. 
-  dup SQLITE_ROW =  [
-    drop f
-  ] [
-    dup SQLITE_DONE = [
-      drop t 
-    ] [
-      sqlite-check-result t
-    ] if
-  ] if ;
-
-: sqlite-each ( statement quot -- )    
-  #! Execute the SQL statement, and call the quotation for
-  #! each row returned from executing the statement with the
-  #! statement on the top of the stack.
-  over sqlite3_step step-complete? [ 
-    2drop
-  ] [
-    [ call ] 2keep sqlite-each
-  ] if ; inline
-
-! For comparison, here is the linrec implementation of sqlite-each
-! [ drop sqlite3_step step-complete? ]
-! [ 2drop ]
-! [ 2dup 2slip ]
-! [ ] linrec ; 
-
-DEFER: (sqlite-map)
-
-: (sqlite-map) ( statement quot seq -- )    
-  pick sqlite3_step step-complete? [ 
-    2nip
-  ] [
-    >r 2dup call r> curry (sqlite-map)
-  ] if ; 
-
-: sqlite-map ( statement quot -- seq )
-  [ ] (sqlite-map) ;
-
-: with-sqlite ( path quot -- )
-    [
-        >r sqlite-open db set r>
-        [ db get sqlite-close ] cleanup
-    ] with-scope ;
-
diff --git a/libs/sqlite/sqlite.facts b/libs/sqlite/sqlite.facts
deleted file mode 100644 (file)
index 4fdee7a..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: help sqlite ;
-
-HELP: sqlite-open 
-{ $values { "filename" "path to sqlite database" } 
-          { "db" "the database object" } 
-}
-{ $description "Opens the sqlite3 database." } 
-{ $see-also sqlite-close sqlite-last-insert-rowid } ;
-
-HELP: sqlite-close
-{ $values { "db" "the database object" } 
-}
-{ $description "Closes the sqlite3 database." } 
-{ $see-also sqlite-open sqlite-last-insert-rowid } ;
-
-HELP: sqlite-last-insert-rowid
-{ $values { "db" "the database object" } 
-         { "rowid" "the row number of the last insert" }
-}
-{ $description "Returns the number of the row of the last statement inserted into the database." } 
-{ $see-also sqlite-open sqlite-close } ;
-
-HELP: sqlite-prepare
-{ $values { "db" "the database object" } 
-         { "sql" "the SQL statement as a string" }
-         { "statement" "the prepared SQL statement" }
-}
-{ $description "Internally compiles the SQL statement ready to be run by sqlite. The statement is executed and the results iterated over using " { $link sqlite-each } " and " { $link sqlite-map } ". The SQL statement can use named parameters which are later bound to values using " { $link sqlite-bind-text } " and " { $link sqlite-bind-text-by-name } "." } 
-{ $see-also sqlite-open sqlite-close } ;
-
-HELP: sqlite-bind-text
-{ $values { "statement" "a prepared SQL statement" }
-         { "index" "the index of the bound parameter in the SQL statement" } 
-         { "text" "the string value to bind to that column" }
-         
-}
-{ $description "Binds the text to a parameter in the SQL statement. The parameter to be bound is identified by the index given and the indexes start from one." }
-{ $examples { $example "\"people.db\" sqlite-open\n\"select * from people where name=?\" sqlite-prepare\n1 \"chris\" sqlite-bind-text" } }
-{ $see-also sqlite-bind-text-by-name } ;
-
-HELP: sqlite-bind-text-by-name
-{ $values { "statement" "a prepared SQL statement" }
-         { "name" "the name of the bound parameter in the SQL statement" } 
-         { "text" "the string value to bind to that column" }
-         
-}
-{ $description "Binds the text to a parameter in the SQL statement. The parameter to be bound is identified by the given name." }
-{ $examples { $example "\"people.db\" sqlite-open\n\"select * from people where name=:name\" sqlite-prepare\n\"name\" \"chris\" sqlite-bind-text" } }
-{ $see-also sqlite-bind-text } ;
-
-HELP: sqlite-finalize
-{ $values { "statement" "a prepared SQL statement" }  
-}
-{ $description "Clean up all resources related to a statement. Once called the statement cannot be used again. All statements must be finalized before closing the database." }
-{ $see-also sqlite-close sqlite-prepare } ;
-
-HELP: sqlite-reset
-{ $values { "statement" "a prepared SQL statement" }  
-}
-{ $description "Reset a statement so it can be called again, possibly with different bound parameters." }
-{ $see-also sqlite-bind-text sqlite-bind-text-by-name } ;
-
-HELP: column-count
-{ $values { "statement" "a prepared SQL statement" }  
-}
-{ $description "Return the number of columns in each row of the result set of the given statement." }
-{ $see-also column-text sqlite-each sqlite-map } ;
-
-HELP: column-text
-{ $values { "statement" "a prepared SQL statement" } { "index" "column number indexed from zero" }   
-}
-{ $description "Return the value of the given column, indexed from zero, as a string." }
-{ $see-also column-count sqlite-each sqlite-map } ;
-
-HELP: sqlite-each
-{ $values { "statement" "a prepared SQL statement" } { "quot" "A quotation with stack effect ( statement -- )" }   
-}
-{ $description "Executes the SQL statement and for each returned row calls the qutotation passing the statement on the stack. The quotation can use " { $link column-text } " to get result values for that row." }
-{ $see-also column-count column-text sqlite-map } ;
-
-HELP: sqlite-map
-{ $values { "statement" "a prepared SQL statement" } { "quot" "A quotation with stack effect ( statement -- value )" } { "seq" "a new sequence" }   
-}
-{ $description "Executes the SQL statement and for each returned row calls the qutotation passing the statement on the stack. The quotation can use " { $link column-text } " to get result values for that row. The quotation should leave a value on the stack which gets collected and returned in the resulting sequence." }
-{ $see-also column-count column-text sqlite-each } ;
diff --git a/libs/sqlite/test.factor b/libs/sqlite/test.factor
deleted file mode 100644 (file)
index 8a9e1f0..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-! Copyright (C) 2005 Chris Double.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-! Test the sqlite interface
-!
-! Create a test database like follows:
-!
-!   sqlite3 test.db < test.txt
-!
-!  Then run this file.
-USE: sqlite
-USE: kernel
-USE: io
-USE: prettyprint
-
-: test.db "libs/sqlite/test.db" resource-path ;
-
-: show-people ( statement -- )
-  dup 0 column-text write " from " write 1 column-text . ;
-
-: run-test ( -- )
-  test.db sqlite-open
-  dup "select * from test" sqlite-prepare
-  dup [ show-people ] sqlite-each 
-  sqlite-finalize
-  sqlite-close ;
-
-: find-person ( name -- )
-  test.db sqlite-open  ! name db
-  dup "select * from test where name=?" sqlite-prepare ! name db stmt
-  [ rot 1 swap sqlite-bind-text ] keep ! db stmt
-  [ [ 1 column-text . ] sqlite-each ] keep
-  sqlite-finalize
-  sqlite-close ;  
-
-: find-all ( -- )
-  test.db sqlite-open  ! db
-  dup "select * from test" sqlite-prepare ! db stmt
-  [ [ [ 0 column-text ] keep 1 column-text curry ] sqlite-map ] keep
-  sqlite-finalize
-  swap sqlite-close ;  
-
-: run-test2 ( -- )
-  test.db sqlite-open
-  dup "select * from test" sqlite-prepare
-  dup [ show-people ] ;
-
-run-test
diff --git a/libs/sqlite/test.txt b/libs/sqlite/test.txt
deleted file mode 100644 (file)
index 5c7ae2b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-create table test (name varchar(30), address varchar(30));
-insert into test values('John', 'America');
-insert into test values('Jane', 'New Zealand');
diff --git a/libs/sqlite/tuple-db-tests.factor b/libs/sqlite/tuple-db-tests.factor
deleted file mode 100644 (file)
index f412abb..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-! Copyright (C) 2005 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-IN: tuple-db
-USING: io kernel sequences namespaces
-hashtables sqlite errors math words generic test ;
-
-TUPLE: testdata one two ;
-
-testdata default-mapping set-mapping
-
-"libs/sqlite/test.db" resource-path [
-
-    db get testdata create-tuple-table
-
-    [ "two" [ ] ] [
-    db get "one" "two" <testdata> insert-tuple
-    db get "one" f <testdata> find-tuples 
-    first [ testdata-two ] keep
-    db get swap delete-tuple    
-    db get "one" f <testdata> find-tuples 
-    ] unit-test
-
-    [ "junk" ] [
-    db get "one" "two" <testdata> insert-tuple
-    db get "one" f <testdata> find-tuples 
-    first  
-    "junk" over set-testdata-two
-    db get swap update-tuple
-    db get "one" f <testdata> find-tuples 
-    first [ testdata-two ] keep
-    db get swap delete-tuple      
-    ] unit-test
-
-    db get testdata drop-tuple-table
-] with-sqlite
-
diff --git a/libs/sqlite/tuple-db.factor b/libs/sqlite/tuple-db.factor
deleted file mode 100644 (file)
index 5513898..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-! Copyright (C) 2005 Chris Double.
-!
-! A tuple that is persistent has its delegate set as 'persistent'.
-! 'persistent' holds the numeric rowid for that tuple in its table.
-IN: tuple-db
-USING: io kernel kernel-internals sequences namespaces
-hashtables sqlite errors math words generic ;
-
-! Each slot in a tuple that is storable in the database has
-! an instance of a db-field object the gives the name of the 
-! database table and slot number in the tuple object of that field.
-TUPLE: db-field name bind-name slot type ;
-
-! The mapping tuple holds information on how the slots of
-! a tuple are mapped to the fields of a sqlite database. 
-TUPLE: mapping tuple table fields one-to-one one-to-many   ;
-
-: sanitize ( string -- string ) 
-    #! Convert a string so it can be used as a table or field name.
-    "_p" "-?" pick subst ;
-
-: tuple-fields ( class -- seq )
-  #! Given a tuple class return a list of the fields
-  #! within that tuple. Ignores the delegate field.
-  [ word-name length 1+ ] keep
-  "slots" word-prop 1 tail [
-    [ third word-name swap tail sanitize dup ":" swap append ] keep    
-    first
-    "text"
-    <db-field>
-  ] map-with ;
-
-: default-mapping ( class -- mapping )  
-  #! Given a tuple class, create a default mappings object. It assumes
-  #! there are no one-to-one or one-to-many relationships.
-  dup [ word-name sanitize ] keep tuple-fields f f <mapping> ;
-
-! The mappings variable holds a hashtable mapping the tuple symbol
-! to the mapping object, describing how that tuple is stored
-! in the database.
-SYMBOL: mappings
-
-: init-mappings ( -- )
-  H{ } mappings set-global ;
-
-: get-mappings ( -- hashtable )
-  mappings get-global ;
-
-: set-mapping ( mapping -- )
-  #! Store a database mapping so that the persistence system 
-  #! knows how to store instances of the relevant tuple in the database.
-  dup mapping-tuple get-mappings set-hash ;
-
-: get-mapping ( class -- mapping )
-  #! Return the database mapping for the given tuple class.
-  get-mappings hash ;
-
-! The 'persistent' tuple will be set to the delegate of any tuple
-! instance stored in the database. It contains the database key
-! of the row in the database table for the instance or 'f' if it has
-! not yet been stored in the database. It also contains the 'mapping'
-! object used to translate the fields of the tuple to the database fields.
-TUPLE: persistent mapping key ;
-C: persistent ( tuple -- persistent )
-  >r class get-mapping r> 
-  [ set-persistent-mapping ] keep ;
-
-: make-persistent ( tuple -- tuple )
-  #! Convert the tuple into something that can be stored
-  #! into a database by setting its delegate to 'persistent'.
-  [ <persistent> ] keep 
-  [ set-delegate ] keep ;
-
-
-: comma-fields ( mapping quot -- string )
-  #! Given a mapping, call quot on each field in
-  #! the mapping. The contents of quot should call ',' or '%'
-  #! to generate output. The output of each quot call
-  #! seperated by commas is returned as a string. 'quot' should be
-  #! stack effect ( field -- ).
-  swap mapping-fields [
-    swap "" make
-  ] map-with "," join ; inline
-
-GENERIC: create-sql ( mapping -- string )
-M: mapping create-sql ( mapping -- string )
-  #! Return the SQL used to create a table for storing this type of tuple.
-  [
-    "create table " % dup mapping-table % 
-    " (" % 
-    [ dup db-field-name % " " % db-field-type % ] comma-fields %
-    ");" %
-  ] "" make ;
-
-GENERIC: drop-sql ( mapping -- string )
-M: mapping drop-sql ( mapping -- string )
-  #! Return the SQL used to drop the table for storing this type of tuple.
-  [
-    "drop table " % mapping-table % ";" %
-  ] "" make ;
-
-GENERIC: insert-sql ( mapping -- string )
-M: mapping insert-sql ( mapping -- string )
-  #! Return the SQL used to insert a tuple into a table
-  [
-    "insert into " % dup mapping-table %
-    " values(" %
-    [ db-field-bind-name % ] comma-fields %
-    ");" %
-  ] "" make ;
-
-GENERIC: delete-sql ( mapping -- string )
-M: mapping delete-sql ( mapping -- string )
-  #! Return the SQL used to delete a tuple from a table
-  [
-    "delete from " % mapping-table %
-    " where ROWID=:rowid;" % 
-  ] "" make ;
-
-GENERIC: update-sql ( mapping -- string )
-M: mapping update-sql ( mapping -- string )
-  #! Return the SQL used to update the tuple
-  [
-    "update " % dup mapping-table %
-    " set " %
-    [ dup db-field-name % "=" % db-field-bind-name % ] comma-fields %
-    " where ROWID=:rowid;" %
-  ] "" make ;
-
-GENERIC: select-sql ( tuple mapping -- select )
-M: mapping select-sql ( tuple mapping -- select )
-  #! Return the SQL used to select a series of tuples from the database. It
-  #! will select based on only the filled in fields of the tuple (ie. all non-f).
-  [
-    "select ROWID,* from " % dup mapping-table %
-    mapping-fields [ ! tuple field
-      swap over db-field-slot slot ! field value
-      [
-        [ dup db-field-name % "=" % db-field-bind-name % ] "" make        
-      ] [
-        drop f
-      ] if
-    ] map-with [ ] subset dup length 0 > [
-      " where " % 
-      " and " join % 
-    ] [
-      drop
-    ] if
-    ";" %
-  ] "" make ;
-
-: execute-update-sql ( db string -- )
-  #! Execute the SQL, which should contain a database update
-  #! statement (update, insert, create, etc). Ignore the result.
-  sqlite-prepare dup [ drop ] sqlite-each sqlite-finalize ;
-
-: create-tuple-table ( db class -- )
-  #! Create the table for the tuple class.
-  get-mapping create-sql execute-update-sql ;
-
-: drop-tuple-table ( db class -- )
-  #! Create the table for the tuple class.
-  get-mapping drop-sql execute-update-sql ;
-
-: bind-for-insert ( statement tuple -- )
-  #! Bind the fields in the tuple to the fields in the 
-  #! prepared insert statement.
-  dup class get-mapping mapping-fields [ ! statement tuple field
-    [ db-field-slot slot ] keep ! statement value field
-    db-field-bind-name swap ! statement name value
-    >r dupd r> sqlite-bind-text-by-name     
-  ] each-with drop ;  
-
-: bind-for-select ( statement tuple -- )
-  #! Bind the fields in the tuple to the fields in the 
-  #! prepared select statement.
-  dup class get-mapping mapping-fields [ ! statement tuple field
-    [ db-field-slot slot ] keep ! statement value field
-    over [
-      db-field-bind-name swap ! statement name value
-      >r dupd r> sqlite-bind-text-by-name     
-    ] [ 
-      2drop 
-    ] if
-  ] each-with drop ;  
-
-: bind-for-update ( statement tuple -- )
-  #! Bind the fields in the tuple to the fields in the 
-  #! prepared update statement.
-  2dup bind-for-insert
-  >r ":rowid" r> persistent-key sqlite-bind-text-by-name ;
-
-: bind-for-delete ( statement tuple -- )
-  #! Bind the fields in the tuple to the fields in the 
-  #! prepared delete statement.
-  >r ":rowid" r> persistent-key sqlite-bind-text-by-name ;
-
-: (insert-tuple) ( db tuple -- )
-  #! Insert this tuple instance into the database. Note that
-  #! it inserts only this instance, and not any one-to-one or
-  #! one-to-many fields.
-  dup class get-mapping insert-sql ! db tuple sql
-  swapd sqlite-prepare swap ! statement tuple
-  dupd bind-for-insert ! statement
-  dup [ drop ] sqlite-each
-  sqlite-finalize ;
-  
-: insert-tuple ( db tuple -- )
-  #! Insert this tuple instance into the database and
-  #! update the rowid of the insert in the tuple.
-  [ (insert-tuple) ] 2keep
-  >r sqlite-last-insert-rowid number>string r> make-persistent set-persistent-key ;
-
-: update-tuple ( db tuple -- )
-  #! Update this tuple instance in the database. The tuple should have
-  #! a delegate of 'persistent' with the key field set.
-  dup class get-mapping update-sql ! db tuple sql
-  swapd sqlite-prepare swap ! statement tuple
-  dupd bind-for-update ! statement
-  dup [ drop ] sqlite-each
-  sqlite-finalize ;
-
-: save-tuple ( db tuple -- )
-  #! Insert or Update the tuple instance depending on whether it
-  #! has a persistent delegate.
-  dup delegate [ update-tuple ] [ insert-tuple ] if ;
-
-: delete-tuple ( db tuple -- )
-  #! Delete this tuple instance from the database. The tuple should have
-  #! a delegate of 'persistent' with the key field set.
-  dup class get-mapping delete-sql ! db tuple sql
-  swapd sqlite-prepare swap ! statement tuple
-  dupd bind-for-delete ! statement
-  dup [ drop ] sqlite-each
-  sqlite-finalize ;
-
-: restore-tuple ( statement tuple -- tuple )
-  #! Using 'tuple' as a template, clone it and 
-  #! return the clone with fields set to the values from the
-  #! database.
-  clone dup class get-mapping mapping-fields 1 swap 
-  [ ! statement tuple index field )
-    over 1+ >r ! statement tuple index field r: index+1
-    db-field-slot >r ! statement tuple index r: index+1 slot
-    pick swap column-text ! statement tuple value r: index+1 slot
-    over r> set-slot r> ! statement tuple index+1
-  ] each ! statement tuple index
-  drop make-persistent swap 0 column-text swap [ set-persistent-key ] keep ; 
-
-: find-tuples ( db tuple -- seq )
-  #! Return a sequence of all tuples in the database that
-  #! match the tuple provided as a template. All fields in the
-  #! tuple must match the entries in the database, except for 
-  #! those set to 'f'. 
-  dup class get-mapping dupd select-sql ! db tuple sql
-  swapd sqlite-prepare swap ! statement tuple
-  2dup bind-for-select ! statement tuple
-  [
-    over [ ! tuple statement
-      over restore-tuple ,
-    ] sqlite-each 
-  ] [ ] make nip ! statement tuple accum
-  swap sqlite-finalize ;
-  
-get-mappings [ init-mappings ] unless 
diff --git a/libs/sqlite/tuple-db.facts b/libs/sqlite/tuple-db.facts
deleted file mode 100644 (file)
index 5120fe9..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: help sqlite tuple-db ;
-
-ARTICLE: { "sqlite" "tuple-db-loading" } "Loading"
-"The quickest way to get up and running with this library is to load it as a module:"
-{ $code "\"libs/sqlite\" require\nUSE: sqlite\nUSE: tuple-db\n" } 
-"Some simple tests can be run to check that everything is working ok:"
-{ $code "\"libs/sqlite\" test-module" } ;
-
-ARTICLE: { "sqlite" "tuple-db-usage" } "Basic Usage"
-"This library can be used for storing simple Factor tuples in a sqlite database. In its current form the tuples must not contain references to other tuples and should not have a delegate set."
-$terpri
-"This document will use the following tuple for demonstration purposes:"
-{ $code "TUPLE: person name surname phone ;" }
-"The sqlite database to store tuples must be created, or an existing one opened. This is done using the " { $link sqlite-open } " word. If the database does not exist then it is created. The examples in this document store the database pointer in a variable called 'db':"
-{ $code "SYMBOL: db\n\"example.db\" sqlite-open db set-global" } ;
-
-ARTICLE: { "sqlite" "tuple-db-mappings" } "Tuple Mappings"
-"Each tuple has a 'mapping' tuple associated with it. The 'mapping' stores information about what table the tuple will be stored in, the datatypes of the tuple slots, etc. A mapping must be created before a tuple can be stored in a database. A default mapping is easily created using " { $link default-mapping } ". Given the tuple class, this will use reflection to get the slots of it, assume that all slots are of database type 'text', and store the tuple objects in a table with the same name as the tuple."
-$terpri
-"The following shows how to create the default mapping for the 'person' tuple, and how to register that mapping so the 'tuple-db' system can know how to handle 'person' instances:"
-{ $code "person default-mapping set-mapping" } ;
-
-ARTICLE: { "sqlite" "tuple-db-create" } "Creating the table"
-"The table used to store tuple instances may need to be created. This can be done manually using the external sqlite program or via " { $link create-tuple-table } ":"
-{ $code "db get person create-tuple-table" }
-"The SQL used to create the table is produced internally by " { $link create-sql } ". This is a generic word dispatched on the mapping object, and could be specialised if needed. If you wish to see the SQL used to create the table, use the following code:"
-{ $code "person get-mapping create-sql .\n => \"create table person (name text,surname text,phone text);\"" } ;
-
-ARTICLE: { "sqlite" "tuple-db-insert" } "Inserting instances"
-"The " { $link insert-tuple } " word will store instances of a tuple into the database table defined by its mapping object:"
-{ $code "db get \"John\" \"Smith\" \"123-456-789\" <person> insert-tuple" }
-{ $link insert-tuple } " internally uses the " { $link insert-sql } " word to produce the SQL used to store the tuple. Like " { $link create-sql } ", it is a generic word specialized on the mapping object. You can call it directly to see what SQL is generated:"
-{ $code "person get-mapping insert-sql .\n => \"insert into person values(:name,:surname,:phone);\"" }
-"Notice that the SQL uses named parameters. These parameters are bound to the values stored in the tuple object when the SQL is compiled. This helps prevent SQL injection techniques."
-$terpri
-"When " { $link insert-sql } " is run, it adds a delegate to the tuple being stored. The delegate is of type 'persistent' and holds the row id of the tuple in its 'key' slot. This way the exact record can be updated or retrieved later. The following demonstates this fact:"
-{ $code "\"Mandy\" \"Jones\" \"987-654-321\" <person> dup .\n  => T{ person f \"Mandy\" \"Jones\" \"987-654-321\" }\ndb get over insert-tuple .\n  => T{ person T{ persistent ... 2 } \"Mandy\" \"Jones\" \"987-654-321\" }" }
-"The '2' in the above example is the row id of the record inserted. We can go into the 'sqlite' command and view this record:"
-{ $code "  $ sqlite3 example.db\n    SQLite version 3.0.8\n    Enter \".help\" for instructions\n    sqlite> select ROWID,* from person;\n      1|John|Smith|123-456-789\n      2|Mandy|Jones|987-654-321\n    sqlite>" } ;
-
-ARTICLE: { "sqlite" "tuple-db-finding" } "Finding instances"
-"The " { $link find-tuples } " word is used to return tuples populated with data already existing in the database. As well as the database objcet, it takes a tuple that should be populated only with the fields that should be matched in the database. All fields you do not wish to match against should be set to 'f':"
-{ $code "db get f \"Smith\" f <person> find-tuples .\n => { T{ person # \"John\" \"Smith\" \"123-456-789\" } }\ndb get \"Mandy\" f f <person> find-tuples .\n => { T{ person # \"Mandy\" \"Jones\" \"987-654-321\" } }\ndb get \"Joe\" f f <person> find-tuples .\n => { }" }
-"Notice that if no matching tuples are found then an empty sequence is returned. The returned tuples also have their delegate set to 'persistent' with the correct row id set as the key. This can be used to later update the tuples with new information and store them in the database." ;
-
-ARTICLE: { "sqlite" "tuple-db-updating" } "Updating instances"
-"Given a tuple that has the 'persistent' delegate with the row id set as the key, you can update this specific record using " { $link update-tuple } ":"
-{ $code "db get f \"Smith\" f <person> find-tuples dup .\n => { T{ person # \"John\" \"Smith\" \"123-456-789\" } }\nfirst { \"999-999-999\" swap set-person-phone ] keep dup .\n => T{ person T{ persistent f # \"1\" } \"John\" \"Smith\" \"999-999-999\" ...\n db get swap update-tuple" }
-"Using the 'sqlite' command from the system shell you can see the record was updated:"
-{ $code "  $ sqlite3 example.db\n    SQLite version 3.0.8\n    Enter \".help\" for instructions\n    sqlite> select ROWID,* from person;\n      1|John|Smith|999-999-999\n      2|Mandy|Jones|987-654-321\n    sqlite>" } ;
-
-ARTICLE: { "sqlite" "tuple-db-inserting-or-updating" } "Inserting or Updating instances"
-"The " { $link save-tuple } " word can be used to insert a tuple if it has not already been stored in the database, or update it if it already exists. Whether to insert or update is decided by the existance of the 'persistent' delegate:"
-{ $code "\"Mary\" \"Smith\" \"111-111-111\" <person> dup .\n  => T{ person f \"Mary\" \"Smith\" \"111-111-111\" }\n! This will insert the tuple\ndb get over save-tuple dup .\n  => T{ person T{ persistent f # \"3\" } \"Mary\" \"Smith\" \"111-111-111\" ...\n[ \"222-222-222\" swap set-person-phone ] keep dup .\n  => T{ person T{ persistent f # \"3\" } \"Mary\"  \"Smith\" \"222-222-222\" ...\n! This will update the tuple\ndb get over save-tuple .\n  => T{ person T{ persistent f # \"3\" } \"Mary\"  \"Smith\" \"222-222-222\" ..." } ;
-
-ARTICLE: { "sqlite" "tuple-db-deleting" } "Deleting instances"
-"Given a tuple with the delegate set to 'persistent' (ie. One already stored in the database) you can delete it from the database with " { $link delete-tuple } ":"
-{ $code "db get f \"Smith\" f <person> find-tuples [ db get swap delete-tuple ] each" } ;
-
-ARTICLE: { "sqlite" "tuple-db-closing" } "Closing the database"
-"It's important to close the sqlite database when you've finished using it. The word for this is " { $link sqlite-close } ":"
-{ $code "db get sqlite-close" } ;
-
-ARTICLE: { "sqlite" "tuple-db" } "Tuple Database Library"
-"The version of sqlite required by this library is version 3 or greater. This library allows storing Factor tuples in a sqlite database. It provides words to create, read update and delete these entries as well as simple searching."\
-$terpri
-"The library is in a very early state and is likely to change quite a bit in the near future. Its most notable omission is it cannot currently handle relationships between tuples." 
-{ $subsection { "sqlite" "tuple-db-loading" } } 
-{ $subsection { "sqlite" "tuple-db-usage" } } 
-{ $subsection { "sqlite" "tuple-db-mappings" } } 
-{ $subsection { "sqlite" "tuple-db-create" } } 
-{ $subsection { "sqlite" "tuple-db-insert" } } 
-{ $subsection { "sqlite" "tuple-db-finding" } } 
-{ $subsection { "sqlite" "tuple-db-updating" } } 
-{ $subsection { "sqlite" "tuple-db-inserting-or-updating" } } 
-{ $subsection { "sqlite" "tuple-db-deleting" } } 
-{ $subsection { "sqlite" "tuple-db-closing" } } 
-;
-
-HELP: default-mapping 
-{ $values { "class" "symbol for the tuple class" } 
-          { "mapping" "a mapping object" } 
-}
-{ $description "Given a tuple class, create a default mappings object. This is used to associate field names in the tuple with SQL statement field names, etc." } 
-{ $see-also { "sqlite" "tuple-db" } set-mapping } ;
-
-HELP: set-mapping 
-{ $values { "mapping" "a mapping object" } 
-}
-{ $description "Store a database mapping so that the tuple-db system knows how to store instances of the tuple in the database." } 
-{ $see-also { "sqlite" "tuple-db" } default-mapping } ;
-
-HELP: create-tuple-table
-{ $values { "db" "a database object" } { "class" "symbol for the tuple class" }
-}
-{ $description "Create the database table to store intances of the given tuple." } 
-{ $see-also { "sqlite" "tuple-db" } default-mapping get-mapping } ;
-
-HELP: insert-tuple
-{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
-}
-{ $description "Insert the tuple instance into the database. It is assumed that this tuple does not currently exist in the database." } 
-{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
-
-HELP: find-tuples
-{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
-}
-{ $description "Return a sequence of all tuples in the database that match the tuple provided as a template. All fields in the tuple must match the entries in the database, except for those set to 'f'." } 
-{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
-
-HELP: update-tuple
-{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
-}
-{ $description "Update the database record for this tuple instance. The tuple must have previously been obtained from the database, or inserted into it. It must have a delegate of 'persistent' with the key field set (which is done by the find and insert operations)." } 
-{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
-
-HELP: save-tuple
-{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
-}
-{ $description "Insert or Update the tuple instance depending on whether it has a persistent delegate." } 
-{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
-
-HELP: delete-tuple
-{ $values { "db" "a database object" } { "tuple" "an instance of a tuple" }
-}
-{ $description "Delete this tuple instance from the database. The tuple must have previously been obtained from the database, or inserted into it. It must have a delegate of 'persistent' with the key field set (which is done by the find and insert operations)." } 
-{ $see-also { "sqlite" "tuple-db" } insert-tuple update-tuple find-tuples delete-tuple save-tuple } ;
diff --git a/libs/textmate/Factor.tmbundle/Syntaxes/Factor.tmLanguage b/libs/textmate/Factor.tmbundle/Syntaxes/Factor.tmLanguage
deleted file mode 100644 (file)
index c6e0e4b..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>fileTypes</key>
-       <array>
-               <string>factor</string>
-               <string>facts</string>
-       </array>
-       <key>foldingStartMarker</key>
-       <string>^\s*(M|C)?:|#(V|H|C)\{</string>
-       <key>foldingStopMarker</key>
-       <string>^\s*$</string>
-       <key>keyEquivalent</key>
-       <string>^~F</string>
-       <key>name</key>
-       <string>Factor</string>
-       <key>patterns</key>
-       <array>
-               <dict>
-                       <key>captures</key>
-                       <dict>
-                               <key>2</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>keyword.colon.factor</string>
-                               </dict>
-                               <key>3</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>entity.name.function.factor</string>
-                               </dict>
-                               <key>4</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>comment.stack-effect.factor</string>
-                               </dict>
-                       </dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(:)\s+([^\s]+)\s+(\(\s.*\))?</string>
-                       <key>name</key>
-                       <string>definition.word.factor</string>
-               </dict>
-               <dict>
-                       <key>captures</key>
-                       <dict>
-                               <key>2</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>keyword.colon.factor</string>
-                               </dict>
-                               <key>3</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>entity.name.method.factor</string>
-                               </dict>
-                               <key>4</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>comment.stack-effect.factor</string>
-                               </dict>
-                       </dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(C:)\s+([^\s]+)\s+(\(\s.*\))?</string>
-                       <key>name</key>
-                       <string>definition.word.class.factor</string>
-               </dict>
-               <dict>
-                       <key>captures</key>
-                       <dict>
-                               <key>2</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>keyword.colon.factor</string>
-                               </dict>
-                               <key>3</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>entity.name.class.factor</string>
-                               </dict>
-                               <key>4</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>entity.name.method.factor</string>
-                               </dict>
-                               <key>5</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>comment.stack-effect.factor</string>
-                               </dict>
-                       </dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(M:)\s+([^\s]+)\s+([^\s]+)\s+(\(\s.*\))?</string>
-                       <key>name</key>
-                       <string>definition.word.method.factor</string>
-               </dict>
-               <dict>
-                       <key>captures</key>
-                       <dict>
-                               <key>2</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>keyword.colon.factor</string>
-                               </dict>
-                               <key>4</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>entity.name.generic.factor</string>
-                               </dict>
-                               <key>5</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>comment.stack-effect.factor</string>
-                               </dict>
-                       </dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(G(ENERIC)?:)\s+([^\s]+)\s+(\(\s.*\))?</string>
-                       <key>name</key>
-                       <string>definition.word.generic.factor</string>
-               </dict>
-               <dict>
-                       <key>captures</key>
-                       <dict>
-                               <key>2</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>storage.type.factor</string>
-                               </dict>
-                               <key>3</key>
-                               <dict>
-                                       <key>name</key>
-                                       <string>entity.name.class.factor</string>
-                               </dict>
-                       </dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(TUPLE:)\s+([^\s]+)\s+(([^\s]+)+)</string>
-                       <key>name</key>
-                       <string>meta.class.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(drop|2drop|3drop|keep|2keep|3keep|nip|2nip|dup|2dup|3dup|dupd|over|pick|tuck|swap|rot|-rot|slip|2swap|swapd|&gt;r|r&gt;)(\s|$)</string>
-                       <key>name</key>
-                       <string>keyword.control.stack.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(get|set)(\s|$)</string>
-                       <key>name</key>
-                       <string>keyword.control.variable.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(if|when|unless|if*|unless*|when*)\*?(\s|$)</string>
-                       <key>name</key>
-                       <string>keyword.control.flow.factor</string>
-               </dict>
-               <dict>
-                       <key>begin</key>
-                       <string>(^|(?&lt;=\s))(USING:)</string>
-                       <key>end</key>
-                       <string>(?&lt;=\s);(\s|$)</string>
-                       <key>name</key>
-                       <string>keyword.control.using.factor</string>
-                       <key>patterns</key>
-                       <array>
-                               <dict>
-                                       <key>match</key>
-                                       <string>(^|(?&lt;=\s))[^\s]+(\s|$)</string>
-                                       <key>name</key>
-                                       <string>constant.namespace.factor</string>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>begin</key>
-                       <string>(^|(?&lt;=\s))(REQUIRES:)</string>
-                       <key>end</key>
-                       <string>(?&lt;=\s);(\s|$)</string>
-                       <key>name</key>
-                       <string>keyword.control.requires.factor</string>
-                       <key>patterns</key>
-                       <array>
-                               <dict>
-                                       <key>match</key>
-                                       <string>(^|(?&lt;=\s))[^\s]+(\s|$)</string>
-                                       <key>name</key>
-                                       <string>constant.namespace.factor</string>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))(f|t)(\s|$)</string>
-                       <key>name</key>
-                       <string>constant.language.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))CHAR:\s+[^\s]+(\s|$)</string>
-                       <key>name</key>
-                       <string>constant.character.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))((BIN:|OCT:)\s+)?-?\d+(\s|$)</string>
-                       <key>name</key>
-                       <string>constant.numeric.integer.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))HEX:\s+-?[\dA-Fa-f]+(\s|$)</string>
-                       <key>name</key>
-                       <string>constant.numeric.hexadecimal.integer.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))-?+\d+\.\d+(E(\+|-)\d+)?(\s|$)</string>
-                       <key>name</key>
-                       <string>constant.numeric.float.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>(^|(?&lt;=\s))-?\d+/-?\d+(\s|$)</string>
-                       <key>name</key>
-                       <string>constant.numeric.rational.factor</string>
-               </dict>
-               <dict>
-                       <key>begin</key>
-                       <string>"</string>
-                       <key>end</key>
-                       <string>"</string>
-                       <key>name</key>
-                       <string>string.quoted.double.factor</string>
-                       <key>patterns</key>
-                       <array>
-                               <dict>
-                                       <key>include</key>
-                                       <string>#escaped_characters</string>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>inline|foldable</string>
-                       <key>name</key>
-                       <string>storage.modifier.factor</string>
-               </dict>
-               <dict>
-                       <key>begin</key>
-                       <string>(^|(?&lt;=\s))#?!\s</string>
-                       <key>end</key>
-                       <string>$</string>
-                       <key>name</key>
-                       <string>comment.line.factor</string>
-               </dict>
-               <dict>
-                       <key>begin</key>
-                       <string>\(\s</string>
-                       <key>end</key>
-                       <string>\s\)</string>
-                       <key>name</key>
-                       <string>comment.parens.factor</string>
-               </dict>
-               <dict>
-                       <key>match</key>
-                       <string>\b[A-Z]+:\s+[^\s]+(\s|$)</string>
-                       <key>name</key>
-                       <string>keyword.control.postpone.factor</string>
-               </dict>
-       </array>
-       <key>repository</key>
-       <dict>
-               <key>escaped_characters</key>
-               <dict>
-                       <key>patterns</key>
-                       <array>
-                               <dict>
-                                       <key>match</key>
-                                       <string>\\(\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2})</string>
-                                       <key>name</key>
-                                       <string>constant.character.escape.factor</string>
-                               </dict>
-                               <dict>
-                                       <key>match</key>
-                                       <string>\\.</string>
-                                       <key>name</key>
-                                       <string>invalid.illegal.unknown-escape.factor</string>
-                               </dict>
-                       </array>
-               </dict>
-       </dict>
-       <key>scopeName</key>
-       <string>source.factor</string>
-       <key>uuid</key>
-       <string>3C9C9C2A-314A-475B-A4E4-A68BAAF3F36E</string>
-</dict>
-</plist>
diff --git a/libs/textmate/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage b/libs/textmate/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage
deleted file mode 100644 (file)
index 963fafc..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>fileTypes</key>
-       <array>
-               <string>fhtml</string>
-       </array>
-       <key>foldingStartMarker</key>
-       <string>(?x)
-               (&lt;(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)\b.*?&gt;
-               |&lt;!--(?!.*--&gt;)
-               |\{\s*($|\?&gt;\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
-               )</string>
-       <key>foldingStopMarker</key>
-       <string>(?x)
-               (&lt;/(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)&gt;
-               |^\s*--&gt;
-               |(^|\s)\}
-               )</string>
-       <key>keyEquivalent</key>
-       <string>^~F</string>
-       <key>name</key>
-       <string>HTML (Factor)</string>
-       <key>patterns</key>
-       <array>
-               <dict>
-                       <key>begin</key>
-                       <string>&lt;%\s</string>
-                       <key>end</key>
-                       <string>\s%&gt;</string>
-                       <key>name</key>
-                       <string>source.factor.embedded.html</string>
-                       <key>patterns</key>
-                       <array>
-                               <dict>
-                                       <key>include</key>
-                                       <string>source.factor</string>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>include</key>
-                       <string>text.html.basic</string>
-               </dict>
-       </array>
-       <key>scopeName</key>
-       <string>text.html.factor</string>
-       <key>uuid</key>
-       <string>141517D7-73E0-4475-A481-71102575A175</string>
-</dict>
-</plist>
diff --git a/libs/textmate/Factor.tmbundle/info.plist b/libs/textmate/Factor.tmbundle/info.plist
deleted file mode 100644 (file)
index 8def380..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>name</key>
-       <string>Factor</string>
-       <key>uuid</key>
-       <string>8061D2F3-B603-411D-AFFE-61784A07906D</string>
-</dict>
-</plist>
diff --git a/libs/textmate/load.factor b/libs/textmate/load.factor
deleted file mode 100644 (file)
index 4352784..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-REQUIRES: libs/process ;
-PROVIDE: libs/textmate { +files+ { "textmate.factor" } } ;
diff --git a/libs/textmate/textmate.factor b/libs/textmate/textmate.factor
deleted file mode 100644 (file)
index 5dbf836..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-USING: definitions kernel parser process namespaces prettyprint ;
-
-IN: textmate
-
-: textmate-location ( file line -- )
-    [ "mate -a -l " % # " " % unparse % ] "" make run-process ;
-
-[ textmate-location ] edit-hook set-global
diff --git a/libs/topology/hopf.factor b/libs/topology/hopf.factor
deleted file mode 100644 (file)
index f3cadfa..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays errors hashtables io kernel math matrices
-namespaces parser prettyprint sequences topology words ;
-IN: hopf
-
-! Finitely generated Hopf algebras.
-
-! An element is represented as a hashtable mapping basis
-! elements to scalars.
-
-! A basis element is a pair of arrays, odd/even generators.
-
-! Define degrees using deg=
-
-! Add elements using l+
-
-! Multiply elements using h*
-
-! The co-unit is co1
-
-! Print elements using h.
-
-! Define the differential using d=
-
-! Differentiate using d
-
-: ?set-hash ( value key hash/f -- hash )
-    [ [ set-hash ] keep ] [ associate ] if* ;
-
-SYMBOL: degrees
-
-: deg= degrees [ ?set-hash ] change ;
-
-: deg degrees get ?hash [ 1 ] unless* ;
-
-: h. ( vec -- )
-    hash>alist [ first2 >r concat r> 2array ] map (l.) ;
-
-: <basis-elt> ( generators -- pair )
-    #! Pair is { odd even }
-    V{ } clone V{ } clone
-    rot [
-        3dup deg odd? [ drop ] [ nip ] if push
-    ] each [ >array ] 2apply 2array ;
-
-: [0] { { } { } } ;
-
-: >h ( obj -- vec )
-    {
-        { [ dup not ] [ drop 0 >h ] }
-        { [ dup number? ] [ [0] associate ] }
-        { [ dup array? ] [ <basis-elt> 1 swap associate ] }
-        { [ dup hashtable? ] [ ] }
-        { [ t ] [ 1array >h ] }
-    } cond ;
-
-: co1 ( vec -- n ) [0] swap hash [ 0 ] unless* ;
-
-: permutation ( seq -- perm )
-    dup natural-sort [ swap index ] map-with ;
-
-: (inversions) ( n seq -- n )
-    [ > ] subset-with length ;
-
-: inversions ( seq -- n )
-    0 swap dup length [
-        swap [ nth ] 2keep swap 1+ tail-slice (inversions) +
-    ] each-with ;
-
-: duplicates? ( seq -- ? )
-    dup prune [ length ] 2apply > ;
-
-: (odd*) ( n terms -- n terms )
-    dup duplicates? [
-        2drop 0 { }
-    ] [
-        dup permutation inversions -1^ rot *
-        swap natural-sort
-    ] if ;
-
-: odd* ( n terms1 terms2 -- n terms )
-    append (odd*) ;
-
-: even* ( terms1 terms2 -- terms )
-    append natural-sort ;
-
-: (h*) ( n basis1 basis2 -- n basis )
-    [
-        [ first ] 2apply odd*
-    ] 2keep [ second ] 2apply even* 2array ;
-
-: h* ( x y -- x.y )
-    [ >h ] 2apply [
-        [
-            rot [
-                2swap [
-                    swapd * -rot (h*) +@
-                ] 2keep
-            ] hash-each 2drop
-        ] hash-each-with
-    ] make-hash canonicalize ;
-
-SYMBOL: boundaries
-
-: d= ( value basis -- )
-    boundaries [ ?set-hash ] change ;
-
-: ((d)) ( basis -- value ) boundaries get ?hash ;
-
-: dx.y ( x y -- vec ) >r ((d)) r> h* ;
-
-DEFER: (d)
-
-: x.dy ( x y -- vec ) >r [ deg -1^ ] keep r> (d) h* h* ;
-
-: (d) ( product -- value )
-    #! d(x.y)=dx.y + (-1)^deg x x.dy
-    dup empty?
-    [ drop H{ } ] [ unclip swap [ x.dy ] 2keep dx.y l+ ] if ;
-
-: d ( x -- dx )
-    >h [ concat (d) ] linear-op ;
-
-: d-matrix ( n seq -- matrix )
-    [ ?nth ] 2keep >r 1+ r> ?nth [ concat (d) ] op-matrix ;
-
-: ker/im-d ( sim -- seq )
-    #! Dimension of kernel of C_{n+1} --> C_n, subsp. of C_{n+1}
-    #! Dimension of image  C_{n+1} --> C_n, subsp. of C_n
-    dup length [ swap d-matrix null/rank 2array ] map-with ;
-
-: nth-bit? ( m bit# -- ? )
-    1 swap shift bitand 0 > ;
-
-: nth-basis-elt ( generators n -- elt )
-    over length [
-        3dup nth-bit? [ nth ] [ 2drop f ] if
-    ] map [ ] subset 2nip ;
-
-SYMBOL: generators
-
-: basis ( generators -- seq )
-    [
-        dup length 1+ [ drop V{ } clone ] map \ basis set
-        1 over length shift [
-            nth-basis-elt dup length \ basis get nth push
-        ] each-with
-        \ basis get [ [ { } 2array ] map ] map
-    ] with-scope ;
-
-: H* ( -- seq ) generators get basis ker/im-d (H*) ;
diff --git a/libs/topology/laplacian.factor b/libs/topology/laplacian.factor
deleted file mode 100644 (file)
index 6eed43d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays hashtables hopf kernel math matrices namespaces
-sequences topology ;
-IN: laplacian
-
-: ((i)) ( x y -- i_y[x] )
-    1 swap associate boundaries set d ;
-
-: (i) ( x y -- i_y[x] )
-    [ <reversed> [ ((i)) ] each ] with-scope ;
-
-: i ( x y -- i_y[x] )
-    #! Adjoint of left multiplication by y
-    [ >h ] 2apply [ dupd concat (i) ] linear-op nip ;
-
-SYMBOL: top-class
-
-: set-generators ( seq -- )
-    natural-sort
-    dup generators set
-    1 [ h* ] reduce top-class set ;
-
-: star ( x -- *x )
-    #! Hodge star involution
-    top-class get swap i ;
-
-: <,>* ( a b -- n )
-    #! Hodge inner product
-    star h* star co1 ;
-
-: (d*) ( x -- d*[x] )
-    [ length 1+ generators get length * 1+ -1^ ] keep
-    star d star h* ;
-
-: d* ( x -- d*[x] )
-    #! Adjoint of the differential
-    >h [ concat (d*) ] linear-op ;
-
-: [,] ( x y -- z )
-    #! Lie bracket
-    h* d* ;
-
-: L ( z -- Lz )
-    #! Laplacian.
-    [ d d* ] keep d* d l+ ;
-
-: L-matrix ( basis -- matrix )
-    dup [ concat L ] op-matrix ;
-
-: cohomology ( -- seq )
-    generators get basis [ L-matrix null/rank drop ] map ;
diff --git a/libs/topology/linear.factor b/libs/topology/linear.factor
deleted file mode 100644 (file)
index e3573f3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: topology
-USING: arrays hashtables hashtables io kernel math math
-namespaces parser prettyprint sequences words ;
-
-: SYMBOLS:
-    string-mode on
-    [ string-mode off [ create-in define-symbol ] each ] f ;
-    parsing
-
-: canonicalize
-    [ nip zero? not ] hash-subset ;
-
-SYMBOL: terms
-
-: with-terms ( quot -- hash )
-    [ H{ } clone terms set call terms get ] with-scope ; inline
-
-: (l+) ( x -- )
-    terms get [ [ swap +@ ] hash-each ] bind ;
-
-: l+ ( x y -- x+y )
-    [ (l+) (l+) ] with-terms canonicalize ;
-
-: l* ( vec n -- vec )
-    dup zero? [
-        2drop H{ }
-    ] [
-        swap
-        hash>alist [ first2 rot * 2array ] map-with alist>hash
-    ] if ;
-
-: num-l. ( n -- str )
-    {
-        { [ dup 1 = ] [ drop " + " ] }
-        { [ dup -1 = ] [ drop " - " ] }
-        { [ t ] [ number>string " + " swap append ] }
-    } cond ;
-
-: (l.) ( assoc -- )
-    dup empty? [
-        drop 0 .
-    ] [
-        [
-            first2 num-l.
-            swap [ unparse ] map "." join
-            append
-        ] map concat " + " ?head drop print
-    ] if ;
-
-: l. ( vec -- ) hash>alist (l.) ;
-
-: linear-op ( vec quot -- vec )
-       [
-        swap [
-            >r swap call r> l* (l+)
-        ] hash-each-with
-    ] with-terms canonicalize ; inline
-
-: -1^ odd? -1 1 ? ;
-
-: (op-matrix) ( range quot basis-elt -- row )
-    swap call swap [ swap hash [ 0 ] unless* ] map-with ; inline
-
-: op-matrix ( domain range quot -- matrix )
-    rot [ >r 2dup r> (op-matrix) ] map 2nip ; inline
-
-: rot-seq 1 swap cut swap append ;
-
-: (H) ( sim -- seq ) flip first2 rot-seq v- ;
-
-: -rot-seq 1 swap cut* swap append ;
-
-: (H*) ( sim -- seq ) flip first2 -rot-seq v- ;
diff --git a/libs/topology/load.factor b/libs/topology/load.factor
deleted file mode 100644 (file)
index 6db11ae..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-PROVIDE: libs/topology
-{ +files+ {
-    "matrix.factor"
-    "linear.factor"
-    "simplex.factor"
-    "hopf.factor"
-    "laplacian.factor"
-} }
-{ +tests+ {
-    "test/matrix.factor"
-    "test/simplex.factor"
-    "test/hopf.factor"
-    "test/laplacian.factor"
-} } ;
diff --git a/libs/topology/matrix.factor b/libs/topology/matrix.factor
deleted file mode 100644 (file)
index 8afad44..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: matrices
-USING: kernel math namespaces parser sequences ;
-
-SYMBOL: matrix
-
-: with-matrix ( matrix quot -- )
-    [ swap matrix set call matrix get ] with-scope ; inline
-
-: nth-row ( row# -- seq ) matrix get nth ;
-
-: nth-col ( col# ignore-rows -- seq )
-    matrix get tail-slice [ nth ] map-with ;
-
-: change-row ( row# quot -- | quot: seq -- seq )
-    matrix get swap change-nth ; inline
-
-: exchange-rows ( row# row# -- ) matrix get exchange ;
-
-: rows ( -- n ) matrix get length ;
-
-: cols ( -- n ) 0 nth-row length ;
-
-: first-col ( row# -- n )
-    #! First non-zero column
-    0 swap nth-row [ zero? not ] skip ;
-
-: clear-scale ( col# pivot-row i-row -- n )
-    >r over r> nth dup zero? [
-        3drop 0
-    ] [
-        >r nth dup zero? [
-            r> 2drop 0
-        ] [
-            r> swap / neg
-        ] if
-    ] if ;
-
-: (clear-col) ( col# pivot-row i -- )
-    [ [ clear-scale ] 2keep >r n*v r> v+ ] change-row ;
-
-: (each-row) ( row# -- slice )
-    rows dup <slice> ;
-
-: each-row ( row# quot -- )
-    >r (each-row) r> each ; inline
-
-: clear-col ( col# row# -- )
-    [ nth-row ] keep 1+
-    [ >r 2dup r> (clear-col) ] each-row
-    2drop ;
-
-: do-row ( exchange-with row# -- )
-    [ exchange-rows ] keep
-    [ first-col ] keep
-    clear-col ;
-
-: find-row ( row# quot -- i elt )
-    >r (each-row) r> find ; inline
-
-: pivot-row ( col# row# -- n )
-    [ dupd nth-row nth zero? not ] find-row 2nip ;
-
-: (row-reduce) ( col# row# -- )
-    over cols < over rows < and [
-        2dup pivot-row [ over do-row 1+ ] when* >r 1+ r>
-        (row-reduce)
-    ] [
-        2drop
-    ] if ;
-
-: row-reduce ( matrix -- matrix' )
-    [ 0 0 (row-reduce) ] with-matrix ;
-
-: null/rank ( matrix -- null rank )
-    row-reduce [ [ [ zero? ] all? ] subset ] keep
-    [ length ] 2apply over - ;
diff --git a/libs/topology/simplex.factor b/libs/topology/simplex.factor
deleted file mode 100644 (file)
index ee14559..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-! Copyright (C) 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-IN: simplex
-USING: arrays hashtables io kernel math matrices namespaces
-prettyprint sequences topology words ;
-
-! Utilities
-: (lengthen) ( seq n -- seq )
-    over length - f <array> append ;
-
-: lengthen ( sim sim -- sim sim )
-    2dup max-length tuck (lengthen) >r (lengthen) r> ;
-
-: <point> ( -- sim ) gensym 1array ;
-
-: (C) ( point sim -- sim )
-    [ [ append natural-sort ] map-with ] map-with ;
-
-: (\/) ( sim sim -- sim )
-    lengthen [ append natural-sort ] 2map ;
-
-! Simplicial complexes
-SYMBOL: basepoint
-
-: {*} ( -- sim )
-    #! Initial object in category
-    { { { basepoint } } } ;
-
-: \/ ( sim sim -- sim )
-    #! Glue two complexes at base point
-    (\/) [ prune ] map ;
-
-: +point ( sim -- sim )
-    #! Adjoint an isolated point
-    unclip <point> add add* ;
-
-: C ( sim -- sim )
-    #! Cone on a space
-    [
-        <point> dup 1array >r swap (C) r> add*
-    ] keep (\/) ;
-
-: S ( sim -- sim )
-    #! Suspension
-    [
-        <point> <point> 2dup 2array >r
-        pick (C) >r swap (C) r> (\/) r> add*
-    ] keep (\/) ;
-
-: S^0 ( -- sim )
-    #! Degenerate sphere -- two points
-    {*} +point ;
-
-: S^ ( n -- sim )
-    #! Sphere
-    S^0 swap [ S ] times ;
-
-: D^ ( n -- sim )
-    #! Disc
-    1- S^ C ;
-
-! Boundary operator
-: (d) ( seq -- chain )
-    dup length 1 <= [
-        H{ }
-    ] [
-        dup length [ 2dup >r remove-nth r> -1^ ] map>hash
-    ] if nip ;
-
-: d ( chain -- chain )
-    [ (d) ] linear-op ;
-
-: d-matrix ( n sim -- matrix )
-    [ ?nth ] 2keep >r 1- r> ?nth [ (d) ] op-matrix ;
-
-: ker/im-d ( sim -- seq )
-    #! Dimension of kernel of C_{n-1} --> C_n, subsp. of C_{n-1}
-    #! Dimension of image  C_{n-1} --> C_n, subsp. of C_n
-    dup length [ swap d-matrix null/rank 2array ] map-with ;
-
-: H ( sim -- seq ) ker/im-d (H) ;
diff --git a/libs/topology/test/hopf.factor b/libs/topology/test/hopf.factor
deleted file mode 100644 (file)
index 7fee293..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-IN: temporary
-USING: topology hopf io test laplacian ;
-
-SYMBOLS: x1 x2 x3 u ;
-
-1 x1 deg=
-1 x2 deg=
-1 x3 deg=
-2 u deg=
-
-x1 x2 x3 h* h* u d=
-
-[ "2x1.x2.x3.u\n" ] [ [ u u h* d h. ] string-out ] unit-test
-
-x1 x2 h* x3 d=
-
-{ x1 x2 x3 } set-generators
-
-[ { 1 2 2 1 } ] [ H* ] unit-test
-
-SYMBOLS: x y z ;
-
-1 x deg=
-1 y deg=
-1 z deg=
-x y h* z d=
-y z h* x d=
-z x h* y d=
-
-{ x y z } set-generators
-
-[ { 1 0 0 1 } ] [ H* ] unit-test
diff --git a/libs/topology/test/laplacian.factor b/libs/topology/test/laplacian.factor
deleted file mode 100644 (file)
index 588b631..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: temporary
-USING: hopf kernel laplacian namespaces test topology ;
-
-SYMBOLS: x y z ;
-
-{ x y z } set-generators
-
-1 x deg=
-1 y deg=
-1 z deg=
-
-[ t ] [ x star y z h* = ] unit-test
-[ t ] [ y star z x h* = ] unit-test
-[ t ] [ z star x y h* = ] unit-test
-
-[ -1 ] [ x x <,>* ] unit-test
-[ 0 ] [ x y <,>* ] unit-test
diff --git a/libs/topology/test/matrix.factor b/libs/topology/test/matrix.factor
deleted file mode 100644 (file)
index 62c417e..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-IN: temporary
-USING: kernel matrices test ;
-
-{
-    { 1 0 0 }
-    { 0 0 1 }
-    { 0 1 0 }
-} [
-    [ 0 ] [ 0 first-col ] unit-test
-    [ 2 ] [ 1 first-col ] unit-test
-    [ 1 ] [ 2 first-col ] unit-test
-] with-matrix drop
-
-[
-    {
-        { 1 0 2 }
-        { 0 0 -3 }
-        { 0 1 -6 }
-    }
-] [
-    {
-        { 1 0 2 }
-        { 2 0 1 }
-        { 3 1 0 }
-    } [
-        0 0 clear-col
-    ] with-matrix
-] unit-test
-
-[ -2 ] [ 0 { 1 2 3 } { 2 7 8 } clear-scale ] unit-test
-
-[
-    {
-        { 1 0 2 }
-        { 0 0 -3 }
-        { 0 1 -6 }
-    }
-] [
-    {
-        { 1 0 2 }
-        { 2 0 1 }
-        { 3 1 0 }
-    } [
-        0 0 clear-col
-    ] with-matrix
-] unit-test
-
-[
-    {
-        { 1 0 0 3 }
-        { 0 2 0 4 }
-        { 0 0 6 8 }
-        { 0 0 0 4 }
-    }
-] [
-    {
-        { 1 0 0 3 }
-        { 0 0 6 8 }
-        { 0 2 0 4 }
-        { 0 0 0 4 }
-    } [
-        0 0 do-row
-        2 1 do-row
-    ] with-matrix
-] unit-test
-
-[
-    {
-        { 1 0 0 1 }
-        { 0 0 6 6 }
-        { 0 2 0 2 }
-        { 0 0 0 2 }
-    }
-] [
-    {
-        { 1 0 0 1 }
-        { 2 0 6 8 }
-        { 2 2 0 4 }
-        { 2 0 0 4 }
-    } [
-        0 0 do-row
-    ] with-matrix
-] unit-test
-
-{
-    { 0 1 0 1 }
-    { 1 0 0 1 }
-    { 1 0 0 0 }
-    { 1 1 0 1 }
-} [
-    [ 1 ] [ 0 0 pivot-row ] unit-test
-] with-matrix drop
-
-[
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 1 0 }
-        { 0 0 0 1 }
-    }
-] [
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 1 0 }
-        { 0 0 0 1 }
-    } row-reduce
-] unit-test
-
-[
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 1 0 }
-        { 0 0 0 1 }
-    }
-] [
-    {
-        { 1 0 0 0 }
-        { 1 1 0 0 }
-        { 1 0 1 0 }
-        { 1 0 0 1 }
-    } row-reduce
-] unit-test
-
-[
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 1 0 }
-        { 0 0 0 1 }
-    }
-] [
-    {
-        { 1 0 0 0 }
-        { 1 1 0 0 }
-        { 1 0 1 0 }
-        { 1 1 0 1 }
-    } row-reduce
-] unit-test
-
-[
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 1 0 }
-        { 0 0 0 1 }
-    }
-] [
-    {
-        { 1 0 0 0 }
-        { 1 1 0 0 }
-        { 1 1 0 1 }
-        { 1 0 1 0 }
-    } row-reduce
-] unit-test
-
-[
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 0 0 }
-        { 0 0 0 0 }
-    }
-] [
-    {
-        { 0 1 0 0 }
-        { 1 0 0 0 }
-        { 1 0 0 0 }
-        { 1 0 0 0 }
-    } [
-        [ 1 ] [ 0 0 pivot-row ] unit-test
-        1 0 do-row
-    ] with-matrix
-] unit-test
-
-[
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 0 0 }
-        { 0 0 0 0 }
-    }
-] [
-    {
-        { 0 1 0 0 }
-        { 1 0 0 0 }
-        { 1 0 0 0 }
-        { 1 0 0 0 }
-    } row-reduce
-] unit-test
-
-[
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 0 0 0 1 }
-        { 0 0 0 0 }
-    }
-] [
-    {
-        { 1 0 0 0 }
-        { 0 1 0 0 }
-        { 1 0 0 1 }
-        { 1 0 0 1 }
-    } row-reduce
-] unit-test
-
-[
-    {
-        { 1 0 0 1 }
-        { 0 1 0 1 }
-        { 0 0 0 -1 }
-        { 0 0 0 0 }
-    }
-] [
-    {
-        { 0 1 0 1 }
-        { 1 0 0 1 }
-        { 1 0 0 0 }
-        { 1 1 0 1 }
-    } row-reduce
-] unit-test
-
-[
-    1 3
-] [
-    {
-        { 0 1 0 1 }
-        { 1 0 0 1 }
-        { 1 0 0 0 }
-        { 1 1 0 1 }
-    } null/rank
-] unit-test
-
-[
-    1 3
-] [
-    {
-        { 0 0 0 0 0 1 0 1 }
-        { 0 0 0 0 1 0 0 1 }
-        { 0 0 0 0 1 0 0 0 }
-        { 0 0 0 0 1 1 0 1 }
-    } null/rank
-] unit-test
diff --git a/libs/topology/test/simplex.factor b/libs/topology/test/simplex.factor
deleted file mode 100644 (file)
index bc6f147..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-IN: temporary
-USING: simplex test ;
-
-! [ { 1 } ] [ {*} H ] unit-test
-! [ { 2 } ] [ S^0 H ] unit-test
-! [ { 1 1 } ] [ 1 S^ H ] unit-test
-! [ { 1 0 } ] [ 1 D^ H ] unit-test
-! [ { 1 0 1 } ] [ 2 S^ H ] unit-test
-! [ { 1 0 0 } ] [ 2 D^ H ] unit-test
diff --git a/libs/units/constants.factor b/libs/units/constants.factor
deleted file mode 100644 (file)
index d3e8ff0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-USING: kernel math si-units ;
-! From: http://physics.nist.gov/constants
-
-IN: si-units
-! speed of light in vacuum
-: c 299792458 m/s ;
-: c0 299792458 m/s ; ! same as c
-: c-vacuum 299792458 m/s ; ! same as c
-
-! more to come
-
diff --git a/libs/units/dimensioned.factor b/libs/units/dimensioned.factor
deleted file mode 100644 (file)
index 5baa03b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-USING: arrays errors tools io kernel math namespaces
-prettyprint sequences vectors words ;
-IN: units
-
-: seq-intersect ( seq1 seq2 -- seq1/\seq2 )
-    [ swap member? ] subset-with ;
-
-TUPLE: dimensioned value top bot ;
-C: dimensioned 
-    [ set-dimensioned-bot ] keep
-    [ set-dimensioned-top ] keep
-    over number? [ "dimensioned must be a number" throw ] unless
-    [ set-dimensioned-value ] keep ;
-
-: remove-one ( obj seq -- seq )
-    [ index ] keep over -1 = [ 2drop ] [ remove-nth ] if ;
-
-: dimensions ( dimensioned -- top bot )
-    dup >r dimensioned-top r> dimensioned-bot ;
-
-: 2remove-one ( obj seq seq -- seq seq )
-    pick swap remove-one >r remove-one r> ;
-
-: symbolic-reduce ( seq seq -- seq seq )
-    [ seq-intersect ] 2keep rot dup empty? [
-            drop
-        ] [
-            first -rot 2remove-one symbolic-reduce
-    ] if ;
-
-: reduce-units ( dimensioned -- )
-    dup dimensions symbolic-reduce pick set-dimensioned-bot swap set-dimensioned-top ;
-
-: 2reduce-units ( d d -- d d )
-    >r dup reduce-units r> dup reduce-units ;
-
-: 2value ( d d -- n n )
-    [ dimensioned-value ] 2apply ;
-
-: =units?
-    >r dimensions 2array r> dimensions 2array = ;
-    
-
-: d+ ( d d -- d )
-    2dup =units? [
-        "d+: dimensions must be the same" throw
-    ] unless
-    dup dimensions
-    >r >r 2value + r> r> <dimensioned> ;
-
-: d- ( d d -- d )
-    2dup =units? [
-        "d-: dimensions must be the same" throw
-    ] unless
-    dup dimensions
-    >r >r 2value - r> r> <dimensioned> ;
-
-: add-dimensions ( d d -- d )
-    >r dimensions r> dimensions >r swap >r append r> r> append 0 -rot <dimensioned> ;
-
-: (d*)
-    >r add-dimensions r> over set-dimensioned-value dup reduce-units ;
-
-: d* ( d d -- d )
-    2dup 2value * (d*) ;
-
-: swap-dimensions ( d -- d )
-    dup dimensions rot [ set-dimensioned-top ] keep [ set-dimensioned-bot ] keep ;
-
-: d/ ( d d -- d )
-    swap-dimensions 2dup 2value / (d*) ;
-
-: d-inv ( d -- d )
-    swap-dimensions dup dimensioned-value 1 swap / over set-dimensioned-value ;
-
-: d-product ( v -- d ) 1 { } { } <dimensioned> [ d* ] reduce ;
-
-! does not compile
-! Example: 4 m { km } { } convert
-: convert ( d top bot -- value )
-    >r [ [ 1 swap execute , ] each ] { } make d-product r>
-    [ [ 1 swap execute d-inv , ] each ] { } make d-product
-    d*
-    2dup =units? [ "cannot make that conversion" throw ] unless
-    [ 2value / ] keep [ set-dimensioned-value ] keep ;
-
diff --git a/libs/units/load.factor b/libs/units/load.factor
deleted file mode 100644 (file)
index acc5653..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-PROVIDE: libs/units
-{ +files+ {
-    "dimensioned.factor" "si-units.factor" "constants.factor"
-} }
-{ +tests+ {
-    "test/units.factor"
-} } ;
-
diff --git a/libs/units/si-units.factor b/libs/units/si-units.factor
deleted file mode 100644 (file)
index 6a26745..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-USING: math units ;
-IN: si-units
-
-! SI Conversions
-! http://physics.nist.gov/cuu/Units/
-
-! Y Z E P T G M k h da 1 d c m mu n p f a z y
-: yotta>1 1000000000000000000000000 * ;
-: zetta>1 1000000000000000000000 * ;
-: exa>1   1000000000000000000 * ;
-: peta>1  1000000000000000 * ;
-: tera>1  1000000000000 * ;
-: giga>1  1000000000 * ;
-: mega>1  1000000 * ;
-: kilo>1  1000 * ;
-: hecto>1 100 * ;
-: deca>1  10 * ;
-: deci>1  10 / ;
-: centi>1 100 / ;
-: milli>1 1000 / ;
-: micro>1 1000000 / ;
-: nano>1  1000000000 / ;
-: pico>1  1000000000000 / ;
-: femto>1 1000000000000000 / ;
-: atto>1  1000000000000000000 / ;
-: zepto>1 1000000000000000000000 / ;
-: yocto>1 1000000000000000000000000 / ;
-
-
-! Length
-SYMBOL: m
-: (m) { m } { } <dimensioned> ;
-: m (m) ;
-: km kilo>1 (m) ;
-: cm centi>1 (m) ;
-: mm milli>1 (m) ;
-: nm nano>1 (m) ;
-
-! Mass
-SYMBOL: kg
-: (kg) { kg } { } <dimensioned> ;
-: kg (kg) ;
-: g milli>1 (kg) ;
-
-! Time
-SYMBOL: s
-: (s) { s } { } <dimensioned> ;
-: s (s) ;
-: ms milli>1 (s) ;
-
-! Electric current
-SYMBOL: A
-: (A) { A } { } <dimensioned> ;
-: A (A) ;
-
-! Temperature
-SYMBOL: K
-: (K) { K } { } <dimensioned> ;
-: K (K) ;
-
-! Amount of substance
-SYMBOL: mol
-: (mol) { mol } { } <dimensioned> ;
-: mol (mol) ;
-
-! Luminous intensity
-SYMBOL: cd
-: (cd) { cd } { } <dimensioned> ;
-: cd (cd) ;
-
-
-! SI derived units
-: m^2 { m m } { } <dimensioned> ;
-: m^3 { m m m } { } <dimensioned> ;
-: m/s { m } { s } <dimensioned> ;
-: m/s^2 { m } { s s } <dimensioned> ;
-: m^-1 { } { m } <dimensioned> ;
-: kg/m^3 { kg } { m m m } <dimensioned> ;
-: A/m^2 { A } { m m } <dimensioned> ;
-: A/m { A } { m } <dimensioned> ;
-: mol/m^3 { mol } { m m m } <dimensioned> ;
-: cd/m^2 { cd } { m m } <dimensioned> ;
-: kg/kg { kg } { kg } <dimensioned> ;
-
-: radian ( n -- radian ) { m } { m } <dimensioned> ;
-: sr ( n -- steradian ) { m m } { m m } <dimensioned> ;
-: Hz ( n -- hertz ) { } { s } <dimensioned> ;
-: N ( n -- newton ) { kg m } { s s } <dimensioned> ;
-: Pa ( n -- pascal ) { kg } { m s s } <dimensioned> ;
-: J ( n -- joule ) { m m kg } { s s } <dimensioned> ;
-: W ( n -- watt ) { m m kg } { s s s } <dimensioned> ;
-: C ( n -- coulomb ) { s A } { } <dimensioned> ;
-: V ( n -- volt ) { m m kg } { s s s A } <dimensioned> ;
-: F ( n -- farad ) { s s s s A A } { m m kg } <dimensioned> ;
-: ohm ( n -- ohm ) { m m kg } { s s s A A } <dimensioned> ;
-: S ( n -- siemens ) { s s s A A } { m m kg } <dimensioned> ;
-: Wb ( n -- weber ) { m m kg } { s s A } <dimensioned> ;
-: T ( n -- tesla ) { kg } { s s A } <dimensioned> ;
-: H ( n -- henry ) { m m kg } { s s A A } <dimensioned> ;
-: deg-C ( n -- Celsius ) 273.15 + { K } { } <dimensioned> ;
-: lm ( n -- lumen ) { m m cd } { m m } <dimensioned> ;
-: lx ( n -- lux ) { m m cd } { m m m m  } <dimensioned> ;
-: Bq ( n -- becquerel ) { } { s } <dimensioned> ;
-: Gy ( n -- gray ) { m m } { s s } <dimensioned> ;
-: Sv ( n -- sievert ) { m m } { s s } <dimensioned> ;
-: kat ( n -- katal ) { mol } { s } <dimensioned> ;
-
-! Extensions to the SI
-: arc-deg pi 180 / * radian ;
-: arc-min pi 10800 / * radian ;
-: arc-sec pi 648000 / * radian ;
-: L ( n -- liter ) 1/1000 * m^3 ;
-: tons ( n -- metric-ton ) 1000 * kg ;
-: Np ( n -- neper ) { } { } <dimensioned> ;
-: B ( n -- bel ) 1.151292546497023 * Np ;
-: eV ( n -- electronvolt ) 1.60218e-19 * J ;
-: u ( n -- unified-atomic-mass-unit ) 1.66054e-27 * kg ;
-: au ( n -- astronomical-unit ) 149598000000 * m ;
-
-: nautical-miles 1852 * m ;
-: knots 1852/3600 * m/s ;
-: a ( n -- are ) 100 * m^2 ;
-: ha ( n -- hectare ) 10000 * m^2 ;
-: bar ( n -- bar ) 100000 * Pa ;
-: angstrom .1 * nm ;
-: b ( n -- barn ) 1/10000000000000000000000000000 * m^2 ;
-: Ci ( n -- curie ) 37000000000 * Bq ;
-: R 0.000258 { s A } { kg } <dimensioned> ;
-: rad .01 * Gy ;
-: rem .01 * Sv ;
-
diff --git a/libs/units/test/units.factor b/libs/units/test/units.factor
deleted file mode 100644 (file)
index 70d9618..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: arrays errors kernel math sequences si-units test units ;
-
-[ T{ dimensioned f 3 { m } { } } ] [ 3 m ] unit-test
-[ T{ dimensioned f 3 { m } { s } } ] [ 3 m/s ] unit-test
-[ T{ dimensioned f 4000 { m } { } } ] [ 4 km ] unit-test
-[ t ] [ 4 km { m } { } convert 4000 m = ] unit-test
-
diff --git a/libs/usb/load.factor b/libs/usb/load.factor
deleted file mode 100644 (file)
index ed7f491..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel ;
-
-PROVIDE: libs/usb
-{ +files+ {
-       "usb-common.factor" 
-       { "usb-unix.factor" [ unix? ] }
-       { "usb-win32.factor" [ win32? ] }
-       { "usb-macosx.factor" [ macosx? ] }
-       "usb.factor" 
-       "usb.facts" 
-} } ;
diff --git a/libs/usb/usb-common.factor b/libs/usb/usb-common.factor
deleted file mode 100644 (file)
index 5e83c7b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: usb
-USING: kernel alien math namespaces sequences parser ;
-
-: define-packed-field ( offset type name -- offset )
-    >r parse-c-decl 
-    >r 1 r> 
-    >r swapd align r> r> 
-    "struct-name" get swap "-" swap 3append
-    3dup define-getter 3dup define-setter
-    drop c-size rot * + ;
-
-: PACKED-FIELD: ( offset -- offset )
-  scan scan define-packed-field ; parsing
-
diff --git a/libs/usb/usb-macosx.factor b/libs/usb/usb-macosx.factor
deleted file mode 100644 (file)
index ce7e062..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: usb
-USING: kernel alien ;
-
-"usb" "/opt/local/lib/libusb.dylib" "cdecl" add-library
-
-LIBRARY: usb
-
-BEGIN-STRUCT: usb_bus
-  FIELD: void*      next
-  FIELD: void*      prev       
-  FIELD: char[1025] dirname
-  FIELD: void*      devices
-  FIELD: uint       location
-  FIELD: void*      root_dev
-END-STRUCT
-
-! __attribute__ ((packed))
-BEGIN-STRUCT: usb_device_descriptor
-  PACKED-FIELD: uchar bLength
-  PACKED-FIELD: uchar bDescriptorType
-  PACKED-FIELD: ushort bcdUSB
-  PACKED-FIELD: uchar  bDeviceClass
-  PACKED-FIELD: uchar  bDeviceSubClass
-  PACKED-FIELD: uchar  bDeviceProtocol
-  PACKED-FIELD: uchar  bMaxPacketSize0
-  PACKED-FIELD: ushort idVendor
-  PACKED-FIELD: ushort idProduct
-  PACKED-FIELD: ushort bcdDevice;
-  PACKED-FIELD: uchar  iManufacturer
-  PACKED-FIELD: uchar  iProduct
-  PACKED-FIELD: uchar  iSerialNumber
-  PACKED-FIELD: uchar  bNumConfigurations
-END-STRUCT
-
-BEGIN-STRUCT: usb_config_descriptor
-  PACKED-FIELD: uchar  bLength ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bDescriptorType ! __attribute__ ((packed))
-  PACKED-FIELD: ushort wTotalLength ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bNumInterfaces !  __attribute__ ((packed))
-  PACKED-FIELD: uchar  bConfigurationValue ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  iConfiguration ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bmAttributes ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  MaxPower ! __attribute__ ((packed))
-
-  FIELD: void*  interface
-
-  FIELD: uchar* extra
-  FIELD: int extralen
-END-STRUCT
-
-BEGIN-STRUCT: usb_device
-  FIELD: void* next
-  FIELD: void* prev
-  FIELD: char[1025] filename
-  FIELD: usb_bus* bus
-  FIELD: usb_device_descriptor descriptor
-  FIELD: usb_config_descriptor* config
-  FIELD: void* dev
-  FIELD: uchar devnum
-  FIELD: uchar num_children
-  FIELD: void* children
-END-STRUCT
-
diff --git a/libs/usb/usb-unix.factor b/libs/usb/usb-unix.factor
deleted file mode 100644 (file)
index 239c806..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: usb
-USING: kernel alien ;
-
-"usb" "libusb.so" "cdecl" add-library
-
-LIBRARY: usb
-
-BEGIN-STRUCT: usb_bus
-  FIELD: void*      next
-  FIELD: void*      prev       
-  FIELD: char[4097] dirname
-  FIELD: void*      devices
-  FIELD: uint       location
-  FIELD: void*      root_dev
-END-STRUCT
-
-! __attribute__ ((packed))
-BEGIN-STRUCT: usb_device_descriptor
-  PACKED-FIELD: uchar bLength
-  PACKED-FIELD: uchar bDescriptorType
-  PACKED-FIELD: ushort bcdUSB
-  PACKED-FIELD: uchar  bDeviceClass
-  PACKED-FIELD: uchar  bDeviceSubClass
-  PACKED-FIELD: uchar  bDeviceProtocol
-  PACKED-FIELD: uchar  bMaxPacketSize0
-  PACKED-FIELD: ushort idVendor
-  PACKED-FIELD: ushort idProduct
-  PACKED-FIELD: ushort bcdDevice;
-  PACKED-FIELD: uchar  iManufacturer
-  PACKED-FIELD: uchar  iProduct
-  PACKED-FIELD: uchar  iSerialNumber
-  PACKED-FIELD: uchar  bNumConfigurations
-END-STRUCT
-
-BEGIN-STRUCT: usb_config_descriptor
-  PACKED-FIELD: uchar  bLength ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bDescriptorType ! __attribute__ ((packed))
-  PACKED-FIELD: ushort wTotalLength ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bNumInterfaces !  __attribute__ ((packed))
-  PACKED-FIELD: uchar  bConfigurationValue ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  iConfiguration ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bmAttributes ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  MaxPower ! __attribute__ ((packed))
-
-  FIELD: void*  interface
-
-  FIELD: uchar* extra
-  FIELD: int extralen
-END-STRUCT
-
-BEGIN-STRUCT: usb_device
-  FIELD: void* next
-  FIELD: void* prev
-  FIELD: char[4097] filename
-  FIELD: usb_bus* bus
-  FIELD: usb_device_descriptor descriptor
-  FIELD: usb_config_descriptor* config
-  FIELD: void* dev
-  FIELD: uchar devnum
-  FIELD: uchar num_children
-  FIELD: void* children
-END-STRUCT
\ No newline at end of file
diff --git a/libs/usb/usb-win32.factor b/libs/usb/usb-win32.factor
deleted file mode 100644 (file)
index e75a930..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: usb
-USING: kernel alien ;
-
-"usb" "libusb.dll" "cdecl" add-library
-
-LIBRARY: usb
-
-BEGIN-STRUCT: usb_bus
-  FIELD: void*      next
-  FIELD: void*      prev       
-  FIELD: char[261] dirname
-  FIELD: void*      devices
-  FIELD: uint       location
-  FIELD: void*      root_dev
-END-STRUCT
-
-! __attribute__ ((packed))
-BEGIN-STRUCT: usb_device_descriptor
-  PACKED-FIELD: uchar bLength
-  PACKED-FIELD: uchar bDescriptorType
-  PACKED-FIELD: ushort bcdUSB
-  PACKED-FIELD: uchar  bDeviceClass
-  PACKED-FIELD: uchar  bDeviceSubClass
-  PACKED-FIELD: uchar  bDeviceProtocol
-  PACKED-FIELD: uchar  bMaxPacketSize0
-  PACKED-FIELD: ushort idVendor
-  PACKED-FIELD: ushort idProduct
-  PACKED-FIELD: ushort bcdDevice;
-  PACKED-FIELD: uchar  iManufacturer
-  PACKED-FIELD: uchar  iProduct
-  PACKED-FIELD: uchar  iSerialNumber
-  PACKED-FIELD: uchar  bNumConfigurations
-END-STRUCT
-
-BEGIN-STRUCT: usb_config_descriptor
-  PACKED-FIELD: uchar  bLength ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bDescriptorType ! __attribute__ ((packed))
-  PACKED-FIELD: ushort wTotalLength ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bNumInterfaces !  __attribute__ ((packed))
-  PACKED-FIELD: uchar  bConfigurationValue ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  iConfiguration ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  bmAttributes ! __attribute__ ((packed))
-  PACKED-FIELD: uchar  MaxPower ! __attribute__ ((packed))
-
-  FIELD: void*  interface
-
-  FIELD: uchar* extra
-  FIELD: int extralen
-END-STRUCT
-
-BEGIN-STRUCT: usb_device
-  FIELD: void* next
-  FIELD: void* prev
-  FIELD: char[261] filename
-  FIELD: usb_bus* bus
-  FIELD: usb_device_descriptor descriptor
-  FIELD: usb_config_descriptor* config
-  FIELD: void* dev
-  FIELD: uchar devnum
-  FIELD: uchar num_children
-  FIELD: void* children
-END-STRUCT
-
diff --git a/libs/usb/usb.factor b/libs/usb/usb.factor
deleted file mode 100644 (file)
index 8df17f0..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-!
-IN: usb
-USING: kernel alien io math arrays sequences ;
-
-LIBRARY: usb
-
-TYPEDEF: void* usb_dev_handle*
-
-FUNCTION: usb_dev_handle* usb_open ( usb_device* dev ) ;
-FUNCTION: int usb_close ( usb_dev_handle* dev ) ;
-FUNCTION: int usb_get_string ( usb_dev_handle* dev, int index, int langid, char *buf, int buflen ) ;
-FUNCTION: int usb_get_string_simple ( usb_dev_handle* dev, int index, char* buf, int buflen ) ;
-
-FUNCTION: int usb_get_descriptor_by_endpoint ( usb_dev_handle* udev, int ep, uchar type, uchar index, void* buf, int size ) ;
-FUNCTION: int usb_get_descriptor ( usb_dev_handle* udev, uchar type, uchar index, void* buf, int size ) ;
-
-FUNCTION: int usb_bulk_write ( usb_dev_handle* dev, int ep, void* bytes, int size, int timeout ) ;
-FUNCTION: int usb_bulk_read ( usb_dev_handle* dev, int ep, void* bytes, int size, int timeout ) ;
-FUNCTION: int usb_interrupt_write ( usb_dev_handle* dev, int ep, char* bytes, int size, int timeout ) ;
-FUNCTION: int usb_interrupt_read ( usb_dev_handle* dev, int ep, char* bytes, int size, int timeout ) ;
-FUNCTION: int usb_control_msg ( usb_dev_handle* dev, int requesttype, int request, int value, int index, char* bytes, int size, int timeout ) ;
-FUNCTION: int usb_set_configuration ( usb_dev_handle* dev, int configuration ) ;
-FUNCTION: int usb_claim_interface ( usb_dev_handle* dev, int interface ) ;
-FUNCTION: int usb_release_interface ( usb_dev_handle* dev, int interface ) ;
-FUNCTION: int usb_set_altinterface ( usb_dev_handle* dev, int alternate ) ;
-FUNCTION: int usb_resetep ( usb_dev_handle* dev, uint ep ) ;
-FUNCTION: int usb_clear_halt ( usb_dev_handle* dev, uint ep ) ;
-FUNCTION: int usb_reset ( usb_dev_handle* dev ) ;
-FUNCTION: int usb_get_driver_np ( usb_dev_handle* dev, int interface, char* name, uint namelen ) ;
-FUNCTION: char* usb_strerror ( ) ;
-
-FUNCTION: void usb_init ( ) ;
-FUNCTION: void usb_set_debug ( int level ) ;
-FUNCTION: int usb_find_busses (  ) ;
-FUNCTION: int usb_find_devices ( ) ;
-FUNCTION: usb_device* usb_device ( usb_dev_handle* dev ) ;
-FUNCTION: usb_bus* usb_get_busses ( ) ;
-
-: bus-each ( usb_bus quot -- ) 
-  [ call ] 2keep >r usb_bus-next r> over [ bus-each ] [ 2drop ] if ;
-
-: device-each ( usb_device quot -- )
-  [ call ] 2keep >r usb_device-next r> over [ device-each ] [ 2drop ] if ;
-
-: vendor-id-matches? ( id usb_device -- bool )
-  usb_device-descriptor usb_device_descriptor-idVendor = ;
-
-: product-id-matches? ( id usb_device  -- bool )
-  usb_device-descriptor usb_device_descriptor-idProduct = ;
-
-: is-device? ( vendor-id product-id usb_device -- bool )
-  tuck product-id-matches? >r vendor-id-matches? r> and ;
-
-: find-devices ( vendor-id product-id -- seq )
-  2array
-  V{ } clone
-  usb_get_busses [
-    usb_bus-devices [
-      pick first2 pick is-device? [
-        over push
-      ] [
-        drop
-      ] if
-    ] device-each
-  ] bus-each nip ;
-
-: init ( -- )
-  #! Initialize libusb and find devices and busses
-  usb_init usb_find_busses drop usb_find_devices drop ;
-       
-: display-devices ( -- )
-  #! Example function to list all usb devices on system
-  usb_get_busses [
-    dup usb_bus-dirname write " - " write 
-    usb_bus-devices [
-      terpri "  " write
-      dup usb_device-filename write 
-      " - " write 
-      dup usb_device-descriptor usb_device_descriptor-bLength number>string write 
-      " - " write 
-      dup usb_device-descriptor usb_device_descriptor-idVendor >hex write 
-      " - " write 
-      usb_device-descriptor usb_device_descriptor-idProduct >hex write
-    ] device-each
-    terpri
-  ] bus-each ;
diff --git a/libs/usb/usb.facts b/libs/usb/usb.facts
deleted file mode 100644 (file)
index 72f159b..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-! Copyright (C) 2006 Chris Double.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: help usb ;
-
-HELP: bus-each 
-{ $values { "usb_bus" "an alien pointing to a usb_bus structure" } { "quot" "A quotation with stack effect " { $snippet "( usb_bus -- )" } } }
-{ $description "Starting with the given usb_bus, traverse the linked list of busses calling the quotation on each one." } 
-{ $examples
-  { $example "usb_get_busses [ display-devices ]" }
-}
-{ $see-also device-each find-devices } ;
-
-HELP: device-each 
-{ $values { "usb_device" "an alien pointing to a usb_device structure" } { "quot" "A quotation with stack effect " { $snippet "( usb_device -- )" } } }
-{ $description "Starting with the given usb_device, traverse the linked list of devices calling the quotation on each one." } 
-{ $examples
-  { $example "usb_get_busses [\n  usb_bus-devices [ display-device ]\n] bus-each" }
-}
-{ $see-also bus-each find-devices } ;
-
-HELP: vendor-id-matches?
-{ $values { "id" "the integer vendor id" } { "usb_device" "an alien pointing to a usb_device structure" } { "bool" "a boolean" } }
-{ $description "Return true if the device has the given vendor id." } 
-{ $see-also product-id-matches? is-device? } ;
-
-HELP: product-id-matches?
-{ $values { "id" "the integer product id" } { "usb_device" "an alien pointing to a usb_device structure" } { "bool" "a boolean" } }
-{ $description "Return true if the device has the given product id." } 
-{ $see-also vendor-id-matches? is-device? } ;
-
-HELP: is-device?
-{ $values { "vendor-id" "the integer vendor id" } { "product-id" "the integer product-id" } { "usb_device" "an alien pointing to a usb_device structure" } { "bool" "a boolean" } }
-{ $description "Return true if the device has the given vendor and product id." } 
-{ $see-also vendor-id-matches? product-id-matches? } ;
-
-HELP: find-devices 
-{ $values { "vendor-id" "the integer vendor id for the device to find" } { "product-id" "the integer product id for the device to find" } { "seq" "a sequence containing the usb_devices found" } }
-{ $description "Traverse the devices on all USB busses looking for a device with the given vendor and product id's. Return a sequence containing all the usb_device structures found matcing the vendor and product id's." } 
-{ $examples
-  { $example "HEX: 10D6 HEX: 1100 find-devices" }
-}
-{ $see-also bus-each device-each } ;
-
diff --git a/libs/vars.factor b/libs/vars.factor
deleted file mode 100644 (file)
index 2cf6751..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-! Copyright (C) 2005, 2006 Eduardo Cavazos
-
-! Thanks to Mackenzie Straight for the idea
-
-USING: kernel parser words namespaces sequences ;
-
-IN: vars
-
-: define-var-symbol ( str -- ) create-in define-symbol ;
-
-: define-var-getter ( str -- )
-dup ">" append create-in swap in get lookup [ get ] curry define-compound ;
-
-: define-var-setter ( str -- )
-">" over append create-in swap in get lookup [ set ] curry define-compound ;
-
-: define-var ( str -- )
-dup define-var-symbol dup define-var-getter define-var-setter ;
-
-: VAR: ! var
-    scan define-var ; parsing
-
-: define-vars ( seq -- ) [ define-var ] each ;
-
-: VARS: ! vars ...
-string-mode on [ string-mode off define-vars ] f ; parsing
-
-: let ( vars body -- result )
-[ >r <reversed> [ set ] each r> call ] with-scope ;
-
-PROVIDE: libs/vars ;
\ No newline at end of file
diff --git a/libs/vim/factor.vim b/libs/vim/factor.vim
deleted file mode 100644 (file)
index 3bbb946..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-" Vim syntax file
-" Language:    factor
-" Maintainer:  Alex Chapman <chapman.alex@gmail.com>
-" Last Change: 2006 Mar 23
-
-" For version 5.x: Clear all syntax items
-" For version 6.x: Quit when a syntax file was already loaded
-if version < 600
-  syntax clear
-elseif exists("b:current_syntax")
-  finish
-endif
-
-" factor is case sensitive.
-syn case match
-
-"is there a better way to make vim treat any non-whitespace char as part of a word?
-setlocal iskeyword+=-
-setlocal iskeyword+=+
-setlocal iskeyword+=(
-setlocal iskeyword+=)
-setlocal iskeyword+=>
-setlocal iskeyword+=<
-setlocal iskeyword+=?
-setlocal iskeyword+=_
-setlocal iskeyword+=,
-setlocal iskeyword+=:
-setlocal iskeyword+=#
-setlocal iskeyword+=&
-setlocal iskeyword+=\[
-setlocal iskeyword+=\]
-setlocal iskeyword+=\/
-setlocal iskeyword+=\{
-setlocal iskeyword+=\}
-setlocal iskeyword+=\.
-setlocal iskeyword+=\!
-setlocal iskeyword+=\$
-setlocal iskeyword+=\^
-
-
-syn cluster factorCluster contains=factorComment,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorColon,factorDefn,factorDefnBody,factorDefnEnd,factorString,@factorNumber
-
-" Script headers highlighted like comments
-syn match factorComment /\<#! .*/ contains=factorTodo
-syn match factorComment /\<! .*/ contains=factorTodo
-syn keyword factorTodo TODO FIXME XXX contained
-
-syn keyword factorBoolean      boolean f general-t t
-
-" use this to have keywords as all words from all vocabs (currently broken by | characters)
-
-
-" use this to only have keywords highlighted from the kernel vocab
-syn keyword factorKeyword continuation-name set-datastack <empty-continuation> wrapper set-continuation-name continuation-catch slip pick 2slip tuple 2nip set-boot clone with-datastack cpu cli-bool-param default-cli-args tuck -rot set-continuation-retain swapd <continuation> >boolean wrapper? ifcc dupd dup 3dup callstack windows? os-env over = <wrapper> ? 2dup alist>quot continuation cond win64? <quotation> continue run-user-init 3drop xor quotation when hashcode curry cli-param default-shell millis set-callstack unless >r version die callcc0 or os callcc1 ignore-cli-args? depth 3keep no-cond? cli-var-param continue-with if exit tuple? unix? set-retainstack cli-args general-t continuation? <no-cond> parse-command-line macosx? r> rot win32? retainstack 2apply >quotation >continuation< type continuation-call clear no-cond call continuation-data 2drop set-continuation-call drop unit set-continuation-data keep-datastack and when* cli-arg quotation? ?if 2swap literalize swap set-continuation-catch datastack unless* not eq? continuation-retain with make-dip wrapped keep 2keep <=> nip if* 
-
-
-syn cluster factorNumber contains=factorInt,factorFloat,factorRatio,factorComplex
-syn cluster factorReal   contains=factorInt,factorFloat,factorRatio
-syn match   factorInt          /\<-\=\d\+\>/
-syn match   factorFloat                /\<-\=\d*\.\d\+\>/
-syn match   factorRatio                /\<-\=\d*\.*\d\+\/-\=\d*\.*\d\+\>/
-syn region  factorComplex      start=/\<C{\>/ end=/\<}\>/ contains=@factorReal,factorComplexErr
-
-"syn region factorColon matchgroup=Keyword start=/\<:\s\+\S\+\>/ matchgroup=Keyword end=/\<;\>/ contains=ALL
-
-syn region factorString start=/"/ skip=/\\"/ end=/"/ oneline
-syn region factorComment start=/\<(\>/ end=/\<)\>/
-
-syn region factorCons     matchgroup=Delimiter start=/\<\[\[\>/  matchgroup=Delimiter end=/\<\]\]\>/ contains=ALL
-syn region factorVector   matchgroup=Delimiter start=/\<V{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-syn region factorHash     matchgroup=Delimiter start=/\<H{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-syn region factorTuple    matchgroup=Delimiter start=/\<T{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-syn region factorWrapper  matchgroup=Delimiter start=/\<W{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-
-"adapted from lisp.vim
-if exists("g:factor_norainbow") 
-    syn region factorQuotation matchgroup=Delimiter start=/\<\[\>/ matchgroup=Delimiter end=/\<\]\>/ contains=ALL
-else
-    syn region factorQuotation0           matchgroup=hlLevel0 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1
-    syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2
-    syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3
-    syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4
-    syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5
-    syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6
-    syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7
-    syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8
-    syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9
-    syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0
-endif
-
-if exists("g:factor_norainbow") 
-    syn region factorArray    matchgroup=Delimiter start=/\<{\>/  matchgroup=Delimiter end=/\<}\>/ contains=ALL
-else
-    syn region factorArray0           matchgroup=hlLevel0 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray1
-    syn region factorArray1 contained matchgroup=hlLevel1 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray2
-    syn region factorArray2 contained matchgroup=hlLevel2 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray3
-    syn region factorArray3 contained matchgroup=hlLevel3 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray4
-    syn region factorArray4 contained matchgroup=hlLevel4 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray5
-    syn region factorArray5 contained matchgroup=hlLevel5 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray6
-    syn region factorArray6 contained matchgroup=hlLevel6 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray7
-    syn region factorArray7 contained matchgroup=hlLevel7 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray8
-    syn region factorArray8 contained matchgroup=hlLevel8 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray9
-    syn region factorArray9 contained matchgroup=hlLevel9 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray0
-endif
-
-syn match factorQuotationError /\<\]\>/
-
-syn sync lines=100
-
-if version >= 508 || !exists("did_factor_syn_inits")
-    if version <= 508
-       let did_factor_syn_inits = 1
-       command -nargs=+ HiLink hi link <args>
-    else
-       command -nargs=+ HiLink hi def link <args>
-    endif
-
-    HiLink factorComment       Comment
-    HiLink factorTodo          Todo
-    HiLink factorInclude       Include
-    HiLink factorRepeat                Repeat
-    HiLink factorConditional   Conditional
-    HiLink factorKeyword       Keyword
-    HiLink factorOperator      Operator
-    HiLink factorBoolean       Boolean
-"    HiLink factorColon                Typedef
-    HiLink factorDefn          Function
-    HiLink factorDefnEnd       Typedef
-    HiLink factorString                String
-    HiLink factorQuotationError Error
-    HiLink factorInt           Number
-    HiLink factorFloat         Float
-    HiLink factorRatio         Number
-    HiLink factorComplex       Number
-    HiLink factorComplexErr    Error
-
-    if &bg == "dark"
-       hi   hlLevel0 ctermfg=red         guifg=red1
-       hi   hlLevel1 ctermfg=yellow      guifg=orange1
-       hi   hlLevel2 ctermfg=green       guifg=yellow1
-       hi   hlLevel3 ctermfg=cyan        guifg=greenyellow
-       hi   hlLevel4 ctermfg=magenta     guifg=green1
-       hi   hlLevel5 ctermfg=red         guifg=springgreen1
-       hi   hlLevel6 ctermfg=yellow      guifg=cyan1
-       hi   hlLevel7 ctermfg=green       guifg=slateblue1
-       hi   hlLevel8 ctermfg=cyan        guifg=magenta1
-       hi   hlLevel9 ctermfg=magenta     guifg=purple1
-    else
-       hi   hlLevel0 ctermfg=red         guifg=red3
-       hi   hlLevel1 ctermfg=darkyellow  guifg=orangered3
-       hi   hlLevel2 ctermfg=darkgreen   guifg=orange2
-       hi   hlLevel3 ctermfg=blue        guifg=yellow3
-       hi   hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
-       hi   hlLevel5 ctermfg=red         guifg=green4
-       hi   hlLevel6 ctermfg=darkyellow  guifg=paleturquoise3
-       hi   hlLevel7 ctermfg=darkgreen   guifg=deepskyblue4
-       hi   hlLevel8 ctermfg=blue        guifg=darkslateblue
-       hi   hlLevel9 ctermfg=darkmagenta guifg=darkviolet
-    endif
-
-    delcommand HiLink
-endif
-
-let b:current_syntax = "factor"
-
diff --git a/libs/vim/factor.vim.fgen b/libs/vim/factor.vim.fgen
deleted file mode 100644 (file)
index 2897bb4..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-" Vim syntax file
-" Language:    factor
-" Maintainer:  Alex Chapman <chapman.alex@gmail.com>
-" Last Change: 2006 Mar 23
-
-" For version 5.x: Clear all syntax items
-" For version 6.x: Quit when a syntax file was already loaded
-if version < 600
-  syntax clear
-elseif exists("b:current_syntax")
-  finish
-endif
-
-" factor is case sensitive.
-syn case match
-
-"is there a better way to make vim treat any non-whitespace char as part of a word?
-<%
-    "-+()><?_,:#&" [ [ "setlocal iskeyword+="   % , ] "" make print ] each
-    "[]/{}.!$^"    [ [ "setlocal iskeyword+=\\" % , ] "" make print ] each
-%>
-
-syn cluster factorCluster contains=factorComment,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorColon,factorDefn,factorDefnBody,factorDefnEnd,factorString,@factorNumber
-
-" Script headers highlighted like comments
-syn match factorComment /\<#! .*/ contains=factorTodo
-syn match factorComment /\<! .*/ contains=factorTodo
-syn keyword factorTodo TODO FIXME XXX contained
-
-syn keyword factorBoolean      boolean f general-t t
-
-" use this to have keywords as all words from all vocabs (currently broken by | characters)
-<% ! vocabs [ words [ "syn keyword factorKeyword " write [ pprint " " write ] each "\n" write ] when* ] each %>
-
-" use this to only have keywords highlighted from the kernel vocab
-<% "kernel" words "syn keyword factorKeyword " write [ pprint " " write ] each "\n" write %>
-
-syn cluster factorNumber contains=factorInt,factorFloat,factorRatio,factorComplex
-syn cluster factorReal   contains=factorInt,factorFloat,factorRatio
-syn match   factorInt          /\<-\=\d\+\>/
-syn match   factorFloat                /\<-\=\d*\.\d\+\>/
-syn match   factorRatio                /\<-\=\d*\.*\d\+\/-\=\d*\.*\d\+\>/
-syn region  factorComplex      start=/\<C{\>/ end=/\<}\>/ contains=@factorReal,factorComplexErr
-
-"syn region factorColon matchgroup=Keyword start=/\<:\s\+\S\+\>/ matchgroup=Keyword end=/\<;\>/ contains=ALL
-
-syn region factorString start=/"/ skip=/\\"/ end=/"/ oneline
-syn region factorComment start=/\<(\>/ end=/\<)\>/
-
-syn region factorCons     matchgroup=Delimiter start=/\<\[\[\>/  matchgroup=Delimiter end=/\<\]\]\>/ contains=ALL
-syn region factorVector   matchgroup=Delimiter start=/\<V{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-syn region factorHash     matchgroup=Delimiter start=/\<H{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-syn region factorTuple    matchgroup=Delimiter start=/\<T{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-syn region factorWrapper  matchgroup=Delimiter start=/\<W{\>/ matchgroup=Delimiter end=/\<}\>/ contains=ALL
-
-"adapted from lisp.vim
-if exists("g:factor_norainbow") 
-    syn region factorQuotation matchgroup=Delimiter start=/\<\[\>/ matchgroup=Delimiter end=/\<\]\>/ contains=ALL
-else
-    syn region factorQuotation0           matchgroup=hlLevel0 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1
-    syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2
-    syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3
-    syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4
-    syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5
-    syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6
-    syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7
-    syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8
-    syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9
-    syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0
-endif
-
-if exists("g:factor_norainbow") 
-    syn region factorArray    matchgroup=Delimiter start=/\<{\>/  matchgroup=Delimiter end=/\<}\>/ contains=ALL
-else
-    syn region factorArray0           matchgroup=hlLevel0 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray1
-    syn region factorArray1 contained matchgroup=hlLevel1 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray2
-    syn region factorArray2 contained matchgroup=hlLevel2 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray3
-    syn region factorArray3 contained matchgroup=hlLevel3 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray4
-    syn region factorArray4 contained matchgroup=hlLevel4 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray5
-    syn region factorArray5 contained matchgroup=hlLevel5 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray6
-    syn region factorArray6 contained matchgroup=hlLevel6 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray7
-    syn region factorArray7 contained matchgroup=hlLevel7 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray8
-    syn region factorArray8 contained matchgroup=hlLevel8 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray9
-    syn region factorArray9 contained matchgroup=hlLevel9 start=/\<{\>/ end=/\<}\>/ contains=@factorCluster,factorArray0
-endif
-
-syn match factorQuotationError /\<\]\>/
-
-syn sync lines=100
-
-if version >= 508 || !exists("did_factor_syn_inits")
-    if version <= 508
-       let did_factor_syn_inits = 1
-       command -nargs=+ HiLink hi link <args>
-    else
-       command -nargs=+ HiLink hi def link <args>
-    endif
-
-    HiLink factorComment       Comment
-    HiLink factorTodo          Todo
-    HiLink factorInclude       Include
-    HiLink factorRepeat                Repeat
-    HiLink factorConditional   Conditional
-    HiLink factorKeyword       Keyword
-    HiLink factorOperator      Operator
-    HiLink factorBoolean       Boolean
-"    HiLink factorColon                Typedef
-    HiLink factorDefn          Function
-    HiLink factorDefnEnd       Typedef
-    HiLink factorString                String
-    HiLink factorQuotationError Error
-    HiLink factorInt           Number
-    HiLink factorFloat         Float
-    HiLink factorRatio         Number
-    HiLink factorComplex       Number
-    HiLink factorComplexErr    Error
-
-    if &bg == "dark"
-       hi   hlLevel0 ctermfg=red         guifg=red1
-       hi   hlLevel1 ctermfg=yellow      guifg=orange1
-       hi   hlLevel2 ctermfg=green       guifg=yellow1
-       hi   hlLevel3 ctermfg=cyan        guifg=greenyellow
-       hi   hlLevel4 ctermfg=magenta     guifg=green1
-       hi   hlLevel5 ctermfg=red         guifg=springgreen1
-       hi   hlLevel6 ctermfg=yellow      guifg=cyan1
-       hi   hlLevel7 ctermfg=green       guifg=slateblue1
-       hi   hlLevel8 ctermfg=cyan        guifg=magenta1
-       hi   hlLevel9 ctermfg=magenta     guifg=purple1
-    else
-       hi   hlLevel0 ctermfg=red         guifg=red3
-       hi   hlLevel1 ctermfg=darkyellow  guifg=orangered3
-       hi   hlLevel2 ctermfg=darkgreen   guifg=orange2
-       hi   hlLevel3 ctermfg=blue        guifg=yellow3
-       hi   hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
-       hi   hlLevel5 ctermfg=red         guifg=green4
-       hi   hlLevel6 ctermfg=darkyellow  guifg=paleturquoise3
-       hi   hlLevel7 ctermfg=darkgreen   guifg=deepskyblue4
-       hi   hlLevel8 ctermfg=blue        guifg=darkslateblue
-       hi   hlLevel9 ctermfg=darkmagenta guifg=darkviolet
-    endif
-
-    delcommand HiLink
-endif
-
-let b:current_syntax = "factor"
-
diff --git a/libs/vim/generate-vim-syntax.factor b/libs/vim/generate-vim-syntax.factor
deleted file mode 100644 (file)
index b6f5328..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-! Generate a new factor.vim file for syntax highlighting
-REQUIRES: libs/httpd ;
-
-IN: vim
-
-USING: embedded io ;
-
-"libs/vim/factor.vim.fgen" resource-path
-"libs/vim/factor.vim" resource-path
-embedded-convert
diff --git a/libs/vim/gvim7.factor b/libs/vim/gvim7.factor
deleted file mode 100644 (file)
index 568b4cf..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-USING: kernel namespaces ;
-IN: vim
-
-: vim-command ( file line -- string )
-    [
-        "\"" % vim-path get % "\" --remote-tab-silent " %
-        "+" % # " \"" % % "\"" %
-    ] "" make ;
diff --git a/libs/vim/load.factor b/libs/vim/load.factor
deleted file mode 100644 (file)
index 561748e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-REQUIRES: libs/process ;
-PROVIDE: libs/vim
-
-USING: kernel ;
-
-{ +files+ { "vim.factor" "vim.facts" { "gvim7.factor" [ win32? ] } } }
-{ +help+ { "vim" "vim" } } ;
diff --git a/libs/vim/vim.factor b/libs/vim/vim.factor
deleted file mode 100644 (file)
index ee65a0b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-IN: vim
-USING: definitions io kernel namespaces parser prettyprint
-process sequences ;
-
-SYMBOL: vim-path
-SYMBOL: vim-detach
-
-"vim" vim-path set-global
-
-: vim-command ( file line -- string )
-    [ "\"" % vim-path get % "\" \"" % swap % "\" +" % # ] "" make ;
-
-: vim-location ( file line -- )
-    vim-command
-    vim-detach get-global
-    [ run-detached ] [ run-process ] if ;
-
-[ vim-location ] edit-hook set-global
diff --git a/libs/vim/vim.facts b/libs/vim/vim.facts
deleted file mode 100644 (file)
index 351dff9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-IN: vim
-USING: definitions help io words ;
-
-ARTICLE: { "vim" "vim" } "Vim support"
-"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim-location } ". The " { $link vim-path } " variable contains the name of the vim executable.  The default " { $link vim-path } " is " { $snippet "\"vim\"" } "."
-$terpri
-"If you intend to use this module regularly, it helps to have it load during stage 2 bootstrap. On Windows, place the following example " { $snippet ".factor-boot-rc" } " in the directory returned by " { $link home } ":"
-{ $code
-"USING: modules namespaces ;"
-"REQUIRES: libs/vim ;"
-"USE: vim"
-"\"c:\\\\program files\\\\vim\\\\vim70\\\\gvim\" vim-path set-global"
-}
-"On Unix, you may omit the last line if " { $snippet "\"vim\"" } " is in your " { $snippet "$PATH" } "."
-$terpri
-"If you are running the terminal version of Vim, you want it to block Factor until exiting, but for GVim the opposite is desired, so that one can work in Factor and GVim concurrently. The " { $link vim-detach } " global variable can be set to " { $link t } " to detach the Vim process. The default is " { $link f } "." ;
-
diff --git a/libs/x11/concurrent-widgets.factor b/libs/x11/concurrent-widgets.factor
deleted file mode 100644 (file)
index 442a9b6..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-USING: io namespaces kernel hashtables math generic threads concurrency
-sequences arrays x11 x ;
-
-IN: concurrent-widgets
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: window display id ;
-
-: create-window-object ( -- <window> ) dpy get create-window <window> ;
-
-: with-window-object ( <window> quot -- )
-[ swap dup window-display dpy set window-id win set call ] with-scope ; inline
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! window-table add-to-window-table
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: window-table
-
-10 <hashtable> window-table set-global
-
-: add-to-window-table ( <window> -- ) dup window-id window-table get set-hash ;
-
-: clean-window-table ( -- )
-window-table get
-[ drop dup valid-window?+ [ drop ] [ window-table get remove-hash ] if ]
-hash-each ;
-
-! The window-table is keyed on window ids. If support is added for
-! multiple displays, then perhaps there should be a window table for
-! each open display.
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! handle-event
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-GENERIC: handle-key-press-event
-GENERIC: handle-key-release-event
-GENERIC: handle-button-press-event
-GENERIC: handle-button-release-event
-GENERIC: handle-expose-event
-GENERIC: handle-configure-event
-GENERIC: handle-enter-window-event
-GENERIC: handle-leave-window-event
-GENERIC: handle-destroy-window-event
-GENERIC: handle-map-request-event
-GENERIC: handle-map-event
-GENERIC: handle-configure-request-event
-GENERIC: handle-unmap-event
-GENERIC: handle-property-event
-
-: handle-event ( event obj -- )
-  over XAnyEvent-type
-  { { [ dup Expose = ]          [ drop handle-expose-event ] }
-    { [ dup KeyPress = ]        [ drop handle-key-press-event ] }
-    { [ dup KeyRelease = ]      [ drop handle-key-release-event ] }
-    { [ dup ButtonPress = ]     [ drop handle-button-press-event ] }
-    { [ dup ButtonRelease = ]   [ drop handle-button-release-event ] }
-    { [ dup ConfigureNotify = ]         [ drop handle-configure-event ] }
-    { [ dup EnterNotify = ]     [ drop handle-enter-window-event ] }
-    { [ dup LeaveNotify = ]     [ drop handle-leave-window-event ] }
-    { [ dup DestroyNotify = ]   [ drop handle-destroy-window-event ] }
-    { [ dup MapRequest = ]      [ drop handle-map-request-event ] }
-    { [ dup MapNotify = ]       [ drop handle-map-event ] }
-    { [ dup ConfigureRequest = ] [ drop handle-configure-request-event ] }
-    { [ dup UnmapNotify = ]      [ drop handle-unmap-event ] }
-    { [ dup PropertyNotify = ]   [ drop handle-property-event ] }
-    { [ t ] [ "handle-event ignoring event" print flush 3drop ] } }
-  cond ;
-
-M: window handle-configure-event ( event obj -- )
-  "Basic handle-configure-event called" print flush drop drop ;
-
-M: window handle-destroy-window-event ( event obj -- )
-  "Basic handle-destroy-window-event called" print flush drop drop ;
-
-M: window handle-map-event ( event obj -- )
-  "Basic handle-map-event called" print flush drop drop ;
-
-M: window handle-expose-event ( event obj -- )
-  "Basic handle-expose-event called" print flush drop drop ;
-
-M: window handle-button-release-event ( event obj -- )
-  "Basic handle-button-release-event called" print flush drop drop ;
-
-M: window handle-unmap-event ( event obj -- )
-  "Basic handle-unmap-event called" print flush drop drop ;
-
-M: window handle-key-press-event ( event obj -- )
-  "Basic handle-key-press-event called" print flush drop drop ;
-
-M: window handle-key-release-event ( event obj -- )
-  "Basic handle-key-release-event called" print flush drop drop ;
-
-M: window handle-enter-window-event ( event obj -- )
-  "Basic handle-enter-window-event called" print flush drop drop ;
-
-M: window handle-leave-window-event ( event obj -- )
-  "Basic handle-leave-window-event called" print flush drop drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-DEFER: draw-string%
-DEFER: draw-string-middle-center%
-DEFER: window-size%
-DEFER: window-children%
-DEFER: set-window-width%
-DEFER: set-window-height%
-DEFER: vertical-layout%
-DEFER: map-subwindows%
-DEFER: reparent-window%
-DEFER: unmap-window%
-DEFER: add-input%
-DEFER: select-input%
-DEFER: set-window-background%
-DEFER: clear-window%
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! <label>
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: label text ;
-
-: create-label ( text -- <label> )
-<label>
-create-window-object over set-delegate
-dup add-to-window-table
-ExposureMask over select-input% ;
-
-M: label handle-expose-event ( event <label> -- )
-nip
-[ window-size% { 1/2 1/2 } v* ] keep
-[ label-text ] keep
-[ draw-string-middle-center ] with-window-object ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! <button>
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: button action enter-color leave-color ;
-
-: create-button ( text action -- <button> )
-f f <button> swap create-label over set-delegate
-dup add-to-window-table
-ButtonPressMask EnterWindowMask bitor LeaveWindowMask bitor over add-input% ;
-
-M: button handle-button-press-event ( event <button> -- )
-nip button-action call ;
-
-M: button handle-enter-window-event ( event obj -- )
-dup button-enter-color 
-[ dup button-enter-color over set-window-background% dup clear-window%
-  handle-expose-event ]
-[ 2drop ] if ;
-
-M: button handle-leave-window-event ( event obj -- )
-dup button-leave-color 
-[ dup button-leave-color over set-window-background% dup clear-window%
-  handle-expose-event ]
-[ 2drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! <menu>
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: menu-enter-color
-SYMBOL: menu-leave-color
-
-TUPLE: menu item-width item-height space ;
-
-: create-menu ( -- <menu> )
-  create-window-object 100 20 1 <menu> [ set-delegate ] keep ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: set-menu-children-height ( menu -- )
-  dup menu-item-height swap window-children%
-  [ set-window-height+ ]
-  each-with ;
-
-: set-menu-children-width ( menu -- )
-  dup menu-item-width swap window-children%
-  [ set-window-width+ ]
-  each-with ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: center-menu-items ( menu -- )
-  window-children% [ center-window-horizontally+ ] each ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: set-menu-width ( menu -- )
-  dup menu-space 2 *
-  over menu-item-width +
-  swap set-window-width% ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: menu-items-height ( menu -- height )
-  dup window-children% length swap menu-item-height * ;
-
-: menu-space-height ( menu -- height )
-  dup window-children% length 1 - 2 +
-  swap menu-space * ;
-
-: menu-height ( menu -- height )
-  dup menu-items-height swap menu-space-height + ;
-
-: set-menu-height ( menu -- )
-  dup menu-height swap set-window-height% ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: refresh-menu ( menu -- )
-  dup set-menu-children-height
-  dup set-menu-children-width
-  dup set-menu-width
-  dup set-menu-height
-  dup menu-space over vertical-layout%
-  dup center-menu-items
-  map-subwindows% ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: add-menu-item ( text action menu -- )
-  -rot create-button
-  menu-enter-color get over set-button-enter-color
-  menu-leave-color get over set-button-leave-color
-  dupd reparent-window%
-  refresh-menu ;
-
-: modify-action-to-unmap ( action menu -- action )
-  [ unmap-window% ] curry append ;
-
-: add-popup-menu-item ( text action menu -- )
-  tuck modify-action-to-unmap
-  swap add-menu-item ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! <pwindow>
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! window with parameterizable responses to events
-
-TUPLE: pwindow resize-action last-size move-action last-position
-key-action button-action motion-action expose-action ;
-
-! resize-action ( { width height } <pwindow> -- )
-! move-action ( { x y } <pwindow> -- )
-
-: create-pwindow ( -- <pwindow> )
-create-window-object f f f f f f f f <pwindow> dup >r set-delegate r>
-dup add-to-window-table ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: XConfigureEvent-size ( event -- { width height } )
-dup XConfigureEvent-width swap XConfigureEvent-height 2array ;
-
-: XConfigureEvent-position ( event -- { x y } )
-dup XConfigureEvent-x swap XConfigureEvent-y 2array ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: size-changed? ( event obj -- ? )
-pwindow-last-size swap XConfigureEvent-size = not ;
-
-: update-last-size ( event obj -- )
-swap XConfigureEvent-size swap set-pwindow-last-size ;
-
-: call-resize-action ( event obj -- ? )
-swap XConfigureEvent-size swap dup pwindow-resize-action call ;
-
-: maybe-handle-resize ( event obj -- )
-2dup size-changed? [ 2dup update-last-size call-resize-action ] [ 2drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: position-changed? ( event obj -- ? )
-pwindow-last-position swap XConfigureEvent-position = not ;
-
-: update-last-position ( event obj -- )
-swap XConfigureEvent-position swap set-pwindow-last-position ;
-
-: call-move-action ( event obj -- ? )
-swap XConfigureEvent-position swap dup pwindow-move-action call ;
-
-: maybe-handle-move ! event obj
-2dup position-changed?
-[ 2dup update-last-position call-move-action ] [ 2drop ] if ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: pwindow handle-configure-event ( event obj -- )
-2dup maybe-handle-resize maybe-handle-move ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: pwindow handle-key-press-event ( event obj -- )
-dup pwindow-key-action call ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: pwindow handle-button-press-event ( event obj -- )
-dup pwindow-button-action call ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: pwindow handle-expose-event ( event obj -- )
-dup pwindow-expose-action call ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! event-loop
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! : event-loop ( -- )
-! next-event           ! event
-! dup                  ! event event
-! XAnyEvent-window     ! event window
-! window-table get     ! event window table
-! hash                 ! event obj-or-f
-! dup                  ! event obj-or-f obj-or-f
-! [ handle-event ]     
-! [ drop drop ]                ! event obj-or-f obj-or-f [ handle-event ] [ drop drop ]
-! if
-! event-loop ;
-
-! It's possible to have multiple displays open simultaneously.
-! Maybe there can be an event loop for each display. Each event loop
-! would run in it's own thread.
-
-: concurrent-next-event ( -- event )
-  ! QueuedAlready events-queued 0 >
-  QueuedAfterFlush events-queued 0 >
-  [ next-event ]
-  [ 100 sleep concurrent-next-event ]
-  if ;
-
-: concurrent-event-loop ( -- )
-  concurrent-next-event        ! event
-  dup                  ! event event
-  XAnyEvent-window     ! event window
-  window-table get     ! event window table
-  hash                 ! event obj-or-f
-  dup                  ! event obj-or-f obj-or-f
-  [ handle-event ]     
-  [ drop drop ]                ! event obj-or-f obj-or-f [ handle-event ] [ drop drop ]
-  if
-  concurrent-event-loop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Not categorized
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: set-window-width%            [ set-window-width ] with-window-object ;
-: set-window-height%           [ set-window-height ] with-window-object ;
-: set-window-gravity%          [ set-window-gravity ] with-window-object ;
-
-: select-input%                [ select-input ] with-window-object ;
-: add-input%                   [ add-input ] with-window-object ;
-: set-input-focus%             [ set-input-focus ] with-window-object ;
-: move-window%                         [ move-window ] with-window-object ;
-: resize-window%               [ resize-window ] with-window-object ;
-: set-window-border-width%     [ set-window-border-width ] with-window-object ;
-: map-window%                  [ map-window ] with-window-object ;
-: map-subwindows%              [ map-subwindows ] with-window-object ;
-: valid-window?%               [ valid-window? ] with-window-object ;
-: window-position%             [ window-position ] with-window-object ;
-: window-size%                 [ window-size ] with-window-object ;
-: window-rect%                 [ window-rect ] with-window-object ;
-: window-map-state%            [ window-map-state ] with-window-object ;
-: window-parent%               [ window-parent ] with-window-object ;
-
-: reparent-window% ( parent window -- )
-  >r window-id r> [ reparent-window ] with-window-object ;
-
-: destroy-window%              [ destroy-window ] with-window-object ;
-: raise-window%                        [ raise-window ] with-window-object ;
-: window-override-redirect%    [ window-override-redirect ] with-window-object ;
-: add-to-save-set%             [ add-to-save-set ] with-window-object ;
-: window-x%                    [ window-x ] with-window-object ;
-: window-y%                    [ window-y ] with-window-object ;
-: window-width%                        [ window-width ] with-window-object ;
-: window-height%               [ window-height ] with-window-object ;
-: unmap-window%                        [ unmap-window ] with-window-object ;
-: set-window-background%       [ set-window-background ] with-window-object ;
-: grab-pointer%                        [ grab-pointer ] with-window-object ;
-: mouse-sensor%                        [ mouse-sensor ] with-window-object ;
-: window-children%             [ window-children ] with-window-object ;
-
-: vertical-layout%             [ vertical-layout ] with-window-object ;
-
-: draw-string%                 [ draw-string ] with-window-object ;
-: draw-string-middle-center%   [ draw-string-middle-center ]
-                               with-window-object ;
-: draw-string-top-left%                [ draw-string-top-left ] with-window-object ;
-
-: get-transient-for-hint%      [ get-transient-for-hint ]
-                               with-window-object ;
-
-: fetch-name%                  [ fetch-name ] with-window-object ;
-
-: clear-window%                        [ clear-window ] with-window-object ;
-
-: init-widgets ( display-string -- )
-initialize-x [ concurrent-event-loop ] in-thread ;
\ No newline at end of file
diff --git a/libs/x11/draw-string.factor b/libs/x11/draw-string.factor
deleted file mode 100644 (file)
index ea72983..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-USING: kernel math arrays namespaces sequences x11 x rectangle ;
-
-IN: x
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: text-width ( string -- width ) font get swap dup length XTextWidth ;
-
-: string-size ( string -- size ) text-width font get font-height 2array ;
-
-: string-rect ( string -- rect ) string-size { 0 0 } swap <rect> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: base-point ( rect -- )
-  top-left font get XFontStruct-ascent 0 swap 2array v+ ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: draw-string-top-left ( point string -- )
-  dup string-rect swapd move-top-left base-point swap draw-string ;
-
-: draw-string-top-right ( point string -- )
-  dup string-rect swapd move-top-right base-point swap draw-string ;
-
-: draw-string-bottom-left ( point string -- )
-  dup string-rect swapd move-bottom-left base-point swap draw-string ;
-
-: draw-string-bottom-right ( point string -- )
-  dup string-rect swapd move-bottom-right base-point swap draw-string ;
-
-: draw-string-middle-center ( point string -- )
-  dup string-rect swapd move-middle-center base-point swap draw-string ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: draw-string-centered ( string -- )
-window-size { 1/2 1/2 } v* swap draw-string-middle-center ;
\ No newline at end of file
diff --git a/libs/x11/load.factor b/libs/x11/load.factor
deleted file mode 100644 (file)
index 2a04e7a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-REQUIRES: libs/concurrency ;
-
-PROVIDE: libs/x11
-{ +files+ {
-    "rectangle.factor"
-    "x.factor"
-    "draw-string.factor"
-    "concurrent-widgets.factor"
-} } ;
\ No newline at end of file
diff --git a/libs/x11/rectangle.factor b/libs/x11/rectangle.factor
deleted file mode 100644 (file)
index 57da392..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-USING: kernel math sequences arrays ; IN: rectangle
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-TUPLE: rect corner size ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-GENERIC: top-left
-GENERIC: top-right
-GENERIC: bottom-left
-GENERIC: bottom-right
-
-GENERIC: move-top-left
-GENERIC: move-top-right
-GENERIC: move-bottom-left
-GENERIC: move-bottom-right
-
-GENERIC: move-middle-center
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: rect-width ( rect -- width ) rect-size 0 swap nth ;
-
-: rect-height ( rect -- height ) rect-size 1 swap nth ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-M: rect top-left ( rect -- point ) rect-corner ;
-
-M: rect top-right ( rect -- point )
-dup rect-corner swap rect-width 1 - 0 2array v+ ;
-
-M: rect bottom-left ( rect -- point )
-dup rect-corner swap rect-height 1 - 0 swap 2array v+ ;
-
-M: rect bottom-right ( rect -- point )
-dup rect-corner swap rect-size { -1 -1 } v+ v+ ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: move-top-left:new-corner ( point rect -- corner )
-  drop ;
-
-M: rect move-top-left ( point rect -- corner )
-  tuck move-top-left:new-corner swap rect-size <rect> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: move-bottom-right:new-corner ( point rect -- corner )
-  rect-size { -1 -1 } v+ v- ;
-
-M: rect move-bottom-right ( point rect -- rect )
-  tuck move-bottom-right:new-corner swap rect-size <rect> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: move-top-right:new-corner ( point rect -- corner )
-  rect-size { -1 -1 } v+ { 1 0 } v* v- ;
-
-M: rect move-top-right ( point rect -- rect )
-  tuck move-top-right:new-corner swap rect-size <rect> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: move-bottom-left:new-corner ( point rect -- corner )
-  rect-size { -1 -1 } v+ { 0 1 } v* v- ;
-
-M: rect move-bottom-left ( point rect -- rect )
-  tuck move-bottom-left:new-corner swap rect-size <rect> ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: move-middle-center:new-corner ( point rect -- coener )
-  rect-size { 1/2 1/2 } v* { -1 -1 } v+ v- ;
-
-M: rect move-middle-center ( point rect -- rect )
-  tuck move-middle-center:new-corner swap rect-size <rect> ;
diff --git a/libs/x11/x.factor b/libs/x11/x.factor
deleted file mode 100644 (file)
index 671bf04..0000000
+++ /dev/null
@@ -1,605 +0,0 @@
-USING: alien namespaces kernel words compiler math arrays strings alien sequences io prettyprint x11 rectangle ;
-
-IN: x 
-
-SYMBOL: dpy
-SYMBOL: scr
-SYMBOL: root
-SYMBOL: gcontext
-SYMBOL: win
-SYMBOL: black-pixel
-SYMBOL: white-pixel
-SYMBOL: colormap
-
-SYMBOL: font
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: <ulong> <uint> ;
-: <XID> <ulong> ;
-: <Window> <XID> ;
-: <Drawable> <XID> ;
-
-: *ulong *uint ;
-: *XID *ulong ;
-: *Window *XID ;
-: *Drawable *XID ;
-
-: True 1 ;
-: False 0 ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 3 - Window Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 3.3 - Creating Windows
-
-! create-window is radically simple. It takes no arguments but you get
-! a window back! After you create-window you should modify it's
-! properties to liking, then do the flush. This way is opposed to
-! calling a create window function with all the properties as
-! arguments.
-
-: create-window ( -- win )
-  dpy get root get 0 0 100 100 0 black-pixel get white-pixel get
-  XCreateSimpleWindow ;
-
-: destroy-window ( -- ) dpy get win get XDestroyWindow drop ;
-
-: map-window ( -- ) dpy get win get XMapWindow drop ;
-
-: map-subwindows ( -- ) dpy get win get XMapSubwindows drop ;
-
-: unmap-window ( -- ) dpy get win get XUnmapWindow drop ;
-
-: unmap-subwindows ( -- ) dpy get win get XUnmapSubwindows drop ;
-
-! 3.7 - Configuring Windows
-
-: move-window ( { x y } -- ) dpy get win get rot first2 XMoveWindow drop ;
-
-DEFER: window-position
-DEFER: window-width
-DEFER: window-height
-DEFER: window-parent
-DEFER: with-win
-
-: set-window-x ( x -- ) 0 window-position dup >r set-nth r> move-window ;
-
-: set-window-y ( y -- ) 1 window-position dup >r set-nth r> move-window ;
-
-: set-window-center-x ( x -- ) window-width 2 / - set-window-x ;
-
-: center-window-horizontally
-  window-parent [ window-width ] with-win
-  2 / set-window-center-x ;
-
-: resize-window ( { width height } -- )
-dpy get win get rot first2 XResizeWindow drop ;
-
-: set-window-width ( width -- )
-  window-height 2array resize-window ;
-
-: set-window-height ( height -- )
-  window-width swap 2array resize-window ;
-
-: set-window-border-width ( width -- )
-  >r dpy get win get r> XSetWindowBorderWidth drop ;
-
-! 3.8 Changing Window Stacking Order
-
-: raise-window ( -- ) dpy get win get XRaiseWindow drop ;
-: lower-window ( -- ) dpy get win get XLowerWindow drop ;
-
-! 3.9 - Changing Window Attributes
-
-: change-window-attributes ( valuemask attr -- )
->r >r dpy get win get r> r> XChangeWindowAttributes drop ;
-
-: set-window-background ( pixel -- )
-  >r dpy get win get r> XSetWindowBackground drop ;
-
-: set-window-gravity ( gravity -- )
-CWWinGravity swap
-"XSetWindowAttributes" <c-object> tuck
-set-XSetWindowAttributes-win_gravity
-change-window-attributes ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 4 - Window Information Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 4.1 - Obtaining Window Information
-
-: window-children ( -- [ child child ... child ] )
-  dpy get win get 0 <uint> 0 <uint>
-  0 <uint> <void*>   0 <uint>   2dup >r >r
-  XQueryTree drop
-  r> r>                                        ! children-return nchildren-return
-  swap *void* swap *uint               ! children nchildren
-  [ over uint-nth ] map
-  swap drop ;
-
-: window-parent ( -- parent )
-  dpy get win get 0 <Window> 0 <Window> dup >r 0 <uint> <void*> 0 <uint>
-  XQueryTree drop
-  r> *Window ;
-
-: window-size ( -- { width height } )
-  dpy get win get 0 <Window> 0 <int> 0 <int>
-  0 <uint> 0 <uint> 2dup 2array >r
-  0 <uint> 0 <uint>
-  XGetGeometry drop r> [ *uint ] map ;
-
-: window-width 0 window-size nth ;
-
-: window-height 1 window-size nth ;
-
-: window-position ( -- { x y } )
-  dpy get win get 0 <Window>
-  0 <int> 0 <int> 2dup 2array >r
-  0 <uint> 0 <uint> 0 <uint> 0 <uint>
-  XGetGeometry drop r> [ *int ] map ;
-
-: window-x 0 window-position nth ;
-: window-y 1 window-position nth ;
-
-: window-rect ( -- <rect> ) window-position window-size <rect> ;
-
-: get-window-attributes ( -- <XWindowAttributes> )
-  dpy get win get "XWindowAttributes" <c-object> dup >r XGetWindowAttributes drop r> ;
-
-: window-root get-window-attributes XWindowAttributes-root ;
-
-: window-map-state
-  get-window-attributes XWindowAttributes-map_state ;
-
-: window-event-mask
-get-window-attributes XWindowAttributes-your_event_mask ;
-
-: window-all-event-masks
-get-window-attributes XWindowAttributes-all_event_masks ;
-
-: window-override-redirect
-  get-window-attributes XWindowAttributes-override_redirect ;
-
-! 4.3 - Properties and Atoms
-
-: intern-atom ( atom-name only-if-exists? -- atom )
->r >r dpy get r> r> XInternAtom ;
-
-: get-atom-name ( atom -- name ) dpy get swap XGetAtomName ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-SYMBOL: event-masks
-
-{ { "NoEventMask" 0 }
-  { "KeyPressMask" 1 }
-  { "KeyReleaseMask" 2 }
-  { "ButtonPressMask" 4 }
-  { "ButtonReleaseMask" 8 }
-  { "EnterWindowMask" 16 }
-  { "LeaveWindowMask" 32 }
-  { "PointerMotionMask" 64 }
-  { "PointerMotionHintMask" 128 }
-  { "Button1MotionMask" 256 }
-  { "Button2MotionMask" 512 }
-  { "Button3MotionMask" 1024 }
-  { "Button4MotionMask" 2048 }
-  { "Button5MotionMask" 4096 }
-  { "ButtonMotionMask" 8192 }
-  { "KeymapStateMask" 16384 }
-  { "ExposureMask" 32768 }
-  { "VisibilityChangeMask" 65536 }
-  { "StructureNotifyMask" 131072 }
-  { "ResizeRedirectMask" 262144 }
-  { "SubstructureNotifyMask" 524288 }
-  { "SubstructureRedirectMask" 1048576 }
-  { "FocusChangeMask" 2097152 }
-  { "PropertyChangeMask" 4194304 }
-  { "ColormapChangeMask" 8388608 }
-  { "OwnerGrabButtonMask" 16777216 }
-} event-masks set-global
-
-: bit-test ( a b -- t-or-f ) bitand 0 = not ;
-
-: name>event-mask ( str -- i )
-event-masks get [ first over = ] find 2nip second ;
-
-: event-mask>name ( i -- str )
-event-masks get [ second over = ] find 2nip first ;
-
-: event-mask-names ( -- seq ) event-masks get [ first ] map ;
-
-: event-mask>names ( mask -- seq )
-event-mask-names [ name>event-mask bit-test ] subset-with ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Pretty printing window information
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: print-field ( name value -- ) swap "=" append write pprint ;
-
-: print-window-geometry ( -- )
-window-width pprint "x" write window-height pprint "+" write
-window-x pprint "+" write window-y pprint ;
-
-: print-map-state ( -- )
-"map-state=" write
-window-map-state
-{ { [ dup 0 = ] [ drop "IsUnmapped" write ] }
-  { [ dup 1 = ] [ drop "IsUnviewable" write ] }
-  { [ dup 2 = ] [ drop "IsViewable" write ] }
-} cond ;
-
-: print-window-info ( -- )
-"id" win get print-field bl
-"parent" window-parent print-field bl
-"root" window-root print-field bl
-print-window-geometry terpri
-"children" window-children print-field terpri
-"override-redirect" window-override-redirect print-field bl
-print-map-state terpri
-"event-mask" window-event-mask event-mask>names print-field terpri
-"all-event-masks" window-all-event-masks event-mask>names print-field
-terpri ;
-
-: .win print-window-info ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 6 - Color Management Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: lookup-color ( name -- pixel )
->r dpy get colormap get r> "XColor" <c-object> dup >r "XColor" <c-object>
-XLookupColor drop
-dpy get colormap get r> dup >r XAllocColor drop r> XColor-pixel ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 7 - Graphics Context Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: create-gc ( -- GC ) dpy get win get 0 0 <alien> XCreateGC ;
-
-: set-foreground ( foreground -- )
-dpy get gcontext get rot XSetForeground drop ;
-
-: set-background ( background -- )
-dpy get gcontext get rot XSetBackground drop ;
-
-: set-function ( function -- ) dpy get gcontext get rot XSetFunction drop ;
-
-: set-subwindow-mode ( subwindow-mode -- )
-dpy get gcontext get rot XSetSubwindowMode drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 8 - Graphics Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: clear-window ( -- ) dpy get win get XClearWindow drop ;
-
-: draw-point ( { x y } -- )
->r dpy get win get gcontext get r> first2 XDrawPoint drop ;
-
-: draw-line ( { x1 y1 } { x2 y2 } -- )
->r >r dpy get win get gcontext get r> first2 r> first2 XDrawLine drop ;
-
-: 2nth ( i seq -- item-i item-i+1 ) 2dup nth -rot swap 1 + swap nth ;
-
-: draw-lines ( seq -- )
-dup length 1 - [ swap 2nth draw-line ] each-with ;
-
-: 4array 3array swap 1array swap append ;
-
-: 5array 4array swap 1array swap append ;
-
-: draw-rect ( rect -- )
-[ top-left ] keep [ top-right ] keep [ bottom-right ] keep
-[ bottom-left ] keep top-left 5array draw-lines ;
-
-: draw-rect+ [ draw-rect ] with-win ;
-
-! 8.5 - Font Metrics
-
-: load-query-font ( name -- <XFontStruct> ) dpy get swap XLoadQueryFont ;
-
-! : text-width ( <XFontStruct> string -- width ) dup length XTextWidth ;
-
-! : text-width ( string -- width ) font get swap dup length XTextWidth ;
-
-: font-height ( <XFontStruct> -- height )
-  dup XFontStruct-ascent swap XFontStruct-descent + ;
-
-! 8.6 - Drawing Text
-
-: draw-string ( { x y } string -- ) >r >r
-dpy get win get gcontext get r> first2 r> dup length XDrawString drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 9 - Window and Session Manager Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: reparent-window ( parent -- ) >r
-dpy get win get r> 0 0 XReparentWindow drop ;
-
-: add-to-save-set ( -- ) dpy get win get XAddToSaveSet drop ;
-
-: grab-server ( -- ) dpy get XGrabServer drop ;
-
-: ungrab-server ( -- ) dpy get XUngrabServer drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 10 - Events
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: event-types ( -- seq )
-{ f
-  f
-  "KeyPress"
-  "KeyRelease"
-  "ButtonPress"
-  "ButtonRelease"
-  "MotionNotify"
-  "EnterNotify"
-  "LeaveNotify"
-  "FocusIn"
-  "FocusOut"
-  "KeymapNotify"
-  "Expose"
-  "GraphicsExpose"
-  "NoExpose"
-  "VisibilityNotify"
-  "CreateNotify"
-  "DestroyNotify"
-  "UnmapNotify"
-  "MapNotify"
-  "MapRequest"
-  "ReparentNotify"
-  "ConfigureNotify"
-  "ConfigureRequest"
-  "GravityNotify"
-  "ResizeRequest"
-  "CirculateNotify"
-  "CirculateRequest"
-  "PropertyNotify"
-  "SelectionClear"
-  "SelectionRequest"
-  "SelectionNotify"
-  "ColormapNotify"
-  "ClientMessage"
-  "MappingNotify"
-  "LASTEvent" } ;
-
-: event-type>name ( i -- str ) event-types nth ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: XButtonEvent-position ( event -- { x y } )
-dup XButtonEvent-x swap XButtonEvent-y 2array ;
-
-: XButtonEvent-root-position ( event -- { x y } )
-dup XButtonEvent-x_root swap XButtonEvent-y_root 2array ;
-
-: XMotionEvent-position ( event -- { x y } )
-dup XMotionEvent-x swap XMotionEvent-y 2array ;
-
-: XMotionEvent-root-position ( event -- { x y } )
-dup XMotionEvent-x_root swap XMotionEvent-y_root 2array ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 11 - Event Handling Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: bitmask ( seq -- mask ) 0 [ execute bitor ] reduce ;
-  
-: select-input ( mask -- ) >r dpy get win get r> XSelectInput drop ;
-
-: add-input ( mask -- )
-window-event-mask bitor dpy get win get rot XSelectInput drop ;
-
-: flush-dpy ( -- ) dpy get XFlush drop ;
-
-: sync-dpy ( discard -- ) >r dpy get r> XSync ;
-
-: next-event ( -- event )
-dpy get "XEvent" <c-object> dup >r XNextEvent drop r> ;
-
-: mask-event ( mask -- event )
-  >r dpy get r> "XEvent" <c-object> dup >r XMaskEvent drop r> ;
-
-: events-queued ( mode -- n ) >r dpy get r> XEventsQueued ;
-
-! 11.8 - Handling Protocol Errors
-
-SYMBOL: error-handler-quot
-
-: error-handler-callback ( -- xt ) "void" { "Display*" "XErrorEvent*" }
-[ error-handler-quot get call ] alien-callback ; 
-
-: set-error-handler ( quot -- )
-error-handler-quot set error-handler-callback XSetErrorHandler drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 12 - Input Device Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! 12.1 - Pointer Grabbing
-
-: grab-pointer ( mask -- )
->r dpy get win get 0 r> GrabModeAsync GrabModeAsync None None CurrentTime
-XGrabPointer drop ;
-
-: ungrab-pointer ( time -- )
-  >r dpy get r> XUngrabPointer drop ;
-
-: change-active-pointer-grab ( mask -- )
-dpy get swap None CurrentTime XChangeActivePointerGrab drop ;
-
-! 12.2 -  Keyboard Grabbing
-
-: grab-key ( keycode modifiers owner-events pointer-mode keyboard-mode -- )
->r >r >r >r >r dpy get r> r> win get r> r> r> XGrabKey drop ;
-
-! 12.5 - Controlling Input Focus
-
-: set-input-focus ( revert-to time -- )
-  >r >r dpy get win get r> r> XSetInputFocus drop ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! 14 - Inter-Client Communication Functions
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: fetch-name ( -- name-or-f )
-  dpy get win get 0 <int> <void*> dup >r XFetchName drop r>
-  dup *void* alien-address 0 = [ drop f ] [ *char* ] if ;
-
-: get-transient-for-hint ( -- win-or-f )
-  dpy get win get 0 <Window> dup >r XGetTransientForHint r>
-  swap 0 = [ drop f ] [ *Window ] if ;
-
-! 14.1.10.  Setting and Reading the WM_PROTOCOLS Property
-
-: <Atom**> ( value -- address ) <Atom> <void*> ;
-
-: get-wm-protocols ( -- protocols )
-dpy get win get 0 <Atom**> 0 <int> 2dup >r >r XGetWMProtocols drop
-r> r>                          ! protocols-return count-return
-swap *void* swap *int          ! protocols count
-[ over int-nth ] map
-nip ;
-
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Not Categorized Yet
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: window-width+                        [ window-width ] with-win ;
-: window-height+               [ window-height ] with-win ;
-: move-window+                 [ move-window ] with-win ;
-: resize-window+               [ resize-window ] with-win ;
-: set-window-y+                        [ set-window-y ] with-win ;
-: set-window-width+            [ set-window-width ] with-win ;
-: set-window-height+           [ set-window-height ] with-win ;
-: center-window-horizontally+  [ center-window-horizontally ] with-win ;
-: window-children+             [ window-children ] with-win ;
-: window-map-state+            [ window-map-state ] with-win ;
-: destroy-window+              [ destroy-window ] with-win ;
-: map-window+                  [ map-window ] with-win ;
-: unmap-window+                        [ unmap-window ] with-win ;
-: window-parent+               [ window-parent ] with-win ;
-: fetch-name+                  [ fetch-name ] with-win ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: with-dpy ( dpy quot -- ) [ swap dpy set call ] with-scope ; inline
-: with-win ( win quot -- ) [ swap win set call ] with-scope ; inline
-
-: with-gcontext ( gcontext quot -- )
-[ swap gcontext set call ] with-scope ; inline
-
-: initialize-x ( display-string -- )
-  dup [ string>char-alien ] when XOpenDisplay dpy set
-  dpy get XDefaultScreen scr set
-  dpy get scr get XRootWindow root set
-  dpy get scr get XBlackPixel black-pixel set
-  dpy get scr get XWhitePixel white-pixel set
-  dpy get scr get XDefaultGC gcontext set
-  dpy get scr get XDefaultColormap colormap set
-  "6x13" load-query-font font set
-  dpy get gcontext get font get XFontStruct-fid XSetFont drop ;
-
-: stack-children ( -- )
-  window-children
-  [ [ { 0 0 } move-window ] with-win ]
-  each ;
-
-: arrange-children-horizontally ( -- )
-  0
-  window-children
-  [ [ dup set-window-x window-width + ] with-win ]
-  each ;
-
-: arrange-children-vertically ( -- )
-  0
-  window-children
-  [ [ dup set-window-y window-height + ] with-win ]
-  each ;
-
-: vertical-layout ( space -- )
-  dup                                          ! space y
-  window-children
-                                               ! space y child
-  [ 2dup                                       ! space y child y child
-    set-window-y+                              ! space y child
-    window-height+                             ! space y height
-    +                                          ! space new-y
-    dupd                                       ! space space new-y
-    + ]                                                ! space new-y
-  each
-  drop drop ;
-
-: valid-window? ( -- ? )
-dpy get win get "XWindowAttributes" <c-object> XGetWindowAttributes 0 = not ;
-
-: valid-window?+               [ valid-window? ] with-win ;
-
-: mouse-sensor ( -- { root-x root-y } )
-  dpy get win get 0 <Window> 0 <Window> 0 <int> 0 <int> 2dup >r >r
-  0 <int> 0 <int> 0 <uint> XQueryPointer drop r> *int r> *int 2array ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Windows and their children
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: seq-max ( v -- item ) dup 0 swap nth [ max ] reduce ;
-
-: seq-last ( v -- item ) dup length 1 - swap nth ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: widest-child-width ( window -- width )
-  window-children+ [ window-width+ ] map seq-max ;
-
-: tallest-child-height ( window -- height )
-  window-children+ [ window-height+ ] map seq-max ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: compare-window-width ( w w -- -1/0/1 )
-  window-width+ swap window-width+ swap < ;
-
-: sort-by-width ( window-seq -- seq ) [ compare-window-width ] sort ;
-
-: widest-child ( window -- child ) window-children+ sort-by-width seq-last ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: compare-window-height ( w w -- -1/0/1 )
-  window-height+ swap window-height+ swap < ;
-
-: sort-by-height ( window-seq -- seq ) [ compare-window-height ] sort ;
-
-: tallest-child ( window -- child ) window-children+ sort-by-height seq-last ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: char-array>string ( n <char-array> -- string )
-swap >array [ swap char-nth ] map-with >string ;
-
-: lookup-string ( event -- string )
-10 "char" <c-array> dup >r 10 f f XLookupString r>
-char-array>string ;
-
-: send-client-message ( atom x -- )
-
-"XClientMessageEvent" <c-object>                       ! atom x event
-
-ClientMessage over set-XClientMessageEvent-type
-win get over set-XClientMessageEvent-window
-rot over set-XClientMessageEvent-message_type          ! x event
-32 over set-XClientMessageEvent-format
-swap over set-XClientMessageEvent-data0                        ! event
-CurrentTime over set-XClientMessageEvent-data1         ! event
-
->r dpy get win get False NoEventMask r> XSendEvent drop ;
\ No newline at end of file
diff --git a/libs/xml-rpc/example.factor b/libs/xml-rpc/example.factor
deleted file mode 100644 (file)
index 0223dfd..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-IN: rpc-example
-REQUIRES: contrib/http-client contrib/calendar ;
-USING: kernel hashtables xml-rpc xml calendar sequences
-    arrays math httpd io http-client namespaces ;
-
-: functions
-    H{ { "add" [ + ] }
-       { "subtract" [ - ] }
-       { "multiply" [ * ] }
-       { "divide" [ / ] } } ;
-
-: apply-function ( name args -- {number} )
-    >r functions hash r> first2 rot call 1array ;
-
-: problem>solution ( xml-doc -- xml-doc )
-    receive-rpc dup rpc-method-name swap rpc-method-params
-    apply-function <rpc-response> send-rpc ;
-
-: respond-rpc-arith ( -- )
-    "raw-response" get
-    string>xml problem>solution xml>string
-    put-http-response ;
-
-: test-rpc-arith
-    "add" { 1 2 } <rpc-method> send-rpc xml>string
-    "text/xml" swap "http://localhost:8080/responder/rpc/"
-    http-post ;
diff --git a/libs/xml-rpc/load.factor b/libs/xml-rpc/load.factor
deleted file mode 100644 (file)
index 5faaa44..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-REQUIRES: libs/xml libs/base64 libs/http-client libs/httpd ;
-
-PROVIDE: libs/xml-rpc
-{ +files+ {
-    "xml-rpc.factor"
-    "xml-rpc.facts"
-} }
-{ +tests+ {
-    "test.factor"
-} } ;
diff --git a/libs/xml-rpc/test.factor b/libs/xml-rpc/test.factor
deleted file mode 100644 (file)
index de5ce3c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-USING: xml-rpc test ;
-
-[ T{ rpc-method f "blah" { 1 H{ { "2" 3 } { "5" "foobar" } } } } ]
-[ "blah" { 1 H{ { "2" 3 } { "5" "foobar" } } }
-    <rpc-method> send-rpc receive-rpc ] unit-test 
diff --git a/libs/xml-rpc/xml-rpc.factor b/libs/xml-rpc/xml-rpc.factor
deleted file mode 100644 (file)
index 161d41c..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-IN: xml-rpc
-USING: kernel xml arrays math errors errors generic http-client
-    hashtables namespaces io base64 sequences strings calendar ;
-
-! * Sending RPC requests
-! TODO: time
-! The word for what this does is "serialization"! Wow!
-
-GENERIC: item>xml ( object -- xml )
-
-M: integer item>xml
-    dup 2 31 ^ neg 2 31 ^ 1 - between?
-    [ "Integers must fit in 32 bits" throw ] unless
-    number>string "i4" build-tag ;
-
-PREDICATE: object boolean { t f } member? ;
-
-M: boolean item>xml
-    "1" "0" ? "boolean" build-tag ;
-
-M: float item>xml
-    number>string "double" build-tag ;
-
-M: string item>xml ! This should change < and &
-    "string" build-tag ;
-
-: struct-member ( name value -- tag )
-    swap dup string?
-    [ "Struct member name must be string" throw ] unless
-    "name" build-tag swap
-    item>xml "value" build-tag
-    2array "member" build-tag* ;
-
-M: hashtable item>xml
-    [ [ struct-member , ] hash-each ] { } make
-    "struct" build-tag* ;
-
-M: array item>xml
-    [ item>xml "value" build-tag ] map
-    "data" build-tag* "array" build-tag ;
-
-TUPLE: base64 string ;
-
-M: base64 item>xml
-    base64-string >base64 "base64" build-tag ;
-
-: params ( seq -- xml )
-    [ item>xml "value" build-tag "param" build-tag ] map
-    "params" build-tag* ;
-
-: method-call ( name seq -- xml )
-    params >r "methodName" build-tag r>
-    2array "methodCall" build-tag* build-xml-doc ;
-
-: return-params ( seq -- xml )
-    params "methodResponse" build-tag build-xml-doc ;
-
-: return-fault ( fault-code fault-string -- xml )
-    [ "faultString" set "faultCode" set ] make-hash item>xml
-    "value" build-tag "fault" build-tag "methodResponse" build-tag
-    build-xml-doc ;
-
-TUPLE: rpc-method name params ;
-TUPLE: rpc-response params ;
-TUPLE: rpc-fault code string ;
-
-GENERIC: send-rpc ( rpc -- xml )
-M: rpc-method send-rpc
-    [ rpc-method-name ] keep rpc-method-params method-call ;
-M: rpc-response send-rpc
-    rpc-response-params return-params ;
-M: rpc-fault send-rpc
-    [ rpc-fault-code ] keep rpc-fault-string return-fault ;
-
-! * Recieving RPC requests
-! this needs to have much better error checking
-
-TUPLE: server-error tag message ;
-M: server-error error.
-    "Error in XML supplied to server" print
-    "Description: " write dup server-error-message print
-    "Tag: " write server-error-tag xml>string print ;
-
-PROCESS: xml>item ( tag -- object )
-
-TAG: string xml>item
-    children>string ;
-
-TAG: i4/int/double xml>item
-    children>string string>number ;
-
-TAG: boolean xml>item
-    dup children>string {
-        { [ dup "1" = ] [ 2drop t ] }
-        { [ "0" = ] [ drop f ] }
-        { [ t ] [ "Bad boolean" <server-error> throw ] }
-    } cond ;
-
-: unstruct-member ( tag -- )
-    children-tags first2
-    first-child-tag xml>item
-    >r children>string r> swap set ;
-
-TAG: struct xml>item
-    [
-        children-tags [ unstruct-member ] each
-    ] make-hash ;
-
-TAG: base64 xml>item
-    children>string base64> <base64> ;
-
-TAG: array xml>item
-    first-child-tag children-tags
-    [ first-child-tag xml>item ] map ;
-
-: params>array ( tag -- array )
-    children-tags
-    [ first-child-tag first-child-tag xml>item ] map ;
-
-: parse-rpc-response ( xml-doc -- array )
-    first-child-tag params>array ;
-
-: parse-method ( xml-doc -- string array )
-    children-tags dup first children>string
-    swap second params>array ;
-
-: parse-fault ( xml-doc -- fault-code fault-string )
-    first-child-tag first-child-tag first-child-tag
-    xml>item [ "faultCode" get "faultString" get ] bind ;
-
-: receive-rpc ( xml-doc -- rpc )
-    dup name-tag dup "methodCall" =
-    [ drop parse-method <rpc-method> ] [
-        "methodResponse" = [
-            dup first-child-tag name-tag "fault" =
-            [ parse-fault <rpc-fault> ]
-            [ parse-rpc-response <rpc-response> ] if
-        ] [ "Bad main tag name" <server-error> throw ] if
-    ] if ;
-
-: post-rpc ( rpc url -- rpc )
-    ! This needs to do something in the event of an error
-    >r "text/xml" swap send-rpc xml>string r> http-post
-    2nip string>xml receive-rpc ;
-
-: invoke-method ( params method url -- )
-    >r swap <rpc-method> r> post-rpc ;
-
-: put-http-response ( string -- )
-    "HTTP/1.1 200 OK\nConnection: close\nContent-Length: " write
-    dup length number>string write
-    "\nContent-Type: text/xml\nDate: " write
-    now timestamp>http-string write "\n\n" write
-    write ;
diff --git a/libs/xml-rpc/xml-rpc.facts b/libs/xml-rpc/xml-rpc.facts
deleted file mode 100644 (file)
index cc20e98..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-USING: xml-rpc help ;
-
-HELP: send-rpc
-{ $values { "rpc" "an RPC data type" } { "xml" "an XML document" } }
-{ $description "converts an RPC data type into an XML document which can be sent to another computer" }
-{ $see-also receive-rpc } ;
-
-HELP: receive-rpc
-{ $values  { "xml" "an XML document" } { "rpc" "an RPC data type" } }
-{ $description "parses an XML document into an RPC data type, for further local processing" }
-{ $see-also send-rpc } ;
-
-HELP: <base64>
-{ $values { "string" "a string" } { "base64" "a base64 tuple" } }
-{ $description "creates a base64 tuple using the data in the string. This marks the data for encoding in the base64 format" }
-{ $see-also base64 } ;
-
-HELP: base64
-{ $class-description "a piece of data marked for encoding as base64 in an XML-RPC message" }
-{ $see-also <base64> } ;
-
-HELP: <rpc-method>
-{ $values { "name" "a string" } { "params" "a sequence" } }
-{ $description "creates a tuple reprsenting a method call which can be translated using send-rpc into an XML-RPC document" }
-{ $see-also rpc-method <rpc-response> <rpc-fault> } ;
-
-HELP: rpc-method
-{ $class-description "a tuple which is equivalent to an XML-RPC method send. Contains two fields, name and params" }
-{ $see-also <rpc-method> rpc-response rpc-fault } ;
-
-HELP: <rpc-response>
-{ $values { "params" "a sequence" } }
-{ $description "creates a tuple representing a data response in XML-RPC" }
-{ $see-also rpc-response <rpc-method> <rpc-fault> } ;
-
-HELP: rpc-response
-{ $class-description "represents an XML-RPC method response, with a number of paramters holding data. Contains one field, params, a sequence" }
-{ $see-also <rpc-response> rpc-method rpc-fault } ;
-
-HELP: <rpc-fault>
-{ $values { "code" "an integer" } { "string" "a string" } }
-{ $description "creates a tuple representing an exception in RPC, to be returned to the caller. The code is a number representing what type of error it is, and the string is a description" }
-{ $see-also rpc-fault <rpc-method> <rpc-response> } ;
-
-HELP: rpc-fault
-{ $class-description "represents an XML-RPC fault" }
-{ $see-also <rpc-fault> rpc-method rpc-response } ;
-
-HELP: post-rpc
-{ $values { "rpc" "an XML-RPC input tuple" } { "url" "a URL" }
-    { "rpc" "an XML-RPC output tuple" } }
-{ $description "posts an XML-RPC document to the specified URL, receives the response and parses it as XML-RPC, returning the tuple" } ;
-
-ARTICLE: { "xml-rpc" "intro" } "XML-RPC"
-    "This is the XML-RPC library. XML-RPC is used instead of SOAP because it is far simpler and easier to use for most tasks. The library was implemented by Daniel Ehrenberg. Together with XML, this is part of the F2EE framework."
-    $terpri
-    "The most important words that this library implements are:"
-    { $subsection send-rpc }
-    { $subsection receive-rpc } 
-    "data types in XML-RPC"
-    { $subsection base64 }
-    { $subsection rpc-method }
-    { $subsection rpc-response }
-    { $subsection rpc-fault }
-    "the constructors for these are"
-    { $subsection <base64> }
-    { $subsection <rpc-method> }
-    { $subsection <rpc-response> }
-    { $subsection <rpc-fault> }
-    "other words include"
-    { $subsection post-rpc } ; 
diff --git a/libs/xml/char-class.factor b/libs/xml/char-class.factor
deleted file mode 100644 (file)
index 235b4e2..0000000
+++ /dev/null
@@ -1,387 +0,0 @@
-IN: char-classes
-USING: kernel sequences math ;
-
-: in-range-seq? ( number seq -- ? )
-    #! seq: { { min max } { min max }* }
-    [ first2 between? ] contains-with? ;
-
-PREDICATE: integer 1.1name-start-char
-    {
-        { CHAR: _    CHAR: _    }
-        { CHAR: A    CHAR: Z    }
-        { CHAR: a    CHAR: z    }
-        { HEX: C0    HEX: D6    }
-        { HEX: D8    HEX: F6    }
-        { HEX: F8    HEX: 2FF   }
-        { HEX: 370   HEX: 37D   }
-        { HEX: 37F   HEX: 1FFF  }
-        { HEX: 200C  HEX: 200D  }
-        { HEX: 2070  HEX: 218F  }
-        { HEX: 2C00  HEX: 2FEF  }
-        { HEX: 3001  HEX: D7FF  }
-        { HEX: F900  HEX: FDCF  }
-        { HEX: FDF0  HEX: FFFD  }
-        { HEX: 10000 HEX: EFFFF }
-    } in-range-seq? ;
-
-PREDICATE: integer 1.1name-char
-    dup 1.1name-start-char? swap {
-        { CHAR: -   CHAR: -   }
-        { CHAR: .   CHAR: .   }
-        { CHAR: 0   CHAR: 9   }
-        { HEX: b7   HEX: b7   }
-        { HEX: 300  HEX: 36F  }
-        { HEX: 203F HEX: 2040 }
-    } in-range-seq? or ;
-
-! The following 335 lines were automatically generated
-! from Appendix B of the XML 1.0 standard, version 3
-
-PREDICATE: integer base-char {
-    { HEX: 0041 HEX: 005A } 
-    { HEX: 0061 HEX: 007A } 
-    { HEX: 00C0 HEX: 00D6 } 
-    { HEX: 00D8 HEX: 00F6 } 
-    { HEX: 00F8 HEX: 00FF } 
-    { HEX: 0100 HEX: 0131 } 
-    { HEX: 0134 HEX: 013E } 
-    { HEX: 0141 HEX: 0148 } 
-    { HEX: 014A HEX: 017E } 
-    { HEX: 0180 HEX: 01C3 } 
-    { HEX: 01CD HEX: 01F0 } 
-    { HEX: 01F4 HEX: 01F5 } 
-    { HEX: 01FA HEX: 0217 } 
-    { HEX: 0250 HEX: 02A8 } 
-    { HEX: 02BB HEX: 02C1 } 
-    { HEX: 0386 HEX: 0386 } 
-    { HEX: 0388 HEX: 038A } 
-    { HEX: 038C HEX: 038C } 
-    { HEX: 038E HEX: 03A1 } 
-    { HEX: 03A3 HEX: 03CE } 
-    { HEX: 03D0 HEX: 03D6 } 
-    { HEX: 03DA HEX: 03DA } 
-    { HEX: 03DC HEX: 03DC } 
-    { HEX: 03DE HEX: 03DE } 
-    { HEX: 03E0 HEX: 03E0 } 
-    { HEX: 03E2 HEX: 03F3 } 
-    { HEX: 0401 HEX: 040C } 
-    { HEX: 040E HEX: 044F } 
-    { HEX: 0451 HEX: 045C } 
-    { HEX: 045E HEX: 0481 } 
-    { HEX: 0490 HEX: 04C4 } 
-    { HEX: 04C7 HEX: 04C8 } 
-    { HEX: 04CB HEX: 04CC } 
-    { HEX: 04D0 HEX: 04EB } 
-    { HEX: 04EE HEX: 04F5 } 
-    { HEX: 04F8 HEX: 04F9 } 
-    { HEX: 0531 HEX: 0556 } 
-    { HEX: 0559 HEX: 0559 } 
-    { HEX: 0561 HEX: 0586 } 
-    { HEX: 05D0 HEX: 05EA } 
-    { HEX: 05F0 HEX: 05F2 } 
-    { HEX: 0621 HEX: 063A } 
-    { HEX: 0641 HEX: 064A } 
-    { HEX: 0671 HEX: 06B7 } 
-    { HEX: 06BA HEX: 06BE } 
-    { HEX: 06C0 HEX: 06CE } 
-    { HEX: 06D0 HEX: 06D3 } 
-    { HEX: 06D5 HEX: 06D5 } 
-    { HEX: 06E5 HEX: 06E6 } 
-    { HEX: 0905 HEX: 0939 } 
-    { HEX: 093D HEX: 093D } 
-    { HEX: 0958 HEX: 0961 } 
-    { HEX: 0985 HEX: 098C } 
-    { HEX: 098F HEX: 0990 } 
-    { HEX: 0993 HEX: 09A8 } 
-    { HEX: 09AA HEX: 09B0 } 
-    { HEX: 09B2 HEX: 09B2 } 
-    { HEX: 09B6 HEX: 09B9 } 
-    { HEX: 09DC HEX: 09DD } 
-    { HEX: 09DF HEX: 09E1 } 
-    { HEX: 09F0 HEX: 09F1 } 
-    { HEX: 0A05 HEX: 0A0A } 
-    { HEX: 0A0F HEX: 0A10 } 
-    { HEX: 0A13 HEX: 0A28 } 
-    { HEX: 0A2A HEX: 0A30 } 
-    { HEX: 0A32 HEX: 0A33 } 
-    { HEX: 0A35 HEX: 0A36 } 
-    { HEX: 0A38 HEX: 0A39 } 
-    { HEX: 0A59 HEX: 0A5C } 
-    { HEX: 0A5E HEX: 0A5E } 
-    { HEX: 0A72 HEX: 0A74 } 
-    { HEX: 0A85 HEX: 0A8B } 
-    { HEX: 0A8D HEX: 0A8D } 
-    { HEX: 0A8F HEX: 0A91 } 
-    { HEX: 0A93 HEX: 0AA8 } 
-    { HEX: 0AAA HEX: 0AB0 } 
-    { HEX: 0AB2 HEX: 0AB3 } 
-    { HEX: 0AB5 HEX: 0AB9 } 
-    { HEX: 0ABD HEX: 0ABD } 
-    { HEX: 0AE0 HEX: 0AE0 } 
-    { HEX: 0B05 HEX: 0B0C } 
-    { HEX: 0B0F HEX: 0B10 } 
-    { HEX: 0B13 HEX: 0B28 } 
-    { HEX: 0B2A HEX: 0B30 } 
-    { HEX: 0B32 HEX: 0B33 } 
-    { HEX: 0B36 HEX: 0B39 } 
-    { HEX: 0B3D HEX: 0B3D } 
-    { HEX: 0B5C HEX: 0B5D } 
-    { HEX: 0B5F HEX: 0B61 } 
-    { HEX: 0B85 HEX: 0B8A } 
-    { HEX: 0B8E HEX: 0B90 } 
-    { HEX: 0B92 HEX: 0B95 } 
-    { HEX: 0B99 HEX: 0B9A } 
-    { HEX: 0B9C HEX: 0B9C } 
-    { HEX: 0B9E HEX: 0B9F } 
-    { HEX: 0BA3 HEX: 0BA4 } 
-    { HEX: 0BA8 HEX: 0BAA } 
-    { HEX: 0BAE HEX: 0BB5 } 
-    { HEX: 0BB7 HEX: 0BB9 } 
-    { HEX: 0C05 HEX: 0C0C } 
-    { HEX: 0C0E HEX: 0C10 } 
-    { HEX: 0C12 HEX: 0C28 } 
-    { HEX: 0C2A HEX: 0C33 } 
-    { HEX: 0C35 HEX: 0C39 } 
-    { HEX: 0C60 HEX: 0C61 } 
-    { HEX: 0C85 HEX: 0C8C } 
-    { HEX: 0C8E HEX: 0C90 } 
-    { HEX: 0C92 HEX: 0CA8 } 
-    { HEX: 0CAA HEX: 0CB3 } 
-    { HEX: 0CB5 HEX: 0CB9 } 
-    { HEX: 0CDE HEX: 0CDE } 
-    { HEX: 0CE0 HEX: 0CE1 } 
-    { HEX: 0D05 HEX: 0D0C } 
-    { HEX: 0D0E HEX: 0D10 } 
-    { HEX: 0D12 HEX: 0D28 } 
-    { HEX: 0D2A HEX: 0D39 } 
-    { HEX: 0D60 HEX: 0D61 } 
-    { HEX: 0E01 HEX: 0E2E } 
-    { HEX: 0E30 HEX: 0E30 } 
-    { HEX: 0E32 HEX: 0E33 } 
-    { HEX: 0E40 HEX: 0E45 } 
-    { HEX: 0E81 HEX: 0E82 } 
-    { HEX: 0E84 HEX: 0E84 } 
-    { HEX: 0E87 HEX: 0E88 } 
-    { HEX: 0E8A HEX: 0E8A } 
-    { HEX: 0E8D HEX: 0E8D } 
-    { HEX: 0E94 HEX: 0E97 } 
-    { HEX: 0E99 HEX: 0E9F } 
-    { HEX: 0EA1 HEX: 0EA3 } 
-    { HEX: 0EA5 HEX: 0EA5 } 
-    { HEX: 0EA7 HEX: 0EA7 } 
-    { HEX: 0EAA HEX: 0EAB } 
-    { HEX: 0EAD HEX: 0EAE } 
-    { HEX: 0EB0 HEX: 0EB0 } 
-    { HEX: 0EB2 HEX: 0EB3 } 
-    { HEX: 0EBD HEX: 0EBD } 
-    { HEX: 0EC0 HEX: 0EC4 } 
-    { HEX: 0F40 HEX: 0F47 } 
-    { HEX: 0F49 HEX: 0F69 } 
-    { HEX: 10A0 HEX: 10C5 } 
-    { HEX: 10D0 HEX: 10F6 } 
-    { HEX: 1100 HEX: 1100 } 
-    { HEX: 1102 HEX: 1103 } 
-    { HEX: 1105 HEX: 1107 } 
-    { HEX: 1109 HEX: 1109 } 
-    { HEX: 110B HEX: 110C } 
-    { HEX: 110E HEX: 1112 } 
-    { HEX: 113C HEX: 113C } 
-    { HEX: 113E HEX: 113E } 
-    { HEX: 1140 HEX: 1140 } 
-    { HEX: 114C HEX: 114C } 
-    { HEX: 114E HEX: 114E } 
-    { HEX: 1150 HEX: 1150 } 
-    { HEX: 1154 HEX: 1155 } 
-    { HEX: 1159 HEX: 1159 } 
-    { HEX: 115F HEX: 1161 } 
-    { HEX: 1163 HEX: 1163 } 
-    { HEX: 1165 HEX: 1165 } 
-    { HEX: 1167 HEX: 1167 } 
-    { HEX: 1169 HEX: 1169 } 
-    { HEX: 116D HEX: 116E } 
-    { HEX: 1172 HEX: 1173 } 
-    { HEX: 1175 HEX: 1175 } 
-    { HEX: 119E HEX: 119E } 
-    { HEX: 11A8 HEX: 11A8 } 
-    { HEX: 11AB HEX: 11AB } 
-    { HEX: 11AE HEX: 11AF } 
-    { HEX: 11B7 HEX: 11B8 } 
-    { HEX: 11BA HEX: 11BA } 
-    { HEX: 11BC HEX: 11C2 } 
-    { HEX: 11EB HEX: 11EB } 
-    { HEX: 11F0 HEX: 11F0 } 
-    { HEX: 11F9 HEX: 11F9 } 
-    { HEX: 1E00 HEX: 1E9B } 
-    { HEX: 1EA0 HEX: 1EF9 } 
-    { HEX: 1F00 HEX: 1F15 } 
-    { HEX: 1F18 HEX: 1F1D } 
-    { HEX: 1F20 HEX: 1F45 } 
-    { HEX: 1F48 HEX: 1F4D } 
-    { HEX: 1F50 HEX: 1F57 } 
-    { HEX: 1F59 HEX: 1F59 } 
-    { HEX: 1F5B HEX: 1F5B } 
-    { HEX: 1F5D HEX: 1F5D } 
-    { HEX: 1F5F HEX: 1F7D } 
-    { HEX: 1F80 HEX: 1FB4 } 
-    { HEX: 1FB6 HEX: 1FBC } 
-    { HEX: 1FBE HEX: 1FBE } 
-    { HEX: 1FC2 HEX: 1FC4 } 
-    { HEX: 1FC6 HEX: 1FCC } 
-    { HEX: 1FD0 HEX: 1FD3 } 
-    { HEX: 1FD6 HEX: 1FDB } 
-    { HEX: 1FE0 HEX: 1FEC } 
-    { HEX: 1FF2 HEX: 1FF4 } 
-    { HEX: 1FF6 HEX: 1FFC } 
-    { HEX: 2126 HEX: 2126 } 
-    { HEX: 212A HEX: 212B } 
-    { HEX: 212E HEX: 212E } 
-    { HEX: 2180 HEX: 2182 } 
-    { HEX: 3041 HEX: 3094 } 
-    { HEX: 30A1 HEX: 30FA } 
-    { HEX: 3105 HEX: 312C } 
-    { HEX: AC00 HEX: D7A3 } } in-range-seq? ;
-
-PREDICATE: integer ideographic {
-    { HEX: 4E00 HEX: 9FA5 } 
-    { HEX: 3007 HEX: 3007 } 
-    { HEX: 3021 HEX: 3029 } } in-range-seq? ;
-
-PREDICATE: integer combining-char {
-    { HEX: 0300 HEX: 0345 } 
-    { HEX: 0360 HEX: 0361 } 
-    { HEX: 0483 HEX: 0486 } 
-    { HEX: 0591 HEX: 05A1 } 
-    { HEX: 05A3 HEX: 05B9 } 
-    { HEX: 05BB HEX: 05BD } 
-    { HEX: 05BF HEX: 05BF } 
-    { HEX: 05C1 HEX: 05C2 } 
-    { HEX: 05C4 HEX: 05C4 } 
-    { HEX: 064B HEX: 0652 } 
-    { HEX: 0670 HEX: 0670 } 
-    { HEX: 06D6 HEX: 06DC } 
-    { HEX: 06DD HEX: 06DF } 
-    { HEX: 06E0 HEX: 06E4 } 
-    { HEX: 06E7 HEX: 06E8 } 
-    { HEX: 06EA HEX: 06ED } 
-    { HEX: 0901 HEX: 0903 } 
-    { HEX: 093C HEX: 093C } 
-    { HEX: 093E HEX: 094C } 
-    { HEX: 094D HEX: 094D } 
-    { HEX: 0951 HEX: 0954 } 
-    { HEX: 0962 HEX: 0963 } 
-    { HEX: 0981 HEX: 0983 } 
-    { HEX: 09BC HEX: 09BC } 
-    { HEX: 09BE HEX: 09BE } 
-    { HEX: 09BF HEX: 09BF } 
-    { HEX: 09C0 HEX: 09C4 } 
-    { HEX: 09C7 HEX: 09C8 } 
-    { HEX: 09CB HEX: 09CD } 
-    { HEX: 09D7 HEX: 09D7 } 
-    { HEX: 09E2 HEX: 09E3 } 
-    { HEX: 0A02 HEX: 0A02 } 
-    { HEX: 0A3C HEX: 0A3C } 
-    { HEX: 0A3E HEX: 0A3E } 
-    { HEX: 0A3F HEX: 0A3F } 
-    { HEX: 0A40 HEX: 0A42 } 
-    { HEX: 0A47 HEX: 0A48 } 
-    { HEX: 0A4B HEX: 0A4D } 
-    { HEX: 0A70 HEX: 0A71 } 
-    { HEX: 0A81 HEX: 0A83 } 
-    { HEX: 0ABC HEX: 0ABC } 
-    { HEX: 0ABE HEX: 0AC5 } 
-    { HEX: 0AC7 HEX: 0AC9 } 
-    { HEX: 0ACB HEX: 0ACD } 
-    { HEX: 0B01 HEX: 0B03 } 
-    { HEX: 0B3C HEX: 0B3C } 
-    { HEX: 0B3E HEX: 0B43 } 
-    { HEX: 0B47 HEX: 0B48 } 
-    { HEX: 0B4B HEX: 0B4D } 
-    { HEX: 0B56 HEX: 0B57 } 
-    { HEX: 0B82 HEX: 0B83 } 
-    { HEX: 0BBE HEX: 0BC2 } 
-    { HEX: 0BC6 HEX: 0BC8 } 
-    { HEX: 0BCA HEX: 0BCD } 
-    { HEX: 0BD7 HEX: 0BD7 } 
-    { HEX: 0C01 HEX: 0C03 } 
-    { HEX: 0C3E HEX: 0C44 } 
-    { HEX: 0C46 HEX: 0C48 } 
-    { HEX: 0C4A HEX: 0C4D } 
-    { HEX: 0C55 HEX: 0C56 } 
-    { HEX: 0C82 HEX: 0C83 } 
-    { HEX: 0CBE HEX: 0CC4 } 
-    { HEX: 0CC6 HEX: 0CC8 } 
-    { HEX: 0CCA HEX: 0CCD } 
-    { HEX: 0CD5 HEX: 0CD6 } 
-    { HEX: 0D02 HEX: 0D03 } 
-    { HEX: 0D3E HEX: 0D43 } 
-    { HEX: 0D46 HEX: 0D48 } 
-    { HEX: 0D4A HEX: 0D4D } 
-    { HEX: 0D57 HEX: 0D57 } 
-    { HEX: 0E31 HEX: 0E31 } 
-    { HEX: 0E34 HEX: 0E3A } 
-    { HEX: 0E47 HEX: 0E4E } 
-    { HEX: 0EB1 HEX: 0EB1 } 
-    { HEX: 0EB4 HEX: 0EB9 } 
-    { HEX: 0EBB HEX: 0EBC } 
-    { HEX: 0EC8 HEX: 0ECD } 
-    { HEX: 0F18 HEX: 0F19 } 
-    { HEX: 0F35 HEX: 0F35 } 
-    { HEX: 0F37 HEX: 0F37 } 
-    { HEX: 0F39 HEX: 0F39 } 
-    { HEX: 0F3E HEX: 0F3E } 
-    { HEX: 0F3F HEX: 0F3F } 
-    { HEX: 0F71 HEX: 0F84 } 
-    { HEX: 0F86 HEX: 0F8B } 
-    { HEX: 0F90 HEX: 0F95 } 
-    { HEX: 0F97 HEX: 0F97 } 
-    { HEX: 0F99 HEX: 0FAD } 
-    { HEX: 0FB1 HEX: 0FB7 } 
-    { HEX: 0FB9 HEX: 0FB9 } 
-    { HEX: 20D0 HEX: 20DC } 
-    { HEX: 20E1 HEX: 20E1 } 
-    { HEX: 302A HEX: 302F } 
-    { HEX: 3099 HEX: 3099 } 
-    { HEX: 309A HEX: 309A } } in-range-seq? ;
-
-PREDICATE: integer unicode-digit {
-    { HEX: 0030 HEX: 0039 } 
-    { HEX: 0660 HEX: 0669 } 
-    { HEX: 06F0 HEX: 06F9 } 
-    { HEX: 0966 HEX: 096F } 
-    { HEX: 09E6 HEX: 09EF } 
-    { HEX: 0A66 HEX: 0A6F } 
-    { HEX: 0AE6 HEX: 0AEF } 
-    { HEX: 0B66 HEX: 0B6F } 
-    { HEX: 0BE7 HEX: 0BEF } 
-    { HEX: 0C66 HEX: 0C6F } 
-    { HEX: 0CE6 HEX: 0CEF } 
-    { HEX: 0D66 HEX: 0D6F } 
-    { HEX: 0E50 HEX: 0E59 } 
-    { HEX: 0ED0 HEX: 0ED9 } 
-    { HEX: 0F20 HEX: 0F29 } } in-range-seq? ;
-
-PREDICATE: integer extender {
-    { HEX: 00B7 HEX: 00B7 }
-    { HEX: 02D0 HEX: 02D0 } 
-    { HEX: 02D1 HEX: 02D1 } 
-    { HEX: 0387 HEX: 0387 } 
-    { HEX: 0640 HEX: 0640 } 
-    { HEX: 0E46 HEX: 0E46 } 
-    { HEX: 0EC6 HEX: 0EC6 } 
-    { HEX: 3005 HEX: 3005 } 
-    { HEX: 3031 HEX: 3035 } 
-    { HEX: 309D HEX: 309E } 
-    { HEX: 30FC HEX: 30FE } } in-range-seq? ;
-
-! end automatically generated code
-
-UNION: 1.0letter base-char ideographic ;
-
-PREDICATE: integer 1.0name-start-char
-    dup 1.0letter? swap CHAR: _ = or ;
-
-PREDICATE: integer 1.0other-name-chars
-    { CHAR: . CHAR: - CHAR: _ } member? ;
-UNION: 1.0name-char
-    1.0letter unicode-digit 1.0other-name-chars
-    combining-char extender ;
diff --git a/libs/xml/example.factor b/libs/xml/example.factor
deleted file mode 100644 (file)
index 5f8cc8d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-IN: xml-arith
-USING: xml io kernel math sequences strings ;
-
-PROCESS: calculate ( tag -- n )
-
-: calc-2children ( tag -- n n )
-    children-tags first2 >r calculate r> calculate ;
-
-TAG: number calculate
-    children>string string>number ;
-TAG: add calculate
-    calc-2children + ;
-TAG: minus calculate
-    calc-2children - ;
-TAG: times calculate
-    calc-2children * ;
-TAG: divide calculate
-    calc-2children / ;
-TAG: neg calculate
-    children-tags first calculate neg ;
-
-: calc-arith ( string -- n )
-    string>xml first-child-tag calculate ;
-
diff --git a/libs/xml/example2.factor b/libs/xml/example2.factor
deleted file mode 100644 (file)
index f695830..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-IN: templating
-USING: kernel xml sequences hashtables tools io arrays namespaces generic ;
-
-SYMBOL: ref-table
-
-: replace ( ref -- object )
-    reference-name ref-table get hash call ;
-
-: ref-string ( seq -- seq )
-    [
-        dup reference? [ replace ] when
-    ] map ;
-
-GENERIC: (r-ref) ( xml -- object )
-M: any-tag (r-ref)
-    dup tag-props dup [
-        dup [ ref-string swap set ] hash-each 
-    ] bind over set-tag-props ;
-M: reference (r-ref)
-    replace ;
-M: object (r-ref) ;
-
-: template ( xml -- xml )
-    [ (r-ref) ] xml-map ;
-
-! Example
-
-: test-refs
-    H{
-        { "foo" [ "foo" ] }
-        { "bar" [ [ .s ] string-out ] }
-        { "baz" [ "<a/>" string>xml delegate ] }
-    } ref-table set
-    "<x>%foo;<y prop='blah%foo;'>%bar;</y>%baz;</x>" string>xml
-    template ;
-
diff --git a/libs/xml/load.factor b/libs/xml/load.factor
deleted file mode 100644 (file)
index 55fedc8..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
-! See http://factorcode.org/license.txt for BSD license.\r
-PROVIDE: libs/xml\r
-{ +files+ {\r
-    "char-class.factor"\r
-    "tokenizer.factor"\r
-    "parser.factor"\r
-    "writer.factor"\r
-    "utilities.factor"\r
-    "xml.facts"\r
-} }\r
-{ +tests+ {\r
-    "test.factor"\r
-} }\r
-{ +help+ { "xml" "intro" } } ;\r
diff --git a/libs/xml/parser.factor b/libs/xml/parser.factor
deleted file mode 100644 (file)
index d676364..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: errors hashtables io kernel math namespaces prettyprint sequences\r
-    arrays generic strings vectors char-classes ;\r
-IN: xml\r
-\r
-! * Parsing tags\r
-\r
-TUPLE: opener name props ;\r
-TUPLE: closer name ;\r
-TUPLE: contained name props ;\r
-TUPLE: comment text ;\r
-TUPLE: directive text ;\r
-TUPLE: instruction text ;\r
-\r
-: start-tag ( -- name ? )\r
-    #! Outputs the name and whether this is a closing tag\r
-    get-char CHAR: / = dup [ next ] when\r
-    parse-name swap ;\r
-\r
-: parse-prop-value ( -- seq )\r
-    get-char dup "'\"" member? [\r
-        next parse-quot\r
-    ] [\r
-        "Attribute lacks quote" <xml-string-error> throw\r
-    ] if ;\r
-\r
-: parse-prop ( -- )\r
-    [ parse-name ] with-scope\r
-    pass-blank CHAR: = expect pass-blank\r
-    [ parse-prop-value ] with-scope\r
-    swap set ;\r
-\r
-: (middle-tag) ( -- )\r
-    pass-blank version=1.0? get-char name-start-char?\r
-    [ parse-prop (middle-tag) ] when ;\r
-\r
-: middle-tag ( -- hash )\r
-    [ (middle-tag) ] make-hash pass-blank ;\r
-\r
-: end-tag ( string hash -- tag )\r
-    pass-blank get-char CHAR: / =\r
-    [ <contained> next ] [ <opener> ] if ;\r
-\r
-: skip-comment ( -- comment )\r
-    "--" expect-string\r
-    "--" take-string\r
-    <comment>\r
-    CHAR: > expect ;\r
-\r
-: cdata ( -- string )\r
-    "[CDATA[" expect-string "]]>" take-string ;\r
-\r
-: directive ( -- object )\r
-    {\r
-        { [ "--" string-matches? ] [ skip-comment ] }\r
-        { [ "[CDATA[" string-matches? ] [ cdata ] }\r
-        { [ t ] [ CHAR: > take-char <directive> ] }\r
-    } cond ;\r
-\r
-: instruction ( -- instruction )\r
-    ! this should make sure the name doesn't include 'xml'\r
-    "?>" take-string <instruction> ;\r
-\r
-: make-tag ( -- tag )\r
-    { { [ get-char dup CHAR: ! = ] [ drop next directive ] }\r
-      { [ CHAR: ? = ] [ next instruction ] } \r
-      { [ t ] [\r
-            start-tag [ <closer> ] [\r
-                middle-tag end-tag\r
-            ] if pass-blank CHAR: > expect\r
-        ] }\r
-    } cond ;\r
-\r
-!   -- Overall parser with data tree\r
-\r
-TUPLE: tag props children ;\r
-C: tag ( name props children -- tag )\r
-    [ set-tag-children ] keep\r
-    [ set-tag-props ] keep\r
-    [ set-delegate ] keep ;\r
-\r
-! tag with children=f is contained\r
-: <contained-tag> ( name props -- tag )\r
-    f <tag> ;\r
-\r
-PREDICATE: tag contained-tag tag-children not ;\r
-PREDICATE: tag open-tag tag-children ;\r
-\r
-! A stack of { tag children } pairs\r
-SYMBOL: xml-stack\r
-\r
-! A stack of hashtables\r
-SYMBOL: namespace-stack\r
-\r
-DEFER: print-name\r
-\r
-TUPLE: mismatched open close ;\r
-M: mismatched error.\r
-    "Mismatched tags" print\r
-    "Opening tag: <" write dup mismatched-open print-name ">" print\r
-    "Closing tag: </" write mismatched-close print-name ">" print ;\r
-\r
-TUPLE: unclosed tags ;\r
-C: unclosed ( -- unclosed )\r
-    xml-stack get 1 tail-slice [ first opener-name ] map\r
-    swap [ set-unclosed-tags  ] keep ;\r
-M: unclosed error.\r
-    "Unclosed tags" print\r
-    "Tags: " print\r
-    unclosed-tags [ "  <" write print-name ">" print ] each ;\r
-\r
-: add-child ( object -- )\r
-    xml-stack get peek second push ;\r
-\r
-: push-xml-stack ( object -- )\r
-    V{ } clone 2array xml-stack get push ;\r
-\r
-TUPLE: bad-uri string ;\r
-M: bad-uri error.\r
-    "Bad URI:" print bad-uri-string . ;\r
-\r
-: xml-string>uri ( seq -- string )\r
-    dup length 1 = [ <bad-uri> throw ] unless\r
-    first ;\r
-\r
-: process-ns ( hash -- hash )\r
-    ! This should assure all namespaces are URIs by replacing first\r
-    [\r
-        dup [\r
-            swap dup name-space "xmlns" =\r
-            [ >r xml-string>uri r> name-tag set ]\r
-            [ 2drop ] if\r
-        ] hash-each\r
-        T{ name f "" "xmlns" } swap hash\r
-        [ xml-string>uri "" set ] when*\r
-    ] make-hash ;\r
-\r
-TUPLE: nonexist-ns name ;\r
-M: nonexist-ns error.\r
-    "Namespace " write nonexist-ns-name write " has not been declared" print ;\r
-\r
-: add-ns2name ( name -- )\r
-    dup name-space dup namespace-stack get hash-stack\r
-    [ nip ] [ <nonexist-ns> throw ] if* swap set-name-url ;\r
-\r
-: push-ns-stack ( hash -- )\r
-    dup process-ns namespace-stack get push\r
-    [ drop add-ns2name ] hash-each ;\r
-\r
-: pop-ns-stack ( -- )\r
-    namespace-stack get pop drop ;\r
-\r
-GENERIC: process ( object -- )\r
-\r
-M: object process add-child ;\r
-\r
-M: contained process\r
-    [ contained-name ] keep contained-props\r
-    dup push-ns-stack >r dup add-ns2name r>\r
-    pop-ns-stack <contained-tag> add-child ;\r
-\r
-M: opener process ! move add-ns2name on name to closer and fix mismatched\r
-    dup opener-props push-ns-stack push-xml-stack ;\r
-\r
-TUPLE: unopened ;\r
-M: unopened error.\r
-    drop "Closed an unopened tag" print ;\r
-\r
-M: closer process\r
-    closer-name xml-stack get pop first2 >r [ \r
-        dup [ <unopened> throw ] unless\r
-        opener-name [\r
-            2dup = [ nip add-ns2name ]\r
-            [ swap <mismatched> throw ] if\r
-        ] keep\r
-    ] keep opener-props r> <tag> add-child pop-ns-stack ;\r
-\r
-: init-ns-stack ( -- )\r
-    V{ H{\r
-        { "xml" "http://www.w3.org/XML/1998/namespace" }\r
-        { "xmlns" "http://www.w3.org/2000/xmlns" }\r
-        { "" "" }\r
-    } } clone\r
-    namespace-stack set ;\r
-\r
-: init-xml-stack ( -- )\r
-    V{ } clone xml-stack set f push-xml-stack ;\r
-\r
-TUPLE: xml-doc prolog before after ;\r
-C: xml-doc ( prolog before main after -- xml-doc )\r
-    [ set-xml-doc-after ] keep\r
-    [ set-delegate ] keep\r
-    [ set-xml-doc-before ] keep\r
-    [ set-xml-doc-prolog ] keep ;\r
-\r
-TUPLE: not-yes/no text ;\r
-M: not-yes/no error.\r
-    "Standalone must be either yes or no, not \"" write\r
-    not-yes/no-text write "\"." print ;\r
-\r
-: yes/no>bool ( string -- t/f )\r
-    dup "yes" = [ drop t ] [\r
-        dup "no" = [ drop f ] [\r
-            <not-yes/no> throw\r
-        ] if\r
-    ] if ;\r
-\r
-TUPLE: extra-attrs attrs ;\r
-M: extra-attrs error.\r
-    "Extra attributes included in xml version declaration:" print\r
-    extra-attrs-attrs . ;\r
-\r
-: assure-no-extra ( hash -- )\r
-    hash-keys {\r
-        T{ name f "" "version" f }\r
-        T{ name f "" "encoding" f }\r
-        T{ name f "" "standalone" f }\r
-    } swap diff dup empty? [ drop ] [ <extra-attrs> throw ] if ; \r
-\r
-: concat-strings ( xml-string -- string )\r
-    dup [ string? ] all?\r
-    [ "XML prolog attributes contain undefined entities"\r
-      <xml-string-error> throw ] unless\r
-    concat ;\r
-\r
-TUPLE: bad-version num ;\r
-M: bad-version error.\r
-    "XML version must be \"1.0\" or \"1.1\". Version here was " write\r
-    bad-version-num . ;\r
-\r
-: good-version ( version -- version )\r
-    dup { "1.0" "1.1" } member? [ <bad-version> throw ] unless ;\r
-\r
-: prolog-attrs ( hash -- )\r
-    T{ name f "" "version" f } over hash [\r
-        concat-strings good-version\r
-        prolog-data get set-prolog-version\r
-    ] when*\r
-    T{ name f "" "encoding" f } over hash [\r
-        concat-strings prolog-data get set-prolog-encoding\r
-    ] when*\r
-    T{ name f "" "standalone" f } swap hash [\r
-        concat-strings yes/no>bool\r
-        prolog-data get set-prolog-standalone\r
-    ] when* ;\r
-\r
-: parse-prolog ( -- )\r
-    "<?xml" string-matches? [\r
-        5 expect-string*\r
-        pass-blank middle-tag "?>" expect-string\r
-         dup assure-no-extra prolog-attrs\r
-    ] when ;\r
-\r
-: basic-init ( stream -- )\r
-    stdio set\r
-    { 0 0 0 "" } clone spot set\r
-    f record set f now-recording? set\r
-    next\r
-    "1.0" "iso-8859-1" f <prolog> prolog-data set ;\r
-\r
-: init-xml ( stream -- )\r
-    basic-init init-xml-stack init-ns-stack ;\r
-\r
-: init-xml-string ( string -- ) ! for debugging\r
-    <string-reader> init-xml ;\r
-\r
-TUPLE: notags ;\r
-M: notags error.\r
-    drop "XML document lacks a main tag" print ;\r
-\r
-TUPLE: multitags ;\r
-M: multitags error.\r
-    drop "XML document contains multiple main tags" print ;\r
-\r
-: make-xml-doc ( seq -- xml-doc )\r
-    prolog-data get swap dup [ tag? ] find\r
-    >r dup -1 = [ <notags> throw ] when\r
-    swap cut 1 tail\r
-    dup [ tag? ] contains? [ <multitags> throw ] when r>\r
-    swap <xml-doc> ;\r
-\r
-! * Views of XML\r
-\r
-SYMBOL: text-now?\r
-\r
-TUPLE: pull-xml scope ;\r
-C: pull-xml ( stream -- pull-xml )\r
-    [\r
-        swap basic-init parse-prolog\r
-        t text-now? set\r
-        [ namestack pop swap set-pull-xml-scope ] keep\r
-    ] with-scope ;\r
-\r
-: pull-next ( pull -- xml-elem/f )\r
-    pull-xml-scope [\r
-        text-now? get [ parse-text f ] [\r
-            get-char [ make-tag t ] [ f f ] if\r
-        ] if text-now? set    \r
-    ] bind ;\r
-\r
-: call-under ( quot object -- quot )\r
-    swap dup slip ; inline\r
-\r
-: sax-loop ( quot -- ) ! quot: xml-elem --\r
-    parse-text [ call-under ] each\r
-    get-char [ make-tag call-under sax-loop ]\r
-    [ drop ] if ; inline\r
-\r
-: sax ( stream quot -- ) ! quot: xml-elem --\r
-    swap [\r
-        basic-init parse-prolog\r
-        prolog-data get call-under\r
-        sax-loop\r
-    ] with-scope ; inline\r
-\r
-: (read-xml) ( -- )\r
-    [ process ] sax-loop ; inline\r
-\r
-: (xml-chunk) ( stream -- seq )\r
-    init-xml parse-prolog (read-xml)\r
-    xml-stack get\r
-    dup length 1 = [ <unclosed> throw ] unless\r
-    first second ;\r
-\r
-: read-xml ( stream -- xml-doc )\r
-    #! Produces a tree of XML nodes\r
-    [ (xml-chunk) make-xml-doc ] with-scope ;\r
-\r
-: xml-chunk ( stream -- seq )\r
-    [ (xml-chunk) ] with-scope ;\r
-\r
-: string>xml ( string -- xml-doc )\r
-    <string-reader> read-xml ;\r
-\r
-UNION: xml-parse-error multitags notags xml-error extra-attrs nonexist-ns\r
-       not-yes/no unclosed mismatched xml-string-error expected no-entity ;\r
diff --git a/libs/xml/test.factor b/libs/xml/test.factor
deleted file mode 100644 (file)
index 3e75ef2..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
-! See http://factorcode.org/license.txt for BSD license.\r
-IN: temporary\r
-REQUIRES: libs/xml/example ;\r
-USING: kernel xml test io namespaces hashtables sequences\r
-    errors parser xml-arith strings ;\r
-\r
-! This is insufficient\r
-SYMBOL: xml-file\r
-[ ] [ "libs/xml/test.xml" resource-path <file-reader>\r
-    read-xml xml-file set ] unit-test\r
-[ "1.0" ] [ xml-file get xml-doc-prolog prolog-version ] unit-test\r
-[ f ] [ xml-file get xml-doc-prolog prolog-standalone ] unit-test\r
-[ "a" ] [ xml-file get name-space ] unit-test\r
-[ "http://www.hello.com" ] [ xml-file get name-url ] unit-test\r
-[ { "that" } ]\r
-    [ T{ name f "" "this" "http://d.de" } xml-file get\r
-    tag-props hash ] unit-test\r
-[ t ] [ xml-file get tag-children second contained-tag? ] unit-test\r
-[ t ] [ [ "<a></b>" string>xml ] catch xml-parse-error? ] unit-test\r
-[ T{ comment f "This is where the fun begins!" } ] [\r
-    xml-file get xml-doc-before [ comment? ] find nip\r
-] unit-test\r
-[ "entity" ] [ xml-file get [ entity? ] xml-find entity-name ] unit-test\r
-[ "reference" ] [ xml-file get [ reference? ] xml-find reference-name ] unit-test\r
-[ "xsl stylesheet=\"that-one.xsl\"" ] [\r
-    xml-file get xml-doc-after [ instruction? ] find nip instruction-text\r
-] unit-test\r
-[ V{ "fa&g" } ] [ xml-file get "x" get-id tag-children ] unit-test\r
-[ { "that" } ] [ xml-file get "this" prop-name-tag ] unit-test\r
-[ "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"no\"?><a b=\"c\"/>" ]\r
-    [ "<a b='c'/>" string>xml xml>string ] unit-test\r
-[ 32 ] [\r
-    "<math><times><add><number>1</number><number>3</number></add><neg><number>-8</number></neg></times></math>"\r
-    calc-arith\r
-] unit-test\r
-[ "abcd" ] [\r
-    "<main>a<sub>bc</sub>d<nothing/></main>" string>xml\r
-    [ [ dup string? [ % ] [ drop ] if ] xml-each ] "" make\r
-] unit-test\r
-[ "foo" ] [\r
-    "<a><b id='c'>%foo;</b><d id='e'/></a>" string>xml\r
-    "c" get-id tag-children [ reference? ] find nip\r
-    reference-name\r
-] unit-test\r
diff --git a/libs/xml/test.xml b/libs/xml/test.xml
deleted file mode 100644 (file)
index 757e3e8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"     standalone="no" ?>\r
-<!--This is where the fun begins!-->\r
-<!DOCTYPE greeting SYSTEM "hello.dtd">\r
-       <!--this is fun, isn't it, guys?-->\r
-<a:b xmlns:a='http://www.hello.com' xmlns='http://d.de'\r
-     this='that' that="this">\r
-   <b xmlns='http://b.nu' feeling='sombre'/>\r
-           Here's a new, undefined &entity;\r
- and here's a %reference; to go along with it!\r
-        isn't this fun?\r
-   <a:c><d mood="happy"></d>\r
-              <e a:id='x'>f&#97;&amp;g</e>\r
-   </a:c>\r
-</a:b>\r
-<!--Well, that went over pretty well-->\r
-<?xsl stylesheet="that-one.xsl"?>\r
diff --git a/libs/xml/tokenizer.factor b/libs/xml/tokenizer.factor
deleted file mode 100644 (file)
index da5b7ac..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
-! See http://factorcode.org/license.txt for BSD license.\r
-IN: xml\r
-USING: errors hashtables io kernel math namespaces prettyprint\r
-sequences tools generic strings char-classes ;\r
-\r
-! -- Low-level parsing\r
-! Code stored in stdio\r
-! Spot is composite so it won't be lost in sub-scopes\r
-SYMBOL: spot #! { char line column line-str }\r
-: get-char ( -- char ) spot get first ;\r
-: set-char ( char -- ) 0 spot get set-nth ;\r
-: get-line ( -- line ) spot get second ;\r
-: set-line ( line -- ) 1 spot get set-nth ;\r
-: get-column ( -- column ) spot get third ;\r
-: set-column ( column -- ) 2 spot get set-nth ;\r
-: get-line-str ( -- line-str ) 3 spot get nth ;\r
-: set-line-str ( line-str -- ) 3 spot get set-nth ;\r
-SYMBOL: prolog-data\r
-\r
-! Record is composite so it changes in nested scopes\r
-SYMBOL: record ! string\r
-SYMBOL: now-recording? ! t/f\r
-: recording? ( -- t/f ) now-recording? get ;\r
-: get-record ( -- sbuf ) record get ;\r
-\r
-: push-record ( ch -- )\r
-    get-record push ;\r
-: new-record ( -- )\r
-    SBUF" " clone record set\r
-    t now-recording? set\r
-    get-char [ push-record ] when* ;\r
-: unrecord ( -- )\r
-    record get pop* ;\r
-\r
-: (end-record) ( -- sbuf )\r
-    f now-recording? set\r
-    get-record ;\r
-: end-record* ( n -- string )\r
-    (end-record) tuck length swap -\r
-    head-slice >string ;\r
-: end-record ( -- string )\r
-    get-record length 0 =\r
-    [ "" f recording? set ]\r
-    [ 1 end-record* ] if ;\r
-\r
-!   -- Error reporting\r
-\r
-TUPLE: xml-error line column ;\r
-C: xml-error ( -- xml-error )\r
-    [ get-line swap set-xml-error-line ] keep\r
-    [ get-column swap set-xml-error-column ] keep ;\r
-\r
-: xml-error. ( xml-error -- )\r
-    "XML error" print\r
-    "Line: " write dup xml-error-line .\r
-    "Column: " write xml-error-column . ;\r
-\r
-TUPLE: expected should-be was ;\r
-C: expected ( should-be was -- error )\r
-    [ <xml-error> swap set-delegate ] keep\r
-    [ set-expected-was ] keep\r
-    [ set-expected-should-be ] keep ;\r
-\r
-M: expected error.\r
-    dup xml-error.\r
-    "Token expected: " write dup expected-should-be print\r
-    "Token present: " write expected-was print ;\r
-\r
-TUPLE: no-entity thing ;\r
-C: no-entity ( string -- entitiy )\r
-    [ <xml-error> swap set-delegate ] keep\r
-    [ set-no-entity-thing ] keep ;\r
-\r
-M: no-entity error.\r
-    dup xml-error.\r
-    "Entity does not exist: &" write no-entity-thing write ";" print ;\r
-\r
-TUPLE: xml-string-error string ;\r
-C: xml-string-error ( string -- xml-string-error )\r
-    [ set-xml-string-error-string ] keep\r
-    [ <xml-error> swap set-delegate ] keep ;\r
-\r
-M: xml-string-error error.\r
-    dup xml-error.\r
-    xml-string-error-string print ;\r
-\r
-!   -- Basic utility words\r
-\r
-: next-line ( -- string )\r
-    ! read a non-blank line\r
-    readln dup "" = [ drop next-line ] when ;\r
-\r
-: (next) ( -- char )\r
-    get-column get-line-str 2dup length 1- < [\r
-        >r 1+ dup set-column r> nth\r
-    ] [\r
-        2drop 0 set-column\r
-        next-line dup set-line-str\r
-        [ first ] [ f ] if*\r
-        get-line 1+ set-line\r
-    ] if ;\r
-\r
-: next ( -- )\r
-    #! Increment spot.\r
-    get-char [\r
-         "XML document unexpectedly ended"\r
-        <xml-string-error> throw\r
-    ] unless\r
-    (next) dup set-char\r
-    recording? over and [ push-record ] [ drop ] if ;\r
-\r
-: skip-until ( quot -- )\r
-    #! quot: ( -- ? )\r
-    get-char [\r
-        [ call ] keep swap [ drop ] [\r
-            next skip-until\r
-        ] if\r
-    ] [ 2drop ] if ; inline\r
-\r
-: take-until ( quot -- string | quot: -- ? )\r
-    #! Take the substring of a string starting at spot\r
-    #! from code until the quotation given is true and\r
-    #! advance spot to after the substring.\r
-    new-record skip-until end-record ; inline\r
-\r
-: take-char ( ch -- string )\r
-    [ dup get-char = ] take-until nip ;\r
-\r
-: pass-blank ( -- )\r
-    #! Advance code past any whitespace, including newlines\r
-    [ get-char blank? not ] skip-until ;\r
-\r
-: string-matches? ( string -- ? )\r
-    dup length get-column tuck +\r
-    dup get-line-str length <=\r
-    [ get-line-str <slice> sequence= ]\r
-    [ 3drop f ] if ;\r
-\r
-: take-string ( match -- string )\r
-    ! match must not contain a newline\r
-    [ dup string-matches? ] take-until\r
-    get-line-str\r
-    [ "Missing closing token" <xml-string-error> throw ] unless\r
-    swap length [ next ] times ;\r
-\r
-!   -- Parsing strings\r
-\r
-: expect ( ch -- )\r
-    get-char 2dup = [ 2drop ] [\r
-        >r ch>string r> ch>string <expected> throw\r
-    ] if next ;\r
-\r
-: expect-string* ( num -- )\r
-    #! only skips string, and only for when you're sure the string is there\r
-    [ next ] times ;\r
-\r
-: expect-string ( string -- )\r
-    ! TODO: add error if this isn't long enough\r
-    new-record dup length [ next ] times\r
-    end-record 2dup = [ 2drop ]\r
-    [ <expected> throw ] if ;\r
-\r
-TUPLE: prolog version encoding standalone ; ! part of xml-doc, see parser\r
-\r
-: entities\r
-    #! We have both directions here as a shortcut.\r
-    H{\r
-        { "lt"    CHAR: <  }\r
-        { "gt"    CHAR: >  }\r
-        { "amp"   CHAR: &  }\r
-        { "apos"  CHAR: '  }\r
-        { "quot"  CHAR: "  }\r
-        { CHAR: < "&lt;"   }\r
-        { CHAR: > "&gt;"   }\r
-        { CHAR: & "&amp;"  }\r
-        { CHAR: ' "&apos;" }\r
-        { CHAR: " "&quot;" }\r
-    } ;\r
-\r
-TUPLE: entity name ;\r
-\r
-: (parse-entity) ( string -- )\r
-    dup entities hash [ push-record ] [ \r
-        prolog-data get prolog-standalone\r
-        [ <no-entity> throw ] [\r
-            end-record , <entity> , next new-record\r
-        ] if\r
-    ] ?if ;\r
-\r
-: parse-entity ( -- )\r
-    next unrecord unrecord \r
-    ! the following line is in a scope to shield this\r
-    ! word from the record-altering side effects of\r
-    ! take-until.\r
-    [ CHAR: ; take-char ] with-scope\r
-    "#" ?head [\r
-        "x" ?head 16 10 ? base>\r
-        push-record\r
-    ] [ (parse-entity) ] if ;\r
-\r
-TUPLE: reference name ;\r
-\r
-: parse-reference ( -- )\r
-    next unrecord end-record , CHAR: ; take-char\r
-    <reference> , next new-record ;\r
-\r
-: (parse-char) ( ch -- )\r
-    get-char {\r
-        { [ dup not ]\r
-          [ 2drop 0 end-record* , ] }\r
-        { [ 2dup = ]\r
-          [ 2drop end-record , next ] }\r
-        { [ dup CHAR: & = ]\r
-          [ drop parse-entity (parse-char) ] }\r
-        { [ CHAR: % = ] [ parse-reference (parse-char) ] }\r
-        { [ t ] [ next (parse-char) ] }\r
-    } cond ;\r
-\r
-: parse-char ( ch -- array )\r
-    [ new-record (parse-char) ] { } make ;\r
-\r
-: parse-quot ( ch -- array )\r
-    parse-char get-char\r
-    [ "XML file ends in a quote" <xml-string-error> throw ] unless ;\r
-\r
-: parse-text ( -- array )\r
-    CHAR: < parse-char ;\r
-\r
-!   -- Parsing names\r
-\r
-TUPLE: name space tag url ;\r
-\r
-: version=1.0? ( -- ? )\r
-    prolog-data get prolog-version "1.0" = ;\r
-\r
-! version=1.0? is calculated once and passed around for efficiency\r
-: name-start-char? ( 1.0? char -- ? )\r
-    swap [ 1.0name-start-char? ] [ 1.1name-start-char? ] if ;\r
-\r
-: name-char? ( 1.0? char -- ? )\r
-    swap [ 1.0name-char? ] [ 1.1name-char? ] if ;\r
-\r
-: (parse-name) ( -- str )\r
-    version=1.0? dup\r
-    new-record get-char name-start-char? [\r
-        [ dup get-char name-char? not ] skip-until\r
-        drop end-record\r
-    ] [\r
-        "Malformed name" <xml-string-error> throw\r
-    ] if ;\r
-\r
-: parse-name ( -- name )\r
-    (parse-name) get-char CHAR: : =\r
-    [ next (parse-name) ] [ "" swap ] if f <name> ;\r
-\r
-: ?= ( object/f object/f -- ? )\r
-    2dup and [ = ] [ 2drop t ] if ;\r
-\r
-: names-match? ( name1 name2 -- ? )\r
-    [ name-space swap name-space ?= ] 2keep\r
-    [ name-url swap name-url ?= ] 2keep\r
-    name-tag swap name-tag ?= and and ;\r
diff --git a/libs/xml/utilities.factor b/libs/xml/utilities.factor
deleted file mode 100644 (file)
index 909b6f6..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
-! See http://factorcode.org/license.txt for BSD license.\r
-IN: xml\r
-USING: kernel namespaces sequences words io errors hashtables\r
-    strings parser arrays generic ;\r
-\r
-! * System for words specialized on tag names\r
-\r
-TUPLE: process-missing process tag ;\r
-M: process-missing error.\r
-    "Tag <" write\r
-    process-missing-tag print-name\r
-    "> not implemented on process process " write\r
-    dup process-missing-process word-name print ;\r
-\r
-: run-process ( tag word -- )\r
-    2dup "xtable" word-prop\r
-    >r dup name-tag r> hash* [ 2nip call ] [\r
-        drop <process-missing> throw\r
-    ] if ;\r
-\r
-: PROCESS:\r
-    CREATE\r
-    dup H{ } clone "xtable" set-word-prop\r
-    dup [ run-process ] curry define-compound ; parsing\r
-\r
-: TAG:\r
-    scan scan-word [\r
-        swap "xtable" word-prop\r
-        rot "/" split [ >r 2dup r> swap set-hash ] each 2drop\r
-    ] f ; parsing\r
-\r
-\r
-! * Common utility functions\r
-\r
-: build-tag* ( items name -- tag )\r
-    "" swap "" <name>\r
-    swap >r H{ } r> <tag> ;\r
-\r
-: build-tag ( item name -- tag )\r
-    >r 1array r> build-tag* ;\r
-\r
-: build-xml-doc ( tag -- xml-doc )\r
-    T{ prolog f "1.0" "iso-8859-1" f } { } rot { } <xml-doc> ;\r
-\r
-: children>string ( tag -- string )\r
-    tag-children [ string? ] subset concat ;\r
-\r
-: children-tags ( tag -- sequence )\r
-    tag-children [ tag? ] subset ;\r
-\r
-: first-child-tag ( tag -- tag )\r
-    tag-children [ tag? ] find nip ;\r
-\r
-! * Utilities for searching through XML documents\r
-! These all work from the outside in, top to bottom.\r
-\r
-: with-delegate ( object quot -- object )\r
-    over clone >r >r delegate r> call r>\r
-    [ set-delegate ] keep ; inline\r
-\r
-GENERIC: (xml-each) ( quot tag -- ) inline\r
-M: tag (xml-each)\r
-    [ swap call ] 2keep\r
-    tag-children [ (xml-each) ] each-with ;\r
-M: object (xml-each)\r
-    swap call ;\r
-M: xml-doc (xml-each)\r
-    delegate (xml-each) ;\r
-: xml-each ( tag quot -- ) ! quot: tag --\r
-    swap (xml-each) ; inline\r
-\r
-GENERIC: (xml-map) ( quot tag -- tag ) inline\r
-M: tag (xml-map)\r
-    clone over >r swap call r> \r
-    swap [ tag-children [ (xml-map) ] map-with ] keep \r
-    [ set-tag-children ] keep ;\r
-M: object (xml-map)\r
-    swap call ;\r
-M: xml-doc (xml-map)\r
-    [ (xml-map) ] with-delegate ;\r
-: xml-map ( tag quot -- tag ) ! quot: tag -- tag\r
-    swap (xml-map) ; inline\r
-\r
-: xml-subset ( quot tag -- seq ) ! quot: tag -- ?\r
-    V{ } clone rot [\r
-        swap >r [ swap call ] 2keep rot r>\r
-        swap [ [ push ] keep ] [ nip ] if\r
-    ] xml-each nip ;\r
-\r
-GENERIC: (xml-find) ( quot tag -- tag ) inline\r
-M: tag (xml-find)\r
-    [ swap call ] 2keep rot [\r
-        tag-children f swap\r
-        [ nip over >r (xml-find) r> swap dup ] find\r
-        2drop ! leaves result of quot\r
-    ] unless nip ;\r
-M: object (xml-find)\r
-    [ swap call ] keep f ? ;\r
-M: xml-doc (xml-find)\r
-    delegate (xml-find) ;\r
-: xml-find ( tag quot -- tag ) ! quot: tag -- ?\r
-    swap (xml-find) ; inline\r
-\r
-: prop-name ( tag name -- seq/f )\r
-    #! gets the property with the first matching name\r
-    swap tag-props [\r
-        hash-keys [ over names-match? ] find\r
-    ] keep hash 2nip ;\r
-\r
-: prop-name-tag ( tag string -- seq/f )\r
-    ! like prop-name but only with name-tag not the whole name\r
-    f swap f <name> prop-name ;\r
-\r
-: get-id ( tag id -- elem ) ! elem=tag.getElementById(id)\r
-    swap [\r
-        dup tag? [\r
-            "id" prop-name-tag\r
-            [ string? ] subset concat\r
-            over =\r
-        ] [ drop f ] if\r
-    ] xml-find nip ;\r
diff --git a/libs/xml/writer.factor b/libs/xml/writer.factor
deleted file mode 100644 (file)
index 5924d8e..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
-! See http://factorcode.org/license.txt for BSD license.\r
-IN: xml\r
-USING: hashtables kernel math namespaces sequences strings\r
-    io generic ;\r
-\r
-GENERIC: write-str-elem ( elem -- )\r
-\r
-: chars>entities ( str -- str )\r
-    #! Convert <, >, &, ' and " to HTML entities.\r
-    [ [ dup entities hash [ % ] [ , ] ?if ] each ] "" make ;\r
-\r
-M: string write-str-elem\r
-    chars>entities write ;\r
-\r
-M: entity write-str-elem\r
-    CHAR: & write1 entity-name write CHAR: ; write1 ;\r
-\r
-M: reference write-str-elem\r
-    CHAR: % write1 reference-name write CHAR: ; write1 ;\r
-\r
-UNION: str-elem string entity reference ;\r
-\r
-: print-name ( name -- )\r
-    dup name-space dup "" = [ drop ]\r
-    [ write CHAR: : write1 ] if\r
-    name-tag write ;\r
-\r
-: print-props ( hash -- )\r
-    [\r
-        " " write swap print-name "=\"" write\r
-        [ write-str-elem ] each "\"" write\r
-    ] hash-each ;\r
-\r
-GENERIC: write-item ( object -- )\r
-\r
-M: str-elem write-item ! string element\r
-    write-str-elem ;\r
-\r
-M: contained-tag write-item\r
-    CHAR: < write1\r
-    dup print-name\r
-    tag-props print-props\r
-    "/>" write ;\r
-\r
-M: open-tag write-item\r
-    CHAR: < write1\r
-    dup print-name\r
-    dup tag-props print-props\r
-    CHAR: > write1\r
-    dup tag-children [ write-item ] each\r
-    "</" write print-name CHAR: > write1 ;\r
-\r
-M: comment write-item\r
-    "<!--" write comment-text write "-->" write ;\r
-\r
-M: directive write-item\r
-    "<!" write directive-text write CHAR: > write1 ;\r
-\r
-M: instruction write-item\r
-    "<?" write instruction-text write "?>" write ;\r
-\r
-: xml-preamble ( xml -- )\r
-    "<?xml version=\"" write dup prolog-version write\r
-    "\" encoding=\"" write dup prolog-encoding write\r
-    "\" standalone=\"" write\r
-    prolog-standalone "yes" "no" ? write\r
-    "\"?>" write ;\r
-\r
-: write-chunk ( seq -- )\r
-    [ write-item ] each ;\r
-\r
-: write-xml ( xml-doc -- )\r
-    dup xml-doc-prolog xml-preamble\r
-    dup xml-doc-before write-chunk\r
-    dup delegate write-item\r
-    xml-doc-after write-chunk ;\r
-\r
-: print-xml ( xml-doc -- )\r
-    write-xml terpri ;\r
-\r
-: xml>string ( xml-doc -- string )\r
-    [ write-xml ] string-out ;\r
-\r
-: xml-reprint ( string -- )\r
-    string>xml print-xml ;\r
-\r
diff --git a/libs/xml/xml.facts b/libs/xml/xml.facts
deleted file mode 100644 (file)
index afa4c30..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-! Copyright (C) 2005, 2006 Daniel Ehrenberg\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: help kernel xml ;\r
-\r
-HELP: string>xml\r
-{ $values { "string" "a string" } { "xml-doc" "an xml document" } }\r
-{ $description "converts a string into an " { $link xml-doc }\r
-    " datatype for further processing" }\r
-{ $see-also xml>string xml-reprint } ;\r
-\r
-HELP: xml>string\r
-{ $values { "xml-doc" "an xml document" } { "string" "a string" } }\r
-{ $description "converts an xml document (" { $link xml-doc } ") into a string" }\r
-{ $notes "does not preserve what type of quotes were used or what data was omitted from version declaration" }\r
-{ $see-also string>xml xml-reprint write-xml } ;\r
-\r
-HELP: xml-parse-error\r
-{ $class-description "the exception class that all parsing errors in XML documents are in." } ;\r
-\r
-HELP: xml-reprint\r
-{ $values { "string" "a string of XML" } }\r
-{ $description "parses XML and prints it out again, for testing purposes" }\r
-{ $notes "does not preserve what type of quotes were used or what data was omitted from version declaration" }\r
-{ $see-also write-xml xml>string string>xml } ;\r
-\r
-HELP: write-xml\r
-{ $values { "xml-doc" "an XML document" } }\r
-{ $description "prints the contents of an XML document (" { $link xml-doc } ") to stdio" }\r
-{ $notes "does not preserve what type of quotes were used or what data was omitted from version declaration" }\r
-{ $see-also xml>string xml-reprint read-xml } ;\r
-\r
-HELP: read-xml\r
-{ $values { "stream" "a stream that supports readln" }\r
-    { "xml-doc" "an XML document" } }\r
-{ $description "exausts the given stream, reading an XML document from it" }\r
-{ $see-also write-xml string>xml } ;\r
-\r
-HELP: PROCESS:\r
-{ $syntax "PROCESS: word" }\r
-{ $values { "word" "a new word to define" } }\r
-{ $description "creates a new word to process XML tags" }\r
-{ $see-also POSTPONE: TAG: } ;\r
-\r
-HELP: TAG:\r
-{ $syntax "TAG: tag word definition... ;" }\r
-{ $values { "tag" "an xml tag name" } { "word" "an XML process" } }\r
-{ $description "defines what a process should do when it encounters a specific tag" }\r
-{ $examples { $code "PROCESS: x ( tag -- )\nTAG: a x drop \"hi\" write ;" } }\r
-{ $see-also POSTPONE: PROCESS: } ;\r
-\r
-HELP: xml-each\r
-{ $values { "tag" "an XML tag" } { "quot" "a quotation ( element -- )" } }\r
-{ $description "applies the quotation to each element (tags, strings, DTD references, etc) in the tag, moving top-down" }\r
-{ $see-also xml-map xml-subset } ;\r
-\r
-HELP: xml-map\r
-{ $values { "tag" "an XML tag" } { "quot" "a quotation ( element -- element )" }\r
-    { "tag" "an XML tag with the quotation applied to each element" } }\r
-{ $description "applies the quotation to each element (tags, strings, DTD references, etc) in the tag, moving top-down, and produces a new tag" }\r
-{ $see-also xml-each xml-subset } ;\r
-\r
-HELP: xml-subset\r
-{ $values { "tag" "an XML tag" } { "quot" "a quotation ( tag -- ? )" }\r
-    { "seq" "sequence of elements" } }\r
-{ $description "applies the quotation to each element (tags, strings, DTD references, etc) in the tag, moving top-down, producing a sequence of elements which do not return false for the sequence" }\r
-{ $see-also xml-map xml-each } ;\r
-\r
-HELP: build-tag*\r
-{ $values { "items" "sequence of elements" } { "name" "string" }\r
-    { "tag" "an XML tag" } }\r
-{ $description "builds a " { $link tag } " with the specified name, in the namespace \"\" and URL \"\" containing the children listed in item" }\r
-{ $see-also build-tag build-xml-doc } ;\r
-\r
-HELP: build-tag\r
-{ $values { "item" "an element" } { "name" "string" } { "tag" "XML tag" } }\r
-{ $description "builds a " { $link tag } " with the specified name containing the single child item" }\r
-{ $see-also build-tag* build-xml-doc } ;\r
-\r
-HELP: build-xml-doc\r
-{ $values { "tag" "an XML tag" } { "xml-doc" "an XML document" } }\r
-{ $description "builds an XML document out of a tag" }\r
-{ $see-also build-tag* build-tag } ;\r
-\r
-HELP: tag\r
-{ $class-description "tuple representing an XML tag, delegating to a " { $link name } ", containing the slots props (a hashtable) and children (a sequence)" }\r
-{ $see-also <tag> name contained-tag xml-doc } ;\r
-\r
-HELP: <tag>\r
-{ $values { "name" "an XML tag name" }\r
-    { "props" "a hashtable of XML properties" }\r
-    { "children" "a sequence" } }\r
-{ $description "constructs an XML " { $link tag } ", with the name (not a string) and tag properties specified in props, and children specified" }\r
-{ $see-also tag <contained-tag> build-tag build-tag* } ;\r
-\r
-HELP: name\r
-{ $class-description "represents an XML name, with the fields space (a string representing the namespace, as written in the document, tag (a string of the actual name of the tag) and url (a string of the URL that the namespace points to)" }\r
-{ $see-also <name> tag } ;\r
-\r
-HELP: <name> ( space tag url -- name )\r
-{ $values { "space" "a string" } { "tag" "a string" } { "url" "a string" }\r
-    { "name" "an XML tag name" } }\r
-{ $description "creates a name tuple with the name-space space and the tag-name tag and the tag-url url." }\r
-{ $see-also name <tag> } ;\r
-\r
-HELP: contained-tag\r
-{ $class-description "delegates to tag representing a tag like <a/> with no contents. The tag properties are accessed with tag-props" }\r
-{ $see-also tag <contained-tag> } ;\r
-\r
-HELP: <contained-tag>\r
-{ $values { "name" "an XML tag name" }\r
-    { "props" "a hashtable of XML properties" }\r
-    { "contained-tag" "an XML tag" } }\r
-{ $description "creates an empty tag (like <a/>) with the specified name and tag properties. This delegates to tag" }\r
-{ $see-also contained-tag <tag> } ;\r
-\r
-HELP: reference\r
-{ $class-description "represents a DTD reference like %foo;" }\r
-{ $see-also <reference> entity } ;\r
-\r
-HELP: <reference> ( name -- reference )\r
-{ $values { "name" "a string" } { "reference" "an XML reference" } }\r
-{ $description "creates a DTD reference (like %foo;) with the specified name" }\r
-{ $see-also reference <entity> } ;\r
-\r
-HELP: entity\r
-{ $class-description "represents an XML entity like &foo;" }\r
-{ $see-also <entity> reference } ;\r
-\r
-HELP: <entity> ( name -- entity )\r
-{ $values { "name" "a string" } { "entity" "an XML entity" } }\r
-{ $description "creates an XML entity like &foo; with the specified name" }\r
-{ $see-also entity <reference> } ;\r
-\r
-HELP: xml-doc\r
-{ $class-description "tuple representing an XML document, delegating to the main tag, containing the fields prolog (the header <?xml...?>), before (whatever comes between the prolog and the main tag) and after (whatever comes after the main tag)" }\r
-{ $see-also <xml-doc> tag prolog } ;\r
-\r
-HELP: <xml-doc>\r
-{ $values { "prolog" "an XML prolog" } { "before" "a sequence of XML elements" }\r
-    { "main" "an XML tag" } { "after" "a sequence of XML elements" } }\r
-{ $description "creates an XML document, delegating to the main tag, with the specified prolog, before, and after" }\r
-{ $see-also xml-doc <tag> } ;\r
-\r
-HELP: prolog\r
-{ $class-description "represents an XML prolog, with the tuple fields version (containing \"1.0\" or \"1.1\"), encoding (a string representing the encoding type), and standalone (t or f, whether the document is standalone without external entities)" }\r
-{ $see-also <prolog> xml-doc } ;\r
-\r
-HELP: <prolog> ( version encoding standalone -- prolog )\r
-{ $values { "version" "a string, 1.0 or 1.1" }\r
-    { "encoding" "a string" } { "standalone" "a boolean" } }\r
-{ $description "creates an XML prolog tuple" }\r
-{ $see-also prolog <xml-doc> } ;\r
-\r
-HELP: comment\r
-{ $class-description "represents a comment in XML. Has one slot, text, which contains the string of the comment" }\r
-{ $see-also <comment> } ;\r
-\r
-HELP: <comment> ( text -- comment )\r
-{ $values { "text" "a string" } { "comment" "a comment" } }\r
-{ $description "creates an XML comment tuple" }\r
-{ $see-also comment } ;\r
-\r
-HELP: instruction\r
-{ $class-description "represents an XML instruction, such as <?xsl stylesheet='foo.xml'?>. Contains one slot, text, which contains the string between the question marks." }\r
-{ $see-also <instruction> } ;\r
-\r
-HELP: <instruction> ( text -- instruction )\r
-{ $values { "text" "a string" } { "instruction" "an XML instruction" } }\r
-{ $description "creates an XML parsing instruction, such as <?xsl stylesheet='foo.xml'?>." }\r
-{ $see-also instruction } ;\r
-\r
-HELP: names-match?\r
-{ $values { "name1" "a name" } { "name2" "a name" } { "?" "t or f" } }\r
-{ $description "checks to see if the two names match, that is, if all fields are equal, ignoring fields whose value is f in either name." }\r
-{ $example "T{ name f \"rpc\" \"methodCall\" f } T{ name f f \"methodCall\" \"http://www.xmlrpc.org/\" } names-match? ! => t" }\r
-{ $see-also name } ;\r
-\r
-HELP: xml-chunk\r
-{ $values { "stream" "an input stream" } { "seq" "a sequence of elements" } }\r
-{ $description "rather than parse a document, as " { $link read-xml } " does, this word parses and returns a sequence of XML elements (tags, strings, etc). This is useful for fragments of XML which may have more than one main tag." }\r
-{ $see-also read-xml } ;\r
-\r
-HELP: xml-find\r
-{ $values { "tag" "an XML element or document" } { "quot" "a quotation ( elem -- ? )" } { "tag" "an XML element which satisfies the predicate" } }\r
-{ $description "finds the first element in the XML document which satisfies the predicate, moving from the outermost element to the innermost, top-down" }\r
-{ $see-also xml-each xml-map get-id } ;\r
-\r
-HELP: get-id\r
-{ $values { "tag" "an XML tag or document" } { "id" "a string" } { "elem" "an XML element or f" } }\r
-{ $description "finds the XML tag with the specified id, ignoring the namespace" }\r
-{ $see-also xml-find } ;\r
-\r
-HELP: spot\r
-{ $var-description "This variable represents the location in the program. It is in the format { char line column line-str } where char is the current character, line is the line number, column is the column number, and line-str is the full contents of the line, as a string. The contents shouldn't be accessed directly but rather with the proxy words get-char set-char get-line etc." } ;\r
-\r
-HELP: new-record\r
-{ $description "puts the parser into recording mode, where all characters encountered are pushed into a string buffer to be extracted later" }\r
-{ $see-also end-record } ;\r
-\r
-HELP: end-record\r
-{ $values { "string" "a string" } }\r
-{ $description "takes the parser out of recording mode and outputs the string recorded" }\r
-{ $see-also new-record } ;\r
-\r
-HELP: skip-until\r
-{ $values { "quot" "a quotation ( -- ? )" } }\r
-{ $description "executes " { $link next } " until the quotation yields false. Usually, the quotation will call " { $link get-char } " in its test, but not always." }\r
-{ $see-also take-until } ;\r
-\r
-HELP: take-until\r
-{ $values { "quot" "a quotation ( -- ? )" } { "string" "a string" } }\r
-{ $description "like " { $link skip-until } " but records what it passes over and outputs the string." }\r
-{ $see-also skip-until take-char take-string } ;\r
-\r
-HELP: take-char\r
-{ $values { "char" "a character" } { "string" "a string" } }\r
-{ $description "records the document from the current spot to the first instance of the given character. Outputs the content between those two points." }\r
-{ $see-also take-until take-string } ;\r
-\r
-HELP: take-string\r
-{ $values { "match" "a string to match" } { "string" "the portion of the XML document" } }\r
-{ $description "records the document from the current spot to the first instance of the given character. Outputs the content between those two points." }\r
-{ $notes "match may not contain a newline" } ;\r
-\r
-HELP: next\r
-{ $description "originally written as " { $code "spot inc" } ", code that would no longer run, this word moves the state of the XML parser to the next place in the source file, keeping track of appropriate debugging information." } ;\r
-\r
-HELP: process\r
-{ $values { "object" "an opener, closer, contained or text element" } }\r
-{ $description  "takes an XML event and, using the XML stack, processes it and adds it to the tree"  } ;\r
-\r
-HELP: sax\r
-{ $values { "stream" "an input stream" } { "quot" "a quotation ( xml-elem -- )" } }\r
-{ $description "parses the XML document, and whenever an event is encountered (a tag piece, comment, parsing instruction, directive or string element), the quotation is called with that event on the stack. The quotation has all responsibility to deal with the event properly, and it is advised that generic words be used in dispatching on the event class." }\r
-{ $notes "It is important to note that this is not SAX, merely an event-based XML view" }\r
-{ $see-also read-xml } ;\r
-\r
-HELP: opener\r
-{ $class-description "describes an opening tag, like <a>. Contains two slots, name and props, containing, respectively, the name of the tag and its attributes. Usually, the name-url will be f." }\r
-{ $see-also closer contained } ;\r
-\r
-HELP: closer\r
-{ $class-description "describes a closing tag, like </a>. Contains one slot, name, containing the tag's name. Usually, the name-url will be f." }\r
-{ $see-also opener contained } ;\r
-\r
-HELP: contained\r
-{ $class-description "represents a self-closing tag, like <a/>. Contains two slots, name and props, containing, respectively, the name of the tag and its attributes. Usually, the name-url will be f." }\r
-{ $see-also opener closer } ;\r
-\r
-HELP: parse-text\r
-{ $values { "array" "an array of text elements" } }\r
-{ $description "moves the pointer from the current spot to the beginning of the next tag, parsing the text underneath, returning the text elements it passed. This parses DTD references like %foo; and XML entities like &bar; &#97; and &amp;" }\r
-{ $see-also parse-name } ;\r
-\r
-HELP: parse-name\r
-{ $values { "name" "an XML name" } }\r
-{ $description "parses a " { $link name } " from the input stream. Returns a name with only the name-space and name-tag defined, with name-url=f" }\r
-{ $see-also parse-text } ;\r
-\r
-HELP: make-tag\r
-{ $values { "tag" "an opener, closer or contained" } }\r
-{ $description "assuming the pointer is just past a <, this word parses until the next > and emits a tuple representing the tag parsed" }\r
-{ $see-also opener closer contained } ;\r
-\r
-HELP: pull-xml\r
-{ $class-description "represents the state of a pull-parser for XML. Has one slot, scope, which is a namespace which contains all relevant state information." }\r
-{ $see-also <pull-xml> pull-next } ;\r
-\r
-HELP: <pull-xml>\r
-{ $values { "stream" "an input stream containing XML" } { "pull-xml" "a pull-xml tuple" } }\r
-{ $description "creates an XML pull-based parser, executing all initial XML commands to set up the parser" }\r
-{ $see-also pull-xml pull-next } ;\r
-\r
-HELP: pull-next\r
-{ $values { "pull" "an XML pull parser" } { "xml-elem/f" "an XML tag event, sequence of string elements, or f" } }\r
-{ $description "gets the next xml element from the given XML pull parser. Returns f upon exaustion" }\r
-{ $see-also pull-xml <pull-xml> } ;\r
-\r
-HELP: write-item\r
-{ $values { "object" "an XML element" } }\r
-{ $description "writes an XML element to stdio" }\r
-{ $see-also write-chunk write-xml } ;\r
-\r
-HELP: write-chunk\r
-{ $values { "seq" "an XML document fragment" } }\r
-{ $description "writes an XML document fragment, ie a sequence of XML elements, to stdio" }\r
-{ $see-also write-item write-xml } ;\r
-\r
-ARTICLE: { "xml" "intro" } "XML"\r
-    "The XML module attempts to implement the XML 1.1 standard, converting strings of text into XML and vice versa. It currently is a work in progress. Together with XML-RPC, this is a component of the F2EE framework."\r
-    $terpri\r
-    "The XML module was implemented by Daniel Ehrenberg, with edits by Slava Pestov."\r
-    { $subsection { "xml" "basic" } }\r
-    { $subsection { "xml" "classes" } }\r
-    { $subsection { "xml" "construct" } }\r
-    { $subsection { "xml" "utils" } }\r
-    { $subsection { "xml" "internal" } }\r
-    { $subsection { "xml" "events" } } ;\r
-\r
-ARTICLE: { "xml" "basic" } "Basic words for XML processing"\r
-    "These are the most basic words needed for processing an XML document"\r
-    $terpri\r
-    "Parsing XML:"\r
-    { $subsection string>xml }\r
-    { $subsection read-xml }\r
-    { $subsection xml-chunk }\r
-    "Printing XML"\r
-    { $subsection xml>string }\r
-    { $subsection write-xml }\r
-    { $subsection write-item }\r
-    { $subsection write-chunk }\r
-    "Other"\r
-    { $subsection xml-parse-error }\r
-    { $subsection xml-reprint } ;\r
-\r
-ARTICLE: { "xml" "classes" } "XML data classes"\r
-    "Data types that XML documents are made of:"\r
-    { $subsection name }\r
-    { $subsection tag }\r
-    { $subsection contained-tag }\r
-    { $subsection reference }\r
-    { $subsection entity }\r
-    { $subsection xml-doc }\r
-    { $subsection prolog }\r
-    { $subsection comment }\r
-    { $subsection instruction } ;\r
-\r
-ARTICLE: { "xml" "construct" } "XML data constructors"\r
-    "These data types are constructed with:"\r
-    { $subsection <name> }\r
-    { $subsection <tag> }\r
-    { $subsection <contained-tag> }\r
-    { $subsection <reference> }\r
-    { $subsection <entity> }\r
-    { $subsection <xml-doc> }\r
-    { $subsection <prolog> }\r
-    { $subsection <comment> }\r
-    { $subsection <instruction> } ;\r
-\r
-ARTICLE: { "xml" "utils" } "XML processing utilities"\r
-    "Utilities for processing XML include..."\r
-    $terpri\r
-    "System sfor creating words which dispatch on XML tags:"\r
-    { $subsection POSTPONE: PROCESS: }\r
-    { $subsection POSTPONE: TAG: }\r
-    "Combinators for traversing XML trees:"\r
-    { $subsection xml-each }\r
-    { $subsection xml-map }\r
-    { $subsection xml-subset }\r
-    { $subsection xml-find }\r
-    { $subsection get-id }\r
-    "Words for simplified generation of XML:"\r
-    { $subsection build-tag* }\r
-    { $subsection build-tag }\r
-    { $subsection build-xml-doc }\r
-    "Other relevant words:"\r
-    { $subsection names-match? } ;\r
-\r
-ARTICLE: { "xml" "internal" } "Internals of the XML parser"\r
-    "The XML parser creates its own parsing framework to process XML documents. The parser operates on streams. Important words involved in processing are:"\r
-    { $subsection spot }\r
-    { $subsection new-record }\r
-    { $subsection end-record }\r
-    { $subsection skip-until }\r
-    { $subsection take-until }\r
-    { $subsection take-char }\r
-    { $subsection take-string }\r
-    { $subsection next }\r
-    { $subsection parse-text }\r
-    { $subsection make-tag }\r
-    { $subsection parse-name }\r
-    { $subsection process } ; ! should I have more? less?\r
-\r
-ARTICLE: { "xml" "events" } "Event-based XML parsing"\r
-    "In addition to DOM-style parsing based around " { $link read-xml } ", the XML module also provides SAX-style event-based parsing. This uses much of the same data structures as normal XML, with the exception of the classes " { $link xml-doc } " and " { $link tag } " and as such, the articles " { $link { "xml" "classes" } } " and " { $link { "xml" "construct" } } " may be useful in learning how to process documents in this way. Other useful words are:"\r
-    { $subsection sax }\r
-    { $subsection opener }\r
-    { $subsection closer }\r
-    { $subsection contained }\r
-    "There is also pull-based parsing to augment the push-parsing of SAX. This is probably easier to use and more logical. It uses the same parsing objects as the above style of parsing, except string elements are always in arrays, for example { \"\" }. Relevant pull-parsing words are:"\r
-    { $subsection <pull-xml> }\r
-    { $subsection pull-xml }\r
-    { $subsection pull-next } ;\r
index 7229e7c12c8eb48050f266d6af66c3f1b0c63dd3..87f170da8c9f24d4ae0eabe4e43cadac59db6307 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003, 2006 Slava Pestov and friends.
+ * Copyright (C) 2003, 2007 Slava Pestov and friends.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
diff --git a/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage b/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage
new file mode 100644 (file)
index 0000000..ec4961f
--- /dev/null
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>fileTypes</key>
+       <array>
+               <string>factor</string>
+               <string>facts</string>
+       </array>
+       <key>foldingStartMarker</key>
+       <string>^\s*(M|C)?:|#(V|H|C)\{</string>
+       <key>foldingStopMarker</key>
+       <string>^\s*$</string>
+       <key>keyEquivalent</key>
+       <string>^~F</string>
+       <key>name</key>
+       <string>Factor</string>
+       <key>patterns</key>
+       <array>
+               <dict>
+                       <key>captures</key>
+                       <dict>
+                               <key>2</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>keyword.colon.factor</string>
+                               </dict>
+                               <key>3</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>entity.name.function.factor</string>
+                               </dict>
+                               <key>4</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>comment.stack-effect.factor</string>
+                               </dict>
+                       </dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(:)\s+([^\s]+)\s</string>
+                       <key>name</key>
+                       <string>definition.word.factor</string>
+               </dict>
+               <dict>
+                       <key>captures</key>
+                       <dict>
+                               <key>2</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>keyword.colon.factor</string>
+                               </dict>
+                               <key>3</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>entity.name.method.factor</string>
+                               </dict>
+                               <key>4</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>comment.stack-effect.factor</string>
+                               </dict>
+                       </dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(C:)\s+([^\s]+)\s</string>
+                       <key>name</key>
+                       <string>definition.word.class.factor</string>
+               </dict>
+               <dict>
+                       <key>captures</key>
+                       <dict>
+                               <key>2</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>keyword.colon.factor</string>
+                               </dict>
+                               <key>3</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>entity.name.class.factor</string>
+                               </dict>
+                               <key>4</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>entity.name.method.factor</string>
+                               </dict>
+                               <key>5</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>comment.stack-effect.factor</string>
+                               </dict>
+                       </dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(M:)\s+([^\s]+)\s+([^\s]+)\s</string>
+                       <key>name</key>
+                       <string>definition.word.method.factor</string>
+               </dict>
+               <dict>
+                       <key>captures</key>
+                       <dict>
+                               <key>2</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>keyword.colon.factor</string>
+                               </dict>
+                               <key>4</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>entity.name.generic.factor</string>
+                               </dict>
+                               <key>5</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>comment.stack-effect.factor</string>
+                               </dict>
+                       </dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(G(ENERIC)?:)\s+([^\s]+)\s</string>
+                       <key>name</key>
+                       <string>definition.word.generic.factor</string>
+               </dict>
+               <dict>
+                       <key>captures</key>
+                       <dict>
+                               <key>2</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>storage.type.factor</string>
+                               </dict>
+                               <key>3</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>entity.name.class.factor</string>
+                               </dict>
+                       </dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(TUPLE:)\s+([^\s]+)\s+(([^\s]+)+)</string>
+                       <key>name</key>
+                       <string>meta.class.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(drop|2drop|3drop|keep|2keep|3keep|nip|2nip|dup|2dup|3dup|dupd|over|pick|tuck|swap|rot|-rot|slip|2swap|swapd|&gt;r|r&gt;)(\s|$)</string>
+                       <key>name</key>
+                       <string>keyword.control.stack.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(get|set)(\s|$)</string>
+                       <key>name</key>
+                       <string>keyword.control.variable.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(if|when|unless|if*|unless*|when*)\*?(\s|$)</string>
+                       <key>name</key>
+                       <string>keyword.control.flow.factor</string>
+               </dict>
+               <dict>
+                       <key>begin</key>
+                       <string>(^|(?&lt;=\s))(USING:)</string>
+                       <key>end</key>
+                       <string>(?&lt;=\s);(\s|$)</string>
+                       <key>name</key>
+                       <string>keyword.control.using.factor</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>match</key>
+                                       <string>(^|(?&lt;=\s))[^\s]+(\s|$)</string>
+                                       <key>name</key>
+                                       <string>constant.namespace.factor</string>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>begin</key>
+                       <string>(^|(?&lt;=\s))(REQUIRES:)</string>
+                       <key>end</key>
+                       <string>(?&lt;=\s);(\s|$)</string>
+                       <key>name</key>
+                       <string>keyword.control.requires.factor</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>match</key>
+                                       <string>(^|(?&lt;=\s))[^\s]+(\s|$)</string>
+                                       <key>name</key>
+                                       <string>constant.namespace.factor</string>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))(f|t)(\s|$)</string>
+                       <key>name</key>
+                       <string>constant.language.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))CHAR:\s+[^\s]+(\s|$)</string>
+                       <key>name</key>
+                       <string>constant.character.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))((BIN:|OCT:)\s+)?-?\d+(\s|$)</string>
+                       <key>name</key>
+                       <string>constant.numeric.integer.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))HEX:\s+-?[\dA-Fa-f]+(\s|$)</string>
+                       <key>name</key>
+                       <string>constant.numeric.hexadecimal.integer.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))-?+\d+\.\d+(E(\+|-)\d+)?(\s|$)</string>
+                       <key>name</key>
+                       <string>constant.numeric.float.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))-?\d+/-?\d+(\s|$)</string>
+                       <key>name</key>
+                       <string>constant.numeric.rational.factor</string>
+               </dict>
+               <dict>
+                       <key>begin</key>
+                       <string>"</string>
+                       <key>end</key>
+                       <string>"</string>
+                       <key>name</key>
+                       <string>string.quoted.double.factor</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#escaped_characters</string>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>inline|foldable</string>
+                       <key>name</key>
+                       <string>storage.modifier.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>(^|(?&lt;=\s))#?!(\s.*)?$</string>
+                       <key>name</key>
+                       <string>comment.line.factor</string>
+               </dict>
+               <dict>
+                       <key>begin</key>
+                       <string>\(\s</string>
+                       <key>end</key>
+                       <string>\s\)</string>
+                       <key>name</key>
+                       <string>comment.parens.factor</string>
+               </dict>
+               <dict>
+                       <key>match</key>
+                       <string>\b[^\s]+:\s+[^\s]+(\s|$)</string>
+                       <key>name</key>
+                       <string>keyword.control.postpone.factor</string>
+               </dict>
+       </array>
+       <key>repository</key>
+       <dict>
+               <key>escaped_characters</key>
+               <dict>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>match</key>
+                                       <string>\\(\\|[enrts'"?]|[0-3]\d{,2}|[4-7]\d?|u[a-fA-F0-9]{,2})</string>
+                                       <key>name</key>
+                                       <string>constant.character.escape.factor</string>
+                               </dict>
+                               <dict>
+                                       <key>match</key>
+                                       <string>\\.</string>
+                                       <key>name</key>
+                                       <string>invalid.illegal.unknown-escape.factor</string>
+                               </dict>
+                       </array>
+               </dict>
+       </dict>
+       <key>scopeName</key>
+       <string>source.factor</string>
+       <key>uuid</key>
+       <string>3C9C9C2A-314A-475B-A4E4-A68BAAF3F36E</string>
+</dict>
+</plist>
diff --git a/misc/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage b/misc/Factor.tmbundle/Syntaxes/HTML (Factor).tmLanguage
new file mode 100644 (file)
index 0000000..89c0f19
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>fileTypes</key>
+       <array>
+               <string>furnace</string>
+               <string>fhtml</string>
+       </array>
+       <key>foldingStartMarker</key>
+       <string>(?x)
+               (&lt;(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)\b.*?&gt;
+               |&lt;!--(?!.*--&gt;)
+               |\{\s*($|\?&gt;\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
+               )</string>
+       <key>foldingStopMarker</key>
+       <string>(?x)
+               (&lt;/(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|form|dl)&gt;
+               |^\s*--&gt;
+               |(^|\s)\}
+               )</string>
+       <key>keyEquivalent</key>
+       <string>^~F</string>
+       <key>name</key>
+       <string>HTML (Factor)</string>
+       <key>patterns</key>
+       <array>
+               <dict>
+                       <key>begin</key>
+                       <string>&lt;%\s</string>
+                       <key>end</key>
+                       <string>\s%&gt;</string>
+                       <key>name</key>
+                       <string>source.factor.embedded.html</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>source.factor</string>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>include</key>
+                       <string>text.html.basic</string>
+               </dict>
+       </array>
+       <key>scopeName</key>
+       <string>text.html.factor</string>
+       <key>uuid</key>
+       <string>141517D7-73E0-4475-A481-71102575A175</string>
+</dict>
+</plist>
diff --git a/misc/Factor.tmbundle/info.plist b/misc/Factor.tmbundle/info.plist
new file mode 100644 (file)
index 0000000..8def380
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>name</key>
+       <string>Factor</string>
+       <key>uuid</key>
+       <string>8061D2F3-B603-411D-AFFE-61784A07906D</string>
+</dict>
+</plist>
diff --git a/misc/factor.el b/misc/factor.el
new file mode 100644 (file)
index 0000000..6598f2c
--- /dev/null
@@ -0,0 +1,173 @@
+;; Eduardo Cavazos - wayo.cavazos@gmail.com
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Add these lines to your .emacs file:
+
+;; (load-file "/scratch/repos/Factor/misc/factor.el")
+;; (setq factor-binary "/scratch/repos/Factor/factor")
+;; (setq factor-image "/scratch/repos/Factor/factor.image")
+
+;; Of course, you'll have to edit the directory paths for your system
+;; accordingly.
+
+;; That's all you have to do to "install" factor.el on your
+;; system. Whenever you edit a factor file, Emacs will know to switch
+;; to Factor mode.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; M-x run-factor === Start a Factor listener inside Emacs
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; BUG: A double quote character on a commented line will break the
+;; syntax highlighting for that line.
+
+(defgroup factor nil
+  "Factor mode"
+  :group 'languages)
+
+(defvar factor-mode-syntax-table nil
+  "Syntax table used while in Factor mode.")
+
+(if factor-mode-syntax-table
+    ()
+  (let ((i 0))
+    (setq factor-mode-syntax-table (make-syntax-table))
+
+    ;; Default is atom-constituent
+    (while (< i 256)
+      (modify-syntax-entry i "_   " factor-mode-syntax-table)
+      (setq i (1+ i)))
+
+    ;; Word components.
+    (setq i ?0)
+    (while (<= i ?9)
+      (modify-syntax-entry i "w   " factor-mode-syntax-table)
+      (setq i (1+ i)))
+    (setq i ?A)
+    (while (<= i ?Z)
+      (modify-syntax-entry i "w   " factor-mode-syntax-table)
+      (setq i (1+ i)))
+    (setq i ?a)
+    (while (<= i ?z)
+      (modify-syntax-entry i "w   " factor-mode-syntax-table)
+      (setq i (1+ i)))
+
+    ;; Whitespace
+    (modify-syntax-entry ?\t " " factor-mode-syntax-table)
+    (modify-syntax-entry ?\n ">" factor-mode-syntax-table)
+    (modify-syntax-entry ?\f " " factor-mode-syntax-table)
+    (modify-syntax-entry ?\r " " factor-mode-syntax-table)
+    (modify-syntax-entry ?  " " factor-mode-syntax-table)
+
+    (modify-syntax-entry ?\[ "(]  " factor-mode-syntax-table)
+    (modify-syntax-entry ?\] ")[  " factor-mode-syntax-table)
+    (modify-syntax-entry ?{ "(}  " factor-mode-syntax-table)
+    (modify-syntax-entry ?} "){  " factor-mode-syntax-table)
+
+    (modify-syntax-entry ?\( "()" factor-mode-syntax-table)
+    (modify-syntax-entry ?\) ")(" factor-mode-syntax-table)
+    (modify-syntax-entry ?\" "\"    " factor-mode-syntax-table)))
+
+(defvar factor-mode-map (make-sparse-keymap))
+    
+(defcustom factor-mode-hook nil
+  "Hook run when entering Factor mode."
+  :type 'hook
+  :group 'factor)
+
+(defconst factor-font-lock-keywords
+  '(("#!.*$" . font-lock-comment-face)
+    ("!( .* )" . font-lock-comment-face)
+    ("^!.*$" . font-lock-comment-face)
+    (" !.*$" . font-lock-comment-face)
+    ("( .* )" . font-lock-comment-face)
+    "MAIN:"
+    "IN:" "USING:" "TUPLE:" "^C:" "^M:" "USE:" "REQUIRE:" "PROVIDE:"
+    "REQUIRES:"
+    "GENERIC:" "GENERIC#" "SYMBOL:" "PREDICATE:" "VAR:" "VARS:"
+    "UNION:" "<PRIVATE" "PRIVATE>" "MACRO:" "MACRO::" "DEFER:"))
+
+(defun factor-mode ()
+  "A mode for editing programs written in the Factor programming language."
+  (interactive)
+  (kill-all-local-variables)
+  (use-local-map factor-mode-map)
+  (setq major-mode 'factor-mode)
+  (setq mode-name "Factor")
+  (make-local-variable 'comment-start)
+  (setq comment-start "! ")
+  (make-local-variable 'font-lock-defaults)
+  (setq font-lock-defaults
+       '(factor-font-lock-keywords nil nil nil nil))
+  (set-syntax-table factor-mode-syntax-table)
+  (run-hooks 'factor-mode-hooks))
+
+(add-to-list 'auto-mode-alist '("\\.factor\\'" . factor-mode))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(require 'comint)
+
+(defvar factor-binary "/scratch/repos/Factor/factor")
+(defvar factor-image "/scratch/repos/Factor/factor.image")
+
+(defun run-factor ()
+  (interactive)
+  (switch-to-buffer
+   (make-comint-in-buffer "factor" nil factor-binary nil
+                         (concat "-i=" factor-image)
+                         "-run=listener")))
+
+(defun factor-telnet-to-port (port)
+  (interactive "nPort: ")
+  (switch-to-buffer
+   (make-comint-in-buffer "factor-telnet" nil (cons "localhost" port))))
+
+(defun factor-telnet ()
+  (interactive)
+  (factor-telnet-to-port 9000))
+
+(defun factor-telnet-factory ()
+  (interactive)
+  (factor-telnet-to-port 9010))
+
+(defun factor-run-file ()
+  (interactive)
+  (comint-send-string "*factor*" (format "\"%s\"" (buffer-file-name)))
+  (comint-send-string "*factor*" " run-file\n"))
+
+(defun factor-send-region (start end)
+  (interactive "r")
+  (comint-send-region "*factor*" start end)
+  (comint-send-string "*factor*" "\n"))
+
+(defun factor-see ()
+  (interactive)
+  (comint-send-string "*factor*" "\\ ")
+  (comint-send-string "*factor*" (thing-at-point 'sexp))
+  (comint-send-string "*factor*" " see\n"))
+
+(defun factor-help ()
+  (interactive)
+  (comint-send-string "*factor*" "\\ ")
+  (comint-send-string "*factor*" (thing-at-point 'sexp))
+  (comint-send-string "*factor*" " help\n"))
+
+(defun factor-edit ()
+  (interactive)
+  (comint-send-string "*factor*" "\\ ")
+  (comint-send-string "*factor*" (thing-at-point 'sexp))
+  (comint-send-string "*factor*" " edit\n"))
+  
+(defun factor-comment-line ()
+  (interactive)
+  (beginning-of-line)
+  (insert "! "))
+
+
+(define-key factor-mode-map "\C-c\C-f" 'factor-run-file)
+(define-key factor-mode-map "\C-c\C-r" 'factor-send-region)
+(define-key factor-mode-map "\C-c\C-s" 'factor-see)
+(define-key factor-mode-map "\C-ce" 'factor-edit)
+(define-key factor-mode-map "\C-c\C-h" 'factor-help)
diff --git a/misc/factor.vim b/misc/factor.vim
new file mode 100644 (file)
index 0000000..4d15245
--- /dev/null
@@ -0,0 +1,232 @@
+" Vim syntax file
+" Language:    factor
+" Maintainer:  Alex Chapman <chapman.alex@gmail.com>
+" Last Change: 2007 Jan 18
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+" factor is case sensitive.
+syn case match
+
+" make all of these characters part of a word (useful for skipping over words with w, e, and b)
+if version >= 600
+    setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
+else
+    set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
+endif
+
+syn cluster factorCluster contains=factorComment,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorString,factorSbuf,@factorNumber,@factorNumErr,factorDelimiter,factorChar,factorCharErr,factorBackslash,@factorWordOps,factorAlien,factorTuple
+
+syn match factorTodo /\(TODO\|FIXME\|XXX\):\=/ contained
+syn match factorComment /\<#! .*/ contains=factorTodo
+syn match factorComment /\<! .*/ contains=factorTodo
+
+syn region None matchgroup=factorDefinition start=/\<\(C\|M\|G\|UNION\|PREDICATE\)\?:\>/ end=/\<;\>/ contains=@factorCluster,factorStackEffect,factorStackEffectErr,factorArray0,factorQuotation0
+
+syn region None matchgroup=factorGeneric start=/\<GENERIC:\>/ end=/$/ contains=factorStackEffect,factorStackEffectErr
+
+syn keyword factorBoolean boolean f general-t t
+syn keyword factorCompileDirective inline foldable parsing
+
+
+
+" kernel vocab keywords
+syn keyword factorKeyword continuation-name set-datastack wrapper continuation-catch set-continuation-name slip pick 2slip 2nip tuple set-boot clone with-datastack cpu -roll tuck -rot (continue) set-continuation-retain swapd <continuation> >boolean wrapper? dupd 3dup dup ifcc callstack windows? os-env = over continuation alist>quot ? <wrapper> 2dup cond win64? <quotation> continue 3drop hashcode quotation xor when curry millis set-callstack unless >r die version callcc0 or os callcc1 get-walker-hook depth equal? 3keep no-cond? continue-with if exit tuple? set-retainstack unix? (continue-with) general-t continuation? 3slip <no-cond> macosx? r> rot win32? retainstack 2apply >quotation >continuation< type continuation-call clear call drop continuation-data set-continuation-call 2drop no-cond unit set-continuation-data keep-datastack and when* quotation? ?if literalize datastack swap unless* 2swap set-continuation-catch eq? not roll set-walker-hook continuation-retain with make-dip wrapped keep 2keep <=> if* nip 
+syn keyword factorKeyword sin integer? log2 cot oct> number>string integer first-bignum sech abs repeat tanh real? vmin norm-sq neg between? asech >rect bignum? atanh -i * + fp-nan? - small / sqrt infimum fix-float cosech even? v*n < bits>double > most-positive-fixnum ^theta numerator digit+ >base (random-int) acosech cosh min pi number vmax zero? sum digit> rem bitor supremum string>integer most-negative-fixnum >polar >fraction ceiling acos acot ^ asin acosh /f ratio e fixnum? /i ^n cis coth 1+ 1- conjugate sinh acosec i number= number? double>bits epsilon float product string>number n/v norm max tan acoth absq float? asinh denominator rational? fixnum rect> >fixnum imaginary recip exp sec bitxor w>h/h >bin align base> times log <= [-] init-random sq odd? (repeat) [v-] ^mag bitnot ratio? random-int >digit (next-power-of-2) v* v+ v- v. v/ >float [-1,1]? arg small? bitand set-axis >oct v/n complex rational shift (^) polar> (gcd) cosec next-power-of-2 >float-rect atan sgn >= float>bits normalize real bin> complex? gcd d>w/w hex> mod string>ratio asec floor n*v >hex truncate bits>float vneg >bignum bignum power-of-2? integer, /mod (string>integer) cos 
+syn keyword factorKeyword second sort-values all-eq? pop* find slice-error-reason inject-with prune remove (group) split1-slice slice-error (slice*) split* head-slice* find* split, first remove-nth hash-prune push-if ?push reverse subseq split1 diff subset split new padding column? copy-into-check column@ <column> peek last/first add find-last ?nth add* slice-from cache-nth subseq? <reversed> <slice-error> (3append) replace-slice reversed-seq find-last-with empty? ((append)) reversed? reversed@ map-with find-last-with* set-slice-error-reason set-column-col natural-sort (subst) set-slice-seq index* concat push binsearch slice-seq 3append nsort length tail-slice* reversed ?head sequence= ?tail sequence? memq? join split-next, delete set-nth subst monotonic? group map flip unclip set-reversed-seq find-last* start* max-length assoc min-length all-equal? all? pad-left contains? inject slice <slice> first2 first3 first4 exchange bounds-check? column-seq check-slice pad-right each subset-with unpair tail head interleave (delete) copy-into sort sequence reduce set-slice-from set-slice-to 2map (cut) member? cut rassoc (append) last-index* sort-keys change-nth 2each >sequence nth tail* head* third tail-slice set-length collapse-slice column (mismatch) contains-with? push-new pop tail? head? slice? slice@ delete-all binsearch* move find-with* 2reduce slice-to find-with like slice-error? set-column-seq nappend column-col cut* (split) index each-with last-index fourth append accumulate drop-prefix mismatch head-slice all-with? start 
+syn keyword factorKeyword namespace-error-object inc dec make off bind get-global init-namespaces set-global namespace on ndrop namespace-error? namestack namespace-error +@ # % make-hash global , set-namestack with-scope building <namespace-error> change nest set-namespace-error-object get set counter 
+syn keyword factorKeyword array <array> pair byte-array pair? 1array 2array resize-array 4array 3array byte-array? <byte-array> array? >array 
+syn keyword factorKeyword cwd duplex-stream pathname? set-pathname-string with-log-file directory duplex-stream-out format <nested-style-stream> (readln) duplex-stream? read1 with-stream-style c-stream-error? <file-reader> stream-write1 with-stream line-reader? set-duplex-stream-out server? cr> <check-closed> directory? log-message flush format-column stream-readln nested-style-stream? <line-reader> <file-r/w> set-timeout write-pathname file-modified duplex-stream-closed? print set-duplex-stream-closed? pathname line-reader ?resource-path terpri write-object le> string-out stream-terpri log-client do-nested-style path+ <c-stream-error> set-client-stream-host plain-writer? server-stream resource-path >be parent-dir with-stream* <file-writer> server-loop string-in nested-style-stream stream-close stream-copy c-stream-error <client-stream> with-style client-stream-host stat plain-writer file-length contents <string-reader> stream-read stream-format check-closed? set-client-stream-port <duplex-stream> <server> write1 bl write-outliner map-last (with-stream-style) set-line-reader-cr tabular-output (lines) stream-write log-stream server-client (stream-copy) with-nested-stream lines readln cd client-stream nth-byte with-logging stream-read1 nested-style-stream-style accept check-closed client-stream-port do-nested-quot pathname-string set-nested-style-stream-style read home close with-stream-table stdio be> log-error duplex-stream-out+ server stream-flush set-duplex-stream-in line-reader-cr >le with-client <client> <pathname> <string-writer> (directory) set-server-client stream-print with-server exists? <plain-writer> with-nesting string-lines write duplex-stream-in client-stream? duplex-stream-in+ 
+syn keyword factorKeyword sbuf ch>upper string? LETTER? >sbuf >lower quotable? string>sbuf blank? string sbuf? printable? >string letter? resize-string control? alpha? <string> >upper Letter? ch>lower digit? <sbuf> ch>string 
+syn keyword factorKeyword <vector> >vector array>vector vector? vector 
+syn keyword factorKeyword set-restart-continuation cleanup error-hook restart-name restarts. stack-underflow. expired-error. restart restart? word-xt. (:help-none) set-catchstack c-string-error. condition <assert> debug-help :get datastack-overflow. set-condition-restarts condition? error. objc-error. print-error assert :res catchstack rethrow assert= kernel-error restart-obj assert? undefined-symbol-error. retainstack-overflow. restarts error-help divide-by-zero-error. ffi-error. signal-error. (:help-multi) set-restart-obj xt. memory-error. retainstack-underflow. set-condition-continuation datastack-underflow. try assert-depth error-continuation error-stack-trace assert-expect recover :edit kernel-error? error callstack-overflow. stack-overflow. callstack-underflow. set-assert-got set-restart-name restart-continuation condition-restarts heap-scan-error. :help type-check-error. <condition> assert-got throw negative-array-size-error. :c condition-continuation :trace undefined-word-error. io-error. parse-dump <restart> set-assert-expect :r :s compute-restarts catch restart. 
+
+
+syn cluster factorReal   contains=factorInt,factorFloat,factorRatio,factorBinary,factorHex,factorOctal
+syn cluster factorNumber contains=@factorReal,factorComplex
+syn cluster factorNumErr contains=factorBinErr,factorHexErr,factorOctErr
+syn match   factorInt          /\<-\=\d\+\>/
+syn match   factorFloat                /\<-\=\d*\.\d\+\>/
+syn match   factorRatio                /\<-\=\d*\.*\d\+\/-\=\d*\.*\d\+\>/
+syn region  factorComplex      start=/\<C{\>/ end=/\<}\>/ contains=@factorReal
+syn match   factorBinErr        /\<BIN:\s\+[01]*[^\s01]\S*\>/
+syn match   factorBinary        /\<BIN:\s\+[01]\+\>/
+syn match   factorHexErr        /\<HEX:\s\+\x*[^\x\s]\S*\>/
+syn match   factorHex           /\<HEX:\s\+\x\+\>/
+syn match   factorOctErr        /\<OCT:\s\+\o*[^\o\s]\S*\>/
+syn match   factorOctal         /\<OCT:\s\+\o\+\>/
+
+syn match factorIn /\<IN:\s\+\S\+\>/
+syn match factorUse /\<USE:\s\+\S\+\>/
+
+syn match factorCharErr /\<CHAR:\s\+\S\+/
+syn match factorChar /\<CHAR:\s\+\\\=\S\>/
+
+syn match factorBackslash /\<\\\>\s\+\S\+\>/
+
+syn region factorUsing start=/\<USING:\>/ end=/;/
+syn region factorRequires start=/\<REQUIRES:\>/ end=/;/
+
+syn cluster factorWordOps contains=factorSymbol,factorPostpone,factorDefer,factorForget
+syn match factorSymbol /\<SYMBOL:\s\+\S\+\>/
+syn match factorPostpone /\<POSTPONE:\s\+\S\+\>/
+syn match factorDefer /\<DEFER:\s\+\S\+\>/
+syn match factorForget /\<FORGET:\s\+\S\+\>/
+
+syn match factorAlien /\<ALIEN:\s\+\d\+\>/
+
+syn region factorTuple start=/\<TUPLE:\>/ end=/\<;\>/
+
+"TODO:
+"misc:
+" HELP:
+" ARTICLE:
+" PROVIDE:
+" MAIN:
+"literals:
+" PRIMITIVE:
+
+"C interface:
+" FIELD:
+" BEGIN-STRUCT:
+" C-ENUM:
+" FUNCTION:
+" END-STRUCT
+" DLL"
+" TYPEDEF:
+" LIBRARY:
+" C-UNION:
+
+syn region factorString start=/"/ skip=/\\"/ end=/"/ oneline
+syn region factorSbuf start=/SBUF" / skip=/\\"/ end=/"/ oneline
+
+syn match factorStackEffectErr /\<)\>/
+syn region factorStackEffectErr start=/\<(\>/ end=/\<)\>/
+syn region factorStackEffect start=/\<(\>/ end=/\<)\>/ contained
+
+"adapted from lisp.vim
+if exists("g:factor_norainbow") 
+    syn region factorQuotation matchgroup=factorDelimiter start=/\<\[\>/ matchgroup=factorDelimiter end=/\<\]\>/ contains=ALL
+else
+    syn region factorQuotation0           matchgroup=hlLevel0 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1,factorArray1
+    syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2,factorArray2
+    syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3,factorArray3
+    syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4,factorArray4
+    syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5,factorArray5
+    syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6,factorArray6
+    syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7,factorArray7
+    syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8,factorArray8
+    syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9,factorArray9
+    syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0,factorArray0
+endif
+
+if exists("g:factor_norainbow") 
+    syn region factorArray    matchgroup=factorDelimiter start=/\<\(V\|H\|T\|W\)\?{\>/  matchgroup=factorDelimiter end=/\<}\>/ contains=ALL
+else
+    syn region factorArray0           matchgroup=hlLevel0 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray1,factorQuotation1
+    syn region factorArray1 contained matchgroup=hlLevel1 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray2,factorQuotation2
+    syn region factorArray2 contained matchgroup=hlLevel2 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray3,factorQuotation3
+    syn region factorArray3 contained matchgroup=hlLevel3 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray4,factorQuotation4
+    syn region factorArray4 contained matchgroup=hlLevel4 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray5,factorQuotation5
+    syn region factorArray5 contained matchgroup=hlLevel5 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray6,factorQuotation6
+    syn region factorArray6 contained matchgroup=hlLevel6 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray7,factorQuotation7
+    syn region factorArray7 contained matchgroup=hlLevel7 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray8,factorQuotation8
+    syn region factorArray8 contained matchgroup=hlLevel8 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray9,factorQuotation9
+    syn region factorArray9 contained matchgroup=hlLevel9 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray0,factorQuotation0
+endif
+
+syn match factorBracketErr /\<\]\>/
+syn match factorBracketErr /\<}\>/
+
+syn sync lines=100
+
+if version >= 508 || !exists("did_factor_syn_inits")
+    if version <= 508
+       let did_factor_syn_inits = 1
+       command -nargs=+ HiLink hi link <args>
+    else
+       command -nargs=+ HiLink hi def link <args>
+    endif
+
+    HiLink factorComment       Comment
+    HiLink factorStackEffect   Typedef
+    HiLink factorTodo          Todo
+    HiLink factorInclude       Include
+    HiLink factorRepeat                Repeat
+    HiLink factorConditional   Conditional
+    HiLink factorKeyword       Keyword
+    HiLink factorOperator      Operator
+    HiLink factorBoolean       Boolean
+    HiLink factorDefinition    Typedef
+    HiLink factorString                String
+    HiLink factorSbuf          String
+    HiLink factorBracketErr     Error
+    HiLink factorStackEffectErr Error
+    HiLink factorComplex       Number
+    HiLink factorRatio          Number
+    HiLink factorBinary         Number
+    HiLink factorBinErr         Error
+    HiLink factorHex            Number
+    HiLink factorHexErr         Error
+    HiLink factorOctal          Number
+    HiLink factorOctErr         Error
+    HiLink factorFloat         Float
+    HiLink factorInt           Number
+    HiLink factorUsing          Include
+    HiLink factorUse            Include
+    HiLink factorRequires       Include
+    HiLink factorIn             Define
+    HiLink factorChar           Character
+    HiLink factorCharErr        Error
+    HiLink factorDelimiter      Delimiter
+    HiLink factorBackslash      Special
+    HiLink factorCompileDirective Keyword
+    HiLink factorSymbol         Define
+    HiLink factorPostpone       Define
+    HiLink factorDefer          Define
+    HiLink factorForget         Define
+    HiLink factorAlien          Define
+    HiLink factorTuple          Typedef
+    HiLink factorGeneric        Define
+
+    if &bg == "dark"
+       hi   hlLevel0 ctermfg=red         guifg=red1
+       hi   hlLevel1 ctermfg=yellow      guifg=orange1
+       hi   hlLevel2 ctermfg=green       guifg=yellow1
+       hi   hlLevel3 ctermfg=cyan        guifg=greenyellow
+       hi   hlLevel4 ctermfg=magenta     guifg=green1
+       hi   hlLevel5 ctermfg=red         guifg=springgreen1
+       hi   hlLevel6 ctermfg=yellow      guifg=cyan1
+       hi   hlLevel7 ctermfg=green       guifg=slateblue1
+       hi   hlLevel8 ctermfg=cyan        guifg=magenta1
+       hi   hlLevel9 ctermfg=magenta     guifg=purple1
+    else
+       hi   hlLevel0 ctermfg=red         guifg=red3
+       hi   hlLevel1 ctermfg=darkyellow  guifg=orangered3
+       hi   hlLevel2 ctermfg=darkgreen   guifg=orange2
+       hi   hlLevel3 ctermfg=blue        guifg=yellow3
+       hi   hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
+       hi   hlLevel5 ctermfg=red         guifg=green4
+       hi   hlLevel6 ctermfg=darkyellow  guifg=paleturquoise3
+       hi   hlLevel7 ctermfg=darkgreen   guifg=deepskyblue4
+       hi   hlLevel8 ctermfg=blue        guifg=darkslateblue
+       hi   hlLevel9 ctermfg=darkmagenta guifg=darkviolet
+    endif
+
+    delcommand HiLink
+endif
+
+let b:current_syntax = "factor"
+
+set sw=4
+set ts=4
+set expandtab
+set autoindent " annoying?
+
+" vim: syntax=vim
diff --git a/misc/factor.vim.fgen b/misc/factor.vim.fgen
new file mode 100644 (file)
index 0000000..9782c4f
--- /dev/null
@@ -0,0 +1,229 @@
+<% USING: kernel io prettyprint words sequences ;
+%>" Vim syntax file
+" Language:    factor
+" Maintainer:  Alex Chapman <chapman.alex@gmail.com>
+" Last Change: 2007 Jan 18
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+" factor is case sensitive.
+syn case match
+
+" make all of these characters part of a word (useful for skipping over words with w, e, and b)
+if version >= 600
+    setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
+else
+    set iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
+endif
+
+syn cluster factorCluster contains=factorComment,factorKeyword,factorRepeat,factorConditional,factorBoolean,factorString,factorSbuf,@factorNumber,@factorNumErr,factorDelimiter,factorChar,factorCharErr,factorBackslash,@factorWordOps,factorAlien,factorTuple
+
+syn match factorTodo /\(TODO\|FIXME\|XXX\):\=/ contained
+syn match factorComment /\<#! .*/ contains=factorTodo
+syn match factorComment /\<! .*/ contains=factorTodo
+
+syn region None matchgroup=factorDefinition start=/\<\(C\|M\|G\|UNION\|PREDICATE\)\?:\>/ end=/\<;\>/ contains=@factorCluster,factorStackEffect,factorStackEffectErr,factorArray0,factorQuotation0
+
+syn region None matchgroup=factorGeneric start=/\<GENERIC:\>/ end=/$/ contains=factorStackEffect,factorStackEffectErr
+
+syn keyword factorBoolean boolean f general-t t
+syn keyword factorCompileDirective inline foldable parsing
+
+<%
+! uncomment this if you want all words from all vocabularies highlighted. Note
+! that this changes factor.vim from around 8k to around 100k (and is a bit
+! broken)
+
+! vocabs [ words [ "syn keyword factorKeyword " write [ pprint " " write ] each "\n" write ] when* ] each %>
+
+" kernel vocab keywords
+<% { "kernel" "math" "sequences" "namespaces" "arrays" "io" "strings" "vectors" "errors" } [ words "syn keyword factorKeyword " write [ pprint " " write ] each "\n" write ] each %>
+
+syn cluster factorReal   contains=factorInt,factorFloat,factorRatio,factorBinary,factorHex,factorOctal
+syn cluster factorNumber contains=@factorReal,factorComplex
+syn cluster factorNumErr contains=factorBinErr,factorHexErr,factorOctErr
+syn match   factorInt          /\<-\=\d\+\>/
+syn match   factorFloat                /\<-\=\d*\.\d\+\>/
+syn match   factorRatio                /\<-\=\d*\.*\d\+\/-\=\d*\.*\d\+\>/
+syn region  factorComplex      start=/\<C{\>/ end=/\<}\>/ contains=@factorReal
+syn match   factorBinErr        /\<BIN:\s\+[01]*[^\s01]\S*\>/
+syn match   factorBinary        /\<BIN:\s\+[01]\+\>/
+syn match   factorHexErr        /\<HEX:\s\+\x*[^\x\s]\S*\>/
+syn match   factorHex           /\<HEX:\s\+\x\+\>/
+syn match   factorOctErr        /\<OCT:\s\+\o*[^\o\s]\S*\>/
+syn match   factorOctal         /\<OCT:\s\+\o\+\>/
+
+syn match factorIn /\<IN:\s\+\S\+\>/
+syn match factorUse /\<USE:\s\+\S\+\>/
+
+syn match factorCharErr /\<CHAR:\s\+\S\+/
+syn match factorChar /\<CHAR:\s\+\\\=\S\>/
+
+syn match factorBackslash /\<\\\>\s\+\S\+\>/
+
+syn region factorUsing start=/\<USING:\>/ end=/;/
+syn region factorRequires start=/\<REQUIRES:\>/ end=/;/
+
+syn cluster factorWordOps contains=factorSymbol,factorPostpone,factorDefer,factorForget
+syn match factorSymbol /\<SYMBOL:\s\+\S\+\>/
+syn match factorPostpone /\<POSTPONE:\s\+\S\+\>/
+syn match factorDefer /\<DEFER:\s\+\S\+\>/
+syn match factorForget /\<FORGET:\s\+\S\+\>/
+
+syn match factorAlien /\<ALIEN:\s\+\d\+\>/
+
+syn region factorTuple start=/\<TUPLE:\>/ end=/\<;\>/
+
+"TODO:
+"misc:
+" HELP:
+" ARTICLE:
+" PROVIDE:
+" MAIN:
+"literals:
+" PRIMITIVE:
+
+"C interface:
+" FIELD:
+" BEGIN-STRUCT:
+" C-ENUM:
+" FUNCTION:
+" END-STRUCT
+" DLL"
+" TYPEDEF:
+" LIBRARY:
+" C-UNION:
+
+syn region factorString start=/"/ skip=/\\"/ end=/"/ oneline
+syn region factorSbuf start=/SBUF" / skip=/\\"/ end=/"/ oneline
+
+syn match factorStackEffectErr /\<)\>/
+syn region factorStackEffectErr start=/\<(\>/ end=/\<)\>/
+syn region factorStackEffect start=/\<(\>/ end=/\<)\>/ contained
+
+"adapted from lisp.vim
+if exists("g:factor_norainbow") 
+    syn region factorQuotation matchgroup=factorDelimiter start=/\<\[\>/ matchgroup=factorDelimiter end=/\<\]\>/ contains=ALL
+else
+    syn region factorQuotation0           matchgroup=hlLevel0 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation1,factorArray1
+    syn region factorQuotation1 contained matchgroup=hlLevel1 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation2,factorArray2
+    syn region factorQuotation2 contained matchgroup=hlLevel2 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation3,factorArray3
+    syn region factorQuotation3 contained matchgroup=hlLevel3 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation4,factorArray4
+    syn region factorQuotation4 contained matchgroup=hlLevel4 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation5,factorArray5
+    syn region factorQuotation5 contained matchgroup=hlLevel5 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation6,factorArray6
+    syn region factorQuotation6 contained matchgroup=hlLevel6 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation7,factorArray7
+    syn region factorQuotation7 contained matchgroup=hlLevel7 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation8,factorArray8
+    syn region factorQuotation8 contained matchgroup=hlLevel8 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation9,factorArray9
+    syn region factorQuotation9 contained matchgroup=hlLevel9 start=/\<\[\>/ end=/\<\]\>/ contains=@factorCluster,factorQuotation0,factorArray0
+endif
+
+if exists("g:factor_norainbow") 
+    syn region factorArray    matchgroup=factorDelimiter start=/\<\(V\|H\|T\|W\)\?{\>/  matchgroup=factorDelimiter end=/\<}\>/ contains=ALL
+else
+    syn region factorArray0           matchgroup=hlLevel0 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray1,factorQuotation1
+    syn region factorArray1 contained matchgroup=hlLevel1 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray2,factorQuotation2
+    syn region factorArray2 contained matchgroup=hlLevel2 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray3,factorQuotation3
+    syn region factorArray3 contained matchgroup=hlLevel3 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray4,factorQuotation4
+    syn region factorArray4 contained matchgroup=hlLevel4 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray5,factorQuotation5
+    syn region factorArray5 contained matchgroup=hlLevel5 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray6,factorQuotation6
+    syn region factorArray6 contained matchgroup=hlLevel6 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray7,factorQuotation7
+    syn region factorArray7 contained matchgroup=hlLevel7 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray8,factorQuotation8
+    syn region factorArray8 contained matchgroup=hlLevel8 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray9,factorQuotation9
+    syn region factorArray9 contained matchgroup=hlLevel9 start=/\<\(V\|H\|T\|W\)\?{\>/ end=/\<}\>/ contains=@factorCluster,factorArray0,factorQuotation0
+endif
+
+syn match factorBracketErr /\<\]\>/
+syn match factorBracketErr /\<}\>/
+
+syn sync lines=100
+
+if version >= 508 || !exists("did_factor_syn_inits")
+    if version <= 508
+       let did_factor_syn_inits = 1
+       command -nargs=+ HiLink hi link <args>
+    else
+       command -nargs=+ HiLink hi def link <args>
+    endif
+
+    HiLink factorComment       Comment
+    HiLink factorStackEffect   Typedef
+    HiLink factorTodo          Todo
+    HiLink factorInclude       Include
+    HiLink factorRepeat                Repeat
+    HiLink factorConditional   Conditional
+    HiLink factorKeyword       Keyword
+    HiLink factorOperator      Operator
+    HiLink factorBoolean       Boolean
+    HiLink factorDefinition    Typedef
+    HiLink factorString                String
+    HiLink factorSbuf          String
+    HiLink factorBracketErr     Error
+    HiLink factorStackEffectErr Error
+    HiLink factorComplex       Number
+    HiLink factorRatio          Number
+    HiLink factorBinary         Number
+    HiLink factorBinErr         Error
+    HiLink factorHex            Number
+    HiLink factorHexErr         Error
+    HiLink factorOctal          Number
+    HiLink factorOctErr         Error
+    HiLink factorFloat         Float
+    HiLink factorInt           Number
+    HiLink factorUsing          Include
+    HiLink factorUse            Include
+    HiLink factorRequires       Include
+    HiLink factorIn             Define
+    HiLink factorChar           Character
+    HiLink factorCharErr        Error
+    HiLink factorDelimiter      Delimiter
+    HiLink factorBackslash      Special
+    HiLink factorCompileDirective Keyword
+    HiLink factorSymbol         Define
+    HiLink factorPostpone       Define
+    HiLink factorDefer          Define
+    HiLink factorForget         Define
+    HiLink factorAlien          Define
+    HiLink factorTuple          Typedef
+    HiLink factorGeneric        Define
+
+    if &bg == "dark"
+       hi   hlLevel0 ctermfg=red         guifg=red1
+       hi   hlLevel1 ctermfg=yellow      guifg=orange1
+       hi   hlLevel2 ctermfg=green       guifg=yellow1
+       hi   hlLevel3 ctermfg=cyan        guifg=greenyellow
+       hi   hlLevel4 ctermfg=magenta     guifg=green1
+       hi   hlLevel5 ctermfg=red         guifg=springgreen1
+       hi   hlLevel6 ctermfg=yellow      guifg=cyan1
+       hi   hlLevel7 ctermfg=green       guifg=slateblue1
+       hi   hlLevel8 ctermfg=cyan        guifg=magenta1
+       hi   hlLevel9 ctermfg=magenta     guifg=purple1
+    else
+       hi   hlLevel0 ctermfg=red         guifg=red3
+       hi   hlLevel1 ctermfg=darkyellow  guifg=orangered3
+       hi   hlLevel2 ctermfg=darkgreen   guifg=orange2
+       hi   hlLevel3 ctermfg=blue        guifg=yellow3
+       hi   hlLevel4 ctermfg=darkmagenta guifg=olivedrab4
+       hi   hlLevel5 ctermfg=red         guifg=green4
+       hi   hlLevel6 ctermfg=darkyellow  guifg=paleturquoise3
+       hi   hlLevel7 ctermfg=darkgreen   guifg=deepskyblue4
+       hi   hlLevel8 ctermfg=blue        guifg=darkslateblue
+       hi   hlLevel9 ctermfg=darkmagenta guifg=darkviolet
+    endif
+
+    delcommand HiLink
+endif
+
+let b:current_syntax = "factor"
+
+set sw=4
+set ts=4
+set expandtab
+set autoindent " annoying?
+
+" vim: syntax=vim
diff --git a/misc/graphics/bmps/1bit.bmp b/misc/graphics/bmps/1bit.bmp
new file mode 100644 (file)
index 0000000..2f244c1
Binary files /dev/null and b/misc/graphics/bmps/1bit.bmp differ
diff --git a/misc/graphics/bmps/rgb4bit.bmp b/misc/graphics/bmps/rgb4bit.bmp
new file mode 100644 (file)
index 0000000..0c6f00d
Binary files /dev/null and b/misc/graphics/bmps/rgb4bit.bmp differ
diff --git a/misc/graphics/bmps/rgb8bit.bmp b/misc/graphics/bmps/rgb8bit.bmp
new file mode 100644 (file)
index 0000000..bc95c0f
Binary files /dev/null and b/misc/graphics/bmps/rgb8bit.bmp differ
diff --git a/misc/graphics/bmps/thiswayup24.bmp b/misc/graphics/bmps/thiswayup24.bmp
new file mode 100644 (file)
index 0000000..202fb15
Binary files /dev/null and b/misc/graphics/bmps/thiswayup24.bmp differ
diff --git a/misc/icons/FRaptorMix.ico b/misc/icons/FRaptorMix.ico
new file mode 100644 (file)
index 0000000..6d199e7
Binary files /dev/null and b/misc/icons/FRaptorMix.ico differ
diff --git a/misc/icons/FRaptorMix_128x128.png b/misc/icons/FRaptorMix_128x128.png
new file mode 100644 (file)
index 0000000..bc08801
Binary files /dev/null and b/misc/icons/FRaptorMix_128x128.png differ
diff --git a/misc/icons/FRaptorMix_16x16.png b/misc/icons/FRaptorMix_16x16.png
new file mode 100644 (file)
index 0000000..1613566
Binary files /dev/null and b/misc/icons/FRaptorMix_16x16.png differ
diff --git a/misc/icons/FRaptorMix_32x32.png b/misc/icons/FRaptorMix_32x32.png
new file mode 100644 (file)
index 0000000..d93a4a6
Binary files /dev/null and b/misc/icons/FRaptorMix_32x32.png differ
diff --git a/misc/icons/FRaptorMix_48x48.png b/misc/icons/FRaptorMix_48x48.png
new file mode 100644 (file)
index 0000000..1200571
Binary files /dev/null and b/misc/icons/FRaptorMix_48x48.png differ
diff --git a/misc/icons/license.txt b/misc/icons/license.txt
new file mode 100644 (file)
index 0000000..3a886d7
--- /dev/null
@@ -0,0 +1,4 @@
+The icons/images/jackets contained in this archive are
+Copyright (C) 2007 Elie CHAFTARI. All Rights Reserved.
+
+See http://factorcode.org/license.txt for BSD license.
\ No newline at end of file
diff --git a/misc/integration/macosx-deploy.factor b/misc/integration/macosx-deploy.factor
new file mode 100644 (file)
index 0000000..29642a0
--- /dev/null
@@ -0,0 +1,24 @@
+USING: tools.deploy.app sequences io.files io.launcher io
+kernel concurrency ;
+
+"." resource-path cd
+
+"mkdir deploy-log" run-process
+
+{
+    "automata.ui"
+    "boids.ui"
+    "bunny"
+    "color-picker"
+    "gesture-logger"
+    "golden-section"
+    "hello-ui"
+    "lsys.ui"
+    "maze"
+    "nehe"
+    "tetris"
+    "catalyst-talk"
+} [
+    "deploy-log/" over append <file-writer>
+    [ deploy.app ] with-stream
+] parallel-each
diff --git a/misc/integration/macosx.sh b/misc/integration/macosx.sh
new file mode 100644 (file)
index 0000000..dafe952
--- /dev/null
@@ -0,0 +1,43 @@
+CPU=$1
+
+if [ "$CPU" = "x86.32" ]; then
+       TARGET="macosx-x86"
+elif [ "$CPU" = "ppc" ]; then
+       TARGET="macosx-ppc"
+       CPU = "macosx-ppc"
+else
+       echo "Specify a CPU"
+       exit 1
+fi
+
+EXE=factor
+
+bash misc/integration/test.sh \
+       $EXE \
+       $CPU \
+       $TARGET \
+       no \
+       no \
+       no \
+       "X11=1" \
+       "-ui-backend=x11" \
+       "-x11" || exit 1
+
+echo "Testing deployment"
+$EXE "misc/integration/x11-deploy.factor" -run=none </dev/null
+
+EXE=Factor.app/Contents/MacOS/factor
+
+bash misc/integration/test.sh \
+       $EXE \
+       $CPU \
+       $TARGET \
+       yes \
+       yes \
+       yes \
+       "" \
+       "" \
+       ""
+
+echo "Testing deployment"
+$EXE "misc/integration/macosx-deploy.factor" -run=none </dev/null
diff --git a/misc/integration/test.sh b/misc/integration/test.sh
new file mode 100644 (file)
index 0000000..973ff7a
--- /dev/null
@@ -0,0 +1,93 @@
+EXE=$1
+CPU=$2
+TARGET=$3
+LOAD_P=$4
+TEST_P=$5
+BENCHMARK_P=$6
+MAKE_FLAGS=$7
+BOOT_FLAGS=$8
+VARIANT=$9
+
+PREFIX=misc/integration/results-$CPU$VARIANT
+
+mkdir -p $PREFIX
+
+VM_LOG=$PREFIX/vm.log
+BOOT_LOG=$PREFIX/boot.log
+LOAD_LOG=$PREFIX/load.log
+TEST_LOG=$PREFIX/test.log
+BENCHMARK_LOG=$PREFIX/benchmark.log
+
+echo "Output files:"
+echo "VM compilation:  $VM_LOG"
+echo "Bootstrap:       $BOOT_LOG"
+echo "Load everything: $LOAD_LOG"
+echo "Unit tests:      $TEST_LOG"
+echo "Benchmarks:      $BENCHMARK_LOG"
+
+IMAGE=factor.image
+
+echo
+echo
+echo
+
+echo "Compiling VM"
+${MAKE-make} clean $TARGET $MAKE_FLAGS >$VM_LOG </dev/null
+
+if [ "$?" -ne 0 ]; then
+       echo "VM compile failed"
+       exit 1
+fi
+
+echo "Bootstrap"
+rm -f $IMAGE
+
+$EXE -i=boot.$CPU.image \
+       -no-user-init \
+       $BOOT_FLAGS \
+       -output-image=$IMAGE >$BOOT_LOG </dev/null
+
+if [ ! -e "factor.image" ]; then
+       echo "Bootstrap failed"
+       exit 1
+fi
+
+# Load all modules; run tests
+if [ "$LOAD_P" = "yes" ]; then
+       echo "Testing loading of all modules"
+
+       echo "USE: tools.browser load-everything USE: memory save USE: system 123 exit" \
+               >/tmp/factor-$$
+
+       $EXE -i=$IMAGE \
+               /tmp/factor-$$ \
+               -run=none \
+               >$LOAD_LOG </dev/null
+
+       if [ "$?" -ne 123 ]; then
+               echo "Load-everything failed"
+               exit 1
+       fi
+
+       # Check for parser notes
+       grep "automatically using" $LOAD_LOG
+
+       if [ "$?" -eq 0 ]; then
+               echo "Missing USE: declarations"
+               # exit 1
+       fi
+fi
+
+# Run unit tests
+if [ "$TEST_P" = "yes" ]; then
+       echo "Running all unit tests"
+
+       $EXE -i=$IMAGE "-e=test-all" -run=none >$TEST_LOG </dev/null
+fi
+
+# Run benchmarks
+if [ "$BENCHMARK_P" = "yes" ]; then
+       echo "Running all benchmarks"
+
+       $EXE -i=$IMAGE "-run=benchmark" >$BENCHMARK_LOG </dev/null
+fi
diff --git a/misc/integration/unix-arm.sh b/misc/integration/unix-arm.sh
new file mode 100644 (file)
index 0000000..312b9c6
--- /dev/null
@@ -0,0 +1,10 @@
+bash misc/integration/test.sh \
+       ./factor \
+       ppc \
+       $1-arm \
+       no \
+       yes \
+       yes \
+       "" \
+       "" \
+       ""
diff --git a/misc/integration/unix-ppc.sh b/misc/integration/unix-ppc.sh
new file mode 100644 (file)
index 0000000..b01ceb9
--- /dev/null
@@ -0,0 +1,10 @@
+bash misc/integration/test.sh \
+       ./factor \
+       ppc \
+       $1-ppc \
+       yes \
+       yes \
+       yes \
+       "" \
+       "" \
+       ""
diff --git a/misc/integration/unix-x86.32.sh b/misc/integration/unix-x86.32.sh
new file mode 100644 (file)
index 0000000..97b6515
--- /dev/null
@@ -0,0 +1,21 @@
+bash misc/integration/test.sh \
+       ./factor \
+       x86.32 \
+       $1-x86 \
+       yes \
+       yes \
+       yes \
+       "" \
+       "" \
+       "" || exit 1
+
+bash misc/integration/test.sh \
+       ./factor \
+       x86.32 \
+       $1-x86 \
+       yes \
+       yes \
+       yes \
+       "" \
+       "-no-sse2" \
+       "-no-sse2"
diff --git a/misc/integration/unix-x86.64.sh b/misc/integration/unix-x86.64.sh
new file mode 100644 (file)
index 0000000..73a1210
--- /dev/null
@@ -0,0 +1,10 @@
+bash misc/integration/test.sh \
+       ./factor \
+       x86.64 \
+       $1-amd64 \
+       yes \
+       yes \
+       yes \
+       "" \
+       "" \
+       ""
diff --git a/misc/integration/x11-deploy.factor b/misc/integration/x11-deploy.factor
new file mode 100644 (file)
index 0000000..6b36e4f
--- /dev/null
@@ -0,0 +1,8 @@
+USING: tools.deploy sequences io.files io kernel ;
+
+"." resource-path cd
+
+"mkdir deploy-log" run-process
+
+"factory" "deploy-log/" over append
+<file-writer> [ deploy ] with-stream
diff --git a/misc/macos-release.sh b/misc/macos-release.sh
new file mode 100644 (file)
index 0000000..6a25ba2
--- /dev/null
@@ -0,0 +1,26 @@
+TARGET=$1
+
+if [ "$TARGET" = "x86" ]; then
+       CPU="x86.32"
+else
+       CPU="ppc"
+fi
+
+make macosx-$TARGET
+Factor.app/Contents/MacOS/factor -i=boot.$CPU.image -no-user-init
+
+VERSION=0.91
+DISK_IMAGE_DIR=Factor-$VERSION
+DISK_IMAGE=Factor-$VERSION-$TARGET.dmg
+
+rm -f $DISK_IMAGE
+rm -rf $DISK_IMAGE_DIR
+mkdir $DISK_IMAGE_DIR
+mkdir -p $DISK_IMAGE_DIR/Factor/
+cp -R Factor.app $DISK_IMAGE_DIR/Factor/Factor.app
+chmod +x cp_dir
+cp factor.image license.txt README.txt $DISK_IMAGE_DIR/Factor/
+find core extra fonts misc unmaintained -type f \
+       -exec ./cp_dir {} $DISK_IMAGE_DIR/Factor/{} \;
+hdiutil create -srcfolder "$DISK_IMAGE_DIR" -fs HFS+ \
+       -volname "$DISK_IMAGE_DIR" "$DISK_IMAGE"
diff --git a/misc/windows-release.sh b/misc/windows-release.sh
new file mode 100644 (file)
index 0000000..052dc39
--- /dev/null
@@ -0,0 +1,19 @@
+CPU=$1
+VERSION=0.91
+
+if [ "$CPU" = "x86" ]; then
+    FLAGS="-no-sse2"
+fi
+
+make windows-nt-x86
+CMD="./factor-nt -i=boot.x86.32.image -no-user-init $FLAGS"
+echo $CMD
+$CMD
+rm -rf Factor.app/
+rm -rf vm/
+rm -f Makefile
+rm -f cp_dir
+rm -f boot.*.image
+
+cd ..
+zip -r Factor-$VERSION-win32-$CPU.zip Factor/
diff --git a/unmaintained/README.libs.txt b/unmaintained/README.libs.txt
new file mode 100644 (file)
index 0000000..fb5430a
--- /dev/null
@@ -0,0 +1,88 @@
+This directory contains Factor code that is not part of the core
+library, but is useful enough to ship with the Factor distribution.
+
+Modules can be loaded from the listener:
+
+  "libs/modulename" require
+
+Available libraries:
+
+- alarms -- call a quotation at a calendar date (Doug Coleman)
+- alien -- Alien utility words (Eduardo Cavazos)
+- base64 -- base64 encoding/decoding (Doug Coleman)
+- basic-authentication -- basic authentication implementation for HTTP server (Chris Double)
+- cairo -- cairo bindings (Sampo Vuori)
+- calendar -- timestamp/calendar with timezones (Doug Coleman)
+- canvas -- Gadget which renders an OpenGL display list (Slava Pestov)
+- cocoa-callbacks -- Allows you to use Factor quotations as actions (Slava Pestov)
+- concurrency -- Erlang/Termite-style distibuted concurrency (Chris Double)
+- coroutines -- coroutines (Chris Double)
+- cryptlib -- cryptlib binding (Elie Chaftari)
+- crypto -- Various cryptographic algorithms (Doug Coleman)
+- csv -- Comma-separated values parser (Daniel Ehrenberg)
+- dlists -- double-linked-lists (Mackenzie Straight)
+- editpadpro -- EditPadPro integration for Windows (Ryan Murphy)
+- emacs -- emacs integration (Eduardo Cavazos)
+- farkup -- Wiki-style markup (Matthew Willis)
+- file-appender -- append to existing files (Doug Coleman)
+- fjsc -- Factor to Javascript compiler (Chris Double)
+- furnace -- Web framework (Slava Pestov)
+- gap-buffer -- Efficient text editor buffer (Alex Chapman)
+- graphics -- Graphics library in Factor (Doug Coleman)
+- hardware-info -- Information about your computer (Doug Coleman)
+- handler -- Gesture handler mixin (Eduardo Cavazos)
+- heap -- Binary min heap implementation (Ryan Murphy)
+- hexdump -- Hexdump routine (Doug Coleman)
+- http -- Code shared by HTTP server and client (Slava Pestov)
+- http-client -- HTTP client (Slava Pestov)
+- id3 -- ID3 parser (Adam Wendt)
+- io -- mmap, filesystem utils (Doug Coleman)
+- jedit -- jEdit editor integration (Slava Pestov)
+- jni -- Java Native Interface Wrapper (Chris Double)
+- json -- JSON reader and writer (Chris Double)
+- koszul -- Lie algebra cohomology and central representation (Slava Pestov)
+- lazy-lists -- Lazy evaluation lists (Chris Double, Matthew Willis)
+- locals -- Crappy local variables (Slava Pestov)
+- mad -- Wrapper for libmad MP3 decoder (Adam Wendt)
+- match -- pattern matching (Chris Double)
+- math -- extended math library (Doug Coleman, Slava Pestov)
+- matrices -- Matrix math (Slava Pestov)
+- memoize -- memoization (caching word results) (Slava Pestov)
+- mmap -- memory mapped files (Doug Coleman)
+- mysql -- MySQL binding (Berlin Brown)
+- null-stream -- Something akin to /dev/null (Slava Pestov)
+- odbc -- Wrapper for ODBC library (Chris Double)
+- ogg -- Wrapper for libogg library (Chris Double)
+- openal -- Wrapper for OpenAL and alut sound libraries (Chris Double)
+- oracle -- Oracle binding (Elie Chaftari)
+- parser-combinators -- Haskell-style parser combinators (Chris Double)
+- porter-stemmer -- Porter stemming algorithm (Slava Pestov)
+- postgresql -- PostgreSQL binding (Doug Coleman)
+- process -- Run external programs (Slava Pestov, Doug Coleman)
+- qualified -- Qualified names for words in other vocabularies (Daniel Ehrenberg)
+- rewrite-closures -- Turn quotations into closures (Eduardo Cavazos)
+- scite -- SciTE editor integration (Clemens F. Hofreither)
+- sequences -- Non-core sequence words (Eduardo Cavazos)
+- serialize -- Binary object serialization (Chris Double)
+- server -- The with-server combinator formely found in the core (Slava Pestov)
+- slate -- Framework for graphical demos (Eduardo Cavazos)
+- shuffle -- Shuffle words not in the core library (Chris Double)
+- smtp -- SMTP client library (Elie Chaftari)
+- splay-trees -- Splay trees (Mackenzie Straight)
+- sqlite -- SQLite binding (Chris Double)
+- state-machine -- Finite state machine abstraction (Daniel Ehrenberg)
+- state-parser -- State-based parsing mechanism (Daniel Ehrenberg)
+- textmate -- TextMate integration (Benjamin Pollack)
+- theora -- Wrapper for libtheora library (Chris Double)
+- trees -- Binary search and AVL (balanced) trees (Alex Chapman)
+- usb -- Wrapper for libusb (Chris Double)
+- unicode -- Partial Unicode support beyond the core (Daniel Ehrenberg)
+- units -- Unit conversion (Doug Coleman)
+- vars -- Alternative syntax for variables (Eduardo Cavazos)
+- vim -- VIM integration (Alex Chapman)
+- visitor -- Double dispatch through the visitor pattern (Daniel Ehrenberg)
+- vorbis -- Wrapper for Ogg Vorbis library (Chris Double)
+- x11 -- X Window System client library (Eduardo Cavazos)
+- xml -- XML parser (Daniel Ehrenberg)
+- xml-rpc -- XML-RPC client and server (Daniel Ehrenberg)
+- yahoo -- Yahoo! automated search (Daniel Ehrenberg)
diff --git a/unmaintained/README.txt b/unmaintained/README.txt
new file mode 100644 (file)
index 0000000..91b1c5f
--- /dev/null
@@ -0,0 +1,30 @@
+This directory contains Factor code that is not part of the core
+library, but is useful enough to ship with the Factor distribution.
+
+Modules can be loaded from the listener:
+
+  "apps/modulename" require
+
+Available applications:
+
+- article-manager -- Web-based content management system (Chris Double)
+- automata -- Graphics demo for the UI (Eduardo Cavazos)
+- benchmarks -- Various performance benchmarks (Slava Pestov)
+- boids -- Graphics demo for the UI (Eduardo Cavazos)
+- factory -- X11 window manager (Eduardo Cavazos)
+- furnace-fjsc -- Web frontend for libs/fjsc (Chris Double)
+- furnace-onigiri -- Weblog engine (Matthew Willis)
+- furnace-pastebin -- demo app for Furnace (Slava Pestov)
+- help-lint -- online documentation typo checker (Slava Pestov)
+- icfp-2006 -- implements the icfp 2006 vm, boundvariable.org (Gavin Harrison)
+- http-server -- HTTP server (Slava Pestov, Chris Double)
+- lindenmayer -- L-systems tool (Eduardo Cavazos)
+- lisppaste -- Lisppaste XML-RPC demo (Slava Pestov)
+- ogg-player -- Ogg Vorbis (audio) and Theora (video) player (Chris Double)
+- print-dataflow -- Code to print compiler dataflow IR to the console, or show it in the UI (Slava Pestov)
+- random-tester -- Random compiler tester (Doug Coleman)
+- rss -- An RSS1, RSS2 and Atom parser and aggregator (Chris Double, Daniel Ehrenberg)
+- space-invaders -- Intel 8080-based Space Invaders arcade machine emulator (Chris Double)
+- tetris -- Tetris game (Alex Chapman)
+- turing -- Turing machine demo (Slava Pestov)
+- wee-url -- Web app to make short URLs from long ones (Doug Coleman)
diff --git a/unmaintained/alarms/alarms.factor b/unmaintained/alarms/alarms.factor
new file mode 100644 (file)
index 0000000..0402ead
--- /dev/null
@@ -0,0 +1,89 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: arrays calendar concurrency generic kernel math
+namespaces sequences threads ;
+IN: alarms-internals
+
+! for now a V{ }, eventually a min-heap to store alarms
+SYMBOL: alarms
+SYMBOL: alarm-receiver
+SYMBOL: alarm-looper
+
+TUPLE: alarm time quot ;
+
+: add-alarm ( alarm -- )
+    alarms get-global push ;
+
+: remove-alarm ( alarm -- )
+    alarms get-global remove alarms set-global ;
+
+: handle-alarm ( alarm -- )
+    dup delegate {
+        { "register" [ add-alarm ] }
+        { "unregister" [ remove-alarm  ] }
+    } case ;
+    
+: expired-alarms ( -- seq )
+    now alarms get-global
+    [ alarm-time compare-timestamps 0 > ] subset-with ;
+
+: unexpired-alarms ( -- seq )
+    now alarms get-global
+    [ alarm-time compare-timestamps 0 <= ] subset-with ;
+
+: call-alarm ( alarm -- )
+    alarm-quot spawn drop ;
+    
+: do-alarms ( -- )
+    alarms get-global expired-alarms
+    [ call-alarm ] each
+    unexpired-alarms alarms set-global ;
+
+: alarm-receive-loop ( -- )
+    receive dup alarm? [ handle-alarm ] [ drop ] if
+    alarm-receive-loop ;
+
+: start-alarm-receiver ( -- )
+    [
+        alarm-receive-loop
+    ] spawn alarm-receiver set-global ;
+
+: alarm-loop ( -- )
+    alarms get-global empty? [
+        do-alarms
+    ] unless 100 sleep alarm-loop ;
+    
+: start-alarm-looper ( -- )
+    [
+        alarm-loop
+    ] spawn alarm-looper set-global ;
+
+: send-alarm ( alarm -- )
+    over set-delegate
+    alarm-receiver get-global send ;
+
+: start-alarm-daemon ( -- process )
+    alarms get-global [
+        V{ } clone alarms set-global
+        start-alarm-looper
+        start-alarm-receiver
+    ] unless ;
+
+start-alarm-daemon
+
+IN: alarms
+
+: register-alarm ( alarm -- )
+    "register" send-alarm ;
+
+: unregister-alarm ( alarm -- )
+    "unregister" send-alarm ;
+
+: change-alarm ( alarm-old alarm-new -- )
+    "register" send-alarm
+    "unregister" send-alarm ;
+
+! Example:
+! now 5 seconds +dt [ "hi" print flush ] <alarm> register-alarm
diff --git a/unmaintained/alarms/load.factor b/unmaintained/alarms/load.factor
new file mode 100644 (file)
index 0000000..4b52ce6
--- /dev/null
@@ -0,0 +1,5 @@
+REQUIRES: libs/calendar libs/concurrency ;
+PROVIDE: libs/alarms
+{ +files+ {
+    "alarms.factor"
+} } ;
diff --git a/unmaintained/enchilada/authors.txt b/unmaintained/enchilada/authors.txt
new file mode 100644 (file)
index 0000000..bfc196f
--- /dev/null
@@ -0,0 +1 @@
+Robbert van Dalen
diff --git a/unmaintained/enchilada/enchilada-tests.factor b/unmaintained/enchilada/enchilada-tests.factor
new file mode 100644 (file)
index 0000000..af24e36
--- /dev/null
@@ -0,0 +1,6 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel sequences enchilada strings ;
+IN: temporary
+
diff --git a/unmaintained/enchilada/enchilada.factor b/unmaintained/enchilada/enchilada.factor
new file mode 100644 (file)
index 0000000..9568fa8
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: enchilada
+USING: generic kernel enchilada.engine enchilada.parser enchilada.printer prettyprint ; 
+
+
+: (e-eval) ( e-expression -- )
+    dup e-reducible? [ dup e-print . e-reduce (e-eval) ] [ e-print . ] if ;
+
+: e-eval ( string -- )
+    e-parse (e-eval) ;
diff --git a/unmaintained/enchilada/engine/engine.factor b/unmaintained/enchilada/engine/engine.factor
new file mode 100644 (file)
index 0000000..8c44d16
--- /dev/null
@@ -0,0 +1,322 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: enchilada.engine
+USING: generic kernel math sequences isequences.interface isequences.base isequences.ops ;
+
+! Provides Enchilada's rewriting expression engine.
+!
+
+GENERIC: !! ( list -- list )
+GENERIC: \\ ( list -- list )
+
+GENERIC: e-reducible? ( e -- ? )
+GENERIC: e-dyadic? ( o -- ? )
+GENERIC: e-operator? ( o -- ? )
+GENERIC: e-list? ( o -- ? )
+GENERIC: e-symbol? ( o -- ? )
+
+GENERIC: e-m-operate ( v op -- e )
+GENERIC: e-d-operate ( v1 v2 op -- e )
+
+GENERIC: e-reduce ( e -- e )
+GENERIC: free-symbols ( s -- symbols )
+
+TUPLE: ireplace from to seq ;
+
+: unpack-ireplace ( ireplace -- from to seq )
+    dup ireplace-from swap dup ireplace-to swap ireplace-seq ; inline
+
+GENERIC: e-replace ( from to sequence -- s )
+
+: (ireplace1) ( from to seq -- ireplace )
+    dup is-atom?
+    [ pick over i-cmp 0 = [ drop nip ] [ nip nip ] if ]
+    [ <ireplace> ] if ;
+    
+: <i-replace> ( from to seq -- ireplace )
+   dup i-length dup 0 =
+   [ 3drop drop 0 ]
+   [ 1 = [ (ireplace1) ] [ <ireplace> ] if ]
+   if ;
+       
+: ireplace-i-at ( s i -- v )
+   swap dup ireplace-seq rot i-at dup >r swap dup ireplace-from rot i-cmp 0 =
+   [ r> drop ireplace-to ]
+   [ dup ireplace-from swap ireplace-to r> e-replace ]
+   if ;
+    
+M: object e-replace <i-replace> ;
+M: integer e-replace -rot 2drop ;
+
+M: ireplace i-length ireplace-seq i-length ;
+M: ireplace i-at ireplace-i-at ;
+M: ireplace ileft unpack-ireplace ileft e-replace ;
+M: ireplace iright unpack-ireplace iright e-replace ;
+M: ireplace ihead (ihead) ;
+M: ireplace itail (itail) ;
+M: ireplace $$ unpack-ireplace [ $$ ] 2apply rot $$ quick-hash quick-hash ;
+
+TUPLE: esymbol seq ;
+
+GENERIC: esymbol/i-cmp ( esymbol s -- i )
+
+M: object esymbol/i-cmp 2drop -1 ;
+M: esymbol esymbol/i-cmp swap [ esymbol-seq ] 2apply i-cmp ;
+M: esymbol object/i-cmp 2drop 1 ;
+M: esymbol i-cmp swap esymbol/i-cmp ; 
+
+DEFER: (sunion)
+
+: (sunion6) ( s1 s2 -- s )
+    2dup [ 0 i-at ] 2apply i-cmp dup zero?
+    [ 2drop ] [ 0 > [ swap ] when ++ ] if ; inline
+    
+: (sunion5) ( s1 s2 -- s )
+    over ileft i-length pick swap i-at icut rot left-right
+    swap roll (sunion) -rot swap (sunion) ++ ; inline
+
+: (sunion4) ( s1 s2 -- s )
+   2dup ifirst swap ilast i-cmp dup zero?
+   [ drop 1 itail ++ ] [ 0 > [ ++ ] [ (sunion5) ] if ] if ; inline
+
+: (sunion3) ( s1 s2 ls1 ls2 -- s )
+    1 = 
+    [ 1 = [ (sunion6) ] [ (sunion4) ] if ]
+    [ 1 = [ swap ] when (sunion4) ] if ; inline
+
+: (sunion2) ( s1 s2 -- s )
+    2dup [ i-length ] 2apply 2dup zero?
+    [ 3drop drop ] [ zero? [ 2drop nip ] [ (sunion3) ] if ] if ; inline
+    
+: (sunion) ( s1 s2 -- s )
+    2dup eq? [ drop ] [ (sunion2) ] if ; inline
+
+: s-union ( s1 s2 -- s )
+    (sunion) ; inline
+
+: (free-symbols) ( s -- symbols )
+    dup is-atom?
+    [ dup e-symbol? [ drop 0 ] unless ]
+    [ 0 i-at free-symbols ] if ;
+
+M: object free-symbols
+    dup i-length dup 0 =
+    [ 2drop 0 ]
+    [ 1 = [ (free-symbols) ] [ left-right [ free-symbols ] 2apply s-union ] if ] if ;
+
+M: integer free-symbols drop 0 ;
+
+M: object !!
+    dup i-length dup 0 =
+    [ 2drop 0 ]
+    [ 1 = [ 0 i-at dup left-side swap right-side [ e-reduce ] 2apply <i-dual-sided> <i> ] [ left-right [ !! ] 2apply ++ ] if ] if ;
+
+M: integer !! ;
+
+
+: (\\) ( expr -- list )
+   dup i-length dup 0 =
+   [ 2drop 0 ]
+   [ 1 = [ <i> ] [ left-right [ (\\) ] 2apply ++ ] if ] if ;
+
+M: object \\
+    dup i-length dup 0 =
+    [ 2drop 0 ]
+    [ 1 = [ 0 i-at left-side (\\) ] [ left-right [ \\ ] 2apply ++ ] if ] if ; 
+M: integer \\ ;
+
+TUPLE: emacro symbols expr eager? ;
+
+: symbol-list? ( symbols -- ? )
+    i-sort dup free-symbols i-cmp 0 = ; inline
+
+: full-reduce ( expr -- expr )
+       dup e-reducible? [ e-reduce full-reduce ] when ;
+
+: <e-macro> ( symbols expr eager? -- e-macro )
+    dup [ swap full-reduce swap ] when
+    >r swap dup symbol-list? [ swap r> <emacro> ] [ "illegal symbol list" throw ] if ;
+
+M: emacro free-symbols dup emacro-expr free-symbols swap emacro-symbols i-diff ;
+
+M: emacro e-replace
+    pick over [ free-symbols ] 2apply i-intersect i-length 0 =
+    [ -rot 2drop ]
+    [ dup >r emacro-expr e-replace r> dup emacro-symbols swap emacro-eager? rot swap <e-macro> ] if ;
+
+: eflatten ( s -- s )
+    dup i-length dup zero?
+    [ 2drop 0 ]
+    [ 1 = [ 0 i-at left-side ] [ left-right [ eflatten ] 2apply ++ ] if ] if ; inline
+    
+TUPLE: c-op v d-op ;
+
+M: object e-operator? drop f ;
+M: object e-list? dup e-operator? not swap e-symbol? not and ;
+M: object e-symbol? drop f ;
+M: object e-dyadic? drop f ;
+
+M: esymbol e-symbol? drop t ;
+
+M: c-op e-m-operate
+    dup c-op-v swap c-op-d-op e-d-operate ; 
+    
+TUPLE: .- ;
+M: .- e-m-operate drop -- <i> ;
+TUPLE: .` ;
+M: .` e-m-operate drop `` <i> ;
+TUPLE: .$ ;
+M: .$ e-m-operate drop $$ <i> ;
+TUPLE: .~ ;
+M: .~ e-m-operate drop ~~ <i> ;
+TUPLE: .: ;
+M: .: e-m-operate drop :: <i> ;
+TUPLE: .# ;
+M: .# e-m-operate drop ## <i> ;
+TUPLE: .^ ;
+M: .^ e-m-operate drop eflatten ;
+TUPLE: .! ;
+M: .! e-m-operate drop !! <i> ;
+TUPLE: .\ ;
+M: .\ e-m-operate drop \\ <i> ;
+    
+TUPLE: .+ ;
+M: .+ e-d-operate drop ++ <i> ;
+TUPLE: .* ;
+M: .* e-d-operate drop ** [ <i> ] 2apply ++ ;
+TUPLE: ./ ;
+M: ./ e-d-operate drop // [ <i> ] 2apply ++ ;
+TUPLE: .& ;
+M: .& e-d-operate drop && <i> ;
+TUPLE: .| ;
+M: .| e-d-operate drop || <i> ;
+TUPLE: .< ;
+M: .< e-d-operate drop << [ <i> ] 2apply ++ ;
+TUPLE: .> ;
+M: .> e-d-operate drop >> <i> ;
+TUPLE: .@ ;
+M: .@ e-d-operate >r swap 0 i-cmp 0 = [ dup eflatten swap <i> ++ r> ++ ] [ r> 2drop 0 ] if ;
+TUPLE: .? ;
+M: .? e-d-operate drop (i-eq?) [ 1 ] [ 0 ] if <i> ;
+TUPLE: .% ;
+M: .% e-d-operate drop %% [ <i> ] 2apply ++ ;
+
+UNION: monadic-class c-op .- .` .$ .~ .: .# .^ .! .\ emacro ;
+UNION: dyadic-class .+ .* ./ .& .| .< .> .@ .? .% ;
+UNION: operator-class monadic-class dyadic-class ;
+
+M: operator-class e-operator? drop t ;
+M: monadic-class e-dyadic? drop f ;
+M: dyadic-class e-dyadic? drop t ;
+
+DEFER: +e+ 
+
+: (e-reducible?) ( e -- ? )
+    left-right 2dup [ e-reducible? ] either?
+    [ 2drop t ] [ ifirst e-operator? swap ilast e-list? and ] if ; inline
+        
+M: object e-reducible?
+    dup i-length 1 <= [ drop f ] [ (e-reducible?) ] if ;
+
+: (e-reduce2) ( e1 e2 -- e )
+    2dup ifirst swap ilast swap e-m-operate
+    -rot 1 itail swap dup i-length 1- ihead rot ++ swap ++ ; inline
+    
+: (e-reduce) ( e -- e )
+    left-right swap dup e-reducible? [ (e-reduce) swap ++ ]
+    [ swap dup e-reducible? [ (e-reduce) ++ ] [ (e-reduce2) ] if ] if ; inline
+
+M: object e-reduce
+    dup e-reducible? [ (e-reduce) ] when ;
+
+: (+e+2) ( e1 e2 -- e )
+    2dup ifirst swap ilast swap <c-op>
+    -rot 1 itail swap dup i-length 1- ihead rot ++ swap ++ ; inline
+
+: (+e+1) ( e1 e2 -- e )
+    2dup ifirst e-dyadic? swap ilast e-list? and
+    [ (+e+2) ] [ ++g ] if ; inline
+
+TUPLE: e-exp expr reducible ;
+
+M: e-exp e-reducible? e-exp-reducible ;
+
+: <expr> ( s -- e-exp )
+    dup e-exp? [ dup e-reducible? <e-exp> ] unless ; inline
+
+: +e+ ( e1 e2 -- e )
+    2dup [ i-length 1 >= ] both?
+    [ (+e+1) ] [ ++g ] if <expr> ; inline
+
+: e-ipair ( e1 e2 -- e )
+    <isequence> <expr> ; inline
+
+M: c-op e-replace dup >r c-op-v e-replace r> c-op-d-op <c-op> ;
+
+
+GENERIC: e-exp/++ ( s e -- e )
+GENERIC: e-exp/ipair ( s e -- e )
+
+M: e-exp ++ swap e-exp/++ ;
+M: e-exp ipair swap e-exp/ipair ;
+
+M: object e-exp/++ swap +e+ ;
+M: object e-exp/ipair swap e-ipair ;
+
+M: e-exp e-exp/++ swap +e+ ;
+M: e-exp e-exp/ipair swap e-ipair ;
+M: e-exp object/++ swap +e+ ;
+M: e-exp object/ipair swap e-ipair ;
+
+M: operator-class ++ +e+ ;
+        
+M: e-exp i-length e-exp-expr i-length ;
+M: e-exp i-at swap e-exp-expr swap i-at ;
+M: e-exp ileft e-exp-expr ileft ;
+M: e-exp iright e-exp-expr iright ;
+M: e-exp ihead swap e-exp-expr swap ihead ;
+M: e-exp itail swap e-exp-expr swap itail ;
+M: e-exp $$ e-exp-expr $$ ;
+
+M: e-exp e-replace 
+    dup i-length 1 =
+    [ e-exp-expr e-replace ]
+    [ 3dup iright e-replace >r ileft e-replace r> ++ ] if ;
+
+TUPLE: ereplacement from to ;
+
+: (ereplace) ( symbols from-symbol --  to-symbol )
+   esymbol-seq dup ++ <esymbol> dup pick i-intersect i-length zero?
+   [ nip ] [ (ereplace) ] if ; inline
+
+: (replacements3) ( symbols from-symbol --  newsymbols replacement )
+    2dup (ereplace) rot over i-union -rot <ereplacement> ; inline
+
+: (replacements2) ( symbols intersect -- replacements )
+   dup i-length zero?
+   [ 2drop 0 ]
+   [ dup >r ifirst (replacements3) swap r> 1 itail (replacements2) ++ ] if ;
+
+: replace-s ( s replacements -- s )
+    dup i-length dup zero?
+    [ 2drop ]
+    [ 1 = [ 0 i-at dup ereplacement-from swap ereplacement-to rot e-replace ] [ left-right >r replace-s r> replace-s ] if ] if ; 
+
+: (replacements) ( value macro -- replacements )
+    dup emacro-expr free-symbols swap emacro-symbols -1 ++
+    i-intersect tuck swap free-symbols i-intersect (replacements2) ; inline 
+
+: (replace-macro) ( replacements macro -- macro )
+    2dup dup >r emacro-symbols swap replace-s swap emacro-expr rot replace-s r> emacro-eager? <e-macro> ;
+    
+: (eval-macro) ( value macro -- macro )
+    dup >r emacro-symbols dup -1 ++ swap ilast rot <i> r> dup >r emacro-expr e-replace r> emacro-eager? <e-macro> ;
+
+: eval-macro ( value macro -- s )
+    2dup (replacements) swap (replace-macro) (eval-macro) ;
+
+: emacro-e-m-operate ( value macro -- s )
+       eval-macro dup emacro-symbols i-length zero? [ emacro-expr ] when ;
+
+M: emacro e-m-operate emacro-e-m-operate ;
diff --git a/unmaintained/enchilada/parser/parser.factor b/unmaintained/enchilada/parser/parser.factor
new file mode 100644 (file)
index 0000000..4001655
--- /dev/null
@@ -0,0 +1,139 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: enchilada.parser
+USING: strings sequences kernel promises lazy-lists parser-combinators parser-combinators.simple isequences.interface isequences.base enchilada.engine ;
+
+USE: lazy-lists
+USE: parser-combinators
+
+DEFER: e-expression
+
+LAZY: e/- ( -- parser )
+    "-" token [ drop <.-> ] <@ ;
+
+LAZY: e/# ( -- parser )
+    "#" token [ drop <.#> ] <@ ;
+
+LAZY: e/^ ( -- parser )
+    "^" token [ drop <.^> ] <@ ;
+
+LAZY: e/` ( -- parser )
+    "`" token [ drop <.`> ] <@ ;
+
+LAZY: e/: ( -- parser )
+    ":" token [ drop <.:> ] <@ ;
+
+LAZY: e/~ ( -- parser )
+    "~" token [ drop <.~> ] <@ ;
+
+LAZY: e/$ ( -- parser )
+    "$" token [ drop <.$> ] <@ ;
+
+LAZY: e/! ( -- parser )
+    "!" token [ drop <.!> ] <@ ;
+
+LAZY: e/\ ( -- parser )
+    "\\" token [ drop <.\> ] <@ ;
+
+LAZY: e/+ ( -- parser )
+    "+" token [ drop <.+> ] <@ ;
+
+LAZY: e/| ( -- parser )
+    "|" token [ drop <.|> ] <@ ;
+
+LAZY: e/& ( -- parser )
+    "&" token [ drop <.&> ] <@ ;
+
+LAZY: e/* ( -- parser )
+    "*" token [ drop <.*> ] <@ ;
+
+LAZY: e// ( -- parser )
+    "/" token [ drop <./> ] <@ ;
+
+LAZY: e/< ( -- parser )
+    "<" token [ drop <.<> ] <@ ;
+
+LAZY: e/> ( -- parser )
+    ">" token [ drop <.>> ] <@ ;
+
+LAZY: e/@ ( -- parser )
+    "@" token [ drop <.@> ] <@ ;
+
+LAZY: e/? ( -- parser )
+    "?" token [ drop <.?> ] <@ ;
+
+LAZY: e/% ( -- parser )
+    "%" token [ drop <.%> ] <@ ;
+
+LAZY: e-monadic ( -- parser )
+    e/- e/# <|> e/^ <|> e/` <|> e/: <|> e/~ <|> e/$ <|> e/! <|> e/\ <|> ;
+
+LAZY: e-dyadic ( -- parser )
+    e/+ e/* <|> e/& <|> e/| <|> e// <|> e/< <|> e/> <|> e/@ <|> e/? <|> e/% <|> ;
+
+LAZY: e-number ( -- parser )
+    'integer' ;
+
+LAZY: e-letter ( -- parser )
+    [ letter? ] satisfy [ 1 swap <string> ] <@ ;
+
+LAZY: e-digit ( -- parser )
+    [ digit? ] satisfy [ 1 swap <string> ] <@ ;
+
+LAZY: e-alphanumeric-char ( -- parser )
+    e-letter e-digit <|> ;
+
+LAZY: e-alphanumeric-symbol ( -- parser )
+    e-letter e-alphanumeric-char <!*> <&> [ dup first swap second "" [ append ] reduce append ] <@ ;
+
+LAZY: e-symbol ( -- parser )
+    e-alphanumeric-symbol 'string' <|> sp [ <esymbol> ] <@ ;
+
+LAZY: e-symbol-list ( -- parser )
+    e-symbol <!+> [ { } [ ++ ] reduce ] <@ ;
+
+LAZY: e-macro-expression ( -- parser )
+    "=" token "=" token <?> <&> sp e-expression <&> [ dup 1 tail swap first second [ t ] [ f ] if add ] <@ ;
+
+LAZY: e-macro ( -- parser )
+    "{" token sp e-symbol-list &> e-macro-expression <?> <&> "}" token sp <& 
+    [ dup first swap second dup [ first ] [ drop { 0 f } ] if dup first swap second <e-macro> ] <@ ;
+
+LAZY: e-right-expression ( -- parser )
+    "=" token e-expression &> ;
+
+: create-e-item ( pair -- e-item )
+    dup first swap second dup [ first ] [ drop 0 ] if <i-dual-sided> <i> ;
+LAZY: e-item ( -- parser )
+e-expression e-right-expression <?> <&> [ create-e-item ] <@ ;
+
+LAZY: e-rest ( -- parser )
+";" token sp e-item &> <!*> [ { } [ ++ ] reduce ] <@ ;
+
+LAZY: e-contents ( -- parser )
+e-item e-rest <&> [ dup first swap second ++ ] <@ ;
+
+LAZY: e-non-empty ( -- parser )
+"[" token e-contents &> "]" token sp <& ;
+
+LAZY: e-empty ( -- parser )
+    "[" token "]" token <&> [ drop 0 ] <@ ;
+
+LAZY: e-sequence ( -- parser )
+    e-empty e-non-empty <|> e-number <|> ;
+
+LAZY: e-operand ( -- parser )
+    "_" token <?> e-sequence <&> [ dup second swap first [ -- ] when <i> ] <@ ;
+
+LAZY: e-operator ( -- parser )
+    e-monadic e-dyadic <|> e-macro <|>  ;
+
+LAZY: e-element ( -- parser )
+    e-operator e-operand <|> e-symbol <|> sp ;
+
+LAZY: e-expression ( -- parser )
+    e-element <!*> [ { } [ ++ ] reduce ] <@ ;
+
+: e-parse  ( string -- result ) e-expression parse car parse-result-parsed ;
diff --git a/unmaintained/enchilada/printer/printer.factor b/unmaintained/enchilada/printer/printer.factor
new file mode 100644 (file)
index 0000000..569c71b
--- /dev/null
@@ -0,0 +1,71 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: enchilada.printer
+USING: prettyprint strings generic kernel math math.parser sequences isequences.interface isequences.base enchilada.engine ;
+
+: s-append ( s1 s2 s3 -- s )
+    swap append append ;
+
+DEFER: e-print
+DEFER: l-print
+
+GENERIC: (e-print) ( op -- string ) 
+
+M: .- (e-print) drop "-" ;
+M: .# (e-print) drop "#" ;
+M: .$ (e-print) drop "$" ;
+M: .^ (e-print) drop "^" ;
+M: .` (e-print) drop "`" ;
+M: .~ (e-print) drop "~" ;
+M: .: (e-print) drop ":" ;
+M: .! (e-print) drop "!" ;
+M: .\ (e-print) drop "\\" ;
+
+M: .+ (e-print) drop "+" ;
+M: .* (e-print) drop "*" ;
+M: ./ (e-print) drop "/" ;
+M: .< (e-print) drop "<" ;
+M: .> (e-print) drop ">" ;
+M: .| (e-print) drop "|" ;
+M: .& (e-print) drop "&" ;
+M: .@ (e-print) drop "@" ;
+M: .? (e-print) drop "?" ;
+M: .% (e-print) drop "%" ;
+
+: (eprint-macro-expr) ( emacro -- string )
+   dup emacro-expr dup i-length 0 =
+   [ 2drop "" ]
+   [ e-print swap emacro-eager? [ "==" ] [ "=" ] if swap append ] if ;
+
+: (l-print1) ( e-list -- string )
+    0 i-at dup left-side swap right-side dup 0 =
+    [ drop dup i-length 0 = [ drop " " ] [ e-print ] if ] [ e-print swap e-print swap "=" s-append ] if ;
+    
+: (l-print0) ( e-list -- string )
+    left-right [ l-print ] 2apply ";" s-append ;
+
+: l-print ( e-list -- string )
+    dup i-length dup 0 =
+    [ 2drop "0" ] [ 1 = [ (l-print1) ] [ (l-print0) ] if ] if ;
+
+: prefix-neg ( s -- s prefix )
+   dup i-length 0 < [ -- "_" ] [ "" ] if ;
+
+: (e-print3) ( symbol -- string )
+    esymbol-seq to-sequence >string ;
+
+: (e-print2) ( e-list -- string )
+    dup integer? [ prefix-neg swap number>string append ] [ prefix-neg "[" append swap l-print "]" append append ] if ;
+    
+: (e-print1) ( e-expression -- string )
+    0 i-at dup e-operator? [ (e-print) ] [ dup e-symbol? [ (e-print3) ] [ (e-print2) ] if ] if ;
+        
+: e-print ( e-expression -- string )
+    dup i-length dup 0 =
+    [ 2drop "" ]
+    [ 1 = [ (e-print1) ] [ left-right [ e-print ] 2apply " " s-append ] if ] if ;
+
+M: c-op (e-print) dup c-op-d-op swap c-op-v (e-print2) swap (e-print) " " s-append ;
+M: emacro (e-print) "{" swap dup emacro-symbols e-print swap (eprint-macro-expr) "}" append append append ;
+
diff --git a/unmaintained/enchilada/summary.txt b/unmaintained/enchilada/summary.txt
new file mode 100644 (file)
index 0000000..17d5a87
--- /dev/null
@@ -0,0 +1 @@
+Enchilada, a concatenative programming language
diff --git a/unmaintained/enchilada/tags.txt b/unmaintained/enchilada/tags.txt
new file mode 100644 (file)
index 0000000..eab42fe
--- /dev/null
@@ -0,0 +1 @@
+languages
diff --git a/unmaintained/factorbot.factor b/unmaintained/factorbot.factor
new file mode 100644 (file)
index 0000000..35280fb
--- /dev/null
@@ -0,0 +1,108 @@
+! Simple IRC bot written in Factor.
+
+REQUIRES: apps/http-server ;
+
+USING: errors generic hashtables help html http io kernel math
+memory namespaces parser prettyprint sequences strings threads
+words inspector network ;
+IN: factorbot
+
+SYMBOL: irc-stream
+SYMBOL: nickname
+SYMBOL: speaker
+SYMBOL: receiver
+
+: irc-write ( s -- ) irc-stream get stream-write ;
+: irc-print ( s -- )
+    irc-stream get stream-print
+    irc-stream get stream-flush ;
+
+: nick ( nick -- )
+    dup nickname set  "NICK " irc-write irc-print ;
+
+: login ( nick -- )
+    dup nick
+    "USER " irc-write irc-write
+    " hostname servername :irc.factor" irc-print ;
+
+: connect ( server -- ) 6667 <inet> <client> irc-stream set ;
+
+: disconnect ( -- ) irc-stream get stream-close ;
+
+: join ( chan -- )
+    "JOIN " irc-write irc-print ;
+
+GENERIC: handle-irc ( line -- )
+PREDICATE: string privmsg " " split1 nip "PRIVMSG" head? ;
+PREDICATE: string ping "PING" head? ;
+
+M: object handle-irc ( line -- )
+    drop ;
+
+: parse-privmsg ( line -- text )
+    " " split1 nip
+    "PRIVMSG " ?head drop
+    " " split1 swap receiver set
+    ":" ?head drop ;
+
+M: privmsg handle-irc ( line -- )
+    parse-privmsg
+    " " split1 swap
+    "factorbot-commands" lookup dup
+    [ execute ] [ 2drop ] if ;
+
+M: ping handle-irc ( line -- )
+    "PING " ?head drop "PONG " swap append irc-print ;
+
+: parse-irc ( line -- )
+    ":" ?head [ "!" split1 swap speaker set ] when handle-irc ;
+
+: say ( line nick -- )
+    "PRIVMSG " irc-write irc-write " :" irc-write irc-print ;
+
+: respond ( line -- )
+    receiver get nickname get = speaker receiver ? get say ;
+
+: irc-loop ( -- )
+    irc-stream get stream-readln
+    [ dup print flush parse-irc irc-loop ] when* ;
+
+: factorbot
+    "irc.freenode.net" connect
+    "factorbot" login
+    "#concatenative" join
+    [ irc-loop ] [ irc-stream get stream-close ] cleanup ;
+
+: factorbot-loop [ factorbot ] try 30000 sleep factorbot-loop ;
+
+: multiline-respond ( string -- )
+    string-lines [ respond ] each ;
+
+: object-href
+    "http://factorcode.org" swap browser-link-href append ;
+
+: not-found ( str -- )
+    "Sorry, I couldn't find anything for " swap append respond ;
+
+IN: factorbot-commands
+
+: see ( text -- )
+    dup words-named dup empty? [
+        drop
+        not-found
+    ] [
+        nip [
+            dup summary " -- " 
+            rot object-href 3append respond
+        ] each
+    ] if ;
+
+: memory ( text -- )
+    drop [ room. ] string-out multiline-respond ;
+
+: quit ( text -- )
+    drop speaker get "slava" = [ disconnect ] when ;
+
+PROVIDE: apps/factorbot ;
+
+MAIN: apps/factorbot factorbot ;
diff --git a/unmaintained/farkup/farkup.factor b/unmaintained/farkup/farkup.factor
new file mode 100644 (file)
index 0000000..3f8e95c
--- /dev/null
@@ -0,0 +1,86 @@
+! Copyright (C) 2006 Matthew Willis. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+USING: parser-combinators kernel sequences lazy-lists
+namespaces strings arrays math io errors ;
+
+IN: farkup
+LAZY: <(*)> ( parser -- parser ) 
+    ! kleene star matching, but take shortest match first
+    { } succeed swap dup <(*)> <&:> <|> ;
+
+LAZY: <(+)> ( parser -- parser )
+    dup <(*)> <&:> ;
+
+LAZY: 'consume1' ( -- parser ) [ CHAR: \n = not ] satisfy ;
+
+LAZY: '\n' ( -- parser ) [ CHAR: \n = ] satisfy ;
+
+: open-tag ( text -- tag ) [ CHAR: < , , CHAR: > , ] { } make ;
+
+: close-tag ( text -- tag ) [ "</" , , CHAR: > , ] { } make ;
+
+: both-tags ( text -- open-tag close-tag ) dup open-tag swap close-tag ;
+
+DEFER: 'inline'
+LAZY: simple-tag ( start end html -- parser )
+     both-tags [ \ drop , , ] [ ] make rot token swap <@ >r
+     [ \ drop , , ] [ ] make swap token swap <@
+     'inline' <(+)> <&> r> <&> ;
+
+LAZY: prefix-tag ( pre html -- parser )
+    >r 'inline' <!*> >r token r> &>
+    r> both-tags [ swap , \ swap , , \ 3array , ] [ ] make <@ ;
+    
+LAZY: 'strong' ( -- parser ) "*" "*" "strong" simple-tag ;
+
+LAZY: 'link' ( -- parser )
+    "[" token [ drop "<a href=\"" ] <@ 'consume1' <(+)> <&> 
+    "," token [ drop "\">" ] <@ <&>
+    'consume1' <(+)> <&> "]" token [ drop "</a>" ] <@ <&> ;
+
+LAZY: 'inline' ( -- parser )
+    'strong' 
+    'link' <|>
+    'consume1' <|> ;
+
+LAZY: 'h1' ( -- parser ) "=" "h1" prefix-tag ;
+LAZY: 'h2' ( -- parser ) "==" "h2" prefix-tag ;
+LAZY: 'h3' ( -- parser ) "===" "h3" prefix-tag ;
+LAZY: 'h4' ( -- parser ) "====" "h4" prefix-tag ;
+LAZY: 'h5' ( -- parser ) "=====" "h5" prefix-tag ;
+LAZY: 'h6' ( -- parser ) "======" "h6" prefix-tag ;
+
+LAZY: 'blockquote' ( -- parser ) "[\"" "\"]" "blockquote" simple-tag ;
+
+LAZY: 'block' ( -- parser )
+    'h6' 'h5' 'h4' 'h3' 'h2' 'h1' <|> <|> <|> <|> <|>
+    'blockquote' <|>
+    'inline' <!+> [ "<p>" swap "</p>" 3array ] <@ <|> ;
+
+LAZY: 'farkup' ( -- parser )
+    'block' '\n' <!+> 'block' <&> <!*> <&> ;
+
+GENERIC: tree-write ( object -- )
+
+PREDICATE: sequence non-leaf dup number? swap string? or not ;
+M: non-leaf tree-write ( sequence -- ) [ tree-write ] each ;
+    
+M: string tree-write ( string -- ) write ;
+
+M: number tree-write ( char -- ) write1 ;
+
+: farkup ( str -- html )
+    'farkup' parse dup nil? 
+    [ error ] [ car parse-result-parsed [ tree-write ] string-out ] if ;
+
+! useful debugging code below
+
+: farkup-backtracks ( wiki -- backtracks )
+    ! for debugging and optimization only
+    'farkup' parse list>array length ;
+
+: farkup-parsed ( wiki -- all-parses )
+    ! for debugging and optimization only
+    'farkup' parse list>array 
+    [ parse-result-parsed [ tree-write ] string-out ] map ;
\ No newline at end of file
diff --git a/unmaintained/farkup/farkup.facts b/unmaintained/farkup/farkup.facts
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/unmaintained/farkup/farkup.list b/unmaintained/farkup/farkup.list
new file mode 100644 (file)
index 0000000..26fdc96
--- /dev/null
@@ -0,0 +1,20 @@
+Blocks
+------
+Must be terminated by \n or end of input.
+
+foo => <p>foo</p>
+=foo => <h1>foo</h1>
+==foo => <h2>foo</h2>
+ ...
+["foo"] => <blockquote>foo</blockquote>
+
+Inlines
+-------
+Can appear anywhere within a block
+
+*foo* => <strong>foo</strong>
+[url,text] => <a href="url">text</a>
+
+
+
diff --git a/unmaintained/farkup/load.factor b/unmaintained/farkup/load.factor
new file mode 100644 (file)
index 0000000..86a471a
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2006 Matthew Willis. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+! Adapted from Wiky (http://goessner.net/articles/wiky/)
+!
+REQUIRES: libs/lazy-lists libs/parser-combinators ;
+
+PROVIDE: libs/farkup
+{ +files+ { 
+  "farkup.factor"
+  "farkup.facts"
+} } ;
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/load.factor b/unmaintained/furnace-onigiri/load.factor
new file mode 100644 (file)
index 0000000..727eaf7
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2006 Matthew Willis. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+
+REQUIRES: libs/calendar libs/crypto libs/basic-authentication 
+libs/furnace libs/serialize ;
+
+PROVIDE: apps/furnace-onigiri
+{ +files+ {
+       "onigiri.factor"
+       "onigiri.facts"
+} } ;
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/onigiri.factor b/unmaintained/furnace-onigiri/onigiri.factor
new file mode 100644 (file)
index 0000000..3c1d43c
--- /dev/null
@@ -0,0 +1,166 @@
+! Copyright (C) 2006 Matthew Willis. All Rights Reserved.
+! See http://factorcode.org/license.txt for BSD license.
+!
+
+USING: httpd threads kernel namespaces furnace sequences 
+html strings math assocs crypto io file-responder calendar 
+prettyprint parser errors sha2 basic-authentication arrays
+serialize ;
+
+IN: furnace:onigiri
+
+TUPLE: entry title stub body created ;
+
+TUPLE: user name password ;
+
+TUPLE: meta key value ;
+
+: title>stub ( title -- stub )
+    ! creates a url friendly name based on the title
+    " " split [ [ alpha? ] subset ] map "" swap remove "-" join ;
+
+C: entry ( title body stub -- entry )
+    tuck set-entry-stub 
+    tuck set-entry-body 
+    dup entry-stub [ over title>stub over set-entry-stub ] unless
+    now over set-entry-created tuck set-entry-title ;
+
+C: user ( name password -- user )
+    swap string>sha-256-string over set-user-password
+    tuck set-user-name ;
+
+: base-url ( -- url )
+    "http://" "Host" "header" get at append ;
+
+: action>url ( action -- url )
+    "responder-url" get swap append ;
+
+: stub>url ( stub -- url )
+    "entry-show?stub=" swap append action>url ;
+
+: stub>entry ( stub -- entry )
+    entry get-global [ entry-stub = ] subset-with 
+    dup empty? [ drop f ] [ first ] if ;
+
+: atom ( -- )
+    "text/xml" serving-content
+    [ f "atom" render-template ] with-html-stream ;
+
+: sitemap ( -- )
+    "text/xml" serving-content
+    [ f "sitemap" render-template ] with-html-stream ;
+
+: css-path ( -- path )
+    ! "text/css" serving-content
+    "css" meta crud-lookup* meta-value
+    [ "onigirihouse.css" ] unless* ;
+
+DEFER: key>meta*
+: entry-list ( -- )
+       "title" key>meta* meta-value
+       serving-html [
+           <furnace-model> "header" render-template
+       entry get-global
+               [ [ entry-created ] 2apply swap compare-timestamps ] sort
+               [ "entry-show" render-template ] each
+       f "footer" render-template
+       ] with-html-stream ;
+
+DEFER: key>meta
+: entry-show ( stub -- )
+    stub>entry
+    [ 
+        "title" key>meta* meta-value
+        " - " pick entry-title 3append
+        serving-html [
+            <furnace-model> "header" render-template
+            "entry-show" render-template
+            f "footer" render-template
+        ] with-html-stream
+    ] [ 
+        "title" key>meta* meta-value " - Entry not found" append
+        serving-html [ 
+            [ 
+                <p> "The entry you are searching for could not be found" write </p>
+                <p> [ entry-list ] "Back to " "title" key>meta
+                [ meta-value ] [ "the main page" ] if* append render-link
+                </p>
+            ] html-document
+        ] with-html-stream
+    ] if* ;
+
+: entry-edit ( stub wiky -- )
+    swap stub>entry dup [ entry-title ] [ f ] if*
+    "title" key>meta* meta-value " - editing " rot 3append
+    serving-html [
+        <furnace-model> "header" render-template
+        swap "entry-edit" "entry-edit-plain" ? render-template
+        f "footer" render-template
+    ] with-html-stream ;
+
+: entry-update ( title body stub -- )
+    "onigiri-realm" [
+        dup stub>entry [
+            nip tuck set-entry-body tuck set-entry-title
+        ] [
+            <entry> dup entry get-global swap add entry set-global 
+       ] if* entry-stub entry-show
+    ] with-basic-authentication ;
+
+: entry-delete ( stub -- )
+    "onigiri-realm" [ 
+        stub>entry entry get-global remove entry set-global entry-list
+    ] with-basic-authentication ;
+
+DEFER: name>user
+: onigiri-realm ( name password -- bool )
+    swap name>user [ user-password = ] [ drop f ] if*
+    user get-global empty? or ;
+    
+: register-actions ( -- )
+    \ entry-list { } define-action
+    \ entry-show { { "stub" } } define-action
+    \ entry-edit { { "stub" } { "wiky" f v-default } } define-action
+    \ entry-update { { "title" } { "body" } { "stub" } } define-action
+    \ entry-delete { { "stub" } } define-action
+    \ atom { } define-action
+    \ sitemap { } define-action
+    "onigiri" "entry-list" "apps/furnace-onigiri/templates/" web-app 
+    "onigiri-resources" [ 
+        [
+            "apps/furnace-onigiri/resources/" resource-path "doc-root" set
+            file-responder
+        ] with-scope
+    ] add-simple-responder 
+    [ onigiri-realm ] "onigiri-realm" add-realm
+    ! and finally, use scaffolding for metadata and user data 
+    [ 
+        "furnace:onigiri" set-in
+        meta "key" "onigiri-realm" scaffold
+        user "name" "onigiri-realm" scaffold 
+    ] with-scope ;
+
+: onigiri ( -- )
+    register-actions
+    "default-responder" key>meta* meta-value
+    [ "onigiri" set-default-responder ] when
+    "port" key>meta* meta-value string>number [ 8888 ] unless*
+    [ httpd ] in-thread drop ;
+
+: onigiri-dump ( path -- )
+    <file-writer> [
+        [
+            entry get-global serialize
+            meta get-global serialize
+            user get-global serialize
+        ] with-serialized
+    ] with-stream ;
+
+: onigiri-boot ( path -- )
+    <file-reader> [
+        [
+            deserialize entry set-global
+            deserialize meta set-global
+            deserialize user set-global
+        ] with-serialized
+    ] with-stream ;
diff --git a/unmaintained/furnace-onigiri/onigiri.facts b/unmaintained/furnace-onigiri/onigiri.facts
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/unmaintained/furnace-onigiri/onigiri.todo b/unmaintained/furnace-onigiri/onigiri.todo
new file mode 100644 (file)
index 0000000..2785c00
--- /dev/null
@@ -0,0 +1,4 @@
+Recent posts sidebar
+Links sidebar
+Widgets (Onigirihouse feels ...)
+Tagging*
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/resources/onigirihouse.css b/unmaintained/furnace-onigiri/resources/onigirihouse.css
new file mode 100644 (file)
index 0000000..89f2664
--- /dev/null
@@ -0,0 +1,7 @@
+body { font: 14px "Trebuchet MS", Arial, Helvetica, sans-serif; }
+h1, h2, h3, h4, h5, h6 { font-family: lucida grande ; }
+#header { text-align: center ; }
+#container { max-width: 720px ; margin: 0 auto; padding: 20px; }
+.entry { margin-bottom: 75px ; }
+a { color: #5C832F; text-decoration: none; }
+a:hover { text-decoration: underline; }
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/resources/wiky/wiky.css b/unmaintained/furnace-onigiri/resources/wiky/wiky.css
new file mode 100644 (file)
index 0000000..062f34e
--- /dev/null
@@ -0,0 +1,15 @@
+/* == wiky == */\r
+*.wiki blockquote { background:#ddd; border:solid 1px #999; margin-left:1em; padding:0.5em;}\r
+*.wiki table {\r
+  border-collapse: collapse;\r
+  empty-cells: show;\r
+}\r
+\r
+*.wiki table td {\r
+  border: solid 1px black;\r
+  padding: 0.25em 0.5em 0.25em 0.5em;\r
+  text-align: center;\r
+}\r
+\r
+/*pre { font-size:100%; background: #eed; border:1px dotted #999; padding:0 0.5em; overflow:auto; }*/\r
+pre { font-family:courier new, monospace; overflow:auto; }\r
diff --git a/unmaintained/furnace-onigiri/resources/wiky/wiky.js b/unmaintained/furnace-onigiri/resources/wiky/wiky.js
new file mode 100644 (file)
index 0000000..71e46ff
--- /dev/null
@@ -0,0 +1,373 @@
+/*     This work is licensed under Creative Commons GNU LGPL License.
+
+       License: http://creativecommons.org/licenses/LGPL/2.1/
+
+       Author:  Stefan Goessner/2005-06
+       Web:     http://goessner.net/ 
+*/
+var Wiky = {
+  version: 0.95,
+  blocks: null,
+  rules: {
+     all: [
+       "Wiky.rules.pre",
+       "Wiky.rules.nonwikiblocks",
+       "Wiky.rules.wikiblocks",
+       "Wiky.rules.post",
+     ],
+     pre: [
+       { rex:/(\r?\n)/g, tmplt:"\xB6" },  // replace line breaks with '¶' ..
+     ],
+     post: [
+       { rex:/(^\xB6)|(\xB6$)/g, tmplt:"" },  // .. remove linebreaks at BOS and EOS ..
+       { rex:/@([0-9]+)@/g, tmplt:function($0,$1){return Wiky.restore($1);} }, // resolve blocks ..
+       { rex:/\xB6/g, tmplt:"\n" } // replace '¶' with line breaks ..
+     ],
+     nonwikiblocks: [
+       { rex:/\\([%])/g, tmplt:function($0,$1){return Wiky.store($1);} },
+       { rex:/\[(?:\{([^}]*)\})?(?:\(([^)]*)\))?%(.*?)%\]/g, tmplt:function($0,$1,$2,$3){return ":p]"+Wiky.store("<pre"+($2?(" lang=\"x-"+Wiky.attr($2)+"\""):"")+Wiky.style($1)+">" + Wiky.apply($3, $2?Wiky.rules.lang[Wiky.attr($2)]:Wiky.rules.code) + "</pre>")+"[p:";} } //programm code block
+     ],
+     wikiblocks: [
+       "Wiky.rules.nonwikiinlines",
+       "Wiky.rules.escapes",
+       { rex:/(?:^|\xB6)(={1,6})(.*?)[=]*(?=\xB6|$)/g, tmplt:function($0,$1,$2){ var h=$1.length; return ":p]\xB6<h"+h+">"+$2+"</h"+h+">\xB6[p:";} }, // <h1> .. <h6>
+       { rex:/(?:^|\xB6)[-]{4}(?:\xB6|$)/g, tmplt:"\xB6<hr/>\xB6" },  // horizontal ruler ..
+       { rex:/\\\\([ \xB6])/g, tmplt:"<br/>$1" },  // forced line break ..
+       { rex:/(^|\xB6)([*01aAiIg]*[\.*])[ ]/g, tmplt:function($0,$1,$2){var state=$2.replace(/([*])/g,"u").replace(/([\.])/,"");return ":"+state+"]"+$1+"["+state+":";}},
+       { rex:/(?:^|\xB6);[ ](.*?):[ ]/g, tmplt:"\xB6:l][l:$1:d][d:"},  // ; term : definition
+       { rex:/\[(?:\{([^}]*)\})?(?:\(([^)]*)\))?\"/g, tmplt:function($0,$1,$2){return ":p]<blockquote"+Wiky.attr($2,"cite",0)+Wiky.attr($2,"title",1)+Wiky.style($1)+">[p:"; } }, // block quotation start
+       { rex:/\"\]/g, tmplt:":p]</blockquote>[p:" }, // block quotation end
+       { rex:/\[(\{[^}]*\})?\|/g, tmplt:":t]$1[r:" },  // .. start table ..
+       { rex:/\|\]/g, tmplt:":r][t:" },  // .. end table ..
+       { rex:/\|\xB6[ ]?\|/g, tmplt:":r]\xB6[r:" },  // .. end/start table row ..
+       { rex:/\|/g, tmplt:":c][c:" },  // .. end/start table cell ..
+       { rex:/^(.*)$/g, tmplt:"[p:$1:p]" },  // start paragraph '[p:' at BOS .. end paragraph ':p]' at EOS ..
+       { rex:/(([\xB6])([ \t\f\v\xB6]*?)){2,}/g, tmplt:":p]$1[p:" },  // .. separate paragraphs at blank lines ..
+       { rex:/\[([01AIacdgilprtu]+)[:](.*?)[:]([01AIacdgilprtu]+)\]/g, tmplt:function($0,$1,$2,$3){return Wiky.sectionRule($1==undefined?"":$1,"",Wiky.apply($2,Wiky.rules.wikiinlines),!$3?"":$3);} },
+       { rex:/\[[01AIacdgilprtu]+[:]|[:][01AIacdgilprtu]+\]/g, tmplt:"" },  // .. remove singular section delimiters (they frequently exist with incomplete documents while typing) ..
+       { rex:/<td>(?:([0-9]*)[>])?([ ]?)(.*?)([ ]?)<\/td>/g, tmplt:function($0,$1,$2,$3,$4){return "<td"+($1?" colspan=\""+$1+"\"":"")+($2==" "?(" style=\"text-align:"+($2==$4?"center":"right")+";\""):($4==" "?" style=\"text-align:left;\"":""))+">"+$2+$3+$4+"</td>";} },
+       { rex:/<(p|table)>(?:\xB6)?(?:\{(.*?)\})/g, tmplt:function($0,$1,$2){return "<"+$1+Wiky.style($2)+">";} },
+       { rex:/<p>([ \t\f\v\xB6]*?)<\/p>/g, tmplt:"$1" },  // .. remove empty paragraphs ..
+       "Wiky.rules.shortcuts"
+     ],
+     nonwikiinlines: [
+       { rex:/%(?:\{([^}]*)\})?(?:\(([^)]*)\))?(.*?)%/g, tmplt:function($0,$1,$2,$3){return Wiky.store("<code"+($2?(" lang=\"x-"+Wiky.attr($2)+"\""):"")+Wiky.style($1)+">" + Wiky.apply($3, $2?Wiky.rules.lang[Wiky.attr($2)]:Wiky.rules.code) + "</code>");} }, // inline code
+       { rex:/%(.*?)%/g, tmplt:function($0,$1){return Wiky.store("<code>" + Wiky.apply($2, Wiky.rules.code) + "</code>");} }
+     ],
+     wikiinlines: [
+       { rex:/\*([^*]+)\*/g, tmplt:"<strong>$1</strong>" },  // .. strong ..
+       { rex:/_([^_]+)_/g, tmplt:"<em>$1</em>" },
+       { rex:/\^([^^]+)\^/g, tmplt:"<sup>$1</sup>" },
+       { rex:/~([^~]+)~/g, tmplt:"<sub>$1</sub>" },
+       { rex:/\(-(.+?)-\)/g, tmplt:"<del>$1</del>" },
+       { rex:/\?([^ \t\f\v\xB6]+)\((.+)\)\?/g, tmplt:"<abbr title=\"$2\">$1</abbr>" },  // .. abbreviation ..
+       { rex:/\[(?:\{([^}]*)\})?[Ii]ma?ge?\:([^ ,\]]*)(?:[, ]([^\]]*))?\]/g, tmplt:function($0,$1,$2,$3){return Wiky.store("<img"+Wiky.style($1)+" src=\""+$2+"\" alt=\""+($3?$3:$2)+"\" title=\""+($3?$3:$2)+"\"/>");} },  // wikimedia image style ..
+       { rex:/\[([^ ,]+)[, ]([^\]]*)\]/g, tmplt:function($0,$1,$2){return Wiky.store("<a href=\""+$1+"\">"+$2+"</a>");}},  // wiki block style uri's ..
+       { rex:/(((http(s?))\:\/\/)?[A-Za-z0-9\._\/~\-:]+\.(?:png|jpg|jpeg|gif|bmp))/g, tmplt:function($0,$1,$2){return Wiky.store("<img src=\""+$1+"\" alt=\""+$1+"\"/>");} },  // simple images .. 
+       { rex:/((mailto\:|javascript\:|(news|file|(ht|f)tp(s?))\:\/\/)[A-Za-z0-9\.:_\/~%\-+&#?!=()@\x80-\xB5\xB7\xFF]+)/g, tmplt:"<a href=\"$1\">$1</a>" }  // simple uri's .. 
+     ],
+     escapes: [
+       { rex:/\\([|*_~\^])/g, tmplt:function($0,$1){return Wiky.store($1);} },
+       { rex:/\\&/g, tmplt:"&amp;" },
+       { rex:/\\>/g, tmplt:"&gt;" },
+       { rex:/\\</g, tmplt:"&lt;" }
+     ],
+     shortcuts: [
+       { rex:/---/g, tmplt:"&#8212;" },  // &mdash;
+       { rex:/--/g, tmplt:"&#8211;" },  // &ndash;
+       { rex:/[\.]{3}/g, tmplt:"&#8230;"}, // &hellip;
+       { rex:/<->/g, tmplt:"&#8596;"}, // $harr;
+       { rex:/<-/g, tmplt:"&#8592;"}, // &larr;
+       { rex:/->/g, tmplt:"&#8594;"}, //&rarr;
+     ],
+     code: [
+       { rex:/&/g, tmplt:"&amp;"},
+       { rex:/</g, tmplt:"&lt;"},
+       { rex:/>/g, tmplt:"&gt;"}
+     ],
+     lang: {}
+   },
+
+   inverse: {
+     all: [
+       "Wiky.inverse.pre",
+       "Wiky.inverse.nonwikiblocks",
+       "Wiky.inverse.wikiblocks",
+       "Wiky.inverse.post"
+     ],
+     pre: [
+       { rex:/(\r?\n)/g, tmplt:"\xB6" }  // replace line breaks with '¶' ..
+     ],
+     post: [
+       { rex:/@([0-9]+)@/g, tmplt:function($0,$1){return Wiky.restore($1);} },  // resolve blocks ..
+       { rex:/\xB6/g, tmplt:"\n" }  // replace '¶' with line breaks ..
+     ],
+     nonwikiblocks: [
+       { rex:/<pre([^>]*)>(.*?)<\/pre>/mgi, tmplt:function($0,$1,$2){return Wiky.store("["+Wiky.invStyle($1)+Wiky.invAttr($1,["lang"]).replace(/x\-/,"")+"%"+Wiky.apply($2, Wiky.hasAttr($1,"lang")?Wiky.inverse.lang[Wiky.attrVal($1,"lang").substr(2)]:Wiky.inverse.code)+"%]");} } //code block
+     ],
+     wikiblocks: [
+       "Wiky.inverse.nonwikiinlines",
+       "Wiky.inverse.escapes",
+       "Wiky.inverse.wikiinlines",
+       { rex:/<h1>(.*?)<\/h1>/mgi, tmplt:"=$1=" },
+       { rex:/<h2>(.*?)<\/h2>/mgi, tmplt:"==$1==" },
+       { rex:/<h3>(.*?)<\/h3>/mgi, tmplt:"===$1===" },
+       { rex:/<h4>(.*?)<\/h4>/mgi, tmplt:"====$1====" },
+       { rex:/<h5>(.*?)<\/h5>/mgi, tmplt:"=====$1=====" },
+       { rex:/<h6>(.*?)<\/h6>/mgi, tmplt:"======$1======" },
+       { rex:/<(p|table)[^>]+(style=\"[^\"]*\")[^>]*>/mgi, tmplt:function($0,$1,$2){return "<"+$1+">"+Wiky.invStyle($2);} },
+       { rex:/\xB6{2}<li/mgi, tmplt:"\xB6<li" },  // ie6 only ..
+       { rex:/<li class=\"?([^ >\"]*)\"?[^>]*?>([^<]*)/mgi, tmplt:function($0,$1,$2){return $1.replace(/u/g,"*").replace(/([01aAiIg])$/,"$1.")+" "+$2;}},  // list items ..
+       { rex:/(^|\xB6)<(u|o)l[^>]*?>\xB6/mgi, tmplt:"$1" },  // only outer level list start at BOL ...
+       { rex:/(<\/(?:dl|ol|ul|p)>[ \xB6]*<(?:p)>)/gi, tmplt:"\xB6\xB6" },
+       { rex:/<dt>(.*?)<\/dt>[ \f\n\r\t\v]*<dd>/mgi, tmplt:"; $1: " },
+       { rex:/<blockquote([^>]*)>/mgi, tmplt:function($0,$1){return Wiky.store("["+Wiky.invStyle($1)+Wiky.invAttr($1,["cite","title"])+"\"");} },
+       { rex:/<\/blockquote>/mgi, tmplt:"\"]" },
+       { rex:/<td class=\"?lft\"?>\xB6*[ ]?|<\/tr>/mgi, tmplt:"|" },  // ie6 only ..
+       { rex:/\xB6<tr(?:[^>]*?)>/mgi, tmplt:"\xB6" },
+       { rex:/<td colspan=\"([0-9]+)\"(?:[^>]*?)>/mgi, tmplt:"|$1>" },
+       { rex:/<td(?:[^>]*?)>/mgi, tmplt:"|" },
+       { rex:/<table>/mgi, tmplt:"[" },
+       { rex:/<\/table>/mgi, tmplt:"]" },
+       { rex:/<tr(?:[^>]*?)>\xB6*|<\/td>\xB6*|<tbody>\xB6*|<\/tbody>/mgi, tmplt:"" },
+       { rex:/<hr\/?>/mgi, tmplt:"----" },
+       { rex:/<br\/?>/mgi, tmplt:"\\\\" },
+       { rex:/(<p>|<(d|o|u)l[^>]*>|<\/(dl|ol|ul|p)>|<\/(li|dd)>)/mgi, tmplt:"" },
+       "Wiky.inverse.shortcuts"
+     ],
+     nonwikiinlines: [
+       { rex:/<code>(.*?)<\/code>/g, tmplt:function($0,$1){return Wiky.store("%"+Wiky.apply($1, Wiky.inverse["code"])+"%");} }
+     ],
+     wikiinlines: [
+       { rex:/<strong[^>]*?>(.*?)<\/strong>/mgi, tmplt:"*$1*" },
+       { rex:/<b[^>]*?>(.*?)<\/b>/mgi, tmplt:"*$1*" },
+       { rex:/<em[^>]*?>(.*?)<\/em>/mgi, tmplt:"_$1_" },
+       { rex:/<i[^>]*?>(.*?)<\/i>/mgi, tmplt:"_$1_" },
+       { rex:/<sup[^>]*?>(.*?)<\/sup>/mgi, tmplt:"^$1^" },
+       { rex:/<sub[^>]*?>(.*?)<\/sub>/mgi, tmplt:"~$1~" },
+       { rex:/<del[^>]*?>(.*?)<\/del>/mgi, tmplt:"(-$1-)" },
+       { rex:/<abbr title=\"([^\"]*)\">(.*?)<\/abbr>/mgi, tmplt:"?$2($1)?" },
+       { rex:/<a href=\"([^\"]*)\"[^>]*?>(.*?)<\/a>/mgi, tmplt:function($0,$1,$2){return $1==$2?$1:"["+$1+","+$2+"]";}},
+       { rex:/<img([^>]*)\/>/mgi, tmplt:function($0,$1){var a=Wiky.attrVal($1,"alt"),h=Wiky.attrVal($1,"src"),t=Wiky.attrVal($1,"title"),s=Wiky.attrVal($1,"style");return s||(t&&h!=t)?("["+Wiky.invStyle($1)+"img:"+h+(t&&(","+t))+"]"):h;}},
+     ],
+     escapes: [
+       { rex:/([|*_~%\^])/g, tmplt:"\\$1" },
+       { rex:/&amp;/g, tmplt:"\\&" },
+       { rex:/&gt;/g, tmplt:"\\>" },
+       { rex:/&lt;/g, tmplt:"\\<" }
+     ],
+     shortcuts: [
+       { rex:/&#8211;|\u2013/g, tmplt:"--"},
+       { rex:/&#8212;|\u2014/g, tmplt:"---"},
+       { rex:/&#8230;|\u2026/g, tmplt:"..."},
+       { rex:/&#8596;|\u2194/g, tmplt:"<->"},
+       { rex:/&#8592;|\u2190/g, tmplt:"<-"},
+       { rex:/&#8594;|\u2192/g, tmplt:"->"}
+     ],
+     code: [
+       { rex:/&amp;/g, tmplt:"&"},
+       { rex:/&lt;/g, tmplt:"<"},
+       { rex:/&gt;/g, tmplt:">"}
+     ],
+     lang: {}
+   },
+
+   toHtml: function(str) {
+      Wiky.blocks = [];
+      return Wiky.apply(str, Wiky.rules.all);
+   },
+
+   toWiki: function(str) {
+      Wiky.blocks = [];
+      return Wiky.apply(str, Wiky.inverse.all);
+   },
+
+   apply: function(str, rules) {
+      if (str && rules)
+         for (var i in rules) {
+            if (typeof(rules[i]) == "string")
+               str = Wiky.apply(str, eval(rules[i]));
+            else
+               str = str.replace(rules[i].rex, rules[i].tmplt);
+         }
+      return str;
+   },
+   store: function(str, unresolved) {
+      return unresolved ? "@" + (Wiky.blocks.push(str)-1) + "@"
+                        : "@" + (Wiky.blocks.push(str.replace(/@([0-9]+)@/g, function($0,$1){return Wiky.restore($1);}))-1) + "@";
+   },
+   restore: function(idx) {
+      return Wiky.blocks[idx];
+   },
+   attr: function(str, name, idx) {
+      var a = str && str.split(",")[idx||0];
+      return a ? (name ? (" "+name+"=\""+a+"\"") : a) : "";
+   },
+   hasAttr: function(str, name) {
+      return new RegExp(name+"=").test(str);
+   },
+   attrVal: function(str, name) {
+      return str.replace(new RegExp("^.*?"+name+"=\"(.*?)\".*?$"), "$1");
+   },
+   invAttr: function(str, names) {
+      var a=[], x;
+      for (var i in names)
+         if (str.indexOf(names[i]+"=")>=0) 
+            a.push(str.replace(new RegExp("^.*?"+names[i]+"=\"(.*?)\".*?$"), "$1"));
+      return a.length ? ("("+a.join(",")+")") : "";
+   },
+   style: function(str) {
+      var s = str && str.split(/,|;/), p, style = "";
+      for (var i in s) {
+         p = s[i].split(":");
+         if (p[0] == ">")       style += "margin-left:4em;";
+         else if (p[0] == "<")  style += "margin-right:4em;";
+         else if (p[0] == ">>") style += "float:right;";
+         else if (p[0] == "<<") style += "float:left;";
+         else if (p[0] == "=") style += "display:block;margin:0 auto;";
+         else if (p[0] == "_")  style += "text-decoration:underline;";
+         else if (p[0] == "b")  style += "border:solid 1px;";
+         else if (p[0] == "c")  style += "color:"+p[1]+";";
+         else if (p[0] == "C")  style += "background:"+p[1]+";";
+         else if (p[0] == "w")  style += "width:"+p[1]+";";
+         else                   style += p[0]+":"+p[1]+";";
+      }
+      return style ? " style=\""+style+"\"" : "";
+   },
+   invStyle: function(str) {
+      var s = /style=/.test(str) ? str.replace(/^.*?style=\"(.*?)\".*?$/, "$1") : "",
+          p = s && s.split(";"), pi, prop = [];
+      for (var i in p) {
+         pi = p[i].split(":");
+         if (pi[0] == "margin-left" && pi[1]=="4em") prop.push(">");
+         else if (pi[0] == "margin-right" && pi[1]=="4em") prop.push("<");
+         else if (pi[0] == "float" && pi[1]=="right") prop.push(">>");
+         else if (pi[0] == "float" && pi[1]=="left") prop.push("<<");
+         else if (pi[0] == "margin" && pi[1]=="0 auto") prop.push("=");
+         else if (pi[0] == "display" && pi[1]=="block") ;
+         else if (pi[0] == "text-decoration" && pi[1]=="underline") prop.push("_");
+         else if (pi[0] == "border" && pi[1]=="solid 1px") prop.push("b");
+         else if (pi[0] == "color") prop.push("c:"+pi[1]);
+         else if (pi[0] == "background") prop.push("C:"+pi[1]);
+         else if (pi[0] == "width") prop.push("w:"+pi[1]);
+         else if (pi[0]) prop.push(pi[0]+":"+pi[1]);
+      }
+      return prop.length ? ("{" + prop.join(",") + "}") : "";
+   },
+   sectionRule: function(fromLevel, style, content, toLevel) {
+      var trf = { p_p: "<p>$1</p>",
+                  p_u: "<p>$1</p><ul$3>",
+                  p_o: "<p>$1</p><ol$3>",
+                  // p - ul
+                  // ul - p
+                  u_p: "<li$2>$1</li></ul>",
+                  u_c: "<li$2>$1</li></ul></td>",
+                  u_r: "<li$2>$1</li></ul></td></tr>",
+                  uu_p: "<li$2>$1</li></ul></li></ul>",
+                  uo_p: "<li$2>$1</li></ol></li></ul>",
+                  uuu_p: "<li$2>$1</li></ul></li></ul></li></ul>",
+                  uou_p: "<li$2>$1</li></ul></li></ol></li></ul>",
+                  uuo_p: "<li$2>$1</li></ol></li></ul></li></ul>",
+                  uoo_p: "<li$2>$1</li></ol></li></ol></li></ul>",
+                  // ul - ul
+                  u_u: "<li$2>$1</li>",
+                  uu_u: "<li$2>$1</li></ul></li>",
+                  uo_u: "<li$2>$1</li></ol></li>",
+                  uuu_u: "<li$2>$1</li></ul></li></ul></li>",
+                  uou_u: "<li$2>$1</li></ul></li></ol></li>",
+                  uuo_u: "<li$2>$1</li></ol></li></ul></li>",
+                  uoo_u: "<li$2>$1</li></ol></li></ol></li>",
+                  u_uu: "<li$2>$1<ul$3>",
+                  // ul - ol
+                  u_o: "<li$2>$1</li></ul><ol$3>",
+                  uu_o: "<li$2>$1</li></ul></li></ul><ol$3>",
+                  uo_o: "<li$2>$1</li></ol></li></ul><ol$3>",
+                  uuu_o: "<li$2>$1</li></ul></li></ul></li></ul><ol$3>",
+                  uou_o: "<li$2>$1</li></ul></li></ol></li></ul><ol$3>",
+                  uuo_o: "<li$2>$1</li></ol></li></ul></li></ul><ol$3>",
+                  uoo_o: "<li$2>$1</li></ol></li></ol></li></ul><ol$3>",
+                  u_uo: "<li$2>$1<ol$3>",
+                  // ol - p
+                  o_p: "<li$2>$1</li></ol>",
+                  oo_p: "<li$2>$1</li></ol></li></ol>",
+                  ou_p: "<li$2>$1</li></ul></li></ol>",
+                  ooo_p: "<li$2>$1</li></ol></li></ol>",
+                  ouo_p: "<li$2>$1</li></ol></li></ul></li></ol>",
+                  oou_p: "<li$2>$1</li></ul></li></ol></li></ol>",
+                  ouu_p: "<li$2>$1</li></ul></li></ul></li></ol>",
+                  // ol - ul
+                  o_u: "<li$2>$1</li></ol><ul$3>",
+                  oo_u: "<li$2>$1</li></ol></li></ol><ul$3>",
+                  ou_u: "<li$2>$1</li></ul></li></ol><ul$3>",
+                  ooo_u: "<li$2>$1</li></ol></li></ol></li></ol><ul$3>",
+                  ouo_u: "<li$2>$1</li></ol></li></ul></li></ol><ul$3>",
+                  oou_u: "<li$2>$1</li></ul></li></ol></li></ol><ul$3>",
+                  ouu_u: "<li$2>$1</li></ul></li></ul></li></ol><ul$3>",
+                  o_ou: "<li$2>$1<ul$3>",
+                  // -- ol - ol --
+                  o_o: "<li$2>$1</li>",
+                  oo_o: "<li$2>$1</li></ol></li>",
+                  ou_o: "<li$2>$1</li></ul></li>",
+                  ooo_o: "<li$2>$1</li></ol></li></ol></li>",
+                  ouo_o: "<li$2>$1</li></ol></li></ul></li>",
+                  oou_o: "<li$2>$1</li></ul></li></ol></li>",
+                  ouu_o: "<li$2>$1</li></ul></li></ul></li>",
+                  o_oo: "<li$2>$1<ol$3>",
+                  // -- dl --
+                  l_d: "<dt>$1</dt>",
+                  d_l: "<dd>$1</dd>",
+                  d_u: "<dd>$1</dd></dl><ul>",
+                  d_o: "<dd>$1</dd></dl><ol>",
+                  p_l: "<p>$1</p><dl>",
+                  u_l: "<li$2>$1</li></ul><dl>",
+                  o_l: "<li$2>$1</li></ol><dl>",
+                  uu_l: "<li$2>$1</li></ul></li></ul><dl>",
+                  uo_l: "<li$2>$1</li></ol></li></ul><dl>",
+                  ou_l: "<li$2>$1</li></ul></li></ol><dl>",
+                  oo_l: "<li$2>$1</li></ol></li></ol><dl>",
+                  d_p: "<dd>$1</dd></dl>",
+                  // -- table --
+                  p_t: "<p>$1</p><table>",
+                  p_r: "<p>$1</p></td></tr>",
+                  p_c: "<p>$1</p></td>",
+                  t_p: "</table><p>$1</p>",
+                  r_r: "<tr><td>$1</td></tr>",
+                  r_p: "<tr><td><p>$1</p>",
+                  r_c: "<tr><td>$1</td>",
+                  r_u: "<tr><td>$1<ul>",
+                  c_p: "<td><p>$1</p>",
+                  c_r: "<td>$1</td></tr>",
+                  c_c: "<td>$1</td>",
+//                  c_u: "<td>$1<ul>",
+                  u_t: "<li$2>$1</li></ul><table>",
+                  o_t: "<li$2>$1</li></ol><table>",
+                  d_t: "<dd>$1</dd></dl><table>",
+                  t_u: "</table><p>$1</p><ul>",
+                  t_o: "</table><p>$1</p><ol>",
+                  t_l: "</table><p>$1</p><dl>"
+      };
+      var type = { "0": "decimal-leading-zero",
+                   "1": "decimal",
+                   "a": "lower-alpha",
+                   "A": "upper-alpha",
+                   "i": "lower-roman",
+                   "I": "upper-roman",
+                   "g": "lower-greek" };
+
+      var from = "", to = "", maxlen = Math.max(fromLevel.length, toLevel.length), sync = true, sectiontype = type[toLevel.charAt(toLevel.length-1)], transition;
+
+      for (var i=0; i<maxlen; i++)
+         if (fromLevel.charAt(i+1) != toLevel.charAt(i+1) || !sync || i == maxlen-1)
+         {
+            from += fromLevel.charAt(i) == undefined ? " " : fromLevel.charAt(i);
+            to += toLevel.charAt(i) == undefined ? " " : toLevel.charAt(i);
+            sync = false;
+         }
+      transition = (from + "_" + to).replace(/([01AIagi])/g, "o");
+      return !trf[transition] ? ("?(" +  transition + ")")  // error string !
+                              : trf[transition].replace(/\$2/, " class=\"" + fromLevel + "\"")
+                                               .replace(/\$3/, !sectiontype ? "" : (" style=\"list-style-type:" + sectiontype + ";\""))
+                                               .replace(/\$1/, content)
+                                               .replace(/<p><\/p>/, "");
+   }
+}
diff --git a/unmaintained/furnace-onigiri/resources/wiky/wiky.lang.css b/unmaintained/furnace-onigiri/resources/wiky/wiky.lang.css
new file mode 100644 (file)
index 0000000..0d61d75
--- /dev/null
@@ -0,0 +1,9 @@
+pre.syntax { font-size:100%; background: #eed; border:1px dotted #999; padding:0 0.5em; overflow:auto; }\r
+span.cmt { font-style: italic; color: green; }\r
+span.str { font-style: italic; color: darkred; }\r
+span.kwd { color: blue; }\r
+span.obj  { color: purple; }\r
+span.mbr  { color: gray; }\r
+span.xtag { color: blue; }\r
+span.xnam { color: purple; }\r
+span.xval { font-style: italic; color: darkred; }\r
diff --git a/unmaintained/furnace-onigiri/resources/wiky/wiky.lang.js b/unmaintained/furnace-onigiri/resources/wiky/wiky.lang.js
new file mode 100644 (file)
index 0000000..dd53e83
--- /dev/null
@@ -0,0 +1,40 @@
+/*     This work is licensed under Creative Commons GNU LGPL License.\r
+\r
+       License: http://creativecommons.org/licenses/LGPL/2.1/\r
+\r
+       Author:  Stefan Goessner/2005-06\r
+       Web:     http://goessner.net/\r
+\r
+   credits: http://www.regular-expressions.info/examplesprogrammer.html\r
+*/\r
+Wiky.rules.lang.js = [\r
+      "Wiky.rules.code",\r
+      { rex:/"([^"\\\xB6]*(\\.[^"\\\xB6]*)*)"/g, tmplt:function($0,$1){return Wiky.store("<span class=\"str\">\""+$1+"\"</span>");}}, // string delimited by '"' with '\"' allowed ..\r
+      { rex:/'([^'\\\xB6]*(\\.[^'\\\xB6]*)*)'/g, tmplt:function($0,$1){return Wiky.store("<span class=\"str\">\'"+$1+"\'</span>");}}, // string delimited by "'" with "\'" allowed ..\r
+      { rex:/\/\/(.*?)(?:\xB6|$)/g, tmplt:function($0,$1){return Wiky.store("<span class\=\"cmt\">//"+$1+"</span>\xB6");}}, // single line comment\r
+      { rex:/\/\*(.*?)\*\//g, tmplt:function($0,$1){return Wiky.store("<span class\=\"cmt\">\/*"+$1+"*\/</span>");}}, // multi-line comment\r
+//       { rex:/([\]\[\-+\|*!%<>=\{\}?:,\)\(]+)|(&#34;|&#47;|&#61;)+/g, tmplt:"<span class=\"op\">$1</span>"}, // operators\r
+      { rex:/\b(break|case|catch|continue|do|else|false|for|function|if|in|new|return|switch|this|throw|true|try|var|while|with)\b/g, tmplt:"<span class=\"kwd\">$1</span>" }, // keywords\r
+      { rex:/\b(arguments|Array|Boolean|Date|Error|Function|Global|Math|Number|Object|RegExp|String)\b/g, tmplt:"<span class=\"obj\">$1</span>" }, // objects\r
+      { rex:/\.(abs|acos|anchor|arguments|asin|atan|atan2|big|blink|bold|callee|caller|ceil|charAt|charCodeAt|concat|constructor|cos|E|escape|eval|exp|fixed|floor|fontcolor|fontsize|fromCharCode|getDate|getDay|getFullYear|getHours|getMilliseconds|getMinutes|getMonth|getSeconds|getTime|getTimezoneOffset|getUTCDate|getUTCDay|getUTCFullYear|getUTCHours|getUTCMilliseconds|getUTCMinutes|getUTCMonth|getUTCSeconds|getVarDate|getYear|index|indexOf|Infinity|input|isFinite|isNaN|italics|join|lastIndex|lastIndexOf|lastMatch|lastParen|leftContext|length|link|LN10|LN2|log|LOG10E|LOG2E|match|max|MAX_VALUE|min|MIN_VALUE|NaN|NaN|NEGATIVE_INFINITY|parse|parseFloat|parseInt|PI|pop|POSITIVE_INFINITY|pow|prototype|push|random|replace|reverse|rightContext|round|search|setDate|setFullYear|setHours|setMilliseconds|setMinutes|setMonth|setSeconds|setTime|setUTCDate|setUTCFullYear|setUTCHours|setUTCMilliseconds|setUTCMinutes|setUTCMonth|setUTCSeconds|setYear|shift|sin|slice|slice|small|sort|splice|split|sqrt|SQRT1_2|SQRT2|strike|sub|substr|substring|sup|tan|toGMTString|toLocaleString|toLowerCase|toString|toUpperCase|toUTCString|unescape|unshift|UTC|valueOf)\b/g, tmplt:".<span class=\"mbr\">$1</span>" }, // members\r
+];\r
+Wiky.rules.lang.xml = [\r
+      { rex:/<script([^>]*)>(.*?)<\/script>/g, tmplt:function($0,$1,$2){return "<script"+$1+">"+Wiky.store(Wiky.apply($2, Wiky.rules.lang.js))+"</script>";} }, // script blocks ..\r
+      { rex:/<!\[CDATA\[(.*?)\]\]>/g, tmplt:function($0,$1){return Wiky.store("&lt;![CDATA["+$1+"]]&gt;");} }, // CDATA sections, ..\r
+      { rex:/<!(.*?)>/g, tmplt:function($0,$1){return Wiky.store("<span class=\"cmt\">&lt;!"+$1+"&gt;</span>");} }, // inline xml comments, doctypes, ..\r
+      { rex:/</g, tmplt:"\xAB"}, // replace '<' by '«'\r
+      { rex:/>/g, tmplt:"\xBB"}, // replace '>' by '»'\r
+      { rex:/([-A-Za-z0-9_:]+)[ ]*=[ ]*\"(.*?)\"/g, tmplt:"<span class=\"xnam\">$1</span>=<span class=\"xval\">&quot;$2&quot;</span>"}, // "xml attribute value strings ..\r
+      { rex:/(\xAB[\/]?)([-A-Za-z0-9_:]+)/g, tmplt:"$1<span class=\"xtag\">$2</span>"}, // "xml tag ..\r
+      { rex:/\xAB/g, tmplt:"&lt;"}, // replace '«' by '<'\r
+      { rex:/\xBB/g, tmplt:"&gt;"}, // replace '»' by '>'\r
+];\r
+Wiky.inverse.lang.js = [\r
+     { rex:/<span class=\"?(cmt|kwd|mbr|obj|str)\"?>|<\/span>/mgi, tmplt:"" },\r
+     { rex:/<strong>(.*?)<\/strong>/mgi, tmplt:"[*$1*]" },\r
+      "Wiky.inverse.code"\r
+];\r
+Wiky.inverse.lang.xml = [\r
+     { rex:/<span class=\"?(cmt|xtag|xnam|xval)\"?>|<\/span>/mgi, tmplt:"" },\r
+     "Wiky.inverse.lang.js"\r
+];\r
diff --git a/unmaintained/furnace-onigiri/resources/wiky/wiky.math.css b/unmaintained/furnace-onigiri/resources/wiky/wiky.math.css
new file mode 100644 (file)
index 0000000..de2a6f5
--- /dev/null
@@ -0,0 +1,88 @@
+/* math */\r
+dfn, div.eq {\r
+  white-space: nowrap;\r
+  font-family: sans-serif;\r
+  font-style: normal;\r
+  color: navy;\r
+}\r
+div.eq {\r
+   margin-left: 3em;\r
+   margin-right: 1em;\r
+}\r
+div.eq a {float:right}\r
+\r
+span.h {  /* huge */\r
+  font-size:150%; \r
+}\r
+\r
+span.o, span.s, span.f {\r
+  display:-moz-inline-box;\r
+  -moz-box-orient:vertical;\r
+  display:inline-block; \r
+  vertical-align:middle; \r
+  margin:0 0.2em;\r
+}\r
+\r
+span.x, span.i, span.d, span.n, span.o span {\r
+  display: block;\r
+}\r
+\r
+span.x, span.d, span.n, span.s, span.o span {\r
+  text-align:center;\r
+  margin:0 0.2em;\r
+}\r
+\r
+span.n, span.d {\r
+  font-size: 90%;\r
+}\r
+\r
+span.i {\r
+  text-align: left;\r
+  margin:0 0.2em 0 0;\r
+}\r
+span.b {\r
+  font-weight: bold;\r
+}\r
+\r
+span.x, span.i, span.f span.f {\r
+  font-size: 80%;\r
+}\r
+\r
+span.n {\r
+  border-bottom:solid 1px navy;\r
+}\r
+\r
+span.v, span.m {\r
+  display:-moz-inline-box;\r
+  -moz-box-orient:vertical;\r
+  display:inline-block;\r
+  vertical-align:middle; \r
+}\r
+span.v span.e, span.m span.e {\r
+  font-size: 90%;\r
+  white-space:nowrap;\r
+  display: block;\r
+  text-align:center;\r
+  margin:0.2em;\r
+}\r
+/*span.m > span.e { height:2em; }*/ /* hide ie 6 */\r
+\r
+span.lb, span.rb {\r
+  margin:0; \r
+  padding:0; \r
+  vertical-align: middle; \r
+  border-top:1px solid navy; \r
+  border-bottom:1px solid navy;\r
+}\r
+span.lb {\r
+  border-left:1px solid navy; \r
+}\r
+span.rb {\r
+  border-right:1px solid navy; \r
+}\r
+span.lbrk2, span.rbrk2 {\r
+  font-size:200%; \r
+}\r
+span.lbrk3, span.rbrk3 {\r
+  font-size:300%; \r
+}\r
diff --git a/unmaintained/furnace-onigiri/resources/wiky/wiky.math.js b/unmaintained/furnace-onigiri/resources/wiky/wiky.math.js
new file mode 100644 (file)
index 0000000..26cf41e
--- /dev/null
@@ -0,0 +1,374 @@
+/*     This work is licensed under Creative Commons GNU LGPL License.
+
+       License: http://creativecommons.org/licenses/LGPL/2.1/
+
+       Author:  Stefan Goessner/2005-06
+       Web:     http://goessner.net/ 
+   inspired by: http://xml-maiden.com/
+*/
+Wiky.rules.math = {
+   version: 0.95,
+   preshortcuts: [
+//      { rex:/[ ]/g, tmplt:"`"},   // omit due to charset support ie6
+      { rex:/\+\-/g, tmplt:"&#177;"},
+      { rex:/\/O|\\Oslash/g, tmplt:"&#216;"},
+      { rex:/\/o|\\oslash/g, tmplt:"&#248;"},
+      { rex:/<->|\\harr/g, tmplt:"&#8596;"},
+      { rex:/<-|\\larr/g, tmplt:"&#8592;"},
+      { rex:/->|\\rarr/g, tmplt:"&#8594;"},
+      { rex:/<=>|\\hArr/g, tmplt:"&#8660;"},
+      { rex:/=>|\\rArr/g, tmplt:"&#8658;"},
+      { rex:/-=|\\equiv/g, tmplt:"&#8801;"},
+      { rex:/<=|\\le/g, tmplt:"&#8804;"},
+      { rex:/>=|\\ge/g, tmplt:"&#8805;"},
+      { rex:/</g, tmplt:"&lt;"},
+      { rex:/>/g, tmplt:"&gt;"}
+   ],
+   postshortcuts: [
+      { rex:/\*|\\middot/g, tmplt:"&#183;"},
+      { rex:/\\x|\\times/g, tmplt:"&#215;"},
+      { rex:/~=|\\cong/g, tmplt:"&#8773;"},
+      { rex:/~~|\\asymp/g, tmplt:"&#8776;"},
+      { rex:/~|\\sim/g, tmplt:"&#8764;"},
+      { rex:/!=|\\neq|\\ne/g, tmplt:"&#8800;"},
+      { rex:/\.\.\.|\\ldots/g, tmplt:"&#8230;"},
+      { rex:/\\in|\\isin/g, tmplt:"&#8712;"},
+      { rex:/([0-9])x([0-9])/g, tmplt:"$1&#215;$2"}, 
+      { rex:/([A-Za-z]) x ([A-Za-z])/g, tmplt:"$1&#215;$2"},
+//      { rex:/[`]{4}/g, tmplt:"&#8195;"},  // omit due to charset support ie6
+//      { rex:/[`]{3}/g, tmplt:"&#8194;"},
+//      { rex:/[`]{2}/g, tmplt:"  "},
+//      { rex:/[`]/g, tmplt:"&#8201;"},
+      { rex:/\{/g, tmplt:"&#8206;"},  // unvisible left-to-right mark,
+      { rex:/\}/g, tmplt:"&#8207;"}   // unvisible right-to-left mark,
+   ],
+   expr: [
+      { rex:/\^\^/g, tmplt:"^&#94;"},  // ^ overindex
+      { rex:/(\\sum|\\prod|\\int)_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"o\"><span class=\"x\">$3</span>$1<span class=\"x\">$2</span></span>"}, // over-/underscript (\sum, \prod, \int)
+      { rex:/(\\sum|\\prod|\\int)\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"o\"><span class=\"x\">$2</span>$1<span>&#160;</span></span>"},
+      { rex:/(\\sum|\\prod|\\int)_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"o\"><span>&#160;</span>$1<span class=\"x\">$2</span></span>"},
+      { rex:/_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"s\"><span class=\"i\">$2</span><span class=\"i\">$1</span></span>"}, // over-/underindex
+      { rex:/\^([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<sup class=\"i\">$1</sup>"}, // overindex
+      { rex:/_([-]?[a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<sub class=\"i\">$1</sub>"}, // underindex
+      { rex:/-/g, tmplt:"&#8722;"},
+      { rex:/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<span class=\"f\"><span class=\"n\">$1</span><span class=\"d\">$2</span></span>"},  // fraction
+      { rex:/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})\/\/([a-zA-Z0-9\.&;#\\]+|\{@[0-9]+@\})/g, tmplt:"<sup>$1</sup>&#8260;<sub>$2</sub>"}, // fraction 
+      { rex:/\[((\[(([^,\]]+[,]){1,}[^\]]+)\][ \n]*){1,})\]/g, tmplt:function($0,$1){var m=Wiky.math.transpose($1.replace(/(^\[|\]$)/g,"").replace(/(\][ \n]*\[)/g,"|").split("|")),sz=" style=\"font-size:"+(m.len)+"00%;\"";/*alert("{("+m.mat.join(")}\n{(").split(",").join(")(")+")}");*/ return "<span class=\"lb\""+sz+">"+Wiky.math.fence()+"</span><span class=\"m\"><span class=\"e\">"+m.mat.join("</span></span>\n<span class=\"m\"><span class=\"e\">").split(",").join("</span><span class=\"e\">")+"</span></span><span class=\"rb\""+sz+">"+Wiky.math.fence()+"</span>";}}, // matrix
+      { rex:/\[((?:[^,\]]){1,}[^\]]+)\]/g, tmplt:function($0,$1){var v=$1.split(","),sz=" style=\"font-size:"+v.length+"00%;\""; return "<span class=\"lb\""+sz+">"+Wiky.math.fence()+"</span><span class=\"v\"><span class=\"e\">"+v.join("</span><span class=\"e\">")+"</span></span><span class=\"rb\""+sz+">"+Wiky.math.fence()+"</span>";}}, // vector
+      { rex:/!([a-zA-Z0-9\.&;]+)/g, tmplt:"<span class=\"b\">$1</span>" }, // bold vector symbol ..
+      { rex:/\\prod/g, tmplt:"<span class=\"h\">&#8719;</span>"},
+      { rex:/\\sum/g, tmplt:"<span class=\"h\">&#8721;</span>"},
+      { rex:/\\int/g, tmplt:"<span class=\"h\">&#8747;</span>"},
+      "Wiky.rules.math.postshortcuts"
+   ],
+   symbols: [
+      { rex:/\\Alpha/g, tmplt:"&#913;"},
+      { rex:/\\Beta/g, tmplt:"&#914;"},
+      { rex:/\\Gamma/g, tmplt:"&#915;"},
+      { rex:/\\Delta/g, tmplt:"&#916;"},
+      { rex:/\\Epsilon/g, tmplt:"&#917;"},
+      { rex:/\\Zeta/g, tmplt:"&#918;"},
+      { rex:/\\Eta/g, tmplt:"&#919;"},
+      { rex:/\\Theta/g, tmplt:"&#920;"},
+      { rex:/\\Iota/g, tmplt:"&#921;"},
+      { rex:/\\Kappa/g, tmplt:"&#922;"},
+      { rex:/\\Lambda/g, tmplt:"&#923;"},
+      { rex:/\\Mu/g, tmplt:"&#924;"},
+      { rex:/\\Nu/g, tmplt:"&#925;"},
+      { rex:/\\Xi/g, tmplt:"&#926;"},
+      { rex:/\\Omicron/g, tmplt:"&#927;"},
+      { rex:/\\Pi/g, tmplt:"&#928;"},
+      { rex:/\\Rho/g, tmplt:"&#929;"},
+      { rex:/\\Sigma/g, tmplt:"&#931;"},
+      { rex:/\\Tau/g, tmplt:"&#932;"},
+      { rex:/\\Upsilon/g, tmplt:"&#933;"},
+      { rex:/\\Phi/g, tmplt:"&#934;"},
+      { rex:/\\Chi/g, tmplt:"&#935;"},
+      { rex:/\\Psi/g, tmplt:"&#936;"},
+      { rex:/\\Omega/g, tmplt:"&#937;"},
+      { rex:/\\alpha/g, tmplt:"&#945;"},
+      { rex:/\\beta/g, tmplt:"&#946;"},
+      { rex:/\\gamma/g, tmplt:"&#947;"},
+      { rex:/\\delta/g, tmplt:"&#948;"},
+      { rex:/\\epsilon/g, tmplt:"&#949;"},
+      { rex:/\\zeta/g, tmplt:"&#950;"},
+      { rex:/\\eta/g, tmplt:"&#951;"},
+      { rex:/\\thetasym/g, tmplt:"&#977;"},
+      { rex:/\\theta/g, tmplt:"&#952;"},
+      { rex:/\\iota/g, tmplt:"&#953;"},
+      { rex:/\\kappa/g, tmplt:"&#954;"},
+      { rex:/\\lambda/g, tmplt:"&#955;"},
+      { rex:/\\mu/g, tmplt:"&#956;"},
+      { rex:/\\nu/g, tmplt:"&#957;"},
+      { rex:/\\xi/g, tmplt:"&#958;"},
+      { rex:/\\omicron/g, tmplt:"&#959;"},
+      { rex:/\\piv/g, tmplt:"&#982;"},
+      { rex:/\\pi/g, tmplt:"&#960;"},
+      { rex:/\\rho/g, tmplt:"&#961;"},
+      { rex:/\\sigmaf/g, tmplt:"&#962;"},
+      { rex:/\\sigma/g, tmplt:"&#963;"},
+      { rex:/\\tau/g, tmplt:"&#964;"},
+      { rex:/\\upsilon/g, tmplt:"&#965;"},
+      { rex:/\\phi/g, tmplt:"&#966;"},
+      { rex:/\\chi/g, tmplt:"&#967;"},
+      { rex:/\\psi/g, tmplt:"&#968;"},
+      { rex:/\\omega/g, tmplt:"&#969;"},
+      { rex:/\\upsih/g, tmplt:"&#978;"},
+      // miscellaneous symbols
+      { rex:/\\bull/g, tmplt:"&#8226;"},
+      { rex:/\\uarr/g, tmplt:"&#8593;"},
+      { rex:/\\darr/g, tmplt:"&#8595;"},
+      { rex:/\\crarr/g, tmplt:"&#8629;"},
+      { rex:/\\lArr/g, tmplt:"&#8656;"},
+      { rex:/\\uArr/g, tmplt:"&#8657;"},
+      { rex:/\\dArr/g, tmplt:"&#8659;"},
+      { rex:/\\forall/g, tmplt:"&#8704;"},
+      { rex:/\\part/g, tmplt:"&#8706;"},
+      { rex:/\\exist/g, tmplt:"&#8707;"},
+      { rex:/\\empty/g, tmplt:"&#8709;"},
+      { rex:/\\nabla/g, tmplt:"&#8711;"},
+      { rex:/\\notin/g, tmplt:"&#8713;"},
+      { rex:/\\ni/g, tmplt:"&#8715;"},
+      { rex:/\\minus/g, tmplt:"&#8722;"},
+      { rex:/\\lowast/g, tmplt:"&#8727;"},
+      { rex:/\\sqrt|\\radic/g, tmplt:"&#8730;"},
+      { rex:/\\prop/g, tmplt:"&#8733;"},
+      { rex:/\\infin/g, tmplt:"&#8734;"},
+      { rex:/\\ang/g, tmplt:"&#8736;"},
+      { rex:/\\and/g, tmplt:"&#8743;"},
+      { rex:/\\or/g, tmplt:"&#8744;"},
+      { rex:/\\cap/g, tmplt:"&#8745;"},
+      { rex:/\\cup/g, tmplt:"&#8746;"},
+      { rex:/\\there4/g, tmplt:"&#8756;"},
+      { rex:/\\sub/g, tmplt:"&#8834;"},
+      { rex:/\\sup/g, tmplt:"&#8835;"},
+      { rex:/\\nsub/g, tmplt:"&#8836;"},
+      { rex:/\\sube/g, tmplt:"&#8838;"},
+      { rex:/\\supe/g, tmplt:"&#8839;"},
+      { rex:/\\oplus/g, tmplt:"&#8853;"},
+      { rex:/\\otimes/g, tmplt:"&#8855;"},
+      { rex:/\\perp/g, tmplt:"&#8869;"},
+      { rex:/\\sdot/g, tmplt:"&#8901;"}
+   ]
+};
+
+Wiky.inverse.math = {
+   pre: [
+      { rex:/&#8722;|\u2212/g, tmplt:"-"},
+      { rex:/&#8201;|\u2009/g, tmplt:"&#8201;"},
+      { rex:/&#8206;|\u200E/g, tmplt:"{"},
+      { rex:/&#8207;|\u200F/g, tmplt:"}"}
+   ],
+   post: [
+//      { rex:/([$])/g, tmplt:"\\$1" },
+      { rex:/&#94;|\x5E/g, tmplt:"^"},
+      { rex:/&lt;/g, tmplt:"<"},
+      { rex:/&gt;/g, tmplt:">"}
+   ],
+   shortcuts: [
+//      { rex:/&#8195;|\u2003/g, tmplt:"    "}, // omit due to charset support ie6
+//      { rex:/&#8194;|\u2002/g, tmplt:"   "},
+//      { rex:/&#8201;|\u2009/g, tmplt:" "},
+      { rex:/&#177;|\xB1/g, tmplt:"+-"},
+      { rex:/&#183;|\xB7/g, tmplt:"*"},
+      { rex:/&#215;|\xD7/g, tmplt:"\\x"},
+      { rex:/&#216;|\xD8/g, tmplt:"/O"},
+      { rex:/&#248;|\xF8/g, tmplt:"/o"},
+      { rex:/&#8592;|\u2190/g, tmplt:"&lt;-"},
+      { rex:/&#8594;|\u2192/g, tmplt:"-&gt;"},
+      { rex:/&#8596;|\u2194/g, tmplt:"&lt;-&gt;"},
+      { rex:/&#8658;|\u21D2/g, tmplt:"=&gt;"},
+      { rex:/&#8660;|\u21D4/g, tmplt:"&lt;=&gt;"},
+      { rex:/&#8764;|\u223C/g, tmplt:"~"},
+      { rex:/&#8773;|\u2245/g, tmplt:"~="},
+      { rex:/&#8776;|\u2248/g, tmplt:"~~"},
+      { rex:/&#8800;|\u2260/g, tmplt:"!="},
+      { rex:/&#8230;/g, tmplt:"..."},
+      { rex:/&#8801;|\u2261/g, tmplt:"-="},
+      { rex:/&#8804;|\u2264/g, tmplt:"&lt;="},
+      { rex:/&#8805;|\u2265/g, tmplt:"&gt;="}
+   ],
+   expr: [
+      { rex:/<span class=\"s\"><span class=\"i\">(\{?@[0-9]+@\}?)<\/span><span class="i">(\{?@[0-9]+@\}?)<\/span><\/span>/g, tmplt:"_$2^$1"}, // superscript + subscript
+      { rex:/<span class=\"o\"><span class=\"x\">(\{?@[0-9]+@\}?)<\/span>(\\prod|\\sum|\\int)<span class=\"x\">(\{?@[0-9]+@\}?)<\/span><\/span>/g, tmplt:"$2_$3^$1"},  // overscript + underscript
+      { rex:/<span class=\"o\"><span>@[0-9]+@<\/span>(\\prod|\\sum|\\int)<span class=\"x\">(\{?@[0-9]+@\}?)<\/span><\/span>/mgi, tmplt:"$1_$2", dbg:true},  // underscript
+      { rex:/<span class=\"o\"><span class=\"x\">(\{?@[0-9]+@\}?)<\/span>(\\prod|\\sum|\\int)<span>@[0-9]+@<\/span><\/span>/mgi, tmplt:"$2^$1"},  // overscript
+      { rex:/<span class=\"f\"><span class=\"n\">(\{?@[0-9]+@\}?)<\/span><span class="d">(\{?@[0-9]+@\}?)<\/span><\/span>/mgi, tmplt:"$1/$2"},  // fraction
+      { rex:/<span class=\"lb\"[^>]*>&[^;]+;<\/span><span class=\"v\">((?:<span class=\"e\">[^>]*<\/span>){2,})<\/span><span class=\"rb\"[^>]*>&[^;]+;<\/span>/mgi, tmplt:function($0,$1){return "["+$1.replace(/(?:^<span class=\"e\">|<\/span>$)/g,"").replace(/<\/span><span class=\"e\">/g,",")+"]";}}, // vector ..
+      { rex:/<span class=\"lb\"[^>]*>&[^;]+;<\/span>((?:<span class=\"m\">(?:(?:<span class=\"e\">[^>]*<\/span>){2,})<\/span>[^>]*){2,})<span class=\"rb\"[^>]*>&[^;]+;<\/span>/mgi, tmplt:function($0,$1){return "[["+Wiky.math.transpose($1.replace(/(?:^<span class=\"m\"><span class=\"e\">|<\/span><\/span>$)/g,"").replace(/<\/span><span class=\"e\">/g,",").replace(/<\/span><\/span>[^>]*<span class=\"m\"><span class=\"e\">/g,"|").split("|")).mat.join("][")+"]]";}}, // matrix ..
+      { rex:/<span class=\"b\">(@[0-9]+@)<\/span>/mgi, tmplt:"!$1"}, // bold vector ..
+      { rex:/<sup>(\{?@[0-9]+@\}?)<\/sup>&#8260;<sub>(\{?@[0-9]+@\}?)<\/sub>/mgi, tmplt:"$1//$2"},
+      { rex:/<sup class=\"i\">(\{?@[0-9]+@\}?)<\/sup>/mgi, tmplt:"^$1" }, 
+      { rex:/<sub class=\"i\">(\{?@[0-9]+@\}?)<\/sub>/mgi, tmplt:"_$1" }
+   ],
+   symbols: [
+      // greek symbols
+      { rex:/&#913;|\u391/g, tmplt:"\\Alpha"},
+      { rex:/&#914;|\u392/g, tmplt:"\\Beta"},
+      { rex:/&#915;|\u393/g, tmplt:"\\Gamma"},
+      { rex:/&#916;|\u394/g, tmplt:"\\Delta"},
+      { rex:/&#917;|\u395/g, tmplt:"\\Epsilon"},
+      { rex:/&#918;|\u396/g, tmplt:"\\Zeta"},
+      { rex:/&#919;|\u397/g, tmplt:"\\Eta"},
+      { rex:/&#920;|\u398/g, tmplt:"\\Theta"},
+      { rex:/&#921;|\u399/g, tmplt:"\\Iota"},
+      { rex:/&#922;|\u39A/g, tmplt:"\\Kappa"},
+      { rex:/&#923;|\u39B/g, tmplt:"\\Lambda"},
+      { rex:/&#924;|\u39C/g, tmplt:"\\Mu"},
+      { rex:/&#925;|\u39D/g, tmplt:"\\Nu"},
+      { rex:/&#926;|\u39E/g, tmplt:"\\Xi"},
+      { rex:/&#927;|\u39F/g, tmplt:"\\Omicron"},
+      { rex:/&#928;|\u3A0/g, tmplt:"\\Pi"},
+      { rex:/&#929;|\u3A1/g, tmplt:"\\Rho"},
+      { rex:/&#931;|\u3A3/g, tmplt:"\\Sigma"},
+      { rex:/&#932;|\u3A4/g, tmplt:"\\Tau"},
+      { rex:/&#933;|\u3A5/g, tmplt:"\\Upsilon"},
+      { rex:/&#934;|\u3A6/g, tmplt:"\\Phi"},
+      { rex:/&#935;|\u3A7/g, tmplt:"\\Chi"},
+      { rex:/&#936;|\u3A8/g, tmplt:"\\Psi"},
+      { rex:/&#937;|\u3A9/g, tmplt:"\\Omega"},
+      { rex:/&#945;|\u3B1/g, tmplt:"\\alpha"},
+      { rex:/&#946;|\u3B2/g, tmplt:"\\beta"},
+      { rex:/&#947;|\u3B3/g, tmplt:"\\gamma"},
+      { rex:/&#948;|\u3B4/g, tmplt:"\\delta"},
+      { rex:/&#949;|\u3B5/g, tmplt:"\\epsilon"},
+      { rex:/&#950;|\u3B6/g, tmplt:"\\zeta"},
+      { rex:/&#951;|\u3B7/g, tmplt:"\\eta"},
+      { rex:/&#977;|\u3D1/g, tmplt:"\\thetasym"},
+      { rex:/&#952;|\u3B8/g, tmplt:"\\theta"},
+      { rex:/&#953;|\u3B9/g, tmplt:"\\iota"},
+      { rex:/&#954;|\u3BA/g, tmplt:"\\kappa"},
+      { rex:/&#955;|\u3BB/g, tmplt:"\\lambda"},
+      { rex:/&#956;|\u3BC/g, tmplt:"\\mu"},
+      { rex:/&#957;|\u3BD/g, tmplt:"\\nu"},
+      { rex:/&#958;|\u3BE/g, tmplt:"\\xi"},
+      { rex:/&#959;|\u3BF/g, tmplt:"\\omicron"},
+      { rex:/&#960;|\u3C0/g, tmplt:"\\pi"},
+      { rex:/&#961;|\u3C1/g, tmplt:"\\rho"},
+      { rex:/&#962;|\u3C2/g, tmplt:"\\sigmaf"},
+      { rex:/&#963;|\u3C3/g, tmplt:"\\sigma"},
+      { rex:/&#964;|\u3C4/g, tmplt:"\\tau"},
+      { rex:/&#965;|\u3C5/g, tmplt:"\\upsilon"},
+      { rex:/&#966;|\u3C6/g, tmplt:"\\phi"},
+      { rex:/&#967;|\u3C7/g, tmplt:"\\chi"},
+      { rex:/&#968;|\u3C8/g, tmplt:"\\psi"},
+      { rex:/&#969;|\u3C9/g, tmplt:"\\omega"},
+      // miscellaneous symbols
+      { rex:/&#978;|\u3D2/g, tmplt:"\\upsih"},
+      { rex:/&#982;|\u3D6/g, tmplt:"\\piv"},
+      { rex:/&#8226;|\u2022/g, tmplt:"\\bull"},
+      { rex:/&#8593;|\u2191/g, tmplt:"\\uarr"},
+      { rex:/&#8595;|\u2193/g, tmplt:"\\darr"},
+      { rex:/&#8629;|\u21B5/g, tmplt:"\\crarr"},
+      { rex:/&#8656;|\u21D0/g, tmplt:"\\lArr"},
+      { rex:/&#8657;|\u21D1/g, tmplt:"\\uArr"},
+      { rex:/&#8659;|\u21D3/g, tmplt:"\\dArr"},
+      { rex:/&#8704;|\u2200/g, tmplt:"\\forall"},
+      { rex:/&#8706;|\u2202/g, tmplt:"\\part"},
+      { rex:/&#8707;|\u2203/g, tmplt:"\\exist"},
+      { rex:/&#8709;|\u2205/g, tmplt:"\\empty"},
+      { rex:/&#8711;|\u2207/g, tmplt:"\\nabla"},
+      { rex:/&#8712;|\u2208/g, tmplt:"\\isin"},
+      { rex:/&#8713;|\u2209/g, tmplt:"\\notin"},
+      { rex:/&#8715;|\u220B/g, tmplt:"\\ni"},
+      { rex:/<span class=\"h\">(&#8719;|\u220F)<\/span>/g, tmplt:"\\prod"},
+      { rex:/<span class=\"h\">(&#8721;|\u2211)<\/span>/g, tmplt:"\\sum"},
+      { rex:/&#8727;|\u2217/g, tmplt:"\\lowast"},
+      { rex:/&#8730;|\u221A/g, tmplt:"\\sqrt"},
+      { rex:/&#8733;|\u221D/g, tmplt:"\\prop"},
+      { rex:/&#8734;|\u221E/g, tmplt:"\\infin"},
+      { rex:/&#8736;|\u2220/g, tmplt:"\\ang"},
+      { rex:/&#8743;|\u2227/g, tmplt:"\\and"},
+      { rex:/&#8744;|\u2228/g, tmplt:"\\or"},
+      { rex:/&#8745;|\u2229/g, tmplt:"\\cap"},
+      { rex:/&#8746;|\u222A/g, tmplt:"\\cup"},
+      { rex:/<span class=\"h\">(?:&#8747;|\u222B)<\/span>/g, tmplt:"\\int"},
+      { rex:/&#8756;|\u2234/g, tmplt:"\\there4"},
+      { rex:/&#8834;|\u2282/g, tmplt:"\\sub"},
+      { rex:/&#8835;|\u2283/g, tmplt:"\\sup"},
+      { rex:/&#8836;|\u2284/g, tmplt:"\\nsub"},
+      { rex:/&#8838;|\u2286/g, tmplt:"\\sube"},
+      { rex:/&#8839;|\u2287/g, tmplt:"\\supe"},
+      { rex:/&#8853;|\u2295/g, tmplt:"\\oplus"},
+      { rex:/&#8855;|\u2297/g, tmplt:"\\otimes"},
+      { rex:/&#8869;|\u22A5/g, tmplt:"\\perp"},
+      { rex:/&#8901;|\u22C5/g, tmplt:"\\sdot"}
+   ]
+};
+
+Wiky.math = {
+   toHtml: function(str) {
+      var expr = function(itr) {  // region from "{" to "}", nesting allowed ..
+         var s = "";
+         for (var c = itr.str.charAt(itr.pos++); itr.pos <= itr.str.length && c != "}"; c = itr.str.charAt(itr.pos++))
+            s += (c == "{") ? ("{"+expr(itr)+"}") : c;
+         return Wiky.store(Wiky.apply(s, Wiky.rules.math.expr));
+      };
+      str = Wiky.apply(str, Wiky.rules.math.preshortcuts);
+      str = Wiky.apply(str, Wiky.rules.math.symbols);
+      str = expr({str:str,pos:0});
+      return str;
+   },
+   toWiki: function(str) {
+      var parseTree = function(itr, endtag) {
+         var c, s="",gt,nam,idxof=function(s,c,p){var i=s.indexOf(c,p);return i>=0?i:s.length;}
+         for (itr.buf=itr.str.substr(itr.pos,endtag.length); 
+              itr.pos<itr.str.length && (!endtag || itr.buf!=endtag); 
+              itr.buf=itr.str.substr(++itr.pos,endtag.length)) {
+            if ((c=itr.str.charAt(itr.pos))=="<" && (gt=idxof(itr.str,">",itr.pos)) < idxof(itr.str,"/",itr.pos)) { // start tags .. no empty elements or endtags ..
+               nam = itr.str.substring(itr.pos+1,Math.min(idxof(itr.str," ",itr.pos),gt));
+               s += itr.str.substring(itr.pos,itr.pos=gt+1) + parseTree(itr, "</" + nam + ">") + "</" + nam + ">";
+               itr.pos += nam.length+3;
+            }
+            else
+               s += c;
+         }
+         itr.pos--;
+         return Wiky.store(s, true);
+      };
+      str = Wiky.apply(str, Wiky.inverse.math.pre);
+      str = Wiky.apply(str, Wiky.inverse.math.symbols);
+      str = parseTree({str:str,pos:0,buf:null}, "");
+      while (str.match(/@[0-9]+@/g) != null)
+         str = Wiky.apply(str.replace(/@([0-9]+)@/g, function($0,$1){return Wiky.restore($1);}), Wiky.inverse.math.expr);
+      str = Wiky.apply(str, Wiky.inverse.math.shortcuts);
+      str = Wiky.apply(str, Wiky.inverse.math.post);
+      return str;
+   },
+   fence: function(str) {
+      return window && window.ActiveXObject ? "&#160;" : "&#8201;";
+   },
+   transpose: function (m) {
+      var t=[];
+      for (var i in m) {
+         m[i] = m[i].split(",");
+         for (var j in m[i]) {
+            if (!t[j]) t[j]=[];
+            t[j][i] = m[i][j];
+         }
+      }
+      for (var i in t)
+         t[i] = t[i].join(",");
+     return {mat:t, len:m.length};
+  }
+};
+
+Wiky.rules.pre = Wiky.rules.pre.concat({ rex:/\\([$])/g, tmplt:function($0,$1){return Wiky.store($1);} });
+Wiky.rules.nonwikiblocks = Wiky.rules.nonwikiblocks.concat(
+[
+    { rex:/\[\(([a-zA-Z0-9\.-]+)\)\$([^$]*)\$\]/g, tmplt:function($0,$1,$2){return ":p]<div class=\"eq\"><a name=\"eq"+$1+"\">("+$1+")</a>" + Wiky.math.toHtml($2) + "</div>[p:";} }, // numbered equation
+    { rex:/\[\$([^$]*)\$\]/g, tmplt:function($0,$1){return ":p]<div class=\"eq\">" + Wiky.math.toHtml($1) + "</div>[p:";} }, // equation
+]);
+Wiky.rules.nonwikiinlines = Wiky.rules.nonwikiinlines.concat(
+    { rex:/\$([^$]*)\$/g, tmplt:function($0,$1){return "<dfn>" + Wiky.math.toHtml($1) + "</dfn>";} } // inline equation
+);
+
+Wiky.inverse.pre = Wiky.inverse.pre.concat({ rex:/([\$])/g, tmplt:"\\$1" });
+Wiky.inverse.nonwikiblocks = Wiky.inverse.nonwikiblocks.concat(
+[
+    { rex:/<div class=\"eq\"><a name=\"eq([0-9]+)\">(?:.*?)<\/a>(.*?)<\/div>/g, tmplt:function($0,$1,$2){return Wiky.store("[("+$1+")$"+Wiky.math.toWiki($2)+"$]");} }, // numbered equation
+    { rex:/<div class=\"eq\">(.*?)<\/div>/g, tmplt:function($0,$1){return Wiky.store("[$"+Wiky.math.toWiki($1)+"$]");} }, // equation
+]);
+Wiky.inverse.nonwikiinlines = Wiky.inverse.nonwikiinlines.concat(
+    { rex:/<dfn>(.*?)<\/dfn>/g, tmplt:function($0,$1){return Wiky.store("$"+Wiky.math.toWiki($1)+"$");} } // inline equation
+);
diff --git a/unmaintained/furnace-onigiri/templates/atom.furnace b/unmaintained/furnace-onigiri/templates/atom.furnace
new file mode 100644 (file)
index 0000000..88bb89a
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+    <% USING: io namespaces furnace:onigiri html
+    math kernel sequences hashtables calendar ; %>
+    <title><% "title" key>meta* meta-value [ "an onigiri weblog" ] unless* write %></title>
+    <link rel="self" href="<% base-url write "atom" action>url write %>"/>
+    <author>
+        <name><% "author" key>meta* meta-value [ "anonymous" ] unless* write %></name>
+    </author>
+    <id><% base-url write "atom" action>url write %></id>
+    <% entry get 
+    [ [ entry-created ] 2apply compare-timestamps neg ] sort
+    dup empty? [ %>
+    <updated><% dup first entry-created timestamp>rfc3339 write %></updated><% ] unless
+    [ %>
+    <entry>
+        <title><% dup entry-title write %></title>
+        <id><% dup entry-stub stub>url dup base-url write write %></id>
+        <updated><% over entry-created timestamp>rfc3339 write %></updated>
+        <link href="<% base-url write write %>"/>
+        <summary><% entry-body write-html %></summary>
+    </entry><% ] each %>
+</feed>
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/templates/entry-edit-plain.furnace b/unmaintained/furnace-onigiri/templates/entry-edit-plain.furnace
new file mode 100644 (file)
index 0000000..78df2ed
--- /dev/null
@@ -0,0 +1,19 @@
+<% USING: namespaces io kernel sequences furnace:onigiri html 
+furnace ; %>
+
+<p><% "stub" get [ "true" entry-edit ] curry "Edit with Wiky" render-link %></p>
+
+<form method="post" action="entry-update">
+    <% "stub" get [ %><input type="hidden" name="stub" value="<% "stub" get write %>"/><% ] when %>
+    <table><tr><td>Title:</td><td><input type="text" name="title" value="<% "title" get write %>"/></td></tr>
+    <tr><td>Body:</td><td><textarea id="body" rows="10" cols="60" name="body" onKeyUp="$('preview').innerHTML=$('body').value;"><% "body" get write %></textarea></td></tr>
+    <tr><td></td><td><input type="submit" name="post" value="<% "stub" get "update" "post" ? write %>"/>
+    
+    <% "stub" get [  [ entry-delete ] curry "Delete" render-link ] when* %>(preview below)</td></tr>
+    <tr><td></td><td><div id="preview"></div></td></tr>
+    </table>
+</form>
+
+<script>
+$('preview').innerHTML=$('body').value;
+</script>
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/templates/entry-edit.furnace b/unmaintained/furnace-onigiri/templates/entry-edit.furnace
new file mode 100644 (file)
index 0000000..d112ac5
--- /dev/null
@@ -0,0 +1,34 @@
+<% USING: namespaces io kernel sequences furnace:onigiri html 
+furnace ; %>
+
+<script type="text/javascript">
+function transformWiky() {
+  var wiky = $('wiky').value;
+  var html = Wiky.toHtml(wiky);
+  $('html').value = html;
+  $('preview').innerHTML = html;
+}
+function transformHtml() {
+  var html = $('preview').innerHTML;
+  var wiky = Wiky.toWiki(html);
+  $('wiky').value = wiky;
+  $('html').value = html;
+}
+</script>
+
+<p><% "stub" get [ f entry-edit ] curry "Edit in non-Wiky editor" render-link %></p>
+
+<form method="post" action="entry-update">
+    <% "stub" get [ %><input type="hidden" name="stub" value="<% "stub" get write %>"/><% ] when %>
+    <table><tr><td>Title:</td><td><input type="text" name="title" value="<% "title" get write %>"/></td></tr>
+    <tr><td>Body:</td><td><textarea id="wiky" rows="10" cols="60" name="wiky" onkeyup="transformWiky();"></textarea></td></tr>
+    <tr><td></td><td><input type="submit" name="post" value="<% "stub" get "update" "post" ? write %>"/>
+    
+    <% "stub" get [  [ entry-delete ] curry "Delete" render-link ] when* %> 
+    (preview below)</td></tr>
+    <tr><td></td><td><input id="html" type="hidden" name="body" value=""/><div id="preview"><% "body" get [ write-html ] when* %></div></td></tr>
+    </table>
+</form>
+<script type="text/javascript">
+transformHtml();  
+</script>
diff --git a/unmaintained/furnace-onigiri/templates/entry-show.furnace b/unmaintained/furnace-onigiri/templates/entry-show.furnace
new file mode 100644 (file)
index 0000000..c4b172a
--- /dev/null
@@ -0,0 +1,9 @@
+<% USING: furnace:onigiri io namespaces math calendar html kernel furnace ; %>
+
+<div class="entry">
+<h2><a href="<% "entry-show" action>url write %>?stub=<% "stub" get write %>"><% "title" get write %></a></h2>
+
+<p>posted <% "created" get timestamp>string write %> <% "stub" get [ entry-edit ] curry "(edit)" render-link %></p>
+
+<% "body" get write-html %>
+</div>
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/templates/footer.furnace b/unmaintained/furnace-onigiri/templates/footer.furnace
new file mode 100644 (file)
index 0000000..8cd3f1d
--- /dev/null
@@ -0,0 +1,16 @@
+<% USING: io kernel namespaces hashtables furnace:onigiri ; %>
+
+<% "analytics" key>meta* meta-value [ %>
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "<% write %>";
+urchinTracker();
+</script>
+
+<% ] when* %>
+
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/templates/header.furnace b/unmaintained/furnace-onigiri/templates/header.furnace
new file mode 100644 (file)
index 0000000..80c6342
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <% USING: namespaces io kernel hashtables furnace:onigiri furnace sequences ; %>
+    <title><% "model" get write %></title>
+    <link rel='stylesheet' type='text/css' href='/responder/onigiri-resources/<% css-path write %>'/>
+    <link rel='stylesheet' type='text/css' href='/responder/onigiri-resources/wiky/wiky.css'/>
+    <link rel='stylesheet' type='text/css' href='/responder/onigiri-resources/wiky/wiky.lang.css'/>
+    <link rel='stylesheet' type='text/css' href='/responder/onigiri-resources/wiky/wiky.math.css'/>
+    <script type='text/javascript' src='/responder/onigiri-resources/wiky/wiky.js'></script>
+    <script type='text/javascript' src='/responder/onigiri-resources/wiky/wiky.lang.js'></script>
+    <script type='text/javascript' src='/responder/onigiri-resources/wiky/wiky.math.js'></script>
+    <script type='text/javascript' src='/responder/resources/prototype.js'></script>
+</head>
+<body>
+
+<div id="header">
+    <h1><a href="<% "" action>url write %>"><% "title" key>meta* meta-value write %></a></h1>
+
+    <p>Proudly running on <a href="http://factorcode.org">Factor <% version write %></a></p>
+
+    <p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0 Strict</a> | <a href="<% "atom" action>url write %>">Subscribe to <% "title" key>meta [ meta-value ] [ "this weblog" ] if* write %></a> | <% [ meta-list ] "Admin" render-link %> | <% [ f entry-edit ] "Post" render-link %></p>
+</div>
+
+<div id="container">
\ No newline at end of file
diff --git a/unmaintained/furnace-onigiri/templates/sitemap.furnace b/unmaintained/furnace-onigiri/templates/sitemap.furnace
new file mode 100644 (file)
index 0000000..ee7d173
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
+    <% USING: namespaces furnace:onigiri sequences io ; %>
+    <url>
+      <loc><% base-url write "" action>url write %></loc>
+    </url>
+    <% entry get [ %>
+    <url>
+      <loc><% entry-stub base-url write stub>url write %></loc>
+    </url>
+    <% ] each %> 
+  </urlset>
\ No newline at end of file
diff --git a/unmaintained/furnace-pastebin/annotate-paste.furnace b/unmaintained/furnace-pastebin/annotate-paste.furnace
new file mode 100644 (file)
index 0000000..24f0d4e
--- /dev/null
@@ -0,0 +1,28 @@
+<% USING: namespaces math io ; %>
+
+<h1>Annotate</h1>
+
+<form method="POST" action="/responder/pastebin/annotate-paste">
+
+<table>
+
+<input type="hidden" name="n" value="<% "n" get number>string write %>" />
+
+<tr>
+<th>Summary:</th>
+<td><input type="TEXT" name="summary" value="" /></td>
+</tr>
+
+<tr>
+<th>Your name:</th>
+<td><input type="TEXT" name="author" value="" /></td>
+</tr>
+
+<tr>
+<th valign="top">Contents:</th>
+<td><textarea rows="24" cols="60" name="contents"></textarea></td>
+</tr>
+</table>
+
+<input type="SUBMIT" value="Annotate" />
+</form>
diff --git a/unmaintained/furnace-pastebin/annotation.furnace b/unmaintained/furnace-pastebin/annotation.furnace
new file mode 100644 (file)
index 0000000..ed1bdac
--- /dev/null
@@ -0,0 +1,11 @@
+<% USING: namespaces io ; %>
+
+<h2>Annotation: <% "summary" get write %></h2>
+
+<table>
+<tr><th>Annotation by:</th><td><% "author" get write %></td></tr>
+<tr><th>Channel:</th><td><% "channel" get write %></td></tr>
+<tr><th>Created:</th><td><% "date" get write %></td></tr>
+</table>
+
+<pre><% "contents" get write %></pre>
diff --git a/unmaintained/furnace-pastebin/load.factor b/unmaintained/furnace-pastebin/load.factor
new file mode 100644 (file)
index 0000000..4f3bdc8
--- /dev/null
@@ -0,0 +1,4 @@
+REQUIRES: libs/concurrency libs/furnace libs/irc libs/store ;
+
+PROVIDE: apps/furnace-pastebin
+{ +files+ {  "pastebin.factor" } } ;
diff --git a/unmaintained/furnace-pastebin/new-paste.furnace b/unmaintained/furnace-pastebin/new-paste.furnace
new file mode 100644 (file)
index 0000000..36f0397
--- /dev/null
@@ -0,0 +1,27 @@
+<form method="POST" action="/responder/pastebin/submit-paste">
+
+<table>
+
+<tr>
+<th>Summary:</th>
+<td><input type="TEXT" name="summary" value="" /></td>
+</tr>
+
+<tr>
+<th>Your name:</th>
+<td><input type="TEXT" name="author" value="" /></td>
+</tr>
+
+<tr>
+<th>Channel:</th>
+<td><input type="TEXT" name="channel" value="" /></td>
+</tr>
+
+<tr>
+<th valign="top">Contents:</th>
+<td><textarea rows="24" cols="60" name="contents"></textarea></td>
+</tr>
+</table>
+
+<input type="SUBMIT" value="Submit paste" />
+</form>
diff --git a/unmaintained/furnace-pastebin/paste-list.furnace b/unmaintained/furnace-pastebin/paste-list.furnace
new file mode 100644 (file)
index 0000000..7a25ae2
--- /dev/null
@@ -0,0 +1,7 @@
+<% USING: namespaces furnace sequences ; %>
+
+<table  width="100%">
+<% "new-paste-quot" get "New paste" render-link %>
+<tr align="left"><th>&nbsp;</th><th>Summary:</th><th>Paste by:</th><th>Link</th><th>Date</th></tr>
+<% "pastes" get <reversed> [ "paste-summary" render-template ] each %></table>
+
diff --git a/unmaintained/furnace-pastebin/paste-summary.furnace b/unmaintained/furnace-pastebin/paste-summary.furnace
new file mode 100644 (file)
index 0000000..ad54c8d
--- /dev/null
@@ -0,0 +1,9 @@
+<% USING: namespaces io kernel math furnace ; %>
+
+<tr>
+<td><% "n" get number>string write %></td>
+<td><% "summary" get write %></td>
+<td><% "author" get write %></td>
+<td><% "n" get number>string "show-paste-quot" get curry "Show" render-link %></td>
+<td><% "date" get print %></td>
+</tr>
diff --git a/unmaintained/furnace-pastebin/pastebin.factor b/unmaintained/furnace-pastebin/pastebin.factor
new file mode 100644 (file)
index 0000000..b111293
--- /dev/null
@@ -0,0 +1,110 @@
+IN: furnace:pastebin
+USING: calendar concurrency irc kernel namespaces sequences
+furnace hashtables math store ;
+
+TUPLE: paste n summary author channel contents date annotations ;
+
+TUPLE: annotation summary author contents ;
+
+C: paste ( summary author channel contents -- paste )
+    V{ } clone over set-paste-annotations
+    [ set-paste-contents ] keep
+    [ set-paste-channel ] keep
+    [ set-paste-author ] keep
+    [ set-paste-summary ] keep ;
+
+TUPLE: pastebin pastes ;
+
+C: pastebin ( -- pastebin )
+    V{ } clone over set-pastebin-pastes ;
+
+SYMBOL: store
+"pastebin.store" load-store store set-global
+<pastebin> pastebin store get store-variable
+
+: add-paste ( paste pastebin -- )
+    now timestamp>http-string pick set-paste-date
+    dup pastebin-pastes length pick set-paste-n
+    pastebin-pastes push ;
+
+: get-paste ( n -- paste )
+    pastebin get pastebin-pastes nth ;
+
+: show-paste ( n -- )
+    get-paste "show-paste" "Paste" render-page ;
+
+\ show-paste { { "n" v-number } } define-action
+
+: new-paste ( -- )
+    f "new-paste" "New paste" render-page ;
+
+\ new-paste { } define-action
+
+: make-remote-process
+    "trifocus.net" 4030 <node> "public-irc" <remote-process> ;
+
+: alert-new-paste ( paste -- )
+    >r make-remote-process r>
+    f over paste-channel rot [
+        dup paste-author %
+        " pasted " %
+        CHAR: " ,
+        dup paste-summary %
+        CHAR: " ,
+        " at " %
+        "http://wee-url.com/responder/pastebin/show-paste?n=" %
+        paste-n #
+    ] "" make <chat-command> swap send ;
+
+: alert-annotation ( annotation paste -- )
+    make-remote-process -rot
+    f over paste-channel 2swap [
+        over annotation-author %
+        " annotated paste " %
+        " with \"" %
+        over annotation-summary %
+        "\" at " %
+        "http://wee-url.com/responder/pastebin/show-paste?n=" %
+        dup paste-n #
+        2drop
+    ] "" make <chat-command> swap send ;
+    
+
+: submit-paste ( summary author channel contents -- )
+    <paste> dup pastebin get-global add-paste
+    alert-new-paste store get save-store ;
+
+\ submit-paste {
+    { "summary" v-required }
+    { "author" v-required }
+    { "channel" "#concatenative" v-default }
+    { "contents" v-required }
+} define-action
+
+: paste-list ( -- )
+    [
+        [ show-paste ] "show-paste-quot" set
+        [ new-paste ] "new-paste-quot" set
+
+        pastebin get "paste-list" "Pastebin" render-page
+    ] with-scope ;
+
+\ paste-list { } define-action
+
+\ submit-paste [ paste-list ] define-redirect
+
+: annotate-paste ( paste# summary author contents -- )
+    <annotation> swap get-paste
+    [ paste-annotations push ] 2keep
+    alert-annotation store get save-store ;
+
+\ annotate-paste {
+    { "n" v-required v-number }
+    { "summary" v-required }
+    { "author" v-required }
+    { "contents" v-required }
+} define-action
+
+\ annotate-paste [ "n" show-paste ] define-redirect
+
+"pastebin" "paste-list" "apps/furnace-pastebin" web-app
diff --git a/unmaintained/furnace-pastebin/show-paste.furnace b/unmaintained/furnace-pastebin/show-paste.furnace
new file mode 100644 (file)
index 0000000..b3b4e99
--- /dev/null
@@ -0,0 +1,15 @@
+<% USING: namespaces io furnace sequences ; %>
+
+<h1>Paste: <% "summary" get write %></h1>
+
+<table>
+<tr><th>Paste by:</th><td><% "author" get write %></td></tr>
+<tr><th>Channel:</th><td><% "channel" get write %></td></tr>
+<tr><th>Created:</th><td><% "date" get write %></td></tr>
+</table>
+
+<pre><% "contents" get write %></pre>
+
+<% "annotations" get [ "annotation" render-template ] each %>
+
+<% model get "annotate-paste" render-template %>
diff --git a/unmaintained/heap/heap.factor b/unmaintained/heap/heap.factor
new file mode 100644 (file)
index 0000000..53c4022
--- /dev/null
@@ -0,0 +1,74 @@
+! Binary Min Heap
+! Copyright 2007 Ryan Murphy
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel math sequences ;
+IN: heap
+
+: [comp] ( elt elt -- ? ) <=> 0 > ;
+
+: <heap> ( -- heap ) V{ } clone ;
+
+: left ( index -- index ) ! left child
+    2 * 1 + ;
+
+: leftv ( heap index -- value )
+    left swap nth ;
+
+: right ( index -- index ) ! right child
+    2 * 2 + ;
+
+: rightv ( heap index -- value )
+    right swap nth ;
+
+: l-oob ( i heap -- ? ) swap left swap length >= ;
+: r-oob ( i heap -- ? ) swap right swap length >= ;
+
+: up ( index -- index ) ! parent node
+    1 -  2 /i ;
+
+: upv ( heap index -- value ) ! parent's value
+    up swap nth ;
+
+: lasti ( seq -- index ) length 1 - ;
+
+: swapup ( heap index -- ) dup up rot exchange ;
+
+: (farchild) ( heap index -- index ) tuck 2dup leftv -rot rightv [comp] [ right ] [ left ] if ;
+
+: farchild ( heap index -- index ) dup right pick length >= [ nip left ] [ (farchild) ] if ;
+
+: farchildv ( heap index -- value ) dupd farchild swap nth ;
+
+: swapdown ( heap index -- ) 2dup farchild rot exchange ;
+
+: upheap ( heap -- )
+    dup dup lasti upv over peek [comp]
+    [ dup lasti 2dup swapup up 1 + head-slice upheap ] [ drop ] if ;
+
+: add ( elt heap -- )
+    tuck push upheap ;
+
+: add-many ( seq heap -- )
+    swap [ swap add ] each-with ;
+
+DEFER: (downheap)
+
+: (downheap2) ( i heap -- )
+    2dup nth -rot
+    2dup swap farchild dup pick nth 2swap
+    >r >r
+    swapd [comp]
+    [ r> r> tuck swap swapdown (downheap) ] [ drop r> r> 2drop ] if ;
+
+: (downheap) ( i heap -- )
+    over left over length >= [ 2drop ] [ (downheap2) ] if ;
+
+: downheap ( heap -- )
+    0 swap (downheap) ;
+
+: bump ( heap -- )
+    dup peek 0 pick set-nth dup pop* downheap ;
+
+: gbump ( heap -- first )
+    dup first swap bump ;
\ No newline at end of file
diff --git a/unmaintained/heap/heap.facts b/unmaintained/heap/heap.facts
new file mode 100644 (file)
index 0000000..5dfe472
--- /dev/null
@@ -0,0 +1,76 @@
+! Binary Min Heap
+! Copyright 2007 Ryan Murphy
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: help heap sequences ;
+
+ARTICLE: { "heap" "heap" } "Binary Min Heap"
+"A vector-based implementation of a binary min heap.  Elements are simply stored in a vector, so use " { $link first } " to access the root of the heap."
+{ $subsection <heap> }
+{ $subsection add }
+{ $subsection add-many }
+{ $subsection bump }
+{ $subsection gbump }
+{ $subsection print-heap }
+;
+
+HELP: <heap>
+"Creates a new heap with nothing on it." ;
+
+HELP: add
+"Adds 1 element to the heap."
+{ $examples
+  { $code
+    "USE: heap"
+    "<heap> 3 over add 4 over add 5 over add"
+    "print-heap"
+  }
+}
+;
+
+HELP: add-many
+"For each element in the sequence, add it to the heap."
+{ $examples
+  { $code
+    "USE: heap"
+    "<heap> { 7 6 5 4 3 2 1 } over add-many"
+    "print-heap"
+  }
+}
+;
+
+HELP: bump
+"\"Bumps\" the root element off of the heap, rearranging the remaining elements so that the heap remains valid."
+{ $examples
+  { $code
+    "USE: heap"
+    "<heap> { 7 6 5 4 3 2 1 } over add-many"
+    "dup print-heap"
+    "dup bump \"(bump)\" print dup print-heap"
+    "dup bump \"(bump)\" print dup print-heap"
+    "dup bump \"(bump)\" print dup print-heap"
+  }
+}
+;
+
+HELP: gbump
+"(\"Get-bump\") Does a " { $link bump } ", but leaves the bumped element on the stack instead of discarding it."
+{ $examples
+  { $code
+    "USE: heap"
+    "<heap> { 7 6 5 4 3 2 1 } over add-many"
+    "dup gbump"
+  }
+}
+;
+
+HELP: print-heap
+"Prints the heap in tree form."
+{ $examples
+  { $code
+    "USE: heap"
+    "<heap> { 7 6 5 4 3 2 1 } over add-many"
+    "print-heap"
+  }
+}
+;
\ No newline at end of file
diff --git a/unmaintained/heap/human tests.factor b/unmaintained/heap/human tests.factor
new file mode 100644 (file)
index 0000000..aeec5d8
--- /dev/null
@@ -0,0 +1,100 @@
+: test-agg2 ( -- )\r
+    {\r
+    } >vector\r
+    {\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+    } >vector\r
+    aggregate2 [ print ] each "" print\r
+\r
+    {\r
+      "aa"\r
+      "aa"\r
+    } >vector\r
+    {\r
+    } >vector\r
+    aggregate2 [ print ] each "" print\r
+\r
+    {\r
+    } >vector\r
+    {\r
+    } >vector\r
+    aggregate2 [ print ] each "" print\r
+\r
+    {\r
+      "aaaaaaa"\r
+      "aaaaaaa"\r
+      "aaaaaaa"\r
+      "aaaaaaa"\r
+      "aaaaaaa"\r
+      "aaaaaaa"\r
+    } >vector\r
+    {\r
+      "bbbb"\r
+      "bbbb"\r
+      "bbbb"\r
+    } >vector\r
+    aggregate2 [ print ] each "" print\r
+\r
+    {\r
+      "aaaa"\r
+      "aaaa"\r
+      "aaaa"\r
+    } >vector\r
+    {\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+      "bbbbbbb"\r
+    } >vector\r
+    aggregate2 [ print ] each "" print\r
+    ;\r
+\r
+\r
+\r
+\r
+: test-agg ( -- )\r
+    {\r
+      "....5.."\r
+      "...|.|."\r
+      "..7...9"\r
+      ".|....."\r
+      "8......"\r
+    } >vector\r
+    {\r
+      "..3.."\r
+      ".|.|."\r
+      "4...4"\r
+    } >vector\r
+    {\r
+      ".2."\r
+      "|.|"\r
+    } >vector\r
+    aggregate3 [ print ] each "" print\r
+\r
+    {\r
+      "....5.."\r
+      "...|.|."\r
+      "..7...9"\r
+      ".|....."\r
+      "8......"\r
+    } >vector\r
+    {\r
+      "......3...."\r
+      ".....|.|..."\r
+      "....4...4.."\r
+      "...|.|....."\r
+      "..5...6...."\r
+      ".|........."\r
+      "6.........."\r
+    } >vector\r
+    {\r
+      ".2."\r
+      "|.|"\r
+    } >vector\r
+    aggregate3 [ print ] each "" print\r
+    ;
\ No newline at end of file
diff --git a/unmaintained/heap/load.factor b/unmaintained/heap/load.factor
new file mode 100644 (file)
index 0000000..d0d925b
--- /dev/null
@@ -0,0 +1,16 @@
+! Binary Min Heap
+! Copyright 2007 Ryan Murphy
+! See http://factorcode.org/license.txt for BSD license.
+
+PROVIDE: libs/heap
+
+{ +files+ { 
+    "heap.factor"
+    "print.factor"
+
+    "heap.facts"
+} }
+
+{ +tests+ {
+    "tests.factor"
+} } ;
\ No newline at end of file
diff --git a/unmaintained/heap/print.factor b/unmaintained/heap/print.factor
new file mode 100644 (file)
index 0000000..e79c246
--- /dev/null
@@ -0,0 +1,51 @@
+! Binary Min Heap
+! Copyright 2007 Ryan Murphy
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: namespaces kernel math sequences prettyprint io ;
+IN: heap
+
+: spaces ( n -- str )
+    [ [ " " % ] times ] "" make ;
+
+: prepend-s ( v1 n -- v1' )
+    spaces   swap [ append ] map-with ;
+
+: append-s ( v1 v2 -- v1' )
+    spaces   swap [ swap append ] map-with ;
+
+: pad-r ( lv rv -- rv' )
+    dup first length spaces   pick length pick length -
+    [ [ dup , ] times ] V{ } make  
+    nip append nip ;
+
+: pad-l ( lv rv -- lv' )
+    swap pad-r ;
+
+: (aggregate2) ( lv rv -- v )
+    over length over length >= [ dupd pad-r ] [ tuck pad-l swap ] if
+    [ append ] 2map ;
+
+: aggregate2 ( lv rv -- v )
+    dup empty? [ drop ] [ over empty? [ nip ] [ (aggregate2) ] if ] if ;
+
+: (agg3len) ( v -- len )
+    dup empty? [ drop 0 ] [ first length ] if ;
+
+: aggregate3 ( lv rv pv -- v )
+    dup (agg3len) -roll
+    pick (agg3len) prepend-s
+    over (agg3len) append-s
+    -roll -rot swap append-s
+    swap aggregate2 append ;
+
+: output-node ( elt -- str ) [ [ pprint ] string-out , ] V{ } make ;
+
+: (print-heap) ( i heap -- vector )
+    2dup l-oob [ V{ } clone ] [ over  left over (print-heap) ] if -rot
+    2dup r-oob [ V{ } clone ] [ over right over (print-heap) ] if -rot
+    V{ } clone pick pick nth  output-node append
+    -rot 2drop aggregate3 ;
+
+: print-heap ( heap -- )
+    dup empty? [ drop ] [ 0 swap (print-heap) [ print ] each ] if ;
\ No newline at end of file
diff --git a/unmaintained/heap/tests.factor b/unmaintained/heap/tests.factor
new file mode 100644 (file)
index 0000000..a166933
--- /dev/null
@@ -0,0 +1,35 @@
+! Binary Min Heap
+! Copyright 2007 Ryan Murphy
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: heap test kernel ;
+
+{ 1 2 3 4 5 6 } [ 0 left 0 right 1 left 1 right 2 left 2 right ] unit-test
+{ t } [ 5 3 [comp] ] unit-test
+{ V{ } } [ <heap> ] unit-test
+
+{ V{ -6 -4 2 1 5 3 2 4 3 7 6 8 3 4 4 6 5 5 } } [ <heap> { 3 5 4 6 7 8 2 4 3 5 6 1 3 2 4 5 -6 -4 } over add-many ] unit-test
+
+
+
+{ V{ "hire" "hose" } } [ V{ "hi" "ho" } V{ "re" "se" } aggregate2 ] unit-test
+{ V{ "hire" "hose" "  it" } } [ V{ "hi" "ho" } V{ "re" "se" "it" } aggregate2 ] unit-test
+{ V{ "tracks" "snacks" "crack " } } [ V{ "track" "snack" "crack" } V{ "s" "s" } aggregate2 ] unit-test
+
+
+
+{ V{ "    top     " "left   right" } } [ V{ "left" } V{ "right" } V{ "top" } aggregate3 ] unit-test
+
+{ V{ "    top     "
+     "    dog     "
+     "left   right"
+     "over   on   "
+     "       man  " } } [ V{ "left" "over" } V{ "right" "on   " "man  " } V{ "top" "dog" } aggregate3 ] unit-test
+
+{ V{ "           -6       "
+     "      -4        2   "
+     "   1     5    3   2 "
+     " 4   3  7 6  8 3 4 4"
+     "6 5 5               " } } [ 0 <heap> { 3 5 4 6 7 8 2 4 3 5 6 1 3 2 4 5 -6 -4 } over add-many (print-heap) ] unit-test
+
+{ V{ 5 6 6 7 8 } } [ <heap> { 3 5 4 6 5 7 6 8 } over add-many dup bump dup bump dup bump ] unit-test
\ No newline at end of file
diff --git a/unmaintained/io/io.factor b/unmaintained/io/io.factor
new file mode 100644 (file)
index 0000000..24151d9
--- /dev/null
@@ -0,0 +1,8 @@
+USING: calendar io io-internals kernel math namespaces
+nonblocking-io prettyprint quotations sequences ;
+IN: libs-io
+
+: bit-set? ( m n -- ? ) [ bitand ] keep = ; 
+: set-bit ( m bit -- n ) bitor ;
+: clear-bit ( m bit -- n ) bitnot bitand ;
+
diff --git a/unmaintained/io/load.factor b/unmaintained/io/load.factor
new file mode 100644 (file)
index 0000000..ac9b954
--- /dev/null
@@ -0,0 +1,24 @@
+USING: kernel ;
+
+REQUIRES: libs/calendar libs/shuffle ;
+
+PROVIDE: libs/io
+{ +files+ {
+    "io.factor"
+    "mmap.factor"
+    "shell.factor"
+    { "os-unix.factor" [ unix? ] }
+    { "os-unix-shell.factor" [ unix? ] }
+    { "mmap-os-unix.factor" [ unix? ] }
+
+    { "os-winnt.factor" [ winnt? ] }
+    { "os-winnt-shell.factor" [ winnt? ] }
+    { "mmap-os-winnt.factor" [ winnt? ] }
+
+    { "os-wince.factor" [ wince? ] }
+} }
+{ +tests+ {
+    "test/io.factor"
+    "test/mmap.factor"
+} } ;
+
diff --git a/unmaintained/io/os-unix-shell.factor b/unmaintained/io/os-unix-shell.factor
new file mode 100644 (file)
index 0000000..6c3919d
--- /dev/null
@@ -0,0 +1,46 @@
+USING: arrays kernel libs-io sequences prettyprint unix-internals
+calendar namespaces math ;
+USE: io
+IN: shell
+
+TUPLE: unix-shell ;
+
+T{ unix-shell } \ shell set-global
+
+TUPLE: file name mode nlink uid gid size mtime symbol ;
+
+M: unix-shell directory* ( path -- seq )
+    dup (directory) [ tuck >r "/" r> 3append stat* 2array ] map-with ;
+
+M: unix-shell make-file ( path -- file )
+    first2
+    [ stat-mode ] keep
+    [ stat-nlink ] keep
+    [ stat-uid ] keep
+    [ stat-gid ] keep
+    [ stat-size ] keep
+    [ stat-mtime timespec>timestamp >local-time ] keep
+    stat-mode mode>symbol <file> ;
+
+M: unix-shell file. ( file -- )
+    [ [ file-mode >oct write ] keep ] with-cell
+    [ bl ] with-cell
+    [ [ file-nlink unparse write ] keep ] with-cell
+    [ bl ] with-cell
+    [ [ file-uid unparse write ] keep ] with-cell
+    [ bl ] with-cell
+    [ [ file-gid unparse write ] keep ] with-cell
+    [ bl ] with-cell
+    [ [ file-size unparse write ] keep ] with-cell
+    [ bl ] with-cell
+    [ [ file-mtime file-time-string write ] keep ] with-cell
+    [ bl ] with-cell
+    [ file-name write ] with-cell ;
+
+USE: unix-internals
+M: unix-shell touch-file ( path -- )
+    dup open-append dup -1 = [
+        drop now dup set-file-times
+    ] [
+        nip [ now dup set-file-times* ] keep close
+    ] if ;
diff --git a/unmaintained/io/os-unix.factor b/unmaintained/io/os-unix.factor
new file mode 100644 (file)
index 0000000..7ae47cd
--- /dev/null
@@ -0,0 +1,237 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien arrays calendar errors io io-internals kernel
+math nonblocking-io sequences unix-internals unix-io ;
+IN: libs-io
+
+: O_APPEND  HEX: 100 ; inline
+: O_EXCL    HEX: 800 ; inline
+: SEEK_SET 0 ; inline
+: SEEK_CUR 1 ; inline
+: SEEK_END 2 ; inline
+: EEXIST 17 ; inline
+
+FUNCTION: off_t lseek ( int fildes, off_t offset, int whence ) ;
+: append-mode
+    O_WRONLY O_APPEND O_CREAT bitor bitor ; foldable
+
+: open-append ( path -- fd )
+    append-mode file-mode open dup io-error
+    [ 0 SEEK_END lseek io-error ] keep ;
+
+: touch-mode
+    O_WRONLY O_APPEND O_CREAT O_EXCL bitor bitor bitor ; foldable    
+
+: open-touch ( path -- fd )
+    touch-mode file-mode open
+    [ io-error close t ]
+    [ 2drop err_no EEXIST = [ err_no io-error ] unless -1 ] recover ;
+    
+: <file-appender> ( path -- stream ) open-append <writer> ;
+
+FUNCTION: int unlink ( char* path ) ;
+: delete-file ( path -- )
+    unlink io-error ;
+
+FUNCTION: int mkdir ( char* path, mode_t mode ) ;
+
+: (create-directory) ( path mode -- )
+    mkdir io-error ;
+
+: create-directory ( path -- )
+    0 (create-directory) ;
+
+FUNCTION: int rmdir ( char* path ) ;
+
+: delete-directory ( path -- )
+    rmdir io-error ;
+
+FUNCTION: int chroot ( char* path ) ;
+FUNCTION: int chdir ( char* path ) ;
+FUNCTION: int fchdir ( int fd ) ;
+
+FUNCTION: int utimes ( char* path, timeval[2] times ) ;
+FUNCTION: int futimes ( int id, timeval[2] times ) ;
+
+TYPEDEF: longlong blkcnt_t
+TYPEDEF: int blksize_t
+TYPEDEF: int dev_t
+TYPEDEF: uint ino_t
+TYPEDEF: ushort mode_t
+TYPEDEF: ushort nlink_t
+TYPEDEF: uint uid_t
+TYPEDEF: uint gid_t
+TYPEDEF: longlong quad_t
+TYPEDEF: ulong u_long
+
+FUNCTION: int stat ( char* path, stat* sb ) ;
+
+C-STRUCT: stat
+    { "dev_t"     "dev" }       ! device inode resides on
+    { "ino_t"     "ino" }       ! inode's number
+    { "mode_t"    "mode" }      ! inode protection mode
+    { "nlink_t"   "nlink" }     ! number or hard links to the file
+    { "uid_t"     "uid" }       ! user-id of owner
+    { "gid_t"     "gid" }       ! group-id of owner
+    { "dev_t"     "rdev" }      ! device type, for special file inode
+    { "timespec"  "atime" }     ! time of last access
+    { "timespec"  "mtime" }     ! time of last data modification
+    { "timespec"  "ctime" }     ! time of last file status change
+    { "off_t"     "size" }      ! file size, in bytes
+    { "blkcnt_t"  "blocks" }    ! blocks allocated for file
+    { "blksize_t" "blksize" }   ! optimal file sys I/O ops blocksize
+    { "u_long"    "flags" }     ! user defined flags for file
+    { "u_long"    "gen" } ;     ! file generation number
+
+: stat* ( path -- byte-array )
+    "stat" <c-object> [ stat io-error ] keep ;
+
+: make-timeval-array ( array -- byte-array )
+    [ length "timeval" <c-array> ] keep
+    dup length [ over [ pick set-timeval-nth ] [ 2drop ] if ] 2each ;
+
+: (set-file-times) ( timestamp timestamp -- alien )
+    [ [ timestamp>timeval ] [ f ] if* ] 2apply 2array
+    make-timeval-array ;
+
+: set-file-times ( path timestamp timestamp -- )
+    #! set access, write
+    (set-file-times) utimes io-error ;
+
+: set-file-times* ( fd timestamp timestamp -- )
+    (set-file-times) futimes io-error ;
+
+
+: set-file-access-time ( path timestamp -- )
+    f set-file-times ;
+
+: set-file-write-time ( path timestamp -- )
+    >r f r> set-file-times ;
+
+
+: file-write-time ( path -- timestamp )
+    stat* stat-mtime timespec>timestamp ;
+
+: file-access-time ( path -- timestamp )
+    stat* stat-atime timespec>timestamp ;
+
+! File type
+: S_IFMT    OCT: 0170000 ; inline ! type of file
+: S_IFIFO   OCT: 0010000 ; inline ! named pipe (fifo)
+: S_IFCHR   OCT: 0020000 ; inline ! character special
+: S_IFDIR   OCT: 0040000 ; inline ! directory
+: S_IFBLK   OCT: 0060000 ; inline ! block special
+: S_IFREG   OCT: 0100000 ; inline ! regular
+: S_IFLNK   OCT: 0120000 ; inline ! symbolic link
+: S_IFSOCK  OCT: 0140000 ; inline ! socket
+: S_IFWHT   OCT: 0160000 ; inline ! whiteout
+: S_IFXATTR OCT: 0200000 ; inline ! extended attribute
+
+! File mode
+! Read, write, execute/search by owner
+: S_IRWXU OCT: 0000700 ; inline    ! rwx mask owner
+: S_IRUSR OCT: 0000400 ; inline    ! r owner
+: S_IWUSR OCT: 0000200 ; inline    ! w owner
+: S_IXUSR OCT: 0000100 ; inline    ! x owner
+! Read, write, execute/search by group
+: S_IRWXG OCT: 0000070 ; inline    ! rwx mask group
+: S_IRGRP OCT: 0000040 ; inline    ! r group
+: S_IWGRP OCT: 0000020 ; inline    ! w group
+: S_IXGRP OCT: 0000010 ; inline    ! x group
+! Read, write, execute/search by others
+: S_IRWXO OCT: 0000007 ; inline    ! rwx mask other
+: S_IROTH OCT: 0000004 ; inline    ! r other
+: S_IWOTH OCT: 0000002 ; inline    ! w other
+: S_IXOTH OCT: 0000001 ; inline    ! x other
+
+: S_ISUID OCT: 0004000 ; inline    ! set user id on execution
+: S_ISGID OCT: 0002000 ; inline    ! set group id on execution
+: S_ISVTX OCT: 0001000 ; inline    ! sticky bit
+
+FUNCTION: uid_t getuid ;
+FUNCTION: uid_t geteuid ;
+
+FUNCTION: gid_t getgid ;
+FUNCTION: gid_t getegid ;
+
+FUNCTION: int setuid ( uid_t uid ) ;
+FUNCTION: int seteuid ( uid_t euid ) ;
+FUNCTION: int setreuid ( uid_t ruid, uid_t euid ) ;
+
+FUNCTION: int setgid ( gid_t gid ) ;
+FUNCTION: int setegid ( gid_t egid ) ;
+FUNCTION: int setregid ( gid_t rgid, gid_t egid ) ;
+
+FUNCTION: int issetugid ;
+
+FUNCTION: int chmod ( char* 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 fchown ( int fd, uid_t owner, gid_t group ) ;
+#! lchown does not follow symbolic links
+FUNCTION: int lchown ( char* path, uid_t owner, gid_t group ) ;
+
+FUNCTION: int getgroups ( int gidsetlen, gid_t* gidset ) ;
+FUNCTION: int setgroups ( int ngroups, gid_t* gidset ) ;
+
+FUNCTION: int flock ( int fd, int operation ) ;
+! FUNCTION: int dup ( int oldd ) ;
+! FUNCTION: int dup2 ( int oldd, int newd ) ;
+
+FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
+FUNCTION: int getdtablesize ;
+
+: file-mode? ( path mask -- ? )
+    >r stat* stat-mode r> bit-set? ;
+
+: user-read? ( path -- ? ) S_IRUSR file-mode? ;
+: user-write? ( path -- ? ) S_IWUSR file-mode? ;
+: user-execute? ( path -- ? ) S_IXUSR file-mode? ;
+
+: group-read? ( path -- ? ) S_IRGRP file-mode? ;
+: group-write? ( path -- ? ) S_IWGRP file-mode? ;
+: group-execute? ( path -- ? ) S_IXGRP file-mode? ;
+
+: other-read? ( path -- ? ) S_IROTH file-mode? ;
+: other-write? ( path -- ? ) S_IWOTH file-mode? ;
+: other-execute? ( path -- ? ) S_IXOTH file-mode? ;
+
+: set-uid? ( path -- ? ) S_ISUID bit-set? ;
+: set-gid? ( path -- ? ) S_ISGID bit-set? ;
+: set-sticky? ( path -- ? ) S_ISVTX bit-set? ;
+
+: chmod* ( path mask ? -- )
+    >r >r dup stat* stat-mode r> r> [
+        set-bit
+    ] [
+        clear-bit
+    ] if chmod io-error ;
+
+: set-user-read ( path ? -- ) >r S_IRUSR r> chmod* ;
+: set-user-write ( path ? -- ) >r S_IWUSR r> chmod* ;
+: set-user-execute ( path ? -- ) >r S_IXUSR r> chmod* ;
+
+: set-group-read ( path ? -- ) >r S_IRGRP r> chmod* ;
+: set-group-write ( path ? -- ) >r S_IWGRP r> chmod* ;
+: set-group-execute ( path ? -- ) >r S_IXGRP r> chmod* ;
+
+: set-other-read ( path ? -- ) >r S_IROTH r> chmod* ;
+: set-other-write ( path ? -- ) >r S_IWOTH r> chmod* ;
+: set-other-execute ( path ? -- ) >r S_IXOTH r> chmod* ;
+
+: set-uid ( path ? -- ) >r S_ISUID r> chmod* ;
+: set-gid ( path ? -- ) >r S_ISGID r> chmod* ;
+: set-sticky ( path ? -- ) >r S_ISVTX r> chmod* ;
+
+: mode>symbol ( mode -- ch )
+    S_IFMT bitand
+    {
+        { [ dup S_IFDIR = ] [ drop "/" ] }
+        { [ dup S_IFIFO = ] [ drop "|" ] }
+        { [ dup S_IXUSR = ] [ drop "*" ] }
+        { [ dup S_IFLNK = ] [ drop "@" ] }
+        { [ dup S_IFWHT = ] [ drop "%" ] }
+        { [ dup S_IFSOCK = ] [ drop "=" ] }
+        { [ t ] [ drop "" ] }
+    } cond ;
diff --git a/unmaintained/io/os-winnt-shell.factor b/unmaintained/io/os-winnt-shell.factor
new file mode 100644 (file)
index 0000000..a2be22d
--- /dev/null
@@ -0,0 +1,55 @@
+USING: alien calendar io io-internals kernel libs-io math
+namespaces prettyprint sequences windows-api ;
+IN: shell
+
+TUPLE: winnt-shell ;
+
+T{ winnt-shell } \ shell set-global
+
+TUPLE: file name size mtime attributes ;
+
+: ((directory*)) ( handle -- )
+    "WIN32_FIND_DATA" <c-object> [ FindNextFile ] 2keep
+    rot zero? [ 2drop ] [ , ((directory*)) ] if ;
+
+: (directory*) ( path -- )
+    "WIN32_FIND_DATA" <c-object> [
+        FindFirstFile dup INVALID_HANDLE_VALUE = [
+            win32-error
+        ] when
+    ] keep ,
+    [ ((directory*)) ] keep FindClose win32-error=0/f ;
+
+: append-star ( path -- path )
+    dup peek CHAR: \\ = "*" "\\*" ? append ;
+
+M: winnt-shell directory* ( path -- seq )
+    normalize-pathname append-star [ (directory*) ] { } make ;
+
+: WIN32_FIND_DATA>file-size ( WIN32_FILE_ATTRIBUTE_DATA -- n )
+    [ WIN32_FIND_DATA-nFileSizeLow ] keep
+    WIN32_FIND_DATA-nFileSizeHigh 32 shift + ; 
+
+M: winnt-shell make-file ( WIN32_FIND_DATA -- file )
+    [ WIN32_FIND_DATA-cFileName alien>u16-string ] keep
+    [ WIN32_FIND_DATA>file-size ] keep
+    [
+        WIN32_FIND_DATA-ftCreationTime
+        FILETIME>timestamp >local-time
+    ] keep
+    WIN32_FIND_DATA-dwFileAttributes <file> ;
+
+M: winnt-shell file. ( file -- )
+    [ [ file-attributes >oct write ] keep ] with-cell
+    [ bl ] with-cell
+    [ [ file-size unparse write ] keep ] with-cell
+    [ bl ] with-cell
+    [ [ file-mtime file-time-string write ] keep ] with-cell
+    [ bl ] with-cell
+    [ file-name write ] with-cell ;
+
+M: winnt-shell touch-file ( path -- )
+    #! Set the file write time to 'now'
+    normalize-pathname
+    dup maybe-create-file [ drop ] [ now set-file-write-time ] if ;
+
diff --git a/unmaintained/io/os-winnt.factor b/unmaintained/io/os-winnt.factor
new file mode 100644 (file)
index 0000000..971ae79
--- /dev/null
@@ -0,0 +1,96 @@
+USING: alien calendar errors generic io io-internals kernel
+math namespaces nonblocking-io parser quotations sequences
+shuffle windows-api words ;
+IN: libs-io
+
+: stat* ( path -- WIN32_FIND_DATA )
+    "WIN32_FIND_DATA" <c-object>
+    [
+        FindFirstFile
+        [ INVALID_HANDLE_VALUE = [ win32-error ] when ] keep
+        FindClose win32-error=0/f
+    ] keep ;
+
+: set-file-time ( path timestamp/f timestamp/f timestamp/f -- )
+    #! timestamp order: creation access write
+    >r >r >r open-existing dup r> r> r>
+    [ timestamp>FILETIME ] 3 napply
+    SetFileTime win32-error=0/f
+    close-handle ;
+
+: set-file-times ( path timestamp/f timestamp/f -- )
+    f -rot set-file-time ;
+
+: set-file-create-time ( path timestamp -- )
+    f f set-file-time ;
+
+: set-file-access-time ( path timestamp -- )
+    >r f r> f set-file-time ;
+
+: set-file-write-time ( path timestamp -- )
+    >r f f r> set-file-time ;
+
+: maybe-make-filetime ( ? -- FILETIME/f )
+    [ "FILETIME" <c-object> ] [ f ] if ;
+
+: file-time ( path ? ? ? -- FILETIME/f FILETIME/f FILETIME/f )
+    >r >r >r open-existing dup r> r> r>
+    [ maybe-make-filetime ] 3 napply
+    [ GetFileTime win32-error=0/f close-handle ] 3keep ;
+
+: file-times ( path -- FILETIME FILETIME FILETIME )
+    t t t file-time [ FILETIME>timestamp ] 3 napply ;
+
+: file-create-time ( path -- FILETIME )
+    t f f file-time 2drop FILETIME>timestamp ;
+
+: file-access-time ( path -- FILETIME )
+    f t f file-time drop nip FILETIME>timestamp ;
+
+: file-write-time ( path -- FILETIME )
+    f f t file-time 2nip FILETIME>timestamp ;
+
+: attrib ( path -- n )
+    [ stat* WIN32_FIND_DATA-dwFileAttributes ] catch
+    [ drop 0 ] when ;
+
+: (read-only?) ( mode -- ? )
+    FILE_ATTRIBUTE_READONLY bit-set? ;
+
+: read-only? ( path -- ? )
+    attrib (read-only?) ;
+
+: (hidden?) ( mode -- ? )
+    FILE_ATTRIBUTE_HIDDEN bit-set? ;
+
+: hidden? ( path -- ? )
+    attrib (hidden?) ;
+
+: (system?) ( mode -- ? )
+    FILE_ATTRIBUTE_SYSTEM bit-set? ;
+
+: system? ( path -- ? )
+    attrib (system?) ;
+
+: (directory?) ( mode -- ? )
+    FILE_ATTRIBUTE_DIRECTORY bit-set? ;
+
+: directory? ( path -- ? )
+    attrib (directory?) ;
+
+: (archive?) ( mode -- ? )
+    FILE_ATTRIBUTE_ARCHIVE bit-set? ;
+    
+: archive? ( path -- ? )
+    attrib (archive?) ;
+
+! FILE_ATTRIBUTE_DEVICE
+! FILE_ATTRIBUTE_NORMAL
+! FILE_ATTRIBUTE_TEMPORARY
+! FILE_ATTRIBUTE_SPARSE_FILE
+! FILE_ATTRIBUTE_REPARSE_POINT
+! FILE_ATTRIBUTE_COMPRESSED
+! FILE_ATTRIBUTE_OFFLINE
+! FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
+! FILE_ATTRIBUTE_ENCRYPTED
+
diff --git a/unmaintained/io/shell.factor b/unmaintained/io/shell.factor
new file mode 100644 (file)
index 0000000..5213eb2
--- /dev/null
@@ -0,0 +1,40 @@
+USING: calendar io io-internals kernel math namespaces
+nonblocking-io prettyprint quotations sequences ;
+IN: shell
+
+SYMBOL: shell
+HOOK: directory* shell ( path -- seq )
+HOOK: make-file shell ( bytes -- file )
+HOOK: file. shell ( file -- )
+HOOK: touch-file shell ( path -- )
+
+: (ls) ( path -- )
+    >r H{ } r> directory*
+    [
+        [ [ make-file file. ] with-row ] each
+    ] curry tabular-output ;
+
+: ls ( -- )
+    cwd (ls) ;
+
+: pwd ( -- )
+    cwd pprint nl ;
+
+: (slurp) ( quot -- )
+    >r default-buffer-size read r> over [
+        dup slip (slurp)
+    ] [
+        2drop
+    ] if ;
+
+: slurp ( stream quot -- )
+    [ (slurp) ] curry with-stream ;
+
+: cat ( path -- )
+     <file-reader> stdio get
+     duplex-stream-out <duplex-stream>
+     [ write ] slurp ;
+
+: copy-file ( path path -- )
+    >r <file-reader> r>
+    <file-writer> <duplex-stream> [ write ] slurp ;
diff --git a/unmaintained/io/test/io.factor b/unmaintained/io/test/io.factor
new file mode 100644 (file)
index 0000000..379e123
--- /dev/null
@@ -0,0 +1,42 @@
+USING: calendar errors io kernel libs-io math namespaces sequences\r
+shell test ;\r
+IN: temporary\r
+\r
+SYMBOL: file "file-appender-test.txt" \ file set\r
+[ \ file get delete-file ] catch drop\r
+[ f ] [ \ file get exists? ] unit-test\r
+\ file get <file-appender> [ "asdf" write ] with-stream\r
+[ t ] [ \ file get exists? ] unit-test\r
+[ 4 ] [ \ file get file-length ] unit-test\r
+\ file get <file-appender> [ "jkl;" write ] with-stream\r
+[ t ] [ \ file get exists? ] unit-test\r
+[ 8 ] [ \ file get file-length ] unit-test\r
+[ "asdfjkl;" ] [ \ file get <file-reader> contents ] unit-test\r
+\ file get delete-file\r
+[ f ] [ \ file get exists? ] unit-test\r
+\r
+SYMBOL: directory "test-directory" \ directory set\r
+\ directory get create-directory\r
+[ t ] [ \ directory get directory? ] unit-test\r
+\ directory get delete-directory\r
+[ f ] [ \ directory get directory? ] unit-test\r
+\r
+SYMBOL: time "time-test.txt" \ time set\r
+[ \ time get delete-file ] catch drop\r
+\ time get touch-file\r
+[ 0 ] [ \ time get file-length ] unit-test\r
+[ t ] [ \ time get exists? ] unit-test\r
+\ time get 0 unix-time>timestamp dup set-file-times\r
+[ t ] [ \ time get file-write-time 0 unix-time>timestamp = ] unit-test\r
+[ t ] [ \ time get file-access-time 0 unix-time>timestamp = ] unit-test\r
+\ time get touch-file\r
+[ t ] [ now \ time get file-write-time timestamp- 10 < ] unit-test\r
+\ time get delete-file\r
+\r
+SYMBOL: longname "" 255 CHAR: a pad-left \ longname set\r
+\ longname get touch-file\r
+[ t ] [ \ longname get exists? ] unit-test\r
+[ 0 ] [ \ longname get file-length ] unit-test\r
+\ longname get delete-file\r
+[ f ] [ \ longname get exists? ] unit-test\r
+\r
diff --git a/unmaintained/io/test/mmap.factor b/unmaintained/io/test/mmap.factor
new file mode 100644 (file)
index 0000000..43ba7b6
--- /dev/null
@@ -0,0 +1,21 @@
+USING: alien errors io kernel libs-io mmap namespaces test ;\r
+\r
+IN: temporary\r
+SYMBOL: mmap "mmap-test.txt" \ mmap set\r
+\r
+[ \ mmap get delete-file ] catch drop\r
+\ mmap get <file-writer> [\r
+    "Four" write\r
+] with-stream\r
+\r
+\ mmap get [\r
+    >r CHAR: R r> mmap-address 3 set-alien-unsigned-1\r
+] with-mmap\r
+\r
+\ mmap get [\r
+    mmap-address 3 alien-unsigned-1 CHAR: R = [\r
+        "mmap test failed" throw\r
+    ] unless\r
+] with-mmap\r
+\r
+[ \ mmap get delete-file ] catch drop\r
diff --git a/unmaintained/irc/irc-client.factor b/unmaintained/irc/irc-client.factor
new file mode 100644 (file)
index 0000000..c3a0bb7
--- /dev/null
@@ -0,0 +1,264 @@
+USING: arrays calendar concurrency errors generic hashtables
+help html http io kernel match math memory namespaces
+parser prettyprint quotations sequences sequences-contrib
+splay-trees strings threads words network ;
+IN: irc
+
+! "setup" objects
+TUPLE: profile server port nickname password default-channels ;
+TUPLE: channel-profile name password auto-rejoin ;
+
+! "live" objects
+TUPLE: irc-client profile nick stream stream-process controller-process ;
+TUPLE: nick name channels log ;
+TUPLE: channel name topic members log attributes ;
+
+! "irc message" objects
+  ! the delegate of all irc messages
+TUPLE: irc-message timestamp ;
+TUPLE: logged-in name text ;
+TUPLE: ping name ;
+TUPLE: join name channel ;
+TUPLE: part name channel text ;
+TUPLE: quit text ;
+
+TUPLE: privmsg name text ;
+TUPLE: kick channel er ee text ;
+TUPLE: roomlist channel names ;
+TUPLE: nick-in-use name ;
+TUPLE: notice type text ;
+TUPLE: mode name channel mode text ;
+! TUPLE: members
+
+TUPLE: unhandled text ;
+
+! "control message" objects
+TUPLE: command sender ;
+TUPLE: service predicate quot enabled? ;
+TUPLE: chat-command from to text ;
+TUPLE: join-command channel password ;
+TUPLE: part-command channel text ;
+
+SYMBOL: irc-client
+: irc-stream> ( -- stream ) irc-client get irc-client-stream ;
+: trim-: ( seq -- seq ) [ CHAR: : = ] ltrim* ;
+: parse-name ( string -- string )
+    trim-: "!" split first ;
+: irc-split ( string -- seq )
+    1 swap [ [ CHAR: : = ] find* ] keep
+    swap [ cut trim-: ] [ nip f ] if >r trim trim-:
+    " " split r> [ 1array append ] when* ;
+: me? ( name -- ? )
+    irc-client get irc-client-nick nick-name = ;
+
+: irc-write ( s -- )
+    irc-stream> stream-write ;
+
+: irc-print ( s -- )
+    irc-stream> [ stream-print ] keep stream-flush ;
+
+: nick ( nick -- )
+    "NICK " irc-write irc-print ;
+
+: login ( nick -- )
+    dup nick
+    "USER " irc-write irc-write
+    " hostname servername :irc.factor" irc-print ;
+
+: connect* ( server port -- )
+    <inet> <client> irc-client get set-irc-client-stream ;
+
+: connect ( server -- ) 6667 connect* ;
+
+: join ( channel password -- )
+    "JOIN " irc-write
+    [ >r " :" r> 3append ] when* irc-print ;
+
+: part ( channel text -- )
+    >r "PART " irc-write irc-write r>
+    " :" irc-write irc-print ;
+
+: say ( line nick -- )
+    "PRIVMSG " irc-write irc-write " :" irc-write irc-print ;
+
+: quit ( text -- )
+    "QUIT :" irc-write irc-print ;
+
+
+GENERIC: handle-irc ( obj -- )
+
+M: object handle-irc ( obj -- )
+    "Unhandled irc object" print drop ;
+
+M: logged-in handle-irc ( obj -- )
+    logged-in-name irc-client get [ irc-client-nick set-nick-name ] keep
+    
+    irc-client-profile profile-default-channels
+    [
+        [ channel-profile-name ] keep
+        channel-profile-password join
+    ] each ;
+
+M: ping handle-irc ( obj -- )
+    "PONG " irc-write
+    ping-name irc-print ;
+
+M: nick-in-use handle-irc ( obj -- )
+    nick-in-use-name "_" append nick ;
+
+: delegate-timestamp ( obj -- obj )
+    now <irc-message> over set-delegate ;
+
+MATCH-VARS: ?name ?name2 ?channel ?text ?mode ;
+SYMBOL: line
+: match-irc ( string -- )
+    dup line set
+    dup print flush
+    irc-split
+    {
+        { { "PING" ?name }
+          [ ?name <ping> ] }
+        { { ?name "001" ?name2 ?text }
+          [ ?name2 ?text <logged-in> ] }
+        { { ?name "433" _ ?name2 "Nickname is already in use." }
+          [ ?name2 <nick-in-use> ] }
+
+        { { ?name "JOIN" ?channel }
+          [ ?name ?channel <join> ] }
+        { { ?name "PART" ?channel ?text }
+          [ ?name ?channel ?text <part> ] }
+        { { ?name "PRIVMSG" ?channel ?text }
+          [ ?name ?channel ?text <privmsg> ] }
+        { { ?name "QUIT" ?text }
+          [ ?name ?text <quit> ] }
+
+        { { "NOTICE" ?name ?text }
+          [ ?name ?text <notice> ] }
+        { { ?name "MODE" ?channel ?mode ?text }
+          [ ?name ?channel ?mode ?text <mode> ] }
+        { { ?name "KICK" ?channel ?name2 ?text }
+          [  ?channel ?name ?name2 ?text <kick> ] }
+
+        ! { { ?name "353" ?name2 _ ?channel ?text }
+         ! [ ?text ?channel ?name2 make-member-list ] }
+        { _ [ line get <unhandled> ] }
+    } match-cond
+    delegate-timestamp handle-irc flush ;
+
+: irc-loop ( -- )
+    irc-stream> stream-readln
+    [ match-irc irc-loop ] when* ;
+
+: do-irc ( irc-client -- )
+    dup irc-client set
+    dup irc-client-profile profile-server
+    over irc-client-profile profile-port connect*
+    dup irc-client-profile profile-nickname login
+    [ irc-loop ] [ irc-stream> stream-close ] cleanup ;
+
+: with-infinite-loop ( quot timeout -- quot timeout )
+    "looping" print flush
+    over catch drop dup sleep with-infinite-loop ;
+
+: start-irc ( irc-client -- )
+    ! [ [ do-irc ] curry 3000 with-infinite-loop ] with-scope ;
+    [ do-irc ] curry 3000 with-infinite-loop ;
+
+
+GENERIC: handle-command ( obj -- )
+: prepare-message ( from text -- string )
+    >r dup [ >r "from " r> ": " 3append ] when r>
+    append >string ;
+
+M: chat-command handle-command ( obj -- )
+    [ chat-command-from ] keep
+    [ chat-command-text prepare-message ] keep
+    chat-command-to say ;
+
+M: join-command handle-command ( obj -- )
+    [ join-command-channel ] keep
+    join-command-password join ;
+
+M: part-command handle-command ( obj -- )
+    [ part-command-channel ] keep part-command-text part ;
+
+M: service handle-command ( service -- )    
+    drop ;
+
+: command-handler ( -- )
+    receive [ handle-command ] catch [
+        "error caught: " . flush
+    ] when* command-handler ;
+
+: send-command ( obj irc-client -- )
+    >r self <command> over set-delegate r>
+    irc-client-controller-process send ;
+
+: subscribe-logger ( irc-client -- )
+    >r "#concatenative-flood" "log" <service> r>
+    send-command ;
+
+! : start-private ( irc-client -- )
+    ! dup irc-client set [ start-irc ] spawn ;
+
+: maybe-start-node ( port -- )
+    \ localnode get [
+        drop
+    ] [
+        >r "localhost" r> start-node
+    ] if ;
+
+: start-public ( irc-client id -- )
+    [
+        >r
+            dup irc-client set
+            4030 maybe-start-node
+            [ command-handler ] spawn
+        r> over register-process
+        swap [ set-irc-client-controller-process ] keep
+        [ [ start-irc ] spawn ] keep set-irc-client-stream-process
+    ] with-scope ;
+
+! "trifocus.net" 4030 <node> "public-irc" <remote-process> "guest" "#concatenative" "hi" <chat-command> over send
+
+: make-test-client
+    "irc.freenode.org"
+        6667
+        "factorbot2"
+        f
+        [
+            "#concatenative-flood" f f <channel-profile> ,
+            ! "#concatenative-test1" f f <channel-profile> ,
+            ! "#concatenative-test2" f f <channel-profile> ,
+            ! "#concatenative" f f <channel-profile> ,
+        ] { } make <profile>
+    f V{ } clone V{ } clone <nick>
+    f
+    f
+    f
+    <irc-client> ;
+
+: test3 make-test-client "test3" start-public ;
+: test4 make-test-client "test4" start-public ;
+: test5 make-test-client "test5" start-public ;
+: test6 make-test-client "test6" start-public ;
+
+: 3test { test3 test4 test5 } [ execute ] each ;
+
+: make-furnacebot
+    "irc.freenode.org"
+        6667
+        "furnacebot"
+        f
+        [
+            "#concatenative" f f <channel-profile> ,
+        ] { } make <profile>
+    f V{ } clone V{ } clone <nick>
+    f
+    f
+    f
+    <irc-client> ;
+
+: furnacebot
+    make-furnacebot "public-irc" start-public ;
+
diff --git a/unmaintained/irc/load.factor b/unmaintained/irc/load.factor
new file mode 100644 (file)
index 0000000..4d90ac3
--- /dev/null
@@ -0,0 +1,7 @@
+REQUIRES: libs/concurrency apps/http-server libs/sequences
+libs/splay-trees ;
+
+PROVIDE: libs/irc
+{ +files+ {
+    "irc-client.factor"
+} } ;
diff --git a/unmaintained/isequences/authors.txt b/unmaintained/isequences/authors.txt
new file mode 100644 (file)
index 0000000..bfc196f
--- /dev/null
@@ -0,0 +1 @@
+Robbert van Dalen
diff --git a/unmaintained/isequences/base/base.factor b/unmaintained/isequences/base/base.factor
new file mode 100644 (file)
index 0000000..18dadf5
--- /dev/null
@@ -0,0 +1,586 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+
+IN: isequences.base
+USING: generic kernel math math.functions sequences
+isequences.interface shuffle ;        
+
+: index-error ( -- * )
+    "index out of bounds" throw ; foldable
+
+: traversal-error ( -- * )
+    "traversal error" throw ; foldable
+
+: to-sequence ( s -- s )
+    dup i-length 0 <
+    [ -- to-sequence reverse ]
+    [ dup [ swap i-at ] swap add* swap i-length swap map ]
+    if ; inline
+
+: neg? ( s -- ? ) i-length 0 < ; foldable
+    
+: is-atom? ( seq -- ? )
+    dup 0 i-at eq? ;
+
+: twice ( n -- n )
+    dup + ; inline
+
+: 2size ( s1 s2 -- s1 s2 size1 size2 )
+    2dup [ i-length ] 2apply ; inline
+
+: rindex ( s n -- s n )
+    swap dup i-length rot - ; inline
+
+: left-right ( s -- left right )
+    [ ileft ] keep iright ; inline
+
+: (i-at) ( s i -- v )
+    i-length swap dup ileft dup i-length roll 2dup <=
+    [ swap - rot iright swap ]
+    [ nip ]
+    if i-at nip ; inline
+
+: (ihead2) ( s i -- h )
+    swap dup ileft dup i-length roll 2dup =
+    [ 2drop nip ]
+    [ 2dup < [ swap - rot iright swap ihead ++ ] [ nip ihead nip ] if ]
+    if ; inline
+    
+: (ihead) ( s i -- h ) 
+    dup pick i-length = [ drop ] [ (ihead2) ] if ; inline
+    
+: (itail3) ( s i -- h )
+    swap left-right swap dup i-length roll 2dup =
+    [ 3drop ]
+    [ 2dup < [ swap - nip itail ] [ nip itail swap ++ ] if ]
+    if ; inline
+
+: (itail2) ( s sl i -- t )
+    tuck = [ 2drop 0 ] [ (itail3) ] if ; inline
+
+: (itail) ( s i -- t )
+    over i-length dup >r 1 = 
+    [ r> drop 1 = [ drop 0 ] when ] [ r> swap (itail2) ] if ;
+
+
+: PRIME1 ( -- prime1 ) HEX: 58ea12c9 ; foldable
+: PRIME2 ( -- prime2 ) HEX: 79af7bc3 ; foldable
+    
+: hh ( fixnum-h -- fixnum-h )
+    PRIME1 * PRIME2 + >fixnum ; inline
+
+: quick-hash ( fixnum-h1 fixnum-h2 -- fixnum-h )
+    [ hh ] 2apply bitxor hh ; inline
+
+: ($$) ( s -- hash )
+    left-right [ $$ ] 2apply quick-hash ; inline
+
+: (ig1) ( s1 s2 -- s )
+    >r left-right 2size <
+    [ dup >r ileft ipair r> iright r> ++ ipair ]
+    [ r> ++ ipair ] if ; inline
+
+: (ig2) ( s1 s2 -- s )
+    left-right 2size >
+    [ >r dup >r ileft ++ r> iright r> ipair ipair ]
+    [ >r ++ r> ipair ] if ; inline
+
+: (ig3) ( s1 s2 size1 size2 -- s )
+    2dup twice >=
+    [ 2drop (ig1) ]
+    [ swap twice >= [ (ig2) ] [ ipair ] if ] if ; inline
+
+: ++g++ ( s1 s2 -- s )
+    dup i-length dup zero? 
+    [ 2drop ]
+    [ pick i-length dup zero? [ 2drop nip ] [ swap (ig3) ] if ] if ; inline 
+
+: ++g+- ( s1 s2 -- s )
+    2size + dup 0 <
+    [ neg swap -- swap rindex itail -- nip ]
+    [ nip ihead ]
+    if ; inline
+
+: ++g-+ ( s1 s2 -- s )
+    2size + dup 0 <
+    [ nip swap -- swap neg ihead -- ]
+    [ rindex itail nip ]
+    if ; inline
+
+: ++g-- ( s1 s2 -- s )
+    -- swap -- swap ++ -- ; inline
+
+: ++g ( s1 s2 -- s )
+    2dup [ neg? ] 2apply
+    [ [ ++g-- ] [ ++g+- ] if ] [ [ ++g-+ ] [ ++g++ ] if ] if ;
+
+
+! #### lazy negative isequence ####
+!
+TUPLE: ineg sequence ;
+
+M: ineg -- ineg-sequence ;
+M: ineg i-length ineg-sequence i-length neg ;
+M: ineg i-at i-length dup 0 <= [ neg swap -- swap i-at ] [ index-error ] if ;
+M: ineg ileft -- iright -- ;
+M: ineg iright -- ileft -- ;
+M: ineg ihead [ -- ] 2apply ihead -- ;
+M: ineg itail [ -- ] 2apply itail -- ;
+M: ineg $$ ineg-sequence $$ neg ;
+
+TUPLE: irev sequence ;
+
+: <i-rev> 
+    dup i-length 1 > [ <irev> ] when ; inline
+
+M: irev i-at swap irev-sequence swap i-length over i-length - 1+ neg i-at ;
+M: irev i-length irev-sequence i-length ;
+M: irev ileft irev-sequence iright `` ;
+M: irev iright irev-sequence ileft `` ;
+M: irev ihead >r irev-sequence r> rindex itail `` ;  
+M: irev itail >r irev-sequence r> rindex ihead `` ;
+M: irev $$ irev-sequence neg hh ;
+
+M: irev descending? irev-sequence ascending? ;
+M: irev ascending? irev-sequence descending? ;
+
+M: object `` <i-rev> ;
+M: ineg `` -- `` -- ; 
+M: integer `` ;
+M: irev `` irev-sequence ;
+
+! #### composite isequence (size-balanced binary tree) ####
+!
+TUPLE: ibranch left right size ;
+
+: <isequence> ( s1 s2 -- s )
+    2size + <ibranch> ; inline
+
+M: ibranch i-length ibranch-size ;
+M: ibranch i-at (i-at) ;
+M: ibranch iright ibranch-right ;
+M: ibranch ileft ibranch-left ;
+M: ibranch ihead (ihead) ;
+M: ibranch itail (itail) ;
+M: ibranch $$ ($$) ;
+
+
+! #### object isequence ####
+!
+GENERIC: object/++ ( s1 s2 -- s )
+GENERIC: object/ipair ( s1 s2 -- s )
+
+M: object object/++ swap ++g ;
+M: object object/ipair swap <isequence> ;
+M: object ++ swap object/++ ;
+M: object ipair swap object/ipair ;
+
+M: object i-length drop 1 ;
+M: object -- <ineg> ;
+M: object i-at i-length zero? [ index-error ] unless ;
+M: object ileft drop 0 ;
+M: object iright drop 0 ;
+M: object ihead dup zero? [ 2drop 0 ] [ 1 = [ index-error ] unless ] if ;
+M: object itail dup zero? [ drop ] [ 1 = [ drop 0 ] [ index-error ] if ] if ;
+
+
+! #### single element isequence ####
+!
+TUPLE: ileaf value ;
+
+: <i> ( v -- s ) <ileaf> ; inline
+
+M: ileaf i-at i-length zero? [ ileaf-value ] [ index-error ] if ;
+M: ileaf $$ 0 i-at $$ ;
+
+
+! #### integer isequence ####
+!
+
+GENERIC: integer/++ ( s1 s2 -- v )
+M: object integer/++ object/++ ;
+M: integer ++ swap integer/++ ;
+
+GENERIC: integer/ipair ( s1 s2 -- s )
+M: object integer/ipair swap <isequence> ;
+M: integer ipair swap integer/ipair ;
+
+M: integer integer/++ + ;
+M: integer integer/ipair + ;
+
+M: integer i-length ;
+M: integer -- neg ;
+M: integer i-at i-length dup 0 >= [ > [ 0 ] [ index-error ] if ] [ index-error ] if ;
+M: integer ileft
+    dup zero? [ traversal-error ] [ 2/ ] if ;
+M: integer iright
+    dup zero? [ traversal-error ] [ 1+ 2/ ] if ;
+M: integer ihead swap drop ;
+M: integer itail - ;
+M: integer $$ >fixnum ;
+
+
+! #### negative integers ####
+!
+PREDICATE: integer ninteger 0 < ;
+
+M: ninteger i-at i-length dup 0 <= [ < [ 0 ] [ index-error ] if ] [ index-error ] if ;
+
+
+! #### sequence -> isequence ####
+!
+
+: chk-index dup zero? [ traversal-error ] [ 2/ ] if ; inline
+
+M: sequence i-length length ;
+M: sequence i-at i-length swap nth ;
+M: sequence ileft dup length chk-index head ;
+M: sequence iright dup length chk-index tail ;
+M: sequence ihead head ;
+M: sequence itail tail ;
+M: sequence $$ [ $$ ] map unclip [ quick-hash ] reduce ;
+
+
+! #### (natural) compare/ordering ####
+
+DEFER: (i-eq?)
+
+: (i-eq4?) ( s1 s2 -- ? )
+   2dup [ is-atom? ] 2apply
+   [ [ = ] [ 2drop f ] if ]
+   [ [ 2drop f ] [ [ 0 i-at ] 2apply (i-eq?) ] if ] if ;
+
+: (i-eq3?) ( s1 s2 -- ? )
+    dup ileft pick over i-length tuck ihead rot (i-eq?)
+    [ itail swap iright swap (i-eq?) ]
+    [ 3drop f ]
+    if ;
+: (i-eq2?) ( s1 s2 sl -- ? )
+    dup zero? [ 3drop 0 ]
+    [ 1 = [ (i-eq4?) ] [ (i-eq3?) ] if ]
+    if ; inline
+
+: (i-eq?) ( s1 s2 -- ? )
+    2dup eq? [ 2drop t ]
+    [ 2dup [ i-length ] 2apply tuck = [ (i-eq2?) ] [ 3drop f ] if ]
+    if ; inline
+
+: (i-cmp5) ( s1 s2 -- i )
+    dup ileft pick over i-length tuck ihead rot i-cmp dup zero?
+    [ drop itail swap iright swap i-cmp ]
+    [ -roll 3drop ] if ; inline
+
+: (i-cmp4) ( s1 s2 s -- i )
+    dup zero? [ 3drop 0 ]
+    [ 1 = [ [ 0 i-at ] 2apply i-cmp ] [ (i-cmp5) ] if ]
+    if ; inline 
+
+: (i-cmp3) ( s1 s2 ls1 ls2 -- i )
+    2dup = [ drop (i-cmp4) ]
+    [ min dup >r ihead r> (i-cmp4) dup zero? [ drop -1 ] when ]
+    if ; inline
+
+: (i-cmp2) ( s1 s2 ls1 ls2 -- i )
+     2dup > [ swap 2swap swap 2swap (i-cmp2) neg ] [ (i-cmp3) ] if ; inline
+    
+: cmp-g++ ( s1 s2 -- i )
+      2dup (i-eq?) [ 2drop 0 ]
+      [ 2dup [ i-length ] 2apply (i-cmp2) ] if ; inline
+
+: cmp-g-- ( s1 s2 -- i )
+    [ -- ] 2apply swap cmp-g++ ; inline
+    
+: cmp-g+- ( s1 s2 -- i ) 2drop 1 ; inline
+
+: cmp-g-+ ( s1 s2 -- i ) 2drop -1 ; inline
+
+: cmp-gg ( s1 s2 -- i )
+  2dup [ neg? ] 2apply [ [ cmp-g-- ] [ cmp-g+- ] if ]
+  [ [ cmp-g-+ ] [ cmp-g++ ] if ] if ;
+
+
+GENERIC: object/i-cmp ( s2 s1 -- s )
+M: object object/i-cmp swap cmp-gg ;
+M: object i-cmp swap object/i-cmp ;
+
+: ifirst ( s1 -- v )
+    dup i-length 1 = [ 0 i-at ] [ ileft ifirst ] if ; inline
+
+: ilast ( s1 -- v )
+    dup i-length 1 = [ 0 i-at ] [ iright ilast ] if ; inline
+
+: (ascending2?) ( s1 s2 -- ? )
+    ifirst swap ilast i-cmp 0 >= ;
+
+: (ascending?) ( s -- ? )
+    dup i-length 1 <=
+    [ drop t ]
+    [ left-right 2dup [ ascending? ] both? [ (ascending2?) ] [ 2drop f ] if ]
+    if ;
+
+: (descending2?) ( s1 s2 -- ? )
+    ifirst swap ilast i-cmp 0 <= ;
+
+: (descending?) ( s -- ? )
+    dup i-length 1 <=
+    [ drop t ]
+    [ left-right 2dup [ descending? ] both? [ (descending2?) ] [ 2drop f ] if ]
+    if ;
+
+M: object ascending? (ascending?) ;
+M: object descending? (descending?) ;
+M: integer ascending? drop t ;
+M: integer descending? drop t ;
+
+
+! **** dual-sided isequences ****
+!
+
+TUPLE: iturned sequence ;
+TUPLE: iright-sided value ;
+TUPLE: idual-sided left right ;
+
+M: iturned i-length iturned-sequence i-length ;
+M: iturned i-at >r iturned-sequence r> i-at :v: ;
+M: iturned ileft iturned-sequence ileft <iturned> ;
+M: iturned iright iturned-sequence iright <iturned> ;
+M: iturned ihead >r iturned-sequence r> ihead <iturned> ;
+M: iturned itail >r iturned-sequence r> itail <iturned> ;
+M: iturned $$ iturned-sequence dup -- [ $$ ] 2apply quick-hash ;
+
+: <i-right-sided> ( v -- lv )
+    dup i-length zero? [ drop 0 ] [ <iright-sided> ] if ; inline
+
+: <i-dual-sided> ( v1 v2 -- dv )
+    2dup [ i-length ] 2apply zero?
+    [ zero? [ 2drop 0 ] [ drop ] if ]
+    [ zero? [ nip <i-right-sided> ] [ <idual-sided> ] if ]
+    if ; 
+
+: i-cmp-left-right ( s1 s2 -- i )
+    2dup [ left-side ] 2apply i-cmp dup zero?
+    [ drop [ right-side ] 2apply i-cmp ]
+    [ -rot 2drop ]
+    if ; inline
+    
+: ::g ( s -- s ) 
+    dup i-length 0 < [ -- <iturned> -- ] [ <iturned> ] if ; inline
+
+M: object :: ::g ;
+M: iturned :: iturned-sequence ;
+M: integer :: ;
+
+GENERIC: iright-sided/i-cmp ( s1 s2 -- i )
+GENERIC: idual-sided/i-cmp ( s1 s2 -- i )
+
+M: object iright-sided/i-cmp swap i-cmp-left-right ;
+M: object idual-sided/i-cmp swap i-cmp-left-right ;
+M: iright-sided object/i-cmp swap i-cmp-left-right ;
+M: idual-sided object/i-cmp swap i-cmp-left-right ;
+M: iright-sided i-cmp swap iright-sided/i-cmp ;
+M: idual-sided i-cmp swap idual-sided/i-cmp ;
+
+
+M: object left-side ;
+M: object right-side drop 0 ;
+M: iright-sided left-side drop 0 ;
+M: iright-sided right-side iright-sided-value ;
+M: idual-sided left-side idual-sided-left ;
+M: idual-sided right-side idual-sided-right ;
+M: object :v: <i-right-sided> ;
+M: idual-sided :v: dup idual-sided-right swap idual-sided-left <i-dual-sided> ;
+M: iright-sided :v: iright-sided-value ;
+
+: dual++ ( v2 v1 -- v ) swap 0 <i-dual-sided> ++ ; inline
+
+M: iright-sided object/++ iright-sided-value swap <i-dual-sided> ;
+M: idual-sided object/++ dual++ ;
+M: iright-sided integer/++ iright-sided-value swap <i-dual-sided> ;
+M: idual-sided integer/++ dual++ ;
+
+GENERIC: iright-sided/++ ( s1 s2 -- s )
+GENERIC: idual-sided/++ ( s1 s2 -- s )
+
+M: iright-sided idual-sided/++
+    swap dup idual-sided-left swap idual-sided-right
+    rot iright-sided-value ++ <i-dual-sided> ;
+
+M: iright-sided iright-sided/++
+    swap [ iright-sided-value ] 2apply ++ <i-right-sided> ;
+
+M: idual-sided iright-sided/++
+    dup idual-sided-left swap idual-sided-right
+    rot iright-sided-value swap ++ <i-dual-sided> ;
+    
+M: idual-sided idual-sided/++
+        swap 2dup [ idual-sided-left ] 2apply ++
+        >r [ idual-sided-right ] 2apply ++ r> <i-dual-sided> ;
+
+M: iright-sided ++ swap iright-sided/++ ;
+M: idual-sided ++ swap idual-sided/++ ;
+
+M: object iright-sided/++
+    >r iright-sided-value r> swap <i-dual-sided> ;
+M: object idual-sided/++
+    >r dup idual-sided-left swap idual-sided-right r> ++ <i-dual-sided> ;
+
+
+! **** lazy left product of an isequence ****
+!
+
+TUPLE: imul sequence multiplier ;
+
+: <i-muls> ( seq mul -- imul ) <imul> ; foldable
+
+: *_g++ ( s n -- s ) i-length dup zero? [ nip ] [ <i-muls> ] if ; inline
+
+: *_g+- ( s n -- s ) -- *_ ; inline
+
+: *_g-+ ( s n -- s ) swap -- swap *_ -- ; inline
+
+: *_g-- ( s n -- s ) [ -- ] 2apply *_ ; inline
+    
+
+: imul-unpack ( imul -- m s )
+    dup imul-multiplier swap imul-sequence ; inline
+
+: imul-ileft ( imul -- imul )
+    imul-unpack dup i-length 1 =
+    [ swap ileft *_ ] 
+    [ ileft swap *_ ]
+    if ; inline
+
+: imul-iright ( imul -- imul )
+    imul-unpack dup i-length 1 =
+    [ swap iright *_ ]
+    [ iright swap *_ ]
+    if ; inline 
+    
+: check-bounds ( s i -- s i )
+    2dup swap i-length >= [ index-error ] when ; inline
+
+: imul-i-at ( imul i -- v  )
+    i-length check-bounds swap dup imul-multiplier swap imul-sequence
+    -rot /i i-at ; inline
+
+: *_g ( s n -- s )
+    2dup [ neg? ] 2apply [ [ *_g-- ] [ *_g+- ] if ]
+    [ [ *_g-+ ] [ *_g++ ] if ] if ; inline
+
+M: object *_ *_g ;
+
+M: integer *_ i-length abs * ;
+M: imul i-at imul-i-at ;
+M: imul i-length imul-unpack i-length swap * ;
+M: imul ileft imul-ileft ;
+M: imul iright imul-iright ;
+M: imul ihead (ihead) ;
+M: imul itail (itail) ;
+M: imul $$ imul-unpack [ $$ 2/ ] 2apply quick-hash ;
+
+M: imul ascending? imul-sequence ascending? ;
+M: imul descending? imul-sequence descending? ;
+    
+
+! **** sort, union, intersect and diff ****
+!
+
+DEFER: (ifind2)
+
+: (ifind3) ( s1 v s e -- i )
+    2dup >r >r + 2/ pick swap i-at over i-cmp 0 <
+    [ r> r> swap over + 1+ 2/ swap (ifind2) ]
+    [ r> r> over + 2/ (ifind2) ]
+    if ; inline
+
+: (ifind2) ( s1 v s e -- i )
+    2dup = [ -roll 3drop ] [ (ifind3) ] if ; inline
+
+: ifind ( s1 v -- i )
+    over i-length 0 swap (ifind2) ; inline
+
+: icontains? ( s1 v -- ? )
+    2dup ifind pick i-length dupd <
+    [ rot swap i-at i-cmp zero? ] [ 3drop f ] if ; inline
+
+: icut ( s v -- s2 s2 )
+     dupd ifind 2dup ihead -rot itail ; inline
+
+DEFER: (union)
+    
+: (union6) ( s1 s2 -- s )
+    2dup [ 0 i-at ] 2apply i-cmp 0 >
+    [ swap ] when ++ ; inline
+    
+: (union5) ( s1 s2 -- s )
+    over ileft i-length pick swap i-at icut rot left-right
+    swap roll (union) -rot swap (union) ++ ;
+
+: (union4) ( s1 s2 -- s )
+    2dup ifirst swap ilast i-cmp 0 >= [ ++ ] [ (union5) ] if ; inline
+    
+: (union3) ( s1 s2 ls1 ls2 -- s )
+    1 = 
+    [ 1 = [ (union6) ] [ (union4) ] if ]
+    [ 1 = [ swap ] when (union4) ] if ; inline
+
+: (union2) ( s1 s2 -- s )
+    2dup [ i-length ] 2apply 2dup zero?
+    [ 3drop drop ] [ zero? [ 2drop nip ] [ (union3) ] if ] if ; inline
+    
+: (union) ( s1 s2 -- s )
+    2dup eq? [ drop 2 *_ ] [ (union2) ] if ; inline
+
+DEFER: i-sort
+
+: (i-sort) ( s -- s )
+    dup i-length 1 >
+    [ left-right [ i-sort ] 2apply (union) ]
+    when ; inline
+
+DEFER: (diff)
+
+: (diff7) ( s1 s2 -- s )
+    dupd swap 0 i-at icontains? [ drop 0 ] when ; inline
+
+: (diff6) ( s1 s2 -- s )
+    2dup [ 0 i-at ] 2apply i-cmp zero?
+    [ 2drop 0 ] [ drop ] if ; inline
+
+: (diff5) ( s1 s2 -- s )
+    over ileft i-length pick swap i-at icut rot left-right
+    swap roll (diff) -rot swap (diff) ++ ; inline
+
+: (diff4) ( s1 s2 -- s )
+    2dup [ i-length ] 2apply 1 =
+    [ 1 = [ (diff6) ] [ (diff5) ] if ]
+    [ 1 = [ (diff7) ] [ (diff5) ] if ] if ; inline
+    
+: (diff3) ( s1 s2 -- s )
+    2dup ifirst swap ilast i-cmp 0 >
+    [ drop ] [ (diff4) ] if ; inline
+
+: (diff2) ( s1 s2 -- s )
+    2dup [ i-length zero? ] either?
+    [ drop ] [ (diff3) ] if ; inline
+    
+: (diff) ( s1 s2 -- s )
+    2dup eq? [ 2drop 0 ] [ (diff2) ] if ; inline
+
+
+! **** sort, diff, union and intersect assumes positive isequences ****
+
+: i-sort ( s -- s )
+    dup ascending? [ dup descending? [ `` ] [ (i-sort) ] if ] unless ;
+
+: i-diff ( s1 s2 -- s )
+   [ i-sort ] 2apply (diff) ; inline
+
+: i-union ( s1 s2 -- s )
+    [ i-sort ] 2apply (union) ; inline
+
+: i-intersect ( s1 s2 -- s )
+    [ i-sort ] 2apply over -rot i-diff i-diff ;
+
diff --git a/unmaintained/isequences/interface/interface-docs.factor b/unmaintained/isequences/interface/interface-docs.factor
new file mode 100644 (file)
index 0000000..3fe4334
--- /dev/null
@@ -0,0 +1,17 @@
+USING: help.markup help.syntax isequences.interface ;
+
+HELP: i-at 
+{ $values { "s" "an isequence" } { "n" "an isequence" } { "v" "the element at the " { $snippet "n" } "th index" } }
+{ $contract "Outputs the element at position" { $snippet "n" } "of the isequence." } ;
+
+HELP: --
+{ $values { "s" "an isequence" } { "-s" "a negated isequence" } }
+{ $contract "Outputs the negated version of " { $snippet "s"} " with its length and indices negated." } ;
+
+HELP: i-length
+{ $values { "s" "an isequence" } { "n" "an integer length" } }
+{ $contract "Outputs the length of " { $snippet "s" } " which can be negative for a negated isequence." } ;
+
+HELP: ++
+{ $values { "s1" "an isequence" } { "s2" "an isequence" } { "s" "the concatenated result of " { $snippet "s1" } " and " { $snippet "s2" } } }
+{ $contract "Outputs the freshly concatened isequence with length = length(s1) + length(s2)." } ;
diff --git a/unmaintained/isequences/interface/interface.factor b/unmaintained/isequences/interface/interface.factor
new file mode 100644 (file)
index 0000000..4d09bcf
--- /dev/null
@@ -0,0 +1,110 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.interface
+USING: generic kernel ;  
+
+! Unifies sequences, integers and objects, following Enchilada semantics.
+! Efficiency is achieved through lazy immutable size-balanced binary trees. 
+
+! - An object is an isequence of size 1 containing itself
+! - An integer is an isequence of size itself containing zeros
+! - If a sequence is never modified it is also considered an isequence
+! - An isequence can have negative sign
+
+
+GENERIC: -- ( s -- -s )                         ! monadic negate
+GENERIC: $$ ( s1 -- h )                         ! monadic hash
+GENERIC: ++ ( s1 s2 -- s )                      ! dyadic concatenate  
+
+GENERIC: i-length ( s -- n )                    ! monadic size
+GENERIC: i-cmp ( s1 s2 -- n )                   ! dyadic compare
+GENERIC# i-at 1 ( s n -- v )                           ! dyadic index
+
+GENERIC# ihead 1 ( s n -- s )                          ! dyadic head of a cut
+GENERIC# itail 1 ( s n -- s )                          ! dyadic tail of a cut
+
+GENERIC: ileft ( s -- v )                       ! balanced left side
+GENERIC: iright ( s -- v )                      ! balanced right side
+GENERIC: ipair ( s1 s2 -- s )                   ! pairing two isequences
+
+GENERIC: ascending? ( s -- ? )                  ! monadic ascending query
+GENERIC: descending? ( s -- ? )                 ! monadic descending query    
+
+GENERIC: left-side ( v -- v )
+GENERIC: right-side ( v -- v )
+GENERIC: left-side-empty? ( s -- ? )
+GENERIC: right-side-empty? ( s -- ? )
+GENERIC: :v: ( v -- v )
+
+
+! **** lazy turn of an isequence 
+!
+GENERIC: :: ( s -- ts )
+
+! **** lazy reversal of an isequence
+!
+GENERIC: `` ( s -- rs )
+
+! **** lazy right division of an isequence
+!
+GENERIC: _/ ( n s -- n/s )
+
+! **** lazy left division of an isequence ****
+!
+GENERIC: /_ ( s1 n -- s1/n )
+
+! **** full division of two isequences ****
+!
+: // ( s1 s2 -- n1/s2 s1/n2 ) 2dup /_ -rot _/ ; inline
+
+! **** matching two isequences ****
+!
+GENERIC: >> ( s1 s2 -- s1/s2 )
+
+! **** iota ****
+!
+GENERIC: ~~ ( s -- s )
+
+! **** lazy maximum of two isequences
+!
+GENERIC: || ( s1 s2 -- max-s1-s2 )
+
+! **** lazy minimum of two isequences ****
+!
+GENERIC: && ( s1 s2 -- min-s1-s2 )
+
+! **** strict modulus of two isequences ****
+!
+GENERIC: %% ( s1 s2 -- ms1 ms2 )
+
+! **** strict right product of an isequence ****
+!
+GENERIC: _* ( m s -- m*s )
+
+! **** lazy left product of an isequence ****
+!
+GENERIC# *_ 1 ( s m -- s*m )
+
+! **** full product of two isequences ****
+!
+: ** ( s1 s2 -- ms1 ms2 ) 2dup *_ -rot _* ; inline
+
+! **** lazy left union ****
+!
+GENERIC: <_ ( n s -- n/s )
+
+! **** lazy right diff ****
+!
+GENERIC: _< ( n s -- n/s )
+
+! **** lazy union and diff of two isequences ****
+!
+: << ( s1 s2 -- u-s1-s2 d-s1-s2 ) 2dup <_ -rot _< ; inline
+
+! **** lazy wiped isequence ****
+!
+GENERIC: ## ( s -- ws )
+
+
+
diff --git a/unmaintained/isequences/isequences-tests.factor b/unmaintained/isequences/isequences-tests.factor
new file mode 100644 (file)
index 0000000..b594a48
--- /dev/null
@@ -0,0 +1,47 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel sequences isequences.interface isequences.base isequences.ops tools.test strings ;
+IN: temporary
+
+! strict isequences (++)
+!
+{ 4 } [ 4 i-length ] unit-test
+{ 4 } [ { 1 2 3 4 } i-length ] unit-test
+{ -4 } [ 4 -- i-length ] unit-test
+{ -4 } [ { 1 2 3 4 } -- i-length ] unit-test
+
+{ 4 } [ { 1 2 3 } { 4 5 6 } ++ 3 i-at ] unit-test
+{ { 3 2 1 } } [ { 1 2 3 } -- to-sequence ] unit-test
+{ 0 } [ 100 30 i-at ] unit-test
+{ 2 } [ { 1 2 3 4 } 1 i-at ] unit-test
+{ 2 } [ { 1 2 3 4 } -- -1 i-at ] unit-test
+
+{ 6 } [ 10 4 -- ++ ] unit-test 
+{ { 1 2 3 4 5 6 } }  [ { 1 2 3 } { 4 5 6 } ++ to-sequence ] unit-test
+{ { 1 2 3 0 0 0 } }  [ { 1 2 3 } 3 ++ to-sequence ] unit-test
+{ { 0 1 2 3 4 5 6 7 8 9 } }  [ 10 [ <i> ] map unclip [ ++ ] reduce to-sequence ] unit-test
+{ { 0 1 2 3 } }  [ { 0 1 2 3 4 5 } 2 -- ++ to-sequence ] unit-test 
+{ { 3 2 1 } } [ { 1 2 3 4 5 } -- 2 ++ to-sequence ] unit-test
+{ { 0 1 2 3 } } [ { 0 1 2 3 4 5 6 } [ 7 8 9 ] -- ++ to-sequence ] unit-test
+{ { 6 5 4 3 2 1 } } [ { 1 2 3 } -- { 4 5 6 } -- ++ to-sequence ] unit-test
+{ { 0 1 } }  [ 100000 [ <i> ] map unclip [ ++ ] reduce -99998 ++ to-sequence ] unit-test
+{ { } } [ { 1 2 3 } { 4 5 6 } -- ++ to-sequence ] unit-test
+
+
+! (Lazy) Enchilada operators ( ** || `` ~~ :: // ## )
+!
+{ { 3 2 1 } } [ { 1 2 3 } `` to-sequence ] unit-test
+{ { 1 2 3 } } [ { 1 2 3 } `` -- to-sequence ] unit-test
+{ { 1 1 2 2 3 3 } { 4 5 4 5 4 5 } } [ { 1 2 3 } { 4 5 } ** [ to-sequence ] 2apply ] unit-test
+{ { 3 3 2 2 1 1 } { 4 5 4 5 4 5 } } [ { 1 2 3 } -- { 4 5 } ** [ to-sequence ] 2apply ] unit-test
+{ { { 1 3 } { 2 4 } } } [ { { 1 } { 2 } } { { 3 } { 4 } } || to-sequence [ to-sequence ] map ] unit-test
+{ { { 1 4 } { 2 3 } } } [ { { 1 } { 2 } } { { 3 } { 4 } } -- || to-sequence [ to-sequence ] map ] unit-test
+
+
+{ 0 } [ 2 ~~ -2 4 ~~ ++ :: || dup ## :: swap :: ## :: swap ++ to-sequence 4 ~~ i-cmp ] unit-test
+{ { { 1 4 } { 2 5 } { 3 } } } [ { { 1 } { 2 } { 3 } } { { 4 } { 5 } } || to-sequence [ to-sequence ] map ] unit-test
+{ 0 } [ 4 ~~ to-sequence 4 [ <i> <i> ] map unclip [ ++ ] reduce i-cmp ] unit-test
+{ { 1 1 1 1 2 2 2 3 3 4 } { 1 1 } }  [ { 1 1 2 1 } { 2 3 2 4 3 1 } << [ to-sequence ] 2apply ] unit-test
+
+{ { 0 1 2 "a" 3 4 5 "b" 6 7 8 "c" 9 10 11 "d" } } [ { 0 1 2 3 4 5 6 7 8 9 10 11 } 3 swap ** nip 3 // drop { "a" "b" "c" "d" } ++ 4 swap ** nip 4 // drop to-sequence ] unit-test
diff --git a/unmaintained/isequences/isequences.factor b/unmaintained/isequences/isequences.factor
new file mode 100644 (file)
index 0000000..2343021
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences
+USING: generic kernel isequences.interface isequences.interface isequences.ops ;  
+
+
diff --git a/unmaintained/isequences/ops/cache/cache.factor b/unmaintained/isequences/ops/cache/cache.factor
new file mode 100644 (file)
index 0000000..5286170
--- /dev/null
@@ -0,0 +1,45 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.cache
+USING: generic kernel math sequences isequences.base isequences.interface ;
+
+! ** An isequence that caches lazy values of its delegate isequence **
+
+GENERIC: CC ( s -- cached-s )
+
+TUPLE: icache left right size hash ;
+
+: <i-cache> ( s -- cs )
+    ! only cache isequences with size > 16
+    dup i-length 16 > [ f f f f <icache> tuck set-delegate ] when ; inline
+    
+: cached-length ( s -- n )
+    dup icache-size dup not
+    [ drop dup delegate i-length tuck swap set-icache-size ]
+    [ nip ] if ; inline
+: cached-ileft ( s -- s ) 
+    dup icache-left dup not
+    [ drop dup delegate ileft CC tuck swap set-icache-left ]
+    [ nip ] if ; inline
+: cached-iright ( s -- s )
+    dup icache-right dup not
+    [ drop dup delegate iright CC tuck swap set-icache-right ]
+    [ nip ] if ; inline
+: cached-$$ ( s -- hash ) 
+    dup icache-hash dup not
+    [ drop dup delegate $$ tuck swap set-icache-hash ]
+    [ nip ] if ; inline
+
+M: object CC <i-cache> ;
+M: integer CC ;
+M: icache CC ;
+
+M: icache i-at (i-at) ;
+M: icache i-length cached-length ;
+M: icache ileft cached-ileft ;
+M: icache iright cached-iright ;
+M: icache ihead (ihead) ;
+M: icache itail (itail) ;
+M: icache $$ ($$) ;
+
diff --git a/unmaintained/isequences/ops/divide/divide.factor b/unmaintained/isequences/ops/divide/divide.factor
new file mode 100644 (file)
index 0000000..bd3b109
--- /dev/null
@@ -0,0 +1,94 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.divide
+USING: generic kernel math math.functions sequences isequences.interface isequences.base ;
+
+
+TUPLE: idiv sequence div offset size ;
+
+: n-cut ( seq pos -- seq )
+    2dup ihead -rot itail <isequence> ; inline
+    
+: n-div ( seq div -- seq )
+    swap dup i-length 2/ dup roll mod - n-cut ; inline
+
+: <i-div> ( sequence div offset size -- idiv )
+    pick 1 = 
+    [ 3drop ] [ >r >r tuck n-div swap r> r> <idiv> ] if ; inline
+
+: idiv-unpack ( idiv -- sequence div offset size )
+    dup idiv-sequence swap dup idiv-div swap dup idiv-offset swap idiv-size ; inline
+    
+: (idiv-offset) ( pos idiv -- offset-pos )
+    tuck dup idiv-offset swap idiv-div
+    dup * -rot + * swap idiv-size 2dup
+    mod neg rot + swap /i ; inline
+
+: (idiv-index) ( pos idiv -- index )
+    idiv-div * ; inline
+
+: idiv-nth ( idiv pos -- v )
+    swap tuck 2dup (idiv-index) -rot (idiv-offset)
+    + swap idiv-sequence swap i-at ; inline
+
+: idiv-ileft ( idiv -- idiv )
+    dup idiv-sequence ileft swap dup idiv-div
+    pick i-length swap tuck = 
+    [ drop nip 0 i-at <i> ]
+    [ swap dup idiv-offset swap idiv-size <i-div> ]
+    if ;
+
+: (idiv-newoffset) ( idiv -- newoff )
+    dup ileft i-length swap idiv-offset + ;
+
+: idiv-iright ( idiv -- idiv )
+    dup idiv-sequence iright swap dup idiv-div
+    pick i-length swap tuck =
+    [ drop nip dup ileft i-length i-at <i> ]
+    [ swap dup (idiv-newoffset) swap idiv-size <i-div> ]
+    if ; inline 
+   
+M: idiv i-length dup idiv-sequence i-length swap idiv-div /i ;
+M: idiv i-at idiv-nth ;
+M: idiv ileft idiv-ileft ;
+M: idiv iright idiv-iright ;
+M: idiv ihead (ihead) ;
+M: idiv itail (itail) ;
+M: idiv $$
+    idiv-unpack [ $$ ] 2apply quick-hash -rot [ $$ ]
+    2apply [ quick-hash ] 2apply ;
+
+: gcd_0 ( n1 n2 -- n )
+    dup zero? [ 2drop 1 ] [ gcd ] if ; inline
+    
+: /_g++ ( s1 n -- idiv )
+    i-length over i-length tuck gcd_0 0 rot <i-div> ; inline
+
+: /_g+- ( s n -- s ) -- /_ ; inline
+
+: /_g-+ ( s n -- s ) swap -- `` swap /_ -- `` ; inline
+
+: /_g-- ( s n -- s ) [ -- ] 2apply /_ ; inline
+
+: /_g ( s1 s2 -- s )
+    2dup [ neg? ] 2apply [ [ /_g-- ] [ /_g+- ] if ] [ [ /_g-+ ] [ /_g++ ] if ] if ; inline
+M: object /_ /_g ;
+
+
+: _/g++ ( n s -- s )
+    dup i-length dup roll i-length gcd_0 tuck /i tuck roll _* rot /_ swap /_ ;
+
+: _/g+- ( n s -- s ) -- `` _/ `` -- ; inline
+
+: _/g-+ ( n s -- s ) swap -- swap _/ ; inline
+
+: _/g-- ( n s -- s ) [ -- ] 2apply _/ ; inline
+
+: _/g ( n s -- s )
+    2dup [ neg? ] 2apply [ [ _/g-- ] [ _/g+- ] if ]
+    [ [ _/g-+ ] [ _/g++ ] if ] if ; inline
+
+M: object _/ _/g ;
+
diff --git a/unmaintained/isequences/ops/iota/iota.factor b/unmaintained/isequences/ops/iota/iota.factor
new file mode 100644 (file)
index 0000000..76ba0e3
--- /dev/null
@@ -0,0 +1,53 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.iota
+USING: generic kernel math sequences isequences.interface isequences.base ;
+
+
+
+! **** positive iota ****
+!
+
+TUPLE: p-iota offset size ;
+
+: <ip-iota> ( offset size -- p-iota ) 
+    dup zero? [ nip ] [ dup 1 = [ drop <i> <i> ] [ <p-iota> ] if ] if ; inline
+
+M: p-iota i-length p-iota-size ;
+M: p-iota i-at swap p-iota-offset + <i> ;
+M: p-iota ileft dup i-length 2/ >r p-iota-offset r> <ip-iota> ;
+M: p-iota iright dup i-length 1 + 2/ >r dup p-iota-offset swap ileft i-length + r> <ip-iota> ;
+M: p-iota ihead (ihead) ;
+M: p-iota itail (itail) ;
+M: p-iota $$ dup p-iota-offset swap p-iota-size [ $$ ] 2apply quick-hash ;
+M: p-iota ascending? drop t ;
+M: p-iota descending? drop f ;
+
+
+! **** negative iota ****
+!
+TUPLE: n-iota offset size ;
+
+: <in-iota> ( offset size -- n-iota ) 
+    dup zero? [ nip ] [ dup 1 = [ drop <i> <i> ] [ <n-iota> ] if ] if ; inline
+
+M: n-iota i-length n-iota-size ;
+M: n-iota i-at swap n-iota-offset + neg -1 + <i> ;
+M: n-iota ileft dup i-length 2/ >r n-iota-offset r> <in-iota> ;
+M: n-iota iright dup i-length 1 + 2/ >r dup n-iota-offset swap ileft i-length + r> <in-iota> ;
+M: n-iota ihead (ihead) ;
+M: n-iota itail (itail) ;
+M: n-iota $$ dup n-iota-offset swap n-iota-size [ $$ -- ] 2apply quick-hash ;
+M: n-iota ascending? drop f ;
+M: n-iota descending? drop t ; 
+
+M: object ~~
+    0 over i-length dup 0 <
+    [ -- <in-iota> -- swap -- ## -- || ]
+    [ <ip-iota> swap ## || ]
+    if ;
+M: integer ~~
+    0 over 0 < [ swap -- <in-iota> -- ] [ swap <ip-iota> ] if ;
+M: p-iota ~~ i-length ~~ ;
+M: n-iota ~~ i-length ~~ ;
diff --git a/unmaintained/isequences/ops/match/match.factor b/unmaintained/isequences/ops/match/match.factor
new file mode 100644 (file)
index 0000000..aa4f6a1
--- /dev/null
@@ -0,0 +1,90 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.match
+USING: generic kernel math sequences isequences.interface isequences.base ;
+
+
+TUPLE: imatch sorted-s1 s2 ;
+
+DEFER: ifind-c
+
+: <i-match> ( s1 s2 -- imatch )
+    dup i-length dup zero? [ 3drop 0 ]
+    [ 1 = [ swap i-sort swap 0 i-at ifind-c <i> ] [ swap i-sort swap <imatch> ] if ] if ; inline 
+
+: imatch-unpack ( imatch -- sorted-s1 s2 )
+    dup imatch-sorted-s1 swap imatch-s2 ; inline 
+
+DEFER: (ifind2-left-m)
+
+: (ifind3-left-m) ( s1 v s e -- i )
+    2dup >r >r + 2/ pick swap i-at left-side over i-cmp 0 <=
+    [ r> r> swap over + 1+ 2/ swap (ifind2-left-m) ]
+    [ r> r> over + 2/ (ifind2-left-m) ]
+    if ; inline
+
+: (ifind2-left-m) ( s1 v s e -- i )
+    2dup = [ -roll 3drop ] [ (ifind3-left-m) ] if ; inline
+
+: ifind-left-m ( s1 v -- i )
+    over i-length 0 swap (ifind2-left-m) ; inline
+
+DEFER: (ifind2-left)
+
+: (ifind3-left) ( s1 v s e -- i )
+    2dup >r >r + 2/ pick swap i-at left-side over i-cmp 0 <
+    [ r> r> swap over + 1+ 2/ swap (ifind2-left) ]
+    [ r> r> over + 2/ (ifind2-left) ]
+    if ; inline
+
+: (ifind2-left) ( s1 v s e -- i )
+    2dup = [ -roll 3drop ] [ (ifind3-left) ] if ; inline
+
+: ifind-left ( s1 v -- i )
+    over i-length 0 swap (ifind2-left) ; inline
+
+: icontains-left? ( s1 v -- ? )
+    2dup ifind-left pick i-length dupd <
+    [ rot swap i-at left-side i-cmp zero? ] [ 3drop f ] if ; inline
+
+: (ifind-s2) ( s1 v -- sv )
+    2dup ifind-left rot swap itail dup rot ifind-left-m ihead ## :: ; inline
+    
+: ifind-s ( s1 v -- sv )
+    2dup icontains-left?
+    [ (ifind-s2) ] [ 2drop 0 ] if ; inline
+
+: iflatten ( s -- s )
+    dup i-length dup zero?
+    [ 2drop 0 ]
+    [ 1 = [ 0 i-at left-side ] [ left-right [ iflatten ] 2apply ++ ] if ] if ; inline
+    
+: ifind-c ( s1 v -- s )
+    ifind-s iflatten ; inline
+
+: >>g++ ( s1 s2 -- imatch )
+    <i-match> ; inline
+    
+: >>g-+ ( s1 s2 -- imatch )
+    swap -- swap >>g++ ; inline
+
+: >>g+- ( s1 s2 -- imatch )
+    -- >>g++ -- ;
+
+: >>g-- ( s1 s2 -- imatch )
+    [ -- ] 2apply >>g++ -- ; inline
+
+: >>g ( s1 s2 -- imatch )
+    2dup [ neg? ] 2apply [ [ >>g-- ] [ >>g+- ] if ]
+    [ [ >>g-+ ] [ >>g++ ] if ] if ; inline
+
+M: object >> >>g ;
+    
+M: imatch i-length imatch-s2 i-length ;
+M: imatch i-at swap imatch-unpack rot i-at tuck left-side ifind-c swap right-side <i-dual-sided> ;
+M: imatch ileft imatch-unpack ileft <i-match> ;
+M: imatch iright imatch-unpack iright <i-match> ;
+M: imatch ihead (ihead) ;
+M: imatch itail (itail) ;
+M: imatch $$ imatch-unpack [ $$ ] 2apply quick-hash ;
diff --git a/unmaintained/isequences/ops/maximum/maximum.factor b/unmaintained/isequences/ops/maximum/maximum.factor
new file mode 100644 (file)
index 0000000..e9ce1c6
--- /dev/null
@@ -0,0 +1,71 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.maximum
+USING: generic kernel math sequences isequences.interface isequences.base ;
+
+
+
+TUPLE: imax left right ;
+
+: imax-unpack ( imax -- left right )
+    dup imax-left swap imax-right ; inline
+
+: nmax ( s n -- s )
+    i-length over i-length - dup 0 <= [ drop ] [ ++ ] if ; inline
+
+: <i-max> ( s1 s2 -- imax )
+    dup i-length pick swap nmax -rot swap nmax <imax> ; inline
+    
+: min## ( s1 s2 -- minimum )
+    [ i-length ] 2apply min ; inline
+    
+: ||g++ ( s1 s2 -- imax )
+    2dup [ i-length ] 2apply zero? [ 2drop ] [ zero? [ nip ] [ <i-max> ] if ] if ; inline
+
+: ||g-+ ( s1 s2 -- imax )
+    swap -- `` swap 2dup min## -rot || swap ihead ; inline
+
+: ||g+- ( s1 s2 -- imax )
+   -- `` 2dup min## -rot || swap ihead ; inline
+
+: ||g-- ( s1 s2 -- imax )
+    [ -- `` ] 2apply 2dup min## -rot || swap ihead `` -- ; inline
+
+: mcut-point ( imax -- i )
+    imax-unpack [ ileft i-length ] 2apply 2dup < [ drop ] [ nip ] if ; inline
+    
+: imax-ileft ( imax -- imax ) 
+    dup i-length 1 =
+    [ drop 0 ]
+    [ dup mcut-point swap imax-unpack pick ihead -rot swap ihead swap || ]
+    if ; inline
+
+: imax-iright ( imax -- imax )
+    dup i-length 1 =
+    [ drop 0 ]
+    [ dup mcut-point swap imax-unpack pick itail -rot swap itail swap || ]
+    if ; inline
+
+
+: ||g ( s1 s2 -- s )
+    2dup [ neg? ] 2apply [ [ ||g-- ] [ ||g+- ] if ]
+    [ [ ||g-+ ] [ ||g++ ] if ] if ; inline
+
+M: object || ||g ;
+
+! double dispatch integer/||
+GENERIC: integer/|| ( s1 s2 -- v )
+M: object integer/|| swap ||g ;
+M: integer || swap integer/|| ;
+! integer optimization
+M: integer integer/|| max ;
+
+M: imax i-at swap imax-unpack pick i-at -rot swap i-at swap ++ ;
+M: imax i-length imax-left i-length ;
+M: imax ileft imax-ileft ;
+M: imax iright imax-iright ;
+M: imax ihead (ihead) ;
+M: imax itail (itail) ;
+M: imax $$ imax-unpack [ $$ -2 shift ] 2apply quick-hash ;
+
diff --git a/unmaintained/isequences/ops/minimum/minimum.factor b/unmaintained/isequences/ops/minimum/minimum.factor
new file mode 100644 (file)
index 0000000..6ac9d42
--- /dev/null
@@ -0,0 +1,60 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.minimum
+USING: generic kernel math sequences isequences.interface isequences.base ;
+
+
+TUPLE: imin left right ;
+
+: <i-min> ( left right -- imin )
+    2dup [ i-length ] 2apply min dup rot
+    swap ihead -rot ihead swap <imin> ; inline
+    
+: imin-unpack ( imin -- left right )
+    dup imin-left swap imin-right ; inline
+    
+: imin-v ( v1 v2 -- v )
+    2dup [ left-side ] 2apply i-cmp dup zero?
+    [ drop [ right-side ] 2apply 2dup i-cmp 0 < [ 2drop 0 ] [ nip :v: ] if ]
+    [ 0 < [ 2drop 0 ] [ drop ] if ]
+    if ; inline
+
+: imin-ileft ( imin -- imin )
+    imin-unpack ileft dup i-length rot swap ihead swap <i-min> ; inline
+
+: imin-iright ( imin -- imin )
+    imin-unpack dup ileft i-length rot swap itail swap iright <i-min> ; inline
+    
+: &&g++ ( s1 s2 -- imax )
+    <i-min> ; inline
+
+: &&g-+ ( s1 s2 -- imax )
+    swap -- `` swap 2dup [ i-length ] 2apply neg + ++ && `` -- ; inline
+
+: &&g+- ( s1 s2 -- imax )
+    -- `` 2dup -roll [ i-length ] 2apply neg + ++ swap && `` -- ; inline
+
+: &&g-- ( s1 s2 -- imax )
+    [ -- `` ] 2apply 2dup [ i-length ] 2apply roll || -rot || && `` -- ; inline
+    
+: &&g ( s1 s2 -- imin )
+    2dup [ neg? ] 2apply [ [ &&g-- ] [ &&g+- ] if ]
+    [ [ &&g-+ ] [ &&g++ ] if ] if ; inline
+
+M: object && &&g ;
+
+M: imin i-length imin-left i-length ;
+M: imin i-at swap imin-unpack swap pick i-at -rot swap i-at imin-v ;
+M: imin ileft imin-ileft ;
+M: imin iright imin-iright ;
+M: imin ihead (ihead) ;
+M: imin itail (itail) ;
+M: imin $$ imin-unpack [ -- $$ neg ] 2apply quick-hash neg ;
+
+! double dispatch integer/&&
+GENERIC: integer/&& ( s1 s2 -- v )
+M: object integer/&& swap &&g ;
+M: integer && swap integer/&& ;
+! integer optimization
+M: integer integer/&& min ;
diff --git a/unmaintained/isequences/ops/modulus/modulus.factor b/unmaintained/isequences/ops/modulus/modulus.factor
new file mode 100644 (file)
index 0000000..4d91930
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.modulus
+USING: generic kernel math sequences isequences.interface isequences.base ;
+
+
+: %%g++ ( s1 s2 -- ms1 ms2 )
+    2dup [ i-length ] 2apply 2dup [ 0 = ] 2apply or
+    [ 3drop drop 0 0 ]
+    [ 2dup mod -rot swap mod swap rot swap ihead >r ihead r> ] if ;
+
+: %%g-+ ( s1 s2 -- ms1 ms2 )
+    ;
+
+: %%g+- ( s1 s2 -- ms2 ms2 )
+    ;
+
+: %%g-- ( s1 s2 -- ms1 ms2 )
+    ;
+    
+: %%g ( s1 s2 --  ms1 ms2 )
+    2dup [ neg? ] 2apply [ [ %%g-- ] [ %%g+- ] if ]
+    [ [ %%g-+ ] [ %%g++ ] if ] if ; inline
+
+M: object %% %%g ;
diff --git a/unmaintained/isequences/ops/multiply/multiply.factor b/unmaintained/isequences/ops/multiply/multiply.factor
new file mode 100644 (file)
index 0000000..4a4ff4f
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.multiply
+USING: generic kernel math math.functions sequences
+isequences.interface isequences.base ;
+
+: _*g++ ( n s -- s )
+    swap i-length dup zero?
+    [ 2drop 0 ]
+    [ dup odd? [ over ] [ 0 ] if -rot 2/ swap _*g++ dup ++ ++ ]
+    if ;
+
+: _*g+- ( n s -- s ) -- _* -- ; inline
+
+: _*g-+ ( n s -- s ) swap -- swap _* ; inline
+
+: _*g-- ( n s -- s ) [ -- ] 2apply _* ; inline
+
+: _*g ( n s -- s )
+    2dup [ neg? ] 2apply [ [ _*g-- ] [ _*g+- ] if ]
+    [ [ _*g-+ ] [ _*g++ ] if ] if ; inline
+
+M: object _* _*g ;
+M: integer _* swap i-length abs * ;
+
diff --git a/unmaintained/isequences/ops/ops.factor b/unmaintained/isequences/ops/ops.factor
new file mode 100644 (file)
index 0000000..bc8f7d4
--- /dev/null
@@ -0,0 +1,5 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops
+USING: isequences.ops.cache isequences.ops.divide isequences.ops.iota isequences.ops.match isequences.ops.maximum isequences.ops.minimum isequences.ops.modulus isequences.ops.multiply isequences.ops.sort isequences.ops.wipe ;
diff --git a/unmaintained/isequences/ops/sort/sort.factor b/unmaintained/isequences/ops/sort/sort.factor
new file mode 100644 (file)
index 0000000..32773ca
--- /dev/null
@@ -0,0 +1,36 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.sort
+USING: generic kernel math sequences isequences.interface isequences.base ;
+
+
+: <_g++ ( n s -- s )
+    i-union ; inline
+
+: <_g+- ( n s -- s ) -- <_ ; inline
+
+: <_g-+ ( n s -- s ) swap -- swap <_ ; inline
+
+: <_g-- ( n s -- s ) [ -- ] 2apply <_ ; inline
+
+: <_g ( n s -- s )
+    2dup [ neg? ] 2apply [ [ <_g-- ] [ <_g+- ] if ]
+    [ [ <_g-+ ] [ <_g++ ] if ] if ; inline
+
+M: object <_ <_g ;
+
+: _<g++ ( n s -- s )
+    i-diff ; inline
+
+: _<g+- ( n s -- s ) -- _< ; inline
+
+: _<g-+ ( n s -- s ) swap -- swap _< ; inline
+
+: _<g-- ( n s -- s ) [ -- ] 2apply _< ; inline
+
+: _<g ( n s -- s )
+    2dup [ neg? ] 2apply [ [ _<g-- ] [ _<g+- ] if ]
+    [ [ _<g-+ ] [ _<g++ ] if ] if ; inline
+
+M: object _< _<g ;
diff --git a/unmaintained/isequences/ops/wipe/wipe.factor b/unmaintained/isequences/ops/wipe/wipe.factor
new file mode 100644 (file)
index 0000000..61eef67
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2007 Robbert van Dalen.
+! See http://factorcode.org/license.txt for BSD license.
+
+IN: isequences.ops.wipe
+USING: generic kernel math sequences isequences.interface isequences.base ;
+
+
+TUPLE: iwiped sequence ;
+
+: <i-wiped> ( s -- iwiped ) 
+    dup i-length zero? [ drop 0 ] [ <iwiped> ] if ; inline
+
+M: iwiped i-length iwiped-sequence i-length ;
+M: iwiped i-at >r iwiped-sequence r> i-at right-side <i-right-sided> ;
+M: iwiped ileft iwiped-sequence ileft <iwiped> ;
+M: iwiped iright iwiped-sequence iright <iwiped> ;
+M: iwiped ihead (ihead) ;
+M: iwiped itail (itail) ;
+M: iwiped $$ iwiped-sequence $$ dup quick-hash ;
+
+M: object ## 
+    dup i-length 0 < [ -- <i-wiped> -- ] [ <i-wiped> ] if ;
+M: integer ## ;
+M: ineg ## -- ## -- ;
+M: irev ## `` ## `` ;
+M: iwiped ## ;
diff --git a/unmaintained/isequences/summary.txt b/unmaintained/isequences/summary.txt
new file mode 100644 (file)
index 0000000..efabd37
--- /dev/null
@@ -0,0 +1 @@
+Immutable sequences
diff --git a/unmaintained/isequences/tags.txt b/unmaintained/isequences/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
diff --git a/unmaintained/jni/jni-internals.factor b/unmaintained/jni/jni-internals.factor
new file mode 100644 (file)
index 0000000..49bc57b
--- /dev/null
@@ -0,0 +1,357 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+IN: jni-internals
+USING: kernel alien arrays sequences ;
+
+LIBRARY: jvm
+
+TYPEDEF: int jint
+TYPEDEF: uchar jboolean
+TYPEDEF: void* JNIEnv
+
+C-STRUCT: jdk-init-args
+       { "jint" "version" }
+       { "void*" "properties" }
+       { "jint" "check-source" }
+       { "jint" "native-stack-size" }
+       { "jint" "java-stack-size" }
+       { "jint" "min-heap-size" }
+       { "jint" "max-heap-size" }
+       { "jint" "verify-mode" }
+       { "char*" "classpath" }
+       { "void*" "vprintf" }
+       { "void*" "exit" }
+       { "void*" "abort" }
+       { "jint" "enable-class-gc" }
+       { "jint" "enable-verbose-gc" }
+       { "jint" "disable-async-gc" }
+       { "jint" "verbose" }
+       { "jboolean" "debugging" }
+       { "jint" "debug-port" } ;
+
+C-STRUCT: JNIInvokeInterface
+       { "void*" "reserved0" }
+       { "void*" "reserved1" }
+       { "void*" "reserved2" }
+       { "void*" "DestroyJavaVM" }
+       { "void*" "AttachCurrentThread" }
+       { "void*" "DetachCurrentThread" }
+       { "void*" "GetEnv" }
+       { "void*" "AttachCurrentThreadAsDaemon" } ;
+
+C-STRUCT: JavaVM
+       { "JNIInvokeInterface*" "functions" } ;
+
+C-STRUCT: JNINativeInterface
+    { "void*" "reserved0" }
+    { "void*" "reserved1" }
+    { "void*" "reserved2" }
+    { "void*" "reserved3" }
+    { "void*" "GetVersion" }
+    { "void*" "DefineClass" }
+    { "void*" "FindClass" }
+    { "void*" "FromReflectedMethod" }
+    { "void*" "FromReflectedField" }
+    { "void*" "ToReflectedMethod" }
+    { "void*" "GetSuperclass" }
+    { "void*" "IsAssignableFrom" }
+    { "void*" "ToReflectedField" }
+    { "void*" "Throw" }
+    { "void*" "ThrowNew" }
+    { "void*" "ExceptionOccurred" }
+    { "void*" "ExceptionDescribe" }
+    { "void*" "ExceptionClear" }
+    { "void*" "FatalError" }
+    { "void*" "PushLocalFrame" }
+    { "void*" "PopLocalFrame" }
+    { "void*" "NewGlobalRef" }
+    { "void*" "DeleteGlobalRef" }
+    { "void*" "DeleteLocalRef" }
+    { "void*" "IsSameObject" }
+    { "void*" "NewLocalRef" }
+    { "void*" "EnsureLocalCapacity" }
+    { "void*" "AllocObject" }
+    { "void*" "NewObject" }
+    { "void*" "NewObjectV" }
+    { "void*" "NewObjectA" }
+    { "void*" "GetObjectClass" }
+    { "void*" "IsInstanceOf" }
+    { "void*" "GetMethodID" }
+    { "void*" "CallObjectMethod" }
+    { "void*" "CallObjectMethodV" }
+    { "void*" "CallObjectMethodA" }
+    { "void*" "CallBooleanMethod" }
+    { "void*" "CallBooleanMethodV" }
+    { "void*" "CallBooleanMethodA" }
+    { "void*" "CallByteMethod" }
+    { "void*" "CallByteMethodV" }
+    { "void*" "CallByteMethodA" }
+    { "void*" "CallCharMethod" }
+    { "void*" "CallCharMethodV" }
+    { "void*" "CallCharMethodA" }
+    { "void*" "CallShortMethod" }
+    { "void*" "CallShortMethodV" }
+    { "void*" "CallShortMethodA" }
+    { "void*" "CallIntMethod" }
+    { "void*" "CallIntMethodV" }
+    { "void*" "CallIntMethodA" }
+    { "void*" "CallLongMethod" }
+    { "void*" "CallLongMethodV" }
+    { "void*" "CallLongMethodA" }
+    { "void*" "CallFloatMethod" }
+    { "void*" "CallFloatMethodV" }
+    { "void*" "CallFloatMethodA" }
+    { "void*" "CallDoubleMethod" }
+    { "void*" "CallDoubleMethodV" }
+    { "void*" "CallDoubleMethodA" }
+    { "void*" "CallVoidMethod" }
+    { "void*" "CallVoidMethodV" }
+    { "void*" "CallVoidMethodA" }
+    { "void*" "CallNonvirtualObjectMethod" }
+    { "void*" "CallNonvirtualObjectMethodV" }
+    { "void*" "CallNonvirtualObjectMethodA" }
+    { "void*" "CallNonvirtualBooleanMethod" }
+    { "void*" "CallNonvirtualBooleanMethodV" }
+    { "void*" "CallNonvirtualBooleanMethodA" }
+    { "void*" "CallNonvirtualByteMethod" }
+    { "void*" "CallNonvirtualByteMethodV" }
+    { "void*" "CallNonvirtualByteMethodA" }
+    { "void*" "CallNonvirtualCharMethod" }
+    { "void*" "CallNonvirtualCharMethodV" }
+    { "void*" "CallNonvirtualCharMethodA" }
+    { "void*" "CallNonvirtualShortMethod" }
+    { "void*" "CallNonvirtualShortMethodV" }
+    { "void*" "CallNonvirtualShortMethodA" }
+    { "void*" "CallNonvirtualIntMethod" }
+    { "void*" "CallNonvirtualIntMethodV" }
+    { "void*" "CallNonvirtualIntMethodA" }
+    { "void*" "CallNonvirtualLongMethod" }
+    { "void*" "CallNonvirtualLongMethodV" }
+    { "void*" "CallNonvirtualLongMethodA" }
+    { "void*" "CallNonvirtualFloatMethod" }
+    { "void*" "CallNonvirtualFloatMethodV" }
+    { "void*" "CallNonvirtualFloatMethodA" }
+    { "void*" "CallNonvirtualDoubleMethod" }
+    { "void*" "CallNonvirtualDoubleMethodV" }
+    { "void*" "CallNonvirtualDoubleMethodA" }
+    { "void*" "CallNonvirtualVoidMethod" }
+    { "void*" "CallNonvirtualVoidMethodV" }
+    { "void*" "CallNonvirtualVoidMethodA" }
+    { "void*" "GetFieldID" }
+    { "void*" "GetObjectField" }
+    { "void*" "GetBooleanField" }
+    { "void*" "GetByteField" }
+    { "void*" "GetCharField" }
+    { "void*" "GetShortField" }
+    { "void*" "GetIntField" }
+    { "void*" "GetLongField" }
+    { "void*" "GetFloatField" }
+    { "void*" "GetDoubleField" }
+    { "void*" "SetObjectField" }
+    { "void*" "SetBooleanField" }
+    { "void*" "SetByteField" }
+    { "void*" "SetCharField" }
+    { "void*" "SetShortField" }
+    { "void*" "SetIntField" }
+    { "void*" "SetLongField" }
+    { "void*" "SetFloatField" }
+    { "void*" "SetDoubleField" }
+    { "void*" "GetStaticMethodID" }
+    { "void*" "CallStaticObjectMethod" }
+    { "void*" "CallStaticObjectMethodV" }
+    { "void*" "CallStaticObjectMethodA" }
+    { "void*" "CallStaticBooleanMethod" }
+    { "void*" "CallStaticBooleanMethodV" }
+    { "void*" "CallStaticBooleanMethodA" }
+    { "void*" "CallStaticByteMethod" }
+    { "void*" "CallStaticByteMethodV" }
+    { "void*" "CallStaticByteMethodA" }
+    { "void*" "CallStaticCharMethod" }
+    { "void*" "CallStaticCharMethodV" }
+    { "void*" "CallStaticCharMethodA" }
+    { "void*" "CallStaticShortMethod" }
+    { "void*" "CallStaticShortMethodV" }
+    { "void*" "CallStaticShortMethodA" }
+    { "void*" "CallStaticIntMethod" }
+    { "void*" "CallStaticIntMethodV" }
+    { "void*" "CallStaticIntMethodA" }
+    { "void*" "CallStaticLongMethod" }
+    { "void*" "CallStaticLongMethodV" }
+    { "void*" "CallStaticLongMethodA" }
+    { "void*" "CallStaticFloatMethod" }
+    { "void*" "CallStaticFloatMethodV" }
+    { "void*" "CallStaticFloatMethodA" }
+    { "void*" "CallStaticDoubleMethod" }
+    { "void*" "CallStaticDoubleMethodV" }
+    { "void*" "CallStaticDoubleMethodA" }
+    { "void*" "CallStaticVoidMethod" }
+    { "void*" "CallStaticVoidMethodV" }
+    { "void*" "CallStaticVoidMethodA" }
+    { "void*" "GetStaticFieldID" }
+    { "void*" "GetStaticObjectField" }
+    { "void*" "GetStaticBooleanField" }
+    { "void*" "GetStaticByteField" }
+    { "void*" "GetStaticCharField" }
+    { "void*" "GetStaticShortField" }
+    { "void*" "GetStaticIntField" }
+    { "void*" "GetStaticLongField" }
+    { "void*" "GetStaticFloatField" }
+    { "void*" "GetStaticDoubleField" }
+    { "void*" "SetStaticObjectField" }
+    { "void*" "SetStaticBooleanField" }
+    { "void*" "SetStaticByteField" }
+    { "void*" "SetStaticCharField" }
+    { "void*" "SetStaticShortField" }
+    { "void*" "SetStaticIntField" }
+    { "void*" "SetStaticLongField" }
+    { "void*" "SetStaticFloatField" }
+    { "void*" "SetStaticDoubleField" }
+    { "void*" "NewString" }
+    { "void*" "GetStringLength" }
+    { "void*" "GetStringChars" }
+    { "void*" "ReleaseStringChars" }
+    { "void*" "NewStringUTF" }
+    { "void*" "GetStringUTFLength" }
+    { "void*" "GetStringUTFChars" }
+    { "void*" "ReleaseStringUTFChars" }
+    { "void*" "GetArrayLength" }
+    { "void*" "NewObjectArray" }
+    { "void*" "GetObjectArrayElement" }
+    { "void*" "SetObjectArrayElement" }
+    { "void*" "NewBooleanArray" }
+    { "void*" "NewByteArray" }
+    { "void*" "NewCharArray" }
+    { "void*" "NewShortArray" }
+    { "void*" "NewIntArray" }
+    { "void*" "NewLongArray" }
+    { "void*" "NewFloatArray" }
+    { "void*" "NewDoubleArray" }
+    { "void*" "GetBooleanArrayElements" }
+    { "void*" "GetByteArrayElements" }
+    { "void*" "GetCharArrayElements" }
+    { "void*" "GetShortArrayElements" }
+    { "void*" "GetIntArrayElements" }
+    { "void*" "GetLongArrayElements" }
+    { "void*" "GetFloatArrayElements" }
+    { "void*" "GetDoubleArrayElements" }
+    { "void*" "ReleaseBooleanArrayElements" }
+    { "void*" "ReleaseByteArrayElements" }
+    { "void*" "ReleaseCharArrayElements" }
+    { "void*" "ReleaseShortArrayElements" }
+    { "void*" "ReleaseIntArrayElements" }
+    { "void*" "ReleaseLongArrayElements" }
+    { "void*" "ReleaseFloatArrayElements" }
+    { "void*" "ReleaseDoubleArrayElements" }
+    { "void*" "GetBooleanArrayRegion" }
+    { "void*" "GetByteArrayRegion" }
+    { "void*" "GetCharArrayRegion" }
+    { "void*" "GetShortArrayRegion" }
+    { "void*" "GetIntArrayRegion" }
+    { "void*" "GetLongArrayRegion" }
+    { "void*" "GetFloatArrayRegion" }
+    { "void*" "GetDoubleArrayRegion" }
+    { "void*" "SetBooleanArrayRegion" }
+    { "void*" "SetByteArrayRegion" }
+    { "void*" "SetCharArrayRegion" }
+    { "void*" "SetShortArrayRegion" }
+    { "void*" "SetIntArrayRegion" }
+    { "void*" "SetLongArrayRegion" }
+    { "void*" "SetFloatArrayRegion" }
+    { "void*" "SetDoubleArrayRegion" }
+    { "void*" "RegisterNatives" }
+    { "void*" "UnregisterNatives" }
+    { "void*" "MonitorEnter" }
+    { "void*" "MonitorExit" }
+    { "void*" "GetJavaVM" }
+    { "void*" "GetStringRegion" }
+    { "void*" "GetStringUTFRegion" }
+    { "void*" "GetPrimitiveArrayCritical" }
+    { "void*" "ReleasePrimitiveArrayCritical" }
+    { "void*" "GetStringCritical" }
+    { "void*" "ReleaseStringCritical" }
+    { "void*" "NewWeakGlobalRef" }
+    { "void*" "DeleteWeakGlobalRef" }
+    { "void*" "ExceptionCheck" }
+    { "void*" "NewDirectByteBuffer" }
+    { "void*" "GetDirectBufferAddress" }
+    { "void*" "GetDirectBufferCapacity" } ;
+
+C-STRUCT: JNIEnv
+       { "JNINativeInterface*" "functions" } ;
+
+FUNCTION: jint JNI_GetDefaultJavaVMInitArgs ( jdk-init-args* args ) ;
+FUNCTION: jint JNI_CreateJavaVM ( void** pvm, void** penv, void* args ) ;
+
+: <jdk-init-args> ( -- jdk-init-args )
+  "jdk-init-args" <c-object>  HEX: 00010004 over set-jdk-init-args-version ;
+
+: jni1 ( -- init-args int )
+  <jdk-init-args> dup JNI_GetDefaultJavaVMInitArgs ;
+
+: jni2 ( -- vm env int )
+  f <void*> f <void*> [
+    jni1 drop JNI_CreateJavaVM
+  ] 2keep rot dup 0 = [
+    >r >r 0 swap void*-nth r> 0 swap void*-nth r> 
+  ] when ;
+
+: (destroy-java-vm) 
+  "int" { "void*" } "cdecl" alien-indirect ;
+
+: (attach-current-thread) 
+  "int" { "void*" "void*" "void*" } "cdecl" alien-indirect ;
+
+: (detach-current-thread) 
+  "int" { "void*" } "cdecl" alien-indirect ;
+
+: (get-env) 
+  "int" { "void*" "void*" "int" } "cdecl" alien-indirect ;
+
+: (attach-current-thread-as-daemon) 
+  "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 ;
+
+: get-version ( jnienv -- int )
+  dup JNIEnv-functions JNINativeInterface-GetVersion (get-version) ;
+  
+: (find-class) 
+  "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 ;
+
+: 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 ;
+
+: 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 ;
+
+: 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 ;
+
+: 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 ;
+
+: call1 ( obj method-id jstr jnienv -- )
+  dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-CallObjectMethod (call1) ;
+
diff --git a/unmaintained/jni/jni.factor b/unmaintained/jni/jni.factor
new file mode 100644 (file)
index 0000000..86e1670
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+IN: jni
+USING: kernel jni-internals namespaces ;
+
+! High level interface for JNI to be added here...
+
+: test0 ( -- )
+  jni2 drop nip "env" set ;
+
+: test1 ( -- system )
+  "java/lang/System" "env" get find-class ;
+
+: test2 ( system -- system.out )
+  dup "out" "Ljava/io/PrintStream;" "env" get get-static-field-id 
+  "env" get get-static-object-field ;
+
+: test3 ( int system.out -- )
+  "java/io/PrintStream" "env" get find-class ! jstr out class
+  "println" "(I)V" "env" get get-method-id ! jstr out id
+  rot "env" get call1 ;
+  
\ No newline at end of file
diff --git a/unmaintained/jni/load.factor b/unmaintained/jni/load.factor
new file mode 100644 (file)
index 0000000..f5fd45c
--- /dev/null
@@ -0,0 +1,4 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+PROVIDE: libs/jni
+{ +files+ { "jni-internals.factor" "jni.factor" } } ;
diff --git a/unmaintained/lambda/TODO.txt b/unmaintained/lambda/TODO.txt
new file mode 100644 (file)
index 0000000..c196e95
--- /dev/null
@@ -0,0 +1,15 @@
+Lambda TODO
+-----------
+Documentation
+Unit tests
+More graceful parse error handling
+Factor out tree traversing into its own lib
+
+Redesign
+--------
+Why doesn't PRED work?
+
+Core
+----
+ISNIL
+READCHAR
\ No newline at end of file
diff --git a/unmaintained/lambda/core.factor b/unmaintained/lambda/core.factor
new file mode 100644 (file)
index 0000000..48ba967
--- /dev/null
@@ -0,0 +1,79 @@
+USING: arrays lazy-lists io strings sequences math namespaces
+kernel ;
+IN: lambda
+
+: lambda-core ( -- expr-string-array )
+    {
+        ":0 (one.(zero.zero))"
+        ":SUCC (num.(one.(zero.(one((num one) zero)))))"
+    }
+    
+    0 lfrom 100 swap ltake list>array
+    [ 
+        [ ":" , dup 1 + number>string , " (SUCC " , number>string ,
+        ")" , ] { } make concat
+    ] map append
+    
+    0 lfrom 26 swap ltake list>array
+    [
+        [ ":" , 65 + dup 1string , " " , number>string , ] { } make concat
+    ] map append
+    
+    {
+        ":LF 10"
+        ":FALSE (t.(f.f))"
+        ":TRUE (t.(f.t))"
+        ":AND (p.(q.((p q) FALSE)))"
+        ":OR (p.(q.((p TRUE) q)))"
+        ":ISZERO (num.((num (pred. FALSE)) TRUE))"
+        ":ADD (num.(other.((num SUCC) other)))"
+        ":MULT (num.(other.((num (ADD other)) 0)))"
+        ":PRED (n.(f.(x.(((n (g.(h.(h(g f))))) (u. x)) (u.u)))))"
+        ":SUBFROM (num.(other.((num PRED) other)))"
+        ":EQUAL (num.(other.((AND (ISZERO ((SUBFROM num) other))) (ISZERO ((SUBFROM other) num)))))"
+        ":FACT (fact.(num.(((ISZERO num) 1) ((MULT num) (fact (PRED num))))))"
+        ":YCOMBINATOR (func.((y. (func (y y)))(y. (func (y y)))))"
+        ":FACTORIAL (YCOMBINATOR FACT)"
+        ":CONS (car.(cdr.(which.((which car) cdr))))"
+        ":CAR (cons.(cons TRUE))"
+        ":CDR (cons.(cons FALSE))"
+        ":PCONS (pcons.(num.(cons.(((ISZERO num) (PRINTSPECIAL LF)) ((PRINTCHAR (CAR cons)) ((pcons (PRED num)) (CDR cons)))))))"
+        ":PRINTCONS (YCOMBINATOR PCONS)"
+        ":NUMTOCHAR (num. ((ADD 48) num))"
+        ":PRINTNUM (num.(PRINTCHAR (NUMTOCHAR num)))"
+        ":PRINTCHAR (char.([PRINTCHAR] (ALIENNUM char)))"
+        ":PRINTSPECIAL (special.([PRINTCHAR] (ALIENNUM special)))"
+        ":ALIEN0 alienbaseonenum"
+        ":ALIENNUM (num.((num [ALIENSUCC]) ALIEN0))"
+        ":HELLOCONS ((CONS H) ((CONS E) ((CONS Y) ((CONS 0) nil))))"
+        ":HELLO ((PRINTCONS 3) HELLOCONS)"
+        "(([HELLO] nil) ([INFO] nil))"
+    } append ;
+
+: print-return ( -- node )
+    write "(nil.nil)" lambda-parse second ;
+    
+: HELLO ( node -- node )
+    drop "\nHello and Welcome to Lambda!\n" print-return ;
+
+: INFO ( node -- node )
+    drop "Type HELLO and wait 10 seconds to see me flex my io muscles.\n" print-return ;
+
+: ALIENSUCC ( node -- node )
+    var-node-name "a" append <var-node> ;
+
+: ALIENPRED ( node -- node )
+    var-node-name 1 tail <var-node> ;
+
+: ALIENISZERO ( node -- node )
+    ;
+
+: PRINTCHAR ( node -- node )
+    #! takes a base one num and prints its char equivalent
+    var-node-name length "alienbaseonenum" length - 1string print-return ;
+
+: READCHAR ( node -- node )
+    #! reads one character of input and stores it as a base one num
+    "alienbaseonenum" read1 "a" <array> >string <var-node> ;
+
+    
\ No newline at end of file
diff --git a/unmaintained/lambda/lambda.factor b/unmaintained/lambda/lambda.factor
new file mode 100644 (file)
index 0000000..441eff8
--- /dev/null
@@ -0,0 +1,28 @@
+#! An interpreter for lambda expressions, by Matthew Willis
+USING: io strings hashtables sequences namespaces kernel ;
+IN: lambda
+
+: lambda-print ( name/expr -- )
+    dup string? 
+    [   dup lambda-names get hash expr>string " " swap 
+        append append "DEF " swap append 
+    ] [ expr>string "=> " swap append 
+    ] if print flush ;
+
+: lambda-define ( parse-result -- name/expr )
+    #! Make sure not to evaluate definitions.
+    first2 over [ over lambda-names get set-hash ] [ nip ] if ;
+
+: lambda-eval ( name/expr -- name/expr )
+    dup string? [ normalize ] unless ;
+
+: lambda-boot ( -- )
+    #! load the core lambda library
+    H{ } clone lambda-names set lambda-core
+    [ lambda-parse lambda-define lambda-eval lambda-print ] each ;
+: lambda ( -- )
+    lambda-names get [ lambda-boot ] unless
+    readln dup "." = [ drop ] [
+        lambda-parse lambda-define lambda-eval lambda-print lambda
+    ] if ;
\ No newline at end of file
diff --git a/unmaintained/lambda/load.factor b/unmaintained/lambda/load.factor
new file mode 100644 (file)
index 0000000..bd0dd66
--- /dev/null
@@ -0,0 +1,14 @@
+REQUIRES: libs/lazy-lists libs/parser-combinators ;
+PROVIDE: libs/lambda
+{ +files+ {
+    "nodes.factor"
+    "parser.factor"
+    "core.factor"
+    "lambda.factor"
+} }
+{ +tests+ {
+    "test/lambda.factor"
+} } ;
+
+USE: lambda
+MAIN: libs/lambda lambda ;
\ No newline at end of file
diff --git a/unmaintained/lambda/nodes.factor b/unmaintained/lambda/nodes.factor
new file mode 100644 (file)
index 0000000..35869b1
--- /dev/null
@@ -0,0 +1,130 @@
+#! A lambda expression manipulator, by Matthew Willis
+USING: lazy-lists strings arrays hashtables 
+sequences namespaces words parser kernel ;
+
+IN: lambda
+
+SYMBOL: lambda-names
+TUPLE: lambda-node self expr name ;
+TUPLE: apply-node func arg ;
+TUPLE: var-node name ; #! var is either a var, name, or pointer to a lambda-node
+TUPLE: beta-node expr lambdas ; #! a namespace node
+TUPLE: alien-node word ;
+
+M: lambda-node equal? 2drop f ;
+
+GENERIC: bind-var
+M: lambda-node bind-var ( binding lambda -- ) 
+    lambda-node-expr bind-var ; 
+
+M: apply-node bind-var ( binding apply -- )
+    [ apply-node-func bind-var ] 2keep apply-node-arg bind-var ;
+
+M: var-node bind-var ( binding var-node -- )
+    2dup var-node-name swap lambda-node-name = 
+    [ set-var-node-name ] [ 2drop ] if ;
+
+M: alien-node bind-var ( binding alien -- ) 2drop ;
+
+C: lambda-node ( expr var lambda -- lambda )
+    swapd [ set-lambda-node-name ] keep
+    [ set-lambda-node-expr ] 2keep
+    dup [ set-lambda-node-self ] keep
+    [ swap bind-var ] keep ;
+
+GENERIC: beta-push
+#! push the beta further down the syntax tree
+#!  this is how lambda achieves lazy beta reduction and efficient cloning.
+#!  everything outside of the beta must have been cloned.
+M: lambda-node beta-push ( beta lambda -- lambda )
+    clone dup lambda-node-expr pick set-beta-node-expr
+    [ set-lambda-node-expr ] keep ;
+
+M: apply-node beta-push ( beta apply -- apply )
+    #! push the beta into each branch, cloning the beta
+    swap dup clone 
+    pick apply-node-func swap [ set-beta-node-expr ] keep swap
+    rot apply-node-arg swap [ set-beta-node-expr ] keep
+    <apply-node> ;
+
+M: var-node beta-push ( beta var -- expr )
+    #! substitute the variable with the appropriate entry from the
+    #! beta namespace
+    tuck var-node-name swap beta-node-lambdas hash dup
+    [ nip ] [ drop ] if ;
+
+M: beta-node beta-push ( beta inner-beta -- beta )
+    #! combines the namespaces of two betas
+    dup beta-node-lambdas rot beta-node-lambdas hash-union
+    swap [ set-beta-node-lambdas ] keep ;
+
+M: alien-node beta-push ( beta alien -- alien ) nip ;
+
+: beta-reduce ( apply -- beta )
+    #! construct a beta-node which carries the namespace of the lambda
+    dup apply-node-arg swap apply-node-func dup lambda-node-expr -rot
+    lambda-node-self H{ } clone [ set-hash ] keep <beta-node> ;
+
+DEFER: evaluate
+: left-reduce ( apply -- apply/f )
+    #! we are at an application node -- evaluate the function
+    dup apply-node-func evaluate dup
+    [ swap [ set-apply-node-func ] keep ]
+    [ nip ] if ;
+
+: alien-reduce ( apply -- node/f )
+    #! we have come to an alien application, which requires us to
+    #! fully normalize the argument before proceeding
+    dup apply-node-arg evaluate dup
+    [ swap [ set-apply-node-arg ] keep ]
+    [ #! right side is normalized, we are ready to do the alien application
+        drop dup apply-node-arg swap apply-node-func
+        alien-node-word "lambda" lookup execute
+    ] if ;
+
+GENERIC: evaluate
+#! There are 
+#!   beta-reduction, beta-pushing, and name replacing.
+: normalize ( expr -- expr )
+    dup evaluate [ nip normalize ] when* ;
+    
+M: lambda-node evaluate ( lambda -- node/f ) drop f ;
+
+M: apply-node evaluate ( apply -- node )
+    dup apply-node-func lambda-node?
+    [ beta-reduce ] 
+    [ 
+        dup apply-node-func alien-node?
+        [ alien-reduce ]
+        [ left-reduce ] if
+    ] if ;
+
+M: var-node evaluate ( var -- node/f ) 
+    var-node-name lambda-names get hash ;
+
+M: beta-node evaluate ( beta -- node/f ) 
+    dup beta-node-expr beta-push ;
+
+M: alien-node evaluate ( alien -- node/f ) drop f ;
+
+GENERIC: expr>string
+M: lambda-node expr>string ( lambda-node -- string )
+    [ 
+        dup "(" , lambda-node-name , ". " , 
+        lambda-node-expr expr>string , ")" , 
+    ] { } make concat ;
+
+M: apply-node expr>string ( apply-node -- string ) 
+    [ 
+        dup "(" , apply-node-func expr>string , " " , 
+        apply-node-arg expr>string , ")" , 
+    ] { } make concat ;
+
+M: var-node expr>string ( variable-node -- string ) 
+    var-node-name dup string? [ lambda-node-name ] unless ;
+
+M: alien-node expr>string ( alien-node -- string )
+    [ "[" , alien-node-word , "]" , ] { } make concat ;
+
+M: beta-node expr>string ( beta -- string )
+    [ "beta<" , beta-node-expr expr>string , ">" , ] { } make concat ;
\ No newline at end of file
diff --git a/unmaintained/lambda/parser.factor b/unmaintained/lambda/parser.factor
new file mode 100644 (file)
index 0000000..eefdffd
--- /dev/null
@@ -0,0 +1,70 @@
+#! A parser for lambda expressions, by Matthew Willis
+#! The grammar in BNF is:
+#! <expr> ::= <id>
+#! <expr> ::= <name>
+#! <expr> ::= (<id> . <expr>)
+#! <expr> ::= (<expr> <expr>)
+#! <line> ::= <expr>
+#! <line> ::= <name> : <expr>
+USING: lazy-lists parser-combinators strings sequences kernel ;
+
+IN: lambda
+
+LAZY: <letter> 
+    #! parses an uppercase or lowercase letter
+       [ letter? ] satisfy [ 1string ] <@ ;
+
+LAZY: <LETTER> 
+    #! parses an uppercase or lowercase letter
+    [ LETTER? ] satisfy [ 1string ] <@ ;
+
+LAZY: <number>
+    #! parses a number
+    [ digit? ] satisfy [ 1string ] <@ ;
+
+LAZY: <alphanumeric>
+    #! parses an alphanumeral
+    <letter> <number> <|> ;
+
+LAZY: <ALPHANUMERIC>
+    #! parses an alphanumeral
+    <LETTER> <number> <|> ;
+
+LAZY: <id>
+    #! parses an identifier (string for now)
+    #! TODO: do we need to enter it into a symbol table?
+    <letter> <alphanumeric> <*> <&:> [ concat <var-node> ] <@ ;
+
+LAZY: <name>
+    #! parses a name, which is used in replacement
+    <ALPHANUMERIC> <+> [ concat ] <@ ;
+
+DEFER: <expr>
+LAZY: <lambda> ( -- parser )
+    #! parses (<id>.<expr>), the "lambda" expression
+    #! all occurences of <id> are replaced with a pointer to this
+    #! lambda expression.
+    "(" token <id> sp &> "." token sp <& 
+    <expr> sp <&> ")" token sp <&
+    [ [ first var-node-name ] keep second <lambda-node> ] <@ ;
+
+LAZY: <apply> ( -- parser )
+    #! parses (<expr> <expr>), the function application
+    "(" token <expr> sp &> <expr> sp <&> ")" token sp <& 
+    [ [ first ] keep second <apply-node> ] <@ ;
+
+LAZY: <alien> ( -- parser )
+    #! parses [<FACTOR-WORD>], the alien invocation
+    #! an alien factor word must be all capital letters and numerals
+    "[" token <name> sp &> "]" token sp <& [ <alien-node> ] <@ ;
+
+LAZY: <expr>
+    <id> <lambda> <apply> <|> <|>
+    <name> [ <var-node> ] <@ <|> <alien> <|> ;
+
+LAZY: <line>
+    ":" token <name> &> <expr> sp <&> f succeed <expr> <&> 
+    <|> "." token <name> &> f succeed <&> <|> ;
+
+: lambda-parse
+    <line> some parse force ;
\ No newline at end of file
diff --git a/unmaintained/lambda/test/lambda.factor b/unmaintained/lambda/test/lambda.factor
new file mode 100644 (file)
index 0000000..96c27a3
--- /dev/null
@@ -0,0 +1,11 @@
+USING: lambda test hashtables sequences kernel ;
+
+#! test simple parsing
+[ "(A. A)" ] [ "(b.b)" lambda-parse second bound-vars swap expr>string ] unit-test
+
+#! test name replacement
+[ "(A. A)" ] [ 
+                "(b.b)" lambda-parse second "OK" H{ } clone [ set-hash ] keep
+                "OK" lambda-parse second replace-names bound-vars
+                swap expr>string 
+             ] unit-test
\ No newline at end of file
diff --git a/unmaintained/mysql/libmysql.factor b/unmaintained/mysql/libmysql.factor
new file mode 100644 (file)
index 0000000..064c7bf
--- /dev/null
@@ -0,0 +1,35 @@
+! See http://factorcode.org/license.txt
+! Copyright (C) 2007 Berlin Brown
+! Date: 1/17/2007
+!
+! libs/mysql/libmysql.factor
+!
+! Adapted from mysql.h and mysql.c
+! Tested with MySQL version - 5.0.24a
+
+IN: mysql
+USING: alien kernel ;
+
+"mysql" {
+    { [ win32? ] [ "libmySQL.dll" "stdcall" ] }
+    { [ macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] }
+    { [ unix? ] [ "libmysqlclient.so.14" "cdecl" ] }
+} cond add-library
+
+LIBRARY: mysql
+
+! ===============================================
+! mysql.c
+! ===============================================
+
+FUNCTION: void* mysql_init ( void* mysql ) ;
+FUNCTION: char* mysql_error ( void* mysql ) ;
+FUNCTION: void* mysql_real_connect ( void* mysql, char* host, char* user, char* passwd, char* db, int port, char* unixsocket, long clientflag ) ;
+FUNCTION: void mysql_close ( void* sock ) ;
+FUNCTION: int mysql_query ( void* mysql, char* q ) ;
+FUNCTION: void* mysql_use_result ( void* mysql ) ;
+FUNCTION: void mysql_free_result ( void* result ) ;
+FUNCTION: char** mysql_fetch_row ( void* result ) ;
+FUNCTION: int mysql_num_fields ( void* result ) ;
+FUNCTION: ulong mysql_affected_rows ( void* mysql ) ;
+
diff --git a/unmaintained/mysql/load.factor b/unmaintained/mysql/load.factor
new file mode 100644 (file)
index 0000000..b3872d6
--- /dev/null
@@ -0,0 +1,11 @@
+! License: See http://factor.sf.net/license.txt for BSD license.
+! Berlin Brown
+! Date: 1/17/2007
+!
+! Adapted from mysql.h and mysql.c
+! Tested with MySQL version - 5.0.24a
+PROVIDE: libs/mysql
+{ +files+ {
+    "libmysql.factor"
+    "mysql.factor"
+} } ;
\ No newline at end of file
diff --git a/unmaintained/mysql/mysql.factor b/unmaintained/mysql/mysql.factor
new file mode 100644 (file)
index 0000000..22a6bc9
--- /dev/null
@@ -0,0 +1,124 @@
+! See http://factorcode.org/license.txt for license.
+! Copyright (C) 2007 Berlin Brown
+! Date: 1/17/2007
+!
+! libs/mysql/mysql.factor
+!
+! Adapted from mysql.h and mysql.c
+! Tested with MySQL version - 5.0.24a
+
+IN: mysql
+USING: kernel alien errors io prettyprint 
+    sequences namespaces arrays math tools generic ;
+
+SYMBOL: my-conn
+
+TUPLE: mysql-connection mysqlconn host user password db port handle resulthandle ;
+
+: init-mysql ( -- conn )
+    f mysql_init ;
+    
+C: mysql-connection ( host user password db port -- mysql-connection )
+    [ set-mysql-connection-port ] keep
+    [ set-mysql-connection-db ] keep
+    [ set-mysql-connection-password ] keep
+    [ set-mysql-connection-user ] keep
+    [ set-mysql-connection-host ] keep ;
+
+: (mysql-error) ( mysql-connection -- str )
+    mysql-connection-mysqlconn mysql_error ;
+
+: connect-error-msg ( mysql-connection -- s ) 
+    mysql-connection-mysqlconn mysql_error
+    [
+        "Couldn't connect to mysql database.\n" %
+        "Message: " % %
+    ] "" make ;
+
+: mysql-connect ( mysql-connection -- )
+    init-mysql swap
+    [ set-mysql-connection-mysqlconn ] 2keep
+    [ mysql-connection-host ] keep
+    [ mysql-connection-user ] keep
+    [ mysql-connection-password ] keep
+    [ mysql-connection-db ] keep
+    [ mysql-connection-port f 0 mysql_real_connect ] keep
+    [ set-mysql-connection-handle ] keep 
+    dup mysql-connection-handle 
+    [ connect-error-msg throw ] unless ;
+
+! =========================================================
+! Low level mysql utility definitions
+! =========================================================
+
+: (mysql-query) ( mysql-connection query -- ret )
+    >r mysql-connection-mysqlconn r> mysql_query ;
+
+: (mysql-result) ( mysql-connection -- ret )
+    [ mysql-connection-mysqlconn mysql_use_result ] keep 
+    [ set-mysql-connection-resulthandle ] keep ;
+    
+: (mysql-affected-rows) ( mysql-connection -- n )
+    mysql-connection-mysqlconn mysql_affected_rows ;
+
+: (mysql-free-result) ( mysql-connection -- )
+    mysql-connection-resulthandle drop ;
+
+: (mysql-row) ( mysql-connection -- row )
+    mysql-connection-resulthandle mysql_fetch_row ;
+
+: (mysql-num-cols) ( mysql-connection -- n )
+    mysql-connection-resulthandle mysql_num_fields ;
+   
+: mysql-char*-nth ( index object -- str )
+    #! Utility based on 'char*-nth' to perform an additional sanity check on the value
+    #! extracted from the array of strings.
+    void*-nth [ alien>char-string ] [ "" ] if* ;
+        
+: mysql-row>seq ( object n -- seq )
+    [ swap mysql-char*-nth ] map-with ;
+    
+: (mysql-result>seq) ( seq -- seq )
+    my-conn get (mysql-row) dup [       
+        my-conn get (mysql-num-cols) mysql-row>seq
+        over push
+        (mysql-result>seq)
+    ] [ drop ] if 
+    ! Perform needed cleanup on fetched results
+    my-conn get (mysql-free-result) ;
+            
+! =========================================================
+!  Public Word Definitions
+! =========================================================
+
+: mysql-close ( mysql-connection -- )
+    mysql-connection-mysqlconn mysql_close ;
+
+: mysql-print-table ( seq -- )
+    [ [ write bl ] each "\n" write ] each ;
+    
+: mysql-query ( query -- ret )
+    >r my-conn get r> (mysql-query) drop
+    my-conn get (mysql-result) ;
+
+: mysql-command ( query -- n )
+    mysql-query drop
+    my-conn get (mysql-affected-rows) ;
+
+: mysql-error ( -- s )
+    #! Get the last mysql error
+    my-conn get (mysql-error) ; 
+
+: mysql-result>seq ( -- seq )
+    V{ } clone (mysql-result>seq) ;
+        
+: with-mysql ( host user password db port quot -- )
+    [ 
+        >r <mysql-connection> my-conn set 
+            my-conn get mysql-connect drop r> 
+        [ my-conn get mysql-close ] cleanup
+    ] with-scope ; inline
+    
+: with-mysql-catch ( host user password db port quot -- )
+    [ with-mysql ] catch [ "Caught: " write print ] when* ;
+    
\ No newline at end of file
diff --git a/unmaintained/mysql/test/create_database.sql b/unmaintained/mysql/test/create_database.sql
new file mode 100644 (file)
index 0000000..00fd323
--- /dev/null
@@ -0,0 +1,17 @@
+--\r
+-- Create three databases (development / test / production) \r
+-- with prefix 'factordb_'\r
+create database factordb_development;\r
+create database factordb_test;\r
+create database factordb_production;\r
+\r
+grant all on factordb_development.* to 'factoruser'@'localhost' identified by 'mysqlfactor';\r
+grant all on factordb_test.* to 'factoruser'@'localhost' identified by 'mysqlfactor';\r
+grant all on factordb_production.* to 'factoruser'@'localhost' identified by 'mysqlfactor';\r
+\r
+grant all on factordb_development.* to 'factoruser'@'*' identified by 'mysqlfactor';\r
+grant all on factordb_test.* to 'factoruser'@'*' identified by 'mysqlfactor';\r
+grant all on factordb_production.* to 'factoruser'@'*' identified by 'mysqlfactor';\r
+\r
+-- End of the Script\r
+\r
diff --git a/unmaintained/mysql/test/mysql-example.factor b/unmaintained/mysql/test/mysql-example.factor
new file mode 100644 (file)
index 0000000..2476153
--- /dev/null
@@ -0,0 +1,57 @@
+! See http://factorcode.org/license.txt for license.
+! Simple test for mysql library
+! libs/mysql/test/mysql-example.factor
+
+IN: mysql-example
+REQUIRES: libs/mysql ;
+USING: sequences mysql modules prettyprint kernel io math tools namespaces test ;
+
+"Testing..." print nl
+
+: get-drop-table ( -- s )
+       "DROP TABLE if exists DISCUSSION_FORUM" ;
+
+: get-insert-table ( -- s )
+    {
+        "INSERT INTO DISCUSSION_FORUM(category, full_name, email, title, main_url, keywords, message) "
+        "VALUES('none', 'John Doe', 'johndoe@test.com', 'The Message', NULL, NULL, 'Testing')"
+    } "" join ;
+
+: get-update-table ( -- s )
+    "UPDATE DISCUSSION_FORUM set category = 'my-new-category'" ;
+    
+: get-delete-table ( -- s )
+    "DELETE FROM DISCUSSION_FORUM where id = 2" ;
+
+: get-create-table ( -- s )
+    {
+        "create table DISCUSSION_FORUM("
+        "id                     int(11) NOT NULL auto_increment,"
+        "category               varchar(128),"
+        "full_name              varchar(128) NOT NULL,"
+        "email                  varchar(128) NOT NULL,"
+        "title                  varchar(255) NOT NULL,"
+        "main_url               varchar(255),"
+        "keywords               varchar(255),"
+        "message                text NOT NULL,"
+        "created_on             DATETIME NOT NULL DEFAULT '0000-00-0000:00:00',"
+        "PRIMARY KEY (id));"
+    } "" join ;
+
+[ "localhost" "factoruser" "mysqlfactor" "factordb_development" 0 [
+    get-drop-table mysql-command drop
+    get-create-table mysql-command drop
+    get-update-table mysql-command drop
+    get-delete-table mysql-command drop
+    
+    ! Insert multiple records
+    20 [
+        get-insert-table mysql-command 2drop
+    ] each
+        
+    "select * from discussion_forum order by created_on" mysql-query drop
+    mysql-result>seq mysql-print-table
+
+] with-mysql ] time
+
+"Done" print
\ No newline at end of file
diff --git a/unmaintained/random-tester/load.factor b/unmaintained/random-tester/load.factor
new file mode 100644 (file)
index 0000000..ba69545
--- /dev/null
@@ -0,0 +1,9 @@
+REQUIRES: libs/lazy-lists libs/null-stream libs/shuffle ;
+PROVIDE: apps/random-tester
+{ +files+ {
+    "utils.factor"
+    "random.factor"
+    "random-tester.factor"
+    "random-tester2.factor"
+    "type.factor"
+} } ;
diff --git a/unmaintained/random-tester/random-tester.factor b/unmaintained/random-tester/random-tester.factor
new file mode 100644 (file)
index 0000000..649ca9d
--- /dev/null
@@ -0,0 +1,301 @@
+USING: kernel math math-internals memory sequences namespaces errors
+assocs words  arrays parser compiler syntax io
+quotations tools prettyprint optimizer inference ;
+IN: random-tester
+
+! n-foo>bar -- list of words of type 'foo' that take n parameters
+!              and output a 'bar'
+
+
+! Math vocabulary words
+: 1-x>y
+    {
+        1+ 1- >bignum >digit >fixnum abs absq arg 
+        bitnot bits>double bits>float ceiling cis conjugate cos cosec cosech
+        cosh cot coth denominator double>bits exp float>bits floor imaginary
+        log neg numerator real sec ! next-power-of-2
+        sech sgn sin sinh sq sqrt tan tanh truncate 
+    } ;
+
+: 1-x>y-throws
+    {
+        recip log2
+        asec asech acot acoth acosec acosech acos acosh asin asinh atan atanh
+    } ;
+
+: 2-x>y ( -- seq ) { * + - /f max min polar> bitand bitor bitxor align } ;
+: 2-x>y-throws ( -- seq ) { / /i mod rem } ;
+
+: 1-integer>x
+    {
+        1+ 1- >bignum >digit >fixnum abs absq arg 
+        bitnot bits>double bits>float ceiling cis conjugate cos cosec cosech
+        cosh cot coth denominator exp floor imaginary
+        log neg next-power-of-2 numerator real sec
+        sech sgn sin sinh sq sqrt tan tanh truncate 
+    } ;
+
+: 1-ratio>x
+    {
+        1+ 1- >bignum >digit >fixnum abs absq arg ceiling
+        cis conjugate cos cosec cosech
+        cosh cot coth exp floor imaginary
+        log neg next-power-of-2 real sec
+        sech sgn sin sinh sq sqrt tan tanh truncate 
+    } ;
+
+: 1-float>x ( -- seq )
+    {
+        1+ 1- >bignum >digit >fixnum abs absq arg 
+        ceiling cis conjugate cos cosec cosech
+        cosh cot coth double>bits exp float>bits floor imaginary
+        log neg real sec ! next-power-of-2
+        sech sgn sin sinh sq sqrt tan tanh truncate
+    } ;
+
+: 1-complex>x
+    {
+        1+ 1- abs absq arg conjugate cos cosec cosech
+        cosh cot coth exp imaginary log neg real
+        sec sech sin sinh sq sqrt tan tanh 
+    } ;
+
+: 1-integer>x-throws
+    {
+        recip log2
+        asec asech acot acoth acosec acosech acos acosh asin asinh atan atanh
+    } ;
+
+: 1-ratio>x-throws
+    {
+        recip
+        asec asech acot acoth acosec acosech acos acosh asin asinh atan atanh
+    } ;
+
+: 1-integer>integer
+    {
+        1+ 1- >bignum >digit >fixnum abs absq bitnot ceiling conjugate 
+        denominator floor imaginary
+        neg next-power-of-2 numerator real sgn sq truncate 
+    } ;
+
+: 1-ratio>ratio
+    { 1+ 1- >digit abs absq conjugate neg real sq } ;
+
+: 1-float>float
+    {
+        1+ 1- >digit abs absq arg ceiling
+        conjugate exp floor neg real sq truncate
+    } ;
+
+: 1-complex>complex
+    {
+        1+ 1- abs absq arg conjugate cosec cosech cosh cot coth exp log
+        neg sech sin sinh sq sqrt tanh 
+    } ;
+
+: 2-integer>x { * + - /f max min polar> bitand bitor bitxor align } ;
+: 2-ratio>x { * + - /f max min polar> } ;
+: 2-float>x { float+ float- float* float/f + - * /f max min polar> } ;
+: 2-complex>x { * + - /f } ;
+
+: 2-integer>integer { * + - max min bitand bitor bitxor align } ;
+: 2-ratio>ratio { * + - max min } ;
+: 2-float>float { float* float+ float- float/f max min /f + - } ;
+: 2-complex>complex { * + - /f } ;
+
+
+SYMBOL: last-quot
+SYMBOL: first-arg
+SYMBOL: second-arg
+: 0-runtime-check ( quot -- )
+    #! Checks the runtime only, not the compiler
+    #! Evaluates the quotation twice and makes sure the results agree
+    [ last-quot set ] keep
+    [ call ] keep
+    call
+    ! 2dup swap unparse write " " write unparse print flush
+    = [ last-quot get . "problem in runtime" throw ] unless ;
+
+: 1-runtime-check ( quot -- )
+    #! Checks the runtime only, not the compiler
+    #! Evaluates the quotation twice and makes sure the results agree
+    #! For quotations that are given one argument
+    [ last-quot set first-arg set ] 2keep
+    [ call ] 2keep
+    call
+    2dup swap unparse write " " write unparse print flush
+    = [ "problem in runtime" throw ] unless ;
+
+: 1-interpreted-vs-compiled-check ( x quot -- ) 
+    #! Checks the runtime output vs the compiler output
+    #! quot: ( x -- y )
+    2dup swap unparse write " " write . flush
+    [ last-quot set first-arg set ] 2keep
+    [ call ] 2keep compile-1
+    2dup swap unparse write " " write unparse print flush
+    = [ "problem in math1" throw ] unless ;
+
+: 2-interpreted-vs-compiled-check ( x y quot -- )
+    #! Checks the runtime output vs the compiler output
+    #! quot: ( x y -- z )
+    .s flush
+    [ last-quot set first-arg set second-arg set ] 3keep
+    [ call ] 3keep compile-1
+    2dup swap unparse write " " write unparse print flush
+    = [ "problem in math2" throw ] unless ;
+
+: 0-interpreted-vs-compiled-check-catch ( quot -- )
+    #! Check the runtime output vs the compiler output for words that throw
+    #!
+    dup .
+    [ last-quot set ] keep
+    [ catch [ "caught: " write dup print-error ] when* ] keep 
+    [ compile-1 ] catch [ nip "caught: " write dup print-error ] when*
+    = [ "problem in math3" throw ] unless ;
+
+: 1-interpreted-vs-compiled-check-catch ( quot -- )
+    #! Check the runtime output vs the compiler output for words that throw
+    2dup swap unparse write " " write .
+    ! "." write
+    [ last-quot set first-arg set ] 2keep
+    [ catch [ nip "caught: " write dup print-error ] when* ] 2keep 
+    [ compile-1 ] catch [ 2nip "caught: " write dup print-error ] when*
+    = [ "problem in math4" throw ] unless ;
+
+: 2-interpreted-vs-compiled-check-catch ( quot -- )
+    #! Check the runtime output vs the compiler output for words that throw
+    ! 3dup rot unparse write " " write swap unparse write " " write .
+    "." write
+    [ last-quot set first-arg set second-arg set ] 3keep
+    [ catch [ 2nip "caught: " write dup print-error ] when* ] 3keep
+    [ compile-1 ] catch [ 2nip nip "caught: " write dup print-error ] when*
+    = [ "problem in math5" throw ] unless ;
+
+
+! RANDOM QUOTATIONS TO TEST
+: random-1-integer>x-quot ( -- quot ) 1-integer>x random 1quotation ;
+: random-1-ratio>x-quot ( -- quot ) 1-ratio>x random 1quotation ;
+: random-1-float>x-quot ( -- quot ) 1-float>x random 1quotation ;
+: random-1-complex>x-quot ( -- quot ) 1-complex>x random 1quotation ;
+
+: test-1-integer>x ( -- )
+    random-integer random-1-integer>x-quot 1-interpreted-vs-compiled-check ;
+: test-1-ratio>x ( -- )
+    random-ratio random-1-ratio>x-quot 1-interpreted-vs-compiled-check ;
+: test-1-float>x ( -- )
+    random-float random-1-float>x-quot 1-interpreted-vs-compiled-check ;
+: test-1-complex>x ( -- )
+    random-complex random-1-complex>x-quot 1-interpreted-vs-compiled-check ;
+
+
+: random-1-float>float-quot ( -- obj ) 1-float>float random 1quotation ;
+: random-2-float>float-quot ( -- obj ) 2-float>float random 1quotation ;
+: nrandom-2-float>float-quot ( -- obj )
+    [
+        5
+        [
+            {
+                [ 2-float>float random , random-float , ]
+                [ 1-float>float random ,  ]
+            } do-one
+        ] times 
+        2-float>float random ,
+    ] [ ] make ;
+
+: test-1-float>float ( -- )
+    random-float random-1-float>float-quot 1-interpreted-vs-compiled-check ;
+: test-2-float>float ( -- )
+    random-float random-float random-2-float>float-quot
+    2-interpreted-vs-compiled-check ;
+
+: test-n-2-float>float ( -- )
+    random-float random-float nrandom-2-float>float-quot
+    2-interpreted-vs-compiled-check ;
+
+: test-1-integer>x-runtime ( -- )
+    random-integer random-1-integer>x-quot 1-runtime-check ;
+
+: random-1-integer>x-throws-quot ( -- obj ) 1-integer>x-throws random 1quotation ;
+: random-1-ratio>x-throws-quot ( -- obj ) 1-ratio>x-throws random 1quotation ;
+: test-1-integer>x-throws ( -- obj )
+    random-integer random-1-integer>x-throws-quot
+    1-interpreted-vs-compiled-check-catch ;
+: test-1-ratio>x-throws ( -- obj )
+    random-ratio random-1-ratio>x-throws-quot
+    1-interpreted-vs-compiled-check-catch ;
+
+
+
+: test-2-integer>x-throws ( -- )
+    [
+        random-integer , random-integer ,
+        2-x>y-throws random ,
+    ] [ ] make 2-interpreted-vs-compiled-check-catch ;
+
+! : test-^-ratio ( -- )
+    ! [
+        ! random-ratio , random-ratio , \ ^ ,
+    ! ] [ ] make interp-compile-check-catch ;
+
+: test-0-float?-when
+    [
+        random-number , \ dup , \ float? , 1-float>x random 1quotation , \ when ,
+    ] [ ] make 0-runtime-check ;
+
+: test-1-integer?-when
+    random-integer [
+        \ dup , \ integer? , 1-integer>x random 1quotation , \ when ,
+    ] [ ] make 1-interpreted-vs-compiled-check ;
+
+: test-1-ratio?-when
+    random-ratio [
+        \ dup , \ ratio? , 1-ratio>x random 1quotation , \ when ,
+    ] [ ] make 1-interpreted-vs-compiled-check ;
+
+: test-1-float?-when
+    random-float [
+        \ dup , \ float? , 1-float>x random 1quotation , \ when ,
+    ] [ ] make 1-interpreted-vs-compiled-check ;
+
+: test-1-complex?-when
+    random-complex [
+        \ dup , \ complex? , 1-complex>x random 1quotation , \ when ,
+    ] [ ] make 1-interpreted-vs-compiled-check ;
+
+
+: many-word-test ( -- )
+    #! defines words a1000 down to a0, which does a trivial addition
+    "random-tester-scratchpad" vocabularies get delete-at
+    "random-tester-scratchpad" set-in
+    "a0" "random-tester-scratchpad" create [ 1 1 + ] define-compound
+    100 [
+        [ 1+ "a" swap unparse append "random-tester-scratchpad" create ] keep
+        "a" swap unparse append [ parse ] catch [ :1 ] when define-compound
+    ] each ;
+
+: compile-loop ( -- )
+    10 [ many-word-test "a100" parse first compile ] times ;
+
+: random-test
+    "----" print
+    {
+        test-1-integer>x
+        test-1-ratio>x
+        test-1-float>x
+        test-1-complex>x
+        test-1-integer>x-throws
+        test-1-ratio>x-throws
+        test-1-float>float
+        test-2-float>float
+        ! test-n-2-float>float
+        test-1-integer>x-runtime
+        ! test-0-float?-when
+        test-1-integer?-when
+        test-1-ratio?-when
+        test-1-float?-when
+        test-1-complex?-when
+        ! full-gc
+        ! code-gc
+    } random dup . execute nl ;
+
diff --git a/unmaintained/random-tester/random-tester2.factor b/unmaintained/random-tester/random-tester2.factor
new file mode 100644 (file)
index 0000000..8a49830
--- /dev/null
@@ -0,0 +1,186 @@
+USING: compiler errors inference interpreter io kernel math
+memory namespaces prettyprint random-tester sequences tools
+quotations words arrays definitions generic graphs
+hashtables byte-arrays assocs network ;
+IN: random-tester2
+
+: dangerous-words ( -- array )
+    {
+        die
+        set-walker-hook exit
+        >r r> ndrop
+
+        set-callstack set-word set-word-prop
+        set-catchstack set-namestack set-retainstack
+        set-continuation-retain continuation-catch
+        set-continuation-name catchstack retainstack
+        set-no-math-method-generic
+        set-no-math-method-right
+        set-check-method-class
+        set-check-create-name
+        set-pathname-string
+        set-check-create-vocab
+        set-check-method-generic
+        <check-create> check-create?
+        reset-generic forget-class
+        create forget-word forget-vocab forget
+        forget-methods forget-predicate
+        remove-word-prop empty-method
+        continue-with <continuation>
+
+        define-compound define make-generic
+        define-method define-predicate-class
+        define-tuple-class define-temp define-tuple-slots
+        define-writer define-predicate define-generic
+        (define-union-class)
+        define-declared define-class
+        define-union-class define-inline
+        ?make-generic define-reader define-slot define-slots
+        define-typecheck define-slot-word define-union-class
+        define-simple-generic with-methods define-constructor
+        predicate-word condition-continuation define-symbol
+        tuple-predicate (sort-classes)
+
+        stdio
+        close readln read1 read read-until
+        stream-read stream-readln stream-read1 lines
+        contents stream-copy stream-flush
+        lines-loop
+        stream-format set-line-reader-cr
+        <client-stream> <server> <client>
+        <duplex-stream> <file-writer> <file-reader>
+        <style-stream> style-stream default-constructor
+        init-namespaces plain-writer
+        
+        with-datastack <quotation> datastack-underflow.
+        (delegates) simple-slot , # %
+        <continuation> continue-with set-delegate
+        callcc0 callcc1
+
+        :r :s :c
+
+        (next-power-of-2) (^) d>w/w w>h/h millis
+        (random) ^n integer, first-bignum
+        most-positive-fixnum ^ init-random next-power-of-2
+        most-negative-fixnum
+
+        clear-assoc build-graph
+
+        set-word-def set-word-name
+        set-word-props
+        set set-axis set-delegate set-global set-restart-obj
+
+
+
+        gensym random
+
+        double>bits float>bits >bignum
+
+        class-predicates delete (delete) memq?
+        prune join concat group at+
+        normalize norm vneg vmax vmin v- v+ [v-]
+        times repeat (repeat)
+        supremum infimum at norm-sq
+        product sum curry remove-all member? subseq?
+
+        ! O(n) on bignums
+        (add-vertex) (prune) (split) digits>integer
+        substitute ?head ?tail add-vertex all? base> closure
+        drop-prefix
+        find-last-sep format-column head? index index*
+        last-index mismatch push-new remove-vertex reset-props
+        seq-quot-uses sequence= split split, split1 start
+        start* string-lines string>integer tail? v.
+        
+        stack-picture
+        
+        ! allot crashes
+        at+ natural-sort
+
+        # % (delegates) +@ , . .s <continuation>
+        <quotation> <word> be> bin> callstack changed-word
+        changed-words continue-with counter dec
+        global
+        hex> inc le> namespace namestack nest oct> off
+        on parent-dir path+ 
+        simple-slot simple-slots string>number tabular-output
+        unxref-word xref-word xref-words vocabularies
+        with-datastack
+
+        bind if-graph ! 0 >n ! GCs
+
+        move-backward move-forward open-slice (open-slice) ! infinite loop
+        (assoc-stack) ! infinite loop
+
+        case ! 100000000000 t case ! takes a long time
+    } ;
+
+: safe-words ( -- array )
+    dangerous-words {
+        "arrays" "assocs" "bit-arrays" "byte-arrays"
+        "errors" "generic" "graphs" "hashtables" "io"
+        "kernel" "math" "namespaces" "quotations" "sbufs"
+        "queues" "strings" "sequences" "vectors" "words"
+    } [ words ] map concat seq-diff natural-sort ;
+    
+safe-words \ safe-words set-global
+
+: databank ( -- array )
+    {
+        ! V{ } H{ } V{ 3 } { 3 } { } "" "asdf"
+        pi 1/0. -1/0. 0/0. [ ]
+        f t "" 0 0.0 3.14 2 -3 -7 20 3/4 -3/4 1.2/3 3.5
+        C{ 2 2 } C{ 1/0. 1/0. }
+    } ;
+
+: setup-test ( #data #code -- data... quot )
+    #! variable stack effect
+    >r [ databank random ] times r>
+    [ drop \ safe-words get random ] map >quotation ;
+
+SYMBOL: before
+SYMBOL: after
+SYMBOL: quot
+SYMBOL: err
+err off
+
+: test-compiler ( data... quot -- ... )
+    err off
+    dup quot set
+    datastack clone dup pop* before set
+    [ call ] catch drop datastack clone after set
+    clear
+    before get [ ] each
+    quot get [ compile-1 ] [ err on ] recover ;
+
+: do-test ( data... quot -- )
+    .s flush test-compiler
+    err get [
+        datastack after get 2dup = [
+            2drop
+        ] [
+            [ . ] each
+            "--" print [ . ] each quot get .
+            "not =" throw
+        ] if
+    ] unless
+    clear ;
+
+: random-test* ( #data #code -- )
+    setup-test do-test ;
+
+: run-random-tester2
+    100000000000000 [ 6 3 random-test* ] times ;
+
+
+! A worthwhile test that has not been run extensively
+
+1000 [ drop gensym ] map "syms" set-global
+
+: fooify-test
+    "syms" get-global random
+    2000 random >quotation
+    over set-word-def
+    100 random zero? [ code-gc ] when
+    compile fooify-test ;
+
diff --git a/unmaintained/random-tester/random.factor b/unmaintained/random-tester/random.factor
new file mode 100644 (file)
index 0000000..da9a5c2
--- /dev/null
@@ -0,0 +1,87 @@
+USING: kernel math sequences namespaces errors hashtables words
+arrays parser compiler syntax io tools prettyprint optimizer
+inference ;
+IN: random-tester
+
+! Tweak me
+: max-length 15 ; inline
+: max-value 1000000000 ; inline
+
+: 10% ( -- bool ) 10 random 8 > ;
+: 20% ( -- bool ) 10 random 7 > ;
+: 30% ( -- bool ) 10 random 6 > ;
+: 40% ( -- bool ) 10 random 5 > ;
+: 50% ( -- bool ) 10 random 4 > ;
+: 60% ( -- bool ) 10 random 3 > ;
+: 70% ( -- bool ) 10 random 2 > ;
+: 80% ( -- bool ) 10 random 1 > ;
+: 90% ( -- bool ) 10 random 0 > ;
+
+! varying bit-length random number
+: random-bits ( n -- int )
+    random 2 swap ^ random ;
+
+: random-seq ( -- seq )
+    { [ ] { } V{ } "" } random
+    [ max-length random [ max-value random , ] times ] swap make ;
+
+: random-string
+    [ max-length random [ max-value random , ] times ] "" make ;
+
+SYMBOL: special-integers
+[ { -1 0 1 } % most-negative-fixnum , most-positive-fixnum , first-bignum , ] 
+{ } make \ special-integers set-global
+: special-integers ( -- seq ) \ special-integers get ;
+SYMBOL: special-floats
+[ { 0.0 -0.0 } % e , pi , 1./0. , -1./0. , 0./0. , epsilon , epsilon neg , ]
+{ } make \ special-floats set-global
+: special-floats ( -- seq ) \ special-floats get ;
+SYMBOL: special-complexes
+[ 
+    { -1 0 1 i -i } %
+    e , e neg , pi , pi neg ,
+    0 pi rect> , 0 pi neg rect> , pi neg 0 rect> , pi pi rect> ,
+    pi pi neg rect> , pi neg pi rect> , pi neg pi neg rect> ,
+    e neg e neg rect> , e e rect> ,
+] { } make \ special-complexes set-global
+: special-complexes ( -- seq ) \ special-complexes get ;
+
+: random-fixnum ( -- fixnum )
+    most-positive-fixnum random 1+ coin-flip [ neg 1- ] when >fixnum ;
+
+: random-bignum ( -- bignum )
+     400 random-bits first-bignum + coin-flip [ neg ] when ;
+    
+: random-integer ( -- n )
+    coin-flip [
+        random-fixnum
+    ] [
+        coin-flip [ random-bignum ] [ special-integers random ] if
+    ] if ;
+
+: random-positive-integer ( -- int )
+    random-integer dup 0 < [
+            neg
+        ] [
+            dup 0 = [ 1 + ] when
+    ] if ;
+
+: random-ratio ( -- ratio )
+    1000000000 dup [ random ] 2apply 1+ / coin-flip [ neg ] when dup [ drop random-ratio ] unless 10% [ drop 0 ] when ;
+
+: random-float ( -- float )
+    coin-flip [ random-ratio ] [ special-floats random ] if
+    coin-flip 
+    [ .0000000000000000001 /f ] [ coin-flip [ .00000000000000001 * ] when ] if
+    >float ;
+
+: random-number ( -- number )
+    {
+        [ random-integer ]
+        [ random-ratio ]
+        [ random-float ]
+    } do-one ;
+
+: random-complex ( -- C )
+    random-number random-number rect> ;
+
diff --git a/unmaintained/random-tester/type.factor b/unmaintained/random-tester/type.factor
new file mode 100644 (file)
index 0000000..bda0284
--- /dev/null
@@ -0,0 +1,218 @@
+USING: arrays errors generic hashtables io kernel lazy-lists math
+memory modules namespaces null-stream prettyprint random-tester2
+quotations sequences strings
+tools vectors words ;
+IN: random-tester
+
+: inert ;
+TUPLE: inert-object ;
+
+: inputs ( -- seq )
+    {
+        0 -1 -1000000000000000000000000 2
+        inert
+        -29/2
+        1000000000000000000000000000000/1111111111111111111111111111111111
+        3/4
+            -1000000000000000000000000/111111111111111111
+        -3.14 1/0. 0.0 -1/0. 3.14 0/0.
+        20102101010100110110
+        C{ 1 -1 }
+        W{ 55 }
+        { }
+        f  t
+        ""
+        "asdf"
+        [ ]
+        ! DLL" libm.dylib"
+        ! ALIEN: 1
+        T{ inert-object f }
+    }
+    [
+        H{ { 1 2 } { "asdf" "foo" } } clone ,
+        H{ } clone ,
+        V{ 1 0 65536 } clone ,
+        V{ } clone ,
+        SBUF" " clone ,
+        B{ } clone ,
+        ?{ } clone ,
+    ] { } make append ;
+
+TUPLE: success quot inputs outputs input-types output-types ;
+
+SYMBOL: err
+SYMBOL: last-time
+SYMBOL: quot
+SYMBOL: output
+SYMBOL: input
+SYMBOL: silent
+t silent set-global
+
+: test-quot ( input quot -- success/f )
+    ! 2dup swap . . flush
+    ! dup [ hash+ ] = [ 2dup . . flush ] when
+    err off
+    quot set input set
+    silent get [
+        quot get last-time get = [
+            quot get
+            dup . flush
+            last-time set
+        ] unless
+    ] unless
+    [
+        clear
+        input get >vector set-datastack quot get
+        [ [ [ call ] { } make drop ] with-null-stream ]
+        [ err on ] recover
+        datastack clone output set
+    ] with-saved-datastack
+    err get [
+        f
+    ] [
+        quot get input get output get
+        2dup [ [ type ] map ] 2apply <success>
+    ] if ;
+    
+: test-inputs ( word -- seq )
+    [
+        [ word-input-count inputs swap ] keep
+        1quotation [
+            test-quot [ , ] when*
+        ] curry each-permutation
+    ] { } make ;
+    
+: >types ( quot -- seq )
+    map concat prune natural-sort ;
+
+: >output-types ( seq -- seq )
+    #! input seq is the result of test-inputs
+    [ success-output-types ] >types ;
+
+: >input-types ( seq -- seq )
+    #! input seq is the result of test-inputs
+    [ success-input-types ] >types ;
+  
+TUPLE: typed quot inputs outputs ;
+
+: successes>typed ( seq -- typed )
+    dup empty? [
+        drop f { } clone { } clone <typed>
+    ] [
+        [ first success-quot ] keep
+        [ >input-types ] keep >output-types <typed>
+    ] if ;
+
+: word>type-check ( word -- tuple )
+    [
+        dup test-inputs
+        successes>typed ,
+    ] curry [ with-saved-datastack ] { } make first ;
+
+: type>name ( n -- string )
+    dup integer? [
+        {
+            "fixnum"
+            "bignum"
+            "word"
+            "obj"
+            "ratio"
+            "float"
+            "complex"
+            "wrapper"
+            "array"
+            "boolean"
+            "hashtable"
+            "vector"
+            "string"
+            "sbuf"
+            "quotation"
+            "dll"
+            "alien"
+            "tuple"
+        } nth
+    ] when ;
+    
+: replace-subseqs ( seq new old -- seq )
+    [
+        swapd split1 [ append swap add ] [ nip ] if*
+    ] 2each ;
+
+: type-array>name ( seq -- seq )
+    {
+        { "object" { 0 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 } }
+        { "seq3" { 0 1 8 9 11 12 13 14 } }
+        { "seq2" { 0 8 9 11 12 13 14 } }
+        { "seq" { 8 9 11 12 13 14 } }
+        { "number" { 0 1 4 5 6 } }
+        { "real" { 0 1 4 5 } }
+        { "rational" { 0 1 4 } }
+        { "integer" { 0 1 } }
+        { "float/complex" { 5 6 } }
+        { "word/f" { 2 9 } }
+    } flip first2 replace-subseqs [ type>name ] map ;
+
+: buggy?
+    [ word>type-check ] catch [
+        drop f
+    ] [
+        2array [ [ type-array>name ] map ] map
+        [ [ length 1 = ] all? ] all? not
+    ] if ;
+
+: variable-stack-effect?
+    [ word>type-check ] catch nip ;
+
+: find-words ( quot -- seq )
+    \ safe-words get
+    [
+        word-input-count 3 <=
+    ] subset swap subset ;
+
+: find-safe ( -- seq ) [ buggy? not ] find-words ;
+
+: find-buggy ( -- seq ) [ buggy? ] find-words ;
+
+: test-word ( output input word -- ? )
+    1quotation test-quot dup [
+        success-outputs sequence=
+    ] [
+        nip
+    ] if ;
+
+: word-finder ( inputs outputs -- seq )
+    swap safe-words
+    [ >r 2dup r> test-word ] subset 2nip ;
+
+: (enumeration-test)
+    [
+        [ stack-effect effect-in length ] catch [ 4 < ] unless
+    ] subset [ [ test-inputs successes>typed , ] each ] { } make ;
+
+! full-gc finds corrupted memory faster
+
+: enumeration-test ( -- seq )
+    [
+        \ safe-words get
+        f silent set
+        (enumeration-test)
+    ] with-scope ;
+    
+: array>all-quots ( seq n -- seq )
+    [
+        [ 1+ [ >quotation , ] each-permutation ] each-with
+    ] { } make ;
+
+: array>all ( seq n -- seq )
+    dupd array>all-quots append ;
+
+: quot-finder ( inputs outputs -- seq )
+    swap safe-words 2 array>all
+    [
+        3 [ >quotation >r 2dup r> [ test-quot ] keep
+        swap [ , ] [ drop ] if ] each-permutation
+    ] { } make ;
+
+: word-frequency ( -- alist )
+    all-words [ dup usage length 2array ] map sort-values ;
+
diff --git a/unmaintained/random-tester/utils.factor b/unmaintained/random-tester/utils.factor
new file mode 100644 (file)
index 0000000..e699d53
--- /dev/null
@@ -0,0 +1,77 @@
+USING: generic kernel math sequences namespaces errors
+assocs words arrays parser compiler syntax io
+quotations optimizer inference shuffle tools prettyprint ;
+IN: random-tester
+
+: word-input-count ( word -- n )
+    [ stack-effect effect-in length ] [ 2drop 0 ] recover ;
+    
+: type-error? ( exception -- ? )
+    [ swap execute or ] curry
+    >r { no-method? no-math-method? } f r> reduce ;
+
+! HASHTABLES
+: random-hash-entry ( hash -- key value )
+    [ keys random dup ] keep at ;
+
+: coin-flip ( -- bool ) 2 random zero? ;
+: do-one ( seq -- ) random call ; inline
+
+: nzero-array ( seq -- )
+    dup length >r 0 r> [ pick set-nth ] each-with drop ;
+    
+: zero-array ( n -- seq ) [ drop 0 ] map ;
+
+TUPLE: p-list seq max count count-vec ;
+: make-p-list ( seq n -- tuple )
+    >r dup length [ 1- ] keep r>
+    [ ^ 0 swap 2array ] keep
+    zero-array <p-list> ;
+
+: inc-seq ( seq max -- )
+    2dup [ < ] curry find-last over -1 = [
+        3drop nzero-array
+    ] [
+        nipd 1+ 2over swap set-nth
+        1+ over length rot <slice> nzero-array
+    ] if ;
+
+: inc-count ( tuple -- )
+    [ p-list-count first2 >r 1+ r> 2array ] keep
+    set-p-list-count ;
+
+: get-permutation ( tuple -- seq )
+    [ p-list-seq ] keep p-list-count-vec [ swap nth ] map-with ;
+
+: p-list-next ( tuple -- seq/f )
+    dup p-list-count first2 < [
+        [
+            [ get-permutation ] keep 
+            [ p-list-count-vec ] keep p-list-max
+            inc-seq
+        ] keep inc-count
+    ] [
+        drop f
+    ] if ;
+
+: (permutations) ( tuple -- )
+    dup p-list-next [ , (permutations) ] [ drop ] if* ;
+
+: permutations ( seq n -- seq )
+    make-p-list [ (permutations) ] { } make ;
+
+: (each-permutation) ( tuple quot -- )
+    over p-list-next [
+        [ rot drop swap call ] 3keep
+        drop (each-permutation)
+    ] [
+        2drop
+    ] if* ; inline
+
+: each-permutation ( seq n quot -- )
+    >r make-p-list r> (each-permutation) ;
+
+SYMBOL: saved-datastack
+: with-saved-datastack
+    >r datastack saved-datastack set r> call
+    saved-datastack get set-datastack ; inline
diff --git a/unmaintained/regexp/load.factor b/unmaintained/regexp/load.factor
new file mode 100644 (file)
index 0000000..989452e
--- /dev/null
@@ -0,0 +1,10 @@
+REQUIRES: libs/memoize ;
+PROVIDE: libs/regexp
+{ +files+ {
+    "tables.factor"
+    "regexp.factor"
+} } { +tests+ {
+    "test/regexp.factor"
+    "test/tables.factor"
+} } ;
+
diff --git a/unmaintained/regexp/regexp.factor b/unmaintained/regexp/regexp.factor
new file mode 100644 (file)
index 0000000..de233b2
--- /dev/null
@@ -0,0 +1,501 @@
+USING: arrays errors generic assocs io kernel math
+memoize namespaces kernel sequences strings tables
+vectors ;
+USE: interpreter
+USE: prettyprint
+USE: test
+
+IN: regexp-internals
+
+SYMBOL: trans-table
+SYMBOL: eps
+SYMBOL: start-state
+SYMBOL: final-state
+
+SYMBOL: paren-count
+SYMBOL: currentstate
+SYMBOL: stack
+
+SYMBOL: bot
+SYMBOL: eot
+SYMBOL: alternation
+SYMBOL: lparen
+SYMBOL: rparen
+
+: regexp-init ( -- )
+    0 paren-count set
+    -1 currentstate set
+    V{ } clone stack set
+    <vector-table> final-state over add-column trans-table set ;
+
+: paren-underflow? ( -- )
+    paren-count get 0 < [ "too many rparen" throw ] when ;
+
+: unbalanced-paren? ( -- )
+    paren-count get 0 > [ "neesds closing paren" throw ] when ;
+
+: inc-paren-count ( -- )
+    paren-count [ 1+ ] change ;
+
+: dec-paren-count ( -- )
+    paren-count [ 1- ] change paren-underflow? ;
+
+: push-stack ( n -- ) stack get push ;
+: next-state ( -- n )
+    currentstate [ 1+ ] change currentstate get ;
+: current-state ( -- n ) currentstate get ;
+
+: set-trans-table ( row col data -- )
+    <entry> trans-table get set-value ;
+
+: add-trans-table ( row col data -- )
+    <entry> trans-table get add-value ;
+
+: data-stack-slice ( token -- seq )
+    stack get reverse [ index ] keep cut reverse dup pop* stack set reverse ;
+
+: find-start-state ( table -- n )
+    start-state t rot find-by-column first ;
+
+: find-final-state ( table -- n )
+    final-state t rot find-by-column first ;
+
+: final-state? ( row table -- ? )
+    get-row final-state swap key? ;
+
+: switch-rows ( r1 r2 -- )
+    [ 2array [ trans-table get get-row ] each ] 2keep
+    2array [ trans-table get set-row ] each ;
+
+: set-table-prop ( prop s table -- )
+    pick over add-column table-rows
+    [
+        pick rot member? [
+            pick t swap rot set-at
+        ] [
+            drop
+        ] if
+    ] assoc-each 2drop ;
+
+: add-numbers ( n obj -- obj )
+    dup sequence? [ 
+        [ + ] map-with
+    ] [
+        dup number? [ + ] [ nip ] if
+    ] if ;
+
+: increment-cols ( n row -- )
+    ! n row
+    dup [ >r pick r> add-numbers swap pick set-at ] assoc-each 2drop ;
+
+: complex-count ( c -- ci-cr+1 )
+    >rect swap - 1+ ;
+
+: copy-rows ( c1 -- )
+    #! copy rows to the bottom with a new row-name c1_range higher
+    [ complex-count ] keep trans-table get table-rows ! 2 C{ 0 1 } rows
+    [ drop [ over real >= ] keep pick imaginary <= and ] assoc-subset nip
+    [ clone [ >r over r> increment-cols ] keep swap pick + trans-table get set-row ] assoc-each ! 2
+    currentstate get 1+ dup pick + 1- rect> push-stack
+    currentstate [ + ] change ;
+
+
+! s1 final f ! s1 eps s2 ! output s0,s3
+: apply-concat ( seq -- )
+    ! "Concat: " write dup .
+    dup pop over pop swap
+    over imaginary final-state f set-trans-table
+    2dup >r imaginary eps r> real add-trans-table
+    >r real r> imaginary rect> swap push ; 
+
+! swap 0, 4 so 0 is incoming
+! ! s1 final f ! s3 final f ! s4 e s0 ! s4 e s2 ! s1 e s5 ! s3 e s5
+! ! s5 final t ! s4,s5 push
+
+SYMBOL: saved-state
+: apply-alternation ( seq -- )
+    ! "Alternation: " print
+    dup pop over pop* over pop swap
+    next-state trans-table get add-row
+    >r >rect >r saved-state set current-state r> rect> r> 
+    ! 4,1 2,3
+    over real saved-state get trans-table get swap-rows
+    saved-state get start-state t set-trans-table
+    over real start-state f set-trans-table
+    over imaginary final-state f set-trans-table
+    dup imaginary final-state f set-trans-table
+    over real saved-state get eps rot add-trans-table
+    dup real saved-state get eps rot add-trans-table
+    imaginary eps next-state add-trans-table
+    imaginary eps current-state add-trans-table
+    current-state final-state t set-trans-table
+    saved-state get current-state rect> swap push ;
+
+! s1 final f ! s1 e s0 ! s2 e s0 ! s2 e s3 ! s1 e s3 ! s3 final t
+: apply-kleene-closure ( -- )
+    ! "Apply kleene closure" print
+    stack get pop
+    next-state trans-table get add-row
+    >rect >r [ saved-state set ] keep current-state 
+        [ trans-table get swap-rows ] keep r> rect>
+
+    dup imaginary final-state f set-trans-table
+    dup imaginary eps pick real add-trans-table
+    saved-state get eps pick real add-trans-table
+    saved-state get eps next-state add-trans-table
+    imaginary eps current-state add-trans-table
+    current-state final-state t add-trans-table
+    saved-state get current-state rect> push-stack ;
+
+: apply-plus-closure ( -- )
+    ! "Apply plus closure" print
+    stack get peek copy-rows
+    apply-kleene-closure stack get apply-concat ;
+
+: apply-alternation? ( seq -- ? )
+    dup length dup 3 < [
+        2drop f
+    ] [
+        2 - swap nth alternation =
+    ] if ; 
+
+: apply-concat? ( seq -- ? )
+    dup length dup 2 < [
+        2drop f
+    ] [
+        2 - swap nth complex?
+    ] if ;
+
+: (apply) ( slice -- slice )
+    dup length 1 > [
+        {
+            { [ dup apply-alternation? ]
+                [ [ apply-alternation ] keep (apply) ] }
+            { [ dup apply-concat? ]
+                [ [ apply-concat ] keep (apply) ] }
+        } cond
+    ] when ;
+
+: apply-til-last ( tokens -- slice )
+    data-stack-slice (apply) ;
+
+: maybe-concat ( -- )
+    stack get apply-concat? [ stack get apply-concat ] when ;
+
+: maybe-concat-loop ( -- )
+    stack get length maybe-concat stack get length > [
+        maybe-concat-loop
+    ] when ;
+
+: create-nontoken-nfa ( tok -- )
+    next-state swap next-state <entry>
+    [ trans-table get set-value ] keep
+    entry-value final-state t set-trans-table
+    current-state [ 1- ] keep rect> push-stack ;
+
+! stack gets:  alternation C{ 0 1 }
+: apply-question-closure ( -- )
+    alternation push-stack
+    eps create-nontoken-nfa stack get apply-alternation ;
+
+! {2}  exactly twice,  {2,} 2 or more,  {2,4} exactly 2,3,4 times
+! : apply-bracket-closure ( c1 -- )
+    ! ;
+SYMBOL: character-class
+SYMBOL: brace
+SYMBOL: escaped-character
+SYMBOL: octal
+SYMBOL: hex
+SYMBOL: control
+SYMBOL: posix
+
+: addto-character-class ( char -- )
+    ;
+
+: make-escaped ( char -- )
+    {
+        ! TODO: POSIX character classes (US-ASCII only)
+        ! TODO: Classes for Unicode blocks and categories
+
+        ! { CHAR: { [ ] } ! left brace
+        { CHAR: \\ [ ] } ! backaslash
+
+        { CHAR: 0 [ ] } ! octal \0n \0nn \0mnn (0 <= m <= 3, 0 <= n <= 7)
+        { CHAR: x [ ] } ! \xhh
+        { CHAR: u [ ] } ! \uhhhh
+        { CHAR: t [ ] } ! tab \u0009
+        { CHAR: n [ ] } ! newline \u000a
+        { CHAR: r [ ] } ! carriage-return \u000d
+        { CHAR: f [ ] } ! form-feed \u000c
+        { CHAR: a [ ] } ! alert (bell) \u0007
+        { CHAR: e [ ] } ! escape \u001b
+        { CHAR: c [ ] } ! control character corresoding to X in \cX
+
+        { CHAR: d [ ] } ! [0-9]
+        { CHAR: D [ ] } ! [^0-9]
+        { CHAR: s [ ] } ! [ \t\n\x0B\f\r]
+        { CHAR: S [ ] } ! [^\s]
+        { CHAR: w [ ] } ! [a-zA-Z_0-9]
+        { CHAR: W [ ] } ! [^\w]
+
+        { CHAR: b [ ] } ! a word boundary
+        { CHAR: B [ ] } ! a non-word boundary
+        { CHAR: A [ ] } ! the beginning of input
+        { CHAR: G [ ] } ! the end of the previous match
+        { CHAR: Z [ ] } ! the end of the input but for the
+                        ! final terminator, if any
+        { CHAR: z [ ] } ! the end of the input
+    } case ;
+
+: handle-character-class ( char -- )
+    {
+        { [ \ escaped-character get ] [ make-escaped \ escaped-character off ] }
+        { [ dup CHAR: ] = ] [ \ character-class off ] }
+        { [ t ] [ addto-character-class ] }
+    } cond ;
+
+: parse-token ( char -- )
+    {
+        ! { [ \ character-class get ] [ ] }
+        ! { [ \ escaped-character get ] [ ] }
+        ! { [ dup CHAR: [ = ] [ \ character-class on ] }
+        ! { [ dup CHAR: \\ = ] [ drop \ escaped-character on ] }
+
+        ! { [ dup CHAR: ^ = ] [ ] }
+        ! { [ dup CHAR: $ = ] [ ] }
+        ! { [ dup CHAR: { = ] [ ] }
+        ! { [ dup CHAR: } = ] [ ] }
+
+        { [ dup CHAR: | = ]
+            [ drop maybe-concat-loop alternation push-stack ] }
+        { [ dup CHAR: * = ]
+            [ drop apply-kleene-closure ] }
+        { [ dup CHAR: + = ]
+            [ drop apply-plus-closure ] }
+        { [ dup CHAR: ? = ]
+            [ drop apply-question-closure ] }
+
+        { [ dup CHAR: ( = ]
+            [ drop inc-paren-count lparen push-stack ] }
+        { [ dup CHAR: ) = ]
+            [
+                drop dec-paren-count lparen apply-til-last
+                stack get push-all
+            ] } ! apply
+
+
+        { [ dup bot = ] [ push-stack ] }
+        { [ dup eot = ]
+            [
+                drop unbalanced-paren? maybe-concat-loop bot apply-til-last
+                dup length 1 = [
+                    pop real start-state t set-trans-table
+                ] [
+                    drop
+                ] if
+            ] }
+        { [ t ] [ create-nontoken-nfa ] }
+    } cond ;
+
+: cut-at-index ( i string ch -- i subseq )
+    -rot [ index* ] 2keep >r >r [ 1+ ] keep r> swap r> subseq ;
+
+: parse-character-class ( index string -- new-index obj )
+    2dup >r 1+ r> nth CHAR: ] = [ >r 1+ r> ] when
+    cut-at-index ;
+
+: (parse-regexp) ( str -- )
+    dup length [
+        2dup swap character-class get [
+            parse-character-class
+            "CHARACTER CLASS: " write .
+            character-class off
+            nip ! adjust index
+        ] [
+            nth parse-token
+        ] if
+    ] repeat ;
+
+: parse-regexp ( str -- )
+    bot parse-token
+    ! [ "parsing: " write dup ch>string . parse-token ] each
+    [ parse-token ] each
+    ! (parse-regexp)
+    eot parse-token ;
+
+: push-all-diff ( seq seq -- diff )
+    [ swap seq-diff ] 2keep push-all ;
+
+: prune-sort ( vec -- vec )
+    prune natural-sort >vector ;
+
+SYMBOL: ttable
+SYMBOL: transition
+SYMBOL: check-list
+SYMBOL: initial-check-list
+SYMBOL: result
+
+: init-find ( data state table -- )
+    ttable set
+    dup sequence? [ clone >vector ] [ V{ } clone [ push ] keep ] if
+    [ check-list set ] keep clone initial-check-list set
+    V{ } clone result set
+    transition set ;
+
+: (find-next-state) ( -- )
+    check-list get [
+        [
+            ttable get get-row transition get swap at*
+                [ dup sequence? [ % ] [ , ] if ] [ drop ] if
+        ] each
+    ] { } make
+    result get push-all-diff
+    check-list set
+    result get prune-sort result set ;
+
+: (find-next-state-recursive) ( -- )
+    check-list get empty? [ (find-next-state) (find-next-state-recursive) ] unless ;
+
+: find-epsilon-closure ( state table -- vec )
+    eps -rot init-find
+    (find-next-state-recursive) result get initial-check-list get append natural-sort ;
+
+: find-next-state ( data state table -- vec )
+    find-epsilon-closure check-list set
+    V{ } clone result set transition set
+    (find-next-state) result get ttable get find-epsilon-closure ;
+
+: filter-cols ( vec -- vec )
+    #! remove info columns state-state, eps, final
+    clone start-state over delete-at eps over delete-at
+    final-state over delete-at ;
+
+SYMBOL: old-table
+SYMBOL: new-table
+SYMBOL: todo-states
+SYMBOL: transitions
+
+: init-nfa>dfa ( table -- )
+    <vector-table> new-table set
+    [ table-columns clone filter-cols keys transitions set ] keep
+    dup [ find-start-state ] keep find-epsilon-closure
+    V{ } clone [ push ] keep todo-states set
+    old-table set ;
+
+: create-row ( state table -- )
+    2dup row-exists?
+    [ 2drop ] [ [ add-row ] 2keep drop todo-states get push ] if ;
+
+: (nfa>dfa) ( -- )
+    todo-states get dup empty? [
+        pop transitions get [
+            2dup swap old-table get find-next-state
+            dup empty? [
+                3drop
+            ] [
+                dup new-table get create-row
+                <entry> new-table get set-value
+            ] if
+        ] each-with 
+    ] unless* todo-states get empty? [ (nfa>dfa) ] unless ;
+
+: nfa>dfa ( table -- table )
+    init-nfa>dfa
+    (nfa>dfa)
+    start-state old-table get find-start-state
+    new-table get set-table-prop
+    final-state old-table get find-final-state
+    new-table get [ set-table-prop ] keep ;
+
+SYMBOL: regexp
+SYMBOL: text
+SYMBOL: matches
+SYMBOL: partial-matches
+TUPLE: partial-match index row count ;
+! a state is a vector
+! state is a key in a hashtable. the value is a hashtable of transition states
+
+: save-partial-match ( index row -- )
+    1 <partial-match> dup partial-match-index
+    \ partial-matches get set-at ;
+
+: inc-partial-match ( partial-match -- )
+    [ partial-match-count 1+ ] keep set-partial-match-count ;
+
+: check-final-state ( partial-match -- )
+    dup partial-match-row regexp get final-state? [
+        clone dup partial-match-index matches get set-at
+    ] [
+        drop
+    ] if ;
+
+: check-trivial-match ( row regexp -- )
+    dupd final-state? [
+        >r 0 r> 0 <partial-match>
+        0 matches get set-at
+    ] [
+        drop
+    ] if ;
+
+: update-partial-match ( char partial-match -- )
+    tuck partial-match-row regexp get get-row at* [
+        over set-partial-match-row
+        inc-partial-match
+    ] [
+        drop
+        partial-match-index partial-matches get delete-at
+    ] if ;
+
+: regexp-step ( index char start-state -- )
+    ! check partial-matches
+    over \ partial-matches get
+    [ nip update-partial-match ] assoc-each-with
+
+    ! check new match
+    at* [
+        save-partial-match
+    ] [
+        2drop
+    ] if
+    partial-matches get values [ check-final-state ] each ;
+
+: regexp-match ( text regexp -- seq )
+    #! text is the haystack
+    #! regexp is a table describing the needle
+    H{ } clone \ matches set
+    H{ } clone \ partial-matches set
+    dup regexp set
+    >r dup text set r>
+    [ find-start-state ] keep
+    2dup check-trivial-match
+    get-row
+    swap [ length ] keep
+    [ pick regexp-step ] 2each drop
+    matches get values [
+        [ partial-match-index ] keep
+        partial-match-count dupd + text get <slice>
+    ] map ;
+
+IN: regexp
+MEMO: make-regexp ( str -- table )
+    [
+        regexp-init
+        parse-regexp
+        trans-table get nfa>dfa
+    ] with-scope ;
+
+! TODO: make compatible with
+! http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
+
+! Greedy
+! Match the longest possible string, default
+! a+
+
+! Reluctant
+! Match on shortest possible string
+! / in vi does this (find next)
+! a+?
+
+! Possessive
+! Match only when the entire text string matches
+! a++
diff --git a/unmaintained/regexp/tables.factor b/unmaintained/regexp/tables.factor
new file mode 100644 (file)
index 0000000..76b27e1
--- /dev/null
@@ -0,0 +1,111 @@
+USING: errors generic kernel namespaces
+sequences vectors assocs ;
+IN: tables
+
+TUPLE: table rows columns ;
+TUPLE: entry row-key column-key value ;
+GENERIC: add-value ( entry table -- )
+
+C: table ( -- obj )
+       H{ } clone over set-table-rows
+       H{ } clone over set-table-columns ;
+
+: (add-row) ( row-key table -- row )
+       2dup table-rows at* [
+        2nip
+       ] [
+               drop H{ } clone [ -rot table-rows set-at ] keep
+       ] if ;
+
+: add-row ( row-key table -- )
+    (add-row) drop ;
+
+: add-column ( column-key table -- )
+       t -rot table-columns set-at ;
+
+: set-row ( row row-key table -- )
+       table-rows set-at ;
+
+: lookup-row ( row-key table -- row/f ? )
+    table-rows at* ;
+
+: row-exists? ( row-key table -- ? )
+    lookup-row nip ;
+
+: lookup-column ( column-key table -- column/f ? )
+    table-columns at* ;
+
+: column-exists? ( column-key table -- ? )
+    lookup-column nip ;
+
+TUPLE: no-row key ;
+TUPLE: no-column key ;
+
+: get-row ( row-key table -- row )
+    dupd lookup-row [
+        nip
+    ] [
+        drop <no-row> throw
+    ] if ;
+
+: get-column ( column-key table -- column )
+    dupd lookup-column [
+        nip
+    ] [
+        drop <no-column> throw
+    ] if ;
+
+: get-value ( row-key column-key table -- obj ? )
+    swapd lookup-row [
+        at*
+    ] [
+        2drop f f
+    ] if ;
+
+: (set-value) ( entry table -- value column-key row )
+    [ >r entry-column-key r> add-column ] 2keep
+    dupd >r entry-row-key r> (add-row)
+    >r [ entry-value ] keep entry-column-key r> ;
+
+: set-value ( entry table -- )
+    (set-value) set-at ;
+    
+: swap-rows ( row-key1 row-key2 table -- )
+       [ tuck get-row >r get-row r> ] 3keep
+       >r >r rot r> r> [ set-row ] keep set-row ;
+
+: member?* ( obj obj -- bool )
+    2dup = [ 2drop t ] [ member? ] if ;
+
+: find-by-column ( column-key data table -- seq )
+    swapd 2dup lookup-column 2drop 
+    [
+        table-rows [
+            pick swap at* [ 
+                >r pick r> member?* [ , ] [ drop ] if
+            ] [ 
+                2drop
+            ] if 
+        ] assoc-each
+    ] { } make 2nip ;
+
+    
+TUPLE: vector-table ;
+C: vector-table ( -- obj )
+    <table> over set-delegate ;
+
+: add-hash-vector ( value key hash -- )
+    2dup at* [
+        dup vector? [
+            2nip push
+        ] [
+            V{ } clone [ push ] keep
+            -rot >r >r [ push ] keep r> r> set-at
+        ] if
+    ] [
+        drop set-at
+    ] if ;
+M: vector-table add-value ( entry table -- )
+    (set-value) add-hash-vector ;
+
diff --git a/unmaintained/regexp/test/regexp.factor b/unmaintained/regexp/test/regexp.factor
new file mode 100644 (file)
index 0000000..36c627c
--- /dev/null
@@ -0,0 +1,30 @@
+USING: kernel sequences namespaces errors io math tables arrays generic hashtables vectors strings parser ;
+USING: prettyprint test ;
+USING: regexp-internals regexp ;
+
+[ "dog" ] [ "dog" "cat|dog" make-regexp regexp-match first >string ] unit-test 
+[ "cat" ] [ "cat" "cat|dog" make-regexp regexp-match first >string ] unit-test 
+[ "a" ] [ "a" "a|b|c" make-regexp regexp-match first >string ] unit-test 
+[ "" ] [ "" "a*" make-regexp regexp-match first >string ] unit-test 
+[ "aaaa" ] [ "aaaa" "a*" make-regexp regexp-match first >string ] unit-test 
+[ "aaaa" ] [ "aaaa" "a+" make-regexp regexp-match first >string ] unit-test 
+[ t ] [ "" "a+" make-regexp regexp-match empty? ] unit-test 
+[ "cadog" ] [ "cadog" "ca(t|d)og" make-regexp regexp-match first >string ] unit-test 
+[ "catog" ] [ "catog" "ca(t|d)og" make-regexp regexp-match first >string ] unit-test 
+[ "cadog" ] [ "abcadoghi" "ca(t|d)og" make-regexp regexp-match first >string ] unit-test 
+[ t ] [ "abcatdoghi" "ca(t|d)og" make-regexp regexp-match empty? ] unit-test 
+
+[ "abcdefghijklmnopqrstuvwxyz" ] [ "abcdefghijklmnopqrstuvwxyz" "a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+" make-regexp regexp-match first >string ] unit-test 
+[ "aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz" ] [ "aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz" "a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+" make-regexp regexp-match first >string ] unit-test 
+[ t ] [ "aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyy" "a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+" make-regexp regexp-match empty? ] unit-test 
+[ "abcdefghijklmnopqrstuvwxyz" ] [ "abcdefghijklmnopqrstuvwxyz" "a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*" make-regexp regexp-match first >string ] unit-test 
+[ "" ] [ "" "a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*" make-regexp regexp-match first >string ] unit-test 
+[ "az" ] [ "az" "a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*" make-regexp regexp-match first >string ] unit-test 
+
+[ t ] [ "abc" "a?b?c?" make-regexp regexp-match length 3 = ] unit-test
+[ "ac" ] [ "ac" "a?b?c?" make-regexp regexp-match first >string ] unit-test
+[ "" ] [ "" "a?b?c?" make-regexp regexp-match first >string ] unit-test
+[ t ] [ "aabc" "a?b?c?" make-regexp regexp-match length 4 = ] unit-test
+[ "abbbccdefefffeffe" ] [ "abbbccdefefffeffe" "(a?b*c+d(e|f)*)+" make-regexp regexp-match first >string ] unit-test
+[ t ] [ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" make-regexp regexp-match length 29 = ] unit-test
+
diff --git a/unmaintained/regexp/test/tables.factor b/unmaintained/regexp/test/tables.factor
new file mode 100644 (file)
index 0000000..4ce339a
--- /dev/null
@@ -0,0 +1,49 @@
+USING: kernel tables test ;
+
+: test-table
+    <table>
+    "a" "c" "z" <entry> over set-value
+    "a" "o" "y" <entry> over set-value
+    "a" "l" "x" <entry> over set-value
+    "b" "o" "y" <entry> over set-value
+    "b" "l" "x" <entry> over set-value
+    "b" "s" "u" <entry> over set-value ;
+
+[
+    T{ table f
+    H{ 
+        { "a" H{ { "l" "x" } { "c" "z" } { "o" "y" } } }
+        { "b" H{ { "l" "x" } { "s" "u" } { "o" "y" } } }
+    }
+    H{ { "l" t } { "s" t } { "c" t } { "o" t } } }
+] [ test-table ] unit-test
+
+[ "x" t ] [ "a" "l" test-table get-value ] unit-test
+[ "har" t ] [
+    "a" "z" "har" <entry> test-table [ set-value ] keep
+    >r "a" "z" r> get-value
+] unit-test
+
+: vector-test-table
+    <vector-table>
+    "a" "c" "z" <entry> over add-value
+    "a" "c" "r" <entry> over add-value
+    "a" "o" "y" <entry> over add-value
+    "a" "l" "x" <entry> over add-value
+    "b" "o" "y" <entry> over add-value
+    "b" "l" "x" <entry> over add-value
+    "b" "s" "u" <entry> over add-value ;
+
+[
+T{ vector-table
+    T{ table f
+    H{ 
+        { "a"
+            H{ { "l" "x" } { "c" V{ "z" "r" } } { "o" "y" } } }
+        { "b"
+            H{ { "l" "x" } { "s" "u" } { "o" "y" } } }
+    }
+    H{ { "l" t } { "s" t } { "c" t } { "o" t } } }
+}
+] [ vector-test-table ] unit-test
+
diff --git a/unmaintained/usb/load.factor b/unmaintained/usb/load.factor
new file mode 100644 (file)
index 0000000..7c5eda2
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel ;
+
+PROVIDE: libs/usb
+{ +files+ {
+       "usb-common.factor"
+       { "usb-unix.factor" [ unix? ] }
+       { "usb-win32.factor" [ win32? ] }
+       { "usb-macosx.factor" [ macosx? ] }
+       "usb.factor" 
+       "usb.facts" 
+} } ;
diff --git a/unmaintained/usb/usb-common.factor b/unmaintained/usb/usb-common.factor
new file mode 100644 (file)
index 0000000..0baca0e
--- /dev/null
@@ -0,0 +1,3 @@
+IN: usb
+
+: +packed+ ; parsing
diff --git a/unmaintained/usb/usb-macosx.factor b/unmaintained/usb/usb-macosx.factor
new file mode 100644 (file)
index 0000000..43a6caa
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+IN: usb
+USING: kernel alien ;
+
+"usb" "libusb.dylib" "cdecl" add-library
+
+LIBRARY: usb
+
+C-STRUCT: usb_bus
+    { "void*" "next" }
+    { "void*" "prev" }
+    { { "char" 1025 } "dirname" }
+    { "void*" "devices" }
+    { "uint" "location" }
+    { "void*" "root_dev" } ;
+
+C-STRUCT: usb_device_descriptor
+    { +packed+ "uchar" "bLength" }
+    { +packed+ "uchar" "bDescriptorType" }
+    { +packed+ "ushort" "bcdUSB" }
+    { +packed+ "uchar" "bDeviceClass" }
+    { +packed+ "uchar" "bDeviceSubClass" }
+    { +packed+ "uchar" "bDeviceProtocol" }
+    { +packed+ "uchar" "bMaxPacketSize0" }
+    { +packed+ "ushort" "idVendor" }
+    { +packed+ "ushort" "idProduct" }
+    { +packed+ "ushort" "bcdDevice;" }
+    { +packed+ "uchar" "iManufacturer" }
+    { +packed+ "uchar" "iProduct" }
+    { +packed+ "uchar" "iSerialNumber" }
+    { +packed+ "uchar" "bNumConfigurations" } ;
+
+C-STRUCT: usb_config_descriptor
+    { +packed+ "uchar" "bLength" }
+    { +packed+ "uchar" "bDescriptorType" }
+    { +packed+ "ushort" "wTotalLength" }
+    { +packed+ "uchar" "bNumInterfaces" }
+    { +packed+ "uchar" "bConfigurationValue" }
+    { +packed+ "uchar" "iConfiguration" }
+    { +packed+ "uchar" "bmAttributes" }
+    { +packed+ "uchar" "MaxPower" }
+    
+    { "void*" "interface" }
+    
+    { "uchar*" "extra" }
+    { "int" "extralen" } ;
+
+C-STRUCT: usb_device
+    { "void*" "next" }
+    { "void*" "prev" }
+    { { "char" 1025 } "filename" }
+    { "usb_bus*" "bus" }
+    { "usb_device_descriptor" "descriptor" }
+    { "usb_config_descriptor*" "config" }
+    { "void*" "dev" }
+    { "uchar" "devnum" }
+    { "uchar" "num_children" }
+    { "void*" "children" } ;
+
diff --git a/unmaintained/usb/usb-unix.factor b/unmaintained/usb/usb-unix.factor
new file mode 100644 (file)
index 0000000..8274cb5
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+IN: usb
+USING: kernel alien ;
+
+"usb" "libusb.so" "cdecl" add-library
+
+LIBRARY: usb
+
+C-STRUCT: usb_bus
+    { "void*" "next" }
+    { "void*" "prev" }
+    { { "char" 4097 } "dirname" }
+    { "void*" "devices" }
+    { "uint" "location" }
+    { "void*" "root_dev" } ;
+
+! __attribute__ ((packed))
+C-STRUCT: usb_device_descriptor
+    { +packed+ "uchar" "bLength" }
+    { +packed+ "uchar" "bDescriptorType" }
+    { +packed+ "ushort" "bcdUSB" }
+    { +packed+ "uchar" "bDeviceClass" }
+    { +packed+ "uchar" "bDeviceSubClass" }
+    { +packed+ "uchar" "bDeviceProtocol" }
+    { +packed+ "uchar" "bMaxPacketSize0" }
+    { +packed+ "ushort" "idVendor" }
+    { +packed+ "ushort" "idProduct" }
+    { +packed+ "ushort" "bcdDevice" }
+    { +packed+ "uchar" "iManufacturer" }
+    { +packed+ "uchar" "iProduct" }
+    { +packed+ "uchar" "iSerialNumber" }
+    { +packed+ "uchar" "bNumConfigurations" } ;
+
+C-STRUCT: usb_config_descriptor
+    { +packed+ "uchar" "bLength" }
+    { +packed+ "uchar" "bDescriptorType" }
+    { +packed+ "ushort" "wTotalLength" }
+    { +packed+ "uchar" "bNumInterfaces" }
+    { +packed+ "uchar" "bConfigurationValue" }
+    { +packed+ "uchar" "iConfiguration" }
+    { +packed+ "uchar" "bmAttributes" }
+    { +packed+ "uchar" "MaxPower" }
+    
+    { "void*" "interface" }
+    
+    { "uchar*" "extra" }
+    { "int" "extralen" } ;
+
+C-STRUCT: usb_device
+    { "void*" "next" }
+    { "void*" "prev" }
+    { { "char" 4097 } "filename" }
+    { "usb_bus*" "bus" }
+    { "usb_device_descriptor" "descriptor" }
+    { "usb_config_descriptor*" "config" }
+    { "void*" "dev" }
+    { "uchar" "devnum" }
+    { "uchar" "num_children" }
+    { "void*" "children" } ;
\ No newline at end of file
diff --git a/unmaintained/usb/usb-win32.factor b/unmaintained/usb/usb-win32.factor
new file mode 100644 (file)
index 0000000..a4b1355
--- /dev/null
@@ -0,0 +1,61 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+IN: usb
+USING: kernel alien ;
+
+"usb" "libusb.dll" "cdecl" add-library
+
+LIBRARY: usb
+
+C-STRUCT: usb_bus
+    { "void*" "next" }
+    { "void*" "prev" }
+    { { "char" 261 } "dirname" }
+    { "void*" "devices" }
+    { "uint" "location" }
+    { "void*" "root_dev" } ;
+
+C-STRUCT: usb_device_descriptor
+    { +packed+ "uchar" "bLength" }
+    { +packed+ "uchar" "bDescriptorType" }
+    { +packed+ "ushort" "bcdUSB" }
+    { +packed+ "uchar" "bDeviceClass" }
+    { +packed+ "uchar" "bDeviceSubClass" }
+    { +packed+ "uchar" "bDeviceProtocol" }
+    { +packed+ "uchar" "bMaxPacketSize0" }
+    { +packed+ "ushort" "idVendor" }
+    { +packed+ "ushort" "idProduct" }
+    { +packed+ "ushort" "bcdDevice;" }
+    { +packed+ "uchar" "iManufacturer" }
+    { +packed+ "uchar" "iProduct" }
+    { +packed+ "uchar" "iSerialNumber" }
+    { +packed+ "uchar" "bNumConfigurations" } ;
+
+C-STRUCT: usb_config_descriptor
+    { +packed+ "uchar" "bLength" }
+    { +packed+ "uchar" "bDescriptorType" }
+    { +packed+ "ushort" "wTotalLength" }
+    { +packed+ "uchar" "bNumInterfaces" }
+    { +packed+ "uchar" "bConfigurationValue" }
+    { +packed+ "uchar" "iConfiguration" }
+    { +packed+ "uchar" "bmAttributes" }
+    { +packed+ "uchar" "MaxPower" }
+    
+    { "void*" "interface" }
+    
+    { "uchar*" "extra" }
+    { "int" "extralen" } ;
+
+C-STRUCT: usb_device
+     { "void*" "next" }
+     { "void*" "prev" }
+     { { "char"  261 } "filename" }
+     { "usb_bus*" "bus" }
+     { "usb_device_descriptor" "descriptor" }
+     { "usb_config_descriptor*" "config" }
+     { "void*" "dev" }
+     { "uchar" "devnum" }
+     { "uchar" "num_children" }
+     { "void*" "children" } ;
+
diff --git a/unmaintained/usb/usb.factor b/unmaintained/usb/usb.factor
new file mode 100644 (file)
index 0000000..662b6e9
--- /dev/null
@@ -0,0 +1,88 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+!
+IN: usb
+USING: kernel alien io math arrays sequences ;
+
+LIBRARY: usb
+
+TYPEDEF: void* usb_dev_handle*
+
+FUNCTION: usb_dev_handle* usb_open ( usb_device* dev ) ;
+FUNCTION: int usb_close ( usb_dev_handle* dev ) ;
+FUNCTION: int usb_get_string ( usb_dev_handle* dev, int index, int langid, char *buf, int buflen ) ;
+FUNCTION: int usb_get_string_simple ( usb_dev_handle* dev, int index, char* buf, int buflen ) ;
+
+FUNCTION: int usb_get_descriptor_by_endpoint ( usb_dev_handle* udev, int ep, uchar type, uchar index, void* buf, int size ) ;
+FUNCTION: int usb_get_descriptor ( usb_dev_handle* udev, uchar type, uchar index, void* buf, int size ) ;
+
+FUNCTION: int usb_bulk_write ( usb_dev_handle* dev, int ep, void* bytes, int size, int timeout ) ;
+FUNCTION: int usb_bulk_read ( usb_dev_handle* dev, int ep, void* bytes, int size, int timeout ) ;
+FUNCTION: int usb_interrupt_write ( usb_dev_handle* dev, int ep, char* bytes, int size, int timeout ) ;
+FUNCTION: int usb_interrupt_read ( usb_dev_handle* dev, int ep, char* bytes, int size, int timeout ) ;
+FUNCTION: int usb_control_msg ( usb_dev_handle* dev, int requesttype, int request, int value, int index, char* bytes, int size, int timeout ) ;
+FUNCTION: int usb_set_configuration ( usb_dev_handle* dev, int configuration ) ;
+FUNCTION: int usb_claim_interface ( usb_dev_handle* dev, int interface ) ;
+FUNCTION: int usb_release_interface ( usb_dev_handle* dev, int interface ) ;
+FUNCTION: int usb_set_altinterface ( usb_dev_handle* dev, int alternate ) ;
+FUNCTION: int usb_resetep ( usb_dev_handle* dev, uint ep ) ;
+FUNCTION: int usb_clear_halt ( usb_dev_handle* dev, uint ep ) ;
+FUNCTION: int usb_reset ( usb_dev_handle* dev ) ;
+FUNCTION: int usb_get_driver_np ( usb_dev_handle* dev, int interface, char* name, uint namelen ) ;
+FUNCTION: char* usb_strerror ( ) ;
+
+FUNCTION: void usb_init ( ) ;
+FUNCTION: void usb_set_debug ( int level ) ;
+FUNCTION: int usb_find_busses (  ) ;
+FUNCTION: int usb_find_devices ( ) ;
+FUNCTION: usb_device* usb_device ( usb_dev_handle* dev ) ;
+FUNCTION: usb_bus* usb_get_busses ( ) ;
+
+: bus-each ( usb_bus quot -- ) 
+  [ call ] 2keep >r usb_bus-next r> over [ bus-each ] [ 2drop ] if ;
+
+: device-each ( usb_device quot -- )
+  [ call ] 2keep >r usb_device-next r> over [ device-each ] [ 2drop ] if ;
+
+: vendor-id-matches? ( id usb_device -- bool )
+  usb_device-descriptor usb_device_descriptor-idVendor = ;
+
+: product-id-matches? ( id usb_device  -- bool )
+  usb_device-descriptor usb_device_descriptor-idProduct = ;
+
+: is-device? ( vendor-id product-id usb_device -- bool )
+  tuck product-id-matches? >r vendor-id-matches? r> and ;
+
+: find-devices ( vendor-id product-id -- seq )
+  2array
+  V{ } clone
+  usb_get_busses [
+    usb_bus-devices [
+      pick first2 pick is-device? [
+        over push
+      ] [
+        drop
+      ] if
+    ] device-each
+  ] bus-each nip ;
+
+: init ( -- )
+  #! Initialize libusb and find devices and busses
+  usb_init usb_find_busses drop usb_find_devices drop ;
+       
+: display-devices ( -- )
+  #! Example function to list all usb devices on system
+  usb_get_busses [
+    dup usb_bus-dirname alien>char-string write " - " write 
+    usb_bus-devices [
+      nl "  " write
+      dup usb_device-filename alien>char-string write 
+      " - " write 
+      dup usb_device-descriptor usb_device_descriptor-bLength number>string write 
+      " - " write 
+      dup usb_device-descriptor usb_device_descriptor-idVendor >hex write 
+      " - " write 
+      usb_device-descriptor usb_device_descriptor-idProduct >hex write
+    ] device-each
+    nl
+  ] bus-each ;
diff --git a/unmaintained/usb/usb.facts b/unmaintained/usb/usb.facts
new file mode 100644 (file)
index 0000000..bd67f64
--- /dev/null
@@ -0,0 +1,44 @@
+! Copyright (C) 2006 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: help usb ;
+
+HELP: bus-each 
+{ $values { "usb_bus" "an alien pointing to a usb_bus structure" } { "quot" "A quotation with stack effect " { $snippet "( usb_bus -- )" } } }
+{ $description "Starting with the given usb_bus, traverse the linked list of busses calling the quotation on each one." } 
+{ $examples
+  { $code "usb_get_busses [ display-devices ]" }
+}
+{ $see-also device-each find-devices } ;
+
+HELP: device-each 
+{ $values { "usb_device" "an alien pointing to a usb_device structure" } { "quot" "A quotation with stack effect " { $snippet "( usb_device -- )" } } }
+{ $description "Starting with the given usb_device, traverse the linked list of devices calling the quotation on each one." } 
+{ $examples
+  { $code "usb_get_busses [\n  usb_bus-devices [ display-device ]\n] bus-each" }
+}
+{ $see-also bus-each find-devices } ;
+
+HELP: vendor-id-matches?
+{ $values { "id" "the integer vendor id" } { "usb_device" "an alien pointing to a usb_device structure" } { "bool" "a boolean" } }
+{ $description "Return true if the device has the given vendor id." } 
+{ $see-also product-id-matches? is-device? } ;
+
+HELP: product-id-matches?
+{ $values { "id" "the integer product id" } { "usb_device" "an alien pointing to a usb_device structure" } { "bool" "a boolean" } }
+{ $description "Return true if the device has the given product id." } 
+{ $see-also vendor-id-matches? is-device? } ;
+
+HELP: is-device?
+{ $values { "vendor-id" "the integer vendor id" } { "product-id" "the integer product-id" } { "usb_device" "an alien pointing to a usb_device structure" } { "bool" "a boolean" } }
+{ $description "Return true if the device has the given vendor and product id." } 
+{ $see-also vendor-id-matches? product-id-matches? } ;
+
+HELP: find-devices 
+{ $values { "vendor-id" "the integer vendor id for the device to find" } { "product-id" "the integer product id for the device to find" } { "seq" "a sequence containing the usb_devices found" } }
+{ $description "Traverse the devices on all USB busses looking for a device with the given vendor and product id's. Return a sequence containing all the usb_device structures found matcing the vendor and product id's." } 
+{ $examples
+  { $code "HEX: 10D6 HEX: 1100 find-devices" }
+}
+{ $see-also bus-each device-each } ;
+
diff --git a/unmaintained/wee-url/load.factor b/unmaintained/wee-url/load.factor
new file mode 100644 (file)
index 0000000..96d2716
--- /dev/null
@@ -0,0 +1,4 @@
+REQUIRES: apps/http-server libs/store ;
+
+PROVIDE: apps/wee-url
+{ +files+ { "responder.factor" } } ;
diff --git a/unmaintained/wee-url/responder.factor b/unmaintained/wee-url/responder.factor
new file mode 100644 (file)
index 0000000..4d7b076
--- /dev/null
@@ -0,0 +1,91 @@
+! Copyright (C) 2006 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: generic assocs help html httpd
+io kernel math namespaces prettyprint sequences store strings ;
+IN: wee-url-responder
+
+SYMBOL: wee-shortcuts
+SYMBOL: wee-store
+
+"wee-url.store" load-store wee-store set-global
+H{ } clone wee-shortcuts wee-store get store-variable
+
+: responder-url "responder-url" get ;
+
+: wee-url ( string -- url )
+    [
+        "http://" %
+        host %
+        responder-url %
+        %
+    ] "" make ;
+
+: letter-bank
+    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ;
+
+: random-letter letter-bank length random letter-bank nth ;
+
+: random-url ( -- string )
+    6 random 1+ [ drop random-letter ] map >string
+    dup wee-shortcuts get key? [ drop random-url ] when ;
+
+: prepare-wee-url ( url -- url )
+    CHAR: : over member? [ "http://" swap append ] unless ;
+
+: set-symmetric-hash ( obj1 obj2 hash -- )
+    3dup set-at swapd set-at ;
+
+: add-shortcut ( url-long -- url-short )
+    dup wee-shortcuts get at* [
+        nip
+    ] [
+        drop
+        random-url [ wee-shortcuts get set-symmetric-hash ] keep
+        wee-store get save-store
+    ] if ;
+
+: url-prompt ( -- )
+    serving-html
+    "wee-url.com - wee URLs since 2007" [
+        <form "get" =method responder-url =action form>
+            "URL: " write
+            <input "text" =type "url" =name input/>
+            <input "submit" =type "Submit" =value input/>
+        </form>
+    ] simple-html-document ;
+
+: url-submitted ( url-long url-short -- )
+    "URL Submitted" [
+        "URL: " write write nl
+        "wee-url: " write
+        <a dup wee-url =href a> wee-url write </a> nl
+        "Back to " write
+        <a responder-url =href a> "wee-url" write </a> nl
+    ] simple-html-document ;
+
+: url-submit ( url -- )
+    serving-html
+    prepare-wee-url [ add-shortcut ] keep url-submitted ;
+
+: url-error ( -- )
+    serving-html
+    "wee-url error" [
+        "No such link." write
+    ] simple-html-document ;
+
+: wee-url-responder ( url -- )
+    "url" query-param [
+        url-submit drop
+    ] [
+        dup empty? [
+            drop url-prompt
+        ] [
+            wee-shortcuts get at*
+            [ permanent-redirect ] [ drop url-error ] if
+        ] if
+    ] if* ;
+
+[
+    "wee-url" "responder" set
+    [ wee-url-responder ] "get" set
+] make-responder
diff --git a/unmaintained/wee-url/wee-url.factor b/unmaintained/wee-url/wee-url.factor
new file mode 100644 (file)
index 0000000..ead2ee8
--- /dev/null
@@ -0,0 +1,89 @@
+! Copyright (C) 2007 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs furnace html html.elements http.server
+http.server.responders io kernel math math.ranges
+namespaces random sequences store strings ;
+IN: webapps.wee-url
+
+SYMBOL: shortcuts
+SYMBOL: store
+
+! "wee-url.store" load-store store set-global
+! H{ } clone shortcuts store get store-variable
+
+: set-at-once ( value key assoc -- ? )
+    2dup key? [ 3drop f ] [ set-at t ] if ;
+
+: responder-url "responder/wee-url" ;
+
+: wee-url ( string -- url )
+    [
+        "http://" %
+        host %
+        responder-url %
+        %
+    ] "" make ;
+
+: letter-bank
+    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ; inline
+
+: random-url ( -- string )
+    1 6 [a,b] random [ drop letter-bank random ] "" map-as
+    dup shortcuts get key? [ drop random-url ] when ;
+
+: add-shortcut ( url-long url-short -- url-short )
+    shortcuts get set-at-once [
+        store get save-store
+    ] [
+        drop
+    ] if ;
+
+: show-submit ( -- )
+    serving-html
+    "wee-url.com - wee URLs since 2007" [
+        <form "get" =method "url-submit" =action form>
+            "URL: " write
+            <input "text" =type "url" =name input/>
+            <input "submit" =type "Submit" =value input/>
+        </form>
+    ] simple-html-document ;
+
+\ show-submit { } define-action
+
+: url-submitted ( url-long url-short -- )
+    "URL Submitted" [
+        "URL: " write write nl
+        "wee-url: " write
+        <a dup wee-url =href a> wee-url write </a> nl
+        "Back to " write
+        <a responder-url =href a> "wee-url" write </a> nl
+    ] simple-html-document ;
+
+: url-submit ( url -- )
+    [ add-shortcut ] keep
+    url-submitted ;
+
+\ url-submit {
+    { "url" }
+} define-action
+
+: url-error ( -- )
+    serving-html
+    "wee-url error" [
+        "No such link." write
+    ] simple-html-document ;
+
+: wee-url-responder ( url -- )
+    "url" query-param [
+        url-submit drop
+    ] [
+        dup empty? [
+            drop show-submit
+        ] [
+            shortcuts get at*
+            [ permanent-redirect ] [ drop url-error ] if
+        ] if
+    ] if* ;
+
+! "wee-url" "wee-url-responder" "extra/webapps/wee-url" web-app
+~
index 52c570a404fbcdc53c010f9ca4bef2bc0a5c9d2b..d2c706cf14faf8d02a2e6208f3d417da71eae657 100644 (file)
@@ -1 +1,2 @@
-PLAF_OBJS += vm/cpu-amd64.o
+BOOT_ARCH = amd64
+PLAF_DLL_OBJS += vm/cpu-amd64.o
diff --git a/vm/Config.arm b/vm/Config.arm
new file mode 100644 (file)
index 0000000..fc41bb9
--- /dev/null
@@ -0,0 +1,2 @@
+BOOT_ARCH = arm
+PLAF_DLL_OBJS += vm/cpu-arm.o
index 689968124b062367e438927dd133b60ffed354c6..384b2fd57aa5f6ad08dfe52ab033d937dcbbb540 100644 (file)
@@ -1,4 +1,4 @@
 include vm/Config.unix
-PLAF_OBJS += vm/os-genunix.o
-CFLAGS += -export-dynamic -pthread
-LIBS = -lm $(X11_UI_LIBS)
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-freebsd.o
+CFLAGS += -export-dynamic
+LIBS = -L/usr/local/lib/ -lm $(X11_UI_LIBS)
diff --git a/vm/Config.freebsd.amd64 b/vm/Config.freebsd.amd64
new file mode 100644 (file)
index 0000000..db6f9f3
--- /dev/null
@@ -0,0 +1,2 @@
+include vm/Config.freebsd
+include vm/Config.amd64
diff --git a/vm/Config.freebsd.x86 b/vm/Config.freebsd.x86
new file mode 100644 (file)
index 0000000..1273130
--- /dev/null
@@ -0,0 +1,2 @@
+include vm/Config.freebsd
+include vm/Config.x86
index 7eecb598ab9688ea7df2e3609dae5ff93ecdf3cc..5f83cc835a91d9905b523e3cc69a58ff3e32d04b 100644 (file)
@@ -1,4 +1,4 @@
 include vm/Config.unix
-PLAF_OBJS += vm/os-genunix.o
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-linux.o
 CFLAGS += -export-dynamic
 LIBS = -ldl -lm $(X11_UI_LIBS)
diff --git a/vm/Config.linux.arm b/vm/Config.linux.arm
new file mode 100644 (file)
index 0000000..4b8c841
--- /dev/null
@@ -0,0 +1,2 @@
+include vm/Config.linux
+include vm/Config.arm
index aa65af4ecfd2c226901b4ecd2e8b5069be428994..40eeb91322607534964508566950d505ac2e26b6 100644 (file)
@@ -1,8 +1,20 @@
 include vm/Config.unix
-PLAF_OBJS += vm/os-macosx.o vm/mach_signal.o
+CFLAGS += -fPIC
+
+PLAF_DLL_OBJS += vm/os-macosx.o vm/mach_signal.o
+
+DLL_EXTENSION = .dylib
 
 ifdef X11
        LIBS = -lm -framework Foundation $(X11_UI_LIBS)
 else
-       LIBS = -lm -framework Cocoa -framework OpenGL -framework AppKit -L/usr/X11R6/lib -lfreetype
+    LIBS = -lm -framework Cocoa -framework AppKit
 endif
+
+LINKER = gcc $(CFLAGS) -dynamiclib -single_module -std=gnu99 \
+       -current_version $(VERSION) \
+       -compatibility_version $(VERSION) \
+       -fvisibility=hidden \
+       $(LIBS) $(LIBPATH) -o
+
+LINK_WITH_ENGINE = -lfactor
index 838215c8b7a9dc4486ada8e9e4e33cd132e990ef..27c47fcb63af20df968eb363478499d6842ebadb 100644 (file)
@@ -1,3 +1,2 @@
 include vm/Config.macosx
 include vm/Config.x86
-CFLAGS += -fomit-frame-pointer
diff --git a/vm/Config.openbsd b/vm/Config.openbsd
new file mode 100644 (file)
index 0000000..61534d4
--- /dev/null
@@ -0,0 +1,4 @@
+include vm/Config.unix
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-openbsd.o
+CFLAGS += -export-dynamic
+LIBS = -L/usr/local/lib/ -lm $(X11_UI_LIBS)
diff --git a/vm/Config.openbsd.amd64 b/vm/Config.openbsd.amd64
new file mode 100644 (file)
index 0000000..e895d34
--- /dev/null
@@ -0,0 +1,2 @@
+include vm/Config.openbsd
+include vm/Config.amd64
diff --git a/vm/Config.openbsd.x86 b/vm/Config.openbsd.x86
new file mode 100644 (file)
index 0000000..99cf991
--- /dev/null
@@ -0,0 +1,2 @@
+include vm/Config.openbsd
+include vm/Config.x86
index 8b6fb9980b983f8f764dae097e1ae34e92eca088..3fa5fd8df1fa79ab8a6dac56d40da0cf4f370ca9 100644 (file)
@@ -1 +1,2 @@
-PLAF_OBJS += vm/cpu-ppc.o
+BOOT_ARCH = ppc
+PLAF_DLL_OBJS += vm/cpu-ppc.o
index c4c66842192948ca308002a084de19fcc350efd3..98b7de16d8207fb0fc3b2a4f4be792fc4cfdf861 100644 (file)
@@ -1,6 +1,6 @@
 include vm/Config.unix
-PLAF_OBJS += vm/os-genunix.o
-CFLAGS += -D_STDC_C99 -Drestrict=""
+PLAF_DLL_OBJS += vm/os-genunix.o vm/os-solaris.o
+CFLAGS += -D_STDC_C99 -Drestrict="" -export-dynamic
 LIBS += -ldl -lsocket -lnsl -lm -R/opt/PM/lib -R/opt/csw/lib \
        -R/usr/local/lib -R/usr/sfw/lib -R/usr/X11R6/lib \
        -R/opt/sfw/lib $(X11_UI_LIBS)
diff --git a/vm/Config.solaris.amd64 b/vm/Config.solaris.amd64
new file mode 100644 (file)
index 0000000..58bd2b2
--- /dev/null
@@ -0,0 +1,2 @@
+include vm/Config.solaris
+include vm/Config.amd64
diff --git a/vm/Config.solaris.x86 b/vm/Config.solaris.x86
new file mode 100644 (file)
index 0000000..d839047
--- /dev/null
@@ -0,0 +1,2 @@
+include vm/Config.solaris
+include vm/Config.x86
index d785a6a21664cd77c0fdfb0b1812e365652974f3..831b3378d8df6cd734b8808fc660e8a4e187827b 100644 (file)
@@ -1,7 +1,21 @@
-PLAF_OBJS = vm/os-unix.o
+EXE_SUFFIX =
+DLL_PREFIX = lib
+DLL_EXTENSION = .a
+# DLL_EXTENSION = .so
+
+PLAF_DLL_OBJS = vm/os-unix.o
+PLAF_EXE_OBJS += vm/main-unix.o
 
 ifdef NO_UI
        X11_UI_LIBS =
 else
        X11_UI_LIBS = -lfreetype -lGL -lGLU -lX11
 endif
+
+# CFLAGS += -fPIC
+
+# LINKER = gcc -shared -o
+# LINK_WITH_ENGINE = '-Wl,-rpath,$$ORIGIN' -lfactor
+
+LINKER = ar rcs
+LINK_WITH_ENGINE = -Wl,--whole-archive -lfactor -Wl,-no-whole-archive
index e88c6e3bbf97e7d38cafed5f272a9e712b7f310c..41eca86b5cfa358993ff6d6428978e28fddec560 100644 (file)
@@ -1,5 +1,7 @@
-CFLAGS += -DWINDOWS
+CFLAGS += -DWINDOWS -mno-cygwin
 LIBS = -lm
-PLAF_SUFFIX = .exe
-PLAF_OBJS = vm/os-windows.o
-include vm/Config.x86
+PLAF_DLL_OBJS += vm/os-windows.o
+EXE_EXTENSION=.exe
+DLL_EXTENSION=.dll
+LINKER = $(CC) -shared -mno-cygwin -o 
+LINK_WITH_ENGINE = -l$(DLL_PREFIX)factor$(DLL_SUFFIX)
diff --git a/vm/Config.windows.ce b/vm/Config.windows.ce
new file mode 100644 (file)
index 0000000..2e3204a
--- /dev/null
@@ -0,0 +1,5 @@
+CFLAGS += -DWINCE
+LIBS = -lm
+PLAF_DLL_OBJS += vm/os-windows-ce.o
+PLAF_EXE_OBJS += vm/main-windows-ce.o
+include vm/Config.windows
diff --git a/vm/Config.windows.ce.arm b/vm/Config.windows.ce.arm
new file mode 100644 (file)
index 0000000..1026968
--- /dev/null
@@ -0,0 +1,5 @@
+CC = arm-wince-mingw32ce-gcc
+DLL_SUFFIX=-ce
+EXE_SUFFIX=-ce
+PLAF_DLL_OBJS += vm/os-windows-ce-arm.o
+include vm/Config.windows.ce vm/Config.arm
diff --git a/vm/Config.windows.ce.x86 b/vm/Config.windows.ce.x86
new file mode 100644 (file)
index 0000000..0d1f776
--- /dev/null
@@ -0,0 +1,2 @@
+#CC = x86-wince-mingw32ce-gcc
+include vm/Config.windows.ce vm/Config.x86
diff --git a/vm/Config.windows.nt.x86 b/vm/Config.windows.nt.x86
new file mode 100644 (file)
index 0000000..8834332
--- /dev/null
@@ -0,0 +1,7 @@
+LIBS = -lm
+EXE_SUFFIX=-nt
+DLL_SUFFIX=-nt
+PLAF_DLL_OBJS += vm/os-windows-nt.o
+PLAF_EXE_OBJS += vm/resources.o
+PLAF_EXE_OBJS += vm/main-windows-nt.o
+include vm/Config.x86 vm/Config.windows
index 709cbe1b724391a2d8141355c33f8c5761a6ceeb..bd739d3a85b8d188f38f4a235934e0840d308b86 100644 (file)
@@ -1 +1,5 @@
-PLAF_OBJS += vm/cpu-x86.o
+BOOT_ARCH = x86
+PLAF_DLL_OBJS += vm/cpu-x86.o
+
+# gcc bug workaround
+CFLAGS += -fno-builtin-strlen -fno-builtin-strcat -mtune=pentium4
index d08325064fdcf12e42520fd7093f766fb1ebc78e..8f62ee37fd2b608dc61417f17e737f4cb8f5b4d6 100644 (file)
@@ -1,42 +1,28 @@
-#include "factor.h"
-
-/* test if alien is no longer valid (it survived an image save/load) */
-void primitive_expired(void)
-{
-       CELL object = dpeek();
-
-       if(type_of(object) == ALIEN_TYPE)
-       {
-               F_ALIEN *alien = untag_alien_fast(object);
-               drepl(tag_boolean(alien->expired));
-       }
-       else if(object == F)
-               drepl(T);
-       else
-               drepl(F);
-}
+#include "master.h"
 
 /* gets the address of an object representing a C pointer */
 void *alien_offset(CELL object)
 {
        F_ALIEN *alien;
-       F_ARRAY *array;
+       F_BYTE_ARRAY *byte_array;
 
        switch(type_of(object))
        {
        case BYTE_ARRAY_TYPE:
-               array = untag_array_fast(object);
-               return array + 1;
+       case BIT_ARRAY_TYPE:
+       case FLOAT_ARRAY_TYPE:
+               byte_array = untag_object(object);
+               return byte_array + 1;
        case ALIEN_TYPE:
-               alien = untag_alien_fast(object);
-               if(alien->expired)
-                       simple_error(ERROR_EXPIRED,object,F);
+               alien = untag_object(object);
+               if(alien->expired != F)
+                       general_error(ERROR_EXPIRED,object,F,NULL);
                return alien_offset(alien->alien) + alien->displacement;
        case F_TYPE:
                return NULL;
        default:
                type_error(ALIEN_TYPE,object);
-               return (void*)-1; /* can't happen */
+               return NULL; /* can't happen */
        }
 }
 
@@ -54,12 +40,12 @@ CELL allot_alien(CELL delegate, CELL displacement)
        UNREGISTER_ROOT(delegate);
        alien->alien = delegate;
        alien->displacement = displacement;
-       alien->expired = false;
+       alien->expired = F;
        return tag_object(alien);
 }
 
 /* make an alien and push */
-void box_alien(voidptr)
+void box_alien(void *ptr)
 {
        if(ptr == NULL)
                dpush(F);
@@ -68,10 +54,10 @@ void box_alien(void* ptr)
 }
 
 /* make an alien pointing at an offset of another alien */
-void primitive_displaced_alien(void)
+DEFINE_PRIMITIVE(displaced_alien)
 {
        CELL alien = dpop();
-       CELL displacement = unbox_unsigned_cell();
+       CELL displacement = to_cell(dpop());
        if(alien == F && displacement == 0)
                dpush(F);
        else
@@ -80,94 +66,97 @@ void primitive_displaced_alien(void)
 
 /* address of an object representing a C pointer. Explicitly throw an error
 if the object is a byte array, as a sanity check. */
-void primitive_alien_address(void)
+DEFINE_PRIMITIVE(alien_address)
 {
        CELL object = dpop();
-       if(type_of(object) == BYTE_ARRAY_TYPE)
-               type_error(ALIEN_TYPE,object);
-       else
+       switch(type_of(object))
+       {
+       case ALIEN_TYPE:
+       case F_TYPE:
                box_unsigned_cell((CELL)alien_offset(object));
-}
-
-/* image loading */
-void fixup_alien(F_ALIEN *d)
-{
-       d->expired = true;
+               break;
+       default:
+               type_error(ALIEN_TYPE,object);
+               break;
+       }
 }
 
 /* pop ( alien n ) from datastack, return alien's address plus n */
 INLINE void *alien_pointer(void)
 {
-       F_FIXNUM offset = unbox_signed_cell();
+       F_FIXNUM offset = to_fixnum(dpop());
        return unbox_alien() + offset;
 }
 
 /* define words to read/write values at an alien address */
-#define DEF_ALIEN_SLOT(name,type,boxer) \
-void primitive_alien_##name (void) \
-{ \
-       box_##boxer (*(type*)alien_pointer()); \
-} \
-void primitive_set_alien_##name (void) \
-{ \
-       type* ptr = alien_pointer(); \
-       type value = unbox_##boxer(); \
-       *ptr = value; \
-}
+#define DEFINE_ALIEN_ACCESSOR(name,type,boxer,to) \
+       DEFINE_PRIMITIVE(alien_##name) \
+       { \
+               boxer(*(type*)alien_pointer()); \
+       } \
+       DEFINE_PRIMITIVE(set_alien_##name) \
+       { \
+               type* ptr = alien_pointer(); \
+               type value = to(dpop()); \
+               *ptr = value; \
+       }
 
-DEF_ALIEN_SLOT(signed_cell,F_FIXNUM,signed_cell)
-DEF_ALIEN_SLOT(unsigned_cell,CELL,unsigned_cell)
-DEF_ALIEN_SLOT(signed_8,s64,signed_8)
-DEF_ALIEN_SLOT(unsigned_8,u64,unsigned_8)
-DEF_ALIEN_SLOT(signed_4,s32,signed_4)
-DEF_ALIEN_SLOT(unsigned_4,u32,unsigned_4)
-DEF_ALIEN_SLOT(signed_2,s16,signed_2)
-DEF_ALIEN_SLOT(unsigned_2,u16,unsigned_2)
-DEF_ALIEN_SLOT(signed_1,u8,signed_1)
-DEF_ALIEN_SLOT(unsigned_1,u8,unsigned_1)
-DEF_ALIEN_SLOT(float,float,float)
-DEF_ALIEN_SLOT(double,double,double)
+DEFINE_ALIEN_ACCESSOR(signed_cell,F_FIXNUM,box_signed_cell,to_fixnum)
+DEFINE_ALIEN_ACCESSOR(unsigned_cell,CELL,box_unsigned_cell,to_cell)
+DEFINE_ALIEN_ACCESSOR(signed_8,s64,box_signed_8,to_signed_8)
+DEFINE_ALIEN_ACCESSOR(unsigned_8,u64,box_unsigned_8,to_unsigned_8)
+DEFINE_ALIEN_ACCESSOR(signed_4,s32,box_signed_4,to_fixnum)
+DEFINE_ALIEN_ACCESSOR(unsigned_4,u32,box_unsigned_4,to_cell)
+DEFINE_ALIEN_ACCESSOR(signed_2,s16,box_signed_2,to_fixnum)
+DEFINE_ALIEN_ACCESSOR(unsigned_2,u16,box_unsigned_2,to_cell)
+DEFINE_ALIEN_ACCESSOR(signed_1,s8,box_signed_1,to_fixnum)
+DEFINE_ALIEN_ACCESSOR(unsigned_1,u8,box_unsigned_1,to_cell)
+DEFINE_ALIEN_ACCESSOR(float,float,box_float,to_float)
+DEFINE_ALIEN_ACCESSOR(double,double,box_double,to_double)
+DEFINE_ALIEN_ACCESSOR(cell,void *,box_alien,alien_offset)
 
 /* for FFI calls passing structs by value */
-void unbox_value_struct(void *dest, CELL size)
+void to_value_struct(CELL src, void *dest, CELL size)
 {
-       memcpy(dest,unbox_alien(),size);
+       memcpy(dest,alien_offset(src),size);
 }
 
 /* for FFI callbacks receiving structs by value */
 void box_value_struct(void *src, CELL size)
 {
-       F_ARRAY *array = allot_byte_array(size);
+       F_BYTE_ARRAY *array = allot_byte_array(size);
        memcpy(array + 1,src,size);
        dpush(tag_object(array));
 }
 
-/* for FFI calls returning an 8-byte struct. This only
-happens on Intel Mac OS X */
-void box_value_pair(CELL x, CELL y)
+/* On OS X, structs <= 8 bytes are returned in registers. */
+void box_small_struct(CELL x, CELL y, CELL size)
 {
-       F_ARRAY *array = allot_byte_array(2 * sizeof(CELL));
-       set_array_nth(array,0,x);
-       set_array_nth(array,1,y);
-       dpush(tag_object(array));
+       CELL data[2];
+       data[0] = x;
+       data[1] = y;
+       box_value_struct(data,size);
 }
 
 /* open a native library and push a handle */
-void primitive_dlopen(void)
+DEFINE_PRIMITIVE(dlopen)
 {
-       primitive_string_to_char_alien();
+       CELL path = tag_object(string_to_native_alien(
+               untag_string(dpop())));
+       REGISTER_ROOT(path);
        F_DLL* dll = allot_object(DLL_TYPE,sizeof(F_DLL));
-       dll->path = dpop();
+       UNREGISTER_ROOT(path);
+       dll->path = path;
        ffi_dlopen(dll,true);
        dpush(tag_object(dll));
 }
 
 /* look up a symbol in a native library */
-void primitive_dlsym(void)
+DEFINE_PRIMITIVE(dlsym)
 {
        CELL dll = dpop();
        REGISTER_ROOT(dll);
-       char *sym = unbox_char_string();
+       F_SYMBOL *sym = unbox_symbol_string();
        UNREGISTER_ROOT(dll);
 
        F_DLL *d;
@@ -178,14 +167,14 @@ void primitive_dlsym(void)
        {
                d = untag_dll(dll);
                if(d->dll == NULL)
-                       simple_error(ERROR_EXPIRED,dll,F);
+                       general_error(ERROR_EXPIRED,dll,F,NULL);
        }
 
-       box_alien(ffi_dlsym(d,sym,true));
+       box_alien(ffi_dlsym(d,sym));
 }
 
 /* close a native library handle */
-void primitive_dlclose(void)
+DEFINE_PRIMITIVE(dlclose)
 {
        ffi_dlclose(untag_dll(dpop()));
 }
index 68784b7e2a1e3a4805409d698217c5f2cb78db8c..a3ca0753a435110d928a30dc51afd789ff160081 100644 (file)
@@ -1,51 +1,45 @@
-DLLEXPORT CELL alien_temp;
-
-INLINE F_ALIEN* untag_alien_fast(CELL tagged)
-{
-       return (F_ALIEN*)UNTAG(tagged);
-}
-
 CELL allot_alien(CELL delegate, CELL displacement);
 
-void primitive_expired(void);
-void primitive_displaced_alien(void);
-void primitive_alien_address(void);
+DECLARE_PRIMITIVE(displaced_alien);
+DECLARE_PRIMITIVE(alien_address);
 
-void* alien_offset(CELL object);
+DLLEXPORT void *alien_offset(CELL object);
 
 void fixup_alien(F_ALIEN* d);
 
 DLLEXPORT void *unbox_alien(void);
 DLLEXPORT void box_alien(void *ptr);
 
-void primitive_alien_signed_cell(void);
-void primitive_set_alien_signed_cell(void);
-void primitive_alien_unsigned_cell(void);
-void primitive_set_alien_unsigned_cell(void);
-void primitive_alien_signed_8(void);
-void primitive_set_alien_signed_8(void);
-void primitive_alien_unsigned_8(void);
-void primitive_set_alien_unsigned_8(void);
-void primitive_alien_signed_4(void);
-void primitive_set_alien_signed_4(void);
-void primitive_alien_unsigned_4(void);
-void primitive_set_alien_unsigned_4(void);
-void primitive_alien_signed_2(void);
-void primitive_set_alien_signed_2(void);
-void primitive_alien_unsigned_2(void);
-void primitive_set_alien_unsigned_2(void);
-void primitive_alien_signed_1(void);
-void primitive_set_alien_signed_1(void);
-void primitive_alien_unsigned_1(void);
-void primitive_set_alien_unsigned_1(void);
-void primitive_alien_float(void);
-void primitive_set_alien_float(void);
-void primitive_alien_double(void);
-void primitive_set_alien_double(void);
-
-DLLEXPORT void unbox_value_struct(void *dest, CELL size);
+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);
+
+DLLEXPORT void to_value_struct(CELL src, void *dest, CELL size);
 DLLEXPORT void box_value_struct(void *src, CELL size);
-DLLEXPORT void box_value_pair(CELL x, CELL y);
+DLLEXPORT void box_small_struct(CELL x, CELL y, CELL size);
 
 INLINE F_DLL *untag_dll(CELL tagged)
 {
@@ -53,6 +47,6 @@ INLINE F_DLL *untag_dll(CELL tagged)
        return (F_DLL*)UNTAG(tagged);
 }
 
-void primitive_dlopen(void);
-void primitive_dlsym(void);
-void primitive_dlclose(void);
+DECLARE_PRIMITIVE(dlopen);
+DECLARE_PRIMITIVE(dlsym);
+DECLARE_PRIMITIVE(dlclose);
diff --git a/vm/asm.h b/vm/asm.h
new file mode 100644 (file)
index 0000000..dc8e0a8
--- /dev/null
+++ b/vm/asm.h
@@ -0,0 +1,11 @@
+#if defined( __APPLE__) || (defined(WINDOWS) && !defined(__arm__))
+       #define MANGLE(sym) _##sym
+       #define XX @
+#else
+       #define MANGLE(sym) sym
+       #define XX ;
+#endif
+
+/* The returns and args are just for documentation */
+#define DEF(returns,symbol,args) .globl MANGLE(symbol) XX \
+MANGLE(symbol)
index 6f3329a86eaea3dc61e26910cf192abcaabd4760..d92f665354c18f1f441cc4c1ecd8a387a8850c4d 100644 (file)
@@ -1,8 +1,7 @@
 /* :tabSize=2:indentSize=2:noTabs=true:
 
-$Id: s48_bignum.c,v 1.12 2005/12/21 02:36:52 spestov Exp $
-
-Copyright (c) 1989-94 Massachusetts Institute of Technology
+Copyright (C) 1989-94 Massachusetts Institute of Technology
+Portions copyright (C) 2004-2007 Slava Pestov
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -36,18 +35,19 @@ MIT in each case. */
 /* Changes for Scheme 48:
  *  - Converted to ANSI.
  *  - Added bitwise operations.
- *  - Added s48_ to the beginning of all externally visible names.
+ *  - Added s48 to the beginning of all externally visible names.
  *  - Cached the bignum representations of -1, 0, and 1.
  */
 
 /* Changes for Factor:
- *  - Adapt s48_bignumint.h for Factor memory manager
+ *  - Adapt bignumint.h for Factor memory manager
  *  - Add more bignum <-> C type conversions
  *  - Remove unused functions
  *  - Add local variable GC root recording
+ *  - Remove s48 prefix from function names
  */
 
-#include "factor.h"
+#include "master.h"
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>        /* abort */
@@ -56,7 +56,7 @@ MIT in each case. */
 /* Exports */
 
 int
-s48_bignum_equal_p(bignum_type x, bignum_type y)
+bignum_equal_p(bignum_type x, bignum_type y)
 {
   return
     ((BIGNUM_ZERO_P (x))
@@ -69,7 +69,7 @@ s48_bignum_equal_p(bignum_type x, bignum_type y)
 }
 
 enum bignum_comparison
-s48_bignum_compare(bignum_type x, bignum_type y)
+bignum_compare(bignum_type x, bignum_type y)
 {
   return
     ((BIGNUM_ZERO_P (x))
@@ -93,7 +93,7 @@ s48_bignum_compare(bignum_type x, bignum_type y)
 
 /* allocates memory */
 bignum_type
-s48_bignum_add(bignum_type x, bignum_type y)
+bignum_add(bignum_type x, bignum_type y)
 {
   return
     ((BIGNUM_ZERO_P (x))
@@ -111,7 +111,7 @@ s48_bignum_add(bignum_type x, bignum_type y)
 
 /* allocates memory */
 bignum_type
-s48_bignum_subtract(bignum_type x, bignum_type y)
+bignum_subtract(bignum_type x, bignum_type y)
 {
   return
     ((BIGNUM_ZERO_P (x))
@@ -131,7 +131,7 @@ s48_bignum_subtract(bignum_type x, bignum_type y)
 
 /* allocates memory */
 bignum_type
-s48_bignum_multiply(bignum_type x, bignum_type y)
+bignum_multiply(bignum_type x, bignum_type y)
 {
   bignum_length_type x_length = (BIGNUM_LENGTH (x));
   bignum_length_type y_length = (BIGNUM_LENGTH (y));
@@ -164,12 +164,12 @@ s48_bignum_multiply(bignum_type x, bignum_type y)
 
 /* allocates memory */
 void
-s48_bignum_divide(bignum_type numerator, bignum_type denominator,
+bignum_divide(bignum_type numerator, bignum_type denominator,
                   bignum_type * quotient, bignum_type * remainder)
 {
   if (BIGNUM_ZERO_P (denominator))
     {
-      divide_by_zero_error();
+      divide_by_zero_error(NULL);
       return;
     }
   if (BIGNUM_ZERO_P (numerator))
@@ -237,11 +237,11 @@ s48_bignum_divide(bignum_type numerator, bignum_type denominator,
 
 /* allocates memory */
 bignum_type
-s48_bignum_quotient(bignum_type numerator, bignum_type denominator)
+bignum_quotient(bignum_type numerator, bignum_type denominator)
 {
   if (BIGNUM_ZERO_P (denominator))
     {
-      divide_by_zero_error();
+      divide_by_zero_error(NULL);
       return (BIGNUM_OUT_OF_BAND);
     }
   if (BIGNUM_ZERO_P (numerator))
@@ -290,11 +290,11 @@ s48_bignum_quotient(bignum_type numerator, bignum_type denominator)
 
 /* allocates memory */
 bignum_type
-s48_bignum_remainder(bignum_type numerator, bignum_type denominator)
+bignum_remainder(bignum_type numerator, bignum_type denominator)
 {
   if (BIGNUM_ZERO_P (denominator))
     {
-      divide_by_zero_error();
+      divide_by_zero_error(NULL);
       return (BIGNUM_OUT_OF_BAND);
     }
   if (BIGNUM_ZERO_P (numerator))
@@ -334,7 +334,7 @@ s48_bignum_remainder(bignum_type numerator, bignum_type denominator)
 }
 
 #define FOO_TO_BIGNUM(name,type,utype) \
-  bignum_type s48_##name##_to_bignum(type n)                           \
+  bignum_type name##_to_bignum(type n)                                 \
   {                                                                    \
     int negative_p;                                                    \
     bignum_digit_type result_digits [BIGNUM_DIGITS_FOR(type)];         \
@@ -342,7 +342,7 @@ s48_bignum_remainder(bignum_type numerator, bignum_type denominator)
     /* Special cases win when these small constants are cached. */     \
     if (n == 0) return (BIGNUM_ZERO ());                               \
     if (n == 1) return (BIGNUM_ONE (0));                               \
-    if (n == -1) return (BIGNUM_ONE (1));                              \
+    if (n < 0 && n == -1) return (BIGNUM_ONE (1));                     \
     {                                                                  \
       utype accumulator = ((negative_p = (n < 0)) ? (-n) : n);         \
       do                                                               \
@@ -362,7 +362,7 @@ s48_bignum_remainder(bignum_type numerator, bignum_type denominator)
       return (result);                                                 \
     }                                                                  \
   }
-
+  
 /* all below allocate memory */
 FOO_TO_BIGNUM(cell,CELL,CELL)
 FOO_TO_BIGNUM(fixnum,F_FIXNUM,CELL)
@@ -372,7 +372,7 @@ FOO_TO_BIGNUM(long_long,s64,u64)
 FOO_TO_BIGNUM(ulong_long,u64,u64)
 
 #define BIGNUM_TO_FOO(name,type,utype) \
-  type s48_bignum_to_##name(bignum_type bignum) \
+  type bignum_to_##name(bignum_type bignum) \
   { \
     if (BIGNUM_ZERO_P (bignum)) \
       return (0); \
@@ -395,7 +395,7 @@ BIGNUM_TO_FOO(long_long,s64,u64)
 BIGNUM_TO_FOO(ulong_long,u64,u64)
 
 double
-s48_bignum_to_double(bignum_type bignum)
+bignum_to_double(bignum_type bignum)
 {
   if (BIGNUM_ZERO_P (bignum))
     return (0);
@@ -419,9 +419,9 @@ s48_bignum_to_double(bignum_type bignum)
 
 /* allocates memory */
 bignum_type
-s48_double_to_bignum(double x)
+double_to_bignum(double x)
 {
-  if (!isnormal(x)) return (BIGNUM_ZERO ());
+  if (x == 1.0/0.0 || x == -1.0/0.0 || x != x) return (BIGNUM_ZERO ());
   int exponent;
   double significand = (frexp (x, (&exponent)));
   if (exponent <= 0) return (BIGNUM_ZERO ());
@@ -742,6 +742,30 @@ bignum_multiply_unsigned_small_factor(bignum_type x, bignum_digit_type y,
   return (bignum_trim (p));
 }
 
+void
+bignum_destructive_add(bignum_type bignum, bignum_digit_type n)
+{
+  bignum_digit_type * scan = (BIGNUM_START_PTR (bignum));
+  bignum_digit_type digit;
+  digit = ((*scan) + n);
+  if (digit < BIGNUM_RADIX)
+    {
+      (*scan) = digit;
+      return;
+    }
+  (*scan++) = (digit - BIGNUM_RADIX);
+  while (1)
+    {
+      digit = ((*scan) + 1);
+      if (digit < BIGNUM_RADIX)
+        {
+          (*scan) = digit;
+          return;
+        }
+      (*scan++) = (digit - BIGNUM_RADIX);
+    }
+}
+
 void
 bignum_destructive_scale_up(bignum_type bignum, bignum_digit_type factor)
 {
@@ -791,6 +815,9 @@ bignum_divide_unsigned_large_denominator(bignum_type numerator,
   bignum_length_type length_n = ((BIGNUM_LENGTH (numerator)) + 1);
   bignum_length_type length_d = (BIGNUM_LENGTH (denominator));
 
+  REGISTER_BIGNUM(numerator);
+  REGISTER_BIGNUM(denominator);
+
   bignum_type q =
     ((quotient != ((bignum_type *) 0))
      ? (allot_bignum ((length_n - length_d), q_negative_p))
@@ -800,6 +827,9 @@ bignum_divide_unsigned_large_denominator(bignum_type numerator,
   bignum_type u = (allot_bignum (length_n, r_negative_p));
   UNREGISTER_BIGNUM(q);
 
+  UNREGISTER_BIGNUM(denominator);
+  UNREGISTER_BIGNUM(numerator);
+
   int shift = 0;
   BIGNUM_ASSERT (length_d > 1);
   {
@@ -1452,19 +1482,17 @@ bignum_destructive_copy(bignum_type source, bignum_type target)
 
 /* allocates memory */
 bignum_type
-s48_bignum_bitwise_not(bignum_type x)
+bignum_bitwise_not(bignum_type x)
 {
-  return s48_bignum_subtract(BIGNUM_ONE(1), x);
+  return bignum_subtract(BIGNUM_ONE(1), x);
 }
 
 /* allocates memory */
 bignum_type
-s48_bignum_arithmetic_shift(bignum_type arg1, long n)
+bignum_arithmetic_shift(bignum_type arg1, long n)
 {
   if (BIGNUM_NEGATIVE_P(arg1) && n < 0)
-    return
-      s48_bignum_bitwise_not(bignum_magnitude_ash(s48_bignum_bitwise_not(arg1),
-                                                  n));
+    return bignum_bitwise_not(bignum_magnitude_ash(bignum_bitwise_not(arg1), n));
   else
     return bignum_magnitude_ash(arg1, n);
 }
@@ -1475,7 +1503,7 @@ s48_bignum_arithmetic_shift(bignum_type arg1, long n)
 
 /* allocates memory */
 bignum_type
-s48_bignum_bitwise_and(bignum_type arg1, bignum_type arg2)
+bignum_bitwise_and(bignum_type arg1, bignum_type arg2)
 {
   return(
          (BIGNUM_NEGATIVE_P (arg1))
@@ -1490,7 +1518,7 @@ s48_bignum_bitwise_and(bignum_type arg1, bignum_type arg2)
 
 /* allocates memory */
 bignum_type
-s48_bignum_bitwise_ior(bignum_type arg1, bignum_type arg2)
+bignum_bitwise_ior(bignum_type arg1, bignum_type arg2)
 {
   return(
          (BIGNUM_NEGATIVE_P (arg1))
@@ -1505,7 +1533,7 @@ s48_bignum_bitwise_ior(bignum_type arg1, bignum_type arg2)
 
 /* allocates memory */
 bignum_type
-s48_bignum_bitwise_xor(bignum_type arg1, bignum_type arg2)
+bignum_bitwise_xor(bignum_type arg1, bignum_type arg2)
 {
   return(
          (BIGNUM_NEGATIVE_P (arg1))
@@ -1618,9 +1646,9 @@ bignum_pospos_bitwise_op(int op, bignum_type arg1, bignum_type arg2)
     fprintf(stderr, "[pospos op = %d, i = %ld, d1 = %lx, d2 = %lx]\n",
             op, endr - scanr, digit1, digit2);
             */
-    *scanr++ = (op == 0) ? digit1 & digit2 :
-               (op == 1) ? digit1 | digit2 :
-                           digit1 ^ digit2;
+    *scanr++ = (op == AND_OP) ? digit1 & digit2 :
+               (op == IOR_OP) ? digit1 | digit2 :
+                                digit1 ^ digit2;
   }
   return bignum_trim(result);
 }
@@ -1696,8 +1724,8 @@ bignum_negneg_bitwise_op(int op, bignum_type arg1, bignum_type arg2)
   max_length =  (BIGNUM_LENGTH(arg1) > BIGNUM_LENGTH(arg2))
                ? BIGNUM_LENGTH(arg1) + 1 : BIGNUM_LENGTH(arg2) + 1;
 
-  UNREGISTER_BIGNUM(arg1);
-  UNREGISTER_BIGNUM(arg2);
+  REGISTER_BIGNUM(arg1);
+  REGISTER_BIGNUM(arg2);
   result = allot_bignum(max_length, neg_p);
   UNREGISTER_BIGNUM(arg2);
   UNREGISTER_BIGNUM(arg1);
@@ -1732,9 +1760,9 @@ bignum_negneg_bitwise_op(int op, bignum_type arg1, bignum_type arg2)
         carry2 = 1;
       }
     
-    *scanr++ = (op == 0) ? digit1 & digit2 :
-               (op == 1) ? digit1 | digit2 :
-                           digit1 ^ digit2;
+    *scanr++ = (op == AND_OP) ? digit1 & digit2 :
+               (op == IOR_OP) ? digit1 | digit2 :
+                                digit1 ^ digit2;
   }
 
   if (neg_p)
@@ -1770,3 +1798,89 @@ bignum_negate_magnitude(bignum_type arg)
     *scan++ = digit;
   }
 }
+
+/* Allocates memory */
+bignum_type
+bignum_integer_length(bignum_type bignum)
+{
+  bignum_length_type index = ((BIGNUM_LENGTH (bignum)) - 1);
+  bignum_digit_type digit = (BIGNUM_REF (bignum, index));
+  
+  REGISTER_BIGNUM(bignum);
+  bignum_type result = (allot_bignum (2, 0));
+  UNREGISTER_BIGNUM(bignum);
+  
+  (BIGNUM_REF (result, 0)) = index;
+  (BIGNUM_REF (result, 1)) = 0;
+  bignum_destructive_scale_up (result, BIGNUM_DIGIT_LENGTH);
+  while (digit > 1)
+    {
+      bignum_destructive_add (result, ((bignum_digit_type) 1));
+      digit >>= 1;
+    }
+  return (bignum_trim (result));
+}
+
+/* Allocates memory */
+int
+bignum_logbitp(int shift, bignum_type arg)
+{
+  return((BIGNUM_NEGATIVE_P (arg)) 
+         ? !bignum_unsigned_logbitp (shift, bignum_bitwise_not (arg))
+         : bignum_unsigned_logbitp (shift,arg));
+}
+
+int
+bignum_unsigned_logbitp(int shift, bignum_type bignum)
+{
+  bignum_length_type len = (BIGNUM_LENGTH (bignum));
+  bignum_digit_type digit;
+  int index = shift / BIGNUM_DIGIT_LENGTH;
+  int p;
+  if (index >= len)
+    return 0;
+  digit = (BIGNUM_REF (bignum, index));
+  p = shift % BIGNUM_DIGIT_LENGTH;
+  return digit & (1 << p);
+}
+
+/* Allocates memory */
+bignum_type
+digit_stream_to_bignum(unsigned int n_digits,
+                       unsigned int (*producer)(unsigned int),
+                       unsigned int radix,
+                       int negative_p)
+{
+  BIGNUM_ASSERT ((radix > 1) && (radix <= BIGNUM_RADIX_ROOT));
+  if (n_digits == 0)
+    return (BIGNUM_ZERO ());
+  if (n_digits == 1)
+    {
+      long digit = ((long) ((*producer) (0)));
+      return (long_to_bignum (negative_p ? (- digit) : digit));
+    }
+  {
+    bignum_length_type length;
+    {
+      unsigned int radix_copy = radix;
+      unsigned int log_radix = 0;
+      while (radix_copy > 0)
+        {
+          radix_copy >>= 1;
+          log_radix += 1;
+        }
+      /* This length will be at least as large as needed. */
+      length = (BIGNUM_BITS_TO_DIGITS (n_digits * log_radix));
+    }
+    {
+      bignum_type result = (allot_bignum_zeroed (length, negative_p));
+      while ((n_digits--) > 0)
+        {
+          bignum_destructive_scale_up (result, ((bignum_digit_type) radix));
+          bignum_destructive_add
+            (result, ((bignum_digit_type) ((*producer) (n_digits))));
+        }
+      return (bignum_trim (result));
+    }
+  }
+}
index aa92f3b4b1af9c1cb4f2ffc9582186dfc3640f7d..3e6fd9f3ec59c79bc09c6ff48cbb288a91b0ab5e 100644 (file)
@@ -1,8 +1,7 @@
-/* -*-C-*-
+/* :tabSize=2:indentSize=2:noTabs=true:
 
-$Id: s48_bignum.h,v 1.13 2005/12/21 02:36:52 spestov Exp $
-
-Copyright (c) 1989-1992 Massachusetts Institute of Technology
+Copyright (C) 1989-1992 Massachusetts Institute of Technology
+Portions copyright (C) 2004-2007 Slava Pestov
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -33,15 +32,6 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* External Interface to Bignum Code */
-
-/* The `unsigned long' type is used for the conversion procedures
-   `bignum_to_long' and `long_to_bignum'.  Older implementations of C
-   don't support this type; if you have such an implementation you can
-   disable these procedures using the following flag (alternatively
-   you could write alternate versions that don't require this type). */
-/* #define BIGNUM_NO_ULONG */
-
 typedef F_ARRAY * bignum_type;
 #define BIGNUM_OUT_OF_BAND ((bignum_type) 0)
 
@@ -52,39 +42,39 @@ enum bignum_comparison
   bignum_comparison_greater = 1
 };
 
-int s48_bignum_equal_p(bignum_type, bignum_type);
-enum bignum_comparison s48_bignum_compare(bignum_type, bignum_type);
-bignum_type s48_bignum_add(bignum_type, bignum_type);
-bignum_type s48_bignum_subtract(bignum_type, bignum_type);
-bignum_type s48_bignum_negate(bignum_type);
-bignum_type s48_bignum_multiply(bignum_type, bignum_type);
+int bignum_equal_p(bignum_type, bignum_type);
+enum bignum_comparison bignum_compare(bignum_type, bignum_type);
+bignum_type bignum_add(bignum_type, bignum_type);
+bignum_type bignum_subtract(bignum_type, bignum_type);
+bignum_type bignum_negate(bignum_type);
+bignum_type bignum_multiply(bignum_type, bignum_type);
 void
-s48_bignum_divide(bignum_type numerator, bignum_type denominator,
+bignum_divide(bignum_type numerator, bignum_type denominator,
                  bignum_type * quotient, bignum_type * remainder);
-bignum_type s48_bignum_quotient(bignum_type, bignum_type);
-bignum_type s48_bignum_remainder(bignum_type, bignum_type);
-DLLEXPORT bignum_type s48_fixnum_to_bignum(F_FIXNUM);
-DLLEXPORT bignum_type s48_cell_to_bignum(CELL);
-DLLEXPORT bignum_type s48_long_to_bignum(long);
-DLLEXPORT bignum_type s48_long_long_to_bignum(s64 n);
-DLLEXPORT bignum_type s48_ulong_long_to_bignum(u64 n);
-DLLEXPORT bignum_type s48_ulong_to_bignum(unsigned long);
-F_FIXNUM s48_bignum_to_fixnum(bignum_type);
-CELL s48_bignum_to_cell(bignum_type);
-long s48_bignum_to_long(bignum_type);
-unsigned long s48_bignum_to_ulong(bignum_type);
-s64 s48_bignum_to_long_long(bignum_type);
-u64 s48_bignum_to_ulong_long(bignum_type);
-bignum_type s48_double_to_bignum(double);
-double s48_bignum_to_double(bignum_type);
+bignum_type bignum_quotient(bignum_type, bignum_type);
+bignum_type bignum_remainder(bignum_type, bignum_type);
+DLLEXPORT bignum_type fixnum_to_bignum(F_FIXNUM);
+DLLEXPORT bignum_type cell_to_bignum(CELL);
+DLLEXPORT bignum_type long_to_bignum(long);
+DLLEXPORT bignum_type long_long_to_bignum(s64 n);
+DLLEXPORT bignum_type ulong_long_to_bignum(u64 n);
+DLLEXPORT bignum_type ulong_to_bignum(unsigned long);
+F_FIXNUM bignum_to_fixnum(bignum_type);
+CELL bignum_to_cell(bignum_type);
+long bignum_to_long(bignum_type);
+unsigned long bignum_to_ulong(bignum_type);
+s64 bignum_to_long_long(bignum_type);
+u64 bignum_to_ulong_long(bignum_type);
+bignum_type double_to_bignum(double);
+double bignum_to_double(bignum_type);
 
 /* Added bitwise operators. */
 
-DLLEXPORT bignum_type s48_bignum_bitwise_not(bignum_type),
-                   s48_bignum_arithmetic_shift(bignum_type, long),
-                   s48_bignum_bitwise_and(bignum_type, bignum_type),
-                   s48_bignum_bitwise_ior(bignum_type, bignum_type),
-                   s48_bignum_bitwise_xor(bignum_type, bignum_type);
+DLLEXPORT bignum_type bignum_bitwise_not(bignum_type),
+                   bignum_arithmetic_shift(bignum_type, long),
+                   bignum_bitwise_and(bignum_type, bignum_type),
+                   bignum_bitwise_ior(bignum_type, bignum_type),
+                   bignum_bitwise_xor(bignum_type, bignum_type);
 
 /* Forward references */
 int bignum_equal_p_unsigned(bignum_type, bignum_type);
@@ -131,3 +121,11 @@ bignum_type bignum_pospos_bitwise_op(int op, bignum_type, bignum_type);
 bignum_type bignum_posneg_bitwise_op(int op, bignum_type, bignum_type);
 bignum_type bignum_negneg_bitwise_op(int op, bignum_type, bignum_type);
 void        bignum_negate_magnitude(bignum_type);
+
+bignum_type bignum_integer_length(bignum_type arg1);
+int bignum_unsigned_logbitp(int shift, bignum_type bignum);
+int bignum_logbitp(int shift, bignum_type arg);
+bignum_type digit_stream_to_bignum(unsigned int n_digits,
+                                   unsigned int (*producer)(unsigned int),
+                                   unsigned int radix,
+                                   int negative_p);
index aacde5d195f18fe83514c1eb6c2278fe4c7c9538..a101473fc64f370849cca35b6c1af74564281ee9 100644 (file)
@@ -64,7 +64,7 @@ typedef F_FIXNUM bignum_length_type;
 
 #define BIGNUM_LENGTH(bignum) (untag_fixnum_fast((bignum)->capacity) - 1)
 
-#define BIGNUM_NEGATIVE_P(bignum) (get(AREF(bignum,0)) != 0)
+#define BIGNUM_NEGATIVE_P(bignum) (array_nth(bignum,0) != 0)
 #define BIGNUM_SET_NEGATIVE_P(bignum,neg) put(AREF(bignum,0),neg)
 
 #define BIGNUM_ZERO_P(bignum)                                          \
@@ -75,9 +75,9 @@ typedef F_FIXNUM bignum_length_type;
 
 /* These definitions are here to facilitate caching of the constants
    0, 1, and -1. */
-#define BIGNUM_ZERO() untag_array_fast(bignum_zero)
+#define BIGNUM_ZERO() untag_object(bignum_zero)
 #define BIGNUM_ONE(neg_p) \
-   untag_array_fast(neg_p ? bignum_neg_one : bignum_pos_one)
+   untag_object(neg_p ? bignum_neg_one : bignum_pos_one)
 
 #define HD_LOW(digit) ((digit) & BIGNUM_HALF_DIGIT_MASK)
 #define HD_HIGH(digit) ((digit) >> BIGNUM_HALF_DIGIT_LENGTH)
index ffb1d5104b48723beba77882b217bb2394465202..1595ba66df8b81481ef7ca6e97ab7281ba30dd32 100644 (file)
@@ -1,21 +1,26 @@
-#include "factor.h"
+#include "master.h"
 
 /* This malloc-style heap code is reasonably generic. Maybe in the future, it
 will be used for the data heap too, if we ever get incremental
 mark/sweep/compact GC. */
 void new_heap(F_HEAP *heap, CELL size)
 {
-       heap->base = (CELL)(alloc_segment(size)->start);
-       if(heap->base == 0)
-               fatal_error("Cannot allocate code heap",size);
-       heap->limit = heap->base + size;
+       heap->segment = alloc_segment(align_page(size));
+       if(!heap->segment)
+               fatal_error("Out of memory in new_heap",size);
        heap->free_list = NULL;
 }
 
 /* Allocate a code heap during startup */
 void init_code_heap(CELL size)
 {
-       new_heap(&compiling,size);
+       new_heap(&code_heap,size);
+}
+
+bool in_code_heap_p(CELL ptr)
+{
+       return (ptr >= code_heap.segment->start
+               && ptr <= code_heap.segment->end);
 }
 
 /* If there is no previous block, next_free becomes the head of the free list,
@@ -36,8 +41,8 @@ void build_free_list(F_HEAP *heap, CELL size)
 {
        F_BLOCK *prev = NULL;
        F_BLOCK *prev_free = NULL;
-       F_BLOCK *scan = (F_BLOCK *)heap->base;
-       F_BLOCK *end = (F_BLOCK *)(heap->base + size);
+       F_BLOCK *scan = first_block(heap);
+       F_BLOCK *end = (F_BLOCK *)(heap->segment->start + size);
 
        /* Add all free blocks to the free list */
        while(scan && scan < end)
@@ -61,11 +66,11 @@ void build_free_list(F_HEAP *heap, CELL size)
 
        /* If there is room at the end of the heap, add a free block. This
        branch is only taken after loading a new image, not after code GC */
-       if((CELL)(end + 1) <= heap->limit)
+       if((CELL)(end + 1) <= heap->segment->end)
        {
                end->status = B_FREE;
                end->next_free = NULL;
-               end->size = heap->limit - (CELL)end;
+               end->size = heap->segment->end - (CELL)end;
 
                /* add final free block */
                update_free_list(heap,prev_free,end);
@@ -78,7 +83,7 @@ void build_free_list(F_HEAP *heap, CELL size)
                free block, we might have to jigger it up by a few bytes in
                case prev + prev->size */
                if(prev)
-                       prev->size = heap->limit - (CELL)prev;
+                       prev->size = heap->segment->end - (CELL)prev;
 
                /* this is the last free block */
                update_free_list(heap,prev_free,NULL);
@@ -92,7 +97,7 @@ CELL heap_allot(F_HEAP *heap, CELL size)
        F_BLOCK *prev = NULL;
        F_BLOCK *scan = heap->free_list;
 
-       size = align8(size);
+       size = (size + 31) & ~31;
 
        while(scan)
        {
@@ -140,12 +145,27 @@ CELL heap_allot(F_HEAP *heap, CELL size)
        return 0;
 }
 
+/* If in the middle of code GC, we have to grow the heap, GC restarts from
+scratch, so we have to unmark any marked blocks. */
+void unmark_marked(F_HEAP *heap)
+{
+       F_BLOCK *scan = first_block(heap);
+
+       while(scan)
+       {
+               if(scan->status == B_MARKED)
+                       scan->status = B_ALLOCATED;
+
+               scan = next_block(heap,scan);
+       }
+}
+
 /* After code GC, all referenced code blocks have status set to B_MARKED, so any
 which are allocated and not marked can be reclaimed. */
 void free_unmarked(F_HEAP *heap)
 {
        F_BLOCK *prev = NULL;
-       F_BLOCK *scan = (F_BLOCK *)heap->base;
+       F_BLOCK *scan = first_block(heap);
 
        while(scan)
        {
@@ -175,18 +195,18 @@ void free_unmarked(F_HEAP *heap)
                scan = next_block(heap,scan);
        }
 
-       build_free_list(heap,heap->limit - heap->base);
+       build_free_list(heap,heap->segment->size);
 }
 
 /* Compute total sum of sizes of free blocks */
-CELL heap_free_space(F_HEAP *heap)
+CELL heap_usage(F_HEAP *heap, F_BLOCK_STATUS status)
 {
        CELL size = 0;
-       F_BLOCK *scan = (F_BLOCK *)heap->base;
+       F_BLOCK *scan = first_block(heap);
 
        while(scan)
        {
-               if(scan->status == B_FREE)
+               if(scan->status == status)
                        size += scan->size;
                scan = next_block(heap,scan);
        }
@@ -197,41 +217,41 @@ CELL heap_free_space(F_HEAP *heap)
 /* The size of the heap, not including the last block if it's free */
 CELL heap_size(F_HEAP *heap)
 {
-       F_BLOCK *scan = (F_BLOCK *)heap->base;
+       F_BLOCK *scan = first_block(heap);
 
        while(next_block(heap,scan) != NULL)
                scan = next_block(heap,scan);
 
        /* this is the last block in the heap, and it is free */
        if(scan->status == B_FREE)
-               return (CELL)scan - heap->base;
+               return (CELL)scan - heap->segment->start;
        /* otherwise the last block is allocated */
        else
-               return heap->limit - heap->base;
+               return heap->segment->size;
 }
 
 /* Apply a function to every code block */
 void iterate_code_heap(CODE_HEAP_ITERATOR iter)
 {
-       F_BLOCK *scan = (F_BLOCK *)compiling.base;
+       F_BLOCK *scan = first_block(&code_heap);
 
        while(scan)
        {
                if(scan->status != B_FREE)
-                       iterate_code_heap_step((F_COMPILED *)(scan + 1),iter);
-               scan = next_block(&compiling,scan);
+                       iterate_code_heap_step(block_to_compiled(scan),iter);
+               scan = next_block(&code_heap,scan);
        }
 }
 
 /* Copy all literals referenced from a code block to newspace */
 void collect_literals_step(F_COMPILED *compiled, CELL code_start,
-       CELL reloc_start, CELL literal_start, CELL words_start, CELL words_end)
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end)
 {
        CELL scan;
 
-       CELL literal_end = literal_start + compiled->literal_length;
+       CELL literal_end = literals_start + compiled->literals_length;
 
-       for(scan = literal_start; scan < literal_end; scan += CELLS)
+       for(scan = literals_start; scan < literal_end; scan += CELLS)
                copy_handle((CELL*)scan);
 
        /* If the block is not finalized, the words area contains pointers to
@@ -257,16 +277,16 @@ void collect_literals(void)
 
 /* Mark all XTs referenced from a code block */
 void mark_sweep_step(F_COMPILED *compiled, CELL code_start,
-       CELL reloc_start, CELL literal_start, CELL words_start, CELL words_end)
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end)
 {
        CELL scan;
 
        for(scan = words_start; scan < words_end; scan += CELLS)
-               recursive_mark(get(scan));
+               recursive_mark((XT)get(scan));
 }
 
 /* Mark all XTs and literals referenced from a word XT */
-void recursive_mark(CELL xt)
+void recursive_mark(XT xt)
 {
        F_BLOCK *block = xt_to_block(xt);
 
@@ -300,22 +320,26 @@ void recursive_mark(CELL xt)
 }
 
 /* Push the free space and total size of the code heap */
-void primitive_code_room(void)
+DEFINE_PRIMITIVE(code_room)
+{
+       dpush(tag_fixnum(heap_usage(&code_heap,B_FREE) / 1024));
+       dpush(tag_fixnum((code_heap.segment->size) / 1024));
+}
+
+void code_gc(void)
 {
-       dpush(tag_fixnum(heap_free_space(&compiling) / 1024));
-       dpush(tag_fixnum((compiling.limit - compiling.base) / 1024));
+       garbage_collection(TENURED,true,false,0);
 }
 
-/* Perform a code GC */
-void primitive_code_gc(void)
+DEFINE_PRIMITIVE(code_gc)
 {
-       garbage_collection(TENURED,true);
+       code_gc();
 }
 
 /* Dump all code blocks for debugging */
 void dump_heap(F_HEAP *heap)
 {
-       F_BLOCK *scan = (F_BLOCK *)heap->base;
+       F_BLOCK *scan = first_block(heap);
 
        while(scan)
        {
@@ -336,8 +360,131 @@ void dump_heap(F_HEAP *heap)
                        break;
                }
 
-               fprintf(stderr,"%lx %s\n",(CELL)scan,status);
+               fprintf(stderr,"%lx %lx %s\n",(CELL)scan,scan->size,status);
 
                scan = next_block(heap,scan);
        }
 }
+
+/* Compute where each block is going to go, after compaction */
+CELL compute_heap_forwarding(F_HEAP *heap)
+{
+       F_BLOCK *scan = first_block(heap);
+       CELL address = (CELL)first_block(heap);
+
+       while(scan)
+       {
+               if(scan->status == B_ALLOCATED)
+               {
+                       scan->forwarding = (F_BLOCK *)address;
+                       address += scan->size;
+               }
+
+               scan = next_block(heap,scan);
+       }
+
+       return address - heap->segment->start;
+}
+
+void forward_xt(XT *xt)
+{
+       F_BLOCK *block = xt_to_block(*xt);
+       *xt = block_to_xt(block->forwarding);
+}
+
+void forward_object_xts(void)
+{
+       begin_scan();
+
+       CELL obj;
+
+       while((obj = next_object()) != F)
+       {
+               if(type_of(obj) == WORD_TYPE)
+               {
+                       F_WORD *word = untag_object(obj);
+
+                       if(in_code_heap_p((CELL)word->xt))
+                               forward_xt(&word->xt);
+               }
+               else if(type_of(obj) == QUOTATION_TYPE)
+               {
+                       F_QUOTATION *quot = untag_object(obj);
+
+                       if(in_code_heap_p((CELL)quot->xt))
+                               forward_xt(&quot->xt);
+               }
+       }
+
+       /* End the heap scan */
+       gc_off = false;
+}
+
+void compaction_code_block_fixup(F_COMPILED *compiled, CELL code_start,
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end)
+{
+       XT *iter = (XT *)words_start;
+       XT *end = (XT *)words_end;
+
+       while(iter < end)
+               forward_xt(iter++);
+}
+
+void forward_block_xts(void)
+{
+       F_BLOCK *scan = first_block(&code_heap);
+
+       while(scan)
+       {
+               if(scan->status == B_ALLOCATED)
+               {
+                       iterate_code_heap_step(block_to_compiled(scan),
+                               compaction_code_block_fixup);
+               }
+
+               scan = next_block(&code_heap,scan);
+       }
+}
+
+void compact_heap(F_HEAP *heap)
+{
+       F_BLOCK *scan = first_block(heap);
+
+       while(scan)
+       {
+               F_BLOCK *next = next_block(heap,scan);
+
+               if(scan->status == B_ALLOCATED && scan != scan->forwarding)
+                       memcpy(scan->forwarding,scan,scan->size);
+
+               scan = next;
+       }
+}
+
+/* Move all free space to the end of the code heap. This is not very efficient,
+since it makes several passes over the code and data heaps, but we only ever
+do this before saving a deployed image and exiting, so performaance is not
+critical here */
+void compact_code_heap(void)
+{
+       /* Free all unreachable code blocks */
+       code_gc();
+
+       fprintf(stderr,"*** Code heap compaction...\n");
+
+       /* Figure out where the code heap blocks are going to end up */
+       CELL size = compute_heap_forwarding(&code_heap);
+
+       /* Update word and quotation XTs to point to the new locations */
+       forward_object_xts();
+
+       /* Update code block XTs to point to the new locations */
+       forward_block_xts();
+
+       /* Actually perform the compaction */
+       compact_heap(&code_heap);
+
+       /* Now update the free list; there will be a single free block at
+       the end */
+       build_free_list(&code_heap,size);
+}
index 846b48c61702b05f27e798fb9ce363fb3a1fd9a8..a2b1310585f54d91443e617df87db0472a5c29f5 100644 (file)
@@ -8,73 +8,109 @@ typedef enum
 typedef struct _F_BLOCK
 {
        F_BLOCK_STATUS status;
+
+       /* In bytes, includes this header */
        CELL size;
+
+       /* Filled in on image load */
        struct _F_BLOCK *next_free;
+
+       /* Used during compaction */
+       struct _F_BLOCK *forwarding;
+
+       /* Alignment padding */
+       CELL padding[4];
 } F_BLOCK;
 
 typedef struct {
-       CELL base;
-       CELL limit;
+       F_SEGMENT *segment;
        F_BLOCK *free_list;
 } F_HEAP;
 
 void new_heap(F_HEAP *heap, CELL size);
 void build_free_list(F_HEAP *heap, CELL size);
 CELL heap_allot(F_HEAP *heap, CELL size);
+void unmark_marked(F_HEAP *heap);
 void free_unmarked(F_HEAP *heap);
-CELL heap_free_space(F_HEAP *heap);
+CELL heap_usage(F_HEAP *heap, F_BLOCK_STATUS status);
 CELL heap_size(F_HEAP *heap);
 
 INLINE F_BLOCK *next_block(F_HEAP *heap, F_BLOCK *block)
 {
        CELL next = ((CELL)block + block->size);
-       if(next == heap->limit)
+       if(next == heap->segment->end)
                return NULL;
        else
                return (F_BLOCK *)next;
 }
 
 /* compiled code */
-F_HEAP compiling;
+F_HEAP code_heap;
 
 /* The compiled code heap is structured into blocks. */
 typedef struct
 {
+       CELL type; /* this is WORD_TYPE or QUOTATION_TYPE */
        CELL code_length; /* # bytes */
        CELL reloc_length; /* # bytes */
-       CELL literal_length; /* # bytes */
+       CELL literals_length; /* # bytes */
        CELL words_length; /* # bytes */
        CELL finalized; /* has finalize_code_block() been called on this yet? */
+       CELL padding[2];
 } F_COMPILED;
 
 typedef void (*CODE_HEAP_ITERATOR)(F_COMPILED *compiled, CELL code_start,
-       CELL reloc_start, CELL literal_start, CELL words_start, CELL words_end);
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end);
 
 INLINE void iterate_code_heap_step(F_COMPILED *compiled, CODE_HEAP_ITERATOR iter)
 {
        CELL code_start = (CELL)(compiled + 1);
        CELL reloc_start = code_start + compiled->code_length;
-       CELL literal_start = reloc_start + compiled->reloc_length;
-       CELL words_start = literal_start + compiled->literal_length;
+       CELL literals_start = reloc_start + compiled->reloc_length;
+       CELL words_start = literals_start + compiled->literals_length;
        CELL words_end = words_start + compiled->words_length;
 
-       iter(compiled,code_start,reloc_start,literal_start,words_start,words_end);
+       iter(compiled,code_start,reloc_start,literals_start,words_start,words_end);
 }
 
-INLINE F_BLOCK *xt_to_block(CELL xt)
+INLINE F_BLOCK *xt_to_block(XT xt)
 {
-       return (F_BLOCK *)(xt - sizeof(F_BLOCK) - sizeof(F_COMPILED));
+       return (F_BLOCK *)((CELL)xt - sizeof(F_BLOCK) - sizeof(F_COMPILED));
 }
 
-INLINE F_COMPILED *xt_to_compiled(CELL xt)
+INLINE F_COMPILED *xt_to_compiled(XT xt)
 {
-       return (F_COMPILED *)(xt - sizeof(F_COMPILED));
+       return (F_COMPILED *)((CELL)xt - sizeof(F_COMPILED));
+}
+
+INLINE F_COMPILED *block_to_compiled(F_BLOCK *block)
+{
+       return (F_COMPILED *)(block + 1);
+}
+
+INLINE XT block_to_xt(F_BLOCK *block)
+{
+       return (XT)((CELL)block + sizeof(F_BLOCK) + sizeof(F_COMPILED));
+}
+
+INLINE F_BLOCK *first_block(F_HEAP *heap)
+{
+       return (F_BLOCK *)heap->segment->start;
+}
+
+INLINE F_BLOCK *last_block(F_HEAP *heap)
+{
+       return (F_BLOCK *)heap->segment->end;
 }
 
 void init_code_heap(CELL size);
+bool in_code_heap_p(CELL ptr);
 void iterate_code_heap(CODE_HEAP_ITERATOR iter);
 void collect_literals(void);
-void recursive_mark(CELL xt);
-void primitive_code_room(void);
-void primitive_code_gc(void);
+void recursive_mark(XT xt);
 void dump_heap(F_HEAP *heap);
+void code_gc(void);
+void compact_code_heap(void);
+
+DECLARE_PRIMITIVE(code_room);
+DECLARE_PRIMITIVE(code_gc);
index 1e24896973b00e51abee5278713c5ec324eea9e2..fd910ef9d4e587ade4fd695784d25f596b8916f6 100644 (file)
@@ -1,57 +1,55 @@
-#include "factor.h"
+#include "master.h"
 
 /* References to undefined symbols are patched up to call this function on
 image load */
 void undefined_symbol(void)
 {
-       simple_error(ERROR_UNDEFINED_SYMBOL,F,F);
+       general_error(ERROR_UNDEFINED_SYMBOL,F,F,NULL);
 }
 
 #define CREF(array,i) ((CELL)(array) + CELLS * (i))
 
-INLINE CELL get_literal(CELL literal_start, CELL num)
+INLINE CELL get_literal(CELL literals_start, CELL num)
 {
-       return get(CREF(literal_start,num));
+       return get(CREF(literals_start,num));
 }
 
 /* Look up an external library symbol referenced by a compiled code block */
-CELL get_rel_symbol(F_REL *rel, CELL literal_start)
+void *get_rel_symbol(F_REL *rel, CELL literals_start)
 {
        CELL arg = REL_ARGUMENT(rel);
-       F_ARRAY *pair = untag_array(get_literal(literal_start,arg));
-       char *symbol = alien_offset(get(AREF(pair,0)));
-       CELL library = get(AREF(pair,1));
+       F_SYMBOL *symbol = alien_offset(get_literal(literals_start,arg));
+       CELL library = get_literal(literals_start,arg + 1);
        F_DLL *dll = (library == F ? NULL : untag_dll(library));
 
        if(dll != NULL && !dll->dll)
-               return (CELL)undefined_symbol;
+               return undefined_symbol;
 
-       CELL sym = (CELL)ffi_dlsym(dll,symbol,false);
+       if(!symbol)
+               return undefined_symbol;
 
-       if(!sym)
-               return (CELL)undefined_symbol;
+       void *sym = ffi_dlsym(dll,symbol);
 
-       return sym;
+       if(sym)
+               return sym;
+       else
+               return undefined_symbol;
 }
 
 /* Compute an address to store at a relocation */
 INLINE CELL compute_code_rel(F_REL *rel,
-       CELL code_start, CELL literal_start, CELL words_start)
+       CELL code_start, CELL literals_start, CELL words_start)
 {
-       CELL offset = code_start + rel->offset;
-
        switch(REL_TYPE(rel))
        {
        case RT_PRIMITIVE:
-               return primitive_to_xt(REL_ARGUMENT(rel));
+               return (CELL)primitives[REL_ARGUMENT(rel)];
        case RT_DLSYM:
-               return get_rel_symbol(rel,literal_start);
-       case RT_HERE:
-               return offset;
-       case RT_CARDS:
-               return cards_offset;
+               return (CELL)get_rel_symbol(rel,literals_start);
        case RT_LITERAL:
-               return CREF(literal_start,REL_ARGUMENT(rel));
+               return CREF(literals_start,REL_ARGUMENT(rel));
+       case RT_DISPATCH:
+               return CREF(words_start,REL_ARGUMENT(rel));
        case RT_XT:
                return get(CREF(words_start,REL_ARGUMENT(rel)));
        case RT_LABEL:
@@ -62,7 +60,7 @@ INLINE CELL compute_code_rel(F_REL *rel,
        }
 }
 
-/* Store a 32-bit value into two consecutive PowerPC LI/LIS instructions */
+/* Store a 32-bit value into a PowerPC LIS/ORI sequence */
 INLINE void reloc_set_2_2(CELL cell, CELL value)
 {
        put(cell - CELLS,((get(cell - CELLS) & ~0xffff) | ((value >> 16) & 0xffff)));
@@ -70,69 +68,98 @@ INLINE void reloc_set_2_2(CELL cell, CELL value)
 }
 
 /* Store a value into a bitfield of a PowerPC instruction */
-INLINE void reloc_set_masked(CELL cell, CELL value, CELL mask)
+INLINE void reloc_set_masked(CELL cell, F_FIXNUM value, CELL mask, F_FIXNUM shift)
 {
        u32 original = *(u32*)cell;
        original &= ~mask;
-       *(u32*)cell = (original | (value & mask));
+       *(u32*)cell = (original | ((value >> shift) & mask));
 }
 
 /* Perform a fixup on a code block */
-void apply_relocation(F_REL *rel,
-       CELL code_start, CELL literal_start, CELL words_start)
+void apply_relocation(CELL class, CELL offset, F_FIXNUM absolute_value)
 {
-       CELL absolute_value;
-       CELL relative_value;
-       CELL offset = rel->offset + code_start;
-
-       absolute_value = compute_code_rel(rel,
-               code_start,literal_start,words_start);
-       relative_value = absolute_value - offset;
+       F_FIXNUM relative_value = absolute_value - offset;
 
-       switch(REL_CLASS(rel))
+       switch(class)
        {
-       case REL_ABSOLUTE_CELL:
+       case RC_ABSOLUTE_CELL:
                put(offset,absolute_value);
                break;
-       case REL_ABSOLUTE:
+       case RC_ABSOLUTE:
                *(u32*)offset = absolute_value;
                break;
-       case REL_RELATIVE:
+       case RC_RELATIVE:
                *(u32*)offset = relative_value - sizeof(u32);
                break;
-       case REL_ABSOLUTE_2_2:
+       case RC_ABSOLUTE_PPC_2_2:
                reloc_set_2_2(offset,absolute_value);
                break;
-       case REL_RELATIVE_2_2:
-               reloc_set_2_2(offset,relative_value);
+       case RC_RELATIVE_PPC_2:
+               reloc_set_masked(offset,relative_value,REL_RELATIVE_PPC_2_MASK,0);
+               break;
+       case RC_RELATIVE_PPC_3:
+               reloc_set_masked(offset,relative_value,REL_RELATIVE_PPC_3_MASK,0);
+               break;
+       case RC_RELATIVE_ARM_3:
+               reloc_set_masked(offset,relative_value - CELLS * 2,
+                       REL_RELATIVE_ARM_3_MASK,2);
                break;
-       case REL_RELATIVE_2:
-               reloc_set_masked(offset,relative_value,REL_RELATIVE_2_MASK);
+       case RC_INDIRECT_ARM:
+               reloc_set_masked(offset,relative_value - CELLS,
+                       REL_INDIRECT_ARM_MASK,0);
                break;
-       case REL_RELATIVE_3:
-               reloc_set_masked(offset,relative_value,REL_RELATIVE_3_MASK);
+       case RC_INDIRECT_ARM_PC:
+               reloc_set_masked(offset,relative_value - CELLS * 2,
+                       REL_INDIRECT_ARM_MASK,0);
                break;
        default:
-               critical_error("Bad rel class",REL_CLASS(rel));
-               return;
+               critical_error("Bad rel class",class);
+               break;
        }
 }
 
 /* Perform all fixups on a code block */
 void relocate_code_block(F_COMPILED *relocating, CELL code_start,
-       CELL reloc_start, CELL literal_start, CELL words_start, CELL words_end)
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end)
 {
        F_REL *rel = (F_REL *)reloc_start;
-       F_REL *rel_end = (F_REL *)literal_start;
+       F_REL *rel_end = (F_REL *)literals_start;
 
        while(rel < rel_end)
-               apply_relocation(rel++,code_start,literal_start,words_start);
+       {
+               CELL offset = rel->offset + code_start;
+
+               F_FIXNUM absolute_value = compute_code_rel(rel,
+                       code_start,literals_start,words_start);
+
+               apply_relocation(REL_CLASS(rel),offset,absolute_value);
+
+               rel++;
+       }
+}
+
+/* Fixup labels. This is done at compile time, not image load time */
+void fixup_labels(F_ARRAY *labels, CELL code_format, CELL code_start)
+{
+       CELL i;
+       CELL size = array_capacity(labels);
+
+       for(i = 0; i < size; i += 3)
+       {
+               CELL class = to_fixnum(array_nth(labels,i));
+               CELL offset = to_fixnum(array_nth(labels,i + 1));
+               CELL target = to_fixnum(array_nth(labels,i + 2));
+
+               apply_relocation(class,
+                       offset + code_start,
+                       target + code_start);
+       }
 }
 
 /* After compiling a batch of words, we replace all mutual word references with
 direct XT references, and perform fixups */
 void finalize_code_block(F_COMPILED *relocating, CELL code_start,
-       CELL reloc_start, CELL literal_start, CELL words_start, CELL words_end)
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end)
 {
        CELL scan;
 
@@ -140,26 +167,25 @@ void finalize_code_block(F_COMPILED *relocating, CELL code_start,
                critical_error("Finalizing a finalized block",(CELL)relocating);
 
        for(scan = words_start; scan < words_end; scan += CELLS)
-               put(scan,untag_word(get(scan))->xt);
+               put(scan,(CELL)(untag_word(get(scan))->xt));
 
        relocating->finalized = true;
 
        relocate_code_block(relocating,code_start,reloc_start,
-               literal_start,words_start,words_end);
+               literals_start,words_start,words_end);
 
        flush_icache(code_start,reloc_start - code_start);
 }
 
 /* Write a sequence of integers to memory, with 'format' bytes per integer */
-void deposit_integers(CELL here, F_VECTOR *vector, CELL format)
+void deposit_integers(CELL here, F_ARRAY *array, CELL format)
 {
-       CELL count = untag_fixnum_fast(vector->top);
-       F_ARRAY *array = untag_array_fast(vector->array);
+       CELL count = array_capacity(array);
        CELL i;
 
        for(i = 0; i < count; i++)
        {
-               F_FIXNUM value = to_fixnum(get(AREF(array,i)));
+               F_FIXNUM value = to_fixnum(array_nth(array,i));
                if(format == 1)
                        cput(here + i,value);
                else if(format == sizeof(unsigned int))
@@ -172,68 +198,76 @@ void deposit_integers(CELL here, F_VECTOR *vector, CELL format)
 }
 
 /* Write a sequence of tagged pointers to memory */
-void deposit_objects(CELL here, F_VECTOR *vector, CELL literal_length)
+void deposit_objects(CELL here, F_ARRAY *array)
 {
-       F_ARRAY *array = untag_array_fast(vector->array);
-       memcpy((void*)here,array + 1,literal_length);
+       memcpy((void*)here,array + 1,array_capacity(array) * CELLS);
 }
 
-#define FROB \
-       CELL code_format = to_cell(get(ds)); \
-       F_VECTOR *code = untag_vector(get(ds - CELLS)); \
-       F_VECTOR *words = untag_vector(get(ds - CELLS * 2)); \
-       F_VECTOR *literals = untag_vector(get(ds - CELLS * 3)); \
-       F_VECTOR *rel = untag_vector(get(ds - CELLS * 4)); \
-       CELL code_length = align8(untag_fixnum_fast(code->top) * code_format); \
-       CELL rel_length = untag_fixnum_fast(rel->top) * sizeof(unsigned int); \
-       CELL literal_length = untag_fixnum_fast(literals->top) * CELLS; \
-       CELL words_length = untag_fixnum_fast(words->top) * CELLS;
-
-void primitive_add_compiled_block(void)
+CELL compiled_code_format(void)
 {
-       CELL start;
-
-       {
-               /* Read parameters from stack, leaving them on the stack */
-               FROB
+       return untag_fixnum_fast(userenv[JIT_CODE_FORMAT]);
+}
 
-               /* Try allocating a new code block */
-               CELL total_length = sizeof(F_COMPILED) + code_length
-                       + rel_length + literal_length + words_length;
+CELL allot_code_block(CELL size)
+{
+       CELL start = heap_allot(&code_heap,size);
 
-               start = heap_allot(&compiling,total_length);
+       /* If allocation failed, do a code GC */
+       if(start == 0)
+       {
+               code_gc();
+               start = heap_allot(&code_heap,size);
 
-               /* If allocation failed, do a code GC */
+               /* Insufficient room even after code GC, give up */
                if(start == 0)
-               {
-                       garbage_collection(TENURED,true);
-                       start = heap_allot(&compiling,total_length);
-
-                       /* Insufficient room even after code GC, give up */
-                       if(start == 0)
-                               critical_error("Out of memory in add-compiled-block",0);
-               }
+                       critical_error("Out of memory in add-compiled-block",0);
        }
 
-       /* we have to read the parameters again, since we may have called
-       GC above in which case the data heap semi-spaces will have switched */
-       FROB
+       return start;
+}
+
+XT add_compiled_block(
+       CELL type,
+       F_ARRAY *code,
+       F_ARRAY *labels,
+       F_ARRAY *rel,
+       F_ARRAY *words,
+       F_ARRAY *literals)
+{
+       CELL code_format = compiled_code_format();
+
+       CELL code_length = align8(array_capacity(code) * code_format);
+       CELL rel_length = (rel ? array_capacity(rel) * sizeof(unsigned int) : 0);
+       CELL words_length = (words ? array_capacity(words) * CELLS : 0);
+       CELL literals_length = (literals ? array_capacity(literals) * CELLS : 0);
 
-       /* now we can pop the parameters from the stack */
-       ds -= CELLS * 5;
+       REGISTER_UNTAGGED(code);
+       REGISTER_UNTAGGED(labels);
+       REGISTER_UNTAGGED(rel);
+       REGISTER_UNTAGGED(words);
+       REGISTER_UNTAGGED(literals);
+
+       CELL start = allot_code_block(sizeof(F_COMPILED) + code_length
+               + rel_length + literals_length + words_length);
+
+       UNREGISTER_UNTAGGED(literals);
+       UNREGISTER_UNTAGGED(words);
+       UNREGISTER_UNTAGGED(rel);
+       UNREGISTER_UNTAGGED(labels);
+       UNREGISTER_UNTAGGED(code);
 
        /* begin depositing the code block's contents */
        CELL here = start;
 
        /* compiled header */
-       F_COMPILED header;
-       header.code_length = code_length;
-       header.reloc_length = rel_length;
-       header.literal_length = literal_length;
-       header.words_length = words_length;
-       header.finalized = false;
-
-       memcpy((void*)here,&header,sizeof(F_COMPILED));
+       F_COMPILED *header = (void *)here;
+       header->type = type;
+       header->code_length = code_length;
+       header->reloc_length = rel_length;
+       header->literals_length = literals_length;
+       header->words_length = words_length;
+       header->finalized = false;
+
        here += sizeof(F_COMPILED);
 
        /* code */
@@ -241,29 +275,60 @@ void primitive_add_compiled_block(void)
        here += code_length;
 
        /* relation info */
-       deposit_integers(here,rel,sizeof(unsigned int));
-       here += rel_length;
+       if(rel)
+       {
+               deposit_integers(here,rel,sizeof(unsigned int));
+               here += rel_length;
+       }
 
        /* literals */
-       deposit_objects(here,literals,literal_length);
-       here += literal_length;
+       if(literals)
+       {
+               deposit_objects(here,literals);
+               here += literals_length;
+       }
 
        /* words */
-       deposit_objects(here,words,words_length);
-       here += words_length;
+       if(words)
+       {
+               deposit_objects(here,words);
+               here += words_length;
+       }
+
+       /* compute the XT */
+       XT xt = (XT)(start + sizeof(F_COMPILED));
+
+       /* fixup labels */
+       if(labels)
+               fixup_labels(labels,code_format,(CELL)xt);
+
+       /* next time we do a minor GC, we have to scan the code heap for
+       literals */
+       last_code_heap_scan = NURSERY;
+
+       return xt;
+}
+
+DEFINE_PRIMITIVE(add_compiled_block)
+{
+       F_ARRAY *code = untag_array(dpop());
+       F_ARRAY *labels = untag_array(dpop());
+       F_ARRAY *rel = untag_array(dpop());
+       F_ARRAY *words = untag_array(dpop());
+       F_ARRAY *literals = untag_array(dpop());
+
+       XT xt = add_compiled_block(WORD_TYPE,code,labels,rel,words,literals);
 
        /* push the XT of the new word on the stack */
        F_WORD *word = allot_word(F,F);
-       word->xt = start + sizeof(F_COMPILED);
+       word->xt = xt;
        word->compiledp = T;
-       dpush(tag_word(word));
+       dpush(tag_object(word));
 }
 
-#undef FROB
-
 /* After batch compiling a bunch of words, perform various fixups to make them
 executable */
-void primitive_finalize_compile(void)
+DEFINE_PRIMITIVE(finalize_compile)
 {
        F_ARRAY *array = untag_array(dpop());
 
@@ -272,12 +337,12 @@ void primitive_finalize_compile(void)
        CELL i;
        for(i = 0; i < count; i++)
        {
-               F_ARRAY *pair = untag_array(get(AREF(array,i)));
-               F_WORD *word = untag_word(get(AREF(pair,0)));
-               CELL xt = untag_word(get(AREF(pair,1)))->xt;
+               F_ARRAY *pair = untag_array(array_nth(array,i));
+               F_WORD *word = untag_word(array_nth(pair,0));
+               XT xt = untag_word(array_nth(pair,1))->xt;
                F_BLOCK *block = xt_to_block(xt);
                if(block->status != B_ALLOCATED)
-                       critical_error("bad XT",xt);
+                       critical_error("bad XT",(CELL)xt);
 
                word->xt = xt;
                word->compiledp = T;
@@ -286,40 +351,9 @@ void primitive_finalize_compile(void)
        /* perform relocation */
        for(i = 0; i < count; i++)
        {
-               F_ARRAY *pair = untag_array(get(AREF(array,i)));
-               F_WORD *word = untag_word(get(AREF(pair,0)));
-               CELL xt = word->xt;
+               F_ARRAY *pair = untag_array(array_nth(array,i));
+               F_WORD *word = untag_word(array_nth(pair,0));
+               XT xt = word->xt;
                iterate_code_heap_step(xt_to_compiled(xt),finalize_code_block);
        }
 }
-
-void primitive_xt_map(void)
-{
-       GROWABLE_ARRAY(array);
-       F_BLOCK *scan = (F_BLOCK *)compiling.base;
-
-       while(scan)
-       {
-               if(scan->status != B_FREE)
-               {
-                       F_COMPILED *compiled = (F_COMPILED *)(scan + 1);
-                       CELL code_start = (CELL)(compiled + 1);
-                       CELL literal_start = code_start
-                               + compiled->code_length
-                               + compiled->reloc_length;
-
-                       CELL word = get_literal(literal_start,0);
-                       GROWABLE_ADD(array,word);
-                       REGISTER_ARRAY(array);
-                       CELL xt = allot_cell(code_start);
-                       UNREGISTER_ARRAY(array);
-                       GROWABLE_ADD(array,xt);
-               }
-
-               scan = next_block(&compiling,scan);
-       }
-
-       GROWABLE_TRIM(array);
-
-       dpush(tag_object(array));
-}
index 5fc6b946a5173bd6373d4a6efc08c8563b79b6a8..c4aeb9e6c38d336a78edb668ac220c10a78213b8 100644 (file)
@@ -3,28 +3,41 @@ typedef enum {
        RT_PRIMITIVE,
        /* arg is a literal table index, holding an array pair (symbol/dll) */
        RT_DLSYM,
-       /* store current address here */
-       RT_HERE,
-       /* store the offset of the card table from the data heap base */
-       RT_CARDS,
        /* an indirect literal from the word's literal table */
        RT_LITERAL,
+       /* a pointer to a compiled word reference */
+       RT_DISPATCH,
        /* a compiled word reference */
        RT_XT,
        /* a local label */
        RT_LABEL
 } F_RELTYPE;
 
-#define REL_ABSOLUTE_CELL 0
-#define REL_ABSOLUTE 1
-#define REL_RELATIVE 2
-#define REL_ABSOLUTE_2_2 3
-#define REL_RELATIVE_2_2 4
-#define REL_RELATIVE_2 5
-#define REL_RELATIVE_3 6
+typedef enum {
+       /* absolute address in a 64-bit location */
+       RC_ABSOLUTE_CELL,
+       /* absolute address in a 32-bit location */
+       RC_ABSOLUTE,
+       /* relative address in a 32-bit location */
+       RC_RELATIVE,
+       /* relative address in a PowerPC LIS/ORI sequence */
+       RC_ABSOLUTE_PPC_2_2,
+       /* relative address in a PowerPC LWZ/STW/BC instruction */
+       RC_RELATIVE_PPC_2,
+       /* relative address in a PowerPC B/BL instruction */
+       RC_RELATIVE_PPC_3,
+       /* relative address in an ARM B/BL instruction */
+       RC_RELATIVE_ARM_3,
+       /* pointer to address in an ARM LDR/STR instruction */
+       RC_INDIRECT_ARM,
+       /* pointer to address in an ARM LDR/STR instruction offset by 8 bytes */
+       RC_INDIRECT_ARM_PC
+} F_RELCLASS;
 
-#define REL_RELATIVE_2_MASK 0xfffc
-#define REL_RELATIVE_3_MASK 0x3fffffc
+#define REL_RELATIVE_PPC_2_MASK 0xfffc
+#define REL_RELATIVE_PPC_3_MASK 0x3fffffc
+#define REL_INDIRECT_ARM_MASK 0xfff
+#define REL_RELATIVE_ARM_3_MASK 0xffffff
 
 /* the rel type is built like a cell to avoid endian-specific code in
 the compiler */
@@ -39,7 +52,20 @@ typedef struct {
 } F_REL;
 
 void relocate_code_block(F_COMPILED *relocating, CELL code_start,
-       CELL reloc_start, CELL literal_start, CELL words_start, CELL words_end);
-void primitive_add_compiled_block(void);
-void primitive_finalize_compile(void);
-void primitive_xt_map(void);
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end);
+
+void finalize_code_block(F_COMPILED *relocating, CELL code_start,
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end);
+
+XT add_compiled_block(
+       CELL type,
+       F_ARRAY *code,
+       F_ARRAY *labels,
+       F_ARRAY *rel,
+       F_ARRAY *words,
+       F_ARRAY *literals);
+
+CELL compiled_code_format(void);
+
+DECLARE_PRIMITIVE(add_compiled_block);
+DECLARE_PRIMITIVE(finalize_compile);
index 9d4946ae2c6cdbea04fc742ce66faafc9c13c935..5df8bd0bf4b8d7d12e2c25ae9d62d30f76aa60b0 100644 (file)
@@ -1,8 +1,4 @@
-#ifdef __APPLE__
-       #define MANGLE(sym) _##sym
-#else
-       #define MANGLE(sym) sym
-#endif
+#include "asm.h"
 
 /* Callable from C as
 void *native_stack_pointer(void) */
index 55d845c48b78f7d7f5d957fe7f186eadffd2b694..64d2c3a14a10748232344d8e8a38f98a3bcfda8d 100644 (file)
@@ -1,14 +1,20 @@
-#define FACTOR_CPU_STRING "amd64"
+#define FACTOR_CPU_STRING "x86.64"
 
 register CELL ds asm("r14");
 register CELL rs asm("r15");
-register CELL cards_offset asm("r13");
+void **primitives;
 
 INLINE void flush_icache(CELL start, CELL len) {}
 
 void *native_stack_pointer(void);
 
-typedef CELL F_STACK_FRAME;
+typedef CELL F_COMPILED_FRAME;
 
 #define PREVIOUS_FRAME(frame) (frame + 1)
 #define RETURN_ADDRESS(frame) (*(frame))
+
+INLINE void execute(CELL word)
+{
+       F_WORD *untagged = untag_object(word);
+       untagged->xt(word);
+}
diff --git a/vm/cpu-arm.S b/vm/cpu-arm.S
new file mode 100644 (file)
index 0000000..f609b1f
--- /dev/null
@@ -0,0 +1,8 @@
+#include "asm.h"
+
+/* Callable from C as
+void *native_stack_pointer(void) */
+       .globl MANGLE(native_stack_pointer)
+MANGLE(native_stack_pointer):
+       mov r0,sp
+       mov pc,lr
diff --git a/vm/cpu-arm.h b/vm/cpu-arm.h
new file mode 100644 (file)
index 0000000..ae8b4e5
--- /dev/null
@@ -0,0 +1,17 @@
+#define FACTOR_CPU_STRING "arm"
+
+register CELL ds asm("r5");
+register CELL rs asm("r6");
+register void **primitives asm("r7");
+
+void *native_stack_pointer(void);
+
+typedef CELL F_COMPILED_FRAME;
+
+#define PREVIOUS_FRAME(frame) (frame + 1)
+#define RETURN_ADDRESS(frame) (*(frame))
+
+INLINE void execute(CELL word)
+{
+       untag_object(word)->xt(word);
+}
index 69347d1df360baf225b5db192b7fc7556caf97d3..295e16f04c1a3f564a76745b87cdcb5201a8fa51 100644 (file)
-#ifdef __APPLE__
-       #define MANGLE(sym) _##sym
+/* Parts of this file were snarfed from SBCL src/runtime/ppc-assem.S, which is
+in the public domain. */
+#include "asm.h"
+
+/* Note that the XT is passed to the quotation in r11 */
+#define CALL_OR_JUMP_QUOT \
+        lwz r11,5(r3)      /* load quotation-xt slot */ XX \
+
+#define CALL_QUOT \
+        CALL_OR_JUMP_QUOT XX \
+        mtlr r11           /* prepare to call XT with quotation in r3 */ XX \
+        blrl               /* go */
+
+#define JUMP_QUOT \
+        CALL_OR_JUMP_QUOT XX \
+        mtctr r11          /* prepare to call XT with quotation in r3 */ XX \
+        bctr               /* go */
+
+#define PARAM_SIZE 32
+
+#define SAVED_REGS_SIZE 96
+
+#define FRAME (RESERVED_SIZE + PARAM_SIZE + SAVED_REGS_SIZE + 8)
+   
+#if defined( __APPLE__)
+        #define LR_SAVE 8
+        #define RESERVED_SIZE 24
 #else
-       #define MANGLE(sym) sym
+        #define LR_SAVE 4
+        #define RESERVED_SIZE 8
 #endif
 
+#define SAVE_LR(reg) stw reg,(LR_SAVE + FRAME)(r1)
+
+#define LOAD_LR(reg) lwz reg,(LR_SAVE + FRAME)(r1)
+
+#define SAVE_AT(offset) (RESERVED_SIZE + PARAM_SIZE + 4 * offset)
+
+#define SAVE(register,offset) stw register,SAVE_AT(offset)(r1)
+
+#define RESTORE(register,offset) lwz register,SAVE_AT(offset)(r1)
+
+DEF(void,c_to_factor,(CELL quot)):
+        mflr r0            /* get caller's return address */
+        stwu r1,-FRAME(r1) /* create a stack frame to hold non-volatile registers */
+        SAVE_LR(r0)
+
+       SAVE(r13,0)        /* save GPRs */
+                           /* don't save ds pointer */
+                           /* don't save rs pointer */
+        SAVE(r16,3)
+        SAVE(r17,4)
+        SAVE(r18,5)
+        SAVE(r19,6)
+        SAVE(r20,7)
+        SAVE(r21,8)
+        SAVE(r22,9)
+        SAVE(r23,10)
+        SAVE(r24,11)
+        SAVE(r25,12)
+        SAVE(r26,13)
+        SAVE(r27,14)
+        SAVE(r28,15)
+        SAVE(r29,16)
+        SAVE(r30,17)
+        SAVE(r31,18)
+       SAVE(r3,19)        /* save quotation since we're about to mangle it */
+
+        mr r3,r1           /* pass call stack pointer as an argument */
+       bl MANGLE(save_callstack_bottom)
+
+       RESTORE(r3,19)     /* restore quotation */
+        CALL_QUOT
+
+        RESTORE(r31,18)    /* restore GPRs */
+        RESTORE(r30,17)
+        RESTORE(r29,16)
+        RESTORE(r28,15)
+        RESTORE(r27,14)
+        RESTORE(r26,13)
+        RESTORE(r25,12)
+        RESTORE(r24,11)
+        RESTORE(r23,10)
+        RESTORE(r22,9)
+        RESTORE(r21,8)
+        RESTORE(r20,7)
+        RESTORE(r19,6)
+        RESTORE(r18,5)
+        RESTORE(r17,4)
+        RESTORE(r16,3)
+                           /* don't restore rs pointer */
+                           /* don't restore ds pointer */
+        RESTORE(r13,0)
+
+        LOAD_LR(r0)
+        lwz r1,0(r1)       /* destroy the stack frame */
+        mtlr r0            /* get ready to return */
+        blr
+
+/* The JIT compiles an 'mr r4,r1' in front of every primitive call, since a
+word which was defined as a primitive will not change its definition for the
+lifetime of the image -- adding new primitives requires a bootstrap. However,
+an undefined word can certainly become defined,
+
+DEFER: foo
+...
+: foo ... ;
+
+And calls to non-primitives do not have this one-instruction prologue, so we
+set the XT of undefined words to this symbol. */
+DEF(void,undefined,(CELL word)):
+       mr r4,r1
+       b MANGLE(undefined_error)
+
+DEF(void,dosym,(CELL word)):
+       stwu r3,4(r14)     /* push word to stack */
+       blr                /* return */
+
+/* Here we have two entry points. The first one is taken when profiling is
+enabled */
+DEF(void,docol_profiling,(CELL word)):
+        lwz r4,25(r3)      /* load profile-count slot */
+        addi r4,r4,8       /* increment count */
+        stw r4,25(r3)      /* store profile-count slot */
+DEF(void,docol,(CELL word)):
+        lwz r3,13(r3)      /* load word-def slot */
+        JUMP_QUOT
+
+/* We must pass the XT to the quotation in r11. */
+DEF(void,primitive_call,(void)):
+        lwz r3,0(r14)      /* load quotation from data stack */
+        subi r14,r14,4     /* pop quotation from data stack */
+        JUMP_QUOT
+
+/* We must preserve r4 here in case we're calling a primitive */
+DEF(void,primitive_execute,(void)):
+        lwz r3,0(r14)      /* load word from data stack */
+        lwz r11,29(r3)     /* load word-xt slot */
+        mtctr r11          /* prepare to call XT with word in r3 */
+        subi r14,r14,4     /* pop word from data stack */
+        bctr               /* go */
+
+#define SCAN_SAVE (RESERVED_SIZE + PARAM_SIZE + 4)
+
+/* We pass a function pointer to memcpy in r6 to work around a Mac OS X ABI
+limitation which would otherwise require us to do a bizzaro PC-relative
+trampoline to retrieve the function address */
+DEF(void,set_callstack,(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy)):
+        sub r1,r3,r5       /* compute new stack pointer */
+        mr r3,r1           /* start of destination of memcpy() */
+       stwu r1,-64(r1)    /* setup fake stack frame for memcpy() */
+       mtlr r6            /* prepare to call memcpy() */
+        blrl               /* go */
+       lwz r1,0(r1)       /* tear down fake stack frame */
+        lwz r0,LR_SAVE(r1) /* we have restored the stack; load return address */
+                          /* load quotation scan pointer */
+        lwz r5,SCAN_SAVE(r1)
+        mtlr r0            /* prepare to return to restored callstack */
+        blr                /* go */
+
+DEF(void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to)):
+       mr r1,r4           /* compute new stack pointer */
+       lwz r0,LR_SAVE(r1) /* we have rewound the stack; load return address */
+       mtlr r0
+       JUMP_QUOT          /* call the quotation */
+
 /* Thanks to Joshua Grams for this code.
 
 On PowerPC processors, we must flush the instruction cache manually
-after writing to the code heap.
-
-Callable from C as
-void flush_icache(void *start, int len) */
-
-       .globl MANGLE(flush_icache)
-MANGLE(flush_icache):
-       /* compute number of cache lines to flush */
-       add r4,r4,r3
-       clrrwi r3,r3,5    /* align addr to next lower cache line boundary */
-       sub r4,r4,r3      /* then n_lines = (len + 0x1f) / 0x20 */
-       addi r4,r4,0x1f
-       srwi. r4,r4,5     /* note '.' suffix */
-       beqlr             /* if n_lines == 0, just return. */
-       mtctr r4          /* flush cache lines */
-0:     dcbf 0,r3         /* for each line... */
-       sync
-       icbi 0,r3
-       addi r3,r3,0x20
-       bdnz 0b
-       sync              /* finish up */
-       isync
-       blr
-
-/* Callable from C as
-void *native_stack_pointer(void) */
-       .globl MANGLE(native_stack_pointer)
-MANGLE(native_stack_pointer):
-       mr r3,r1          /* native stack pointer is in r1 */
-       blr
+after writing to the code heap. */
+
+DEF(void,flush_icache,(void *start, int len)):
+        /* compute number of cache lines to flush */
+        add r4,r4,r3
+        clrrwi r3,r3,5     /* align addr to next lower cache line boundary */
+        sub r4,r4,r3       /* then n_lines = (len + 0x1f) / 0x20 */
+        addi r4,r4,0x1f
+        srwi. r4,r4,5      /* note '.' suffix */
+        beqlr              /* if n_lines == 0, just return. */
+        mtctr r4           /* flush cache lines */
+0:      dcbf 0,r3          /* for each line... */
+        sync
+        icbi 0,r3
+        addi r3,r3,0x20
+        bdnz 0b
+        sync               /* finish up */
+        isync
+        blr
index 3e4a0f32140a94404c6000e18724cdc2b8abde4e..e4ff35c15c602f133d72249167157bf6ec41fa65 100644 (file)
@@ -1,12 +1,16 @@
 #define FACTOR_CPU_STRING "ppc"
+#define FASTCALL
 
 register CELL ds asm("r14");
 register CELL rs asm("r15");
-register CELL cards_offset asm("r16");
 
+void c_to_factor(CELL quot);
+void dosym(CELL word);
+void docol_profiling(CELL word);
+void docol(CELL word);
+void undefined(CELL word);
+void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy);
+void throw_impl(CELL quot, F_STACK_FRAME *rewind);
 void flush_icache(CELL start, CELL len);
 
-void *native_stack_pointer(void);
-
-#define PREVIOUS_FRAME(frame) (frame->previous)
-#define RETURN_ADDRESS(frame) (frame->return_address)
+#define FRAME_SUCCESSOR(frame) (frame)->previous
index 19254d63c9079c4ff105b3790d9e10af91c304fe..aa640028982eddf55eb1c9350c77da908749e6eb 100644 (file)
@@ -1,12 +1,83 @@
-#if defined(__APPLE__) || defined(WINDOWS)
-       #define MANGLE(sym) _##sym
-#else
-       #define MANGLE(sym) sym
-#endif
-
-/* Callable from C as
-void *native_stack_pointer(void) */
-       .globl MANGLE(native_stack_pointer)
-MANGLE(native_stack_pointer):
-       mov %esp,%eax
+#include "asm.h"
+
+/* Note that primitive word definitions are compiled with
+__attribute__((regparm 2), so the pointer to the word object is passed in EAX,
+and the callstack top is passed in EDX */
+
+/* When calling a quotation, we pass the XT in ECX */
+#define JUMP_QUOT \
+       mov 5(%eax),%ecx ;                 /* Load quot-xt */ \
+       jmp *%ecx                          /* Jump to quot-xt */
+
+DEF(void,c_to_factor,(CELL quot)):
+       push %ebp                          /* Save non-volatile registers */
+       push %ebx
+
+       lea -8(%esp),%eax                  /* Save stack pointer */
+       push %eax                          /* This 16-byte aligns the stack */
+       call MANGLE(save_callstack_bottom)
+
+       mov 16(%esp),%eax                  /* Pass quot as arg 1 */
+       mov 5(%eax),%ecx                   /* Pass quot-xt */
+       call *%ecx                         /* Call quot-xt */
+
+       pop %eax                           /* Clobber */
+       pop %ebx                           /* Restore non-volatile registers */
+       pop %ebp
+       ret
+
+DEF(void,undefined,(CELL word)):
+       mov %esp,%ecx                      /* Save stack pointer before we mess with it */
+       sub $12,%esp                       /* Alignment */
+       mov %eax,4(%esp)                   /* Pass word as arg 1 (not fastcall) */
+       mov %ecx,8(%esp)                   /* Pass callstack pointer as arg 2 (not fastcall) */
+       jmp MANGLE(undefined_error)        /* This throws an error */
+
+DEF(void,dosym,(CELL word)):
+       add $4,%esi                        /* Increment stack pointer */
+       mov %eax,(%esi)                    /* Store word on stack */
        ret
+
+/* Here we have two entry points. The first one is taken when profiling is
+enabled */
+DEF(void,docol_profiling,(CELL word)):
+       add $8,25(%eax)                    /* Increment profile-count slot */
+DEF(void,docol,(CELL word)):
+       mov 13(%eax),%eax                  /* Load word-def slot */
+       JUMP_QUOT
+
+/* We must pass the XT to the quotation in ECX. */
+DEF(void,primitive_call,(void)):
+        mov (%esi),%eax                    /* Load quotation from data stack */
+       sub $4,%esi                        /* Pop data stack */
+       JUMP_QUOT
+
+/* We pass the word in EAX and the XT in ECX. Don't mess up EDX, it's the
+callstack top parameter to primitives. */
+DEF(void,primitive_execute,(void)):
+       mov (%esi),%eax                    /* Load word from data stack */
+       sub $4,%esi                        /* Pop data stack */
+        mov 29(%eax),%ecx                  /* Load word-xt slot */
+       jmp *%ecx                          /* Go */
+
+/* We pass a function pointer to memcpy in 16(%esp) to work around a Mac OS X
+ABI limitation which would otherwise require us to do a bizzaro PC-relative
+trampoline to retrieve the function address */
+DEF(void,set_callstack,(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy)):
+       mov 4(%esp),%ebp                   /* to */
+       mov 8(%esp),%edx                   /* from */
+       mov 12(%esp),%ecx                  /* length */
+       mov 16(%esp),%eax                  /* memcpy */
+       sub %ecx,%ebp                      /* compute new stack pointer */
+       mov %ebp,%esp
+       push %ecx                          /* pass length */
+       push %edx                          /* pass src */
+       push %ebp                          /* pass dst */
+       call *%eax                         /* call memcpy */
+       add $12,%esp                       /* pop args from the stack */
+       ret                                /* return _with new stack_ */
+
+DEF(void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to)):
+       mov 4(%esp),%eax                   /* quot */
+       mov 8(%esp),%esp                   /* rewind_to */
+       JUMP_QUOT
index 51e511f53f4aea4353a947f74874e15ccbc27627..7733df3ded6a16d8668fcbc1cc6a31ad7c73dbb0 100644 (file)
@@ -1,14 +1,40 @@
-#define FACTOR_CPU_STRING "x86"
+#define FACTOR_CPU_STRING "x86.32"
 
 register CELL ds asm("esi");
 register CELL rs asm("edi");
-CELL cards_offset;
+
+#define FASTCALL __attribute__ ((regparm (2)))
+
+typedef struct _F_STACK_FRAME
+{
+       /* In compiled quotation frames, position within the array.
+       In compiled word frames, unused. */
+       CELL scan;
+
+       /* In compiled quotation frames, the quot->array slot.
+       In compiled word frames, unused. */
+       CELL array;
+
+       /* In all compiled frames, the XT on entry. */
+       XT xt;
+
+       struct _F_STACK_FRAME *next;
+} F_STACK_FRAME;
+
+#define CALLSTACK_UP_P
+
+#define FRAME_SUCCESSOR(frame) (frame)->next
 
 INLINE void flush_icache(CELL start, CELL len) {}
 
-void *native_stack_pointer(void);
+void c_to_factor(CELL quot);
 
-typedef CELL F_STACK_FRAME;
+void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy);
+void throw_impl(CELL quot, F_STACK_FRAME *rewind_to);
 
-#define PREVIOUS_FRAME(frame) (frame + 1)
-#define RETURN_ADDRESS(frame) (*(frame))
+/* Defined in cpu-x86.S and only called from Factor-compiled code. They all
+use funny calling convention. */
+void undefined(CELL word);
+void dosym(CELL word);
+void docol_profiling(CELL word);
+void docol(CELL word);
index 451561dbd68bc8053dcad52ad54f955666c1397b..eaf88f31c5c029995d59e3913e6b4f4a54c57097 100644 (file)
-#include "factor.h"
+#include "master.h"
 
-/* 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 in_page(CELL fault, CELL area, CELL area_size, int offset)
+CELL init_zone(F_ZONE *z, CELL size, CELL start)
 {
-       const int pagesize = getpagesize();
-       area += area_size;
-       area += offset * pagesize;
+       z->size = size;
+       z->start = z->here = start;
+       z->end = start + size;
+       return z->end;
+}
 
-       return fault >= area && fault <= area + pagesize;
+void init_cards_offset(void)
+{
+       cards_offset = (CELL)data_heap->cards
+               - (data_heap->segment->start >> CARD_BITS);
 }
 
-/* If memory allocation fails, bail out */
-void *safe_malloc(size_t size)
+F_DATA_HEAP *alloc_data_heap(CELL gens, CELL young_size, CELL aging_size)
 {
-       void *ptr = malloc(size);
-       if(ptr == 0)
-               fatal_error("malloc() failed", 0);
-       return ptr;
+       young_size = align_page(young_size);
+       aging_size = align_page(aging_size);
+
+       F_DATA_HEAP *data_heap = safe_malloc(sizeof(F_DATA_HEAP));
+       data_heap->young_size = young_size;
+       data_heap->aging_size = aging_size;
+       data_heap->gen_count = gens;
+
+       CELL total_size;
+       if(data_heap->gen_count == 1)
+               total_size = 2 * aging_size;
+       else if(data_heap->gen_count == 2)
+               total_size = (gens - 1) * young_size + 2 * aging_size;
+       else if(data_heap->gen_count == 3)
+               total_size = gens * young_size + 2 * aging_size;
+       else
+       {
+               fatal_error("Invalid number of generations",data_heap->gen_count);
+               return NULL; /* can't happen */
+       }
+
+       data_heap->segment = alloc_segment(total_size);
+
+       data_heap->generations = safe_malloc(sizeof(F_ZONE) * gens);
+       data_heap->semispaces = safe_malloc(sizeof(F_ZONE) * gens);
+
+       CELL cards_size = total_size / CARD_SIZE;
+       data_heap->cards = safe_malloc(cards_size);
+       data_heap->cards_end = data_heap->cards + cards_size;
+
+       CELL alloter = data_heap->segment->start;
+
+       alloter = init_zone(&data_heap->semispaces[NURSERY],0,alloter);
+
+       alloter = init_zone(&data_heap->generations[TENURED],aging_size,alloter);
+       alloter = init_zone(&data_heap->semispaces[TENURED],aging_size,alloter);
+
+       int i;
+
+       if(data_heap->gen_count > 2)
+       {
+               alloter = init_zone(&data_heap->generations[AGING],young_size,alloter);
+               alloter = init_zone(&data_heap->semispaces[AGING],young_size,alloter);
+
+               for(i = gens - 3; i >= 0; i--)
+               {
+                       alloter = init_zone(&data_heap->generations[i],
+                               young_size,alloter);
+               }
+       }
+       else
+       {
+               for(i = gens - 2; i >= 0; i--)
+               {
+                       alloter = init_zone(&data_heap->generations[i],
+                               young_size,alloter);
+               }
+       }
+
+       if(alloter != data_heap->segment->end)
+               critical_error("Bug in alloc_data_heap",alloter);
+
+       return data_heap;
+}
+
+F_DATA_HEAP *grow_data_heap(F_DATA_HEAP *data_heap, CELL requested_bytes)
+{
+       CELL new_young_size = (data_heap->young_size * 2) + requested_bytes;
+       CELL new_aging_size = (data_heap->aging_size * 2) + requested_bytes;
+
+       return alloc_data_heap(data_heap->gen_count,
+               new_young_size,
+               new_aging_size);
+}
+
+void dealloc_data_heap(F_DATA_HEAP *data_heap)
+{
+       dealloc_segment(data_heap->segment);
+       free(data_heap->generations);
+       free(data_heap->semispaces);
+       free(data_heap->cards);
+       free(data_heap);
+}
+
+/* Every card stores the offset of the first object in that card, which must be
+cleared when a generation has been cleared */
+void clear_cards(CELL from, CELL to)
+{
+       /* NOTE: reverse order due to heap layout. */
+       F_CARD *last_card = ADDR_TO_CARD(data_heap->generations[from].end);
+       F_CARD *ptr = ADDR_TO_CARD(data_heap->generations[to].start);
+       for(; ptr < last_card; ptr++)
+               clear_card(ptr);
+}
+
+void set_data_heap(F_DATA_HEAP *data_heap_)
+{
+       data_heap = data_heap_;
+       nursery = &data_heap->generations[NURSERY];
+       init_cards_offset();
+       clear_cards(NURSERY,TENURED);
+}
+
+void init_data_heap(CELL gens,
+       CELL young_size,
+       CELL aging_size,
+       bool secure_gc_)
+{
+       set_data_heap(alloc_data_heap(gens,young_size,aging_size));
+
+       extra_roots_region = alloc_segment(getpagesize());
+       extra_roots = extra_roots_region->start - CELLS;
+
+       gc_time = 0;
+       minor_collections = 0;
+       cards_scanned = 0;
+       secure_gc = secure_gc_;
 }
 
 /* Size of the object pointed to by a tagged pointer */
 CELL object_size(CELL tagged)
 {
-       if(tagged == F || TAG(tagged) == FIXNUM_TYPE)
+       if(immediate_p(tagged))
                return 0;
        else
                return untagged_object_size(UNTAG(tagged));
@@ -40,20 +155,29 @@ CELL unaligned_object_size(CELL pointer)
 {
        switch(untag_header(get(pointer)))
        {
-       case WORD_TYPE:
-               return sizeof(F_WORD);
        case ARRAY_TYPE:
        case TUPLE_TYPE:
        case BIGNUM_TYPE:
+               return array_size(array_capacity((F_ARRAY*)pointer));
        case BYTE_ARRAY_TYPE:
+               return byte_array_size(
+                       byte_array_capacity((F_BYTE_ARRAY*)pointer));
+       case BIT_ARRAY_TYPE:
+               return bit_array_size(
+                       bit_array_capacity((F_BIT_ARRAY*)pointer));
+       case FLOAT_ARRAY_TYPE:
+               return float_array_size(
+                       float_array_capacity((F_FLOAT_ARRAY*)pointer));
+       case STRING_TYPE:
+               return string_size(string_capacity((F_STRING*)pointer));
        case QUOTATION_TYPE:
-               return array_size(array_capacity((F_ARRAY*)(pointer)));
+               return sizeof(F_QUOTATION);
+       case WORD_TYPE:
+               return sizeof(F_WORD);
        case HASHTABLE_TYPE:
                return sizeof(F_HASHTABLE);
        case VECTOR_TYPE:
                return sizeof(F_VECTOR);
-       case STRING_TYPE:
-               return string_size(string_capacity((F_STRING*)(pointer)));
        case SBUF_TYPE:
                return sizeof(F_SBUF);
        case RATIO_TYPE:
@@ -68,84 +192,90 @@ CELL unaligned_object_size(CELL pointer)
                return sizeof(F_ALIEN);
        case WRAPPER_TYPE:
                return sizeof(F_WRAPPER);
+       case CURRY_TYPE:
+               return sizeof(F_CURRY);
+       case CALLSTACK_TYPE:
+               return callstack_size(
+                       untag_fixnum_fast(((F_CALLSTACK *)pointer)->length));
        default:
-               critical_error("Cannot determine untagged_object_size",pointer);
+               critical_error("Invalid header",pointer);
                return -1; /* can't happen */
        }
 }
 
-void primitive_size(void)
+DEFINE_PRIMITIVE(size)
 {
-       drepl(tag_fixnum(object_size(dpeek())));
+       box_unsigned_cell(object_size(dpop()));
 }
 
 /* Push memory usage statistics in data heap */
-void primitive_data_room(void)
+DEFINE_PRIMITIVE(data_room)
 {
-       F_ARRAY *a = allot_array(ARRAY_TYPE,gen_count * 2,F);
+       F_ARRAY *a = allot_array(ARRAY_TYPE,data_heap->gen_count * 2,F);
        int gen;
 
-       dpush(tag_fixnum((cards_end - cards) >> 10));
-       dpush(tag_fixnum((prior.limit - prior.base) >> 10));
+       dpush(tag_fixnum((data_heap->cards_end - data_heap->cards) >> 10));
 
-       for(gen = 0; gen < gen_count; gen++)
+       for(gen = 0; gen < data_heap->gen_count; gen++)
        {
-               F_ZONE *z = &generations[gen];
-               set_array_nth(a,gen * 2,tag_fixnum((z->limit - z->here) >> 10));
-               set_array_nth(a,gen * 2 + 1,tag_fixnum((z->limit - z->base) >> 10));
+               F_ZONE *z = &data_heap->generations[gen];
+               set_array_nth(a,gen * 2,tag_fixnum((z->end - z->here) >> 10));
+               set_array_nth(a,gen * 2 + 1,tag_fixnum((z->size) >> 10));
        }
 
        dpush(tag_object(a));
 }
 
 /* Disables GC and activates next-object ( -- obj ) primitive */
-void primitive_begin_scan(void)
+void begin_scan(void)
 {
-       garbage_collection(TENURED,false);
-       heap_scan_ptr = tenured.base;
+       heap_scan_ptr = data_heap->generations[TENURED].start;
        gc_off = true;
 }
 
-/* Push object at heap scan cursor and advance; pushes f when done */
-void primitive_next_object(void)
+DEFINE_PRIMITIVE(begin_scan)
+{
+       data_gc();
+       begin_scan();
+}
+
+CELL next_object(void)
 {
+       if(!gc_off)
+               general_error(ERROR_HEAP_SCAN,F,F,NULL);
+
        CELL value = get(heap_scan_ptr);
        CELL obj = heap_scan_ptr;
        CELL type;
 
-       if(!gc_off)
-               simple_error(ERROR_HEAP_SCAN,F,F);
-
-       if(heap_scan_ptr >= tenured.here)
-       {
-               dpush(F);
-               return;
-       }
+       if(heap_scan_ptr >= data_heap->generations[TENURED].here)
+               return F;
        
        type = untag_header(value);
        heap_scan_ptr += untagged_object_size(heap_scan_ptr);
 
-       if(type <= HEADER_TYPE)
-               dpush(RETAG(obj,type));
-       else
-               dpush(RETAG(obj,OBJECT_TYPE));
+       return RETAG(obj,type <= HEADER_TYPE ? type : OBJECT_TYPE);
+}
+
+/* Push object at heap scan cursor and advance; pushes f when done */
+DEFINE_PRIMITIVE(next_object)
+{
+       dpush(next_object());
 }
 
 /* Re-enables GC */
-void primitive_end_scan(void)
+DEFINE_PRIMITIVE(end_scan)
 {
        gc_off = false;
 }
 
 /* Scan all the objects in the card */
-INLINE void collect_card(F_CARD *ptr, CELL here)
+INLINE void collect_card(F_CARD *ptr, CELL gen, CELL here)
 {
        F_CARD c = *ptr;
        CELL offset = (c & CARD_BASE_MASK);
-       CELL card_scan = (CELL)CARD_TO_ADDR(ptr) + offset;
-       CELL card_end = (CELL)CARD_TO_ADDR(ptr + 1);
 
-       if(offset == 0x7f)
+       if(offset == CARD_BASE_MASK)
        {
                if(c == 0xff)
                        critical_error("bad card",(CELL)ptr);
@@ -153,138 +283,89 @@ INLINE void collect_card(F_CARD *ptr, CELL here)
                        return;
        }
 
+       CELL card_scan = (CELL)CARD_TO_ADDR(ptr) + offset;
+       CELL card_end = (CELL)CARD_TO_ADDR(ptr + 1);
+
        while(card_scan < card_end && card_scan < here)
                card_scan = collect_next(card_scan);
-       
+
        cards_scanned++;
 }
 
 /* Copy all newspace objects referenced from marked cards to the destination */
 INLINE void collect_gen_cards(CELL gen)
 {
-       F_CARD *ptr = ADDR_TO_CARD(generations[gen].base);
-       CELL here = generations[gen].here;
-       F_CARD *last_card = ADDR_TO_CARD(here);
-       
-       if(generations[gen].here == generations[gen].limit)
-               last_card--;
-       
-       for(; ptr <= last_card; ptr++)
+       F_CARD *ptr = ADDR_TO_CARD(data_heap->generations[gen].start);
+       CELL here = data_heap->generations[gen].here;
+       F_CARD *last_card = ADDR_TO_CARD(here - 1);
+
+       CELL mask, unmask;
+
+       /* if we are collecting the nursery, we care about old->nursery pointers
+       but not old->aging pointers */
+       if(collecting_gen == NURSERY)
+       {
+               mask = CARD_POINTS_TO_NURSERY;
+
+               /* after the collection, no old->nursery pointers remain
+               anywhere, but old->aging pointers might remain in tenured
+               space */
+               if(gen == TENURED)
+                       unmask = CARD_POINTS_TO_NURSERY;
+               /* after the collection, all cards in aging space can be
+               cleared */
+               else if(HAVE_AGING_P && gen == AGING)
+                       unmask = CARD_MARK_MASK;
+               else
+               {
+                       critical_error("bug in collect_gen_cards",gen);
+                       return;
+               }
+       }
+       /* if we are collecting aging space into tenured space, we care about
+       all old->nursery and old->aging pointers. no old->aging pointers can
+       remain */
+       else if(HAVE_AGING_P && collecting_gen == AGING)
        {
-               if(card_marked(*ptr))
-                       collect_card(ptr,here);
+               if(collecting_aging_again)
+               {
+                       mask = CARD_POINTS_TO_AGING;
+                       unmask = CARD_MARK_MASK;
+               }
+               /* after we collect aging space into the aging semispace, no
+               old->nursery pointers remain but tenured space might still have
+               pointers to aging space. */
+               else
+               {
+                       mask = CARD_POINTS_TO_AGING;
+                       unmask = CARD_POINTS_TO_NURSERY;
+               }
+       }
+       else
+       {
+               critical_error("bug in collect_gen_cards",gen);
+               return;
        }
-}
 
-/* After all old->new forward references have been copied over, we must unmark
-the cards */
-void unmark_cards(CELL from, CELL to)
-{
-       F_CARD *ptr = ADDR_TO_CARD(generations[from].base);
-       F_CARD *last_card = ADDR_TO_CARD(generations[to].here);
-       if(generations[to].here == generations[to].limit)
-               last_card--;
        for(; ptr <= last_card; ptr++)
-               unmark_card(ptr);
-}
-
-/* Every card stores the offset of the first object in that card, which must be
-cleared when a generation has been cleared */
-void clear_cards(CELL from, CELL to)
-{
-       /* NOTE: reverse order due to heap layout. */
-       F_CARD *last_card = ADDR_TO_CARD(generations[from].limit);
-       F_CARD *ptr = ADDR_TO_CARD(generations[to].base);
-       for(; ptr < last_card; ptr++)
-               clear_card(ptr);
+       {
+               if(*ptr & mask)
+               {
+                       collect_card(ptr,gen,here);
+                       *ptr &= ~unmask;
+               }
+       }
 }
 
 /* Scan cards in all generations older than the one being collected, copying
 old->new references */
-void collect_cards(CELL gen)
+void collect_cards(void)
 {
        int i;
-       for(i = gen + 1; i < gen_count; i++)
+       for(i = collecting_gen + 1; i < data_heap->gen_count; i++)
                collect_gen_cards(i);
 }
 
-CELL init_zone(F_ZONE *z, CELL size, CELL base)
-{
-       z->base = z->here = base;
-       z->limit = z->base + size;
-       return z->limit;
-}
-
-/* update this global variable. since it is stored in a non-volatile register,
-we need to save its contents and re-initialize it when entering a callback,
-and restore its contents when leaving the callback. see stack.c */
-void update_cards_offset(void)
-{
-       cards_offset = (CELL)cards - (data_heap_start >> CARD_BITS);
-}
-
-/* input parameters must be 8 byte aligned */
-/* the data heap layout is important:
-- two semispaces: tenured and prior
-- younger generations follow
-this is so that we can easily check if a pointer is in some generation or a
-younger one */
-void init_data_heap(CELL gens,
-       CELL young_size,
-       CELL aging_size,
-       bool secure_gc_)
-{
-       int i;
-       CELL alloter;
-
-       CELL total_size = (gens - 1) * young_size + 2 * aging_size;
-       CELL cards_size = total_size / CARD_SIZE;
-
-       gen_count = gens;
-       generations = safe_malloc(sizeof(F_ZONE) * gen_count);
-
-       data_heap_start = (CELL)(alloc_segment(total_size)->start);
-       data_heap_end = data_heap_start + total_size;
-
-       cards = safe_malloc(cards_size);
-       cards_end = cards + cards_size;
-       update_cards_offset();
-
-       alloter = data_heap_start;
-
-       alloter = init_zone(&tenured,aging_size,alloter);
-       alloter = init_zone(&prior,aging_size,alloter);
-
-       for(i = gen_count - 2; i >= 0; i--)
-               alloter = init_zone(&generations[i],young_size,alloter);
-
-       clear_cards(NURSERY,TENURED);
-
-       if(alloter != data_heap_start + total_size)
-               fatal_error("Oops",alloter);
-
-       gc_off = false;
-       gc_time = 0;
-       minor_collections = 0;
-       cards_scanned = 0;
-       secure_gc = secure_gc_;
-
-       data_heap_end = data_heap_start + total_size;
-
-       extra_roots_region = alloc_segment(getpagesize());
-       extra_roots = extra_roots_region->start - CELLS;
-}
-
-void collect_callframe_triple(CELL *callframe,
-       CELL *callframe_scan, CELL *callframe_end)
-{
-       *callframe_scan -= *callframe;
-       *callframe_end -= *callframe;
-       copy_handle(callframe);
-       *callframe_scan += *callframe;
-       *callframe_end += *callframe;
-}
-
 /* Copy all tagged pointers in a range of memory */
 void collect_stack(F_SEGMENT *region, CELL top)
 {
@@ -295,15 +376,27 @@ void collect_stack(F_SEGMENT *region, CELL top)
                copy_handle((CELL*)ptr);
 }
 
-/* The callstack has a special format */
-void collect_callstack(F_SEGMENT *region, CELL top)
+void collect_stack_frame(F_STACK_FRAME *frame)
 {
-       CELL bottom = region->start;
-       CELL ptr;
+       if(frame_type(frame) == QUOTATION_TYPE)
+       {
+               CELL scan = frame->scan - frame->array;
+               copy_handle(&frame->array);
+               frame->scan = scan + frame->array;
+       }
+
+       if(collecting_code)
+               recursive_mark(frame->xt);
+}
 
-       for(ptr = bottom; ptr <= top; ptr += CELLS * 3)
-               collect_callframe_triple((CELL*)ptr,
-                       (CELL*)ptr + 1, (CELL*)ptr + 2);
+/* The base parameter allows us to adjust for a heap-allocated
+callstack snapshot */
+void collect_callstack(F_CONTEXT *stacks)
+{
+       CELL top = (CELL)stacks->callstack_top;
+       CELL bottom = (CELL)stacks->callstack_bottom;
+       CELL base = bottom;
+       iterate_callstack(top,bottom,base,collect_stack_frame);
 }
 
 /* Copy roots over at the start of GC, namely various constants, stacks,
@@ -317,8 +410,6 @@ void collect_roots(void)
        copy_handle(&bignum_zero);
        copy_handle(&bignum_pos_one);
        copy_handle(&bignum_neg_one);
-       
-       collect_callframe_triple(&callframe,&callframe_scan,&callframe_end);
 
        collect_stack(extra_roots_region,extra_roots);
 
@@ -327,18 +418,13 @@ void collect_roots(void)
 
        while(stacks)
        {
-               collect_stack(stacks->data_region,stacks->data);
-               collect_stack(stacks->retain_region,stacks->retain);
-               
-               collect_callstack(stacks->call_region,stacks->call);
+               collect_stack(stacks->datastack_region,stacks->datastack);
+               collect_stack(stacks->retainstack_region,stacks->retainstack);
 
-               if(stacks->next != NULL)
-               {
-                       collect_callframe_triple(&stacks->callframe,
-                               &stacks->callframe_scan,&stacks->callframe_end);
-               }
+               copy_handle(&stacks->catchstack_save);
+               copy_handle(&stacks->current_callback_save);
 
-               copy_handle(&stacks->catch_save);
+               collect_callstack(stacks);
 
                stacks = stacks->next;
        }
@@ -351,21 +437,25 @@ void collect_roots(void)
 INLINE void *copy_untagged_object(void *pointer, CELL size)
 {
        void *newpointer;
-       if(newspace->here + size >= newspace->limit)
+       if(newspace->here + size >= newspace->end)
                longjmp(gc_jmp,1);
+       allot_barrier(newspace->here);
        newpointer = allot_zone(newspace,size);
        memcpy(newpointer,pointer,size);
        return newpointer;
 }
 
-INLINE CELL copy_object_impl(CELL pointer)
+INLINE void forward_object(CELL pointer, CELL newpointer)
 {
-       CELL newpointer = (CELL)copy_untagged_object((void*)UNTAG(pointer),
-               object_size(pointer));
-
-       /* install forwarding pointer */
        put(UNTAG(pointer),RETAG(newpointer,GC_COLLECTED));
+}
 
+INLINE CELL copy_object_impl(CELL pointer)
+{
+       CELL newpointer = (CELL)copy_untagged_object(
+               (void*)UNTAG(pointer),
+               object_size(pointer));
+       forward_object(pointer,newpointer);
        return newpointer;
 }
 
@@ -390,26 +480,25 @@ CELL resolve_forwarding(CELL untagged, CELL tag)
 If the object has already been copied, return the forwarding
 pointer address without copying anything; otherwise, install
 a new forwarding pointer. */
-CELL copy_object(CELL pointer)
+INLINE CELL copy_object(CELL pointer)
 {
-       CELL tag;
-       CELL header;
-
-       if(pointer == F)
-               return F;
-
-       tag = TAG(pointer);
+       CELL tag = TAG(pointer);
+       CELL header = get(UNTAG(pointer));
 
-       if(tag == FIXNUM_TYPE)
-               return pointer;
-
-       header = get(UNTAG(pointer));
        if(TAG(header) == GC_COLLECTED)
                return resolve_forwarding(UNTAG(header),tag);
        else
                return RETAG(copy_object_impl(pointer),tag);
 }
 
+void copy_handle(CELL *handle)
+{
+       CELL pointer = *handle;
+
+       if(!immediate_p(pointer) && should_copy(pointer))
+               *handle = copy_object(pointer);
+}
+
 /* The number of cells from the start of the object which should be scanned by
 the GC. Some types have a binary payload at the end (string, word, DLL) which
 we ignore. */
@@ -421,53 +510,67 @@ CELL binary_payload_start(CELL pointer)
        case STRING_TYPE:
        case FLOAT_TYPE:
        case BYTE_ARRAY_TYPE:
+       case BIT_ARRAY_TYPE:
+       case FLOAT_ARRAY_TYPE:
        case BIGNUM_TYPE:
+       case CALLSTACK_TYPE:
                return 0;
        /* these objects have some binary data at the end */
        case WORD_TYPE:
                return sizeof(F_WORD) - CELLS;
        case ALIEN_TYPE:
+               return CELLS * 3;
        case DLL_TYPE:
                return CELLS * 2;
+       case QUOTATION_TYPE:
+               return sizeof(F_QUOTATION) - CELLS;
        /* everything else consists entirely of pointers */
        default:
                return unaligned_object_size(pointer);
        }
 }
 
-/* Every object has a regular representation in the runtime, which makes GC
-much simpler. Every slot of the object until binary_payload_start is a pointer
-to some other object. */
-INLINE void collect_object(CELL start)
+void collect_callstack_object(F_CALLSTACK *callstack)
 {
-       CELL scan = start;
-       CELL payload_start = binary_payload_start(scan);
-       CELL end = scan + payload_start;
+       iterate_callstack_object(callstack,collect_stack_frame);
+}
 
-       scan += CELLS;
+CELL collect_next(CELL scan)
+{
+       do_slots(scan,copy_handle);
 
-       while(scan < end)
-       {
-               copy_handle((CELL*)scan);
-               scan += CELLS;
-       }
+       /* Special behaviors */
+       F_WORD *word;
+       F_QUOTATION *quot;
+       F_CALLSTACK *stack;
 
-       /* It is odd to put this hook here, but this is the only special case
-       made for any type of object by the GC. If code GC is being performed,
-       compiled code blocks referenced by this word must be marked. */
-       if(collecting_code && object_type(start) == WORD_TYPE)
+       switch(object_type(scan))
        {
-               F_WORD *word = (F_WORD *)start;
-               if(word->compiledp != F)
+       case WORD_TYPE:
+               word = (F_WORD *)scan;
+               if(collecting_code && word->compiledp != F)
                        recursive_mark(word->xt);
+               break;
+       case QUOTATION_TYPE:
+               quot = (F_QUOTATION *)scan;
+               if(collecting_code && quot->xt != NULL)
+                       recursive_mark(quot->xt);
+               break;
+       case CALLSTACK_TYPE:
+               stack = (F_CALLSTACK *)scan;
+               collect_callstack_object(stack);
+               break;
        }
+
+       return scan + untagged_object_size(scan);
 }
 
-CELL collect_next(CELL scan)
+INLINE void reset_generation(CELL i)
 {
-       CELL size = untagged_object_size(scan);
-       collect_object(scan);
-       return scan + size;
+       F_ZONE *z = &data_heap->generations[i];
+       z->here = z->start;
+       if(secure_gc)
+               memset((void*)z->start,69,z->size);
 }
 
 /* After garbage collection, any generations which are now empty need to have
@@ -475,124 +578,172 @@ their allocation pointers and cards reset. */
 void reset_generations(CELL from, CELL to)
 {
        CELL i;
-
-       for(i = from; i <= to; i++)
-       {
-               F_ZONE *z = &generations[i];
-               z->here = z->base;
-               if(secure_gc)
-                       memset((void*)z->base,69,z->limit - z->base);
-       }
-
+       for(i = from; i <= to; i++) reset_generation(i);
        clear_cards(from,to);
 }
 
 /* Prepare to start copying reachable objects into an unused zone */
-void begin_gc(CELL gen, bool code_gc)
+void begin_gc(CELL requested_bytes)
 {
-       collecting_gen = gen;
-       collecting_gen_start = generations[gen].base;
-       collecting_code = code_gc;
+       if(growing_data_heap)
+       {
+               if(collecting_gen != TENURED)
+                       critical_error("Invalid parameters to begin_gc",0);
 
-       if(gen == TENURED)
+               old_data_heap = data_heap;
+               set_data_heap(grow_data_heap(old_data_heap,requested_bytes));
+               newspace = &data_heap->generations[collecting_gen];
+       }
+       else if(collecting_accumulation_gen_p())
        {
-               /* when collecting the oldest generation, rotate it
+               /* when collecting one of these generations, rotate it
                with the semispace */
-               F_ZONE z = generations[gen];
-               generations[gen] = prior;
-               prior = z;
-               generations[gen].here = generations[gen].base;
-               newspace = &generations[gen];
-               clear_cards(TENURED,TENURED);
+               F_ZONE z = data_heap->generations[collecting_gen];
+               data_heap->generations[collecting_gen] = data_heap->semispaces[collecting_gen];
+               data_heap->semispaces[collecting_gen] = z;
+               reset_generation(collecting_gen);
+               newspace = &data_heap->generations[collecting_gen];
+               clear_cards(collecting_gen,collecting_gen);
        }
        else
        {
                /* when collecting a younger generation, we copy
                reachable objects to the next oldest generation,
                so we set the newspace so the next generation. */
-               newspace = &generations[gen + 1];
+               newspace = &data_heap->generations[collecting_gen + 1];
        }
 }
 
-void end_gc()
+void major_gc_message(void)
+{
+       fprintf(stderr,"*** %s GC (%ld minor, %ld cards)\n",
+               collecting_code ? "Code and data" : "Data",
+               minor_collections,cards_scanned);
+       fflush(stderr);
+       minor_collections = 0;
+       cards_scanned = 0;
+}
+
+void end_gc(void)
 {
-       if(collecting_gen == TENURED)
+       if(growing_data_heap)
+       {
+               dealloc_data_heap(old_data_heap);
+               old_data_heap = NULL;
+               growing_data_heap = false;
+
+               fprintf(stderr,"*** Data heap resized to %lu bytes\n",
+                       data_heap->segment->size);
+       }
+
+       if(collecting_accumulation_gen_p())
        {
-               /* we did a full collection; no more
-               old-to-new pointers remain since everything
-               is in tenured space */
-               unmark_cards(TENURED,TENURED);
-               /* all generations except tenured space are
-               now empty */
-               reset_generations(NURSERY,TENURED - 1);
-
-               fprintf(stderr,"*** %s GC (%ld minor, %ld cards)\n",
-                       collecting_code ? "Code and data" : "Data",
-                       minor_collections,cards_scanned);
-               fflush(stderr);
-               minor_collections = 0;
-               cards_scanned = 0;
+               /* all younger generations except are now empty.
+               if collecting_gen == NURSERY here, we only have 1 generation;
+               old-school Cheney collector */
+               if(collecting_gen != NURSERY)
+                       reset_generations(NURSERY,collecting_gen - 1);
+
+               if(collecting_gen == TENURED)
+                       major_gc_message();
+               else if(HAVE_AGING_P && collecting_gen == AGING)
+                       minor_collections++;
        }
        else
        {
-               /* we collected a younger generation. so the
-               next-oldest generation no longer has any
-               pointers into the younger generation (the
-               younger generation is empty!) */
-               unmark_cards(collecting_gen + 1,collecting_gen + 1);
                /* all generations up to and including the one
                collected are now empty */
                reset_generations(NURSERY,collecting_gen);
 
                minor_collections++;
        }
-       
+
        if(collecting_code)
        {
                /* now that all reachable code blocks have been marked,
                deallocate the rest */
-               free_unmarked(&compiling);
+               free_unmarked(&code_heap);
        }
+
+       collecting_aging_again = false;
 }
 
-/* Collect gen and all younger generations */
-void garbage_collection(CELL gen, bool code_gc)
+/* Collect gen and all younger generations.
+If growing_data_heap_ is true, we must grow the data heap to such a size that
+an allocation of requested_bytes won't fail */
+void garbage_collection(CELL gen,
+       bool code_gc,
+       bool growing_data_heap_,
+       CELL requested_bytes)
 {
-       s64 start = current_millis();
-       CELL scan;
-
        if(gc_off)
+       {
                critical_error("GC disabled",gen);
+               return;
+       }
+
+       s64 start = current_millis();
+
+       performing_gc = true;
+       collecting_code = code_gc;
+       growing_data_heap = growing_data_heap_;
+       collecting_gen = gen;
 
        /* we come back here if a generation is full */
        if(setjmp(gc_jmp))
        {
-               if(gen == TENURED)
+               /* We have no older generations we can try collecting, so we
+               resort to growing the data heap */
+               if(collecting_gen == TENURED)
+               {
+                       growing_data_heap = true;
+
+                       /* see the comment in unmark_marked() */
+                       if(collecting_code)
+                               unmark_marked(&code_heap);
+               }
+               /* we try collecting AGING space twice before going on to
+               collect TENURED */
+               else if(HAVE_AGING_P
+                       && collecting_gen == AGING
+                       && !collecting_aging_again)
                {
-                       /* oops, out of memory */
-                       critical_error("Out of memory in GC",0);
+                       collecting_aging_again = true;
                }
+               /* Collect the next oldest generation */
                else
-                       gen++;
+               {
+                       collecting_gen++;
+               }
        }
 
-       begin_gc(gen,code_gc);
+       begin_gc(requested_bytes);
 
        /* initialize chase pointer */
-       scan = newspace->here;
+       CELL scan = newspace->here;
 
        /* collect objects referenced from stacks and environment */
        collect_roots();
        
        /* collect objects referenced from older generations */
-       collect_cards(gen);
+       collect_cards();
 
-       if(!code_gc)
+       if(!collecting_code)
        {
-               /* if we are doing code GC, then we will copy over literals
-               from any code block which gets marked as live. if we are not
-               doing code GC, just consider all literals as roots. */
-               collect_literals();
+               /* don't scan code heap unless it has pointers to this
+               generation or younger */
+               if(collecting_gen >= last_code_heap_scan)
+               {
+                       /* if we are doing code GC, then we will copy over
+                       literals from any code block which gets marked as live.
+                       if we are not doing code GC, just consider all literals
+                       as roots. */
+                       collect_literals();
+                       if(collecting_accumulation_gen_p())
+                               last_code_heap_scan = collecting_gen;
+                       else
+                               last_code_heap_scan = collecting_gen + 1;
+               }
        }
 
        while(scan < newspace->here)
@@ -601,20 +752,21 @@ void garbage_collection(CELL gen, bool code_gc)
        end_gc();
 
        gc_time += (current_millis() - start);
+       performing_gc = false;
+}
+
+void data_gc(void)
+{
+       garbage_collection(TENURED,false,false,0);
 }
 
-void primitive_data_gc(void)
+DEFINE_PRIMITIVE(data_gc)
 {
-       F_FIXNUM gen = unbox_signed_cell();
-       if(gen <= NURSERY)
-               gen = NURSERY;
-       else if(gen >= TENURED)
-               gen = TENURED;
-       garbage_collection(gen,false);
+       data_gc();
 }
 
 /* Push total time spent on GC */
-void primitive_gc_time(void)
+DEFINE_PRIMITIVE(gc_time)
 {
        box_unsigned_8(gc_time);
 }
@@ -623,3 +775,25 @@ void simple_gc(void)
 {
        maybe_gc(0);
 }
+
+DEFINE_PRIMITIVE(become)
+{
+       F_ARRAY *new_objects = untag_array(dpop());
+       F_ARRAY *old_objects = untag_array(dpop());
+
+       CELL capacity = array_capacity(new_objects);
+       if(capacity != array_capacity(old_objects))
+               critical_error("bad parameters to become",0);
+
+       CELL i;
+       
+       for(i = 0; i < capacity; i++)
+       {
+               CELL old_obj = array_nth(old_objects,i);
+               CELL new_obj = array_nth(new_objects,i);
+
+               forward_object(old_obj,new_obj);
+       }
+
+       data_gc();
+}
index 4b145b15d166f8beb62cf7764aa54ba903cd8653..69b8ff2aa705516c8e5e7720cec789c574041cb3 100644 (file)
@@ -1,13 +1,10 @@
 /* Set by the -S command line argument */
 bool secure_gc;
 
-bool in_page(CELL fault, CELL area, CELL area_size, int offset);
-
-void *safe_malloc(size_t size);
-
 typedef struct {
        CELL start;
        CELL size;
+       CELL end;
 } F_SEGMENT;
 
 /* set up guard pages to check for under/overflow.
@@ -19,14 +16,41 @@ CELL untagged_object_size(CELL pointer);
 CELL unaligned_object_size(CELL pointer);
 CELL object_size(CELL pointer);
 CELL binary_payload_start(CELL pointer);
-void primitive_data_room(void);
-void primitive_size(void);
-void primitive_begin_scan(void);
-void primitive_next_object(void);
-void primitive_end_scan(void);
+void begin_scan(void);
+CELL next_object(void);
+
+DECLARE_PRIMITIVE(data_room);
+DECLARE_PRIMITIVE(size);
+DECLARE_PRIMITIVE(begin_scan);
+DECLARE_PRIMITIVE(next_object);
+DECLARE_PRIMITIVE(end_scan);
+
+/* generational copying GC divides memory into zones */
+typedef struct {
+       /* allocation pointer is 'here'; its offset is hardcoded in the
+       compiler backends, see core/compiler/.../allot.factor */
+       CELL start;
+       CELL here;
+       CELL size;
+       CELL end;
+} F_ZONE;
+
+typedef struct {
+       F_SEGMENT *segment;
+
+       CELL young_size;
+       CELL aging_size;
+
+       CELL gen_count;
+
+       F_ZONE *generations;
+       F_ZONE* semispaces;
+
+       CELL *cards;
+       CELL *cards_end;
+} F_DATA_HEAP;
 
-CELL data_heap_start;
-CELL data_heap_end;
+F_DATA_HEAP *data_heap;
 
 /* card marking write barrier. a card is a byte storing a mark flag,
 and the offset (in cells) of the first object in the card.
@@ -34,44 +58,31 @@ and the offset (in cells) of the first object in the card.
 the mark flag is set by the write barrier when an object in the
 card has a slot written to.
 
-the offset of the first object is set by the allocator.
-*/
-#define CARD_MARK_MASK 0x80
-#define CARD_BASE_MASK 0x7f
-typedef u8 F_CARD;
+the offset of the first object is set by the allocator. */
 
-F_CARD *cards;
-F_CARD *cards_end;
+/* if CARD_POINTS_TO_NURSERY is set, CARD_POINTS_TO_AGING must also be set. */
+#define CARD_POINTS_TO_NURSERY 0x80
+#define CARD_POINTS_TO_AGING 0x40
+#define CARD_MARK_MASK (CARD_POINTS_TO_NURSERY | CARD_POINTS_TO_AGING)
+#define CARD_BASE_MASK 0x3f
+typedef u8 F_CARD;
 
-/* A card is 16 bytes (128 bits), 5 address bits per card.
-it is important that 7 bits is sufficient to represent every
+/* A card is 64 bytes. 6 bits is sufficient to represent every
 offset within the card */
-#define CARD_SIZE 128
-#define CARD_BITS 7
+#define CARD_SIZE 64
+#define CARD_BITS 6
 #define ADDR_CARD_MASK (CARD_SIZE-1)
 
-INLINE F_CARD card_marked(F_CARD c)
-{
-       return c & CARD_MARK_MASK;
-}
-
-INLINE void unmark_card(F_CARD *c)
-{
-       *c &= CARD_BASE_MASK;
-}
-
 INLINE void clear_card(F_CARD *c)
 {
        *c = CARD_BASE_MASK; /* invalid value */
 }
 
-INLINE u8 card_base(F_CARD c)
-{
-       return c & CARD_BASE_MASK;
-}
+DLLEXPORT CELL cards_offset;
+void init_cards_offset(void);
 
-#define ADDR_TO_CARD(a) (F_CARD*)(((CELL)a >> CARD_BITS) + cards_offset)
-#define CARD_TO_ADDR(c) (CELL*)(((CELL)c - cards_offset)<<CARD_BITS)
+#define ADDR_TO_CARD(a) (F_CARD*)(((CELL)(a) >> CARD_BITS) + cards_offset)
+#define CARD_TO_ADDR(c) (CELL*)(((CELL)(c) - cards_offset)<<CARD_BITS)
 
 /* this is an inefficient write barrier. compiled definitions use a more
 efficient one hand-coded in assembly. the write barrier must be called
@@ -80,10 +91,10 @@ to a younger one */
 INLINE void write_barrier(CELL address)
 {
        F_CARD *c = ADDR_TO_CARD(address);
-       *c |= CARD_MARK_MASK;
+       *c |= (CARD_POINTS_TO_NURSERY | CARD_POINTS_TO_AGING);
 }
 
-#define SLOT(obj,slot) ((obj) + (slot) * CELLS)
+#define SLOT(obj,slot) (UNTAG(obj) + (slot) * CELLS)
 
 INLINE void set_slot(CELL obj, CELL slot, CELL value)
 {
@@ -96,47 +107,32 @@ INLINE void allot_barrier(CELL address)
 {
        F_CARD *ptr = ADDR_TO_CARD(address);
        F_CARD c = *ptr;
-       CELL b = card_base(c);
+       CELL b = (c & CARD_BASE_MASK);
        CELL a = (address & ADDR_CARD_MASK);
-       *ptr = (card_marked(c) | ((b < a) ? b : a));
+       *ptr = ((c & CARD_MARK_MASK) | ((b < a) ? b : a));
 }
 
-void unmark_cards(CELL from, CELL to);
 void clear_cards(CELL from, CELL to);
-void collect_cards(CELL gen);
-
-/* generational copying GC divides memory into zones */
-typedef struct {
-       /* start of zone */
-       CELL base;
-       /* allocation pointer */
-       CELL here;
-       /* end of zone */
-       CELL limit;
-} F_ZONE;
-
-/* total number of generations. */
-CELL gen_count;
+void collect_cards(void);
 
 /* the 0th generation is where new objects are allocated. */
 #define NURSERY 0
+#define HAVE_NURSERY_P (data_heap->gen_count>1)
+/* where objects hang around */
+#define AGING (data_heap->gen_count-2)
+#define HAVE_AGING_P (data_heap->gen_count>2)
 /* the oldest generation */
-#define TENURED (gen_count-1)
-
-DLLEXPORT F_ZONE *generations;
+#define TENURED (data_heap->gen_count-1)
 
 /* used during garbage collection only */
 F_ZONE *newspace;
 
-#define tenured generations[TENURED]
-#define nursery generations[NURSERY]
-
-/* spare semi-space; rotates with tenured. */
-F_ZONE prior;
+/* new objects are allocated here */
+DLLEXPORT F_ZONE *nursery;
 
 INLINE bool in_zone(F_ZONE *z, CELL pointer)
 {
-       return pointer >= z->base && pointer < z->limit;
+       return pointer >= z->start && pointer < z->end;
 }
 
 CELL init_zone(F_ZONE *z, CELL size, CELL base);
@@ -152,31 +148,72 @@ CELL minor_collections;
 CELL cards_scanned;
 
 /* only meaningful during a GC */
+bool performing_gc;
 CELL collecting_gen;
-CELL collecting_gen_start;
 bool collecting_code;
 
+/* if true, we collecting AGING space for the second time, so if it is still
+full, we go on to collect TENURED */
+bool collecting_aging_again;
+
+INLINE bool collecting_accumulation_gen_p(void)
+{
+       return ((HAVE_AGING_P
+               && collecting_gen == AGING
+               && !collecting_aging_again)
+               || collecting_gen == TENURED);
+}
+
+/* What generation was being collected when collect_literals() was last
+called? Until the next call to primitive_add_compiled_block(), future
+collections of younger generations don't have to touch the code
+heap. */
+CELL last_code_heap_scan;
+
+/* sometimes we grow the heap */
+bool growing_data_heap;
+F_DATA_HEAP *old_data_heap;
+
+/* Every object has a regular representation in the runtime, which makes GC
+much simpler. Every slot of the object until binary_payload_start is a pointer
+to some other object. */
+INLINE void do_slots(CELL obj, void (* iter)(CELL *))
+{
+       CELL scan = obj;
+       CELL payload_start = binary_payload_start(obj);
+       CELL end = obj + payload_start;
+
+       scan += CELLS;
+
+       while(scan < end)
+       {
+               iter((CELL *)scan);
+               scan += CELLS;
+       }
+}
+
 /* test if the pointer is in generation being collected, or a younger one.
 init_data_heap() arranges things so that the older generations are first,
 so we have to check that the pointer occurs after the beginning of
 the requested generation. */
-#define COLLECTING_GEN(ptr) (collecting_gen_start <= ptr)
-
 INLINE bool should_copy(CELL untagged)
 {
+       if(in_zone(newspace,untagged))
+               return false;
        if(collecting_gen == TENURED)
-               return !in_zone(newspace,untagged);
+               return true;
+       else if(HAVE_AGING_P && collecting_gen == AGING)
+               return !in_zone(&data_heap->generations[TENURED],untagged);
+       else if(HAVE_NURSERY_P && collecting_gen == NURSERY)
+               return in_zone(&data_heap->generations[NURSERY],untagged);
        else
-               return(in_zone(&prior,untagged) || COLLECTING_GEN(untagged));
+       {
+               critical_error("Bug in should_copy",untagged);
+               return false;
+       }
 }
 
-CELL copy_object(CELL pointer);
-#define COPY_OBJECT(lvalue) if(should_copy(lvalue)) lvalue = copy_object(lvalue)
-
-INLINE void copy_handle(CELL *handle)
-{
-       COPY_OBJECT(*handle);
-}
+void copy_handle(CELL *handle);
 
 /* in case a generation fills up in the middle of a gc, we jump back
 up to try collecting the next generation. */
@@ -189,7 +226,10 @@ CELL heap_scan_ptr;
 /* GC is off during heap walking */
 bool gc_off;
 
-void garbage_collection(CELL gen, bool code_gc);
+void garbage_collection(volatile CELL gen,
+       bool code_gc,
+       bool growing_data_heap_,
+       CELL requested_bytes);
 
 /* If a runtime function needs to call another function which potentially
 allocates memory, it must store any local variable references to Factor
@@ -202,20 +242,21 @@ DEFPUSHPOP(root_,extra_roots)
 #define REGISTER_ROOT(obj) root_push(obj)
 #define UNREGISTER_ROOT(obj) obj = root_pop()
 
-#define REGISTER_ARRAY(obj) root_push(tag_object(obj))
-#define UNREGISTER_ARRAY(obj) obj = untag_array_fast(root_pop())
+#define REGISTER_UNTAGGED(obj) root_push(obj ? tag_object(obj) : 0)
+#define UNREGISTER_UNTAGGED(obj) obj = untag_object(root_pop())
 
-#define REGISTER_STRING(obj) root_push(tag_object(obj))
-#define UNREGISTER_STRING(obj) obj = untag_string_fast(root_pop())
+#define REGISTER_STRING(obj) REGISTER_UNTAGGED(obj)
+#define UNREGISTER_STRING(obj) UNREGISTER_UNTAGGED(obj)
 
 /* We ignore strings which point outside the data heap, but we might be given
 a char* which points inside the data heap, in which case it is a root, for
 example if we call unbox_char_string() the result is placed in a byte array */
 INLINE bool root_push_alien(const void *ptr)
 {
-       if((CELL)ptr > data_heap_start && (CELL)ptr < data_heap_end)
+       if((CELL)ptr > data_heap->segment->start
+               && (CELL)ptr < data_heap->segment->end)
        {
-               F_ARRAY *objptr = ((F_ARRAY *)ptr) - 1;
+               F_BYTE_ARRAY *objptr = ((F_BYTE_ARRAY *)ptr) - 1;
                if(objptr->header == tag_header(BYTE_ARRAY_TYPE))
                {
                        root_push(tag_object(objptr));
@@ -232,14 +273,12 @@ INLINE bool root_push_alien(const void *ptr)
        if(obj##_root) obj = alien_offset(root_pop())
 
 #define REGISTER_BIGNUM(obj) if(obj) root_push(tag_bignum(obj))
-#define UNREGISTER_BIGNUM(obj) if(obj) obj = (untag_bignum_fast(root_pop()))
+#define UNREGISTER_BIGNUM(obj) if(obj) obj = (untag_object(root_pop()))
 
 INLINE void *allot_zone(F_ZONE *z, CELL a)
 {
        CELL h = z->here;
        z->here = h + align8(a);
-
-       allot_barrier(h);
        return (void*)h;
 }
 
@@ -250,21 +289,16 @@ registers) does not run out of memory */
 
 INLINE void maybe_gc(CELL a)
 {
-       if(nursery.here + a + ALLOT_BUFFER_ZONE > nursery.limit)
-               garbage_collection(NURSERY,false);
-       if(nursery.here + a + ALLOT_BUFFER_ZONE > nursery.limit)
-       {
-               if(nursery.here + ALLOT_BUFFER_ZONE > nursery.limit)
-                       critical_error("Out of memory in maybe_gc",0);
-               else
-                       memory_error();
-       }
-}
-
-INLINE void *allot(CELL a)
-{
-       maybe_gc(a);
-       return allot_zone(&nursery,a);
+       /* If we are requesting a huge object, grow immediately */
+       if(nursery->size - ALLOT_BUFFER_ZONE <= a)
+               garbage_collection(TENURED,false,true,a);
+       /* If we have enough space in the nursery, just return.
+       Otherwise, perform a GC - this may grow the heap if
+       tenured space cannot hold all live objects from the nursery
+       even after a full GC */
+       else if(a + ALLOT_BUFFER_ZONE + nursery->here > nursery->end)
+               garbage_collection(NURSERY,false,false,0);
+       /* There is now sufficient room in the nursery for 'a' */
 }
 
 /*
@@ -273,13 +307,18 @@ INLINE void *allot(CELL a)
  */
 INLINE void* allot_object(CELL type, CELL length)
 {
-       CELL* object = allot(length);
+       maybe_gc(length);
+       CELL* object = allot_zone(nursery,length);
        *object = tag_header(type);
        return object;
 }
 
-void update_cards_offset(void);
 CELL collect_next(CELL scan);
-void primitive_data_gc(void);
-void primitive_gc_time(void);
+
 DLLEXPORT void simple_gc(void);
+
+void data_gc(void);
+
+DECLARE_PRIMITIVE(data_gc);
+DECLARE_PRIMITIVE(gc_time);
+DECLARE_PRIMITIVE(become);
index 3e5835f32efc446f79992477e66510ac222b5988..b7fb4ff68f2ae9e94057624ba16d88693093b677 100644 (file)
-#include "factor.h"
+#include "master.h"
 
-void print_word(F_WORD* word)
+void print_word(F_WORD* word, CELL nesting)
 {
        if(type_of(word->name) == STRING_TYPE)
-               fprintf(stderr,"%s",to_char_string(untag_string(word->name),true));
+               printf("%s",to_char_string(untag_string(word->name),true));
        else
        {
-               fprintf(stderr,"#<not a string: ");
-               print_obj(word->name);
-               fprintf(stderr,">");
+               printf("#<not a string: ");
+               print_nested_obj(word->name,nesting - 1);
+               printf(">");
        }
-
-       fprintf(stderr," (#%ld)",untag_fixnum_fast(word->primitive));
 }
 
 void print_string(F_STRING* str)
 {
-       fprintf(stderr,"\"%s\"",to_char_string(str,true));
+       printf("\"%s\"",to_char_string(str,true));
 }
 
-void print_array(F_ARRAY* array)
+void print_array(F_ARRAY* array, CELL nesting)
 {
        CELL length = array_capacity(array);
        CELL i;
 
        for(i = 0; i < length; i++)
        {
-               fprintf(stderr," ");
-               print_obj(get(AREF(array,i)));
+               printf(" ");
+               print_nested_obj(array_nth(array,i),nesting - 1);
        }
 }
 
-void print_obj(CELL obj)
+void print_nested_obj(CELL obj, CELL nesting)
 {
+       if(nesting == 0)
+       {
+               printf(" ... ");
+               return;
+       }
+
+       F_QUOTATION *quot;
+
        switch(type_of(obj))
        {
        case FIXNUM_TYPE:
-               fprintf(stderr,"%ld",untag_fixnum_fast(obj));
+               printf("%ld",untag_fixnum_fast(obj));
                break;
        case WORD_TYPE:
-               print_word(untag_word(obj));
+               print_word(untag_word(obj),nesting - 1);
                break;
        case STRING_TYPE:
                print_string(untag_string(obj));
                break;
        case F_TYPE:
-               fprintf(stderr,"f");
+               printf("f");
                break;
        case TUPLE_TYPE:
-               fprintf(stderr,"T{");
-               print_array((F_ARRAY*)UNTAG(obj));
-               fprintf(stderr," }");
+               printf("T{");
+               print_array(untag_object(obj),nesting - 1);
+               printf(" }");
                break;
        case ARRAY_TYPE:
-               fprintf(stderr,"{");
-               print_array((F_ARRAY*)UNTAG(obj));
-               fprintf(stderr," }");
+               printf("{");
+               print_array(untag_object(obj),nesting - 1);
+               printf(" }");
                break;
        case QUOTATION_TYPE:
-               fprintf(stderr,"[");
-               print_array((F_ARRAY*)UNTAG(obj));
-               fprintf(stderr," ]");
+               printf("[");
+               quot = untag_object(obj);
+               print_array(untag_object(quot->array),nesting - 1);
+               printf(" ]");
                break;
        default:
-               fprintf(stderr,"#<type %ld @ %lx>",type_of(obj),obj);
+               printf("#<type %ld @ %lx>",type_of(obj),obj);
                break;
        }
 }
 
+void print_obj(CELL obj)
+{
+       print_nested_obj(obj,10);
+}
+
 void print_objects(CELL start, CELL end)
 {
        for(; start <= end; start += CELLS)
        {
                print_obj(get(start));
-               fprintf(stderr,"\n");
+               printf("\n");
        }
 }
 
+void print_stack_frame(F_STACK_FRAME *frame)
+{
+       print_obj(frame_executing(frame));
+       printf("\n");
+}
+
+void print_callstack(void)
+{
+       CELL bottom = (CELL)stack_chain->callstack_bottom;
+       CELL top = (CELL)stack_chain->callstack_top;
+       CELL base = bottom;
+       iterate_callstack(top,bottom,base,print_stack_frame);
+}
+
 void dump_cell(CELL cell)
 {
-       fprintf(stderr,"%08lx: ",cell);
+       printf("%08lx: ",cell);
 
        cell = get(cell);
 
-       fprintf(stderr,"%08lx tag %ld",cell,TAG(cell));
+       printf("%08lx tag %ld",cell,TAG(cell));
 
        switch(TAG(cell))
        {
@@ -91,23 +117,24 @@ void dump_cell(CELL cell)
        case BIGNUM_TYPE:
        case FLOAT_TYPE:
                if(cell == F)
-                       fprintf(stderr," -- F");
+                       printf(" -- F");
                else if(cell < TYPE_COUNT<<TAG_BITS)
-                       fprintf(stderr," -- header: %ld",cell>>TAG_BITS);
-               else if(cell >= data_heap_start && cell < data_heap_end)
+                       printf(" -- possible header: %ld",cell>>TAG_BITS);
+               else if(cell >= data_heap->segment->start
+                       && cell < data_heap->segment->end)
                {
                        CELL header = get(UNTAG(cell));
                        CELL type = header>>TAG_BITS;
-                       fprintf(stderr," -- object; ");
-                       if(TAG(header) == OBJECT_TYPE && type < TYPE_COUNT)
-                               fprintf(stderr," type %ld",type);
+                       printf(" -- object; ");
+                       if(TAG(header) == 0 && type < TYPE_COUNT)
+                               printf(" type %ld",type);
                        else
-                               fprintf(stderr," header corrupt");
+                               printf(" header corrupt");
                }
                break;
        }
        
-       fprintf(stderr,"\n");
+       printf("\n");
 }
 
 void dump_memory(CELL from, CELL to)
@@ -118,60 +145,59 @@ void dump_memory(CELL from, CELL to)
                dump_cell(from);
 }
 
-void dump_generation(F_ZONE *z)
+void dump_zone(F_ZONE z)
 {
-       fprintf(stderr,"base=%lx, size=%lx, here=%lx\n",
-               z->base,
-               z->limit - z->base,
-               z->here - z->base);
+       printf("start=%lx, size=%lx, end=%lx, here=%lx\n",
+               z.start,z.size,z.end,z.here - z.start);
 }
 
 void dump_generations(void)
 {
        int i;
-       for(i = 0; i < gen_count; i++)
+       for(i = 0; i < data_heap->gen_count; i++)
        {
-               fprintf(stderr,"Generation %d: ",i);
-               dump_generation(&generations[i]);
+               printf("Generation %d: ",i);
+               dump_zone(data_heap->generations[i]);
        }
 
-       fprintf(stderr,"Semispace: ");
-       dump_generation(&prior);
+       for(i = 0; i < data_heap->gen_count; i++)
+       {
+               printf("Semispace %d: ",i);
+               dump_zone(data_heap->semispaces[i]);
+       }
 
-       fprintf(stderr,"Cards: base=%lx, size=%lx\n",(CELL)cards,
-               (CELL)(cards_end - cards));
+       printf("Cards: base=%lx, size=%lx\n",
+               (CELL)data_heap->cards,
+               (CELL)(data_heap->cards_end - data_heap->cards));
 }
 
 void factorbug(void)
 {
        reset_stdio();
 
-       fprintf(stderr,"A fatal error has occurred and Factor cannot continue.\n");
-       fprintf(stderr,"The low-level debugger has been started to help diagnose the problem.\n");
-       fprintf(stderr,"  Basic commands:\n");
-       fprintf(stderr,"t                -- throw exception in Factor\n");
-       fprintf(stderr,"q                -- continue executing Factor\n");
-       fprintf(stderr,"im               -- save image to fep.image\n");
-       fprintf(stderr,"x                -- exit Factor\n");
-       fprintf(stderr,"  Advanced commands:\n");
-       fprintf(stderr,"d <addr> <count> -- dump memory\n");
-       fprintf(stderr,"u <addr>         -- dump object at tagged <addr>\n");
-       fprintf(stderr,". <addr>         -- print object at tagged <addr>\n");
-       fprintf(stderr,"s r c            -- dump data, retain, call stacks\n");
-       fprintf(stderr,".s .r .c         -- print data, retain, call stacks\n");
-       fprintf(stderr,"i                -- dump interpreter state\n");
-       fprintf(stderr,"e                -- dump environment\n");
-       fprintf(stderr,"g                -- dump generations\n");
-       fprintf(stderr,"card <addr>      -- print card containing address\n");
-       fprintf(stderr,"addr <card>      -- print address containing card\n");
-       fprintf(stderr,"code             -- code heap dump\n");
+       printf("Starting low level debugger...\n");
+       printf("  Basic commands:\n");
+       printf("q                -- continue executing Factor - NOT SAFE\n");
+       printf("im               -- save image to fep.image\n");
+       printf("x                -- exit Factor\n");
+       printf("  Advanced commands:\n");
+       printf("d <addr> <count> -- dump memory\n");
+       printf("u <addr>         -- dump object at tagged <addr>\n");
+       printf(". <addr>         -- print object at tagged <addr>\n");
+       printf("s r              -- dump data, retain stacks\n");
+       printf(".s .r .c         -- print data, retain, call stacks\n");
+       printf("e                -- dump environment\n");
+       printf("g                -- dump generations\n");
+       printf("card <addr>      -- print card containing address\n");
+       printf("addr <card>      -- print address containing card\n");
+       printf("code             -- code heap dump\n");
        
        for(;;)
        {
                char cmd[1024];
 
-               fprintf(stderr,"READY\n");
-               fflush(stderr);
+               printf("READY\n");
+               fflush(stdout);
 
                if(scanf("%1000s",cmd) <= 0)
                        exit(1);
@@ -194,26 +220,18 @@ void factorbug(void)
                        CELL addr;
                        scanf("%lx",&addr);
                        print_obj(addr);
-                       fprintf(stderr,"\n");
+                       printf("\n");
                }
                else if(strcmp(cmd,"s") == 0)
                        dump_memory(ds_bot,ds);
                else if(strcmp(cmd,"r") == 0)
                        dump_memory(rs_bot,rs);
-               else if(strcmp(cmd,"c") == 0)
-                       dump_memory(cs_bot,cs);
                else if(strcmp(cmd,".s") == 0)
                        print_objects(ds_bot,ds);
                else if(strcmp(cmd,".r") == 0)
                        print_objects(rs_bot,rs);
                else if(strcmp(cmd,".c") == 0)
-                       print_objects(cs_bot,cs);
-               else if(strcmp(cmd,"i") == 0)
-               {
-                       fprintf(stderr,"Call frame:\n");
-                       print_obj(callframe);
-                       fprintf(stderr,"\n");
-               }
+                       print_callstack();
                else if(strcmp(cmd,"e") == 0)
                {
                        int i;
@@ -226,25 +244,30 @@ void factorbug(void)
                {
                        CELL addr;
                        scanf("%lx",&addr);
-                       fprintf(stderr,"%lx\n",(CELL)ADDR_TO_CARD(addr));
+                       printf("%lx\n",(CELL)ADDR_TO_CARD(addr));
                }
                else if(strcmp(cmd,"addr") == 0)
                {
                        CELL card;
                        scanf("%lx",&card);
-                       fprintf(stderr,"%lx\n",(CELL)CARD_TO_ADDR(card));
+                       printf("%lx\n",(CELL)CARD_TO_ADDR(card));
                }
-               else if(strcmp(cmd,"t") == 0)
-                       simple_error(ERROR_USER_INTERRUPT,F,F);
                else if(strcmp(cmd,"q") == 0)
                        return;
                else if(strcmp(cmd,"x") == 0)
                        exit(1);
                else if(strcmp(cmd,"im") == 0)
-                       save_image("fep.image");
+                       save_image(STR_FORMAT("fep.image"));
                else if(strcmp(cmd,"code") == 0)
-                       dump_heap(&compiling);
+                       dump_heap(&code_heap);
                else
-                       fprintf(stderr,"unknown command\n");
+                       printf("unknown command\n");
        }
 }
+
+DEFINE_PRIMITIVE(die)
+{
+       fprintf(stderr,"The die word was called by the library. Unless you called it yourself,\n");
+       fprintf(stderr,"you have triggered a bug in Factor. Please report.\n");
+       factorbug();
+}
index 6ce56265cf677ea704c2bd81c7a53c998c4f0e27..cfd928bb51f23ac0cd8e72fd58210d6177169960 100644 (file)
@@ -1,3 +1,6 @@
 void print_obj(CELL obj);
+void print_nested_obj(CELL obj, CELL nesting);
 void dump_generations(void);
 void factorbug(void);
+
+DECLARE_PRIMITIVE(die);
index 6a7474dc8f6bd119f96bf4fba98c1ede13c34769..e74662a8a42aed54ae93fec144d6e73d31e6c590 100644 (file)
@@ -1,36 +1,74 @@
-#include "factor.h"
+#include "master.h"
+
+void default_parameters(F_PARAMETERS *p)
+{
+       p->image = NULL;
+       p->ds_size = 128;
+       p->rs_size = 128;
+
+       /* We make a wild guess here that if we're running on ARM, we don't
+       have a lot of memory. */
+#ifdef FACTOR_ARM
+       p->gen_count = 2;
+       p->code_size = 2 * CELLS;
+#else
+       p->gen_count = 3;
+       p->code_size = 4 * CELLS;
+#endif
+
+       p->young_size = 2 * CELLS;
+       p->aging_size = 4 * CELLS;
+       p->secure_gc = false;
+}
 
 /* Get things started */
-void init_factor(const char* image,
-       CELL ds_size, CELL rs_size, CELL cs_size,
-       CELL gen_count, CELL young_size, CELL aging_size,
-       CELL code_size,
-       bool secure_gc)
+void init_factor(F_PARAMETERS *p)
 {
+       /* Kilobytes */
+       p->ds_size = align_page(p->ds_size << 10);
+       p->rs_size = align_page(p->rs_size << 10);
+
+       /* Megabytes */
+       p->young_size <<= 20;
+       p->aging_size <<= 20;
+       p->code_size <<= 20;
+
+       /* Disable GC during init as a sanity check */
+       gc_off = true;
+
+       profiling = false;
+
+       early_init();
+
+       if(p->image == NULL)
+               p->image = default_image_path();
+
        srand(current_millis());
        init_ffi();
-       init_data_heap(gen_count,young_size,aging_size,secure_gc);
-       init_code_heap(code_size);
-       init_stacks(ds_size,rs_size,cs_size);
-       /* callframe must be valid in case load_image() does GC */
-       callframe = F;
-       callframe_scan = callframe_end = 0;
-       thrown_error = F;
-       load_image(image);
-       call(userenv[BOOT_ENV]);
+       init_stacks(p->ds_size,p->rs_size);
+       load_image(p);
        init_c_io();
        init_signals();
+
+       stack_chain = NULL;
+
        userenv[CPU_ENV] = tag_object(from_char_string(FACTOR_CPU_STRING));
        userenv[OS_ENV] = tag_object(from_char_string(FACTOR_OS_STRING));
-       userenv[GEN_ENV] = tag_fixnum(gen_count);
-       userenv[IMAGE_ENV] = tag_object(from_char_string(image));
        userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(CELL));
+
+       performing_gc = false;
+       last_code_heap_scan = NURSERY;
+       collecting_aging_again = false;
+       stack_chain = NULL;
+
+       /* We can GC now */
+       gc_off = false;
 }
 
-INLINE bool factor_arg(const char* str, const char* arg, CELL* value)
+INLINE bool factor_arg(const F_CHAR* str, const F_CHAR* arg, CELL* value)
 {
        int val;
-       if(sscanf(str,arg,&val))
+       if(SSCANF(str,arg,&val) > 0)
        {
                *value = val;
                return true;
@@ -39,70 +77,90 @@ INLINE bool factor_arg(const char* str, const char* arg, CELL* value)
                return false;
 }
 
-int main(int argc, char** argv)
+void init_factor_from_args(F_CHAR *image, int argc, F_CHAR **argv, bool embedded)
 {
-       const char *image = NULL;
-       CELL ds_size = 128;
-       CELL rs_size = 128;
-       CELL cs_size = 128;
-       CELL generations = 2;
-       CELL young_size = 4 * CELLS;
-       CELL aging_size = 8 * CELLS;
-       CELL code_size = CELLS;
-       F_ARRAY *args;
-       CELL arg_count;
+       F_PARAMETERS p;
+       default_parameters(&p);
+
+       if(image) p.image = image;
+
        CELL i;
-       bool image_given = true;
-       bool secure_gc = false;
 
-       early_init();
+       posix_argc = argc;
+       posix_argv = safe_malloc(argc * sizeof(F_CHAR*));
+       posix_argv[0] = safe_strdup(argv[0]);
 
        for(i = 1; i < argc; i++)
        {
-               if(factor_arg(argv[i],"-D=%d",&ds_size)) continue;
-               if(factor_arg(argv[i],"-R=%d",&rs_size)) continue;
-               if(factor_arg(argv[i],"-C=%d",&cs_size)) continue;
-               if(factor_arg(argv[i],"-G=%d",&generations)) continue;
-               if(factor_arg(argv[i],"-Y=%d",&young_size)) continue;
-               if(factor_arg(argv[i],"-A=%d",&aging_size)) continue;
-               if(factor_arg(argv[i],"-X=%d",&code_size)) continue;
-               if(strcmp(argv[i],"-S") == 0) { secure_gc = true; continue; }
-
-               if(strncmp(argv[i],"-",1) != 0 && image == NULL)
-                       image = argv[1];
+               posix_argv[i] = safe_strdup(argv[i]);
+               if(factor_arg(argv[i],STR_FORMAT("-datastack=%d"),&p.ds_size));
+               else if(factor_arg(argv[i],STR_FORMAT("-retainstack=%d"),&p.rs_size));
+               else if(factor_arg(argv[i],STR_FORMAT("-generations=%d"),&p.gen_count));
+               else if(factor_arg(argv[i],STR_FORMAT("-young=%d"),&p.young_size));
+               else if(factor_arg(argv[i],STR_FORMAT("-aging=%d"),&p.aging_size));
+               else if(factor_arg(argv[i],STR_FORMAT("-codeheap=%d"),&p.code_size));
+               else if(STRCMP(argv[i],STR_FORMAT("-securegc")) == 0)
+                       p.secure_gc = true;
+               else if(STRNCMP(argv[i],STR_FORMAT("-i="),3) == 0)
+                       p.image = argv[i] + 3;
        }
 
-       if(image == NULL)
+       init_factor(&p);
+
+       F_ARRAY *args = allot_array(ARRAY_TYPE,argc,F);
+
+       for(i = 1; i < argc; i++)
        {
-               image_given = false;
-               image = default_image_path();
+               REGISTER_UNTAGGED(args);
+               CELL arg = tag_object(from_native_string(argv[i]));
+               UNREGISTER_UNTAGGED(args);
+               set_array_nth(args,i,arg);
        }
 
-       init_factor(image,
-               ds_size * 1024,
-               rs_size * 1024,
-               cs_size * 1024,
-               generations,
-               young_size * 1024 * 1024,
-               aging_size * 1024 * 1024,
-               code_size * 1024 * 1024,
-               secure_gc);
+       userenv[ARGS_ENV] = tag_object(args);
 
-       arg_count = (image_given ? 2 : 1);
+       const F_CHAR *executable_path = vm_executable_path();
+       if(!executable_path)
+               executable_path = argv[0];
 
-       args = allot_array(ARRAY_TYPE,argc,F);
+       userenv[EXECUTABLE_ENV] = tag_object(from_native_string(executable_path));
+       userenv[EMBEDDED_ENV] = (embedded ? T : F);
 
-       for(i = arg_count; i < argc; i++)
+       if(!untag_quotation(userenv[BOOT_ENV])->xt)
        {
-               REGISTER_ARRAY(args);
-               CELL arg = tag_object(from_char_string(argv[i]));
-               UNREGISTER_ARRAY(args);
-               set_array_nth(args,i,arg);
+               /* This can only happen when we're starting a stage2 bootstrap.
+               The stage1 bootstrapper doesn't attempt to compile quotations,
+               so we do it here. */
+               jit_compile_all();
        }
 
-       userenv[ARGS_ENV] = tag_object(args);
+       nest_stacks();
+       c_to_factor_toplevel(userenv[BOOT_ENV]);
+       unnest_stacks();
+
+       for(i = 0; i < argc; i++)
+               free(posix_argv[i]);
+}
 
-       run_toplevel();
+char *factor_eval_string(char *string)
+{
+       char* (*callback)(char*) = alien_offset(userenv[EVAL_CALLBACK_ENV]);
+       return callback(string);
+}
+
+void factor_eval_free(char *result)
+{
+       free(result);
+}
 
-       return 0;
+void factor_yield(void)
+{
+       void (*callback)() = alien_offset(userenv[YIELD_CALLBACK_ENV]);
+       callback();
+}
+
+void factor_sleep(long ms)
+{
+       void (*callback)() = alien_offset(userenv[SLEEP_CALLBACK_ENV]);
+       callback(ms);
 }
index 2277827499f4355777f3f4e6260fdfb8cd781b62..a0632c3138e3140cf7e8c46faa2bb53c98561cc7 100644 (file)
@@ -1,34 +1,8 @@
-#ifndef __FACTOR_H__
-#define __FACTOR_H__
+int posix_argc;
+F_CHAR **posix_argv;
 
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <math.h>
-#include <stdbool.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <sys/param.h>
-
-#include "layouts.h"
-#include "platform.h"
-#include "debug.h"
-#include "run.h"
-#include "bignumint.h"
-#include "bignum.h"
-#include "data_gc.h"
-#include "types.h"
-#include "math.h"
-#include "io.h"
-#include "code_gc.h"
-#include "compiler.h"
-#include "image.h"
-#include "primitives.h"
-#include "stack.h"
-#include "alien.h"
-
-#endif /* __FACTOR_H__ */
+DLLEXPORT void init_factor_from_args(F_CHAR *image, int argc, F_CHAR **argv, bool embedded);
+DLLEXPORT char *factor_eval_string(char *string);
+DLLEXPORT void factor_eval_free(char *result);
+DLLEXPORT void factor_yield(void);
+DLLEXPORT void factor_sleep(long ms);
diff --git a/vm/factor.rs b/vm/factor.rs
new file mode 100644 (file)
index 0000000..ffe83d0
--- /dev/null
@@ -0,0 +1,2 @@
+fraptor ICON "misc/icons/FRaptorMix.ico"\r
+\r
index 8e87b8fb6c2f0816006b9834859c997fbf90efc3..3892af9787e08c94c9a8e3f6699cff6ec8590a28 100644 (file)
@@ -1,7 +1,7 @@
 /* This file is linked into the runtime for the sole purpose
  * of testing FFI code. */
 #include <stdio.h>
-#include "factor.h"
+#include "master.h"
 #include "ffi_test.h"
 
 void ffi_test_0(void)
@@ -90,6 +90,7 @@ int ffi_test_13(int a, int b, int c, int d, int e, int f, int g, int h, int i, i
 struct foo ffi_test_14(int x, int y)
 {
        struct foo r;
+       printf("ffi_test_14(%d,%d)\n",x,y);
        r.x = x; r.y = y;
        return r;
 }
@@ -101,3 +102,124 @@ char *ffi_test_15(char *x, char *y)
        else
                return "bar";
 }
+
+struct bar ffi_test_16(long x, long y, long z)
+{
+       struct bar r;
+       r.x = x; r.y = y; r.z = z;
+       return r;
+}
+
+struct tiny ffi_test_17(int x)
+{
+       struct tiny r;
+       r.x = x;
+       return r;
+}
+
+F_STDCALL int ffi_test_18(int x, int y, int z, int t)
+{
+       printf("ffi_test_18(%d,%d,%d,%d)\n",x,y,z,t);
+       return x + y + z * t;
+}
+
+F_STDCALL struct bar ffi_test_19(long x, long y, long z)
+{
+       struct bar r;
+       r.x = x; r.y = y; r.z = z;
+       return r;
+}
+
+void ffi_test_20(double x1, double x2, double x3,
+       double y1, double y2, double y3,
+       double z1, double z2, double z3)
+{
+       printf("ffi_test_20(%f,%f,%f,%f,%f,%f,%f,%f,%f)\n",
+               x1, x2, x3, y1, y2, y3, z1, z2, z3);
+}
+
+long long ffi_test_21(long x, long y)
+{
+       return (long long)x * (long long)y;
+}
+
+long ffi_test_22(long x, long long y, long long z)
+{
+       printf("ffi_test_22(%ld,%lld,%lld)\n",x,y,z);
+       return x + y / z;
+}
+
+float ffi_test_23(float x[3], float y[3])
+{
+       return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
+}
+
+DLLEXPORT struct test_struct_1 ffi_test_24(void)
+{
+       struct test_struct_1 s;
+       s.x = 1;
+       return s;
+}
+
+DLLEXPORT struct test_struct_2 ffi_test_25(void)
+{
+       struct test_struct_2 s;
+       s.x = 1;
+       s.y = 2;
+       return s;
+}
+
+DLLEXPORT struct test_struct_3 ffi_test_26(void)
+{
+       struct test_struct_3 s;
+       s.x = 1;
+       s.y = 2;
+       s.z = 3;
+       return s;
+}
+
+DLLEXPORT struct test_struct_4 ffi_test_27(void)
+{
+       struct test_struct_4 s;
+       s.x = 1;
+       s.y = 2;
+       s.z = 3;
+       s.a = 4;
+       return s;
+}
+
+DLLEXPORT struct test_struct_5 ffi_test_28(void)
+{
+       struct test_struct_5 s;
+       s.x = 1;
+       s.y = 2;
+       s.z = 3;
+       s.a = 4;
+       s.b = 5;
+       return s;
+}
+
+DLLEXPORT struct test_struct_6 ffi_test_29(void)
+{
+       struct test_struct_6 s;
+       s.x = 1;
+       s.y = 2;
+       s.z = 3;
+       s.a = 4;
+       s.b = 5;
+       s.c = 6;
+       return s;
+}
+
+DLLEXPORT struct test_struct_7 ffi_test_30(void)
+{
+       struct test_struct_7 s;
+       s.x = 1;
+       s.y = 2;
+       s.z = 3;
+       s.a = 4;
+       s.b = 5;
+       s.c = 6;
+       s.d = 7;
+       return s;
+}
index 8991664526fe672a1721829dbcd5613ab034ed1f..da1acd09e0a54ee86993baa4efc8636b8ebab096 100644 (file)
@@ -1,3 +1,9 @@
+#if defined(FACTOR_X86)
+       #define F_STDCALL __attribute__((stdcall))
+#else
+       #define F_STDCALL
+#endif
+
 DLLEXPORT void ffi_test_0(void);
 DLLEXPORT int ffi_test_1(void);
 DLLEXPORT int ffi_test_2(int x, int y);
@@ -16,3 +22,29 @@ DLLEXPORT int ffi_test_12(int a, int b, struct rect c, int d, int e, int f);
 DLLEXPORT 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);
 DLLEXPORT struct foo ffi_test_14(int x, int y);
 DLLEXPORT char *ffi_test_15(char *x, char *y);
+struct bar { long x, y, z; };
+DLLEXPORT struct bar ffi_test_16(long x, long y, long z);
+struct tiny { int x; };
+DLLEXPORT struct tiny ffi_test_17(int x);
+DLLEXPORT F_STDCALL int ffi_test_18(int x, int y, int z, int t);
+DLLEXPORT F_STDCALL struct bar ffi_test_19(long x, long y, long z);
+DLLEXPORT void ffi_test_20(double x1, double x2, double x3,
+       double y1, double y2, double y3,
+       double z1, double z2, double z3);
+DLLEXPORT long long ffi_test_21(long x, long y);
+DLLEXPORT long ffi_test_22(long x, long long y, long long z);
+DLLEXPORT float ffi_test_23(float x[3], float y[3]);
+struct test_struct_1 { char x; };
+DLLEXPORT struct test_struct_1 ffi_test_24(void);
+struct test_struct_2 { char x, y; };
+DLLEXPORT struct test_struct_2 ffi_test_25(void);
+struct test_struct_3 { char x, y, z; };
+DLLEXPORT struct test_struct_3 ffi_test_26(void);
+struct test_struct_4 { char x, y, z, a; };
+DLLEXPORT struct test_struct_4 ffi_test_27(void);
+struct test_struct_5 { char x, y, z, a, b; };
+DLLEXPORT struct test_struct_5 ffi_test_28(void);
+struct test_struct_6 { char x, y, z, a, b, c; };
+DLLEXPORT struct test_struct_6 ffi_test_29(void);
+struct test_struct_7 { char x, y, z, a, b, c, d; };
+DLLEXPORT struct test_struct_7 ffi_test_30(void);
diff --git a/vm/float_bits.h b/vm/float_bits.h
new file mode 100644 (file)
index 0000000..a60d42f
--- /dev/null
@@ -0,0 +1,40 @@
+/* Some functions for converting floating point numbers to binary
+representations and vice versa */
+
+typedef union {
+    double x;
+    u64 y;
+} F_DOUBLE_BITS;
+
+INLINE u64 double_bits(double x)
+{
+       F_DOUBLE_BITS b;
+       b.x = x;
+       return b.y;
+}
+
+INLINE double bits_double(u64 y)
+{
+       F_DOUBLE_BITS b;
+       b.y = y;
+       return b.x;
+}
+
+typedef union {
+    float x;
+    u32 y;
+} F_FLOAT_BITS;
+
+INLINE u32 float_bits(float x)
+{
+       F_FLOAT_BITS b;
+       b.x = x;
+       return b.y;
+}
+
+INLINE float bits_float(u32 y)
+{
+       F_FLOAT_BITS b;
+       b.y = y;
+       return b.x;
+}
index 7d3256fb2df8f0b54acfbf3475fa17c70a3f68e5..0d1b22adee92a49f0633454a37a18db208ab050c 100644 (file)
@@ -1,66 +1,74 @@
-#include "factor.h"
+#include "master.h"
 
 /* Certain special objects in the image are known to the runtime */
 void init_objects(F_HEADER *h)
 {
-       int i;
-       for(i = 0; i < USER_ENV; i++)
-               userenv[i] = F;
-       userenv[GLOBAL_ENV] = h->global;
-       userenv[BOOT_ENV] = h->boot;
+       memcpy(userenv,h->userenv,sizeof(userenv));
+
        T = h->t;
        bignum_zero = h->bignum_zero;
        bignum_pos_one = h->bignum_pos_one;
        bignum_neg_one = h->bignum_neg_one;
 }
 
-/* Read an image file from disk, only done once during startup */
-void load_image(const char* filename)
+INLINE void load_data_heap(FILE *file, F_HEADER *h, F_PARAMETERS *p)
 {
-       FILE* file;
-       F_HEADER h;
+       CELL good_size = h->data_size + (1 << 20);
+
+       if(good_size > p->aging_size)
+               p->aging_size = good_size;
+
+       init_data_heap(p->gen_count,p->young_size,p->aging_size,p->secure_gc);
+
+       F_ZONE *tenured = &data_heap->generations[TENURED];
+
+       if(fread((void*)tenured->start,h->data_size,1,file) != 1)
+               fatal_error("load_data_heap failed",0);
 
-       file = fopen(filename,"rb");
+       tenured->here = tenured->start + h->data_size;
+       data_relocation_base = h->data_relocation_base;
+}
+
+INLINE void load_code_heap(FILE *file, F_HEADER *h, F_PARAMETERS *p)
+{
+       CELL good_size = h->code_size + (1 << 19);
+
+       if(good_size > p->code_size)
+               p->code_size = good_size;
+
+       init_code_heap(p->code_size);
+
+       if(h->code_size != 0
+               && fread(first_block(&code_heap),h->code_size,1,file) != 1)
+               fatal_error("load_code_heap failed",0);
+
+       code_relocation_base = h->code_relocation_base;
+       build_free_list(&code_heap,h->code_size);
+}
+
+/* Read an image file from disk, only done once during startup */
+/* This function also initializes the data and code heaps */
+void load_image(F_PARAMETERS *p)
+{
+       FILE *file = OPEN_READ(p->image);
        if(file == NULL)
        {
-               fprintf(stderr,"Cannot open image file: %s\n",filename);
+               FPRINTF(stderr,"Cannot open image file: %s\n",p->image);
                fprintf(stderr,"%s\n",strerror(errno));
                exit(1);
        }
 
-       /* read it in native byte order */
-       fread(&h,sizeof(F_HEADER)/sizeof(CELL),sizeof(CELL),file);
+       F_HEADER h;
+       fread(&h,sizeof(F_HEADER),1,file);
 
        if(h.magic != IMAGE_MAGIC)
-               fatal_error("Bad magic number",h.magic);
+               fatal_error("Bad image: magic number check failed",h.magic);
 
        if(h.version != IMAGE_VERSION)
-               fatal_error("Bad version number",h.version);
+               fatal_error("Bad image: version number check failed",h.version);
        
-       /* read data heap */
-       {
-               CELL size = h.data_size;
-               if(size + tenured.base >= tenured.limit)
-                       fatal_error("Data heap too large",h.code_size);
-
-               fread((void*)tenured.base,size,1,file);
-
-               tenured.here = tenured.base + h.data_size;
-               data_relocation_base = h.data_relocation_base;
-       }
-
-       /* read code heap */
-       {
-               CELL size = h.code_size;
-               if(size + compiling.base > compiling.limit)
-                       fatal_error("Code heap too large",h.code_size);
-
-               fread((void*)compiling.base,size,1,file);
-
-               code_relocation_base = h.code_relocation_base;
-
-               build_free_list(&compiling,size);
-       }
+       load_data_heap(file,&h,p);
+       load_code_heap(file,&h,p);
 
        fclose(file);
 
@@ -68,80 +76,154 @@ void load_image(const char* filename)
 
        relocate_data();
        relocate_code();
+
+       /* Store image path name */
+       userenv[IMAGE_ENV] = tag_object(from_native_string(p->image));
+}
+
+/* Compute total sum of sizes of free blocks */
+void save_code_heap(FILE *file)
+{
+       F_BLOCK *scan = first_block(&code_heap);
+
+       while(scan)
+       {
+               if(scan->status == B_ALLOCATED)
+                       fwrite(scan,scan->size,1,file);
+               scan = next_block(&code_heap,scan);
+       }
 }
 
 /* Save the current image to disk */
-bool save_image(const char* filename)
+bool save_image(const F_CHAR *filename)
 {
        FILE* file;
        F_HEADER h;
 
-       fprintf(stderr,"Saving %s...\n",filename);
+       FPRINTF(stderr,"*** Saving %s...\n",filename);
 
-       file = fopen(filename,"wb");
+       file = OPEN_WRITE(filename);
        if(file == NULL)
                fatal_error("Cannot open image for writing",errno);
 
+       F_ZONE *tenured = &data_heap->generations[TENURED];
+
        h.magic = IMAGE_MAGIC;
        h.version = IMAGE_VERSION;
-       h.data_relocation_base = tenured.base;
-       h.boot = userenv[BOOT_ENV];
-       h.data_size = tenured.here - tenured.base;
-       h.global = userenv[GLOBAL_ENV];
+       h.data_relocation_base = tenured->start;
+       h.data_size = tenured->here - tenured->start;
+       h.code_relocation_base = code_heap.segment->start;
+       h.code_size = heap_size(&code_heap);
+
        h.t = T;
        h.bignum_zero = bignum_zero;
        h.bignum_pos_one = bignum_pos_one;
        h.bignum_neg_one = bignum_neg_one;
-       
-       h.code_size = heap_size(&compiling);
-       h.code_relocation_base = compiling.base;
+
+       CELL i;
+       for(i = 0; i < USER_ENV; i++)
+       {
+               if(i < FIRST_SAVE_ENV)
+                       h.userenv[i] = F;
+               else
+                       h.userenv[i] = userenv[i];
+       }
+
        fwrite(&h,sizeof(F_HEADER),1,file);
 
-       fwrite((void*)tenured.base,h.data_size,1,file);
-       fwrite((void*)compiling.base,h.code_size,1,file);
+       fwrite((void*)tenured->start,h.data_size,1,file);
+       /* save_code_heap(file); */
+       fwrite(first_block(&code_heap),h.code_size,1,file);
 
        fclose(file);
 
        return true;
 }
 
-void primitive_save_image(void)
+DEFINE_PRIMITIVE(save_image)
 {
-       F_STRING* filename;
        /* do a full GC to push everything into tenured space */
-       garbage_collection(TENURED,true);
-       filename = untag_string(dpop());
-       save_image(to_char_string(filename,true));
+       code_gc();
+
+       save_image(unbox_native_string());
 }
 
-/* Initialize an object in a newly-loaded image */
-void relocate_object(CELL relocating)
+DEFINE_PRIMITIVE(save_image_and_exit)
+{
+       /* strip out userenv data which is set on startup anyway */
+       CELL i;
+       for(i = 0; i < FIRST_SAVE_ENV; i++)
+               userenv[i] = F;
+
+       /* do a full GC + code heap compaction */
+       compact_code_heap();
+
+       save_image(unbox_native_string());
+
+       /* now exit; we cannot continue executing like this */
+       exit(0);
+}
+
+void fixup_word(F_WORD *word)
 {
-       CELL scan = relocating;
-       CELL payload_start = binary_payload_start(scan);
-       CELL end = scan + payload_start;
+       /* If this is a compiled word, relocate the code pointer. Otherwise,
+       reset it based on the primitive number of the word. */
+       if(word->compiledp != F)
+               code_fixup(&word->xt);
+       else
+               update_xt(word);
+}
+
+void fixup_quotation(F_QUOTATION *quot)
+{
+       /* quot->xt is only ever NULL at the start of stage2 bootstrap,
+       in this case the JIT compiles all quotations */
+       if(quot->xt)
+               code_fixup(&quot->xt);
+}
+
+void fixup_alien(F_ALIEN *d)
+{
+       d->expired = T;
+}
 
-       scan += CELLS;
+void fixup_stack_frame(F_STACK_FRAME *frame)
+{
+       code_fixup(&frame->xt);
 
-       while(scan < end)
+       if(frame_type(frame) == QUOTATION_TYPE)
        {
-               data_fixup((CELL*)scan);
-               scan += CELLS;
+               CELL scan = frame->scan - frame->array;
+               data_fixup(&frame->array);
+               frame->scan = scan + frame->array;
        }
 
+       /* code_fixup(&frame->return_address); */
+}
+
+/* Initialize an object in a newly-loaded image */
+void relocate_object(CELL relocating)
+{
+       do_slots(relocating,data_fixup);
+
        switch(untag_header(get(relocating)))
        {
        case WORD_TYPE:
-               fixup_word((F_WORD*)relocating);
+               fixup_word((F_WORD *)relocating);
                break;
-       case STRING_TYPE:
-               rehash_string((F_STRING*)relocating);
+       case QUOTATION_TYPE:
+               fixup_quotation((F_QUOTATION *)relocating);
                break;
        case DLL_TYPE:
-               ffi_dlopen((F_DLL*)relocating,false);
+               ffi_dlopen((F_DLL *)relocating,false);
                break;
        case ALIEN_TYPE:
-               fixup_alien((F_ALIEN*)relocating);
+               fixup_alien((F_ALIEN *)relocating);
+               break;
+       case CALLSTACK_TYPE:
+               iterate_callstack_object(
+                       (F_CALLSTACK *)relocating,
+                       fixup_stack_frame);
                break;
        }
 }
@@ -152,15 +234,19 @@ void relocate_data()
 {
        CELL relocating;
 
-       data_fixup(&userenv[BOOT_ENV]);
-       data_fixup(&userenv[GLOBAL_ENV]);
+       CELL i;
+       for(i = 0; i < USER_ENV; i++)
+               data_fixup(&userenv[i]);
+
        data_fixup(&T);
        data_fixup(&bignum_zero);
        data_fixup(&bignum_pos_one);
        data_fixup(&bignum_neg_one);
 
-       for(relocating = tenured.base;
-               relocating < tenured.here;
+       F_ZONE *tenured = &data_heap->generations[TENURED];
+
+       for(relocating = tenured->start;
+               relocating < tenured->here;
                relocating += untagged_object_size(relocating))
        {
                allot_barrier(relocating);
@@ -169,25 +255,25 @@ void relocate_data()
 }
 
 void fixup_code_block(F_COMPILED *relocating, CELL code_start,
-       CELL reloc_start, CELL literal_start, CELL words_start, CELL words_end)
+       CELL reloc_start, CELL literals_start, CELL words_start, CELL words_end)
 {
        /* relocate literal table data */
        CELL scan;
-       CELL literal_end = literal_start + relocating->literal_length;
+       CELL literal_end = literals_start + relocating->literals_length;
 
-       for(scan = literal_start; scan < literal_end; scan += CELLS)
+       for(scan = literals_start; scan < literal_end; scan += CELLS)
                data_fixup((CELL*)scan);
 
        for(scan = words_start; scan < words_end; scan += CELLS)
        {
                if(relocating->finalized)
-                       code_fixup((CELL*)scan);
+                       code_fixup((XT*)scan);
                else
                        data_fixup((CELL*)scan);
        }
 
        relocate_code_block(relocating,code_start,reloc_start,
-               literal_start,words_start,words_end);
+               literals_start,words_start,words_end);
 }
 
 void relocate_code()
index b4366864b2330ade9cac9d55b507ab2efbf00cd1..a15f850bb3a732dad694fd8abbc7baa82519991a 100644 (file)
@@ -1,5 +1,5 @@
 #define IMAGE_MAGIC 0x0f0e0d0c
-#define IMAGE_VERSION 2
+#define IMAGE_VERSION 4
 
 typedef struct {
        CELL magic;
@@ -7,10 +7,12 @@ typedef struct {
        /* all pointers in the image file are relocated from
           relocation_base to here when the image is loaded */
        CELL data_relocation_base;
-       /* tagged pointer to bootstrap quotation */
-       CELL boot;
-       /* tagged pointer to global namespace */
-       CELL global;
+       /* size of heap */
+       CELL data_size;
+       /* code relocation base */
+       CELL code_relocation_base;
+       /* size of code heap */
+       CELL code_size;
        /* tagged pointer to t singleton */
        CELL t;
        /* tagged pointer to bignum 0 */
@@ -19,33 +21,44 @@ typedef struct {
        CELL bignum_pos_one;
        /* tagged pointer to bignum -1 */
        CELL bignum_neg_one;
-       /* size of heap */
-       CELL data_size;
-       /* size of code heap */
-       CELL code_size;
-       /* code relocation base */
-       CELL code_relocation_base;
+       /* Initial user environment */
+       CELL userenv[USER_ENV];
 } F_HEADER;
 
+typedef struct {
+       const F_CHAR* image;
+       CELL ds_size, rs_size;
+       CELL gen_count, young_size, aging_size;
+       CELL code_size;
+       bool secure_gc;
+} F_PARAMETERS;
+
+void load_image(F_PARAMETERS *p);
 void init_objects(F_HEADER *h);
-void load_image(const char* file);
-bool save_image(const char* file);
-void primitive_save_image(void);
+bool save_image(const F_CHAR *file);
+
+DECLARE_PRIMITIVE(save_image);
+DECLARE_PRIMITIVE(save_image_and_exit);
 
 /* relocation base of currently loaded image's data heap */
 CELL data_relocation_base;
 
 INLINE void data_fixup(CELL *cell)
 {
-       if(TAG(*cell) != FIXNUM_TYPE && *cell != F)
-               *cell += (tenured.base - data_relocation_base);
+       if(immediate_p(*cell))
+               return;
+
+       F_ZONE *tenured = &data_heap->generations[TENURED];
+       *cell += (tenured->start - data_relocation_base);
 }
 
 CELL code_relocation_base;
 
-INLINE void code_fixup(CELL *cell)
+INLINE void code_fixup(XT *cell)
 {
-       *cell += (compiling.base - code_relocation_base);
+       CELL value = (CELL)*cell;
+       value += (code_heap.segment->start - code_relocation_base);
+       *cell = (XT)value;
 }
 
 void relocate_data();
diff --git a/vm/io.c b/vm/io.c
index fca66a0a8c40ef80ae263deec8fbbb6ca4d295da..f6cc62736c0cf7f5a875d3f1ca1868d16659144f 100644 (file)
--- a/vm/io.c
+++ b/vm/io.c
@@ -1,16 +1,15 @@
-#include "factor.h"
-
-/* This function is used by FFI I/O. Accessing the errno global directly is
-not portable, since on some libc's errno is not a global but a funky macro that
-reads thread-local storage. */
-int err_no(void)
-{
-       return errno;
-}
+#include "master.h"
 
 /* Simple wrappers for ANSI C I/O functions, used for bootstrapping.
+
+Note the ugly loop logic in almost every function; we have to handle EINTR
+and restart the operation if the system call was interrupted. Naive
+applications don't do this, but then they quickly fail if one enables
+itimer()s or other signals.
+
 The Factor library provides platform-specific code for Unix and Windows
-with many more capabilities. */
+with many more capabilities so these words are not usually used in
+normal operation. */
 
 void init_c_io(void)
 {
@@ -20,51 +19,150 @@ void init_c_io(void)
 
 void io_error(void)
 {
+       if(errno == EINTR)
+               return;
+
        CELL error = tag_object(from_char_string(strerror(errno)));
-       simple_error(ERROR_IO,error,F);
+       general_error(ERROR_IO,error,F,NULL);
 }
 
-void primitive_fopen(void)
+DEFINE_PRIMITIVE(fopen)
 {
        char *mode = unbox_char_string();
        REGISTER_C_STRING(mode);
        char *path = unbox_char_string();
        UNREGISTER_C_STRING(mode);
-       FILE *file = fopen(path,mode);
-       if(file == NULL)
-               io_error();
-       box_alien(file);
+
+       for(;;)
+       {
+               FILE *file = fopen(path,mode);
+               if(file == NULL)
+                       io_error();
+               else
+               {
+                       box_alien(file);
+                       break;
+               }
+       }
 }
 
-void primitive_fgetc(void)
+DEFINE_PRIMITIVE(fgetc)
 {
        FILE* file = unbox_alien();
-       int c = fgetc(file);
-       if(c == EOF)
-               dpush(F);
-       else
-               dpush(tag_fixnum(c));
+
+       for(;;)
+       {
+               int c = fgetc(file);
+               if(c == EOF)
+               {
+                       if(feof(file))
+                       {
+                               dpush(F);
+                               break;
+                       }
+                       else
+                               io_error();
+               }
+               else
+               {
+                       dpush(tag_fixnum(c));
+                       break;
+               }
+       }
 }
 
-void primitive_fwrite(void)
+DEFINE_PRIMITIVE(fread)
+{
+       FILE* file = unbox_alien();
+       CELL size = unbox_array_size();
+
+       if(size == 0)
+       {
+               dpush(tag_object(allot_string(0,0)));
+               return;
+       }
+
+       F_BYTE_ARRAY *buf = allot_byte_array(size);
+
+       for(;;)
+       {
+               int c = fread(buf + 1,1,size,file);
+               if(c <= 0)
+               {
+                       if(feof(file))
+                       {
+                               dpush(F);
+                               break;
+                       }
+                       else
+                               io_error();
+               }
+               else
+               {
+                       dpush(tag_object(memory_to_char_string(
+                               (char *)(buf + 1),c)));
+                       break;
+               }
+       }
+}
+
+DEFINE_PRIMITIVE(fwrite)
 {
        FILE* file = unbox_alien();
        F_STRING* text = untag_string(dpop());
        F_FIXNUM length = untag_fixnum_fast(text->length);
+       char* string = to_char_string(text,false);
 
        if(string_capacity(text) == 0)
                return;
 
-       if(!fwrite(to_char_string(text,false),1,length,file))
-               io_error();
+       for(;;)
+       {
+               size_t written = fwrite(string,1,length,file);
+               if(written == length)
+                       break;
+               else
+               {
+                       if(feof(file))
+                               break;
+                       else
+                               io_error();
+
+                       /* Still here? EINTR */
+                       length -= written;
+                       string += written;
+               }
+       }
 }
 
-void primitive_fflush(void)
+DEFINE_PRIMITIVE(fflush)
 {
-       fflush(unbox_alien());
+       FILE *file = unbox_alien();
+       for(;;)
+       {
+               if(fflush(file) == EOF)
+                       io_error();
+               else
+                       break;
+       }
 }
 
-void primitive_fclose(void)
+DEFINE_PRIMITIVE(fclose)
 {
-       fclose(unbox_alien());
+       FILE *file = unbox_alien();
+       for(;;)
+       {
+               if(fclose(file) == EOF)
+                       io_error();
+               else
+                       break;
+       }
+}
+
+/* This function is used by FFI I/O. Accessing the errno global directly is
+not portable, since on some libc's errno is not a global but a funky macro that
+reads thread-local storage. */
+int err_no(void)
+{
+       return errno;
 }
diff --git a/vm/io.h b/vm/io.h
index a0a69a4efcc06b1f9267c8bd5f4e98cf70301253..d8cc2a057814f5a9883cc3e1532cef92bfbd15b8 100644 (file)
--- a/vm/io.h
+++ b/vm/io.h
@@ -1,8 +1,17 @@
-int err_no(void);
 void init_c_io(void);
 void io_error(void);
-void primitive_fopen(void);
-void primitive_fwrite(void);
-void primitive_fflush(void);
-void primitive_fclose(void);
-void primitive_fgetc(void);
+int err_no(void);
+
+DECLARE_PRIMITIVE(fopen);
+DECLARE_PRIMITIVE(fwrite);
+DECLARE_PRIMITIVE(fflush);
+DECLARE_PRIMITIVE(fclose);
+DECLARE_PRIMITIVE(fgetc);
+DECLARE_PRIMITIVE(fread);
+
+/* Platform specific primitives */
+DECLARE_PRIMITIVE(open_file);
+DECLARE_PRIMITIVE(stat);
+DECLARE_PRIMITIVE(read_dir);
+DECLARE_PRIMITIVE(cwd);
+DECLARE_PRIMITIVE(cd);
diff --git a/vm/jit.c b/vm/jit.c
new file mode 100644 (file)
index 0000000..7cdd645
--- /dev/null
+++ b/vm/jit.c
@@ -0,0 +1,186 @@
+#include "master.h"
+
+bool jit_fast_if_p(F_ARRAY *array, CELL i)
+{
+       return (i + 3) <= array_capacity(array)
+               && type_of(array_nth(array,i)) == QUOTATION_TYPE
+               && type_of(array_nth(array,i + 1)) == QUOTATION_TYPE
+               && array_nth(array,i + 2) == userenv[JIT_IF_WORD];
+}
+
+bool jit_fast_dispatch_p(F_ARRAY *array, CELL i)
+{
+       return (i + 2) == array_capacity(array)
+               && array_nth(array,i + 1) == userenv[JIT_DISPATCH_WORD];
+}
+
+#define EMIT(name) { \
+               REGISTER_UNTAGGED(array); \
+               GROWABLE_APPEND(result,untag_object(userenv[name])); \
+               UNREGISTER_UNTAGGED(array); \
+       }
+
+bool jit_stack_frame_p(F_ARRAY *array)
+{
+       F_FIXNUM length = array_capacity(array);
+       F_FIXNUM i;
+
+       for(i = 0; i < length - 1; i++)
+       {
+               if(type_of(array_nth(array,i)) == WORD_TYPE)
+                       return true;
+       }
+
+       return false;
+}
+
+void jit_compile(F_QUOTATION *quot)
+{
+       F_ARRAY *array = untag_object(quot->array);
+
+       REGISTER_UNTAGGED(quot);
+
+       REGISTER_UNTAGGED(array);
+       GROWABLE_ARRAY(result);
+       UNREGISTER_UNTAGGED(array);
+
+       bool stack_frame = jit_stack_frame_p(array);
+
+       EMIT(JIT_SETUP);
+
+       if(stack_frame)
+               EMIT(JIT_PROLOG);
+
+       CELL i;
+       CELL length = array_capacity(array);
+       bool tail_call = false;
+
+       for(i = 0; i < length; i++)
+       {
+               CELL obj = array_nth(array,i);
+               F_WORD *word;
+               bool primitive_p;
+
+               switch(type_of(obj))
+               {
+               case WORD_TYPE:
+                       /* Emit the epilog before the primitive call gate
+                       so that we save the C stack pointer minus the
+                       current stack frame. */
+                       word = untag_object(obj);
+                       primitive_p = type_of(word->def) == FIXNUM_TYPE;
+
+                       if(i == length - 1)
+                       {
+                               if(stack_frame)
+                                       EMIT(JIT_EPILOG);
+
+                               if(primitive_p)
+                                       EMIT(JIT_WORD_PRIMITIVE_JUMP);
+
+                               EMIT(JIT_WORD_JUMP);
+                               tail_call = true;
+                       }
+                       else
+                       {
+                               if(primitive_p)
+                                       EMIT(JIT_WORD_PRIMITIVE_CALL);
+
+                               EMIT(JIT_WORD_CALL);
+                       }
+                       break;
+               case WRAPPER_TYPE:
+                       EMIT(JIT_PUSH_WRAPPER);
+                       break;
+               case QUOTATION_TYPE:
+                       if(jit_fast_if_p(array,i))
+                       {
+                               i += 2;
+
+                               if(i == length - 1)
+                               {
+                                       if(stack_frame)
+                                               EMIT(JIT_EPILOG);
+                                       EMIT(JIT_IF_JUMP);
+                                       tail_call = true;
+                               }
+                               else
+                                       EMIT(JIT_IF_CALL);
+
+                               break;
+                       }
+               case ARRAY_TYPE:
+                       if(jit_fast_dispatch_p(array,i))
+                       {
+                               i++;
+
+                               if(stack_frame)
+                                       EMIT(JIT_EPILOG);
+
+                               EMIT(JIT_DISPATCH);
+
+                               tail_call = true;
+                               break;
+                       }
+               default:
+                       EMIT(JIT_PUSH_LITERAL);
+                       break;
+               }
+       }
+
+       if(!tail_call)
+       {
+               if(stack_frame)
+                       EMIT(JIT_EPILOG);
+
+               EMIT(JIT_RETURN);
+       }
+
+       GROWABLE_TRIM(result);
+
+       UNREGISTER_UNTAGGED(quot);
+       REGISTER_UNTAGGED(quot);
+
+       REGISTER_UNTAGGED(result);
+       F_ARRAY *literals = allot_array(ARRAY_TYPE,1,tag_object(quot));
+       UNREGISTER_UNTAGGED(result);
+
+       XT xt = add_compiled_block(QUOTATION_TYPE,result,NULL,NULL,NULL,literals);
+       iterate_code_heap_step(xt_to_compiled(xt),finalize_code_block);
+
+       UNREGISTER_UNTAGGED(quot);
+       quot->xt = xt;
+}
+
+void jit_compile_all(void)
+{
+       begin_scan();
+
+       CELL obj;
+       while((obj = next_object()) != F)
+       {
+               if(type_of(obj) == QUOTATION_TYPE)
+                       jit_compile(untag_quotation(obj));
+       }
+
+       /* End the scan */
+       gc_off = false;
+}
+
+XT quot_offset_to_pc(F_QUOTATION *quot, F_FIXNUM offset)
+{
+       if(offset != -1)
+               critical_error("Not yet implemented",0);
+
+       CELL xt = 0;
+
+       xt += array_capacity(untag_array(userenv[JIT_SETUP]));
+
+       bool stack_frame = jit_stack_frame_p(untag_array(quot->array));
+       if(stack_frame)
+               xt += array_capacity(untag_array(userenv[JIT_PROLOG]));
+
+       xt *= compiled_code_format();
+
+       return quot->xt + xt;
+}
diff --git a/vm/jit.h b/vm/jit.h
new file mode 100644 (file)
index 0000000..1758a24
--- /dev/null
+++ b/vm/jit.h
@@ -0,0 +1,3 @@
+void jit_compile(F_QUOTATION *quot);
+void jit_compile_all(void);
+XT quot_offset_to_pc(F_QUOTATION *quot, F_FIXNUM offset);
index 28fa5a7c82c9f32136375153a4eebd72b217e565..b924f61a811063fd2f02f72a44cfa72b12d38998 100644 (file)
@@ -1,3 +1,5 @@
+#define INLINE inline static
+
 typedef unsigned char u8;
 typedef unsigned short u16;
 typedef unsigned int u32;
@@ -27,29 +29,29 @@ typedef signed long long s64;
 #define TAG_MASK 7
 #define TAG_BITS 3
 #define TAG(cell) ((CELL)(cell) & TAG_MASK)
-#define RETAG(cell,tag) ((CELL)(cell) | (tag))
 #define UNTAG(cell) ((CELL)(cell) & ~TAG_MASK)
+#define RETAG(cell,tag) (UNTAG(cell) | (tag))
 
 /*** Tags ***/
 #define FIXNUM_TYPE 0
 #define BIGNUM_TYPE 1
-#define WORD_TYPE 2
+#define TUPLE_TYPE 2
 #define OBJECT_TYPE 3
 #define RATIO_TYPE 4
 #define FLOAT_TYPE 5
 #define COMPLEX_TYPE 6
-#define WRAPPER_TYPE 7
+
+/* Canonical F object */
+#define F_TYPE 7
+#define F F_TYPE
 
 #define HEADER_TYPE 7 /* anything less than or equal to this is a tag */
-#define GC_COLLECTED 0 /* See gc.c */
+
+#define GC_COLLECTED 5 /* See gc.c */
 
 /*** Header types ***/
 #define ARRAY_TYPE 8
-
-/* Canonical F object */
-#define F_TYPE 9
-#define F RETAG(0,OBJECT_TYPE)
-
+#define WRAPPER_TYPE 9
 #define HASHTABLE_TYPE 10
 #define VECTOR_TYPE 11
 #define STRING_TYPE 12
@@ -57,17 +59,51 @@ typedef signed long long s64;
 #define QUOTATION_TYPE 14
 #define DLL_TYPE 15
 #define ALIEN_TYPE 16
-#define TUPLE_TYPE 17
+#define WORD_TYPE 17
 #define BYTE_ARRAY_TYPE 18
+#define BIT_ARRAY_TYPE 19
+#define FLOAT_ARRAY_TYPE 20
+#define CURRY_TYPE 21
+#define CALLSTACK_TYPE 22
+
+#define TYPE_COUNT 23
+
+INLINE bool immediate_p(CELL obj)
+{
+       return (TAG(obj) == FIXNUM_TYPE || obj == F);
+}
 
-#define TYPE_COUNT 19
+INLINE F_FIXNUM untag_fixnum_fast(CELL tagged)
+{
+       return ((F_FIXNUM)tagged) >> TAG_BITS;
+}
 
+INLINE CELL tag_fixnum(F_FIXNUM untagged)
+{
+       return RETAG(untagged << TAG_BITS,FIXNUM_TYPE);
+}
+
+INLINE void *untag_object(CELL tagged)
+{
+       return (void *)UNTAG(tagged);
+}
+
+typedef void (*XT)(CELL arg);
+
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        CELL header;
        /* tagged */
        CELL capacity;
 } F_ARRAY;
 
+typedef F_ARRAY F_BYTE_ARRAY;
+
+typedef F_ARRAY F_BIT_ARRAY;
+
+typedef F_ARRAY F_FLOAT_ARRAY;
+
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        /* always tag_header(VECTOR_TYPE) */
        CELL header;
@@ -77,6 +113,7 @@ typedef struct {
        CELL array;
 } F_VECTOR;
 
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        CELL header;
        /* tagged num of chars */
@@ -85,6 +122,7 @@ typedef struct {
        CELL hashcode;
 } F_STRING;
 
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        /* always tag_header(SBUF_TYPE) */
        CELL header;
@@ -94,6 +132,7 @@ typedef struct {
        CELL string;
 } F_SBUF;
 
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        /* always tag_header(HASHTABLE_TYPE) */
        CELL header;
@@ -105,11 +144,7 @@ typedef struct {
        CELL array;
 } F_HASHTABLE;
 
-/* When a word is executed we jump to the value of the XT field. However this
-value is an unportable function pointer. Interpreted and primitive words will
-have their XT set to a value in the 'primitives' global (see primitives.c).
-Compiled words are marked as such and their XT, which point inside the code
-heap, are instead relocated on startup, and also considered a code GC root. */
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        /* TAGGED header */
        CELL header;
@@ -119,29 +154,32 @@ typedef struct {
        CELL name;
        /* TAGGED word vocabulary */
        CELL vocabulary;
-       /* TAGGED on-disk primitive number */
-       CELL primitive;
-       /* TAGGED parameter to xt; used for colon definitions */
+       /* TAGGED definition */
        CELL def;
-       /* TAGGED property hash for library code */
+       /* TAGGED property assoc for library code */
        CELL props;
        /* TAGGED t or f, depending on if the word is compiled or not */
        CELL compiledp;
+       /* TAGGED call count for profiling */
+       CELL counter;
        /* UNTAGGED execution token: jump here to execute word */
-       CELL xt;
+       XT xt;
 } F_WORD;
 
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        CELL header;
        CELL object;
 } F_WRAPPER;
 
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        CELL header;
        CELL numerator;
        CELL denominator;
 } F_RATIO;
 
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
 /* C sucks. */
        union {
@@ -151,20 +189,31 @@ typedef struct {
        double n;
 } F_FLOAT;
 
+/* Assembly code makes assumptions about the layout of this struct */
+typedef struct {
+       CELL header;
+       /* tagged */
+       CELL array;
+       /* untagged */
+       XT xt;
+} F_QUOTATION;
+
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        CELL header;
        CELL real;
        CELL imaginary;
 } F_COMPLEX;
 
+/* Assembly code makes assumptions about the layout of this struct */
 typedef struct {
        CELL header;
        /* tagged */
        CELL alien;
+       /* tagged */
+       CELL expired;
        /* untagged */
        CELL displacement;
-       /* untagged */
-       bool expired;
 } F_ALIEN;
 
 typedef struct {
@@ -174,3 +223,19 @@ typedef struct {
        /* OS-specific handle */
        void* dll;
 } F_DLL;
+
+typedef struct {
+       CELL header;
+       /* tagged */
+       CELL obj;
+       /* tagged */
+       CELL quot;
+} F_CURRY;
+
+typedef struct {
+       CELL header;
+       /* tagged */
+       CELL length;
+       /* untagged */
+       CELL bottom;
+} F_CALLSTACK;
index 80efd0e7cc0dad50f2df854f88340713a80090c8..d373037b82f7ba99600f35694ccb2062fca86ed1 100644 (file)
 /* Fault handler information.  MacOSX version.
 Copyright (C) 1993-1999, 2002-2003  Bruno Haible <clisp.org at bruno>
 Copyright (C) 2003  Paolo Bonzini <gnu.org at bonzini>
-Various modifications to support Intel Macs by Slava Pestov
 
 Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
-2005-03-10
+2005-03-10:
 
-see http://www.caddr.com/macho/archives/sbcl-devel/2005-3/4764.html */
+http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
 
-#include "factor.h"
+Extensively modified for Factor - portions copyright (C) 2004-2007 Slava Pestov */
 
-/* The following sources were used as a *reference* for this exception handling
-   code:
-      1. Apple's mach/xnu documentation
-      2. Timothy J. Wood's "Mach Exception Handlers 101" post to the
-         omnigroup's macosx-dev list.
-         www.omnigroup.com/mailman/archive/macosx-dev/2000-June/002030.html */
-
-/* The exception port on which our thread listens.  */
-static mach_port_t our_exception_port;
-
-/* Handlers that are called in the faulting thread. */
-static void
-memory_protection_handler (void *fault_addr)
-{
-  memory_protection_error((CELL)fault_addr,SIGSEGV,native_stack_pointer());
-  abort ();
-}
+#include "master.h"
 
-static void
-arithmetic_handler (void *ignore)
+/* The following sources were used as a *reference* for this exception handling
+code:
+1. Apple's mach/xnu documentation
+2. Timothy J. Wood's "Mach Exception Handlers 101" post to the
+omnigroup's macosx-dev list.
+http://www.wodeveloper.com/omniLists/macosx-dev/2000/June/msg00137.html */
+
+/* Modify a suspended thread's thread_state so that when the thread resumes
+executing, the call frame of the current C primitive (if any) is rewound, and
+the appropriate Factor error is thrown from the top-most Factor frame. */
+static void call_fault_handler(exception_type_t exception,
+       MACH_EXC_STATE_TYPE *exc_state,
+       MACH_THREAD_STATE_TYPE *thread_state)
 {
-  signal_error(SIGFPE,native_stack_pointer());
-  abort ();
+       /* 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 = (void *)MACH_STACK_POINTER(thread_state);
+       /* Are we in C? Then use the saved callstack top */
+       else
+               signal_callstack_top = NULL;
+
+       /* Now we point the program counter at the right handler function. */
+       if(exception == EXC_BAD_ACCESS)
+       {
+               signal_fault_addr = MACH_EXC_STATE_FAULT(exc_state);
+               MACH_PROGRAM_COUNTER(thread_state) = (CELL)memory_signal_handler_impl;
+       }
+       else
+       {
+               if(exception == EXC_ARITHMETIC)
+                       signal_number = SIGFPE;
+               else
+                       signal_number = SIGABRT;
+               MACH_PROGRAM_COUNTER(thread_state) = (CELL)misc_signal_handler_impl;
+       }
 }
 
 /* Handle an exception by invoking the user's fault handler and/or forwarding
-   the duty to the previously installed handlers.  */
+the duty to the previously installed handlers.  */
 kern_return_t
 catch_exception_raise (mach_port_t exception_port,
-                       mach_port_t thread,
-                       mach_port_t task,
-                       exception_type_t exception,
-                       exception_data_t code,
-                       mach_msg_type_number_t code_count)
+       mach_port_t thread,
+       mach_port_t task,
+       exception_type_t exception,
+       exception_data_t code,
+       mach_msg_type_number_t code_count)
 {
-  SIGSEGV_EXC_STATE_TYPE exc_state;
-  SIGSEGV_THREAD_STATE_TYPE thread_state;
-  mach_msg_type_number_t state_count;
-  unsigned long sp;
-
-  /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_get_state.html.  */
-  state_count = SIGSEGV_EXC_STATE_COUNT;
-  if (thread_get_state (thread, SIGSEGV_EXC_STATE_FLAVOR,
-                        (void *) &exc_state, &state_count)
-      != KERN_SUCCESS)
-    {
-      /* The thread is supposed to be suspended while the exception handler
-         is called. This shouldn't fail. */
-      return KERN_FAILURE;
-    }
-
-  state_count = SIGSEGV_THREAD_STATE_COUNT;
-  if (thread_get_state (thread, SIGSEGV_THREAD_STATE_FLAVOR,
-                        (void *) &thread_state, &state_count)
-      != KERN_SUCCESS)
-    {
-      /* The thread is supposed to be suspended while the exception handler
-         is called. This shouldn't fail. */
-      return KERN_FAILURE;
-    }
-
-  sp = (unsigned long) (SIGSEGV_STACK_POINTER (thread_state));
-
-  void *handler;
-
-  if(exception == EXC_BAD_ACCESS)
-    handler = memory_protection_handler;
-  else if(exception == EXC_ARITHMETIC)
-    handler = arithmetic_handler;
-  else
-    abort();
-
-  SIGSEGV_PROGRAM_COUNTER (thread_state) = (unsigned long) handler;
-  SIGSEGV_STACK_POINTER (thread_state) = fix_stack_ptr(sp);
-  pass_arg0(&thread_state,SIGSEGV_EXC_STATE_FAULT(exc_state));
-
-  /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_set_state.html.  */
-  if (thread_set_state (thread, SIGSEGV_THREAD_STATE_FLAVOR,
-                        (void *) &thread_state, state_count)
-      != KERN_SUCCESS)
-    {
-      return KERN_FAILURE;
-    }
-  return KERN_SUCCESS;
+       MACH_EXC_STATE_TYPE exc_state;
+       MACH_THREAD_STATE_TYPE thread_state;
+       mach_msg_type_number_t state_count;
+
+       /* 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.  */
+       state_count = MACH_EXC_STATE_COUNT;
+       if (thread_get_state (thread, MACH_EXC_STATE_FLAVOR,
+               (void *) &exc_state, &state_count)
+               != KERN_SUCCESS)
+       {
+               /* The thread is supposed to be suspended while the exception
+               handler is called. This shouldn't fail. */
+               return KERN_FAILURE;
+       }
+
+       state_count = MACH_THREAD_STATE_COUNT;
+       if (thread_get_state (thread, MACH_THREAD_STATE_FLAVOR,
+               (void *) &thread_state, &state_count)
+               != KERN_SUCCESS)
+       {
+               /* The thread is supposed to be suspended while the exception
+               handler is called. This shouldn't fail. */
+               return KERN_FAILURE;
+       }
+
+       /* Modify registers so to have the thread resume executing the
+       fault handler */
+       call_fault_handler(exception,&exc_state,&thread_state);
+
+       /* Set the faulting thread's register contents..
+       
+       See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_set_state.html.  */
+       if (thread_set_state (thread, MACH_THREAD_STATE_FLAVOR,
+               (void *) &thread_state, state_count)
+               != KERN_SUCCESS)
+       {
+               return KERN_FAILURE;
+       }
+
+       return KERN_SUCCESS;
 }
 
 
@@ -101,98 +112,94 @@ catch_exception_raise (mach_port_t exception_port,
 static void *
 mach_exception_thread (void *arg)
 {
-  for (;;)
-    {
-      /* These two structures contain some private kernel data. We don't need
-         to access any of it so we don't bother defining a proper struct. The
-         correct definitions are in the xnu source code. */
-      /* Buffer for a message to be received.  */
-      struct
-        {
-          mach_msg_header_t head;
-          mach_msg_body_t msgh_body;
-          char data[1024];
-        }
-        msg;
-      /* Buffer for a reply message.  */
-      struct
-        {
-          mach_msg_header_t head;
-          char data[1024];
-        }
-        reply;
-
-      mach_msg_return_t retval;
-
-      /* Wait for a message on the exception port.  */
-      retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0,
-                         sizeof (msg), our_exception_port,
-                         MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-      if (retval != MACH_MSG_SUCCESS)
-        {
-          abort ();
-        }
-
-      /* Handle the message: Call exc_server, which will call
-         catch_exception_raise and produce a reply message.  */
-      exc_server (&msg.head, &reply.head);
-
-      /* Send the reply.  */
-      if (mach_msg (&reply.head, MACH_SEND_MSG, reply.head.msgh_size,
-                    0, MACH_PORT_NULL,
-                    MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL)
-          != MACH_MSG_SUCCESS)
-        {
-          abort ();
-        }
-    }
+       for (;;)
+       {
+               /* These two structures contain some private kernel data. We don't need
+               to access any of it so we don't bother defining a proper struct. The
+               correct definitions are in the xnu source code. */
+               /* Buffer for a message to be received.  */
+               struct
+               {
+                       mach_msg_header_t head;
+                       mach_msg_body_t msgh_body;
+                       char data[1024];
+               }
+               msg;
+               /* Buffer for a reply message.  */
+               struct
+               {
+                       mach_msg_header_t head;
+                       char data[1024];
+               }
+               reply;
+
+               mach_msg_return_t retval;
+
+               /* Wait for a message on the exception port.  */
+               retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0,
+                       sizeof (msg), our_exception_port,
+                       MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+               if (retval != MACH_MSG_SUCCESS)
+               {
+                       abort ();
+               }
+
+               /* Handle the message: Call exc_server, which will call
+               catch_exception_raise and produce a reply message.  */
+               exc_server (&msg.head, &reply.head);
+
+               /* Send the reply.  */
+               if (mach_msg (&reply.head, MACH_SEND_MSG, reply.head.msgh_size,
+                       0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL)
+                       != MACH_MSG_SUCCESS)
+               {
+                       abort ();
+               }
+       }
 }
 
 
-/* Initialize the Mach exception handler thread.
-   Return 0 if OK, -1 on error.  */
-int mach_initialize ()
+/* Initialize the Mach exception handler thread. */
+void mach_initialize (void)
 {
-  mach_port_t self;
-  exception_mask_t mask;
-  pthread_attr_t attr;
-  pthread_t thread;
-
-  self = mach_task_self ();
-
-  /* Allocate a port on which the thread shall listen for exceptions.  */
-  if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
-      != KERN_SUCCESS)
-    return -1;
-
-  /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
-  if (mach_port_insert_right (self, our_exception_port, our_exception_port,
-                              MACH_MSG_TYPE_MAKE_SEND)
-      != KERN_SUCCESS)
-    return -1;
-
-  /* The exceptions we want to catch. */
-  mask = EXC_MASK_BAD_ACCESS | EXC_MASK_ARITHMETIC;
-
-  /* Create the thread listening on the exception port.  */
-  if (pthread_attr_init (&attr) != 0)
-    return -1;
-  if (pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) != 0)
-    return -1;
-  if (pthread_create (&thread, &attr, mach_exception_thread, NULL) != 0)
-    return -1;
-  pthread_attr_destroy (&attr);
-
-  /* Replace the exception port info for these exceptions with our own.
-     Note that we replace the exception port for the entire task, not only
-     for a particular thread.  This has the effect that when our exception
-     port gets the message, the thread specific exception port has already
-     been asked, and we don't need to bother about it.
-     See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
-  if (task_set_exception_ports (self, mask, our_exception_port,
-                                EXCEPTION_DEFAULT, MACHINE_THREAD_STATE)
-      != KERN_SUCCESS)
-    return -1;
-
-  return 0;
+       mach_port_t self;
+       exception_mask_t mask;
+       pthread_attr_t attr;
+       pthread_t thread;
+
+       self = mach_task_self ();
+
+       /* Allocate a port on which the thread shall listen for exceptions.  */
+       if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
+               != KERN_SUCCESS)
+               fatal_error("mach_port_allocate() failed",0);
+
+       /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
+       if (mach_port_insert_right (self, our_exception_port, our_exception_port,
+               MACH_MSG_TYPE_MAKE_SEND)
+               != KERN_SUCCESS)
+               fatal_error("mach_port_insert_right() failed",0);
+
+       /* The exceptions we want to catch. */
+       mask = EXC_MASK_BAD_ACCESS | EXC_MASK_ARITHMETIC;
+
+       /* Create the thread listening on the exception port.  */
+       if (pthread_attr_init (&attr) != 0)
+               fatal_error("pthread_attr_init() failed",0);
+       if (pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) != 0)
+               fatal_error("pthread_attr_setdetachstate() failed",0);
+       if (pthread_create (&thread, &attr, mach_exception_thread, NULL) != 0)
+               fatal_error("pthread_create() failed",0);
+       pthread_attr_destroy (&attr);
+
+       /* Replace the exception port info for these exceptions with our own.
+       Note that we replace the exception port for the entire task, not only
+       for a particular thread.  This has the effect that when our exception
+       port gets the message, the thread specific exception port has already
+       been asked, and we don't need to bother about it.
+       See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
+       if (task_set_exception_ports (self, mask, our_exception_port,
+               EXCEPTION_DEFAULT, MACHINE_THREAD_STATE)
+               != KERN_SUCCESS)
+               fatal_error("task_set_exception_ports() failed",0);
 }
index 0dbcc09f33ca49520e17614c29cd65ac3f45122b..ca46a4c32c591f2032847cbc86b780b125e95485 100644 (file)
 #include <mach/task.h>
 #include <pthread.h>
 
-/* For MacOSX.  */
-#ifndef SS_DISABLE
-#define SS_DISABLE SA_DISABLE
-#endif
+/* The exception port on which our thread listens. */
+mach_port_t our_exception_port;
 
 /* This is not defined in any header, although documented.  */
 
@@ -69,4 +67,4 @@ catch_exception_raise_state_identity (mach_port_t exception_port,
                                       thread_state_t out_state,
                                       mach_msg_type_number_t *out_state_count);
 
-int mach_initialize ();
+void mach_initialize (void);
diff --git a/vm/main-unix.c b/vm/main-unix.c
new file mode 100644 (file)
index 0000000..5af454e
--- /dev/null
@@ -0,0 +1,7 @@
+#include "master.h"
+
+int main(int argc, char **argv)
+{
+       init_factor_from_args(NULL,argc,argv,false);
+       return 0;
+}
diff --git a/vm/main-windows-ce.c b/vm/main-windows-ce.c
new file mode 100644 (file)
index 0000000..e67f08a
--- /dev/null
@@ -0,0 +1,134 @@
+#include <windows.h>
+#include <stdio.h>
+#include "master.h"
+
+/* 
+       Windows CE argument parsing ported to work on
+       int main(int argc, wchar_t **argv).
+
+       This would not be necessary if Windows CE had CommandLineToArgvW.
+
+       Based on MinGW's public domain char** version.  */
+
+int __argc;
+wchar_t **__argv;
+
+static int
+parse_tokens(wchar_t* string, wchar_t*** tokens, int length)
+{
+       /* Extract whitespace- and quotes- delimited tokens from the given string
+          and put them into the tokens array. Returns number of tokens
+          extracted. Length specifies the current size of tokens[].
+          THIS METHOD MODIFIES string.  */
+
+       const wchar_t* whitespace = L" \t\r\n";
+       wchar_t* tokenEnd = 0;
+       const wchar_t* quoteCharacters = L"\"\'";
+       wchar_t *end = string + wcslen(string);
+
+       if (string == NULL)
+               return length;
+
+       while (1)
+       {
+               const wchar_t* q;
+               /* Skip over initial whitespace.  */
+               string += wcsspn(string, whitespace);
+               if (*string == '\0')
+                       break;
+
+               for (q = quoteCharacters; *q; ++q)
+               {
+                       if (*string == *q)
+                               break;
+               }
+               if (*q)
+               {
+                       /* Token is quoted.  */
+                       wchar_t quote = *string++;
+                       tokenEnd = wcschr(string, quote);
+                       /* If there is no endquote, the token is the rest of the string.  */
+                       if (!tokenEnd)
+                               tokenEnd = end;
+               }
+               else
+               {
+                       tokenEnd = string + wcscspn(string, whitespace);
+               }
+
+               *tokenEnd = '\0';
+
+               {
+                       wchar_t** new_tokens;
+                       int newlen = length + 1;
+                       new_tokens = realloc (*tokens, sizeof (wchar_t**) * newlen);
+                       if (!new_tokens)
+                       {
+                               /* Out of memory.  */
+                               return -1;
+                       }
+
+                       *tokens = new_tokens;
+                       (*tokens)[length] = string;
+                       length = newlen;
+               }
+               if (tokenEnd == end)
+                       break;
+               string = tokenEnd + 1;
+       }
+       return length;
+}
+
+static void
+parse_args(int *argc, wchar_t ***argv, wchar_t *cmdlinePtrW)
+{
+       wchar_t cmdnameBufW[MAX_UNICODE_PATH];
+       int cmdlineLen = 0;
+       int modlen;
+
+       /* argv[0] is the path of invoked program - get this from CE.  */
+       cmdnameBufW[0] = 0;
+       modlen = GetModuleFileNameW(NULL, cmdnameBufW, sizeof (cmdnameBufW)/sizeof (cmdnameBufW[0]));
+
+       if (!cmdlinePtrW)
+               cmdlineLen = 0;
+       else
+               cmdlineLen = wcslen(cmdlinePtrW);
+
+       /* gets realloc()'d later */
+       *argv = malloc (sizeof (wchar_t**) * 1);
+       if (!*argv)
+               ExitProcess(-1);
+
+       (*argv)[0] = wcsdup(cmdnameBufW);
+       if(!(*argv[0]))
+               ExitProcess(-1);
+       /* Add one to account for argv[0] */
+       (*argc)++;
+
+       if (cmdlineLen > 0)
+       {
+               wchar_t* argv1 = (*argv)[0] + wcslen((*argv)[0]) + 1;
+               argv1 = wcsdup(cmdlinePtrW);
+               if(!argv1)
+                       ExitProcess(-1);
+               *argc = parse_tokens(argv1, argv, 1);
+               if (*argc < 0)
+                       ExitProcess(-1);
+       }
+       (*argv)[*argc] = 0;
+       return;
+}
+
+int WINAPI
+WinMain(
+       HINSTANCE hInstance,
+       HINSTANCE hPrevInstance,
+       LPWSTR lpCmdLine,
+       int nCmdShow)
+{
+       parse_args(&__argc, &__argv, lpCmdLine);
+       init_factor_from_args(NULL,__argc,(LPWSTR*)__argv,false);
+       // memory leak from malloc, wcsdup
+       return 0;
+}
diff --git a/vm/main-windows-nt.c b/vm/main-windows-nt.c
new file mode 100644 (file)
index 0000000..7438319
--- /dev/null
@@ -0,0 +1,27 @@
+#include <windows.h>
+#include <stdio.h>
+#include <shellapi.h>
+#include "master.h"
+
+int WINAPI WinMain(
+       HINSTANCE hInstance,
+       HINSTANCE hPrevInstance,
+       LPSTR lpCmdLine,
+       int nCmdShow)
+{
+       LPWSTR *szArglist;
+       int nArgs;
+
+       szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
+       if( NULL == szArglist )
+       {
+               wprintf(L"CommandLineToArgvW failed\n");
+               return 1;
+       }
+
+       init_factor_from_args(NULL,nArgs,szArglist,false);
+
+       LocalFree(szArglist);
+
+       return 0;
+}
diff --git a/vm/master.h b/vm/master.h
new file mode 100644 (file)
index 0000000..ec98d34
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef __FACTOR_MASTER_H__
+#define __FACTOR_MASTER_H__
+
+#ifndef WINCE
+       #include <errno.h>
+#endif
+
+#include <fcntl.h>
+#include <limits.h>
+#include <math.h>
+#include <stdbool.h>
+#include <setjmp.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/param.h>
+
+#include "layouts.h"
+#include "platform.h"
+#include "primitives.h"
+#include "debug.h"
+#include "run.h"
+#include "bignumint.h"
+#include "bignum.h"
+#include "data_gc.h"
+#include "types.h"
+#include "math.h"
+#include "float_bits.h"
+#include "io.h"
+#include "code_gc.h"
+#include "compiler.h"
+#include "image.h"
+#include "stack.h"
+#include "alien.h"
+#include "jit.h"
+#include "factor.h"
+#include "utilities.h"
+
+#endif /* __FACTOR_MASTER_H__ */
index 7ae1e22593f423441495ef494fc3ec719661345a..a8bc76c2b10ceadafc6c6ba7c96ea9a933bd90ba 100644 (file)
--- a/vm/math.c
+++ b/vm/math.c
@@ -1,4 +1,4 @@
-#include "factor.h"
+#include "master.h"
 
 /* Fixnums */
 
@@ -9,7 +9,7 @@ F_FIXNUM to_fixnum(CELL tagged)
        case FIXNUM_TYPE:
                return untag_fixnum_fast(tagged);
        case BIGNUM_TYPE:
-               return bignum_to_fixnum(tagged);
+               return bignum_to_fixnum(untag_object(tagged));
        default:
                type_error(FIXNUM_TYPE,tagged);
                return -1; /* can't happen */
@@ -21,12 +21,12 @@ CELL to_cell(CELL tagged)
        return (CELL)to_fixnum(tagged);
 }
 
-void primitive_bignum_to_fixnum(void)
+DEFINE_PRIMITIVE(bignum_to_fixnum)
 {
-       drepl(tag_fixnum(bignum_to_fixnum(dpeek())));
+       drepl(tag_fixnum(bignum_to_fixnum(untag_object(dpeek()))));
 }
 
-void primitive_float_to_fixnum(void)
+DEFINE_PRIMITIVE(float_to_fixnum)
 {
        drepl(tag_fixnum(float_to_fixnum(dpeek())));
 }
@@ -36,27 +36,27 @@ void primitive_float_to_fixnum(void)
        F_FIXNUM x = untag_fixnum_fast(dpop());
 
 /* The fixnum arithmetic operations defined in C are relatively slow.
-The Factor compiler has optimized assembly intrinsics for all these
+The Factor compiler has optimized assembly intrinsics for some of these
 operations. */
-void primitive_fixnum_add(void)
+DEFINE_PRIMITIVE(fixnum_add)
 {
        POP_FIXNUMS(x,y)
        box_signed_cell(x + y);
 }
 
-void primitive_fixnum_add_fast(void)
+DEFINE_PRIMITIVE(fixnum_add_fast)
 {
        POP_FIXNUMS(x,y)
        dpush(tag_fixnum(x + y));
 }
 
-void primitive_fixnum_subtract(void)
+DEFINE_PRIMITIVE(fixnum_subtract)
 {
        POP_FIXNUMS(x,y)
        box_signed_cell(x - y);
 }
 
-void primitive_fixnum_subtract_fast(void)
+DEFINE_PRIMITIVE(fixnum_subtract_fast)
 {
        POP_FIXNUMS(x,y)
        dpush(tag_fixnum(x - y));
@@ -64,7 +64,7 @@ void primitive_fixnum_subtract_fast(void)
 
 /* Multiply two integers, and trap overflow.
 Thanks to David Blaikie (The_Vulture from freenode #java) for the hint. */
-void primitive_fixnum_multiply(void)
+DEFINE_PRIMITIVE(fixnum_multiply)
 {
        POP_FIXNUMS(x,y)
 
@@ -78,47 +78,53 @@ void primitive_fixnum_multiply(void)
                        box_signed_cell(prod);
                else
                {
-                       F_ARRAY *bx = s48_fixnum_to_bignum(x);
+                       F_ARRAY *bx = fixnum_to_bignum(x);
                        REGISTER_BIGNUM(bx);
-                       F_ARRAY *by = s48_fixnum_to_bignum(y);
+                       F_ARRAY *by = fixnum_to_bignum(y);
                        UNREGISTER_BIGNUM(bx);
-                       dpush(tag_bignum(s48_bignum_multiply(bx,by)));
+                       dpush(tag_bignum(bignum_multiply(bx,by)));
                }
        }
 }
 
-void primitive_fixnum_divint(void)
+DEFINE_PRIMITIVE(fixnum_multiply_fast)
+{
+       POP_FIXNUMS(x,y)
+       dpush(tag_fixnum(x * y));
+}
+
+DEFINE_PRIMITIVE(fixnum_divint)
 {
        POP_FIXNUMS(x,y)
        box_signed_cell(x / y);
 }
 
-void primitive_fixnum_divmod(void)
+DEFINE_PRIMITIVE(fixnum_divmod)
 {
        POP_FIXNUMS(x,y)
        box_signed_cell(x / y);
-       box_signed_cell(x % y);
+       dpush(tag_fixnum(x % y));
 }
 
-void primitive_fixnum_mod(void)
+DEFINE_PRIMITIVE(fixnum_mod)
 {
        POP_FIXNUMS(x,y)
        dpush(tag_fixnum(x % y));
 }
 
-void primitive_fixnum_and(void)
+DEFINE_PRIMITIVE(fixnum_and)
 {
        POP_FIXNUMS(x,y)
        dpush(tag_fixnum(x & y));
 }
 
-void primitive_fixnum_or(void)
+DEFINE_PRIMITIVE(fixnum_or)
 {
        POP_FIXNUMS(x,y)
        dpush(tag_fixnum(x | y));
 }
 
-void primitive_fixnum_xor(void)
+DEFINE_PRIMITIVE(fixnum_xor)
 {
        POP_FIXNUMS(x,y)
        dpush(tag_fixnum(x ^ y));
@@ -129,7 +135,7 @@ void primitive_fixnum_xor(void)
  * If we're shifting right by n bits, we won't overflow as long as none of the
  * high WORD_SIZE-TAG_BITS-n bits are set.
  */
-void primitive_fixnum_shift(void)
+DEFINE_PRIMITIVE(fixnum_shift)
 {
        POP_FIXNUMS(x,y)
 
@@ -148,7 +154,7 @@ void primitive_fixnum_shift(void)
        }
        else if(y < WORD_SIZE - TAG_BITS)
        {
-               F_FIXNUM mask = -(1 << (WORD_SIZE - 1 - TAG_BITS - y));
+               F_FIXNUM mask = -(1L << (WORD_SIZE - 1 - TAG_BITS - y));
                if((x > 0 && (x & mask) == 0) || (x & mask) == mask)
                {
                        dpush(tag_fixnum(x << y));
@@ -156,203 +162,203 @@ void primitive_fixnum_shift(void)
                }
        }
 
-       dpush(tag_bignum(s48_bignum_arithmetic_shift(
-               s48_fixnum_to_bignum(x),y)));
+       dpush(tag_bignum(bignum_arithmetic_shift(
+               fixnum_to_bignum(x),y)));
 }
 
-void primitive_fixnum_less(void)
+DEFINE_PRIMITIVE(fixnum_less)
 {
        POP_FIXNUMS(x,y)
        box_boolean(x < y);
 }
 
-void primitive_fixnum_lesseq(void)
+DEFINE_PRIMITIVE(fixnum_lesseq)
 {
        POP_FIXNUMS(x,y)
        box_boolean(x <= y);
 }
 
-void primitive_fixnum_greater(void)
+DEFINE_PRIMITIVE(fixnum_greater)
 {
        POP_FIXNUMS(x,y)
        box_boolean(x > y);
 }
 
-void primitive_fixnum_greatereq(void)
+DEFINE_PRIMITIVE(fixnum_greatereq)
 {
        POP_FIXNUMS(x,y)
        box_boolean(x >= y);
 }
 
-void primitive_fixnum_not(void)
+DEFINE_PRIMITIVE(fixnum_not)
 {
        drepl(tag_fixnum(~untag_fixnum_fast(dpeek())));
 }
 
-#define INT_DEFBOX(name,type) \
-void name(type integer)                                                        \
-{                                                                              \
-       dpush(tag_fixnum(integer));                                            \
-}
-
-#define INT_DEFUNBOX(name,type) \
-type name(void)                                                                \
-{                                                                              \
-       return to_fixnum(dpop());                                              \
-}
-
-INT_DEFBOX(box_signed_1, signed char)
-INT_DEFBOX(box_signed_2, signed short)
-INT_DEFBOX(box_unsigned_1, unsigned char)
-INT_DEFBOX(box_unsigned_2, unsigned short)
-INT_DEFUNBOX(unbox_signed_1, signed char)
-INT_DEFUNBOX(unbox_signed_2, signed short)
-INT_DEFUNBOX(unbox_unsigned_1, unsigned char)
-INT_DEFUNBOX(unbox_unsigned_2, unsigned short) 
-
 /* Bignums */
-void primitive_fixnum_to_bignum(void)
+DEFINE_PRIMITIVE(fixnum_to_bignum)
 {
-       drepl(tag_bignum(fixnum_to_bignum(dpeek())));
+       drepl(tag_bignum(fixnum_to_bignum(untag_fixnum_fast(dpeek()))));
 }
 
-void primitive_float_to_bignum(void)
+DEFINE_PRIMITIVE(float_to_bignum)
 {
        drepl(tag_bignum(float_to_bignum(dpeek())));
 }
 
 #define POP_BIGNUMS(x,y) \
-       F_ARRAY *y = untag_bignum_fast(dpop()); \
-       F_ARRAY *x = untag_bignum_fast(dpop());
+       F_ARRAY *y = untag_object(dpop()); \
+       F_ARRAY *x = untag_object(dpop());
 
-void primitive_bignum_eq(void)
+DEFINE_PRIMITIVE(bignum_eq)
 {
        POP_BIGNUMS(x,y);
-       box_boolean(s48_bignum_equal_p(x,y));
+       box_boolean(bignum_equal_p(x,y));
 }
 
-void primitive_bignum_add(void)
+DEFINE_PRIMITIVE(bignum_add)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_add(x,y)));
+       dpush(tag_bignum(bignum_add(x,y)));
 }
 
-void primitive_bignum_subtract(void)
+DEFINE_PRIMITIVE(bignum_subtract)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_subtract(x,y)));
+       dpush(tag_bignum(bignum_subtract(x,y)));
 }
 
-void primitive_bignum_multiply(void)
+DEFINE_PRIMITIVE(bignum_multiply)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_multiply(x,y)));
+       dpush(tag_bignum(bignum_multiply(x,y)));
 }
 
-void primitive_bignum_divint(void)
+DEFINE_PRIMITIVE(bignum_divint)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_quotient(x,y)));
+       dpush(tag_bignum(bignum_quotient(x,y)));
 }
 
-void primitive_bignum_divmod(void)
+DEFINE_PRIMITIVE(bignum_divmod)
 {
        F_ARRAY *q, *r;
        POP_BIGNUMS(x,y);
-       s48_bignum_divide(x,y,&q,&r);
+       bignum_divide(x,y,&q,&r);
        dpush(tag_bignum(q));
        dpush(tag_bignum(r));
 }
 
-void primitive_bignum_mod(void)
+DEFINE_PRIMITIVE(bignum_mod)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_remainder(x,y)));
+       dpush(tag_bignum(bignum_remainder(x,y)));
 }
 
-void primitive_bignum_and(void)
+DEFINE_PRIMITIVE(bignum_and)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_bitwise_and(x,y)));
+       dpush(tag_bignum(bignum_bitwise_and(x,y)));
 }
 
-void primitive_bignum_or(void)
+DEFINE_PRIMITIVE(bignum_or)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_bitwise_ior(x,y)));
+       dpush(tag_bignum(bignum_bitwise_ior(x,y)));
 }
 
-void primitive_bignum_xor(void)
+DEFINE_PRIMITIVE(bignum_xor)
 {
        POP_BIGNUMS(x,y);
-       dpush(tag_bignum(s48_bignum_bitwise_xor(x,y)));
+       dpush(tag_bignum(bignum_bitwise_xor(x,y)));
 }
 
-void primitive_bignum_shift(void)
+DEFINE_PRIMITIVE(bignum_shift)
 {
-       F_FIXNUM y = untag_fixnum_fast(dpop());
-        F_ARRAY* x = untag_bignum_fast(dpop());
-       dpush(tag_bignum(s48_bignum_arithmetic_shift(x,y)));
+       F_FIXNUM y = to_fixnum(dpop());
+        F_ARRAY* x = untag_object(dpop());
+       dpush(tag_bignum(bignum_arithmetic_shift(x,y)));
 }
 
-void primitive_bignum_less(void)
+DEFINE_PRIMITIVE(bignum_less)
 {
        POP_BIGNUMS(x,y);
-       box_boolean(s48_bignum_compare(x,y) == bignum_comparison_less);
+       box_boolean(bignum_compare(x,y) == bignum_comparison_less);
 }
 
-void primitive_bignum_lesseq(void)
+DEFINE_PRIMITIVE(bignum_lesseq)
 {
        POP_BIGNUMS(x,y);
-       box_boolean(s48_bignum_compare(x,y) != bignum_comparison_greater);
+       box_boolean(bignum_compare(x,y) != bignum_comparison_greater);
 }
 
-void primitive_bignum_greater(void)
+DEFINE_PRIMITIVE(bignum_greater)
 {
        POP_BIGNUMS(x,y);
-       box_boolean(s48_bignum_compare(x,y) == bignum_comparison_greater);
+       box_boolean(bignum_compare(x,y) == bignum_comparison_greater);
 }
 
-void primitive_bignum_greatereq(void)
+DEFINE_PRIMITIVE(bignum_greatereq)
 {
        POP_BIGNUMS(x,y);
-       box_boolean(s48_bignum_compare(x,y) != bignum_comparison_less);
+       box_boolean(bignum_compare(x,y) != bignum_comparison_less);
 }
 
-void primitive_bignum_not(void)
+DEFINE_PRIMITIVE(bignum_not)
 {
-       drepl(tag_bignum(s48_bignum_bitwise_not(
-               untag_bignum_fast(dpeek()))));
+       drepl(tag_bignum(bignum_bitwise_not(untag_object(dpeek()))));
 }
 
-void box_signed_cell(F_FIXNUM integer)
+DEFINE_PRIMITIVE(bignum_bitp)
 {
-       dpush(allot_integer(integer));
+       F_FIXNUM bit = to_fixnum(dpop());
+       F_ARRAY *x = untag_object(dpop());
+       box_boolean(bignum_logbitp(bit,x));
 }
 
-F_FIXNUM unbox_signed_cell(void)
+DEFINE_PRIMITIVE(bignum_log2)
 {
-       return to_fixnum(dpop());
+       drepl(tag_bignum(bignum_integer_length(untag_object(dpeek()))));
 }
 
-void box_unsigned_cell(CELL cell)
+unsigned int bignum_producer(unsigned int digit)
 {
-       dpush(allot_cell(cell));
+       unsigned char *ptr = alien_offset(dpeek());
+       return *(ptr + digit);
 }
 
-F_FIXNUM unbox_unsigned_cell(void)
+DEFINE_PRIMITIVE(byte_array_to_bignum)
 {
-       return to_cell(dpop());
+       type_check(BYTE_ARRAY_TYPE,dpeek());
+       CELL n_digits = array_capacity(untag_object(dpeek()));
+       bignum_type bignum = digit_stream_to_bignum(
+               n_digits,bignum_producer,0x100,0);
+       drepl(tag_bignum(bignum));
 }
 
-void box_signed_4(s32 n)
+void box_signed_1(s8 n)
 {
-       dpush(allot_integer(n));
+       dpush(tag_fixnum(n));
 }
 
-s32 unbox_signed_4(void)
+void box_unsigned_1(u8 n)
 {
-       return to_fixnum(dpop());
+       dpush(tag_fixnum(n));
+}
+
+void box_signed_2(s16 n)
+{
+       dpush(tag_fixnum(n));
+}
+
+void box_unsigned_2(u16 n)
+{
+       dpush(tag_fixnum(n));
+}
+
+void box_signed_4(s32 n)
+{
+       dpush(allot_integer(n));
 }
 
 void box_unsigned_4(u32 n)
@@ -360,29 +366,32 @@ void box_unsigned_4(u32 n)
        dpush(allot_cell(n));
 }
 
-u32 unbox_unsigned_4(void)
+void box_signed_cell(F_FIXNUM integer)
+{
+       dpush(allot_integer(integer));
+}
+
+void box_unsigned_cell(CELL cell)
 {
-       return to_cell(dpop());
+       dpush(allot_cell(cell));
 }
 
 void box_signed_8(s64 n)
 {
        if(n < FIXNUM_MIN || n > FIXNUM_MAX)
-               dpush(tag_bignum(s48_long_long_to_bignum(n)));
+               dpush(tag_bignum(long_long_to_bignum(n)));
        else
                dpush(tag_fixnum(n));
 }
 
-s64 unbox_signed_8(void)
+s64 to_signed_8(CELL obj)
 {
-       CELL obj = dpop();
-
        switch(type_of(obj))
        {
        case FIXNUM_TYPE:
                return untag_fixnum_fast(obj);
        case BIGNUM_TYPE:
-               return s48_bignum_to_long_long(untag_array_fast(obj));
+               return bignum_to_long_long(untag_object(obj));
        default:
                type_error(BIGNUM_TYPE,obj);
                return -1;
@@ -392,32 +401,63 @@ s64 unbox_signed_8(void)
 void box_unsigned_8(u64 n)
 {
        if(n > FIXNUM_MAX)
-               dpush(tag_bignum(s48_ulong_long_to_bignum(n)));
+               dpush(tag_bignum(ulong_long_to_bignum(n)));
        else
                dpush(tag_fixnum(n));
 }
 
-u64 unbox_unsigned_8(void)
+u64 to_unsigned_8(CELL obj)
 {
-       CELL obj = dpop();
-
        switch(type_of(obj))
        {
        case FIXNUM_TYPE:
                return untag_fixnum_fast(obj);
        case BIGNUM_TYPE:
-               return s48_bignum_to_ulong_long(untag_array_fast(obj));
+               return bignum_to_ulong_long(untag_object(obj));
        default:
                type_error(BIGNUM_TYPE,obj);
                return -1;
        }
 }
 
+CELL unbox_array_size(void)
+{
+       switch(type_of(dpeek()))
+       {
+       case FIXNUM_TYPE:
+               {
+                       F_FIXNUM n = untag_fixnum_fast(dpeek());
+                       if(n >= 0 && n < ARRAY_SIZE_MAX)
+                       {
+                               dpop();
+                               return n;
+                       }
+                       break;
+               }
+       case BIGNUM_TYPE:
+               {
+                       bignum_type zero = untag_object(bignum_zero);
+                       bignum_type max = ulong_to_bignum(ARRAY_SIZE_MAX);
+                       bignum_type n = untag_object(dpeek());
+                       if(bignum_compare(n,zero) != bignum_comparison_less
+                               && bignum_compare(n,max) == bignum_comparison_less)
+                       {
+                               dpop();
+                               return bignum_to_ulong(n);
+                       }
+                       break;
+               }
+       }
+
+       general_error(ERROR_ARRAY_SIZE,dpop(),tag_fixnum(ARRAY_SIZE_MAX),NULL);
+       return 0; /* can't happen */
+}
+
 /* Ratios */
 
 /* Does not reduce to lowest terms, so should only be used by math
 library implementation, to avoid breaking invariants. */
-void primitive_from_fraction(void)
+DEFINE_PRIMITIVE(from_fraction)
 {
        F_RATIO* ratio = allot_object(RATIO_TYPE,sizeof(F_RATIO));
        ratio->denominator = dpop();
@@ -426,42 +466,36 @@ void primitive_from_fraction(void)
 }
 
 /* Floats */
-void primitive_fixnum_to_float(void)
+DEFINE_PRIMITIVE(fixnum_to_float)
 {
        drepl(allot_float(fixnum_to_float(dpeek())));
 }
 
-void primitive_bignum_to_float(void)
+DEFINE_PRIMITIVE(bignum_to_float)
 {
        drepl(allot_float(bignum_to_float(dpeek())));
 }
 
-void primitive_str_to_float(void)
+DEFINE_PRIMITIVE(str_to_float)
 {
        char *c_str, *end;
        double f;
        F_STRING *str = untag_string(dpeek());
        CELL capacity = string_capacity(str);
 
-       /* if the string has nulls or chars > 255, its definitely not a float */
-       if(!check_string(str,sizeof(char)))
+       c_str = to_char_string(str,false);
+       end = c_str;
+       f = strtod(c_str,&end);
+       if(end != c_str + capacity)
                drepl(F);
        else
-       {
-               c_str = to_char_string(str,false);
-               end = c_str;
-               f = strtod(c_str,&end);
-               if(end != c_str + capacity)
-                       drepl(F);
-               else
-                       drepl(allot_float(f));
-       }
+               drepl(allot_float(f));
 }
 
-void primitive_float_to_str(void)
+DEFINE_PRIMITIVE(float_to_str)
 {
        char tmp[33];
-       snprintf(tmp,32,"%.16g",unbox_double());
+       snprintf(tmp,32,"%.16g",untag_float(dpop()));
        tmp[32] = '\0';
        box_char_string(tmp);
 }
@@ -470,108 +504,109 @@ void primitive_float_to_str(void)
        double y = untag_float_fast(dpop()); \
        double x = untag_float_fast(dpop());
 
-void primitive_float_add(void)
+DEFINE_PRIMITIVE(float_eq)
+{
+       POP_FLOATS(x,y);
+       box_boolean(x == y);
+}
+
+DEFINE_PRIMITIVE(float_add)
 {
        POP_FLOATS(x,y);
        box_double(x + y);
 }
 
-void primitive_float_subtract(void)
+DEFINE_PRIMITIVE(float_subtract)
 {
        POP_FLOATS(x,y);
        box_double(x - y);
 }
 
-void primitive_float_multiply(void)
+DEFINE_PRIMITIVE(float_multiply)
 {
        POP_FLOATS(x,y);
        box_double(x * y);
 }
 
-void primitive_float_divfloat(void)
+DEFINE_PRIMITIVE(float_divfloat)
 {
        POP_FLOATS(x,y);
        box_double(x / y);
 }
 
-void primitive_float_mod(void)
+DEFINE_PRIMITIVE(float_mod)
 {
        POP_FLOATS(x,y);
        box_double(fmod(x,y));
 }
 
-void primitive_float_less(void)
+DEFINE_PRIMITIVE(float_less)
 {
        POP_FLOATS(x,y);
        box_boolean(x < y);
 }
 
-void primitive_float_lesseq(void)
+DEFINE_PRIMITIVE(float_lesseq)
 {
        POP_FLOATS(x,y);
        box_boolean(x <= y);
 }
 
-void primitive_float_greater(void)
+DEFINE_PRIMITIVE(float_greater)
 {
        POP_FLOATS(x,y);
        box_boolean(x > y);
 }
 
-void primitive_float_greatereq(void)
+DEFINE_PRIMITIVE(float_greatereq)
 {
        POP_FLOATS(x,y);
        box_boolean(x >= y);
 }
 
-void primitive_float_bits(void)
+DEFINE_PRIMITIVE(float_bits)
 {
-       F_FLOAT_BITS b;
-       b.x = unbox_float();
-       box_unsigned_4(b.y);
+       box_unsigned_4(float_bits(untag_float(dpop())));
 }
 
-void primitive_bits_float(void)
+DEFINE_PRIMITIVE(bits_float)
 {
-       F_FLOAT_BITS b;
-       b.y = unbox_unsigned_4();
-       box_float(b.x);
+       box_float(bits_float(to_cell(dpop())));
 }
 
-void primitive_double_bits(void)
+DEFINE_PRIMITIVE(double_bits)
 {
-       F_DOUBLE_BITS b;
-       b.x = unbox_double();
-       box_unsigned_8(b.y);
+       box_unsigned_8(double_bits(untag_float(dpop())));
 }
 
-void primitive_bits_double(void)
+DEFINE_PRIMITIVE(bits_double)
 {
-       F_DOUBLE_BITS b;
-       b.y = unbox_unsigned_8();
-       box_double(b.x);
+       box_double(bits_double(to_unsigned_8(dpop())));
 }
 
-#define FLO_DEFBOX(name,type) \
-void name (type flo)                                                       \
-{                                                                              \
-       dpush(allot_float(flo));                                               \
+float to_float(CELL value)
+{
+       return untag_float(value);
 }
 
-#define FLO_DEFUNBOX(name,type) \
-type name(void)                                                                \
-{                                                                              \
-       return untag_float(dpop());                                            \
+double to_double(CELL value)
+{
+       return untag_float(value);
 }
 
-FLO_DEFBOX(box_float,float)
-FLO_DEFUNBOX(unbox_float,float)  
-FLO_DEFBOX(box_double,double)
-FLO_DEFUNBOX(unbox_double,double)
+void box_float(float flo)
+{
+        dpush(allot_float(flo));
+}
+
+void box_double(double flo)
+{
+        dpush(allot_float(flo));
+}
 
 /* Complex numbers */
 
-void primitive_from_rect(void)
+DEFINE_PRIMITIVE(from_rect)
 {
        F_COMPLEX* complex = allot_object(COMPLEX_TYPE,sizeof(F_COMPLEX));
        complex->imaginary = dpop();
index 690070331165f1d6a2df9d6bd7a9cf0aa689a203..7e427b483330e7b6cd10a96bcf3d839a31b3453e 100644 (file)
--- a/vm/math.h
+++ b/vm/math.h
+#define CELL_MAX (CELL)(-1)
 #define FIXNUM_MAX (((F_FIXNUM)1 << (WORD_SIZE - TAG_BITS - 1)) - 1)
 #define FIXNUM_MIN (-((F_FIXNUM)1 << (WORD_SIZE - TAG_BITS - 1)))
-
-INLINE F_FIXNUM untag_fixnum_fast(CELL tagged)
-{
-       return ((F_FIXNUM)tagged) >> TAG_BITS;
-}
-
-INLINE CELL tag_fixnum(F_FIXNUM untagged)
-{
-       return RETAG(untagged << TAG_BITS,FIXNUM_TYPE);
-}
-
-INLINE F_FIXNUM bignum_to_fixnum(CELL tagged)
-{
-       return (F_FIXNUM)s48_bignum_to_fixnum(untag_array_fast(tagged));
-}
-
-F_FIXNUM to_fixnum(CELL tagged);
-CELL to_cell(CELL tagged);
-
-void primitive_bignum_to_fixnum(void);
-void primitive_float_to_fixnum(void);
-
-void primitive_fixnum_add(void);
-void primitive_fixnum_subtract(void);
-void primitive_fixnum_add_fast(void);
-void primitive_fixnum_subtract_fast(void);
-void primitive_fixnum_multiply(void);
-void primitive_fixnum_divint(void);
-void primitive_fixnum_divmod(void);
-void primitive_fixnum_mod(void);
-void primitive_fixnum_and(void);
-void primitive_fixnum_or(void);
-void primitive_fixnum_xor(void);
-void primitive_fixnum_shift(void);
-void primitive_fixnum_less(void);
-void primitive_fixnum_lesseq(void);
-void primitive_fixnum_greater(void);
-void primitive_fixnum_greatereq(void);
-void primitive_fixnum_not(void);
-DLLEXPORT void box_signed_1(signed char integer);
-DLLEXPORT void box_signed_2(signed short integer);
-DLLEXPORT void box_unsigned_1(unsigned char integer);
-DLLEXPORT void box_unsigned_2(unsigned short integer);
-DLLEXPORT signed char unbox_signed_1(void);
-DLLEXPORT signed short unbox_signed_2(void);
-DLLEXPORT unsigned char unbox_unsigned_1(void);
-DLLEXPORT unsigned short unbox_unsigned_2(void);
+#define ARRAY_SIZE_MAX ((CELL)1 << (WORD_SIZE - TAG_BITS - 2))
+
+DLLEXPORT F_FIXNUM to_fixnum(CELL tagged);
+DLLEXPORT CELL to_cell(CELL tagged);
+
+DECLARE_PRIMITIVE(bignum_to_fixnum);
+DECLARE_PRIMITIVE(float_to_fixnum);
+
+DECLARE_PRIMITIVE(fixnum_add);
+DECLARE_PRIMITIVE(fixnum_subtract);
+DECLARE_PRIMITIVE(fixnum_add_fast);
+DECLARE_PRIMITIVE(fixnum_subtract_fast);
+DECLARE_PRIMITIVE(fixnum_multiply);
+DECLARE_PRIMITIVE(fixnum_multiply_fast);
+DECLARE_PRIMITIVE(fixnum_divint);
+DECLARE_PRIMITIVE(fixnum_divmod);
+DECLARE_PRIMITIVE(fixnum_mod);
+DECLARE_PRIMITIVE(fixnum_and);
+DECLARE_PRIMITIVE(fixnum_or);
+DECLARE_PRIMITIVE(fixnum_xor);
+DECLARE_PRIMITIVE(fixnum_shift);
+DECLARE_PRIMITIVE(fixnum_less);
+DECLARE_PRIMITIVE(fixnum_lesseq);
+DECLARE_PRIMITIVE(fixnum_greater);
+DECLARE_PRIMITIVE(fixnum_greatereq);
+DECLARE_PRIMITIVE(fixnum_not);
 
 CELL bignum_zero;
 CELL bignum_pos_one;
 CELL bignum_neg_one;
 
-INLINE F_ARRAY* untag_bignum_fast(CELL tagged)
-{
-       return (F_ARRAY*)UNTAG(tagged);
-}
-
 INLINE CELL tag_bignum(F_ARRAY* bignum)
 {
        return RETAG(bignum,BIGNUM_TYPE);
 }
 
-INLINE F_ARRAY *fixnum_to_bignum(CELL tagged)
-{
-       return s48_fixnum_to_bignum(untag_fixnum_fast(tagged));
-}
-
-void primitive_fixnum_to_bignum(void);
-void primitive_float_to_bignum(void);
-void primitive_bignum_eq(void);
-void primitive_bignum_add(void);
-void primitive_bignum_subtract(void);
-void primitive_bignum_multiply(void);
-void primitive_bignum_divint(void);
-void primitive_bignum_divmod(void);
-void primitive_bignum_mod(void);
-void primitive_bignum_and(void);
-void primitive_bignum_or(void);
-void primitive_bignum_xor(void);
-void primitive_bignum_shift(void);
-void primitive_bignum_less(void);
-void primitive_bignum_lesseq(void);
-void primitive_bignum_greater(void);
-void primitive_bignum_greatereq(void);
-void primitive_bignum_not(void);
+DECLARE_PRIMITIVE(fixnum_to_bignum);
+DECLARE_PRIMITIVE(float_to_bignum);
+DECLARE_PRIMITIVE(bignum_eq);
+DECLARE_PRIMITIVE(bignum_add);
+DECLARE_PRIMITIVE(bignum_subtract);
+DECLARE_PRIMITIVE(bignum_multiply);
+DECLARE_PRIMITIVE(bignum_divint);
+DECLARE_PRIMITIVE(bignum_divmod);
+DECLARE_PRIMITIVE(bignum_mod);
+DECLARE_PRIMITIVE(bignum_and);
+DECLARE_PRIMITIVE(bignum_or);
+DECLARE_PRIMITIVE(bignum_xor);
+DECLARE_PRIMITIVE(bignum_shift);
+DECLARE_PRIMITIVE(bignum_less);
+DECLARE_PRIMITIVE(bignum_lesseq);
+DECLARE_PRIMITIVE(bignum_greater);
+DECLARE_PRIMITIVE(bignum_greatereq);
+DECLARE_PRIMITIVE(bignum_not);
+DECLARE_PRIMITIVE(bignum_bitp);
+DECLARE_PRIMITIVE(bignum_log2);
+DECLARE_PRIMITIVE(byte_array_to_bignum);
 
 INLINE CELL allot_integer(F_FIXNUM x)
 {
        if(x < FIXNUM_MIN || x > FIXNUM_MAX)
-               return tag_bignum(s48_fixnum_to_bignum(x));
+               return tag_bignum(fixnum_to_bignum(x));
        else
                return tag_fixnum(x);
 }
 
 INLINE CELL allot_cell(CELL x)
 {
-       if(x > FIXNUM_MAX)
-               return tag_bignum(s48_cell_to_bignum(x));
+       if(x > (CELL)FIXNUM_MAX)
+               return tag_bignum(cell_to_bignum(x));
        else
                return tag_fixnum(x);
 }
 
 /* FFI calls this */
-DLLEXPORT void box_signed_cell(F_FIXNUM integer);
-DLLEXPORT F_FIXNUM unbox_signed_cell(void);
-
-DLLEXPORT void box_unsigned_cell(CELL cell);
-DLLEXPORT F_FIXNUM unbox_unsigned_cell(void);
-
+DLLEXPORT void box_signed_1(s8 n);
+DLLEXPORT void box_unsigned_1(u8 n);
+DLLEXPORT void box_signed_2(s16 n);
+DLLEXPORT void box_unsigned_2(u16 n);
 DLLEXPORT void box_signed_4(s32 n);
-DLLEXPORT s32 unbox_signed_4(void);
-
 DLLEXPORT void box_unsigned_4(u32 n);
-DLLEXPORT u32 unbox_unsigned_4(void);
-
+DLLEXPORT void box_signed_cell(F_FIXNUM integer);
+DLLEXPORT void box_unsigned_cell(CELL cell);
 DLLEXPORT void box_signed_8(s64 n);
-DLLEXPORT s64 unbox_signed_8(void);
+DLLEXPORT s64 to_signed_8(CELL obj);
 
 DLLEXPORT void box_unsigned_8(u64 n);
-DLLEXPORT u64 unbox_unsigned_8(void);
+DLLEXPORT u64 to_unsigned_8(CELL obj);
 
-void primitive_from_fraction(void);
+CELL unbox_array_size(void);
 
-/* for punning */
-typedef union {
-    double x;
-    u64 y;
-} F_DOUBLE_BITS;
-
-typedef union {
-    float x;
-    u32 y;
-} F_FLOAT_BITS;
+DECLARE_PRIMITIVE(from_fraction);
 
 INLINE double untag_float_fast(CELL tagged)
 {
@@ -159,7 +119,7 @@ INLINE F_FIXNUM float_to_fixnum(CELL tagged)
 
 INLINE F_ARRAY *float_to_bignum(CELL tagged)
 {
-       return s48_double_to_bignum(untag_float_fast(tagged));
+       return double_to_bignum(untag_float_fast(tagged));
 }
 
 INLINE double fixnum_to_float(CELL tagged)
@@ -169,33 +129,34 @@ INLINE double fixnum_to_float(CELL tagged)
 
 INLINE double bignum_to_float(CELL tagged)
 {
-       return s48_bignum_to_double(untag_array_fast(tagged));
+       return bignum_to_double(untag_object(tagged));
 }
 
-void primitive_fixnum_to_float(void);
-void primitive_bignum_to_float(void);
-void primitive_str_to_float(void);
-void primitive_float_to_str(void);
-void primitive_float_to_bits(void);
-
-void primitive_float_add(void);
-void primitive_float_subtract(void);
-void primitive_float_multiply(void);
-void primitive_float_divfloat(void);
-void primitive_float_mod(void);
-void primitive_float_less(void);
-void primitive_float_lesseq(void);
-void primitive_float_greater(void);
-void primitive_float_greatereq(void);
-
-void primitive_float_bits(void);
-void primitive_bits_float(void);
-void primitive_double_bits(void);
-void primitive_bits_double(void);
-
 DLLEXPORT void box_float(float flo);
-DLLEXPORT float unbox_float(void);
+DLLEXPORT float to_float(CELL value);
 DLLEXPORT void box_double(double flo);
-DLLEXPORT double unbox_double(void);
-
-void primitive_from_rect(void);
+DLLEXPORT double to_double(CELL value);
+
+DECLARE_PRIMITIVE(fixnum_to_float);
+DECLARE_PRIMITIVE(bignum_to_float);
+DECLARE_PRIMITIVE(str_to_float);
+DECLARE_PRIMITIVE(float_to_str);
+DECLARE_PRIMITIVE(float_to_bits);
+
+DECLARE_PRIMITIVE(float_eq);
+DECLARE_PRIMITIVE(float_add);
+DECLARE_PRIMITIVE(float_subtract);
+DECLARE_PRIMITIVE(float_multiply);
+DECLARE_PRIMITIVE(float_divfloat);
+DECLARE_PRIMITIVE(float_mod);
+DECLARE_PRIMITIVE(float_less);
+DECLARE_PRIMITIVE(float_lesseq);
+DECLARE_PRIMITIVE(float_greater);
+DECLARE_PRIMITIVE(float_greatereq);
+
+DECLARE_PRIMITIVE(float_bits);
+DECLARE_PRIMITIVE(bits_float);
+DECLARE_PRIMITIVE(double_bits);
+DECLARE_PRIMITIVE(bits_double);
+
+DECLARE_PRIMITIVE(from_rect);
diff --git a/vm/os-freebsd.c b/vm/os-freebsd.c
new file mode 100644 (file)
index 0000000..1d43a13
--- /dev/null
@@ -0,0 +1,34 @@
+#include "master.h"
+
+/* From SBCL */
+const char *vm_executable_path(void)
+{
+       char path[PATH_MAX + 1];
+
+       if (getosreldate() >= 600024)
+       {
+               /* KERN_PROC_PATHNAME is available */
+               size_t len = PATH_MAX + 1;
+               int mib[4];
+
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_PROC;
+               mib[2] = KERN_PROC_PATHNAME;
+               mib[3] = -1;
+               if (sysctl(mib, 4, &path, &len, NULL, 0) != 0)
+                       return NULL;
+       }
+       else
+       {
+               int size;
+               size = readlink("/proc/curproc/file", path, sizeof(path) - 1);
+               if (size < 0)
+                       return NULL;
+               path[size] = '\0';
+       }
+
+       if(strcmp(path, "unknown") == 0)
+               return NULL;
+
+       return safe_strdup(path);
+}
index a2dafd8f9e8363d5afc92fdc53f7a9c07c99ce2c..c535e2d71fb46adfeaf3e19df85455cfeda9ce3a 100644 (file)
@@ -1 +1,12 @@
-#define FACTOR_OS_STRING "freebsd"
+#include <osreldate.h>
+
+extern int getosreldate(void);
+
+#include <sys/sysctl.h>
+
+#ifndef KERN_PROC_PATHNAME
+#define KERN_PROC_PATHNAME 12
+#endif
+
+#define UNKNOWN_TYPE_P(file) ((file)->d_type == DT_UNKNOWN)
+#define DIRECTORY_P(file) ((file)->d_type == DT_DIR)
index 1703515d8204c284d48032412097c7f00fd20243..92598eec41236fc6a51d929f986ff8013474515f 100644 (file)
@@ -1,21 +1,27 @@
-#include "factor.h"
+#include "master.h"
 
-void run(void)
+void c_to_factor_toplevel(CELL quot)
 {
-       interpreter();
+       c_to_factor(quot);
 }
 
-void run_toplevel(void)
+void init_signals(void)
 {
-       run();
+       unix_init_signals();
 }
 
+void early_init(void) { }
+
+#define SUFFIX ".image"
+
 const char *default_image_path(void)
 {
-       return "factor.image";
-}
+       const char *path = vm_executable_path();
 
-void init_signals(void)
-{
-       unix_init_signals();
+       if(!path)
+               return "factor.image";
+
+       char *new_path = safe_realloc(path,PATH_MAX + strlen(SUFFIX) + 1);
+       strcat(new_path,SUFFIX); 
+       return new_path;
 }
index b3c9f70bbbce36e6172be523839494d0a0eabd90..7afc68998dec7ee4d0507a3b6c5d80ac21632da4 100644 (file)
@@ -1,3 +1,8 @@
+#define DLLEXPORT
+#define NULL_DLL NULL
+
+void c_to_factor_toplevel(CELL quot);
 void init_signals(void);
-INLINE void early_init(void) {}
+void early_init(void);
+const char *vm_executable_path(void);
 const char *default_image_path(void);
diff --git a/vm/os-linux-arm.h b/vm/os-linux-arm.h
new file mode 100644 (file)
index 0000000..2e3d606
--- /dev/null
@@ -0,0 +1,14 @@
+#include <ucontext.h>
+#include <asm/unistd.h>
+#include <sys/syscall.h>
+
+INLINE void *ucontext_stack_pointer(void *uap)
+{
+       ucontext_t *ucontext = (ucontext_t *)uap;
+       return (void *)ucontext->uc_mcontext.arm_sp;
+}
+
+INLINE void flush_icache(CELL start, CELL len)
+{
+       syscall(__ARM_NR_cacheflush,start,start + len,0);
+}
index 4dae4c62cf154c125d71b6e0498eaf0d95128586..d90524095b226132e62ca65f70a49f12d191b0d8 100644 (file)
@@ -1,4 +1,29 @@
-typedef struct _F_STACK_FRAME {
+typedef struct _F_STACK_FRAME
+{
        struct _F_STACK_FRAME *previous;
-       CELL return_address;
+
+       /* Callee stores our LR here */
+       XT return_address;
+
+       /* ===== 32 bytes saved register area ===== */
+       CELL padding5[8];
+
+       /* ===== 16 byte local variable area ===== */
+
+       /* In compiled quotation frames, the quot->array slot.
+       In compiled word frames, unused. */
+       CELL array;
+
+       /* In compiled quotation frames, position within the array.
+       In compiled word frames, unused. */
+       CELL scan;
+
+       /* In all compiled frames, the XT on entry. */
+       XT xt;
+
+       /* ===== 12 byte padding to make it 16 byte aligned ===== */
+       CELL padding6[3];
 } F_STACK_FRAME;
+
+#define UAP_PROGRAM_COUNTER(ucontext) \
+       (((ucontext_t *)(ucontext))->uc_mcontext.uc_regs->gregs[PT_NIP])
diff --git a/vm/os-linux.c b/vm/os-linux.c
new file mode 100644 (file)
index 0000000..8f3f840
--- /dev/null
@@ -0,0 +1,19 @@
+#include "master.h"
+
+/* Snarfed from SBCL linux-so.c. You must free() this yourself. */
+const char *vm_executable_path(void)
+{
+       char *path = safe_malloc(PATH_MAX + 1);
+
+       int size = readlink("/proc/self/exe", path, PATH_MAX);
+       if (size < 0)
+       {
+               fatal_error("Cannot read /proc/self/exe",0);
+               return NULL;
+       }
+       else
+       {
+               path[size] = '\0';
+               return safe_strdup(path);
+       }
+}
index 7335706c97534ca8d413d570d30337da2a0654df..af47f7bceaa7a763d86eb526017efdf65c0108f4 100644 (file)
@@ -1 +1,2 @@
-#define FACTOR_OS_STRING "linux"
+#define UNKNOWN_TYPE_P(file) ((file)->d_type == DT_UNKNOWN)
+#define DIRECTORY_P(file) ((file)->d_type == DT_DIR)
index d1ac388a42ec9eb36c04196cac63f57d55b913ce..da757b28ad9bbdad35c2d962a78c92515c726923 100644 (file)
@@ -1,27 +1,51 @@
 typedef struct _F_STACK_FRAME {
+       /* ===== 24 bytes reserved ===== */
        struct _F_STACK_FRAME *previous;
+
        CELL padding1;
-       CELL return_address;
+
+       /* Callee stores our LR here */
+       XT return_address;
+
        CELL padding2;
+       CELL padding3;
+       CELL padding4;
+       /* ===== 32 bytes saved register area ===== */
+       CELL padding5[8];
+
+       /* ===== 16 byte local variable area ===== */
+
+       /* In compiled quotation frames, the quot->array slot.
+       In compiled word frames, unused. */
+       CELL array;
+
+       /* In compiled quotation frames, position within the array.
+       In compiled word frames, unused. */
+       CELL scan;
+
+       /* In all compiled frames, the XT on entry. */
+       XT xt;
+
+       /* ===== 12 byte padding to make it 16 byte aligned ===== */
+       CELL padding6[3];
 } F_STACK_FRAME;
 
-#define SIGSEGV_EXC_STATE_TYPE ppc_exception_state_t
-#define SIGSEGV_EXC_STATE_FLAVOR PPC_EXCEPTION_STATE
-#define SIGSEGV_EXC_STATE_COUNT PPC_EXCEPTION_STATE_COUNT
-#define SIGSEGV_EXC_STATE_FAULT(exc_state) (exc_state).dar
-#define SIGSEGV_THREAD_STATE_TYPE ppc_thread_state_t
-#define SIGSEGV_THREAD_STATE_FLAVOR PPC_THREAD_STATE
-#define SIGSEGV_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
-#define SIGSEGV_STACK_POINTER(thr_state) (thr_state).r1
-#define SIGSEGV_THREAD_STATE_ARG(thr_state) (thr_state).r3
-#define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).srr0
-
-INLINE unsigned long fix_stack_ptr(unsigned long sp)
-{
-         return sp;
-}
-
-INLINE void pass_arg0(SIGSEGV_THREAD_STATE_TYPE *thr_state, CELL arg)
-{
-       SIGSEGV_THREAD_STATE_ARG(*thr_state) = arg;
-}
+#define MACH_EXC_STATE_TYPE ppc_exception_state_t
+#define MACH_EXC_STATE_FLAVOR PPC_EXCEPTION_STATE
+#define MACH_EXC_STATE_COUNT PPC_EXCEPTION_STATE_COUNT
+#define MACH_THREAD_STATE_TYPE ppc_thread_state_t
+#define MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE
+#define MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
+
+#if __DARWIN_UNIX03
+    #define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->__dar
+    #define MACH_STACK_POINTER(thr_state) (thr_state)->__r1
+    #define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->__srr0
+#else
+    #define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->dar
+    #define MACH_STACK_POINTER(thr_state) (thr_state)->r1
+    #define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->srr0
+#endif
+
+#define UAP_PROGRAM_COUNTER(ucontext) \
+       MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
index 7bf12998bb0cdbc2dc5cab544dbd6896cda335a2..75a1a8cfe01f5c85454f0073279274f96b5dc9c4 100644 (file)
@@ -1,12 +1,19 @@
-#define SIGSEGV_EXC_STATE_TYPE i386_exception_state_t
-#define SIGSEGV_EXC_STATE_FLAVOR i386_EXCEPTION_STATE
-#define SIGSEGV_EXC_STATE_COUNT i386_EXCEPTION_STATE_COUNT
-#define SIGSEGV_EXC_STATE_FAULT(exc_state) (exc_state).faultvaddr
-#define SIGSEGV_THREAD_STATE_TYPE i386_thread_state_t
-#define SIGSEGV_THREAD_STATE_FLAVOR i386_THREAD_STATE
-#define SIGSEGV_THREAD_STATE_COUNT i386_THREAD_STATE_COUNT
-#define SIGSEGV_STACK_POINTER(thr_state) (thr_state).esp
-#define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).eip
+#define MACH_EXC_STATE_TYPE i386_exception_state_t
+#define MACH_EXC_STATE_FLAVOR i386_EXCEPTION_STATE
+#define MACH_EXC_STATE_COUNT i386_EXCEPTION_STATE_COUNT
+#define MACH_THREAD_STATE_TYPE i386_thread_state_t
+#define MACH_THREAD_STATE_FLAVOR i386_THREAD_STATE
+#define MACH_THREAD_STATE_COUNT i386_THREAD_STATE_COUNT
+
+#if __DARWIN_UNIX03
+    #define MACH_EXC_STATE_FAULT(exc_state) (exc_state).__faultvaddr
+    #define MACH_STACK_POINTER(thr_state) (thr_state).__esp
+    #define MACH_PROGRAM_COUNTER(thr_state) (thr_state).__eip
+#else
+    #define MACH_EXC_STATE_FAULT(exc_state) (exc_state).faultvaddr
+    #define MACH_STACK_POINTER(thr_state) (thr_state).esp
+    #define MACH_PROGRAM_COUNTER(thr_state) (thr_state).eip
+#endif
 
 /* Adjust stack pointer so we can push an arg */
 INLINE unsigned long fix_stack_ptr(unsigned long sp)
@@ -14,8 +21,8 @@ INLINE unsigned long fix_stack_ptr(unsigned long sp)
          return sp - (sp & 0xf);
 }
 
-INLINE void pass_arg0(SIGSEGV_THREAD_STATE_TYPE *thr_state, CELL arg)
+INLINE void pass_arg0(MACH_THREAD_STATE_TYPE *thr_state, CELL arg)
 {
-       *(CELL *)thr_state->esp = arg;
-       thr_state->esp -= CELLS;
+       *(CELL *)MACH_STACK_POINTER(*thr_state) = arg;
+       MACH_STACK_POINTER(*thr_state) -= CELLS;
 }
index 5d771d26dfb265c7d3db4a1aaf1106452a50bbce..abd0bf5305ff58cd85c596d89569c98d39c11c5e 100644 (file)
@@ -1,4 +1,13 @@
+#define DLLEXPORT __attribute__((visibility("default")))
 #define FACTOR_OS_STRING "macosx"
+#define NULL_DLL "libfactor.dylib"
+#define UNKNOWN_TYPE_P(file) ((file)->d_type == DT_UNKNOWN)
+#define DIRECTORY_P(file) ((file)->d_type == DT_DIR)
+
 void init_signals(void);
 void early_init(void);
+
+const char *vm_executable_path(void);
 const char *default_image_path(void);
+
+DLLEXPORT void c_to_factor_toplevel(CELL quot);
index 952c06e5865afe32b9bafc3fff5031ff3fc8c252..07695b77fb3cfdc5ca3baef9f03bb3ce681b43e0 100644 (file)
@@ -1,62 +1,61 @@
-#include "factor.h"
+#import <Cocoa/Cocoa.h>
 
-#import "Foundation/NSAutoreleasePool.h"
-#import "Foundation/NSBundle.h"
-#import "Foundation/NSException.h"
-#import "Foundation/NSString.h"
-#import "Foundation/NSPathUtilities.h"
+#include "master.h"
 
-static CELL error;
-
-/* This code is convoluted because Cocoa places restrictions on longjmp and
-exception handling. In particular, a longjmp can never cross an NS_DURING,
-NS_HANDLER or NS_ENDHANDLER. */
-void run()
+void c_to_factor_toplevel(CELL quot)
 {
-       error = F;
-
        for(;;)
        {
 NS_DURING
-               stack_chain->native_stack_pointer = native_stack_pointer();
-               SETJMP(stack_chain->toplevel);
-               handle_error();
-
-               if(error != F)
-               {
-                       CELL e = error;
-                       error = F;
-                       simple_error(ERROR_OBJECTIVE_C,e,F);
-               }
-
-               interpreter_loop();
+               c_to_factor(quot);
                NS_VOIDRETURN;
 NS_HANDLER
-               error = allot_alien(F,(CELL)localException);
+               dpush(allot_alien(F,(CELL)localException));
+               quot = userenv[COCOA_EXCEPTION_ENV];
+               if(type_of(quot) != QUOTATION_TYPE)
+               {
+                       /* No Cocoa exception handler was registered, so
+                       extra/cocoa/ is not loaded. So we pass the exception
+                       along. */
+                       [localException raise];
+               }
 NS_ENDHANDLER
        }
 }
 
-void run_toplevel(void)
+void early_init(void)
 {
-       run();
+       [[NSAutoreleasePool alloc] init];
 }
 
-void early_init(void)
+const char *vm_executable_path(void)
 {
-       [[NSAutoreleasePool alloc] init];
+       return [[[NSBundle mainBundle] executablePath] cString];
 }
 
 const char *default_image_path(void)
 {
        NSBundle *bundle = [NSBundle mainBundle];
        NSString *path = [bundle bundlePath];
-       NSString *image;
+       NSString *executable = [[bundle executablePath] lastPathComponent];
+       NSString *image = [executable stringByAppendingString:@".image"];
+
+       NSString *returnVal;
+
        if([path hasSuffix:@".app"] || [path hasSuffix:@".app/"])
-               image = [[path stringByDeletingLastPathComponent] stringByAppendingString:@"/factor.image"];
+       {
+               NSFileManager *mgr = [NSFileManager defaultManager];
+
+               NSString *imageInBundle = [[path stringByAppendingPathComponent:@"Contents/Resources"] stringByAppendingPathComponent:image];
+               NSString *imageAlongBundle = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:image];
+
+               returnVal = ([mgr fileExistsAtPath:imageInBundle]
+                       ? imageInBundle : imageAlongBundle);
+       }
        else
-               image = [path stringByAppendingString:@"/factor.image"];
-       return [image cString];
+               returnVal = [path stringByAppendingPathComponent:image];
+
+       return [returnVal cString];
 }
 
 void init_signals(void)
@@ -64,3 +63,12 @@ void init_signals(void)
        unix_init_signals();
        mach_initialize();
 }
+
+/* Amateurs at Apple: implement this function, properly! */
+Protocol *objc_getProtocol(char *name)
+{
+       if(strcmp(name,"NSTextInput") == 0)
+               return @protocol(NSTextInput);
+       else
+               return nil;
+}
diff --git a/vm/os-openbsd-amd64.h b/vm/os-openbsd-amd64.h
new file mode 100644 (file)
index 0000000..ff225c3
--- /dev/null
@@ -0,0 +1,7 @@
+INLINE void *openbsd_stack_pointer(void *uap)
+{
+       ucontext_t *ucontext = (ucontext_t *)uap;
+       return (void *)ucontext->sc_rsp;
+}
+
+#define ucontext_stack_pointer openbsd_stack_pointer
diff --git a/vm/os-openbsd-x86.h b/vm/os-openbsd-x86.h
new file mode 100644 (file)
index 0000000..7e1e489
--- /dev/null
@@ -0,0 +1,7 @@
+INLINE void *openbsd_stack_pointer(void *uap)
+{
+       ucontext_t *ucontext = (ucontext_t *)uap;
+       return (void *)ucontext->sc_esp;
+}
+
+#define ucontext_stack_pointer openbsd_stack_pointer
diff --git a/vm/os-openbsd.c b/vm/os-openbsd.c
new file mode 100644 (file)
index 0000000..b9238b7
--- /dev/null
@@ -0,0 +1,6 @@
+#include "master.h"
+
+const char *vm_executable_path(void)
+{
+       return NULL;
+}
diff --git a/vm/os-openbsd.h b/vm/os-openbsd.h
new file mode 100644 (file)
index 0000000..af47f7b
--- /dev/null
@@ -0,0 +1,2 @@
+#define UNKNOWN_TYPE_P(file) ((file)->d_type == DT_UNKNOWN)
+#define DIRECTORY_P(file) ((file)->d_type == DT_DIR)
diff --git a/vm/os-solaris.c b/vm/os-solaris.c
new file mode 100644 (file)
index 0000000..b9238b7
--- /dev/null
@@ -0,0 +1,6 @@
+#include "master.h"
+
+const char *vm_executable_path(void)
+{
+       return NULL;
+}
index da743aee1a14db82f4fa5c831e733cff98fdc258..788a78090bfbecd70cd8d3b8b32f461a74f5d563 100644 (file)
@@ -1 +1,2 @@
-#define FACTOR_OS_STRING "solaris"
+#define UNKNOWN_TYPE_P(file) 1
+#define DIRECTORY_P(file) 0
diff --git a/vm/os-unix-ucontext.h b/vm/os-unix-ucontext.h
new file mode 100644 (file)
index 0000000..9ed0620
--- /dev/null
@@ -0,0 +1,7 @@
+#include <ucontext.h>
+
+INLINE void *ucontext_stack_pointer(void *uap)
+{
+       ucontext_t *ucontext = (ucontext_t *)uap;
+       return ucontext->uc_stack.ss_sp;
+}
index 8f46169d9d57e153ec9d088c195d6d68ad1e859f..2d9ba02ca5ca4d93ed21732a66b58f5d47e414d3 100644 (file)
@@ -1,4 +1,4 @@
-#include "factor.h"
+#include "master.h"
 
 static void *null_dll;
 
@@ -6,12 +6,18 @@ s64 current_millis(void)
 {
        struct timeval t;
        gettimeofday(&t,NULL);
-       return (s64)t.tv_sec * 1000 + t.tv_usec/1000;
+       return (s64)t.tv_sec * 1000 + t.tv_usec / 1000;
+}
+
+void sleep_millis(CELL msec)
+{
+       usleep(msec * 1000);
 }
 
 void init_ffi(void)
 {
-       null_dll = dlopen(NULL,RTLD_LAZY);
+       /* NULL_DLL is "libfactor.dylib" for OS X and NULL for generic unix */
+       null_dll = dlopen(NULL_DLL,RTLD_LAZY);
 }
 
 void ffi_dlopen(F_DLL *dll, bool error)
@@ -22,8 +28,9 @@ void ffi_dlopen(F_DLL *dll, bool error)
        {
                if(error)
                {
-                       simple_error(ERROR_FFI,F,
-                               tag_object(from_char_string(dlerror())));
+                       general_error(ERROR_FFI,F,
+                               tag_object(from_char_string(dlerror())),
+                               NULL);
                }
                else
                        dll->dll = NULL;
@@ -34,35 +41,23 @@ void ffi_dlopen(F_DLL *dll, bool error)
        dll->dll = dllptr;
 }
 
-void *ffi_dlsym(F_DLL *dll, char *symbol, bool error)
+void *ffi_dlsym(F_DLL *dll, F_SYMBOL *symbol)
 {
        void *handle = (dll == NULL ? null_dll : dll->dll);
-       void *sym = dlsym(handle,symbol);
-       if(sym == NULL)
-       {
-               if(error)
-               {
-                       simple_error(ERROR_FFI,
-                               tag_object(from_char_string(symbol)),
-                               tag_object(from_char_string(dlerror())));
-               }
-
-               return NULL;
-       }
-       return sym;
+       return dlsym(handle,symbol);
 }
 
 void ffi_dlclose(F_DLL *dll)
 {
        if(dlclose(dll->dll))
        {
-               simple_error(ERROR_FFI,tag_object(
-                       from_char_string(dlerror())),F);
+               general_error(ERROR_FFI,tag_object(
+                       from_char_string(dlerror())),F,NULL);
        }
        dll->dll = NULL;
 }
 
-void primitive_stat(void)
+DEFINE_PRIMITIVE(stat)
 {
        struct stat sb;
 
@@ -82,7 +77,20 @@ void primitive_stat(void)
        }
 }
 
-void primitive_read_dir(void)
+/* Allocates memory */
+CELL parse_dir_entry(struct dirent *file)
+{
+       CELL name = tag_object(from_char_string(file->d_name));
+       if(UNKNOWN_TYPE_P(file))
+               return name;
+       else
+       {
+               CELL dirp = tag_boolean(DIRECTORY_P(file));
+               return allot_array_2(name,dirp);
+       }
+}
+
+DEFINE_PRIMITIVE(read_dir)
 {
        DIR* dir = opendir(unbox_char_string());
        GROWABLE_ARRAY(result);
@@ -93,10 +101,10 @@ void primitive_read_dir(void)
 
                while((file = readdir(dir)) != NULL)
                {
-                       REGISTER_ARRAY(result);
-                       CELL name = tag_object(from_char_string(file->d_name));
-                       UNREGISTER_ARRAY(result);
-                       GROWABLE_ADD(result,name);
+                       REGISTER_UNTAGGED(result);
+                       CELL pair = parse_dir_entry(file);
+                       UNREGISTER_UNTAGGED(result);
+                       GROWABLE_ADD(result,pair);
                }
 
                closedir(dir);
@@ -107,7 +115,7 @@ void primitive_read_dir(void)
        dpush(tag_object(result));
 }
 
-void primitive_cwd(void)
+DEFINE_PRIMITIVE(cwd)
 {
        char wd[MAXPATHLEN];
        if(getcwd(wd,MAXPATHLEN) == NULL)
@@ -115,7 +123,7 @@ void primitive_cwd(void)
        box_char_string(wd);
 }
 
-void primitive_cd(void)
+DEFINE_PRIMITIVE(cd)
 {
        chdir(unbox_char_string());
 }
@@ -124,12 +132,12 @@ F_SEGMENT *alloc_segment(CELL size)
 {
        int pagesize = getpagesize();
 
-       char *array = mmap((void*)0,pagesize + size + pagesize,
+       char *array = mmap(NULL,pagesize + size + pagesize,
                PROT_READ | PROT_WRITE | PROT_EXEC,
                MAP_ANON | MAP_PRIVATE,-1,0);
 
-       if(array == NULL)
-               fatal_error("Cannot allocate memory region",0);
+       if(array == (char*)-1)
+               fatal_error("Out of memory in alloc_segment",0);
 
        if(mprotect(array,pagesize,PROT_NONE) == -1)
                fatal_error("Cannot protect low guard page",(CELL)array);
@@ -138,9 +146,10 @@ F_SEGMENT *alloc_segment(CELL size)
                fatal_error("Cannot protect high guard page",(CELL)array);
 
        F_SEGMENT *retval = safe_malloc(sizeof(F_SEGMENT));
-       
+
        retval->start = (CELL)(array + pagesize);
        retval->size = size;
+       retval->end = retval->start + size;
 
        return retval;
 }
@@ -153,26 +162,45 @@ void dealloc_segment(F_SEGMENT *block)
                pagesize + block->size + pagesize);
        
        if(retval)
-               fatal_error("Failed to unmap region",0);
+               fatal_error("dealloc_segment failed",0);
 
        free(block);
 }
-
+  
 INLINE F_STACK_FRAME *uap_stack_pointer(void *uap)
 {
-       ucontext_t *ucontext = (ucontext_t *)uap;
-       return (F_STACK_FRAME *)ucontext->uc_stack.ss_sp;
+       /* There is a race condition here, but in practice a signal
+       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 */
+       if(in_code_heap_p(UAP_PROGRAM_COUNTER(uap)))
+               return ucontext_stack_pointer(uap);
+       else
+               return NULL;
+}
+
+void memory_signal_handler_impl(void)
+{
+       memory_protection_error(signal_fault_addr,signal_callstack_top);
 }
 
 void memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
-       memory_protection_error((CELL)siginfo->si_addr,signal,
-               uap_stack_pointer(uap));
+       signal_fault_addr = (CELL)siginfo->si_addr;
+       signal_callstack_top = uap_stack_pointer(uap);
+       UAP_PROGRAM_COUNTER(uap) = (CELL)memory_signal_handler_impl;
+}
+
+void misc_signal_handler_impl(void)
+{
+       signal_error(signal_number,signal_callstack_top);
 }
 
 void misc_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
-       signal_error(signal,uap_stack_pointer(uap));
+       signal_number = signal;
+       signal_callstack_top = uap_stack_pointer(uap);
+       UAP_PROGRAM_COUNTER(uap) = (CELL)misc_signal_handler_impl;
 }
 
 static void sigaction_safe(int signum, const struct sigaction *act, struct sigaction *oldact)
@@ -189,8 +217,9 @@ void unix_init_signals(void)
 {
        struct sigaction memory_sigaction;
        struct sigaction misc_sigaction;
-       struct sigaction ign_sigaction;
-       
+       struct sigaction ignore_sigaction;
+
+       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;
@@ -198,6 +227,7 @@ void unix_init_signals(void)
        sigaction_safe(SIGBUS,&memory_sigaction,NULL);
        sigaction_safe(SIGSEGV,&memory_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;
@@ -206,10 +236,11 @@ void unix_init_signals(void)
        sigaction_safe(SIGFPE,&misc_sigaction,NULL);
        sigaction_safe(SIGQUIT,&misc_sigaction,NULL);
        sigaction_safe(SIGILL,&misc_sigaction,NULL);
-       
-       sigemptyset(&ign_sigaction.sa_mask);
-       ign_sigaction.sa_handler = SIG_IGN;
-       sigaction_safe(SIGPIPE,&ign_sigaction,NULL);
+
+       memset(&ignore_sigaction,0,sizeof(struct sigaction));
+       sigemptyset(&ignore_sigaction.sa_mask);
+       ignore_sigaction.sa_handler = SIG_IGN;
+       sigaction_safe(SIGPIPE,&ignore_sigaction,NULL);
 }
 
 void reset_stdio(void)
index ca0e6f52b2bff8a92f12b252e32b8f307cabf02f..c1239bb83c38c299c12e6ad0d9a81afff8bd10f5 100644 (file)
@@ -5,28 +5,46 @@
 #include <unistd.h>
 #include <sys/time.h>
 #include <dlfcn.h>
-#include <ucontext.h>
+#include <signal.h>
 
-#define DLLEXPORT
-#define SETJMP(jmpbuf) sigsetjmp(jmpbuf,1)
-#define LONGJMP siglongjmp
-#define JMP_BUF sigjmp_buf
+typedef char F_CHAR;
+typedef char F_SYMBOL;
+
+#define from_native_string from_char_string
+#define unbox_native_string unbox_char_string
+#define string_to_native_alien(string) string_to_char_alien(string,true)
+#define unbox_symbol_string unbox_char_string
+
+#define STR_FORMAT(string) string
+
+#define SSCANF sscanf
+#define STRCMP strcmp
+#define STRNCMP strncmp
+#define STRDUP strdup
+
+#define OPEN_READ(path) fopen(path,"rb")
+#define OPEN_WRITE(path) fopen(path,"wb")
+#define FPRINTF(stream,format,arg) fprintf(stream,format,arg)
 
 void init_ffi(void);
 void ffi_dlopen(F_DLL *dll, bool error);
-void *ffi_dlsym(F_DLL *dll, char *symbol, bool error);
+void *ffi_dlsym(F_DLL *dll, F_SYMBOL *symbol);
 void ffi_dlclose(F_DLL *dll);
 
 void unix_init_signals(void);
 void signal_handler(int signal, siginfo_t* siginfo, void* uap);
 void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap);
 
-void primitive_open_file(void);
-void primitive_stat(void);
-void primitive_read_dir(void);
-void primitive_cwd(void);
-void primitive_cd(void);
-
 s64 current_millis(void);
+void sleep_millis(CELL msec);
 
 void reset_stdio(void);
+
+/* Global variables used to pass fault handler state from signal handler to
+user-space */
+CELL signal_number;
+CELL signal_fault_addr;
+void *signal_callstack_top;
+
+void memory_signal_handler_impl(void);
+void misc_signal_handler_impl(void);
diff --git a/vm/os-windows-ce-arm.S b/vm/os-windows-ce-arm.S
new file mode 100644 (file)
index 0000000..9e9ed2a
--- /dev/null
@@ -0,0 +1,18 @@
+       .text
+
+       .globl run_toplevel
+
+       .word exception_handler 
+       .word 0
+
+run_toplevel:
+       ldr pc, _Prun
+
+
+_Prun:  .word run
+
+       .section .pdata
+       .word run_toplevel
+
+       .word 0xc0000002 | (0xFFFFF << 8)
+
diff --git a/vm/os-windows-ce.c b/vm/os-windows-ce.c
new file mode 100644 (file)
index 0000000..1d6547d
--- /dev/null
@@ -0,0 +1,46 @@
+#include "master.h"
+
+s64 current_millis(void)
+{
+       SYSTEMTIME st;
+       FILETIME ft;
+       GetSystemTime(&st);
+       SystemTimeToFileTime(&st, &ft);
+       return (((s64)ft.dwLowDateTime
+               | (s64)ft.dwHighDateTime<<32) - EPOCH_OFFSET) / 10000;
+}
+
+DEFINE_PRIMITIVE(cwd)
+{
+       not_implemented_error();
+}
+
+DEFINE_PRIMITIVE(cd)
+{
+       not_implemented_error();
+}
+
+char *strerror(int err)
+{
+       /* strerror() is not defined on WinCE */
+       return "strerror() is not defined on WinCE. Use native io";
+}
+
+void flush_icache()
+{
+       FlushInstructionCache(GetCurrentProcess(), 0, 0);
+}
+
+char *getenv(char *name)
+{
+       not_implemented_error();
+       return 0; /* unreachable */
+}
+
+long exception_handler(PEXCEPTION_RECORD rec, void *frame, void *ctx, void *dispatch)
+{
+       memory_protection_error(
+               rec->ExceptionInformation[1] & 0x1ffffff,
+               native_stack_pointer());
+       return -1; /* unreachable */
+}
diff --git a/vm/os-windows-ce.h b/vm/os-windows-ce.h
new file mode 100644 (file)
index 0000000..1010359
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef UNICODE
+#define UNICODE
+#endif
+
+#include <ctype.h>
+
+typedef wchar_t F_SYMBOL;
+
+#define unbox_symbol_string unbox_u16_string
+#define from_symbol_string from_u16_string
+
+#define FACTOR_OS_STRING "wince"
+#define FACTOR_DLL L"factor-ce.dll"
+#define FACTOR_DLL_NAME "factor-ce.dll"
+
+int errno;
+char *strerror(int err);
+void flush_icache();
+char *getenv(char *name);
+
+#define snprintf _snprintf
+#define snwprintf _snwprintf
+#define EINTR 0
+
+s64 current_millis(void);
+
+DECLARE_PRIMITIVE(cwd);
+DECLARE_PRIMITIVE(cd);
+
diff --git a/vm/os-windows-nt.c b/vm/os-windows-nt.c
new file mode 100644 (file)
index 0000000..2a87a85
--- /dev/null
@@ -0,0 +1,53 @@
+#include "master.h"
+
+s64 current_millis(void)
+{
+       FILETIME t;
+       GetSystemTimeAsFileTime(&t);
+       return (((s64)t.dwLowDateTime | (s64)t.dwHighDateTime<<32)
+               - EPOCH_OFFSET) / 10000;
+}
+
+DEFINE_PRIMITIVE(cwd)
+{
+       F_CHAR buf[MAX_PATH + 4];
+
+       if(!GetCurrentDirectory(MAX_PATH + 4, buf))
+               io_error();
+
+       box_u16_string(buf);
+}
+
+DEFINE_PRIMITIVE(cd)
+{
+       SetCurrentDirectory(unbox_u16_string());
+}
+
+void seh_call(void (*func)(), exception_handler_t *handler)
+{
+       exception_record_t record;
+       asm volatile("mov %%fs:0, %0" : "=r" (record.next_handler));
+       asm volatile("mov %0, %%fs:0" : : "r" (&record));
+       record.handler_func = handler;
+       func();
+       asm volatile("mov %0, %%fs:0" : "=r" (record.next_handler));
+}
+
+long exception_handler(PEXCEPTION_RECORD rec, void *frame, void *ctx, void *dispatch)
+{
+       if(rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
+               memory_protection_error(
+                       rec->ExceptionInformation[1],
+                       native_stack_pointer());
+       else if(rec->ExceptionCode == EXCEPTION_FLT_DIVIDE_BY_ZERO
+                       || rec->ExceptionCode == EXCEPTION_INT_DIVIDE_BY_ZERO)
+               general_error(ERROR_DIVIDE_BY_ZERO,F,F,false,(void*)rec->ExceptionInformation[1]);
+       else
+               signal_error(11,(void*)rec->ExceptionInformation[1]);
+       return -1; /* unreachable */
+}
+
+void run_toplevel(void)
+{
+       seh_call(run, exception_handler);
+}
diff --git a/vm/os-windows-nt.h b/vm/os-windows-nt.h
new file mode 100644 (file)
index 0000000..514da31
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef UNICODE
+#define UNICODE
+#endif
+
+typedef char F_SYMBOL;
+
+#define unbox_symbol_string unbox_char_string
+#define from_symbol_string from_char_string
+
+#define FACTOR_OS_STRING "windows"
+#define FACTOR_DLL L"factor-nt.dll"
+#define FACTOR_DLL_NAME "factor-nt.dll"
index 2001662ee1f790fa788274dd057c840c88666da2..823fd7e9d0d7bed63801ebbc71e706d55efae53a 100644 (file)
@@ -1,54 +1,57 @@
-#include "factor.h"
+#include "master.h"
 
 F_STRING *get_error_message()
 {
        DWORD id = GetLastError();
-       char *msg = error_message(id);
-       F_STRING *string = from_char_string(msg);
+       F_CHAR *msg = error_message(id);
+       F_STRING *string = from_u16_string(msg);
        LocalFree(msg);
        return string;
 }
 
 /* You must LocalFree() the return value! */
-char *error_message(DWORD id)
+F_CHAR *error_message(DWORD id)
 {
-       char *buffer;
+       F_CHAR *buffer;
        int index;
 
-       FormatMessage(
+       DWORD ret = FormatMessage(
                FORMAT_MESSAGE_ALLOCATE_BUFFER |
                FORMAT_MESSAGE_FROM_SYSTEM,
                NULL,
                id,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-               (LPTSTR) &buffer,
+               (LPTSTR)(void *) &buffer,
                0, NULL);
+       if(ret == 0)
+               return error_message(GetLastError());
 
        /* strip whitespace from end */
-       index = strlen(buffer) - 1;
+       index = wcslen(buffer) - 1;
        while(index >= 0 && isspace(buffer[index]))
                buffer[index--] = 0;
 
        return buffer;
 }
 
-s64 current_millis(void)
+HMODULE hFactorDll;
+
+void init_ffi()
 {
-       FILETIME t;
-       GetSystemTimeAsFileTime(&t);
-       return (((s64)t.dwLowDateTime | (s64)t.dwHighDateTime<<32)
-               - EPOCH_OFFSET) / 10000;
+       hFactorDll = GetModuleHandle(FACTOR_DLL);
+       if(!hFactorDll)
+               fatal_error("GetModuleHandle(\"" FACTOR_DLL_NAME "\") failed", 0);
 }
 
 void ffi_dlopen (F_DLL *dll, bool error)
 {
-       HMODULE module = LoadLibrary(alien_offset(dll->path));
+       HMODULE module = LoadLibraryEx(alien_offset(dll->path), NULL, 0);
 
        if (!module)
        {
                dll->dll = NULL;
                if(error)
-                       simple_error(ERROR_FFI,F,
+                       general_error(ERROR_FFI,F,
                                tag_object(get_error_message()));
                else
                        return;
@@ -57,39 +60,54 @@ void ffi_dlopen (F_DLL *dll, bool error)
        dll->dll = module;
 }
 
-void *ffi_dlsym (F_DLL *dll, char *symbol, bool error)
+void *ffi_dlsym(F_DLL *dll, F_SYMBOL *symbol)
 {
-       void *sym = GetProcAddress(
-               dll ? (HMODULE)dll->dll : GetModuleHandle(NULL),
-               symbol);
-
-       if (!sym)
-       {
-               if(error)
-                       simple_error(ERROR_FFI,
-                               tag_object(from_char_string(symbol)),
-                               tag_object(get_error_message()));
-               else
-                       return NULL;
-       }
-
-       return sym;
+       return GetProcAddress(dll ? (HMODULE)dll->dll : hFactorDll, symbol);
 }
 
-void ffi_dlclose (F_DLL *dll)
+void ffi_dlclose(F_DLL *dll)
 {
        FreeLibrary((HMODULE)dll->dll);
        dll->dll = NULL;
 }
 
-void primitive_stat(void)
+/* You must free() this yourself. */
+const F_CHAR *default_image_path(void)
 {
-       WIN32_FILE_ATTRIBUTE_DATA st;
+       F_CHAR full_path[MAX_UNICODE_PATH];
+       F_CHAR *ptr;
+       F_CHAR path_temp[MAX_UNICODE_PATH];
+
+       if(!GetModuleFileName(NULL, full_path, MAX_UNICODE_PATH))
+               fatal_error("GetModuleFileName() failed", 0);
+
+       if((ptr = wcsrchr(full_path, '.')))
+               *ptr = 0;
+
+       snwprintf(path_temp, sizeof(path_temp)-1, L"%s.image", full_path); 
+       path_temp[sizeof(path_temp) - 1] = 0;
 
-       if(!GetFileAttributesEx(
-               unbox_char_string(),
-               GetFileExInfoStandard,
-               &st))
+       return safe_strdup(path_temp);
+}
+
+/* You must free() this yourself. */
+const F_CHAR *vm_executable_path(void)
+{
+       F_CHAR full_path[MAX_UNICODE_PATH];
+       if(!GetModuleFileName(NULL, full_path, MAX_UNICODE_PATH))
+               fatal_error("GetModuleFileName() failed", 0);
+       return safe_strdup(full_path);
+}
+
+DEFINE_PRIMITIVE(stat)
+{
+       WIN32_FIND_DATA st;
+       HANDLE h;
+
+       F_CHAR *path = unbox_u16_string();
+       if(INVALID_HANDLE_VALUE == (h = FindFirstFile(
+               path,
+               &st)))
        {
                dpush(F);
                dpush(F);
@@ -99,21 +117,20 @@ void primitive_stat(void)
        else
        {
                box_boolean(st.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
-               box_signed_4(0);
+               dpush(tag_fixnum(0));
+               box_unsigned_8(
+                       (u64)st.nFileSizeLow | (u64)st.nFileSizeHigh << 32);
                box_unsigned_8(
-                       (s64)st.nFileSizeLow | (s64)st.nFileSizeHigh << 32);
-               box_unsigned_8((int)
-                       ((*(s64*)&st.ftLastWriteTime - EPOCH_OFFSET) / 10000000));
+                       ((*(u64*)&st.ftLastWriteTime - EPOCH_OFFSET) / 10000000));
+               FindClose(h);
        }
 }
 
-void primitive_read_dir(void)
+DEFINE_PRIMITIVE(read_dir)
 {
        HANDLE dir;
        WIN32_FIND_DATA find_data;
-       char path[MAX_PATH + 4];
-
-       sprintf(path, "%s\\*", unbox_char_string());
+       F_CHAR *path = unbox_u16_string();
 
        GROWABLE_ARRAY(result);
 
@@ -121,11 +138,12 @@ void primitive_read_dir(void)
        {
                do
                {
-                       REGISTER_ARRAY(result);
-                       CELL name = tag_object(from_char_string(
-                               find_data.cFileName));
-                       UNREGISTER_ARRAY(result);
-                       GROWABLE_ADD(result,name);
+                       REGISTER_UNTAGGED(result);
+                       CELL name = tag_object(from_u16_string(find_data.cFileName));
+                       CELL dirp = tag_boolean(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+                       CELL pair = allot_array_2(name,dirp);
+                       UNREGISTER_UNTAGGED(result);
+                       GROWABLE_ADD(result,pair);
                }
                while (FindNextFile(dir, &find_data));
                CloseHandle(dir);
@@ -136,41 +154,27 @@ void primitive_read_dir(void)
        dpush(tag_object(result));
 }
 
-void primitive_cwd(void)
-{
-       char buf[MAX_PATH];
-
-       if(!GetCurrentDirectory(MAX_PATH, buf))
-               io_error();
-
-       box_char_string(buf);
-}
-
-void primitive_cd(void)
-{
-       SetCurrentDirectory(unbox_char_string());
-}
-
 F_SEGMENT *alloc_segment(CELL size)
 {
-       SYSTEM_INFO si;
        char *mem;
        DWORD ignore;
 
-       GetSystemInfo(&si);
-       if((mem = (char *)VirtualAlloc(NULL, si.dwPageSize*2 + size, MEM_COMMIT, PAGE_EXECUTE_READWRITE)) == 0)
-               fatal_error("VirtualAlloc() failed in alloc_segment()",0);
+       if((mem = (char *)VirtualAlloc(NULL, getpagesize() * 2 + size,
+               MEM_COMMIT, PAGE_EXECUTE_READWRITE)) == 0)
+               fatal_error("Out of memory in alloc_segment",0);
 
-       if (!VirtualProtect(mem, si.dwPageSize, PAGE_NOACCESS, &ignore))
+       if (!VirtualProtect(mem, getpagesize(), PAGE_NOACCESS, &ignore))
                fatal_error("Cannot allocate low guard page", (CELL)mem);
 
-       if (!VirtualProtect(mem+size+si.dwPageSize, si.dwPageSize, PAGE_NOACCESS, &ignore))
+       if (!VirtualProtect(mem + size + getpagesize(),
+               getpagesize(), PAGE_NOACCESS, &ignore))
                fatal_error("Cannot allocate high guard page", (CELL)mem);
 
        F_SEGMENT *block = safe_malloc(sizeof(F_SEGMENT));
 
-       block->start = (int)mem + si.dwPageSize;
+       block->start = (CELL)mem + getpagesize();
        block->size = size;
+       block->end = block->start + size;
 
        return block;
 }
@@ -180,7 +184,7 @@ void dealloc_segment(F_SEGMENT *block)
        SYSTEM_INFO si;
        GetSystemInfo(&si);
        if(!VirtualFree((void*)(block->start - si.dwPageSize), 0, MEM_RELEASE))
-               fatal_error("VirtualFree() failed",0);
+               fatal_error("dealloc_segment failed",0);
        free(block);
 }
 
@@ -196,36 +200,9 @@ long getpagesize(void)
        return g_pagesize;
 }
 
-const char *default_image_path(void)
-{
-       return "factor.image";
-}
-
-/* SEH support. Proceed with caution. */
-typedef long exception_handler_t(
-       PEXCEPTION_RECORD rec, void *frame, void *context, void *dispatch);
-
-typedef struct exception_record
-{
-       struct exception_record *next_handler;
-       void *handler_func;
-} exception_record_t;
-
-void seh_call(void (*func)(), exception_handler_t *handler)
-{
-       exception_record_t record;
-       asm("mov %%fs:0, %0" : "=r" (record.next_handler));
-       asm("mov %0, %%fs:0" : : "r" (&record));
-       record.handler_func = handler;
-       func();
-       asm("mov %0, %%fs:0" : "=r" (record.next_handler));
-}
-
-static long exception_handler(PEXCEPTION_RECORD rec, void *frame, void *ctx, void *dispatch)
+void sleep_millis(DWORD msec)
 {
-       memory_protection_error(rec->ExceptionInformation[1],
-               SIGSEGV,native_stack_pointer());
-       return -1; /* unreachable */
+    Sleep(msec);
 }
 
 void run(void)
@@ -233,7 +210,3 @@ void run(void)
        interpreter();
 }
 
-void run_toplevel(void)
-{
-       seh_call(run, exception_handler);
-}
index d5a36ceabb07aefd3b3f6a1722aee6eddc4a2e50..04f5c87ac706282e3c169a9847333a0cf1c492c2 100644 (file)
@@ -1,36 +1,68 @@
 #include <windows.h>
 #include <ctype.h>
 
-#define FACTOR_OS_STRING "windows"
+#ifndef wcslen
+  /* for cygwin */
+  #include <wchar.h>
+#endif
 
+typedef wchar_t F_CHAR;
+
+#define from_native_string from_u16_string
+#define unbox_native_string unbox_u16_string
+#define string_to_native_alien(string) string_to_u16_alien(string,true)
+
+#define STR_FORMAT(string) L##string
+
+#define MAX_UNICODE_PATH 32768
 #define DLLEXPORT __declspec(dllexport)
-#define SETJMP setjmp
-#define LONGJMP longjmp
-#define JMP_BUF jmp_buf
+#define SSCANF swscanf
+#define STRCMP wcscmp
+#define STRNCMP wcsncmp
+#define STRDUP _wcsdup
+
+#define OPEN_READ(path) _wfopen(path,L"rb")
+#define OPEN_WRITE(path) _wfopen(path,L"wb")
+#define FPRINTF(stream,format,arg) fwprintf(stream,L##format,arg)
+
 
 /* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
 #define EPOCH_OFFSET 0x019db1ded53e8000LL
 
-char *buffer_to_c_string(char *buffer);
 F_STRING *get_error_message(void);
-DLLEXPORT char *error_message(DWORD id);
+DLLEXPORT F_CHAR *error_message(DWORD id);
 
-INLINE void init_ffi(void) {}
+void init_ffi(void);
 void ffi_dlopen(F_DLL *dll, bool error);
-void *ffi_dlsym(F_DLL *dll, char *symbol, bool error);
+void *ffi_dlsym(F_DLL *dll, F_SYMBOL *symbol);
 void ffi_dlclose(F_DLL *dll);
 
-void primitive_open_file(void);
-void primitive_stat(void);
-void primitive_read_dir(void);
-void primitive_cwd(void);
-void primitive_cd(void);
+void sleep_millis(DWORD msec);
 
 INLINE void init_signals(void) {}
 INLINE void early_init(void) {}
-const char *default_image_path(void);
+const F_CHAR *vm_executable_path(void);
+const F_CHAR *default_image_path(void);
 long getpagesize (void);
 
 s64 current_millis(void);
 
 INLINE void reset_stdio(void) {}
+
+/* SEH support. Proceed with caution. */
+typedef long exception_handler_t(
+       PEXCEPTION_RECORD rec, void *frame, void *context, void *dispatch);
+
+typedef struct exception_record
+{
+       struct exception_record *next_handler;
+       void *handler_func;
+} exception_record_t;
+
+long exception_handler(PEXCEPTION_RECORD rec, void *frame, void *ctx, void *dispatch);
+
+DECLARE_PRIMITIVE(open_file);
+DECLARE_PRIMITIVE(stat);
+DECLARE_PRIMITIVE(read_dir);
+DECLARE_PRIMITIVE(cwd);
+DECLARE_PRIMITIVE(cd);
index d892e7c98c27e87f2711157a627636fe20099447..602c7e6af5ba7e60210f86dad2fdfc72401a040f 100644 (file)
@@ -1,19 +1,30 @@
-#define INLINE inline static
-
-#if defined(i386) || defined(__i386) || defined(__i386__) || defined(WIN32)
+#if defined(__arm__)
+       #define FACTOR_ARM
+#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(WIN32)
        #define FACTOR_X86
 #elif defined(__POWERPC__) || defined(__ppc__) || defined(_ARCH_PPC)
        #define FACTOR_PPC
 #elif defined(__amd64__) || defined(__x86_64__)
        #define FACTOR_AMD64
+#else
+       #error "Unsupported architecture"
 #endif
 
-#ifdef WINDOWS
+#if defined(WINDOWS)
+       #if defined(WINCE)
+               #include "os-windows-ce.h"
+       #elif defined (__i386)
+               #include "os-windows-nt.h"
+       #else
+               #error "Unsupported Windows flavor"
+       #endif
+
        #include "os-windows.h"
 #else
        #include "os-unix.h"
 
        #ifdef __APPLE__
+               #include "os-unix-ucontext.h"
                #include "os-macosx.h"
                #include "mach_signal.h"
                
                        #include "os-macosx-x86.h"
                #elif defined(FACTOR_PPC)
                        #include "os-macosx-ppc.h"
+               #else
+                       #error "Unsupported Mac OS X flavor"
                #endif
        #else
                #include "os-genunix.h"
+
                #ifdef __FreeBSD__
+                       #define FACTOR_OS_STRING "freebsd"
                        #include "os-freebsd.h"
-               #elif defined(linux)
-                       #ifdef FACTOR_PPC
-                               #include "os-linux-ppc.h"
+                       #include "os-unix-ucontext.h"
+                       
+                       #if defined(FACTOR_X86)
+                               #include "os-freebsd-x86.h"
+                       #else
+                               #error "Unsupported FreeBSD flavor"
                        #endif
+               #elif defined(__OpenBSD__)
+                       #define FACTOR_OS_STRING "openbsd"
+                       #include "os-openbsd.h"
 
+                       #if defined(FACTOR_X86)
+                               #include "os-openbsd-x86.h"
+                       #elif defined(FACTOR_AMD64)
+                               #include "os-openbsd-amd64.h"
+                       #else
+                               #error "Unsupported OpenBSD flavor"
+                       #endif
+               #elif defined(linux)
+                       #define FACTOR_OS_STRING "linux"
                        #include "os-linux.h"
-               #elif defined(__sun)
+
+                       #if defined(FACTOR_X86)
+                               #include "os-unix-ucontext.h"
+                       #elif defined(FACTOR_PPC)
+                               #include "os-unix-ucontext.h"
+                               #include "os-linux-ppc.h"
+                       #elif defined(FACTOR_ARM)
+                               #include "os-linux-arm.h"
+                       #elif defined(FACTOR_AMD64)
+                               #include "os-unix-ucontext.h"
+                       #else
+                               #error "Unsupported Linux flavor"
+                       #endif
+               #elif defined(__SVR4) && defined(sun)
+                       #define FACTOR_OS_STRING "solaris"
                        #include "os-solaris.h"
+                       #include "os-unix-ucontext.h"
                #else
                        #error "Unsupported OS"
                #endif
        #endif
 #endif
 
-#ifdef FACTOR_X86
+#if defined(FACTOR_X86)
        #include "cpu-x86.h"
 #elif defined(FACTOR_PPC)
        #include "cpu-ppc.h"
 #elif defined(FACTOR_AMD64)
        #include "cpu-amd64.h"
+#elif defined(FACTOR_ARM)
+       #include "cpu-arm.h"
 #else
        #error "Unsupported CPU"
 #endif
index 65c5ce5d02e95c0165a02e324e5983fbd4b9770e..f94412c7275f7c96a6690ce227a1d13c94fc9466 100644 (file)
@@ -1,14 +1,9 @@
-#include "factor.h"
+#include "master.h"
 
-void* primitives[] = {
-       undefined,
-       docol,
-       dosym,
+void *primitives[] = {
        primitive_execute,
        primitive_call,
-       primitive_ifte,
-       primitive_dispatch,
-       primitive_rehash_string,
+       primitive_uncurry,
        primitive_string_to_sbuf,
        primitive_bignum_to_fixnum,
        primitive_float_to_fixnum,
@@ -29,6 +24,7 @@ void* primitives[] = {
        primitive_fixnum_subtract,
        primitive_fixnum_subtract_fast,
        primitive_fixnum_multiply,
+       primitive_fixnum_multiply_fast,
        primitive_fixnum_divint,
        primitive_fixnum_mod,
        primitive_fixnum_divmod,
@@ -57,6 +53,10 @@ void* primitives[] = {
        primitive_bignum_lesseq,
        primitive_bignum_greater,
        primitive_bignum_greatereq,
+       primitive_bignum_bitp,
+       primitive_bignum_log2,
+       primitive_byte_array_to_bignum,
+       primitive_float_eq,
        primitive_float_add,
        primitive_float_subtract,
        primitive_float_multiply,
@@ -96,6 +96,7 @@ void* primitives[] = {
        primitive_code_gc,
        primitive_gc_time,
        primitive_save_image,
+       primitive_save_image_and_exit,
        primitive_datastack,
        primitive_retainstack,
        primitive_callstack,
@@ -116,6 +117,7 @@ void* primitives[] = {
        primitive_dlsym,
        primitive_dlclose,
        primitive_byte_array,
+       primitive_bit_array,
        primitive_displaced_alien,
        primitive_alien_signed_cell,
        primitive_set_alien_signed_cell,
@@ -141,6 +143,8 @@ void* primitives[] = {
        primitive_set_alien_float,
        primitive_alien_double,
        primitive_set_alien_double,
+       primitive_alien_cell,
+       primitive_set_alien_cell,
        primitive_alien_to_char_string,
        primitive_string_to_char_alien,
        primitive_alien_to_u16_string,
@@ -165,19 +169,26 @@ void* primitives[] = {
        primitive_finalize_compile,
        primitive_fopen,
        primitive_fgetc,
+       primitive_fread,
        primitive_fwrite,
        primitive_fflush,
        primitive_fclose,
-       primitive_expired,
        primitive_wrapper,
        primitive_clone,
-       primitive_become,
        primitive_array_to_vector,
        primitive_string,
-       primitive_xt_map
+       primitive_to_tuple,
+       primitive_array_to_quotation,
+       primitive_quotation_xt,
+       primitive_tuple,
+       primitive_tuple_to_array,
+       primitive_profiling,
+       primitive_become,
+       primitive_sleep,
+       primitive_float_array,
+       primitive_curry,
+       primitive_tuple_boa,
+       primitive_class_hash,
+       primitive_callstack_to_array,
+       primitive_array_to_callstack,
 };
-
-CELL primitive_to_xt(CELL primitive)
-{
-       return (CELL)primitives[primitive];
-}
index 2ed5cdc7685c3b90aad2809f3dad8a2f053f274b..ce22cff5283893fff4890c4a2a44dd028b150daa 100644 (file)
@@ -1,3 +1,39 @@
-extern voidprimitives[];
+extern void *primitives[];
 
-CELL primitive_to_xt(CELL primitive);
+/* Primitives are called with two parameters, the word itself and the current
+callstack pointer. The DEFINE_PRIMITIVE() macro takes care of boilerplate to
+save the current callstack pointer so that GC and other facilities can proceed
+to inspect Factor stack frames below the primitive's C stack frame.
+
+Usage:
+
+DEFINE_PRIMITIVE(name)
+{
+       ... CODE ...
+}
+
+Becomes
+
+FASTCALL void primitive_name(CELL word, F_STACK_FRAME *callstack_top)
+{
+       stack_chain->callstack_top = callstack_top;
+       ... CODE ...
+}
+
+On x86, FASTCALL expands into a GCC declaration which forces the two parameters
+to be passed in registers. This simplifies the quotation compiler and support
+code in cpu-x86.S. */
+#define DEFINE_PRIMITIVE(name) \
+       INLINE void primitive_##name##_impl(void); \
+       \
+       FASTCALL void primitive_##name(CELL word, F_STACK_FRAME *callstack_top) \
+       { \
+               stack_chain->callstack_top = callstack_top; \
+               primitive_##name##_impl(); \
+       } \
+       \
+       INLINE void primitive_##name##_impl(void) \
+
+/* Prototype for header files */
+#define DECLARE_PRIMITIVE(name) \
+       FASTCALL void primitive_##name(CELL word, F_STACK_FRAME *callstack_top)
index eb3887aa55b55321afed04f0399b8e3b445edbf9..2ed7bae7f479689a343ef315c3e0b93e43aaf373 100644 (file)
--- a/vm/run.c
+++ b/vm/run.c
-#include "factor.h"
+#include "master.h"
 
-INLINE void execute(F_WORD* word)
+void uncurry(CELL obj)
 {
-       ((XT)(word->xt))(word);
-}
-
-INLINE void push_callframe(void)
-{
-       put(cs + CELLS,callframe);
-       put(cs + CELLS * 2,callframe_scan);
-       put(cs + CELLS * 3,callframe_end);
-
-       /* update the pointer last, so that if we have a memory protection error
-       above, we don't have garbage stored as live data */
-       cs += CELLS * 3;
-}
-
-INLINE void set_callframe(CELL quot)
-{
-       F_ARRAY *untagged = (F_ARRAY*)UNTAG(quot);
-       type_check(QUOTATION_TYPE,quot);
-       callframe = quot;
-       callframe_scan = AREF(untagged,0);
-       callframe_end = AREF(untagged,array_capacity(untagged));
-}
-
-void call(CELL quot)
-{
-       if(quot == F)
-               return;
-
-       /* tail call optimization */
-       if(callframe_scan < callframe_end)
-               push_callframe();
+       F_CURRY *curry;
 
-       set_callframe(quot);
-}
-
-/* Called from interpreter() */
-void handle_error(void)
-{
-       if(throwing)
+       switch(type_of(obj))
        {
-               gc_off = false;
-               extra_roots = stack_chain->extra_roots;
-
-               if(thrown_keep_stacks)
-               {
-                       ds = thrown_ds;
-                       rs = thrown_rs;
-               }
-               else
-                       fix_stacks();
-
-               dpush(thrown_error);
-               dpush(thrown_native_stack_trace);
-               /* Notify any 'catch' blocks */
-               push_callframe();
-               set_callframe(userenv[BREAK_ENV]);
-               throwing = false;
+       case QUOTATION_TYPE:
+               dpush(obj);
+               break;
+       case CURRY_TYPE:
+               curry = untag_object(obj);
+               dpush(curry->obj);
+               uncurry(curry->quot);
+               break;
+       default:
+               type_error(QUOTATION_TYPE,obj);
+               break;
        }
 }
 
-void interpreter_loop(void)
+void update_xt(F_WORD* word)
 {
-       CELL next;
+       word->compiledp = F;
 
-       for(;;)
+       if(word->def == T)
+               word->xt = dosym;
+       else if(type_of(word->def) == QUOTATION_TYPE)
        {
-               if(callframe_scan == callframe_end)
-               {
-                       if(cs_bot - cs == CELLS)
-                       {
-                               if(stack_chain->next)
-                                       return;
-
-                               simple_error(ERROR_CS_UNDERFLOW,F,F);
-                       }
-
-                       callframe_end = get(cs);
-                       callframe_scan = get(cs - CELLS);
-                       callframe = get(cs - CELLS * 2);
-                       cs -= CELLS * 3;
-                       continue;
-               }
-
-               next = get(callframe_scan);
-               callframe_scan += CELLS;
-
-               switch(TAG(next))
-               {
-               case WORD_TYPE:
-                       execute(untag_word_fast(next));
-                       break;
-               case WRAPPER_TYPE:
-                       dpush(untag_wrapper_fast(next)->object);
-                       break;
-               default:
-                       dpush(next);
-                       break;
-               }
+               if(profiling)
+                       word->xt = docol_profiling;
+               else
+                       word->xt = docol;
        }
+       else if(type_of(word->def) == FIXNUM_TYPE)
+               word->xt = primitives[to_fixnum(word->def)];
+       else
+               word->xt = undefined;
 }
 
-void interpreter(void)
-{
-       stack_chain->native_stack_pointer = native_stack_pointer();
-       SETJMP(stack_chain->toplevel);
-       handle_error();
-       interpreter_loop();
-}
-
-/* Called by compiled callbacks after nest_stacks() and boxing registers */
-void run_callback(CELL quot)
-{
-       call(quot);
-       run();
-}
-
-/* XT of deferred words */
-void undefined(F_WORD* word)
-{
-       simple_error(ERROR_UNDEFINED_WORD,tag_word(word),F);
-}
-
-/* XT of compound definitions */
-void docol(F_WORD* word)
-{
-       call(word->def);
-}
-
-/* pushes word parameter */
-void dosym(F_WORD* word)
-{
-       dpush(word->def);
-}
-
-void primitive_execute(void)
-{
-       execute(untag_word(dpop()));
-}
-
-void primitive_call(void)
-{
-       call(dpop());
-}
-
-void primitive_ifte(void)
-{
-       ds -= CELLS * 3;
-       call(get(ds + CELLS) == F ? get(ds + CELLS * 3) : get(ds + CELLS * 2));
-}
-
-void primitive_dispatch(void)
+DEFINE_PRIMITIVE(uncurry)
 {
-       F_ARRAY *a = untag_array_fast(dpop());
-       F_FIXNUM n = untag_fixnum_fast(dpop());
-       call(get(AREF(a,n)));
+       uncurry(dpop());
 }
 
-void primitive_getenv(void)
+DEFINE_PRIMITIVE(getenv)
 {
        F_FIXNUM e = untag_fixnum_fast(dpeek());
        drepl(userenv[e]);
 }
 
-void primitive_setenv(void)
+DEFINE_PRIMITIVE(setenv)
 {
        F_FIXNUM e = untag_fixnum_fast(dpop());
        CELL value = dpop();
        userenv[e] = value;
 }
 
-void primitive_exit(void)
+DEFINE_PRIMITIVE(exit)
 {
-       exit(unbox_signed_cell());
+       exit(to_fixnum(dpop()));
 }
 
-void primitive_os_env(void)
+DEFINE_PRIMITIVE(os_env)
 {
        char *name = unbox_char_string();
        char *value = getenv(name);
@@ -187,190 +72,215 @@ void primitive_os_env(void)
                box_char_string(value);
 }
 
-void primitive_eq(void)
+DEFINE_PRIMITIVE(eq)
 {
        CELL lhs = dpop();
        CELL rhs = dpeek();
        drepl((lhs == rhs) ? T : F);
 }
 
-void primitive_millis(void)
+DEFINE_PRIMITIVE(millis)
 {
        box_unsigned_8(current_millis());
 }
 
-void primitive_type(void)
+DEFINE_PRIMITIVE(sleep)
+{
+       sleep_millis(to_cell(dpop()));
+}
+
+DEFINE_PRIMITIVE(type)
 {
        drepl(tag_fixnum(type_of(dpeek())));
 }
 
-void primitive_tag(void)
+DEFINE_PRIMITIVE(tag)
 {
        drepl(tag_fixnum(TAG(dpeek())));
 }
 
-void primitive_slot(void)
+DEFINE_PRIMITIVE(class_hash)
+{
+       CELL obj = dpeek();
+       CELL tag = TAG(obj);
+       if(tag == TUPLE_TYPE)
+       {
+               F_WORD *class = untag_object(get(SLOT(obj,2)));
+               drepl(class->hashcode);
+       }
+       else if(tag == OBJECT_TYPE)
+               drepl(get(UNTAG(obj)));
+       else
+               drepl(tag_fixnum(tag));
+}
+
+DEFINE_PRIMITIVE(slot)
 {
        F_FIXNUM slot = untag_fixnum_fast(dpop());
-       CELL obj = UNTAG(dpop());
+       CELL obj = dpop();
        dpush(get(SLOT(obj,slot)));
 }
 
-void primitive_set_slot(void)
+DEFINE_PRIMITIVE(set_slot)
 {
        F_FIXNUM slot = untag_fixnum_fast(dpop());
-       CELL obj = UNTAG(dpop());
+       CELL obj = dpop();
        CELL value = dpop();
        set_slot(obj,slot,value);
 }
 
-void primitive_clone(void)
-{
-       CELL size = object_size(dpeek());
-       void *new_obj = allot(size);
-       CELL tag = TAG(dpeek());
-       memcpy(new_obj,(void*)UNTAG(dpeek()),size);
-       drepl(RETAG(new_obj,tag));
-}
-
 void fatal_error(char* msg, CELL tagged)
 {
-       fprintf(stderr,"Fatal error: %s %lx\n",msg,tagged);
+       fprintf(stderr,"fatal_error: %s %lx\n",msg,tagged);
        exit(1);
 }
 
 void critical_error(char* msg, CELL tagged)
 {
-       fprintf(stderr,"Critical error: %s %lx\n",msg,tagged);
+       fprintf(stderr,"You have triggered a bug in Factor. Please report.\n");
+       fprintf(stderr,"critical_error: %s %lx\n",msg,tagged);
        factorbug();
 }
 
-void early_error(CELL error)
+void throw_error(CELL error, F_STACK_FRAME *callstack_top)
 {
-       if(userenv[BREAK_ENV] == F)
+       /* If error was thrown during heap scan, we re-enable the GC */
+       gc_off = false;
+
+       /* Reset local roots */
+       extra_roots = stack_chain->extra_roots;
+
+       /* If we had an underflow or overflow, stack pointers might be
+       out of bounds */
+       fix_stacks();
+
+       dpush(error);
+
+       /* If the error handler is set, we rewind any C stack frames and
+       pass the error to user-space. */
+       if(userenv[BREAK_ENV] != F)
+       {
+               /* 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 = stack_chain->callstack_top;
+
+               throw_impl(userenv[BREAK_ENV],callstack_top);
+       }
+       /* Error was thrown in early startup before error handler is set, just
+       crash. */
+       else
        {
-               /* Crash at startup */
-               fprintf(stderr,"Error during startup: ");
+               fprintf(stderr,"You have triggered a bug in Factor. Please report.\n");
+               fprintf(stderr,"early_error: ");
                print_obj(error);
                fprintf(stderr,"\n");
                factorbug();
        }
 }
 
-/* allocates memory */
-CELL allot_native_stack_trace(F_STACK_FRAME *stack)
+void general_error(F_ERRORTYPE error, CELL arg1, CELL arg2,
+       F_STACK_FRAME *callstack_top)
 {
-       GROWABLE_ARRAY(array);
-
-       while(stack < stack_chain->native_stack_pointer)
-       {
-               CELL return_address = RETURN_ADDRESS(stack);
-
-               if(return_address >= compiling.base
-                       && return_address <= compiling.limit)
-               {
-                       REGISTER_ARRAY(array);
-                       CELL cell = allot_cell(return_address);
-                       UNREGISTER_ARRAY(array);
-                       GROWABLE_ADD(array,cell);
-               }
-
-               F_STACK_FRAME *prev = PREVIOUS_FRAME(stack);
-
-               if(prev <= stack)
-               {
-                       fprintf(stderr,"*** Unusual C stack layout (why?)\n");
-                       fflush(stderr);
-                       break;
-               }
-
-               stack = prev;
-       }
-
-       GROWABLE_TRIM(array);
-
-       return tag_object(array);
+       throw_error(allot_array_4(userenv[ERROR_ENV],
+               tag_fixnum(error),arg1,arg2),callstack_top);
 }
 
-void throw_error(CELL error, bool keep_stacks, F_STACK_FRAME *native_stack)
+void type_error(CELL type, CELL tagged)
 {
-       early_error(error);
-
-       REGISTER_ROOT(error);
-       thrown_native_stack_trace = allot_native_stack_trace(native_stack);
-       UNREGISTER_ROOT(error);
-
-       throwing = true;
-       thrown_error = error;
-       thrown_keep_stacks = keep_stacks;
-       thrown_ds = ds;
-       thrown_rs = rs;
-
-       /* Return to interpreter() function */
-       LONGJMP(stack_chain->toplevel,1);
+       general_error(ERROR_TYPE,tag_fixnum(type),tagged,NULL);
 }
 
-void primitive_throw(void)
+void not_implemented_error(void)
 {
-       throw_error(dpop(),true,native_stack_pointer());
+       general_error(ERROR_NOT_IMPLEMENTED,F,F,NULL);
 }
 
-void primitive_die(void)
+/* This function is called from the undefined function in cpu_*.S */
+void undefined_error(CELL word, F_STACK_FRAME *callstack_top)
 {
-       factorbug();
+       stack_chain->callstack_top = callstack_top;
+       general_error(ERROR_UNDEFINED_WORD,word,F,NULL);
 }
 
-void general_error(F_ERRORTYPE error, CELL arg1, CELL arg2,
-       bool keep_stacks, F_STACK_FRAME *native_stack)
+/* 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 in_page(CELL fault, CELL area, CELL area_size, int offset)
 {
-       throw_error(allot_array_4(userenv[ERROR_ENV],
-               tag_fixnum(error),arg1,arg2),keep_stacks,native_stack);
-}
+       int pagesize = getpagesize();
+       area += area_size;
+       area += offset * pagesize;
 
-void simple_error(F_ERRORTYPE error, CELL arg1, CELL arg2)
-{
-       general_error(error,arg1,arg2,true,native_stack_pointer());
+       return fault >= area && fault <= area + pagesize;
 }
 
-void memory_protection_error(CELL addr, int signal, F_STACK_FRAME *native_stack)
+void memory_protection_error(CELL addr, F_STACK_FRAME *native_stack)
 {
-       gc_off = true;
-
        if(in_page(addr, ds_bot, 0, -1))
-               general_error(ERROR_DS_UNDERFLOW,F,F,false,native_stack);
+               general_error(ERROR_DS_UNDERFLOW,F,F,native_stack);
        else if(in_page(addr, ds_bot, ds_size, 0))
-               general_error(ERROR_DS_OVERFLOW,F,F,false,native_stack);
+               general_error(ERROR_DS_OVERFLOW,F,F,native_stack);
        else if(in_page(addr, rs_bot, 0, -1))
-               general_error(ERROR_RS_UNDERFLOW,F,F,false,native_stack);
+               general_error(ERROR_RS_UNDERFLOW,F,F,native_stack);
        else if(in_page(addr, rs_bot, rs_size, 0))
-               general_error(ERROR_RS_OVERFLOW,F,F,false,native_stack);
-       else if(in_page(addr, cs_bot, 0, -1))
-               general_error(ERROR_CS_UNDERFLOW,F,F,false,native_stack);
-       else if(in_page(addr, cs_bot, cs_size, 0))
-               general_error(ERROR_CS_OVERFLOW,F,F,false,native_stack);
-       else if(in_page(addr, nursery.limit, 0, 0))
-               critical_error("Out of memory in allot",0);
-
-       signal_error(signal,native_stack);
+               general_error(ERROR_RS_OVERFLOW,F,F,native_stack);
+       else if(in_page(addr, nursery->end, 0, 0))
+               critical_error("allot_object() missed GC check",0);
+       else if(in_page(addr, extra_roots_region->start, 0, -1))
+               critical_error("local root underflow",0);
+       else if(in_page(addr, extra_roots_region->end, 0, 0))
+               critical_error("local root overflow",0);
+       else
+               general_error(ERROR_MEMORY,allot_cell(addr),F,native_stack);
 }
 
 void signal_error(int signal, F_STACK_FRAME *native_stack)
 {
-       gc_off = true;
-       general_error(ERROR_SIGNAL,tag_fixnum(signal),F,false,native_stack);
+       general_error(ERROR_SIGNAL,tag_fixnum(signal),F,native_stack);
 }
 
-void type_error(CELL type, CELL tagged)
+void divide_by_zero_error(F_STACK_FRAME *native_stack)
 {
-       simple_error(ERROR_TYPE,tag_fixnum(type),tagged);
+       general_error(ERROR_DIVIDE_BY_ZERO,F,F,native_stack);
 }
 
-void divide_by_zero_error(void)
+DEFINE_PRIMITIVE(throw)
 {
-       simple_error(ERROR_DIVIDE_BY_ZERO,F,F);
+       uncurry(dpop());
+       throw_impl(dpop(),stack_chain->callstack_top);
 }
 
-void memory_error(void)
+void enable_word_profiling(F_WORD *word)
 {
-       simple_error(ERROR_MEMORY,F,F);
+       if(word->xt == docol)
+               word->xt = docol_profiling;
+}
+
+void disable_word_profiling(F_WORD *word)
+{
+       if(word->xt == docol_profiling)
+               word->xt = docol;
+}
+
+DEFINE_PRIMITIVE(profiling)
+{
+       profiling = to_boolean(dpop());
+
+       begin_scan();
+
+       CELL obj;
+       while((obj = next_object()) != F)
+       {
+               if(type_of(obj) == WORD_TYPE)
+               {
+                       if(profiling)
+                               enable_word_profiling(untag_object(obj));
+                       else
+                               disable_word_profiling(untag_object(obj));
+               }
+       }
+
+       gc_off = false; /* end heap scan */
 }
index e0a9c7783ccc59d8e3b9b9cd5fd835c4d034b7cf..732880ce9743377179cdf4e4ca9fe78903824bd7 100644 (file)
--- a/vm/run.h
+++ b/vm/run.h
@@ -1,36 +1,61 @@
-/* Callstack top pointer */
-CELL cs;
+/* Is profiling on? */
+DLLEXPORT bool profiling;
 
-/* TAGGED currently executing quotation */
-CELL callframe;
-
-/* UNTAGGED currently executing word in quotation */
-CELL callframe_scan;
-
-/* UNTAGGED end of quotation */
-CELL callframe_end;
-
-#define USER_ENV 32
+#define USER_ENV 40
 
 typedef enum {
-       CELL_SIZE_ENV      = 1, /* sizeof(CELL) */
-       NLX_VECTOR_ENV,         /* non-local exit hook, used by library only */
-       NAMESTACK_ENV,          /* used by library only */
-       GLOBAL_ENV,             
-       BREAK_ENV,              
-       CATCHSTACK_ENV,         /* used by library only */
-       CPU_ENV,                
-       BOOT_ENV,               
-       CALLCC_1_ENV,           /* used by library only */
-       ARGS_ENV,               
-       OS_ENV,                 
-       ERROR_ENV,              /* a marker consed onto kernel errors */
-       IN_ENV,                 
-       OUT_ENV,                
-       GEN_ENV,                /* set to gen_count */
-       IMAGE_ENV               /* image name */
+       NAMESTACK_ENV,            /* used by library only */
+       CATCHSTACK_ENV,           /* used by library only, per-callback */
+
+       CURRENT_CALLBACK_ENV = 2, /* used by library only, per-callback */
+       WALKER_HOOK_ENV,          /* non-local exit hook, used by library only */
+       CALLCC_1_ENV,             /* used to pass the value in callcc1 */
+                                  
+       BREAK_ENV            = 5, /* quotation called by throw primitive */
+       ERROR_ENV,                /* a marker consed onto kernel errors */
+                                  
+       CELL_SIZE_ENV        = 7, /* sizeof(CELL) */
+       CPU_ENV,                  /* CPU architecture */
+       OS_ENV,                   /* operating system name */
+                                  
+       ARGS_ENV            = 10, /* command line arguments */
+       IN_ENV,                   /* stdin FILE* handle */
+       OUT_ENV,                  /* stdout FILE* handle */
+                                  
+       IMAGE_ENV           = 13, /* image path name */
+       EXECUTABLE_ENV,           /* runtime executable path name */
+                                  
+       EMBEDDED_ENV        = 15, /* are we embedded in another app? */
+       EVAL_CALLBACK_ENV,        /* used when Factor is embedded in a C app */
+       YIELD_CALLBACK_ENV,       /* used when Factor is embedded in a C app */
+       SLEEP_CALLBACK_ENV,       /* used when Factor is embedded in a C app */
+
+       COCOA_EXCEPTION_ENV = 19, /* Cocoa exception handler quotation */
+
+       BOOT_ENV            = 20, /* boot quotation */
+       GLOBAL_ENV,               /* global namespace */
+
+       /* Used by the JIT compiler */
+       JIT_CODE_FORMAT     = 22,
+       JIT_SETUP,
+       JIT_PROLOG,
+       JIT_WORD_PRIMITIVE_JUMP,
+       JIT_WORD_PRIMITIVE_CALL,
+       JIT_WORD_JUMP,
+       JIT_WORD_CALL,
+       JIT_PUSH_WRAPPER,
+       JIT_PUSH_LITERAL,
+       JIT_IF_WORD,
+       JIT_IF_JUMP,
+       JIT_IF_CALL,
+       JIT_DISPATCH_WORD,
+       JIT_DISPATCH,
+       JIT_EPILOG,
+       JIT_RETURN,
 } F_ENVTYPE;
 
+#define FIRST_SAVE_ENV BOOT_ENV
+
 /* TAGGED user environment data; see getenv/setenv prims */
 DLLEXPORT CELL userenv[USER_ENV];
 
@@ -56,24 +81,24 @@ INLINE void cput(CELL where, u16 what)
        *((u16*)where) = what;
 }
 
-INLINE CELL align8(CELL a)
+INLINE CELL align(CELL a, CELL b)
 {
-       return (a + 7) & ~7;
+       return (a + b) & ~b;
 }
 
+#define align8(a) align(a,7)
+#define align_page(a) align(a,getpagesize() - 1)
+
 /* Canonical T object. It's just a word */
 CELL T;
 
 INLINE CELL tag_header(CELL cell)
 {
-       return RETAG(cell << TAG_BITS,OBJECT_TYPE);
+       return cell << TAG_BITS;
 }
 
 INLINE CELL untag_header(CELL cell)
 {
-       /* if((cell & TAG_MASK) != OBJECT_TYPE)
-               critical_error("Corrupt object header",cell); */
-
        return cell >> TAG_BITS;
 }
 
@@ -89,12 +114,11 @@ INLINE CELL object_type(CELL tagged)
 
 INLINE CELL type_of(CELL tagged)
 {
-       if(tagged == F)
-               return F_TYPE;
-       else if(TAG(tagged) == FIXNUM_TYPE)
-               return FIXNUM_TYPE;
-       else
+       CELL tag = TAG(tagged);
+       if(tag == OBJECT_TYPE)
                return object_type(tagged);
+       else
+               return tag;
 }
 
 #define DEFPUSHPOP(prefix,ptr) \
@@ -121,32 +145,23 @@ INLINE CELL type_of(CELL tagged)
 DEFPUSHPOP(d,ds)
 DEFPUSHPOP(r,rs)
 
-void call(CELL quot);
-
-void handle_error();
-void interpreter_loop(void);
-void interpreter(void);
-DLLEXPORT void run_callback(CELL quot);
-void run(void);
-void run_toplevel(void);
-void undefined(F_WORD *word);
-void docol(F_WORD *word);
-void dosym(F_WORD *word);
-void primitive_execute(void);
-void primitive_call(void);
-void primitive_ifte(void);
-void primitive_dispatch(void);
-void primitive_getenv(void);
-void primitive_setenv(void);
-void primitive_exit(void);
-void primitive_os_env(void);
-void primitive_eq(void);
-void primitive_millis(void);
-void primitive_type(void);
-void primitive_tag(void);
-void primitive_slot(void);
-void primitive_set_slot(void);
-void primitive_clone(void);
+void update_xt(F_WORD* word);
+
+DECLARE_PRIMITIVE(execute);
+DECLARE_PRIMITIVE(call);
+DECLARE_PRIMITIVE(uncurry);
+DECLARE_PRIMITIVE(getenv);
+DECLARE_PRIMITIVE(setenv);
+DECLARE_PRIMITIVE(exit);
+DECLARE_PRIMITIVE(os_env);
+DECLARE_PRIMITIVE(eq);
+DECLARE_PRIMITIVE(millis);
+DECLARE_PRIMITIVE(sleep);
+DECLARE_PRIMITIVE(type);
+DECLARE_PRIMITIVE(tag);
+DECLARE_PRIMITIVE(class_hash);
+DECLARE_PRIMITIVE(slot);
+DECLARE_PRIMITIVE(set_slot);
 
 /* Runtime errors */
 typedef enum
@@ -157,52 +172,37 @@ typedef enum
        ERROR_TYPE,
        ERROR_DIVIDE_BY_ZERO,
        ERROR_SIGNAL,
-       ERROR_NEGATIVE_ARRAY_SIZE,
+       ERROR_ARRAY_SIZE,
        ERROR_C_STRING,
        ERROR_FFI,
        ERROR_HEAP_SCAN,
        ERROR_UNDEFINED_SYMBOL,
-       ERROR_USER_INTERRUPT,
        ERROR_DS_UNDERFLOW,
        ERROR_DS_OVERFLOW,
        ERROR_RS_UNDERFLOW,
        ERROR_RS_OVERFLOW,
-       ERROR_CS_UNDERFLOW,
-       ERROR_CS_OVERFLOW,
        ERROR_MEMORY,
-       ERROR_OBJECTIVE_C
+       ERROR_NOT_IMPLEMENTED,
 } F_ERRORTYPE;
 
-/* Are we throwing an error? */
-/* XXX Why is this volatile? The resulting executable crashes when compiled
-under gcc on windows otherwise. Proper fix pending */
-volatile bool throwing;
-/* When throw_error throws an error, it sets this global and
-longjmps back to the top-level. */
-CELL thrown_error;
-CELL thrown_native_stack_trace;
-CELL thrown_keep_stacks;
-/* Since longjmp restores registers, we must save all these values. */
-CELL thrown_ds;
-CELL thrown_rs;
-
 void fatal_error(char* msg, CELL tagged);
 void critical_error(char* msg, CELL tagged);
-void throw_error(CELL error, bool keep_stacks, F_STACK_FRAME *native_stack);
-void early_error(CELL error);
-void general_error(F_ERRORTYPE error, CELL arg1, CELL arg2,
-       bool keep_stacks, F_STACK_FRAME *native_stack);
-void simple_error(F_ERRORTYPE error, CELL arg1, CELL arg2);
-void memory_protection_error(CELL addr, int signal, F_STACK_FRAME *native_stacks);
+DECLARE_PRIMITIVE(die);
+
+void throw_error(CELL error, F_STACK_FRAME *native_stack);
+void general_error(F_ERRORTYPE error, CELL arg1, CELL arg2, F_STACK_FRAME *native_stack);
+void divide_by_zero_error(F_STACK_FRAME *native_stack);
+void memory_protection_error(CELL addr, F_STACK_FRAME *native_stack);
 void signal_error(int signal, F_STACK_FRAME *native_stack);
 void type_error(CELL type, CELL tagged);
-void divide_by_zero_error(void);
-void memory_error(void);
-void primitive_throw(void);
-void primitive_die(void);
+void not_implemented_error(void);
+void undefined_error(CELL word, F_STACK_FRAME *callstack_top);
+
+DECLARE_PRIMITIVE(throw);
 
 INLINE void type_check(CELL type, CELL tagged)
 {
-       if(type_of(tagged) != type)
-               type_error(type,tagged);
+       if(type_of(tagged) != type) type_error(type,tagged);
 }
+
+DECLARE_PRIMITIVE(profiling);
index e23e632eb3bf5e52652058157d04117c2576d380..9c36389b40ca49cc8c569446d4d23873c13457a7 100644 (file)
@@ -1,4 +1,4 @@
-#include "factor.h"
+#include "master.h"
 
 void reset_datastack(void)
 {
@@ -10,41 +10,36 @@ void reset_retainstack(void)
        rs = rs_bot - CELLS;
 }
 
-void reset_callstack(void)
+#define RESERVED (64 * CELLS)
+
+void fix_stacks(void)
 {
-       cs = cs_bot - CELLS;
+       if(ds + CELLS < ds_bot || ds + RESERVED >= ds_top) reset_datastack();
+       if(rs + CELLS < rs_bot || rs + RESERVED >= rs_top) reset_retainstack();
 }
 
-void fix_stacks(void)
+/* called before entry into Factor code. */
+void save_callstack_bottom(F_STACK_FRAME *callstack_bottom)
 {
-       if(STACK_UNDERFLOW(ds,stack_chain->data_region))
-               reset_datastack();
-       if(STACK_OVERFLOW(ds,stack_chain->data_region))
-               reset_datastack();
-       if(STACK_UNDERFLOW(rs,stack_chain->retain_region))
-               reset_retainstack();
-       if(STACK_OVERFLOW(rs,stack_chain->retain_region))
-               reset_retainstack();
-       if(STACK_UNDERFLOW(cs,stack_chain->call_region))
-               reset_callstack();
-       if(STACK_OVERFLOW(cs,stack_chain->call_region))
-               reset_callstack();
-}
-
-/* called before entry into foreign C code. Note that ds, rs and cs might
+       stack_chain->callstack_bottom = callstack_bottom;
+}
+
+/* called before entry into foreign C code. Note that ds and rs might
 be stored in registers, so callbacks must save and restore the correct values */
 void save_stacks(void)
 {
-       stack_chain->data = ds;
-       stack_chain->retain = rs;
-       stack_chain->call = cs;
+       stack_chain->datastack = ds;
+       stack_chain->retainstack = rs;
 }
 
 /* called on entry into a compiled callback */
 void nest_stacks(void)
 {
        F_CONTEXT *new_stacks = safe_malloc(sizeof(F_CONTEXT));
-       
+
+       new_stacks->callstack_bottom = (F_STACK_FRAME *)-1;
+       new_stacks->callstack_top = (F_STACK_FRAME *)-1;
+
        /* note that these register values are not necessarily valid stack
        pointers. they are merely saved non-volatile registers, and are
        restored in unnest_stacks(). consider this scenario:
@@ -55,49 +50,37 @@ void nest_stacks(void)
        - Factor callback returns
        - C function restores registers
        - C function returns to Factor code */
-       new_stacks->data_save = ds;
-       new_stacks->retain_save = rs;
-       new_stacks->call_save = cs;
-       new_stacks->cards_offset = cards_offset;
+       new_stacks->datastack_save = ds;
+       new_stacks->retainstack_save = rs;
 
-       new_stacks->callframe = callframe;
-       new_stacks->callframe_scan = callframe_scan;
-       new_stacks->callframe_end = callframe_end;
-       new_stacks->catch_save = userenv[CATCHSTACK_ENV];
+       /* save per-callback userenv */
+       new_stacks->current_callback_save = userenv[CURRENT_CALLBACK_ENV];
+       new_stacks->catchstack_save = userenv[CATCHSTACK_ENV];
 
-       new_stacks->data_region = alloc_segment(ds_size);
-       new_stacks->retain_region = alloc_segment(rs_size);
-       new_stacks->call_region = alloc_segment(cs_size);
+       new_stacks->datastack_region = alloc_segment(ds_size);
+       new_stacks->retainstack_region = alloc_segment(rs_size);
 
        new_stacks->extra_roots = extra_roots;
 
        new_stacks->next = stack_chain;
        stack_chain = new_stacks;
 
-       callframe = F;
-       callframe_scan = callframe_end = 0;
        reset_datastack();
        reset_retainstack();
-       reset_callstack();
-       update_cards_offset();
 }
 
 /* called when leaving a compiled callback */
 void unnest_stacks(void)
 {
-       dealloc_segment(stack_chain->data_region);
-       dealloc_segment(stack_chain->retain_region);
-       dealloc_segment(stack_chain->call_region);
+       dealloc_segment(stack_chain->datastack_region);
+       dealloc_segment(stack_chain->retainstack_region);
 
-       ds = stack_chain->data_save;
-       rs = stack_chain->retain_save;
-       cs = stack_chain->call_save;
-       cards_offset = stack_chain->cards_offset;
+       ds = stack_chain->datastack_save;
+       rs = stack_chain->retainstack_save;
 
-       callframe = stack_chain->callframe;
-       callframe_scan = stack_chain->callframe_scan;
-       callframe_end = stack_chain->callframe_end;
-       userenv[CATCHSTACK_ENV] = stack_chain->catch_save;
+       /* restore per-callback userenv */
+       userenv[CURRENT_CALLBACK_ENV] = stack_chain->current_callback_save;
+       userenv[CATCHSTACK_ENV] = stack_chain->catchstack_save;
 
        extra_roots = stack_chain->extra_roots;
 
@@ -107,36 +90,63 @@ void unnest_stacks(void)
 }
 
 /* called on startup */
-void init_stacks(CELL ds_size_, CELL rs_size_, CELL cs_size_)
+void init_stacks(CELL ds_size_, CELL rs_size_)
 {
        ds_size = ds_size_;
        rs_size = rs_size_;
-       cs_size = cs_size_;
        stack_chain = NULL;
-       nest_stacks();
 }
 
-void primitive_drop(void)
+void iterate_callstack(CELL top, CELL bottom, CELL base, CALLSTACK_ITER iterator)
+{
+       CELL delta = (bottom - base);
+
+#ifdef CALLSTACK_UP_P
+       F_STACK_FRAME *frame = (F_STACK_FRAME *)bottom - 1;
+       #define ITERATING_P (CELL)frame >= top
+#else
+       F_STACK_FRAME *frame = (F_STACK_FRAME *)top;
+       #define ITERATING_P (CELL)frame < bottom
+#endif
+
+       while(ITERATING_P)
+       {
+               F_STACK_FRAME *next = (F_STACK_FRAME *)((CELL)FRAME_SUCCESSOR(frame) + delta);
+               iterator(frame);
+               frame = next;
+       }
+}
+
+void iterate_callstack_object(F_CALLSTACK *stack, CALLSTACK_ITER iterator)
+{
+       CELL top = (CELL)(stack + 1);
+       CELL bottom = top + untag_fixnum_fast(stack->length);
+       CELL base = stack->bottom;
+
+       iterate_callstack(top,bottom,base,iterator);
+}
+
+DEFINE_PRIMITIVE(drop)
 {
        dpop();
 }
 
-void primitive_2drop(void)
+DEFINE_PRIMITIVE(2drop)
 {
        ds -= 2 * CELLS;
 }
 
-void primitive_3drop(void)
+DEFINE_PRIMITIVE(3drop)
 {
        ds -= 3 * CELLS;
 }
 
-void primitive_dup(void)
+DEFINE_PRIMITIVE(dup)
 {
        dpush(dpeek());
 }
 
-void primitive_2dup(void)
+DEFINE_PRIMITIVE(2dup)
 {
        CELL top = dpeek();
        CELL next = get(ds - CELLS);
@@ -145,7 +155,7 @@ void primitive_2dup(void)
        put(ds,top);
 }
 
-void primitive_3dup(void)
+DEFINE_PRIMITIVE(3dup)
 {
        CELL c1 = dpeek();
        CELL c2 = get(ds - CELLS);
@@ -156,7 +166,7 @@ void primitive_3dup(void)
        put (ds - CELLS * 2,c3);
 }
 
-void primitive_rot(void)
+DEFINE_PRIMITIVE(rot)
 {
        CELL c1 = dpeek();
        CELL c2 = get(ds - CELLS);
@@ -166,7 +176,7 @@ void primitive_rot(void)
        put(ds - CELLS * 2,c2);
 }
 
-void primitive__rot(void)
+DEFINE_PRIMITIVE(_rot)
 {
        CELL c1 = dpeek();
        CELL c2 = get(ds - CELLS);
@@ -176,7 +186,7 @@ void primitive__rot(void)
        put(ds - CELLS * 2,c1);
 }
 
-void primitive_dupd(void)
+DEFINE_PRIMITIVE(dupd)
 {
        CELL top = dpeek();
        CELL next = get(ds - CELLS);
@@ -185,7 +195,7 @@ void primitive_dupd(void)
        dpush(top);
 }
 
-void primitive_swapd(void)
+DEFINE_PRIMITIVE(swapd)
 {
        CELL top = get(ds - CELLS);
        CELL next = get(ds - CELLS * 2);
@@ -193,20 +203,20 @@ void primitive_swapd(void)
        put(ds - CELLS * 2,top);
 }
 
-void primitive_nip(void)
+DEFINE_PRIMITIVE(nip)
 {
        CELL top = dpop();
        drepl(top);
 }
 
-void primitive_2nip(void)
+DEFINE_PRIMITIVE(2nip)
 {
        CELL top = dpeek();
        ds -= CELLS * 2;
        drepl(top);
 }
 
-void primitive_tuck(void)
+DEFINE_PRIMITIVE(tuck)
 {
        CELL top = dpeek();
        CELL next = get(ds - CELLS);
@@ -215,17 +225,17 @@ void primitive_tuck(void)
        dpush(top);
 }
 
-void primitive_over(void)
+DEFINE_PRIMITIVE(over)
 {
        dpush(get(ds - CELLS));
 }
 
-void primitive_pick(void)
+DEFINE_PRIMITIVE(pick)
 {
        dpush(get(ds - CELLS * 2));
 }
 
-void primitive_swap(void)
+DEFINE_PRIMITIVE(swap)
 {
        CELL top = dpeek();
        CELL next = get(ds - CELLS);
@@ -233,107 +243,237 @@ void primitive_swap(void)
        put(ds - CELLS,top);
 }
 
-void primitive_to_r(void)
+DEFINE_PRIMITIVE(to_r)
 {
        rpush(dpop());
 }
 
-void primitive_from_r(void)
+DEFINE_PRIMITIVE(from_r)
 {
        dpush(rpop());
 }
 
-void stack_to_vector(CELL bottom, CELL top)
+void stack_to_array(CELL bottom, CELL top)
 {
-       F_FIXNUM depth = (F_FIXNUM)(top - bottom + CELLS) / CELLS;
-       if(depth < 0)
-               depth = 0;
-       F_ARRAY *a = allot_array_internal(ARRAY_TYPE,depth);
-       memcpy(a + 1,(void*)bottom,depth * CELLS);
+       F_FIXNUM depth = (F_FIXNUM)(top - bottom + CELLS);
+
+       if(depth < 0) critical_error("depth < 0",0);
+
+       F_ARRAY *a = allot_array_internal(ARRAY_TYPE,depth / CELLS);
+       memcpy(a + 1,(void*)bottom,depth);
        dpush(tag_object(a));
-       primitive_array_to_vector();
 }
 
-void primitive_datastack(void)
+DEFINE_PRIMITIVE(datastack)
+{
+       stack_to_array(ds_bot,ds);
+}
+
+DEFINE_PRIMITIVE(retainstack)
+{
+       stack_to_array(rs_bot,rs);
+}
+
+/* returns pointer to top of stack */
+CELL array_to_stack(F_ARRAY *array, CELL bottom)
 {
-       stack_to_vector(ds_bot,ds);
+       CELL depth = array_capacity(array) * CELLS;
+       memcpy((void*)bottom,array + 1,depth);
+       return bottom + depth - CELLS;
 }
 
-void primitive_retainstack(void)
+DEFINE_PRIMITIVE(set_datastack)
 {
-       stack_to_vector(rs_bot,rs);
+       ds = array_to_stack(untag_array(dpop()),ds_bot);
 }
 
-void primitive_callstack(void)
+DEFINE_PRIMITIVE(set_retainstack)
 {
-       CELL depth = (cs - cs_bot + CELLS) / CELLS - 3;
-       F_ARRAY *a = allot_array_internal(ARRAY_TYPE,depth);
-       CELL i;
-       CELL ptr = cs_bot;
-       
-       for(i = 0; i < depth; i += 3, ptr += 3 * CELLS)
+       rs = array_to_stack(untag_array(dpop()),rs_bot);
+}
+
+F_CALLSTACK *allot_callstack(CELL size)
+{
+       F_CALLSTACK *callstack = allot_object(
+               CALLSTACK_TYPE,
+               callstack_size(size));
+       callstack->length = tag_fixnum(size);
+       return callstack;
+}
+
+/* We ignore the topmost frame, the one calling 'callstack',
+so that set-callstack doesn't get stuck in an infinite loop.
+
+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. */
+F_STACK_FRAME *capture_start(void)
+{
+#ifdef CALLSTACK_UP_P
+       F_STACK_FRAME *frame = stack_chain->callstack_bottom - 1;
+       while(frame >= stack_chain->callstack_top
+               && FRAME_SUCCESSOR(frame) >= stack_chain->callstack_top)
        {
-               CELL quot = get(ptr);
-               CELL untagged = UNTAG(quot);
-               CELL position = UNAREF(untagged,get(ptr + CELLS));
-               CELL end = UNAREF(untagged,get(ptr + CELLS * 2));
-               set_array_nth(a,i,quot);
-               set_array_nth(a,i + 1,tag_fixnum(position));
-               set_array_nth(a,i + 2,tag_fixnum(end));
+               frame = FRAME_SUCCESSOR(frame);
        }
+       return frame + 1;
+#else
+       return FRAME_SUCCESSOR(stack_chain->callstack_top);
+#endif
+}
 
-       dpush(tag_object(a));
-       primitive_array_to_vector();
+DEFINE_PRIMITIVE(callstack)
+{
+       F_STACK_FRAME *top = capture_start();
+       F_STACK_FRAME *bottom = stack_chain->callstack_bottom;
+
+       F_FIXNUM size = (CELL)bottom - (CELL)top;
+       if(size < 0)
+               size = 0;
+
+       F_CALLSTACK *callstack = allot_callstack(size);
+       callstack->bottom = (CELL)bottom;
+       memcpy(FIRST_STACK_FRAME(callstack),top,size);
+       dpush(tag_object(callstack));
 }
 
-/* returns pointer to top of stack */
-CELL vector_to_stack(F_VECTOR* vector, CELL bottom)
+/* If a callstack object was captured at a different base stack height than
+we have now, we have to patch up the back-chain pointers. */
+static F_FIXNUM delta;
+
+void adjust_stack_frame(F_STACK_FRAME *frame)
+{
+       FRAME_SUCCESSOR(frame) = (F_STACK_FRAME *)((CELL)FRAME_SUCCESSOR(frame) + delta);
+}
+
+void adjust_callstack(F_CALLSTACK *stack, CELL bottom)
+{
+       delta = (bottom - stack->bottom);
+       iterate_callstack_object(stack,adjust_stack_frame);
+       stack->bottom = bottom;
+}
+
+DEFINE_PRIMITIVE(set_callstack)
+{
+       F_CALLSTACK *stack = untag_callstack(dpop());
+
+       CELL bottom = (CELL)stack_chain->callstack_bottom;
+
+       if(stack->bottom != bottom)
+               adjust_callstack(stack,bottom);
+
+       set_callstack(stack_chain->callstack_bottom,
+               FIRST_STACK_FRAME(stack),
+               untag_fixnum_fast(stack->length),
+               memcpy);
+
+       /* We cannot return here ... */
+       critical_error("Bug in set_callstack()",0);
+}
+
+/* C doesn't have closures... */
+static CELL frame_count;
+static CELL frame_index;
+static F_ARRAY *array;
+
+void count_stack_frame(F_STACK_FRAME *frame) {
+       frame_count += 2; 
+}
+
+CELL frame_type(F_STACK_FRAME *frame)
 {
-       CELL start = bottom;
-       CELL len = untag_fixnum_fast(vector->top) * CELLS;
-       memcpy((void*)start,untag_array_fast(vector->array) + 1,len);
-       return start + len - CELLS;
+       return xt_to_compiled(frame->xt)->type;
 }
 
-void primitive_set_datastack(void)
+CELL frame_executing(F_STACK_FRAME *frame)
 {
-       ds = vector_to_stack(untag_vector(dpop()),ds_bot);
+       F_COMPILED *compiled = xt_to_compiled(frame->xt);
+       CELL code_start = (CELL)(compiled + 1);
+       CELL literal_start = code_start
+               + compiled->code_length
+               + compiled->reloc_length;
+
+       return get(literal_start);
 }
 
-void primitive_set_retainstack(void)
+void stack_frame_to_array(F_STACK_FRAME *frame)
 {
-       rs = vector_to_stack(untag_vector(dpop()),rs_bot);
+       CELL offset;
+
+       if(frame_type(frame) == QUOTATION_TYPE)
+               offset = tag_fixnum(UNAREF(UNTAG(frame->array),frame->scan));
+       else
+               offset = F;
+
+#ifdef CALLSTACK_UP_P
+       #define I(n) (n)
+#else
+       #define I(n) (array_capacity(array) - (n) - 1)
+#endif
+
+       set_array_nth(array,I(frame_index++),frame_executing(frame));
+       set_array_nth(array,I(frame_index++),offset);
 }
 
-void primitive_set_callstack(void)
+DEFINE_PRIMITIVE(callstack_to_array)
 {
-       F_VECTOR *v = untag_vector(dpop());
-       F_ARRAY *a = untag_array_fast(v->array);
+       F_CALLSTACK *stack = untag_callstack(dpop());
+
+       frame_count = 0;
+       iterate_callstack_object(stack,count_stack_frame);
 
-       CELL depth = untag_fixnum_fast(v->top);
-       depth -= (depth % 3);
+       REGISTER_UNTAGGED(stack);
+       array = allot_array_internal(ARRAY_TYPE,frame_count);
+       UNREGISTER_UNTAGGED(stack);
 
-       CELL i, ptr;
-       for(i = 0, ptr = cs_bot; i < depth; i += 3, ptr += 3 * CELLS)
+       /* frame_count is equal to the total length now */
+
+       frame_index = 0;
+       iterate_callstack_object(stack,stack_frame_to_array);
+
+       dpush(tag_object(array));
+}
+
+DEFINE_PRIMITIVE(array_to_callstack)
+{
+       F_ARRAY *array = untag_array(dpop());
+
+       CELL count = array_capacity(array);
+
+       if(count % 2 == 1)
        {
-               CELL quot = get(AREF(a,i));
-               type_check(QUOTATION_TYPE,quot);
+               /* malformed array? type checks below will catch it */
+               count--;
+       }
 
-               F_ARRAY *untagged = (F_ARRAY*)UNTAG(quot);
-               CELL length = array_capacity(untagged);
+       REGISTER_UNTAGGED(array);
+       F_CALLSTACK *callstack = allot_callstack(count / 2 * sizeof(F_STACK_FRAME));
+       UNREGISTER_UNTAGGED(array);
 
-               F_FIXNUM position = to_fixnum(get(AREF(a,i + 1)));
-               F_FIXNUM end = to_fixnum(get(AREF(a,i + 2)));
+       F_STACK_FRAME *next = NULL;
+       F_STACK_FRAME *current = FIRST_STACK_FRAME(callstack);
+
+       while(count > 0)
+       {
+               F_FIXNUM offset = to_fixnum(array_nth(array,--count));
 
-               if(end < 0) end = 0;
-               if(end > length) end = length;
-               if(position < 0) position = 0;
-               if(position > end) position = end;
+               F_QUOTATION *quot = untag_quotation(array_nth(array,--count));
 
-               put(ptr,quot);
-               put(ptr + CELLS,AREF(untagged,position));
-               put(ptr + CELLS * 2,AREF(untagged,end));
+               current->array = quot->array;
+               current->scan = AREF(UNTAG(quot->array),offset);
+               current->xt = quot->xt;
+               //current->return_address = quot_offset_to_pc(quot,offset);
+
+               if(next) FRAME_SUCCESSOR(next) = current;
+
+               next = current;
+               current++;
        }
 
-       cs = cs_bot + depth * CELLS - CELLS;
+       if(next) FRAME_SUCCESSOR(next) = current;
+
+       callstack->bottom = (CELL)current;
+
+       dpush(tag_object(callstack));
 }
index e5d5395911eadea942fb82510d67e5b58fe42eb8..f07a1a76df5f5bb2a78716b3a41f064b871d2484 100644 (file)
@@ -1,89 +1,91 @@
+/* Assembly code makes assumptions about the layout of this struct:
+   - callstack_top field is 0
+   - callstack_bottom field is 1
+   - datastack field is 2
+   - retainstack field is 3 */
 typedef struct _F_CONTEXT {
+       /* C stack pointer on entry */
+       F_STACK_FRAME *callstack_top;
+       F_STACK_FRAME *callstack_bottom;
+
        /* current datastack top pointer */
-       CELL data;
-       /* saved contents of ds register on entry to callback */
-       CELL data_save;
-       /* memory region holding current datastack */
-       F_SEGMENT *data_region;
+       CELL datastack;
 
        /* current retain stack top pointer */
-       CELL retain;
-       /* saved contents of rs register on entry to callback */
-       CELL retain_save;
-       /* memory region holding current retain stack */
-       F_SEGMENT *retain_region;
+       CELL retainstack;
 
-       /* current callstack top pointer */
-       CELL call;
-       /* saved contents of cs register on entry to callback */
-       CELL call_save;
-       /* memory region holding current callstack */
-       F_SEGMENT *call_region;
+       /* saved contents of ds register on entry to callback */
+       CELL datastack_save;
 
-       /* saved callframe on entry to callback */
-       CELL callframe;
-       CELL callframe_scan;
-       CELL callframe_end;
+       /* saved contents of rs register on entry to callback */
+       CELL retainstack_save;
 
-       /* saved catchstack on entry to callback */
-       CELL catch_save;
+       /* memory region holding current datastack */
+       F_SEGMENT *datastack_region;
 
-       /* saved cards_offset register on entry to callback */
-       CELL cards_offset;
+       /* memory region holding current retain stack */
+       F_SEGMENT *retainstack_region;
+
+       /* saved userenv slots on entry to callback */
+       CELL catchstack_save;
+       CELL current_callback_save;
 
        /* saved extra_roots pointer on entry to callback */
        CELL extra_roots;
 
-       /* C stack pointer on entry */
-       F_STACK_FRAME *native_stack_pointer;
-
-       /* error handler longjmp buffer */
-       JMP_BUF toplevel;
-
        struct _F_CONTEXT *next;
 } F_CONTEXT;
 
-F_CONTEXT *stack_chain;
-
-CELL ds_size, rs_size, cs_size;
+DLLEXPORT F_CONTEXT *stack_chain;
 
-#define ds_bot ((CELL)(stack_chain->data_region->start))
-#define rs_bot ((CELL)(stack_chain->retain_region->start))
-#define cs_bot ((CELL)(stack_chain->call_region->start))
+CELL ds_size, rs_size;
 
-#define STACK_UNDERFLOW(stack,region) ((stack) + 3 * CELLS < (region)->start)
-#define STACK_OVERFLOW(stack,region) ((stack) + 3 * CELLS >= (region)->start + (region)->size)
+#define ds_bot (stack_chain->datastack_region->start)
+#define ds_top (stack_chain->datastack_region->end)
+#define rs_bot (stack_chain->retainstack_region->start)
+#define rs_top (stack_chain->retainstack_region->end)
 
 void reset_datastack(void);
 void reset_retainstack(void);
-void reset_callstack(void);
 void fix_stacks(void);
+void save_callstack_bottom(F_STACK_FRAME *callstack_bottom);
 DLLEXPORT void save_stacks(void);
 DLLEXPORT void nest_stacks(void);
 DLLEXPORT void unnest_stacks(void);
-void init_stacks(CELL ds_size, CELL rs_size, CELL cs_size);
-
-void primitive_drop(void);
-void primitive_2drop(void);
-void primitive_3drop(void);
-void primitive_dup(void);
-void primitive_2dup(void);
-void primitive_3dup(void);
-void primitive_rot(void);
-void primitive__rot(void);
-void primitive_dupd(void);
-void primitive_swapd(void);
-void primitive_nip(void);
-void primitive_2nip(void);
-void primitive_tuck(void);
-void primitive_over(void);
-void primitive_pick(void);
-void primitive_swap(void);
-void primitive_to_r(void);
-void primitive_from_r(void);
-void primitive_datastack(void);
-void primitive_retainstack(void);
-void primitive_callstack(void);
-void primitive_set_datastack(void);
-void primitive_set_retainstack(void);
-void primitive_set_callstack(void);
+void init_stacks(CELL ds_size, CELL rs_size);
+
+#define FIRST_STACK_FRAME(stack) (F_STACK_FRAME *)((stack) + 1)
+
+typedef void (*CALLSTACK_ITER)(F_STACK_FRAME *frame);
+
+void iterate_callstack(CELL top, CELL bottom, CELL base, CALLSTACK_ITER iterator);
+void iterate_callstack_object(F_CALLSTACK *stack, CALLSTACK_ITER iterator);
+CELL frame_executing(F_STACK_FRAME *frame);
+CELL frame_type(F_STACK_FRAME *frame);
+
+DECLARE_PRIMITIVE(drop);
+DECLARE_PRIMITIVE(2drop);
+DECLARE_PRIMITIVE(3drop);
+DECLARE_PRIMITIVE(dup);
+DECLARE_PRIMITIVE(2dup);
+DECLARE_PRIMITIVE(3dup);
+DECLARE_PRIMITIVE(rot);
+DECLARE_PRIMITIVE(_rot);
+DECLARE_PRIMITIVE(dupd);
+DECLARE_PRIMITIVE(swapd);
+DECLARE_PRIMITIVE(nip);
+DECLARE_PRIMITIVE(2nip);
+DECLARE_PRIMITIVE(tuck);
+DECLARE_PRIMITIVE(over);
+DECLARE_PRIMITIVE(pick);
+DECLARE_PRIMITIVE(swap);
+DECLARE_PRIMITIVE(to_r);
+DECLARE_PRIMITIVE(from_r);
+DECLARE_PRIMITIVE(datastack);
+DECLARE_PRIMITIVE(retainstack);
+DECLARE_PRIMITIVE(callstack);
+DECLARE_PRIMITIVE(set_datastack);
+DECLARE_PRIMITIVE(set_retainstack);
+DECLARE_PRIMITIVE(set_callstack);
+DECLARE_PRIMITIVE(callstack_to_array);
+DECLARE_PRIMITIVE(array_to_callstack);
index a7b5d259d2c8e7b94fed5e91c7377b4c36f2e1b0..1b9b3513dc5a9a5d935d192bd22669571d1a23c6 100644 (file)
@@ -1,4 +1,4 @@
-#include "factor.h"
+#include "master.h"
 
 /* FFI calls this */
 void box_boolean(bool value)
@@ -7,70 +7,195 @@ void box_boolean(bool value)
 }
 
 /* FFI calls this */
-bool unbox_boolean(void)
+bool to_boolean(CELL value)
 {
-       return (dpop() != F);
+       return value != F;
 }
 
 /* the array is full of undefined data, and must be correctly filled before the
 next GC. size is in cells */
-F_ARRAY *allot_array_internal(CELL type, F_FIXNUM capacity)
+F_ARRAY *allot_array_internal(CELL type, CELL capacity)
 {
-       F_ARRAY *array;
-
-       if(capacity < 0)
-       {
-               simple_error(ERROR_NEGATIVE_ARRAY_SIZE,allot_integer(capacity),F);
-               return NULL;
-       }
-       else
-       {
-               array = allot_object(type,array_size(capacity));
-               array->capacity = tag_fixnum(capacity);
-               return array;
-       }
+       F_ARRAY *array = allot_object(type,array_size(capacity));
+       array->capacity = tag_fixnum(capacity);
+       return array;
 }
 
 /* make a new array with an initial element */
-F_ARRAY *allot_array(CELL type, F_FIXNUM capacity, CELL fill)
+F_ARRAY *allot_array(CELL type, CELL capacity, CELL fill)
 {
        int i;
        REGISTER_ROOT(fill);
        F_ARRAY* array = allot_array_internal(type, capacity);
        UNREGISTER_ROOT(fill);
-       for(i = 0; i < capacity; i++)
-               set_array_nth(array,i,fill);
+       if(fill == 0)
+               memset((void*)AREF(array,0),'\0',capacity * CELLS);
+       else
+       {
+               for(i = 0; i < capacity; i++)
+                       set_array_nth(array,i,fill);
+       }
        return array;
 }
 
 /* size is in bytes this time */
-F_ARRAY *allot_byte_array(F_FIXNUM size)
+F_BYTE_ARRAY *allot_byte_array(CELL size)
 {
-       if(size < 0)
-       {
-               simple_error(ERROR_NEGATIVE_ARRAY_SIZE,allot_integer(size),F);
-               return NULL;
-       }
+       F_BYTE_ARRAY *array = allot_object(BYTE_ARRAY_TYPE,
+               byte_array_size(size));
+       array->capacity = tag_fixnum(size);
+       memset(array + 1,0,size);
+       return array;
+}
+
+/* size is in bits */
+F_BIT_ARRAY *allot_bit_array(CELL size)
+{
+       F_BIT_ARRAY *array = allot_object(BIT_ARRAY_TYPE,
+               bit_array_size(size));
+       array->capacity = tag_fixnum(size);
+       memset(array + 1,0,(size + 31) / 32 * 4);
+       return array;
+}
+
+/* size is in 8-byte doubles */
+F_BIT_ARRAY *allot_float_array(CELL size, double initial)
+{
+       F_FLOAT_ARRAY *array = allot_object(FLOAT_ARRAY_TYPE,
+               float_array_size(size));
+       array->capacity = tag_fixnum(size);
 
-       CELL byte_size = (size + sizeof(CELL) - 1) / sizeof(CELL);
-       return allot_array(BYTE_ARRAY_TYPE,byte_size,0);
+       double *elements = (double *)AREF(array,0);
+       int i;
+       for(i = 0; i < size; i++)
+               elements[i] = initial;
+
+       return array;
 }
 
 /* push a new array on the stack */
-void primitive_array(void)
+DEFINE_PRIMITIVE(array)
 {
        CELL initial = dpop();
-       F_FIXNUM size = unbox_signed_cell();
+       CELL size = unbox_array_size();
        dpush(tag_object(allot_array(ARRAY_TYPE,size,initial)));
 }
 
-/* push a new byte on the stack */
-void primitive_byte_array(void)
+/* push a new tuple on the stack */
+DEFINE_PRIMITIVE(tuple)
+{
+       CELL size = unbox_array_size();
+       F_ARRAY *array = allot_array(TUPLE_TYPE,size,F);
+       set_array_nth(array,0,dpop());
+       dpush(tag_tuple(array));
+}
+
+/* push a new tuple on the stack, filling its slots from the stack */
+DEFINE_PRIMITIVE(tuple_boa)
+{
+       CELL size = unbox_array_size();
+       F_ARRAY *array = allot_array(TUPLE_TYPE,size,F);
+       set_array_nth(array,0,dpop());
+
+       CELL i;
+       for(i = size - 1; i >= 2; i--)
+               set_array_nth(array,i,dpop());
+
+       dpush(tag_tuple(array));
+}
+
+/* push a new byte array on the stack */
+DEFINE_PRIMITIVE(byte_array)
 {
-       F_FIXNUM size = unbox_signed_cell();
+       CELL size = unbox_array_size();
        dpush(tag_object(allot_byte_array(size)));
 }
 
+/* push a new bit array on the stack */
+DEFINE_PRIMITIVE(bit_array)
+{
+       CELL size = unbox_array_size();
+       dpush(tag_object(allot_bit_array(size)));
+}
+
+/* push a new float array on the stack */
+DEFINE_PRIMITIVE(float_array)
+{
+       double initial = untag_float(dpop());
+       CELL size = unbox_array_size();
+       dpush(tag_object(allot_float_array(size,initial)));
+}
+
+/* push a new quotation on the stack */
+DEFINE_PRIMITIVE(array_to_quotation)
+{
+       F_QUOTATION *quot = allot_object(QUOTATION_TYPE,sizeof(F_QUOTATION));
+       quot->array = dpeek();
+       quot->xt = NULL;
+
+       REGISTER_UNTAGGED(quot);
+       jit_compile(quot);
+       UNREGISTER_UNTAGGED(quot);
+
+       drepl(tag_object(quot));
+}
+
+DEFINE_PRIMITIVE(quotation_xt)
+{
+       F_QUOTATION *quot = untag_quotation(dpeek());
+       drepl(allot_cell((CELL)quot->xt));
+}
+
+CELL clone(CELL object)
+{
+       CELL size = object_size(object);
+       if(size == 0)
+               return object;
+       else
+       {
+               REGISTER_ROOT(object);
+               void *new_obj = allot_object(type_of(object),size);
+               UNREGISTER_ROOT(object);
+
+               CELL tag = TAG(object);
+               memcpy(new_obj,(void*)UNTAG(object),size);
+               return RETAG(new_obj,tag);
+       }
+}
+
+DEFINE_PRIMITIVE(clone)
+{
+       drepl(clone(dpeek()));
+}
+
+DEFINE_PRIMITIVE(tuple_to_array)
+{
+       CELL object = dpeek();
+       type_check(TUPLE_TYPE,object);
+       object = RETAG(clone(object),OBJECT_TYPE);
+       set_slot(object,0,tag_header(ARRAY_TYPE));
+       drepl(object);
+}
+
+DEFINE_PRIMITIVE(to_tuple)
+{
+       CELL object = RETAG(clone(dpeek()),TUPLE_TYPE);
+       set_slot(object,0,tag_header(TUPLE_TYPE));
+       drepl(object);
+}
+
+CELL allot_array_2(CELL v1, CELL v2)
+{
+       REGISTER_ROOT(v1);
+       REGISTER_ROOT(v2);
+       F_ARRAY *a = allot_array_internal(ARRAY_TYPE,2);
+       UNREGISTER_ROOT(v2);
+       UNREGISTER_ROOT(v1);
+       set_array_nth(a,0,v1);
+       set_array_nth(a,1,v2);
+       return tag_object(a);
+}
+
 CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4)
 {
        REGISTER_ROOT(v1);
@@ -89,7 +214,7 @@ CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4)
        return tag_object(a);
 }
 
-F_ARRAY *reallot_array(F_ARRAY* array, F_FIXNUM capacity, CELL fill)
+F_ARRAY *reallot_array(F_ARRAY* array, CELL capacity, CELL fill)
 {
        int i;
        F_ARRAY* new_array;
@@ -98,13 +223,13 @@ F_ARRAY *reallot_array(F_ARRAY* array, F_FIXNUM capacity, CELL fill)
        if(capacity < to_copy)
                to_copy = capacity;
 
-       REGISTER_ARRAY(array);
+       REGISTER_UNTAGGED(array);
        REGISTER_ROOT(fill);
 
        new_array = allot_array_internal(untag_header(array->header),capacity);
 
        UNREGISTER_ROOT(fill);
-       UNREGISTER_ARRAY(array);
+       UNREGISTER_UNTAGGED(array);
 
        memcpy(new_array + 1,array + 1,to_copy * CELLS);
        
@@ -114,119 +239,86 @@ F_ARRAY *reallot_array(F_ARRAY* array, F_FIXNUM capacity, CELL fill)
        return new_array;
 }
 
-void primitive_resize_array(void)
+DEFINE_PRIMITIVE(resize_array)
 {
        F_ARRAY* array = untag_array(dpop());
-       F_FIXNUM capacity = unbox_signed_cell();
+       CELL capacity = unbox_array_size();
        dpush(tag_object(reallot_array(array,capacity,F)));
 }
 
-void primitive_become(void)
-{
-       CELL type = unbox_signed_cell();
-       CELL obj = dpeek();
-       put(SLOT(UNTAG(obj),0),tag_header(type));
-}
-
-void primitive_array_to_vector(void)
+DEFINE_PRIMITIVE(array_to_vector)
 {
        F_VECTOR *vector = allot_object(VECTOR_TYPE,sizeof(F_VECTOR));
-       F_ARRAY *array = untag_array(dpeek());
-       vector->top = array->capacity;
-       vector->array = tag_object(array);
-       drepl(tag_object(vector));
+       vector->top = dpop();
+       vector->array = dpop();
+       dpush(tag_object(vector));
 }
 
 /* untagged */
-F_STRING* allot_string_internal(F_FIXNUM capacity)
-{
-       F_STRING* string;
-
-       if(capacity < 0)
-       {
-               simple_error(ERROR_NEGATIVE_ARRAY_SIZE,allot_integer(capacity),F);
-               return NULL;
-       }
-       else
-       {
-               string = allot_object(STRING_TYPE,
-                       sizeof(F_STRING) + (capacity + 1) * CHARS);
-               /* strings are null-terminated in memory, even though they also
-               have a length field. The null termination allows us to add
-               the sizeof(F_STRING) to a Factor string to get a C-style
-               UTF16 string for C library calls. */
-               cput(SREF(string,capacity),(u16)'\0');
-               string->length = tag_fixnum(capacity);
-               string->hashcode = F;
-               return string;
-       }
+F_STRING* allot_string_internal(CELL capacity)
+{
+       F_STRING* string = allot_object(STRING_TYPE,
+               sizeof(F_STRING) + (capacity + 1) * CHARS);
+
+       /* strings are null-terminated in memory, even though they also
+       have a length field. The null termination allows us to add
+       the sizeof(F_STRING) to a Factor string to get a C-style
+       UCS-2 string for C library calls. */
+       cput(SREF(string,capacity),(u16)'\0');
+       string->length = tag_fixnum(capacity);
+       string->hashcode = F;
+       return string;
 }
 
-/* call this after constructing a string */
-void rehash_string(F_STRING* str)
+void fill_string(F_STRING *string, CELL start, CELL capacity, CELL fill)
 {
-       s32 hash = 0;
-       CELL i;
-       CELL capacity = string_capacity(str);
-       for(i = 0; i < capacity; i++)
-               hash = (31*hash + string_nth(str,i));
-       str->hashcode = (s32)tag_fixnum(hash);
-}
+       if(fill == 0)
+               memset((void*)SREF(string,start),'\0',
+                       (capacity - start) * CHARS);
+       else
+       {
+               CELL i;
 
-void primitive_rehash_string(void)
-{
-       rehash_string(untag_string(dpop()));
+               for(i = start; i < capacity; i++)
+                       cput(SREF(string,i),fill);
+       }
 }
 
 /* untagged */
-F_STRING *allot_string(F_FIXNUM capacity, CELL fill)
+F_STRING *allot_string(CELL capacity, CELL fill)
 {
-       CELL i;
-
        F_STRING* string = allot_string_internal(capacity);
-
-       for(i = 0; i < capacity; i++)
-               cput(SREF(string,i),fill);
-
-       rehash_string(string);
-
+       fill_string(string,0,capacity,fill);
        return string;
 }
 
-void primitive_string(void)
+DEFINE_PRIMITIVE(string)
 {
-       CELL initial = unbox_unsigned_cell();
-       F_FIXNUM length = unbox_signed_cell();
+       CELL initial = to_cell(dpop());
+       CELL length = unbox_array_size();
        dpush(tag_object(allot_string(length,initial)));
 }
 
-F_STRING* reallot_string(F_STRING* string, F_FIXNUM capacity, u16 fill)
+F_STRING* reallot_string(F_STRING* string, CELL capacity, u16 fill)
 {
-       /* later on, do an optimization: if end of array is here, just grow */
-       CELL i;
        CELL to_copy = string_capacity(string);
-
        if(capacity < to_copy)
                to_copy = capacity;
 
        REGISTER_STRING(string);
-
        F_STRING *new_string = allot_string_internal(capacity);
-
        UNREGISTER_STRING(string);
 
        memcpy(new_string + 1,string + 1,to_copy * CHARS);
-
-       for(i = to_copy; i < capacity; i++)
-               cput(SREF(new_string,i),fill);
+       fill_string(new_string,to_copy,capacity,fill);
 
        return new_string;
 }
 
-void primitive_resize_string(void)
+DEFINE_PRIMITIVE(resize_string)
 {
        F_STRING* string = untag_string(dpop());
-       F_FIXNUM capacity = unbox_signed_cell();
+       CELL capacity = unbox_array_size();
        dpush(tag_object(reallot_string(string,capacity,0)));
 }
 
@@ -244,13 +336,12 @@ void primitive_resize_string(void)
                        cput(SREF(s,i),(utype)*string); \
                        string++; \
                } \
-               rehash_string(s); \
                return s; \
        } \
-       void primitive_memory_to_##type##_string(void) \
+       DEFINE_PRIMITIVE(memory_to_##type##_string) \
        { \
-               CELL length = unbox_unsigned_cell(); \
-               const type *string = (const type*)unbox_unsigned_cell(); \
+               CELL length = to_cell(dpop()); \
+               const type *string = unbox_alien(); \
                dpush(tag_object(memory_to_##type##_string(string,length))); \
        } \
        F_STRING *from_##type##_string(const type *str) \
@@ -264,7 +355,7 @@ void primitive_resize_string(void)
        { \
                dpush(str ? tag_object(from_##type##_string(str)) : F); \
        } \
-       void primitive_alien_to_##type##_string(void) \
+       DEFINE_PRIMITIVE(alien_to_##type##_string) \
        { \
                drepl(tag_object(from_##type##_string(alien_offset(dpeek())))); \
        }
@@ -285,9 +376,9 @@ bool check_string(F_STRING *s, CELL max)
        return true;
 }
 
-F_ARRAY *allot_c_string(CELL capacity, CELL size)
+F_BYTE_ARRAY *allot_c_string(CELL capacity, CELL size)
 {
-       return allot_array_internal(BYTE_ARRAY_TYPE,capacity * size / CELLS + 1);
+       return allot_byte_array((capacity + 1) * size);
 }
 
 #define STRING_TO_MEMORY(type) \
@@ -298,18 +389,18 @@ F_ARRAY *allot_c_string(CELL capacity, CELL size)
                for(i = 0; i < capacity; i++) \
                        string[i] = string_nth(s,i); \
        } \
-       void primitive_##type##_string_to_memory(void) \
+       DEFINE_PRIMITIVE(type##_string_to_memory) \
        { \
-               type *address = (type*)unbox_unsigned_cell(); \
+               type *address = unbox_alien(); \
                F_STRING *str = untag_string(dpop()); \
                type##_string_to_memory(str,address); \
        } \
-       F_ARRAY *string_to_##type##_alien(F_STRING *s, bool check) \
+       F_BYTE_ARRAY *string_to_##type##_alien(F_STRING *s, bool check) \
        { \
                CELL capacity = string_capacity(s); \
-               F_ARRAY *_c_str; \
+               F_BYTE_ARRAY *_c_str; \
                if(check && !check_string(s,sizeof(type))) \
-                       simple_error(ERROR_C_STRING,tag_object(s),F); \
+                       general_error(ERROR_C_STRING,tag_object(s),F,NULL); \
                REGISTER_STRING(s); \
                _c_str = allot_c_string(capacity,sizeof(type)); \
                UNREGISTER_STRING(s); \
@@ -323,7 +414,7 @@ F_ARRAY *allot_c_string(CELL capacity, CELL size)
                if(sizeof(type) == sizeof(u16)) \
                { \
                        if(check && !check_string(s,sizeof(type))) \
-                               simple_error(ERROR_C_STRING,tag_object(s),F); \
+                               general_error(ERROR_C_STRING,tag_object(s),F,NULL); \
                        return (type*)(s + 1); \
                } \
                else \
@@ -333,7 +424,7 @@ F_ARRAY *allot_c_string(CELL capacity, CELL size)
        { \
                return to_##type##_string(untag_string(dpop()),true); \
        } \
-       void primitive_string_to_##type##_alien(void) \
+       DEFINE_PRIMITIVE(string_to_##type##_alien) \
        { \
                CELL string, t; \
                string = dpeek(); \
@@ -345,31 +436,30 @@ F_ARRAY *allot_c_string(CELL capacity, CELL size)
 STRING_TO_MEMORY(char);
 STRING_TO_MEMORY(u16);
 
-void primitive_char_slot(void)
+DEFINE_PRIMITIVE(char_slot)
 {
-       F_STRING* string = untag_string_fast(dpop());
+       F_STRING* string = untag_object(dpop());
        CELL index = untag_fixnum_fast(dpop());
        dpush(tag_fixnum(string_nth(string,index)));
 }
 
-void primitive_set_char_slot(void)
+DEFINE_PRIMITIVE(set_char_slot)
 {
-       F_STRING* string = untag_string_fast(dpop());
+       F_STRING* string = untag_object(dpop());
        CELL index = untag_fixnum_fast(dpop());
        CELL value = untag_fixnum_fast(dpop());
        set_string_nth(string,index,value);
 }
 
-void primitive_string_to_sbuf(void)
+DEFINE_PRIMITIVE(string_to_sbuf)
 {
        F_SBUF *sbuf = allot_object(SBUF_TYPE,sizeof(F_SBUF));
-       F_STRING *string = untag_string(dpeek());
-       sbuf->top = string->length;
-       sbuf->string = tag_object(string);
-       drepl(tag_object(sbuf));
+       sbuf->top = dpop();
+       sbuf->string = dpop();
+       dpush(tag_object(sbuf));
 }
 
-void primitive_hashtable(void)
+DEFINE_PRIMITIVE(hashtable)
 {
        F_HASHTABLE* hash = allot_object(HASHTABLE_TYPE,sizeof(F_HASHTABLE));
        hash->count = F;
@@ -378,12 +468,6 @@ void primitive_hashtable(void)
        dpush(tag_object(hash));
 }
 
-void update_xt(F_WORD* word)
-{
-       word->compiledp = F;
-       word->xt = primitive_to_xt(to_fixnum(word->primitive));
-}
-
 /* <word> ( name vocabulary -- word ) */
 F_WORD *allot_word(CELL vocab, CELL name)
 {
@@ -395,44 +479,42 @@ F_WORD *allot_word(CELL vocab, CELL name)
        word->hashcode = tag_fixnum(rand());
        word->vocabulary = vocab;
        word->name = name;
-       word->primitive = tag_fixnum(0);
        word->def = F;
        word->props = F;
+       word->counter = tag_fixnum(0);
        update_xt(word);
        return word;
 }
 
-void primitive_word(void)
+DEFINE_PRIMITIVE(word)
 {
        CELL vocab = dpop();
        CELL name = dpop();
-       dpush(tag_word(allot_word(vocab,name)));
+       dpush(tag_object(allot_word(vocab,name)));
 }
 
-void primitive_update_xt(void)
+DEFINE_PRIMITIVE(update_xt)
 {
        update_xt(untag_word(dpop()));
 }
 
-void primitive_word_xt(void)
+DEFINE_PRIMITIVE(word_xt)
 {
        F_WORD *word = untag_word(dpeek());
-       drepl(allot_cell(word->xt));
+       drepl(allot_cell((CELL)word->xt));
 }
 
-void fixup_word(F_WORD* word)
+DEFINE_PRIMITIVE(wrapper)
 {
-       /* If this is a compiled word, relocate the code pointer. Otherwise,
-       reset it based on the primitive number of the word. */
-       if(word->compiledp != F)
-               code_fixup(&word->xt);
-       else
-               update_xt(word);
+       F_WRAPPER *wrapper = allot_object(WRAPPER_TYPE,sizeof(F_WRAPPER));
+       wrapper->object = dpeek();
+       drepl(tag_object(wrapper));
 }
 
-void primitive_wrapper(void)
+DEFINE_PRIMITIVE(curry)
 {
-       F_WRAPPER *wrapper = allot_object(WRAPPER_TYPE,sizeof(F_WRAPPER));
-       wrapper->object = dpeek();
-       drepl(tag_wrapper(wrapper));
+       F_CURRY *curry = allot_object(CURRY_TYPE,sizeof(F_CURRY));
+       curry->quot = dpop();
+       curry->obj = dpop();
+       dpush(tag_object(curry));
 }
index c1ebb104d97a98ada6b66621380d1eca13036e84..478b6fdb3dd2db6d4a232c94721305f55279b129 100644 (file)
@@ -1,44 +1,79 @@
-INLINE CELL tag_boolean(CELL untagged)
+/* Inline functions */
+INLINE CELL array_size(CELL size)
 {
-       return (untagged == false ? F : T);
+       return sizeof(F_ARRAY) + size * CELLS;
 }
 
-DLLEXPORT void box_boolean(bool value);
-DLLEXPORT bool unbox_boolean(void);
+INLINE CELL string_capacity(F_STRING* str)
+{
+       return untag_fixnum_fast(str->length);
+}
 
-INLINE F_ARRAY* untag_array_fast(CELL tagged)
+INLINE CELL string_size(CELL size)
 {
-       return (F_ARRAY*)UNTAG(tagged);
+       return sizeof(F_STRING) + (size + 1) * CHARS;
 }
 
-INLINE F_ARRAY* untag_array(CELL tagged)
+INLINE CELL byte_array_capacity(F_BYTE_ARRAY *array)
 {
-       type_check(ARRAY_TYPE,tagged);
-       return untag_array_fast(tagged);
+       return untag_fixnum_fast(array->capacity);
 }
 
-INLINE CELL array_size(CELL size)
+INLINE CELL byte_array_size(CELL size)
 {
-       return sizeof(F_ARRAY) + size * CELLS;
+       return sizeof(F_BYTE_ARRAY) + size;
 }
 
-F_ARRAY *allot_array_internal(CELL type, F_FIXNUM capacity);
-F_ARRAY *allot_array(CELL type, F_FIXNUM capacity, CELL fill);
-F_ARRAY *allot_byte_array(F_FIXNUM size);
+INLINE CELL bit_array_capacity(F_BIT_ARRAY *array)
+{
+       return untag_fixnum_fast(array->capacity);
+}
 
-CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4);
+INLINE CELL bit_array_size(CELL size)
+{
+       return sizeof(F_BIT_ARRAY) + (size + 7) / 8;
+}
+
+INLINE CELL float_array_capacity(F_FLOAT_ARRAY *array)
+{
+       return untag_fixnum_fast(array->capacity);
+}
+
+INLINE CELL float_array_size(CELL size)
+{
+       return sizeof(F_FLOAT_ARRAY) + size * sizeof(double);
+}
 
-void primitive_array(void);
-void primitive_byte_array(void);
+INLINE CELL callstack_size(CELL size)
+{
+       return sizeof(F_CALLSTACK) + size;
+}
 
-F_ARRAY *reallot_array(F_ARRAY* array, F_FIXNUM capacity, CELL fill);
-void primitive_resize_array(void);
+INLINE F_CALLSTACK *untag_callstack(CELL obj)
+{
+       type_check(CALLSTACK_TYPE,obj);
+       return untag_object(obj);
+}
 
-void primitive_become(void);
+INLINE CELL tag_boolean(CELL untagged)
+{
+       return (untagged == false ? F : T);
+}
+
+INLINE F_ARRAY* untag_array(CELL tagged)
+{
+       type_check(ARRAY_TYPE,tagged);
+       return untag_object(tagged);
+}
 
 #define AREF(array,index) ((CELL)(array) + sizeof(F_ARRAY) + (index) * CELLS)
 #define UNAREF(array,ptr) (((CELL)(ptr)-(CELL)(array)-sizeof(F_ARRAY)) / CELLS)
 
+INLINE CELL array_nth(F_ARRAY *array, CELL slot)
+{
+       return get(AREF(array,slot));
+}
+
 INLINE void set_array_nth(F_ARRAY *array, CELL slot, CELL value)
 {
        put(AREF(array,slot),value);
@@ -50,153 +85,163 @@ INLINE CELL array_capacity(F_ARRAY* array)
        return array->capacity >> TAG_BITS;
 }
 
-#define GROWABLE_ARRAY(result) \
-       CELL result##_count = 0; \
-       F_ARRAY *result = allot_array(ARRAY_TYPE,100,F)
+#define SREF(string,index) ((CELL)string + sizeof(F_STRING) + index * CHARS)
 
-INLINE F_ARRAY *growable_add(F_ARRAY *result, CELL elt, CELL *result_count)
+INLINE F_STRING* untag_string(CELL tagged)
 {
-       REGISTER_ROOT(elt);
-
-       if(*result_count == array_capacity(result))
-       {
-               result = reallot_array(result,
-                       *result_count * 2,F);
-       }
-
-       UNREGISTER_ROOT(elt);
-       set_array_nth(result,*result_count,elt);
-       *result_count = *result_count + 1;
-
-       return result;
+       type_check(STRING_TYPE,tagged);
+       return untag_object(tagged);
 }
 
-#define GROWABLE_ADD(result,elt) \
-       result = growable_add(result,elt,&result##_count)
-
-#define GROWABLE_TRIM(result) result = reallot_array(result,result##_count,F)
-
-INLINE F_VECTOR* untag_vector(CELL tagged)
+INLINE CELL string_nth(F_STRING* string, CELL index)
 {
-       type_check(VECTOR_TYPE,tagged);
-       return (F_VECTOR*)UNTAG(tagged);
+       return cget(SREF(string,index));
 }
 
-F_VECTOR* vector(F_FIXNUM capacity);
-
-void primitive_array_to_vector(void);
-
-#define SREF(string,index) ((CELL)string + sizeof(F_STRING) + index * CHARS)
-
-INLINE F_STRING* untag_string_fast(CELL tagged)
+INLINE void set_string_nth(F_STRING* string, CELL index, u16 value)
 {
-       return (F_STRING*)UNTAG(tagged);
+       cput(SREF(string,index),value);
 }
 
-INLINE F_STRING* untag_string(CELL tagged)
+INLINE F_QUOTATION *untag_quotation(CELL tagged)
 {
-       type_check(STRING_TYPE,tagged);
-       return untag_string_fast(tagged);
+       type_check(QUOTATION_TYPE,tagged);
+       return untag_object(tagged);
 }
 
-INLINE CELL string_capacity(F_STRING* str)
+INLINE F_WORD *untag_word(CELL tagged)
 {
-       return str->length >> TAG_BITS;
+       type_check(WORD_TYPE,tagged);
+       return untag_object(tagged);
 }
 
-INLINE CELL string_size(CELL size)
+INLINE CELL tag_tuple(F_ARRAY *tuple)
 {
-       return sizeof(F_STRING) + (size + 1) * CHARS;
+       return RETAG(tuple,TUPLE_TYPE);
 }
 
-F_STRING* allot_string_internal(F_FIXNUM capacity);
-void rehash_string(F_STRING* str);
-void primitive_rehash_string(void);
-F_STRING* allot_string(F_FIXNUM capacity, CELL fill);
-void primitive_string(void);
-F_STRING *reallot_string(F_STRING *string, F_FIXNUM capacity, u16 fill);
-void primitive_resize_string(void);
+/* Prototypes */
+DLLEXPORT void box_boolean(bool value);
+DLLEXPORT bool to_boolean(CELL value);
+
+F_ARRAY *allot_array_internal(CELL type, CELL capacity);
+F_ARRAY *allot_array(CELL type, CELL capacity, CELL fill);
+F_BYTE_ARRAY *allot_byte_array(CELL size);
+
+CELL allot_array_2(CELL v1, CELL v2);
+CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4);
 
-bool check_string(F_STRING *s, CELL max);
+DECLARE_PRIMITIVE(array);
+DECLARE_PRIMITIVE(tuple);
+DECLARE_PRIMITIVE(tuple_boa);
+DECLARE_PRIMITIVE(byte_array);
+DECLARE_PRIMITIVE(bit_array);
+DECLARE_PRIMITIVE(float_array);
+DECLARE_PRIMITIVE(array_to_quotation);
+DECLARE_PRIMITIVE(quotation_xt);
+DECLARE_PRIMITIVE(clone);
+DECLARE_PRIMITIVE(tuple_to_array);
+DECLARE_PRIMITIVE(to_tuple);
+
+F_ARRAY *reallot_array(F_ARRAY* array, CELL capacity, CELL fill);
+DECLARE_PRIMITIVE(resize_array);
+
+DECLARE_PRIMITIVE(array_to_vector);
+
+F_STRING* allot_string_internal(CELL capacity);
+F_STRING* allot_string(CELL capacity, CELL fill);
+DECLARE_PRIMITIVE(string);
+F_STRING *reallot_string(F_STRING *string, CELL capacity, u16 fill);
+DECLARE_PRIMITIVE(resize_string);
 
 F_STRING *memory_to_char_string(const char *string, CELL length);
-void primitive_memory_to_char_string(void);
+DECLARE_PRIMITIVE(memory_to_char_string);
 F_STRING *from_char_string(const char *c_string);
 DLLEXPORT void box_char_string(const char *c_string);
-void primitive_alien_to_char_string(void);
+DECLARE_PRIMITIVE(alien_to_char_string);
 
 F_STRING *memory_to_u16_string(const u16 *string, CELL length);
-void primitive_memory_to_u16_string(void);
+DECLARE_PRIMITIVE(memory_to_u16_string);
 F_STRING *from_u16_string(const u16 *c_string);
 DLLEXPORT void box_u16_string(const u16 *c_string);
-void primitive_alien_to_u16_string(void);
+DECLARE_PRIMITIVE(alien_to_u16_string);
 
 void char_string_to_memory(F_STRING *s, char *string);
-void primitive_char_string_to_memory(void);
-F_ARRAY *string_to_char_alien(F_STRING *s, bool check);
+DECLARE_PRIMITIVE(char_string_to_memory);
+F_BYTE_ARRAY *string_to_char_alien(F_STRING *s, bool check);
 char* to_char_string(F_STRING *s, bool check);
 DLLEXPORT char *unbox_char_string(void);
-void primitive_string_to_char_alien(void);
+DECLARE_PRIMITIVE(string_to_char_alien);
 
 void u16_string_to_memory(F_STRING *s, u16 *string);
-void primitive_u16_string_to_memory(void);
-F_ARRAY *string_to_u16_alien(F_STRING *s, bool check);
+DECLARE_PRIMITIVE(u16_string_to_memory);
+F_BYTE_ARRAY *string_to_u16_alien(F_STRING *s, bool check);
 u16* to_u16_string(F_STRING *s, bool check);
 DLLEXPORT u16 *unbox_u16_string(void);
-void primitive_string_to_u16_alien(void);
+DECLARE_PRIMITIVE(string_to_u16_alien);
 
-/* untagged & unchecked */
-INLINE CELL string_nth(F_STRING* string, CELL index)
-{
-       return cget(SREF(string,index));
-}
+DECLARE_PRIMITIVE(char_slot);
+DECLARE_PRIMITIVE(set_char_slot);
 
-/* untagged & unchecked */
-INLINE void set_string_nth(F_STRING* string, CELL index, u16 value)
-{
-       cput(SREF(string,index),value);
-}
+DECLARE_PRIMITIVE(string_to_sbuf);
 
-void primitive_char_slot(void);
-void primitive_set_char_slot(void);
+DECLARE_PRIMITIVE(hashtable);
 
-void primitive_string_to_sbuf(void);
+F_WORD *allot_word(CELL vocab, CELL name);
+DECLARE_PRIMITIVE(word);
+DECLARE_PRIMITIVE(update_xt);
+DECLARE_PRIMITIVE(word_xt);
+void fixup_word(F_WORD* word);
+void fixup_quotation(F_QUOTATION *quot);
 
-void primitive_hashtable(void);
+DECLARE_PRIMITIVE(wrapper);
+DECLARE_PRIMITIVE(curry);
 
-typedef void (*XT)(F_WORD *word);
+/* Macros to simulate a vector in C */
+#define GROWABLE_ARRAY(result) \
+       CELL result##_count = 0; \
+       F_ARRAY *result = allot_array(ARRAY_TYPE,100,F)
 
-INLINE F_WORD *untag_word_fast(CELL tagged)
+INLINE F_ARRAY *growable_add(F_ARRAY *result, CELL elt, CELL *result_count)
 {
-       return (F_WORD*)UNTAG(tagged);
-}
+       REGISTER_ROOT(elt);
 
-INLINE F_WORD *untag_word(CELL tagged)
-{
-       type_check(WORD_TYPE,tagged);
-       return untag_word_fast(tagged);
-}
+       if(*result_count == array_capacity(result))
+       {
+               result = reallot_array(result,
+                       *result_count * 2,F);
+       }
 
-INLINE CELL tag_word(F_WORD *word)
-{
-       return RETAG(word,WORD_TYPE);
+       UNREGISTER_ROOT(elt);
+       set_array_nth(result,*result_count,elt);
+       *result_count = *result_count + 1;
+
+       return result;
 }
 
-void update_xt(F_WORD* word);
-F_WORD *allot_word(CELL vocab, CELL name);
-void primitive_word(void);
-void primitive_update_xt(void);
-void primitive_word_xt(void);
-void fixup_word(F_WORD* word);
+#define GROWABLE_ADD(result,elt) \
+       result = growable_add(result,elt,&result##_count)
 
-INLINE F_WRAPPER *untag_wrapper_fast(CELL tagged)
+INLINE F_ARRAY *growable_append(F_ARRAY *result, F_ARRAY *elts, CELL *result_count)
 {
-       return (F_WRAPPER*)UNTAG(tagged);
-}
+       REGISTER_UNTAGGED(elts);
 
-INLINE CELL tag_wrapper(F_WRAPPER *wrapper)
-{
-       return RETAG(wrapper,WRAPPER_TYPE);
+       CELL elts_size = array_capacity(elts);
+       CELL new_size = *result_count + elts_size;
+
+       if(new_size >= array_capacity(result))
+               result = reallot_array(result,new_size * 2,F);
+
+       UNREGISTER_UNTAGGED(elts);
+
+       memcpy((void*)AREF(result,*result_count),(void*)AREF(elts,0),elts_size * CELLS);
+
+       *result_count += elts_size;
+
+       return result;
 }
 
-void primitive_wrapper(void);
+#define GROWABLE_APPEND(result,elts) \
+       result = growable_append(result,elts,&result##_count)
+       
+#define GROWABLE_TRIM(result) result = reallot_array(result,result##_count,F)
diff --git a/vm/utilities.c b/vm/utilities.c
new file mode 100644 (file)
index 0000000..60a4ecb
--- /dev/null
@@ -0,0 +1,23 @@
+#include "master.h"
+
+/* If memory allocation fails, bail out */
+void *safe_malloc(size_t size)
+{
+       void *ptr = malloc(size);
+       if(!ptr) fatal_error("Out of memory in safe_malloc", 0);
+       return ptr;
+}
+
+void *safe_realloc(const void *ptr, size_t size)
+{
+       void *new_ptr = realloc((void *)ptr,size);
+       if(!new_ptr) fatal_error("Out of memory in safe_realloc", 0);
+       return new_ptr;
+}
+
+F_CHAR *safe_strdup(const F_CHAR *str)
+{
+       F_CHAR *ptr = STRDUP(str);
+       if(!ptr) fatal_error("Out of memory in safe_strdup", 0);
+       return ptr;
+}
diff --git a/vm/utilities.h b/vm/utilities.h
new file mode 100644 (file)
index 0000000..483e395
--- /dev/null
@@ -0,0 +1,3 @@
+void *safe_malloc(size_t size);
+void *safe_realloc(const void *ptr, size_t size);
+F_CHAR *safe_strdup(const F_CHAR *str);